From 98f2d9184214b9b60766ea22178f67037ec5312c Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 15:02:40 -0700 Subject: [PATCH 1/8] remove 'code-cpp' snippet references --- xml/System.Net.Security/NegotiateStream.xml | 168 +++----- xml/System.Net/WebClient.xml | 146 ++++--- xml/System.Xml/XmlDocument.xml | 410 +++++++++----------- xml/System.Xml/XmlValidatingReader.xml | 222 ++++------- 4 files changed, 419 insertions(+), 527 deletions(-) diff --git a/xml/System.Net.Security/NegotiateStream.xml b/xml/System.Net.Security/NegotiateStream.xml index 350ed0ef56c..c33c59a773c 100644 --- a/xml/System.Net.Security/NegotiateStream.xml +++ b/xml/System.Net.Security/NegotiateStream.xml @@ -59,11 +59,9 @@ ## Remarks Use the class for authentication and to help secure information transmitted between a client and a server. Using , you can do the following. -- Send the client's credentials to the server for Impersonation or Delegation. - -- Request server authentication. - -- Encrypt and/or sign data before transmitting it. +- Send the client's credentials to the server for Impersonation or Delegation. +- Request server authentication. +- Encrypt and/or sign data before transmitting it. Authentication must be performed before transmitting information. Clients request authentication using the synchronous methods, which block until the authentication completes, or the asynchronous methods, which do not block while waiting for the authentication to complete. Servers request authentication using the synchronous or asynchronous methods. The client, and optionally the server, is authenticated using the Negotiate security protocol. The Kerberos protocol is used for authentication if both client and server support it; otherwise NTLM is used. The class performs the authentication using the Security Support Provider Interface (SSPI). @@ -75,18 +73,15 @@ The transmits data using a stream that you supply when creating the . When you supply this underlying stream, you have the option to specify whether closing the also closes the underlying stream. - - ## Examples + The following example demonstrates the client side of a client-server connection that uses the . The client authenticates and sends a message to the server asynchronously. -[!code-cpp[NclNegoAsyncClient#0](~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp#0)] [!code-csharp[NclNegoAsyncClient#0](~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs#0)] [!code-vb[NclNegoAsyncClient#0](~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb#0)] The following code example demonstrates the server side of a client-server connection that uses the to authenticate the client and read a message sent by the client. -[!code-cpp[NclNegoAsyncServer#0](~/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp#0)] [!code-csharp[NclNegoAsyncServer#0](~/snippets/csharp/System.Net.Security/NegotiateStream/Overview/server.cs#0)] ]]> @@ -159,9 +154,9 @@ The following code example demonstrates the server side of a client-server conne @@ -216,9 +211,9 @@ The following code example demonstrates the server side of a client-server conne When you specify `true` for the `leaveStreamOpen` parameter, closing the has no effect on the `innerStream` stream; you must explicitly close `innerStream` when you no longer need it. ## Examples + The following example demonstrates calling this constructor. This code example is part of a larger example provided for the class. -[!code-cpp[NclNegoAsyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp#1)] [!code-csharp[NclNegoAsyncClient#1](~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs#1)] [!code-vb[NclNegoAsyncClient#1](~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb#1)] @@ -1700,12 +1695,10 @@ The following example demonstrates calling this constructor. This code example i If the authentication fails, you receive an or an . In this case, you can retry the authentication with a different credential. - - ## Examples + The following example demonstrates calling this method to begin an asynchronous authentication for the client. -[!code-cpp[NclNegoAsyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp#2)] [!code-csharp[NclNegoAsyncClient#2](~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs#2)] [!code-vb[NclNegoAsyncClient#2](~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb#2)] @@ -2576,12 +2569,10 @@ The following example demonstrates calling this method to begin an asynchronous You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , , , or methods. - - ## Examples + The following code example demonstrates starting an asynchronous read operation. This code example is part of a larger example provided for the class. - [!code-cpp[NclNegoAsyncServer#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp#1)] [!code-csharp[NclNegoAsyncServer#1](~/snippets/csharp/System.Net.Security/NegotiateStream/Overview/server.cs#1)] ]]> @@ -2686,18 +2677,15 @@ The following example demonstrates calling this method to begin an asynchronous You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , , , or methods. - - ## Examples + The following example demonstrates beginning an asynchronous write operation. -[!code-cpp[NclNegoAsyncClient#3](~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp#3)] [!code-csharp[NclNegoAsyncClient#3](~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs#3)] [!code-vb[NclNegoAsyncClient#3](~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb#3)] The following method is called when the operation completes. -[!code-cpp[NclNegoAsyncClient#4](~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp#4)] [!code-csharp[NclNegoAsyncClient#4](~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs#4)] [!code-vb[NclNegoAsyncClient#4](~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb#4)] @@ -2770,13 +2758,11 @@ The following method is called when the operation completes. ## Remarks If successful authentication has occurred, this property returns the value returned by invoking the property on the underlying stream. The underlying stream is specified when you create an instance of the class. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> @@ -2826,13 +2812,11 @@ The following method is called when the operation completes. ## Remarks You should not attempt to set the position of the object or its underlying stream. The underlying stream is specified when you create an instance of the class. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> @@ -2887,10 +2871,10 @@ The following method is called when the operation completes. ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> @@ -2944,10 +2928,10 @@ The following method is called when the operation completes. ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> @@ -3231,13 +3215,11 @@ The following method is called when the operation completes. You cannot call this method until you have successfully authenticated. To authenticate, call one of the , , , , , or methods. - - ## Examples - The following code example demonstrates ending an asynchronous read operation. For an example that demonstrates starting the operation, see . - [!code-cpp[NclNegoAsyncServer#3](~/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp#3)] - [!code-csharp[NclNegoAsyncServer#3](~/snippets/csharp/System.Net.Security/NegotiateStream/Overview/server.cs#3)] +The following code example demonstrates ending an asynchronous read operation. For an example that demonstrates starting the operation, see . + +[!code-csharp[NclNegoAsyncServer#3](~/snippets/csharp/System.Net.Security/NegotiateStream/Overview/server.cs#3)] ]]> @@ -3302,12 +3284,10 @@ Authentication has not occurred. To perform this operation synchronously, use the method. - - ## Examples + The following example demonstrates a method that is called to complete the asynchronous write operation. For an example that demonstrates starting the operation, see . -[!code-cpp[NclNegoAsyncClient#4](~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp#4)] [!code-csharp[NclNegoAsyncClient#4](~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs#4)] [!code-vb[NclNegoAsyncClient#4](~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb#4)] @@ -3368,13 +3348,11 @@ Authentication has not occurred. ## Remarks This method invokes on the underlying stream. - - ## Examples - The following code example demonstrates flushing the stream. - [!code-cpp[NclNegoSyncClient#4](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#4)] - [!code-csharp[NclNegoSyncClient#4](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#4)] +The following code example demonstrates flushing the stream. + +[!code-csharp[NclNegoSyncClient#4](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#4)] ]]> @@ -3471,13 +3449,11 @@ Authentication has not occurred. ## Remarks You must successfully authenticate before calling this method. Clients specify the impersonation level when they request authentication by calling one of the or methods. If you authenticate without specifying a , is used. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#1)] - [!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] ]]> @@ -3529,13 +3505,11 @@ Authentication has not occurred. ## Remarks Clients authenticate by calling the or methods. Servers authenticate by calling the or methods. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#1)] - [!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] ]]> @@ -3586,13 +3560,11 @@ Authentication has not occurred. ## Remarks Encryption helps to protect the privacy of the data; namely, it helps to ensure that while data is in transit it cannot be deciphered by third parties. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#1)] - [!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] ]]> @@ -3646,13 +3618,11 @@ Authentication has not occurred. The Negotiate protocol selects either NTLM or Kerberos depending on the security protocols supported by the client and server. NTLM does not support mutual authentication. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#1)] - [!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] ]]> @@ -3705,13 +3675,11 @@ Authentication has not occurred. To authenticate as the server, call the or methods. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#1)] - [!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] ]]> @@ -3762,13 +3730,11 @@ Authentication has not occurred. ## Remarks Data signing helps to protect the integrity of the data; namely, it helps the recipient determine whether the data has been tampered with while in transit. - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#1)] - [!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#1](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#1)] ]]> @@ -3821,10 +3787,10 @@ Authentication has not occurred. ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> @@ -3940,13 +3906,11 @@ Authentication has not occurred. To perform this operation asynchronously, use the method. - - ## Examples - The following code example demonstrates reading from a . - [!code-cpp[NclNegoSyncServer#1](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp#1)] - [!code-csharp[NclNegoSyncServer#1](~/snippets/csharp/System.Net.Security/NegotiateStream/Read/server.cs#1)] +The following code example demonstrates reading from a . + +[!code-csharp[NclNegoSyncServer#1](~/snippets/csharp/System.Net.Security/NegotiateStream/Read/server.cs#1)] ]]> @@ -4104,10 +4068,10 @@ This method reads asynchronously as much data as is available into `buffer` and ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> @@ -4157,13 +4121,11 @@ This method reads asynchronously as much data as is available into `buffer` and ## Remarks When accessed by the client, this property returns a containing the Service Principal Name (SPN) of the server and the authentication protocol used. When accessed by the server, this property returns a that describes the client. If the is not available, client information is returned to the server in a . - - ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoAsyncServer#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp#2)] - [!code-csharp[NclNegoAsyncServer#2](~/snippets/csharp/System.Net.Security/NegotiateStream/Overview/server.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoAsyncServer#2](~/snippets/csharp/System.Net.Security/NegotiateStream/Overview/server.cs#2)] ]]> @@ -4326,13 +4288,11 @@ This method reads asynchronously as much data as is available into `buffer` and The class does not support multiple simultaneous write operations. If you attempt to start a write operation while another write operation is already executing on the same stream, a exception will be thrown. - - ## Examples - The following code example demonstrates writing to a . - [!code-cpp[NclNegoSyncClient#4](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#4)] - [!code-csharp[NclNegoSyncClient#4](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#4)] +The following code example demonstrates writing to a . + +[!code-csharp[NclNegoSyncClient#4](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#4)] ]]> @@ -4521,10 +4481,10 @@ This method reads asynchronously as much data as is available into `buffer` and If the underlying stream is a , is in milliseconds and is set to by default so that write operations do not time out. ## Examples - The following code example demonstrates displaying the value of this property. - [!code-cpp[NclNegoSyncClient#2](~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp#2)] - [!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] +The following code example demonstrates displaying the value of this property. + +[!code-csharp[NclNegoSyncClient#2](~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs#2)] ]]> diff --git a/xml/System.Net/WebClient.xml b/xml/System.Net/WebClient.xml index c2c35b06d01..839c9f86173 100644 --- a/xml/System.Net/WebClient.xml +++ b/xml/System.Net/WebClient.xml @@ -110,7 +110,8 @@ is set to `true` in instances. ## Examples - The following code example takes the URI of a resource, retrieves it, and displays the response. + +The following code example takes the URI of a resource, retrieves it, and displays the response. [!code-cpp[NCLWebClientUserAgent#1](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp#1)] [!code-csharp[NCLWebClientUserAgent#1](~/snippets/csharp/System.Net/WebClient/Overview/useragent.cs#1)] @@ -178,11 +179,11 @@ The parameterless constructor creates a new instance of the class. The default HTTP method is GET. The default FTP method is RETR. The default is . The default value of is `true`. ## Examples - The following code example creates a instance and then uses it to download data from a server and display it on the system console, to download data from a server and write it to a file, and to upload form values to a server and receive the response. - [!code-cpp[WebClient#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp#1)] - [!code-csharp[WebClient#1](~/snippets/csharp/System.Net/WebClient/.ctor/webclient.cs#1)] - [!code-vb[WebClient#1](~/snippets/visualbasic/VS_Snippets_Remoting/WebClient/VB/webclient.vb#1)] +The following code example creates a instance and then uses it to download data from a server and display it on the system console, to download data from a server and write it to a file, and to upload form values to a server and receive the response. + +[!code-csharp[WebClient#1](~/snippets/csharp/System.Net/WebClient/.ctor/webclient.cs#1)] +[!code-vb[WebClient#1](~/snippets/visualbasic/VS_Snippets_Remoting/WebClient/VB/webclient.vb#1)] ]]> @@ -363,7 +364,8 @@ ## Examples - The following code example downloads data from an Internet server and displays it on the console. It assumes that the server's address (such as http://www.contoso.com) is in `hostUri` and that the path to the resource (such as /default.htm) is in `uriSuffix`. + +The following code example downloads data from an Internet server and displays it on the console. It assumes that the server's address (such as http://www.contoso.com) is in `hostUri` and that the path to the resource (such as /default.htm) is in `uriSuffix`. [!code-cpp[WebClient_BaseAddress_ResponseHeaders#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp#1)] [!code-csharp[WebClient_BaseAddress_ResponseHeaders#1](~/snippets/csharp/System.Net/WebClient/BaseAddress/webclient_baseaddress_responseheaders.cs#1)] @@ -563,7 +565,8 @@ For security reasons, when automatically following redirects, store the credentials that you want to be included in the redirect in a and assign it to this property. This property will automatically be set to `null` upon redirection if it contains anything except a . Having this property value be automatically set to `null` under those conditions prevents credentials from being sent to any unintended destination. ## Examples - The following code example uses the user's system credentials to authenticate a request. + +The following code example uses the user's system credentials to authenticate a request. [!code-cpp[WebClientAuthentication#1](~/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp#1)] [!code-csharp[WebClientAuthentication#1](~/snippets/csharp/System.Net/WebClient/Credentials/webclientauth.cs#1)] @@ -648,7 +651,8 @@ > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example requests data from a server and displays the data returned. It assumes that `remoteUri` contains a valid URI for the requested data. + +The following code example requests data from a server and displays the data returned. It assumes that `remoteUri` contains a valid URI for the requested data. [!code-cpp[WebClient_DownloadData#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp#1)] [!code-csharp[WebClient_DownloadData#1](~/snippets/csharp/System.Net/WebClient/DownloadData/webclient_downloaddata.cs#1)] @@ -967,7 +971,8 @@ ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#21](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#21)] [!code-csharp[NCLWebClientAsync#21](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#21)] @@ -1224,7 +1229,8 @@ When using this method in a middle tier application, such as an ASP.NET page, you will receive an error if the account under which the application executes does not have permission to access the file. ## Examples - The following code example downloads a file from http://www.contoso.com to the local hard drive. + +The following code example downloads a file from http://www.contoso.com to the local hard drive. [!code-cpp[WebClient_DownloadFile#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp#1)] [!code-csharp[WebClient_DownloadFile#1](~/snippets/csharp/System.Net/WebClient/DownloadFile/webclient_downloadfile.cs#1)] @@ -1586,7 +1592,8 @@ For more information about how to handle events, see [Handling and Raising Events](/dotnet/standard/events/). ## Examples - The following code example demonstrates setting an event handler for the `DownloadFileCompleted` event. + +The following code example demonstrates setting an event handler for the `DownloadFileCompleted` event. [!code-cpp[NCLWebClientAsync#19](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#19)] [!code-csharp[NCLWebClientAsync#19](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#19)] @@ -1864,7 +1871,8 @@ internal class MyWebClient : WebClientProtocol ``` ## Examples - The following code example demonstrates setting an event handler for the `DownloadProgressChanged` event. + +The following code example demonstrates setting an event handler for the `DownloadProgressChanged` event. [!code-cpp[DownloadProgressChanged](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#SnippetDownloadProgressChanged)] [!code-csharp[DownloadProgressChanged](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#SnippetDownloadProgressChanged)] @@ -1945,7 +1953,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example demonstrates calling this method. + +The following code example demonstrates calling this method. [!code-cpp[NCLWebClientAsync#25](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#25)] [!code-csharp[NCLWebClientAsync#25](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#25)] @@ -2270,7 +2279,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#28](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#28)] [!code-csharp[NCLWebClientAsync#28](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#28)] @@ -2512,7 +2522,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting the value of this property. + +The following code example demonstrates setting the value of this property. [!code-cpp[NCLWebClientAsync#1](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#1)] [!code-csharp[NCLWebClientAsync#1](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#1)] @@ -2580,7 +2591,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#1](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#1)] [!code-csharp[NCLCustomWebClient#1](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#1)] @@ -2657,7 +2669,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#2](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#2)] [!code-csharp[NCLCustomWebClient#2](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#2)] @@ -2726,7 +2739,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#3](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#3)] [!code-csharp[NCLCustomWebClient#3](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#3)] @@ -2822,7 +2836,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example uses the collection to set the HTTP `Content-Type` header to `application/x-www-form-urlencoded,` to notify the server that form data is attached to the post. + +The following code example uses the collection to set the HTTP `Content-Type` header to `application/x-www-form-urlencoded,` to notify the server that form data is attached to the post. [!code-cpp[WebClient_UpLoadData_Headers#2](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp#2)] [!code-csharp[WebClient_UpLoadData_Headers#2](~/snippets/csharp/System.Net/WebClient/Headers/webclient_uploaddata_headers.cs#2)] @@ -2937,7 +2952,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#4](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#4)] [!code-csharp[NCLCustomWebClient#4](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#4)] @@ -3008,7 +3024,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#5](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#5)] [!code-csharp[NCLCustomWebClient#5](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#5)] @@ -3079,7 +3096,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#12](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#12)] [!code-csharp[NCLCustomWebClient#12](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#12)] @@ -3150,7 +3168,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#6](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#6)] [!code-csharp[NCLCustomWebClient#6](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#6)] @@ -3221,7 +3240,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#7](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#7)] [!code-csharp[NCLCustomWebClient#7](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#7)] @@ -3292,7 +3312,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#8](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#8)] [!code-csharp[NCLCustomWebClient#8](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#8)] @@ -3363,7 +3384,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#9](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#9)] [!code-csharp[NCLCustomWebClient#9](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#9)] @@ -3434,7 +3456,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#10](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#10)] [!code-csharp[NCLCustomWebClient#10](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#10)] @@ -3505,7 +3528,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#13](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#13)] [!code-csharp[NCLCustomWebClient#13](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#13)] @@ -3573,7 +3597,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#11](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#11)] [!code-csharp[NCLCustomWebClient#11](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#11)] @@ -3644,7 +3669,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example shows an implementation of this method that can be customized by a class derived from . + +The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#14](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#14)] [!code-csharp[NCLCustomWebClient#14](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#14)] @@ -3784,7 +3810,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example opens the resource identified by `uriString` and displays the results on the system console. The returned by is closed when the data has been read. + +The following code example opens the resource identified by `uriString` and displays the results on the system console. The returned by is closed when the data has been read. [!code-cpp[WebClient_OpenRead#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp#1)] [!code-csharp[WebClient_OpenRead#1](~/snippets/csharp/System.Net/WebClient/OpenRead/webclient_openread.cs#1)] @@ -4124,7 +4151,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#30](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#30)] [!code-csharp[NCLWebClientAsync#30](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#30)] @@ -4396,7 +4424,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example reads data from the command line and uses to obtain a stream for writing the data. The returned by is closed after the data is sent. + +The following code example reads data from the command line and uses to obtain a stream for writing the data. The returned by is closed after the data is sent. [!code-cpp[WebClient_OpenWrite2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp#1)] [!code-csharp[WebClient_OpenWrite2#1](~/snippets/csharp/System.Net/WebClient/OpenWrite/webclient_openwrite2.cs#1)] @@ -4560,7 +4589,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example reads data from the command line and uses to obtain a stream used to write the data. The returned by must be closed to send the data. + +The following code example reads data from the command line and uses to obtain a stream used to write the data. The returned by must be closed to send the data. [!code-cpp[WebClient_OpenWrite#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp#1)] [!code-csharp[WebClient_OpenWrite#1](~/snippets/csharp/System.Net/WebClient/OpenWrite/webclient_openwrite.cs#1)] @@ -4968,7 +4998,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#14](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#14)] [!code-csharp[NCLWebClientAsync#14](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#14)] @@ -5474,7 +5505,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example takes user input from the command line and builds a that is assigned to the property. It then downloads the response from the server to a local file. + +The following code example takes user input from the command line and builds a that is assigned to the property. It then downloads the response from the server to a local file. [!code-cpp[WebClient_QueryString#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp#1)] [!code-csharp[WebClient_QueryString#1](~/snippets/csharp/System.Net/WebClient/QueryString/webclient_querystring.cs#1)] @@ -5544,7 +5576,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example downloads and displays the returned by a server. + +The following code example downloads and displays the returned by a server. [!code-cpp[WebClient_BaseAddress_ResponseHeaders#2](~/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp#2)] [!code-csharp[WebClient_BaseAddress_ResponseHeaders#2](~/snippets/csharp/System.Net/WebClient/BaseAddress/webclient_baseaddress_responseheaders.cs#2)] @@ -5630,7 +5663,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example converts a string entered from the console to a array and posts the array to the specified server using . Any response from the server is displayed to the console. + +The following code example converts a string entered from the console to a array and posts the array to the specified server using . Any response from the server is displayed to the console. [!code-cpp[WebClient_UpLoadData2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp#1)] [!code-csharp[WebClient_UpLoadData2#1](~/snippets/csharp/System.Net/WebClient/UploadData/webclient_uploaddata2.cs#1)] @@ -5818,7 +5852,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example converts a string entered from the console into a byte array and posts the array to the specified server using . Any response from the server is displayed to the console. + +The following code example converts a string entered from the console into a byte array and posts the array to the specified server using . Any response from the server is displayed to the console. [!code-cpp[WebClient_UpLoadData_Headers#2](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp#2)] [!code-csharp[WebClient_UpLoadData_Headers#2](~/snippets/csharp/System.Net/WebClient/Headers/webclient_uploaddata_headers.cs#2)] @@ -6285,7 +6320,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#36](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#36)] [!code-csharp[NCLWebClientAsync#36](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#36)] @@ -6743,7 +6779,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. + +The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. [!code-cpp[WebClient_UpLoadFile#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp#1)] [!code-csharp[WebClient_UpLoadFile#1](~/snippets/csharp/System.Net/WebClient/UploadFile/webclient_uploadfile.cs#1)] @@ -6950,7 +6987,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. + +The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. [!code-cpp[WebClient_UpLoadFile2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp#1)] [!code-csharp[WebClient_UpLoadFile2#1](~/snippets/csharp/System.Net/WebClient/UploadFile/webclient_uploadfile2.cs#1)] @@ -7476,7 +7514,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#4](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#4)] [!code-csharp[NCLWebClientAsync#4](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#4)] @@ -7971,7 +8010,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#4](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#4)] [!code-csharp[NCLWebClientAsync#4](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#4)] @@ -8060,7 +8100,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example demonstrates calling this method. + +The following code example demonstrates calling this method. [!code-cpp[NCLWebClientAsync#1](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#1)] [!code-csharp[NCLWebClientAsync#1](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#1)] @@ -8233,7 +8274,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example demonstrates calling this method. + +The following code example demonstrates calling this method. [!code-cpp[NCLWebClientAsync#2](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#2)] [!code-csharp[NCLWebClientAsync#2](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#2)] @@ -8704,7 +8746,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting an event handler for this event. + +The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#38](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#38)] [!code-csharp[NCLWebClientAsync#38](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#38)] @@ -9168,7 +9211,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. + +The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. [!code-cpp[WebClient_UploadValues#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp#1)] [!code-csharp[WebClient_UploadValues#1](~/snippets/csharp/System.Net/WebClient/UploadValues/webclient_uploadvalues.cs#1)] @@ -9374,7 +9418,8 @@ internal class MyWebClient : WebClientProtocol > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. + +The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. [!code-cpp[WebClient_UploadValues2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp#1)] [!code-csharp[WebClient_UploadValues2#1](~/snippets/csharp/System.Net/WebClient/UploadValues/webclient_uploadvalues2.cs#1)] @@ -10345,7 +10390,8 @@ internal class MyWebClient : WebClientProtocol ## Examples - The following code example demonstrates setting this property. + +The following code example demonstrates setting this property. [!code-cpp[NCLWebClientAsync#3](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#3)] [!code-csharp[NCLWebClientAsync#3](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#3)] diff --git a/xml/System.Xml/XmlDocument.xml b/xml/System.Xml/XmlDocument.xml index 0f87bcae068..c78bab30e62 100644 --- a/xml/System.Xml/XmlDocument.xml +++ b/xml/System.Xml/XmlDocument.xml @@ -119,15 +119,15 @@ is passed to the method and a is provided to notify users of any validation errors. In this example a validation error is found, but the document is still loaded. Alternatively, you can define a validating to throw an exception and stop the load process when a validation error is found by not specifying the . For more information about validating XML data, see the Remarks section of the reference page. - [!code-cpp[XmlDocument.cctor#1](~/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp#1)] - [!code-csharp[XmlDocument.cctor#1](~/snippets/csharp/System.Xml/XmlDocument/.ctor/docload.cs#1)] - [!code-vb[XmlDocument.cctor#1](~/snippets/visualbasic/VS_Snippets_Data/XmlDocument.cctor/VB/docload.vb#1)] +The following is an example of load-time validation. A document type definition (DTD) validating is passed to the method and a is provided to notify users of any validation errors. In this example a validation error is found, but the document is still loaded. Alternatively, you can define a validating to throw an exception and stop the load process when a validation error is found by not specifying the . For more information about validating XML data, see the Remarks section of the reference page. - The example uses the `bookDTD.xml` file as input. +[!code-csharp[XmlDocument.cctor#1](~/snippets/csharp/System.Xml/XmlDocument/.ctor/docload.cs#1)] +[!code-vb[XmlDocument.cctor#1](~/snippets/visualbasic/VS_Snippets_Data/XmlDocument.cctor/VB/docload.vb#1)] - [!code-xml[XmlDocument.cctor#2](~/snippets/xml/VS_Snippets_Data/XmlDocument.cctor/XML/bookdtd.xml#2)] +The example uses the `bookDTD.xml` file as input. + +[!code-xml[XmlDocument.cctor#2](~/snippets/xml/VS_Snippets_Data/XmlDocument.cctor/XML/bookdtd.xml#2)] ]]> @@ -346,12 +346,10 @@ If `deep` is `true`, the cloned node includes all the child nodes, otherwise only the `XmlDocument` node is cloned. See the method to see how this method behaves on other node types. - - ## Examples - The following example shows the difference between a deep and shallow clone. - [!code-cpp[Classic WebData XmlDocument.CloneNode Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp#1)] +The following example shows the difference between a deep and shallow clone. + [!code-csharp[Classic WebData XmlDocument.CloneNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/CloneNode/source.cs#1)] [!code-vb[Classic WebData XmlDocument.CloneNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/VB/source.vb#1)] @@ -421,12 +419,10 @@ ## Remarks The `XmlAttribute` can be added to an using the method. - - ## Examples - The following creates an attribute and adds it to an XML document. - [!code-cpp[Classic WebData XmlDocument.CreateAttribute Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp#1)] +The following creates an attribute and adds it to an XML document. + [!code-csharp[Classic WebData XmlDocument.CreateAttribute Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateAttribute/source.cs#1)] [!code-vb[Classic WebData XmlDocument.CreateAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/VB/source.vb#1)] @@ -648,12 +644,10 @@ According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), CDataSection nodes are allowed within Element nodes and in EntityReference nodes when the EntityReference node is not a child of an Attribute node. - - ## Examples - The following example creates a CDATA node and adds it to the document. - [!code-cpp[Classic WebData XmlDocument.CreateCDataSection Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp#1)] +The following example creates a CDATA node and adds it to the document. + [!code-csharp[Classic WebData XmlDocument.CreateCDataSection Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateCDataSection/source.cs#1)] [!code-vb[Classic WebData XmlDocument.CreateCDataSection Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/VB/source.vb#1)] @@ -724,14 +718,12 @@ According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), Comment nodes are only allowed within Document, Element and EntityReference nodes, when the EntityReference node is not a child of an Attribute node. - - ## Examples - The following example creates a comment and adds it to an XML document. - [!code-cpp[Classic WebData XmlDocument.CreateComment Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateComment Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateComment/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateComment Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/VB/source.vb#1)] +The following example creates a comment and adds it to an XML document. + +[!code-csharp[Classic WebData XmlDocument.CreateComment Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateComment/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateComment Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/VB/source.vb#1)] ]]> @@ -861,14 +853,12 @@ ## Remarks DocumentFragment nodes cannot be inserted into a document. However, you can insert children of the DocumentFragment node into a document. - - ## Examples - The following example adds new nodes to an XML document. - [!code-cpp[Classic WebData XmlDocument.CreateDocumentFragment Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateDocumentFragment Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateDocumentFragment/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateDocumentFragment Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/VB/source.vb#1)] +The following example adds new nodes to an XML document. + +[!code-csharp[Classic WebData XmlDocument.CreateDocumentFragment Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateDocumentFragment/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateDocumentFragment Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/VB/source.vb#1)] ]]> @@ -950,14 +940,12 @@ According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), DocumentType nodes are only allowed within Document nodes. Each can have only one DocumentType node. The DocumentType node must also be inserted before the root element of the `XmlDocument` (if the document already has a root element, you cannot add a DocumentType node). If the passed parameters do not combine to build a valid `XmlDocumentType`, an exception is thrown. - - ## Examples - The following example creates a DocumentType node and adds it to an XML document. - [!code-cpp[Classic WebData XmlDocument.CreateDocumentType Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateDocumentType Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateDocumentType/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateDocumentType Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/VB/source.vb#1)] +The following example creates a DocumentType node and adds it to an XML document. + +[!code-csharp[Classic WebData XmlDocument.CreateDocumentType Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateDocumentType/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateDocumentType Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/VB/source.vb#1)] ]]> @@ -1034,14 +1022,12 @@ According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), Element nodes are allowed within Document and Element nodes, and in EntityReference nodes when the EntityReference node is not a child of an Attribute node. - - ## Examples - The following example creates a new element and adds it to the document. - [!code-cpp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)] +The following example creates a new element and adds it to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)] ]]> @@ -1221,14 +1207,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example adds a new element to the existing XML document. - [!code-cpp[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/VB/source.vb#1)] +The following example adds a new element to the existing XML document. + +[!code-csharp[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/VB/source.vb#1)] ]]> @@ -1301,14 +1285,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), EntityReference nodes are only allowed within Element, Attribute and EntityReference nodes. - - ## Examples - The following example creates two entity reference nodes and inserts them into an XML document. - [!code-cpp[Classic WebData XmlDocument.CreateEntityReference Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateEntityReference Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateEntityReference/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateEntityReference Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/VB/source.vb#1)] +The following example creates two entity reference nodes and inserts them into an XML document. + +[!code-csharp[Classic WebData XmlDocument.CreateEntityReference Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateEntityReference/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateEntityReference Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/VB/source.vb#1)] ]]> @@ -1527,7 +1509,8 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); @@ -1678,11 +1661,11 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). ## Examples - The following example creates a new element and inserts it into an XML document. - [!code-cpp[Classic WebData XmlDocument.CreateNode Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateNode/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/VB/source.vb#1)] +The following example creates a new element and inserts it into an XML document. + +[!code-csharp[Classic WebData XmlDocument.CreateNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateNode/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/VB/source.vb#1)] ]]> @@ -1788,11 +1771,11 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). ## Examples - The following example adds a new element to the document. - [!code-cpp[Classic WebData XmlDocument.CreateNode2 Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateNode2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateNode/source2.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateNode2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/VB/source.vb#1)] +The following example adds a new element to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateNode2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateNode/source2.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateNode2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/VB/source.vb#1)] ]]> @@ -1864,14 +1847,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), ProcessingInstruction nodes are only allowed within Document, Element, and EntityReference nodes, when the EntityReference node is not a child of an Attribute node. - - ## Examples - The following example creates a ProcessingInstruction node and adds it to the document. - [!code-cpp[Classic WebData XmlDocument.CreateProcessingInstruction Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateProcessingInstruction Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateProcessingInstruction/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateProcessingInstruction Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/VB/source.vb#1)] +The following example creates a ProcessingInstruction node and adds it to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateProcessingInstruction Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateProcessingInstruction/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateProcessingInstruction Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/VB/source.vb#1)] ]]> @@ -1940,14 +1921,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods. - - ## Examples - The following example adds significant white space to the document. - [!code-cpp[Classic WebData XmlDocument.CreateSignificantWhitespace Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateSignificantWhitespace Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateSignificantWhitespace/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateSignificantWhitespace Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/VB/source.vb#1)] +The following example adds significant white space to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateSignificantWhitespace Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateSignificantWhitespace/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateSignificantWhitespace Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/VB/source.vb#1)] ]]> @@ -2016,14 +1995,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); According to the W3C [Extensible Markup Language (XML) 1.0 recommendation](https://www.w3.org/TR/1998/REC-xml-19980210), Text nodes are only allowed within Element, Attribute and EntityReference nodes. - - ## Examples - The following example creates a new element and adds it to the document. - [!code-cpp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)] +The following example creates a new element and adds it to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/VB/source.vb#1)] ]]> @@ -2092,14 +2069,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); Although this method creates the new object in the context of the document, it does not automatically add the new object to the document tree. To add the new object, you must explicitly call one of the node insert methods. - - ## Examples - The following example adds white space to the document. - [!code-cpp[Classic WebData XmlDocument.CreateWhitespace Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateWhitespace Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateWhitespace/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateWhitespace Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/VB/source.vb#1)] +The following example adds white space to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateWhitespace Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateWhitespace/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateWhitespace Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/VB/source.vb#1)] ]]> @@ -2185,14 +2160,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example creates an XML declaration and adds it to the document. - [!code-cpp[Classic WebData XmlDocument.CreateXmlDeclaration Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateXmlDeclaration Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateXmlDeclaration/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateXmlDeclaration Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/VB/source.vb#1)] +The following example creates an XML declaration and adds it to the document. + +[!code-csharp[Classic WebData XmlDocument.CreateXmlDeclaration Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateXmlDeclaration/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateXmlDeclaration Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/VB/source.vb#1)] ]]> @@ -2254,13 +2227,13 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); Pride And Prejudice @@ -2325,16 +2298,14 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); An `XmlDocument` can have one and only one child with equal to DocumentType. > [!NOTE] -> This property is read-only. To change the DocumentType node, delete the existing node, create a new one using the method, and add the new node to the document. - - +> This property is read-only. To change the DocumentType node, delete the existing node, create a new one using the method, and add the new node to the document. ## Examples - The following example gets and displays the DOCTYPE declaration for the document. - [!code-cpp[Classic WebData XmlDocument.DocumentType Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.DocumentType Example#1](~/snippets/csharp/System.Xml/XmlDocument/DocumentType/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.DocumentType Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/VB/source.vb#1)] +The following example gets and displays the DOCTYPE declaration for the document. + +[!code-csharp[Classic WebData XmlDocument.DocumentType Example#1](~/snippets/csharp/System.Xml/XmlDocument/DocumentType/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.DocumentType Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/VB/source.vb#1)] ]]> @@ -2402,14 +2373,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); > [!NOTE] > The DOM implementation must have information which defines which attributes are of type ID. Although attributes of type ID can be defined in either XSD schemas or DTDs, this version of the product only supports those defined in DTDs. Attributes with the name "ID" are not of type ID unless so defined in the DTD. Implementations where it is unknown whether the attributes are of type ID are expected to return `null`. - - ## Examples - The following example uses the `GetElementById` method. - [!code-cpp[Classic WebData XmlDocument.GetElementById Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.GetElementById Example#1](~/snippets/csharp/System.Xml/XmlDocument/GetElementById/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.GetElementById Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/VB/source.vb#1)] +The following example uses the `GetElementById` method. + +[!code-csharp[Classic WebData XmlDocument.GetElementById Example#1](~/snippets/csharp/System.Xml/XmlDocument/GetElementById/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.GetElementById Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/VB/source.vb#1)] The example uses the file, `ids.xml`, as input. @@ -2499,14 +2468,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); > [!NOTE] > It is recommended that you use the or method instead of the method. - - ## Examples - The following example creates a `XmlDocument` object and uses the `GetElementsByTagName` method and the resulting object to display all the book titles. - [!code-cpp[Classic WebData XmlDocument.GetElementsByTagName Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.GetElementsByTagName Example#1](~/snippets/csharp/System.Xml/XmlDocument/Overview/source1.cs#1)] - [!code-vb[Classic WebData XmlDocument.GetElementsByTagName Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/VB/source.vb#1)] +The following example creates a `XmlDocument` object and uses the `GetElementsByTagName` method and the resulting object to display all the book titles. + +[!code-csharp[Classic WebData XmlDocument.GetElementsByTagName Example#1](~/snippets/csharp/System.Xml/XmlDocument/Overview/source1.cs#1)] +[!code-vb[Classic WebData XmlDocument.GetElementsByTagName Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/VB/source.vb#1)] The example uses the `books.xml` file as input. @@ -2635,14 +2602,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); Although the `XmlDocument` objects share the same implementation, to move nodes from one document to another you must use the method. - - ## Examples - The following example creates a new `XmlDocument` using another document's implementation. - [!code-cpp[Classic WebData XmlDocument.Implementation Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.Implementation Example#1](~/snippets/csharp/System.Xml/XmlDocument/Implementation/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.Implementation Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/VB/source.vb#1)] +The following example creates a new `XmlDocument` using another document's implementation. + +[!code-csharp[Classic WebData XmlDocument.Implementation Example#1](~/snippets/csharp/System.Xml/XmlDocument/Implementation/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.Implementation Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/VB/source.vb#1)] ]]> @@ -2734,18 +2699,16 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); *Although DocumentType nodes can be imported, a document can only have one DocumentType. If the document currently has a DocumentType node, it must be removed before adding a new one. - - ## Examples - The following example imports a book node from a second XML document into the original XML document. - [!code-cpp[Classic WebData XmlDocument.ImportNode Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.ImportNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/ImportNode/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.ImportNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/VB/source.vb#1)] +The following example imports a book node from a second XML document into the original XML document. - The example uses the file, `books.xml`, as input. +[!code-csharp[Classic WebData XmlDocument.ImportNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/ImportNode/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.ImportNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/VB/source.vb#1)] - [!code-xml[Classic WebData XslTransform.Transform7 Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/XML/books.xml#2)] +The example uses the file, `books.xml`, as input. + +[!code-xml[Classic WebData XslTransform.Transform7 Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/XML/books.xml#2)] ]]> @@ -2993,14 +2956,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This property is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example shows how to use the `IsReadOnly` property. - [!code-cpp[Classic WebData XmlDocument.IsReadOnly Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.IsReadOnly Example#1](~/snippets/csharp/System.Xml/XmlDocument/IsReadOnly/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.IsReadOnly Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/VB/source.vb#1)] +The following example shows how to use the `IsReadOnly` property. + +[!code-csharp[Classic WebData XmlDocument.IsReadOnly Example#1](~/snippets/csharp/System.Xml/XmlDocument/IsReadOnly/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.IsReadOnly Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/VB/source.vb#1)] ]]> @@ -3141,14 +3102,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example uses the class to load a string of XML data into the `XmlDocument` object. - [!code-cpp[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs#1)] - [!code-vb[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/VB/source.vb#1)] +The following example uses the class to load a string of XML data into the `XmlDocument` object. + +[!code-csharp[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/CreateElement/source1.cs#1)] +[!code-vb[Classic WebData XmlDocument.CreateElement2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/VB/source.vb#1)] ]]> @@ -3300,7 +3259,7 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); ## Remarks > [!NOTE] -> The `Load` method always preserves significant white space. The property determines whether or not insignificant white space, that is white space in element content, is preserved. The default is `false`; white space in element content is not preserved. +> The `Load` method always preserves significant white space. The property determines whether or not insignificant white space, that is white space in element content, is preserved. The default is `false`; white space in element content is not preserved. If the reader is in the initial state ( =ReadState.Initial), `Load` consumes the entire contents of the reader and builds the DOM from what it finds. @@ -3326,18 +3285,16 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example loads the last book node of the `books.xml` file into the XML document. - [!code-cpp[Classic WebData XmlDocument.Load2 Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.Load2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/Load/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.Load2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/VB/source.vb#1)] +The following example loads the last book node of the `books.xml` file into the XML document. - The example uses the file, `books.xml`, as input. +[!code-csharp[Classic WebData XmlDocument.Load2 Example#1](~/snippets/csharp/System.Xml/XmlDocument/Load/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.Load2 Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/VB/source.vb#1)] - [!code-xml[Classic WebData XslTransform.Transform7 Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/XML/books.xml#2)] +The example uses the file, `books.xml`, as input. + +[!code-xml[Classic WebData XslTransform.Transform7 Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/XML/books.xml#2)] ]]> @@ -3412,14 +3369,12 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example loads XML into an `XmlDocument` object and saves it out to a file. - [!code-cpp[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/csharp/System.Xml/XmlDocument/LoadXml/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/VB/source.vb#1)] +The following example loads XML into an `XmlDocument` object and saves it out to a file. + +[!code-csharp[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/csharp/System.Xml/XmlDocument/LoadXml/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/VB/source.vb#1)] ]]> @@ -4147,18 +4102,16 @@ elem=doc.CreateElement("xy", "item", "urn:abc"); This method is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example shows how to strip white space from a file. - [!code-cpp[Classic WebData XmlDocument.PreserveWhitespace Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.PreserveWhitespace Example#1](~/snippets/csharp/System.Xml/XmlDocument/PreserveWhitespace/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.PreserveWhitespace Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/VB/source.vb#1)] +The following example shows how to strip white space from a file. - The example uses the file `book.xml` as input. +[!code-csharp[Classic WebData XmlDocument.PreserveWhitespace Example#1](~/snippets/csharp/System.Xml/XmlDocument/PreserveWhitespace/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.PreserveWhitespace Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/VB/source.vb#1)] - [!code-xml[Classic WebData XmlDocument.PreserveWhitespace Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/XML/source.xml#2)] +The example uses the file `book.xml` as input. + +[!code-xml[Classic WebData XmlDocument.PreserveWhitespace Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/XML/source.xml#2)] ]]> @@ -4233,18 +4186,16 @@ while (reader.MoveToNextAttribute()) `ReadNode` does consume the attribute value though, which means after calling `ReadNode` on an attribute, returns `false`. - - ## Examples - The following example uses `ReadNode` to create a new node and then inserts the new node into the document. - [!code-cpp[Classic WebData XmlDocument.ReadNode Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.ReadNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/ReadNode/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.ReadNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/VB/source.vb#1)] +The following example uses `ReadNode` to create a new node and then inserts the new node into the document. + +[!code-csharp[Classic WebData XmlDocument.ReadNode Example#1](~/snippets/csharp/System.Xml/XmlDocument/ReadNode/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.ReadNode Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/VB/source.vb#1)] - The example uses the file, `cd.xml`, as input. +The example uses the file, `cd.xml`, as input. - [!code-xml[Classic WebData XmlDocument.ReadNode Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/XML/source.xml#2)] +[!code-xml[Classic WebData XmlDocument.ReadNode Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/XML/source.xml#2)] ]]> @@ -4467,14 +4418,12 @@ doc.Save(Console.Out); Note that only the method enforces a well-formed XML document. All other `Save` overloads only guarantee a well-formed fragment. - - ## Examples - The following example loads XML into an XmlDocument object, modifies it, and then saves it to a file named data.xml. - [!code-cpp[Classic WebData XmlDocument.Save Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.Save Example#1](~/snippets/csharp/System.Xml/XmlDocument/Save/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.Save Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/VB/source.vb#1)] +The following example loads XML into an XmlDocument object, modifies it, and then saves it to a file named data.xml. + +[!code-csharp[Classic WebData XmlDocument.Save Example#1](~/snippets/csharp/System.Xml/XmlDocument/Save/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.Save Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/VB/source.vb#1)] The data.xml file will contain the following XML: `wrench10.95`. @@ -4556,14 +4505,12 @@ doc.Save(Console.Out); Note that only the method enforces a well-formed XML document. All other `Save` overloads only guarantee a well-formed fragment. - - ## Examples - The following example loads XML into an `XmlDocument` object and saves it out to a file. - [!code-cpp[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/csharp/System.Xml/XmlDocument/LoadXml/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/VB/source.vb#1)] +The following example loads XML into an `XmlDocument` object and saves it out to a file. + +[!code-csharp[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/csharp/System.Xml/XmlDocument/LoadXml/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.LoadXml Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/VB/source.vb#1)] ]]> @@ -4748,30 +4695,25 @@ doc.Save(Console.Out); ## Remarks The method validates the XML data in the against the schemas contained in the property. The method performs infoset augmentation. Specifically, after successful validation, schema defaults are applied, text values are converted to atomic values as necessary, and type information is associated with validated information items. The result is a previously un-typed XML sub-tree in the replaced with a typed sub-tree. - The following are important notes to consider when using the method. - -- Schema location hints like `xsi:schemaLocation` or `xsi:noNamespaceSchemaLocation` are ignored. - -- Inline schemas are ignored. - -- If schema validation errors occur during validation the becomes partially validated with some nodes with correct type information and some without. - -- The validation process includes checking for uniqueness and reference constraints (`xs:ID`, `xs:IDREF`, `xs:key`, `xs:keyref`, and `xs:unique`). - +Consider the following points when using the method: +- Schema location hints like `xsi:schemaLocation` or `xsi:noNamespaceSchemaLocation` are ignored. +- Inline schemas are ignored. +- If schema validation errors occur during validation the becomes partially validated with some nodes with correct type information and some without. +- The validation process includes checking for uniqueness and reference constraints (`xs:ID`, `xs:IDREF`, `xs:key`, `xs:keyref`, and `xs:unique`). ## Examples - The following example illustrates use of the method. The example creates an that contains an associated XSD schema using the and objects. The example then uses the class to incorrectly modify the typed value of an element in the XML document generating a schema validation error. - [!code-cpp[XPathValidation#1](~/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp#1)] - [!code-csharp[XPathValidation#1](~/snippets/csharp/System.Xml/XmlDocument/Validate/XPathValidation.cs#1)] - [!code-vb[XPathValidation#1](~/snippets/visualbasic/VS_Snippets_Data/XPathValidation/VB/XPathValidation.vb#1)] +The following example illustrates use of the method. The example creates an that contains an associated XSD schema using the and objects. The example then uses the class to incorrectly modify the typed value of an element in the XML document generating a schema validation error. + +[!code-csharp[XPathValidation#1](~/snippets/csharp/System.Xml/XmlDocument/Validate/XPathValidation.cs#1)] +[!code-vb[XPathValidation#1](~/snippets/visualbasic/VS_Snippets_Data/XPathValidation/VB/XPathValidation.vb#1)] - The example takes the `contosoBooks.xml` and `contosoBooks.xsd` files as input. +The example takes the `contosoBooks.xml` and `contosoBooks.xsd` files as input. - [!code-xml[XPathXMLExamples#2](~/snippets/xml/VS_Snippets_Data/XPathXMLExamples/XML/contosoBooks.xml#2)] +[!code-xml[XPathXMLExamples#2](~/snippets/xml/VS_Snippets_Data/XPathXMLExamples/XML/contosoBooks.xml#2)] - [!code-xml[XPathXMLExamples#3](~/snippets/xml/VS_Snippets_Data/XPathXMLExamples/XML/contosoBooks.xsd#3)] +[!code-xml[XPathXMLExamples#3](~/snippets/xml/VS_Snippets_Data/XPathXMLExamples/XML/contosoBooks.xsd#3)] ]]> @@ -4839,11 +4781,11 @@ doc.Save(Console.Out); The following are important notes to consider when using the method. -- Schema location hints like `xsi:schemaLocation` or `xsi:noNamespaceSchemaLocation` are ignored. +- Schema location hints like `xsi:schemaLocation` or `xsi:noNamespaceSchemaLocation` are ignored. -- Inline schemas are ignored. +- Inline schemas are ignored. -- If schema validation errors occur during validation the becomes partially validated with some nodes with correct type information and some without. +- If schema validation errors occur during validation the becomes partially validated with some nodes with correct type information and some without. If the node to validate is the root node, the validation process includes checking for uniqueness and reference constraints (`xs:ID`, `xs:IDREF`, `xs:key`, `xs:keyref`, and `xs:unique`); otherwise, uniqueness and reference constraints are omitted. @@ -4913,14 +4855,12 @@ doc.Save(Console.Out); The property determines the encoding that is written out. If the `Encoding` property does not have a value, the `XmlDocument` is written out without an encoding attribute. - - ## Examples - The following example displays the document onscreen. - [!code-cpp[Classic WebData XmlDocument.WriteContentTo Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.WriteContentTo Example#1](~/snippets/csharp/System.Xml/XmlDocument/WriteContentTo/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.WriteContentTo Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/VB/source.vb#1)] +The following example displays the document. + +[!code-csharp[Classic WebData XmlDocument.WriteContentTo Example#1](~/snippets/csharp/System.Xml/XmlDocument/WriteContentTo/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.WriteContentTo Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/VB/source.vb#1)] ]]> @@ -4980,14 +4920,12 @@ doc.Save(Console.Out); The property determines the encoding that is written out. If the `Encoding` property does not have a value, the `XmlDocument` is written out without an encoding attribute. - - ## Examples - The following example displays the document onscreen. - [!code-cpp[Classic WebData XmlDocument.WriteTo Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlDocument.WriteTo Example#1](~/snippets/csharp/System.Xml/XmlDocument/WriteTo/source.cs#1)] - [!code-vb[Classic WebData XmlDocument.WriteTo Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/VB/source.vb#1)] +The following example displays the document. + +[!code-csharp[Classic WebData XmlDocument.WriteTo Example#1](~/snippets/csharp/System.Xml/XmlDocument/WriteTo/source.cs#1)] +[!code-vb[Classic WebData XmlDocument.WriteTo Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/VB/source.vb#1)] ]]> @@ -5049,13 +4987,13 @@ doc.Save(Console.Out); ## Remarks The `XmlResolver` can be used to load DTDs or expand entity references. Using the property, you can set credentials on the `XmlResolver` to access resources stored on a secure network resource. -- If the document was not loaded using an (that is, if it was loaded using a stream, file, and so on) the `XmlResolver` on the `XmlDocument` is always used. +- If the document was not loaded using an (that is, if it was loaded using a stream, file, and so on) the `XmlResolver` on the `XmlDocument` is always used. -- If the document was loaded with an , the resolver on the `XmlTextReader` is used to resolve any DTD references in the DocumentType node. The resolver on the `XmlDocument` is used to expand any entity references. +- If the document was loaded with an , the resolver on the `XmlTextReader` is used to resolve any DTD references in the DocumentType node. The resolver on the `XmlDocument` is used to expand any entity references. -- If the document was loaded with an , the resolver on the `XmlDocument` is never used. +- If the document was loaded with an , the resolver on the `XmlDocument` is never used. -- If the document was loaded with a class that extends `XmlReader` and the `XmlReader` cannot resolve entities ( returns `false`), the `XmlResolver` on the `XmlDocument` is used to resolve any references in the DocumentType node and to expand any entity references. +- If the document was loaded with a class that extends `XmlReader` and the `XmlReader` cannot resolve entities ( returns `false`), the `XmlResolver` on the `XmlDocument` is used to resolve any references in the DocumentType node and to expand any entity references. > [!NOTE] > If the `XmlDocument` is loaded using an that had an `XmlResolver` set to it, the `XmlResolver` on the `XmlReader` is not cached by the `XmlDocument` after completes. @@ -5070,24 +5008,22 @@ doc.Save(Console.Out); This property is a Microsoft extension to the Document Object Model (DOM). - - ## Examples - The following example loads an XML document which includes a reference to a DTD file. The `XmlResolver` property is used to set the credentials necessary to access the network resource. - [!code-cpp[XmlDocument.XmlResolver#1](~/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp#1)] - [!code-csharp[XmlDocument.XmlResolver#1](~/snippets/csharp/System.Xml/XmlDocument/XmlResolver/docresolver.cs#1)] - [!code-vb[XmlDocument.XmlResolver#1](~/snippets/visualbasic/VS_Snippets_Data/XmlDocument.XmlResolver/VB/docresolver.vb#1)] +The following example loads an XML document which includes a reference to a DTD file. The `XmlResolver` property is used to set the credentials necessary to access the network resource. + +[!code-csharp[XmlDocument.XmlResolver#1](~/snippets/csharp/System.Xml/XmlDocument/XmlResolver/docresolver.cs#1)] +[!code-vb[XmlDocument.XmlResolver#1](~/snippets/visualbasic/VS_Snippets_Data/XmlDocument.XmlResolver/VB/docresolver.vb#1)] - The example uses the following data files as input. +The example uses the following data files as input. - `book5.xml` +`book5.xml` - [!code-xml[XmlDocument.XmlResolver#2](~/snippets/xml/VS_Snippets_Data/XmlDocument.XmlResolver/XML/book5.xml#2)] +[!code-xml[XmlDocument.XmlResolver#2](~/snippets/xml/VS_Snippets_Data/XmlDocument.XmlResolver/XML/book5.xml#2)] - `books.dtd` +`books.dtd` - [!code-xml[XmlDocument.XmlResolver#3](~/snippets/xml/VS_Snippets_Data/XmlDocument.XmlResolver/XML/books.dtd#3)] +[!code-xml[XmlDocument.XmlResolver#3](~/snippets/xml/VS_Snippets_Data/XmlDocument.XmlResolver/XML/books.dtd#3)] ]]> diff --git a/xml/System.Xml/XmlValidatingReader.xml b/xml/System.Xml/XmlValidatingReader.xml index 608452bd314..86aadee8075 100644 --- a/xml/System.Xml/XmlValidatingReader.xml +++ b/xml/System.Xml/XmlValidatingReader.xml @@ -154,28 +154,26 @@ When external document type definitions (DTDs) or schemas are needed for validation, the property sets the object to use for resolving external resources. - - ## Examples - The following example validates two documents. - [!code-cpp[XmlValidatingReader.Cctor#1](~/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp#1)] - [!code-csharp[XmlValidatingReader.Cctor#1](~/snippets/csharp/System.Xml/XmlValidatingReader/.ctor/valid_xsd2.cs#1)] - [!code-vb[XmlValidatingReader.Cctor#1](~/snippets/visualbasic/VS_Snippets_Data/XmlValidatingReader.Cctor/VB/valid_xsd2.vb#1)] +The following example validates two documents. - The sample uses the following input files: +[!code-csharp[XmlValidatingReader.Cctor#1](~/snippets/csharp/System.Xml/XmlValidatingReader/.ctor/valid_xsd2.cs#1)] +[!code-vb[XmlValidatingReader.Cctor#1](~/snippets/visualbasic/VS_Snippets_Data/XmlValidatingReader.Cctor/VB/valid_xsd2.vb#1)] - `notValidXSD.xml` +The sample uses the following input files: - [!code-xml[XmlValidatingReader.Cctor#2](~/snippets/xml/VS_Snippets_Data/XmlValidatingReader.Cctor/XML/notvalidxsd.xml#2)] +`notValidXSD.xml` - `books.xsd` +[!code-xml[XmlValidatingReader.Cctor#2](~/snippets/xml/VS_Snippets_Data/XmlValidatingReader.Cctor/XML/notvalidxsd.xml#2)] - [!code-xml[XmlValidatingReader.Cctor#3](~/snippets/xml/VS_Snippets_Data/XmlValidatingReader.Cctor/XML/books.xsd#3)] +`books.xsd` - `inlineXSD.xml` +[!code-xml[XmlValidatingReader.Cctor#3](~/snippets/xml/VS_Snippets_Data/XmlValidatingReader.Cctor/XML/books.xsd#3)] - [!code-xml[XmlValidatingReader.Cctor#4](~/snippets/xml/VS_Snippets_Data/XmlValidatingReader.Cctor/XML/inlinexsd.xml#4)] +`inlineXSD.xml` + +[!code-xml[XmlValidatingReader.Cctor#4](~/snippets/xml/VS_Snippets_Data/XmlValidatingReader.Cctor/XML/inlinexsd.xml#4)] ]]> @@ -340,10 +338,9 @@ If this reader will be validating by using XML-Data Reduced (XDR) or XML Schema definition language (XSD) schemas, use the property to specify the that contains the schemas (the `XmlParserContext` does not need to supply the DocumentType information). - - ## Examples - The following example reads an XML fragment. It uses an `XmlParserContext` and its to handle namespace matching. + +The following example reads an XML fragment. It uses an `XmlParserContext` and its to handle namespace matching. [!code-csharp[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/csharp/System.Xml/XmlParserContext/.ctor/source.cs#1)] [!code-vb[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlParserContext.XmlParserContext Example/VB/source.vb#1)] @@ -403,14 +400,12 @@ This property is relevant to `Element`, `DocumentType`, and `XmlDeclaration` nodes only. (Other node types do not have attributes.) - - ## Examples - The following example reads all the elements on the root node. - [!code-cpp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/AttributeCount/source.cs#1)] - [!code-vb[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/VB/source.vb#1)] +The following example reads all the elements on the root node. + +[!code-csharp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/AttributeCount/source.cs#1)] +[!code-vb[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/VB/source.vb#1)] ]]> @@ -466,20 +461,18 @@ A networked XML document is comprised of chunks of data aggregated by using various World Wide Web Consortium (W3C) standard inclusion mechanisms and therefore contains nodes that come from different places. document type definition (DTD) entities are an example of this, but this is not limited to DTDs. The base URI tells you where these nodes came from. If there is no base URI for the nodes being returned (for example, they were parsed from an in-memory string), String.Empty is returned. - - ## Examples - The following example parses a file and displays the base URI of each node. - [!code-cpp[Classic WebData XmlValidatingReader.BaseURI Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlValidatingReader.BaseURI Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/BaseURI/source.cs#1)] - [!code-vb[Classic WebData XmlValidatingReader.BaseURI Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/VB/source.vb#1)] +The following example parses a file and displays the base URI of each node. + +[!code-csharp[Classic WebData XmlValidatingReader.BaseURI Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/BaseURI/source.cs#1)] +[!code-vb[Classic WebData XmlValidatingReader.BaseURI Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/VB/source.vb#1)] - The example uses the file, `uri.xml`, as input. +The example uses the file, `uri.xml`, as input. - [!code-xml[Classic WebData XmlValidatingReader.BaseURI Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/XML/source.xml#2)] +[!code-xml[Classic WebData XmlValidatingReader.BaseURI Example#2](~/snippets/xml/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/XML/source.xml#2)] - The `style.xml` file contains the XML text ``. +The `style.xml` file contains the XML text ``. ]]> @@ -692,14 +685,12 @@ > [!NOTE] > The class is obsolete in .NET Framework 2.0. You can create a validating instance by using the class and the method. For more information, see the Remarks section of the reference page. - - ## Examples - The following example displays each node including its depth, line number, and line position. - [!code-cpp[IXmlLineInfo#1](~/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp#1)] - [!code-csharp[IXmlLineInfo#1](~/snippets/csharp/System.Xml/IXmlLineInfo/Overview/lineinfo.cs#1)] - [!code-vb[IXmlLineInfo#1](~/snippets/visualbasic/VS_Snippets_Data/IXmlLineInfo/VB/lineinfo.vb#1)] +The following example displays each node including its depth, line number, and line position. + +[!code-csharp[IXmlLineInfo#1](~/snippets/csharp/System.Xml/IXmlLineInfo/Overview/lineinfo.cs#1)] +[!code-vb[IXmlLineInfo#1](~/snippets/visualbasic/VS_Snippets_Data/IXmlLineInfo/VB/lineinfo.vb#1)] ]]> @@ -841,11 +832,11 @@ | 1 | SignificantWhitespace | | | ## Examples - The following example uses the `ResolveEntity` method to expand a general entity. -[!code-cpp[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/EntityHandling/source.cs#1)] - [!code-vb[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/VB/source.vb#1)] +The following example uses the `ResolveEntity` method to expand a general entity. + +[!code-csharp[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/EntityHandling/source.cs#1)] +[!code-vb[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/VB/source.vb#1)] The example uses the file, `book1.xml`, as input. @@ -1037,14 +1028,12 @@ If the reader is positioned on a `DocumentType` node, this method can be used to get the PUBLIC and SYSTEM literals, for example, `reader.GetAttribute("PUBLIC")` - - ## Examples - The following example gets the value of the ISBN attribute. - [!code-cpp[Classic WebData XmlValidatingReader.GetAttribute Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlValidatingReader.GetAttribute Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/GetAttribute/source.cs#1)] - [!code-vb[Classic WebData XmlValidatingReader.GetAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/VB/source.vb#1)] +The following example gets the value of the ISBN attribute. + +[!code-csharp[Classic WebData XmlValidatingReader.GetAttribute Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/GetAttribute/source.cs#1)] +[!code-vb[Classic WebData XmlValidatingReader.GetAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/VB/source.vb#1)] The example uses the file, `attrs.xml`, as input. @@ -1258,14 +1247,12 @@ String dt4 = reader.GetAttribute("dt",http://www.w3.org/2000/xmlns/); |`Whitespace`|The white space between markup.| |`XmlDeclaration`|The content of the declaration.| - - ## Examples - The following example reads in XML with various data types and displays each of the nodes. - [!code-cpp[Classic WebData XmlValidatingReader.HasValue Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp#1)] - [!code-csharp[Classic WebData XmlValidatingReader.HasValue Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/HasValue/source.cs#1)] - [!code-vb[Classic WebData XmlValidatingReader.HasValue Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/VB/source.vb#1)] +The following example reads in XML with various data types and displays each of the nodes. + +[!code-csharp[Classic WebData XmlValidatingReader.HasValue Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/HasValue/source.cs#1)] +[!code-vb[Classic WebData XmlValidatingReader.HasValue Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/VB/source.vb#1)] ]]> @@ -1320,12 +1307,10 @@ String dt4 = reader.GetAttribute("dt",http://www.w3.org/2000/xmlns/); > [!NOTE] > The class is obsolete in .NET Framework 2.0. You can create a validating instance by using the class and the method. For more information, see the Remarks section of the reference page. - - ## Examples - The following example displays all attributes nodes on the root element. - [!code-cpp[XmlValidatingReader.IsDefault#1](~/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp#1)] +The following example displays all attributes nodes on the root element. + [!code-csharp[XmlValidatingReader.IsDefault#1](~/snippets/csharp/System.Xml/XmlValidatingReader/IsDefault/readdefattr.cs#1)] [!code-vb[XmlValidatingReader.IsDefault#1](~/snippets/visualbasic/VS_Snippets_Data/XmlValidatingReader.IsDefault/VB/readdefattr.vb#1)] @@ -1401,12 +1386,10 @@ String dt4 = reader.GetAttribute("dt",http://www.w3.org/2000/xmlns/); If default content has been added to an element due to schema validation, `IsEmptyElement` still returns `true`. It has no bearing on whether or not the element has a default value. In other words, `IsEmptyElement` simply reports whether or not the element in the source document had an end element tag. - - ## Examples - The following example displays the text content of each element. - [!code-cpp[Classic WebData XmlValidatingReader.IsEmptyElement Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp#1)] +The following example displays the text content of each element. + [!code-csharp[Classic WebData XmlValidatingReader.IsEmptyElement Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/IsEmptyElement/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.IsEmptyElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/VB/source.vb#1)] @@ -1697,7 +1680,8 @@ If the reader is positioned on a `DocumentType` node, this method can be used to ## Examples - The following example reads an XML fragment. + +The following example reads an XML fragment. [!code-csharp[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/csharp/System.Xml/XmlParserContext/.ctor/source.cs#1)] [!code-vb[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlParserContext.XmlParserContext Example/VB/source.vb#1)] @@ -1838,12 +1822,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to > [!NOTE] > The class is obsolete in .NET Framework 2.0. You can create a validating instance by using the class and the method. For more information, see the Remarks section of the reference page. - - ## Examples - The following example reads all the elements on the root node. - [!code-cpp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp#1)] +The following example reads all the elements on the root node. + [!code-csharp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/AttributeCount/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/VB/source.vb#1)] @@ -1906,12 +1888,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to After calling this method, the , , and properties reflect the properties of that attribute. - - ## Examples - The following example reads an attribute with text and entity reference nodes. - [!code-cpp[Classic WebData XmlValidatingReader.MoveToAttribute Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp#1)] +The following example reads an attribute with text and entity reference nodes. + [!code-csharp[Classic WebData XmlValidatingReader.MoveToAttribute Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/MoveToAttribute/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.MoveToAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/VB/source.vb#1)] @@ -2038,12 +2018,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to Use this method to return to an element after navigating through its attributes. This method moves the reader to one of the following node types: `Element`, `DocumentType`, or `XmlDeclaration`. - - ## Examples - The following example reads all the elements on the root node. - [!code-cpp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp#1)] +The following example reads all the elements on the root node. + [!code-csharp[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/AttributeCount/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.AttributeCount Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/VB/source.vb#1)] @@ -2100,12 +2078,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to > [!NOTE] > The class is obsolete in .NET Framework 2.0. You can create a validating instance by using the class and the method. For more information, see the Remarks section of the reference page. - - ## Examples - The following example reads an XML fragment. - [!code-cpp[Classic WebData XmlValidatingReader.MoveToFirstAttribute Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp#1)] +The following example reads an XML fragment. + [!code-csharp[Classic WebData XmlValidatingReader.MoveToFirstAttribute Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/MoveToFirstAttribute/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.MoveToFirstAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/VB/source.vb#1)] @@ -2164,12 +2140,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to If the current node is an element node, this method is equivalent to . If `MoveToNextAttribute` returns `true`, the reader moves to the next attribute; otherwise, the position of the reader does not change. - - ## Examples - The following example reads an XML fragment. - [!code-cpp[Classic WebData XmlValidatingReader.MoveToFirstAttribute Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp#1)] +The following example reads an XML fragment. + [!code-csharp[Classic WebData XmlValidatingReader.MoveToFirstAttribute Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/MoveToFirstAttribute/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.MoveToFirstAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/VB/source.vb#1)] @@ -2244,12 +2218,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to > [!NOTE] > The class is obsolete in .NET Framework 2.0. You can create a validating instance by using the class and the method. For more information, see the Remarks section of the reference page. - - ## Examples - The following example reads an XML file and displays each of the nodes. - [!code-cpp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp#1)] +The following example reads an XML file and displays each of the nodes. + [!code-csharp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/Name/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/VB/source.vb#1)] @@ -2364,7 +2336,8 @@ If the reader is positioned on a `DocumentType` node, this method can be used to ## Examples - The following example reads an XML fragment. + +The following example reads an XML fragment. [!code-csharp[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/csharp/System.Xml/XmlParserContext/.ctor/source.cs#1)] [!code-vb[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlParserContext.XmlParserContext Example/VB/source.vb#1)] @@ -2477,12 +2450,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to This property never returns the following `XmlNodeType` types: `Document`, `DocumentFragment`, `Entity`, or `Notation`. - - ## Examples - The following example reads an XML file and displays each of the nodes. - [!code-cpp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp#1)] +The following example reads an XML file and displays each of the nodes. + [!code-csharp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/Name/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/VB/source.vb#1)] @@ -2544,7 +2515,8 @@ If the reader is positioned on a `DocumentType` node, this method can be used to ## Examples - The following example reads an XML fragment. + +The following example reads an XML fragment. [!code-csharp[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/csharp/System.Xml/XmlParserContext/.ctor/source.cs#1)] [!code-vb[Classic WebData XmlParserContext.XmlParserContext Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlParserContext.XmlParserContext Example/VB/source.vb#1)] @@ -2656,12 +2628,10 @@ If the reader is positioned on a `DocumentType` node, this method can be used to When a reader is first created and initialized, there is no information available. You must call `Read` to read the first node. - - ## Examples - The following example reads an XML file and displays each node. - [!code-cpp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp#1)] +The following example reads an XML file and displays each node. + [!code-csharp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/Name/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/VB/source.vb#1)] @@ -2755,12 +2725,10 @@ reader.MoveToAttribute("name"); } ``` - - ## Examples - The following example reads an attribute with text and entity reference nodes. - [!code-cpp[Classic WebData XmlValidatingReader.MoveToAttribute Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp#1)] +The following example reads an attribute with text and entity reference nodes. + [!code-csharp[Classic WebData XmlValidatingReader.MoveToAttribute Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/MoveToAttribute/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.MoveToAttribute Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/VB/source.vb#1)] @@ -3240,12 +3208,10 @@ The text node can be either an element or an attribute text node. |ExpandEntities|Returns expanded character and general entities. This is the default.| |ExpandCharEntities|Returns the text content up to but not including a general entity reference. This means a general entity causes ReadString to stop. You must call `Read` to step over the entity reference.| - - ## Examples - The following example displays the text content of each of the elements. - [!code-cpp[Classic WebData XmlValidatingReader.IsEmptyElement Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp#1)] +The following example displays the text content of each of the elements. + [!code-csharp[Classic WebData XmlValidatingReader.IsEmptyElement Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/IsEmptyElement/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.IsEmptyElement Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/VB/source.vb#1)] @@ -3316,12 +3282,10 @@ The text node can be either an element or an attribute text node. > [!CAUTION] > After calling , `ReadTypedValue` will return `null`. - - ## Examples - The following example displays the type information for each of the elements in the XML document. - [!code-cpp[XmlValidatingReader.SchemaType#1](~/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp#1)] +The following example displays the type information for each of the elements in the XML document. + [!code-csharp[XmlValidatingReader.SchemaType#1](~/snippets/csharp/System.Xml/XmlValidatingReader/ReadTypedValue/schematype.cs#1)] [!code-vb[XmlValidatingReader.SchemaType#1](~/snippets/visualbasic/VS_Snippets_Data/XmlValidatingReader.SchemaType/VB/schematype.vb#1)] @@ -3391,12 +3355,10 @@ The text node can be either an element or an attribute text node. > [!NOTE] > After calling this method, if the entity is part of an attribute value, you must call to step into the entity. - - ## Examples - The following example uses `ResolveEntity` to expand a general entity. - [!code-cpp[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp#1)] +The following example uses `ResolveEntity` to expand a general entity. + [!code-csharp[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/EntityHandling/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.ResolveEntity Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/VB/source.vb#1)] @@ -3466,12 +3428,10 @@ The text node can be either an element or an attribute text node. > [!NOTE] > The schemas must be added to the `XmlSchemaCollection` before the first `Read` call. - - ## Examples - The following example validates three XML files using schemas stored in the XmlSchemaCollection. - [!code-cpp[Classic WebData XmlValidatingReader.Schemas Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp#1)] +The following example validates three XML files using schemas stored in the XmlSchemaCollection. + [!code-csharp[Classic WebData XmlValidatingReader.Schemas Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/Schemas/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.Schemas Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/VB/source.vb#1)] @@ -3587,12 +3547,10 @@ object obj = vreader.SchemaType; > [!CAUTION] > After calling , SchemaType will return Null. - - ## Examples - The following example displays the type information for each of the elements in the XML document. - [!code-cpp[XmlValidatingReader.SchemaType#1](~/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp#1)] +The following example displays the type information for each of the elements in the XML document. + [!code-csharp[XmlValidatingReader.SchemaType#1](~/snippets/csharp/System.Xml/XmlValidatingReader/ReadTypedValue/schematype.cs#1)] [!code-vb[XmlValidatingReader.SchemaType#1](~/snippets/visualbasic/VS_Snippets_Data/XmlValidatingReader.SchemaType/VB/schematype.vb#1)] @@ -3898,12 +3856,10 @@ object obj = vreader.SchemaType; The callback handler can use the property to guarantee that an XML instance document is validated against a schema. The `Severity` property allows you to distinguish between validation errors (Severity is equal to XmlSeverityType.Error) that indicate a fatal error, and validation warnings (Severity is equal to XmlSeverityType.Warning) that indicate that no schema information is available. - - ## Examples - The following example validates a file against an XML Schema. - [!code-cpp[Classic WebData XmlValidatingReader.ValidationEventHandler Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp#1)] +The following example validates a file against an XML Schema. + [!code-csharp[Classic WebData XmlValidatingReader.ValidationEventHandler Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/ValidationEventHandler/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.ValidationEventHandler Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/VB/source.vb#1)] @@ -3973,12 +3929,10 @@ object obj = vreader.SchemaType; If external document type definitions (DTDs) or schemas are needed for validation, the is used. - - ## Examples - The following example validates two files. - [!code-cpp[Classic WebData XmlValidatingReader.ValidationType Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp#1)] +The following example validates two files. + [!code-csharp[Classic WebData XmlValidatingReader.ValidationType Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/ValidationType/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.ValidationType Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/VB/source.vb#1)] @@ -4076,12 +4030,10 @@ object obj = vreader.SchemaType; > [!NOTE] > The class is obsolete in .NET Framework 2.0. You can create a validating instance by using the class and the method. For more information, see the Remarks section of the reference page. - - ## Examples - The following example reads an XML file and displays each node. - [!code-cpp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp#1)] +The following example reads an XML file and displays each node. + [!code-csharp[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/csharp/System.Xml/XmlValidatingReader/Name/source.cs#1)] [!code-vb[Classic WebData XmlValidatingReader.Name Example#1](~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/VB/source.vb#1)] @@ -4215,12 +4167,10 @@ object obj = vreader.SchemaType; When validating using schemas, you can avoid the expensive load process by providing an using the property. - - ## Examples - The following example uses the `XmlResolver` property to specify the credentials necessary to access the networked DTD file. - [!code-cpp[XmlValidatingReader.XmlResolver#1](~/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp#1)] +The following example uses the `XmlResolver` property to specify the credentials necessary to access the networked DTD file. + [!code-csharp[XmlValidatingReader.XmlResolver#1](~/snippets/csharp/System.Xml/XmlValidatingReader/XmlResolver/vrdr_resolver.cs#1)] [!code-vb[XmlValidatingReader.XmlResolver#1](~/snippets/visualbasic/VS_Snippets_Data/XmlValidatingReader.XmlResolver/VB/vrdr_resolver.vb#1)] From b2acfb19b892fa47b034f3f1ba7bae75a42e3e99 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 15:03:14 -0700 Subject: [PATCH 2/8] delete the referenced snippets --- .../CPP/adapplicationbase.cpp | 29 - .../CPP/adclearprivatepath.cpp | 35 - .../ADDynamicBase/CPP/addynamicbase.cpp | 107 -- .../cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp | 126 -- .../ADGetAssemblies/CPP/adgetassemblies.cpp | 32 - .../ADGetData/CPP/adgetdata.cpp | 28 - .../ADMultiDomain/CPP/admultidomain.cpp | 49 - .../ADPrincipal/CPP/adprincipal.cpp | 55 - .../CPP/adsetappdomainpolicy.cpp | 46 - .../VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp | 39 - .../ADShadowCopy/CPP/adshadowcopy.cpp | 66 - .../ADToString/CPP/adtostring.cpp | 28 - .../VS_Snippets_CLR/ADUnload/CPP/adunload.cpp | 35 - .../ActivatorX/cpp/ActivatorX.cpp | 48 - .../ActivatorX/cpp/source2.cpp | 67 - .../AnimalAttributes/CPP/customattribute.cpp | 98 - .../CPP/reflectiononly.cpp | 47 - .../AppDomainInitializer/cpp/source.cpp | 68 - .../AppDomainX/cpp/AppDomainX.cpp | 102 - .../CPP/assemblyload.cpp | 45 - .../CPP/createcominstancefrom.cpp | 51 - .../CPP/ignorecase.cpp | 35 - .../CPP/definedynamicassembly.cpp | 56 - .../CPP/docallback_byref.cpp | 48 - .../CPP/docallback_byval.cpp | 49 - .../CPP/docallback_static.cpp | 40 - .../CPP/executeassembly.cpp | 17 - .../AppDomain_LoadRaw/CPP/loadraw.cpp | 77 - .../AppDomain_Setup/CPP/setup.cpp | 21 - .../AppDomain_TypeResolve/CPP/typeresolve.cpp | 90 - .../CPP/unhandledexception.cpp | 51 - .../cpp/ArgumentException.cpp | 38 - .../cpp/argumentexception2.cpp | 34 - .../ArrayList/CPP/ArrayListSample.cpp | 78 - .../CPP/arraytypemismatch_constructor1.cpp | 56 - .../CPP/arraytypemismatch_constructor2.cpp | 57 - .../CPP/arraytypemismatch_constructor3.cpp | 56 - .../Array_ConvertAll/cpp/source.cpp | 55 - .../Array_FindEtAl/cpp/source.cpp | 169 -- .../Array_FindIndex/cpp/source.cpp | 60 - .../Array_FindLastIndex/cpp/source.cpp | 60 - .../Array_IndexOf/cpp/source.cpp | 48 - .../Array_LastIndexOf/cpp/source.cpp | 51 - .../Array_Sort2IntIntIComparer/cpp/source.cpp | 124 -- .../Array_SortComparison/cpp/source.cpp | 106 -- .../Array_SortIntIntIComparer/cpp/source.cpp | 80 - .../Array_SortSearch/cpp/source.cpp | 91 - .../Array_SortSearchComparer/cpp/source.cpp | 103 - .../Assembly.FullName/CPP/Example.cpp | 23 - .../Assembly.GetExportedTypes/CPP/source.cpp | 78 - .../Assembly.Load1/CPP/load1.cpp | 23 - .../CPP/assemblybuilder_defineresource.cpp | 54 - .../AssemblyBuilderClass/cpp/24895.cpp | 222 --- .../cpp/AssemblyBuilderClass.vcxproj | 147 -- .../cpp/snippets.5000.json | 3 - ...ssemblybuilder_defineunmanagedresource.cpp | 66 - ...semblybuilder_defineunmanagedresource2.cpp | 66 - ...emblybuilder_defineversioninforesource.cpp | 167 -- .../assemblybuilder_setcustomattribute1.cpp | 62 - .../assemblybuilder_setcustomattribute2.cpp | 59 - .../AssemblyClass/cpp/source.cpp | 75 - .../AssemblyDelaySignAttribute/cpp/source.cpp | 13 - .../AssemblyFlagsAttribute/CPP/source.cpp | 79 - .../CPP/assemblyinstaller.cpp | 41 - .../assemblyinstaller_checkifinstallable.cpp | 35 - .../CPP/assemblyinstaller_helptext.cpp | 55 - .../CPP/assemblyinstaller_install.cpp | 53 - .../CPP/assemblyinstaller_rollback.cpp | 57 - .../CPP/assemblyinstaller_uninstall.cpp | 49 - .../AssemblyName.Version/cpp/Example.cpp | 21 - .../CPP/assemblyname_codebase.cpp | 99 - .../CPP/assemblyname_constructor.cpp | 84 - .../AssemblyName_Constructor_2/CPP/source.cpp | 24 - .../CPP/assemblyname_getassemblyname.cpp | 30 - .../CPP/assemblyname_keypair.cpp | 123 -- .../CPP/assemblyname_setpublickey.cpp | 125 -- .../AssemblyResolve/CPP/assemblyresolve.cpp | 79 - .../AsyncDelegateExamples/cpp/TestMethod.cpp | 27 - .../AsyncDelegateExamples/cpp/callback.cpp | 79 - .../AsyncDelegateExamples/cpp/polling.cpp | 43 - .../AsyncDelegateExamples/cpp/waithandle.cpp | 47 - .../AsyncResult.NewExamples/CPP/ad.cpp | 122 -- .../AttrTargs/CPP/attrtargs.cpp | 73 - .../VS_Snippets_CLR/Binder_1/CPP/binder.cpp | 449 ----- .../BindingFlags/CPP/bindingflagssample.cpp | 365 ---- .../VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp | 80 - .../CertSelect/CPP/certselect.cpp | 47 - .../CipherReference2/CPP/example.cpp | 38 - .../cpp/ClassInterfaceType.cpp | 41 - ...codeargumentreferenceexpressionexample.cpp | 43 - .../CPP/codearraycreateexpressionsnippet.cpp | 289 --- .../CPP/codearrayindexerexpressionsnippet.cpp | 301 --- .../CPP/codeassignstatementsnippet.cpp | 289 --- .../CPP/codeattacheventstatementexample.cpp | 81 - .../CPP/class1.cpp | 82 - .../CPP/class1.cpp | 90 - .../codebasereferenceexpressionexample.cpp | 29 - .../codebinaryoperatorexpressionexample.cpp | 32 - .../CPP/codecastexpressionexample.cpp | 33 - .../CPP/class1.cpp | 78 - .../CPP/codecommentexample.cpp | 37 - .../CPP/class1.cpp | 80 - .../CPP/codeconditionstatementexample.cpp | 40 - .../CPP/codeconstructorexample.cpp | 130 -- .../codedelegateinvokeexpressionexample.cpp | 98 - .../CodeDomExample/CPP/source.cpp | 309 --- .../CodeDomPartialTypeExample/CPP/source.cpp | 439 ----- .../CodeDomSampleBatch/CPP/class1.cpp | 100 - .../CodeDom_CompilerInfo/CPP/source.cpp | 327 ---- .../CPP/codeentrypointmethodexample.cpp | 59 - .../CPP/class1.cpp | 77 - .../CPP/class1.cpp | 37 - .../CPP/codegotostatementexample.cpp | 59 - .../CPP/codeiterationstatementexample.cpp | 35 - .../CPP/codemembereventexample.cpp | 59 - .../CPP/codememberfieldexample.cpp | 46 - .../CPP/class1.cpp | 38 - .../CPP/codemembermethodexample.cpp | 37 - .../CPP/codememberpropertyexample.cpp | 95 - .../CPP/codemethodinvokeexpressionexample.cpp | 32 - .../CPP/codemethodreferenceexample.cpp | 53 - .../CodeMultiExample/CPP/codemultiexample.cpp | 66 - .../CPP/class1.cpp | 78 - .../CPP/codenamespaceexample.cpp | 32 - .../CPP/codenamespaceimportexample.cpp | 45 - .../CPP/codeparameterdeclarationexample.cpp | 52 - .../CPP/class1.cpp | 81 - .../CPP/codeprimitiveexpressionexample.cpp | 37 - .../CPP/codepropertysetvalueexample.cpp | 70 - .../CPP/codereferenceexample.cpp | 53 - .../CPP/coderemoveeventexample.cpp | 33 - .../CPP/class1.cpp | 78 - .../codethrowexceptionstatementexample.cpp | 24 - .../CPP/codetrycatchfinallyexample.cpp | 81 - .../CPP/codetypeconstructorexample.cpp | 42 - .../CPP/class1.cpp | 80 - .../CPP/codetypedeclarationexample.cpp | 41 - .../CPP/codetypedelegateexample.cpp | 78 - .../CPP/class1.cpp | 79 - .../CPP/codetypeofexample.cpp | 63 - .../CPP/class1.cpp | 78 - ...odevariabledeclarationstatementexample.cpp | 28 - .../CompareInfo/cpp/CompareInfo.cpp | 46 - .../CPP/class1.cpp | 77 - .../CompilerParametersExample/CPP/source.cpp | 234 --- .../CompilerResultsExample/CPP/class1.cpp | 54 - .../componentinstaller_copyfromcomponent.cpp | 51 - .../Console-EXPANDTABSEX/CPP/expandtabsex.cpp | 66 - .../CPP/constructorbuilder_attributes_4.cpp | 155 -- .../CPP/constructorbuilder_getmodule_4.cpp | 127 -- .../CPP/constructorbuilder_name_5.cpp | 123 -- ...constructorbuilder_setcustomattribute1.cpp | 91 - ...constructorbuilder_setcustomattribute2.cpp | 86 - ...structorbuilder_setimplementationflags.cpp | 128 -- ...nstructorbuilder_setsymcustomattribute.cpp | 106 -- ...countercreationdatacollection_addrange.cpp | 65 - ...countercreationdatacollection_contains.cpp | 79 - .../countercreationdatacollection_ctor.cpp | 66 - .../countercreationdatacollection_ctor.cpp | 62 - ...rcreationdatacollection_insert_indexof.cpp | 75 - .../CPP/countersample_ctor_2.cpp | 69 - .../CreateInstanceAndUnwrap2/cpp/source.cpp | 36 - .../CPP/fileexample.cpp | 146 -- .../CPP/memoryexample.cpp | 170 -- .../CPP/asnencodeddata.cpp | 90 - .../CPP/fileexample.cpp | 146 -- .../CPP/memoryexample.cpp | 170 -- .../CPP/fileexample.cpp | 113 -- .../CPP/memoryexample.cpp | 105 -- .../CPP/dataprotectionsample.cpp | 82 - .../Cryptography.KeyNumber/cpp/sample.cpp | 20 - .../CPP/memoryprotectionsample.cpp | 19 - .../Cryptography.Oid/CPP/cryptography.oid.cpp | 61 - .../cpp/sample.cpp | 100 - .../CPP/fileexample.cpp | 146 -- .../CPP/memoryexample.cpp | 170 -- .../cpp/example.cpp | 57 - .../CPP/example.cpp | 52 - .../CPP/example.cpp | 81 - .../CPP/example.cpp | 107 -- .../CPP/example.cpp | 94 - .../CPP/example.cpp | 110 -- .../CPP/example2.cpp | 77 - .../CPP/example.cpp | 174 -- .../CPP/example.cpp | 104 - .../CPP/example.cpp | 175 -- .../CPP/sample.cpp | 63 - .../CPP/Cryptography.SmartCardCSP.cpp | 38 - .../CPP/sample.cpp | 29 - .../CPP/sample.cpp | 28 - .../CPP/example.cpp | 27 - .../CPP/sample.cpp | 63 - .../CPP/sample.cpp | 207 -- .../CPP/sample.cpp | 178 -- .../CPP/sample.cpp | 169 -- .../CPP/sample.cpp | 179 -- .../CPP/Cryptography.XML.XMLEncMapKey.cpp | 200 -- .../CPP/Cryptography.XML.XMLEncMapKeyX509.cpp | 133 -- .../Cryptography.XML.XMLEncMinimalDecrypt.cpp | 135 -- ...ptography.XML.XMLEncMinimalDecryptData.cpp | 196 -- .../CPP/example.cpp | 181 -- .../CPP/sample.cpp | 178 -- .../CPP/sample.cpp | 202 -- .../CPP/sample.cpp | 193 -- .../cpp/sample.cpp | 75 - .../CPP/currencydecimaldigits.cpp | 29 - .../CPP/currencydecimalseparator.cpp | 29 - .../CPP/currencygroupseparator.cpp | 29 - .../CPP/currencygroupsizes.cpp | 34 - .../CustomAttributeData/CPP/source.cpp | 234 --- .../DataBinding/CPP/webcustomcontrol1.cpp | 328 ---- .../DateTime Operators/CPP/class1.cpp | 30 - .../DateTime.Add/CPP/class1.cpp | 12 - .../DateTime.AddDays/CPP/class1.cpp | 15 - .../DateTime.CompareTo/CPP/class1.cpp | 34 - .../DateTime.DayOfWeek/CPP/dow.cpp | 21 - .../DateTime.DaysInMonth/CPP/class1.cpp | 22 - .../DateTime.Equals/CPP/class1.cpp | 22 - .../DateTime.FromFileTime/CPP/class1.cpp | 44 - .../CPP/class1.cpp | 34 - .../DateTime.Subtraction/CPP/class1.cpp | 27 - .../DateTime.ToFileTime/CPP/class1.cpp | 21 - .../CPP/class1.cpp | 49 - .../Decimal Example/CPP/source.cpp | 144 -- .../cpp/source.cpp | 51 - .../cpp/source.cpp | 56 - .../CPP/source.cpp | 78 - .../CPP/diagnostics_countercreationdata.cpp | 63 - .../Dictionary/cpp/Dictionary.cpp | 398 ---- .../Dictionary/cpp/remarks.cpp | 44 - .../CPP/dirinfo class example.cpp | 37 - .../DirInfo Create/CPP/dirinfo create.cpp | 37 - .../DirInfo Ctor/CPP/dirinfo ctor.cpp | 30 - .../DirInfo Delete1/CPP/dirinfo delete1.cpp | 29 - .../DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp | 28 - .../Dir_CreateDir/CPP/dir_createdir.cpp | 35 - .../Dir_GetCreation/CPP/dir_getcreation.cpp | 40 - .../Dir_GetCurDir/CPP/dir_getcurdir.cpp | 37 - .../Dir_GetDirs2/CPP/dir_getdirs2.cpp | 26 - .../Dir_GetFiles2/CPP/dir_getfiles2.cpp | 26 - .../CPP/dir_getlastaccess.cpp | 32 - .../Dir_GetLastWrite/CPP/dir_getlastwrite.cpp | 37 - .../CPP/dir_setlastaccess.cpp | 32 - .../Dir_SetLastWrite/CPP/dir_setlastwrite.cpp | 37 - .../CPP/copydirectory.cpp | 36 - .../Double Example/CPP/source.cpp | 531 ------ .../CPP/gettype.cpp | 30 - .../CPP/referenceequals.cpp | 24 - .../Emit.ArgIterator/cpp/source.cpp | 111 -- .../EmitGenericType/CPP/source.cpp | 300 --- .../CPP/entrywritteneventargs_ctor1.cpp | 49 - .../CPP/entrywritteneventargs_ctor2.cpp | 59 - .../CPP/enumbuilder_properties_4.cpp | 87 - .../CPP/enumbuilder_properties_5.cpp | 92 - .../CPP/enumbuilder_setcustomattribute1.cpp | 107 -- .../CPP/enumbuilder_setcustomattribute2.cpp | 93 - .../CPP/getcommandlineargs.cpp | 20 - .../CPP/getenvironmentvariables.cpp | 16 - .../CPP/getfolderpath.cpp | 16 - .../CPP/getlogicaldrives.cpp | 17 - .../CPP/machinename.cpp | 19 - .../Environment.NewLine/CPP/newline.cpp | 18 - .../Environment.StackTrace/CPP/stacktrace.cpp | 19 - .../CPP/systemdirectory.cpp | 18 - .../Environment.TickCount/CPP/tickcount.cpp | 20 - .../CPP/userinteractive.cpp | 16 - .../Environment.UserName/CPP/username.cpp | 13 - .../Environment.Version/CPP/version.cpp | 17 - .../Environment.WorkingSet/CPP/workingset.cpp | 15 - .../VS_Snippets_CLR/EventArg/CPP/eventarg.cpp | 29 - .../CPP/eventlogentrytype_6.cpp | 110 -- .../CPP/eventlogentry_copyto.cpp | 72 - .../CPP/eventlogentry_item.cpp | 67 - .../CPP/eventlogentry_source.cpp | 65 - .../CPP/eventloginstaller.cpp | 50 - .../EventLogProperties/CPP/source.cpp | 187 -- .../CPP/source.cpp | 137 -- .../CPP/eventlog_exists_1.cpp | 36 - .../CPP/eventlog_writeentry_1_3.cpp | 53 - .../CPP/eventlog_writeentry_4.cpp | 42 - .../CPP/eventlog_writeentry_5.cpp | 58 - .../ExToString/CPP/extostring.cpp | 34 - .../FInfo AppendText/CPP/finfo appendtext.cpp | 79 - .../FInfo Class/CPP/finfo class.cpp | 60 - .../FInfo CopyTo2/CPP/finfo copyto2.cpp | 38 - .../FInfo Create/CPP/finfo create.cpp | 53 - .../FInfo CreateText/CPP/finfo createtext.cpp | 48 - .../FInfo Ctor/CPP/finfo ctor.cpp | 72 - .../FInfo Delete/CPP/finfo delete.cpp | 39 - .../FInfo Open1/CPP/finfo open1.cpp | 65 - .../FInfo Open2/CPP/finfo open2.cpp | 80 - .../FInfo OpenRead/CPP/finfo openread.cpp | 64 - .../FInfo OpenText/CPP/file opentext.cpp | 47 - .../FInfo OpenWrite/CPP/file openwrite.cpp | 63 - .../FStream CanSeek/CPP/fstream canseek.cpp | 35 - .../FStream CanWrite/CPP/fstream canwrite.cpp | 32 - .../FStream Class/CPP/fstream class.cpp | 68 - .../CPP/fieldbuilder_reflectedtype.cpp | 84 - .../CPP/fieldbuilder_setcustomattributes.cpp | 132 -- .../CPP/fieldbuilder_setoffset.cpp | 74 - .../FieldInfo/CPP/fieldinfo.cpp | 34 - .../CPP/fieldinfo_fieldhandle.cpp | 50 - .../CPP/fieldinfo_getfieldfromhandle.cpp | 36 - .../CPP/fieldinfo_getvalue.cpp | 40 - .../CPP/fieldinfo_isnotserialized.cpp | 34 - .../CPP/fieldinfo_ispinvokeimpl.cpp | 29 - .../CPP/fieldinfo_isprivate.cpp | 53 - .../CPP/fieldinfo_isspecialname.cpp | 34 - .../CPP/fieldinfo_setvalue.cpp | 51 - .../CPP/file class example.cpp | 61 - .../File Create1/CPP/file create1.cpp | 41 - .../File Create2/CPP/file create2.cpp | 41 - .../File CreateText/CPP/file createtext.cpp | 41 - .../CPP/file getattributes.cpp | 32 - .../CPP/file getlastaccess.cpp | 32 - .../CPP/file getlastwrite.cpp | 37 - .../File Move/CPP/file move.cpp | 44 - .../File Open1/CPP/file open1.cpp | 41 - .../File Open2/CPP/file open2.cpp | 57 - .../File Open3/CPP/file open3.cpp | 65 - .../File OpenRead/CPP/file openread.cpp | 45 - .../File OpenText/CPP/file opentext.cpp | 43 - .../File OpenWrite/CPP/file openwrite.cpp | 47 - .../CPP/file setlastaccess.cpp | 34 - .../CPP/file setlastwrite.cpp | 37 - .../FileInfoCopyTo1/CPP/fileinfocopyto1.cpp | 50 - .../FileLength/CPP/filelength.cpp | 45 - .../FileSystemInfo/cpp/program.cpp | 58 - .../File_AppendText/CPP/file_appendtext.cpp | 58 - .../GCNotification/cpp/program.cpp | 242 --- .../Generic.Dictionary/cpp/source.cpp | 184 -- .../Generic.Dictionary/cpp/source2.cpp | 35 - .../Generic.IDictionary/cpp/source.cpp | 182 -- .../Generic.IDictionary/cpp/source2.cpp | 34 - .../Generic.LinkedList/cpp/source.cpp | 264 --- .../Generic.SortedList/cpp/remarks.cpp | 41 - .../Generic.SortedList/cpp/source.cpp | 198 -- .../GenericMethodBuilder/cpp/source.cpp | 114 -- .../GetCustomAttributes/CPP/ca1.cpp | 42 - .../GetCustomAttributes/CPP/custattrs.cpp | 258 --- .../GetFldVal/CPP/getfldval.cpp | 22 - .../HMACRIPEMD160/CPP/hmacripemd160.cpp | 134 -- .../HMACSHA256/CPP/hmacsha256.cpp | 134 -- .../HMACSHA384/CPP/hmacsha384.cpp | 134 -- .../HMACSHA512/CPP/hmacsha512.cpp | 134 -- .../IComparable Example/CPP/source.cpp | 81 - .../IComparable`1 Example/CPP/source.cpp | 99 - .../CPP/ilgenerator_beginfaultblock.cpp | 102 - .../CPP/ILGenerator_BeginFinallyBlock_2.cpp | 114 -- .../CPP/ilgenerator_begin_endscope.cpp | 97 - .../cpp/sample.cpp | 86 - .../IO.File.Encrypt-Decrypt/cpp/sample.cpp | 49 - .../cpp/sample.cpp | 67 - .../IO.File.Replace/cpp/sample.cpp | 39 - .../cpp/sample.cpp | 60 - .../IO.FileInfo.Exists/cpp/sample.cpp | 49 - .../cpp/sample.cpp | 97 - .../IO.FileInfo.Replace/cpp/sample.cpp | 64 - .../IO.FileInfo.isReadOnly/cpp/sample.cpp | 47 - .../IO.FileStream.ctor1/cpp/example.cpp | 60 - .../IO.FileStream.ctor2/cpp/example.cpp | 74 - .../cpp/example.cpp | 67 - .../IO.Ports.GetPortNames/cpp/example.cpp | 30 - .../ImprovedInteropSnippets/CPP/codefile1.cpp | 14 - .../ImprovedInteropSnippets/CPP/codefile2.cpp | 57 - .../ImprovedInteropSnippets/CPP/codefile3.cpp | 31 - .../ImprovedInteropSnippets/CPP/codefile4.cpp | 25 - .../ImprovedInteropSnippets/CPP/codefile5.cpp | 26 - .../IndentedTextWriterExample/CPP/form1.cpp | 120 -- .../VS_Snippets_CLR/InnerEx/CPP/innerex.cpp | 53 - .../CPP/installcontext_installcontext.cpp | 136 -- .../InstallEventArgs/CPP/installeventargs.cpp | 124 -- .../InstallException/CPP/installexception.cpp | 114 -- .../Installer/CPP/installer.cpp | 82 - .../CPP/installercollection_add.cpp | 114 -- .../CPP/installercollection_addrange1.cpp | 60 - .../CPP/installercollection_copyto.cpp | 65 - .../CPP/installercollection_insert.cpp | 60 - .../CPP/installercollection_item.cpp | 65 - .../CPP/installercollection_remove.cpp | 81 - .../CPP/installer_afterinstall.cpp | 88 - .../CPP/installer_afterrollback.cpp | 72 - .../CPP/installer_afteruninstall.cpp | 89 - .../CPP/installer_beforeinstall.cpp | 90 - .../CPP/installer_beforerollback.cpp | 88 - .../CPP/installer_beforeuninstall.cpp | 89 - .../CPP/installer_committed.cpp | 83 - .../CPP/installer_committed.cpp | 58 - .../CPP/installer_committing.cpp | 59 - .../CPP/installer_context.cpp | 73 - .../CPP/installer_helptext.cpp | 69 - .../CPP/installer_install.cpp | 48 - .../CPP/installer_installers.cpp | 51 - .../CPP/installer_oninstall.cpp | 79 - .../CPP/installer_rollback.cpp | 53 - .../CPP/installer_uninstall.cpp | 41 - .../Int16_Equals/CPP/int16_equals.cpp | 357 ---- .../Int32_Equals/CPP/int32_equals.cpp | 357 ---- .../Int64_Equals/CPP/int64_equals.cpp | 357 ---- .../CPP/callingconv.cpp | 25 - .../Interop InOutParameters/CPP/inout.cpp | 29 - .../InvokeMem/CPP/invokemem.cpp | 90 - .../IsDefaultAttribute/CPP/defattr.cpp | 85 - .../IsDefined/CPP/isdefined.cpp | 276 --- .../IsolatedStoragePermissionAttribute.cpp | 92 - .../KeyedCollection/cpp/source.cpp | 220 --- .../KeyedCollection2/cpp/source.cpp | 341 ---- .../CPP/lcidattrsample.cpp | 42 - .../LayoutKind/CPP/layoutkind.cpp | 76 - .../List`1_AsReadOnly/cpp/source.cpp | 68 - .../List`1_Class/cpp/source.cpp | 104 - .../List`1_ConvertAll/cpp/source.cpp | 51 - .../List`1_CopyTo/cpp/source.cpp | 53 - .../List`1_FindEtAl/cpp/source.cpp | 97 - .../List`1_IndexOf/cpp/source.cpp | 51 - .../List`1_LastIndexOf/cpp/source.cpp | 51 - .../List`1_Ranges/cpp/source.cpp | 105 -- .../List`1_Reverse/cpp/source.cpp | 64 - .../List`1_SortComparison/cpp/source.cpp | 106 -- .../List`1_SortSearch/cpp/source.cpp | 89 - .../List`1_SortSearchComparer/cpp/source.cpp | 164 -- .../cpp/source.cpp | 141 -- .../CPP/localbuilder_sample_4.cpp | 92 - .../cpp/source.cpp | 71 - .../VS_Snippets_CLR/Marshal/cpp/marshal.cpp | 67 - .../MathSample/CPP/mathsample.cpp | 88 - ...emberinfo_getcustomattribute_isdefined.cpp | 68 - .../CPP/memberinfo_getcustomattributes1.cpp | 67 - .../VS_Snippets_CLR/MethodBody/cpp/source.cpp | 157 -- .../cpp/source.cpp | 41 - .../CPP/methodbuilderclass.cpp | 67 - .../MethodInfo.Generics/cpp/source.cpp | 132 -- .../CPP/source.cpp | 92 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 64 - .../CPP/source2.cpp | 34 - .../CPP/source.cpp | 93 - .../cpp/MissingMethodException.cpp | 72 - .../ModuleBuilder_Class/CPP/modulebuilder.cpp | 80 - .../modulebuilder_createglobalfunctions.cpp | 79 - .../CPP/modulebuilder_definedocument.cpp | 49 - .../CPP/modulebuilder_defineenum.cpp | 46 - .../modulebuilder_defineinitializeddata.cpp | 67 - .../modulebuilder_definepinvokemethod1.cpp | 68 - .../CPP/modulebuilder_defineresource1.cpp | 50 - .../CPP/modulebuilder_defineresource2.cpp | 50 - .../CPP/modulebuilder_getarraymethod.cpp | 110 -- .../MonitorExmpl2/CPP/monitor2.cpp | 331 ---- .../CPP/delegatestring.cpp | 149 -- .../CPP/numberdecimaldigits.cpp | 27 - .../CPP/numberdecimalseparator.cpp | 28 - .../NumberFormatInfo/cpp/NumberFormatInfo.cpp | 47 - .../CPP/numbergroupseparator.cpp | 27 - .../NumberGroupSizes/CPP/numbergroupsizes.cpp | 32 - .../NumberStyles/cpp/NumberStyles.cpp | 41 - .../ObjDispEx/CPP/objdispexc.cpp | 20 - .../ObjectModel.Collection/cpp/source.cpp | 115 -- .../VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp | 107 -- .../OperatingSystem.ServicePack/CPP/sp.cpp | 18 - .../CPP/osvs.cpp | 20 - .../CPP/parameterinfo_attributes1.cpp | 38 - ...meterInfo_GetCustomAttribute_IsDefined.cpp | 87 - .../CPP/source.cpp | 82 - .../ParameterInfo_IsIn_IsOut_IsOptional.cpp | 103 - .../Path Class/CPP/path class.cpp | 38 - .../CPP/percentdecimaldigits.cpp | 27 - .../CPP/percentdecimalseparator.cpp | 28 - .../CPP/percentgroupseparator.cpp | 28 - .../CPP/percentgroupsizes.cpp | 33 - .../PerfCounter/CPP/perfcounter.cpp | 102 - .../PerfCounter_ccd/CPP/ccd.cpp | 25 - .../CPP/performancecounterinstaller.cpp | 50 - .../CPP/averagecount32.cpp | 138 -- .../CPP/elapsedtime.cpp | 208 -- .../Permission/cpp/Permission.cpp | 279 --- .../CPP/processstaticget.cpp | 40 - .../CPP/processstart.cpp | 28 - .../CPP/processstartstatic.cpp | 47 - .../CPP/processstartstatic2.cpp | 52 - .../CPP/processstartstatic3.cpp | 17 - .../ProcessModule/CPP/processmodule.cpp | 56 - .../CPP/processmodule_baseaddress.cpp | 53 - .../CPP/processmodule_entrypoint.cpp | 50 - .../CPP/processmodule_filename.cpp | 53 - .../CPP/processmodule_fileversioninfo.cpp | 52 - .../CPP/processmodule_modulememorysize.cpp | 53 - .../CPP/processmodule_modulename.cpp | 53 - .../CPP/processmodule_tostring.cpp | 53 - .../ProcessOneStream/CPP/stdstr.cpp | 24 - .../CPP/process_mainwindowtitle.cpp | 41 - .../Process_StandardError/CPP/source.cpp | 48 - .../CPP/process_standardinput.cpp | 76 - .../CPP/process_standardoutput.cpp | 26 - .../CPP/process_synchronizingobject.cpp | 110 -- .../CPP/remarks.cpp | 138 -- .../CPP/progidattribute_value.cpp | 39 - .../CPP/propertybuilder_setgetmethod_4.cpp | 130 -- .../PropertyInfo.SetValue/cpp/Example.cpp | 132 -- .../PropertyInfo.SetValue/cpp/example2.cpp | 65 - .../PtrToStructure/CPP/pts.cpp | 77 - .../RIPEMD160/CPP/ripemd160.cpp | 77 - .../cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp | 75 - .../ReadTextFile/CPP/readtextfile.cpp | 35 - .../CPP/directorylisting.cpp | 69 - .../cpp/source.cpp | 253 --- .../cpp/source.cpp | 81 - .../Reflection/CPP/reflection.cpp | 172 -- .../VS_Snippets_CLR/Regex_Words/CPP/words.cpp | 36 - .../RegistryKey.OpenSubKey/CPP/opensubkey.cpp | 41 - .../RegistrySecurity101/cpp/source.cpp | 145 -- .../CPP/RegistryValueOptions.cpp | 30 - .../CPP/source.cpp | 28 - .../CPP/resourcepermissionbase.cpp | 149 -- .../RijndaelManaged Example/CPP/class1.cpp | 172 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../cpp/sample.cpp | 128 -- .../CPP/sample.cpp | 127 -- .../cpp/sample.cpp | 18 - .../cpp/sample.cpp | 16 - .../cpp/sample.cpp | 19 - .../cpp/sample.cpp | 19 - .../cpp/sample.cpp | 20 - .../cpp/sample.cpp | 19 - .../cpp/sample.cpp | 21 - .../cpp/sample.cpp | 18 - .../cpp/sample.cpp | 22 - .../cpp/sample.cpp | 18 - .../CPP/stringtohglobalansi.cpp | 23 - .../CPP/sample.cpp | 20 - .../cpp/RuntimeEnvironment.cpp | 46 - .../SecureString.xAt/CPP/SecureString.xAt.cpp | 85 - .../CPP/SecureString.xChar.cpp | 62 - .../CPP/SecurityElementMembers.cpp | 290 --- .../CPP/servicecontroller.cpp | 344 ---- .../ServiceInstallConfig/CPP/source.cpp | 372 ---- .../StackFrameSample1/CPP/source.cpp | 280 --- .../CPP/stacktracesample1.cpp | 147 -- .../CPP/stacktracesample2.cpp | 72 - .../CPP/stacktracesample3.cpp | 88 - .../StopWatchPerfSample/CPP/source.cpp | 201 -- .../StringBuilder/cpp/StringBuilder.cpp | 59 - .../CPP/stringcompareordinal.cpp | 34 - .../StringCompareTo/CPP/stringcompareto.cpp | 40 - .../StringInfo/cpp/StringInfo.cpp | 84 - .../StrmRdrRead/CPP/strmrdrread.cpp | 24 - .../StrmReader Ctor1/CPP/strmreader ctor1.cpp | 52 - .../StrmReader Ctor2/CPP/strmreader ctor2.cpp | 44 - .../CPP/strmreader currentencoding.cpp | 53 - .../StrmReader Peek/CPP/strmreader peek.cpp | 45 - .../StrmReader Read1/CPP/strmreader read1.cpp | 44 - .../StrmReader Read2/CPP/strmreader read2.cpp | 52 - .../CPP/strmreader readline.cpp | 45 - .../CPP/strmreader readtoend.cpp | 42 - .../cpp/strongnamekeypairx.cpp | 49 - .../CPP/structlayoutattribute.cpp | 78 - .../VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp | 134 -- .../cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp | 181 -- .../TestBaseType/CPP/testbasetype.cpp | 10 - .../TestFullName/CPP/TestFullName.cpp | 14 - .../CPP/TestGetElementType.cpp | 23 - .../cpp/testisassignablefrom.cpp | 108 -- .../TestIsEnum/CPP/TestIsEnum.cpp | 21 - .../CPP/testisinstanceoftype.cpp | 38 - .../cpp/source.cpp | 47 - .../ThreadAbEx/CPP/threadabex.cpp | 46 - .../ThreadStEx/CPP/threadstex.cpp | 33 - .../ThreadStart/CPP/threadstart.cpp | 37 - .../TimeoutException.class/cpp/to.cpp | 53 - .../CPP/transactedinstaller.cpp | 129 -- .../Type.IsPublic/CPP/type_ispublic.cpp | 20 - .../CPP/Type.StructLayoutAttribute.cpp | 40 - .../cpp/source.cpp | 104 - .../typebuilder_adddeclarativesecurity.cpp | 47 - .../CPP/typebuilder_definenestedtype1.cpp | 94 - .../cpp/100656_fix.cpp | 64 - .../typebuilder_defineuninitializeddata.cpp | 98 - .../CPP/typebuilder_getevents1.cpp | 64 - .../CPP/typebuilder_properties.cpp | 66 - .../CPP/typebuilder_sample_4.cpp | 103 - .../TypeLibVar/CPP/codefile6.cpp | 25 - .../CPP/typeloadexception_constructor2.cpp | 32 - .../CPP/typeloadexception_constructor3.cpp | 56 - .../CPP/typeloadexception_getobjectdata.cpp | 112 -- .../CPP/typeloadexception_typename.cpp | 39 - .../Type_Assembly/CPP/type_assembly.cpp | 20 - .../CPP/type_defaultbinder.cpp | 32 - .../CPP/type_filterattribute.cpp | 36 - .../CPP/type_filternameignorecase.cpp | 36 - .../CPP/type_findinterfaces.cpp | 69 - .../Type_FindMembers/CPP/type_findmembers.cpp | 48 - .../CPP/type_getarrayrank.cpp | 27 - .../CPP/type_getconstructor.cpp | 42 - .../CPP/type_getconstructor2.cpp | 50 - .../CPP/type_getconstructor3.cpp | 50 - .../CPP/type_getdefaultmembers.cpp | 58 - .../Type_GetEvent/CPP/type_getevent.cpp | 41 - .../Type_GetField/CPP/type_getfield.cpp | 97 - .../CPP/type_gethashcode_getfields.cpp | 49 - .../CPP/type_getinterface.cpp | 52 - .../CPP/type_getinterfaces1.cpp | 30 - .../Type_GetMember/CPP/type_getmember.cpp | 100 - .../Type_GetMembers1/CPP/type_getmembers1.cpp | 52 - .../Type_GetMembers2/CPP/type_getmembers2.cpp | 66 - .../Type_GetMethod1/CPP/type_getmethod1.cpp | 24 - .../Type_GetMethod2/CPP/type_getmethod2.cpp | 25 - .../Type_GetMethod3/CPP/type_getmethod3.cpp | 64 - .../Type_GetMethod4/CPP/type_getmethod4.cpp | 47 - .../Type_GetMethod5/CPP/type_getmethod5.cpp | 59 - .../Type_GetMethods2/CPP/type_getmethods2.cpp | 54 - .../CPP/type_getnestedclassesabs.cpp | 56 - .../CPP/type_getnestedtypes.cpp | 43 - .../CPP/type_getproperties2.cpp | 153 -- .../CPP/type_getproperty1.cpp | 45 - .../CPP/type_getproperty2.cpp | 45 - .../CPP/type_getproperty3.cpp | 58 - .../CPP/type_getproperty2.cpp | 53 - .../CPP/type_getproperty_types.cpp | 55 - .../Type_GetType/CPP/type_gettype.cpp | 32 - .../Type_GetTypeCode/CPP/type_gettypecode.cpp | 72 - .../CPP/type_gettypefromhandle.cpp | 23 - .../CPP/type_gettypefromprogid2.cpp | 32 - .../CPP/Type_GetTypeFromProgID3.cpp | 32 - .../CPP/Type_GetTypeFromProgID4.cpp | 35 - .../CPP/Type_GetTypeHandle.cpp | 57 - .../Type_Guid/CPP/type_guid.cpp | 25 - .../CPP/type_haselementtype.cpp | 55 - .../CPP/type_haselementtypeimpl.cpp | 86 - .../Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp | 38 - .../Type_IsArrayImpl/CPP/type_isarrayimpl.cpp | 68 - .../CPP/type_isautolayout.cpp | 40 - .../Type_IsClass/CPP/type_isclass.cpp | 23 - .../CPP/type_iscontextful.cpp | 49 - .../CPP/type_iscontextfulimpl.cpp | 82 - .../Type_IsInterface/CPP/type_isinterface.cpp | 35 - .../CPP/type_islayoutsequential.cpp | 40 - .../CPP/type_ismarshalbyrefimpl.cpp | 81 - .../CPP/type_isprimitiveimpl.cpp | 73 - .../Type_IsSealed/CPP/type_issealed.cpp | 21 - .../CPP/type_isserializable.cpp | 37 - .../Type_IsValueType/CPP/type_isvaluetype.cpp | 24 - .../Type_ToString/CPP/type_tostring.cpp | 31 - .../Type_TypeHandle/CPP/type_typehandle.cpp | 42 - .../UInt16 Example/CPP/source.cpp | 631 ------- .../UInt16_Equals/CPP/uint16_equals.cpp | 34 - .../UInt32 Example/CPP/source.cpp | 417 ----- .../UInt32_Equals/CPP/uint32_equals.cpp | 34 - .../UInt64 Example/CPP/source.cpp | 405 ---- .../UInt64_Equals/CPP/uint64_equals.cpp | 23 - .../CPP/uninstallaction_noaction_remove_3.cpp | 95 - .../UnmanagedMarshalObsolete/cpp/source.cpp | 63 - .../Uri_IsHexDigit/CPP/uri_ishexdigit.cpp | 43 - .../ValueType.Equals Example/CPP/source.cpp | 28 - .../WaitHandle/cpp/WaitHandle.cpp | 71 - .../CPP/source.cpp | 93 - .../CPP/example.cpp | 25 - .../CPP/example.cpp | 18 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 26 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 26 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 26 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 26 - .../CPP/example.cpp | 21 - .../CPP/example.cpp | 27 - .../CPP/sample.cpp | 173 -- .../XMLDSIG Signing/CPP/source.cpp | 57 - .../XMLDSIG Verification/CPP/source.cpp | 36 - .../adproperties/CPP/adproperties.cpp | 67 - .../VS_Snippets_CLR/capikey/CPP/capikey.cpp | 22 - .../VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp | 57 - .../char.surrogate/CPP/sur.cpp | 85 - .../VS_Snippets_CLR/console.beep/CPP/beep.cpp | 42 - .../VS_Snippets_CLR/console.beep2/CPP/b2.cpp | 124 -- .../console.bufferHW/CPP/hw.cpp | 18 - .../console.cancelkeypress/cpp/ckp.cpp | 74 - .../console.cursorLTS/CPP/lts.cpp | 75 - .../console.cursorsize/CPP/csize.cpp | 45 - .../console.cursorvis/CPP/vis.cpp | 75 - .../console.keyavailable/CPP/ka.cpp | 40 - .../VS_Snippets_CLR/console.read/CPP/read.cpp | 82 - .../console.readkey1/CPP/rk.cpp | 37 - .../console.readkey2/CPP/rkbool.cpp | 35 - .../console.setwindowsize/CPP/sws.cpp | 55 - .../console.title/CPP/mytitle.cpp | 26 - .../console.windowLT/CPP/wlt.cpp | 135 -- .../console.writelineFmt1/cpp/wl.cpp | 102 - .../consolein/CPP/consolein.cpp | 15 - .../convert.tobase64chararray/CPP/tb64ca.cpp | 100 - .../convert.tobase64string/CPP/tb64s.cpp | 113 -- .../CPP/convertchangetype.cpp | 14 - .../cpp/encrypteddata.cpp | 61 - .../CPP/example.cpp | 71 - .../CPP/encrypteddata.cpp | 55 - .../datetime.ctor_Int64/CPP/ticks.cpp | 39 - .../CPP/directoryinfocreatesub.cpp | 28 - .../CPP/directoryinfodelete.cpp | 29 - .../CPP/directoryinfogetdirectories.cpp | 23 - .../CPP/directoryinfomoveto.cpp | 44 - .../CPP/directoryinfoparent.cpp | 27 - .../enum.tostring/CPP/tostr.cpp | 47 - .../enumcompareto/CPP/EnumCompareTo.cpp | 31 - .../enumequals/CPP/EnumEquals.cpp | 44 - .../enumformat/CPP/EnumFormat.cpp | 20 - .../enumgetname/CPP/EnumGetName.cpp | 22 - .../enumgetnames/CPP/EnumGetNames.cpp | 49 - .../enumgetvalues/CPP/EnumGetValues.cpp | 48 - .../enumparse/CPP/EnumParse.cpp | 42 - .../CPP/commandline.cpp | 19 - .../CPP/expandenvironmentvariables.cpp | 23 - .../environment.class/CPP/env0.cpp | 104 - .../environment.processorcount/CPP/pc.cpp | 16 - .../CPP/source.cpp | 73 - .../eventlog_WriteEvent/CPP/source.cpp | 277 --- .../eventsoverview/cpp/programwithdata.cpp | 67 - .../exception.data/CPP/data.cpp | 89 - .../CPP/fileinfoappendtext.cpp | 29 - .../fileinfocopyto/CPP/fileinfocopyto.cpp | 43 - .../fileinfodelete/CPP/fileinfodelete.cpp | 21 - .../CPP/fileinfodirectory.cpp | 35 - .../fileinfomain/CPP/fileinfomain.cpp | 28 - .../fileinfoname/CPP/fileinfoname.cpp | 31 - .../fileinfoopen/CPP/fileinfoopen.cpp | 40 - .../generic.ReadOnlyCollection/cpp/source.cpp | 92 - .../VS_Snippets_CLR/math.atanx/CPP/atan.cpp | 47 - .../math.bigmul/CPP/bigmul.cpp | 22 - .../cpp/VS_Snippets_CLR/math.max/CPP/max.cpp | 59 - .../cpp/VS_Snippets_CLR/math.min/CPP/min.cpp | 59 - .../VS_Snippets_CLR/math.sign/CPP/sign.cpp | 59 - .../pathcombine/CPP/pathcombine.cpp | 40 - .../platformID.class/CPP/pid.cpp | 39 - .../CPP/datareceivedevent.cpp | 55 - .../process_asyncstreams/CPP/net_async.cpp | 227 --- .../process_asyncstreams/CPP/nmake_async.cpp | 258 --- .../process_asyncstreams/CPP/sort_async.cpp | 136 -- .../process_refresh/CPP/process_refresh.cpp | 60 - .../process_sample/CPP/process_sample.cpp | 73 - .../cpp/snippet8.cpp | 52 - .../VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp | 96 - .../string.LastIndexOf7/CPP/lastixof7.cpp | 39 - .../string.LastIndexOf8/CPP/lastixof8.cpp | 44 - .../string.LastIndexOfAny1/CPP/lastixany1.cpp | 38 - .../string.LastIndexOfAny2/CPP/lastixany2.cpp | 38 - .../string.LastIndexOfAny3/CPP/lastixany3.cpp | 38 - .../string.ToCharArray1/CPP/tocharry1.cpp | 32 - .../string.comp4/CPP/string.comp4.cpp | 34 - .../string.compare3/CPP/comp3.cpp | 28 - .../string.compare4/CPP/comp4.cpp | 40 - .../string.compare5/CPP/comp5.cpp | 41 - .../string.compareordinal/CPP/comp0.cpp | 28 - .../string.concat5/CPP/string.concat5.cpp | 33 - .../string.contains/CPP/cont.cpp | 21 - .../string.equals/CPP/equals.cpp | 55 - .../string.gettypecode/CPP/gtc.cpp | 16 - .../string.indexof1/CPP/ixof1.cpp | 42 - .../string.indexof8/CPP/ixof8.cpp | 49 - .../string.indexofany2/CPP/ixany2.cpp | 38 - .../string.indexofany3/CPP/ixany3.cpp | 40 - .../string.intern/CPP/string_intern.cpp | 26 - .../string.isNullOrEmpty/CPP/inoe.cpp | 25 - .../string.isinterned/CPP/isin.cpp | 45 - .../string.join2/CPP/join2.cpp | 22 - .../string.lastindexof1/CPP/lastixof1.cpp | 37 - .../string.lastindexof2/CPP/lastixof2.cpp | 44 - .../string.length/CPP/length.cpp | 20 - .../string.normalize/CPP/norm.cpp | 117 -- .../VS_Snippets_CLR/string.remove/CPP/r.cpp | 25 - .../string.replace1/CPP/string.replace1.cpp | 16 - .../string.split3/CPP/omit.cpp | 76 - .../string.tolower1/CPP/tolower.cpp | 75 - .../string.tostring/CPP/string.tostring.cpp | 26 - .../stringbuilder.appendformat/CPP/appfmt.cpp | 46 - .../stringbuilder.appendline/CPP/al.cpp | 49 - .../stringbuilder.copyto2/CPP/ct2.cpp | 43 - .../stringbuilder.ensurecapacity/CPP/cap.cpp | 61 - .../stringbuilder.insert/CPP/insert.cpp | 118 -- .../stringbuilder.remove/CPP/remove.cpp | 43 - .../stringbuilder.replace/CPP/replace.cpp | 67 - .../stringconcat3/CPP/stringconcat3.cpp | 22 - .../stringconcat4/CPP/stringconcat4.cpp | 23 - .../stringcopyto/CPP/stringcopyto.cpp | 31 - .../stringendswith/CPP/stringendswith.cpp | 76 - .../stringexample1/CPP/source.cpp | 80 - .../stringindexof4/CPP/stringindexof4.cpp | 38 - .../stringinsert/CPP/stringinsert.cpp | 30 - .../stringjoin/CPP/stringjoin.cpp | 24 - .../stringlowerupper/CPP/stringtolower.cpp | 53 - .../stringremove/CPP/stringremove.cpp | 21 - .../stringreplace/CPP/stringreplace.cpp | 22 - .../stringstartswith/CPP/stringstartswith.cpp | 61 - .../sys.glob.NFI.nativeDigits/cpp/nd.cpp | 31 - .../sys.glob.calendartype/CPP/caltype.cpp | 34 - .../sys.glob.carib1/CPP/carib.cpp | 71 - .../sys.glob.ci.getCFUIC/cpp/cfuic.cpp | 20 - .../cpp/rgn5props.cpp | 31 - .../sys.txt.fallbackDecExc/cpp/fallDecExc.cpp | 141 -- .../sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp | 115 -- .../sys.txt.fallbackEncExc/cpp/fallEncExc.cpp | 96 - .../sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp | 106 -- .../thread.sleep/cpp/example.cpp | 25 - .../thread.sleep_timespan/cpp/example.cpp | 27 - .../type_getevent1/CPP/type_getevent1.cpp | 44 - .../type_getevents1/CPP/type_getevents1.cpp | 38 - .../type_getevents2/CPP/type_getevents2.cpp | 41 - .../x509chaintest/CPP/remarks.cpp | 26 - .../x509chaintest/CPP/x509chaintest.cpp | 73 - .../x509store2/CPP/x509store2.cpp | 79 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 75 - .../classic Array Example/CPP/source.cpp | 74 - .../classic Array Example/CPP/source3.cpp | 68 - .../CPP/source.cpp | 80 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 67 - .../CPP/source2.cpp | 61 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 77 - .../CPP/source.cpp | 63 - .../CPP/source.cpp | 51 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 61 - .../CPP/source.cpp | 61 - .../classic ArrayList Example/CPP/source.cpp | 44 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 58 - .../CPP/source2.cpp | 67 - .../CPP/source.cpp | 86 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 76 - .../CPP/source.cpp | 91 - .../CPP/source.cpp | 127 -- .../CPP/source.cpp | 31 - .../CPP/source2.cpp | 35 - .../CPP/source.cpp | 76 - .../CPP/source.cpp | 91 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 61 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 32 - .../classic BitArray Example/CPP/source.cpp | 119 -- .../classic BitArray Example/CPP/source2.cpp | 37 - .../CPP/source.cpp | 98 - .../CPP/source.cpp | 104 - .../CPP/source.cpp | 78 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 98 - .../CPP/source.cpp | 99 - .../CPP/remarks.cpp | 30 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 13 - .../CPP/source.cpp | 16 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 8 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 80 - .../CPP/source.cpp | 46 - .../classic DES Example/CPP/source.cpp | 46 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 109 -- .../classic Debug Example/CPP/source.cpp | 24 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 29 - .../classic Debug.Fail Example/CPP/source.cpp | 57 - .../CPP/source.cpp | 59 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 25 - .../classic Decoder Example/CPP/source.cpp | 29 - .../classic Delegate Example/CPP/source.cpp | 63 - .../CPP/source.cpp | 12 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 16 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 59 - .../CPP/source.cpp | 62 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 50 - .../CPP/source.cpp | 83 - .../CPP/source.cpp | 78 - .../CPP/source.cpp | 87 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 28 - .../classic FileAccess Example/CPP/source.cpp | 13 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 13 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 11 - .../classic Hash.SHA1 Example/CPP/source.cpp | 22 - .../CPP/source.cpp | 22 - .../classic Hashtable Example/CPP/source2.cpp | 76 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 65 - .../CPP/source.cpp | 65 - .../CPP/source.cpp | 63 - .../CPP/remarks.cpp | 40 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 14 - .../CPP/source.cpp | 28 - .../classic Math.Round Example/CPP/source.cpp | 12 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 73 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 91 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 161 -- .../CPP/source.cpp | 85 - .../CPP/source.cpp | 92 - .../CPP/source.cpp | 59 - .../CPP/source.cpp | 92 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 67 - .../classic Queue Example/CPP/source.cpp | 41 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 66 - .../CPP/source.cpp | 32 - .../CPP/source2.cpp | 35 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 78 - .../CPP/source.cpp | 20 - .../classic SHA256 Example/CPP/source.cpp | 76 - .../classic SHA384 Example/CPP/source.cpp | 23 - .../CPP/source.cpp | 24 - .../classic SHA512 Example/CPP/source.cpp | 23 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 57 - .../CPP/remarks.cpp | 27 - .../classic SortedList Example/CPP/source.cpp | 53 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 106 -- .../CPP/source.cpp | 63 - .../CPP/source.cpp | 59 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 33 - .../CPP/source2.cpp | 35 - .../CPP/source.cpp | 89 - .../CPP/source.cpp | 62 - .../classic Stack Example/CPP/source.cpp | 41 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 32 - .../CPP/source2.cpp | 35 - .../classic Stack.Peek Example/CPP/source.cpp | 65 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 13 - .../CPP/source.cpp | 16 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 19 - .../classic Switch Example/CPP/remarks.cpp | 30 - .../classic Switch Example/CPP/source.cpp | 127 -- .../CPP/source.cpp | 27 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 18 - .../classic Timer Example/CPP/source.cpp | 73 - .../CPP/source.cpp | 53 - .../classic Trace Example/CPP/source.cpp | 23 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../classic Trace.Fail Example/CPP/source.cpp | 56 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 42 - .../CPP/remarks.cpp | 33 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 78 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 26 - .../CPP/source1.cpp | 26 - .../CPP/source2.cpp | 25 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 15 - .../cpp/source.cpp | 64 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/class1.cpp | 317 ---- .../CPP/cfromchar.cpp | 26 - .../CPP/cfromdouble.cpp | 66 - .../CPP/cfromsingle.cpp | 66 - .../CPP/cfromint16.cpp | 23 - .../CPP/cfromint32.cpp | 23 - .../CPP/cfromint64.cpp | 24 - .../CPP/cfromsbyte.cpp | 23 - .../CPP/cfrombyte.cpp | 23 - .../CPP/cfromuint16.cpp | 23 - .../CPP/cfromuint32.cpp | 24 - .../CPP/cfromuint64.cpp | 24 - .../System.Decimal.ConvTo/CPP/ctos_byte.cpp | 43 - .../System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp | 31 - .../System.Decimal.ConvTo/CPP/ctou_int16.cpp | 88 - .../System.Decimal.ConvTo/CPP/ctou_int32.cpp | 88 - .../System.Decimal.ConvTo/CPP/ctou_int64.cpp | 88 - .../System.IntPtr.ToPointer/cpp/topointer.cpp | 55 - .../cpp/source.cpp | 54 - .../CPP/class1.cpp | 153 -- .../cpp/Substring10.cpp | 35 - .../system.Action/cpp/action.cpp | 42 - .../system.Action~1/cpp/action`1.cpp | 36 - .../system.Action~1/cpp/delegate.cpp | 34 - .../System.AppDomain.IsDefaultAppDomain.cpp | 34 - .../CPP/arrayasreadonly.cpp | 116 -- .../system.Array.Clone/CPP/arrayclone.cpp | 73 - .../CPP/System.Array.Resize.cpp | 83 - .../system.Array.Sort/CPP/arraysort.cpp | 119 -- .../system.Array.Sort2/CPP/arraysort2.cpp | 109 -- .../system.Array.SyncRoot/cpp/source.cpp | 22 - .../system.ArraySegment/CPP/arraysegment.cpp | 126 -- .../system.ArrayTypeMismatch/CPP/class1.cpp | 68 - .../CPP/array_getenumerator.cpp | 42 - .../CPP/array_getsetvalue.cpp | 47 - .../system.Attribute.Equals/CPP/equals.cpp | 124 -- .../CPP/getcustattrparam.cpp | 130 -- .../CPP/getcustattrprminh.cpp | 152 -- .../system.Attribute.TypeId/CPP/typeid.cpp | 136 -- .../system.BitConverter.Class/CPP/bitconv.cpp | 44 - .../CPP/littleend.cpp | 19 - .../CPP/bitstodbl.cpp | 67 - .../CPP/dbltobits.cpp | 71 - .../CPP/bytesbool.cpp | 23 - .../CPP/byteschar.cpp | 46 - .../CPP/bytesdouble.cpp | 64 - .../CPP/bytessingle.cpp | 64 - .../CPP/bytesint16.cpp | 32 - .../CPP/bytesint32.cpp | 34 - .../CPP/bytesint64.cpp | 42 - .../CPP/bytesuint16.cpp | 42 - .../CPP/bytesuint32.cpp | 44 - .../CPP/bytesuint64.cpp | 48 - .../CPP/batostring.cpp | 51 - .../CPP/batostringii.cpp | 65 - .../CPP/batobool.cpp | 30 - .../CPP/batochar.cpp | 59 - .../CPP/batodouble.cpp | 96 - .../CPP/batosingle.cpp | 93 - .../CPP/batoint16.cpp | 55 - .../CPP/batoint64.cpp | 85 - .../CPP/batouint16.cpp | 54 - .../CPP/batouint32.cpp | 56 - .../CPP/batouint64.cpp | 78 - .../system.Boolean/CPP/booleanmembers.cpp | 26 - .../system.Buffer.BlockCopy/CPP/bcopy.cpp | 137 -- .../system.Buffer.BlockCopy/CPP/buffer.cpp | 62 - .../system.Buffer.BlockCopy/CPP/overlap1.cpp | 37 - .../system.Buffer.Bytes/CPP/bytelength.cpp | 52 - .../system.Buffer.Bytes/CPP/getbyte.cpp | 83 - .../system.Buffer.Bytes/CPP/setbyte.cpp | 71 - .../system.Byte Examples/CPP/systembyte.cpp | 106 -- .../system.Byte.Parse/cpp/parse.cpp | 162 -- .../CPP/newbytemembers.cpp | 29 - .../CPP/newbytemembers2.cpp | 79 - .../system.Byte.TryParse/cpp/tryparse.cpp | 37 - .../system.Byte.TryParse/cpp/tryparse2.cpp | 75 - .../CPP/charstructure.cpp | 26 - .../system.Char.CompareTo/CPP/compareto.cpp | 13 - .../system.Char.Equals/CPP/equals.cpp | 12 - .../CPP/getnumericvalue.cpp | 11 - .../CPP/getunicodecategory.cpp | 13 - .../system.Char.IsControl/CPP/iscontrol1.cpp | 35 - .../system.Char.IsControl/CPP/iscontrol2.cpp | 22 - .../system.Char.IsDigit/CPP/isdigit.cpp | 11 - .../system.Char.IsLetter/CPP/isletter.cpp | 11 - .../CPP/isletterordigit.cpp | 11 - .../system.Char.IsLower/CPP/islower.cpp | 11 - .../system.Char.IsNumber/CPP/isnumber.cpp | 11 - .../CPP/ispunctuation.cpp | 11 - .../CPP/isseparator.cpp | 11 - .../CPP/isseparator1.cpp | 36 - .../CPP/issurrogate.cpp | 11 - .../system.Char.IsSymbol/CPP/issymbol.cpp | 11 - .../CPP/iswhitespace.cpp | 11 - .../system.Char.Parse/CPP/parse.cpp | 9 - .../system.Char.ToLower/CPP/tolower.cpp | 12 - .../system.Char.ToString/CPP/tostring.cpp | 11 - .../cpp/charenumerator1.cpp | 75 - .../CPP/source2.cpp | 39 - .../CPP/stringdictionary.cpp | 117 -- .../CPP/stringdictionary_addremove.cpp | 65 - .../CPP/stringdictionary_contains.cpp | 67 - .../CPP/stringdictionary_enumeration.cpp | 90 - .../CPP/values.cpp | 38 - .../cpp/source.cpp | 94 - .../cpp/source2.cpp | 69 - .../CPP/arraylist_sort2.cpp | 98 - .../CPP/arraylist_sort3.cpp | 98 - .../CPP/arraylist_toarray.cpp | 80 - .../CPP/caseinsensitive.cpp | 55 - .../CPP/collectionbase.cpp | 183 -- .../CPP/remarks.cpp | 118 -- .../CPP/comparercultures.cpp | 36 - .../CPP/dictionarybase.cpp | 258 --- .../CPP/source2.cpp | 171 -- .../cpp/dictionaryentrysample.cpp | 46 - .../cpp/program.cpp | 62 - .../cpp/source2.cpp | 122 -- .../CPP/llctor.cpp | 48 - .../cpp/llnctor.cpp | 87 - .../cpp/hashtable_example.cpp | 130 -- .../cpp/remarks.cpp | 36 - .../CPP/hashtable_ctor.cpp | 110 -- .../CPP/hashtable_ctordictionary.cpp | 95 - .../CPP/hashtable_ctordictionaryfloat.cpp | 93 - .../CPP/hashtable_ctorint.cpp | 97 - .../CPP/hashtable_ctorintfloat.cpp | 97 - .../CPP/readonlycollectionbase.cpp | 107 -- .../CPP/source2.cpp | 80 - .../CPP/sortedlist_ctor.cpp | 116 -- .../CPP/sortedlist_ctordictionary.cpp | 126 -- .../CPP/sortedlist_ctorint.cpp | 139 -- .../CPP/bitvector32_createmasks.cpp | 40 - .../CPP/bitvector32_equals.cpp | 78 - .../CPP/bitvector32_bitflags.cpp | 42 - .../CPP/bitvector32_sections.cpp | 68 - .../CPP/hybriddictionary.cpp | 222 --- .../CPP/source2.cpp | 48 - .../CPP/hybriddictionary_addremove.cpp | 110 -- .../CPP/hybriddictionary_contains.cpp | 87 - .../CPP/hybriddictionary_copyto.cpp | 109 -- .../CPP/hybriddictionary_enumerator.cpp | 147 -- .../cpp/iordereddictionary.cpp | 318 ---- .../cpp/remarks.cpp | 297 --- .../CPP/listdictionary.cpp | 151 -- .../CPP/source2.cpp | 50 - .../CPP/listdictionary_addremove.cpp | 74 - .../CPP/listdictionary_contains.cpp | 63 - .../CPP/listdictionary_copyto.cpp | 73 - .../CPP/listdictionary_enumerator.cpp | 99 - .../CPP/nocb_baseadd.cpp | 65 - .../CPP/nocb_baseclear.cpp | 83 - .../CPP/nocb_baseget.cpp | 92 - .../CPP/nocb_basegetall.cpp | 124 -- .../CPP/nocb_basehaskeys.cpp | 78 - .../CPP/nocb_baseremove.cpp | 98 - .../CPP/nocb_baseset.cpp | 108 -- .../CPP/nocb_isreadonly.cpp | 91 - .../CPP/nameobjectcollectionbase.cpp | 192 -- .../CPP/remarks.cpp | 130 -- .../CPP/nvc.cpp | 101 - .../cpp/ordereddictionary1.cpp | 138 -- .../cpp/source2.cpp | 26 - .../CPP/remarks.cpp | 39 - .../CPP/stringcollection.cpp | 182 -- .../CPP/stringcollectionadd.cpp | 76 - .../CPP/stringcollectioncontains.cpp | 58 - .../CPP/stringcollectioncopyto.cpp | 73 - .../CPP/stringcollectionremove.cpp | 91 - .../CPP/stringdictionary_copyto.cpp | 56 - .../CPP/stringenumerator.cpp | 44 - .../CPP/inserttabs.cpp | 63 - .../system.Console-REFORMAT/CPP/reformat.cpp | 72 - .../CPP/decode.cpp | 20 - .../cpp/ReadLineSimple.cpp | 20 - .../system.Console.ReadLine/cpp/readline2.cpp | 28 - .../system.Console.SetError/cpp/seterror1.cpp | 32 - .../system.Console.WriteLine/CPP/newline1.cpp | 39 - .../CPP/writeline_boolean1.cpp | 22 - .../CPP/writeline_obj1.cpp | 18 - .../CPP/writeline_vararg.cpp | 43 - .../system.ConsoleKey/cpp/consolekey.cpp | 72 - .../cpp/consolekeyinfo.equals.cpp | 101 - .../cpp/hash.cpp | 85 - .../CPP/system.convert snippet.cpp | 593 ------ .../cpp/toint_str_int32.cpp | 45 - .../cpp/toboolean1.cpp | 37 - .../cpp/toboolean2.cpp | 303 --- .../CPP/stringnonnum.cpp | 75 - .../CPP/toint16.cpp | 105 -- .../CPP/tosbyte.cpp | 100 - .../CPP/nonnumeric.cpp | 94 - .../CPP/objectifp.cpp | 458 ----- .../system.DateTime.Date/cpp/date1.cpp | 22 - .../system.DateTime.Minute etc/CPP/class1.cpp | 31 - .../cpp/datetime.tryparse1.cpp | 37 - .../CPP/comp_equal.cpp | 65 - .../CPP/cto_eq_obj.cpp | 88 - .../CPP/ctoriarr.cpp | 117 -- .../CPP/ctoriiibby.cpp | 108 -- .../system.Decimal.Ctor.Ints/CPP/ctori.cpp | 47 - .../system.Decimal.Ctor.Ints/CPP/ctorl.cpp | 47 - .../system.Decimal.Ctor.Ints/CPP/ctorui.cpp | 47 - .../system.Decimal.Ctor.Ints/CPP/ctorul.cpp | 47 - .../system.Decimal.Ctor.Reals/CPP/ctordo.cpp | 73 - .../system.Decimal.Ctor.Reals/CPP/ctors.cpp | 73 - .../system.Decimal.Fields/CPP/fields.cpp | 46 - .../CPP/floor_neg_trunc.cpp | 66 - .../CPP/getbits.cpp | 56 - .../CPP/gettypecode.cpp | 25 - .../CPP/mul_div_rem.cpp | 76 - .../CPP/fromoacurrency.cpp | 59 - .../CPP/tooacurrency.cpp | 82 - .../system.Decimal.ToXXX/CPP/tosgl_dbl.cpp | 60 - .../cpp/correlationmanager.cpp | 51 - .../cpp/program.cpp | 105 -- .../CPP/eventschematracelistener.cpp | 99 - .../CPP/instdatacopyto.cpp | 187 -- .../cpp/perfcountercatgetcount.cpp | 91 - .../cpp/perfcountercatgetinst.cpp | 84 - .../cpp/perfcountergetcat.cpp | 72 - .../CPP/tracesource2.cpp | 143 -- .../system.Double.ToString/cpp/tostring1.cpp | 63 - .../system.Double.ToString/cpp/tostring3.cpp | 223 --- .../system.Double/CPP/doublesample.cpp | 150 -- .../system.Environment/CPP/Vars1.cpp | 24 - .../system.Exception.Ctor/CPP/new.cpp | 108 -- .../system.Exception.Ctor/CPP/news.cpp | 116 -- .../system.Exception.Ctor/CPP/newsi.cpp | 109 -- .../CPP/getbaseexc.cpp | 137 -- .../CPP/getobjdata.cpp | 149 -- .../system.Exception.HResult/CPP/hresult.cpp | 70 - .../CPP/exception_properties.vcxproj | 123 -- .../CPP/properties.cpp | 121 -- .../system.FlagsAttribute/CPP/flags.cpp | 79 - .../system.FlagsAttribute/CPP/flags1.cpp | 75 - .../system.Func~2/cpp/Example.cpp | 44 - .../system.GC.Collect Example/CPP/class1.cpp | 31 - .../CPP/systemgcgetgenerationweak.cpp | 72 - .../CPP/gckeepalive.cpp | 108 -- .../CPP/class1.cpp | 64 - .../CPP/class1.cpp | 70 - .../CPP/yslin_calendar_getweekofyear.cpp | 37 - .../CPP/calendar.cpp | 77 - .../CPP/calendar_compare.cpp | 125 -- .../CPP/charunicodeinfo_char.cpp | 54 - .../CPP/charunicodeinfo_string.cpp | 41 - .../CPP/comparestrintintstrintint.cpp | 41 - .../CPP/comparestrintintstrintintopt.cpp | 40 - .../CPP/comparestrintstrint.cpp | 42 - .../CPP/comparestrintstrintopt.cpp | 39 - .../CPP/comparestrstr.cpp | 41 - .../CPP/comparestrstropt.cpp | 39 - .../CPP/indexof.cpp | 118 -- .../CPP/indexofint.cpp | 205 -- .../CPP/indexofintint.cpp | 134 -- .../CPP/isprefixsuffix.cpp | 35 - .../CPP/isprefixsuffixopt.cpp | 42 - .../CPP/yslin_cultureinfo_clone.cpp | 37 - .../CPP/currentculture.cpp | 28 - .../CPP/getcultures.cpp | 45 - .../CPP/neutralculture.cpp | 44 - .../CPP/parentculture.cpp | 38 - .../CPP/yslin_cultureinfo_readonly.cpp | 35 - .../CPP/spanishspain.cpp | 63 - .../CPP/dtfi_fulldatetimepattern.cpp | 32 - .../CPP/dtfi_longdatepattern.cpp | 32 - .../CPP/dtfi_longtimepattern.cpp | 32 - .../CPP/dtfi_monthdaypattern.cpp | 32 - .../CPP/dtfi_rfc1123pattern.cpp | 32 - .../CPP/dtfi_shorttimepattern.cpp | 32 - .../CPP/dtfi_sortabledatetimepattern.cpp | 32 - .../dtfi_universalsortabledatetimepattern.cpp | 33 - .../CPP/dtfi_yearmonthpattern.cpp | 32 - .../CPP/gregoriancalendar_getdaysinmonth.cpp | 44 - .../CPP/gregoriancalendar_getdaysinyear.cpp | 43 - .../CPP/gregorian_getera.cpp | 64 - .../CPP/gregoriancalendar_getmonthsinyear.cpp | 43 - .../CPP/gregoriancalendar_isleapday.cpp | 55 - .../CPP/gregoriancalendar_isleapmonth.cpp | 36 - .../CPP/gregoriancalendar_isleapyear.cpp | 43 - .../CPP/gregorianlocalized.cpp | 40 - .../CPP/gregoriancalendartypes.cpp | 44 - .../CPP/gregoriancalendar_addget.cpp | 59 - .../CPP/gregoriancalendar_minmax.cpp | 29 - .../CPP/hebrewcalendar_getdaysinmonth.cpp | 44 - .../CPP/hebrewcalendar_getmonthsinyear.cpp | 43 - .../CPP/hebrewcalendar_isleapday.cpp | 55 - .../CPP/hebrewcalendar_isleapmonth.cpp | 36 - .../CPP/hebrewcalendar_isleapyear.cpp | 43 - .../CPP/hebrewcalendar_addget.cpp | 59 - .../CPP/hebrewcalendar_getdaysinyear.cpp | 43 - .../CPP/hebrewcalendar_minmax.cpp | 34 - .../CPP/hijricalendar_getdaysinmonth.cpp | 45 - .../CPP/hijricalendar_getdaysinyear.cpp | 44 - .../CPP/hijricalendar_getmonthsinyear.cpp | 44 - .../CPP/hijriadjustment.cpp | 53 - .../CPP/hijricalendar_isleapday.cpp | 55 - .../CPP/hijricalendar_isleapmonth.cpp | 36 - .../CPP/hijricalendar_isleapyear.cpp | 43 - .../CPP/hijricalendar_addget.cpp | 59 - .../CPP/hijricalendar_minmax.cpp | 34 - .../CPP/yslin_japanesecalendar_eras.cpp | 29 - .../CPP/japanesecalendar_getdaysinmonth.cpp | 47 - .../CPP/japanesecalendar_getdaysinyear.cpp | 46 - .../CPP/japanesecalendar_getmonthsinyear.cpp | 30 - .../CPP/japanesecalendar_isleapday.cpp | 52 - .../CPP/japanesecalendar_isleapmonth.cpp | 36 - .../CPP/japanesecalendar_isleapyear.cpp | 41 - .../CPP/japanesecalendar_addget.cpp | 59 - .../CPP/japanesecalendar_minmax.cpp | 34 - .../CPP/juliancalendar_getdaysinmonth.cpp | 44 - .../CPP/juliancalendar_getdaysinyear.cpp | 43 - .../CPP/juliancalendar_getmonthsinyear.cpp | 43 - .../CPP/juliancalendar_isleapday.cpp | 55 - .../CPP/juliancalendar_isleapmonth.cpp | 36 - .../CPP/juliancalendar_isleapyear.cpp | 43 - .../CPP/juliancalendar_addget.cpp | 59 - .../CPP/juliancalendar_minmax.cpp | 34 - .../CPP/koreancalendar_getdaysinmonth.cpp | 44 - .../CPP/koreancalendar_getdaysinyear.cpp | 43 - .../CPP/koreancalendar_getmonthsinyear.cpp | 43 - .../CPP/koreancalendar_isleapday.cpp | 55 - .../CPP/koreancalendar_isleapmonth.cpp | 35 - .../CPP/koreancalendar_isleapyear.cpp | 43 - .../CPP/koreancalendar_addget.cpp | 59 - .../CPP/koreancalendar_minmax.cpp | 35 - .../CPP/invariantinfo.cpp | 82 - .../CPP/regioninfo_ctorculturename.cpp | 112 -- .../CPP/regioninfo.cpp | 46 - .../CPP/regioninfo_equals.cpp | 28 - .../CPP/regioninfo_properties.cpp | 36 - .../CPP/sortkey_compare.cpp | 36 - .../CPP/sortkey_equals.cpp | 80 - .../CPP/taiwancalendar_getdaysinmonth.cpp | 44 - .../CPP/taiwancalendar_getdaysinyear.cpp | 43 - .../CPP/taiwancalendar_getmonthsinyear.cpp | 43 - .../CPP/taiwancalendar_isleapday.cpp | 54 - .../CPP/taiwancalendar_isleapmonth.cpp | 35 - .../CPP/taiwancalendar_isleapyear.cpp | 43 - .../CPP/taiwancalendar_addget.cpp | 59 - .../CPP/taiwancalendar_minmax.cpp | 35 - .../CPP/tee_summary.cpp | 36 - .../CPP/textinfo_casing.cpp | 34 - .../thaibuddhistcalendar_getdaysinmonth.cpp | 44 - .../thaibuddhistcalendar_getdaysinyear.cpp | 43 - .../thaibuddhistcalendar_getmonthsinyear.cpp | 43 - .../CPP/thaibuddhistcalendar_isleapday.cpp | 55 - .../CPP/thaibuddhistcalendar_isleapmonth.cpp | 35 - .../CPP/thaibuddhistcalendar_isleapyear.cpp | 43 - .../CPP/thaibuddhistcalendar_addget.cpp | 59 - .../CPP/thaibuddhistcalendar_minmax.cpp | 34 - .../system.IConvertible/CPP/iconvertible.cpp | 144 -- .../CPP/idisposabledispose.cpp | 80 - .../CPP/rwbyte.cpp | 48 - .../CPP/rwbytes.cpp | 44 - .../CPP/rwchar.cpp | 38 - .../CPP/rwreadchar.cpp | 38 - .../CPP/rwchars.cpp | 27 - .../CPP/rwreadchars.cpp | 30 - .../CPP/rwdouble.cpp | 66 - .../CPP/source3.cpp | 100 - .../system.IO.BufferedStream1/CPP/client.cpp | 168 -- .../system.IO.BufferedStream2/CPP/server.cpp | 91 - .../system.IO.Directory/CPP/class1.cpp | 163 -- .../cpp/searchoption.cpp | 44 - .../system.IO.DirectoryRoot/CPP/example.cpp | 34 - .../system.IO.FileStream1/CPP/source.cpp | 46 - .../system.IO.FileStream2/CPP/source.cpp | 156 -- .../system.IO.FileStream3/CPP/fstreamlock.cpp | 144 -- .../CPP/remarks.cpp | 61 - .../CPP/source.cpp | 422 ----- .../system.IO.MemoryStream/CPP/memstream.cpp | 74 - .../CPP/pathmembers.cpp | 307 --- .../cpp/program.cpp | 51 - .../cpp/program.cpp | 65 - .../cpp/program.cpp | 160 -- .../cpp/datareceived.cpp | 49 - .../cpp/serialport.cpp | 207 -- .../CPP/streamreadersample.cpp | 177 -- .../system.IO.StreamWriter/CPP/logger.cpp | 201 -- .../CPP/stringrw.cpp | 76 - .../CPP/strwriter1.cpp | 30 - .../CPP/strwriter2.cpp | 18 - .../CPP/strwriter3.cpp | 24 - .../system.IO.TextReaderWriter/CPP/textrw.cpp | 46 - .../system.IO.UTCExample/CPP/example.cpp | 54 - .../system.Int16.MaxValue/cpp/minvalue.cpp | 30 - .../system.Int16.Parse/cpp/parse1.cpp | 54 - .../system.Int16.Parse/cpp/parse2.cpp | 87 - .../system.Int16.Parse/cpp/parse3.cpp | 62 - .../system.Int16.Parse/cpp/parse4.cpp | 66 - .../system.Int32.Parse/cpp/parse1.cpp | 40 - .../system.Int32.Parse/cpp/parse2.cpp | 50 - .../system.Int32.Parse/cpp/parse3.cpp | 61 - .../system.Int32.ToString/cpp/ToString1.cpp | 26 - .../system.Int32.ToString/cpp/ToString2.cpp | 22 - .../system.Int32.ToString/cpp/ToString3.cpp | 56 - .../system.Int32.ToString/cpp/ToString4.cpp | 60 - .../cpp/int32.tryparse1.cpp | 43 - .../cpp/int32.tryparse2.cpp | 100 - .../system.Math.E/CPP/efield.cpp | 66 - .../system.Math.Exp/CPP/exp.cpp | 96 - .../system.Math.Log_Overloads/CPP/loggen.cpp | 66 - .../system.Math.SinCos/CPP/sincos.cpp | 120 -- .../system.Math.SinhCosh/CPP/sinhcosh.cpp | 115 -- .../system.Math.Tanh/CPP/tanh.cpp | 87 - .../cpp/equals.cpp | 76 - .../cpp/equals2.cpp | 43 - .../CPP/clone.cpp | 56 - .../CPP/ctor_tostr.cpp | 60 - .../CPP/plat_ver.cpp | 64 - .../system.Random.Ctor/CPP/ctor.cpp | 95 - .../system.Random.Next/CPP/next.cpp | 99 - .../system.Random.Next/CPP/next1.cpp | 27 - .../system.Random.Next/CPP/next2.cpp | 47 - .../system.Random.Next/CPP/next3.cpp | 35 - .../system.Random.Next/CPP/next4.cpp | 27 - .../system.Random.Sample/cpp/sampleex.cpp | 149 -- .../system.Random/cpp/random2.cpp | 54 - .../CPP/source.cpp | 56 - .../CPP/GetAssembly1.cpp | 19 - .../CPP/assembly.cpp | 182 -- .../CPP/codebase1.cpp | 16 - .../CPP/getcallingassembly1.cpp | 18 - .../CPP/source.cpp | 137 -- .../CPP/source.cpp | 65 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 236 --- .../CPP/source.cpp | 150 -- .../CPP/source.cpp | 118 -- .../CPP/source.cpp | 89 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 116 -- .../CPP/source.cpp | 159 -- .../CPP/source.cpp | 81 - .../CPP/source.cpp | 105 -- .../CPP/source.cpp | 33 - .../CPP/source3.cpp | 34 - .../CPP/source4.cpp | 29 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 28 - .../CPP/source2.cpp | 28 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 90 - .../CPP/source.cpp | 107 -- .../CPP/nestedenum.cpp | 121 -- .../cpp/source.cpp | 32 - .../cpp/hide.cpp | 90 - .../CPP/class1.cpp | 17 - .../CPP/class1.cpp | 30 - .../CPP/class1.cpp | 32 - .../CPP/class1.cpp | 16 - .../CPP/class1.cpp | 51 - .../CPP/class1.cpp | 52 - .../CPP/class1.cpp | 25 - .../CPP/class1.cpp | 25 - .../CPP/class1.cpp | 25 - .../CPP/class1.cpp | 44 - .../CPP/class1.cpp | 16 - .../CPP/class1.cpp | 16 - .../CPP/resxresourcereader.cpp | 30 - .../CPP/useresxdatanodes.cpp | 112 -- .../CPP/getenumerator.cpp | 22 - .../CPP/getenumerator.cpp | 22 - .../CPP/resourcewritercstr1.cpp | 24 - .../CPP/resourcewriterdispose.cpp | 24 - .../CPP/resourcewritergenerate.cpp | 25 - .../cpp/sample.cpp | 18 - .../cpp/sample.cpp | 26 - .../CPP/convert1.cpp | 52 - .../CPP/marshalas.sizeparamindex.cpp | 31 - .../CPP/convert2.cpp | 49 - .../AllowPartiallyTrustedCallersAttribute.cpp | 150 -- .../cpp/customcrypto.cpp | 320 ---- .../cpp/customcryptoimpl.cpp | 129 -- .../CPP/members.cpp | 199 -- .../CPP/members.cpp | 71 - .../CPP/cryptographicexceptionmembers.cpp | 243 --- .../CPP/sample.cpp | 50 - .../CPP/sample.cpp | 36 - .../CPP/class1.cpp | 56 - .../CPP/members.cpp | 110 -- .../CPP/contosokeyedhash.cpp | 80 - .../CPP/maskgenerator.cpp | 114 -- .../CPP/sample.cpp | 52 - .../CPP/sample.cpp | 25 - .../CPP/sample.cpp | 33 - .../CPP/sample.cpp | 106 -- .../CPP/rsaencoder.cpp | 213 --- .../CPP/members.cpp | 129 -- .../CPP/xmldsigdetach.cpp | 132 -- .../CPP/xmldsigenv.cpp | 171 -- .../CPP/exampledetached.cpp | 132 -- .../CPP/exampleenvelope.cpp | 174 -- .../CPP/examplecreatedetached.cpp | 100 - .../CPP/examplecreateenvelope.cpp | 135 -- .../CPP/exampleenvelope.cpp | 170 -- .../CPP/example.cpp | 172 -- .../CPP/exampledetached.cpp | 124 -- .../CPP/exampleenvelope.cpp | 159 -- .../CPP/xmldsigdetachedkeyedhashalg.cpp | 117 -- .../CPP/xmldsigenvkeyedhashalg.cpp | 160 -- .../CPP/sampledetached.cpp | 134 -- .../CPP/sampleenvelope.cpp | 168 -- .../CPP/members.cpp | 219 --- .../CPP/members.cpp | 334 ---- .../cpp/members.cpp | 290 --- .../CPP/members.cpp | 261 --- .../CPP/permissionset.cpp | 164 -- .../CPP/nameidpermissionattribute.cpp | 59 - .../CPP/dataprotect.cpp | 234 --- .../CPP/fileiopermission.cpp | 534 ------ .../CPP/remarks.cpp | 95 - .../CPP/fileiopermissionattribute.cpp | 102 - .../CPP/gacidentitypermission.cpp | 260 --- .../CPP/gacidentitypermissionattribute.cpp | 51 - .../CPP/hostprotectionattribute.cpp | 243 --- .../CPP/keycontainerpermission.cpp | 296 --- .../CPP/nameidpermission.cpp | 280 --- .../CPP/publisheridentitypermission.cpp | 166 -- .../CPP/securitypermissionattribute.cpp | 457 ----- .../CPP/storepermission.cpp | 143 -- .../CPP/strongnameidentity.cpp | 244 --- .../CPP/uipermission.cpp | 178 -- .../CPP/urlidentity.cpp | 121 -- .../CPP/evidence_evidence.cpp | 220 --- .../CPP/members.cpp | 314 ---- .../CPP/members.cpp | 359 ---- .../system.Security.Policy.Gac/CPP/gac.cpp | 39 - .../CPP/gacmembershipcondition.cpp | 227 --- .../CPP/members.cpp | 224 --- .../CPP/genericidentitymembers.cpp | 81 - .../CPP/genericprincipalmembers.cpp | 98 - .../CPP/source.cpp | 41 - .../CPP/windowsidentitymembers.cpp | 220 --- .../cpp/Ctor2.cpp | 25 - .../cpp/Ctor3.cpp | 25 - .../CPP/form1.cpp | 243 --- .../CPP/policylevel.cpp | 272 --- .../system.Single/CPP/singlesample.cpp | 163 -- .../cpp/system.string.class.cpp | 10 - .../system.String.Compare/cpp/compare02.cpp | 30 - .../system.String.Compare/cpp/example.cpp | 65 - .../system.String.Compare/cpp/remarks.cpp | 197 -- .../system.String.CompareCmp/cpp/cmpcmp.cpp | 140 -- .../system.String.EndsWithCmp/cpp/ewcmp.cpp | 83 - .../system.String.Equality/CPP/equalityop.cpp | 28 - .../system.String.Format/cpp/format4.cpp | 24 - .../system.String.Format/cpp/format5.cpp | 33 - .../system.String.Format/cpp/format7.cpp | 41 - .../cpp/format_paramarray1.cpp | 48 - .../cpp/formatexample2.cpp | 77 - .../cpp/formatexample4.cpp | 32 - .../cpp/formatoverload1.cpp | 20 - .../cpp/formatoverload2.cpp | 41 - .../cpp/formatsyntax1.cpp | 16 - .../system.String.Format/cpp/interceptor2.cpp | 122 -- .../system.String.Format/cpp/starting1.cpp | 80 - .../system.String.Format/cpp/starting2.cpp | 37 - .../CPP/getenumerator.cpp | 69 - .../CPP/gethashcode.cpp | 43 - .../system.String.IndexOf/CPP/indexof_c.cpp | 33 - .../system.String.IndexOf/CPP/indexofcii.cpp | 61 - .../system.String.IndexOf/CPP/simple1.cpp | 15 - .../CPP/inequalityop.cpp | 28 - .../system.String.ToUpper/cpp/ToUpperEx.cpp | 82 - .../system.String.Trim/cpp/trim1.cpp | 16 - .../system.String.Trim/cpp/trim2.cpp | 30 - .../system.StringComparer/cpp/omni.cpp | 139 -- .../CPP/snippet.cpp | 67 - .../CPP/getbytecount-char[]-int32-int32.cpp | 18 - .../CPP/getbytecount-string.cpp | 13 - ...tbytes-string-int32-int32-byte[]-int32.cpp | 26 - ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 - .../CPP/getcharcount-byte[]-int32-int32.cpp | 13 - ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 - .../CPP/getmaxbytecount-int32.cpp | 13 - .../CPP/getmaxcharcount-int32.cpp | 13 - .../CPP/getstring-byte[].cpp | 29 - .../CPP/ctor.cpp | 12 - .../CPP/getcharcount-byte[]-int32-int32.cpp | 19 - ...tchars-byte[]-int32-int32-char[]-int32.cpp | 33 - .../CPP/ctor.cpp | 32 - .../CPP/snippet.cpp | 125 -- .../CPP/getbytecount-char[]-int32-int32.cpp | 24 - ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 38 - .../CPP/ctor.cpp | 33 - .../CPP/ascii.cpp | 65 - .../CPP/bigendianunicode.cpp | 19 - .../CPP/codepage.cpp | 176 -- .../CPP/convert.cpp | 32 - .../CPP/equals.cpp | 25 - .../CPP/getbytes_chararr.cpp | 82 - .../CPP/getbytes_chararric.cpp | 85 - .../CPP/getbytes_string.cpp | 121 -- .../CPP/getchars.cpp | 64 - .../CPP/getcharsic.cpp | 69 - .../CPP/preamble.cpp | 41 - .../CPP/isprops.cpp | 173 -- .../system.Text.Encoding.Names/CPP/names.cpp | 52 - .../CPP/webname.cpp | 39 - .../CPP/encodinginfo.cpp | 188 -- .../CPP/constructors.cpp | 127 -- .../CPP/encdec.cpp | 56 - .../CPP/equals.cpp | 94 - .../CPP/errordetection.cpp | 70 - .../CPP/getbytes_chararr.cpp | 87 - .../CPP/getbytes_string.cpp | 85 - .../CPP/getchars.cpp | 88 - .../CPP/getpreamble.cpp | 44 - .../CPP/snippet.cpp | 38 - .../CPP/getbytecount-char[]-int32-int32.cpp | 18 - ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 - ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 - .../CPP/getdecoder-.cpp | 26 - .../CPP/getencoder-.cpp | 26 - .../CPP/getmaxbytecount-int32.cpp | 13 - .../CPP/getmaxcharcount-int32.cpp | 13 - .../CPP/ctor.cpp | 12 - .../CPP/ctor-boolean.cpp | 47 - .../CPP/getstring.cpp | 34 - .../CPP/snippet.cpp | 51 - .../CPP/equals-object.cpp | 34 - ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 - ...tbytes-string-int32-int32-byte[]-int32.cpp | 26 - .../CPP/getcharcount-byte[]-int32-int32.cpp | 13 - ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 - .../CPP/getdecoder-.cpp | 26 - .../CPP/getencoder-.cpp | 26 - .../CPP/gethashcode-.cpp | 21 - .../CPP/getmaxbytecount-int32.cpp | 13 - .../CPP/getmaxcharcount-int32.cpp | 13 - .../CPP/getpreamble-.cpp | 42 - .../CPP/ctor.cpp | 12 - .../CPP/ctor-boolean.cpp | 28 - .../CPP/ctor-boolean-boolean.cpp | 39 - .../CPP/snippet.cpp | 38 - .../CPP/charsize.cpp | 10 - .../CPP/encdec.cpp | 56 - .../CPP/errordetection.cpp | 71 - ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 - ...tbytes-string-int32-int32-byte[]-int32.cpp | 26 - .../CPP/getcharcount-byte[]-int32-int32.cpp | 13 - ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 - .../CPP/getmaxbytecount-int32.cpp | 13 - .../CPP/getmaxcharcount-int32.cpp | 13 - .../CPP/getpreamble-.cpp | 30 - .../CPP/ctor.cpp | 12 - .../CPP/ctor-boolean-boolean.cpp | 45 - .../CPP/koax.cpp | 148 -- .../CPP/class1.cpp | 51 - .../CPP/simplerisbetter.cpp | 105 -- .../CPP/source.cpp | 197 -- .../CPP/source.cpp | 70 - .../CPP/class1.cpp | 71 - .../CPP/source.cpp | 117 -- .../CPP/class1.cpp | 82 - .../CPP/class1.cpp | 27 - .../CPP/class1.cpp | 56 - .../CPP/class1.cpp | 66 - .../CPP/source.cpp | 197 -- .../CPP/source.cpp | 49 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 320 ---- .../CPP/source.cpp | 58 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 186 -- .../CPP/source.cpp | 79 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 75 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 103 - .../CPP/source.cpp | 86 - .../CPP/source.cpp | 114 -- .../CPP/source.cpp | 28 - .../CPP/source.cpp | 49 - .../system.Threading.Timer/CPP/source.cpp | 98 - .../system.Threading.Timer2/CPP/source2.cpp | 59 - .../CPP/source.cpp | 125 -- .../CPP/source1.cpp | 93 - .../CPP/source2.cpp | 102 - .../CPP/source3.cpp | 102 - .../CPP/source2.cpp | 83 - .../CPP/source3.cpp | 83 - .../CPP/source1.cpp | 37 - .../CPP/source2.cpp | 46 - .../CPP/source3.cpp | 46 - .../CPP/comp_equal.cpp | 64 - .../CPP/cto_eq_obj.cpp | 78 - .../system.TimeSpan.Ctor/CPP/ctoriii.cpp | 45 - .../system.TimeSpan.Ctor/CPP/ctoriiii.cpp | 42 - .../system.TimeSpan.Ctor/CPP/ctoriiiii.cpp | 51 - .../system.TimeSpan.Ctor/CPP/ctorl.cpp | 54 - .../CPP/dura_nega_una.cpp | 48 - .../system.TimeSpan.Fields/CPP/fields.cpp | 58 - .../system.TimeSpan.From/CPP/fromdays.cpp | 58 - .../system.TimeSpan.From/CPP/fromhours.cpp | 58 - .../system.TimeSpan.From/CPP/frommillisec.cpp | 58 - .../system.TimeSpan.From/CPP/fromminutes.cpp | 58 - .../system.TimeSpan.From/CPP/fromseconds.cpp | 58 - .../system.TimeSpan.From/CPP/fromticks.cpp | 58 - .../CPP/hashcode.cpp | 73 - .../CPP/properties.cpp | 88 - .../CPP/relationalops.cpp | 76 - .../system.TimeZone.Class/CPP/tzclass.cpp | 61 - .../CPP/source.cpp | 100 - .../CPP/source.cpp | 126 -- .../CPP/source.cpp | 70 - .../CPP/source.cpp | 108 -- .../CPP/source.cpp | 101 - .../system.Type.IsGenericType/cpp/remarks.cpp | 21 - .../system.Type.IsGenericType/cpp/source.cpp | 110 -- .../CPP/source.cpp | 101 - .../system.Type.IsVisible/CPP/source.cpp | 36 - .../system.Type.MakeXxxType/CPP/source.cpp | 82 - .../system.Type/cpp/source.cpp | 27 - .../system.TypeCode/CPP/iconvertible.cpp | 153 -- .../system.action.delegate/cpp/delegate.cpp | 42 - .../cpp/delegate.vcxproj | 89 - .../cpp/remarks.cpp | 18 - .../cpp/example.cpp | 54 - .../system.appdomain.load/cpp/source.cpp | 31 - .../system.array.foreach/cpp/source.cpp | 40 - .../system.array.getlength/cpp/source.cpp | 64 - .../system.array.getupperbound/cpp/source.cpp | 65 - .../system.byte.equals/cpp/eq.cpp | 24 - .../cpp/source.cpp | 37 - .../cpp/source.cpp | 32 - .../cpp/source.cpp | 48 - .../cpp/source.cpp | 39 - .../cpp/remarks.cpp | 59 - .../cpp/source.cpp | 63 - .../cpp/source.cpp | 131 -- .../system.console.setout/cpp/source.cpp | 29 - .../cpp/windowleft1.cpp | 53 - .../system.console.write/cpp/con_write.cpp | 23 - .../cpp/changetype00.cpp | 98 - .../cpp/changetype03.cpp | 239 --- .../cpp/changetype_01.cpp | 21 - .../system.convert.tobyte/cpp/tobyte1.cpp | 19 - .../cpp/addminutes1.cpp | 33 - .../system.datetime.now/cpp/now1.cpp | 23 - .../system.datetime.now/cpp/now2.cpp | 42 - .../cpp/tosbyte.cpp | 43 - .../cpp/tosingle1.cpp | 31 - .../cpp/source.cpp | 52 - .../cpp/dllmain.cpp | 19 - .../cpp/stdafx.cpp | 8 - .../cpp/stdafx.h | 16 - .../cpp/targetver.h | 8 - .../cpp/testdll.cpp | 23 - .../cpp/testdll.h | 22 - .../cpp/testdll.vcxproj | 100 - .../cpp/ToStringEx1.cpp | 47 - .../CPP/class1.cpp | 54 - .../system.int32.maxvalue/cpp/maxvalue1.cpp | 29 - .../system.intptr/cpp/topointer.cpp | 55 - .../system.io.pipes.pipestream/cpp/sample.cpp | 98 - .../system.nullableOfT.class/cpp/tarow.cpp | 80 - .../system.object.tostring/cpp/tostring1.cpp | 11 - .../system.object.tostring/cpp/tostring2.cpp | 18 - .../system.object.tostring/cpp/tostring3.cpp | 29 - .../cpp/getexecutingassembly1.cpp | 32 - .../cpp/remarks.cpp | 43 - .../cpp/remarks.cpp | 32 - .../cpp/source.cpp | 46 - .../cpp/friend1.cpp | 39 - .../cpp/friend2.cpp | 12 - .../cpp/source.cpp | 23 - .../cpp/source.cpp | 18 - .../cpp/source.cpp | 18 - .../cpp/source.cpp | 34 - .../cpp/source.cpp | 62 - .../cpp/source.cpp | 18 - .../cpp/encryptor.cpp | 54 - .../cpp/remarks.cpp | 39 - .../cpp/ctor1.cpp | 23 - .../cpp/remarks.cpp | 44 - .../system.string.concat/cpp/Concat6.cpp | 15 - .../system.string.ctor/cpp/assignment.cpp | 18 - .../system.string.ctor/cpp/char1_ctor.cpp | 20 - .../system.string.ctor/cpp/char2_ctor.cpp | 32 - .../system.string.ctor/cpp/chptrctor_null.cpp | 24 - .../system.string.ctor/cpp/ptrctor_null.cpp | 27 - .../cpp/NullString1.cpp | 32 - .../cpp/isnullorempty1.cpp | 18 - .../cpp/StartsWith2.cpp | 23 - .../cpp/startswith1.cpp | 54 - .../CPP/regexreplace.cpp | 49 - .../cpp/source.cpp | 36 - .../cpp/source.cpp | 102 - .../system.timers.timer/cpp/timer1.cpp | 49 - .../system.type.basetype/cpp/remarks.cpp | 11 - .../system.type.declaringtype/cpp/remarks.cpp | 12 - .../cpp/remarks.cpp | 18 - .../cpp/remarks.cpp | 26 - .../system.typedreference/cpp/source.cpp | 33 - .../system.version.revision/cpp/rev.cpp | 32 - .../FxCop.Reliability.ReliabilityContract.cpp | 11 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 67 - .../CPP/source.cpp | 49 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 97 - .../CPP/source.cpp | 100 - .../CPP/source.cpp | 115 -- .../CPP/source.cpp | 70 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 74 - .../CPP/source.cpp | 106 -- .../CPP/source.cpp | 96 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 103 - .../CPP/source.cpp | 118 -- .../CPP/source.cpp | 89 - .../CPP/source.cpp | 66 - .../CPP/source.cpp | 108 -- .../CPP/notation.cpp | 52 - .../CPP/source.cpp | 89 - .../CPP/namespaces.cpp | 30 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 100 - .../CPP/source.cpp | 119 -- .../CPP/source.cpp | 32 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 82 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 74 - .../CPP/source.cpp | 61 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 75 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 75 - .../CPP/source.cpp | 67 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 49 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 51 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 79 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 83 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 90 - .../CPP/source.cpp | 117 -- .../CPP/source.cpp | 30 - .../CPP/complextype.cpp | 68 - .../CPP/datatype.cpp | 57 - .../CPP/documentation.cpp | 114 -- .../CPP/element.cpp | 94 - .../CPP/fractiondigitsfacet.cpp | 84 - .../CPP/import_include_sample.cpp | 63 - .../CPP/key_sample.cpp | 83 - .../CPP/lengthfacet.cpp | 77 - .../CPP/maxexclusivefacet.cpp | 78 - .../CPP/maxinclusivefacet.cpp | 78 - .../CPP/maxlengthfacet.cpp | 79 - .../CPP/minexclusivefacet.cpp | 78 - .../CPP/mininclusivefacet.cpp | 78 - .../CPP/minlengthfacet.cpp | 79 - .../CPP/patternfacet.cpp | 78 - .../CPP/simpletypeunion.cpp | 78 - .../CPP/unique.cpp | 128 -- .../CPP/whitespacefacet.cpp | 68 - .../IHasXmlNode.GetNode/CPP/hasxmlnode.cpp | 26 - .../IXmlLineInfo/CPP/lineinfo.cpp | 60 - .../NameTable/CPP/nametable.cpp | 31 - .../CPP/severity.cpp | 67 - .../CPP/returntype.cpp | 54 - .../CPP/xpathnavigatormethods.cpp | 1166 ------------ .../CPP/xpathnavigatorproperties.cpp | 134 -- .../XPathValidation/CPP/XPathValidation.cpp | 68 - .../XmlConvert.EncodeName/CPP/convert.cpp | 24 - .../XmlConvert.ToDouble/CPP/readData.cpp | 38 - .../XmlConvert.VerifyName/CPP/verifyname.cpp | 35 - .../CPP/getrow.cpp | 30 - .../XmlDataDocument.Load/CPP/loadrdr.cpp | 31 - .../CPP/docresolver.cpp | 27 - .../XmlDocument.cctor/CPP/docload.cpp | 56 - .../XmlEntity/CPP/entities.cpp | 39 - .../XmlNode.SelectNodes1/CPP/selectnodes1.cpp | 31 - .../CPP/selectsingnode.cpp | 25 - .../CPP/XmlNode.SelectSingleNode2.cpp | 25 - .../CPP/nodeevent.cpp | 64 - .../XmlNotation/CPP/notation.cpp | 32 - .../CPP/XmlReaderSettings.DtdValidate.cpp | 33 - .../CPP/XmlReaderSettings.cctor.cpp | 38 - .../CPP/XmlReader_Validate_SchemaSet.cpp | 50 - .../CPP/schemaevent.cpp | 37 - .../CPP/schemacolladd.cpp | 55 - .../XmlSchemaCollection.Basic/CPP/aa.cpp | 45 - .../CPP/XmlSchemaInferenceExamples.cpp | 101 - .../CPP/xmlschemasetexample.cpp | 36 - .../CPP/secresolver2.cpp | 37 - .../CPP/secresolver.cpp | 41 - .../XmlTextReader.Cctor/CPP/readfrag.cpp | 47 - .../XmlTextReader.LineNum/CPP/readlinenum.cpp | 57 - .../CPP/readnormal.cpp | 45 - .../CPP/readattrval.cpp | 46 - .../CPP/resetstate.cpp | 31 - .../XmlTextReader.XmlLang/CPP/readlang.cpp | 50 - .../CPP/rdr_resolver.cpp | 34 - .../XmlTextReader.XmlSpace/CPP/readspace.cpp | 41 - .../XmlTextReader.cctor1/CPP/rdrcctor1.cpp | 41 - .../XmlTextWriter.Flush/CPP/write2docs.cpp | 32 - .../CPP/valid_xsd2.cpp | 64 - .../CPP/readdefattr.cpp | 31 - .../CPP/schematype.cpp | 51 - .../CPP/vrdr_resolver.cpp | 59 - .../XmlWriter.Close/CPP/XmlWriter.Close.cpp | 32 - .../XmlWriter.Flush/CPP/write2docs_v2.cpp | 33 - .../CPP/writeattrstring.cpp | 29 - .../CPP/writeattrs_v2.cpp | 32 - .../XmlWriter.WriteBase64/CPP/writebase64.cpp | 143 -- .../CPP/writeelemstring_v2.cpp | 71 - .../XmlWriter.WriteNode/CPP/writenode.cpp | 40 - .../CPP/trans_snip4.cpp | 25 - .../XslTransform.Load3/CPP/trans3.cpp | 38 - .../XslTransform.Load4/CPP/trans_ev.cpp | 35 - .../CPP/trans_snip.cpp | 27 - .../CPP/trans_snip3.cpp | 41 - .../CPP/trans_snip2.cpp | 20 - .../cpp/source.cpp | 47 - .../cpp/source.cpp | 63 - ...atedservicetypeentry_objecttype_server.cpp | 53 - .../CPP/authenticationmanager_unregister2.cpp | 63 - .../CPP/authorization_constructor3.cpp | 104 - .../CPP/authorization_protectionrealm.cpp | 192 -- .../CPP/bindingcollectionsample2.cpp | 170 -- .../CPP/bindingcollectionsample1.cpp | 62 - .../CPP/bindingcollectionsample3.cpp | 51 - .../CallContext/CPP/client.cpp | 49 - .../CallContext/CPP/service.cpp | 94 - .../CPP/callcontext_client.cpp | 110 -- .../CPP/callcontext_share.cpp | 69 - .../CPP/channelservices_getchannel_client.cpp | 56 - ...nnelservices_registeredchannels_client.cpp | 50 - ...nnelservices_registeredchannels_server.cpp | 69 - ...nelservices_syncdispatchmessage_client.cpp | 132 -- .../CPP/source.cpp | 25 - .../Classic Dns Example/CPP/source.cpp | 20 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 16 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 166 -- .../CPP/source.cpp | 157 -- .../CPP/source.cpp | 156 -- .../CPP/source.cpp | 154 -- .../CPP/source.cpp | 68 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 61 - .../CPP/source.cpp | 61 - .../CPP/source.cpp | 58 - .../CPP/source.cpp | 61 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 62 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 106 -- .../Classic TcpListenerExample/CPP/source.cpp | 83 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 280 --- .../Classic UdpClientExample/CPP/source.cpp | 45 - .../Classic Uri Example/CPP/source.cpp | 34 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 18 - .../Classic Uri.Host Example/CPP/source.cpp | 20 - .../CPP/source.cpp | 29 - .../Classic Uri.Port Example/CPP/source.cpp | 20 - .../Classic Uri.Scheme Example/CPP/source.cpp | 20 - .../Classic Uri.Uri Example/CPP/source.cpp | 18 - .../Classic Uri.Uri1 Example/CPP/source.cpp | 18 - .../Classic Uri.Uri3 Example/CPP/source.cpp | 20 - .../Classic Uri.Uri4 Example/CPP/source.cpp | 12 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 37 - .../Classic WebProxy Example/CPP/source.cpp | 22 - .../Classic WebRequest Example/CPP/source.cpp | 24 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 132 -- .../CPP/source.cpp | 62 - .../CPP/source.cpp | 111 -- .../CPP/source.cpp | 22 - .../CPP/source.cpp | 162 -- .../CPP/source.cpp | 22 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 93 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 59 - .../CPP/source.cpp | 75 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 65 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 113 -- .../CPP/source.cpp | 102 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 85 - .../CPP/source.cpp | 107 -- .../CPP/source.cpp | 78 - .../CPP/source.cpp | 112 -- .../CPP/source.cpp | 88 - .../CPP/source.cpp | 101 - .../CPP/source.cpp | 80 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 74 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 115 -- .../CPP/source.cpp | 55 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 20 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 64 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 19 - .../CPP/source.cpp | 96 - .../CPP/source.cpp | 100 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 80 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 43 - .../CPP/source2.cpp | 23 - .../CPP/source3.cpp | 46 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 17 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 67 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 62 - .../CPP/source.cpp | 216 --- .../CPP/source.cpp | 26 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 91 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 79 - .../CPP/source.cpp | 181 -- .../CPP/source.cpp | 51 - .../CPP/source.cpp | 58 - .../CPP/source.cpp | 137 -- .../CPP/source.cpp | 133 -- .../CPP/source.cpp | 46 - .../CPP/source.cpp | 82 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 99 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 248 --- .../CPP/clientsponsor_client.cpp | 61 - .../CPP/commontransportkeys.cpp | 228 --- .../CPP/contractreference.cpp | 63 - .../CPP/contractreference_contract.cpp | 52 - .../CPP/contractreference_defaultfilename.cpp | 41 - .../CPP/contractreference_readdocument.cpp | 37 - .../CPP/contractreference_ref.cpp | 46 - .../CPP/contractreference_writedocument.cpp | 45 - .../CPP/contractreference_ctor1.cpp | 56 - .../CPP/contractreference_ctor2.cpp | 57 - .../CPP/CookieCollection_Item_1.cpp | 147 -- .../CPP/CookieCollection_Item_2.cpp | 143 -- .../CreateObjRef/CPP/example.cpp | 141 -- .../CreateObjRef2/CPP/example.cpp | 139 -- .../CPP/credentialcache_add_remove.cpp | 84 - .../credentialcache_defaultcredentials.cpp | 82 - .../CPP/credentialcache_getcredential.cpp | 86 - .../CPP/credentialcache_getenumerator.cpp | 92 - .../CPP/customproxy_sample.cpp | 250 --- ...ateclient_socketpermission_constructor.cpp | 168 -- .../CPP/dateclient_socketpermission_toxml.cpp | 193 -- .../CPP/descriptionnamespacesample1.cpp | 213 --- .../CPP/discoveryclientdocumentcollection.cpp | 60 - ...discoveryclientdocumentcollection_keys.cpp | 68 - ...discoveryclientdocumentcollection_ctor.cpp | 70 - ...ryclientprotocol_additionalinformation.cpp | 49 - .../CPP/discoveryclientprotocol_download.cpp | 38 - .../CPP/discoveryclientprotocol_download.cpp | 36 - .../CPP/discoveryclientprotocol_errors.cpp | 54 - .../discoveryclientreferencecollection.cpp | 63 - ...scoveryclientreferencecollection_items.cpp | 75 - ...iscoveryclientreferencecollection_keys.cpp | 67 - .../CPP/discoveryclientresult.cpp | 46 - .../CPP/discoveryclientresultcollection.cpp | 62 - .../CPP/discoveryclientresult_filename.cpp | 96 - .../CPP/discoveryclientresult_ctor.cpp | 64 - .../discoveryclientresultsfile_results.cpp | 66 - .../CPP/discoverydocument.cpp | 64 - ...iscoverydocumentreference_readdocument.cpp | 44 - ...overydocumentreference_ctor_properties.cpp | 59 - ...rydocumentreference_ctor_writedocument.cpp | 61 - .../discoverydocument_discoverydocument.cpp | 70 - .../CPP/discoverydocument_write1.cpp | 62 - .../CPP/discoverydocument_write2.cpp | 64 - ...eryexceptiondictionary_property_method.cpp | 115 -- .../CPP/discoveryreference.cpp | 119 -- .../CPP/discoveryreference.cpp | 122 -- .../CPP/discoveryreferencecollection.cpp | 58 - .../CPP/discovery_soapbinding.cpp | 64 - .../CPP/dnspermission_constructor.cpp | 69 - .../CPP/dnspermission_copy.cpp | 67 - .../CPP/dnspermission_fromxml.cpp | 95 - .../CPP/dnspermission_issubsetof.cpp | 84 - .../CPP/dnspermission_isunrestricted.cpp | 73 - .../CPP/dns_begin_endresolve.cpp | 80 - .../CPP/dns_gethostbyaddress_ipaddress.cpp | 80 - .../CPP/dns_gethostbyname.cpp | 73 - .../Dns_GetHostName/CPP/dns_gethostname.cpp | 45 - .../Dns_Resolve/CPP/dns_resolve.cpp | 84 - .../CPP/documentableitemsample.cpp | 48 - .../CPP/deployservicedcomponent.cpp | 69 - .../CPP/class1.cpp | 108 -- .../CPP/class1.cpp | 19 - .../cpp/class1.cpp | 72 - .../cpp/class1.cpp | 45 - .../cpp/class1.cpp | 49 - .../cpp/class1.cpp | 48 - .../cpp/class1.cpp | 46 - .../CPP/calculator.cpp | 23 - .../EnterpriseServices_Crm/cpp/crmclient.cpp | 27 - .../EnterpriseServices_Crm/cpp/crmserver.cpp | 289 --- .../CPP/inspector.cpp | 60 - .../CPP/employeeinformation.cpp | 91 - .../CPP/receiptcounterclass.cpp | 54 - .../CPP/transaction.cpp | 27 - .../CPP/faultbindingcollection_add.cpp | 217 --- .../CPP/faultbindingcollection_item.cpp | 47 - .../CPP/faultbindingcollection_remove.cpp | 89 - .../CPP/filewebrequest_contentlength.cpp | 72 - .../CPP/filewebrequest_reqbeginend.cpp | 118 -- .../CPP/filewebrequest_resbeginend.cpp | 105 -- .../CPP/filewebresponse_close.cpp | 58 - ...ewebresponse_contentlength_contenttype.cpp | 56 - .../CPP/filewebresponse_getresponsestream.cpp | 77 - .../CPP/filewebresponse_headers.cpp | 57 - .../CPP/filewebresponse_responseuri.cpp | 56 - .../CPP/httpbinding_ctor.cpp | 93 - .../CPP/class1.cpp | 219 --- .../CPP/class1.cpp | 215 --- .../HttpChannel.GetUrlsFromUri/CPP/class1.cpp | 33 - .../HttpChannel/CPP/server.cpp | 30 - .../CPP/httpgetclientprotocol_constructor.cpp | 77 - .../httppostclientprotocol_constructor.cpp | 75 - .../CPP/httpclientchannel_6_client.cpp | 71 - .../CPP/httpserverchannel_9_server.cpp | 84 - .../CPP/source.cpp | 60 - .../CPP/httpversion_version10.cpp | 49 - .../CPP/httpwebclientprotocol_useragent.cpp | 78 - .../CPP/httpwebrequest_accept.cpp | 92 - .../CPP/httpwebrequest_allowautoredirect.cpp | 60 - ...tpwebrequest_allowwritestreambuffering.cpp | 81 - .../httpwebrequest_begingetrequeststream.cpp | 97 - .../CPP/httpwebrequest_begingetresponse.cpp | 158 -- .../CPP/httpwebrequest_connection.cpp | 94 - .../CPP/httpwebrequest_contentlength.cpp | 102 - .../CPP/httpwebrequest_headers.cpp | 57 - .../CPP/httpwebrequest_ifmodifiedsince.cpp | 90 - .../CPP/httpwebrequest_pipelined.cpp | 86 - .../CPP/httpwebrequest_protocolversion.cpp | 67 - .../CPP/httpwebrequest_referer.cpp | 89 - .../CPP/httpwebrequest_sendchunked.cpp | 112 -- .../CPP/httpwebrequest_timeout.cpp | 61 - .../CPP/httpwebrequest_useragent.cpp | 58 - .../CPP/httpwebresponse_close.cpp | 52 - .../CPP/source.cpp | 82 - .../CPP/httpwebresponse_getresponseheader.cpp | 70 - .../CPP/httpwebresponse_getresponsestream.cpp | 73 - .../CPP/httpwebresponse_headers.cpp | 61 - .../CPP/httpwebresponse_lastmodified.cpp | 67 - .../CPP/httpwebresponse_method_server.cpp | 59 - .../CPP/httpwebresponse_protocolversion.cpp | 59 - .../CPP/httpwebresponse_responseuri.cpp | 63 - ...bresponse_statuscode_statusdescription.cpp | 56 - .../CPP/httpwebrequest_haveresponse.cpp | 78 - .../CPP/httpwebrequest_proxy.cpp | 110 -- .../CPP/ichanneldatastore.cpp | 69 - .../ichannelreceiverhook_channelscheme.cpp | 141 -- .../ichannelreceiver_channeldata_server.cpp | 174 -- .../CPP/ichannelsender_2_client.cpp | 71 - .../ICredential/CPP/icredential.cpp | 125 -- .../ILease_ILease/CPP/ilease_client.cpp | 91 - .../CPP/imessagesink_client.cpp | 149 -- .../CPP/imethodcallmessage.cpp | 108 -- .../CPP/imethodmessage_logicalcallcontext.cpp | 104 - .../CPP/imethodmessage_methodname.cpp | 111 -- .../CPP/imethodreturnmessage_exception.cpp | 87 - .../CPP/imethodreturnmessage_returnvalue.cpp | 106 -- .../CPP/ipaddress_broadcast_loopback.cpp | 33 - .../CPP/ipaddress_networktohost.cpp | 87 - .../IPAddress_None/CPP/ipaddress_none.cpp | 22 - .../CPP/ipendpoint_properties.cpp | 123 -- .../CPP/iphostentry_addresslist.cpp | 59 - .../CPP/iserverchannelsinkprovider_3.cpp | 71 - .../ISponsor_Client/CPP/isponsor_client.cpp | 68 - .../CPP/itransportheaders_3_server.cpp | 115 -- .../CPP/iwebproxy_interface.cpp | 87 - .../CPP/importcollection_6.cpp | 71 - .../Importsample/CPP/importsample.cpp | 88 - .../CPP/logicalmethodinfo_begininvoke.cpp | 123 -- .../CPP/logicalmethodinfo_constructor.cpp | 66 - .../CPP/logicalmethodinfo_create1.cpp | 76 - .../CPP/logicalmethodinfo_create2.cpp | 78 - .../logicalmethodinfo_getcustomattribute.cpp | 124 -- .../CPP/logicalmethodinfo_isbeginmethod.cpp | 80 - .../CPP/SvcClient_MatchAttribute.cpp | 141 -- .../CPP/message_acknowledgment.cpp | 145 -- .../Message.Body/CPP/message_sendreceive.cpp | 117 -- .../CPP/message_defaultandpriority.cpp | 107 -- .../CPP/messagebinding_sample.cpp | 85 - .../CPP/messagecollection.cpp | 80 - .../CPP/messagepartcollection.cpp | 106 -- .../MessagePropertyFilter/CPP/class1.cpp | 930 --------- .../CPP/mqbeginpeek_timeoutstateobject.cpp | 75 - .../CPP/mqbeginpeek_noparms.cpp | 55 - .../CPP/mqbeginpeek_timeout.cpp | 61 - .../CPP/mqbeginreceive_noparms_mre.cpp | 69 - .../CPP/mqbeginreceive_noparms_wh.cpp | 64 - .../MessageQueue.Close/CPP/mqclose.cpp | 76 - .../CPP/mqcreate_transactional.cpp | 106 -- .../MessageQueue.Create_path/CPP/mqcreate.cpp | 80 - .../CPP/mqdefaultpropertiestosend.cpp | 76 - .../CPP/mqexistsdelete.cpp | 36 - .../CPP/mqgetmessageenumerator.cpp | 55 - .../mqgetmessagequeueenumerator_criteria.cpp | 60 - .../CPP/mqgetmessagequeueenumerator.cpp | 54 - .../CPP/mqgetqueuelists.cpp | 155 -- .../CPP/mqmessagereadpropertyfilter.cpp | 117 -- .../MessageQueue.Path/CPP/mqpath.cpp | 125 -- .../CPP/mqpeek_noparms.cpp | 127 -- .../CPP/mqpeek_timeout.cpp | 73 - .../CPP/mqreceivecompletedeventhandler.cpp | 58 - .../CPP/mqreceive_timeouttransaction.cpp | 121 -- .../CPP/mqreceive_noparms.cpp | 100 - .../CPP/mqreceive_timeout.cpp | 85 - .../CPP/mqreceive_transaction.cpp | 113 -- .../CPP/mqsend_objtransaction.cpp | 113 -- .../CPP/mqsend_generic.cpp | 55 - .../CPP/mqctor_denysharedreceive.cpp | 63 - .../MessageQueue2/cpp/class1.cpp | 1101 ----------- .../MessageQueue4/cpp/class1.cpp | 43 - .../MessageQueueBeginPeek/cpp/class1.cpp | 69 - .../MessageQueueBeginReceive1/cpp/class1.cpp | 82 - .../MessageQueueBeginReceive2/cpp/class1.cpp | 86 - .../MessageQueueBeginReceive3/cpp/class1.cpp | 81 - .../cpp/class1.cpp | 62 - .../cpp/class1.cpp | 213 --- .../cpp/class1.cpp | 208 -- .../cpp/class1.cpp | 408 ---- .../Message_Samples3/CPP/message_samples3.cpp | 58 - .../CPP/source.cpp | 15 - .../CPP/source.cpp | 48 - .../CPP/source.cpp | 50 - .../CPP/mimecontentbinding_part_4.cpp | 53 - .../mimemultipartrelatedbinding_parts_2.cpp | 55 - .../CPP/mimepartcollection_1.cpp | 66 - .../CPP/mimepartcollection_8.cpp | 146 -- .../MimePart_3/CPP/mimepart_3.cpp | 60 - .../MimeTextMatch_5/CPP/mimetextmatch_5.cpp | 138 -- .../CPP/mimetext_binding_match_8.cpp | 128 -- .../CPP/mimetext_match_matchcoll_9.cpp | 180 -- .../CPP/mimexmlbinding_part_3.cpp | 93 - .../NCLAutoProxy/CPP/proxy.cpp | 235 --- .../NCLCookies/CPP/cookiessnippets.cpp | 77 - .../NCLCredPolicy/CPP/NCLCredPolicy.cpp | 249 --- .../NCLCustomWebClient/CPP/mywebclient.cpp | 188 -- .../NCLEmptyWebProxy/CPP/test.cpp | 31 - .../NCLFtpAsync/CPP/async.cpp | 227 --- .../NCLFtpClient/CPP/ftptests.cpp | 842 --------- .../NCLMailSync/CPP/NclMailSync.cpp | 1082 ----------- .../NCLNetInfo2/CPP/networkexamples.cpp | 1010 ---------- .../NCLNetInfoReport/CPP/netinfo.cpp | 603 ------ .../CPP/NCLPhysicalAddress.cpp | 140 -- .../NCLPingSampler/CPP/pingtest.cpp | 249 --- .../NCLResponse1/CPP/httpwebrequest1.cpp | 51 - .../NCLServicePoint/CPP/nclservicepoint.cpp | 88 - .../NCLSimpleCache/CPP/NCLSimpleCache.cpp | 274 --- .../CPP/nclsocketenhancements.cpp | 713 ------- .../CPP/iocontrolserver.cpp | 68 - .../NCLSocketIoControl1/CPP/iocontrolcode.cpp | 70 - .../NCLTcpClientSync/CPP/tcpclient.cpp | 36 - .../CPP/nclurienhancements.cpp | 150 -- .../NCLUriExamples/CPP/uriexamples.cpp | 271 --- .../NCLWebClientAsync/CPP/asyncmethods.cpp | 843 --------- .../NCLWebClientUserAgent/CPP/useragent.cpp | 31 - .../NCLWebProxy/CPP/nclwebproxy.cpp | 186 -- .../NCLWebRequestSimple/CPP/webrequestget.cpp | 45 - .../CPP/source.cpp | 40 - .../NclCodeGroup/cpp/sample.cpp | 167 -- .../NclMailASync/cpp/mailasync.cpp | 94 - .../NclMailPerms/CPP/mailpermissions.cpp | 98 - .../CPP/NclNegoAsyncServer.cpp | 239 --- .../CPP/NclNegoSyncClient.cpp | 107 -- .../CPP/NclNegoSyncServer.cpp | 73 - .../CPP/NclNegoasyncClient.cpp | 128 -- .../NclNetAddressChanged1/CPP/changed.cpp | 27 - .../CPP/NclNetworkInfoPerms.cpp | 48 - .../NclPingAsync/CPP/asyncping.cpp | 115 -- .../NclPingSync/CPP/syncping.cpp | 48 - .../CPP/NclSslClientAsync.cpp | 337 ---- .../NclSslClientSync/CPP/clientsync.cpp | 260 --- .../CPP/NclSslServerAsync.cpp | 265 --- .../NclSslServerSync/CPP/NclSslServerSync.cpp | 235 --- .../NclTcpServerSync/cpp/tcplistener.cpp | 39 - .../NestingLevel/cpp/nestinglevel.cpp | 43 - .../CPP/networkcredential_constructor2.cpp | 67 - .../CPP/networkcredential_getcredential.cpp | 68 - ...orkcredential_username_password_domain.cpp | 74 - .../CPP/source.cpp | 51 - .../CPP/source.cpp | 108 -- .../ObjectHandle/CPP/objecthandleassembly.cpp | 48 - ...gcollection_operationbindingcollection.cpp | 134 -- .../CPP/operationbinding_operationbinding.cpp | 127 -- .../CPP/operationcollection_methods.cpp | 92 - .../CPP/operationfaultcollection_7.cpp | 114 -- .../CPP/operationfaultcollection_add.cpp | 54 - .../CPP/operationfaultcollection_item.cpp | 53 - .../CPP/operationfault_operationfault.cpp | 55 - .../CPP/operationflow_enum.cpp | 141 -- .../CPP/operationinput_operationinput.cpp | 127 -- .../CPP/operationmessagecollection_sample.cpp | 129 -- .../CPP/operationmessage_properties.cpp | 64 - .../CPP/operationoutput_operationoutput.cpp | 127 -- .../Operation_2/CPP/operation_2.cpp | 155 -- .../Operation_5/CPP/operation_5.cpp | 72 - .../Operation_Faults/CPP/operation_faults.cpp | 47 - .../CPP/operation_isboundby.cpp | 95 - .../PortClass/CPP/portclass.cpp | 166 -- .../CPP/portcollection_add.cpp | 67 - .../CPP/portcollection_copyto.cpp | 71 - .../CPP/portcollection_item.cpp | 71 - .../PortType/CPP/porttype.cpp | 75 - .../CPP/porttypecollection_1.cpp | 59 - .../CPP/porttypecollection_2.cpp | 68 - .../CPP/porttypecollection_class.cpp | 64 - .../CPP/porttypecollection_copyto.cpp | 50 - .../PortType_Class/CPP/porttype_class.cpp | 71 - .../RealProxy_Sample/CPP/realproxy_sample.cpp | 131 -- .../Remoting.ObjRef/CPP/client.cpp | 54 - .../CPP/client.cpp | 36 - .../CPP/server.cpp | 21 - .../CPP/service.cpp | 36 - .../CPP/server.cpp | 61 - .../CPP/client.cpp | 38 - .../CPP/server.cpp | 27 - .../CPP/service.cpp | 34 - ...remotingconfiguration_configure_server.cpp | 40 - ...n_GetRegisteredActivatedService_server.cpp | 44 - ...on_getregisteredwellknownclient_client.cpp | 36 - ..._isremotelyactivatedclienttype1_client.cpp | 43 - ..._isremotelyactivatedclienttype2_client.cpp | 52 - ...guration_iswellknownclienttype1_client.cpp | 37 - ...guration_iswellknownclienttype2_client.cpp | 42 - .../CPP/class1.cpp | 56 - .../CPP/basicclient.cpp | 45 - .../CPP/manualserver.cpp | 33 - .../CPP/serviceclass.cpp | 153 -- .../CPP/client.cpp | 54 - .../CPP/timerclient.cpp | 75 - .../RemotingServices.Unmarshal/CPP/client.cpp | 39 - .../Remoting_Ipc/CPP/client.cpp | 33 - .../Remoting_Ipc/CPP/counter.cpp | 24 - .../Remoting_Ipc/CPP/server.cpp | 40 - .../Remoting_Sinks/CPP/clientsink.cpp | 142 -- .../Remoting_Sinks/CPP/serversink.cpp | 137 -- .../Remoting_TcpAuth/CPP/client.cpp | 35 - .../Remoting_TcpAuth/CPP/server.cpp | 34 - .../Remoting_TcpInfo/CPP/client.cpp | 35 - .../Remoting_TcpInfo/CPP/remotable.cpp | 22 - .../Remoting_TcpInfo/CPP/server.cpp | 45 - .../SchemaReference/CPP/schemareference.cpp | 83 - .../SelectModeExample/CPP/source.cpp | 65 - .../SerializationAttributes/CPP/s.cpp | 77 - .../ServiceClass/CPP/serviceclass.cpp | 84 - .../CPP/servicecollection_copyto.cpp | 111 -- .../CPP/servicecollection_item.cpp | 80 - .../CPP/servicedescription.cpp | 84 - .../CPP/servicedescriptionbasecollection.cpp | 192 -- .../CPP/servicedescriptioncollection.cpp | 57 - .../CPP/sdcollection_constructor_add_item.cpp | 50 - ...ervicedescriptioncollection_getbinding.cpp | 52 - ...ervicedescriptioncollection_getmessage.cpp | 52 - ...rvicedescriptioncollection_getporttype.cpp | 53 - ...ervicedescriptioncollection_getservice.cpp | 53 - .../CPP/sdcollection_insert_item_copyto.cpp | 62 - .../servicedescriptionformatextension_13.cpp | 142 -- .../servicedescriptionimportstyle_client.cpp | 39 - .../servicedescriptionimportwarnings_enum.cpp | 82 - .../CPP/servicedescription_bindings.cpp | 85 - .../CPP/servicedescription_constructor_4.cpp | 59 - .../CPP/servicedescription_extensions_2.cpp | 42 - .../CPP/servicedescription_imports.cpp | 42 - .../CPP/servicedescription_namespace.cpp | 30 - .../CPP/servicedescription_porttypes_2.cpp | 69 - .../CPP/servicedescription_read.cpp | 85 - .../CPP/servicedescription_read1.cpp | 44 - .../CPP/servicedescription_read2.cpp | 44 - .../CPP/servicedescription_types.cpp | 101 - .../Service_Class4/CPP/service_class.cpp | 95 - .../SinkProviders/CPP/source.cpp | 23 - .../CPP/defvalue.cpp | 126 -- .../SoapAttribute/CPP/soapattribute.cpp | 115 -- .../CPP/soapattributeex2.cpp | 76 - .../CPP/attadd.cpp | 72 - .../CPP/attadd2.cpp | 72 - .../SoapAttributes1/CPP/s.cpp | 50 - .../SoapAttributesOverrides/CPP/soapover.cpp | 246 --- .../CPP/soapbindingstyle_rpc.cpp | 110 -- .../CPP/soapprotocol.cpp | 178 -- .../CPP/soapbodybinding_parts.cpp | 89 - ...ntformattersinkprovider_customprovider.cpp | 173 -- ...ntformattersinkprovider_customprovider.cpp | 270 --- .../CPP/SoapClientMessage.cpp | 269 --- .../CPP/soapelementoverrides.cpp | 106 -- .../CPP/soapenumoverrides.cpp | 94 - .../CPP/traceextension.cpp | 156 -- .../CPP/SoapExtensionAttribute.cpp | 230 --- .../SoapFaultBinding/CPP/soapfaultbinding.cpp | 68 - .../CPP/soapfaultbinding_ctor.cpp | 110 -- .../CPP/soapformatter.cpp | 90 - .../CPP/soapheaderbinding.cpp | 67 - .../CPP/soapheaderbinding_maptoproperty.cpp | 35 - .../CPP/soapheaderbinding_use.cpp | 87 - .../CPP/SoapHeaderCollection.cpp | 257 --- .../CPP/SoapHeaderCollection_Contains.cpp | 253 --- .../CPP/soapheader_encodedmustunderstand.cpp | 53 - .../CPP/source.cpp | 60 - .../SoapMessage/CPP/SoapMessage.cpp | 322 ---- .../SoapMessageState/CPP/SoapMessageState.cpp | 225 --- .../CPP/SoapMessage_Headers.cpp | 281 --- .../CPP/soapoperationbinding.cpp | 104 - .../CPP/soaptype.cpp | 171 -- .../SocketPermissionExample/CPP/source.cpp | 122 -- .../SocketPropertyTester/CPP/class1.cpp | 105 -- .../Socket_Select/CPP/source.cpp | 75 - .../Socket_Send_Receive/CPP/source.cpp | 128 -- .../Socket_Socket_Options/CPP/source.cpp | 105 -- .../Socket_Sync_Send_Receive/CPP/source.cpp | 449 ----- .../CPP/queuedcomponent.cpp | 47 - .../CPP/queuedcomponentclientclass.cpp | 24 - .../CPP/custombasicauthentication.cpp | 355 ---- .../System.Net.Dns/CPP/dnsnewmethods.cpp | 145 -- .../CPP/getresponse.cpp | 120 -- .../CPP/getrequeststream.cpp | 134 -- .../CPP/noneanyloopback.cpp | 140 -- .../CPP/isloopback.cpp | 75 - .../System.Net.IPAddress.Parse/CPP/parse.cpp | 73 - .../System.Net.IPAddress/CPP/ipaddress.cpp | 142 -- .../System.Net.IPEndPoint/CPP/ipendpoint.cpp | 230 --- .../CPP/servicepoint.cpp | 203 -- .../cpp/servicepoint.cpp | 241 --- .../CPP/custombasicauthentication.cpp | 344 ---- .../CPP/listener.cpp | 130 -- .../CPP/sender.cpp | 107 -- .../CPP/beginconnect.cpp | 128 -- .../CPP/sendgeneric.cpp | 175 -- .../CPP/tcpclient.cpp | 118 -- .../CPP/newtcpclient.cpp | 125 -- .../CPP/tcpserver.cpp | 226 --- .../cpp/tcpserver.cpp | 150 -- .../CPP/joinmulticastgroup.cpp | 326 ---- .../CPP/newudpclient.cpp | 88 - .../cpp/asyncudp.cpp | 261 --- .../CPP/activatedclienttypeentry_client.cpp | 56 - .../CPP/activatedclienttypeentry_server.cpp | 19 - .../CPP/activatedclienttypeentry_share.cpp | 21 - .../CPP/client.cpp | 47 - .../CPP/remoteobject.cpp | 27 - .../CPP/server.cpp | 35 - .../CPP/client.cpp | 68 - .../CPP/client2.cpp | 93 - .../CPP/common.cpp | 22 - .../CPP/server.cpp | 26 - .../CPP/client.cpp | 31 - .../CPP/common.cpp | 19 - .../CPP/server.cpp | 91 - .../CPP/server2.cpp | 97 - .../CPP/client.cpp | 46 - .../CPP/common.cpp | 21 - .../CPP/server.cpp | 76 - .../CPP/server2.cpp | 43 - .../CPP/client.cpp | 70 - .../CPP/client2.cpp | 73 - .../CPP/server.cpp | 75 - .../CPP/server2.cpp | 86 - .../CPP/client.cpp | 51 - .../CPP/common.cpp | 25 - .../CPP/server.cpp | 68 - .../CPP/server.cpp | 54 - .../CPP/client.cpp | 57 - .../CPP/server.cpp | 44 - .../CPP/server.cpp | 55 - .../CPP/server.cpp | 29 - .../CPP/demo.cpp | 69 - .../CPP/demo.cpp | 50 - .../CPP/demo2.cpp | 34 - .../CPP/demo.cpp | 57 - .../CPP/demo2.cpp | 40 - .../CPP/demo.cpp | 55 - .../CPP/demo2.cpp | 42 - .../CPP/demo.cpp | 34 - .../CPP/demo.cpp | 61 - .../CPP/demo2.cpp | 31 - .../CPP/demo.cpp | 49 - .../CPP/demo.cpp | 56 - .../CPP/demo2.cpp | 38 - .../CPP/demo.cpp | 50 - .../CPP/demo2.cpp | 36 - .../CPP/demo.cpp | 69 - .../CPP/demo2.cpp | 31 - .../CPP/demo.cpp | 62 - .../CPP/demo2.cpp | 33 - .../CPP/demo.cpp | 51 - .../CPP/demo2.cpp | 35 - .../CPP/demo.cpp | 54 - .../CPP/demo2.cpp | 33 - .../CPP/demo.cpp | 53 - .../CPP/demo2.cpp | 36 - .../CPP/demo.cpp | 79 - .../CPP/demo2.cpp | 36 - .../CPP/demo.cpp | 51 - .../CPP/demo2.cpp | 35 - .../CPP/demo.cpp | 73 - .../CPP/demo2.cpp | 63 - .../CPP/demo.cpp | 55 - .../CPP/demo2.cpp | 31 - .../CPP/demo.cpp | 55 - .../CPP/demo2.cpp | 41 - .../CPP/demo.cpp | 57 - .../CPP/demo2.cpp | 41 - .../CPP/remotingservicessample.cpp | 232 --- .../CPP/demo.cpp | 371 ---- .../CPP/class1.cpp | 28 - .../TcpChannel.GetUrlsForUri/CPP/class1.cpp | 32 - .../CPP/source.cpp | 44 - .../CPP/class1.cpp | 32 - .../CPP/unrefobj.cpp | 90 - .../UriBuilderSample/cpp/main.cpp | 27 - .../WebClient/CPP/webclient.cpp | 37 - .../CPP/webclientauth.cpp | 27 - .../webclient_baseaddress_responseheaders.cpp | 67 - .../CPP/webclient_downloaddata.cpp | 48 - .../CPP/webclient_downloadfile.cpp | 47 - .../CPP/webclient_openread.cpp | 49 - .../CPP/webclient_openwrite.cpp | 56 - .../CPP/webclient_openwrite2.cpp | 58 - .../CPP/webclient_querystring.cpp | 65 - .../CPP/webclient_uploaddata2.cpp | 52 - .../CPP/webclient_uploaddata_headers.cpp | 62 - .../CPP/webclient_uploadfile.cpp | 56 - .../CPP/webclient_uploadfile2.cpp | 55 - .../CPP/webclient_uploadvalues.cpp | 68 - .../CPP/webclient_uploadvalues2.cpp | 68 - .../CPP/webexception_constructor1.cpp | 63 - .../CPP/webexception_constructor2.cpp | 62 - .../CPP/webexception_constructor3.cpp | 62 - .../CPP/webexception_constructor4.cpp | 64 - .../CPP/webexception_constructor5.cpp | 117 -- .../CPP/webexception_status_response.cpp | 40 - .../CPP/webheadercollection_add.cpp | 67 - .../CPP/webheadercollection_getvalues_1.cpp | 58 - .../CPP/webheadercollection_isrestricted.cpp | 49 - .../CPP/webheadercollection_remove.cpp | 79 - .../CPP/webheadercollection_set.cpp | 65 - .../CPP/source.cpp | 52 - .../webpermissionattribute_acceptconnect.cpp | 46 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 50 - .../CPP/source.cpp | 51 - .../CPP/source.cpp | 47 - .../CPP/webpermission_acceptconnectlist.cpp | 99 - .../CPP/webpermission_constructor4.cpp | 80 - .../CPP/webpermission_copy.cpp | 91 - .../CPP/webpermission_fromtoxml.cpp | 76 - .../CPP/webpermission_intersect.cpp | 104 - .../CPP/webpermission_issubset.cpp | 109 -- .../WebPermission_IsSubset2/CPP/source.cpp | 41 - .../WebPermission_Regex/CPP/regex.cpp | 50 - .../CPP/webpermission_union.cpp | 92 - .../CPP/webrequest_begingetrequest.cpp | 92 - .../CPP/webrequest_contenttype.cpp | 95 - .../CPP/webrequest_create.cpp | 60 - .../CPP/webrequest_headers.cpp | 44 - .../WebRequest_Proxy/CPP/webrequest_proxy.cpp | 108 -- .../CPP/webrequest_requesturi.cpp | 49 - .../CPP/webrequest_timeout.cpp | 66 - .../CPP/webresponse_close.cpp | 58 - .../CPP/webresponse_contentlength_type.cpp | 59 - .../CPP/webresponse_getresponsestream.cpp | 81 - .../CPP/webresponse_headers.cpp | 64 - .../CPP/webresponse_responseuri.cpp | 67 - .../CPP/import.cpp | 63 - .../CPP/httpbinding.cpp | 151 -- .../CPP/wellknownclienttypeentry_client.cpp | 43 - .../CPP/wellknownservicetypeentry_server.cpp | 41 - .../CPP/xmlAttributeAttribute_ctr1_2.cpp | 100 - .../CPP/xmlrootattribute_constructor.cpp | 76 - .../CPP/xmlrootattribute_elementname.cpp | 74 - .../CPP/xmltypeattribute1_2.cpp | 77 - .../CPP/source.cpp | 59 - .../CPP/anyattover.cpp | 58 - .../CPP/anyelement.cpp | 117 -- .../CPP/arrayitem.cpp | 107 -- .../CPP/xmlanyover.cpp | 71 - .../CPP/xmlns.cpp | 86 - .../CPP/choice.cpp | 131 -- .../CPP/person.cpp | 58 - .../CPP/reader.cpp | 19 - .../CPP/writer.cpp | 22 - .../CPP/unknownelement.cpp | 56 - .../xmlserializernamespaces_constructor.cpp | 79 - .../XmlTypeMapping Example/CPP/mapping.cpp | 67 - .../CPP/dnspermission_union_intersect.cpp | 97 - .../CPP/colorbuilderdesigner.cpp | 102 - .../CPP/controladapter.control.cpp | 29 - .../CPP/controladapter_browser.cpp | 30 - .../CPP/controladapter_oninit.cpp | 25 - .../CPP/webcustomcontrol1.cpp | 282 --- .../CPP/datasourcetypeconverterexamples.cpp | 114 -- .../CPP/htmltextwriter_addstyleattribute.cpp | 65 - .../HtmlTextWriter_Methods/CPP/htw.cpp | 116 -- .../HtmlTextWriter_Methods1/CPP/htw2.cpp | 73 - .../CPP/htmltextwriter_methods3.cpp | 126 -- .../CPP/htmltextwriter_methods4.cpp | 120 -- .../CPP/htmltextwriter_properties1.cpp | 81 - .../CPP/htmltextwriter.cpp | 59 - .../CPP/urlbuilderdesigner.cpp | 103 - .../CPP/accesssitemapprovider.cpp | 219 --- .../CPP/webcustomcontrol1.cpp | 175 -- .../ActiveDesignerEventArgs/CPP/class1.cpp | 15 - .../CPP/activedesignereventhandlerexample.cpp | 41 - .../AngleEditor/CPP/angleeditor.cpp | 335 ---- .../cpp/AppSettingsSample.cpp | 321 ---- .../Appearance/CPP/form1.cpp | 34 - .../Application/CPP/source.cpp | 249 --- .../ArrayEditorExample/CPP/class1.cpp | 41 - .../CPP/basicsplitcontainer.cpp | 179 -- .../CPP/canceledit.cpp | 161 -- .../CPP/bindingmanagerbase_removeat.cpp | 126 -- ...dingmanagerbase_suspend_resume_binding.cpp | 209 --- .../Binding_Editable/CPP/binding_editable.cpp | 412 ---- .../CPP/bindingscollectionthis.cpp | 39 - .../BitmapEditorExample/CPP/usercontrol1.cpp | 65 - .../CPP/bufferingtest.cpp | 176 -- .../CPP/bufferingexamples.cpp | 76 - .../ButtonState/CPP/buttonstate1.cpp | 49 - .../ByteViewerExample/CPP/form1.cpp | 149 -- .../CPP/toolboxcategorynamescontrol.cpp | 81 - .../CheckedListBox/CPP/source.cpp | 163 -- .../CPP/checkoutexceptionexample.cpp | 19 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 50 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 89 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 27 - .../CPP/Source.cpp | 38 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 74 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 39 - .../Classic Binding Example/CPP/source.cpp | 281 --- .../CPP/source.cpp | 34 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 83 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 81 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 172 -- .../Classic Clipboard Example/CPP/source.cpp | 51 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 91 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 99 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 65 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 18 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 58 - .../CPP/source.cpp | 74 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 51 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 79 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 29 - .../Classic DataGrid Example/CPP/source.cpp | 252 --- .../CPP/source.cpp | 24 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 50 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 64 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 53 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 44 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 73 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 75 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 50 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 70 - .../Classic DataObject Example/CPP/source.cpp | 55 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 43 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 55 - .../CPP/source.cpp | 57 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 51 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 100 - .../CPP/source.cpp | 29 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 68 - .../CPP/source.cpp | 65 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 33 - .../Classic FontDialog Example/CPP/source.cpp | 34 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 23 - .../CPP/source.cpp | 95 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 99 - .../CPP/source.cpp | 58 - .../CPP/source.cpp | 22 - .../CPP/source.cpp | 60 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 21 - .../CPP/source.cpp | 29 - .../Classic HScrollBar Example/CPP/source.cpp | 27 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 25 - .../Classic ImageList Example/CPP/source.cpp | 224 --- .../CPP/source.cpp | 45 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 52 - .../CPP/source2.cpp | 39 - .../Classic Label Example/CPP/source.cpp | 43 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 43 - .../Classic ListBox Example/CPP/source.cpp | 63 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 34 - .../Classic Margins Example/CPP/source.cpp | 65 - .../CPP/source.cpp | 68 - .../Classic Menu Example/CPP/source.cpp | 49 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 59 - .../CPP/source.cpp | 25 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 24 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 58 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 67 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 29 - .../Classic MessageBox Example/CPP/source.cpp | 29 - .../CPP/source.cpp | 84 - .../Classic OSFeature Example/CPP/source.cpp | 48 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 52 - .../CPP/source.cpp | 53 - .../Classic Panel Example/CPP/source.cpp | 42 - .../CPP/source.cpp | 26 - .../Classic PictureBox Example/CPP/source.cpp | 52 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 116 -- .../CPP/source.cpp | 39 - .../CPP/source.cpp | 87 - .../CPP/source.cpp | 111 -- .../CPP/source.cpp | 85 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 91 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 41 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 30 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 40 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 38 - .../CPP/source.cpp | 46 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 36 - .../CPP/source.cpp | 34 - .../CPP/source.cpp | 146 -- .../CPP/source.cpp | 36 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 56 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 71 - .../CPP/source.cpp | 73 - .../CPP/source.cpp | 39 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 33 - .../Classic TabControl Example/CPP/source.cpp | 139 -- .../CPP/source.cpp | 37 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 42 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 72 - .../CPP/source.cpp | 47 - .../CPP/source.cpp | 33 - .../CPP/source.cpp | 26 - .../CPP/source.cpp | 35 - .../CPP/source.cpp | 32 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 71 - .../Classic Timer Example 2/CPP/source.cpp | 67 - .../CPP/source.cpp | 37 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 28 - .../CPP/source.cpp | 70 - .../CPP/source.cpp | 27 - .../CPP/source.cpp | 31 - .../CPP/source.cpp | 54 - .../CPP/source.cpp | 69 - .../CPP/source.cpp | 37 - .../Classic UpDownBase Example/CPP/source.cpp | 106 -- .../CPP/source.cpp | 90 - .../CPP/source.cpp | 45 - .../CPP/source.cpp | 163 -- .../CPP/source.cpp | 219 --- .../Classic VScrollBar Example/CPP/source.cpp | 30 - .../ClearItems/CPP/clearitems.cpp | 112 -- .../CloneMenu/CPP/form1.cpp | 106 -- .../CPP/source.cpp | 21 - .../ComboBox/CPP/comboboxmembers.cpp | 138 -- .../ComboBox/CPP/comboboxtype.cpp | 140 -- .../CPP/componentchangedeventargsexample.cpp | 28 - .../componentchangedeventhandlerexample.cpp | 36 - .../CPP/componentchangingeventargsexample.cpp | 26 - .../componentchangingeventhandlerexample.cpp | 34 - .../CPP/examplecomponent.cpp | 62 - .../CPP/componenteventargsexample.cpp | 27 - .../CPP/componenteventhandlerexample.cpp | 46 - .../CPP/componentrenameeventargsexample.cpp | 29 - .../componentrenameeventhandlerexample.cpp | 38 - .../ContainsItems/CPP/containsitems.cpp | 55 - .../ContextStackExample/CPP/class1.cpp | 36 - .../Control.ControlRemoved/CPP/form1.cpp | 162 -- .../Control.DoubleClick/CPP/form1.cpp | 142 -- .../Control.Enter/CPP/form1.cpp | 128 -- .../Control.FindForm/CPP/form1.cpp | 126 -- .../Control.KeyDown/CPP/form1.cpp | 134 -- .../Control.KeyUp/CPP/form1.cpp | 113 -- .../Control.Layout/CPP/layout.cpp | 74 - .../Control.Move/CPP/form1.cpp | 86 - .../Control.Paint/CPP/form1.cpp | 109 -- .../Control.Validating/CPP/validating.cpp | 114 -- .../CPP/controlcollection.cpp | 223 --- .../CPP/controldesignerexample.cpp | 97 - .../CPP/controliskeylocked.cpp | 21 - .../CPP/control_begininvoke.cpp | 121 -- .../control_contextmenu_creategraphics.cpp | 157 -- .../Control_Font/CPP/control_font.cpp | 92 - .../Control_Invoke1/CPP/control_invoke1.cpp | 115 -- .../Control_Invoke2/CPP/control_invoke2.cpp | 109 -- .../Control_Scale1/CPP/control_scale1.cpp | 135 -- .../CPP/control_stylechanged.cpp | 98 - .../CPP/control_visiblechanged.cpp | 107 -- .../Converters/CPP/converters.cpp | 264 --- .../CountProperty/CPP/countitems.cpp | 45 - .../CreateParams/CPP/createparams.cpp | 199 -- .../CurrencyManager.List Example/CPP/list.cpp | 68 - .../CursorFromResource/CPP/mycursor.cpp | 153 -- .../CPP/dataformats_dif.cpp | 48 - .../CPP/dataformats_getformat.cpp | 26 - .../CPP/dataformats_stringformat.cpp | 46 - .../CPP/dataformats_unicodetext.cpp | 57 - .../CPP/overridemousedown.cpp | 133 -- .../CPP/boolcolumn.cpp | 252 --- .../CPP/datagridboolcolumn.cpp | 284 --- .../CPP/timecolumn.cpp | 292 --- .../datagridcolumnstyle_alignmentchanged.cpp | 123 -- .../datagridcolumnstyle_headertextchanged.cpp | 126 -- ...datagridcolumnstyle_mappingnamechanged.cpp | 135 -- .../datagridcolumnstyle_nulltextchanged.cpp | 132 -- .../CPP/propertydescriptorchanged.cpp | 128 -- .../datagridcolumnstyle_readonlychanged.cpp | 126 -- .../datagridcolumnstyle_resetheadertext.cpp | 116 -- .../CPP/datagridcolumnstyle_widthchanged.cpp | 229 --- .../CPP/bindarray.cpp | 284 --- .../CPP/datagridtablestyle_forecolor.cpp | 190 -- .../CPP/datagridtablestyle_header_4.cpp | 241 --- ...atagridtablestyle_preferredcolumnwidth.cpp | 220 --- .../datagridtablestyle_preferredrowheight.cpp | 141 -- .../CPP/preferredrowheightchanged.cpp | 152 -- .../datagridtablestyle_readonlychanged.cpp | 133 -- .../CPP/resetalternatingbackcolor.cpp | 117 -- .../CPP/datagridtablestyle_resetbackcolor.cpp | 123 -- .../CPP/datagridtablestyle_resetforecolor.cpp | 144 -- .../datagridtablestyle_resetgridlinecolor.cpp | 132 -- ...atagridtablestyle_resetheaderbackcolor.cpp | 133 -- .../datagridtablestyle_resetheaderfont1.cpp | 124 -- ...atagridtablestyle_resetheaderforecolor.cpp | 137 -- .../CPP/datagridtablestyle_resetlinkcolor.cpp | 288 --- .../CPP/rowheaderwidth.cpp | 217 --- .../CPP/rowheadersvisiblechanged.cpp | 186 -- .../CPP/datagridtablestyle_sample.cpp | 268 --- .../CPP/datagridtablestyle_sample2.cpp | 247 --- .../CPP/datagridtablestyle_sample3.cpp | 286 --- .../CPP/selectionbackcolor.cpp | 234 --- .../CPP/selectionforecolor.cpp | 237 --- .../CPP/datagridtablestyle_sample1.cpp | 256 --- .../CPP/datagridtablestyle_sample5.cpp | 257 --- .../CPP/datagridtextboxcolumn format.cpp | 34 - .../CPP/datagridtextboxcolumn_2.cpp | 147 -- ...datagridtextbox_isineditornavigatemode.cpp | 165 -- .../CPP/datagridtextbox_setdatagrid.cpp | 149 -- .../CPP/mydatagrid_allownavigationchanged.cpp | 213 --- .../CPP/mydatagrid_backgroundcolorchanged.cpp | 216 --- .../CPP/mydatagrid_captionvisiblechanged.cpp | 244 --- .../DataGrid_ColorMembers/CPP/datagrid_10.cpp | 731 -------- .../datagrid_parentrowslabelstylechanged.cpp | 197 -- .../datagrid_showparentdetailsbuttonclick.cpp | 156 -- .../CPP/datagrid_unselect.cpp | 145 -- .../CPP/calendarfont.cpp | 29 - .../CPP/calendarforecolor.cpp | 27 - .../CPP/calendarmonthbackground.cpp | 27 - .../DateTimePicker.Value/CPP/value.cpp | 31 - .../CPP/form1.cpp | 126 -- .../CPP/examplecomponent.cpp | 43 - .../CPP/designereventargsexample.cpp | 29 - .../CPP/designereventhandlerexample.cpp | 36 - .../DesignerHostAcquisition/CPP/source.cpp | 29 - .../CPP/source.cpp | 41 - .../DesignerTransaction Sample/CPP/source.cpp | 196 -- ...signertransactioncloseeventargsexample.cpp | 31 - ...nertransactioncloseeventhandlerexample.cpp | 42 - .../DesignerVerb Example/CPP/component1.cpp | 65 - .../CPP/class1.cpp | 85 - .../DisplayRectangle1/CPP/form1.cpp | 48 - .../DlgOpenFileReadOnly/CPP/form1.cpp | 112 -- .../DrawItem/CPP/drawitem.cpp | 62 - .../DrawMode/CPP/drawmode.cpp | 51 - .../EditorAttributesExample/CPP/class1.cpp | 132 -- .../CPP/ctleditorbrowsable.cpp | 41 - .../EventDescriptor/CPP/eventdescriptor.cpp | 117 -- .../EventsTabExample/CPP/class1.cpp | 106 -- .../CPP/extenderlistserviceexample.cpp | 72 - .../CPP/extenderservicedesigner.cpp | 101 - .../FontDialog.ShowApply/CPP/form1.cpp | 131 -- .../Form.AddOwnedForm/CPP/form1.cpp | 132 -- .../Form.AutoScroll/CPP/form1.cpp | 127 -- .../Form.Closing/CPP/form1.cpp | 122 -- .../Form.MDIChildren/CPP/form1.cpp | 144 -- .../Form.MDIParent/CPP/form1.cpp | 122 -- .../Form.Modal/CPP/form1.cpp | 123 -- .../Form.Opacity/CPP/form1.cpp | 121 -- .../Form.OwnedForms/CPP/form1.cpp | 140 -- .../Form.ShowInTaskbar/CPP/form1.cpp | 114 -- .../Form.SizeGripStyle/CPP/form1.cpp | 115 -- .../Form.TopMost/CPP/form1.cpp | 125 -- .../FormBorderStyle/CPP/form1.cpp | 41 - .../CPP/formstartposition.cpp | 44 - .../FormWindowState/CPP/formwindowstate.cpp | 41 - .../GetContextMenu2/CPP/form1.cpp | 135 -- .../GetData1/CPP/getdata1.cpp | 119 -- .../GetData2/CPP/getdata2.cpp | 109 -- .../GetData3/CPP/getdata3.cpp | 113 -- .../GetDataPresent1/CPP/getdatapresent1.cpp | 85 - .../GetDataPresent2/CPP/getdatapresent2.cpp | 130 -- .../GetDataPresent3/CPP/getdatapresent3.cpp | 110 -- .../GetFormats1/CPP/getformats1.cpp | 38 - .../GetFormats2/CPP/getformats2.cpp | 47 - .../GetMainMenu/CPP/form1.cpp | 130 -- .../GetTabPageOfComponent/CPP/form1.cpp | 62 - .../GetTabRect/CPP/gettabrect.cpp | 51 - .../gridcolumnstylescollection_members.cpp | 307 --- .../gridcolumnstylescollection_removeat.cpp | 216 --- .../CPP/resetpropertydescriptor.cpp | 148 -- .../CPP/gridtablestylescollectionexamples.cpp | 162 -- .../CPP/fontdialogoverride.cpp | 66 - .../HorizontalAlignment/CPP/form1.cpp | 109 -- .../HotTrack/CPP/form1.cpp | 50 - .../HtmlElementEventHandler/CPP/form1.cpp | 121 -- .../CPP/mybutton.cpp | 61 - .../CPP/icomponentchangeserviceexample.cpp | 173 -- .../CPP/mycontainercontrol.cpp | 61 - .../CPP/source.cpp | 143 -- .../IDesignerExample/CPP/testcontrol.cpp | 93 - .../CPP/idesignerhostexample.cpp | 151 -- .../CPP/idesigneroptionservicecontrol.cpp | 95 - .../idesignerserializationmanagersample.cpp | 88 - .../IDictionaryServiceExample/CPP/source.cpp | 143 -- .../CPP/source.cpp | 117 -- .../IHelpServiceExample/CPP/source.cpp | 68 - .../CPP/class1.cpp | 102 - .../CPP/ireferenceserviceexample.cpp | 176 -- .../IResourceServiceExample/CPP/source.cpp | 138 -- .../IRootDesigner Sample/CPP/class1.cpp | 124 -- .../CPP/csiselectionserviceexample.cpp | 139 -- .../CPP/selectioncomponent.cpp | 141 -- .../CPP/serviceform.cpp | 580 ------ .../CPP/itoolboxservicecontrol.cpp | 239 --- .../IToolboxUserExample/CPP/samplecontrol.cpp | 178 -- .../CPP/source.cpp | 372 ---- .../CPP/ityperesolutionservicecontrol.cpp | 373 ---- .../IUIServiceExample/CPP/class1.cpp | 124 -- .../IndexOf/CPP/indexof.cpp | 56 - .../InputLanguageChanged/CPP/form1.cpp | 49 - .../CPP/instancedescriptor.cpp | 154 -- .../IsParent/CPP/form1.cpp | 112 -- .../ItemSize/CPP/form1.cpp | 44 - .../KeyEventArgs.Modifiers/CPP/form1.cpp | 120 -- .../KeyPressEventArgs/CPP/form1.cpp | 36 - .../Label_Image/CPP/form1.cpp | 99 - .../LayoutEventArgs/CPP/form1.cpp | 149 -- .../LicenseException/CPP/licenseex.cpp | 99 - .../LinkLabel Overview/CPP/linklabelex.cpp | 111 -- .../ListBox.FindString/CPP/form1.cpp | 162 -- .../ListBox.FindString2/CPP/form1.cpp | 131 -- .../ListBox.FindStringExact/CPP/form1.cpp | 129 -- .../ListBox.FindStringExact2/CPP/form1.cpp | 158 -- .../ListBox.GetSelected/CPP/form1.cpp | 158 -- .../ListBox.PreferredHeight/CPP/form1.cpp | 121 -- .../ListBox.SelectedIndex/CPP/form1.cpp | 133 -- .../CPP/form1.cpp | 125 -- .../ListBox.UseTabStops/CPP/form1.cpp | 113 -- .../ListControl/CPP/form1.cpp | 104 - .../ListView.AfterLabelEdit/CPP/form1.cpp | 144 -- .../CPP/listviewsort1.cpp | 121 -- .../ListView.HorizontalExtent/CPP/form1.cpp | 138 -- .../ListViewExample/CPP/form1.cpp | 177 -- .../CPP/class1.cpp | 205 -- .../MeasureItemEventArgs/CPP/form1.cpp | 134 -- .../MenuCommand Example/CPP/component1.cpp | 38 - .../MenuItem.Popup/CPP/form1.cpp | 177 -- .../MenuItem.Select/CPP/form1.cpp | 180 -- .../MenuItemClick/CPP/form1.cpp | 118 -- .../MergeMenu/CPP/form1.cpp | 111 -- .../MessageBox.Show Variations/CPP/form1.cpp | 233 --- .../MonthCalendar/CPP/mc.cpp | 487 ----- .../MoreEventArgsExamples/CPP/class1.cpp | 59 - .../MoreEventHandlerExamples/CPP/form1.cpp | 105 -- .../Multiline/CPP/form1.cpp | 56 - .../CPP/mydatagridclass_flatmode_readonly.cpp | 213 --- .../mydatagridclass_resetheaderbackcolor.cpp | 385 ---- .../NativeWindow/CPP/form1.cpp | 165 -- .../OwnerDraw example/CPP/form1.cpp | 163 -- .../Padding/CPP/form1.cpp | 50 - .../CPP/source.cpp | 338 ---- .../ParentForm2/CPP/form1.cpp | 117 -- .../ParentForm2/CPP/form2.cpp | 91 - .../ParentMenu/CPP/form1.cpp | 106 -- .../PerformClick/CPP/form1.cpp | 116 -- .../PerformSelect/CPP/form1.cpp | 116 -- .../CPP/powerstatusbrowser.cpp | 92 - .../ProgressBar.Increment/CPP/form1.cpp | 168 -- .../ProgressBarOverview/CPP/form1.cpp | 151 -- .../CPP/propertydescriptor.cpp | 121 -- .../PropertyTabExample/CPP/class1.cpp | 90 - .../RefreshEventHandler/CPP/refreshevent.cpp | 137 -- .../RemoveAt/CPP/removeat.cpp | 49 - .../RemoveMenuItems/CPP/removeitems.cpp | 116 -- .../RichTextBox.AllowDrop/CPP/form1.cpp | 140 -- .../RichTextBox.BulletIndent/CPP/form1.cpp | 157 -- .../RichTextBox.FindChar1/CPP/form1.cpp | 136 -- .../RichTextBox.FindChar2/CPP/form1.cpp | 138 -- .../CPP/form1.cpp | 139 -- .../RichTextBox.GetCharAtIndex/CPP/form1.cpp | 112 -- .../CPP/form1.cpp | 118 -- .../RichTextBox.MaxLength/CPP/form1.cpp | 124 -- .../RichTextBox.RedoAction/CPP/form1.cpp | 127 -- .../CPP/form1.cpp | 129 -- .../RichTextBox.SelectionBullet/CPP/form1.cpp | 152 -- .../CPP/form1.cpp | 151 -- .../CPP/form1.cpp | 130 -- .../RichTextBox.SelectionIndent/CPP/form1.cpp | 130 -- .../RichTextBox.SelectionLength/CPP/form1.cpp | 131 -- .../CPP/form1.cpp | 133 -- .../CPP/form1.cpp | 134 -- .../RichTextBox.ZoomFactor/CPP/form1.cpp | 129 -- .../RichTextDragDrop/CPP/form1.cpp | 146 -- .../RichText_Paste/CPP/form1.cpp | 124 -- .../RowCount/CPP/form1.cpp | 50 - .../Screen Object Example/CPP/form1.cpp | 130 -- .../Screen.FromPoint/CPP/form1.cpp | 104 - .../SelectedIndex/CPP/form1.cpp | 52 - .../SelectedTab/CPP/form1.cpp | 50 - .../CPP/serviceform.cpp | 421 ----- .../ServiceContainerExample/CPP/form1.cpp | 232 --- .../SetData1/CPP/setdata1.cpp | 56 - .../SetData2/CPP/setdata2.cpp | 43 - .../SetData3/CPP/setdata3.cpp | 58 - .../SetData4/CPP/form1.cpp | 111 -- .../SizeMode/CPP/form1.cpp | 45 - .../CPP/splitcontainerevents.cpp | 90 - .../Splitter Example/CPP/form1.cpp | 112 -- .../CPP/form1.cpp | 144 -- .../StatusBar.DrawItem/CPP/form1.cpp | 148 -- .../CPP/fibonacciform.cpp | 310 --- .../CPP/form1.cpp | 263 --- .../cpp/form1.cpp | 112 -- .../CPP/form1.cpp | 197 -- .../CPP/form1.cpp | 297 --- .../CPP/form1.cpp | 568 ------ .../CPP/form1.cpp | 192 -- .../CPP/form1.cpp | 276 --- .../CPP/form1.cpp | 224 --- .../CPP/form1.cpp | 1666 ----------------- .../CPP/form1.cpp | 1292 ------------- .../CPP/form1.cpp | 1410 -------------- .../cpp/form1.cpp | 83 - .../CPP/form1.cpp | 300 --- .../CPP/form1.cpp | 55 - .../CPP/form1.cpp | 55 - .../CPP/form1.cpp | 65 - .../CPP/form1.cpp | 273 --- .../CPP/form1.cpp | 133 -- .../CPP/form1.cpp | 147 -- .../CPP/form1.cpp | 401 ---- .../CPP/form1.cpp | 273 --- .../CPP/form1.cpp | 240 --- .../CPP/form1.cpp | 74 - .../System.Drawing.Converters/CPP/form1.cpp | 122 -- .../CPP/form1.cpp | 753 -------- .../CPP/form1.cpp | 569 ------ .../CPP/form1.cpp | 276 --- .../CPP/form1.cpp | 393 ---- .../CPP/form1.cpp | 145 -- .../CPP/form1.cpp | 256 --- .../System.Drawing.FontsExample/cpp/form1.cpp | 203 -- .../CPP/form1.cpp | 237 --- .../System.Drawing.ImageExample/CPP/form1.cpp | 381 ---- .../CPP/form1.cpp | 57 - .../cpp/form1.cpp | 146 -- .../System.Drawing.Misc2/CPP/form1.cpp | 295 --- .../System.Drawing.MiscExamples/CPP/form1.cpp | 489 ----- .../System.Drawing.PensExample/CPP/form1.cpp | 169 -- .../CPP/form1.cpp | 268 --- .../CPP/form1.cpp | 275 --- .../cpp/usercontrol1.cpp | 270 --- .../CPP/chartcontrol.cpp | 599 ------ .../CPP/form1.cpp | 46 - .../cpp/form1.cpp | 201 -- .../cpp/form1.cpp | 155 -- .../CPP/form1.cpp | 166 -- .../CPP/form1.cpp | 100 - .../CPP/form1.cpp | 87 - .../CPP/form1.cpp | 153 -- .../CPP/form1.cpp | 146 -- .../cpp/form1.cpp | 172 -- .../CPP/form1.cpp | 127 -- .../CPP/form1.cpp | 319 ---- .../CPP/form1.cpp | 168 -- .../CPP/form1.cpp | 81 - .../CPP/form1.cpp | 80 - .../CPP/form1.cpp | 103 - .../CPP/form1.cpp | 146 -- .../CPP/form1.cpp | 71 - .../CPP/form1.cpp | 152 -- .../CPP/form1.cpp | 98 - .../CPP/cursorstuff.cpp | 135 -- .../CPP/cursorexample.cpp | 120 -- .../CPP/form1.cpp | 181 -- .../CPP/form1.cpp | 253 --- .../CPP/form1.cpp | 169 -- .../CPP/form1.cpp | 178 -- .../CPP/form1.cpp | 215 --- .../cpp/form1.cpp | 120 -- .../CPP/autosizing.cpp | 303 --- .../CPP/DataGridViewBandDemo.cpp | 328 ---- .../CPP/DataGridViewColumnDemo.cpp | 441 ----- .../CPP/DataGridViewRowDemo.cpp | 304 --- .../CPP/tictactoe.cpp | 480 ----- .../CPP/mousesizing.cpp | 311 --- .../CPP/programmaticsizing.cpp | 281 --- .../CPP/datagridviewrowtemplate.cpp | 48 - .../CPP/virtualmode.cpp | 355 ---- .../CPP/virtual.cpp | 174 -- .../cpp/datagridviewcell.tooltiptext.cpp | 89 - .../CPP/employees.cpp | 479 ----- .../cpp/trivaluevirtualcheckbox.cpp | 96 - .../CPP/sharedrows.cpp | 210 --- .../CPP/form1.cpp | 118 -- .../cpp/Form1.cpp | 227 --- .../CPP/errorproviderexample.cpp | 215 --- .../CPP/filedialogform.cpp | 203 -- .../cpp/form1.cpp | 243 --- .../CPP/form1.cpp | 167 -- .../CPP/form1.cpp | 164 -- .../CPP/form1.cpp | 137 -- .../CPP/form1.cpp | 151 -- .../CPP/form1.cpp | 214 --- .../CPP/form1.cpp | 165 -- .../CPP/form1.cpp | 364 ---- .../CPP/form1.cpp | 136 -- .../cpp/form1.cpp | 130 -- .../CPP/helpsnippet.cpp | 158 -- .../CPP/helpevent.cpp | 117 -- .../CPP/form1.cpp | 128 -- .../CPP/helpprovider.cpp | 121 -- .../CPP/form1.cpp | 150 -- .../CPP/form1.cpp | 211 --- .../CPP/form1.cpp | 85 - .../cpp/DemoFlowLayout.cpp | 134 -- .../CPP/linklabel.cpp | 100 - .../CPP/form1.cpp | 138 -- .../CPP/form1.cpp | 152 -- .../CPP/form1.cpp | 105 -- .../CPP/listviewgroupsexample.cpp | 258 --- .../CPP/listviewinsertionmarkexample.cpp | 160 -- .../CPP/listviewtilingexample.cpp | 88 - .../CPP/form1.cpp | 153 -- .../CPP/form1.cpp | 170 -- .../CPP/form1.cpp | 81 - .../CPP/form1.cpp | 106 -- .../CPP/form1.cpp | 167 -- .../cpp/form1.cpp | 188 -- .../CPP/form1.cpp | 103 - .../CPP/form1.cpp | 115 -- .../CPP/form1.cpp | 92 - .../CPP/form1.cpp | 141 -- .../CPP/form1.cpp | 112 -- .../CPP/form1.cpp | 233 --- .../CPP/monthcalendar.cpp | 115 -- .../CPP/form1.cpp | 53 - .../CPP/mouseeventexample.cpp | 268 --- .../CPP/source.cpp | 95 - .../CPP/form1.cpp | 98 - .../CPP/form1.cpp | 103 - .../CPP/form1.cpp | 124 -- .../system.windows.forms.sound.playasync.cpp | 103 - .../CPP/form1.cpp | 140 -- .../CPP/form1.cpp | 124 -- .../CPP/form1.cpp | 103 - .../cpp/form1.cpp | 227 --- .../CPP/form1.cpp | 144 -- .../cpp/form1.cpp | 161 -- .../CPP/form1.cpp | 170 -- .../CPP/form1.cpp | 160 -- .../CPP/form1.cpp | 129 -- .../CPP/form1.cpp | 95 - .../cpp/form1.cpp | 421 ----- .../CPP/form1.cpp | 127 -- .../CPP/selectionrangeobj.cpp | 173 -- .../CPP/form1.cpp | 110 -- .../CPP/soundtestform.cpp | 414 ---- .../CPP/form1.cpp | 144 -- .../CPP/form1.cpp | 148 -- .../CPP/form1.cpp | 119 -- .../cpp/form1.cpp | 156 -- .../CPP/form1.cpp | 137 -- .../cpp/form1.cpp | 132 -- .../CPP/form1.cpp | 151 -- .../CPP/form1.cpp | 469 ----- .../CPP/form1.cpp | 332 ---- .../CPP/form1.cpp | 155 -- .../CPP/source.cpp | 73 - .../CPP/form1.cpp | 128 -- .../cpp/form1.cpp | 234 --- .../CPP/form1.cpp | 241 --- .../CPP/form1.cpp | 133 -- .../cpp/Form1.cpp | 267 --- .../cpp/form1.cpp | 384 ---- .../cpp/form1.cpp | 73 - .../cpp/form1.cpp | 438 ----- .../cpp/visualstylestate.cpp | 96 - .../CPP/form1.cpp | 502 ----- .../SystemEvents/cpp/SystemEvents.cpp | 57 - .../CPP/sysinfobrowser.cpp | 114 -- .../SystemSoundsExample/CPP/form1.cpp | 82 - .../TabAlignment/CPP/form1.cpp | 54 - .../TabControl.ImageList/CPP/form1.cpp | 48 - .../TabControl_constructor/CPP/form1.cpp | 42 - .../TabCount/CPP/form1.cpp | 48 - .../TabPage.ImageIndex/CPP/form1.cpp | 44 - .../TabPage.ToString/CPP/form1.cpp | 46 - .../TabPage/CPP/form1.cpp | 46 - .../TabPageCollection.Add/CPP/form1.cpp | 38 - .../TabPageCollection.AddRange/CPP/form1.cpp | 43 - .../TabPageCollection.Clear/CPP/form1.cpp | 48 - .../TabPageCollection.Contains/CPP/form1.cpp | 49 - .../TabPageCollection.Count/CPP/form1.cpp | 49 - .../TabPageCollection.IndexOf/CPP/form1.cpp | 40 - .../CPP/form1.cpp | 44 - .../TabPageCollection.Remove/CPP/form1.cpp | 47 - .../TabPageCollection.RemoveAt/CPP/form1.cpp | 52 - .../TabPageControlCollection.Add/CPP/add.cpp | 43 - .../TabPage_constructor/CPP/form1.cpp | 38 - .../TabPage_withText/CPP/form1.cpp | 43 - .../TabText/CPP/form1.cpp | 45 - .../TextBoxBase.AppendText/CPP/form1.cpp | 141 -- .../ToolBar/CPP/mytoolbar.cpp | 226 --- .../ToolTip Example/CPP/form1.cpp | 110 -- .../ToolTipText/CPP/form1.cpp | 51 - .../CPP/textdatatextboxcomponent.cpp | 168 -- .../CPP/class1.cpp | 54 - .../Trackbar/CPP/form1.cpp | 197 -- .../CPP/treenodecollection.cpp | 176 -- .../CPP/treenodecollection_clear.cpp | 231 --- ...enodecollection_contains_getenumerator.cpp | 127 -- .../CPP/treenodecollection_count_copyto.cpp | 125 -- .../TreeNode_Bounds/CPP/treenode_bounds.cpp | 254 --- .../TreeNode_Checked/CPP/treenode_checked.cpp | 189 -- .../CPP/treenode_ensurevisible_4.cpp | 222 --- .../CPP/treenode_forecolor.cpp | 291 --- .../TreeNode_Parent/CPP/treenode_parent.cpp | 304 --- .../CPP/treenode_treenode.cpp | 188 -- .../CPP/tn_checked.cpp | 136 -- .../TreeView/CPP/treeview.cpp | 213 --- .../CPP/treeviewcustomization.cpp | 89 - .../TreeViewDragDrop/CPP/treeviewdragdrop.cpp | 156 -- .../CPP/treeviewownerdraw.cpp | 175 -- .../CPP/treeviewshowcheckednodes1.cpp | 126 -- .../CPP/treeviewshowcheckednodes2.cpp | 127 -- .../WarningException/CPP/warningex_doc.cpp | 25 - .../Win32Exception/CPP/win32exception.cpp | 45 - .../WinForms.Control.Resize/CPP/form1.cpp | 69 - .../winformsedserviceeditordialogexample.cpp | 150 -- ...winformsedserviceeditordropdownexample.cpp | 159 -- .../CPP/controlmembers5.cpp | 161 -- .../CPP/controlmembers2.cpp | 289 --- .../CPP/controlmembers4.cpp | 213 --- .../CPP/controlproperties.cpp | 170 -- .../CPP/misccontrolproperties.cpp | 212 --- .../CPP/aboutdialog.cpp | 91 - .../CPP/controlsizelocation.cpp | 125 -- .../CPP/controlaccessibility.cpp | 152 -- .../CPP/imagedrag.cpp | 147 -- .../CPP/controlmembers6.cpp | 225 --- .../CPP/controlmethods.cpp | 99 - .../CPP/onpropertychangedevents.cpp | 114 -- .../CPP/propertychangedevents.cpp | 99 - .../CPP/scrollablecontrol.cpp | 102 - .../Windows.Forms.TreeNode/CPP/treenode.cpp | 148 -- .../enumException/CPP/enumexception.cpp | 101 - .../BitMapMetadata/CPP/BitmapMetadata.cpp | 92 - .../BitMapMetadata/CPP/bitmapmetadata.vcxproj | 123 -- .../BitMapMetadata/CPP/smiley.png | Bin 4599 -> 0 bytes .../BmpBitmapDecoderEncoder/CPP/BitmapFrame.h | 46 - .../CPP/anotherfile.cpp | 134 -- .../CPP/anotherproject.vcxproj | 97 - .../CPP/anotherproject.vcxproj.filters | 32 - .../BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp | Bin 921654 -> 0 bytes .../CanvasZ-Order/CPP/CanvasZ-Order.cpp | 131 -- .../CanvasZ-Order/CPP/canvasz-order.vcxproj | 117 -- .../CPP/Program.cpp | 345 ---- .../CPP/diagnoseproblematicprintjob.vcxproj | 131 -- .../CPP/DockPanel_Ovw_Sample.cpp | 123 -- .../CPP/dockpanel_ovw_sample.vcxproj | 123 -- .../CPP/Program.cpp | 44 - .../CPP/enumeratesubsetofprintqueues.vcxproj | 131 -- .../CPP/GifEncoderDecoder.cpp | 133 -- .../CPP/gifencoderdecoder.vcxproj | 126 -- .../GifBitmapDecoderEncoder/CPP/tulipfarm.gif | Bin 170770 -> 0 bytes .../CPP/jpegencoderdecoder.cpp | 133 -- .../CPP/jpegencoderdecoder.vcxproj | 129 -- .../CPP/tulipfarm.jpg | Bin 110238 -> 0 bytes .../LayoutTransform/CPP/LayoutTransform.cpp | 195 -- .../CPP/layouttransform.vcxproj | 123 -- .../CPP/Margin_Padding_Alignment_Sample.cpp | 220 --- .../margin_padding_alignment_sample.vcxproj | 123 -- .../PlotPanel/CPP/PlotPanel.cpp | 101 - .../PlotPanel/CPP/plotpanel.vcxproj | 123 -- .../CPP/PngEncoderDecoder.cpp | 130 -- .../CPP/pngencoderdecoder.vcxproj | 126 -- .../PngBitmapDecoderEncoder/CPP/smiley.png | Bin 4599 -> 0 bytes .../PrinterStatusSurvey/CPP/Program.cpp | 213 --- .../CPP/printerstatussurvey.vcxproj | 127 -- .../ScrollViewer/CPP/ScrollViewer_wcp.cpp | 86 - .../ScrollViewer/CPP/scrollviewer_cpp.vcxproj | 118 -- .../ShapesProcedural/CPP/ShapesProcedural.cpp | 264 --- .../CPP/shapesprocedural.vcxproj | 123 -- .../CPP/StackPanel_Ovw_Sample4.cpp | 141 -- .../StackPanelOvw4/CPP/smiley_stackpanel.PNG | Bin 4599 -> 0 bytes .../CPP/stackpanel_ovw_sample4.vcxproj | 123 -- .../CPP/TiffEncoderDecoder.cpp | 130 -- .../CPP/tiffencoderdecoder.vcxproj | 126 -- .../CPP/tulipfarm.tif | Bin 697320 -> 0 bytes .../ViewBoxCode/CPP/ViewboxCode.cpp | 107 -- .../ViewBoxCode/CPP/viewboxcode.vcxproj | 123 -- .../CPP/WDPEncoderDecoder.cpp | 142 -- .../WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg | Bin 110238 -> 0 bytes .../WdpBitmapDecoderEncoder/CPP/tulipfarm.wdp | Bin 124413 -> 0 bytes .../CPP/wdpencoderdecoder.vcxproj | 126 -- .../WrapPanel_Intro/CPP/WrapPanel_Code.cpp | 92 - .../CPP/wrappanel_code_cpp.vcxproj | 124 -- .../XpsCreate/CPP/XpsCreate.cpp | 459 ----- .../VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf | Bin 367112 -> 0 bytes .../VS_Snippets_Wpf/XpsCreate/CPP/courier.ttf | Bin 303296 -> 0 bytes .../VS_Snippets_Wpf/XpsCreate/CPP/image.tif | Bin 72782 -> 0 bytes .../VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg | Bin 18216 -> 0 bytes .../XpsCreate/CPP/xpscreate.vcxproj | 131 -- .../CPP/InteractiveExample.cpp | 125 -- .../CPP/LocalAnimationExample.cpp | 72 - .../CPP/animagionproperty_cpp.vcxproj | 135 -- .../animateproperty/CPP/app.cpp | 99 - 3927 files changed, 320122 deletions(-) delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp delete mode 100644 snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp delete mode 100644 snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/smiley.png delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/BitmapFrame.h delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters delete mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/CanvasZ-Order.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/tulipfarm.gif delete mode 100644 snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/tulipfarm.jpg delete mode 100644 snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/LayoutTransform.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/smiley.png delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/Program.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/smiley_stackpanel.PNG delete mode 100644 snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/stackpanel_ovw_sample4.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tulipfarm.tif delete mode 100644 snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/ViewboxCode.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg delete mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.wdp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf delete mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/courier.ttf delete mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/image.tif delete mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg delete mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp delete mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj delete mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp b/snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp deleted file mode 100644 index edf32009f79..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -using namespace System; - -int main() -{ - AppDomain^ root = AppDomain::CurrentDomain; - - AppDomainSetup^ setup = gcnew AppDomainSetup(); - setup->ApplicationBase = - root->SetupInformation->ApplicationBase + "MyAppSubfolder\\"; - - AppDomain^ domain = AppDomain::CreateDomain("MyDomain", nullptr, setup); - - Console::WriteLine("Application base of {0}:\r\n\t{1}", - root->FriendlyName, root->SetupInformation->ApplicationBase); - Console::WriteLine("Application base of {0}:\r\n\t{1}", - domain->FriendlyName, domain->SetupInformation->ApplicationBase); - - AppDomain::Unload(domain); -} - -/* This example produces output similar to the following: - -Application base of MyApp.exe: - C:\Program Files\MyApp\ -Application base of MyDomain: - C:\Program Files\MyApp\MyAppSubfolder\ - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp b/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp deleted file mode 100644 index 2da48b17c60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; - -//for evidence Object -int main() -{ - - //Create evidence for new appdomain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - //Create the new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence ); - - //Display the current relative search path. - Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath ); - - //Append the relative path. - String^ Newpath = "www.code.microsoft.com"; - domain->AppendPrivatePath( Newpath ); - - //Display the new relative search path. - Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath ); - - //Clear the private search path. - domain->ClearPrivatePath(); - - //Display the new relative search path. - Console::WriteLine( "Relative search path is now: {0}", domain->RelativeSearchPath ); - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp b/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp deleted file mode 100644 index 163e81b104a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class Example : MarshalByRefObject -{ -public: - void Test() - { - Assembly^ dynAssem = Assembly::Load( - "DynamicHelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); - - Type^ myType = dynAssem->GetType("HelloWorld"); - myType->InvokeMember("HelloFromAD", BindingFlags::Public | - BindingFlags::Static | BindingFlags::InvokeMethod, - Type::DefaultBinder, nullptr, nullptr); - } -}; - - -static void GenerateDynamicAssembly(String^ location) -{ - // Define the dynamic assembly and the module. There is only one - // module in this assembly. Note that the call to DefineDynamicAssembly - // specifies the location where the assembly will be saved. The - // assembly version is 1.0.0.0. - // - AssemblyName^ asmName = gcnew AssemblyName("DynamicHelloWorld"); - asmName->Version = gcnew Version("1.0.0.0"); - - AssemblyBuilder^ ab = - AppDomain::CurrentDomain->DefineDynamicAssembly( - asmName, AssemblyBuilderAccess::Save, location); - - String^ moduleName = asmName->Name + ".exe"; - ModuleBuilder^ mb = ab->DefineDynamicModule(asmName->Name, moduleName); - - // Define the "HelloWorld" type, with one static method. - TypeBuilder^ tb = mb->DefineType("HelloWorld", TypeAttributes::Public); - MethodBuilder^ hello = tb->DefineMethod("HelloFromAD", - MethodAttributes::Public | MethodAttributes::Static, nullptr, nullptr); - - // The method displays a message that contains the name of the application - // domain where the method is executed. - ILGenerator^ il = hello->GetILGenerator(); - il->Emit(OpCodes::Ldstr, "Hello from '{0}'!"); - il->Emit(OpCodes::Call, AppDomain::typeid->GetProperty("CurrentDomain")->GetGetMethod()); - il->Emit(OpCodes::Call, AppDomain::typeid->GetProperty("FriendlyName")->GetGetMethod()); - il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine", - gcnew array { String::typeid, String::typeid })); - il->Emit(OpCodes::Ret); - - // Complete the HelloWorld type and save the assembly. The assembly - // is placed in the location specified by DefineDynamicAssembly. - Type^ myType = tb->CreateType(); - ab->Save(moduleName); -}; - -void main() -{ - // Prepare to create a new application domain. - AppDomainSetup^ setup = gcnew AppDomainSetup(); - - // Set the application name before setting the dynamic base. - setup->ApplicationName = "Example"; - - // Set the location of the base directory where assembly resolution - // probes for dynamic assemblies. Note that the hash code of the - // application name is concatenated to the base directory name you - // supply. - setup->DynamicBase = "C:\\DynamicAssemblyDir"; - Console::WriteLine("DynamicBase is set to '{0}'.", setup->DynamicBase); - - AppDomain^ ad = AppDomain::CreateDomain("MyDomain", nullptr, setup); - - // The dynamic directory name is the dynamic base concatenated with - // the application name: \\ - String^ dynamicDir = ad->DynamicDirectory; - Console::WriteLine("Dynamic directory is '{0}'.", dynamicDir); - - // The AssemblyBuilder won't create this directory automatically. - if (!System::IO::Directory::Exists(dynamicDir)) - { - Console::WriteLine("Creating the dynamic directory."); - System::IO::Directory::CreateDirectory(dynamicDir); - } - - // Generate a dynamic assembly and store it in the dynamic - // directory. - GenerateDynamicAssembly(dynamicDir); - - // Create an instance of the Example class in the application domain, - // and call its Test method to load the dynamic assembly and use it. - Example^ ex = (Example^) ad->CreateInstanceAndUnwrap( - Example::typeid->Assembly->FullName, "Example"); - ex->Test(); -} - -/* This example produces output similar to the following: - -DynamicBase is set to 'C:\DynamicAssemblyDir\5e4a7545'. -Dynamic directory is 'C:\DynamicAssemblyDir\5e4a7545\Example'. -Creating the dynamic directory. -Hello from 'MyDomain'! - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp b/snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp deleted file mode 100644 index 501cca2a2d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp +++ /dev/null @@ -1,126 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::Remoting; - -ref class ADDyno -{ -public: - static Type^ CreateADynamicAssembly( interior_ptr myNewDomain, String^ executableNameNoExe ) - { - String^ executableName = String::Concat( executableNameNoExe, ".exe" ); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = executableNameNoExe; - myAsmName->CodeBase = Environment::CurrentDirectory; - AssemblyBuilder^ myAsmBuilder = ( *myNewDomain)->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - Console::WriteLine( "-- Dynamic Assembly instantiated." ); - ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( executableNameNoExe, executableName ); - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( executableNameNoExe, TypeAttributes::Public, MarshalByRefObject::typeid ); - array^temp0 = nullptr; - MethodBuilder^ myFCMethod = myTypeBuilder->DefineMethod( "CountLocalFiles", static_cast(MethodAttributes::Public | MethodAttributes::Static), nullptr, temp0 ); - MethodInfo^ currentDirGetMI = Environment::typeid->GetProperty( "CurrentDirectory" )->GetGetMethod(); - array^temp1 = {String::typeid}; - MethodInfo^ writeLine0objMI = Console::typeid->GetMethod( "WriteLine", temp1 ); - array^temp2 = {String::typeid,Object::typeid,Object::typeid}; - MethodInfo^ writeLine2objMI = Console::typeid->GetMethod( "WriteLine", temp2 ); - array^temp3 = {String::typeid}; - MethodInfo^ getFilesMI = Directory::typeid->GetMethod( "GetFiles", temp3 ); - myFCMethod->InitLocals = true; - ILGenerator^ myFCIL = myFCMethod->GetILGenerator(); - Console::WriteLine( "-- Generating MSIL method body..." ); - LocalBuilder^ v0 = myFCIL->DeclareLocal( String::typeid ); - LocalBuilder^ v1 = myFCIL->DeclareLocal( int::typeid ); - LocalBuilder^ v2 = myFCIL->DeclareLocal( String::typeid ); - LocalBuilder^ v3 = myFCIL->DeclareLocal( array::typeid ); - Label evalForEachLabel = myFCIL->DefineLabel(); - Label topOfForEachLabel = myFCIL->DefineLabel(); - - // Build the method body. - myFCIL->EmitCall( OpCodes::Call, currentDirGetMI, nullptr ); - myFCIL->Emit( OpCodes::Stloc_S, v0 ); - myFCIL->Emit( OpCodes::Ldc_I4_0 ); - myFCIL->Emit( OpCodes::Stloc_S, v1 ); - myFCIL->Emit( OpCodes::Ldstr, "---" ); - myFCIL->EmitCall( OpCodes::Call, writeLine0objMI, nullptr ); - myFCIL->Emit( OpCodes::Ldloc_S, v0 ); - myFCIL->EmitCall( OpCodes::Call, getFilesMI, nullptr ); - myFCIL->Emit( OpCodes::Stloc_S, v3 ); - myFCIL->Emit( OpCodes::Br_S, evalForEachLabel ); - - // foreach loop starts here. - myFCIL->MarkLabel( topOfForEachLabel ); - - // Load array of strings and index, store value at index for output. - myFCIL->Emit( OpCodes::Ldloc_S, v3 ); - myFCIL->Emit( OpCodes::Ldloc_S, v1 ); - myFCIL->Emit( OpCodes::Ldelem_Ref ); - myFCIL->Emit( OpCodes::Stloc_S, v2 ); - myFCIL->Emit( OpCodes::Ldloc_S, v2 ); - myFCIL->EmitCall( OpCodes::Call, writeLine0objMI, nullptr ); - - // Increment counter by one. - myFCIL->Emit( OpCodes::Ldloc_S, v1 ); - myFCIL->Emit( OpCodes::Ldc_I4_1 ); - myFCIL->Emit( OpCodes::Add ); - myFCIL->Emit( OpCodes::Stloc_S, v1 ); - - // Determine if end of file list array has been reached. - myFCIL->MarkLabel( evalForEachLabel ); - myFCIL->Emit( OpCodes::Ldloc_S, v1 ); - myFCIL->Emit( OpCodes::Ldloc_S, v3 ); - myFCIL->Emit( OpCodes::Ldlen ); - myFCIL->Emit( OpCodes::Conv_I4 ); - myFCIL->Emit( OpCodes::Blt_S, topOfForEachLabel ); - - //foreach loop end here. - myFCIL->Emit( OpCodes::Ldstr, "---" ); - myFCIL->EmitCall( OpCodes::Call, writeLine0objMI, nullptr ); - myFCIL->Emit( OpCodes::Ldstr, "There are {0} files in {1}." ); - myFCIL->Emit( OpCodes::Ldloc_S, v1 ); - myFCIL->Emit( OpCodes::Box, int::typeid ); - myFCIL->Emit( OpCodes::Ldloc_S, v0 ); - myFCIL->EmitCall( OpCodes::Call, writeLine2objMI, nullptr ); - myFCIL->Emit( OpCodes::Ret ); - Type^ myType = myTypeBuilder->CreateType(); - myAsmBuilder->SetEntryPoint( myFCMethod ); - myAsmBuilder->Save( executableName ); - Console::WriteLine( "-- Method generated, type completed, and assembly saved to disk." ); - return myType; - } -}; - -int main() -{ - String^ domainDir; - String^ executableName = nullptr; - Console::Write( "Enter a name for the file counting assembly: " ); - String^ executableNameNoExe = Console::ReadLine(); - executableName = String::Concat( executableNameNoExe, ".exe" ); - Console::WriteLine( "---" ); - domainDir = Environment::CurrentDirectory; - AppDomain^ curDomain = Thread::GetDomain(); - - // Create a new AppDomain, with the current directory as the base. - Console::WriteLine( "Current Directory: {0}", Environment::CurrentDirectory ); - AppDomainSetup^ mySetupInfo = gcnew AppDomainSetup; - mySetupInfo->ApplicationBase = domainDir; - mySetupInfo->ApplicationName = executableNameNoExe; - mySetupInfo->LoaderOptimization = LoaderOptimization::SingleDomain; - AppDomain^ myDomain = AppDomain::CreateDomain( executableNameNoExe, nullptr, mySetupInfo ); - Console::WriteLine( "Creating a new AppDomain '{0}'...", executableNameNoExe ); - Console::WriteLine( "-- Base Directory = '{0}'", myDomain->BaseDirectory ); - Console::WriteLine( "-- Shadow Copy? = '{0}'", myDomain->ShadowCopyFiles ); - Console::WriteLine( "---" ); - Type^ myFCType = ADDyno::CreateADynamicAssembly( &curDomain, executableNameNoExe ); - Console::WriteLine( "Loading '{0}' from '{1}'...", executableName, myDomain->BaseDirectory ); - BindingFlags bFlags = static_cast(BindingFlags::Public | BindingFlags::CreateInstance | BindingFlags::Instance); - Object^ myObjInstance = myDomain->CreateInstanceAndUnwrap( executableNameNoExe, executableNameNoExe, false, bFlags, nullptr, nullptr, nullptr, nullptr, nullptr ); - Console::WriteLine( "Executing method 'CountLocalFiles' in {0}...", myObjInstance ); - array^temp4 = nullptr; - myFCType->InvokeMember( "CountLocalFiles", BindingFlags::InvokeMethod, nullptr, myObjInstance, temp4 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp b/snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp deleted file mode 100644 index fb5fa78276b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; - -//for Evidence Object -int main() -{ - AppDomain^ currentDomain = AppDomain::CurrentDomain; - - //Provide the current application domain evidence for the assembly. - Evidence^ asEvidence = currentDomain->Evidence; - - //Load the assembly from the application directory using a simple name. - //Create an assembly called CustomLibrary to run this sample. - currentDomain->Load( "CustomLibrary", asEvidence ); - - //Make an array for the list of assemblies. - array^assems = currentDomain->GetAssemblies(); - - //List the assemblies in the current application domain. - Console::WriteLine( "List of assemblies loaded in current appdomain:" ); - System::Collections::IEnumerator^ myEnum = assems->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Assembly^ assem = safe_cast(myEnum->Current); - Console::WriteLine( assem ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp b/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp deleted file mode 100644 index 2c9683ae785..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -int main() -{ - // appdomain setup information - AppDomain^ currentDomain = AppDomain::CurrentDomain; - - //Create a new value pair for the appdomain - currentDomain->SetData( "ADVALUE", "Example value" ); - - //get the value specified in the setdata method - Console::WriteLine( "ADVALUE is: {0}", currentDomain->GetData( "ADVALUE" ) ); - - //get a system value specified at appdomainsetup - Console::WriteLine( "System value for loader optimization: {0}", - currentDomain->GetData( "LOADER_OPTIMIZATION" ) ); -} - -/* This code example produces the following output: - -ADVALUE is: Example value -System value for loader optimization: NotSpecified - */ - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp b/snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp deleted file mode 100644 index 0cace0ddf7b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; - -ref class Worker : MarshalByRefObject -{ -public: - void TestLoad() - { - // You must supply a valid fully qualified assembly name here. - Assembly::Load("Text assembly name, Culture, PublicKeyToken, Version"); - for each (Assembly^ assem in AppDomain::CurrentDomain->GetAssemblies()) - Console::WriteLine(assem->FullName); - } -}; - -//for evidence Object* -// The following attribute indicates to loader that multiple application -// domains are used in this application. - -[LoaderOptimizationAttribute(LoaderOptimization::MultiDomainHost)] -int main() -{ - - // Create application domain setup information for new application domain. - AppDomainSetup^ domaininfo = gcnew AppDomainSetup; - domaininfo->ApplicationBase = System::Environment::CurrentDirectory; - domaininfo->ApplicationName = "MyMultiDomain Application"; - - //Create evidence for the new appdomain from evidence of current application domain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create appdomain. - AppDomain^ newDomain = AppDomain::CreateDomain( "MyMultiDomain", adevidence, domaininfo ); - - // Load an assembly into the new application domain. - Worker^ w = (Worker^) newDomain->CreateInstanceAndUnwrap( - Worker::typeid->Assembly->GetName()->Name, - "Worker" - ); - w->TestLoad(); - - //Unload the application domain, which also unloads the assembly. - AppDomain::Unload(newDomain); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp b/snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp deleted file mode 100644 index d7de6e72c21..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Principal; -using namespace System::Threading; -ref class ADPrincipal -{ -public: - static void PrintPrincipalInformation() - { - IPrincipal^ curPrincipal = Thread::CurrentPrincipal; - if ( curPrincipal != nullptr ) - { - Console::WriteLine( "Type: {0}", curPrincipal->GetType()->Name ); - Console::WriteLine( "Name: {0}", curPrincipal->Identity->Name ); - Console::WriteLine( "Authenticated: {0}", curPrincipal->Identity->IsAuthenticated ); - Console::WriteLine(); - } - } - -}; - -int main() -{ - - // Create a new thread with a generic principal. - Thread^ t = gcnew Thread( gcnew ThreadStart( ADPrincipal::PrintPrincipalInformation ) ); - t->Start(); - t->Join(); - - // Set the principal policy to WindowsPrincipal. - AppDomain^ currentDomain = AppDomain::CurrentDomain; - currentDomain->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal ); - - // The new thread will have a Windows principal representing the - // current user. - t = gcnew Thread( gcnew ThreadStart( ADPrincipal::PrintPrincipalInformation ) ); - t->Start(); - t->Join(); - - // Create a principal to use for new threads. - IIdentity^ identity = gcnew GenericIdentity( "NewUser" ); - IPrincipal^ principal = gcnew GenericPrincipal( identity,nullptr ); - currentDomain->SetThreadPrincipal( principal ); - - // Create a new thread with the principal created above. - t = gcnew Thread( gcnew ThreadStart( ADPrincipal::PrintPrincipalInformation ) ); - t->Start(); - t->Join(); - - // Wait for user input before terminating. - Console::ReadLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp b/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp deleted file mode 100644 index 54f58550e69..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; -int main() -{ - - // Create a new application domain. - AppDomain^ domain = System::AppDomain::CreateDomain( "MyDomain" ); - - // Create a new AppDomain PolicyLevel. - PolicyLevel^ polLevel = PolicyLevel::CreateAppDomainLevel(); - - // Create a new, empty permission set. - PermissionSet^ permSet = gcnew PermissionSet( PermissionState::None ); - - // Add permission to execute code to the permission set. - permSet->AddPermission( gcnew SecurityPermission( SecurityPermissionFlag::Execution ) ); - - // Give the policy level's root code group a new policy statement based - // on the new permission set. - polLevel->RootCodeGroup->PolicyStatement = gcnew PolicyStatement( permSet ); - - // Give the new policy level to the application domain. - domain->SetAppDomainPolicy( polLevel ); - - // Try to execute the assembly. - try - { - - // This will throw a PolicyException if the executable tries to - // access any resources like file I/O or tries to create a window. - domain->ExecuteAssembly( "Assemblies\\MyWindowsExe.exe" ); - } - catch ( PolicyException^ e ) - { - Console::WriteLine( "PolicyException: {0}", e->Message ); - } - - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp b/snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp deleted file mode 100644 index 17c1ac6e7ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; -using namespace System::Security::Policy; // For Evidence object. - -int main() -{ - - // Create application domain setup information - AppDomainSetup^ domaininfo = gcnew AppDomainSetup; - domaininfo->ConfigurationFile = String::Format("{0}{1}ADSetup.exe.config", - Environment::CurrentDirectory, - Path::DirectorySeparatorChar); - domaininfo->ApplicationBase = String::Format("{0}", System::Environment::CurrentDirectory); - - //Create evidence for the new appdomain from evidence of the current application domain - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create appdomain - AppDomain^ domain = AppDomain::CreateDomain("Domain2", adevidence, domaininfo); - - // Display application domain information - Console::WriteLine("Host domain: {0}", AppDomain::CurrentDomain->FriendlyName); - Console::WriteLine("Child domain: {0}", domain->FriendlyName); - Console::WriteLine(); - Console::WriteLine("Configuration file: {0}", domain->SetupInformation->ConfigurationFile); - Console::WriteLine( "Application Base Directory: {0}", domain->BaseDirectory); - - AppDomain::Unload(domain); -} -// The example displays output like the following: -// Host domain: adsetup.exe -// Child domain: Domain2 -// -// Configuration file: C:\Test\ADSetup.exe.config -// Application Base Directory: C:\Test -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp b/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp deleted file mode 100644 index 228dd62f2ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Policy; - -//for evidence Object* -int main() -{ - AppDomainSetup^ setup = gcnew AppDomainSetup; - - // Shadow copying will not work unless the application has a name. - setup->ApplicationName = "MyApplication"; - - //Create evidence for the new application domain from evidence of - // current application domain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create a new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup ); - - // MyAssembly.dll is located in the Assemblies subdirectory. - domain->AppendPrivatePath( "Assemblies" ); - - // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - // MoreAssemblies subdirectory. - domain->AppendPrivatePath( "MoreAssemblies" ); - - // Display the relative search path. - Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath ); - - // Because Load returns an Assembly Object*, the assemblies must be - // loaded into the current domain as well. This will fail unless the - // current domain also has these directories in its search path. - AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" ); - AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" ); - - // Save shadow copies to C:\Cache - domain->SetCachePath( "C:\\Cache" ); - - // Shadow copy only the assemblies in the Assemblies directory. - domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) ); - - // Turn shadow copying on. - domain->SetShadowCopyFiles(); - - // This will be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" ); - - // This will not be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" ); - - // When the shadow copy path is cleared, the CLR will make shadow copies - // of all private assemblies. - domain->ClearShadowCopyPath(); - - // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" ); - - // Unload the domain. - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp b/snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp deleted file mode 100644 index 52694e50b43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; - -//for evidence Object* -int main() -{ - - // Create application domain setup information - AppDomainSetup^ domaininfo = gcnew AppDomainSetup; - - //Create evidence for the new appdomain from evidence of the current application domain - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create appdomain - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, domaininfo ); - - // Write out application domain information - Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName ); - Console::WriteLine( "child domain: {0}", domain->FriendlyName ); - Console::WriteLine( "child domain name using ToString: {0}", domain ); - Console::WriteLine(); - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp b/snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp deleted file mode 100644 index 66cd1bdcd86..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; - -//for evidence Object* -int main() -{ - - //Create evidence for the new appdomain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create the new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence ); - Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName ); - Console::WriteLine( "child domain: {0}", domain->FriendlyName ); - - // Unload the application domain. - AppDomain::Unload( domain ); - try - { - Console::WriteLine(); - - // Note that the following statement creates an exception because the domain no longer exists. - Console::WriteLine( "child domain: {0}", domain->FriendlyName ); - } - catch ( AppDomainUnloadedException^ /*e*/ ) - { - Console::WriteLine( "The appdomain MyDomain does not exist." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp deleted file mode 100644 index 23f9d8bfc08..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Text; - -public ref class SomeType -{ -public: - void DoSomething(int x) - { - Console::WriteLine("100 / {0} = {1}", x, 100 / x); - } -}; - -void main() -{ - // - // Create an instance of the StringBuilder type using - // Activator.CreateInstance. - Object^ o = Activator::CreateInstance(StringBuilder::typeid); - - // Append a string into the StringBuilder object and display the - // StringBuilder. - StringBuilder^ sb = (StringBuilder^) o; - sb->Append("Hello, there."); - Console::WriteLine(sb); - // - - // - // Create an instance of the SomeType class that is defined in this - // assembly. - System::Runtime::Remoting::ObjectHandle^ oh = - Activator::CreateInstanceFrom(Assembly::GetEntryAssembly()->CodeBase, - SomeType::typeid->FullName); - - // Call an instance method defined by the SomeType type using this object. - SomeType^ st = (SomeType^) oh->Unwrap(); - - st->DoSomething(5); - // -}; - -/* This code produces the following output: - -Hello, there. -100 / 5 = 20 - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp deleted file mode 100644 index d02d7ca37f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; - -ref class DynamicInstanceList -{ -private: - static String^ instanceSpec = "System.EventArgs;System.Random;" + - "System.Exception;System.Object;System.Version"; - -public: - static void Main() - { - array^ instances = instanceSpec->Split(';'); - Array^ instlist = Array::CreateInstance(Object::typeid, instances->Length); - Object^ item; - - for (int i = 0; i < instances->Length; i++) - { - // create the object from the specification string - Console::WriteLine("Creating instance of: {0}", instances[i]); - item = Activator::CreateInstance(Type::GetType(instances[i])); - instlist->SetValue(item, i); - } - Console::WriteLine("\nObjects and their default values:\n"); - for each (Object^ o in instlist) - { - Console::WriteLine("Type: {0}\nValue: {1}\nHashCode: {2}\n", - o->GetType()->FullName, o->ToString(), o->GetHashCode()); - } - } -}; - -int main() -{ - DynamicInstanceList::Main(); -} - -// This program will display output similar to the following: -// -// Creating instance of: System.EventArgs -// Creating instance of: System.Random -// Creating instance of: System.Exception -// Creating instance of: System.Object -// Creating instance of: System.Version -// -// Objects and their default values: -// -// Type: System.EventArgs -// Value: System.EventArgs -// HashCode: 46104728 -// -// Type: System.Random -// Value: System.Random -// HashCode: 12289376 -// -// Type: System.Exception -// Value: System.Exception: Exception of type 'System.Exception' was thrown. -// HashCode: 55530882 -// -// Type: System.Object -// Value: System.Object -// HashCode: 30015890 -// -// Type: System.Version -// Value: 0.0 -// HashCode: 1048575 -// diff --git a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp b/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp deleted file mode 100644 index 46b9455a618..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// An enumeration of animals. Start at 1 (0 = uninitialized). -public enum class Animal -{ - // Pets. - Dog = 1, - Cat, Bird -}; - -// A custom attribute to allow a target to have a pet. -public ref class AnimalTypeAttribute: public Attribute -{ -public: - - // The constructor is called when the attribute is set. - AnimalTypeAttribute( Animal pet ) - { - thePet = pet; - } - - -protected: - - // Keep a variable internally ... - Animal thePet; - -public: - - property Animal Pet - { - // .. and show a copy to the outside world. - Animal get() - { - return thePet; - } - - void set( Animal value ) - { - thePet = value; - } - } -}; - -// A test class where each method has its own pet. -ref class AnimalTypeTestClass -{ -public: - - [AnimalType(Animal::Dog)] - void DogMethod(){} - - - [AnimalType(Animal::Cat)] - void CatMethod(){} - - [AnimalType(Animal::Bird)] - void BirdMethod(){} - -}; - -int main() -{ - AnimalTypeTestClass^ testClass = gcnew AnimalTypeTestClass; - Type^ type = testClass->GetType(); - - // Iterate through all the methods of the class. - System::Collections::IEnumerator^ myEnum = - type->GetMethods()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MethodInfo^ mInfo = safe_cast(myEnum->Current); - - // Iterate through all the Attributes for each method. - System::Collections::IEnumerator^ myEnum1 = - Attribute::GetCustomAttributes( mInfo )->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum1->Current); - - // Check for the AnimalType attribute. - if ( attr->GetType() == AnimalTypeAttribute::typeid ) - Console::WriteLine( "Method {0} has a pet {1} attribute.", - mInfo->Name, (dynamic_cast(attr))->Pet ); - } - } -} - -/* - * Output: - * Method DogMethod has a pet Dog attribute. - * Method CatMethod has a pet Cat attribute. - * Method BirdMethod has a pet Bird attribute. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp deleted file mode 100644 index c5dd8fefacd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -#using - -using namespace System::Timers; -using namespace System::Collections; -int main() -{ - - // Get the assembly display name for System.dll, the assembly - // that contains System.Timers.Timer. Note that this causes - // System.dll to be loaded into the execution context. - // - String^ displayName = Timer::typeid->Assembly->FullName; - - // Load System.dll into the reflection-only context. Note that - // if you obtain the display name (for example, by running this - // example program), and enter it as a literal string in the - // preceding line of code, you can load System.dll into the - // reflection-only context without loading it into the execution - // context. - Assembly::ReflectionOnlyLoad( displayName ); - - // Display the assemblies loaded into the execution and - // reflection-only contexts. System.dll appears in both contexts. - // - Console::WriteLine( L"------------- Execution Context --------------" ); - IEnumerator^ myEnum = AppDomain::CurrentDomain->GetAssemblies()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Assembly^ a = safe_cast(myEnum->Current); - Console::WriteLine( L"\t{0}", a->GetName() ); - } - - Console::WriteLine( L"------------- Reflection-only Context --------------" ); - IEnumerator^ myEnum1 = AppDomain::CurrentDomain->ReflectionOnlyGetAssemblies()->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Assembly^ a = safe_cast(myEnum1->Current); - Console::WriteLine( L"\t{0}", a->GetName() ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp deleted file mode 100644 index bd93fb5f6a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -using namespace System; -using namespace System::Security::Policy; - -public ref class AppDomainInitializerExample -{ - // The callback method invoked when the child application domain is - // initialized. The method simply displays the arguments that were - // passed to it. - // -public: - static void AppDomainInit(array^ args) - { - Console::WriteLine("AppDomain \"{0}\" is initialized with these " + - "arguments:", AppDomain::CurrentDomain->FriendlyName); - for each (String^ arg in args) - { - Console::WriteLine(" {0}", arg); - } - } -}; - -int main() -{ - // Get a reference to the default application domain. - // - AppDomain^ currentDomain = AppDomain::CurrentDomain; - - // Create the AppDomainSetup that will be used to set up the child - // AppDomain. - AppDomainSetup^ domainSetup = gcnew AppDomainSetup(); - - // Use the evidence from the default application domain to - // create evidence for the child application domain. - // - Evidence^ evidence = gcnew Evidence(currentDomain->Evidence); - - // Create an AppDomainInitializer delegate that represents the - // callback method, AppDomainInit. Assign this delegate to the - // AppDomainInitializer property of the AppDomainSetup object. - // - AppDomainInitializer^ domainInitializer = - gcnew AppDomainInitializer(AppDomainInitializerExample::AppDomainInit); - domainSetup->AppDomainInitializer = domainInitializer; - - // Create an array of strings to pass as arguments to the callback - // method. Assign the array to the AppDomainInitializerArguments - // property. - array^ initialArguments = {"String1", "String2"}; - domainSetup->AppDomainInitializerArguments = initialArguments; - - // Create a child application domain named "ChildDomain", using - // the evidence and the AppDomainSetup object. - // - AppDomain^ appDomain = AppDomain::CreateDomain("ChildDomain", - evidence, domainSetup); - - Console::WriteLine("Press the Enter key to exit the example program."); - Console::ReadLine(); -} - -/* This code example produces the following output: - -AppDomain "ChildDomain" is initialized with these arguments: -String1 -String2 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp deleted file mode 100644 index c3e20a5292a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Threading; -using namespace System::Security::Policy; - -// -// Because this class is derived from MarshalByRefObject, a proxy -// to a MarshalByRefType object can be returned across an AppDomain -// boundary. -ref class MarshalByRefType : MarshalByRefObject -{ -public: - // Call this method via a proxy. - void SomeMethod(String^ callingDomainName) - { - // Get this AppDomain's settings and display some of them. - AppDomainSetup^ ads = AppDomain::CurrentDomain->SetupInformation; - Console::WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", - ads->ApplicationName, - ads->ApplicationBase, - ads->ConfigurationFile - ); - - // Display the name of the calling AppDomain and the name - // of the second domain. - // NOTE: The application's thread has transitioned between - // AppDomains. - Console::WriteLine("Calling from '{0}' to '{1}'.", - callingDomainName, - Thread::GetDomain()->FriendlyName - ); - }; -}; -// - -// -void main() -{ - // Get and display the friendly name of the default AppDomain. - String^ callingDomainName = Thread::GetDomain()->FriendlyName; - Console::WriteLine(callingDomainName); - - // Get and display the full name of the EXE assembly. - String^ exeAssembly = Assembly::GetEntryAssembly()->FullName; - Console::WriteLine(exeAssembly); - - // Construct and initialize settings for a second AppDomain. - AppDomainSetup^ ads = gcnew AppDomainSetup(); - ads->ApplicationBase = AppDomain::CurrentDomain->BaseDirectory; - - ads->DisallowBindingRedirects = false; - ads->DisallowCodeDownload = true; - ads->ConfigurationFile = - AppDomain::CurrentDomain->SetupInformation->ConfigurationFile; - - // Create the second AppDomain. - AppDomain^ ad2 = AppDomain::CreateDomain("AD #2", - AppDomain::CurrentDomain->Evidence, ads); - - // Create an instance of MarshalbyRefType in the second AppDomain. - // A proxy to the object is returned. - MarshalByRefType^ mbrt = - (MarshalByRefType^) ad2->CreateInstanceAndUnwrap( - exeAssembly, - MarshalByRefType::typeid->FullName - ); - - // Call a method on the object via the proxy, passing the - // default AppDomain's friendly name in as a parameter. - mbrt->SomeMethod(callingDomainName); - - // Unload the second AppDomain. This deletes its object and - // invalidates the proxy object. - AppDomain::Unload(ad2); - try - { - // Call the method again. Note that this time it fails - // because the second AppDomain was unloaded. - mbrt->SomeMethod(callingDomainName); - Console::WriteLine("Sucessful call."); - } - catch(AppDomainUnloadedException^) - { - Console::WriteLine("Failed call; this is expected."); - } -} -// - -/* This code produces output similar to the following: - -AppDomainX.exe -AppDomainX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null -AppName=, AppBase=C:\AppDomain\bin, ConfigFile=C:\AppDomain\bin\AppDomainX.exe.config -Calling from 'AppDomainX.exe' to 'AD #2'. -Failed call; this is expected. - */ -// - - - - diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp deleted file mode 100644 index ecd3b28ecd6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class Test -{ -public: - static void MyAssemblyLoadEventHandler( Object^ sender, AssemblyLoadEventArgs^ args ) - { - Console::WriteLine( "ASSEMBLY LOADED: {0}", args->LoadedAssembly->FullName ); - Console::WriteLine(); - } - -}; - -void PrintLoadedAssemblies( AppDomain^ domain ) -{ - Console::WriteLine( "LOADED ASSEMBLIES:" ); - System::Collections::IEnumerator^ myEnum = domain->GetAssemblies()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Assembly^ a = safe_cast(myEnum->Current); - Console::WriteLine( a->FullName ); - } - - Console::WriteLine(); -} - -int main() -{ - AppDomain^ currentDomain = AppDomain::CurrentDomain; - currentDomain->AssemblyLoad += gcnew AssemblyLoadEventHandler( Test::MyAssemblyLoadEventHandler ); - PrintLoadedAssemblies( currentDomain ); - - // Lists mscorlib and this assembly - // You must supply a valid fully qualified assembly name here. - currentDomain->CreateInstance( "System.Windows.Forms, Version, Culture, PublicKeyToken", "System.Windows.Forms.TextBox" ); - - // Loads System, System::Drawing, System::Windows::Forms - PrintLoadedAssemblies( currentDomain ); - - // Lists all five assemblies -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp deleted file mode 100644 index 94f31e4024a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -[ComVisible(true)] -public ref class MyComVisibleType -{ -public: - MyComVisibleType() - { - Console::WriteLine( "MyComVisibleType instantiated!" ); - } - -}; - - -[ComVisible(false)] -public ref class MyComNonVisibleType -{ -public: - MyComNonVisibleType() - { - Console::WriteLine( "MyComNonVisibleType instantiated!" ); - } - -}; - -void CreateComInstance( String^ typeName ) -{ - try - { - AppDomain^ currentDomain = AppDomain::CurrentDomain; - String^ assemblyName = currentDomain->FriendlyName; - currentDomain->CreateComInstanceFrom( assemblyName, typeName ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -int main() -{ - CreateComInstance( "MyComNonVisibleType" ); // Fail! - CreateComInstance( "MyComVisibleType" ); // OK! -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp deleted file mode 100644 index 5348a8644bc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -static void InstantiateINT32( bool ignoreCase ) -{ - try - { - AppDomain^ currentDomain = AppDomain::CurrentDomain; - Object^ instance = currentDomain->CreateInstanceAndUnwrap( - "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", - "SYSTEM.INT32", - ignoreCase, - BindingFlags::Default, - nullptr, - nullptr, - nullptr, - nullptr, - nullptr ); - Console::WriteLine( instance->GetType() ); - } - catch ( TypeLoadException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -int main() -{ - InstantiateINT32( false ); // Failed! - InstantiateINT32( true ); // OK! -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp deleted file mode 100644 index ae2ce9f4402..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -ref class Test -{ -public: - static void InstantiateMyDynamicType( AppDomain^ domain ) - { - try - { - - // You must supply a valid fully qualified assembly name here. - domain->CreateInstance( "Assembly text name, Version, Culture, PublicKeyToken", "MyDynamicType" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - - } - - static Assembly^ MyResolveEventHandler( Object^ sender, ResolveEventArgs^ args ) - { - return DefineDynamicAssembly( dynamic_cast(sender) ); - } - - static Assembly^ DefineDynamicAssembly( AppDomain^ domain ) - { - - // Build a dynamic assembly using Reflection Emit API. - AssemblyName^ assemblyName = gcnew AssemblyName; - assemblyName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ assemblyBuilder = domain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Run ); - ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule( "MyDynamicModule" ); - TypeBuilder^ typeBuilder = moduleBuilder->DefineType( "MyDynamicType", TypeAttributes::Public ); - ConstructorBuilder^ constructorBuilder = typeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, nullptr ); - ILGenerator^ ilGenerator = constructorBuilder->GetILGenerator(); - ilGenerator->EmitWriteLine( "MyDynamicType instantiated!" ); - ilGenerator->Emit( OpCodes::Ret ); - typeBuilder->CreateType(); - return assemblyBuilder; - } - -}; - -int main() -{ - AppDomain^ currentDomain = AppDomain::CurrentDomain; - Test::InstantiateMyDynamicType( currentDomain ); // Failed! - currentDomain->AssemblyResolve += gcnew ResolveEventHandler( Test::MyResolveEventHandler ); - Test::InstantiateMyDynamicType( currentDomain ); // OK! -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp deleted file mode 100644 index 6de7aba1837..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -using namespace System; - -// -public ref class PingPong : public MarshalByRefObject -{ -private: - String^ greetings; - -public: - PingPong() - { - greetings = "PING!"; - } - - static void Main() - { - AppDomain^ otherDomain = AppDomain::CreateDomain("otherDomain"); - - PingPong^ pp = gcnew PingPong(); - pp->MyCallBack(); - pp->greetings = "PONG!"; - otherDomain->DoCallBack(gcnew CrossAppDomainDelegate( pp, &PingPong::MyCallBack)); - - // Output: - // PING! from defaultDomain - // PONG! from defaultDomain - } - - // Callback will always execute within defaultDomain due to inheritance from - // MarshalByRefObject - void MyCallBack() - { - String^ name = AppDomain::CurrentDomain->FriendlyName; - if (name == AppDomain::CurrentDomain->SetupInformation->ApplicationName) - { - name = "defaultDomain"; - } - Console::WriteLine(greetings + " from " + name); - } -}; - -int main() -{ - PingPong::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp deleted file mode 100644 index f11f478ba46..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -using namespace System; - -// - -[Serializable] -public ref class PingPong -{ -private: - String^ greetings; - -public: - PingPong() - { - greetings = "PING!"; - } - - static void Main() - { - AppDomain^ otherDomain = AppDomain::CreateDomain("otherDomain"); - - PingPong^ pp = gcnew PingPong(); - pp->MyCallBack(); - pp->greetings = "PONG!"; - otherDomain->DoCallBack(gcnew CrossAppDomainDelegate( pp, &PingPong::MyCallBack)); - - // Output: - // PING! from defaultDomain - // PONG! from otherDomain - } - - void MyCallBack() - { - String^ name = AppDomain::CurrentDomain->FriendlyName; - - if (name == AppDomain::CurrentDomain->SetupInformation->ApplicationName) - { - name = "defaultDomain"; - } - Console::WriteLine(greetings + " from " + name); - } -}; - -int main() -{ - PingPong::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp deleted file mode 100644 index 3a97986292e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -using namespace System; - -// -public ref class PingPong -{ -private: - static String^ greetings = "PONG!"; - -public: - static void Main() - { - AppDomain^ otherDomain = AppDomain::CreateDomain("otherDomain"); - - greetings = "PING!"; - MyCallBack(); - otherDomain->DoCallBack(gcnew CrossAppDomainDelegate(MyCallBack)); - - // Output: - // PING! from defaultDomain - // PONG! from otherDomain - } - - static void MyCallBack() - { - String^ name = AppDomain::CurrentDomain->FriendlyName; - - if (name == AppDomain::CurrentDomain->SetupInformation->ApplicationName) - { - name = "defaultDomain"; - } - Console::WriteLine(greetings + " from " + name); - } -}; - -int main() -{ - PingPong::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp deleted file mode 100644 index 51295fdce3f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -using namespace System; - -// -int main() -{ - AppDomain^ currentDomain = AppDomain::CurrentDomain; - AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" ); - currentDomain->ExecuteAssembly( "MyExecutable.exe" ); - - // Prints S"MyExecutable running on [default]" - otherDomain->ExecuteAssembly( "MyExecutable.exe" ); - - // Prints S"MyExecutable running on otherDomain" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp deleted file mode 100644 index b17c8ebe02b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp +++ /dev/null @@ -1,77 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -void InstantiateMyType( AppDomain^ domain ) -{ - try - { - - // You must supply a valid fully qualified assembly name here. - domain->CreateInstance( "Assembly text name, Version, Culture, PublicKeyToken", "MyType" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} - - -// Loads the content of a file to a Byte array. -array^ loadFile( String^ filename ) -{ - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - array^buffer = gcnew array((int)fs->Length); - fs->Read( buffer, 0, buffer->Length ); - fs->Close(); - return buffer; -} - - -// Creates a dynamic assembly with symbol information -// and saves them to temp.dll and temp.pdb -void EmitAssembly( AppDomain^ domain ) -{ - AssemblyName^ assemblyName = gcnew AssemblyName; - assemblyName->Name = "MyAssembly"; - AssemblyBuilder^ assemblyBuilder = domain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Save ); - ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule( "MyModule", "temp.dll", true ); - TypeBuilder^ typeBuilder = moduleBuilder->DefineType( "MyType", TypeAttributes::Public ); - ConstructorBuilder^ constructorBuilder = typeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, nullptr ); - ILGenerator^ ilGenerator = constructorBuilder->GetILGenerator(); - ilGenerator->EmitWriteLine( "MyType instantiated!" ); - ilGenerator->Emit( OpCodes::Ret ); - typeBuilder->CreateType(); - assemblyBuilder->Save( "temp.dll" ); -} - -ref class Resolver -{ -public: - static Assembly^ MyResolver( Object^ sender, ResolveEventArgs^ args ) - { - AppDomain^ domain = dynamic_cast(sender); - - // Once the files are generated, this call is - // actually no longer necessary. - EmitAssembly( domain ); - array^rawAssembly = loadFile( "temp.dll" ); - array^rawSymbolStore = loadFile( "temp.pdb" ); - Assembly^ assembly = domain->Load( rawAssembly, rawSymbolStore ); - return assembly; - } - -}; - -int main() -{ - AppDomain^ currentDomain = AppDomain::CurrentDomain; - InstantiateMyType( currentDomain ); // Failed! - currentDomain->AssemblyResolve += gcnew ResolveEventHandler( Resolver::MyResolver ); - InstantiateMyType( currentDomain ); // OK! -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp deleted file mode 100644 index 1b6c10fd7b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp +++ /dev/null @@ -1,21 +0,0 @@ -using namespace System; -using namespace System::Security::Policy; - -int main() -{ - // - // Set up the AppDomainSetup - AppDomainSetup^ setup = gcnew AppDomainSetup; - setup->ApplicationBase = "(some directory)"; - setup->ConfigurationFile = "(some file)"; - - // Set up the Evidence - Evidence^ baseEvidence = AppDomain::CurrentDomain->Evidence; - Evidence^ evidence = gcnew Evidence( baseEvidence ); - evidence->AddAssembly( "(some assembly)" ); - evidence->AddHost( "(some host)" ); - - // Create the AppDomain - AppDomain^ newDomain = AppDomain::CreateDomain( "newDomain", evidence, setup ); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp deleted file mode 100644 index 7c1b00f5f41..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -ref class Test -{ -private: - static Assembly^ HandleTypeResolve(Object^ sender, ResolveEventArgs^ args) - { - Console::WriteLine("TypeResolve event handler."); - - // Save the dynamic assembly, and then load it using its - // display name. Return the loaded assembly. - // - ab->Save(moduleName); - return Assembly::Load(ab->FullName); - } - - // For this code example, the following information needs to be - // available to both Demo and the HandleTypeResolve event - // handler: - static AssemblyBuilder^ ab; - static String^ moduleName; - -public: - static void Demo() - { - AppDomain^ currDom = AppDomain::CurrentDomain; - - // Create a dynamic assembly with one module, to be saved to - // disk (AssemblyBuilderAccess::Save). - // - AssemblyName^ aName = gcnew AssemblyName(); - aName->Name = "Transient"; - moduleName = aName->Name + ".dll"; - ab = currDom->DefineDynamicAssembly(aName, - AssemblyBuilderAccess::Save); - ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name, moduleName); - - // The dynamic assembly has just one dummy type, to demonstrate - // type resolution. - TypeBuilder^ tb = mb->DefineType("Example"); - tb->CreateType(); - - - // First, try to load the type without saving the dynamic - // assembly and without hooking up the TypeResolve event. The - // type cannot be loaded. - try - { - Type^ temp = Type::GetType("Example", true); - Console::WriteLine("Loaded type {0}.", temp); - } - catch (TypeLoadException^) - { - Console::WriteLine("Loader could not resolve the type."); - } - - // Hook up the TypeResolve event. - // - currDom->TypeResolve += - gcnew ResolveEventHandler(HandleTypeResolve); - - // Now try to load the type again. The TypeResolve event is - // raised, the dynamic assembly is saved, and the dummy type is - // loaded successfully. Display it to the console, and create - // an instance. - Type^ t = Type::GetType("Example", true); - Console::WriteLine("Loaded type \"{0}\".", t); - Object^ o = Activator::CreateInstance(t); - } -}; - -void main() -{ - Test::Demo(); -} - -/* This code example produces the following output: - -Loader could not resolve the type. -TypeResolve event handler. -Loaded type "Example". - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp deleted file mode 100644 index 8929a8c5fda..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -// The example should be compiled with the /clr:pure compiler option. -using namespace System; -using namespace System::Security::Permissions; - -public ref class Example -{ - - -private: - static void MyHandler(Object^ sender, UnhandledExceptionEventArgs^ args) - { - Exception^ e = dynamic_cast(args->ExceptionObject); - Console::WriteLine( "MyHandler caught : {0}", e->Message ); - Console::WriteLine("Runtime terminating: {0}", args->IsTerminating); - } - -public: - [SecurityPermissionAttribute( SecurityAction::Demand, ControlAppDomain = true )] - static void Main() - { - AppDomain^ currentDomain = AppDomain::CurrentDomain; - currentDomain->UnhandledException += gcnew UnhandledExceptionEventHandler(Example::MyHandler); - try - { - throw gcnew Exception("1"); - } - catch (Exception^ e) - { - Console::WriteLine( "Catch clause caught : {0}\n", e->Message ); - } - - throw gcnew Exception("2"); - } -}; - -void main() -{ - Example::Main(); -} -// The example displays the following output: -// Catch clause caught : 1 -// -// MyHandler caught : 2 -// Runtime terminating: True -// -// Unhandled Exception: System.Exception: 2 -// at Example.Main() -// at mainCRTStartup(String[] arguments) -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp deleted file mode 100644 index 34a424f0c5f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// Types:System.ArgumentException -// -using namespace System; - -// -int DivideByTwo(int num) -{ - // If num is an odd number, throw an ArgumentException. - if ((num & 1) == 1) - { - throw gcnew ArgumentException("Number must be even", "num"); - } - // num is even, return half of its value. - return num / 2; -} -// - -int main() -{ - // ArgumentException is not thrown because 10 is an even number. - Console::WriteLine("10 divided by 2 is {0}", DivideByTwo(10)); - try - { - // ArgumentException is thrown because 7 is not an even number. - Console::WriteLine("7 divided by 2 is {0}", DivideByTwo(7)); - } - catch (ArgumentException^) - { - // Show the user that 7 cannot be divided by 2. - Console::WriteLine("7 is not divided by 2 integrally."); - } -} - -// This code produces the following output. -// -// 10 divided by 2 is 5 -// 7 is not divided by 2 integrally. -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp deleted file mode 100644 index 63ffdbb6142..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; - -static int DivideByTwo(int num) -{ - // If num is an odd number, throw an ArgumentException. - if ((num & 1) == 1) - throw gcnew ArgumentException(String::Format("{0} is not an even number", num), - "num"); - - // num is even, return half of its value. - return num / 2; -} - -void main() -{ - // Define some integers for a division operation. - array^ values = { 10, 7 }; - for each (int value in values) { - try { - Console::WriteLine("{0} divided by 2 is {1}", value, DivideByTwo(value)); - } - catch (ArgumentException^ e) { - Console::WriteLine("{0}: {1}", e->GetType()->Name, e->Message); - } - Console::WriteLine(); - } -} -// This example displays the following output: -// 10 divided by 2 is 5 -// -// ArgumentException: 7 is not an even number -// Parameter name: num -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp deleted file mode 100644 index dfe97aa75c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; - -// -ref class ReverseStringComparer: public IComparer -{ -public: - virtual int Compare( Object^ x, Object^ y ) - { - String^ s1 = dynamic_cast(x); - String^ s2 = dynamic_cast(y); - - //negate the return value to get the reverse order - return -String::Compare( s1, s2 ); - } - -}; -// - -// -void PrintValues( String^ title, IEnumerable^ myList ) -{ - Console::Write( "{0,10}: ", title ); - StringBuilder^ sb = gcnew StringBuilder; - { - IEnumerator^ en = myList->GetEnumerator(); - String^ s; - while ( en->MoveNext() ) - { - s = en->Current->ToString(); - sb->AppendFormat( "{0}, ", s ); - } - } - sb->Remove( sb->Length - 2, 2 ); - Console::WriteLine( sb ); -} -// - -void main() -{ - // - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "Eric" ); - myAL->Add( "Mark" ); - myAL->Add( "Lance" ); - myAL->Add( "Rob" ); - myAL->Add( "Kris" ); - myAL->Add( "Brad" ); - myAL->Add( "Kit" ); - myAL->Add( "Bradley" ); - myAL->Add( "Keith" ); - myAL->Add( "Susan" ); - - // Displays the properties and values of the ArrayList. - Console::WriteLine( "Count: {0}", myAL->Count.ToString() ); - // - - PrintValues( "Unsorted", myAL ); - - // - myAL->Sort(); - PrintValues( "Sorted", myAL ); - // - - // - myAL->Sort( gcnew ReverseStringComparer ); - PrintValues( "Reverse", myAL ); - // - - // - array^names = dynamic_cast^>(myAL->ToArray( String::typeid )); - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp deleted file mode 100644 index 3bd578173ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// System::ArrayTypeMismatchException::ArrayTypeMismatchException -/* - * The following example demonstrates the 'ArrayTypeMismatchException()' constructor of class - * ArrayTypeMismatchException class. It creates a function which takes two arrays as arguments. - * It checks whether the two arrays are of same type or not. If two arrays are not of same type - * then a new 'ArrayTypeMismatchException' object is created and thrown. That exception is caught - * in the calling method. - */ -// -using namespace System; -public ref class ArrayTypeMisMatchConst -{ -public: - void CopyArray( Array^ myArray, Array^ myArray1 ) - { - String^ typeArray1 = myArray->GetType()->ToString(); - String^ typeArray2 = myArray1->GetType()->ToString(); - - // Check whether the two arrays are of same type or not. - if ( typeArray1 == typeArray2 ) - { - - // Copy the values from one array to another. - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 ); - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 ); - } - else - { - - // Throw an exception of type 'ArrayTypeMismatchException'. - throw gcnew ArrayTypeMismatchException; - } - } - -}; - -int main() -{ - try - { - array^myStringArray = gcnew array(2); - myStringArray->SetValue( "Jones", 0 ); - myStringArray->SetValue( "John", 1 ); - array^myIntArray = gcnew array(2); - ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; - myArrayType->CopyArray( myStringArray, myIntArray ); - } - catch ( ArrayTypeMismatchException^ e ) - { - Console::WriteLine( "The Exception is : {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp deleted file mode 100644 index d83f12c18e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -// System::ArrayTypeMismatchException::ArrayTypeMismatchException -/* - The following example demonstrates the 'ArrayTypeMismatchException(String*)' - constructor of class ArrayTypeMismatchException class. A function has been - created which takes two arrays as arguments. It checks whether the two arrays - are of same type or not. If two arrays are of not same type then a new - 'ArrayTypeMismatchException' object is created and thrown. That exception is - caught in the calling method. - */ -// -using namespace System; -public ref class ArrayTypeMisMatchConst -{ -public: - void CopyArray( Array^ myArray, Array^ myArray1 ) - { - String^ typeArray1 = myArray->GetType()->ToString(); - String^ typeArray2 = myArray1->GetType()->ToString(); - - // Check whether the two arrays are of same type or not. - if ( typeArray1 == typeArray2 ) - { - - // Copies the values from one array to another. - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 ); - myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 ); - } - else - { - - // Throw an exception of type 'ArrayTypeMismatchException' with a message String* as parameter. - throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are not of same type." ); - } - } - -}; - -int main() -{ - try - { - array^myStringArray = gcnew array(2); - myStringArray->SetValue( "Jones", 0 ); - myStringArray->SetValue( "John", 1 ); - array^myIntArray = gcnew array(2); - ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; - myArrayType->CopyArray( myStringArray, myIntArray ); - } - catch ( ArrayTypeMismatchException^ e ) - { - Console::WriteLine( "The Exception Message is : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp deleted file mode 100644 index 83d9a347667..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// System::ArrayTypeMismatchException::ArrayTypeMismatchException -/* - The following example demonstrates the 'ArrayTypeMismatchException(String*, innerException)' - constructor of class ArrayTypeMismatchException class. It creates a - function which takes two arrays as arguments. It copies elements of - one array to another array. If two arrays are of not same type then - an exception has been thrown. In the 'Catch' block a new 'WebException' - object is created and thrown to the caller. That exception is caught - in the calling method and the error message is displayed to the console. - */ -// -using namespace System; -public ref class ArrayTypeMisMatchConst -{ -public: - void CopyArray( Array^ myArray, Array^ myArray1 ) - { - try - { - - // Copies the value of one array into another array. - myArray->SetValue( myArray1->GetValue( 0 ), 0 ); - myArray->SetValue( myArray1->GetValue( 1 ), 1 ); - } - catch ( Exception^ e ) - { - - // Throw an exception of with a message and innerexception. - throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are of not same type.",e ); - } - - } - -}; - -int main() -{ - try - { - array^myStringArray = gcnew array(2); - myStringArray->SetValue( "Jones", 0 ); - myStringArray->SetValue( "John", 1 ); - array^myIntArray = gcnew array(2); - ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; - myArrayType->CopyArray( myStringArray, myIntArray ); - } - catch ( ArrayTypeMismatchException^ e ) - { - Console::WriteLine( "The Exception Message is : {0}", e->Message ); - Console::WriteLine( "The Inner exception is : {0}", e->InnerException ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp deleted file mode 100644 index 6ea5b937007..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections::Generic; - -Point PointFToPoint(PointF pf) -{ - return Point((int) pf.X, (int) pf.Y); -}; - -void main() -{ - // Create an array of PointF objects. - array^ apf = { - PointF(27.8F, 32.62F), - PointF(99.3F, 147.273F), - PointF(7.5F, 1412.2F) }; - - - // Display each element in the PointF array. - Console::WriteLine(); - for each(PointF p in apf) - { - Console::WriteLine(p); - } - - // Convert each PointF element to a Point object. - array^ ap = - Array::ConvertAll(apf, - gcnew Converter(PointFToPoint) - ); - - // Display each element in the Point array. - Console::WriteLine(); - for each(Point p in ap) - { - Console::WriteLine(p); - } -} - -/* This code example produces the following output: - -{X=27.8, Y=32.62} -{X=99.3, Y=147.273} -{X=7.5, Y=1412.2} - -{X=27,Y=32} -{X=99,Y=147} -{X=7,Y=1412} - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp deleted file mode 100644 index 61bb710737e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// -using namespace System; - -public ref class DinoDiscoverySet -{ -public: - static void Main() - { - array^ dinosaurs = - { - "Compsognathus", "Amargasaurus", "Oviraptor", - "Velociraptor", "Deinonychus", "Dilophosaurus", - "Gallimimus", "Triceratops" - }; - - DinoDiscoverySet^ GoMesozoic = gcnew DinoDiscoverySet(dinosaurs); - - GoMesozoic->DiscoverAll(); - GoMesozoic->DiscoverByEnding("saurus"); - } - - DinoDiscoverySet(array^ items) - { - dinosaurs = items; - } - - void DiscoverAll() - { - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - } - - void DiscoverByEnding(String^ Ending) - { - Predicate^ dinoType; - - if (Ending->ToLower() == "raptor") - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithRaptor); - } - else if (Ending->ToLower() == "tops") - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithTops); - } - else if (Ending->ToLower() == "saurus") - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus); - } - else - { - dinoType = - gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus); - } - - Console::WriteLine( - "\nArray::Exists(dinosaurs, \"{0}\"): {1}", - Ending, - Array::Exists(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::TrueForAll(dinosaurs, \"{0}\"): {1}", - Ending, - Array::TrueForAll(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::Find(dinosaurs, \"{0}\"): {1}", - Ending, - Array::Find(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::FindLast(dinosaurs, \"{0}\"): {1}", - Ending, - Array::FindLast(dinosaurs, dinoType)); - - Console::WriteLine( - "\nArray::FindAll(dinosaurs, \"{0}\"):", Ending); - - array^ subArray = - Array::FindAll(dinosaurs, dinoType); - - for each(String^ dinosaur in subArray) - { - Console::WriteLine(dinosaur); - } - } - -private: - array^ dinosaurs; - - // Search predicate returns true if a string ends in "saurus". - static bool EndsWithSaurus(String^ s) - { - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "saurus")) - { - return true; - } - else - { - return false; - } - } - - // Search predicate returns true if a string ends in "raptor". - static bool EndsWithRaptor(String^ s) - { - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "raptor")) - { - return true; - } - else - { - return false; - } - } - - // Search predicate returns true if a string ends in "tops". - static bool EndsWithTops(String^ s) - { - if ((s->Length > 3) && - (s->Substring(s->Length - 4)->ToLower() == "tops")) - { - return true; - } - else - { - return false; - } - } -}; - -int main() -{ - DinoDiscoverySet::Main(); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -Array.Exists(dinosaurs, "saurus"): True - -Array.TrueForAll(dinosaurs, "saurus"): False - -Array.Find(dinosaurs, "saurus"): Amargasaurus - -Array.FindLast(dinosaurs, "saurus"): Dilophosaurus - -Array.FindAll(dinosaurs, "saurus"): -Amargasaurus -Dilophosaurus -*/ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp deleted file mode 100644 index da0510c1de8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; - -// Search predicate returns true if a string ends in "saurus". -bool EndsWithSaurus(String^ s) -{ - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "saurus")) - { - return true; - } - else - { - return false; - } -}; - -void main() -{ - array^ dinosaurs = { "Compsognathus", - "Amargasaurus", "Oviraptor", "Velociraptor", - "Deinonychus", "Dilophosaurus", "Gallimimus", - "Triceratops" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nArray::FindIndex(dinosaurs, EndsWithSaurus): {0}", - Array::FindIndex(dinosaurs, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, EndsWithSaurus): {0}", - Array::FindIndex(dinosaurs, 2, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): {0}", - Array::FindIndex(dinosaurs, 2, 3, gcnew Predicate(EndsWithSaurus))); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -Array::FindIndex(dinosaurs, EndsWithSaurus): 1 - -Array::FindIndex(dinosaurs, 2, EndsWithSaurus): 5 - -Array::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp deleted file mode 100644 index 2ce93684dce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; - -// Search predicate returns true if a string ends in "saurus". -bool EndsWithSaurus(String^ s) -{ - if ((s->Length > 5) && - (s->Substring(s->Length - 6)->ToLower() == "saurus")) - { - return true; - } - else - { - return false; - } -}; - -void main() -{ - array^ dinosaurs = { "Compsognathus", - "Amargasaurus", "Oviraptor", "Velociraptor", - "Deinonychus", "Dilophosaurus", "Gallimimus", - "Triceratops" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nArray::FindLastIndex(dinosaurs, EndsWithSaurus): {0}", - Array::FindLastIndex(dinosaurs, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, EndsWithSaurus): {0}", - Array::FindLastIndex(dinosaurs, 4, gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): {0}", - Array::FindLastIndex(dinosaurs, 4, 3, gcnew Predicate(EndsWithSaurus))); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -Array::FindLastIndex(dinosaurs, EndsWithSaurus): 5 - -Array::FindLastIndex(dinosaurs, 4, EndsWithSaurus): 1 - -Array::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp deleted file mode 100644 index 946551d8cde..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ dinosaurs = { "Tyrannosaurus", - "Amargasaurus", - "Mamenchisaurus", - "Brachiosaurus", - "Deinonychus", - "Tyrannosaurus", - "Compsognathus" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\"): {0}", - Array::IndexOf(dinosaurs, "Tyrannosaurus")); - - Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}", - Array::IndexOf(dinosaurs, "Tyrannosaurus", 3)); - - Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 2, 2): {0}", - Array::IndexOf(dinosaurs, "Tyrannosaurus", 2, 2)); -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -Array.IndexOf(dinosaurs, "Tyrannosaurus"): 0 - -Array.IndexOf(dinosaurs, "Tyrannosaurus", 3): 5 - -Array.IndexOf(dinosaurs, "Tyrannosaurus", 2, 2): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp deleted file mode 100644 index 2f297639c6a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ dinosaurs = { "Tyrannosaurus", - "Amargasaurus", - "Mamenchisaurus", - "Brachiosaurus", - "Deinonychus", - "Tyrannosaurus", - "Compsognathus" }; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine( - "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\"): {0}", - Array::LastIndexOf(dinosaurs, "Tyrannosaurus")); - - Console::WriteLine( - "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}", - Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 3)); - - Console::WriteLine( - "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 4, 4): {0}", - Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4)); -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -Array.LastIndexOf(dinosaurs, "Tyrannosaurus"): 5 - -Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 3): 0 - -Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp deleted file mode 100644 index 0eece7d8c34..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class ReverseComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - // Compare y and x in reverse order. - return y->CompareTo(x); - } -}; - -void main() -{ - array^ dinosaurs = { - "Seismosaurus", - "Chasmosaurus", - "Coelophysis", - "Mamenchisaurus", - "Caudipteryx", - "Cetiosaurus" }; - - array^ dinosaurSizes = { 40, 5, 3, 22, 1, 18 }; - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes)"); - Array::Sort(dinosaurs, dinosaurSizes); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - ReverseComparer^ rc = gcnew ReverseComparer(); - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, rc)"); - Array::Sort(dinosaurs, dinosaurSizes, rc); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3)"); - Array::Sort(dinosaurs, dinosaurSizes, 3, 3); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } - - Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3, rc)"); - Array::Sort(dinosaurs, dinosaurSizes, 3, 3, rc); - - Console::WriteLine(); - for (int i = 0; i < dinosaurs->Length; i++) - { - Console::WriteLine("{0}: up to {1} meters long.", - dinosaurs[i], dinosaurSizes[i]); - } -} - -/* This code example produces the following output: - -Seismosaurus: up to 40 meters long. -Chasmosaurus: up to 5 meters long. -Coelophysis: up to 3 meters long. -Mamenchisaurus: up to 22 meters long. -Caudipteryx: up to 1 meters long. -Cetiosaurus: up to 18 meters long. - -Sort(dinosaurs, dinosaurSizes) - -Caudipteryx: up to 1 meters long. -Cetiosaurus: up to 18 meters long. -Chasmosaurus: up to 5 meters long. -Coelophysis: up to 3 meters long. -Mamenchisaurus: up to 22 meters long. -Seismosaurus: up to 40 meters long. - -Sort(dinosaurs, dinosaurSizes, rc) - -Seismosaurus: up to 40 meters long. -Mamenchisaurus: up to 22 meters long. -Coelophysis: up to 3 meters long. -Chasmosaurus: up to 5 meters long. -Cetiosaurus: up to 18 meters long. -Caudipteryx: up to 1 meters long. - -Sort(dinosaurs, dinosaurSizes, 3, 3) - -Seismosaurus: up to 40 meters long. -Mamenchisaurus: up to 22 meters long. -Coelophysis: up to 3 meters long. -Caudipteryx: up to 1 meters long. -Cetiosaurus: up to 18 meters long. -Chasmosaurus: up to 5 meters long. - -Sort(dinosaurs, dinosaurSizes, 3, 3, rc) - -Seismosaurus: up to 40 meters long. -Mamenchisaurus: up to 22 meters long. -Coelophysis: up to 3 meters long. -Chasmosaurus: up to 5 meters long. -Cetiosaurus: up to 18 meters long. -Caudipteryx: up to 1 meters long. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp deleted file mode 100644 index 8570582fcc3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -int CompareDinosByLength(String^ x, String^ y) -{ - if (x == nullptr) - { - if (y == nullptr) - { - // If x is null and y is null, they're - // equal. - return 0; - } - else - { - // If x is null and y is not null, y - // is greater. - return -1; - } - } - else - { - // If x is not null... - // - if (y == nullptr) - // ...and y is null, x is greater. - { - return 1; - } - else - { - // ...and y is not null, compare the - // lengths of the two strings. - // - int retval = x->Length.CompareTo(y->Length); - - if (retval != 0) - { - // If the strings are not of equal length, - // the longer string is greater. - // - return retval; - } - else - { - // If the strings are of equal length, - // sort them with ordinary string comparison. - // - return x->CompareTo(y); - } - } - } -}; - -void Display(array^ arr) -{ - Console::WriteLine(); - for each(String^ s in arr) - { - if (s == nullptr) - Console::WriteLine("(null)"); - else - Console::WriteLine("\"{0}\"", s); - } -}; - -void main() -{ - array^ dinosaurs = { - "Pachycephalosaurus", - "Amargasaurus", - "", - nullptr, - "Mamenchisaurus", - "Deinonychus" }; - Display(dinosaurs); - - Console::WriteLine("\nSort with generic Comparison delegate:"); - Array::Sort(dinosaurs, - gcnew Comparison(CompareDinosByLength)); - Display(dinosaurs); - -} - -/* This code example produces the following output: - -"Pachycephalosaurus" -"Amargasaurus" -"" -(null) -"Mamenchisaurus" -"Deinonychus" - -Sort with generic Comparison delegate: - -(null) -"" -"Deinonychus" -"Amargasaurus" -"Mamenchisaurus" -"Pachycephalosaurus" - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp deleted file mode 100644 index d51b2194310..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class ReverseComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - // Compare y and x in reverse order. - return y->CompareTo(x); - } -}; - -void main() -{ - array^ dinosaurs = {"Pachycephalosaurus", - "Amargasaurus", - "Mamenchisaurus", - "Tarbosaurus", - "Tyrannosaurus", - "Albertasaurus"}; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nSort(dinosaurs, 3, 3)"); - Array::Sort(dinosaurs, 3, 3); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - ReverseComparer^ rc = gcnew ReverseComparer(); - - Console::WriteLine("\nSort(dinosaurs, 3, 3, rc)"); - Array::Sort(dinosaurs, 3, 3, rc); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Tarbosaurus -Tyrannosaurus -Albertasaurus - -Sort(dinosaurs, 3, 3) - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Albertasaurus -Tarbosaurus -Tyrannosaurus - -Sort(dinosaurs, 3, 3, rc) - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Tyrannosaurus -Tarbosaurus -Albertasaurus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp deleted file mode 100644 index 1d9c96cc967..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -generic void ShowWhere(array^ arr, int index) -{ - if (index<0) - { - // If the index is negative, it represents the bitwise - // complement of the next larger element in the array. - // - index = ~index; - - Console::Write("Not found. Sorts between: "); - - if (index == 0) - Console::Write("beginning of array and "); - else - Console::Write("{0} and ", arr[index-1]); - - if (index == arr->Length) - Console::WriteLine("end of array."); - else - Console::WriteLine("{0}.", arr[index]); - } - else - { - Console::WriteLine("Found at index {0}.", index); - } -}; - -void main() -{ - array^ dinosaurs = {"Pachycephalosaurus", - "Amargasaurus", - "Tyrannosaurus", - "Mamenchisaurus", - "Deinonychus", - "Edmontosaurus"}; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nSort"); - Array::Sort(dinosaurs); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nBinarySearch for 'Coelophysis':"); - int index = Array::BinarySearch(dinosaurs, "Coelophysis"); - ShowWhere(dinosaurs, index); - - Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':"); - index = Array::BinarySearch(dinosaurs, "Tyrannosaurus"); - ShowWhere(dinosaurs, index); -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Tyrannosaurus -Mamenchisaurus -Deinonychus -Edmontosaurus - -Sort - -Amargasaurus -Deinonychus -Edmontosaurus -Mamenchisaurus -Pachycephalosaurus -Tyrannosaurus - -BinarySearch for 'Coelophysis': -Not found. Sorts between: Amargasaurus and Deinonychus. - -BinarySearch for 'Tyrannosaurus': -Found at index 5. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp deleted file mode 100644 index d19063bd802..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class ReverseComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - // Compare y and x in reverse order. - return y->CompareTo(x); - } -}; - -generic void ShowWhere(array^ arr, int index) -{ - if (index<0) - { - // If the index is negative, it represents the bitwise - // complement of the next larger element in the array. - // - index = ~index; - - Console::Write("Not found. Sorts between: "); - - if (index == 0) - Console::Write("beginning of array and "); - else - Console::Write("{0} and ", arr[index-1]); - - if (index == arr->Length) - Console::WriteLine("end of array."); - else - Console::WriteLine("{0}.", arr[index]); - } - else - { - Console::WriteLine("Found at index {0}.", index); - } -}; - -void main() -{ - array^ dinosaurs = {"Pachycephalosaurus", - "Amargasaurus", - "Tyrannosaurus", - "Mamenchisaurus", - "Deinonychus", - "Edmontosaurus"}; - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - ReverseComparer^ rc = gcnew ReverseComparer(); - - Console::WriteLine("\nSort"); - Array::Sort(dinosaurs, rc); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nBinarySearch for 'Coelophysis':"); - int index = Array::BinarySearch(dinosaurs, "Coelophysis", rc); - ShowWhere(dinosaurs, index); - - Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':"); - index = Array::BinarySearch(dinosaurs, "Tyrannosaurus", rc); - ShowWhere(dinosaurs, index); -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Tyrannosaurus -Mamenchisaurus -Deinonychus -Edmontosaurus - -Sort - -Tyrannosaurus -Pachycephalosaurus -Mamenchisaurus -Edmontosaurus -Deinonychus -Amargasaurus - -BinarySearch for 'Coelophysis': -Not found. Sorts between: Deinonychus and Amargasaurus. - -BinarySearch for 'Tyrannosaurus': -Found at index 0. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp deleted file mode 100644 index 54654202f49..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -void main() -{ - Console::WriteLine("The FullName property (also called the display name) of..."); - Console::WriteLine("...the currently executing assembly:"); - Console::WriteLine(Assembly::GetExecutingAssembly()->FullName); - - Console::WriteLine("...the assembly that contains the Int32 type:"); - Console::WriteLine(int::typeid->Assembly->FullName); -} - -/* This example produces output similar to the following: - -The FullName property (also called the display name) of... -...the currently executing assembly: -ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -...the assembly that contains the Int32 type: -mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp deleted file mode 100644 index 85c7081e152..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -namespace ExportedClassExample -{ - public ref class Example sealed - { - private: - Example() - { - } - - public: - void static EnumerateExportedTypes() - { - for each (Type^ exportedType in - Example::typeid->Assembly->GetExportedTypes()) - { - Console::WriteLine(exportedType); - } - } - }; - - public ref class PublicClass - { - public: - ref class PublicNestedClass - { - }; - - protected: - ref class ProtectedNestedClass - { - }; - - internal: - ref class FriendNestedClass - { - }; - - private: - ref class PrivateNestedClass - { - }; - }; - - ref class FriendClass - { - public: - ref class PublicNestedClass - { - }; - - protected: - ref class ProtectedNestedClass - { - }; - - internal: - ref class FriendNestedClass - { - }; - - private: - ref class PrivateNestedClass - { - }; - }; -} - -int main() -{ - ExportedClassExample::Example::EnumerateExportedTypes(); - - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp deleted file mode 100644 index 8735dfb6dac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; -int main() -{ - // You must supply a valid fully qualified assembly name. - Assembly^ SampleAssembly = Assembly::Load - ( "SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3" ); - array^ Types = SampleAssembly->GetTypes(); - - // Display all the types contained in the specified assembly. - IEnumerator^ myEnum = Types->GetEnumerator(); - Type^ oType; - while ( myEnum->MoveNext() ) - { - oType = safe_cast(myEnum->Current); - Console::WriteLine( oType->Name ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp deleted file mode 100644 index d5ff911a579..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Resources; - -/* - The following program demonstrates the 'DefineResource' and 'DefineVersionInfoResource' - methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime. - The unmanaged version information like product, product version, Company, Copyright, - trademark are defined with 'DefineVersionInfoResource' method. -*/ -static Type^ CreateAssembly( AppDomain^ appDomain ); - -int main() -{ - AssemblyBuilder^ myAssembly; - IResourceWriter^ myResourceWriter; - myAssembly = safe_cast(CreateAssembly( Thread::GetDomain() )->Assembly); - myResourceWriter = myAssembly->DefineResource( "myResourceFile", "A sample Resource File", "MyEmitAssembly.MyResource.resources" ); - myResourceWriter->AddResource( "AddResource 1", "First added resource" ); - myResourceWriter->AddResource( "AddResource 2", "Second added resource" ); - myResourceWriter->AddResource( "AddResource 3", "Third added resource" ); - myAssembly->DefineVersionInfoResource( "AssemblySample", "2:0:0:1", "Microsoft Corporation", "@Copyright Microsoft Corp. 1990-2001", ".NET is a trademark of Microsoft Corporation" ); - myAssembly->Save( "MyEmitAssembly.dll" ); -} - -// Create the callee transient dynamic assembly. -static Type^ CreateAssembly( AppDomain^ appDomain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "MyEmitAssembly"; - AssemblyBuilder^ myAssembly = appDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); - - // Define a public class named "HelloWorld" in the assembly. - TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Define the Display method. - MethodBuilder^ myMethod = helloWorldClass->DefineMethod( "Display", MethodAttributes::Public, String::typeid, nullptr ); - - // Generate IL for GetGreeting. - ILGenerator^ methodIL = myMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldstr, "Display method get called." ); - methodIL->Emit( OpCodes::Ret ); - - // Returns the type HelloWorld. - return (helloWorldClass->CreateType()); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp deleted file mode 100644 index 28daac1e840..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -void main() -{ - // This code creates an assembly that contains one type, - // named "MyDynamicType", that has a private field, a property - // that gets and sets the private field, constructors that - // initialize the private field, and a method that multiplies - // a user-supplied number by the private field value and returns - // the result. In Visual C++ the type might look like this: - /* - public ref class MyDynamicType - { - private: - int m_number; - - public: - MyDynamicType() : m_number(42) {}; - MyDynamicType(int initNumber) : m_number(initNumber) {}; - - property int Number - { - int get() { return m_number; } - void set(int value) { m_number = value; } - } - - int MyMethod(int multiplier) - { - return m_number * multiplier; - } - }; - */ - - AssemblyName^ aName = gcnew AssemblyName("DynamicAssemblyExample"); - AssemblyBuilder^ ab = - AssemblyBuilder::DefineDynamicAssembly( - aName, - AssemblyBuilderAccess::Run); - - // The module name is usually the same as the assembly name - ModuleBuilder^ mb = - ab->DefineDynamicModule(aName->Name); - - TypeBuilder^ tb = mb->DefineType( - "MyDynamicType", - TypeAttributes::Public); - - // Add a private field of type int (Int32). - FieldBuilder^ fbNumber = tb->DefineField( - "m_number", - int::typeid, - FieldAttributes::Private); - - // Define a constructor that takes an integer argument and - // stores it in the private field. - array^ parameterTypes = { int::typeid }; - ConstructorBuilder^ ctor1 = tb->DefineConstructor( - MethodAttributes::Public, - CallingConventions::Standard, - parameterTypes); - - ILGenerator^ ctor1IL = ctor1->GetILGenerator(); - // For a constructor, argument zero is a reference to the new - // instance. Push it on the stack before calling the base - // class constructor. Specify the default constructor of the - // base class (System::Object) by passing an empty array of - // types (Type::EmptyTypes) to GetConstructor. - ctor1IL->Emit(OpCodes::Ldarg_0); - ctor1IL->Emit(OpCodes::Call, - Object::typeid->GetConstructor(Type::EmptyTypes)); - // Push the instance on the stack before pushing the argument - // that is to be assigned to the private field m_number. - ctor1IL->Emit(OpCodes::Ldarg_0); - ctor1IL->Emit(OpCodes::Ldarg_1); - ctor1IL->Emit(OpCodes::Stfld, fbNumber); - ctor1IL->Emit(OpCodes::Ret); - - // Define a default constructor that supplies a default value - // for the private field. For parameter types, pass the empty - // array of types or pass nullptr. - ConstructorBuilder^ ctor0 = tb->DefineConstructor( - MethodAttributes::Public, - CallingConventions::Standard, - Type::EmptyTypes); - - ILGenerator^ ctor0IL = ctor0->GetILGenerator(); - ctor0IL->Emit(OpCodes::Ldarg_0); - ctor0IL->Emit(OpCodes::Call, - Object::typeid->GetConstructor(Type::EmptyTypes)); - // For a constructor, argument zero is a reference to the new - // instance. Push it on the stack before pushing the default - // value on the stack. - ctor0IL->Emit(OpCodes::Ldarg_0); - ctor0IL->Emit(OpCodes::Ldc_I4_S, 42); - ctor0IL->Emit(OpCodes::Stfld, fbNumber); - ctor0IL->Emit(OpCodes::Ret); - - // Define a property named Number that gets and sets the private - // field. - // - // The last argument of DefineProperty is nullptr, because the - // property has no parameters. (If you don't specify nullptr, you must - // specify an array of Type objects. For a parameterless property, - // use the built-in array with no elements: Type::EmptyTypes) - PropertyBuilder^ pbNumber = tb->DefineProperty( - "Number", - PropertyAttributes::HasDefault, - int::typeid, - nullptr); - - // The property "set" and property "get" methods require a special - // set of attributes. - MethodAttributes getSetAttr = MethodAttributes::Public | - MethodAttributes::SpecialName | MethodAttributes::HideBySig; - - // Define the "get" accessor method for Number. The method returns - // an integer and has no arguments. (Note that nullptr could be - // used instead of Types::EmptyTypes) - MethodBuilder^ mbNumberGetAccessor = tb->DefineMethod( - "get_Number", - getSetAttr, - int::typeid, - Type::EmptyTypes); - - ILGenerator^ numberGetIL = mbNumberGetAccessor->GetILGenerator(); - // For an instance property, argument zero is the instance. Load the - // instance, then load the private field and return, leaving the - // field value on the stack. - numberGetIL->Emit(OpCodes::Ldarg_0); - numberGetIL->Emit(OpCodes::Ldfld, fbNumber); - numberGetIL->Emit(OpCodes::Ret); - - // Define the "set" accessor method for Number, which has no return - // type and takes one argument of type int (Int32). - MethodBuilder^ mbNumberSetAccessor = tb->DefineMethod( - "set_Number", - getSetAttr, - nullptr, - gcnew array { int::typeid }); - - ILGenerator^ numberSetIL = mbNumberSetAccessor->GetILGenerator(); - // Load the instance and then the numeric argument, then store the - // argument in the field. - numberSetIL->Emit(OpCodes::Ldarg_0); - numberSetIL->Emit(OpCodes::Ldarg_1); - numberSetIL->Emit(OpCodes::Stfld, fbNumber); - numberSetIL->Emit(OpCodes::Ret); - - // Last, map the "get" and "set" accessor methods to the - // PropertyBuilder. The property is now complete. - pbNumber->SetGetMethod(mbNumberGetAccessor); - pbNumber->SetSetMethod(mbNumberSetAccessor); - - // Define a method that accepts an integer argument and returns - // the product of that integer and the private field m_number. This - // time, the array of parameter types is created on the fly. - MethodBuilder^ meth = tb->DefineMethod( - "MyMethod", - MethodAttributes::Public, - int::typeid, - gcnew array { int::typeid }); - - ILGenerator^ methIL = meth->GetILGenerator(); - // To retrieve the private instance field, load the instance it - // belongs to (argument zero). After loading the field, load the - // argument one and then multiply. Return from the method with - // the return value (the product of the two numbers) on the - // execution stack. - methIL->Emit(OpCodes::Ldarg_0); - methIL->Emit(OpCodes::Ldfld, fbNumber); - methIL->Emit(OpCodes::Ldarg_1); - methIL->Emit(OpCodes::Mul); - methIL->Emit(OpCodes::Ret); - - // Finish the type-> - Type^ t = tb->CreateType(); - - // Because AssemblyBuilderAccess includes Run, the code can be - // executed immediately. Start by getting reflection objects for - // the method and the property. - MethodInfo^ mi = t->GetMethod("MyMethod"); - PropertyInfo^ pi = t->GetProperty("Number"); - - // Create an instance of MyDynamicType using the default - // constructor. - Object^ o1 = Activator::CreateInstance(t); - - // Display the value of the property, then change it to 127 and - // display it again. Use nullptr to indicate that the property - // has no index. - Console::WriteLine("o1->Number: {0}", pi->GetValue(o1, nullptr)); - pi->SetValue(o1, 127, nullptr); - Console::WriteLine("o1->Number: {0}", pi->GetValue(o1, nullptr)); - - // Call MyMethod, passing 22, and display the return value, 22 - // times 127. Arguments must be passed as an array, even when - // there is only one. - array^ arguments = { 22 }; - Console::WriteLine("o1->MyMethod(22): {0}", - mi->Invoke(o1, arguments)); - - // Create an instance of MyDynamicType using the constructor - // that specifies m_Number. The constructor is identified by - // matching the types in the argument array. In this case, - // the argument array is created on the fly. Display the - // property value. - Object^ o2 = Activator::CreateInstance(t, - gcnew array { 5280 }); - Console::WriteLine("o2->Number: {0}", pi->GetValue(o2, nullptr)); -}; - -/* This code produces the following output: - -o1->Number: 42 -o1->Number: 127 -o1->MyMethod(22): 2794 -o2->Number: 5280 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj deleted file mode 100644 index f0b6e04f882..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj +++ /dev/null @@ -1,147 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 15.0 - {2C2BE6AE-166F-4B41-8A58-5A6088ED4869} - v4.7.2 - ManagedCProj - AssemblyBuilderClass - 10.0.17134.0 - - - - Application - true - v141 - true - Unicode - - - Application - false - v141 - true - Unicode - - - Application - true - v141 - true - Unicode - - - Application - false - v141 - true - Unicode - - - - - - - - - - - - - - - - - - - - - true - - - true - - - false - - - false - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - - - - Console - - - - - NotUsing - Level3 - Disabled - _DEBUG;%(PreprocessorDefinitions) - - - - Console - - - - - NotUsing - Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - - - - Console - - - - - NotUsing - Level3 - NDEBUG;%(PreprocessorDefinitions) - - - - Console - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json deleted file mode 100644 index da9ebf8da2f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "host": "visualstudio" -} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp deleted file mode 100644 index be95d74e2dc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -/* - The following program demonstrates the 'DefineResource' and 'DefineUnmanagedResource' - methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime. - An unmanaged resource file is also defined for the same resource file. The EmittedTest2.cpp file - calls the methods of "MyEmitAssembly.dll" assembly and the message is displayed to console. -*/ -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Resources; - - static AssemblyBuilder^ CreateAssembly( String^ name ) - { - AssemblyName^ aName = gcnew AssemblyName(name); - AssemblyBuilder^ myAssembly = - AppDomain::CurrentDomain->DefineDynamicAssembly( aName, - AssemblyBuilderAccess::Save ); - - // Define a dynamic module. - ModuleBuilder^ myModule = - myAssembly->DefineDynamicModule( aName->Name, aName->Name + ".dll" ); - - // Define a public class named "EmitClass" in the assembly. - TypeBuilder^ myEmitClass = - myModule->DefineType( "EmitClass", TypeAttributes::Public ); - - // Define the Display method. - MethodBuilder^ myMethod = - myEmitClass->DefineMethod( "Display", MethodAttributes::Public, - String::typeid, nullptr ); - - // Generate IL for Display method. - ILGenerator^ methodIL = myMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldstr, "Display method gets called." ); - methodIL->Emit( OpCodes::Ret ); - - myEmitClass->CreateType(); - - return (myAssembly); - }; - - // - // - void main() - { - AssemblyBuilder^ myAssembly = CreateAssembly("MyEmitTestAssembly"); - - // Defines a standalone managed resource for this assembly. - IResourceWriter^ myResourceWriter = - myAssembly->DefineResource( "myResourceFile", "A sample Resource File", - "MyAssemblyResource.resources", ResourceAttributes::Private ); - - myResourceWriter->AddResource( "AddResource Test", "Testing for the added resource" ); - - myAssembly->Save(myAssembly->GetName()->Name + ".dll" ); - - // Defines an unmanaged resource file for this assembly. - myAssembly->DefineUnmanagedResource( "MyAssemblyResource.resources" ); - }; - -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp deleted file mode 100644 index 6f099f1d8c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -/* - The following program demonstrates the 'DefineResource' and 'DefineUnmanagedResource' - methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime. - An unmanaged resource file is also defined for the same resource file. The EmittedTest2.cpp file - calls the methods of "MyEmitAssembly.dll" assembly and the message is displayed to console. -*/ -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Resources; - - static AssemblyBuilder^ CreateAssembly( String^ name ) - { - AssemblyName^ aName = gcnew AssemblyName(name); - AssemblyBuilder^ myAssembly = - AppDomain::CurrentDomain->DefineDynamicAssembly( aName, - AssemblyBuilderAccess::Save ); - - // Define a dynamic module. - ModuleBuilder^ myModule = - myAssembly->DefineDynamicModule( aName->Name, aName->Name + ".dll" ); - - // Define a public class named "EmitClass" in the assembly. - TypeBuilder^ myEmitClass = - myModule->DefineType( "EmitClass", TypeAttributes::Public ); - - // Define the Display method. - MethodBuilder^ myMethod = - myEmitClass->DefineMethod( "Display", MethodAttributes::Public, - String::typeid, nullptr ); - - // Generate IL for Display method. - ILGenerator^ methodIL = myMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldstr, "Display method gets called." ); - methodIL->Emit( OpCodes::Ret ); - - myEmitClass->CreateType(); - - return (myAssembly); - }; - - // - // - void main() - { - AssemblyBuilder^ myAssembly = CreateAssembly("MyEmitTestAssembly"); - - // Defines a standalone managed resource for this assembly. - IResourceWriter^ myResourceWriter = - myAssembly->DefineResource( "myResourceFile", "A sample Resource File", - "MyAssemblyResource.resources", ResourceAttributes::Private ); - - myResourceWriter->AddResource( "AddResource Test", "Testing for the added resource" ); - - myAssembly->Save(myAssembly->GetName()->Name + ".dll" ); - - // Defines an unmanaged resource file for this assembly. - myAssembly->DefineUnmanagedResource( gcnew array{01, 00, 01} ); - }; - -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp deleted file mode 100644 index 8b17c3f5d4f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp +++ /dev/null @@ -1,167 +0,0 @@ -// System::Reflection::Emit::AssemblyBuilder.DefineVersionInfoResource() - -// This code example shows how to use the AssemblyBuilder::DefineVersionInfoResource method -// to add Windows version information to a dynamic assembly. The code example builds an -// assembly with one module and no types. Several attributes are applied to the assembly, -// DefineVersionInfoResource is used to create the Windows version information resource, -// and then the assembly is saved as EmittedAssembly.exe. The Windows Explorer can be used -// to examine the version information for the assembly. - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - - -/* -// Create the callee transient dynamic assembly. -static Type^ CreateAssembly( AppDomain^ myDomain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "MyEmittedAssembly"; - AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); - - // Set Company Attribute to the assembly. - Type^ companyAttribute = AssemblyCompanyAttribute::typeid; - array^types1 = {String::typeid}; - ConstructorInfo^ myConstructorInfo1 = companyAttribute->GetConstructor( types1 ); - array^obj1 = {"Microsoft Corporation"}; - CustomAttributeBuilder^ attributeBuilder1 = gcnew CustomAttributeBuilder( myConstructorInfo1,obj1 ); - myAssembly->SetCustomAttribute( attributeBuilder1 ); - - // Set Copyright Attribute to the assembly. - Type^ copyrightAttribute = AssemblyCopyrightAttribute::typeid; - array^types2 = {String::typeid}; - ConstructorInfo^ myConstructorInfo2 = copyrightAttribute->GetConstructor( types2 ); - array^obj2 = {"@Copyright Microsoft Corp. 1990-2001"}; - CustomAttributeBuilder^ attributeBuilder2 = gcnew CustomAttributeBuilder( myConstructorInfo2,obj2 ); - myAssembly->SetCustomAttribute( attributeBuilder2 ); - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); - - // Define a public class named S"HelloWorld" in the assembly. - TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Define the Display method. - MethodBuilder^ myMethod = helloWorldClass->DefineMethod( "Display", MethodAttributes::Public, String::typeid, nullptr ); - - // Generate IL for GetGreeting. - ILGenerator^ methodIL = myMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldstr, "Display method get called." ); - methodIL->Emit( OpCodes::Ret ); - - // Returns the type HelloWorld. - return (helloWorldClass->CreateType()); -} -*/ - -int main() -{ - AssemblyName^ assemName = gcnew AssemblyName(); - assemName->Name = "EmittedAssembly"; - - // Create a dynamic assembly in the current application domain, - // specifying that the assembly is to be saved. - // - AssemblyBuilder^ myAssembly = - AppDomain::CurrentDomain->DefineDynamicAssembly(assemName, - AssemblyBuilderAccess::Save); - - - // To apply an attribute to a dynamic assembly, first get the - // attribute type. The AssemblyFileVersionAttribute sets the - // File Version field on the Version tab of the Windows file - // properties dialog. - // - Type^ attributeType = AssemblyFileVersionAttribute::typeid; - - // To identify the constructor, use an array of types representing - // the constructor's parameter types. This ctor takes a string. - // - array^ ctorParameters = { String::typeid }; - - // Get the constructor for the attribute. - // - ConstructorInfo^ ctor = attributeType->GetConstructor(ctorParameters); - - // Pass the constructor and an array of arguments (in this case, - // an array containing a single string) to the - // CustomAttributeBuilder constructor. - // - array^ ctorArgs = { "2.0.3033.0" }; - CustomAttributeBuilder^ attribute = - gcnew CustomAttributeBuilder(ctor, ctorArgs); - - // Finally, apply the attribute to the assembly. - // - myAssembly->SetCustomAttribute(attribute); - - - // The pattern described above is used to create and apply - // several more attributes. As it happens, all these attributes - // have a constructor that takes a string, so the same ctorArgs - // variable works for all of them. - - - // The AssemblyTitleAttribute sets the Description field on - // the General tab and the Version tab of the Windows file - // properties dialog. - // - attributeType = AssemblyTitleAttribute::typeid; - ctor = attributeType->GetConstructor(ctorParameters); - ctorArgs = gcnew array { "The Application Title" }; - attribute = gcnew CustomAttributeBuilder(ctor, ctorArgs); - myAssembly->SetCustomAttribute(attribute); - - // The AssemblyCopyrightAttribute sets the Copyright field on - // the Version tab. - // - attributeType = AssemblyCopyrightAttribute::typeid; - ctor = attributeType->GetConstructor(ctorParameters); - ctorArgs = gcnew array { "� My Example Company 1991-2005" }; - attribute = gcnew CustomAttributeBuilder(ctor, ctorArgs); - myAssembly->SetCustomAttribute(attribute); - - // The AssemblyDescriptionAttribute sets the Comment item. - // - attributeType = AssemblyDescriptionAttribute::typeid; - ctor = attributeType->GetConstructor(ctorParameters); - attribute = gcnew CustomAttributeBuilder(ctor, - gcnew array { "This is a comment." }); - myAssembly->SetCustomAttribute(attribute); - - // The AssemblyCompanyAttribute sets the Company item. - // - attributeType = AssemblyCompanyAttribute::typeid; - ctor = attributeType->GetConstructor(ctorParameters); - attribute = gcnew CustomAttributeBuilder(ctor, - gcnew array { "My Example Company" }); - myAssembly->SetCustomAttribute(attribute); - - // The AssemblyProductAttribute sets the Product Name item. - // - attributeType = AssemblyProductAttribute::typeid; - ctor = attributeType->GetConstructor(ctorParameters); - attribute = gcnew CustomAttributeBuilder(ctor, - gcnew array { "My Product Name" }); - myAssembly->SetCustomAttribute(attribute); - - - // Define the assembly's only module. For a single-file assembly, - // the module name is the assembly name. - // - ModuleBuilder^ myModule = - myAssembly->DefineDynamicModule(assemName->Name, - assemName->Name + ".exe"); - - // No types or methods are created for this example. - - - // Define the unmanaged version information resource, which - // contains the attribute informaion applied earlier, and save - // the assembly. Use the Windows Explorer to examine the properties - // of the .exe file. - // - myAssembly->DefineVersionInfoResource(); - myAssembly->Save(assemName->Name + ".exe"); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp deleted file mode 100644 index 668ee141f99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp +++ /dev/null @@ -1,62 +0,0 @@ - -// System.Reflection.Emit.SetCustomAttribute(CustomAttributeBuilder) -/* -The following program demonstrates the 'SetCustomAttribute(CustomAttributeBuilder)' -method of 'AssemblyBuilder' class. It defines a 'MyAttribute' class which is derived -from 'Attribute' class. It builds an assembly by setting 'MyAttribute' custom attribute -and defines 'HelloWorld' type. Then it gets the custom attributes of 'HelloWorld' type -and displays its contents to the console. -*/ -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute: public Attribute -{ -public: - String^ s; - int x; - MyAttribute( String^ s, int x ) - { - this->s = s; - this->x = x; - } -}; - -Type^ CreateCallee( AppDomain^ domain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - Type^ myType = MyAttribute::typeid; - array^temp0 = {String::typeid,int::typeid}; - ConstructorInfo^ infoConstructor = myType->GetConstructor( temp0 ); - array^temp1 = {"Hello",2}; - CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( infoConstructor,temp1 ); - myAssembly->SetCustomAttribute( attributeBuilder ); - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Define a public class named "HelloWorld" in the assembly. - TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - return (helloWorldClass->CreateType()); -} - -int main() -{ - Type^ customAttribute = CreateCallee( Thread::GetDomain() ); - array^attributes = customAttribute->Assembly->GetCustomAttributes( true ); - Console::WriteLine( "MyAttribute custom attribute contains : " ); - for ( int index = 0; index < attributes->Length; index++ ) - { - if ( dynamic_cast(attributes[ index ]) ) - { - Console::WriteLine( "s : {0}", (dynamic_cast(attributes[ index ]))->s ); - Console::WriteLine( "x : {0}", (dynamic_cast(attributes[ index ]))->x ); - break; - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp deleted file mode 100644 index 008090d756e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// System.Reflection.Emit.SetCustomAttribute(ConstructorInfo, byte[]) -/* -The following program demonstrates the 'SetCustomAttribute(ConstructorInfo, byte[])' -method of 'AssemblyBuilder' class. It defines a 'MyAttribute' class which is derived -from 'Attribute' class. It builds an assembly by setting 'MyAttribute' custom attribute -and defines 'HelloWorld' type. Then it gets the custom attributes of 'HelloWorld' type -and displays its contents to the console. -*/ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute: public Attribute -{ -public: - bool s; - MyAttribute( bool s ) - { - this->s = s; - } -}; - -Type^ CreateCallee( AppDomain^ domain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - Type^ myType = MyAttribute::typeid; - array^temp0 = {bool::typeid}; - ConstructorInfo^ infoConstructor = myType->GetConstructor( temp0 ); - array^temp1 = {01,00,01}; - myAssembly->SetCustomAttribute( infoConstructor, temp1 ); - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Define a public class named "HelloWorld" in the assembly. - TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - return (helloWorldClass->CreateType()); -} - -int main() -{ - Type^ customAttribute = CreateCallee( Thread::GetDomain() ); - array^attributes = customAttribute->Assembly->GetCustomAttributes( true ); - Console::WriteLine( "MyAttribute custom attribute contains : " ); - for ( int index = 0; index < attributes->Length; index++ ) - { - if ( dynamic_cast(attributes[ index ]) ) - { - Console::WriteLine( "s : {0}", (dynamic_cast(attributes[ index ]))->s ); - break; - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp deleted file mode 100644 index 2384a6c6a11..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Permissions; - -[assembly:AssemblyVersionAttribute("1.0.2000.0")]; - -public ref class Example -{ -private: - int factor; - -public: - Example(int f) - { - factor = f; - } - - int SampleMethod(int x) - { - Console::WriteLine("\nExample->SampleMethod({0}) executes.", x); - return x * factor; - } -}; - -void main() -{ - Assembly^ assem = Example::typeid->Assembly; - - Console::WriteLine("Assembly Full Name:"); - Console::WriteLine(assem->FullName); - - // The AssemblyName type can be used to parse the full name. - AssemblyName^ assemName = assem->GetName(); - Console::WriteLine("\nName: {0}", assemName->Name); - Console::WriteLine("Version: {0}.{1}", - assemName->Version->Major, assemName->Version->Minor); - - Console::WriteLine("\nAssembly CodeBase:"); - Console::WriteLine(assem->CodeBase); - - // Create an object from the assembly, passing in the correct number and - // type of arguments for the constructor. - Object^ o = assem->CreateInstance("Example", false, - BindingFlags::ExactBinding, - nullptr, gcnew array { 2 }, nullptr, nullptr); - - // Make a late-bound call to an instance method of the object. - MethodInfo^ m = assem->GetType("Example")->GetMethod("SampleMethod"); - Object^ ret = m->Invoke(o, gcnew array { 42 }); - Console::WriteLine("SampleMethod returned {0}.", ret); - - Console::WriteLine("\nAssembly entry point:"); - Console::WriteLine(assem->EntryPoint); -} - -/* This code example produces output similar to the following: - -Assembly Full Name: -source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null - -Name: source -Version: 1.0 - -Assembly CodeBase: -file:///C:/sdtree/AssemblyClass/cpp/source.exe - -Example->SampleMethod(42) executes. -SampleMethod returned 84. - -Assembly entry point: -UInt32 _mainCRTStartup() - */ -// - diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp deleted file mode 100644 index 9ec81948d79..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// Per Kitg, from cut QuickStart (vswhidbey 160832) -// -using namespace System; -using namespace System::Reflection; - -[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")]; -[assembly:AssemblyDelaySignAttribute(true)]; - -namespace DelaySign -{ - public ref class Test { }; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp deleted file mode 100644 index 28ca23085e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Specify a combination of AssemblyNameFlags for this -// assembly. -[assembly:AssemblyFlagsAttribute( - AssemblyNameFlags::EnableJITcompileOptimizer - | AssemblyNameFlags::Retargetable)]; - -public ref class Example -{ -public: - static void Main() - { - // Get this assembly. - Assembly^ thisAsm = Example::typeid->Assembly; - - // Get the AssemblyName for this assembly. - AssemblyName^ thisAsmName = thisAsm->GetName( false ); - - // Display the flags that were set for this assembly. - ListFlags( thisAsmName->Flags ); - - // Create an instance of AssemblyFlagsAttribute with the - // same combination of flags that was specified for this - // assembly. Note that PublicKey is included automatically - // for the assembly, but not for this instance of - // AssemblyFlagsAttribute. - AssemblyFlagsAttribute^ afa = gcnew AssemblyFlagsAttribute( - static_cast (AssemblyNameFlags::EnableJITcompileOptimizer - | AssemblyNameFlags::Retargetable) ); - - // Get the flags. The property returns an integer, so - // the return value must be cast to AssemblyNameFlags. - AssemblyNameFlags anf = static_cast(afa->AssemblyFlags); - - // Display the flags. - Console::WriteLine(); - ListFlags( anf ); - } - -private: - static void ListFlags( AssemblyNameFlags anf ) - { - if ( anf == AssemblyNameFlags::None ) - { - Console::WriteLine( L"AssemblyNameFlags.None" ); - } - else - { - if ( 0 != static_cast(anf & AssemblyNameFlags::Retargetable) ) - Console::WriteLine( L"AssemblyNameFlags.Retargetable" ); - if ( 0 != static_cast(anf & AssemblyNameFlags::PublicKey) ) - Console::WriteLine( L"AssemblyNameFlags.PublicKey" ); - if ( 0 != static_cast(anf & AssemblyNameFlags::EnableJITcompileOptimizer) ) - Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileOptimizer" ); - if ( 0 != static_cast(anf & AssemblyNameFlags::EnableJITcompileTracking) ) - Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileTracking" ); - } - } - -}; - -int main() -{ - Example::Main(); -} - -/* This code example produces the following output: - -AssemblyNameFlags.Retargetable -AssemblyNameFlags.PublicKey -AssemblyNameFlags.EnableJITcompileOptimizer - -AssemblyNameFlags.Retargetable -AssemblyNameFlags.EnableJITcompileOptimizer -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp deleted file mode 100644 index 727999e0bf2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// System::Configuration::Install::AssemblyInstaller -/* The following example demonstrates the 'AssemblyInstaller' class. -An object of the AssemblyInstaller class is created by invoking the constructor. -The properties of this object are set and the install and commit methods are -called to install the 'MyAssembly.exe' assembly. -*/ -// -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Collections; -using namespace System::Collections::Specialized; -int main() -{ - IDictionary^ mySavedState = gcnew Hashtable; - Console::WriteLine( "" ); - try - { - - // Set the commandline argument array for 'logfile'. - array^commandLineOptions = {"/LogFile=example.log"}; - - // Create an object of the 'AssemblyInstaller' class. - AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller( - "MyAssembly.exe", commandLineOptions ); - myAssemblyInstaller->UseNewContext = true; - - // Install the 'MyAssembly' assembly. - myAssemblyInstaller->Install( mySavedState ); - - // Commit the 'MyAssembly' assembly. - myAssemblyInstaller->Commit( mySavedState ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp deleted file mode 100644 index 15aa57873e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// System::Configuration::Install::AssemblyInstaller.CheckIfInstallable -/* The following example demonstrates the 'CheckIfInstallable' method -of the 'AssemblyInstaller' class. -The 'CheckIfInstallable' method is applied to an existent and -nonexistent assembly and the results of the call are displayed -onto the console. -*/ -// -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -int main() -{ - try - { - - // Determine whether the assembly 'MyAssembly' is installable. - AssemblyInstaller::CheckIfInstallable( "MyAssembly_CheckIfInstallable.exe" ); - Console::WriteLine( "The assembly 'MyAssembly_CheckIfInstallable' is installable" ); - - // Determine whether the assembly 'NonExistant' is installable. - AssemblyInstaller::CheckIfInstallable( "NonExistant" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp deleted file mode 100644 index 837a4ff8d94..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// System::Configuration::Install::AssemblyInstaller.UseNewContext -// System::Configuration::Install::AssemblyInstaller.HelpText -/* The following example demonstrates the 'UseNewContext' and the -'HelpText' properties of the 'AssemblyInstaller' class. -An object of the AssemblyInstaller class is created by invoking the constructor. -The 'UseNewContext' property of this object is set to true and the install -method is invoked on the 'MyAssembly_HelpText.exe' assembly. Due -to this the log messages are displayed on the console. The 'HelpText' -property for the object is displayed on the console. -*/ -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void main() -{ - IDictionary^ mySavedState = gcnew Hashtable; - Console::WriteLine( "" ); - try - { - array^ commandLineOptions = {"/LogFile=example.log"}; - - // - // Create an Object* of the 'AssemblyInstaller' class. - AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller( - "MyAssembly_HelpText.exe", commandLineOptions ); - - // Set the 'UseNewContext' property to true. - myAssemblyInstaller->UseNewContext = true; - - // - // Install the 'MyAssembly_HelpText' assembly. - myAssemblyInstaller->Install( mySavedState ); - - // - Console::WriteLine( "The 'HelpText' is-" ); - - // Display the 'HelpText' of this AssemblyInstaller Object*. - Console::WriteLine( myAssemblyInstaller->HelpText ); - - // - } - catch ( ArgumentException^ ) - { - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp deleted file mode 100644 index 27158e54816..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Configuration::Install::AssemblyInstaller.AssemblyInstaller() -// System::Configuration::Install::AssemblyInstaller.Install -// System::Configuration::Install::AssemblyInstaller.Commit -/* The following example demonstrates the 'AssemblyInstaller()' constructor and -the 'Install' and 'Commit' methods of the 'AssemblyInstaller' class. -An object of the AssemblyInstaller class is created by invoking the constructor. -The properties of this object are set and the install and commit methods are -called to install the 'MyAssembly_Install.exe' assembly. -*/ -// -// -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void main() -{ - IDictionary^ mySavedState = gcnew Hashtable; - Console::WriteLine( "" ); - try - { - // Set the commandline argument array for 'logfile'. - array^myString = {"/logFile=example.log"}; - - // - // Create an Object* of the 'AssemblyInstaller' class. - AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; - // - - // Set the properties to install the required assembly. - myAssemblyInstaller->Path = "MyAssembly_Install.exe"; - myAssemblyInstaller->CommandLine = myString; - myAssemblyInstaller->UseNewContext = true; - - // Clear the 'IDictionary' Object*. - mySavedState->Clear(); - - // Install the 'MyAssembly_Install' assembly. - myAssemblyInstaller->Install( mySavedState ); - - // Commit the 'MyAssembly_Install' assembly. - myAssemblyInstaller->Commit( mySavedState ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp deleted file mode 100644 index 6d5648101ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// System::Configuration::Install::AssemblyInstaller.Rollback -// System::Configuration::Install::AssemblyInstaller.Path -// System::Configuration::Install::AssemblyInstaller.CommandLine -/* The following example demonstrates the 'Rollback' method and the -'Path' and 'CommandLine' properties of the 'AssemblyInstaller' class. -An object of the AssemblyInstaller class is created by invoking the constructor. -The properties of this object are set and the install method is invoked on the -'MyAssembly.exe' assembly. The 'Rollback' method is called to undo the -install process on the specified assembly. -*/ -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void main() -{ - IDictionary^ mySavedState = gcnew Hashtable; - Console::WriteLine( "" ); - try - { - // - // Create an object of the 'AssemblyInstaller' class. - AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; - - // Set the path property of the AssemblyInstaller object. - myAssemblyInstaller->Path = "MyAssembly_Rollback.exe"; - - // - // - // Set the logfile name in the commandline argument array. - array^commandLineOptions = {"/LogFile=example.log"}; - myAssemblyInstaller->CommandLine = commandLineOptions; - - // - // Set the 'UseNewContext' property to true. - myAssemblyInstaller->UseNewContext = true; - - // Install the 'MyAssembly_Rollback' assembly. - myAssemblyInstaller->Install( mySavedState ); - - // - // 'Rollback' the installation process. - myAssemblyInstaller->Rollback( mySavedState ); - - // - } - catch ( ArgumentException^ ) - { - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp deleted file mode 100644 index 44a53315ff6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// System::Configuration::Install::AssemblyInstaller.AssemblyInstaller(String*, String*->Item[]) -// System::Configuration::Install::AssemblyInstaller.Uninstall -/* The following example demonstrates the 'AssemblyInstaller(String*, String*->Item[])' -constructor and the 'Uninstall' method of the 'AssemblyInstaller' class. -An object of the AssemblyInstaller class is created by invoking the constructor -with the assembly to install and the commandline argument array as -parameters. The uninstall method is called after installing and committing -the assembly passed as the parameter to the constructor. -*/ -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void main() -{ - IDictionary^ mySavedState = gcnew Hashtable; - Console::WriteLine( "" ); - try - { - // - array^myStringArray = {"/logFile=example.log"}; - String^ myString = "MyAssembly_Uninstall.exe"; - - // Create an object of the 'AssemblyInstaller' class. - AssemblyInstaller^ myAssemblyInstaller = - gcnew AssemblyInstaller( myString,myStringArray ); - // - - // Install and commit the 'MyAssembly_Uninstall' assembly. - mySavedState->Clear(); - myAssemblyInstaller->Install( mySavedState ); - myAssemblyInstaller->Commit( mySavedState ); - - // - // Uninstall the 'MyAssembly_Uninstall' assembly. - myAssemblyInstaller->Uninstall( mySavedState ); - // - } - catch ( ArgumentException^ ) - { - } - catch ( Exception^ myException ) - { - Console::WriteLine( myException->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp deleted file mode 100644 index 7a72383a28c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -[assembly:AssemblyVersion("1.1.0.0")]; - -void main() -{ - Console::WriteLine("The version of the currently executing assembly is: {0}", - Assembly::GetExecutingAssembly()->GetName()->Version); - - Console::WriteLine("The version of mscorlib.dll is: {0}", - String::typeid->Assembly->GetName()->Version); -} - -/* This example produces output similar to the following: - -The version of the currently executing assembly is: 1.1.0.0 -The version of mscorlib.dll is: 2.0.0.0 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp deleted file mode 100644 index 1879b4dc9fd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp +++ /dev/null @@ -1,99 +0,0 @@ - -// System::Reflection::AssemblyName::CodeBase -// System::Reflection::AssemblyName::CultureInfo -// System::Reflection::AssemblyName::HashAlgorithm -// System::Reflection::AssemblyName::FullName -/* - The following example demonstrates the 'CodeBase', 'CultureInfo' - 'HashAlgorithm' and 'FullName' properties of the 'AssemblyName' class. Creates - a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and - a type within the module named 'MyType'. The type 'MyType' has a single - method called 'Main' which is also the entry point to the assembly. The - creation of the dynamic assembly is carried out by the method called - 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly' - the assemblies currently loaded are found and the dynamic assembly that we - have created is searched for, which is displayed to the console. The dynamic - assembly is also saved to a file named 'MyAssembly.exe'. - - Note : Run 'MyAssembly.exe' which this example has created for a simple - 'Hello World!' display. -*/ -// -// -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Threading; -using namespace System::IO; -using namespace System::Globalization; -using namespace System::Reflection::Emit; -using namespace System::Configuration::Assemblies; -static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) -{ - // Get the assembly builder from the application domain associated with the current thread. - AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a dynamic module in the assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); - - // Create a method called 'Main'. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); - - // Get the Intermediate Language generator for the method. - ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); - - // Use the utility method to generate the IL instructions that print a String* to the console. - myILGenerator->EmitWriteLine( "Hello World!" ); - - // Generate the 'ret' IL instruction. - myILGenerator->Emit( OpCodes::Ret ); - - // End the creation of the type. - myTypeBuilder->CreateType(); - - // Set the method with name 'Main' as the entry point in the assembly. - myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); - myAssemblyBuilder->Save( fileName ); -} - -int main() -{ - // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - - // Set the codebase to the physical directory were the assembly resides. - myAssemblyName->CodeBase = Directory::GetCurrentDirectory(); - - // Set the culture information of the assembly to 'English-American'. - myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" ); - - // Set the hash algorithm to 'SHA256'. - myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256; - myAssemblyName->Name = "MyAssembly"; - myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); - MakeAssembly( myAssemblyName, "MyAssembly.exe" ); - - // Get all the assemblies currently loaded in the application domain. - array^myAssemblies = Thread::GetDomain()->GetAssemblies(); - - // Get the dynamic assembly named 'MyAssembly'. - Assembly^ myAssembly = nullptr; - for ( int i = 0; i < myAssemblies->Length; i++ ) - { - if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) - myAssembly = myAssemblies[ i ]; - } - if ( myAssembly != nullptr ) - { - Console::WriteLine( "\nDisplaying the full assembly name\n" ); - Console::WriteLine( myAssembly->GetName()->FullName ); - } -} -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp deleted file mode 100644 index 21eae3f4c19..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp +++ /dev/null @@ -1,84 +0,0 @@ - -// System::Reflection::AssemblyName::AssemblyName() -// System::Reflection::AssemblyName::Name -// System::Reflection::AssemblyName::Version -/* - The following example demonstrates the constructor 'AssemblyName()' and - the 'Name' and 'Version' properties of the 'AssemblyName' class. Creates - a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and - a type within the module named 'MyType'. The type 'MyType' has a single - method called 'Main' which is also the entry point to the assembly. The - creation of the dynamic assembly is carried out by the method called - 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly' - the assemblies currently loaded are found and the dynamic assembly that we - have created is searched for, which is displayed to the console. The dynamic - assembly is also saved to a file named 'MyAssembly.exe'. - - Note : Run 'MyAssembly.exe' which this example has created for a simple - 'Hello World!' display. -*/ -// -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Threading; -using namespace System::Reflection::Emit; -static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) -{ - // Get the assembly builder from the application domain associated with the current thread. - AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a dynamic module in the assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); - - // Create a method called 'Main'. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); - - // Get the Intermediate Language generator for the method. - ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); - - // Use the utility method to generate the IL instructions that print a String* to the console. - myILGenerator->EmitWriteLine( "Hello World!" ); - - // Generate the 'ret' IL instruction. - myILGenerator->Emit( OpCodes::Ret ); - - // End the creation of the type. - myTypeBuilder->CreateType(); - - // Set the method with name 'Main' as the entry point in the assembly. - myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); - myAssemblyBuilder->Save( fileName ); -} - -int main() -{ - // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "MyAssembly"; - myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); - MakeAssembly( myAssemblyName, "MyAssembly.exe" ); - - // Get all the assemblies currently loaded in the application domain. - array^myAssemblies = Thread::GetDomain()->GetAssemblies(); - - // Get the dynamic assembly named 'MyAssembly'. - Assembly^ myAssembly = nullptr; - for ( int i = 0; i < myAssemblies->Length; i++ ) - { - if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) - myAssembly = myAssemblies[ i ]; - } - if ( myAssembly != nullptr ) - { - Console::WriteLine( "\nDisplaying the assembly name\n" ); - Console::WriteLine( myAssembly ); - } -} -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp deleted file mode 100644 index 7bd4f7d79f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Simplified snippet per SuzCook tech review. -// -using namespace System; -using namespace System::Reflection; - -int main() -{ - // Create an AssemblyName, specifying the display name, and then - // print the properties. - AssemblyName^ myAssemblyName = - gcnew AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null"); - Console::WriteLine("Name: {0}", myAssemblyName->Name); - Console::WriteLine("Version: {0}", myAssemblyName->Version); - Console::WriteLine("CultureInfo: {0}", myAssemblyName->CultureInfo); - Console::WriteLine("FullName: {0}", myAssemblyName->FullName); -} -/* This code example produces output similar to the following: - -Name: Example -Version: 1.0.0.2001 -CultureInfo: en-US -FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp deleted file mode 100644 index 2f372084604..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -// System::Reflection::AssemblyName::GetAssemblyName(String*) -// System::Reflection::AssemblyName -/* - This example demonstrates the 'GetAssemblyName(String*)' and 'ToString()' - methods of the 'AssemblyName' class. Get the path of 'System.dll' from - the path of 'mscorlib.dll'. Get the assembly information from 'System.dll' - and display the information to the console. - */ -// -// -#using - -using namespace System; -using namespace System::Reflection; -int main() -{ - - // Replace the string "MyAssembly.exe" with the name of an assembly, - // including a path if necessary. If you do not have another assembly - // to use, you can use whatever name you give to this assembly. - // - AssemblyName^ myAssemblyName = AssemblyName::GetAssemblyName( "MyAssembly.exe" ); - Console::WriteLine( "\nDisplaying assembly information:\n" ); - Console::WriteLine( myAssemblyName ); -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp deleted file mode 100644 index ce82c90bc54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp +++ /dev/null @@ -1,123 +0,0 @@ - -// System::Reflection::AssemblyName::KeyPair -// System::Reflection::AssemblyName::GetPublicKey() -// System::Reflection::AssemblyName::GetPublicKeyToken() -// System::Reflection::AssemblyName::Flags -// System::Reflection::AssemblyName::VersionCompatibility -/* - The following example demonstrates the 'GetPublicKey()' and - 'GetPublicKeyToken()' methods and the 'KeyPair', 'Flags' and 'VersionCompatibility' - properties of the 'AssemblyName' class. Creates a dynamic assembly named 'MyAssembly' - with a module named 'MyModule' and a type within the module named 'MyType'. - The type 'MyType' has a single method called 'Main' which is also the entry - point to the assembly. The creation of the dynamic assembly is carried out - by the method called 'MakeAssembly'. After the assembly is created with the - help of 'MakeAssembly' the assemblies currently loaded are found and the - dynamic assembly that we have created is searched for, which is displayed - to the console. Moreover the public key and the public key token are displayed - The dynamic assembly is also saved to a file named 'MyAssembly.exe'. The - dynamic assembly that has been created has a strong name containing a private - and a public key which is generated by a tool named 'Sn.exe'. The key pair - is stored in a file named 'KeyPair.snk'. - - Note : Run 'MyAssembly.exe' which this example has created for a simple - 'Hello World!' display. -*/ -// -// -// -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Threading; -using namespace System::IO; -using namespace System::Globalization; -using namespace System::Reflection::Emit; -using namespace System::Configuration::Assemblies; -using namespace System::Text; -static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) -{ - // Get the assembly builder from the application domain associated with the current thread. - AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a dynamic module in the assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); - - // Create a method called 'Main'. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); - - // Get the Intermediate Language generator for the method. - ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); - - // Use the utility method to generate the IL instructions that print a String* to the console. - myILGenerator->EmitWriteLine( "Hello World!" ); - - // Generate the 'ret' IL instruction. - myILGenerator->Emit( OpCodes::Ret ); - - // End the creation of the type. - myTypeBuilder->CreateType(); - - // Set the method with name 'Main' as the entry point in the assembly. - myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); - myAssemblyBuilder->Save( fileName ); -} - -int main() -{ - // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - - // Set the codebase to the physical directory were the assembly resides. - myAssemblyName->CodeBase = Directory::GetCurrentDirectory(); - - // Set the culture information of the assembly to 'English-American'. - myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" ); - - // Set the hash algorithm to 'SHA256'. - myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256; - myAssemblyName->VersionCompatibility = AssemblyVersionCompatibility::SameProcess; - myAssemblyName->Flags = AssemblyNameFlags::PublicKey; - - // Provide this assembly with a strong name. - myAssemblyName->KeyPair = gcnew StrongNameKeyPair( File::Open( "KeyPair.snk", FileMode::Open, FileAccess::Read ) ); - myAssemblyName->Name = "MyAssembly"; - myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); - MakeAssembly( myAssemblyName, "MyAssembly.exe" ); - - // Get the assemblies loaded in the current application domain. - array^myAssemblies = Thread::GetDomain()->GetAssemblies(); - - // Get the dynamic assembly named 'MyAssembly'. - Assembly^ myAssembly = nullptr; - for ( int i = 0; i < myAssemblies->Length; i++ ) - if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) - myAssembly = myAssemblies[ i ]; - - // Display the full assembly information to the console. - if ( myAssembly != nullptr ) - { - Console::WriteLine( "\nDisplaying the full assembly name.\n" ); - Console::WriteLine( myAssembly->GetName()->FullName ); - Console::WriteLine( "\nDisplaying the public key.\n" ); - array^pk; - pk = myAssembly->GetName()->GetPublicKey(); - for ( int i = 0; i < pk->GetLength( 0 ); i++ ) - Console::Write( " {0:x2}", pk[ i ] ); - Console::WriteLine(); - Console::WriteLine( "\nDisplaying the public key token.\n" ); - array^pt; - pt = myAssembly->GetName()->GetPublicKeyToken(); - for ( int i = 0; i < pt->GetLength( 0 ); i++ ) - Console::Write( " {0:x2}", pt[ i ] ); - } -} -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp deleted file mode 100644 index 105e762cd75..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -// System::Reflection::AssemblyName::SetPublicKey(Byte->Item[]) -// System::Reflection::AssemblyName::SetPublicKeyToken(Byte->Item[]) -/* - The following example demonstrates the 'SetPublicKey(Byte->Item[])' and the - 'SetPublicKeyToken(Byte->Item[])' methods of the 'AssemblyName' class. Creates - a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and - a type within the module named 'MyType'. The type 'MyType' has a single - method called 'Main' which is also the entry point to the assembly. The - creation of the dynamic assembly is carried out by the method called - 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly' - the assemblies currently loaded are found and the dynamic assembly that we - have created is searched for, which is displayed to the console. The dynamic - assembly is also saved to a file named 'MyAssembly.exe'. The assembly is - provided with a strong name. This is done by getting the public key and - the public key token from the 'KeyPair.snk' (private and public key file). - The public key is stored in 'PublicKey.snk' and the public key token is - stored in 'PublicKeyToken.snk' with the help of the tool named 'sn.exe'. - - Note : Running 'MyAssembly.exe' with this example does not display 'Hello World!' - since this assembly has been stongly signed. -*/ - -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Threading; -using namespace System::IO; -using namespace System::Globalization; -using namespace System::Reflection::Emit; -using namespace System::Configuration::Assemblies; -using namespace System::Text; - -static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) -{ - // Get the assembly builder from the application domain associated with the current thread. - AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a dynamic module in the assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); - - // Create a method called 'Main'. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); - - // Get the Intermediate Language generator for the method. - ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); - - // Use the utility method to generate the IL instructions that print a String* to the console. - myILGenerator->EmitWriteLine( "Hello World!" ); - - // Generate the 'ret' IL instruction. - myILGenerator->Emit( OpCodes::Ret ); - - // End the creation of the type. - myTypeBuilder->CreateType(); - - // Set the method with name 'Main' as the entry point in the assembly. - myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); - myAssemblyBuilder->Save( fileName ); -} - -int main() -{ - // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - - // Set the codebase to the physical directory were the assembly resides. - myAssemblyName->CodeBase = Directory::GetCurrentDirectory(); - - // Set the culture information of the assembly to 'English-American'. - myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" ); - - // Set the hash algorithm to 'SHA256'. - myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256; - myAssemblyName->VersionCompatibility = AssemblyVersionCompatibility::SameProcess; - myAssemblyName->Flags = AssemblyNameFlags::PublicKey; - - // Get the whole contents of the 'PublicKey.snk' into a Byte array. - FileStream^ publicKeyStream = File::Open( "PublicKey.snk", FileMode::Open ); - array^publicKey = gcnew array(publicKeyStream->Length); - publicKeyStream->Read( publicKey, 0, (int)publicKeyStream->Length ); - - // Provide the assembly with a public key. - myAssemblyName->SetPublicKey( publicKey ); - - // Get the whole contents of the 'PublicKeyToken.snk' into a Byte array. - FileStream^ publicKeyTokenStream = File::Open( "PublicKeyToken.snk", FileMode::Open ); - array^publicKeyToken = gcnew array(publicKeyTokenStream->Length); - publicKeyTokenStream->Read( publicKeyToken, 0, (int)publicKeyToken->Length ); - - // Provide the assembly with a public key token. - myAssemblyName->SetPublicKeyToken( publicKeyToken ); - myAssemblyName->Name = "MyAssembly"; - myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); - MakeAssembly( myAssemblyName, "MyAssembly.exe" ); - - // Get the assemblies loaded in the current application domain. - array^myAssemblies = Thread::GetDomain()->GetAssemblies(); - - // Get the dynamic assembly named 'MyAssembly'. - Assembly^ myAssembly = nullptr; - for ( int i = 0; i < myAssemblies->Length; i++ ) - if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) - myAssembly = myAssemblies[ i ]; - - // Display the full assembly information to the console. - if ( myAssembly != nullptr ) - { - Console::WriteLine( "\nDisplaying the full assembly name\n" ); - String^ assemblyName = myAssembly->GetName()->FullName; - Console::WriteLine( assemblyName ); - Console::WriteLine( "\nDisplaying the public key for the assembly\n" ); - array^publicKeyBytes = myAssembly->GetName()->GetPublicKey(); - Console::WriteLine( Encoding::ASCII->GetString( publicKeyBytes ) ); - Console::WriteLine( "\nDisplaying the public key token for the assembly\n" ); - array^publicKeyTokenBytes = myAssembly->GetName()->GetPublicKeyToken(); - Console::WriteLine( Encoding::ASCII->GetString( publicKeyTokenBytes ) ); - } -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp deleted file mode 100644 index 240c13bea6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp +++ /dev/null @@ -1,79 +0,0 @@ -using namespace System; -using namespace System::Reflection; - -// -public ref class MyType -{ -public: - MyType() - { - Console::WriteLine(); - Console::WriteLine("MyType instantiated!"); - } -}; - -class Test -{ -public: - static void Main() - { - AppDomain^ currentDomain = AppDomain::CurrentDomain; - - // This call will fail to create an instance of MyType since the - // assembly resolver is not set - InstantiateMyTypeFail(currentDomain); - - currentDomain->AssemblyResolve += gcnew ResolveEventHandler(&Test::MyResolveEventHandler); - - // This call will succeed in creating an instance of MyType since the - // assembly resolver is now set. - InstantiateMyTypeFail(currentDomain); - - // This call will succeed in creating an instance of MyType since the - // assembly name is valid. - InstantiateMyTypeSucceed(currentDomain); - } - -private: - static void InstantiateMyTypeFail(AppDomain^ domain) - { - // Calling InstantiateMyType will always fail since the assembly info - // given to CreateInstance is invalid. - try - { - // You must supply a valid fully qualified assembly name here. - domain->CreateInstance("Assembly text name, Version, Culture, PublicKeyToken", "MyType"); - } - catch (Exception^ e) - { - Console::WriteLine(); - Console::WriteLine(e->Message); - } - } - - static void InstantiateMyTypeSucceed(AppDomain^ domain) - { - try - { - String^ asmname = Assembly::GetCallingAssembly()->FullName; - domain->CreateInstance(asmname, "MyType"); - } - catch (Exception^ e) - { - Console::WriteLine(); - Console::WriteLine(e->Message); - } - } - - static Assembly^ MyResolveEventHandler(Object^ sender, ResolveEventArgs^ args) - { - Console::WriteLine("Resolving..."); - return MyType::typeid->Assembly; - } -}; - -int main() -{ - Test::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp deleted file mode 100644 index 91ec8999683..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; -using namespace System::Threading; -using namespace System::Runtime::InteropServices; - -namespace Examples { -namespace AdvancedProgramming { -namespace AsynchronousOperations -{ - public ref class AsyncDemo - { - public: - // The method to be executed asynchronously. - String^ TestMethod(int callDuration, [OutAttribute] int% threadId) - { - Console::WriteLine("Test method begins."); - Thread::Sleep(callDuration); - threadId = Thread::CurrentThread->ManagedThreadId; - return String::Format("My call time was {0}.", callDuration); - } - }; - - // The delegate must have the same signature as the method - // it will call asynchronously. - public delegate String^ AsyncMethodCaller(int callDuration, [OutAttribute] int% threadId); -}}} -// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp deleted file mode 100644 index 4f99e90248e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Threading; -using namespace System::Runtime::Remoting::Messaging; -using namespace Examples::AdvancedProgramming::AsynchronousOperations; - -// The callback method must have the same signature as the -// AsyncCallback delegate. -void CallbackMethod(IAsyncResult^ ar) -{ - // Retrieve the delegate. - AsyncResult^ result = (AsyncResult^) ar; - AsyncMethodCaller^ caller = (AsyncMethodCaller^) result->AsyncDelegate; - - // Retrieve the format string that was passed as state - // information. - String^ formatString = (String^) ar->AsyncState; - - // Define a variable to receive the value of the out parameter. - // If the parameter were ref rather than out then it would have to - // be a class-level field so it could also be passed to BeginInvoke. - int threadId = 0; - - // Call EndInvoke to retrieve the results. - String^ returnValue = caller->EndInvoke(threadId, ar); - - // Use the format string to format the output message. - Console::WriteLine(formatString, threadId, returnValue); -}; - -void main() -{ - // Create an instance of the test class. - AsyncDemo^ ad = gcnew AsyncDemo(); - - // Create the delegate. - AsyncMethodCaller^ caller = gcnew AsyncMethodCaller(ad, &AsyncDemo::TestMethod); - - // The threadId parameter of TestMethod is an out parameter, so - // its input value is never used by TestMethod. Therefore, a dummy - // variable can be passed to the BeginInvoke call. If the threadId - // parameter were a ref parameter, it would have to be a class- - // level field so that it could be passed to both BeginInvoke and - // EndInvoke. - int dummy = 0; - - // Initiate the asynchronous call, passing three seconds (3000 ms) - // for the callDuration parameter of TestMethod; a dummy variable - // for the out parameter (threadId); the callback delegate; and - // state information that can be retrieved by the callback method. - // In this case, the state information is a string that can be used - // to format a console message. - IAsyncResult^ result = caller->BeginInvoke(3000, - dummy, - gcnew AsyncCallback(&CallbackMethod), - "The call executed on thread {0}, with return value \"{1}\"."); - - Console::WriteLine("The main thread {0} continues to execute...", - Thread::CurrentThread->ManagedThreadId); - - // The callback is made on a ThreadPool thread. ThreadPool threads - // are background threads, which do not keep the application running - // if the main thread ends. Comment out the next line to demonstrate - // this. - Thread::Sleep(4000); - Console::WriteLine("The main thread ends."); -} - -/* This example produces output similar to the following: - -The main thread 1 continues to execute... -Test method begins. -The call executed on thread 3, with return value "My call time was 3000.". -The main thread ends. - */ -// - diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp deleted file mode 100644 index c0c1952f583..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Threading; -using namespace Examples::AdvancedProgramming::AsynchronousOperations; - -void main() -{ - // The asynchronous method puts the thread id here. - int threadId; - - // Create an instance of the test class. - AsyncDemo^ ad = gcnew AsyncDemo(); - - // Create the delegate. - AsyncMethodCaller^ caller = gcnew AsyncMethodCaller(ad, &AsyncDemo::TestMethod); - - // Initiate the asychronous call. - IAsyncResult^ result = caller->BeginInvoke(3000, - threadId, nullptr, nullptr); - - // Poll while simulating work. - while(!result->IsCompleted) - { - Thread::Sleep(250); - Console::Write("."); - } - - // Call EndInvoke to retrieve the results. - String^ returnValue = caller->EndInvoke(threadId, result); - - Console::WriteLine("\nThe call executed on thread {0}, with return value \"{1}\".", - threadId, returnValue); -} - -/* This example produces output similar to the following: - -Test method begins. -............. -The call executed on thread 3, with return value "My call time was 3000.". - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp deleted file mode 100644 index 8ce4877786e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Threading; -using namespace Examples::AdvancedProgramming::AsynchronousOperations; - -void main() -{ - // The asynchronous method puts the thread id here. - int threadId; - - // Create an instance of the test class. - AsyncDemo^ ad = gcnew AsyncDemo(); - - // Create the delegate. - AsyncMethodCaller^ caller = gcnew AsyncMethodCaller(ad, &AsyncDemo::TestMethod); - - // Initiate the asychronous call. - IAsyncResult^ result = caller->BeginInvoke(3000, - threadId, nullptr, nullptr); - - Thread::Sleep(0); - Console::WriteLine("Main thread {0} does some work.", - Thread::CurrentThread->ManagedThreadId); - - // Wait for the WaitHandle to become signaled. - result->AsyncWaitHandle->WaitOne(); - - // Perform additional processing here. - // Call EndInvoke to retrieve the results. - String^ returnValue = caller->EndInvoke(threadId, result); - - // Close the wait handle. - result->AsyncWaitHandle->Close(); - - Console::WriteLine("The call executed on thread {0}, with return value \"{1}\".", - threadId, returnValue); -} - -/* This example produces output similar to the following: - -Main thread 1 does some work. -Test method begins. -The call executed on thread 3, with return value "My call time was 3000.". - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp deleted file mode 100644 index 4f3ebd80ce7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp +++ /dev/null @@ -1,122 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Runtime::Remoting::Messaging; - -// -// Context-bound type with the Synchronization context attribute. - -[Synchronization] -public ref class SampleSynchronized: public ContextBoundObject -{ -public: - - // A method that does some work, and returns the square of the given number. - int Square( int i ) - { - Console::Write( "The hash of the thread executing " ); - Console::WriteLine( "SampleSynchronized::Square is: {0}", Thread::CurrentThread->GetHashCode() ); - return i * i; - } - -}; -// - -// The async delegate used to call a method with this signature asynchronously. -delegate int SampSyncSqrDelegate( int i ); - -public ref class AsyncResultSample -{ -public: - - // - // Asynchronous Callback method. - static void MyCallback( IAsyncResult^ ar ) - { - - // Obtains the last parameter of the delegate call. - int value = Convert::ToInt32( ar->AsyncState ); - - // Obtains return value from the delegate call using EndInvoke. - AsyncResult^ aResult = dynamic_cast(ar); - SampSyncSqrDelegate^ temp = static_cast(aResult->AsyncDelegate); - int result = temp->EndInvoke( ar ); - Console::Write( "Simple::SomeMethod (AsyncCallback): Result of " ); - Console::WriteLine( " {0} in SampleSynchronized::Square is {1} ", value, result ); - } - - // -}; - -int main() -{ - int result; - int param; - - // - // Creates an instance of a context-bound type SampleSynchronized. - SampleSynchronized^ sampSyncObj = gcnew SampleSynchronized; - - // Checks whether the Object* is a proxy, since it is context-bound. - if ( RemotingServices::IsTransparentProxy( sampSyncObj ) ) - Console::WriteLine( "sampSyncObj is a proxy." ); - else - Console::WriteLine( "sampSyncObj is NOT a proxy." ); - - - // - // - param = 10; - Console::WriteLine( "" ); - Console::WriteLine( "Making a synchronous call on the context-bound Object*:" ); - result = sampSyncObj->Square( param ); - Console::Write( "The result of calling sampSyncObj.Square with " ); - Console::WriteLine( " {0} is {1}.", param, result ); - Console::WriteLine( "" ); - - // - // - SampSyncSqrDelegate^ sampleDelegate = gcnew SampSyncSqrDelegate( sampSyncObj, &SampleSynchronized::Square ); - param = 8; - Console::WriteLine( "Making a single asynchronous call on the context-bound Object*:" ); - IAsyncResult^ ar1 = sampleDelegate->BeginInvoke( param, gcnew AsyncCallback( AsyncResultSample::MyCallback ), param ); - Console::WriteLine( "Waiting for the asynchronous call to complete..." ); - WaitHandle^ wh = ar1->AsyncWaitHandle; - wh->WaitOne(); - wh->Close(); - - Console::WriteLine( "" ); - Console::WriteLine( "Waiting for the AsyncCallback to complete..." ); - // Note that normally, a callback and a wait handle would not - // both be used on the same asynchronous call. Callbacks are - // useful in cases where the original thread does not need to - // be synchronized with the result of the call, and in that - // scenario they provide a place to call EndInvoke. Sleep is - // used here because the callback is on a ThreadPool thread. - // ThreadPool threads are background threads, and will not keep - // a process running when the main thread ends. - Thread::Sleep( 1000 ); - return 0; - - // -} - -/* This code produces output similar to the following: - -sampSyncObj is a proxy. - -Making a synchronous call on the context-bound object: -The hash of the thread executing SampleSynchronized.Square is: 1 -The result of calling sampSyncObj.Square with 10 is 100. - -Making a single asynchronous call on the context-bound object: -Waiting for the asynchronous call to complete... -The hash of the thread executing SampleSynchronized.Square is: 6 - -Waiting for the AsyncCallback to complete... -Simple.SomeMethod (AsyncCallback): Result of 8 in SampleSynchronized.Square is 64 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp b/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp deleted file mode 100644 index 41f69f4f144..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -using namespace System; - -namespace AttTargsCS -{ - - // This attribute is only valid on a class. - - [AttributeUsage(AttributeTargets::Class)] - public ref class ClassTargetAttribute: public Attribute{}; - - - // This attribute is only valid on a method. - - [AttributeUsage(AttributeTargets::Method)] - public ref class MethodTargetAttribute: public Attribute{}; - - - // This attribute is only valid on a constructor. - - [AttributeUsage(AttributeTargets::Constructor)] - public ref class ConstructorTargetAttribute: public Attribute{}; - - - // This attribute is only valid on a field. - - [AttributeUsage(AttributeTargets::Field)] - public ref class FieldTargetAttribute: public Attribute{}; - - - // This attribute is valid on a class or a method. - - [AttributeUsage(AttributeTargets::Class|AttributeTargets::Method)] - public ref class ClassMethodTargetAttribute: public Attribute{}; - - - // This attribute is valid on any target. - - [AttributeUsage(AttributeTargets::All)] - public ref class AllTargetsAttribute: public Attribute{}; - - - [ClassTarget] - [ClassMethodTarget] - [AllTargets] - public ref class TestClassAttribute - { - private: - - [ConstructorTarget] - [AllTargets] - TestClassAttribute(){} - - - public: - - [MethodTarget] - [ClassMethodTarget] - [AllTargets] - void Method1(){} - - - [FieldTarget] - [AllTargets] - int myInt; - static void Main(){} - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp b/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp deleted file mode 100644 index 382e0b264dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp +++ /dev/null @@ -1,449 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Globalization; -using namespace System::Runtime::InteropServices; -public ref class MyBinder: public Binder -{ -public: - MyBinder() - : Binder() - {} - -private: - ref class BinderState - { - public: - array^args; - }; - -public: - virtual FieldInfo^ BindToField( BindingFlags bindingAttr, array^match, Object^ value, CultureInfo^ culture ) override - { - if ( match == nullptr ) - throw gcnew ArgumentNullException( "match" ); - - // Get a field for which the value parameter can be converted to the specified field type. - for ( int i = 0; i < match->Length; i++ ) - if ( ChangeType( value, match[ i ]->FieldType, culture ) != nullptr ) - return match[ i ]; - - return nullptr; - } - - virtual MethodBase^ BindToMethod( BindingFlags bindingAttr, array^match, array^%args, array^ modifiers, CultureInfo^ culture, array^names, [Out]Object^% state ) override - { - // Store the arguments to the method in a state Object*. - BinderState^ myBinderState = gcnew BinderState; - array^arguments = gcnew array(args->Length); - args->CopyTo( arguments, 0 ); - myBinderState->args = arguments; - state = myBinderState; - if ( match == nullptr ) - throw gcnew ArgumentNullException; - - // Find a method that has the same parameters as those of the args parameter. - for ( int i = 0; i < match->Length; i++ ) - { - // Count the number of parameters that match. - int count = 0; - array^parameters = match[ i ]->GetParameters(); - - // Go on to the next method if the number of parameters do not match. - if ( args->Length != parameters->Length ) - continue; - - // Match each of the parameters that the user expects the method to have. - for ( int j = 0; j < args->Length; j++ ) - { - // If the names parameter is not 0, then reorder args. - if ( names != nullptr ) - { - if ( names->Length != args->Length ) - throw gcnew ArgumentException( "names and args must have the same number of elements." ); - - for ( int k = 0; k < names->Length; k++ ) - if ( String::Compare( parameters[ j ]->Name, names[ k ] ) == 0 ) - args[ j ] = myBinderState->args[ k ]; - } - - // Determine whether the types specified by the user can be converted to the parameter type. - if ( ChangeType( args[ j ], parameters[ j ]->ParameterType, culture ) != nullptr ) - count += 1; - else - break; - } - if ( count == args->Length ) - return match[ i ]; - } - return nullptr; - } - - virtual Object^ ChangeType( Object^ value, Type^ myChangeType, CultureInfo^ culture ) override - { - // Determine whether the value parameter can be converted to a value of type myType. - if ( CanConvertFrom( value->GetType(), myChangeType ) ) - // Return the converted Object*. - return Convert::ChangeType( value, myChangeType ); - else - return nullptr; - } - - virtual void ReorderArgumentArray( array^%args, Object^ state ) override - { - // Return the args that had been reordered by BindToMethod. - (safe_cast(state))->args->CopyTo( args, 0 ); - } - - virtual MethodBase^ SelectMethod( BindingFlags bindingAttr, array^match, array^types, array^ modifiers ) override - { - if ( match == nullptr ) - throw gcnew ArgumentNullException( "match" ); - - for ( int i = 0; i < match->Length; i++ ) - { - // Count the number of parameters that match. - int count = 0; - array^parameters = match[ i ]->GetParameters(); - - // Go on to the next method if the number of parameters do not match. - if ( types->Length != parameters->Length ) - continue; - - // Match each of the parameters that the user expects the method to have. - for ( int j = 0; j < types->Length; j++ ) - { - // Determine whether the types specified by the user can be converted to parameter type. - if ( CanConvertFrom( types[ j ], parameters[ j ]->ParameterType ) ) - count += 1; - else - break; - } - // Determine whether the method has been found. - if ( count == types->Length ) - return match[ i ]; - } - return nullptr; - } - - virtual PropertyInfo^ SelectProperty( BindingFlags bindingAttr, array^match, Type^ returnType, array^indexes, array^ modifiers ) override - { - if ( match == nullptr ) - throw gcnew ArgumentNullException( "match" ); - - for ( int i = 0; i < match->Length; i++ ) - { - // Count the number of indexes that match. - int count = 0; - array^parameters = match[ i ]->GetIndexParameters(); - - // Go on to the next property if the number of indexes do not match. - if ( indexes->Length != parameters->Length ) - continue; - - // Match each of the indexes that the user expects the property to have. - for ( int j = 0; j < indexes->Length; j++ ) - // Determine whether the types specified by the user can be converted to index type. - if ( CanConvertFrom( indexes[ j ], parameters[ j ]->ParameterType ) ) - count += 1; - else - break; - - // Determine whether the property has been found. - if ( count == indexes->Length ) - { - // Determine whether the return type can be converted to the properties type. - if ( CanConvertFrom( returnType, match[ i ]->PropertyType ) ) - return match[ i ]; - else - continue; - } - } - return nullptr; - } - -private: - - // Determines whether type1 can be converted to type2. Check only for primitive types. - bool CanConvertFrom( Type^ type1, Type^ type2 ) - { - if ( type1->IsPrimitive && type2->IsPrimitive ) - { - TypeCode typeCode1 = Type::GetTypeCode( type1 ); - TypeCode typeCode2 = Type::GetTypeCode( type2 ); - - // If both type1 and type2 have the same type, return true. - if ( typeCode1 == typeCode2 ) - return true; - - // Possible conversions from Char follow. - if ( typeCode1 == TypeCode::Char ) - { - switch ( typeCode2 ) - { - case TypeCode::UInt16: - return true; - - case TypeCode::UInt32: - return true; - - case TypeCode::Int32: - return true; - - case TypeCode::UInt64: - return true; - - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from Byte follow. - if ( typeCode1 == TypeCode::Byte ) - { - switch ( typeCode2 ) - { - case TypeCode::Char: - return true; - - case TypeCode::UInt16: - return true; - - case TypeCode::Int16: - return true; - - case TypeCode::UInt32: - return true; - - case TypeCode::Int32: - return true; - - case TypeCode::UInt64: - return true; - - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from SByte follow. - if ( typeCode1 == TypeCode::SByte ) - { - switch ( typeCode2 ) - { - case TypeCode::Int16: - return true; - - case TypeCode::Int32: - return true; - - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from UInt16 follow. - if ( typeCode1 == TypeCode::UInt16 ) - { - switch ( typeCode2 ) - { - case TypeCode::UInt32: - return true; - - case TypeCode::Int32: - return true; - - case TypeCode::UInt64: - return true; - - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from Int16 follow. - if ( typeCode1 == TypeCode::Int16 ) - { - switch ( typeCode2 ) - { - case TypeCode::Int32: - return true; - - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from UInt32 follow. - if ( typeCode1 == TypeCode::UInt32 ) - { - switch ( typeCode2 ) - { - case TypeCode::UInt64: - return true; - - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from Int32 follow. - if ( typeCode1 == TypeCode::Int32 ) - { - switch ( typeCode2 ) - { - case TypeCode::Int64: - return true; - - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from UInt64 follow. - if ( typeCode1 == TypeCode::UInt64 ) - { - switch ( typeCode2 ) - { - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from Int64 follow. - if ( typeCode1 == TypeCode::Int64 ) - { - switch ( typeCode2 ) - { - case TypeCode::Single: - return true; - - case TypeCode::Double: - return true; - - default: - return false; - } - } - - // Possible conversions from Single follow. - if ( typeCode1 == TypeCode::Single ) - { - switch ( typeCode2 ) - { - case TypeCode::Double: - return true; - - default: - return false; - } - } - } - - return false; - } - -}; - -public ref class MyClass1 -{ -public: - short myFieldB; - int myFieldA; - void MyMethod( long i, char k ) - { - Console::WriteLine( "\nThis is MyMethod(long i, char k)" ); - } - - void MyMethod( long i, long j ) - { - Console::WriteLine( "\nThis is MyMethod(long i, long j)" ); - } -}; - -int main() -{ - // Get the type of MyClass1. - Type^ myType = MyClass1::typeid; - - // Get the instance of MyClass1. - MyClass1^ myInstance = gcnew MyClass1; - Console::WriteLine( "\nDisplaying the results of using the MyBinder binder.\n" ); - - // Get the method information for MyMethod. - array^types = {short::typeid,short::typeid}; - MethodInfo^ myMethod = myType->GetMethod( "MyMethod", static_cast(BindingFlags::Public | BindingFlags::Instance), gcnew MyBinder, types, nullptr ); - Console::WriteLine( myMethod ); - - // Invoke MyMethod. - array^obj = {32,32}; - myMethod->Invoke( myInstance, BindingFlags::InvokeMethod, gcnew MyBinder, obj, CultureInfo::CurrentCulture ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp b/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp deleted file mode 100644 index 9657b10660c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp +++ /dev/null @@ -1,365 +0,0 @@ -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; -using namespace System::IO; - -//namespace BindingFlagsSnippet { -public ref class TestClass -{ -public: - String^ Name; - -private: - array^ values; - int methodCalled; - -public: - - property Object^ Item [int] - { - Object^ get( int index ) - { - return values[ index ]; - } - - void set( int index, Object^ value ) - { - values[ index ] = value; - } - } - - property Object^ Value - { - Object^ get() - { - return "the value"; - } - } - - TestClass() - { - Name = "initialName"; - values = gcnew array {(int^)0,1,2,3,4,5,6,7,8,9}; - methodCalled = 0; - } - - TestClass(String^ initName) - { - Name = initName; - values = gcnew array {(int^)0,1,2,3,4,5,6,7,8,9}; - methodCalled = 0; - } - - static void SayHello() - { - Console::WriteLine( "Hello" ); - } - - void AddUp() - { - methodCalled++; - Console::WriteLine( "AddUp Called {0} times", methodCalled ); - } - - static double ComputeSum( double d1, double d2 ) - { - return d1 + d2; - } - - static void PrintName( String^ firstName, String^ lastName ) - { - Console::WriteLine( "{0},{1}", lastName, firstName ); - } - - void PrintTime() - { - Console::WriteLine( DateTime::Now ); - } - - void Swap( interior_ptr a, interior_ptr b ) - { - int x = *a; - *a = *b; - *b = x; - } -}; - - -[DefaultMemberAttribute("PrintTime")] -public ref class TestClass2 -{ -public: - void PrintTime() - { - Console::WriteLine( DateTime::Now ); - } - -}; - -public ref class Base -{ -private: - static int BaseOnlyPrivate = 0; -protected: - static int BaseOnly = 0; -}; - -public ref class Derived : Base -{ -public: - static int DerivedOnly = 0; -}; - -public ref class MostDerived : Derived {}; - -void main() -{ - array^ noArguments; - - // BindingFlags::InvokeMethod - // Call a static method. - Type^ t = TestClass::typeid; - Console::WriteLine(); - Console::WriteLine( "Invoking a static method." ); - Console::WriteLine( "-------------------------" ); - t->InvokeMember( "SayHello", BindingFlags::InvokeMethod | BindingFlags::Public | BindingFlags::Static, - nullptr, nullptr, noArguments ); - - // BindingFlags::InvokeMethod - // Call an instance method. - TestClass^ c = gcnew TestClass; - Console::WriteLine(); - Console::WriteLine( "Invoking an instance method." ); - Console::WriteLine( "----------------------------" ); - c->GetType()->InvokeMember( "AddUp", BindingFlags::InvokeMethod, nullptr, c, noArguments ); - c->GetType()->InvokeMember( "AddUp", BindingFlags::InvokeMethod, nullptr, c, noArguments ); - - // BindingFlags::InvokeMethod - // Call a method with parameters. - array^args = {100.09,184.45}; - Object^ result; - Console::WriteLine(); - Console::WriteLine( "Invoking a method with parameters." ); - Console::WriteLine( "---------------------------------" ); - result = t->InvokeMember( "ComputeSum", BindingFlags::InvokeMethod, nullptr, nullptr, args ); - Console::WriteLine( " {0} + {1} = {2}", args[ 0 ], args[ 1 ], result ); - - // BindingFlags::GetField, SetField - Console::WriteLine(); - Console::WriteLine( "Invoking a field (getting and setting.)" ); - Console::WriteLine( "--------------------------------------" ); - - // Get a field value. - result = t->InvokeMember( "Name", BindingFlags::GetField, nullptr, c, noArguments ); - Console::WriteLine( "Name == {0}", result ); - - // Set a field. - array^obj2 = {"NewName"}; - t->InvokeMember( "Name", BindingFlags::SetField, nullptr, c, obj2 ); - result = t->InvokeMember( "Name", BindingFlags::GetField, nullptr, c, noArguments ); - Console::WriteLine( "Name == {0}", result ); - Console::WriteLine(); - Console::WriteLine( "Invoking an indexed property (getting and setting.)" ); - Console::WriteLine( "--------------------------------------------------" ); - - // BindingFlags::GetProperty - // Get an indexed property value. - int index = 3; - array^obj3 = {index}; - result = t->InvokeMember( "Item", BindingFlags::GetProperty, nullptr, c, obj3 ); - Console::WriteLine( "Item->Item[ {0}] == {1}", index, result ); - - // BindingFlags::SetProperty - // Set an indexed property value. - index = 3; - array^obj4 = {index,"NewValue"}; - t->InvokeMember( "Item", BindingFlags::SetProperty, nullptr, c, obj4 ); - result = t->InvokeMember( "Item", BindingFlags::GetProperty, nullptr, c, obj3 ); - Console::WriteLine( "Item->Item[ {0}] == {1}", index, result ); - Console::WriteLine(); - Console::WriteLine( "Getting a field or property." ); - Console::WriteLine( "----------------------------" ); - - // BindingFlags::GetField - // Get a field or property. - result = t->InvokeMember( "Name", static_cast(BindingFlags::GetField | - BindingFlags::GetProperty), nullptr, c, noArguments ); - Console::WriteLine( "Name == {0}", result ); - - // BindingFlags::GetProperty - result = t->InvokeMember( "Value", static_cast(BindingFlags::GetField | - BindingFlags::GetProperty), nullptr, c, noArguments ); - Console::WriteLine( "Value == {0}", result ); - Console::WriteLine(); - Console::WriteLine( "Invoking a method with named parameters." ); - Console::WriteLine( "---------------------------------------" ); - - // BindingFlags::InvokeMethod - // Call a method using named parameters. - array^argValues = {"Mouse","Micky"}; - array^argNames = {"lastName","firstName"}; - t->InvokeMember( "PrintName", BindingFlags::InvokeMethod, nullptr, nullptr, argValues, nullptr, - nullptr, argNames ); - Console::WriteLine(); - Console::WriteLine( "Invoking a default member of a type." ); - Console::WriteLine( "------------------------------------" ); - - // BindingFlags::Default - // Call the default member of a type. - Type^ t3 = TestClass2::typeid; - t3->InvokeMember( "", static_cast(BindingFlags::InvokeMethod | BindingFlags::Default), - nullptr, gcnew TestClass2, noArguments ); - - // BindingFlags::Static, NonPublic, and Public - // Invoking a member with ref parameters. - Console::WriteLine(); - Console::WriteLine( "Invoking a method with ref parameters." ); - Console::WriteLine( "--------------------------------------" ); - MethodInfo^ m = t->GetMethod( "Swap" ); - args = gcnew array(2); - args[ 0 ] = 1; - args[ 1 ] = 2; - m->Invoke( gcnew TestClass, args ); - Console::WriteLine( "{0}, {1}", args[ 0 ], args[ 1 ] ); - - // BindingFlags::CreateInstance - // Creating an instance with a parameterless constructor. - Console::WriteLine(); - Console::WriteLine( "Creating an instance with a parameterless constructor." ); - Console::WriteLine( "------------------------------------------------------" ); - Object^ obj = t->InvokeMember( "TestClass", static_cast(BindingFlags::Public | - BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, noArguments ); - Console::WriteLine("Instance of {0} created.", obj->GetType()->Name); - - // Creating an instance with a constructor that has parameters. - Console::WriteLine(); - Console::WriteLine( "Creating an instance with a constructor that has parameters." ); - Console::WriteLine( "------------------------------------------------------------" ); - obj = t->InvokeMember( "TestClass", static_cast(BindingFlags::Public | - BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, - gcnew array { "Hello, World!" } ); - Console::WriteLine("Instance of {0} created with initial value '{1}'.", obj->GetType()->Name, - obj->GetType()->InvokeMember("Name", BindingFlags::GetField, nullptr, obj, noArguments)); - - // BindingFlags::DeclaredOnly - Console::WriteLine(); - Console::WriteLine( "DeclaredOnly instance members." ); - Console::WriteLine( "------------------------------" ); - array^memInfo = t->GetMembers( BindingFlags::DeclaredOnly | - BindingFlags::Instance | BindingFlags::Public); - for ( int i = 0; i < memInfo->Length; i++ ) - { - Console::WriteLine( memInfo[ i ]->Name ); - - } - - // BindingFlags::IgnoreCase - Console::WriteLine(); - Console::WriteLine( "Using IgnoreCase and invoking the PrintName method." ); - Console::WriteLine( "---------------------------------------------------" ); - t->InvokeMember( "printname", static_cast(BindingFlags::IgnoreCase | - BindingFlags::Static | BindingFlags::Public | BindingFlags::InvokeMethod), - nullptr, nullptr, gcnew array {"Brad","Smith"}); - - // BindingFlags::FlattenHierarchy - Console::WriteLine(); - Console::WriteLine( "Using FlattenHierarchy to get inherited static protected and public members." ); - Console::WriteLine( "----------------------------------------------------------------------------" ); - array^ finfos = MostDerived::typeid->GetFields(BindingFlags::NonPublic | - BindingFlags::Public | BindingFlags::Static | BindingFlags::FlattenHierarchy); - for each (FieldInfo^ finfo in finfos) - { - Console::WriteLine("{0} defined in {1}.", finfo->Name, finfo->DeclaringType->Name); - } - - Console::WriteLine(); - Console::WriteLine("Without FlattenHierarchy." ); - Console::WriteLine("-------------------------"); - finfos = MostDerived::typeid->GetFields(BindingFlags::NonPublic | BindingFlags::Public | - BindingFlags::Static); - for each (FieldInfo^ finfo in finfos) - { - Console::WriteLine("{0} defined in {1}.", finfo->Name, finfo->DeclaringType->Name); - } -}; - -/* This example produces output similar to the following: - -Invoking a static method. -------------------------- -Hello - -Invoking an instance method. ----------------------------- -AddUp Called 1 times -AddUp Called 2 times - -Invoking a method with parameters. ---------------------------------- - 100.09 + 184.45 = 284.54 - -Invoking a field (getting and setting.) --------------------------------------- -Name == initialName -Name == NewName - -Invoking an indexed property (getting and setting.) --------------------------------------------------- -Item->Item[ 3] == 3 -Item->Item[ 3] == NewValue - -Getting a field or property. ----------------------------- -Name == NewName -Value == the value - -Invoking a method with named parameters. ---------------------------------------- -Mouse,Micky - -Invoking a default member of a type. ------------------------------------- -12/23/2009 4:19:06 PM - -Invoking a method with ref parameters. --------------------------------------- -2, 1 - -Creating an instance with a parameterless constructor. ------------------------------------------------------- -Instance of TestClass created. - -Creating an instance with a constructor that has parameters. ------------------------------------------------------------- -Instance of TestClass created with initial value 'Hello, World!'. - -DeclaredOnly instance members. ------------------------------- -get_Item -set_Item -get_Value -AddUp -PrintTime -Swap -.ctor -.ctor -Value -Item -Name -methodCalled - -Using IgnoreCase and invoking the PrintName method. ---------------------------------------------------- -Smith,Brad - -Using FlattenHierarchy to get inherited static protected and public members. ----------------------------------------------------------------------------- -DerivedOnly defined in Derived. -BaseOnly defined in Base. - -Without FlattenHierarchy. -------------------------- - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp b/snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp deleted file mode 100644 index d20aed62b38..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Permissions; -using namespace System::IO; -using namespace System::Security::Cryptography::X509Certificates; - -//Reads a file. -array^ ReadFile( String^ fileName ) -{ - FileStream^ f = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - int size = (int)f->Length; - array^data = gcnew array(size); - size = f->Read( data, 0, size ); - f->Close(); - return data; -} - -[SecurityPermissionAttribute(SecurityAction::LinkDemand, Unrestricted = true)] -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - //Test for correct number of arguments. - if ( args->Length < 2 ) - { - Console::WriteLine( "Usage: CertInfo " ); - return -1; - } - - try - { - System::Security::Cryptography::X509Certificates::X509Certificate2 ^ x509 = - gcnew System::Security::Cryptography::X509Certificates::X509Certificate2; - - //Create X509Certificate2 object from .cer file. - array^rawData = ReadFile( args[ 1 ] ); - - x509->Import(rawData); - - //Print to console information contained in the certificate. - Console::WriteLine( "{0}Subject: {1}{0}", Environment::NewLine, x509->Subject ); - Console::WriteLine( "{0}Issuer: {1}{0}", Environment::NewLine, x509->Issuer ); - Console::WriteLine( "{0}Version: {1}{0}", Environment::NewLine, x509->Version ); - Console::WriteLine( "{0}Valid Date: {1}{0}", Environment::NewLine, x509->NotBefore ); - Console::WriteLine( "{0}Expiry Date: {1}{0}", Environment::NewLine, x509->NotAfter ); - Console::WriteLine( "{0}Thumbprint: {1}{0}", Environment::NewLine, x509->Thumbprint ); - Console::WriteLine( "{0}Serial Number: {1}{0}", Environment::NewLine, x509->SerialNumber ); - Console::WriteLine( "{0}Friendly Name: {1}{0}", Environment::NewLine, x509->PublicKey->Oid->FriendlyName ); - Console::WriteLine( "{0}Public Key Format: {1}{0}", Environment::NewLine, x509->PublicKey->EncodedKeyValue->Format(true) ); - Console::WriteLine( "{0}Raw Data Length: {1}{0}", Environment::NewLine, x509->RawData->Length ); - Console::WriteLine( "{0}Certificate to string: {1}{0}", Environment::NewLine, x509->ToString( true ) ); - Console::WriteLine( "{0}Certificate to XML String: {1}{0}", Environment::NewLine, x509->PublicKey->Key->ToXmlString( false ) ); - - //Add the certificate to a X509Store. - X509Store ^ store = gcnew X509Store; - store->Open( OpenFlags::MaxAllowed ); - store->Add( x509 ); - store->Close(); - } - catch ( DirectoryNotFoundException^ ) - { - Console::WriteLine( "Error: The directory specified could not be found." ); - } - catch ( IOException^ ) - { - Console::WriteLine( "Error: A file in the directory could not be accessed." ); - } - catch ( NullReferenceException^ ) - { - Console::WriteLine( "File must be a .cer file. Program does not have access to that type of file." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp b/snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp deleted file mode 100644 index bbe9ba49645..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Permissions; -using namespace System::IO; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - try - { - X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser ); - store->Open( static_cast(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); - X509Certificate2Collection ^ collection = dynamic_cast(store->Certificates); - X509Certificate2Collection ^ fcollection = dynamic_cast(collection->Find( X509FindType::FindByTimeValid, DateTime::Now, false )); - X509Certificate2Collection ^ scollection = X509Certificate2UI::SelectFromCollection(fcollection, "Test Certificate Select","Select a certificate from the following list to get information on that certificate",X509SelectionFlag::MultiSelection); - Console::WriteLine( "Number of certificates: {0}{1}", scollection->Count, Environment::NewLine ); - System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - X509Certificate2 ^ x509 = safe_cast(myEnum->Current); - array^rawdata = x509->RawData; - Console::WriteLine( "Content Type: {0}{1}", X509Certificate2::GetCertContentType( rawdata ), Environment::NewLine ); - Console::WriteLine( "Friendly Name: {0}{1}", x509->FriendlyName, Environment::NewLine ); - Console::WriteLine( "Certificate Verified?: {0}{1}", x509->Verify(), Environment::NewLine ); - Console::WriteLine( "Simple Name: {0}{1}", x509->GetNameInfo( X509NameType::SimpleName, true ), Environment::NewLine ); - Console::WriteLine( "Signature Algorithm: {0}{1}", x509->SignatureAlgorithm->FriendlyName, Environment::NewLine ); - Console::WriteLine( "Private Key: {0}{1}", x509->PrivateKey->ToXmlString( false ), Environment::NewLine ); - Console::WriteLine( "Public Key: {0}{1}", x509->PublicKey->Key->ToXmlString( false ), Environment::NewLine ); - Console::WriteLine( "Certificate Archived?: {0}{1}", x509->Archived, Environment::NewLine ); - Console::WriteLine( "Length of Raw Data: {0}{1}", x509->RawData->Length, Environment::NewLine ); - x509->Reset(); - } - store->Close(); - } - catch ( CryptographicException^ ) - { - Console::WriteLine( "Information could not be written out for this certificate." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp deleted file mode 100644 index 262a32465c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography::Xml; -using namespace System::Xml; -using namespace System::IO; - -/// This sample used the GetXml method in the CipherReference class to -/// write the XML values for the CipherReference to the console. - -[STAThread] -int main() -{ - - //Create a URI string. - String^ uri = "http://www.woodgrovebank.com/document.xml"; - - // Create a Base64 transform. The input content retrieved from the - // URI should be Base64-decoded before other processing. - Transform^ base64 = gcnew XmlDsigBase64Transform; - - //Create a transform chain and add the transform to it. - TransformChain^ tc = gcnew TransformChain; - tc->Add( base64 ); - - //Create information. - CipherReference ^ reference = gcnew CipherReference( uri,tc ); - - // Write the CipherReference value to the console. - Console::WriteLine( "Cipher Reference data: {0}", reference->GetXml()->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp b/snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp deleted file mode 100644 index 20b2ee5c8d9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//Types:System.Runtime.InteropServices.ClassInterfaceType -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// Have the CLR expose a class interface (derived from IDispatch) -// for this type. COM clients can call the members of this -// class using the Invoke method from the IDispatch interface. -[ClassInterface(ClassInterfaceType::AutoDispatch)] -public ref class AClassUsableViaCOM -{ -public: - AClassUsableViaCOM() - { - } - -public: - int Add(int x, int y) - { - return x + y; - } -}; - -// The CLR does not expose a class interface for this type. -// COM clients can call the members of this class using -// the methods from the IComparable interface. -[ClassInterface(ClassInterfaceType::None)] -public ref class AnotherClassUsableViaCOM : public IComparable -{ -public: - AnotherClassUsableViaCOM() - { - } - - virtual int CompareTo(Object^ o) = IComparable::CompareTo - { - return 0; - } -}; -// - diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp deleted file mode 100644 index cafb9d2dab4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeArgumentReferenceExpressionExample - { - public: - CodeArgumentReferenceExpressionExample() - { - - // - // Declare a method that accepts a string parameter named text. - CodeMemberMethod^ cmm = gcnew CodeMemberMethod; - cmm->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","text" ) ); - cmm->Name = "WriteString"; - cmm->ReturnType = gcnew CodeTypeReference( "System::Void" ); - array^ce = {gcnew CodeArgumentReferenceExpression( "test1" )}; - - // Create a method invoke statement to output the string passed to the method. - CodeMethodInvokeExpression^ cmie = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine",ce ); - - // Add the method invoke expression to the method's statements collection. - cmm->Statements->Add( cmie ); - - // A C++ code generator produces the following source code for the preceeding example code: - // private: - // void WriteString(String text) { - // Console::WriteLine(text); - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp deleted file mode 100644 index ba586aa0cf3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; -using namespace Microsoft::CSharp; -using namespace Microsoft::VisualBasic; -using namespace Microsoft::JScript; - -/// -/// Provides a wrapper for CodeDOM samples. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::CodeDom::CodeCompileUnit^ cu; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::GroupBox^ groupBox1; - System::Windows::Forms::RadioButton^ radioButton1; - System::Windows::Forms::RadioButton^ radioButton2; - System::Windows::Forms::RadioButton^ radioButton3; - int language; - System::ComponentModel::Container^ components; - -public: - Form1() - { - language = 1; // 1 = Csharp 2 = VB 3 = JScript - components = nullptr; - InitializeComponent(); - cu = CreateGraph(); - } - - // -public: - CodeCompileUnit^ CreateGraph() - { - // Create a compile unit to contain a CodeDOM graph - CodeCompileUnit^ cu = gcnew CodeCompileUnit; - - // Create a namespace named "TestSpace" - CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); - - // Create a new type named "TestClass" - CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); - - // Create a new entry point method - CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod; - - // - // Create an initialization expression for a new array of type Int32 with 10 indices - CodeArrayCreateExpression^ ca1 = gcnew CodeArrayCreateExpression( "System.Int32",10 ); - - // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression - CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32[]","x",ca1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // int[] x = new int[10]; - // - - // Add the variable declaration and initialization statement to the entry point method - cm->Statements->Add( cv1 ); - - // Add the entry point method to the "TestClass" type - cd->Members->Add( cm ); - - // Add the "TestClass" type to the namespace - cn->Types->Add( cd ); - - // Add the "TestSpace" namespace to the compile unit - cu->Namespaces->Add( cn ); - return cu; - } - // - -private: - void OutputGraph() - { - // Create string writer to output to textbox - StringWriter^ sw = gcnew StringWriter; - - // Create appropriate CodeProvider - System::CodeDom::Compiler::CodeDomProvider^ cp; - switch ( language ) - { - case 2: - // VB - cp = CodeDomProvider::CreateProvider("VisualBasic"); - break; - - case 3: - // JScript - cp = CodeDomProvider::CreateProvider("JScript"); - break; - - default: - // CSharp - cp = CodeDomProvider::CreateProvider("CSharp"); - break; - } - - // Create a code generator that will output to the string writer - ICodeGenerator^ cg = cp->CreateGenerator( sw ); - - // Generate code from the compile unit and outputs it to the string writer - cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions ); - - // Output the contents of the string writer to the textbox - this->textBox1->Text = sw->ToString(); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->groupBox1 = gcnew System::Windows::Forms::GroupBox; - this->radioButton1 = gcnew System::Windows::Forms::RadioButton; - this->radioButton2 = gcnew System::Windows::Forms::RadioButton; - this->radioButton3 = gcnew System::Windows::Forms::RadioButton; - this->groupBox1->SuspendLayout(); - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 16, 112 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both; - this->textBox1->Size = System::Drawing::Size( 664, 248 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - this->textBox1->WordWrap = false; - - // - // button1 - // - this->button1->BackColor = System::Drawing::Color::Aquamarine; - this->button1->Location = System::Drawing::Point( 16, 16 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "Generate"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->BackColor = System::Drawing::Color::MediumTurquoise; - this->button2->Location = System::Drawing::Point( 112, 16 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 2; - this->button2->Text = "Show Code"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // groupBox1 - // - array^temp0 = {this->radioButton3,this->radioButton2,this->radioButton1}; - this->groupBox1->Controls->AddRange( temp0 ); - this->groupBox1->Location = System::Drawing::Point( 16, 48 ); - this->groupBox1->Name = "groupBox1"; - this->groupBox1->Size = System::Drawing::Size( 384, 56 ); - this->groupBox1->TabIndex = 3; - this->groupBox1->TabStop = false; - this->groupBox1->Text = "Language selection"; - - // - // radioButton1 - // - this->radioButton1->Checked = true; - this->radioButton1->Location = System::Drawing::Point( 16, 24 ); - this->radioButton1->Name = "radioButton1"; - this->radioButton1->TabIndex = 0; - this->radioButton1->TabStop = true; - this->radioButton1->Text = "CSharp"; - this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // radioButton2 - // - this->radioButton2->Location = System::Drawing::Point( 144, 24 ); - this->radioButton2->Name = "radioButton2"; - this->radioButton2->TabIndex = 1; - this->radioButton2->Text = "Visual Basic"; - this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged ); - - // - // radioButton3 - // - this->radioButton3->Location = System::Drawing::Point( 272, 24 ); - this->radioButton3->Name = "radioButton3"; - this->radioButton3->TabIndex = 2; - this->radioButton3->Text = "JScript"; - this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged ); - - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 714, 367 ); - array^temp1 = {this->groupBox1,this->button2,this->button1,this->textBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "CodeDOM Samples Framework"; - this->groupBox1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void ShowCode() - { - this->textBox1->Text = ""; - } - - // Show code button - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowCode(); - } - - // Generate and show code button - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - OutputGraph(); - } - - // Csharp language selection button - void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = true; - radioButton2->Checked = false; - radioButton3->Checked = false; - language = 1; - } - - // Visual Basic language selection button - void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = false; - radioButton2->Checked = true; - radioButton3->Checked = false; - language = 2; - } - - // JScript language selection button - void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = false; - radioButton2->Checked = false; - radioButton3->Checked = true; - language = 3; - } - -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp deleted file mode 100644 index e565079d0a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp +++ /dev/null @@ -1,301 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; -using namespace Microsoft::CSharp; -using namespace Microsoft::VisualBasic; -using namespace Microsoft::JScript; - -/// -/// Provides a wrapper for CodeDOM samples. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::CodeDom::CodeCompileUnit^ cu; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::GroupBox^ groupBox1; - System::Windows::Forms::RadioButton^ radioButton1; - System::Windows::Forms::RadioButton^ radioButton2; - System::Windows::Forms::RadioButton^ radioButton3; - int language; - System::ComponentModel::Container^ components; - -public: - Form1() - { - language = 1; // 1 = Csharp 2 = VB 3 = JScript - components = nullptr; - InitializeComponent(); - cu = CreateGraph(); - } - - // -public: - CodeCompileUnit^ CreateGraph() - { - // Create a compile unit to contain a CodeDOM graph - CodeCompileUnit^ cu = gcnew CodeCompileUnit; - - // Create a namespace named "TestSpace" - CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); - - // Create a new type named "TestClass" - CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); - - // Create an entry point method - CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod; - - // Create the initialization expression for an array of type Int32 with 10 indices - CodeArrayCreateExpression^ ca1 = gcnew CodeArrayCreateExpression( "System.Int32",10 ); - - // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression - CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32[]","x",ca1 ); - - // Add the array declaration and initialization statement to the entry point method class member - cm->Statements->Add( cv1 ); - // - - // Create an array indexer expression that references index 5 of array "x" - array^temp = {gcnew CodePrimitiveExpression( 5 )}; - CodeArrayIndexerExpression^ ci1 = gcnew CodeArrayIndexerExpression( gcnew CodeVariableReferenceExpression( "x" ),temp ); - - // A C# code generator produces the following source code for the preceeding example code: - // x[5] - // - // Declare a variable of type Int32 and adds it to the entry point method - CodeVariableDeclarationStatement^ cv2 = gcnew CodeVariableDeclarationStatement( "System.Int32","y" ); - cm->Statements->Add( cv2 ); - - // Assign the value of the array indexer ci1 to variable "y" - CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "y" ),ci1 ); - - // Add the assignment statement to the entry point method - cm->Statements->Add( as1 ); - - // Add the entry point method to the "TestClass" type - cd->Members->Add( cm ); - - // Add the "TestClass" type to the namespace - cn->Types->Add( cd ); - - // Add the "TestSpace" namespace to the compile unit - cu->Namespaces->Add( cn ); - return cu; - } - // - -private: - void OutputGraph() - { - // Create string writer to output to textbox - StringWriter^ sw = gcnew StringWriter; - - // Create appropriate CodeProvider - System::CodeDom::Compiler::CodeDomProvider^ cp; - switch ( language ) - { - case 2: - // VB - cp = CodeDomProvider::CreateProvider("VisualBasic"); - break; - - case 3: - // JScript - cp = CodeDomProvider::CreateProvider("JScript"); - break; - - default: - // CSharp - cp = CodeDomProvider::CreateProvider("CSharp"); - break; - } - - // Create a code generator that will output to the string writer - ICodeGenerator^ cg = cp->CreateGenerator( sw ); - - // Generate code from the compile unit and outputs it to the string writer - cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions ); - - // Output the contents of the string writer to the textbox - this->textBox1->Text = sw->ToString(); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->groupBox1 = gcnew System::Windows::Forms::GroupBox; - this->radioButton1 = gcnew System::Windows::Forms::RadioButton; - this->radioButton2 = gcnew System::Windows::Forms::RadioButton; - this->radioButton3 = gcnew System::Windows::Forms::RadioButton; - this->groupBox1->SuspendLayout(); - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 16, 112 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both; - this->textBox1->Size = System::Drawing::Size( 664, 248 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - this->textBox1->WordWrap = false; - - // - // button1 - // - this->button1->BackColor = System::Drawing::Color::Aquamarine; - this->button1->Location = System::Drawing::Point( 16, 16 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "Generate"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->BackColor = System::Drawing::Color::MediumTurquoise; - this->button2->Location = System::Drawing::Point( 112, 16 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 2; - this->button2->Text = "Show Code"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // groupBox1 - // - array^temp2 = {this->radioButton3,this->radioButton2,this->radioButton1}; - this->groupBox1->Controls->AddRange( temp2 ); - this->groupBox1->Location = System::Drawing::Point( 16, 48 ); - this->groupBox1->Name = "groupBox1"; - this->groupBox1->Size = System::Drawing::Size( 384, 56 ); - this->groupBox1->TabIndex = 3; - this->groupBox1->TabStop = false; - this->groupBox1->Text = "Language selection"; - - // - // radioButton1 - // - this->radioButton1->Checked = true; - this->radioButton1->Location = System::Drawing::Point( 16, 24 ); - this->radioButton1->Name = "radioButton1"; - this->radioButton1->TabIndex = 0; - this->radioButton1->TabStop = true; - this->radioButton1->Text = "CSharp"; - this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // radioButton2 - // - this->radioButton2->Location = System::Drawing::Point( 144, 24 ); - this->radioButton2->Name = "radioButton2"; - this->radioButton2->TabIndex = 1; - this->radioButton2->Text = "Visual Basic"; - this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged ); - - // - // radioButton3 - // - this->radioButton3->Location = System::Drawing::Point( 272, 24 ); - this->radioButton3->Name = "radioButton3"; - this->radioButton3->TabIndex = 2; - this->radioButton3->Text = "JScript"; - this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged ); - - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 714, 367 ); - array^temp3 = {this->groupBox1,this->button2,this->button1,this->textBox1}; - this->Controls->AddRange( temp3 ); - this->Name = "Form1"; - this->Text = "CodeDOM Samples Framework"; - this->groupBox1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void ShowCode() - { - this->textBox1->Text = ""; - } - - // Show code button - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowCode(); - } - - // Generate and show code button - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - OutputGraph(); - } - - // Csharp language selection button - void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = true; - radioButton2->Checked = false; - radioButton3->Checked = false; - language = 1; - } - - // Visual Basic language selection button - void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = false; - radioButton2->Checked = true; - radioButton3->Checked = false; - language = 2; - } - - // JScript language selection button - void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = false; - radioButton2->Checked = false; - radioButton3->Checked = true; - language = 3; - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp deleted file mode 100644 index a94dc0b0c36..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; -using namespace Microsoft::CSharp; -using namespace Microsoft::VisualBasic; -using namespace Microsoft::JScript; - -/// -/// Provides a wrapper for CodeDOM samples. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::CodeDom::CodeCompileUnit^ cu; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::GroupBox^ groupBox1; - System::Windows::Forms::RadioButton^ radioButton1; - System::Windows::Forms::RadioButton^ radioButton2; - System::Windows::Forms::RadioButton^ radioButton3; - int language; - System::ComponentModel::Container^ components; - -public: - Form1() - { - language = 1; // 1 = Csharp 2 = VB 3 = JScript - components = nullptr; - InitializeComponent(); - cu = CreateGraph(); - } - - // - CodeCompileUnit^ CreateGraph() - { - // Create a compile unit to contain a CodeDOM graph - CodeCompileUnit^ cu = gcnew CodeCompileUnit; - - // Create a namespace named "TestSpace" - CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); - - // Create a new type named "TestClass" - CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); - - // Create a new entry point method - CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod; - - // Declare a variable of type Int32 named "i" - CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32","i" ); - - // Add the variable declaration statement to the entry point method - cm->Statements->Add( cv1 ); - - // - // Assigns the value of the 10 to the integer variable "i". - CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "i" ),gcnew CodePrimitiveExpression( 10 ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // i=10; - // - // Add the assignment statement to the entry point method - cm->Statements->Add( as1 ); - - // Add the entry point method to the "TestClass" type - cd->Members->Add( cm ); - - // Add the "TestClass" type to the namespace - cn->Types->Add( cd ); - - // Add the "TestSpace" namespace to the compile unit - cu->Namespaces->Add( cn ); - return cu; - } - // - -private: - void OutputGraph() - { - // Create string writer to output to textbox - StringWriter^ sw = gcnew StringWriter; - - // Create appropriate CodeProvider - System::CodeDom::Compiler::CodeDomProvider^ cp; - switch ( language ) - { - case 2: - // VB - cp = CodeDomProvider::CreateProvider("VisualBasic"); - break; - - case 3: - // JScript - cp = CodeDomProvider::CreateProvider("JScript"); - break; - - default: - // CSharp - cp = CodeDomProvider::CreateProvider("CSharp"); - break; - } - - // Create a code generator that will output to the string writer - ICodeGenerator^ cg = cp->CreateGenerator( sw ); - - // Generate code from the compile unit and outputs it to the string writer - cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions ); - - // Output the contents of the string writer to the textbox - this->textBox1->Text = sw->ToString(); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->groupBox1 = gcnew System::Windows::Forms::GroupBox; - this->radioButton1 = gcnew System::Windows::Forms::RadioButton; - this->radioButton2 = gcnew System::Windows::Forms::RadioButton; - this->radioButton3 = gcnew System::Windows::Forms::RadioButton; - this->groupBox1->SuspendLayout(); - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 16, 112 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both; - this->textBox1->Size = System::Drawing::Size( 664, 248 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - this->textBox1->WordWrap = false; - - // - // button1 - // - this->button1->BackColor = System::Drawing::Color::Aquamarine; - this->button1->Location = System::Drawing::Point( 16, 16 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "Generate"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->BackColor = System::Drawing::Color::MediumTurquoise; - this->button2->Location = System::Drawing::Point( 112, 16 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 2; - this->button2->Text = "Show Code"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // groupBox1 - // - array^temp0 = {this->radioButton3,this->radioButton2,this->radioButton1}; - this->groupBox1->Controls->AddRange( temp0 ); - this->groupBox1->Location = System::Drawing::Point( 16, 48 ); - this->groupBox1->Name = "groupBox1"; - this->groupBox1->Size = System::Drawing::Size( 384, 56 ); - this->groupBox1->TabIndex = 3; - this->groupBox1->TabStop = false; - this->groupBox1->Text = "Language selection"; - - // - // radioButton1 - // - this->radioButton1->Checked = true; - this->radioButton1->Location = System::Drawing::Point( 16, 24 ); - this->radioButton1->Name = "radioButton1"; - this->radioButton1->TabIndex = 0; - this->radioButton1->TabStop = true; - this->radioButton1->Text = "CSharp"; - this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // radioButton2 - // - this->radioButton2->Location = System::Drawing::Point( 144, 24 ); - this->radioButton2->Name = "radioButton2"; - this->radioButton2->TabIndex = 1; - this->radioButton2->Text = "Visual Basic"; - this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged ); - - // - // radioButton3 - // - this->radioButton3->Location = System::Drawing::Point( 272, 24 ); - this->radioButton3->Name = "radioButton3"; - this->radioButton3->TabIndex = 2; - this->radioButton3->Text = "JScript"; - this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged ); - - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 714, 367 ); - array^temp1 = {this->groupBox1,this->button2,this->button1,this->textBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "CodeDOM Samples Framework"; - this->groupBox1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void ShowCode() - { - this->textBox1->Text = ""; - } - - // Show code button - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowCode(); - } - - // Generate and show code button - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - OutputGraph(); - } - - // Csharp language selection button - void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = true; - radioButton2->Checked = false; - radioButton3->Checked = false; - language = 1; - } - - // Visual Basic language selection button - void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = false; - radioButton2->Checked = true; - radioButton3->Checked = false; - language = 2; - } - - // JScript language selection button - void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioButton1->Checked = false; - radioButton2->Checked = false; - radioButton3->Checked = true; - language = 3; - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp deleted file mode 100644 index bf0e69c601b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp +++ /dev/null @@ -1,81 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeAttachEventStatementExample - { - public: - CodeAttachEventStatementExample() - { - - // - // Declares a type to contain the delegate and constructor method. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "AttachEventTest" ); - - // Declares an event that needs no custom event arguments class. - CodeMemberEvent^ event1 = gcnew CodeMemberEvent; - event1->Name = "TestEvent"; - event1->Type = gcnew CodeTypeReference( "System.EventHandler" ); - - // Adds the event to the type members. - type1->Members->Add( event1 ); - - // Declares a method that matches the System.EventHandler method signature. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "TestMethod"; - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); - - // Adds the method to the type members. - type1->Members->Add( method1 ); - - // Defines a constructor that attaches a TestDelegate delegate pointing to - // the TestMethod method to the TestEvent event. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - - // - // Defines a delegate creation expression that creates an EventHandler delegate pointing to a method named TestMethod. - CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"TestMethod" ); - - // Attaches an EventHandler delegate pointing to TestMethod to the TestEvent event. - CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestEvent += new System.EventHandler(this.TestMethod); - // - // Adds the constructor statements to the construtor. - constructor1->Statements->Add( attachStatement1 ); - - // Adds the construtor to the type members. - type1->Members->Add( constructor1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class AttachEventTest - // { - // - // public AttachEventTest() - // { - // this.TestEvent += new System.EventHandler(this.TestMethod); - // } - // - // private event System.EventHandler TestEvent; - // - // private void TestMethod(object sender, System.EventArgs e) - // { - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp deleted file mode 100644 index 0e04788981c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -namespace CodeAttributeArgumentCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - - // CodeAttributeArgumentCollection - void CodeAttributeArgumentCollectionExample() - { - - // - // - // Creates an empty CodeAttributeArgumentCollection. - CodeAttributeArgumentCollection^ collection = gcnew CodeAttributeArgumentCollection; - // - - // - // Adds a CodeAttributeArgument to the collection. - collection->Add( gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ) ); - // - - // - // Adds an array of CodeAttributeArgument objects to the collection. - array^arguments = {gcnew CodeAttributeArgument,gcnew CodeAttributeArgument}; - collection->AddRange( arguments ); - - // Adds a collection of CodeAttributeArgument objects to - // the collection. - CodeAttributeArgumentCollection^ argumentsCollection = gcnew CodeAttributeArgumentCollection; - argumentsCollection->Add( gcnew CodeAttributeArgument( "TestBooleanArgument",gcnew CodePrimitiveExpression( true ) ) ); - argumentsCollection->Add( gcnew CodeAttributeArgument( "TestIntArgument",gcnew CodePrimitiveExpression( 1 ) ) ); - collection->AddRange( argumentsCollection ); - // - - // - // Tests for the presence of a CodeAttributeArgument - // within the collection, and retrieves its index if it is found. - CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ); - int itemIndex = -1; - if ( collection->Contains( testArgument ) ) - itemIndex = collection->IndexOf( testArgument ); - // - - // - // Copies the contents of the collection beginning at index 0, - // to the specified CodeAttributeArgument array. - // 'arguments' is a CodeAttributeArgument array. - collection->CopyTo( arguments, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeAttributeArgument at index 0 of the collection. - collection->Insert( 0, gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ) ); - // - - // - // Removes the specified CodeAttributeArgument from the collection. - CodeAttributeArgument^ argument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ); - collection->Remove( argument ); - // - - // - // Removes the CodeAttributeArgument at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp deleted file mode 100644 index cfcbb80230e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Collections; - -namespace CodeAttributeDeclarationCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeAttributeDeclarationCollection - void CodeAttributeDeclarationCollectionExample() - { - - // - // - // Creates an empty CodeAttributeDeclarationCollection. - CodeAttributeDeclarationCollection^ collection = gcnew CodeAttributeDeclarationCollection; - // - - // - // Adds a CodeAttributeDeclaration to the collection. - array^temp = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; - collection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp ) ); - // - - // - // Adds an array of CodeAttributeDeclaration objects - // to the collection. - array^declarations = {gcnew CodeAttributeDeclaration,gcnew CodeAttributeDeclaration}; - collection->AddRange( declarations ); - - // Adds a collection of CodeAttributeDeclaration objects - // to the collection. - CodeAttributeDeclarationCollection^ declarationsCollection = gcnew CodeAttributeDeclarationCollection; - array^temp1 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; - declarationsCollection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp1 ) ); - array^temp2 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( true ) )}; - declarationsCollection->Add( gcnew CodeAttributeDeclaration( "BrowsableAttribute",temp2 ) ); - collection->AddRange( declarationsCollection ); - // - - // - // Tests for the presence of a CodeAttributeDeclaration in - // the collection, and retrieves its index if it is found. - array^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; - CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 ); - int itemIndex = -1; - if ( collection->Contains( testdeclaration ) ) - itemIndex = collection->IndexOf( testdeclaration ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified CodeAttributeDeclaration array. - // 'declarations' is a CodeAttributeDeclaration array. - collection->CopyTo( declarations, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeAttributeDeclaration at index 0 of the collection. - array^temp4 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; - collection->Insert( 0, gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp4 ) ); - // - - // - // Removes the specified CodeAttributeDeclaration from - // the collection. - array^temp5 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; - CodeAttributeDeclaration^ declaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp5 ); - collection->Remove( declaration ); - // - - // - // Removes the CodeAttributeDeclaration at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp deleted file mode 100644 index 636d5881825..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -public ref class CodeBaseReferenceExpressionExample -{ -public: - CodeBaseReferenceExpressionExample() - { - - // - // Example method invoke expression uses CodeBaseReferenceExpression to produce - // a base.Dispose method call - CodeMethodInvokeExpression^ methodInvokeExpression = - gcnew CodeMethodInvokeExpression( // Creates a method invoke expression - gcnew CodeBaseReferenceExpression, // targetObjectparameter can be a base class reference - "Dispose",gcnew array{} ); // Method name and method parameter arguments - - // A C# code generator produces the following source code for the preceeding example code: - // base.Dispose(); - // - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp deleted file mode 100644 index 5acadb676c2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeBinaryOperatorExpressionExample - { - public: - CodeBinaryOperatorExpressionExample() - { - - // - // This CodeBinaryOperatorExpression represents the addition of 1 and 2. - - // Right operand. - CodeBinaryOperatorExpression^ addMethod = gcnew CodeBinaryOperatorExpression( gcnew CodePrimitiveExpression( 1 ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 2 ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // (1 + 2) - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp deleted file mode 100644 index 6bcd05541f1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeCastExpressionExample - { - public: - CodeCastExpressionExample() - { - - // - // This CodeCastExpression casts an Int32 of 1000 to an Int64. - - // targetType parameter indicating the target type of the cast. - // The CodeExpression to cast, here an Int32 value of 1000. - CodeCastExpression^ castExpression = gcnew CodeCastExpression( "System.Int64",gcnew CodePrimitiveExpression( 1000 ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // ((long)(1000)); - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp deleted file mode 100644 index b1f1d3cb90e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -namespace CodeCatchClauseCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeCatchClauseCollection - void CodeCatchClauseCollectionExample() - { - // - // - // Creates an empty CodeCatchClauseCollection. - CodeCatchClauseCollection^ collection = gcnew CodeCatchClauseCollection; - // - - // - // Adds a CodeCatchClause to the collection. - collection->Add( gcnew CodeCatchClause( "e" ) ); - // - - // - // Adds an array of CodeCatchClause objects to the collection. - array^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause}; - collection->AddRange( clauses ); - - // Adds a collection of CodeCatchClause objects to the collection. - CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection; - clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) ); - clausesCollection->Add( gcnew CodeCatchClause( "e" ) ); - collection->AddRange( clausesCollection ); - // - - // - // Tests for the presence of a CodeCatchClause in the - // collection, and retrieves its index if it is found. - CodeCatchClause^ testClause = gcnew CodeCatchClause( "e" ); - int itemIndex = -1; - if ( collection->Contains( testClause ) ) - itemIndex = collection->IndexOf( testClause ); - // - - // - // Copies the contents of the collection beginning at index 0 to the specified CodeCatchClause array. - // 'clauses' is a CodeCatchClause array. - collection->CopyTo( clauses, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeCatchClause at index 0 of the collection. - collection->Insert( 0, gcnew CodeCatchClause( "e" ) ); - // - - // - // Removes the specified CodeCatchClause from the collection. - CodeCatchClause^ clause = gcnew CodeCatchClause( "e" ); - collection->Remove( clause ); - // - - // - // Removes the CodeCatchClause at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp deleted file mode 100644 index f4f7099d6a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeCommentExample - { - public: - CodeCommentExample() - { - - // - // Create a CodeComment with some example comment text. - - // The text of the comment. - // Whether the comment is a comment intended for documentation purposes. - CodeComment^ comment = gcnew CodeComment( "This comment was generated from a System.CodeDom.CodeComment",false ); - - // Create a CodeCommentStatement that contains the comment, in order - // to add the comment to a CodeTypeDeclaration Members collection. - CodeCommentStatement^ commentStatement = gcnew CodeCommentStatement( comment ); - - // A C# code generator produces the following source code for the preceeding example code: - // // This comment was generated from a System.CodeDom.CodeComment - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp deleted file mode 100644 index c779ba5e491..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -namespace CodeCommentStatementCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeCommentStatementCollection - void CodeCommentStatementCollectionExample() - { - - // - // - // Creates an empty CodeCommentStatementCollection. - CodeCommentStatementCollection^ collection = gcnew CodeCommentStatementCollection; - // - - // - // Adds a CodeCommentStatement to the collection. - collection->Add( gcnew CodeCommentStatement( "Test comment" ) ); - // - - // - // Adds an array of CodeCommentStatement objects to the collection. - array^comments = {gcnew CodeCommentStatement( "Test comment" ),gcnew CodeCommentStatement( "Another test comment" )}; - collection->AddRange( comments ); - - // Adds a collection of CodeCommentStatement objects to the collection. - CodeCommentStatementCollection^ commentsCollection = gcnew CodeCommentStatementCollection; - commentsCollection->Add( gcnew CodeCommentStatement( "Test comment" ) ); - commentsCollection->Add( gcnew CodeCommentStatement( "Another test comment" ) ); - collection->AddRange( commentsCollection ); - // - - // - // Tests for the presence of a CodeCommentStatement in the - // collection, and retrieves its index if it is found. - CodeCommentStatement^ testComment = gcnew CodeCommentStatement( "Test comment" ); - int itemIndex = -1; - if ( collection->Contains( testComment ) ) - itemIndex = collection->IndexOf( testComment ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified CodeCommentStatement array. - // 'comments' is a CodeCommentStatement array. - collection->CopyTo( comments, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeCommentStatement at index 0 of the collection. - collection->Insert( 0, gcnew CodeCommentStatement( "Test comment" ) ); - // - - // - // Removes the specified CodeCommentStatement from the collection. - CodeCommentStatement^ comment = gcnew CodeCommentStatement( "Test comment" ); - collection->Remove( comment ); - // - - // - // Removes the CodeCommentStatement at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp deleted file mode 100644 index 9209d6fd754..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeConditionStatementExample - { - public: - CodeConditionStatementExample() - { - - // - // Create a CodeConditionStatement that tests a boolean value named boolean. - array^temp0 = {gcnew CodeCommentStatement( "If condition is true, execute these statements." )}; - array^temp1 = {gcnew CodeCommentStatement( "Else block. If condition is false, execute these statements." )}; - - // The statements to execute if the condition evalues to false. - CodeConditionStatement^ conditionalStatement = gcnew CodeConditionStatement( gcnew CodeVariableReferenceExpression( "boolean" ),temp0,temp1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // if (boolean) - // { - // // If condition is true, execute these statements. - // } - // else { - // // Else block. If condition is false, execute these statements. - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp deleted file mode 100644 index f222b742baf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp +++ /dev/null @@ -1,130 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::Reflection; - -namespace CodeDomSamples -{ - public ref class CodeConstructorExample - { - public: - CodeConstructorExample() - { - - // - // This example declares two types, one of which inherits from another, - // and creates a set of different styles of constructors using CodeConstructor. - // Creates a new CodeCompileUnit to contain the program graph. - CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit; - - // Declares a new namespace object and names it. - CodeNamespace^ Samples = gcnew CodeNamespace( "Samples" ); - - // Adds the namespace object to the compile unit. - CompileUnit->Namespaces->Add( Samples ); - - // Adds a new namespace import for the System namespace. - Samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); - - // Declares a new type and names it. - CodeTypeDeclaration^ BaseType = gcnew CodeTypeDeclaration( "BaseType" ); - - // Adds the new type to the namespace object's type collection. - Samples->Types->Add( BaseType ); - - // Declares a default constructor that takes no arguments. - CodeConstructor^ defaultConstructor = gcnew CodeConstructor; - defaultConstructor->Attributes = MemberAttributes::Public; - - // Adds the constructor to the Members collection of the BaseType. - BaseType->Members->Add( defaultConstructor ); - - // Declares a constructor that takes a string argument. - CodeConstructor^ stringConstructor = gcnew CodeConstructor; - stringConstructor->Attributes = MemberAttributes::Public; - - // Declares a parameter of type string named "TestStringParameter". - stringConstructor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","TestStringParameter" ) ); - - // Adds the constructor to the Members collection of the BaseType. - BaseType->Members->Add( stringConstructor ); - - // Declares a type that derives from BaseType and names it. - CodeTypeDeclaration^ DerivedType = gcnew CodeTypeDeclaration( "DerivedType" ); - - // The DerivedType class inherits from the BaseType class. - DerivedType->BaseTypes->Add( gcnew CodeTypeReference( "BaseType" ) ); - - // Adds the new type to the namespace object's type collection. - Samples->Types->Add( DerivedType ); - - // Declare a constructor that takes a string argument and calls the base class constructor with it. - CodeConstructor^ baseStringConstructor = gcnew CodeConstructor; - baseStringConstructor->Attributes = MemberAttributes::Public; - - // Declares a parameter of type string named "TestStringParameter". - baseStringConstructor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","TestStringParameter" ) ); - - // Calls a base class constructor with the TestStringParameter parameter. - baseStringConstructor->BaseConstructorArgs->Add( gcnew CodeVariableReferenceExpression( "TestStringParameter" ) ); - - // Adds the constructor to the Members collection of the DerivedType. - DerivedType->Members->Add( baseStringConstructor ); - - // Declares a constructor overload that calls another constructor for the type with a predefined argument. - CodeConstructor^ overloadConstructor = gcnew CodeConstructor; - overloadConstructor->Attributes = MemberAttributes::Public; - - // Sets the argument to pass to a base constructor method. - overloadConstructor->ChainedConstructorArgs->Add( gcnew CodePrimitiveExpression( "Test" ) ); - - // Adds the constructor to the Members collection of the DerivedType. - DerivedType->Members->Add( overloadConstructor ); - - // Declares a constructor overload that calls the default constructor for the type. - CodeConstructor^ overloadConstructor2 = gcnew CodeConstructor; - overloadConstructor2->Attributes = MemberAttributes::Public; - overloadConstructor2->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Int32","TestIntParameter" ) ); - - // Sets the argument to pass to a base constructor method. - overloadConstructor2->ChainedConstructorArgs->Add( gcnew CodeSnippetExpression( "" ) ); - - // Adds the constructor to the Members collection of the DerivedType. - DerivedType->Members->Add( overloadConstructor2 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class BaseType { - // - // public BaseType() { - // } - // - // public BaseType(string TestStringParameter) { - // } - // } - // - // public class DerivedType : BaseType { - // - // public DerivedType(string TestStringParameter) : - // base(TestStringParameter) { - // } - // - // public DerivedType() : - // this("Test") { - // } - // - // public DerivedType(int TestIntParameter) : - // this() { - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp deleted file mode 100644 index 7e7167c2f2c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp +++ /dev/null @@ -1,98 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeDelegateInvokeExpressionExample - { - public: - CodeDelegateInvokeExpressionExample() - { - - // - // Declares a type to contain the delegate and constructor method. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "DelegateInvokeTest" ); - - // Declares an event that accepts a custom delegate type of "TestDelegate". - CodeMemberEvent^ event1 = gcnew CodeMemberEvent; - event1->Name = "TestEvent"; - event1->Type = gcnew CodeTypeReference( "DelegateInvokeTest.TestDelegate" ); - type1->Members->Add( event1 ); - - // Declares a delegate type called TestDelegate with an EventArgs parameter. - CodeTypeDelegate^ delegate1 = gcnew CodeTypeDelegate( "TestDelegate" ); - delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); - delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); - type1->Members->Add( delegate1 ); - - // Declares a method that matches the "TestDelegate" method signature. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "TestMethod"; - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); - type1->Members->Add( method1 ); - - // Defines a constructor that attaches a TestDelegate delegate pointing to the TestMethod method - // to the TestEvent event. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - constructor1->Statements->Add( gcnew CodeCommentStatement( "Attaches a delegate to the TestEvent event." ) ); - - // Creates and attaches a delegate to the TestEvent. - CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "DelegateInvokeTest.TestDelegate" ),gcnew CodeThisReferenceExpression,"TestMethod" ); - CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 ); - constructor1->Statements->Add( attachStatement1 ); - constructor1->Statements->Add( gcnew CodeCommentStatement( "Invokes the TestEvent event." ) ); - - // Invokes the TestEvent. - array^temp0 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )}; - CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp0 ); - constructor1->Statements->Add( invoke1 ); - type1->Members->Add( constructor1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class DelegateInvokeTest - // { - // - // public DelegateInvokeTest() - // { - // // Attaches a delegate to the TestEvent event. - // this.TestEvent += new DelegateInvokeTest.TestDelegate(this.TestMethod); - // // Invokes the TestEvent event. - // this.TestEvent(this, new System.EventArgs()); - // } - // - // private event DelegateInvokeTest.TestDelegate TestEvent; - // - // private void TestMethod(object sender, System.EventArgs e) - // { - // } - // - // public delegate void TestDelegate(object sender, System.EventArgs e); - // } - // - } - - void DelegateInvokeOnlyType() - { - - // - // Invokes the delegates for an event named TestEvent, passing a local object reference and a new System.EventArgs. - array^temp1 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )}; - CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestEvent(this, new System.EventArgs()); - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp deleted file mode 100644 index 2f548be0a78..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp +++ /dev/null @@ -1,309 +0,0 @@ -/* -// CodeDOMExample_CPP.cpp : main project file. - -#include "stdafx.h" - -using namespace System; - -int main(array ^args) -{ - Console::WriteLine(L"Hello World"); - return 0; -} -*/ - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Diagnostics; -using namespace System::Drawing; -using namespace System::IO; -using namespace System::Windows::Forms; -using namespace Microsoft::CSharp; -using namespace Microsoft::VisualBasic; -using namespace Microsoft::JScript; -using namespace System::Security::Permissions; - -// This example demonstrates building a Hello World program graph -// using System.CodeDom elements. It calls code generator and -// code compiler methods to build the program using CSharp, VB, or -// JScript. A Windows Forms interface is included. Note: Code -// must be compiled and linked with the Microsoft.JScript assembly. -namespace CodeDOMExample -{ - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - public ref class CodeDomExample - { - public: - // - // Build a Hello World program graph using - // System::CodeDom types. - static CodeCompileUnit^ BuildHelloWorldGraph() - { - // Create a new CodeCompileUnit to contain - // the program graph. - CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; - - // Declare a new namespace called Samples. - CodeNamespace^ samples = gcnew CodeNamespace( "Samples" ); - - // Add the new namespace to the compile unit. - compileUnit->Namespaces->Add( samples ); - - // Add the new namespace import for the System namespace. - samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); - - // Declare a new type called Class1. - CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" ); - - // Add the new type to the namespace's type collection. - samples->Types->Add( class1 ); - - // Declare a new code entry point method. - CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod; - - // Create a type reference for the System::Console class. - CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" ); - - // Build a Console::WriteLine statement. - CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression("Hello World!") ); - - // Add the WriteLine call to the statement collection. - start->Statements->Add( cs1 ); - - // Build another Console::WriteLine statement. - CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) ); - - // Add the WriteLine call to the statement collection. - start->Statements->Add( cs2 ); - - // Build a call to System::Console::ReadLine. - CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression( csSystemConsoleType, "ReadLine" ); - CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression( csReadLine, gcnew array(0) ); - - // Add the ReadLine statement. - start->Statements->Add( cs3 ); - - // Add the code entry point method to - // the Members collection of the type. - class1->Members->Add( start ); - return compileUnit; - } - // - - // - static void GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit ) - { - // Build the source file name with the appropriate - // language extension. - String^ sourceFile; - if ( provider->FileExtension->StartsWith( "." ) ) - { - sourceFile = String::Concat( "TestGraph", provider->FileExtension ); - } - else - { - sourceFile = String::Concat( "TestGraph.", provider->FileExtension ); - } - - // Create an IndentedTextWriter, constructed with - // a StreamWriter to the source file. - IndentedTextWriter^ tw = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false )," " ); - - // Generate source code using the code generator. - provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions ); - - // Close the output file. - tw->Close(); - } - // - - // - static CompilerResults^ CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile ) - { - // Configure a CompilerParameters that links System.dll - // and produces the specified executable file. - array^referenceAssemblies = {"System.dll"}; - CompilerParameters^ cp = gcnew CompilerParameters( referenceAssemblies,exeFile,false ); - - // Generate an executable rather than a DLL file. - cp->GenerateExecutable = true; - - // Invoke compilation. - CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile ); - - // Return the results of compilation. - return cr; - } - // - }; - - public ref class CodeDomExampleForm: public System::Windows::Forms::Form - { - private: - static System::Windows::Forms::Button^ run_button = gcnew System::Windows::Forms::Button; - static System::Windows::Forms::Button^ compile_button = gcnew System::Windows::Forms::Button; - static System::Windows::Forms::Button^ generate_button = gcnew System::Windows::Forms::Button; - static System::Windows::Forms::TextBox^ textBox1 = gcnew System::Windows::Forms::TextBox; - static System::Windows::Forms::ComboBox^ comboBox1 = gcnew System::Windows::Forms::ComboBox; - static System::Windows::Forms::Label^ label1 = gcnew System::Windows::Forms::Label; - void generate_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CodeDomProvider^ provider = GetCurrentProvider(); - CodeDomExample::GenerateCode( provider, CodeDomExample::BuildHelloWorldGraph() ); - - // Build the source file name with the appropriate - // language extension. - String^ sourceFile; - if ( provider->FileExtension->StartsWith( "." ) ) - { - sourceFile = String::Concat( "TestGraph", provider->FileExtension ); - } - else - { - sourceFile = String::Concat( "TestGraph.", provider->FileExtension ); - } - - - // Read in the generated source file and - // display the source text. - StreamReader^ sr = gcnew StreamReader( sourceFile ); - textBox1->Text = sr->ReadToEnd(); - sr->Close(); - } - - CodeDomProvider^ GetCurrentProvider() - { - CodeDomProvider^ provider; - if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "CSharp" ) == 0 ) - provider = CodeDomProvider::CreateProvider("CSharp"); - else - if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "Visual Basic" ) == 0 ) - provider = CodeDomProvider::CreateProvider("VisualBasic"); - else - if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "JScript" ) == 0 ) - provider = CodeDomProvider::CreateProvider("JScript"); - else - provider = CodeDomProvider::CreateProvider("CSharp"); - - return provider; - } - - void compile_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CodeDomProvider^ provider = GetCurrentProvider(); - - // Build the source file name with the appropriate - // language extension. - String^ sourceFile = String::Concat( "TestGraph.", provider->FileExtension ); - - // Compile the source file into an executable output file. - CompilerResults^ cr = CodeDomExample::CompileCode( provider, sourceFile, "TestGraph.exe" ); - if ( cr->Errors->Count > 0 ) - { - // Display compilation errors. - textBox1->Text = String::Concat( "Errors encountered while building ", sourceFile, " into ", cr->PathToAssembly, ": \r\n\n" ); - System::CodeDom::Compiler::CompilerError^ ce; - for ( int i = 0; i < cr->Errors->Count; i++ ) - { - ce = cr->Errors[i]; - textBox1->AppendText( String::Concat( ce->ToString(), "\r\n" ) ); - - } - run_button->Enabled = false; - } - else - { - textBox1->Text = String::Concat( "Source ", sourceFile, " built into ", cr->PathToAssembly, " with no errors." ); - run_button->Enabled = true; - } - } - - void run_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Process::Start( "TestGraph.exe" ); - } - - public: - CodeDomExampleForm() - { - this->SuspendLayout(); - - // Set properties for label1. - this->label1->Location = System::Drawing::Point( 395, 20 ); - this->label1->Size = System::Drawing::Size( 180, 22 ); - this->label1->Text = "Select a programming language:"; - - // Set properties for comboBox1. - this->comboBox1->Location = System::Drawing::Point( 560, 16 ); - this->comboBox1->Size = System::Drawing::Size( 190, 23 ); - this->comboBox1->Name = "comboBox1"; - array^temp1 = {"CSharp","Visual Basic","JScript"}; - this->comboBox1->Items->AddRange( temp1 ); - this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right | System::Windows::Forms::AnchorStyles::Top); - this->comboBox1->SelectedIndex = 0; - - // Set properties for generate_button. - this->generate_button->Location = System::Drawing::Point( 8, 16 ); - this->generate_button->Name = "generate_button"; - this->generate_button->Size = System::Drawing::Size( 120, 23 ); - this->generate_button->Text = "Generate Code"; - this->generate_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::generate_button_Click ); - - // Set properties for compile_button. - this->compile_button->Location = System::Drawing::Point( 136, 16 ); - this->compile_button->Name = "compile_button"; - this->compile_button->Size = System::Drawing::Size( 120, 23 ); - this->compile_button->Text = "Compile"; - this->compile_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::compile_button_Click ); - - // Set properties for run_button. - this->run_button->Enabled = false; - this->run_button->Location = System::Drawing::Point( 264, 16 ); - this->run_button->Name = "run_button"; - this->run_button->Size = System::Drawing::Size( 120, 23 ); - this->run_button->Text = "Run"; - this->run_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::run_button_Click ); - - // Set properties for textBox1. - this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->textBox1->Location = System::Drawing::Point( 8, 48 ); - this->textBox1->Multiline = true; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 744, 280 ); - this->textBox1->Text = ""; - - // Set properties for the CodeDomExampleForm. - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 768, 340 ); - this->MinimumSize = System::Drawing::Size( 750, 340 ); - array^myControl = {this->textBox1,this->run_button,this->compile_button,this->generate_button,this->comboBox1,this->label1}; - this->Controls->AddRange( myControl ); - this->Name = "CodeDomExampleForm"; - this->Text = "CodeDom Hello World Example"; - this->ResumeLayout( false ); - } - - public: - ~CodeDomExampleForm() - { - } - }; - -} - -[STAThread] -int main() -{ - Application::Run( gcnew CodeDOMExample::CodeDomExampleForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp deleted file mode 100644 index 080c30b3d2c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp +++ /dev/null @@ -1,439 +0,0 @@ - -// The following example builds a CodeDom source graph for a simple -// class that represents document properties. The source for the -// graph is generated, saved to a file, compiled into an executable, -// and run. -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::IO; -using namespace System::Diagnostics; - -// -// Build the source graph using System.CodeDom types. -CodeCompileUnit^ DocumentPropertyGraphBase() -{ - // Create a new CodeCompileUnit for the source graph. - CodeCompileUnit^ docPropUnit = gcnew CodeCompileUnit; - - // Declare a new namespace called DocumentSamples. - CodeNamespace^ sampleSpace = gcnew CodeNamespace( "DocumentSamples" ); - - // Add the new namespace to the compile unit. - docPropUnit->Namespaces->Add( sampleSpace ); - - // Add an import statement for the System namespace. - sampleSpace->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); - - // Declare a new class called DocumentProperties. - // - CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties" ); - baseClass->IsPartial = true; - baseClass->IsClass = true; - baseClass->Attributes = MemberAttributes::Public; - baseClass->BaseTypes->Add( gcnew CodeTypeReference( System::Object::typeid ) ); - - // Add the DocumentProperties class to the namespace. - sampleSpace->Types->Add( baseClass ); - // - - // ------Build the DocumentProperty.Main method------ - // Declare the Main method of the class. - CodeEntryPointMethod^ mainMethod = gcnew CodeEntryPointMethod; - mainMethod->Comments->Add( gcnew CodeCommentStatement( " Perform a simple test of the class methods." ) ); - - // Add the code entry point method to the Members - // collection of the type. - baseClass->Members->Add( mainMethod ); - mainMethod->Statements->Add( gcnew CodeCommentStatement( "Initialize a class instance and display it." ) ); - - // - // Initialize a local DocumentProperty instance, named myDoc. - // Use the DocumentProperty constructor to set the author, - // title, and date. Set the publish date to DateTime.Now. - CodePrimitiveExpression^ docTitlePrimitive = gcnew CodePrimitiveExpression( "Cubicle Survival Strategies" ); - CodePrimitiveExpression^ docAuthorPrimitive = gcnew CodePrimitiveExpression( "John Smith" ); - - // Store the value of DateTime.Now in a local variable, to re-use - // the same value later. - CodeTypeReferenceExpression^ docDateClass = gcnew CodeTypeReferenceExpression( "DateTime" ); - CodePropertyReferenceExpression^ docDateNow = gcnew CodePropertyReferenceExpression( docDateClass,"Now" ); - CodeVariableDeclarationStatement^ publishNow = gcnew CodeVariableDeclarationStatement( DateTime::typeid,"publishNow",docDateNow ); - mainMethod->Statements->Add( publishNow ); - CodeVariableReferenceExpression^ publishNowRef = gcnew CodeVariableReferenceExpression( "publishNow" ); - array^ctorParams = {docTitlePrimitive,docAuthorPrimitive,publishNowRef}; - CodeObjectCreateExpression^ initDocConstruct = gcnew CodeObjectCreateExpression( "DocumentProperties",ctorParams ); - CodeVariableDeclarationStatement^ myDocDeclare = gcnew CodeVariableDeclarationStatement( "DocumentProperties","myDoc",initDocConstruct ); - mainMethod->Statements->Add( myDocDeclare ); - // - - // Create a variable reference for the myDoc instance. - CodeVariableReferenceExpression^ myDocInstance = gcnew CodeVariableReferenceExpression( "myDoc" ); - - // Create a type reference for the System.Console class. - CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" ); - - // Build Console.WriteLine statement. - CodeMethodInvokeExpression^ consoleWriteLine0 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "** Document properties test **" ) ); - - // Add the WriteLine call to the statement collection. - mainMethod->Statements->Add( consoleWriteLine0 ); - - // Build Console.WriteLine("First document:"). - CodeMethodInvokeExpression^ consoleWriteLine1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "First document:" ) ); - - // Add the WriteLine call to the statement collection. - mainMethod->Statements->Add( consoleWriteLine1 ); - - // Add a statement to display the myDoc instance properties. - CodeMethodInvokeExpression^ myDocToString = gcnew CodeMethodInvokeExpression( myDocInstance,"ToString" ); - CodeMethodInvokeExpression^ consoleWriteLine2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",myDocToString ); - mainMethod->Statements->Add( consoleWriteLine2 ); - - // Add a statement to display the myDoc instance hashcode property. - CodeMethodInvokeExpression^ myDocHashCode = gcnew CodeMethodInvokeExpression( myDocInstance,"GetHashCode" ); - array^writeHashCodeParams = {gcnew CodePrimitiveExpression( " Hash code: {0}" ),myDocHashCode}; - CodeMethodInvokeExpression^ consoleWriteLine3 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",writeHashCodeParams ); - mainMethod->Statements->Add( consoleWriteLine3 ); - - // Add statements to create another instance. - mainMethod->Statements->Add( gcnew CodeCommentStatement( "Create another instance." ) ); - CodeVariableDeclarationStatement^ myNewDocDeclare = gcnew CodeVariableDeclarationStatement( "DocumentProperties","myNewDoc",initDocConstruct ); - mainMethod->Statements->Add( myNewDocDeclare ); - - // Create a variable reference for the myNewDoc instance. - CodeVariableReferenceExpression^ myNewDocInstance = gcnew CodeVariableReferenceExpression( "myNewDoc" ); - - // Build Console.WriteLine("Second document:"). - CodeMethodInvokeExpression^ consoleWriteLine5 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Second document:" ) ); - - // Add the WriteLine call to the statement collection. - mainMethod->Statements->Add( consoleWriteLine5 ); - - // Add a statement to display the myNewDoc instance properties. - CodeMethodInvokeExpression^ myNewDocToString = gcnew CodeMethodInvokeExpression( myNewDocInstance,"ToString" ); - CodeMethodInvokeExpression^ consoleWriteLine6 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",myNewDocToString ); - mainMethod->Statements->Add( consoleWriteLine6 ); - - // Add a statement to display the myNewDoc instance hashcode property. - CodeMethodInvokeExpression^ myNewDocHashCode = gcnew CodeMethodInvokeExpression( myNewDocInstance,"GetHashCode" ); - array^writeNewHashCodeParams = {gcnew CodePrimitiveExpression( " Hash code: {0}" ),myNewDocHashCode}; - CodeMethodInvokeExpression^ consoleWriteLine7 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",writeNewHashCodeParams ); - mainMethod->Statements->Add( consoleWriteLine7 ); - - // - // Build a compound statement to compare the two instances. - mainMethod->Statements->Add( gcnew CodeCommentStatement( "Compare the two instances." ) ); - CodeMethodInvokeExpression^ myDocEquals = gcnew CodeMethodInvokeExpression( myDocInstance,"Equals",myNewDocInstance ); - CodePrimitiveExpression^ equalLine = gcnew CodePrimitiveExpression( "Second document is equal to the first." ); - CodePrimitiveExpression^ notEqualLine = gcnew CodePrimitiveExpression( "Second document is not equal to the first." ); - CodeMethodInvokeExpression^ equalWriteLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",equalLine ); - CodeMethodInvokeExpression^ notEqualWriteLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",notEqualLine ); - array^equalStatements = {gcnew CodeExpressionStatement( equalWriteLine )}; - array^notEqualStatements = {gcnew CodeExpressionStatement( notEqualWriteLine )}; - CodeConditionStatement^ docCompare = gcnew CodeConditionStatement( myDocEquals,equalStatements,notEqualStatements ); - mainMethod->Statements->Add( docCompare ); - // - - // - // Add a statement to change the myDoc.Author property: - mainMethod->Statements->Add( gcnew CodeCommentStatement( "Change the author of the original instance." ) ); - CodePropertyReferenceExpression^ myDocAuthor = gcnew CodePropertyReferenceExpression( myDocInstance,"Author" ); - CodePrimitiveExpression^ newDocAuthor = gcnew CodePrimitiveExpression( "Jane Doe" ); - CodeAssignStatement^ myDocAuthorAssign = gcnew CodeAssignStatement( myDocAuthor,newDocAuthor ); - mainMethod->Statements->Add( myDocAuthorAssign ); - // - - // Add a statement to display the modified instance. - CodeMethodInvokeExpression^ consoleWriteLine8 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Modified original document:" ) ); - mainMethod->Statements->Add( consoleWriteLine8 ); - - // Reuse the myDoc.ToString statement built earlier. - mainMethod->Statements->Add( consoleWriteLine2 ); - - // Reuse the comparison block built earlier. - mainMethod->Statements->Add( gcnew CodeCommentStatement( "Compare the two instances again." ) ); - mainMethod->Statements->Add( docCompare ); - - // Add a statement to prompt the user to hit a key. - - // Build another call to System.WriteLine. - // Add string parameter to the WriteLine method. - CodeMethodInvokeExpression^ consoleWriteLine9 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) ); - mainMethod->Statements->Add( consoleWriteLine9 ); - - // Build a call to System.ReadLine. - CodeMethodInvokeExpression^ consoleReadLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"ReadLine" ); - mainMethod->Statements->Add( consoleReadLine ); - - // Define a few common expressions for the class methods. - CodePropertyReferenceExpression^ thisTitle = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ); - CodePropertyReferenceExpression^ thisAuthor = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ); - CodePropertyReferenceExpression^ thisDate = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ); - CodeTypeReferenceExpression^ stringType = gcnew CodeTypeReferenceExpression( String::typeid ); - CodePrimitiveExpression^ trueConst = gcnew CodePrimitiveExpression( true ); - CodePrimitiveExpression^ falseConst = gcnew CodePrimitiveExpression( false ); - - // ------Build the DocumentProperty.Equals method------ - CodeMemberMethod^ baseEquals = gcnew CodeMemberMethod; - baseEquals->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override | MemberAttributes::Overloaded); - baseEquals->ReturnType = gcnew CodeTypeReference( bool::typeid ); - baseEquals->Name = "Equals"; - baseEquals->Parameters->Add( gcnew CodeParameterDeclarationExpression( Object::typeid,"obj" ) ); - baseEquals->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.Equals method." ) ); - CodeVariableReferenceExpression^ objVar = gcnew CodeVariableReferenceExpression( "obj" ); - CodeCastExpression^ objCast = gcnew CodeCastExpression( "DocumentProperties",objVar ); - CodePropertyReferenceExpression^ objTitle = gcnew CodePropertyReferenceExpression( objCast,"Title" ); - CodePropertyReferenceExpression^ objAuthor = gcnew CodePropertyReferenceExpression( objCast,"Author" ); - CodePropertyReferenceExpression^ objDate = gcnew CodePropertyReferenceExpression( objCast,"PublishDate" ); - CodeMethodInvokeExpression^ objTitleEquals = gcnew CodeMethodInvokeExpression( objTitle,"Equals",thisTitle ); - CodeMethodInvokeExpression^ objAuthorEquals = gcnew CodeMethodInvokeExpression( objAuthor,"Equals",thisAuthor ); - CodeMethodInvokeExpression^ objDateEquals = gcnew CodeMethodInvokeExpression( objDate,"Equals",thisDate ); - CodeBinaryOperatorExpression^ andEquals1 = gcnew CodeBinaryOperatorExpression( objTitleEquals,CodeBinaryOperatorType::BooleanAnd,objAuthorEquals ); - CodeBinaryOperatorExpression^ andEquals2 = gcnew CodeBinaryOperatorExpression( andEquals1,CodeBinaryOperatorType::BooleanAnd,objDateEquals ); - array^returnTrueStatements = {gcnew CodeMethodReturnStatement( trueConst )}; - array^returnFalseStatements = {gcnew CodeMethodReturnStatement( falseConst )}; - CodeConditionStatement^ objEquals = gcnew CodeConditionStatement( andEquals2,returnTrueStatements,returnFalseStatements ); - baseEquals->Statements->Add( objEquals ); - baseClass->Members->Add( baseEquals ); - - // ------Build the DocumentProperty.GetHashCode method------ - CodeMemberMethod^ baseHash = gcnew CodeMemberMethod; - baseHash->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override); - baseHash->ReturnType = gcnew CodeTypeReference( int::typeid ); - baseHash->Name = "GetHashCode"; - baseHash->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.GetHashCode method." ) ); - CodeMethodInvokeExpression^ hashTitle = gcnew CodeMethodInvokeExpression( thisTitle,"GetHashCode" ); - CodeMethodInvokeExpression^ hashAuthor = gcnew CodeMethodInvokeExpression( thisAuthor,"GetHashCode" ); - CodeMethodInvokeExpression^ hashDate = gcnew CodeMethodInvokeExpression( thisDate,"GetHashCode" ); - CodeBinaryOperatorExpression^ orHash1 = gcnew CodeBinaryOperatorExpression( hashTitle,CodeBinaryOperatorType::BitwiseOr,hashAuthor ); - CodeBinaryOperatorExpression^ andHash = gcnew CodeBinaryOperatorExpression( orHash1,CodeBinaryOperatorType::BitwiseAnd,hashDate ); - baseHash->Statements->Add( gcnew CodeMethodReturnStatement( andHash ) ); - baseClass->Members->Add( baseHash ); - - // ------Build the DocumentProperty.ToString method------ - CodeMemberMethod^ docToString = gcnew CodeMemberMethod; - docToString->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override); - docToString->ReturnType = gcnew CodeTypeReference( String::typeid ); - docToString->Name = "ToString"; - docToString->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.ToString method." ) ); - CodeMethodInvokeExpression^ baseToString = gcnew CodeMethodInvokeExpression( gcnew CodeBaseReferenceExpression,"ToString" ); - CodePrimitiveExpression^ formatString = gcnew CodePrimitiveExpression( "{0} ({1} by {2}, {3})" ); - array^formatParams = {formatString,baseToString,thisTitle,thisAuthor,thisDate}; - CodeMethodInvokeExpression^ stringFormat = gcnew CodeMethodInvokeExpression( stringType,"Format",formatParams ); - docToString->Statements->Add( gcnew CodeMethodReturnStatement( stringFormat ) ); - baseClass->Members->Add( docToString ); - return docPropUnit; -} -// - -void DocumentPropertyGraphExpand( interior_ptr docPropUnit ) -{ - // Expand on the DocumentProperties class, - // adding the constructor and property implementation. - // - CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties" ); - baseClass->IsPartial = true; - baseClass->IsClass = true; - baseClass->Attributes = MemberAttributes::Public; - - // Extend the DocumentProperties class in the unit namespace. - ( *docPropUnit)->Namespaces[ 0 ]->Types->Add( baseClass ); - // - - // ------Declare the internal class fields------ - baseClass->Members->Add( gcnew CodeMemberField( "String","docTitle" ) ); - baseClass->Members->Add( gcnew CodeMemberField( "String","docAuthor" ) ); - baseClass->Members->Add( gcnew CodeMemberField( "DateTime","docDate" ) ); - - // ------Build the DocumentProperty constructor------ - CodeConstructor^ docPropCtor = gcnew CodeConstructor; - docPropCtor->Attributes = MemberAttributes::Public; - docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","title" ) ); - docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","author" ) ); - docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "DateTime","publishDate" ) ); - CodeFieldReferenceExpression^ myTitle = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ); - CodeVariableReferenceExpression^ inTitle = gcnew CodeVariableReferenceExpression( "title" ); - CodeAssignStatement^ myDocTitleAssign = gcnew CodeAssignStatement( myTitle,inTitle ); - docPropCtor->Statements->Add( myDocTitleAssign ); - CodeFieldReferenceExpression^ myAuthor = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ); - CodeVariableReferenceExpression^ inAuthor = gcnew CodeVariableReferenceExpression( "author" ); - CodeAssignStatement^ myDocAuthorAssign = gcnew CodeAssignStatement( myAuthor,inAuthor ); - docPropCtor->Statements->Add( myDocAuthorAssign ); - CodeFieldReferenceExpression^ myDate = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ); - CodeVariableReferenceExpression^ inDate = gcnew CodeVariableReferenceExpression( "publishDate" ); - CodeAssignStatement^ myDocDateAssign = gcnew CodeAssignStatement( myDate,inDate ); - docPropCtor->Statements->Add( myDocDateAssign ); - baseClass->Members->Add( docPropCtor ); - - // ------Build the DocumentProperty properties------ - CodeMemberProperty^ docTitleProp = gcnew CodeMemberProperty; - docTitleProp->HasGet = true; - docTitleProp->HasSet = true; - docTitleProp->Name = "Title"; - docTitleProp->Type = gcnew CodeTypeReference( "String" ); - docTitleProp->Attributes = MemberAttributes::Public; - docTitleProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ) ) ); - docTitleProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ),gcnew CodePropertySetValueReferenceExpression ) ); - baseClass->Members->Add( docTitleProp ); - CodeMemberProperty^ docAuthorProp = gcnew CodeMemberProperty; - docAuthorProp->HasGet = true; - docAuthorProp->HasSet = true; - docAuthorProp->Name = "Author"; - docAuthorProp->Type = gcnew CodeTypeReference( "String" ); - docAuthorProp->Attributes = MemberAttributes::Public; - docAuthorProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ) ) ); - docAuthorProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ),gcnew CodePropertySetValueReferenceExpression ) ); - baseClass->Members->Add( docAuthorProp ); - CodeMemberProperty^ docDateProp = gcnew CodeMemberProperty; - docDateProp->HasGet = true; - docDateProp->HasSet = true; - docDateProp->Name = "PublishDate"; - docDateProp->Type = gcnew CodeTypeReference( "DateTime" ); - docDateProp->Attributes = MemberAttributes::Public; - docDateProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ) ) ); - docDateProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ),gcnew CodePropertySetValueReferenceExpression ) ); - baseClass->Members->Add( docDateProp ); -} - -String^ GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileUnit ) -{ - // Build the source file name with the language - // extension (vb, cs, js). - String^ sourceFile = ""; - - // Write the source out in the selected language if - // the code generator supports partial type declarations. - if ( provider->Supports( GeneratorSupport::PartialTypes ) ) - { - if ( provider->FileExtension[ 0 ] == '.' ) - { - sourceFile = String::Format( "DocProp{0}", provider->FileExtension ); - } - else - { - sourceFile = String::Format( "DocProp.{0}", provider->FileExtension ); - } - - // Create a TextWriter to a StreamWriter to an output file. - IndentedTextWriter^ outWriter = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false )," " ); - - // Generate source code using the code generator. - provider->GenerateCodeFromCompileUnit( compileUnit, outWriter, nullptr ); - - // Close the output file. - outWriter->Close(); - } - - return sourceFile; -} - -// -bool CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile ) -{ - CompilerParameters^ cp = gcnew CompilerParameters; - - // Generate an executable instead of - // a class library. - cp->GenerateExecutable = true; - - // Set the assembly file name to generate. - cp->OutputAssembly = exeFile; - - // Save the assembly as a physical file. - cp->GenerateInMemory = false; - - // Generate debug information. - cp->IncludeDebugInformation = true; - - // Add an assembly reference. - cp->ReferencedAssemblies->Add( "System.dll" ); - - // Set the warning level at which - // the compiler should abort compilation - // if a warning of this level occurs. - cp->WarningLevel = 3; - - // Set whether to treat all warnings as errors. - cp->TreatWarningsAsErrors = false; - if ( provider->Supports( GeneratorSupport::EntryPointMethod ) ) - { - // Specify the class that contains - // the main method of the executable. - cp->MainClass = "DocumentSamples.DocumentProperties"; - } - - // Invoke compilation. - CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile ); - if ( cr->Errors->Count > 0 ) - { - // Display compilation errors. - Console::WriteLine( "Errors building {0} into {1}", sourceFile, cr->PathToAssembly ); - IEnumerator^ myEnum = cr->Errors->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - CompilerError^ ce = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", ce ); - Console::WriteLine(); - } - } - else - { - Console::WriteLine( "Source {0} built into {1} successfully.", sourceFile, cr->PathToAssembly ); - } - - // Return the results of compilation. - if ( cr->Errors->Count > 0 ) - { - return false; - } - else - { - return true; - } -} -// - -[STAThread] -int main() -{ - CodeDomProvider^ provider = nullptr; - String^ exeName = "DocProp.exe"; - Console::WriteLine( "Enter the source language for DocumentProperties class (cs, vb, etc):" ); - String^ inputLang = Console::ReadLine(); - Console::WriteLine(); - if ( CodeDomProvider::IsDefinedLanguage( inputLang ) ) - { - provider = CodeDomProvider::CreateProvider( inputLang ); - } - - if ( provider == nullptr ) - { - Console::WriteLine( "There is no CodeDomProvider for the input language." ); - } - else - { - CodeCompileUnit^ docPropertyUnit = DocumentPropertyGraphBase(); - DocumentPropertyGraphExpand( &docPropertyUnit ); - String^ sourceFile = GenerateCode( provider, docPropertyUnit ); - if ( !String::IsNullOrEmpty( sourceFile ) ) - { - Console::WriteLine( "Document property class code generated." ); - if ( CompileCode( provider, sourceFile, exeName ) ) - { - Console::WriteLine( "Starting DocProp executable." ); - Process::Start( exeName ); - } - } - else - { - Console::WriteLine( "Could not generate source file." ); - Console::WriteLine( "Target language code generator might not support partial type declarations." ); - } - } -} - diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp deleted file mode 100644 index 1cc24bf7789..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSampleBatch -{ - public ref class Class1 - { - public: - Class1(){} - - static CodeCompileUnit^ CreateCompileUnit() - { - CodeCompileUnit^ cu = gcnew CodeCompileUnit; - - // - // Creates a code expression for a CodeExpressionStatement to contain. - array^ temp = {gcnew CodePrimitiveExpression( "Example string" )}; - CodeExpression^ invokeExpression = gcnew CodeMethodInvokeExpression( - gcnew CodeTypeReferenceExpression( "Console" ),"Write",temp ); - - // Creates a statement using a code expression. - CodeExpressionStatement^ expressionStatement; - expressionStatement = gcnew CodeExpressionStatement( invokeExpression ); - - // A C++ code generator produces the following source code for the preceeding example code: - - // Console::Write( "Example string" ); - // - - // - // Creates a CodeLinePragma that references line 100 of the file "example.cs". - CodeLinePragma^ pragma = gcnew CodeLinePragma( "example.cs",100 ); - // - - // - // Creates a CodeSnippetExpression that represents a literal string that - // can be used as an expression in a CodeDOM graph. - CodeSnippetExpression^ literalExpression = - gcnew CodeSnippetExpression( "Literal expression" ); - // - - // - // Creates a statement using a literal string. - CodeSnippetStatement^ literalStatement = - gcnew CodeSnippetStatement( "Console.Write(\"Test literal statement output\")" ); - // - - // - // Creates a type member using a literal string. - CodeSnippetTypeMember^ literalMember = - gcnew CodeSnippetTypeMember( "public static void TestMethod() {}" ); - // - return cu; - } - - static CodeCompileUnit^ CreateSnippetCompileUnit() - { - // - // Creates a compile unit using a literal sring; - String^ literalCode; - literalCode = "using System; namespace TestLiteralCode " + - "{ public class TestClass { public TestClass() {} } }"; - CodeSnippetCompileUnit^ csu = gcnew CodeSnippetCompileUnit( literalCode ); - // - return csu; - } - - // CodeNamespaceImportCollection - void CodeNamespaceImportCollectionExample() - { - // - // - // Creates an empty CodeNamespaceImportCollection. - CodeNamespaceImportCollection^ collection = - gcnew CodeNamespaceImportCollection; - // - - // - // Adds a CodeNamespaceImport to the collection. - collection->Add( gcnew CodeNamespaceImport( "System" ) ); - // - - // - // Adds an array of CodeNamespaceImport objects to the collection. - array^ Imports = { - gcnew CodeNamespaceImport( "System" ), - gcnew CodeNamespaceImport( "System.Drawing" )}; - collection->AddRange( Imports ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp deleted file mode 100644 index 6d0058c9957..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp +++ /dev/null @@ -1,327 +0,0 @@ - - -// System.CodeDom.Compiler.CompilerInfo -// -// Requires .NET Framework version 2.0 or higher. -// -// The following example displays compiler configuration settings. -// Command-line arguments are used to specify a compiler language, -// file extension, or provider type. For the given input, the -// example determines the corresponding code compiler settings. -// -// -// Command-line argument examples: -// -// - Displays Visual Basic, C#, and JScript compiler settings. -// Language CSharp -// - Displays the compiler settings for C#. -// All -// - Displays settings for all configured compilers. -// Config Pascal -// - Displays settings for configured Pascal language provider, -// if one exists. -// Extension .vb -// - Displays settings for the compiler associated with the .vb -// file extension. -#using -#using - -using namespace System; -using namespace System::Globalization; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace Microsoft::CSharp; -using namespace Microsoft::VisualBasic; -using namespace System::Configuration; -using namespace System::Security::Permissions; - -namespace CodeDomCompilerInfoSample -{ - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - public ref class CompilerInfoSample - { - public: - static void Main( array^args ) - { - String^ queryCommand = ""; - String^ queryArg = ""; - int iNumArguments = args->Length; - - // Get input command-line arguments. - if ( iNumArguments > 0 ) - { - queryCommand = args[ 0 ]->ToUpper( CultureInfo::InvariantCulture ); - if ( iNumArguments > 1 ) - queryArg = args[ 1 ]; - } - - // Determine which method to call. - Console::WriteLine(); - if ( queryCommand->Equals( "LANGUAGE" ) ) - DisplayCompilerInfoForLanguage( queryArg ); // Display compiler information for input language. - else if ( queryCommand->Equals( "EXTENSION" ) ) - DisplayCompilerInfoUsingExtension( queryArg ); // Display compiler information for input file extension. - else if ( queryCommand->Equals( "CONFIG" ) ) - DisplayCompilerInfoForConfigLanguage( queryArg ); // Display settings for the configured language provider. - else if ( queryCommand->Equals( "ALL" ) ) - DisplayAllCompilerInfo(); // Display compiler information for all configured language providers. - else - { - // There was no command-line argument, or the - // command-line argument was not recognized. - // Display the C#, Visual Basic and JScript - // compiler information. - DisplayCSharpCompilerInfo(); - DisplayVBCompilerInfo(); - DisplayJScriptCompilerInfo(); - } - } - - - private: - static void DisplayCSharpCompilerInfo() - { - // - // Get the provider for Microsoft.CSharp -// CodeDomProvider^ provider = CodeDomProvider.CreateProvider("CSharp"); - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - if ( provider ) - { - // Display the C# language provider information. - Console::WriteLine( "CSharp provider is {0}", provider->ToString() ); - Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() ); - Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); - } - - // - Console::WriteLine(); - } - - static void DisplayVBCompilerInfo() - { - // - // Get the provider for Microsoft.VisualBasic -// CodeDomProvider^ provider = CodeDomProvider.CreateProvider("VisualBasic"); - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("VisualBasic"); - if ( provider ) // Display the Visual Basic language provider information. - { - Console::WriteLine( "Visual Basic provider is {0}", provider->ToString() ); - Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() ); - Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); - } - - // - Console::WriteLine(); - } - - static void DisplayJScriptCompilerInfo() - { - // - // Get the provider for JScript. - CodeDomProvider^ provider; - try - { -// provider = CodeDomProvider.CreateProvider("JScript"); - provider = CodeDomProvider::CreateProvider("JScript"); - if ( provider ) - { - // Display the JScript language provider information. - Console::WriteLine( "JScript language provider is {0}", provider->ToString() ); - Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() ); - Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); - Console::WriteLine(); - } - } - catch ( ConfigurationException^ e ) - { - // The JScript language provider was not found. - Console::WriteLine( "There is no configured JScript language provider." ); - } - - // - } - - static void DisplayCompilerInfoUsingExtension( String^ fileExtension ) - { - // - if ( !fileExtension->StartsWith( "." ) ) - fileExtension = String::Concat( ".", fileExtension ); - - // Get the language associated with the file extension. - CodeDomProvider^ provider = nullptr; - if ( CodeDomProvider::IsDefinedExtension( fileExtension ) ) - { - String^ language = CodeDomProvider::GetLanguageFromExtension( fileExtension ); - if ( language ) - Console::WriteLine( "The language \"{0}\" is associated with file extension \"{1}\"\n", - language, fileExtension ); - - // Check for a corresponding language provider. - if ( language && CodeDomProvider::IsDefinedLanguage( language ) ) - { - provider = CodeDomProvider::CreateProvider( language ); - if ( provider ) - { - // Display information about this language provider. - Console::WriteLine( "Language provider: {0}\n", provider->ToString() ); - - // Get the compiler settings for this language. - CompilerInfo^ langCompilerInfo = CodeDomProvider::GetCompilerInfo( language ); - if ( langCompilerInfo ) - { - CompilerParameters^ langCompilerConfig = langCompilerInfo->CreateDefaultCompilerParameters(); - if ( langCompilerConfig ) - { - Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); - Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); - } - } - } - } - } - - if ( provider == nullptr ) // Tell the user that the language provider was not found. - Console::WriteLine( "There is no language provider associated with input file extension \"{0}\".", fileExtension ); - - // - } - - static void DisplayCompilerInfoForLanguage( String^ language ) - { - // - CodeDomProvider^ provider = nullptr; - - // Check for a provider corresponding to the input language. - if ( CodeDomProvider::IsDefinedLanguage( language ) ) - { - provider = CodeDomProvider::CreateProvider( language ); - if ( provider ) - { - // Display information about this language provider. - Console::WriteLine( "Language provider: {0}", provider->ToString() ); - Console::WriteLine(); - Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); - Console::WriteLine(); - - // Get the compiler settings for this language. - CompilerInfo^ langCompilerInfo = CodeDomProvider::GetCompilerInfo( language ); - if ( langCompilerInfo ) - { - CompilerParameters^ langCompilerConfig = langCompilerInfo->CreateDefaultCompilerParameters(); - if ( langCompilerConfig ) - { - Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); - Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); - } - } - } - } - - if ( provider == nullptr ) // Tell the user that the language provider was not found. - Console::WriteLine( "There is no provider configured for input language \"{0}\".", language ); - - // - } - - static void DisplayCompilerInfoForConfigLanguage( String^ configLanguage ) - { - // - CodeDomProvider^ provider = nullptr; - CompilerInfo^ info = CodeDomProvider::GetCompilerInfo( configLanguage ); - - // Check whether there is a provider configured for this language. - if ( info->IsCodeDomProviderTypeValid ) - { - // Get a provider instance using the configured type information. - provider = dynamic_cast(Activator::CreateInstance( info->CodeDomProviderType )); - if ( provider ) - { - // Display information about this language provider. - Console::WriteLine( "Language provider: {0}", provider->ToString() ); - Console::WriteLine(); - Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); - Console::WriteLine(); - - // Get the compiler settings for this language. - CompilerParameters^ langCompilerConfig = info->CreateDefaultCompilerParameters(); - if ( langCompilerConfig ) - { - Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); - Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); - } - } - } - - if ( provider == nullptr ) // Tell the user that the language provider was not found. - Console::WriteLine( "There is no provider configured for input language \"{0}\".", configLanguage ); - - // - } - - static void DisplayAllCompilerInfo() - { - // - array^allCompilerInfo = CodeDomProvider::GetAllCompilerInfo(); - for ( int i = 0; i < allCompilerInfo->Length; i++ ) - { - String^ defaultLanguage; - String^ defaultExtension; - CompilerInfo^ info = allCompilerInfo[ i ]; - CodeDomProvider^ provider = nullptr; - if ( info ) - provider = info->CreateProvider(); - - if ( provider ) - { - // Display information about this configured provider. - Console::WriteLine( "Language provider: {0}", provider->ToString() ); - Console::WriteLine(); - Console::WriteLine( " Supported file extension(s):" ); - array^extensions = info->GetExtensions(); - for ( int i = 0; i < extensions->Length; i++ ) - Console::WriteLine( " {0}", extensions[ i ] ); - - defaultExtension = provider->FileExtension; - if ( !defaultExtension->StartsWith( "." ) ) - defaultExtension = String::Concat( ".", defaultExtension ); - - Console::WriteLine( " Default file extension: {0}\n", defaultExtension ); - Console::WriteLine( " Supported language(s):" ); - array^languages = info->GetLanguages(); - for ( int i = 0; i < languages->Length; i++ ) - Console::WriteLine( " {0}", languages[ i ] ); - - defaultLanguage = CodeDomProvider::GetLanguageFromExtension( defaultExtension ); - Console::WriteLine( " Default language: {0}", defaultLanguage ); - Console::WriteLine(); - - // Get the compiler settings for this provider. - CompilerParameters^ langCompilerConfig = info->CreateDefaultCompilerParameters(); - if ( langCompilerConfig ) - { - Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); - Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); - } - } - - } - // - } - - }; - -} - - -// The main entry point for the application. - -[STAThread] -int main( int argc, char *argv[] ) -{ - CodeDomCompilerInfoSample::CompilerInfoSample::Main( Environment::GetCommandLineArgs() ); - Console::WriteLine("\n\nPress ENTER to return"); - Console::ReadLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp deleted file mode 100644 index 98d30708b47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeEntryPointMethodExample - { - public: - - // - // Builds a Hello World Program Graph using System.CodeDom objects - static CodeCompileUnit^ BuildHelloWorldGraph() - { - - // Create a new CodeCompileUnit to contain the program graph - CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit; - - // Declare a new namespace object and name it - CodeNamespace^ Samples = gcnew CodeNamespace( "Samples" ); - - // Add the namespace object to the compile unit - CompileUnit->Namespaces->Add( Samples ); - - // Add a new namespace import for the System namespace - Samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); - - // Declare a new type object and name it - CodeTypeDeclaration^ Class1 = gcnew CodeTypeDeclaration( "Class1" ); - - // Add the new type to the namespace object's type collection - Samples->Types->Add( Class1 ); - - // Declare a new code entry point method - CodeEntryPointMethod^ Start = gcnew CodeEntryPointMethod; - - // Create a new method invoke expression - array^temp = {gcnew CodePrimitiveExpression( "Hello World!" )}; - CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp ); - - // Add the new method code statement - Start->Statements->Add( gcnew CodeExpressionStatement( cs1 ) ); - - // Add the code entry point method to the type's members collection - Class1->Members->Add( Start ); - return CompileUnit; - - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp deleted file mode 100644 index 8a1f531f50a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeExpressionCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeExpressionCollection - void CodeExpressionCollectionExample() - { - // - // - // Creates an empty CodeExpressionCollection. - CodeExpressionCollection^ collection = gcnew CodeExpressionCollection; - // - - // - // Adds a CodeExpression to the collection. - collection->Add( gcnew CodePrimitiveExpression( true ) ); - // - - // - // Adds an array of CodeExpression objects to the collection. - array^expressions = {gcnew CodePrimitiveExpression( true ),gcnew CodePrimitiveExpression( true )}; - collection->AddRange( expressions ); - - // Adds a collection of CodeExpression objects to the collection. - CodeExpressionCollection^ expressionsCollection = gcnew CodeExpressionCollection; - expressionsCollection->Add( gcnew CodePrimitiveExpression( true ) ); - expressionsCollection->Add( gcnew CodePrimitiveExpression( true ) ); - collection->AddRange( expressionsCollection ); - // - - // - // Tests for the presence of a CodeExpression in the - // collection, and retrieves its index if it is found. - CodeExpression^ testComment = gcnew CodePrimitiveExpression( true ); - int itemIndex = -1; - if ( collection->Contains( testComment ) ) - itemIndex = collection->IndexOf( testComment ); - // - - // - // Copies the contents of the collection beginning at index 0 to the specified CodeExpression array. - // 'expressions' is a CodeExpression array. - collection->CopyTo( expressions, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeExpression at index 0 of the collection. - collection->Insert( 0, gcnew CodePrimitiveExpression( true ) ); - // - - // - // Removes the specified CodeExpression from the collection. - CodeExpression^ expression = gcnew CodePrimitiveExpression( true ); - collection->Remove( expression ); - // - - // - // Removes the CodeExpression at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp deleted file mode 100644 index be4a228d29c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -[STAThread] -int main() -{ - // - // Creates a new CodeGeneratorOptions. - CodeGeneratorOptions^ genOptions = gcnew CodeGeneratorOptions; - - // Sets a value indicating that the code generator should insert blank lines between type members. - genOptions->BlankLinesBetweenMembers = true; - - // Sets the style of bracing format to use: either S"Block" to start a - // bracing block on the same line as the declaration of its container, or - // S"C" to start the bracing for the block on the following line. - genOptions->BracingStyle = "C"; - - // Sets a value indicating that the code generator should not append an else, - // catch or finally block, including brackets, at the closing line of a preceeding if or try block. - genOptions->ElseOnClosing = false; - - // Sets the String* to indent each line with. - genOptions->IndentString = " "; - - // Uses the CodeGeneratorOptions indexer property to set an - // example Object* to the type's String*-keyed ListDictionary. - // Custom ICodeGenerator* implementations can use objects - // in this dictionary to customize process behavior. - genOptions[ "CustomGeneratorOptionStringExampleID" ] = "BuildFlags: /A /B /C /D /E"; - // - - Console::WriteLine( genOptions ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp deleted file mode 100644 index cab34001736..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeGotoStatementExample - { - public: - CodeGotoStatementExample() - { - - // - // Declares a type to contain the example code. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); - - // Declares an entry point method. - CodeEntryPointMethod^ entry1 = gcnew CodeEntryPointMethod; - type1->Members->Add( entry1 ); - - // Adds a goto statement to continue program flow at the "JumpToLabel" label. - CodeGotoStatement^ goto1 = gcnew CodeGotoStatement( "JumpToLabel" ); - entry1->Statements->Add( goto1 ); - - // Invokes Console.WriteLine to print "Test Output", which is skipped by the goto statement. - array^temp = {gcnew CodePrimitiveExpression( "Test Output." )}; - CodeMethodInvokeExpression^ method1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp ); - entry1->Statements->Add( method1 ); - - // Declares a label named "JumpToLabel" associated with a method to output a test string using Console.WriteLine. - array^temp2 = {gcnew CodePrimitiveExpression( "Output from labeled statement." )}; - CodeMethodInvokeExpression^ method2 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp2 ); - CodeLabeledStatement^ label1 = gcnew CodeLabeledStatement( "JumpToLabel",gcnew CodeExpressionStatement( method2 ) ); - entry1->Statements->Add( label1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class Type1 - // { - // - // public static void Main() - // { - // goto JumpToLabel; - // System.Console.WriteLine("Test Output"); - // JumpToLabel: - // System.Console.WriteLine("Output from labeled statement."); - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp deleted file mode 100644 index c3a1463a6e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeIterationStatementExample - { - public: - CodeIterationStatementExample() - { - // - // Declares and initializes an integer variable named testInt. - CodeVariableDeclarationStatement^ testInt = gcnew CodeVariableDeclarationStatement( int::typeid,"testInt",gcnew CodePrimitiveExpression( (int^)0 ) ); - array^writelineparams = {gcnew CodeMethodInvokeExpression( gcnew CodeVariableReferenceExpression( "testInt" ),"ToString",nullptr )}; - array^codestatements = {gcnew CodeExpressionStatement( gcnew CodeMethodInvokeExpression( gcnew CodeMethodReferenceExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine" ),writelineparams ) )}; - - // Creates a for loop that sets testInt to 0 and continues incrementing testInt by 1 each loop until testInt is not less than 10. - - // Each loop iteration the value of the integer is output using the Console.WriteLine method. - CodeIterationStatement^ forLoop = gcnew CodeIterationStatement( gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "testInt" ),gcnew CodePrimitiveExpression( 1 ) ),gcnew CodeBinaryOperatorExpression( gcnew CodeVariableReferenceExpression( "testInt" ),CodeBinaryOperatorType::LessThan,gcnew CodePrimitiveExpression( 10 ) ),gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "testInt" ),gcnew CodeBinaryOperatorExpression( gcnew CodeVariableReferenceExpression( "testInt" ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 1 ) ) ),codestatements ); - - // A C# code generator produces the following source code for the preceeding example code: - // int testInt = 0; - // for (testInt = 1; (testInt < 10); testInt = (testInt + 1)) { - // Console.WriteLine(testInt.ToString()); - // - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp deleted file mode 100644 index 26b6cf744fb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeMemberEventExample - { - public: - CodeMemberEventExample() - { - - // - // Declares a type to contain an event and constructor method. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "EventTest" ); - - // - // Declares an event that accepts a delegate type of System.EventHandler. - CodeMemberEvent^ event1 = gcnew CodeMemberEvent; - - // Sets a name for the event. - event1->Name = "TestEvent"; - - // Sets the type of event. - event1->Type = gcnew CodeTypeReference( "System.EventHandler" ); - - // A C# code generator produces the following source code for the preceeding example code: - // private event System.EventHandler TestEvent; - // - // Adds the event to the type members collection. - type1->Members->Add( event1 ); - - // Declares an empty type constructor. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class EventTest - // { - // - // public EventTest() - // { - // } - // - // private event System.EventHandler TestEvent; - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp deleted file mode 100644 index a6523e8e7f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeMemberFieldExample - { - public: - CodeMemberFieldExample() - { - - // - // Declares a type to contain a field and a constructor method. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "FieldTest" ); - - // Declares a field of type String named testStringField. - CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","TestStringField" ); - type1->Members->Add( field1 ); - - // Declares an empty type constructor. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class FieldTest - // { - // private string testStringField; - // - // public FieldTest() - // { - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp deleted file mode 100644 index 85f2cca6311..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeMemberField_PublicConst_Example -{ - public ref class Class1 - { - private: - static CodeCompileUnit^ GetCompileUnit() - { - CodeCompileUnit^ cu = gcnew CodeCompileUnit; - CodeNamespace^ nsp = gcnew CodeNamespace( "TestNamespace" ); - cu->Namespaces->Add( nsp ); - CodeTypeDeclaration^ testType = gcnew CodeTypeDeclaration( "testType" ); - nsp->Types->Add( testType ); - - // - // This example demonstrates declaring a public constant type member field. - - // When declaring a public constant type member field, you must set a particular - // access and scope mask to the member attributes of the field in order for the - // code generator to properly generate the field as a constant field. - - // Declares an integer field using a CodeMemberField - CodeMemberField^ constPublicField = gcnew CodeMemberField( int::typeid,"testConstPublicField" ); - - // Resets the access and scope mask bit flags of the member attributes of the field - // before setting the member attributes of the field to public and constant. - constPublicField->Attributes = (MemberAttributes)((constPublicField->Attributes & ~MemberAttributes::AccessMask & ~MemberAttributes::ScopeMask) | MemberAttributes::Public | MemberAttributes::Const); - // - - testType->Members->Add( constPublicField ); - return cu; - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp deleted file mode 100644 index 8175a5921e6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeMemberMethodExample - { - public: - CodeMemberMethodExample() - { - - // - // Defines a method that returns a string passed to it. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "ReturnString"; - method1->ReturnType = gcnew CodeTypeReference( "System.String" ); - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","text" ) ); - method1->Statements->Add( gcnew CodeMethodReturnStatement( gcnew CodeArgumentReferenceExpression( "text" ) ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // private string ReturnString(string text) - // { - // return text; - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp deleted file mode 100644 index 7e2bc0cca2b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeMemberPropertyExample - { - public: - CodeMemberPropertyExample() - { - - // - // Declares a type to contain a field and a constructor method. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "PropertyTest" ); - - // Declares a field of type String named testStringField. - CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","testStringField" ); - type1->Members->Add( field1 ); - - // Declares a property of type String named StringProperty. - CodeMemberProperty^ property1 = gcnew CodeMemberProperty; - property1->Name = "StringProperty"; - property1->Type = gcnew CodeTypeReference( "System.String" ); - property1->Attributes = MemberAttributes::Public; - property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ) ) ); - property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ),gcnew CodePropertySetValueReferenceExpression ) ); - type1->Members->Add( property1 ); - - // Declares an empty type constructor. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class PropertyTest - // { - // - // private string testStringField; - // - // public PropertyTest() - // { - // } - // - // public virtual string StringProperty - // { - // get - // { - // return this.testStringField; - // } - // set - // { - // this.testStringField = value; - // } - // } - // } - // - } - - void SpecificExample() - { - - // - // Declares a property of type String named StringProperty. - CodeMemberProperty^ property1 = gcnew CodeMemberProperty; - property1->Name = "StringProperty"; - property1->Type = gcnew CodeTypeReference( "System.String" ); - property1->Attributes = MemberAttributes::Public; - property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ) ) ); - property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ),gcnew CodePropertySetValueReferenceExpression ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // public virtual string StringProperty - // { - // get - // { - // return this.testStringField; - // } - // set - // { - // this.testStringField = value; - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp deleted file mode 100644 index e6f645922d9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeMethodInvokeExpressionExample - { - public: - CodeMethodInvokeExpressionExample() - { - - // - array^temp0 = {gcnew CodePrimitiveExpression( true )}; - - // parameters array contains the parameters for the method. - CodeMethodInvokeExpression^ methodInvoke = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"Dispose",temp0 ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.Dispose(true); - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp deleted file mode 100644 index 5bb3d9a74c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -public ref class CodeMethodReferenceExample -{ -public: - CodeMethodReferenceExample() - { - - // - // Declares a type to contain the example code. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); - - // Declares a method. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "TestMethod"; - type1->Members->Add( method1 ); - - // Declares a type constructor that calls a method. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // Invokes the TestMethod method of the current type object. - CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" ); - array^temp0; - CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp0 ); - constructor1->Statements->Add( invoke1 ); - - // - } - - void InvokeExample() - { - - // - // Invokes the TestMethod method of the current type object. - CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" ); - array^temp1; - CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestMethod(); - // - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp deleted file mode 100644 index 038d748adc7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp +++ /dev/null @@ -1,66 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -public ref class CodeMultiExample -{ -public: - CodeMultiExample(){} - - void CodeEventReferenceExample() - { - - // - // Represents a reference to an event. - CodeEventReferenceExpression^ eventRef1 = gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestEvent - // - } - - void CodeIndexerExample() - { - - // - array^temp1 = {gcnew CodePrimitiveExpression( 1 )}; - System::CodeDom::CodeIndexerExpression^ indexerExpression = gcnew CodeIndexerExpression( gcnew CodeThisReferenceExpression,temp1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // this[1]; - // - } - - void CodeDirectionExample() - { - - // - // Declares a parameter passed by reference using a CodeDirectionExpression. - array^param1 = {gcnew CodeDirectionExpression( FieldDirection::Ref,gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestParameter" ) )}; - - // Invokes a method on this named TestMethod using the direction expression as a parameter. - CodeMethodInvokeExpression^ methodInvoke1 = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"TestMethod",param1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestMethod(ref TestParameter); - // - } - - void CreateExpressionExample() - { - - // - array^temp0 = gcnew array(0); - CodeObjectCreateExpression^ objectCreate1 = gcnew CodeObjectCreateExpression( "System.DateTime",temp0 ); - - // A C# code generator produces the following source code for the preceeding example code: - // new System.DateTime(); - // - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp deleted file mode 100644 index 1fa3cdbea7d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeNamespaceCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeNamespaceCollection - void CodeNamespaceCollectionExample() - { - // - // - // Creates an empty CodeNamespaceCollection. - CodeNamespaceCollection^ collection = gcnew CodeNamespaceCollection; - // - - // - // Adds a CodeNamespace to the collection. - collection->Add( gcnew CodeNamespace( "TestNamespace" ) ); - // - - // - // Adds an array of CodeNamespace objects to the collection. - array^namespaces = {gcnew CodeNamespace( "TestNamespace1" ),gcnew CodeNamespace( "TestNamespace2" )}; - collection->AddRange( namespaces ); - - // Adds a collection of CodeNamespace objects to the collection. - CodeNamespaceCollection^ namespacesCollection = gcnew CodeNamespaceCollection; - namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace1" ) ); - namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace2" ) ); - collection->AddRange( namespacesCollection ); - // - - // - // Tests for the presence of a CodeNamespace in the collection, - // and retrieves its index if it is found. - CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" ); - int itemIndex = -1; - if ( collection->Contains( testNamespace ) ) - itemIndex = collection->IndexOf( testNamespace ); - // - - // - // Copies the contents of the collection beginning at index 0, - // to the specified CodeNamespace array. - // 'namespaces' is a CodeNamespace array. - collection->CopyTo( namespaces, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeNamespace at index 0 of the collection. - collection->Insert( 0, gcnew CodeNamespace( "TestNamespace" ) ); - // - - // - // Removes the specified CodeNamespace from the collection. - CodeNamespace^ namespace_ = gcnew CodeNamespace( "TestNamespace" ); - collection->Remove( namespace_ ); - // - - // - // Removes the CodeNamespace at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp deleted file mode 100644 index e2d0cf27fab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeMemberEventExample - { - public: - CodeMemberEventExample() - { - - // - CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; - CodeNamespace^ namespace1 = gcnew CodeNamespace( "TestNamespace" ); - compileUnit->Namespaces->Add( namespace1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // namespace TestNamespace { - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp deleted file mode 100644 index ac420b30839..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeNamespaceImportExample - { - public: - CodeNamespaceImportExample() - { - - // - // Declares a compile unit to contain a namespace. - CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; - - // Declares a namespace named TestNamespace. - CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" ); - - // Adds the namespace to the namespace collection of the compile unit. - compileUnit->Namespaces->Add( testNamespace ); - - // Declares a namespace import of the System namespace. - CodeNamespaceImport^ import1 = gcnew CodeNamespaceImport( "System" ); - - // Adds the namespace import to the namespace imports collection of the namespace. - testNamespace->Imports->Add( import1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // namespace TestNamespace { - // using System; - // - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp deleted file mode 100644 index 8e07b2222f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeParameterDeclarationExample - { - public: - CodeParameterDeclarationExample() - { - - // - // Declares a new type to contain the example methods. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // - // Declares a method. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "TestMethod"; - - // Declares a string parameter passed by reference. - CodeParameterDeclarationExpression^ param1 = gcnew CodeParameterDeclarationExpression( "System.String","stringParam" ); - param1->Direction = FieldDirection::Ref; - method1->Parameters->Add( param1 ); - - // Declares a Int32 parameter passed by incoming field. - CodeParameterDeclarationExpression^ param2 = gcnew CodeParameterDeclarationExpression( "System.Int32","intParam" ); - param2->Direction = FieldDirection::Out; - method1->Parameters->Add( param2 ); - - // A C# code generator produces the following source code for the preceeding example code: - // private void TestMethod(ref string stringParam, out int intParam) { - // } - // - type1->Members->Add( method1 ); - - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp deleted file mode 100644 index 3b66a3fe5b6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeParameterDeclarationExpressionCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeParameterDeclarationExpressionCollection - void CodeParameterDeclarationExpressionCollectionExample() - { - // - // - // Creates an empty CodeParameterDeclarationExpressionCollection. - CodeParameterDeclarationExpressionCollection^ collection = gcnew CodeParameterDeclarationExpressionCollection; - // - - // - // Adds a CodeParameterDeclarationExpression to the collection. - collection->Add( gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) ); - // - - // - // Adds an array of CodeParameterDeclarationExpression objects - // to the collection. - array^parameters = {gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ),gcnew CodeParameterDeclarationExpression( bool::typeid,"testBoolArgument" )}; - collection->AddRange( parameters ); - - // Adds a collection of CodeParameterDeclarationExpression objects - // to the collection. - CodeParameterDeclarationExpressionCollection^ parametersCollection = gcnew CodeParameterDeclarationExpressionCollection; - parametersCollection->Add( gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) ); - parametersCollection->Add( gcnew CodeParameterDeclarationExpression( bool::typeid,"testBoolArgument" ) ); - collection->AddRange( parametersCollection ); - // - - // - // Tests for the presence of a CodeParameterDeclarationExpression - // in the collection, and retrieves its index if it is found. - CodeParameterDeclarationExpression^ testParameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ); - int itemIndex = -1; - if ( collection->Contains( testParameter ) ) - itemIndex = collection->IndexOf( testParameter ); - // - - // - // Copies the contents of the collection beginning at index 0 to the specified CodeParameterDeclarationExpression array. - // 'parameters' is a CodeParameterDeclarationExpression array. - collection->CopyTo( parameters, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeParameterDeclarationExpression at index 0 - // of the collection. - collection->Insert( 0, gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) ); - // - - // - // Removes the specified CodeParameterDeclarationExpression - // from the collection. - CodeParameterDeclarationExpression^ parameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ); - collection->Remove( parameter ); - // - - // - // Removes the CodeParameterDeclarationExpression at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp deleted file mode 100644 index 9056a9d5683..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodePrimitiveExpressionExample - { - public: - CodePrimitiveExpressionExample() - { - - // - // Represents a string. - CodePrimitiveExpression^ stringPrimitive = gcnew CodePrimitiveExpression( "Test String" ); - - // Represents an integer. - CodePrimitiveExpression^ intPrimitive = gcnew CodePrimitiveExpression( 10 ); - - // Represents a floating point number. - CodePrimitiveExpression^ floatPrimitive = gcnew CodePrimitiveExpression( 1.03189 ); - - // Represents a null value expression. - CodePrimitiveExpression^ nullPrimitive = gcnew CodePrimitiveExpression( 0 ); - - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp deleted file mode 100644 index 6a937caac58..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodePropertySetValueExample - { - public: - CodePropertySetValueExample() - { - - // - // Declares a type. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); - - // Declares a constructor. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // Declares an integer field. - CodeMemberField^ field1 = gcnew CodeMemberField( "System.Int32","integerField" ); - type1->Members->Add( field1 ); - - // Declares a property. - CodeMemberProperty^ property1 = gcnew CodeMemberProperty; - - // Declares a property get statement to return the value of the integer field. - property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ) ) ); - - // Declares a property set statement to set the value to the integer field. - // The CodePropertySetValueReferenceExpression represents the value argument passed to the property set statement. - property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ),gcnew CodePropertySetValueReferenceExpression ) ); - type1->Members->Add( property1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class Type1 - // { - // - // private int integerField; - // - // public Type1() - // { - // } - // - // private int integerProperty - // { - // get - // { - // return this.integerField; - // } - // set - // { - // this.integerField = value; - // } - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp deleted file mode 100644 index b6dcd099dd2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeReferenceExample - { - public: - CodeReferenceExample(){} - - void CodeFieldReferenceExample() - { - - // - CodeFieldReferenceExpression^ fieldRef1 = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestField - // - } - - void CodePropertyReferenceExample() - { - - // - CodePropertyReferenceExpression^ propertyRef1 = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"TestProperty" ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestProperty - // - } - - void CodeVariableReferenceExample() - { - - // - CodeVariableReferenceExpression^ variableRef1 = gcnew CodeVariableReferenceExpression( "TestVariable" ); - - // A C# code generator produces the following source code for the preceeding example code: - // TestVariable - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp deleted file mode 100644 index 4f5f9c70446..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeRemoveEventExample - { - public: - CodeRemoveEventExample() - { - - // - // Creates a delegate of type System.EventHandler pointing to a method named OnMouseEnter. - CodeDelegateCreateExpression^ mouseEnterDelegate = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"OnMouseEnter" ); - - // Creates a remove event statement that removes the delegate from the TestEvent event. - CodeRemoveEventStatement^ removeEvent1 = gcnew CodeRemoveEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",mouseEnterDelegate ); - - // A C# code generator produces the following source code for the preceeding example code: - // this.TestEvent -= new System.EventHandler(this.OnMouseEnter); - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp deleted file mode 100644 index 03265e75e7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeStatementCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeStatementCollection - void CodeStatementCollectionExample() - { - - // - // - // Creates an empty CodeStatementCollection. - CodeStatementCollection^ collection = gcnew CodeStatementCollection; - // - - // - // Adds a CodeStatement to the collection. - collection->Add( gcnew CodeCommentStatement( "Test comment statement" ) ); - // - - // - // Adds an array of CodeStatement objects to the collection. - array^statements = {gcnew CodeCommentStatement( "Test comment statement" ),gcnew CodeCommentStatement( "Test comment statement" )}; - collection->AddRange( statements ); - - // Adds a collection of CodeStatement objects to the collection. - CodeStatement^ testStatement = gcnew CodeCommentStatement( "Test comment statement" ); - CodeStatementCollection^ statementsCollection = gcnew CodeStatementCollection; - statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) ); - statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) ); - statementsCollection->Add( testStatement ); - collection->AddRange( statementsCollection ); - // - - // - // Tests for the presence of a CodeStatement in the - // collection, and retrieves its index if it is found. - int itemIndex = -1; - if ( collection->Contains( testStatement ) ) - itemIndex = collection->IndexOf( testStatement ); - // - - // - // Copies the contents of the collection beginning at index 0 to the specified CodeStatement array. - // 'statements' is a CodeStatement array. - collection->CopyTo( statements, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeStatement at index 0 of the collection. - collection->Insert( 0, gcnew CodeCommentStatement( "Test comment statement" ) ); - // - - // - // Removes the specified CodeStatement from the collection. - collection->Remove( testStatement ); - // - - // - // Removes the CodeStatement at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp deleted file mode 100644 index 54009857661..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -public ref class CodeThrowExceptionStatementExample -{ -public: - CodeThrowExceptionStatementExample() - { - // - // This CodeThrowExceptionStatement throws a new System.Exception. - array^temp0; - CodeThrowExceptionStatement^ throwException = gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( gcnew CodeTypeReference( System::Exception::typeid ),temp0 ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // throw new System.Exception(); - // - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp deleted file mode 100644 index cb97225e885..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp +++ /dev/null @@ -1,81 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -public ref class CodeTryCatchFinallyExample -{ -public: - CodeTryCatchFinallyExample() - { - - // - // Declares a type to contain a try...catch block. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "TryCatchTest" ); - - // Defines a method that throws an exception of type System.ApplicationException. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "ThrowApplicationException"; - array^temp = {gcnew CodePrimitiveExpression( "Test Application Exception" )}; - method1->Statements->Add( gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( "System.ApplicationException",temp ) ) ); - type1->Members->Add( method1 ); - - // Defines a constructor that calls the ThrowApplicationException method from a try block. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - type1->Members->Add( constructor1 ); - - // Defines a try statement that calls the ThrowApplicationException method. - CodeTryCatchFinallyStatement^ try1 = gcnew CodeTryCatchFinallyStatement; - try1->TryStatements->Add( gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"ThrowApplicationException", nullptr ) ); - constructor1->Statements->Add( try1 ); - - // Defines a catch clause for exceptions of type ApplicationException. - CodeCatchClause^ catch1 = gcnew CodeCatchClause( "ex",gcnew CodeTypeReference( "System.ApplicationException" ) ); - catch1->Statements->Add( gcnew CodeCommentStatement( "Handle any System.ApplicationException here." ) ); - try1->CatchClauses->Add( catch1 ); - - // Defines a catch clause for any remaining unhandled exception types. - CodeCatchClause^ catch2 = gcnew CodeCatchClause( "ex" ); - catch2->Statements->Add( gcnew CodeCommentStatement( "Handle any other exception type here." ) ); - try1->CatchClauses->Add( catch2 ); - - // Defines a finally block by adding to the FinallyStatements collection. - try1->FinallyStatements->Add( gcnew CodeCommentStatement( "Handle any finally block statements." ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class TryCatchTest - // { - // - // public TryCatchTest() - // { - // try - // { - // this.ThrowApplicationException(); - // } - // catch (System.ApplicationException ex) - // { - // // Handle any System.ApplicationException here. - // } - // catch (System.Exception ex) - // { - // // Handle any other exception type here. - // } - // finally { - // // Handle any finally block statements. - // } - // } - // - // private void ThrowApplicationException() - // { - // throw new System.ApplicationException("Test Application Exception"); - // } - // } - // - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp deleted file mode 100644 index aefa0b83158..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeTypeConstructorExample - { - public: - CodeTypeConstructorExample() - { - - // - // Declares a new type for a static constructor. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); - - // Declares a static constructor. - CodeTypeConstructor^ constructor2 = gcnew CodeTypeConstructor; - - // Adds the static constructor to the type. - type1->Members->Add( constructor2 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class Type1 - // { - // - // static Type1() - // { - // } - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp deleted file mode 100644 index eb0a71bdaee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeTypeDeclarationCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeTypeDeclarationCollection - void CodeTypeDeclarationCollectionExample() - { - - // - // - // Creates an empty CodeTypeDeclarationCollection. - CodeTypeDeclarationCollection^ collection = gcnew CodeTypeDeclarationCollection; - // - - // - // Adds a CodeTypeDeclaration to the collection. - collection->Add( gcnew CodeTypeDeclaration( "TestType" ) ); - // - - // - // Adds an array of CodeTypeDeclaration objects to the collection. - array^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )}; - collection->AddRange( declarations ); - - // Adds a collection of CodeTypeDeclaration objects to the - // collection. - CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection; - declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) ); - declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) ); - collection->AddRange( declarationsCollection ); - // - - // - // Tests for the presence of a CodeTypeDeclaration in the - // collection, and retrieves its index if it is found. - CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" ); - int itemIndex = -1; - if ( collection->Contains( testDeclaration ) ) - itemIndex = collection->IndexOf( testDeclaration ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified CodeTypeDeclaration array. - // 'declarations' is a CodeTypeDeclaration array. - collection->CopyTo( declarations, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeTypeDeclaration at index 0 of the collection. - collection->Insert( 0, gcnew CodeTypeDeclaration( "TestType" ) ); - // - - // - // Removes the specified CodeTypeDeclaration from the collection. - CodeTypeDeclaration^ declaration = gcnew CodeTypeDeclaration( "TestType" ); - collection->Remove( declaration ); - // - - // - // Removes the CodeTypeDeclaration at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp deleted file mode 100644 index ac817d9918f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::Reflection; - -namespace CodeDomSamples -{ - public ref class CodeTypeDeclarationExample - { - public: - CodeTypeDeclarationExample() - { - - // - // Creates a new type declaration. - - // name parameter indicates the name of the type. - CodeTypeDeclaration^ newType = gcnew CodeTypeDeclaration( "TestType" ); - - // Sets the member attributes for the type to private. - newType->Attributes = MemberAttributes::Private; - - // Sets a base class which the type inherits from. - newType->BaseTypes->Add( "BaseType" ); - - // A C# code generator produces the following source code for the preceeding example code: - // class TestType : BaseType - // { - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp deleted file mode 100644 index 79266531f92..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp +++ /dev/null @@ -1,78 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeTypeDelegateExample - { - public: - CodeTypeDelegateExample() - { - - // - // Declares a type to contain the delegate and constructor method. - CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "DelegateTest" ); - - // Declares an event that accepts a custom delegate type of "TestDelegate". - CodeMemberEvent^ event1 = gcnew CodeMemberEvent; - event1->Name = "TestEvent"; - event1->Type = gcnew CodeTypeReference( "DelegateTest.TestDelegate" ); - type1->Members->Add( event1 ); - - // - // Declares a delegate type called TestDelegate with an EventArgs parameter. - CodeTypeDelegate^ delegate1 = gcnew CodeTypeDelegate( "TestDelegate" ); - delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); - delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // public delegate void TestDelegate(object sender, System.EventArgs e); - // - type1->Members->Add( delegate1 ); - - // Declares a method that matches the "TestDelegate" method signature. - CodeMemberMethod^ method1 = gcnew CodeMemberMethod; - method1->Name = "TestMethod"; - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); - method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); - type1->Members->Add( method1 ); - - // Defines a constructor that attaches a TestDelegate delegate pointing to the TestMethod method - // to the TestEvent event. - CodeConstructor^ constructor1 = gcnew CodeConstructor; - constructor1->Attributes = MemberAttributes::Public; - CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "DelegateTest.TestDelegate" ),gcnew CodeThisReferenceExpression,"TestMethod" ); - CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 ); - constructor1->Statements->Add( attachStatement1 ); - type1->Members->Add( constructor1 ); - - // A C# code generator produces the following source code for the preceeding example code: - // public class DelegateTest - // { - // - // public DelegateTest() - // { - // this.TestEvent += new DelegateTest.TestDelegate(this.TestMethod); - // } - // - // private event DelegateTest.TestDelegate TestEvent; - // - // private void TestMethod(object sender, System.EventArgs e) - // { - // } - // - // public delegate void TestDelegate(object sender, System.EventArgs e); - // } - // - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp deleted file mode 100644 index 764de1a8a1d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeTypeMemberCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeTypeMemberCollection - void CodeTypeMemberCollectionExample() - { - - // - // - // Creates an empty CodeTypeMemberCollection. - CodeTypeMemberCollection^ collection = gcnew CodeTypeMemberCollection; - // - - // - // Adds a CodeTypeMember to the collection. - collection->Add( gcnew CodeMemberField( "System.String","TestStringField" ) ); - // - - // - // Adds an array of CodeTypeMember objects to the collection. - array^members = {gcnew CodeMemberField( "System.String","TestStringField1" ),gcnew CodeMemberField( "System.String","TestStringField2" )}; - collection->AddRange( members ); - - // Adds a collection of CodeTypeMember objects to the collection. - CodeTypeMemberCollection^ membersCollection = gcnew CodeTypeMemberCollection; - membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField1" ) ); - membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField2" ) ); - collection->AddRange( membersCollection ); - // - - // - // Tests for the presence of a CodeTypeMember in the collection, - // and retrieves its index if it is found. - CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" ); - int itemIndex = -1; - if ( collection->Contains( testMember ) ) - itemIndex = collection->IndexOf( testMember ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified CodeTypeMember array. - // 'members' is a CodeTypeMember array. - collection->CopyTo( members, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeTypeMember at index 0 of the collection. - collection->Insert( 0, gcnew CodeMemberField( "System.String","TestStringField" ) ); - // - - // - // Removes the specified CodeTypeMember from the collection. - CodeTypeMember^ member = gcnew CodeMemberField( "System.String","TestStringField" ); - collection->Remove( member ); - // - - // - // Removes the CodeTypeMember at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp deleted file mode 100644 index c1b459722a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -namespace CodeDomSamples -{ - public ref class CodeTypeOfExample - { - public: - static void Main() - { - ShowTypeReference(); - Console::WriteLine(); - ShowTypeReferenceExpression(); - } - - static void ShowTypeReference() - { - // - // Creates a reference to the System.DateTime type. - CodeTypeReference^ typeRef1 = gcnew CodeTypeReference("System.DateTime"); - - // Creates a typeof expression for the specified type reference. - CodeTypeOfExpression^ typeof1 = gcnew CodeTypeOfExpression(typeRef1); - - // Create a C# code provider - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Generate code and send the output to the console - provider->GenerateCodeFromExpression(typeof1, Console::Out, gcnew CodeGeneratorOptions()); - // The code generator produces the following source code for the preceeding example code: - // typeof(System.DateTime) - // - } - - static void ShowTypeReferenceExpression() - { - // - // Creates an expression referencing the System.DateTime type. - CodeTypeReferenceExpression^ typeRef1 = gcnew CodeTypeReferenceExpression("System.DateTime"); - - // Create a C# code provider - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Generate code and send the output to the console - provider->GenerateCodeFromExpression(typeRef1, Console::Out, gcnew CodeGeneratorOptions()); - // The code generator produces the following source code for the preceeding example code: - - // System.DateTime - - // - } - }; -} - -int main() -{ - CodeDomSamples::CodeTypeOfExample::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp deleted file mode 100644 index ab613ec0d11..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeTypeReferenceCollectionExample -{ - public ref class Class1 - { - public: - Class1(){} - - // CodeTypeReferenceCollection - void CodeTypeReferenceCollectionExample() - { - // - // - // Creates an empty CodeTypeReferenceCollection. - CodeTypeReferenceCollection^ collection = gcnew CodeTypeReferenceCollection; - // - - // - // Adds a CodeTypeReference to the collection. - collection->Add( gcnew CodeTypeReference( bool::typeid ) ); - // - - // - // Adds an array of CodeTypeReference objects to the collection. - array^references = {gcnew CodeTypeReference( bool::typeid ),gcnew CodeTypeReference( bool::typeid )}; - collection->AddRange( references ); - - // Adds a collection of CodeTypeReference objects to the collection. - CodeTypeReferenceCollection^ referencesCollection = gcnew CodeTypeReferenceCollection; - referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) ); - referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) ); - collection->AddRange( referencesCollection ); - // - - // - // Tests for the presence of a CodeTypeReference in the - // collection, and retrieves its index if it is found. - CodeTypeReference^ testReference = gcnew CodeTypeReference( bool::typeid ); - int itemIndex = -1; - if ( collection->Contains( testReference ) ) - itemIndex = collection->IndexOf( testReference ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified CodeTypeReference array. - // 'references' is a CodeTypeReference array. - collection->CopyTo( references, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CodeTypeReference at index 0 of the collection. - collection->Insert( 0, gcnew CodeTypeReference( bool::typeid ) ); - // - - // - // Removes the specified CodeTypeReference from the collection. - CodeTypeReference^ reference = gcnew CodeTypeReference( bool::typeid ); - collection->Remove( reference ); - // - - // - // Removes the CodeTypeReference at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp deleted file mode 100644 index a97b2b691ab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; - -namespace CodeDomSamples -{ - public ref class CodeVariableDeclarationStatementExample - { - public: - CodeVariableDeclarationStatementExample() - { - // - // Type of the variable to declare. - // Name of the variable to declare. - // Optional initExpression parameter initializes the variable. - CodeVariableDeclarationStatement^ variableDeclaration = gcnew CodeVariableDeclarationStatement( String::typeid,"TestString",gcnew CodePrimitiveExpression( "Testing" ) ); - - // A C# code generator produces the following source code for the preceeding example code: - // string TestString = "Testing"; - // - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp b/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp deleted file mode 100644 index 914c8f0a8fb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Types:System.Globalization.CompareInfo -// -using namespace System; -using namespace System::Text; -using namespace System::Globalization; - -int main() -{ - array^ sign = gcnew array { "<", "=", ">" }; - - // The code below demonstrates how strings compare - // differently for different cultures. - String^ s1 = "Coté"; - String^ s2 = "coté"; - String^ s3 = "côte"; - - // Set sort order of strings for French in France. - CompareInfo^ ci = (gcnew CultureInfo("fr-FR"))->CompareInfo; - Console::WriteLine(L"The LCID for {0} is {1}.", ci->Name, ci->LCID); - - // Display the result using fr-FR Compare of Coté = coté. - Console::WriteLine(L"fr-FR Compare: {0} {2} {1}", - s1, s2, sign[ci->Compare(s1, s2, CompareOptions::IgnoreCase) + 1]); - - // Display the result using fr-FR Compare of coté > côte. - Console::WriteLine(L"fr-FR Compare: {0} {2} {1}", - s2, s3, sign[ci->Compare(s2, s3, CompareOptions::None) + 1]); - - // Set sort order of strings for Japanese as spoken in Japan. - ci = (gcnew CultureInfo("ja-JP"))->CompareInfo; - Console::WriteLine(L"The LCID for {0} is {1}.", ci->Name, ci->LCID); - - // Display the result using ja-JP Compare of coté < côte. - Console::WriteLine("ja-JP Compare: {0} {2} {1}", - s2, s3, sign[ci->Compare(s2, s3) + 1]); -} - -// This code produces the following output. -// -// The LCID for fr-FR is 1036. -// fr-FR Compare: Coté = coté -// fr-FR Compare: coté > côte -// The LCID for ja-JP is 1041. -// ja-JP Compare: coté < côte -// - diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp deleted file mode 100644 index 8a41cb9003d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -public ref class Class1 -{ -public: - Class1(){} - - // CompilerErrorCollection - void CompilerErrorCollectionExample() - { - - // - // - // Creates an empty CompilerErrorCollection. - CompilerErrorCollection^ collection = gcnew CompilerErrorCollection; - // - - // - // Adds a CompilerError to the collection. - collection->Add( gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" ) ); - // - - // - // Adds an array of CompilerError objects to the collection. - array^errors = {gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ),gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" )}; - collection->AddRange( errors ); - - // Adds a collection of CompilerError objects to the collection. - CompilerErrorCollection^ errorsCollection = gcnew CompilerErrorCollection; - errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) ); - errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) ); - collection->AddRange( errorsCollection ); - // - - // - // Tests for the presence of a CompilerError in the - // collection, and retrieves its index if it is found. - CompilerError^ testError = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ); - int itemIndex = -1; - if ( collection->Contains( testError ) ) - itemIndex = collection->IndexOf( testError ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified CompilerError array. - // 'errors' is a CompilerError array. - collection->CopyTo( errors, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a CompilerError at index 0 of the collection. - collection->Insert( 0, gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) ); - // - - // - // Removes the specified CompilerError from the collection. - CompilerError^ error = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ); - collection->Remove( error ); - // - - // - // Removes the CompilerError at index 0. - collection->RemoveAt( 0 ); - // - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp deleted file mode 100644 index 2ee1d38b759..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// The following example builds a CodeDom source graph for a simple -// Hello World program. The source is then saved to a file, -// compiled into an executable, and run. - -// This example is based loosely on the CodeDom example, but its -// primary intent is to illustrate the CompilerParameters class. - -// Notice that the snippet is conditionally compiled for Everett vs. -// Whidbey builds. Whidbey introduced new APIs that are not available -// in Everett. Snippet IDs do not overlap between Whidbey and Everett; -// Snippet #1 is Everett, Snippet #2 is Whidbey. -#using -// -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::IO; -using namespace System::Diagnostics; - -// Build a Hello World program graph using System.CodeDom types. -static CodeCompileUnit^ BuildHelloWorldGraph() -{ - // Create a new CodeCompileUnit to contain the program graph. - CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; - - // Declare a new namespace called Samples. - CodeNamespace^ samples = gcnew CodeNamespace( "Samples" ); - // Add the new namespace to the compile unit. - compileUnit->Namespaces->Add( samples ); - - // Add the new namespace import for the System namespace. - samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); - - // Declare a new type called Class1. - CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" ); - // Add the new type to the namespace's type collection. - samples->Types->Add( class1 ); - - // Declare a new code entry point method - CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod; - - // Create a type reference for the System::Console class. - CodeTypeReferenceExpression^ csSystemConsoleType = - gcnew CodeTypeReferenceExpression( "System.Console" ); - - // Build a Console::WriteLine statement. - CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( - csSystemConsoleType, "WriteLine", - gcnew CodePrimitiveExpression( "Hello World!" ) ); - - // Add the WriteLine call to the statement collection. - start->Statements->Add( cs1 ); - - // Build another Console::WriteLine statement. - CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression( - csSystemConsoleType, "WriteLine", - gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) ); - // Add the WriteLine call to the statement collection. - start->Statements->Add( cs2 ); - - // Build a call to System::Console::ReadLine. - CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression( - csSystemConsoleType, "ReadLine" ); - CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression( - csReadLine,gcnew array(0) ); - - // Add the ReadLine statement. - start->Statements->Add( cs3 ); - - // Add the code entry point method to the Members collection - // of the type. - class1->Members->Add( start ); - - return compileUnit; -} - -static String^ GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit ) -{ - // Build the source file name with the language extension (vb, cs, js). - String^ sourceFile = String::Empty; - - if ( provider->FileExtension->StartsWith( "." ) ) - { - sourceFile = String::Concat( "HelloWorld", provider->FileExtension ); - } - else - { - sourceFile = String::Concat( "HelloWorld.", provider->FileExtension ); - } - - // Create a TextWriter to a StreamWriter to an output file. - IndentedTextWriter^ tw = gcnew IndentedTextWriter( - gcnew StreamWriter( sourceFile,false )," " ); - // Generate source code using the code generator. - provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions ); - // Close the output file. - tw->Close(); - return sourceFile; -} - -// -static bool CompileCode( CodeDomProvider^ provider, - String^ sourceFile, - String^ exeFile ) -{ - - CompilerParameters^ cp = gcnew CompilerParameters; - if ( !cp) - { - return false; - } - - // Generate an executable instead of - // a class library. - cp->GenerateExecutable = true; - - // Set the assembly file name to generate. - cp->OutputAssembly = exeFile; - - // Generate debug information. - cp->IncludeDebugInformation = true; - - // Add an assembly reference. - cp->ReferencedAssemblies->Add( "System.dll" ); - - // Save the assembly as a physical file. - cp->GenerateInMemory = false; - - // Set the level at which the compiler - // should start displaying warnings. - cp->WarningLevel = 3; - - // Set whether to treat all warnings as errors. - cp->TreatWarningsAsErrors = false; - - // Set compiler argument to optimize output. - cp->CompilerOptions = "/optimize"; - - // Set a temporary files collection. - // The TempFileCollection stores the temporary files - // generated during a build in the current directory, - // and does not delete them after compilation. - cp->TempFiles = gcnew TempFileCollection( ".",true ); - - if ( provider->Supports( GeneratorSupport::EntryPointMethod ) ) - { - // Specify the class that contains - // the main method of the executable. - cp->MainClass = "Samples.Class1"; - } - - if ( Directory::Exists( "Resources" ) ) - { - if ( provider->Supports( GeneratorSupport::Resources ) ) - { - // Set the embedded resource file of the assembly. - // This is useful for culture-neutral resources, - // or default (fallback) resources. - cp->EmbeddedResources->Add( "Resources\\Default.resources" ); - - // Set the linked resource reference files of the assembly. - // These resources are included in separate assembly files, - // typically localized for a specific language and culture. - cp->LinkedResources->Add( "Resources\\nb-no.resources" ); - } - } - - // Invoke compilation. - CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile ); - - if ( cr->Errors->Count > 0 ) - { - // Display compilation errors. - Console::WriteLine( "Errors building {0} into {1}", - sourceFile, cr->PathToAssembly ); - for each ( CompilerError^ ce in cr->Errors ) - { - Console::WriteLine( " {0}", ce->ToString() ); - Console::WriteLine(); - } - } - else - { - Console::WriteLine( "Source {0} built into {1} successfully.", - sourceFile, cr->PathToAssembly ); - } - - // Return the results of compilation. - if ( cr->Errors->Count > 0 ) - { - return false; - } - else - { - return true; - } -} -// - -[STAThread] -void main() -{ - String^ exeName = "HelloWorld.exe"; - CodeDomProvider^ provider = nullptr; - - Console::WriteLine( "Enter the source language for Hello World (cs, vb, etc):" ); - String^ inputLang = Console::ReadLine(); - Console::WriteLine(); - - if ( CodeDomProvider::IsDefinedLanguage( inputLang ) ) - { - CodeCompileUnit^ helloWorld = BuildHelloWorldGraph(); - provider = CodeDomProvider::CreateProvider( inputLang ); - if ( helloWorld && provider ) - { - String^ sourceFile = GenerateCode( provider, helloWorld ); - Console::WriteLine( "HelloWorld source code generated." ); - if ( CompileCode( provider, sourceFile, exeName ) ) - { - Console::WriteLine( "Starting HelloWorld executable." ); - Process::Start( exeName ); - } - } - } - - if ( provider == nullptr ) - { - Console::WriteLine( "There is no CodeDomProvider for the input language." ); - } -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp deleted file mode 100644 index 89f9230ed7d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::Collections; -using namespace System::Security::Permissions; - -public ref class Class1 -{ -public: - Class1(){} - - // - // Displays information from a CompilerResults. - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - static void DisplayCompilerResults( System::CodeDom::Compiler::CompilerResults^ cr ) - { - - // If errors occurred during compilation, output the compiler output and errors. - if ( cr->Errors->Count > 0 ) - { - for ( int i = 0; i < cr->Output->Count; i++ ) - Console::WriteLine( cr->Output[ i ] ); - for ( int i = 0; i < cr->Errors->Count; i++ ) - Console::WriteLine( String::Concat( i, ": ", cr->Errors[ i ] ) ); - } - else - { - - // Display information ab->Item[Out] the* compiler's exit code and the generated assembly. - Console::WriteLine( "Compiler returned with result code: {0}", cr->NativeCompilerReturnValue ); - Console::WriteLine( "Generated assembly name: {0}", cr->CompiledAssembly->FullName ); - if ( cr->PathToAssembly == nullptr ) - Console::WriteLine( "The assembly has been generated in memory." ); - else - Console::WriteLine( "Path to assembly: {0}", cr->PathToAssembly ); - - // Display temporary files information. - if ( !cr->TempFiles->KeepFiles ) - Console::WriteLine( "Temporary build files were deleted." ); - else - { - Console::WriteLine( "Temporary build files were not deleted." ); - - // Display a list of the temporary build files - IEnumerator^ enu = cr->TempFiles->GetEnumerator(); - for ( int i = 0; enu->MoveNext(); i++ ) - Console::WriteLine("TempFile " + i.ToString() + ": " + (String^)(enu->Current) ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp b/snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp deleted file mode 100644 index c3bc51ec87e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// System::Configuration::Install::ComponentInstaller.CopyFromComponent -// System::Configuration::Install::ComponentInstaller.IsEquivalentInstaller - -/* The following example demonstrates the 'CopyFromComponent' and -the 'IsEquivalentInstaller' methods of the 'ComponentInstaller' class. -It defines a class MyInstallClass, which creates the event log and copies -the properties of the event log component to the 'EventLogInstaller' object. -It also checks whether 'ServiceInstaller' object can handle the same kind of -installation as 'EventLogInstaller' object. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::ServiceProcess; - -int main() -{ -// - EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller; - // Create a source for the specified event log, on local computer. - EventLog::CreateEventSource( "MyEventSource", "MyEventLog", "." ); - // Create an event log instance and associate it with the log . - EventLog^ myEventLog = gcnew EventLog( "MyEventLog",".","MyEventSource" ); - // Copy the properties that are required at install time from - // the event log component to the installer. - myEventLogInstaller->CopyFromComponent( myEventLog ); -// - Console::WriteLine( "The properties of the event log component : " ); - Console::WriteLine( myEventLogInstaller->Log ); - Console::WriteLine( myEventLogInstaller->Source ); -// - ServiceInstaller^ myServiceInstaller = gcnew ServiceInstaller; - // Check whether 'ServiceInstaller' object can handle the same - // kind of installation as 'EventLogInstaller' object. - if ( myEventLogInstaller->IsEquivalentInstaller( myServiceInstaller ) ) - { - Console::WriteLine( "'ServiceInstaller' can handle the same kind " + - "of installation as EventLogInstaller" ); - } - else - { - Console::WriteLine( "'ServiceInstaller' can't handle the same " + - "kind of installation as 'EventLogInstaller'" ); - } -// - EventLog::Delete( "MyEventLog", "." ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp b/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp deleted file mode 100644 index 3c72773fc05..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp +++ /dev/null @@ -1,66 +0,0 @@ - - -// This sample takes a given input and replaces each -// occurence of the tab character with 4 space characters. -// It also takes two command-line arguements: input file name, & output file name. -// Usage: -// EXPANDTABS inputfile.txt outputfile.txt -// System.Console.Read -// System.Console.WriteLine -// System.Console.Write -// System.Console.SetIn -// System.Console.SetOut -// System.Console.Error -// System.Console.Out -// -using namespace System; -using namespace System::IO; - -void main() -{ - const int tabSize = 4; - array^args = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: EXPANDTABSEX inputfile.txt outputfile.txt"; - StreamWriter^ writer = nullptr; - - if ( args->Length < 3 ) - { - Console::WriteLine( usageText ); - return; - } - - try - { - writer = gcnew StreamWriter( args[ 2 ] ); - Console::SetOut( writer ); - Console::SetIn( gcnew StreamReader( args[ 1 ] ) ); - } - catch ( IOException^ e ) - { - TextWriter^ errorWriter = Console::Error; - errorWriter->WriteLine( e->Message ); - errorWriter->WriteLine( usageText ); - return; - } - - int i; - while ( (i = Console::Read()) != -1 ) - { - Char c = (Char)i; - if ( c == '\t' ) - Console::Write( ((String^)"")->PadRight( tabSize, ' ' ) ); - else - Console::Write( c ); - } - - writer->Close(); - - // Recover the standard output stream so that a - // completion message can be displayed. - StreamWriter^ standardOutput = gcnew StreamWriter(Console::OpenStandardOutput()); - standardOutput->AutoFlush = true; - Console::SetOut(standardOutput); - Console::WriteLine( "EXPANDTABSEX has completed the processing of {0}.", args[ 0 ] ); - return; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp deleted file mode 100644 index da26b213429..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// System.Reflection.Emit.ConstructorBuilder.AddDeclarativeSecurity() -// System.Reflection.Emit.ConstructorBuilder.Attributes -// System.Reflection.Emit.ConstructorBuilder.DeclaringType -// System.Reflection.Emit.ConstructorBuilder.DefineParameter() - -/* The following program demonstrates the 'AddDeclarativeSecurity', -'DefineParameter' methods, and 'Attributes', 'DeclaringType' properties -of the ConstructorBuilder class. Create the assembly in the current domain -with dynamic module in the assembly. Constructor builder is used in -conjunction with the 'TypeBuilder' class to create constructor at run time. -Add declarative security to the constructor. Display the 'Attributes', -'DeclaringType' and 'DefineParameter'. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Security::Permissions; -using namespace System::Security; - -public ref class MyConstructorBuilder -{ -private: - Type^ myType1; - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - MyConstructorBuilder() - { - myModuleBuilder = nullptr; - myAssemblyBuilder = nullptr; - -// -// -// - MethodBuilder^ myMethodBuilder = nullptr; - - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - // Create assembly in current CurrentDomain - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - // Create a dynamic assembly - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( - myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - // Create a dynamic module in the assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); - FieldInfo^ myFieldInfo = - myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); - // Create a type in the module - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); - FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", - String::typeid, FieldAttributes::Public ); - array^myConstructorArgs = {String::typeid}; - // Define a constructor of the dynamic class. - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( - MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); - PermissionSet^ myPset = gcnew PermissionSet( PermissionState::Unrestricted ); - // Add declarative security to the constructor. - Console::WriteLine( "Adding declarative security to the constructor....." ); - Console::WriteLine( "The Security action to be taken is \"DENY\" and" + - " Permission set is \"UNRESTRICTED\"." ); - myConstructor->AddDeclarativeSecurity( SecurityAction::Deny, myPset ); -// - MethodAttributes myMethodAttributes = myConstructor->Attributes; - Type^ myAttributeType = MethodAttributes::typeid; - int myAttribValue = (int)myMethodAttributes; - if ( !myAttributeType->IsEnum ) - { - Console::WriteLine( "This is not an Enum" ); - } - array^myFieldInfo1 = myAttributeType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); - Console::WriteLine( "The Field info names of the Attributes for the constructor are:" ); - for ( int i = 0; i < myFieldInfo1->Length; i++ ) - { - int myFieldValue = *dynamic_cast(myFieldInfo1[ i ]->GetValue( nullptr )); - if ( (myFieldValue & myAttribValue) == myFieldValue ) - { - Console::WriteLine( " {0}", myFieldInfo1[ i ]->Name ); - } - } - - Type^ myType2 = myConstructor->DeclaringType; - Console::WriteLine( "The declaring type is : {0}", myType2 ); -// - ParameterBuilder^ myParameterBuilder1 = - myConstructor->DefineParameter( 1, ParameterAttributes::Out, "My Parameter Name1" ); - Console::WriteLine( "The name of the parameter is : {0}", - myParameterBuilder1->Name ); - if ( myParameterBuilder1->IsIn ) - Console::WriteLine( "{0} is Input parameter.", myParameterBuilder1->Name ); - else - Console::WriteLine( "{0} is not Input Parameter.", myParameterBuilder1->Name ); - ParameterBuilder^ myParameterBuilder2 = - myConstructor->DefineParameter( 1, ParameterAttributes::In, "My Parameter Name2" ); - Console::WriteLine( "The Parameter name is : {0}", - myParameterBuilder2->Name ); - if ( myParameterBuilder2->IsIn ) - Console::WriteLine( "{0} is Input parameter.", myParameterBuilder2->Name ); - else - Console::WriteLine( "{0} is not Input Parameter.", myParameterBuilder2->Name ); -// - // Generate MSIL for the method, call its base class constructor and store the arguments - // in the private field. - ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator(); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); - myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - myILGenerator3->Emit( OpCodes::Ldarg_1 ); - myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); - myILGenerator3->Emit( OpCodes::Ret ); - // Add a method to the type. - myMethodBuilder = myTypeBuilder->DefineMethod( - "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); - // Generate MSIL for the method. - ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); - myILGenerator2->EmitWriteLine( "Hello World from global" ); - myILGenerator2->Emit( OpCodes::Ret ); - myModuleBuilder->CreateGlobalFunctions(); - myType1 = myTypeBuilder->CreateType(); - } - property Type^ MyTypeProperty - { - Type^ get() - { - return this->myType1; - } - } -}; -int main() -{ - MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; - Type^ myType1 = myConstructorBuilder->MyTypeProperty; - if ( nullptr != myType1 ) - { - Console::WriteLine( "Instantiating the new type..." ); - array^myObject = {"hello"}; - Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); - MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); - if ( nullptr != myMethodInfo ) - { - Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); - myMethodInfo->Invoke( myObject1, nullptr ); - } - else - { - Console::WriteLine( "Could not locate HelloWorld method" ); - } - } - else - { - Console::WriteLine( "Could not access Type." ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp deleted file mode 100644 index 6bc0d5da26e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// System.Reflection.Emit.ConstructorBuilder.GetModule() -// System.Reflection.Emit.ConstructorBuilder.GetToken() -// System.Reflection.Emit.ConstructorBuilder.GetMethodImplementationFlags() -// System.Reflection.Emit.ConstructorBuilder.GetParameters() - -/* The following program demonstrates the 'GetModule','GetToken', -'GetMethodImplementationFlags' and 'GetParameters' -methods of 'ConstructorBuilder' class. Create the assembly -in the current domain with dynamic module in the assembly. Constructor -builder is used in conjunction with the 'TypeBuilder' class to create -constructor at run time. Set a custom attribute using a custom attribute -builder and displays module name, Token id and parameter info of this class. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Security; -using namespace System::Security::Permissions; - -public ref class MyConstructorBuilder -{ -private: - Type^ myType1; - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - MyConstructorBuilder() - { - myModuleBuilder = nullptr; - myAssemblyBuilder = nullptr; -// -// - - MethodBuilder^ myMethodBuilder = nullptr; - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - // Create assembly in current CurrentDomain. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - // Create a dynamic assembly. - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - // Create a dynamic module in the assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); - FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", - String::typeid, FieldAttributes::Public ); - array^myConstructorArgs = {String::typeid}; -// -// - // Define a constructor of the dynamic class. - ConstructorBuilder^ myConstructorBuilder = myTypeBuilder->DefineConstructor( - MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); - // Get a reference to the module that contains this constructor. - Module^ myModule = myConstructorBuilder->GetModule(); - Console::WriteLine( "Module Name : {0}", myModule->Name ); - // Get the 'MethodToken' that represents the token for this constructor. - MethodToken myMethodToken = myConstructorBuilder->GetToken(); - Console::WriteLine( "Constructor Token is : {0}", myMethodToken.Token ); - // Get the method implementation flags for this constructor. - MethodImplAttributes myMethodImplAttributes = myConstructorBuilder->GetMethodImplementationFlags(); - Console::WriteLine( "MethodImplAttributes : {0}", myMethodImplAttributes ); -// -// -// - // Generate IL for the method, call its base class constructor and store the arguments - // in the private field. - ILGenerator^ myILGenerator3 = myConstructorBuilder->GetILGenerator(); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); - myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - myILGenerator3->Emit( OpCodes::Ldarg_1 ); - myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); - myILGenerator3->Emit( OpCodes::Ret ); - // Add a method to the type. - myMethodBuilder = myTypeBuilder->DefineMethod( - "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); - // Generate IL for the method. - ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); - myILGenerator2->EmitWriteLine( "Hello World from global" ); - myILGenerator2->Emit( OpCodes::Ret ); - myModuleBuilder->CreateGlobalFunctions(); - myType1 = myTypeBuilder->CreateType(); - - // Get the parameters of this constructor. - array^myParameterInfo = myConstructorBuilder->GetParameters(); - for ( int i = 0; i < myParameterInfo->Length; i++ ) - { - Console::WriteLine( "Declaration type : {0}", myParameterInfo[ i ]->Member->DeclaringType ); - } -// - } - property Type^ MyTypeProperty - { - Type^ get() - { - return this->myType1; - } - } -}; - -int main() -{ - MyConstructorBuilder^ myConstructorBuilder1 = gcnew MyConstructorBuilder; - Type^ myTypeProperty = myConstructorBuilder1->MyTypeProperty; - if ( nullptr != myTypeProperty ) - { - array^myObject = {"Hello"}; - Object^ myObject1 = Activator::CreateInstance( myTypeProperty, myObject, (Object^) 0 ); - MethodInfo^ myMethodInfo = myTypeProperty->GetMethod( "HelloWorld" ); - - if ( nullptr != myMethodInfo ) - { - myMethodInfo->Invoke( myObject1, nullptr ); - } - else - { - Console::WriteLine( "Could not locate HelloWorld method" ); - } - } - else - { - Console::WriteLine( "Could not access Type." ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp deleted file mode 100644 index 90448fc379b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp +++ /dev/null @@ -1,123 +0,0 @@ - -// System.Reflection.Emit.ConstructorBuilder -// System.Reflection.Emit.ConstructorBuilder.Name -// System.Reflection.Emit.ConstructorBuilder.ReflectedType -// System.Reflection.Emit.ConstructorBuilder.Signature -// System.Reflection.Emit.ConstructorBuilder.ToString() -/* The following program demonstrates the 'ConstructorBuilder' class, -its 'Name', 'ReflectedType', 'Signature' properties and 'ToString' -method. Create the assembly in the current domain with dynamic module -in the assembly. ConstructorBuilder is used in conjunction with the -'TypeBuilder' class to create constructor at run time. Display the -'Name', 'Signature' and 'ReflectedType' to the console. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -public ref class MyConstructorBuilder -{ -private: - Type^ myType1; - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - MyConstructorBuilder() - { - myModuleBuilder = nullptr; - myAssemblyBuilder = nullptr; - - // - MethodBuilder^ myMethodBuilder = nullptr; - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - - // Create assembly in current CurrentDomain. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Create a dynamic assembly. - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module in the assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); - FieldInfo^ myFieldInfo = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); - FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); - array^myConstructorArgs = {String::typeid}; - - // Define a constructor of the dynamic class. - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); - - // Display the name of the constructor. - Console::WriteLine( "The constructor name is : {0}", myConstructor->Name ); - - // Display the 'Type' object from which this object was obtained. - Console::WriteLine( "The reflected type is : {0}", myConstructor->ReflectedType ); - - // Display the signature of the field. - Console::WriteLine( myConstructor->Signature ); - - // Display the constructor builder instance as a string. - Console::WriteLine( myConstructor ); - // - - // Generate IL for the method, call its superclass constructor and store the arguments - // in the private field. - ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator(); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); - myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - myILGenerator3->Emit( OpCodes::Ldarg_1 ); - myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); - myILGenerator3->Emit( OpCodes::Ret ); - - // Add a method to the type. - myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); - - // Generate IL for the method. - ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); - myILGenerator2->EmitWriteLine( "Hello World from global" ); - myILGenerator2->Emit( OpCodes::Ret ); - myModuleBuilder->CreateGlobalFunctions(); - myType1 = myTypeBuilder->CreateType(); - } - - property Type^ MyTypeProperty - { - Type^ get() - { - return this->myType1; - } - } -}; - -int main() -{ - MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; - Type^ myType1 = myConstructorBuilder->MyTypeProperty; - if ( nullptr != myType1 ) - { - Console::WriteLine( "Instantiating the new type..." ); - array^myObject = {"hello"}; - Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); - MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); - if ( nullptr != myMethodInfo ) - { - Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); - myMethodInfo->Invoke( myObject1, nullptr ); - } - else - { - Console::WriteLine( "Could not locate HelloWorld method" ); - } - } - else - { - Console::WriteLine( "Could not access Type." ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp deleted file mode 100644 index df97697cd2e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp +++ /dev/null @@ -1,91 +0,0 @@ - -// System::Reflection::Emit::ConstructorBuilder.SetCustomAttribute(CustomAttributeBuilder) -/* - The following program demonstrates the 'SetCustomAttribute(CustomAttributeBuilder)' - method of 'ConstructorBuilder' class. It defines a 'MyAttribute' class which is derived - from 'Attribute' class. It builds a constructor by setting 'MyAttribute' custom attribute - and defines 'Helloworld' type. Then it gets the custom attributes of 'HelloWorld' type - and displays its contents to the console. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute: public Attribute -{ -public: - String^ myString; - int myInteger; - MyAttribute( String^ myString, int myInteger ) - { - this->myString = myString; - this->myInteger = myInteger; - } - -}; - -static Type^ MyCreateCallee( AppDomain^ domain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Define a dynamic assembly in the current application domain-> - AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Define a dynamic module in this assembly-> - ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Construct a 'TypeBuilder' given the name and attributes. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Define a constructor of the dynamic class. - array^type1 = {String::typeid}; - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, type1 ); - ILGenerator^ myILGenerator = myConstructor->GetILGenerator(); - myILGenerator->Emit( OpCodes::Ldstr, "Constructor is invoked" ); - myILGenerator->Emit( OpCodes::Ldarg_1 ); - array^type2 = {String::typeid}; - MethodInfo^ myMethodInfo = Console::typeid->GetMethod( "WriteLine", type2 ); - myILGenerator->Emit( OpCodes::Call, myMethodInfo ); - myILGenerator->Emit( OpCodes::Ret ); - Type^ myType = MyAttribute::typeid; - array^type3 = {String::typeid,int::typeid}; - ConstructorInfo^ myConstructorInfo = myType->GetConstructor( type3 ); - array^obj1 = {"Hello",2}; - CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 ); - try - { - myConstructor->SetCustomAttribute( attributeBuilder ); - } - catch ( ArgumentNullException^ ex ) - { - Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); - } - - return myTypeBuilder->CreateType(); -} - -int main() -{ - Type^ myHelloworld = MyCreateCallee( Thread::GetDomain() ); - array^type1 = {String::typeid}; - ConstructorInfo^ myConstructor = myHelloworld->GetConstructor( type1 ); - array^myAttributes1 = myConstructor->GetCustomAttributes( true ); - Console::WriteLine( "MyAttribute custom attribute contains " ); - for ( int index = 0; index < myAttributes1->Length; index++ ) - { - if ( dynamic_cast(myAttributes1[ index ]) ) - { - Console::WriteLine( "The value of myString is : {0}", (safe_cast(myAttributes1[ index ]))->myString ); - Console::WriteLine( "The value of myInteger is : {0}", (safe_cast(myAttributes1[ index ]))->myInteger ); - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp deleted file mode 100644 index 7c6ae9bf4cb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp +++ /dev/null @@ -1,86 +0,0 @@ - -// System::Reflection::Emit::ConstructorBuilder.SetCustomAttribute(ConstructorInfo, Byte->Item[]) -/* - The following program demonstrates the 'SetCustomAttribute(ConstructorInfo, Byte[])' - method of 'ConstructorBuilder' class. It defines a 'MyAttribute' class which is derived - from 'Attribute' class. It builds a constructor by setting 'MyAttribute' custom attribute - and defines 'Helloworld' type. Then it gets the custom attributes of 'HelloWorld' type - and displays its contents to the console. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute: public Attribute -{ -public: - bool myBoolean; - MyAttribute( bool myBoolean ) - { - this->myBoolean = myBoolean; - } -}; - -static Type^ MyCreateCallee( AppDomain^ domain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Define a dynamic assembly in the current application domain. - AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Define a dynamic module in this assembly. - ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Construct a 'TypeBuilder' given the name and attributes. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Define a constructor of the dynamic class. - array^type1 = {String::typeid}; - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, type1 ); - ILGenerator^ myILGenerator = myConstructor->GetILGenerator(); - myILGenerator->Emit( OpCodes::Ldstr, "Constructor is invoked" ); - myILGenerator->Emit( OpCodes::Ldarg_1 ); - array^type2 = {String::typeid}; - MethodInfo^ myMethodInfo = Console::typeid->GetMethod( "WriteLine", type2 ); - myILGenerator->Emit( OpCodes::Call, myMethodInfo ); - myILGenerator->Emit( OpCodes::Ret ); - Type^ myType = MyAttribute::typeid; - array^type3 = {bool::typeid}; - ConstructorInfo^ myConstructorInfo = myType->GetConstructor( type3 ); - try - { - array^bytes = {01,00,01}; - myConstructor->SetCustomAttribute( myConstructorInfo, bytes ); - } - catch ( ArgumentNullException^ ex ) - { - Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); - } - - return myTypeBuilder->CreateType(); -} - -int main() -{ - Type^ myHelloworld = MyCreateCallee( Thread::GetDomain() ); - array^type1 = {String::typeid}; - ConstructorInfo^ myConstructor = myHelloworld->GetConstructor( type1 ); - array^myAttributes1 = myConstructor->GetCustomAttributes( true ); - Console::WriteLine( "MyAttribute custom attribute contains " ); - for ( int index = 0; index < myAttributes1->Length; index++ ) - { - if ( dynamic_cast(myAttributes1[ index ]) ) - { - Console::WriteLine( "myBoolean : {0}", safe_cast(myAttributes1[ index ])->myBoolean ); - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp deleted file mode 100644 index 9ff254e4a6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -// System::Reflection::Emit::ConstructorBuilder.SetImplementationFlags() -/* The following program demonstrates the 'SetImplementationFlags' - method of ConstructorBuilder class. It creates an assembly in the - current domain with a dynamic module in the assembly. Constructor - builder is used in conjunction with the 'TypeBuilder' class to create - constructor at run time. It then sets the method implementation flags - for the constructor and displays the same. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -public ref class MyConstructorBuilder -{ -private: - Type^ myType1; - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - MyConstructorBuilder() - { - myModuleBuilder = nullptr; - myAssemblyBuilder = nullptr; - try - { - // - MethodBuilder^ myMethodBuilder = nullptr; - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - - // Create assembly in current CurrentDomain. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Create a dynamic assembly. - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module in the assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true ); - FieldInfo^ myFieldInfo2 = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); - FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); - array^myConstructorArgs = {String::typeid}; - - // Define a constructor of the dynamic class. - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); - - // Set the method implementation flags for the constructor. - myConstructor->SetImplementationFlags( static_cast(MethodImplAttributes::PreserveSig | MethodImplAttributes::Runtime) ); - - // Get the method implementation flags for the constructor. - MethodImplAttributes myMethodAttributes = myConstructor->GetMethodImplementationFlags(); - Type^ myAttributeType = MethodImplAttributes::typeid; - int myAttribValue = (int)myMethodAttributes; - if ( !myAttributeType->IsEnum ) - { - Console::WriteLine( "This is not an Enum" ); - } - - // Display the field info names of the retrieved method implementation flags. - array^myFieldInfo = myAttributeType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); - Console::WriteLine( "The Field info names of the MethodImplAttributes for the constructor are:" ); - for ( int i = 0; i < myFieldInfo->Length; i++ ) - { - int myFieldValue = *safe_cast(myFieldInfo[ i ]->GetValue( nullptr )); - if ( (myFieldValue & myAttribValue) == myFieldValue ) - { - Console::WriteLine( " {0}", myFieldInfo[ i ]->Name ); - } - } - // - - // Add a method to the type. - myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); - - // Generate IL for the method. - ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); - myILGenerator2->EmitWriteLine( "Hello World from global" ); - myILGenerator2->Emit( OpCodes::Ret ); - myModuleBuilder->CreateGlobalFunctions(); - myType1 = myTypeBuilder->CreateType(); - } - catch ( InvalidOperationException^ ex ) - { - Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); - } - } - - property Type^ MyTypeProperty - { - Type^ get() - { - return this->myType1; - } - } -}; - -void main() -{ - MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; - Type^ myType1 = myConstructorBuilder->MyTypeProperty; - if ( nullptr != myType1 ) - { - Console::WriteLine( "Instantiating the new type..." ); - array^myObject = {"hello"}; - Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); - MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); - if ( nullptr != myMethodInfo ) - { - Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); - myMethodInfo->Invoke( myObject1, nullptr ); - } - else - { - Console::WriteLine( "Could not locate HelloWorld method" ); - } - } - else - { - Console::WriteLine( "Could not access Type." ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp deleted file mode 100644 index 16aca594b6f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// System.Reflection.Emit.ConstructorBuilder.SetSymCustomAttribute() - -/* The following program demonstrates the 'SetSymCustomAttribute' method -of ConstructorBuilder class. It creates an assembly in the current -domain with dynamic module in the assembly. Constructor builder is -used in conjunction with the 'TypeBuilder' class to create constructor -at run time. It then sets this constructor's custom attribute associated -with symbolic information. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class MyConstructorBuilder -{ -private: - Type^ myType1; - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - MyConstructorBuilder() - { - myModuleBuilder = nullptr; - myAssemblyBuilder = nullptr; - -// - MethodBuilder^ myMethodBuilder = nullptr; - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - // Create assembly in current CurrentDomain. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - // Create a dynamic assembly. - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( - myAssemblyName, AssemblyBuilderAccess::Run ); - // Create a dynamic module in the assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true ); - FieldInfo^ myFieldInfo = - myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); - FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", - String::typeid, FieldAttributes::Public ); - array^ myConstructorArgs = {String::typeid}; - // Define a constructor of the dynamic class. - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); - // Display the name of the constructor. - Console::WriteLine( "The constructor name is : {0}", myConstructor->Name ); - array^ temp0 = {01,00,00}; - myConstructor->SetSymCustomAttribute( "MySimAttribute", temp0 ); -// - // Generate the IL for the method and call its superclass constructor. - ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator(); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); - myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); - myILGenerator3->Emit( OpCodes::Ldarg_0 ); - myILGenerator3->Emit( OpCodes::Ldarg_1 ); - myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); - myILGenerator3->Emit( OpCodes::Ret ); - // Add a method to the type. - myMethodBuilder = myTypeBuilder->DefineMethod( - "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); - // Generate IL for the method. - ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); - myILGenerator2->EmitWriteLine( "Hello World from global" ); - myILGenerator2->Emit( OpCodes::Ret ); - myModuleBuilder->CreateGlobalFunctions(); - myType1 = myTypeBuilder->CreateType(); - } - - property Type^ MyTypeProperty - { - Type^ get() - { - return this->myType1; - } - } -}; - -int main() -{ - MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; - Type^ myType1 = myConstructorBuilder->MyTypeProperty; - if ( nullptr != myType1 ) - { - Console::WriteLine( "Instantiating the new type..." ); - array^ myObject = {"hello"}; - Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); - MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); - if ( nullptr != myMethodInfo ) - { - Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); - myMethodInfo->Invoke( myObject1, nullptr ); - } - else - { - Console::WriteLine( "Could not locate HelloWorld method" ); - } - } - else - { - Console::WriteLine( "Could not access Type." ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp deleted file mode 100644 index 2c6841d495b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -// System::Diagnostics->CounterCreationDataCollection::ctor -// System::Diagnostics->CounterCreationDataCollection->AddRange(CounterCreationDataCollection) -/* -The following program demonstrates 'CounterCreationDataCollection()' constructor and -'AddRange(CounterCreationDataCollection)' method of 'CounterCreationDataCollection' class. -A 'CounterCreationData' Object* is created and added to an instance of 'CounterCreationDataCollection' -class. Then counters in the 'CounterCreationDataCollection' are displayed to the console. -*/ -// -// -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - PerformanceCounter^ myCounter; - try - { - String^ myCategoryName; - int numberOfCounters; - Console::Write( "Enter the number of counters : " ); - numberOfCounters = Int32::Parse( Console::ReadLine() ); - array^myCounterCreationData = gcnew array(numberOfCounters); - for ( int i = 0; i < numberOfCounters; i++ ) - { - Console::Write( "Enter the counter name for {0} counter : ", i ); - myCounterCreationData[ i ] = gcnew CounterCreationData; - myCounterCreationData[ i ]->CounterName = Console::ReadLine(); - } - CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData ); - Console::Write( "Enter the category Name : " ); - myCategoryName = Console::ReadLine(); - - // Check if the category already exists or not. - if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) - { - CounterCreationDataCollection^ myNewCounterCollection = gcnew CounterCreationDataCollection; - - // Add the 'CounterCreationDataCollection' to 'CounterCreationDataCollection' Object*. - myNewCounterCollection->AddRange( myCounterCollection ); - PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myNewCounterCollection ); - for ( int i = 0; i < numberOfCounters; i++ ) - { - myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false ); - - } - Console::WriteLine( "The list of counters in CounterCollection are: " ); - for ( int i = 0; i < myNewCounterCollection->Count; i++ ) - Console::WriteLine( "Counter {0} is '{1}'", i + 1, myNewCounterCollection[ i ]->CounterName ); - } - else - { - Console::WriteLine( "The category already exists" ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}.", e->Message ); - } -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp deleted file mode 100644 index 04c88582196..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// System::Diagnostics->CounterCreationDataCollection::Contains(CounterCreationData) -// System::Diagnostics->CounterCreationDataCollection::Remove(CounterCreationData) - -/* -The following program demonstrates 'Contains' and 'Remove' methods of -'CounterCreationDataCollection' class. An instance of 'CounterCreationDataCollection' -is created by passing an array of 'CounterCreationData'. A particular instance of -'CounterCreationData' is removed if it exist in the 'CounterCreationDataCollection'. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - PerformanceCounter^ myCounter; - try - { -// -// - String^ myCategoryName; - int numberOfCounters; - Console::Write( "Enter the category Name :" ); - myCategoryName = Console::ReadLine(); - // Check if the category already exists or not. - if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) - { - Console::Write( "Enter the number of counters : " ); - numberOfCounters = Int32::Parse( Console::ReadLine() ); - array^ myCounterCreationData = - gcnew array(numberOfCounters); - for ( int i = 0; i < numberOfCounters; i++ ) - { - Console::Write( "Enter the counter name for {0} counter : ", i ); - myCounterCreationData[ i ] = gcnew CounterCreationData; - myCounterCreationData[ i ]->CounterName = Console::ReadLine(); - } - CounterCreationDataCollection^ myCounterCollection = - gcnew CounterCreationDataCollection; - // Add the 'CounterCreationData[]' to 'CounterCollection'. - myCounterCollection->AddRange( myCounterCreationData ); - - PerformanceCounterCategory::Create( myCategoryName, - "Sample Category", myCounterCollection ); - - for ( int i = 0; i < numberOfCounters; i++ ) - { - myCounter = gcnew PerformanceCounter( myCategoryName, - myCounterCreationData[ i ]->CounterName, "", false ); - } - if ( myCounterCreationData->Length > 0 ) - { - if ( myCounterCollection->Contains( myCounterCreationData[ 0 ] ) ) - { - myCounterCollection->Remove( myCounterCreationData[ 0 ] ); - Console::WriteLine( "'{0}' counter is removed from the" + - " CounterCreationDataCollection", myCounterCreationData[ 0 ]->CounterName ); - } - } - else - { - Console::WriteLine( "The counters does not exist" ); - } - } - else - { - Console::WriteLine( "The category already exists" ); - } -// -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}.", e->Message ); - return; - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp deleted file mode 100644 index 5af877a5275..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// System::Diagnostics->CounterCreationDataCollection->CounterCreationDataCollection(CounterCreationData->Item[]) - -/* -The following program demonstrates 'CounterCreationDataCollection(CounterCreationData->Item[])' -constructor of 'CounterCreationDataCollection' class. -An instance of 'CounterCreationDataCollection' is created by passing an array of -'CounterCreationData' to the constructor. The counters of the 'CounterCreationDataCollection' -are displayed to the console. - -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - PerformanceCounter^ myCounter; - try - { - -// - String^ myCategoryName; - int numberOfCounters; - Console::Write( "Enter the category Name : " ); - myCategoryName = Console::ReadLine(); - - // Check if the category already exists or not. - if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) - { - Console::Write( "Enter the number of counters : " ); - numberOfCounters = Int32::Parse( Console::ReadLine() ); - array^myCounterCreationData = gcnew array(numberOfCounters); - for ( int i = 0; i < numberOfCounters; i++ ) - { - Console::Write( "Enter the counter name for {0} counter : ", i ); - myCounterCreationData[ i ] = gcnew CounterCreationData; - myCounterCreationData[ i ]->CounterName = Console::ReadLine(); - - } - CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData ); - - // Create the category. - PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myCounterCollection ); - for ( int i = 0; i < numberOfCounters; i++ ) - { - myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false ); - - } - Console::WriteLine( "The list of counters in 'CounterCollection' are :" ); - for ( int i = 0; i < myCounterCollection->Count; i++ ) - Console::WriteLine( "Counter {0} is '{1}'", i, myCounterCollection[ i ]->CounterName ); - } - else - { - Console::WriteLine( "The category already exists" ); - } -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}.", e->Message ); - return; - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp deleted file mode 100644 index d9619066739..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -// System::Diagnostics->CounterCreationDataCollection->CounterCreationDataCollection(CounterCreationDataCollection) -/* -The following program demonstrates 'CounterCreationDataCollection(CounterCreationDataCollection)' -constructor of 'CounterCreationDataCollection' class. -An instance of 'CounterCreationDataCollection' is created by passing another instance -of 'CounterCreationDataCollection'. The counters of the 'CounterCreationDataCollection' -are displayed to the console. -*/ -#using - -using namespace System; -using namespace System::Diagnostics; -void main() -{ - PerformanceCounter^ myCounter; - try - { -// - String^ myCategoryName; - int numberOfCounters; - Console::Write( "Enter the number of counters : " ); - numberOfCounters = Int32::Parse( Console::ReadLine() ); - array^myCounterCreationData = gcnew array(numberOfCounters); - for ( int i = 0; i < numberOfCounters; i++ ) - { - Console::Write( "Enter the counter name for {0} counter : ", i ); - myCounterCreationData[ i ] = gcnew CounterCreationData; - myCounterCreationData[ i ]->CounterName = Console::ReadLine(); - - } - CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData ); - Console::Write( "Enter the category Name:" ); - myCategoryName = Console::ReadLine(); - - // Check if the category already exists or not. - if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) - { - CounterCreationDataCollection^ myNewCounterCollection = gcnew CounterCreationDataCollection( myCounterCollection ); - PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myNewCounterCollection ); - for ( int i = 0; i < numberOfCounters; i++ ) - { - myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false ); - - } - Console::WriteLine( "The list of counters in 'CounterCollection' are : " ); - for ( int i = 0; i < myNewCounterCollection->Count; i++ ) - Console::WriteLine( "Counter {0} is '{1}'", i, myNewCounterCollection[ i ]->CounterName ); - } - else - { - Console::WriteLine( "The category already exists" ); - } -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}.", e->Message ); - return; - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp deleted file mode 100644 index e4e097db2f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// System::Diagnostics->CounterCreationDataCollection::Insert(int, CounterCreationData) -// System::Diagnostics->CounterCreationDataCollection::IndexOf(CounterCreationData) - -/* -The following program demonstrates 'IndexOf(CounterCreationData)' and 'Insert(int, CounterCreationData)' -methods of 'CounterCreationDataCollection' class. An instance of 'CounterCreationDataCollection' -is created by passing an array of 'CounterCreationData' to the constructor. A counter is inserted -into the 'CounterCreationDataCollection' at specified index. The inserted counter and -its index are displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - PerformanceCounter^ myCounter; - try - { -// -// - String^ myCategoryName; - int numberOfCounters; - Console::Write( "Enter the category Name : " ); - myCategoryName = Console::ReadLine(); - // Check if the category already exists or not. - if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) - { - Console::Write( "Enter the number of counters : " ); - numberOfCounters = Int32::Parse( Console::ReadLine() ); - array^ myCounterCreationData = - gcnew array(numberOfCounters); - - for ( int i = 0; i < numberOfCounters; i++ ) - { - Console::Write( "Enter the counter name for {0} counter ", i ); - myCounterCreationData[ i ] = gcnew CounterCreationData; - myCounterCreationData[ i ]->CounterName = Console::ReadLine(); - } - CounterCreationDataCollection^ myCounterCollection = - gcnew CounterCreationDataCollection( myCounterCreationData ); - CounterCreationData^ myInsertCounterCreationData = gcnew CounterCreationData( - "CounterInsert","",PerformanceCounterType::NumberOfItems32 ); - // Insert an instance of 'CounterCreationData' in the 'CounterCreationDataCollection'. - myCounterCollection->Insert( myCounterCollection->Count - 1, - myInsertCounterCreationData ); - Console::WriteLine( "'{0}' counter is inserted into 'CounterCreationDataCollection'", - myInsertCounterCreationData->CounterName ); - // Create the category. - PerformanceCounterCategory::Create( myCategoryName, "Sample Category", - myCounterCollection ); - - for ( int i = 0; i < numberOfCounters; i++ ) - { - myCounter = gcnew PerformanceCounter( myCategoryName, - myCounterCreationData[ i ]->CounterName, "", false ); - } - Console::WriteLine( "The index of '{0}' counter is {1}", - myInsertCounterCreationData->CounterName, myCounterCollection->IndexOf( myInsertCounterCreationData ) ); - } - else - { - Console::WriteLine( "The category already exists" ); - } -// -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}.", e->Message ); - return; - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp b/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp deleted file mode 100644 index 2fe2f7b3082..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// System::Diagnostics->CounterSample->CounterSample(long, long, long, long, long, long, PerformanceCounterType) -// System::Diagnostics->CounterSample->CounterSample(long, long, long, long, long, long, PerformanceCounterType, long) - -/* The following program demonstrates the constructors of the 'CounterSample' -structure. It creates an instance of performance counter, configures it -to interact with 'Processor' category, '% Processor Time' counter and -'0' instance, creates an instance of 'CounterSample', and displays -the corresponding fields. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ -// - PerformanceCounter^ myPerformanceCounter1 = gcnew PerformanceCounter( - "Processor","% Processor Time","0" ); - CounterSample myCounterSample1( 10L, 20L, 30L, 40L, 50L, 60L, - PerformanceCounterType::AverageCount64 ); - Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample1.CounterTimeStamp ); - - Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue ); - Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue ); - Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency ); - Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency ); - Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp ); - Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec ); - Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType ); - // Hold the results of sample. - myCounterSample1 = myPerformanceCounter1->NextSample(); - Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue ); - Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue ); - Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency ); - Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency ); - Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp ); - Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec ); - Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType ); -// - Console::WriteLine( "" ); - Console::WriteLine( "" ); -// - PerformanceCounter^ myPerformanceCounter2 = - gcnew PerformanceCounter( "Processor","% Processor Time","0" ); - CounterSample myCounterSample2( 10L, 20L, 30L, 40L, 50L, 60L, - PerformanceCounterType::AverageCount64,300); - Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp ); - Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue ); - Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue ); - Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency ); - Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency ); - Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp ); - Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec ); - Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType ); - Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp ); - // Hold the results of sample. - myCounterSample2 = myPerformanceCounter2->NextSample(); - Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue ); - Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue ); - Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency ); - Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency ); - Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp ); - Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec ); - Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType ); - Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp ); -// -} diff --git a/snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp deleted file mode 100644 index 515adb362ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Worker : MarshalByRefObject -{ -public: - void PrintDomain() - { - Console::WriteLine("Object is executing in AppDomain \"{0}\"", - AppDomain::CurrentDomain->FriendlyName); - } -}; - -void main() -{ - // Create an ordinary instance in the current AppDomain - Worker^ localWorker = gcnew Worker(); - localWorker->PrintDomain(); - - // Create a new application domain, create an instance - // of Worker in the application domain, and execute code - // there. - AppDomain^ ad = AppDomain::CreateDomain("New domain"); - Worker^ remoteWorker = (Worker^) ad->CreateInstanceAndUnwrap( - Worker::typeid->Assembly->FullName, - "Worker"); - remoteWorker->PrintDomain(); -} - -/* This code produces output similar to the following: - -Object is executing in AppDomain "source.exe" -Object is executing in AppDomain "New domain" - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp deleted file mode 100644 index 99c669d9f27..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; -using namespace System::Text; - -void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv); -String^ DecryptTextFromFile(String^ path, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new TripleDES object to generate a random key - // and initialization vector (IV). - { - TripleDES^ tripleDes; - - try - { - tripleDes = TripleDES::Create(); - key = tripleDes->Key; - iv = tripleDes->IV; - } - finally - { - delete tripleDes; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - // The name/path of the file to write. - String^ filename = "CText.enc"; - - // Encrypt the string to a file. - EncryptTextToFile(original, filename, key, iv); - - // Decrypt the file back to a string. - String^ decrypted = DecryptTextFromFile(filename, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv) -{ - FileStream^ fStream = nullptr; - TripleDES^ tripleDes = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create or open the specified file. - fStream = File::Open(path, FileMode::Create); - // Create a new TripleDES object. - tripleDes = TripleDES::Create(); - // Create a TripleDES encryptor from the key and IV - encryptor = tripleDes->CreateEncryptor(key, iv); - // Create a CryptoStream using the FileStream and encryptor - cStream = gcnew CryptoStream(fStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (tripleDes != nullptr) - delete tripleDes; - - if (fStream != nullptr) - delete fStream; - } -} - -String^ DecryptTextFromFile(String^ path, array^ key, array^ iv) -{ - FileStream^ fStream = nullptr; - TripleDES^ tripleDes = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - StreamReader^ reader = nullptr; - - try - { - // Open the specified file - fStream = File::OpenRead(path); - // Create a new TripleDES object. - tripleDes = TripleDES::Create(); - // Create a TripleDES decryptor from the key and IV - decryptor = tripleDes->CreateDecryptor(key, iv); - // Create a CryptoStream using the FileStream and decryptor - cStream = gcnew CryptoStream(fStream, decryptor, CryptoStreamMode::Read); - // Create a StreamReader to turn the bytes back into text - reader = gcnew StreamReader(cStream, Encoding::UTF8); - - // Read back all of the text from the StreamReader, which receives - // the decrypted bytes from the CryptoStream, which receives the - // encrypted bytes from the FileStream. - return reader->ReadToEnd(); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (tripleDes != nullptr) - delete tripleDes; - - if (fStream != nullptr) - delete fStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp deleted file mode 100644 index f1d7dc04657..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new TripleDES object to generate a random key - // and initialization vector (IV). - { - TripleDES^ tripleDes; - - try - { - tripleDes = TripleDES::Create(); - key = tripleDes->Key; - iv = tripleDes->IV; - } - finally - { - delete tripleDes; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - - // Encrypt the string to an in-memory buffer. - array^ encrypted = EncryptTextToMemory(original, key, iv); - - // Decrypt the buffer back to a string. - String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - - try - { - // Create a MemoryStream. - mStream = gcnew MemoryStream; - - TripleDES^ tripleDes = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create a new TripleDES object. - tripleDes = TripleDES::Create(); - // Create a TripleDES encryptor from the key and IV - encryptor = tripleDes->CreateEncryptor(key, iv); - // Create a CryptoStream using the MemoryStream and encryptor - cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - - // Disposing the CryptoStream completes the encryption and flushes the stream. - delete cStream; - - // Get an array of bytes from the MemoryStream that holds the encrypted data. - array^ ret = mStream->ToArray(); - - // Return the encrypted buffer. - return ret; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (tripleDes != nullptr) - delete tripleDes; - } - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (mStream != nullptr) - delete mStream; - } -} - -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - TripleDES^ tripleDes = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create buffer to hold the decrypted data. - // TripleDES-encrypted data will always be slightly bigger than the decrypted data. - array^ decrypted = gcnew array(encrypted->Length); - Int32 offset = 0; - - // Create a new MemoryStream using the provided array of encrypted data. - mStream = gcnew MemoryStream(encrypted); - // Create a new TripleDES object. - tripleDes = TripleDES::Create(); - // Create a TripleDES decryptor from the key and IV - decryptor = tripleDes->CreateDecryptor(key, iv); - // Create a CryptoStream using the MemoryStream and decryptor - cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); - - // Keep reading from the CryptoStream until it finishes (returns 0). - Int32 read = 1; - - while (read > 0) - { - read = cStream->Read(decrypted, offset, decrypted->Length - offset); - offset += read; - } - - // Convert the buffer into a string and return it. - return Encoding::UTF8->GetString(decrypted, 0, offset); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (tripleDes != nullptr) - delete tripleDes; - - if (mStream != nullptr) - delete mStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp deleted file mode 100644 index 3f109c53866..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; - -int main() -{ - - //The following example demonstrates the usage of the AsnEncodedData classes. - // Asn encoded data is read from the extensions of an X509 certificate. - try - { - - // Open the certificate store. - X509Store^ store = gcnew X509Store( L"MY",StoreLocation::CurrentUser ); - store->Open( static_cast(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); - X509Certificate2Collection^ collection = dynamic_cast(store->Certificates); - X509Certificate2Collection^ fcollection = dynamic_cast(collection->Find( X509FindType::FindByTimeValid, DateTime::Now, false )); - - // Select one or more certificates to display extensions information. - X509Certificate2Collection^ scollection = X509Certificate2UI::SelectFromCollection(fcollection, L"Certificate Select",L"Select certificates from the following list to get extension information on that certificate",X509SelectionFlag::MultiSelection); - - // Create a new AsnEncodedDataCollection object. - AsnEncodedDataCollection^ asncoll = gcnew AsnEncodedDataCollection; - for ( int i = 0; i < scollection->Count; i++ ) - { - - // Display certificate information. - Console::ForegroundColor = ConsoleColor::Red; - Console::WriteLine( L"Certificate name: {0}", scollection[i]->GetName() ); - Console::ResetColor(); - - // Display extensions information. - System::Collections::IEnumerator^ myEnum = scollection[i]->Extensions->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - X509Extension^ extension = safe_cast(myEnum->Current); - - // Create an AsnEncodedData object using the extensions information. - AsnEncodedData^ asndata = gcnew AsnEncodedData( extension->Oid,extension->RawData ); - Console::ForegroundColor = ConsoleColor::Green; - Console::WriteLine( L"Extension type: {0}", extension->Oid->FriendlyName ); - Console::WriteLine( L"Oid value: {0}", asndata->Oid->Value ); - Console::WriteLine( L"Raw data length: {0} {1}", asndata->RawData->Length, Environment::NewLine ); - Console::ResetColor(); - Console::WriteLine( asndata->Format(true) ); - Console::WriteLine( Environment::NewLine ); - - // Add the AsnEncodedData object to the AsnEncodedDataCollection object. - asncoll->Add( asndata ); - } - - Console::WriteLine( Environment::NewLine ); - - } - Console::ForegroundColor = ConsoleColor::Red; - Console::WriteLine( L"Number of AsnEncodedData items in the collection: {0} {1}", asncoll->Count, Environment::NewLine ); - Console::ResetColor(); - store->Close(); - - //Create an enumerator for moving through the collection. - AsnEncodedDataEnumerator^ asne = asncoll->GetEnumerator(); - - //You must execute a MoveNext() to get to the first item in the collection. - asne->MoveNext(); - - // Write out AsnEncodedData in the collection. - Console::ForegroundColor = ConsoleColor::Blue; - Console::WriteLine( L"First AsnEncodedData in the collection: {0}", asne->Current->Format(true) ); - Console::ResetColor(); - asne->MoveNext(); - Console::ForegroundColor = ConsoleColor::DarkBlue; - Console::WriteLine( L"Second AsnEncodedData in the collection: {0}", asne->Current->Format(true) ); - Console::ResetColor(); - - //Return index in the collection to the beginning. - asne->Reset(); - } - catch ( CryptographicException^ ) - { - Console::WriteLine( L"Information could not be written out for this certificate." ); - } - - return 1; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp deleted file mode 100644 index e48f4e14aa9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; -using namespace System::Text; - -void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv); -String^ DecryptTextFromFile(String^ path, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new DES object to generate a random key - // and initialization vector (IV). - { - DES^ des; - - try - { - des = DES::Create(); - key = des->Key; - iv = des->IV; - } - finally - { - delete des; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - // The name/path of the file to write. - String^ filename = "CText.enc"; - - // Encrypt the string to a file. - EncryptTextToFile(original, filename, key, iv); - - // Decrypt the file back to a string. - String^ decrypted = DecryptTextFromFile(filename, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv) -{ - FileStream^ fStream = nullptr; - DES^ des = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create or open the specified file. - fStream = File::Open(path, FileMode::Create); - // Create a new DES object. - des = DES::Create(); - // Create a DES encryptor from the key and IV - encryptor = des->CreateEncryptor(key, iv); - // Create a CryptoStream using the FileStream and encryptor - cStream = gcnew CryptoStream(fStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (des != nullptr) - delete des; - - if (fStream != nullptr) - delete fStream; - } -} - -String^ DecryptTextFromFile(String^ path, array^ key, array^ iv) -{ - FileStream^ fStream = nullptr; - DES^ des = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - StreamReader^ reader = nullptr; - - try - { - // Open the specified file - fStream = File::OpenRead(path); - // Create a new DES object. - des = DES::Create(); - // Create a DES decryptor from the key and IV - decryptor = des->CreateDecryptor(key, iv); - // Create a CryptoStream using the FileStream and decryptor - cStream = gcnew CryptoStream(fStream, decryptor, CryptoStreamMode::Read); - // Create a StreamReader to turn the bytes back into text - reader = gcnew StreamReader(cStream, Encoding::UTF8); - - // Read back all of the text from the StreamReader, which receives - // the decrypted bytes from the CryptoStream, which receives the - // encrypted bytes from the FileStream. - return reader->ReadToEnd(); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (des != nullptr) - delete des; - - if (fStream != nullptr) - delete fStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp deleted file mode 100644 index 27a8c01000f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new DES object to generate a random key - // and initialization vector (IV). - { - DES^ des; - - try - { - des = DES::Create(); - key = des->Key; - iv = des->IV; - } - finally - { - delete des; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - - // Encrypt the string to an in-memory buffer. - array^ encrypted = EncryptTextToMemory(original, key, iv); - - // Decrypt the buffer back to a string. - String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - - try - { - // Create a MemoryStream. - mStream = gcnew MemoryStream; - - DES^ des = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create a new DES object. - des = DES::Create(); - // Create a DES encryptor from the key and IV - encryptor = des->CreateEncryptor(key, iv); - // Create a CryptoStream using the MemoryStream and encryptor - cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - - // Disposing the CryptoStream completes the encryption and flushes the stream. - delete cStream; - - // Get an array of bytes from the MemoryStream that holds the encrypted data. - array^ ret = mStream->ToArray(); - - // Return the encrypted buffer. - return ret; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (des != nullptr) - delete des; - } - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (mStream != nullptr) - delete mStream; - } -} - -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - DES^ des = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create buffer to hold the decrypted data. - // DES-encrypted data will always be slightly bigger than the decrypted data. - array^ decrypted = gcnew array(encrypted->Length); - Int32 offset = 0; - - // Create a new MemoryStream using the provided array of encrypted data. - mStream = gcnew MemoryStream(encrypted); - // Create a new DES object. - des = DES::Create(); - // Create a DES decryptor from the key and IV - decryptor = des->CreateDecryptor(key, iv); - // Create a CryptoStream using the MemoryStream and decryptor - cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); - - // Keep reading from the CryptoStream until it finishes (returns 0). - Int32 read = 1; - - while (read > 0) - { - read = cStream->Read(decrypted, offset, decrypted->Length - offset); - offset += read; - } - - // Convert the buffer into a string and return it. - return Encoding::UTF8->GetString(decrypted, 0, offset); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (des != nullptr) - delete des; - - if (mStream != nullptr) - delete mStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp deleted file mode 100644 index 0aeedb91f59..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp +++ /dev/null @@ -1,113 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; -void EncryptTextToFile( String^ Data, String^ FileName, array^Key, array^IV ) -{ - try - { - - // Create or open the specified file. - FileStream^ fStream = File::Open( FileName, FileMode::OpenOrCreate ); - - // Create a CryptoStream using the FileStream - // and the passed key and initialization vector (IV). - CryptoStream^ cStream = gcnew CryptoStream( fStream,(gcnew DESCryptoServiceProvider)->CreateEncryptor( Key, IV ),CryptoStreamMode::Write ); - - // Create a StreamWriter using the CryptoStream. - StreamWriter^ sWriter = gcnew StreamWriter( cStream ); - - // Write the data to the stream - // to encrypt it. - sWriter->WriteLine( Data ); - - // Close the streams and - // close the file. - sWriter->Close(); - cStream->Close(); - fStream->Close(); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); - } - catch ( UnauthorizedAccessException^ e ) - { - Console::WriteLine( "A file error occurred: {0}", e->Message ); - } - -} - -String^ DecryptTextFromFile( String^ FileName, array^Key, array^IV ) -{ - try - { - - // Create or open the specified file. - FileStream^ fStream = File::Open( FileName, FileMode::OpenOrCreate ); - - // Create a CryptoStream using the FileStream - // and the passed key and initialization vector (IV). - CryptoStream^ cStream = gcnew CryptoStream( fStream,(gcnew DESCryptoServiceProvider)->CreateDecryptor( Key, IV ),CryptoStreamMode::Read ); - - // Create a StreamReader using the CryptoStream. - StreamReader^ sReader = gcnew StreamReader( cStream ); - - // Read the data from the stream - // to decrypt it. - String^ val = sReader->ReadLine(); - - // Close the streams and - // close the file. - sReader->Close(); - cStream->Close(); - fStream->Close(); - - // Return the string. - return val; - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); - return nullptr; - } - catch ( UnauthorizedAccessException^ e ) - { - Console::WriteLine( "A file error occurred: {0}", e->Message ); - return nullptr; - } - -} - -int main() -{ - try - { - - // Create a new DESCryptoServiceProvider object - // to generate a key and initialization vector (IV). - DESCryptoServiceProvider^ DESalg = gcnew DESCryptoServiceProvider; - - // Create a string to encrypt. - String^ sData = "Here is some data to encrypt."; - String^ FileName = "CText.txt"; - - // Encrypt text to a file using the file name, key, and IV. - EncryptTextToFile( sData, FileName, DESalg->Key, DESalg->IV ); - - // Decrypt the text from a file using the file name, key, and IV. - String^ Final = DecryptTextFromFile( FileName, DESalg->Key, DESalg->IV ); - - // Display the decrypted string to the console. - Console::WriteLine( Final ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp deleted file mode 100644 index 3fdcdbcd1dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp +++ /dev/null @@ -1,105 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; -array^ EncryptTextToMemory( String^ Data, array^Key, array^IV ) -{ - try - { - - // Create a MemoryStream. - MemoryStream^ mStream = gcnew MemoryStream; - - // Create a CryptoStream using the MemoryStream - // and the passed key and initialization vector (IV). - CryptoStream^ cStream = gcnew CryptoStream( mStream,(gcnew DESCryptoServiceProvider)->CreateEncryptor( Key, IV ),CryptoStreamMode::Write ); - - // Convert the passed string to a byte array. - array^toEncrypt = (gcnew ASCIIEncoding)->GetBytes( Data ); - - // Write the byte array to the crypto stream and flush it. - cStream->Write( toEncrypt, 0, toEncrypt->Length ); - cStream->FlushFinalBlock(); - - // Get an array of bytes from the - // MemoryStream that holds the - // encrypted data. - array^ret = mStream->ToArray(); - - // Close the streams. - cStream->Close(); - mStream->Close(); - - // Return the encrypted buffer. - return ret; - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); - return nullptr; - } - -} - -String^ DecryptTextFromMemory( array^Data, array^Key, array^IV ) -{ - try - { - - // Create a new MemoryStream using the passed - // array of encrypted data. - MemoryStream^ msDecrypt = gcnew MemoryStream( Data ); - - // Create a CryptoStream using the MemoryStream - // and the passed key and initialization vector (IV). - CryptoStream^ csDecrypt = gcnew CryptoStream( msDecrypt,(gcnew DESCryptoServiceProvider)->CreateDecryptor( Key, IV ),CryptoStreamMode::Read ); - - // Create buffer to hold the decrypted data. - array^fromEncrypt = gcnew array(Data->Length); - - // Read the decrypted data out of the crypto stream - // and place it into the temporary buffer. - csDecrypt->Read( fromEncrypt, 0, fromEncrypt->Length ); - - //Convert the buffer into a string and return it. - return (gcnew ASCIIEncoding)->GetString( fromEncrypt ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); - return nullptr; - } - -} - -int main() -{ - try - { - - // Create a new DESCryptoServiceProvider object - // to generate a key and initialization vector (IV). - DESCryptoServiceProvider^ DESalg = gcnew DESCryptoServiceProvider; - - // Create a string to encrypt. - String^ sData = "Here is some data to encrypt."; - - // Encrypt the string to an in-memory buffer. - array^Data = EncryptTextToMemory( sData, DESalg->Key, DESalg->IV ); - - // Decrypt the buffer back to a string. - String^ Final = DecryptTextFromMemory( Data, DESalg->Key, DESalg->IV ); - - // Display the decrypted string to the console. - Console::WriteLine( Final ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp deleted file mode 100644 index 7b3ed1ec455..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Security::Cryptography; - -public ref class DataProtectionSample -{ -private: - - // Create byte array for additional entropy when using Protect method. - static array^s_additionalEntropy = {9,8,7,6,5}; - -public: - static void Main() - { - - // Create a simple byte array containing data to be encrypted. - array^secret = {0,1,2,3,4,1,2,3,4}; - - //Encrypt the data. - array^encryptedSecret = Protect( secret ); - Console::WriteLine( "The encrypted byte array is:" ); - PrintValues( encryptedSecret ); - - // Decrypt the data and store in a byte array. - array^originalData = Unprotect( encryptedSecret ); - Console::WriteLine( "{0}The original data is:", Environment::NewLine ); - PrintValues( originalData ); - } - - static array^ Protect( array^data ) - { - try - { - - // Encrypt the data using DataProtectionScope.CurrentUser. The result can be decrypted - // only by the same current user. - return ProtectedData::Protect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "Data was not encrypted. An error occurred." ); - Console::WriteLine( e ); - return nullptr; - } - } - - static array^ Unprotect( array^data ) - { - try - { - - //Decrypt the data using DataProtectionScope.CurrentUser. - return ProtectedData::Unprotect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "Data was not decrypted. An error occurred." ); - Console::WriteLine( e ); - return nullptr; - } - } - - static void PrintValues( array^myArr ) - { - System::Collections::IEnumerator^ myEnum = myArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte i = safe_cast(myEnum->Current); - Console::Write( "\t{0}", i ); - } - - Console::WriteLine(); - } -}; - -int main() -{ - DataProtectionSample::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp deleted file mode 100644 index 8bd6a68686f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp +++ /dev/null @@ -1,20 +0,0 @@ -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Security::Cryptography; - -int main() -{ - // - // Create a new CspParameters object. - CspParameters^ cspParams = gcnew CspParameters(); - - // Specify an exchange key. - cspParams->KeyNumber = (int) KeyNumber::Exchange; - - // Initialize the RSACryptoServiceProvider - // with the CspParameters object. - RSACryptoServiceProvider^ RSACSP = gcnew RSACryptoServiceProvider(cspParams); - // -}; - diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp deleted file mode 100644 index a3c08414188..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Security::Cryptography; - -int main() -{ - - // Create the original data to be encrypted (The data length should be a multiple of 16). - array^secret = {1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4}; - - // Encrypt the data in memory. The result is stored in the same array as the original data. - ProtectedMemory::Protect( secret, MemoryProtectionScope::SameLogon ); - - // Decrypt the data in memory and store in the original array. - ProtectedMemory::Unprotect( secret, MemoryProtectionScope::SameLogon ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp deleted file mode 100644 index 3189ba48a53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Security::Cryptography; -int main() -{ - - // Assign values to strings. - String^ Value1 = "1.2.840.113549.1.1.1"; - String^ Name1 = "3DES"; - String^ Value2 = "1.3.6.1.4.1.311.20.2"; - String^ InvalidName = "This name is not a valid name"; - String^ InvalidValue = "1.1.1.1.1.1.1.1"; - - // Create new Oid objects using the specified values. - // Note that the corresponding Value or Friendly Name property is automatically added to the object. - Oid ^ o1 = gcnew Oid( Value1 ); - Oid ^ o2 = gcnew Oid( Name1 ); - - // Create a new Oid object using the specified Value and Friendly Name properties. - // Note that the two are not compared to determine if the Value is associated - // with the Friendly Name. - Oid ^ o3 = gcnew Oid( Value2,InvalidName ); - - //Create a new Oid object using the specified Value. Note that if the value - // is invalid or not known, no value is assigned to the Friendly Name property. - Oid ^ o4 = gcnew Oid( InvalidValue ); - - //Write out the property information of the Oid objects. - Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}", o1->FriendlyName, o1->Value ); - Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}", o2->FriendlyName, o2->Value ); - Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName, o3->Value ); - Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName, o4->Value, Environment::NewLine ); - - //Create an Oid collection and add several Oid objects. - OidCollection ^ oc = gcnew OidCollection; - oc->Add( o1 ); - oc->Add( o2 ); - oc->Add( o3 ); - Console::WriteLine( "Number of Oids in the collection: {0}", oc->Count ); - Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized, Environment::NewLine ); - - //Create an enumerator for moving through the collection. - OidEnumerator ^ oe = oc->GetEnumerator(); - - //You must execute a MoveNext() to get to the first item in the collection. - oe->MoveNext(); - - // Write out Oids in the collection. - Console::WriteLine( "First Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value ); - oe->MoveNext(); - Console::WriteLine( "Second Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value ); - - //Return index in the collection to the beginning. - oe->Reset(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp deleted file mode 100644 index 06b5a8483db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; - -// Generates a random salt value of the specified length. -array^ CreateRandomSalt(int length) -{ - // Create a buffer - array^ randomBytes; - - if (length >= 1) - { - randomBytes = gcnew array (length); - } - else - { - randomBytes = gcnew array (1); - } - - // Create a new RandomNumberGenerator. - RandomNumberGenerator^ randomNumberGenerator = - RandomNumberGenerator::Create(); - - // Fill the buffer with random bytes. - randomNumberGenerator->GetBytes(randomBytes); - - // return the bytes. - return randomBytes; -} - -// Clears the bytes in a buffer so they can't later be read from memory. -void ClearBytes(array^ buffer) -{ - // Check arguments. - if (buffer == nullptr) - { - throw gcnew ArgumentNullException("buffer"); - } - - // Set each byte in the buffer to 0. - for (int x = 0; x <= buffer->Length - 1; x++) - { - buffer[x] = 0; - } -} - -int main(array^ args) -{ - - // Get a password from the user. - Console::WriteLine("Enter a password to produce a key:"); - - // Security Note: Never hard-code a password within your - // source code. Hard-coded passwords can be retrieved - // from a compiled assembly. - array^ password = Encoding::Unicode->GetBytes(Console::ReadLine()); - - array^ randomSalt = CreateRandomSalt(7); - - // Create a TripleDESCryptoServiceProvider object. - TripleDESCryptoServiceProvider^ cryptoDESProvider = - gcnew TripleDESCryptoServiceProvider(); - - try - { - Console::WriteLine("Creating a key with PasswordDeriveBytes..."); - - // Create a PasswordDeriveBytes object and then create - // a TripleDES key from the password and salt. - PasswordDeriveBytes^ passwordDeriveBytes = gcnew PasswordDeriveBytes - (password->ToString(), randomSalt); - - // - // Create the key and set it to the Key property - // of the TripleDESCryptoServiceProvider object. - // This example uses the SHA1 algorithm. - // Due to collision problems with SHA1, Microsoft recommends SHA256 or better. - cryptoDESProvider->Key = passwordDeriveBytes->CryptDeriveKey - ("TripleDES", "SHA1", 192, cryptoDESProvider->IV); - // - Console::WriteLine("Operation complete."); - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - } - finally - { - // Clear the buffers - ClearBytes(password); - ClearBytes(randomSalt); - - // Clear the key. - cryptoDESProvider->Clear(); - } - - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp deleted file mode 100644 index c6753a5be6f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; -using namespace System::Text; - -void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv); -String^ DecryptTextFromFile(String^ path, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new RC2 object to generate a random key - // and initialization vector (IV). - { - RC2^ rc2; - - try - { - rc2 = RC2::Create(); - key = rc2->Key; - iv = rc2->IV; - } - finally - { - delete rc2; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - // The name/path of the file to write. - String^ filename = "CText.enc"; - - // Encrypt the string to a file. - EncryptTextToFile(original, filename, key, iv); - - // Decrypt the file back to a string. - String^ decrypted = DecryptTextFromFile(filename, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv) -{ - FileStream^ fStream = nullptr; - RC2^ rc2 = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create or open the specified file. - fStream = File::Open(path, FileMode::Create); - // Create a new RC2 object. - rc2 = RC2::Create(); - // Create an RC2 encryptor from the key and IV - encryptor = rc2->CreateEncryptor(key, iv); - // Create a CryptoStream using the FileStream and encryptor - cStream = gcnew CryptoStream(fStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (rc2 != nullptr) - delete rc2; - - if (fStream != nullptr) - delete fStream; - } -} - -String^ DecryptTextFromFile(String^ path, array^ key, array^ iv) -{ - FileStream^ fStream = nullptr; - RC2^ rc2 = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - StreamReader^ reader = nullptr; - - try - { - // Open the specified file - fStream = File::OpenRead(path); - // Create a new RC2 object. - rc2 = RC2::Create(); - // Create an RC2 decryptor from the key and IV - decryptor = rc2->CreateDecryptor(key, iv); - // Create a CryptoStream using the FileStream and decryptor - cStream = gcnew CryptoStream(fStream, decryptor, CryptoStreamMode::Read); - // Create a StreamReader to turn the bytes back into text - reader = gcnew StreamReader(cStream, Encoding::UTF8); - - // Read back all of the text from the StreamReader, which receives - // the decrypted bytes from the CryptoStream, which receives the - // encrypted bytes from the FileStream. - return reader->ReadToEnd(); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (rc2 != nullptr) - delete rc2; - - if (fStream != nullptr) - delete fStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp deleted file mode 100644 index 3179ea1bfc1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp +++ /dev/null @@ -1,170 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); - -int main() -{ - try - { - array^ key; - array^ iv; - - // Create a new RC2 object to generate a random key - // and initialization vector (IV). - { - RC2^ rc2; - - try - { - rc2 = RC2::Create(); - key = rc2->Key; - iv = rc2->IV; - } - finally - { - delete rc2; - } - } - - // Create a string to encrypt. - String^ original = "Here is some data to encrypt."; - - // Encrypt the string to an in-memory buffer. - array^ encrypted = EncryptTextToMemory(original, key, iv); - - // Decrypt the buffer back to a string. - String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); - - // Display the decrypted string to the console. - Console::WriteLine(decrypted); - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - - try - { - // Create a MemoryStream. - mStream = gcnew MemoryStream; - - RC2^ rc2 = nullptr; - ICryptoTransform^ encryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create a new RC2 object. - rc2 = RC2::Create(); - // Create an RC2 encryptor from the key and IV - encryptor = rc2->CreateEncryptor(key, iv); - // Create a CryptoStream using the MemoryStream and encryptor - cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); - - // Convert the provided string to a byte array. - array^ toEncrypt = Encoding::UTF8->GetBytes(text); - - // Write the byte array to the crypto stream. - cStream->Write(toEncrypt, 0, toEncrypt->Length); - - // Disposing the CryptoStream completes the encryption and flushes the stream. - delete cStream; - - // Get an array of bytes from the MemoryStream that holds the encrypted data. - array^ ret = mStream->ToArray(); - - // Return the encrypted buffer. - return ret; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (encryptor != nullptr) - delete encryptor; - - if (rc2 != nullptr) - delete rc2; - } - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (mStream != nullptr) - delete mStream; - } -} - -String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) -{ - MemoryStream^ mStream = nullptr; - RC2^ rc2 = nullptr; - ICryptoTransform^ decryptor = nullptr; - CryptoStream^ cStream = nullptr; - - try - { - // Create buffer to hold the decrypted data. - // RC2-encrypted data will always be slightly bigger than the decrypted data. - array^ decrypted = gcnew array(encrypted->Length); - Int32 offset = 0; - - // Create a new MemoryStream using the provided array of encrypted data. - mStream = gcnew MemoryStream(encrypted); - // Create a new RC2 object. - rc2 = RC2::Create(); - // Create an RC2 decryptor from the key and IV - decryptor = rc2->CreateDecryptor(key, iv); - // Create a CryptoStream using the MemoryStream and decryptor - cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); - - // Keep reading from the CryptoStream until it finishes (returns 0). - Int32 read = 1; - - while (read > 0) - { - read = cStream->Read(decrypted, offset, decrypted->Length - offset); - offset += read; - } - - // Convert the buffer into a string and return it. - return Encoding::UTF8->GetString(decrypted, 0, offset); - } - catch (CryptographicException^ e) - { - Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); - throw; - } - finally - { - if (cStream != nullptr) - delete cStream; - - if (decryptor != nullptr) - delete decryptor; - - if (rc2 != nullptr) - delete rc2; - - if (mStream != nullptr) - delete mStream; - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp deleted file mode 100644 index 2c8834fcc20..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Security::Cryptography; - -int main() -{ - array ^ originalBytes = - ASCIIEncoding::ASCII->GetBytes("Here is some data."); - - //Create a new RC2CryptoServiceProvider. - RC2CryptoServiceProvider^ rc2Provider = - gcnew RC2CryptoServiceProvider(); - rc2Provider->UseSalt = true; - - rc2Provider->GenerateKey(); - rc2Provider->GenerateIV(); - - //Encrypt the data. - MemoryStream^ encryptionMemoryStream = gcnew MemoryStream(); - CryptoStream^ encryptionCryptoStream = gcnew CryptoStream( - encryptionMemoryStream, rc2Provider->CreateEncryptor( - rc2Provider->Key, rc2Provider->IV), CryptoStreamMode::Write); - - //Write all data to the crypto stream and flush it. - encryptionCryptoStream->Write(originalBytes, 0, originalBytes->Length); - encryptionCryptoStream->FlushFinalBlock(); - - //Get encrypted array of bytes. - array^ encryptedBytes = encryptionMemoryStream->ToArray(); - - //Decrypt the previously encrypted message. - MemoryStream^ decryptionMemoryStream = - gcnew MemoryStream(encryptedBytes); - CryptoStream^ decryptionCryptoStream = - gcnew CryptoStream(decryptionMemoryStream, - rc2Provider->CreateDecryptor(rc2Provider->Key,rc2Provider->IV), - CryptoStreamMode::Read); - - array^ unencryptedBytes = - gcnew array(originalBytes->Length); - - //Read the data out of the crypto stream. - decryptionCryptoStream->Read(unencryptedBytes, 0, - unencryptedBytes->Length); - - //Convert the byte array back into a string. - String^ plainText = ASCIIEncoding::ASCII->GetString(unencryptedBytes); - - //Display the results. - Console::WriteLine("Unencrypted text: {0}", plainText); - - Console::ReadLine(); -} - -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp deleted file mode 100644 index 97053716b78..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -int main() -{ - try - { - - //Create a UnicodeEncoder to convert between byte array and string. - ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; - String^ dataString = "Data to Encrypt"; - - //Create byte arrays to hold original, encrypted, and decrypted data. - array^dataToEncrypt = ByteConverter->GetBytes( dataString ); - array^encryptedData; - array^decryptedData; - - //Create a new instance of the RSACryptoServiceProvider class - // and automatically create a new key-pair. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - - //Display the origianl data to the console. - Console::WriteLine( "Original Data: {0}", dataString ); - - //Encrypt the byte array and specify no OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - encryptedData = RSAalg->Encrypt( dataToEncrypt, false ); - - //Display the encrypted data to the console. - Console::WriteLine( "Encrypted Data: {0}", ByteConverter->GetString( encryptedData ) ); - - //Pass the data to ENCRYPT and boolean flag specifying - //no OAEP padding. - decryptedData = RSAalg->Decrypt( encryptedData, false ); - - //Display the decrypted plaintext to the console. - Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); - } - catch ( CryptographicException^ e ) - { - - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp deleted file mode 100644 index aac2730c2f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp +++ /dev/null @@ -1,81 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -void RSAPersistKeyInCSP( String^ ContainerName ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider to generate - //a new key pair. Pass the CspParameters class to persist the - //key in the container. The PersistKeyInCsp property is true by - //default, allowing the key to be persisted. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Indicate that the key was persisted. - Console::WriteLine( "The RSA key was persisted in the container, \"{0}\".", ContainerName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -void RSADeleteKeyInCSP( String^ ContainerName ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider. - //Pass the CspParameters class to use the - //key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Explicitly set the PersistKeyInCsp property to false - //to delete the key entry in the container. - RSAalg->PersistKeyInCsp = false; - - //Call Clear to release resources and delete the key from the container. - RSAalg->Clear(); - - //Indicate that the key was persisted. - Console::WriteLine( "The RSA key was deleted from the container, \"{0}\".", ContainerName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -int main() -{ - String^ KeyContainerName = "MyKeyContainer"; - - //Create a new key and persist it in - //the key container. - RSAPersistKeyInCSP( KeyContainerName ); - - //Delete the key from the key container. - RSADeleteKeyInCSP( KeyContainerName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp deleted file mode 100644 index cea1dc68672..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -array^ HashAndSignBytes( array^DataToSign, RSAParameters Key, int Index, int Length ) -{ - try - { - - // Create a new instance of RSACryptoServiceProvider using the - // key from RSAParameters. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - RSAalg->ImportParameters( Key ); - - // Hash and sign the data. Pass a new instance of SHA256 - // to specify the hashing algorithm. - return RSAalg->SignData( DataToSign, Index, Length, SHA256::Create() ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -bool VerifySignedHash( array^DataToVerify, array^SignedData, RSAParameters Key ) -{ - try - { - - // Create a new instance of RSACryptoServiceProvider using the - // key from RSAParameters. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - RSAalg->ImportParameters( Key ); - - // Verify the data using the signature. Pass a new instance of SHA256 - // to specify the hashing algorithm. - return RSAalg->VerifyData( DataToVerify, SHA256::Create(), SignedData ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return false; - } - -} - -int main() -{ - try - { - - // Create a UnicodeEncoder to convert between byte array and string. - ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; - String^ dataString = "Data to Sign"; - - // Create byte arrays to hold original, encrypted, and decrypted data. - array^originalData = ByteConverter->GetBytes( dataString ); - array^signedData; - array^smallArray; - - // Create a new instance of the RSACryptoServiceProvider class - // and automatically create a new key-pair. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - - // Export the key information to an RSAParameters object. - // You must pass true to export the private key for signing. - // However, you do not need to export the private key - // for verification. - RSAParameters Key = RSAalg->ExportParameters( true ); - - // Hash and sign the data. Start at the fifth offset - // only use data from the next 7 bytes. - signedData = HashAndSignBytes( originalData, Key, 5, 7 ); - - // The previous method only signed one segment - // of the array. Create a new array for verification - // that only holds the data that was actually signed. - // - // Initialize the array. - smallArray = gcnew array(7); - - // Copy 7 bytes starting at the 5th index to - // the new array. - Array::Copy( originalData, 5, smallArray, 0, 7 ); - - // Verify the data and display the result to the - // console. - if ( VerifySignedHash( smallArray, signedData, Key ) ) - { - Console::WriteLine( "The data was verified." ); - } - else - { - Console::WriteLine( "The data does not match the signature." ); - } - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "The data was not signed or verified" ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp deleted file mode 100644 index aa2a389c449..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -array^ HashAndSignBytes( array^DataToSign, RSAParameters Key ) -{ - try - { - - // Create a new instance of RSACryptoServiceProvider using the - // key from RSAParameters. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - RSAalg->ImportParameters( Key ); - - // Hash and sign the data. Pass a new instance of SHA256 - // to specify the hashing algorithm. - return RSAalg->SignData( DataToSign, SHA256::Create() ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -bool VerifySignedHash( array^DataToVerify, array^SignedData, RSAParameters Key ) -{ - try - { - - // Create a new instance of RSACryptoServiceProvider using the - // key from RSAParameters. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - RSAalg->ImportParameters( Key ); - - // Verify the data using the signature. Pass a new instance of SHA256 - // to specify the hashing algorithm. - return RSAalg->VerifyData( DataToVerify, SHA256::Create(), SignedData ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return false; - } - -} - -int main() -{ - try - { - - // Create a UnicodeEncoder to convert between byte array and string. - ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; - String^ dataString = "Data to Sign"; - - // Create byte arrays to hold original, encrypted, and decrypted data. - array^originalData = ByteConverter->GetBytes( dataString ); - array^signedData; - - // Create a new instance of the RSACryptoServiceProvider class - // and automatically create a new key-pair. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - - // Export the key information to an RSAParameters object. - // You must pass true to export the private key for signing. - // However, you do not need to export the private key - // for verification. - RSAParameters Key = RSAalg->ExportParameters( true ); - - // Hash and sign the data. - signedData = HashAndSignBytes( originalData, Key ); - - // Verify the data and display the result to the - // console. - if ( VerifySignedHash( originalData, signedData, Key ) ) - { - Console::WriteLine( "The data was verified." ); - } - else - { - Console::WriteLine( "The data does not match the signature." ); - } - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "The data was not signed or verified" ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp deleted file mode 100644 index ac322898229..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp +++ /dev/null @@ -1,110 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -using namespace System::IO; -array^ HashAndSignBytes( Stream^ DataStream, RSAParameters Key ) -{ - try - { - - // Reset the current position in the stream to - // the beginning of the stream (0). RSACryptoServiceProvider - // can't verify the data unless the stream position - // is set to the starting position of the data. - DataStream->Position = 0; - - // Create a new instance of RSACryptoServiceProvider using the - // key from RSAParameters. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - RSAalg->ImportParameters( Key ); - - // Hash and sign the data. Pass a new instance of SHA256 - // to specify the hashing algorithm. - return RSAalg->SignData( DataStream, SHA256::Create() ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -bool VerifySignedHash( array^DataToVerify, array^SignedData, RSAParameters Key ) -{ - try - { - - // Create a new instance of RSACryptoServiceProvider using the - // key from RSAParameters. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - RSAalg->ImportParameters( Key ); - - // Verify the data using the signature. Pass a new instance of SHA256 - // to specify the hashing algorithm. - return RSAalg->VerifyData( DataToVerify, SHA256(), SignedData ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return false; - } - -} - -int main() -{ - try - { - ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; - - // Create some bytes to be signed. - array^dataBytes = ByteConverter->GetBytes( "Here is some data to sign!" ); - - // Create a buffer for the memory stream. - array^buffer = gcnew array(dataBytes->Length); - - // Create a MemoryStream. - MemoryStream^ mStream = gcnew MemoryStream( buffer ); - - // Write the bytes to the stream and flush it. - mStream->Write( dataBytes, 0, dataBytes->Length ); - mStream->Flush(); - - // Create a new instance of the RSACryptoServiceProvider class - // and automatically create a new key-pair. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - - // Export the key information to an RSAParameters object. - // You must pass true to export the private key for signing. - // However, you do not need to export the private key - // for verification. - RSAParameters Key = RSAalg->ExportParameters( true ); - - // Hash and sign the data. - array^signedData = HashAndSignBytes( mStream, Key ); - - // Verify the data and display the result to the - // console. - if ( VerifySignedHash( dataBytes, signedData, Key ) ) - { - Console::WriteLine( "The data was verified." ); - } - else - { - Console::WriteLine( "The data does not match the signature." ); - } - - // Close the MemoryStream. - mStream->Close(); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "The data was not signed or verified" ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp deleted file mode 100644 index 68adc843467..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// -using namespace System; -using namespace System::Security::Cryptography; - -ref class RSAKeyStoreSample -{ -public: - static void Main() - { - // Set the static UseMachineKeyStore property to use the machine key - // store instead of the user profile key store. All CSP instances not - // initialized with CspParameters will use this setting. - RSACryptoServiceProvider::UseMachineKeyStore = true; - try - { - RSACryptoServiceProvider^ RSAalg; - - // This CSP instance will use the Machine Store as set above and is - // initialized with no parameters. - RSAalg = gcnew RSACryptoServiceProvider(); - ShowContainerInfo(RSAalg->CspKeyContainerInfo); - RSAalg->PersistKeyInCsp = false; - delete RSAalg; - - CspParameters^ cspParams = gcnew CspParameters(); - - cspParams->KeyContainerName = "MyKeyContainer"; - - // This CSP instance will use the User Store since cspParams are used. - RSAalg = gcnew RSACryptoServiceProvider(cspParams); - ShowContainerInfo(RSAalg->CspKeyContainerInfo); - RSAalg->PersistKeyInCsp = false; - delete RSAalg; - - cspParams->Flags |= CspProviderFlags::UseMachineKeyStore; - - // This CSP instance will use the Machine Store. Although cspParams are used, - // the cspParams.Flags is set to CspProviderFlags.UseMachineKeyStore. - RSAalg = gcnew RSACryptoServiceProvider(cspParams); - ShowContainerInfo(RSAalg->CspKeyContainerInfo); - RSAalg->PersistKeyInCsp = false; - delete RSAalg; - } - catch (CryptographicException^ e) - { - Console::WriteLine("Exception: {0}", e->GetType()->FullName); - Console::WriteLine(e->Message); - } - } - - static void ShowContainerInfo(CspKeyContainerInfo^ containerInfo) - { - String^ keyStore; - - Console::WriteLine(); - if (containerInfo->MachineKeyStore) - { - keyStore = "Machine Store"; - } - else - { - keyStore = "User Store"; - } - Console::WriteLine("Key Store: {0}", keyStore); - Console::WriteLine("Key Provider: {0}", containerInfo->ProviderName); - Console::WriteLine("Key Container: \"{0}\"", containerInfo->KeyContainerName); - Console::WriteLine("Generated: {0}", containerInfo->RandomlyGenerated); - Console::WriteLine("Key Nubmer: {0}", containerInfo->KeyNumber); - Console::WriteLine("Removable Key: {0}", containerInfo->Removable); - } -}; - -int main() -{ - RSAKeyStoreSample::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp deleted file mode 100644 index b99a174d918..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp +++ /dev/null @@ -1,174 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -void RSAPersistKeyInCSP( String^ ContainerName ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider to generate - //a new key pair. Pass the CspParameters class to persist the - //key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Indicate that the key was persisted. - Console::WriteLine( "The RSA key was persisted in the container, \"{0}\".", ContainerName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -void RSADeleteKeyInCSP( String^ ContainerName ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider. - //Pass the CspParameters class to use the - //key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Delete the key entry in the container. - RSAalg->PersistKeyInCsp = false; - - //Call Clear to release resources and delete the key from the container. - RSAalg->Clear(); - - //Indicate that the key was persisted. - Console::WriteLine( "The RSA key was deleted from the container, \"{0}\".", ContainerName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -array^ RSAEncrypt( array^DataToEncrypt, String^ ContainerName, bool DoOAEPPadding ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider. - //Pass the CspParameters class to use the key - //from the key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Encrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - return RSAalg->Encrypt( DataToEncrypt, DoOAEPPadding ); - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -array^ RSADecrypt( array^DataToDecrypt, String^ ContainerName, bool DoOAEPPadding ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider. - //Pass the CspParameters class to use the key - //from the key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Decrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - return RSAalg->Decrypt( DataToDecrypt, DoOAEPPadding ); - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e ); - return nullptr; - } - -} - -int main() -{ - try - { - String^ KeyContainerName = "MyKeyContainer"; - - //Create a new key and persist it in - //the key container. - RSAPersistKeyInCSP( KeyContainerName ); - - //Create a UnicodeEncoder to convert between byte array and string. - UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; - - //Create byte arrays to hold original, encrypted, and decrypted data. - array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); - array^encryptedData; - array^decryptedData; - - //Pass the data to ENCRYPT, the name of the key container, - //and a boolean flag specifying no OAEP padding. - encryptedData = RSAEncrypt( dataToEncrypt, KeyContainerName, false ); - - //Pass the data to DECRYPT, the name of the key container, - //and a boolean flag specifying no OAEP padding. - decryptedData = RSADecrypt( encryptedData, KeyContainerName, false ); - - //Display the decrypted plaintext to the console. - Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); - RSADeleteKeyInCSP( KeyContainerName ); - } - catch ( ArgumentNullException^ ) - { - - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( "Encryption failed." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp deleted file mode 100644 index 19f120af03a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -array^ RSAEncrypt( array^DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) -{ - try - { - - //Create a new instance of RSACryptoServiceProvider. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - - //Import the RSA Key information. This only needs - //toinclude the public key information. - RSAalg->ImportParameters( RSAKeyInfo ); - - //Encrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - return RSAalg->Encrypt( DataToEncrypt, DoOAEPPadding ); - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -array^ RSADecrypt( array^DataToDecrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) -{ - try - { - - //Create a new instance of RSACryptoServiceProvider. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; - - //Import the RSA Key information. This needs - //to include the private key information. - RSAalg->ImportParameters( RSAKeyInfo ); - - //Decrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - return RSAalg->Decrypt( DataToDecrypt, DoOAEPPadding ); - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e ); - return nullptr; - } - -} - -int main() -{ - try - { - - //Create a UnicodeEncoder to convert between byte array and string. - UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; - - //Create byte arrays to hold original, encrypted, and decrypted data. - array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); - array^encryptedData; - array^decryptedData; - - //Create a new instance of RSACryptoServiceProvider to generate - //public and private key data. Pass an integer specifying a key- - //length of 2048. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( 2048 ); - - //Display the key-legth to the console. - Console::WriteLine( "A new key pair of legth {0} was created", RSAalg->KeySize ); - - //Pass the data to ENCRYPT, the public key information - //(using RSACryptoServiceProvider.ExportParameters(false), - //and a boolean flag specifying no OAEP padding. - encryptedData = RSAEncrypt( dataToEncrypt, RSAalg->ExportParameters( false ), false ); - - //Pass the data to DECRYPT, the private key information - //(using RSACryptoServiceProvider.ExportParameters(true), - //and a boolean flag specifying no OAEP padding. - decryptedData = RSADecrypt( encryptedData, RSAalg->ExportParameters( true ), false ); - - //Display the decrypted plaintext to the console. - Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); - } - catch ( ArgumentNullException^ ) - { - - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( "Encryption failed." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp deleted file mode 100644 index f1f072b4665..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp +++ /dev/null @@ -1,175 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -void RSAPersistKeyInCSP( String^ ContainerName ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of RSACryptoServiceProvider to generate - //a new key pair. Pass the CspParameters class to persist the - //key in the container. Pass an intger of 2048 to specify the - //key-size. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( 2048,cspParams ); - - //Indicate that the key was persisted. - Console::WriteLine( "The RSA key with a key-size of {0} was persisted in the container, \"{1}\".", RSAalg->KeySize, ContainerName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -void RSADeleteKeyInCSP( String^ ContainerName ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of DSACryptoServiceProvider. - //Pass the CspParameters class to use the - //key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Delete the key entry in the container. - RSAalg->PersistKeyInCsp = false; - - //Call Clear to release resources and delete the key from the container. - RSAalg->Clear(); - - //Indicate that the key was persisted. - Console::WriteLine( "The RSA key was deleted from the container, \"{0}\".", ContainerName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -array^ RSAEncrypt( array^DataToEncrypt, String^ ContainerName, bool DoOAEPPadding ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of DSACryptoServiceProvider. - //Pass the CspParameters class to use the key - //from the key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Encrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - return RSAalg->Encrypt( DataToEncrypt, DoOAEPPadding ); - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -array^ RSADecrypt( array^DataToDecrypt, String^ ContainerName, bool DoOAEPPadding ) -{ - try - { - - // Create a new instance of CspParameters. Pass - // 13 to specify a DSA container or 1 to specify - // an RSA container. The default is 1. - CspParameters^ cspParams = gcnew CspParameters; - - // Specify the container name using the passed variable. - cspParams->KeyContainerName = ContainerName; - - //Create a new instance of DSACryptoServiceProvider. - //Pass the CspParameters class to use the key - //from the key in the container. - RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); - - //Decrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - return RSAalg->Decrypt( DataToDecrypt, DoOAEPPadding ); - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e ); - return nullptr; - } - -} - -int main() -{ - try - { - String^ KeyContainerName = "MyKeyContainer"; - - //Create a new key and persist it in - //the key container. - RSAPersistKeyInCSP( KeyContainerName ); - - //Create a UnicodeEncoder to convert between byte array and string. - UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; - - //Create byte arrays to hold original, encrypted, and decrypted data. - array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); - array^encryptedData; - array^decryptedData; - - //Pass the data to ENCRYPT, the name of the key container, - //and a boolean flag specifying no OAEP padding. - encryptedData = RSAEncrypt( dataToEncrypt, KeyContainerName, false ); - - //Pass the data to DECRYPT, the name of the key container, - //and a boolean flag specifying no OAEP padding. - decryptedData = RSADecrypt( encryptedData, KeyContainerName, false ); - - //Display the decrypted plaintext to the console. - Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); - RSADeleteKeyInCSP( KeyContainerName ); - } - catch ( ArgumentNullException^ ) - { - - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( "Encryption failed." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp deleted file mode 100644 index 87f5955ad65..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -int main() -{ - RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider; - try - { - - // Note: In cases where a random key is generated, - // a key container is not created until you call - // a method that uses the key. This example calls - // the Encrypt method before calling the - // CspKeyContainerInfo property so that a key - // container is created. - // Create some data to encrypt and display it. - String^ data = L"Here is some data to encrypt."; - Console::WriteLine( L"Data to encrypt: {0}", data ); - - // Convert the data to an array of bytes and - // encrypt it. - array^byteData = Encoding::ASCII->GetBytes( data ); - array^encData = rsa->Encrypt( byteData, false ); - - // Display the encrypted value. - Console::WriteLine( L"Encrypted Data: {0}", Encoding::ASCII->GetString( encData ) ); - Console::WriteLine(); - Console::WriteLine( L"CspKeyContainerInfo information:" ); - Console::WriteLine(); - - // Create a new CspKeyContainerInfo object. - CspKeyContainerInfo^ keyInfo = rsa->CspKeyContainerInfo; - - // Display the value of each property. - Console::WriteLine( L"Accessible property: {0}", keyInfo->Accessible ); - Console::WriteLine( L"Exportable property: {0}", keyInfo->Exportable ); - Console::WriteLine( L"HardwareDevice property: {0}", keyInfo->HardwareDevice ); - Console::WriteLine( L"KeyContainerName property: {0}", keyInfo->KeyContainerName ); - Console::WriteLine( L"KeyNumber property: {0}", keyInfo->KeyNumber ); - Console::WriteLine( L"MachineKeyStore property: {0}", keyInfo->MachineKeyStore ); - Console::WriteLine( L"Protected property: {0}", keyInfo->Protected ); - Console::WriteLine( L"ProviderName property: {0}", keyInfo->ProviderName ); - Console::WriteLine( L"ProviderType property: {0}", keyInfo->ProviderType ); - Console::WriteLine( L"RandomlyGenerated property: {0}", keyInfo->RandomlyGenerated ); - Console::WriteLine( L"Removable property: {0}", keyInfo->Removable ); - Console::WriteLine( L"UniqueKeyContainerName property: {0}", keyInfo->UniqueKeyContainerName ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - finally - { - - // Clear the key. - rsa->Clear(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp deleted file mode 100644 index ab2873ba3a4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography; -int main() -{ - - // To idendify the Smart Card CryptoGraphic Providers on your - // computer, use the Microsoft Registry Editor (Regedit.exe). - // The available Smart Card CryptoGraphic Providers are listed - // in HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider. - // Create a new CspParameters object that identifies a - // Smart Card CryptoGraphic Provider. - // The 1st parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider Types. - // The 2nd parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider. - CspParameters^ csp = gcnew CspParameters( 1,L"Schlumberger Cryptographic Service Provider" ); - csp->Flags = CspProviderFlags::UseDefaultKeyContainer; - - // Initialize an RSACryptoServiceProvider object using - // the CspParameters object. - RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( csp ); - - // Create some data to sign. - array^data = gcnew array{ - 0,1,2,3,4,5,6,7 - }; - Console::WriteLine( L"Data : {0}", BitConverter::ToString( data ) ); - - // Sign the data using the Smart Card CryptoGraphic Provider. - array^sig = rsa->SignData( data, L"SHA256" ); - Console::WriteLine( L"Signature : {0}", BitConverter::ToString( sig ) ); - - // Verify the data using the Smart Card CryptoGraphic Provider. - bool verified = rsa->VerifyData( data, L"SHA256", sig ); - Console::WriteLine( L"Verified : {0}", verified ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp deleted file mode 100644 index 99639f7a588..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = L"test.pfx"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = gcnew X509Certificate( Certificate ); - array^certData = cert->Export( X509ContentType::Cert ); - X509Certificate^ newCert = gcnew X509Certificate( certData ); - - // Get the value. - String^ resultsTrue = newCert->ToString( true ); - - // Display the value to the console. - Console::WriteLine( resultsTrue ); - - // Get the value. - String^ resultsFalse = newCert->ToString( false ); - - // Display the value to the console. - Console::WriteLine( resultsFalse ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp deleted file mode 100644 index c67a8cb4a04..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = L"Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = gcnew X509Certificate; - cert->Import(Certificate); - - // Get the value. - String^ resultsTrue = cert->ToString( true ); - - // Display the value to the console. - Console::WriteLine( resultsTrue ); - - // Get the value. - String^ resultsFalse = cert->ToString( false ); - - // Display the value to the console. - Console::WriteLine( resultsFalse ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp deleted file mode 100644 index d2dab6fe3be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = L"Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = gcnew X509Certificate( Certificate ); - - // Get the value. - String^ resultsTrue = cert->ToString( true ); - - // Display the value to the console. - Console::WriteLine( resultsTrue ); - - // Get the value. - String^ resultsFalse = cert->ToString( false ); - - // Display the value to the console. - Console::WriteLine( resultsFalse ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp deleted file mode 100644 index 574abf906a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - try - { - X509Store^ store = gcnew X509Store( L"MY",StoreLocation::CurrentUser ); - store->Open( static_cast(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); - X509Certificate2Collection^ collection = dynamic_cast(store->Certificates); - for ( int i = 0; i < collection->Count; i++ ) - { - System::Collections::IEnumerator^ myEnum = collection[ i ]->Extensions->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - X509Extension^ extension = safe_cast(myEnum->Current); - Console::WriteLine( L"{0}({1})", extension->Oid->FriendlyName, extension->Oid->Value ); - if ( extension->Oid->FriendlyName == L"Key Usage" ) - { - X509KeyUsageExtension^ ext = dynamic_cast(extension); - Console::WriteLine( ext->KeyUsages ); - } - if ( extension->Oid->FriendlyName == L"Basic Constraints" ) - { - X509BasicConstraintsExtension^ ext = dynamic_cast(extension); - Console::WriteLine( ext->CertificateAuthority ); - Console::WriteLine( ext->HasPathLengthConstraint ); - Console::WriteLine( ext->PathLengthConstraint ); - } - if ( extension->Oid->FriendlyName == L"Subject Key Identifier" ) - { - X509SubjectKeyIdentifierExtension^ ext = dynamic_cast(extension); - Console::WriteLine( ext->SubjectKeyIdentifier ); - } - if ( extension->Oid->FriendlyName == L"Enhanced Key Usage" ) - { - X509EnhancedKeyUsageExtension^ ext = dynamic_cast(extension); - OidCollection^ oids = ext->EnhancedKeyUsages; - System::Collections::IEnumerator^ myEnum1 = oids->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Oid^ oid = safe_cast(myEnum1->Current); - Console::WriteLine( L"{0}({1})", oid->FriendlyName, oid->Value ); - } - } - } - - } - store->Close(); - } - catch ( CryptographicException^ ) - { - Console::WriteLine( L"Information could not be written out for this certificate." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp deleted file mode 100644 index c7f4f074317..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp +++ /dev/null @@ -1,207 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; - -ref class TrippleDESDocumentEncryption -{ -protected: - XmlDocument^ docValue; - TripleDES^ algValue; - -public: - TrippleDESDocumentEncryption( XmlDocument^ Doc, TripleDES^ Key ) - { - if ( Doc != nullptr ) - { - docValue = Doc; - } - else - { - throw gcnew ArgumentNullException( L"Doc" ); - } - - if ( Key != nullptr ) - { - algValue = Key; - } - else - { - throw gcnew ArgumentNullException( L"Key" ); - } - } - - - property XmlDocument^ Doc - { - XmlDocument^ get() - { - return docValue; - } - - void set( XmlDocument^ value ) - { - docValue = value; - } - - } - - property TripleDES^ Alg - { - TripleDES^ get() - { - return algValue; - } - - void set( TripleDES^ value ) - { - algValue = value; - } - - } - void Clear() - { - if ( algValue != nullptr ) - { - algValue->Clear(); - } - else - { - throw gcnew Exception( L"No TripleDES key was found to clear." ); - } - } - - void Encrypt( String^ Element ) - { - - // Find the element by name and create a new - // XmlElement object. - XmlElement^ inputElement = dynamic_cast(docValue->GetElementsByTagName( Element )->Item( 0 )); - - // If the element was not found, throw an exception. - if ( inputElement == nullptr ) - { - throw gcnew Exception( L"The element was not found." ); - } - - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml( docValue ); - - // Encrypt the element using the symmetric key. - array^rgbOutput = exml->EncryptData( inputElement, algValue, false ); - - // Create an EncryptedData object and populate it. - EncryptedData^ ed = gcnew EncryptedData; - - // Specify the namespace URI for XML encryption elements. - ed->Type = EncryptedXml::XmlEncElementUrl; - - // Specify the namespace URI for the TrippleDES algorithm. - ed->EncryptionMethod = gcnew EncryptionMethod( EncryptedXml::XmlEncTripleDESUrl ); - - // Create a CipherData element. - ed->CipherData = gcnew CipherData; - - // Set the CipherData element to the value of the encrypted XML element. - ed->CipherData->CipherValue = rgbOutput; - - // Replace the plaintext XML elemnt with an EncryptedData element. - EncryptedXml::ReplaceElement( inputElement, ed, false ); - } - - void Decrypt() - { - - // XmlElement object. - XmlElement^ encryptedElement = dynamic_cast(docValue->GetElementsByTagName( L"EncryptedData" )->Item( 0 )); - - // If the EncryptedData element was not found, throw an exception. - if ( encryptedElement == nullptr ) - { - throw gcnew Exception( L"The EncryptedData element was not found." ); - } - - - // Create an EncryptedData object and populate it. - EncryptedData^ ed = gcnew EncryptedData; - ed->LoadXml( encryptedElement ); - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml; - - // Decrypt the element using the symmetric key. - array^rgbOutput = exml->DecryptData( ed, algValue ); - - // Replace the encryptedData element with the plaintext XML elemnt. - exml->ReplaceData( encryptedElement, rgbOutput ); - } - -}; - -int main() -{ - - // Create an XmlDocument object. - XmlDocument^ xmlDoc = gcnew XmlDocument; - - // Load an XML file into the XmlDocument object. - try - { - xmlDoc->PreserveWhitespace = true; - xmlDoc->Load( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - return 0; - } - - - // Create a new TripleDES key. - TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; - - // Create a new instance of the TrippleDESDocumentEncryption object - // defined in this sample. - TrippleDESDocumentEncryption^ xmlTDES = gcnew TrippleDESDocumentEncryption( xmlDoc,tDESkey ); - try - { - - // Encrypt the "creditcard" element. - xmlTDES->Encrypt( L"creditcard" ); - - // Display the encrypted XML to the console. - Console::WriteLine( L"Encrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlTDES->Doc->OuterXml ); - - // Decrypt the "creditcard" element. - xmlTDES->Decrypt(); - - // Display the encrypted XML to the console. - Console::WriteLine(); - Console::WriteLine( L"Decrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlTDES->Doc->OuterXml ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear the TripleDES key. - xmlTDES->Clear(); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp deleted file mode 100644 index c1e61870173..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp +++ /dev/null @@ -1,178 +0,0 @@ - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. -static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, array^ElementsToSign ) -{ - - // Check the arguments. - if ( FileName == nullptr ) - throw gcnew ArgumentNullException( L"FileName" ); - - if ( SignedFileName == nullptr ) - throw gcnew ArgumentNullException( L"SignedFileName" ); - - if ( Key == nullptr ) - throw gcnew ArgumentNullException( L"Key" ); - - if ( ElementsToSign == nullptr ) - throw gcnew ArgumentNullException( L"ElementsToSign" ); - - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Loop through each passed element to sign - // and create a reference. - System::Collections::IEnumerator^ myEnum = ElementsToSign->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ s = safe_cast(myEnum->Current); - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = s; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - } - - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( dynamic_cast(doc->FirstChild) ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -static Boolean VerifyXmlFile( String^ Name ) -{ - - // Check the arguments. - if ( Name == nullptr ) - throw gcnew ArgumentNullException( L"Name" ); - - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - -int main() -{ - - // Generate a signing key. - RSA^ Key = RSA::Create(); - try - { - - // Specify an element to sign. - array^elements = {L"#tag1"}; - - // Sign an XML file and save the signature to a - // new file. - SignXmlFile( L"Test.xml", L"SignedExample.xml", Key, elements ); - Console::WriteLine( L"XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( L"Verifying signature..." ); - bool result = VerifyXmlFile( L"SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( L"The XML signature is valid." ); - } - else - { - Console::WriteLine( L"The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear resources associated with the - // RSA instance. - Key->Clear(); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp deleted file mode 100644 index cdae3dcaebf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp +++ /dev/null @@ -1,169 +0,0 @@ - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. -static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) -{ - - // Check the arguments. - if ( FileName == nullptr ) - throw gcnew ArgumentNullException( L"FileName" ); - - if ( SignedFileName == nullptr ) - throw gcnew ArgumentNullException( L"SignedFileName" ); - - if ( Key == nullptr ) - throw gcnew ArgumentNullException( L"Key" ); - - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Get the signature object from the SignedXml object. - Signature^ XMLSignature = signedXml->Signature; - - // Create a reference to be signed. Pass "" - // to specify that all of the current XML - // document should be signed. - Reference^ reference = gcnew Reference( L"" ); - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the Reference object to the Signature object. - XMLSignature->SignedInfo->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); - - // Add the KeyInfo object to the Reference object. - XMLSignature->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( dynamic_cast(doc->FirstChild) ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -static Boolean VerifyXmlFile( String^ Name ) -{ - - // Check the arguments. - if ( Name == nullptr ) - throw gcnew ArgumentNullException( L"Name" ); - - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - -int main() -{ - - // Generate a signing key. - RSA^ Key = RSA::Create(); - try - { - - // Sign an XML file and save the signature to a - // new file. - SignXmlFile( L"Test.xml", L"SignedExample.xml", Key ); - Console::WriteLine( L"XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( L"Verifying signature..." ); - bool result = VerifyXmlFile( L"SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( L"The XML signature is valid." ); - } - else - { - Console::WriteLine( L"The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear resources associated with the - // RSA instance. - Key->Clear(); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp deleted file mode 100644 index 97cfce97aee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp +++ /dev/null @@ -1,179 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, RSA^ Alg, String^ KeyName ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( ElementToEncrypt == nullptr ) - throw gcnew ArgumentNullException( L"ElementToEncrypt" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - - //////////////////////////////////////////////// - // Find the specified element in the XmlDocument - // object and create a new XmlElemnt object. - //////////////////////////////////////////////// - XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); - - // Throw an XmlException if the element was not found. - if ( elementToEncrypt == nullptr ) - { - throw gcnew XmlException( L"The specified element was not found" ); - } - - - ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the - // a new random symmetric key. - ////////////////////////////////////////////////// - // Create a 256 bit Aes key. - Aes^ sessionKey = Aes::Create(); - sessionKey->KeySize = 256; - EncryptedXml^ eXml = gcnew EncryptedXml; - array^encryptedElement = eXml->EncryptData( elementToEncrypt, sessionKey, false ); - - //////////////////////////////////////////////// - // Construct an EncryptedData object and populate - // it with the desired encryption information. - //////////////////////////////////////////////// - EncryptedData^ edElement = gcnew EncryptedData; - edElement->Type = EncryptedXml::XmlEncElementUrl; - - // Create an EncryptionMethod element so that the - // receiver knows which algorithm to use for decryption. - edElement->EncryptionMethod = gcnew EncryptionMethod( EncryptedXml::XmlEncAES256Url ); - - // Encrypt the session key and add it to an EncryptedKey element. - EncryptedKey^ ek = gcnew EncryptedKey; - array^encryptedKey = EncryptedXml::EncryptKey( sessionKey->Key, Alg, false ); - ek->CipherData = gcnew CipherData( encryptedKey ); - ek->EncryptionMethod = gcnew EncryptionMethod( EncryptedXml::XmlEncRSA15Url ); - - // Set the KeyInfo element to specify the - // name of the RSA key. - // Create a new KeyInfo element. - edElement->KeyInfo = gcnew KeyInfo; - - // Create a new KeyInfoName element. - KeyInfoName^ kin = gcnew KeyInfoName; - - // Specify a name for the key. - kin->Value = KeyName; - - // Add the KeyInfoName element to the - // EncryptedKey object. - ek->KeyInfo->AddClause( kin ); - - // Add the encrypted key to the - // EncryptedData object. - edElement->KeyInfo->AddClause( gcnew KeyInfoEncryptedKey( ek ) ); - - // Add the encrypted element data to the - // EncryptedData object. - edElement->CipherData->CipherValue = encryptedElement; - - //////////////////////////////////////////////////// - // Replace the element from the original XmlDocument - // object with the EncryptedData element. - //////////////////////////////////////////////////// - EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); -} - -static void Decrypt( XmlDocument^ Doc, RSA^ Alg, String^ KeyName ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - if ( KeyName == nullptr ) - throw gcnew ArgumentNullException( L"KeyName" ); - - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml( Doc ); - - // Add a key-name mapping. - // This method can only decrypt documents - // that present the specified key name. - exml->AddKeyNameMapping( KeyName, Alg ); - - // Decrypt the element. - exml->DecryptDocument(); -} - -int main() -{ - - // Create an XmlDocument object. - XmlDocument^ xmlDoc = gcnew XmlDocument; - - // Load an XML file into the XmlDocument object. - try - { - xmlDoc->PreserveWhitespace = true; - xmlDoc->Load( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - return 0; - } - - - // Create a new RSA key. This key will encrypt a symmetric key, - // which will then be imbedded in the XML document. - RSA^ rsaKey = RSA::Create(); - try - { - - // Encrypt the "creditcard" element. - Encrypt( xmlDoc, L"creditcard", rsaKey, L"rsaKey" ); - - // Display the encrypted XML to the console. - Console::WriteLine( L"Encrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - xmlDoc->Save( L"test.xml" ); - - // Decrypt the "creditcard" element. - Decrypt( xmlDoc, rsaKey, L"rsaKey" ); - - // Display the encrypted XML to the console. - Console::WriteLine(); - Console::WriteLine( L"Decrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - xmlDoc->Save( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear the RSA key. - rsaKey->Clear(); - } - - return 1; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp deleted file mode 100644 index 3856ce1b7b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp +++ /dev/null @@ -1,200 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, SymmetricAlgorithm^ Alg, String^ KeyName ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( ElementToEncrypt == nullptr ) - throw gcnew ArgumentNullException( L"ElementToEncrypt" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - - //////////////////////////////////////////////// - // Find the specified element in the XmlDocument - // object and create a new XmlElemnt object. - //////////////////////////////////////////////// - XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); - - // Throw an XmlException if the element was not found. - if ( elementToEncrypt == nullptr ) - { - throw gcnew XmlException( L"The specified element was not found" ); - } - - - ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the - // symmetric key. - ////////////////////////////////////////////////// - EncryptedXml^ eXml = gcnew EncryptedXml; - array^encryptedElement = eXml->EncryptData( elementToEncrypt, Alg, false ); - - //////////////////////////////////////////////// - // Construct an EncryptedData object and populate - // it with the desired encryption information. - //////////////////////////////////////////////// - EncryptedData^ edElement = gcnew EncryptedData; - edElement->Type = EncryptedXml::XmlEncElementUrl; - - // Create an EncryptionMethod element so that the - // receiver knows which algorithm to use for decryption. - // Determine what kind of algorithm is being used and - // supply the appropriate URL to the EncryptionMethod element. - String^ encryptionMethod = nullptr; - if ( dynamic_cast(Alg) ) - { - encryptionMethod = EncryptedXml::XmlEncTripleDESUrl; - } - else - if ( dynamic_cast(Alg) ) - { - encryptionMethod = EncryptedXml::XmlEncDESUrl; - } - else - if ( dynamic_cast(Alg) ) - { - switch ( Alg->KeySize ) - { - case 128: - encryptionMethod = EncryptedXml::XmlEncAES128Url; - break; - - case 192: - encryptionMethod = EncryptedXml::XmlEncAES192Url; - break; - - case 256: - encryptionMethod = EncryptedXml::XmlEncAES256Url; - break; - } - } - else - { - - // Throw an exception if the transform is not in the previous categories - throw gcnew CryptographicException( L"The specified algorithm is not supported for XML Encryption." ); - } - - - - edElement->EncryptionMethod = gcnew EncryptionMethod( encryptionMethod ); - - // Set the KeyInfo element to specify the - // name of a key. - // Create a new KeyInfo element. - edElement->KeyInfo = gcnew KeyInfo; - - // Create a new KeyInfoName element. - KeyInfoName^ kin = gcnew KeyInfoName; - - // Specify a name for the key. - kin->Value = KeyName; - - // Add the KeyInfoName element. - edElement->KeyInfo->AddClause( kin ); - - // Add the encrypted element data to the - // EncryptedData object. - edElement->CipherData->CipherValue = encryptedElement; - - //////////////////////////////////////////////////// - // Replace the element from the original XmlDocument - // object with the EncryptedData element. - //////////////////////////////////////////////////// - EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); -} - -static void Decrypt( XmlDocument^ Doc, SymmetricAlgorithm^ Alg, String^ KeyName ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - if ( KeyName == nullptr ) - throw gcnew ArgumentNullException( L"KeyName" ); - - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml( Doc ); - - // Add a key-name mapping. - // This method can only decrypt documents - // that present the specified key name. - exml->AddKeyNameMapping( KeyName, Alg ); - - // Decrypt the element. - exml->DecryptDocument(); -} - -int main() -{ - - // Create an XmlDocument object. - XmlDocument^ xmlDoc = gcnew XmlDocument; - - // Load an XML file into the XmlDocument object. - try - { - xmlDoc->PreserveWhitespace = true; - xmlDoc->Load( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - return 0; - } - - - // Create a new TripleDES key. - TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; - try - { - - // Encrypt the "creditcard" element. - Encrypt( xmlDoc, L"creditcard", tDESkey, L"tDESKey" ); - - // Display the encrypted XML to the console. - Console::WriteLine( L"Encrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - - // Decrypt the "creditcard" element. - Decrypt( xmlDoc, tDESkey, L"tDESKey" ); - - // Display the encrypted XML to the console. - Console::WriteLine(); - Console::WriteLine( L"Decrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear the TripleDES key. - tDESkey->Clear(); - } - return 1; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp deleted file mode 100644 index 0ed4e81288a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp +++ /dev/null @@ -1,133 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Security::Cryptography::X509Certificates; -static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, X509Certificate2^ Cert ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( ElementToEncrypt == nullptr ) - throw gcnew ArgumentNullException( L"ElementToEncrypt" ); - - if ( Cert == nullptr ) - throw gcnew ArgumentNullException( L"Cert" ); - - - //////////////////////////////////////////////// - // Find the specified element in the XmlDocument - // object and create a new XmlElemnt object. - //////////////////////////////////////////////// - XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); - - // Throw an XmlException if the element was not found. - if ( elementToEncrypt == nullptr ) - { - throw gcnew XmlException( L"The specified element was not found" ); - } - - - ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the - // X.509 Certificate. - ////////////////////////////////////////////////// - EncryptedXml^ eXml = gcnew EncryptedXml; - - // Encrypt the element. - EncryptedData^ edElement = eXml->Encrypt( elementToEncrypt, Cert ); - - //////////////////////////////////////////////////// - // Replace the element from the original XmlDocument - // object with the EncryptedData element. - //////////////////////////////////////////////////// - EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); -} - -static void Decrypt( XmlDocument^ Doc ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml( Doc ); - - // Decrypt the XML document. - exml->DecryptDocument(); -} - -int main() -{ - - // Create an XmlDocument object. - XmlDocument^ xmlDoc = gcnew XmlDocument; - - // Load an XML file into the XmlDocument object. - try - { - xmlDoc->PreserveWhitespace = true; - xmlDoc->Load( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - return 0; - } - - - // Create a new X509Certificate2 object by loading - // an X.509 certificate file. To use XML encryption - // with an X.509 certificate, use an X509Certificate2 - // object to encrypt, but use a certificate in a certificate - // store to decrypt. - // You can create a new test certificate file using the - // makecert.exe tool. - // Create an X509Certificate2 object for encryption. - X509Certificate2^ cert = gcnew X509Certificate2( L"test.pfx" ); - - // Put the certificate in certificate store for decryption. - X509Store^ store = gcnew X509Store( StoreLocation::CurrentUser ); - store->Open( OpenFlags::ReadWrite ); - store->Add( cert ); - store->Close(); - try - { - - // Encrypt the "creditcard" element. - Encrypt( xmlDoc, L"creditcard", cert ); - - // Display the encrypted XML to the console. - Console::WriteLine( L"Encrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - - // Decrypt the "creditcard" element. - Decrypt( xmlDoc ); - - // Display the encrypted XML to the console. - Console::WriteLine(); - Console::WriteLine( L"Decrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp deleted file mode 100644 index c8b0ef17967..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp +++ /dev/null @@ -1,135 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, SymmetricAlgorithm^ Alg, String^ KeyName ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( ElementToEncrypt == nullptr ) - throw gcnew ArgumentNullException( L"ElementToEncrypt" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - - //////////////////////////////////////////////// - // Find the specified element in the XmlDocument - // object and create a new XmlElemnt object. - //////////////////////////////////////////////// - XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); - - // Throw an XmlException if the element was not found. - if ( elementToEncrypt == nullptr ) - { - throw gcnew XmlException( L"The specified element was not found" ); - } - - - ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the - // symmetric key. - ////////////////////////////////////////////////// - EncryptedXml^ eXml = gcnew EncryptedXml; - - // Add the key mapping. - eXml->AddKeyNameMapping( KeyName, Alg ); - - // Encrypt the element. - EncryptedData^ edElement = eXml->Encrypt( elementToEncrypt, KeyName ); - - //////////////////////////////////////////////////// - // Replace the element from the original XmlDocument - // object with the EncryptedData element. - //////////////////////////////////////////////////// - EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); -} - -static void Decrypt( XmlDocument^ Doc, SymmetricAlgorithm^ Alg, String^ KeyName ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - if ( KeyName == nullptr ) - throw gcnew ArgumentNullException( L"KeyName" ); - - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml( Doc ); - - // Add the key name mapping. - exml->AddKeyNameMapping( KeyName, Alg ); - - // Decrypt the XML document. - exml->DecryptDocument(); -} - -int main() -{ - - // Create an XmlDocument object. - XmlDocument^ xmlDoc = gcnew XmlDocument; - - // Load an XML file into the XmlDocument object. - try - { - xmlDoc->PreserveWhitespace = true; - xmlDoc->Load( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - - - // Create a new TripleDES key. - TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; - try - { - - // Encrypt the "creditcard" element. - Encrypt( xmlDoc, L"creditcard", tDESkey, L"tDesKey" ); - - // Display the encrypted XML to the console. - Console::WriteLine( L"Encrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - - // Decrypt the "creditcard" element. - Decrypt( xmlDoc, tDESkey, L"tDesKey" ); - - // Display the encrypted XML to the console. - Console::WriteLine(); - Console::WriteLine( L"Decrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear the TripleDES key. - tDESkey->Clear(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp deleted file mode 100644 index ae795778f31..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp +++ /dev/null @@ -1,196 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, SymmetricAlgorithm^ Alg ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( ElementToEncrypt == nullptr ) - throw gcnew ArgumentNullException( L"ElementToEncrypt" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - - //////////////////////////////////////////////// - // Find the specified element in the XmlDocument - // object and create a new XmlElemnt object. - //////////////////////////////////////////////// - XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); - - // Throw an XmlException if the element was not found. - if ( elementToEncrypt == nullptr ) - { - throw gcnew XmlException( L"The specified element was not found" ); - } - - - ////////////////////////////////////////////////// - // Create a new instance of the EncryptedXml class - // and use it to encrypt the XmlElement with the - // symmetric key. - ////////////////////////////////////////////////// - EncryptedXml^ eXml = gcnew EncryptedXml; - array^encryptedElement = eXml->EncryptData( elementToEncrypt, Alg, false ); - - //////////////////////////////////////////////// - // Construct an EncryptedData object and populate - // it with the desired encryption information. - //////////////////////////////////////////////// - EncryptedData^ edElement = gcnew EncryptedData; - edElement->Type = EncryptedXml::XmlEncElementUrl; - - // Create an EncryptionMethod element so that the - // receiver knows which algorithm to use for decryption. - // Determine what kind of algorithm is being used and - // supply the appropriate URL to the EncryptionMethod element. - String^ encryptionMethod = nullptr; - if ( dynamic_cast(Alg) ) - { - encryptionMethod = EncryptedXml::XmlEncTripleDESUrl; - } - else - if ( dynamic_cast(Alg) ) - { - encryptionMethod = EncryptedXml::XmlEncDESUrl; - } - else - if ( dynamic_cast(Alg) ) - { - switch ( Alg->KeySize ) - { - case 128: - encryptionMethod = EncryptedXml::XmlEncAES128Url; - break; - - case 192: - encryptionMethod = EncryptedXml::XmlEncAES192Url; - break; - - case 256: - encryptionMethod = EncryptedXml::XmlEncAES256Url; - break; - } - } - else - { - - // Throw an exception if the transform is not in the previous categories - throw gcnew CryptographicException( L"The specified algorithm is not supported for XML Encryption." ); - } - - - - edElement->EncryptionMethod = gcnew EncryptionMethod( encryptionMethod ); - - // Add the encrypted element data to the - // EncryptedData object. - edElement->CipherData->CipherValue = encryptedElement; - - //////////////////////////////////////////////////// - // Replace the element from the original XmlDocument - // object with the EncryptedData element. - //////////////////////////////////////////////////// - EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); -} - -static void Decrypt( XmlDocument^ Doc, SymmetricAlgorithm^ Alg ) -{ - - // Check the arguments. - if ( Doc == nullptr ) - throw gcnew ArgumentNullException( L"Doc" ); - - if ( Alg == nullptr ) - throw gcnew ArgumentNullException( L"Alg" ); - - - // Find the EncryptedData element in the XmlDocument. - XmlElement^ encryptedElement = dynamic_cast(Doc->GetElementsByTagName( L"EncryptedData" )->Item( 0 )); - - // If the EncryptedData element was not found, throw an exception. - if ( encryptedElement == nullptr ) - { - throw gcnew XmlException( L"The EncryptedData element was not found." ); - } - - - // Create an EncryptedData object and populate it. - EncryptedData^ edElement = gcnew EncryptedData; - edElement->LoadXml( encryptedElement ); - - // Create a new EncryptedXml object. - EncryptedXml^ exml = gcnew EncryptedXml; - - // Decrypt the element using the symmetric key. - array^rgbOutput = exml->DecryptData( edElement, Alg ); - - // Replace the encryptedData element with the plaintext XML element. - exml->ReplaceData( encryptedElement, rgbOutput ); -} - -int main() -{ - - // Create an XmlDocument object. - XmlDocument^ xmlDoc = gcnew XmlDocument; - - // Load an XML file into the XmlDocument object. - try - { - xmlDoc->PreserveWhitespace = true; - xmlDoc->Load( L"test.xml" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - return 0; - } - - - // Create a new TripleDES key. - TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; - try - { - - // Encrypt the "creditcard" element. - Encrypt( xmlDoc, L"creditcard", tDESkey ); - - // Display the encrypted XML to the console. - Console::WriteLine( L"Encrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - - // Decrypt the "creditcard" element. - Decrypt( xmlDoc, tDESkey ); - - // Display the encrypted XML to the console. - Console::WriteLine(); - Console::WriteLine( L"Decrypted XML:" ); - Console::WriteLine(); - Console::WriteLine( xmlDoc->OuterXml ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - - // Clear the TripleDES key. - tDESkey->Clear(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp deleted file mode 100644 index 2d4df6a368d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp +++ /dev/null @@ -1,181 +0,0 @@ - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. -static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Specify a canonicalization method. - signedXml->SignedInfo->CanonicalizationMethod = SignedXml::XmlDsigExcC14NTransformUrl; - - // Set the InclusiveNamespacesPrefixList property. - XmlDsigExcC14NTransform^ canMethod = dynamic_cast(signedXml->SignedInfo->CanonicalizationMethodObject); - canMethod->InclusiveNamespacesPrefixList = L"Sign"; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = L""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( dynamic_cast(doc->FirstChild) ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -static Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// Create example data to sign. -static void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); - - // Append the node to the document. - document->AppendChild( node ); - - // Create a new XmlNode object. - XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"TempElement", L"Sign" ); - - // Add some text to the node. - subnode->InnerText = L"Here is some data to sign."; - - // Append the node to the document. - document->DocumentElement->AppendChild( subnode ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( L"Example.xml" ); - Console::WriteLine( L"New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( L"Example.xml", L"SignedExample.xml", Key ); - Console::WriteLine( L"XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( L"Verifying signature..." ); - bool result = VerifyXmlFile( L"SignedExample.xml" ); - - // Display the results of the signature verification to \ - // the console. - if ( result ) - { - Console::WriteLine( L"The XML signature is valid." ); - } - else - { - Console::WriteLine( L"The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp deleted file mode 100644 index ce578aa7c43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp +++ /dev/null @@ -1,178 +0,0 @@ - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. -static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Specify a canonicalization method. - signedXml->SignedInfo->CanonicalizationMethod = SignedXml::XmlDsigExcC14NWithCommentsTransformUrl; - - // Set the InclusiveNamespacesPrefixList property. - XmlDsigExcC14NWithCommentsTransform^ canMethod = dynamic_cast(signedXml->SignedInfo->CanonicalizationMethodObject); - canMethod->InclusiveNamespacesPrefixList = L"Sign"; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = L""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( dynamic_cast(doc->FirstChild) ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -static Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// Create example data to sign. -static void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); - - // Append the node to the document. - document->AppendChild( node ); - - // Create a new XmlNode object. - XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"TempElement", L"Sign" ); - - // Add some text to the node. - subnode->InnerText = L"Here is some data to sign."; - - // Append the node to the document. - document->DocumentElement->AppendChild( subnode ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Create an XML file to sign. - CreateSomeXml( L"Example.xml" ); - Console::WriteLine( L"New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - //SignXmlFile("Example.xml", "SignedExample.xml", Key); - Console::WriteLine( L"XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( L"Verifying signature..." ); - bool result = VerifyXmlFile( L"SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( L"The XML signature is valid." ); - } - else - { - Console::WriteLine( L"The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp deleted file mode 100644 index 6edd984e6b9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp +++ /dev/null @@ -1,202 +0,0 @@ - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Create the XML that represents the transform. -static XmlDsigXPathTransform^ CreateXPathTransform( String^ XPathString ) -{ - - // Create a new XMLDocument object. - XmlDocument^ doc = gcnew XmlDocument; - - // Create a new XmlElement. - XmlElement^ xPathElem = doc->CreateElement( L"XPath" ); - - // Set the element text to the value - // of the XPath string. - xPathElem->InnerText = XPathString; - - // Create a new XmlDsigXPathTransform object. - XmlDsigXPathTransform^ xForm = gcnew XmlDsigXPathTransform; - - // Load the XPath XML from the element. - xForm->LoadInnerXml( xPathElem->SelectNodes( L"." ) ); - - // Return the XML that represents the transform. - return xForm; -} - - -// Sign an XML file and save the signature in a new file. -static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, String^ XPathString ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = L""; - - // Create an XmlDsigXPathTransform object using - // the helper method 'CreateXPathTransform' defined - // later in this sample. - XmlDsigXPathTransform^ XPathTransform = CreateXPathTransform( XPathString ); - - // Add the transform to the reference. - reference->AddTransform( XPathTransform ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -static Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// Create example data to sign. -static void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); - - // Append the node to the document. - document->AppendChild( node ); - - // Create a new XmlNode object. - XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"TempElement", L"Sign" ); - - // Add some text to the node. - subnode->InnerText = L"Here is some data to sign."; - - // Append the node to the document. - document->DocumentElement->AppendChild( subnode ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - - // Generate a signing key. - RSA^ Key = RSA::Create(); - try - { - - // Create an XML file to sign. - CreateSomeXml( L"Example.xml" ); - Console::WriteLine( L"New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( L"Example.xml", L"SignedExample.xml", Key, L"ancestor-or-self::TempElement" ); - Console::WriteLine( L"XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( L"Verifying signature..." ); - bool result = VerifyXmlFile( L"SignedExample.xml" ); - - // Display the results of the signature verification to \ - // the console. - if ( result ) - { - Console::WriteLine( L"The XML signature is valid." ); - } - else - { - Console::WriteLine( L"The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - Key->Clear(); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp deleted file mode 100644 index 6693cd9c0f6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp +++ /dev/null @@ -1,193 +0,0 @@ - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Create the XML that represents the transform. -static XmlDsigXsltTransform^ CreateXsltTransform( String^ xsl ) -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( xsl ); - XmlDsigXsltTransform^ xform = gcnew XmlDsigXsltTransform; - xform->LoadInnerXml( doc->ChildNodes ); - return xform; -} - - -// Sign an XML file and save the signature in a new file. -static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, String^ XSLString ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = L""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Create an XmlDsigXPathTransform object using - // the helper method 'CreateXPathTransform' defined - // later in this sample. - XmlDsigXsltTransform^ XsltTransform = CreateXsltTransform( XSLString ); - - // Add the transform to the reference. - reference->AddTransform( XsltTransform ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -static Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// Create example data to sign. -static void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); - - // Append the node to the document. - document->AppendChild( node ); - - // Create a new XmlNode object. - XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"ElementToTransform", L"Sign" ); - - // Add some text to the node. - subnode->InnerText = L"Here is some data to sign."; - - // Append the node to the document. - document->DocumentElement->AppendChild( subnode ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - - // Generate a signing key. - RSA^ Key = RSA::Create(); - String^ xsl = L"\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n "; - try - { - - // Create an XML file to sign. - CreateSomeXml( L"Example.xml" ); - Console::WriteLine( L"New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( L"Example.xml", L"SignedExample.xml", Key, xsl ); - Console::WriteLine( L"XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( L"Verifying signature..." ); - bool result = VerifyXmlFile( L"SignedExample.xml" ); - - // Display the results of the signature verification to \ - // the console. - if ( result ) - { - Console::WriteLine( L"The XML signature is valid." ); - } - else - { - Console::WriteLine( L"The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - Key->Clear(); - } - - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp deleted file mode 100644 index 4477c20eac3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -#using -#using -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; - -// -void CheckSignatureWithEncryptedGrant( - String^ fileName, IRelDecryptor^ decryptor) -{ - // Create a new XML document. - XmlDocument^ sourceDocument = gcnew XmlDocument(); - XmlNamespaceManager^ namespaceManager = - gcnew XmlNamespaceManager(sourceDocument->NameTable); - - // Format using white spaces. - sourceDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - sourceDocument->Load(fileName); - namespaceManager->AddNamespace("dsig", - SignedXml::XmlDsigNamespaceUrl); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = - sourceDocument->SelectNodes("//dsig:Signature", namespaceManager); - - for (int i = 0, count = nodeList->Count; i < count; i++) - { - XmlDocument^ clone = (XmlDocument^) sourceDocument->Clone(); - XmlNodeList^ signatures = - clone->SelectNodes("//dsig:Signature", namespaceManager); - - // Create a new SignedXml object and pass into it the - // XML document clone. - SignedXml^ signedDocument = gcnew SignedXml(clone); - - // Load the signature node. - signedDocument->LoadXml((XmlElement^)signatures[i]); - - // Set the context for license transform - Transform^ licenseTransform = ((Reference^)signedDocument-> - SignedInfo->References[0])->TransformChain[0]; - - if ((licenseTransform::typeid == XmlLicenseTransform::typeid) - && (decryptor != nullptr)) - { - // Decryptor is used to decrypt encryptedGrant - // elements. - ((XmlLicenseTransform^) licenseTransform)->Decryptor = decryptor; - } - - // Check the signature and display the result. - if (signedDocument->CheckSignature()) - { - Console::WriteLine("SUCCESS: " + - "CheckSignatureWithEncryptedGrant - issuer index #" + i); - } - else - { - Console::WriteLine("FAILURE: " + - "CheckSignatureWithEncryptedGrant - issuer index #" + i); - } - } -} -// - -int main() -{ -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp deleted file mode 100644 index e5ffc2a58d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// CurrencyDecimalDigits property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a negative value with the default number of decimal digits (2). - Int64 myInt = -1234; - Console::WriteLine( myInt.ToString( "C", nfi ) ); - - // Displays the same value with four decimal digits. - nfi->CurrencyDecimalDigits = 4; - Console::WriteLine( myInt.ToString( "C", nfi ) ); -} - -/* -This code produces the following output. - -($1, 234.00) -($1, 234.0000) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp deleted file mode 100644 index 9620c7b2591..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// CurrencyDecimalSeparator property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S"."). - Int64 myInt = 123456789; - Console::WriteLine( myInt.ToString( "C", nfi ) ); - - // Displays the same value with a blank as the separator. - nfi->CurrencyDecimalSeparator = " "; - Console::WriteLine( myInt.ToString( "C", nfi ) ); -} - -/* -This code produces the following output. - -$123, 456, 789.00 -$123, 456, 789 00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp deleted file mode 100644 index 0421ff605f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// CurrencyGroupSeparator property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S", "). - Int64 myInt = 123456789; - Console::WriteLine( myInt.ToString( "C", nfi ) ); - - // Displays the same value with a blank as the separator. - nfi->CurrencyGroupSeparator = " "; - Console::WriteLine( myInt.ToString( "C", nfi ) ); -} - -/* -This code produces the following output. - -$123, 456, 789.00 -$123 456 789.00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp deleted file mode 100644 index a06da3edcbf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// CurrencyGroupSizes property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S"."). - Int64 myInt = 123456789012345; - Console::WriteLine( myInt.ToString( "C", nfi ) ); - - // Displays the same value with different groupings. - array^mySizes1 = {2,3,4}; - array^mySizes2 = {2,3,0}; - nfi->CurrencyGroupSizes = mySizes1; - Console::WriteLine( myInt.ToString( "C", nfi ) ); - nfi->CurrencyGroupSizes = mySizes2; - Console::WriteLine( myInt.ToString( "C", nfi ) ); -} - -/* -This code produces the following output. - -$123, 456, 789, 012, 345.00 -$12, 3456, 7890, 123, 45.00 -$1234567890, 123, 45.00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp deleted file mode 100644 index 95a1012b1d2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; -using namespace System::Collections::ObjectModel; - -// An enumeration used by the ExampleAttribute class. -public enum class ExampleKind -{ - FirstKind, SecondKind, ThirdKind, FourthKind -}; - -// An example attribute. The attribute can be applied to all -// targets, from assemblies to parameters. -// -[AttributeUsage(AttributeTargets::All)] -public ref class ExampleAttribute: public Attribute -{ -private: - // Data for properties. - ExampleKind kindValue; - String^ noteValue; - array^ arrayStrings; - array^ arrayNumbers; - - // Constructors. - void ExampleAttributeInitialize( ExampleKind initKind, array^ initStrings ) - { - kindValue = initKind; - arrayStrings = initStrings; - } -public: - ExampleAttribute() - { - ExampleAttributeInitialize( ExampleKind::FirstKind, nullptr ); - } - ExampleAttribute( ExampleKind initKind ) - { - ExampleAttributeInitialize( initKind, nullptr ); - } - ExampleAttribute( ExampleKind initKind, array^ initStrings ) - { - ExampleAttributeInitialize( initKind, initStrings ); - } - - // Properties. The Note and Numbers properties must be read/write, so they - // can be used as named parameters. - // - property ExampleKind Kind - { - ExampleKind get() - { - return kindValue; - } - } - property array^ Strings - { - array^ get() - { - return arrayStrings; - } - } - property String^ Note - { - String^ get() - { - return noteValue; - } - - void set( String^ value ) - { - noteValue = value; - } - } - property array^ Numbers - { - array^ get() - { - return arrayNumbers; - } - - void set( array^ value ) - { - arrayNumbers = value; - } - } -}; - -// The example attribute is applied to the assembly. -[assembly:Example(ExampleKind::ThirdKind,Note="This is a note on the assembly.")]; - -// The example attribute is applied to the test class. -// -[Example(ExampleKind::SecondKind, - gcnew array { "String array argument, line 1", - "String array argument, line 2", - "String array argument, line 3" }, - Note="This is a note on the class.", - Numbers = gcnew array { 53, 57, 59 })] -public ref class Test -{ -public: - // The example attribute is applied to a method, using the - // parameterless constructor and supplying a named argument. - // The attribute is also applied to the method parameter. - // - [Example(Note="This is a note on a method.")] - void TestMethod( [Example] Object^ arg ){} - - // Main() gets objects representing the assembly, the test - // type, the test method, and the method parameter. Custom - // attribute data is displayed for each of these. - // - static void Main() - { - Assembly^ assembly = Assembly::ReflectionOnlyLoad( "Source" ); - Type^ t = assembly->GetType( "Test" ); - MethodInfo^ m = t->GetMethod( "TestMethod" ); - array^p = m->GetParameters(); - - Console::WriteLine( "\r\nAttributes for assembly: '{0}'", assembly ); - ShowAttributeData( CustomAttributeData::GetCustomAttributes( assembly ) ); - Console::WriteLine( "\r\nAttributes for type: '{0}'", t ); - ShowAttributeData( CustomAttributeData::GetCustomAttributes( t ) ); - Console::WriteLine( "\r\nAttributes for member: '{0}'", m ); - ShowAttributeData( CustomAttributeData::GetCustomAttributes( m ) ); - Console::WriteLine( "\r\nAttributes for parameter: '{0}'", p ); - ShowAttributeData( CustomAttributeData::GetCustomAttributes( p[ 0 ] ) ); - } - -private: - static void ShowValueOrArray(CustomAttributeTypedArgument^ cata) - { - if (cata->Value->GetType() == ReadOnlyCollection::typeid) - { - Console::WriteLine(" Array of '{0}':", cata->ArgumentType); - - for each (CustomAttributeTypedArgument^ cataElement in - (ReadOnlyCollection^) cata->Value) - { - Console::WriteLine(" Type: '{0}' Value: '{1}'", - cataElement->ArgumentType, cataElement->Value); - } - } - else - { - Console::WriteLine( " Type: '{0}' Value: '{1}'", - cata->ArgumentType, cata->Value ); - } - } - - static void ShowAttributeData( IList< CustomAttributeData^ >^ attributes ) - { - for each ( CustomAttributeData^ cad in attributes ) - { - Console::WriteLine( " {0}", cad ); - Console::WriteLine( " Constructor: '{0}'", cad->Constructor ); - - Console::WriteLine( " Constructor arguments:" ); - for each ( CustomAttributeTypedArgument^ cata in cad->ConstructorArguments ) - { - ShowValueOrArray(cata); - } - - Console::WriteLine( " Named arguments:" ); - for each ( CustomAttributeNamedArgument cana in cad->NamedArguments ) - { - Console::WriteLine( " MemberInfo: '{0}'", cana.MemberInfo ); - ShowValueOrArray(cana.TypedValue); - } - } - } -}; - -int main() -{ - Test::Main(); -} - -/* This code example produces output similar to the following: - -Attributes for assembly: 'source, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' - [System.Runtime.CompilerServices.CompilationRelaxationsAttribute((Int32)8)] - Constructor: 'Void .ctor(Int32)' - Constructor arguments: - Type: 'System.Int32' Value: '8' - Named arguments: - [System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows = True)] - Constructor: 'Void .ctor()' - Constructor arguments: - Named arguments: - MemberInfo: 'Boolean WrapNonExceptionThrows' - Type: 'System.Boolean' Value: 'True' - [ExampleAttribute((ExampleKind)2, Note = "This is a note on the assembly.")] - Constructor: 'Void .ctor(ExampleKind)' - Constructor arguments: - Type: 'ExampleKind' Value: '2' - Named arguments: - MemberInfo: 'System.String Note' - Type: 'System.String' Value: 'This is a note on the assembly.' - -Attributes for type: 'Test' - [ExampleAttribute((ExampleKind)1, new String[3] { "String array argument, line 1", "String array argument, line 2", "String array argument, line 3" }, Note = "This is a note on the class.", Numbers = new Int32[3] { 53, 57, 59 })] - Constructor: 'Void .ctor(ExampleKind, System.String[])' - Constructor arguments: - Type: 'ExampleKind' Value: '1' - Array of 'System.String[]': - Type: 'System.String' Value: 'String array argument, line 1' - Type: 'System.String' Value: 'String array argument, line 2' - Type: 'System.String' Value: 'String array argument, line 3' - Named arguments: - MemberInfo: 'System.String Note' - Type: 'System.String' Value: 'This is a note on the class.' - MemberInfo: 'Int32[] Numbers' - Array of 'System.Int32[]': - Type: 'System.Int32' Value: '53' - Type: 'System.Int32' Value: '57' - Type: 'System.Int32' Value: '59' - -Attributes for member: 'Void TestMethod(System.Object)' - [ExampleAttribute(Note = "This is a note on a method.")] - Constructor: 'Void .ctor()' - Constructor arguments: - Named arguments: - MemberInfo: 'System.String Note' - Type: 'System.String' Value: 'This is a note on a method.' - -Attributes for parameter: 'System.Object arg' - [ExampleAttribute()] - Constructor: 'Void .ctor()' - Constructor arguments: - Named arguments: -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp b/snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp deleted file mode 100644 index 1bb36cb458d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp +++ /dev/null @@ -1,328 +0,0 @@ -// System.Web.UI.DataBinding.Expression -// System.Web.UI.DataBindingCollection.Remove(string) -// System.Web.UI.DataBindingCollection.Item -// System.Web.UI.DataBinding.DataBinding -// System.Web.UI.DataBinding.Expression -// System.Web.UI.DataBindingCollection.SyncRoot -// System.Web.UI.DataBindingCollection.Add(DataBinding) -// System.Web.UI.DataBindingCollection.DataBindingCollection -// System.Web.UI.DataBindingCollection.RemovedBindings -// System.Web.UI.DataBindingCollection.GetEnumerator -// System.Web.UI.DataBinding.PropertyName -// System.Web.UI.DataBinding.PropertyType -// System.Web.UI.DataBindingCollection.Count -// System.Web.UI.DataBindingCollection.IsReadOnly -// System.Web.UI.DataBindingCollection.IsSynchronized -// System.Web.UI.DataBindingCollection.CopyTo -// System.Web.UI.DataBindingCollection.GetHashCode -// System.Web.UI.DataBindingCollection.Remove(DataBinding) -// System.Web.UI.DataBindingCollection.Remove(string,true) -// System.Web.UI.DataBindingCollection.Clear() -// System.Web.UI.DataBindingHandlerAttribute -// System.Web.UI.DataBindingHandlerAttribute.IsDefaultAttribute(). -/*The following example demonstrates the members of 'DataBinding' and -' 'DataBindingCollection'. A new control 'SimpleWebControl' is created -and a 'Designer' attribute is attached to it which actually refers to the -DesignTimeClass. The 'OnBindingsCollectionChanged(string)' method is overridden -to actually capture the DataBindingCollection instance and add the -DataBinding Expression to the property in the ASPX file. When 'Text' property of the -SimpleWebControl is bound to the 'Text' property of 'Button1' at the DesignTime -using the IDE, the 'OnBindingCollectionChanged' method is called and -the 'Text' property of the 'SimpleWebControl' is updated in .aspx file. -The actual DataBinding is done at the runtime. The properties of the 'DataBinding' -and 'DataBindingCollection' are written into a text file (DataBindingOutput.txt) -in drive C. The Output is written at the design time itself. - -Note:This program has to be tested at "DesignTime". -These are the instructions to be followed to successfully test the functionality of the program. -1) Create a new "C# WebApplication" project. -2) Add Reference "System.Design.dll" to the project. -3) Add the 'DataBinding.aspx' and 'WebCustomControl1.cs' files to the project, -which are provided with this example. -4) In the 'DataBinding.aspx' file, make the assembly name same as the -"Project Name", created in step1. -5)Build the project. -6)Go to the "DesignTab" of the 'DataBinding.aspx' file. -7)Go to the properties window of the SimpleWebcontrol, built in Step5. -8)Go to the DataBindings column. -9)Select the "Text" property. -10)Select the "CustomBindingExpression" option. -11)Associate the Text property to any property of any control which is of the -type string. -12)Observe in "C:\" a file created with the name "DataBindingOutput.txt". -This file contains the properties of 'DataBinding' and 'DataBindingCollection' -classes demonstrated. -*/ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::WebControls; -using namespace System::ComponentModel; -using namespace System::Web::UI::Design; -using namespace System::IO; -using namespace System::Text; -using namespace System::Collections; - -namespace DataBindingTest -{ - public ref class SimpleDesigner: public System::Web::UI::Design::ControlDesigner - { - public: - - property String^ Text - { - - // The DesigneTime manipulation is done by this class. - String^ get() - { - // - DataBinding^ myBinding = DataBindings[ "Text" ]; - if ( myBinding != nullptr ) - { - return myBinding->Expression; - } - - return String::Empty; - // - } - - void set( String^ value ) - { - // - if ( (value == nullptr) || (value->Length == 0) ) - { - DataBindings->Remove( "Text" ); - } - // - else - { - // - DataBinding^ binding = DataBindings[ "Text" ]; - // - - // - if ( binding == nullptr ) - { - binding = gcnew DataBinding( "Text",String::typeid,value ); - } - // - // - else - { - binding->Expression = value; - } - // - // - // - DataBinding^ binding1 = dynamic_cast(DataBindings->SyncRoot); - DataBindings->Add( binding ); - DataBindings->Add( binding1 ); - - // - // - } - - OnBindingsCollectionChanged( "Text" ); - } - } - - protected: - virtual void OnBindingsCollectionChanged( String^ propName ) override - { - // This method actually forms an DataBindingExpression of the design time and associates it to the Property of the Control. - IHtmlControlDesignerBehavior^ myHtmlControlDesignBehavior = Behavior; - DataBindingCollection^ myDataBindingCollection; - DataBinding^ myDataBinding1; - DataBinding^ myDataBinding2; - String^ myStringReplace1; - String^ myDataBindingExpression1; - String^ removedBinding; - String^ removedBindingAfterReplace; - String^ myDataBindingExpression2; - String^ myStringReplace2; - array^removedBindings1; - array^removedBindings2; - Int32 temp; - IEnumerator^ myEnumerator; - if ( myHtmlControlDesignBehavior == nullptr ) - return; - - // - DataBindingCollection^ myDataBindingCollection1 = gcnew DataBindingCollection; - myDataBindingCollection1 = myDataBindingCollection = DataBindings; - // - if ( propName != nullptr ) - { - myDataBinding1 = myDataBindingCollection[ propName ]; - myStringReplace1 = propName->Replace( ".", "-" ); - if ( myDataBinding1 == nullptr ) - { - myHtmlControlDesignBehavior->RemoveAttribute( myStringReplace1, true ); - return; - } - - // DataBinding is not null. - myDataBindingExpression1 = String::Concat( "<%#", myDataBinding1->Expression, "%>" ); - myHtmlControlDesignBehavior->SetAttribute( myStringReplace1, myDataBindingExpression1, true ); - int index = myStringReplace1->IndexOf( "-" ); - } - else - { - // - removedBindings2 = removedBindings1 = DataBindings->RemovedBindings; - // - - temp = 0; - while ( removedBindings2->Length > temp ) - { - removedBinding = removedBindings2[ temp ]; - removedBindingAfterReplace = removedBinding->Replace( '.', '-' ); - myHtmlControlDesignBehavior->RemoveAttribute( removedBindingAfterReplace, true ); - temp = temp + 1; - } - myDataBindingCollection = DataBindings; - myEnumerator = myDataBindingCollection->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - { - // - // - myDataBinding2 = dynamic_cast(myEnumerator->Current); - String^ dataBindingOutput1; - String^ dataBindingOutput2; - String^ dataBindingOutput3; - dataBindingOutput1 = String::Concat( "The property name is ", myDataBinding2->PropertyName ); - dataBindingOutput2 = String::Concat( "The property type is ", myDataBinding2->PropertyType->ToString(), "-", dataBindingOutput1 ); - dataBindingOutput3 = String::Concat( "The expression is ", myDataBinding2->Expression, "-", dataBindingOutput2 ); - WriteToFile( dataBindingOutput3 ); - // - // - - myDataBindingExpression2 = String::Concat( "<%#", myDataBinding2->Expression, "%>" ); - myStringReplace2 = myDataBinding2->PropertyName->Replace( ".", "-" ); - myHtmlControlDesignBehavior->SetAttribute( myStringReplace2, myDataBindingExpression2, true ); - int index = myStringReplace2->IndexOf( '-' ); - } - // - // - // - String^ dataBindingOutput4; - String^ dataBindingOutput5; - String^ dataBindingOutput6; - String^ dataBindingOutput7; - String^ dataBindingOutput8; - dataBindingOutput4 = String::Concat( "The Count of the collection is ", myDataBindingCollection1->Count ); - dataBindingOutput5 = String::Concat( "The IsSynchronised property of the collection is ", myDataBindingCollection1->IsSynchronized, "-", dataBindingOutput4 ); - dataBindingOutput6 = String::Concat( "The IsReadOnly property of the collection is ", myDataBindingCollection1->IsReadOnly, "-", dataBindingOutput5 ); - WriteToFile( dataBindingOutput6 ); - - // - // - // - // - System::Array^ dataBindingCollectionArray = Array::CreateInstance( Object::typeid, myDataBindingCollection1->Count ); - myDataBindingCollection1->CopyTo( dataBindingCollectionArray, 0 ); - dataBindingOutput7 = String::Concat( "The count of DataBindingArray is ", dataBindingCollectionArray->Length ); - WriteToFile( dataBindingOutput7 ); - - // - IEnumerator^ myEnumerator1 = myDataBindingCollection1->GetEnumerator(); - if ( myEnumerator1->MoveNext() ) - { - // - myDataBinding1 = dynamic_cast(myEnumerator1->Current); - dataBindingOutput8 = String::Concat( "The HashCode is", myDataBinding1->GetHashCode().ToString() ); - WriteToFile( dataBindingOutput8 ); - - // - myDataBindingCollection1->Remove( myDataBinding1 ); - dataBindingOutput8 = String::Concat( "The Count of the collection after DataBinding is removed is ", myDataBindingCollection1->Count ); - WriteToFile( dataBindingOutput8 ); - // - // - } - else - { - myDataBinding1 = dynamic_cast(myEnumerator1->Current); - - // - myDataBindingCollection1->Remove( "Text", true ); - dataBindingOutput8 = String::Concat( "The Count of the collection after DataBinding is removed is ", myDataBindingCollection1->Count ); - WriteToFile( dataBindingOutput8 ); - // - - // - myDataBindingCollection1->Clear(); - dataBindingOutput8 = String::Concat( "The Count of the collection after clear method is called ", myDataBindingCollection1->Count ); - WriteToFile( dataBindingOutput8 ); - // - } - } - } - - public: - void WriteToFile( String^ input ) - { - // This method writes the values of the properties at the design time into a Text file DataBindingOutput.txt in the "C" of the system. - StreamWriter^ myFile = File::AppendText( "C:\\DataBindingOutput.txt" ); - ASCIIEncoding^ encoder = gcnew ASCIIEncoding; - array^ByteArray = encoder->GetBytes( input ); - array^CharArray = encoder->GetChars( ByteArray ); - myFile->WriteLine( CharArray, 0, input->Length ); - myFile->Close(); - } - }; - // - [DefaultProperty("Text"), - ToolboxData("<{0}:Simple runat=server>"), - Designer("DataBindingTest.SimpleDesigner"), - DataBindingHandlerAttribute(System::Web::UI::Design::TextDataBindingHandler::typeid) - ] - // - public ref class SimpleWebControl: public WebControl - { - private: - - //A control derived from 'System.Web.UI.WebControl' class with single property 'Text'. - String^ _Text; - - public: - property String^ Text - { - - [Bindable(true)] - String^ get() - { - return _Text; - } - - void set( String^ value ) - { - _Text = value; - } - } - - protected: - // - virtual void Render( HtmlTextWriter^ output ) override - { - output->Write( "
This is the Text of SimpleWebControl : {0}", _Text ); - IEnumerator^ myEnum = SimpleWebControl::typeid->GetCustomAttributes( true )->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ attribute = safe_cast(myEnum->Current); - if ( dynamic_cast(attribute) ) - { - DataBindingHandlerAttribute^ myDataBindingHandlerAttribute = dynamic_cast(attribute); - output->Write( "


The IsDefaultAttribute of DataBindingHandlerAttribute is :{0}", myDataBindingHandlerAttribute->IsDefaultAttribute() ); - output->Write( "


DataBinding HandlerTypeName:{0}", myDataBindingHandlerAttribute->HandlerTypeName ); - } - } - } - //
- }; -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp deleted file mode 100644 index e1bc418aedf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp +++ /dev/null @@ -1,30 +0,0 @@ -using namespace System; - -int main() -{ - // Addition operator - // - System::DateTime dTime( 1980, 8, 5 ); - - // tSpan is 17 days, 4 hours, 2 minutes and 1 second. - System::TimeSpan tSpan( 17, 4, 2, 1 ); - - // Result gets 8/22/1980 4:02:01 AM. - System::DateTime result = dTime + tSpan; - // - - System::Console::WriteLine( result ); - - // Equality operator. - // - System::DateTime april19( 2001, 4, 19 ); - System::DateTime otherDate( 1991, 6, 5 ); - - // areEqual gets false. - bool areEqual = april19 == otherDate; - - otherDate = DateTime( 2001, 4, 19 ); - // areEqual gets true. - areEqual = april19 == otherDate; - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp deleted file mode 100644 index 8d23921d77c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp +++ /dev/null @@ -1,12 +0,0 @@ -using namespace System; - -int main() -{ - // - // Calculate what day of the week is 36 days from this instant. - System::DateTime today = System::DateTime::Now; - System::TimeSpan duration( 36, 0, 0, 0 ); - System::DateTime answer = today.Add( duration ); - System::Console::WriteLine( " {0:dddd}", answer ); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp deleted file mode 100644 index 0cd42a84a60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -using namespace System; - -int main() -{ - // Calculate what day of the week is 36 days from this instant. - DateTime today = System::DateTime::Now; - DateTime answer = today.AddDays( 36 ); - Console::WriteLine("Today: {0:dddd}", today); - Console::WriteLine("36 days from today: {0:dddd}", answer); -} -// The example displays output like the following: -// Today: Wednesday -// 36 days from today: Thursday -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp deleted file mode 100644 index 90e6be09498..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -void main() -{ - - - System::DateTime theDay(System::DateTime::Today.Year,7,28); - int compareValue; - try - { - compareValue = theDay.CompareTo( System::DateTime::Today ); - } - catch ( ArgumentException^ ) - { - System::Console::WriteLine( "Value is not a DateTime" ); - return; - } - - if ( compareValue < 0 ) - { - System::Console::WriteLine( "{0:d} is in the past.", theDay ); - } - else - if ( compareValue == 0 ) - { - System::Console::WriteLine( "{0:d} is today!", theDay ); - } - else - // compareValue > 0 - { - System::Console::WriteLine( "{0:d} has not come yet.", theDay ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp deleted file mode 100644 index 9c3486e2cfa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -// This example demonstrates the DateTime.DayOfWeek property -using namespace System; -int main() -{ - - // Assume the current culture is en-US. - // Create a DateTime for the first of May, 2003. - DateTime dt = DateTime(2003,5,1); - Console::WriteLine( "Is Thursday the day of the week for {0:d}?: {1}", dt, dt.DayOfWeek == DayOfWeek::Thursday ); - Console::WriteLine( "The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek ); -} - -/* -This example produces the following results: - -Is Thursday the day of the week for 5/1/2003?: True -The day of the week for 5/1/2003 is Thursday. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp deleted file mode 100644 index 4cd3cdc577f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; - -int main() -{ - const int July = 7; - const int Feb = 2; - - int daysInJuly = System::DateTime::DaysInMonth( 2001, July ); - Console::WriteLine(daysInJuly); - // daysInFeb gets 28 because the year 1998 was not a leap year. - int daysInFeb = System::DateTime::DaysInMonth( 1998, Feb ); - Console::WriteLine(daysInFeb); - // daysInFebLeap gets 29 because the year 1996 was a leap year. - int daysInFebLeap = System::DateTime::DaysInMonth( 1996, Feb ); - Console::WriteLine(daysInFebLeap); -} -// The example displays the following output: -// 31 -// 28 -// 29 -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp deleted file mode 100644 index 3bccccac024..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -using namespace System; - -int main() -{ - // - System::DateTime today1 = System::DateTime( - System::DateTime::Today.Ticks ); - System::DateTime today2 = System::DateTime( - System::DateTime::Today.Ticks ); - System::DateTime tomorrow = System::DateTime( - System::DateTime::Today.AddDays( 1 ).Ticks ); - - // todayEqualsToday gets true. - bool todayEqualsToday = System::DateTime::Equals( today1, today2 ); - - // todayEqualsTomorrow gets false. - bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow ); - // - - System::Console::WriteLine( todayEqualsToday ); - System::Console::WriteLine( todayEqualsTomorrow ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp deleted file mode 100644 index 6e94f44f925..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -using namespace System; -using namespace System::IO; - -// This function takes a file's creation time as an unsigned long, -// and returns its age. -// -System::TimeSpan FileAge( long fileCreationTime ) -{ - System::DateTime now = System::DateTime::Now; - try - { - System::DateTime fCreationTime = - System::DateTime::FromFileTime( fileCreationTime ); - System::TimeSpan fileAge = now.Subtract( fCreationTime ); - return fileAge; - } - catch ( ArgumentOutOfRangeException^ ) - { - // fileCreationTime is not valid, so re-throw the exception. - throw; - } -} -// - -void main() -{ - System::Console::WriteLine( "Enter a file's path" ); - String^ filePath = System::Console::ReadLine(); - System::IO::FileInfo^ fInfo; - try - { - fInfo = gcnew System::IO::FileInfo( filePath ); - } - catch ( Exception^ ) - { - System::Console::WriteLine( "Error opening {0}", filePath ); - return; - } - - long fileTime = System::Convert::ToInt64( - fInfo->CreationTime.ToFileTime() ); - System::TimeSpan fileAge = FileAge( fileTime ); - System::Console::WriteLine( " {0}", fileAge ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp deleted file mode 100644 index 436ff3e6d0e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -using namespace System; - -int main() -{ - // - DateTime july28 = DateTime(2009, 7, 28, 5, 23, 15, 16); - array^july28Formats = july28.GetDateTimeFormats(); - - // Print [Out] july28* in all DateTime formats using the default culture. - System::Collections::IEnumerator^ myEnum = july28Formats->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ format = safe_cast(myEnum->Current); - System::Console::WriteLine( format ); - } - // - - // - DateTime juil28 = DateTime(2009, 7, 28, 5, 23, 15, 16); - IFormatProvider^ culture = gcnew System::Globalization::CultureInfo("fr-FR", true ); - - // Get the short date formats using the S"fr-FR" culture. - array^frenchJuly28Formats = juil28.GetDateTimeFormats(culture ); - - // Print [Out] july28* in all DateTime formats using fr-FR culture. - System::Collections::IEnumerator^ myEnum2 = frenchJuly28Formats->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ format = safe_cast(myEnum2->Current); - System::Console::WriteLine(format ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp deleted file mode 100644 index d3d290772b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -using namespace System; - -int main() -{ - // - System::DateTime date1 = System::DateTime( 1996, 6, 3, 22, 15, 0 ); - System::DateTime date2 = System::DateTime( 1996, 12, 6, 13, 2, 0 ); - System::DateTime date3 = System::DateTime( 1996, 10, 12, 8, 42, 0 ); - - // diff1 gets 185 days, 14 hours, and 47 minutes. - System::TimeSpan diff1 = date2.Subtract( date1 ); - - // date4 gets 4/9/1996 5:55:00 PM. - System::DateTime date4 = date3.Subtract( diff1 ); - - // diff2 gets 55 days 4 hours and 20 minutes. - System::TimeSpan diff2 = date2 - date3; - - // date5 gets 4/9/1996 5:55:00 PM. - System::DateTime date5 = date1 - diff2; - // - - System::Console::WriteLine( diff1 ); - System::Console::WriteLine( date4 ); - System::Console::WriteLine( diff2 ); - System::Console::WriteLine( date4 ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp deleted file mode 100644 index fd732ab14d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -using namespace System; - -// -int main() -{ - System::Console::WriteLine( "Enter the file path:" ); - String^ filePath = System::Console::ReadLine(); - if ( System::IO::File::Exists( filePath ) ) - { - System::DateTime fileCreationDateTime = System::IO::File::GetCreationTime( filePath ); - __int64 fileCreationFileTime = fileCreationDateTime.ToFileTime(); - System::Console::WriteLine( "{0} in file time is {1}.", fileCreationDateTime, fileCreationFileTime ); - } - else - { - System::Console::WriteLine( "{0} is an invalid file", filePath ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp deleted file mode 100644 index 9b140cbb13e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::WriteLine("Enter a date and time."); - String^ strDateTime = Console::ReadLine(); - - DateTime localDateTime, univDateTime; - try - { - localDateTime = DateTime::Parse(strDateTime); - univDateTime = localDateTime.ToUniversalTime(); - - Console::WriteLine("{0} local time is {1} universal time.", - localDateTime, univDateTime ); - } - catch (FormatException^) - { - Console::WriteLine("Invalid format."); - return; - } - - Console::WriteLine("Enter a date and time in universal time."); - strDateTime = Console::ReadLine(); - - try - { - univDateTime = DateTime::Parse(strDateTime); - localDateTime = univDateTime.ToLocalTime(); - - Console::WriteLine("{0} universal time is {1} local time.", - univDateTime, localDateTime ); - } - catch (FormatException^) - { - Console::WriteLine("Invalid format."); - return; - } -} -// The example displays output like the following when run on a -// computer whose culture is en-US in the Pacific Standard Time zone: -// Enter a date and time. -// 12/10/2015 6:18 AM -// 12/10/2015 6:18:00 AM local time is 12/10/2015 2:18:00 PM universal time. -// Enter a date and time in universal time. -// 12/20/2015 6:42:00 -// 12/20/2015 6:42:00 AM universal time is 12/19/2015 10:42:00 PM local time. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp deleted file mode 100644 index 1d76e0d1879..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp +++ /dev/null @@ -1,144 +0,0 @@ -using namespace System; - -namespace Snippets -{ -// - /// - /// Keeping my fortune in Decimals to avoid the round-off errors. - /// - public ref class PiggyBank - { - protected: - Decimal MyFortune; - - public: - void AddPenny() - { - MyFortune = System::Decimal::Add( MyFortune, Decimal(.01) ); - } - - System::Decimal Capacity() - { - return MyFortune.MaxValue; - } - - Decimal Dollars() - { - return Decimal::Floor( MyFortune ); - } - - Decimal Cents() - { - return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) ); - } - - virtual System::String^ ToString() override - { - return MyFortune.ToString("C")+" in piggy bank"; - } - }; -} -// - -using namespace Snippets; -int main( void ) -{ - PiggyBank ^ pb = gcnew PiggyBank; - for ( Int32 i = 0; i < 378; i++ ) - { - pb->AddPenny(); - - } - Console::WriteLine( pb ); -} - - -namespace Snippets2 -{ - // - public ref class PiggyBank - { - public: - Decimal Capacity() - { - return MyFortune.MaxValue; - } - - void AddPenny() - { - MyFortune = Decimal::Add(MyFortune, (Decimal).01); - } - - protected: - Decimal MyFortune; - }; - -} -// - -namespace Snippets3 -{ - // - public ref class PiggyBank - { - public: - Decimal Dollars() - { - return Decimal::Floor( MyFortune ); - } - - void AddPenny() - { - MyFortune = Decimal::Add(MyFortune, (Decimal).01); - } - - protected: - Decimal MyFortune; - }; - -} -// - -namespace Snippets4 -{ -// - public ref class PiggyBank - { - public: - Decimal Cents() - { - return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) ); - } - - void AddPenny() - { - MyFortune = Decimal::Add(MyFortune, (Decimal).01); - } - - protected: - Decimal MyFortune; - }; -} -// - -namespace Snippets5 -{ -// - public ref class PiggyBank - { - public: - void AddPenny() - { - MyFortune = Decimal::Add( MyFortune, (Decimal).01 ); - } - - virtual System::String^ ToString() override - { - return MyFortune.ToString("C")+" in piggy bank"; - } - - protected: - Decimal MyFortune; - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp deleted file mode 100644 index 4ead255443e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Security; - -void main() -{ - // Create a CustomAttributeBuilder for the assembly attribute. - // - // SecurityTransparentAttribute has a parameterless constructor, - // which is retrieved by passing an array of empty types for the - // constructor's parameter types. The CustomAttributeBuilder is - // then created by passing the ConstructorInfo and an empty array - // of objects to represent the parameters. - // - ConstructorInfo^ transparentCtor = - SecurityTransparentAttribute::typeid->GetConstructor( - Type::EmptyTypes); - CustomAttributeBuilder^ transparent = gcnew CustomAttributeBuilder( - transparentCtor, - gcnew array {} ); - - // Create a dynamic assembly using the attribute. The attribute is - // passed as an array with one element. - AssemblyName^ aName = gcnew AssemblyName("EmittedAssembly"); - AssemblyBuilder^ ab = AppDomain::CurrentDomain->DefineDynamicAssembly( - aName, - AssemblyBuilderAccess::Run, - gcnew array { transparent } ); - - ModuleBuilder^ mb = ab->DefineDynamicModule( aName->Name ); - TypeBuilder^ tb = mb->DefineType( - "MyDynamicType", - TypeAttributes::Public ); - tb->CreateType(); - - Console::WriteLine("{0}\nAssembly attributes:", ab); - for each (Attribute^ attr in ab->GetCustomAttributes(true)) - { - Console::WriteLine("\t{0}", attr); - } -}; - -/* This code example produces the following output: - -EmittedAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -Assembly attributes: - System.Security.SecurityTransparentAttribute - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp deleted file mode 100644 index e8b0c924c07..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Define two classes to use in the demonstration, a base class and -// a class that derives from it. -// -public ref class Base {}; - -public ref class Derived : Base -{ - // Define a static method to use in the demonstration. The method - // takes an instance of Base and returns an instance of Derived. - // For the purposes of the demonstration, it is not necessary for - // the method to do anything useful. - // -public: - static Derived^ MyMethod(Base^ arg) - { - Base^ dummy = arg; - return gcnew Derived(); - } -}; - -// Define a delegate that takes an instance of Derived and returns an -// instance of Base. -// -public delegate Base^ Example(Derived^ arg); - -void main() -{ - // The binding flags needed to retrieve MyMethod. - BindingFlags flags = BindingFlags::Public | BindingFlags::Static; - - // Get a MethodInfo that represents MyMethod. - MethodInfo^ minfo = Derived::typeid->GetMethod("MyMethod", flags); - - // Demonstrate contravariance of parameter types and covariance - // of return types by using the delegate Example to represent - // MyMethod. The delegate binds to the method because the - // parameter of the delegate is more restrictive than the - // parameter of the method (that is, the delegate accepts an - // instance of Derived, which can always be safely passed to - // a parameter of type Base), and the return type of MyMethod - // is more restrictive than the return type of Example (that - // is, the method returns an instance of Derived, which can - // always be safely cast to type Base). - // - Example^ ex = - (Example^) Delegate::CreateDelegate(Example::typeid, minfo); - - // Execute MyMethod using the delegate Example. - // - Base^ b = ex(gcnew Derived()); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp deleted file mode 100644 index a0af052a1d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// The following example starts an instance of Notepad. The example -// then retrieves and displays various properties of the associated -// process. The example detects when the process exits, and displays -// the process's exit code. -// -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - - // Define variables to track the peak - // memory usage of the process. - _int64 peakPagedMem = 0,peakWorkingSet = 0,peakVirtualMem = 0; - Process^ myProcess = nullptr; - try - { - - // Start the process. - myProcess = Process::Start( "NotePad.exe" ); - - // Display the process statistics until - // the user closes the program. - do - { - if ( !myProcess->HasExited ) - { - - // Refresh the current process property values. - myProcess->Refresh(); - Console::WriteLine(); - - // Display current process statistics. - Console::WriteLine( "{0} -", myProcess ); - Console::WriteLine( "-------------------------------------" ); - Console::WriteLine( " physical memory usage: {0}", myProcess->WorkingSet64 ); - Console::WriteLine( " base priority: {0}", myProcess->BasePriority ); - Console::WriteLine( " priority class: {0}", myProcess->PriorityClass ); - Console::WriteLine( " user processor time: {0}", myProcess->UserProcessorTime ); - Console::WriteLine( " privileged processor time: {0}", myProcess->PrivilegedProcessorTime ); - Console::WriteLine( " total processor time: {0}", myProcess->TotalProcessorTime ); - Console::WriteLine(" PagedSystemMemorySize64: {0}", myProcess->PagedSystemMemorySize64); - Console::WriteLine(" PagedMemorySize64: {0}", myProcess->PagedMemorySize64); - - // Update the values for the overall peak memory statistics. - peakPagedMem = myProcess->PeakPagedMemorySize64; - peakVirtualMem = myProcess->PeakVirtualMemorySize64; - peakWorkingSet = myProcess->PeakWorkingSet64; - if ( myProcess->Responding ) - { - Console::WriteLine( "Status = Running" ); - } - else - { - Console::WriteLine( "Status = Not Responding" ); - } - } - } - while ( !myProcess->WaitForExit( 1000 ) ); - Console::WriteLine(); - Console::WriteLine( "Process exit code: {0}", myProcess->ExitCode ); - - // Display peak memory statistics for the process. - Console::WriteLine( "Peak physical memory usage of the process: {0}", peakWorkingSet ); - Console::WriteLine( "Peak paged memory usage of the process: {0}", peakPagedMem ); - Console::WriteLine( "Peak virtual memory usage of the process: {0}", peakVirtualMem ); - } - finally - { - if ( myProcess != nullptr ) - { - myProcess->Close(); - } - } - -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp b/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp deleted file mode 100644 index 1ec20413156..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// System::Diagnostics->CounterCreationData -// System::Diagnostics->CounterCreationData(String*, String*, PerformanceCounterType) -// System::Diagnostics->CounterCreationData() -// System::Diagnostics->CounterCreationData->CounterName -// System::Diagnostics->CounterCreationData->CounterHelp -// System::Diagnostics->CounterCreationData->CounterType - -/* The following program demonstrates 'CounterCreationData' class, -CounterCreationData(String*, String*, PerformanceCounterType)', -'CounterCreationData()', 'CounterName', 'CounterHelp' and -'CounterType' members of 'System::Diagnostics->CounterCreationData' -class. It creates the custom counters with 'CounterCreationData' -and binds them to 'PerformanceCounterCategory' object. */ - -// -// -// -// -// -// -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - CounterCreationDataCollection^ myCol = gcnew CounterCreationDataCollection; - - // Create two custom counter objects. - CounterCreationData^ myCounter1 = gcnew CounterCreationData( "Counter1","First custom counter",PerformanceCounterType::CounterDelta32 ); - CounterCreationData^ myCounter2 = gcnew CounterCreationData; - - // Set the properties of the 'CounterCreationData' Object*. - myCounter2->CounterName = "Counter2"; - myCounter2->CounterHelp = "Second custom counter"; - myCounter2->CounterType = PerformanceCounterType::NumberOfItemsHEX32; - - // Add custom counter objects to CounterCreationDataCollection. - myCol->Add( myCounter1 ); - myCol->Add( myCounter2 ); - if ( PerformanceCounterCategory::Exists( "New Counter Category" ) ) - PerformanceCounterCategory::Delete( "New Counter Category" ); - - // Bind the counters to a PerformanceCounterCategory. - PerformanceCounterCategory^ myCategory = PerformanceCounterCategory::Create( "New Counter Category", "Category Help", myCol ); - Console::WriteLine( "Counter Information:" ); - Console::WriteLine( "Category Name: {0}", myCategory->CategoryName ); - for ( int i = 0; i < myCol->Count; i++ ) - { - // Display the properties of the CounterCreationData objects. - Console::WriteLine( "CounterName : {0}", myCol[ i ]->CounterName ); - Console::WriteLine( "CounterHelp : {0}", myCol[ i ]->CounterHelp ); - Console::WriteLine( "CounterType : {0}", myCol[ i ]->CounterType ); - } -} - -// -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp deleted file mode 100644 index b5b6c7488d8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp +++ /dev/null @@ -1,398 +0,0 @@ -//Types:System.Collections.DictionaryEntry -//Types:System.Collections.IDictionary -//Types:System.Collections.IDictionaryEnumerator -// -using namespace System; -using namespace System::Collections; - -// -// This class implements a simple dictionary using an array of -// DictionaryEntry objects (key/value pairs). -public ref class SimpleDictionary : public IDictionary -{ - // The array of items -private: - array^ items; -private: - int itemsInUse; - - // Construct the SimpleDictionary with the desired number of - // items. The number of items cannot change for the life time of - // this SimpleDictionary. -public: - SimpleDictionary(int size) - { - items = gcnew array(size); - } - - #pragma region IDictionary Members - // -public: - property virtual bool IsReadOnly - { - bool get() - { - return false; - } - } - // - // -public: - virtual bool Contains(Object^ key) - { - int index; - return TryGetIndexOfKey(key, &index); - } - // - // -public: - virtual property bool IsFixedSize - { - bool get() - { - return false; - } - } - // - // -public: - virtual void Remove(Object^ key) - { - if (key == nullptr) - { - throw gcnew ArgumentNullException("key"); - } - // Try to find the key in the DictionaryEntry array - int index; - if (TryGetIndexOfKey(key, &index)) - { - // If the key is found, slide all the items down. - Array::Copy(items, index + 1, items, index, itemsInUse - - index - 1); - itemsInUse--; - } - else - { - // If the key is not in the dictionary, just return. - return; - } - } - // - // -public: - virtual void Clear() - { - itemsInUse = 0; - } - // - // -public: - virtual void Add(Object^ key, Object^ value) - { - // Add the new key/value pair even if this key already exists - // in the dictionary. - if (itemsInUse == items->Length) - { - throw gcnew InvalidOperationException - ("The dictionary cannot hold any more items."); - } - items[itemsInUse++] = gcnew DictionaryEntry(key, value); - } - // - // -public: - virtual property ICollection^ Keys - { - ICollection^ get() - { - // Return an array where each item is a key. - array^ keys = gcnew array(itemsInUse); - for (int i = 0; i < itemsInUse; i++) - { - keys[i] = items[i]->Key; - } - return keys; - } - } - // - // -public: - virtual property ICollection^ Values - { - ICollection^ get() - { - // Return an array where each item is a value. - array^ values = gcnew array(itemsInUse); - for (int i = 0; i < itemsInUse; i++) - { - values[i] = items[i]->Value; - } - return values; - } - } - // - // -public: - virtual property Object^ default[Object^] - { - Object^ get(Object^ key) - { - // If this key is in the dictionary, return its value. - int index; - if (TryGetIndexOfKey(key, &index)) - { - // The key was found; return its value. - return items[index]->Value; - } - else - { - // The key was not found; return null. - return nullptr; - } - } - - void set(Object^ key, Object^ value) - { - // If this key is in the dictionary, change its value. - int index; - if (TryGetIndexOfKey(key, &index)) - { - // The key was found; change its value. - items[index]->Value = value; - } - else - { - // This key is not in the dictionary; add this - // key/value pair. - Add(key, value); - } - } - } - // -private: - bool TryGetIndexOfKey(Object^ key, int* index) - { - for (*index = 0; *index < itemsInUse; *index++) - { - // If the key is found, return true (the index is also - // returned). - if (items[*index]->Key->Equals(key)) - { - return true; - } - } - - // Key not found, return false (index should be ignored by - // the caller). - return false; - } -// -// -private: - ref class SimpleDictionaryEnumerator : public IDictionaryEnumerator - { - // A copy of the SimpleDictionary object's key/value pairs. -private: - array^ items; -private: - int index; - -public: - SimpleDictionaryEnumerator(SimpleDictionary^ sd) - { - // Make a copy of the dictionary entries currently in the - // SimpleDictionary object. - items = gcnew array(sd->Count); - Array::Copy(sd->items, 0, items, 0, sd->Count); - index = -1; - } - - // Return the current item. -public: - virtual property Object^ Current - { - Object^ get() - { - ValidateIndex(); - return items[index]; - } - } - - // Return the current dictionary entry. -public: - virtual property DictionaryEntry Entry - { - DictionaryEntry get() - { - return (DictionaryEntry) Current; - } - } - - // Return the key of the current item. -public: - virtual property Object^ Key - { - Object^ get() - { - ValidateIndex(); - return items[index]->Key; - } - } - - // Return the value of the current item. -public: - virtual property Object^ Value - { - Object^ get() - { - ValidateIndex(); - return items[index]->Value; - } - } - - // Advance to the next item. -public: - virtual bool MoveNext() - { - if (index < items->Length - 1) - { - index++; - return true; - } - return false; - } - - // Validate the enumeration index and throw an exception if - // the index is out of range. -private: - void ValidateIndex() - { - if (index < 0 || index >= items->Length) - { - throw gcnew InvalidOperationException - ("Enumerator is before or after the collection."); - } - } - - // Reset the index to restart the enumeration. -public: - virtual void Reset() - { - index = -1; - } - }; - // -public: - virtual IDictionaryEnumerator^ GetEnumerator() - { - // Construct and return an enumerator. - return gcnew SimpleDictionaryEnumerator(this); - } - // - #pragma endregion - - #pragma region ICollection Members -public: - virtual property bool IsSynchronized - { - bool get() - { - return false; - } - } - -public: - virtual property Object^ SyncRoot - { - Object^ get() - { - throw gcnew NotImplementedException(); - } - } - -public: - virtual property int Count - { - int get() - { - return itemsInUse; - } - } - -public: - virtual void CopyTo(Array^ array, int index) - { - throw gcnew NotImplementedException(); - } - #pragma endregion - - #pragma region IEnumerable Members - - virtual IEnumerator^ IEnumerable_GetEnumerator() - = IEnumerable::GetEnumerator - { - // Construct and return an enumerator. - return ((IDictionary^)this)->GetEnumerator(); - } - #pragma endregion -}; -// - -int main() -{ - // Create a dictionary that contains no more than three - // entries. - IDictionary^ d = gcnew SimpleDictionary(3); - - // Add three people and their ages to the dictionary. - d->Add("Jeff", 40); - d->Add("Kristin", 34); - d->Add("Aidan", 1); - - Console::WriteLine("Number of elements in dictionary = {0}", - d->Count); - - Console::WriteLine("Does dictionary contain 'Jeff'? {0}", - d->Contains("Jeff")); - Console::WriteLine("Jeff's age is {0}", d["Jeff"]); - - // Display every entry's key and value. - for each (DictionaryEntry^ de in d) - { - Console::WriteLine("{0} is {1} years old.", de->Key, - de->Value); - } - - // Remove an entry that exists. - d->Remove("Jeff"); - - // Remove an entry that does not exist, but do not throw an - // exception. - d->Remove("Max"); - - // Show the names (keys) of the people in the dictionary. - for each (String^ s in d->Keys) - { - Console::WriteLine(s); - } - - // Show the ages (values) of the people in the dictionary. - for each (int age in d->Values) - { - Console::WriteLine(age); - } -} - -// This code produces the following output. -// -// Number of elements in dictionary = 3 -// Does dictionary contain 'Jeff'? True -// Jeff's age is 40 -// Jeff is 40 years old. -// Kristin is 34 years old. -// Aidan is 1 years old. -// Kristin -// Aidan -// 34 -// 1 -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp deleted file mode 100644 index 6d4e4af244c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp +++ /dev/null @@ -1,44 +0,0 @@ -using namespace System; -using namespace System::Collections; - -public ref class SimpleDictionary : DictionaryBase -{ -}; - -public ref class DictionaySamples -{ -public: - static void Main() - { - // Create a dictionary that contains no more than three entries. - IDictionary^ myDictionary = gcnew SimpleDictionary(); - - // Add three people and their ages to the dictionary. - myDictionary->Add("Jeff", 40); - myDictionary->Add("Kristin", 34); - myDictionary->Add("Aidan", 1); - // Display every entry's key and value. - for each (DictionaryEntry de in myDictionary) - { - Console::WriteLine("{0} is {1} years old.", de.Key, de.Value); - } - - // Remove an entry that exists. - myDictionary->Remove("Jeff"); - - // Remove an entry that does not exist, but do not throw an exception. - myDictionary->Remove("Max"); - - // - for each (DictionaryEntry de in myDictionary) - { - //... - } - // - } -}; - -int main() -{ - DictionaySamples::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp deleted file mode 100644 index ad273901016..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Specify the directories you want to manipulate. - DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\MyDir" ); - try - { - - // Determine whether the directory exists. - if ( di->Exists ) - { - - // Indicate that the directory already exists. - Console::WriteLine( "That path exists already." ); - return 0; - } - - // Try to create the directory. - di->Create(); - Console::WriteLine( "The directory was created successfully." ); - - // Delete the directory. - di->Delete(); - Console::WriteLine( "The directory was deleted successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp deleted file mode 100644 index b172c01236b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Specify the directories you want to manipulate. - DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\MyDir" ); - try - { - - // Determine whether the directory exists. - if ( di->Exists ) - { - - // Indicate that it already exists. - Console::WriteLine( "That path exists already." ); - return 0; - } - - // Try to create the directory. - di->Create(); - Console::WriteLine( "The directory was created successfully." ); - - // Delete the directory. - di->Delete(); - Console::WriteLine( "The directory was deleted successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp deleted file mode 100644 index 8a3584321aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Specify the directories you want to manipulate. - DirectoryInfo^ di1 = gcnew DirectoryInfo( "c:\\MyDir" ); - DirectoryInfo^ di2 = gcnew DirectoryInfo( "c:\\MyDir\\temp" ); - try - { - - // Create the directories. - di1->Create(); - di2->Create(); - - // This operation will not be allowed because there are subdirectories. - Console::WriteLine( "I am about to attempt to delete {0}.", di1->Name ); - di1->Delete(); - Console::WriteLine( "The Delete operation was successful, which was unexpected." ); - } - catch ( Exception^ ) - { - Console::WriteLine( "The Delete operation failed as expected." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp deleted file mode 100644 index c0751c822f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Specify the directories you want to manipulate. - DirectoryInfo^ di1 = gcnew DirectoryInfo( "c:\\MyDir" ); - try - { - - // Create the directories. - di1->Create(); - di1->CreateSubdirectory( "temp" ); - - //This operation will not be allowed because there are subdirectories. - Console::WriteLine( "I am about to attempt to delete {0}", di1->Name ); - di1->Delete(); - Console::WriteLine( "The Delete operation was successful, which was unexpected." ); - } - catch ( Exception^ ) - { - Console::WriteLine( "The Delete operation failed as expected." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp deleted file mode 100644 index 7ecd08dfd25..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" ); - - // Get only subdirectories that contain the letter "p." - array^dirs = di->GetDirectories( "*p*" ); - Console::WriteLine( "The number of directories containing the letter p is {0}.", dirs->Length ); - Collections::IEnumerator^ myEnum = dirs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DirectoryInfo^ diNext = safe_cast(myEnum->Current); - Console::WriteLine( "The number of files in {0} is {1}", diNext, diNext->GetFiles()->Length ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp deleted file mode 100644 index 550cc864617..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Specify the directory you want to manipulate. - String^ path = "c:\\MyDir"; - try - { - - // Determine whether the directory exists. - if ( Directory::Exists( path ) ) - { - Console::WriteLine( "That path exists already." ); - return 0; - } - - // Try to create the directory. - DirectoryInfo^ di = Directory::CreateDirectory( path ); - Console::WriteLine( "The directory was created successfully at {0}.", Directory::GetCreationTime( path ) ); - - // Delete the directory. - di->Delete(); - Console::WriteLine( "The directory was deleted successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp deleted file mode 100644 index 86cac85e3fc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - - // Get the creation time of a well-known directory. - DateTime dt = Directory::GetCreationTime( Environment::CurrentDirectory ); - - // Give feedback to the user. - if ( DateTime::Now.Subtract( dt ).TotalDays > 364 ) - { - Console::WriteLine( "This directory is over a year old." ); - } - else - if ( DateTime::Now.Subtract( dt ).TotalDays > 30 ) - { - Console::WriteLine( "This directory is over a month old." ); - } - else - if ( DateTime::Now.Subtract( dt ).TotalDays <= 1 ) - { - Console::WriteLine( "This directory is less than a day old." ); - } - else - { - Console::WriteLine( "This directory was created on {0}", dt ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp deleted file mode 100644 index 716792cead5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - - // Get the current directory. - String^ path = Directory::GetCurrentDirectory(); - String^ target = "c:\\temp"; - Console::WriteLine( "The current directory is {0}", path ); - if ( !Directory::Exists( target ) ) - { - Directory::CreateDirectory( target ); - } - - // Change the current directory. - Environment::CurrentDirectory = target; - if ( path->Equals( Directory::GetCurrentDirectory() ) ) - { - Console::WriteLine( "You are in the temp directory." ); - } - else - { - Console::WriteLine( "You are not in the temp directory." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp deleted file mode 100644 index 0896d4ca1b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - - // Only get subdirectories that begin with the letter "p." - array^dirs = Directory::GetDirectories( "c:\\", "p*" ); - Console::WriteLine( "The number of directories starting with p is {0}.", dirs->Length ); - Collections::IEnumerator^ myEnum = dirs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Console::WriteLine( myEnum->Current ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp deleted file mode 100644 index 95bb8528e02..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - - // Only get files that begin with the letter "c". - array^dirs = Directory::GetFiles( "c:\\", "c*" ); - Console::WriteLine( "The number of files starting with c is {0}.", dirs->Length ); - Collections::IEnumerator^ myEnum = dirs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Console::WriteLine( myEnum->Current ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp deleted file mode 100644 index d38d877f932..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\MyDir"; - if ( !Directory::Exists( path ) ) - { - Directory::CreateDirectory( path ); - } - Directory::SetLastAccessTime( path, DateTime(1985,5,4) ); - - // Get the creation time of a well-known directory. - DateTime dt = Directory::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this directory was {0}", dt ); - - // Update the last access time. - Directory::SetLastAccessTime( path, DateTime::Now ); - dt = Directory::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this directory was {0}", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp deleted file mode 100644 index 75e5bee709d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\MyDir"; - if ( !Directory::Exists( path ) ) - { - Directory::CreateDirectory( path ); - } - else - { - - // Take an action which will affect the write time. - Directory::SetLastWriteTime( path, DateTime(1985,4,3) ); - } - - // Get the creation time of a well-known directory. - DateTime dt = Directory::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this directory was {0}", dt ); - - // Update the last write time. - Directory::SetLastWriteTime( path, DateTime::Now ); - dt = Directory::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this directory was {0}", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp deleted file mode 100644 index 0da03649338..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\MyDir"; - if ( !Directory::Exists( path ) ) - { - Directory::CreateDirectory( path ); - } - Directory::SetLastAccessTime( path, DateTime(1985,5,4) ); - - // Get the last access time of a well-known directory. - DateTime dt = Directory::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this directory was {0}", dt ); - - // Update the last access time. - Directory::SetLastAccessTime( path, DateTime::Now ); - dt = Directory::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this directory was {0}", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp deleted file mode 100644 index 45c4c45428c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -void main() -{ - try - { - String^ path = "c:\\MyDir"; - if ( !Directory::Exists( path ) ) - { - Directory::CreateDirectory( path ); - } - else - { - - // Take an action that will affect the write time. - Directory::SetLastWriteTime( path, DateTime(1985,4,3) ); - } - - // Get the last write time of a well-known directory. - DateTime dt = Directory::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this directory was {0}", dt ); - - //Update the last write time. - Directory::SetLastWriteTime( path, DateTime::Now ); - dt = Directory::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this directory was {0}", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp b/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp deleted file mode 100644 index 9647674e17e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::IO; - -// Copy a source directory to a target directory. -void CopyDirectory( String^ SourceDirectory, String^ TargetDirectory ) -{ - DirectoryInfo^ source = gcnew DirectoryInfo( SourceDirectory ); - DirectoryInfo^ target = gcnew DirectoryInfo( TargetDirectory ); - - //Determine whether the source directory exists. - if ( !source->Exists ) - return; - - if ( !target->Exists ) - target->Create(); - - - //Copy files. - array^sourceFiles = source->GetFiles(); - for ( int i = 0; i < sourceFiles->Length; ++i ) - File::Copy( sourceFiles[ i ]->FullName, String::Concat( target->FullName, "\\", sourceFiles[ i ]->Name ), true ); - - //Copy directories. - array^sourceDirectories = source->GetDirectories(); - for ( int j = 0; j < sourceDirectories->Length; ++j ) - CopyDirectory( sourceDirectories[ j ]->FullName, String::Concat( target->FullName, "\\", sourceDirectories[ j ]->Name ) ); -} - -int main() -{ - CopyDirectory( "D:\\Tools", "D:\\NewTools" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp deleted file mode 100644 index 95b5dde57f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp +++ /dev/null @@ -1,531 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -namespace Snippets -{ - // - // The Temperature class stores the temperature as a Double - // and delegates most of the functionality to the Double - // implementation. - public ref class Temperature: public IComparable, public IFormattable - { - // IComparable.CompareTo implementation. - public: - virtual int CompareTo( Object^ obj ) - { - if (obj == nullptr) return 1; - - if (dynamic_cast(obj) ) - { - Temperature^ temp = (Temperature^)(obj); - return m_value.CompareTo( temp->m_value ); - } - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - // IFormattable.ToString implementation. - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - return m_value.ToString( format, provider ); - } - - // Parses the temperature from a string in the form - // [ws][sign]digits['F|'C][ws] - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = Double::Parse( s, styles, provider ); - } - return temp; - } - - protected: - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; - // - - ref class Launcher - { - public: - static void Main() - { - Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Float, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - - String^ str1 = t1->ToString( "C", nullptr ); - Console::WriteLine( str1 ); - - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Float, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t2 ) ); - - Temperature^ t3 = Temperature::Parse( "20'C", NumberStyles::Float, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t3 ) ); - - Console::ReadLine(); - } - }; -} - -namespace Snippets2 -{ - // - public ref class Temperature - { - public: - static property double MinValue - { - double get() - { - return Double::MinValue; - } - } - - static property double MaxValue - { - double get() - { - return Double::MaxValue; - } - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets3 -{ - // - public ref class Temperature: public IComparable - { - // IComparable.CompareTo implementation. - public: - virtual int CompareTo( Object^ obj ) - { - if (obj == nullptr) return 1; - - if ( dynamic_cast(obj) ) - { - Temperature^ temp = dynamic_cast(obj); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets4 -{ - // - public ref class Temperature: public IFormattable - { - // IFormattable.ToString implementation. - public: - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - - return m_value.ToString( format, provider ); - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets5 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = Double::Parse( s ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets6 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = Double::Parse( s, provider ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets7 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = Double::Parse( s, styles ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -namespace Snippets8 -{ - // - public ref class Temperature - { - // Parses the temperature from a string in the form - // [ws][sign]digits['F|'C][ws] - public: - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) - { - temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) - { - temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = Double::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - double m_value; - - public: - property double Value - { - double get() - { - return m_value; - } - void set( double value ) - { - m_value = value; - } - } - - property double Celsius - { - double get() - { - return (m_value - 32.0) / 1.8; - } - void set( double value ) - { - m_value = 1.8 * value + 32.0; - } - } - }; -// -} - -int main() -{ - Snippets::Launcher::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp deleted file mode 100644 index 6ee946709cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; - -public ref class MyBaseClass {}; - -public ref class MyDerivedClass: MyBaseClass{}; - -int main() -{ - MyBaseClass^ myBase = gcnew MyBaseClass; - MyDerivedClass^ myDerived = gcnew MyDerivedClass; - Object^ o = myDerived; - MyBaseClass^ b = myDerived; - Console::WriteLine( "mybase: Type is {0}", myBase->GetType() ); - Console::WriteLine( "myDerived: Type is {0}", myDerived->GetType() ); - Console::WriteLine( "object o = myDerived: Type is {0}", o->GetType() ); - Console::WriteLine( "MyBaseClass b = myDerived: Type is {0}", b->GetType() ); -} - -/* - -This code produces the following output. - -mybase: Type is MyBaseClass -myDerived: Type is MyDerivedClass -object o = myDerived: Type is MyDerivedClass -MyBaseClass b = myDerived: Type is MyDerivedClass - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp deleted file mode 100644 index 994eab40042..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -int main() -{ - Object^ o = nullptr; - Object^ p = nullptr; - Object^ q = gcnew Object; - Console::WriteLine( Object::ReferenceEquals( o, p ) ); - p = q; - Console::WriteLine( Object::ReferenceEquals( p, q ) ); - Console::WriteLine( Object::ReferenceEquals( o, p ) ); -} - -/* - -This code produces the following output. - -True -True -False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp deleted file mode 100644 index 0ee3bf8e579..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -void main() -{ - String^ name = "InMemory"; - - AssemblyBuilder^ asmBldr = - AppDomain::CurrentDomain->DefineDynamicAssembly(gcnew AssemblyName(name), - AssemblyBuilderAccess::Run); - ModuleBuilder^ modBldr = asmBldr->DefineDynamicModule(name); - - TypeBuilder^ tb = modBldr->DefineType("DemoVararg"); - - // Create a vararg method with no return value and one - // string argument. (The string argument type is the only - // element of an array of Type objects.) - // - MethodBuilder^ mb1 = tb->DefineMethod("VarargMethod", - MethodAttributes::Public | MethodAttributes::Static, - CallingConventions::VarArgs, - nullptr, - gcnew array { String::typeid }); - - ILGenerator^ il1 = mb1->GetILGenerator(); - - LocalBuilder^ locAi = il1->DeclareLocal(ArgIterator::typeid); - LocalBuilder^ locNext = il1->DeclareLocal(bool::typeid); - - Label labelCheckCondition = il1->DefineLabel(); - Label labelNext = il1->DefineLabel(); - - // Load the fixed argument and print it. - il1->Emit(OpCodes::Ldarg_0); - il1->Emit(OpCodes::Call, Console::typeid->GetMethod("Write", - gcnew array { String::typeid })); - - // Load the address of the local variable represented by - // locAi, which will hold the ArgIterator. - il1->Emit(OpCodes::Ldloca_S, locAi); - - // Load the address of the argument list, and call the - // ArgIterator constructor that takes an array of runtime - // argument handles. - il1->Emit(OpCodes::Arglist); - il1->Emit(OpCodes::Call, ArgIterator::typeid->GetConstructor( - gcnew array { RuntimeArgumentHandle::typeid })); - - // Enter the loop at the point where the remaining argument - // count is tested. - il1->Emit(OpCodes::Br_S, labelCheckCondition); - - // At the top of the loop, call GetNextArg to get the next - // argument from the ArgIterator. Convert the typed reference - // to an object reference and write the object to the console. - il1->MarkLabel(labelNext); - il1->Emit(OpCodes::Ldloca_S, locAi); - il1->Emit(OpCodes::Call, ArgIterator::typeid->GetMethod("GetNextArg", Type::EmptyTypes)); - il1->Emit(OpCodes::Call, TypedReference::typeid->GetMethod("ToObject")); - il1->Emit(OpCodes::Call, Console::typeid->GetMethod("Write", - gcnew array { Object::typeid })); - - il1->MarkLabel(labelCheckCondition); - il1->Emit(OpCodes::Ldloca_S, locAi); - il1->Emit(OpCodes::Call, ArgIterator::typeid->GetMethod("GetRemainingCount")); - - // If the remaining count is greater than zero, go to - // the top of the loop. - il1->Emit(OpCodes::Ldc_I4_0); - il1->Emit(OpCodes::Cgt); - il1->Emit(OpCodes::Stloc_1); - il1->Emit(OpCodes::Ldloc_1); - il1->Emit(OpCodes::Brtrue_S, labelNext); - - il1->Emit(OpCodes::Ret); - - // Create a method that contains a call to the vararg - // method. - MethodBuilder^ mb2 = tb->DefineMethod("CallVarargMethod", - MethodAttributes::Public | MethodAttributes::Static, - CallingConventions::Standard, - nullptr, Type::EmptyTypes); - - ILGenerator^ il2 = mb2->GetILGenerator(); - - // Push arguments on the stack: one for the fixed string - // parameter, and two for the list. - il2->Emit(OpCodes::Ldstr, "Hello "); - il2->Emit(OpCodes::Ldstr, "world "); - il2->Emit(OpCodes::Ldc_I4, 2006); - - // Call the vararg method, specifying the types of the - // arguments in the list. - il2->EmitCall(OpCodes::Call, mb1, - gcnew array { String::typeid, int::typeid }); - - il2->Emit(OpCodes::Ret); - - Type^ type = tb->CreateType(); - type->GetMethod("CallVarargMethod")->Invoke(nullptr, nullptr); -} - -/* This code example produces the following output: - -Hello world 2006 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp deleted file mode 100644 index e0695468622..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp +++ /dev/null @@ -1,300 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Collections::Generic; - -// Dummy class to satisfy TFirst constraints. -// -public ref class Example {}; - -// Define a trivial base class and two trivial interfaces -// to use when demonstrating constraints. -// -public ref class ExampleBase {}; -public interface class IExampleA {}; -public interface class IExampleB {}; - -// Define a trivial type that can substitute for type parameter -// TSecond. -// -public ref class ExampleDerived : ExampleBase, IExampleA, IExampleB {}; - -// List the constraint flags. The GenericParameterAttributes -// enumeration contains two sets of attributes, variance and -// constraints. For this example, only constraints are used. -// -static void ListConstraintAttributes( Type^ t ) -{ - // Mask off the constraint flags. - GenericParameterAttributes constraints = - t->GenericParameterAttributes & - GenericParameterAttributes::SpecialConstraintMask; - - if ((constraints & GenericParameterAttributes::ReferenceTypeConstraint) - != GenericParameterAttributes::None) - Console::WriteLine( L" ReferenceTypeConstraint"); - - if ((constraints & GenericParameterAttributes::NotNullableValueTypeConstraint) - != GenericParameterAttributes::None) - Console::WriteLine( L" NotNullableValueTypeConstraint"); - - if ((constraints & GenericParameterAttributes::DefaultConstructorConstraint) - != GenericParameterAttributes::None) - Console::WriteLine( L" DefaultConstructorConstraint"); -} - -static void DisplayGenericParameters( Type^ t ) -{ - if (!t->IsGenericType) - { - Console::WriteLine( L"Type '{0}' is not generic." ); - return; - } - if (!t->IsGenericTypeDefinition) - t = t->GetGenericTypeDefinition(); - - array^ typeParameters = t->GetGenericArguments(); - Console::WriteLine( L"\r\nListing {0} type parameters for type '{1}'.", - typeParameters->Length, t ); - - for each ( Type^ tParam in typeParameters ) - { - Console::WriteLine( L"\r\nType parameter {0}:", - tParam->ToString() ); - - for each (Type^ c in tParam->GetGenericParameterConstraints()) - { - if (c->IsInterface) - Console::WriteLine( L" Interface constraint: {0}", c); - else - Console::WriteLine( L" Base type constraint: {0}", c); - } - ListConstraintAttributes(tParam); - } -} - -void main() -{ - // Define a dynamic assembly to contain the sample type. The - // assembly will be run and also saved to disk, so - // AssemblyBuilderAccess.RunAndSave is specified. - // - // - AppDomain^ myDomain = AppDomain::CurrentDomain; - AssemblyName^ myAsmName = gcnew AssemblyName( L"GenericEmitExample1" ); - AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( - myAsmName, AssemblyBuilderAccess::RunAndSave ); - // - - // An assembly is made up of executable modules. For a single- - // module assembly, the module name and file name are the same - // as the assembly name. - // - // - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( - myAsmName->Name, String::Concat( myAsmName->Name, L".dll" ) ); - // - - // Get type objects for the base class trivial interfaces to - // be used as constraints. - // - Type^ baseType = ExampleBase::typeid; - Type^ interfaceA = IExampleA::typeid; - Type^ interfaceB = IExampleB::typeid; - - // Define the sample type. - // - // - TypeBuilder^ myType = myModule->DefineType( L"Sample", - TypeAttributes::Public ); - // - - Console::WriteLine( L"Type 'Sample' is generic: {0}", - myType->IsGenericType ); - - // Define type parameters for the type. Until you do this, - // the type is not generic, as the preceding and following - // WriteLine statements show. The type parameter names are - // specified as an array of strings. To make the code - // easier to read, each GenericTypeParameterBuilder is placed - // in a variable with the same name as the type parameter. - // - // - array^typeParamNames = {L"TFirst",L"TSecond"}; - array^typeParams = - myType->DefineGenericParameters( typeParamNames ); - - GenericTypeParameterBuilder^ TFirst = typeParams[0]; - GenericTypeParameterBuilder^ TSecond = typeParams[1]; - // - - Console::WriteLine( L"Type 'Sample' is generic: {0}", - myType->IsGenericType ); - - // Apply constraints to the type parameters. - // - // A type that is substituted for the first parameter, TFirst, - // must be a reference type and must have a parameterless - // constructor. - // - TFirst->SetGenericParameterAttributes( - GenericParameterAttributes::DefaultConstructorConstraint | - GenericParameterAttributes::ReferenceTypeConstraint - ); - // - - // A type that is substituted for the second type - // parameter must implement IExampleA and IExampleB, and - // inherit from the trivial test class ExampleBase. The - // interface constraints are specified as an array - // containing the interface types. - // - array^interfaceTypes = { interfaceA, interfaceB }; - TSecond->SetInterfaceConstraints( interfaceTypes ); - TSecond->SetBaseTypeConstraint( baseType ); - // - - // The following code adds a private field named ExampleField, - // of type TFirst. - // - FieldBuilder^ exField = - myType->DefineField("ExampleField", TFirst, - FieldAttributes::Private); - // - - // Define a static method that takes an array of TFirst and - // returns a List containing all the elements of - // the array. To define this method it is necessary to create - // the type List by calling MakeGenericType on the - // generic type definition, generic List. - // The parameter type is created by using the - // MakeArrayType method. - // - // - Type^ listOf = List::typeid; - Type^ listOfTFirst = listOf->MakeGenericType(TFirst); - array^ mParamTypes = { TFirst->MakeArrayType() }; - - MethodBuilder^ exMethod = - myType->DefineMethod("ExampleMethod", - MethodAttributes::Public | MethodAttributes::Static, - listOfTFirst, - mParamTypes); - // - - // Emit the method body. - // The method body consists of just three opcodes, to load - // the input array onto the execution stack, to call the - // List constructor that takes IEnumerable, - // which does all the work of putting the input elements into - // the list, and to return, leaving the list on the stack. The - // hard work is getting the constructor. - // - // The GetConstructor method is not supported on a - // GenericTypeParameterBuilder, so it is not possible to get - // the constructor of List directly. There are two - // steps, first getting the constructor of generic List and then - // calling a method that converts it to the corresponding - // constructor of List. - // - // The constructor needed here is the one that takes an - // IEnumerable. Note, however, that this is not the - // generic type definition of generic IEnumerable; instead, the - // T from generic List must be substituted for the T of - // generic IEnumerable. (This seems confusing only because both - // types have type parameters named T. That is why this example - // uses the somewhat silly names TFirst and TSecond.) To get - // the type of the constructor argument, take the generic - // type definition generic IEnumerable and - // call MakeGenericType with the first generic type parameter - // of generic List. The constructor argument list must be passed - // as an array, with just one argument in this case. - // - // Now it is possible to get the constructor of generic List, - // using GetConstructor on the generic type definition. To get - // the constructor of List, pass List and - // the constructor from generic List to the static - // TypeBuilder.GetConstructor method. - // - // - ILGenerator^ ilgen = exMethod->GetILGenerator(); - - Type^ ienumOf = IEnumerable::typeid; - Type^ TfromListOf = listOf->GetGenericArguments()[0]; - Type^ ienumOfT = ienumOf->MakeGenericType(TfromListOf); - array^ ctorArgs = {ienumOfT}; - - ConstructorInfo^ ctorPrep = listOf->GetConstructor(ctorArgs); - ConstructorInfo^ ctor = - TypeBuilder::GetConstructor(listOfTFirst, ctorPrep); - - ilgen->Emit(OpCodes::Ldarg_0); - ilgen->Emit(OpCodes::Newobj, ctor); - ilgen->Emit(OpCodes::Ret); - // - - // Create the type and save the assembly. - // - Type^ finished = myType->CreateType(); - myAssembly->Save( String::Concat( myAsmName->Name, L".dll" ) ); - // - - // Invoke the method. - // ExampleMethod is not generic, but the type it belongs to is - // generic, so in order to get a MethodInfo that can be invoked - // it is necessary to create a constructed type. The Example - // class satisfies the constraints on TFirst, because it is a - // reference type and has a default constructor. In order to - // have a class that satisfies the constraints on TSecond, - // this code example defines the ExampleDerived type. These - // two types are passed to MakeGenericMethod to create the - // constructed type. - // - // - array^ typeArgs = - { Example::typeid, ExampleDerived::typeid }; - Type^ constructed = finished->MakeGenericType(typeArgs); - MethodInfo^ mi = constructed->GetMethod("ExampleMethod"); - // - - // Create an array of Example objects, as input to the generic - // method. This array must be passed as the only element of an - // array of arguments. The first argument of Invoke is - // null, because ExampleMethod is static. Display the count - // on the resulting List. - // - // - array^ input = { gcnew Example(), gcnew Example() }; - array^ arguments = { input }; - - List^ listX = - (List^) mi->Invoke(nullptr, arguments); - - Console::WriteLine( - "\nThere are {0} elements in the List.", - listX->Count); - // - - DisplayGenericParameters(finished); -} - -/* This code example produces the following output: - -Type 'Sample' is generic: False -Type 'Sample' is generic: True - -There are 2 elements in the List. - -Listing 2 type parameters for type 'Sample[TFirst,TSecond]'. - -Type parameter TFirst: - ReferenceTypeConstraint - DefaultConstructorConstraint - -Type parameter TSecond: - Interface constraint: IExampleA - Interface constraint: IExampleB - Base type constraint: ExampleBase - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp deleted file mode 100644 index 3f5ffdf0349..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// System::Diagnostics::EntryWrittenEventArgs::ctor() - -/* -The following example demonstrates 'EntryWrittenEventArgs ()' -constructor of the 'EntryWrittenEventArgs' class. It creates a custom 'EventLog' -and writes an entry into it. Then creates an 'EntryWrittenEventArgs' Object* -using the first entry in the custom eventlog. This Object* is used to notify a message -*/ - -// -#using - -using namespace System; -using namespace System::Diagnostics; - -void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e ) -{ - if ( !e->Entry ) - Console::WriteLine( "A new entry is written in MyNewLog." ); -} - -int main() -{ - try - { - EventLog^ myNewLog = gcnew EventLog; - myNewLog->Log = "MyNewLog"; - myNewLog->Source = "MySource"; - - // Create the source if it does not exist already. - if ( !EventLog::SourceExists( "MySource" ) ) - { - EventLog::CreateEventSource( "MySource", "MyNewLog" ); - Console::WriteLine( "CreatingEventSource" ); - } - - // Write an entry to the EventLog. - myNewLog->WriteEntry( "The Latest entry in the Event Log" ); - int myEntries = myNewLog->Entries->Count; - EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ]; - EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs; - MyOnEntry( myNewLog, myEntryEventArgs ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Raised{0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp deleted file mode 100644 index 96f9f0f008b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// System::Diagnostics::EntryWrittenEventArgs::ctor(EventLogEntry) -// System::Diagnostics::EntryWrittenEventArgs::Entry - -/* -The following example demonstrates the 'Entry' property and EntryWrittenEventArgs (EventLogEntry) -constructor of the 'EntryWrittenEventArgs' class. It creates a custom 'EventLog' and writes an -entry into it. Then creates an 'EntryWrittenEventArgs' Object* using the first entry in the custom -eventlog. This Object* is used to notify a message -*/ - -// -#using - -using namespace System; -using namespace System::Diagnostics; - -// -void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e ) -{ - EventLogEntry^ myEventLogEntry = e->Entry; - if ( myEventLogEntry ) - { - Console::WriteLine( "Current message entry is: '{0}'", myEventLogEntry->Message ); - } - else - { - Console::WriteLine( "The current entry is null" ); - } -} -// - -int main() -{ - try - { - EventLog^ myNewLog = gcnew EventLog; - myNewLog->Log = "MyNewLog"; - myNewLog->Source = "MySource"; - - // Create the source if it does not exist already. - if ( !EventLog::SourceExists( "MySource" ) ) - { - EventLog::CreateEventSource( "MySource", "MyNewLog" ); - Console::WriteLine( "CreatingEventSource" ); - } - - // Write an entry to the EventLog. - myNewLog->WriteEntry( "The Latest entry in the Event Log" ); - int myEntries = myNewLog->Entries->Count; - EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ]; - EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs( entry ); - MyOnEntry( myNewLog, myEntryEventArgs ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Raised {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp deleted file mode 100644 index 47c3f438a04..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// System.Reflection.Emit.EnumBuilder.TypeToken -// System.Reflection.Emit.EnumBuilder.UnderlyingField -// System.Reflection.Emit.EnumBuilder.UnderlyingSystemType -// System.Reflection.Emit.EnumBuilder.GUID -/* The following program demonstrates 'TypeToken', 'UnderlyingField', - 'UnderlyingSystemType' and ''GUID' properties of - 'System.Reflection.Emit.EnumBuilder' class. This example defines - a class 'MyEnumBuilderSample'. The main function calls the CreateCalle - method in which the 'EnumBuilder' class and its fields are constructed. - The output of the 'EnumBuilder' properties are displayed on the console - in the main method. */ -// -// -// -// -using namespace System; -using namespace System::Collections; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -public ref class MyEnumBuilderSample -{ -private: - static AssemblyBuilder^ myAssemblyBuilder; - static ModuleBuilder^ myModuleBuilder; - static EnumBuilder^ myEnumBuilder; - -public: - static void Main() - { - try - { - CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save ); - array^myTypeArray = myModuleBuilder->GetTypes(); - IEnumerator^ myEnum = myTypeArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ myType = safe_cast(myEnum->Current); - Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name ); - } - Console::WriteLine( "Enum TypeToken is :{0}", myEnumBuilder->TypeToken ); - Console::WriteLine( "Enum UnderLyingField is :{0}", myEnumBuilder->UnderlyingField ); - Console::WriteLine( "Enum UnderLyingSystemType is :{0}", myEnumBuilder->UnderlyingSystemType ); - Console::WriteLine( "Enum GUID is :{0}", myEnumBuilder->GUID ); - myAssemblyBuilder->Save( "EmittedAssembly.dll" ); - } - catch ( NotSupportedException^ ex ) - { - Console::WriteLine( "The following is the exception is raised: {0}", ex->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following is the exception raised: {0}", e->Message ); - } - } - - -private: - static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ ) - { - // Create a name for the assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Create the dynamic assembly. - myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); - - // Create a dynamic module. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); - - // Create a dynamic Enum. - myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); - FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); - FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); - myEnumBuilder->CreateType(); - } -}; - -int main() -{ - MyEnumBuilderSample::Main(); -} -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp deleted file mode 100644 index e210b66486f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -// System.Reflection.Emit.EnumBuilder.Assembly -// System.Reflection.Emit.EnumBuilder.AssemblyQualifiedName -// System.Reflection.Emit.EnumBuilder.Module -// System.Reflection.Emit.EnumBuilder.Name -// System.Reflection.Emit.EnumBuilder.Namespace -/* The following program demonstrates 'Assembly', 'AssemblyQualifiedName', - 'Module', 'Name' and 'Namespace' properties of - 'System.Reflection.Emit.EnumBuilder' class. This example defines a - class 'MyEnumBuilderSample'. The main function calls the CreateCalle - method in which the 'EnumBuilder' class and its fields are constructed. - The output of the 'EnumBuilder' properties are displayed on the console - in the main method. */ -// -// -// -// -// -using namespace System; -using namespace System::Collections; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class MyEnumBuilderSample -{ -private: - static AssemblyBuilder^ myAssemblyBuilder; - static ModuleBuilder^ myModuleBuilder; - static EnumBuilder^ myEnumBuilder; - -public: - static void Main() - { - try - { - CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save ); - array^myTypeArray = myModuleBuilder->GetTypes(); - IEnumerator^ myEnum = myTypeArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ myType = safe_cast(myEnum->Current); - Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name ); - } - Console::WriteLine( "Properties of EnumBuilder : " ); - Console::WriteLine( "Enum Assembly is :{0}", myEnumBuilder->Assembly ); - Console::WriteLine( "Enum AssemblyQualifiedName is :{0}", myEnumBuilder->AssemblyQualifiedName ); - Console::WriteLine( "Enum Module is :{0}", myEnumBuilder->Module ); - Console::WriteLine( "Enum Name is :{0}", myEnumBuilder->Name ); - Console::WriteLine( "Enum NameSpace is :{0}", myEnumBuilder->Namespace ); - myAssemblyBuilder->Save( "EmittedAssembly.dll" ); - } - catch ( NotSupportedException^ ex ) - { - Console::WriteLine( "The following is the exception is raised: {0}", ex->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following is the exception raised: {0}", e->Message ); - } - } - -private: - static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ ) - { - // Create a name for the assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Create the dynamic assembly. - myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); - - // Create a dynamic module. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); - - // Create a dynamic Enum. - myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); - FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); - FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); - myEnumBuilder->CreateType(); - } -}; - -int main() -{ - MyEnumBuilderSample::Main(); -} -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp deleted file mode 100644 index 6fa6db382ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// System.Reflection.Emit.EnumBuilder -// System.Reflection.Emit.EnumBuilder.IsDefined() -// System.Reflection.Emit.EnumBuilder.GetCustomAttributes(Type, bool) -// System.Reflection.Emit.EnumBuilder.SetCustomAttribute(CustomAttributeBuilder) -/* - The following program demonstrates the EnumBuilder class and - its methods 'IsDefined', 'GetCustomAttributes(Type, bool)' and - 'SetCustomAttribute(CustomAttributeBuilder)'. It defines a 'MyAttribute' - class which is derived from 'System.Attribute' class. It builds an Enum - and sets 'MyAttribute' as custom attribute to the Enum. It gets the - custom attributes of the Enum type and displays its contents on the console. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute: public Attribute -{ -public: - String^ myString; - int myInteger; - MyAttribute( String^ myString1, int myInteger1 ) - { - this->myString = myString1; - this->myInteger = myInteger1; - } - -}; - -ref class MyApplication -{ -private: - static AssemblyBuilder^ myAssemblyBuilder; - static EnumBuilder^ myEnumBuilder; - -public: - static void Main() - { - try - { - CreateCallee( Thread::GetDomain() ); - if ( myEnumBuilder->IsDefined( MyAttribute::typeid, false ) ) - { - array^myAttributesArray = myEnumBuilder->GetCustomAttributes( MyAttribute::typeid, false ); - Console::WriteLine( "Custom attribute contains: " ); - - // Read the attributes and display them on the console. - for ( int index = 0; index < myAttributesArray->Length; index++ ) - { - if ( dynamic_cast(myAttributesArray[ index ]) ) - { - Console::WriteLine( "The value of myString is: {0}", (dynamic_cast(myAttributesArray[ index ]))->myString ); - Console::WriteLine( "The value of myInteger is: {0}", (dynamic_cast(myAttributesArray[ index ]))->myInteger ); - } - } - } - else - { - Console::WriteLine( "Custom Attributes are not set for the EnumBuilder" ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception is raised:{0}", e->Message ); - } - - } - -private: - static void CreateCallee( AppDomain^ domain ) - { - // Create a name for the assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Create the dynamic assembly. - myAssemblyBuilder = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - Type^ myType = MyAttribute::typeid; - array^temp0 = {String::typeid,int::typeid}; - ConstructorInfo^ myInfo = myType->GetConstructor( temp0 ); - array^temp1 = {"Hello",2}; - CustomAttributeBuilder^ myCustomAttributeBuilder = gcnew CustomAttributeBuilder( myInfo,temp1 ); - - // Create a dynamic module. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" ); - - // Create a dynamic Enum. - myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); - FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); - FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); - myEnumBuilder->CreateType(); - myEnumBuilder->SetCustomAttribute( myCustomAttributeBuilder ); - } -}; - -int main() -{ - MyApplication::Main(); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp deleted file mode 100644 index 2e1b90bdfc9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -// System.Reflection.Emit.EnumBuilder.GetCustomAttributes(bool) -// System.Reflection.Emit.EnumBuilder.SetCustomAttribute(ConstructorInfo, byte[]) -/* - The following program demonstrates 'GetCustomAttributes(bool)' - and 'SetCustomAttribute(ConstructorInfo, byte[])' methods of - 'System.Reflection.Emit.EnumBuilder' class. It defines 'MyAttribute' - class which is derived from 'System.Attribute' class. It builds an - Enum and sets 'MyAttribute' as custom attribute to the Enum. - It gets the custom attributes of the Enum type and displays its contents - on the console. -*/ -// -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute: public Attribute -{ -public: - bool myBoolValue; - MyAttribute( bool myBool ) - { - this->myBoolValue = myBool; - } -}; - -ref class MyApplication -{ -private: - static EnumBuilder^ myEnumBuilder; - -public: - static void Main() - { - try - { - CreateCallee( Thread::GetDomain() ); - array^myAttributesArray = myEnumBuilder->GetCustomAttributes( true ); - - // Read the attributes and display them on the console. - Console::WriteLine( "Custom attribute contains: " ); - for ( int index = 0; index < myAttributesArray->Length; index++ ) - { - if ( dynamic_cast(myAttributesArray[ index ]) ) - { - Console::WriteLine( "myBoolValue: {0}", (dynamic_cast(myAttributesArray[ index ]))->myBoolValue ); - } - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception is raised:{0}", e->Message ); - } - - } - -private: - static void CreateCallee( AppDomain^ domain ) - { - AssemblyName^ myAssemblyName = gcnew AssemblyName; - - // Create a name for the assembly. - myAssemblyName->Name = "EmittedAssembly"; - - // Create the dynamic assembly. - AssemblyBuilder^ myAssemblyBuilder = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - Type^ myType = MyAttribute::typeid; - array^temp0 = {bool::typeid}; - ConstructorInfo^ myInfo = myType->GetConstructor( temp0 ); - - // Create a dynamic module. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" ); - - // Create a dynamic Enum. - myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); - FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); - FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); - myEnumBuilder->CreateType(); - array^temp1 = {01,00,01}; - myEnumBuilder->SetCustomAttribute( myInfo, temp1 ); - } -}; - -int main() -{ - MyApplication::Main(); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp deleted file mode 100644 index 91579bc8326..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; - -int main() -{ - Console::WriteLine(); - - // Invoke this sample with an arbitrary set of command line arguments. - array^ arguments = Environment::GetCommandLineArgs(); - Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) ); -} -/* -This example produces output like the following: - - C:\>GetCommandLineArgs ARBITRARY TEXT - - GetCommandLineArgs: GetCommandLineArgs, ARBITRARY, TEXT -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp deleted file mode 100644 index e99e9275e62..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -int main() -{ - Console::WriteLine( "GetEnvironmentVariables: " ); - for each (DictionaryEntry^ de in Environment::GetEnvironmentVariables()) - Console::WriteLine( " {0} = {1}", de->Key, de->Value ); -} -// Output from the example is not shown, since it is: -// Lengthy. -// Specific to the machine on which the example is run. -// May reveal information that should remain secure. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp deleted file mode 100644 index 724d32024ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// Sample for the Environment::GetFolderPath method -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) ); -} - -/* -This example produces the following results: - -GetFolderPath: C:\WINNT\System32 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp deleted file mode 100644 index 214308f0a70..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -// -// Sample for the Environment::GetLogicalDrives method -using namespace System; -int main() -{ - Console::WriteLine(); - array^drives = Environment::GetLogicalDrives(); - Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) ); -} - -/* -This example produces the following results: - -GetLogicalDrives: A:\, C:\, D:\ -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp deleted file mode 100644 index 344e571ae41..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -// Sample for the Environment::MachineName property -using namespace System; -int main() -{ - Console::WriteLine(); - - // <-- Keep this information secure! --> - Console::WriteLine( "MachineName: {0}", Environment::MachineName ); -} - -/* -This example produces the following results: -(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) - -MachineName: !---OMITTED---! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp deleted file mode 100644 index f1681245632..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// Sample for the Environment::NewLine property -using namespace System; - -int main() -{ - Console::WriteLine(); - Console::WriteLine("NewLine: {0} first line {0} second line", Environment::NewLine); -} - -/* -This example produces the following results: - -NewLine: -first line -second line -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp deleted file mode 100644 index b6f0511a800..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -// Sample for the Environment::StackTrace property -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); -} - -/* -This example produces the following results: - -StackTrace: ' at System::Environment::GetStackTrace(Exception e) -at System::Environment::GetStackTrace(Exception e) -at System::Environment::get_StackTrace() -at Sample::Main()' -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp deleted file mode 100644 index 687b4f85405..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -// Sample for the Environment::SystemDirectory property -using namespace System; -int main() -{ - Console::WriteLine(); - - // <-- Keep this information secure! --> - Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory ); -} - -/* -This example produces the following results: - -SystemDirectory: C:\WINNT\System32 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp deleted file mode 100644 index 009bcb3a1d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -// Sample for the Environment::TickCount property -// TickCount cycles between Int32::MinValue, which is a negative -// number, and Int32::MaxValue once every 49.8 days. This sample -// removes the sign bit to yield a nonnegative number that cycles -// between zero and Int32::MaxValue once every 24.9 days. -using namespace System; -int main() -{ - int result = Environment::TickCount & Int32::MaxValue; - Console::WriteLine( "TickCount: {0}", result ); -} - -/* -This example produces an output similar to the following: - -TickCount: 101931139 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp deleted file mode 100644 index b3fe458162d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// Sample for the Environment::UserInteractive property -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive ); -} - -/* -This example produces the following results: - -UserInteractive: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp deleted file mode 100644 index 9fd924b3c30..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -// Sample for the Environment::UserName property -using namespace System; -int main() -{ - Console::WriteLine(); - - // <-- Keep this information secure! --> - Console::WriteLine( "UserName: {0}", Environment::UserName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp deleted file mode 100644 index cba784628bf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -// -// Sample for the Environment::Version property -using namespace System; -int main() -{ - Console::WriteLine(); - Console::WriteLine( "Version: {0}", Environment::Version ); -} - -/* -This example produces the following results: -(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) - -Version: !---OMITTED---! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp deleted file mode 100644 index 10d59ac8fe5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -// -// Sample for the Environment::WorkingSet property -using namespace System; -int main() -{ - Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet ); -} - -/* -This example produces the following results: - -WorkingSet: 5038080 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp b/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp deleted file mode 100644 index 1b826c1f2bc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -// The following example uses instances of classes in -// the System::Reflection namespace to discover an event argument type. -using namespace System; -using namespace System::Reflection; - -public delegate void MyDelegate( int i ); -public ref class MainClass -{ -public: - event MyDelegate^ ev; -}; - -int main() -{ - Type^ delegateType = MainClass::typeid->GetEvent( "ev" )->EventHandlerType; - MethodInfo^ invoke = delegateType->GetMethod( "Invoke" ); - array^pars = invoke->GetParameters(); - System::Collections::IEnumerator^ myEnum = pars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ParameterInfo^ p = safe_cast(myEnum->Current); - Console::WriteLine( p->ParameterType ); - } -} -// The example displays the following output: -// System.Int32 -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp deleted file mode 100644 index 54a15c9b13c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp +++ /dev/null @@ -1,110 +0,0 @@ - - -// System::Diagnostics::EventLogEntryType -// System::Diagnostics::EventLogEntryType::Error -// System::Diagnostics::EventLogEntryType::Warning -// System::Diagnostics::EventLogEntryType::Information -// System::Diagnostics::EventLogEntryType::FailureAudit -// System::Diagnostics::EventLogEntryType::SuccessAudit -/* The following program demonstrates 'Error', 'Warning', -'Information', 'FailureAudit' and 'SuccessAudit' members of -'EventLogEntryType' enumerator. It creates new source with a -specified event log, new ID, EventLogEntryType and message, -if does not exist. -*/ -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Runtime::Serialization; -void main() -{ - try - { - EventLog^ myEventLog; - String^ mySource = nullptr; - String^ myLog = nullptr; - String^ myType = nullptr; - String^ myMessage = "A new event is created."; - String^ myEventID = nullptr; - int myIntLog = 0; - int myID = 0; - Console::Write( "Enter source name for new event (eg: Print): " ); - mySource = Console::ReadLine(); - Console::Write( "Enter log name in which to write an event(eg: System): " ); - myLog = Console::ReadLine(); - Console::WriteLine( "" ); - Console::WriteLine( " Select type of event to write:" ); - Console::WriteLine( " 1. Error " ); - Console::WriteLine( " 2. Warning" ); - Console::WriteLine( " 3. Information" ); - Console::WriteLine( " 4. FailureAudit" ); - Console::WriteLine( " 5. SuccessAudit" ); - Console::Write( "Enter the choice(eg. 1): " ); - myType = Console::ReadLine(); - myIntLog = Convert::ToInt32( myType ); - Console::Write( "Enter ID with which to write an event(eg: 0-65535): " ); - myEventID = Console::ReadLine(); - myID = Convert::ToInt32( myEventID ); - - // - // Check whether source exist in event log. - if ( !EventLog::SourceExists( mySource ) ) - { - - // Create a new source in a specified log on a system. - EventLog::CreateEventSource( mySource, myLog ); - } - - // Create an event log instance.* myEventLog = new EventLog(myLog); - // Initialize source property of obtained instance. - myEventLog->Source = mySource; - switch ( myIntLog ) - { - case 1: - - // Write an 'Error' entry in specified log of event log. - myEventLog->WriteEntry( myMessage, EventLogEntryType::Error, myID ); - break; - - case 2: - - // Write a 'Warning' entry in specified log of event log. - myEventLog->WriteEntry( myMessage, EventLogEntryType::Warning, myID ); - break; - - case 3: - - // Write an 'Information' entry in specified log of event log. - myEventLog->WriteEntry( myMessage, EventLogEntryType::Information, myID ); - break; - - case 4: - - // Write a 'FailureAudit' entry in specified log of event log. - myEventLog->WriteEntry( myMessage, EventLogEntryType::FailureAudit, myID ); - break; - - case 5: - - // Write a 'SuccessAudit' entry in specified log of event log. - myEventLog->WriteEntry( myMessage, EventLogEntryType::SuccessAudit, myID ); - break; - - default: - Console::WriteLine( "Error: Failed to create an event in event log." ); - break; - } - Console::WriteLine( "A new event in log '{0}' with ID '{1}' is successfully written into event log.", myEventLog->Log, myID ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp deleted file mode 100644 index 6cb7dbb7107..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// System::Diagnostics::EventLogEntryCollection -// System::Diagnostics::EventLogEntryCollection::CopyTo(EventLogEntry->Item[],int) - -/* -The following example demonstrates the EventLogEntryCollection class and the -CopyTo method of EventLogEntryCollection class. A new Source for eventlog 'MyNewLog' -is created. A new entry is created for 'MyNewLog'. The entries of EventLog are copied -to an Array. -*/ - -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Diagnostics; -int main() -{ - try - { - String^ myLogName = "MyNewLog"; - - // Check if the source exists. - if ( !EventLog::SourceExists( "MySource" ) ) - { - //Create source. - EventLog::CreateEventSource( "MySource", myLogName ); - Console::WriteLine( "Creating EventSource" ); - } - else - myLogName = EventLog::LogNameFromSourceName( "MySource", "." ); - - // Get the EventLog associated if the source exists. - // Create an EventLog instance and assign its source. - EventLog^ myEventLog2 = gcnew EventLog; - myEventLog2->Source = "MySource"; - - // Write an informational entry to the event log. - myEventLog2->WriteEntry( "Successfully created a new Entry in the Log" ); - myEventLog2->Close(); - - // Create a new EventLog Object*. - EventLog^ myEventLog1 = gcnew EventLog; - myEventLog1->Log = myLogName; - - // Obtain the Log Entries of S"MyNewLog". - EventLogEntryCollection^ myEventLogEntryCollection = myEventLog1->Entries; - myEventLog1->Close(); - Console::WriteLine( "The number of entries in 'MyNewLog' = {0}", myEventLogEntryCollection->Count ); - - // Display the 'Message' property of EventLogEntry. - for ( int i = 0; i < myEventLogEntryCollection->Count; i++ ) - { - Console::WriteLine( "The Message of the EventLog is : {0}", myEventLogEntryCollection[ i ]->Message ); - } - - // Copy the EventLog entries to Array of type EventLogEntry. - array^myEventLogEntryArray = gcnew array(myEventLogEntryCollection->Count); - myEventLogEntryCollection->CopyTo( myEventLogEntryArray, 0 ); - IEnumerator^ myEnumerator = myEventLogEntryArray->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - { - EventLogEntry^ myEventLogEntry = safe_cast(myEnumerator->Current); - Console::WriteLine( "The LocalTime the Event is generated is {0}", myEventLogEntry->TimeGenerated ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp deleted file mode 100644 index 60cc220d29d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System::Diagnostics::EventLogEntryCollection->Count -// System::Diagnostics::EventLogEntryCollection::Item - -/* -The following example demonstrates 'Item','Count' properties of -EventLogEntryCollection class. A new Source for eventlog 'MyNewLog' is created. -The program checks if a Event source exists. If the source already exists, it gets -the Log name associated with it otherwise, creates a new event source. -A new entry is created for 'MyNewLog'.Entries of 'MyNewLog' are obtained and -the count and the messages are displayed. - -*/ - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Diagnostics; - -void main() -{ - try - { - String^ myLogName = "MyNewLog"; - - // Check if the source exists. - if ( !EventLog::SourceExists( "MySource" ) ) - { - - //Create source. - EventLog::CreateEventSource( "MySource", myLogName ); - Console::WriteLine( "Creating EventSource" ); - } - else - myLogName = EventLog::LogNameFromSourceName( "MySource", "." ); - - // Get the EventLog associated if the source exists. - // Create an EventLog instance and assign its source. - EventLog^ myEventLog2 = gcnew EventLog; - myEventLog2->Source = "MySource"; - - //Write an entry to the event log. - myEventLog2->WriteEntry( "Successfully created a new Entry in the Log. " ); - - // - // - // Create a new EventLog object. - EventLog^ myEventLog1 = gcnew EventLog; - myEventLog1->Log = myLogName; - - // Obtain the Log Entries of the Event Log - EventLogEntryCollection^ myEventLogEntryCollection = myEventLog1->Entries; - Console::WriteLine( "The number of entries in 'MyNewLog' = {0}", myEventLogEntryCollection->Count ); - - // Display the 'Message' property of EventLogEntry. - for ( int i = 0; i < myEventLogEntryCollection->Count; i++ ) - { - Console::WriteLine( "The Message of the EventLog is : {0}", myEventLogEntryCollection[ i ]->Message ); - } - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught! {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp deleted file mode 100644 index 2c9c0d22442..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// System::Diagnostics::EventLogEntry::EntryType -// System::Diagnostics::EventLogEntry::Source - -/* -The following example demonstrates the properties 'EntryType' and 'Source' -of the class 'EventLogEntry'. -A new instance of 'EventLog' class is created and is associated to existing -System Log file of local machine. User selects the event type and the latest -entry in the log file of that type and it's source is displayed. -*/ - -// -// -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - String^ myEventType = nullptr; - - // Associate the instance of 'EventLog' with local System Log. - EventLog^ myEventLog = gcnew EventLog( "System","." ); - Console::WriteLine( "1:Error" ); - Console::WriteLine( "2:Information" ); - Console::WriteLine( "3:Warning" ); - Console::WriteLine( "Select the Event Type" ); - int myOption = Convert::ToInt32( Console::ReadLine() ); - switch ( myOption ) - { - case 1: - myEventType = "Error"; - break; - - case 2: - myEventType = "Information"; - break; - - case 3: - myEventType = "Warning"; - break; - - default: - break; - } - EventLogEntryCollection^ myLogEntryCollection = myEventLog->Entries; - int myCount = myLogEntryCollection->Count; - - // Iterate through all 'EventLogEntry' instances in 'EventLog'. - for ( int i = myCount - 1; i > -1; i-- ) - { - EventLogEntry^ myLogEntry = myLogEntryCollection[ i ]; - - // Select the entry having desired EventType. - if ( myLogEntry->EntryType.Equals( myEventType ) ) - { - // Display Source of the event. - Console::WriteLine( "{0} was the source of last event of type {1}", myLogEntry->Source, myLogEntry->EntryType ); - return 0; - } - } -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp deleted file mode 100644 index 24f99e2bd0d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// System.Diagnostics.EventLogInstaller - -// The following example demonstrates the EventLogInstaller class. -// It defines the instance MyEventLogInstaller with the -// attribute RunInstallerAttribute. -// -// The Log and Source properties of the new instance are set, -// and the instance is added to the Installers collection. -// -// Note: -// 1) Run this program using the following command: -// InstallUtil.exe -// 2) Uninstall the event log created in step 1 using the -// following command: -// InstallUtil.exe /u - -// -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Diagnostics; -using namespace System::ComponentModel; - -[RunInstaller(true)] -ref class MyEventLogInstaller: public Installer -{ -private: - EventLogInstaller^ myEventLogInstaller; - -public: - MyEventLogInstaller() - { - // Create an instance of an EventLogInstaller. - myEventLogInstaller = gcnew EventLogInstaller; - - // Set the source name of the event log. - myEventLogInstaller->Source = "NewLogSource"; - - // Set the event log that the source writes entries to. - myEventLogInstaller->Log = "MyNewLog"; - - // Add myEventLogInstaller to the Installer collection. - Installers->Add( myEventLogInstaller ); - } -}; -// - -void main(){} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp deleted file mode 100644 index f89e23b187c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp +++ /dev/null @@ -1,187 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Globalization; -using namespace System::IO; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace Microsoft::Win32; -void GetNewOverflowSetting( OverflowAction * newOverflow, interior_ptr numDays ); -void DisplayEventLogProperties(); -void ChangeEventLogOverflowAction( String^ logName ); - -/// The main entry point for the sample application. - -[STAThread] -int main() -{ - DisplayEventLogProperties(); - Console::WriteLine(); - Console::WriteLine( "Enter the name of an event log to change the" ); - Console::WriteLine( "overflow policy (or press Enter to exit): " ); - String^ input = Console::ReadLine(); - if ( !String::IsNullOrEmpty( input ) ) - { - ChangeEventLogOverflowAction( input ); - } -} - - -// Prompt the user for the overflow policy setting. -void GetNewOverflowSetting( OverflowAction * newOverflow, interior_ptr numDays ) -{ - Console::Write( "Enter the new overflow policy setting [" ); - Console::Write( " OverwriteOlder," ); - Console::Write( " DoNotOverwrite," ); - Console::Write( " OverwriteAsNeeded" ); - Console::WriteLine( "] : " ); - String^ input = Console::ReadLine(); - if ( !String::IsNullOrEmpty( input ) ) - { - String^ INPUT = input->Trim()->ToUpper( CultureInfo::InvariantCulture ); - if ( INPUT->Equals( "OVERWRITEOLDER" ) ) - { - *newOverflow = OverflowAction::OverwriteOlder; - Console::WriteLine( "Enter the number of days to retain events: " ); - input = Console::ReadLine(); - - if ( ( !Int32::TryParse( input, *numDays )) || ( *numDays == 0) ) - { - Console::WriteLine( " Invalid input, defaulting to 7 days." ); - *numDays = 7; - } - } - else - if ( INPUT->Equals( "DONOTOVERWRITE" ) ) - { - *newOverflow = OverflowAction::DoNotOverwrite; - } - else - if ( INPUT->Equals( "OVERWRITEASNEEDED" ) ) - { - *newOverflow = OverflowAction::OverwriteAsNeeded; - } - else - Console::WriteLine( "Unrecognized overflow policy." ); - } - - Console::WriteLine(); -} - - -// -void DisplayEventLogProperties() -{ - - // Iterate through the current set of event log files, - // displaying the property settings for each file. - array^eventLogs = EventLog::GetEventLogs(); - System::Collections::IEnumerator^ myEnum = eventLogs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLog^ e = safe_cast(myEnum->Current); - Int64 sizeKB = 0; - Console::WriteLine(); - Console::WriteLine( "{0}:", e->LogDisplayName ); - Console::WriteLine( " Log name = \t\t {0}", e->Log ); - Console::WriteLine( " Number of event log entries = {0}", e->Entries->Count ); - - // Determine if there is a file for this event log. - RegistryKey ^ regEventLog = Registry::LocalMachine->OpenSubKey( String::Format( "System\\CurrentControlSet\\Services\\EventLog\\{0}", e->Log ) ); - if ( regEventLog ) - { - Object^ temp = regEventLog->GetValue( "File" ); - if ( temp != nullptr ) - { - Console::WriteLine( " Log file path = \t {0}", temp ); - FileInfo^ file = gcnew FileInfo( temp->ToString() ); - - // Get the current size of the event log file. - if ( file->Exists ) - { - sizeKB = file->Length / 1024; - if ( (file->Length % 1024) != 0 ) - { - sizeKB++; - } - Console::WriteLine( " Current size = \t {0} kilobytes", sizeKB ); - } - } - else - { - Console::WriteLine( " Log file path = \t " ); - } - } - - // Display the maximum size and overflow settings. - sizeKB = e->MaximumKilobytes; - Console::WriteLine( " Maximum size = \t {0} kilobytes", sizeKB ); - Console::WriteLine( " Overflow setting = \t {0}", e->OverflowAction ); - switch ( e->OverflowAction ) - { - case OverflowAction::OverwriteOlder: - Console::WriteLine( "\t Entries are retained a minimum of {0} days.", e->MinimumRetentionDays ); - break; - - case OverflowAction::DoNotOverwrite: - Console::WriteLine( "\t Older entries are not overwritten." ); - break; - - case OverflowAction::OverwriteAsNeeded: - Console::WriteLine( "\t If number of entries equals max size limit, a new event log entry overwrites the oldest entry." ); - break; - - default: - break; - } - } -} - - -// -// -// Display the current event log overflow settings, and -// prompt the user to input a new overflow setting. -void ChangeEventLogOverflowAction( String^ logName ) -{ - if ( EventLog::Exists( logName ) ) - { - - // Display the current overflow setting of the - // specified event log. - EventLog^ inputLog = gcnew EventLog( logName ); - Console::WriteLine( " Event log {0}", inputLog->Log ); - OverflowAction logOverflow = inputLog->OverflowAction; - Int32 numDays = inputLog->MinimumRetentionDays; - Console::WriteLine( " Current overflow setting = {0}", logOverflow ); - if ( logOverflow == OverflowAction::OverwriteOlder ) - { - Console::WriteLine( "\t Entries are retained a minimum of {0} days.", numDays ); - } - - // Prompt user for a new overflow setting. - GetNewOverflowSetting( &logOverflow, &numDays ); - - // Change the overflow setting on the event log. - if ( logOverflow != inputLog->OverflowAction ) - { - inputLog->ModifyOverflowPolicy( logOverflow, numDays ); - Console::WriteLine( "Event log overflow policy was modified successfully!" ); - } - else - { - Console::WriteLine( "Event log overflow policy was not modified." ); - } - } - else - { - Console::WriteLine( "Event log {0} was not found.", logName ); - } -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp deleted file mode 100644 index f61b7647435..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp +++ /dev/null @@ -1,137 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Globalization; -using namespace System::Diagnostics; - -[STAThread] -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // - EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( "","" ); - bool registerSource = true; - - // Process input parameters. - if ( args->Length > 1 ) - { - - // Require at least the source name. - mySourceData->Source = args[ 1 ]; - if ( args->Length > 2 ) - { - mySourceData->LogName = args[ 2 ]; - } - - if ( args->Length > 3 ) - { - mySourceData->MachineName = args[ 3 ]; - } - - if ( (args->Length > 4) && (args[ 4 ]->Length > 0) ) - { - mySourceData->MessageResourceFile = args[ 4 ]; - } - } - else - { - - // Display a syntax help message. - Console::WriteLine( "Input:" ); - Console::WriteLine( " source [event log] [machine name] [resource file]" ); - registerSource = false; - } - - - // Set defaults for parameters missing input. - if ( mySourceData->MachineName->Length == 0 ) - { - - // Default to the local computer. - mySourceData->MachineName = "."; - } - - if ( mySourceData->LogName->Length == 0 ) - { - - // Default to the Application log. - mySourceData->LogName = "Application"; - } - - - // - // Determine if the source exists on the specified computer. - if ( !EventLog::SourceExists( mySourceData->Source, mySourceData->MachineName ) ) - { - - // The source does not exist. - // Verify that the message file exists - // and the event log is local. - if ( (mySourceData->MessageResourceFile != nullptr) && (mySourceData->MessageResourceFile->Length > 0) ) - { - if ( mySourceData->MachineName->Equals( "." ) ) - { - if ( !System::IO::File::Exists( mySourceData->MessageResourceFile ) ) - { - Console::WriteLine( "File {0} not found - message file not set for source.", mySourceData->MessageResourceFile ); - registerSource = false; - } - } - else - { - - // For simplicity, do not allow setting the message - // file for a remote event log. To set the message - // for a remote event log, and for source registration, - // the file path should be specified with system-wide - // environment variables that are valid on the remote - // computer, such as - // "%SystemRoot%\system32\myresource.dll". - Console::WriteLine( "Message resource file ignored for remote event log." ); - registerSource = false; - } - } - } - else - { - - // Do not register the source, it already exists. - registerSource = false; - - // Get the event log corresponding to the existing source. - String^ sourceLog; - sourceLog = EventLog::LogNameFromSourceName( mySourceData->Source, mySourceData->MachineName ); - - // Determine if the event source is registered for the - // specified log. - if ( sourceLog->ToUpper( CultureInfo::InvariantCulture ) != mySourceData->LogName->ToUpper( CultureInfo::InvariantCulture ) ) - { - - // An existing source is registered - // to write to a different event log. - Console::WriteLine( "Warning: source {0} is already registered to write to event log {1}", mySourceData->Source, sourceLog ); - } - else - { - - // The source is already registered - // to write to the specified event log. - Console::WriteLine( "Source {0} already registered to write to event log {1}", mySourceData->Source, sourceLog ); - } - } - - if ( registerSource ) - { - - // Register the new event source for the specified event log. - Console::WriteLine( "Registering new source {0} for event log {1}.", mySourceData->Source, mySourceData->LogName ); - EventLog::CreateEventSource( mySourceData ); - Console::WriteLine( "Event source was registered successfully!" ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp deleted file mode 100644 index 07109b189ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// System::Diagnostics::EventLog::Exists(String) -/* -The following sample demonstrates the 'Exists(String)'method of -'EventLog' class. It checks for the existence of a log and displays -the result accordingly. -*/ -#using - -using namespace System; -using namespace System::Diagnostics; -void main() -{ - try - { - - // - String^ myLog = "myNewLog"; - if ( EventLog::Exists( myLog ) ) - { - Console::WriteLine( "Log '{0}' exists.", myLog ); - } - else - { - Console::WriteLine( "Log '{0}' does not exist.", myLog ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp deleted file mode 100644 index 663444e9b51..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Diagnostics::EventLog::WriteEntry(String, String, EventLogEntryType, Int32, Int16) -// System::Diagnostics::EventLog::WriteEntry(String, String, EventLogEntryType, Int32, Int16, Byte->Item[]) -// System::Diagnostics::EventLog::EventLog.WriteEntry(String, EventLogEntryType, Int32, Int16) - -/* The following example demonstrates the method -'WriteEntry(String, String, EventLogEntryType, Int32, Int16)', -'WriteEntry(String, String, EventLogEntryType, Int32, Int16, Byte->Item[]) ' -and 'WriteEntry(String, EventLogEntryType, Int32, Int16)' of class -'EventLog'. The following example writes the information to an event log. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - // - int myEventID = 20; - short myCategory = 10; - - // Write an informational entry to the event log. - Console::WriteLine( "Write from first source " ); - EventLog::WriteEntry( "FirstSource", "Writing warning to event log.", - EventLogEntryType::Information, myEventID, myCategory ); - // - - // - //Create a byte array for binary data to associate with the entry. - array^myByte = gcnew array(10); - //Populate the byte array with simulated data. - for ( int i = 0; i < 10; i++ ) - { - myByte[ i ] = (Byte)(i % 2); - } - //Write an entry to the event log that includes associated binary data. - Console::WriteLine( "Write from second source " ); - EventLog::WriteEntry( "SecondSource", "Writing warning to event log.", - EventLogEntryType::Error, myEventID, myCategory, myByte ); - // - - // - // Create an EventLog instance and assign its source. - EventLog^ myLog = gcnew EventLog; - myLog->Source = "ThirdSource"; - - // Write an informational entry to the event log. - Console::WriteLine( "Write from third source " ); - myLog->WriteEntry( "Writing warning to event log.", - EventLogEntryType::Warning, myEventID, myCategory ); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp deleted file mode 100644 index 5d40a7c71c9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// System::Diagnostics::EventLog::WriteEntry(String,String,EventLogEntryType,Int32) - -/* -The following sample demonstrates the -'WriteEntry(String,String,EventLogEntryType,Int32)' method of -'EventLog' class. It writes an entry to a custom event log, S"MyNewLog". -It creates the source S"MySource" if the source does not already exist. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - try - { -// - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - EventLog::CreateEventSource( "MySource", "myNewLog" ); - Console::WriteLine( "Creating EventSource" ); - } - - // Set the 'description' for the event. - String^ myMessage = "This is my event."; - EventLogEntryType myEventLogEntryType = EventLogEntryType::Warning; - int myApplicationEventId = 100; - - // Write the entry in the event log. - Console::WriteLine( "Writing to EventLog.. " ); - EventLog::WriteEntry( "MySource", myMessage, - myEventLogEntryType, myApplicationEventId ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception:{0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp deleted file mode 100644 index 4771b4f0eb5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Diagnostics::EventLog::WriteEntry(String, EventLogEntryType, Int32, Int16, Byte[]) - -/* -The following sample demonstrates the -'WriteEntry(String, EventLogEntryType, Int32, Int16, Byte->Item[])' method of -'EventLog' class. It writes an entry to a custom event log, S"MyLog". -It creates the source S"MySource" if the source does not already exist. -It creates an 'EventLog' Object* and calls 'WriteEntry' passing the -description, Log entry type, application specific identifier for the event, -application specific subcategory and data to be associated with the entry. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - try - { -// - // Create the source, if it does not already exist. - String^ myLogName = "myNewLog"; - if ( !EventLog::SourceExists( "MySource" ) ) - { - EventLog::CreateEventSource( "MySource", myLogName ); - Console::WriteLine( "Creating EventSource" ); - } - else - myLogName = EventLog::LogNameFromSourceName( "MySource", "." ); - - // Create an EventLog and assign source. - EventLog^ myEventLog = gcnew EventLog; - myEventLog->Source = "MySource"; - myEventLog->Log = myLogName; - - // Set the 'description' for the event. - String^ myMessage = "This is my event."; - EventLogEntryType myEventLogEntryType = EventLogEntryType::Warning; - int myApplicatinEventId = 1100; - short myApplicatinCategoryId = 1; - - // Set the 'data' for the event. - array^ myRawData = gcnew array(4); - for ( int i = 0; i < 4; i++ ) - { - myRawData[ i ] = 1; - } - Console::WriteLine( "Writing to EventLog.. " ); - myEventLog->WriteEntry( myMessage, myEventLogEntryType, myApplicatinEventId, myApplicatinCategoryId, myRawData ); -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception:{0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp b/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp deleted file mode 100644 index c94bc78e16b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; - -public ref class TestClass{}; - -int main() -{ - TestClass^ test = gcnew TestClass; - array^ objectsToCompare = { test, test->ToString(), 123, - (123).ToString(), "some text", - "Some Text" }; - String^ s = "some text"; - for each (Object^ objectToCompare in objectsToCompare) { - try { - Int32 i = s->CompareTo(objectToCompare); - Console::WriteLine("Comparing '{0}' with '{1}': {2}", - s, objectToCompare, i); - } - catch (ArgumentException^ e) { - Console::WriteLine("Bad argument: {0} (type {1})", - objectToCompare, - objectToCompare->GetType()->Name); - } - } -} -// The example displays the following output: -// Bad argument: TestClass (type TestClass) -// Comparing 'some text' with 'TestClass': -1 -// Bad argument: 123 (type Int32) -// Comparing 'some text' with '123': 1 -// Comparing 'some text' with 'some text': 0 -// Comparing 'some text' with 'Some Text': -1 -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp deleted file mode 100644 index f18b6e52fe0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - FileInfo^ fi = gcnew FileInfo( "c:\\MyTest.txt" ); - - // This text is added only once to the file. - if ( !fi->Exists ) - { - //Create a file to write to. - StreamWriter^ sw = fi->CreateText(); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - } - - // This text will always be added, making the file longer over time - // if it is not deleted. - StreamWriter^ sw = fi->AppendText(); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is Extra" ); - sw->WriteLine( "Text" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - - //Open the file to read from. - StreamReader^ sr = fi->OpenText(); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//Hello -//And -//Welcome -//This -//is Extra -//Text -// -//When you run this application a second time, you will see the following output: -// -//Hello -//And -//Welcome -//This -//is Extra -//Text -//This -//is Extra -//Text -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp deleted file mode 100644 index cd1f26bb6ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = Path::GetTempFileName(); - FileInfo^ fi1 = gcnew FileInfo( path ); - //Create a file to write to. - StreamWriter^ sw = fi1->CreateText(); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - - //Open the file to read from. - StreamReader^ sr = fi1->OpenText(); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } - - try - { - String^ path2 = Path::GetTempFileName(); - FileInfo^ fi2 = gcnew FileInfo( path2 ); - - //Ensure that the target does not exist. - fi2->Delete(); - - //Copy the file. - fi1->CopyTo( path2 ); - Console::WriteLine( "{0} was copied to {1}.", path, path2 ); - - //Delete the newly created file. - fi2->Delete(); - Console::WriteLine( "{0} was successfully deleted.", path2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp deleted file mode 100644 index 457a43483a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - String^ path2 = "c:\\MyTest.txttemp"; - FileInfo^ fi1 = gcnew FileInfo( path ); - FileInfo^ fi2 = gcnew FileInfo( path2 ); - try - { - // Create the file and clean up handles. - FileStream^ fs = fi1->Create(); - if ( fs ) - delete (IDisposable^)fs; - - //Ensure that the target does not exist. - fi2->Delete(); - - //Copy the file. - fi1->CopyTo( path2 ); - Console::WriteLine( "{0} was copied to {1}.", path, path2 ); - - //Try to copy it again, which should succeed. - fi1->CopyTo( path2, true ); - Console::WriteLine( "The second Copy operation succeeded, which is expected." ); - } - catch ( Exception^ ) - { - Console::WriteLine( "Double copying was not allowed, which is not expected." ); - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//The second Copy operation succeeded, which is expected. -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp deleted file mode 100644 index 8533b4ee458..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi = gcnew FileInfo( path ); - - // Delete the file if it exists. - if ( fi->Exists ) - { - fi->Delete(); - } - - //Create the file. - FileStream^ fs = fi->Create(); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - //Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - - //Open the stream and read it back. - StreamReader^ sr = fi->OpenText(); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} - -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is some text in the file. -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp deleted file mode 100644 index eecfff022ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi = gcnew FileInfo( path ); - if ( !fi->Exists ) - { - //Create a file to write to. - StreamWriter^ sw = fi->CreateText(); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - } - - //Open the file to read from. - StreamReader^ sr = fi->OpenText(); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//Hello -//And -//Welcome -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp deleted file mode 100644 index d0901ff161a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi1 = gcnew FileInfo( path ); - if ( !fi1->Exists ) - { - //Create a file to write to. - StreamWriter^ sw = fi1->CreateText(); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - } - - //Open the file to read from. - StreamReader^ sr = fi1->OpenText(); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } - - try - { - String^ path2 = String::Concat( path, "temp" ); - FileInfo^ fi2 = gcnew FileInfo( path2 ); - - //Ensure that the target does not exist. - fi2->Delete(); - - //Copy the file. - fi1->CopyTo( path2 ); - Console::WriteLine( "{0} was copied to {1}.", path, path2 ); - - //Delete the newly created file. - fi2->Delete(); - Console::WriteLine( "{0} was successfully deleted.", path2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} - -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//Hello -//And -//Welcome -//c:\MyTest.txt was copied to c:\MyTest.txttemp. -//c:\MyTest.txttemp was successfully deleted. -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp deleted file mode 100644 index c219e088f8c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi1 = gcnew FileInfo( path ); - try - { - StreamWriter^ sw = fi1->CreateText(); - if ( sw ) - delete (IDisposable^)sw; - - String^ path2 = String::Concat( path, "temp" ); - FileInfo^ fi2 = gcnew FileInfo( path2 ); - - //Ensure that the target does not exist. - fi2->Delete(); - - //Copy the file. - fi1->CopyTo( path2 ); - Console::WriteLine( "{0} was copied to {1}.", path, path2 ); - - //Delete the newly created file. - fi2->Delete(); - Console::WriteLine( "{0} was successfully deleted.", path2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//c:\MyTest.txt was copied to c:\MyTest.txttemp. -//c:\MyTest.txttemp was successfully deleted. -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp deleted file mode 100644 index 052607a8faf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi = gcnew FileInfo( path ); - - // Delete the file if it exists. - if ( !fi->Exists ) - { - //Create the file. - FileStream^ fs = fi->Create(); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - //Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - //Open the stream and read it back. - FileStream^ fs = fi->Open( FileMode::Open ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} - -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is some text in the file. -// -// -// -// -// -// -// -// -// -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp deleted file mode 100644 index 7996e15f1cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi = gcnew FileInfo( path ); - - // Delete the file if it exists. - if ( !fi->Exists ) - { - - //Create the file. - FileStream^ fs = fi->Create(); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - //Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - //Open the stream and read it back. - FileStream^ fs = fi->Open( FileMode::Open, FileAccess::Read ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - try - { - //Try to write to the file. - fs->Write( b, 0, b->Length ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Writing was disallowed, as expected: {0}", e ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is some text in the file. -// -// -// -// -// -// -// -// -// -// -// -// -//Writing was disallowed, as expected: System.NotSupportedException: Stream does -//not support writing. -// at System.IO.__Error.WriteNotSupported() -// at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) -// at main() in c:\documents and settings\MyComputer\my documents\ -//visual studio 2005\projects\finfo open2\finfo open2\ -//cpp_console_application.cpp:line 46 -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp deleted file mode 100644 index f81348f3afa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\MyTest.txt"; - FileInfo^ fi = gcnew FileInfo( path ); - - // Delete the file if it exists. - if ( !fi->Exists ) - { - //Create the file. - FileStream^ fs = fi->Create(); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - //Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - //Open the stream and read it back. - FileStream^ fs = fi->OpenRead(); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is some text in the file. -// -// -// -// -// -// -// -// -// -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp deleted file mode 100644 index 3868e7e68fb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -public ref class OpenTextTest -{ -public: - static void Main() - { - String^ path = "c:\\MyTest.txt"; - - FileInfo^ fi = gcnew FileInfo(path); - - // Check for existing file - if (!fi->Exists) - { - // Create the file. - FileStream^ fs = fi->Create(); - array^ info = - (gcnew UTF8Encoding(true))->GetBytes("This is some text in the file."); - - // Add some information to the file. - fs->Write(info, 0, info->Length); - fs->Close(); - } - - // Open the stream and read it back. - StreamReader^ sr = fi->OpenText(); - String^ s = ""; - while ((s = sr->ReadLine()) != nullptr) - { - Console::WriteLine(s); - } - } -}; - -int main() -{ - OpenTextTest::Main(); -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is some text in the file. -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp deleted file mode 100644 index e4a0ca98bdb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\Temp\\MyTest.txt"; - FileInfo^ fi = gcnew FileInfo( path ); - - // Open the stream for writing. - { - FileStream^ fs = fi->OpenWrite(); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is to test the OpenWrite method." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - // Open the stream and read it back. - { - FileStream^ fs = fi->OpenRead(); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is to test the OpenWrite method. -// -// -// -// -// -// -// -// -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp b/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp deleted file mode 100644 index e79c45b3672..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Delete the file if it exists. - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - - //Create the file. - FileStream^ fs = File::Create( path ); - try - { - if ( fs->CanSeek ) - { - Console::WriteLine( "The stream connected to {0} is seekable.", path ); - } - else - { - Console::WriteLine( "The stream connected to {0} is not seekable.", path ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp b/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp deleted file mode 100644 index 7dd44acda66..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Ensure that the file is readonly. - File::SetAttributes( path, static_cast(File::GetAttributes( path ) | FileAttributes::ReadOnly) ); - - //Create the file. - FileStream^ fs = gcnew FileStream( path,FileMode::OpenOrCreate,FileAccess::Read ); - try - { - if ( fs->CanWrite ) - { - Console::WriteLine( "The stream for file {0} is writable.", path ); - } - else - { - Console::WriteLine( "The stream for file {0} is not writable.", path ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp b/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp deleted file mode 100644 index cc2e6916562..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -void AddText( FileStream^ fs, String^ value ) -{ - array^info = (gcnew UTF8Encoding( true ))->GetBytes( value ); - fs->Write( info, 0, info->Length ); -} - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Delete the file if it exists. - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - - //Create the file. - { - FileStream^ fs = File::Create( path ); - try - { - AddText( fs, "This is some text" ); - AddText( fs, "This is some more text," ); - AddText( fs, "\r\nand this is on a new line" ); - AddText( fs, "\r\n\r\nThe following is a subset of characters:\r\n" ); - for ( int i = 1; i < 120; i++ ) - { - AddText( fs, Convert::ToChar( i ).ToString() ); - - //Split the output at every 10th character. - if ( Math::IEEERemainder( Convert::ToDouble( i ), 10 ) == 0 ) - { - AddText( fs, "\r\n" ); - } - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - //Open the stream and read it back. - { - FileStream^ fs = File::OpenRead( path ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp deleted file mode 100644 index 8b038438f4b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp +++ /dev/null @@ -1,84 +0,0 @@ - -// System::Reflection::Emit::FieldBuilder.ReflectedType -// System::Reflection::Emit::FieldBuilder.Attributes -/* - The following example demonstrates 'ReflectedType' and 'Attributes' - properties of 'FieldBuilder' class.A new class 'MyClass' is created. - A Field and a method are defined in the class.In the constructor of the class - the field is initialized.Method of the class gets the value of the Field. - An instance of the class is created and method is invoked. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ CreateType( AppDomain^ currentDomain ) -{ - // Create an assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "DynamicAssembly"; - AssemblyBuilder^ myAssembly = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module in Dynamic Assembly. - ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "MyModule" ); - - // Define a public class named S"MyClass" in the assembly. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyClass", TypeAttributes::Public ); - - // Define a private String field named S"MyField" in the type. - FieldBuilder^ myFieldBuilder = myTypeBuilder->DefineField( "MyField", String::typeid, static_cast(FieldAttributes::Private | FieldAttributes::Static) ); - - // Create the constructor. - array^constructorArgs = {String::typeid}; - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, constructorArgs ); - ILGenerator^ constructorIL = myConstructor->GetILGenerator(); - constructorIL->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ superConstructor = Object::typeid->GetConstructor( gcnew array(0) ); - constructorIL->Emit( OpCodes::Call, superConstructor ); - constructorIL->Emit( OpCodes::Ldarg_0 ); - constructorIL->Emit( OpCodes::Ldarg_1 ); - constructorIL->Emit( OpCodes::Stfld, myFieldBuilder ); - constructorIL->Emit( OpCodes::Ret ); - - // Create the MyMethod method. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, String::typeid, nullptr ); - ILGenerator^ methodIL = myMethodBuilder->GetILGenerator(); - methodIL->Emit( OpCodes::Ldarg_0 ); - methodIL->Emit( OpCodes::Ldfld, myFieldBuilder ); - methodIL->Emit( OpCodes::Ret ); - if ( myFieldBuilder->Attributes.Equals( FieldAttributes::Static ) ) - { - Console::WriteLine( "Field attribute defined as Static" ); - } - else - if ( myFieldBuilder->Attributes.Equals( FieldAttributes::Static | FieldAttributes::Private ) ) - { - Console::WriteLine( "Field attributes are Static and Private" ); - } - - - Console::WriteLine( "ReflectedType of Field is : {0}", myFieldBuilder->ReflectedType ); - return myTypeBuilder->CreateType(); -} - -int main() -{ - try - { - Type^ myType = CreateType( Thread::GetDomain() ); - - // Create an instance of the S"HelloWorld" class. - array^type = {"HelloWorld"}; - Object^ helloWorld = Activator::CreateInstance( myType, type ); - - // Invoke the S"MyMethod" of the S"MyClass". - Object^ myObject = myType->InvokeMember( "MyMethod", BindingFlags::InvokeMethod, nullptr, helloWorld, nullptr ); - Console::WriteLine( "MyClass::MyMethod returned: \"{0}\"", myObject ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp deleted file mode 100644 index fab865dd934..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp +++ /dev/null @@ -1,132 +0,0 @@ - -// System::Reflection::Emit::FieldBuilder.SetCustomAttribute(ConstructorInfo, Byte->Item[]) -// System::Reflection::Emit::FieldBuilder.SetCustomAttribute(CustomAttributeBuilder) -/* - The following program demonstrates 'SetCustomAttribute(ConstructorInfo, Byte[])' - and 'SetCustomAttribute(CustomAttributeBuilder)' methods of 'FieldBuilder' class. - A dynamic assembly is created. A new class of type 'MyClass' is created. - A 'Method' and a 'Field are defined in the class.Two 'CustomAttributes' are - set to the field. The method initializes a value to 'Field'.Value of the field - is displayed to console.Values of Attributes applied to field are retrieved and - displayed to console. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute1: public Attribute -{ -public: - String^ myCustomAttributeValue; - MyAttribute1( String^ myString ) - { - myCustomAttributeValue = myString; - } -}; - - -[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] -public ref class MyAttribute2: public Attribute -{ -public: - bool myCustomAttributeValue; - MyAttribute2( bool myBool ) - { - myCustomAttributeValue = myBool; - } -}; - -Type^ CreateCallee( AppDomain^ currentDomain ) -{ - // Create a simple name for the assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Create the called dynamic assembly. - AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); - - // Define a public class named 'CustomClass' in the assembly. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "CustomClass", TypeAttributes::Public ); - - // Define a private String field named 'MyField' in the type. - FieldBuilder^ myFieldBuilder = myTypeBuilder->DefineField( "MyField", String::typeid, FieldAttributes::Public ); - Type^ myAttributeType1 = MyAttribute1::typeid; - - // Create a Constructorinfo Object* for attribute 'MyAttribute1'. - array^type1 = {String::typeid}; - ConstructorInfo^ myConstructorInfo = myAttributeType1->GetConstructor( type1 ); - - // Create the CustomAttribute instance of attribute of type 'MyAttribute1'. - array^obj1 = {"Test"}; - CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 ); - - // Set the CustomAttribute 'MyAttribute1' to the Field. - myFieldBuilder->SetCustomAttribute( attributeBuilder ); - Type^ myAttributeType2 = MyAttribute2::typeid; - - // Create a Constructorinfo Object* for attribute 'MyAttribute2'. - array^type2 = {bool::typeid}; - ConstructorInfo^ myConstructorInfo2 = myAttributeType2->GetConstructor( type2 ); - - // Set the CustomAttribute 'MyAttribute2' to the Field. - array^bytes = {01,00,01,00,00}; - myFieldBuilder->SetCustomAttribute( myConstructorInfo2, bytes ); - - // Create a method. - array^type3 = {String::typeid,int::typeid}; - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, nullptr, type3 ); - ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); - myILGenerator->Emit( OpCodes::Ldarg_0 ); - myILGenerator->Emit( OpCodes::Ldarg_1 ); - myILGenerator->Emit( OpCodes::Stfld, myFieldBuilder ); - myILGenerator->EmitWriteLine( "Value of the Field is :" ); - myILGenerator->EmitWriteLine( myFieldBuilder ); - myILGenerator->Emit( OpCodes::Ret ); - return myTypeBuilder->CreateType(); -} - -int main() -{ - try - { - Type^ myCustomClass = CreateCallee( Thread::GetDomain() ); - - // Construct an instance of a type. - Object^ myObject = Activator::CreateInstance( myCustomClass ); - Console::WriteLine( "FieldBuilder Sample" ); - - // Find a method in this type and call it on this Object*. - MethodInfo^ myMethodInfo = myCustomClass->GetMethod( "MyMethod" ); - array^obj1 = {"Sample string",3}; - myMethodInfo->Invoke( myObject, obj1 ); - - // Retrieve the values of Attributes applied to field and display to console. - array^myFieldInfo = myCustomClass->GetFields(); - for ( int i = 0; i < myFieldInfo->Length; i++ ) - { - array^attributes = myFieldInfo[ i ]->GetCustomAttributes( true ); - for ( int index = 0; index < attributes->Length; index++ ) - { - if ( dynamic_cast(attributes[ index ]) ) - { - MyAttribute1^ myCustomAttribute = safe_cast(attributes[ index ]); - Console::WriteLine( "Attribute Value of (MyAttribute1): {0}", myCustomAttribute->myCustomAttributeValue ); - } - if ( dynamic_cast(attributes[ index ]) ) - { - MyAttribute2^ myCustomAttribute = safe_cast(attributes[ index ]); - Console::WriteLine( "Attribute Value of (MyAttribute2): {0}", myCustomAttribute->myCustomAttributeValue ); - } - } - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp deleted file mode 100644 index 0fe41fc175c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp +++ /dev/null @@ -1,74 +0,0 @@ - -// System::Reflection::Emit::FieldBuilder.SetOffset -// System::Reflection::Emit::FieldBuilder.SetMarshal -/* - The following program demonstrates 'SetOffset' and 'SetMarshal' - methods of 'FieldBuilder' class.A new Class is defined and a - 'PInvoke' method 'OpenFile' method of 'Kernel32.dll' is defined - in the class.Instance of the class is created and the method is invoked. - To execute this program, make sure a file named 'MyFile.txt' should be there - in the current directory. -*/ -// -using namespace System; -using namespace System::Runtime::InteropServices; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -Type^ CreateType( AppDomain^ currentDomain ) -{ - // Create an assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "DynamicAssembly"; - AssemblyBuilder^ myAssembly = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a dynamic module in Dynamic Assembly. - ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "MyModule", "MyModule.mod" ); - - // Define a public class named S"MyClass" in the assembly. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyClass", TypeAttributes::Public ); - TypeBuilder^ myTypeBuilder2 = myModuleBuilder->DefineType( "MyClass2", static_cast(TypeAttributes::Public | TypeAttributes::BeforeFieldInit | TypeAttributes::SequentialLayout | TypeAttributes::AnsiClass | TypeAttributes::Sealed) ); - FieldBuilder^ myFieldBuilder1 = myTypeBuilder2->DefineField( "myBytes1", Byte::typeid, FieldAttributes::Public ); - FieldBuilder^ myFieldBuilder2 = myTypeBuilder2->DefineField( "myBytes2", Byte::typeid, FieldAttributes::Public ); - FieldBuilder^ myFieldBuilder3 = myTypeBuilder2->DefineField( "myErrorCode", short::typeid, FieldAttributes::Public ); - FieldBuilder^ myFieldBuilder4 = myTypeBuilder2->DefineField( "myReserved1", short::typeid, FieldAttributes::Public ); - FieldBuilder^ myFieldBuilder5 = myTypeBuilder2->DefineField( "myReserved2", short::typeid, FieldAttributes::Public ); - FieldBuilder^ myFieldBuilder6 = myTypeBuilder2->DefineField( "myPathName", array::typeid,FieldAttributes::Public ); - myFieldBuilder6->SetMarshal( UnmanagedMarshal::DefineByValArray( 128 ) ); - myFieldBuilder6->SetOffset( 4 ); - Type^ myType1 = myTypeBuilder2->CreateType(); - - // Create the PInvoke method for 'OpenFile' method of 'Kernel32.dll'. - array^myParameters = {String::typeid,myType1,UInt32::typeid}; - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefinePInvokeMethod( "OpenFile", "kernel32.dll", static_cast(MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::HideBySig), CallingConventions::Standard, IntPtr::typeid, myParameters, CallingConvention::Winapi, CharSet::None ); - Type^ myAttributeType = MethodImplAttribute::typeid; - array^type1 = {MethodImplOptions::typeid}; - ConstructorInfo^ myConstructorInfo = myAttributeType->GetConstructor( type1 ); - array^obj1 = {MethodImplOptions::PreserveSig}; - CustomAttributeBuilder^ myAttributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 ); - myMethodBuilder->SetCustomAttribute( myAttributeBuilder ); - ParameterBuilder^ myParameterBuilder2 = myMethodBuilder->DefineParameter( 2, ParameterAttributes::Out, "myClass2" ); - Type^ myType = myTypeBuilder->CreateType(); - myAssembly->Save( "EmittedAssembly.dll" ); - return myType; -} - -int main() -{ - try - { - Type^ myType = CreateType( Thread::GetDomain() ); - Type^ myClass2 = myType->Module->GetType( "MyClass2" ); - Object^ myParam2 = Activator::CreateInstance( myClass2 ); - UInt32 myUint = 0x00000800; - array^myArgs = {"MyFile.Txt",myParam2,myUint}; - Object^ myObject = myType->InvokeMember( "OpenFile", static_cast(BindingFlags::Public | BindingFlags::InvokeMethod | BindingFlags::Static), nullptr, nullptr, myArgs ); - Console::WriteLine( "MyClass::OpenFile method returned: \"{0}\"", myObject ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp deleted file mode 100644 index 58a29d2bc11..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class FieldInfoClass -{ -public: - int myField1; - -protected: - String^ myField2; -}; - -int main() -{ - array^myFieldInfo; - Type^ myType = FieldInfoClass::typeid; - - // Get the type and fields of FieldInfoClass. - myFieldInfo = myType->GetFields( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Public) ); - Console::WriteLine( "\nThe fields of FieldInfoClass are \n" ); - - // Display the field information of FieldInfoClass. - for ( int i = 0; i < myFieldInfo->Length; i++ ) - { - Console::WriteLine( "\nName : {0}", myFieldInfo[ i ]->Name ); - Console::WriteLine( "Declaring Type : {0}", myFieldInfo[ i ]->DeclaringType ); - Console::WriteLine( "IsPublic : {0}", myFieldInfo[ i ]->IsPublic ); - Console::WriteLine( "MemberType : {0}", myFieldInfo[ i ]->MemberType ); - Console::WriteLine( "FieldType : {0}", myFieldInfo[ i ]->FieldType ); - Console::WriteLine( "IsFamily : {0}", myFieldInfo[ i ]->IsFamily ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp deleted file mode 100644 index 8d70ea8d553..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyClass -{ -public: - String^ MyField; -}; - -void DisplayFieldHandle( RuntimeFieldHandle myFieldHandle ) -{ - // Get the type from the handle. - FieldInfo^ myField = FieldInfo::GetFieldFromHandle( myFieldHandle ); - - // Display the type. - Console::WriteLine( "\nDisplaying the field from the handle.\n" ); - Console::WriteLine( "The type is {0}.", myField ); -} - -int main() -{ - MyClass^ myClass = gcnew MyClass; - - // Get the type of MyClass. - Type^ myType = MyClass::typeid; - try - { - // Get the field information of MyField. - FieldInfo^ myFieldInfo = myType->GetField( "MyField", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - - // Determine whether or not the FieldInfo Object* is 0. - if ( myFieldInfo != nullptr ) - { - // Get the handle for the field. - RuntimeFieldHandle myFieldHandle = myFieldInfo->FieldHandle; - DisplayFieldHandle( myFieldHandle ); - } - else - { - Console::WriteLine( "The myFieldInfo Object* is 0." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp deleted file mode 100644 index 558c1eaa9ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class FieldInfo_GetFieldFromHandle -{ -public: - String^ x; - Char y; - float a; - int b; -}; - -int main() -{ - // Get the type of the FieldInfo_GetFieldFromHandle class. - Type^ myType = FieldInfo_GetFieldFromHandle::typeid; - - // Get the fields of the FieldInfo_GetFieldFromHandle class. - array^myFieldInfoArray = myType->GetFields(); - Console::WriteLine( "\nThe field information of the declared fields x, y, a, and b is:\n" ); - RuntimeFieldHandle myRuntimeFieldHandle; - for ( int i = 0; i < myFieldInfoArray->Length; i++ ) - { - // Get the RuntimeFieldHandle of myFieldInfoArray. - myRuntimeFieldHandle = myFieldInfoArray[ i ]->FieldHandle; - - // Call the GetFieldFromHandle method. - FieldInfo^ myFieldInfo = FieldInfo::GetFieldFromHandle( myRuntimeFieldHandle ); - - // Display the FieldInfo of myFieldInfo. - Console::WriteLine( " {0}", myFieldInfo ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp deleted file mode 100644 index b4d9d357a06..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class FieldsClass -{ - public: - String^ fieldA; - String^ fieldB; - - FieldsClass() - { - fieldA = "A public field"; - fieldB = "Another public field"; - } -}; - -int main() -{ - FieldsClass^ fieldsInst = gcnew FieldsClass; - - // Get the type of FieldsClass. - Type^ fieldsType = FieldsClass::typeid; - - // Get the FieldInfo of FieldsClass. - array^ fields = fieldsType->GetFields(static_cast(BindingFlags::Public | BindingFlags::Instance)); - - // Display the values of the fields. - Console::WriteLine("Displaying the values of the fields of {0}:", fieldsType); - for (int i = 0; i < fields->Length; i++) - { - Console::WriteLine(" {0}:\t'{1}'", - fields[i]->Name, fields[i]->GetValue(fieldsInst)); - } -} -// The example displays the following output: -// Displaying the values of the fields of FieldsClass: -// fieldA: 'A public field' -// fieldB: 'Another public field' -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp deleted file mode 100644 index 49b86026b86..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::Serialization; - -public ref class MyClass -{ -public: - short myShort; - - // The following field will not be serialized. - - [NonSerialized] - int myInt; -}; - -int main() -{ - // Get the type of MyClass. - Type^ myType = MyClass::typeid; - - // Get the fields of MyClass. - array^myFields = myType->GetFields( static_cast(BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Static) ); - Console::WriteLine( "\nDisplaying whether or not the field is serializable.\n" ); - - // Display whether or not the field is serializable. - for ( int i = 0; i < myFields->Length; i++ ) - if ( myFields[ i ]->IsNotSerialized ) - Console::WriteLine( "The {0} field is not serializable.", myFields[ i ] ); - else - Console::WriteLine( "The {0} field is serializable.", myFields[ i ] ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp deleted file mode 100644 index 5d8ebfb8a80..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class Fieldinfo_IsPinvoke -{ -public: - String^ myField; - Fieldinfo_IsPinvoke() - { - myField = "A public field"; - } -}; - -int main() -{ - Fieldinfo_IsPinvoke^ myObject = gcnew Fieldinfo_IsPinvoke; - - // Get the Type and FieldInfo. - Type^ myType1 = Fieldinfo_IsPinvoke::typeid; - FieldInfo^ myFieldInfo = myType1->GetField( "myField", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - - // Display the name, field and the PInvokeImpl attribute for the field. - Console::Write( "\n Name of class: {0}", myType1->FullName ); - Console::Write( "\n Value of field: {0}", myFieldInfo->GetValue( myObject ) ); - Console::Write( "\n IsPinvokeImpl: {0}", myFieldInfo->IsPinvokeImpl ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp deleted file mode 100644 index 19e2ca9f358..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -ref class MyClass -{ -private: - String^ myField; - -public: - array^myArray; - MyClass() - { - myField = "Microsoft"; - array^s = {"New York","New Jersey"}; - myArray = s; - } - - property String^ GetField - { - String^ get() - { - return myField; - } - } -}; - -int main() -{ - try - { - // Gets the type of MyClass. - Type^ myType = MyClass::typeid; - - // Gets the field information of MyClass. - array^myFields = myType->GetFields( static_cast(BindingFlags::NonPublic | BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine( "\nDisplaying whether the fields of {0} are private or not:\n", myType ); - for ( int i = 0; i < myFields->Length; i++ ) - { - // Check whether the field is private or not. - if ( myFields[ i ]->IsPrivate ) - Console::WriteLine( " {0} is a private field.", myFields[ i ]->Name ); - else - Console::WriteLine( " {0} is not a private field.", myFields[ i ]->Name ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0} ", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp deleted file mode 100644 index 0e31a95a459..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel::Design; - -int main() -{ - try - { - // Get the type handle of a specified class. - Type^ myType = ViewTechnology::typeid; - - // Get the fields of the specified class. - array^myField = myType->GetFields(); - Console::WriteLine( "\nDisplaying fields that have SpecialName attributes:\n" ); - for ( int i = 0; i < myField->Length; i++ ) - { - // Determine whether or not each field is a special name. - if ( myField[ i ]->IsSpecialName ) - { - Console::WriteLine( "The field {0} has a SpecialName attribute.", myField[ i ]->Name ); - } - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0} ", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp deleted file mode 100644 index 5ba37dacd8a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Globalization; - -public ref class Example -{ -private: - String^ myString; - -public: - Example() - { - myString = "Old value"; - } - - property String^ StringProperty - { - String^ get() - { - return myString; - } - } -}; - -int main() -{ - Example^ myObject = gcnew Example; - Type^ myType = Example::typeid; - FieldInfo^ myFieldInfo = myType->GetField( "myString", - BindingFlags::NonPublic | BindingFlags::Instance); - - // Display the string before applying SetValue to the field. - Console::WriteLine( "\nThe field value of myString is \"{0}\".", - myFieldInfo->GetValue( myObject ) ); - // Display the SetValue signature used to set the value of a field. - Console::WriteLine( "Applying SetValue(Object, Object)." ); - - // Change the field value using the SetValue method. - myFieldInfo->SetValue( myObject, "New value" ); - // Display the string after applying SetValue to the field. - Console::WriteLine( "The field value of mystring is \"{0}\".", - myFieldInfo->GetValue(myObject)); -} -/* This code produces the following output: - -The field value of myString is "Old value". -Applying SetValue(Object, Object). -The field value of mystring is "New value". - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp b/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp deleted file mode 100644 index 1f0ebf4662f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - if ( !File::Exists( path ) ) - { - - // Create a file to write to. - StreamWriter^ sw = File::CreateText( path ); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)(sw); - } - } - - // Open the file to read from. - StreamReader^ sr = File::OpenText( path ); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)(sr); - } - - try - { - String^ path2 = String::Concat( path, "temp" ); - - // Ensure that the target does not exist. - File::Delete( path2 ); - - // Copy the file. - File::Copy( path, path2 ); - Console::WriteLine( "{0} was copied to {1}.", path, path2 ); - - // Delete the newly created file. - File::Delete( path2 ); - Console::WriteLine( "{0} was successfully deleted.", path2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp b/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp deleted file mode 100644 index 9c511bd99e5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Create the file, or overwrite if the file exists. - FileStream^ fs = File::Create( path ); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - - // Open the stream and read it back. - StreamReader^ sr = File::OpenText( path ); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp b/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp deleted file mode 100644 index e79d7bdd9ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Create the file, or overwrite if the file exists. - FileStream^ fs = File::Create( path, 1024 ); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - - // Open the stream and read it back. - StreamReader^ sr = File::OpenText( path ); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp b/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp deleted file mode 100644 index e93de3ce721..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - if ( !File::Exists( path ) ) - { - - // Create a file to write to. - StreamWriter^ sw = File::CreateText( path ); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - } - - // Open the file to read from. - StreamReader^ sr = File::OpenText( path ); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp b/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp deleted file mode 100644 index 502539dd149..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Create the file if it does not exist. - if ( !File::Exists( path ) ) - { - File::Create( path ); - } - - if ( (File::GetAttributes( path ) & FileAttributes::Hidden) == FileAttributes::Hidden ) - { - - // Show the file. - File::SetAttributes(path, File::GetAttributes( path ) & ~FileAttributes::Hidden); - Console::WriteLine( "The {0} file is no longer hidden.", path ); - } - else - { - - // Hide the file. - File::SetAttributes( path, static_cast(File::GetAttributes( path ) | FileAttributes::Hidden) ); - Console::WriteLine( "The {0} file is now hidden.", path ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp deleted file mode 100644 index 80e27831de7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\Temp\\MyTest.txt"; - if ( !File::Exists( path ) ) - { - File::Create( path ); - } - File::SetLastAccessTime( path, DateTime(1985,5,4) ); - - // Get the creation time of a well-known directory. - DateTime dt = File::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this file was {0}.", dt ); - - // Update the last access time. - File::SetLastAccessTime( path, DateTime::Now ); - dt = File::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this file was {0}.", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp deleted file mode 100644 index 8b796882ead..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\Temp\\MyTest.txt"; - if ( !File::Exists( path ) ) - { - File::Create( path ); - } - else - { - - // Take an action that will affect the write time. - File::SetLastWriteTime( path, DateTime(1985,4,3) ); - } - - // Get the creation time of a well-known directory. - DateTime dt = File::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this file was {0}.", dt ); - - // Update the last write time. - File::SetLastWriteTime( path, DateTime::Now ); - dt = File::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this file was {0}.", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp b/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp deleted file mode 100644 index 38bf0f2cab3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - String^ path2 = "c:\\temp2\\MyTest.txt"; - try - { - if ( !File::Exists( path ) ) - { - - // This statement ensures that the file is created, - // but the handle is not kept. - FileStream^ fs = File::Create( path ); - if ( fs ) - delete (IDisposable^)fs; - } - - // Ensure that the target does not exist. - if ( File::Exists( path2 ) ) - File::Delete( path2 ); - - // Move the file. - File::Move( path, path2 ); - Console::WriteLine( "{0} was moved to {1}.", path, path2 ); - - // See if the original exists now. - if ( File::Exists( path ) ) - { - Console::WriteLine( "The original file still exists, which is unexpected." ); - } - else - { - Console::WriteLine( "The original file no longer exists, which is expected." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp b/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp deleted file mode 100644 index 1378629c6eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - // Create a temporary file, and put some data into it. - String^ path = Path::GetTempFileName(); - FileStream^ fs = File::Open( path, FileMode::Open, FileAccess::Write, FileShare::None ); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - - // Open the stream and read it back. - fs = File::Open( path, FileMode::Open ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp b/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp deleted file mode 100644 index 09b89e18c7e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// - -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - // This sample assumes that you have a folder named "c:\temp" on your computer. - String^ filePath = "c:\\temp\\MyTest.txt"; - // Delete the file if it exists. - if (File::Exists( filePath )) - { - File::Delete( filePath ); - } - // Create the file. - FileStream^ fs = File::Create( filePath ); - try - { - array^ info = ( gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - - // Open the stream and read it back. - fs = File::Open( filePath, FileMode::Open, FileAccess::Read ); - try - { - array^ b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - try - { - // Try to write to the file. - fs->Write( b, 0, b->Length ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Writing was disallowed, as expected: {0}", e->ToString() ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp b/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp deleted file mode 100644 index c8b21c2f7d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Create the file if it does not exist. - if ( !File::Exists( path ) ) - { - // Create the file. - FileStream^ fs = File::Create( path ); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - // Open the stream and read it back. - FileStream^ fs = File::Open( path, FileMode::Open, FileAccess::Read, FileShare::None ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - try - { - // Try to get another handle to the same file. - FileStream^ fs2 = File::Open( path, FileMode::Open ); - try - { - // Do some task here. - } - finally - { - if ( fs2 ) - delete (IDisposable^)fs2; - } - } - catch ( Exception^ e ) - { - Console::Write( "Opening the file twice is disallowed." ); - Console::WriteLine( ", as expected: {0}", e ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp deleted file mode 100644 index d257fe26072..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - if ( !File::Exists( path ) ) - { - // Create the file. - FileStream^ fs = File::Create( path ); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - // Open the stream and read it back. - FileStream^ fs = File::OpenRead( path ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp deleted file mode 100644 index 8bbd948b4c6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - if ( !File::Exists( path ) ) - { - // Create the file. - FileStream^ fs = File::Create( path ); - try - { - array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - // Open the stream and read it back. - StreamReader^ sr = File::OpenText( path ); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp deleted file mode 100644 index e08318b7bf6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // Open the stream and write to it. - { - FileStream^ fs = File::OpenWrite( path ); - try - { - array^info = (gcnew UTF8Encoding( true ))-> - GetBytes( "This is to test the OpenWrite method." ); - - // Add some information to the file. - fs->Write( info, 0, info->Length ); - } - finally - { - if ( fs ) - delete (IDisposable^)fs; - } - } - - // Open the stream and read it back. - { - FileStream^ fs = File::OpenRead( path ); - try - { - array^b = gcnew array(1024); - UTF8Encoding^ temp = gcnew UTF8Encoding( true ); - while ( fs->Read( b, 0, b->Length ) > 0 ) - { - Console::WriteLine( temp->GetString( b ) ); - } - } - finally - { - if ( fs ) - delete(IDisposable^)fs; - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp deleted file mode 100644 index 3fe8c6832a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\Temp\\MyTest.txt"; - if ( !File::Exists( path ) ) - { - File::Create( path ); - - // Update the last access time. - } - File::SetLastAccessTime( path, DateTime(1985,5,4) ); - - // Get the creation time of a well-known directory. - DateTime dt = File::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this file was {0}.", dt ); - - // Update the last access time. - File::SetLastAccessTime( path, DateTime::Now ); - dt = File::GetLastAccessTime( path ); - Console::WriteLine( "The last access time for this file was {0}.", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp deleted file mode 100644 index 8b796882ead..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - String^ path = "c:\\Temp\\MyTest.txt"; - if ( !File::Exists( path ) ) - { - File::Create( path ); - } - else - { - - // Take an action that will affect the write time. - File::SetLastWriteTime( path, DateTime(1985,4,3) ); - } - - // Get the creation time of a well-known directory. - DateTime dt = File::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this file was {0}.", dt ); - - // Update the last write time. - File::SetLastWriteTime( path, DateTime::Now ); - dt = File::GetLastWriteTime( path ); - Console::WriteLine( "The last write time for this file was {0}.", dt ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp b/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp deleted file mode 100644 index f16d9cbcb6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - - // Create a reference to a file, which might or might not exist. - // If it does not exist, it is not yet created. - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Create a writer, ready to add entries to the file. - StreamWriter^ sw = fi->AppendText(); - sw->WriteLine( "Add as many lines as you like..." ); - sw->WriteLine( "Add another line to the output..." ); - sw->Flush(); - sw->Close(); - - // Get the information out of the file and display it. - StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); - Console::WriteLine( "This is the information in the first file:" ); - while ( sr->Peek() != -1 ) - Console::WriteLine( sr->ReadLine() ); - - // Copy this file to another file. The file will not be overwritten if it already exists. - FileInfo^ newfi = fi->CopyTo( "newTemp.txt" ); - - // Get the information out of the new file and display it.* sr = new StreamReader(newfi->OpenRead()); - Console::WriteLine( "{0}This is the information in the second file:", Environment::NewLine ); - while ( sr->Peek() != -1 ) - Console::WriteLine( sr->ReadLine() ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is the information in the first file: -//Add as many lines as you like... -//Add another line to the output... -// -//This is the information in the second file: - -// diff --git a/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp b/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp deleted file mode 100644 index 49b2ff55954..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -// The following example displays the names and sizes -// of the files in the specified directory. -using namespace System; -using namespace System::IO; -int main() -{ - - // Make a reference to a directory. - DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" ); - - // Get a reference to each file in that directory. - array^fiArr = di->GetFiles(); - - // Display the names and sizes of the files. - Console::WriteLine( "The directory {0} contains the following files:", di->Name ); - System::Collections::IEnumerator^ myEnum = fiArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FileInfo^ f = safe_cast(myEnum->Current); - Console::WriteLine( "The size of {0} is {1} bytes.", f->Name, f->Length ); - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//The directory c:\ contains the following files: -//The size of MyComputer.log is 274 bytes. -//The size of AUTOEXEC.BAT is 0 bytes. -//The size of boot.ini is 211 bytes. -//The size of CONFIG.SYS is 0 bytes. -//The size of hiberfil.sys is 1072775168 bytes. -//The size of IO.SYS is 0 bytes. -//The size of MASK.txt is 2700 bytes. -//The size of mfc80.dll is 1093632 bytes. -//The size of mfc80u.dll is 1079808 bytes. -//The size of MSDOS.SYS is 0 bytes. -//The size of NTDETECT.COM is 47564 bytes. -//The size of ntldr is 250032 bytes. -//The size of pagefile.sys is 1610612736 bytes. -//The size of UpdatePatch.log is 22778 bytes. -//The size of UpdatePatch.txt is 30 bytes. -//The size of wt3d.ini is 234 bytes. -// diff --git a/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp deleted file mode 100644 index c6df18efd4e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -using namespace System; -using namespace System::IO; - - -namespace ConsoleApplication2 -{ - public ref class Program - { - public: - static void Main() - { - // Loop through all the immediate subdirectories of C. - for each (String^ entry in Directory::GetDirectories("C:\\")) - { - DisplayFileSystemInfoAttributes(gcnew DirectoryInfo(entry)); - } - // Loop through all the files in C. - for each (String^ entry in Directory::GetFiles("C:\\")) - { - DisplayFileSystemInfoAttributes(gcnew FileInfo(entry)); - } - } - // - static void DisplayFileSystemInfoAttributes(FileSystemInfo^ fsi) - { - // Assume that this entry is a file. - String^ entryType = "File"; - - // Determine if entry is really a directory - if ((fsi->Attributes & FileAttributes::Directory) == FileAttributes::Directory) - { - entryType = "Directory"; - } - // Show this entry's type, name, and creation date. - Console::WriteLine("{0} entry {1} was created on {2:D}", entryType, fsi->FullName, fsi->CreationTime); - } - // - }; -}; - -int main() -{ - ConsoleApplication2::Program::Main(); -} - - // Output will vary based on contents of drive C. - - // Directory entry C:\Documents and Settings was created on Tuesday, November 25, 2003 - // Directory entry C:\Inetpub was created on Monday, January 12, 2004 - // Directory entry C:\Program Files was created on Tuesday, November 25, 2003 - // Directory entry C:\RECYCLER was created on Tuesday, November 25, 2003 - // Directory entry C:\System Volume Information was created on Tuesday, November 2, 2003 - // Directory entry C:\WINDOWS was created on Tuesday, November 25, 2003 - // File entry C:\IO.SYS was created on Tuesday, November 25, 2003 - // File entry C:\MSDOS.SYS was created on Tuesday, November 25, 2003 - // File entry C:\pagefile.sys was created on Saturday, December 27, 2003 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp b/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp deleted file mode 100644 index 33129302fbb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - - // This text is added only once to the file. - if ( !File::Exists( path ) ) - { - // Create a file to write to. - StreamWriter^ sw = File::CreateText( path ); - try - { - sw->WriteLine( "Hello" ); - sw->WriteLine( "And" ); - sw->WriteLine( "Welcome" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - } - - // This text is always added, making the file longer over time - // if it is not deleted. - StreamWriter^ sw = File::AppendText( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is Extra" ); - sw->WriteLine( "Text" ); - } - finally - { - if ( sw ) - delete (IDisposable^)sw; - } - - // Open the file to read from. - StreamReader^ sr = File::OpenText( path ); - try - { - String^ s = ""; - while ( s = sr->ReadLine() ) - { - Console::WriteLine( s ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp deleted file mode 100644 index 44aa0f37782..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp +++ /dev/null @@ -1,242 +0,0 @@ -// -// -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Threading; - -namespace GCNotify -{ - ref class Program - { - private: - // Variable for continual checking in the - // While loop in the WaitForFullGCProc method. - static bool checkForNotify = false; - - // Variable for suspending work - // (such servicing allocated server requests) - // after a notification is received and then - // resuming allocation after inducing a garbage collection. - static bool bAllocate = false; - - // Variable for ending the example. - static bool finalExit = false; - - // Collection for objects that - // simulate the server request workload. - static List^>^ load = gcnew List^>(); - - - public: - static void Main() - { - try - { - // Register for a notification. - GC::RegisterForFullGCNotification(10, 10); - Console::WriteLine("Registered for GC notification."); - - checkForNotify = true; - bAllocate = true; - - // Start a thread using WaitForFullGCProc. - Thread^ thWaitForFullGC = gcnew Thread(gcnew ThreadStart(&WaitForFullGCProc)); - thWaitForFullGC->Start(); - - // While the thread is checking for notifications in - // WaitForFullGCProc, create objects to simulate a server workload. - try - { - int lastCollCount = 0; - int newCollCount = 0; - - - while (true) - { - if (bAllocate) - { - load->Add(gcnew array(1000)); - newCollCount = GC::CollectionCount(2); - if (newCollCount != lastCollCount) - { - // Show collection count when it increases: - Console::WriteLine("Gen 2 collection count: {0}", GC::CollectionCount(2).ToString()); - lastCollCount = newCollCount; - } - - // For ending the example (arbitrary). - if (newCollCount == 500) - { - finalExit = true; - checkForNotify = false; - break; - } - } - } - - } - catch (OutOfMemoryException^) - { - Console::WriteLine("Out of memory."); - } - - - // - finalExit = true; - checkForNotify = false; - GC::CancelFullGCNotification(); - // - - } - catch (InvalidOperationException^ invalidOp) - { - - Console::WriteLine("GC Notifications are not supported while concurrent GC is enabled.\n" - + invalidOp->Message); - } - } - - // - public: - static void OnFullGCApproachNotify() - { - Console::WriteLine("Redirecting requests."); - - // Method that tells the request queuing - // server to not direct requests to this server. - RedirectRequests(); - - // Method that provides time to - // finish processing pending requests. - FinishExistingRequests(); - - // This is a good time to induce a GC collection - // because the runtime will induce a full GC soon. - // To be very careful, you can check precede with a - // check of the GC.GCCollectionCount to make sure - // a full GC did not already occur since last notified. - GC::Collect(); - Console::WriteLine("Induced a collection."); - - } - // - - - // - public: - static void OnFullGCCompleteEndNotify() - { - // Method that informs the request queuing server - // that this server is ready to accept requests again. - AcceptRequests(); - Console::WriteLine("Accepting requests again."); - } - // - - // - public: - static void WaitForFullGCProc() - { - while (true) - { - // CheckForNotify is set to true and false in Main. - while (checkForNotify) - { - // - // Check for a notification of an approaching collection. - GCNotificationStatus s = GC::WaitForFullGCApproach(); - if (s == GCNotificationStatus::Succeeded) - { - Console::WriteLine("GC Notifiction raised."); - OnFullGCApproachNotify(); - } - else if (s == GCNotificationStatus::Canceled) - { - Console::WriteLine("GC Notification cancelled."); - break; - } - else - { - // This can occur if a timeout period - // is specified for WaitForFullGCApproach(Timeout) - // or WaitForFullGCComplete(Timeout) - // and the time out period has elapsed. - Console::WriteLine("GC Notification not applicable."); - break; - } - // - - // - // Check for a notification of a completed collection. - s = GC::WaitForFullGCComplete(); - if (s == GCNotificationStatus::Succeeded) - { - Console::WriteLine("GC Notification raised."); - OnFullGCCompleteEndNotify(); - } - else if (s == GCNotificationStatus::Canceled) - { - Console::WriteLine("GC Notification cancelled."); - break; - } - else - { - // Could be a time out. - Console::WriteLine("GC Notification not applicable."); - break; - } - // - } - - - Thread::Sleep(500); - // FinalExit is set to true right before - // the main thread cancelled notification. - if (finalExit) - { - break; - } - } - } - // - - // - private: - static void RedirectRequests() - { - // Code that sends requests - // to other servers. - - // Suspend work. - bAllocate = false; - - } - - static void FinishExistingRequests() - { - // Code that waits a period of time - // for pending requests to finish. - - // Clear the simulated workload. - load->Clear(); - - } - - static void AcceptRequests() - { - // Code that resumes processing - // requests on this server. - - // Resume work. - bAllocate = true; - } - // - }; -} - -int main() -{ - GCNotify::Program::Main(); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp deleted file mode 100644 index 5c9e28f3fbd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp +++ /dev/null @@ -1,184 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class Example -{ -public: - static void Main() - { - // - // Create a new dictionary of strings, with string keys. - // - Dictionary^ openWith = - gcnew Dictionary(); - - // Add some elements to the dictionary. There are no - // duplicate keys, but some of the values are duplicates. - openWith->Add("txt", "notepad.exe"); - openWith->Add("bmp", "paint.exe"); - openWith->Add("dib", "paint.exe"); - openWith->Add("rtf", "wordpad.exe"); - - // The Add method throws an exception if the new key is - // already in the dictionary. - try - { - openWith->Add("txt", "winword.exe"); - } - catch (ArgumentException^) - { - Console::WriteLine("An element with Key = \"txt\" already exists."); - } - // - - // - // The Item property is another name for the indexer, so you - // can omit its name when accessing elements. - Console::WriteLine("For key = \"rtf\", value = {0}.", - openWith["rtf"]); - - // The indexer can be used to change the value associated - // with a key. - openWith["rtf"] = "winword.exe"; - Console::WriteLine("For key = \"rtf\", value = {0}.", - openWith["rtf"]); - - // If a key does not exist, setting the indexer for that key - // adds a new key/value pair. - openWith["doc"] = "winword.exe"; - // - - // - // The indexer throws an exception if the requested key is - // not in the dictionary. - try - { - Console::WriteLine("For key = \"tif\", value = {0}.", - openWith["tif"]); - } - catch (KeyNotFoundException^) - { - Console::WriteLine("Key = \"tif\" is not found."); - } - // - - // - // When a program often has to try keys that turn out not to - // be in the dictionary, TryGetValue can be a more efficient - // way to retrieve values. - String^ value = ""; - if (openWith->TryGetValue("tif", value)) - { - Console::WriteLine("For key = \"tif\", value = {0}.", value); - } - else - { - Console::WriteLine("Key = \"tif\" is not found."); - } - // - - // - // ContainsKey can be used to test keys before inserting - // them. - if (!openWith->ContainsKey("ht")) - { - openWith->Add("ht", "hypertrm.exe"); - Console::WriteLine("Value added for key = \"ht\": {0}", - openWith["ht"]); - } - // - - // - // When you use foreach to enumerate dictionary elements, - // the elements are retrieved as KeyValuePair objects. - Console::WriteLine(); - for each( KeyValuePair kvp in openWith ) - { - Console::WriteLine("Key = {0}, Value = {1}", - kvp.Key, kvp.Value); - } - // - - // - // To get the values alone, use the Values property. - Dictionary::ValueCollection^ valueColl = - openWith->Values; - - // The elements of the ValueCollection are strongly typed - // with the type that was specified for dictionary values. - Console::WriteLine(); - for each( String^ s in valueColl ) - { - Console::WriteLine("Value = {0}", s); - } - // - - // - // To get the keys alone, use the Keys property. - Dictionary::KeyCollection^ keyColl = - openWith->Keys; - - // The elements of the KeyCollection are strongly typed - // with the type that was specified for dictionary keys. - Console::WriteLine(); - for each( String^ s in keyColl ) - { - Console::WriteLine("Key = {0}", s); - } - // - - // - // Use the Remove method to remove a key/value pair. - Console::WriteLine("\nRemove(\"doc\")"); - openWith->Remove("doc"); - - if (!openWith->ContainsKey("doc")) - { - Console::WriteLine("Key \"doc\" is not found."); - } - // - } -}; - -int main() -{ - Example::Main(); -} - -/* This code example produces the following output: - -An element with Key = "txt" already exists. -For key = "rtf", value = wordpad.exe. -For key = "rtf", value = winword.exe. -Key = "tif" is not found. -Key = "tif" is not found. -Value added for key = "ht": hypertrm.exe - -Key = txt, Value = notepad.exe -Key = bmp, Value = paint.exe -Key = dib, Value = paint.exe -Key = rtf, Value = winword.exe -Key = doc, Value = winword.exe -Key = ht, Value = hypertrm.exe - -Value = notepad.exe -Value = paint.exe -Value = paint.exe -Value = winword.exe -Value = winword.exe -Value = hypertrm.exe - -Key = txt -Key = bmp -Key = dib -Key = rtf -Key = doc -Key = ht - -Remove("doc") -Key "doc" is not found. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp deleted file mode 100644 index b16f6d80b9c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -using namespace System; -using namespace System::Collections::Generic; -//using namespace System::Threading; - -public ref class Example -{ -public: - static void Main() - { - // Create a new dictionary of strings, with string keys. - // - Dictionary^ myDictionary = - gcnew Dictionary(); - - // Add some elements to the dictionary. There are no - // duplicate keys, but some of the values are duplicates. - myDictionary->Add("txt", "notepad.exe"); - myDictionary->Add("bmp", "paint.exe"); - myDictionary->Add("dib", "paint.exe"); - myDictionary->Add("rtf", "wordpad.exe"); - - // - for each(KeyValuePair kvp in myDictionary) - { - Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); - } - // - } -}; - -int main() -{ - Example::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp deleted file mode 100644 index 96a21ffd2f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class Example -{ -public: - static void Main() - { - // - // Create a new dictionary of strings, with string keys, - // and access it through the IDictionary generic interface. - IDictionary^ openWith = - gcnew Dictionary(); - - // Add some elements to the dictionary. There are no - // duplicate keys, but some of the values are duplicates. - openWith->Add("txt", "notepad.exe"); - openWith->Add("bmp", "paint.exe"); - openWith->Add("dib", "paint.exe"); - openWith->Add("rtf", "wordpad.exe"); - - // The Add method throws an exception if the new key is - // already in the dictionary. - try - { - openWith->Add("txt", "winword.exe"); - } - catch (ArgumentException^) - { - Console::WriteLine("An element with Key = \"txt\" already exists."); - } - // - - // - // The Item property is another name for the indexer, so you - // can omit its name when accessing elements. - Console::WriteLine("For key = \"rtf\", value = {0}.", - openWith["rtf"]); - - // The indexer can be used to change the value associated - // with a key. - openWith["rtf"] = "winword.exe"; - Console::WriteLine("For key = \"rtf\", value = {0}.", - openWith["rtf"]); - - // If a key does not exist, setting the indexer for that key - // adds a new key/value pair. - openWith["doc"] = "winword.exe"; - // - - // - // The indexer throws an exception if the requested key is - // not in the dictionary. - try - { - Console::WriteLine("For key = \"tif\", value = {0}.", - openWith["tif"]); - } - catch (KeyNotFoundException^) - { - Console::WriteLine("Key = \"tif\" is not found."); - } - // - - // - // When a program often has to try keys that turn out not to - // be in the dictionary, TryGetValue can be a more efficient - // way to retrieve values. - String^ value = ""; - if (openWith->TryGetValue("tif", value)) - { - Console::WriteLine("For key = \"tif\", value = {0}.", value); - } - else - { - Console::WriteLine("Key = \"tif\" is not found."); - } - // - - // - // ContainsKey can be used to test keys before inserting - // them. - if (!openWith->ContainsKey("ht")) - { - openWith->Add("ht", "hypertrm.exe"); - Console::WriteLine("Value added for key = \"ht\": {0}", - openWith["ht"]); - } - // - - // - // When you use foreach to enumerate dictionary elements, - // the elements are retrieved as KeyValuePair objects. - Console::WriteLine(); - for each( KeyValuePair kvp in openWith ) - { - Console::WriteLine("Key = {0}, Value = {1}", - kvp.Key, kvp.Value); - } - // - - // - // To get the values alone, use the Values property. - ICollection^ icoll = openWith->Values; - - // The elements of the ValueCollection are strongly typed - // with the type that was specified for dictionary values. - Console::WriteLine(); - for each( String^ s in icoll ) - { - Console::WriteLine("Value = {0}", s); - } - // - - // - // To get the keys alone, use the Keys property. - icoll = openWith->Keys; - - // The elements of the ValueCollection are strongly typed - // with the type that was specified for dictionary values. - Console::WriteLine(); - for each( String^ s in icoll ) - { - Console::WriteLine("Key = {0}", s); - } - // - - // - // Use the Remove method to remove a key/value pair. - Console::WriteLine("\nRemove(\"doc\")"); - openWith->Remove("doc"); - - if (!openWith->ContainsKey("doc")) - { - Console::WriteLine("Key \"doc\" is not found."); - } - // - } -}; - -int main() -{ - Example::Main(); -} - -/* This code example produces the following output: - -An element with Key = "txt" already exists. -For key = "rtf", value = wordpad.exe. -For key = "rtf", value = winword.exe. -Key = "tif" is not found. -Key = "tif" is not found. -Value added for key = "ht": hypertrm.exe - -Key = txt, Value = notepad.exe -Key = bmp, Value = paint.exe -Key = dib, Value = paint.exe -Key = rtf, Value = winword.exe -Key = doc, Value = winword.exe -Key = ht, Value = hypertrm.exe - -Value = notepad.exe -Value = paint.exe -Value = paint.exe -Value = winword.exe -Value = winword.exe -Value = hypertrm.exe - -Key = txt -Key = bmp -Key = dib -Key = rtf -Key = doc -Key = ht - -Remove("doc") -Key "doc" is not found. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp deleted file mode 100644 index d3c038ba91c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -using namespace System; -using namespace System::Collections::Generic; - -public ref class Example -{ -public: - static void Main() - { - // Create a new dictionary of strings, with string keys. - // - Dictionary^ exDictionary = - gcnew Dictionary(); - - // Add some elements to the dictionary. There are no - // duplicate keys, but some of the values are duplicates. - exDictionary->Add(0, "notepad.exe"); - exDictionary->Add(1, "paint.exe"); - exDictionary->Add(2, "paint.exe"); - exDictionary->Add(3, "wordpad.exe"); - IDictionary^ myDictionary = exDictionary; - // - for each(KeyValuePair kvp in myDictionary) - { - Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); - } - // - } -}; - -int main() -{ - Example::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp deleted file mode 100644 index 1439a447483..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp +++ /dev/null @@ -1,264 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Text; -using namespace System::Collections::Generic; - -public ref class Example -{ -public: - static void Main() - { - // - // Create the link list. - array^ words = - { "the", "fox", "jumped", "over", "the", "dog" }; - LinkedList^ sentence = gcnew LinkedList(words); - Display(sentence, "The linked list values:"); - Console::WriteLine("sentence.Contains(\"jumped\") = {0}", - sentence->Contains("jumped")); - // - - // Add the word 'today' to the beginning of the linked list. - sentence->AddFirst("today"); - Display(sentence, "Test 1: Add 'today' to beginning of the list:"); - - // - // Move the first node to be the last node. - LinkedListNode^ mark1 = sentence->First; - sentence->RemoveFirst(); - sentence->AddLast(mark1); - // - Display(sentence, "Test 2: Move first node to be last node:"); - - // Change the last node to 'yesterday'. - sentence->RemoveLast(); - sentence->AddLast("yesterday"); - Display(sentence, "Test 3: Change the last node to 'yesterday':"); - - // - // Move the last node to be the first node. - mark1 = sentence->Last; - sentence->RemoveLast(); - sentence->AddFirst(mark1); - // - Display(sentence, "Test 4: Move last node to be first node:"); - - - // - // Indicate the last occurence of 'the'. - sentence->RemoveFirst(); - LinkedListNode^ current = sentence->FindLast("the"); - // - IndicateNode(current, "Test 5: Indicate last occurence of 'the':"); - - // - // Add 'lazy' and 'old' after 'the' (the LinkedListNode named current). - sentence->AddAfter(current, "old"); - sentence->AddAfter(current, "lazy"); - // - IndicateNode(current, "Test 6: Add 'lazy' and 'old' after 'the':"); - - // - // Indicate 'fox' node. - current = sentence->Find("fox"); - IndicateNode(current, "Test 7: Indicate the 'fox' node:"); - - // Add 'quick' and 'brown' before 'fox': - sentence->AddBefore(current, "quick"); - sentence->AddBefore(current, "brown"); - // - IndicateNode(current, "Test 8: Add 'quick' and 'brown' before 'fox':"); - - // Keep a reference to the current node, 'fox', - // and to the previous node in the list. Indicate the 'dog' node. - mark1 = current; - LinkedListNode^ mark2 = current->Previous; - current = sentence->Find("dog"); - IndicateNode(current, "Test 9: Indicate the 'dog' node:"); - - // The AddBefore method throws an InvalidOperationException - // if you try to add a node that already belongs to a list. - Console::WriteLine("Test 10: Throw exception by adding node (fox) already in the list:"); - try - { - sentence->AddBefore(current, mark1); - } - catch (InvalidOperationException^ ex) - { - Console::WriteLine("Exception message: {0}", ex->Message); - } - Console::WriteLine(); - - // - // Remove the node referred to by mark1, and then add it - // before the node referred to by current. - // Indicate the node referred to by current. - sentence->Remove(mark1); - sentence->AddBefore(current, mark1); - // - IndicateNode(current, "Test 11: Move a referenced node (fox) before the current node (dog):"); - - // - // Remove the node referred to by current. - sentence->Remove(current); - // - IndicateNode(current, "Test 12: Remove current node (dog) and attempt to indicate it:"); - - // Add the node after the node referred to by mark2. - sentence->AddAfter(mark2, current); - IndicateNode(current, "Test 13: Add node removed in test 11 after a referenced node (brown):"); - - // The Remove method finds and removes the - // first node that that has the specified value. - sentence->Remove("old"); - Display(sentence, "Test 14: Remove node that has the value 'old':"); - - // - // When the linked list is cast to ICollection(Of String), - // the Add method adds a node to the end of the list. - sentence->RemoveLast(); - ICollection^ icoll = sentence; - icoll->Add("rhinoceros"); - // - Display(sentence, "Test 15: Remove last node, cast to ICollection, and add 'rhinoceros':"); - - Console::WriteLine("Test 16: Copy the list to an array:"); - // - // Create an array with the same number of - // elements as the inked list. - array^ sArray = gcnew array(sentence->Count); - sentence->CopyTo(sArray, 0); - - for each (String^ s in sArray) - { - Console::WriteLine(s); - } - // - - - // - // Release all the nodes. - sentence->Clear(); - - Console::WriteLine(); - Console::WriteLine("Test 17: Clear linked list. Contains 'jumped' = {0}", - sentence->Contains("jumped")); - // - - Console::ReadLine(); - } - -private: - static void Display(LinkedList^ words, String^ test) - { - Console::WriteLine(test); - for each (String^ word in words) - { - Console::Write(word + " "); - } - Console::WriteLine(); - Console::WriteLine(); - } - - static void IndicateNode(LinkedListNode^ node, String^ test) - { - Console::WriteLine(test); - if (node->List == nullptr) - { - Console::WriteLine("Node '{0}' is not in the list.\n", - node->Value); - return; - } - - StringBuilder^ result = gcnew StringBuilder("(" + node->Value + ")"); - LinkedListNode^ nodeP = node->Previous; - - while (nodeP != nullptr) - { - result->Insert(0, nodeP->Value + " "); - nodeP = nodeP->Previous; - } - - node = node->Next; - while (node != nullptr) - { - result->Append(" " + node->Value); - node = node->Next; - } - - Console::WriteLine(result); - Console::WriteLine(); - } -}; - -int main() -{ - Example::Main(); -} - -//This code example produces the following output: -// -//The linked list values: -//the fox jumped over the dog - -//Test 1: Add 'today' to beginning of the list: -//today the fox jumped over the dog - -//Test 2: Move first node to be last node: -//the fox jumped over the dog today - -//Test 3: Change the last node to 'yesterday': -//the fox jumped over the dog yesterday - -//Test 4: Move last node to be first node: -//yesterday the fox jumped over the dog - -//Test 5: Indicate last occurence of 'the': -//the fox jumped over (the) dog - -//Test 6: Add 'lazy' and 'old' after 'the': -//the fox jumped over (the) lazy old dog - -//Test 7: Indicate the 'fox' node: -//the (fox) jumped over the lazy old dog - -//Test 8: Add 'quick' and 'brown' before 'fox': -//the quick brown (fox) jumped over the lazy old dog - -//Test 9: Indicate the 'dog' node: -//the quick brown fox jumped over the lazy old (dog) - -//Test 10: Throw exception by adding node (fox) already in the list: -//Exception message: The LinkedList node belongs a LinkedList. - -//Test 11: Move a referenced node (fox) before the current node (dog): -//the quick brown jumped over the lazy old fox (dog) - -//Test 12: Remove current node (dog) and attempt to indicate it: -//Node 'dog' is not in the list. - -//Test 13: Add node removed in test 11 after a referenced node (brown): -//the quick brown (dog) jumped over the lazy old fox - -//Test 14: Remove node that has the value 'old': -//the quick brown dog jumped over the lazy fox - -//Test 15: Remove last node, cast to ICollection, and add 'rhinoceros': -//the quick brown dog jumped over the lazy rhinoceros - -//Test 16: Copy the list to an array: -//the -//quick -//brown -//dog -//jumped -//over -//the -//lazy -//rhinoceros - -//Test 17: Clear linked list. Contains 'jumped' = False -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp deleted file mode 100644 index 8e667bffa93..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections::Generic; - -public ref class Example -{ -public: - static void Main() - { - // Create a new sorted list of strings, with string - // keys. - SortedList^ mySortedList = - gcnew SortedList(); - - // Add some elements to the list. There are no - // duplicate keys, but some of the values are duplicates. - mySortedList->Add(0, "notepad.exe"); - mySortedList->Add(1, "paint.exe"); - mySortedList->Add(2, "paint.exe"); - mySortedList->Add(3, "wordpad.exe"); - - // - String^ v = mySortedList->Values[3]; - // - - Console::WriteLine("Value at index 3: {0}", v); - - // - for each( KeyValuePair kvp in mySortedList ) - { - Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); - } - // - } -}; - -int main() -{ - Example::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp deleted file mode 100644 index 47488deda3e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp +++ /dev/null @@ -1,198 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections::Generic; - -public ref class Example -{ -public: - static void Main() - { - // - // Create a new sorted list of strings, with string - // keys. - SortedList^ openWith = - gcnew SortedList(); - - // Add some elements to the list. There are no - // duplicate keys, but some of the values are duplicates. - openWith->Add("txt", "notepad.exe"); - openWith->Add("bmp", "paint.exe"); - openWith->Add("dib", "paint.exe"); - openWith->Add("rtf", "wordpad.exe"); - - // The Add method throws an exception if the new key is - // already in the list. - try - { - openWith->Add("txt", "winword.exe"); - } - catch (ArgumentException^) - { - Console::WriteLine("An element with Key = \"txt\" already exists."); - } - // - - // - // The Item property is another name for the indexer, so you - // can omit its name when accessing elements. - Console::WriteLine("For key = \"rtf\", value = {0}.", - openWith["rtf"]); - - // The indexer can be used to change the value associated - // with a key. - openWith["rtf"] = "winword.exe"; - Console::WriteLine("For key = \"rtf\", value = {0}.", - openWith["rtf"]); - - // If a key does not exist, setting the indexer for that key - // adds a new key/value pair. - openWith["doc"] = "winword.exe"; - // - - // - // The indexer throws an exception if the requested key is - // not in the list. - try - { - Console::WriteLine("For key = \"tif\", value = {0}.", - openWith["tif"]); - } - catch (KeyNotFoundException^) - { - Console::WriteLine("Key = \"tif\" is not found."); - } - // - - // - // When a program often has to try keys that turn out not to - // be in the list, TryGetValue can be a more efficient - // way to retrieve values. - String^ value = ""; - if (openWith->TryGetValue("tif", value)) - { - Console::WriteLine("For key = \"tif\", value = {0}.", value); - } - else - { - Console::WriteLine("Key = \"tif\" is not found."); - } - // - - // - // ContainsKey can be used to test keys before inserting - // them. - if (!openWith->ContainsKey("ht")) - { - openWith->Add("ht", "hypertrm.exe"); - Console::WriteLine("Value added for key = \"ht\": {0}", - openWith["ht"]); - } - // - - // - // When you use foreach to enumerate list elements, - // the elements are retrieved as KeyValuePair objects. - Console::WriteLine(); - for each( KeyValuePair kvp in openWith ) - { - Console::WriteLine("Key = {0}, Value = {1}", - kvp.Key, kvp.Value); - } - // - - // - // To get the values alone, use the Values property. - IList^ ilistValues = openWith->Values; - - // The elements of the list are strongly typed with the - // type that was specified for the SortedList values. - Console::WriteLine(); - for each( String^ s in ilistValues ) - { - Console::WriteLine("Value = {0}", s); - } - - // The Values property is an efficient way to retrieve - // values by index. - Console::WriteLine("\nIndexed retrieval using the Values " + - "property: Values[2] = {0}", openWith->Values[2]); - // - - // - // To get the keys alone, use the Keys property. - IList^ ilistKeys = openWith->Keys; - - // The elements of the list are strongly typed with the - // type that was specified for the SortedList keys. - Console::WriteLine(); - for each( String^ s in ilistKeys ) - { - Console::WriteLine("Key = {0}", s); - } - - // The Keys property is an efficient way to retrieve - // keys by index. - Console::WriteLine("\nIndexed retrieval using the Keys " + - "property: Keys[2] = {0}", openWith->Keys[2]); - // - - // - // Use the Remove method to remove a key/value pair. - Console::WriteLine("\nRemove(\"doc\")"); - openWith->Remove("doc"); - - if (!openWith->ContainsKey("doc")) - { - Console::WriteLine("Key \"doc\" is not found."); - } - // - } -}; - -int main() -{ - Example::Main(); -} - -/* This code example produces the following output: - -An element with Key = "txt" already exists. -For key = "rtf", value = wordpad.exe. -For key = "rtf", value = winword.exe. -Key = "tif" is not found. -Key = "tif" is not found. -Value added for key = "ht": hypertrm.exe - -Key = bmp, Value = paint.exe -Key = dib, Value = paint.exe -Key = doc, Value = winword.exe -Key = ht, Value = hypertrm.exe -Key = rtf, Value = winword.exe -Key = txt, Value = notepad.exe - -Value = paint.exe -Value = paint.exe -Value = winword.exe -Value = hypertrm.exe -Value = winword.exe -Value = notepad.exe - -Indexed retrieval using the Values property: Values[2] = winword.exe - -Key = bmp -Key = dib -Key = doc -Key = ht -Key = rtf -Key = txt - -Indexed retrieval using the Keys property: Keys[2] = doc - -Remove("doc") -Key "doc" is not found. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp deleted file mode 100644 index 9f909725077..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class GenericReflectionSample -{ -}; - -int main() -{ - // Creating a dynamic assembly requires an AssemblyName - // object, and the current application domain. - // - AssemblyName^ asmName = - gcnew AssemblyName("EmittedAssembly"); - AppDomain^ domain = AppDomain::CurrentDomain; - AssemblyBuilder^ sampleAssemblyBuilder = - domain->DefineDynamicAssembly(asmName, - AssemblyBuilderAccess::RunAndSave); - - // Define the module that contains the code. For an - // assembly with one module, the module name is the - // assembly name plus a file extension. - ModuleBuilder^ sampleModuleBuilder = - sampleAssemblyBuilder->DefineDynamicModule(asmName->Name, - asmName->Name + ".dll"); - - TypeBuilder^ sampleTypeBuilder = - sampleModuleBuilder->DefineType("SampleType", - TypeAttributes::Public | TypeAttributes::Abstract); - - // - // Define a Shared, Public method with standard calling - // conventions. Do not specify the parameter types or the - // return type, because type parameters will be used for - // those types, and the type parameters have not been - // defined yet. - MethodBuilder^ sampleMethodBuilder = - sampleTypeBuilder->DefineMethod("SampleMethod", - MethodAttributes::Public | MethodAttributes::Static); - // - - // - // Defining generic parameters for the method makes it a - // generic method. By convention, type parameters are - // single alphabetic characters. T and U are used here. - // - array^ genericTypeNames = {"T", "U"}; - array^ genericTypes = - sampleMethodBuilder->DefineGenericParameters( - genericTypeNames); - // - - // - // Use the IsGenericMethod property to find out if a - // dynamic method is generic, and IsGenericMethodDefinition - // to find out if it defines a generic method. - Console::WriteLine("Is SampleMethod generic? {0}", - sampleMethodBuilder->IsGenericMethod); - Console::WriteLine( - "Is SampleMethod a generic method definition? {0}", - sampleMethodBuilder->IsGenericMethodDefinition); - // - - // - // Set parameter types for the method. The method takes - // one parameter, and its type is specified by the first - // type parameter, T. - array^ parameterTypes = {genericTypes[0]}; - sampleMethodBuilder->SetParameters(parameterTypes); - - // Set the return type for the method. The return type is - // specified by the second type parameter, U. - sampleMethodBuilder->SetReturnType(genericTypes[1]); - // - - // Generate a code body for the method. The method doesn't - // do anything except return null. - // - ILGenerator^ ilgen = sampleMethodBuilder->GetILGenerator(); - ilgen->Emit(OpCodes::Ldnull); - ilgen->Emit(OpCodes::Ret); - - // - // Complete the type. - Type^ sampleType = sampleTypeBuilder->CreateType(); - - // To bind types to a dynamic generic method, you must - // first call the GetMethod method on the completed type. - // You can then define an array of types, and bind them - // to the method. - MethodInfo^ sampleMethodInfo = sampleType->GetMethod("SampleMethod"); - array^ boundParameters = - {String::typeid, GenericReflectionSample::typeid}; - MethodInfo^ boundMethodInfo = - sampleMethodInfo->MakeGenericMethod(boundParameters); - // Display a string representing the bound method. - Console::WriteLine(boundMethodInfo); - // - - // Save the assembly, so it can be examined with Ildasm.exe. - sampleAssemblyBuilder->Save(asmName->Name + ".dll"); -} - -/* This code example produces the following output: -Is SampleMethod generic? True -Is SampleMethod a generic method definition? True -GenericReflectionSample SampleMethod[String,GenericReflectionSample](System.String) -*/ -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp deleted file mode 100644 index d3c27fc9117..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -[assembly:AssemblyTitle("CustAttrs1CPP")]; -[assembly:AssemblyDescription("GetCustomAttributes() Demo")]; -[assembly:AssemblyCompany("Microsoft")]; - -ref class Example -{}; - -static void main() -{ - Type^ clsType = Example::typeid; - - // Get the Assembly type to access its metadata. - Assembly^ assy = clsType->Assembly; - - // Iterate through the attributes for the assembly. - System::Collections::IEnumerator^ myEnum = Attribute::GetCustomAttributes( assy )->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum->Current); - - // Check for the AssemblyTitle attribute. - if ( attr->GetType() == AssemblyTitleAttribute::typeid ) - Console::WriteLine( "Assembly title is \"{0}\".", (dynamic_cast(attr))->Title ); - // Check for the AssemblyDescription attribute. - else - // Check for the AssemblyDescription attribute. - if ( attr->GetType() == AssemblyDescriptionAttribute::typeid ) - Console::WriteLine( "Assembly description is \"{0}\".", (dynamic_cast(attr))->Description ); - // Check for the AssemblyCompany attribute. - else if ( attr->GetType() == AssemblyCompanyAttribute::typeid ) - Console::WriteLine( "Assembly company is {0}.", (dynamic_cast(attr))->Company ); - } -} -// The example displays the following output: -// Assembly description is "GetCustomAttributes() Demo". -// Assembly company is Microsoft. -// Assembly title is "CustAttrs1CPP". -// diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp deleted file mode 100644 index 1756e0d976f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp +++ /dev/null @@ -1,258 +0,0 @@ - - -// -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; - -// Assign some attributes to the module. -// Set the module's CLSCompliant attribute to false -// The CLSCompliant attribute is applicable for /target:module. -[module:Description("A sample description")]; -[module:CLSCompliant(false)]; -namespace CustAttrs2CS -{ - ref class DemoClass - { - public: - static void Main() - { - Type^ clsType = DemoClass::typeid; - - // Get the Module type to access its metadata. - Module^ module = clsType->Module; - - // Iterate through all the attributes for the module. - System::Collections::IEnumerator^ myEnum1 = Attribute::GetCustomAttributes( module )->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum1->Current); - - // Check for the Description attribute. - if ( attr->GetType() == DescriptionAttribute::typeid ) - Console::WriteLine( "Module {0} has the description \"{1}\".", module->Name, (dynamic_cast(attr))->Description ); - // Check for the CLSCompliant attribute. - else - - // Check for the CLSCompliant attribute. - if ( attr->GetType() == CLSCompliantAttribute::typeid ) - Console::WriteLine( "Module {0} {1} CLSCompliant.", module->Name, (dynamic_cast(attr))->IsCompliant ? (String^)"is" : "is not" ); - } - } - }; -} - - -/* - * Output: - * Module CustAttrs2CS.exe is not CLSCompliant. - * Module CustAttrs2CS.exe has the description "A sample description". - */ -// -// -using namespace System; -using namespace System::Runtime::InteropServices; - -namespace CustAttrs3CS -{ - // Set a GUID and ProgId attribute for this class. - - [Guid("BF235B41-52D1-46CC-9C55-046793DB363F")] - [ProgId("CustAttrs3CS.ClassWithGuidAndProgId")] - public ref class ClassWithGuidAndProgId{}; - - ref class DemoClass - { - public: - static void Main() - { - // Get the Class type to access its metadata. - Type^ clsType = ClassWithGuidAndProgId::typeid; - - // Iterate through all the attributes for the class. - System::Collections::IEnumerator^ myEnum2 = Attribute::GetCustomAttributes( clsType )->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum2->Current); - - // Check for the Guid attribute. - if ( attr->GetType() == GuidAttribute::typeid ) - { - // Display the GUID. - Console::WriteLine( "Class {0} has a GUID.", clsType->Name ); - Console::WriteLine( "GUID: {{0}}.", (dynamic_cast(attr))->Value ); - } - // Check for the ProgId attribute. - else - - // Check for the ProgId attribute. - if ( attr->GetType() == ProgIdAttribute::typeid ) - { - // Display the ProgId. - Console::WriteLine( "Class {0} has a ProgId.", clsType->Name ); - Console::WriteLine( "ProgId: \"{0}\".", (dynamic_cast(attr))->Value ); - } - } - } - }; -} - - -/* - * Output: - * Class ClassWithGuidAndProgId has a GUID. - * GUID: {BF235B41-52D1-46CC-9C55-046793DB363F}. - * Class ClassWithGuidAndProgId has a ProgId. - * ProgId: "CustAttrs3CS.ClassWithGuidAndProgId". - */ -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -using namespace System::Runtime::InteropServices; - -namespace CustAttrs4CS -{ - // Create a class for Win32 imported unmanaged functions. - public ref class Win32 - { - public: - - [DllImport("user32.dll", CharSet = CharSet::Unicode)] - static int MessageBox( int hWnd, String^ text, String^ caption, UInt32 type ); - }; - - public ref class AClass - { - public: - - // Add some attributes to the Win32CallMethod. - - [Obsolete("This method is obsolete. Use managed MsgBox instead.")] - void Win32CallMethod() - { - Win32::MessageBox( 0, "This is an unmanaged call.", "Be Careful!", 0 ); - } - - }; - - ref class DemoClass - { - public: - static void Main() - { - // Get the Class type to access its metadata. - Type^ clsType = AClass::typeid; - - // Get the type information for the Win32CallMethod. - MethodInfo^ mInfo = clsType->GetMethod( "Win32CallMethod" ); - if ( mInfo != nullptr ) - { - // Iterate through all the attributes for the method. - System::Collections::IEnumerator^ myEnum3 = Attribute::GetCustomAttributes( mInfo )->GetEnumerator(); - while ( myEnum3->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum3->Current); - - // Check for the Obsolete attribute. - if ( attr->GetType() == ObsoleteAttribute::typeid ) - { - Console::WriteLine( "Method {0} is obsolete. " - "The message is:", mInfo->Name ); - Console::WriteLine( (dynamic_cast(attr))->Message ); - } - // Check for the SuppressUnmanagedCodeSecurity attribute. - else - - // Check for the SuppressUnmanagedCodeSecurity attribute. - if ( attr->GetType() == SuppressUnmanagedCodeSecurityAttribute::typeid ) - { - Console::WriteLine( "This method calls unmanaged code " - "with no security check." ); - Console::WriteLine( "Please do not use unless absolutely necessary." ); - AClass^ myCls = gcnew AClass; - myCls->Win32CallMethod(); - } - } - } - } - }; -} - - -/* - * Output: - * Method Win32CallMethod is obsolete. The message is: - * This method is obsolete. Use managed MsgBox instead. - * This method calls unmanaged code with no security check. - * Please do not use unless absolutely necessary. - */ -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; - -namespace CustAttrs5CS -{ - public ref class AClass - { - public: - void ParamArrayAndDesc( - // Add ParamArray and Description attributes. - [Description("This argument is a ParamArray")] - array^args ) - {} - }; - - ref class DemoClass - { - public: - static void Main() - { - // Get the Class type to access its metadata. - Type^ clsType = AClass::typeid; - - // Get the type information for the method. - MethodInfo^ mInfo = clsType->GetMethod( "ParamArrayAndDesc" ); - if ( mInfo != nullptr ) - { - // Get the parameter information. - array^pInfo = mInfo->GetParameters(); - if ( pInfo != nullptr ) - { - // Iterate through all the attributes for the parameter. - System::Collections::IEnumerator^ myEnum4 = Attribute::GetCustomAttributes( pInfo[ 0 ] )->GetEnumerator(); - while ( myEnum4->MoveNext() ) - { - Attribute^ attr = safe_cast(myEnum4->Current); - - // Check for the ParamArray attribute. - if ( attr->GetType() == ParamArrayAttribute::typeid ) - Console::WriteLine( "Parameter {0} for method {1} " - "has the ParamArray attribute.", pInfo[ 0 ]->Name, mInfo->Name ); - // Check for the Description attribute. - else - - // Check for the Description attribute. - if ( attr->GetType() == DescriptionAttribute::typeid ) - { - Console::WriteLine( "Parameter {0} for method {1} " - "has a description attribute.", pInfo[ 0 ]->Name, mInfo->Name ); - Console::WriteLine( "The description is: \"{0}\"", (dynamic_cast(attr))->Description ); - } - } - } - } - } - }; -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp b/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp deleted file mode 100644 index 4fd14cbab59..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -ref class Example -{ - public: - static String^ val = "test"; -}; - -int main() -{ - FieldInfo^ fld = Example::typeid->GetField( "val" ); - Console::WriteLine(fld->GetValue(nullptr) ); - Example::val = "hi"; - Console::WriteLine(fld->GetValue(nullptr) ); -} -// The example displays the following output: -// test -// hi -// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp deleted file mode 100644 index 0f9f1c2f6ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -// Computes a keyed hash for a source file, creates a target file with the keyed hash -// prepended to the contents of the source file, then decrypts the file and compares -// the source and the decrypted files. -void EncodeFile( array^key, String^ sourceFile, String^ destFile ) -{ - - // Initialize the keyed hash object. - HMACRIPEMD160^ myhmacRIPEMD160 = gcnew HMACRIPEMD160( key ); - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); - - // Compute the hash of the input file. - array^hashValue = myhmacRIPEMD160->ComputeHash( inStream ); - - // Reset inStream to the beginning of the file. - inStream->Position = 0; - - // Write the computed hash value to the output file. - outStream->Write( hashValue, 0, hashValue->Length ); - - // Copy the contents of the sourceFile to the destFile. - int bytesRead; - - // read 1K at a time - array^buffer = gcnew array(1024); - do - { - - // Read from the wrapping CryptoStream. - bytesRead = inStream->Read( buffer, 0, 1024 ); - outStream->Write( buffer, 0, bytesRead ); - } - while ( bytesRead > 0 ); - - myhmacRIPEMD160->Clear(); - - // Close the streams - inStream->Close(); - outStream->Close(); - return; -} // end EncodeFile - - - -// Decrypt the encoded file and compare to original file. -bool DecodeFile( array^key, String^ sourceFile ) -{ - - // Initialize the keyed hash object. - HMACRIPEMD160^ hmacRIPEMD160 = gcnew HMACRIPEMD160( key ); - - // Create an array to hold the keyed hash value read from the file. - array^storedHash = gcnew array(hmacRIPEMD160->HashSize / 8); - - // Create a FileStream for the source file. - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - - // Read in the storedHash. - inStream->Read( storedHash, 0, storedHash->Length ); - - // Compute the hash of the remaining contents of the file. - // The stream is properly positioned at the beginning of the content, - // immediately after the stored hash value. - array^computedHash = hmacRIPEMD160->ComputeHash( inStream ); - - // compare the computed hash with the stored value - bool err = false; - for ( int i = 0; i < storedHash->Length; i++ ) - { - if ( computedHash[ i ] != storedHash[ i ] ) - { - err = true; - } - } - if (err) - { - Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); - return false; - } - else - { - Console::WriteLine("Hash values agree -- no tampering occurred."); - return true; - } - -} //end DecodeFile - - -int main() -{ - array^Fileargs = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: HMACRIPEMD160 inputfile.txt encryptedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; - - //If no file names are specified, write usage text. - if ( Fileargs->Length < 3 ) - { - Console::WriteLine( usageText ); - } - else - { - try - { - - // Create a random key using a random number generator. This would be the - // secret key shared by sender and receiver. - array^secretkey = gcnew array(64); - - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - - // The array is now filled with cryptographically strong random bytes. - rng->GetBytes( secretkey ); - - // Use the secret key to encode the message file. - EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); - - // Take the encoded file and decode - DecodeFile( secretkey, Fileargs[ 2 ] ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "Error: File not found", e ); - } - - } -} //end main - - -// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp deleted file mode 100644 index d26844e8082..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -// Computes a keyed hash for a source file, creates a target file with the keyed hash -// prepended to the contents of the source file, then decodes the file and compares -// the source and the decoded files. -void EncodeFile( array^key, String^ sourceFile, String^ destFile ) -{ - - // Initialize the keyed hash object. - HMACSHA256^ myhmacsha256 = gcnew HMACSHA256( key ); - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); - - // Compute the hash of the input file. - array^hashValue = myhmacsha256->ComputeHash( inStream ); - - // Reset inStream to the beginning of the file. - inStream->Position = 0; - - // Write the computed hash value to the output file. - outStream->Write( hashValue, 0, hashValue->Length ); - - // Copy the contents of the sourceFile to the destFile. - int bytesRead; - - // read 1K at a time - array^buffer = gcnew array(1024); - do - { - - // Read from the wrapping CryptoStream. - bytesRead = inStream->Read( buffer, 0, 1024 ); - outStream->Write( buffer, 0, bytesRead ); - } - while ( bytesRead > 0 ); - - myhmacsha256->Clear(); - - // Close the streams - inStream->Close(); - outStream->Close(); - return; -} // end EncodeFile - - - -// Decode the encoded file and compare to original file. -bool DecodeFile( array^key, String^ sourceFile ) -{ - - // Initialize the keyed hash object. - HMACSHA256^ hmacsha256 = gcnew HMACSHA256( key ); - - // Create an array to hold the keyed hash value read from the file. - array^storedHash = gcnew array(hmacsha256->HashSize / 8); - - // Create a FileStream for the source file. - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - - // Read in the storedHash. - inStream->Read( storedHash, 0, storedHash->Length ); - - // Compute the hash of the remaining contents of the file. - // The stream is properly positioned at the beginning of the content, - // immediately after the stored hash value. - array^computedHash = hmacsha256->ComputeHash( inStream ); - - // compare the computed hash with the stored value - bool err = false; - for ( int i = 0; i < storedHash->Length; i++ ) - { - if ( computedHash[ i ] != storedHash[ i ] ) - { - err = true; - } - } - if (err) - { - Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); - return false; - } - else - { - Console::WriteLine("Hash values agree -- no tampering occurred."); - return true; - } - -} //end DecodeFile - - -int main() -{ - array^Fileargs = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: HMACSHA256 inputfile.txt encodedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; - - //If no file names are specified, write usage text. - if ( Fileargs->Length < 3 ) - { - Console::WriteLine( usageText ); - } - else - { - try - { - - // Create a random key using a random number generator. This would be the - // secret key shared by sender and receiver. - array^secretkey = gcnew array(64); - - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - - // The array is now filled with cryptographically strong random bytes. - rng->GetBytes( secretkey ); - - // Use the secret key to encode the message file. - EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); - - // Take the encoded file and decode - DecodeFile( secretkey, Fileargs[ 2 ] ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "Error: File not found", e ); - } - - } -} //end main - - -// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp deleted file mode 100644 index 6dfcd8a29fa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -// Computes a keyed hash for a source file, creates a target file with the keyed hash -// prepended to the contents of the source file, then decrypts the file and compares -// the source and the decrypted files. -void EncodeFile( array^key, String^ sourceFile, String^ destFile ) -{ - - // Initialize the keyed hash object. - HMACSHA384^ myhmacsha384 = gcnew HMACSHA384( key ); - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); - - // Compute the hash of the input file. - array^hashValue = myhmacsha384->ComputeHash( inStream ); - - // Reset inStream to the beginning of the file. - inStream->Position = 0; - - // Write the computed hash value to the output file. - outStream->Write( hashValue, 0, hashValue->Length ); - - // Copy the contents of the sourceFile to the destFile. - int bytesRead; - - // read 1K at a time - array^buffer = gcnew array(1024); - do - { - - // Read from the wrapping CryptoStream. - bytesRead = inStream->Read( buffer, 0, 1024 ); - outStream->Write( buffer, 0, bytesRead ); - } - while ( bytesRead > 0 ); - - myhmacsha384->Clear(); - - // Close the streams - inStream->Close(); - outStream->Close(); - return; -} // end EncodeFile - - - -// Decrypt the encoded file and compare to original file. -bool DecodeFile( array^key, String^ sourceFile ) -{ - - // Initialize the keyed hash object. - HMACSHA384^ hmacsha384 = gcnew HMACSHA384( key ); - - // Create an array to hold the keyed hash value read from the file. - array^storedHash = gcnew array(hmacsha384->HashSize / 8); - - // Create a FileStream for the source file. - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - - // Read in the storedHash. - inStream->Read( storedHash, 0, storedHash->Length ); - - // Compute the hash of the remaining contents of the file. - // The stream is properly positioned at the beginning of the content, - // immediately after the stored hash value. - array^computedHash = hmacsha384->ComputeHash( inStream ); - - // compare the computed hash with the stored value - bool err = false; - for ( int i = 0; i < storedHash->Length; i++ ) - { - if ( computedHash[ i ] != storedHash[ i ] ) - { - err = true; - } - } - if (err) - { - Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); - return false; - } - else - { - Console::WriteLine("Hash values agree -- no tampering occurred."); - return true; - } - -} //end DecodeFile - - -int main() -{ - array^Fileargs = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: HMACSHA384 inputfile.txt encryptedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; - - //If no file names are specified, write usage text. - if ( Fileargs->Length < 3 ) - { - Console::WriteLine( usageText ); - } - else - { - try - { - - // Create a random key using a random number generator. This would be the - // secret key shared by sender and receiver. - array^secretkey = gcnew array(64); - - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - - // The array is now filled with cryptographically strong random bytes. - rng->GetBytes( secretkey ); - - // Use the secret key to encode the message file. - EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); - - // Take the encoded file and decode - DecodeFile( secretkey, Fileargs[ 2 ] ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "Error: File not found", e ); - } - - } -} //end main - - -// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp deleted file mode 100644 index 4f83ce4b8b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -// Computes a keyed hash for a source file, creates a target file with the keyed hash -// prepended to the contents of the source file, then decrypts the file and compares -// the source and the decrypted files. -void EncodeFile( array^key, String^ sourceFile, String^ destFile ) -{ - - // Initialize the keyed hash object. - HMACSHA512^ myhmacsha512 = gcnew HMACSHA512( key ); - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); - - // Compute the hash of the input file. - array^hashValue = myhmacsha512->ComputeHash( inStream ); - - // Reset inStream to the beginning of the file. - inStream->Position = 0; - - // Write the computed hash value to the output file. - outStream->Write( hashValue, 0, hashValue->Length ); - - // Copy the contents of the sourceFile to the destFile. - int bytesRead; - - // read 1K at a time - array^buffer = gcnew array(1024); - do - { - - // Read from the wrapping CryptoStream. - bytesRead = inStream->Read( buffer, 0, 1024 ); - outStream->Write( buffer, 0, bytesRead ); - } - while ( bytesRead > 0 ); - - myhmacsha512->Clear(); - - // Close the streams - inStream->Close(); - outStream->Close(); - return; -} // end EncodeFile - - - -// Decrypt the encoded file and compare to original file. -bool DecodeFile( array^key, String^ sourceFile ) -{ - - // Initialize the keyed hash object. - HMACSHA512^ hmacsha512 = gcnew HMACSHA512( key ); - - // Create an array to hold the keyed hash value read from the file. - array^storedHash = gcnew array(hmacsha512->HashSize / 8); - - // Create a FileStream for the source file. - FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); - - // Read in the storedHash. - inStream->Read( storedHash, 0, storedHash->Length ); - - // Compute the hash of the remaining contents of the file. - // The stream is properly positioned at the beginning of the content, - // immediately after the stored hash value. - array^computedHash = hmacsha512->ComputeHash( inStream ); - - // compare the computed hash with the stored value - bool err = false; - for ( int i = 0; i < storedHash->Length; i++ ) - { - if ( computedHash[ i ] != storedHash[ i ] ) - { - err = true; - } - } - if (err) - { - Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); - return false; - } - else - { - Console::WriteLine("Hash values agree -- no tampering occurred."); - return true; - } - -} //end DecodeFile - - -int main() -{ - array^Fileargs = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: HMACSHA512 inputfile.txt encryptedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; - - //If no file names are specified, write usage text. - if ( Fileargs->Length < 3 ) - { - Console::WriteLine( usageText ); - } - else - { - try - { - - // Create a random key using a random number generator. This would be the - // secret key shared by sender and receiver. - array^secretkey = gcnew array(64); - - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - - // The array is now filled with cryptographically strong random bytes. - rng->GetBytes( secretkey ); - - // Use the secret key to encode the message file. - EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); - - // Take the encoded file and decode - DecodeFile( secretkey, Fileargs[ 2 ] ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "Error: File not found", e ); - } - - } -} //end main - - -// diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp deleted file mode 100644 index b421c5517db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// IComparableExample.cpp : main project file. - -// -using namespace System; -using namespace System::Collections; - -public ref class Temperature: public IComparable { - /// - /// IComparable.CompareTo implementation. - /// -protected: - // The value holder - Double m_value; - -public: - virtual Int32 CompareTo( Object^ obj ) { - - if (obj == nullptr) return 1; - - if ( obj->GetType() == Temperature::typeid ) { - Temperature^ temp = dynamic_cast(obj); - - return m_value.CompareTo( temp->m_value ); - } - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - property Double Value { - Double get() { - return m_value; - } - void set( Double value ) { - m_value = value; - } - } - - property Double Celsius { - Double get() { - return (m_value - 32) / 1.8; - } - void set( Double value ) { - m_value = (value * 1.8) + 32; - } - } -}; - -int main() -{ - ArrayList^ temperatures = gcnew ArrayList; - // Initialize random number generator. - Random^ rnd = gcnew Random; - - // Generate 10 temperatures between 0 and 100 randomly. - for (int ctr = 1; ctr <= 10; ctr++) - { - int degrees = rnd->Next(0, 100); - Temperature^ temp = gcnew Temperature; - temp->Value = degrees; - temperatures->Add(temp); - } - - // Sort ArrayList. - temperatures->Sort(); - - for each (Temperature^ temp in temperatures) - Console::WriteLine(temp->Value); - return 0; -} -// The example displays the following output to the console (individual -// values may vary because they are randomly generated): -// 2 -// 7 -// 16 -// 17 -// 31 -// 37 -// 58 -// 66 -// 72 -// 95 -// diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp deleted file mode 100644 index 8c4f0f164e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections::Generic; - -public ref class Temperature: public IComparable { - -protected: - // The underlying temperature value. - Double m_value; - -public: - // Implement the generic CompareTo method with the Temperature class - // as the Type parameter. - virtual Int32 CompareTo( Temperature^ other ) { - - // If other is not a valid object reference, this instance - // is greater. - if (other == nullptr) return 1; - - // The temperature comparison depends on the comparison of the - // the underlying Double values. - return m_value.CompareTo( other->m_value ); - } - - // Define the is greater than operator. - bool operator>= (Temperature^ other) - { - return CompareTo(other) >= 0; - } - - // Define the is less than operator. - bool operator< (Temperature^ other) - { - return CompareTo(other) < 0; - } - - // Define the is greater than or equal to operator. - bool operator> (Temperature^ other) - { - return CompareTo(other) > 0; - } - - // Define the is less than or equal to operator. - bool operator<= (Temperature^ other) - { - return CompareTo(other) <= 0; - } - - property Double Celsius { - Double get() { - return m_value + 273.15; - } - } - - property Double Kelvin { - Double get() { - return m_value; - } - void set( Double value ) { - if (value < 0) - throw gcnew ArgumentException("Temperature cannot be less than absolute zero."); - else - m_value = value; - } - } - - Temperature(Double kelvins) { - this->Kelvin = kelvins; - } -}; - -int main() { - SortedList^ temps = - gcnew SortedList(); - - // Add entries to the sorted list, out of order. - temps->Add(gcnew Temperature(2017.15), "Boiling point of Lead"); - temps->Add(gcnew Temperature(0), "Absolute zero"); - temps->Add(gcnew Temperature(273.15), "Freezing point of water"); - temps->Add(gcnew Temperature(5100.15), "Boiling point of Carbon"); - temps->Add(gcnew Temperature(373.15), "Boiling point of water"); - temps->Add(gcnew Temperature(600.65), "Melting point of Lead"); - - for each( KeyValuePair^ kvp in temps ) - { - Console::WriteLine("{0} is {1} degrees Celsius.", kvp->Value, kvp->Key->Celsius); - } -} -/* The example displays the following output: - Absolute zero is 273.15 degrees Celsius. - Freezing point of water is 546.3 degrees Celsius. - Boiling point of water is 646.3 degrees Celsius. - Melting point of Lead is 873.8 degrees Celsius. - Boiling point of Lead is 2290.3 degrees Celsius. - Boiling point of Carbon is 5373.3 degrees Celsius. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp deleted file mode 100644 index 59545a35ced..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -// System.Reflection.Emit.ILGenerator.BeginFaultBlock() -/* -The following program demonstrates the 'BeginFaultBlock()' method of 'ILGenerator' -class. Exception is raised by passing two integer values which are out of range, -the same is caught in the 'BeginExceptionBlock' which is non-filtered. First it -checks for the exception thrown in the 'BeginFaultBlock' and then emits the MSIL -instructions in 'BeginExceptFilterBlock'. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -Type^ AddType() -{ - // Create an assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "AdderExceptionAsm"; - - // Create dynamic assembly. - AppDomain^ myAppDomain = Thread::GetDomain(); - AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "AdderExceptionMod" ); - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "Adder" ); - array^myAdderParams = {int::typeid,int::typeid}; - - // Method to add two numbers. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, myAdderParams ); - ILGenerator^ myAdderIL = myMethodBuilder->GetILGenerator(); - - // Create constructor. - array^temp0 = {String::typeid}; - ConstructorInfo^ myConstructorInfo = OverflowException::typeid->GetConstructor( temp0 ); - MethodInfo^ myExToStrMI = OverflowException::typeid->GetMethod( "ToString" ); - array^temp1 = {String::typeid,Object::typeid}; - MethodInfo^ myWriteLineMI = Console::typeid->GetMethod( "WriteLine", temp1 ); - - // Declare local variable. - LocalBuilder^ myLocalBuilder1 = myAdderIL->DeclareLocal( int::typeid ); - LocalBuilder^ myLocalBuilder2 = myAdderIL->DeclareLocal( OverflowException::typeid ); - - // Define label. - Label myFailedLabel = myAdderIL->DefineLabel(); - Label myEndOfMethodLabel = myAdderIL->DefineLabel(); - - // Begin exception block. - Label myLabel = myAdderIL->BeginExceptionBlock(); - myAdderIL->Emit( OpCodes::Ldarg_0 ); - myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); - myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); - myAdderIL->Emit( OpCodes::Ldarg_1 ); - myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); - myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); - myAdderIL->Emit( OpCodes::Ldarg_0 ); - myAdderIL->Emit( OpCodes::Ldarg_1 ); - myAdderIL->Emit( OpCodes::Add_Ovf_Un ); - myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); - myAdderIL->Emit( OpCodes::Br_S, myEndOfMethodLabel ); - myAdderIL->MarkLabel( myFailedLabel ); - myAdderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 10 for addition." ); - myAdderIL->Emit( OpCodes::Newobj, myConstructorInfo ); - myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder2 ); - myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); - - // Call fault block. - myAdderIL->BeginFaultBlock(); - Console::WriteLine( "Fault block called." ); - - //Throw exception. - myAdderIL->ThrowException( NotSupportedException::typeid ); - - // Call finally block. - myAdderIL->BeginFinallyBlock(); - myAdderIL->Emit( OpCodes::Ldstr, "{0}" ); - myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); - myAdderIL->EmitCall( OpCodes::Callvirt, myExToStrMI, nullptr ); - myAdderIL->EmitCall( OpCodes::Call, myWriteLineMI, nullptr ); - myAdderIL->Emit( OpCodes::Ldc_I4_M1 ); - myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); - - // End exception block. - myAdderIL->EndExceptionBlock(); - myAdderIL->MarkLabel( myEndOfMethodLabel ); - myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder1 ); - myAdderIL->Emit( OpCodes::Ret ); - return myTypeBuilder->CreateType(); -} - -int main() -{ - Type^ myAddType = AddType(); - Object^ myObject1 = Activator::CreateInstance( myAddType ); - array^myObject2 = {11,12}; - - // Invoke member. - myAddType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, myObject1, myObject2 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp deleted file mode 100644 index bc0c0c8e893..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp +++ /dev/null @@ -1,114 +0,0 @@ - -// System::Reflection::Emit::ILGenerator.BeginExceptFilterBlock() -// System::Reflection::Emit::ILGenerator.BeginFinallyBlock() -/* - The following program demonstrates the 'BeginExceptFilterBlock()' method and - 'BeginFinallyBlock()' of 'ILGenerator' class. Exception is raised by passing - two integer values which are out of range, the same is caught in the - 'BeginExceptionBlock' which is non-filtered and then emits the MSIL - instructions in 'BeginExceptFilterBlock' and 'BeginFinallyBlock'. -*/ -// -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class ILGenerator_BeginFinallyBlock -{ -public: - static Type^ AddType() - { - // Create an assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "AdderExceptionAsm"; - - // Create dynamic assembly. - AppDomain^ myAppDomain = Thread::GetDomain(); - AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "AdderExceptionMod" ); - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "Adder" ); - array^adderParams = {int::typeid,int::typeid}; - - // Define method to add two numbers. - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, adderParams ); - ILGenerator^ myAdderIL = myMethodBuilder->GetILGenerator(); - - // Create constructor. - array^type1 = {String::typeid}; - ConstructorInfo^ myConstructorInfo = OverflowException::typeid->GetConstructor( type1 ); - MethodInfo^ myExToStrMI = OverflowException::typeid->GetMethod( "ToString" ); - array^type2 = {String::typeid,Object::typeid}; - MethodInfo^ myWriteLineMI = Console::typeid->GetMethod( "WriteLine", type2 ); - - // Declare local variable. - LocalBuilder^ myLocalBuilder1 = myAdderIL->DeclareLocal( int::typeid ); - LocalBuilder^ myLocalBuilder2 = myAdderIL->DeclareLocal( OverflowException::typeid ); - - // Define label. - Label myFailedLabel = myAdderIL->DefineLabel(); - Label myEndOfMethodLabel = myAdderIL->DefineLabel(); - - // Begin exception block. - Label myLabel = myAdderIL->BeginExceptionBlock(); - myAdderIL->Emit( OpCodes::Ldarg_0 ); - myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); - myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); - myAdderIL->Emit( OpCodes::Ldarg_1 ); - myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); - myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); - myAdderIL->Emit( OpCodes::Ldarg_0 ); - myAdderIL->Emit( OpCodes::Ldarg_1 ); - myAdderIL->Emit( OpCodes::Add_Ovf_Un ); - myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); - myAdderIL->Emit( OpCodes::Br_S, myEndOfMethodLabel ); - myAdderIL->MarkLabel( myFailedLabel ); - myAdderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 10 for add." ); - myAdderIL->Emit( OpCodes::Newobj, myConstructorInfo ); - myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder2 ); - myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); - - // Throw the exception. - myAdderIL->ThrowException( OverflowException::typeid ); - - // Call 'BeginExceptFilterBlock'. - myAdderIL->BeginExceptFilterBlock(); - myAdderIL->EmitWriteLine( "Except filter block called." ); - - // Call catch block. - myAdderIL->BeginCatchBlock( nullptr ); - - // Call other catch block. - myAdderIL->BeginCatchBlock( OverflowException::typeid ); - myAdderIL->Emit( OpCodes::Ldstr, "{0}" ); - myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); - myAdderIL->EmitCall( OpCodes::Callvirt, myExToStrMI, nullptr ); - myAdderIL->EmitCall( OpCodes::Call, myWriteLineMI, nullptr ); - myAdderIL->Emit( OpCodes::Ldc_I4_M1 ); - myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); - - // Call finally block. - myAdderIL->BeginFinallyBlock(); - myAdderIL->EmitWriteLine( "Finally block called." ); - - // End the exception block. - myAdderIL->EndExceptionBlock(); - myAdderIL->MarkLabel( myEndOfMethodLabel ); - myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder1 ); - myAdderIL->Emit( OpCodes::Ret ); - return myTypeBuilder->CreateType(); - } -}; - -int main() -{ - Type^ myAddType = ILGenerator_BeginFinallyBlock::AddType(); - Object^ myObject1 = Activator::CreateInstance( myAddType ); - array^myObject2 = {15,15}; - myAddType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, myObject1, myObject2 ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp deleted file mode 100644 index 125264cb896..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -// System.Reflection.Emit.ILGenerator -// System.Reflection.Emit.ILGenerator.BeginScope() -// System.Reflection.Emit.ILGenerator.EndScope() -/* -This program demonstrates the 'BeginScope()', 'EndScope()' methods and the class -'ILGenerator'. A dynamic class 'myTypeBuilder' is created in which a -constructor 'myConstructor' and a method 'myMethod' are created dynamically. Their IL's -are generated. A local variable 'myLocalBuilder' is declared using 'DeclareLocal' property -of 'myMethodIL'. The scope of 'myLocalBuilder' is specified using 'BeginScope' and -'EndScope' methods. Respective messages related to scope are printed on the console. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -int main() -{ - try - { - // - // - // Get the current AppDomain. - AppDomain^ myAppDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "SampleAssembly"; - - // Create a dynamic assembly 'myAssembly' with access mode 'Run'. - AssemblyBuilder^ myAssembly = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module 'myModule' in 'myAssembly'. - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "MyDynamicModule", true ); - - // Define a public class 'MyDynamicClass'. - TypeBuilder^ myTypeBuilder = myModule->DefineType( "MyDynamicClass", TypeAttributes::Public ); - - // Define a public string field. - FieldBuilder^ myField = myTypeBuilder->DefineField( "MyDynamicField", String::typeid, FieldAttributes::Public ); - - // Create the constructor. - array^myConstructorArgs = {String::typeid}; - ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); - - // Generate IL for 'myConstructor'. - ILGenerator^ myConstructorIL = myConstructor->GetILGenerator(); - - // Emit the necessary opcodes. - myConstructorIL->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ mySuperConstructor = Object::typeid->GetConstructor( gcnew array(0) ); - myConstructorIL->Emit( OpCodes::Call, mySuperConstructor ); - myConstructorIL->Emit( OpCodes::Ldarg_0 ); - myConstructorIL->Emit( OpCodes::Ldarg_1 ); - myConstructorIL->Emit( OpCodes::Stfld, myField ); - myConstructorIL->Emit( OpCodes::Ret ); - - // Define a dynamic method named 'MyDynamicMethod'. - MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyDynamicMethod", MethodAttributes::Public, String::typeid, nullptr ); - - // Generate IL for 'myMethod'. - ILGenerator^ myMethodIL = myMethod->GetILGenerator(); - - // Begin the scope for a local variable. - myMethodIL->BeginScope(); - LocalBuilder^ myLocalBuilder = myMethodIL->DeclareLocal( int::typeid ); - Console::WriteLine( "\nTrying to access the local variable within the scope." ); - Console::WriteLine( "'myLocalBuilder' type is :{0}", myLocalBuilder->LocalType ); - myMethodIL->Emit( OpCodes::Ldstr, "Local value" ); - myMethodIL->Emit( OpCodes::Stloc_0, myLocalBuilder ); - - // End the scope of 'myLocalBuilder'. - myMethodIL->EndScope(); - - // Access the local variable outside the scope. - Console::WriteLine( "\nTrying to access the local variable outside the scope:\n" ); - myMethodIL->Emit( OpCodes::Stloc_0, myLocalBuilder ); - myMethodIL->Emit( OpCodes::Ldloc_0 ); - myMethodIL->Emit( OpCodes::Ret ); - - // Create 'MyDynamicClass' class. - Type^ myType1 = myTypeBuilder->CreateType(); - // - // - - // Create an instance of the 'MyDynamicClass'. - array^temp0 = {"HelloWorld"}; - Object^ myObject1 = Activator::CreateInstance( myType1, temp0 ); - - // Invoke 'MyDynamicMethod' method of 'MyDynamicClass'. - Object^ myObject2 = myType1->InvokeMember( "MyDynamicMethod", BindingFlags::InvokeMethod, nullptr, myObject1, nullptr ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception :{0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp deleted file mode 100644 index aa305292301..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::AccessControl; - -// Adds an ACL entry on the specified directory for the -// specified account. -void AddDirectorySecurity(String^ directoryName, String^ account, - FileSystemRights rights, AccessControlType controlType) -{ - // Create a new DirectoryInfo object. - DirectoryInfo^ dInfo = gcnew DirectoryInfo(directoryName); - - // Get a DirectorySecurity object that represents the - // current security settings. - DirectorySecurity^ dSecurity = dInfo->GetAccessControl(); - - // Add the FileSystemAccessRule to the security settings. - dSecurity->AddAccessRule( gcnew FileSystemAccessRule(account, - rights, controlType)); - - // Set the new access settings. - dInfo->SetAccessControl(dSecurity); -} - -// Removes an ACL entry on the specified directory for the -// specified account. -void RemoveDirectorySecurity(String^ directoryName, String^ account, - FileSystemRights rights, AccessControlType controlType) -{ - // Create a new DirectoryInfo object. - DirectoryInfo^ dInfo = gcnew DirectoryInfo(directoryName); - - // Get a DirectorySecurity object that represents the - // current security settings. - DirectorySecurity^ dSecurity = dInfo->GetAccessControl(); - - // Add the FileSystemAccessRule to the security settings. - dSecurity->RemoveAccessRule(gcnew FileSystemAccessRule(account, - rights, controlType)); - - // Set the new access settings. - dInfo->SetAccessControl(dSecurity); -} - -int main() -{ - String^ directoryName = "TestDirectory"; - String^ accountName = "MYDOMAIN\\MyAccount"; - if (!Directory::Exists(directoryName)) - { - Console::WriteLine("The directory {0} could not be found.", - directoryName); - return 0; - } - try - { - Console::WriteLine("Adding access control entry for {0}", - directoryName); - - // Add the access control entry to the directory. - AddDirectorySecurity(directoryName, accountName, - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Removing access control entry from {0}", - directoryName); - - // Remove the access control entry from the directory. - RemoveDirectorySecurity(directoryName, accountName, - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Done."); - } - catch (UnauthorizedAccessException^) - { - Console::WriteLine("You are not authorised to carry" + - " out this procedure."); - } - catch (System::Security::Principal:: - IdentityNotMappedException^) - { - Console::WriteLine("The account {0} could not be found.", accountName); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp deleted file mode 100644 index 506b780b31a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ fileName = "test.xml"; - if (!File::Exists(fileName)) - { - Console::WriteLine("The file " + fileName - + " does not exist."); - return 0; - } - try - { - Console::WriteLine("Encrypt " + fileName); - - // Encrypt the file. - File::Encrypt(fileName); - - Console::WriteLine("Decrypt " + fileName); - - // Decrypt the file. - File::Decrypt(fileName); - - Console::WriteLine("Done"); - } - catch (IOException^ ex) - { - Console::WriteLine("There was an IO problem."); - Console::WriteLine(ex->Message); - } - catch (PlatformNotSupportedException^) - { - Console::WriteLine("Encryption is not supported on " + - "this system."); - } - catch (NotSupportedException^) - { - Console::WriteLine("Encryption is not supported on " + - "this system."); - } - catch (UnauthorizedAccessException^) - { - Console::WriteLine("The operation could not be " - + "carried out."); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp deleted file mode 100644 index 5bd01722472..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::AccessControl; - -// Adds an ACL entry on the specified file for the specified account. - -void AddFileSecurity(String^ fileName, String^ account, - FileSystemRights rights, AccessControlType controlType) -{ - // Get a FileSecurity object that represents the - // current security settings. - FileSecurity^ fSecurity = File::GetAccessControl(fileName); - - // Add the FileSystemAccessRule to the security settings. - fSecurity->AddAccessRule(gcnew FileSystemAccessRule - (account,rights, controlType)); - - // Set the new access settings. - File::SetAccessControl(fileName, fSecurity); -} - -// Removes an ACL entry on the specified file for the specified account. - -void RemoveFileSecurity(String^ fileName, String^ account, - FileSystemRights rights, AccessControlType controlType) -{ - - // Get a FileSecurity object that represents the - // current security settings. - FileSecurity^ fSecurity = File::GetAccessControl(fileName); - - // Remove the FileSystemAccessRule from the security settings. - fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule - (account,rights, controlType)); - - // Set the new access settings. - File::SetAccessControl(fileName, fSecurity); -} - -int main() -{ - try - { - String^ fileName = "test.xml"; - - Console::WriteLine("Adding access control entry for " + fileName); - - // Add the access control entry to the file. - AddFileSecurity(fileName, "MYDOMAIN\\MyAccount", - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Removing access control entry from " + fileName); - - // Remove the access control entry from the file. - RemoveFileSecurity(fileName, "MYDOMAIN\\MyAccount", - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Done."); - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp deleted file mode 100644 index 4876d14c2dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -using namespace System; -using namespace System::IO; - - -// Move a file into another file, delete the original, -// and create a backup of the replaced file. - -void ReplaceFile(String^ fileToMoveAndDelete, - String^ fileToReplace, String^ backupOfFileToReplace) -{ - File::Replace(fileToMoveAndDelete, fileToReplace, - backupOfFileToReplace, false); -} - - -int main() -{ - try - { - String^ originalFile = "test.xml"; - String^ fileToReplace = "test2.xml"; - String^ backUpOfFileToReplace = "test2.xml.bac"; - - Console::WriteLine("Move the contents of " + originalFile + " into " - + fileToReplace + ", delete " + originalFile - + ", and create a backup of " + fileToReplace + "."); - - // Replace the file. - ReplaceFile(originalFile, fileToReplace, backUpOfFileToReplace); - - Console::WriteLine("Done"); - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp deleted file mode 100644 index 3cbff62e773..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::AccessControl; - - - static void Addencryption(String^ fileName) -{ - // Create a new FileInfo object. - FileInfo^ fInfo = gcnew FileInfo(fileName); - if (!fInfo->Exists) - { - fInfo->Create(); - } - // Add encryption. - fInfo->Encrypt(); - -} - - - static void Removeencryption(String^ fileName) -{ -// Create a new FileInfo object. - FileInfo^ fInfo = gcnew FileInfo(fileName); - if (!fInfo->Exists) - { - fInfo->Create(); - } - // Remove encryption. - fInfo->Decrypt(); -} - -int main() -{ - try - { - String^ fileName = "c:\\MyTest.txt"; - Console::WriteLine("Encrypt " + fileName); - - // Encrypt the file. - - Addencryption(fileName); - Console::WriteLine("Decrypt " + fileName); - - // Decrypt the file. - Removeencryption(fileName); - Console::WriteLine("Done"); - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//Encrypt c:\MyTest.txt -//Decrypt c:\MyTest.txt -//Done -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp deleted file mode 100644 index 27fb4bdc1ae..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp +++ /dev/null @@ -1,49 +0,0 @@ -using namespace System; -using namespace System::IO; - -// -array^ Openfile(String^ fileName) -{ - // Check the fileName argument. - if (fileName == nullptr || fileName->Length == 0) - { - throw gcnew ArgumentNullException("fileName"); - } - - // Check to see if the file exists. - FileInfo^ fInfo = gcnew FileInfo(fileName); - - // You can throw a personalized exception if - // the file does not exist. - if (!fInfo->Exists) - { - throw gcnew FileNotFoundException("The file was not found.", - fileName); - } - - try - { - // Open the file. - FileStream^ fStream = gcnew FileStream(fileName, FileMode::Open); - - // Create a buffer. - array^ buffer = gcnew array(fStream->Length); - - // Read the file contents to the buffer. - fStream->Read(buffer, 0, (int)fStream->Length); - - // return the buffer. - return buffer; - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - return nullptr; - } -} -// - -int main() -{ - -}; diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp deleted file mode 100644 index eb8b7aeaec2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// -#using -using namespace System; -using namespace System::IO; -using namespace System::Security::AccessControl; -using namespace System::Security::Principal; - -// Adds an ACL entry on the specified file for the specified account. -static void AddFileSecurity(String^ fileName, String^ account, - FileSystemRights^ rights, - AccessControlType^ controlType) -{ - // Create a new FileInfo object. - FileInfo^ fInfo = gcnew FileInfo(fileName); - if (!fInfo->Exists) - { - fInfo->Create(); - } - - // Get a FileSecurity object that represents the - // current security settings. - FileSecurity^ fSecurity = fInfo->GetAccessControl(); - - // Add the FileSystemAccessRule to the security settings. - fSecurity->AddAccessRule(gcnew FileSystemAccessRule(account, - *rights, *controlType)); - - // Set the new access settings. - fInfo->SetAccessControl(fSecurity); -} - -// Removes an ACL entry on the specified file for the specified account. -static void RemoveFileSecurity(String^ fileName, String^ account, - FileSystemRights^ rights, - AccessControlType^ controlType) -{ - // Create a new FileInfo object. - FileInfo^ fInfo = gcnew FileInfo(fileName); - if (!fInfo->Exists) - { - fInfo->Create(); - } - - // Get a FileSecurity object that represents the - // current security settings. - FileSecurity^ fSecurity = fInfo->GetAccessControl(); - - // Remove the FileSystemAccessRule from the security settings. - fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule(account, - *rights, *controlType)); - - // Set the new access settings. - fInfo->SetAccessControl(fSecurity); -} - -int main() -{ - try - { - String^ fileName = "c:\\test.xml"; - - Console::WriteLine("Adding access control entry for " + - fileName); - - // Add the access control entry to the file. - // Before compiling this snippet, change MyDomain to your - // domain name and MyAccessAccount to the name - // you use to access your domain. - AddFileSecurity(fileName, "MyDomain\\MyAccessAccount", - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Removing access control entry from " + - fileName); - - // Remove the access control entry from the file. - // Before compiling this snippet, change MyDomain to your - // domain name and MyAccessAccount to the name - // you use to access your domain. - RemoveFileSecurity(fileName, "MyDomain\\MyAccessAccount", - FileSystemRights::ReadData, AccessControlType::Allow); - - Console::WriteLine("Done."); - } - catch (Exception^ e) - { - Console::WriteLine(e); - } - -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//Adding access control entry for c:\test.xml -//Removing access control entry from c:\test.xml -//Done. -// -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp deleted file mode 100644 index f7dbe0f1cb2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// - -using namespace System; -using namespace System::IO; - - -// Move a file into another file, delete the original, -// and create a backup of the replaced file. -void ReplaceFile(String^ fileToMoveAndDelete, - String^ fileToReplace, String^ backupOfFileToReplace) -{ - // Create a new FileInfo object. - FileInfo^ fInfo = gcnew FileInfo(fileToMoveAndDelete); - - // replace the file. - fInfo->Replace(fileToReplace, backupOfFileToReplace, false); -} - - -int main() -{ - try - { - // originalFile and fileToReplace must contain - // the path to files that already exist in the - // file system. backUpOfFileToReplace is created - // during the execution of the Replace method. - - String^ originalFile = "test.xml"; - String^ fileToReplace = "test2.xml"; - String^ backUpOfFileToReplace = "test2.xml.bak"; - - if (File::Exists(originalFile) && (File::Exists(fileToReplace))) - { - Console::WriteLine("Move the contents of {0} into {1}, " + - "delete {0}, and create a backup of {1}", - originalFile, fileToReplace); - - // Replace the file. - ReplaceFile(originalFile, fileToReplace, - backUpOfFileToReplace); - Console::WriteLine("Done"); - } - else - { - Console::WriteLine("Either the file {0} or {1} doesn't " + - "exist.", originalFile, fileToReplace); - } - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } -} - - -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//Move the contents of c:\test1.xml into c:\test2.xml, delete c:\test1.xml, -//and create a backup of c:\test2.xml -//Done - -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp deleted file mode 100644 index e5fb1ade0c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - // Create a temporary file. - String^ filePath = Path::GetTempFileName(); - Console::WriteLine("Created a temp file at '{0}.", filePath); - - // Create a new FileInfo object. - FileInfo^ fInfo = gcnew FileInfo(filePath); - - // Get the read-only value for a file. - bool isReadOnly = fInfo->IsReadOnly; - - // Display whether the file is read-only. - Console::WriteLine("The file read-only value for '{0}' is {1}.", fInfo->Name, isReadOnly); - - // Set the file to read-only. - Console::WriteLine("Setting the read-only value for '{0}' to true.", fInfo->Name); - fInfo->IsReadOnly = true; - - // Get the read-only value for a file. - isReadOnly = fInfo->IsReadOnly; - - // Display that the file is now read-only. - Console::WriteLine("The file read-only value for '{0}' is {1}.", fInfo->Name, isReadOnly); - - // Make the file mutable again so it can be deleted. - fInfo->IsReadOnly = false; - - // Delete the temporary file. - fInfo->Delete(); - - return 0; -}; - -// This code produces output similar to the following, -// though results may vary based on the computer, file structure, etc.: -// -// Created a temp file at 'C:\Users\UserName\AppData\Local\Temp\tmpB438.tmp'. -// The file read-only value for 'tmpB438.tmp' is False. -// Setting the read-only value for 'tmpB438.tmp' to true. -// The file read-only value for 'tmpB438.tmp' is True. -// -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp deleted file mode 100644 index d31fd98984e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Security::AccessControl; - -int main() -{ - try - { - // Create a file and write data to it. - - // Create an array of bytes. - array^ messageByte = - Encoding::ASCII->GetBytes("Here is some data."); - - // Create a file using the FileStream class. - FileStream^ fWrite = gcnew FileStream("test.txt", FileMode::Create, - FileAccess::ReadWrite, FileShare::None, 8, FileOptions::None); - - // Write the number of bytes to the file. - fWrite->WriteByte((Byte)messageByte->Length); - - // Write the bytes to the file. - fWrite->Write(messageByte, 0, messageByte->Length); - - // Close the stream. - fWrite->Close(); - - - // Open a file and read the number of bytes. - - FileStream^ fRead = gcnew FileStream("test.txt", - FileMode::Open); - - // The first byte is the string length. - int length = (int)fRead->ReadByte(); - - // Create a new byte array for the data. - array^ readBytes = gcnew array(length); - - // Read the data from the file. - fRead->Read(readBytes, 0, readBytes->Length); - - // Close the stream. - fRead->Close(); - - // Display the data. - Console::WriteLine(Encoding::ASCII->GetString(readBytes)); - - Console::WriteLine("Done writing and reading data."); - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp deleted file mode 100644 index 3c25ca60661..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Security::AccessControl; -using namespace System::Security::Principal; - -int main() -{ - try - { - // Create a file and write data to it. - - // Create an array of bytes. - array^ messageByte = - Encoding::ASCII->GetBytes("Here is some data."); - - // Specify an access control list (ACL) - FileSecurity^ fs = gcnew FileSecurity(); - - fs->AddAccessRule( - gcnew FileSystemAccessRule("MYDOMAIN\\MyAccount", - FileSystemRights::Modify, AccessControlType::Allow)); - - // Create a file using the FileStream class. - FileStream^ fWrite = gcnew FileStream("test.txt", - FileMode::Create, FileSystemRights::Modify, - FileShare::None, 8, FileOptions::None, fs); - - // Write the number of bytes to the file. - fWrite->WriteByte((Byte)messageByte->Length); - - // Write the bytes to the file. - fWrite->Write(messageByte, 0, messageByte->Length); - - // Close the stream. - fWrite->Close(); - - // Open a file and read the number of bytes. - - FileStream^ fRead = - gcnew FileStream("test.txt", FileMode::Open); - - // The first byte is the string length. - int length = (int)fRead->ReadByte(); - - // Create a new byte array for the data. - array^ readBytes = gcnew array(length); - - // Read the data from the file. - fRead->Read(readBytes, 0, readBytes->Length); - - // Close the stream. - fRead->Close(); - - // Display the data. - Console::WriteLine(Encoding::ASCII->GetString(readBytes)); - - Console::WriteLine("Done writing and reading data."); - } - - catch (IdentityNotMappedException^) - { - Console::WriteLine("You need to use your own credentials " + - " 'MYDOMAIN\\MyAccount'."); - } - - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp deleted file mode 100644 index 98e59f68290..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -namespace PathExample -{ - public ref class GetCharExample - { - public: - static void Main() - { - // Get a list of invalid path characters. - array^ invalidPathChars = Path::GetInvalidPathChars(); - - Console::WriteLine("The following characters are invalid in a path:"); - ShowChars(invalidPathChars); - Console::WriteLine(); - - // Get a list of invalid file characters. - array^ invalidFileChars = Path::GetInvalidFileNameChars(); - - Console::WriteLine("The following characters are invalid in a filename:"); - ShowChars(invalidFileChars); - } - - static void ShowChars(array^ charArray) - { - Console::WriteLine("Char\tHex Value"); - // Display each invalid character to the console. - for each (Char someChar in charArray) - { - if (Char::IsWhiteSpace(someChar)) - { - Console::WriteLine(",\t{0:X4}", (Int16)someChar); - } - else - { - Console::WriteLine("{0:c},\t{1:X4}", someChar, (Int16)someChar); - } - } - } - }; -}; - -int main() -{ - PathExample::GetCharExample::Main(); -} -// Note: Some characters may not be displayable on the console. -// The output will look something like: -// -// The following characters are invalid in a path: -// Char Hex Value -// ", 0022 -// <, 003C -// >, 003E -// |, 007C -// ... -// -// The following characters are invalid in a filename: -// Char Hex Value -// ", 0022 -// <, 003C -// >, 003E -// |, 007C -// ... -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp deleted file mode 100644 index 47d43906d84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO::Ports; -using namespace System::ComponentModel; - -void main() -{ - array^ serialPorts = nullptr; - try - { - // Get a list of serial port names. - serialPorts = SerialPort::GetPortNames(); - } - catch (Win32Exception^ ex) - { - Console::WriteLine(ex->Message); - } - - Console::WriteLine("The following serial ports were found:"); - - // Display each port name to the console. - for each(String^ port in serialPorts) - { - Console::WriteLine(port); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp deleted file mode 100644 index f485421aac8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -//System::Runtime::InteropServices::IDispatchImplAttribute* -//System::Runtime::InteropServices::IDispatchImplType* -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// by default all classes in this assembly will use COM implementaion -// // But this class will use runtime implementaion - -[assembly:IDispatchImpl(IDispatchImplType::CompatibleImpl)]; -[IDispatchImpl(IDispatchImplType::InternalImpl)] -ref class MyClass{}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp deleted file mode 100644 index d06ee10f022..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -// System::Runtime::InteropServices::ComImportAttribute -// System::Runtime::InteropServices::InAttribute -// System::Runtime::InteropServices::OutAttribute -// System::Runtime::InteropServices::UnmanagedType -// System::Runtime::InteropServices::VarEnum - -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// If you do not have a type library for an interface -// you can redeclare it using ComImportAttribute. -// This is how the interface would look in an idl file. -//[ -//object, -//uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"), -//dual, helpstring("IMyStorage Interface"), -//pointer_default(unique) -//] -//interface IMyStorage : IDispatch -//{ -// [id(1)] -// HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem); -// [id(2)] -// HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems); -// [id(3)] -// HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems); -// [id(4), propget] -// HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty); -//}; -// This is the managed declaration. - -[ComImport] -[Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")] -interface class IMyStorage -{ - [DispId(1)] - Object^ GetItem( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrName ); - - //[return : MarshalAs(UnmanagedType::Interface)] - - [DispId(2)] - void GetItems( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrLocation, [Out,MarshalAs(UnmanagedType::SafeArray, - SafeArraySubType=VarEnum::VT_VARIANT)]array^Items ); - - [DispId(3)] - void GetItemDescriptions( [In]String^ bstrLocation, [In,Out,MarshalAs(UnmanagedType::SafeArray)]array^varDescriptions ); - - property bool IsEmpty - { - [DispId(4)] - [returnvalue:MarshalAs(UnmanagedType::VariantBool)] - bool get(); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp deleted file mode 100644 index 578ba56242a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// System::Assembly::GetCustomAttributes -// System::Runtime::InteropServices::ImportedFromTypeLibAttribute - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -class ClassA -{ -private: - static bool IsCOMAssembly( Assembly^ a ) - { - array^AsmAttributes = a->GetCustomAttributes( ImportedFromTypeLibAttribute::typeid, true ); - if ( AsmAttributes->Length > 0 ) - { - ImportedFromTypeLibAttribute^ imptlb = dynamic_cast(AsmAttributes[ 0 ]); - String^ strImportedFrom = imptlb->Value; - - // Print out the name of the DLL from which the assembly is imported. - Console::WriteLine( "Assembly {0} is imported from {1}", a->FullName, strImportedFrom ); - return true; - } - - // This is not a COM assembly. - Console::WriteLine( "Assembly {0} is not imported from COM", a->FullName ); - return false; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp deleted file mode 100644 index 78097a7488d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// System::Runtime::InteropServices::TypeLibTypeAttribute -// System::Runtime::InteropServices::TypeLibTypeFlags - -// -using namespace System; -using namespace System::Runtime::InteropServices; - -ref class ClassB -{ -private: - static bool IsHiddenInterface( Type^ InterfaceType ) - { - array^InterfaceAttributes = InterfaceType->GetCustomAttributes( TypeLibTypeAttribute::typeid, false ); - if ( InterfaceAttributes->Length > 0 ) - { - TypeLibTypeAttribute^ tlt = dynamic_cast(InterfaceAttributes[ 0 ]); - TypeLibTypeFlags flags = tlt->Value; - return (flags & TypeLibTypeFlags::FHidden) != TypeLibTypeFlags(0); - } - - return false; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp deleted file mode 100644 index 6484b104239..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// System::Runtime::InteropServices::TypeLibFuncAttribute -// System::Runtime::InteropServices::TypeLibFuncFlags - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -ref class ClassC -{ -private: - static bool IsHiddenMethod( MethodInfo^ mi ) - { - array^MethodAttributes = mi->GetCustomAttributes( TypeLibFuncAttribute::typeid, true ); - if ( MethodAttributes->Length > 0 ) - { - TypeLibFuncAttribute^ tlf = dynamic_cast(MethodAttributes[ 0 ]); - TypeLibFuncFlags flags = tlf->Value; - return (flags & TypeLibFuncFlags::FHidden) != (TypeLibFuncFlags)0; - } - - return false; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp deleted file mode 100644 index 4c29bcd1705..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp +++ /dev/null @@ -1,120 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace System::ComponentModel; -using namespace System::IO; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - // - String^ CreateMultilevelIndentString() - { - - // - // Creates a TextWriter to use as the base output writer. - System::IO::StringWriter^ baseTextWriter = gcnew System::IO::StringWriter; - - // Create an IndentedTextWriter and set the tab string to use - // as the indentation string for each indentation level. - System::CodeDom::Compiler::IndentedTextWriter^ indentWriter = gcnew IndentedTextWriter( baseTextWriter," " ); - - // - // - // Sets the indentation level. - indentWriter->Indent = 0; - - // - // Output test strings at stepped indentations through a recursive loop method. - WriteLevel( indentWriter, 0, 5 ); - - // Return the resulting string from the base StringWriter. - return baseTextWriter->ToString(); - } - - - // - void WriteLevel( IndentedTextWriter^ indentWriter, int level, int totalLevels ) - { - - // Output a test string with a new-line character at the end. - indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level ); - - // If not yet at the highest recursion level, call this output method for the next level of indentation. - if ( level < totalLevels ) - { - - // Increase the indentation count for the next level of indented output. - indentWriter->Indent++; - - // Call the WriteLevel method to write test output for the next level of indentation. - WriteLevel( indentWriter, level + 1, totalLevels ); - - // Restores the indentation count for this level after the recursive branch method has returned. - indentWriter->Indent--; - } - else - // - // Outputs a string using the WriteLineNoTabs method. - indentWriter->WriteLineNoTabs( "This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method." ); - // - // Outputs a test string with a new-line character at the end. - indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level ); - } - - - // - // - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - textBox1->Text = CreateMultilevelIndentString(); - } - - -public: - Form1() - { - System::Windows::Forms::Button^ button1 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->textBox1->Location = System::Drawing::Point( 8, 40 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 391, 242 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - button1->Location = System::Drawing::Point( 11, 8 ); - button1->Name = "button1"; - button1->Size = System::Drawing::Size( 229, 23 ); - button1->TabIndex = 1; - button1->Text = "Generate string using IndentedTextWriter"; - button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 407, 287 ); - this->Controls->Add( button1 ); - this->Controls->Add( this->textBox1 ); - this->Name = "Form1"; - this->Text = "IndentedTextWriter example"; - this->ResumeLayout( false ); - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp b/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp deleted file mode 100644 index b75ca626687..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; - -public ref class AppException: public Exception -{ -public: - AppException(String^ message ) : Exception(message) - {} - - AppException(String^ message, Exception^ inner) : Exception(message, inner) - {} -}; - -public ref class Example -{ -public: - void ThrowInner() - { - throw gcnew AppException("Exception in ThrowInner method."); - } - - void CatchInner() - { - try { - this->ThrowInner(); - } - catch (AppException^ e) { - throw gcnew AppException("Error in CatchInner caused by calling the ThrowInner method.", e); - } - } -}; - -int main() -{ - Example^ ex = gcnew Example(); - try { - ex->CatchInner(); - } - catch (AppException^ e) { - Console::WriteLine("In catch block of Main method."); - Console::WriteLine("Caught: {0}", e->Message); - if (e->InnerException != nullptr) - Console::WriteLine("Inner exception: {0}", e->InnerException); - } -} -// The example displays the following output: -// In catch block of Main method. -// Caught: Error in CatchInner caused by calling the ThrowInner method. -// Inner exception: AppException: Exception in ThrowInner method. -// at Example.ThrowInner() -// at Example.CatchInner() -// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp b/snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp deleted file mode 100644 index 2dad18f9049..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// System::Configuration::Install::InstallContext -// System::Configuration::Install::InstallContext.InstallContext() -// System::Configuration::Install::InstallContext.InstallContext(String*, String*[]) -// System::Configuration::Install::InstallContext.IsParameterTrue -// System::Configuration::Install::InstallContext.LogMessage -// System::Configuration::Install::InstallContext.Parameters - -/* The following example demonstrates the 'InstallContext()' and -InstallContext(String*, String*->Item[]) constructors, the 'Parameters' property -and the 'LogMessage' and 'IsParameterTrue' methods of the -'InstallContext' class. -When the program is invoked without any arguments an empty InstallContext -object is created and when the '/LogFile' and '/LogtoConsole' are -specified the InstallContext Object* is created by passing the respective -arguments to InstallContext(String*, String*[]). When the install method of the -installer is called, it checks for parameters from the command line and -depending on that it displays the progress messages onto the console and -also saves it to the specified log file. -*/ - -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -[RunInstallerAttribute(true)] -ref class InstallContext_Example: public Installer -{ -public: - InstallContext^ myInstallContext; - virtual void Install( IDictionary^ mySavedState ) override - { - // - StringDictionary^ myStringDictionary = myInstallContext->Parameters; - if ( myStringDictionary->Count == 0 ) - { - Console::Write( "No parameters have been entered in the command line " ); - Console::WriteLine( "hence, the install will take place in the silent mode" ); - } - else - { - // - // - // Check whether the "LogtoConsole" parameter has been set. - if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) - { - // Display the message to the console and add it to the logfile. - myInstallContext->LogMessage( "The 'Install' method has been called" ); - } - // - // - } - // - // The 'Install procedure should be added here. - } - - virtual void Uninstall( IDictionary^ mySavedState ) override - { - // The 'Uninstall' procedure should be added here. - } - - virtual void Rollback( IDictionary^ mySavedState ) override - { - if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) - { - myInstallContext->LogMessage( "The 'Rollback' method has been called" ); - } - - // The 'Rollback' procedure should be added here. - } - - virtual void Commit( IDictionary^ mySavedState ) override - { - if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) - { - myInstallContext->LogMessage( "The 'Commit' method has been called" ); - } - - // The 'Commit' procedure should be added here. - } -}; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - InstallContext_Example^ myInstallObject = gcnew InstallContext_Example; - IDictionary^ mySavedState = gcnew Hashtable; - if ( args->Length < 2 ) - { - // - // There are no command line arguments, create an empty 'InstallContext'. - myInstallObject->myInstallContext = gcnew InstallContext; - // - } - else - if ( (args->Length == 2) && (args[ 1 ]->Equals( "/?" )) ) - { - // Display the 'Help' for this utility. - Console::WriteLine( "Specify the '/Logfile' and '/LogtoConsole' parameters" ); - Console::WriteLine( "Example: " ); - Console::WriteLine( "InstallContext_InstallContext.exe /LogFile=example.log /LogtoConsole=true" ); - return 0; - } - else - { - // - // Create an InstallContext object with the given parameters. - array^commandLine = gcnew array(args->Length - 1); - for ( int i = 0; i < args->Length - 1; i++ ) - { - commandLine[ i ] = args[ i + 1 ]; - } - myInstallObject->myInstallContext = gcnew InstallContext( args[ 1 ],commandLine ); - // - } - - try - { - // Call the 'Install' method. - myInstallObject->Install( mySavedState ); - - // Call the 'Commit' method. - myInstallObject->Commit( mySavedState ); - } - catch ( Exception^ ) - { - // Call the 'Rollback' method. - myInstallObject->Rollback( mySavedState ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp b/snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp deleted file mode 100644 index f395a783e17..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// System::Configuration::Install::InstallEventArgs -// System::Configuration::Install::InstallEventArgs.InstallEventArgs() -// System::Configuration::Install::InstallEventArgs.InstallEventArgs(IDictionary*) -// System::Configuration::Install::InstallEventArgs.SavedState - -/* - The following example demonstrates the 'InstallEventArgs()' and - 'InstallEventArgs(IDictionary*)' constructors and the 'SavedState' - property of the 'InstallEventArgs' property. There are two new - events called 'BeforeCommit' and 'AfterCommit'. The handlers of - these events are invoked from the protected: - methods named 'OnBeforeCommit' - and 'OnAfterCommit' respectively. These events are raised when the - 'Commit' method is called. - - Note : - a) The two events named 'BeforeCommit' and 'AfterCommit' are added - only for example purposes, since there are already - events named 'Committing' and 'Committed' which perform the same - function. This example can be made a basis for a new stage being - added to the already existing four stages namely 'Install', 'Commit', - 'Rollback' and 'Uninstall'. - - b) Run the example with the help of InstallUtil.exe - InstallUtil InstallEventArgs.exe -*/ - -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ -public: - // Simple events to handle before and after commit handlers. - event InstallEventHandler^ BeforeCommit; - event InstallEventHandler^ AfterCommit; - - MyInstaller() - { - // Add handlers to the events. - BeforeCommit += gcnew InstallEventHandler( this, &MyInstaller::BeforeCommitHandler ); - AfterCommit += gcnew InstallEventHandler( this, &MyInstaller::AfterCommitHandler ); - } - - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - Console::WriteLine( "Install ...\n" ); - } - - virtual void Commit( IDictionary^ savedState ) override - { - Console::WriteLine( "Before Committing ...\n" ); - // Call the 'OnBeforeCommit' protected method. - OnBeforeCommit( savedState ); - Installer::Commit( savedState ); - Console::WriteLine( "Committing ...\n" ); - // Call the 'OnAfterCommit' protected method. - OnAfterCommit( savedState ); - Console::WriteLine( "After Committing ...\n" ); - } - - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - Console::WriteLine( "RollBack ...\n" ); - } - - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - Console::WriteLine( "UnInstall ...\n" ); - } - -// - // Protected method that invoke the handlers associated with the 'BeforeCommit' event. -protected: - virtual void OnBeforeCommit( IDictionary^ savedState ) - { - BeforeCommit( this, gcnew InstallEventArgs( savedState ) ); - } -// - -// - // Protected method that invoke the handlers associated with the 'AfterCommit' event. -protected: - virtual void OnAfterCommit( IDictionary^ savedState ) - { - AfterCommit( this, gcnew InstallEventArgs ); - } -// - -// - // A simple event handler to exemplify the example. - void BeforeCommitHandler( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "BeforeCommitHandler event handler has been called\n" ); - Console::WriteLine( "The count of saved state objects are : {0}\n", - e->SavedState->Count ); - } -// - - // A simple event handler to exemplify the example. -private: - void AfterCommitHandler( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "AfterCommitHandler event handler has been called\n" ); - } -}; -// - -// An Assembly that has its own installer. -void main() -{ - Console::WriteLine( "This assembly is just an example for the Installer\n" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp b/snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp deleted file mode 100644 index 1f1bcfe9e83..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp +++ /dev/null @@ -1,114 +0,0 @@ - - -// System::Configuration::Install::InstallException -// System::Configuration::Install::InstallException.InstallException() -// System::Configuration::Install::InstallException.InstallException(String, Exception) -// System::Configuration::Install::InstallException.InstallException(String) -/* -The following example demonstrates the 'InstallException()', 'InstallException(String)' -and 'InstallException(String, Exception)' constructors for 'InstallException' class. -This example shows an assembly having its own installer named 'MyInstaller' -which has an attribute 'RunInstallerAttribute', indicating that this installer -will be invoked by InstallUtil.exe. InstallUtil.exe calls the 'Install', 'Commit', -'Rollback' and 'Uninstall' methods. The code in 'Commit' method presumes that -a file named 'FileDoesNotExist.txt' exists before the installation of the -assembly can be committed. If the file 'FileDoesNotExist.txt' does not exist -'Commit' raises a 'InstallException'. Same is the case with 'Uninstall', -uninstalltion will only progress if the file named 'FileDoesNotExist.txt' -exists else it raises an 'InstallException'. In 'Rollback' some piece of -code is executed which may raise an exception. If the exception is raised then -it is caught and an 'InstallException' is raised with that exception being passed -to it. - -Note : Run this example with the help of 'InstallUtil.exe' -InstallUtil InstallException.exe -InstallUtil /u InstallException.exe -*/ -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ -public: - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - Console::WriteLine( "Install ..." ); - - // Commit is called when install goes through successfully. - // Rollback is called if there is any error during Install. - // Uncommenting the code below will lead to 'RollBack' being called, - // currently 'Commit' shall be called. - // throw new IOException(); - } - - - // - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - Console::WriteLine( "Commit ..." ); - - // Throw an error if a particular file doesn't exist. - if ( !File::Exists( "FileDoesNotExist.txt" ) ) - throw gcnew InstallException; - - - // Perform the final installation if the file exists. - } - - - // - // - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - Console::WriteLine( "RollBack ..." ); - try - { - - // Performing some activity during rollback that raises an 'IOException*'. - throw gcnew IOException; - } - catch ( Exception^ e ) - { - throw gcnew InstallException( "IOException* raised",e ); - } - - - // Perform the remaining rollback activites if no exception raised. - } - - - // - // - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - Console::WriteLine( "UnInstall ..." ); - - // Throw an error if a particular file doesn't exist. - if ( !File::Exists( "FileDoesNotExist.txt" ) ) - throw gcnew InstallException( "The file 'FileDoesNotExist' does not exist" ); - - - // Perform the uninstall activites if the file exists. - } - - // -}; - -int main() -{ - Console::WriteLine( "This assembly is just an example for the Installer" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp b/snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp deleted file mode 100644 index 6806f207863..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp +++ /dev/null @@ -1,82 +0,0 @@ - - -// System::Configuration::Install::Installer -/* The following program demonstrates the use of the 'Installer' -class. It creates a class which inherits from 'Installer'. -When the 'Commit' is about to complete, 'Committing' event -occurs and a message is displayed when the event occurs. -*/ -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -// Set 'RunInstaller' attribute to true. - -[RunInstaller(true)] -ref class MyInstallerClass: public Installer -{ -private: - - // Event handler for 'Committing' event. - void MyInstaller_Committing( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "" ); - Console::WriteLine( "Committing Event occurred." ); - Console::WriteLine( "" ); - } - - - // Event handler for 'Committed' event. - void MyInstaller_Committed( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "" ); - Console::WriteLine( "Committed Event occurred." ); - Console::WriteLine( "" ); - } - - -public: - MyInstallerClass() - { - - // Attach the 'Committed' event. - this->Committed += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committed ); - - // Attach the 'Committing' event. - this->Committing += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committing ); - } - - - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - } - - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - -}; - -int main() -{ - Console::WriteLine( "Usage : installutil.exe Installer.exe " ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp deleted file mode 100644 index 9451bee27cb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// System::Configuration::Install::InstallerCollection -// System::Configuration::Install::InstallerCollection.Add(Installer) - -/* -The following example demonstrates the Add(Installer) -method of the 'InstallerCollection' class. This example provides -an implementation similar to that of 'InstallUtil.exe'. It installs -assemblies with the options preceding that particular assembly. -If an option is not specified for an assembly the previous assemblies -options are taken if there is a previous assembly in the list. If the -'/u' or '/uninstall' option is specified then the assemblies are uninstalled. -If the '/?' or '/help' option is provided then the help information is -displayed to the console. -*/ - -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -void PrintHelpMessage() -{ - Console::WriteLine( "Usage : InstallerCollection_Add [/u | /uninstall] [option [...]] assembly " + - "[[option [...]] assembly] [...]]" ); - Console::WriteLine( "InstallerCollection_Add executes the installers in each of" + - "the given assembly. If /u or /uninstall option" + - "option is given it uninstalls the assemblies." ); -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - ArrayList^ options = gcnew ArrayList; - String^ myOption; - bool toUnInstall = false; - bool toPrintHelp = false; - TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller; - InstallContext^ myInstallContext; - - try - { - for ( int i = 0; i < args->Length; i++ ) - { - // Process the arguments. - if ( args[ i ]->StartsWith( "/" ) || args[ i ]->StartsWith( "-" ) ) - { - myOption = args[ i ]->Substring( 1 ); - // Determine whether the option is to 'uninstall' a assembly. - if ( String::Compare( myOption, "u", true ) == 0 || - String::Compare( myOption, "uninstall", true ) == 0 ) - { - toUnInstall = true; - continue; - } - // Determine whether the option is for printing help information. - if ( String::Compare( myOption, "?", true ) == 0 || - String::Compare( myOption, "help", true ) == 0 ) - { - toPrintHelp = true; - continue; - } - // Add the option encountered to the list of all options - // encountered for the current assembly. - options->Add( myOption ); - } - else - { - // Determine whether the assembly file exists. - if ( !File::Exists( args[ i ] ) ) - { - // If assembly file doesn't exist then print error. - Console::WriteLine( " Error : {0} - Assembly file doesn't exist.", args[ i ] ); - return 0; - } -// - // Create an instance of 'AssemblyInstaller' that installs the given assembly. - myAssemblyInstaller = gcnew AssemblyInstaller( args[ i ], - (array^)(options->ToArray( String::typeid )) ); - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Add( myAssemblyInstaller ); -// - } - } - // then print help message. - if ( toPrintHelp || myTransactedInstaller->Installers->Count == 0 ) - { - PrintHelpMessage(); - return 0; - } - - // Create an instance of 'InstallContext' with the options specified. - myInstallContext = - gcnew InstallContext( "Install.log", - (array^)(options->ToArray( String::typeid )) ); - myTransactedInstaller->Context = myInstallContext; - - // Install or Uninstall an assembly depending on the option provided. - if ( !toUnInstall ) - myTransactedInstaller->Install( gcnew Hashtable ); - else - myTransactedInstaller->Uninstall( nullptr ); - } - catch ( Exception^ e ) - { - Console::WriteLine( " Exception raised : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp deleted file mode 100644 index 777a3ed5ce2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// System::Configuration::Install::InstallerCollection.AddRange(Installer->Item[]) - -/* - The following example demonstrates the 'AddRange(Installer->Item[])' - method of the 'InstallerCollection' class. It Creates 'AssemblyInstaller' - instances for 'MyAssembly1.exe' and for 'MyAssembly2.exe'. These - instances are added to an instance of 'TransactedInstaller'. The installation - process installs both 'MyAssembly1.exe' and 'MyAssembly2.exe'. -*/ - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -void main() -{ - try - { -// - ArrayList^ myInstallers = gcnew ArrayList; - TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller; - InstallContext^ myInstallContext; - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. - myAssemblyInstaller = - gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the list of installers. - myInstallers->Add( myAssemblyInstaller ); - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. - myAssemblyInstaller = - gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the list of installers. - myInstallers->Add( myAssemblyInstaller ); - - // Add the installers to the 'TransactedInstaller' instance. - myTransactedInstaller->Installers->AddRange( safe_cast^>(myInstallers->ToArray( Installer::typeid )) ); -// - - // Create a instance of 'InstallContext' with log file named 'Install::log'. - myInstallContext = - gcnew InstallContext( "Install.log",nullptr ); - myTransactedInstaller->Context = myInstallContext; - - // Install an assembly. - myTransactedInstaller->Install( gcnew Hashtable ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp deleted file mode 100644 index abbfe8fd906..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// System::Configuration::Install::InstallerCollection.CopyTo(Installer->Item[], Int32) - -/* - The following example demonstrates the 'CopyTo(Installer->Item[], Int32)' method - of the 'InstallerCollection' class. It Creates 'AssemblyInstaller' instances - for 'MyAssembly1.exe' and 'MyAssembly2.exe'. These instances of - 'AssemblyInstaller' are added to an instance of 'TransactedInstaller' - instance. The names of the assemblies to be installed - are displayed on the console. The installation process then installs - both 'MyAssembly1.exe' and 'MyAssembly2.exe'. -*/ - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -void main() -{ - // - TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller; - InstallContext^ myInstallContext; - - // Create an instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. - myAssemblyInstaller = - gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Add( myAssemblyInstaller ); - - // Create an instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. - myAssemblyInstaller = - gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Add( myAssemblyInstaller ); - - array^ myInstallers = - gcnew array(myTransactedInstaller->Installers->Count); - - myTransactedInstaller->Installers->CopyTo( myInstallers, 0 ); - // Print the assemblies to be installed. - Console::WriteLine( "Printing all assemblies to be installed -" ); - for ( int i = 0; i < myInstallers->Length; i++ ) - { - if ( dynamic_cast( myInstallers[ i ] ) ) - { - Console::WriteLine( "{0} {1}", i + 1, ( (AssemblyInstaller^)( myInstallers[ i ]) )->Path ); - } - } -// - - // Create a instance of 'InstallContext' with log file named 'Install.log'. - myInstallContext = - gcnew InstallContext( "Install.log",nullptr ); - myTransactedInstaller->Context = myInstallContext; - - // Install an assembly. - myTransactedInstaller->Install( gcnew Hashtable ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp deleted file mode 100644 index 0a38efbeaf8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// System::Configuration::Install::InstallerCollection.Insert(Int32, Installer) -// System::Configuration::Install::InstallerCollection.AddRange(InstallerCollection) - -/* -The following example demonstrates the 'Insert(Int32, Installer)' and -'AddRange(InstallerCollection)' methods of the 'InstallerCollection' -class. It Creates 'AssemblyInstaller' instances for 'MyAssembly1.exe' -and 'MyAssembly2.exe'. These instances of 'AssemblyInstaller' are -added to an instance of 'TransactedInstaller' named 'myTransactedInstaller1'. -The installers in the 'myTransactedInstaller1' are copied to another -instance of 'TransactedInstaller' named 'myTransactedInstaller2'.The -installation process installs both 'MyAssembly1.exe' and 'MyAssembly2.exe'. -*/ - -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -void main() -{ -// -// - TransactedInstaller^ myTransactedInstaller1 = gcnew TransactedInstaller; - TransactedInstaller^ myTransactedInstaller2 = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; - InstallContext^ myInstallContext; - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. - myAssemblyInstaller = - gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller1->Installers->Insert( 0, myAssemblyInstaller ); - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. - myAssemblyInstaller = - gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller1->Installers->Insert( 1, myAssemblyInstaller ); - - // Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'. - myTransactedInstaller2->Installers->AddRange( myTransactedInstaller1->Installers ); -// -// - - // Create a instance of 'InstallContext' with log file named 'Install.log'. - myInstallContext = - gcnew InstallContext( "Install.log",nullptr ); - myTransactedInstaller2->Context = myInstallContext; - - // Install an assembly. - myTransactedInstaller2->Install( gcnew Hashtable ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp deleted file mode 100644 index e5228341c9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// System::Configuration::Install::InstallerCollection.Item(Int32) - -/* -The following example demonstrates the 'Item(Int32)' method of the -'InstallerCollection' class. It creates 'AssemblyInstaller' instances -for 'MyAssembly1.exe' and 'MyAssembly2.exe'. These instances are added -to an instance of 'TransactedInstaller'. The names of all the assemblies -that are to be installed are displayed to the console. The installation -process installs both 'MyAssembly1.exe' and 'MyAssembly2.exe'. -*/ - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -void main() -{ - try - { - // - TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller; - InstallContext^ myInstallContext; - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. - myAssemblyInstaller = gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Add( myAssemblyInstaller ); - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. - myAssemblyInstaller = gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Add( myAssemblyInstaller ); - - //Print the assemblies to be installed. - InstallerCollection^ myInstallers = myTransactedInstaller->Installers; - Console::WriteLine( "\nPrinting all assemblies to be installed" ); - for ( int i = 0; i < myInstallers->Count; i++ ) - { - if ( dynamic_cast(myInstallers[ i ]) ) - { - Console::WriteLine( "{0} {1}", i + 1, safe_cast(myInstallers[ i ])->Path ); - } - } - // - - // Create a instance of 'InstallContext' with log file named 'Install.log'. - myInstallContext = gcnew InstallContext( "Install.log",nullptr ); - myTransactedInstaller->Context = myInstallContext; - - // Install an assembly . - myTransactedInstaller->Install( gcnew Hashtable ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp deleted file mode 100644 index a06d225c140..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// System::Configuration::Install::InstallerCollection.Remove(Installer) -// System::Configuration::Install::InstallerCollection.Contains(Installer) -// System::Configuration::Install::InstallerCollection.IndexOf(Installer) - -/* -The following example demonstrates the 'Remove(Installer)', -'Contains(Installer)' and 'IndexOf(Installer)' methods of the -'InstallerCollection' class. Create's 'AssemblyInstaller' instances -for 'MyAssembly1.exe' and for 'MyAssembly2.exe'. These instances -of 'AssemblyInstaller' are added to an instance of 'TransactedInstaller'. -The 'AssemblyIntaller' instance for 'MyAssembly2.exe' is removed -from the installers collection of the 'TransactedInstaller' instance. -The installation process is started which installs only 'MyAssembly1.exe'. -*/ - -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; -void main() -{ - try - { - // - // - // - TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller1; - AssemblyInstaller^ myAssemblyInstaller2; - InstallContext^ myInstallContext; - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. - myAssemblyInstaller1 = gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Insert( 0, myAssemblyInstaller1 ); - - // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. - myAssemblyInstaller2 = gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); - - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Insert( 1, myAssemblyInstaller2 ); - - // Remove the 'myAssemblyInstaller2' from the 'Installers' collection. - if ( myTransactedInstaller->Installers->Contains( myAssemblyInstaller2 ) ) - { - Console::WriteLine( "\nInstaller at index : {0} is being removed", myTransactedInstaller->Installers->IndexOf( myAssemblyInstaller2 ) ); - myTransactedInstaller->Installers->Remove( myAssemblyInstaller2 ); - } - // - // - // - - //Print the installers to be installed. - InstallerCollection^ myInstallers = myTransactedInstaller->Installers; - Console::WriteLine( "\nPrinting all installers to be installed\n" ); - for ( int i = 0; i < myInstallers->Count; i++ ) - { - if ( dynamic_cast(myInstallers[ i ]) ) - { - Console::WriteLine( "{0} {1}", i + 1, safe_cast(myInstallers[ i ])->Path ); - } - } - - // Create a instance of 'InstallContext' with log file named 'Install.log'. - myInstallContext = gcnew InstallContext( "Install.log",nullptr ); - myTransactedInstaller->Context = myInstallContext; - - // Install an assembly. - myTransactedInstaller->Install( gcnew Hashtable ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp deleted file mode 100644 index 391cd5a87a4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp +++ /dev/null @@ -1,88 +0,0 @@ -/* - System::Configuration::Install::Installer.AfterInstall - - The following example demonstrates the event 'AfterInstall' of the - 'Installer' class. The event 'AfterInstall' is raised by the method - 'OnAfterInstall'. - - Use the installer process 'InstallUtil' to run the assembly - 'Installer_AfterInstall.exe'. - -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ - // - // MyInstaller is derived from the class 'Installer'. -public: - MyInstaller() - { - AfterInstall += gcnew InstallEventHandler( this, &MyInstaller::AfterInstallEventHandler ); - } - -private: - void AfterInstallEventHandler( Object^ sender, InstallEventArgs^ e ) - { - // Add steps to perform any actions after the install process. - Console::WriteLine( "Code for AfterInstallEventHandler" ); - } - // - - // Override the 'Install' method. -public: - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "Install method of MyInstaller called" ); - Console::WriteLine( "" ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - } - - // Override the 'OnBeforeInstall' method. - virtual void OnBeforeInstall( IDictionary^ savedState ) override - { - Installer::OnBeforeInstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnBeforeInstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } - -protected: - // Override the 'OnAfterInstall' method. - virtual void OnAfterInstall( IDictionary^ savedState ) override - { - Installer::OnAfterInstall( savedState ); - } -}; - -void main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly Installer_AfterInstall.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp deleted file mode 100644 index da1a8c557cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// System::Configuration::Install::Installer.AfterRollback -/* The following program demonstrates the 'AfterRollback' event of the -'Installer' class. It overrides the Install method, explicitly throws -arguement exception so that 'Rollback' method is called. When the -'RollBack' is complete, 'AfterRollback' event occurs and a message is -displayed when the event occurs. -*/ -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -// Set 'RunInstaller' attribute to true. - -[RunInstaller(true)] -ref class MyInstallerClass: public Installer -{ -private: - - // Event handler for 'AfterRollback' event. - void MyInstaller_AfterRollBack( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "AfterRollBack Event occurred." ); - } - - -public: - MyInstallerClass() - { - - // Attach the 'AfterRollback' event. - this->AfterRollback += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_AfterRollBack ); - } - - - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - - // Explicitly throw an exception so that roll back is called. - throw gcnew ArgumentException( "Arg Exception" ); - } - - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - -}; - -int main() -{ - Console::WriteLine( "Usage : installutil.exe Installer_AfterRollback.exe " ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp deleted file mode 100644 index 7125f43cb9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -System::Configuration::Install::Installer.AfterUninstall - -The following example demonstrates the event 'AfterUninstall' of the -'Installer' class. This event is raised by the method 'OnAfterUninstall'. - -Use the installer process 'InstallUtil -u' to run the assembly -'Installer_AfterUninstall.exe'. - -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ - // - // MyInstaller is derived from the class 'Installer'. -private: - MyInstaller() - { - AfterUninstall += gcnew InstallEventHandler( this, &MyInstaller::AfterUninstallEventHandler ); - } - - void AfterUninstallEventHandler( Object^ sender, InstallEventArgs^ e ) - { - // Add steps to perform any actions before the Uninstall process. - Console::WriteLine( "Code for AfterUninstallEventHandler" ); - } - // - -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "Uninstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } - - // Override the 'OnBeforeUninstall' method. - virtual void OnBeforeUninstall( IDictionary^ savedState ) override - { - Installer::OnBeforeUninstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnBeforeUninstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } - -protected: - // Override the 'OnAfterUninstall' method. - virtual void OnAfterUninstall( IDictionary^ savedState ) override - { - Installer::OnAfterUninstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnAfterUninstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } -}; - -void main() -{ - Console::WriteLine( "Use 'installutil.exe -u' to run the assembly Installer_AfterUninstall.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp deleted file mode 100644 index d29ac6f3c70..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* -System::Configuration::Install::Installer.BeforeInstall - -The following example demonstrates the event 'BeforeInstall' of the -'Installer' class. The event 'BeforeInstall' is raised by the method -'OnBeforeInstall'. - -Use the installer process 'InstallUtil' to run the assembly -Installer_BeforeInstall.exe. - -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ - // - // MyInstaller is derived from the class 'Installer'. -private: - MyInstaller() - { - BeforeInstall += gcnew InstallEventHandler( this, &MyInstaller::BeforeInstallEventHandler ); - } - - void BeforeInstallEventHandler( Object^ sender, InstallEventArgs^ e ) - { - // Add steps to perform any actions before the install process. - Console::WriteLine( "Code for BeforeInstallEventHandler" ); - } - // - -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "Install method of MyInstaller called" ); - Console::WriteLine( "" ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - } - -protected: - // Override the 'OnBeforeInstall' method. - virtual void OnBeforeInstall( IDictionary^ savedState ) override - { - Installer::OnBeforeInstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnBeforeInstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } - - // Override the 'OnAfterInstall' method. - virtual void OnAfterInstall( IDictionary^ savedState ) override - { - Installer::OnAfterInstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnAfterInstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } -}; - -void main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly Installer_BeforeInstall.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp deleted file mode 100644 index aa830ddd1d5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -// System::Configuration::Install::Installer.BeforeRollback -/* The following program demonstrates the 'BeforeRollback' event of the -'Installer' class. It overrides the Install method, explicitly throws -arguement exception so that 'Rollback' method is called. When the -'RollBack' is about to complete, 'BeforeRollback' event occurs and -a message is displayed when the event occurs. -*/ -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -// Set 'RunInstaller' attribute to true. - -[RunInstaller(true)] -ref class MyInstallerClass: public Installer -{ -public: - MyInstallerClass() - { - - // Attach the 'BeforeRollback' event. - this->BeforeRollback += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_BeforeRollBack ); - - // Attach the 'AfterRollback' event. - this->AfterRollback += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_AfterRollback ); - } - - -private: - - // Event handler for 'BeforeRollback' event. - void MyInstaller_BeforeRollBack( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "" ); - Console::WriteLine( "BeforeRollback Event occurred." ); - Console::WriteLine( "" ); - } - - - // Event handler for 'AfterRollback' event. - void MyInstaller_AfterRollback( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "" ); - Console::WriteLine( "AfterRollback Event occurred." ); - Console::WriteLine( "" ); - } - - -public: - - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - - // Explicitly throw an exception so that roll back is called. - throw gcnew ArgumentException( "Arg Exception" ); - } - - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - -}; - -int main() -{ - Console::WriteLine( "Usage : installutil.exe Installer_BeforeRollback.exe " ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp deleted file mode 100644 index cc85c76dcf5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -System::Configuration::Install::Installer.BeforeUninstall - -The following example demonstrates the event 'BeforeUninstall' of the -'Installer' class. This event is raised by the method 'OnBeforeUninstall'. - -Use the installer process 'InstallUtil -u' to run the assembly -'Installer_BeforeUninstall.exe'. - -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ - // - // MyInstaller is derived from the class 'Installer'. -private: - MyInstaller() - { - BeforeUninstall += gcnew InstallEventHandler( this, &MyInstaller::BeforeUninstallEventHandler ); - } - - void BeforeUninstallEventHandler( Object^ sender, InstallEventArgs^ e ) - { - // Add steps to perform any actions before the Uninstall process. - Console::WriteLine( "Code for BeforeUninstallEventHandler" ); - } - // - -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "Uninstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } - -protected: - // Override the 'OnBeforeUninstall' method. - virtual void OnBeforeUninstall( IDictionary^ savedState ) override - { - Installer::OnBeforeUninstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnBeforeUninstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } - - // Override the 'OnAfterUninstall' method. - virtual void OnAfterUninstall( IDictionary^ savedState ) override - { - Installer::OnAfterUninstall( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "OnAfterUninstall method of MyInstaller called" ); - Console::WriteLine( "" ); - } -}; - -void main() -{ - Console::WriteLine( "Use 'installutil.exe -u' to run the assembly Installer_BeforeUninstall.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp deleted file mode 100644 index fe813f41274..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp +++ /dev/null @@ -1,83 +0,0 @@ -/* -System::Configuration::Install::Installer.OnCommitting(Idictionary savedState) -System::Configuration::Install::Installer.OnCommitted(Idictionary savedState) - -The following example demonstrates the methods 'OnCommitting' and -'OnCommitted' of the 'Installer' class. The methods 'OnCommitting' and -'OnCommitted' are overridden in the derived class. Space is provided -for the user to add the steps to be performed before committing and -after committing. - -'Installer_Committed.exe' needs to be run using the installer process -'installutil'. -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ -public: - - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - Console::WriteLine( "" ); - Console::WriteLine( "Install method of MyInstaller called" ); - Console::WriteLine( "" ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - } - - // - // Override the 'OnCommitting' method. -protected: - virtual void OnCommitting( IDictionary^ savedState ) override - { - Installer::OnCommitting( savedState ); - - // Add steps to be done before committing an application. - Console::WriteLine( "The OnCommitting method of MyInstaller called" ); - } - // - - // - // Override the 'OnCommitted' method. -protected: - virtual void OnCommitted( IDictionary^ savedState ) override - { - Installer::OnCommitted( savedState ); - - // Add steps to be done after committing an application. - Console::WriteLine( "The OnCommitted method of MyInstaller called" ); - } - // -}; - -void main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly Installer_Committed.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp deleted file mode 100644 index 99af9bbebfc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Configuration::Install::Installer.Committed -/* The following program demonstrates the 'Committed' event of the -'Installer' class. When the 'Commit' is complete, 'Committed' event -is fired and a message is displayed. -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -// Set 'RunInstaller' attribute to true. -[RunInstaller(true)] -ref class MyInstallerClass: public Installer -{ - // -public: - MyInstallerClass() - { - // Attach the 'Committed' event. - this->Committed += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committed ); - } - -private: - // Event handler for 'Committed' event. - void MyInstaller_Committed( Object^ sender, InstallEventArgs^ e ) - { - Console::WriteLine( "Committed Event occurred." ); - } - // - -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } -}; - -void main() -{ - Console::WriteLine( "Usage : installutil.exe Installer_Committed.exe " ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp deleted file mode 100644 index eeade68268f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// System::Configuration::Install::Installer.Committing -/* The following program demonstrates the 'Committing' event of the -'Installer' class. When the 'Commit' is ab->Item[Out] to* complete, -'Committing' event is fired and a message is displayed. -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -// Set 'RunInstaller' attribute to true. -[RunInstaller(true)] -public ref class MyInstallerClass: public Installer -{ - // -public: - MyInstallerClass() - : Installer() - { - // Attach the 'Committing' event. - this->Committing += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committing ); - } - -private: - // Event handler for 'Committing' event. - void MyInstaller_Committing( Object^ /*sender*/, InstallEventArgs^ /*e*/ ) - { - Console::WriteLine( "Committing Event occurred." ); - } - // - -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - __super::Install( savedState ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - __super::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - __super::Rollback( savedState ); - } -}; - -int main() -{ - Console::WriteLine( "Usage : installutil.exe Installer_Committing.exe " ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp deleted file mode 100644 index f4b0501ac9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* -System::Configuration::Install::Installer.Context - -The following example demonstrates the 'Context' property of -the 'Installer' class. The contents of the 'Context' property -like information about the location of the log file for the -installation, the location of the file to save information -required by the Uninstall method, and the command line that -was entered when the installation executable was run is -displayed on the console. - -Use 'installutil' to run the assembly Installer_Context.exe -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; -using namespace System::Collections::Specialized; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ -public: - - // Override the 'Install' method. - virtual void Install( IDictionary^ mySavedState ) override - { - Installer::Install( mySavedState ); - Console::WriteLine( "" ); - - // - StringDictionary^ myStringDictionary = Context->Parameters; - if ( Context->Parameters->Count > 0 ) - { - Console::WriteLine( "Context Property : " ); - IEnumerator^ myEnum = Context->Parameters->Keys->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ myString = safe_cast(myEnum->Current); - Console::WriteLine( Context->Parameters[ myString ] ); - } - } - // - Console::WriteLine( "" ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - } -}; - -void main() -{ - Console::WriteLine( "Run the assembly Installer_Context.exe using the installer process 'installutil'" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp deleted file mode 100644 index 8f3bd6adc00..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -System::Configuration::Install::Installer.HelpText - -The following example demonstrates the property 'HelpText'. The -'HelpText' property is defined in the 'Installer', which when called -returns the description of the 'Installer' and the command line -options for the installation executable, such as the InstallUtil.exe utility, -that can be passed to and understood by the 'Installer'. - -Use 'installutil' to run the assembly Installer_HelpText.exe. -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - String^ myHelpText = HelpText; - Console::WriteLine( "Help Text : " ); - Console::WriteLine( myHelpText ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - } - -// - // Override the property 'HelpText'. - property String^ HelpText - { - virtual String^ get() override - { - return "Installer Description : This is a sample Installer\n" - + "HelpText is used to provide useful information about the " - + "installer."; - } - } -// -}; - -int main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly Installer_HelpText.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp deleted file mode 100644 index b13ecba3e96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/* -System::Configuration::Install::Installer.Install -System::Configuration::Install::Installer.Commit - -The following example demonstrates the 'Install' and 'Commit' methods -of the 'Installer' class. -A class is derived from the 'Installer' base class and the Install -and Commit methods are overridden. -*/ - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; -using namespace System::Collections; - -[RunInstaller(true)] -ref class MyInstallerSample: public Installer -{ -// - // Override the 'Install' method of the Installer class. -public: - virtual void Install( IDictionary^ mySavedState ) override - { - Installer::Install( mySavedState ); - // Code maybe written for installation of an application. - Console::WriteLine( "The Install method of 'MyInstallerSample' has been called" ); - } -// - -// - // Override the 'Commit' method of the Installer class. - virtual void Commit( IDictionary^ mySavedState ) override - { - Installer::Commit( mySavedState ); - Console::WriteLine( "The Commit method of 'MyInstallerSample' " - "has been called" ); - } -// -}; - -void main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly" - + " Installer_Install.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp deleted file mode 100644 index 4bd8e8e06b8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/* -System::Configuration::Install::Installer.Installers -System::Configuration::Install::Installer.Parent - -The following example demonstrates the properties 'Installers' and -'Parent'. The Installers property shows the InstallerCollection -associated with an Installer and the Parent property gets the -installer containing the collection that this installer belongs to. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ServiceProcess; -using namespace System::Diagnostics; -using namespace System::Configuration::Install; - -void main() -{ -// - AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; - ServiceInstaller^ myServiceInstaller = gcnew ServiceInstaller; - EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller; - - InstallerCollection^ myInstallerCollection = myAssemblyInstaller->Installers; - - // Add Installers to the InstallerCollection of 'myAssemblyInstaller'. - myInstallerCollection->Add( myServiceInstaller ); - myInstallerCollection->Add( myEventLogInstaller ); - - array^ myInstaller = gcnew array(2); - myInstallerCollection->CopyTo( myInstaller, 0 ); - // Show the contents of the InstallerCollection of 'myAssemblyInstaller'. - Console::WriteLine( "Installers in the InstallerCollection : " ); - for ( int iIndex = 0; iIndex < myInstaller->Length; iIndex++ ) - Console::WriteLine( myInstaller[ iIndex ]->ToString() ); -// - Console::WriteLine( "" ); -// - AssemblyInstaller^ myAssemblyInstaller1 = gcnew AssemblyInstaller; - InstallerCollection^ myInstallerCollection1 = myAssemblyInstaller1->Installers; - // 'myAssemblyInstaller' is an installer of type 'AssemblyInstaller'. - myInstallerCollection1->Add( myAssemblyInstaller ); - - Installer^ myInstaller1 = myAssemblyInstaller->Parent; - Console::WriteLine( "Parent of myAssembly : {0}", myInstaller1 ); -// -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp deleted file mode 100644 index bbb7e27bb5d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* -System::Configuration::Install::Installer.OnBeforeInstall(IDictionary* savedState) -System::Configuration::Install::Installer.OnAfterInstall(IDictionary* savedState) - -The following example demonstrates the methods 'OnBeforeInstall' and -'OnAfterInstall' of the 'Installer' class. The methods 'OnBeforeInstall' -and 'OnAfterInstall' are overridden in the derived class. Space is provided -to add steps to be done before the installation in 'OnBeforeInstall' method -and after the installation in 'OnAfterInstall' method. - -Use the installer process 'InstallUtil' to run the assembly -Installer_OnInstall.exe. - -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyInstaller: public Installer -{ -public: - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Installer::Install( savedState ); - } - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - // Override the 'Uninstall' method. - virtual void Uninstall( IDictionary^ savedState ) override - { - Installer::Uninstall( savedState ); - } - -// - // Override the 'OnBeforeInstall' method. -protected: - virtual void OnBeforeInstall( IDictionary^ savedState ) override - { - Installer::OnBeforeInstall( savedState ); - - // Add steps to be done before the installation starts. - Console::WriteLine( "OnBeforeInstall method of MyInstaller called" ); - } -// - -// - // Override the 'OnAfterInstall' method. -protected: - virtual void OnAfterInstall( IDictionary^ savedState ) override - { - Installer::OnAfterInstall( savedState ); - // Add steps to be done after the installation is over. - Console::WriteLine( "OnAfterInstall method of MyInstaller called" ); - } -// -}; - -void main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly Installer_OnInstall.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp deleted file mode 100644 index 570fbfacc63..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/* -System::Configuration::Install::Installer.Rollback - -The following example demonstrates the Rollback method -of the class 'installer'. The Rollback method is overridden -in a derived class of 'installer'.An exception is generated to -force an installation rollback. -*/ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; -using namespace System::Collections; - -[RunInstaller(true)] -ref class MyInstallerSample: public Installer -{ -public: - - // Override 'Install' method of Installer class. - virtual void Install( IDictionary^ mySavedState ) override - { - Installer::Install( mySavedState ); - Console::WriteLine( "" ); - - // Include code to install an application. - Console::WriteLine( "The Install method of 'MyInstallerSample' has been called" ); - Console::WriteLine( "" ); - - // Exception generated to call Rollback method. - Exception^ myException = gcnew Exception; - Console::WriteLine( "Exception thrown during Installation" ); - throw myException; - } - -// - // Override 'Rollback' method of Installer class. -public: - virtual void Rollback( IDictionary^ mySavedState ) override - { - Installer::Rollback( mySavedState ); - Console::WriteLine( "The Rollback method of 'MyInstallerSample'" + - " has been called" ); - } -// -}; - -void main() -{ - Console::WriteLine( "Use installutil.exe to run the assembly Installer_Rollback.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp deleted file mode 100644 index fd987e21d11..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/* -System::Configuration::Install::Installer.Uninstall - -The following example demonstrates the Uninstall method -of the class 'installer'. The method Uninstall is overridden -in the derived class of 'installer'. -*/ - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; -using namespace System::Collections; - -[RunInstaller(true)] -ref class MyInstallerSample: public Installer -{ -// - // Override 'Uninstall' method of Installer class. -public: - virtual void Uninstall( IDictionary^ mySavedState ) override - { - if ( mySavedState == nullptr ) - { - Console::WriteLine( "Uninstallation Error !" ); - } - else - { - Installer::Uninstall( mySavedState ); - Console::WriteLine( "The Uninstall method of 'MyInstallerSample' has been called" ); - } - } -// -}; - -void main() -{ - Console::WriteLine( "Use 'installutil.exe -u' to run the assembly Installer_Uninstall.exe" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp deleted file mode 100644 index 0d107fe1e0e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp +++ /dev/null @@ -1,357 +0,0 @@ - -// System::Int16::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'Int16'. This compares an instance of 'Int16' with the -passed in Object* and returns true if they are equal. -*/ -using namespace System; -int main() -{ - try - { - - // - Int16 myVariable1 = 20; - Int16 myVariable2 = 20; - - // Get and display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -/* expected return values: -20'F --6'C -20'F -0 -72'F --52 -*/ -/* -namespace Snippets2 { - // - - public __gc class Temperature { - // The value holder - protected: - short m_value; - - public: - __property static short get_MinValue() { - return Int16.MinValue; - } - - __property static short get_MaxValue() { - return Int16.MaxValue; - } - - __property short get_Value(){ - return m_value; - } - __property void set_Value( short value){ - m_value = value; - } - - __property short get_Celsius(){ - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value){ - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets3 { - // - public __gc class Temperature : IComparable { - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - protected: - short m_value; - - public: - Int32 CompareTo(Object* obj) { - if(obj->GetType() == __typeof(Temperature)) { - Temperature temp = dynamic_cast(obj); - return m_value.CompareTo(temp.m_value); - } - - throw new ArgumentException("object is not a Temperature"); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( Int32 value) { - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets4 { - // - public __gc class Temperature : IFormattable { - /// - /// IFormattable.ToString implementation. - /// - // The value holder - protected: - short m_value; - - public: - String* ToString(String* format, IFormatProvider provider) { - if( format != NULL ) { - if( format->Equals("F") ) { - return String::Format("{0}'F", this->Value->ToString()); - } - if( format->Equals("C") ) { - return String::Format("{0}'C", this->Celsius->ToString()); - } - } - - return m_value->ToString(format, provider); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets5 { - // - public __gc class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - temp->Value = Int16::Parse(s); - } - } - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - } - // -} -namespace Snippets6 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, IFormatProvider provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - temp->Value = Int16::Parse(s, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets7 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - temp->Value = Int16::Parse(s, styles); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets8 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - temp->Value = Int16::Parse(s, styles, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp deleted file mode 100644 index a5199f2b75d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp +++ /dev/null @@ -1,357 +0,0 @@ - -// System::Int32::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'Int32'. This compares an instance of 'Int32' with the -passed in object and returns true if they are equal. -*/ -using namespace System; -int main() -{ - try - { - - // - Int32 myVariable1 = 60; - Int32 myVariable2 = 60; - - // Get and display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -/* expected return values: -20'F --6'C -20'F -0 -72'F --52 -*/ -/* -namespace Snippets2 { - // - - public __gc class Temperature { - // The value holder - protected: - short m_value; - - public: - __property static short get_MinValue() { - return Int32.MinValue; - } - - __property static short get_MaxValue() { - return Int32.MaxValue; - } - - __property short get_Value(){ - return m_value; - } - __property void set_Value( short value){ - m_value = value; - } - - __property short get_Celsius(){ - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value){ - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets3 { - // - public __gc class Temperature : IComparable { - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - protected: - short m_value; - - public: - Int32 CompareTo(Object* obj) { - if(obj->GetType() == __typeof(Temperature)) { - Temperature temp = dynamic_cast(obj); - return m_value.CompareTo(temp.m_value); - } - - throw new ArgumentException("object is not a Temperature"); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( Int32 value) { - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets4 { - // - public __gc class Temperature : IFormattable { - /// - /// IFormattable.ToString implementation. - /// - // The value holder - protected: - short m_value; - - public: - String* ToString(String* format, IFormatProvider provider) { - if( format != NULL ) { - if( format->Equals("F") ) { - return String::Format("{0}'F", this->Value->ToString()); - } - if( format->Equals("C") ) { - return String::Format("{0}'C", this->Celsius->ToString()); - } - } - - return m_value->ToString(format, provider); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets5 { - // - public __gc class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - temp->Value = Int32::Parse(s); - } - } - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - } - // -} -namespace Snippets6 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, IFormatProvider provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - temp->Value = Int32::Parse(s, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets7 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - temp->Value = Int32::Parse(s, styles); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets8 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - temp->Value = Int32::Parse(s, styles, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp deleted file mode 100644 index b4f54b5d004..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp +++ /dev/null @@ -1,357 +0,0 @@ - -// System::Int64::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'Int64'. This compares an instance of 'Int64' with the -passed in Object and returns true if they are equal. -*/ -using namespace System; -int main() -{ - try - { - - // - Int64 myVariable1 = 80; - Int64 myVariable2 = 80; - - // Get and display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is ' {0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is ' {0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -/* expected return values: -20'F --6'C -20'F -0 -72'F --52 -*/ -/* -namespace Snippets2 { - // - - public __gc class Temperature { - // The value holder - protected: - short m_value; - - public: - __property static short get_MinValue() { - return Int64.MinValue; - } - - __property static short get_MaxValue() { - return Int64.MaxValue; - } - - __property short get_Value(){ - return m_value; - } - __property void set_Value( short value){ - m_value = value; - } - - __property short get_Celsius(){ - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value){ - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets3 { - // - public __gc class Temperature : IComparable { - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - protected: - short m_value; - - public: - Int64 CompareTo(Object* obj) { - if(obj->GetType() == __typeof(Temperature)) { - Temperature temp = dynamic_cast(obj); - return m_value.CompareTo(temp.m_value); - } - - throw new ArgumentException("object is not a Temperature"); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( Int64 value) { - m_value = (short)(value*2+32); - } - } - // -} - -namespace Snippets4 { - // - public __gc class Temperature : IFormattable { - /// - /// IFormattable.ToString implementation. - /// - // The value holder - protected: - short m_value; - - public: - String* ToString(String* format, IFormatProvider provider) { - if( format != NULL ) { - if( format->Equals("F") ) { - return String::Format("{0}'F", this->Value->ToString()); - } - if( format->Equals("C") ) { - return String::Format("{0}'C", this->Celsius->ToString()); - } - } - - return m_value->ToString(format, provider); - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets5 { - // - public __gc class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) ); - } - else { - temp->Value = Int64::Parse(s); - } - } - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - } - // -} -namespace Snippets6 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, IFormatProvider provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); - } - else { - temp->Value = Int64::Parse(s, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets7 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); - } - else { - temp->Value = Int64::Parse(s, styles); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -namespace Snippets8 { - // - public class Temperature { - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - - // The value holder - protected: - short m_value; - - public: - static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { - Temperature* temp = new Temperature(); - - if( s->TrimEnd(NULL)->EndsWith("'F") ) { - temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - if( s->TrimEnd(NULL)->EndsWith("'C") ) { - temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); - } - else { - temp->Value = Int64::Parse(s, styles, provider); - } - } - - return temp; - } - - __property short get_Value() { - return m_value; - } - - __property void set_Value( short value) { - m_value = value; - } - - __property short get_Celsius() { - return (short)((m_value-32)/2); - } - - __property void set_Celsius( short value) { - m_value = (short)(value*2+32); - } - } - // -} -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp b/snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp deleted file mode 100644 index 8b8a740a62a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -private ref class NativeMethods -{ -public: - - // CallingConvention.Cdecl must be used since the stack is - // cleaned up by the caller. - // int printf( const char *format [, argument]... ) - - [DllImport("msvcrt.dll", CharSet = CharSet::Unicode, CallingConvention = CallingConvention::Cdecl)] - static int printf(String^ format, int i, double d); - - [DllImport("msvcrt.dll", CharSet = CharSet::Unicode, CallingConvention = CallingConvention::Cdecl)] - static int printf(String^ format, int i, String^ s); -}; - -int main() -{ - NativeMethods::printf("\nPrint params: %i %f", 99, 99.99); - NativeMethods::printf("\nPrint params: %i %s", 99, "abcd"); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp b/snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp deleted file mode 100644 index 349f1fefdba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// Declare a class member for each structure element. - -[StructLayout(LayoutKind::Sequential, CharSet = CharSet::Unicode)] -public ref class OpenFileName -{ -public: - int structSize; - String^ filter; - String^ file; - // ... -}; - -private ref class NativeMethods -{ -public: - - // Declare a managed prototype for the unmanaged function. - - [DllImport("Comdlg32.dll", CharSet = CharSet::Unicode)] - static bool GetOpenFileName([In, Out]OpenFileName^ ofn); -}; - -void main() {} -// diff --git a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp b/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp deleted file mode 100644 index ce2f1b81b12..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// This sample class has a field, constructor, method, and property. -ref class MyType -{ -private: - Int32 myField; - -public: - MyType( interior_ptr x ) - { - *x *= 5; - } - - virtual String^ ToString() override - { - return myField.ToString(); - } - - property Int32 MyProp - { - Int32 get() - { - return myField; - } - - void set( Int32 value ) - { - if ( value < 1 ) - throw gcnew ArgumentOutOfRangeException( "value",value,"value must be > 0" ); - - myField = value; - } - } -}; - -int main() -{ - Type^ t = MyType::typeid; - - // Create an instance of a type. - array^args = {8}; - Console::WriteLine( "The value of x before the constructor is called is {0}.", args[ 0 ] ); - Object^ obj = t->InvokeMember( nullptr, static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, args ); - Console::WriteLine( "Type: {0}", obj->GetType() ); - Console::WriteLine( "The value of x after the constructor returns is {0}.", args[ 0 ] ); - - // Read and write to a field. - array^obj5 = {5}; - t->InvokeMember( "myField", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetField), nullptr, obj, obj5 ); - Int32 v = safe_cast(t->InvokeMember( "myField", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::GetField), nullptr, obj, nullptr )); - Console::WriteLine( "myField: {0}", v ); - - // Call a method. - String^ s = safe_cast(t->InvokeMember( "ToString", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::InvokeMethod), nullptr, obj, nullptr )); - Console::WriteLine( "ToString: {0}", s ); - - // Read and write a property. First, attempt to assign an - // invalid value; then assign a valid value; finally, get - // the value. - try - { - // Assign the value zero to MyProp. The Property Set - // throws an exception, because zero is an invalid value. - // InvokeMember catches the exception, and throws - // TargetInvocationException. To discover the real cause - // you must catch TargetInvocationException and examine - // the inner exception. - array^obj0 = {(int^)0}; - t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetProperty), nullptr, obj, obj0 ); - } - catch ( TargetInvocationException^ e ) - { - // If the property assignment failed for some unexpected - // reason, rethrow the TargetInvocationException. - if ( e->InnerException->GetType() != ArgumentOutOfRangeException::typeid ) - throw; - - Console::WriteLine( "An invalid value was assigned to MyProp." ); - } - - array^obj2 = {2}; - t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetProperty), nullptr, obj, obj2 ); - v = safe_cast(t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::GetProperty), nullptr, obj, nullptr )); - Console::WriteLine( "MyProp: {0}", v ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp deleted file mode 100644 index bbdb493fd1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// An enumeration of animals. Start at 1 (0 = uninitialized). -public enum class Animal -{ - // Pets. - Dog = 1, - Cat, Bird -}; - - -// A custom attribute to allow a target to have a pet. -public ref class AnimalTypeAttribute: public Attribute -{ -public: - - // The constructor is called when the attribute is set. - AnimalTypeAttribute( Animal pet ) - { - thePet = pet; - } - - // Provide a default constructor and make Dog the default. - AnimalTypeAttribute() - { - thePet = Animal::Dog; - } - -protected: - - // Keep a variable internally ... - Animal thePet; - -public: - - property Animal Pet - { - // .. and show a copy to the outside world. - Animal get() - { - return thePet; - } - void set( Animal value ) - { - thePet = value; - } - - } - - // Override IsDefaultAttribute to return the correct response. - virtual bool IsDefaultAttribute() override - { - return thePet == Animal::Dog; - } -}; - -public ref class TestClass -{ -public: - - // Use the default constructor. - - [AnimalType] - void Method1(){} -}; - -int main() -{ - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // Get type information for the method. - MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); - - // Get the AnimalType attribute for the method. - AnimalTypeAttribute^ atAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, AnimalTypeAttribute::typeid )); - - // Check to see if the default attribute is applied. - Console::WriteLine( "The attribute {0} for method {1} in class {2}", atAttr->Pet, mInfo->Name, clsType->Name ); - Console::WriteLine( "{0} the default for the AnimalType attribute.", atAttr->IsDefaultAttribute() ? (String^)"is" : "is not" ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp deleted file mode 100644 index cf2f401b63a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp +++ /dev/null @@ -1,276 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Add an AssemblyDescription attribute -[assembly:AssemblyDescription("A sample description")]; -namespace IsDef1CS -{ - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = DemoClass::typeid; - - // Get the assembly object. - Assembly^ assy = clsType->Assembly; - - // Store the assembly's name. - String^ assyName = assy->GetName()->Name; - - //Type assyType = assy.GetType(); - // See if the Assembly Description is defined. - bool isdef = Attribute::IsDefined( assy, AssemblyDescriptionAttribute::typeid ); - if ( isdef ) - { - - // Affirm that the attribute is defined. - Console::WriteLine( "The AssemblyDescription attribute " - "is defined for assembly {0}.", assyName ); - - // Get the description attribute itself. - AssemblyDescriptionAttribute^ adAttr = dynamic_cast(Attribute::GetCustomAttribute( assy, AssemblyDescriptionAttribute::typeid )); - - // Display the description. - if ( adAttr != nullptr ) - Console::WriteLine( "The description is \"{0}\".", adAttr->Description ); - else - Console::WriteLine( "The description could not " - "be retrieved." ); - } - else - Console::WriteLine( "The AssemblyDescription attribute is not " - "defined for assembly {0}.", assyName ); - } - - }; - -} - - -/* - * Output: - * The AssemblyDescription attributeis defined for assembly IsDef1CS. - * The description is "A sample description". - */ -// -// -using namespace System; -using namespace System::Diagnostics; - -// Add the Debuggable attribute to the module. -[module:Debuggable(true,false)]; -namespace IsDef2CS -{ - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = DemoClass::typeid; - - // See if the Debuggable attribute is defined for this module. - bool isDef = Attribute::IsDefined( clsType->Module, DebuggableAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The Debuggable attribute {0} " - "defined for Module {1}.", isDef ? (String^)"is" : "is not", clsType->Module->Name ); - - // If the attribute is defined, display the JIT settings. - if ( isDef ) - { - - // Retrieve the attribute itself. - DebuggableAttribute^ dbgAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType->Module, DebuggableAttribute::typeid )); - if ( dbgAttr != nullptr ) - { - Console::WriteLine( "JITTrackingEnabled is {0}.", dbgAttr->IsJITTrackingEnabled ); - Console::WriteLine( "JITOptimizerDisabled is {0}.", dbgAttr->IsJITOptimizerDisabled ); - } - else - Console::WriteLine( "The Debuggable attribute " - "could not be retrieved." ); - } - } - - }; - -} - - -/* - * Output: - * The Debuggable attribute is defined for Module IsDef2CS.exe. - * JITTrackingEnabled is True. - * JITOptimizerDisabled is False. - */ -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -namespace IsDef3CS -{ - - // Assign a Guid attribute to a class. - - [Guid("BF235B41-52D1-46cc-9C55-046793DB363F")] - public ref class TestClass{}; - - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // See if the Guid attribute is defined for the class. - bool isDef = Attribute::IsDefined( clsType, GuidAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The Guid attribute {0} defined for class {1}.", isDef ? (String^)"is" : "is not", clsType->Name ); - - // If it's defined, display the GUID. - if ( isDef ) - { - GuidAttribute^ guidAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType, GuidAttribute::typeid )); - if ( guidAttr != nullptr ) - Console::WriteLine( "GUID: {{0}}.", guidAttr->Value ); - else - Console::WriteLine( "The Guid attribute could " - "not be retrieved." ); - } - } - - }; - -} - - -/* - * Output: - * The Guid attribute is defined for class TestClass. - * GUID: {BF235B41-52D1-46cc-9C55-046793DB363F}. - */ -// -// -using namespace System; -using namespace System::Reflection; - -namespace IsDef4CS -{ - public ref class TestClass - { - public: - - // Assign the Obsolete attribute to a method. - - [Obsolete("This method is obsolete. Use Method2 instead.")] - void Method1(){} - - void Method2(){} - - }; - - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // Get the MethodInfo object for Method1. - MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); - - // See if the Obsolete attribute is defined for this method. - bool isDef = Attribute::IsDefined( mInfo, ObsoleteAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The Obsolete Attribute {0} defined for {1} of class {2}.", isDef ? (String^)"is" : "is not", mInfo->Name, clsType->Name ); - - // If it's defined, display the attribute's message. - if ( isDef ) - { - ObsoleteAttribute^ obsAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, ObsoleteAttribute::typeid )); - if ( obsAttr != nullptr ) - Console::WriteLine( "The message is: \"{0}\".", obsAttr->Message ); - else - Console::WriteLine( "The message could not be retrieved." ); - } - } - - }; - -} - - -/* - * Output: - * The Obsolete Attribute is defined for Method1 of class TestClass. - * The message is: "This method is obsolete. Use Method2 instead.". - */ -// -// -using namespace System; -using namespace System::Reflection; - -namespace IsDef5CS -{ - public ref class TestClass - { - public: - - // Assign a ParamArray attribute to the parameter using the keyword. - void Method1(... array^args ){} - - }; - - ref class DemoClass - { - public: - static void Main() - { - - // Get the class type to access its metadata. - Type^ clsType = TestClass::typeid; - - // Get the MethodInfo object for Method1. - MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); - - // Get the ParameterInfo array for the method parameters. - array^pInfo = mInfo->GetParameters(); - if ( pInfo != nullptr ) - { - - // See if the ParamArray attribute is defined. - bool isDef = Attribute::IsDefined( pInfo[ 0 ], ParamArrayAttribute::typeid ); - - // Display the result. - Console::WriteLine( "The ParamArray attribute {0} defined for " - "parameter {1} of method {2}.", isDef ? (String^)"is" : "is not", pInfo[ 0 ]->Name, mInfo->Name ); - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); - } - - }; - -} - -/* - * Output: - * The ParamArray attribute is defined for parameter args of method Method1. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp deleted file mode 100644 index 99ec465e315..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//Types:System.Security.Permissions.IsolatedStorageContainment (enum) -//Types:System.Security.Permissions.IsolatedStoragePermissionAttribute -//Types:System.Security.Permissions.SecurityAction -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO::IsolatedStorage; -using namespace System::IO; - - -static void WriteIsolatedStorage() -{ - try - { - // Attempt to create a storage file that is isolated by - // user and assembly. IsolatedStorageFilePermission - // granted to the attribute at the top of this file - // allows CLR to load this assembly and execution of this - // statement. - Stream^ fileCreateStream = gcnew - IsolatedStorageFileStream( - "AssemblyData", - FileMode::Create, - IsolatedStorageFile::GetUserStoreForAssembly()); - - StreamWriter^ streamWriter = gcnew StreamWriter( - fileCreateStream); - try - { - // Write some data out to the isolated file. - - streamWriter->Write("This is some test data."); - streamWriter->Close(); - } - finally - { - delete fileCreateStream; - delete streamWriter; - } - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } - - try - { - Stream^ fileOpenStream = - gcnew IsolatedStorageFileStream( - "AssemblyData", - FileMode::Open, - IsolatedStorageFile::GetUserStoreForAssembly()); - // Attempt to open the file that was previously created. - - StreamReader^ streamReader = gcnew StreamReader( - fileOpenStream); - try - { - // Read the data from the file and display it. - - Console::WriteLine(streamReader->ReadLine()); - streamReader->Close(); - } - finally - { - delete fileOpenStream; - delete streamReader; - } - } - catch (FileNotFoundException^ ex) - { - Console::WriteLine(ex->Message); - } - catch (IOException^ ex) - { - Console::WriteLine(ex->Message); - } -} -// Notify the CLR to only grant IsolatedStorageFilePermission to called methods. -// This restricts the called methods to working only with storage files that are isolated -// by user and assembly. -[IsolatedStorageFilePermission(SecurityAction::PermitOnly, UsageAllowed = IsolatedStorageContainment::AssemblyIsolationByUser)] -int main() -{ - WriteIsolatedStorage(); -} - -// This code produces the following output. -// -// This is some test data. -// diff --git a/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp deleted file mode 100644 index 8997b4e85f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp +++ /dev/null @@ -1,220 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Collections::ObjectModel; - -// This class represents a simple line item in an order. All the -// values are immutable except quantity. -// -public ref class OrderItem -{ -private: - int _quantity; - -public: - initonly int PartNumber; - initonly String^ Description; - initonly double UnitPrice; - - OrderItem(int partNumber, String^ description, - int quantity, double unitPrice) - { - this->PartNumber = partNumber; - this->Description = description; - this->Quantity = quantity; - this->UnitPrice = unitPrice; - } - - property int Quantity - { - int get() { return _quantity; } - void set(int value) - { - if (value < 0) - throw gcnew ArgumentException("Quantity cannot be negative."); - - _quantity = value; - } - } - - virtual String^ ToString() override - { - return String::Format( - "{0,9} {1,6} {2,-12} at {3,8:#,###.00} = {4,10:###,###.00}", - PartNumber, _quantity, Description, UnitPrice, - UnitPrice * _quantity); - } -}; - -// This class represents a very simple keyed list of OrderItems, -// inheriting most of its behavior from the KeyedCollection and -// Collection classes. The immediate base class is the constructed -// type KeyedCollection. When you inherit -// from KeyedCollection, the second generic type argument is the -// type that you want to store in the collection -- in this case -// OrderItem. The first type argument is the type that you want -// to use as a key. Its values must be calculated from OrderItem; -// in this case it is the int field PartNumber, so SimpleOrder -// inherits KeyedCollection. -// -public ref class SimpleOrder : KeyedCollection -{ - // The parameterless constructor of the base class creates a - // KeyedCollection with an internal dictionary. For this code - // example, no other constructors are exposed. - // -public: - SimpleOrder() {} - - // This is the only method that absolutely must be overridden, - // because without it the KeyedCollection cannot extract the - // keys from the items. The input parameter type is the - // second generic type argument, in this case OrderItem, and - // the return value type is the first generic type argument, - // in this case int. - // -protected: - virtual int GetKeyForItem(OrderItem^ item) override - { - // In this example, the key is the part number. - return item->PartNumber; - } -}; - -public ref class Demo -{ -public: - static void Main() - { - SimpleOrder^ weekly = gcnew SimpleOrder(); - - // The Add method, inherited from Collection, takes OrderItem. - // - weekly->Add(gcnew OrderItem(110072674, "Widget", 400, 45.17)); - weekly->Add(gcnew OrderItem(110072675, "Sprocket", 27, 5.3)); - weekly->Add(gcnew OrderItem(101030411, "Motor", 10, 237.5)); - weekly->Add(gcnew OrderItem(110072684, "Gear", 175, 5.17)); - - Display(weekly); - - // The Contains method of KeyedCollection takes the key, - // type, in this case int. - // - Console::WriteLine("\nContains(101030411): {0}", - weekly->Contains(101030411)); - - // The default Item property of KeyedCollection takes a key. - // - Console::WriteLine("\nweekly(101030411)->Description: {0}", - weekly[101030411]->Description); - - // The Remove method of KeyedCollection takes a key. - // - Console::WriteLine("\nRemove(101030411)"); - weekly->Remove(101030411); - Display(weekly); - - // The Insert method, inherited from Collection, takes an - // index and an OrderItem. - // - Console::WriteLine("\nInsert(2, New OrderItem(...))"); - weekly->Insert(2, gcnew OrderItem(111033401, "Nut", 10, .5)); - Display(weekly); - - // The default Item property is overloaded. One overload comes - // from KeyedCollection; that overload - // is read-only, and takes Integer because it retrieves by key. - // The other overload comes from Collection, the - // base class of KeyedCollection; it - // retrieves by index, so it also takes an Integer. The compiler - // uses the most-derived overload, from KeyedCollection, so the - // only way to access SimpleOrder by index is to cast it to - // Collection. Otherwise the index is interpreted - // as a key, and KeyNotFoundException is thrown. - // - Collection^ coweekly = weekly; - Console::WriteLine("\ncoweekly[2].Description: {0}", - coweekly[2]->Description); - - Console::WriteLine("\ncoweekly[2] = gcnew OrderItem(...)"); - coweekly[2] = gcnew OrderItem(127700026, "Crank", 27, 5.98); - - OrderItem^ temp = coweekly[2]; - - // The IndexOf method inherited from Collection - // takes an OrderItem instead of a key - // - Console::WriteLine("\nIndexOf(temp): {0}", weekly->IndexOf(temp)); - - // The inherited Remove method also takes an OrderItem. - // - Console::WriteLine("\nRemove(temp)"); - weekly->Remove(temp); - Display(weekly); - - Console::WriteLine("\nRemoveAt(0)"); - weekly->RemoveAt(0); - Display(weekly); - - } - -private: - static void Display(SimpleOrder^ order) - { - Console::WriteLine(); - for each( OrderItem^ item in order ) - { - Console::WriteLine(item); - } - } -}; - -void main() -{ - Demo::Main(); -} - -/* This code example produces the following output: - -110072674 400 Widget at 45.17 = 18,068.00 -110072675 27 Sprocket at 5.30 = 143.10 -101030411 10 Motor at 237.50 = 2,375.00 -110072684 175 Gear at 5.17 = 904.75 - -Contains(101030411): True - -weekly(101030411)->Description: Motor - -Remove(101030411) - -110072674 400 Widget at 45.17 = 18,068.00 -110072675 27 Sprocket at 5.30 = 143.10 -110072684 175 Gear at 5.17 = 904.75 - -Insert(2, New OrderItem(...)) - -110072674 400 Widget at 45.17 = 18,068.00 -110072675 27 Sprocket at 5.30 = 143.10 -111033401 10 Nut at .50 = 5.00 -110072684 175 Gear at 5.17 = 904.75 - -coweekly(2)->Description: Nut - -coweekly[2] = gcnew OrderItem(...) - -IndexOf(temp): 2 - -Remove(temp) - -110072674 400 Widget at 45.17 = 18,068.00 -110072675 27 Sprocket at 5.30 = 143.10 -110072684 175 Gear at 5.17 = 904.75 - -RemoveAt(0) - -110072675 27 Sprocket at 5.30 = 143.10 -110072684 175 Gear at 5.17 = 904.75 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp deleted file mode 100644 index 37225c227f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp +++ /dev/null @@ -1,341 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Collections::ObjectModel; - -public enum class ChangeTypes -{ - Added, - Removed, - Replaced, - Cleared -}; - -ref class SimpleOrderChangedEventArgs; - -// This class represents a simple line item in an order. All the -// values are immutable except quantity. -// -public ref class OrderItem -{ -private: - int _quantity; - -public: - initonly int PartNumber; - initonly String^ Description; - initonly double UnitPrice; - - OrderItem(int partNumber, String^ description, int quantity, - double unitPrice) - { - this->PartNumber = partNumber; - this->Description = description; - this->Quantity = quantity; - this->UnitPrice = unitPrice; - }; - - property int Quantity - { - int get() { return _quantity; }; - void set(int value) - { - if (value < 0) - throw gcnew ArgumentException("Quantity cannot be negative."); - - _quantity = value; - }; - }; - - virtual String^ ToString() override - { - return String::Format( - "{0,9} {1,6} {2,-12} at {3,8:#,###.00} = {4,10:###,###.00}", - PartNumber, _quantity, Description, UnitPrice, - UnitPrice * _quantity); - }; -}; - -// Event argument for the Changed event. -// -public ref class SimpleOrderChangedEventArgs : EventArgs -{ -public: - OrderItem^ ChangedItem; - initonly ChangeTypes ChangeType; - OrderItem^ ReplacedWith; - - SimpleOrderChangedEventArgs(ChangeTypes change, - OrderItem^ item, OrderItem^ replacement) - { - this->ChangeType = change; - this->ChangedItem = item; - this->ReplacedWith = replacement; - } -}; - -// This class derives from KeyedCollection and shows how to override -// the protected ClearItems, InsertItem, RemoveItem, and SetItem -// methods in order to change the behavior of the default Item -// property and the Add, Clear, Insert, and Remove methods. The -// class implements a Changed event, which is raised by all the -// protected methods. -// -// SimpleOrder is a collection of OrderItem objects, and its key -// is the PartNumber field of OrderItem-> PartNumber is an Integer, -// so SimpleOrder inherits KeyedCollection. -// (Note that the key of OrderItem cannot be changed; if it could -// be changed, SimpleOrder would have to override ChangeItemKey.) -// -public ref class SimpleOrder : KeyedCollection -{ -public: - event EventHandler^ Changed; - - // This parameterless constructor calls the base class constructor - // that specifies a dictionary threshold of 0, so that the internal - // dictionary is created as soon as an item is added to the - // collection. - // - SimpleOrder() : KeyedCollection(nullptr, 0) {}; - - // This is the only method that absolutely must be overridden, - // because without it the KeyedCollection cannot extract the - // keys from the items. - // -protected: - virtual int GetKeyForItem(OrderItem^ item) override - { - // In this example, the key is the part number. - return item->PartNumber; - } - - virtual void InsertItem(int index, OrderItem^ newItem) override - { - __super::InsertItem(index, newItem); - - Changed(this, gcnew SimpleOrderChangedEventArgs( - ChangeTypes::Added, newItem, nullptr)); - } - - // - virtual void SetItem(int index, OrderItem^ newItem) override - { - OrderItem^ replaced = this->Items[index]; - __super::SetItem(index, newItem); - - Changed(this, gcnew SimpleOrderChangedEventArgs( - ChangeTypes::Replaced, replaced, newItem)); - } - // - - virtual void RemoveItem(int index) override - { - OrderItem^ removedItem = Items[index]; - __super::RemoveItem(index); - - Changed(this, gcnew SimpleOrderChangedEventArgs( - ChangeTypes::Removed, removedItem, nullptr)); - } - - virtual void ClearItems() override - { - __super::ClearItems(); - - Changed(this, gcnew SimpleOrderChangedEventArgs( - ChangeTypes::Cleared, nullptr, nullptr)); - } - - // - // This method uses the internal reference to the dictionary - // to test fo -public: - void AddOrMerge(OrderItem^ newItem) - { - - int key = this->GetKeyForItem(newItem); - OrderItem^ existingItem = nullptr; - - // The dictionary is not created until the first item is - // added, so it is necessary to test for null. Using - // AndAlso ensures that TryGetValue is not called if the - // dictionary does not exist. - // - if (this->Dictionary != nullptr && - this->Dictionary->TryGetValue(key, existingItem)) - { - existingItem->Quantity += newItem->Quantity; - } - else - { - this->Add(newItem); - } - } - // -}; - -public ref class Demo -{ -public: - static void Main() - { - SimpleOrder^ weekly = gcnew SimpleOrder(); - weekly->Changed += gcnew - EventHandler(ChangedHandler); - - // The Add method, inherited from Collection, takes OrderItem-> - // - weekly->Add(gcnew OrderItem(110072674, "Widget", 400, 45.17)); - weekly->Add(gcnew OrderItem(110072675, "Sprocket", 27, 5.3)); - weekly->Add(gcnew OrderItem(101030411, "Motor", 10, 237.5)); - weekly->Add(gcnew OrderItem(110072684, "Gear", 175, 5.17)); - - Display(weekly); - - // The Contains method of KeyedCollection takes TKey. - // - Console::WriteLine("\nContains(101030411): {0}", - weekly->Contains(101030411)); - - // The default Item property of KeyedCollection takes the key - // type, Integer. The property is read-only. - // - Console::WriteLine("\nweekly[101030411]->Description: {0}", - weekly[101030411]->Description); - - // The Remove method of KeyedCollection takes a key. - // - Console::WriteLine("\nRemove(101030411)"); - weekly->Remove(101030411); - - // The Insert method, inherited from Collection, takes an - // index and an OrderItem. - // - Console::WriteLine("\nInsert(2, gcnew OrderItem(...))"); - weekly->Insert(2, gcnew OrderItem(111033401, "Nut", 10, .5)); - - // The default Item property is overloaded. One overload comes - // from KeyedCollection; that overload - // is read-only, and takes Integer because it retrieves by key. - // The other overload comes from Collection, the - // base class of KeyedCollection; it - // retrieves by index, so it also takes an Integer. The compiler - // uses the most-derived overload, from KeyedCollection, so the - // only way to access SimpleOrder by index is to cast it to - // Collection. Otherwise the index is interpreted - // as a key, and KeyNotFoundException is thrown. - // - Collection^ coweekly = weekly; - Console::WriteLine("\ncoweekly[2].Description: {0}", - coweekly[2]->Description); - - Console::WriteLine("\ncoweekly[2] = gcnew OrderItem(...)"); - coweekly[2] = gcnew OrderItem(127700026, "Crank", 27, 5.98); - - OrderItem^ temp = coweekly[2]; - - // The IndexOf method, inherited from Collection, - // takes an OrderItem instead of a key. - // - Console::WriteLine("\nIndexOf(temp): {0}", weekly->IndexOf(temp)); - - // The inherited Remove method also takes an OrderItem-> - // - Console::WriteLine("\nRemove(temp)"); - weekly->Remove(temp); - - Console::WriteLine("\nRemoveAt(0)"); - weekly->RemoveAt(0); - - weekly->AddOrMerge(gcnew OrderItem(110072684, "Gear", 1000, 5.17)); - - Display(weekly); - - Console::WriteLine(); - weekly->Clear(); - } - -private: - static void Display(SimpleOrder^ order) - { - Console::WriteLine(); - for each( OrderItem^ item in order ) - { - Console::WriteLine(item); - } - } - - static void ChangedHandler(Object^ source, - SimpleOrderChangedEventArgs^ e) - { - OrderItem^ item = e->ChangedItem; - - if (e->ChangeType == ChangeTypes::Replaced) - { - OrderItem^ replacement = e->ReplacedWith; - - Console::WriteLine("{0} (quantity {1}) was replaced " + - "by {2}, (quantity {3}).", item->Description, - item->Quantity, replacement->Description, - replacement->Quantity); - } - else if(e->ChangeType == ChangeTypes::Cleared) - { - Console::WriteLine("The order list was cleared."); - } - else - { - Console::WriteLine("{0} (quantity {1}) was {2}.", - item->Description, item->Quantity, e->ChangeType); - } - } -}; - -void main() -{ - Demo::Main(); -} - -/* This code example produces the following output: - -Widget (quantity 400) was Added. -Sprocket (quantity 27) was Added. -Motor (quantity 10) was Added. -Gear (quantity 175) was Added. - -110072674 400 Widget at 45.17 = 18,068.00 -110072675 27 Sprocket at 5.30 = 143.10 -101030411 10 Motor at 237.50 = 2,375.00 -110072684 175 Gear at 5.17 = 904.75 - -Contains(101030411): True - -weekly[101030411]->Description: Motor - -Remove(101030411) -Motor (quantity 10) was Removed. - -Insert(2, gcnew OrderItem(...)) -Nut (quantity 10) was Added. - -coweekly[2].Description: Nut - -coweekly[2] = gcnew OrderItem(...) -Nut (quantity 10) was replaced by Crank, (quantity 27). - -IndexOf(temp): 2 - -Remove(temp) -Crank (quantity 27) was Removed. - -RemoveAt(0) -Widget (quantity 400) was Removed. - -110072675 27 Sprocket at 5.30 = 143.10 -110072684 1175 Gear at 5.17 = 6,074.75 - -The order list was cleared. - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp b/snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp deleted file mode 100644 index 68aeee21dd5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; - -#define LCID_INSTALLED 1 -#define LCID_SUPPORTED 2 - -ref class LCIDAttrSample -{ -public: - - // Position of the LCID argument - - [DllImport("KERNEL32.DLL",EntryPoint="IsValidLocale",SetLastError=true,CharSet=CharSet::Auto)] - [LCIDConversionAttribute(0)] - static bool IsValidLocale( int dwFlags ); // options - - void CheckCurrentLCID() - { - MethodInfo^ mthIfo = this->GetType()->GetMethod( "IsValidLocale" ); - Attribute^ attr = Attribute::GetCustomAttribute( mthIfo, LCIDConversionAttribute::typeid ); - if ( attr != nullptr ) - { - LCIDConversionAttribute^ lcidAttr = dynamic_cast(attr); - Console::WriteLine( "Position of the LCID argument in the unmanaged signature: {0}", lcidAttr->Value ); - } - - bool res = IsValidLocale( LCID_INSTALLED ); - Console::WriteLine( "Result LCID_INSTALLED {0}", res ); - res = IsValidLocale( LCID_SUPPORTED ); - Console::WriteLine( "Result LCID_SUPPORTED {0}", res ); - } -}; - -int main() -{ - LCIDAttrSample^ smpl = gcnew LCIDAttrSample; - smpl->CheckCurrentLCID(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp b/snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp deleted file mode 100644 index 0763df330bd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -using namespace System; -using namespace System::Runtime::InteropServices; - -// -// -enum class Bool -{ - False = 0, - True -}; - - -[StructLayout(LayoutKind::Sequential)] -value struct Point -{ -public: - int x; - int y; -}; - - -[StructLayout(LayoutKind::Explicit)] -value struct Rect -{ -public: - - [FieldOffset(0)] - int left; - - [FieldOffset(4)] - int top; - - [FieldOffset(8)] - int right; - - [FieldOffset(12)] - int bottom; -}; - -ref class NativeMethods -{ -public: - - [DllImport("user32.dll",CallingConvention=CallingConvention::StdCall)] - static Bool PtInRect( Rect * r, Point p ); -}; - -int main() -{ - try - { - Bool bPointInRect = (Bool)0; - Rect myRect = Rect( ); - myRect.left = 10; - myRect.right = 100; - myRect.top = 10; - myRect.bottom = 100; - Point myPoint = Point( ); - myPoint.x = 50; - myPoint.y = 50; - bPointInRect = NativeMethods::PtInRect( &myRect, myPoint ); - if ( bPointInRect == Bool::True ) - Console::WriteLine( "Point lies within the Rect" ); - else - Console::WriteLine( "Point did not lie within the Rect" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp deleted file mode 100644 index 8fb5233f28b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(4); - - Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); - - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Deinonychus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nIList^ roDinosaurs = dinosaurs->AsReadOnly()"); - IList^ roDinosaurs = dinosaurs->AsReadOnly(); - - Console::WriteLine("\nElements in the read-only IList:"); - for each(String^ dinosaur in roDinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\ndinosaurs[2] = \"Coelophysis\""); - dinosaurs[2] = "Coelophysis"; - - Console::WriteLine("\nElements in the read-only IList:"); - for each(String^ dinosaur in roDinosaurs) - { - Console::WriteLine(dinosaur); - } -} - -/* This code example produces the following output: - -Capacity: 4 - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Deinonychus - -IList^ roDinosaurs = dinosaurs->AsReadOnly() - -Elements in the read-only IList: -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Deinonychus - -dinosaurs[2] = "Coelophysis" - -Elements in the read-only IList: -Tyrannosaurus -Amargasaurus -Coelophysis -Deinonychus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp deleted file mode 100644 index df52855da1d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(); - - Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); - - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Deinonychus"); - dinosaurs->Add("Compsognathus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); - Console::WriteLine("Count: {0}", dinosaurs->Count); - - Console::WriteLine("\nContains(\"Deinonychus\"): {0}", - dinosaurs->Contains("Deinonychus")); - - Console::WriteLine("\nInsert(2, \"Compsognathus\")"); - dinosaurs->Insert(2, "Compsognathus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\ndinosaurs[3]: {0}", dinosaurs[3]); - - Console::WriteLine("\nRemove(\"Compsognathus\")"); - dinosaurs->Remove("Compsognathus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - dinosaurs->TrimExcess(); - Console::WriteLine("\nTrimExcess()"); - Console::WriteLine("Capacity: {0}", dinosaurs->Capacity); - Console::WriteLine("Count: {0}", dinosaurs->Count); - - dinosaurs->Clear(); - Console::WriteLine("\nClear()"); - Console::WriteLine("Capacity: {0}", dinosaurs->Capacity); - Console::WriteLine("Count: {0}", dinosaurs->Count); -} - -/* This code example produces the following output: - -Capacity: 0 - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Deinonychus -Compsognathus - -Capacity: 8 -Count: 5 - -Contains("Deinonychus"): True - -Insert(2, "Compsognathus") - -Tyrannosaurus -Amargasaurus -Compsognathus -Mamenchisaurus -Deinonychus -Compsognathus - -dinosaurs[3]: Mamenchisaurus - -Remove("Compsognathus") - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Deinonychus -Compsognathus - -TrimExcess() -Capacity: 5 -Count: 5 - -Clear() -Capacity: 5 -Count: 0 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp deleted file mode 100644 index eb95c6a9af7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections::Generic; - -Point PointFToPoint(PointF pf) -{ - return Point((int) pf.X, (int) pf.Y); -}; - -void main() -{ - List^ lpf = gcnew List(); - - lpf->Add(PointF(27.8F, 32.62F)); - lpf->Add(PointF(99.3F, 147.273F)); - lpf->Add(PointF(7.5F, 1412.2F)); - - Console::WriteLine(); - for each(PointF p in lpf) - { - Console::WriteLine(p); - } - - List^ lp = - lpf->ConvertAll( - gcnew Converter(PointFToPoint) - ); - - Console::WriteLine(); - for each(Point p in lp) - { - Console::WriteLine(p); - } -} - -/* This code example produces the following output: - -{X=27.8, Y=32.62} -{X=99.3, Y=147.273} -{X=7.5, Y=1412.2} - -{X=27,Y=32} -{X=99,Y=147} -{X=7,Y=1412} - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp deleted file mode 100644 index ce250927500..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Brachiosaurus"); - dinosaurs->Add("Compsognathus"); - - Console::WriteLine(); - for each(String^ dinosaurs in dinosaurs ) - { - Console::WriteLine(dinosaurs); - } - - // Create an array of 15 strings. - array^ arr = gcnew array(15); - - dinosaurs->CopyTo(arr); - dinosaurs->CopyTo(arr, 6); - dinosaurs->CopyTo(2, arr, 12, 3); - - Console::WriteLine("\nContents of the array:"); - for each(String^ dinosaurs in arr ) - { - Console::WriteLine(dinosaurs); - } -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -IndexOf("Tyrannosaurus"): 0 - -IndexOf("Tyrannosaurus", 3): 5 - -IndexOf("Tyrannosaurus", 2, 2): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp deleted file mode 100644 index d4033713e6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -// Search predicate returns true if a string ends in "saurus". -bool EndsWithSaurus(String^ s) -{ - return s->ToLower()->EndsWith("saurus"); -}; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Compsognathus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Oviraptor"); - dinosaurs->Add("Velociraptor"); - dinosaurs->Add("Deinonychus"); - dinosaurs->Add("Dilophosaurus"); - dinosaurs->Add("Gallimimus"); - dinosaurs->Add("Triceratops"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nTrueForAll(EndsWithSaurus): {0}", - dinosaurs->TrueForAll(gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nFind(EndsWithSaurus): {0}", - dinosaurs->Find(gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nFindLast(EndsWithSaurus): {0}", - dinosaurs->FindLast(gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nFindAll(EndsWithSaurus):"); - List^ sublist = - dinosaurs->FindAll(gcnew Predicate(EndsWithSaurus)); - - for each(String^ dinosaur in sublist) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine( - "\n{0} elements removed by RemoveAll(EndsWithSaurus).", - dinosaurs->RemoveAll(gcnew Predicate(EndsWithSaurus))); - - Console::WriteLine("\nList now contains:"); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nExists(EndsWithSaurus): {0}", - dinosaurs->Exists(gcnew Predicate(EndsWithSaurus))); -} - -/* This code example produces the following output: - -Compsognathus -Amargasaurus -Oviraptor -Velociraptor -Deinonychus -Dilophosaurus -Gallimimus -Triceratops - -TrueForAll(EndsWithSaurus): False - -Find(EndsWithSaurus): Amargasaurus - -FindLast(EndsWithSaurus): Dilophosaurus - -FindAll(EndsWithSaurus): -Amargasaurus -Dilophosaurus - -2 elements removed by RemoveAll(EndsWithSaurus). - -List now contains: -Compsognathus -Oviraptor -Velociraptor -Deinonychus -Gallimimus -Triceratops - -Exists(EndsWithSaurus): False - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp deleted file mode 100644 index 6ca3a08037e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Brachiosaurus"); - dinosaurs->Add("Deinonychus"); - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Compsognathus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nIndexOf(\"Tyrannosaurus\"): {0}", - dinosaurs->IndexOf("Tyrannosaurus")); - - Console::WriteLine("\nIndexOf(\"Tyrannosaurus\", 3): {0}", - dinosaurs->IndexOf("Tyrannosaurus", 3)); - - Console::WriteLine("\nIndexOf(\"Tyrannosaurus\", 2, 2): {0}", - dinosaurs->IndexOf("Tyrannosaurus", 2, 2)); -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -IndexOf("Tyrannosaurus"): 0 - -IndexOf("Tyrannosaurus", 3): 5 - -IndexOf("Tyrannosaurus", 2, 2): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp deleted file mode 100644 index c6ffc2e2707..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Brachiosaurus"); - dinosaurs->Add("Deinonychus"); - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Compsognathus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\"): {0}", - dinosaurs->LastIndexOf("Tyrannosaurus")); - - Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\", 3): {0}", - dinosaurs->LastIndexOf("Tyrannosaurus", 3)); - - Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\", 4, 4): {0}", - dinosaurs->LastIndexOf("Tyrannosaurus", 4, 4)); -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Deinonychus -Tyrannosaurus -Compsognathus - -LastIndexOf("Tyrannosaurus"): 5 - -LastIndexOf("Tyrannosaurus", 3): 0 - -LastIndexOf("Tyrannosaurus", 4, 4): -1 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp deleted file mode 100644 index fbee67ad25b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - array^ input = { "Brachiosaurus", - "Amargasaurus", - "Mamenchisaurus" }; - - List^ dinosaurs = - gcnew List((IEnumerable^) input); - - Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nAddRange(dinosaurs)"); - dinosaurs->AddRange(dinosaurs); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nRemoveRange(2, 2)"); - dinosaurs->RemoveRange(2, 2); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - input = gcnew array { "Tyrannosaurus", - "Deinonychus", - "Velociraptor"}; - - Console::WriteLine("\nInsertRange(3, (IEnumerable^) input)"); - dinosaurs->InsertRange(3, (IEnumerable^) input); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\noutput = dinosaurs->GetRange(2, 3)->ToArray()"); - array^ output = dinosaurs->GetRange(2, 3)->ToArray(); - - Console::WriteLine(); - for each(String^ dinosaur in output ) - { - Console::WriteLine(dinosaur); - } -} - -/* This code example produces the following output: - -Capacity: 3 - -Brachiosaurus -Amargasaurus -Mamenchisaurus - -AddRange(dinosaurs) - -Brachiosaurus -Amargasaurus -Mamenchisaurus -Brachiosaurus -Amargasaurus -Mamenchisaurus - -RemoveRange(2, 2) - -Brachiosaurus -Amargasaurus -Amargasaurus -Mamenchisaurus - -InsertRange(3, (IEnumerable^) input) - -Brachiosaurus -Amargasaurus -Amargasaurus -Tyrannosaurus -Deinonychus -Velociraptor -Mamenchisaurus - -output = dinosaurs->GetRange(2, 3)->ToArray() - -Amargasaurus -Tyrannosaurus -Deinonychus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp deleted file mode 100644 index 71c584db785..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Pachycephalosaurus"); - dinosaurs->Add("Parasauralophus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Coelophysis"); - dinosaurs->Add("Oviraptor"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - dinosaurs->Reverse(); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - dinosaurs->Reverse(1, 4); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } -} - -/* This code example produces the following output: - -Pachycephalosaurus -Parasauralophus -Mamenchisaurus -Amargasaurus -Coelophysis -Oviraptor - -Oviraptor -Coelophysis -Amargasaurus -Mamenchisaurus -Parasauralophus -Pachycephalosaurus - -Oviraptor -Parasauralophus -Mamenchisaurus -Amargasaurus -Coelophysis -Pachycephalosaurus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp deleted file mode 100644 index 4ae53587c2f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -int CompareDinosByLength(String^ x, String^ y) -{ - if (x == nullptr) - { - if (y == nullptr) - { - // If x is null and y is null, they're - // equal. - return 0; - } - else - { - // If x is null and y is not null, y - // is greater. - return -1; - } - } - else - { - // If x is not null... - // - if (y == nullptr) - // ...and y is null, x is greater. - { - return 1; - } - else - { - // ...and y is not null, compare the - // lengths of the two strings. - // - int retval = x->Length.CompareTo(y->Length); - - if (retval != 0) - { - // If the strings are not of equal length, - // the longer string is greater. - // - return retval; - } - else - { - // If the strings are of equal length, - // sort them with ordinary string comparison. - // - return x->CompareTo(y); - } - } - } -}; - -void Display(List^ list) -{ - Console::WriteLine(); - for each(String^ s in list) - { - if (s == nullptr) - Console::WriteLine("(null)"); - else - Console::WriteLine("\"{0}\"", s); - } -}; - -void main() -{ - List^ dinosaurs = gcnew List(); - dinosaurs->Add("Pachycephalosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add(""); - dinosaurs->Add(nullptr); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Deinonychus"); - Display(dinosaurs); - - Console::WriteLine("\nSort with generic Comparison delegate:"); - dinosaurs->Sort( - gcnew Comparison(CompareDinosByLength)); - Display(dinosaurs); - -} - -/* This code example produces the following output: - -"Pachycephalosaurus" -"Amargasaurus" -"" -(null) -"Mamenchisaurus" -"Deinonychus" - -Sort with generic Comparison delegate: - -(null) -"" -"Deinonychus" -"Amargasaurus" -"Mamenchisaurus" -"Pachycephalosaurus" - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp deleted file mode 100644 index e37961290a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Pachycephalosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Deinonychus"); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nSort"); - dinosaurs->Sort(); - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nBinarySearch and Insert \"Coelophysis\":"); - int index = dinosaurs->BinarySearch("Coelophysis"); - if (index < 0) - { - dinosaurs->Insert(~index, "Coelophysis"); - } - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nBinarySearch and Insert \"Tyrannosaurus\":"); - index = dinosaurs->BinarySearch("Tyrannosaurus"); - if (index < 0) - { - dinosaurs->Insert(~index, "Tyrannosaurus"); - } - - Console::WriteLine(); - for each(String^ dinosaur in dinosaurs) - { - Console::WriteLine(dinosaur); - } -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Deinonychus - -Sort - -Amargasaurus -Deinonychus -Mamenchisaurus -Pachycephalosaurus - -BinarySearch and Insert "Coelophysis": - -Amargasaurus -Coelophysis -Deinonychus -Mamenchisaurus -Pachycephalosaurus - -BinarySearch and Insert "Tyrannosaurus": - -Amargasaurus -Coelophysis -Deinonychus -Mamenchisaurus -Pachycephalosaurus -Tyrannosaurus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp deleted file mode 100644 index 396d3d9f86e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp +++ /dev/null @@ -1,164 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class DinoComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - if (x == nullptr) - { - if (y == nullptr) - { - // If x is null and y is null, they're - // equal. - return 0; - } - else - { - // If x is null and y is not null, y - // is greater. - return -1; - } - } - else - { - // If x is not null... - // - if (y == nullptr) - // ...and y is null, x is greater. - { - return 1; - } - else - { - // ...and y is not null, compare the - // lengths of the two strings. - // - int retval = x->Length.CompareTo(y->Length); - - if (retval != 0) - { - // If the strings are not of equal length, - // the longer string is greater. - // - return retval; - } - else - { - // If the strings are of equal length, - // sort them with ordinary string comparison. - // - return x->CompareTo(y); - } - } - } - } -}; - -void SearchAndInsert(List^ list, String^ insert, - DinoComparer^ dc) -{ - Console::WriteLine("\nBinarySearch and Insert \"{0}\":", insert); - - int index = list->BinarySearch(insert, dc); - - if (index < 0) - { - list->Insert(~index, insert); - } -}; - -void Display(List^ list) -{ - Console::WriteLine(); - for each(String^ s in list) - { - Console::WriteLine(s); - } -}; - -void main() -{ - List^ dinosaurs = gcnew List(); - dinosaurs->Add("Pachycephalosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Deinonychus"); - Display(dinosaurs); - - DinoComparer^ dc = gcnew DinoComparer(); - - Console::WriteLine("\nSort with alternate comparer:"); - dinosaurs->Sort(dc); - Display(dinosaurs); - - SearchAndInsert(dinosaurs, "Coelophysis", dc); - Display(dinosaurs); - - SearchAndInsert(dinosaurs, "Oviraptor", dc); - Display(dinosaurs); - - SearchAndInsert(dinosaurs, "Tyrannosaur", dc); - Display(dinosaurs); - - SearchAndInsert(dinosaurs, nullptr, dc); - Display(dinosaurs); -} - -/* This code example produces the following output: - -Pachycephalosaurus -Amargasaurus -Mamenchisaurus -Deinonychus - -Sort with alternate comparer: - -Deinonychus -Amargasaurus -Mamenchisaurus -Pachycephalosaurus - -BinarySearch and Insert "Coelophysis": - -Coelophysis -Deinonychus -Amargasaurus -Mamenchisaurus -Pachycephalosaurus - -BinarySearch and Insert "Oviraptor": - -Oviraptor -Coelophysis -Deinonychus -Amargasaurus -Mamenchisaurus -Pachycephalosaurus - -BinarySearch and Insert "Tyrannosaur": - -Oviraptor -Coelophysis -Deinonychus -Tyrannosaur -Amargasaurus -Mamenchisaurus -Pachycephalosaurus - -BinarySearch and Insert "": - - -Oviraptor -Coelophysis -Deinonychus -Tyrannosaur -Amargasaurus -Mamenchisaurus -Pachycephalosaurus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp deleted file mode 100644 index dbb74dd3f43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -public ref class DinoComparer: IComparer -{ -public: - virtual int Compare(String^ x, String^ y) - { - if (x == nullptr) - { - if (y == nullptr) - { - // If x is null and y is null, they're - // equal. - return 0; - } - else - { - // If x is null and y is not null, y - // is greater. - return -1; - } - } - else - { - // If x is not null... - // - if (y == nullptr) - // ...and y is null, x is greater. - { - return 1; - } - else - { - // ...and y is not null, compare the - // lengths of the two strings. - // - int retval = x->Length.CompareTo(y->Length); - - if (retval != 0) - { - // If the strings are not of equal length, - // the longer string is greater. - // - return retval; - } - else - { - // If the strings are of equal length, - // sort them with ordinary string comparison. - // - return x->CompareTo(y); - } - } - } - } -}; - -void Display(List^ list) -{ - Console::WriteLine(); - for each(String^ s in list) - { - Console::WriteLine(s); - } -}; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Pachycephalosaurus"); - dinosaurs->Add("Parasauralophus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Galimimus"); - dinosaurs->Add("Mamenchisaurus"); - dinosaurs->Add("Deinonychus"); - dinosaurs->Add("Oviraptor"); - dinosaurs->Add("Tyrannosaurus"); - - int herbivores = 5; - Display(dinosaurs); - - DinoComparer^ dc = gcnew DinoComparer(); - - Console::WriteLine("\nSort a range with the alternate comparer:"); - dinosaurs->Sort(0, herbivores, dc); - Display(dinosaurs); - - Console::WriteLine("\nBinarySearch a range and Insert \"{0}\":", - "Brachiosaurus"); - - int index = dinosaurs->BinarySearch(0, herbivores, "Brachiosaurus", dc); - - if (index < 0) - { - dinosaurs->Insert(~index, "Brachiosaurus"); - herbivores++; - } - - Display(dinosaurs); -} - -/* This code example produces the following output: - -Pachycephalosaurus -Parasauralophus -Amargasaurus -Galimimus -Mamenchisaurus -Deinonychus -Oviraptor -Tyrannosaurus - -Sort a range with the alternate comparer: - -Galimimus -Amargasaurus -Mamenchisaurus -Parasauralophus -Pachycephalosaurus -Deinonychus -Oviraptor -Tyrannosaurus - -BinarySearch a range and Insert "Brachiosaurus": - -Galimimus -Amargasaurus -Brachiosaurus -Mamenchisaurus -Parasauralophus -Pachycephalosaurus -Deinonychus -Oviraptor -Tyrannosaurus - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp b/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp deleted file mode 100644 index 75e16a96906..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -// System.Reflection.Emit.LocalBuilder -// System.Reflection.Emit.ILGenerator.DeclareLocal(Type) -// System.Reflection.Emit.LocalBuilder.SetLocalSymInfo(String) -// System.Reflection.Emit.LocalBuilder.LocalType() -// System.Reflection.Emit.LocalBuilder.SetLocalSymInfo(String, Int32, Int32) -/* - -This program demonstrates 'LocalType' property, 'SetLocalSymInfo(String)', -'SetLocalSymInfo(String, Int32,Int32)' methods, class level for 'LocalBuilder' and -'DeclareLocal(Type)' method of ILGenerator class. An assembly 'myClass' is created using -AssemblyBuilder, ModuleBuilder, FieldBuilder, TypeBuilder, ConstructorBuilder classes. -Localbuilder class is used to create local variables of the specified type. - -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Threading; -int main() -{ - // Create an assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "SampleAssembly"; - AssemblyBuilder^ myAssembly = Thread::GetDomain()->DefineDynamicAssembly( - myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a module. For a single-file assembly the module - // name is usually the same as the assembly name. - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( - myAssemblyName->Name, myAssemblyName->Name + ".dll", true ); - - // Define a public class 'Example'. - TypeBuilder^ myTypeBuilder = myModule->DefineType( "Example", TypeAttributes::Public ); - - // Create the 'Function1' public method, which takes an integer - // and returns a string. - MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "Function1", - MethodAttributes::Public | MethodAttributes::Static, String::typeid, - gcnew array { int::typeid } ); - - // Generate IL for 'Function1'. The function body demonstrates - // assigning an argument to a local variable, assigning a - // constant string to a local variable, and putting the contents - // of local variables on the stack. - ILGenerator^ myMethodIL = myMethod->GetILGenerator(); - - // - // Create local variables named myString and myInt. - LocalBuilder^ myLB1 = myMethodIL->DeclareLocal( String::typeid ); - myLB1->SetLocalSymInfo( "myString" ); - Console::WriteLine( "local 'myString' type is: {0}", myLB1->LocalType ); - - LocalBuilder^ myLB2 = myMethodIL->DeclareLocal( int::typeid ); - myLB2->SetLocalSymInfo( "myInt", 1, 2 ); - Console::WriteLine( "local 'myInt' type is: {0}", myLB2->LocalType ); - // - - // Store the function argument in myInt. - myMethodIL->Emit( OpCodes::Ldarg_0 ); - myMethodIL->Emit( OpCodes::Stloc_1 ); - - // Store a literal value in myString, and return the value. - myMethodIL->Emit( OpCodes::Ldstr, "string value" ); - myMethodIL->Emit( OpCodes::Stloc_0 ); - myMethodIL->Emit( OpCodes::Ldloc_0 ); - myMethodIL->Emit( OpCodes::Ret ); - - // Create "Example" class. - Type^ myType1 = myTypeBuilder->CreateType(); - Console::WriteLine( "'Example' is created." ); - - myAssembly->Save(myAssemblyName->Name + ".dll"); - Console::WriteLine( "'{0}' is created.", myAssemblyName->Name + ".dll" ); - - // Invoke 'Function1' method of 'Example', passing the value 42. - Object^ myObject2 = myType1->InvokeMember( "Function1", - BindingFlags::InvokeMethod, nullptr, nullptr, - gcnew array { 42 } ); - - Console::WriteLine( "Example::Function1 returned: {0}", myObject2 ); -} -/* This code example produces the following output: - -local 'myString' type is: System.String -local 'myInt' type is: System.Int32 -'Example' is created. -'SampleAssembly.dll' is created. -Example::Function1 returned: string value - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp deleted file mode 100644 index e978a2ab18b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -int main() -{ - // Define a dynamic assembly to contain the sample type. The - // assembly will not be run, but only saved to disk, so - // AssemblyBuilderAccess.Save is specified. - // - AppDomain^ appDomain = AppDomain::CurrentDomain; - AssemblyName^ assemblyName = gcnew - AssemblyName("MakeXxxGenericTypeParameterExample"); - AssemblyBuilder^ assemblyBuilder = appDomain->DefineDynamicAssembly - (assemblyName, AssemblyBuilderAccess::Save); - - // An assembly is made up of executable modules. For a single - // module assembly, the module name and file name are the - // same as the assembly name. - ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule - (assemblyName->Name, assemblyName->Name + ".dll"); - - // Define the sample type. - TypeBuilder^ typeBuilder = moduleBuilder->DefineType("Sample", - TypeAttributes::Public | TypeAttributes::Abstract); - - // Make the sample type a generic type, by defining a type - // parameter T. All type parameters are defined at the same - // time, by passing an array containing the type parameter - // names. - array^ typeParamNames = {"T"}; - array^ typeParams = - typeBuilder->DefineGenericParameters(typeParamNames); - - // Define a method that takes a ByRef argument of type T, a - // pointer to type T, and one-dimensional array of type T. - // The method returns a two-dimensional array of type T. - // - // To create this method, you need Type objects that repre- - // sent the parameter types and the return type. Use the - // MakeByRefType, MakePointerType, and MakeArrayType methods - // to create the Type objects, using the generic type para- - // meter T. - // - Type^ byRefType = typeParams[0]->MakeByRefType(); - Type^ pointerType = typeParams[0]->MakePointerType(); - Type^ arrayType = typeParams[0]->MakeArrayType(); - Type^ twoDimArrayType = typeParams[0]->MakeArrayType(2); - - // Create the array of parameter types. - array^ parameterTypes = {byRefType, pointerType, arrayType}; - - // Define the abstract Test method. After you have compiled - // and run this example code, you can use ildasm.exe to open - // MakeXxxGenericTypeParameterExample.dll, examine the Sample - // type, and verify the parameter types and return type of - // the TestMethod method. - // - MethodBuilder^ methodBuilder = typeBuilder->DefineMethod("TestMethod", - MethodAttributes::Abstract | MethodAttributes::Virtual - | MethodAttributes::Public, twoDimArrayType, parameterTypes); - - // Create the type and save the assembly. For a single-file - // assembly, there is only one module to store the manifest - // information in. - // - typeBuilder->CreateType(); - assemblyBuilder->Save(assemblyName->Name + ".dll"); -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp b/snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp deleted file mode 100644 index 87fd8d8dab6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp +++ /dev/null @@ -1,67 +0,0 @@ -//Types:System.Runtime.InteropServices.Marshal -// -using namespace System; -using namespace System::Runtime::InteropServices; - -public value struct Point -{ -public: - property int X; - property int Y; -}; -// -extern bool CloseHandle(IntPtr h); - -int main() -{ - // - // Demonstrate the use of public static fields of the Marshal - // class. - Console::WriteLine( - "SystemDefaultCharSize={0},SystemMaxDBCSCharSize={1}", - Marshal::SystemDefaultCharSize, - Marshal::SystemMaxDBCSCharSize); - // - - // - // Demonstrate the use of the SizeOf method of the Marshal - // class. - Console::WriteLine("Number of bytes needed by a Point object: {0}", - Marshal::SizeOf(Point::typeid)); - Point point; - Console::WriteLine("Number of bytes needed by a Point object: {0}", - Marshal::SizeOf(point)); - // - - // - // Demonstrate how to call GlobalAlloc and - // GlobalFree using the Marshal class. - IntPtr hglobal = Marshal::AllocHGlobal(100); - Marshal::FreeHGlobal(hglobal); - // - - // Demonstrate how to use the Marshal class to get the Win32 - // error code when a Win32 method fails. - bool isCloseHandleSuccess = CloseHandle(IntPtr(-1)); - if (!isCloseHandleSuccess) - { - Console::WriteLine( - "CloseHandle call failed with an error code of: {0}", - Marshal::GetLastWin32Error()); - } -}; - -// This is a platform invoke prototype. SetLastError is true, -// which allows the GetLastWin32Error method of the Marshal class -// to work correctly. -[DllImport("Kernel32", ExactSpelling = true, SetLastError = true)] -extern bool CloseHandle(IntPtr h); -// - -// This code produces the following output. -// -// SystemDefaultCharSize=2, SystemMaxDBCSCharSize=1 -// Number of bytes needed by a Point object: 8 -// Number of bytes needed by a Point object: 8 -// CloseHandle call failed with an error code of: 6 -// diff --git a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp b/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp deleted file mode 100644 index b71de67675c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -// -/// -/// The following class represents simple functionality of the trapezoid. -/// -using namespace System; - -public ref class MathTrapezoidSample -{ -private: - double m_longBase; - double m_shortBase; - double m_leftLeg; - double m_rightLeg; - -public: - MathTrapezoidSample( double longbase, double shortbase, double leftLeg, double rightLeg ) - { - m_longBase = Math::Abs( longbase ); - m_shortBase = Math::Abs( shortbase ); - m_leftLeg = Math::Abs( leftLeg ); - m_rightLeg = Math::Abs( rightLeg ); - } - - -private: - double GetRightSmallBase() - { - return (Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( m_leftLeg, 2.0 ) + Math::Pow( m_longBase, 2.0 ) + Math::Pow( m_shortBase, 2.0 ) - 2 * m_shortBase * m_longBase) / (2 * (m_longBase - m_shortBase)); - } - - -public: - double GetHeight() - { - double x = GetRightSmallBase(); - return Math::Sqrt( Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( x, 2.0 ) ); - } - - double GetSquare() - { - return GetHeight() * m_longBase / 2.0; - } - - double GetLeftBaseRadianAngle() - { - double sinX = GetHeight() / m_leftLeg; - return Math::Round( Math::Asin( sinX ), 2 ); - } - - double GetRightBaseRadianAngle() - { - double x = GetRightSmallBase(); - double cosX = (Math::Pow( m_rightLeg, 2.0 ) + Math::Pow( x, 2.0 ) - Math::Pow( GetHeight(), 2.0 )) / (2 * x * m_rightLeg); - return Math::Round( Math::Acos( cosX ), 2 ); - } - - double GetLeftBaseDegreeAngle() - { - double x = GetLeftBaseRadianAngle() * 180 / Math::PI; - return Math::Round( x, 2 ); - } - - double GetRightBaseDegreeAngle() - { - double x = GetRightBaseRadianAngle() * 180 / Math::PI; - return Math::Round( x, 2 ); - } - -}; - -int main() -{ - MathTrapezoidSample^ trpz = gcnew MathTrapezoidSample( 20.0,10.0,8.0,6.0 ); - Console::WriteLine( "The trapezoid's bases are 20.0 and 10.0, the trapezoid's legs are 8.0 and 6.0" ); - double h = trpz->GetHeight(); - Console::WriteLine( "Trapezoid height is: {0}", h.ToString() ); - double dxR = trpz->GetLeftBaseRadianAngle(); - Console::WriteLine( "Trapezoid left base angle is: {0} Radians", dxR.ToString() ); - double dyR = trpz->GetRightBaseRadianAngle(); - Console::WriteLine( "Trapezoid right base angle is: {0} Radians", dyR.ToString() ); - double dxD = trpz->GetLeftBaseDegreeAngle(); - Console::WriteLine( "Trapezoid left base angle is: {0} Degrees", dxD.ToString() ); - double dyD = trpz->GetRightBaseDegreeAngle(); - Console::WriteLine( "Trapezoid right base angle is: {0} Degrees", dyD.ToString() ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp deleted file mode 100644 index 3586a67f36a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Define a custom attribute with one named parameter. - -[AttributeUsage(AttributeTargets::All)] -public ref class MyAttribute: public Attribute -{ -private: - String^ myName; - -public: - MyAttribute( String^ name ) - { - myName = name; - } - - property String^ Name - { - String^ get() - { - return myName; - } - } -}; - -// Define a class that has the custom attribute associated with one of its members. -public ref class MyClass1 -{ -public: - - [MyAttribute("This is an example attribute.")] - void MyMethod( int i ){} -}; - -int main() -{ - try - { - // Get the type of MyClass1. - Type^ myType = MyClass1::typeid; - - // Get the members associated with MyClass1. - array^myMembers = myType->GetMembers(); - - // Display the attributes for each of the members of MyClass1. - for ( int i = 0; i < myMembers->Length; i++ ) - { - // Display the attribute if it is of type MyAttribute. - if ( myMembers[ i ]->IsDefined( MyAttribute::typeid, false ) ) - { - array^myAttributes = myMembers[ i ]->GetCustomAttributes( MyAttribute::typeid, false ); - Console::WriteLine( "\nThe attributes of type MyAttribute for the member {0} are: \n", myMembers[ i ] ); - for ( int j = 0; j < myAttributes->Length; j++ ) - - // Display the value associated with the attribute. - Console::WriteLine( "The value of the attribute is : \"{0}\"", - (safe_cast(myAttributes[ j ]))->Name ); - } - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp deleted file mode 100644 index 6153b2ffb03..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Define a custom attribute with one named parameter. - -[AttributeUsage(AttributeTargets::All)] -public ref class MyAttribute: public Attribute -{ -private: - String^ myName; - -public: - MyAttribute( String^ name ) - { - myName = name; - } - - property String^ Name - { - String^ get() - { - return myName; - } - } -}; - -// Define a class that has the custom attribute associated with one of its members. -public ref class MyClass1 -{ -public: - - [MyAttribute("This is an example attribute.")] - void MyMethod( int i ) - { - return; - } -}; - -int main() -{ - try - { - // Get the type of MyClass1. - Type^ myType = MyClass1::typeid; - - // Get the members associated with MyClass1. - array^myMembers = myType->GetMembers(); - - // Display the attributes for each of the members of MyClass1. - for ( int i = 0; i < myMembers->Length; i++ ) - { - array^myAttributes = myMembers[ i ]->GetCustomAttributes( true ); - if ( myAttributes->Length > 0 ) - { - Console::WriteLine( "\nThe attributes for the member {0} are: \n", myMembers[ i ] ); - for ( int j = 0; j < myAttributes->Length; j++ ) - Console::WriteLine( "The type of the attribute is {0}.", myAttributes[ j ] ); - } - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp deleted file mode 100644 index 44d2576e6eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp +++ /dev/null @@ -1,157 +0,0 @@ -// 1 - (entire sample) MethodBody class -// 2 - (everything through GetMethodBody and displaying InitLocals & MaxStackSize) -// 3 - (displaying locals) -// 4 - (displaying exception clauses) -// 5 - (end of Main, example method, beginning of output through output for snippet 2) -// 6 - (output for snippet 3 (locals)) -// 7 - (output for snippet 4 (clauses)) -// 2,5 - InitLocals, MaxStackSize -// 2,3,5,6 - lvis property, lviInfo class -// 2,4,5,7 - ExceptionHandlingClauses property, ExceptionHandlingClause class, ExceptionHandlingClauseFlags enum -// -// -// -#using - -using namespace System; -using namespace System::Reflection; - -public ref class Example -{ - // - // The Main method contains code to analyze this method, using - // the properties and methods of the MethodBody class. -public: - void MethodBodyExample(Object^ arg) - { - // Define some local variables. In addition to these variables, - // the local variable list includes the variables scoped to - // the catch clauses. - int var1 = 42; - String^ var2 = "Forty-two"; - - try - { - // Depending on the input value, throw an ArgumentException or - // an ArgumentNullException to test the Catch clauses. - if (arg == nullptr) - { - throw gcnew ArgumentNullException("The argument cannot " + - "be null."); - } - if (arg->GetType() == String::typeid) - { - throw gcnew ArgumentException("The argument cannot " + - "be a string."); - } - } - - // There is no Filter clause in this code example. See the Visual - // Basic code for an example of a Filter clause. - - // This catch clause handles the ArgumentException class, and - // any other class derived from Exception. - catch (ArgumentException^ ex) - { - Console::WriteLine("Ordinary exception-handling clause caught:" + - " {0}", ex->GetType()); - } - finally - { - var1 = 3033; - var2 = "Another string."; - } - } - // -}; - -int main() -{ - // Get method body information. - MethodInfo^ mi = - Example::typeid->GetMethod("MethodBodyExample"); - - MethodBody^ mb = mi->GetMethodBody(); - Console::WriteLine("\r\nMethod: {0}", mi); - - // Display the general information included in the - // MethodBody object. - Console::WriteLine(" Local variables are initialized: {0}", - mb->InitLocals); - Console::WriteLine(" Maximum number of items on the operand " + - "stack: {0}", mb->MaxStackSize); - // - // - - // Display information about the local variables in the - // method body. - Console::WriteLine(); - for each (LocalVariableInfo^ lvi in mb->LocalVariables) - { - Console::WriteLine("Local variable: {0}", lvi); - } - // - // - - // Display exception handling clauses. - Console::WriteLine(); - for each(ExceptionHandlingClause^ exhc in mb->ExceptionHandlingClauses) - { - Console::WriteLine(exhc->Flags.ToString()); - - // The FilterOffset property is meaningful only for Filter - // clauses. The CatchType property is not meaningful for - // Filter or Finally clauses. - switch(exhc->Flags) - { - case ExceptionHandlingClauseOptions::Filter: - Console::WriteLine(" Filter Offset: {0}", - exhc->FilterOffset); - break; - case ExceptionHandlingClauseOptions::Finally: - break; - default: - Console::WriteLine(" Type of exception: {0}", - exhc->CatchType); - break; - } - - Console::WriteLine(" Handler Length: {0}", - exhc->HandlerLength); - Console::WriteLine(" Handler Offset: {0}", - exhc->HandlerOffset); - Console::WriteLine(" Try Block Length: {0}", exhc->TryLength); - Console::WriteLine(" Try Block Offset: {0}", exhc->TryOffset); - } - // -} - -//This code example produces output similar to the following: -// -//Method: Void MethodBodyExample(System.Object) -// Local variables are initialized: False -// Maximum number of items on the operand stack: 4 -// -// -//Local variable: System.ArgumentException (0) -//Local variable: System.String (1) -//Local variable: System.Int32 (2) -// -// -//Clause -// Type of exception: System.ArgumentException -// Handler Length: 29 -// Handler Offset: 78 -// Try Block Length: 65 -// Try Block Offset: 13 -//Finally -// Handler Length: 13 -// Handler Offset: 113 -// Try Block Length: 100 -// Try Block Offset: 13 -// -// - - - - diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp deleted file mode 100644 index 546d0961119..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -void main() -{ - // Define a transient dynamic assembly (only to run, not - // to save) with one module and a type "Test". - // - AssemblyName^ aName = gcnew AssemblyName("MyDynamic"); - AssemblyBuilder^ ab = - AppDomain::CurrentDomain->DefineDynamicAssembly( - aName, - AssemblyBuilderAccess::Run); - ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name); - TypeBuilder^ tb = mb->DefineType("Test"); - - // Add a public static method "M" to Test, and make it a - // generic method with one type parameter named "T"). - // - MethodBuilder^ meb = tb->DefineMethod("M", - MethodAttributes::Public | MethodAttributes::Static); - array^ typeParams = - meb->DefineGenericParameters(gcnew array { "T" }); - - // Give the method one parameter, of type T, and a - // return type of T. - meb->SetParameters(typeParams); - meb->SetReturnType(typeParams[0]); - - // Create a MethodInfo for M, which can be used in - // emitted code. This is possible even though the method - // does not yet have a body, and the enclosing type is not - // created. - MethodInfo^ mi = meb->MakeGenericMethod(String::typeid); - // Note that this is actually a subclass of MethodInfo, - // which has rather limited capabilities -- for - // example, you cannot reflect on its parameters. -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp deleted file mode 100644 index f43a09ff0c7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// System.Reflection.Emit.MethodBuilder -/* -This program demonstrates 'MethodBuilder' class. A dynamic class 'myTypeBuilder' -is created in which a constructor 'myConstructorBuilder' and a method 'myMethodBuilder' -are created dynamically. Their IL's are generated. The Non-Public methods of the class -are printed on the console. The attributes and signature of 'MyDynamicMethod' are displayed -on the console using 'Attributes' and 'Signature' properties of the 'MethodBuilder' class. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -int main() -{ - try - { - // Get the current AppDomain. - AppDomain^ myAppDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "MyDynamicAssembly"; - - // Create the dynamic assembly and set its access mode to 'Save'. - AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); - - // Create a dynamic module 'myModuleBuilder'. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyDynamicModule", true ); - - // Define a public class 'MyDynamicClass'. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyDynamicClass", TypeAttributes::Public ); - - // Define a public string field named 'myField'. - FieldBuilder^ myField = myTypeBuilder->DefineField( "MyDynamicField", String::typeid, FieldAttributes::Public ); - - // Define the dynamic method 'MyDynamicMethod'. - array^temp0 = gcnew array(0); - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyDynamicMethod", MethodAttributes::Private, int::typeid, temp0 ); - - // Generate the IL for 'myMethodBuilder'. - ILGenerator^ myMethodIL = myMethodBuilder->GetILGenerator(); - - // Emit the necessary opcodes. - myMethodIL->Emit( OpCodes::Ldarg_0 ); - myMethodIL->Emit( OpCodes::Ldfld, myField ); - myMethodIL->Emit( OpCodes::Ret ); - - // Create 'myTypeBuilder' class. - Type^ myType1 = myTypeBuilder->CreateType(); - - // Get the method information of 'myTypeBuilder'. - array^myInfo = myType1->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - - // Print non-public methods present of 'myType1'. - Console::WriteLine( "\nThe Non-Public methods present in 'myType1' are:\n" ); - for ( int i = 0; i < myInfo->Length; i++ ) - { - Console::WriteLine( myInfo[ i ]->Name ); - } - Console::WriteLine( "\nThe Attribute of 'MyDynamicMethod' is :{0}", myMethodBuilder->Attributes ); - Console::WriteLine( "\nThe Signature of 'MyDynamicMethod' is : \n{0}", myMethodBuilder->Signature ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception :{0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp deleted file mode 100644 index f2e621d6748..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// -// Define a class with a generic method. -ref class Example -{ -public: - generic static void Generic(T toDisplay) - { - Console::WriteLine("\r\nHere it is: {0}", toDisplay); - } -}; -// - -void DisplayGenericMethodInfo(MethodInfo^ mi) -{ - Console::WriteLine("\r\n{0}", mi); - - // - Console::WriteLine("\tIs this a generic method definition? {0}", - mi->IsGenericMethodDefinition); - // - - // - Console::WriteLine("\tIs it a generic method? {0}", - mi->IsGenericMethod); - // - - // - Console::WriteLine("\tDoes it have unassigned generic parameters? {0}", - mi->ContainsGenericParameters); - // - - // - // If this is a generic method, display its type arguments. - // - if (mi->IsGenericMethod) - { - array^ typeArguments = mi->GetGenericArguments(); - - Console::WriteLine("\tList type arguments ({0}):", - typeArguments->Length); - - for each (Type^ tParam in typeArguments) - { - // IsGenericParameter is true only for generic type - // parameters. - // - if (tParam->IsGenericParameter) - { - Console::WriteLine("\t\t{0} parameter position {1}" + - "\n\t\t declaring method: {2}", - tParam, - tParam->GenericParameterPosition, - tParam->DeclaringMethod); - } - else - { - Console::WriteLine("\t\t{0}", tParam); - } - } - } - // -}; - -void main() -{ - Console::WriteLine("\r\n--- Examine a generic method."); - - // - // Create a Type object representing class Example, and - // get a MethodInfo representing the generic method. - // - Type^ ex = Example::typeid; - MethodInfo^ mi = ex->GetMethod("Generic"); - - DisplayGenericMethodInfo(mi); - - // Assign the int type to the type parameter of the Example - // method. - // - MethodInfo^ miConstructed = mi->MakeGenericMethod(int::typeid); - - DisplayGenericMethodInfo(miConstructed); - // - - // Invoke the method. - array^ args = { 42 }; - miConstructed->Invoke((Object^) 0, args); - - // Invoke the method normally. - Example::Generic(42); - - // - // Get the generic type definition from the closed method, - // and show it's the same as the original definition. - // - MethodInfo^ miDef = miConstructed->GetGenericMethodDefinition(); - Console::WriteLine("\r\nThe definition is the same: {0}", - miDef == mi); - // -}; - -/* This example produces the following output: - ---- Examine a generic method. - -Void Generic[T](T) - Is this a generic method definition? True - Is it a generic method? True - Does it have unassigned generic parameters? True - List type arguments (1): - T parameter position 0 - declaring method: Void Generic[T](T) - -Void Generic[Int32](Int32) - Is this a generic method definition? False - Is it a generic method? True - Does it have unassigned generic parameters? False - List type arguments (1): - System.Int32 - -Here it is: 42 - -Here it is: 42 - -The definition is the same: True - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp deleted file mode 100644 index f0cad63b50a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// -using namespace System; -using namespace Microsoft::Win32; - -int main() -{ - // The name of the key must include a valid root. - String^ userRoot = "HKEY_CURRENT_USER"; - String^ subKey = "RegistrySetValueExample2"; - String^ keyName = String::Concat(userRoot, "\\", subKey); - - // An int value can be stored without specifying the - // registry data type, but Int64 values will be stored - // as strings unless you specify the type. Note that - // the int is stored in the default name/value - // pair. - Registry::SetValue(keyName, "", 5280); - Registry::SetValue(keyName, "TestInt64", 12345678901234, - RegistryValueKind::QWord); - - // Strings with expandable environment variables are - // stored as ordinary strings unless you specify the - // data type. - Registry::SetValue(keyName, "TestExpand", "My path: %path%"); - Registry::SetValue(keyName, "TestExpand2", "My path: %path%", - RegistryValueKind::ExpandString); - - // Arrays of strings are stored automatically as - // MultiString. Similarly, arrays of Byte are stored - // automatically as Binary. - array^ strings = {"One", "Two", "Three"}; - Registry::SetValue(keyName, "TestArray", strings); - - // Your default value is returned if the name/value pair - // does not exist. - String^ noSuch = (String^)Registry::GetValue(keyName, - "NoSuchName", - "Return this default if NoSuchName does not exist."); - Console::WriteLine("\r\nNoSuchName: {0}", noSuch); - - // Retrieve the int and Int64 values, specifying - // numeric default values in case the name/value pairs - // do not exist. The int value is retrieved from the - // default (nameless) name/value pair for the key. - int testInteger = (int)Registry::GetValue(keyName, "", -1); - Console::WriteLine("(Default): {0}", testInteger); - long long testInt64 = (long long)Registry::GetValue(keyName, - "TestInt64", System::Int64::MinValue); - Console::WriteLine("TestInt64: {0}", testInt64); - - // When retrieving a MultiString value, you can specify - // an array for the default return value. - array^ testArray = (array^)Registry::GetValue( - keyName, "TestArray", - gcnew array {"Default if TestArray does not exist."}); - for (int i = 0; i < testArray->Length; i++) - { - Console::WriteLine("TestArray({0}): {1}", i, testArray[i]); - } - - // A string with embedded environment variables is not - // expanded if it was stored as an ordinary string. - String^ testExpand = (String^)Registry::GetValue(keyName, - "TestExpand", "Default if TestExpand does not exist."); - Console::WriteLine("TestExpand: {0}", testExpand); - - // A string stored as ExpandString is expanded. - String^ testExpand2 = (String^)Registry::GetValue(keyName, - "TestExpand2", "Default if TestExpand2 does not exist."); - Console::WriteLine( - "TestExpand2: {0}...", testExpand2->Substring(0, 40)); - Console::WriteLine( - "\r\nUse the registry editor to examine the key."); - Console::WriteLine("Press the Enter key to delete the key."); - Console::ReadLine(); - Registry::CurrentUser->DeleteSubKey(subKey); -} -// -// This code example produces output similar to the following: -// -// NoSuchName: Return this default if NoSuchName does not exist. -// (Default): 5280 -// TestInt64: 12345678901234 -// TestArray(0): One -// TestArray(1): Two -// TestArray(2): Three -// TestExpand: My path: %path% -// TestExpand2: My path: D:\Program Files\Microsoft.NET\... -// -// Use the registry editor to examine the key. -// Press the Enter key to delete the key. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp deleted file mode 100644 index d2c646822c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Permissions; -using namespace Microsoft::Win32; - - -int main( int argc, char *argv[] ) -{ - RegistryKey ^ environmentKey; - - // Check that an argument was specified when the - // program was invoked. - if ( argc == 1 ) - { - Console::WriteLine( "Error: The name of the remote computer " - "must be specified as input on the command line." ); - return -1; - } - - try - { - - // Open HKEY_CURRENT_USER\Environment on a remote computer. - environmentKey = RegistryKey::OpenRemoteBaseKey( RegistryHive::CurrentUser, gcnew String(argv[ 1 ]) )->OpenSubKey( "Environment" ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "{0}: {1}", e->GetType()->Name, e->Message ); - return -1; - } - - - // Print the values. - Console::WriteLine( "\nThere are {0} values for {1}.", environmentKey->ValueCount.ToString(), environmentKey->Name ); - array^valueNames = environmentKey->GetValueNames(); - for ( int i = 0; i < environmentKey->ValueCount; i++ ) - { - Console::WriteLine( "{0,-20}: {1}", valueNames[ i ], environmentKey->GetValue( valueNames[ i ] )->ToString() ); - - } - - // Close the registry key. - environmentKey->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp deleted file mode 100644 index d7525ab162b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -int main() -{ - - // Delete and recreate the test key. - Registry::CurrentUser->DeleteSubKey( "RegistrySetValueExample", false ); - RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( "RegistrySetValueExample" ); - - // Create name/value pairs. - // Numeric values that cannot be interpreted as DWord (int) values - // are stored as strings. - rk->SetValue( "LargeNumberValue1", (long)42 ); - rk->SetValue( "LargeNumberValue2", 42000000000 ); - rk->SetValue( "DWordValue", 42 ); - array^temp0 = {"One","Two","Three"}; - rk->SetValue( "MultipleStringValue", temp0 ); - array^temp1 = {10,43,44,45,14,255}; - rk->SetValue( "BinaryValue", temp1 ); - - // This overload of SetValue does not support expanding strings. Use - // the overload that allows you to specify RegistryValueKind. - rk->SetValue( "StringValue", "The path is %PATH%" ); - - // Display all the name/value pairs stored in the test key, with - // the registry data type in parentheses. - // - array^valueNames = rk->GetValueNames(); - System::Collections::IEnumerator^ myEnum = valueNames->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ s = safe_cast(myEnum->Current); - RegistryValueKind rvk = rk->GetValueKind( s ); - switch ( rvk ) - { - case RegistryValueKind::MultiString: - { - array^values = (array^)rk->GetValue( s ); - Console::Write( "\r\n {0} ({1}) = \"{2}\"", s, rvk, values[ 0 ] ); - for ( int i = 1; i < values->Length; i++ ) - { - Console::Write( ", \"{0}\"", values[ i ] ); - - } - Console::WriteLine(); - break; - } - case RegistryValueKind::Binary: - { - array^bytes = (array^)rk->GetValue( s ); - Console::Write( "\r\n {0} ({1}) = {2:X2}", s, rvk, bytes[ 0 ] ); - for ( int i = 1; i < bytes->Length; i++ ) - { - - // Display each byte as two hexadecimal digits. - Console::Write( " {0:X2}", bytes[ i ] ); - - } - Console::WriteLine(); - break; - } - default: - Console::WriteLine( "\r\n {0} ({1}) = {2}", s, rvk, rk->GetValue( s ) ); - break; - } - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp deleted file mode 100644 index e9f720004e7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Permissions; -using namespace Microsoft::Win32; - -int main() -{ - // Create a subkey named Test9999 under HKEY_CURRENT_USER. - RegistryKey ^ test9999 = Registry::CurrentUser->CreateSubKey( "Test9999" ); - - // Create two subkeys under HKEY_CURRENT_USER\Test9999. - test9999->CreateSubKey( "TestName" )->Close(); - RegistryKey ^ testSettings = test9999->CreateSubKey( "TestSettings" ); - - // Create data for the TestSettings subkey. - testSettings->SetValue( "Language", "French" ); - testSettings->SetValue( "Level", "Intermediate" ); - testSettings->SetValue( "ID", 123 ); - testSettings->Close(); - - // - // Print the information from the Test9999 subkey. - Console::WriteLine( "There are {0} subkeys under Test9999.", test9999->SubKeyCount.ToString() ); - array^subKeyNames = test9999->GetSubKeyNames(); - for ( int i = 0; i < subKeyNames->Length; i++ ) - { - RegistryKey ^ tempKey = test9999->OpenSubKey( subKeyNames[ i ] ); - Console::WriteLine( "\nThere are {0} values for {1}.", tempKey->ValueCount.ToString(), tempKey->Name ); - array^valueNames = tempKey->GetValueNames(); - for ( int j = 0; j < valueNames->Length; j++ ) - { - Console::WriteLine( "{0,-8}: {1}", valueNames[ j ], tempKey->GetValue( valueNames[ j ] )->ToString() ); - - } - } - // - - // - // Delete the ID value. - testSettings = test9999->OpenSubKey( "TestSettings", true ); - testSettings->DeleteValue( "id" ); - - // Verify the deletion. - Console::WriteLine( dynamic_cast(testSettings->GetValue( "id", "ID not found." )) ); - testSettings->Close(); - // - - // - // Delete or close the new subkey. - Console::Write( "\nDelete newly created registry key? (Y/N) " ); - if ( Char::ToUpper( Convert::ToChar( Console::Read() ) ) == 'Y' ) - { - Registry::CurrentUser->DeleteSubKeyTree( "Test9999" ); - Console::WriteLine( "\nRegistry key {0} deleted.", test9999->Name ); - } - else - { - Console::WriteLine( "\nRegistry key {0} closed.", test9999->ToString() ); - test9999->Close(); - } - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp deleted file mode 100644 index e13a94e5145..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -using namespace Microsoft::Win32; - -public ref class RegKeyDel -{ -public: - static void Main() - { - // Create a subkey named Test9999 under HKEY_CURRENT_USER. - RegistryKey^ test9999 = - Registry::CurrentUser->CreateSubKey("Test9999"); - // Create two subkeys under HKEY_CURRENT_USER\Test9999. The - // keys are disposed when execution exits the using statement. - RegistryKey^ testName = test9999->CreateSubKey("TestName"); - RegistryKey^ testSettings = test9999->CreateSubKey("TestSettings"); - - // Create data for the TestSettings subkey. - testSettings->SetValue("Language", "French"); - testSettings->SetValue("Level", "Intermediate"); - testSettings->SetValue("ID", 123); - - // delete the subkey "TestName" - test9999->DeleteSubKey("TestName"); - // delete everything under and including "Test9999" - Registry::CurrentUser->DeleteSubKeyTree("Test9999"); - } -}; - -int main() -{ - RegKeyDel::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp deleted file mode 100644 index 3f19093fe47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -int main() -{ - - // Delete and recreate the test key. - Registry::CurrentUser->DeleteSubKey( "RegistryValueKindExample", false ); - RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( "RegistryValueKindExample" ); - - // Create name/value pairs. - // This overload supports QWord (long) values. - rk->SetValue( "QuadWordValue", 42, RegistryValueKind::QWord ); - - // The following SetValue calls have the same effect as using the - // SetValue overload that does not specify RegistryValueKind. - // - rk->SetValue( "DWordValue", 42, RegistryValueKind::DWord ); - rk->SetValue( "MultipleStringValue", gcnew array{ - "One","Two","Three" - }, RegistryValueKind::MultiString ); - rk->SetValue( "BinaryValue", gcnew array{ - 10,43,44,45,14,255 - }, RegistryValueKind::Binary ); - rk->SetValue( "StringValue", "The path is %PATH%", RegistryValueKind::String ); - - // This overload supports setting expandable string values. Compare - // the output from this value with the previous string value. - rk->SetValue( "ExpandedStringValue", "The path is %PATH%", RegistryValueKind::ExpandString ); - - // Display all the name/value pairs stored in the test key, with the - // registry data type in parentheses. - // - array^valueNames = rk->GetValueNames(); - System::Collections::IEnumerator^ myEnum = valueNames->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ s = safe_cast(myEnum->Current); - RegistryValueKind rvk = rk->GetValueKind( s ); - switch ( rvk ) - { - case RegistryValueKind::MultiString: - { - array^values = (array^)rk->GetValue( s ); - Console::Write( "\r\n {0} ({1}) =", s, rvk ); - for ( int i = 0; i < values->Length; i++ ) - { - if (i != 0) Console::Write(","); - Console::Write( " \"{0}\"", values[ i ] ); - - } - Console::WriteLine(); - break; - } - case RegistryValueKind::Binary: - { - array^bytes = (array^)rk->GetValue( s ); - Console::Write( "\r\n {0} ({1}) =", s, rvk ); - for ( int i = 0; i < bytes->Length; i++ ) - { - - // Display each byte as two hexadecimal digits. - Console::Write( " {0:X2}", bytes[ i ] ); - - } - Console::WriteLine(); - break; - } - default: - Console::WriteLine( "\r\n {0} ({1}) = {2}", s, rvk, rk->GetValue( s ) ); - break; - } - } -} -/* - -This code example produces the following output: - QuadWordValue (QWord) = 42 - - DWordValue (DWord) = 42 - - MultipleStringValue (MultiString) =, "One", "Two", "Three" - - BinaryValue (Binary) = 0A 2B 2C 2D 0E FF - - StringValue (String) = The path is %PATH% - - ExpandedStringValue (ExpandString) = The path is C:\Program Files\Microsoft.NET\SDK\v2.0\Bin; - [***The remainder of this output is omitted.***] - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp b/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp deleted file mode 100644 index 5f170354fb3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//Types:System.MissingMethodException -//Types:System.MissingMemberException -//Types:System.MissingFieldException -// -using namespace System; -using namespace System::Reflection; - -ref class App -{ -}; - -int main() -{ - // - try - { - // Attempt to call a static DoSomething method defined in the App class. - // However, because the App class does not define this method, - // a MissingMethodException is thrown. - App::typeid->InvokeMember("DoSomething", BindingFlags::Static | - BindingFlags::InvokeMethod, nullptr, nullptr, nullptr); - } - catch (MissingMethodException^ ex) - { - // Show the user that the DoSomething method cannot be called. - Console::WriteLine("Unable to call the DoSomething method: {0}", - ex->Message); - } - // - - // - try - { - // Attempt to access a static AField field defined in the App class. - // However, because the App class does not define this field, - // a MissingFieldException is thrown. - App::typeid->InvokeMember("AField", BindingFlags::Static | - BindingFlags::SetField, nullptr, nullptr, gcnew array{5}); - } - catch (MissingFieldException^ ex) - { - // Show the user that the AField field cannot be accessed. - Console::WriteLine("Unable to access the AField field: {0}", - ex->Message); - } - // - - // - try - { - // Attempt to access a static AnotherField field defined in the App class. - // However, because the App class does not define this field, - // a MissingFieldException is thrown. - App::typeid->InvokeMember("AnotherField", BindingFlags::Static | - BindingFlags::GetField, nullptr, nullptr, nullptr); - } - catch (MissingMemberException^ ex) - { - // Notice that this code is catching MissingMemberException which is the - // base class of MissingMethodException and MissingFieldException. - // Show the user that the AnotherField field cannot be accessed. - Console::WriteLine("Unable to access the AnotherField field: {0}", - ex->Message); - } - // -} -// This code produces the following output. -// -// Unable to call the DoSomething method: Method 'App.DoSomething' not found. -// Unable to access the AField field: Field 'App.AField' not found. -// Unable to access the AnotherField field: Field 'App.AnotherField' not found. -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp deleted file mode 100644 index f498738331b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -// System.Reflection.Emit.ModuleBuilder -/* -The following example demonstrates the 'ModuleBuilder' class. -A dynamic assembly with a module in it is created in 'CodeGenerator' class. -A run time class having a method and a field is created using the 'ModuleBuilder' -class and created class is called from the 'TestClass'. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -public ref class CodeGenerator -{ -private: - AssemblyBuilder^ myAssemblyBuilder; - -public: - CodeGenerator() - { - // Get the current application domain for the current thread. - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define a dynamic assembly in the current application domain. - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Define a dynamic module in this assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); - - // Define a runtime class with specified name and attributes. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); - - // Add 'Greeting' field to the class, with the specified attribute and type. - FieldBuilder^ greetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); - array^myMethodArgs = {String::typeid}; - - // Add 'MyMethod' method to the class, with the specified attribute and signature. - MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, CallingConventions::Standard, nullptr, myMethodArgs ); - ILGenerator^ methodIL = myMethod->GetILGenerator(); - methodIL->EmitWriteLine( "In the method..." ); - methodIL->Emit( OpCodes::Ldarg_0 ); - methodIL->Emit( OpCodes::Ldarg_1 ); - methodIL->Emit( OpCodes::Stfld, greetingField ); - methodIL->Emit( OpCodes::Ret ); - myTypeBuilder->CreateType(); - } - - property AssemblyBuilder^ MyAssembly - { - AssemblyBuilder^ get() - { - return this->myAssemblyBuilder; - } - } -}; - -int main() -{ - CodeGenerator^ myCodeGenerator = gcnew CodeGenerator; - - // Get the assembly builder for 'myCodeGenerator' object. - AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyAssembly; - - // Get the module builder for the above assembly builder object . - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->GetDynamicModule( "TempModule" ); - Console::WriteLine( "The fully qualified name and path to this module is :{0}", myModuleBuilder->FullyQualifiedName ); - Type^ myType = myModuleBuilder->GetType( "TempClass" ); - MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" ); - - // Get the token used to identify the method within this module. - MethodToken myMethodToken = myModuleBuilder->GetMethodToken( myMethodInfo ); - Console::WriteLine( "Token used to identify the method of 'myType'" - " within the module is {0:x}", myMethodToken.Token ); - array^args = {"Hello."}; - Object^ myObject = Activator::CreateInstance( myType, nullptr, nullptr ); - myMethodInfo->Invoke( myObject, args ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp deleted file mode 100644 index 3979e2356e6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// System.Reflection.Emit.ModuleBuilder.DefineGlobalMethod(String,MethodAttributes,Type,Type[]) -// System.Reflection.Emit.ModuleBuilder.CreateGlobalFunctions - -/* -The following example demonstrates the 'DefineGlobalMethod(String,MethodAttributes,Type,Type[])' -and 'CreateGlobalFunctions' methods of 'ModuleBuilder' class. -A dynamic assembly with a module in it is created in 'CodeGenerator' class. Then a global method -is created in the module using the 'DefineGlobalMethod' method. The global method is called from -the 'CallerClass'. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class CodeGenerator -{ -private: - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - CodeGenerator() - { - myModuleBuilder = nullptr; - myAssemblyBuilder = nullptr; - - // - // - AppDomain^ currentDomain; - AssemblyName^ myAssemblyName; - MethodBuilder^ myMethodBuilder = nullptr; - ILGenerator^ myILGenerator; - - // Get the current application domain for the current thread. - currentDomain = AppDomain::CurrentDomain; - myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define a dynamic assembly in the 'currentDomain'. - myAssemblyBuilder = - currentDomain->DefineDynamicAssembly( - myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Define a dynamic module in "TempAssembly" assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); - - // Define a global method in the 'TempModule' module. - myMethodBuilder = myModuleBuilder->DefineGlobalMethod( - "MyMethod1", (MethodAttributes)(MethodAttributes::Static | MethodAttributes::Public), - nullptr, nullptr ); - myILGenerator = myMethodBuilder->GetILGenerator(); - myILGenerator->EmitWriteLine( "Hello World from global method." ); - myILGenerator->Emit( OpCodes::Ret ); - - // Fix up the 'TempModule' module . - myModuleBuilder->CreateGlobalFunctions(); - // - // - } - - property AssemblyBuilder^ MyAssembly - { - AssemblyBuilder^ get() - { - return this->myAssemblyBuilder; - } - } -}; - -int main() -{ - CodeGenerator^ myGenerator = gcnew CodeGenerator; - AssemblyBuilder^ myAssembly = myGenerator->MyAssembly; - ModuleBuilder^ myBuilder = myAssembly->GetDynamicModule( "TempModule" ); - Console::WriteLine( "Invoking the global method..." ); - MethodInfo^ myMethodInfo = myBuilder->GetMethod( "MyMethod1" ); - myMethodInfo->Invoke( nullptr, nullptr ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp deleted file mode 100644 index d74a7ca473d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// System::Reflection::Emit::ModuleBuilder.DefineDocument -/* -The following example demonstrates the 'DefineDocument' method -of 'ModuleBuilder' class. -A dynamic assembly with a module in it is created in 'CodeGenerator' class. -It gets the Object* representing the defined document using the method -'DefineDocument'. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Resources; -using namespace System::Diagnostics::SymbolStore; -public ref class CodeGenerator -{ -private: - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - CodeGenerator() - { - - // Get the current application domain for the current thread. - AppDomain^ currentDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define a dynamic assembly in the current domain. - myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Define a dynamic module in S"TempAssembly" assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "Resource.mod", true ); - - // Define a document for source.on 'TempModule' module. - ISymbolDocumentWriter^ myDocument = myModuleBuilder->DefineDocument( "RTAsm.il", SymDocumentType::Text, SymLanguageType::ILAssembly, SymLanguageVendor::Microsoft ); - Console::WriteLine( "The object representing the defined document is: {0}", myDocument ); - } - -}; - -int main() -{ - CodeGenerator^ myGenerator = gcnew CodeGenerator; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp deleted file mode 100644 index b40b5fe22cc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -void main() -{ - // Get the current application domain for the current thread. - AppDomain^ currentDomain = AppDomain::CurrentDomain; - - // Create a dynamic assembly in the current application domain, - // and allow it to be executed and saved to disk. - AssemblyName^ aName = gcnew AssemblyName("TempAssembly"); - AssemblyBuilder^ ab = currentDomain->DefineDynamicAssembly( - aName, AssemblyBuilderAccess::RunAndSave); - - // Define a dynamic module in "TempAssembly" assembly. For a single- - // module assembly, the module has the same name as the assembly. - ModuleBuilder^ mb = - ab->DefineDynamicModule(aName->Name, aName->Name + ".dll"); - - // Define a public enumeration with the name "Elevation" and an - // underlying type of Int32. - EnumBuilder^ eb = - mb->DefineEnum("Elevation", TypeAttributes::Public, int::typeid); - - // Define two members, "High" and "Low". - eb->DefineLiteral("Low", (Object^) 0); - eb->DefineLiteral("High", 1); - - // Create the type and save the assembly. - Type^ finished = eb->CreateType(); - ab->Save(aName->Name + ".dll"); - - for each (Object^ o in Enum::GetValues(finished)) - { - Console::WriteLine("{0}.{1} = {2}", finished, o, (int)o); - } -} - -/* This code example produces the following output: - -Elevation.Low = 0 -Elevation.High = 1 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp deleted file mode 100644 index d87da81e582..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System.Reflection.Emit.ModuleBuilder.DefineInitializedData - -/* -The following example demonstrates the 'DefineInitializedData' method of -'ModuleBuilder' class. -A dynamic assembly with a module in it is created in 'CodeGenerator' class. -A initialized data field is created using 'DefineInitializedData' -method for creating the initialized data. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class CodeGenerator -{ -private: - ModuleBuilder^ myModuleBuilder; - AssemblyBuilder^ myAssemblyBuilder; - -public: - CodeGenerator() - { - // - AppDomain^ currentDomain; - AssemblyName^ myAssemblyName; - - // Get the current application domain for the current thread. - currentDomain = AppDomain::CurrentDomain; - myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define a dynamic assembly in the 'currentDomain'. - myAssemblyBuilder = - currentDomain->DefineDynamicAssembly( - myAssemblyName, AssemblyBuilderAccess::Run ); - - // Define a dynamic module in "TempAssembly" assembly. - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); - - // Define the initialized data field in the .sdata section of the PE file. - array^ temp0 = {01,00,01}; - FieldBuilder^ myFieldBuilder = - myModuleBuilder->DefineInitializedData( "MyField", temp0, - (FieldAttributes)(FieldAttributes::Static | FieldAttributes::Public) ); - myModuleBuilder->CreateGlobalFunctions(); - // - } - - property AssemblyBuilder^ MyAssembly - { - AssemblyBuilder^ get() - { - return this->myAssemblyBuilder; - } - } -}; - -int main() -{ - CodeGenerator^ myGenerator = gcnew CodeGenerator; - AssemblyBuilder^ myAssembly = myGenerator->MyAssembly; - ModuleBuilder^ myBuilder = myAssembly->GetDynamicModule( "TempModule" ); - FieldInfo^ myInfo = myBuilder->GetField( "MyField" ); - Console::WriteLine( "The name of the initialized data field is :" + myInfo->Name ); - Console::WriteLine( "The object having the field value is :" + myInfo->GetValue( myBuilder ) ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp deleted file mode 100644 index 3e81dcf0345..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// System.Reflection.Emit.ModuleBuilder.DefinePInvokeMethod(String,String,MethodAttributes, -// CallingConventions,Type,Type[],CallingConvention,CharSet) -/* - The following example demonstrates that DefinePInvokeMethod doesn't work unless you - add a DLLImportAttribute...which you can do just as well with DefineGlobalMethod. - -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; - -const int MB_RETRYCANCEL = 5; - -void main() -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName("TempAssembly"); - - // Define a dynamic assembly in the current application domain. - AssemblyBuilder^ myAssemblyBuilder = - AppDomain::CurrentDomain->DefineDynamicAssembly( - myAssemblyName, AssemblyBuilderAccess::Run); - - // Define a dynamic module in "TempAssembly" assembly. - ModuleBuilder^ myModuleBuilder = - myAssemblyBuilder->DefineDynamicModule("TempModule"); - - array^ paramTypes = - { int::typeid, String::typeid, String::typeid, int::typeid }; - - // Define a PInvoke method. - MethodBuilder^ piMethodBuilder = myModuleBuilder->DefinePInvokeMethod( - "MessageBoxA", - "user32.dll", - MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::PinvokeImpl, - CallingConventions::Standard, - int::typeid, - paramTypes, - CallingConvention::Winapi, - CharSet::Ansi); - - // Add PreserveSig to the method implementation flags. NOTE: If this line - // is commented out, the return value will be zero when the method is - // invoked. - piMethodBuilder->SetImplementationFlags( - piMethodBuilder->GetMethodImplementationFlags() | MethodImplAttributes::PreserveSig); - - // Create global methods. - myModuleBuilder->CreateGlobalFunctions(); - - // Arguments for calling the method. - array^ arguments = - { (Object^)(int) 0, "Hello World", "Title", MB_RETRYCANCEL }; - - MethodInfo^ pinvokeMethod = myModuleBuilder->GetMethod("MessageBoxA"); - Console::WriteLine("Testing module-level PInvoke method created with DefinePInvokeMethod..."); - Console::WriteLine("Message box returned: {0}", - pinvokeMethod->Invoke(nullptr, arguments)); -}; - - -/* This code example produces input similar to the following: - -Testing module-level PInvoke method created with DefinePInvokeMethod... -Message box returned: 4 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp deleted file mode 100644 index 8cbc472c421..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// System::Reflection::Emit::ModuleBuilder.DefineResource(String, String) -/* -The following example demonstrates the 'DefineResource(String, String)' method -of 'ModuleBuilder' class. -A dynamic assembly with a module in it is created in 'CodeGenerator' class. -Then a managed resource is defined in the module using the 'DefineResource' -method. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Resources; -public ref class CodeGenerator -{ -public: - CodeGenerator() - { - - // Get the current application domain for the current thread. - AppDomain^ currentDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define 'TempAssembly' assembly in the current application domain. - AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Define 'TempModule' module in 'TempAssembly' assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "TempModule.netmodule", true ); - - // Define the managed embedded resource, 'MyResource' in 'TempModule'. - IResourceWriter^ myResourceWriter = myModuleBuilder->DefineResource( "MyResource.resource", "Description" ); - - // Add resources to the resource writer. - myResourceWriter->AddResource( "String 1", "First String" ); - myResourceWriter->AddResource( "String 2", "Second String" ); - myResourceWriter->AddResource( "String 3", "Third String" ); - myAssemblyBuilder->Save( "MyAssembly.dll" ); - } - -}; - -int main() -{ - CodeGenerator^ myGenerator = gcnew CodeGenerator; - Console::WriteLine( "A resource named 'MyResource.resource' has been created and can be viewed in the 'MyAssembly.dll'" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp deleted file mode 100644 index 5caa523989d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// System::Reflection::Emit::ModuleBuilder.DefineResource(String, String, ResourceAttributes) -/* -The following example demonstrates the 'DefineResource(String, String, ResourceAttributes)' -method of 'ModuleBuilder' class. -A dynamic assembly with a module in it is created in 'CodeGenerator' class. -Then a managed resource is defined in the module using the 'DefineResource' method. -*/ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Resources; -public ref class CodeGenerator -{ -public: - CodeGenerator() - { - - // Get the current application domain for the current thread. - AppDomain^ currentDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define 'TempAssembly' assembly in the current application domain. - AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Define 'TempModule' module in 'TempAssembly' assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "TempModule.netmodule", true ); - - // Define the managed embedded resource, 'MyResource' in 'TempModule' - // with the specified attribute. - IResourceWriter^ writer = myModuleBuilder->DefineResource( "MyResource.resource", "Description", ResourceAttributes::Public ); - - // Add resources to the resource writer. - writer->AddResource( "String 1", "First String" ); - writer->AddResource( "String 2", "Second String" ); - writer->AddResource( "String 3", "Third String" ); - myAssemblyBuilder->Save( "MyAssembly.dll" ); - } - -}; - -int main() -{ - CodeGenerator^ myGenerator = gcnew CodeGenerator; - Console::WriteLine( "A resource named 'MyResource::resource' has been created and can be viewed in the 'MyAssembly.dll'" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp deleted file mode 100644 index 574e5fa1686..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// System.Reflection.Emit.ModuleBuilder.GetArrayMethod -// System.Reflection.Emit.ModuleBuilder.GetArrayMethodToken - -/* -The following example demonstrates 'GetArrayMethod' and 'GetArrayMethodToken' -methods of 'ModuleBuilder' class. -A dynamic assembly with a module having a runtime class, 'TempClass' is created. -This class defines a method, 'SortArray', which sorts the elements of the array -passed to it. The 'GetArrayMethod' method is used to obtain the 'MethodInfo' object -corresponding to the 'Sort' method of the 'Array'. The token used to identify the 'Sort' -method in dynamic module is displayed using 'GetArrayMethodToken' method. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class CodeGenerator -{ -private: - AssemblyBuilder^ myAssemblyBuilder; - -public: - CodeGenerator() - { - AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "TempAssembly"; - - // Define a dynamic assembly in the current application domain. - myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - -// -// - // Define a dynamic module in "TempAssembly" assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder-> - DefineDynamicModule( "TempModule" ); - - // Define a runtime class with specified name and attributes. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( - "TempClass", TypeAttributes::Public ); - array^ paramArray = { Array::typeid }; - // Add 'SortArray' method to the class, with the given signature. - MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "SortArray", - MethodAttributes::Public, Array::typeid, paramArray ); - - array^ myArrayClass = gcnew array( 1 ); - array^ parameterTypes = { Array::typeid }; - // Get the 'MethodInfo' object corresponding to 'Sort' method of 'Array' class. - MethodInfo^ myMethodInfo = myModuleBuilder->GetArrayMethod( - myArrayClass->GetType(), "Sort", CallingConventions::Standard, - nullptr, parameterTypes ); - - // Get the token corresponding to 'Sort' method of 'Array' class. - MethodToken myMethodToken = myModuleBuilder->GetArrayMethodToken( - myArrayClass->GetType(), "Sort", CallingConventions::Standard, - nullptr, parameterTypes ); - Console::WriteLine( "Token used by module to identify the 'Sort' method" - + " of 'Array' class is : {0:x} ", myMethodToken.Token ); - - ILGenerator^ methodIL = myMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldarg_1 ); - methodIL->Emit( OpCodes::Call, myMethodInfo ); - methodIL->Emit( OpCodes::Ldarg_1 ); - methodIL->Emit( OpCodes::Ret ); - - // Complete the creation of type. - myTypeBuilder->CreateType(); - // - // - } - - property AssemblyBuilder^ MyBuilder - { - AssemblyBuilder^ get() - { - return this->myAssemblyBuilder; - } - } -}; - -int main() -{ - CodeGenerator^ myCodeGenerator = gcnew CodeGenerator; - AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyBuilder; - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder-> - GetDynamicModule( "TempModule" ); - Type^ myType = myModuleBuilder->GetType( "TempClass" ); - Object^ myObject = Activator::CreateInstance( myType ); - MethodInfo^ sortArray = myType->GetMethod( "SortArray" ); - if ( nullptr != sortArray ) - { - array^ arrayToSort = {"I","am","not","sorted"}; - Console::WriteLine( "Array elements before sorting " ); - for ( int i = 0; i < arrayToSort->Length; i++ ) - { - Console::WriteLine( "Array element {0} : {1} ", i, arrayToSort[ i ] ); - } - array^arguments = {arrayToSort}; - Console::WriteLine( "Invoking our dynamically " - + "created SortArray method..." ); - Object^ myOutput = sortArray->Invoke( myObject, arguments ); - array^ mySortedArray = ( array^ )myOutput; - Console::WriteLine( "Array elements after sorting " ); - for ( int i = 0; i < mySortedArray->Length; i++ ) - { - Console::WriteLine( "Array element {0} : {1} ", i, mySortedArray[ i ] ); - } - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp b/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp deleted file mode 100644 index b45d3fbc13a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp +++ /dev/null @@ -1,331 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Threading; -using namespace System::Collections::Generic; -using namespace System::Text; - -generic public ref class SafeQueue -{ -private: - // - // - // A queue that is protected by Monitor. - Queue^ m_inputQueue; - // - -public: - SafeQueue() - { - m_inputQueue = gcnew Queue(); - }; - - // Lock the queue and add an element. - void Enqueue(T qValue) - { - // Request the lock, and block until it is obtained. - Monitor::Enter(m_inputQueue); - try - { - // When the lock is obtained, add an element. - m_inputQueue->Enqueue(qValue); - } - finally - { - // Ensure that the lock is released. - Monitor::Exit(m_inputQueue); - } - }; - // - - // - // Try to add an element to the queue: Add the element to the queue - // only if the lock is immediately available. - bool TryEnqueue(T qValue) - { - // Request the lock. - if (Monitor::TryEnter(m_inputQueue)) - { - try - { - m_inputQueue->Enqueue(qValue); - } - finally - { - // Ensure that the lock is released. - Monitor::Exit(m_inputQueue); - } - return true; - } - else - { - return false; - } - }; - // - - // - // Try to add an element to the queue: Add the element to the queue - // only if the lock becomes available during the specified time - // interval. - bool TryEnqueue(T qValue, int waitTime) - { - // Request the lock. - if (Monitor::TryEnter(m_inputQueue, waitTime)) - { - try - { - m_inputQueue->Enqueue(qValue); - } - finally - { - // Ensure that the lock is released. - Monitor::Exit(m_inputQueue); - } - return true; - } - else - { - return false; - } - }; - // - - // Lock the queue and dequeue an element. - T Dequeue() - { - T retval; - - // Request the lock, and block until it is obtained. - Monitor::Enter(m_inputQueue); - try - { - // When the lock is obtained, dequeue an element. - retval = m_inputQueue->Dequeue(); - } - finally - { - // Ensure that the lock is released. - Monitor::Exit(m_inputQueue); - } - - return retval; - }; - - // Delete all elements that equal the given object. - int Remove(T qValue) - { - int removedCt = 0; - - // Wait until the lock is available and lock the queue. - Monitor::Enter(m_inputQueue); - try - { - int counter = m_inputQueue->Count; - while (counter > 0) - // Check each element. - { - T elem = m_inputQueue->Dequeue(); - if (!elem->Equals(qValue)) - { - m_inputQueue->Enqueue(elem); - } - else - { - // Keep a count of items removed. - removedCt += 1; - } - counter = counter - 1; - } - } - finally - { - // Ensure that the lock is released. - Monitor::Exit(m_inputQueue); - } - - return removedCt; - }; - - // Print all queue elements. - String^ PrintAllElements() - { - StringBuilder^ output = gcnew StringBuilder(); - - // Lock the queue. - Monitor::Enter(m_inputQueue); - try - { - for each ( T elem in m_inputQueue ) - { - // Print the next element. - output->AppendLine(elem->ToString()); - } - } - finally - { - // Ensure that the lock is released. - Monitor::Exit(m_inputQueue); - } - - return output->ToString(); - }; -}; - -public ref class Example -{ -private: - static SafeQueue^ q = gcnew SafeQueue(); - static int threadsRunning = 0; - static array^>^ results = gcnew array^>(3); - - static void ThreadProc(Object^ state) - { - DateTime finish = DateTime::Now.AddSeconds(10); - Random^ rand = gcnew Random(); - array^ result = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - int threadNum = (int) state; - - while (DateTime::Now < finish) - - { - int what = rand->Next(250); - int how = rand->Next(100); - - if (how < 16) - { - q->Enqueue(what); - result[(int)ThreadResultIndex::EnqueueCt] += 1; - } - else if (how < 32) - { - if (q->TryEnqueue(what)) - { - result[(int)ThreadResultIndex::TryEnqueueSucceedCt] += 1; - } - else - { - result[(int)ThreadResultIndex::TryEnqueueFailCt] += 1; - } - } - else if (how < 48) - { - // Even a very small wait significantly increases the success - // rate of the conditional enqueue operation. - if (q->TryEnqueue(what, 10)) - { - result[(int)ThreadResultIndex::TryEnqueueWaitSucceedCt] += 1; - } - else - { - result[(int)ThreadResultIndex::TryEnqueueWaitFailCt] += 1; - } - } - else if (how < 96) - { - result[(int)ThreadResultIndex::DequeueCt] += 1; - try - { - q->Dequeue(); - } - catch (Exception^ ex) - { - result[(int)ThreadResultIndex::DequeueExCt] += 1; - } - } - else - { - result[(int)ThreadResultIndex::RemoveCt] += 1; - result[(int)ThreadResultIndex::RemovedCt] += q->Remove(what); - } - } - - results[threadNum] = result; - - if (0 == Interlocked::Decrement(threadsRunning)) - { - StringBuilder^ sb = gcnew StringBuilder( - " Thread 1 Thread 2 Thread 3 Total\n"); - - for (int row = 0; row < 9; row++) - { - int total = 0; - sb->Append(titles[row]); - - for(int col = 0; col < 3; col++) - { - sb->Append(String::Format("{0,9}", results[col][row])); - total += results[col][row]; - } - - sb->AppendLine(String::Format("{0,9}", total)); - } - - Console::WriteLine(sb->ToString()); - } - }; - - static array^ titles = { - "Enqueue ", - "TryEnqueue succeeded ", - "TryEnqueue failed ", - "TryEnqueue(T, wait) succeeded ", - "TryEnqueue(T, wait) failed ", - "Dequeue attempts ", - "Dequeue exceptions ", - "Remove operations ", - "Queue elements removed "}; - - enum class ThreadResultIndex - { - EnqueueCt, - TryEnqueueSucceedCt, - TryEnqueueFailCt, - TryEnqueueWaitSucceedCt, - TryEnqueueWaitFailCt, - DequeueCt, - DequeueExCt, - RemoveCt, - RemovedCt - }; - -public: - static void Demo() - { - Console::WriteLine("Working..."); - - for(int i = 0; i < 3; i++) - { - Thread^ t = gcnew Thread(gcnew ParameterizedThreadStart(Example::ThreadProc)); - t->Start(i); - Interlocked::Increment(threadsRunning); - } - }; -}; - -void main() -{ - Example::Demo(); -} - - -/* This example produces output similar to the following: - -Working... - Thread 1 Thread 2 Thread 3 Total -Enqueue 274718 513514 337895 1126127 -TryEnqueue succeeded 274502 513516 337480 1125498 -TryEnqueue failed 119 235 141 495 -TryEnqueue(T, wait) succeeded 274552 513116 338532 1126200 -TryEnqueue(T, wait) failed 0 1 0 1 -Dequeue attempts 824038 1541866 1015006 3380910 -Dequeue exceptions 12828 23416 14799 51043 -Remove operations 68746 128218 84306 281270 -Queue elements removed 11464 22024 14470 47958 -Queue elements removed 2921 4690 2982 10593 - */ -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp b/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp deleted file mode 100644 index 0017618eb8d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -ref class StringContainer -{ -private: - // A generic list object that holds the strings. - List^ container = gcnew List; - -public: - // Define a delegate to handle string display. - delegate void CheckAndDisplayDelegate(String^ str); - - // A method that adds more strings to the collection. - void AddString(String^ str) - { - container->Add(str); - } - - // Iterate through the strings and invoke the method(s) that the delegate points to. - void DisplayAllQualified(CheckAndDisplayDelegate^ displayDelegate) - { - for each (String^ str in container) - displayDelegate(str); -// System::Collections::IEnumerator^ myEnum = container->GetEnumerator(); -// while ( myEnum->MoveNext() ) -// { -// String^ str = safe_cast(myEnum->Current); -// displayDelegate(str); -// } - } -}; - -//end of class StringContainer -// This class contains a few sample methods -ref class StringFuncs -{ -public: - - // This method prints a String* that it is passed if the String* starts with a vowel - static void ConStart(String^ str) - { - if ( !(str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') ) - Console::WriteLine( str ); - } - - // This method prints a String* that it is passed if the String* starts with a consonant - static void VowelStart( String^ str ) - { - if ( (str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') ) - Console::WriteLine( str ); - } -}; - -// This function demonstrates using Delegates, including using the Remove and -// Combine methods to create and modify delegate combinations. -int main() -{ - // Declare the StringContainer class and add some strings - StringContainer^ container = gcnew StringContainer; - container->AddString( "This" ); - container->AddString( "is" ); - container->AddString( "a" ); - container->AddString( "multicast" ); - container->AddString( "delegate" ); - container->AddString( "example" ); - -// RETURN HERE. - // Create two delegates individually using different methods - StringContainer::CheckAndDisplayDelegate^ conStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::ConStart ); - StringContainer::CheckAndDisplayDelegate^ vowelStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::VowelStart ); - - // Get the list of all delegates assigned to this MulticastDelegate instance. - array^ delegateList = conStart->GetInvocationList(); - Console::WriteLine("conStart contains {0} delegate(s).", delegateList->Length); - delegateList = vowelStart->GetInvocationList(); - Console::WriteLine("vowelStart contains {0} delegate(s).\n", delegateList->Length ); - - // Determine whether the delegates are System::Multicast delegates - if ( dynamic_cast(conStart) && dynamic_cast(vowelStart) ) - { - Console::WriteLine("conStart and vowelStart are derived from MulticastDelegate.\n"); - } - - // Execute the two delegates. - Console::WriteLine("Executing the conStart delegate:" ); - container->DisplayAllQualified(conStart); - Console::WriteLine(); - Console::WriteLine("Executing the vowelStart delegate:" ); - container->DisplayAllQualified(vowelStart); - - // Create a new MulticastDelegate and call Combine to add two delegates. - StringContainer::CheckAndDisplayDelegate^ multipleDelegates = - dynamic_cast(Delegate::Combine(conStart, vowelStart)); - - // How many delegates does multipleDelegates contain? - delegateList = multipleDelegates->GetInvocationList(); - Console::WriteLine("\nmultipleDelegates contains {0} delegates.\n", - delegateList->Length ); - - // // Pass this multicast delegate to DisplayAllQualified. - Console::WriteLine("Executing the multipleDelegate delegate."); - container->DisplayAllQualified(multipleDelegates); - // Call remove and combine to change the contained delegates. - multipleDelegates = dynamic_cast - (Delegate::Remove(multipleDelegates, vowelStart)); - multipleDelegates = dynamic_cast - (Delegate::Combine(multipleDelegates, conStart)); - - // Pass multipleDelegates to DisplayAllQualified again. - Console::WriteLine("\nExecuting the multipleDelegate delegate with two conStart delegates:"); - container->DisplayAllQualified(multipleDelegates); -} -// The example displays the following output: -// conStart contains 1 delegate(s). -// vowelStart contains 1 delegate(s). -// -// conStart and vowelStart are derived from MulticastDelegate. -// -// Executing the conStart delegate: -// This -// multicast -// delegate -// -// Executing the vowelStart delegate: -// is -// a -// example -// -// -// multipleDelegates contains 2 delegates. -// -// Executing the multipleDelegate delegate. -// This -// is -// a -// multicast -// delegate -// example -// -// Executing the multipleDelegate delegate with two conStart delegates: -// This -// This -// multicast -// multicast -// delegate -// delegate -// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp deleted file mode 100644 index 4836a5745f6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// The following code example demonstrates the effect of changing the NumberDecimalDigits property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a negative value with the default number of decimal digits (2). - Int64 myInt = -1234; - Console::WriteLine( myInt.ToString( "N", nfi ) ); - - // Displays the same value with four decimal digits. - nfi->NumberDecimalDigits = 4; - Console::WriteLine( myInt.ToString( "N", nfi ) ); -} - -/* -This code produces the following output. --1, 234.00 --1, 234.0000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp deleted file mode 100644 index 3314e9eab5c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// NumberDecimalSeparator property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S"."). - Int64 myInt = 123456789; - Console::WriteLine( myInt.ToString( "N", nfi ) ); - - // Displays the same value with a blank as the separator. - nfi->NumberDecimalSeparator = " "; - Console::WriteLine( myInt.ToString( "N", nfi ) ); -} - -/* -This code produces the following output. -123, 456, 789.00 -123, 456, 789 00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp b/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp deleted file mode 100644 index 8211f6d47a8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp +++ /dev/null @@ -1,47 +0,0 @@ -//Types:System.Globalization.NumberFormatInfo -// -using namespace System; -using namespace System::Globalization; -using namespace System::Text; - -int main() -{ - StringBuilder^ builder = gcnew StringBuilder(); - - // Loop through all the specific cultures known to the CLR. - for each(CultureInfo^ culture in - CultureInfo::GetCultures (CultureTypes::SpecificCultures)) - { - // Only show the currency symbols for cultures - // that speak English. - if (culture->TwoLetterISOLanguageName == "en") - { - // - // Display the culture name and currency symbol. - NumberFormatInfo^ numberFormat = culture->NumberFormat; - builder->AppendFormat("The currency symbol for '{0}'"+ - "is '{1}'",culture->DisplayName, - numberFormat->CurrencySymbol); - builder->AppendLine(); - // - } - } - Console::WriteLine(builder); -} - -// This code produces the following output. -// -// The currency symbol for 'English (United States)' is '$' -// The currency symbol for 'English (United Kingdom)' is 'Ј' -// The currency symbol for 'English (Australia)' is '$' -// The currency symbol for 'English (Canada)' is '$' -// The currency symbol for 'English (New Zealand)' is '$' -// The currency symbol for 'English (Ireland)' is '?' -// The currency symbol for 'English (South Africa)' is 'R' -// The currency symbol for 'English (Jamaica)' is 'J$' -// The currency symbol for 'English (Caribbean)' is '$' -// The currency symbol for 'English (Belize)' is 'BZ$' -// The currency symbol for 'English (Trinidad and Tobago)' is 'TT$' -// The currency symbol for 'English (Zimbabwe)' is 'Z$' -// The currency symbol for 'English (Republic of the Philippines)' is 'Php' -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp deleted file mode 100644 index 96cb476c415..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// The following code example demonstrates the effect of changing the NumberGroupSeparator property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S", "). - Int64 myInt = 123456789; - Console::WriteLine( myInt.ToString( "N", nfi ) ); - - // Displays the same value with a blank as the separator. - nfi->NumberGroupSeparator = " "; - Console::WriteLine( myInt.ToString( "N", nfi ) ); -} - -/* -This code produces the following output. -123, 456, 789.00 -123 456 789.00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp deleted file mode 100644 index f51cb7d8d13..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example demonstrates the effect of changing the NumberGroupSizes property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S"."). - Int64 myInt = 123456789012345; - Console::WriteLine( myInt.ToString( "N", nfi ) ); - - // Displays the same value with different groupings. - array^mySizes1 = {2,3,4}; - array^mySizes2 = {2,3,0}; - nfi->NumberGroupSizes = mySizes1; - Console::WriteLine( myInt.ToString( "N", nfi ) ); - nfi->NumberGroupSizes = mySizes2; - Console::WriteLine( myInt.ToString( "N", nfi ) ); -} - -/* -This code produces the following output. -123, 456, 789, 012, 345.00 -12, 3456, 7890, 123, 45.00 -1234567890, 123, 45.00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp b/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp deleted file mode 100644 index 5fe0650df9b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp +++ /dev/null @@ -1,41 +0,0 @@ -//Types:System.Globalization.NumberStyles (enum) -// -using namespace System; -using namespace System::Text; -using namespace System::Globalization; - - -int main() -{ - // Parse the string as a hex value and display the - // value as a decimal. - String^ numberString = "A"; - int stringValue = Int32::Parse(numberString, NumberStyles::HexNumber); - Console::WriteLine("{0} in hex = {1} in decimal.", - numberString, stringValue); - - // Parse the string, allowing a leading sign, and ignoring - // leading and trailing white spaces. - numberString = " -45 "; - stringValue =Int32::Parse(numberString, NumberStyles::AllowLeadingSign | - NumberStyles::AllowLeadingWhite | NumberStyles::AllowTrailingWhite); - Console::WriteLine("'{0}' parsed to an int is '{1}'.", - numberString, stringValue); - - // Parse the string, allowing parentheses, and ignoring - // leading and trailing white spaces. - numberString = " (37) "; - stringValue = Int32::Parse(numberString, NumberStyles::AllowParentheses | - NumberStyles::AllowLeadingSign | NumberStyles::AllowLeadingWhite | - NumberStyles::AllowTrailingWhite); - - Console::WriteLine("'{0}' parsed to an int is '{1}'.", - numberString, stringValue); -} - -// This code produces the following output. -// -// A in hex = 10 in decimal. -// ' -45 ' parsed to an int is '-45'. -// ' (37) ' parsed to an int is '-37'. -// diff --git a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp b/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp deleted file mode 100644 index 90c4a5a1302..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - MemoryStream^ ms = gcnew MemoryStream( 16 ); - ms->Close(); - try - { - ms->ReadByte(); - } - catch ( ObjectDisposedException^ e ) - { - Console::WriteLine( "Caught: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp deleted file mode 100644 index 75724099841..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Collections::ObjectModel; - -public ref class Demo -{ -public: - static void Main() - { - Collection^ dinosaurs = gcnew Collection(); - - dinosaurs->Add("Psitticosaurus"); - dinosaurs->Add("Caudipteryx"); - dinosaurs->Add("Compsognathus"); - dinosaurs->Add("Muttaburrasaurus"); - - Console::WriteLine("{0} dinosaurs:", dinosaurs->Count); - Display(dinosaurs); - - Console::WriteLine("\nIndexOf(\"Muttaburrasaurus\"): {0}", - dinosaurs->IndexOf("Muttaburrasaurus")); - - Console::WriteLine("\nContains(\"Caudipteryx\"): {0}", - dinosaurs->Contains("Caudipteryx")); - - Console::WriteLine("\nInsert(2, \"Nanotyrannus\")"); - dinosaurs->Insert(2, "Nanotyrannus"); - Display(dinosaurs); - - Console::WriteLine("\ndinosaurs[2]: {0}", dinosaurs[2]); - - Console::WriteLine("\ndinosaurs[2] = \"Microraptor\""); - dinosaurs[2] = "Microraptor"; - Display(dinosaurs); - - Console::WriteLine("\nRemove(\"Microraptor\")"); - dinosaurs->Remove("Microraptor"); - Display(dinosaurs); - - Console::WriteLine("\nRemoveAt(0)"); - dinosaurs->RemoveAt(0); - Display(dinosaurs); - - Console::WriteLine("\ndinosaurs.Clear()"); - dinosaurs->Clear(); - Console::WriteLine("Count: {0}", dinosaurs->Count); - } - -private: - static void Display(Collection^ cs) - { - Console::WriteLine(); - for each( String^ item in cs ) - { - Console::WriteLine(item); - } - } -}; - -int main() -{ - Demo::Main(); -} - -/* This code example produces the following output: - -4 dinosaurs: - -Psitticosaurus -Caudipteryx -Compsognathus -Muttaburrasaurus - -IndexOf("Muttaburrasaurus"): 3 - -Contains("Caudipteryx"): True - -Insert(2, "Nanotyrannus") - -Psitticosaurus -Caudipteryx -Nanotyrannus -Compsognathus -Muttaburrasaurus - -dinosaurs[2]: Nanotyrannus - -dinosaurs[2] = "Microraptor" - -Psitticosaurus -Caudipteryx -Microraptor -Compsognathus -Muttaburrasaurus - -Remove("Microraptor") - -Psitticosaurus -Caudipteryx -Compsognathus -Muttaburrasaurus - -RemoveAt(0) - -Caudipteryx -Compsognathus -Muttaburrasaurus - -dinosaurs.Clear() -Count: 0 - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp deleted file mode 100644 index d13e56d248d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//Types:System.Object -// -using namespace System; - -// The Point class is derived from System.Object. -ref class Point -{ -public: - int x; -public: - int y; - -public: - Point(int x, int y) - { - this->x = x; - this->y = y; - } - - // -public: - virtual bool Equals(Object^ obj) override - { - // If this and obj do not refer to the same type, - // then they are not equal. - if (obj->GetType() != this->GetType()) - { - return false; - } - - // Return true if x and y fields match. - Point^ other = (Point^) obj; - return (this->x == other->x) && (this->y == other->y); - } - // - - // - // Return the XOR of the x and y fields. -public: - virtual int GetHashCode() override - { - return x ^ y; - } - // - - // - // Return the point's value as a string. -public: - virtual String^ ToString() override - { - return String::Format("({0}, {1})", x, y); - } - // - - // - // Return a copy of this point object by making a simple - // field copy. -public: - Point^ Copy() - { - return (Point^) this->MemberwiseClone(); - } - // -}; - -int main() -{ - // Construct a Point object. - Point^ p1 = gcnew Point(1, 2); - - // Make another Point object that is a copy of the first. - Point^ p2 = p1->Copy(); - - // Make another variable that references the first - // Point object. - Point^ p3 = p1; - - // - // The line below displays false because p1 and - // p2 refer to two different objects. - Console::WriteLine( - Object::ReferenceEquals(p1, p2)); - // - - // - // The line below displays true because p1 and p2 refer - // to two different objects that have the same value. - Console::WriteLine(Object::Equals(p1, p2)); - // - - // The line below displays true because p1 and - // p3 refer to one object. - Console::WriteLine(Object::ReferenceEquals(p1, p3)); - - // - // The line below displays: p1's value is: (1, 2) - Console::WriteLine("p1's value is: {0}", p1->ToString()); - // -} - -// This code produces the following output. -// -// False -// True -// True -// p1's value is: (1, 2) -// diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp deleted file mode 100644 index c2c7e1cf179..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -// This example demonstrates the OperatingSystem.ServicePack property. -using namespace System; -int main() -{ - OperatingSystem^ os = Environment::OSVersion; - String^ sp = os->ServicePack; - Console::WriteLine( "Service pack version = \"{0}\"", sp ); -} - -/* -This example produces the following results: - -Service pack version = "Service Pack 1" - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp deleted file mode 100644 index 6c87d9dff1f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -// This example demonstrates the VersionString property. -using namespace System; -int main() -{ - OperatingSystem^ os = Environment::OSVersion; - - // Display the value of OperatingSystem.VersionString. By default, this is - // the same value as OperatingSystem.ToString. - Console::WriteLine( L"This operating system is {0}", os->VersionString ); - return 0; -} - -/* -This example produces the following results: - -This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp deleted file mode 100644 index a0934b9b3d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// System::Reflection::ParameterInfo::Attributes -/* - The following example displays the attributes associated with the - parameters of the method called 'MyMethod' of class 'ParameterInfo_Example'. - */ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; -public ref class MyClass1 -{ -public: - int MyMethod( int i, [Out]short * j, long * k ) - { - *j = 2; - return 0; - } - -}; - -void main() -{ - // Get the type. - Type^ myType = MyClass1::typeid; - - // Get the method named 'MyMethod' from the type. - MethodBase^ myMethodBase = myType->GetMethod( "MyMethod" ); - - // Get the parameters associated with the method. - array^myParameters = myMethodBase->GetParameters(); - Console::WriteLine( "\nThe method {0} has the {1} parameters :", "ParameterInfo_Example::MyMethod", myParameters->Length ); - - // Print the attributes associated with each of the parameters. - for ( int i = 0; i < myParameters->Length; i++ ) - Console::WriteLine( "\tThe {0} parameter has the attribute : {1}", i + 1, myParameters[ i ]->Attributes ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp deleted file mode 100644 index 06e6497934c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// -// System::Reflection::ParameterInfo::GetCustomAttributes(Type, bool) -// System::Reflection::ParameterInfo::IsDefined(Type, bool) -using namespace System; -using namespace System::Reflection; - -// Define a custom attribute with one named parameter. -[AttributeUsage(AttributeTargets::Parameter)] -public ref class MyAttribute: public Attribute -{ -private: - String^ myName; - -public: - MyAttribute( String^ name ) - { - myName = name; - } - - property String^ Name - { - String^ get() - { - return myName; - } - } -}; - -// Derive another custom attribute from MyAttribute. -[AttributeUsage(AttributeTargets::Parameter)] -public ref class MyDerivedAttribute: public MyAttribute -{ -public: - MyDerivedAttribute( String^ name ) : MyAttribute( name ) {} -}; - -// Define a class with a method that has three parameters. Apply -// MyAttribute to one parameter, MyDerivedAttribute to another, and -// no attributes to the third. -public ref class MyClass1 -{ -public: - void MyMethod( [MyAttribute("This is an example parameter attribute")] - int i, - [MyDerivedAttribute("This is another parameter attribute")] - int j, - int k ){} -}; - -void main() -{ - // Get the type of the class 'MyClass1'. - Type^ myType = MyClass1::typeid; - - // Get the members associated with the class 'MyClass1'. - array^myMethods = myType->GetMethods(); - - // For each method of the class 'MyClass1', display all the parameters - // to which MyAttribute or its derived types have been applied. - for each ( MethodInfo^ mi in myMethods ) - { - // Get the parameters for the method. - array^ myParameters = mi->GetParameters(); - if ( myParameters->Length > 0 ) - { - Console::WriteLine("\nThe following parameters of {0} have MyAttribute or a derived type:", mi); - for each ( ParameterInfo^ pi in myParameters) - { - if (pi->IsDefined(MyAttribute::typeid, false)) - { - Console::WriteLine("Parameter {0}, name = {1}, type = {2}", - pi->Position, pi->Name, pi->ParameterType); - } - } - } - } -} - -/* This code example produces the following output: - -The following parameters of Void MyMethod(Int32, Int32, Int32) have MyAttribute or a derived type: -Parameter 0, name = i, type = System.Int32 -Parameter 1, name = j, type = System.Int32 - -The following parameters of Boolean Equals(System.Object) have MyAttribute or a derived type: - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp deleted file mode 100644 index f864dfbd878..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Define a custom attribute with one named parameter. -[AttributeUsage(AttributeTargets::Parameter)] -public ref class MyAttribute: public Attribute -{ -private: - String^ myName; - -public: - MyAttribute( String^ name ) - { - myName = name; - } - - property String^ Name - { - String^ get() - { - return myName; - } - } -}; - -// Define a class which has a custom attribute associated with one of the -// parameters of a method. -public ref class MyClass1 -{ -public: - void MyMethod( - [MyAttribute("This is an example parameter attribute")] - int i ) {} -}; - -void main() -{ - // Get the type of the class 'MyClass1'. - Type^ myType = MyClass1::typeid; - - // Get the members associated with the class 'MyClass1'. - array^myMethods = myType->GetMethods(); - - // Display the attributes for each of the parameters of each method of the class 'MyClass1'. - for ( int i = 0; i < myMethods->Length; i++ ) - { - // Get the parameters for the method. - array^myParameters = myMethods[ i ]->GetParameters(); - - if ( myParameters->Length > 0 ) - { - Console::WriteLine( "\nThe parameters for the method \"{0}\" that have custom attributes are:", myMethods[ i ] ); - for ( int j = 0; j < myParameters->Length; j++ ) - { - // Get the attributes of type 'MyAttribute' for each parameter. - array^myAttributes = myParameters[ j ]->GetCustomAttributes( MyAttribute::typeid, false ); - - if ( myAttributes->Length > 0 ) - { - Console::WriteLine( "Parameter {0}, name = {1}, type = {2} has attributes:", - myParameters[ j ]->Position, - myParameters[ j ]->Name, - myParameters[ j ]->ParameterType ); - for ( int k = 0; k < myAttributes->Length; k++ ) - { - Console::WriteLine( "\t{0}", myAttributes[ k ] ); - } - } - } - } - } -} -/* This code example produces the following output: - -The parameters for the method Void MyMethod(Int32) that have custom attributes are : -Parameter 0, name = i, type = System.Int32 has attributes: - MyAttribute - -The parameters for the method Boolean Equals(System.Object) that have custom attributes are : - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp deleted file mode 100644 index c568d6441a6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp +++ /dev/null @@ -1,103 +0,0 @@ - -// System::Reflection::ParameterInfo::IsIn -// System::Reflection::ParameterInfo::IsOptional -// System::Reflection::ParameterInfo::IsOut -/* -The following program creates a dynamic assembly named 'MyAssembly', defines a -module named 'MyModule' within the assembly. It defines a type called 'MyType' -within the module and also defines a static method named 'MyMethod' for the -type. This dynamic assembly is then queried for the type defined within it and -then the attributes of all the parameters of the method named 'MyMethod' is -displayed. -*/ -// -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Threading; -using namespace System::Reflection::Emit; -void DefineMethod() -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "MyAssembly"; - - // Get the assembly builder from the application domain associated with the current thread. - AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - - // Create a dynamic module in the assembly. - ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", "MyAssembly.dll" ); - - // Create a type in the module. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); - - // Create a method called MyMethod. - array^type1 = {int::typeid,short::typeid,long::typeid}; - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), String::typeid, type1 ); - - // Set the attributes for the parameters of the method. - // Set the attribute for the first parameter to IN. - ParameterBuilder^ myParameterBuilder = myMethodBuilder->DefineParameter( 1, ParameterAttributes::In, "MyIntParameter" ); - - // Set the attribute for the second parameter to OUT. - myParameterBuilder = myMethodBuilder->DefineParameter( 2, ParameterAttributes::Out, "MyShortParameter" ); - - // Set the attribute for the third parameter to OPTIONAL. - myParameterBuilder = myMethodBuilder->DefineParameter( 3, static_cast(ParameterAttributes::Optional | ParameterAttributes::HasDefault), "MyLongParameter" ); - - // Get the Microsoft Intermediate Language generator for the method. - ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); - - // Use the utility method to generate the MSIL instructions that print a String* to the console. - myILGenerator->EmitWriteLine( "Hello World!" ); - - // Generate the S"ret" MSIL instruction. - myILGenerator->Emit( OpCodes::Ret ); - - // End the creation of the type. - myTypeBuilder->CreateType(); -} - -int main() -{ - // Create a dynamic assembly with a type named MyType. - DefineMethod(); - - // Get the assemblies currently loaded in the application domain. - array^myAssemblies = Thread::GetDomain()->GetAssemblies(); - Assembly^ myAssembly = nullptr; - - // Get the assembly named MyAssembly. - for ( int i = 0; i < myAssemblies->Length; i++ ) - if ( String::Compare( myAssemblies[ i ]->GetName( false )->Name, "MyAssembly" ) == 0 ) - myAssembly = myAssemblies[ i ]; - - if ( myAssembly != nullptr ) - { - // Get a type named MyType. - Type^ myType = myAssembly->GetType( "MyType" ); - - // Get a method named MyMethod from the type. - MethodBase^ myMethodBase = myType->GetMethod( "MyMethod" ); - - // Get the parameters associated with the method. - array^myParameters = myMethodBase->GetParameters(); - Console::WriteLine( "\nThe method {0} has the {1} parameters :", myMethodBase, myParameters->Length ); - - // Print the IN, OUT and OPTIONAL attributes associated with each of the parameters. - for ( int i = 0; i < myParameters->Length; i++ ) - { - if ( myParameters[ i ]->IsIn ) - Console::WriteLine( "\tThe {0} parameter has the In attribute", i + 1 ); - if ( myParameters[ i ]->IsOptional ) - Console::WriteLine( "\tThe {0} parameter has the Optional attribute", i + 1 ); - if ( myParameters[ i ]->IsOut ) - Console::WriteLine( "\tThe {0} parameter has the Out attribute", i + 1 ); - } - } - else - Console::WriteLine( "Could not find a assembly named 'MyAssembly' for the current application domain" ); -} -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp b/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp deleted file mode 100644 index 08709a04488..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path1 = "c:\\temp\\MyTest.txt"; - String^ path2 = "c:\\temp\\MyTest"; - String^ path3 = "temp"; - if ( Path::HasExtension( path1 ) ) - { - Console::WriteLine( "{0} has an extension.", path1 ); - } - - if ( !Path::HasExtension( path2 ) ) - { - Console::WriteLine( "{0} has no extension.", path2 ); - } - - if ( !Path::IsPathRooted( path3 ) ) - { - Console::WriteLine( "The string {0} contains no root information.", path3 ); - } - - Console::WriteLine( "The full path of {0} is {1}.", path3, Path::GetFullPath( path3 ) ); - Console::WriteLine( "{0} is the location for temporary files.", Path::GetTempPath() ); - Console::WriteLine( "{0} is a file available for use.", Path::GetTempFileName() ); - Console::WriteLine( "\r\nThe set of invalid characters in a path is:" ); - Console::WriteLine( "(Note that the wildcard characters '*' and '?' are not invalid.):" ); - Collections::IEnumerator^ myEnum = Path::InvalidPathChars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = *safe_cast(myEnum->Current); - Console::WriteLine( c ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp deleted file mode 100644 index 331d7abbb90..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// The following code example demonstrates the effect of changing the PercentDecimalDigits property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a negative value with the default number of decimal digits (2). - Double myInt = 0.1234; - Console::WriteLine( myInt.ToString( "P", nfi ) ); - - // Displays the same value with four decimal digits. - nfi->PercentDecimalDigits = 4; - Console::WriteLine( myInt.ToString( "P", nfi ) ); -} - -/* -This code produces the following output. -12.34 % -12.3400 % -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp deleted file mode 100644 index de975569dfb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// PercentDecimalSeparator property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S"."). - Double myInt = 0.1234; - Console::WriteLine( myInt.ToString( "P", nfi ) ); - - // Displays the same value with a blank as the separator. - nfi->PercentDecimalSeparator = " "; - Console::WriteLine( myInt.ToString( "P", nfi ) ); -} - -/* -This code produces the following output. -12.34 % -12 34 % -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp deleted file mode 100644 index 39d7c7a20ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// The following code example demonstrates the effect of changing the -// PercentGroupSeparator property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S", "). - Double myInt = 1234.5678; - Console::WriteLine( myInt.ToString( "P", nfi ) ); - - // Displays the same value with a blank as the separator. - nfi->PercentGroupSeparator = " "; - Console::WriteLine( myInt.ToString( "P", nfi ) ); -} - -/* -This code produces the following output. -123, 456.78 % -123 456.78 % -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp deleted file mode 100644 index 2edc2ec4edf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// The following code example demonstrates the effect of changing the PercentGroupSizes property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets a NumberFormatInfo associated with the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - NumberFormatInfo^ nfi = MyCI->NumberFormat; - - // Displays a value with the default separator (S"."). - Double myInt = 123456789012345.6789; - Console::WriteLine( myInt.ToString( "P", nfi ) ); - - // Displays the same value with different groupings. - array^mySizes1 = {2,3,4}; - array^mySizes2 = {2,3,0}; - nfi->PercentGroupSizes = mySizes1; - Console::WriteLine( myInt.ToString( "P", nfi ) ); - nfi->PercentGroupSizes = mySizes2; - Console::WriteLine( myInt.ToString( "P", nfi ) ); -} - -/* -This code produces the following output. - -12, 345, 678, 901, 234, 600.00 % -1234, 5678, 9012, 346, 00.00 % -123456789012, 346, 00.00 % -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp b/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp deleted file mode 100644 index ec0c28aeb8c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Diagnostics; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - PerformanceCounter^ PC = gcnew PerformanceCounter; - PC->CategoryName = "Process"; - PC->CounterName = "Private Bytes"; - PC->InstanceName = "Explorer"; - MessageBox::Show( PC->NextValue().ToString() ); - // - - // - Array^ PerfCat = PerformanceCounterCategory::GetCategories(); - MessageBox::Show( String::Concat( "The number of performance counter categories in the local machine is ", PerfCat->Length ) ); - // - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -//Output: -//11.11 % -//11.11 Percent diff --git a/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp b/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp deleted file mode 100644 index 9cdd3a26593..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - - // - if ( !PerformanceCounterCategory::Exists( "Orders" ) ) - { - CounterCreationData^ milk = gcnew CounterCreationData; - milk->CounterName = "milk"; - milk->CounterType = PerformanceCounterType::NumberOfItems32; - - CounterCreationData^ milkPerSecond = gcnew CounterCreationData; - milkPerSecond->CounterName = "milk orders/second"; - milkPerSecond->CounterType = PerformanceCounterType::RateOfCountsPerSecond32; - - CounterCreationDataCollection^ ccds = gcnew CounterCreationDataCollection; - ccds->Add( milkPerSecond ); - ccds->Add( milk ); - PerformanceCounterCategory::Create( "Orders", "Number of processed orders", ccds ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp deleted file mode 100644 index fe5c4b92d7c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// cpp.cpp : main project file. -// System::Diagnostics.PerformanceCounterInstaller -/* -The following example demonstrates 'PerformanceCounterInstaller' class. -A class is inherited from 'Installer' having 'RunInstallerAttribute' set to true. -A new instance of 'PerformanceCounterInstaller' is created and its 'CategoryName' -is set. Then this instance is added to 'InstallerCollection'. -Note: -1)To run this example use the following command: -InstallUtil::exe PerformanceCounterInstaller::exe -2)To uninstall the perfomance counter use the following command: -InstallUtil::exe /u PerformanceCounterInstaller::exe -*/ -// -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Diagnostics; -using namespace System::ComponentModel; - -[RunInstaller(true)] -ref class MyPerformanceCounterInstaller: public Installer -{ -public: - MyPerformanceCounterInstaller() - { - try - { - // Create an instance of 'PerformanceCounterInstaller'. - PerformanceCounterInstaller^ myPerformanceCounterInstaller = - gcnew PerformanceCounterInstaller; - // Set the 'CategoryName' for performance counter. - myPerformanceCounterInstaller->CategoryName = - "MyPerformanceCounter"; - CounterCreationData^ myCounterCreation = gcnew CounterCreationData; - myCounterCreation->CounterName = "MyCounter"; - myCounterCreation->CounterHelp = "Counter Help"; - // Add a counter to collection of myPerformanceCounterInstaller. - myPerformanceCounterInstaller->Counters->Add( myCounterCreation ); - Installers->Add( myPerformanceCounterInstaller ); - } - catch ( Exception^ e ) - { - this->Context->LogMessage( "Error occurred : " + e->Message ); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp deleted file mode 100644 index f51c915deba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Diagnostics; - -// Output information about the counter sample. -void OutputSample( CounterSample s ) -{ - Console::WriteLine( "\r\n+++++++++++" ); - Console::WriteLine( "Sample values - \r\n" ); - Console::WriteLine( " BaseValue = {0}", s.BaseValue ); - Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency ); - Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp ); - Console::WriteLine( " CounterType = {0}", s.CounterType ); - Console::WriteLine( " RawValue = {0}", s.RawValue ); - Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency ); - Console::WriteLine( " TimeStamp = {0}", s.TimeStamp ); - Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec ); - Console::WriteLine( "++++++++++++++++++++++" ); -} - -//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++ -// Description - This counter type shows how many items are processed, on average, -// during an operation. Counters of this type display a ratio of the items -// processed (such as bytes sent) to the number of operations completed. The -// ratio is calculated by comparing the number of items processed during the -// last interval to the number of operations completed during the last interval. -// Generic type - Average -// Formula - (N1 - N0) / (D1 - D0), where the numerator (N) represents the number -// of items processed during the last sample interval and the denominator (D) -// represents the number of operations completed during the last two sample -// intervals. -// Average (Nx - N0) / (Dx - D0) -// Example PhysicalDisk\ Avg. Disk Bytes/Transfer -//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++ -float MyComputeCounterValue( CounterSample s0, CounterSample s1 ) -{ - float numerator = (float)s1.RawValue - (float)s0.RawValue; - float denomenator = (float)s1.BaseValue - (float)s0.BaseValue; - float counterValue = numerator / denomenator; - return counterValue; -} - -bool SetupCategory() -{ - if ( !PerformanceCounterCategory::Exists( "AverageCounter64SampleCategory" ) ) - { - CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection; - - // Add the counter. - CounterCreationData^ averageCount64 = gcnew CounterCreationData; - averageCount64->CounterType = PerformanceCounterType::AverageCount64; - averageCount64->CounterName = "AverageCounter64Sample"; - CCDC->Add( averageCount64 ); - - // Add the base counter. - CounterCreationData^ averageCount64Base = gcnew CounterCreationData; - averageCount64Base->CounterType = PerformanceCounterType::AverageBase; - averageCount64Base->CounterName = "AverageCounter64SampleBase"; - CCDC->Add( averageCount64Base ); - - // Create the category. - PerformanceCounterCategory::Create( "AverageCounter64SampleCategory", "Demonstrates usage of the AverageCounter64 performance counter type.", CCDC ); - return (true); - } - else - { - Console::WriteLine( "Category exists - AverageCounter64SampleCategory" ); - return (false); - } -} - -void CreateCounters( PerformanceCounter^% PC, PerformanceCounter^% BPC ) -{ - - // Create the counters. - // - PC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64Sample",false ); - // - - BPC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64SampleBase",false ); - PC->RawValue = 0; - BPC->RawValue = 0; -} -// -void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC, PerformanceCounter^ BPC ) -{ - Random^ r = gcnew Random( DateTime::Now.Millisecond ); - - // Loop for the samples. - for ( int j = 0; j < 100; j++ ) - { - int value = r->Next( 1, 10 ); - Console::Write( "{0} = {1}", j, value ); - PC->IncrementBy( value ); - BPC->Increment(); - if ( (j % 10) == 9 ) - { - OutputSample( PC->NextSample() ); - samplesList->Add( PC->NextSample() ); - } - else - Console::WriteLine(); - System::Threading::Thread::Sleep( 50 ); - } -} -// - -void CalculateResults( ArrayList^ samplesList ) -{ - for ( int i = 0; i < (samplesList->Count - 1); i++ ) - { - // Output the sample. - OutputSample( *safe_cast(samplesList[ i ]) ); - OutputSample( *safe_cast(samplesList[ i + 1 ]) ); - - // Use .NET to calculate the counter value. - Console::WriteLine( ".NET computed counter value = {0}", CounterSampleCalculator::ComputeCounterValue( *safe_cast(samplesList[ i ]), *safe_cast(samplesList[ i + 1 ]) ) ); - - // Calculate the counter value manually. - Console::WriteLine( "My computed counter value = {0}", MyComputeCounterValue( *safe_cast(samplesList[ i ]), *safe_cast(samplesList[ i + 1 ]) ) ); - } -} - -int main() -{ - ArrayList^ samplesList = gcnew ArrayList; - PerformanceCounter^ PC; - PerformanceCounter^ BPC; - SetupCategory(); - CreateCounters( PC, BPC ); - CollectSamples( samplesList, PC, BPC ); - CalculateResults( samplesList ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp deleted file mode 100644 index 0c6d5707320..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp +++ /dev/null @@ -1,208 +0,0 @@ -// Notice that the sample is conditionally compiled for Everett vs. -// Whidbey builds. Whidbey introduced new APIs that are not available -// in Everett. Snippet IDs do not overlap between Whidbey and Everett; -// Snippet #1 is Everett, Snippet #2 and #3 are Whidbey. - -#if ( BELOW_WHIDBEY_BUILD ) - -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Diagnostics; -using namespace System::Runtime::InteropServices; - -void OutputSample( CounterSample s ) -{ - Console::WriteLine( "\r\n+++++++++++" ); - Console::WriteLine( "Sample values - \r\n" ); - Console::WriteLine( " BaseValue = {0}", s.BaseValue ); - Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency ); - Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp ); - Console::WriteLine( " CounterType = {0}", s.CounterType ); - Console::WriteLine( " RawValue = {0}", s.RawValue ); - Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency ); - Console::WriteLine( " TimeStamp = {0}", s.TimeStamp ); - Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec ); - Console::WriteLine( "++++++++++++++++++++++" ); -} - -// Reads the counter information to enable setting the RawValue. -[DllImport("Kernel32.dll")] -extern bool QueryPerformanceCounter( [Out]__int64 * value ); - -bool SetupCategory() -{ - if ( !PerformanceCounterCategory::Exists( "ElapsedTimeSampleCategory" ) ) - { - CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection; - - // Add the counter. - CounterCreationData^ ETimeData = gcnew CounterCreationData; - ETimeData->CounterType = PerformanceCounterType::ElapsedTime; - ETimeData->CounterName = "ElapsedTimeSample"; - CCDC->Add( ETimeData ); - - // Create the category. - PerformanceCounterCategory::Create( "ElapsedTimeSampleCategory", - "Demonstrates usage of the ElapsedTime performance counter type.", - CCDC ); - return true; - } - else - { - Console::WriteLine( "Category exists - ElapsedTimeSampleCategory" ); - return false; - } -} - -void CreateCounters( PerformanceCounter^% PC ) -{ - // Create the counter. - PC = gcnew PerformanceCounter( "ElapsedTimeSampleCategory", - "ElapsedTimeSample", - false ); -} - -void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC ) -{ - __int64 pcValue; - DateTime Start; - - // Initialize the counter. - QueryPerformanceCounter( &pcValue ); - PC->RawValue = pcValue; - Start = DateTime::Now; - - // Loop for the samples. - for ( int j = 0; j < 1000; j++ ) - { - // Output the values. - if ( (j % 10) == 9 ) - { - Console::WriteLine( "NextValue() = {0}", PC->NextValue() ); - Console::WriteLine( "Actual elapsed time = {0}", DateTime::Now.Subtract( Start ) ); - OutputSample( PC->NextSample() ); - samplesList->Add( PC->NextSample() ); - } - - // reset the counter on 100th iteration. - if ( j % 100 == 0 ) - { - QueryPerformanceCounter( &pcValue ); - PC->RawValue = pcValue; - Start = DateTime::Now; - } - System::Threading::Thread::Sleep( 50 ); - } - - Console::WriteLine( "Elapsed time = {0}", DateTime::Now.Subtract( Start ) ); -} - -void main() -{ - ArrayList^ samplesList = gcnew ArrayList; -// PerformanceCounter^ PC; - SetupCategory(); -// CreateCounters( PC ); - CreateCounters(); - CollectSamples( samplesList, PC ); -} -// - -#else -// Build sample for Whidbey or higher. - -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Diagnostics; -using namespace System::Runtime::InteropServices; - -void OutputSample( CounterSample s ) -{ - Console::WriteLine( "\r\n+++++++++++" ); - Console::WriteLine( "Sample values - \r\n" ); - Console::WriteLine( " BaseValue = {0}", s.BaseValue ); - Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency ); - Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp ); - Console::WriteLine( " CounterType = {0}", s.CounterType ); - Console::WriteLine( " RawValue = {0}", s.RawValue ); - Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency ); - Console::WriteLine( " TimeStamp = {0}", s.TimeStamp ); - Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec ); - Console::WriteLine( "++++++++++++++++++++++" ); -} - -void CollectSamples() -{ - String^ categoryName = "ElapsedTimeSampleCategory"; - String^ counterName = "ElapsedTimeSample"; - - // Create the performance counter category. - if ( !PerformanceCounterCategory::Exists( categoryName ) ) - { - CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection; - - // Add the counter. - CounterCreationData^ ETimeData = gcnew CounterCreationData; - ETimeData->CounterType = PerformanceCounterType::ElapsedTime; - ETimeData->CounterName = counterName; - CCDC->Add( ETimeData ); - - // Create the category. - PerformanceCounterCategory::Create( categoryName, - "Demonstrates ElapsedTime performance counter usage.", - CCDC ); - } - else - { - Console::WriteLine( "Category exists - {0}", categoryName ); - } - - - // - // Create the performance counter. - PerformanceCounter^ PC = gcnew PerformanceCounter( categoryName, - counterName, - false ); - // Initialize the counter. - PC->RawValue = Stopwatch::GetTimestamp(); - // - - DateTime Start = DateTime::Now; - - // Loop for the samples. - for ( int j = 0; j < 100; j++ ) - { - // Output the values. - if ( (j % 10) == 9 ) - { - Console::WriteLine( "NextValue() = {0}", PC->NextValue() ); - Console::WriteLine( "Actual elapsed time = {0}", DateTime::Now.Subtract( Start ) ); - OutputSample( PC->NextSample() ); - } - - // Reset the counter on every 20th iteration. - if ( j % 20 == 0 ) - { - PC->RawValue = Stopwatch::GetTimestamp(); - Start = DateTime::Now; - } - System::Threading::Thread::Sleep( 50 ); - } - - Console::WriteLine( "Elapsed time = {0}", DateTime::Now.Subtract( Start ) ); -} - -int main() -{ - CollectSamples(); -} -// -#endif diff --git a/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp b/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp deleted file mode 100644 index e61059912b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp +++ /dev/null @@ -1,279 +0,0 @@ -// Types:System.Security.IPermission Vendor:Richter -// Types:System.Security.ISecurityEncodable Vendor:Richter -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Reflection; - -// Enumerated type for permission states. -[Serializable] -public enum class SoundPermissionState -{ - NoSound = 0, - PlaySystemSounds = 1, - PlayAnySound = 2 -}; - -// Derive from CodeAccessPermission to gain implementations of the following -// sealed IStackWalk methods: Assert, Demand, Deny, and PermitOnly. -// Implement the following abstract IPermission methods: -// Copy, Intersect, and IsSubSetOf. -// Implementing the Union method of the IPermission class is optional. -// Implement the following abstract ISecurityEncodable methods: -// FromXml and ToXml. -// Making the class 'sealed' is optional. - -public ref class SoundPermission sealed : public CodeAccessPermission, - public IPermission, public IUnrestrictedPermission, - public ISecurityEncodable, public ICloneable -{ -private: - bool specifiedAsUnrestricted; -private: - SoundPermissionState stateFlags; - - // This constructor creates and initializes - // a permission with generic access. -public: - SoundPermission(PermissionState^ state) - { - specifiedAsUnrestricted = (state == PermissionState::Unrestricted); - } - - // This constructor creates and initializes - // a permission with specific access. -public: - SoundPermission(SoundPermissionState flags) - { - if (flags < SoundPermissionState::NoSound || - flags > SoundPermissionState::PlayAnySound) - { - throw gcnew ArgumentException("The value of \"flags\" is not" + - " valid for the SoundPermissionState enumerated type"); - } - stateFlags = flags; - } - - // For debugging, return the state of this object as XML. -public: - virtual String^ ToString() override - { - return ToXml()->ToString(); - } - - // Private method to cast (if possible) an IPermission to the type. -private: - SoundPermission^ VerifyTypeMatch(IPermission^ target) - { - if (GetType() != target->GetType()) - { - throw gcnew ArgumentException(String::Format( - "The variable \"target\" must be of the {0} type", - GetType()->FullName)); - } - return (SoundPermission^) target; - } - - // This is the Private Clone helper method. -private: - SoundPermission^ Clone(bool specifiedAsUnrestricted, - SoundPermissionState flags) - { - SoundPermission^ soundPerm = (SoundPermission^) Clone(); - soundPerm->specifiedAsUnrestricted = specifiedAsUnrestricted; - soundPerm->stateFlags = specifiedAsUnrestricted ? - SoundPermissionState::PlayAnySound : flags; - return soundPerm; - } - - #pragma region IPermission^ Members - // - // Return a new object that contains the intersection - // of 'this' and 'target'. -public: - virtual IPermission^ Intersect(IPermission^ target) override - { - // If 'target' is null, return null. - if (target == nullptr) - { - return nullptr; - } - - // Both objects must be the same type. - SoundPermission^ soundPerm = VerifyTypeMatch(target); - - // If 'this' and 'target' are unrestricted, - // return a new unrestricted permission. - if (specifiedAsUnrestricted && soundPerm->specifiedAsUnrestricted) - { - return Clone(true, SoundPermissionState::PlayAnySound); - } - - // Calculate the intersected permissions. - // If there are none, return null. - SoundPermissionState minimumPermission = (SoundPermissionState) - Math::Min((int) stateFlags, (int) soundPerm->stateFlags); - if ((int)minimumPermission == 0) - { - return nullptr; - } - - // Return a new object with the intersected permission value. - return Clone(false, minimumPermission); - } - // - - // - // Called by the Demand method: returns true - // if 'this' is a subset of 'target'. -public: - virtual bool IsSubsetOf(IPermission^ target) override - { - // If 'target' is null and this permission allows nothing, - // return true. - if (target == nullptr) - { - return (int)stateFlags == 0; - } - - // Both objects must be the same type. - SoundPermission^ soundPerm = VerifyTypeMatch(target); - - // Return true if the permissions of 'this' - // is a subset of 'target'. - return stateFlags <= soundPerm->stateFlags; - } - // - - // - // Return a new object that matches 'this' object's permissions. -public: - virtual IPermission^ Copy () override sealed - { - return (IPermission^) Clone(); - } - // - - // - // Return a new object that contains the union of 'this' and 'target'. - // Note: You do not have to implement this method. - // If you do not, the version - // in CodeAccessPermission does this: - // 1. If target is not null, a NotSupportedException is thrown. - // 2. If target is null, then Copy is called and - // the new object is returned. -public: - virtual IPermission^ Union(IPermission^ target) override - { - // If 'target' is null, then return a copy of 'this'. - if (target == nullptr) - { - return Copy(); - } - - // Both objects must be the same type. - SoundPermission^ soundPerm = VerifyTypeMatch(target); - - // If 'this' or 'target' are unrestricted, - // return a new unrestricted permission. - if (specifiedAsUnrestricted || soundPerm->specifiedAsUnrestricted) - { - return Clone(true, SoundPermissionState::PlayAnySound); - } - - // Return a new object with the calculated, unioned permission value. - return Clone(false, (SoundPermissionState) - Math::Max((int) stateFlags, (int) soundPerm->stateFlags)); - } - // - #pragma endregion - - #pragma region ISecurityEncodable^ Members - // - // Populate the permission's fields from XML. -public: - virtual void FromXml(SecurityElement^ element) override - { - specifiedAsUnrestricted = false; - stateFlags = (SoundPermissionState)0; - - // If XML indicates an unrestricted permission, - // make this permission unrestricted. - String^ attributeString = - (String^) element->Attributes["Unrestricted"]; - if (attributeString != nullptr) - { - specifiedAsUnrestricted = Convert::ToBoolean(attributeString); - if (specifiedAsUnrestricted) - { - stateFlags = SoundPermissionState::PlayAnySound; - } - } - - // If XML indicates a restricted permission, parse the flags. - if (!specifiedAsUnrestricted) - { - attributeString = (String^) element->Attributes["Flags"]; - if (attributeString != nullptr) - { - stateFlags = (SoundPermissionState) Convert::ToInt32( - Enum::Parse(SoundPermissionState::typeid, - attributeString, true)); - } - } - } - // - - // - // Produce XML from the permission's fields. -public: - virtual SecurityElement^ ToXml() override - { - // These first three lines create an element with the required format. - SecurityElement^ element = gcnew SecurityElement("IPermission"); - // Replace the double quotation marks () - // with single quotation marks () - // to remain XML compliant when the culture is not neutral. - element->AddAttribute("class", - GetType()->AssemblyQualifiedName->Replace('\"', '\'')); - element->AddAttribute("version", "1"); - - if (!specifiedAsUnrestricted) - { - element->AddAttribute("Flags", - Enum::Format(SoundPermissionState::typeid, stateFlags, "G")); - } - else - { - element->AddAttribute("Unrestricted", "true"); - } - return element; - } - // - #pragma endregion - - #pragma region IUnrestrictedPermission^ Members - // - // Returns true if permission is effectively unrestricted. -public: - virtual bool IsUnrestricted() - { - // This means that the object is unrestricted at runtime. - return stateFlags == SoundPermissionState::PlayAnySound; - } - // - #pragma endregion - - #pragma region ICloneable^ Members - - // Return a copy of the permission. -public: - virtual Object^ Clone() - { - return MemberwiseClone(); - } - - #pragma endregion -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp b/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp deleted file mode 100644 index c551e40c3f6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::ComponentModel; -int main() -{ - // Get the current process. - Process^ currentProcess = Process::GetCurrentProcess(); - - // Get all processes running on the local computer. - array^localAll = Process::GetProcesses(); - - // Get all instances of Notepad running on the local computer. - // This will return an empty array if notepad isn't running. - array^localByName = Process::GetProcessesByName("notepad"); - - // Get a process on the local computer, using the process id. - // This will throw an exception if there is no such process. - Process^ localById = Process::GetProcessById(1234); - - - // Get processes running on a remote computer. Note that this - // and all the following calls will timeout and throw an exception - // if "myComputer" and 169.0.0.0 do not exist on your local network. - - // Get all processes on a remote computer. - array^remoteAll = Process::GetProcesses("myComputer"); - - // Get all instances of Notepad running on the specific computer, using machine name. - array^remoteByName = Process::GetProcessesByName( "notepad", "myComputer" ); - - // Get all instances of Notepad running on the specific computer, using IP address. - array^ipByName = Process::GetProcessesByName( "notepad", "169.0.0.0" ); - - // Get a process on a remote computer, using the process id and machine name. - Process^ remoteById = Process::GetProcessById( 2345, "myComputer" ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp deleted file mode 100644 index b4879144d08..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -#using -using namespace System; -using namespace System::Diagnostics; -using namespace System::ComponentModel; - -int main() -{ - Process^ myProcess = gcnew Process; - - try - { - myProcess->StartInfo->UseShellExecute = false; - // You can start any process, HelloWorld is a do-nothing example. - myProcess->StartInfo->FileName = "C:\\HelloWorld.exe"; - myProcess->StartInfo->CreateNoWindow = true; - myProcess->Start(); - // This code assumes the process you are starting will terminate itself. - // Given that it is started without a window so you cannot terminate it - // on the desktop, it must terminate itself or you can do it programmatically - // from this application using the Kill method. - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp deleted file mode 100644 index 6db5fa36f59..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::ComponentModel; - -// Opens the Internet Explorer application. -void OpenApplication(String^ myFavoritesPath) -{ - // Start Internet Explorer. Defaults to the home page. - Process::Start("IExplore.exe"); - - // Display the contents of the favorites folder in the browser. - Process::Start(myFavoritesPath); -} - -// Opens urls and .html documents using Internet Explorer. -void OpenWithArguments() -{ - // URLs are not considered documents. They can only be opened - // by passing them as arguments. - Process::Start("IExplore.exe", "www.northwindtraders.com"); - - // Start a Web page using a browser associated with .html and .asp files. - Process::Start("IExplore.exe", "C:\\myPath\\myFile.htm"); - Process::Start("IExplore.exe", "C:\\myPath\\myFile.asp"); -} - -// Uses the ProcessStartInfo class to start new processes, -// both in a minimized mode. -void OpenWithStartInfo() -{ - ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("IExplore.exe"); - startInfo->WindowStyle = ProcessWindowStyle::Minimized; - Process::Start(startInfo); - startInfo->Arguments = "www.northwindtraders.com"; - Process::Start(startInfo); -} - -int main() -{ - // Get the path that stores favorite links. - String^ myFavoritesPath = Environment::GetFolderPath(Environment::SpecialFolder::Favorites); - OpenApplication(myFavoritesPath); - OpenWithArguments(); - OpenWithStartInfo(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp deleted file mode 100644 index b84436e8b00..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Place the following code into a console project called StartArgsEcho. It depends on the -// console application named argsecho.exe. - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("argsecho.exe"); - startInfo->WindowStyle = ProcessWindowStyle::Normal; - - // Start with one argument. - // Output of ArgsEcho: - // [0]=/a - startInfo->Arguments = "/a"; - Process::Start(startInfo); - - // Start with multiple arguments separated by spaces. - // Output of ArgsEcho: - // [0] = /a - // [1] = /b - // [2] = c:\temp - startInfo->Arguments = "/a /b c:\\temp"; - Process::Start(startInfo); - - // An argument with spaces inside quotes is interpreted as multiple arguments. - // Output of ArgsEcho: - // [0] = /a - // [1] = literal string arg - startInfo->Arguments = "/a \"literal string arg\""; - Process::Start(startInfo); - - // An argument inside double quotes is interpreted as if the quote weren't there, - // that is, as separate arguments. - // Output of ArgsEcho: - // [0] = /a - // [1] = /b:string - // [2] = in - // [3] = double - // [4] = quotes - startInfo->Arguments = "/a /b:\"\"string in double quotes\"\""; - Process::Start(startInfo); - - // Triple-escape quotation marks to include the character in the final argument received - // by the target process. - // [0] = /a - // [1] = /b:"quoted string" - startInfo->Arguments = "/a /b:\"\"\"quoted string\"\"\""; - Process::Start(startInfo); - - return 0; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp deleted file mode 100644 index d4fd5c0b6cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// Place this code into a console project called ArgsEcho to build the argsecho.exe target - -using namespace System; - -int main(array ^args) -{ - Console::WriteLine("Received the following arguments:\n"); - - for (int i = 0; i < args->Length; i++) - { - Console::WriteLine("[" + i + "] = " + args[i]); - } - - Console::WriteLine("\nPress any key to exit"); - Console::ReadLine(); - return 0; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp deleted file mode 100644 index 57ea4cc3263..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// System::Diagnostics::ProcessModule -/* The following program demonstrates the use of 'ProcessModule' class. -It creates a notepad, gets the 'MainModule' and all other modules of -the process 'notepad.exe', displays some of the properties of each modules. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "Properties of the modules associated with 'notepad' are:" ); - - // Display the properties of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "The moduleName is {0}", myProcessModule->ModuleName ); - Console::WriteLine( "The {0}'s base address is: {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress ); - Console::WriteLine( "The {0}'s Entry point address is: {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress ); - Console::WriteLine( "The {0}'s File name is: {1}", myProcessModule->ModuleName, myProcessModule->FileName ); - } - myProcessModule = myProcess->MainModule; - - // Display the properties of the main module. - Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName ); - Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress ); - Console::WriteLine( "The process's main module's Entry point address is: {0}", myProcessModule->EntryPointAddress ); - Console::WriteLine( "The process's main module's File name is: {0}", myProcessModule->FileName ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp deleted file mode 100644 index c941fb56f0d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Diagnostics::ProcessModule::BaseAddress - -/* The following program demonstrates the use of 'BaseAddress' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'BaseAddress' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "Base addresses of the modules associated with 'notepad' are:" ); - - // Display the 'BaseAddress' of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress ); - } - myProcessModule = myProcess->MainModule; - - // Display the 'BaseAddress' of the main module. - Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress ); - myProcess->CloseMainWindow(); - // - - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp deleted file mode 100644 index a03a38206d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// System::Diagnostics::ProcessModule::EntryPointAddress - -/* The following program demonstrates the use of 'EntryPointAddress' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'EntryPointAddress' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "Entry point addresses of the modules associated with 'notepad' are:" ); - - // Display the 'EntryPointAddress' of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress ); - } - myProcessModule = myProcess->MainModule; - Console::WriteLine( "The process's main module's EntryPointAddress is: {0}", myProcessModule->EntryPointAddress ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp deleted file mode 100644 index a67c20e8412..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Diagnostics::ProcessModule::FileName - -/* The following program demonstrates the use of 'FileName' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'FileName' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "File names of the modules associated with 'notepad' are:" ); - - // Display the 'FileName' of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "{0:s} : {1:s}", myProcessModule->ModuleName, myProcessModule->FileName ); - } - myProcessModule = myProcess->MainModule; - - // Display the 'FileName' of the main module. - Console::WriteLine( "The process's main module's FileName is: {0}", myProcessModule->FileName ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp deleted file mode 100644 index 62a1569e9f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// System::Diagnostics::ProcessModule::FileVersionInfo - -/* The following program demonstrates the use of 'FileVersionInfo' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'FileVersionInfo' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "'FileversionInfo' of the modules associated with 'notepad' are:" ); - - // Display the 'FileVersionInfo' of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->FileVersionInfo ); - } - myProcessModule = myProcess->MainModule; - - // Display the 'FileVersionInfo' of main module. - Console::WriteLine( "The process's main module's FileVersionInfo is: {0}", myProcessModule->FileVersionInfo ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp deleted file mode 100644 index 8d5907528ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Diagnostics::ProcessModule::ModuleMemorySize - -/* The following program demonstrates the use of 'ModuleMemorySize' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'ModuleMemorySize' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "Module memory sizes of the modules associated with 'notepad' are:" ); - - // Display the 'ModuleMemorySize' of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->ModuleMemorySize ); - } - myProcessModule = myProcess->MainModule; - - // Display the 'ModuleMemorySize' of the main module. - Console::WriteLine( "The process's main module's ModuleMemorySize is: {0}", myProcessModule->ModuleMemorySize ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp deleted file mode 100644 index 96abbee1dab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Diagnostics::ProcessModule::ModuleName - -/* The following program demonstrates the use of 'ModuleName' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'ModuleName' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "Module names of the modules associated with 'notepad' are:" ); - - // Display the 'ModuleName' of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( myProcessModule->ModuleName ); - } - myProcessModule = myProcess->MainModule; - - // Display the 'ModuleName' of the main module. - Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp deleted file mode 100644 index 9bd9a254aa0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Diagnostics::ProcessModule::ToString - -/* The following program demonstrates the use of 'ToString' property of -'ProcessModule' class. It creates a notepad, gets the 'MainModule' and -all other modules of the process 'notepad.exe', displays 'ToString' -for all the modules and the main module. -*/ - -#using - -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - try - { - // - Process^ myProcess = gcnew Process; - - // Get the process start information of notepad. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); - - // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. - myProcess->StartInfo = myProcessStartInfo; - - // Create a notepad. - myProcess->Start(); - System::Threading::Thread::Sleep( 1000 ); - ProcessModule^ myProcessModule; - - // Get all the modules associated with 'myProcess'. - ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; - Console::WriteLine( "ToString properties of the modules associated with 'notepad' are:" ); - - // Display the ToString of each of the modules. - for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) - { - myProcessModule = myProcessModuleCollection[ i ]; - Console::WriteLine( "{0} : {1}", myProcessModuleCollection[ i ]->ModuleName, myProcessModule->ToString() ); - } - myProcessModule = myProcess->MainModule; - - // Display the ToString of the main module. - Console::WriteLine( "The process's main module is : {0}", myProcessModule->ToString() ); - myProcess->CloseMainWindow(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp deleted file mode 100644 index dc1a08793ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using - -using namespace System; -using namespace System::Diagnostics; - -void main() -{ - // - // Run "cl.exe /cld stdstr.cpp /link /out:sample.exe". UseShellExecute is false because we're specifying - // an executable directly and in this case depending on it being in a PATH folder. By setting - // RedirectStandardOutput to true, the output of cl.exe is directed to the Process.StandardOutput stream - // which is then displayed in this console window directly. - Process^ compiler = gcnew Process; - compiler->StartInfo->FileName = "cl.exe"; - compiler->StartInfo->Arguments = "/clr stdstr.cpp /link /out:sample.exe"; - compiler->StartInfo->UseShellExecute = false; - compiler->StartInfo->RedirectStandardOutput = true; - compiler->Start(); - - Console::WriteLine( compiler->StandardOutput->ReadToEnd() ); - - compiler->WaitForExit(); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp b/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp deleted file mode 100644 index 194770fb873..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// System::Diagnostics::Process::MainWindowTitle -/* The following program demonstrates the property 'MainWindowTitle' of class 'Process'. -It creates a new process notepad on local computer and displays its caption to console. -*/ -// -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - try - { - - // Create an instance of process component. - Process^ myProcess = gcnew Process; - - // Create an instance of 'myProcessStartInfo'. - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo; - myProcessStartInfo->FileName = "notepad"; - myProcess->StartInfo = myProcessStartInfo; - - // Start process. - myProcess->Start(); - - // Allow the process to finish starting. - myProcess->WaitForInputIdle(); - Console::Write( "Main window Title : {0}", myProcess->MainWindowTitle ); - myProcess->CloseMainWindow(); - myProcess->Close(); - } - catch ( Exception^ e ) - { - Console::Write( " Message : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp deleted file mode 100644 index b295733c646..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// System::Diagnostics::Process::StandardError -/* -The following example demonstrates property 'StandardError' of -'Process' class. - -It starts a process(net.exe) which writes an error message on to the standard -error when a bad network path is given. This program gets 'StandardError' of -net.exe process and reads output from its stream reader.*/ - -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::ComponentModel; -using namespace System::IO; - -void GetStandardError( array^args ) -{ -// - Process^ myProcess = gcnew Process; - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "net ",String::Concat( "use ", args[ 0 ] ) ); - - myProcessStartInfo->UseShellExecute = false; - myProcessStartInfo->RedirectStandardError = true; - myProcess->StartInfo = myProcessStartInfo; - myProcess->Start(); - - StreamReader^ myStreamReader = myProcess->StandardError; - // Read the standard error of net.exe and write it on to console. - Console::WriteLine( myStreamReader->ReadLine() ); - myProcess->Close(); -// -} - -void main( int argc, char *argv[] ) -{ - if ( argc < 2 ) - { - Console::WriteLine( "\nThis requires a machine name as a parameter which is not on the network." ); - Console::WriteLine( "\nUsage:" ); - Console::WriteLine( "Process_StandardError <\\\\machine name>" ); - } - else - { - GetStandardError( Environment::GetCommandLineArgs() ); - } - return; -} diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp deleted file mode 100644 index 02249c8a531..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -/// System.Diagnostics.Process.StandardInput -// -// -// The following example illustrates how to redirect the StandardInput -// stream of a process. The example starts the sort command with -// redirected input. It then prompts the user for text, and passes -// that to the sort command by means of the redirected input stream. -// The sort command results are displayed to the user on the console. -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; -using namespace System::ComponentModel; -int main() -{ - Console::WriteLine( "Ready to sort one or more text lines..." ); - - // Start the Sort.exe process with redirected input. - // Use the sort command to sort the input text. - Process^ myProcess = gcnew Process; - if ( myProcess ) - { - myProcess->StartInfo->FileName = "Sort.exe"; - myProcess->StartInfo->UseShellExecute = false; - myProcess->StartInfo->RedirectStandardInput = true; - myProcess->Start(); - StreamWriter^ myStreamWriter = myProcess->StandardInput; - if ( myStreamWriter ) - { - - // Prompt the user for input text lines to sort. - // Write each line to the StandardInput stream of - // the sort command. - String^ inputText; - int numLines = 0; - do - { - Console::WriteLine( "Enter a line of text (or press the Enter key to stop):" ); - inputText = Console::ReadLine(); - if ( inputText && inputText->Length > 0 ) - { - numLines++; - myStreamWriter->WriteLine( inputText ); - } - } - while ( inputText && inputText->Length != 0 ); - - // Write a report header to the console. - if ( numLines > 0 ) - { - Console::WriteLine( " {0} sorted text line(s) ", numLines.ToString() ); - Console::WriteLine( "------------------------" ); - } - else - { - Console::WriteLine( " No input was sorted" ); - } - - // End the input stream to the sort command. - // When the stream closes, the sort command - // writes the sorted text lines to the - // console. - myStreamWriter->Close(); - } - - // Wait for the sort process to write the sorted text lines. - myProcess->WaitForExit(); - myProcess->Close(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp deleted file mode 100644 index 6820437e824..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp +++ /dev/null @@ -1,26 +0,0 @@ -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -int main() -{ - Process^ process = gcnew Process(); - process->StartInfo->FileName = "ipconfig.exe"; - process->StartInfo->UseShellExecute = false; - process->StartInfo->RedirectStandardOutput = true; - process->Start(); - - // Synchronously read the standard output of the spawned process-> - StreamReader^ reader = process->StandardOutput; - String^ output = reader->ReadToEnd(); - - // Write the redirected output to this application's window. - Console::WriteLine(output); - - process->WaitForExit(); - process->Close(); - - Console::WriteLine("\n\nPress any key to exit"); - Console::ReadLine(); - return 0; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp deleted file mode 100644 index 7494c07f40a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// System::Diagnostics::Process::SynchronizingObject - -/* -The following example demonstrates the property 'SynchronizingObject' -of 'Process' class. - -It starts a process 'mspaint.exe' on button click. -It attaches 'MyProcessExited' method of 'MyButton' class as EventHandler to -'Exited' event of the process. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -ref class Form1: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - - // - ref class MyButton: public Button - { - public: - void MyProcessExited( Object^ source, EventArgs^ e ) - { - MessageBox::Show( "The process has exited." ); - } - }; - -public: - MyButton^ button1; -private: - void MyProcessExited( Object^ source, EventArgs^ e ) - { - MessageBox::Show( "The process has exited." ); - } - void button1_Click( Object^ sender, EventArgs^ e ) - { - Process^ myProcess = gcnew Process; - ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "mspaint" ); - myProcess->StartInfo = myProcessStartInfo; - myProcess->Start(); - myProcess->Exited += gcnew System::EventHandler( this, &Form1::MyProcessExited ); - - // Set 'EnableRaisingEvents' to true, to raise 'Exited' event when process is terminated. - myProcess->EnableRaisingEvents = true; - - // Set method handling the exited event to be called ; - // on the same thread on which MyButton was created. - myProcess->SynchronizingObject = button1; - MessageBox::Show( "Waiting for the process 'mspaint' to exit...." ); - myProcess->WaitForExit(); - myProcess->Close(); - } - // - - void InitializeComponent() - { - this->button1 = gcnew MyButton; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 40, 80 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 168, 32 ); - this->button1->TabIndex = 0; - this->button1->Text = "Click Me"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^newControls = {this->button1}; - this->Controls->AddRange( newControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -public: - Form1() - : components( nullptr ) - { - InitializeComponent(); - } -}; - -[STAThread] -void main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp deleted file mode 100644 index 70a6c01850b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// This is kind of a ripoff of 'process_synchronizingobject.cs' for use as a znippet -// for the remarks section. - -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -namespace SynchronizingObjectTest -{ - public ref class SyncForm : System::Windows::Forms::Form - { - - public: - SyncForm() : components( nullptr ) - { - InitializeComponent(); - } - - ~SyncForm() - { - if ( components != nullptr ) - { - delete components; - } - } - - static void Main() - { - Application::Run(gcnew SyncForm); - } -#if 0 // Dispose is implicit - protected: - virtual void Dispose( bool disposing ) override - { - if( disposing ) - { - if (components != null) - { - components->Dispose(); - } - } - base->Dispose( disposing ); - } -#endif - - private: - System::ComponentModel::Container^ components; - Process^ process1; - Button^ button1; - Label^ label1; - - void InitializeComponent() - { - this->button1 = gcnew Button(); - this->label1 = gcnew Label(); - this->SuspendLayout(); - // - // button1 - // - this->button1->Location = System::Drawing::Point(20, 20); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size(160, 30); - this->button1->TabIndex = 0; - this->button1->Text = "Click Me"; - this->button1->Click += gcnew EventHandler(this, &SyncForm::button1_Click); - // - // textbox - // - this->label1->Location = System::Drawing::Point(20, 20); - this->label1->Name = "textbox1"; - this->label1->Size = System::Drawing::Size(160, 30); - this->label1->TabIndex = 1; - this->label1->Text = "Waiting for the process 'notepad' to exit...."; - this->label1->ForeColor = System::Drawing::Color::Red; - this->label1->Visible = false; - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(200, 70); - this->Controls->Add(this->button1); - this->Controls->Add(this->label1); - this->Name = "SyncForm"; - this->Text = "SyncForm"; - this->ResumeLayout(false); - } - - - - void button1_Click(Object^ sender, System::EventArgs^ e) - { - this->button1->Hide(); - this->label1->Show(); - - process1 = gcnew Process(); - ProcessStartInfo^ process1StartInfo= gcnew ProcessStartInfo("notepad"); - - // - this->process1->StartInfo->Domain = ""; - this->process1->StartInfo->LoadUserProfile = false; - this->process1->StartInfo->Password = nullptr; - this->process1->StartInfo->StandardErrorEncoding = nullptr; - this->process1->StartInfo->StandardOutputEncoding = nullptr; - this->process1->StartInfo->UserName = ""; - this->process1->SynchronizingObject = this; - // - - // Set method handling the exited event to be called - process1->Exited += gcnew EventHandler(this, &SyncForm::TheProcessExited); - // Set 'EnableRaisingEvents' to true, to raise 'Exited' event when process is terminated. - process1->EnableRaisingEvents = true; - - this->Refresh(); - process1->StartInfo = process1StartInfo; - process1->Start(); - - process1->WaitForExit(); - process1->Close(); - } - - void TheProcessExited(Object^ source, EventArgs^ e) - { - this->label1->Hide(); - this->button1->Show(); - MessageBox::Show("The process has exited."); - } - }; -} - -[STAThread] -int main() -{ - SynchronizingObjectTest::SyncForm::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp b/snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp deleted file mode 100644 index 7e27af608f2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* -System::Runtime::InteropServices::ProgIdAttribute.Value - -The program shows MyClass as a COM class with prog id 'InteropSample::MyClass'. -It gets all attributes of MyClass by calling GetAttributes method of TypeDescriptor -then prints the 'Value' property of 'ProgIdAttribute' class. -*/ - -#using - -using namespace System; -using namespace System::Runtime::InteropServices; -using namespace System::ComponentModel; - -// -[ClassInterface(ClassInterfaceType::AutoDispatch)] -[ProgId("InteropSample.MyClass")] -public ref class MyClass -{ -public: - MyClass(){} - -}; - -int main() -{ - try - { - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( MyClass::typeid ); - ProgIdAttribute^ progIdAttributeObj = dynamic_cast(attributes[ ProgIdAttribute::typeid ]); - Console::WriteLine( "ProgIdAttribute's value is set to : {0}", progIdAttributeObj->Value ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp deleted file mode 100644 index f64e0f64c9b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp +++ /dev/null @@ -1,130 +0,0 @@ - -// System.Reflection.Emit.PropertyBuilder.SetGetMethod -// System.Reflection.Emit.PropertyBuilder.SetSetMethod -// System.Reflection.Emit.PropertyBuilder.AddOtherMethod -// System.Reflection.Emit.PropertyBuilder -/* -This following program demonstrates methods 'SetGetMethod','SetSetMethod' and -'AddOtherMethod' of class 'PropertyBuilder'. - -A dynamic assembly is generated with a class having a property 'Greeting'. -Its 'get' and 'set' method are created by returning and setting a string respectively. -This property value is reset with default string using othermethod. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// Create the callee transient dynamic assembly. -Type^ CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess access ) -{ - // Create a simple name for the callee assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Create the callee dynamic assembly. - AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, access ); - - // Create a dynamic module named "EmittedModule" in the callee assembly. - ModuleBuilder^ myModule; - if ( access == AssemblyBuilderAccess::Run ) - { - myModule = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" ); - } - else - { - myModule = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); - } - - // - TypeBuilder^ helloWorldTypeBuilder = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Define a private String field named "m_greeting" in "HelloWorld" class. - FieldBuilder^ greetingFieldBuilder = helloWorldTypeBuilder->DefineField( "m_greeting", String::typeid, FieldAttributes::Private ); - - // Create constructor args and define constructor. - array^constructorArgs = {String::typeid}; - ConstructorBuilder^ constructor = helloWorldTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, constructorArgs ); - - // Generate IL code for the method. The constructor stores its argument in the private field. - ILGenerator^ constructorIL = constructor->GetILGenerator(); - constructorIL->Emit( OpCodes::Ldarg_0 ); - constructorIL->Emit( OpCodes::Ldarg_1 ); - constructorIL->Emit( OpCodes::Stfld, greetingFieldBuilder ); - constructorIL->Emit( OpCodes::Ret ); - - // - // Define property Greeting. - PropertyBuilder^ greetingPropertyBuilder = helloWorldTypeBuilder->DefineProperty( "Greeting", PropertyAttributes::None, String::typeid, nullptr ); - - // Define the 'get_Greeting' method. - MethodBuilder^ getGreetingMethod = helloWorldTypeBuilder->DefineMethod( "get_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::SpecialName), String::typeid, nullptr ); - - // Generate IL code for 'get_Greeting' method. - ILGenerator^ methodIL = getGreetingMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldarg_0 ); - methodIL->Emit( OpCodes::Ldfld, greetingFieldBuilder ); - methodIL->Emit( OpCodes::Ret ); - greetingPropertyBuilder->SetGetMethod( getGreetingMethod ); - // - - - // Define the set_Greeting method. - array^methodArgs = {String::typeid}; - MethodBuilder^ setGreetingMethod = helloWorldTypeBuilder->DefineMethod( "set_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::SpecialName), void::typeid, methodArgs ); - - // Generate IL code for set_Greeting method. - methodIL = setGreetingMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldarg_0 ); - methodIL->Emit( OpCodes::Ldarg_1 ); - methodIL->Emit( OpCodes::Stfld, greetingFieldBuilder ); - methodIL->Emit( OpCodes::Ret ); - greetingPropertyBuilder->SetSetMethod( setGreetingMethod ); - // - - // - // Define the reset_Greeting method. - MethodBuilder^ otherGreetingMethod = helloWorldTypeBuilder->DefineMethod( "reset_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig), void::typeid, nullptr ); - - // Generate IL code for reset_Greeting method. - methodIL = otherGreetingMethod->GetILGenerator(); - methodIL->Emit( OpCodes::Ldarg_0 ); - methodIL->Emit( OpCodes::Ldstr, "Default String." ); - methodIL->Emit( OpCodes::Stfld, greetingFieldBuilder ); - methodIL->Emit( OpCodes::Ret ); - greetingPropertyBuilder->AddOtherMethod( otherGreetingMethod ); - // - - // Create the class HelloWorld. - return (helloWorldTypeBuilder->CreateType()); -} - -int main() -{ - // Create the "HelloWorld" type in an assembly with mode 'RunAndSave'. - Type^ helloWorldType = CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::RunAndSave ); - - // Create an instance of the "HelloWorld" class. - array^temp0 = {"HelloWorld"}; - Object^ helloWorld = Activator::CreateInstance( helloWorldType, temp0 ); - Object^ returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr ); - Console::WriteLine( "HelloWorld.GetGreeting returned: \"{0}\"", returnValue ); - - // Set 'Greeting' property with 'NewMessage!!!'. - array^temp1 = {"New Message !!!"}; - helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::SetProperty), nullptr, helloWorld, temp1 ); - returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr ); - Console::WriteLine( "After Set operation HelloWorld.GetGreeting returned: \"{0}\"", returnValue ); - - // Reset 'Greeting' property to 'Default String'. - helloWorldType->InvokeMember( "reset_Greeting", static_cast(BindingFlags::Default | BindingFlags::InvokeMethod), nullptr, helloWorld, nullptr ); - returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr ); - Console::WriteLine( "After Reset operation HelloWorld.GetGreeting returned: \"{0}\"", returnValue ); - AssemblyBuilder^ myAssembly = dynamic_cast(helloWorldType->Assembly); - - // Save to disk. - myAssembly->Save( "EmittedAssembly.dll" ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp deleted file mode 100644 index 3ec2d28a977..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -ref class Example -{ -private: - int static _sharedProperty = 41; - int _instanceProperty; - Dictionary^ _indexedInstanceProperty; - -public: - Example() - { - _instanceProperty = 42; - _indexedInstanceProperty = gcnew Dictionary(); - }; - - static property int SharedProperty - { - int get() { return _sharedProperty; } - void set(int value) { _sharedProperty = value; } - }; - - property int InstanceProperty - { - int get() { return _instanceProperty; } - void set(int value) { _instanceProperty = value; } - }; - - // By default, the name of the default indexed property (class - // indexer) is Item, and that name must be used to search for the - // property with reflection. The property can be given a different - // name by using the IndexerNameAttribute attribute. - property String^ default[int] - { - String^ get(int key) - { - String^ returnValue; - if (_indexedInstanceProperty->TryGetValue(key, returnValue)) - { - return returnValue; - } - else - { - return nullptr; - } - } - void set(int key, String^ value) - { - if (value == nullptr) - { - throw gcnew ArgumentNullException( - "IndexedInstanceProperty value can be an empty string, but it cannot be null."); - } - else - { - if (_indexedInstanceProperty->ContainsKey(key)) - { - _indexedInstanceProperty[key] = value; - } - else - { - _indexedInstanceProperty->Add(key, value); - } - } - } - }; -}; - -void main() -{ - Console::WriteLine("Initial value of class-level property: {0}", - Example::SharedProperty); - - PropertyInfo^ piShared = - Example::typeid->GetProperty("SharedProperty"); - piShared->SetValue(nullptr, 76, nullptr); - - Console::WriteLine("Final value of class-level property: {0}", - Example::SharedProperty); - - - Example^ exam = gcnew Example(); - - Console::WriteLine("\nInitial value of instance property: {0}", - exam->InstanceProperty); - - PropertyInfo^ piInstance = - Example::typeid->GetProperty("InstanceProperty"); - piInstance->SetValue(exam, 37, nullptr); - - Console::WriteLine("Final value of instance property: {0}", - exam->InstanceProperty); - - - exam[17] = "String number 17"; - exam[46] = "String number 46"; - exam[9] = "String number 9"; - - Console::WriteLine( - "\nInitial value of indexed instance property(17): '{0}'", - exam[17]); - - // By default, the name of the default indexed property (class - // indexer) is Item, and that name must be used to search for the - // property with reflection. The property can be given a different - // name by using the IndexerNameAttribute attribute. - PropertyInfo^ piIndexedInstance = - Example::typeid->GetProperty("Item"); - piIndexedInstance->SetValue( - exam, - "New value for string number 17", - gcnew array { 17 }); - - Console::WriteLine("Final value of indexed instance property(17): '{0}'", - exam[17]); -}; - -/* This example produces the following output: - -Initial value of class-level property: 41 -Final value of class-level property: 76 - -Initial value of instance property: 42 -Final value of instance property: 37 - -Initial value of indexed instance property(17): 'String number 17' -Final value of indexed instance property(17): 'New value for string number 17' - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp deleted file mode 100644 index f6ea3e649aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -ref class Example -{ -private: - int static _sharedProperty = 41; - int _instanceProperty; - - -public: - Example() - { - _instanceProperty = 42; - }; - - static property int SharedProperty - { - int get() { return _sharedProperty; } - void set(int value) { _sharedProperty = value; } - }; - - property int InstanceProperty - { - int get() { return _instanceProperty; } - void set(int value) { _instanceProperty = value; } - }; - -}; - -void main() -{ - Console::WriteLine("Initial value of static property: {0}", - Example::SharedProperty); - - PropertyInfo^ piShared = - Example::typeid->GetProperty("SharedProperty"); - piShared->SetValue(nullptr, 76, nullptr); - - Console::WriteLine("New value of static property: {0}", - Example::SharedProperty); - - - Example^ exam = gcnew Example(); - - Console::WriteLine("\nInitial value of instance property: {0}", - exam->InstanceProperty); - - PropertyInfo^ piInstance = - Example::typeid->GetProperty("InstanceProperty"); - piInstance->SetValue(exam, 37, nullptr); - - Console::WriteLine("New value of instance property: {0}", - exam->InstanceProperty); -}; - -/* The example displays the following output: - Initial value of static property: 41 - New value of static property: 76 - - Initial value of instance property: 42 - New value of instance property: 37 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp b/snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp deleted file mode 100644 index 9f5c2be1644..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp +++ /dev/null @@ -1,77 +0,0 @@ -#using - -using namespace System; -using namespace System::Runtime::InteropServices; - -namespace PtrToStructureExample -{ - ref class PtrToStructureTester - { - public: - // - [StructLayout(LayoutKind::Sequential)] - ref class INNER - { - public: - [MarshalAs(UnmanagedType::ByValTStr,SizeConst=10)] - String^ field; - - INNER() - { - field = "Test"; - } - }; - - [StructLayout(LayoutKind::Sequential)] - value struct OUTER - { - public: - [MarshalAs(UnmanagedType::ByValTStr,SizeConst=10)] - String^ field; - - [MarshalAs(UnmanagedType::ByValArray,SizeConst=100)] - array^ inner; - }; - - [DllImport("SomeTestDLL.dll")] - static void CallTest(OUTER^ outerStructurePointer); - - void static Work() - { - OUTER outerStructure; - array^ innerArray = gcnew array(10); - INNER^ innerStructure = gcnew INNER; - int structSize = Marshal::SizeOf(innerStructure); - int size = innerArray->Length * structSize; - outerStructure.inner = gcnew array(size); - - try - { - CallTest(outerStructure); - } - catch (SystemException^ ex) - { - Console::WriteLine(ex->Message); - } - - IntPtr buffer = Marshal::AllocCoTaskMem(structSize * 10); - Marshal::Copy(outerStructure.inner, 0, buffer, structSize * 10); - int currentOffset = 0; - for (int i = 0; i < 10; i++) - { - innerArray[i] = safe_cast(Marshal::PtrToStructure( - IntPtr(buffer.ToInt32() + currentOffset), - INNER::typeid)); - currentOffset += structSize; - } - Console::WriteLine(outerStructure.field); - Marshal::FreeCoTaskMem(buffer); - } - // - }; -} - -void main() -{ - PtrToStructureExample::PtrToStructureTester::Work(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp b/snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp deleted file mode 100644 index 5f87c29dc97..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp +++ /dev/null @@ -1,77 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -// Print the byte array in a readable format. -void PrintByteArray( array^array ) -{ - int i; - for ( i = 0; i < array->Length; i++ ) - { - Console::Write( String::Format( "{0:X2}", array[ i ] ) ); - if ( (i % 4) == 3 ) - Console::Write( " " ); - - } - Console::WriteLine(); -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "Usage: hashdir " ); - return 0; - } - - try - { - - // Create a DirectoryInfo object representing the specified directory. - DirectoryInfo^ dir = gcnew DirectoryInfo( args[ 1 ] ); - - // Get the FileInfo objects for every file in the directory. - array^files = dir->GetFiles(); - - // Initialize a RIPE160 hash object. - RIPEMD160 ^ myRIPEMD160 = RIPEMD160Managed::Create(); - array^hashValue; - - // Compute and print the hash values for each file in directory. - System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FileInfo^ fInfo = safe_cast(myEnum->Current); - - // Create a fileStream for the file. - FileStream^ fileStream = fInfo->Open( FileMode::Open ); - - // Compute the hash of the fileStream. - hashValue = myRIPEMD160->ComputeHash( fileStream ); - - // Write the name of the file to the Console. - Console::Write( "{0}: ", fInfo->Name ); - - // Write the hash value to the Console. - PrintByteArray( hashValue ); - - // Close the file. - fileStream->Close(); - } - return 0; - } - catch ( DirectoryNotFoundException^ ) - { - Console::WriteLine( "Error: The directory specified could not be found." ); - } - catch ( IOException^ ) - { - Console::WriteLine( "Error: A file in the directory could not be accessed." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp b/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp deleted file mode 100644 index 743f3c8001f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -//The following sample uses the Cryptography class to simulate the roll of a dice. - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Security::Cryptography; - -ref class RNGCSP -{ -public: - // Main method. - static void Main() - { - const int totalRolls = 25000; - array^ results = gcnew array(6); - - // Roll the dice 25000 times and display - // the results to the console. - for (int x = 0; x < totalRolls; x++) - { - Byte roll = RollDice((Byte)results->Length); - results[roll - 1]++; - } - for (int i = 0; i < results->Length; ++i) - { - Console::WriteLine("{0}: {1} ({2:p1})", i + 1, results[i], (double)results[i] / (double)totalRolls); - } - } - - // This method simulates a roll of the dice. The input parameter is the - // number of sides of the dice. - - static Byte RollDice(Byte numberSides) - { - if (numberSides <= 0) - throw gcnew ArgumentOutOfRangeException("numberSides"); - // Create a new instance of the RNGCryptoServiceProvider. - RNGCryptoServiceProvider^ rngCsp = gcnew RNGCryptoServiceProvider(); - // Create a byte array to hold the random value. - array^ randomNumber = gcnew array(1); - do - { - // Fill the array with a random value. - rngCsp->GetBytes(randomNumber); - } - while (!IsFairRoll(randomNumber[0], numberSides)); - // Return the random number mod the number - // of sides. The possible values are zero- - // based, so we add one. - return (Byte)((randomNumber[0] % numberSides) + 1); - } - -private: - static bool IsFairRoll(Byte roll, Byte numSides) - { - // There are MaxValue / numSides full sets of numbers that can come up - // in a single byte. For instance, if we have a 6 sided die, there are - // 42 full sets of 1-6 that come up. The 43rd set is incomplete. - int fullSetsOfValues = Byte::MaxValue / numSides; - - // If the roll is within this range of fair values, then we let it continue. - // In the 6 sided die case, a roll between 0 and 251 is allowed. (We use - // < rather than <= since the = portion allows through an extra 0 value). - // 252 through 255 would provide an extra 0, 1, 2, 3 so they are not fair - // to use. - return roll < numSides * fullSetsOfValues; - } -}; - -int main() -{ - RNGCSP::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp b/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp deleted file mode 100644 index 327d731d991..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - try - { - // Create an instance of StreamReader to read from a file. - StreamReader^ sr = gcnew StreamReader( "TestFile.txt" ); - try - { - String^ line; - - // Read and display lines from the file until the end of - // the file is reached. - while ( line = sr->ReadLine() ) - { - Console::WriteLine( line ); - } - } - finally - { - if ( sr ) - delete (IDisposable^)sr; - } - } - catch ( Exception^ e ) - { - // Let the user know what went wrong. - Console::WriteLine( "The file could not be read:" ); - Console::WriteLine( e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp b/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp deleted file mode 100644 index abd2bed7dea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp +++ /dev/null @@ -1,69 +0,0 @@ - -// -// For Directory::GetFiles and Directory::GetDirectories -// -// For File::Exists, Directory::Exists -using namespace System; -using namespace System::IO; -using namespace System::Collections; - -// Insert logic for processing found files here. -void ProcessFile( String^ path ) -{ - Console::WriteLine( "Processed file '{0}'.", path ); -} - - -// Process all files in the directory passed in, recurse on any directories -// that are found, and process the files they contain. -void ProcessDirectory( String^ targetDirectory ) -{ - - // Process the list of files found in the directory. - array^fileEntries = Directory::GetFiles( targetDirectory ); - IEnumerator^ files = fileEntries->GetEnumerator(); - while ( files->MoveNext() ) - { - String^ fileName = safe_cast(files->Current); - ProcessFile( fileName ); - } - - - // Recurse into subdirectories of this directory. - array^subdirectoryEntries = Directory::GetDirectories( targetDirectory ); - IEnumerator^ dirs = subdirectoryEntries->GetEnumerator(); - while ( dirs->MoveNext() ) - { - String^ subdirectory = safe_cast(dirs->Current); - ProcessDirectory( subdirectory ); - } -} - -int main( int argc, char *argv[] ) -{ - for ( int i = 1; i < argc; i++ ) - { - String^ path = gcnew String(argv[ i ]); - if ( File::Exists( path ) ) - { - - // This path is a file - ProcessFile( path ); - } - else - if ( Directory::Exists( path ) ) - { - - // This path is a directory - ProcessDirectory( path ); - } - else - { - Console::WriteLine( "{0} is not a valid file or directory.", path ); - } - - } -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp deleted file mode 100644 index 28a75c1bc29..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Globalization; - -// Declare a delegate type that can be used to execute the completed -// dynamic method. -private delegate int HelloDelegate(String^ msg, int ret); - -void main() -{ - // Create an array that specifies the types of the parameters - // of the dynamic method. This dynamic method has a String - // parameter and an Integer parameter. - array^ helloArgs = { String::typeid, int::typeid }; - - // Create a dynamic method with the name "Hello", a return type - // of Integer, and two parameters whose types are specified by - // the array helloArgs. Create the method in the module that - // defines the String class. - DynamicMethod^ hello = gcnew DynamicMethod("Hello", - int::typeid, - helloArgs, - String::typeid->Module); - - // - // Create an array that specifies the parameter types of the - // overload of Console::WriteLine to be used in Hello. - array^ writeStringArgs = { String::typeid }; - // Get the overload of Console::WriteLine that has one - // String parameter. - MethodInfo^ writeString = Console::typeid->GetMethod("WriteLine", - writeStringArgs); - - // Get an ILGenerator and emit a body for the dynamic method, - // using a stream size larger than the IL that will be - // emitted. - ILGenerator^ il = hello->GetILGenerator(256); - // Load the first argument, which is a string, onto the stack. - il->Emit(OpCodes::Ldarg_0); - // Call the overload of Console::WriteLine that prints a string. - il->EmitCall(OpCodes::Call, writeString, nullptr); - // The Hello method returns the value of the second argument; - // to do this, load the onto the stack and return. - il->Emit(OpCodes::Ldarg_1); - il->Emit(OpCodes::Ret); - // - - // - // Add parameter information to the dynamic method. (This is not - // necessary, but can be useful for debugging.) For each parameter, - // identified by position, supply the parameter attributes and a - // parameter name. - hello->DefineParameter(1, ParameterAttributes::In, "message"); - hello->DefineParameter(2, ParameterAttributes::In, "valueToReturn"); - // - - // - // Create a delegate that represents the dynamic method. This - // action completes the method. Any further attempts to - // change the method are ignored. - HelloDelegate^ hi = - (HelloDelegate^) hello->CreateDelegate(HelloDelegate::typeid); - - // Use the delegate to execute the dynamic method. - Console::WriteLine("\r\nUse the delegate to execute the dynamic method:"); - int retval = hi("\r\nHello, World!", 42); - Console::WriteLine("Invoking delegate hi(\"Hello, World!\", 42) returned: " + retval); - - // Execute it again, with different arguments. - retval = hi("\r\nHi, Mom!", 5280); - Console::WriteLine("Invoking delegate hi(\"Hi, Mom!\", 5280) returned: " + retval); - // - - // - Console::WriteLine("\r\nUse the Invoke method to execute the dynamic method:"); - // Create an array of arguments to use with the Invoke method. - array^ invokeArgs = { "\r\nHello, World!", 42 }; - // Invoke the dynamic method using the arguments. This is much - // slower than using the delegate, because you must create an - // array to contain the arguments, and value-type arguments - // must be boxed. - Object^ objRet = hello->Invoke(nullptr, BindingFlags::ExactBinding, nullptr, invokeArgs, gcnew CultureInfo("en-us")); - Console::WriteLine("hello.Invoke returned: " + objRet); - // - - Console::WriteLine("\r\n ----- Display information about the dynamic method -----"); - // - // Display MethodAttributes for the dynamic method, set when - // the dynamic method was created. - Console::WriteLine("\r\nMethod Attributes: {0}", hello->Attributes); - // - - // - // Display the calling convention of the dynamic method, set when the - // dynamic method was created. - Console::WriteLine("\r\nCalling convention: {0}", hello->CallingConvention); - // - - // - // Display the declaring type, which is always null for dynamic - // methods. - if (hello->DeclaringType == nullptr) - { - Console::WriteLine("\r\nDeclaringType is always null for dynamic methods."); - } - else - { - Console::WriteLine("DeclaringType: {0}", hello->DeclaringType); - } - // - - // - // Display the default value for InitLocals. - if (hello->InitLocals) - { - Console::Write("\r\nThis method contains verifiable code."); - } - else - { - Console::Write("\r\nThis method contains unverifiable code."); - } - Console::WriteLine(" (InitLocals = {0})", hello->InitLocals); - // - - // - // Display the module specified when the dynamic method was created. - Console::WriteLine("\r\nModule: {0}", hello->Module); - // - - // - // Display the name specified when the dynamic method was created. - // Note that the name can be blank. - Console::WriteLine("\r\nName: {0}", hello->Name); - // - - // - // For dynamic methods, the reflected type is always null. - if (hello->ReflectedType == nullptr) - { - Console::WriteLine("\r\nReflectedType is null."); - } - else - { - Console::WriteLine("\r\nReflectedType: {0}", hello->ReflectedType); - } - // - - // - if (hello->ReturnParameter == nullptr) - { - Console::WriteLine("\r\nMethod has no return parameter."); - } - else - { - Console::WriteLine("\r\nReturn parameter: {0}", hello->ReturnParameter); - } - // - - // - // If the method has no return type, ReturnType is System.Void. - Console::WriteLine("\r\nReturn type: {0}", hello->ReturnType); - // - - // - // ReturnTypeCustomAttributes returns an ICustomeAttributeProvider - // that can be used to enumerate the custom attributes of the - // return value. At present, there is no way to set such custom - // attributes, so the list is empty. - if (hello->ReturnType == Void::typeid) - { - Console::WriteLine("The method has no return type."); - } - else - { - ICustomAttributeProvider^ caProvider = hello->ReturnTypeCustomAttributes; - array^ returnAttributes = caProvider->GetCustomAttributes(true); - if (returnAttributes->Length == 0) - { - Console::WriteLine("\r\nThe return type has no custom attributes."); - } - else - { - Console::WriteLine("\r\nThe return type has the following custom attributes:"); - for each (Object^ attr in returnAttributes) - { - Console::WriteLine("\t{0}", attr->ToString()); - } - } - } - // - - // - Console::WriteLine("\r\nToString: {0}", hello->ToString()); - // - - // - // Display parameter information. - array^ parameters = hello->GetParameters(); - Console::WriteLine("\r\nParameters: name, type, ParameterAttributes"); - for each (ParameterInfo^ p in parameters) - { - Console::WriteLine("\t{0}, {1}, {2}", - p->Name, p->ParameterType, p->Attributes); - } - // -} - -/* This code example produces the following output: - -Use the delegate to execute the dynamic method: - -Hello, World! -Invoking delegate hi("Hello, World!", 42) returned: 42 - -Hi, Mom! -Invoking delegate hi("Hi, Mom!", 5280) returned: 5280 - -Use the Invoke method to execute the dynamic method: - -Hello, World! -hello.Invoke returned: 42 - - ----- Display information about the dynamic method ----- - -Method Attributes: PrivateScope, Public, Static - -Calling convention: Standard - -DeclaringType is always null for dynamic methods. - -This method contains verifiable code. (InitLocals = True) - -Module: CommonLanguageRuntimeLibrary - -Name: Hello - -ReflectedType is null. - -Method has no return parameter. - -Return type: System.Int32 - -The return type has no custom attributes. - -ToString: Int32 Hello(System.String, Int32) - -Parameters: name, type, ParameterAttributes - message, System.String, In - valueToReturn, System.Int32, In - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp deleted file mode 100644 index 86d3112fd26..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class Test -{ -}; - -// Declare a delegate that will be used to execute the completed -// dynamic method. -delegate int HelloInvoker(String^ msg, int ret); - -int main() -{ - // Create an array that specifies the types of the parameters - // of the dynamic method. This method has a string parameter - // and an int parameter. - array^ helloArgs = {String::typeid, int::typeid}; - - // Create a dynamic method with the name "Hello", a return type - // of int, and two parameters whose types are specified by the - // array helloArgs. Create the method in the module that - // defines the Test class. - DynamicMethod^ hello = gcnew DynamicMethod("Hello", - int::typeid, - helloArgs, - Test::typeid->Module); - - // - // Create an array that specifies the parameter types of the - // overload of Console.WriteLine to be used in Hello. - array^ writeStringArgs = {String::typeid}; - // Get the overload of Console.WriteLine that has one - // String parameter. - MethodInfo^ writeString = - Console::typeid->GetMethod("WriteLine", writeStringArgs); - - // Get an ILGenerator and emit a body for the dynamic method. - ILGenerator^ ilgen = hello->GetILGenerator(); - // Load the first argument, which is a string, onto the stack. - ilgen->Emit(OpCodes::Ldarg_0); - // Call the overload of Console.WriteLine that prints a string. - ilgen->EmitCall(OpCodes::Call, writeString, nullptr); - // The Hello method returns the value of the second argument; - // to do this, load the onto the stack and return. - ilgen->Emit(OpCodes::Ldarg_1); - ilgen->Emit(OpCodes::Ret); - // - - // - // Create a delegate that represents the dynamic method. This - // action completes the method, and any further attempts to - // change the method will cause an exception. - HelloInvoker^ helloDelegate = - (HelloInvoker^) hello->CreateDelegate(HelloInvoker::typeid); - // - - // Use the delegate to execute the dynamic method. Save and - // print the return value. - int returnValue = helloDelegate("\r\nHello, World!", 42); - Console::WriteLine("helloDelegate(\"Hello, World!\", 42) returned {0}", - returnValue); - - // Do it again, with different arguments. - returnValue = helloDelegate("\r\nHi, Mom!", 5280); - Console::WriteLine("helloDelegate(\"Hi, Mom!\", 5280) returned {0}", - returnValue); - - // - // Create an array of arguments to use with the Invoke method. - array^ delegateArgs = {"\r\nHello, World!", 42}; - // Invoke the dynamic method using the arguments. This is much - // slower than using the delegate, because you must create an - // array to contain the arguments, and ValueType arguments - // must be boxed. - Object^ returnValueObject = hello->Invoke(nullptr, delegateArgs); - Console::WriteLine("hello.Invoke returned {0}", returnValueObject); - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp deleted file mode 100644 index f6f2d74c1e0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -static void Display(Int32 indent, String^ format, ... array^param) -{ - Console::Write("{0}", gcnew String (' ', indent)); - Console::WriteLine(format, param); -} - -// Displays the custom attributes applied to the specified member. -static void DisplayAttributes(Int32 indent, MemberInfo^ mi) -{ - // Get the set of custom attributes; if none exist, just return. - array^attrs = mi->GetCustomAttributes(false); - - if (attrs->Length==0) - { - return; - } - - // Display the custom attributes applied to this member. - Display(indent+1, "Attributes:"); - for each ( Object^ o in attrs ) - { - Display(indent*2, "{0}", o); - } -} - -void main() -{ - try - { - // This variable holds the amount of indenting that - // should be used when displaying each line of information. - Int32 indent = 0; - // Display information about the EXE assembly. - // - Assembly^ a = System::Reflection::Assembly::GetExecutingAssembly(); - - Display(indent, "Assembly identity={0}", gcnew array {a->FullName}); - Display(indent+1, "Codebase={0}", gcnew array {a->CodeBase}); - - // Display the set of assemblies our assemblies reference. - - Display(indent, "Referenced assemblies:"); - - for each ( AssemblyName^ an in a->GetReferencedAssemblies() ) - { - Display(indent + 1, "Name={0}, Version={1}, Culture={2}, PublicKey token={3}", gcnew array {an->Name, an->Version, an->CultureInfo, (BitConverter::ToString(an->GetPublicKeyToken()))}); - } - // - Display(indent, ""); - // Display information about each assembly loading into this AppDomain. - for each ( Assembly^ b in AppDomain::CurrentDomain->GetAssemblies()) - { - Display(indent, "Assembly: {0}", gcnew array {b}); - // Display information about each module of this assembly. - - for each ( Module^ m in b->GetModules(true) ) - { - Display(indent+1, "Module: {0}", gcnew array {m->Name}); - } - // Display information about each type exported from this assembly. - - indent += 1; - for each ( Type^ t in b->GetExportedTypes() ) - { - Display(0, ""); - Display(indent, "Type: {0}", gcnew array {t}); - - // For each type, show its members & their custom attributes. - - indent += 1; - for each (MemberInfo^ mi in t->GetMembers() ) - { - Display(indent, "Member: {0}", gcnew array {mi->Name}); - DisplayAttributes(indent, mi); - - // If the member is a method, display information about its parameters. - if (mi->MemberType==MemberTypes::Method) - { - - for each ( ParameterInfo^ pi in (((MethodInfo^) mi)->GetParameters())) - { - Display(indent+1, "Parameter: Type={0}, Name={1}", gcnew array {pi->ParameterType, pi->Name}); - } - } - - // If the member is a property, display information about the property's accessor methods. - if (mi->MemberType==MemberTypes::Property) - { - for each ( MethodInfo^ am in (((PropertyInfo^) mi)->GetAccessors()) ) - { - Display(indent+1, "Accessor method: {0}", gcnew array {am}); - } - } - } - // Display a formatted string indented by the specified amount. - indent -= 1; - } - indent -= 1; - } - } - catch (Exception^ e) - { - Console::WriteLine(e->Message); - } -} - -// The output shown below is abbreviated. -// -//Assembly identity=Reflection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -// Codebase=file:///C:/Reflection.exe -//Referenced assemblies: -// Name=mscorlib, Version=1.0.5000.0, Culture=, PublicKey token=B7-7A-5C-56-19-34-E0-89 -// Name=Microsoft.VisualBasic, Version=7.0.5000.0, Culture=, PublicKey token=B0-3F-5F-7F-11-D5-0A-3A -// -//Assembly: mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 -// Module: mscorlib.dll -// Module: prc.nlp -// Module: prcp.nlp -// Module: ksc.nlp -// Module: ctype.nlp -// Module: xjis.nlp -// Module: bopomofo.nlp -// Module: culture.nlp -// Module: region.nlp -// Module: sortkey.nlp -// Module: charinfo.nlp -// Module: big5.nlp -// Module: sorttbls.nlp -// Module: l_intl.nlp -// Module: l_except.nlp -// -// Type: System.Object -// Member: GetHashCode -// Member: Equals -// Parameter: Type=System.Object, Name=obj -// Member: ToString -// Member: Equals -// Parameter: Type=System.Object, Name=objA -// Parameter: Type=System.Object, Name=objB -// Member: ReferenceEquals -// Parameter: Type=System.Object, Name=objA -// Parameter: Type=System.Object, Name=objB -// Member: GetType -// Member: .ctor -// -// Type: System.ICloneable -// Member: Clone -// -// Type: System.Collections.IEnumerable -// Member: GetEnumerator -// Attributes: -// System.Runtime.InteropServices.DispIdAttribute -// -// Type: System.Collections.ICollection -// Member: get_IsSynchronized -// Member: get_SyncRoot -// Member: get_Count -// Member: CopyTo -// Parameter: Type=System.Array, Name=array -// Parameter: Type=System.Int32, Name=index -// Member: Count -// Accessor method: Int32 get_Count() -// Member: SyncRoot -// Accessor method: System.Object get_SyncRoot() -// Member: IsSynchronized -// Accessor method: Boolean get_IsSynchronized() -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp b/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp deleted file mode 100644 index 1cfed0722c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Text::RegularExpressions; -int main() -{ - // - // Define a regular expression for repeated words. - Regex^ rx = gcnew Regex( "\\b(?\\w+)\\s+(\\k)\\b",static_cast(RegexOptions::Compiled | RegexOptions::IgnoreCase) ); - // - - // Define a test string. - String^ text = "The the quick brown fox fox jumps over the lazy dog dog."; - - // - // Find matches. - MatchCollection^ matches = rx->Matches( text ); - // - - // - // Report the number of matches found. - Console::WriteLine( "{0} matches found.", matches->Count ); - // - - // - // Report on each match. - for each (Match^ match in matches) - { - String^ word = match->Groups["word"]->Value; - int index = match->Index; - Console::WriteLine("{0} repeated at position {1}", word, index); - } - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp b/snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp deleted file mode 100644 index 2b2373c1b72..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -#using - -using namespace System; -using namespace Microsoft::Win32; -using namespace Microsoft::VisualBasic; - -int main() -{ - // Delete and recreate the test key. - Registry::CurrentUser->DeleteSubKey( L"RegistryOpenSubKeyExample", false ); - RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( L"RegistryOpenSubKeyExample" ); - rk->Close(); - - // Obtain an instance of RegistryKey for the CurrentUser registry - // root. - RegistryKey ^ rkCurrentUser = Registry::CurrentUser; - - // Obtain the test key (read-only) and display it. - RegistryKey ^ rkTest = rkCurrentUser->OpenSubKey( L"RegistryOpenSubKeyExample" ); - Console::WriteLine( L"Test key: {0}", rkTest ); - rkTest->Close(); - rkCurrentUser->Close(); - - // Obtain the test key in one step, using the CurrentUser registry - // root. - rkTest = Registry::CurrentUser->OpenSubKey( L"RegistryOpenSubKeyExample" ); - Console::WriteLine( L"Test key: {0}", rkTest ); - rkTest->Close(); - - // Open the test key in read/write mode. - rkTest = Registry::CurrentUser->OpenSubKey( L"RegistryOpenSubKeyExample", true ); - rkTest->SetValue( L"TestName", L"TestValue" ); - Console::WriteLine( L"Test value for TestName: {0}", rkTest->GetValue( L"TestName" ) ); - rkTest->Close(); - - return 0; -} //Main -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp deleted file mode 100644 index a7c67a66588..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp +++ /dev/null @@ -1,145 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace Microsoft::Win32; -using namespace System::Security::AccessControl; -using namespace System::Security; - -int main() -{ - // Delete the example key if it exists. - try - { - Registry::CurrentUser->DeleteSubKey("RegistryRightsExample"); - Console::WriteLine("Example key has been deleted."); - } - catch (ArgumentException^) - { - // ArgumentException is thrown if the key does not exist. In - // this case, there is no reason to display a message. - } - catch (InvalidOperationException^ ex) - { - Console::WriteLine( - "{0}Unable to delete key: it appears to have child subkeys:{0}{1}", - Environment::NewLine, ex); - return 0; - } - catch (SecurityException^ ex) - { - Console::WriteLine("{0}You do not have the permissions required " + - "to delete this key:{0}{1}", Environment::NewLine, ex); - return 0; - } - - String^ user = Environment::UserDomainName + "\\" + Environment::UserName; - - RegistrySecurity^ regSecurity = gcnew RegistrySecurity(); - - // Allow the current user to read and delete the key. - // - regSecurity->AddAccessRule(gcnew RegistryAccessRule(user, - RegistryRights::ReadKey | RegistryRights::Delete, - InheritanceFlags::None, - PropagationFlags::None, - AccessControlType::Allow)); - - // Prevent the current user from writing or changing the - // permission set of the key. Note that if Delete permission - // were not allowed in the previous access rule, denying - // WriteKey permission would prevent the user from deleting the - // key. - regSecurity->AddAccessRule(gcnew RegistryAccessRule(user, - RegistryRights::WriteKey | RegistryRights::ChangePermissions, - InheritanceFlags::None, - PropagationFlags::None, - AccessControlType::Deny)); - - // Create the example key with registry security. - RegistryKey^ createdKey = nullptr; - try - { - createdKey = Registry::CurrentUser->CreateSubKey( - "RegistryRightsExample", RegistryKeyPermissionCheck::Default, - regSecurity); - Console::WriteLine("{0}Example key created.", Environment::NewLine); - createdKey->SetValue("ValueName", "StringValue"); - } - catch (SecurityException^ ex) - { - Console::WriteLine("{0}You do not have the permissions required " + - "to create the example key:{0}{1}", Environment::NewLine, ex); - return 0; - } - if (createdKey != nullptr) - { - createdKey->Close(); - } - - RegistryKey^ openedKey; - - // Open the key with read access. - openedKey = Registry::CurrentUser->OpenSubKey("RegistryRightsExample", - false); - Console::WriteLine("{0}Retrieved value: {1}", - Environment::NewLine, openedKey->GetValue("ValueName")); - openedKey->Close(); - - // Attempt to open the key with write access. - try - { - openedKey = Registry::CurrentUser->OpenSubKey("RegistryRightsExample", - true); - } - catch (SecurityException^ ex) - { - Console::WriteLine("{0}You do not have the permissions required " + - "to write to the example key:{0}{1}", Environment::NewLine, ex); - } - if (openedKey != nullptr) - { - openedKey->Close(); - } - - // Attempt to change permissions for the key. - try - { - regSecurity = gcnew RegistrySecurity(); - regSecurity->AddAccessRule(gcnew RegistryAccessRule(user, - RegistryRights::WriteKey, - InheritanceFlags::None, - PropagationFlags::None, - AccessControlType::Allow)); - openedKey = Registry::CurrentUser->OpenSubKey("RegistryRightsExample", - false); - openedKey->SetAccessControl(regSecurity); - Console::WriteLine("{0}Example key permissions were changed.", - Environment::NewLine); - } - catch (UnauthorizedAccessException^ ex) - { - Console::WriteLine("{0}You are not authorized to change " + - "permissions for the example key:{0}{1}", Environment::NewLine, ex); - } - if (openedKey != nullptr) - { - openedKey->Close(); - } - - Console::WriteLine("{0}Press Enter to delete the example key.", - Environment::NewLine); - Console::ReadLine(); - - try - { - Registry::CurrentUser->DeleteSubKey("RegistryRightsExample"); - Console::WriteLine("Example key was deleted."); - } - catch(SecurityException^ ex) - { - Console::WriteLine("{0}You do not have the permissions required to " - + "delete the example key:{0}{1}", Environment::NewLine, ex); - } -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp b/snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp deleted file mode 100644 index ab2f233cbf5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -#using - -using namespace System; -using namespace Microsoft::Win32; -using namespace Microsoft::VisualBasic; - -int main() -{ - // Delete and recreate the test key. - Registry::CurrentUser->DeleteSubKey( L"RegistryValueOptionsExample", false ); - RegistryKey ^ rk = - Registry::CurrentUser->CreateSubKey( L"RegistryValueOptionsExample" ); - - // Add a value that contains an environment variable. - rk->SetValue( L"ExpandValue", L"The path is %PATH%", - RegistryValueKind::ExpandString ); - - // Retrieve the value, first without expanding the environment - // variable and then expanding it. - Console::WriteLine( L"Unexpanded: \"{0}\"", - rk->GetValue( L"ExpandValue", - L"No Value", - RegistryValueOptions::DoNotExpandEnvironmentNames ) ); - Console::WriteLine( L"Expanded: \"{0}\"", rk->GetValue( L"ExpandValue" ) ); - - return 0; -} //Main -// - diff --git a/snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp deleted file mode 100644 index 8810e3a661a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Security::Permissions; - -public ref class SetObjectUriForMarshalTest -{ -public: - ref class TestClass: public MarshalByRefObject{}; - - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::RemotingConfiguration)] - static void Main() - { - TestClass^ obj = gcnew TestClass; - RemotingServices::SetObjectUriForMarshal( obj, "testUri" ); - RemotingServices::Marshal(obj); - Console::WriteLine( RemotingServices::GetObjectUri( obj ) ); - } - -}; -// - -int main() -{ - SetObjectUriForMarshalTest::TestClass^ testerobject = gcnew SetObjectUriForMarshalTest::TestClass; - SetObjectUriForMarshalTest::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp b/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp deleted file mode 100644 index a3567246321..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Security::Permissions; -using namespace System::Collections; - -[Flags] - -public enum class MailslotPermissionAccess -{ - None = 0, - Send = 1 << 1, - Receive = 1 << 2 | MailslotPermissionAccess::Send -}; - - -[Serializable] -public ref class MailslotPermissionEntry -{ -private: - String^ name; - String^ machineName; - MailslotPermissionAccess permissionAccess; - -internal: - MailslotPermissionEntry( ResourcePermissionBaseEntry^ baseEntry ) - { - this->permissionAccess = (MailslotPermissionAccess)baseEntry->PermissionAccess; - this->name = baseEntry->PermissionAccessPath[ 0 ]->ToString(); - this->machineName = baseEntry->PermissionAccessPath[ 1 ]->ToString(); - } - - ResourcePermissionBaseEntry^ GetBaseEntry() - { - array^newStrings = {this->Name,this->MachineName}; - ResourcePermissionBaseEntry^ baseEntry = gcnew ResourcePermissionBaseEntry( (int)(this->PermissionAccess),newStrings ); - return baseEntry; - } - -public: - MailslotPermissionEntry( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName ) - { - this->permissionAccess = permissionAccess; - this->name = name; - this->machineName = machineName; - } - - property String^ Name - { - String^ get() - { - return this->name; - } - } - - property String^ MachineName - { - String^ get() - { - return this->machineName; - } - } - - property MailslotPermissionAccess PermissionAccess - { - MailslotPermissionAccess get() - { - return this->permissionAccess; - } - } -}; - - -[Serializable] -public ref class MailslotPermission: public ResourcePermissionBase -{ -private: - ArrayList^ innerCollection; - void SetNames() - { - this->PermissionAccessType = MailslotPermissionAccess::typeid; - array^newStrings = {"Name","Machine"}; - this->TagNames = newStrings; - } - - -internal: - void AddPermissionAccess( MailslotPermissionEntry^ entry ) - { - ResourcePermissionBase::AddPermissionAccess( entry->GetBaseEntry() ); - } - - void Clear() - { - ResourcePermissionBase::Clear(); - } - - void RemovePermissionAccess( MailslotPermissionEntry^ entry ) - { - ResourcePermissionBase::RemovePermissionAccess( entry->GetBaseEntry() ); - } - - -public: - MailslotPermission() - { - SetNames(); - } - - MailslotPermission( PermissionState state ) - : ResourcePermissionBase( state ) - { - SetNames(); - } - - // - MailslotPermission( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName ) - { - SetNames(); - this->AddPermissionAccess( gcnew MailslotPermissionEntry( permissionAccess,name,machineName ) ); - } - - MailslotPermission( array^permissionAccessEntries ) - { - SetNames(); - if ( permissionAccessEntries == nullptr ) - throw gcnew ArgumentNullException( "permissionAccessEntries" ); - - for ( int index = 0; index < permissionAccessEntries->Length; ++index ) - this->AddPermissionAccess( permissionAccessEntries[ index ] ); - } - // - - property ArrayList^ PermissionEntries - { - ArrayList^ get() - { - if ( this->innerCollection == nullptr ) - this->innerCollection = gcnew ArrayList; - - this->innerCollection->InsertRange( 0, safe_cast(ResourcePermissionBase::GetPermissionEntries()) ); - return this->innerCollection; - } - } -}; -// - -void main(){} diff --git a/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp deleted file mode 100644 index cb616efc570..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - - -class RijndaelMemoryExample -{ -public: - static array^ encryptStringToBytes_AES(String^ plainText, array^ Key, array^ IV) - { - // Check arguments. - if (!plainText || plainText->Length <= 0) - throw gcnew ArgumentNullException("plainText"); - if (!Key || Key->Length <= 0) - throw gcnew ArgumentNullException("Key"); - if (!IV || IV->Length <= 0) - throw gcnew ArgumentNullException("IV"); - - // Declare the streams used - // to encrypt to an in memory - // array of bytes. - MemoryStream^ msEncrypt; - CryptoStream^ csEncrypt; - StreamWriter^ swEncrypt; - - // Declare the RijndaelManaged object - // used to encrypt the data. - RijndaelManaged^ aesAlg; - - try - { - // Create a RijndaelManaged object - // with the specified key and IV. - aesAlg = gcnew RijndaelManaged(); - aesAlg->Padding = PaddingMode::PKCS7; - aesAlg->Key = Key; - aesAlg->IV = IV; - - // Create an encryptor to perform the stream transform. - ICryptoTransform^ encryptor = aesAlg->CreateEncryptor(aesAlg->Key, aesAlg->IV); - - // Create the streams used for encryption. - msEncrypt = gcnew MemoryStream(); - csEncrypt = gcnew CryptoStream(msEncrypt, encryptor, CryptoStreamMode::Write); - swEncrypt = gcnew StreamWriter(csEncrypt); - - //Write all data to the stream. - swEncrypt->Write(plainText); - swEncrypt->Flush(); - csEncrypt->FlushFinalBlock(); - msEncrypt->Flush(); - } - finally - { - // Clean things up. - - // Close the streams. - if(swEncrypt) - swEncrypt->Close(); - if (csEncrypt) - csEncrypt->Close(); - - - // Clear the RijndaelManaged object. - if (aesAlg) - aesAlg->Clear(); - } - - // Return the encrypted bytes from the memory stream. - return msEncrypt->ToArray(); - } - - static String^ decryptStringFromBytes_AES(array^ cipherText, array^ Key, array^ IV) - { - // Check arguments. - if (!cipherText || cipherText->Length <= 0) - throw gcnew ArgumentNullException("cipherText"); - if (!Key || Key->Length <= 0) - throw gcnew ArgumentNullException("Key"); - if (!IV || IV->Length <= 0) - throw gcnew ArgumentNullException("IV"); - - // TDeclare the streams used - // to decrypt to an in memory - // array of bytes. - MemoryStream^ msDecrypt; - CryptoStream^ csDecrypt; - StreamReader^ srDecrypt; - - // Declare the RijndaelManaged object - // used to decrypt the data. - RijndaelManaged^ aesAlg; - - // Declare the string used to hold - // the decrypted text. - String^ plaintext; - - try - { - // Create a RijndaelManaged object - // with the specified key and IV. - aesAlg = gcnew RijndaelManaged(); - aesAlg->Padding = PaddingMode::PKCS7; - aesAlg->Key = Key; - aesAlg->IV = IV; - - // Create a decryptor to perform the stream transform. - ICryptoTransform^ decryptor = aesAlg->CreateDecryptor(aesAlg->Key, aesAlg->IV); - - // Create the streams used for decryption. - msDecrypt = gcnew MemoryStream(cipherText); - csDecrypt = gcnew CryptoStream(msDecrypt, decryptor, CryptoStreamMode::Read); - srDecrypt = gcnew StreamReader(csDecrypt); - - // Read the decrypted bytes from the decrypting stream - // and place them in a string. - plaintext = srDecrypt->ReadToEnd(); - } - finally - { - // Clean things up. - - // Close the streams. - if (srDecrypt) - srDecrypt->Close(); - if (csDecrypt) - csDecrypt->Close(); - if (msDecrypt) - msDecrypt->Close(); - - // Clear the RijndaelManaged object. - if (aesAlg) - aesAlg->Clear(); - } - - return plaintext; - } -}; - -int main() -{ - try - { - String^ original = "Here is some data to encrypt!"; - - // Create a new instance of the RijndaelManaged - // class. This generates a new key and initialization - // vector (IV). - RijndaelManaged^ myRijndael = gcnew RijndaelManaged(); - - // Encrypt the string to an array of bytes. - array^ encrypted = RijndaelMemoryExample::encryptStringToBytes_AES(original, myRijndael->Key, myRijndael->IV); - - // Decrypt the bytes to a string. - String^ roundtrip = RijndaelMemoryExample::decryptStringFromBytes_AES(encrypted, myRijndael->Key, myRijndael->IV); - - //Display the original data and the decrypted data. - Console::WriteLine("Original: {0}", original); - Console::WriteLine("Round Trip: {0}", roundtrip); - } - catch (Exception^ e) - { - Console::WriteLine("Error: {0}", e->Message); - } - - return 0; -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp deleted file mode 100644 index 261c5964049..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsBoxed::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp deleted file mode 100644 index 6bcd696486c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsByValue::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp deleted file mode 100644 index 83156793bc8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsConst::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp deleted file mode 100644 index 80c5153f951..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsExplicitlyDereferenced::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.IntPtr"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp deleted file mode 100644 index d27a6c343f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsImplicitlyDereferenced::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.IntPtr"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp deleted file mode 100644 index a1de5c68353..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsLong::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Int64"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp deleted file mode 100644 index 93467c8949e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsPinned::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp deleted file mode 100644 index 0119caa3d48..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void main() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsSignUnspecifiedByte::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Byte"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp deleted file mode 100644 index b36907eae59..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::CompilerServices; -using namespace System::Threading; - - -ref class CodeEmitter -{ -private: - AssemblyBuilder^ asmBuilder; - String^ asmName; - ModuleBuilder^ modBuilder; - - - void prepareAssembly(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - asmName = name; - - // Create an AssemblyName object and set the name. - AssemblyName^ asmName = gcnew AssemblyName(); - - asmName->Name = name; - - // Use the AppDomain class to create an AssemblyBuilder instance. - - AppDomain^ currentDomain = Thread::GetDomain(); - - asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); - - // Create a dynamic module. - modBuilder = asmBuilder->DefineDynamicModule(name); - } - - -public: - - // Constructor. - CodeEmitter(String ^ AssemblyName){ - - prepareAssembly(AssemblyName); - } - - // Create a new type. - TypeBuilder^ CreateType(String^ name){ - - // Check the input. - if(!name){ - - throw gcnew ArgumentNullException("AssemblyName"); - } - - return modBuilder->DefineType( name ); - } - - // Write the assembly. - void WriteAssembly(MethodBuilder^ entryPoint){ - - // Check the input. - if(!entryPoint){ - - throw gcnew ArgumentNullException("entryPoint"); - } - - asmBuilder->SetEntryPoint( entryPoint ); - asmBuilder->Save( asmName ); - } - -}; - -void _tmain() -{ - - // Create a CodeEmitter to handle assembly creation. - CodeEmitter ^ e = gcnew CodeEmitter("programAssem.exe"); - - // Create a new type. - TypeBuilder^ mainClass = e->CreateType("MainClass"); - - // Create a new method. - MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); - - // Create an ILGenerator and emit IL for - // a simple "Hello World." program. - ILGenerator^ ilGen = mBuilder->GetILGenerator(); - - ilGen->Emit(OpCodes::Ldstr, "Hello World"); - - array^mType = {String::typeid}; - - MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); - - ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); - - ilGen->Emit( OpCodes::Ret ); - - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - // Apply a required custom modifier - // to a field. - ///////////////////////////////////////////////// - ///////////////////////////////////////////////// - - array^fType = {IsUdtReturn::typeid}; - - mainClass->DefineField("modifiedInteger", Type::GetType("System.Type"), fType, nullptr, FieldAttributes::Private); - - // Create the type. - mainClass->CreateType(); - - // Write the assembly using a reference to - // the entry point. - e->WriteAssembly(mBuilder); - - Console::WriteLine(L"Assembly created."); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp deleted file mode 100644 index 19e9aa78fb8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged c string. - const char * myString = "Hello managed world (from the unmanaged world)!"; - - // Convert the c string to a managed String. - String ^ myManagedString = Marshal::PtrToStringAnsi((IntPtr) (char *) myString); - - // Display the string to the console. - Console::WriteLine(myManagedString); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp deleted file mode 100644 index 5014e38232f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -void main() -{ - // Create an unmanaged c string. - const char * myString = "Hello managed world (from the unmanaged world)!"; - - // Convert the c string to a managed String. - String ^ myManagedString = Marshal::PtrToStringAnsi((IntPtr) (char *) myString); - - // Display the string to the console. - Console::WriteLine(myManagedString); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp deleted file mode 100644 index 8ae9ef7be08..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// - -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged byte. - const char * myString = "bB"; - - // Read the second character of the c string as a managed byte. - Byte ^ myManagedByte = Marshal::ReadByte((IntPtr) (char *) myString, 1); - - // Display the byte to the console. - Console::WriteLine(myManagedByte); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp deleted file mode 100644 index ef30a93a73e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// - -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged byte. - const char * myString = "b"; - - // Read the c string as a managed byte. - Byte ^ myManagedByte = Marshal::ReadByte((IntPtr) (char *) myString); - - // Display the byte to the console. - Console::WriteLine(myManagedByte); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp deleted file mode 100644 index cd13dbea9ba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// - -using namespace System; -using namespace System::Runtime::InteropServices; - -void main() -{ - // Create an unmanaged short pointer. - short * myShort; - short tmp = 42; - // Initialize it to another value. - myShort = &tmp; - - // Read value as a managed Int16. - Int16 ^ myManagedVal = Marshal::ReadInt16((IntPtr) myShort, 0); - - // Display the value to the console. - Console::WriteLine(myManagedVal); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp deleted file mode 100644 index 5c4fa47e54d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// - -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged short. - short myShort = 42; - - // Read the short as a managed Int16. - Int16 ^ myManagedVal = Marshal::ReadInt16((IntPtr) &myShort); - - // Display the value to the console. - Console::WriteLine(myManagedVal); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp deleted file mode 100644 index 914ec7fc2b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged int pointer. - int * myVal; - int tmp = 42; - // Initialize it to another value. - myVal = &tmp; - - // Read value as a managed Int32. - Int32 ^ myManagedVal = Marshal::ReadInt32((IntPtr) myVal, 0); - - // Display the value to the console. - Console::WriteLine(myManagedVal); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp deleted file mode 100644 index 2179d45c1c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged integer. - int myVal = 42; - - // Read the int as a managed Int32. - Int32 ^ myManagedVal = Marshal::ReadInt32((IntPtr) &myVal); - - // Display the value to the console. - Console::WriteLine(myManagedVal); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp deleted file mode 100644 index 0a92279d908..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// - -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged __int64 pointer. - __int64 * myVal; - __int64 tmp = 42; - // Initialize it to another value. - myVal = &tmp; - - // Read value as a managed Int64. - Int64 ^ myManagedVal = Marshal::ReadInt64((IntPtr) myVal, 0); - - // Display the value to the console. - Console::WriteLine(myManagedVal); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp deleted file mode 100644 index 3161dd47176..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - - - -void main() -{ - // Create an unmanaged __int64. - __int64 myVal = 42; - - // Read the value as a managed Int64. - Int64 ^ myManagedVal = Marshal::ReadInt64((IntPtr) &myVal); - - // Display the value to the console. - Console::WriteLine(myManagedVal); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp deleted file mode 100644 index c749e16e7aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -#include // for printf - - -int main() -{ - // Create a managed string. - String^ managedString = "Hello unmanaged world (from the managed world)."; - - // Marshal the managed string to unmanaged memory. - char* stringPointer = (char*) Marshal::StringToHGlobalAnsi(managedString ).ToPointer(); - - printf("stringPointer = %s\n", stringPointer); - - // Always free the unmanaged string. - Marshal::FreeHGlobal(IntPtr(stringPointer)); - - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp deleted file mode 100644 index ca8439537a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -int main() -{ - // Create a managed string. - String^ managedString = "Hello unmanaged world (from the managed world)."; - - // Marshal the managed string to unmanaged memory. - char* stringPointer = (char*) Marshal::StringToHGlobalAuto(managedString).ToPointer(); - - // Pass the string to an unmanaged API. - - // Always free the unmanaged string. - Marshal::FreeHGlobal(IntPtr(stringPointer)); - - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp b/snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp deleted file mode 100644 index 24d170d28cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp +++ /dev/null @@ -1,46 +0,0 @@ -//Types:System.Runtime.InteropServices.RuntimeEnvironment -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -int main() -{ - // - // Show whether the EXE assembly was loaded from the GAC or from a - // private subdirectory. - Console::WriteLine("Did the {0} assembly load from the GAC? {1}", - Assembly::GetExecutingAssembly(), - RuntimeEnvironment::FromGlobalAccessCache( - Assembly::GetExecutingAssembly())); - // - - // - // Show the path where the CLR was loaded from. - Console::WriteLine("Runtime directory: {0}", - RuntimeEnvironment::GetRuntimeDirectory()); - // - - // - // Show the CLR's version number. - Console::WriteLine("System version: {0}", - RuntimeEnvironment::GetSystemVersion()); - // - - // - // Show the path of the machine's configuration file. - Console::WriteLine("System configuration file: {0}", - RuntimeEnvironment::SystemConfigurationFile); - // -} - -// This code produces the following output. -// -// Did the RuntimeEnvironment, Version=0.0.0.0, Culture=neutral, -// PublicKeyToken=null -// assembly load from the GAC? False -// Runtime directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\ -// System version: v2.0.40607 -// System configuration file: -// C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\config\machine.config -// diff --git a/snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp b/snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp deleted file mode 100644 index bdc5fda9a9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// -using namespace System; -using namespace System::Security; - -void main() -{ - String^ msg = L" The current length of the SecureString object: {0}\n"; - SecureString ^ ss = gcnew SecureString; - - Console::WriteLine(L"1) Instantiate the SecureString object:"); - Console::WriteLine(msg, ss->Length ); - - Console::WriteLine(L"2) Append 'a' to the value:"); - ss->AppendChar('a'); - Console::WriteLine(msg, ss->Length ); - - Console::WriteLine(L"3) Append 'X' to the value:"); - ss->AppendChar('X'); - Console::WriteLine(msg, ss->Length); - - Console::WriteLine(L"4) Append 'c' to the value:"); - ss->AppendChar('c'); - Console::WriteLine(msg, ss->Length); - - Console::WriteLine(L"5) Insert 'd' at the end of the value:"); - ss->InsertAt(ss->Length, 'd'); - Console::WriteLine(msg, ss->Length); - - Console::WriteLine(L"6) Remove the last character ('d') from the value:"); - ss->RemoveAt(3); - Console::WriteLine(msg, ss->Length); - - Console::WriteLine(L"7) Set the second character ('X') of the value to 'b':" ); - ss->SetAt(1, 'b'); - Console::WriteLine(msg, ss->Length ); - - Console::WriteLine(L"8) Delete the value of the SecureString object:"); - ss->Clear(); - Console::WriteLine(msg, ss->Length); - - delete ss; -} - -/* -This code example produces the following results: - -This example demonstrates the effect of the AppendChar, InsertAt, -RemoveAt, SetAt, and Clear methods on the value of a SecureString -object. This example simulates the value of the object because the -actual value is encrypted. - -1) The initial value of the SecureString object: - SecureString = "" - Length = 0 - -2) AppendChar: Append 'a' to the value: - SecureString = "a" - Length = 1 - -3) AppendChar: Append 'X' to the value: - SecureString = "aX" - Length = 2 - -4) AppendChar: Append 'c' to the value: - SecureString = "aXc" - Length = 3 - -5) InsertAt: Insert 'd' at the end of the value (equivalent - to AppendChar): - SecureString = "aXcd" - Length = 4 - -6) RemoveAt: Remove the last character ('d') from the value: - SecureString = "aXc" - Length = 3 - -7) SetAt: Set the second character ('X') of the value to 'b': - SecureString = "abc" - Length = 3 - -8) Clear: Delete the value of the SecureString object: - SecureString = "" - Length = 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp b/snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp deleted file mode 100644 index 4a5db9f067c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp +++ /dev/null @@ -1,62 +0,0 @@ - -// -using namespace System; -using namespace System::Security; - -void main() -{ - bool go = true; - ConsoleKeyInfo cki; - String^ m = L"\nEnter your password (up to 15 letters, numbers, and underscores)\n" - L"Press BACKSPACE to delete the last character entered. " + - L"\nPress Enter when done, or ESCAPE to quit:"; - SecureString ^ password = gcnew SecureString; - int top; - int left; - - // The Console.TreatControlCAsInput property prevents CTRL+C from - // ending this example. - Console::TreatControlCAsInput = true; - - Console::Clear(); - Console::WriteLine(m); - - top = Console::CursorTop; - left = Console::CursorLeft; - - do { - cki = Console::ReadKey(true); - if (cki.Key == ConsoleKey::Escape) - break; - - if (cki.Key == ConsoleKey::Backspace){ - if (password->Length > 0) { - Console::SetCursorPosition(left + password->Length - 1, top); - Console::Write(' '); - Console::SetCursorPosition(left + password->Length - 1, top); - password->RemoveAt(password->Length - 1); - } - } - else { - if ((password->Length < 15) && - (Char::IsLetterOrDigit( cki.KeyChar ) || - cki.KeyChar == '_') ) { - password->AppendChar( cki.KeyChar ); - Console::SetCursorPosition( left + password->Length - 1, top ); - Console::Write("*"); - } - } - } while (cki.Key != ConsoleKey::Enter & password->Length < 15); - - // Make the password read-only to prevent modification. - password->MakeReadOnly(); - // Dispose of the SecureString instance. - delete password; - -} -// The example displays output like the following: -// Enter your password (up to 15 letters, numbers, and underscores) -// Press BACKSPACE to delete the last character entered. -// Press Enter when done, or ESCAPE to quit: -// ************ -// diff --git a/snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp b/snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp deleted file mode 100644 index 51ea424f825..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp +++ /dev/null @@ -1,290 +0,0 @@ - -// This sample demonstrates how to use members of the SecurityElement class. -// The sample creates a SecurityElement for the root of the XML tree and -// demonstrates how to add attributes and child elements. -// -using namespace System; -using namespace System::Security; -using namespace System::Collections; -ref class SecurityElementMembers -{ -public: - - [STAThread] - int TestSecurityElementMembers() - { - // - SecurityElement^ xmlRootElement = gcnew SecurityElement( L"RootTag",L"XML security tree" ); - // - - AddAttribute( xmlRootElement, L"creationdate", DateTime::Now.ToString() ); - AddChildElement( xmlRootElement, L"destroytime", DateTime::Now.AddSeconds( 1.0 ).ToString() ); - - // - SecurityElement^ windowsRoleElement = gcnew SecurityElement( L"WindowsMembership.WindowsRole" ); - // - - // - windowsRoleElement->AddAttribute( L"version", L"1.00" ); - // - - // Add a child element and a creationdate attribute. - AddChildElement( windowsRoleElement, L"BabyElement", L"This is a child element" ); - AddAttribute( windowsRoleElement, L"creationdate", DateTime::Now.ToString() ); - - // - xmlRootElement->AddChild( windowsRoleElement ); - // - - CompareAttributes( xmlRootElement, L"creationdate" ); - ConvertToHashTable( xmlRootElement ); - DisplaySummary( xmlRootElement ); - - // Determine if the security element is too old to keep. - xmlRootElement = DestroyTree( xmlRootElement ); - if ( xmlRootElement != nullptr ) - { - // - String^ elementInXml = xmlRootElement->ToString(); - // - - Console::WriteLine( elementInXml ); - } - - Console::WriteLine( L"This sample completed successfully; " - L"press Enter to exit." ); - Console::ReadLine(); - return 1; - } - - -private: - - // Add an attribute to the specified security element. - static SecurityElement^ AddAttribute( SecurityElement^ xmlElement, String^ attributeName, String^ attributeValue ) - { - if ( xmlElement != nullptr ) - { - // Verify that the attribute name and value are valid XML formats. - // - // - if ( SecurityElement::IsValidAttributeName( attributeName ) && - SecurityElement::IsValidAttributeValue( attributeValue ) ) - // - // - { - // Add the attribute to the security element. - // - xmlElement->AddAttribute( attributeName, attributeValue ); - // - } - } - - return xmlElement; - } - - - // Add a child element to the specified security element. - static SecurityElement^ AddChildElement( SecurityElement^ parentElement, String^ tagName, String^ tagText ) - { - if ( parentElement != nullptr ) - { - // Ensure that the tag text is in valid XML format. - // - if ( !SecurityElement::IsValidText( tagText ) ) - // - { - // Replace invalid text with valid XML text - // to enforce proper XML formatting. - // - tagText = SecurityElement::Escape( tagText ); - // - } - - // Determine whether the tag is in valid XML format. - // - if ( SecurityElement::IsValidTag( tagName ) ) - // - { - // - SecurityElement^ childElement; - childElement = parentElement->SearchForChildByTag( tagName ); - // - if ( childElement != nullptr ) - { - // - String^ elementText; - elementText = parentElement->SearchForTextOfTag( tagName ); - // - if ( !elementText->Equals( tagText ) ) - { - // Add child element to the parent security element. - parentElement->AddChild( gcnew SecurityElement( tagName,tagText ) ); - } - } - else - { - // Add child element to the parent security element. - parentElement->AddChild( gcnew SecurityElement( tagName,tagText ) ); - } - } - } - - return parentElement; - } - - - // Create and display a summary sentence - // about the specified security element. - static void DisplaySummary( SecurityElement^ xmlElement ) - { - // Retrieve tag name for the security element. - // - String^ xmlTreeName = xmlElement->Tag->ToString(); - // - // Retrieve tag text for the security element. - // - String^ xmlTreeDescription = xmlElement->Text; - // - // Retrieve value of the creationdate attribute. - // - String^ xmlCreationDate = xmlElement->Attribute(L"creationdate"); - // - // Retrieve the number of children under the security element. - // - String^ childrenCount = xmlElement->Children->Count.ToString(); - // - String^ outputMessage = String::Format( L"The security XML tree named {0}", xmlTreeName ); - outputMessage = String::Concat( outputMessage, String::Format( L"({0})", xmlTreeDescription ) ); - outputMessage = String::Concat( outputMessage, String::Format( L" was created on {0} and ", xmlCreationDate ) ); - outputMessage = String::Concat( outputMessage, String::Format( L"contains {0} child elements.", childrenCount ) ); - Console::WriteLine( outputMessage ); - } - - // Compare the first two occurrences of an attribute - // in the specified security element. - static void CompareAttributes( SecurityElement^ xmlElement, String^ attributeName ) - { - // Create a hash table containing the security element's attributes. - // - Hashtable^ attributeKeys = xmlElement->Attributes; - String^ attributeValue = attributeKeys[ attributeName ]->ToString(); - // - IEnumerator^ myEnum = xmlElement->Children->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - SecurityElement^ xmlChild = safe_cast(myEnum->Current); - if ( attributeValue->Equals( xmlChild->Attribute(attributeName) ) ) - { - // The security elements were created at the exact same time. - } - } - } - - // Convert the contents of the specified security element - // to hash codes stored in a hash table. - static void ConvertToHashTable( SecurityElement^ xmlElement ) - { - // Create a hash table to hold hash codes of the security elements. - // - Hashtable^ xmlAsHash = gcnew Hashtable; - int rootIndex = xmlElement->GetHashCode(); - xmlAsHash->Add( rootIndex, L"root" ); - // - int parentNum = 0; - IEnumerator^ myEnum1 = xmlElement->Children->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - SecurityElement^ xmlParent = safe_cast(myEnum1->Current); - parentNum++; - xmlAsHash->Add( xmlParent->GetHashCode(), String::Format( L"parent{0}", parentNum ) ); - if ( (xmlParent->Children != nullptr) && (xmlParent->Children->Count > 0) ) - { - int childNum = 0; - IEnumerator^ myEnum2 = xmlParent->Children->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - SecurityElement^ xmlChild = safe_cast(myEnum2->Current); - childNum++; - xmlAsHash->Add( xmlChild->GetHashCode(), String::Format( L"child{0}", childNum ) ); - } - } - } - } - - // Delete the specified security element if the current time is past - // the time stored in the destroytime tag. - static SecurityElement^ DestroyTree( SecurityElement^ xmlElement ) - { - SecurityElement^ localXmlElement = xmlElement; - SecurityElement^ destroyElement = localXmlElement->SearchForChildByTag( L"destroytime" ); - - // Verify that a destroytime tag exists. - // - if ( localXmlElement->SearchForChildByTag( L"destroytime" ) != nullptr ) - // - { - // Retrieve the destroytime text to get the time - // the tree can be destroyed. - // - String^ storedDestroyTime = localXmlElement->SearchForTextOfTag( L"destroytime" ); - // - DateTime destroyTime = DateTime::Parse( storedDestroyTime ); - if ( DateTime::Now > destroyTime ) - { - localXmlElement = nullptr; - Console::WriteLine( L"The XML security tree has been deleted." ); - } - } - - - // Verify that xmlElement is of type SecurityElement. - // - if ( xmlElement->GetType()->Equals( System::Security::SecurityElement::typeid ) ) - // - { - // Determine whether the localXmlElement object - // differs from xmlElement. - // - if ( xmlElement->Equals( localXmlElement ) ) - // - { - // Verify that the tags, attributes and children of the - // two security elements are identical. - // - if ( xmlElement->Equal( localXmlElement ) ) - // - { - // Return the original security element. - return xmlElement; - } - } - } - - // Return the modified security element. - return localXmlElement; - } - -}; - -int main() -{ - SecurityElementMembers^ sem = gcnew SecurityElementMembers; - sem->TestSecurityElementMembers(); -} - -// -// This sample produces the following output: -// -// The security XML tree named RootTag(XML security tree) -// was created on 2/23/2004 1:23:00 PM and contains 2 child elements. -//XML security tree -// 2/23/2004 1:23:01 PM -// -// This is a child element. -// -// -// -//This sample completed successfully; press Exit to continue. -// diff --git a/snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp b/snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp deleted file mode 100644 index 937d62b4562..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp +++ /dev/null @@ -1,344 +0,0 @@ -// System.ServiceProcess.ServiceController -// -// The following example application performs basic service queries/commands. -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Data; -using namespace System::ServiceProcess; -using namespace System::Management; - -namespace ServiceControllerSample -{ - public ref class ServiceControllerInfo - { - public: - ServiceControllerInfo() - { - // Constructor... - } - - public: - ~ServiceControllerInfo() - { - // destructor... - } - - public: - static void Main() - { - try - { - // This is a simple interface for exercising the snippet code. - Console::WriteLine( "Service options:" ); - Console::WriteLine( " 1. Ensure the Alerter service is started" ); - Console::WriteLine( " 2. Toggle the Telnet service state (stop/start)" ); - Console::WriteLine( " 3. List services dependent on the Event Log service" ); - Console::WriteLine( " 4. List services that the Messenger service depends on" ); - Console::WriteLine( " 5. List device driver services on this computer" ); - Console::WriteLine( " 6. List the running services on this computer" ); - Console::WriteLine( "Enter the desired option (or any other key to quit): " ); - - // Get the input number. - String^ inputText = Console::ReadLine(); - int inputNum = 0; - if ( (inputText) && (inputText->Length > 0) ) - { - inputNum = Int32::Parse( inputText ); - } - - // Perform the requested option. - switch ( inputNum ) - { - case 1: - CheckAlerterServiceStarted(); - break; - - case 2: - ToggleTelNetServiceState(); - break; - - case 3: - CheckDependenciesOnEventLogService(); - break; - - case 4: - CheckMessengerServiceDependencies(); - break; - - case 5: - ListDeviceDriverServices(); - break; - - case 6: - ListRunningServices(); - break; - - default: - - // Quit if input was any other key. - break; - } - } - catch ( Object^ e ) - { - Console::WriteLine( "Exception:" ); - Console::WriteLine( e->ToString() ); - } - - } - - private: - static void CheckAlerterServiceStarted() - { - // The following example uses the ServiceController class to - // check whether the Alerter service is stopped. If the service is - // stopped, the example starts the service and waits until - // the service status is set to "Running". - // - // Check whether the Alerter service is started. - ServiceController^ sc = gcnew ServiceController; - if ( sc ) - { - sc->ServiceName = "Alerter"; - Console::WriteLine( "The Alerter service status is currently set to {0}", sc->Status ); - if ( sc->Status == (ServiceControllerStatus::Stopped) ) - { - // Start the service if the current status is stopped. - Console::WriteLine( "Starting the Alerter service..." ); - try - { - // Start the service, and wait until its status is "Running". - sc->Start(); - sc->WaitForStatus( ServiceControllerStatus::Running ); - - // Display the current service status. - Console::WriteLine( "The Alerter service status is now set to {0}.", sc->Status ); - } - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( "Could not start the Alerter service." ); - } - } - } - // - } - - static void ToggleTelNetServiceState() - { - // The following example uses the ServiceController class to - // check the current status of the TelNet service. - // If the service is stopped, the example starts the service. - // If the service is running, the example stops the service. - Console::WriteLine(); - - // - // Toggle the Telnet service - - // If it is started (running, paused, etc), stop the service. - // If it is stopped, start the service. - ServiceController^ sc = gcnew ServiceController( "Telnet" ); - if ( sc ) - { - Console::WriteLine( "The Telnet service status is currently set to {0}", sc->Status ); - if ( (sc->Status == (ServiceControllerStatus::Stopped) ) || (sc->Status == (ServiceControllerStatus::StopPending) ) ) - { - // Start the service if the current status is stopped. - Console::WriteLine( "Starting the Telnet service..." ); - sc->Start(); - } - else - { - // Stop the service if its status is not set to "Stopped". - Console::WriteLine( "Stopping the Telnet service..." ); - sc->Stop(); - } - - // Refresh and display the current service status. - sc->Refresh(); - Console::WriteLine( "The Telnet service status is now set to {0}.", sc->Status ); - // - } - } - - static void CheckDependenciesOnEventLogService() - { - Console::WriteLine(); - - // The following example uses the ServiceController class to - // display the set of services that are dependent on the - // Event Log service. - // - ServiceController^ sc = gcnew ServiceController( "Event Log" ); - array^scServices = nullptr; - if ( sc ) - { - scServices = sc->DependentServices; - } - - if ( sc && scServices ) - { - // Display the list of services dependent on the Event Log service. - if ( scServices->Length == 0 ) - { - Console::WriteLine( "There are no services dependent on {0}", sc->ServiceName ); - } - else - { - Console::WriteLine( "Services dependent on {0}:", sc->ServiceName ); - for each (ServiceController^ scTemp in scServices) - { - Console::WriteLine(" {0}", scTemp->DisplayName); - } - } - } - // - } - - static void CheckMessengerServiceDependencies() - { - // The following example uses the ServiceController class to - // display the set of services that the "Messenger" service - // is dependent on. - Console::WriteLine(); - - // - ServiceController^ sc = gcnew ServiceController( "Messenger" ); - array^scServices = nullptr; - if ( sc ) - { - scServices = sc->ServicesDependedOn; - } - - if ( sc && scServices ) - { - // Display the services that the Messenger service is dependent on. - if ( scServices->Length == 0 ) - { - Console::WriteLine( "{0} service is not dependent on any other services.", sc->ServiceName ); - } - else - { - Console::WriteLine( "{0} service is dependent on the following:", sc->ServiceName ); - for each (ServiceController^ scTemp in scServices) - { - Console::WriteLine(" {0}", scTemp->DisplayName); - } - } - } - // - } - - static void ListDeviceDriverServices() - { - // The following example uses the ServiceController class to - // display the device driver services on the local computer. - Console::WriteLine(); - - // - array^scDevices = ServiceController::GetDevices(); - if ( scDevices->Length ) - { - int numAdapter = 0,numFileSystem = 0,numKernel = 0,numRecognizer = 0; - - // Display the list of device driver services. - Console::WriteLine( "Device driver services on the local computer:" ); - - for each (ServiceController^ scTemp in scDevices) - { - // Display the status and the service name, for example, - // [Running] PCI Bus Driver - // Type = KernelDriver - Console::WriteLine( " [{0}] {1}", scTemp->Status, scTemp->DisplayName ); - Console::WriteLine( " Type = {0}", scTemp->ServiceType ); - - // Update counters using the service type bit flags. - if ( (scTemp->ServiceType & ServiceType::Adapter) != (ServiceType)0 ) - { - numAdapter++; - } - if ( (scTemp->ServiceType & ServiceType::FileSystemDriver) != (ServiceType)0 ) - { - numFileSystem++; - } - if ( (scTemp->ServiceType & ServiceType::KernelDriver) != (ServiceType)0 ) - { - numKernel++; - } - if ( (scTemp->ServiceType & ServiceType::RecognizerDriver) != (ServiceType)0 ) - { - numRecognizer++; - } - } - Console::WriteLine(); - Console::WriteLine( "Total of {0} device driver services", scDevices->Length.ToString() ); - Console::WriteLine( " {0} are adapter drivers", numAdapter.ToString() ); - Console::WriteLine( " {0} are file system drivers", numFileSystem.ToString() ); - Console::WriteLine( " {0} are kernel drivers", numKernel.ToString() ); - Console::WriteLine( " {0} are file system recognizer drivers", numRecognizer.ToString() ); - // - } - } - - static void ListRunningServices() - { - // The following example uses the ServiceController class to - // display the services that are running on the local computer. - Console::WriteLine(); - - // - array^scServices = ServiceController::GetServices(); - - // Display the list of services currently running on this computer. - Console::WriteLine( "Services running on the local computer:" ); - for each (ServiceController^ scTemp in scServices) - { - if ( scTemp->Status == ServiceControllerStatus::Running ) - { - // Write the service name and the display name - // for each running service. - Console::WriteLine(); - Console::WriteLine( " Service : {0}", scTemp->ServiceName ); - Console::WriteLine( " Display name: {0}", scTemp->DisplayName ); - - // Query WMI for additional information about this service. - // Display the start name (LocalSystem, etc) and the service - // description. - ManagementObject^ wmiService; - String^ objPath; - objPath = String::Format( "Win32_Service.Name='{0}'", scTemp->ServiceName ); - wmiService = gcnew ManagementObject( objPath ); - if ( wmiService ) - { - wmiService->Get(); - Object^ objStartName = wmiService["StartName"]; - Object^ objDescription = wmiService["Description"]; - if ( objStartName ) - { - Console::WriteLine( " Start name: {0}", objStartName->ToString() ); - } - if ( objDescription ) - { - Console::WriteLine( " Description: {0}", objDescription->ToString() ); - } - } - } - } - // - } - }; -} - -// end of class -// end of namespace -/// The main entry point for the application. - -[STAThread] -int main() -{ - ServiceControllerSample::ServiceControllerInfo::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp deleted file mode 100644 index 178337b709c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp +++ /dev/null @@ -1,372 +0,0 @@ -#using -#using -#using -#using -#using -#using -#using - -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Data; -using namespace System::Globalization; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; -using namespace System::ServiceProcess; -using namespace System::ServiceProcess::Design; -using namespace System::Management; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class ServiceChange -{ -public: - - // Define the console application entry point. - - [STAThread] - static void ConsoleTestMain() - { - ServiceController^ sc = gcnew ServiceController; - Console::WriteLine( "Query by service name or display name [S|D]:" ); - String^ inputText = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); - String^ serviceInput = ""; - if ( inputText->Equals( "S" ) ) - { - Console::WriteLine( "Enter the service name:" ); - serviceInput = Console::ReadLine()->ToLower(); - if ( serviceInput->Length > 0 ) - { - sc->ServiceName = serviceInput; - } - } - - if ( inputText->Equals( "D" ) ) - { - Console::WriteLine( "Enter the service display name:" ); - serviceInput = Console::ReadLine(); - if ( serviceInput->Length > 0 ) - { - sc->DisplayName = serviceInput; - } - } - else - { - // Quit if input was any other key. - } - - String^ scInfo; - if ( QueryService( &sc, &scInfo ) ) - { - Console::WriteLine( scInfo ); - Console::WriteLine( "Would you like to change the service start mode [Y|N]:" ); - inputText = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); - if ( inputText->Equals( "Y" ) ) - { - Console::WriteLine( "Enter the new start mode [Auto|Manual|Disabled]:" ); - serviceInput = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); - if ( serviceInput->Length > 0 ) - { - ChangeServiceStartMode( &sc, serviceInput, &scInfo ); - } - } - } - } - - static bool QueryService( interior_ptr sc, [Out]interior_ptr scInfo ) - { - bool serviceValid = false; - *scInfo = ""; - try - { - if ( (( *sc)->ServiceName->Length > 0) || (( *sc)->DisplayName->Length > 0) ) - { - ( *sc)->Refresh(); - - // Display information about this service. - *scInfo = String::Concat( String::Concat( *scInfo, Environment::NewLine ), String::Concat( "Service name:\t", ( *sc)->ServiceName, Environment::NewLine ), String::Concat( "Display name:\t", ( *sc)->DisplayName, Environment::NewLine ), String::Concat( "Service type:\t", ( *sc)->ServiceType, Environment::NewLine ), String::Concat( "Status:\t\t", ( *sc)->Status, Environment::NewLine ) ); - serviceValid = true; - - // Query WMI for additional information about this service. - ManagementObject^ wmiService; - wmiService = gcnew ManagementObject( String::Format( "Win32_Service.Name='{0}'", ( *sc)->ServiceName ) ); - wmiService->Get(); - *scInfo = String::Concat( *scInfo, String::Concat( "Start name:\t", wmiService[ "StartName" ], Environment::NewLine ), String::Concat( "Start mode:\t", wmiService[ "StartMode" ], Environment::NewLine ), String::Concat( "Service path:\t", wmiService[ "PathName" ], Environment::NewLine ), String::Concat( "Description:\t", wmiService[ "Description" ], Environment::NewLine ) ); - } - } - catch ( InvalidOperationException^ ) - { - serviceValid = false; - *scInfo = ""; - } - - return serviceValid; - } - - static bool ChangeServiceStartMode( interior_ptr sc, String^ startMode, [Out]interior_ptr scInfo ) - { - bool startModeChanged = false; - ManagementObject^ wmiService; - wmiService = gcnew ManagementObject( String::Format( "Win32_Service.Name='{0}'", ( *sc)->ServiceName ) ); - wmiService->Get(); - String^ origStartMode = wmiService[ "StartMode" ]->ToString(); - *scInfo = ""; - startMode = startMode->ToUpper( CultureInfo::InvariantCulture ); - if ( startMode->Equals( "AUTO" ) || startMode->Equals( "MANUAL" ) || startMode->Equals( "DISABLED" ) ) - { - if ( startMode->Equals( origStartMode->ToUpper( CultureInfo::InvariantCulture ) ) ) - { - *scInfo = String::Format( "{0}Requested mode is the same as the current mode; no change necessary.{1}", *scInfo, Environment::NewLine ); - } - else - { - // Change the start mode to requested value. - *scInfo = String::Format( "{0}Setting service start mode to {1}...{2}", *scInfo, startMode, Environment::NewLine ); - - // See Win32_Service schema for ChangeStartMode input values. - array^startArgs = {startMode}; - Object^ retVal; - retVal = wmiService->InvokeMethod( "ChangeStartMode", startArgs ); - if ( !retVal->ToString()->Equals( "0" ) ) - { - *scInfo = String::Format( "{0}Warning: Win32_Service.ChangeStartMode failed with return value {1}{2}", *scInfo, retVal->ToString(), Environment::NewLine ); - } - else - { - *scInfo = String::Concat( String::Format( "{0}Service {1} start mode changed to {2}{3}", *scInfo, ( *sc)->ServiceName, startMode ), Environment::NewLine ); - } - } - } - else - { - *scInfo = String::Format( "{0}Invalid start mode.{1}", *scInfo, Environment::NewLine ); - } - - return startModeChanged; - } - - // - // Prompt the user for service installation account values. -public: - static bool GetServiceAccount( interior_ptr svcInst ) - { - bool accountSet = false; - ServiceInstallerDialog^ svcDialog = gcnew ServiceInstallerDialog; - - // Query the user for the service account type. - do - { - svcDialog->TopMost = true; - svcDialog->ShowDialog(); - if ( svcDialog->Result == ServiceInstallerDialogResult::OK ) - { - // Do a very simple validation on the user - // input. Check to see whether the user name - // or password is blank. - if ( (svcDialog->Username->Length > 0) && (svcDialog->Password->Length > 0) ) - { - // Use the account and password. - accountSet = true; - ( *svcInst)->Account = ServiceAccount::User; - ( *svcInst)->Username = svcDialog->Username; - ( *svcInst)->Password = svcDialog->Password; - } - } - else - if ( svcDialog->Result == ServiceInstallerDialogResult::UseSystem ) - { - ( *svcInst)->Account = ServiceAccount::LocalSystem; - ( *svcInst)->Username = nullptr; - ( *svcInst)->Password = nullptr; - accountSet = true; - } - - if ( !accountSet ) - { - // Display a message box. Tell the user to - // enter a valid user and password, or cancel - // out to leave the service account alone. - DialogResult result; - result = MessageBox::Show( "Invalid user name or password for service installation." - " Press Cancel to leave the service account unchanged.", "Change Service Account", - MessageBoxButtons::OKCancel, MessageBoxIcon::Hand ); - if ( result == DialogResult::Cancel ) - { - // Break out of loop. - break; - } - } - } - while ( !accountSet ); - - return accountSet; - } - // -}; - -public ref class ServiceSampleForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ query_button; - System::Windows::Forms::Button^ startMode_button; - System::Windows::Forms::Button^ changeMode_button; - System::Windows::Forms::Button^ startName_button; - System::Windows::Forms::TextBox^ textBox; - System::Windows::Forms::Label ^ modeLabel; - System::Windows::Forms::ComboBox^ modeComboBox; - ServiceController^ currentService; - void query_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - textBox->Text = "Querying service configuration..."; - String^ scInfo; - currentService->DisplayName = "TelNet"; - if ( ServiceChange::QueryService( ¤tService, &scInfo ) ) - { - textBox->Text = scInfo; - this->startName_button->Enabled = true; - this->startMode_button->Enabled = true; - this->modeLabel->Visible = true; - this->modeComboBox->Visible = true; - } - else - { - textBox->Text = "Could not read configuration information for service."; - } - } - - void startMode_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - String^ scInfo; - String^ wmiStartMode = ""; - if ( this->modeComboBox->SelectedItem->ToString()->Equals( "Automatic" ) ) - { - wmiStartMode = "Auto"; - } - else - if ( this->modeComboBox->SelectedItem->ToString()->Equals( "Manual" ) ) - { - wmiStartMode = "Manual"; - } - else - if ( this->modeComboBox->SelectedItem->ToString()->Equals( "Disabled" ) ) - { - wmiStartMode = "Disabled"; - } - - if ( ServiceChange::ChangeServiceStartMode( ¤tService, wmiStartMode, &scInfo ) ) - { - textBox->Text = "Service start mode updated successfully."; - } - else - { - textBox->Text = scInfo; - } - } - - void startName_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ServiceProcessInstaller^ svcProcInst = gcnew ServiceProcessInstaller; - textBox->Text = "Displaying service installer dialog..."; - if ( ServiceChange::GetServiceAccount( &svcProcInst ) ) - { - textBox->Text = "Changing the service account is not currently implemented in this application."; - } - else - { - textBox->Text = "No change made to service account."; - } - - String^ scInfo; - if ( ServiceChange::QueryService( ¤tService, &scInfo ) ) - { - textBox->Text = String::Concat( textBox->Text, Environment::NewLine, scInfo ); - } - } - - -public: - ServiceSampleForm() - { - query_button = gcnew System::Windows::Forms::Button; - startMode_button = gcnew System::Windows::Forms::Button; - changeMode_button = gcnew System::Windows::Forms::Button; - startName_button = gcnew System::Windows::Forms::Button; - textBox = gcnew System::Windows::Forms::TextBox; - modeLabel = gcnew System::Windows::Forms::Label; - modeComboBox = gcnew System::Windows::Forms::ComboBox; - currentService = gcnew ServiceController; - this->SuspendLayout(); - - // Set properties for query_button. - this->query_button->Enabled = true; - this->query_button->Location = System::Drawing::Point( 8, 16 ); - this->query_button->Name = "query_button"; - this->query_button->Size = System::Drawing::Size( 124, 30 ); - this->query_button->Text = "Query Service"; - this->query_button->Click += gcnew System::EventHandler( this, &ServiceSampleForm::query_button_Click ); - - // Set properties for startMode_button. - this->startMode_button->Enabled = false; - this->startMode_button->Location = System::Drawing::Point( 264, 16 ); - this->startMode_button->Name = "startMode_button"; - this->startMode_button->Size = System::Drawing::Size( 124, 30 ); - this->startMode_button->Text = "Change Service Start Mode"; - this->startMode_button->Click += gcnew System::EventHandler( this, &ServiceSampleForm::startMode_button_Click ); - - // Set properties for modeLabel - this->modeLabel->Location = System::Drawing::Point( 395, 20 ); - this->modeLabel->Size = System::Drawing::Size( 180, 22 ); - this->modeLabel->Text = "Select a service mode:"; - this->modeLabel->Visible = false; - - // Set properties for modeComboBox - this->modeComboBox->Location = System::Drawing::Point( 560, 16 ); - this->modeComboBox->Size = System::Drawing::Size( 190, 23 ); - this->modeComboBox->Name = "modeComboBox"; - array^temp0 = {"Automatic","Manual","Disabled"}; - this->modeComboBox->Items->AddRange( temp0 ); - this->modeComboBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right | System::Windows::Forms::AnchorStyles::Top); - this->modeComboBox->SelectedIndex = 0; - this->modeComboBox->Visible = false; - - // Set properties for startName_button. - this->startName_button->Enabled = false; - this->startName_button->Location = System::Drawing::Point( 136, 16 ); - this->startName_button->Name = "startName_button"; - this->startName_button->Size = System::Drawing::Size( 124, 30 ); - this->startName_button->Text = "Change Service Account"; - this->startName_button->Click += gcnew System::EventHandler( this, &ServiceSampleForm::startName_button_Click ); - - // Set properties for textBox. - this->textBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->textBox->Location = System::Drawing::Point( 8, 48 ); - this->textBox->Multiline = true; - this->textBox->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->textBox->Name = "textBox"; - this->textBox->Size = System::Drawing::Size( 744, 280 ); - this->textBox->Text = ""; - - // Set properties for the ServiceSampleForm. - this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); - this->ClientSize = System::Drawing::Size( 768, 340 ); - this->MinimumSize = System::Drawing::Size( 750, 340 ); - array^temp1 = {this->textBox,this->query_button,this->startMode_button,this->startName_button,this->modeComboBox,this->modeLabel}; - this->Controls->AddRange( temp1 ); - this->Name = "ServiceSampleForm"; - this->Text = "Query and Change Service Configuration"; - this->ResumeLayout( false ); - } - -public: - ~ServiceSampleForm() - { - } -}; - -// Define the windows application entry point. - -[STAThread] -int main() -{ - Application::Run( gcnew ServiceSampleForm ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp deleted file mode 100644 index b873188879c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp +++ /dev/null @@ -1,280 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; - -// This console application illustrates various uses -// of the StackTrace and StackFrame classes. -namespace SampleInternal -{ - public ref class ClassLevel6 - { - public: - void Level6Method() - { - throw gcnew Exception( "An error occurred in the lowest internal class method." ); - } - - }; - - public ref class ClassLevel5 - { - public: - - // - void Level5Method() - { - try - { - ClassLevel6^ nestedClass = gcnew ClassLevel6; - nestedClass->Level6Method(); - } - catch ( Exception^ e ) - { - Console::WriteLine( " Level5Method exception handler" ); - StackTrace^ st = gcnew StackTrace; - - // Display the most recent function call. - StackFrame^ sf = st->GetFrame( 0 ); - Console::WriteLine(); - Console::WriteLine( " Exception in method: " ); - Console::WriteLine( " {0}", sf->GetMethod() ); - if ( st->FrameCount > 1 ) - { - - // Display the highest-level function call - // in the trace. - sf = st->GetFrame( st->FrameCount - 1 ); - Console::WriteLine( " Original function call at top of call stack):" ); - Console::WriteLine( " {0}", sf->GetMethod() ); - } - Console::WriteLine(); - Console::WriteLine( " ... throwing exception to next level ..." ); - Console::WriteLine( "-------------------------------------------------\n" ); - throw e; - } - - } - - // - }; - - public ref class ClassLevel4 - { - public: - void Level4Method() - { - - // - try - { - ClassLevel5^ nestedClass = gcnew ClassLevel5; - nestedClass->Level5Method(); - } - catch ( Exception^ e ) - { - Console::WriteLine( " Level4Method exception handler" ); - - // Build a stack trace from a dummy stack frame. - // Explicitly specify the source file name, line number - // and column number. - StackTrace^ st = gcnew StackTrace( gcnew StackFrame( "source.cs",79,24 ) ); - Console::WriteLine( " Stack trace with dummy stack frame: {0}", st->ToString() ); - - // Access the StackFrames explicitly to display the file - // name, line number and column number properties. - // StackTrace.ToString only includes the method name. - for ( int i = 0; i < st->FrameCount; i++ ) - { - StackFrame^ sf = st->GetFrame( i ); - Console::WriteLine( " File: {0}", sf->GetFileName() ); - Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() ); - Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() ); - - } - Console::WriteLine(); - Console::WriteLine( " ... throwing exception to next level ..." ); - Console::WriteLine( "-------------------------------------------------\n" ); - throw e; - } - - - // - } - - }; - - public ref class ClassLevel3 - { - public: - - // - void Level3Method() - { - try - { - ClassLevel4^ nestedClass = gcnew ClassLevel4; - nestedClass->Level4Method(); - } - catch ( Exception^ e ) - { - Console::WriteLine( " Level3Method exception handler" ); - - // Build a stack trace from a dummy stack frame. - // Explicitly specify the source file name and line number. - StackTrace^ st = gcnew StackTrace( gcnew StackFrame( "source.cs",60 ) ); - Console::WriteLine( " Stack trace with dummy stack frame: {0}", st->ToString() ); - for ( int i = 0; i < st->FrameCount; i++ ) - { - - // - // Display the stack frame properties. - StackFrame^ sf = st->GetFrame( i ); - Console::WriteLine( " File: {0}", sf->GetFileName() ); - Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() ); - - // Note that the column number defaults to zero - // when not initialized. - Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() ); - Console::WriteLine( " Intermediate Language Offset: {0}", sf->GetILOffset().ToString() ); - Console::WriteLine( " Native Offset: {0}", sf->GetNativeOffset().ToString() ); - - // - - } - Console::WriteLine(); - Console::WriteLine( " ... throwing exception to next level ..." ); - Console::WriteLine( "-------------------------------------------------\n" ); - throw e; - } - - } - - // - }; - - public ref class ClassLevel2 - { - public: - - // - void Level2Method() - { - try - { - ClassLevel3^ nestedClass = gcnew ClassLevel3; - nestedClass->Level3Method(); - } - catch ( Exception^ e ) - { - Console::WriteLine( " Level2Method exception handler" ); - - // Display the full call stack at this level. - StackTrace^ st1 = gcnew StackTrace( true ); - Console::WriteLine( " Stack trace for this level: {0}", st1->ToString() ); - - // Build a stack trace from one frame, skipping the - // current frame and using the next frame. - StackTrace^ st2 = gcnew StackTrace( gcnew StackFrame( 1,true ) ); - Console::WriteLine( " Stack trace built with next level frame: {0}", st2->ToString() ); - - // Build a stack trace skipping the current frame, and - // including all the other frames. - StackTrace^ st3 = gcnew StackTrace( 1,true ); - Console::WriteLine( " Stack trace built from the next level up: {0}", st3->ToString() ); - Console::WriteLine(); - Console::WriteLine( " ... throwing exception to next level ..." ); - Console::WriteLine( "-------------------------------------------------\n" ); - throw e; - } - - } - - // - }; - - public ref class ClassLevel1 - { - public: - - // - void InternalMethod() - { - try - { - ClassLevel2^ nestedClass = gcnew ClassLevel2; - nestedClass->Level2Method(); - } - catch ( Exception^ e ) - { - Console::WriteLine( " InternalMethod exception handler" ); - - // Build a stack trace from one frame, skipping the - // current frame and using the next frame. By - // default, file and line information are not displayed. - StackTrace^ st = gcnew StackTrace( gcnew StackFrame( 1 ) ); - Console::WriteLine( " Stack trace for next level frame: {0}", st->ToString() ); - Console::WriteLine( " Stack frame for next level: " ); - Console::WriteLine( " {0}", st->GetFrame( 0 )->ToString() ); - Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() ); - Console::WriteLine(); - Console::WriteLine( " ... throwing exception to next level ..." ); - Console::WriteLine( "-------------------------------------------------\n" ); - throw e; - } - - } - - // - }; - -} - - -using namespace SampleInternal; - -namespace SamplePublic -{ - class ConsoleApp - { - public: - - // - - [STAThread] - static void Main() - { - ClassLevel1 ^ mainClass = gcnew ClassLevel1; - try - { - mainClass->InternalMethod(); - } - catch ( Exception^ e ) - { - Console::WriteLine( " Main method exception handler" ); - - // Display file and line information, if available. - StackTrace^ st = gcnew StackTrace( gcnew StackFrame( true ) ); - Console::WriteLine( " Stack trace for current level: {0}", st->ToString() ); - Console::WriteLine( " File: {0}", st->GetFrame( 0 )->GetFileName() ); - Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() ); - Console::WriteLine(); - Console::WriteLine( "-------------------------------------------------\n" ); - } - - } - - // - }; - -} - -int main() -{ - SamplePublic::ConsoleApp::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp deleted file mode 100644 index 83e6e596d61..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp +++ /dev/null @@ -1,147 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -ref class StackTraceSample -{ -private: - ref class MyInternalClass - { - public: - void ThrowsException() - { - try - { - throw gcnew Exception( "A problem was encountered." ); - } - catch ( Exception^ e ) - { - - // Create a StackTrace that captures - // filename, line number, and column - // information for the current thread. - StackTrace^ st = gcnew StackTrace( true ); - String^ stackIndent = ""; - for ( int i = 0; i < st->FrameCount; i++ ) - { - - // Note that at this level, there are five - // stack frames, one for each method invocation. - StackFrame^ sf = st->GetFrame( i ); - Console::WriteLine(); - Console::WriteLine( "{0}Method: {1}", stackIndent, sf->GetMethod() ); - Console::WriteLine( "{0}File: {1}", stackIndent, sf->GetFileName() ); - Console::WriteLine( "{0}Line Number: {1}", stackIndent, sf->GetFileLineNumber().ToString() ); - stackIndent = String::Concat( stackIndent, " " ); - - } - throw e; - } - - } - - }; - - -protected: - void MyProtectedMethod() - { - MyInternalClass^ mic = gcnew MyInternalClass; - mic->ThrowsException(); - } - - -public: - void MyPublicMethod() - { - MyProtectedMethod(); - } - -}; - -int main() -{ - StackTraceSample^ sample = gcnew StackTraceSample; - try - { - sample->MyPublicMethod(); - } - catch ( Exception^ ) - { - - // Create a StackTrace that captures - // filename, line number, and column - // information for the current thread. - StackTrace^ st = gcnew StackTrace( true ); - for ( int i = 0; i < st->FrameCount; i++ ) - { - - // For an executable built from C++, there - // are two stack frames here: one for main, - // and one for the _mainCRTStartup stub. - StackFrame^ sf = st->GetFrame( i ); - Console::WriteLine(); - Console::WriteLine( "High up the call stack, Method: {0}", sf->GetMethod()->ToString() ); - Console::WriteLine( "High up the call stack, Line Number: {0}", sf->GetFileLineNumber().ToString() ); - - } - } - -} - -/* -This console application produces the following output when -compiled with the Debug configuration. - - Method: Void ThrowsException() - File: c:\samples\stacktraceframe\myclass.cpp - Line Number: 20 - - Method: Void MyProtectedMethod() - File: c:\samples\stacktraceframe\myclass.cpp - Line Number: 45 - - Method: Void MyPublicMethod() - File: c:\samples\stacktraceframe\myclass.cpp - Line Number: 50 - - Method: Int32 main() - File: c:\samples\stacktraceframe\myclass.cpp - Line Number: 56 - - Method: UInt32 _mainCRTStartup() - File: - Line Number: 0 - - High up the call stack, Method: Int32 main() - High up the call stack, Line Number: 62 - - High up the call stack, Method: UInt32 _mainCRTStartup() - High up the call stack, Line Number: 0 - -This console application produces the following output when -compiled with the Release configuration. - - Method: Void ThrowsException() - File: - Line Number: 0 - - Method: Int32 main() - File: - Line Number: 0 - - Method: UInt32 _mainCRTStartup() - File: - Line Number: 0 - - High up the call stack, Method: Int32 main() - High up the call stack, Line Number: 0 - - High up the call stack, Method: UInt32 _mainCRTStartup() - High up the call stack, Line Number: 0 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp deleted file mode 100644 index 2dcb2ce73fc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -ref class MyConsoleApp -{ -private: - ref class MyInnerClass - { - public: - void ThrowsException() - { - try - { - throw gcnew Exception( "A problem was encountered." ); - } - catch ( Exception^ ) - { - - // Create a StackTrace starting at the next level - // stack frame. Skip the first frame, the frame of - // this level, which hides the internal implementation - // of the ThrowsException method. Include the line - // number, file name, and column number information - // for each frame. - // - StackTrace^ st = gcnew StackTrace( 1,true ); - array^stFrames = st->GetFrames(); - for ( int i; i < stFrames->Length; i++ ) - { - StackFrame^ sf = stFrames[ i ]; - Console::WriteLine( "Method: {0}", sf->GetMethod() ); - - } - // - } - - } - - }; - - -public: - void MyPublicMethod() - { - MyInnerClass^ helperClass = gcnew MyInnerClass; - helperClass->ThrowsException(); - } - -}; - -void main() -{ - MyConsoleApp^ myApp = gcnew MyConsoleApp; - myApp->MyPublicMethod(); -} - -/* -This console application produces the following output -when compiled with optimization off. - -Note that the ThrowsException() method is not identified in -this stack trace. - - Method: Void MyPublicMethod() - Method: Void Main() - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp deleted file mode 100644 index 49e44641a2b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Diagnostics; -ref class MyConsoleApp -{ -private: - - // - ref class MyInnerClass - { - public: - void ThrowsException() - { - try - { - throw gcnew Exception( "A problem was encountered." ); - } - catch ( Exception^ ) - { - - // Log the Exception. We do not want to reveal the - // inner workings of the class, or be too verbose, so - // we will create a StackTrace with a single - // StackFrame, where the frame is that of the calling - // method. - // - StackFrame^ fr = gcnew StackFrame( 1,true ); - StackTrace^ st = gcnew StackTrace( fr ); - EventLog::WriteEntry( fr->GetMethod()->Name, st->ToString(), EventLogEntryType::Warning ); - // - - // Note that whenever this application is run, the EventLog - // contains an Event similar to the following Event. - // - // Event Type: Warning - // Event Source: MyPublicMethod - // Event Category: None - // Event ID: 0 - // Date: 6/17/2001 - // Time: 6:39:56 PM - // User: N/A - // Computer: MYCOMPUTER - // Description: - // - // at MyConsoleApp.MyPublicMethod() - // - // For more information, see Help and Support Center at - // http://go.microsoft.com/fwlink/events.asp. - } - - } - - }; - // - - -public: - - // - void MyPublicMethod() - { - MyInnerClass^ helperClass = gcnew MyInnerClass; - helperClass->ThrowsException(); - } - -}; - -void main() -{ - MyConsoleApp^ helperClass = gcnew MyConsoleApp; - helperClass->MyPublicMethod(); -} - -/* -This console application produces the following output -when compiled with optimization off. - -Note that the ThrowsException() method is not identified in -this stack trace. - - Method: Void MyPublicMethod() - Method: Void Main() - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp deleted file mode 100644 index 3b2fe7a7575..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp +++ /dev/null @@ -1,201 +0,0 @@ - - -// System.Diagnostics.Stopwatch -// -#using - -using namespace System; -using namespace System::Diagnostics; - -// -void DisplayTimerProperties() -{ - // Display the timer frequency and resolution. - if ( Stopwatch::IsHighResolution ) - { - Console::WriteLine( "Operations timed using the system's high-resolution performance counter." ); - } - else - { - Console::WriteLine( "Operations timed using the DateTime class." ); - } - - Int64 frequency = Stopwatch::Frequency; - Console::WriteLine( " Timer frequency in ticks per second = {0}", frequency ); - Int64 nanosecPerTick = (1000L * 1000L * 1000L) / frequency; - Console::WriteLine( " Timer is accurate within {0} nanoseconds", nanosecPerTick ); -} -// - -// -void TimeOperations() -{ - Int64 nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch::Frequency; - const long numIterations = 10000; - - // Define the operation title names. - array^operationNames = {"Operation: Int32.Parse(\"0\")","Operation: Int32.TryParse(\"0\")","Operation: Int32.Parse(\"a\")","Operation: Int32.TryParse(\"a\")"}; - - // Time four different implementations for parsing - // an integer from a string. - for ( int operation = 0; operation <= 3; operation++ ) - { - // - // Define variables for operation statistics. - Int64 numTicks = 0; - Int64 numRollovers = 0; - Int64 maxTicks = 0; - Int64 minTicks = Int64::MaxValue; - int indexFastest = -1; - int indexSlowest = -1; - Int64 milliSec = 0; - Stopwatch ^ time10kOperations = Stopwatch::StartNew(); - - // Run the current operation 10001 times. - // The first execution time will be tossed - // out, since it can skew the average time. - for ( int i = 0; i <= numIterations; i++ ) - { - // - Int64 ticksThisTime = 0; - int inputNum; - Stopwatch ^ timePerParse; - switch ( operation ) - { - case 0: - - // Parse a valid integer using - // a try-catch statement. - // Start a new stopwatch timer. - timePerParse = Stopwatch::StartNew(); - try - { - inputNum = Int32::Parse( "0" ); - } - catch ( FormatException^ ) - { - inputNum = 0; - } - - // Stop the timer, and save the - // elapsed ticks for the operation. - timePerParse->Stop(); - ticksThisTime = timePerParse->ElapsedTicks; - break; - - case 1: - - // Parse a valid integer using - // the TryParse statement. - // Start a new stopwatch timer. - timePerParse = Stopwatch::StartNew(); - if ( !Int32::TryParse( "0", inputNum ) ) - { - inputNum = 0; - } - - // Stop the timer, and save the - // elapsed ticks for the operation. - timePerParse->Stop(); - ticksThisTime = timePerParse->ElapsedTicks; - break; - - case 2: - - // Parse an invalid value using - // a try-catch statement. - // Start a new stopwatch timer. - timePerParse = Stopwatch::StartNew(); - try - { - inputNum = Int32::Parse( "a" ); - } - catch ( FormatException^ ) - { - inputNum = 0; - } - - // Stop the timer, and save the - // elapsed ticks for the operation. - timePerParse->Stop(); - ticksThisTime = timePerParse->ElapsedTicks; - break; - - case 3: - - // Parse an invalid value using - // the TryParse statement. - // Start a new stopwatch timer. - timePerParse = Stopwatch::StartNew(); - if ( !Int32::TryParse( "a", inputNum ) ) - { - inputNum = 0; - } - - // Stop the timer, and save the - // elapsed ticks for the operation. - timePerParse->Stop(); - ticksThisTime = timePerParse->ElapsedTicks; - break; - - default: - break; - } - // - - // Skip over the time for the first operation, - // just in case it caused a one-time - // performance hit. - if ( i == 0 ) - { - time10kOperations->Reset(); - time10kOperations->Start(); - } - else - { - // Update operation statistics - // for iterations 1-10001. - if ( maxTicks < ticksThisTime ) - { - indexSlowest = i; - maxTicks = ticksThisTime; - } - if ( minTicks > ticksThisTime ) - { - indexFastest = i; - minTicks = ticksThisTime; - } - numTicks += ticksThisTime; - if ( numTicks < ticksThisTime ) - { - // Keep track of rollovers. - numRollovers++; - } - } - } - - // Display the statistics for 10000 iterations. - time10kOperations->Stop(); - milliSec = time10kOperations->ElapsedMilliseconds; - Console::WriteLine(); - Console::WriteLine( "{0} Summary:", operationNames[ operation ] ); - Console::WriteLine( " Slowest time: #{0}/{1} = {2} ticks", indexSlowest, numIterations, maxTicks ); - Console::WriteLine( " Fastest time: #{0}/{1} = {2} ticks", indexFastest, numIterations, minTicks ); - Console::WriteLine( " Average time: {0} ticks = {1} nanoseconds", numTicks / numIterations, (numTicks * nanosecPerTick) / numIterations ); - Console::WriteLine( " Total time looping through {0} operations: {1} milliseconds", numIterations, milliSec ); - // - - } -} -// - -int main() -{ - DisplayTimerProperties(); - Console::WriteLine(); - Console::WriteLine( "Press the Enter key to begin:" ); - Console::ReadLine(); - Console::WriteLine(); - TimeOperations(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp b/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp deleted file mode 100644 index ba044bc83d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp +++ /dev/null @@ -1,59 +0,0 @@ -//Code Modification: Removed AppendLine and associated comment after the AppendFormat line. -//The CR/LF bytes introduces by AppendLine made the sb.Length appear incorrect. -// Before -//sb.AppendFormat("GHI{0}{1}", 'J', 'k'); -////APpend a blank line to the end of the StringBuilder. -// sb.AppendLine(); -// After -//sb.AppendFormat("GHI{0}{1}", 'J', 'k'); -//Code Modification: End -//Types:System.Text.StringBuilder -// -using namespace System; -using namespace System::Text; - -int main() -{ - // - // Create a StringBuilder that expects to hold 50 characters. - // Initialize the StringBuilder with "ABC". - StringBuilder^ sb = gcnew StringBuilder("ABC", 50); - // - - // - // Append three characters (D, E, and F) to the end of the - // StringBuilder. - sb->Append(gcnew array{'D', 'E', 'F'}); - // - - // - // Append a format string to the end of the StringBuilder. - sb->AppendFormat("GHI{0}{1}", (Char)'J', (Char)'k'); - // - - // - // Display the number of characters in the StringBuilder - // and its string. - Console::WriteLine("{0} chars: {1}", sb->Length, sb->ToString()); - // - - // - // Insert a string at the beginning of the StringBuilder. - sb->Insert(0, "Alphabet: "); - // - - // - // Replace all lowercase k's with uppercase K's. - sb->Replace('k', 'K'); - // - - // Display the number of characters in the StringBuilder - // and its string. - Console::WriteLine("{0} chars: {1}", sb->Length, sb->ToString()); -} - -// This code produces the following output. -// -// 11 chars: ABCDEFGHIJk -// 21 chars: Alphabet: ABCDEFGHIJK -// diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp deleted file mode 100644 index 6541e6b0a6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; -int main() -{ - String^ strLow = "abc"; - String^ strCap = "ABC"; - String^ result = "equal to "; - int x = 0; - int pos = 1; - - // The Unicode codepoint for 'b' is greater than the codepoint for 'B'. - x = String::CompareOrdinal( strLow, pos, strCap, pos, 1 ); - if ( x < 0 ) - result = "less than"; - - if ( x > 0 ) - result = "greater than"; - - Console::WriteLine( "CompareOrdinal(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos ); - Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] ); - - // In U.S. English culture, 'b' is linguistically less than 'B'. - x = String::Compare( strLow, pos, strCap, pos, 1, false, gcnew CultureInfo( "en-US" ) ); - if ( x < 0 ) - result = "less than"; - else - if ( x > 0 ) - result = "greater than"; - - Console::WriteLine( "Compare(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos ); - Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp deleted file mode 100644 index 389943d7364..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; - -String^ CompareStrings(String^ str1, String^ str2) -{ - // compare the values, using the CompareTo method on the first string - int cmpVal = str1->CompareTo(str2); - if (cmpVal == 0) - // the values are the same - return "The strings occur in the same position in the sort order."; - else if (cmpVal < 0) - return "The first string precedes the second in the sort order."; - else - return "The first string follows the second in the sort order."; -} - -int main() -{ - String^ strFirst = "Goodbye"; - String^ strSecond = "Hello"; - String^ strThird = "a small String*"; - String^ strFourth = "goodbye"; - - // Compare a string to itself. - Console::WriteLine(CompareStrings(strFirst, strFirst)); - Console::WriteLine(CompareStrings(strFirst, strSecond)); - Console::WriteLine(CompareStrings(strFirst, strThird)); - - // Compare a string to another string that varies only by case. - Console::WriteLine(CompareStrings(strFirst, strFourth)); - Console::WriteLine(CompareStrings(strFourth, strFirst)); -} -// The example displays the following output: -// The strings occur in the same position in the sort order. -// The first string precedes the second in the sort order. -// The first string follows the second in the sort order. -// The first string follows the second in the sort order. -// The first string precedes the second in the sort order. -// diff --git a/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp b/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp deleted file mode 100644 index 15c96facbe9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp +++ /dev/null @@ -1,84 +0,0 @@ -//Types:System.Globalization.StringInfo -// -using namespace System; -using namespace System::Text; -using namespace System::Globalization; - - -// Show how to enumerate each real character (honoring surrogates) -// in a string. - -void EnumTextElements(String^ combiningChars) -{ - // This StringBuilder holds the output results. - StringBuilder^ sb = gcnew StringBuilder(); - - // Use the enumerator returned from GetTextElementEnumerator - // method to examine each real character. - TextElementEnumerator^ charEnum = - StringInfo::GetTextElementEnumerator(combiningChars); - while (charEnum->MoveNext()) - { - sb->AppendFormat("Character at index {0} is '{1}'{2}", - charEnum->ElementIndex, charEnum->GetTextElement(), - Environment::NewLine); - } - - // Show the results. - Console::WriteLine("Result of GetTextElementEnumerator:"); - Console::WriteLine(sb); -} - - -// Show how to discover the index of each real character -// (honoring surrogates) in a string. - -void EnumTextElementIndexes(String^ combiningChars) -{ - // This StringBuilder holds the output results. - StringBuilder^ sb = gcnew StringBuilder(); - - // Use the ParseCombiningCharacters method to - // get the index of each real character in the string. - array ^ textElemIndex = - StringInfo::ParseCombiningCharacters(combiningChars); - - // Iterate through each real character showing the character - // and the index where it was found. - for (int i = 0; i < textElemIndex->Length; i++) - { - sb->AppendFormat("Character {0} starts at index {1}{2}", - i, textElemIndex[i], Environment::NewLine); - } - - // Show the results. - Console::WriteLine("Result of ParseCombiningCharacters:"); - Console::WriteLine(sb); -} - -int main() -{ - - // The string below contains combining characters. - String^ combiningChars = L"a\u0304\u0308bc\u0327"; - - // Show each 'character' in the string. - EnumTextElements(combiningChars); - - // Show the index in the string where each 'character' starts. - EnumTextElementIndexes(combiningChars); - -}; - -// This code produces the following output. -// -// Result of GetTextElementEnumerator: -// Character at index 0 is 'a-"' -// Character at index 3 is 'b' -// Character at index 4 is 'c,' -// -// Result of ParseCombiningCharacters: -// Character 0 starts at index 0 -// Character 1 starts at index 3 -// Character 2 starts at index 4 -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp b/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp deleted file mode 100644 index 7d915b93810..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - //Create a FileInfo instance representing an existing text file. - FileInfo^ MyFile = gcnew FileInfo( "c:\\csc.txt" ); - - //Instantiate a StreamReader to read from the text file. - StreamReader^ sr = MyFile->OpenText(); - - //Read a single character. - int FirstChar = sr->Read(); - - //Display the ASCII number of the character read in both decimal and hexadecimal format. - Console::WriteLine( "The ASCII number of the first character read is {0:D} in decimal and {1:X} in hexadecimal.", FirstChar, FirstChar ); - - // - sr->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp deleted file mode 100644 index 91fe38d447f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - FileStream^ fs = gcnew FileStream( path,FileMode::Open ); - try - { - StreamReader^ sr = gcnew StreamReader( fs ); - try - { - while ( sr->Peek() >= 0 ) - { - Console::WriteLine( sr->ReadLine() ); - } - } - finally - { - delete sr; - } - } - finally - { - delete fs; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp deleted file mode 100644 index 9966a619ccf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path ); - try - { - while ( sr->Peek() >= 0 ) - { - Console::WriteLine( sr->ReadLine() ); - } - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp deleted file mode 100644 index 2bd7741e9da..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - - //Use an encoding other than the default (UTF8). - StreamWriter^ sw = gcnew StreamWriter( path,false,gcnew UnicodeEncoding ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path,true ); - try - { - while ( sr->Peek() >= 0 ) - { - Console::Write( (Char)sr->Read() ); - } - - //Test for the encoding after reading, or at least - //after the first read. - Console::WriteLine( "The encoding used was {0}.", sr->CurrentEncoding ); - Console::WriteLine(); - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp deleted file mode 100644 index cbfd1711768..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path ); - try - { - while ( sr->Peek() > -1 ) - { - Console::WriteLine( sr->ReadLine() ); - } - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp deleted file mode 100644 index 3b817c31cf1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path ); - try - { - while ( sr->Peek() >= 0 ) - { - Console::Write( (Char)sr->Read() ); - } - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp deleted file mode 100644 index 5ce83649e21..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path ); - try - { - //This is an arbitrary size for this example. - array^c = nullptr; - while ( sr->Peek() >= 0 ) - { - c = gcnew array(5); - sr->Read( c, 0, c->Length ); - - //The output will look odd, because - //only five characters are read at a time. - Console::WriteLine( c ); - } - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp deleted file mode 100644 index 5829e1a8108..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path ); - try - { - while ( sr->Peek() >= 0 ) - { - Console::WriteLine( sr->ReadLine() ); - } - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp deleted file mode 100644 index 5ae01bcfc2e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ path = "c:\\temp\\MyTest.txt"; - try - { - if ( File::Exists( path ) ) - { - File::Delete( path ); - } - StreamWriter^ sw = gcnew StreamWriter( path ); - try - { - sw->WriteLine( "This" ); - sw->WriteLine( "is some text" ); - sw->WriteLine( "to test" ); - sw->WriteLine( "Reading" ); - } - finally - { - delete sw; - } - - StreamReader^ sr = gcnew StreamReader( path ); - try - { - //This allows you to do one Read operation. - Console::WriteLine( sr->ReadToEnd() ); - } - finally - { - delete sr; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The process failed: {0}", e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp b/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp deleted file mode 100644 index 97c560511ad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//Types:System.Reflection.StrongNameKeyPair -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; - -ref class snkX -{ -public: - static void Main() - { - // Open a file that contains a public key value. The line below - // assumes that the Strong Name tool (SN.exe) was executed from - // a command prompt as follows: - // SN.exe -k C:\Company.keys - FileStream^ fs = File::Open("C:\\Company.keys", FileMode::Open); - - // - // Construct a StrongNameKeyPair object. This object should obtain - // the public key from the Company.keys file. - StrongNameKeyPair^ k = gcnew StrongNameKeyPair(fs); - // - - // - // Display the bytes that make up the public key. - Console::WriteLine(BitConverter::ToString(k->PublicKey)); - // - - // Close the file. - fs->Close(); - } -}; - -int main() -{ - snkX::Main(); -} - -// Output will vary by user. -// -// 00-24-00-00-04-80-00-00-94-69-89-78-BB-F1-F2-71-00-00-00-34-26- -// 69-89-78-BB-F1-F2-71-00-F1-FA-F2-F9-4A-A8-5E-82-55-AB-49-4D-A6- -// ED-AB-5F-CE-DE-59-49-8D-63-01-B0-E1-BF-43-07-FA-55-D4-36-75-EE- -// 8B-83-32-39-B7-02-DE-3D-81-29-7B-E8-EA-F0-2E-78-94-96-F1-73-79- -// 69-89-78-BB-F1-F2-71-0E-4E-F4-5D-DD-A4-7F-11-54-DF-65-DE-89-23- -// 91-AD-53-E1-C0-DA-9E-0C-88-BE-AA-7B-39-20-9C-9B-55-34-26-3B-1A- -// 53-41-31-00-04-00-00-01-00-01-00-9D-F1-EA-14-4C-88-34-26-3B-1A- -// 2D-D7-A0-AB-F6-7E-B7-24-7F-87-DF-3E-97 -// diff --git a/snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp b/snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp deleted file mode 100644 index 4c5c693094c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -/* -System::Runtime::InteropServices::StructLayoutAttribute.StructLayoutAttribute(LayoutKind) -System::Runtime::InteropServices::StructLayoutAttribute.CharSet -System::Runtime::InteropServices::StructLayoutAttribute.Size - -The program shows a managed declaration of the GetSystemTime function and defines -MySystemTime class with explicit layout. The GetSystemTime get the system time -and print to the console. -*/ - -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// -// - -[StructLayout(LayoutKind::Explicit,Size=16,CharSet=CharSet::Ansi)] -value class MySystemTime -{ -public: - - [FieldOffset(0)] - short wYear; - - [FieldOffset(2)] - short wMonth; - - [FieldOffset(4)] - short wDayOfWeek; - - [FieldOffset(6)] - short wDay; - - [FieldOffset(8)] - short wHour; - - [FieldOffset(10)] - short wMinute; - - [FieldOffset(12)] - short wSecond; - - [FieldOffset(14)] - short wMilliseconds; -}; - -ref class NativeMethods -{ -public: - - [DllImport("kernel32.dll")] - static void GetSystemTime( MySystemTime * st ); -}; - -int main() -{ - try - { - MySystemTime sysTime; - NativeMethods::GetSystemTime( &sysTime ); - Console::WriteLine( "The System time is {0}/{1}/{2} {3}:{4}:{5}", sysTime.wDay, sysTime.wMonth, sysTime.wYear, sysTime.wHour, sysTime.wMinute, sysTime.wSecond ); - } - catch ( TypeLoadException^ e ) - { - Console::WriteLine( "TypeLoadException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp b/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp deleted file mode 100644 index 10d4eb14002..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// -// This example demonstrates the two versions of the -// CompareTo method for several base types. -// The general version takes a parameter of type Object, while the specific -// version takes a type-specific parameter, such as Boolean, Int32, or Double. -using namespace System; - -void Show( String^ caption, Object^ var1, Object^ var2, int resultGeneric, int resultNonGeneric ) -{ - String^ relation; - Console::Write( caption ); - if ( resultGeneric == resultNonGeneric ) - { - if ( resultGeneric < 0 ) - relation = "less than"; - else - if ( resultGeneric > 0 ) - relation = "greater than"; - else - relation = "equal to"; - Console::WriteLine( "{0} is {1} {2}", var1, relation, var2 ); - } - // The following condition will never occur because the generic and non-generic - // CompareTo methods are equivalent. - else - { - Console::WriteLine( "Generic CompareTo = {0}; non-generic CompareTo = {1}", resultGeneric, resultNonGeneric ); - } -} - -int main() -{ - String^ nl = Environment::NewLine; - String^ msg = "{0}The following is the result of using the generic and non-generic{0}" - "versions of the CompareTo method for several base types:{0}"; - Object^ obj; // An Object used to insure CompareTo(Object) is called. - - DateTime now = DateTime::Now; - - // Time span = 11 days, 22 hours, 33 minutes, 44 seconds - TimeSpan tsX = TimeSpan(11,22,33,44); - - // Version = 1.2.333.4 - Version^ versX = gcnew Version( "1.2.333.4" ); - - // Guid = CA761232-ED42-11CE-BACD-00AA0057B223 - Guid guidX = Guid( "{CA761232-ED42-11CE-BACD-00AA0057B223}"); - Boolean a1 = true,a2 = true; - Byte b1 = 1,b2 = 1; - Int16 c1 = -2,c2 = 2; - Int32 d1 = 3,d2 = 3; - Int64 e1 = 4,e2 = -4; - Decimal f1 = Decimal(-5.5), f2 = Decimal(5.5); - Single g1 = 6.6f,g2 = 6.6f; - Double h1 = 7.7,h2 = -7.7; - Char i1 = 'A',i2 = 'A'; - String^ j1 = "abc", ^j2 = "abc"; - DateTime k1 = now,k2 = now; - TimeSpan l1 = tsX,l2 = tsX; - Version^ m1 = versX, ^m2 = gcnew Version( "2.0" ); - Guid n1 = guidX,n2 = guidX; - - // The following types are not CLS-compliant. - SByte w1 = 8,w2 = 8; - UInt16 x1 = 9,x2 = 9; - UInt32 y1 = 10,y2 = 10; - UInt64 z1 = 11,z2 = 11; - - // - Console::WriteLine( msg, nl ); - try - { - Show( "Boolean: ", a1, a2, a1.CompareTo( a2 ), a1.CompareTo( a2 ) ); - Show( "Byte: ", b1, b2, b1.CompareTo( b2 ), b1.CompareTo( b2 ) ); - Show( "Int16: ", c1, c2, c1.CompareTo( c2 ), c1.CompareTo( c2 ) ); - Show( "Int32: ", d1, d2, d1.CompareTo( d2 ), d1.CompareTo( d2 ) ); - Show( "Int64: ", e1, e2, e1.CompareTo( e2 ), e1.CompareTo( e2 ) ); - Show( "Decimal: ", f1, f2, f1.CompareTo( f2 ), f1.CompareTo( f2 ) ); - Show( "Single: ", g1, g2, g1.CompareTo( g2 ), g1.CompareTo( g2 ) ); - Show( "Double: ", h1, h2, h1.CompareTo( h2 ), h1.CompareTo( h2 ) ); - Show( "Char: ", i1, i2, i1.CompareTo( i2 ), i1.CompareTo( i2 ) ); - - // Use an anonymous object to hide the String object. - obj = j2; - Show( "String: ", j1, j2, j1->CompareTo( j2 ), j1->CompareTo( obj ) ); - Show( "DateTime:", k1, k2, k1.CompareTo( k2 ), k1.CompareTo( k2 ) ); - Show( "TimeSpan: ", l1, l2, l1.CompareTo( l2 ), l1.CompareTo( l2 ) ); - - // Use an anonymous object to hide the Version object. - obj = m2; - Show( "Version: ", m1, m2, m1->CompareTo( m2 ), m1->CompareTo( obj ) ); - Show( "Guid: ", n1, n2, n1.CompareTo( n2 ), n1.CompareTo( n2 ) ); - - // - Console::WriteLine( "{0}The following types are not CLS-compliant:", nl ); - Show( "SByte: ", w1, w2, w1.CompareTo( w2 ), w1.CompareTo( w2 ) ); - Show( "UInt16: ", x1, x2, x1.CompareTo( x2 ), x1.CompareTo( x2 ) ); - Show( "UInt32: ", y1, y2, y1.CompareTo( y2 ), y1.CompareTo( y2 ) ); - Show( "UInt64: ", z1, z2, z1.CompareTo( z2 ), z1.CompareTo( z2 ) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - -} -// This example displays the following output: -// -// The following is the result of using the generic and non-generic versions of the -// CompareTo method for several base types: -// -// Boolean: True is equal to True -// Byte: 1 is equal to 1 -// Int16: -2 is less than 2 -// Int32: 3 is equal to 3 -// Int64: 4 is greater than -4 -// Decimal: -5.5 is less than 5.5 -// Single: 6.6 is equal to 6.6 -// Double: 7.7 is greater than -7.7 -// Char: A is equal to A -// String: abc is equal to abc -// DateTime: 12/1/2003 5:37:46 PM is equal to 12/1/2003 5:37:46 PM -// TimeSpan: 11.22:33:44 is equal to 11.22:33:44 -// Version: 1.2.333.4 is less than 2.0 -// Guid: ca761232-ed42-11ce-bacd-00aa0057b223 is equal to ca761232-ed42-11ce-bacd-00 -// aa0057b223 -// -// The following types are not CLS-compliant: -// SByte: 8 is equal to 8 -// UInt16: 9 is equal to 9 -// UInt32: 10 is equal to 10 -// UInt64: 11 is equal to 11 -// diff --git a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp deleted file mode 100644 index cc253499947..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// -// This example demonstrates overloads of the TryParse method for -// several base types, and the TryParseExact method for DateTime. -// In most cases, this example uses the most complex overload; that is, the overload -// with the most parameters for a particular type. If a complex overload specifies -// null (Nothing in Visual Basic) for the IFormatProvider parameter, formatting -// information is obtained from the culture associated with the current thread. -// If a complex overload specifies the style parameter, the parameter value is -// the default value used by the equivalent simple overload. -using namespace System; -using namespace System::Globalization; - -static void Show( bool parseResult, String^ typeName, String^ parseValue ) -{ - String^ msgSuccess = L"Parse for {0} = {1}"; - String^ msgFailure = L"** Parse for {0} failed. Invalid input."; - - // - if ( parseResult ) - Console::WriteLine( msgSuccess, typeName, parseValue ); - else - Console::WriteLine( msgFailure, typeName ); -} - -void main() -{ - bool result; - CultureInfo^ ci; - String^ nl = Environment::NewLine; - String^ msg1 = L"This example demonstrates overloads of the TryParse method for{0}" - L"several base types, as well as the TryParseExact method for DateTime.{0}"; - String^ msg2 = L"Non-numeric types:{0}"; - String^ msg3 = L"{0}Numeric types:{0}"; - String^ msg4 = L"{0}The following types are not CLS-compliant:{0}"; - - // Non-numeric types. - Boolean booleanVal; - Char charVal; - DateTime datetimeVal; - - // Numeric types. - Byte byteVal; - Int16 int16Val; - Int32 int32Val; - Int64 int64Val; - Decimal decimalVal; - Single singleVal; - Double doubleVal; - - // The following types are not CLS-compliant. - SByte sbyteVal; - UInt16 uint16Val; - UInt32 uint32Val; - UInt64 uint64Val; - - // - Console::WriteLine( msg1, nl ); - - // Non-numeric types: - Console::WriteLine( msg2, nl ); - - // DateTime - // TryParse: - // Assume current culture is en-US, and dates of the form: MMDDYYYY. - result = DateTime::TryParse( L"7/4/2004 12:34:56", datetimeVal ); - Show( result, L"DateTime #1", datetimeVal.ToString() ); - - // Use fr-FR culture, and dates of the form: DDMMYYYY. - ci = gcnew CultureInfo( L"fr-FR" ); - result = DateTime::TryParse( L"4/7/2004 12:34:56", ci, DateTimeStyles::None, datetimeVal ); - Show( result, L"DateTime #2", datetimeVal.ToString() ); - - // TryParseExact: - // Use fr-FR culture. The format, "G", is short date and long time. - result = DateTime::TryParseExact( L"04/07/2004 12:34:56", L"G", ci, DateTimeStyles::None, datetimeVal ); - Show( result, L"DateTime #3", datetimeVal.ToString() ); - - // Assume en-US culture. - array^dateFormats = {L"f",L"F",L"g",L"G"}; - result = DateTime::TryParseExact( L"7/4/2004 12:34:56 PM", dateFormats, nullptr, DateTimeStyles::None, datetimeVal ); - Show( result, L"DateTime #4", datetimeVal.ToString() ); - Console::WriteLine(); - - // Boolean - result = Boolean::TryParse( L"true", booleanVal ); - Show( result, L"Boolean", booleanVal.ToString() ); - - // Char - result = Char::TryParse( L"A", charVal ); - Show( result, L"Char", charVal.ToString() ); - - // Numeric types: - Console::WriteLine( msg3, nl ); - - // Byte - result = Byte::TryParse( L"1", NumberStyles::Integer, nullptr, byteVal ); - Show( result, L"Byte", byteVal.ToString() ); - - // Int16 - result = Int16::TryParse( L"-2", NumberStyles::Integer, nullptr, int16Val ); - Show( result, L"Int16", int16Val.ToString() ); - - // Int32 - result = Int32::TryParse( L"3", NumberStyles::Integer, nullptr, int32Val ); - Show( result, L"Int32", int32Val.ToString() ); - - // Int64 - result = Int64::TryParse( L"4", NumberStyles::Integer, nullptr, int64Val ); - Show( result, L"Int64", int64Val.ToString() ); - - // Decimal - result = Decimal::TryParse( L"-5.5", NumberStyles::Number, nullptr, decimalVal ); - Show( result, L"Decimal", decimalVal.ToString() ); - - // Single - result = Single::TryParse( L"6.6", static_cast((NumberStyles::Float | NumberStyles::AllowThousands)), nullptr, singleVal ); - Show( result, L"Single", singleVal.ToString() ); - - // Double - result = Double::TryParse( L"-7", static_cast(NumberStyles::Float | NumberStyles::AllowThousands), nullptr, doubleVal ); - Show( result, L"Double", doubleVal.ToString() ); - - // Use the simple Double.TryParse overload, but specify an invalid value. - result = Double::TryParse( L"abc", doubleVal ); - Show( result, L"Double #2", doubleVal.ToString() ); - - // - Console::WriteLine( msg4, nl ); - - // SByte - result = SByte::TryParse( L"-8", NumberStyles::Integer, nullptr, sbyteVal ); - Show( result, L"SByte", sbyteVal.ToString() ); - - // UInt16 - result = UInt16::TryParse( L"9", NumberStyles::Integer, nullptr, uint16Val ); - Show( result, L"UInt16", uint16Val.ToString() ); - - // UInt32 - result = UInt32::TryParse( L"10", NumberStyles::Integer, nullptr, uint32Val ); - Show( result, L"UInt32", uint32Val.ToString() ); - - // UInt64 - result = UInt64::TryParse( L"11", NumberStyles::Integer, nullptr, uint64Val ); - Show( result, L"UInt64", uint64Val.ToString() ); -} - -/* -This example produces the following results: - -This example demonstrates overloads of the TryParse method for -several base types, as well as the TryParseExact method for DateTime. - -Non-numeric types: - -Parse for DateTime #1 = 7/4/2004 12:34:56 PM -Parse for DateTime #2 = 7/4/2004 12:34:56 PM -Parse for DateTime #3 = 7/4/2004 12:34:56 PM -Parse for DateTime #4 = 7/4/2004 12:34:56 PM - -Parse for Boolean = True -Parse for Char = A - -Numeric types: - -Parse for Byte = 1 -Parse for Int16 = -2 -Parse for Int32 = 3 -Parse for Int64 = 4 -Parse for Decimal = -5.5 -Parse for Single = 6.6 -Parse for Double = -7 -** Parse for Double #2 failed. Invalid input. - -The following types are not CLS-compliant: - -Parse for SByte = -8 -Parse for UInt16 = 9 -Parse for UInt32 = 10 -Parse for UInt64 = 11 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp b/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp deleted file mode 100644 index e6f659eaf11..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp +++ /dev/null @@ -1,10 +0,0 @@ - -// -using namespace System; -void main() -{ - Type^ t = int::typeid; - Console::WriteLine( "{0} inherits from {1}.", t, t->BaseType ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp b/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp deleted file mode 100644 index 9faf8c82ca5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -// -using namespace System; -int main() -{ - Type^ t = Array::typeid; - Console::WriteLine( "The full name of the Array type is {0}.", t->FullName ); -} - -/* This example produces the following output: - -The full name of the Array type is System.Array. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp b/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp deleted file mode 100644 index 801fb6bb503..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -public ref class TestGetElementType{}; - -int main() -{ - array^array = {1,2,3}; - Type^ t = array->GetType(); - Type^ t2 = t->GetElementType(); - Console::WriteLine( "The element type of {0} is {1}.", array, t2 ); - TestGetElementType^ newMe = gcnew TestGetElementType; - t = newMe->GetType(); - t2 = t->GetElementType(); - Console::WriteLine( "The element type of {0} is {1}.", newMe, t2 == nullptr ? "null" : t2->ToString() ); -} - -/* This code produces the following output: - -The element type of System.Int32[] is System.Int32. -The element type of TestGetElementType is null. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp deleted file mode 100644 index aea549667ea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -ref class Room -{ -}; - -ref class Kitchen : Room -{ -}; - -ref class Bedroom : Room -{ -}; - -ref class Guestroom : Bedroom -{ -}; - -ref class MasterBedroom : Bedroom -{ -}; - -ref class Program -{ -public: - static void Main() - { - // Demonstrate classes: - Console::WriteLine("Defined Classes:"); - Room^ room1 = gcnew Room(); - Kitchen^ kitchen1 = gcnew Kitchen(); - Bedroom^ bedroom1 = gcnew Bedroom(); - Guestroom^ guestroom1 = gcnew Guestroom(); - MasterBedroom^ masterbedroom1 = gcnew MasterBedroom(); - - Type^ room1Type = room1->GetType(); - Type^ kitchen1Type = kitchen1->GetType(); - Type^ bedroom1Type = bedroom1->GetType(); - Type^ guestroom1Type = guestroom1->GetType(); - Type^ masterbedroom1Type = masterbedroom1->GetType(); - - Console::WriteLine("room assignable from kitchen: {0}", room1Type->IsAssignableFrom(kitchen1Type)); - Console::WriteLine("bedroom assignable from guestroom: {0}", bedroom1Type->IsAssignableFrom(guestroom1Type)); - Console::WriteLine("kitchen assignable from masterbedroom: {0}", kitchen1Type->IsAssignableFrom(masterbedroom1Type)); - - // Demonstrate arrays: - Console::WriteLine(); - Console::WriteLine("Integer arrays:"); - array^ array2 = gcnew array(2); - array^ array10 = gcnew array(10); - array^ array22 = gcnew array(2, 2); - array^ array24 = gcnew array(2, 4); - - Type^ array2Type = array2->GetType(); - Type^ array10Type = array10->GetType(); - Type^ array22Type = array22->GetType(); - Type^ array24Type = array24->GetType(); - - Console::WriteLine("Int32[2] assignable from Int32[10]: {0}", array2Type->IsAssignableFrom(array10Type)); - Console::WriteLine("Int32[2] assignable from Int32[2,4]: {0}", array2Type->IsAssignableFrom(array24Type)); - Console::WriteLine("Int32[2,4] assignable from Int32[2,2]: {0}", array24Type->IsAssignableFrom(array22Type)); - - // Demonstrate generics: - Console::WriteLine(); - Console::WriteLine("Generics:"); - - // Note that "int?[]" is the same as "Nullable[]" - //int?[] arrayNull = new int?[10]; - array^ arrayNull = gcnew array(10); - List^ genIntList = gcnew List(); - List^ genTList = gcnew List(); - - Type^ arrayNullType = arrayNull->GetType(); - Type^ genIntListType = genIntList->GetType(); - Type^ genTListType = genTList->GetType(); - - Console::WriteLine("Int32[10] assignable from Nullable[10]: {0}", array10Type->IsAssignableFrom(arrayNullType)); - Console::WriteLine("List assignable from List: {0}", genIntListType->IsAssignableFrom(genTListType)); - Console::WriteLine("List assignable from List: {0}", genTListType->IsAssignableFrom(genIntListType)); - - Console::ReadLine(); - } -}; - -int main() -{ - Program::Main(); -} - -//This code example produces the following output: -// -// Defined Classes: -// room assignable from kitchen: True -// bedroom assignable from guestroom: True -//kitchen assignable from masterbedroom: False -// -// Integer arrays: -// Int32[2] assignable from Int32[10]: True -// Int32[2] assignable from Int32[2,4]: False -// Int32[2,4] assignable from Int32[2,2]: True -// -// Generics: -// Int32[10] assignable from Nullable[10]: False -// List assignable from List: False -// List assignable from List: False -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp deleted file mode 100644 index 9c1f8344454..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -enum class Color -{ Red, Blue, Green }; - -int main() -{ - Type^ colorType = Color::typeid; - Type^ enumType = Enum::typeid; - Console::WriteLine( "Is Color an enum? {0}.", colorType->IsEnum ); - Console::WriteLine( "Is Color a value type? {0}.", colorType->IsValueType ); - Console::WriteLine( "Is Enum an enum Type? {0}.", enumType->IsEnum ); - Console::WriteLine( "Is Enum a value type? {0}.", enumType->IsValueType ); -} -// The example displays the following output: -// Is Color an enum? True. -// Is Color a value type? True. -// Is Enum an enum type? False. -// Is Enum a value type? False. -// diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp deleted file mode 100644 index b2152ac3fa7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; - -public interface class IExample{}; - -public ref class BaseClass: IExample{}; - -public ref class DerivedClass: BaseClass{}; - -void main() -{ - Type^ interfaceType = IExample::typeid; - BaseClass^ base1 = gcnew BaseClass; - Type^ base1Type = base1->GetType(); - BaseClass^ derived1 = gcnew DerivedClass; - Type^ derived1Type = derived1->GetType(); - array^ arr = gcnew array(11); - Type^ arrayType = Array::typeid; - - Console::WriteLine("Is Int32[] an instance of the Array class? {0}.", - arrayType->IsInstanceOfType( arr ) ); - Console::WriteLine("Is myclass an instance of BaseClass? {0}.", - base1Type->IsInstanceOfType( base1 ) ); - Console::WriteLine("Is myderivedclass an instance of BaseClass? {0}.", - base1Type->IsInstanceOfType( derived1 ) ); - Console::WriteLine("Is myclass an instance of IExample? {0}.", - interfaceType->IsInstanceOfType( base1 ) ); - Console::WriteLine("Is myderivedclass an instance of IExample? {0}.", - interfaceType->IsInstanceOfType( derived1 ) ); -} -// The example displays the following output: -// Is int[] an instance of the Array class? True. -// Is base1 an instance of BaseClass? True. -// Is derived1 an instance of BaseClass? True. -// Is base1 an instance of IExample? True. -// Is derived1 an instance of IExample? True. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp deleted file mode 100644 index 00fb6116cb7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -void ThreadProc() -{ - Thread::Sleep(2000); -}; - -void main() -{ - Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); - Console::WriteLine("Before setting apartment state: {0}", - t->GetApartmentState()); - - t->SetApartmentState(ApartmentState::STA); - Console::WriteLine("After setting apartment state: {0}", - t->GetApartmentState()); - - bool result = t->TrySetApartmentState(ApartmentState::MTA); - Console::WriteLine("Try to change state: {0}", result); - - t->Start(); - - Thread::Sleep(500); - - try - { - t->TrySetApartmentState(ApartmentState::STA); - } - catch (ThreadStateException^) - { - Console::WriteLine("ThreadStateException occurs " + - "if apartment state is set after starting thread."); - } - - t->Join(); -} - -/* This code example produces the following output: - -Before setting apartment state: Unknown -After setting apartment state: STA -Try to change state: False -ThreadStateException occurs if apartment state is set after starting thread. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp deleted file mode 100644 index b1f06ee79ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Security::Permissions; -ref class ThreadWork -{ -public: - static void DoWork() - { - try - { - for ( int i = 0; i < 100; i++ ) - { - Console::WriteLine( "Thread - working." ); - Thread::Sleep( 100 ); - - } - } - catch ( ThreadAbortException^ e ) - { - Console::WriteLine( "Thread - caught ThreadAbortException - resetting." ); - Console::WriteLine( "Exception message: {0}", e->Message ); - Thread::ResetAbort(); - } - - Console::WriteLine( "Thread - still alive and working." ); - Thread::Sleep( 1000 ); - Console::WriteLine( "Thread - finished working." ); - } - -}; - -int main() -{ - ThreadStart^ myThreadDelegate = gcnew ThreadStart( ThreadWork::DoWork ); - Thread^ myThread = gcnew Thread( myThreadDelegate ); - myThread->Start(); - Thread::Sleep( 100 ); - Console::WriteLine( "Main - aborting my thread." ); - myThread->Abort(); - myThread->Join(); - Console::WriteLine( "Main ending." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp deleted file mode 100644 index 45cf4ed9674..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class ThreadWork -{ -public: - static void DoWork() - { - Console::WriteLine( "Working thread..." ); - } - -}; - -int main() -{ - ThreadStart^ myThreadDelegate = gcnew ThreadStart( ThreadWork::DoWork ); - Thread^ myThread = gcnew Thread( myThreadDelegate ); - myThread->Start(); - Thread::Sleep( 0 ); - Console::WriteLine( "In main. Attempting to restart myThread." ); - try - { - myThread->Start(); - } - catch ( ThreadStateException^ e ) - { - Console::WriteLine( "Caught: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp deleted file mode 100644 index d59246f431a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -public ref class ThreadWork -{ -public: - static void DoWork() - { - for ( int i = 0; i < 3; i++ ) - { - Console::WriteLine( "Working thread..." ); - Thread::Sleep( 100 ); - } - } -}; - -int main() -{ - ThreadStart^ myThreadDelegate = gcnew ThreadStart(&ThreadWork::DoWork); - Thread^ thread1 = gcnew Thread( myThreadDelegate ); - thread1->Start(); - for ( int i = 0; i < 3; i++ ) - { - Console::WriteLine( "In main." ); - Thread::Sleep( 100 ); - } -} -// The example displays output like the following: -// In main. -// Working thread... -// In main. -// Working thread... -// In main. -// Working thread... -// diff --git a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp b/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp deleted file mode 100644 index 29339b956eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -// This example demonstrates the use of the TimeoutException -// exception in conjunction with the SerialPort class. - -#using - -using namespace System; -using namespace System::IO::Ports; - -int main() -{ - String^ input; - try - { - // Set the COM1 serial port to speed = 4800 baud, parity = odd, - // data bits = 8, stop bits = 1. - SerialPort^ port = gcnew SerialPort("COM1", - 4800, Parity::Odd, 8, StopBits::One); - // Timeout after 2 seconds. - port->ReadTimeout = 2000; - port->Open(); - - // Read until either the default newline termination string - // is detected or the read operation times out. - input = port->ReadLine(); - - port->Close(); - - // Echo the input. - Console::WriteLine(input); - } - - // Only catch timeout exceptions. - catch (TimeoutException^ ex) - { - Console::WriteLine(ex); - } -}; -/* -This example produces the following results: - -(Data received at the serial port is echoed to the console if the -read operation completes successfully before the specified timeout period -expires. Otherwise, a timeout exception like the following is thrown.) - -System.TimeoutException: The operation has timed-out. -at System.IO.Ports.SerialStream.ReadByte(Int32 timeout) -at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout) -at System.IO.Ports.SerialPort.ReadTo(String value) -at System.IO.Ports.SerialPort.ReadLine() -at Sample.Main() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp deleted file mode 100644 index 0e97e3124f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// System::Configuration::Install::TransactedInstaller -// System::Configuration::Install::TransactedInstaller.TransactedInstaller() -// System::Configuration::Install::TransactedInstaller.Install(IDictionary*) -// System::COnfiguration::Install::TransactedInstaller.Uninstall(IDictionary*) - -/* -The following example demonstrates the constructor, Install(IDictionary*) and -Uninstall(IDictionary*) methods of the 'TransactedInstaller' class. -This example provides an implementation similar to that of 'InstallUtil.exe'. -It installs assemblies with the options preceding that particular assembly. -If an option is not specified for an assembly the previous assemblies options -are taken if there is a previous assembly in the list. If the '/u' or -'/uninstall' option is specified then the assemblies are uninstalled. -If the '/?' or '/help' option is provided then the help information is -printed to the console. -*/ - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::IO; - -void PrintHelpMessage() -{ - Console::WriteLine( "Usage : TransactedInstaller [/u | /uninstall] [option [...]] assembly" + - " [[option [...]] assembly] [...]]" ); - Console::WriteLine( "TransactedInstaller executes the installers in each of" + - " the given assembly. If /u or /uninstall option" + - " is given it uninstalls the assemblies." ); -} - -int main() -{ - // - // - // - // - array^ args = Environment::GetCommandLineArgs(); - ArrayList^ myOptions = gcnew ArrayList; - String^ myOption; - bool toUnInstall = false; - bool toPrintHelp = false; - TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; - AssemblyInstaller^ myAssemblyInstaller; - InstallContext^ myInstallContext; - - try - { - for ( int i = 1; i < args->Length; i++ ) - { - // Process the arguments. - if ( args[ i ]->StartsWith( "/" ) || args[ i ]->StartsWith( "-" ) ) - { - myOption = args[ i ]->Substring( 1 ); - // Determine whether the option is to 'uninstall' an assembly. - if ( String::Compare( myOption, "u", true ) == 0 || - String::Compare( myOption, "uninstall", true ) == 0 ) - { - toUnInstall = true; - continue; - } - // Determine whether the option is for printing help information. - if ( String::Compare( myOption, "?", true ) == 0 || - String::Compare( myOption, "help", true ) == 0 ) - { - toPrintHelp = true; - continue; - } - // Add the option encountered to the list of all options - // encountered for the current assembly. - myOptions->Add( myOption ); - } - else - { - // Determine whether the assembly file exists. - if ( !File::Exists( args[ i ] ) ) - { - // If assembly file doesn't exist then print error. - Console::WriteLine( "\nError : {0} - Assembly file doesn't exist.", - args[ i ] ); - return 0; - } - - // Create a instance of 'AssemblyInstaller' that installs the given assembly. - myAssemblyInstaller = - gcnew AssemblyInstaller( args[ i ], - (array^)( myOptions->ToArray( String::typeid ) ) ); - // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. - myTransactedInstaller->Installers->Add( myAssemblyInstaller ); - } - } - - // If user requested help or didn't provide any assemblies to install - // then print help message. - if ( toPrintHelp || myTransactedInstaller->Installers->Count == 0 ) - { - PrintHelpMessage(); - return 0; - } - - // Create a instance of 'InstallContext' with the options specified. - myInstallContext = - gcnew InstallContext( "Install.log", - (array^)( myOptions->ToArray( String::typeid ) ) ); - myTransactedInstaller->Context = myInstallContext; - - // Install or Uninstall an assembly depending on the option provided. - if ( !toUnInstall ) - { - myTransactedInstaller->Install( gcnew Hashtable ); - } - else - { - myTransactedInstaller->Uninstall( nullptr ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised : {0}", e->Message ); - } - // - // - // - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp b/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp deleted file mode 100644 index 813adf57610..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; - -// Declare MyTestClass as public. -public ref class TestClass{}; - -int main() -{ - TestClass^ testClassInstance = gcnew TestClass; - - // Get the type of myTestClassInstance. - Type^ testType = testClassInstance->GetType(); - - // Get the IsPublic property of the myTestClassInstance. - bool isPublic = testType->IsPublic; - Console::WriteLine( "Is {0} public? {1}", testType->FullName, isPublic); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp deleted file mode 100644 index 3f49f739983..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::InteropServices; -value struct Test1 -{ -public: - Byte B1; - short S; - Byte B2; -}; - - -[StructLayout(LayoutKind::Explicit,Pack=1)] -value struct Test2 -{ -public: - - [FieldOffset(0)] - Byte B1; - - [FieldOffset(1)] - short S; - - [FieldOffset(3)] - Byte B2; -}; - -static void DisplayLayoutAttribute( StructLayoutAttribute^ sla ) -{ - Console::WriteLine( L"\r\nCharSet: {0}\r\n Pack: {1}\r\n Size: {2}\r\n Value: {3}", sla->CharSet, sla->Pack, sla->Size, sla->Value ); -} - -int main() -{ - DisplayLayoutAttribute( Test1::typeid->StructLayoutAttribute ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp deleted file mode 100644 index c9151536fe5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public interface class I -{ - void M(); -}; - -public ref class A -{ -public: - virtual void M() { Console::WriteLine("In method A.M"); } -}; - -// The object of this code example is to emit code equivalent to -// the following C++ code: -// -public ref class C : A, I -{ -public: - virtual void M() override - { - Console::WriteLine("Overriding A.M from C.M"); - } - -private: - // In order to provide a different implementation from C.M when - // emitting the following explicit interface implementation, - // it is necessary to use a MethodImpl. - // - virtual void IM() sealed = I::M - { - Console::WriteLine("The I::M implementation of C"); - } -}; - -void main() -{ - String^ name = "DefineMethodOverrideExample"; - AssemblyName^ asmName = gcnew AssemblyName(name); - AssemblyBuilder^ ab = - AppDomain::CurrentDomain->DefineDynamicAssembly( - asmName, AssemblyBuilderAccess::RunAndSave); - ModuleBuilder^ mb = ab->DefineDynamicModule(name, name + ".dll"); - - TypeBuilder^ tb = - mb->DefineType("C", TypeAttributes::Public, A::typeid); - tb->AddInterfaceImplementation(I::typeid); - - // Build the method body for the explicit interface - // implementation. The name used for the method body - // can be anything. Here, it is the name of the method, - // qualified by the interface name. - // - MethodBuilder^ mbIM = tb->DefineMethod("I.M", - MethodAttributes::Private | MethodAttributes::HideBySig | - MethodAttributes::NewSlot | MethodAttributes::Virtual | - MethodAttributes::Final, - nullptr, - Type::EmptyTypes); - ILGenerator^ il = mbIM->GetILGenerator(); - il->Emit(OpCodes::Ldstr, "The I.M implementation of C"); - il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine", - gcnew array { String::typeid })); - il->Emit(OpCodes::Ret); - - // DefineMethodOverride is used to associate the method - // body with the interface method that is being implemented. - // - tb->DefineMethodOverride(mbIM, I::typeid->GetMethod("M")); - - MethodBuilder^ mbM = tb->DefineMethod("M", - MethodAttributes::Public | MethodAttributes::ReuseSlot | - MethodAttributes::Virtual | MethodAttributes::HideBySig, - nullptr, - Type::EmptyTypes); - il = mbM->GetILGenerator(); - il->Emit(OpCodes::Ldstr, "Overriding A.M from C.M"); - il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine", - gcnew array { String::typeid })); - il->Emit(OpCodes::Ret); - - Type^ tc = tb->CreateType(); - - // Save the emitted assembly, to examine with Ildasm.exe. - ab->Save(name + ".dll"); - - Object^ test = Activator::CreateInstance(tc); - - MethodInfo^ mi = I::typeid->GetMethod("M"); - mi->Invoke(test, nullptr); - - mi = A::typeid->GetMethod("M"); - mi->Invoke(test, nullptr); -} - -/* This code example produces the following output: - -The I.M implementation of C -Overriding A.M from C.M - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp deleted file mode 100644 index 6ea81968d31..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// System::Reflection::Emit::TypeBuilder.AddDeclarativeSecurity -/* The following example demonstrates method AddDeclarativeSecurity -of 'TypeBuilder' class. -The program creates a dynamic assembly and a type in it having support for declarative security. -It demands an Environmentpermission read access on 'TEMP'. -Caller (main) is able to create an instance successfully with -default permission(as local machine executes with full trust permission set). -*/ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Security; -using namespace System::Security::Permissions; - -int main() -{ - // Create a simple name for the assembly; create the assembly and module. - AssemblyName^ myAssemblyName = gcnew AssemblyName("EmittedAssembly"); - AssemblyBuilder^ myAssemblyBuilder = - AppDomain::CurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ myModuleBuilder = - myAssemblyBuilder->DefineDynamicModule( "EmittedAssembly", "EmittedAssembly.dll"); - - // Define a public class named "MyDynamicClass" in the assembly. - TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyDynamicClass", TypeAttributes::Public ); - - - // Create a permission set and add a security permission - // with the ControlEvidence flag. - // - PermissionSet^ myPermissionSet = gcnew PermissionSet(PermissionState::None); - myPermissionSet->AddPermission( - gcnew SecurityPermission(SecurityPermissionFlag::ControlEvidence)); - - // Add the permission set to the MyDynamicClass type, - // as a declarative security demand. - // - myTypeBuilder->AddDeclarativeSecurity(SecurityAction::Demand, myPermissionSet); - - - Type^ myType = myTypeBuilder->CreateType(); - myAssemblyBuilder->Save("EmittedAssembly.dll"); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp deleted file mode 100644 index c19e9adcb71..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// System.Reflection.Emit.TypeBuilder.DefineNestedType(string, TypeAttributes, Type, Type[]) -// System.Reflection.Emit.TypeBuilder.DefineMethodOverride(MethodInfo, MethodInfo) -// System.Reflection.Emit.TypeBuilder.DefineMethod(string, MethodAttributes,Type,Type[]) -/* -The following program demonstrates the 'DefineNestedType', 'DefineMethodOverride' and -'DefineMethod' methods of 'TypeBuilder' class. It builds an assembly by defining -'MyHelloWorld' type. 'MyHelloWorld' class has a nested class 'MyNestedClass' which extends -'EmittedClass' and implements 'IMyInterface' interface. Then it creates and instance of -'MyNestedClass' type and calls the 'HelloMethod' using 'IMyInterface' object and -results are displayed to the console. -*/ -// -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -public interface class IMyInterface -{ - String^ HelloMethod( String^ parameter ); -}; - -public ref class EmittedClass -{ -public: - // Because this method calls Activator::CreateInstance, - // it requires full trust. - [System::Security::Permissions::PermissionSetAttribute - (System::Security::Permissions::SecurityAction::Demand, Name = "FullTrust")] - static void Main() - { - Type^ myNestedClassType = CreateCallee( Thread::GetDomain() ); - - // Create an instance of 'MyNestedClass'. - IMyInterface^ myInterface = dynamic_cast(Activator::CreateInstance( myNestedClassType )); - Console::WriteLine( myInterface->HelloMethod( "Bill" ) ); - } - -private: - - // Create the callee transient dynamic assembly. - static Type^ CreateCallee( AppDomain^ myAppDomain ) - { - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedClass"; - - // Create the callee dynamic assembly. - AssemblyBuilder^ myAssembly = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module in the callee assembly. - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Define a public class named "MyHelloWorld". - TypeBuilder^ myHelloWorldType = myModule->DefineType( "MyHelloWorld", TypeAttributes::Public ); - - // Define a public nested class named 'MyNestedClass'. - array^temp0 = {IMyInterface::typeid}; - TypeBuilder^ myNestedClassType = myHelloWorldType->DefineNestedType( "MyNestedClass", TypeAttributes::NestedPublic, EmittedClass::typeid, temp0 ); - - // Implement 'IMyInterface' interface. - myNestedClassType->AddInterfaceImplementation( IMyInterface::typeid ); - - // Define 'HelloMethod' of 'IMyInterface'. - array^temp1 = {String::typeid}; - MethodBuilder^ myHelloMethod = myNestedClassType->DefineMethod( "HelloMethod", static_cast(MethodAttributes::Public | MethodAttributes::Virtual), String::typeid, temp1 ); - - // Generate IL for 'GetGreeting' method. - ILGenerator^ myMethodIL = myHelloMethod->GetILGenerator(); - myMethodIL->Emit( OpCodes::Ldstr, "Hi! " ); - myMethodIL->Emit( OpCodes::Ldarg_1 ); - array^temp2 = {String::typeid,String::typeid}; - MethodInfo^ infoMethod = String::typeid->GetMethod( "Concat", temp2 ); - myMethodIL->Emit( OpCodes::Call, infoMethod ); - myMethodIL->Emit( OpCodes::Ret ); - MethodInfo^ myHelloMethodInfo = IMyInterface::typeid->GetMethod( "HelloMethod" ); - - // Implement 'HelloMethod' of 'IMyInterface'. - myNestedClassType->DefineMethodOverride( myHelloMethod, myHelloMethodInfo ); - - // Create 'MyHelloWorld' type. - Type^ myType = myHelloWorldType->CreateType(); - - // Create 'MyNestedClass' type. - return myNestedClassType->CreateType(); - } -}; - -int main() -{ - EmittedClass::Main(); -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp deleted file mode 100644 index 15212e47056..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -using namespace System; -using namespace System::Text; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; - - void main() - { - // Create the AssemblyBuilder. - AssemblyName^ asmName = gcnew AssemblyName("PInvokeTest"); - AssemblyBuilder^ dynamicAsm = AppDomain::CurrentDomain->DefineDynamicAssembly( - asmName, - AssemblyBuilderAccess::RunAndSave - ); - - // Create the module. - ModuleBuilder^ dynamicMod = - dynamicAsm->DefineDynamicModule(asmName->Name, asmName->Name + ".dll"); - - // Create the TypeBuilder for the class that will contain the - // signature for the PInvoke call. - TypeBuilder^ tb = dynamicMod->DefineType( - "MyType", - TypeAttributes::Public | TypeAttributes::UnicodeClass - ); - - MethodBuilder^ mb = tb->DefinePInvokeMethod( - "GetTickCount", - "Kernel32.dll", - MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::PinvokeImpl, - CallingConventions::Standard, - int::typeid, - Type::EmptyTypes, - CallingConvention::Winapi, - CharSet::Ansi); - - // Add PreserveSig to the method implementation flags. NOTE: If this line - // is commented out, the return value will be zero when the method is - // invoked. - mb->SetImplementationFlags( - mb->GetMethodImplementationFlags() | MethodImplAttributes::PreserveSig); - - // The PInvoke method does not have a method body. - - // Create the class and test the method. - Type^ t = tb->CreateType(); - - MethodInfo^ mi = t->GetMethod("GetTickCount"); - Console::WriteLine("Testing PInvoke method..."); - Console::WriteLine("GetTickCount returned: {0}", mi->Invoke(nullptr, nullptr)); - - // Produce the .dll file. - Console::WriteLine("Saving: " + asmName->Name + ".dll"); - dynamicAsm->Save(asmName->Name + ".dll"); - }; - -/* This example produces output similar to the following: - -Testing PInvoke method... -GetTickCount returned: 1314410994 -Saving: PInvokeTest.dll - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp deleted file mode 100644 index ad88d21ef91..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp +++ /dev/null @@ -1,98 +0,0 @@ - - -// System::Reflection::Emit::TypeBuilder::DefineUninitializedData(string,int,FieldAttributes) -/* -The following program demonstrates the 'DefineUninitializedData' -method of 'TypeBuilder' class. It builds an assembly by defining 'MyHelloWorld' type and -it has 'MyGreeting' field. Then it displays the initial value of 'MyGreeting' -field to the console. -*/ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Permissions; - -public ref class Example -{ -public: - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - static void Main() - { - Type^ myHelloWorldType = CreateCallee( Thread::GetDomain() ); - Object^ myHelloWorldInstance = Activator::CreateInstance( myHelloWorldType ); - FieldInfo^ myGreetingFieldInfo = myHelloWorldType->GetField( "MyGreeting" ); - Object^ oval = Activator::CreateInstance( myGreetingFieldInfo->FieldType ); - IntPtr myIntPtr = Marshal::AllocHGlobal( 4 ); - Random^ rand = gcnew Random; - int iTempSeed = rand->Next(); - array^bINITBYTE = GetRandBytes( iTempSeed, 4 ); - IntPtr intptrTemp = myIntPtr; - for ( int j = 0; j < 4; j++ ) - { - Marshal::WriteByte( myIntPtr, bINITBYTE[ j ] ); - myIntPtr = (IntPtr)((int)myIntPtr + 1); - - } - myIntPtr = intptrTemp; - Object^ oValNew = Marshal::PtrToStructure( myIntPtr, myGreetingFieldInfo->FieldType ); - Marshal::FreeHGlobal( myIntPtr ); - myIntPtr = Marshal::AllocHGlobal( 4 ); - Object^ myObj = myGreetingFieldInfo->GetValue( myHelloWorldInstance ); - Marshal::StructureToPtr( myObj, myIntPtr, true ); - intptrTemp = myIntPtr; - Console::WriteLine( "The value of 'MyGreeting' field : " ); - for ( int j = 0; j < 4; j++ ) - { - Marshal::WriteByte( myIntPtr, bINITBYTE[ j ] ); - Console::WriteLine( bINITBYTE[ j ] ); - myIntPtr = (IntPtr)((int)myIntPtr + 1); - - } - } - - -private: - static array^ GetRandBytes( int iRandSeed, int iSize ) - { - array^barr = gcnew array(iSize); - Random^ randTemp = gcnew Random( iRandSeed ); - randTemp->NextBytes( barr ); - return barr; - } - - - // Create the callee transient dynamic assembly. - static Type^ CreateCallee( AppDomain^ myDomain ) - { - - // Create a simple name for the callee assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedClass"; - - // Create the callee dynamic assembly. - AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module in the callee assembly. - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Define a public class named "MyHelloWorld" - TypeBuilder^ myHelloWorldType = myModule->DefineType( "MyHelloWorld", TypeAttributes::Public ); - - // Define a 'MyGreeting' field and initialize it. - FieldBuilder^ myFieldBuilder = myHelloWorldType->DefineUninitializedData( "MyGreeting", 4, FieldAttributes::Public ); - - // Create the 'MyHelloWorld' class. - return (myHelloWorldType->CreateType()); - } - -}; - -int main() -{ - Example::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp deleted file mode 100644 index e35e284ec04..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// System::Reflection::Emit::TypeBuilder.GetEvents(BindingFlags) -/* -The program demonstrates the 'GetEvents' method of the 'TypeBuilder' class. -It builds an assembly by defining 'HelloWorld' type and creates a 'Click' and -'MouseUp' events on the type. Then displays all events to the Console. -*/ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -ref class MyApplication -{ -private: - delegate void MyEvent( Object^ temp ); - -public: - - // Create the callee transient dynamic assembly. - static TypeBuilder^ CreateCallee( AppDomain^ myDomain ) - { - AssemblyName^ assemblyName = gcnew AssemblyName; - assemblyName->Name = "EmittedAssembly"; - - // Create the callee dynamic assembly. - AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Define a public class named "HelloWorld" in the assembly. - TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - array^typeArray = gcnew array(1); - typeArray[ 0 ] = Object::typeid; - MethodBuilder^ myMethod1 = helloWorldClass->DefineMethod( "OnClick", MethodAttributes::Public, void::typeid, typeArray ); - ILGenerator^ methodIL1 = myMethod1->GetILGenerator(); - methodIL1->Emit( OpCodes::Ret ); - MethodBuilder^ myMethod2 = helloWorldClass->DefineMethod( "OnMouseUp", MethodAttributes::Public, void::typeid, typeArray ); - ILGenerator^ methodIL2 = myMethod2->GetILGenerator(); - methodIL2->Emit( OpCodes::Ret ); - - // Create the events. - EventBuilder^ myEvent1 = helloWorldClass->DefineEvent( "Click", EventAttributes::None, MyEvent::typeid ); - myEvent1->SetRaiseMethod( myMethod1 ); - EventBuilder^ myEvent2 = helloWorldClass->DefineEvent( "MouseUp", EventAttributes::None, MyEvent::typeid ); - myEvent2->SetRaiseMethod( myMethod2 ); - helloWorldClass->CreateType(); - return (helloWorldClass); - } -}; - -int main() -{ - TypeBuilder^ helloWorldClass = MyApplication::CreateCallee( Thread::GetDomain() ); - array^info = helloWorldClass->GetEvents( static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine( "'HelloWorld' type has following events :" ); - for ( int i = 0; i < info->Length; i++ ) - Console::WriteLine( info[ i ]->Name ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp deleted file mode 100644 index a6d8a10bd75..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// System.Reflection.Emit.TypeBuilder.FullName -// System.Reflection.Emit.TypeBuilder.GetConstructors -// System.Reflection.Emit.TypeBuilder.DefineTypeInitializer -/* -The following program demonstrates DefineTypeInitializer and 'GetConstructors' methods and -the 'FullName' property of 'TypeBuilder' class. It builds an assembly by defining 'HelloWorld' -type. It also defines a constructor for 'HelloWorld' type. Then it displays the -full name of type and its constructors to the console. -*/ -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// -// -// -// Create the callee transient dynamic assembly. -TypeBuilder^ CreateCallee( AppDomain^ myDomain ) -{ - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - - // Create the callee dynamic assembly. - AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module named "CalleeModule" in the callee assembly. - ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); - - // Define a public class named "HelloWorld" in the assembly. - TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Define a private String field named "Greeting" in the type. - FieldBuilder^ greetingField = helloWorldClass->DefineField( "Greeting", String::typeid, FieldAttributes::Private ); - - // Create the constructor. - ConstructorBuilder^ constructor = helloWorldClass->DefineTypeInitializer(); - - // Generate IL for the method. The constructor calls its base class - // constructor. The constructor stores its argument in the private field. - ILGenerator^ constructorIL = constructor->GetILGenerator(); - constructorIL->Emit( OpCodes::Ldarg_0 ); - ConstructorInfo^ superConstructor = Object::typeid->GetConstructor( gcnew array(0) ); - constructorIL->Emit( OpCodes::Call, superConstructor ); - constructorIL->Emit( OpCodes::Ldarg_0 ); - constructorIL->Emit( OpCodes::Ldarg_1 ); - constructorIL->Emit( OpCodes::Stfld, greetingField ); - constructorIL->Emit( OpCodes::Ret ); - helloWorldClass->CreateType(); - return (helloWorldClass); -} - -int main() -{ - // Create the "HelloWorld" class - TypeBuilder^ helloWorldClass = CreateCallee( Thread::GetDomain() ); - Console::WriteLine( "Full Name : {0}", helloWorldClass->FullName ); - Console::WriteLine( "Constructors :" ); - array^info = helloWorldClass->GetConstructors( static_cast(BindingFlags::Public | BindingFlags::Instance) ); - for ( int index = 0; index < info->Length; index++ ) - Console::WriteLine( info[ index ] ); -} -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp deleted file mode 100644 index 073d9d96852..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// System.Reflection.Emit.TypeBuilder.DefineField() -// System.Reflection.Emit.TypeBuilder.DefineConstructor() -// System.Reflection.Emit.TypeBuilder.AddInterfaceImplementation() -// System.Reflection.Emit.TypeBuilder.BaseType - -/* The following program demonstrates the property 'BaseType' and methods - 'DefineField','DefineConstructor','AddInterfaceImplementation' of the - class 'TypeBuilder'. - The program creates a dynamic assembly and a type within it called as - 'HelloWorld' This defines a field and implements an interface. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Threading; - -// Declare the interface. -interface class IHello -{ - void SayHello(); -}; - -// Create the transient dynamic assembly. -Type^ CreateDynamicAssembly( AppDomain^ myAppDomain, AssemblyBuilderAccess myAccess ) -{ - // Create a simple name for assembly. - AssemblyName^ myAssemblyName = gcnew AssemblyName; - myAssemblyName->Name = "EmittedAssembly"; - // Create the dynamic assembly. - AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, myAccess ); - // Create a dynamic module named 'CalleeModule' in the assembly. - ModuleBuilder^ myModuleBuilder; - myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", - "EmittedModule.mod" ); -// -// - // Define a public class named 'myHelloWorld' in the assembly. - TypeBuilder^ helloWorldTypeBuilder = - myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public ); - - // Get base type. - Console::WriteLine( "Base Type :{0}", helloWorldTypeBuilder->BaseType->Name ); -// - - // Define 'myGreetingField' field. - FieldBuilder^ myGreetingField = - helloWorldTypeBuilder->DefineField( "myGreeting", String::typeid, - FieldAttributes::Public ); -// - -// - // Define the constructor. - array^ constructorArgs = {String::typeid}; - ConstructorBuilder^ myConstructorBuilder = - helloWorldTypeBuilder->DefineConstructor( MethodAttributes::Public, - CallingConventions::Standard, constructorArgs ); - // Generate IL for the method. The constructor stores its argument in the private field. - ILGenerator^ myConstructorIL = myConstructorBuilder->GetILGenerator(); - myConstructorIL->Emit( OpCodes::Ldarg_0 ); - myConstructorIL->Emit( OpCodes::Ldarg_1 ); - myConstructorIL->Emit( OpCodes::Stfld, myGreetingField ); - myConstructorIL->Emit( OpCodes::Ret ); -// - -// - // Mark the class as implementing 'IHello' interface. - helloWorldTypeBuilder->AddInterfaceImplementation( IHello::typeid ); - MethodBuilder^ myMethodBuilder = - helloWorldTypeBuilder->DefineMethod( "SayHello", - (MethodAttributes)(MethodAttributes::Public | MethodAttributes::Virtual), - nullptr, - nullptr ); - // Generate IL for 'SayHello' method. - ILGenerator^ myMethodIL = myMethodBuilder->GetILGenerator(); - myMethodIL->EmitWriteLine( myGreetingField ); - myMethodIL->Emit( OpCodes::Ret ); - MethodInfo^ sayHelloMethod = IHello::typeid->GetMethod( "SayHello" ); - helloWorldTypeBuilder->DefineMethodOverride( myMethodBuilder, sayHelloMethod ); -// - return (helloWorldTypeBuilder->CreateType()); -} - -int main() -{ - Console::WriteLine( "TypeBuilder Sample" ); - Console::WriteLine( "----------------------" ); - - // Create 'helloWorldType' . - Type^ helloWorldType = CreateDynamicAssembly( Thread::GetDomain(), AssemblyBuilderAccess::RunAndSave ); - - // Create an instance of 'HelloWorld' class. - array^ temp0 = {"Called HelloWorld"}; - Object^ helloWorld = Activator::CreateInstance( helloWorldType, temp0 ); - - // Invoke 'SayHello' method. - helloWorldType->InvokeMember( "SayHello", static_cast(BindingFlags::Default | BindingFlags::InvokeMethod), nullptr, helloWorld, nullptr ); - - // Get defined field in the class. - Console::WriteLine( "Defined Field :{0}", helloWorldType->GetField( "myGreeting" )->Name ); - AssemblyBuilder^ myAssemblyBuilder = dynamic_cast(helloWorldType->Assembly); - myAssemblyBuilder->Save( "EmittedAssembly.dll" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp deleted file mode 100644 index 1da14c506f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// System.Runtime.InteropServices.TypeLibVarAttribute -// System.Runtime.InteropServices.TypeLibVarFlags -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -ref class ClassD -{ -public: - static bool IsHiddenField( FieldInfo^ fi ) - { - array^FieldAttributes = fi->GetCustomAttributes( TypeLibVarAttribute::typeid, true ); - if ( FieldAttributes->Length > 0 ) - { - TypeLibVarAttribute^ tlv = dynamic_cast(FieldAttributes[ 0 ]); - TypeLibVarFlags flags = tlv->Value; - return (flags & TypeLibVarFlags::FHidden) != (TypeLibVarFlags)0; - } - - return false; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp deleted file mode 100644 index cb8e0c58917..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; - -class TypeLoadExceptionDemoClass -{ - public: - static bool GenerateException() - { - // Throw a TypeLoadException with a custom message. - throw gcnew TypeLoadException("This is a custom TypeLoadException error message."); - } -}; - -int main() -{ - try { - // Call a method that throws an exception. - TypeLoadExceptionDemoClass::GenerateException(); - } - catch ( TypeLoadException^ e ) { - Console::WriteLine("TypeLoadException:\n {0}", e->Message); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message ); - } - -} -// The example displays the following output: -// TypeLoadException: -// This is a custom TypeLoadException error message. -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp deleted file mode 100644 index 649e2fc5034..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// System::TypeLoadException::TypeLoadException -/* This program demonstrates the 'TypeLoadException(String*, Exception)' - constructor of 'TypeLoadException' class. It attempts to call a - non-existent method located in NonExistentDLL.dll, which will - throw an exception. A new exception is thrown with this exception - as an inner exception. -*/ -// -using namespace System; -using namespace System::Runtime::InteropServices; -ref class TypeLoadExceptionDemoClass -{ -public: - - // A call to this method will raise a TypeLoadException. - - [DllImport("NonExistentDLL.DLL",EntryPoint="MethodNotExists")] - static void NonExistentMethod(); - static void GenerateException() - { - try - { - NonExistentMethod(); - } - catch ( TypeLoadException^ e ) - { - - // Rethrow exception with the exception as inner exception - throw gcnew TypeLoadException( "This exception was raised due to a call to an invalid method.",e ); - } - - } - -}; - -int main() -{ - Console::WriteLine( "Calling a method in a non-existent DLL which triggers a TypeLoadException." ); - try - { - TypeLoadExceptionDemoClass::GenerateException(); - } - catch ( TypeLoadException^ e ) - { - Console::WriteLine( "TypeLoadException: \n\tError Message = {0}", e->Message ); - Console::WriteLine( "TypeLoadException: \n\tInnerException Message = {0}", e->InnerException->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp deleted file mode 100644 index 6b8fd92068e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp +++ /dev/null @@ -1,112 +0,0 @@ - - -// System::TypeLoadException::GetObjectData -// System::TypeLoadException -/* This program demonstrates the 'GetObjectData' method and the - protected constructor TypeLoadException(SerializationInfo, StreamingContext) - of 'TypeLoadException' class. It generates an exception and - serializes the exception data to a file and then reconstitutes the - exception. -*/ -// -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Soap; -using namespace System::IO; - -// This class overrides the GetObjectData method and initializes -// its data with current time. - -[Serializable] -public ref class MyTypeLoadExceptionChild: public TypeLoadException -{ -public: - System::DateTime ErrorDateTime; - MyTypeLoadExceptionChild() - { - ErrorDateTime = DateTime::Now; - } - - MyTypeLoadExceptionChild( DateTime myDateTime ) - { - ErrorDateTime = myDateTime; - } - - -protected: - MyTypeLoadExceptionChild( SerializationInfo^ sInfo, StreamingContext * sContext ) - { - - // Reconstitute the deserialized information into the instance. - ErrorDateTime = sInfo->GetDateTime( "ErrorDate" ); - } - - -public: - void GetObjectData( SerializationInfo^ sInfo, StreamingContext * sContext ) - { - - // Add a value to the Serialization information. - sInfo->AddValue( "ErrorDate", ErrorDateTime ); - } - -}; - -int main() -{ - - // Load the mscorlib assembly and get a reference to it. - // You must supply the fully qualified assembly name for mscorlib.dll here. - Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); - try - { - Console::WriteLine( "Attempting to load a type not present in the assembly 'mscorlib'" ); - - // This loading of invalid type raises a TypeLoadException - Type^ myType = myAssembly->GetType( "System::NonExistentType", true ); - } - catch ( TypeLoadException^ ) - { - - // Serialize the exception to disk and reconstitute it back again. - try - { - System::DateTime ErrorDatetime = DateTime::Now; - Console::WriteLine( "A TypeLoadException has been raised." ); - - // Create MyTypeLoadException instance with current time. - MyTypeLoadExceptionChild^ myTypeLoadExceptionChild = gcnew MyTypeLoadExceptionChild( ErrorDatetime ); - IFormatter^ myFormatter = gcnew SoapFormatter; - Stream^ myFileStream = gcnew FileStream( "typeload.xml",FileMode::Create,FileAccess::Write,FileShare::None ); - Console::WriteLine( "Serializing the TypeLoadException with DateTime as {0}", ErrorDatetime ); - - // Serialize the MyTypeLoadException instance to a file. - myFormatter->Serialize( myFileStream, myTypeLoadExceptionChild ); - myFileStream->Close(); - Console::WriteLine( "Deserializing the Exception." ); - myFileStream = gcnew FileStream( "typeload.xml",FileMode::Open,FileAccess::Read,FileShare::None ); - - // Deserialize and reconstitute the instance from file. - myTypeLoadExceptionChild = safe_cast(myFormatter->Deserialize( myFileStream )); - myFileStream->Close(); - Console::WriteLine( "Deserialized exception has ErrorDateTime = {0}", myTypeLoadExceptionChild->ErrorDateTime ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp deleted file mode 100644 index 102cf32f110..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// System::TypeLoadException::TypeName;System::TypeLoadException::Message - -/* This program demonstrates the 'TypeName' and 'Message' properties - of the 'TypeLoadException' class. It attempts to load a - non-existent type from the mscorlib assembly which throws an - exception. This exception is caught and the TypeName and Message - values are displayed. -*/ - -using namespace System; -using namespace System::Reflection; - -int main() -{ - // - // - // Load the mscorlib assembly and get a reference to it. - // You must supply the fully qualified assembly name for mscorlib.dll here. - Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); - try - { - Console::WriteLine( "This program throws an exception upon successful run." ); - - // Attempt to load a non-existent type from an assembly. - Type^ myType = myAssembly->GetType( "System.NonExistentType", true ); - } - catch ( TypeLoadException^ e ) - { - // Display the name of the Type that was not found. - Console::WriteLine( "TypeLoadException: \n\tError loading the type '{0}' from the assembly 'mscorlib'", e->TypeName ); - Console::WriteLine( "\tError Message = {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: Error Message = {0}", e->Message ); - } - // - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp deleted file mode 100644 index 4ae236700c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Type^ objType = System::Array::typeid; - - // Print the full assembly name. - Console::WriteLine( "Full assembly name: {0}.", objType->Assembly->FullName ); - - // Print the qualified assembly name. - Console::WriteLine( "Qualified assembly name: {0}.", objType->AssemblyQualifiedName ); -} -// The example displays the following output if run under the .NET Framework 4.5: -// Full assembly name: -// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. -// Qualified assembly name: -// System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp b/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp deleted file mode 100644 index f9301b87911..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -public: - void HelloWorld() - { - Console::WriteLine( "Hello World" ); - } - -}; - -int main() -{ - try - { - Binder^ defaultBinder = Type::DefaultBinder; - MyClass^ myClass = gcnew MyClass; - - // Invoke the HelloWorld method of MyClass. - myClass->GetType()->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, defaultBinder, myClass, nullptr ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp deleted file mode 100644 index bcb5e2a58a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; -using namespace System::Security; -int main() -{ - try - { - MemberFilter^ myFilter = Type::FilterAttribute; - Type^ myType = System::String::typeid; - array^myMemberInfoArray = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, MethodAttributes::SpecialName ); - IEnumerator^ myEnum = myMemberInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MemberInfo^ myMemberinfo = safe_cast(myEnum->Current); - Console::Write( "\n {0}", myMemberinfo->Name ); - Console::Write( " is a {0}", myMemberinfo->MemberType ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::Write( "ArgumentNullException : {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::Write( "SecurityException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::Write( "Exception : {0}", e->Message ); - } - -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp deleted file mode 100644 index 38bf38a1528..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; -using namespace System::Security; -int main() -{ - try - { - MemberFilter^ myFilter = Type::FilterNameIgnoreCase; - Type^ myType = System::String::typeid; - array^myMemberinfo1 = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, "C*" ); - IEnumerator^ myEnum = myMemberinfo1->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MemberInfo^ myMemberinfo2 = safe_cast(myEnum->Current); - Console::Write( "\n {0}", myMemberinfo2->Name ); - MemberTypes Mymembertypes = myMemberinfo2->MemberType; - Console::WriteLine( " is a {0}", Mymembertypes ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::Write( "ArgumentNullException : {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::Write( "SecurityException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::Write( "Exception : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp deleted file mode 100644 index 12d2c367f57..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Reflection; -public ref class MyFindInterfacesSample -{ -public: - static bool MyInterfaceFilter(Type^ typeObj, Object^ criteriaObj) - { - if(typeObj->ToString()->Equals(criteriaObj->ToString())) - return true; - else - return false; - } -}; - -int main() -{ - try - { - XmlDocument^ myXMLDoc = gcnew XmlDocument; - myXMLDoc->LoadXml("" - + "Pride And Prejudice "); - Type^ myType = myXMLDoc->GetType(); - - // Specify the TypeFilter delegate that compares the interfaces - // against filter criteria. - TypeFilter^ myFilter = gcnew TypeFilter( - MyFindInterfacesSample::MyInterfaceFilter); - array^myInterfaceList = {"System.Collections.IEnumerable", - "System.Collections.ICollection"}; - for(int index = 0; index < myInterfaceList->Length; index++) - { - array^myInterfaces = myType->FindInterfaces( - myFilter, myInterfaceList[index]); - if(myInterfaces->Length > 0) - { - Console::WriteLine("\n{0} implements the interface {1}.", - myType, myInterfaceList[index]); - for(int j = 0; j < myInterfaces->Length; j++) - Console::WriteLine("Interfaces supported: {0}.", - myInterfaces[j]); - } - else - Console::WriteLine( - "\n{0} does not implement the interface {1}.", - myType, myInterfaceList[index]); - - } - } - catch(ArgumentNullException^ e) - { - Console::WriteLine("ArgumentNullException: {0}", e->Message); - } - catch(TargetInvocationException^ e) - { - Console::WriteLine("TargetInvocationException: {0}", e->Message); - } - catch(Exception^ e) - { - Console::WriteLine("Exception: {0}", e->Message); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp deleted file mode 100644 index 759df40e831..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyFindMembersClass -{ -public: - static void Test() - { - Object^ objTest = gcnew Object; - Type^ objType = objTest->GetType(); - array^arrayMemberInfo; - try - { - - //Find all static or public methods in the Object class that match the specified name. - arrayMemberInfo = objType->FindMembers( MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), gcnew MemberFilter( DelegateToSearchCriteria ), "ReferenceEquals" ); - for ( int index = 0; index < arrayMemberInfo->Length; index++ ) - Console::WriteLine( "Result of FindMembers -\t {0}", String::Concat( arrayMemberInfo[ index ], "\n" ) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e ); - } - - } - - static bool DelegateToSearchCriteria( MemberInfo^ objMemberInfo, Object^ objSearch ) - { - - // Compare the name of the member function with the filter criteria. - if ( objMemberInfo->Name->Equals( objSearch->ToString() ) ) - return true; - else - return false; - } - -}; - -int main() -{ - MyFindMembersClass::Test(); -} -/* The example produces the following output: - -Result of FindMembers - Boolean ReferenceEquals(System.Object, System.Object) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp deleted file mode 100644 index 0917b237224..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - array^myArray = gcnew array(3,4,5); - Type^ myType = myArray->GetType(); - Console::WriteLine( "myArray has {0} dimensions.", myType->GetArrayRank() ); - } - catch ( NotSupportedException^ e ) - { - Console::WriteLine( "NotSupportedException raised." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp deleted file mode 100644 index b0cdfecb09c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyClass1 -{ -public: - MyClass1(){} - - MyClass1( int i ){} - -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - array^types = gcnew array(1); - types[ 0 ] = int::typeid; - - // Get the constructor that takes an integer as a parameter. - ConstructorInfo^ constructorInfoObj = myType->GetConstructor( types ); - if ( constructorInfoObj != nullptr ) - { - Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is: " ); - Console::WriteLine( constructorInfoObj ); - } - else - { - Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is not available." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp deleted file mode 100644 index 66f4064a45d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyClass1 -{ -public: - MyClass1( int i ){} - -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - array^types = gcnew array(1); - types[ 0 ] = int::typeid; - - // Get the constructor that is public and takes an integer parameter. - ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, types, nullptr ); - if ( constructorInfoObj != nullptr ) - { - Console::WriteLine( "The constructor of MyClass1 that is public and takes an integer as a parameter is:" ); - Console::WriteLine( constructorInfoObj ); - } - else - { - Console::WriteLine( "The constructor of the MyClass1 that is public and takes an integer as a parameter is not available." ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( "ArgumentException: {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp deleted file mode 100644 index 6d911a7f1cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyClass1 -{ -public: - MyClass1( int i ){} - -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - array^types = gcnew array(1); - types[ 0 ] = int::typeid; - - // Get the public instance constructor that takes an integer parameter. - ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, CallingConventions::HasThis, types, nullptr ); - if ( constructorInfoObj != nullptr ) - { - Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is: " ); - Console::WriteLine( constructorInfoObj ); - } - else - { - Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is not available." ); - } - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( "ArgumentException: {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp deleted file mode 100644 index b924dff4307..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::IO; - -[DefaultMemberAttribute("Age")] -public ref class MyClass -{ -public: - void Name( String^ s ){} - - - property int Age - { - int get() - { - return 20; - } - - } - -}; - -int main() -{ - try - { - Type^ myType = MyClass::typeid; - array^memberInfoArray = myType->GetDefaultMembers(); - if ( memberInfoArray->Length > 0 ) - { - System::Collections::IEnumerator^ myEnum = memberInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MemberInfo^ memberInfoObj = safe_cast(myEnum->Current); - Console::WriteLine( "The default member name is: {0}", memberInfoObj ); - } - } - else - { - Console::WriteLine( "No default members are available." ); - } - } - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( "InvalidOperationException: {0}", e->Message ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "IOException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp deleted file mode 100644 index f6faf3d5c38..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -int main() -{ - try - { - Type^ myType = System::Windows::Forms::Button::typeid; - EventInfo^ myEvent = myType->GetEvent( "Click" ); - if ( myEvent != nullptr ) - { - Console::WriteLine( "Looking for the Click event in the Button class." ); - Console::WriteLine( myEvent ); - } - else - Console::WriteLine( "The Click event is not available in the Button class." ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp deleted file mode 100644 index 1921939e115..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -// -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -public ref class MyFieldClassA -{ -public: - String^ field; - MyFieldClassA() - { - field = "A Field"; - } - - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -public ref class MyFieldClassB -{ -public: - String^ field; - MyFieldClassB() - { - field = "B Field"; - } - - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -int main() -{ - try - { - MyFieldClassB^ myFieldObjectB = gcnew MyFieldClassB; - MyFieldClassA^ myFieldObjectA = gcnew MyFieldClassA; - Type^ myTypeA = Type::GetType( "MyFieldClassA" ); - FieldInfo^ myFieldInfo = myTypeA->GetField( "field" ); - Type^ myTypeB = Type::GetType( "MyFieldClassB" ); - FieldInfo^ myFieldInfo1 = myTypeB->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine( "The value of the field is : {0} ", myFieldInfo->GetValue( myFieldObjectA ) ); - Console::WriteLine( "The value of the field is : {0} ", myFieldInfo1->GetValue( myFieldObjectB ) ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Exception Raised!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "Exception Raised!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Raised!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp deleted file mode 100644 index 38a4f53dbdb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security; -using namespace System::Reflection; - -int main() -{ - Type^ myType = System::Net::IPAddress::typeid; - array^myFields = myType->GetFields( static_cast(BindingFlags::Static | BindingFlags::NonPublic) ); - Console::WriteLine( "\nThe IPAddress class has the following nonpublic fields: " ); - System::Collections::IEnumerator^ myEnum = myFields->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FieldInfo^ myField = safe_cast(myEnum->Current); - Console::WriteLine( myField ); - } - - Type^ myType1 = System::Net::IPAddress::typeid; - array^myFields1 = myType1->GetFields(); - Console::WriteLine( "\nThe IPAddress class has the following public fields: " ); - System::Collections::IEnumerator^ myEnum2 = myFields1->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - FieldInfo^ myField = safe_cast(myEnum2->Current); - Console::WriteLine( myField ); - } - - try - { - Console::WriteLine( "The HashCode of the System::Windows::Forms::Button type is: {0}", System::Windows::Forms::Button::typeid->GetHashCode() ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp deleted file mode 100644 index 6bd012509e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -/* -System::Type::GetInterface(String) -System::Type::GetInterface(String, bool) -System::Type::GetInterfaceMap - -The following program get the type of Hashtable class and searches for the interface -with the specified name. Then prints the method name of that interface. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; - -// -// -// -int main() -{ - Hashtable^ hashtableObj = gcnew Hashtable; - Type^ objType = hashtableObj->GetType(); - array^arrayMemberInfo; - array^arrayMethodInfo; - try - { - // Get the methods implemented in 'IDeserializationCallback' interface. - arrayMethodInfo = objType->GetInterface( "IDeserializationCallback" )->GetMethods(); - Console::WriteLine( "\nMethods of 'IDeserializationCallback' Interface :" ); - for ( int index = 0; index < arrayMethodInfo->Length; index++ ) - Console::WriteLine( arrayMethodInfo[ index ] ); - - // Get FullName for interface by using Ignore case search. - Console::WriteLine( "\nMethods of 'IEnumerable' Interface" ); - arrayMethodInfo = objType->GetInterface( "ienumerable", true )->GetMethods(); - for ( int index = 0; index < arrayMethodInfo->Length; index++ ) - Console::WriteLine( arrayMethodInfo[ index ] ); - - //Get the Interface methods for 'IDictionary*' interface - InterfaceMapping interfaceMappingObj; - interfaceMappingObj = objType->GetInterfaceMap( IDictionary::typeid ); - arrayMemberInfo = interfaceMappingObj.InterfaceMethods; - Console::WriteLine( "\nHashtable class Implements the following IDictionary Interface methods :" ); - for ( int index = 0; index < arrayMemberInfo->Length; index++ ) - Console::WriteLine( arrayMemberInfo[ index ] ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e ); - } -} -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp deleted file mode 100644 index d6ba8989b72..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - Console::WriteLine("\r\nInterfaces implemented by Dictionary:\r\n"); - - for each (Type^ tinterface in Dictionary::typeid->GetInterfaces()) - { - Console::WriteLine(tinterface->ToString()); - } - - //Console::ReadLine() // Uncomment this line for Visual Studio. -} - -/* This example produces output similar to the following: - -Interfaces implemented by Dictionary: - -System.Collections.Generic.IDictionary`2[System.Int32,System.String] -System.Collections.Generic.ICollection`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]] -System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]] -System.Collection.IEnumerable -System.Collection.IDictionary -System.Collection.ICollection -System.Runtime.Serialization.ISerializable -System.Runtime.Serialization.IDeserializationCallback - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp deleted file mode 100644 index 509f20ff956..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Reflection; - -// forward declarations: -void GetMemberInfo(); -void GetPublicStaticMemberInfo(); -void GetPublicInstanceMethodMemberInfo(); -int main() -{ - try - { - GetMemberInfo(); - GetPublicStaticMemberInfo(); - GetPublicInstanceMethodMemberInfo(); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( NotSupportedException^ e ) - { - Console::WriteLine( "NotSupportedException occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -void GetMemberInfo() -{ - String^ myString = "GetMember_String"; - Type^ myType = myString->GetType(); - - // Get the members for myString starting with the letter C. - array^myMembers = myType->GetMember( "C*" ); - if ( myMembers->Length > 0 ) - { - Console::WriteLine( "\nThe member(s) starting with the letter C for type {0}:", myType ); - for ( int index = 0; index < myMembers->Length; index++ ) - Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); - } - else - Console::WriteLine( "No members match the search criteria." ); -} -// - -// -void GetPublicStaticMemberInfo() -{ - String^ myString = "GetMember_String_BindingFlag"; - Type^ myType = myString->GetType(); - - // Get the public static members for the class myString starting with the letter C - array^myMembers = myType->GetMember( "C*", static_cast(BindingFlags::Public | BindingFlags::Static) ); - if ( myMembers->Length > 0 ) - { - Console::WriteLine( "\nThe public static member(s) starting with the letter C for type {0}:", myType ); - for ( int index = 0; index < myMembers->Length; index++ ) - Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); - } - else - Console::WriteLine( "No members match the search criteria." ); -} -// - -// -void GetPublicInstanceMethodMemberInfo() -{ - String^ myString = "GetMember_String_MemberType_BindingFlag"; - Type^ myType = myString->GetType(); - - // Get the public instance methods for myString starting with the letter C. - array^myMembers = myType->GetMember( "C*", MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Instance) ); - if ( myMembers->Length > 0 ) - { - Console::WriteLine( "\nThe public instance method(s) starting with the letter C for type {0}:", myType ); - for ( int index = 0; index < myMembers->Length; index++ ) - Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); - } - else - Console::WriteLine( "No members match the search criteria." ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp deleted file mode 100644 index f80aa9bb4c3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// System::Type::GetMembers() -/* -This program demonstrates GetMembers() method of System::Type Class. -Get the members (properties, methods, fields, events, and so on) -of the class 'MyClass' and displays the same to the console. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -// -ref class MyClass -{ -public: - int myInt; - String^ myString; - MyClass(){} - - void Myfunction(){} - -}; - -int main() -{ - try - { - MyClass^ myObject = gcnew MyClass; - array^myMemberInfo; - - // Get the type of 'MyClass'. - Type^ myType = myObject->GetType(); - - // Get the information related to all public members of 'MyClass'. - myMemberInfo = myType->GetMembers(); - Console::WriteLine( "\nThe members of class '{0}' are :\n", myType ); - for ( int i = 0; i < myMemberInfo->Length; i++ ) - { - - // Display name and type of the concerned member. - Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp deleted file mode 100644 index 41bb6aea10f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// System::Type::GetMembers(BindingFlags) -/* -This program demonstrates 'GetMembers(BindingFlags)' method of -System::Type Class. This will get all the public instance members -declared or inherited by this type and displays the members to -the console. -*/ -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -// -ref class MyClass -{ -public: - int * myInt; - String^ myString; - MyClass(){} - - void Myfunction(){} - -}; - -int main() -{ - try - { - MyClass^ MyObject = gcnew MyClass; - array^myMemberInfo; - - // Get the type of the class 'MyClass'. - Type^ myType = MyObject->GetType(); - - // Get the public instance members of the class 'MyClass'. - myMemberInfo = myType->GetMembers( static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine( "\nThe public instance members of class '{0}' are : \n", myType ); - for ( int i = 0; i < myMemberInfo->Length; i++ ) - { - - // Display name and type of the member of 'MyClass'. - Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException : {0}", e->Message ); - } - - - //Output: - //The public instance members of class 'MyClass' are : - - //'Myfunction' is a Method - //'ToString' is a Method - //'Equals' is a Method - //'GetHashCode' is a Method - //'GetType' is a Method - //'.ctor' is a Constructor - //'myInt' is a Field - //'myString' is a Field - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp deleted file mode 100644 index baf1615c7c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class Program -{ - - public: - - // Method to get: - void MethodA() { } - - }; - - int main() - { - - // Get MethodA() - MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA"); - Console::WriteLine("Found method: {0}", mInfo ); - - } -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp deleted file mode 100644 index b4f0669dc23..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class Program -{ - - public: - - // Method to get: - void MethodA() { } - - }; - - int main() - { - - // Get MethodA() - MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance)); - Console::WriteLine("Found method: {0}", mInfo ); - - } -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp deleted file mode 100644 index 635d6dcd96c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Program -{ - -public: - // Methods to get: - - void MethodA(int i, int j) { } - - void MethodA(array^ iarry) { } - - void MethodA(double *ip) { } - - // Method that takes a managed reference paramter. - void MethodA(int% r) {} -}; - -int main() -{ - MethodInfo^ mInfo; - - - // Get MethodA(int i, int j) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {int::typeid, int::typeid}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(array^ iarry) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {int::typeid->MakeArrayType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(double *ip) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {double::typeid->MakePointerType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(int% r) - mInfo = Program::typeid->GetMethod("MethodA", - BindingFlags::Public | BindingFlags::Instance, - nullptr, - CallingConventions::Any, - gcnew array {int::typeid->MakeByRefType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp deleted file mode 100644 index 5e67e5d4695..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class Program -{ - -public: - // Methods to get: - - void MethodA(int i, int j) { } - - void MethodA(array^ iarry) { } - - void MethodA(double *ip) { } - - // Method that takes a managed reference parameter. - void MethodA(int% r) {} -}; - -int main() -{ - MethodInfo^ mInfo; - - - // Get MethodA(int i, int j) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid,int::typeid}); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(array^ iarry) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeArrayType()}); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(double *ip) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {double::typeid->MakePointerType()}); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(int% r) - mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeByRefType()}); - // Display the method information. - Console::WriteLine("Found method: {0}", mInfo ); - -} -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp deleted file mode 100644 index 8fb1d143de6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Program -{ - -public: - // Methods to get: - - void MethodA(int i, int j) { } - - void MethodA(array^ iarry) { } - - void MethodA(double *ip) { } - - // Method that takes a managed reference parameter. - void MethodA(int% r) {} -}; - -int main() -{ - MethodInfo^ mInfo; - - - // Get MethodA(int i, int j) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {int::typeid, int::typeid}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(array^ iarry) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {int::typeid->MakeArrayType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(double *ip) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {double::typeid->MakePointerType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); - - // Get MethodA(int% r) - mInfo = Program::typeid->GetMethod("MethodA", - static_cast(BindingFlags::Public | BindingFlags::Instance), - nullptr, - gcnew array {int::typeid->MakeByRefType()}, - nullptr); - Console::WriteLine("Found method: {0}", mInfo ); -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp deleted file mode 100644 index c249289de27..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// Create a class having two public methods and one protected method. -public ref class MyTypeClass -{ -public: - void MyMethods(){} - - int MyMethods1() - { - return 3; - } - - -protected: - String^ MyMethods2() - { - return "hello"; - } -}; - -void DisplayMethodInfo( array^myArrayMethodInfo ) -{ - // Display information for all methods. - for ( int i = 0; i < myArrayMethodInfo->Length; i++ ) - { - MethodInfo^ myMethodInfo = dynamic_cast(myArrayMethodInfo[ i ]); - Console::WriteLine( "\nThe name of the method is {0}.", myMethodInfo->Name ); - } -} - -int main() -{ - Type^ myType = MyTypeClass::typeid; - - // Get the public methods. - array^myArrayMethodInfo = myType->GetMethods( static_cast(BindingFlags::Public | BindingFlags::Instance | BindingFlags::DeclaredOnly) ); - Console::WriteLine( "\nThe number of public methods is {0}->", myArrayMethodInfo->Length ); - - // Display all the methods. - DisplayMethodInfo( myArrayMethodInfo ); - - // Get the nonpublic methods. - array^myArrayMethodInfo1 = myType->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly) ); - Console::WriteLine( "\nThe number of protected methods is {0}->", myArrayMethodInfo1->Length ); - - // Display information for all methods. - DisplayMethodInfo( myArrayMethodInfo1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp deleted file mode 100644 index 8c37fe7a44c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Create a class with two nested public classes and two nested protected classes. -public ref class MyTypeClass -{ - public: - ref class Myclass1{}; - - public: - ref class Myclass2{}; - - protected: - ref class MyClass3{}; - - protected: - ref class MyClass4{}; -}; - -void DisplayTypeInfo(array^ myArrayType) -{ - // Display the information for all the nested classes. - for each (Type^ t in myArrayType) - Console::WriteLine( "The name of the nested class is {0}.", t->FullName); -} - -int main() -{ - Type^ myType = MyTypeClass::typeid; - - // Get the public nested classes. - array^myTypeArray = myType->GetNestedTypes( static_cast(BindingFlags::Public)); - Console::WriteLine( "The number of nested public classes is {0}.", myTypeArray->Length ); - - // Display all the public nested classes. - DisplayTypeInfo( myTypeArray ); - Console::WriteLine(); - - // Get the nonpublic nested classes. - array^myTypeArray1 = myType->GetNestedTypes( static_cast(BindingFlags::NonPublic)); - Console::WriteLine( "The number of nested protected classes is {0}.", myTypeArray1->Length ); - - // Display all the nonpublic nested classes. - DisplayTypeInfo( myTypeArray1 ); -} -// The example displays the following output: -// The number of public nested classes is 2. -// The name of the nested class is MyTypeClass+Myclass1. -// The name of the nested class is MyTypeClass+Myclass2. -// -// The number of protected nested classes is 2. -// The name of the nested class is MyTypeClass+MyClass3. -// The name of the nested class is MyTypeClass+MyClass4. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp deleted file mode 100644 index 53d43153bd8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyClass -{ -public: - ref class NestClass - { - public: - static int myPublicInt = 0; - }; - - ref struct NestStruct - { - public: - static int myPublicInt = 0; - }; -}; - -int main() -{ - try - { - // Get the Type object corresponding to MyClass. - Type^ myType = MyClass::typeid; - - // Get an array of nested type objects in MyClass. - array^nestType = myType->GetNestedTypes(); - Console::WriteLine( "The number of nested types is {0}.", nestType->Length ); - System::Collections::IEnumerator^ myEnum = nestType->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ t = safe_cast(myEnum->Current); - Console::WriteLine( "Nested type is {0}.", t ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp deleted file mode 100644 index 9be794b12cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// Create a class having three properties. -public ref class PropertyClass -{ - -public: - property String^ Property1 - { - String^ get() - { - return "hello"; - } - } - - property String^ Property2 - { - String^ get() - { - return "hello"; - } - } - -protected: - property String^ Property3 - { - String^ get() - { - return "hello"; - } - } - -private: - property int Property4 - { - int get() - { - return 32; - } - } - -internal: - property String^ Property5 - { - String^ get() - { - return "value"; - } - } - -public protected: - property String^ Property6 - { - String^ get() - { - return "value"; - } - } -}; - -String^ GetVisibility(MethodInfo^ accessor) -{ - if (accessor->IsPublic) - return "Public"; - else if (accessor->IsPrivate) - return "Private"; - else if (accessor->IsFamily) - return "Protected"; - else if (accessor->IsAssembly) - return "Internal/Friend"; - else - return "Protected Internal/Friend"; -} - -void DisplayPropertyInfo(array^ propInfos ) -{ - // Display information for all properties. - for each(PropertyInfo^ propInfo in propInfos) { - bool readable = propInfo->CanRead; - bool writable = propInfo->CanWrite; - - Console::WriteLine(" Property name: {0}", propInfo->Name); - Console::WriteLine(" Property type: {0}", propInfo->PropertyType); - Console::WriteLine(" Read-Write: {0}", readable && writable); - if (readable) { - MethodInfo^ getAccessor = propInfo->GetMethod; - Console::WriteLine(" Visibility: {0}", - GetVisibility(getAccessor)); - } - if (writable) { - MethodInfo^ setAccessor = propInfo->SetMethod; - Console::WriteLine(" Visibility: {0}", - GetVisibility(setAccessor)); - } - Console::WriteLine(); - } -} - -void main() -{ - Type^ myType = PropertyClass::typeid; - - // Get the public properties. - array^propInfos = myType->GetProperties( static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Console::WriteLine("The number of public properties: {0}.\n", - propInfos->Length); - // Display the public properties. - DisplayPropertyInfo( propInfos ); - - // Get the non-public properties. - array^propInfos1 = myType->GetProperties( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Console::WriteLine("The number of non-public properties: {0}.\n", - propInfos1->Length); - // Display all the non-public properties. - DisplayPropertyInfo(propInfos1); -} -// The example displays the following output: -// The number of public properties: 2. -// -// Property name: Property2 -// Property type: System.String -// Read-Write: False -// Visibility: Public -// -// Property name: Property1 -// Property type: System.String -// Read-Write: False -// Visibility: Public -// -// The number of non-public properties: 4. -// -// Property name: Property6 -// Property type: System.String -// Read-Write: False -// Visibility: Protected Internal/Friend -// -// Property name: Property5 -// Property type: System.String -// Read-Write: False -// Visibility: Internal/Friend -// -// Property name: Property4 -// Property type: System.Int32 -// Read-Write: False -// Visibility: Private -// -// Property name: Property3 -// Property type: System.String -// Read-Write: False -// Visibility: Protected -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp deleted file mode 100644 index 8ae8ea145d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -private: - int myProperty; - -public: - - property int MyProperty - { - // Declare MyProperty. - int get() - { - return myProperty; - } - - void set( int value ) - { - myProperty = value; - } - } -}; - -int main() -{ - try - { - // Get the Type object corresponding to MyClass. - Type^ myType = MyClass::typeid; - - // Get the PropertyInfo object by passing the property name. - PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty" ); - - // Display the property name. - Console::WriteLine( "The {0} property exists in MyClass.", myPropInfo->Name ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "The property does not exist in MyClass. {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp deleted file mode 100644 index 9301970d3b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -private: - int myProperty; - -public: - - property int MyProperty - { - // Declare MyProperty. - int get() - { - return myProperty; - } - - void set( int value ) - { - myProperty = value; - } - } -}; - -int main() -{ - try - { - // Get Type object of MyClass. - Type^ myType = MyClass::typeid; - - // Get the PropertyInfo by passing the property name and specifying the BindingFlags. - PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - - // Display Name property to console. - Console::WriteLine( "{0} is a property of MyClass.", myPropInfo->Name ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "MyProperty does not exist in MyClass. {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp deleted file mode 100644 index 8b7ac89dba4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass1 -{ -private: - array^myArray; - -public: - - property int Item [int, int] - { - - // Declare an indexer. - int get( int i, int j ) - { - return myArray[ i,j ]; - } - - void set( int i, int j, int value ) - { - myArray[ i,j ] = value; - } - - } - -}; - -int main() -{ - try - { - - // Get the Type object. - Type^ myType = MyClass1::typeid; - array^myTypeArr = gcnew array(2); - - // Create an instance of a Type array. - myTypeArr->SetValue( int::typeid, 0 ); - myTypeArr->SetValue( int::typeid, 1 ); - - // Get the PropertyInfo object for the indexed property Item, which has two integer parameters. - PropertyInfo^ myPropInfo = myType->GetProperty( "Item", myTypeArr ); - - // Display the property. - Console::WriteLine( "The {0} property exists in MyClass1.", myPropInfo ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp deleted file mode 100644 index 905e696e9f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyPropertyClass -{ -private: - array^ myPropertyArray; - -public: - - property int Item [int, int] - { - // Declare an indexer. - int get( int i, int j ) - { - return myPropertyArray[ i,j ]; - } - - void set( int i, int j, int value ) - { - myPropertyArray[ i,j ] = value; - } - - } - -}; - -int main() -{ - try - { - Type^ myType = MyPropertyClass::typeid; - array^myTypeArray = gcnew array(2); - - // Create an instance of the Type array representing the number, order - // and type of the parameters for the property. - myTypeArray->SetValue( int::typeid, 0 ); - myTypeArray->SetValue( int::typeid, 1 ); - - // Search for the indexed property whose parameters match the - // specified argument types and modifiers. - PropertyInfo^ myPropertyInfo = myType->GetProperty( "Item", int::typeid, myTypeArray, nullptr ); - Console::WriteLine( "{0}.{1} has a property type of {2}", myType->FullName, myPropertyInfo->Name, myPropertyInfo->PropertyType ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "An exception occurred {0}", ex->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp deleted file mode 100644 index 406346579d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass1 -{ -private: - String^ myMessage; - -public: - - property String^ MyProperty1 - { - String^ get() - { - return myMessage; - } - - void set( String^ value ) - { - myMessage = value; - } - } -}; - -int main() -{ - try - { - Type^ myType = MyClass1::typeid; - - // Get the PropertyInfo Object* representing MyProperty1. - PropertyInfo^ myStringProperties1 = myType->GetProperty( "MyProperty1", String::typeid ); - Console::WriteLine( "The name of the first property of MyClass1 is {0}.", myStringProperties1->Name ); - Console::WriteLine( "The type of the first property of MyClass1 is {0}.", myStringProperties1->PropertyType ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException : {0}", e->Message ); - } - catch ( AmbiguousMatchException^ e ) - { - Console::WriteLine( "AmbiguousMatchException : {0}", e->Message ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - //Output: - //The name of the first property of MyClass1 is MyProperty1. - //The type of the first property of MyClass1 is System.String. - -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp deleted file mode 100644 index eb10775df99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; - -int main() -{ - try { - // Get the type of a specified class. - Type^ myType1 = Type::GetType( "System.Int32" ); - Console::WriteLine( "The full name is {0}.\n", myType1->FullName ); - } - catch ( TypeLoadException^ e ) { - Console::WriteLine("{0}: Unable to load type System.Int32", - e->GetType()->Name); - } - - try { - // Since NoneSuch does not exist in this assembly, GetType throws a TypeLoadException. - Type^ myType2 = Type::GetType( "NoneSuch", true ); - Console::WriteLine( "The full name is {0}.", myType2->FullName ); - } - catch ( TypeLoadException^ e ) { - Console::WriteLine("{0}: Unable to load type NoneSuch", - e->GetType()->Name); - } - -} -// The example displays the following output: -// The full name is System.Int32. -// -// TypeLoadException: Unable to load type NoneSuch -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp deleted file mode 100644 index 4eedf13f6b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -// System::Type::GetTypeCode() -// System::Type::GetProperties() -// System::Type::GetTypeArray() -// System::Type::GetType(String, Boolean, Boolean) -/* The following example demonstrates the 'GetTypeCode()', 'GetProperties()', 'GetTypeArray()', -'GetType(String, Boolean, Boolean)' methods of 'Type' class. -An object of 'Type' corresponding to 'System::Int32 is obtained '. Properties of 'System::Type' -is retrieved into 'PropertyInfo' array and displayed. Array of 'Type' objects is created -which represents the type specified by an arbitary set of objects. When 'Type' object is -attempted to create for 'sYSTem.iNT32', an exception is thrown when case-sensitive search -is done. -*/ -using namespace System; -using namespace System::Reflection; -int main() -{ - // - // Create an object of 'Type' class. - Type^ myType1 = Type::GetType( "System.Int32" ); - - // Get the 'TypeCode' of the 'Type' class object created above. - TypeCode myTypeCode = Type::GetTypeCode( myType1 ); - Console::WriteLine( "TypeCode is: {0}", myTypeCode ); - // - - // - array^myPropertyInfo; - - // Get the properties of 'Type' class object. - myPropertyInfo = Type::GetType( "System.Type" )->GetProperties(); - Console::WriteLine( "Properties of System.Type are:" ); - for ( int i = 0; i < myPropertyInfo->Length; i++ ) - { - Console::WriteLine( myPropertyInfo[ i ] ); - - } - // - - // - array^myObject = gcnew array(3); - myObject[ 0 ] = 66; - myObject[ 1 ] = "puri"; - myObject[ 2 ] = 33.33; - - // Get the array of 'Type' class objects. - array^myTypeArray = Type::GetTypeArray( myObject ); - Console::WriteLine( "Full names of the 'Type' objects in the array are:" ); - for ( int h = 0; h < myTypeArray->Length; h++ ) - { - Console::WriteLine( myTypeArray[ h ]->FullName ); - - } - // - - // - try - { - // Throws 'TypeLoadException' because of case-sensitive search. - Type^ myType2 = Type::GetType( "sYSTem.iNT32", true, false ); - Console::WriteLine( myType2->FullName ); - } - catch ( TypeLoadException^ e ) - { - Console::WriteLine( e->Message ); - } - // - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp deleted file mode 100644 index 3bdbda50535..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// System::Type::GetTypeFromHandle(RuntimeTypeHandle) - -/* -The following example demonstrates the 'GetTypeFromHandle(RuntimeTypeHandle)' method -of the 'Type' Class. -It defines an empty class 'Myclass1' and obtains an object of 'Myclass1'. Then the runtime handle of -the object is obtained and passed as an argument to 'GetTypeFromHandle(RuntimeTypeHandle)'method. That -returns the type referenced by the specified type handle. -*/ - -using namespace System; -using namespace System::Reflection; -public ref class MyClass1{}; - -int main() -{ - // - MyClass1^ myClass1 = gcnew MyClass1; - // Get the type referenced by the specified type handle. - Type^ myClass1Type = Type::GetTypeFromHandle( Type::GetTypeHandle( myClass1 ) ); - Console::WriteLine( "The Names of the Attributes : {0}", myClass1Type->Attributes ); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp deleted file mode 100644 index f5e69fb913a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - - // Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. - String^ myString1 = "DIRECT.ddPalette.3"; - - // Use a nonexistent ProgID WrongProgID. - String^ myString2 = "WrongProgID"; - - // Make a call to the method to get the type information of the given ProgID. - Type^ myType1 = Type::GetTypeFromProgID( myString1, true ); - Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); - - // Throw an exception because the ProgID is invalid and the throwOnError - // parameter is set to True. - Type^ myType2 = Type::GetTypeFromProgID( myString2, true ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp deleted file mode 100644 index 1e6853e4688..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - - // Use the ProgID localhost\HKEY_CLASSES_ROOT\DirControl::DirList.1. - String^ theProgramID = "DirControl.DirList.1"; - - // Use the server name localhost. - String^ theServer = "localhost"; - - // Make a call to the method to get the type information for the given ProgID. - Type^ myType = Type::GetTypeFromProgID( theProgramID, theServer ); - if ( myType == nullptr ) - { - throw gcnew Exception( "Invalid ProgID or Server." ); - } - Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType->GUID ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp deleted file mode 100644 index 706229d1e8d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -int main() -{ - try - { - - // Use server localhost. - String^ theServer = "localhost"; - - // Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. - String^ myString1 = "DirControl.DirList.1"; - - // Use a wrong ProgID WrongProgID. - String^ myString2 = "WrongProgID"; - - // Make a call to the method to get the type information for the given ProgID. - Type^ myType1 = Type::GetTypeFromProgID( myString1, theServer, true ); - Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); - - // Throw an exception because the ProgID is invalid and the throwOnError - // parameter is set to True. - Type^ myType2 = Type::GetTypeFromProgID( myString2, theServer, true ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred. The ProgID is wrong." ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp deleted file mode 100644 index fe262565879..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class MyClass1 -{ -private: - int x; - -public: - int MyMethod() - { - return x; - } -}; - -int main() -{ - MyClass1^ myClass1 = gcnew MyClass1; - - // Get the RuntimeTypeHandle from an object. - RuntimeTypeHandle myRTHFromObject = Type::GetTypeHandle( myClass1 ); - - // Get the RuntimeTypeHandle from a type. - RuntimeTypeHandle myRTHFromType = MyClass1::typeid->TypeHandle; - - Console::WriteLine( "\nmyRTHFromObject.Value: {0}", myRTHFromObject.Value ); - Console::WriteLine( "myRTHFromObject.GetType(): {0}", myRTHFromObject.GetType() ); - Console::WriteLine( "Get the type back from the handle..." ); - Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromObject): {0}", - Type::GetTypeFromHandle(myRTHFromObject) ); - - Console::WriteLine( "\nmyRTHFromObject.Equals(myRTHFromType): {0}", - myRTHFromObject.Equals(myRTHFromType) ); - - Console::WriteLine( "\nmyRTHFromType.Value: {0}", myRTHFromType.Value ); - Console::WriteLine( "myRTHFromType.GetType(): {0}", myRTHFromType.GetType() ); - Console::WriteLine( "Get the type back from the handle..." ); - Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromType): {0}", - Type::GetTypeFromHandle(myRTHFromType) ); -} - -/* This code example produces output similar to the following: - -myRTHFromObject.Value: 3295832 -myRTHFromObject.GetType(): System.RuntimeTypeHandle -Get the type back from the handle... -Type::GetTypeFromHandle(myRTHFromObject): MyClass1 - -myRTHFromObject.Equals(myRTHFromType): True - -myRTHFromType.Value: 3295832 -myRTHFromType.GetType(): System.RuntimeTypeHandle -Get the type back from the handle... -Type::GetTypeFromHandle(myRTHFromType): MyClass1 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp deleted file mode 100644 index 5f399d51673..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -ref class MyGetTypeFromCLSID -{ -public: - ref class MyClass1 - { - public: - void MyMethod1(){} - }; -}; - -int main() -{ - - // Get the type corresponding to the class MyClass. - Type^ myType = MyGetTypeFromCLSID::MyClass1::typeid; - - // Get the Object* of the Guid. - Guid myGuid = (Guid)myType->GUID; - Console::WriteLine( "The name of the class is {0}", myType ); - Console::WriteLine( "The ClassId of MyClass is {0}", myType->GUID ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp deleted file mode 100644 index c11f4e80d20..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -public ref class Example -{ -public: - // This method is for demonstration purposes. It includes a - // tracking reference (C# ref, VB ByRef), an out parameter, - // and a pointer. - void Test(int% x, [OutAttribute()] int% y, int* z) - { - *z = x = y = 0; - } -}; - -int main() -{ - // All of the following display 'True'. - - // Define a managed array, get its type, and display HasElementType. - array^ examples = {gcnew Example(), gcnew Example()}; - Type^ t = examples::typeid; - Console::WriteLine(t); - Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType); - - // When you use Reflection Emit to emit dynamic methods and - // assemblies, you can create array types using MakeArrayType. - // The following creates the type 'array of Example'. - t = Example::typeid->MakeArrayType(); - Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType); - - // When you reflect over methods, HasElementType is true for - // ref, out, and pointer parameter types. The following - // gets the Test method, defined above, and examines its - // parameters. - MethodInfo^ mi = Example::typeid->GetMethod("Test"); - array^ parms = mi->GetParameters(); - t = parms[0]->ParameterType; - Console::WriteLine("HasElementType is '{0}' for ref parameter types.", t->HasElementType); - t = parms[1]->ParameterType; - Console::WriteLine("HasElementType is '{0}' for out parameter types.", t->HasElementType); - t = parms[2]->ParameterType; - Console::WriteLine("HasElementType is '{0}' for pointer parameter types.", t->HasElementType); - - // When you use Reflection Emit to emit dynamic methods and - // assemblies, you can create pointer and ByRef types to use - // when you define method parameters. - t = Example::typeid->MakePointerType(); - Console::WriteLine("HasElementType is '{0}' for pointer types.", t->HasElementType); - t = Example::typeid->MakeByRefType(); - Console::WriteLine("HasElementType is '{0}' for ByRef types.", t->HasElementType); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp deleted file mode 100644 index a2a8c92e5cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp +++ /dev/null @@ -1,86 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyTypeDelegator: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegator( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - - -protected: - - // Override Type::HasElementTypeImpl(). - virtual bool HasElementTypeImpl() override - { - - // Determine whether the type is an array. - if ( myType->IsArray ) - { - myElementType = "array"; - return true; - } - - - // Determine whether the type is a reference. - if ( myType->IsByRef ) - { - myElementType = "reference"; - return true; - } - - - // Determine whether the type is a pointer. - if ( myType->IsPointer ) - { - myElementType = "pointer"; - return true; - } - - - // Return false if the type is not a reference, array, or pointer type. - return false; - } - -}; - -int main() -{ - try - { - int myInt = 0; - array^myArray = gcnew array(5); - MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() ); - - // Determine whether myType is an array, pointer, reference type. - Console::WriteLine( "\nDetermine whether a variable is an array, pointer, or reference type.\n" ); - if ( myType->HasElementType ) - Console::WriteLine( "The type of myArray is {0}.", myType->myElementType ); - else - Console::WriteLine( "myArray is not an array, pointer, or reference type." ); - myType = gcnew MyTypeDelegator( myInt.GetType() ); - - // Determine whether myType is an array, pointer, reference type. - if ( myType->HasElementType ) - Console::WriteLine( "The type of myInt is {0}.", myType->myElementType ); - else - Console::WriteLine( "myInt is not an array, pointer, or reference type." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp deleted file mode 100644 index 6bdc99f8a1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyClass -{ -protected: - String^ myField; - -public: - MyClass() - { - myField = "A sample protected field"; - } -}; - -int main() -{ - try - { - MyClass^ myObject = gcnew MyClass; - - // Get the type of the 'MyClass'. - Type^ myType = MyClass::typeid; - - // Get the field information and the attributes associated with MyClass. - FieldInfo^ myFieldInfo = myType->GetField( "myField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Console::WriteLine( "\nChecking for the AnsiClass attribute for a field.\n" ); - - // Get and display the name, field, and the AnsiClass attribute. - Console::WriteLine( "Name of Class: {0} \nValue of Field: {1} \nIsAnsiClass = {2}", myType->FullName, myFieldInfo->GetValue( myObject ), myType->IsAnsiClass ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp deleted file mode 100644 index dadf165d511..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyTypeDelegator: public TypeDelegator -{ -public: - String^ myElementType; - Type^ myType; - MyTypeDelegator( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - - -protected: - - // Override IsArrayImpl(). - virtual bool IsArrayImpl() override - { - - // Determine whether the type is an array. - if ( myType->IsArray ) - { - myElementType = "array"; - return true; - } - - - // Return false if the type is not an array. - return false; - } - -}; - -int main() -{ - try - { - int myInt = 0; - - // Create an instance of an array element. - array^myArray = gcnew array(5); - MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() ); - Console::WriteLine( "\nDetermine whether the variable is an array.\n" ); - - // Determine whether myType is an array type. - if ( myType->IsArray ) - Console::WriteLine( "The type of myArray is {0}.", myType->myElementType ); - else - Console::WriteLine( "myArray is not an array." ); - myType = gcnew MyTypeDelegator( myInt.GetType() ); - - // Determine whether myType is an array type. - if ( myType->IsArray ) - Console::WriteLine( "The type of myInt is {0}.", myType->myElementType ); - else - Console::WriteLine( "myInt is not an array." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp deleted file mode 100644 index 9c15d3604d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; -using namespace System::Runtime::InteropServices; - -// The MyDemoAttribute class is selected as AutoLayout. - -[StructLayoutAttribute(LayoutKind::Auto)] -public ref class MyDemoAttribute{}; - -void MyAutoLayoutMethod( String^ typeName ) -{ - try - { - - // Create an instance of the Type class using the GetType method. - Type^ myType = Type::GetType( typeName ); - - // Get and display the IsAutoLayout property of the - // MyDemoAttribute instance. - Console::WriteLine( "\nThe AutoLayout property for the MyDemoAttribute is {0}.", myType->IsAutoLayout ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); - } - -} - -int main() -{ - MyAutoLayoutMethod( "MyDemoAttribute" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp deleted file mode 100644 index 028383c4410..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyDemoClass{}; - -int main() -{ - try - { - Type^ myType = Type::GetType( "MyDemoClass" ); - - // Get and display the 'IsClass' property of the 'MyDemoClass' instance. - Console::WriteLine( "\nIs the specified type a class? {0}.", myType->IsClass ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp deleted file mode 100644 index a9a34cadfd5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::Remoting::Contexts; - -public ref class ContextBoundClass: public ContextBoundObject -{ - public: - String^ Value; -}; - -public ref class Example -{ -public: - void Demo() - { - // Determine whether the types can be hosted in a Context. - Console::WriteLine("The IsContextful property for the {0} type is {1}.", - Example::typeid->Name, Example::typeid->IsContextful); - Console::WriteLine("The IsContextful property for the {0} type is {1}.", - ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsContextful); - - // Determine whether the types are marshalled by reference. - Console::WriteLine("The IsMarshalByRef property of {0} is {1}.", - Example::typeid->Name, Example::typeid->IsMarshalByRef ); - Console::WriteLine("The IsMarshalByRef property of {0} is {1}.", - ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsMarshalByRef ); - - // Determine whether the types are primitive datatypes. - Console::WriteLine("{0} is a primitive data type: {1}.", - int::typeid->Name, int::typeid->IsPrimitive ); - Console::WriteLine("{0} is a primitive data type: {1}.", - String::typeid->Name, String::typeid->IsPrimitive ); - } -}; - -int main() -{ - Example^ ex = gcnew Example; - ex->Demo(); -} -// The example displays the following output: -// The IsContextful property for the Example type is False. -// The IsContextful property for the ContextBoundClass type is True. -// The IsMarshalByRef property of Example is False. -// The IsMarshalByRef property of ContextBoundClass is True. -// Int32 is a primitive data type: True. -// String is a primitive data type: False. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp deleted file mode 100644 index 1ce5137c1af..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyTypeDelegatorClass: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegatorClass( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - -protected: - - // Override IsContextfulImpl. - virtual bool IsContextfulImpl() override - { - - // Check whether the type is contextful. - if ( myType->IsContextful ) - { - myElementType = " is contextful "; - return true; - } - - return false; - } - -}; - -public ref class MyTypeDemoClass{}; - - -// This class demonstrates IsContextfulImpl. -public ref class MyContextBoundClass: public ContextBoundObject -{ -public: - String^ myString; -}; - -int main() -{ - try - { - MyTypeDelegatorClass^ myType; - Console::WriteLine( "Check whether MyContextBoundClass can be hosted in a context." ); - - // Check whether MyContextBoundClass is contextful. - myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid ); - if ( myType->IsContextful ) - { - Console::WriteLine( "{0} can be hosted in a context.", MyContextBoundClass::typeid ); - } - else - { - Console::WriteLine( "{0} cannot be hosted in a context.", MyContextBoundClass::typeid ); - } - myType = gcnew MyTypeDelegatorClass( MyTypeDemoClass::typeid ); - Console::WriteLine( "\nCheck whether MyTypeDemoClass can be hosted in a context." ); - if ( myType->IsContextful ) - { - Console::WriteLine( "{0} can be hosted in a context.", MyTypeDemoClass::typeid ); - } - else - { - Console::WriteLine( "{0} cannot be hosted in a context.", MyTypeDemoClass::typeid ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp deleted file mode 100644 index f8e795207a6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; - -// Declare an interface. -interface class myIFace{}; -public ref class MyIsInterface{}; - -void main() -{ - try - { - // Get the IsInterface attribute for myIFace. - bool myBool1 = myIFace::typeid->IsInterface; - - //Display the IsInterface attribute for myIFace. - Console::WriteLine( "Is the specified type an interface? {0}.", myBool1 ); - - // Get the attribute IsInterface for MyIsInterface. - bool myBool2 = MyIsInterface::typeid->IsInterface; - - //Display the IsInterface attribute for MyIsInterface. - Console::WriteLine( "Is the specified type an interface? {0}.", myBool2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); - } -} -/* The example produces the following output: - -Is the specified type an interface? True. -Is the specified type an interface? False. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp deleted file mode 100644 index db0652f266e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::ComponentModel; -using namespace System::Runtime::InteropServices; -ref class MyTypeSequential1{}; - - -[StructLayoutAttribute(LayoutKind::Sequential)] -ref class MyTypeSequential2{}; - -int main() -{ - try - { - - // Create an instance of myTypeSeq1. - MyTypeSequential1^ myObj1 = gcnew MyTypeSequential1; - - // Check for and display the SequentialLayout attribute. - Console::WriteLine( "\nThe object myObj1 has IsLayoutSequential: {0}.", myObj1->GetType()->IsLayoutSequential ); - - // Create an instance of 'myTypeSeq2' class. - MyTypeSequential2^ myObj2 = gcnew MyTypeSequential2; - - // Check for and display the SequentialLayout attribute. - Console::WriteLine( "\nThe object myObj2 has IsLayoutSequential: {0}.", myObj2->GetType()->IsLayoutSequential ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp deleted file mode 100644 index d6c5c85b0f9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp +++ /dev/null @@ -1,81 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class MyTypeDelegatorClass: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegatorClass( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - -protected: - - // Override IsMarshalByRefImpl. - virtual bool IsMarshalByRefImpl() override - { - // Determine whether the type is marshalled by reference. - if ( myType->IsMarshalByRef ) - { - myElementType = " marshalled by reference"; - return true; - } - - return false; - } -}; - -public ref class MyTypeDemoClass{}; - - -// This class is used to demonstrate the IsMarshalByRefImpl method. -public ref class MyContextBoundClass: public ContextBoundObject -{ -public: - String^ myString; -}; - -int main() -{ - try - { - MyTypeDelegatorClass^ myType; - Console::WriteLine( "Determine whether MyContextBoundClass is marshalled by reference." ); - - // Determine whether MyContextBoundClass type is marshalled by reference. - myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid ); - if ( myType->IsMarshalByRef ) - { - Console::WriteLine( "{0} is marshalled by reference.", MyContextBoundClass::typeid ); - } - else - { - Console::WriteLine( "{0} is not marshalled by reference.", MyContextBoundClass::typeid ); - } - - // Determine whether int type is marshalled by reference. - myType = gcnew MyTypeDelegatorClass( int::typeid ); - Console::WriteLine( "\nDetermine whether int is marshalled by reference." ); - if ( myType->IsMarshalByRef ) - { - Console::WriteLine( "{0} is marshalled by reference.", int::typeid ); - } - else - { - Console::WriteLine( "{0} is not marshalled by reference.", int::typeid ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp deleted file mode 100644 index 777086959b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyTypeDelegatorClass: public TypeDelegator -{ -public: - String^ myElementType; - -private: - Type^ myType; - -public: - MyTypeDelegatorClass( Type^ myType ) - : TypeDelegator( myType ) - { - this->myType = myType; - } - -protected: - - // Override the IsPrimitiveImpl. - virtual bool IsPrimitiveImpl() override - { - - // Determine whether the type is a primitive type. - if ( myType->IsPrimitive ) - { - myElementType = "primitive"; - return true; - } - - return false; - } -}; - -int main() -{ - try - { - Console::WriteLine( "Determine whether int is a primitive type." ); - MyTypeDelegatorClass^ myType; - myType = gcnew MyTypeDelegatorClass( int::typeid ); - - // Determine whether int is a primitive type. - if ( myType->IsPrimitive ) - { - Console::WriteLine( "{0} is a primitive type.", int::typeid ); - } - else - { - Console::WriteLine( "{0} is not a primitive type.", int::typeid ); - } - Console::WriteLine( "\nDetermine whether String is a primitive type." ); - myType = gcnew MyTypeDelegatorClass( String::typeid ); - - // Determine if String is a primitive type. - if ( myType->IsPrimitive ) - { - Console::WriteLine( "{0} is a primitive type.", String::typeid ); - } - else - { - Console::WriteLine( "{0} is not a primitive type.", String::typeid ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp deleted file mode 100644 index ef24b8b9c18..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; - -// Declare MyTestClass as sealed. -ref class TestClass sealed{}; - -int main() -{ - TestClass^ testClassInstance = gcnew TestClass; - - // Get the type of testClassInstance. - Type^ type = testClassInstance->GetType(); - - // Get the IsSealed property of the myTestClassInstance. - bool sealed = type->IsSealed; - Console::WriteLine("{0} is sealed: {1}.", type->FullName, sealed); -} -// The example displays the following output: -// TestClass is sealed: True. -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp deleted file mode 100644 index 80e31b7ccbb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -public ref class MyClass -{ -public: - - // Declare a public class with the [Serializable] attribute. - - [Serializable] - ref class MyTestClass{}; - - -}; - -int main() -{ - try - { - bool myBool = false; - MyClass::MyTestClass^ myTestClassInstance = gcnew MyClass::MyTestClass; - - // Get the type of myTestClassInstance. - Type^ myType = myTestClassInstance->GetType(); - - // Get the IsSerializable property of myTestClassInstance. - myBool = myType->IsSerializable; - Console::WriteLine( "\nIs {0} serializable? {1}.", myType->FullName, myBool ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nAn exception occurred: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp deleted file mode 100644 index c8ad8156905..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; - -// Declare an enum type. -public enum class NumEnum -{ - One, Two -}; - -int main() -{ - bool flag = false; - NumEnum testEnum = NumEnum::One; - - // Get the type of testEnum. - Type^ t = testEnum.GetType(); - - // Get the IsValueType property of the testEnum - // variable. - flag = t->IsValueType; - Console::WriteLine("{0} is a value type: {1}", t->FullName, flag); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp deleted file mode 100644 index d6e8a01a328..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; - -namespace MyNamespace -{ - ref class MyClass - { - }; -} - -void main() -{ - Type^ myType = MyNamespace::MyClass::typeid; - Console::WriteLine("Displaying information about {0}:", myType ); - - // Get the namespace of the class MyClass. - Console::WriteLine(" Namespace: {0}", myType->Namespace ); - - // Get the name of the module. - Console::WriteLine(" Module: {0}", myType->Module ); - - // Get the fully qualified common language runtime namespace. - Console::WriteLine(" Fully qualified type: {0}", myType ); -} -// The example displays the following output: -// Displaying information about MyNamespace.MyClass: -// Namespace: MyNamespace -// Module: type_tostring.exe -// Fully qualified name: MyNamespace.MyClass -// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp deleted file mode 100644 index 23ac79f22ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -ref class MyClass -{ -public: - int myField; -}; - -void DisplayTypeHandle( RuntimeTypeHandle myTypeHandle ) -{ - - // Get the type from the handle. - Type^ myType = Type::GetTypeFromHandle( myTypeHandle ); - - // Display the type. - Console::WriteLine( "\nDisplaying the type from the handle:\n" ); - Console::WriteLine( "The type is {0}.", myType ); -} - -int main() -{ - try - { - MyClass^ myClass = gcnew MyClass; - - // Get the type of MyClass. - Type^ myClassType = myClass->GetType(); - - // Get the runtime handle of MyClass. - RuntimeTypeHandle myClassHandle = myClassType->TypeHandle; - DisplayTypeHandle( myClassHandle ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp deleted file mode 100644 index 439589d1a61..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp +++ /dev/null @@ -1,631 +0,0 @@ - -// This is the main DLL file. -using namespace System; -using namespace System::Globalization; - -#define NULL 0 - -// -/// -/// Temperature class stores the value as UInt16 -/// and delegates most of the functionality -/// to the UInt16 implementation. -/// -public ref class Temperature: public IComparable, public IFormattable -{ -protected: - - /// - /// IComparable.CompareTo implementation. - /// - short m_value; - -public: - virtual Int32 CompareTo( Object^ obj ) - { - if ( obj->GetType() == Temperature::typeid ) - { - Temperature^ temp = dynamic_cast(obj); - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - - return m_value.ToString( format, provider ); - } - - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->EndsWith( "F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - if ( s->EndsWith( "C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt16::Parse( s, styles, provider ); - } - } - - return temp; - } - - - property short Value - { - - // The value holder - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - static property short MinValue - { - short get() - { - return UInt16::MinValue; - } - - } - - static property short MaxValue - { - short get() - { - return UInt16::MaxValue; - } - - } - -}; -// - -void main() -{ - Temperature^ t1 = Temperature::Parse( "40'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - String^ str1 = t1->ToString( "C", nullptr ); - Console::WriteLine( str1 ); - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - Console::WriteLine( t1->CompareTo( t2 ) ); - Temperature^ t3 = Temperature::Parse( "40'C", NumberStyles::Integer, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - Console::WriteLine( t1->CompareTo( t3 ) ); -} - - -/* expected return values: -40'F -4'C -40'F -0 -112'F --72 -*/ -namespace Snippets2 -{ - // - public ref class Temperature - { - protected: - - // The value holder - short m_value; - - public: - - static property short MinValue - { - short get() - { - return UInt16::MinValue; - } - - } - - static property short MaxValue - { - short get() - { - return UInt16::MaxValue; - } - - } - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets3 -{ - - // - public ref class Temperature: public IComparable - { - protected: - - /// - /// IComparable.CompareTo implementation. - /// - // The value holder - short m_value; - - public: - virtual Int32 CompareTo( Object^ obj ) - { - if ( obj->GetType() == Temperature::typeid ) - { - Temperature^ temp = dynamic_cast(obj); - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets4 -{ - - // - public ref class Temperature: public IFormattable - { - protected: - - /// - /// IFormattable.ToString implementation. - /// - // The value holder - short m_value; - - public: - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr ) - { - if ( format->Equals( "F" ) ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - if ( format->Equals( "C" ) ) - { - return String::Format( "{0}'C", this->Celsius.ToString() ); - } - } - - return m_value.ToString( format, provider ); - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets5 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = UInt16::Parse( s ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets6 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = UInt16::Parse( s, provider ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets7 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = UInt16::Parse( s, styles ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// - -namespace Snippets8 -{ - // - public ref class Temperature - { - protected: - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - // The value holder - short m_value; - - public: - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) - { - temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) - { - temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt16::Parse( s, styles, provider ); - } - } - - return temp; - } - - - property short Value - { - short get() - { - return m_value; - } - - void set( short value ) - { - m_value = value; - } - - } - - property short Celsius - { - short get() - { - return (short)((m_value - 32) / 2); - } - - void set( short value ) - { - m_value = (short)(value * 2 + 32); - } - - } - - }; - -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp deleted file mode 100644 index 03bba64ea5d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// System::UInt16::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'UInt16'. This compares an instance of 'UInt16' with the -passed in Object* and returns true if they are equal. -*/ -using namespace System; - -int main() -{ - try - { - // - UInt16 myVariable1 = 10; - UInt16 myVariable2 = 10; - - //Display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp deleted file mode 100644 index 75a62e5c82b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp +++ /dev/null @@ -1,417 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -namespace Snippets -{ - // - /// - /// Temperature class stores the value as UInt32 - /// and delegates most of the functionality - /// to the UInt32 implementation. - /// - public ref class Temperature: public IComparable, public IFormattable - { - public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt32::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets2 -{ - // - public ref class Temperature - { - public: - static property UInt32 MinValue - { - UInt32 get() - { - return UInt32::MinValue; - } - } - - static property UInt32 MaxValue - { - UInt32 get() - { - return UInt32::MaxValue; - } - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets3 -{ - // - public ref class Temperature: public IComparable - { - public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets4 -{ - // - public ref class Temperature: public IFormattable - { - public: - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets5 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = UInt32::Parse( s ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets6 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = UInt32::Parse( s, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets7 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = UInt32::Parse( s, styles ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets8 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt32::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt32 m_value; - - public: - property UInt32 Value - { - UInt32 get() - { - return m_value; - } - void set( UInt32 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets -{ - void Main() - { - Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - - String^ str1 = t1->ToString( "G", nullptr ); - Console::WriteLine( str1 ); - - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t2 ) ); - - Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t3 ) ); - - Console::ReadLine(); - } -} - -int main() -{ - Snippets::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp deleted file mode 100644 index 66564fc6421..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// System::UInt32::Equals(Object) -/* -The following program demonstrates the 'Equals(Object)' method -of struct 'UInt32'. This compares an instance of 'UInt32' with the -passed in Object* and returns true if they are equal. -*/ -using namespace System; - -int main() -{ - try - { - // - UInt32 myVariable1 = 20; - UInt32 myVariable2 = 20; - - // Display the declaring type. - Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); - Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); - - // Compare 'myVariable1' instance with 'myVariable2' Object. - if ( myVariable1.Equals( myVariable2 ) ) - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); - else - Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp deleted file mode 100644 index 0e4d7eef2ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp +++ /dev/null @@ -1,405 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -// -/// -/// Temperature class stores the value as UInt64 -/// and delegates most of the functionality -/// to the UInt64 implementation. -/// -public ref class Temperature: public IComparable, public IFormattable -{ -public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt64::Parse( s, styles, provider ); - } - - return temp; - } - -protected: - // The value holder - UInt64 m_value; - -public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } -}; -// - -namespace Snippets2 -{ - // - public ref class Temperature - { - public: - static property Int64 MinValue - { - Int64 get() - { - return UInt64::MinValue; - } - } - - static property UInt64 MaxValue - { - UInt64 get() - { - return UInt64::MaxValue; - } - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets3 -{ - // - public ref class Temperature: public IComparable - { - public: - /// - /// IComparable.CompareTo implementation. - /// - virtual int CompareTo( Object^ obj ) - { - if ( (Temperature^)( obj ) ) - { - Temperature^ temp = (Temperature^)( obj ); - - return m_value.CompareTo( temp->m_value ); - } - - throw gcnew ArgumentException( "object is not a Temperature" ); - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets4 -{ - // - public ref class Temperature: public IFormattable - { - public: - /// - /// IFormattable.ToString implementation. - /// - virtual String^ ToString( String^ format, IFormatProvider^ provider ) - { - if ( format != nullptr && format == "F" ) - { - return String::Format( "{0}'F", this->Value.ToString() ); - } - - return m_value.ToString( format, provider ); - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets5 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); - } - else - { - temp->Value = UInt64::Parse( s ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets6 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); - } - else - { - temp->Value = UInt64::Parse( s, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets7 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); - } - else - { - temp->Value = UInt64::Parse( s, styles ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -namespace Snippets8 -{ - // - public ref class Temperature - { - public: - /// - /// Parses the temperature from a string in form - /// [ws][sign]digits['F|'C][ws] - /// - static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) - { - Temperature^ temp = gcnew Temperature; - - if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) - { - temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); - } - else - { - temp->Value = UInt64::Parse( s, styles, provider ); - } - - return temp; - } - - protected: - // The value holder - UInt64 m_value; - - public: - property UInt64 Value - { - UInt64 get() - { - return m_value; - } - void set( UInt64 value ) - { - m_value = value; - } - } - }; -} -// - -int main() -{ - Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t1->ToString( "F", nullptr ) ); - - String^ str1 = t1->ToString( "G", nullptr ); - Console::WriteLine( str1 ); - - Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); - Console::WriteLine( t2->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t2 ) ); - - Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr ); - Console::WriteLine( t3->ToString( "F", nullptr ) ); - - Console::WriteLine( t1->CompareTo( t3 ) ); - - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp deleted file mode 100644 index b5928f9ee25..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -int main() -{ - UInt64 value1 = 50; - UInt64 value2 = 50; - - // Display the values. - Console::WriteLine("value1: Type: {0} Value: {1}", - value1.GetType()->Name, value1); - Console::WriteLine("value2: Type: {0} Value: {1}", - value2.GetType()->Name, value2); - - // Compare the two values. - Console::WriteLine("value1 and value2 are equal: {0}", - value1.Equals(value2)); -} -// The example displays the following output: -// value1: Type: UInt64 Value: 50 -// value2: Type: UInt64 Value: 50 -// value1 and value2 are equal: True -// diff --git a/snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp b/snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp deleted file mode 100644 index dd812c872af..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - -// System::Configuration::Install::UninstallAction -// System::Configuration::Install::UninstallAction.NoAction -// System::Configuration::Install::UninstallAction.Remove -/* The following program demonstrates S"NoAction" and S"Remove" -members of S"UninstallAction" enumeration. A resource is -installed and uninstalled using 'installutil.exe' in an event -log depending on the user input. -*/ -// -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Configuration::Install; - -[RunInstaller(true)] -ref class MyUninstallActionClass: public Installer -{ -private: - EventLogInstaller^ myInstaller; - -public: - MyUninstallActionClass() - { - myInstaller = gcnew EventLogInstaller; - } - - - // Override the 'Install' method. - virtual void Install( IDictionary^ savedState ) override - { - Console::Write( "Enter a new log to create (eg: MyLog): " ); - myInstaller->Log = Console::ReadLine(); - Console::Write( "Enter a source for log (eg: MySource): " ); - myInstaller->Source = Console::ReadLine(); - Installers->Add( myInstaller ); - Installer::Install( savedState ); - } - - - // Override the 'Commit' method. - virtual void Commit( IDictionary^ savedState ) override - { - Installer::Commit( savedState ); - } - - - // Override the 'Rollback' method. - virtual void Rollback( IDictionary^ savedState ) override - { - Installer::Rollback( savedState ); - } - - - // - // - virtual void Uninstall( IDictionary^ savedState ) override - { - Console::Write( "Enter a source from log to uninstall(eg: MySource): " ); - myInstaller->Source = Console::ReadLine(); - Console::Write( "Do you want to uninstall, press 'y' for 'YES' and 'n' for 'NO':" ); - String^ myUninstall = Console::ReadLine(); - if ( myUninstall->Equals( "n" ) ) - { - - // No action to be taken on the resource in the event log. - myInstaller->UninstallAction = UninstallAction::NoAction; - } - else - { - - // Remove the resource from the event log. - myInstaller->UninstallAction = UninstallAction::Remove; - } - - Installers->Add( myInstaller ); - Installer::Uninstall( savedState ); - } - - // - // -}; - -int main() -{ - Console::WriteLine( "Syntax for install: installutil.exe UninstallAction_NoAction_Remove_3.exe " ); - Console::WriteLine( "Syntax for uninstall: installutil.exe /u UninstallAction_NoAction_Remove_3.exe " ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp deleted file mode 100644 index bf3e8e72213..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; - -void main() -{ - AppDomain^ myDomain = AppDomain::CurrentDomain; - AssemblyName^ myAsmName = gcnew AssemblyName("EmitMarshalAs"); - - AssemblyBuilder^ myAssembly = - myDomain->DefineDynamicAssembly(myAsmName, - AssemblyBuilderAccess::RunAndSave); - - ModuleBuilder^ myModule = - myAssembly->DefineDynamicModule(myAsmName->Name, - myAsmName->Name + ".dll"); - - TypeBuilder^ myType = - myModule->DefineType("Sample", TypeAttributes::Public); - - MethodBuilder^ myMethod = - myType->DefineMethod("Test", MethodAttributes::Public, - nullptr, gcnew array { String::typeid }); - - - // Get a parameter builder for the parameter that needs the - // attribute, using the HasFieldMarshal attribute. In this - // example, the parameter is at position 0 and has the name - // "arg". - ParameterBuilder^ pb = - myMethod->DefineParameter(0, - ParameterAttributes::HasFieldMarshal, "arg"); - - // Get the MarshalAsAttribute constructor that takes an - // argument of type UnmanagedType. - // - //Type^ maattrType = MarshalAsAttribute::typeid; - ConstructorInfo^ ci = - (MarshalAsAttribute::typeid)->GetConstructor( - gcnew array { UnmanagedType::typeid }); - - // Create a CustomAttributeBuilder representing the attribute, - // specifying the necessary unmanaged type. In this case, - // UnmanagedType.BStr is specified. - // - CustomAttributeBuilder^ cabuilder = - gcnew CustomAttributeBuilder( - ci, gcnew array { UnmanagedType::BStr }); - - // Apply the attribute to the parameter. - // - pb->SetCustomAttribute(cabuilder); - - - ILGenerator^ il = myMethod->GetILGenerator(); - il->Emit(OpCodes::Ret); - - Type^ finished = myType->CreateType(); - myAssembly->Save(myAsmName->Name + ".dll"); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp b/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp deleted file mode 100644 index 6a1f8f2f542..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -/* -System.Uri.IsHexDigit - -The following program reads a string from console and determines whether the -specified character is valid hexadecimal digit. -*/ -#using - -using namespace System; -int main() -{ - try - { - // - Console::Write( "Type a string : " ); - String^ myString = Console::ReadLine(); - for ( int i = 0; i < myString->Length; i++ ) - if ( Uri::IsHexDigit( myString[ i ] ) ) - Console::WriteLine( "{0} is a hexadecimal digit.", myString[ i ] ); - else - Console::WriteLine( "{0} is not a hexadecimal digit.", myString[ i ] ); - // The example produces output like the following: - // Type a string : 3f5EaZ - // 3 is a hexadecimal digit. - // f is a hexadecimal digit. - // 5 is a hexadecimal digit. - // E is a hexadecimal digit. - // a is a hexadecimal digit. - // Z is not a hexadecimal digit. - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} - -// ***** Output ***** -/* - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp deleted file mode 100644 index dfec68d03a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -using namespace System; - -// -public ref struct Complex -{ -public: - double m_Re; - double m_Im; - virtual bool Equals( Object^ ob ) override - { - if ( dynamic_cast(ob) ) - { - Complex^ c = dynamic_cast(ob); - return m_Re == c->m_Re && m_Im == c->m_Im; - } - else - { - return false; - } - } - - virtual int GetHashCode() override - { - return m_Re.GetHashCode() ^ m_Im.GetHashCode(); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp b/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp deleted file mode 100644 index a5590808eaa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp +++ /dev/null @@ -1,71 +0,0 @@ -//Types:System.Threading.WaitHandle -// -using namespace System; -using namespace System::Threading; - -public ref class WaitHandleExample -{ - // Define a random number generator for testing. -private: - static Random^ random = gcnew Random(); -public: - static void DoTask(Object^ state) - { - AutoResetEvent^ autoReset = (AutoResetEvent^) state; - int time = 1000 * random->Next(2, 10); - Console::WriteLine("Performing a task for {0} milliseconds.", time); - Thread::Sleep(time); - autoReset->Set(); - } -}; - -// -int main() -{ - // Define an array with two AutoResetEvent WaitHandles. - array^ handles = gcnew array { - gcnew AutoResetEvent(false), gcnew AutoResetEvent(false)}; - - // Queue up two tasks on two different threads; - // wait until all tasks are completed. - DateTime timeInstance = DateTime::Now; - Console::WriteLine("Main thread is waiting for BOTH tasks to " + - "complete."); - ThreadPool::QueueUserWorkItem( - gcnew WaitCallback(WaitHandleExample::DoTask), handles[0]); - ThreadPool::QueueUserWorkItem( - gcnew WaitCallback(WaitHandleExample::DoTask), handles[1]); - WaitHandle::WaitAll(handles); - // The time shown below should match the longest task. - Console::WriteLine("Both tasks are completed (time waited={0})", - (DateTime::Now - timeInstance).TotalMilliseconds); - - // Queue up two tasks on two different threads; - // wait until any tasks are completed. - timeInstance = DateTime::Now; - Console::WriteLine(); - Console::WriteLine("The main thread is waiting for either task to " + - "complete."); - ThreadPool::QueueUserWorkItem( - gcnew WaitCallback(WaitHandleExample::DoTask), handles[0]); - ThreadPool::QueueUserWorkItem( - gcnew WaitCallback(WaitHandleExample::DoTask), handles[1]); - int index = WaitHandle::WaitAny(handles); - // The time shown below should match the shortest task. - Console::WriteLine("Task {0} finished first (time waited={1}).", - index + 1, (DateTime::Now - timeInstance).TotalMilliseconds); -} -// - -// This code produces the following sample output. -// -// Main thread is waiting for BOTH tasks to complete. -// Performing a task for 7000 milliseconds. -// Performing a task for 4000 milliseconds. -// Both tasks are completed (time waited=7064.8052) - -// The main thread is waiting for either task to complete. -// Performing a task for 2000 milliseconds. -// Performing a task for 2000 milliseconds. -// Task 1 finished first (time waited=2000.6528). -// diff --git a/snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp deleted file mode 100644 index 5565d07259a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp +++ /dev/null @@ -1,93 +0,0 @@ - - -// -// This sample demonstrates the use of the WindowsIdentity class to impersonate a user. -// IMPORTANT NOTES: -// This sample requests the user to enter a password on the console screen. -// Because the console window does not support methods allowing the password to be masked, -// it will be visible to anyone viewing the screen. -// On Windows Vista and later this sample must be run as an administrator. - -#using - -using namespace System; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Principal; -using namespace System::Security::Permissions; - - -[DllImport("advapi32.dll",SetLastError=true)] -bool LogonUser( String^ lpszUsername, String^ lpszDomain, String^ lpszPassword, int dwLogonType, int dwLogonProvider, IntPtr * phToken ); - -[DllImport("kernel32.dll",CharSet=CharSet::Auto)] -bool CloseHandle( IntPtr handle ); - -// Test harness. -// If you incorporate this code into a DLL, be sure to demand FullTrust. - -[PermissionSetAttribute(SecurityAction::Demand,Name="FullTrust")] -int main() -{ - IntPtr tokenHandle = IntPtr(0); - - try - { - String^ userName; - String^ domainName; - - // Get the user token for the specified user, domain, and password using the - // unmanaged LogonUser method. - // The local machine name can be used for the domain name to impersonate a user on this machine. - Console::Write( "Enter the name of the domain on which to log on: " ); - domainName = Console::ReadLine(); - Console::Write( "Enter the login of a user on {0} that you wish to impersonate: ", domainName ); - userName = Console::ReadLine(); - Console::Write( "Enter the password for {0}: ", userName ); - const int LOGON32_PROVIDER_DEFAULT = 0; - - //This parameter causes LogonUser to create a primary token. - const int LOGON32_LOGON_INTERACTIVE = 2; - const int SecurityImpersonation = 2; - tokenHandle = IntPtr::Zero; - - // Call LogonUser to obtain a handle to an access token. - bool returnValue = LogonUser( userName, domainName, Console::ReadLine(), LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &tokenHandle ); - Console::WriteLine( "LogonUser called." ); - if ( false == returnValue ) - { - int ret = Marshal::GetLastWin32Error(); - Console::WriteLine( "LogonUser failed with error code : {0}", ret ); - throw gcnew System::ComponentModel::Win32Exception( ret ); - } - Console::WriteLine( "Did LogonUser Succeed? {0}", (returnValue ? (String^)"Yes" : "No") ); - Console::WriteLine( "Value of Windows NT token: {0}", tokenHandle ); - - // Check the identity. - Console::WriteLine( "Before impersonation: {0}", WindowsIdentity::GetCurrent()->Name ); - - // The token that is passed to the following constructor must - // be a primary token in order to use it for impersonation. - WindowsIdentity^ newId = gcnew WindowsIdentity( tokenHandle ); - WindowsImpersonationContext^ impersonatedUser = newId->Impersonate(); - - // Check the identity. - Console::WriteLine( "After impersonation: {0}", WindowsIdentity::GetCurrent()->Name ); - - // Stop impersonating the user. - impersonatedUser->Undo(); - - // Check the identity. - Console::WriteLine( "After Undo: {0}", WindowsIdentity::GetCurrent()->Name ); - - // Free the tokens. - if ( tokenHandle != IntPtr::Zero ) - CloseHandle( tokenHandle ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Exception occurred. {0}", ex->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp deleted file mode 100644 index 9772134cfdc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - String^ OtherCertificate = "OtherCertificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Load the certificate into an X509Certificate object. - X509Certificate^ certTwo = X509Certificate::CreateFromCertFile( OtherCertificate ); - - // Get the value. - bool result = cert->Equals( certTwo ); - - // Display the value to the console. - Console::WriteLine( result ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp deleted file mode 100644 index 5af220ab9f7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - array^results = cert->GetCertHash(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp deleted file mode 100644 index 55ab6046d0b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetCertHashString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp deleted file mode 100644 index bdd5c733874..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetEffectiveDateString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp deleted file mode 100644 index 7c7ba844a14..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetExpirationDateString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp deleted file mode 100644 index 478464e28d5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetFormat(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp deleted file mode 100644 index fbd037afed5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - int results = cert->GetHashCode(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp deleted file mode 100644 index c8cc924a1df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetIssuerName(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp deleted file mode 100644 index 6c0355deedf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetKeyAlgorithm(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp deleted file mode 100644 index 834343b8ca2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - array^results = cert->GetKeyAlgorithmParameters(); - - // Display the value to the console. - System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); - while ( enum0->MoveNext() ) - { - Byte b = safe_cast(enum0->Current); - Console::Write( b ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp deleted file mode 100644 index 3ebc0887b84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetKeyAlgorithmParametersString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp deleted file mode 100644 index 14cc5940220..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetName(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp deleted file mode 100644 index e30ffdb3735..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - array^results = cert->GetPublicKey(); - - // Display the value to the console. - System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); - while ( enum0->MoveNext() ) - { - Byte b = safe_cast(enum0->Current); - Console::Write( b ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp deleted file mode 100644 index 53861be1cdc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetPublicKeyString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp deleted file mode 100644 index da8eae2d858..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - array^results = cert->GetRawCertData(); - - // Display the value to the console. - System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); - while ( enum0->MoveNext() ) - { - Byte b = safe_cast(enum0->Current); - Console::Write( b ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp deleted file mode 100644 index 17f1ada058c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetRawCertDataString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp deleted file mode 100644 index fe0562f72c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - array^results = cert->GetSerialNumber(); - - // Display the value to the console. - System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); - while ( enum0->MoveNext() ) - { - Byte b = safe_cast(enum0->Current); - Console::Write( b ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp deleted file mode 100644 index f0bcfd5314f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ results = cert->GetSerialNumberString(); - - // Display the value to the console. - Console::WriteLine( results ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp deleted file mode 100644 index 311195b9c1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Cryptography::X509Certificates; -int main() -{ - - // The path to the certificate. - String^ Certificate = "Certificate.cer"; - - // Load the certificate into an X509Certificate object. - X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); - - // Get the value. - String^ resultsTrue = cert->ToString( true ); - - // Display the value to the console. - Console::WriteLine( resultsTrue ); - - // Get the value. - String^ resultsFalse = cert->ToString( false ); - - // Display the value to the console. - Console::WriteLine( resultsFalse ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp deleted file mode 100644 index aa1fd739b5b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// -// -// This example signs a URL using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - - -namespace Sample -{ - public ref class SignVerifyEnvelope - { - public: - static void Work() - { - // Generate a signing key. - RSA^ key = RSA::Create(); - - try - { - - // Sign the detached resource and save the - // signature in an XML file. - SignDetachedResource("http://www.microsoft.com", - "SignedExample.xml", key); - - Console::WriteLine("XML file signed."); - - // Verify the signature of the signed XML. - Console::WriteLine("Verifying signature..."); - - bool result = VerifyXmlFile("SignedExample.xml"); - - // Display the results of the signature verification - // to the console. - if (result) - { - Console::WriteLine("The XML signature" - " is valid."); - } - else - { - Console::WriteLine("The XML signature" - " is not valid."); - } - Console::ReadLine(); - } - - catch (CryptographicException^ ex) - { - Console::WriteLine(ex->Message); - } - finally - { - // Clear resources associated with the - // RSA instance. - key->Clear(); - } - } - - - // Sign an XML file and save the signature in a new file. - static void SignDetachedResource(String^ uri, - String^ xmlFileName, RSA^ key) - { - // Check the arguments. - if (uri->Length == 0) - { - throw gcnew ArgumentException("uri"); - } - if (xmlFileName->Length == 0) - { - throw gcnew ArgumentException("xmlFileName"); - } - if (key->KeySize == 0) - { - throw gcnew ArgumentException("key"); - } - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml(); - - // Assign the key to the SignedXml object. - signedXml->SigningKey = key; - - // Get the signature object from the SignedXml object. - Signature^ xmlSignature = signedXml->Signature; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference(); - - // Add the passed URI to the reference object. - reference->Uri = uri; - - // Add the Reference object to the Signature object. - xmlSignature->SignedInfo->AddReference(reference); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient - // find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo(); - keyInfo->AddClause( - gcnew RSAKeyValue(key)); - - // Add the KeyInfo object to the Reference object. - xmlSignature->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmlTextWriter = gcnew XmlTextWriter( - xmlFileName, gcnew UTF8Encoding(false)); - - xmlDigitalSignature->WriteTo(xmlTextWriter); - xmlTextWriter->Close(); - } - - - // Verify the signature of an XML file and return the result. - static Boolean VerifyXmlFile(String^ documentName) - { - // Check the arguments. - if (documentName->Length == 0) - { - throw gcnew ArgumentException("documentName"); - } - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument(); - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load(documentName); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml(xmlDocument); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = - xmlDocument->GetElementsByTagName("Signature"); - - // Load the signature node. - signedXml->LoadXml( - (XmlElement^) nodeList->Item(0)); - - // Check the signature and return the result. - return signedXml->CheckSignature(); - } - }; -} - - -int main() -{ - Sample::SignVerifyEnvelope::Work(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp deleted file mode 100644 index 95b151171e8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Xml; -int main() -{ - - // Create example data to sign. - XmlDocument^ document = gcnew XmlDocument; - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - node->InnerText = "This is some text"; - document->AppendChild( node ); - Console::Error->WriteLine( "Data to sign:\n{0}\n", document->OuterXml ); - - // Create the SignedXml message. - SignedXml^ signedXml = gcnew SignedXml; - RSA^ key = RSA::Create(); - signedXml->SigningKey = key; - - // Create a data object to hold the data to sign. - DataObject^ dataObject = gcnew DataObject; - dataObject->Data = document->ChildNodes; - dataObject->Id = "MyObjectId"; - - // Add the data object to the signature. - signedXml->AddObject( dataObject ); - - // Create a reference to be able to package everything into the - // message. - Reference^ reference = gcnew Reference; - reference->Uri = "#MyObjectId"; - - // Add it to the message. - signedXml->AddReference( reference ); - - // Add a KeyInfo. - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( key ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature. - XmlElement^ xmlSignature = signedXml->GetXml(); - Console::WriteLine( xmlSignature->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp deleted file mode 100644 index 74689b19c1f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - array^args = System::Environment::GetCommandLineArgs(); - Console::WriteLine( "Verifying {0}...", args[ 1 ] ); - - // Create a SignedXml. - SignedXml^ signedXml = gcnew SignedXml; - - // Load the XML. - XmlDocument^ xmlDocument = gcnew XmlDocument; - xmlDocument->PreserveWhitespace = true; - xmlDocument->Load( gcnew XmlTextReader( args[ 1 ] ) ); - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - signedXml->LoadXml( safe_cast(nodeList[ 0 ]) ); - if ( signedXml->CheckSignature() ) - { - Console::WriteLine( "Signature check OK" ); - } - else - { - Console::WriteLine( "Signature check FAILED" ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp b/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp deleted file mode 100644 index fb78282dd30..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Policy; - -//for evidence object -int main() -{ - AppDomainSetup^ setup = gcnew AppDomainSetup; - - // Shadow copying will not work unless the application has a name. - setup->ApplicationName = "MyApplication"; - - //Create evidence for the new application domain from evidence of - // current application domain. - Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; - - // Create a new application domain. - AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup ); - - // MyAssembly.dll is located in the Assemblies subdirectory. - domain->AppendPrivatePath( "Assemblies" ); - - // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the - // MoreAssemblies subdirectory. - domain->AppendPrivatePath( "MoreAssemblies" ); - - // Display the relative search path. - Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath ); - - // Because Load returns an Assembly object, the assemblies must be - // loaded into the current domain as well. This will fail unless the - // current domain also has these directories in its search path. - AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" ); - AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" ); - - // Save shadow copies to C:\Cache - domain->SetCachePath( "C:\\Cache" ); - - // Shadow copy only the assemblies in the Assemblies directory. - domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) ); - - // Turn shadow copying on. - domain->SetShadowCopyFiles(); - Console::WriteLine( "ShadowCopyFiles turned on: {0}", domain->ShadowCopyFiles ); - - // This will be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" ); - - // This will not be copied. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" ); - - // When the shadow copy path is cleared, the CLR will make shadow copies - // of all private assemblies. - domain->ClearShadowCopyPath(); - - // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. - // You must supply a valid fully qualified assembly name here. - domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" ); - - // Unload the domain. - AppDomain::Unload( domain ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp b/snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp deleted file mode 100644 index e3a2a599d6d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; -int main() -{ - - // creates the CspParameters object and sets the key container name used to store the RSA key pair - CspParameters^ cp = gcnew CspParameters; - cp->KeyContainerName = "MyKeyContainerName"; - - // instantiates the rsa instance accessing the key container MyKeyContainerName - RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( cp ); - - // add the below line to delete the key entry in MyKeyContainerName - // rsa.PersistKeyInCsp = false; - //writes out the current key pair used in the rsa instance - Console::WriteLine( "Key is : \n{0}", rsa->ToXmlString( true ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp b/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp deleted file mode 100644 index 7cd42aba971..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp +++ /dev/null @@ -1,57 +0,0 @@ - -// -// This example demonstrates the Char.ConvertFromUtf32() method -// and Char.ConvertToUtf32() overloads. -using namespace System; -void Show( String^ s ) -{ -// Console::Write( "0x{0:X}, 0x{1:X}", (int)s->get_Chars( 0 ), (int)s->get_Chars( 1 ) ); - Console::Write( "0x{0:X}, 0x{1:X}", (int)s[ 0 ], (int)s[ 1 ] ); -} - -int main() -{ - int music = 0x1D161; //U+1D161 = MUSICAL SYMBOL SIXTEENTH NOTE - - String^ s1; - String^ comment1a = "Create a UTF-16 encoded string from a code point."; - String^ comment1b = "Create a code point from a surrogate pair at a certain position in a string."; - String^ comment1c = "Create a code point from a high surrogate and a low surrogate code point."; - - // ------------------------------------------------------------------- - // Convert the code point U+1D161 to UTF-16. The UTF-16 equivalent of - // U+1D161 is a surrogate pair with hexadecimal values D834 and DD61. - Console::WriteLine( comment1a ); - s1 = Char::ConvertFromUtf32( music ); - Console::Write( " 1a) 0x{0:X} => ", music ); - Show( s1 ); - Console::WriteLine(); - - // Convert the surrogate pair in the string at index position - // zero to a code point. - Console::WriteLine( comment1b ); - music = Char::ConvertToUtf32( s1, 0 ); - Console::Write( " 1b) " ); - Show( s1 ); - Console::WriteLine( " => 0x{0:X}", music ); - - // Convert the high and low characters in the surrogate pair into a code point. - Console::WriteLine( comment1c ); - music = Char::ConvertToUtf32( s1[ 0 ], s1[ 1 ] ); - Console::Write( " 1c) " ); - Show( s1 ); - Console::WriteLine( " => 0x{0:X}", music ); -} - -/* -This example produces the following results: - -Create a UTF-16 encoded string from a code point. - 1a) 0x1D161 => 0xD834, 0xDD61 -Create a code point from a surrogate pair at a certain position in a string. - 1b) 0xD834, 0xDD61 => 0x1D161 -Create a code point from a high surrogate and a low surrogate code point. - 1c) 0xD834, 0xDD61 => 0x1D161 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp b/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp deleted file mode 100644 index 1a9d98b34ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -// This example demonstrates the Char.IsLowSurrogate() method -// IsHighSurrogate() method -// IsSurrogatePair() method -using namespace System; -int main() -{ - Char cHigh = L'\xD800'; - Char cLow = L'\xDC00'; - array^temp0 = {L'a',L'\xD800',L'\xDC00',L'z'}; - String^ s1 = gcnew String( temp0 ); - String^ divider = String::Concat( Environment::NewLine, gcnew String( '-',70 ), Environment::NewLine ); - Console::WriteLine(); - Console::WriteLine( "Hexadecimal code point of the character, cHigh: {0:X4}", (int)cHigh ); - Console::WriteLine( "Hexadecimal code point of the character, cLow: {0:X4}", (int)cLow ); - Console::WriteLine(); - Console::WriteLine( "Characters in string, s1: 'a', high surrogate, low surrogate, 'z'" ); - Console::WriteLine( "Hexadecimal code points of the characters in string, s1: " ); - for ( int i = 0; i < s1->Length; i++ ) - { - Console::WriteLine( "s1[{0}] = {1:X4} ", i, (int)s1[ i ] ); - } - Console::WriteLine( divider ); - Console::WriteLine( "Is each of the following characters a high surrogate?" ); - Console::WriteLine( "A1) cLow? - {0}", Char::IsHighSurrogate( cLow ) ); - Console::WriteLine( "A2) cHigh? - {0}", Char::IsHighSurrogate( cHigh ) ); - Console::WriteLine( "A3) s1[0]? - {0}", Char::IsHighSurrogate( s1, 0 ) ); - Console::WriteLine( "A4) s1[1]? - {0}", Char::IsHighSurrogate( s1, 1 ) ); - Console::WriteLine( divider ); - Console::WriteLine( "Is each of the following characters a low surrogate?" ); - Console::WriteLine( "B1) cLow? - {0}", Char::IsLowSurrogate( cLow ) ); - Console::WriteLine( "B2) cHigh? - {0}", Char::IsLowSurrogate( cHigh ) ); - Console::WriteLine( "B3) s1[0]? - {0}", Char::IsLowSurrogate( s1, 0 ) ); - Console::WriteLine( "B4) s1[2]? - {0}", Char::IsLowSurrogate( s1, 2 ) ); - Console::WriteLine( divider ); - Console::WriteLine( "Is each of the following pairs of characters a surrogate pair?" ); - Console::WriteLine( "C1) cHigh and cLow? - {0}", Char::IsSurrogatePair( cHigh, cLow ) ); - Console::WriteLine( "C2) s1[0] and s1[1]? - {0}", Char::IsSurrogatePair( s1, 0 ) ); - Console::WriteLine( "C3) s1[1] and s1[2]? - {0}", Char::IsSurrogatePair( s1, 1 ) ); - Console::WriteLine( "C4) s1[2] and s1[3]? - {0}", Char::IsSurrogatePair( s1, 2 ) ); - Console::WriteLine( divider ); -} - -/* -This example produces the following results: - -Hexadecimal code point of the character, cHigh: D800 -Hexadecimal code point of the character, cLow: DC00 - -Characters in string, s1: 'a', high surrogate, low surrogate, 'z' -Hexadecimal code points of the characters in string, s1: -s1[0] = 0061 -s1[1] = D800 -s1[2] = DC00 -s1[3] = 007A - ----------------------------------------------------------------------- - -Is each of the following characters a high surrogate? -A1) cLow? - False -A2) cHigh? - True -A3) s1[0]? - False -A4) s1[1]? - True - ----------------------------------------------------------------------- - -Is each of the following characters a low surrogate? -B1) cLow? - True -B2) cHigh? - False -B3) s1[0]? - False -B4) s1[2]? - True - ----------------------------------------------------------------------- - -Is each of the following pairs of characters a surrogate pair? -C1) cHigh and cLow? - True -C2) s1[0] and s1[1]? - False -C3) s1[1] and s1[2]? - True -C4) s1[2] and s1[3]? - False - ----------------------------------------------------------------------- - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp deleted file mode 100644 index 23e5a5ec992..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -// This example demonstrates the Console.Beep() method. -using namespace System; -int main() -{ - array^args = Environment::GetCommandLineArgs(); - int x = 0; - - // - if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x )) && ((x >= 1) && (x <= 9)) ) - { - for ( int i = 1; i <= x; i++ ) - { - Console::WriteLine( "Beep number {0}.", i ); - Console::Beep(); - - } - } - else - Console::WriteLine( "Usage: Enter the number of times (between 1 and 9) to beep." ); -} - -/* -This example produces the following results: - ->beep -Usage: Enter the number of times (between 1 and 9) to beep - ->beep 9 -Beep number 1. -Beep number 2. -Beep number 3. -Beep number 4. -Beep number 5. -Beep number 6. -Beep number 7. -Beep number 8. -Beep number 9. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp deleted file mode 100644 index d933d3fdf50..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp +++ /dev/null @@ -1,124 +0,0 @@ - -// -// This example demonstrates the Console.Beep(Int32, Int32) method -using namespace System; -using namespace System::Threading; -ref class Sample -{ -protected: - - // Define the frequencies of notes in an octave, as well as - // silence (rest). - enum class Tone - { - REST = 0, - GbelowC = 196, - A = 220, - Asharp = 233, - B = 247, - C = 262, - Csharp = 277, - D = 294, - Dsharp = 311, - E = 330, - F = 349, - Fsharp = 370, - G = 392, - Gsharp = 415 - }; - - - // Define the duration of a note in units of milliseconds. - enum class Duration - { - WHOLE = 1600, - HALF = Duration::WHOLE / 2, - QUARTER = Duration::HALF / 2, - EIGHTH = Duration::QUARTER / 2, - SIXTEENTH = Duration::EIGHTH / 2 - }; - - -public: - - // Define a note as a frequency (tone) and the amount of - // time (duration) the note plays. - value struct Note - { - public: - Tone toneVal; - Duration durVal; - - // Define a constructor to create a specific note. - Note( Tone frequency, Duration time ) - { - toneVal = frequency; - durVal = time; - } - - - property Tone NoteTone - { - - // Define properties to return the note's tone and duration. - Tone get() - { - return toneVal; - } - - } - - property Duration NoteDuration - { - Duration get() - { - return durVal; - } - - } - - }; - - -protected: - - // Play the notes in a song. - static void Play( array^ tune ) - { - System::Collections::IEnumerator^ myEnum = tune->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Note n = *safe_cast(myEnum->Current); - if ( n.NoteTone == Tone::REST ) - Thread::Sleep( (int)n.NoteDuration ); - else - Console::Beep( (int)n.NoteTone, (int)n.NoteDuration ); - } - } - - -public: - static void Main() - { - - // Declare the first few notes of the song, "Mary Had A Little Lamb". - array^ Mary = {Note( Tone::B, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::GbelowC, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::HALF ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::HALF ),Note( Tone::B, Duration::QUARTER ),Note( Tone::D, Duration::QUARTER ),Note( Tone::D, Duration::HALF )}; - - // Play the song - Play( Mary ); - } - -}; - -int main() -{ - Sample::Main(); -} - -/* -This example produces the following results: - -This example plays the first few notes of "Mary Had A Little Lamb" -through the console speaker. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp b/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp deleted file mode 100644 index 75f186ab055..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -// This example demonstrates the Console.BufferHeight and -// Console.BufferWidth properties. -using namespace System; -int main() -{ - Console::WriteLine( "The current buffer height is {0} rows.", Console::BufferHeight ); - Console::WriteLine( "The current buffer width is {0} columns.", Console::BufferWidth ); -} - -/* -This example produces the following results: - -The current buffer height is 300 rows. -The current buffer width is 85 columns. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp b/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp deleted file mode 100644 index 4ad4c4573e5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -using namespace System; - -void OnCancelKeyPressed(Object^ sender, - ConsoleCancelEventArgs^ args) -{ - Console::WriteLine("{0}The read operation has been interrupted.", - Environment::NewLine); - - Console::WriteLine(" Key pressed: {0}", args->SpecialKey); - - Console::WriteLine(" Cancel property: {0}", args->Cancel); - - // Set the Cancel property to true to prevent the process from - // terminating. - Console::WriteLine("Setting the Cancel property to true..."); - args->Cancel = true; - - // Announce the new value of the Cancel property. - Console::WriteLine(" Cancel property: {0}", args->Cancel); - Console::WriteLine("The read operation will resume...{0}", - Environment::NewLine); -} - -int main() -{ - // Clear the screen. - Console::Clear(); - - // Establish an event handler to process key press events. - Console::CancelKeyPress += - gcnew ConsoleCancelEventHandler(OnCancelKeyPressed); - - while (true) - { - // Prompt the user. - Console::Write("Press any key, or 'X' to quit, or "); - Console::WriteLine("CTRL+C to interrupt the read operation:"); - - // Start a console read operation. Do not display the input. - ConsoleKeyInfo^ keyInfo = Console::ReadKey(true); - - // Announce the name of the key that was pressed . - Console::WriteLine(" Key pressed: {0}{1}", keyInfo->Key, - Environment::NewLine); - - // Exit if the user pressed the 'X' key. - if (keyInfo->Key == ConsoleKey::X) - { - break; - } - } -} -// The example displays output similar to the following: -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// Key pressed: J -// -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// Key pressed: Enter -// -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// -// The read operation has been interrupted. -// Key pressed: ControlC -// Cancel property: False -// Setting the Cancel property to true... -// Cancel property: True -// The read operation will resume... -// -// Key pressed: Q -// -// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: -// Key pressed: X -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp deleted file mode 100644 index fb1544c6848..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -// This example demonstrates the -// Console.CursorLeft and -// Console.CursorTop properties, and the -// Console.SetCursorPosition and -// Console.Clear methods. -using namespace System; -int origRow; -int origCol; -void WriteAt( String^ s, int x, int y ) -{ - try - { - Console::SetCursorPosition( origCol + x, origRow + y ); - Console::Write( s ); - } - catch ( ArgumentOutOfRangeException^ e ) - { - Console::Clear(); - Console::WriteLine( e->Message ); - } - -} - -int main() -{ - - // Clear the screen, then save the top and left coordinates. - Console::Clear(); - origRow = Console::CursorTop; - origCol = Console::CursorLeft; - - // Draw the left side of a 5x5 rectangle, from top to bottom. - WriteAt( "+", 0, 0 ); - WriteAt( "|", 0, 1 ); - WriteAt( "|", 0, 2 ); - WriteAt( "|", 0, 3 ); - WriteAt( "+", 0, 4 ); - - // Draw the bottom side, from left to right. - WriteAt( "-", 1, 4 ); // shortcut: WriteAt("---", 1, 4) - WriteAt( "-", 2, 4 ); // ... - WriteAt( "-", 3, 4 ); // ... - WriteAt( "+", 4, 4 ); - - // Draw the right side, from bottom to top. - WriteAt( "|", 4, 3 ); - WriteAt( "|", 4, 2 ); - WriteAt( "|", 4, 1 ); - WriteAt( "+", 4, 0 ); - - // Draw the top side, from right to left. - WriteAt( "-", 3, 0 ); // shortcut: WriteAt("---", 1, 0) - WriteAt( "-", 2, 0 ); // ... - WriteAt( "-", 1, 0 ); // ... - - // - WriteAt( "All done!", 0, 6 ); - Console::WriteLine(); -} - -/* -This example produces the following results: - -+---+ -| | -| | -| | -+---+ - -All done! - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp deleted file mode 100644 index d04872cd7db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -// This example demonstrates the Console.CursorSize property. -using namespace System; -int main() -{ - String^ m0 = "This example increments the cursor size from 1% to 100%:\n"; - String^ m1 = "Cursor size = {0}%. (Press any key to continue...)"; - array^sizes = {1,10,20,30,40,50,60,70,80,90,100}; - int saveCursorSize; - - // - saveCursorSize = Console::CursorSize; - Console::WriteLine( m0 ); - System::Collections::IEnumerator^ myEnum = sizes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - int size = *safe_cast(myEnum->Current); - Console::CursorSize = size; - Console::WriteLine( m1, size ); - Console::ReadKey(); - } - - Console::CursorSize = saveCursorSize; -} - -/* -This example produces the following results: - -This example increments the cursor size from 1% to 100%: - -Cursor size = 1%. (Press any key to continue...) -Cursor size = 10%. (Press any key to continue...) -Cursor size = 20%. (Press any key to continue...) -Cursor size = 30%. (Press any key to continue...) -Cursor size = 40%. (Press any key to continue...) -Cursor size = 50%. (Press any key to continue...) -Cursor size = 60%. (Press any key to continue...) -Cursor size = 70%. (Press any key to continue...) -Cursor size = 80%. (Press any key to continue...) -Cursor size = 90%. (Press any key to continue...) -Cursor size = 100%. (Press any key to continue...) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp deleted file mode 100644 index bf60e0028a7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -// This example demonstrates the Console.CursorVisible property. -using namespace System; - -int main() -{ - String^ m1 = "\nThe cursor is {0}.\nType any text then press Enter. " - "Type '+' in the first column to show \n" - "the cursor, '-' to hide the cursor, " - "or lowercase 'x' to quit:"; - String^ s; - bool saveCursorVisibile; - int saveCursorSize; - - // - Console::CursorVisible = true; // Initialize the cursor to visible. - saveCursorVisibile = Console::CursorVisible; - saveCursorSize = Console::CursorSize; - Console::CursorSize = 100; // Emphasize the cursor. - for ( ; ; ) - { - Console::WriteLine( m1, ((Console::CursorVisible == true) ? (String^)"VISIBLE" : "HIDDEN") ); - s = Console::ReadLine(); - if ( !String::IsNullOrEmpty( s ) ) - if ( s[ 0 ] == '+' ) - Console::CursorVisible = true; - else - if ( s[ 0 ] == '-' ) - Console::CursorVisible = false; - else - if ( s[ 0 ] == 'x' ) - break; - - } - Console::CursorVisible = saveCursorVisibile; - Console::CursorSize = saveCursorSize; -} - -/* -This example produces the following results. Note that these results -cannot depict cursor visibility. You must run the example to see the -cursor behavior: - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -The quick brown fox - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -- - -The cursor is HIDDEN. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -jumps over - -The cursor is HIDDEN. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -+ - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -the lazy dog. - -The cursor is VISIBLE. -Type any text then press Enter. Type '+' in the first column to show -the cursor, '-' to hide the cursor, or lowercase 'x' to quit: -x - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp deleted file mode 100644 index 8b8f1a06db8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -int main() -{ - ConsoleKeyInfo cki; - do - { - Console::WriteLine( "\nPress a key to display; press the 'x' key to quit." ); - - // Your code could perform some useful task in the following loop. However, - // for the sake of this example we'll merely pause for a quarter second. - while ( !Console::KeyAvailable ) - Thread::Sleep( 250 ); - cki = Console::ReadKey( true ); - Console::WriteLine( "You pressed the '{0}' key.", cki.Key ); - } - while ( cki.Key != ConsoleKey::X ); -} - -/* -This example produces results similar to the following: - -Press a key to display; press the 'x' key to quit. -You pressed the 'H' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'E' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'PageUp' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'DownArrow' key. - -Press a key to display; press the 'x' key to quit. -You pressed the 'X' key. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp b/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp deleted file mode 100644 index fa7edff4517..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -// This example demonstrates the Console.Read() method. -using namespace System; -int main() -{ - String^ m1 = "\nType a string of text then press Enter. " - "Type '+' anywhere in the text to quit:\n"; - String^ m2 = "Character '{0}' is hexadecimal 0x{1:x4}."; - String^ m3 = "Character is hexadecimal 0x{0:x4}."; - Char ch; - int x; - - // - Console::WriteLine( m1 ); - do - { - x = Console::Read(); - try - { - ch = Convert::ToChar( x ); - if ( Char::IsWhiteSpace( ch ) ) - { - Console::WriteLine( m3, x ); - if ( ch == 0x0a ) - Console::WriteLine( m1 ); - } - else - Console::WriteLine( m2, ch, x ); - } - catch ( OverflowException^ e ) - { - Console::WriteLine( "{0} Value read = {1}.", e->Message, x ); - ch = Char::MinValue; - Console::WriteLine( m1 ); - } - - } - while ( ch != '+' ); -} - -/* -This example produces the following results: - -Type a string of text then press Enter. Type '+' anywhere in the text to quit: - -The quick brown fox. -Character 'T' is hexadecimal 0x0054. -Character 'h' is hexadecimal 0x0068. -Character 'e' is hexadecimal 0x0065. -Character is hexadecimal 0x0020. -Character 'q' is hexadecimal 0x0071. -Character 'u' is hexadecimal 0x0075. -Character 'i' is hexadecimal 0x0069. -Character 'c' is hexadecimal 0x0063. -Character 'k' is hexadecimal 0x006b. -Character is hexadecimal 0x0020. -Character 'b' is hexadecimal 0x0062. -Character 'r' is hexadecimal 0x0072. -Character 'o' is hexadecimal 0x006f. -Character 'w' is hexadecimal 0x0077. -Character 'n' is hexadecimal 0x006e. -Character is hexadecimal 0x0020. -Character 'f' is hexadecimal 0x0066. -Character 'o' is hexadecimal 0x006f. -Character 'x' is hexadecimal 0x0078. -Character '.' is hexadecimal 0x002e. -Character is hexadecimal 0x000d. -Character is hexadecimal 0x000a. - -Type a string of text then press Enter. Type '+' anywhere in the text to quit: - -^Z -Value was either too large or too small for a character. Value read = -1. - -Type a string of text then press Enter. Type '+' anywhere in the text to quit: - -+ -Character '+' is hexadecimal 0x002b. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp deleted file mode 100644 index d2f1a175be4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Console.ReadKey.cpp : main project file. - -// -using namespace System; - -void main() -{ - ConsoleKeyInfo cki; - // Prevent example from ending if CTL+C is pressed. - Console::TreatControlCAsInput = true; - - Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key."); - Console::WriteLine("Press the Escape (Esc) key to quit: \n"); - do - { - cki = Console::ReadKey(); - Console::Write(" --- You pressed "); - if((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+"); - if((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+"); - if((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+"); - Console::WriteLine(cki.Key.ToString()); - } while (cki.Key != ConsoleKey::Escape); -} -// This example displays output similar to the following: -// Press any combination of CTL, ALT, and SHIFT, and a console key. -// Press the Escape (Esc) key to quit: -// -// a --- You pressed A -// k --- You pressed ALT+K -// â–º --- You pressed CTL+P -// --- You pressed RightArrow -// R --- You pressed SHIFT+R -// --- You pressed CTL+I -// j --- You pressed ALT+J -// O --- You pressed SHIFT+O -// § --- You pressed CTL+U } -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp deleted file mode 100644 index f354fdf3929..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Console.ReadKey2.cpp : main project file. - -// -using namespace System; - -void main() -{ - ConsoleKeyInfo cki; - // Prevent example from ending if CTL+C is pressed. - Console::TreatControlCAsInput = true; - - Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key."); - Console::WriteLine("Press the Escape (Esc) key to quit: \n"); - do { - cki = Console::ReadKey(true); - Console::Write("You pressed "); - if ((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+"); - if ((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+"); - if ((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+"); - Console::WriteLine("{0} (character '{1}')", cki.Key, cki.KeyChar); - } while (cki.Key != ConsoleKey::Escape); -} -// This example displays output similar to the following: -// Press any combination of CTL, ALT, and SHIFT, and a console key. -// Press the Escape (Esc) key to quit: -// -// You pressed CTL+A (character '☺') -// You pressed C (character 'c') -// You pressed CTL+C (character '♥') -// You pressed K (character 'k') -// You pressed ALT+I (character 'i') -// You pressed ALT+U (character 'u') -// You pressed ALT+SHIFT+H (character 'H') -// You pressed Escape (character 'â†') -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp b/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp deleted file mode 100644 index 074acc11362..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -// This example demonstrates the Console.SetWindowSize method, -// the Console.WindowWidth property, -// and the Console.WindowHeight property. -using namespace System; -int main() -{ - int origWidth; - int width; - int origHeight; - int height; - String^ m1 = "The current window width is {0}, and the " - "current window height is {1}."; - String^ m2 = "The new window width is {0}, and the new " - "window height is {1}."; - String^ m4 = " (Press any key to continue...)"; - - // - // Step 1: Get the current window dimensions. - // - origWidth = Console::WindowWidth; - origHeight = Console::WindowHeight; - Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight ); - Console::WriteLine( m4 ); - Console::ReadKey( true ); - - // - // Step 2: Cut the window to 1/4 its original size. - // - width = origWidth / 2; - height = origHeight / 2; - Console::SetWindowSize( width, height ); - Console::WriteLine( m2, Console::WindowWidth, Console::WindowHeight ); - Console::WriteLine( m4 ); - Console::ReadKey( true ); - - // - // Step 3: Restore the window to its original size. - // - Console::SetWindowSize( origWidth, origHeight ); - Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight ); -} - -/* -This example produces the following results: - -The current window width is 85, and the current window height is 43. - (Press any key to continue...) -The new window width is 42, and the new window height is 21. - (Press any key to continue...) -The current window width is 85, and the current window height is 43. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp b/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp deleted file mode 100644 index 9fd1a51bc1b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -// This example demonstrates the Console.Title property. -using namespace System; -int main() -{ - Console::WriteLine( "The current console title is: \"{0}\"", Console::Title ); - Console::WriteLine( " (Press any key to change the console title.)" ); - Console::ReadKey( true ); - Console::Title = "The title has changed!"; - Console::WriteLine( "Note that the new console title is \"{0}\"\n" - " (Press any key to quit.)", Console::Title ); - Console::ReadKey( true ); -} - -/* -This example produces the following results: - ->myTitle -The current console title is: "Command Prompt - myTitle" - (Press any key to change the console title.) -Note that the new console title is "The title has changed!" - (Press any key to quit.) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp b/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp deleted file mode 100644 index cb5364bab15..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp +++ /dev/null @@ -1,135 +0,0 @@ - -// -// This example demonstrates the Console.WindowLeft and -// Console.WindowTop properties. -using namespace System; -using namespace System::Text; -using namespace System::IO; - -// -int saveBufferWidth; -int saveBufferHeight; -int saveWindowHeight; -int saveWindowWidth; -bool saveCursorVisible; - -// -int main() -{ - String^ m1 = "1) Press the cursor keys to move the console window.\n" - "2) Press any key to begin. When you're finished...\n" - "3) Press the Escape key to quit."; - String^ g1 = "+----"; - String^ g2 = "| "; - String^ grid1; - String^ grid2; - StringBuilder^ sbG1 = gcnew StringBuilder; - StringBuilder^ sbG2 = gcnew StringBuilder; - ConsoleKeyInfo cki; - int y; - - // - try - { - saveBufferWidth = Console::BufferWidth; - saveBufferHeight = Console::BufferHeight; - saveWindowHeight = Console::WindowHeight; - saveWindowWidth = Console::WindowWidth; - saveCursorVisible = Console::CursorVisible; - - // - Console::Clear(); - Console::WriteLine( m1 ); - Console::ReadKey( true ); - - // Set the smallest possible window size before setting the buffer size. - Console::SetWindowSize( 1, 1 ); - Console::SetBufferSize( 80, 80 ); - Console::SetWindowSize( 40, 20 ); - - // Create grid lines to fit the buffer. (The buffer width is 80, but - // this same technique could be used with an arbitrary buffer width.) - for ( y = 0; y < Console::BufferWidth / g1->Length; y++ ) - { - sbG1->Append( g1 ); - sbG2->Append( g2 ); - - } - sbG1->Append( g1, 0, Console::BufferWidth % g1->Length ); - sbG2->Append( g2, 0, Console::BufferWidth % g2->Length ); - grid1 = sbG1->ToString(); - grid2 = sbG2->ToString(); - Console::CursorVisible = false; - Console::Clear(); - for ( y = 0; y < Console::BufferHeight - 1; y++ ) - { - if ( y % 3 == 0 ) - Console::Write( grid1 ); - else - Console::Write( grid2 ); - - } - Console::SetWindowPosition( 0, 0 ); - do - { - cki = Console::ReadKey( true ); - switch ( cki.Key ) - { - case ConsoleKey::LeftArrow: - if ( Console::WindowLeft > 0 ) - Console::SetWindowPosition( Console::WindowLeft - 1, Console::WindowTop ); - break; - - case ConsoleKey::UpArrow: - if ( Console::WindowTop > 0 ) - Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop - 1 ); - break; - - case ConsoleKey::RightArrow: - if ( Console::WindowLeft < (Console::BufferWidth - Console::WindowWidth) ) - Console::SetWindowPosition( Console::WindowLeft + 1, Console::WindowTop ); - break; - - case ConsoleKey::DownArrow: - if ( Console::WindowTop < (Console::BufferHeight - Console::WindowHeight) ) - Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop + 1 ); - break; - } - } - while ( cki.Key != ConsoleKey::Escape ); - } - catch ( IOException^ e ) - { - Console::WriteLine( e->Message ); - } - finally - { - Console::Clear(); - Console::SetWindowSize( 1, 1 ); - Console::SetBufferSize( saveBufferWidth, saveBufferHeight ); - Console::SetWindowSize( saveWindowWidth, saveWindowHeight ); - Console::CursorVisible = saveCursorVisible; - } - -} // end Main - - -/* -This example produces results similar to the following: - -1) Press the cursor keys to move the console window. -2) Press any key to begin. When you're finished... -3) Press the Escape key to quit. - -... - -+----+----+----+- -| | | | -| | | | -+----+----+----+- -| | | | -| | | | -+----+----+----+- - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp b/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp deleted file mode 100644 index b31dd5edc66..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// -// This code example demonstrates the Console.WriteLine() method. -// Formatting for this example uses the "en-US" culture. - -using namespace System; - -public enum class Color {Yellow = 1, Blue, Green}; - -int main() -{ - DateTime thisDate = DateTime::Now; - Console::Clear(); - - // Format a negative integer or floating-point number in various ways. - Console::WriteLine("Standard Numeric Format Specifiers"); - Console::WriteLine( - "(C) Currency: . . . . . . . . {0:C}\n" + - "(D) Decimal:. . . . . . . . . {0:D}\n" + - "(E) Scientific: . . . . . . . {1:E}\n" + - "(F) Fixed point:. . . . . . . {1:F}\n" + - "(G) General:. . . . . . . . . {0:G}\n" + - " (default):. . . . . . . . {0} (default = 'G')\n" + - "(N) Number: . . . . . . . . . {0:N}\n" + - "(P) Percent:. . . . . . . . . {1:P}\n" + - "(R) Round-trip: . . . . . . . {1:R}\n" + - "(X) Hexadecimal:. . . . . . . {0:X}\n", - -123, -123.45f); - - // Format the current date in various ways. - Console::WriteLine("Standard DateTime Format Specifiers"); - Console::WriteLine( - "(d) Short date: . . . . . . . {0:d}\n" + - "(D) Long date:. . . . . . . . {0:D}\n" + - "(t) Short time: . . . . . . . {0:t}\n" + - "(T) Long time:. . . . . . . . {0:T}\n" + - "(f) Full date/short time: . . {0:f}\n" + - "(F) Full date/long time:. . . {0:F}\n" + - "(g) General date/short time:. {0:g}\n" + - "(G) General date/long time: . {0:G}\n" + - " (default):. . . . . . . . {0} (default = 'G')\n" + - "(M) Month:. . . . . . . . . . {0:M}\n" + - "(R) RFC1123:. . . . . . . . . {0:R}\n" + - "(s) Sortable: . . . . . . . . {0:s}\n" + - "(u) Universal sortable: . . . {0:u} (invariant)\n" + - "(U) Universal full date/time: {0:U}\n" + - "(Y) Year: . . . . . . . . . . {0:Y}\n", - thisDate); - - // Format a Color enumeration value in various ways. - Console::WriteLine("Standard Enumeration Format Specifiers"); - Console::WriteLine( - "(G) General:. . . . . . . . . {0:G}\n" + - " (default):. . . . . . . . {0} (default = 'G')\n" + - "(F) Flags:. . . . . . . . . . {0:F} (flags or integer)\n" + - "(D) Decimal number: . . . . . {0:D}\n" + - "(X) Hexadecimal:. . . . . . . {0:X}\n", - Color::Green); - -}; - - -/* -This code example produces the following results: - -Standard Numeric Format Specifiers -(C) Currency: . . . . . . . . ($123.00) -(D) Decimal:. . . . . . . . . -123 -(E) Scientific: . . . . . . . -1.234500E+002 -(F) Fixed point:. . . . . . . -123.45 -(G) General:. . . . . . . . . -123 -(default):. . . . . . . . -123 (default = 'G') -(N) Number: . . . . . . . . . -123.00 -(P) Percent:. . . . . . . . . -12,345.00 % -(R) Round-trip: . . . . . . . -123.45 -(X) Hexadecimal:. . . . . . . FFFFFF85 - -Standard DateTime Format Specifiers -(d) Short date: . . . . . . . 6/26/2004 -(D) Long date:. . . . . . . . Saturday, June 26, 2004 -(t) Short time: . . . . . . . 8:11 PM -(T) Long time:. . . . . . . . 8:11:04 PM -(f) Full date/short time: . . Saturday, June 26, 2004 8:11 PM -(F) Full date/long time:. . . Saturday, June 26, 2004 8:11:04 PM -(g) General date/short time:. 6/26/2004 8:11 PM -(G) General date/long time: . 6/26/2004 8:11:04 PM -(default):. . . . . . . . 6/26/2004 8:11:04 PM (default = 'G') -(M) Month:. . . . . . . . . . June 26 -(R) RFC1123:. . . . . . . . . Sat, 26 Jun 2004 20:11:04 GMT -(s) Sortable: . . . . . . . . 2004-06-26T20:11:04 -(u) Universal sortable: . . . 2004-06-26 20:11:04Z (invariant) -(U) Universal full date/time: Sunday, June 27, 2004 3:11:04 AM -(Y) Year: . . . . . . . . . . June, 2004 - -Standard Enumeration Format Specifiers -(G) General:. . . . . . . . . Green -(default):. . . . . . . . Green (default = 'G') -(F) Flags:. . . . . . . . . . Green (flags or integer) -(D) Decimal number: . . . . . 3 -(X) Hexadecimal:. . . . . . . 00000003 - -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp b/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp deleted file mode 100644 index 528816ff13d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - TextReader^ tIn = Console::In; - TextWriter^ tOut = Console::Out; - tOut->WriteLine( "Hola Mundo!" ); - tOut->Write( "What is your name: " ); - String^ name = tIn->ReadLine(); - tOut->WriteLine( "Buenos Dias, {0}!", name ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp deleted file mode 100644 index a876518582c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -// -// This example demonstrates the Convert.ToBase64CharArray() and -// Convert.FromBase64CharArray methods -using namespace System; -bool ArraysAreEqual( array^a1, array^a2 ); -int main() -{ - array^byteArray1 = gcnew array(256); - array^byteArray2 = gcnew array(256); - array^charArray = gcnew array(352); - int charArrayLength; - String^ nl = Environment::NewLine; - String^ ruler1a = " 1 2 3 4"; - String^ ruler2a = "1234567890123456789012345678901234567890"; - String^ ruler3a = "----+----+----+----+----+----+----+----+"; - String^ ruler1b = " 5 6 7 "; - String^ ruler2b = "123456789012345678901234567890123456"; - String^ ruler3b = "----+----+----+----+----+----+----+-"; - String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b ); - - // 1) Initialize and display a Byte array of arbitrary data. - Console::WriteLine( "1) Input: A Byte array of arbitrary data.{0}", nl ); - for ( int x = 0; x < byteArray1->Length; x++ ) - { - byteArray1[ x ] = (Byte)x; - Console::Write( "{0:X2} ", byteArray1[ x ] ); - if ( ((x + 1) % 20) == 0 ) - Console::WriteLine(); - - } - Console::Write( "{0}{0}", nl ); - - // 2) Convert the input Byte array to a Char array, with newlines inserted. - charArrayLength = Convert::ToBase64CharArray( byteArray1, 0, byteArray1->Length, - charArray, 0, - Base64FormattingOptions::InsertLineBreaks ); - Console::WriteLine( "2) Convert the input Byte array to a Char array with newlines." ); - Console::Write( " Output: A Char array (length = {0}). ", charArrayLength ); - Console::WriteLine( "The elements of the array are:{0}", nl ); - Console::WriteLine( ruler ); - Console::WriteLine( gcnew String( charArray ) ); - Console::WriteLine(); - - // 3) Convert the Char array back to a Byte array. - Console::WriteLine( "3) Convert the Char array to an output Byte array." ); - byteArray2 = Convert::FromBase64CharArray( charArray, 0, charArrayLength ); - - // 4) Are the input and output Byte arrays equivalent? - Console::WriteLine( "4) The output Byte array is equal to the input Byte array: {0}", ArraysAreEqual( byteArray1, byteArray2 ) ); -} - -bool ArraysAreEqual( array^a1, array^a2 ) -{ - if ( a1->Length != a2->Length ) - return false; - - for ( int i = 0; i < a1->Length; i++ ) - if ( a1[ i ] != a2[ i ] ) - return false; - - return true; -} - -/* -This example produces the following results: - -1) Input: A Byte array of arbitrary data. - -00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 -14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 -28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B -3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F -50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 -64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 -78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B -8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F -A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 -B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 -C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB -DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF -F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -2) Convert the input Byte array to a Char array with newlines. - Output: A Char array (length = 352). The elements of the array are: - - 1 2 3 4 5 6 7 -1234567890123456789012345678901234567890123456789012345678901234567890123456 -----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+- -AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4 -OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx -cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq -q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj -5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== - -3) Convert the Char array to an output Byte array. -4) The output Byte array is equal to the input Byte array: True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp deleted file mode 100644 index 316e8eeab95..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp +++ /dev/null @@ -1,113 +0,0 @@ - -// -// This example demonstrates the Convert.ToBase64String() and -// Convert.FromBase64String() methods -using namespace System; -bool ArraysAreEqual( array^a1, array^a2 ); -int main() -{ - array^inArray = gcnew array(256); - array^outArray = gcnew array(256); - String^ s2; - String^ s3; - String^ step1 = "1) The input is a byte array (inArray) of arbitrary data."; - String^ step2 = "2) Convert a subarray of the input data array to a base 64 string."; - String^ step3 = "3) Convert the entire input data array to a base 64 string."; - String^ step4 = "4) The two methods in steps 2 and 3 produce the same result: {0}"; - String^ step5 = "5) Convert the base 64 string to an output byte array (outArray)."; - String^ step6 = "6) The input and output arrays, inArray and outArray, are equal: {0}"; - int x; - String^ nl = Environment::NewLine; - String^ ruler1a = " 1 2 3 4"; - String^ ruler2a = "1234567890123456789012345678901234567890"; - String^ ruler3a = "----+----+----+----+----+----+----+----+"; - String^ ruler1b = " 5 6 7 "; - String^ ruler2b = "123456789012345678901234567890123456"; - String^ ruler3b = "----+----+----+----+----+----+----+-"; - String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b, nl ); - - // 1) Display an arbitrary array of input data (inArray). The data could be - // derived from user input, a file, an algorithm, etc. - Console::WriteLine( step1 ); - Console::WriteLine(); - for ( x = 0; x < inArray->Length; x++ ) - { - inArray[ x ] = (Byte)x; - Console::Write( "{0:X2} ", inArray[ x ] ); - if ( ((x + 1) % 20) == 0 ) - Console::WriteLine(); - - } - Console::Write( "{0}{0}", nl ); - - // 2) Convert a subarray of the input data to a base64 string. In this case, - // the subarray is the entire input data array. New lines (CRLF) are inserted. - Console::WriteLine( step2 ); - s2 = Convert::ToBase64String( inArray, 0, inArray->Length, Base64FormattingOptions::InsertLineBreaks ); - Console::WriteLine( "{0}{1}{2}{3}", nl, ruler, s2, nl ); - - // 3) Convert the input data to a base64 string. In this case, the entire - // input data array is converted by default. New lines (CRLF) are inserted. - Console::WriteLine( step3 ); - s3 = Convert::ToBase64String( inArray, Base64FormattingOptions::InsertLineBreaks ); - - // 4) Test whether the methods in steps 2 and 3 produce the same result. - Console::WriteLine( step4, s2->Equals( s3 ) ); - - // 5) Convert the base 64 string to an output array (outArray). - Console::WriteLine( step5 ); - outArray = Convert::FromBase64String( s2 ); - - // 6) Is outArray equal to inArray? - Console::WriteLine( step6, ArraysAreEqual( inArray, outArray ) ); -} - -bool ArraysAreEqual( array^a1, array^a2 ) -{ - if ( a1->Length != a2->Length ) - return false; - - for ( int i = 0; i < a1->Length; i++ ) - if ( a1[ i ] != a2[ i ] ) - return false; - - return true; -} - -/* -This example produces the following results: - -1) The input is a byte array (inArray) of arbitrary data. - -00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 -14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 -28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B -3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F -50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 -64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 -78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B -8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F -A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 -B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 -C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB -DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF -F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF - -2) Convert a subarray of the input data array to a base 64 string. - - 1 2 3 4 5 6 7 -1234567890123456789012345678901234567890123456789012345678901234567890123456 -----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+- -AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4 -OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx -cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq -q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj -5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== - -3) Convert the entire input data array to a base 64 string. -4) The two methods in steps 2 and 3 produce the same result: True -5) Convert the base 64 string to an output byte array (outArray). -6) The input and output arrays, inArray and outArray, are equal: True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp b/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp deleted file mode 100644 index 38f78b48eef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -// -using namespace System; - -int main() -{ - Double d = -2.345; - int i = *safe_cast(Convert::ChangeType( d, int::typeid )); - Console::WriteLine( "The double value {0} when converted to an int becomes {1}", d, i ); - String^ s = "12/12/98"; - DateTime dt = *safe_cast(Convert::ChangeType( s, DateTime::typeid )); - Console::WriteLine( "The string value {0} when converted to a Date becomes {1}", s, dt ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp b/snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp deleted file mode 100644 index 486c6233b75..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::IO; - -/// This sample used the EncryptedData class to create a EncryptedData element -/// and write it to an XML file. -int main() -{ - // - // Create a new CipherData object. - CipherData^ cipher = gcnew CipherData(); - // Assign a byte array to be the CipherValue. This is a - // byte array representing encrypted data. - cipher->CipherValue = gcnew array(8); - // - // - // Create a new EncryptedData object. - EncryptedData^ encryptionRoot = gcnew EncryptedData(); - // - //Add an encryption method to the object. - encryptionRoot->Id = "ED"; - encryptionRoot->EncryptionMethod = gcnew EncryptionMethod( - "http://www.w3.org/2001/04/xmlenc#aes128-cbc"); - encryptionRoot->CipherData = cipher; - - //Add key information to the object. - KeyInfo^ keyDetails = gcnew KeyInfo(); - keyDetails->AddClause(gcnew KeyInfoRetrievalMethod("#EK", - "http://www.w3.org/2001/04/xmlenc#EncryptedKey")); - encryptionRoot->KeyInfo = keyDetails; - - // Create new XML document and put encrypted data into it. - XmlDocument^ doc = gcnew XmlDocument(); - XmlElement^ encryptionPropertyElement = - doc->CreateElement("EncryptionProperty", - EncryptedXml::XmlEncNamespaceUrl); - EncryptionProperty^ property = gcnew EncryptionProperty( - encryptionPropertyElement); - encryptionRoot->AddProperty(property); - - // Output the resulting XML information into a file. - String^ path = "test.xml"; - try - { - File::WriteAllText(path, encryptionRoot->GetXml()->OuterXml); - } - catch (IOException^ ex) - { - Console::WriteLine("There was an error writing to {0}", path); - Console::WriteLine(ex->Message); - } - //Console.WriteLine(ed.GetXml().OuterXml); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp deleted file mode 100644 index e1fe39c2ee1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography::Xml; -using namespace System::Xml; -using namespace System::IO; - -/// This sample used the EncryptedData class to create an encrypted data element -/// and write it to an XML file. It demonstrates the use of CipherReference. - -[STAThread] -int main() -{ - - //Create a URI string. - String^ uri = "http://www.woodgrovebank.com/document.xml"; - - // Create a Base64 transform. The input content retrieved from the - // URI should be Base64-decoded before other processing. - Transform^ base64 = gcnew XmlDsigBase64Transform; - - //Create a transform chain and add the transform to it. - TransformChain^ tc = gcnew TransformChain; - tc->Add( base64 ); - - //Create information. - CipherReference ^ reference = gcnew CipherReference( uri,tc ); - - // Create a new CipherData object using the CipherReference information. - // Note that you cannot assign both a CipherReference and a CipherValue - // to a CipherData object. - CipherData ^ cd = gcnew CipherData( reference ); - - // Create a new EncryptedData object. - EncryptedData^ ed = gcnew EncryptedData; - - //Add an encryption method to the object. - ed->Id = "ED"; - ed->EncryptionMethod = gcnew EncryptionMethod( "http://www.w3.org/2001/04/xmlenc#aes128-cbc" ); - ed->CipherData = cd; - - //Add key information to the object. - KeyInfo^ ki = gcnew KeyInfo; - ki->AddClause( gcnew KeyInfoRetrievalMethod( "#EK","http://www.w3.org/2001/04/xmlenc#EncryptedKey" ) ); - ed->KeyInfo = ki; - - // Create new XML document and put encrypted data into it. - XmlDocument^ doc = gcnew XmlDocument; - XmlElement^ encryptionPropertyElement = dynamic_cast(doc->CreateElement( "EncryptionProperty", EncryptedXml::XmlEncNamespaceUrl )); - EncryptionProperty ^ ep = gcnew EncryptionProperty( encryptionPropertyElement ); - ed->AddProperty( ep ); - - // Output the resulting XML information into a file. - try - { - String^ path = "c:\\test\\MyTest.xml"; - File::WriteAllText( path, ed->GetXml()->OuterXml ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "File IO error. {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp b/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp deleted file mode 100644 index a13819251ee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography::Xml; -using namespace System::Xml; -using namespace System::IO; - -/// This sample used the EncryptedData class to create a EncryptedData element -/// and write it to an XML file. - -[STAThread] -int main() -{ - - // - // - // Create a new CipherData object using a byte array to represent encrypted data. - array^sampledata = gcnew array(8); - CipherData ^ cd = gcnew CipherData( sampledata ); - - // - // Create a new EncryptedData object. - EncryptedData^ ed = gcnew EncryptedData; - - //Add an encryption method to the object. - ed->Id = "ED"; - ed->EncryptionMethod = gcnew EncryptionMethod( "http://www.w3.org/2001/04/xmlenc#aes128-cbc" ); - ed->CipherData = cd; - - // - // - //Add key information to the object. - KeyInfo^ ki = gcnew KeyInfo; - ki->AddClause( gcnew KeyInfoRetrievalMethod( "#EK","http://www.w3.org/2001/04/xmlenc#EncryptedKey" ) ); - ed->KeyInfo = ki; - - // - // Create new XML document and put encrypted data into it. - XmlDocument^ doc = gcnew XmlDocument; - XmlElement^ encryptionPropertyElement = dynamic_cast(doc->CreateElement( "EncryptionProperty", EncryptedXml::XmlEncNamespaceUrl )); - EncryptionProperty ^ ep = gcnew EncryptionProperty( encryptionPropertyElement ); - ed->AddProperty( ep ); - - // Output the resulting XML information into a file. Change the path variable to point to a directory where - // the XML file should be written. - String^ path = "c:\\test\\MyTest.xml"; - File::WriteAllText( path, ed->GetXml()->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp b/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp deleted file mode 100644 index 1e507f938a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -// This example demonstrates the DateTime(Int64) constructor. -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Instead of using the implicit, default "G" date and time format string, we - // use a custom format string that aligns the results and inserts leading zeroes. - String^ format = "{0}) The {1} date and time is {2:MM/dd/yyyy hh:mm:ss tt}"; - - // Create a DateTime for the maximum date and time using ticks. - DateTime dt1 = DateTime(DateTime::MaxValue.Ticks); - - // Create a DateTime for the minimum date and time using ticks. - DateTime dt2 = DateTime(DateTime::MinValue.Ticks); - - // Create a custom DateTime for 7/28/1979 at 10:35:05 PM using a - // calendar based on the "en-US" culture, and ticks. - Int64 ticks = DateTime(1979,07,28,22,35,5,(gcnew CultureInfo( "en-US",false ))->Calendar).Ticks; - DateTime dt3 = DateTime(ticks); - Console::WriteLine( format, 1, "maximum", dt1 ); - Console::WriteLine( format, 2, "minimum", dt2 ); - Console::WriteLine( format, 3, "custom ", dt3 ); - Console::WriteLine( "\nThe custom date and time is created from {0:N0} ticks.", ticks ); -} - -/* -This example produces the following results: - -1) The maximum date and time is 12/31/9999 11:59:59 PM -2) The minimum date and time is 01/01/0001 12:00:00 AM -3) The custom date and time is 07/28/1979 10:35:05 PM - -The custom date and time is created from 624,376,461,050,000,000 ticks. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp deleted file mode 100644 index ab6a5a558b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Create a reference to a directory. - DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); - - // Create the directory only if it does not already exist. - if ( !di->Exists ) - di->Create(); - - - // Create a subdirectory in the directory just created. - DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); - - // Process that directory as required. - // ... - // Delete the subdirectory. - dis->Delete( true ); - - // Delete the directory. - di->Delete( true ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp deleted file mode 100644 index 26deda48521..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Make a reference to a directory. - DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); - - // Create the directory only if it does not already exist. - if ( !di->Exists ) - di->Create(); - - - // Create a subdirectory in the directory just created. - DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); - - // Process that directory as required. - // ... - // Delete the subdirectory. The true indicates that if subdirectories - // or files are in this directory, they are to be deleted as well. - dis->Delete( true ); - - // Delete the directory. - di->Delete( true ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp deleted file mode 100644 index e9e232e4458..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Make a reference to a directory. - DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" ); - - // Get a reference to each directory in that directory. - array^diArr = di->GetDirectories(); - - // Display the names of the directories. - Collections::IEnumerator^ myEnum = diArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DirectoryInfo^ dri = safe_cast(myEnum->Current); - Console::WriteLine( dri->Name ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp deleted file mode 100644 index 3acf01cd274..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Make a reference to a directory. - DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); - - // Create the directory only if it does not already exist. - if ( !di->Exists ) - di->Create(); - - - // Create a subdirectory in the directory just created. - DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); - - // Move the main directory. Note that the contents move with the directory. - if ( !Directory::Exists( "NewTempDir" ) ) - di->MoveTo( "NewTempDir" ); - - try - { - - // Attempt to delete the subdirectory. Note that because it has been - // moved, an exception is thrown. - dis->Delete( true ); - } - catch ( Exception^ ) - { - - // Handle this exception in some way, such as with the following code: - // Console::WriteLine(S"That directory does not exist."); - } - - - // Point the DirectoryInfo reference to the new directory. - //di = new DirectoryInfo(S"NewTempDir"); - // Delete the directory. - //di->Delete(true); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp deleted file mode 100644 index 73ca8a192a8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Make a reference to a directory. - DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); - - // Create the directory only if it does not already exist. - if ( !di->Exists ) - di->Create(); - - - // Create a subdirectory in the directory just created. - DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); - - // Get a reference to the parent directory of the subdirectory you just made. - DirectoryInfo^ parentDir = dis->Parent; - Console::WriteLine( "The parent directory of '{0}' is '{1}'", dis->Name, parentDir->Name ); - - // Delete the parent directory. - di->Delete( true ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp b/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp deleted file mode 100644 index a798bc4a24c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// Sample for Enum::ToString(String) - -using namespace System; - -public enum class Colors -{ - Red, Green, Blue, Yellow = 12 -}; - -int main() -{ - Colors myColor = Colors::Yellow; - Console::WriteLine( "Colors::Red = {0}", Colors::Red.ToString( "d" ) ); - Console::WriteLine( "Colors::Green = {0}", Colors::Green.ToString( "d" ) ); - Console::WriteLine( "Colors::Blue = {0}", Colors::Blue.ToString( "d" ) ); - Console::WriteLine( "Colors::Yellow = {0}", Colors::Yellow.ToString( "d" ) ); - Console::WriteLine( " {0}myColor = Colors::Yellow {0}", Environment::NewLine ); - Console::WriteLine( "myColor->ToString(\"g\") = {0}", myColor.ToString( "g" ) ); - Console::WriteLine( "myColor->ToString(\"G\") = {0}", myColor.ToString( "G" ) ); - Console::WriteLine( "myColor->ToString(\"x\") = {0}", myColor.ToString( "x" ) ); - Console::WriteLine( "myColor->ToString(\"X\") = {0}", myColor.ToString( "X" ) ); - Console::WriteLine( "myColor->ToString(\"d\") = {0}", myColor.ToString( "d" ) ); - Console::WriteLine( "myColor->ToString(\"D\") = {0}", myColor.ToString( "D" ) ); - Console::WriteLine( "myColor->ToString(\"f\") = {0}", myColor.ToString( "f" ) ); - Console::WriteLine( "myColor->ToString(\"F\") = {0}", myColor.ToString( "F" ) ); -} - -/* -This example produces the following results: -Colors::Red = 0 -Colors::Green = 1 -Colors::Blue = 2 -Colors::Yellow = 12 - -myColor = Colors::Yellow - -myColor->ToString("g") = Yellow -myColor->ToString("G") = Yellow -myColor->ToString("x") = 0000000C -myColor->ToString("X") = 0000000C -myColor->ToString("d") = 12 -myColor->ToString("D") = 12 -myColor->ToString("f") = Yellow -myColor->ToString("F") = Yellow -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp b/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp deleted file mode 100644 index 8d067455708..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; - -public enum class VehicleDoors -{ - Motorbike = 0, - Sportscar = 2, - Sedan = 4, - Hatchback = 5 -}; - -int main() -{ - VehicleDoors myVeh = VehicleDoors::Sportscar; - VehicleDoors yourVeh = VehicleDoors::Motorbike; - VehicleDoors otherVeh = VehicleDoors::Sedan; - Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, yourVeh ); - Int32 iRes = myVeh.CompareTo( yourVeh ); - Console::WriteLine( "{0}{1}", iRes > 0 ? (String^)"Yes" : "No", Environment::NewLine ); - Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, otherVeh ); - iRes = myVeh.CompareTo( otherVeh ); - Console::WriteLine( "{0}", iRes > 0 ? (String^)"Yes" : "No" ); -} -// The example displays the following output: -// Does a Sportscar have more doors than a Motorbike? -// Yes -// -// Does a Sportscar have more doors than a Sedan? -// No -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp b/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp deleted file mode 100644 index 2c8b0fb26db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -public enum class Colors -{ - Red, Green, Blue, Yellow -}; - -public enum class Mammals -{ - Cat, Dog, Horse, Dolphin -}; - -int main() -{ - Mammals myPet = Mammals::Cat; - Colors myColor = Colors::Red; - Mammals yourPet = Mammals::Dog; - Colors yourColor = Colors::Red; - Console::WriteLine( "My favorite animal is a {0}", myPet ); - Console::WriteLine( "Your favorite animal is a {0}", yourPet ); - Console::WriteLine( "Do we like the same animal? {0}", myPet.Equals( yourPet ) ? (String^)"Yes" : "No" ); - Console::WriteLine(); - Console::WriteLine( "My favorite color is {0}", myColor ); - Console::WriteLine( "Your favorite color is {0}", yourColor ); - Console::WriteLine( "Do we like the same color? {0}", myColor.Equals( yourColor ) ? (String^)"Yes" : "No" ); - Console::WriteLine(); - Console::WriteLine( "The value of my color ({0}) is {1}", myColor, Enum::Format( Colors::typeid, myColor, "d" ) ); - Console::WriteLine( "The value of my pet (a {0}) is {1}", myPet, Enum::Format( Mammals::typeid, myPet, "d" ) ); - Console::WriteLine( "Even though they have the same value, are they equal? {0}", myColor.Equals( myPet ) ? (String^)"Yes" : "No" ); -} -// The example displays the following output: -// My favorite animal is a Cat -// Your favorite animal is a Dog -// Do we like the same animal? No -// -// My favorite color is Red -// Your favorite color is Red -// Do we like the same color? Yes -// -// The value of my color (Red) is 0 -// The value of my pet (a Cat) is 0 -// Even though they have the same value, are they equal? No -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp b/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp deleted file mode 100644 index 1176bcd60d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -public enum class Colors -{ - Red, Green, Blue, Yellow -}; - -int main() -{ - Colors myColor = Colors::Blue; - Console::WriteLine( "My favorite color is {0}.", myColor ); - Console::WriteLine( "The value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "d" ) ); - Console::WriteLine( "The hex value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "x" ) ); -} -// The example displays the folowing output: -// My favorite color is Blue. -// The value of my favorite color is 2. -// The hex value of my favorite color is 00000002. -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp deleted file mode 100644 index f5f08936cf6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; - -enum class Colors -{ - Red, Green, Blue, Yellow -}; - -enum class Styles -{ - Plaid, Striped, Tartan, Corduroy -}; - -int main() -{ - Console::WriteLine( "The 4th value of the Colors Enum is {0}", Enum::GetName( Colors::typeid, 3 ) ); - Console::WriteLine( "The 4th value of the Styles Enum is {0}", Enum::GetName( Styles::typeid, 3 ) ); -} -// The example displays the following output: -// The 4th value of the Colors Enum is Yellow -// The 4th value of the Styles Enum is Corduroy -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp deleted file mode 100644 index 5c01de3f879..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -enum class Colors -{ - Red, Green, Blue, Yellow -}; - -enum class Styles -{ - Plaid, Striped, Tartan, Corduroy -}; - -int main() -{ - Console::WriteLine( "The members of the Colors enum are:" ); - Array^ a = Enum::GetNames( Colors::typeid ); - Int32 i = 0; - do - { - Object^ o = a->GetValue( i ); - Console::WriteLine( o->ToString() ); - } - while ( ++i < a->Length ); - - Console::WriteLine(); - Console::WriteLine( "The members of the Styles enum are:" ); - Array^ b = Enum::GetNames( Styles::typeid ); - i = 0; - do - { - Object^ o = b->GetValue( i ); - Console::WriteLine( o->ToString() ); - } - while ( ++i < b->Length ); -} -// The example displays the following output: -// The members of the Colors enum are: -// Red -// Green -// Blue -// Yellow -// -// The members of the Styles enum are: -// Plaid -// Striped -// Tartan -// Corduroy -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp deleted file mode 100644 index 69416cafd99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -enum class Colors -{ - Red, Green, Blue, Yellow -}; - -enum class Styles -{ - Plaid = 0, - Striped = 23, - Tartan = 65, - Corduroy = 78 -}; - -int main() -{ - Console::WriteLine( "The values of the Colors Enum are:" ); - Array^ a = Enum::GetValues( Colors::typeid ); - for ( Int32 i = 0; i < a->Length; i++ ) - { - Object^ o = a->GetValue( i ); - Console::WriteLine( "{0}", Enum::Format( Colors::typeid, o, "D" ) ); - } - Console::WriteLine(); - Console::WriteLine( "The values of the Styles Enum are:" ); - Array^ b = Enum::GetValues( Styles::typeid ); - for ( Int32 i = 0; i < b->Length; i++ ) - { - Object^ o = b->GetValue( i ); - Console::WriteLine( "{0}", Enum::Format( Styles::typeid, o, "D" ) ); - - } -} -// The example produces the following output: -// The values of the Colors Enum are: -// 0 -// 1 -// 2 -// 3 -// -// The values of the Styles Enum are: -// 0 -// 23 -// 65 -// 78 -// diff --git a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp b/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp deleted file mode 100644 index a5fc6c7c51d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; - -[Flags] -enum class Colors -{ - Red = 1, - Green = 2, - Blue = 4, - Yellow = 8 -}; - -int main() -{ - Console::WriteLine( "The entries of the Colors enumeration are:" ); - Array^ a = Enum::GetNames( Colors::typeid ); - Int32 i = 0; - while ( i < a->Length ) - { - Object^ o = a->GetValue( i ); - Console::WriteLine( o->ToString() ); - i++; - } - - Console::WriteLine(); - Object^ orange = Enum::Parse( Colors::typeid, "Red, Yellow" ); - Console::WriteLine("The orange value has the combined entries of {0}", orange ); -} - -/* -This code example produces the following results: - -The entries of the Colors Enum are: -Red -Green -Blue -Yellow - -The orange value has the combined entries of Red, Yellow - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp b/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp deleted file mode 100644 index d8cae622055..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -using namespace System; - -int main() -{ - Console::WriteLine(); - - // Invoke this sample with an arbitrary set of command line arguments. - Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); -} -/* -The example displays output like the following: - -C:\>env0 ARBITRARY TEXT - -CommandLine: env0 ARBITRARY TEXT -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp deleted file mode 100644 index 8da45abecdb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -// Sample for the Environment::ExpandEnvironmentVariables method -using namespace System; -int main() -{ - String^ str; - String^ nl = Environment::NewLine; - Console::WriteLine(); - - // <-- Keep this information secure! --> - String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%"; - str = Environment::ExpandEnvironmentVariables( query ); - Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str ); -} - -/* -This example produces the following results: - -ExpandEnvironmentVariables: -My system drive is C: and my system root is C:\WINNT -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp b/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp deleted file mode 100644 index 3da3cc965d5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -// -// Sample for Environment class summary -using namespace System; -using namespace System::Collections; -int main() -{ - String^ str; - String^ nl = Environment::NewLine; - - // - Console::WriteLine(); - Console::WriteLine( "-- Environment members --" ); - - // Invoke this sample with an arbitrary set of command line arguments. - Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); - array^arguments = Environment::GetCommandLineArgs(); - Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) ); - - // <-- Keep this information secure! --> - Console::WriteLine( "CurrentDirectory: {0}", Environment::CurrentDirectory ); - Console::WriteLine( "ExitCode: {0}", Environment::ExitCode ); - Console::WriteLine( "HasShutdownStarted: {0}", Environment::HasShutdownStarted ); - - // <-- Keep this information secure! --> - Console::WriteLine( "MachineName: {0}", Environment::MachineName ); - Console::WriteLine( "NewLine: {0} first line {0} second line {0} third line", Environment::NewLine ); - Console::WriteLine( "OSVersion: {0}", Environment::OSVersion ); - Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); - - // <-- Keep this information secure! --> - Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory ); - Console::WriteLine( "TickCount: {0}", Environment::TickCount ); - - // <-- Keep this information secure! --> - Console::WriteLine( "UserDomainName: {0}", Environment::UserDomainName ); - Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive ); - - // <-- Keep this information secure! --> - Console::WriteLine( "UserName: {0}", Environment::UserName ); - Console::WriteLine( "Version: {0}", Environment::Version ); - Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet ); - - // No example for Exit(exitCode) because doing so would terminate this example. - // <-- Keep this information secure! --> - String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%"; - str = Environment::ExpandEnvironmentVariables( query ); - Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str ); - Console::WriteLine( "GetEnvironmentVariable: {0} My temporary directory is {1}.", nl, Environment::GetEnvironmentVariable( "TEMP" ) ); - Console::WriteLine( "GetEnvironmentVariables: " ); - IDictionary^ environmentVariables = Environment::GetEnvironmentVariables(); - IEnumerator^ myEnum = environmentVariables->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(myEnum->Current); - Console::WriteLine( " {0} = {1}", de->Key, de->Value ); - } - - Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) ); - array^drives = Environment::GetLogicalDrives(); - Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) ); -} - -/* -This example produces results similar to the following: -(Any result that is lengthy or reveals information that should remain -secure has been omitted and marked S"!---OMITTED---!".) - -C:\>env0 ARBITRARY TEXT - --- Environment members -- -CommandLine: env0 ARBITRARY TEXT -GetCommandLineArgs: env0, ARBITRARY, TEXT -CurrentDirectory: C:\Documents and Settings\!---OMITTED---! -ExitCode: 0 -HasShutdownStarted: False -MachineName: !---OMITTED---! -NewLine: - first line - second line - third line -OSVersion: Microsoft Windows NT 5.1.2600.0 -StackTrace: ' at System::Environment::GetStackTrace(Exception e) - at System::Environment::GetStackTrace(Exception e) - at System::Environment::get_StackTrace() - at Sample::Main()' -SystemDirectory: C:\WINNT\System32 -TickCount: 17995355 -UserDomainName: !---OMITTED---! -UserInteractive: True -UserName: !---OMITTED---! -Version: !---OMITTED---! -WorkingSet: 5038080 -ExpandEnvironmentVariables: - My system drive is C: and my system root is C:\WINNT -GetEnvironmentVariable: - My temporary directory is C:\DOCUME~1\!---OMITTED---!\LOCALS~1\Temp. -GetEnvironmentVariables: - !---OMITTED---! -GetFolderPath: C:\WINNT\System32 -GetLogicalDrives: A:\, C:\, D:\ - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp b/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp deleted file mode 100644 index 8a06d998c6d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// This example demonstrates the -// Environment.ProcessorCount property. -using namespace System; -int main() -{ - Console::WriteLine( "The number of processors on this computer is {0}.", Environment::ProcessorCount ); -} - -/* -This example produces the following results: - -The number of processors on this computer is 1. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp deleted file mode 100644 index becae48d9ab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -// System.Diagnostics.EventLogInstaller -// The following example demonstrates the EventLogInstaller class. -// It defines the instance SampleEventLogInstaller with the -// attribute RunInstallerAttribute. -// -// The Log and Source properties of the new instance are set, -// along with the new resource file properties, -// and the instance is added to the collection of installers -// to be run during an installation. -// -// Note: -// 1) Run this program using the following command: -// InstallUtil.exe -// 2) Uninstall the event log created in step 1 using the -// following command: -// InstallUtil.exe /u -// -#using -#using - -using namespace System; -using namespace System::Configuration::Install; -using namespace System::Diagnostics; -using namespace System::ComponentModel; - -[RunInstaller(true)] -public ref class SampleEventLogInstaller : public Installer -{ -private: - EventLogInstaller^ myEventLogInstaller; - -public: - SampleEventLogInstaller() - { - - // Create an instance of an EventLogInstaller. - myEventLogInstaller = gcnew EventLogInstaller; - - // Set the source name of the event log. - myEventLogInstaller->Source = "ApplicationEventSource"; - - // Set the event log into which the source writes entries. - //myEventLogInstaller.Log = "MyCustomLog"; - myEventLogInstaller->Log = "myNewLog"; - - // Set the resource file for the event log. - // The message strings are defined in EventLogMsgs.mc; the message - // identifiers used in the application must match those defined in the - // corresponding message resource file. The messages must be built - // into a Win32 resource library and copied to the target path on the - // system. - myEventLogInstaller->CategoryResourceFile = - Environment::SystemDirectory + "\\eventlogmsgs.dll"; - myEventLogInstaller->CategoryCount = 3; - myEventLogInstaller->MessageResourceFile = - Environment::SystemDirectory + "\\eventlogmsgs.dll"; - myEventLogInstaller->ParameterResourceFile = - Environment::SystemDirectory + "\\eventlogmsgs.dll"; - - // Add myEventLogInstaller to the installer collection. - Installers->Add( myEventLogInstaller ); - } - -}; - -int main() -{ - Console::WriteLine( "Usage: InstallUtil.exe [.exe | .dll]" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp deleted file mode 100644 index 7bfe2badf7e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp +++ /dev/null @@ -1,277 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -void CleanUp(); -void CreateEventSourceSample1( String^ messageFile ); -void WriteEventSample1(); -void WriteEventSample2(); -void EventInstanceSamples(); - -// -// The following constants match the message definitions -// in the message resource file. They are used to specify -// the resource identifier for a localized string in the -// message resource file. -// The message resource file is an .mc file built into a -// Win32 resource file using the message compiler (MC) tool. -// -const short InstallCategoryMsgId = 1; -const short QueryCategoryMsgId = 2; -const short RefreshCategoryMsgId = 3; -const short CategoryCount = 3; - -// -// -// Define the resource identifiers for the event messages. -// Resource identifiers combine the message ID and the severity field. -const long AuditSuccessMsgId = 1000; -const long AuditFailedMsgId = 1001 + 0x80000000; -const long InformationMsgId = 1002; -const long WarningMsgId = 1003 + 0x80000000; -const long UpdateCycleCompleteMsgId = 1004; -const long ServerConnectionDownMsgId = 1005 + 0x80000000; - -// -// -const long DisplayNameMsgId = 5001; -const long ServiceNameMsgId = 5002; - -// -// - -[STAThread] -int main() -{ - array^args = Environment::GetCommandLineArgs(); - String^ messageFile; - if ( args->Length > 1 ) - { - - // Use the input argument as the message resource file. - messageFile = args[ 1 ]; - } - else - { - - // Use the default message dll. - messageFile = String::Format( "{0}\\{1}", System::Environment::CurrentDirectory, "EventLogMsgs.dll" ); - } - - CleanUp(); - CreateEventSourceSample1( messageFile ); - WriteEventSample1(); - WriteEventSample2(); - EventInstanceSamples(); -} - -void CleanUp() -{ - String^ sourceName = "SampleApplicationSource"; - - // Delete the event source in order to re-register - // the source with the latest configuration properties. - if ( EventLog::SourceExists( sourceName ) ) - { - Console::WriteLine( "Deleting event source {0}.", sourceName ); - EventLog::DeleteEventSource( sourceName ); - } -} -// -void CreateEventSourceSample1( String^ messageFile ) -{ - String^ myLogName; - String^ sourceName = "SampleApplicationSource"; - - // Create the event source if it does not exist. - if ( !EventLog::SourceExists( sourceName ) ) - { - - // Create a new event source for the custom event log - // named "myNewLog." - myLogName = "myNewLog"; - EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( sourceName,myLogName ); - - // Set the message resource file that the event source references. - // All event resource identifiers correspond to text in this file. - if ( !System::IO::File::Exists( messageFile ) ) - { - Console::WriteLine( "Input message resource file does not exist - {0}", messageFile ); - messageFile = ""; - } - else - { - - // Set the specified file as the resource - // file for message text, category text, and - // message parameter strings. - mySourceData->MessageResourceFile = messageFile; - mySourceData->CategoryResourceFile = messageFile; - mySourceData->CategoryCount = CategoryCount; - mySourceData->ParameterResourceFile = messageFile; - Console::WriteLine( "Event source message resource file set to {0}", messageFile ); - } - - Console::WriteLine( "Registering new source for event log." ); - EventLog::CreateEventSource( mySourceData ); - } - else - { - - // Get the event log corresponding to the existing source. - myLogName = EventLog::LogNameFromSourceName( sourceName, "." ); - } - - - // Register the localized name of the event log. - // For example, the actual name of the event log is "myNewLog," but - // the event log name displayed in the Event Viewer might be - // "Sample Application Log" or some other application-specific - // text. - EventLog^ myEventLog = gcnew EventLog( myLogName,".",sourceName ); - if ( messageFile->Length > 0 ) - { - myEventLog->RegisterDisplayName( messageFile, DisplayNameMsgId ); - } -} -// - -void WriteEventSample1() -{ - // - // Create the event source if it does not exist. - String^ sourceName = "SampleApplicationSource"; - if ( !EventLog::SourceExists( sourceName ) ) - { - - // Call a local method to register the event log source - // for the event log "myNewLog." Use the resource file - // EventLogMsgs.dll in the current directory for message text. - String^ messageFile = String::Format( "{0}\\{1}", System::Environment::CurrentDirectory, "EventLogMsgs.dll" ); - CreateEventSourceSample1( messageFile ); - } - - // Get the event log corresponding to the existing source. - String^ myLogName = EventLog::LogNameFromSourceName( sourceName, "." ); - EventLog^ myEventLog = gcnew EventLog( myLogName,".",sourceName ); - - // Define two audit events. - // The message identifiers correspond to the message text in the - // message resource file defined for the source. - EventInstance ^ myAuditSuccessEvent = gcnew EventInstance( AuditSuccessMsgId,0,EventLogEntryType::SuccessAudit ); - EventInstance ^ myAuditFailEvent = gcnew EventInstance( AuditFailedMsgId,0,EventLogEntryType::FailureAudit ); - - // Insert the method name into the event log message. - array^insertStrings = {"EventLogSamples.WriteEventSample1"}; - - // Write the events to the event log. - myEventLog->WriteEvent( myAuditSuccessEvent, insertStrings ); - - // Append binary data to the audit failure event entry. - array^binaryData = {3,4,5,6}; - myEventLog->WriteEvent( myAuditFailEvent, binaryData, insertStrings ); - - // -} - -void WriteEventSample2() -{ - // - String^ sourceName = "SampleApplicationSource"; - if ( EventLog::SourceExists( sourceName ) ) - { - - // Define an informational event and a warning event. - // The message identifiers correspond to the message text in the - // message resource file defined for the source. - EventInstance ^ myInfoEvent = gcnew EventInstance( InformationMsgId,0,EventLogEntryType::Information ); - EventInstance ^ myWarningEvent = gcnew EventInstance( WarningMsgId,0,EventLogEntryType::Warning ); - - // Insert the method name into the event log message. - array^insertStrings = {"EventLogSamples.WriteEventSample2"}; - - // Write the events to the event log. - EventLog::WriteEvent( sourceName, myInfoEvent, 0 ); - - // Append binary data to the warning event entry. - array^binaryData = {7,8,9,10}; - EventLog::WriteEvent( sourceName, myWarningEvent, binaryData, insertStrings ); - } - else - { - Console::WriteLine( "Warning - event source {0} not registered", sourceName ); - } - // -} - -void EventInstanceSamples() -{ - - // - // Ensure that the source has already been registered using - // EventLogInstaller or EventLog.CreateEventSource. - String^ sourceName = "SampleApplicationSource"; - if ( EventLog::SourceExists( sourceName ) ) - { - // Define an informational event with no category. - // The message identifier corresponds to the message text in the - // message resource file defined for the source. - EventInstance ^ myEvent = gcnew EventInstance( UpdateCycleCompleteMsgId,0 ); - - // Write the event to the event log using the registered source. - EventLog::WriteEvent( sourceName, myEvent, 0 ); - - // Reuse the event data instance for another event entry. - // Set the entry category and message identifiers for - // the appropriate resource identifiers in the resource files - // for the registered source. Set the event type to Warning. - myEvent->CategoryId = RefreshCategoryMsgId; - myEvent->EntryType = EventLogEntryType::Warning; - myEvent->InstanceId = ServerConnectionDownMsgId; - - // Write the event to the event log using the registered source. - // Insert the machine name into the event message text. - array^ss = {Environment::MachineName}; - EventLog::WriteEvent( sourceName, myEvent, ss ); - } - else - { - Console::WriteLine( "Warning - event source {0} not registered", sourceName ); - } - // - // - - // Get the event log corresponding to the existing source. - String^ myLogName = EventLog::LogNameFromSourceName( sourceName, "." ); - - // Find each instance of a specific event log entry in a - // particular event log. - EventLog^ myEventLog = gcnew EventLog( myLogName,"." ); - int count = 0; - Console::WriteLine( "Searching event log entries for the event ID {0}...", ServerConnectionDownMsgId ); - - // Search for the resource ID, display the event text, - // and display the number of matching entries. - System::Collections::IEnumerator^ myEnum = myEventLog->Entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLogEntry^ entry = safe_cast(myEnum->Current); - if ( entry->InstanceId == ServerConnectionDownMsgId ) - { - count++; - Console::WriteLine(); - Console::WriteLine( "Entry ID = {0}", entry->InstanceId ); - Console::WriteLine( "Reported at {0}", entry->TimeWritten ); - Console::WriteLine( "Message text:" ); - Console::WriteLine( "\t{0}", entry->Message ); - } - } - - Console::WriteLine(); - Console::WriteLine( "Found {0} events with ID {1} in event log {2}.", count, ServerConnectionDownMsgId, myLogName ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp b/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp deleted file mode 100644 index d1bc63b6472..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; - -public ref class ThresholdReachedEventArgs : public EventArgs -{ - public: - property int Threshold; - property DateTime TimeReached; -}; - -public ref class Counter -{ - private: - int threshold; - int total; - - public: - Counter() {}; - - Counter(int passedThreshold) - { - threshold = passedThreshold; - } - - void Add(int x) - { - total += x; - if (total >= threshold) { - ThresholdReachedEventArgs^ args = gcnew ThresholdReachedEventArgs(); - args->Threshold = threshold; - args->TimeReached = DateTime::Now; - OnThresholdReached(args); - } - } - - event EventHandler^ ThresholdReached; - - protected: - virtual void OnThresholdReached(ThresholdReachedEventArgs^ e) - { - ThresholdReached(this, e); - } -}; - -public ref class SampleHandler -{ - public: - static void c_ThresholdReached(Object^ sender, ThresholdReachedEventArgs^ e) - { - Console::WriteLine("The threshold of {0} was reached at {1}.", - e->Threshold, e->TimeReached); - Environment::Exit(0); - } -}; - -void main() -{ - Counter^ c = gcnew Counter((gcnew Random())->Next(10)); - c->ThresholdReached += gcnew EventHandler(SampleHandler::c_ThresholdReached); - - Console::WriteLine("press 'a' key to increase total"); - while (Console::ReadKey(true).KeyChar == 'a') { - Console::WriteLine("adding one"); - c->Add(1); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp b/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp deleted file mode 100644 index 57b3be51deb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -void NestedRunTest( bool displayDetails ); // forward declarations -void NestedRoutine1( bool displayDetails ); -void NestedRoutine2( bool displayDetails ); -void RunTest( bool displayDetails ); - -int main() -{ - Console::WriteLine("\nException with some extra information..." ); - RunTest(false); - Console::WriteLine("\nException with all extra information..." ); - RunTest(true); -} - -void RunTest( bool displayDetails ) -{ - try - { - NestedRoutine1( displayDetails ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown." ); - Console::WriteLine( e->Message ); - if ( e->Data != nullptr ) - { - Console::WriteLine( " Extra details:" ); - - for each (DictionaryEntry de in e->Data) - Console::WriteLine(" Key: {0,-20} Value: {1}", - "'" + de.Key->ToString() + "'", de.Value); - } - } -} - -void NestedRoutine1( bool displayDetails ) -{ - try - { - NestedRoutine2( displayDetails ); - } - catch ( Exception^ e ) - { - e->Data[ "ExtraInfo" ] = "Information from NestedRoutine1."; - e->Data->Add( "MoreExtraInfo", "More information from NestedRoutine1." ); - throw; - } -} - -void NestedRoutine2( bool displayDetails ) -{ - Exception^ e = gcnew Exception( "This statement is the original exception message." ); - if ( displayDetails ) - { - String^ s = "Information from NestedRoutine2."; - int i = -903; - DateTime dt = DateTime::Now; - e->Data->Add( "stringInfo", s ); - e->Data[ "IntInfo" ] = i; - e->Data[ "DateTimeInfo" ] = dt; - } - - throw e; -} - -/* -This example produces the following results: - -Exception with some extra information... -An exception was thrown. -This statement is the original exception message. - Extra details: - The key is 'ExtraInfo' and the value is: Information from NestedRoutine1. - The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1. - -Exception with all extra information... -An exception was thrown. -This statement is the original exception message. - Extra details: - The key is 'stringInfo' and the value is: Information from NestedRoutine2. - The key is 'IntInfo' and the value is: -903 - The key is 'DateTimeInfo' and the value is: 11/26/2002 2:12:58 PM - The key is 'ExtraInfo' and the value is: Information from NestedRoutine1. - The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp deleted file mode 100644 index 9006e0e4c6d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Create a writer, ready to add entries to the file. - StreamWriter^ sw = fi->AppendText(); - sw->WriteLine( "Add as many lines as you like..." ); - sw->WriteLine( "Add another line to the output..." ); - sw->Flush(); - sw->Close(); - - // Get the information out of the file and display it. - // Remember that the file might have other lines if it already existed. - StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); - while ( sr->Peek() != -1 ) - Console::WriteLine( sr->ReadLine() ); -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -//Add as many lines as you like... -//Add another line to the output... - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp deleted file mode 100644 index 3b56ad744a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Create a reference to a file, which might or might not exist. - // If it does not exist, it is not yet created. - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Create a writer, ready to add entries to the file. - StreamWriter^ sw = fi->AppendText(); - sw->WriteLine( "Add as many lines as you like..." ); - sw->WriteLine( "Add another line to the output..." ); - sw->Flush(); - sw->Close(); - - // Get the information out of the file and display it. - StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); - Console::WriteLine( "This is the information in the first file:" ); - while ( sr->Peek() != -1 ) - Console::WriteLine( sr->ReadLine() ); - - - // Copy this file to another file. The true parameter specifies - // that the file will be overwritten if it already exists. - FileInfo^ newfi = fi->CopyTo( "newTemp.txt", true ); - - // Get the information out of the new file and display it.* sr = new StreamReader( newfi->OpenRead() ); - Console::WriteLine( "{0}This is the information in the second file:", Environment::NewLine ); - while ( sr->Peek() != -1 ) - Console::WriteLine( sr->ReadLine() ); -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is the information in the first file: -//Add as many lines as you like... -//Add another line to the output... -//This is the information in the second file: -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp deleted file mode 100644 index a5bcc91ed5d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Create a reference to a file. - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Actually create the file. - FileStream^ fs = fi->Create(); - - // Modify the file as required, and then close the file. - fs->Close(); - - // Delete the file. - fi->Delete(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp deleted file mode 100644 index 194a71d29f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Open an existing file, or create a new one. - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Determine the full path of the file just created. - DirectoryInfo^ di = fi->Directory; - - // Figure out what other entries are in that directory. - array^fsi = di->GetFileSystemInfos(); - Console::WriteLine( "The directory '{0}' contains the following files and directories:", di->FullName ); - - // Print the names of all the files and subdirectories of that directory. - Collections::IEnumerator^ myEnum = fsi->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FileSystemInfo^ info = safe_cast(myEnum->Current); - Console::WriteLine( info->Name ); - } -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//The directory 'C:\Visual Studio 2005\release' contains the following files -//and directories: -//fileinfodirectory.exe -//fileinfodirectory.pdb -//newTemp.txt -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp deleted file mode 100644 index bdd66b10555..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Open an existing file, or create a new one. - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Create a writer, ready to add entries to the file. - StreamWriter^ sw = fi->AppendText(); - sw->WriteLine( "This is a new entry to add to the file" ); - sw->WriteLine( "This is yet another line to add..." ); - sw->Flush(); - sw->Close(); - - // Get the information out of the file and display it. - StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); - while ( sr->Peek() != -1 ) - Console::WriteLine( sr->ReadLine() ); -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//This is a new entry to add to the file -//This is yet another line to add... -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp deleted file mode 100644 index e29a987391a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Create a reference to the current directory. - DirectoryInfo^ di = gcnew DirectoryInfo( Environment::CurrentDirectory ); - - // Create an array representing the files in the current directory. - array^fi = di->GetFiles(); - Console::WriteLine( "The following files exist in the current directory:" ); - - // Print out the names of the files in the current directory. - Collections::IEnumerator^ myEnum = fi->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FileInfo^ fiTemp = safe_cast(myEnum->Current); - Console::WriteLine( fiTemp->Name ); - } -} - -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//The following files exist in the current directory: -//fileinfoname.exe -//fileinfoname.pdb -//newTemp.txt -// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp deleted file mode 100644 index 7919473364a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Open an existing file, or create a new one. - FileInfo^ fi = gcnew FileInfo( "temp.txt" ); - - // Open the file just specified such that no one else can use it. - FileStream^ fs = fi->Open( FileMode::OpenOrCreate, FileAccess::ReadWrite, FileShare::None ); - - // Create another reference to the same file. - FileInfo^ nextfi = gcnew FileInfo( "temp.txt" ); - try - { - - // Try opening the same file, which was locked by the previous process. - nextfi->Open( FileMode::OpenOrCreate, FileAccess::Read ); - Console::WriteLine( "The file was not locked, and was opened by a second process." ); - } - catch ( IOException^ ) - { - Console::WriteLine( "The file could not be opened because it was locked by another process." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - - - // Close the file so it can be deleted. - fs->Close(); -} -//This code produces output similar to the following; -//results may vary based on the computer/file structure/etc.: -// -//The file could not be opened because it was locked by another process. -// diff --git a/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp deleted file mode 100644 index feda725012e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Collections::ObjectModel; - -void main() -{ - List^ dinosaurs = gcnew List(); - - dinosaurs->Add("Tyrannosaurus"); - dinosaurs->Add("Amargasaurus"); - dinosaurs->Add("Deinonychus"); - dinosaurs->Add("Compsognathus"); - - ReadOnlyCollection^ readOnlyDinosaurs = - gcnew ReadOnlyCollection(dinosaurs); - - Console::WriteLine(); - for each(String^ dinosaur in readOnlyDinosaurs ) - { - Console::WriteLine(dinosaur); - } - - Console::WriteLine("\nCount: {0}", readOnlyDinosaurs->Count); - - Console::WriteLine("\nContains(\"Deinonychus\"): {0}", - readOnlyDinosaurs->Contains("Deinonychus")); - - Console::WriteLine("\nreadOnlyDinosaurs[3]: {0}", - readOnlyDinosaurs[3]); - - Console::WriteLine("\nIndexOf(\"Compsognathus\"): {0}", - readOnlyDinosaurs->IndexOf("Compsognathus")); - - Console::WriteLine("\nInsert into the wrapped List:"); - Console::WriteLine("Insert(2, \"Oviraptor\")"); - dinosaurs->Insert(2, "Oviraptor"); - - Console::WriteLine(); - for each( String^ dinosaur in readOnlyDinosaurs ) - { - Console::WriteLine(dinosaur); - } - - array^ dinoArray = - gcnew array(readOnlyDinosaurs->Count + 2); - readOnlyDinosaurs->CopyTo(dinoArray, 1); - - Console::WriteLine("\nCopied array has {0} elements:", - dinoArray->Length); - for each( String^ dinosaur in dinoArray ) - { - Console::WriteLine("\"{0}\"", dinosaur); - } -} - -/* This code example produces the following output: - -Tyrannosaurus -Amargasaurus -Deinonychus -Compsognathus - -Count: 4 - -Contains("Deinonychus"): True - -readOnlyDinosaurs[3]: Compsognathus - -IndexOf("Compsognathus"): 3 - -Insert into the wrapped List: -Insert(2, "Oviraptor") - -Tyrannosaurus -Amargasaurus -Oviraptor -Deinonychus -Compsognathus - -Copied array has 7 elements: -"" -"Tyrannosaurus" -"Amargasaurus" -"Oviraptor" -"Deinonychus" -"Compsognathus" -"" - */ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp b/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp deleted file mode 100644 index 66e8c71ecbd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// This example demonstrates Math.Atan() -// Math.Atan2() -// Math.Tan() -using namespace System; -int main() -{ - double x = 1.0; - double y = 2.0; - double angle; - double radians; - double result; - - // Calculate the tangent of 30 degrees. - angle = 30; - radians = angle * (Math::PI / 180); - result = Math::Tan( radians ); - Console::WriteLine( "The tangent of 30 degrees is {0}.", result ); - - // Calculate the arctangent of the previous tangent. - radians = Math::Atan( result ); - angle = radians * (180 / Math::PI); - Console::WriteLine( "The previous tangent is equivalent to {0} degrees.", angle ); - - // Calculate the arctangent of an angle. - String^ line1 = "{0}The arctangent of the angle formed by the x-axis and "; - String^ line2 = "a vector to point ({0},{1}) is {2}, "; - String^ line3 = "which is equivalent to {0} degrees."; - radians = Math::Atan2( y, x ); - angle = radians * (180 / Math::PI); - Console::WriteLine( line1, Environment::NewLine ); - Console::WriteLine( line2, x, y, radians ); - Console::WriteLine( line3, angle ); -} - -/* -This example produces the following results: - -The tangent of 30 degrees is 0.577350269189626. -The previous tangent is equivalent to 30 degrees. - -The arctangent of the angle formed by the x-axis and -a vector to point (1,2) is 1.10714871779409, -which is equivalent to 63.434948822922 degrees. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp b/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp deleted file mode 100644 index ce21aac3d31..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -// This example demonstrates Math.BigMul() -using namespace System; -int main() -{ - int int1 = Int32::MaxValue; - int int2 = Int32::MaxValue; - Int64 longResult; - - // - longResult = Math::BigMul( int1, int2 ); - Console::WriteLine( "Calculate the product of two Int32 values:" ); - Console::WriteLine( "{0} * {1} = {2}", int1, int2, longResult ); -} - -/* -This example produces the following results: -Calculate the product of two Int32 values: -2147483647 * 2147483647 = 4611686014132420609 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp b/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp deleted file mode 100644 index 30f8d543207..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// This example demonstrates Math.Max() -using namespace System; -int main() -{ - String^ str = "{0}: The greater of {1,3} and {2,3} is {3}."; - String^ nl = Environment::NewLine; - Byte xByte1 = 1,xByte2 = 51; - short xShort1 = -2,xShort2 = 52; - int xInt1 = -3,xInt2 = 53; - long xLong1 = -4,xLong2 = 54; - float xSingle1 = 5.0f,xSingle2 = 55.0f; - double xDouble1 = 6.0,xDouble2 = 56.0; - Decimal xDecimal1 = 7,xDecimal2 = 57; - - // The following types are not CLS-compliant. - SByte xSbyte1 = 101,xSbyte2 = 111; - UInt16 xUshort1 = 102,xUshort2 = 112; - UInt32 xUint1 = 103,xUint2 = 113; - UInt64 xUlong1 = 104,xUlong2 = 114; - Console::WriteLine( "{0}Display the greater of two values:{0}", nl ); - Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Max( xByte1, xByte2 ) ); - Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Max( xShort1, xShort2 ) ); - Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Max( xInt1, xInt2 ) ); - Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Max( xLong1, xLong2 ) ); - Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Max( xSingle1, xSingle2 ) ); - Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Max( xDouble1, xDouble2 ) ); - Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Max( xDecimal1, xDecimal2 ) ); - - // - Console::WriteLine( "{0}The following types are not CLS-compliant.{0}", nl ); - Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Max( xSbyte1, xSbyte2 ) ); - Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Max( xUshort1, xUshort2 ) ); - Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Max( xUint1, xUint2 ) ); - Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Max( xUlong1, xUlong2 ) ); -} - -/* -This example produces the following results: - -Display the greater of two values: - -Byte : The greater of 1 and 51 is 51. -Int16 : The greater of -2 and 52 is 52. -Int32 : The greater of -3 and 53 is 53. -Int64 : The greater of -4 and 54 is 54. -Single : The greater of 5 and 55 is 55. -Double : The greater of 6 and 56 is 56. -Decimal: The greater of 7 and 57 is 57. - -(The following types are not CLS-compliant.) - -SByte : The greater of 101 and 111 is 111. -UInt16 : The greater of 102 and 112 is 112. -UInt32 : The greater of 103 and 113 is 113. -UInt64 : The greater of 104 and 114 is 114. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp b/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp deleted file mode 100644 index fe4036cee2d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// This example demonstrates Math.Min() -using namespace System; -int main() -{ - String^ str = "{0}: The lesser of {1,3} and {2,3} is {3}."; - String^ nl = Environment::NewLine; - Byte xByte1 = 1,xByte2 = 51; - short xShort1 = -2,xShort2 = 52; - int xInt1 = -3,xInt2 = 53; - long xLong1 = -4,xLong2 = 54; - float xSingle1 = 5.0f,xSingle2 = 55.0f; - double xDouble1 = 6.0,xDouble2 = 56.0; - Decimal xDecimal1 = 7,xDecimal2 = 57; - - // The following types are not CLS-compliant. - SByte xSbyte1 = 101,xSbyte2 = 111; - UInt16 xUshort1 = 102,xUshort2 = 112; - UInt32 xUint1 = 103,xUint2 = 113; - UInt64 xUlong1 = 104,xUlong2 = 114; - Console::WriteLine( "{0}Display the lesser of two values:{0}", nl ); - Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Min( xByte1, xByte2 ) ); - Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Min( xShort1, xShort2 ) ); - Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Min( xInt1, xInt2 ) ); - Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Min( xLong1, xLong2 ) ); - Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Min( xSingle1, xSingle2 ) ); - Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Min( xDouble1, xDouble2 ) ); - Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Min( xDecimal1, xDecimal2 ) ); - - // - Console::WriteLine( "{0}The following types are not CLS-compliant:{0}", nl ); - Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Min( xSbyte1, xSbyte2 ) ); - Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Min( xUshort1, xUshort2 ) ); - Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Min( xUint1, xUint2 ) ); - Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Min( xUlong1, xUlong2 ) ); -} - -/* -This example produces the following results: - -Display the lesser of two values: - -Byte : The lesser of 1 and 51 is 1. -Int16 : The lesser of -2 and 52 is -2. -Int32 : The lesser of -3 and 53 is -3. -Int64 : The lesser of -4 and 54 is -4. -Single : The lesser of 5 and 55 is 5. -Double : The lesser of 6 and 56 is 6. -Decimal: The lesser of 7 and 57 is 7. - -The following types are not CLS-compliant: - -SByte : The lesser of 101 and 111 is 101. -UInt16 : The lesser of 102 and 112 is 102. -UInt32 : The lesser of 103 and 113 is 103. -UInt64 : The lesser of 104 and 114 is 104. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp b/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp deleted file mode 100644 index 200dda534ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// This example demonstrates Math.Sign() -using namespace System; -String^ Test( int compare ) -{ - if ( compare == 0 ) - return "equal to"; - else - if ( compare < 0 ) - return "less than"; - else - return "greater than"; -} - -int main() -{ - String^ str = "{0}: {1,3} is {2} zero."; - String^ nl = Environment::NewLine; - Byte xByte1 = 0; - short xShort1 = -2; - int xInt1 = -3; - long xLong1 = -4; - float xSingle1 = 0.0f; - double xDouble1 = 6.0; - Decimal xDecimal1 = -7; - - // The following type is not CLS-compliant. - SByte xSbyte1 = -101; - Console::WriteLine( "{0}Test the sign of the following types of values:", nl ); - Console::WriteLine( str, "Byte ", xByte1, Test( Math::Sign( xByte1 ) ) ); - Console::WriteLine( str, "Int16 ", xShort1, Test( Math::Sign( xShort1 ) ) ); - Console::WriteLine( str, "Int32 ", xInt1, Test( Math::Sign( xInt1 ) ) ); - Console::WriteLine( str, "Int64 ", xLong1, Test( Math::Sign( xLong1 ) ) ); - Console::WriteLine( str, "Single ", xSingle1, Test( Math::Sign( xSingle1 ) ) ); - Console::WriteLine( str, "Double ", xDouble1, Test( Math::Sign( xDouble1 ) ) ); - Console::WriteLine( str, "Decimal", xDecimal1, Test( Math::Sign( xDecimal1 ) ) ); - - // - Console::WriteLine( "{0}The following type is not CLS-compliant.", nl ); - Console::WriteLine( str, "SByte ", xSbyte1, Test( Math::Sign( xSbyte1 ) ) ); -} - -/* -This example produces the following results: - -Test the sign of the following types of values: -Byte : 0 is equal to zero. -Int16 : -2 is less than zero. -Int32 : -3 is less than zero. -Int64 : -4 is less than zero. -Single : 0 is equal to zero. -Double : 6 is greater than zero. -Decimal: -7 is less than zero. - -The following type is not CLS-compliant. -SByte : -101 is less than zero. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp b/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp deleted file mode 100644 index c576f3dc408..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -void CombinePaths( String^ p1, String^ p2 ) -{ - try - { - String^ combination = Path::Combine( p1, p2 ); - Console::WriteLine( "When you combine '{0}' and '{1}', the result is: {2}'{3}'", p1, p2, Environment::NewLine, combination ); - } - catch ( Exception^ e ) - { - if (p1 == nullptr) - p1 = "nullptr"; - if (p2 == nullptr) - p2 = "nullptr"; - Console::WriteLine( "You cannot combine '{0}' and '{1}' because: {2}{3}", p1, p2, Environment::NewLine, e->Message ); - } - - Console::WriteLine(); -} - -int main() -{ - String^ path1 = "c:\\temp"; - String^ path2 = "subdir\\file.txt"; - String^ path3 = "c:\\temp.txt"; - String^ path4 = "c:^*&)(_=@#'\\^.*(.txt"; - String^ path5 = ""; - String^ path6 = nullptr; - CombinePaths( path1, path2 ); - CombinePaths( path1, path3 ); - CombinePaths( path3, path2 ); - CombinePaths( path4, path2 ); - CombinePaths( path5, path2 ); - CombinePaths( path6, path2 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp b/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp deleted file mode 100644 index 0db73927f0c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -// This example demonstrates the PlatformID enumeration. -using namespace System; -int main() -{ - String^ msg1 = L"This is a Windows operating system."; - String^ msg2 = L"This is a Unix operating system."; - String^ msg3 = L"ERROR: This platform identifier is invalid."; - - // Assume this example is run on a Windows operating system. - OperatingSystem^ os = Environment::OSVersion; - PlatformID pid = os->Platform; - switch ( pid ) - { - case PlatformID::Win32NT: - case PlatformID::Win32S: - case PlatformID::Win32Windows: - case PlatformID::WinCE: - Console::WriteLine( msg1 ); - break; - - case PlatformID::Unix: - Console::WriteLine( msg2 ); - break; - - default: - Console::WriteLine( msg3 ); - break; - } - return 1; -} - -/* -This example produces the following results: - -This is a Windows operating system. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp deleted file mode 100644 index ea3629d178b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; -using namespace System::Text; - -ref class StandardAsyncOutputExample -{ -private: - static int lineCount = 0; - static StringBuilder^ output = nullptr; - -public: - static void Run() - { - Process^ process = gcnew Process(); - process->StartInfo->FileName = "ipconfig.exe"; - process->StartInfo->UseShellExecute = false; - process->StartInfo->RedirectStandardOutput = true; - output = gcnew StringBuilder(); - process->OutputDataReceived += gcnew DataReceivedEventHandler(OutputHandler); - process->Start(); - - // Asynchronously read the standard output of the spawned process. - // This raises OutputDataReceived events for each line of output. - process->BeginOutputReadLine(); - process->WaitForExit(); - - // Write the redirected output to this application's window. - Console::WriteLine(output); - - process->WaitForExit(); - process->Close(); - - Console::WriteLine("\n\nPress any key to exit"); - Console::ReadLine(); - } - -private: - static void OutputHandler(Object^ sender, DataReceivedEventArgs^ e) - { - // Prepend line numbers to each line of the output. - if (!String::IsNullOrEmpty(e->Data)) - { - lineCount++; - output->Append("\n[" + lineCount + "]: " + e->Data); - } - } -}; - -int main() -{ - StandardAsyncOutputExample::Run(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp deleted file mode 100644 index 6dc1d4e11d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// System.Diagnostics -// -// Requires .NET Framework version 1.2 or higher. - -// The following example uses the net view command to list the -// available network resources available on a remote computer, -// and displays the results to the console. Specifying the optional -// error log file redirects error output to that file. - -// -// Define the namespaces used by this sample. -#using - -using namespace System; -using namespace System::Text; -using namespace System::Globalization; -using namespace System::IO; -using namespace System::Diagnostics; -using namespace System::Threading; -using namespace System::ComponentModel; - -ref class ProcessNetStreamRedirection -{ -private: - // Define static variables shared by class methods. - static StreamWriter^ streamError = nullptr; - static String^ netErrorFile = ""; - static StringBuilder^ netOutput = nullptr; - static bool errorRedirect = false; - static bool errorsWritten = false; - -public: - static void RedirectNetCommandStreams() - { - String^ netArguments; - Process^ netProcess; - - // Get the input computer name. - Console::WriteLine( "Enter the computer name for the net view command:" ); - netArguments = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); - if ( String::IsNullOrEmpty( netArguments ) ) - { - // Default to the help command if there is not an input argument. - netArguments = "/?"; - } - - // Check if errors should be redirected to a file. - errorsWritten = false; - Console::WriteLine( "Enter a fully qualified path to an error log file" ); - Console::WriteLine( " or just press Enter to write errors to console:" ); - netErrorFile = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); - if ( !String::IsNullOrEmpty( netErrorFile ) ) - { - errorRedirect = true; - } - - // Note that at this point, netArguments and netErrorFile - // are set with user input. If the user did not specify - // an error file, then errorRedirect is set to false. - - // Initialize the process and its StartInfo properties. - netProcess = gcnew Process; - netProcess->StartInfo->FileName = "Net.exe"; - - // Build the net command argument list. - netProcess->StartInfo->Arguments = String::Format( "view {0}", netArguments ); - - // Set UseShellExecute to false for redirection. - netProcess->StartInfo->UseShellExecute = false; - - // Redirect the standard output of the net command. - // This stream is read asynchronously using an event handler. - netProcess->StartInfo->RedirectStandardOutput = true; - netProcess->OutputDataReceived += gcnew DataReceivedEventHandler( NetOutputDataHandler ); - netOutput = gcnew StringBuilder; - if ( errorRedirect ) - { - - // Redirect the error output of the net command. - netProcess->StartInfo->RedirectStandardError = true; - netProcess->ErrorDataReceived += gcnew DataReceivedEventHandler( NetErrorDataHandler ); - } - else - { - - // Do not redirect the error output. - netProcess->StartInfo->RedirectStandardError = false; - } - - Console::WriteLine( "\nStarting process: net {0}", - netProcess->StartInfo->Arguments ); - if ( errorRedirect ) - { - Console::WriteLine( "Errors will be written to the file {0}", netErrorFile ); - } - - // Start the process. - netProcess->Start(); - - // Start the asynchronous read of the standard output stream. - netProcess->BeginOutputReadLine(); - - if ( errorRedirect ) - { - // Start the asynchronous read of the standard - // error stream. - netProcess->BeginErrorReadLine(); - } - - // Let the net command run, collecting the output. - netProcess->WaitForExit(); - - if ( streamError != nullptr ) - { - // Close the error file. - streamError->Close(); - } - else - { - // Set errorsWritten to false if the stream is not - // open. Either there are no errors, or the error - // file could not be opened. - errorsWritten = false; - } - - if ( netOutput->Length > 0 ) - { - // If the process wrote more than just - // white space, write the output to the console. - Console::WriteLine( "\nPublic network shares from net view:\n{0}\n", - netOutput->ToString() ); - } - - if ( errorsWritten ) - { - // Signal that the error file had something - // written to it. - array^errorOutput = File::ReadAllLines( netErrorFile ); - if ( errorOutput->Length > 0 ) - { - Console::WriteLine( "\nThe following error output was appended to {0}.", - netErrorFile ); - System::Collections::IEnumerator^ myEnum = errorOutput->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ errLine = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", errLine ); - } - } - Console::WriteLine(); - } - - netProcess->Close(); - - } - -private: - static void NetOutputDataHandler( Object^ /*sendingProcess*/, - DataReceivedEventArgs^ outLine ) - { - // Collect the net view command output. - if ( !String::IsNullOrEmpty( outLine->Data ) ) - { - // Add the text to the collected output. - netOutput->AppendFormat( "\n {0}", outLine->Data ); - } - } - - static void NetErrorDataHandler( Object^ /*sendingProcess*/, - DataReceivedEventArgs^ errLine ) - { - // Write the error text to the file if there is something to - // write and an error file has been specified. - - if ( !String::IsNullOrEmpty( errLine->Data ) ) - { - if ( !errorsWritten ) - { - if ( streamError == nullptr ) - { - // Open the file. - try - { - streamError = gcnew StreamWriter( netErrorFile,true ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Could not open error file!" ); - Console::WriteLine( e->Message->ToString() ); - } - } - - if ( streamError != nullptr ) - { - // Write a header to the file if this is the first - // call to the error output handler. - streamError->WriteLine(); - streamError->WriteLine( DateTime::Now.ToString() ); - streamError->WriteLine( "Net View error output:" ); - } - errorsWritten = true; - } - - if ( streamError != nullptr ) - { - // Write redirected errors to the file. - streamError->WriteLine( errLine->Data ); - streamError->Flush(); - } - } - } -}; -// - -/// The main entry point for the application. -void main() -{ - try - { - ProcessNetStreamRedirection::RedirectNetCommandStreams(); - } - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( "Exception:" ); - Console::WriteLine( e ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp deleted file mode 100644 index 037704e8279..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp +++ /dev/null @@ -1,258 +0,0 @@ -// System.Diagnostics -// -// Requires .NET Framework version 1.2 or higher. - -// Define the namespaces used by this sample. -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Diagnostics; -using namespace System::Threading; -using namespace System::ComponentModel; - -// -ref class ProcessNMakeStreamRedirection -{ -private: - // Define static variables shared by class methods. - static StreamWriter^ buildLogStream = nullptr; - static Mutex^ logMutex = gcnew Mutex; - static int maxLogLines = 25; - static int currentLogLines = 0; - -public: - static void RedirectNMakeCommandStreams() - { - String^ nmakeArguments = nullptr; - Process^ nmakeProcess; - - // Get the input nmake command-line arguments. - Console::WriteLine( "Enter the NMake command line arguments (@commandfile or /f makefile, etc):" ); - String^ inputText = Console::ReadLine(); - if ( !String::IsNullOrEmpty( inputText ) ) - { - nmakeArguments = inputText; - } - - Console::WriteLine( "Enter max line limit for log file (default is 25):" ); - inputText = Console::ReadLine(); - if ( !String::IsNullOrEmpty( inputText ) ) - { - if ( !Int32::TryParse( inputText, maxLogLines ) ) - { - maxLogLines = 25; - } - } - Console::WriteLine( "Output beyond {0} lines will be ignored.", - maxLogLines.ToString() ); - - // Initialize the process and its StartInfo properties. - nmakeProcess = gcnew Process; - nmakeProcess->StartInfo->FileName = "NMake.exe"; - - // Build the nmake command argument list. - if ( !String::IsNullOrEmpty( nmakeArguments ) ) - { - nmakeProcess->StartInfo->Arguments = nmakeArguments; - } - - // Set UseShellExecute to false for redirection. - nmakeProcess->StartInfo->UseShellExecute = false; - - // Redirect the standard output of the nmake command. - // Read the stream asynchronously using an event handler. - nmakeProcess->StartInfo->RedirectStandardOutput = true; - nmakeProcess->OutputDataReceived += gcnew DataReceivedEventHandler( NMakeOutputDataHandler ); - - // Redirect the error output of the nmake command. - nmakeProcess->StartInfo->RedirectStandardError = true; - nmakeProcess->ErrorDataReceived += gcnew DataReceivedEventHandler( NMakeErrorDataHandler ); - - logMutex->WaitOne(); - - currentLogLines = 0; - - // Write a header to the log file. - String^ buildLogFile = "NmakeCmd.Txt"; - try - { - buildLogStream = gcnew StreamWriter( buildLogFile,true ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Could not open output file {0}", buildLogFile ); - Console::WriteLine( "Exception = {0}", e->ToString() ); - Console::WriteLine( e->Message->ToString() ); - - buildLogStream = nullptr; - } - - if ( buildLogStream != nullptr ) - { - Console::WriteLine( "Nmake output logged to {0}", buildLogFile ); - - buildLogStream->WriteLine(); - buildLogStream->WriteLine( DateTime::Now.ToString() ); - if ( !String::IsNullOrEmpty( nmakeArguments ) ) - { - buildLogStream->Write( "Command line = NMake {0}", nmakeArguments ); - } - else - { - buildLogStream->Write( "Command line = Nmake" ); - } - buildLogStream->WriteLine(); - buildLogStream->Flush(); - - logMutex->ReleaseMutex(); - - // Start the process. - Console::WriteLine(); - Console::WriteLine( "\nStarting Nmake command" ); - Console::WriteLine(); - nmakeProcess->Start(); - - // Start the asynchronous read of the output stream. - nmakeProcess->BeginOutputReadLine(); - - // Start the asynchronous read of the error stream. - nmakeProcess->BeginErrorReadLine(); - - // Let the nmake command run, collecting the output. - nmakeProcess->WaitForExit(); - - nmakeProcess->Close(); - buildLogStream->Close(); - logMutex->Dispose(); - } - } - -private: - static void NMakeOutputDataHandler( Object^ sendingProcess, - DataReceivedEventArgs^ outLine ) - { - // Collect the output, displaying it to the screen and - // logging it to the output file. Cancel the read - // operation when the maximum line limit is reached. - - if ( !String::IsNullOrEmpty( outLine->Data ) ) - { - logMutex->WaitOne(); - - currentLogLines++; - if ( currentLogLines > maxLogLines ) - { - // Display the line to the console. - // Skip writing the line to the log file. - Console::WriteLine( "StdOut: {0}", outLine->Data->ToString() ); - } - else - if ( currentLogLines == maxLogLines ) - { - LogToFile( "StdOut", "", true ); - - // Stop reading the output streams. - Process^ p = dynamic_cast(sendingProcess); - if ( p != nullptr ) - { - p->CancelOutputRead(); - p->CancelErrorRead(); - } - } - else - { - // Write the line to the log file. - LogToFile( "StdOut", outLine->Data, true ); - } - logMutex->ReleaseMutex(); - } - } - - static void NMakeErrorDataHandler( Object^ sendingProcess, - DataReceivedEventArgs^ errLine ) - { - - // Collect the error output, displaying it to the screen and - // logging it to the output file. Cancel the error output - // read operation when the maximum line limit is reached. - - if ( !String::IsNullOrEmpty( errLine->Data ) ) - { - logMutex->WaitOne(); - - currentLogLines++; - if ( currentLogLines > maxLogLines ) - { - - // Display the line to the console. - // Skip writing the line to the log file. - Console::WriteLine( "StdErr: {0}", errLine->Data->ToString() ); - } - else - if ( currentLogLines == maxLogLines ) - { - LogToFile( "StdOut", "", true ); - - // Stop reading the output streams. - Process^ p = dynamic_cast(sendingProcess); - if ( p != nullptr ) - { - p->CancelOutputRead(); - p->CancelErrorRead(); - } - } - else - { - // Write the line to the log file. - LogToFile( "StdErr", errLine->Data, true ); - } - logMutex->ReleaseMutex(); - } - } - - static void LogToFile( String^ logPrefix, String^ logText, - bool echoToConsole ) - { - // Write the specified line to the log file stream. - StringBuilder^ logString = gcnew StringBuilder; - - if ( !String::IsNullOrEmpty( logPrefix ) ) - { - logString->AppendFormat( "{0}> ", logPrefix ); - } - - if ( !String::IsNullOrEmpty( logText ) ) - { - logString->Append( logText ); - } - - if ( buildLogStream != nullptr ) - { - buildLogStream->WriteLine( "[{0}] {1}", - DateTime::Now.ToString(), logString->ToString() ); - buildLogStream->Flush(); - } - - if ( echoToConsole ) - { - Console::WriteLine( logString->ToString() ); - } - } -}; -// - -/// The main entry point for the application. -void main() -{ - try - { - ProcessNMakeStreamRedirection::RedirectNMakeCommandStreams(); - } - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( "Exception:" ); - Console::WriteLine( e ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp deleted file mode 100644 index 87b8730cbc4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp +++ /dev/null @@ -1,136 +0,0 @@ -// System.Diagnostics -// -// Requires .NET Framework version 1.2 or higher. - -// The following example uses the sort command to sort a list -// of input text lines, and displays the sorted list to the console. - -// -// Define the namespaces used by this sample. -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Diagnostics; -using namespace System::Threading; -using namespace System::ComponentModel; - -ref class SortOutputRedirection -{ -private: - // Define static variables shared by class methods. - static StringBuilder^ sortOutput = nullptr; - static int numOutputLines = 0; - -public: - static void SortInputListText() - { - // Initialize the process and its StartInfo properties. - // The sort command is a console application that - // reads and sorts text input. - - Process^ sortProcess; - sortProcess = gcnew Process; - sortProcess->StartInfo->FileName = "Sort.exe"; - - // Set UseShellExecute to false for redirection. - sortProcess->StartInfo->UseShellExecute = false; - - // Redirect the standard output of the sort command. - // This stream is read asynchronously using an event handler. - sortProcess->StartInfo->RedirectStandardOutput = true; - sortOutput = gcnew StringBuilder; - - // Set our event handler to asynchronously read the sort output. - sortProcess->OutputDataReceived += gcnew DataReceivedEventHandler( SortOutputHandler ); - - // Redirect standard input as well. This stream - // is used synchronously. - sortProcess->StartInfo->RedirectStandardInput = true; - - // Start the process. - sortProcess->Start(); - - // Use a stream writer to synchronously write the sort input. - StreamWriter^ sortStreamWriter = sortProcess->StandardInput; - - // Start the asynchronous read of the sort output stream. - sortProcess->BeginOutputReadLine(); - - // Prompt the user for input text lines. Write each - // line to the redirected input stream of the sort command. - Console::WriteLine( "Ready to sort up to 50 lines of text" ); - - String^ inputText; - int numInputLines = 0; - do - { - Console::WriteLine( "Enter a text line (or press the Enter key to stop):" ); - - inputText = Console::ReadLine(); - if ( !String::IsNullOrEmpty( inputText ) ) - { - numInputLines++; - sortStreamWriter->WriteLine( inputText ); - } - } - while ( !String::IsNullOrEmpty( inputText ) && (numInputLines < 50) ); - - Console::WriteLine( "" ); - Console::WriteLine(); - - // End the input stream to the sort command. - sortStreamWriter->Close(); - - // Wait for the sort process to write the sorted text lines. - sortProcess->WaitForExit(); - - if ( numOutputLines > 0 ) - { - - // Write the formatted and sorted output to the console. - Console::WriteLine( " Sort results = {0} sorted text line(s) ", - numOutputLines.ToString() ); - Console::WriteLine( "----------" ); - Console::WriteLine( sortOutput->ToString() ); - } - else - { - Console::WriteLine( " No input lines were sorted." ); - } - - sortProcess->Close(); - } - -private: - static void SortOutputHandler( Object^ /*sendingProcess*/, - DataReceivedEventArgs^ outLine ) - { - // Collect the sort command output. - if ( !String::IsNullOrEmpty( outLine->Data ) ) - { - numOutputLines++; - - // Add the text to the collected output. - sortOutput->AppendFormat( "\n[{0}] {1}", - numOutputLines.ToString(), outLine->Data ); - } - } -}; - -/// The main entry point for the application. -void main() -{ - try - { - SortOutputRedirection::SortInputListText(); - } - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( "Exception:" ); - Console::WriteLine( e ); - } -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp b/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp deleted file mode 100644 index 5289fe8f30b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// System::Diagnostics::Process::Refresh -// System::Diagnostics::Process::HasExited -// System::Diagnostics::Process::Close -// System::Diagnostics::Process::CloseMainWindow -// The following example starts an instance of Notepad. It then -// retrieves the physical memory usage of the associated process at -// 2 second intervals for a maximum of 10 seconds. The example detects -// whether the process exits before 10 seconds have elapsed. -// The example closes the process if it is still running after -// 10 seconds. -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - try - { - Process^ myProcess; - myProcess = Process::Start( "Notepad.exe" ); - - // Display physical memory usage 5 times at intervals of 2 seconds. - for ( int i = 0; i < 5; i++ ) - { - if ( !myProcess->HasExited ) - { - - // Discard cached information about the process. - myProcess->Refresh(); - - // Print working set to console. - Console::WriteLine( "Physical Memory Usage : {0}", myProcess->WorkingSet.ToString() ); - - // Wait 2 seconds. - Thread::Sleep( 2000 ); - } - else - { - break; - } - - } - myProcess->CloseMainWindow(); - - // Free resources associated with process. - myProcess->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: " ); - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp b/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp deleted file mode 100644 index db06be9bee1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -// System::Diagnostics::Process::WorkingSet -// System::Diagnostics::Process::BasePriority -// System::Diagnostics::Process::UserProcessorTime -// System::Diagnostics::Process::PrivilegedProcessorTime -// System::Diagnostics::Process::TotalProcessorTime -// System::Diagnostics::Process::ToString -// System::Diagnostics::Process::Responding -// System::Diagnostics::Process::PriorityClass -// System::Diagnostics::Process::ExitCode -// The following example starts an instance of Notepad. The example -// then retrieves and displays various properties of the associated -// process. The example detects when the process exits, and displays the process's exit code. -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - try - { - Process^ myProcess; - myProcess = Process::Start( "NotePad.exe" ); - while ( !myProcess->HasExited ) - { - Console::WriteLine(); - - // Get physical memory usage of the associated process. - Console::WriteLine( "Process's physical memory usage: {0}", myProcess->WorkingSet.ToString() ); - - // Get base priority of the associated process. - Console::WriteLine( "Base priority of the associated process: {0}", myProcess->BasePriority.ToString() ); - - // Get priority class of the associated process. - Console::WriteLine( "Priority class of the associated process: {0}", myProcess->PriorityClass ); - - // Get user processor time for this process. - Console::WriteLine( "User Processor Time: {0}", myProcess->UserProcessorTime.ToString() ); - - // Get privileged processor time for this process. - Console::WriteLine( "Privileged Processor Time: {0}", myProcess->PrivilegedProcessorTime.ToString() ); - - // Get total processor time for this process. - Console::WriteLine( "Total Processor Time: {0}", myProcess->TotalProcessorTime.ToString() ); - - // Invoke overloaded ToString function. - Console::WriteLine( "Process's Name: {0}", myProcess->ToString() ); - Console::WriteLine( "-------------------------------------" ); - if ( myProcess->Responding ) - { - Console::WriteLine( "Status: Responding to user interface" ); - myProcess->Refresh(); - } - else - { - Console::WriteLine( "Status: Not Responding" ); - } - Thread::Sleep( 1000 ); - } - Console::WriteLine(); - Console::WriteLine( "Process exit code: {0}", myProcess->ExitCode.ToString() ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp b/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp deleted file mode 100644 index 8695804de6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Text::RegularExpressions; -void main() -{ - - String^ text = "One car red car blue car"; - String^ pat = "(\\w+)\\s+(car)"; - - // Compile the regular expression. - Regex^ r = gcnew Regex( pat,RegexOptions::IgnoreCase ); - - // Match the regular expression pattern against a text string. - Match^ m = r->Match(text); - int matchCount = 0; - while ( m->Success ) - { - Console::WriteLine( "Match{0}", ++matchCount ); - for ( int i = 1; i <= 2; i++ ) - { - Group^ g = m->Groups[ i ]; - Console::WriteLine( "Group{0}='{1}'", i, g ); - CaptureCollection^ cc = g->Captures; - for ( int j = 0; j < cc->Count; j++ ) - { - Capture^ c = cc[ j ]; - System::Console::WriteLine( "Capture{0}='{1}', Position={2}", j, c, c->Index ); - } - } - m = m->NextMatch(); - } -} -// This example displays the following output: -// Match1 -// Group1='One' -// Capture0='One', Position=0 -// Group2='car' -// Capture0='car', Position=4 -// Match2 -// Group1='red' -// Capture0='red', Position=8 -// Group2='car' -// Capture0='car', Position=12 -// Match3 -// Group1='blue' -// Capture0='blue', Position=16 -// Group2='car' -// Capture0='car', Position=21 -// - diff --git a/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp b/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp deleted file mode 100644 index 0494e4ad274..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Security::Cryptography; - -// Generate a key k1 with password pwd1 and salt salt1. -// Generate a key k2 with password pwd1 and salt salt1. -// Encrypt data1 with key k1 using symmetric encryption, creating edata1. -// Decrypt edata1 with key k2 using symmetric decryption, creating data2. -// data2 should equal data1. - -int main() -{ - array^passwordargs = Environment::GetCommandLineArgs(); - String^ usageText = "Usage: RFC2898 \nYou must specify the password for encryption.\n"; - - //If no file name is specified, write usage text. - if ( passwordargs->Length == 1 ) - { - Console::WriteLine( usageText ); - } - else - { - // - String^ pwd1 = passwordargs[ 1 ]; - - array^salt1 = gcnew array(8); - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - rng->GetBytes(salt1); - //data1 can be a string or contents of a file. - String^ data1 = "Some test data"; - - // - //The default iteration count is 1000 so the two methods use the same iteration count. - int myIterations = 1000; - // - - // - try - { - // - Rfc2898DeriveBytes ^ k1 = gcnew Rfc2898DeriveBytes( pwd1,salt1,myIterations ); - Rfc2898DeriveBytes ^ k2 = gcnew Rfc2898DeriveBytes( pwd1,salt1 ); - // - - // Encrypt the data. - Aes^ encAlg = Aes::Create(); - encAlg->Key = k1->GetBytes( 16 ); - MemoryStream^ encryptionStream = gcnew MemoryStream; - CryptoStream^ encrypt = gcnew CryptoStream( encryptionStream,encAlg->CreateEncryptor(),CryptoStreamMode::Write ); - array^utfD1 = (gcnew System::Text::UTF8Encoding( false ))->GetBytes( data1 ); - // - - encrypt->Write( utfD1, 0, utfD1->Length ); - encrypt->FlushFinalBlock(); - encrypt->Close(); - array^edata1 = encryptionStream->ToArray(); - k1->Reset(); - - // Try to decrypt, thus showing it can be round-tripped. - Aes^ decAlg = Aes::Create(); - decAlg->Key = k2->GetBytes( 16 ); - decAlg->IV = encAlg->IV; - MemoryStream^ decryptionStreamBacking = gcnew MemoryStream; - CryptoStream^ decrypt = gcnew CryptoStream( decryptionStreamBacking,decAlg->CreateDecryptor(),CryptoStreamMode::Write ); - - // - decrypt->Write( edata1, 0, edata1->Length ); - decrypt->Flush(); - decrypt->Close(); - k2->Reset(); - // - - String^ data2 = (gcnew UTF8Encoding( false ))->GetString( decryptionStreamBacking->ToArray() ); - if ( !data1->Equals( data2 ) ) - { - Console::WriteLine( "Error: The two values are not equal." ); - } - else - { - Console::WriteLine( "The two values are equal." ); - Console::WriteLine( "k1 iterations: {0}", k1->IterationCount ); - Console::WriteLine( "k2 iterations: {0}", k2->IterationCount ); - } - // - } - - catch ( Exception^ e ) - { - Console::WriteLine( "Error: ", e ); - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp deleted file mode 100644 index 985c85cb847..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -// Sample for String::LastIndexOf(String, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - start = str->Length - 1; - Console::WriteLine( "All occurrences of 'he' from position {0} to 0.", start ); - Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str ); - Console::Write( "The string 'he' occurs at position(s): " ); - at = 0; - while ( (start > -1) && (at > -1) ) - { - at = str->LastIndexOf( "he", start ); - if ( at > -1 ) - { - Console::Write( " {0} ", at ); - start = at - 1; - } - } - - Console::WriteLine(); -} - -/* -This example produces the following results: -All occurrences of 'he' from position 66 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The string 'he' occurs at position(s): 56 45 8 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp deleted file mode 100644 index 707743dd829..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Sample for String::LastIndexOf(String, Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - int end; - start = str->Length - 1; - end = start / 2 - 1; - Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "The string 'he' occurs at position(s): " ); - count = 0; - at = 0; - while ( (start > -1) && (at > -1) ) - { - count = start - end; //Count must be within the substring. - at = str->LastIndexOf( "he", start, count ); - if ( at > -1 ) - { - Console::Write( "{0} ", at ); - start = at - 1; - } - } - - Console::Write( "{0} {0} {0}", Environment::NewLine ); -} - -/* -This example produces the following results: -All occurrences of 'he' from position 66 to 32. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The string 'he' occurs at position(s): 56 45 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp deleted file mode 100644 index 545ffd356be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::LastIndexOfAny(Char[]) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - String^ target = "is"; - array^anyOf = target->ToCharArray(); - start = str->Length - 1; - Console::WriteLine( "The last character occurrence from position {0} to 0.", start ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->LastIndexOfAny( anyOf ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::Write( "{0}{0}{0}", Environment::NewLine ); -} - -/* -This example produces the following results: -The last character occurrence from position 66 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'is' occurs at position: 58 - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp deleted file mode 100644 index 4328318576a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::LastIndexOfAny(Char, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - String^ target = "is"; - array^anyOf = target->ToCharArray(); - start = (str->Length - 1) / 2; - Console::WriteLine( "The last character occurrence from position {0} to 0.", start ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->LastIndexOfAny( anyOf, start ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::Write( "{0}{0}{0}", Environment::NewLine ); -} - -/* -This example produces the following results: -The last character occurrence from position 33 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'is' occurs at position: 12 - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp deleted file mode 100644 index 2c3f5ecd695..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::LastIndexOfAny(Char[], Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - String^ target = "aid"; - array^anyOf = target->ToCharArray(); - start = ((str->Length - 1) * 2) / 3; - count = (str->Length - 1) / 3; - Console::WriteLine( "The last character occurrence from position {0} for {1} characters.", start, count ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->LastIndexOfAny( anyOf, start, count ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::Write( "{0}{0}{0}", Environment::NewLine ); -} - -/* -This example produces the following results: -The last character occurrence from position 44 for 22 characters. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'aid' occurs at position: 27 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp b/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp deleted file mode 100644 index 338ffdc3b4f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -// Sample for String::ToCharArray(Int32, Int32) -using namespace System; -using namespace System::Collections; -int main() -{ - String^ str = "012wxyz789"; - array^arr; - arr = str->ToCharArray( 3, 4 ); - Console::Write( "The letters in '{0}' are: '", str ); - Console::Write( arr ); - Console::WriteLine( "'" ); - Console::WriteLine( "Each letter in '{0}' is:", str ); - IEnumerator^ myEnum = arr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::WriteLine( c ); - } -} - -/* -This example produces the following results: -The letters in '012wxyz789' are: 'wxyz' -Each letter in '012wxyz789' is: -w -x -y -z -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp deleted file mode 100644 index 67cba53ecab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -String^ symbol( int r ) -{ - String^ s = "="; - if ( r < 0 ) - s = "<"; - else - if ( r > 0 ) - s = ">"; - - - return s; -} - -int main() -{ - String^ str1 = "change"; - String^ str2 = "dollar"; - String^ relation = nullptr; - relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "en-US" ) ) ); - Console::WriteLine( "For en-US: {0} {1} {2}", str1, relation, str2 ); - relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "cs-CZ" ) ) ); - Console::WriteLine( "For cs-CZ: {0} {1} {2}", str1, relation, str2 ); -} - -/* -This example produces the following results. -For en-US: change < dollar -For cs-CZ: change > dollar -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp deleted file mode 100644 index 069e685cc76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Sample for String::Compare(String, Int32, String, Int32, Int32) -using namespace System; -int main() -{ - - // 0123456 - String^ str1 = "machine"; - String^ str2 = "device"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - result = String::Compare( str1, 2, str2, 0, 2 ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in ' {1}' is ", str1->Substring( 2, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in ' {1}'.", str2->Substring( 0, 2 ), str2 ); -} - -/* -This example produces the following results: - -str1 = 'machine', str2 = 'device' -Substring 'ch' in 'machine' is less than substring 'de' in 'device'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp deleted file mode 100644 index 0e2fd3df934..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean) -using namespace System; -int main() -{ - - // 0123456 - String^ str1 = "MACHINE"; - String^ str2 = "machine"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - Console::WriteLine( "Ignore case:" ); - result = String::Compare( str1, 2, str2, 2, 2, true ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 ); - Console::WriteLine(); - Console::WriteLine( "Honor case:" ); - result = String::Compare( str1, 2, str2, 2, 2, false ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 ); -} - -/* -This example produces the following results: - -str1 = 'MACHINE', str2 = 'machine' -Ignore case: -Substring 'CH' in 'MACHINE' is equal to substring 'ch' in 'machine'. - -Honor case: -Substring 'CH' in 'MACHINE' is greater than substring 'ch' in 'machine'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp deleted file mode 100644 index 3afdbfd074c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo) -using namespace System; -using namespace System::Globalization; -int main() -{ - - // 0123456 - String^ str1 = "MACHINE"; - String^ str2 = "machine"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - Console::WriteLine( "Ignore case, Turkish culture:" ); - result = String::Compare( str1, 4, str2, 4, 2, true, gcnew CultureInfo( "tr-TR" ) ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 ); - Console::WriteLine(); - Console::WriteLine( "Ignore case, invariant culture:" ); - result = String::Compare( str1, 4, str2, 4, 2, true, CultureInfo::InvariantCulture ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 ); - Console::Write( " {0} ", str ); - Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 ); -} - -/* -This example produces the following results: - -str1 = 'MACHINE', str2 = 'machine' -Ignore case, Turkish culture: -Substring 'IN' in 'MACHINE' is less than substring 'in' in 'machine'. - -Ignore case, invariant culture: -Substring 'IN' in 'MACHINE' is equal to substring 'in' in 'machine'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp b/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp deleted file mode 100644 index 52112724b74..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Sample for String::CompareOrdinal(String, String) -using namespace System; -int main() -{ - String^ str1 = "ABCD"; - String^ str2 = "abcd"; - String^ str; - int result; - Console::WriteLine(); - Console::WriteLine( "Compare the numeric values of the corresponding Char objects in each string." ); - Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); - result = String::CompareOrdinal( str1, str2 ); - str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); - Console::Write( "String '{0}' is ", str1 ); - Console::Write( "{0} ", str ); - Console::WriteLine( "String '{0}'.", str2 ); -} - -/* -This example produces the following results: - -Compare the numeric values of the corresponding Char objects in each string. -str1 = 'ABCD', str2 = 'abcd' -String 'ABCD' is less than String 'abcd'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp b/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp deleted file mode 100644 index 4b457f0078d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -using namespace System; - -int main() -{ - int i = -123; - Object^ o = i; - array^objs = { -123, -456, -789}; - Console::WriteLine("Concatenate 1, 2, and 3 objects:"); - Console::WriteLine("1) {0}", String::Concat(o)); - Console::WriteLine("2) {0}", String::Concat(o, o)); - Console::WriteLine("3) {0}", String::Concat(o, o, o)); - - Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" ); - Console::WriteLine("4) {0}", String::Concat(o, o, o, o)); - Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o)); - Console::WriteLine("\nConcatenate a 3-element object array:"); - Console::WriteLine("6) {0}", String::Concat(objs)); -} -// The example displays the following output: -// Concatenate 1, 2, and 3 objects: -// 1) -123 -// 2) -123-123 -// 3) -123-123-123 -// -// Concatenate 4 objects and a variable length parameter list: -// 4) -123-123-123-123 -// 5) -123-123-123-123-123 -// -// Concatenate a 3-element object array: -// 6) -123-456-789 -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp b/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp deleted file mode 100644 index d9beeec7af6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; - -int main() -{ - String^ s1 = "The quick brown fox jumps over the lazy dog"; - String^ s2 = "fox"; - bool b = s1->Contains( s2 ); - Console::WriteLine( "Is the string, s2, in the string, s1?: {0}", b ); - if (b) { - int index = s1->IndexOf(s2); - if (index >= 0) - Console::WriteLine("'{0} begins at character position {1}", - s2, index + 1); - } -} -// This example displays the following output: -// 'fox' is in the string 'The quick brown fox jumps over the lazy dog': True -// 'fox begins at character position 17 -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp deleted file mode 100644 index 94de0334063..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -// Sample for String::Equals(Object) -// String::Equals(String) -// String::Equals(String, String) -using namespace System; -using namespace System::Text; -int main() -{ - StringBuilder^ sb = gcnew StringBuilder( "abcd" ); - String^ str1 = "abcd"; - String^ str2 = nullptr; - Object^ o2 = nullptr; - Console::WriteLine(); - Console::WriteLine( " * The value of String str1 is '{0}'.", str1 ); - Console::WriteLine( " * The value of StringBuilder sb is '{0}'.", sb ); - Console::WriteLine(); - Console::WriteLine( "1a) String::Equals(Object). Object is a StringBuilder, not a String." ); - Console::WriteLine( " Is str1 equal to sb?: {0}", str1->Equals( sb ) ); - Console::WriteLine(); - Console::WriteLine( "1b) String::Equals(Object). Object is a String." ); - str2 = sb->ToString(); - o2 = str2; - Console::WriteLine( " * The value of Object o2 is '{0}'.", o2 ); - Console::WriteLine( " Is str1 equal to o2?: {0}", str1->Equals( o2 ) ); - Console::WriteLine(); - Console::WriteLine( " 2) String::Equals(String)" ); - Console::WriteLine( " * The value of String str2 is '{0}'.", str2 ); - Console::WriteLine( " Is str1 equal to str2?: {0}", str1->Equals( str2 ) ); - Console::WriteLine(); - Console::WriteLine( " 3) String::Equals(String, String)" ); - Console::WriteLine( " Is str1 equal to str2?: {0}", String::Equals( str1, str2 ) ); -} - -/* -This example produces the following results: - - * The value of String str1 is 'abcd'. - * The value of StringBuilder sb is 'abcd'. - -1a) String::Equals(Object). Object is a StringBuilder, not a String. - Is str1 equal to sb?: False - -1b) String::Equals(Object). Object is a String. - * The value of Object o2 is 'abcd'. - Is str1 equal to o2?: True - - 2) String::Equals(String) - * The value of String str2 is 'abcd'. - Is str1 equal to str2?: True - - 3) String::Equals(String, String) - Is str1 equal to str2?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp b/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp deleted file mode 100644 index 536db349ec4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -// Sample for String.GetTypeCode() -using namespace System; -int main() -{ - String^ str = "abc"; - TypeCode tc = str->GetTypeCode(); - Console::WriteLine( "The type code for '{0}' is {1}, which represents {2}.", str, tc.ToString( "D" ), tc.ToString( "F" ) ); -} - -/* -This example produces the following results: -The type code for 'abc' is 18, which represents String. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp deleted file mode 100644 index 30d08ce5ace..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -// Sample for String::IndexOf(Char, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - Console::WriteLine(); - Console::WriteLine( "All occurrences of 't' from position 0 to {0}.", str->Length - 1 ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "The letter 't' occurs at position(s): " ); - at = 0; - start = 0; - while ( (start < str->Length) && (at > -1) ) - { - at = str->IndexOf( 't', start ); - if ( at == -1 ) - break; - - Console::Write( "{0} ", at ); - start = at + 1; - } - - Console::WriteLine(); -} - -/* -This example produces the following results: - -All occurrences of 't' from position 0 to 66. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The letter 't' occurs at position(s): 7 11 33 41 44 55 64 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp deleted file mode 100644 index f8a1385b749..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -// Sample for String::IndexOf(String, Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int end; - int count; - end = str->Length; - start = end / 2; - Console::WriteLine(); - Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end - 1 ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "The string 'he' occurs at position(s): " ); - count = 0; - at = 0; - while ( (start <= end) && (at > -1) ) - { - - // start+count must be a position within -str-. - count = end - start; - at = str->IndexOf( "he", start, count ); - if ( at == -1 ) - break; - - Console::Write( "{0} ", at ); - start = at + 1; - } - - Console::WriteLine(); -} - -/* -This example produces the following results: - -All occurrences of 'he' from position 33 to 66. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The string 'he' occurs at position(s): 45 56 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp deleted file mode 100644 index 47b0a1db97c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -// Sample for String::IndexOfAny(Char[], Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - String^ target = "is"; - array^anyOf = target->ToCharArray(); - start = str->Length / 2; - Console::WriteLine(); - Console::WriteLine( "The first character occurrence from position {0} to {1}.", start, str->Length - 1 ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->IndexOfAny( anyOf, start ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::WriteLine(); -} - -/* - -The first character occurrence from position 33 to 66. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'is' occurs at position: 49 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp deleted file mode 100644 index 4bd03080726..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -// Sample for String::IndexOfAny(Char[], Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - String^ target = "aid"; - array^anyOf = target->ToCharArray(); - start = (str->Length - 1) / 3; - count = (str->Length - 1) / 4; - Console::WriteLine(); - Console::WriteLine( "The first character occurrence from position {0} for {1} characters.", start, count ); - Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - Console::Write( "A character in '{0}' occurs at position: ", target ); - at = str->IndexOfAny( anyOf, start, count ); - if ( at > -1 ) - Console::Write( at ); - else - Console::Write( "(not found)" ); - - Console::WriteLine(); -} - -/* - -The first character occurrence from position 22 for 16 characters. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -A character in 'aid' occurs at position: 27 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp b/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp deleted file mode 100644 index b70c604b0b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -// Sample for String::Intern(String) -using namespace System; -using namespace System::Text; -int main() -{ - String^ s1 = "MyTest"; - String^ s2 = (gcnew StringBuilder)->Append( "My" )->Append( "Test" )->ToString(); - String^ s3 = String::Intern( s2 ); - Console::WriteLine( "s1 == '{0}'", s1 ); - Console::WriteLine( "s2 == '{0}'", s2 ); - Console::WriteLine( "s3 == '{0}'", s3 ); - Console::WriteLine( "Is s2 the same reference as s1?: {0}", s2 == s1 ); - Console::WriteLine( "Is s3 the same reference as s1?: {0}", s3 == s1 ); -} - -/* -This example produces the following results: -s1 == 'MyTest' -s2 == 'MyTest' -s3 == 'MyTest' -Is s2 the same reference as s1?: False -Is s3 the same reference as s1?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp b/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp deleted file mode 100644 index a9a9593c87e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -String^ Test( String^ s ) -{ - if (String::IsNullOrEmpty(s)) - return "is null or empty"; - else - return String::Format( "(\"{0}\") is neither null nor empty", s ); -} - -int main() -{ - String^ s1 = "abcd"; - String^ s2 = ""; - String^ s3 = nullptr; - Console::WriteLine( "String s1 {0}.", Test( s1 ) ); - Console::WriteLine( "String s2 {0}.", Test( s2 ) ); - Console::WriteLine( "String s3 {0}.", Test( s3 ) ); -} -// The example displays the following output: -// String s1 ("abcd") is neither null nor empty. -// String s2 is null or empty. -// String s3 is null or empty. -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp b/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp deleted file mode 100644 index bec722b1e9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// Sample for String::IsInterned(String) -using namespace System; -using namespace System::Text; -using namespace System::Runtime::CompilerServices; - -// In the .NET Framework 2.0 the following attribute declaration allows you to -// avoid the use of the interning when you use NGEN.exe to compile an assembly -// to the native image cache. -[assembly:CompilationRelaxations(CompilationRelaxations::NoStringInterning)]; -void Test( int sequence, String^ str ) -{ - Console::Write( "{0} The string '", sequence ); - String^ strInterned = String::IsInterned( str ); - if ( strInterned == nullptr ) - Console::WriteLine( "{0}' is not interned.", str ); - else - Console::WriteLine( "{0}' is interned.", strInterned ); -} - -int main() -{ - - // String str1 is known at compile time, and is automatically interned. - String^ str1 = "abcd"; - - // Constructed string, str2, is not explicitly or automatically interned. - String^ str2 = (gcnew StringBuilder)->Append( "wx" )->Append( "yz" )->ToString(); - Console::WriteLine(); - Test( 1, str1 ); - Test( 2, str2 ); -} - -//This example produces the following results: - -//1) The string, 'abcd', is interned. -//2) The string, 'wxyz', is not interned. - -//If you use NGEN.exe to compile the assembly to the native image cache, this -//example produces the following results: - -//1) The string, 'abcd', is not interned. -//2) The string, 'wxyz', is not interned. - -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp b/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp deleted file mode 100644 index 07f204ebd9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -// Sample for String::Join(String, String[], int int) -using namespace System; -int main() -{ - array^val = {"apple","orange","grape","pear"}; - String^ sep = ", "; - String^ result; - Console::WriteLine( "sep = '{0}'", sep ); - Console::WriteLine( "val[] = {{'{0}' '{1}' '{2}' '{3}'}}", val[ 0 ], val[ 1 ], val[ 2 ], val[ 3 ] ); - result = String::Join( sep, val, 1, 2 ); - Console::WriteLine( "String::Join(sep, val, 1, 2) = '{0}'", result ); -} - -/* -This example produces the following results: -sep = ', ' -val[] = {'apple' 'orange' 'grape' 'pear'} -String::Join(sep, val, 1, 2) = 'orange, grape' -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp deleted file mode 100644 index 809d2c001d6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -// Sample for String::LastIndexOf(Char, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - start = str->Length - 1; - Console::WriteLine( "All occurrences of 't' from position {0} to 0.", start ); - Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str ); - Console::Write( "The letter 't' occurs at position(s): " ); - at = 0; - while ( (start > -1) && (at > -1) ) - { - at = str->LastIndexOf( 't', start ); - if ( at > -1 ) - { - Console::Write( " {0} ", at ); - start = at - 1; - } - } -} - -/* -This example produces the following results: -All occurrences of 't' from position 66 to 0. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The letter 't' occurs at position(s): 64 55 44 41 33 11 7 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp deleted file mode 100644 index 881187073e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Sample for String::LastIndexOf(Char, Int32, Int32) -using namespace System; -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; - String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; - String^ str = "Now is the time for all good men to come to the aid of their party."; - int start; - int at; - int count; - int end; - start = str->Length - 1; - end = start / 2 - 1; - Console::WriteLine( "All occurrences of 't' from position {0} to {1}.", start, end ); - Console::WriteLine( "\n{0}\n{1}\n{2}", br1, br2, str ); - Console::Write( "The letter 't' occurs at position(s): " ); - count = 0; - at = 0; - while ( (start > -1) && (at > -1) ) - { - count = start - end; //Count must be within the substring. - at = str->LastIndexOf( 't', start, count ); - if ( at > -1 ) - { - Console::Write( " {0} ", at ); - start = at - 1; - } - } -} - -/* -This example produces the following results: -All occurrences of 't' from position 66 to 32. -0----+----1----+----2----+----3----+----4----+----5----+----6----+- -0123456789012345678901234567890123456789012345678901234567890123456 -Now is the time for all good men to come to the aid of their party. - -The letter 't' occurs at position(s): 64 55 44 41 33 - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp b/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp deleted file mode 100644 index e3a6250c8ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -// Sample for String::Length -using namespace System; -int main() -{ - String^ str = "abcdefg"; - Console::WriteLine( "1) The length of '{0}' is {1}", str, str->Length ); - Console::WriteLine( "2) The length of '{0}' is {1}", "xyz", ((String^)"xyz")->Length ); - int length = str->Length; - Console::WriteLine( "1) The length of '{0}' is {1}", str, length ); -} - -/* -This example displays the following output: - 1) The length of 'abcdefg' is 7 - 2) The length of 'xyz' is 3 - 3) The length of 'abcdefg' is 7 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp b/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp deleted file mode 100644 index 8193a3115e2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp +++ /dev/null @@ -1,117 +0,0 @@ - -// -using namespace System; -using namespace System::Text; - -void Show( String^ title, String^ s ) -{ - Console::Write( "Characters in string {0} = ", title ); - for each (short x in s) { - Console::Write("{0:X4} ", x); - } - Console::WriteLine(); -} - -int main() -{ - - // Character c; combining characters acute and cedilla; character 3/4 - array^temp0 = {L'c',L'\u0301',L'\u0327',L'\u00BE'}; - String^ s1 = gcnew String( temp0 ); - String^ s2 = nullptr; - String^ divider = gcnew String( '-',80 ); - divider = String::Concat( Environment::NewLine, divider, Environment::NewLine ); - - Show( "s1", s1 ); - Console::WriteLine(); - Console::WriteLine( "U+0063 = LATIN SMALL LETTER C" ); - Console::WriteLine( "U+0301 = COMBINING ACUTE ACCENT" ); - Console::WriteLine( "U+0327 = COMBINING CEDILLA" ); - Console::WriteLine( "U+00BE = VULGAR FRACTION THREE QUARTERS" ); - Console::WriteLine( divider ); - Console::WriteLine( "A1) Is s1 normalized to the default form (Form C)?: {0}", s1->IsNormalized() ); - Console::WriteLine( "A2) Is s1 normalized to Form C?: {0}", s1->IsNormalized( NormalizationForm::FormC ) ); - Console::WriteLine( "A3) Is s1 normalized to Form D?: {0}", s1->IsNormalized( NormalizationForm::FormD ) ); - Console::WriteLine( "A4) Is s1 normalized to Form KC?: {0}", s1->IsNormalized( NormalizationForm::FormKC ) ); - Console::WriteLine( "A5) Is s1 normalized to Form KD?: {0}", s1->IsNormalized( NormalizationForm::FormKD ) ); - Console::WriteLine( divider ); - Console::WriteLine( "Set string s2 to each normalized form of string s1." ); - Console::WriteLine(); - Console::WriteLine( "U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE" ); - Console::WriteLine( "U+0033 = DIGIT THREE" ); - Console::WriteLine( "U+2044 = FRACTION SLASH" ); - Console::WriteLine( "U+0034 = DIGIT FOUR" ); - Console::WriteLine( divider ); - s2 = s1->Normalize(); - Console::Write( "B1) Is s2 normalized to the default form (Form C)?: " ); - Console::WriteLine( s2->IsNormalized() ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormC ); - Console::Write( "B2) Is s2 normalized to Form C?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormC ) ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormD ); - Console::Write( "B3) Is s2 normalized to Form D?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormD ) ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormKC ); - Console::Write( "B4) Is s2 normalized to Form KC?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKC ) ); - Show( "s2", s2 ); - Console::WriteLine(); - s2 = s1->Normalize( NormalizationForm::FormKD ); - Console::Write( "B5) Is s2 normalized to Form KD?: " ); - Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKD ) ); - Show( "s2", s2 ); - Console::WriteLine(); -} - -/* -This example produces the following results: - -Characters in string s1 = 0063 0301 0327 00BE - -U+0063 = LATIN SMALL LETTER C -U+0301 = COMBINING ACUTE ACCENT -U+0327 = COMBINING CEDILLA -U+00BE = VULGAR FRACTION THREE QUARTERS - --------------------------------------------------------------------------------- - -A1) Is s1 normalized to the default form (Form C)?: False -A2) Is s1 normalized to Form C?: False -A3) Is s1 normalized to Form D?: False -A4) Is s1 normalized to Form KC?: False -A5) Is s1 normalized to Form KD?: False - --------------------------------------------------------------------------------- - -Set string s2 to each normalized form of string s1. - -U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE -U+0033 = DIGIT THREE -U+2044 = FRACTION SLASH -U+0034 = DIGIT FOUR - --------------------------------------------------------------------------------- - -B1) Is s2 normalized to the default form (Form C)?: True -Characters in string s2 = 1E09 00BE - -B2) Is s2 normalized to Form C?: True -Characters in string s2 = 1E09 00BE - -B3) Is s2 normalized to Form D?: True -Characters in string s2 = 0063 0327 0301 00BE - -B4) Is s2 normalized to Form KC?: True -Characters in string s2 = 1E09 0033 2044 0034 - -B5) Is s2 normalized to Form KD?: True -Characters in string s2 = 0063 0327 0301 0033 2044 0034 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp b/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp deleted file mode 100644 index a7be6a4bd78..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -// This example demonstrates the String.Remove() method. -using namespace System; -int main() -{ - String^ s = "abc---def"; - - // - Console::WriteLine( "Index: 012345678" ); - Console::WriteLine( "1) {0}", s ); - Console::WriteLine( "2) {0}", s->Remove( 3 ) ); - Console::WriteLine( "3) {0}", s->Remove( 3, 3 ) ); -} - -/* -This example produces the following results: - -Index: 012345678 -1) abc---def -2) abc -3) abcdef - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp b/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp deleted file mode 100644 index 5bb7e44d58f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "1 2 3 4 5 6 7 8 9"; - Console::WriteLine( "Original string: \"{0}\"", str ); - Console::WriteLine( "CSV string: \"{0}\"", str->Replace( ' ', ',' ) ); -} - -// -// This example produces the following output: -// Original string: "1 2 3 4 5 6 7 8 9" -// CSV string: "1,2,3,4,5,6,7,8,9" -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp b/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp deleted file mode 100644 index c976a43115b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -// This example demonstrates the String.Split(Char[], Boolean) and -// String.Split(Char[], Int32, Boolean) methods -using namespace System; -void Show( array^entries ) -{ - Console::WriteLine( "The return value contains these {0} elements:", entries->Length ); - System::Collections::IEnumerator^ myEnum = entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ entry = safe_cast(myEnum->Current); - Console::Write( "<{0}>", entry ); - } - - Console::Write( "{0}{0}", Environment::NewLine ); -} - -int main() -{ - String^ s = ",one,,,two,,,,,three,,"; - array^sep = gcnew array{ - ',' - }; - array^result; - - // - Console::WriteLine( "The original string is \"{0}\".", s ); - Console::WriteLine( "The separation character is '{0}'.", sep[ 0 ] ); - Console::WriteLine(); - - // - Console::WriteLine( "Split the string and return all elements:" ); - result = s->Split( sep, StringSplitOptions::None ); - Show( result ); - - // - Console::WriteLine( "Split the string and return all non-empty elements:" ); - result = s->Split( sep, StringSplitOptions::RemoveEmptyEntries ); - Show( result ); - - // - Console::WriteLine( "Split the string and return 2 elements:" ); - result = s->Split( sep, 2, StringSplitOptions::None ); - Show( result ); - - // - Console::WriteLine( "Split the string and return 2 non-empty elements:" ); - result = s->Split( sep, 2, StringSplitOptions::RemoveEmptyEntries ); - Show( result ); -} - -/* -This example produces the following results: - -The original string is ",one,,,two,,,,,three,,". -The separation character is ','. - -Split the string and return all elements: -The return value contains these 12 elements: -<><><><><><><><><> - -Split the string and return all non-empty elements: -The return value contains these 3 elements: - - -Split the string and return 2 elements: -The return value contains these 2 elements: -<> - -Split the string and return 2 non-empty elements: -The return value contains these 2 elements: -<,,two,,,,,three,,> - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp deleted file mode 100644 index bb7a31a327d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -// Sample for String::ToLower(CultureInfo) -using namespace System; -using namespace System::Globalization; -void CodePoints( String^ title, String^ s ) -{ - Console::Write( "{0}The code points in {1} are: {0}", Environment::NewLine, title ); - System::Collections::IEnumerator^ myEnum = s->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - UInt16 u = safe_cast(myEnum->Current); - Console::Write( "{0:x4} ", u ); - } - - Console::WriteLine(); -} - -int main() -{ - String^ str1 = "INDIGO"; - - // str2 = str1, except each 'I' is '\u0130' (Unicode LATIN CAPITAL I WITH DOT ABOVE). - array^temp = {L'\u0130',L'N',L'D',L'\u0130',L'G',L'O'}; - String^ str2 = gcnew String( temp ); - String^ str3; - String^ str4; - Console::WriteLine(); - Console::WriteLine( "str1 = '{0}'", str1 ); - Console::WriteLine(); - Console::WriteLine( "str1 is {0} to str2.", ((0 == String::CompareOrdinal( str1, str2 )) ? (String^)"equal" : "not equal") ); - CodePoints( "str1", str1 ); - CodePoints( "str2", str2 ); - Console::WriteLine(); - - // str3 is a lower case copy of str2, using English-United States culture. - Console::WriteLine( "str3 = Lower case copy of str2 using English-United States culture." ); - str3 = str2->ToLower( gcnew CultureInfo( "en-US",false ) ); - - // str4 is a lower case copy of str2, using Turkish-Turkey culture. - Console::WriteLine( "str4 = Lower case copy of str2 using Turkish-Turkey culture." ); - str4 = str2->ToLower( gcnew CultureInfo( "tr-TR",false ) ); - - // Compare the code points in str3 and str4. - Console::WriteLine(); - Console::WriteLine( "str3 is {0} to str4.", ((0 == String::CompareOrdinal( str3, str4 )) ? (String^)"equal" : "not equal") ); - CodePoints( "str3", str3 ); - CodePoints( "str4", str4 ); -} - -/* -This example produces the following results: - -str1 = 'INDIGO' - -str1 is not equal to str2. - -The code points in str1 are: -0049 004e 0044 0049 0047 004f - -The code points in str2 are: -0130 004e 0044 0130 0047 004f - -str3 = Lower case copy of str2 using English-United States culture. -str4 = Lower case copy of str2 using Turkish-Turkey culture. - -str3 is equal to str4. - -The code points in str3 are: -0069 006e 0064 0069 0067 006f - -The code points in str4 are: -0069 006e 0064 0069 0067 006f -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp b/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp deleted file mode 100644 index 389fdf3e61a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str1 = "123"; - String^ str2 = "abc"; - Console::WriteLine( "Original str1: {0}", str1 ); - Console::WriteLine( "Original str2: {0}", str2 ); - Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) ); - str2 = str1; - Console::WriteLine(); - Console::WriteLine( "New str2: {0}", str2 ); - Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) ); -} - -/* -This code produces the following output: -Original str1: 123 -Original str2: abc -str1 same as str2?: False - -New str2: 123 -str1 same as str2?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp deleted file mode 100644 index 3cb652fc45a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// This example demonstrates the StringBuilder.AppendFormat method -// -using namespace System; -using namespace System::Text; -using namespace System::Globalization; -void Show( StringBuilder^ sbs ) -{ - Console::WriteLine( sbs ); - sbs->Length = 0; -} - -int main() -{ - StringBuilder^ sb = gcnew StringBuilder; - int var1 = 111; - float var2 = 2.22F; - String^ var3 = "abcd"; - array^var4 = {3,4.4,(Char)'X'}; - Console::WriteLine(); - Console::WriteLine( "StringBuilder.AppendFormat method:" ); - sb->AppendFormat( "1) {0}", var1 ); - Show( sb ); - sb->AppendFormat( "2) {0}, {1}", var1, var2 ); - Show( sb ); - sb->AppendFormat( "3) {0}, {1}, {2}", var1, var2, var3 ); - Show( sb ); - sb->AppendFormat( "4) {0}, {1}, {2}", var4 ); - Show( sb ); - CultureInfo^ ci = gcnew CultureInfo( "es-ES",true ); - array^temp1 = {var2}; - sb->AppendFormat( ci, "5) {0}", temp1 ); - Show( sb ); -} - -/* -This example produces the following results: - -StringBuilder.AppendFormat method: -1) 111 -2) 111, 2.22 -3) 111, 2.22, abcd -4) 3, 4.4, X -5) 2,22 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp deleted file mode 100644 index 8d70a9a85d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// This example demonstrates the StringBuilder.AppendLine() -// method. - -using namespace System; -using namespace System::Text; - -int main() -{ - StringBuilder^ sb = gcnew StringBuilder; - String^ line = L"A line of text."; - int number = 123; - - // Append two lines of text. - sb->AppendLine( L"The first line of text." ); - sb->AppendLine( line ); - - // Append a new line, an empty string, and a null cast as a string. - sb->AppendLine(); - sb->AppendLine( L"" ); - sb->AppendLine( L"" ); - - // Append the non-string value, 123, and two new lines. - sb->Append( number )->AppendLine()->AppendLine(); - - // Append two lines of text. - sb->AppendLine( line ); - sb->AppendLine( L"The last line of text." ); - - // Convert the value of the StringBuilder to a string and display the string. - Console::WriteLine( sb ); - - return 0; -} - -/* -This example produces the following results: - -The first line of text. -A line of text. - - - -123 - -A line of text. -The last line of text. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp deleted file mode 100644 index be8fea41b47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -// This example demonstrates the CopyTo(Int32, Char[], Int32, Int32) method. -// Typically the destination array is small, preallocated, and global while -// the StringBuilder is large with programmatically defined data. -// However, for this example both the array and StringBuilder are small -// and the StringBuilder has predefined data. - -using namespace System; -using namespace System::Text; - -int main() -{ - array^dest = gcnew array(6); - StringBuilder^ src = gcnew StringBuilder( "abcdefghijklmnopqrstuvwxyz!" ); - dest[ 1 ] = ')'; - dest[ 2 ] = ' '; - - // Copy the source to the destination in 9 pieces, 3 characters per piece. - Console::WriteLine( "\nPiece) Data:" ); - for ( int ix = 0; ix < 9; ix++ ) - { - dest[ 0 ] = ix.ToString()[ 0 ]; - src->CopyTo( ix * 3, dest, 3, 3 ); - Console::Write( " " ); - Console::WriteLine( dest ); - } -} - -/* -This example produces the following results: - -Piece) Data: - 0) abc - 1) def - 2) ghi - 3) jkl - 4) mno - 5) pqr - 6) stu - 7) vwx - 8) yz! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp deleted file mode 100644 index 8043d615414..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// This example demonstrates StringBuilder.EnsureCapacity -// StringBuilder.Capacity -// StringBuilder.Length -// StringBuilder.Equals -// -using namespace System; -using namespace System::Text; -int main() -{ - StringBuilder^ sb1 = gcnew StringBuilder( "abc" ); - StringBuilder^ sb2 = gcnew StringBuilder( "abc",16 ); - Console::WriteLine(); - Console::WriteLine( "a1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity ); - Console::WriteLine( "a2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity ); - Console::WriteLine( "a3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 ); - Console::WriteLine( "a4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) ); - Console::WriteLine(); - Console::WriteLine( "Ensure sb1 has a capacity of at least 50 characters." ); - sb1->EnsureCapacity( 50 ); - Console::WriteLine(); - Console::WriteLine( "b1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity ); - Console::WriteLine( "b2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity ); - Console::WriteLine( "b3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 ); - Console::WriteLine( "b4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) ); - Console::WriteLine(); - Console::WriteLine( "Set the length of sb1 to zero." ); - Console::WriteLine( "Set the capacity of sb2 to 51 characters." ); - sb1->Length = 0; - sb2->Capacity = 51; - Console::WriteLine(); - Console::WriteLine( "c1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity ); - Console::WriteLine( "c2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity ); - Console::WriteLine( "c3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 ); - Console::WriteLine( "c4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) ); -} - -/* -The example displays the following output: - -a1) sb1->Length = 3, sb1->Capacity = 16 -a2) sb2->Length = 3, sb2->Capacity = 16 -a3) sb1 = "abc", sb2 = "abc" -a4) sb1 equals sb2: True - -Ensure sb1 has a capacity of at least 50 characters. - -b1) sb1->Length = 3, sb1->Capacity = 50 -b2) sb2->Length = 3, sb2->Capacity = 16 -b3) sb1 = "abc", sb2 = "abc" -b4) sb1 equals sb2: False - -Set the length of sb1 to zero. -Set the capacity of sb2 to 51 characters. - -c1) sb1->Length = 0, sb1->Capacity = 50 -c2) sb2->Length = 3, sb2->Capacity = 51 -c3) sb1 = "", sb2 = "abc" -c4) sb1 equals sb2: False -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp deleted file mode 100644 index 03de6cb972e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp +++ /dev/null @@ -1,118 +0,0 @@ - -// This example demonstrates StringBuilder.Insert() -// -using namespace System; -using namespace System::Text; -ref class Sample -{ -private: - - // index: 012345 - static String^ initialValue = "--[]--"; - static StringBuilder^ sb; - -public: - static void Main() - { - String^ xyz = "xyz"; - array^abc = {'a','b','c'}; - Char star = '*'; - Object^ obj = 0; - bool xBool = true; - Byte xByte = 1; - short xInt16 = 2; - int xInt32 = 3; - long xInt64 = 4; - Decimal xDecimal = 5; - float xSingle = 6.6F; - double xDouble = 7.7; - - // The following types are not CLS-compliant. - UInt16 xUInt16 = 8; - UInt32 xUInt32 = 9; - UInt64 xUInt64 = 10; - SByte xSByte = -11; - - // - Console::WriteLine( "StringBuilder.Insert method" ); - sb = gcnew StringBuilder( initialValue ); - sb->Insert( 3, xyz, 2 ); - Show( 1, sb ); - sb->Insert( 3, xyz ); - Show( 2, sb ); - sb->Insert( 3, star ); - Show( 3, sb ); - sb->Insert( 3, abc ); - Show( 4, sb ); - sb->Insert( 3, abc, 1, 2 ); - Show( 5, sb ); - sb->Insert( 3, xBool ); // True - Show( 6, sb ); - sb->Insert( 3, obj ); // 0 - Show( 7, sb ); - sb->Insert( 3, xByte ); // 1 - Show( 8, sb ); - sb->Insert( 3, xInt16 ); // 2 - Show( 9, sb ); - sb->Insert( 3, xInt32 ); // 3 - Show( 10, sb ); - sb->Insert( 3, xInt64 ); // 4 - Show( 11, sb ); - sb->Insert( 3, xDecimal ); // 5 - Show( 12, sb ); - sb->Insert( 3, xSingle ); // 6.6 - Show( 13, sb ); - sb->Insert( 3, xDouble ); // 7.7 - Show( 14, sb ); - - // The following Insert methods are not CLS-compliant. - sb->Insert( 3, xUInt16 ); // 8 - Show( 15, sb ); - sb->Insert( 3, xUInt32 ); // 9 - Show( 16, sb ); - sb->Insert( 3, xUInt64 ); // 10 - Show( 17, sb ); - sb->Insert( 3, xSByte ); // -11 - Show( 18, sb ); - - // - } - - static void Show( int overloadNumber, StringBuilder^ sbs ) - { - Console::WriteLine( "{0,2:G} = {1}", overloadNumber, sbs ); - sb = gcnew StringBuilder( initialValue ); - } - -}; - -int main() -{ - Sample::Main(); -} - -/* -This example produces the following results: - -StringBuilder.Insert method - 1 = --[xyzxyz]-- - 2 = --[xyz]-- - 3 = --[*]-- - 4 = --[abc]-- - 5 = --[bc]-- - 6 = --[True]-- - 7 = --[0]-- - 8 = --[1]-- - 9 = --[2]-- -10 = --[3]-- -11 = --[4]-- -12 = --[5]-- -13 = --[6.6]-- -14 = --[7.7]-- -15 = --[8]-- -16 = --[9]-- -17 = --[10]-- -18 = --[-11]-- - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp deleted file mode 100644 index df36afedca8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// This example demonstrates StringBuilder.Remove() -// -using namespace System; -using namespace System::Text; -int main() -{ - String^ rule1 = "0----+----1----+----2----+----3----+----4---"; - String^ rule2 = "01234567890123456789012345678901234567890123"; - String^ str = "The quick brown fox jumps over the lazy dog."; - StringBuilder^ sb = gcnew StringBuilder( str ); - Console::WriteLine(); - Console::WriteLine( "StringBuilder.Remove method" ); - Console::WriteLine(); - Console::WriteLine( "Original value:" ); - Console::WriteLine( rule1 ); - Console::WriteLine( rule2 ); - Console::WriteLine( "{0}", sb ); - Console::WriteLine(); - sb->Remove( 10, 6 ); // Remove "brown " - Console::WriteLine( "New value:" ); - Console::WriteLine( rule1 ); - Console::WriteLine( rule2 ); - Console::WriteLine( "{0}", sb ); -} - -/* -This example produces the following results: - -StringBuilder.Remove method - -Original value: -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick brown fox jumps over the lazy dog. - -New value: -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick fox jumps over the lazy dog. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp deleted file mode 100644 index 56420a34a24..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// This example demonstrates StringBuilder.Replace() -// -using namespace System; -using namespace System::Text; -void Show( StringBuilder^ sbs ) -{ - String^ rule1 = "0----+----1----+----2----+----3----+----4---"; - String^ rule2 = "01234567890123456789012345678901234567890123"; - Console::WriteLine( rule1 ); - Console::WriteLine( rule2 ); - Console::WriteLine( "{0}", sbs ); - Console::WriteLine(); -} - -int main() -{ - - // 0----+----1----+----2----+----3----+----4--- - // 01234567890123456789012345678901234567890123 - String^ str = "The quick br!wn d#g jumps #ver the lazy cat."; - StringBuilder^ sb = gcnew StringBuilder( str ); - Console::WriteLine(); - Console::WriteLine( "StringBuilder.Replace method" ); - Console::WriteLine(); - Console::WriteLine( "Original value:" ); - Show( sb ); - sb->Replace( '#', '!', 15, 29 ); // Some '#' -> '!' - Show( sb ); - sb->Replace( '!', 'o' ); // All '!' -> 'o' - Show( sb ); - sb->Replace( "cat", "dog" ); // All "cat" -> "dog" - Show( sb ); - sb->Replace( "dog", "fox", 15, 20 ); // Some "dog" -> "fox" - Console::WriteLine( "Final value:" ); - Show( sb ); -} - -/* -This example produces the following results: - -StringBuilder.Replace method - -Original value: -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick br!wn d#g jumps #ver the lazy cat. - -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick br!wn d!g jumps !ver the lazy cat. - -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick brown dog jumps over the lazy cat. - -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick brown dog jumps over the lazy dog. - -Final value: -0----+----1----+----2----+----3----+----4--- -01234567890123456789012345678901234567890123 -The quick brown fox jumps over the lazy dog. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp deleted file mode 100644 index 9f50fa95027..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; - -int main() -{ - - // Make an array of strings. Note that we have included spaces. - array^s = { "hello ", "and ", "welcome ", "to ", - "this ", "demo! "}; - - // Put all the strings together. - Console::WriteLine( String::Concat(s) ); - - // Sort the strings, and put them together. - Array::Sort( s ); - Console::WriteLine( String::Concat(s)); -} -// The example displays the following output: -// hello and welcome to this demo! -// and demo! hello this to welcome -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp deleted file mode 100644 index a8d0614ca35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -int main() -{ - - // we want to simply quickly add this person's name together - String^ fName = "Simon"; - String^ mName = "Jake"; - String^ lName = "Harrows"; - - // because we want a name to appear with a space in between each name, - // put a space on the front of the middle, and last name, allowing for - // the fact that a space may already be there - mName = String::Concat( " ", mName->Trim() ); - lName = String::Concat( " ", lName->Trim() ); - - // this line simply concatenates the two strings - Console::WriteLine( "Welcome to this page, '{0}'!", String::Concat( String::Concat( fName, mName ), lName ) ); -} -// The example displays the following output: -// Welcome to this page, 'Simon Jake Harrows'! -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp b/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp deleted file mode 100644 index 683bae6c061..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -int main() -{ - - // Embed an array of characters in a string - String^ strSource = "changed"; - array^destination = {'T','h','e',' ','i','n','i','t','i','a','l',' ','a','r','r','a','y'}; - - // Print the char array - Console::WriteLine( destination ); - - // Embed the source string in the destination string - strSource->CopyTo( 0, destination, 4, strSource->Length ); - - // Print the resulting array - Console::WriteLine( destination ); - strSource = "A different string"; - - // Embed only a section of the source string in the destination - strSource->CopyTo( 2, destination, 3, 9 ); - - // Print the resulting array - Console::WriteLine( destination ); -} -// The example displays the following output: -// The initial array -// The changed array -// Thedifferentarray -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp deleted file mode 100644 index da9802a9dc7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -String^ StripEndTags( String^ item ) -{ - bool found = false; - - // try to find a tag at the end of the line using EndsWith - if ( item->Trim()->EndsWith( ">" ) ) - { - - // now search for the opening tag... - int lastLocation = item->LastIndexOf( "= 0 ) { - item = item->Substring( 0, lastLocation ); - found = true; - } - } - - if (found) item = StripEndTags(item); - - return item; -} - -int main() -{ - - // process an input file that contains html tags. - // this sample checks for multiple tags at the end of the line, rather than simply - // removing the last one. - // note: HTML markup tags always end in a greater than symbol (>). - array^strSource = {"This is bold text","

This is large Text

","This has multiple tags","This has embedded tags.","This line simply ends with a greater than symbol, it should not be modified>"}; - Console::WriteLine( "The following lists the items before the ends have been stripped:" ); - Console::WriteLine( "-----------------------------------------------------------------" ); - - // print out the initial array of strings - IEnumerator^ myEnum1 = strSource->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ s = safe_cast(myEnum1->Current); - Console::WriteLine( s ); - } - - Console::WriteLine(); - Console::WriteLine( "The following lists the items after the ends have been stripped:" ); - Console::WriteLine( "----------------------------------------------------------------" ); - - // Display the array of strings. - IEnumerator^ myEnum2 = strSource->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ s = safe_cast(myEnum2->Current); - Console::WriteLine( StripEndTags( s ) ); - } -} -// The example displays the following output: -// The following lists the items before the ends have been stripped: -// ----------------------------------------------------------------- -// This is bold text -//

This is large Text

-// This has multiple tags -// This has embedded tags. -// This line simply ends with a greater than symbol, it should not be modified> -// -// The following lists the items after the ends have been stripped: -// ---------------------------------------------------------------- -// This is bold text -//

This is large Text -// This has multiple tags -// This has embedded tags. -// This line simply ends with a greater than symbol, it should not be modified> -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp deleted file mode 100644 index 4f76320ec42..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// This is the main project file for VC++ application project -// generated using an Application Wizard. -#define _UNICODE - -#include - -using namespace System; -using namespace System::Text; - -// This is the entry point for this application -int _tmain( void ) -{ - // - // Unicode Mathematical operators - wchar_t charArray1[4] = {L'\x2200',L'\x2202',L'\x200F',L'\x2205'}; - wchar_t * lptstr1 = &charArray1[ 0 ]; - String^ wszMathSymbols = gcnew String( lptstr1 ); - - // Unicode Letterlike Symbols - wchar_t charArray2[4] = {L'\x2111',L'\x2118',L'\x2122',L'\x2126'}; - wchar_t * lptstr2 = &charArray2[ 0 ]; - String^ wszLetterLike = gcnew String( lptstr2 ); - - // Compare Strings - the result is false - Console::WriteLine( String::Concat( L"The Strings are equal? ", (0 == String::Compare( wszLetterLike, wszMathSymbols ) ? (String^)"TRUE" : "FALSE") ) ); - // - - // - // Null terminated ASCII characters in a simple char array - char charArray3[4] = {0x41,0x42,0x43,0x00}; - char * pstr3 = &charArray3[ 0 ]; - String^ szAsciiUpper = gcnew String( pstr3 ); - char charArray4[4] = {0x61,0x62,0x63,0x00}; - char * pstr4 = &charArray4[ 0 ]; - String^ szAsciiLower = gcnew String( pstr4,0,sizeof(charArray4) ); - - // Prints "ABC abc" - Console::WriteLine( String::Concat( szAsciiUpper, " ", szAsciiLower ) ); - - // Compare Strings - the result is true - Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper->ToUpper(), szAsciiLower->ToUpper() ) ? (String^)"TRUE" : "FALSE") ) ); - - // This is the effective equivalent of another Compare method, which ignores case - Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper, szAsciiLower, true ) ? (String^)"TRUE" : "FALSE") ) ); - // - - // - // Create a Unicode String with 5 Greek Alpha characters - String^ szGreekAlpha = gcnew String( L'\x0391',5 ); - - // Create a Unicode String with a Greek Omega character - wchar_t charArray5[3] = {L'\x03A9',L'\x03A9',L'\x03A9'}; - String^ szGreekOmega = gcnew String( charArray5,2,1 ); - String^ szGreekLetters = String::Concat( szGreekOmega, szGreekAlpha, szGreekOmega->Clone() ); - - // Examine the result - Console::WriteLine( szGreekLetters ); - - // The first index of Alpha - int ialpha = szGreekLetters->IndexOf( L'\x0391' ); - - // The last index of Omega - int iomega = szGreekLetters->LastIndexOf( L'\x03A9' ); - Console::WriteLine( String::Concat( "The Greek letter Alpha first appears at index ", Convert::ToString( ialpha ) ) ); - Console::WriteLine( String::Concat( " and Omega last appears at index ", Convert::ToString( iomega ), " in this String." ) ); - // - - // - char asciiChars[6] = {0x51,0x52,0x53,0x54,0x54,0x56}; - char * pstr6 = &asciiChars[ 0 ]; - UTF8Encoding^ encoding = gcnew UTF8Encoding( true,true ); - String^ utfeightstring = gcnew String( pstr6,0,sizeof(asciiChars),encoding ); - - // prints "QRSTTV" - Console::WriteLine( String::Concat( "The UTF8 String is ", utfeightstring ) ); - // - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp b/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp deleted file mode 100644 index 9ca351899a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ strSource = "This is the string which we will perform the search on"; - Console::WriteLine( "The search string is: {0}\"{1}\" {0}", Environment::NewLine, strSource ); - String^ strTarget = ""; - int found = 0; - int totFinds = 0; - do - { - Console::Write( "Please enter a search value to look for in the above string (hit Enter to exit) ==> " ); - strTarget = Console::ReadLine(); - if ( !strTarget->Equals( "" ) ) - { - for ( int i = 0; i < strSource->Length; i++ ) - { - found = strSource->IndexOf( strTarget, i ); - if (found >= 0) - { - totFinds++; - i = found; - } - else - break; - - } - } - else - return 0; - Console::WriteLine( "{0}The search parameter '{1}' was found {2} times. {0}", Environment::NewLine, strTarget, totFinds ); - totFinds = 0; - } - while ( true ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp b/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp deleted file mode 100644 index 1bd127d5ce3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; - -int main() -{ - String^ animal1 = "fox"; - String^ animal2 = "dog"; - String^ strTarget = String::Format( "The {0} jumps over the {1}.", animal1, animal2 ); - Console::WriteLine( "The original string is:{0}{1}{0}", Environment::NewLine, strTarget ); - Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal1 ); - String^ adj1 = Console::ReadLine(); - Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal2 ); - String^ adj2 = Console::ReadLine(); - adj1 = String::Concat( adj1->Trim(), " " ); - adj2 = String::Concat( adj2->Trim(), " " ); - strTarget = strTarget->Insert( strTarget->IndexOf( animal1 ), adj1 ); - strTarget = strTarget->Insert( strTarget->IndexOf( animal2 ), adj2 ); - Console::WriteLine( " {0}The final string is: {0} {1}", Environment::NewLine, strTarget ); -} -// Output from the example might appear as follows: -// The original string is: -// The fox jumps over the dog. -// -// Enter an adjective (or group of adjectives) to describe the fox: ==> bold -// Enter an adjective (or group of adjectives) to describe the dog: ==> lazy -// -// The final string is: -// The bold fox jumps over the lazy dog. -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp b/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp deleted file mode 100644 index 8f6a431148c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -String^ MakeLine( int initVal, int multVal, String^ sep ) -{ - array^sArr = gcnew array(10); - for ( int i = initVal; i < initVal + 10; i++ ) - sArr[ i - initVal ] = String::Format( "{0, -3}", i * multVal ); - return String::Join( sep, sArr ); -} - -int main() -{ - Console::WriteLine( MakeLine( 0, 5, ", " ) ); - Console::WriteLine( MakeLine( 1, 6, " " ) ); - Console::WriteLine( MakeLine( 9, 9, ": " ) ); - Console::WriteLine( MakeLine( 4, 7, "< " ) ); -} -// The example displays the following output: -// 0 , 5 , 10 , 15 , 20 , 25 , 30 , 35 , 40 , 45 -// 6 12 18 24 30 36 42 48 54 60 -// 81 : 90 : 99 : 108: 117: 126: 135: 144: 153: 162 -// 28 < 35 < 42 < 49 < 56 < 63 < 70 < 77 < 84 < 91 -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp b/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp deleted file mode 100644 index 4ea0b86e8aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -int main() -{ - array^info = {"Name","Title","Age","Location","Gender"}; - Console::WriteLine( "The initial values in the array are:" ); - IEnumerator^ myEnum = info->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ s = safe_cast(myEnum->Current); - Console::WriteLine( s ); - } - - Console::WriteLine( " {0}The lowercase of these values is:", Environment::NewLine ); - IEnumerator^ myEnum1 = info->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ s = safe_cast(myEnum1->Current); - Console::WriteLine( s->ToLower() ); - } - - Console::WriteLine( " {0}The uppercase of these values is:", Environment::NewLine ); - IEnumerator^ myEnum2 = info->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ s = safe_cast(myEnum2->Current); - Console::WriteLine( s->ToUpper() ); - } -} -// The example displays the following output: -// The initial values in the array are: -// Name -// Title -// Age -// Location -// Gender -// -// The lowercase of these values is: -// name -// title -// age -// location -// gender -// -// The uppercase of these values is: -// NAME -// TITLE -// AGE -// LOCATION -// GENDER -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp b/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp deleted file mode 100644 index 4960d17021a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ name = "Michelle Violet Banks"; - Console::WriteLine( "The entire name is '{0}'", name ); - - // remove the middle name, identified by finding the spaces in the middle of the name->->. - int foundS1 = name->IndexOf( " " ); - int foundS2 = name->IndexOf( " ", foundS1 + 1 ); - if ( foundS1 != foundS2 && foundS1 >= 0 ) - { - name = name->Remove( foundS1 + 1, foundS2 - foundS1 ); - Console::WriteLine( "After removing the middle name, we are left with '{0}'", name ); - } -} -// The example displays the following output: -// The entire name is 'Michelle Violet Banks' -// After removing the middle name, we are left with 'Michelle Banks' -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp b/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp deleted file mode 100644 index 4d7cac7c4d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ errString = "This docment uses 3 other docments to docment the docmentation"; - Console::WriteLine( "The original string is:\n'{0}'\n", errString ); - - // Correct the spelling of S"document". - String^ correctString = errString->Replace( "docment", "document" ); - Console::WriteLine( "After correcting the string, the result is:\n'{0}'", correctString ); -} -// -// This code example produces the following output: -// -// The original string is: -// 'This docment uses 3 other docments to docment the docmentation' -// -// After correcting the string, the result is: -// 'This document uses 3 other documents to document the documentation' -// -// diff --git a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp deleted file mode 100644 index 66a53e4c6dc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -using namespace System; - -String^ StripStartTags( String^ item ) -{ - // Determine whether a tag begins the string. - if (item->Trim()->StartsWith("<")) { - // Find the closing tag. - int lastLocation = item->IndexOf(">"); - - // Remove the tag. - if ( lastLocation >= 0 ) { - item = item->Substring(lastLocation+ 1); - - // Remove any additional starting tags. - item = StripStartTags(item); - } - } - - return item; -} - -int main() -{ - array^ strSource = { "This is bold text", - "

This is large Text

", - "This has multiple tags", - "This has embedded tags.", - "This is bold text
-//

This is large Text

-// This has multiple tags -// This has embedded tags. -// -// This is large Text

-// This has multiple tags -// This has embedded tags.
-// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp deleted file mode 100644 index 7af27ada416..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// This example demonstrates the NativeDigits property. - -using namespace System; -using namespace System::Globalization; -using namespace System::Threading; - -int main() -{ - CultureInfo^ currentCI = Thread::CurrentThread->CurrentCulture; - NumberFormatInfo^ nfi = currentCI->NumberFormat; - array^ nativeDigitList = nfi->NativeDigits; - - Console::WriteLine("The native digits for the {0} culture are:", - currentCI->Name); - - for each (String^ nativeDigit in nativeDigitList) - { - Console::Write("\"{0}\" ", nativeDigit); - } - - Console::WriteLine(); -} -/* -This code example produces the following results: - -The native digits for the en-US culture are: -"0" "1" "2" "3" "4" "5" "6" "7" "8" "9" - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp deleted file mode 100644 index 415a49fc640..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -namespace CalendarTypeExample -{ - static void Display(Calendar^ genericCalendar) - { - String^ calendarName = - genericCalendar->ToString()->PadRight(50, '.'); - Console::WriteLine("{0} {1}", calendarName, genericCalendar->GetType()); - } -} - -int main() -{ - GregorianCalendar^ gregorianCalendar = gcnew GregorianCalendar(); - HijriCalendar^ hijriCalendar = gcnew HijriCalendar(); - JapaneseLunisolarCalendar^ japaneseCalendar = - gcnew JapaneseLunisolarCalendar(); - CalendarTypeExample::Display(gregorianCalendar); - CalendarTypeExample::Display(hijriCalendar); - CalendarTypeExample::Display(japaneseCalendar); - return 0; -} - -/* This code example produces the following output. - -System.Globalization.GregorianCalendar............ System.Globalization.GregorianCalendar -System.Globalization.HijriCalendar................ System.Globalization.HijriCalendar -System.Globalization.JapaneseLunisolarCalendar.... System.Globalization.JapaneseLunisolarCalendar - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp deleted file mode 100644 index 0e754047e7d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// This example demonstrates a System.Globalization.Culture- -// AndRegionInfoBuilder constructor and some of the properties -// of a custom culture object created with the constructor. - -#using - -using namespace System; -using namespace System::Globalization; - -int main() -{ - CultureAndRegionInfoBuilder^ builder = - gcnew CultureAndRegionInfoBuilder - ("x-en-US-sample", CultureAndRegionModifiers::None); - - // Display some of the properties - // for the en-US culture. - Console::WriteLine("CultureName:. . . . . . . . . . {0}", - builder->CultureName); - Console::WriteLine("CultureEnglishName: . . . . . . {0}", - builder->CultureEnglishName); - Console::WriteLine("CultureNativeName:. . . . . . . {0}", - builder->CultureNativeName); - Console::WriteLine("GeoId:. . . . . . . . . . . . . {0}", - builder->GeoId); - Console::WriteLine("IsMetric: . . . . . . . . . . . {0}", - builder->IsMetric); - Console::WriteLine("ISOCurrencySymbol:. . . . . . . {0}", - builder->ISOCurrencySymbol); - Console::WriteLine("RegionEnglishName:. . . . . . . {0}", - builder->RegionEnglishName); - Console::WriteLine("RegionName: . . . . . . . . . . {0}", - builder->RegionName); - Console::WriteLine("RegionNativeName: . . . . . . . {0}", - builder->RegionNativeName); - Console::WriteLine("ThreeLetterISOLanguageName: . . {0}", - builder->ThreeLetterISOLanguageName); - Console::WriteLine("ThreeLetterISORegionName: . . . {0}", - builder->ThreeLetterISORegionName); - Console::WriteLine("ThreeLetterWindowsLanguageName: {0}", - builder->ThreeLetterWindowsLanguageName); - Console::WriteLine("ThreeLetterWindowsRegionName: . {0}", - builder->ThreeLetterWindowsRegionName); - Console::WriteLine("TwoLetterISOLanguageName: . . . {0}", - builder->TwoLetterISOLanguageName); - Console::WriteLine("TwoLetterISORegionName: . . . . {0}", - builder->TwoLetterISORegionName); -} - -/* -This code example produces the following results: - -CultureName:. . . . . . . . . . en-US -CultureEnglishName: . . . . . . English (United States) -CultureNativeName:. . . . . . . English (United States) -GeoId:. . . . . . . . . . . . . 244 -IsMetric: . . . . . . . . . . . False -ISOCurrencySymbol:. . . . . . . USD -RegionEnglishName:. . . . . . . United States -RegionName: . . . . . . . . . . US -RegionNativeName: . . . . . . . United States -ThreeLetterISOLanguageName: . . eng -ThreeLetterISORegionName: . . . USA -ThreeLetterWindowsLanguageName: ENU -ThreeLetterWindowsRegionName: . USA -TwoLetterISOLanguageName: . . . en -TwoLetterISORegionName: . . . . US - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp deleted file mode 100644 index 846861d5752..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -// This example demonstrates the GetConsoleFallbackUICulture() method -using namespace System; -using namespace System::Globalization; - -int main() -{ - CultureInfo^ ci = gcnew CultureInfo("ar-DZ"); - Console::WriteLine("Culture name: . . . . . . . . . {0}", ci->Name); - Console::WriteLine("Console fallback UI culture:. . {0}", - ci->GetConsoleFallbackUICulture()->Name); -} -/* -This code example produces the following results: - -Culture name: . . . . . . . . . ar-DZ -Console fallback UI culture:. . fr-FR - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp deleted file mode 100644 index 573d82f64eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -// This example demonstrates the RegionInfo.EnglishName, NativeName, -// CurrencyEnglishName, CurrencyNativeName, and GeoId properties. - -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Regional Info for Sweden - RegionInfo^ ri = gcnew RegionInfo("SE"); - - Console::WriteLine("Region English Name: . . . {0}", ri->EnglishName); - Console::WriteLine("Native Name: . . . . . . . {0}", ri->NativeName); - Console::WriteLine("Currency English Name: . . {0}", - ri->CurrencyEnglishName); - Console::WriteLine("Currency Native Name:. . . {0}", - ri->CurrencyNativeName); - Console::WriteLine("Geographical ID: . . . . . {0}", ri->GeoId); -} -/* -This code example produces the following results: - -Region English Name: . . . Sweden -Native Name: . . . . . . . Sverige -Currency English Name: . . Swedish Krona -Currency Native Name:. . . Svensk krona -Geographical ID: . . . . . 221 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp deleted file mode 100644 index 6728f14abce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// -// This example demonstrates the DecoderExceptionFallback class. - -using namespace System; -using namespace System::Text; - -int main() -{ - // Create an encoding, which is equivalent to calling the - // ASCIIEncoding class constructor. - // The DecoderExceptionFallback parameter specifies that an exception - // is thrown if a character cannot be encoded. - // An encoder exception fallback is also specified, but in this code - // example the encoding operation cannot fail. - - Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii", - gcnew EncoderExceptionFallback(), gcnew DecoderExceptionFallback()); - String^ inputString = "XYZ"; - String^ decodedString; - String^ twoNewLines = Environment::NewLine + Environment::NewLine ; - - array^ encodedBytes = - gcnew array(asciiEncoding->GetByteCount(inputString)); - int numberOfEncodedBytes = 0; - - // --------------------------------------------------------------------- - Console::Clear(); - - // Display the name of the encoding. - Console::WriteLine("The name of the encoding is \"{0}\".{1}", - asciiEncoding->WebName, Environment::NewLine); - - // Display the input string in text. - Console::WriteLine("Input string ({0} characters): \"{1}\"", - inputString->Length, inputString); - - // Display the input string in hexadecimal. - Console::Write("Input string in hexadecimal: "); - for each (char c in inputString) - { - Console::Write("0x{0:X2} ", c); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Encode the input string. - - Console::WriteLine("Encode the input string..."); - - numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0, - inputString->Length, encodedBytes, 0); - - // Display the encoded bytes. - Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", - numberOfEncodedBytes, Environment::NewLine); - for each (Byte b in encodedBytes) - { - Console::Write("0x{0:X2} ", b); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - - // Replace the encoded byte sequences for the characters 'X' and 'Z' - // with the value 0xFF, which is outside the valid range of 0x00 to 0x7F - // for ASCIIEncoding. The resulting byte sequence is actually the - // beginning of this code example because it is the input to the decoder - // operation, and is equivalent to a corrupted or improperly encoded - // byte sequence. - - encodedBytes[0] = 0xFF; - encodedBytes[2] = 0xFF; - - Console::WriteLine("Display the corrupted byte sequence..."); - Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", - numberOfEncodedBytes, Environment::NewLine); - for each (Byte b in encodedBytes) - { - Console::Write("0x{0:X2} ", b); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Attempt to decode the encoded bytes. However, an exception is thrown - // before the byte sequence can be decoded. - - Console::WriteLine("Compare the decoded bytes to the input string..."); - - try - { - decodedString = asciiEncoding->GetString(encodedBytes); - // This statement is never executed. - Console::WriteLine("This statement is never executed."); - } - catch (DecoderFallbackException^ ex) - { - Console::WriteLine(ex); - Console::WriteLine( - "{0}*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***", - Environment::NewLine); - } -} - - -/* -This code example produces the following results: - -The name of the encoding is "us-ascii". - -Input string (3 characters): "XYZ" -Input string in hexadecimal: 0x58 0x59 0x5A - -Encode the input string... -Encoded bytes in hexadecimal (3 bytes): - -0x58 0x59 0x5A - -Display the corrupted byte sequence... -Encoded bytes in hexadecimal (3 bytes): - -0xFF 0x59 0xFF - -Compare the decoded bytes to the input string... -System.Text.DecoderFallbackException: Unable to translate bytes [FF] at index 0 from speci -fied code page to Unicode. -at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index) -at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index -) -at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes) -at System.Text.ASCIIEncoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS decoder) - -at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encod -ing) -at System.Text.ASCIIEncoding.GetString(Byte[] bytes, Int32 byteIndex, Int32 byteCount) -at System.Text.Encoding.GetString(Byte[] bytes) -at Sample.Main() - -*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. *** - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp deleted file mode 100644 index 332c5a91b7d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// -// This example demonstrates the DecoderReplacementFallback class. - -using namespace System; -using namespace System::Text; - -int main() -{ - // Create an encoding, which is equivalent to calling the - // ASCIIEncoding class constructor. - // The DecoderReplacementFallback parameter specifies that the - // string "(error)" is to replace characters that cannot be decoded. - // An encoder replacement fallback is also specified, but in this code - // example the encoding operation cannot fail. - - Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii", - gcnew EncoderReplacementFallback("(unknown)"), - gcnew DecoderReplacementFallback("(error)")); - String^ inputString = "XYZ"; - String^ decodedString; - String^ twoNewLines = Environment::NewLine + Environment::NewLine; - array^ encodedBytes = gcnew array( - asciiEncoding->GetByteCount(inputString)); - int numberOfEncodedBytes = 0; - - // --------------------------------------------------------------------- - Console::Clear(); - - // Display the name of the encoding. - Console::WriteLine("The name of the encoding is \"{0}\".{1}", - asciiEncoding->WebName, Environment::NewLine); - - // Display the input string in text. - Console::WriteLine("Input string ({0} characters): \"{1}\"", - inputString->Length, inputString); - - // Display the input string in hexadecimal. - Console::Write("Input string in hexadecimal: "); - for each (char c in inputString) - { - Console::Write("0x{0:X2} ", c); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Encode the input string. - - Console::WriteLine("Encode the input string..."); - numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0, - inputString->Length, encodedBytes, 0); - - // Display the encoded bytes. - Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", - numberOfEncodedBytes, Environment::NewLine); - for each (Byte b in encodedBytes) - { - Console::Write("0x{0:X2} ", b); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - - // Replace the encoded byte sequences for the characters 'X' and 'Z' - // with the value 0xFF, which is outside the valid range of 0x00 to 0x7F - // for ASCIIEncoding. The resulting byte sequence is actually the - // beginning of this code example because it is the input to the decoder - // operation, and is equivalent to a corrupted or improperly encoded - // byte sequence. - - encodedBytes[0] = 0xFF; - encodedBytes[2] = 0xFF; - - Console::WriteLine("Display the corrupted byte sequence..."); - Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", - numberOfEncodedBytes, Environment::NewLine); - for each (Byte b in encodedBytes) - { - Console::Write("0x{0:X2} ", b); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Decode the encoded bytes. - - Console::WriteLine("Compare the decoded bytes to the input string..."); - decodedString = asciiEncoding->GetString(encodedBytes); - - // Display the input string and the decoded string for comparison. - Console::WriteLine("Input string: \"{0}\"", inputString); - Console::WriteLine("Decoded string:\"{0}\"", decodedString); -} -/* -This code example produces the following results: - -The name of the encoding is "us-ascii". - -Input string (3 characters): "XYZ" -Input string in hexadecimal: 0x58 0x59 0x5A - -Encode the input string... -Encoded bytes in hexadecimal (3 bytes): - -0x58 0x59 0x5A - -Display the corrupted byte sequence... -Encoded bytes in hexadecimal (3 bytes): - -0xFF 0x59 0xFF - -Compare the decoded bytes to the input string... -Input string: "XYZ" -Decoded string:"(error)Y(error)" - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp deleted file mode 100644 index 3207d7a7fb2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// -// This example demonstrates the EncoderExceptionFallback class. - -using namespace System; -using namespace System::Text; - -int main() -{ - // Create an encoding, which is equivalent to calling the - // ASCIIEncoding class constructor. - // The EncoderExceptionFallback parameter causes an exception to - // be thrown when a character cannot be encoded. - // A decoder exception fallback is also specified, but it is not - // used because this example terminates during the encoding operation. - - Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii", - gcnew EncoderExceptionFallback(), gcnew DecoderExceptionFallback()); - - // The input string consists of the Unicode characters LEFT POINTING - // DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT - // POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB). - // The encoding can only encode characters in the US-ASCII range of - // U+0000 through U+007F. Consequently, the characters bracketing the - // 'X' character cause an exception. - String^ inputString = L"\u00abX\u00bb"; - - String^ twoNewLines = Environment::NewLine + Environment::NewLine; - array^ encodedBytes = gcnew array( - asciiEncoding->GetMaxByteCount(inputString->Length)); - int numberOfEncodedBytes = 0; - - // --------------------------------------------------------------------- - Console::Clear(); - - // Display the name of the encoding. - Console::WriteLine("The name of the encoding is \"{0}\".{1}", - asciiEncoding->WebName, Environment::NewLine); - - // Display the input string in text. - Console::WriteLine("Input string ({0} characters): \"{1}\"", - inputString->Length, inputString); - - // Display the input string in hexadecimal. - Console::Write("Input string in hexadecimal: "); - for each (char c in inputString) - { - Console::Write("0x{0:X2} ", c); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Attempt to encode the input string. However, an exception is thrown - // before the input string can be encoded. - - Console::WriteLine("Encode the input string..."); - - // The code example terminates during the call to the GetBytes() method. - try - { - numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0, - inputString->Length, encodedBytes, 0); - // This statement is never executed. - Console::WriteLine("This statement is never executed."); - } - catch (EncoderFallbackException^ ex) - { - Console::WriteLine(ex); - Console::WriteLine( - "{0}*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***", - Environment::NewLine); - } -} - -/* -This code example produces the following results: - -The name of the encoding is "us-ascii". - -Input string (3 characters): "X" -Input string in hexadecimal: 0xAB 0x58 0xBB - -Encode the input string... -System.Text.EncoderFallbackException: Unable to translate Unicode character \u00AB at inde -x 0 to specified code page. -at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) -at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars) -at System.Text.ASCIIEncoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 -byteCount, EncoderNLS encoder) -at System.Text.ASCIIEncoding.GetBytes(String chars, Int32 charIndex, Int32 charCount, B -yte[] bytes, Int32 byteIndex) -at Sample.Main() - -*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. *** - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp deleted file mode 100644 index ec4a3456bd1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -// This example demonstrates the EncoderReplacementFallback class. - -using namespace System; -using namespace System::Text; - -int main() -{ - // Create an encoding, which is equivalent to calling the - // ASCIIEncoding class constructor. - // The EncoderReplacementFallback parameter specifies that the - // string, "(unknown)", replace characters that cannot be encoded. - // A decoder replacement fallback is also specified, but in this - // code example the decoding operation cannot fail. - - Encoding^ ascii = Encoding::GetEncoding("us-ascii", - gcnew EncoderReplacementFallback("(unknown)"), - gcnew DecoderReplacementFallback("(error)")); - - // The input string consists of the Unicode characters LEFT POINTING - // DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT - // POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB). - // The encoding can only encode characters in the US-ASCII range of - // U+0000 through U+007F. Consequently, the characters bracketing the - // 'X' character are replaced with the fallback replacement string, - // "(unknown)". - - String^ inputString = "\u00abX\u00bb"; - String^ decodedString; - String^ twoNewLines = Environment::NewLine + Environment::NewLine; - array ^ encodedBytes = - gcnew array(ascii->GetByteCount(inputString)); - int numberOfEncodedBytes = 0; - - // --------------------------------------------------------------------- - // Display the name of the encoding. - Console::WriteLine("The name of the encoding is \"{0}\".{1}", - ascii->WebName, Environment::NewLine); - - // Display the input string in text. - Console::WriteLine("Input string ({0} characters): \"{1}\"", - inputString->Length, inputString); - - // Display the input string in hexadecimal. - Console::Write("Input string in hexadecimal: "); - for each (char c in inputString) - { - Console::Write("0x{0:X2} ", c); - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Encode the input string. - - Console::WriteLine("Encode the input string..."); - numberOfEncodedBytes = ascii->GetBytes(inputString, 0, inputString->Length, - encodedBytes, 0); - - // Display the encoded bytes. - Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", - numberOfEncodedBytes, Environment::NewLine); - for(int i = 0; i < encodedBytes->Length; i++) - { - Console::Write("0x{0:X2} ", encodedBytes[i]); - if(((i + 1) % 6) == 0) - { - Console::WriteLine(); - } - } - Console::Write(twoNewLines); - - // --------------------------------------------------------------------- - // Decode the encoded bytes, yielding a reconstituted string. - - Console::WriteLine("Decode the encoded bytes..."); - decodedString = ascii->GetString(encodedBytes); - - // Display the input string and the decoded string for comparison. - Console::WriteLine("Input string: \"{0}\"", inputString); - Console::WriteLine("Decoded string:\"{0}\"", decodedString); -} - - - -/* -This code example produces the following results: - -The name of the encoding is "us-ascii". - -Input string (3 characters): "X" -Input string in hexadecimal: 0xAB 0x58 0xBB - -Encode the input string... -Encoded bytes in hexadecimal (19 bytes): - -0x28 0x75 0x6E 0x6B 0x6E 0x6F -0x77 0x6E 0x29 0x58 0x28 0x75 -0x6E 0x6B 0x6E 0x6F 0x77 0x6E -0x29 - -Decode the encoded bytes... -Input string: "X" -Decoded string:"(unknown)X(unknown)" - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp deleted file mode 100644 index 79399d8f51e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -int main() -{ - for (int i = 0; i < 5; i++) - { - Console::WriteLine("Sleep for 2 seconds."); - Thread::Sleep(2000); - } - - Console::WriteLine("Main thread exits."); -} - -/* This example produces the following output: - -Sleep for 2 seconds. -Sleep for 2 seconds. -Sleep for 2 seconds. -Sleep for 2 seconds. -Sleep for 2 seconds. -Main thread exits. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp deleted file mode 100644 index 4f50e318256..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -int main() -{ - TimeSpan interval = TimeSpan(0, 0, 2); - - for (int i = 0; i < 5; i++) - { - Console::WriteLine("Sleep for 2 seconds."); - Thread::Sleep(interval); - } - - Console::WriteLine("Main thread exits."); -} - -/* This example produces the following output: - -Sleep for 2 seconds. -Sleep for 2 seconds. -Sleep for 2 seconds. -Sleep for 2 seconds. -Sleep for 2 seconds. -Main thread exits. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp deleted file mode 100644 index 552ea842e18..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; -using namespace System::Windows::Forms; - -int main() -{ - try - { - // Creates a bitmask based on BindingFlags. - BindingFlags myBindingFlags = static_cast(BindingFlags::Instance | BindingFlags::Public | BindingFlags::NonPublic); - Type^ myTypeBindingFlags = System::Windows::Forms::Button::typeid; - EventInfo^ myEventBindingFlags = myTypeBindingFlags->GetEvent( "Click", myBindingFlags ); - if ( myEventBindingFlags != nullptr ) - { - Console::WriteLine( "Looking for the Click event in the Button class with the specified BindingFlags." ); - Console::WriteLine( myEventBindingFlags ); - } - else - Console::WriteLine( "The Click event is not available with the Button class." ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "An exception occurred." ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp deleted file mode 100644 index f2daabba2aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -int main() -{ - try - { - Type^ myType = System::Windows::Forms::Button::typeid; - array^myEvents = myType->GetEvents(); - Console::WriteLine( "The events on the Button class are: " ); - for ( int index = 0; index < myEvents->Length; index++ ) - { - Console::WriteLine( myEvents[ index ] ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp deleted file mode 100644 index 2c09a6f7f39..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security; - -int main() -{ - try - { - - // Create a bitmask based on BindingFlags. - BindingFlags myBindingFlags = static_cast(BindingFlags::Instance | BindingFlags::Public); - Type^ myTypeEvent = System::Windows::Forms::Button::typeid; - array^myEventsBindingFlags = myTypeEvent->GetEvents( myBindingFlags ); - Console::WriteLine( "\nThe events on the Button class with the specified BindingFlags are:" ); - for ( int index = 0; index < myEventsBindingFlags->Length; index++ ) - { - Console::WriteLine( myEventsBindingFlags[ index ] ); - - } - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp deleted file mode 100644 index fbbf07e7429..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; - -int main() -{ -// - X509Chain^ ch = gcnew X509Chain(); - ch->ChainPolicy->ApplicationPolicy->Add(gcnew Oid("1.2.1.1")); -// - //Output chain information about the chain. - Console::WriteLine("Chain Information"); - ch->ChainPolicy->RevocationMode = X509RevocationMode::Online; - Console::WriteLine("Chain revocation flag: {0}", ch->ChainPolicy->RevocationFlag); - Console::WriteLine("Chain revocation mode: {0}", ch->ChainPolicy->RevocationMode); - Console::WriteLine("Chain verification flag: {0}", ch->ChainPolicy->VerificationFlags); - Console::WriteLine("Chain verification time: {0}", ch->ChainPolicy->VerificationTime); - Console::WriteLine("Chain status length: {0}", ch->ChainStatus->Length); - Console::WriteLine("Chain application policy count: {0}", ch->ChainPolicy->ApplicationPolicy->Count); - Console::WriteLine("Chain certificate policy count: {0} {1}", ch->ChainPolicy->CertificatePolicy->Count, Environment::NewLine); -} diff --git a/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp b/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp deleted file mode 100644 index 7b57914985d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; - -int main() -{ - // - //Create new X509 store from local certificate store. - X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser ); - store->Open( static_cast(OpenFlags::OpenExistingOnly | OpenFlags::ReadWrite) ); - - //Output store information. - Console::WriteLine( "Store Information" ); - Console::WriteLine( "Number of certificates in the store: {0}", store->Certificates->Count ); - Console::WriteLine( "Store location: {0}", store->Location ); - Console::WriteLine( "Store name: {0} {1}", store->Name, Environment::NewLine ); - - //Put certificates from the store into a collection so user can select one. - X509Certificate2Collection ^ fcollection = dynamic_cast(store->Certificates); - X509Certificate2Collection ^ collection = X509Certificate2UI::SelectFromCollection(fcollection, "Select an X509 Certificate","Choose a certificate to examine.",X509SelectionFlag::SingleSelection); - X509Certificate2 ^ certificate = collection[ 0 ]; - X509Certificate2UI::DisplayCertificate(certificate); - // - - // - //Output chain information of the selected certificate. - X509Chain ^ ch = gcnew X509Chain; - ch->ChainPolicy->RevocationMode = X509RevocationMode::Online; - ch->Build( certificate ); - Console::WriteLine( "Chain Information" ); - Console::WriteLine( "Chain revocation flag: {0}", ch->ChainPolicy->RevocationFlag ); - Console::WriteLine( "Chain revocation mode: {0}", ch->ChainPolicy->RevocationMode ); - Console::WriteLine( "Chain verification flag: {0}", ch->ChainPolicy->VerificationFlags ); - Console::WriteLine( "Chain verification time: {0}", ch->ChainPolicy->VerificationTime ); - Console::WriteLine( "Chain status length: {0}", ch->ChainStatus->Length ); - Console::WriteLine( "Chain application policy count: {0}", ch->ChainPolicy->ApplicationPolicy->Count ); - Console::WriteLine( "Chain certificate policy count: {0} {1}", ch->ChainPolicy->CertificatePolicy->Count, Environment::NewLine ); - // - - // - //Output chain element information. - Console::WriteLine( "Chain Element Information" ); - Console::WriteLine( "Number of chain elements: {0}", ch->ChainElements->Count ); - Console::WriteLine( "Chain elements synchronized? {0} {1}", ch->ChainElements->IsSynchronized, Environment::NewLine ); - System::Collections::IEnumerator^ myEnum = ch->ChainElements->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - X509ChainElement ^ element = safe_cast(myEnum->Current); - Console::WriteLine( "Element issuer name: {0}", element->Certificate->Issuer ); - Console::WriteLine( "Element certificate valid until: {0}", element->Certificate->NotAfter ); - Console::WriteLine( "Element certificate is valid: {0}", element->Certificate->Verify() ); - Console::WriteLine( "Element error status length: {0}", element->ChainElementStatus->Length ); - Console::WriteLine( "Element information: {0}", element->Information ); - Console::WriteLine( "Number of element extensions: {0}{1}", element->Certificate->Extensions->Count, Environment::NewLine ); - if ( ch->ChainStatus->Length > 1 ) - { - for ( int index = 0; index < element->ChainElementStatus->Length; index++ ) - { - Console::WriteLine( element->ChainElementStatus[ index ].Status ); - Console::WriteLine( element->ChainElementStatus[ index ].StatusInformation ); - } - } - } - - store->Close(); - // -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp b/snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp deleted file mode 100644 index e1db565ed35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp +++ /dev/null @@ -1,79 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; -int main() -{ - - //Create new X509 store called teststore from the local certificate store. - X509Store ^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser ); - store->Open( OpenFlags::ReadWrite ); - X509Certificate2 ^ certificate = gcnew X509Certificate2; - - //Create certificates from certificate files. - //You must put in a valid path to three certificates in the following constructors. - X509Certificate2 ^ certificate1 = gcnew X509Certificate2( "c:\\mycerts\\*****.cer" ); - X509Certificate2 ^ certificate2 = gcnew X509Certificate2( "c:\\mycerts\\*****.cer" ); - X509Certificate2 ^ certificate5 = gcnew X509Certificate2( "c:\\mycerts\\*****.cer" ); - - //Create a collection and add two of the certificates. - X509Certificate2Collection ^ collection = gcnew X509Certificate2Collection; - collection->Add( certificate2 ); - collection->Add( certificate5 ); - - //Add certificates to the store. - store->Add( certificate1 ); - store->AddRange( collection ); - X509Certificate2Collection ^ storecollection = dynamic_cast(store->Certificates); - Console::WriteLine( "Store name: {0}", store->Name ); - Console::WriteLine( "Store location: {0}", store->Location ); - System::Collections::IEnumerator^ myEnum = storecollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - X509Certificate2 ^ x509 = safe_cast(myEnum->Current); - Console::WriteLine( "certificate name: {0}", x509->Subject ); - } - - - //Remove a certificate. - store->Remove( certificate1 ); - X509Certificate2Collection ^ storecollection2 = dynamic_cast(store->Certificates); - Console::WriteLine( "{1}Store name: {0}", store->Name, Environment::NewLine ); - System::Collections::IEnumerator^ myEnum1 = storecollection2->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - X509Certificate2 ^ x509 = safe_cast(myEnum1->Current); - Console::WriteLine( "certificate name: {0}", x509->Subject ); - } - - - //Remove a range of certificates. - store->RemoveRange( collection ); - X509Certificate2Collection ^ storecollection3 = dynamic_cast(store->Certificates); - Console::WriteLine( "{1}Store name: {0}", store->Name, Environment::NewLine ); - if ( storecollection3->Count == 0 ) - { - Console::WriteLine( "Store contains no certificates." ); - } - else - { - System::Collections::IEnumerator^ myEnum2 = storecollection3->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - X509Certificate2 ^ x509 = safe_cast(myEnum2->Current); - Console::WriteLine( "certificate name: {0}", x509->Subject ); - } - } - - - //Close the store. - store->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp deleted file mode 100644 index 79226085d31..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: Form -{ -protected: - TextBox^ textBox1; - // - void GetComments() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); - // Print the comments in a text box. - textBox1->Text = "Comments: " + myFileVersionInfo->Comments; - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp deleted file mode 100644 index 2b2375d4317..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -namespace Ambiguity -{ - ref class Myambiguous - { - public: - - //The first overload is typed to an Int32 - static void Mymethod(Int32 number) - { - Console::WriteLine("I am from 'Int32' method"); - } - - //The second overload is typed to a String^ - static void Mymethod(String^ alpha) - { - Console::WriteLine("I am from 'String^' method."); - } - - static void Main() - { - try - { - //The following does not cause as exception - Mymethod(2); // goes to Mymethod (Int32) - Mymethod("3"); // goes to Mymethod (String*) - Type^ Mytype = Type::GetType("Ambiguity.Myambiguous"); - array^temp0 = {Int32::typeid}; - MethodInfo^ Mymethodinfo32 = Mytype->GetMethod("Mymethod", temp0); - array^temp1 = {System::String::typeid}; - MethodInfo^ Mymethodinfostr = Mytype->GetMethod("Mymethod", temp1); - - //Invoke a method, utilizing a Int32 integer - array^temp2 = {2}; - Mymethodinfo32->Invoke(nullptr, temp2); - - //Invoke the method utilizing a String^ - array^temp3 = {"1"}; - Mymethodinfostr->Invoke(nullptr, temp3); - - //The following line causes an ambiguous exception - MethodInfo^ Mymethodinfo = Mytype->GetMethod("Mymethod"); - } - catch (AmbiguousMatchException^ ex) - { - Console::WriteLine("\n{0}\n{1}", ex->GetType()->FullName, ex->Message); - } - catch (...) - { - Console::WriteLine("\nSome other exception."); - } - - return; - } - }; -} - -int main() -{ - Ambiguity::Myambiguous::Main(); -} - -//This code produces the following output: -// -// I am from 'Int32' method -// I am from 'String^' method. -// I am from 'Int32' method -// I am from 'String^' method. -// -// System.Reflection.AmbiguousMatchException -// Ambiguous match found. -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp deleted file mode 100644 index bc8df83efca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -using namespace System; - -void PrintValues(array^myArr); -void PrintValues(array^myArr); -void main() -{ - // Creates and initializes a new int array and a new Object array. - array^myIntArray = { 1,2,3,4,5 }; - array^myObjArray = { 26,27,28,29,30 }; - - // Prints the initial values of both arrays. - Console::WriteLine("Initially:"); - Console::Write("int array: "); - PrintValues(myIntArray); - Console::Write("Object array:"); - PrintValues(myObjArray); - - // Copies the first two elements from the int array to the Object array. - System::Array::Copy(myIntArray, myObjArray, 2); - - // Prints the values of the modified arrays. - Console::WriteLine("\nAfter copying the first two elements of the int array to the Object array:"); - Console::Write("int array: "); - PrintValues(myIntArray); - Console::Write("Object array:"); - PrintValues(myObjArray); - - // Copies the last two elements from the Object array to the int array. - System::Array::Copy(myObjArray, myObjArray->GetUpperBound(0) - 1, myIntArray, myIntArray->GetUpperBound(0) - 1, 2); - - // Prints the values of the modified arrays. - Console::WriteLine("\nAfter copying the last two elements of the Object array to the int array:"); - Console::Write("int array: "); - PrintValues(myIntArray); - Console::Write("Object array:"); - PrintValues(myObjArray); -} - -void PrintValues(array^myArr) -{ - for (int i = 0; i < myArr->Length; i++) - { - Console::Write("\t{0}", myArr[i]); - - } - Console::WriteLine(); -} - -void PrintValues(array^myArr) -{ - for (int i = 0; i < myArr->Length; i++) - { - Console::Write("\t{0}", myArr[i]); - - } - Console::WriteLine(); -} - - -/* -This code produces the following output. - -Initially: -int array: 1 2 3 4 5 -Object array: 26 27 28 29 30 -After copying the first two elements of the int array to the Object array: -int array: 1 2 3 4 5 -Object array: 1 2 28 29 30 -After copying the last two elements of the Object array to the int array: -int array: 1 2 3 29 30 -Object array: 1 2 28 29 30 -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp deleted file mode 100644 index 10f90aa8ae1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -using namespace System; -void PrintValues(Array^ myArr); -void main() -{ - // Creates and initializes a new three-dimensional Array instance of type Int32. - Array^ myArr = Array::CreateInstance( Int32::typeid, 2, 3, 4 ); - for ( int i = myArr->GetLowerBound( 0 ); i <= myArr->GetUpperBound( 0 ); i++ ) - { - for ( int j = myArr->GetLowerBound( 1 ); j <= myArr->GetUpperBound( 1 ); j++ ) - { - for ( int k = myArr->GetLowerBound( 2 ); k <= myArr->GetUpperBound( 2 ); k++ ) - myArr->SetValue( (i * 100) + (j * 10) + k, i, j, k ); - - } - } - - // Displays the properties of the Array. - Console::WriteLine( "The Array instance has {0} dimension(s) and a total of {1} elements.", myArr->Rank, myArr->Length ); - Console::WriteLine( "\tLength\tLower\tUpper" ); - for ( int i = 0; i < myArr->Rank; i++ ) - { - Console::Write( "{0}:\t{1}", i, myArr->GetLength( i ) ); - Console::WriteLine( "\t{0}\t{1}", myArr->GetLowerBound( i ), myArr->GetUpperBound( i ) ); - - } - Console::WriteLine( "The Array instance contains the following values:" ); - PrintValues( myArr ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - i++; - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The Array instance has 3 dimension(s) and a total of 24 elements. - Length Lower Upper - 0: 2 0 1 - 1: 3 0 2 - 2: 4 0 3 - The Array instance contains the following values: - 0 1 2 3 - 10 11 12 13 - 20 21 22 23 - 100 101 102 103 - 110 111 112 113 - 120 121 122 123 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp deleted file mode 100644 index 40db20d5eb6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -using namespace System; - -public ref class SamplesArray -{ -public: - static void Main() - { - // Creates and initializes a new Array. - Array^ myIntArray = Array::CreateInstance(Int32::typeid, 5); - - myIntArray->SetValue(8, 0); - myIntArray->SetValue(2, 1); - myIntArray->SetValue(6, 2); - myIntArray->SetValue(3, 3); - myIntArray->SetValue(7, 4); - - // Do the required sort first - Array::Sort(myIntArray); - - // Displays the values of the Array. - Console::WriteLine("The Int32 array contains the following:"); - PrintValues(myIntArray); - - // Locates a specific object that does not exist in the Array. - Object^ myObjectOdd = 1; - FindMyObject(myIntArray, myObjectOdd); - - // Locates an object that exists in the Array. - Object^ myObjectEven = 6; - FindMyObject(myIntArray, myObjectEven); - } - - static void FindMyObject(Array^ myArr, Object^ myObject) - { - int myIndex = Array::BinarySearch(myArr, myObject); - if (myIndex < 0) - { - Console::WriteLine("The object to search for ({0}) is not found. The next larger object is at index {1}.", myObject, ~myIndex); - } - else - { - Console::WriteLine("The object to search for ({0}) is at index {1}.", myObject, myIndex); - } - } - - static void PrintValues(Array^ myArr) - { - int i = 0; - int cols = myArr->GetLength(myArr->Rank - 1); - for each (Object^ o in myArr) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - Console::Write("\t{0}", o); - } - Console::WriteLine(); - } -}; - -int main() -{ - SamplesArray::Main(); -} -// This code produces the following output. -// -//The Int32 array contains the following: -// 2 3 6 7 8 -//The object to search for (1) is not found. The next larger object is at index 0 -// -//The object to search for (6) is at index 2. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp deleted file mode 100644 index 16882781c33..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -// -using namespace System; -void PrintValues( Array^ myArr ); -void main() -{ - - // Creates and initializes a new Array instance of type Int32. - Array^ myIntArray = Array::CreateInstance( Type::GetType( "System.Int32" ), 5 ); - for ( int i = myIntArray->GetLowerBound( 0 ); i <= myIntArray->GetUpperBound( 0 ); i++ ) - myIntArray->SetValue( i + 1, i ); - - // Creates and initializes a new Array instance of type Object. - Array^ myObjArray = Array::CreateInstance( Type::GetType( "System.Object" ), 5 ); - for ( int i = myObjArray->GetLowerBound( 0 ); i <= myObjArray->GetUpperBound( 0 ); i++ ) - myObjArray->SetValue( i + 26, i ); - - // Displays the initial values of both arrays. - Console::WriteLine( "Int32 array:" ); - PrintValues( myIntArray ); - Console::WriteLine( "Object array:" ); - PrintValues( myObjArray ); - - // Copies the first element from the Int32 array to the Object array. - Array::Copy( myIntArray, myIntArray->GetLowerBound( 0 ), myObjArray, myObjArray->GetLowerBound( 0 ), 1 ); - - // Copies the last two elements from the Object array to the Int32 array. - Array::Copy( myObjArray, myObjArray->GetUpperBound( 0 ) - 1, myIntArray, myIntArray->GetUpperBound( 0 ) - 1, 2 ); - - // Displays the values of the modified arrays. - Console::WriteLine( "Int32 array - Last two elements should now be the same as Object array:" ); - PrintValues( myIntArray ); - Console::WriteLine( "Object array - First element should now be the same as Int32 array:" ); - PrintValues( myObjArray ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Int32 array: - 1 2 3 4 5 - Object array: - 26 27 28 29 30 - Int32 array - Last two elements should now be the same as Object array: - 1 2 3 29 30 - Object array - First element should now be the same as Int32 array: - 1 27 28 29 30 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp deleted file mode 100644 index 2caab9082ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -using namespace System; - -void main() -{ - // Creates and initializes two new Array instances. - Array^ mySourceArray = Array::CreateInstance(String::typeid, 6); - mySourceArray->SetValue("three", 0); - mySourceArray->SetValue("napping", 1); - mySourceArray->SetValue("cats", 2); - mySourceArray->SetValue("in", 3); - mySourceArray->SetValue("the", 4); - mySourceArray->SetValue("barn", 5); - Array^ myTargetArray = Array::CreateInstance(String::typeid, 15); - myTargetArray->SetValue("The", 0); - myTargetArray->SetValue("quick", 1); - myTargetArray->SetValue("brown", 2); - myTargetArray->SetValue("fox", 3); - myTargetArray->SetValue("jumps", 4); - myTargetArray->SetValue("over", 5); - myTargetArray->SetValue("the", 6); - myTargetArray->SetValue("lazy", 7); - myTargetArray->SetValue("dog", 8); - - // Displays the values of the Array. - Console::WriteLine( "The target Array instance contains the following (before and after copying):"); - PrintValues(myTargetArray); - - // Copies the source Array to the target Array, starting at index 6. - mySourceArray->CopyTo(myTargetArray, 6); - - // Displays the values of the Array. - PrintValues(myTargetArray); -} - -void PrintValues(Array^ myArr) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength(myArr->Rank - 1); - while (myEnumerator->MoveNext()) - { - if (i < cols) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( " {0}", myEnumerator->Current); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Array instance contains the following (before and after copying): - The quick brown fox jumps over the lazy dog - The quick brown fox jumps over three napping cats in the barn - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp deleted file mode 100644 index ca74d220df4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -using namespace System; - -void main() -{ - // Creates and initializes the source Array. - Array^ myArrayZero = Array::CreateInstance(String::typeid, 3); - myArrayZero->SetValue("zero", 0); - myArrayZero->SetValue("one", 1); - - // Displays the source Array. - Console::WriteLine("The array with lowbound=0 contains:"); - PrintIndexAndValues(myArrayZero); - - // Creates and initializes the target Array. - array^myArrLen = {4}; - array^myArrLow = {2}; - Array^ myArrayTwo = Array::CreateInstance(String::typeid, myArrLen, myArrLow); - myArrayTwo->SetValue("two", 2); - myArrayTwo->SetValue("three", 3); - myArrayTwo->SetValue("four", 4); - myArrayTwo->SetValue("five", 5); - - // Displays the target Array. - Console::WriteLine("The array with lowbound=2 contains:"); - PrintIndexAndValues(myArrayTwo); - - // Copy from the array with lowbound=0 to the array with lowbound=2. - myArrayZero->CopyTo(myArrayTwo, 3); - - // Displays the modified target Array. - Console::WriteLine("\nAfter copying at relative index 1:"); - PrintIndexAndValues(myArrayTwo); -} - -void PrintIndexAndValues(Array^ myArray) -{ - for (int i = myArray->GetLowerBound(0); i <= myArray->GetUpperBound(0); i++) - Console::WriteLine("\t[{0}]:\t{1}", i, myArray->GetValue(i)); -} - -/* - This code produces the following output. - - The array with lowbound=0 contains: - [0]: zero - [1]: one - [2]: - The array with lowbound=2 contains: - [2]: two - [3]: three - [4]: four - [5]: five - - After copying at relative index 1: - [2]: two - [3]: zero - [4]: one - [5]: - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp deleted file mode 100644 index 6fb07cb3bf1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -void PrintValues( Array^ myArr ); -void main() -{ - // Creates and initializes a one-dimensional Array instance of type Int32. - Array^ my1DArray = Array::CreateInstance( Int32::typeid, 5 ); - for ( int i = my1DArray->GetLowerBound( 0 ); i <= my1DArray->GetUpperBound( 0 ); i++ ) - my1DArray->SetValue( i + 1, i ); - - // Displays the values of the Array. - Console::WriteLine( "The one-dimensional Array instance contains the following values:" ); - PrintValues( my1DArray ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The one-dimensional Array instance contains the following values: - 1 2 3 4 5 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp deleted file mode 100644 index 782e95f0280..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -void PrintValues( Array^ myArr ); -void main() -{ - // Creates and initializes a two-dimensional Array instance of type String. - Array^ my2DArray = Array::CreateInstance( String::typeid, 2, 3 ); - for ( int i = my2DArray->GetLowerBound( 0 ); i <= my2DArray->GetUpperBound( 0 ); i++ ) - for ( int j = my2DArray->GetLowerBound( 1 ); j <= my2DArray->GetUpperBound( 1 ); j++ ) - my2DArray->SetValue( String::Concat( "abc", i, j ), i, j ); - - // Displays the values of the Array. - Console::WriteLine( "The two-dimensional Array instance contains the following values:" ); - PrintValues( my2DArray ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The two-dimensional Array instance contains the following values: - abc00 abc01 abc02 - abc10 abc11 abc12 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp deleted file mode 100644 index dfc52829993..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -void PrintValues( Array^ myArr ); -void main() -{ - // Creates and initializes a three-dimensional Array instance of type Object. - Array^ my3DArray = Array::CreateInstance( Object::typeid, 2, 3, 4 ); - for ( int i = my3DArray->GetLowerBound( 0 ); i <= my3DArray->GetUpperBound( 0 ); i++ ) - for ( int j = my3DArray->GetLowerBound( 1 ); j <= my3DArray->GetUpperBound( 1 ); j++ ) - for ( int k = my3DArray->GetLowerBound( 2 ); k <= my3DArray->GetUpperBound( 2 ); k++ ) - my3DArray->SetValue( String::Concat( "abc", i, j, k ), i, j, k ); - - // Displays the values of the Array. - Console::WriteLine( "The three-dimensional Array instance contains the following values:" ); - PrintValues( my3DArray ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The three-dimensional Array instance contains the following values: - abc000 abc001 abc002 abc003 - abc010 abc011 abc012 abc013 - abc020 abc021 abc022 abc023 - abc100 abc101 abc102 abc103 - abc110 abc111 abc112 abc113 - abc120 abc121 abc122 abc123 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp deleted file mode 100644 index cf5aac93295..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp +++ /dev/null @@ -1,77 +0,0 @@ - -// -using namespace System; -void PrintValues( Array^ myArr ); -void main() -{ - // Creates and initializes a multidimensional Array instance of type String. - array^myLengthsArray = {2,3,4,5}; - Array^ my4DArray = Array::CreateInstance( String::typeid, myLengthsArray ); - for ( int i = my4DArray->GetLowerBound( 0 ); i <= my4DArray->GetUpperBound( 0 ); i++ ) - for ( int j = my4DArray->GetLowerBound( 1 ); j <= my4DArray->GetUpperBound( 1 ); j++ ) - for ( int k = my4DArray->GetLowerBound( 2 ); k <= my4DArray->GetUpperBound( 2 ); k++ ) - for ( int l = my4DArray->GetLowerBound( 3 ); l <= my4DArray->GetUpperBound( 3 ); l++ ) - { - array^myIndicesArray = {i,j,k,l}; - my4DArray->SetValue( String::Concat( Convert::ToString( i ), j, k, l ), myIndicesArray ); - - } - - // Displays the values of the Array. - Console::WriteLine( "The four-dimensional Array instance contains the following values:" ); - PrintValues( my4DArray ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The four-dimensional Array instance contains the following values: - 0000 0001 0002 0003 0004 - 0010 0011 0012 0013 0014 - 0020 0021 0022 0023 0024 - 0030 0031 0032 0033 0034 - 0100 0101 0102 0103 0104 - 0110 0111 0112 0113 0114 - 0120 0121 0122 0123 0124 - 0130 0131 0132 0133 0134 - 0200 0201 0202 0203 0204 - 0210 0211 0212 0213 0214 - 0220 0221 0222 0223 0224 - 0230 0231 0232 0233 0234 - 1000 1001 1002 1003 1004 - 1010 1011 1012 1013 1014 - 1020 1021 1022 1023 1024 - 1030 1031 1032 1033 1034 - 1100 1101 1102 1103 1104 - 1110 1111 1112 1113 1114 - 1120 1121 1122 1123 1124 - 1130 1131 1132 1133 1134 - 1200 1201 1202 1203 1204 - 1210 1211 1212 1213 1214 - 1220 1221 1222 1223 1224 - 1230 1231 1232 1233 1234 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp deleted file mode 100644 index cc1ff6dbbc9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// -using namespace System; -void PrintValues( Array^ myArr ); -void main() -{ - // Creates and initializes a multidimensional Array instance of type String. - array^myLengthsArray = {3,5}; - array^myBoundsArray = {2,3}; - Array^ myArray = Array::CreateInstance( String::typeid, myLengthsArray, myBoundsArray ); - for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) - for ( int j = myArray->GetLowerBound( 1 ); j <= myArray->GetUpperBound( 1 ); j++ ) - { - array^myIndicesArray = {i,j}; - myArray->SetValue( String::Concat( Convert::ToString( i ), j ), myIndicesArray ); - - } - - // Displays the lower bounds and the upper bounds of each dimension. - Console::WriteLine( "Bounds:\tLower\tUpper" ); - for ( int i = 0; i < myArray->Rank; i++ ) - Console::WriteLine( "{0}:\t{1}\t{2}", i, myArray->GetLowerBound( i ), myArray->GetUpperBound( i ) ); - - // Displays the values of the Array. - Console::WriteLine( "The Array instance contains the following values:" ); - PrintValues( myArray ); -} - -void PrintValues( Array^ myArr ) -{ - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - int i = 0; - int cols = myArr->GetLength( myArr->Rank - 1 ); - while ( myEnumerator->MoveNext() ) - { - if ( i < cols ) - { - i++; - } - else - { - Console::WriteLine(); - i = 1; - } - - Console::Write( "\t{0}", myEnumerator->Current ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Bounds: Lower Upper - 0: 2 4 - 1: 3 7 - The Array instance contains the following values: - 23 24 25 26 27 - 33 34 35 36 37 - 43 44 45 46 47 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp deleted file mode 100644 index 18923bcbb6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -using namespace System; - -void main() -{ - // Create a string array with 3 elements having the same value. - array^ strings = { "the", "quick", "brown", "fox", - "jumps", "over", "the", "lazy", "dog", - "in", "the", "barn" }; - - // Display the elements of the array. - Console::WriteLine("The array contains the following values:"); - for (int i = strings->GetLowerBound(0); i <= strings->GetUpperBound(0); i++) - Console::WriteLine(" [{0,2}]: {1}", i, strings[i]); - - // Search for the first occurrence of the duplicated value. - String^ searchString = "the"; - int index = Array::IndexOf(strings, searchString); - Console::WriteLine("The first occurrence of \"{0}\" is at index {1}.", - searchString, index); - - // Search for the first occurrence of the duplicated value in the last section of the array. - index = Array::IndexOf( strings, searchString, 4); - Console::WriteLine("The first occurrence of \"{0}\" between index 4 and the end is at index {1}.", - searchString, index); - - // Search for the first occurrence of the duplicated value in a section of the array. - int position = index + 1; - index = Array::IndexOf(strings, searchString, position, strings->GetUpperBound(0) - position + 1); - Console::WriteLine("The first occurrence of \"{0}\" between index {1} and index {2} is at index {3}.", - searchString, position, strings->GetUpperBound(0), index); -} -// The example displays the following output: -// The array contains the following values: -// [ 0]: the -// [ 1]: quick -// [ 2]: brown -// [ 3]: fox -// [ 4]: jumps -// [ 5]: over -// [ 6]: the -// [ 7]: lazy -// [ 8]: dog -// [ 9]: in -// [10]: the -// [11]: barn -// The first occurrence of "the" is at index 0. -// The first occurrence of "the" between index 4 and the end is at index 6. -// The first occurrence of "the" between index 7 and index 11 is at index 10. -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp deleted file mode 100644 index 1b8d7459315..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -// -using namespace System; -void PrintIndexAndValues( Array^ myArray ); - -void main() -{ - // Creates and initializes a new Array instance with three elements of the same value. - Array^ myArray = Array::CreateInstance( String::typeid, 12 ); - myArray->SetValue( "the", 0 ); - myArray->SetValue( "quick", 1 ); - myArray->SetValue( "brown", 2 ); - myArray->SetValue( "fox", 3 ); - myArray->SetValue( "jumps", 4 ); - myArray->SetValue( "over", 5 ); - myArray->SetValue( "the", 6 ); - myArray->SetValue( "lazy", 7 ); - myArray->SetValue( "dog", 8 ); - myArray->SetValue( "in", 9 ); - myArray->SetValue( "the", 10 ); - myArray->SetValue( "barn", 11 ); - - // Displays the values of the Array. - Console::WriteLine( "The Array instance contains the following values:" ); - PrintIndexAndValues( myArray ); - - // Searches for the last occurrence of the duplicated value. - String^ myString = "the"; - int myIndex = Array::LastIndexOf( myArray, myString ); - Console::WriteLine( "The last occurrence of \"{0}\" is at index {1}.", myString, myIndex ); - - // Searches for the last occurrence of the duplicated value in the first section of the Array. - myIndex = Array::LastIndexOf( myArray, myString, 8 ); - Console::WriteLine( "The last occurrence of \"{0}\" between the start and index 8 is at index {1}.", myString, myIndex ); - - // Searches for the last occurrence of the duplicated value in a section of the Array. - // Note that the start index is greater than the end index because the search is done backward. - myIndex = Array::LastIndexOf( myArray, myString, 10, 6 ); - Console::WriteLine( "The last occurrence of \"{0}\" between index 5 and index 10 is at index {1}.", myString, myIndex ); -} - -void PrintIndexAndValues( Array^ myArray ) -{ - for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) - Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); -} - -/* - This code produces the following output. - - The Array instance contains the following values: - [0]: the - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - [9]: in - [10]: the - [11]: barn - The last occurrence of "the" is at index 10. - The last occurrence of "the" between the start and index 8 is at index 6. - The last occurrence of "the" between index 5 and index 10 is at index 10. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp deleted file mode 100644 index 097d0727938..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -using namespace System; -void PrintIndexAndValues( Array^ myArray ); -void main() -{ - // Creates and initializes a new Array instance. - Array^ myArray = Array::CreateInstance( String::typeid, 9 ); - myArray->SetValue( "The", 0 ); - myArray->SetValue( "quick", 1 ); - myArray->SetValue( "brown", 2 ); - myArray->SetValue( "fox", 3 ); - myArray->SetValue( "jumps", 4 ); - myArray->SetValue( "over", 5 ); - myArray->SetValue( "the", 6 ); - myArray->SetValue( "lazy", 7 ); - myArray->SetValue( "dog", 8 ); - - // Displays the values of the Array. - Console::WriteLine( "The Array instance initially contains the following values:" ); - PrintIndexAndValues( myArray ); - - // Reverses the sort of the values of the Array. - Array::Reverse( myArray ); - - // Displays the values of the Array. - Console::WriteLine( "After reversing:" ); - PrintIndexAndValues( myArray ); -} - -void PrintIndexAndValues( Array^ myArray ) -{ - for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) - Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); -} - -/* - This code produces the following output. - - The Array instance initially contains the following values: - [0]: The - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - After reversing: - [0]: dog - [1]: lazy - [2]: the - [3]: over - [4]: jumps - [5]: fox - [6]: brown - [7]: quick - [8]: The - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp deleted file mode 100644 index 1f394ab0ee6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -using namespace System; -void PrintIndexAndValues( Array^ myArray ); -void main() -{ - // Creates and initializes a new Array instance. - Array^ myArray = Array::CreateInstance( String::typeid, 9 ); - myArray->SetValue( "The", 0 ); - myArray->SetValue( "QUICK", 1 ); - myArray->SetValue( "BROWN", 2 ); - myArray->SetValue( "FOX", 3 ); - myArray->SetValue( "jumps", 4 ); - myArray->SetValue( "over", 5 ); - myArray->SetValue( "the", 6 ); - myArray->SetValue( "lazy", 7 ); - myArray->SetValue( "dog", 8 ); - - // Displays the values of the Array. - Console::WriteLine( "The Array instance initially contains the following values:" ); - PrintIndexAndValues( myArray ); - - // Reverses the sort of the values of the Array. - Array::Reverse( myArray, 1, 3 ); - - // Displays the values of the Array. - Console::WriteLine( "After reversing:" ); - PrintIndexAndValues( myArray ); -} - -void PrintIndexAndValues( Array^ myArray ) -{ - for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) - Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); -} - -/* - This code produces the following output. - - The Array instance initially contains the following values: - [0]: The - [1]: QUICK - [2]: BROWN - [3]: FOX - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - After reversing: - [0]: The - [1]: FOX - [2]: BROWN - [3]: QUICK - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp deleted file mode 100644 index 49678c8cdc2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "Hello" ); - myAL->Add( "World" ); - myAL->Add( "!" ); - - // Displays the properties and values of the ArrayList. - Console::WriteLine( "myAL" ); - Console::WriteLine( " Count: {0}", myAL->Count ); - Console::WriteLine( " Capacity: {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* -This code produces output similar to the following: - -myAL - Count: 3 - Capacity: 4 - Values: Hello World ! - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp deleted file mode 100644 index 2755de2cbe1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, char mySeparator ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - - // Creates and initializes a new Queue. - Queue^ myQueue = gcnew Queue; - myQueue->Enqueue( "jumps" ); - myQueue->Enqueue( "over" ); - myQueue->Enqueue( "the" ); - myQueue->Enqueue( "lazy" ); - myQueue->Enqueue( "dog" ); - - // Displays the ArrayList and the Queue. - Console::WriteLine( "The ArrayList initially contains the following:" ); - PrintValues( myAL, '\t' ); - Console::WriteLine( "The Queue initially contains the following:" ); - PrintValues( myQueue, '\t' ); - - // Copies the Queue elements to the end of the ArrayList. - myAL->AddRange( myQueue ); - - // Displays the ArrayList. - Console::WriteLine( "The ArrayList now contains the following:" ); - PrintValues( myAL, '\t' ); -} - -void PrintValues( IEnumerable^ myList, char mySeparator ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( "{0}{1}", mySeparator, obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. - -The ArrayList initially contains the following: - The quick brown fox -The Queue initially contains the following: - jumps over the lazy dog -The ArrayList now contains the following: - The quick brown fox jumps over the lazy dog -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp deleted file mode 100644 index f7052b8c414..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void FindMyObject( ArrayList^ myList, Object^ myObject ); -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. BinarySearch requires - // a sorted ArrayList. - ArrayList^ myAL = gcnew ArrayList; - for ( int i = 0; i <= 4; i++ ) - myAL->Add( i * 2 ); - - // Displays the ArrayList. - Console::WriteLine( "The Int32 ArrayList contains the following:" ); - PrintValues( myAL ); - - // Locates a specific object that does not exist in the ArrayList. - Object^ myObjectOdd = 3; - FindMyObject( myAL, myObjectOdd ); - - // Locates an object that exists in the ArrayList. - Object^ myObjectEven = 6; - FindMyObject( myAL, myObjectEven ); -} - -void FindMyObject( ArrayList^ myList, Object^ myObject ) -{ - int myIndex = myList->BinarySearch( myObject ); - if ( myIndex < 0 ) - Console::WriteLine( "The object to search for ({0}) is not found. The next larger object is at index {1}.", myObject, ~myIndex ); - else - Console::WriteLine( "The object to search for ({0}) is at index {1}.", myObject, myIndex ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The Int32 ArrayList contains the following: - 0 2 4 6 8 - The object to search for (3) is not found. The next larger object is at index 2. - The object to search for (6) is at index 3. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp deleted file mode 100644 index cd02a23fd6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -public ref class SimpleStringComparer : public IComparer -{ - virtual int Compare(Object^ x, Object^ y) sealed = IComparer::Compare - { - String^ cmpstr = (String^)x; - return cmpstr->CompareTo((String^)y); - } -}; - -public ref class MyArrayList : public ArrayList -{ -public: - static void Main() - { - // Creates and initializes a new ArrayList. - MyArrayList^ coloredAnimals = gcnew MyArrayList(); - - coloredAnimals->Add("White Tiger"); - coloredAnimals->Add("Pink Bunny"); - coloredAnimals->Add("Red Dragon"); - coloredAnimals->Add("Green Frog"); - coloredAnimals->Add("Blue Whale"); - coloredAnimals->Add("Black Cat"); - coloredAnimals->Add("Yellow Lion"); - - // BinarySearch requires a sorted ArrayList. - coloredAnimals->Sort(); - - // Compare results of an iterative search with a binary search - int index = coloredAnimals->IterativeSearch("White Tiger"); - Console::WriteLine("Iterative search, item found at index: {0}", index); - - index = coloredAnimals->BinarySearch("White Tiger", gcnew SimpleStringComparer()); - Console::WriteLine("Binary search, item found at index: {0}", index); - } - - int IterativeSearch(Object^ finditem) - { - int index = -1; - - for (int i = 0; i < this->Count; i++) - { - if (finditem->Equals(this[i])) - { - index = i; - break; - } - } - return index; - } -}; - -int main() -{ - MyArrayList::Main(); -} -// -// This code produces the following output. -// -// Iterative search, item found at index: 5 -// Binary search, item found at index: 5 -// -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp deleted file mode 100644 index ecce0f77c76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - - // Displays the count, capacity and values of the ArrayList. - Console::WriteLine( "Initially," ); - Console::WriteLine( " Count : {0}", myAL->Count ); - Console::WriteLine( " Capacity : {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); - - // Trim the ArrayList. - myAL->TrimToSize(); - - // Displays the count, capacity and values of the ArrayList. - Console::WriteLine( "After TrimToSize," ); - Console::WriteLine( " Count : {0}", myAL->Count ); - Console::WriteLine( " Capacity : {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); - - // Clear the ArrayList. - myAL->Clear(); - - // Displays the count, capacity and values of the ArrayList. - Console::WriteLine( "After Clear," ); - Console::WriteLine( " Count : {0}", myAL->Count ); - Console::WriteLine( " Capacity : {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); - - // Trim the ArrayList again. - myAL->TrimToSize(); - - // Displays the count, capacity and values of the ArrayList. - Console::WriteLine( "After the second TrimToSize," ); - Console::WriteLine( " Count : {0}", myAL->Count ); - Console::WriteLine( " Capacity : {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initially, - Count : 5 - Capacity : 16 - Values: The quick brown fox jumps - After TrimToSize, - Count : 5 - Capacity : 5 - Values: The quick brown fox jumps - After Clear, - Count : 0 - Capacity : 5 - Values: - After the second TrimToSize, - Count : 0 - Capacity : 16 - Values: - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp deleted file mode 100644 index 350784fe0ae..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -using namespace System; -using namespace System::Collections; -void PrintValues( array^myArr, char mySeparator ); -int main() -{ - - // Creates and initializes the source ArrayList. - ArrayList^ mySourceList = gcnew ArrayList; - mySourceList->Add( "three" ); - mySourceList->Add( "napping" ); - mySourceList->Add( "cats" ); - mySourceList->Add( "in" ); - mySourceList->Add( "the" ); - mySourceList->Add( "barn" ); - - // Creates and initializes the one-dimensional target Array. - array^myTargetArray = gcnew array(15); - myTargetArray[ 0 ] = "The"; - myTargetArray[ 1 ] = "quick"; - myTargetArray[ 2 ] = "brown"; - myTargetArray[ 3 ] = "fox"; - myTargetArray[ 4 ] = "jumps"; - myTargetArray[ 5 ] = "over"; - myTargetArray[ 6 ] = "the"; - myTargetArray[ 7 ] = "lazy"; - myTargetArray[ 8 ] = "dog"; - - // Displays the values of the target Array. - Console::WriteLine( "The target Array contains the following (before and after copying):" ); - PrintValues( myTargetArray, ' ' ); - - // Copies the second element from the source ArrayList to the target ArrayList starting at index 7. - mySourceList->CopyTo( 1, myTargetArray, 7, 1 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source ArrayList to the target ArrayList starting at index 6. - mySourceList->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source ArrayList to the target ArrayList starting at index 0. - mySourceList->CopyTo( myTargetArray ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); -} - -void PrintValues( array^myArr, char mySeparator ) -{ - for ( int i = 0; i < myArr->Length; i++ ) - Console::Write( "{0}{1}", mySeparator, myArr[ i ] ); - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Array contains the following (before and after copying): - The quick brown fox jumps over the lazy dog - The quick brown fox jumps over the napping dog - The quick brown fox jumps over three napping cats in the barn - three napping cats in the barn three napping cats in the barn - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp deleted file mode 100644 index de10c82aaf7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( array^myArr, char mySeparator ); -int main() -{ - - // Creates and initializes the source ArrayList. - ArrayList^ mySourceList = gcnew ArrayList; - mySourceList->Add( "three" ); - mySourceList->Add( "napping" ); - mySourceList->Add( "cats" ); - mySourceList->Add( "in" ); - mySourceList->Add( "the" ); - mySourceList->Add( "barn" ); - - // Creates and initializes the one-dimensional target Array. - array^myTargetArray = gcnew array(15); - myTargetArray[ 0 ] = "The"; - myTargetArray[ 1 ] = "quick"; - myTargetArray[ 2 ] = "brown"; - myTargetArray[ 3 ] = "fox"; - myTargetArray[ 4 ] = "jumps"; - myTargetArray[ 5 ] = "over"; - myTargetArray[ 6 ] = "the"; - myTargetArray[ 7 ] = "lazy"; - myTargetArray[ 8 ] = "dog"; - - // Displays the values of the target Array. - Console::WriteLine( "The target Array contains the following (before and after copying):" ); - PrintValues( myTargetArray, ' ' ); - - // Copies the second element from the source ArrayList to the target Array, starting at index 7. - mySourceList->CopyTo( 1, myTargetArray, 7, 1 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source ArrayList to the target Array, starting at index 6. - mySourceList->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source ArrayList to the target Array, starting at index 0. - mySourceList->CopyTo( myTargetArray ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); -} - -void PrintValues( array^myArr, char mySeparator ) -{ - for ( int i = 0; i < myArr->Length; i++ ) - Console::Write( "{0}{1}", mySeparator, myArr[ i ] ); - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Array contains the following (before and after copying): - The quick brown fox jumps over the lazy dog - The quick brown fox jumps over the napping dog - The quick brown fox jumps over three napping cats in the barn - three napping cats in the barn three napping cats in the barn - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp deleted file mode 100644 index 2d45857cac0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList with three elements of the same value. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "the" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - myAL->Add( "in" ); - myAL->Add( "the" ); - myAL->Add( "barn" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList contains the following values:" ); - PrintIndexAndValues( myAL ); - - // Search for the first occurrence of the duplicated value. - String^ myString = "the"; - int myIndex = myAL->IndexOf( myString ); - Console::WriteLine( "The first occurrence of \"{0}\" is at index {1}.", myString, myIndex ); - - // Search for the first occurrence of the duplicated value in the last section of the ArrayList. - myIndex = myAL->IndexOf( myString, 4 ); - Console::WriteLine( "The first occurrence of \"{0}\" between index 4 and the end is at index {1}.", myString, myIndex ); - - // Search for the first occurrence of the duplicated value in a section of the ArrayList. - myIndex = myAL->IndexOf( myString, 6, 6 ); - Console::WriteLine( "The first occurrence of \"{0}\" between index 6 and index 11 is at index {1}.", myString, myIndex ); -} - -void PrintIndexAndValues( IEnumerable^ myList ) -{ - int i = 0; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " [{0}]: {1}", i++, obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList contains the following values: - [0]: the - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - [9]: in - [10]: the - [11]: barn - - The first occurrence of "the" is at index 0. - The first occurrence of "the" between index 4 and the end is at index 6. - The first occurrence of "the" between index 6 and index 11 is at index 6. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp deleted file mode 100644 index f29a6c01426..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList using Insert instead of Add. - ArrayList^ myAL = gcnew ArrayList; - myAL->Insert( 0, "The" ); - myAL->Insert( 1, "fox" ); - myAL->Insert( 2, "jumps" ); - myAL->Insert( 3, "over" ); - myAL->Insert( 4, "the" ); - myAL->Insert( 5, "dog" ); - - // Creates and initializes a new Queue. - Queue^ myQueue = gcnew Queue; - myQueue->Enqueue( "quick" ); - myQueue->Enqueue( "brown" ); - - // Displays the ArrayList and the Queue. - Console::WriteLine( "The ArrayList initially contains the following:" ); - PrintValues( myAL ); - Console::WriteLine( "The Queue initially contains the following:" ); - PrintValues( myQueue ); - - // Copies the Queue elements to the ArrayList at index 1. - myAL->InsertRange( 1, myQueue ); - - // Displays the ArrayList. - Console::WriteLine( "After adding the Queue, the ArrayList now contains:" ); - PrintValues( myAL ); - - // Search for "dog" and add "lazy" before it. - myAL->Insert( myAL->IndexOf( "dog" ), "lazy" ); - - // Displays the ArrayList. - Console::WriteLine( "After adding \"lazy\", the ArrayList now contains:" ); - PrintValues( myAL ); - - // Add "!!!" at the end. - myAL->Insert( myAL->Count, "!!!" ); - - // Displays the ArrayList. - Console::WriteLine( "After adding \"!!!\", the ArrayList now contains:" ); - PrintValues( myAL ); - - // Inserting an element beyond Count throws an exception. - try - { - myAL->Insert( myAL->Count + 1, "anystring" ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList initially contains the following: - The fox jumps over the dog - The Queue initially contains the following: - quick brown - After adding the Queue, the ArrayList now contains: - The quick brown fox jumps over the dog - After adding "lazy", the ArrayList now contains: - The quick brown fox jumps over the lazy dog - After adding "!!!", the ArrayList now contains: - The quick brown fox jumps over the lazy dog !!! - Exception: System.ArgumentOutOfRangeException: Insertion index was out of range. Must be non-negative and less than or equal to size. - Parameter name: index - at System.Collections.ArrayList.Insert(Int32 index, Object value) - at SamplesArrayList.Main() - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp deleted file mode 100644 index e5271eb3ea7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp +++ /dev/null @@ -1,127 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, char mySeparator ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Create a fixed-size wrapper around the ArrayList. - ArrayList^ myFixedSizeAL = ArrayList::FixedSize( myAL ); - - // Display whether the ArrayLists have a fixed size or not. - Console::WriteLine( "myAL {0}.", myAL->IsFixedSize ? (String^)"has a fixed size" : "does not have a fixed size" ); - Console::WriteLine( "myFixedSizeAL {0}.", myFixedSizeAL->IsFixedSize ? (String^)"has a fixed size" : "does not have a fixed size" ); - Console::WriteLine(); - - // Display both ArrayLists. - Console::WriteLine( "Initially," ); - Console::Write( "Standard :" ); - PrintValues( myAL, ' ' ); - Console::Write( "Fixed size:" ); - PrintValues( myFixedSizeAL, ' ' ); - - // Sort is allowed in the fixed-size ArrayList. - myFixedSizeAL->Sort(); - - // Display both ArrayLists. - Console::WriteLine( "After Sort," ); - Console::Write( "Standard :" ); - PrintValues( myAL, ' ' ); - Console::Write( "Fixed size:" ); - PrintValues( myFixedSizeAL, ' ' ); - - // Reverse is allowed in the fixed-size ArrayList. - myFixedSizeAL->Reverse(); - - // Display both ArrayLists. - Console::WriteLine( "After Reverse," ); - Console::Write( "Standard :" ); - PrintValues( myAL, ' ' ); - Console::Write( "Fixed size:" ); - PrintValues( myFixedSizeAL, ' ' ); - - // Add an element to the standard ArrayList. - myAL->Add( "AddMe" ); - - // Display both ArrayLists. - Console::WriteLine( "After adding to the standard ArrayList," ); - Console::Write( "Standard :" ); - PrintValues( myAL, ' ' ); - Console::Write( "Fixed size:" ); - PrintValues( myFixedSizeAL, ' ' ); - Console::WriteLine(); - - // Adding or inserting elements to the fixed-size ArrayList throws an exception. - try - { - myFixedSizeAL->Add( "AddMe2" ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - - try - { - myFixedSizeAL->Insert( 3, "InsertMe" ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - -} - -void PrintValues( IEnumerable^ myList, char mySeparator ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( "{0}{1}", mySeparator, obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - myAL does not have a fixed size. - myFixedSizeAL has a fixed size. - - Initially, - Standard : The quick brown fox jumps over the lazy dog - Fixed size: The quick brown fox jumps over the lazy dog - After Sort, - Standard : brown dog fox jumps lazy over quick the The - Fixed size: brown dog fox jumps lazy over quick the The - After Reverse, - Standard : The the quick over lazy jumps fox dog brown - Fixed size: The the quick over lazy jumps fox dog brown - After adding to the standard ArrayList, - Standard : The the quick over lazy jumps fox dog brown AddMe - Fixed size: The the quick over lazy jumps fox dog brown AddMe - - Exception: System.NotSupportedException: Collection was of a fixed size. - at System.Collections.FixedSizeArrayList.Add(Object obj) - at SamplesArrayList.Main() - Exception: System.NotSupportedException: Collection was of a fixed size. - at System.Collections.FixedSizeArrayList.Insert(Int32 index, Object obj) - at SamplesArrayList.Main() - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp deleted file mode 100644 index 83e78208a4d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -int main() -{ - - // Creates and initializes a new ArrayList instance. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - - // Creates a synchronized wrapper around the ArrayList. - ArrayList^ mySyncdAL = ArrayList::Synchronized( myAL ); - - // Displays the sychronization status of both ArrayLists. - String^ szRes = myAL->IsSynchronized ? (String^)"synchronized" : "not synchronized"; - Console::WriteLine( "myAL is {0}.", szRes ); - String^ szSyncRes = mySyncdAL->IsSynchronized ? (String^)"synchronized" : "not synchronized"; - Console::WriteLine( "mySyncdAL is {0}.", szSyncRes ); -} - -/* - This code produces the following output. - - myAL is not synchronized. - mySyncdAL is synchronized. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp deleted file mode 100644 index 7180bf8a5e0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class SamplesArrayList -{ -public: - static void Main() - { - // - ArrayList^ myCollection = gcnew ArrayList(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesArrayList::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp deleted file mode 100644 index 29c9798e23c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList with three elements of the same value. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "the" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - myAL->Add( "in" ); - myAL->Add( "the" ); - myAL->Add( "barn" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList contains the following values:" ); - PrintIndexAndValues( myAL ); - - // Searches for the last occurrence of the duplicated value. - String^ myString = "the"; - int myIndex = myAL->LastIndexOf( myString ); - Console::WriteLine( "The last occurrence of \"{0}\" is at index {1}.", myString, myIndex ); - - // Searches for the last occurrence of the duplicated value in the first section of the ArrayList. - myIndex = myAL->LastIndexOf( myString, 8 ); - Console::WriteLine( "The last occurrence of \"{0}\" between the start and index 8 is at index {1}.", myString, myIndex ); - - // Searches for the last occurrence of the duplicated value in a section of the ArrayList. Note that the start index is greater than the end index because the search is done backward. - myIndex = myAL->LastIndexOf( myString, 10, 6 ); - Console::WriteLine( "The last occurrence of \"{0}\" between index 10 and index 5 is at index {1}.", myString, myIndex ); -} - -void PrintIndexAndValues( IEnumerable^ myList ) -{ - int i = 0; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " [{0}]: {1}", i++, obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList contains the following values: - [0]: the - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - [9]: in - [10]: the - [11]: barn - - The last occurrence of "the" is at index 10. - The last occurrence of "the" between the start and index 8 is at index 6. - The last occurrence of "the" between index 10 and index 5 is at index 10. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp deleted file mode 100644 index 874f42b2001..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Collections; -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "red" ); - myAL->Add( "orange" ); - myAL->Add( "yellow" ); - - // Creates a read-only copy of the ArrayList. - ArrayList^ myReadOnlyAL = ArrayList::ReadOnly( myAL ); - - // Displays whether the ArrayList is read-only or writable. - Console::WriteLine( "myAL is {0}.", myAL->IsReadOnly ? (String^)"read-only" : "writable" ); - Console::WriteLine( "myReadOnlyAL is {0}.", myReadOnlyAL->IsReadOnly ? (String^)"read-only" : "writable" ); - - // Displays the contents of both collections. - Console::WriteLine( "\nInitially," ); - Console::WriteLine( "The original ArrayList myAL contains:" ); - for ( int i(0); i < myAL->Count; ++i ) - Console::WriteLine( " {0}", static_cast(myAL[ i ]) ); - Console::WriteLine( "The read-only ArrayList myReadOnlyAL contains:" ); - for ( int i(0); i < myReadOnlyAL->Count; ++i ) - Console::WriteLine( " {0}", static_cast(myReadOnlyAL[ i ]) ); - - // Adding an element to a read-only ArrayList throws an exception. - Console::WriteLine( "\nTrying to add a new element to the read-only ArrayList:" ); - try - { - myReadOnlyAL->Add( "green" ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( String::Concat( "Exception: ", myException->ToString() ) ); - } - - - // Adding an element to the original ArrayList affects the read-only ArrayList. - myAL->Add( "blue" ); - - // Displays the contents of both collections again. - Console::WriteLine( "\nAfter adding a new element to the original ArrayList," ); - Console::WriteLine( "The original ArrayList myAL contains:" ); - for ( int i(0); i < myAL->Count; ++i ) - Console::WriteLine( " {0}", static_cast(myAL[ i ]) ); - Console::WriteLine( "The read-only ArrayList myReadOnlyAL contains:" ); - for ( int i(0); i < myReadOnlyAL->Count; ++i ) - Console::WriteLine( " {0}", static_cast(myReadOnlyAL[ i ]) ); -} - -/* -This code produces the following output. - -myAL is writable. -myReadOnlyAL is read-only. - -Initially, -The original ArrayList myAL contains: - red - orange - yellow -The read-only ArrayList myReadOnlyAL contains: - red - orange - yellow - -Trying to add a new element to the read-only ArrayList: -Exception: System.NotSupportedException: Collection is read-only. - at System.Collections.ReadOnlyArrayList.Add(Object obj) - at SamplesArrayList.Main() - -After adding a new element to the original ArrayList, -The original ArrayList myAL contains: - red - orange - yellow - blue -The read-only ArrayList myReadOnlyAL contains: - red - orange - yellow - blue - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp deleted file mode 100644 index 4b53513ceb4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the ArrayList. - Console::WriteLine( "The ArrayList initially contains the following:" ); - PrintValues( myAL ); - - // Removes the element containing "lazy". - myAL->Remove( "lazy" ); - - // Displays the current state of the ArrayList. - Console::WriteLine( "After removing \"lazy\":" ); - PrintValues( myAL ); - - // Removes the element at index 5. - myAL->RemoveAt( 5 ); - - // Displays the current state of the ArrayList. - Console::WriteLine( "After removing the element at index 5:" ); - PrintValues( myAL ); - - // Removes three elements starting at index 4. - myAL->RemoveRange( 4, 3 ); - - // Displays the current state of the ArrayList. - Console::WriteLine( "After removing three elements starting at index 4:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList initially contains the following: - The quick brown fox jumps over the lazy dog - After removing "lazy": - The quick brown fox jumps over the dog - After removing the element at index 5: - The quick brown fox jumps the dog - After removing three elements starting at index 4: - The quick brown fox - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp deleted file mode 100644 index 0de76e16267..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates a new ArrayList with five elements and initialize each element with a null value. - ArrayList^ myAL = ArrayList::Repeat( 0, 5 ); - - // Displays the count, capacity and values of the ArrayList. - Console::WriteLine( "ArrayList with five elements with a null value" ); - Console::WriteLine( " Count : {0}", myAL->Count ); - Console::WriteLine( " Capacity : {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); - - // Creates a new ArrayList with seven elements and initialize each element with the string "abc". - myAL = ArrayList::Repeat( "abc", 7 ); - - // Displays the count, capacity and values of the ArrayList. - Console::WriteLine( "ArrayList with seven elements with a string value" ); - Console::WriteLine( " Count : {0}", myAL->Count ); - Console::WriteLine( " Capacity : {0}", myAL->Capacity ); - Console::Write( " Values:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - ArrayList with five elements with a null value - Count : 5 - Capacity : 16 - Values: - ArrayList with seven elements with a string value - Count : 7 - Capacity : 16 - Values: abc abc abc abc abc abc abc - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp deleted file mode 100644 index 0fed55d8877..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList initially contains the following values:" ); - PrintValues( myAL ); - - // Reverses the sort order of the values of the ArrayList. - myAL->Reverse(); - - // Displays the values of the ArrayList. - Console::WriteLine( "After reversing:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList initially contains the following values: - The - quick - brown - fox - jumps - over - the - lazy - dog - - After reversing: - dog - lazy - the - over - jumps - fox - brown - quick - The - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp deleted file mode 100644 index 94b787234f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "QUICK" ); - myAL->Add( "BROWN" ); - myAL->Add( "FOX" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList initially contains the following values:" ); - PrintValues( myAL ); - - // Reverses the sort order of the values of the ArrayList. - myAL->Reverse( 1, 3 ); - - // Displays the values of the ArrayList. - Console::WriteLine( "After reversing:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList initially contains the following values: - The - QUICK - BROWN - FOX - jumps - over - the - lazy - dog - - After reversing: - The - FOX - BROWN - QUICK - jumps - over - the - lazy - dog - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp deleted file mode 100644 index 87913eb48c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, char mySeparator ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Creates and initializes the source ICollection. - Queue^ mySourceList = gcnew Queue; - mySourceList->Enqueue( "big" ); - mySourceList->Enqueue( "gray" ); - mySourceList->Enqueue( "wolf" ); - - // Displays the values of five elements starting at index 0. - ArrayList^ mySubAL = myAL->GetRange( 0, 5 ); - Console::WriteLine( "Index 0 through 4 contains:" ); - PrintValues( mySubAL, '\t' ); - - // Replaces the values of five elements starting at index 1 with the values in the ICollection. - myAL->SetRange( 1, mySourceList ); - - // Displays the values of five elements starting at index 0. - mySubAL = myAL->GetRange( 0, 5 ); - Console::WriteLine( "Index 0 through 4 now contains:" ); - PrintValues( mySubAL, '\t' ); -} - -void PrintValues( IEnumerable^ myList, char mySeparator ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( "{0}{1}", mySeparator, obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Index 0 through 4 contains: - The quick brown fox jumps - Index 0 through 4 now contains: - The big gray wolf jumps - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp deleted file mode 100644 index 0b0876c0b0f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList ); -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList initially contains the following values:" ); - PrintValues( myAL ); - - // Sorts the values of the ArrayList. - myAL->Sort(); - - // Displays the values of the ArrayList. - Console::WriteLine( "After sorting:" ); - PrintValues( myAL ); -} - -void PrintValues( IEnumerable^ myList ) -{ - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The ArrayList initially contains the following values: - The - quick - brown - fox - jumps - over - the - lazy - dog - - After sorting: - brown - dog - fox - jumps - lazy - over - quick - the - The - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp deleted file mode 100644 index ecaba9d9d0b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Assembly^ mainAssembly = Assembly::GetExecutingAssembly(); - Console::WriteLine( "The executing assembly is {0}.", mainAssembly ); - array^mods = mainAssembly->GetModules(); - Console::WriteLine( "\tModules in the assembly:" ); - for ( int i = 0; i < mods->Length; i++ ) - Console::WriteLine( "\t{0}", mods[ i ] ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp deleted file mode 100644 index 2aa6055f25c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -#using - -using namespace System; - -// -namespace InteropServices -{ - [AttributeUsage(AttributeTargets::Method| - AttributeTargets::Field| - AttributeTargets::Property) - ] - public ref class DispIdAttribute: public Attribute - { - public: - DispIdAttribute( int value ) - { - // . . . - } - - property int Value - { - int get() - { - // . . . - return 0; - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp deleted file mode 100644 index d0f81ed9be8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp +++ /dev/null @@ -1,119 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, int myWidth ); -int main() -{ - - // Creates and initializes several BitArrays. - BitArray^ myBA1 = gcnew BitArray( 5 ); - BitArray^ myBA2 = gcnew BitArray( 5,false ); - array^myBytes = {1,2,3,4,5}; - BitArray^ myBA3 = gcnew BitArray( myBytes ); - array^myBools = {true,false,true,true,false}; - BitArray^ myBA4 = gcnew BitArray( myBools ); - array^myInts = {6,7,8,9,10}; - BitArray^ myBA5 = gcnew BitArray( myInts ); - - // Displays the properties and values of the BitArrays. - Console::WriteLine( "myBA1" ); - Console::WriteLine( " Count: {0}", myBA1->Count ); - Console::WriteLine( " Length: {0}", myBA1->Length ); - Console::WriteLine( " Values:" ); - PrintValues( myBA1, 8 ); - Console::WriteLine( "myBA2" ); - Console::WriteLine( " Count: {0}", myBA2->Count ); - Console::WriteLine( " Length: {0}", myBA2->Length ); - Console::WriteLine( " Values:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine( "myBA3" ); - Console::WriteLine( " Count: {0}", myBA3->Count ); - Console::WriteLine( " Length: {0}", myBA3->Length ); - Console::WriteLine( " Values:" ); - PrintValues( myBA3, 8 ); - Console::WriteLine( "myBA4" ); - Console::WriteLine( " Count: {0}", myBA4->Count ); - Console::WriteLine( " Length: {0}", myBA4->Length ); - Console::WriteLine( " Values:" ); - PrintValues( myBA4, 8 ); - Console::WriteLine( "myBA5" ); - Console::WriteLine( " Count: {0}", myBA5->Count ); - Console::WriteLine( " Length: {0}", myBA5->Length ); - Console::WriteLine( " Values:" ); - PrintValues( myBA5, 8 ); -} - -void PrintValues( IEnumerable^ myList, int myWidth ) -{ - int i = myWidth; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - if ( i <= 0 ) - { - i = myWidth; - Console::WriteLine(); - } - - i--; - Console::Write( "{0,8}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - myBA1 - Count: 5 - Length: 5 - Values: - False False False False False - myBA2 - Count: 5 - Length: 5 - Values: - False False False False False - myBA3 - Count: 40 - Length: 40 - Values: - True False False False False False False False - False True False False False False False False - True True False False False False False False - False False True False False False False False - True False True False False False False False - myBA4 - Count: 5 - Length: 5 - Values: - True False True True False - myBA5 - Count: 160 - Length: 160 - Values: - False True True False False False False False - False False False False False False False False - False False False False False False False False - False False False False False False False False - True True True False False False False False - False False False False False False False False - False False False False False False False False - False False False False False False False False - False False False True False False False False - False False False False False False False False - False False False False False False False False - False False False False False False False False - True False False True False False False False - False False False False False False False False - False False False False False False False False - False False False False False False False False - False True False True False False False False - False False False False False False False False - False False False False False False False False - False False False False False False False False - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp deleted file mode 100644 index fec3d1d5c3e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class SamplesLocker -{ -public: - static void Main() - { - // - BitArray^ myCollection = gcnew BitArray(64, true); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesLocker::Main(); -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp deleted file mode 100644 index cfd52ecb27a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, int myWidth ); -int main() -{ - - // Creates and initializes two BitArrays of the same size. - BitArray^ myBA1 = gcnew BitArray( 4 ); - BitArray^ myBA2 = gcnew BitArray( 4 ); - myBA1[ 0 ] = false; - myBA1[ 1 ] = false; - myBA1[ 2 ] = true; - myBA1[ 3 ] = true; - myBA2[ 0 ] = false; - myBA2[ 2 ] = false; - myBA2[ 1 ] = true; - myBA2[ 3 ] = true; - - // Performs a bitwise AND operation between BitArray instances of the same size. - Console::WriteLine( "Initial values" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - Console::WriteLine( "Result" ); - Console::Write( "AND:" ); - PrintValues( myBA1->And( myBA2 ), 8 ); - Console::WriteLine(); - Console::WriteLine( "After AND" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - - // Performing AND between BitArray instances of different sizes returns an exception. - try - { - BitArray^ myBA3 = gcnew BitArray( 8 ); - myBA3[ 0 ] = false; - myBA3[ 1 ] = false; - myBA3[ 2 ] = false; - myBA3[ 3 ] = false; - myBA3[ 4 ] = true; - myBA3[ 5 ] = true; - myBA3[ 6 ] = true; - myBA3[ 7 ] = true; - myBA1->And( myBA3 ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - -} - -void PrintValues( IEnumerable^ myList, int myWidth ) -{ - int i = myWidth; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - if ( i <= 0 ) - { - i = myWidth; - Console::WriteLine(); - } - - i--; - Console::Write( "{0,8}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initial values - myBA1: False False True True - myBA2: False True False True - - Result - AND: False False False True - - After AND - myBA1: False False False True - myBA2: False True False True - - Exception: System.ArgumentException: Array lengths must be the same. - at System.Collections.BitArray.And(BitArray value) - at SamplesBitArray.Main() - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp deleted file mode 100644 index c1f547de31b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,104 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myArr ); -int main() -{ - // Creates and initializes the source BitArray. - BitArray^ myBA = gcnew BitArray( 4 ); - myBA[ 0 ] = true; - myBA[ 1 ] = true; - myBA[ 2 ] = true; - myBA[ 3 ] = true; - - // Creates and initializes the one-dimensional target Array of type Boolean. - array^myBoolArray = gcnew array(8); - myBoolArray[ 0 ] = false; - myBoolArray[ 1 ] = false; - - // Displays the values of the target Array. - Console::WriteLine( "The target Boolean Array contains the following (before and after copying):" ); - PrintValues( dynamic_cast(myBoolArray) ); - - // Copies the entire source BitArray to the target BitArray, starting at index 3. - myBA->CopyTo( myBoolArray, 3 ); - - // Displays the values of the target Array. - PrintValues( dynamic_cast(myBoolArray) ); - - // Creates and initializes the one-dimensional target Array of type integer. - array^myIntArray = gcnew array(8); - myIntArray[ 0 ] = 42; - myIntArray[ 1 ] = 43; - - // Displays the values of the target Array. - Console::WriteLine( "The target integer Array contains the following (before and after copying):" ); - PrintValues( dynamic_cast(myIntArray) ); - - // Copies the entire source BitArray to the target BitArray, starting at index 3. - myBA->CopyTo( myIntArray, 3 ); - - // Displays the values of the target Array. - PrintValues( dynamic_cast(myIntArray) ); - - // Creates and initializes the one-dimensional target Array of type byte. - Array^ myByteArray = Array::CreateInstance( Byte::typeid, 8 ); - myByteArray->SetValue( (Byte)10, 0 ); - myByteArray->SetValue( (Byte)11, 1 ); - - // Displays the values of the target Array. - Console::WriteLine( "The target byte Array contains the following (before and after copying):" ); - PrintValues( myByteArray ); - - // Copies the entire source BitArray to the target BitArray, starting at index 3. - myBA->CopyTo( myByteArray, 3 ); - - // Displays the values of the target Array. - PrintValues( myByteArray ); - - // Returns an exception if the array is not of type Boolean, integer or byte. - try - { - Array^ myStringArray = Array::CreateInstance( String::typeid, 8 ); - myStringArray->SetValue( "Hello", 0 ); - myStringArray->SetValue( "World", 1 ); - myBA->CopyTo( myStringArray, 3 ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - -} - -void PrintValues( IEnumerable^ myArr ) -{ - IEnumerator^ myEnum = myArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( "{0,8}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Boolean Array contains the following (before and after copying): - False False False False False False False False - False False False True True True True False - The target integer Array contains the following (before and after copying): - 42 43 0 0 0 0 0 0 - 42 43 0 15 0 0 0 0 - The target byte Array contains the following (before and after copying): - 10 11 0 0 0 0 0 0 - 10 11 0 15 0 0 0 0 - Exception: System.ArgumentException: Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[]. - at System.Collections.BitArray.CopyTo(Array array, Int32 index) - at SamplesBitArray.Main() - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp deleted file mode 100644 index 6417fdd49ba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndValues( IEnumerable^ myCol ); -int main() -{ - - // Creates and initializes a BitArray. - BitArray^ myBA = gcnew BitArray( 5 ); - - // Displays the properties and values of the BitArray. - Console::WriteLine( "myBA values:" ); - PrintIndexAndValues( myBA ); - - // Sets all the elements to true. - myBA->SetAll( true ); - - // Displays the properties and values of the BitArray. - Console::WriteLine( "After setting all elements to true," ); - PrintIndexAndValues( myBA ); - - // Sets the last index to false. - myBA->Set( myBA->Count - 1, false ); - - // Displays the properties and values of the BitArray. - Console::WriteLine( "After setting the last element to false," ); - PrintIndexAndValues( myBA ); - - // Gets the value of the last two elements. - Console::WriteLine( "The last two elements are: " ); - Console::WriteLine( " at index {0} : {1}", myBA->Count - 2, myBA->Get( myBA->Count - 2 ) ); - Console::WriteLine( " at index {0} : {1}", myBA->Count - 1, myBA->Get( myBA->Count - 1 ) ); -} - -void PrintIndexAndValues( IEnumerable^ myCol ) -{ - int i = 0; - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " [{0}]: {1}", i++, obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - myBA values: - [0]: False - [1]: False - [2]: False - [3]: False - [4]: False - - After setting all elements to true, - [0]: True - [1]: True - [2]: True - [3]: True - [4]: True - - After setting the last element to false, - [0]: True - [1]: True - [2]: True - [3]: True - [4]: False - - The last two elements are: - at index 3 : True - at index 4 : False - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp deleted file mode 100644 index ca1de36ae1e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, int myWidth ); -int main() -{ - - // Creates and initializes two BitArrays of the same size. - BitArray^ myBA1 = gcnew BitArray( 4 ); - BitArray^ myBA2 = gcnew BitArray( 4 ); - myBA1[ 0 ] = false; - myBA1[ 1 ] = false; - myBA1[ 2 ] = true; - myBA1[ 3 ] = true; - myBA2[ 0 ] = false; - myBA2[ 1 ] = true; - myBA2[ 2 ] = false; - myBA2[ 3 ] = true; - - // Performs a bitwise NOT operation between BitArray instances of the same size. - Console::WriteLine( "Initial values" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - myBA1->Not(); - myBA2->Not(); - Console::WriteLine( "After NOT" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); -} - -void PrintValues( IEnumerable^ myList, int myWidth ) -{ - int i = myWidth; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - if ( i <= 0 ) - { - i = myWidth; - Console::WriteLine(); - } - - i--; - Console::Write( "{0,8}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initial values - myBA1: False False True True - myBA2: False True False True - - After NOT - myBA1: True True False False - myBA2: True False True False - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp deleted file mode 100644 index 0a5de2543d8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, int myWidth ); -int main() -{ - - // Creates and initializes two BitArrays of the same size. - BitArray^ myBA1 = gcnew BitArray( 4 ); - BitArray^ myBA2 = gcnew BitArray( 4 ); - myBA1[ 0 ] = false; - myBA1[ 1 ] = false; - myBA1[ 2 ] = true; - myBA1[ 3 ] = true; - myBA2[ 0 ] = false; - myBA2[ 1 ] = true; - myBA2[ 2 ] = false; - myBA2[ 3 ] = true; - - // Performs a bitwise OR operation between BitArray instances of the same size. - Console::WriteLine( "Initial values" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - Console::WriteLine( "Result" ); - Console::Write( "OR:" ); - PrintValues( myBA1->Or( myBA2 ), 8 ); - Console::WriteLine(); - Console::WriteLine( "After OR" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - - // Performing OR between BitArray instances of different sizes returns an exception. - try - { - BitArray^ myBA3 = gcnew BitArray( 8 ); - myBA3[ 0 ] = false; - myBA3[ 1 ] = false; - myBA3[ 2 ] = false; - myBA3[ 3 ] = false; - myBA3[ 4 ] = true; - myBA3[ 5 ] = true; - myBA3[ 6 ] = true; - myBA3[ 7 ] = true; - myBA1->Or( myBA3 ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - -} - -void PrintValues( IEnumerable^ myList, int myWidth ) -{ - int i = myWidth; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - if ( i <= 0 ) - { - i = myWidth; - Console::WriteLine(); - } - - i--; - Console::Write( "{0,8}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initial values - myBA1: False False True True - myBA2: False True False True - - Result - OR: False True True True - - After OR - myBA1: False True True True - myBA2: False True False True - - Exception: System.ArgumentException: Array lengths must be the same. - at System.Collections.BitArray.Or(BitArray value) - at SamplesBitArray.Main() - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp deleted file mode 100644 index cd12c4f4ea2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp +++ /dev/null @@ -1,99 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myList, int myWidth ); -int main() -{ - - // Creates and initializes two BitArrays of the same size. - BitArray^ myBA1 = gcnew BitArray( 4 ); - BitArray^ myBA2 = gcnew BitArray( 4 ); - myBA1[ 0 ] = false; - myBA1[ 1 ] = false; - myBA1[ 2 ] = true; - myBA1[ 3 ] = true; - myBA2[ 0 ] = false; - myBA2[ 1 ] = true; - myBA2[ 2 ] = false; - myBA2[ 3 ] = true; - - // Performs a bitwise XOR operation between BitArray instances of the same size. - Console::WriteLine( "Initial values" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - Console::WriteLine( "Result" ); - Console::Write( "XOR:" ); - PrintValues( myBA1->Xor( myBA2 ), 8 ); - Console::WriteLine(); - Console::WriteLine( "After XOR" ); - Console::Write( "myBA1:" ); - PrintValues( myBA1, 8 ); - Console::Write( "myBA2:" ); - PrintValues( myBA2, 8 ); - Console::WriteLine(); - - // Performing XOR between BitArray instances of different sizes returns an exception. - try - { - BitArray^ myBA3 = gcnew BitArray( 8 ); - myBA3[ 0 ] = false; - myBA3[ 1 ] = false; - myBA3[ 2 ] = false; - myBA3[ 3 ] = false; - myBA3[ 4 ] = true; - myBA3[ 5 ] = true; - myBA3[ 6 ] = true; - myBA3[ 7 ] = true; - myBA1->Xor( myBA3 ); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception: {0}", myException ); - } - -} - -void PrintValues( IEnumerable^ myList, int myWidth ) -{ - int i = myWidth; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - if ( i <= 0 ) - { - i = myWidth; - Console::WriteLine(); - } - - i--; - Console::Write( "{0,8}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initial values - myBA1: False False True True - myBA2: False True False True - - Result - XOR: False True True False - - After XOR - myBA1: False True True False - myBA2: False True False True - - Exception: System.ArgumentException: Array lengths must be the same. - at System.Collections.BitArray.Xor(BitArray value) - at SamplesBitArray.Main() - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp deleted file mode 100644 index cd78af80b5c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using - -using namespace System; -using namespace System::Diagnostics; - -public ref class SomeClass -{ -// -private: - static BooleanSwitch^ boolSwitch = gcnew BooleanSwitch("mySwitch", - "Switch in config file"); - -public: - static void Main( ) - { - //... - Console::WriteLine("Boolean switch {0} configured as {1}", - boolSwitch->DisplayName, ((Boolean^)boolSwitch->Enabled)->ToString()); - if (boolSwitch->Enabled) - { - //... - } - } -// -}; - -int main() -{ - SomeClass::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp deleted file mode 100644 index 824f579d9be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -// -public ref class BooleanSwitchTest -{ -private: - - /* Create a BooleanSwitch for data.*/ - static BooleanSwitch^ dataSwitch = gcnew BooleanSwitch( "Data","DataAccess module" ); - -public: - static void MyMethod( String^ location ) - { - - //Insert code here to handle processing. - if ( dataSwitch->Enabled ) - Console::WriteLine( "Error happened at {0}", location ); - } - -}; - -int main() -{ - - //Run the method which writes an error message specifying the location of the error. - BooleanSwitchTest::MyMethod( "in main" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp deleted file mode 100644 index fb8731a2646..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -// -public ref class BooleanSwitchTest -{ -private: - - /* Create a BooleanSwitch for data.*/ - static BooleanSwitch^ dataSwitch = gcnew BooleanSwitch( "Data","DataAccess module" ); - -public: - static void MyMethod( String^ location ) - { - - //Insert code here to handle processing. - if ( dataSwitch->Enabled ) - Console::WriteLine( "Error happened at {0}", location ); - } - -}; - -int main() -{ - - //Run the method that writes an error message specifying the location of the error. - BooleanSwitchTest::MyMethod( "in main" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp deleted file mode 100644 index cf7e2053472..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System::Runtime::InteropServices; - -[ClassInterface(ClassInterfaceType::AutoDispatch)] -public ref class MyClass -{ -public: - MyClass(){} - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp deleted file mode 100644 index 1264a13f77c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp +++ /dev/null @@ -1,16 +0,0 @@ -using namespace System; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; - -public ref class Sample -{ -private: - void Method() - { - FirstMatchCodeGroup^ codeGroup = gcnew FirstMatchCodeGroup( nullptr,gcnew PolicyStatement( gcnew PermissionSet( PermissionState::None ) ) ); - // - codeGroup->PolicyStatement = gcnew PolicyStatement( gcnew NamedPermissionSet( "MyPermissionSet" ) ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp deleted file mode 100644 index 6f07c6f7725..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Runtime::InteropServices; - -/* -*/ -// -interface class Baz -{ - void SetColor( [ComAliasName("stdole.OLE_COLOR")]int cl ); - - [returnvalue:ComAliasName("stdole.OLE_COLOR")] - int GetColor(); -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp deleted file mode 100644 index 5f0c83c0974..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::InteropServices; -public ref class MyClassThatNeedsToRegister -{ -public: - - [ComRegisterFunctionAttribute] - static void RegisterFunction( Type^ t ) - { - - //Insert code here. - } - - - [ComUnregisterFunctionAttribute] - static void UnregisterFunction( Type^ t ) - { - - //Insert code here. - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp deleted file mode 100644 index fb779b2bf59..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,8 +0,0 @@ - -// -using namespace System::Runtime::InteropServices; - -[ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")] -public ref class Baz{}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp deleted file mode 100644 index 51b8108af9d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -using namespace System; -// -using namespace System::Runtime::InteropServices; - -[ComVisible(false)] -ref class MyClass -{ -private: - int myProperty; - -public: - MyClass() - { - - //Insert code here. - } - - - [ComVisible(false)] - int MyMethod( String^ param ) - { - return 0; - } - - bool MyOtherMethod() - { - return true; - } - - - property int MyProperty - { - - [ComVisible(false)] - int get() - { - return myProperty; - } - - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp deleted file mode 100644 index b9c151ae5a8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; -using namespace Microsoft::CSharp; -CodeCompileUnit^ GetCompileUnit() -{ - - // Create a compile unit to contain a CodeDOM graph. - CodeCompileUnit^ cu = gcnew CodeCompileUnit; - - // Create a namespace named TestSpace. - CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); - - // Declare a new type named TestClass. - CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); - - // Declare a new member string field named TestField. - CodeMemberField^ cmf = gcnew CodeMemberField( "System.String","TestField" ); - - // Add the field to the type. - cd->Members->Add( cmf ); - - // Declare a new member method named TestMethod. - CodeMemberMethod^ cm = gcnew CodeMemberMethod; - cm->Name = "TestMethod"; - - // Declare a string variable named TestVariable. - CodeVariableDeclarationStatement^ cvd = gcnew CodeVariableDeclarationStatement( "System.String1","TestVariable" ); - cm->Statements->Add( cvd ); - - // Cast the TestField reference expression to string and assign it to the TestVariable. - CodeAssignStatement^ ca = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "TestVariable" ),gcnew CodeCastExpression( "System.String2",gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" ) ) ); - - // This code can be used to generate the following code in C#: - // TestVariable = ((string)(this.TestField)); - cm->Statements->Add( ca ); - - // Add the TestMethod member to the TestClass type. - cd->Members->Add( cm ); - - // Add the TestClass type to the namespace. - cn->Types->Add( cd ); - - // Add the TestSpace namespace to the compile unit. - cu->Namespaces->Add( cn ); - return cu; -} - -int main() -{ - - // Output some program information using Console.WriteLine. - Console::WriteLine( "This program compiles a CodeDOM program that incorrectly declares multiple data" ); - Console::WriteLine( "types to demonstrate handling compiler errors programmatically." ); - Console::WriteLine( "" ); - - // Compile the CodeCompileUnit retrieved from the GetCompileUnit() method. - //CSharpCodeProvider ^ provider = gcnew Microsoft::CSharp::CSharpCodeProvider; - CodeDomProvider ^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Initialize a CompilerParameters with the options for compilation. - array^assemblies = {"System.dll"}; - CompilerParameters^ options = gcnew CompilerParameters( assemblies,"output.exe" ); - - // Compile the CodeDOM graph and store the results in a CompilerResults. - CompilerResults^ results = provider->CompileAssemblyFromDom( options, GetCompileUnit() ); - - // Compilation produces errors. Print out each error. - Console::WriteLine( "Listing errors from compilation: " ); - Console::WriteLine( "" ); - for ( int i = 0; i < results->Errors->Count; i++ ) - Console::WriteLine( results->Errors[ i ] ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp deleted file mode 100644 index d67485dbd80..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::ComponentModel; -using namespace System::Security::Cryptography; - -// -void EncryptData( String^ inName, String^ outName, array^aesKey, array^aesIV ) -{ - - //Create the file streams to handle the input and output files. - FileStream^ fin = gcnew FileStream( inName,FileMode::Open,FileAccess::Read ); - FileStream^ fout = gcnew FileStream( outName,FileMode::OpenOrCreate,FileAccess::Write ); - fout->SetLength( 0 ); - - //Create variables to help with read and write. - array^bin = gcnew array(100); - long rdlen = 0; //This is the total number of bytes written. - - long totlen = (long)fin->Length; //This is the total length of the input file. - - int len; //This is the number of bytes to be written at a time. - - Aes^ aes = Aes::Create(); - - CryptoStream^ encStream = gcnew CryptoStream( fout,aes->CreateEncryptor( aesKey, aesIV ),CryptoStreamMode::Write ); - Console::WriteLine( "Encrypting..." ); - - //Read from the input file, then encrypt and write to the output file. - while ( rdlen < totlen ) - { - len = fin->Read( bin, 0, 100 ); - encStream->Write( bin, 0, len ); - rdlen = rdlen + len; - Console::WriteLine( "{0} bytes processed", rdlen ); - } - - encStream->Close(); - fout->Close(); - fin->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp deleted file mode 100644 index 505973f52b6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Windows::Forms; -using namespace System::Security::Cryptography; - -// -void EncryptData( String^ inName, String^ outName, array^desKey, array^desIV ) -{ - - //Create the file streams to handle the input and output files. - FileStream^ fin = gcnew FileStream( inName,FileMode::Open,FileAccess::Read ); - FileStream^ fout = gcnew FileStream( outName,FileMode::OpenOrCreate,FileAccess::Write ); - fout->SetLength( 0 ); - - //Create variables to help with read and write. - array^bin = gcnew array(100); - long rdlen = 0; //This is the total number of bytes written. - - long totlen = (long)fin->Length; //This is the total length of the input file. - - int len; //This is the number of bytes to be written at a time. - - DES^ des = gcnew DESCryptoServiceProvider; - CryptoStream^ encStream = gcnew CryptoStream( fout,des->CreateEncryptor( desKey, desIV ),CryptoStreamMode::Write ); - Console::WriteLine( "Encrypting..." ); - - //Read from the input file, then encrypt and write to the output file. - while ( rdlen < totlen ) - { - len = fin->Read( bin, 0, 100 ); - encStream->Write( bin, 0, len ); - rdlen = rdlen + len; - Console::WriteLine( "{0} bytes processed", rdlen ); - } - - encStream->Close(); - fout->Close(); - fin->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp deleted file mode 100644 index 494de16ea1c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -void main() -{ - DateTime dt = DateTime::Now; - array^format = {L"d",L"D",L"f",L"F",L"g",L"G",L"m",L"r",L"s",L"t",L"T",L"u",L"U",L"y",L"dddd, MMMM dd yyyy",L"ddd, MMM d \"'\"yy",L"dddd, MMMM dd",L"M/yy",L"dd-MM-yy"}; - String^ date; - for ( int i = 0; i < format->Length; i++ ) - { - date = dt.ToString( format[ i ], DateTimeFormatInfo::InvariantInfo ); - Console::WriteLine( String::Concat( format[ i ], L" :", date ) ); - - } - - /** Output. - * - * d :08/17/2000 - * D :Thursday, August 17, 2000 - * f :Thursday, August 17, 2000 16:32 - * F :Thursday, August 17, 2000 16:32:32 - * g :08/17/2000 16:32 - * G :08/17/2000 16:32:32 - * m :August 17 - * r :Thu, 17 Aug 2000 23:32:32 GMT - * s :2000-08-17T16:32:32 - * t :16:32 - * T :16:32:32 - * u :2000-08-17 23:32:32Z - * U :Thursday, August 17, 2000 23:32:32 - * y :August, 2000 - * dddd, MMMM dd yyyy :Thursday, August 17 2000 - * ddd, MMM d "'"yy :Thu, Aug 17 '00 - * dddd, MMMM dd :Thursday, August 17 - * M/yy :8/00 - * dd-MM-yy :17-08-00 - */ -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp deleted file mode 100644 index ca1ec41a454..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp +++ /dev/null @@ -1,109 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Globalization; -public ref class SamplesDateTimeFormatInfo -{ -public: - static void Main() - { - - // Creates a new DateTimeFormatinfo. - DateTimeFormatInfo^ myDtfi = gcnew DateTimeFormatInfo; - - // Gets and prints all the patterns - array^myPatternsArray = myDtfi->GetAllDateTimePatterns(); - Console::WriteLine( "ALL the patterns:" ); - PrintIndexAndValues( myPatternsArray ); - - // Gets and prints the pattern(s) associated with some of the format characters. - myPatternsArray = myDtfi->GetAllDateTimePatterns( 'd' ); - Console::WriteLine( "The patterns for 'd':" ); - PrintIndexAndValues( myPatternsArray ); - myPatternsArray = myDtfi->GetAllDateTimePatterns( 'D' ); - Console::WriteLine( "The patterns for 'D':" ); - PrintIndexAndValues( myPatternsArray ); - myPatternsArray = myDtfi->GetAllDateTimePatterns( 'f' ); - Console::WriteLine( "The patterns for 'f':" ); - PrintIndexAndValues( myPatternsArray ); - myPatternsArray = myDtfi->GetAllDateTimePatterns( 'F' ); - Console::WriteLine( "The patterns for 'F':" ); - PrintIndexAndValues( myPatternsArray ); - myPatternsArray = myDtfi->GetAllDateTimePatterns( 'r' ); - Console::WriteLine( "The patterns for 'r':" ); - PrintIndexAndValues( myPatternsArray ); - myPatternsArray = myDtfi->GetAllDateTimePatterns( 'R' ); - Console::WriteLine( "The patterns for 'R':" ); - PrintIndexAndValues( myPatternsArray ); - } - - public: - static void PrintIndexAndValues( array^myArray ) { - int i = 0; - for each ( String^ s in myArray ) - Console::WriteLine( "\t[{0}]:\t{1}", i++, s ); - Console::WriteLine(); - } -}; - -int main() -{ - SamplesDateTimeFormatInfo::Main(); -} - -/* -This code produces the following output. - -ALL the patterns: - [0]: MM/dd/yyyy - [1]: dddd, dd MMMM yyyy - [2]: dddd, dd MMMM yyyy HH:mm - [3]: dddd, dd MMMM yyyy hh:mm tt - [4]: dddd, dd MMMM yyyy H:mm - [5]: dddd, dd MMMM yyyy h:mm tt - [6]: dddd, dd MMMM yyyy HH:mm:ss - [7]: MM/dd/yyyy HH:mm - [8]: MM/dd/yyyy hh:mm tt - [9]: MM/dd/yyyy H:mm - [10]: MM/dd/yyyy h:mm tt - [11]: MM/dd/yyyy HH:mm:ss - [12]: MMMM dd - [13]: MMMM dd - [14]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' - [15]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' - [16]: yyyy'-'MM'-'dd'T'HH':'mm':'ss - [17]: HH:mm - [18]: hh:mm tt - [19]: H:mm - [20]: h:mm tt - [21]: HH:mm:ss - [22]: yyyy'-'MM'-'dd HH':'mm':'ss'Z' - [23]: dddd, dd MMMM yyyy HH:mm:ss - [24]: yyyy MMMM - [25]: yyyy MMMM - -The patterns for 'd': - [0]: MM/dd/yyyy - -The patterns for 'D': - [0]: dddd, dd MMMM yyyy - -The patterns for 'f': - [0]: dddd, dd MMMM yyyy HH:mm - [1]: dddd, dd MMMM yyyy hh:mm tt - [2]: dddd, dd MMMM yyyy H:mm - [3]: dddd, dd MMMM yyyy h:mm tt - -The patterns for 'F': - [0]: dddd, dd MMMM yyyy HH:mm:ss - -The patterns for 'r': - [0]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' - -The patterns for 'R': - [0]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp deleted file mode 100644 index 3aab3172dfa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -// Specify /DDEBUG when compiling. - -#using -using namespace System; -using namespace System::Diagnostics; - -int main( void ) -{ - #if defined(DEBUG) - Debug::Listeners->Add( gcnew TextWriterTraceListener( Console::Out ) ); - Debug::AutoFlush = true; - Debug::Indent(); - Debug::WriteLine( "Entering Main" ); - #endif - Console::WriteLine( "Hello World." ); - #if defined(DEBUG) - Debug::WriteLine( "Exiting Main" ); - Debug::Unindent(); - #endif - return 0; -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp deleted file mode 100644 index 4cd8faa26fc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -int main( void ) -{ - - // - // Create a local value. - int index; - - // Perform some action that sets the local value. - index = -40; - - // Test that the local value is valid. - #if defined(DEBUG) - Debug::Assert( index > -1 ); - #endif - // - - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp deleted file mode 100644 index db8c6bd2ccb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -void MyMethod( Object^ obj, Type^ type ); - -int main( void ) -{ - MyMethod( nullptr, nullptr ); - return 0; -} - -// -void MyMethod( Object^ obj, Type^ type ) -{ - #if defined(DEBUG) - Debug::Assert( type != nullptr, "Type paramater is null" ); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp deleted file mode 100644 index 06b428a1024..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -void MyMethod( Object^ obj, Type^ type ); - -int main( void ) -{ - MyMethod( nullptr, nullptr ); - return 0; -} - -// -void MyMethod( Object^ obj, Type^ type ) -{ - #if defined(DEBUG) - Debug::Assert( type != nullptr, "Type paramater is null", "Can't get object for null type" ); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp deleted file mode 100644 index a9769743b9c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -// Specify /DDEBUG when compiling. - -#using -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -void main() -{ - #if defined(DEBUG) - // Create a new stream object for an output file named TestFile.txt. - FileStream^ myFileStream = - gcnew FileStream( "TestFile.txt", FileMode::Append ); - - // Add the stream object to the trace listeners. - TextWriterTraceListener^ myTextListener = - gcnew TextWriterTraceListener( myFileStream ); - Debug::Listeners->Add( myTextListener ); - - // Write output to the file. - Debug::WriteLine( "Test output" ); - - // Flush and close the output stream. - Debug::Flush(); - Debug::Close(); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp deleted file mode 100644 index 52656e679ec..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -enum class Option -{ - First, Second, Last -}; - -ref class Test -{ -public: - void SomeMethod() - { - int option = (int)Option::Last + 1; - double result; - // - switch ( option ) - { - case Option::First: - result = 1.0; - break; - - // Insert additional cases. - - default: - #if defined(DEBUG) - Debug::Fail( "Unknown Option" + option ); - #endif - result = 1.0; - break; - } - // - } -}; - -int main( void ) -{ - try - { - Object^ b; - b->ToString(); - } - // - catch ( Exception^ e ) - { - #if defined(DEBUG) - Debug::Fail( "Unknown Option " + option + ", using the default." ); - #endif - } - // - - Test^ test = gcnew Test(); - test->SomeMethod(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp deleted file mode 100644 index 3333cf56f0b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -enum class Option -{ - First, Second, Last -}; - -ref class Test -{ -public: - void SomeMethod() - { - int option = (int)Option::Last + 1; - double result; - // - switch ( option ) - { - case Option::First: - result = 1.0; - break; - - // Insert additional cases. - - default: - #if defined(DEBUG) - Debug::Fail( "Unknown Option" + option, "Result set to 1.0" ); - #endif - result = 1.0; - break; - } - // - } -}; - -int main( void ) -{ - try - { - Object^ b; - b->ToString(); - } - // - catch ( Exception^ e ) - { - #if defined(DEBUG) - Debug::Fail( "Cannot find SpecialController, proceeding with StandardController", "Setting Controller to default value" ); - #endif - } - // - - Test^ test = gcnew Test(); - test->SomeMethod(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp deleted file mode 100644 index daaf7687108..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -int main( void ) -{ - // - #if defined(DEBUG) - Debug::WriteLine( "List of errors:" ); - Debug::Indent(); - Debug::WriteLine( "Error 1: File not found" ); - Debug::WriteLine( "Error 2: Directory not found" ); - Debug::Unindent(); - Debug::WriteLine( "End of list of errors" ); - #endif - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp deleted file mode 100644 index 267bc674630..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -int main( void ) -{ - - // - // Create a listener that outputs to the console screen - // and add it to the debug listeners. - #if defined(DEBUG) - TextWriterTraceListener^ myWriter = - gcnew TextWriterTraceListener( System::Console::Out ); - Debug::Listeners->Add( myWriter ); - #endif - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp deleted file mode 100644 index 6b4827ca3c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( generalSwitch->TraceError ) - { - #if defined(DEBUG) - Debug::Write( myObject, category ); - #endif - } - // Write a second message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - #if defined(DEBUG) - Debug::Write( " Object is not valid for this category." ); - #endif - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp deleted file mode 100644 index db1cf0381a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod() - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceError, "My error message. " ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteIf( generalSwitch->TraceVerbose, - "My second error message." ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp deleted file mode 100644 index 21e33495423..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceError, myObject ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceVerbose, - " is not a valid value for this method." ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp deleted file mode 100644 index 9fa1f596191..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceVerbose, String::Concat( myObject, - " is not a valid object for category: " ), category ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceError, - " Please use a different category." ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp deleted file mode 100644 index aa9a5022701..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceVerbose, myObject, category ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceError, - " Object is not valid for this category." ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp deleted file mode 100644 index ef9961a738d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod() - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( generalSwitch->TraceError ) - { - #if defined(DEBUG) - Debug::Write( "My error message. " ); - #endif - } - // Write a second message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - #if defined(DEBUG) - Debug::WriteLine( "My second error message." ); - #endif - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp deleted file mode 100644 index c3a53e7adcd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( generalSwitch->TraceError ) - { - #if defined(DEBUG) - Debug::Write( "Invalid object. " ); - #endif - } - // Write a second message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - #if defined(DEBUG) - Debug::WriteLine( myObject ); - #endif - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp deleted file mode 100644 index 05f395a2ce6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( generalSwitch->TraceError ) - { - #if defined(DEBUG) - Debug::Write( "My error message. " ); - #endif - } - // Write a second message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - #if defined(DEBUG) - Debug::WriteLine( "My second error message.", category ); - #endif - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp deleted file mode 100644 index 8c64d37cc22..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( generalSwitch->TraceError ) - { - #if defined(DEBUG) - Debug::Write( "Invalid object for category. " ); - #endif - } - // Write a second message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - #if defined(DEBUG) - Debug::WriteLine( myObject, category ); - #endif - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp deleted file mode 100644 index 8ded25d813b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod() - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceError, "My error message. " ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceVerbose, - "My second error message." ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp deleted file mode 100644 index fefafc88fcc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceError, "Invalid object. " ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceVerbose, myObject ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp deleted file mode 100644 index ee7c49907b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf( generalSwitch->TraceError, "My error message. " ); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceVerbose, - "My second error message.", category ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp deleted file mode 100644 index d7fb6a3dfaa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ - // - // Class-level declaration. - // Create a TraceSwitch. - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General","Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - // Write the message if the TraceSwitch level is set to Error or higher. - #if defined(DEBUG) - Debug::WriteIf(generalSwitch->TraceError, "Invalid object for category. "); - - // Write a second message if the TraceSwitch level is set to Verbose. - Debug::WriteLineIf( generalSwitch->TraceVerbose, myObject, category ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp deleted file mode 100644 index 56512d92aca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // These bytes in UTF-8 correspond to 3 different Unicode - // characters: space (U+0020), # (U+0023), and the biohazard - // symbol (U+2623). Note the biohazard symbol requires 3 bytes - // in UTF-8 (hexadecimal e2, 98, a3). Decoders store state across - // multiple calls to GetChars, handling the case when one char - // is in multiple byte arrays. - array^bytes1 = {0x20,0x23,0xe2}; - array^bytes2 = {0x98,0xa3}; - array^chars = gcnew array(3); - Decoder^ d = Encoding::UTF8->GetDecoder(); - int charLen = d->GetChars( bytes1, 0, bytes1->Length, chars, 0 ); - - // The value of charLen should be 2 now. - charLen += d->GetChars( bytes2, 0, bytes2->Length, chars, charLen ); - for ( UInt16 index(0); index < chars->Length; ++index ) - { - Console::Write( "U+{0:X4} ", static_cast(chars[ index ]) ); - - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp deleted file mode 100644 index ec2ce96c984..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -// -using namespace System; -delegate String^ myMethodDelegate( // Declares a delegate for a method that takes in an int and returns a String. -int myInt ); - -// Defines some methods to which the delegate can point. -ref class mySampleClass -{ -public: - - // Defines an instance method. - String^ myStringMethod( int myInt ) - { - if ( myInt > 0 ) - return ("positive"); - - if ( myInt < 0 ) - return ("negative"); - - return ("zero"); - } - - - // Defines a static method. - static String^ mySignMethod( int myInt ) - { - if ( myInt > 0 ) - return ("+"); - - if ( myInt < 0 ) - return ("-"); - - return (""); - } - -}; - -int main() -{ - - // Creates one delegate for each method. For the instance method, an - // instance (mySC) must be supplied. For the static method, only the - // method name is needed. - mySampleClass^ mySC = gcnew mySampleClass; - myMethodDelegate^ myD1 = gcnew myMethodDelegate( mySC, &mySampleClass::myStringMethod ); - myMethodDelegate^ myD2 = gcnew myMethodDelegate( mySampleClass::mySignMethod ); - - // Invokes the delegates. - Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", 5, myD1( 5 ), myD2( 5 ) ); - Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", -3, myD1( -3 ), myD2( -3 ) ); - Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", 0, myD1( 0 ), myD2( 0 ) ); -} - -/* -This code produces the following output: - -5 is positive; use the sign "+". --3 is negative; use the sign "-". -0 is zero; use the sign "". -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp deleted file mode 100644 index 296584f4b92..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - DirectoryInfo^ dir = gcnew DirectoryInfo( "." ); - String^ dirName = dir->Name; - Console::WriteLine( "DirectoryInfo name is {0}.", dirName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp deleted file mode 100644 index 0bcc87c363d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System::Runtime::InteropServices; -public ref class MyClass -{ -public: - MyClass(){} - - - [DispId(8)] - void MyMethod(){} - - int MyOtherMethod() - { - return 0; - } - - - [DispId(9)] - bool MyField; -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp deleted file mode 100644 index f3f215111a7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; -public ref class EnumSample -{ -public: - enum class Colors - { - Red = 1, - Blue = 2 - }; - - static void main() - { - Enum ^ myColors = Colors::Red; - Console::WriteLine( "The value of this instance is '{0}'", myColors ); - } - -}; - -int main() -{ - EnumSample::main(); -} - -/* -Output. -The value of this instance is 'Red'. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp deleted file mode 100644 index 1d5d2c3bae2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Windows::Forms; - -// -int main() -{ - - // Creates an exception with an error message. - Exception^ myException = gcnew Exception( "This is an exception test" ); - - // Creates an ErrorEventArgs with the exception. - ErrorEventArgs^ myErrorEventArgs = gcnew ErrorEventArgs( myException ); - - // Extracts the exception from the ErrorEventArgs and display it. - Exception^ myReturnedException = myErrorEventArgs->GetException(); - MessageBox::Show( String::Concat( "The returned exception is: ", myReturnedException->Message ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp deleted file mode 100644 index dafe3cd798d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Windows::Forms; - -// -int main() -{ - - //Creates an exception with an error message. - Exception^ myException = gcnew Exception( "This is an exception test" ); - - //Creates an ErrorEventArgs with the exception. - ErrorEventArgs^ myErrorEventArgs = gcnew ErrorEventArgs( myException ); - - //Extracts the exception from the ErrorEventArgs and display it. - Exception^ myReturnedException = myErrorEventArgs->GetException(); - MessageBox::Show( String::Concat( "The returned exception is: ", myReturnedException->Message ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp deleted file mode 100644 index 220658df802..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Create an EventLog instance and assign its log name. - EventLog^ myLog = gcnew EventLog; - myLog->Log = "myNewLog"; - myLog->Clear(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp deleted file mode 100644 index 837b9e669dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - //An event log source should not be created and immediately used. - //There is a latency time to enable the source, it should be created - //prior to executing the application that uses the source. - //Execute this sample a second time to use the new source. - EventLog::CreateEventSource( "MySource", "MyNewLog" ); - Console::WriteLine( "CreatingEventSource" ); - // The source is created. Exit the application to allow it to be registered. - return 0; - } - - - // Create an EventLog instance and assign its source. - EventLog^ myLog = gcnew EventLog; - myLog->Source = "MySource"; - - // Write an informational entry to the event log. - myLog->WriteEntry( "Writing to event log." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp deleted file mode 100644 index d34be2b024f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - String^ logName; - if ( EventLog::SourceExists( "MySource", "MyMachine") ) - { - - // Find the log associated with this source. - logName = EventLog::LogNameFromSourceName( "MySource", "MyMachine" ); - // Make sure the source is in the log we believe it to be in - if (logName != "MyLog") - return -1; - // Delete the source and the log. - EventLog::DeleteEventSource( "MySource", "MyMachine" ); - EventLog::Delete( logName, "MyMachine" ); - Console::WriteLine( "{0} deleted.", logName ); - } - else - { - // Create the event source to make next try successful. - EventSourceCreationData^ mySourceData = gcnew EventSourceCreationData("MySource", "MyLog"); - mySourceData->MachineName = "MyMachine"; - EventLog::CreateEventSource(mySourceData); - } -} - -// - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp deleted file mode 100644 index 7fbbf42dd7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - String^ logName; - if ( EventLog::SourceExists( "MySource" ) ) - { - - // Find the log associated with this source. - logName = EventLog::LogNameFromSourceName( "MySource", "." ); - // Make sure the source is in the log we believe it to be in - if (logName != "MyLog") - return -1; - // Delete the source and the log. - EventLog::DeleteEventSource( "MySource" ); - EventLog::Delete( logName ); - Console::WriteLine( "{0} deleted.", logName ); - } - else - { - // Create the event source to make next try successful. - EventLog::CreateEventSource("MySource", "MyLog"); - } -} - -// - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp deleted file mode 100644 index 8d2633a605a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -ref class MySample -{ -public: - static void MyOnEntryWritten( Object^ /*source*/, EntryWrittenEventArgs^ e ) - { - Console::WriteLine( "Written: {0}", e->Entry->Message ); - } - -}; - -int main() -{ - EventLog^ myNewLog = gcnew EventLog; - myNewLog->Log = "MyCustomLog"; - myNewLog->EntryWritten += gcnew EntryWrittenEventHandler( MySample::MyOnEntryWritten ); - myNewLog->EnableRaisingEvents = true; - Console::WriteLine( "Press \'q\' to quit." ); - - // Wait for the EntryWrittenEvent or a quit command. - while ( Console::Read() != 'q' ) - { - - // Wait. - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp deleted file mode 100644 index b53690fb654..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - EventLog^ myLog = gcnew EventLog; - myLog->Log = "MyNewLog"; - System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLogEntry^ entry = safe_cast(myEnum->Current); - Console::WriteLine( "\tEntry: {0}", entry->Message ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp deleted file mode 100644 index 6a70ed0eae5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -ref class MySample -{ -private: - - // This member is used to wait for events. - static AutoResetEvent^ signal; - -public: - static void main() - { - signal = gcnew AutoResetEvent( false ); - EventLog^ myNewLog = gcnew EventLog; - myNewLog->Source = "testEventLogEvent"; - myNewLog->EntryWritten += gcnew EntryWrittenEventHandler( MyOnEntryWritten ); - myNewLog->EnableRaisingEvents = true; - myNewLog->WriteEntry("Test message", EventLogEntryType::Information); - signal->WaitOne(); - } - - static void MyOnEntryWritten( Object^ /*source*/, EntryWrittenEventArgs^ /*e*/ ) - { - Console::WriteLine("In event handler"); - signal->Set(); - } - -}; - -int main() -{ - MySample::main(); -} - -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp deleted file mode 100644 index 784d135be2e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - //An event log source should not be created and immediately used. - //There is a latency time to enable the source, it should be created - //prior to executing the application that uses the source. - //Execute this sample a second time to use the new source. - EventLog::CreateEventSource( "MySource", "MyNewLog" ); - Console::WriteLine( "CreatingEventSource" ); - // The source is created. Exit the application to allow it to be registered. - return 0; - } - - - // Create an EventLog instance and assign its log name. - EventLog^ myLog = gcnew EventLog( "myNewLog" ); - - // Read the event log entries. - System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLogEntry^ entry = safe_cast(myEnum->Current); - Console::WriteLine( "\tEntry: {0}", entry->Message ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp deleted file mode 100644 index d4a6b83d0d1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - //An event log source should not be created and immediately used. - //There is a latency time to enable the source, it should be created - //prior to executing the application that uses the source. - //Execute this sample a second time to use the new source. - EventLog::CreateEventSource( "MySource", "MyNewLog", "myServer" ); - Console::WriteLine( "CreatingEventSource" ); - // The source is created. Exit the application to allow it to be registered. - return 0; - } - - // Create an EventLog instance and assign its log name. - EventLog^ myLog = gcnew EventLog( "myNewLog","myServer" ); - - // Read the event log entries. - System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLogEntry^ entry = safe_cast(myEnum->Current); - Console::WriteLine( "\tEntry: {0}", entry->Message ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp deleted file mode 100644 index 1406cddf5c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - //An event log source should not be created and immediately used. - //There is a latency time to enable the source, it should be created - //prior to executing the application that uses the source. - //Execute this sample a second time to use the new source. - EventLog::CreateEventSource( "MySource", "MyNewLog"); - Console::WriteLine( "CreatingEventSource" ); - // The source is created. Exit the application to allow it to be registered. - return 0; - } - - // Create an EventLog instance and assign its source. - EventLog^ myLog = gcnew EventLog( "myNewLog",".","MySource" ); - - // Write an entry to the log. - myLog->WriteEntry( String::Format( "Writing to event log on {0}", myLog->MachineName ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp deleted file mode 100644 index 0bb3db04e83..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - array^remoteEventLogs; - remoteEventLogs = EventLog::GetEventLogs( "myServer" ); - Console::WriteLine( "Number of logs on computer: {0}", remoteEventLogs->Length ); - System::Collections::IEnumerator^ myEnum = remoteEventLogs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLog^ log = safe_cast(myEnum->Current); - Console::WriteLine( "Log: {0}", log->Log ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp deleted file mode 100644 index e9a75f0cb41..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - EventLog^ myNewLog = gcnew EventLog; - myNewLog->Log = "NewEventLog"; - System::Collections::IEnumerator^ myEnum = myNewLog->Entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLogEntry^ entry = safe_cast(myEnum->Current); - Console::WriteLine( "\tEntry: {0}", entry->Message ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp deleted file mode 100644 index fe550a181e0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -int main() -{ - EventLog^ myNewLog = gcnew EventLog; - myNewLog->Log = "NewEventLog"; - myNewLog->MachineName = "MyServer"; - System::Collections::IEnumerator^ myEnum = myNewLog->Entries->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventLogEntry^ entry = safe_cast(myEnum->Current); - Console::WriteLine( "\tEntry: {0}", entry->Message ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp deleted file mode 100644 index 44c4682c561..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - EventLog::CreateEventSource( "MySource", "MyNewLog" ); - Console::WriteLine( "CreatingEventSource" ); - } - - - // Create an EventLog instance and assign its source. - EventLog^ myLog = gcnew EventLog; - myLog->Source = "MySource"; - - // Write an informational entry to the event log. - myLog->WriteEntry( "Writing to event log." ); - Console::WriteLine( "Message written to event log." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp deleted file mode 100644 index c66d775c270..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource", "MyServer" ) ) - { - EventLog::CreateEventSource( "MySource", "MyNewLog", "MyServer" ); - Console::WriteLine( "CreatingEventSource" ); - } - - - // Create an EventLog instance and assign its source. - EventLog^ myLog = gcnew EventLog; - myLog->Source = "MySource"; - - // Write an informational entry to the event log. - myLog->WriteEntry( "Writing to event log." ); - Console::WriteLine( "Message written to event log." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp deleted file mode 100644 index 8980996197a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Create the source, if it does not already exist. - if ( !EventLog::SourceExists( "MySource" ) ) - { - EventLog::CreateEventSource( "MySource", "myNewLog" ); - Console::WriteLine( "CreatingEventSource" ); - } - - - // Write an informational entry to the event log. - EventLog::WriteEntry( "MySource", "Writing to event log." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp deleted file mode 100644 index 52610a420c6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Create an EventLog instance and assign its source. - EventLog^ myLog = gcnew EventLog("MyNewLog"); - myLog->Source = "MyNewLogSource"; - - // Write an informational entry to the event log. - myLog->WriteEntry( "Writing warning to event log.", EventLogEntryType::Warning ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp deleted file mode 100644 index 126dd6381a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp +++ /dev/null @@ -1,16 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Threading; -int main() -{ - - // Write an informational entry to the event log. - EventLog::WriteEntry( "MySource", "Writing warning to event log.", EventLogEntryType::Warning ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp deleted file mode 100644 index bae18050fe1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -// -int main() -{ - #if defined(TRACE) - - // Create a trace listener for the event log. - EventLogTraceListener^ myTraceListener = - gcnew EventLogTraceListener( "myEventLogSource" ); - - // Add the event log trace listener to the collection. - Trace::Listeners->Add( myTraceListener ); - - // Write output to the event log. - Trace::WriteLine( "Test output" ); - - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp deleted file mode 100644 index e16c6ffd058..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -using namespace System; -using namespace System::Runtime::InteropServices; - -//This namespace is a placeholder for the ECFSRV32Lib - since -// this library may not exist on the build machine we place -// a dummy namespace with dummy classes to keep the compiler -// happy. -namespace ECFSRV32Lib -{ - public ref class BaseComponent{}; - - public interface class IObjectActivator - { - int CreateBaseComponent( int Aggregator ); - }; - - public ref class ObjectActivator: public IObjectActivator - { - public: - virtual int CreateBaseComponent( int Aggregator ) - { - return 0; - } - }; -} - -// -public ref class CallBack -{ -public: - IntPtr Activate( IntPtr Aggregator ) - { - ECFSRV32Lib::ObjectActivator^ oCOM = gcnew ECFSRV32Lib::ObjectActivator; - ECFSRV32Lib::IObjectActivator^ itf = dynamic_cast(oCOM); - return (IntPtr)itf->CreateBaseComponent( (int)Aggregator ); - } -}; - -// -// The EcfInner class. First .NET class derived directly from COM class. -// -public ref class EcfInner: public ECFSRV32Lib::BaseComponent -{ -private: - static CallBack^ callbackInner; - static void RegisterInner() - { - callbackInner = gcnew CallBack; - System::Runtime::InteropServices::ExtensibleClassFactory::RegisterObjectCreationCallback( gcnew System::Runtime::InteropServices::ObjectCreationDelegate( callbackInner, &CallBack::Activate ) ); - } - - //This is the static initializer. - static EcfInner() - { - RegisterInner(); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp deleted file mode 100644 index 2c4a0747c4a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Permissions; - -public ref class Demo -{ -private: - // Make three fields: - // The first field is private. - String^ m_field; - - // The second field is public. -public: - String^ Field; - - // The third field is public and literal. - literal String^ FieldC = "String C"; - - Demo() { m_field = "String A"; Field = "String B"; } -}; - -static void DisplayField(Object^ obj, FieldInfo^ f) -{ - // Display the field name, value, and attributes. - // - Console::WriteLine("{0} = \"{1}\"; attributes: {2}", - f->Name, f->GetValue(obj), f->Attributes); -}; - -void main() -{ - Console::WriteLine ("\nReflection.FieldAttributes"); - Demo^ d = gcnew Demo(); - - // Get a Type object for Demo, and a FieldInfo for each of - // the three fields. Use the FieldInfo to display field - // name, value for the Demo object in d, and attributes. - // - Type^ myType = Demo::typeid; - - FieldInfo^ fiPrivate = myType->GetField("m_field", - BindingFlags::NonPublic | BindingFlags::Instance); - DisplayField(d, fiPrivate); - - FieldInfo^ fiPublic = myType->GetField("Field", - BindingFlags::Public | BindingFlags::Instance); - DisplayField(d, fiPublic); - - FieldInfo^ fiConstant = myType->GetField("FieldC", - BindingFlags::Public | BindingFlags::Static); - DisplayField(d, fiConstant); -} - -/* This code example produces the following output: - -Reflection.FieldAttributes -m_field = "String A"; attributes: Private -Field = "String B"; attributes: Public -FieldC = "String C"; attributes: Public, Static, Literal, HasDefault - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp deleted file mode 100644 index d04993ffecd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class TestClass -{ - // Define a field. - private: - String^ field = "private field" ; - -// public: -// Myfield() -// : field( "private field" ) -// {} -// -// -// property String^ Field -// { -// String^ get() -// { -// return field; -// } -// -// } -}; - -void main() -{ - TestClass^ cl = gcnew TestClass; - - // Get the type and FieldInfo. - Type^ t = cl->GetType(); - FieldInfo^ fi = t->GetField("field", - static_cast(BindingFlags::Instance | BindingFlags::NonPublic)); - - // Get and display the Ftype s ieldType. - Console::WriteLine("Field Name: {0}.{1}", t->FullName, fi->Name ); - Console::WriteLine("Field Value: '{0}'", fi->GetValue(cl)); - Console::WriteLine("Field Type: {0}", fi->FieldType); -} -// The example displays the following output: -// Field Name: TestClass.field -// Field Value: 'private field' -// Field Type: System.String -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp deleted file mode 100644 index 11c0acbac47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Example -{ -public: - int f_public; -internal: - int f_internal; -protected: - int f_protected; -protected public: - int f_protected_public; -protected private: - int f_protected_private; -}; - -void main() -{ - Console::WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly"); - Console::WriteLine("{0,-21}{1,-18}{2,-18}{3}\n", - "", "IsPublic", "IsFamily", "IsFamilyAndAssembly"); - - for each (FieldInfo^ f in Example::typeid->GetFields( - BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::Public)) - { - Console::WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}", - f->Name, - f->IsPublic, - f->IsAssembly, - f->IsFamily, - f->IsFamilyOrAssembly, - f->IsFamilyAndAssembly - ); - } -} - -/* This code example produces output similar to the following: - - IsAssembly IsFamilyOrAssembly - IsPublic IsFamily IsFamilyAndAssembly - -f_public True False False False False -f_internal False True False False False -f_protected False False True False False -f_protected_public False False False True False -f_protected_private False False False False True - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp deleted file mode 100644 index e4ab406d1aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -//Make two fields, one public and one read-only. -public ref class Myfielda -{ -public: - String^ field; - Myfielda() - : field( "A - public field" ) - {} - - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -public ref class Myfieldb -{ -private: - String^ const field; - -public: - Myfieldb() - : field( "B - readonly field" ) - {} - - - property String^ Field - { - String^ get() - { - return field; - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.FieldInfo" ); - Myfielda^ myfielda = gcnew Myfielda; - Myfieldb^ myfieldb = gcnew Myfieldb; - - //Get the Type and FieldInfo. - Type^ MyTypea = Type::GetType( "Myfielda" ); - FieldInfo^ Myfieldinfoa = MyTypea->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) ); - Type^ MyTypeb = Type::GetType( "Myfieldb" ); - FieldInfo^ Myfieldinfob = MyTypeb->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - - //Modify the fields. - //Note that Myfieldb is not modified, as it is - //read-only (IsInitOnly is True). - myfielda->field = "A- modified"; - - //Myfieldb.field = "B- modified"; - //For the first field, get and display the name, field, and IsInitOnly state. - Console::Write( "\n{0} - {1}, IsInitOnly = {2} ", MyTypea->FullName, Myfieldinfoa->GetValue( myfielda ), Myfieldinfoa->IsInitOnly ); - - //For the second field get and display the name, field, and IsInitOnly state. - Console::Write( "\n{0} - {1}, IsInitOnly = {2} ", MyTypeb->FullName, Myfieldinfob->GetValue( myfieldb ), Myfieldinfob->IsInitOnly ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp deleted file mode 100644 index 622ef650283..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Make two fields. -// private -public ref class Myfielda -{ -private: - String^ SomeField; - -public: - Myfielda() - : SomeField( "private field" ) - {} - - - property String^ Field - { - String^ get() - { - return SomeField; - } - - } - -}; - - -// public -public ref class Myfieldb -{ -public: - String^ SomeField; - Myfieldb() - : SomeField( "public field" ) - {} - - - property String^ Field - { - String^ get() - { - return SomeField; - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.FieldInfo" ); - Myfielda^ myfielda = gcnew Myfielda; - Myfieldb^ myfieldb = gcnew Myfieldb; - - // Get the Type and FieldInfo. - Type^ MyTypea = Type::GetType( "Myfielda" ); - FieldInfo^ Myfieldinfoa = MyTypea->GetField( "SomeField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Type^ MyTypeb = Type::GetType( "Myfieldb" ); - FieldInfo^ Myfieldinfob = MyTypeb->GetField( "SomeField" ); - - // Get and display the IsPublic and IsPrivate property values. - Console::Write( "\n{0}.", MyTypea->FullName ); - Console::Write( "{0} - ", Myfieldinfoa->Name ); - Console::Write( "{0}", myfielda->Field ); - Console::Write( "\n IsPublic = {0}", Myfieldinfoa->IsPublic ); - Console::Write( "\n IsPrivate = {0}", Myfieldinfoa->IsPrivate ); - Console::Write( "\n{0}.", MyTypeb->FullName ); - Console::Write( "{0} - ", Myfieldinfob->Name ); - Console::Write( "{0};", myfieldb->Field ); - Console::Write( "\n IsPublic = {0}", Myfieldinfob->IsPublic ); - Console::Write( "\n IsPrivate = {0}", Myfieldinfob->IsPrivate ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp deleted file mode 100644 index cac0b79e4d2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Make two fields. -public ref class Myfielda -{ -private: - String^ field; - -public: - Myfielda() - : field( "A private field" ) - {} - - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -public ref class Myfieldb -{ -private: - static String^ field = "B static field"; - -public: - - property String^ Field - { - String^ get() - { - return field; - } - - void set( String^ value ) - { - if ( field != value ) - { - field = value; - } - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.FieldInfo" ); - Myfielda^ myfielda = gcnew Myfielda; - Myfieldb^ myfieldb = gcnew Myfieldb; - - // Get the Type and FieldInfo. - Type^ MyTypea = Type::GetType( "Myfielda" ); - FieldInfo^ Myfieldinfoa = MyTypea->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Type^ MyTypeb = Type::GetType( "Myfieldb" ); - FieldInfo^ Myfieldinfob = MyTypeb->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Static) ); - - // For the first field, get and display the name, field, and IsStatic property value. - Console::Write( "\n{0} - ", MyTypea->FullName ); - Console::Write( "{0}; ", Myfieldinfoa->GetValue( myfielda ) ); - Console::Write( "IsStatic - {0}", Myfieldinfoa->IsStatic ); - - // For the second field get and display the name, field, and IsStatic property value. - Console::Write( "\n{0} - ", MyTypeb->FullName ); - Console::Write( "{0}; ", Myfieldinfob->GetValue( myfieldb ) ); - Console::Write( "IsStatic - {0}", Myfieldinfob->IsStatic ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp deleted file mode 100644 index 0daa04b49b6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Make a field. -public ref class Myfield -{ -private: - String^ field; - -public: - Myfield() - : field( "a private field" ) - {} - - - property String^ Field - { - String^ get() - { - return field; - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.FieldInfo" ); - Myfield^ myfield = gcnew Myfield; - - // Get the Type and FieldInfo. - Type^ MyType = Type::GetType( "Myfield" ); - FieldInfo^ Myfieldinfo = MyType->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - - // Get and display the MemberType. - Console::Write( "\n{0}.", MyType->FullName ); - Console::Write( "{0} - ", Myfieldinfo->Name ); - Console::Write( "{0};", myfield->Field ); - MemberTypes Mymembertypes = Myfieldinfo->MemberType; - Console::Write( "MemberType is a {0}.", Mymembertypes ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp deleted file mode 100644 index 0189476aa87..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -using namespace System; -using namespace System::Runtime::InteropServices; - -// - -[StructLayout(LayoutKind::Explicit)] -public ref class SYSTEM_INFO -{ -public: - - [FieldOffset(0)] - UInt64 OemId; - - [FieldOffset(8)] - UInt64 PageSize; - - [FieldOffset(24)] - UInt64 ActiveProcessorMask; - - [FieldOffset(32)] - UInt64 NumberOfProcessors; - - [FieldOffset(40)] - UInt64 ProcessorType; -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp deleted file mode 100644 index d0051f61250..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp +++ /dev/null @@ -1,13 +0,0 @@ -using namespace System; -using namespace System::IO; - -public ref class Form1 -{ -protected: - void Method( String^ name ) - { -// -FileStream^ s2 = gcnew FileStream( name, FileMode::Open, FileAccess::Read, FileShare::Read ); -// - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp deleted file mode 100644 index f0687bcf481..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -using namespace System; -using namespace System::Security::Permissions; - -// - [assembly:FileDialogPermissionAttribute(SecurityAction::RequestMinimum,Unrestricted=true)]; - //In C++, you must specify that you are using the assembly scope when making a request. -// - -namespace Snippet2 -{ -// - [FileDialogPermissionAttribute(SecurityAction::Demand,Unrestricted=true)] -// - public ref class SampleClass{}; -} - -namespace Snippet3 -{ -// - //[FileDialogPermissionAttribute(SecurityAction::Assert,Unrestricted=true)] -// - public ref class SampleClass{}; -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp deleted file mode 100644 index d14379899fe..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Security::Permissions; -using namespace System::Windows::Forms; -using namespace System::Security; - -public ref class Form1: public Form -{ -protected: - void Method() - { -// - FileIOPermission^ f = gcnew FileIOPermission( PermissionState::None ); - f->AllLocalFiles = FileIOPermissionAccess::Read; - try - { - f->Demand(); - } - catch (SecurityException^ s) - { - Console::WriteLine(s->Message); - } -// - -// - FileIOPermission^ f2 = gcnew FileIOPermission( FileIOPermissionAccess::Read,"C:\\test_r" ); - f2->AddPathList( (FileIOPermissionAccess) (FileIOPermissionAccess::Write | FileIOPermissionAccess::Read), "C:\\example\\out.txt" ); - try - { - f2->Demand(); - } - catch (SecurityException^ s) - { - Console::WriteLine(s->Message); - } -// - - // - FileIOPermission^ f3 = gcnew FileIOPermission( PermissionState::None ); - f->AllFiles = FileIOPermissionAccess::Read; - try - { - f3->Demand(); - } - catch (SecurityException^ s) - { - Console::WriteLine(s->Message); - } -// - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp deleted file mode 100644 index 6279477dcee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -using namespace System; -using namespace System::Security::Permissions; - -namespace Snippet1 -{ -// -[FileIOPermissionAttribute(SecurityAction::PermitOnly,ViewAndModify="C:\\example\\sample.txt")] -// - public ref class SampleClass{}; -} -namespace Snippet2 -{ -// - [FileIOPermissionAttribute(SecurityAction::Demand,Unrestricted=true)] -// - public ref class SampleClass{}; -} - -namespace Snippet3 -{ -// - //[FileIOPermissionAttribute(SecurityAction::Assert,Unrestricted=true)] -// - public ref class SampleClass{}; -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp deleted file mode 100644 index 73b079909b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main( void ) -{ - FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Read ); - if ( fs->CanRead && fs->CanWrite ) - { - Console::WriteLine( "MyFile.txt can be both written to and read from." ); - } - else - { - Console::WriteLine( "MyFile.txt is not writable" ); - } - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp deleted file mode 100644 index 1c4c9b8a84c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main( void ) -{ - FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Write ); - if ( fs->CanRead && fs->CanWrite ) - { - Console::WriteLine( "MyFile.txt can be both written to and read from." ); - } - else - { - Console::WriteLine( "MyFile.txt is writable." ); - } - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp deleted file mode 100644 index 6d129222b6a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp +++ /dev/null @@ -1,13 +0,0 @@ -using namespace System; -using namespace System::IO; -using namespace System::IO::IsolatedStorage; - -void Method( FileStream^ s ) -{ - // - if ( s->Length == s->Position ) - { - Console::WriteLine( "End of file has been reached." ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp deleted file mode 100644 index 9239a2c8f3e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - - -public ref class Class1 -{ - -public: - static void Main() - { - // Get the file version for the notepad. - // Use either of the two following methods. - FileVersionInfo::GetVersionInfo(Path::Combine(Environment::SystemDirectory, "Notepad.exe")); - FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); - - - // Print the file name and version number. - Console::WriteLine("File: " + myFileVersionInfo->FileDescription + "\n" + - "Version number: " + myFileVersionInfo->FileVersion); - } -}; - -int main() -{ - Class1::Main(); -} -// - - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp deleted file mode 100644 index 2a2d18167f1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetCompanyName() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); - - // Print the company name. - textBox1->Text = "The company name: " + myFileVersionInfo->CompanyName; - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp deleted file mode 100644 index 0766d0bcf94..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetFileBuildPart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); - - // Print the file build number. - textBox1->Text = String::Format( "File build number: {0}", myFileVersionInfo->FileBuildPart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp deleted file mode 100644 index 944efb43eff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Diagnostics; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetFileDescription() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the file description. - textBox1->Text = String::Concat( "File description: ", myFileVersionInfo->FileDescription ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp deleted file mode 100644 index fe1fceca8b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetFileMajorPart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo( "%systemroot%\\Notepad.exe" ); - - // Print the file major part number. - textBox1->Text = String::Concat( "File major part number: ", myFileVersionInfo->FileMajorPart ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp deleted file mode 100644 index 1c1a34b3c9a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetFileMinorPart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the file minor part number. - textBox1->Text = String::Concat( "File minor part number: ", myFileVersionInfo->FileMinorPart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp deleted file mode 100644 index c9afaf47525..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetFileName() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the file name. - textBox1->Text = String::Concat( "File name: ", myFileVersionInfo->FileName ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp deleted file mode 100644 index ff28177ca51..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetFilePrivatePart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the file private part number. - textBox1->Text = String::Concat( "File private part number: ", myFileVersionInfo->FilePrivatePart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp deleted file mode 100644 index d957207f64e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetInternalName() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the internal name. - textBox1->Text = String::Concat( "Internal name: ", myFileVersionInfo->InternalName ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp deleted file mode 100644 index 03806600176..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetIsDebug() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print whether the file contains debugging information. - textBox1->Text = String::Concat( "File contains debugging information: ", - myFileVersionInfo->IsDebug ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp deleted file mode 100644 index 679f5f4c274..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetIsPatched() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print whether the file has a patch installed. - textBox1->Text = String::Concat( "File has patch installed: ", myFileVersionInfo->IsPatched ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp deleted file mode 100644 index fc4df817667..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetIsPreRelease() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print whether the file is a prerelease version. - textBox1->Text = String::Concat( "File is prerelease version ", myFileVersionInfo->IsPreRelease ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp deleted file mode 100644 index 83dd4978d95..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetIsPrivateBuild() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print whether the version is a private build. - textBox1->Text = String::Concat( "Version is a private build: ", myFileVersionInfo->IsPrivateBuild ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp deleted file mode 100644 index 252a113a733..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetIsSpecialBuild() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print whether the file is a special build. - textBox1->Text = String::Concat( "File is a special build: ", myFileVersionInfo->IsSpecialBuild ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp deleted file mode 100644 index c4f8e392537..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetCopyright() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the copyright notice. - textBox1->Text = String::Concat( "Copyright notice: ", myFileVersionInfo->LegalCopyright ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp deleted file mode 100644 index 0ed892c3443..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetTrademarks() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the trademarks. - textBox1->Text = String::Concat( "Trademarks: ", myFileVersionInfo->LegalTrademarks ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp deleted file mode 100644 index 06de83f723a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetOriginalName() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the original file name. - textBox1->Text = String::Concat( "Original file name: ", myFileVersionInfo->OriginalFilename ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp deleted file mode 100644 index 9087c661b55..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetPrivateBuild() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the private build number. - textBox1->Text = String::Concat( "Private build number: ", myFileVersionInfo->PrivateBuild ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp deleted file mode 100644 index 81913117b81..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetProductBuildPart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the product build part number. - textBox1->Text = String::Concat( "Product build part number: ", myFileVersionInfo->ProductBuildPart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp deleted file mode 100644 index c08b8bbc59b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetProductMajorPart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the product major part number. - textBox1->Text = String::Concat( "Product major part number: ", myFileVersionInfo->ProductMajorPart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp deleted file mode 100644 index a419d991f9a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetProductMinorPart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the product minor part number. - textBox1->Text = String::Concat( "Product minor part number: ", myFileVersionInfo->ProductMinorPart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp deleted file mode 100644 index 4b5b6d28591..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetProductName() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the product name. - textBox1->Text = String::Concat( "Product name: ", myFileVersionInfo->ProductName ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp deleted file mode 100644 index 9ef151fdcab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetProductPrivatePart() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the product private part number. - textBox1->Text = String::Concat( "Product private part number: ", myFileVersionInfo->ProductPrivatePart ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp deleted file mode 100644 index 37638630d5a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetProductVersion() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the product version number. - textBox1->Text = String::Concat( "Product version number: ", myFileVersionInfo->ProductVersion ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp deleted file mode 100644 index a3f209f9682..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetSpecialBuild() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print the special build information. - textBox1->Text = String::Concat( "Special build information: ", myFileVersionInfo->SpecialBuild ); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp deleted file mode 100644 index fbecc3c9e0c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1 : public Form -{ -protected: - TextBox^ textBox1; - -// -private: - void GetFileVersion2() - { - // Get the file version for the notepad. - FileVersionInfo^ myFileVersionInfo = - FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); - - // Print all the version information. - textBox1->Text = myFileVersionInfo->ToString(); - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp deleted file mode 100644 index 3f96bf804aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - - -[GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")] -public ref class SampleClass -{ - // Insert class members here. -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp deleted file mode 100644 index 3acaccabe57..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Policy; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Assembly^ myAssembly; - - void Method() - { - // - Hash^ hash = gcnew Hash( myAssembly ); - array^ hashcode = hash->SHA1; - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp deleted file mode 100644 index 69ae75d0f48..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Policy; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - array^dataArray; - - void Method() - { - // - HashAlgorithm^ sha = SHA256::Create(); - array^ result = sha->ComputeHash( dataArray ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp deleted file mode 100644 index 473f4a7a126..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -public class HashtableExample -{ -public: - static void Main() - { - // Creates and initializes a new Hashtable. - Hashtable^ clouds = gcnew Hashtable(); - clouds->Add("Cirrus", "Castellanus"); - clouds->Add("Cirrocumulus", "Stratiformis"); - clouds->Add("Altostratus", "Radiatus"); - clouds->Add("Stratocumulus", "Perlucidus"); - clouds->Add("Stratus", "Fractus"); - clouds->Add("Nimbostratus", "Pannus"); - clouds->Add("Cumulus", "Humilis"); - clouds->Add("Cumulonimbus", "Incus"); - - // Displays the keys and values of the Hashtable using GetEnumerator() - - IDictionaryEnumerator^ denum = clouds->GetEnumerator(); - DictionaryEntry dentry; - - Console::WriteLine(); - Console::WriteLine(" Cloud Type Variation"); - Console::WriteLine(" -----------------------------"); - while (denum->MoveNext()) - { - dentry = (DictionaryEntry) denum->Current; - Console::WriteLine(" {0,-17}{1}", dentry.Key, dentry.Value); - } - Console::WriteLine(); - - // Displays the keys and values of the Hashtable using foreach statement - - Console::WriteLine(" Cloud Type Variation"); - Console::WriteLine(" -----------------------------"); - for each (DictionaryEntry de in clouds) - { - Console::WriteLine(" {0,-17}{1}", de.Key, de.Value); - } - Console::WriteLine(); - } -}; - -int main() -{ - HashtableExample::Main(); -} - -// The program displays the following output to the console: -// -// Cloud Type Variation -// ----------------------------- -// Cirrocumulus Stratiformis -// Stratocumulus Perlucidus -// Cirrus Castellanus -// Cumulus Humilis -// Nimbostratus Pannus -// Stratus Fractus -// Altostratus Radiatus -// Cumulonimbus Incus -// -// Cloud Type Variation -// ----------------------------- -// Cirrocumulus Stratiformis -// Stratocumulus Perlucidus -// Cirrus Castellanus -// Cumulus Humilis -// Nimbostratus Pannus -// Stratus Fractus -// Altostratus Radiatus -// Cumulonimbus Incus*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp deleted file mode 100644 index 21cce15687b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintKeysAndValues( Hashtable^ myHT ); -int main() -{ - - // Creates and initializes a new Hashtable. - Hashtable^ myHT = gcnew Hashtable; - myHT->Add( "one", "The" ); - myHT->Add( "two", "quick" ); - myHT->Add( "three", "brown" ); - myHT->Add( "four", "fox" ); - - // Displays the Hashtable. - Console::WriteLine( "The Hashtable contains the following:" ); - PrintKeysAndValues( myHT ); -} - -void PrintKeysAndValues( Hashtable^ myHT ) -{ - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - IEnumerator^ myEnum = myHT->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = *safe_cast(myEnum->Current); - Console::WriteLine( "\t{0}:\t{1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The Hashtable contains the following: - -KEY- -VALUE- - two: quick - three: brown - four: fox - one: The - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp deleted file mode 100644 index 87875e40e37..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintKeysAndValues( Hashtable^ myHT ); -int main() -{ - - // Creates and initializes a new Hashtable. - Hashtable^ myHT = gcnew Hashtable; - myHT->Add( "one", "The" ); - myHT->Add( "two", "quick" ); - myHT->Add( "three", "brown" ); - myHT->Add( "four", "fox" ); - myHT->Add( "five", "jumps" ); - - // Displays the count and values of the Hashtable. - Console::WriteLine( "Initially," ); - Console::WriteLine( " Count : {0}", myHT->Count ); - Console::WriteLine( " Values:" ); - PrintKeysAndValues( myHT ); - - // Clears the Hashtable. - myHT->Clear(); - - // Displays the count and values of the Hashtable. - Console::WriteLine( "After Clear," ); - Console::WriteLine( " Count : {0}", myHT->Count ); - Console::WriteLine( " Values:" ); - PrintKeysAndValues( myHT ); -} - -void PrintKeysAndValues( Hashtable^ myHT ) -{ - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - IEnumerator^ myEnum = myHT->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = *safe_cast(myEnum->Current); - Console::WriteLine( "\t{0}:\t{1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initially, - Count : 5 - Values: - -KEY- -VALUE- - two: quick - three: brown - four: fox - five: jumps - one: The - - After Clear, - Count : 0 - Values: - -KEY- -VALUE- - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp deleted file mode 100644 index b6d25cecb55..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndKeysAndValues( Hashtable^ myHT ); -int main() -{ - - // Creates and initializes a new Hashtable. - Hashtable^ myHT = gcnew Hashtable; - myHT->Add( (int^)0, "zero" ); - myHT->Add( 1, "one" ); - myHT->Add( 2, "two" ); - myHT->Add( 3, "three" ); - myHT->Add( 4, "four" ); - - // Displays the values of the Hashtable. - Console::WriteLine( "The Hashtable contains the following values:" ); - PrintIndexAndKeysAndValues( myHT ); - - // Searches for a specific key. - int myKey = 2; - Console::WriteLine( "The key \"{0}\" is {1}.", myKey, myHT->ContainsKey( myKey ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); - myKey = 6; - Console::WriteLine( "The key \"{0}\" is {1}.", myKey, myHT->ContainsKey( myKey ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); - - // Searches for a specific value. - String^ myValue = "three"; - Console::WriteLine( "The value \"{0}\" is {1}.", myValue, myHT->ContainsValue( myValue ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); - myValue = "nine"; - Console::WriteLine( "The value \"{0}\" is {1}.", myValue, myHT->ContainsValue( myValue ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); -} - -void PrintIndexAndKeysAndValues( Hashtable^ myHT ) -{ - int i = 0; - Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); - IEnumerator^ myEnum = myHT->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = *safe_cast(myEnum->Current); - Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i++, de.Key, de.Value ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The Hashtable contains the following values: - -INDEX- -KEY- -VALUE- - [0]: 4 four - [1]: 3 three - [2]: 2 two - [3]: 1 one - [4]: 0 zero - - The key "2" is in the Hashtable. - The key "6" is NOT in the Hashtable. - The value "three" is in the Hashtable. - The value "nine" is NOT in the Hashtable. - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp deleted file mode 100644 index 70190cc955d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( array^myArr, char mySeparator ); -int main() -{ - - // Creates and initializes the source Hashtable. - Hashtable^ mySourceHT = gcnew Hashtable; - mySourceHT->Add( "A", "valueA" ); - mySourceHT->Add( "B", "valueB" ); - - // Creates and initializes the one-dimensional target Array. - array^myTargetArray = gcnew array(15); - myTargetArray[ 0 ] = "The"; - myTargetArray[ 1 ] = "quick"; - myTargetArray[ 2 ] = "brown"; - myTargetArray[ 3 ] = "fox"; - myTargetArray[ 4 ] = "jumps"; - myTargetArray[ 5 ] = "over"; - myTargetArray[ 6 ] = "the"; - myTargetArray[ 7 ] = "lazy"; - myTargetArray[ 8 ] = "dog"; - - // Displays the values of the target Array. - Console::WriteLine( "The target Array contains the following before:" ); - PrintValues( myTargetArray, ' ' ); - - // Copies the keys in the source Hashtable to the target Hashtable, starting at index 6. - Console::WriteLine( "After copying the keys, starting at index 6:" ); - mySourceHT->Keys->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the values in the source Hashtable to the target Hashtable, starting at index 6. - Console::WriteLine( "After copying the values, starting at index 6:" ); - mySourceHT->Values->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); -} - -void PrintValues( array^myArr, char mySeparator ) -{ - for ( int i = 0; i < myArr->Length; i++ ) - Console::Write( "{0}{1}", mySeparator, myArr[ i ] ); - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Array contains the following before: - The quick brown fox jumps over the lazy dog - After copying the keys, starting at index 6: - The quick brown fox jumps over B A dog - After copying the values, starting at index 6: - The quick brown fox jumps over valueB valueA dog - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp deleted file mode 100644 index 5e205ba0c28..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class SamplesHashtable -{ -public: - static void Main() - { - // - Hashtable^ myCollection = gcnew Hashtable(); - bool lockTaken = false; - - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -void main() -{ - SamplesHashtable::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp deleted file mode 100644 index 4696c2337e9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void main() -{ - - // Creates and initializes a new Hashtable. - Hashtable^ myHT = gcnew Hashtable; - myHT->Add( (int^)0, "zero" ); - myHT->Add( 1, "one" ); - myHT->Add( 2, "two" ); - myHT->Add( 3, "three" ); - myHT->Add( 4, "four" ); - - // Creates a synchronized wrapper around the Hashtable. - Hashtable^ mySyncdHT = Hashtable::Synchronized( myHT ); - - // Displays the sychronization status of both Hashtables. - Console::WriteLine( "myHT is {0}.", myHT->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); - Console::WriteLine( "mySyncdHT is {0}.", mySyncdHT->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); -} - -/* - This code produces the following output. - - myHT is not synchronized. - mySyncdHT is synchronized. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp deleted file mode 100644 index 23ce290b57a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintKeysAndValues( Hashtable^ myHT ); -int main() -{ - - // Creates and initializes a new Hashtable. - Hashtable^ myHT = gcnew Hashtable; - myHT->Add( "1a", "The" ); - myHT->Add( "1b", "quick" ); - myHT->Add( "1c", "brown" ); - myHT->Add( "2a", "fox" ); - myHT->Add( "2b", "jumps" ); - myHT->Add( "2c", "over" ); - myHT->Add( "3a", "the" ); - myHT->Add( "3b", "lazy" ); - myHT->Add( "3c", "dog" ); - - // Displays the Hashtable. - Console::WriteLine( "The Hashtable initially contains the following:" ); - PrintKeysAndValues( myHT ); - - // Removes the element with the key "3b". - myHT->Remove( "3b" ); - - // Displays the current state of the Hashtable. - Console::WriteLine( "After removing \"lazy\":" ); - PrintKeysAndValues( myHT ); -} - -void PrintKeysAndValues( Hashtable^ myHT ) -{ - IEnumerator^ myEnum = myHT->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = *safe_cast(myEnum->Current); - Console::WriteLine( " {0}: {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The Hashtable initially contains the following: - 2c: over - 3a: the - 2b: jumps - 3b: lazy - 1b: quick - 3c: dog - 2a: fox - 1c: brown - 1a: The - - After removing "lazy": - 2c: over - 3a: the - 2b: jumps - 1b: quick - 3c: dog - 2a: fox - 1c: brown - 1a: The - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp deleted file mode 100644 index adbeb6fbeac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Reflection; - -#define NULL 0 -void main() -{ - Type^ tDate = Type::GetType( L"System.DateTime" ); - Object^ result = tDate->InvokeMember( L"Now", BindingFlags::GetProperty, nullptr, NULL, gcnew array(0) ); - Console::WriteLine( result->ToString() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp deleted file mode 100644 index 262e0c5bca9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,14 +0,0 @@ - -// -using namespace System::Runtime::InteropServices; - -//Interface is exposed to COM as dual. -interface class IMyInterface1{}; - -//Insert code here. -//Interface is exposed to COM as IDispatch. - -[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIDispatch)] -interface class IMyInterface2{}; -//Insert code here. -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp deleted file mode 100644 index 9458c1d30b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -using namespace System; -using namespace System::Runtime::Remoting::Lifetime; - -// -public ref class MyClass: public MarshalByRefObject -{ -public: - - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::Demand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual Object^ InitializeLifetimeService() override - { - ILease^ lease = dynamic_cast(MarshalByRefObject::InitializeLifetimeService()); - if ( lease->CurrentState == LeaseState::Initial ) - { - lease->InitialLeaseTime = TimeSpan::FromMinutes( 1 ); - lease->SponsorshipTimeout = TimeSpan::FromMinutes( 2 ); - lease->RenewOnCallTime = TimeSpan::FromSeconds( 2 ); - } - - return lease; - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp deleted file mode 100644 index 13ab6a90a87..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::WriteLine("Classic Math.Round in CPP"); - Console::WriteLine(Math::Round(4.4)); // 4 - Console::WriteLine(Math::Round(4.5)); // 4 - Console::WriteLine(Math::Round(4.6)); // 5 - Console::WriteLine(Math::Round(5.5)); // 6 -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp deleted file mode 100644 index e9c1085e6f1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using - -using namespace System; - -ref class Sample -{ -private: - void Method() - { - // - Math::Round(3.44, 1); //Returns 3.4. - Math::Round(3.45, 1); //Returns 3.4. - Math::Round(3.46, 1); //Returns 3.5. - - Math::Round(4.34, 1); // Returns 4.3 - Math::Round(4.35, 1); // Returns 4.4 - Math::Round(4.36, 1); // Returns 4.4 - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp deleted file mode 100644 index fca76263e2b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Console::WriteLine( "\nReflection.MemberInfo" ); - - // Get the Type and MemberInfo. - Type^ MyType = Type::GetType( "System.Reflection.PropertyInfo" ); - array^Mymemberinfoarray = MyType->GetMembers(); - - // Get the MemberType method and display the elements. - Console::Write( "\nThere are {0} members in ", Mymemberinfoarray->GetLength( 0 ) ); - Console::Write( "{0}.", MyType->FullName ); - for ( int counter = 0; counter < Mymemberinfoarray->Length; counter++ ) - { - Console::Write( "\n{0}. {1} Member type - {2}", counter, Mymemberinfoarray[ counter ]->Name, Mymemberinfoarray[ counter ]->MemberType ); - - } - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp deleted file mode 100644 index f4a7d06c3ce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Get the Type and MemberInfo. - Type^ t = Type::GetType("System.Empty"); - array^ memberArray = t->GetMembers(); - - // Get and display the type that declares the member. - Console::WriteLine("There are {0} members in {1}", - memberArray->Length, t->FullName); - for each (MemberInfo^ member in memberArray) { - Console::WriteLine("Member {0} declared by {1}", - member->Name, member->DeclaringType); - } -} -// The example displays the following output: -// There are 6 members in System.Empty -// Member ToString declared by System.Empty -// Member GetObjectData declared by System.Empty -// Member Equals declared by System.Object -// Member GetHashCode declared by System.Object -// Member GetType declared by System.Object -// Member Value declared by System.Empty -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp deleted file mode 100644 index 04e9498bfd7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -int main() -{ - MemberInfo^ m1 = Object::typeid->GetMethod("ToString"); - MemberInfo^ m2 = MemberInfo::typeid->GetMethod("ToString"); - - Console::WriteLine("m1.DeclaringType: {0}", m1->DeclaringType); - Console::WriteLine("m1.ReflectedType: {0}", m1->ReflectedType); - Console::WriteLine(); - Console::WriteLine("m2.DeclaringType: {0}", m2->DeclaringType); - Console::WriteLine("m2.ReflectedType: {0}", m2->ReflectedType); - - //Console::ReadLine(); -} - -/* This code example produces the following output: - -m1.DeclaringType: System.Object -m1.ReflectedType: System.Object - -m2.DeclaringType: System.Object -m2.ReflectedType: System.Reflection.MemberInfo - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp deleted file mode 100644 index d9f1db69a7b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -public ref class AttributesSample -{ -public: - void Mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) - { - *str2m = "in Mymethod"; - } -}; - -void PrintAttributes( Type^ attribType, int iAttribValue ) -{ - if ( !attribType->IsEnum ) - { - Console::WriteLine( "This type is not an enum." ); - return; - } - - array^fields = attribType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); - for ( int i = 0; i < fields->Length; i++ ) - { - int fieldvalue = safe_cast(fields[ i ]->GetValue( nullptr )); - if ( (fieldvalue & iAttribValue) == fieldvalue ) - { - Console::WriteLine( fields[ i ]->Name ); - } - } -} - -int main() -{ - Console::WriteLine( "Reflection.MethodBase.Attributes Sample" ); - - // Get the type of the chosen class. - Type^ MyType = Type::GetType( "AttributesSample" ); - - // Get the method Mymethod on the type. - MethodBase^ Mymethodbase = MyType->GetMethod( "Mymethod" ); - - // Display the method name and signature. - Console::WriteLine( "Mymethodbase = {0}", Mymethodbase ); - - // Get the MethodAttribute enumerated value. - MethodAttributes Myattributes = Mymethodbase->Attributes; - - // Display the flags that are set. - PrintAttributes( System::Reflection::MethodAttributes::typeid, (int)Myattributes ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp deleted file mode 100644 index b803afb891b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; -public ref class AttributesSample -{ -public: - void Mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) - { - *str2m = "in Mymethod"; - } -}; - -void PrintAttributes( Type^ attribType, int iAttribValue ) -{ - if ( !attribType->IsEnum ) - { - Console::WriteLine( "This type is not an enum." ); - return; - } - - array^fields = attribType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); - for ( int i = 0; i < fields->Length; i++ ) - { - int fieldvalue = safe_cast(fields[ i ]->GetValue( nullptr )); - if ( (fieldvalue & iAttribValue) == fieldvalue ) - { - Console::WriteLine( fields[ i ]->Name ); - } - } -} - -int main() -{ - Console::WriteLine( "Reflection.MethodBase.Attributes Sample" ); - - // Get the type. - Type^ MyType = Type::GetType( "AttributesSample" ); - - // Get the method Mymethod on the type. - MethodBase^ Mymethodbase = MyType->GetMethod( "Mymethod" ); - - // Display the method name. - Console::WriteLine( "Mymethodbase = {0}", Mymethodbase ); - - // Get the MethodAttribute enumerated value. - MethodAttributes Myattributes = Mymethodbase->Attributes; - - // Display the flags that are set. - PrintAttributes( System::Reflection::MethodAttributes::typeid, (int)Myattributes ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp deleted file mode 100644 index 945399096dc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class MagicClass -{ -private: - int magicBaseValue; - -public: - MagicClass() - { - magicBaseValue = 9; - } - - int ItsMagic(int preMagic) - { - return preMagic * magicBaseValue; - } -}; - -public ref class TestMethodInfo -{ -public: - static void Main() - { - // Get the constructor and create an instance of MagicClass - - Type^ magicType = Type::GetType("MagicClass"); - ConstructorInfo^ magicConstructor = magicType->GetConstructor(Type::EmptyTypes); - Object^ magicClassObject = magicConstructor->Invoke(gcnew array(0)); - - // Get the ItsMagic method and invoke with a parameter value of 100 - - MethodInfo^ magicMethod = magicType->GetMethod("ItsMagic"); - Object^ magicValue = magicMethod->Invoke(magicClassObject, gcnew array(1){100}); - - Console::WriteLine("MethodInfo.Invoke() Example\n"); - Console::WriteLine("MagicClass.ItsMagic() returned: {0}", magicValue); - } -}; - -int main() -{ - TestMethodInfo::Main(); -} - -// The example program gives the following output: -// -// MethodInfo.Invoke() Example -// -// MagicClass.ItsMagic() returned: 900 -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp deleted file mode 100644 index a8d47e52181..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Console::WriteLine( "\nReflection.MethodBase" ); - - // Get the types. - Type^ MyType1 = Type::GetType( "System.Runtime.Serialization.Formatter" ); - Type^ MyType2 = Type::GetType( "System.Reflection.MethodBase" ); - - // Get and display the methods. - MethodBase^ Mymethodbase1 = MyType1->GetMethod( "WriteInt32", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - MethodBase^ Mymethodbase2 = MyType2->GetMethod( "GetCurrentMethod", static_cast(BindingFlags::Public | BindingFlags::Static) ); - Console::Write( "\nMymethodbase = {0}", Mymethodbase1 ); - if ( Mymethodbase1->IsAbstract ) - Console::Write( "\nMymethodbase is an abstract method." ); - else - Console::Write( "\nMymethodbase is not an abstract method." ); - - Console::Write( "\n\nMymethodbase = {0}", Mymethodbase2 ); - if ( Mymethodbase2->IsAbstract ) - Console::Write( "\nMymethodbase is an abstract method." ); - else - Console::Write( "\nMymethodbase is not an abstract method." ); - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp deleted file mode 100644 index 72f077ad3a4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Example -{ -public: - void m_public() {}; -internal: - void m_internal() {}; -protected: - void m_protected() {}; -protected public: - void m_protected_public() {}; -protected private: - void m_protected_private() {}; -}; - -void main() -{ - Console::WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly"); - Console::WriteLine("{0,-21}{1,-18}{2,-18}{3}\n", - "", "IsPublic", "IsFamily", "IsFamilyAndAssembly"); - - for each (MethodBase^ m in Example::typeid->GetMethods( - BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::Public)) - { - if (m->Name->Substring(0, 1) == "m") - { - Console::WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}", - m->Name, - m->IsPublic, - m->IsAssembly, - m->IsFamily, - m->IsFamilyOrAssembly, - m->IsFamilyAndAssembly - ); - } - } -} - -/* This code example produces output similar to the following: - - IsAssembly IsFamilyOrAssembly - IsPublic IsFamily IsFamilyAndAssembly - -m_public True False False False False -m_internal False True False False False -m_protected False False True False False -m_protected_public False False False True False -m_protected_private False False False False True - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp deleted file mode 100644 index a7ea8cf252b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Windows::Forms; - -// -int main() -{ - Console::WriteLine( "\nReflection.MethodBase" ); - - //Get the MethodBase of a method. - //Get the type - Type^ MyType = Type::GetType( "System.MulticastDelegate" ); - - //Get and display the method - MethodBase^ Mymethodbase = MyType->GetMethod( "RemoveImpl", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); - Console::Write( "\nMymethodbase = {0}", Mymethodbase ); - bool Myispublic = Mymethodbase->IsPublic; - if ( Myispublic ) - Console::Write( "\nMymethodbase is a public method" ); - else - Console::Write( "\nMymethodbase is not a public method" ); - - return 0; -} - -/* -Produces the following output - -Reflection.MethodBase -Mymethodbase = System.Delegate RemoveImpl (System.Delegate) -Mymethodbase is not a public method -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp deleted file mode 100644 index f96f32346d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyClass -{ -public: - void MyMethod(){} -}; - -int main() -{ - MethodBase^ m = MyClass::typeid->GetMethod( "MyMethod" ); - Console::WriteLine( "The IsFinal property value of MyMethod is {0}.", m->IsFinal ); - Console::WriteLine( "The IsVirtual property value of MyMethod is {0}.", m->IsVirtual ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp deleted file mode 100644 index b878d322184..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Console::WriteLine( "Reflection.MethodInfo" ); - - // Get the Type and MethodInfo. - Type^ MyType = Type::GetType( "System.Reflection.FieldInfo" ); - MethodInfo^ Mymethodinfo = MyType->GetMethod( "GetValue" ); - Console::WriteLine( "{0}.{1}", MyType->FullName, Mymethodinfo->Name ); - - // Get and display the MemberType property. - MemberTypes Mymembertypes = Mymethodinfo->MemberType; - if ( MemberTypes::Constructor == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type All." ); - } - else - if ( MemberTypes::Custom == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type Custom." ); - } - else - if ( MemberTypes::Event == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type Event." ); - } - else - if ( MemberTypes::Field == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type Field." ); - } - else - if ( MemberTypes::Method == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type Method." ); - } - else - if ( MemberTypes::Property == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type Property." ); - } - else - if ( MemberTypes::TypeInfo == Mymembertypes ) - { - Console::WriteLine( "MemberType is of type TypeInfo." ); - } - - - - - - - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp deleted file mode 100644 index 9e122d5e99d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Console::WriteLine( "\nReflection.MethodInfo" ); - - // Get the Type and MethodInfo. - Type^ MyType = Type::GetType( "System.Reflection.FieldInfo" ); - MethodInfo^ Mymethodinfo = MyType->GetMethod( "GetValue" ); - Console::Write( "\n{0}.{1}", MyType->FullName, Mymethodinfo->Name ); - - // Get and display the ReturnType. - Console::Write( "\nReturnType = {0}", Mymethodinfo->ReturnType ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp deleted file mode 100644 index 744eed074a9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; - -// First make a method that returns 0. -// Then swap the method body with a body that returns 1. -int main() -{ - // Construct a dynamic assembly - Guid g = Guid::NewGuid(); - AssemblyName^ asmname = gcnew AssemblyName; - asmname->Name = String::Concat( "tempfile", g ); - AssemblyBuilder^ asmbuild = System::Threading::Thread::GetDomain()->DefineDynamicAssembly( asmname, AssemblyBuilderAccess::Run ); - - // Add a dynamic module that contains one type that has one method that - // has no arguments. - ModuleBuilder^ modbuild = asmbuild->DefineDynamicModule( "test" ); - TypeBuilder^ tb = modbuild->DefineType( "name of the Type" ); - array^temp2; - MethodBuilder^ somemethod = tb->DefineMethod( "My method Name", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, temp2 ); - - // Define the body of the method to return 0. - ILGenerator^ ilg = somemethod->GetILGenerator(); - ilg->Emit( OpCodes::Ldc_I4_0 ); - ilg->Emit( OpCodes::Ret ); - - // Complete the type and verify that it returns 0. - Type^ tbBaked = tb->CreateType(); - array^temp0; - int res1 = safe_cast(tbBaked->GetMethod( "My method Name" )->Invoke( nullptr, temp0 )); - if ( res1 != 0 ) - { - Console::WriteLine( "Err_001a, should have returned 0" ); - } - else - { - Console::WriteLine( "Original method returned 0" ); - } - - // Define a new method body that will return a 1 instead. - - // code size - // ldc_i4_1 - // ret - array^methodBytes = {0x03,0x30,0x0A,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x2a}; - - // Get the token for the method whose body you are replacing. - MethodToken somemethodToken = somemethod->GetToken(); - - // Get the pointer to the method body. - GCHandle hmem = GCHandle::Alloc( (Object^)methodBytes, GCHandleType::Pinned ); - IntPtr addr = hmem.AddrOfPinnedObject(); - int cbSize = methodBytes->Length; - - // Swap the old method body with the new body. - MethodRental::SwapMethodBody( tbBaked, somemethodToken.Token, addr, cbSize, MethodRental::JitImmediate ); - - // Verify that the modified method returns 1. - array^temp1; - int res2 = safe_cast(tbBaked->GetMethod( "My method Name" )->Invoke( nullptr, temp1 )); - if ( res2 != 1 ) - { - Console::WriteLine( "Err_001b, should have returned 1" ); - } - else - { - Console::WriteLine( "Swapped method body returned 1" ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp deleted file mode 100644 index d2aa22fa155..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ]; - Console::WriteLine( "Module Name is {0}", mod->Name ); - Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName ); - Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName ); -} - -/* -This code produces the following output: - -Module Name is modname.exe -Module FullyQualifiedName is C:\Bin\modname.exe -Module ScopeName is modname.exe -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp deleted file mode 100644 index 591da3b46bd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ]; - Console::WriteLine( "Module Name is {0}", mod->Name ); - Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName ); - Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName ); -} - -/* -Produces this output: -Module Name is modname.exe -Module FullyQualifiedName is C:\Bin\modname.exe -Module ScopeName is modname.exe -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp deleted file mode 100644 index 009ddd456c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class Sample -{ -public: - void Method() - { - // - AssemblyName^ asmname = gcnew AssemblyName; - asmname->Name = "assemfilename.exe"; - AssemblyBuilder^ asmbuild = System::Threading::Thread::GetDomain()-> - DefineDynamicAssembly( asmname, AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ modbuild = asmbuild->DefineDynamicModule( "modulename", - "assemfilename.exe" ); - TypeBuilder^ typebuild1 = modbuild->DefineType( "typename" ); - typebuild1->CreateType(); - asmbuild->Save( "assemfilename.exe" ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp deleted file mode 100644 index c9eb24638ad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -#include "pch.h" - -using namespace System; -using namespace System::IO; - -class MyClassCPP -{ -public: - - int static Run() - { - FileSystemWatcher^ watcher = gcnew FileSystemWatcher("C:\\path\\to\\folder"); - - watcher->NotifyFilter = static_cast(NotifyFilters::Attributes - | NotifyFilters::CreationTime - | NotifyFilters::DirectoryName - | NotifyFilters::FileName - | NotifyFilters::LastAccess - | NotifyFilters::LastWrite - | NotifyFilters::Security - | NotifyFilters::Size); - - watcher->Changed += gcnew FileSystemEventHandler(MyClassCPP::OnChanged); - watcher->Created += gcnew FileSystemEventHandler(MyClassCPP::OnCreated); - watcher->Deleted += gcnew FileSystemEventHandler(MyClassCPP::OnDeleted); - watcher->Renamed += gcnew RenamedEventHandler(MyClassCPP::OnRenamed); - watcher->Error += gcnew ErrorEventHandler(MyClassCPP::OnError); - - watcher->Filter = "*.txt"; - watcher->IncludeSubdirectories = true; - watcher->EnableRaisingEvents = true; - - Console::WriteLine("Press enter to exit."); - Console::ReadLine(); - - return 0; - } - -private: - - static void OnChanged(Object^ sender, FileSystemEventArgs^ e) - { - if (e->ChangeType != WatcherChangeTypes::Changed) - { - return; - } - Console::WriteLine("Changed: {0}", e->FullPath); - } - - static void OnCreated(Object^ sender, FileSystemEventArgs^ e) - { - Console::WriteLine("Created: {0}", e->FullPath); - } - - static void OnDeleted(Object^ sender, FileSystemEventArgs^ e) - { - Console::WriteLine("Deleted: {0}", e->FullPath); - } - - static void OnRenamed(Object^ sender, RenamedEventArgs^ e) - { - Console::WriteLine("Renamed:"); - Console::WriteLine(" Old: {0}", e->OldFullPath); - Console::WriteLine(" New: {0}", e->FullPath); - } - - static void OnError(Object^ sender, ErrorEventArgs^ e) - { - PrintException(e->GetException()); - } - - static void PrintException(Exception^ ex) - { - if (ex != nullptr) - { - Console::WriteLine("Message: {0}", ex->Message); - Console::WriteLine("Stacktrace:"); - Console::WriteLine(ex->StackTrace); - Console::WriteLine(); - PrintException(ex->InnerException); - } - } -}; - - -int main() -{ - MyClassCPP::Run(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp deleted file mode 100644 index 0c7dbce3903..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -String^ PrintArraySet( array^myArr ) -{ - String^ myStr = nullptr; - myStr = myArr[ 0 ].ToString(); - for ( int i = 1; i < myArr->Length; i++ ) - myStr = String::Concat( myStr, ", ", myArr[ i ].ToString() ); - return myStr; -} - -int main() -{ - - // Creates a new NumberFormatinfo. - NumberFormatInfo^ myNfi = gcnew NumberFormatInfo; - - // Takes a long value. - Int64 myInt = 123456789012345; - - // Displays the value with default formatting. - Console::WriteLine( "Default \t\t:\t{0}", myInt.ToString( "N", myNfi ) ); - - // Displays the value with three elements in the GroupSize array. - array^newInts1 = {2,3,4}; - myNfi->NumberGroupSizes = newInts1; - Console::WriteLine( "Grouping ( {0} )\t:\t{1}", PrintArraySet( myNfi->NumberGroupSizes ), myInt.ToString( "N", myNfi ) ); - - // Displays the value with zero as the last element in the GroupSize array. - array^newInts2 = {2,4,0}; - myNfi->NumberGroupSizes = newInts2; - Console::WriteLine( "Grouping ( {0} )\t:\t{1}", PrintArraySet( myNfi->NumberGroupSizes ), myInt.ToString( "N", myNfi ) ); -} - -/* -This code produces the following output. - -Default : 123, 456, 789, 012, 345.00 -Grouping (2, 3, 4) : 12, 3456, 7890, 123, 45.00 -Grouping (2, 4, 0) : 123456789, 0123, 45.00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp deleted file mode 100644 index 25d277574d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create a new NumberFormatinfo. - NumberFormatInfo^ nfi = gcnew NumberFormatInfo; - - // Takes a negative value. - Int64 value = -1234; - - // Displays the value with default formatting. - Console::WriteLine("{0,-20} {1,-10}", "Default:", - value.ToString("N", nfi)); - - // Displays the value with other patterns. - for (int i = 0; i <= 4; i++) { - nfi->NumberNegativePattern = i; - Console::WriteLine("{0,-20} {1,-10}", - String::Format("Pattern {0}:", - nfi->NumberNegativePattern), - value.ToString("N", nfi)); - } -} -// The example displays the following output: -// Default: -1,234.00 -// Pattern 0: (1,234.00) -// Pattern 1: -1,234.00 -// Pattern 2: - 1,234.00 -// Pattern 3: 1,234.00- -// Pattern 4: 1,234.00 - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp deleted file mode 100644 index cefa875d170..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; -public ref class paramatt -{ -public: - static void mymethod( String^ str1, [Out]interior_ptr str2, interior_ptr str3 ) - { - *str2 = "string"; - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.ParameterAttributes" ); - - // Get the Type and the method. - Type^ Mytype = Type::GetType( "paramatt" ); - MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); - - // Display the method. - Console::Write( "\nMymethodbase = {0}", Mymethodbase ); - - // Get the ParameterInfo array. - array^Myarray = Mymethodbase->GetParameters(); - - // Get and display the attributes for the second parameter. - ParameterAttributes Myparamattributes = Myarray[ 1 ]->Attributes; - Console::Write( "\nFor the second parameter:\nMyparamattributes = {0}, which is an {1}", (int)Myparamattributes, Myparamattributes ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp deleted file mode 100644 index 9d1bd81902a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; -public ref class parminfo -{ -public: - static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) - { - *str2m = "in mymethod"; - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.Parameterinfo" ); - - //Get the ParameterInfo parameter of a function. - //Get the type. - Type^ Mytype = Type::GetType( "parminfo" ); - - //Get and display the method. - MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); - Console::Write( "\nMymethodbase = {0}", Mymethodbase ); - - //Get the ParameterInfo array. - array^Myarray = Mymethodbase->GetParameters(); - - //Get and display the IsOut of each parameter. - System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator(); - while ( enum0->MoveNext() ) - { - ParameterInfo^ Myparam = safe_cast(enum0->Current); - Console::Write( "\nFor parameter # {0}, the IsOut is - {1}", Myparam->Position, Myparam->IsOut ); - } - - return 0; -} - -/* -This code produces the following output: - -Reflection.ParameterInfo - -Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef) -For parameter # 0, the IsOut is - False -For parameter # 1, the IsOut is - True -For parameter # 2, the IsOut is - False -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp deleted file mode 100644 index f604a9598d8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; -public ref class parminfo -{ -public: - static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) - { - *str2m = "in mymethod"; - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.Parameterinfo" ); - - //Get the ParameterInfo parameter of a function. - //Get the type. - Type^ Mytype = Type::GetType( "parminfo" ); - - //Get and display the method. - MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); - Console::Write( "\nMymethodbase = {0}", Mymethodbase ); - - //Get the ParameterInfo array. - array^Myarray = Mymethodbase->GetParameters(); - - //Get and display the name of each parameter. - System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator(); - while ( enum0->MoveNext() ) - { - ParameterInfo^ Myparam = safe_cast(enum0->Current); - Console::Write( "\nFor parameter # {0}, the Name is - {1}", Myparam->Position, Myparam->Name ); - } - - return 0; -} - -/* -This code produces the following output: - -Reflection.ParameterInfo - -Mymethodbase -= Void mymethod (Int32, System.String ByRef, System.String ByRef) -For parameter # 0, the Name is - int1m -For parameter # 1, the Name is - str2m -For parameter # 2, the Name is - str3m -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp deleted file mode 100644 index e005d0ef83a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; -public ref class parminfo -{ -public: - static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) - { - *str2m = "in mymethod"; - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.Parameterinfo" ); - - //Get the ParameterInfo parameter of a function. - //Get the type. - Type^ Mytype = Type::GetType( "parminfo" ); - - //Get and display the method. - MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); - Console::Write( "\nMymethodbase = {0}", Mymethodbase ); - - //Get the ParameterInfo array. - array^Myarray = Mymethodbase->GetParameters(); - - //Get and display the ParameterInfo of each parameter. - System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator(); - while ( enum0->MoveNext() ) - { - ParameterInfo^ Myparam = safe_cast(enum0->Current); - Console::Write( "\nFor parameter # {0}, the ParameterType is - {1}", Myparam->Position, Myparam->ParameterType ); - } - - return 0; -} - -/* -This code produces the following output: - -Reflection.Parameterinfo - -Mymethodbase = Void mymethod(Int32, System.String ByRef, System.String ByRef) -For parameter # 0, the ParameterType is - System.Int32 -For parameter # 1, the ParameterType is - System.String& -For parameter # 2, the ParameterType is - System.String& -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp deleted file mode 100644 index da729d96fce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Policy; -using namespace System::Security::Principal; - -int main(array ^args) -{ - System::String^ null; - AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal); - PrincipalPermission^ principalPerm = gcnew PrincipalPermission(null, "Administrators" ); - principalPerm->Demand(); - Console::WriteLine("Demand succeeded"); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp deleted file mode 100644 index 0bde5631510..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Policy; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - void Method() - { - // - //Define users and roles. - PrincipalPermission^ ppBob = gcnew PrincipalPermission( "Bob", "Manager" ); - PrincipalPermission^ ppLouise = gcnew PrincipalPermission( "Louise", "Supervisor" ); - PrincipalPermission^ ppGreg = gcnew PrincipalPermission( "Greg", "Employee" ); - - //Define groups of users. - PrincipalPermission^ pp1 = (PrincipalPermission^) (ppBob->Union( ppLouise )); - PrincipalPermission^ pp2 = (PrincipalPermission^) (ppGreg->Union( pp1 )); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp deleted file mode 100644 index cbff0e29e8a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Policy; -using namespace System::Security::Principal; - -[PrincipalPermission(SecurityAction::Demand, Role = "Administrators")] -void CheckAdministrator() -{ - Console::WriteLine("User is an administrator."); -} -int main(array ^args) -{ - try - { - // Must set PrincipalPolicy to WindowsPrincipal - AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal); - // Check using declarative security. - CheckAdministrator(); - // Check using Imperative security. - System::String^ null; - PrincipalPermission^ principalPerm = gcnew PrincipalPermission(null, "Administrators" ); - principalPerm->Demand(); - Console::WriteLine("Demand succeeded"); - } - catch (Exception ^e) - { - Console::WriteLine(e->Message); - } - return 0; -} - - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp deleted file mode 100644 index 189cd35d9c7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,161 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Define three properties: one read-write, one default, -// and one read only. -// Define a read-write property. -public ref class Aproperty -{ -private: - String^ caption; - -public: - Aproperty() - : caption( "A Default caption" ) - {} - - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - - -// Define a default property. -public ref class Bproperty -{ -private: - String^ caption; - -public: - Bproperty() - : caption( "B Default caption" ) - {} - -public: - property String^ Item - { - String^ get() - { - return "1"; - } - - } - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - - -// Define a read-only property. -public ref class Cproperty -{ -private: - String^ caption; - -public: - Cproperty() - : caption( "C Default caption" ) - {} - - - property String^ Caption - { - String^ get() - { - return caption; - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.PropertyAttributes" ); - - // Determine whether a property exists, and change its value. - Aproperty^ Mypropertya = gcnew Aproperty; - Bproperty^ Mypropertyb = gcnew Bproperty; - Cproperty^ Mypropertyc = gcnew Cproperty; - Console::Write( "\n1. Mypropertya->Caption = {0}", Mypropertya->Caption ); - Console::Write( "\n1. Mypropertyb->Caption = {0}", Mypropertyb->Caption ); - Console::Write( "\n1. Mypropertyc->Caption = {0}", Mypropertyc->Caption ); - - // Only Mypropertya can be changed, as Mypropertyb is read-only. - Mypropertya->Caption = "A- This is changed."; - Mypropertyb->Caption = "B- This is changed."; - - // Note that Mypropertyc is not changed because it is read only - Console::Write( "\n\n2. Mypropertya->Caption = {0}", Mypropertya->Caption ); - Console::Write( "\n2. Mypropertyb->Caption = {0}", Mypropertyb->Caption ); - Console::Write( "\n2. Mypropertyc->Caption = {0}", Mypropertyc->Caption ); - - // Get the PropertyAttributes enumeration of the property. - // Get the type. - Type^ MyTypea = Type::GetType( "Aproperty" ); - Type^ MyTypeb = Type::GetType( "Bproperty" ); - Type^ MyTypec = Type::GetType( "Cproperty" ); - - // Get the property attributes. - PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); - PropertyAttributes Myattributesa = Mypropertyinfoa->Attributes; - PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Item" ); - PropertyAttributes Myattributesb = Mypropertyinfob->Attributes; - PropertyInfo^ Mypropertyinfoc = MyTypec->GetProperty( "Caption" ); - PropertyAttributes Myattributesc = Mypropertyinfoc->Attributes; - - // Display the property attributes value. - Console::Write( "\n\na- {0}", Myattributesa ); - Console::Write( "\nb- {0}", Myattributesb ); - Console::Write( "\nc- {0}", Myattributesc ); - return 0; -} - -// This example displays the following output to the console -// -// Reflection.PropertyAttributes -// -// 1. Mypropertya.Caption = A Default caption -// 1. Mypropertyb.Caption = B Default caption -// 1. Mypropertyc.Caption = C Default caption -// -// 2. Mypropertya.Caption = A- This is changed. -// 2. Mypropertyb.Caption = B- This is changed. -// 2. Mypropertyc.Caption = C Default caption -// -// a- None -// b- None -// c- None -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp deleted file mode 100644 index 5e3598f1d39..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Define one readable property and one not readable. -public ref class Mypropertya -{ -private: - String^ caption; - -public: - Mypropertya() - : caption( "A Default caption" ) - {} - - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - -public ref class Mypropertyb -{ -private: - String^ caption; - -public: - Mypropertyb() - : caption( "B Default caption" ) - {} - - - property String^ Caption - { - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.PropertyInfo" ); - - // Define two properties. - Mypropertya^ mypropertya = gcnew Mypropertya; - Mypropertyb^ mypropertyb = gcnew Mypropertyb; - Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption ); - - // Mypropertyb.Caption cannot be read, because - // there is no get accessor. - // Get the type and PropertyInfo. - Type^ MyTypea = Type::GetType( "Mypropertya" ); - PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); - Type^ MyTypeb = Type::GetType( "Mypropertyb" ); - PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Caption" ); - - // Get and display the CanRead property. - Console::Write( "\nCanRead a - {0}", Mypropertyinfoa->CanRead ); - Console::Write( "\nCanRead b - {0}", Mypropertyinfob->CanRead ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp deleted file mode 100644 index c83b78e6d61..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Define one writable property and one not writable. -public ref class Mypropertya -{ -private: - String^ caption; - -public: - Mypropertya() - : caption( "A Default caption" ) - {} - - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - -public ref class Mypropertyb -{ -private: - String^ caption; - -public: - Mypropertyb() - : caption( "B Default caption" ) - {} - - - property String^ Caption - { - String^ get() - { - return caption; - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.PropertyInfo" ); - - // Define two properties. - Mypropertya^ mypropertya = gcnew Mypropertya; - Mypropertyb^ mypropertyb = gcnew Mypropertyb; - - // Read and display the property. - Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption ); - Console::Write( "\nMypropertyb->Caption = {0}", mypropertyb->Caption ); - - // Write to the property. - mypropertya->Caption = "A- No Change"; - - // Mypropertyb.Caption cannot be written to because - // there is no set accessor. - // Read and display the property. - Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption ); - Console::Write( "\nMypropertyb->Caption = {0}", mypropertyb->Caption ); - - // Get the type and PropertyInfo. - Type^ MyTypea = Type::GetType( "Mypropertya" ); - PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); - Type^ MyTypeb = Type::GetType( "Mypropertyb" ); - PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Caption" ); - - // Get and display the CanWrite property. - Console::Write( "\nCanWrite a - {0}", Mypropertyinfoa->CanWrite ); - Console::Write( "\nCanWrite b - {0}", Mypropertyinfob->CanWrite ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp deleted file mode 100644 index e947e02ff48..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Define a property. -public ref class Myproperty -{ -private: - String^ caption; - -public: - Myproperty() - : caption( "A Default caption" ) - {} - - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.PropertyInfo" ); - - // Get the type and PropertyInfo for two separate properties. - Type^ MyTypea = Type::GetType( "Myproperty" ); - PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); - Type^ MyTypeb = Type::GetType( "System.Reflection.MethodInfo" ); - PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "MemberType" ); - - // Get and display the GetGetMethod method for each property. - MethodInfo^ Mygetmethodinfoa = Mypropertyinfoa->GetGetMethod(); - Console::Write( "\nGetAccessor for {0} returns a {1}", Mypropertyinfoa->Name, Mygetmethodinfoa->ReturnType ); - MethodInfo^ Mygetmethodinfob = Mypropertyinfob->GetGetMethod(); - Console::Write( "\nGetAccessor for {0} returns a {1}", Mypropertyinfob->Name, Mygetmethodinfob->ReturnType ); - - // Display the GetGetMethod without using the MethodInfo. - Console::Write( "\n{0}.{1} GetGetMethod - {2}", MyTypea->FullName, Mypropertyinfoa->Name, Mypropertyinfoa->GetGetMethod() ); - Console::Write( "\n{0}.{1} GetGetMethod - {2}", MyTypeb->FullName, Mypropertyinfob->Name, Mypropertyinfob->GetGetMethod() ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp deleted file mode 100644 index 6c130b9d45f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// A class that contains some properties. -public ref class MyProperty -{ -private: - - // Define a simple string property. - String^ caption; - -public: - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -private: - - // A very limited indexer that gets or sets one of four - // strings. - array^strings; - -public: - MyProperty() - { - array^temp0 = {"abc","def","ghi","jkl"}; - strings = temp0; - } - - - property String^ Item [int] - { - String^ get( int Index ) - { - return strings[ Index ]; - } - - void set( int Index, String^ value ) - { - strings[ Index ] = value; - } - - } - -}; - -int main() -{ - - // Get the type and PropertyInfo. - Type^ t = Type::GetType( "MyProperty" ); - PropertyInfo^ pi = t->GetProperty( "Caption" ); - - // Get the public GetIndexParameters method. - array^parms = pi->GetIndexParameters(); - Console::WriteLine( "\n{0}.{1} has {2} parameters.", t->FullName, pi->Name, parms->GetLength( 0 ) ); - - // Display a property that has parameters. - pi = t->GetProperty( "Item" ); - parms = pi->GetIndexParameters(); - Console::WriteLine( "{0}.{1} has {2} parameters.", t->FullName, pi->Name, parms->GetLength( 0 ) ); - for ( int i = 0; i < parms->GetLength( 0 ); i++ ) - { - Console::WriteLine( " Parameter: {0}", parms[ i ]->Name ); - - } - return 0; -} - -/* - This example produces the following output: - MyProperty.Caption has 0 parameters. - MyProperty.Item has 1 parameters. - Parameter: Index - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp deleted file mode 100644 index 490380e255b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Define a property. -public ref class Myproperty -{ -private: - String^ caption; - -public: - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - -int main() -{ - Console::WriteLine( "\nReflection.PropertyInfo" ); - - // Get the type and PropertyInfo for two separate properties. - Type^ MyTypea = Type::GetType( "Myproperty" ); - PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); - Type^ MyTypeb = Type::GetType( "System.Text.StringBuilder" ); - PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Length" ); - - // Get and display the GetSetMethod method for each property. - MethodInfo^ Mygetmethodinfoa = Mypropertyinfoa->GetSetMethod(); - Console::Write( "\nSetAccessor for {0} returns a {1}", Mypropertyinfoa->Name, Mygetmethodinfoa->ReturnType ); - MethodInfo^ Mygetmethodinfob = Mypropertyinfob->GetSetMethod(); - Console::Write( "\nSetAccessor for {0} returns a {1}", Mypropertyinfob->Name, Mygetmethodinfob->ReturnType ); - - // Display the GetSetMethod without using the MethodInfo. - Console::Write( "\n\n{0}.{1} GetSetMethod - {2}", MyTypea->FullName, Mypropertyinfoa->Name, Mypropertyinfoa->GetSetMethod() ); - Console::Write( "\n{0}.{1} GetSetMethod - {2}", MyTypeb->FullName, Mypropertyinfob->Name, Mypropertyinfob->GetSetMethod() ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp deleted file mode 100644 index a56525a268e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - Console::WriteLine( "\nReflection.PropertyInfo" ); - - // Get the type and PropertyInfo. - Type^ MyType = Type::GetType( "System.Reflection.MemberInfo" ); - PropertyInfo^ Mypropertyinfo = MyType->GetProperty( "Name" ); - - // Read and display the MemberType property. - Console::Write( "\nMemberType = {0}", Mypropertyinfo->MemberType ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp deleted file mode 100644 index 7c87302d269..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -// Define a property. -public ref class TestClass -{ -private: - String^ caption; - -public: - TestClass() - { - caption = "A Default caption"; - } - - - property String^ Caption - { - String^ get() - { - return caption; - } - - void set( String^ value ) - { - if ( caption != value ) - { - caption = value; - } - } - - } - -}; - -int main() -{ - TestClass^ t = gcnew TestClass; - - // Get the type and PropertyInfo. - Type^ myType = t->GetType(); - PropertyInfo^ pinfo = myType->GetProperty( "Caption" ); - - // Display the property value, using the GetValue method. - Console::WriteLine( "\nGetValue: {0}", pinfo->GetValue( t, nullptr ) ); - - // Use the SetValue method to change the caption. - pinfo->SetValue( t, "This caption has been changed.", nullptr ); - - // Display the caption again. - Console::WriteLine( "GetValue: {0}", pinfo->GetValue( t, nullptr ) ); - Console::WriteLine( "\nPress the Enter key to continue." ); - Console::ReadLine(); - return 0; -} - -/* -This example produces the following output: - -GetValue: A Default caption -GetValue: This caption has been changed - -Press the Enter key to continue. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp deleted file mode 100644 index 37dced94673..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myCollection ); -int main() -{ - - // Creates and initializes a new Queue. - Queue^ myQ = gcnew Queue; - myQ->Enqueue( "Hello" ); - myQ->Enqueue( "World" ); - myQ->Enqueue( "!" ); - - // Displays the properties and values of the Queue. - Console::WriteLine( "myQ" ); - Console::WriteLine( "\tCount: {0}", myQ->Count ); - Console::Write( "\tValues:" ); - PrintValues( myQ ); -} - -void PrintValues( IEnumerable^ myCollection ) -{ - IEnumerator^ myEnum = myCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - myQ - Count: 3 - Values: Hello World ! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp deleted file mode 100644 index 7ff5770c590..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( Queue^ myQ ); -int main() -{ - - // Creates and initializes a new Queue. - Queue^ myQ = gcnew Queue; - myQ->Enqueue( "The" ); - myQ->Enqueue( "quick" ); - myQ->Enqueue( "brown" ); - myQ->Enqueue( "fox" ); - myQ->Enqueue( "jumps" ); - - // Displays the count and values of the Queue. - Console::WriteLine( "Initially," ); - Console::WriteLine( " Count : {0}", myQ->Count ); - Console::Write( " Values:" ); - PrintValues( myQ ); - - // Clears the Queue. - myQ->Clear(); - - // Displays the count and values of the Queue. - Console::WriteLine( "After Clear," ); - Console::WriteLine( " Count : {0}", myQ->Count ); - Console::Write( " Values:" ); - PrintValues( myQ ); -} - -void PrintValues( Queue^ myQ ) -{ - IEnumerator^ myEnum = myQ->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ myObj = safe_cast(myEnum->Current); - Console::Write( " {0}", myObj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initially, - Count : 5 - Values: The quick brown fox jumps - After Clear, - Count : 0 - Values: - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp deleted file mode 100644 index da270065dbb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( Array^ myArr, char mySeparator ); -int main() -{ - // Creates and initializes the source Queue. - Queue^ mySourceQ = gcnew Queue; - mySourceQ->Enqueue( "three" ); - mySourceQ->Enqueue( "napping" ); - mySourceQ->Enqueue( "cats" ); - mySourceQ->Enqueue( "in" ); - mySourceQ->Enqueue( "the" ); - mySourceQ->Enqueue( "barn" ); - - // Creates and initializes the one-dimensional target Array. - Array^ myTargetArray = Array::CreateInstance( String::typeid, 15 ); - myTargetArray->SetValue( "The", 0 ); - myTargetArray->SetValue( "quick", 1 ); - myTargetArray->SetValue( "brown", 2 ); - myTargetArray->SetValue( "fox", 3 ); - myTargetArray->SetValue( "jumps", 4 ); - myTargetArray->SetValue( "over", 5 ); - myTargetArray->SetValue( "the", 6 ); - myTargetArray->SetValue( "lazy", 7 ); - myTargetArray->SetValue( "dog", 8 ); - - // Displays the values of the target Array. - Console::WriteLine( "The target Array contains the following (before and after copying):" ); - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source Queue to the target Array, starting at index 6. - mySourceQ->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source Queue to a new standard array. - array^myStandardArray = mySourceQ->ToArray(); - - // Displays the values of the new standard array. - Console::WriteLine( "The new standard array contains the following:" ); - PrintValues( myStandardArray, ' ' ); -} - -void PrintValues( Array^ myArr, char mySeparator ) -{ - IEnumerator^ myEnum = myArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ myObj = safe_cast(myEnum->Current); - Console::Write( "{0}{1}", mySeparator, myObj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Array contains the following (before and after copying): - The quick brown fox jumps over the lazy dog - The quick brown fox jumps over three napping cats in the barn - The new standard array contains the following: - three napping cats in the barn - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp deleted file mode 100644 index 7238b539959..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myCollection ); -int main() -{ - - // Creates and initializes a new Queue. - Queue^ myQ = gcnew Queue; - myQ->Enqueue( "The" ); - myQ->Enqueue( "quick" ); - myQ->Enqueue( "brown" ); - myQ->Enqueue( "fox" ); - - // Displays the Queue. - Console::Write( "Queue values:" ); - PrintValues( myQ ); - - // Removes an element from the Queue. - Console::WriteLine( "(Dequeue)\t{0}", myQ->Dequeue() ); - - // Displays the Queue. - Console::Write( "Queue values:" ); - PrintValues( myQ ); - - // Removes another element from the Queue. - Console::WriteLine( "(Dequeue)\t{0}", myQ->Dequeue() ); - - // Displays the Queue. - Console::Write( "Queue values:" ); - PrintValues( myQ ); - - // Views the first element in the Queue but does not remove it. - Console::WriteLine( "(Peek) \t{0}", myQ->Peek() ); - - // Displays the Queue. - Console::Write( "Queue values:" ); - PrintValues( myQ ); -} - -void PrintValues( IEnumerable^ myCollection ) -{ - IEnumerator^ myEnum = myCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Queue values: The quick brown fox - (Dequeue) The - Queue values: quick brown fox - (Dequeue) quick - Queue values: brown fox - (Peek) brown - Queue values: brown fox - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp deleted file mode 100644 index ce3246510e6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -int main() -{ - - // Creates and initializes a new Queue. - Queue^ myQ = gcnew Queue; - myQ->Enqueue( "The" ); - myQ->Enqueue( "quick" ); - myQ->Enqueue( "brown" ); - myQ->Enqueue( "fox" ); - - // Creates a synchronized wrapper around the Queue. - Queue^ mySyncdQ = Queue::Synchronized( myQ ); - - // Displays the sychronization status of both Queues. - Console::WriteLine( "myQ is {0}.", myQ->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); - Console::WriteLine( "mySyncdQ is {0}.", mySyncdQ->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); -} - -/* -This code produces the following output. - -myQ is not synchronized. -mySyncdQ is synchronized. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp deleted file mode 100644 index 8bfdf62af62..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class SamplesQueue -{ -public: - static void Main() - { - // - Queue^ myCollection = gcnew Queue(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesQueue::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp deleted file mode 100644 index bdf0c7f6486..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random; - array^b = gcnew array(10); - rnd->NextBytes( b ); - Console::WriteLine("The Random bytes are:"); - for ( int i = 0; i < 10; i++ ) - Console::WriteLine("{0}: {1}", i, b[i]); -} -// The example displays output similar to the following: -// The Random bytes are: -// 0: 131 -// 1: 96 -// 2: 226 -// 3: 213 -// 4: 176 -// 5: 208 -// 6: 99 -// 7: 89 -// 8: 226 -// 9: 194 -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp deleted file mode 100644 index 9d881778d4a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Cryptography; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - // - array^ random = gcnew array(100); - - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - rng->GetBytes( random ); // The array is now filled with cryptographically strong random bytes. - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp deleted file mode 100644 index c9dcb18468c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Cryptography; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - // - array^ random = gcnew array(100); - RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); - rng->GetNonZeroBytes( random ); // The array is now filled with cryptographically strong random bytes, and none are zero. - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp deleted file mode 100644 index 9b6c4198a94..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -void PrintKeys( RegistryKey ^ rkey ) -{ - - // Retrieve all the subkeys for the specified key. - array^names = rkey->GetSubKeyNames(); - int icount = 0; - Console::WriteLine( "Subkeys of {0}", rkey->Name ); - Console::WriteLine( "-----------------------------------------------" ); - - // Print the contents of the array to the console. - System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); - while ( enum0->MoveNext() ) - { - String^ s = safe_cast(enum0->Current); - Console::WriteLine( s ); - - // The following code puts a limit on the number - // of keys displayed. Comment it out to print the - // complete list. - icount++; - if ( icount >= 10 ) - break; - } -} - -int main() -{ - - // Create a RegistryKey, which will access the HKEY_CLASSES_ROOT - // key in the registry of this machine. - RegistryKey ^ rk = Registry::ClassesRoot; - - // Print out the keys. - PrintKeys( rk ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp deleted file mode 100644 index 6baa9bb3a23..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -void PrintKeys( RegistryKey ^ rkey ) -{ - - // Retrieve all the subkeys for the specified key. - array^names = rkey->GetSubKeyNames(); - int icount = 0; - Console::WriteLine( "Subkeys of {0}", rkey->Name ); - Console::WriteLine( "-----------------------------------------------" ); - - // Print the contents of the array to the console. - System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); - while ( enum0->MoveNext() ) - { - String^ s = safe_cast(enum0->Current); - Console::WriteLine( s ); - - // The following code puts a limit on the number - // of keys displayed. Comment it out to print the - // complete list. - icount++; - if ( icount >= 10 ) - break; - } -} - -int main() -{ - - // Create a RegistryKey, which will access the HKEY_CURRENT_CONFIG - // key in the registry of this machine. - RegistryKey ^ rk = Registry::CurrentConfig; - - // Print out the keys. - PrintKeys( rk ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp deleted file mode 100644 index c6f43174e0d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -void PrintKeys( RegistryKey ^ rkey ) -{ - - // Retrieve all the subkeys for the specified key. - array^names = rkey->GetSubKeyNames(); - int icount = 0; - Console::WriteLine( "Subkeys of {0}", rkey->Name ); - Console::WriteLine( "-----------------------------------------------" ); - - // Print the contents of the array to the console. - System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); - while ( enum0->MoveNext() ) - { - String^ s = safe_cast(enum0->Current); - Console::WriteLine( s ); - - // The following code puts a limit on the number - // of keys displayed. Comment it out to print the - // complete list. - icount++; - if ( icount >= 10 ) - break; - } -} - -int main() -{ - - // Create a RegistryKey, which will access the HKEY_CURRENT_USER - // key in the registry of this machine. - RegistryKey ^ rk = Registry::CurrentUser; - - // Print out the keys. - PrintKeys( rk ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp deleted file mode 100644 index 0fe44b29190..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -void PrintKeys( RegistryKey ^ rkey ) -{ - - // Retrieve all the subkeys for the specified key. - array^names = rkey->GetSubKeyNames(); - int icount = 0; - Console::WriteLine( "Subkeys of {0}", rkey->Name ); - Console::WriteLine( "-----------------------------------------------" ); - - // Print the contents of the array to the console. - System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); - while ( enum0->MoveNext() ) - { - String^ s = safe_cast(enum0->Current); - Console::WriteLine( s ); - - // The following code puts a limit on the number - // of keys displayed. Comment it out to print the - // complete list. - icount++; - if ( icount >= 10 ) - break; - } -} - -int main() -{ - - // Create a RegistryKey, which will access the HKEY_LOCAL_MACHINE - // key in the registry of this machine. - RegistryKey ^ rk = Registry::LocalMachine; - - // Print out the keys. - PrintKeys( rk ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp deleted file mode 100644 index aa60f391bdb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -void PrintKeys( RegistryKey ^ rkey ) -{ - - // Retrieve all the subkeys for the specified key. - array^names = rkey->GetSubKeyNames(); - int icount = 0; - Console::WriteLine( "Subkeys of {0}", rkey->Name ); - Console::WriteLine( "-----------------------------------------------" ); - - // Print the contents of the array to the console. - System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); - while ( enum0->MoveNext() ) - { - String^ s = safe_cast(enum0->Current); - Console::WriteLine( s ); - - // The following code puts a limit on the number - // of keys displayed. Comment it out to print the - // complete list. - icount++; - if ( icount >= 10 ) - break; - } -} - -int main() -{ - - // Create a RegistryKey, which will access the HKEY_PERFORMANCE_DATA - // key in the registry of this machine. - RegistryKey ^ rk = Registry::PerformanceData; - - // Print out the keys. - PrintKeys( rk ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp deleted file mode 100644 index 6131b75f231..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace Microsoft::Win32; -void PrintKeys( RegistryKey ^ rkey ) -{ - - // Retrieve all the subkeys for the specified key. - array^names = rkey->GetSubKeyNames(); - int icount = 0; - Console::WriteLine( "Subkeys of {0}", rkey->Name ); - Console::WriteLine( "-----------------------------------------------" ); - - // Print the contents of the array to the console. - System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); - while ( enum0->MoveNext() ) - { - String^ s = safe_cast(enum0->Current); - Console::WriteLine( s ); - - // The following code puts a limit on the number - // of keys displayed. Comment it out to print the - // complete list. - icount++; - if ( icount >= 10 ) - break; - } -} - -int main() -{ - - // Create a RegistryKey, which will access the HKEY_USERS - // key in the registry of this machine. - RegistryKey ^ rk = Registry::Users; - - // Print out the keys. - PrintKeys( rk ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp deleted file mode 100644 index 924a4b4b69f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -using namespace System; -using namespace Microsoft::Win32; - -public ref class RegGetDef -{ -public: - static void Main() - { - // Create a reference to a valid key. In order for this code to - // work, the indicated key must have been created previously. - // The key name is not case-sensitive. - RegistryKey^ rk = Registry::LocalMachine->OpenSubKey("Software\\myTestKey", false); - // Get the value from the specified name/value pair in the key. - String^ valueName = "myTestValue"; - - Console::WriteLine("Retrieving registry value ..."); - Console::WriteLine(); - Object^ o = rk->GetValue(valueName); - Console::WriteLine("Object Type = " + o->GetType()->FullName); - Console::WriteLine(); - switch (rk->GetValueKind(valueName)) - { - case RegistryValueKind::String: - case RegistryValueKind::ExpandString: - Console::WriteLine("Value = " + o); - break; - case RegistryValueKind::Binary: - for each (Byte^ b in (array^)o) - { - Console::Write("{0:x2} ", b); - } - Console::WriteLine(); - break; - case RegistryValueKind::DWord: - Console::WriteLine("Value = " + Convert::ToString((Int32^)o)); - break; - case RegistryValueKind::QWord: - Console::WriteLine("Value = " + Convert::ToString((Int64^)o)); - break; - case RegistryValueKind::MultiString: - for each (String^ s in (array^)o) - { - Console::Write("[{0:s}], ", s); - } - Console::WriteLine(); - break; - default: - Console::WriteLine("Value = (Unknown)"); - break; - } - - // Attempt to retrieve a value that does not exist; the specified - // default value is returned. - String^ def = (String^)rk->GetValue("notavalue", "The default to return"); - Console::WriteLine(); - Console::WriteLine(def); - - rk->Close(); - } -}; - -int main() -{ - RegGetDef::Main(); -} -/* -Output: -Retrieving registry value ... - -Object Type = System.String - -Value = testData - -The default to return -*/ -// - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp deleted file mode 100644 index ebd4a81690e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - -// -using namespace System; -using namespace System::Resources; -int main() -{ - - // Creates a resource writer. - IResourceWriter^ writer = gcnew ResourceWriter( "myResources.resources" ); - - // Adds resources to the resource writer. - writer->AddResource( "String 1", "First String" ); - writer->AddResource( "String 2", "Second String" ); - writer->AddResource( "String 3", "Third String" ); - - // Writes the resources to the file or stream, and closes it. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp deleted file mode 100644 index aa1b6553ab8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -// Print the byte array in a readable format. -void PrintByteArray( array^array ) -{ - int i; - for ( i = 0; i < array->Length; i++ ) - { - Console::Write( String::Format( "{0:X2}", array[ i ] ) ); - if ( (i % 4) == 3 ) - Console::Write( " " ); - - } - Console::WriteLine(); -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "Usage: hashdir " ); - return 0; - } - - try - { - - // Create a DirectoryInfo object representing the specified directory. - DirectoryInfo^ dir = gcnew DirectoryInfo( args[ 1 ] ); - - // Get the FileInfo objects for every file in the directory. - array^files = dir->GetFiles(); - - // Initialize a SHA256 hash object. - SHA256 ^ mySHA256 = SHA256Managed::Create(); - array^hashValue; - - // Compute and print the hash values for each file in directory. - System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FileInfo^ fInfo = safe_cast(myEnum->Current); - - // Create a fileStream for the file. - FileStream^ fileStream = fInfo->Open( FileMode::Open ); - - // Compute the hash of the fileStream. - hashValue = mySHA256->ComputeHash( fileStream ); - - // Write the name of the file to the Console. - Console::Write( "{0}: ", fInfo->Name ); - - // Write the hash value to the Console. - PrintByteArray( hashValue ); - - // Close the file. - fileStream->Close(); - } - return 0; - } - catch ( DirectoryNotFoundException^ ) - { - Console::WriteLine( "Error: The directory specified could not be found." ); - } - catch ( IOException^ ) - { - Console::WriteLine( "Error: A file in the directory could not be accessed." ); - } - -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp deleted file mode 100644 index 471fe0f815a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Security::Cryptography; - -public ref class Sample -{ -protected: - void Method() - { - int DATA_SIZE = 1024; - - // - array^ data = gcnew array( DATA_SIZE ); - array^ result; - SHA384^ shaM = gcnew SHA384Managed; - result = shaM->ComputeHash( data ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp deleted file mode 100644 index 6a0aa345a43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Security::Cryptography; - -public ref class Sample -{ -protected: - void Method() - { - int DATA_SIZE = 1024; - - // - array^ data = gcnew array( DATA_SIZE ); - array^ result; - - SHA384^ shaM = gcnew SHA384Managed; - result = shaM->ComputeHash( data ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp deleted file mode 100644 index 2a84c2dc7ba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Security::Cryptography; - -public ref class Sample -{ -protected: - void Method() - { - int DATA_SIZE = 1024; - - // - array^ data = gcnew array( DATA_SIZE ); - array^ result; - SHA512^ shaM = gcnew SHA512Managed; - result = shaM->ComputeHash( data ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp deleted file mode 100644 index a22a11fb2ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Security::Cryptography; - -public ref class Sample -{ -protected: - void Method() - { - int DATA_SIZE = 1024; - - // - array^ data = gcnew array( DATA_SIZE ); - array^ result; - - SHA512^ shaM = gcnew SHA512Managed; - result = shaM->ComputeHash( data ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp deleted file mode 100644 index d7c3794882b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Configuration::Install; -using namespace System::ServiceProcess; -using namespace System::ComponentModel; - -[RunInstaller(true)] -public ref class MyProjectInstaller : public Installer -{ -private: - ServiceInstaller^ serviceInstaller1; - ServiceInstaller^ serviceInstaller2; - ServiceProcessInstaller^ processInstaller; - -public: - MyProjectInstaller() - { - // Instantiate installers for process and services. - processInstaller = gcnew ServiceProcessInstaller; - serviceInstaller1 = gcnew ServiceInstaller; - serviceInstaller2 = gcnew ServiceInstaller; - - // The services run under the system account. - processInstaller->Account = ServiceAccount::LocalSystem; - - // The services are started manually. - serviceInstaller1->StartType = ServiceStartMode::Manual; - serviceInstaller2->StartType = ServiceStartMode::Manual; - - // ServiceName must equal those on ServiceBase derived classes. - serviceInstaller1->ServiceName = "Hello-World Service 1"; - serviceInstaller2->ServiceName = "Hello-World Service 2"; - - // Add installers to collection. Order is not important. - Installers->Add( serviceInstaller1 ); - Installers->Add( serviceInstaller2 ); - Installers->Add( processInstaller ); - } - - static void Main() - { - Console::WriteLine("Usage: InstallUtil.exe [.exe]"); - } -}; - -int main() -{ - MyProjectInstaller::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp deleted file mode 100644 index c7e0914d780..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp +++ /dev/null @@ -1,27 +0,0 @@ -using namespace System; -using namespace System::Collections; - -public ref class SamplesSortedList -{ -public: - static void Main() - { - // Creates and initializes a new SortedList. - SortedList^ mySortedList = gcnew SortedList(); - mySortedList->Add("Third", "!"); - mySortedList->Add("Second", "World"); - mySortedList->Add("First", "Hello"); - - // - for each (DictionaryEntry de in mySortedList) - { - //... - } - // - } -}; - -int main() -{ - SamplesSortedList::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp deleted file mode 100644 index bc3817bdcfe..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -public ref class SamplesSortedList -{ -public: - static void PrintKeysAndValues( SortedList^ myList ) - { - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); - } - -}; - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( "Third", "!" ); - mySL->Add( "Second", "World" ); - mySL->Add( "First", "Hello" ); - - // Displays the properties and values of the SortedList. - Console::WriteLine( "mySL" ); - Console::WriteLine( " Count: {0}", mySL->Count ); - Console::WriteLine( " Capacity: {0}", mySL->Capacity ); - Console::WriteLine( " Keys and Values:" ); - SamplesSortedList::PrintKeysAndValues( mySL ); -} - -/* -This code produces the following output. - -mySL -Count: 3 -Capacity: 16 -Keys and Values: --KEY- -VALUE- -First: Hello -Second: World -Third: ! -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp deleted file mode 100644 index ce1205d460a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void PrintKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( "one", "The" ); - mySL->Add( "two", "quick" ); - mySL->Add( "three", "brown" ); - mySL->Add( "four", "fox" ); - - // Displays the SortedList. - Console::WriteLine( "The SortedList contains the following:" ); - PrintKeysAndValues( mySL ); -} - -/* -This code produces the following output. - -The SortedList contains the following: - -KEY- -VALUE- - four: fox - one: The - three: brown - two: quick -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp deleted file mode 100644 index d4b3dbf1600..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void PrintKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( "one", "The" ); - mySL->Add( "two", "quick" ); - mySL->Add( "three", "brown" ); - mySL->Add( "four", "fox" ); - mySL->Add( "five", "jumps" ); - - // Displays the count, capacity and values of the SortedList. - Console::WriteLine( "Initially," ); - Console::WriteLine( " Count : {0}", mySL->Count ); - Console::WriteLine( " Capacity : {0}", mySL->Capacity ); - Console::WriteLine( " Values:" ); - PrintKeysAndValues( mySL ); - - // Trims the SortedList. - mySL->TrimToSize(); - - // Displays the count, capacity and values of the SortedList. - Console::WriteLine( "After TrimToSize," ); - Console::WriteLine( " Count : {0}", mySL->Count ); - Console::WriteLine( " Capacity : {0}", mySL->Capacity ); - Console::WriteLine( " Values:" ); - PrintKeysAndValues( mySL ); - - // Clears the SortedList. - mySL->Clear(); - - // Displays the count, capacity and values of the SortedList. - Console::WriteLine( "After Clear," ); - Console::WriteLine( " Count : {0}", mySL->Count ); - Console::WriteLine( " Capacity : {0}", mySL->Capacity ); - Console::WriteLine( " Values:" ); - PrintKeysAndValues( mySL ); - - // Trims the SortedList again. - mySL->TrimToSize(); - - // Displays the count, capacity and values of the SortedList. - Console::WriteLine( "After the second TrimToSize," ); - Console::WriteLine( " Count : {0}", mySL->Count ); - Console::WriteLine( " Capacity : {0}", mySL->Capacity ); - Console::WriteLine( " Values:" ); - PrintKeysAndValues( mySL ); -} - -/* -This code produces the following output. - -Initially, - Count : 5 - Capacity : 16 - Values: - -KEY- -VALUE- - five: jumps - four: fox - one: The - three: brown - two: quick - -After TrimToSize, - Count : 5 - Capacity : 5 - Values: - -KEY- -VALUE- - five: jumps - four: fox - one: The - three: brown - two: quick - -After Clear, - Count : 0 - Capacity : 16 - Values: - -KEY- -VALUE- - -After the second TrimToSize, - Count : 0 - Capacity : 16 - Values: - -KEY- -VALUE- - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp deleted file mode 100644 index e233d2f4884..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void PrintIndexAndKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i, myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( 2, "two" ); - mySL->Add( 4, "four" ); - mySL->Add( 1, "one" ); - mySL->Add( 3, "three" ); - mySL->Add( (int^)0, "zero" ); - - // Displays the values of the SortedList. - Console::WriteLine( "The SortedList contains the following values:" ); - PrintIndexAndKeysAndValues( mySL ); - - // Searches for a specific key. - int myKey = 2; - Console::WriteLine( "The key \"{0}\" is {1}.", myKey, mySL->ContainsKey( myKey ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); - myKey = 6; - Console::WriteLine( "The key \"{0}\" is {1}.", myKey, mySL->ContainsKey( myKey ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); - - // Searches for a specific value. - String^ myValue = "three"; - Console::WriteLine( "The value \"{0}\" is {1}.", myValue, mySL->ContainsValue( myValue ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); - myValue = "nine"; - Console::WriteLine( "The value \"{0}\" is {1}.", myValue, mySL->ContainsValue( myValue ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); -} - -/* -This code produces the following output. - -The SortedList contains the following values: - -INDEX- -KEY- -VALUE- - [0]: 0 zero - [1]: 1 one - [2]: 2 two - [3]: 3 three - [4]: 4 four - -The key "2" is in the SortedList. -The key "6" is NOT in the SortedList. -The value "three" is in the SortedList. -The value "nine" is NOT in the SortedList. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp deleted file mode 100644 index 5bb708f958a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// -using namespace System; -using namespace System::Collections; -void PrintValues( array^ myArr, Char mySeparator ); -int main() -{ - - // Creates and initializes the source SortedList. - SortedList^ mySourceList = gcnew SortedList; - mySourceList->Add( 2, "cats" ); - mySourceList->Add( 3, "in" ); - mySourceList->Add( 1, "napping" ); - mySourceList->Add( 4, "the" ); - mySourceList->Add( 0, "three" ); - mySourceList->Add( 5, "barn" ); - - // Creates and initializes the one-dimensional target Array. - array^tempArray = {"The","quick","brown","fox","jumps","over","the","lazy","dog"}; - array^myTargetArray = gcnew array(15); - int i = 0; - IEnumerator^ myEnum = tempArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ s = safe_cast(myEnum->Current); - myTargetArray[ i ].Key = i; - myTargetArray[ i ].Value = s; - i++; - } - - - // Displays the values of the target Array. - Console::WriteLine( "The target Array contains the following (before and after copying):" ); - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source SortedList to the target SortedList, starting at index 6. - mySourceList->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); -} - -void PrintValues( array^ myArr, Char mySeparator ) -{ - for ( int i = 0; i < myArr->Length; i++ ) - Console::Write( "{0}{1}", mySeparator, myArr[ i ].Value ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -The target Array contains the following (before and after copying): - The quick brown fox jumps over the lazy dog - The quick brown fox jumps over three napping cats in the barn - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp deleted file mode 100644 index 987dd455be0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( 1.3, "fox" ); - mySL->Add( 1.4, "jumps" ); - mySL->Add( 1.5, "over" ); - mySL->Add( 1.2, "brown" ); - mySL->Add( 1.1, "quick" ); - mySL->Add( 1.0, "The" ); - mySL->Add( 1.6, "the" ); - mySL->Add( 1.8, "dog" ); - mySL->Add( 1.7, "lazy" ); - - // Gets the key and the value based on the index. - int myIndex = 3; - Console::WriteLine( "The key at index {0} is {1}.", myIndex, mySL->GetKey( myIndex ) ); - Console::WriteLine( "The value at index {0} is {1}.", myIndex, mySL->GetByIndex( myIndex ) ); - - // Gets the list of keys and the list of values. - IList^ myKeyList = mySL->GetKeyList(); - IList^ myValueList = mySL->GetValueList(); - - // Prints the keys in the first column and the values in the second column. - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < mySL->Count; i++ ) - Console::WriteLine( "\t{0}\t{1}", myKeyList[ i ], myValueList[ i ] ); -} - -/* -This code produces the following output. - -The key at index 3 is 1.3. -The value at index 3 is fox. - -KEY- -VALUE- - 1 The - 1.1 quick - 1.2 brown - 1.3 fox - 1.4 jumps - 1.5 over - 1.6 the - 1.7 lazy - 1.8 dog -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp deleted file mode 100644 index e9197a41dd1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void PrintIndexAndKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i, myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( 1, "one" ); - mySL->Add( 3, "three" ); - mySL->Add( 2, "two" ); - mySL->Add( 4, "four" ); - mySL->Add( 0, "zero" ); - - // Displays the values of the SortedList. - Console::WriteLine( "The SortedList contains the following values:" ); - PrintIndexAndKeysAndValues( mySL ); - - // Searches for a specific key. - int myKey = 2; - Console::WriteLine( "The key \"{0}\" is at index {1}.", myKey, mySL->IndexOfKey( myKey ) ); - - // Searches for a specific value. - String^ myValue = "three"; - Console::WriteLine( "The value \"{0}\" is at index {1}.", myValue, mySL->IndexOfValue( myValue ) ); -} - -/* -This code produces the following output. - -The SortedList contains the following values: - -INDEX- -KEY- -VALUE- - [0]: 0 zero - [1]: 1 one - [2]: 2 two - [3]: 3 three - [4]: 4 four - -The key "2" is at index 2. -The value "three" is at index 3. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp deleted file mode 100644 index 3808b907c27..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( 2, "two" ); - mySL->Add( 3, "three" ); - mySL->Add( 1, "one" ); - mySL->Add( (int^)0, "zero" ); - mySL->Add( 4, "four" ); - - // Creates a synchronized wrapper around the SortedList. - SortedList^ mySyncdSL = SortedList::Synchronized( mySL ); - - // Displays the sychronization status of both SortedLists. - Console::WriteLine( "mySL is {0}.", mySL->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); - Console::WriteLine( "mySyncdSL is {0}.", mySyncdSL->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); -} - -/* -This code produces the following output. - -mySL is not synchronized. -mySyncdSL is synchronized. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp deleted file mode 100644 index fb191eafec5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class SamplesSortedList -{ -public: - static void Main() - { - // - SortedList^ myCollection = gcnew SortedList(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesSortedList::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp deleted file mode 100644 index 86e30997f0a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp +++ /dev/null @@ -1,89 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void PrintKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( "3c", "dog" ); - mySL->Add( "2c", "over" ); - mySL->Add( "1c", "brown" ); - mySL->Add( "1a", "The" ); - mySL->Add( "1b", "quick" ); - mySL->Add( "3a", "the" ); - mySL->Add( "3b", "lazy" ); - mySL->Add( "2a", "fox" ); - mySL->Add( "2b", "jumps" ); - - // Displays the SortedList. - Console::WriteLine( "The SortedList initially contains the following:" ); - PrintKeysAndValues( mySL ); - - // Removes the element with the key "3b". - mySL->Remove( "3b" ); - - // Displays the current state of the SortedList. - Console::WriteLine( "After removing \"lazy\":" ); - PrintKeysAndValues( mySL ); - - // Removes the element at index 5. - mySL->RemoveAt( 5 ); - - // Displays the current state of the SortedList. - Console::WriteLine( "After removing the element at index 5:" ); - PrintKeysAndValues( mySL ); -} - -/* -This code produces the following output. - -The SortedList initially contains the following: - -KEY- -VALUE- - 1a: The - 1b: quick - 1c: brown - 2a: fox - 2b: jumps - 2c: over - 3a: the - 3b: lazy - 3c: dog - -After removing "lazy": - -KEY- -VALUE- - 1a: The - 1b: quick - 1c: brown - 2a: fox - 2b: jumps - 2c: over - 3a: the - 3c: dog - -After removing the element at index 5: - -KEY- -VALUE- - 1a: The - 1b: quick - 1c: brown - 2a: fox - 2b: jumps - 3a: the - 3c: dog -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp deleted file mode 100644 index 71da886cdc1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -void PrintIndexAndKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i, myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new SortedList. - SortedList^ mySL = gcnew SortedList; - mySL->Add( 2, "two" ); - mySL->Add( 3, "three" ); - mySL->Add( 1, "one" ); - mySL->Add( 0, "zero" ); - mySL->Add( 4, "four" ); - - // Displays the values of the SortedList. - Console::WriteLine( "The SortedList contains the following values:" ); - PrintIndexAndKeysAndValues( mySL ); - - // Replaces the values at index 3 and index 4. - mySL->SetByIndex( 3, "III" ); - mySL->SetByIndex( 4, "IV" ); - - // Displays the updated values of the SortedList. - Console::WriteLine( "After replacing the value at index 3 and index 4," ); - PrintIndexAndKeysAndValues( mySL ); -} - -/* -This code produces the following output. - -The SortedList contains the following values: - -INDEX- -KEY- -VALUE- - [0]: 0 zero - [1]: 1 one - [2]: 2 two - [3]: 3 three - [4]: 4 four - -After replacing the value at index 3 and index 4, - -INDEX- -KEY- -VALUE- - [0]: 0 zero - [1]: 1 one - [2]: 2 two - [3]: 3 III - [4]: 4 IV -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp deleted file mode 100644 index fd38bcf4520..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myCollection ); -int main() -{ - - // Creates and initializes a new Stack. - Stack^ myStack = gcnew Stack; - myStack->Push( "Hello" ); - myStack->Push( "World" ); - myStack->Push( "!" ); - - // Displays the properties and values of the Stack. - Console::WriteLine( "myStack" ); - Console::WriteLine( "\tCount: {0}", myStack->Count ); - Console::Write( "\tValues:" ); - PrintValues( myStack ); -} - -void PrintValues( IEnumerable^ myCollection ) -{ - IEnumerator^ myEnum = myCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - myStack - Count: 3 - Values: ! World Hello - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp deleted file mode 100644 index a60b6d00fde..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myCollection ); -int main() -{ - - // Creates and initializes a new Stack. - Stack^ myStack = gcnew Stack; - myStack->Push( "The" ); - myStack->Push( "quick" ); - myStack->Push( "brown" ); - myStack->Push( "fox" ); - myStack->Push( "jumps" ); - - // Displays the count and values of the Stack. - Console::WriteLine( "Initially," ); - Console::WriteLine( " Count : {0}", myStack->Count ); - Console::Write( " Values:" ); - PrintValues( myStack ); - - // Clears the Stack. - myStack->Clear(); - - // Displays the count and values of the Stack. - Console::WriteLine( "After Clear," ); - Console::WriteLine( " Count : {0}", myStack->Count ); - Console::Write( " Values:" ); - PrintValues( myStack ); -} - -void PrintValues( IEnumerable^ myCollection ) -{ - IEnumerator^ myEnum = myCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Initially, - Count : 5 - Values: jumps fox brown quick The - After Clear, - Count : 0 - Values: - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp deleted file mode 100644 index ae4b0f72df0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( Array^ myArr, char mySeparator ); -int main() -{ - // Creates and initializes the source Stack. - Stack^ mySourceQ = gcnew Stack; - mySourceQ->Push( "barn" ); - mySourceQ->Push( "the" ); - mySourceQ->Push( "in" ); - mySourceQ->Push( "cats" ); - mySourceQ->Push( "napping" ); - mySourceQ->Push( "three" ); - - // Creates and initializes the one-dimensional target Array. - Array^ myTargetArray = Array::CreateInstance( String::typeid, 15 ); - myTargetArray->SetValue( "The", 0 ); - myTargetArray->SetValue( "quick", 1 ); - myTargetArray->SetValue( "brown", 2 ); - myTargetArray->SetValue( "fox", 3 ); - myTargetArray->SetValue( "jumps", 4 ); - myTargetArray->SetValue( "over", 5 ); - myTargetArray->SetValue( "the", 6 ); - myTargetArray->SetValue( "lazy", 7 ); - myTargetArray->SetValue( "dog", 8 ); - - // Displays the values of the target Array. - Console::WriteLine( "The target Array contains the following (before and after copying):" ); - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source Stack to the target Array, starting at index 6. - mySourceQ->CopyTo( myTargetArray, 6 ); - - // Displays the values of the target Array. - PrintValues( myTargetArray, ' ' ); - - // Copies the entire source Stack to a new standard array. - array^myStandardArray = mySourceQ->ToArray(); - - // Displays the values of the new standard array. - Console::WriteLine( "The new standard array contains the following:" ); - PrintValues( myStandardArray, ' ' ); -} - -void PrintValues( Array^ myArr, char mySeparator ) -{ - IEnumerator^ myEnum = myArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ myObj = safe_cast(myEnum->Current); - Console::Write( "{0}{1}", mySeparator, myObj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - The target Array contains the following (before and after copying): - The quick brown fox jumps over the lazy dog - The quick brown fox jumps over three napping cats in the barn - The new standard array contains the following: - three napping cats in the barn - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp deleted file mode 100644 index 7b964e928e6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -int main() -{ - - // Creates and initializes a new Stack. - Stack^ myStack = gcnew Stack; - myStack->Push( "The" ); - myStack->Push( "quick" ); - myStack->Push( "brown" ); - myStack->Push( "fox" ); - - // Creates a synchronized wrapper around the Stack. - Stack^ mySyncdStack = Stack::Synchronized( myStack ); - - // Displays the sychronization status of both Stacks. - Console::WriteLine( "myStack is {0}.", myStack->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); - Console::WriteLine( "mySyncdStack is {0}.", mySyncdStack->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); -} - -/* -This code produces the following output. - -myStack is not synchronized. -mySyncdStack is synchronized. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp deleted file mode 100644 index d44a2d7b9a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class SamplesStack -{ -public: - static void Main() - { - // - Stack^ myCollection = gcnew Stack(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesStack::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp deleted file mode 100644 index 1e77a8f04a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -void PrintValues( IEnumerable^ myCollection, char mySeparator ); -int main() -{ - - // Creates and initializes a new Stack. - Stack^ myStack = gcnew Stack; - myStack->Push( "The" ); - myStack->Push( "quick" ); - myStack->Push( "brown" ); - myStack->Push( "fox" ); - - // Displays the Stack. - Console::Write( "Stack values:" ); - PrintValues( myStack, '\t' ); - - // Removes an element from the Stack. - Console::WriteLine( "(Pop)\t\t{0}", myStack->Pop() ); - - // Displays the Stack. - Console::Write( "Stack values:" ); - PrintValues( myStack, '\t' ); - - // Removes another element from the Stack. - Console::WriteLine( "(Pop)\t\t{0}", myStack->Pop() ); - - // Displays the Stack. - Console::Write( "Stack values:" ); - PrintValues( myStack, '\t' ); - - // Views the first element in the Stack but does not remove it. - Console::WriteLine( "(Peek)\t\t{0}", myStack->Peek() ); - - // Displays the Stack. - Console::Write( "Stack values:" ); - PrintValues( myStack, '\t' ); -} - -void PrintValues( IEnumerable^ myCollection, char mySeparator ) -{ - IEnumerator^ myEnum = myCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::Write( "{0}{1}", mySeparator, obj ); - } - - Console::WriteLine(); -} - -/* - This code produces the following output. - - Stack values: fox brown quick The - (Pop) fox - Stack values: brown quick The - (Pop) brown - Stack values: quick The - (Peek) quick - Stack values: quick The - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp deleted file mode 100644 index 63fd237a4c2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Write ); - if ( fs->CanRead && fs->CanWrite ) - { - Console::WriteLine( "MyFile.txt can be both written to and read from." ); - } - else - if ( fs->CanWrite ) - { - Console::WriteLine( "MyFile.txt is writable." ); - } -} - -//This code outputs "MyFile.txt is writable." -//To get the output message "MyFile.txt can be both written to and read from.", -//change the FileAccess parameter to ReadWrite in the FileStream constructor. -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp deleted file mode 100644 index e644fe2a10f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -public ref class Block -{ -public: - static void Main() - { - Stream^ s = gcnew MemoryStream(); - for (int i = 0; i < 100; i++) - { - s->WriteByte((Byte)i); - } - s->Position = 0; - - // Now read s into a byte buffer. - array^ bytes = gcnew array(s->Length); - int numBytesToRead = (int) s->Length; - int numBytesRead = 0; - while (numBytesToRead > 0) - { - // Read may return anything from 0 to 10. - int n = s->Read(bytes, numBytesRead, 10); - // The end of the file is reached. - if (n == 0) - { - break; - } - numBytesRead += n; - numBytesToRead -= n; - } - s->Close(); - // numBytesToRead should be 0 now, and numBytesRead should - // equal 100. - Console::WriteLine("number of bytes read: {0:d}", numBytesRead); - } -}; - -int main() -{ - Block::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp deleted file mode 100644 index 035727fe0c6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp +++ /dev/null @@ -1,13 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -int main() -{ - FileStream^ sb = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate ); - array^b = {'a','b','c','d','e','f','g','h','i','j','k','l','m'}; - StreamWriter^ sw = gcnew StreamWriter( sb ); - sw->Write( b, 3, 8 ); - sw->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp deleted file mode 100644 index 7c44cb174ba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#using - -using namespace System; - -ref class Sample -{ -private: - void Method() - { - // - String^ str = "BBQ and Slaw"; - Console::WriteLine( str->PadLeft( 15 ) ); // Displays " BBQ and Slaw". - Console::WriteLine( str->PadLeft( 5 ) ); // Displays "BBQ and Slaw". - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp deleted file mode 100644 index 4f65f5fcc67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#using - -// -using namespace System; - -void main() -{ - String^ str = "forty-two"; - Console::WriteLine( str->PadLeft( 15, L'.' ) ); - Console::WriteLine( str->PadLeft( 2, L'.' ) ); -} -// The example displays the following output: -// ......forty-two -// forty-two -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp deleted file mode 100644 index d313d14119e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using - -using namespace System; -ref class Sample -{ -private: - void Method() - { - - // - String^ str = "BBQ and Slaw"; - Console::Write( "|" ); - Console::Write( str->PadRight( 15 ) ); - Console::WriteLine( "|" ); // Displays "|BBQ and Slaw |". - Console::Write( "|" ); - Console::Write( str->PadRight( 5 ) ); - Console::WriteLine( "|" ); // Displays "|BBQ and Slaw|". - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp deleted file mode 100644 index 0786d97857d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#using - -using namespace System; -ref class Sample -{ -private: - void Method() - { - // - String^ str = "forty-two"; - Console::Write( "|" ); - Console::Write( str->PadRight( 15, '.' ) ); - Console::WriteLine( "|" ); // Displays "|forty-two......|". - Console::Write( "|" ); - Console::Write( str->PadRight( 5, '.' ) ); - Console::WriteLine( "|" ); // Displays "|forty-two|". - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp deleted file mode 100644 index cf774966a53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using - -using namespace System; -using namespace System::Diagnostics; - -public ref class SomeClass -{ -// -private: - static BooleanSwitch^ boolSwitch = gcnew BooleanSwitch("mySwitch", - "Switch in config file"); - -public: - static void Main( ) - { - //... - Console::WriteLine("Boolean switch {0} configured as {1}", - boolSwitch->DisplayName, ((Boolean^)boolSwitch->Enabled)->ToString()); - if (boolSwitch->Enabled) - { - //... - } - } -// -}; - -int main() -{ - SomeClass::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp deleted file mode 100644 index 35f255928a0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#using - -using namespace System; -using namespace System::Diagnostics; - -// -// The following are possible values for the new switch. -public enum class MethodTracingSwitchLevel -{ - Off = 0, - EnteringMethod = 1, - ExitingMethod = 2, - Both = 3 -}; - - -// -// -public ref class MyMethodTracingSwitch: public Switch -{ -protected: - bool outExit; - bool outEnter; - MethodTracingSwitchLevel level; - -public: - MyMethodTracingSwitch( String^ displayName, String^ description ) - : Switch( displayName, description ) - {} - - property MethodTracingSwitchLevel Level - { - MethodTracingSwitchLevel get() - { - return level; - } - - void set( MethodTracingSwitchLevel value ) - { - SetSwitchSetting( (int)value ); - } - } - -protected: - void SetSwitchSetting( int value ) - { - if ( value < 0 ) - { - value = 0; - } - - if ( value > 3 ) - { - value = 3; - } - - level = (MethodTracingSwitchLevel)value; - outEnter = false; - if ((value == (int)MethodTracingSwitchLevel::EnteringMethod) || - (value == (int)MethodTracingSwitchLevel::Both)) - { - outEnter = true; - } - - outExit = false; - if ((value == (int)MethodTracingSwitchLevel::ExitingMethod) || - (value == (int)MethodTracingSwitchLevel::Both)) - { - outExit = true; - } - } - -public: - property bool OutputExit - { - bool get() - { - return outExit; - } - } - - property bool OutputEnter - { - bool get() - { - return outEnter; - } - } -}; - - -// -// -public ref class Class1 -{ -private: - - /* Create an instance of MyMethodTracingSwitch.*/ - static MyMethodTracingSwitch^ mySwitch = - gcnew MyMethodTracingSwitch( "Methods","Trace entering and exiting method" ); - -public: - static void main() - { - // Add the console listener to see trace messages as console output - Trace::Listeners->Add(gcnew ConsoleTraceListener(true)); - Debug::AutoFlush = true; - - // Set the switch level to both enter and exit - mySwitch->Level = MethodTracingSwitchLevel::Both; - - // Write a diagnostic message if the switch is set to entering. - Debug::WriteLineIf(mySwitch->OutputEnter, "Entering Main"); - - // Insert code to handle processing here... - - // Write another diagnostic message if the switch is set to exiting. - Debug::WriteLineIf(mySwitch->OutputExit, "Exiting Main"); - } -}; -// - -int main() -{ - Class1::main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp deleted file mode 100644 index 830c7d9c618..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -// -void main() -{ - #if defined(TRACE) - // Create a file for output named TestFile.txt. - Stream^ myFile = File::Create( "TestFile.txt" ); - - // Create a new text writer using the output stream and - // add it to the trace listeners. - TextWriterTraceListener^ myTextListener = - gcnew TextWriterTraceListener( myFile ); - Trace::Listeners->Add( myTextListener ); - - // Write output to the file. - Trace::Write( "Test output " ); - - // Flush the output. - Trace::Flush(); - Trace::Close(); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp deleted file mode 100644 index e338a01270a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -#using -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -void main() -{ - #if defined(TRACE) - TextWriterTraceListener^ myTextListener = nullptr; - - // Create a file for output named TestFile.txt. - String^ myFileName = "TestFile.txt"; - StreamWriter^ myOutputWriter = gcnew StreamWriter( myFileName,true ); - - // Add a TextWriterTraceListener for the file. - if ( myOutputWriter ) - { - myTextListener = gcnew TextWriterTraceListener( myOutputWriter ); - Trace::Listeners->Add( myTextListener ); - } - - // Write trace output to all trace listeners. - Trace::WriteLine( - String::Concat( DateTime::Now.ToString(), " - Trace output" ) ); - if ( myTextListener ) - { - // Remove and close the file writer/trace listener. - myTextListener->Flush(); - Trace::Listeners->Remove( myTextListener ); - myTextListener->Close(); - } - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp deleted file mode 100644 index a8af3ae4585..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -// -void main() -{ - #if defined(TRACE) - // Create a text writer that writes to the console screen and add - // it to the trace listeners. - TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; - myWriter->Writer = System::Console::Out; - Trace::Listeners->Add( myWriter ); - - // Write the output to the console screen. - myWriter->Write( "Write to console screen. " ); - myWriter->WriteLine( "Again, write to the Console screen." ); - - // Flush and close the output. - myWriter->Flush(); - myWriter->Close(); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp deleted file mode 100644 index 17598cbac6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -// -void main() -{ - #if defined(TRACE) - // Create a text writer that writes to the console screen and add - // it to the trace listeners. - TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; - myWriter->Writer = System::Console::Out; - Trace::Listeners->Add( myWriter ); - - // Write the output to the console screen. - myWriter->Write( "Write to the Console screen. " ); - myWriter->WriteLine( "Again, write to console screen." ); - - // Flush and close the output. - myWriter->Flush(); - myWriter->Close(); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp deleted file mode 100644 index aed5e7442ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Sample -{ -protected: - void Method() - { - // - #if defined(TRACE) - TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; - myWriter->Writer = System::Console::Out; - Trace::Listeners->Add( myWriter ); - #endif - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp deleted file mode 100644 index df797ae34f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// Use this code inside a project created with the Visual C++ > CLR > CLR Console Application template. -// Replace the code in the default .cpp file with this code. - -#include "stdafx.h" -#using - -using namespace System; - -// To avoid confusion with other Timer classes, this sample always uses the fully-qualified -// name of System::Timers::Timer instead of a using statement for System::Timer. - -public ref class Example -{ -private: - static System::Timers::Timer^ aTimer; - -public: - static void Demo() - { - // Normally, the timer is declared at the class level, so that it stays in scope as long as it - // is needed. If the timer is declared in a long-running method, KeepAlive must be used to prevent - // the JIT compiler from allowing aggressive garbage collection to occur before the method ends. - // You can experiment with this by commenting out the class-level declaration and uncommenting - // the declaration below; then uncomment the GC.KeepAlive(aTimer) at the end of the method. - //System::Timers::Timer^ aTimer; - - // Create a timer and set a two second interval. - aTimer = gcnew System::Timers::Timer(); - aTimer->Interval = 2000; - - // Alternate method: create a Timer with an interval argument to the constructor. - //aTimer = gcnew System::Timers::Timer(2000); - - // Hook up the Elapsed event for the timer. - aTimer->Elapsed += gcnew System::Timers::ElapsedEventHandler(Example::OnTimedEvent); - - // Have the timer fire repeated events (true is the default) - aTimer->AutoReset = true; - - // Start the timer - aTimer->Enabled = true; - - Console::WriteLine("Press the Enter key to exit the program at any time... "); - Console::ReadLine(); - - // If the timer is declared in a long-running method, use KeepAlive to prevent garbage collection - // from occurring before the method ends. - //GC::KeepAlive(aTimer); - } - -private: - static void OnTimedEvent(Object^ source, System::Timers::ElapsedEventArgs^ e) - { - Console::WriteLine("The Elapsed event was raised at {0}", e->SignalTime); - } - -}; - -int main() -{ - Example::Demo(); -} - -// This example displays output like the following: -// Press the Enter key to exit the program at any time... -// The Elapsed event was raised at 5/20/2015 8:48:58 PM -// The Elapsed event was raised at 5/20/2015 8:49:00 PM -// The Elapsed event was raised at 5/20/2015 8:49:02 PM -// The Elapsed event was raised at 5/20/2015 8:49:04 PM -// The Elapsed event was raised at 5/20/2015 8:49:06 PM - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp deleted file mode 100644 index 6f843e8ba21..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Timers; - -public ref class Timer2 -{ -private: - static System::Timers::Timer^ aTimer; - -public: - static void Main() - { - // Create a new Timer with Interval set to 1.5 seconds. - double interval = 1500.0; - aTimer = gcnew System::Timers::Timer(interval); - - // Hook up the event handler for the Elapsed event. - aTimer->Elapsed += gcnew ElapsedEventHandler( OnTimedEvent ); - - // Only raise the event the first time Interval elapses. - aTimer->AutoReset = false; - aTimer->Enabled = true; - - // Ensure the event fires before the exit message appears. - System::Threading::Thread::Sleep((int) interval * 2); - Console::WriteLine("Press the Enter key to exit the program."); - Console::ReadLine(); - - // If the timer is declared in a long-running method, use - // KeepAlive to prevent garbage collection from occurring - // before the method ends. - //GC::KeepAlive(aTimer); - } - -private: - // Handle the Elapsed event. - static void OnTimedEvent( Object^ /*source*/, ElapsedEventArgs^ /*e*/ ) - { - Console::WriteLine( "Hello World!" ); - } - -}; - -int main() -{ - Timer2::Main(); -} -// The example displays the following output: -// Hello World! -// Press the Enter key to exit the program. -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp deleted file mode 100644 index bfaeea7c89b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -// Specify /DTRACE when compiling. - -#using -using namespace System; -using namespace System::Diagnostics; - -int main() -{ - #if defined(TRACE) - Trace::Listeners->Add( gcnew TextWriterTraceListener( Console::Out ) ); - Trace::AutoFlush = true; - Trace::Indent(); - Trace::WriteLine( "Entering Main" ); - #endif - Console::WriteLine( "Hello World." ); - #if defined(TRACE) - Trace::WriteLine( "Exiting Main" ); - Trace::Unindent(); - #endif - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp deleted file mode 100644 index bf1accda6fd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -protected: - // Create an index for an array. - int index; - - void Method() - { - // Perform some action that sets the index. - // Test that the index value is valid. - #if defined(TRACE) - Trace::Assert( index > -1 ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp deleted file mode 100644 index b8c99bf228b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - static void MyMethod( Type^ type, Type^ baseType ) - { - #if defined(TRACE) - Trace::Assert( type != nullptr, "Type parameter is null" ); - #endif - - // Perform some processing. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp deleted file mode 100644 index 862da8804df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - static void MyMethod( Type^ type, Type^ baseType ) - { - #if defined(TRACE) - Trace::Assert( type != nullptr, "Type parameter is null", "Can't get object for null type" ); - #endif - - // Perform some processing. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp deleted file mode 100644 index 7f8c353e0c2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - enum class Option - { - First, Second - }; - -protected: - double result; - -public: - void Method( Option option ) - { - try - { - // try something here - } - // - catch ( Exception^ ) - { - #if defined(TRACE) - Trace::Fail( "Unknown Option " + option + ", using the default." ); - #endif - } - // - - // - switch ( option ) - { - case Option::First: - result = 1.0; - break; - - // Insert additional cases. - - default: - #if defined(TRACE) - Trace::Fail(String::Format("Unknown Option {0}", option)); - #endif - result = 1.0; - break; - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp deleted file mode 100644 index 377a4428493..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - enum class Option - { - First, Second - }; - -protected: - double result; - -public: - void Method( Option option, String^ userInput ) - { - int value = 0; - int newValue = 1; - try - { - value = Int32::Parse( userInput ); - } - // - catch ( Exception^ ) - { - #if defined(TRACE) - Trace::Fail( String::Format( "Invalid value: {0}", value ), - "Resetting value to newValue." ); - #endif - value = newValue; - } - // - - // - switch ( option ) - { - case Option::First: - result = 1.0; - break; - - // Insert additional cases. - - default: - #if defined(TRACE) - Trace::Fail( String::Format( "Unsupported option {0}", option ), - "Result set to 1.0" ); - #endif - result = 1.0; - break; - } - // - } - -}; - -void main() -{ - Form1^ myForm = gcnew Form1; - myForm->Method( Form1::Option::Second, "not an integer string" ); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp deleted file mode 100644 index 00e2126d795..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -// Specify /DTRACE when compiling. - -#using -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - -void main() -{ - #if defined(TRACE) - // Create a file for output named TestFile.txt. - FileStream^ myFileStream = - gcnew FileStream( "TestFile.txt", FileMode::Append ); - - // Create a new text writer using the output stream - // and add it to the trace listeners. - TextWriterTraceListener^ myTextListener = - gcnew TextWriterTraceListener( myFileStream ); - Trace::Listeners->Add( myTextListener ); - - // Write output to the file. - Trace::WriteLine( "Test output" ); - - // Flush and close the output stream. - Trace::Flush(); - Trace::Close(); - #endif -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp deleted file mode 100644 index 8465839ad87..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - // - Trace::WriteLine( "List of errors:" ); - Trace::Indent(); - Trace::WriteLine( "Error 1: File not found" ); - Trace::WriteLine( "Error 2: Directory not found" ); - Trace::Unindent(); - Trace::WriteLine( "End of list of errors" ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp deleted file mode 100644 index aaba2c756c3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Class1 -{ -public: - void Method() - { - // - // Create a ConsoletTraceListener and add it to the trace listeners. - #if defined(TRACE) - ConsoleTraceListener^ myWriter = gcnew ConsoleTraceListener( ); - Trace::Listeners->Add( myWriter ); - #endif - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp deleted file mode 100644 index b5c173d444f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod() - { - // Write the message if the TraceSwitch level is set - // to Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::Write( "My error message. " ); - } - - // Write a second message if the TraceSwitch level is set - // to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::WriteLine( "My second error message." ); - } - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp deleted file mode 100644 index 6aa428982f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level - // is set to Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::Write( myObject ); - } - - // Write a second message if the TraceSwitch level - // is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::WriteLine( " is not a valid value for this method." ); - } - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp deleted file mode 100644 index c37eb6cb2bd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::Write( String::Concat( myObject, - " is not a valid object for category: " ), category ); - } - - // Write a second message if the TraceSwitch level is set to - // Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::WriteLine( " Please use a different category." ); - } - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp deleted file mode 100644 index 815cd36e34c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::Write( myObject, category ); - } - - // Write a second message if the TraceSwitch level is set to - // Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::WriteLine( " Object is not valid for this category." ); - } - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp deleted file mode 100644 index 49f4eaff259..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod() - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set to - // Error or higher. - Trace::WriteIf( generalSwitch->TraceError, "My error message. " ); - - // Write a second message if the TraceSwitch level is set - // to Verbose. - Trace::WriteLineIf( generalSwitch->TraceVerbose, - "My second error message." ); - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp deleted file mode 100644 index 14dfd2e3487..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set - // to Error or higher. - Trace::WriteIf( generalSwitch->TraceError, myObject ); - - // Write a second message if the TraceSwitch level is set - // to Verbose. - Trace::WriteLineIf( generalSwitch->TraceVerbose, - " is not a valid value for this method." ); - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp deleted file mode 100644 index fa99d333ccc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set to Verbose. - Trace::WriteIf( generalSwitch->TraceVerbose, - String::Concat( myObject, - " is not a valid object for category: " ), category ); - - // Write a second message if the TraceSwitch level is set - // to Error or higher. - Trace::WriteLineIf( generalSwitch->TraceError, - " Please use a different category." ); - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp deleted file mode 100644 index 7b433a3415c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set to Verbose. - Trace::WriteIf( generalSwitch->TraceVerbose, myObject, category ); - - // Write a second message if the TraceSwitch level is set to - // Error or higher. - Trace::WriteLineIf( generalSwitch->TraceError, - " Object is not valid for this category." ); - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp deleted file mode 100644 index 69e7837f9bd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level - // is set to Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::Write( "Invalid object. " ); - } - - // Write a second message if the TraceSwitch level - // is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::WriteLine( myObject ); - } - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp deleted file mode 100644 index 408ce11e5e2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level - // is set to Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::Write( "My error message. " ); - } - - // Write a second message if the TraceSwitch level - // is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::WriteLine( "My second error message.", category ); - } - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp deleted file mode 100644 index 9b663621991..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level - // is set to Error or higher. - if ( generalSwitch->TraceError ) - { - Trace::Write( "Invalid object for category. " ); - } - - // Write a second message if the TraceSwitch level - // is set to Verbose. - if ( generalSwitch->TraceVerbose ) - { - Trace::WriteLine( myObject, category ); - } - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp deleted file mode 100644 index e0248f58cc3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level - // is set to Error or higher. - Trace::WriteIf( generalSwitch->TraceError, "Invalid object. " ); - - // Write a second message if the TraceSwitch level is set - // to Verbose. - Trace::WriteLineIf( generalSwitch->TraceVerbose, myObject ); - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp deleted file mode 100644 index f0ced96de43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set - // to Error or higher. - Trace::WriteIf( generalSwitch->TraceError, "My error message. " ); - - // Write a second message if the TraceSwitch level is set - // to Verbose. - Trace::WriteLineIf( generalSwitch->TraceVerbose, - "My second error message.", category ); - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp deleted file mode 100644 index 3b1d19efcba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -using namespace System; -using namespace System::Diagnostics; - -public ref class Test -{ -// -// Class-level declaration. -// Create a TraceSwitch. -private: - static TraceSwitch^ generalSwitch = - gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyErrorMethod( Object^ myObject, String^ category ) - { - #if defined(TRACE) - // Write the message if the TraceSwitch level is set - // to Error or higher. - Trace::WriteIf( generalSwitch->TraceError, - "Invalid object for category. " ); - - // Write a second message if the TraceSwitch level is set - // to Verbose. - Trace::WriteLineIf( generalSwitch->TraceVerbose, - myObject, category ); - #endif - } -// -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp deleted file mode 100644 index 0839abd6837..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - // - /* Create a listener, which outputs to the console screen, and - * add it to the trace listeners. */ - TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; - myWriter->Writer = System::Console::Out; - Trace::Listeners->Add( myWriter ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp deleted file mode 100644 index f2af2f1ef67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // - // Class-level declaration. - /* Create a TraceSwitch to use in the entire application.*/ -private: - static TraceSwitch^ mySwitch = gcnew TraceSwitch( "mySwitch","Entire Application" ); - -public: - static void MyMethod() - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( mySwitch->TraceError ) - Console::WriteLine( "My error message." ); - - // Write the message if the TraceSwitch level is set to Verbose. - if ( mySwitch->TraceVerbose ) - Console::WriteLine( "My second error message." ); - } - - static void main() - { - // Run the method that prints error messages based on the switch level. - MyMethod(); - } - // -}; - -int main() -{ - Form1::main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp deleted file mode 100644 index 1c6a7b5ea20..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; - -public ref class TraceErr -{ -// -private: - static TraceSwitch^ appSwitch = gcnew TraceSwitch("mySwitch", - "Switch in config file"); - -public: - static void Main(array^ args) - { - //... - Console::WriteLine("Trace switch {0} configured as {1}", - appSwitch->DisplayName, appSwitch->Level.ToString()); - if (appSwitch->TraceError) - { - //... - } - } -// -}; - -int main() -{ - array^ args = gcnew array{}; - TraceErr::Main(args); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp deleted file mode 100644 index 7806bc0fb37..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // - // Class-level declaration. - /* Create a TraceSwitch to use in the entire application.*/ -private: - static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyMethod() - { - // Write the message if the TraceSwitch level is set to Error or higher. - if ( mySwitch->TraceError ) - Console::WriteLine( "My error message." ); - - // Write the message if the TraceSwitch level is set to Verbose. - if ( mySwitch->TraceVerbose ) - Console::WriteLine( "My second error message." ); - } - - static void main() - { - // Run the method that prints error messages based on the switch level. - MyMethod(); - } - // -}; - -int main() -{ - Form1::main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp deleted file mode 100644 index b3d9962e4cc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // - // Class-level declaration. - /* Create a TraceSwitch to use in the entire application.*/ -private: - static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyMethod() - { - // Write the message if the TraceSwitch level is set to Info or higher. - if ( mySwitch->TraceInfo ) - Console::WriteLine( "My error message." ); - - // Write the message if the TraceSwitch level is set to Verbose. - if ( mySwitch->TraceVerbose ) - Console::WriteLine( "My second error message." ); - } - - static void main() - { - // Run the method that prints error messages based on the switch level. - MyMethod(); - } - // -}; - -int main() -{ - Form1::main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp deleted file mode 100644 index 9135da63a48..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // - // Class-level declaration. - /* Create a TraceSwitch to use in the entire application.*/ -private: - static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" ); - -public: - static void MyMethod() - { - // Write the message if the TraceSwitch level is set to Warning or higher. - if ( mySwitch->TraceWarning ) - Console::WriteLine( "My error message." ); - - // Write the message if the TraceSwitch level is set to Verbose. - if ( mySwitch->TraceVerbose ) - Console::WriteLine( "My second error message." ); - } - - static void main() - { - // Run the method that prints error messages based on the switch level. - MyMethod(); - } - // -}; - -int main() -{ - Form1::main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp deleted file mode 100644 index ade13e662f9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TreeView^ treeView1; - TreeNode^ mySelectedNode; - - // - /* Get the tree node under the mouse pointer and - save it in the mySelectedNode variable. */ -private: - void treeView1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - mySelectedNode = treeView1->GetNodeAt( e->X, e->Y ); - } - - void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( mySelectedNode != nullptr && mySelectedNode->Parent != nullptr ) - { - treeView1->SelectedNode = mySelectedNode; - treeView1->LabelEdit = true; - if ( !mySelectedNode->IsEditing ) - { - mySelectedNode->BeginEdit(); - } - } - else - { - MessageBox::Show( String::Concat( "No tree node selected or selected node is a root node.\n", - "Editing of root nodes is not allowed." ), "Invalid selection" ); - } - } - - void treeView1_AfterLabelEdit( Object^ /*sender*/, - System::Windows::Forms::NodeLabelEditEventArgs^ e ) - { - if ( e->Label != nullptr ) - { - if ( e->Label->Length > 0 ) - { - array^ temp0 = {'@','.',',','!'}; - if ( e->Label->IndexOfAny( temp0 ) == -1 ) - { - - // Stop editing without canceling the label change. - e->Node->EndEdit( false ); - } - else - { - /* Cancel the label edit action, inform the user, and - place the node in edit mode again. */ - e->CancelEdit = true; - MessageBox::Show( String::Concat( "Invalid tree node label.\n", - "The invalid characters are: '@','.', ',', '!'" ), - "Node Label Edit" ); - e->Node->BeginEdit(); - } - } - else - { - /* Cancel the label edit action, inform the user, and - place the node in edit mode again. */ - e->CancelEdit = true; - MessageBox::Show( "Invalid tree node label.\nThe label cannot be blank", - "Node Label Edit" ); - e->Node->BeginEdit(); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp deleted file mode 100644 index 16e8d85658e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class dtype abstract -{ -public: - ref class MyClassA abstract - { - public: - virtual int m() = 0; - }; - - ref class MyClassB abstract: public MyClassA{}; -}; - -int main() -{ - Console::WriteLine( "The declaring type of m is {0}.", dtype::MyClassB::typeid->GetMethod( "m" )->DeclaringType ); -} -/* The example produces the following output: - -The declaring type of m is dtype+MyClassA. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp deleted file mode 100644 index ee3ada47aea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -using namespace System; -using namespace System::IO; -using namespace System::Reflection; - -public ref class Sample -{ -public: - void Method( Type^ type ) - { - ConstructorInfo^ cInfo; - - // - cInfo = type->GetConstructor( BindingFlags::ExactBinding, nullptr, - Type::EmptyTypes, nullptr ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp deleted file mode 100644 index eaae896f09f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -using namespace System; -using namespace System::Reflection; - -// Class added so sample will compile -public ref class Application -{ -public: - void Method(){} -}; - -public ref class Sample -{ -public: - void Method() - { - // - // Get the set of methods associated with the type - array^ mi = Application::typeid->FindMembers( - (MemberTypes)(MemberTypes::Constructor | MemberTypes::Method), - (BindingFlags)(BindingFlags::Public | BindingFlags::Static | - BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly), - Type::FilterName, "*" ); - Console::WriteLine( "Number of methods (includes constructors): {0}", mi->Length ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp deleted file mode 100644 index 4c9e6c12c06..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class t -{ -public: - t(){} - - static t(){} - - t( int /*i*/ ){} - -}; - -int main() -{ - array^p = t::typeid->GetConstructors(); - Console::WriteLine( p->Length ); - for ( int i = 0; i < p->Length; i++ ) - { - Console::WriteLine( p[ i ]->IsStatic ); - - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp deleted file mode 100644 index 881b9216d30..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -public ref class t -{ -public: - t(){} - - t( int /*i*/ ){} - - static t(){} - -}; - -int main() -{ - array^p = t::typeid->GetConstructors( static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::NonPublic | BindingFlags::Instance) ); - Console::WriteLine( p->Length ); - for ( int i = 0; i < p->Length; i++ ) - { - Console::WriteLine( p[ i ]->IsStatic ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp deleted file mode 100644 index f0af5fbd409..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; - -int main() -{ - //Get the Type and MemberInfo. - Type^ t = Type::GetType("System.IO.File"); - array^ members = t->GetMembers(); - - //Get and display the DeclaringType method. - Console::WriteLine("There are {0} members in {1}.", - members->Length, t->FullName ); - Console::WriteLine("Is {0} non-public? {1}", - t->FullName, t->IsNotPublic ); -} -// The example displays the following output: -// There are 60 members in System.IO.File. -// Is System.IO.File non-public? False -// - -// -public ref class A -{ -public: - ref class B{}; - - -private: - ref class C{}; - - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp deleted file mode 100644 index 47d546e7a06..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; -using namespace System::Text; -public ref class Sample -{ -protected: - bool ShowMethods; - StreamWriter^ myWriter; - -private: - void DumpMethods( Type^ aType ) - { - if ( !ShowMethods ) - return; - - array^mInfo = aType->GetMethods(); - myWriter->WriteLine( "Methods" ); - bool found = false; - if ( mInfo->Length != 0 ) - { - for ( int i = 0; i < mInfo->Length; i++ ) - { - - // Only display methods declared in this type. Also - // filter out any methods with special names, because these - // cannot be generally called by the user. That is, their - // functionality is usually exposed in other ways, for example, - // property get/set methods are exposed as properties. - if ( mInfo[ i ]->DeclaringType == aType && !mInfo[ i ]->IsSpecialName ) - { - found = true; - StringBuilder^ modifiers = gcnew StringBuilder; - if ( mInfo[ i ]->IsStatic ) - { - modifiers->Append( "static " ); - } - if ( mInfo[ i ]->IsPublic ) - { - modifiers->Append( "public " ); - } - if ( mInfo[ i ]->IsFamily ) - { - modifiers->Append( "protected " ); - } - if ( mInfo[ i ]->IsAssembly ) - { - modifiers->Append( "internal " ); - } - if ( mInfo[ i ]->IsPrivate ) - { - modifiers->Append( "private " ); - } - myWriter->WriteLine( "{0} {1}", modifiers, mInfo[ i ] ); - } - - } - } - - if ( !found ) - { - myWriter->WriteLine( "(none)" ); - } - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp deleted file mode 100644 index 5f55897e971..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ -using namespace System; -using namespace System::Reflection; - -public ref class Sample -{ -public: - void Method( Type^ t, MemberInfo^ mi ) - { - // - array^ others = t->GetMember( mi->Name, mi->MemberType, - (BindingFlags)(BindingFlags::Public | BindingFlags::Static | - BindingFlags::NonPublic | BindingFlags::Instance) ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp deleted file mode 100644 index be2838788b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::CodeDom::Compiler; - -ref class Example -{ -public: - static void Main() - { - // VB source for example. Not all versions of CS and CPP compilers - // support optional arguments. - String^ codeLines = - "Imports System\n\n" + - "Public Class OptionalArg\n" + - " Public Sub MyMethod(ByVal a As Integer, _\n" + - " Optional ByVal b As Double = 1.2, _\n" + - " Optional ByVal c As Integer = 1)\n\n" + - " Console.WriteLine(\"a = \" & a & \" b = \" & b & \" c = \" & c)\n" + - " End Sub\n" + - "End Class\n"; - - // Generate a OptionalArg instance from the source above. - Object^ o = GenerateObjectFromSource("OptionalArg", codeLines, "VisualBasic"); - Type^ t; - - t = o->GetType(); - BindingFlags bf = BindingFlags::Public | BindingFlags::Instance | - BindingFlags::InvokeMethod | BindingFlags::OptionalParamBinding; - - t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, 55.3, 12}); - t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, 1.3, Type::Missing}); - t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, Type::Missing, Type::Missing}); - } - -private: - static Object^ GenerateObjectFromSource(String^ objectName, - String^ sourceLines, String^ providerName) - { - Object^ genObject = nullptr; - CodeDomProvider^ codeProvider = CodeDomProvider::CreateProvider(providerName); - CompilerParameters^ cp = gcnew CompilerParameters(); - - cp->GenerateExecutable = false; - cp->GenerateInMemory = true; - - CompilerResults^ results = - codeProvider->CompileAssemblyFromSource(cp, sourceLines); - if (results->Errors->Count == 0) - { - genObject = results->CompiledAssembly->CreateInstance(objectName); - } - - return genObject; - } -}; - -int main() -{ - Example::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp deleted file mode 100644 index e40dfeced46..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -public ref class MyClassA abstract -{ -public: - ref class MyClassB abstract - { - - }; - -}; - -int main() -{ - Console::WriteLine( "Reflected type of MyClassB is {0}", MyClassA::MyClassB::typeid->ReflectedType ); - //Outputs MyClassA, the enclosing type. -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp deleted file mode 100644 index 154b58c3fd2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method( IntPtr userToken ) - { - // - WindowsImpersonationContext^ ImpersonationCtx = WindowsIdentity::Impersonate( userToken ); - - //Do something under the context of the impersonated user. - - ImpersonationCtx->Undo(); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp deleted file mode 100644 index 6a7fa3ba07b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method() - { - // - WindowsPrincipal^ wp = gcnew WindowsPrincipal( WindowsIdentity::GetCurrent() ); - String^ username = wp->Identity->Name; - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp deleted file mode 100644 index 58a56176dfb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method() - { - // - WindowsIdentity^ wi = WindowsIdentity::GetCurrent(); - WindowsPrincipal^ wp = gcnew WindowsPrincipal( wi ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp deleted file mode 100644 index 5b668e808cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp +++ /dev/null @@ -1,317 +0,0 @@ -using namespace System; -using namespace System::IO; - -ref class Coder -{ -private: - String^ inputFileName; - String^ outputFileName; - -public: - Coder( String^ inFile, String^ outFile ) - { - inputFileName = (String^)(inFile->Clone()); - outputFileName = (String^)(outFile->Clone()); - } - - // -public: - void EncodeWithString() - { - FileStream^ inFile; - array^ binaryData; - - try - { - inFile = gcnew FileStream( inputFileName, - FileMode::Open, - FileAccess::Read ); - binaryData = gcnew array((int)(inFile->Length)); - long bytesRead = inFile->Read( binaryData, 0, - (int)inFile->Length ); - inFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or reading from it. - Console::WriteLine( " {0}", exp->Message ); - return; - } - - // Convert the binary input into Base64 UUEncoded output. - String^ base64String; - try - { - base64String = Convert::ToBase64String( binaryData, - 0, - binaryData->Length ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Binary data array is null." ); - return; - } - - // Write the UUEncoded version to the output file. - StreamWriter^ outFile; - try - { - outFile = gcnew StreamWriter( outputFileName, - false, - Text::Encoding::ASCII ); - outFile->Write( base64String ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - - // Error creating stream or writing to it. - Console::WriteLine( " {0}", exp->Message ); - } - } - // - - // -public: - void EncodeWithCharArray() - { - FileStream^ inFile; - array^binaryData; - - try - { - inFile = gcnew FileStream( inputFileName, - FileMode::Open, - FileAccess::Read ); - binaryData = gcnew array((int)(inFile->Length)); - long bytesRead = inFile->Read( binaryData, 0, - (int)inFile->Length ); - inFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or reading from it. - Console::WriteLine( "{0}", exp->Message ); - return; - } - - // Convert the binary input into Base64 UUEncoded output. - // Each 3 Byte sequence in the source data becomes a 4 Byte - // sequence in the character array. - long arrayLength = (long)((4.0 / 3.0) * binaryData->Length); - - // If array length is not divisible by 4, go up to the next - // multiple of 4. - if ( arrayLength % 4 != 0 ) - { - arrayLength += 4 - arrayLength % 4; - } - - array^ base64CharArray = gcnew array(arrayLength); - try - { - Convert::ToBase64CharArray( binaryData, - 0, - binaryData->Length, - base64CharArray, 0 ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Binary data array is null." ); - return; - } - catch ( ArgumentOutOfRangeException^ ) - { - Console::WriteLine( "Char Array is not large enough." ); - return; - } - - // Write the UUEncoded version to the output file. - StreamWriter^ outFile; - try - { - outFile = gcnew StreamWriter( outputFileName, - false, - Text::Encoding::ASCII ); - outFile->Write( base64CharArray ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or writing to it. - Console::WriteLine( " {0}", exp->Message ); - } - } - // - - // -public: - void DecodeWithCharArray() - { - StreamReader^ inFile; - array^base64CharArray; - try - { - inFile = gcnew StreamReader( inputFileName, - Text::Encoding::ASCII ); - base64CharArray = gcnew array((int)(inFile->BaseStream->Length)); - inFile->Read( base64CharArray, 0, (int)inFile->BaseStream->Length ); - inFile->Close(); - } - catch ( Exception^ exp ) - { - - // Error creating stream or reading from it. - Console::WriteLine( "{0}", exp->Message ); - return; - } - - // Convert the Base64 UUEncoded input into binary output. - array^binaryData; - try - { - binaryData = Convert::FromBase64CharArray( base64CharArray, - 0, - base64CharArray->Length ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Base 64 character array is null." ); - return; - } - catch ( FormatException^ ) - { - Console::WriteLine( "Base 64 Char Array length is not " + - "4 or is not an even multiple of 4." ); - return; - } - - // Write out the decoded data. - FileStream^ outFile; - try - { - outFile = gcnew FileStream( outputFileName, - FileMode::Create, - FileAccess::Write ); - outFile->Write( binaryData, 0, binaryData->Length ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or writing to it. - Console::WriteLine( "{0}", exp->Message ); - } - } - // - - // -public: - void DecodeWithString() - { - StreamReader^ inFile; - String^ base64String; - try - { - array^base64CharArray; - inFile = gcnew StreamReader( inputFileName, - Text::Encoding::ASCII ); - base64CharArray = gcnew array((int)(inFile->BaseStream->Length)); - inFile->Read( base64CharArray, 0, (int)inFile->BaseStream->Length ); - base64String = gcnew String( base64CharArray ); - } - catch ( Exception^ exp ) - { - // Error creating stream or reading from it. - Console::WriteLine( "{0}", exp->Message ); - return; - } - - // Convert the Base64 UUEncoded input into binary output. - array^binaryData; - try - { - binaryData = Convert::FromBase64String( base64String ); - } - catch ( ArgumentNullException^ ) - { - Console::WriteLine( "Base 64 String^ is null." ); - return; - } - catch ( FormatException^ ) - { - Console::WriteLine( "Base 64 String^ length is not " + - "4 or is not an even multiple of 4." ); - return; - } - - // Write out the decoded data. - FileStream^ outFile; - try - { - outFile = gcnew FileStream( outputFileName, - FileMode::Create, - FileAccess::Write ); - outFile->Write( binaryData, 0, binaryData->Length ); - outFile->Close(); - } - catch ( Exception^ exp ) - { - // Error creating stream or writing to it. - Console::WriteLine( "{0}", exp->Message ); - } - } - // -}; - -void main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length != 5 ) - { - Console::WriteLine( "Usage: UUCodeC -d | -e " + - "-s | -c inputFile outputFile" ); - return; - } - - String^ inputFileName = args[ 3 ]; - String^ outputFileName = args[ 4 ]; - Coder^ coder = gcnew Coder( inputFileName,outputFileName ); - - if ( args[ 1 ] == "-d" ) - { - if ( args[ 2 ] == "-s" ) - { - coder->DecodeWithString(); - } - else if ( args[ 2 ] == "-c" ) - { - coder->DecodeWithCharArray(); - } - else - { - Console::WriteLine( "Second arg must be -s or -c" ); - return; - } - } - else - if ( args[ 1 ] == "-e" ) - { - if ( args[ 2 ] == "-s" ) - { - coder->EncodeWithString(); - } - else if ( args[ 2 ] == "-c" ) - { - coder->EncodeWithCharArray(); - } - else - { - Console::WriteLine( "Second arg must be -s or -c" ); - return; - } - } - else - { - Console::WriteLine( "First arg must be -d or -e" ); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp deleted file mode 100644 index a03e6c881a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of Char values. - array^ values = { L'\0', L' ', L'*', L'A', L'a', - L'{', L'Æ' }; - - // Convert each Char value to a Decimal. - for each (wchar_t value in values) { - Decimal decValue = value; - Console::WriteLine("'{0}' ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// This example displays the following output: -// ' ' (Decimal) --> 0 (Decimal) -// ' ' (Decimal) --> 32 (Decimal) -// '*' (Decimal) --> 42 (Decimal) -// 'A' (Decimal) --> 65 (Decimal) -// 'a' (Decimal) --> 97 (Decimal) -// '{' (Decimal) --> 123 (Decimal) -// 'A' (Decimal) --> 195 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp deleted file mode 100644 index f923cdfb25d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example of the explicit conversion from double to Decimal. -using namespace System; -#define formatter "{0,25:E16}{1,33}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the double argument; catch exceptions that are thrown. -void DecimalFromDouble( double argument ) -{ - Object^ decValue; - - // Convert the double argument to a Decimal value. - try - { - decValue = (Decimal)argument; - } - catch ( Exception^ ex ) - { - decValue = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, decValue ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversion from double " - "to Decimal \ngenerates the following output.\n" ); - Console::WriteLine( formatter, "double argument", "Decimal value" ); - Console::WriteLine( formatter, "---------------", "-------------" ); - - // Convert double values and display the results. - DecimalFromDouble( 1.234567890123E-30 ); - DecimalFromDouble( 1.2345678901234E-25 ); - DecimalFromDouble( 1.23456789012345E-20 ); - DecimalFromDouble( 1.234567890123456E-10 ); - DecimalFromDouble( 1.2345678901234567 ); - DecimalFromDouble( 1.23456789012345678E+12 ); - DecimalFromDouble( 1.234567890123456789E+28 ); - DecimalFromDouble( 1.234567890123456789E+30 ); -} - -/* -This example of the explicit conversion from double to Decimal -generates the following output. - - double argument Decimal value - --------------- ------------- - 1.2345678901230000E-030 0 - 1.2345678901233999E-025 0.0000000000000000000000001235 - 1.2345678901234499E-020 0.0000000000000000000123456789 - 1.2345678901234560E-010 0.000000000123456789012346 - 1.2345678901234567E+000 1.23456789012346 - 1.2345678901234568E+012 1234567890123.46 - 1.2345678901234568E+028 12345678901234600000000000000 - 1.2345678901234569E+030 OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp deleted file mode 100644 index 2b8674f5b9b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example of the explicit conversion from float to Decimal. -using namespace System; -#define formatter "{0,16:E7}{1,33}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the float argument; catch exceptions that are thrown. -void DecimalFromSingle( float argument ) -{ - Object^ decValue; - - // Convert the float argument to a Decimal value. - try - { - decValue = (Decimal)argument; - } - catch ( Exception^ ex ) - { - decValue = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, decValue ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversion from float " - "to Decimal \ngenerates the following output.\n" ); - Console::WriteLine( formatter, "float argument", "Decimal value" ); - Console::WriteLine( formatter, "--------------", "-------------" ); - - // Convert float values and display the results. - DecimalFromSingle( 1.2345E-30F ); - DecimalFromSingle( 1.2345E-26F ); - DecimalFromSingle( 1.23456E-22F ); - DecimalFromSingle( 1.23456E-12F ); - DecimalFromSingle( 1.234567F ); - DecimalFromSingle( 1.234567E+12F ); - DecimalFromSingle( 1.2345678E+28F ); - DecimalFromSingle( 1.2345678E+30F ); -} - -/* -This example of the explicit conversion from float to Decimal -generates the following output. - - float argument Decimal value - -------------- ------------- - 1.2345000E-030 0 - 1.2345000E-026 0.0000000000000000000000000123 - 1.2345600E-022 0.000000000000000000000123456 - 1.2345600E-012 0.00000000000123456 - 1.2345671E+000 1.234567 - 1.2345670E+012 1234567000000 - 1.2345678E+028 12345680000000000000000000000 - 1.2345678E+030 OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp deleted file mode 100644 index 6d1843e5d96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 16-bit integer values. - array^ values = { Int16::MinValue, Int16::MaxValue, - 0xFFF, 12345, -10000 }; - // Convert each value to a Decimal. - for each (Int16 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -32768 (Int16) --> -32768 (Decimal) -// 32767 (Int16) --> 32767 (Decimal) -// 4095 (Int16) --> 4095 (Decimal) -// 12345 (Int16) --> 12345 (Decimal) -// -10000 (Int16) --> -10000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp deleted file mode 100644 index 02af50b7b64..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 32-bit integer values. - array^ values = { Int32::MinValue, Int32::MaxValue, - 0xFFFFFF, 123456789, -1000000000 }; - // Convert each value to a Decimal. - for each (Int32 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -2147483648 (Int32) --> -2147483648 (Decimal) -// 2147483647 (Int32) --> 2147483647 (Decimal) -// 16777215 (Int32) --> 16777215 (Decimal) -// 123456789 (Int32) --> 123456789 (Decimal) -// -1000000000 (Int32) --> -1000000000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp deleted file mode 100644 index 6276b339c09..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 64-bit integer values. - array^ values = { Int64::MinValue, Int64::MaxValue, - 0xFFFFFFFFFFFF, 123456789123456789, - -1000000000000000 }; - // Convert each value to a Decimal. - for each (Int64 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -9223372036854775808 (Int64) --> -9223372036854775808 (Decimal) -// 9223372036854775807 (Int64) --> 9223372036854775807 (Decimal) -// 281474976710655 (Int64) --> 281474976710655 (Decimal) -// 123456789123456789 (Int64) --> 123456789123456789 (Decimal) -// -1000000000000000 (Int64) --> -1000000000000000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp deleted file mode 100644 index 7dc5e10fb54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 8-bit signed integer values. - array^ values = { SByte::MinValue, SByte::MaxValue, - 0x3F, 123, -100 }; - // Convert each value to a Decimal. - for each (SByte value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// -128 (SByte) --> -128 (Decimal) -// 127 (SByte) --> 127 (Decimal) -// 63 (SByte) --> 63 (Decimal) -// 123 (SByte) --> 123 (Decimal) -// -100 (SByte) --> -100 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp deleted file mode 100644 index f1aeb921e60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of byte values. - array^ values = { Byte::MinValue, Byte::MaxValue, - 0x3F, 123, 200 }; - // Convert each value to a Decimal. - for each (Byte value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (Byte) --> 0 (Decimal) -// 255 (Byte) --> 255 (Decimal) -// 63 (Byte) --> 63 (Decimal) -// 123 (Byte) --> 123 (Decimal) -// 200 (Byte) --> 200 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp deleted file mode 100644 index 05b5707b713..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 16-bit unsigned integer values. - array^ values = { UInt16::MinValue, UInt16::MaxValue, - 0xFFF, 12345, 40000 }; - // Convert each value to a Decimal. - for each (UInt16 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (UInt16) --> 0 (Decimal) -// 65535 (UInt16) --> 65535 (Decimal) -// 4095 (UInt16) --> 4095 (Decimal) -// 12345 (UInt16) --> 12345 (Decimal) -// 40000 (UInt16) --> 40000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp deleted file mode 100644 index 66304c49b67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 32-bit unsigned integer values. - array^ values = { UInt32::MinValue, UInt32::MaxValue, - 0xFFFFFF, 123456789, 4000000000 }; - // Convert each value to a Decimal. - for each (UInt32 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (UInt32) --> 0 (Decimal) -// 4294967295 (UInt32) --> 4294967295 (Decimal) -// 16777215 (UInt32) --> 16777215 (Decimal) -// 123456789 (UInt32) --> 123456789 (Decimal) -// 4000000000 (UInt32) --> 4000000000 (Decimal) -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp deleted file mode 100644 index 83f40b676ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of 64-bit unsigned integer values. - array^ values = { UInt64::MinValue, UInt64::MaxValue, - 0xFFFFFFFFFFFF, 123456789123456789, - 1000000000000000 }; - // Convert each value to a Decimal. - for each (UInt64 value in values) { - Decimal decValue = value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, decValue, - decValue.GetType()->Name); - } -} -// The example displays the following output: -// 0 (UInt64) --> 0 (Decimal) -// 18446744073709551615 (UInt64) --> 18446744073709551615 (Decimal) -// 281474976710655 (UInt64) --> 281474976710655 (Decimal) -// 123456789123456789 (UInt64) --> 123456789123456789 (Decimal) -// 1000000000000000 (UInt64) --> 1000000000000000 (Decimal) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp deleted file mode 100644 index b129d97d402..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of decimal values. - array^ values = { Decimal::Parse("78"), - Decimal(78000,0,0,false,3), - Decimal::Parse("78.999"), - Decimal::Parse("255.999"), - Decimal::Parse("256"), - Decimal::Parse("127.999"), - Decimal::Parse("128"), - Decimal::Parse("-0.999"), - Decimal::Parse("-1"), - Decimal::Parse("-128.999"), - Decimal::Parse("-129") }; - for each (Decimal value in values) { - try { - Byte byteValue = (Byte) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, byteValue, - byteValue.GetType()->Name); - } - catch (OverflowException^ e) { - Console::WriteLine("OverflowException: Cannot convert {0}", - value); - } - } -} -// The example displays the following output: -// 78 (Decimal) --> 78 (Byte) -// 78.000 (Decimal) --> 78 (Byte) -// 78.999 (Decimal) --> 78 (Byte) -// 255.999 (Decimal) --> 255 (Byte) -// OverflowException: Cannot convert 256 -// 127.999 (Decimal) --> 127 (Byte) -// 128 (Decimal) --> 128 (Byte) -// -0.999 (Decimal) --> 0 (Byte) -// OverflowException: Cannot convert -1 -// OverflowException: Cannot convert -128.999 -// OverflowException: Cannot convert -129 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp deleted file mode 100644 index b9c5dfa766d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of Decimal values. - array^ values = { Decimal::Parse("0.0000000000000000000000000001"), - Decimal::Parse("0.0000000000123456789123456789"), - Decimal::Parse("123"), - Decimal(123000000, 0, 0, false, 6), - Decimal::Parse("123456789.123456789"), - Decimal::Parse("123456789123456789123456789"), - Decimal::MinValue, Decimal::MaxValue }; - // Convert each value to a double. - for each (Decimal value in values) { - double dblValue = (double) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, dblValue, - dblValue.GetType()->Name); - } -} -// The example displays the following output: -// 0.0000000000000000000000000001 (Decimal) --> 1E-28 (Double) -// 0.0000000000123456789123456789 (Decimal) --> 1.23456789123457E-11 (Double) -// 123 (Decimal) --> 123 (Double) -// 123.000000 (Decimal) --> 123 (Double) -// 123456789.123456789 (Decimal) --> 123456789.123457 (Double) -// 123456789123456789123456789 (Decimal) --> 1.23456789123457E+26 (Double) -// -79228162514264337593543950335 (Decimal) --> -7.92281625142643E+28 (Double) -// 79228162514264337593543950335 (Decimal) --> 7.92281625142643E+28 (Double) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp deleted file mode 100644 index ba9c3b99b99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the explicit conversions from Decimal to short and -// Decimal to unsigned short. -using namespace System; -#define formatter "{0,16}{1,19}{2,19}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the Decimal argument; catch exceptions that are thrown. -void DecimalToU_Int16( Decimal argument ) -{ - Object^ Int16Value; - Object^ UInt16Value; - - // Convert the argument to a short value. - try - { - Int16Value = (short)argument; - } - catch ( Exception^ ex ) - { - Int16Value = GetExceptionType( ex ); - } - - - // Convert the argument to an unsigned short value. - try - { - UInt16Value = (unsigned short)argument; - } - catch ( Exception^ ex ) - { - UInt16Value = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, Int16Value, UInt16Value ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversions from Decimal to " - "short \nand Decimal to unsigned short generates the " - "following output. \nIt displays several converted Decimal " - "values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "short", "unsigned short" ); - Console::WriteLine( formatter, "----------------", "-----", "--------------" ); - - // Convert Decimal values and display the results. - DecimalToU_Int16( Decimal::Parse( "123" ) ); - DecimalToU_Int16( Decimal(123000,0,0,false,3) ); - DecimalToU_Int16( Decimal::Parse( "123.999" ) ); - DecimalToU_Int16( Decimal::Parse( "65535.999" ) ); - DecimalToU_Int16( Decimal::Parse( "65536" ) ); - DecimalToU_Int16( Decimal::Parse( "32767.999" ) ); - DecimalToU_Int16( Decimal::Parse( "32768" ) ); - DecimalToU_Int16( Decimal::Parse( "-0.999" ) ); - DecimalToU_Int16( Decimal::Parse( "-1" ) ); - DecimalToU_Int16( Decimal::Parse( "-32768.999" ) ); - DecimalToU_Int16( Decimal::Parse( "-32769" ) ); -} - -/* -This example of the explicit conversions from Decimal to short -and Decimal to unsigned short generates the following output. -It displays several converted Decimal values. - -Decimal argument short unsigned short ----------------- ----- -------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 65535.999 OverflowException 65535 - 65536 OverflowException OverflowException - 32767.999 32767 32767 - 32768 OverflowException 32768 - -0.999 0 0 - -1 -1 OverflowException - -32768.999 -32768 OverflowException - -32769 OverflowException OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp deleted file mode 100644 index 02cb0e6339f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the explicit conversions from Decimal to int and -// Decimal to unsigned int. -using namespace System; -#define formatter "{0,17}{1,19}{2,19}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the Decimal argument; catch exceptions that are thrown. -void DecimalToU_Int32( Decimal argument ) -{ - Object^ Int32Value; - Object^ UInt32Value; - - // Convert the argument to an int value. - try - { - Int32Value = (int)argument; - } - catch ( Exception^ ex ) - { - Int32Value = GetExceptionType( ex ); - } - - - // Convert the argument to an unsigned int value. - try - { - UInt32Value = (unsigned int)argument; - } - catch ( Exception^ ex ) - { - UInt32Value = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, Int32Value, UInt32Value ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversions from Decimal to " - "int \nand Decimal to unsigned int generates the " - "following output. \nIt displays several converted Decimal " - "values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "int", "unsigned int" ); - Console::WriteLine( formatter, "----------------", "---", "------------" ); - - // Convert Decimal values and display the results. - DecimalToU_Int32( Decimal::Parse( "123" ) ); - DecimalToU_Int32( Decimal(123000,0,0,false,3) ); - DecimalToU_Int32( Decimal::Parse( "123.999" ) ); - DecimalToU_Int32( Decimal::Parse( "4294967295.999" ) ); - DecimalToU_Int32( Decimal::Parse( "4294967296" ) ); - DecimalToU_Int32( Decimal::Parse( "2147483647.999" ) ); - DecimalToU_Int32( Decimal::Parse( "2147483648" ) ); - DecimalToU_Int32( Decimal::Parse( "-0.999" ) ); - DecimalToU_Int32( Decimal::Parse( "-1" ) ); - DecimalToU_Int32( Decimal::Parse( "-2147483648.999" ) ); - DecimalToU_Int32( Decimal::Parse( "-2147483649" ) ); -} - -/* -This example of the explicit conversions from Decimal to int -and Decimal to unsigned int generates the following output. -It displays several converted Decimal values. - - Decimal argument int unsigned int - ---------------- --- ------------ - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 4294967295.999 OverflowException 4294967295 - 4294967296 OverflowException OverflowException - 2147483647.999 2147483647 2147483647 - 2147483648 OverflowException 2147483648 - -0.999 0 0 - -1 -1 OverflowException - -2147483648.999 -2147483648 OverflowException - -2147483649 OverflowException OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp deleted file mode 100644 index 5beaab71f7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the explicit conversions from Decimal to __int64 and -// Decimal to unsigned __int64. -using namespace System; -#define formatter "{0,25}{1,22}{2,22}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Convert the Decimal argument; catch exceptions that are thrown. -void DecimalToU_Int64( Decimal argument ) -{ - Object^ Int64Value; - Object^ UInt64Value; - - // Convert the argument to an __int64 value. - try - { - Int64Value = (__int64)argument; - } - catch ( Exception^ ex ) - { - Int64Value = GetExceptionType( ex ); - } - - - // Convert the argument to an unsigned __int64 value. - try - { - UInt64Value = (unsigned __int64)argument; - } - catch ( Exception^ ex ) - { - UInt64Value = GetExceptionType( ex ); - } - - Console::WriteLine( formatter, argument, Int64Value, UInt64Value ); -} - -int main() -{ - Console::WriteLine( "This example of the explicit conversions from Decimal to " - "__int64 \nand Decimal to unsigned __int64 generates the " - "following output. \nIt displays several converted Decimal " - "values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "__int64", "unsigned __int64" ); - Console::WriteLine( formatter, "----------------", "-------", "----------------" ); - - // Convert Decimal values and display the results. - DecimalToU_Int64( Decimal::Parse( "123" ) ); - DecimalToU_Int64( Decimal(123000,0,0,false,3) ); - DecimalToU_Int64( Decimal::Parse( "123.999" ) ); - DecimalToU_Int64( Decimal::Parse( "18446744073709551615.999" ) ); - DecimalToU_Int64( Decimal::Parse( "18446744073709551616" ) ); - DecimalToU_Int64( Decimal::Parse( "9223372036854775807.999" ) ); - DecimalToU_Int64( Decimal::Parse( "9223372036854775808" ) ); - DecimalToU_Int64( Decimal::Parse( "-0.999" ) ); - DecimalToU_Int64( Decimal::Parse( "-1" ) ); - DecimalToU_Int64( Decimal::Parse( "-9223372036854775808.999" ) ); - DecimalToU_Int64( Decimal::Parse( "-9223372036854775809" ) ); -} - -/* -This example of the explicit conversions from Decimal to __int64 -and Decimal to unsigned __int64 generates the following output. -It displays several converted Decimal values. - - Decimal argument __int64 unsigned __int64 - ---------------- ------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp deleted file mode 100644 index c6b41982d9d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -class NotTooSafeStringReverse -{ -public: - static void Main() - { - String^ stringA = "I seem to be turned around!"; - int copylen = stringA->Length; - - // Allocate HGlobal memory for source and destination strings - IntPtr sptr = Marshal::StringToHGlobalAnsi(stringA); - IntPtr dptr = Marshal::AllocHGlobal(copylen + 1); - - char *src = (char *)sptr.ToPointer(); - char *dst = (char *)dptr.ToPointer(); - - if (copylen > 0) - { - // set the source pointer to the end of the string - // to do a reverse copy. - src += copylen - 1; - - while (copylen-- > 0) - { - *dst++ = *src--; - } - *dst = 0; - } - String^ stringB = Marshal::PtrToStringAnsi(dptr); - - Console::WriteLine("Original:\n{0}\n", stringA); - Console::WriteLine("Reversed:\n{0}", stringB); - - // Free HGlobal memory - Marshal::FreeHGlobal(dptr); - Marshal::FreeHGlobal(sptr); - } -}; - -int main() -{ - NotTooSafeStringReverse::Main(); -} - -// The progam has the following output: -// -// Original: -// I seem to be turned around! -// -// Reversed: -// !dnuora denrut eb ot mees I -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp deleted file mode 100644 index d0cc8fad02a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Get the type of a chosen class. - Type^ t = ReflectionTypeLoadException::typeid; - - // Get the MemberInfo array. - array^ members = t->GetMembers(); - - // Get and display the name and the MemberType for each member. - Console::WriteLine("Members of {0}", t->Name); - for each (MemberInfo^ member in members) { - MemberTypes memberType = member->MemberType; - Console::WriteLine(" {0}: {1}", member->Name, memberType); - } -} -// The example displays the following output: -// Members of ReflectionTypeLoadException -// get_Types: Method -// get_LoaderExceptions: Method -// GetObjectData: Method -// get_Message: Method -// get_Data: Method -// GetBaseException: Method -// get_InnerException: Method -// get_TargetSite: Method -// get_StackTrace: Method -// get_HelpLink: Method -// set_HelpLink: Method -// get_Source: Method -// set_Source: Method -// ToString: Method -// get_HResult: Method -// GetType: Method -// Equals: Method -// GetHashCode: Method -// GetType: Method -// .ctor: Constructor -// .ctor: Constructor -// Types: Property -// LoaderExceptions: Property -// Message: Property -// Data: Property -// InnerException: Property -// TargetSite: Property -// StackTrace: Property -// HelpLink: Property -// Source: Property -// HResult: Property -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp deleted file mode 100644 index f17fb57cbb7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp +++ /dev/null @@ -1,153 +0,0 @@ - - -// -// This example uses the SHA1 algorithm. -// Due to collision problems with SHA1, Microsoft recommends SHA256 or better. -#using - -using namespace System; -using namespace System::Text; -using namespace System::Security::Cryptography; -ref class Sender -{ -private: - RSAParameters rsaPubParams; - RSAParameters rsaPrivateParams; - -public: - Sender() - { - RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; - - //Generate public and private key data. - rsaPrivateParams = rsaCSP->ExportParameters( true ); - rsaPubParams = rsaCSP->ExportParameters( false ); - } - - - property RSAParameters PublicParameters - { - RSAParameters get() - { - return rsaPubParams; - } - - } - - //Manually performs hash and then signs hashed value. - array^ HashAndSign( array^encrypted ) - { - RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; - SHA1Managed^ hash = gcnew SHA1Managed; - array^hashedData; - rsaCSP->ImportParameters( rsaPrivateParams ); - hashedData = hash->ComputeHash( encrypted ); - return rsaCSP->SignHash( hashedData, CryptoConfig::MapNameToOID( "SHA1" ) ); - } - - - //Encrypts using only the public key data. - array^ EncryptData( RSAParameters rsaParams, array^toEncrypt ) - { - RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; - rsaCSP->ImportParameters( rsaParams ); - return rsaCSP->Encrypt( toEncrypt, false ); - } - -}; - -ref class Receiver -{ -private: - RSAParameters rsaPubParams; - RSAParameters rsaPrivateParams; - -public: - Receiver() - { - RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; - - //Generate public and private key data. - rsaPrivateParams = rsaCSP->ExportParameters( true ); - rsaPubParams = rsaCSP->ExportParameters( false ); - } - - - property RSAParameters PublicParameters - { - RSAParameters get() - { - return rsaPubParams; - } - - } - - //Manually performs hash and then verifies hashed value. - // - bool VerifyHash( RSAParameters rsaParams, array^signedData, array^signature ) - { - RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; - SHA1Managed^ hash = gcnew SHA1Managed; - array^hashedData; - rsaCSP->ImportParameters( rsaParams ); - bool dataOK = rsaCSP->VerifyData(signedData, CryptoConfig::MapNameToOID("SHA1"), signature); - hashedData = hash->ComputeHash( signedData ); - return rsaCSP->VerifyHash( hashedData, CryptoConfig::MapNameToOID( "SHA1" ), signature ); - } - // - - - //Decrypt using the private key data. - void DecryptData( array^encrypted ) - { - array^fromEncrypt; - String^ roundTrip; - ASCIIEncoding^ myAscii = gcnew ASCIIEncoding; - RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; - rsaCSP->ImportParameters( rsaPrivateParams ); - fromEncrypt = rsaCSP->Decrypt( encrypted, false ); - roundTrip = myAscii->GetString( fromEncrypt ); - Console::WriteLine( "RoundTrip: {0}", roundTrip ); - } - -}; - -int main() -{ - array^toEncrypt; - array^encrypted; - array^signature; - - //Choose a small amount of data to encrypt. - String^ original = "Hello"; - ASCIIEncoding^ myAscii = gcnew ASCIIEncoding; - - //Create a sender and receiver. - Sender^ mySender = gcnew Sender; - Receiver^ myReceiver = gcnew Receiver; - - //Convert the data string to a byte array. - toEncrypt = myAscii->GetBytes( original ); - - //Encrypt data using receiver's public key. - encrypted = mySender->EncryptData( myReceiver->PublicParameters, toEncrypt ); - - //Hash the encrypted data and generate a signature on the hash - // using the sender's private key. - signature = mySender->HashAndSign( encrypted ); - Console::WriteLine( "Original: {0}", original ); - - //Verify the signature is authentic using the sender's public key. - if ( myReceiver->VerifyHash( mySender->PublicParameters, encrypted, signature ) ) - { - - //Decrypt the data using the receiver's private key. - myReceiver->DecryptData( encrypted ); - } - else - { - Console::WriteLine( "Invalid signature" ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp deleted file mode 100644 index ffc578df28f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -int main() -{ - array^info = { "Name: Felica Walker", "Title: Mz.", - "Age: 47", "Location: Paris", "Gender: F"}; - int found = 0; - Console::WriteLine("The initial values in the array are:"); - for each (String^ s in info) - Console::WriteLine(s); - - Console::WriteLine("\nWe want to retrieve only the key information. That is:"); - for each (String^ s in info) { - found = s->IndexOf(": "); - Console::WriteLine(" {0}", s->Substring(found + 2)); - } -} -// The example displays the following output: -// The initial values in the array are: -// Name: Felica Walker -// Title: Mz. -// Age: 47 -// Location: Paris -// Gender: F -// -// We want to retrieve only the key information. That is: -// Felica Walker -// Mz. -// 47 -// Paris -// F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp deleted file mode 100644 index df9aa3a8a84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Action.cpp : main project file. - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Name -{ -private: - String^ instanceName; - -public: - Name(String^ name) - { - instanceName = name; - } - - void DisplayToConsole() - { - Console::WriteLine(this->instanceName); - } - - void DisplayToWindow() - { - MessageBox::Show(this->instanceName); - } -}; - - -int main() -{ - Name^ testName = gcnew Name(L"Koani"); - System::Action^ showMethod; - showMethod += gcnew Action(testName, &Name::DisplayToWindow); - showMethod(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp deleted file mode 100644 index c593825b090..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Action`1.cpp : main project file. - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Windows::Forms; - -namespace ActionExample -{ - public ref class Message - { - public: - static void ShowWindowsMessage(String^ message) - { - MessageBox::Show(message); - } - }; -} - -int main() -{ - Action^ messageTarget; - - if (Environment::GetCommandLineArgs()->Length > 1) - messageTarget = gcnew Action(&ActionExample::Message::ShowWindowsMessage); - else - messageTarget = gcnew Action(&Console::WriteLine); - - messageTarget("Hello, World!"); - return 0; -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp deleted file mode 100644 index 143680f77d9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// Delegate.cpp : main project file. - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Windows::Forms; - -public delegate void DisplayMessage(String^ message); - -public ref class TestCustomDelegate -{ -public: - static void ShowWindowsMessage(String^ message) - { - MessageBox::Show(message); - } -}; - -int main() -{ - DisplayMessage^ messageTarget; - - if (Environment::GetCommandLineArgs()->Length > 1) - messageTarget = gcnew DisplayMessage(&TestCustomDelegate::ShowWindowsMessage); - else - messageTarget = gcnew DisplayMessage(&Console::WriteLine); - - messageTarget(L"Hello World!"); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp deleted file mode 100644 index f0be96546c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// This method has the same signature as the CrossAppDomainDelegate, -// so that it can be executed easily in the new application domain. -// -static void ShowDomainInfo() -{ - AppDomain^ ad = AppDomain::CurrentDomain; - Console::WriteLine(); - Console::WriteLine( L"FriendlyName: {0}", ad->FriendlyName ); - Console::WriteLine( L"Id: {0}", ad->Id ); - Console::WriteLine( L"IsDefaultAppDomain: {0}", ad->IsDefaultAppDomain() ); -} - -// The following attribute indicates to the loader that assemblies -// in the global assembly cache should be shared across multiple -// application domains. -// -[LoaderOptimizationAttribute(LoaderOptimization::MultiDomainHost)] -int main() -{ - // Show information for the default application domain. - ShowDomainInfo(); - - // Create a new application domain and display its information. - AppDomain^ newDomain = AppDomain::CreateDomain( L"MyMultiDomain" ); - newDomain->DoCallBack( gcnew CrossAppDomainDelegate( ShowDomainInfo ) ); - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp deleted file mode 100644 index bc76d292564..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// The following example wraps an array in a read-only IList. -#using - -// -using namespace System; -using namespace System::Collections::Generic; - -namespace Samples -{ - public ref class SamplesArray - { - public: - static void Work() - { - - // Create and initialize a new string array. - array ^ textArray = - {"The", "quick", "brown", "fox"}; - - // Display the values of the array. - Console::WriteLine("The string array initially contains " - "the following values:"); - PrintIndexAndValues(textArray); - - // Create a read-only IList wrapper around the array. - IList ^ textList = Array::AsReadOnly(textArray); - - // Display the values of the read-only IList. - Console::WriteLine("The read-only IList contains " - "the following values:"); - PrintIndexAndValues(textList); - - // Attempt to change a value through the wrapper. - try - { - textList[3] = "CAT"; - } - catch (NotSupportedException^ ex) - { - Console::WriteLine("{0} - {1}", ex->GetType(), - ex->Message); - Console::WriteLine(); - } - - - // Change a value in the original array. - textArray[2] = "RED"; - - // Display the values of the array. - Console::WriteLine("After changing the third element," - "the string array contains the following values:"); - PrintIndexAndValues(textArray); - - // Display the values of the read-only IList. - Console::WriteLine("After changing the third element, the" - " read-only IList contains the following values:"); - PrintIndexAndValues(textList); - } - - static void PrintIndexAndValues(array^ textArray) - { - for (int i = 0; i < textArray->Length; i++) - { - Console::WriteLine(" [{0}] : {1}", i, textArray[i]); - } - Console::WriteLine(); - } - - static void PrintIndexAndValues(IList^ textList) - { - for (int i = 0; i < textList->Count; i++) - { - Console::WriteLine(" [{0}] : {1}", i, textList[i]); - } - Console::WriteLine(); - } - }; -} - -int main() -{ - Samples::SamplesArray::Work(); - -} - -/* -This code produces the following output. - -The string array initially contains the following values: -[0] : The -[1] : quick -[2] : brown -[3] : fox - -The read-only IList contains the following values: -[0] : The -[1] : quick -[2] : brown -[3] : fox - -System.NotSupportedException - Collection is read-only. - -After changing the third element, the string array contains the following values: -[0] : The -[1] : quick -[2] : RED -[3] : fox - -After changing the third element, the read-only IList contains the following values: -[0] : The -[1] : quick -[2] : RED -[3] : fox - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp deleted file mode 100644 index cbcd2d14244..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// The following code example clones a CultureInfo array and demonstrates the behavior of a shallow copy. -// -using namespace System; -using namespace System::Globalization; -void PrintIndexAndValues( Array^ myArray ); -int main() -{ - - // Create and initialize a new CultureInfo array. - CultureInfo^ ci0 = gcnew CultureInfo( "ar-SA",false ); - CultureInfo^ ci1 = gcnew CultureInfo( "en-US",false ); - CultureInfo^ ci2 = gcnew CultureInfo( "fr-FR",false ); - CultureInfo^ ci3 = gcnew CultureInfo( "ja-JP",false ); - array^arrCI = {ci0,ci1,ci2,ci3}; - - // Create a clone of the CultureInfo array. - array^arrCIClone = (array^)arrCI->Clone(); - - // Replace an element in the clone array. - CultureInfo^ ci4 = gcnew CultureInfo( "th-TH",false ); - arrCIClone[ 0 ] = ci4; - - // Display the contents of the original array. - Console::WriteLine( "The original array contains the following values:" ); - PrintIndexAndValues( arrCI ); - - // Display the contents of the clone array. - Console::WriteLine( "The clone array contains the following values:" ); - PrintIndexAndValues( arrCIClone ); - - // Display the DateTimeFormatInfo.DateSeparator for the fourth element in both arrays. - Console::WriteLine( "Before changes to the clone:" ); - Console::WriteLine( " Original: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCI[ 3 ]->Name, arrCI[ 3 ]->DateTimeFormat->DateSeparator ); - Console::WriteLine( " Clone: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCIClone[ 3 ]->Name, arrCIClone[ 3 ]->DateTimeFormat->DateSeparator ); - - // Replace the DateTimeFormatInfo.DateSeparator for the fourth element in the clone array. - arrCIClone[ 3 ]->DateTimeFormat->DateSeparator = "-"; - - // Display the DateTimeFormatInfo.DateSeparator for the fourth element in both arrays. - Console::WriteLine( "After changes to the clone:" ); - Console::WriteLine( " Original: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCI[ 3 ]->Name, arrCI[ 3 ]->DateTimeFormat->DateSeparator ); - Console::WriteLine( " Clone: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCIClone[ 3 ]->Name, arrCIClone[ 3 ]->DateTimeFormat->DateSeparator ); -} - -void PrintIndexAndValues( Array^ myArray ) -{ - for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) - Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); -} - -/* -This code produces the following output. - -The original array contains the following values: - [0]: ar-SA - [1]: en-US - [2]: fr-FR - [3]: ja-JP -The clone array contains the following values: - [0]: th-TH - [1]: en-US - [2]: fr-FR - [3]: ja-JP -Before changes to the clone: - Original: The DateTimeFormatInfo.DateSeparator for ja-JP is /. - Clone: The DateTimeFormatInfo.DateSeparator for ja-JP is /. -After changes to the clone: - Original: The DateTimeFormatInfo.DateSeparator for ja-JP is -. - Clone: The DateTimeFormatInfo.DateSeparator for ja-JP is -. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp deleted file mode 100644 index 3bba94a2dc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// The following example shows how resizing affects the array. -// -using namespace System; -static void PrintIndexAndValues(array^myArr) -{ - for(int i = 0; i < myArr->Length; i++) - { - Console::WriteLine(L" [{0}] : {1}", i, myArr[i]); - } - Console::WriteLine(); -} - -int main() -{ - - // Create and initialize a new string array. - array^myArr = {L"The", L"quick", L"brown", L"fox", - L"jumps", L"over", L"the", L"lazy", L"dog"}; - - // Display the values of the array. - Console::WriteLine( - L"The string array initially contains the following values:"); - PrintIndexAndValues(myArr); - - // Resize the array to a bigger size (five elements larger). - Array::Resize(myArr, myArr->Length + 5); - - // Display the values of the array. - Console::WriteLine(L"After resizing to a larger size, "); - Console::WriteLine(L"the string array contains the following values:"); - PrintIndexAndValues(myArr); - - // Resize the array to a smaller size (four elements). - Array::Resize(myArr, 4); - - // Display the values of the array. - Console::WriteLine(L"After resizing to a smaller size, "); - Console::WriteLine(L"the string array contains the following values:"); - PrintIndexAndValues(myArr); - return 1; -} - -/* -This code produces the following output. - -The string array initially contains the following values: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After resizing to a larger size, -the string array contains the following values: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - [9] : - [10] : - [11] : - [12] : - [13] : - -After resizing to a smaller size, -the string array contains the following values: - [0] : The - [1] : quick - [2] : brown - [3] : fox - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp deleted file mode 100644 index a3cb3dea791..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp +++ /dev/null @@ -1,119 +0,0 @@ - -// The following example shows how to sort the values in an array using the default comparer -// and a custom comparer that reverses the sort order. - -// -using namespace System; -using namespace System::Collections; - -public ref class ReverseComparer : IComparer -{ -public: - // Call CaseInsensitiveComparer::Compare with the parameters reversed. - virtual int Compare(Object^ x, Object^ y) = IComparer::Compare - { - return ((gcnew CaseInsensitiveComparer)->Compare(y, x)); - } -}; - -void DisplayValues(array^ arr) -{ - for (int i = arr->GetLowerBound(0); i <= arr->GetUpperBound(0); i++) - Console::WriteLine( " [{0}] : {1}", i, arr[ i ] ); - - Console::WriteLine(); -} - -int main() -{ - // Create and initialize a new array. and a new custom comparer. - array^ words = { "The","QUICK","BROWN","FOX","jumps", - "over","the","lazy","dog" }; - // Instantiate the reverse comparer. - IComparer^ revComparer = gcnew ReverseComparer(); - - // Display the values of the Array. - Console::WriteLine( "The original order of elements in the array:" ); - DisplayValues(words); - - // Sort a section of the array using the default comparer. - Array::Sort(words, 1, 3); - Console::WriteLine( "After sorting elements 1-3 by using the default comparer:"); - DisplayValues(words); - - // Sort a section of the array using the reverse case-insensitive comparer. - Array::Sort(words, 1, 3, revComparer); - Console::WriteLine( "After sorting elements 1-3 by using the reverse case-insensitive comparer:"); - DisplayValues(words); - - // Sort the entire array using the default comparer. - Array::Sort(words); - Console::WriteLine( "After sorting the entire array by using the default comparer:"); - DisplayValues(words); - - // Sort the entire array by using the reverse case-insensitive comparer. - Array::Sort(words, revComparer); - Console::WriteLine( "After sorting the entire array using the reverse case-insensitive comparer:"); - DisplayValues(words); -} - -/* -This code produces the following output. - -The Array initially contains the following values: - [0] : The - [1] : QUICK - [2] : BROWN - [3] : FOX - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After sorting a section of the Array using the default comparer: - [0] : The - [1] : BROWN - [2] : FOX - [3] : QUICK - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After sorting a section of the Array using the reverse case-insensitive comparer: - [0] : The - [1] : QUICK - [2] : FOX - [3] : BROWN - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - -After sorting the entire Array using the default comparer: - [0] : BROWN - [1] : dog - [2] : FOX - [3] : jumps - [4] : lazy - [5] : over - [6] : QUICK - [7] : the - [8] : The - -After sorting the entire Array using the reverse case-insensitive comparer: - [0] : the - [1] : The - [2] : QUICK - [3] : over - [4] : lazy - [5] : jumps - [6] : FOX - [7] : dog - [8] : BROWN - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp deleted file mode 100644 index ef9afc50bc2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// The following example shows how to sort two associated arrays -// where the first array contains the keys and the second array contains the values. -// Sorts are done using the default comparer and a custom comparer that reverses the sort order. - -// -using namespace System; -using namespace System::Collections; - -public ref class myReverserClass: public IComparer -{ -private: - - // Calls CaseInsensitiveComparer::Compare with the parameters reversed. - virtual int Compare( Object^ x, Object^ y ) = IComparer::Compare - { - return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); - } -}; - -void PrintKeysAndValues( array^myKeys, array^myValues ) -{ - for ( int i = 0; i < myKeys->Length; i++ ) - { - Console::WriteLine( " {0, -10}: {1}", myKeys[ i ], myValues[ i ] ); - } - Console::WriteLine(); -} - -int main() -{ - // Creates and initializes a new Array and a new custom comparer. - array^myKeys = {"red","GREEN","YELLOW","BLUE","purple","black","orange"}; - array^myValues = {"strawberries","PEARS","LIMES","BERRIES","grapes","olives","cantaloupe"}; - IComparer^ myComparer = gcnew myReverserClass; - - // Displays the values of the Array. - Console::WriteLine( "The Array initially contains the following values:" ); - PrintKeysAndValues( myKeys, myValues ); - - // Sorts a section of the Array using the default comparer. - Array::Sort( myKeys, myValues, 1, 3 ); - Console::WriteLine( "After sorting a section of the Array using the default comparer:" ); - - // Sorts a section of the Array using the reverse case-insensitive comparer. - Array::Sort( myKeys, myValues, 1, 3, myComparer ); - Console::WriteLine( "After sorting a section of the Array using the reverse case-insensitive comparer:" ); - PrintKeysAndValues( myKeys, myValues ); - - // Sorts the entire Array using the default comparer. - Array::Sort( myKeys, myValues ); - Console::WriteLine( "After sorting the entire Array using the default comparer:" ); - PrintKeysAndValues( myKeys, myValues ); - - // Sorts the entire Array using the reverse case-insensitive comparer. - Array::Sort( myKeys, myValues, myComparer ); - Console::WriteLine( "After sorting the entire Array using the reverse case-insensitive comparer:" ); - PrintKeysAndValues( myKeys, myValues ); -} - -/* -This code produces the following output. - -The Array initially contains the following values: - red : strawberries - GREEN : PEARS - YELLOW : LIMES - BLUE : BERRIES - purple : grapes - black : olives - orange : cantaloupe - -After sorting a section of the Array using the default comparer: - red : strawberries - BLUE : BERRIES - GREEN : PEARS - YELLOW : LIMES - purple : grapes - black : olives - orange : cantaloupe - -After sorting a section of the Array using the reverse case-insensitive comparer: - red : strawberries - YELLOW : LIMES - GREEN : PEARS - BLUE : BERRIES - purple : grapes - black : olives - orange : cantaloupe - -After sorting the entire Array using the default comparer: - black : olives - BLUE : BERRIES - GREEN : PEARS - orange : cantaloupe - purple : grapes - red : strawberries - YELLOW : LIMES - -After sorting the entire Array using the reverse case-insensitive comparer: - YELLOW : LIMES - red : strawberries - purple : grapes - orange : cantaloupe - GREEN : PEARS - BLUE : BERRIES - black : olives - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp deleted file mode 100644 index 8133ae99134..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -using namespace System; -using namespace System::Threading; - -int main() -{ -// - Array^ myArray = gcnew array { 1, 2, 4 }; - try - { - Monitor::Enter(myArray->SyncRoot); - - for each (Int32 item in myArray) - Console::WriteLine(item); - } - finally - { - Monitor::Exit(myArray->SyncRoot); - } -// - - return 1; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp deleted file mode 100644 index f8fd837a057..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// The following code example passes an ArraySegment to a method. - -// -using namespace System; - - -namespace Sample -{ - public ref class SampleArray - { - public: - static void Work() - { - - // Create and initialize a new string array. - array ^ words = {"The", "quick", "brown", - "fox", "jumps", "over", "the", "lazy", "dog"}; - - // Display the initial contents of the array. - Console::WriteLine("The first array segment" - " (with all the array's elements) contains:"); - PrintIndexAndValues(words); - - // Define an array segment that contains the entire array. - ArraySegment segment(words); - - // Display the contents of the ArraySegment. - Console::WriteLine("The first array segment" - " (with all the array's elements) contains:"); - PrintIndexAndValues(segment); - - // Define an array segment that contains the middle five - // values of the array. - ArraySegment middle(words, 2, 5); - - // Display the contents of the ArraySegment. - Console::WriteLine("The second array segment" - " (with the middle five elements) contains:"); - PrintIndexAndValues(middle); - - // Modify the fourth element of the first array - // segment - segment.Array[3] = "LION"; - - // Display the contents of the second array segment - // middle. Note that the value of its second element - // also changed. - Console::WriteLine("After the first array segment" - " is modified,the second array segment" - " now contains:"); - PrintIndexAndValues(middle); - Console::ReadLine(); - } - - static void PrintIndexAndValues(ArraySegment^ segment) - { - for (int i = segment->Offset; - i < (segment->Offset + segment->Count); i++) - { - Console::WriteLine(" [{0}] : {1}", i, - segment->Array[i]); - } - Console::WriteLine(); - } - - static void PrintIndexAndValues(array^ words) - { - for (int i = 0; i < words->Length; i++) - { - Console::WriteLine(" [{0}] : {1}", i, - words[i]); - } - Console::WriteLine(); - } - }; -} - -int main() -{ - Sample::SampleArray::Work(); - return 0; -} - - - /* - This code produces the following output. - - The original array initially contains: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - - The first array segment (with all the array's elements) contains: - [0] : The - [1] : quick - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - [7] : lazy - [8] : dog - - The second array segment (with the middle five elements) contains: - [2] : brown - [3] : fox - [4] : jumps - [5] : over - [6] : the - - After the first array segment is modified, the second array segment now contains: - [2] : brown - [3] : LION - [4] : jumps - [5] : over - [6] : the - - */ - - // diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp deleted file mode 100644 index 2f0f4ea3c86..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -// -using namespace System; -int main() -{ - array^names = { "Dog", "Cat", "Fish"}; - array^objs = dynamic_cast^>(names); - try - { - objs[ 2 ] = (Object^)"Mouse"; - for ( Int32 i = 0; i < objs->Length; i++ ) - { - Console::WriteLine( objs[ i ] ); - - } - } - catch ( System::ArrayTypeMismatchException^ ) - { - - // Not reached, "Mouse" is of the correct type - Console::WriteLine( "Exception Thrown" ); - } - - try - { - Object^ obj = 13; - objs[ 2 ] = obj; - } - catch ( System::ArrayTypeMismatchException^ ) - { - - // Always reached, 13 is not a string. - Console::WriteLine( "New element is not of the correct type" ); - } - - - // Set obj to an array of objects instead of an array of strings - array^objs2 = gcnew array(3); - try - { - objs2[ 0 ] = (Object^)"Turtle"; - objs2[ 1 ] = 12; - objs2[ 2 ] = 2.341; - for ( Int32 i = 0; i < objs->Length; i++ ) - { - Console::WriteLine( objs2[ i ] ); - - } - } - catch ( System::ArrayTypeMismatchException^ ) - { - - // ArrayTypeMismatchException is not thrown this time. - Console::WriteLine( "Exception Thrown" ); - } - -} - -/*expected return values: -Dog -Cat -Mouse -New element is not of the correct type -Turtle -12 -2.341 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp deleted file mode 100644 index 63f0c9c330c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// The following example shows how to use GetEnumerator to list the elements of an array. -// -using namespace System; - -int main() -{ - // Creates and initializes a new Array. - array^myArr = gcnew array(10); - myArr[ 0 ] = "The"; - myArr[ 1 ] = "quick"; - myArr[ 2 ] = "brown"; - myArr[ 3 ] = "fox"; - myArr[ 4 ] = "jumps"; - myArr[ 5 ] = "over"; - myArr[ 6 ] = "the"; - myArr[ 7 ] = "lazy"; - myArr[ 8 ] = "dog"; - - // Displays the values of the Array. - int i = 0; - System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); - Console::WriteLine( "The Array contains the following values:" ); - while ( (myEnumerator->MoveNext()) && (myEnumerator->Current != nullptr) ) - Console::WriteLine( "[{0}] {1}", i++, myEnumerator->Current ); -} - -/* -This code produces the following output. - -The Array contains the following values: -[0] The -[1] quick -[2] brown -[3] fox -[4] jumps -[5] over -[6] the -[7] lazy -[8] dog - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp deleted file mode 100644 index bdfd647373c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// The following code example demonstrates how to set and get a specific value in a one-dimensional or multidimensional array. -// -using namespace System; -int main() -{ - - // Creates and initializes a one-dimensional array. - array^myArr1 = gcnew array(5); - - // Sets the element at index 3. - myArr1->SetValue( "three", 3 ); - Console::WriteLine( "[3]: {0}", myArr1->GetValue( 3 ) ); - - // Creates and initializes a two-dimensional array. - array^myArr2 = gcnew array(5,5); - - // Sets the element at index 1,3. - myArr2->SetValue( "one-three", 1, 3 ); - Console::WriteLine( "[1,3]: {0}", myArr2->GetValue( 1, 3 ) ); - - // Creates and initializes a three-dimensional array. - array^myArr3 = gcnew array(5,5,5); - - // Sets the element at index 1,2,3. - myArr3->SetValue( "one-two-three", 1, 2, 3 ); - Console::WriteLine( "[1,2,3]: {0}", myArr3->GetValue( 1, 2, 3 ) ); - - // Creates and initializes a seven-dimensional array. - array^myArr7 = gcnew array(5,5,5,5,5,5,5); - - // Sets the element at index 1,2,3,0,1,2,3. - array^myIndices = {1,2,3,0,1,2,3}; - myArr7->SetValue( "one-two-three-zero-one-two-three", myIndices ); - Console::WriteLine( "[1,2,3,0,1,2,3]: {0}", myArr7->GetValue( myIndices ) ); -} - -/* -This code produces the following output. - -[3]: three -[1,3]: one-three -[1,2,3]: one-two-three -[1,2,3,0,1,2,3]: one-two-three-zero-one-two-three - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp deleted file mode 100644 index e14da9f2add..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp +++ /dev/null @@ -1,124 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - - // Define a custom parameter attribute that takes a single message argument. - -[AttributeUsage(AttributeTargets::Parameter)] -public ref class ArgumentUsageAttribute: public Attribute -{ - protected: - // usageMsg is storage for the attribute message. - String^ usageMsg; - - public: - // This is the attribute constructor. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - } - - - // Override ToString() to append the message to what the base generates. - virtual String^ ToString() override - { - return String::Concat( Attribute::ToString(), ":", usageMsg ); - } -} ; - - - // Define a custom parameter attribute that generates a GUID for each instance. -[AttributeUsage(AttributeTargets::Parameter)] -public ref class ArgumentIDAttribute : Attribute -{ - protected: - // instanceGUID is storage for the generated GUID. - Guid instanceGUID; - - public: - // This is the attribute constructor, which generates the GUID. - ArgumentIDAttribute() - { - this->instanceGUID = Guid::NewGuid(); - } - - // Override ToString() to append the GUID to what the base generates. - virtual String^ ToString() override - { - return String::Concat( Attribute::ToString(), ".", instanceGUID.ToString() ); - } -}; - -public ref class TestClass -{ - public: - // Assign an ArgumentID attribute to each parameter. - // Assign an ArgumentUsage attribute to each parameter. - void TestMethod( [ArgumentID][ArgumentUsage("Must pass an array here.")]array^strArray, - [ArgumentID][ArgumentUsage("Can pass param list or array here.")]array^strList ){} -}; - -int main() -{ - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = TestClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // There will be two elements in pInfoArray, one for each parameter. - array^pInfoArray = mInfo->GetParameters(); - if (pInfoArray != nullptr) - { - // Create an instance of the argument usage attribute on strArray. - ArgumentUsageAttribute^ arrayUsageAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create another instance of the argument usage attribute on strArray. - ArgumentUsageAttribute^ arrayUsageAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create an instance of the argument usage attribute on strList. - ArgumentUsageAttribute^ listUsageAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentUsageAttribute::typeid )); - - // Create an instance of the argument ID attribute on strArray. - ArgumentIDAttribute^ arrayIDAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentIDAttribute::typeid )); - - // Create another instance of the argument ID attribute on strArray. - ArgumentIDAttribute^ arrayIDAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentIDAttribute::typeid )); - - // Create an instance of the argument ID attribute on strList. - ArgumentIDAttribute^ listIDAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentIDAttribute::typeid )); - - // Compare various pairs of attributes for equality. - Console::WriteLine( "\nCompare a usage attribute instance to " - "another instance of the same attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayUsageAttr1->ToString(), arrayUsageAttr2->ToString(), arrayUsageAttr1->Equals( arrayUsageAttr2 ) ); - Console::WriteLine( "\nCompare a usage attribute to another usage attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayUsageAttr1->ToString(), listUsageAttr->ToString(), arrayUsageAttr1->Equals( listUsageAttr ) ); - Console::WriteLine( "\nCompare an ID attribute instance to " - "another instance of the same attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayIDAttr1->ToString(), arrayIDAttr2->ToString(), arrayIDAttr1->Equals( arrayIDAttr2 ) ); - Console::WriteLine( "\nCompare an ID attribute to another ID attribute:" ); - Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayIDAttr1->ToString(), listIDAttr->ToString(), arrayIDAttr1->Equals( listIDAttr ) ); - } - else - { - Console::WriteLine( "The parameters information could not be retrieved for method {0}.", mInfo->Name ); - } -} -/* -The example displays an output similar to the following: - Compare a usage attribute instance to another instance of the same attribute: - "ArgumentUsageAttribute:Must pass an array here." == - "ArgumentUsageAttribute:Must pass an array here." ? True - - Compare a usage attribute to another usage attribute: - "ArgumentUsageAttribute:Must pass an array here." == - "ArgumentUsageAttribute:Can pass param list or array here." ? False - - Compare an ID attribute instance to another instance of the same attribute: - "ArgumentIDAttribute.22d1a176-4aca-427b-8230-0c1563e13187" == - "ArgumentIDAttribute.7fa94bba-c290-48e1-a0de-e22f6c1e64f1" ? False - - Compare an ID attribute to another ID attribute: - "ArgumentIDAttribute.22d1a176-4aca-427b-8230-0c1563e13187" == - "ArgumentIDAttribute.b9eea70d-9c0f-459e-a984-19c46b6c8789" ? False -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp deleted file mode 100644 index b5764d952ba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp +++ /dev/null @@ -1,130 +0,0 @@ - -// -// Example for the Attribute::GetCustomAttribute( ParameterInfo*, Type* ) -// method. -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; - -namespace NDP_UE_CPP -{ - - // - // Define a custom parameter attribute that takes a single message argument. - - [AttributeUsage(AttributeTargets::Parameter)] - public ref class ArgumentUsageAttribute: public Attribute - { - protected: - - // usageMsg is storage for the attribute message. - String^ usageMsg; - - public: - - // This is the attribute constructor. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - } - - - property String^ Message - { - // This is the Message property for the attribute. - String^ get() - { - return usageMsg; - } - - void set( String^ value ) - { - this->usageMsg = value; - } - } - }; - // - - public ref class BaseClass - { - public: - - // Assign an ArgumentUsage attribute to the strArray parameter. - // Assign a ParamArray attribute to strList. - virtual void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, - ...array^strList ){} - }; - - public ref class DerivedClass: public BaseClass - { - public: - - // Assign an ArgumentUsage attributes to the strList parameter. - virtual void TestMethod( array^strArray, [ArgumentUsage( - "Can pass a parameter list or array here.")]array^strList ) override {} - }; -} - -int main() -{ - Console::WriteLine( "This example of Attribute::GetCustomAttribute( Param" - "eterInfo*, Type* )\ngenerates the following output." ); - - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = NDP_UE_CPP::DerivedClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // Iterate through the ParameterInfo array for the method parameters. - array^pInfoArray = mInfo->GetParameters(); - if ( pInfoArray != nullptr ) - { - // This implements foreach( ParameterInfo* paramInfo in pInfoArray ). - IEnumerator^ myEnum = pInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ParameterInfo^ paramInfo = safe_cast(myEnum->Current); - - // See if the ParamArray attribute is defined. - bool isDef = Attribute::IsDefined( paramInfo, ParamArrayAttribute::typeid ); - if ( isDef ) - Console::WriteLine( "\nThe ParamArray attribute is defined for \n" - "parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - - // See if ParamUsageAttribute is defined. - // If so, display a message. - NDP_UE_CPP::ArgumentUsageAttribute^ usageAttr = static_cast(Attribute::GetCustomAttribute( paramInfo, NDP_UE_CPP::ArgumentUsageAttribute::typeid )); - if ( usageAttr != nullptr ) - { - Console::WriteLine( "\nThe ArgumentUsage attribute is defined for \n" - "parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - Console::WriteLine( "\n The usage " - "message for {0} is:\n \"{1}\".", paramInfo->Name, usageAttr->Message ); - } - } - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); -} - -/* -This example of Attribute::GetCustomAttribute( ParameterInfo*, Type* ) -generates the following output. - -The ArgumentUsage attribute is defined for -parameter strArray of method TestMethod. - - The usage message for strArray is: - "Must pass an array here.". - -The ParamArray attribute is defined for -parameter strList of method TestMethod. - -The ArgumentUsage attribute is defined for -parameter strList of method TestMethod. - - The usage message for strList is: - "Can pass a parameter list or array here.". -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp deleted file mode 100644 index 8197cb5c956..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp +++ /dev/null @@ -1,152 +0,0 @@ - -// -// Example for the Attribute::GetCustomAttribute( ParameterInfo*, Type*, bool ) -// method. -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; - -namespace NDP_UE_CPP -{ - // Define a custom parameter attribute that takes a single message argument. - - [AttributeUsage(AttributeTargets::Parameter)] - public ref class ArgumentUsageAttribute: public Attribute - { - protected: - - // usageMsg is storage for the attribute message. - String^ usageMsg; - - public: - - // This is the attribute constructor. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - } - - property String^ Message - { - // This is the Message property for the attribute. - String^ get() - { - return usageMsg; - } - - void set( String^ value ) - { - this->usageMsg = value; - } - } - }; - - public ref class BaseClass - { - public: - - // Assign an ArgumentUsage attribute to the strArray parameter. - // Assign a ParamArray attribute to strList. - virtual void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, - ...array^strList ){} - }; - - public ref class DerivedClass: public BaseClass - { - public: - - // Assign an ArgumentUsage attributes to the strList parameter. - virtual void TestMethod( array^strArray, [ArgumentUsage( - "Can pass a parameter list or array here.")]array^strList ) override {} - - }; - - void DisplayParameterAttributes( MethodInfo^ mInfo, array^pInfoArray, bool includeInherited ) - { - Console::WriteLine( "\nParameter attribute information for method \"{0}" - "\"\nincludes inheritance from base class: {1}.", mInfo->Name, includeInherited ? (String^)"Yes" : "No" ); - - // This implements foreach( ParameterInfo* paramInfo in pInfoArray ). - IEnumerator^ myEnum = pInfoArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ParameterInfo^ paramInfo = safe_cast(myEnum->Current); - - // See if the ParamArray attribute is defined. - bool isDef = Attribute::IsDefined( paramInfo, ParamArrayAttribute::typeid ); - if ( isDef ) - Console::WriteLine( "\n The ParamArray attribute is defined " - "for \n parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - - // See if ParamUsageAttribute is defined. - // If so, display a message. - ArgumentUsageAttribute^ usageAttr = static_cast(Attribute::GetCustomAttribute( paramInfo, ArgumentUsageAttribute::typeid, includeInherited )); - if ( usageAttr != nullptr ) - { - Console::WriteLine( "\n The ArgumentUsage attribute is defined " - "for \n parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); - Console::WriteLine( "\n The usage " - "message for {0} is:\n \"{1}\".", paramInfo->Name, usageAttr->Message ); - } - } - } - -} - -int main() -{ - Console::WriteLine( "This example of Attribute::GetCustomAttribute( ParameterInfo*, " - "Type*, bool )\ngenerates the following output." ); - - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = NDP_UE_CPP::DerivedClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // Iterate through the ParameterInfo array for the method parameters. - array^pInfoArray = mInfo->GetParameters(); - if ( pInfoArray != nullptr ) - { - NDP_UE_CPP::DisplayParameterAttributes( mInfo, pInfoArray, false ); - NDP_UE_CPP::DisplayParameterAttributes( mInfo, pInfoArray, true ); - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); -} - -/* -This example of Attribute::GetCustomAttribute( ParameterInfo*, Type*, bool ) -generates the following output. - -Parameter attribute information for method "TestMethod" -includes inheritance from base class: No. - - The ParamArray attribute is defined for - parameter strList of method TestMethod. - - The ArgumentUsage attribute is defined for - parameter strList of method TestMethod. - - The usage message for strList is: - "Can pass a parameter list or array here.". - -Parameter attribute information for method "TestMethod" -includes inheritance from base class: Yes. - - The ArgumentUsage attribute is defined for - parameter strArray of method TestMethod. - - The usage message for strArray is: - "Must pass an array here.". - - The ParamArray attribute is defined for - parameter strList of method TestMethod. - - The ArgumentUsage attribute is defined for - parameter strList of method TestMethod. - - The usage message for strList is: - "Can pass a parameter list or array here.". -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp deleted file mode 100644 index 9cfaa32643e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp +++ /dev/null @@ -1,136 +0,0 @@ - -// -// Example for the Attribute::TypeId property. -using namespace System; -using namespace System::Reflection; - -namespace NDP_UE_CPP -{ - - // Define a custom parameter attribute that takes a single message argument. - - [AttributeUsage(AttributeTargets::Parameter)] - public ref class ArgumentUsageAttribute: public Attribute - { - protected: - - // This is storage for the attribute message and unique ID. - String^ usageMsg; - Guid instanceGUID; - - public: - - // The constructor saves the message and creates a unique identifier. - ArgumentUsageAttribute( String^ UsageMsg ) - { - this->usageMsg = UsageMsg; - this->instanceGUID = Guid::NewGuid(); - } - - property String^ Message - { - // This is the Message property for the attribute. - String^ get() - { - return usageMsg; - } - - void set( String^ value ) - { - this->usageMsg = value; - } - } - - property Object^ TypeId - { - // Override TypeId to provide a unique identifier for the instance. - virtual Object^ get() override - { - return instanceGUID; - } - } - - // Override ToString() to append the message to - // what the base generates. - virtual String^ ToString() override - { - return String::Concat( Attribute::ToString(), ":", usageMsg ); - } - }; - - public ref class TestClass - { - public: - - // Assign an ArgumentUsage attribute to each parameter. - // Assign a ParamArray attribute to strList. - void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, - [ArgumentUsage("Can pass a param list or array here.")]array^strList ){} - }; - - static void ShowAttributeTypeIds() - { - // Get the class type, and then get the MethodInfo object - // for TestMethod to access its metadata. - Type^ clsType = TestClass::typeid; - MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); - - // There will be two elements in pInfoArray, one for each parameter. - array^pInfoArray = mInfo->GetParameters(); - if ( pInfoArray != nullptr ) - { - // Create an instance of the param array attribute on strList. - ParamArrayAttribute^ listArrayAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ParamArrayAttribute::typeid )); - - // Create an instance of the argument usage attribute on strArray. - ArgumentUsageAttribute^ arrayUsageAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create another instance of the argument usage attribute - // on strArray. - ArgumentUsageAttribute^ arrayUsageAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); - - // Create an instance of the argument usage attribute on strList. - ArgumentUsageAttribute^ listUsageAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentUsageAttribute::typeid )); - - // Display the attributes and corresponding TypeId values. - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", listArrayAttr->ToString(), listArrayAttr->TypeId ); - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", arrayUsageAttr1->ToString(), arrayUsageAttr1->TypeId ); - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", arrayUsageAttr2->ToString(), arrayUsageAttr2->TypeId ); - Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", listUsageAttr->ToString(), listUsageAttr->TypeId ); - } - else - Console::WriteLine( "The parameters information could " - "not be retrieved for method {0}.", mInfo->Name ); - } -} - -int main() -{ - Console::WriteLine( "This example of the Attribute::TypeId property\n" - "generates the following output." ); - Console::WriteLine( "\nCreate instances from a derived Attribute " - "class that implements TypeId, \nand then " - "display the attributes and corresponding TypeId values:" ); - NDP_UE_CPP::ShowAttributeTypeIds(); -} - -/* -This example of the Attribute::TypeId property -generates output similar to the following: - -Create instances from a derived Attribute class that implements TypeId, -and then display the attributes and corresponding TypeId values: - -"System.ParamArrayAttribute" -TypeId: System.ParamArrayAttribute - -"NDP_UE_CPP.ArgumentUsageAttribute:Must pass an array here." -TypeId: 9316015d-1219-4ce1-b317-e71efb23d42e - -"NDP_UE_CPP.ArgumentUsageAttribute:Must pass an array here." -TypeId: ebc1ba23-2573-4c1f-aea6-90515e733796 - -"NDP_UE_CPP.ArgumentUsageAttribute:Can pass a param list or array here." -TypeId: 624af10b-9bba-4403-a97e-46927e7385fb -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp deleted file mode 100644 index b6498b4a22a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Example of BitConverter class methods. -using namespace System; -int main() -{ - String^ formatter = "{0,25}{1,30}"; - double aDoubl = 0.1111111111111111111; - float aSingl = 0.1111111111111111111F; - __int64 aLong = 1111111111111111111; - int anInt = 1111111111; - short aShort = 11111; - __wchar_t aChar = L'*'; - bool aBool = true; - Console::WriteLine( "This example of methods of the BitConverter class" - "\ngenerates the following output.\n" ); - Console::WriteLine( formatter, "argument", "byte array" ); - Console::WriteLine( formatter, "--------", "----------" ); - - // Convert values to Byte arrays and display them. - Console::WriteLine( formatter, aDoubl, BitConverter::ToString( BitConverter::GetBytes( aDoubl ) ) ); - Console::WriteLine( formatter, aSingl, BitConverter::ToString( BitConverter::GetBytes( aSingl ) ) ); - Console::WriteLine( formatter, aLong, BitConverter::ToString( BitConverter::GetBytes( aLong ) ) ); - Console::WriteLine( formatter, anInt, BitConverter::ToString( BitConverter::GetBytes( anInt ) ) ); - Console::WriteLine( formatter, aShort, BitConverter::ToString( BitConverter::GetBytes( aShort ) ) ); - Console::WriteLine( formatter, aChar, BitConverter::ToString( BitConverter::GetBytes( aChar ) ) ); - Console::WriteLine( formatter, aBool, BitConverter::ToString( BitConverter::GetBytes( aBool ) ) ); -} - -/* -This example of methods of the BitConverter class -generates the following output. - - argument byte array - -------- ---------- - 0.111111111111111 1C-C7-71-1C-C7-71-BC-3F - 0.1111111 39-8E-E3-3D - 1111111111111111111 C7-71-C4-2B-AB-75-6B-0F - 1111111111 C7-35-3A-42 - 11111 67-2B - * 2A-00 - True 01 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp deleted file mode 100644 index 57627564464..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -// Example of the BitConverter::IsLittleEndian field. -using namespace System; -int main() -{ - Console::WriteLine( "This example of the BitConverter::IsLittleEndian field " - "generates \nthe following output when run on " - "x86-class computers.\n" ); - Console::WriteLine( "IsLittleEndian: {0}", BitConverter::IsLittleEndian ); -} - -/* -This example of the BitConverter::IsLittleEndian field generates -the following output when run on x86-class computers. - -IsLittleEndian: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp deleted file mode 100644 index 011dda5201d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -// Example of the BitConverter::Int64BitsToDouble method. -using namespace System; - -// Reinterpret the __int64 argument as a double. -void LongBitsToDouble( __int64 argument ) -{ - double doubleValue; - doubleValue = BitConverter::Int64BitsToDouble( argument ); - - // Display the argument in hexadecimal. - Console::WriteLine( "{0,20}{1,27:E16}", String::Format( "0x{0:X16}", argument ), doubleValue ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::Int64BitsToDouble( " - "__int64 ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,20}{1,27:E16}", "__int64 argument", "double value" ); - Console::WriteLine( "{0,20}{1,27:E16}", "----------------", "------------" ); - - // Convert __int64 values and display the results. - LongBitsToDouble( 0 ); - LongBitsToDouble( 0x3FF0000000000000 ); - LongBitsToDouble( 0x402E000000000000 ); - LongBitsToDouble( 0x406FE00000000000 ); - LongBitsToDouble( 0x41EFFFFFFFE00000 ); - LongBitsToDouble( 0x3F70000000000000 ); - LongBitsToDouble( 0x3DF0000000000000 ); - LongBitsToDouble( 0x0000000000000001 ); - LongBitsToDouble( 0x000000000000FFFF ); - LongBitsToDouble( 0x0000FFFFFFFFFFFF ); - LongBitsToDouble( 0xFFFFFFFFFFFFFFFF ); - LongBitsToDouble( 0xFFF0000000000000 ); - LongBitsToDouble( 0x7FF0000000000000 ); - LongBitsToDouble( 0xFFEFFFFFFFFFFFFF ); - LongBitsToDouble( 0x7FEFFFFFFFFFFFFF ); - LongBitsToDouble( Int64::MinValue ); - LongBitsToDouble( Int64::MaxValue ); -} - -/* -This example of the BitConverter::Int64BitsToDouble( __int64 ) -method generates the following output. - - __int64 argument double value - ---------------- ------------ - 0x0000000000000000 0.0000000000000000E+000 - 0x3FF0000000000000 1.0000000000000000E+000 - 0x402E000000000000 1.5000000000000000E+001 - 0x406FE00000000000 2.5500000000000000E+002 - 0x41EFFFFFFFE00000 4.2949672950000000E+009 - 0x3F70000000000000 3.9062500000000000E-003 - 0x3DF0000000000000 2.3283064365386963E-010 - 0x0000000000000001 4.9406564584124654E-324 - 0x000000000000FFFF 3.2378592100206092E-319 - 0x0000FFFFFFFFFFFF 1.3906711615669959E-309 - 0xFFFFFFFFFFFFFFFF NaN - 0xFFF0000000000000 -Infinity - 0x7FF0000000000000 Infinity - 0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308 - 0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308 - 0x8000000000000000 0.0000000000000000E+000 - 0x7FFFFFFFFFFFFFFF NaN -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp deleted file mode 100644 index 347acebc505..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -// Example of the BitConverter::DoubleToInt64Bits method. -using namespace System; - -// Reinterpret the double argument as an __int64. -void DoubleToLongBits( double argument ) -{ - __int64 longValue; - longValue = BitConverter::DoubleToInt64Bits( argument ); - - // Display the resulting __int64 in hexadecimal. - Console::WriteLine( "{0,25:E16}{1,23:X16}", argument, longValue ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::DoubleToInt64Bits( " - "double ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,25:E16}{1,23:X16}", "double argument", "hexadecimal value" ); - Console::WriteLine( "{0,25:E16}{1,23:X16}", "---------------", "-----------------" ); - - // Convert double values and display the results. - DoubleToLongBits( 1.0 ); - DoubleToLongBits( 15.0 ); - DoubleToLongBits( 255.0 ); - DoubleToLongBits( 4294967295.0 ); - DoubleToLongBits( 0.00390625 ); - DoubleToLongBits( 0.00000000023283064365386962890625 ); - DoubleToLongBits( 1.234567890123E-300 ); - DoubleToLongBits( 1.23456789012345E-150 ); - DoubleToLongBits( 1.2345678901234565 ); - DoubleToLongBits( 1.2345678901234567 ); - DoubleToLongBits( 1.2345678901234569 ); - DoubleToLongBits( 1.23456789012345678E+150 ); - DoubleToLongBits( 1.234567890123456789E+300 ); - DoubleToLongBits( Double::MinValue ); - DoubleToLongBits( Double::MaxValue ); - DoubleToLongBits( Double::Epsilon ); - DoubleToLongBits( Double::NaN ); - DoubleToLongBits( Double::NegativeInfinity ); - DoubleToLongBits( Double::PositiveInfinity ); -} - -/* -This example of the BitConverter::DoubleToInt64Bits( double ) -method generates the following output. - - double argument hexadecimal value - --------------- ----------------- - 1.0000000000000000E+000 3FF0000000000000 - 1.5000000000000000E+001 402E000000000000 - 2.5500000000000000E+002 406FE00000000000 - 4.2949672950000000E+009 41EFFFFFFFE00000 - 3.9062500000000000E-003 3F70000000000000 - 2.3283064365386963E-010 3DF0000000000000 - 1.2345678901230000E-300 01AA74FE1C1E7E45 - 1.2345678901234500E-150 20D02A36586DB4BB - 1.2345678901234565E+000 3FF3C0CA428C59FA - 1.2345678901234567E+000 3FF3C0CA428C59FB - 1.2345678901234569E+000 3FF3C0CA428C59FC - 1.2345678901234569E+150 5F182344CD3CDF9F - 1.2345678901234569E+300 7E3D7EE8BCBBD352 - -1.7976931348623157E+308 FFEFFFFFFFFFFFFF - 1.7976931348623157E+308 7FEFFFFFFFFFFFFF - 4.9406564584124654E-324 0000000000000001 - NaN FFF8000000000000 - -Infinity FFF0000000000000 - Infinity 7FF0000000000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp deleted file mode 100644 index d6d4ad9fb47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; - -int main() -{ - // Define Boolean true and false values. - array^ values = { true, false }; - - // Display the value and its corresponding byte array. - Console::WriteLine("{0,10}{1,16}\n", "Boolean", "Bytes"); - for each (Byte value in values) { - array^ bytes = BitConverter::GetBytes(value); - Console::WriteLine("{0,10}{1,16}", value, - BitConverter::ToString(bytes)); - } -} -// This example displays the following output: -// Boolean Bytes -// -// True 01 -// False 00 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp deleted file mode 100644 index 47d776fe8a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( __wchar_t ) method. -using namespace System; - -// Convert a __wchar_t argument to a byte array and display it. -void GetBytesChar( __wchar_t argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,10}{1,16}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( __wchar_t ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,10}{1,16}", "__wchar_t", "byte array" ); - Console::WriteLine( "{0,10}{1,16}", "---------", "----------" ); - - // Convert __wchar_t values and display the results. - GetBytesChar( L'\0' ); - GetBytesChar( L' ' ); - GetBytesChar( L'*' ); - GetBytesChar( L'3' ); - GetBytesChar( L'A' ); - GetBytesChar( L'[' ); - GetBytesChar( L'a' ); - GetBytesChar( L'{' ); -} - -/* -This example of the BitConverter::GetBytes( __wchar_t ) -method generates the following output. - - __wchar_t byte array - --------- ---------- - 00-00 - 20-00 - * 2A-00 - 3 33-00 - A 41-00 - [ 5B-00 - a 61-00 - { 7B-00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp deleted file mode 100644 index 000a26b3a68..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( double ) method. -using namespace System; - -// Convert a double argument to a byte array and display it. -void GetBytesDouble( double argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,25:E16}{1,30}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( double ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,25:E16}{1,30}", "double", "byte array" ); - Console::WriteLine( "{0,25:E16}{1,30}", "------", "----------" ); - - // Convert double values and display the results. - GetBytesDouble( 0.0 ); - GetBytesDouble( 1.0 ); - GetBytesDouble( 255.0 ); - GetBytesDouble( 4294967295.0 ); - GetBytesDouble( 0.00390625 ); - GetBytesDouble( 0.00000000023283064365386962890625 ); - GetBytesDouble( 1.23456789012345E-300 ); - GetBytesDouble( 1.2345678901234565 ); - GetBytesDouble( 1.2345678901234567 ); - GetBytesDouble( 1.2345678901234569 ); - GetBytesDouble( 1.23456789012345678E+300 ); - GetBytesDouble( Double::MinValue ); - GetBytesDouble( Double::MaxValue ); - GetBytesDouble( Double::Epsilon ); - GetBytesDouble( Double::NaN ); - GetBytesDouble( Double::NegativeInfinity ); - GetBytesDouble( Double::PositiveInfinity ); -} - -/* -This example of the BitConverter::GetBytes( double ) -method generates the following output. - - double byte array - ------ ---------- - 0.0000000000000000E+000 00-00-00-00-00-00-00-00 - 1.0000000000000000E+000 00-00-00-00-00-00-F0-3F - 2.5500000000000000E+002 00-00-00-00-00-E0-6F-40 - 4.2949672950000000E+009 00-00-E0-FF-FF-FF-EF-41 - 3.9062500000000000E-003 00-00-00-00-00-00-70-3F - 2.3283064365386963E-010 00-00-00-00-00-00-F0-3D - 1.2345678901234500E-300 DF-88-1E-1C-FE-74-AA-01 - 1.2345678901234565E+000 FA-59-8C-42-CA-C0-F3-3F - 1.2345678901234567E+000 FB-59-8C-42-CA-C0-F3-3F - 1.2345678901234569E+000 FC-59-8C-42-CA-C0-F3-3F - 1.2345678901234569E+300 52-D3-BB-BC-E8-7E-3D-7E - -1.7976931348623157E+308 FF-FF-FF-FF-FF-FF-EF-FF - 1.7976931348623157E+308 FF-FF-FF-FF-FF-FF-EF-7F - 4.9406564584124654E-324 01-00-00-00-00-00-00-00 - NaN 00-00-00-00-00-00-F8-FF - -Infinity 00-00-00-00-00-00-F0-FF - Infinity 00-00-00-00-00-00-F0-7F -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp deleted file mode 100644 index c9dbcc43471..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( float ) method. -using namespace System; - -// Convert a float argument to a byte array and display it. -void GetBytesSingle( float argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,16:E7}{1,20}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( float ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,16:E7}{1,20}", "float", "byte array" ); - Console::WriteLine( "{0,16:E7}{1,20}", "-----", "----------" ); - - // Convert float values and display the results. - GetBytesSingle( 0.0F ); - GetBytesSingle( 1.0F ); - GetBytesSingle( 15.0F ); - GetBytesSingle( 65535.0F ); - GetBytesSingle( 0.00390625F ); - GetBytesSingle( 0.00000000023283064365386962890625F ); - GetBytesSingle( 1.2345E-35F ); - GetBytesSingle( 1.2345671F ); - GetBytesSingle( 1.2345673F ); - GetBytesSingle( 1.2345677F ); - GetBytesSingle( 1.23456789E+35F ); - GetBytesSingle( Single::MinValue ); - GetBytesSingle( Single::MaxValue ); - GetBytesSingle( Single::Epsilon ); - GetBytesSingle( Single::NaN ); - GetBytesSingle( Single::NegativeInfinity ); - GetBytesSingle( Single::PositiveInfinity ); -} - -/* -This example of the BitConverter::GetBytes( float ) -method generates the following output. - - float byte array - ----- ---------- - 0.0000000E+000 00-00-00-00 - 1.0000000E+000 00-00-80-3F - 1.5000000E+001 00-00-70-41 - 6.5535000E+004 00-FF-7F-47 - 3.9062500E-003 00-00-80-3B - 2.3283064E-010 00-00-80-2F - 1.2345000E-035 49-46-83-05 - 1.2345671E+000 4B-06-9E-3F - 1.2345673E+000 4D-06-9E-3F - 1.2345676E+000 50-06-9E-3F - 1.2345679E+035 1E-37-BE-79 - -3.4028235E+038 FF-FF-7F-FF - 3.4028235E+038 FF-FF-7F-7F - 1.4012985E-045 01-00-00-00 - NaN 00-00-C0-FF - -Infinity 00-00-80-FF - Infinity 00-00-80-7F -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp deleted file mode 100644 index 85dfd8f960e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of integers. - array^ values = { 0, 15, -15, 10000, -10000, - Int16::MinValue, Int16::MaxValue}; - - // Convert each integer to a byte array. - Console::WriteLine("{0,16}{1,10}{2,17}", "Integer", - "Endian", "Byte Array"); - Console::WriteLine("{0,16}{1,10}{2,17}", "---", "------", - "----------"); - for each (int value in values) { - array^ byteArray = BitConverter::GetBytes(value); - Console::WriteLine("{0,16}{1,10}{2,17}", value, - BitConverter::IsLittleEndian ? "Little" : " Big", - BitConverter::ToString(byteArray)); - } -} -// This example displays output like the following: -// Integer Endian Byte Array -// --- ------ ---------- -// 0 Little 00-00 -// 15 Little 0F-00 -// -15 Little F1-FF -// 10000 Little 10-27 -// -10000 Little F0-D8 -// -32768 Little 00-80 -// 32767 Little FF-7F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp deleted file mode 100644 index f1a781ff180..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of integers. - array^ values = { 0, 15, -15, 0x100000, -0x100000, 1000000000, - -1000000000, Int32::MinValue, Int32::MaxValue }; - - // Convert each integer to a byte array. - Console::WriteLine("{0,16}{1,10}{2,17}", "Integer", - "Endian", "Byte Array"); - Console::WriteLine("{0,16}{1,10}{2,17}", "---", "------", - "----------" ); - for each (int value in values) { - array^ byteArray = BitConverter::GetBytes(value); - Console::WriteLine("{0,16}{1,10}{2,17}", value, - BitConverter::IsLittleEndian ? "Little" : " Big", - BitConverter::ToString(byteArray)); - } -} -// This example displays output like the following: -// Integer Endian Byte Array -// --- ------ ---------- -// 0 Little 00-00-00-00 -// 15 Little 0F-00-00-00 -// -15 Little F1-FF-FF-FF -// 1048576 Little 00-00-10-00 -// -1048576 Little 00-00-F0-FF -// 1000000000 Little 00-CA-9A-3B -// -1000000000 Little 00-36-65-C4 -// -2147483648 Little 00-00-00-80 -// 2147483647 Little FF-FF-FF-7F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp deleted file mode 100644 index dace2c6c7a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; - -void main() -{ - // Define an array of Int64 values. - array^ values = { 0, 0xFFFFFF, -0xFFFFFF, 1000000000, -1000000000, - 0x100000000, -0x100000000, 0xAAAAAAAAAAAA, - -0xAAAAAAAAAAAA, 1000000000000000000, - -1000000000000000000, Int64::MinValue, - Int64::MaxValue}; - - Console::WriteLine( "{0,22}{1,10}{2,30}", "Int64", "Endian", "Byte Array"); - Console::WriteLine( "{0,22}{1,10}{2,30}", "----", "------", "----------"); - - for each (Int64 value in values) { - // Convert each Int64 value to a byte array. - array^ byteArray = BitConverter::GetBytes(value); - // Display the result. - Console::WriteLine("{0,22}{1,10}{2,30}", value, - BitConverter::IsLittleEndian ? "Little" : " Big", - BitConverter::ToString(byteArray)); - } -} -// The example displays output like the following: -// Int64 Endian Byte Array -// ---- ------ ---------- -// 0 Little 00-00-00-00-00-00-00-00 -// 16777215 Little FF-FF-FF-00-00-00-00-00 -// -16777215 Little 01-00-00-FF-FF-FF-FF-FF -// 1000000000 Little 00-CA-9A-3B-00-00-00-00 -// -1000000000 Little 00-36-65-C4-FF-FF-FF-FF -// 4294967296 Little 00-00-00-00-01-00-00-00 -// -4294967296 Little 00-00-00-00-FF-FF-FF-FF -// 187649984473770 Little AA-AA-AA-AA-AA-AA-00-00 -// -187649984473770 Little 56-55-55-55-55-55-FF-FF -// 1000000000000000000 Little 00-00-64-A7-B3-B6-E0-0D -// -1000000000000000000 Little 00-00-9C-58-4C-49-1F-F2 -// -9223372036854775808 Little 00-00-00-00-00-00-00-80 -// 9223372036854775807 Little FF-FF-FF-FF-FF-FF-FF-7F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp deleted file mode 100644 index 5ec8af9b911..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( unsigned short ) method. -using namespace System; - -// Convert an unsigned short argument to a byte array and display it. -void GetBytesUInt16( unsigned short argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,14}{1,13}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " - "short ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,14}{1,13}", "unsigned short", "byte array" ); - Console::WriteLine( "{0,14}{1,13}", "--------------", "----------" ); - - // Convert unsigned short values and display the results. - GetBytesUInt16( 15 ); - GetBytesUInt16( 1023 ); - GetBytesUInt16( 10000 ); - GetBytesUInt16( UInt16::MinValue ); - GetBytesUInt16( Int16::MaxValue ); - GetBytesUInt16( UInt16::MaxValue ); -} - -/* -This example of the BitConverter::GetBytes( unsigned short ) -method generates the following output. - -unsigned short byte array --------------- ---------- - 15 0F-00 - 1023 FF-03 - 10000 10-27 - 0 00-00 - 32767 FF-7F - 65535 FF-FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp deleted file mode 100644 index e7017024141..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( unsigned int ) method. -using namespace System; - -// Convert an unsigned int argument to a byte array and display it. -void GetBytesUInt32( unsigned int argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,16}{1,20}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " - "int ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,16}{1,20}", "unsigned int", "byte array" ); - Console::WriteLine( "{0,16}{1,20}", "------------", "----------" ); - - // Convert unsigned int values and display the results. - GetBytesUInt32( 15 ); - GetBytesUInt32( 1023 ); - GetBytesUInt32( 0x100000 ); - GetBytesUInt32( 1000000000 ); - GetBytesUInt32( UInt32::MinValue ); - GetBytesUInt32( Int32::MaxValue ); - GetBytesUInt32( UInt32::MaxValue ); -} - -/* -This example of the BitConverter::GetBytes( unsigned int ) -method generates the following output. - - unsigned int byte array - ------------ ---------- - 15 0F-00-00-00 - 1023 FF-03-00-00 - 1048576 00-00-10-00 - 1000000000 00-CA-9A-3B - 0 00-00-00-00 - 2147483647 FF-FF-FF-7F - 4294967295 FF-FF-FF-FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp deleted file mode 100644 index 7c94f1c6895..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -// Example of the BitConverter::GetBytes( unsigned __int64 ) method. -using namespace System; - -// Convert an unsigned __int64 argument to a byte array and display it. -void GetBytesUInt64( unsigned __int64 argument ) -{ - array^byteArray = BitConverter::GetBytes( argument ); - Console::WriteLine( "{0,22}{1,30}", argument, BitConverter::ToString( byteArray ) ); -} - -int main() -{ - Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " - "__int64 ) \nmethod generates the following output.\n" ); - Console::WriteLine( "{0,22}{1,30}", "unsigned __int64", "byte array" ); - Console::WriteLine( "{0,22}{1,30}", "----------------", "----------" ); - - // Convert unsigned __int64 values and display the results. - GetBytesUInt64( 0xFFFFFF ); - GetBytesUInt64( 1000000000 ); - GetBytesUInt64( 0x100000000 ); - GetBytesUInt64( 0xAAAAAAAAAAAA ); - GetBytesUInt64( 1000000000000000000 ); - GetBytesUInt64( 10000000000000000000 ); - GetBytesUInt64( UInt64::MinValue ); - GetBytesUInt64( Int64::MaxValue ); - GetBytesUInt64( UInt64::MaxValue ); -} - -/* -This example of the BitConverter::GetBytes( unsigned __int64 ) -method generates the following output. - - unsigned __int64 byte array - ---------------- ---------- - 16777215 FF-FF-FF-00-00-00-00-00 - 1000000000 00-CA-9A-3B-00-00-00-00 - 4294967296 00-00-00-00-01-00-00-00 - 187649984473770 AA-AA-AA-AA-AA-AA-00-00 - 1000000000000000000 00-00-64-A7-B3-B6-E0-0D - 10000000000000000000 00-00-E8-89-04-23-C7-8A - 0 00-00-00-00-00-00-00-00 - 9223372036854775807 FF-FF-FF-FF-FF-FF-FF-7F - 18446744073709551615 FF-FF-FF-FF-FF-FF-FF-FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp deleted file mode 100644 index 6be5740936b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -// Example of the BitConverter::ToString( unsigned char[ ] ) method. -using namespace System; - -// Display a byte array with a name. -void WriteByteArray( array^bytes, String^ name ) -{ - String^ underLine = "--------------------------------"; - Console::WriteLine( name ); - Console::WriteLine( underLine->Substring( 0, Math::Min( name->Length, underLine->Length ) ) ); - Console::WriteLine( BitConverter::ToString( bytes ) ); - Console::WriteLine(); -} - -int main() -{ - array^arrayOne = {0,1,2,4,8,16,32,64,128,255}; - array^arrayTwo = {32,0,0,42,0,65,0,125,0,197,0,168,3,41,4,172,32}; - array^arrayThree = {15,0,0,128,16,39,240,216,241,255,127}; - array^arrayFour = {15,0,0,0,0,16,0,255,3,0,0,202,154,59,255,255,255,255,127}; - Console::WriteLine( "This example of the " - "BitConverter::ToString( unsigned char[ ] ) \n" - "method generates the following output.\n" ); - WriteByteArray( arrayOne, "arrayOne" ); - WriteByteArray( arrayTwo, "arrayTwo" ); - WriteByteArray( arrayThree, "arrayThree" ); - WriteByteArray( arrayFour, "arrayFour" ); -} - -/* -This example of the BitConverter::ToString( unsigned char[ ] ) -method generates the following output. - -arrayOne --------- -00-01-02-04-08-10-20-40-80-FF - -arrayTwo --------- -20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20 - -arrayThree ----------- -0F-00-00-80-10-27-F0-D8-F1-FF-7F - -arrayFour ---------- -0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp deleted file mode 100644 index a35ba6d8dc5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -// Example of some BitConverter::ToString( ) method overloads. -using namespace System; - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes, String^ name ) -{ - const int rowSize = 20; - String^ underLine = "--------------------------------"; - int iter; - Console::WriteLine( name ); - Console::WriteLine( underLine->Substring( 0, Math::Min( name->Length, underLine->Length ) ) ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^arrayOne = {0,0,0,0,128,63,0,0,112,65,0,255,127,71,0,0,128,59,0,0,128,47,73,70,131,5,75,6,158,63,77,6,158,63,80,6,158,63,30,55,190,121,255,255,127,255,255,127,127,1,0,0,0,192,255,0,0,128,255,0,0,128,127}; - array^arrayTwo = {255,255,255,0,0,20,0,33,0,0,0,1,0,0,0,100,167,179,182,224,13,0,202,154,59,0,143,91,0,170,170,170,170,170,170,0,0,232,137,4,35,199,138,255,232,244,255,252,205,255,255,129}; - array^arrayThree = {0,222,0,0,0,224,111,64,0,0,224,255,255,255,239,65,0,0,131,0,0,0,112,63,0,143,0,100,0,0,240,61,223,136,30,28,254,116,170,1,250,89,140,66,202,192,243,63,251,89,140,66,202,192,243,63,252,89,140,66,202,192,243,63,82,211,187,188,232,126,255,255,255,244,255,239,127,1,0,0,0,10,17,0,0,248,255,0,88,0,91,0,0,240,255,0,0,240,157}; - Console::WriteLine( "This example of the\n" - " BitConverter::ToString( unsigned char[ ], int ) and \n" - " BitConverter::ToString( unsigned char[ ], int, int ) \n" - "methods generates the following output.\n" ); - WriteMultiLineByteArray( arrayOne, "arrayOne" ); - WriteMultiLineByteArray( arrayTwo, "arrayTwo" ); - WriteMultiLineByteArray( arrayThree, "arrayThree" ); -} - -/* -This example of the - BitConverter::ToString( unsigned char[ ], int ) and - BitConverter::ToString( unsigned char[ ], int, int ) -methods generates the following output. - -arrayOne --------- -00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00- -80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37- -BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00- -00-80-7F - -arrayTwo --------- -FF-FF-FF-00-00-14-00-21-00-00-00-01-00-00-00-64-A7-B3-B6-E0- -0D-00-CA-9A-3B-00-8F-5B-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04- -23-C7-8A-FF-E8-F4-FF-FC-CD-FF-FF-81 - -arrayThree ----------- -00-DE-00-00-00-E0-6F-40-00-00-E0-FF-FF-FF-EF-41-00-00-83-00- -00-00-70-3F-00-8F-00-64-00-00-F0-3D-DF-88-1E-1C-FE-74-AA-01- -FA-59-8C-42-CA-C0-F3-3F-FB-59-8C-42-CA-C0-F3-3F-FC-59-8C-42- -CA-C0-F3-3F-52-D3-BB-BC-E8-7E-FF-FF-FF-F4-FF-EF-7F-01-00-00- -00-0A-11-00-00-F8-FF-00-58-00-5B-00-00-F0-FF-00-00-F0-9D -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp deleted file mode 100644 index d867bc4145f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -// Example of the BitConverter::ToBoolean method. -using namespace System; - -int main() -{ - // Define an array of byte values. - array^ bytes = { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }; - - Console::WriteLine("{0,5}{1,16}{2,10}\n", "index", "array element", "bool" ); - // Convert each array element to a Boolean value. - for (int index = 0; index < bytes->Length; index++) - Console::WriteLine("{0,5}{1,16:X2}{2,10}", index, bytes[index], - BitConverter::ToBoolean(bytes, index)); -} -// The example displays the following output: -// index array element bool -// -// 0 00 False -// 1 01 True -// 2 02 True -// 3 04 True -// 4 08 True -// 5 10 True -// 6 20 True -// 7 40 True -// 8 80 True -// 9 FF True -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp deleted file mode 100644 index cfade12139f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// Example of the BitConverter::ToChar method. -using namespace System; - -// Convert two byte array elements to a __wchar_t and display it. -void BAToChar( array^bytes, int index ) -{ - __wchar_t value = BitConverter::ToChar( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,11}", index, BitConverter::ToString( bytes, index, 2 ), value ); -} - -int main() -{ - array^byteArray = {32,0,0,42,0,65,0,125,0,197,0,168,3,41,4,172,32}; - Console::WriteLine( "This example of the BitConverter::ToChar( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to __wchar_t values.\n" ); - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,11}", "index", "array elements", "__wchar_t" ); - Console::WriteLine( "{0,5}{1,17}{2,11}", "-----", "--------------", "---------" ); - - // Convert byte array elements to __wchar_t values. - BAToChar( byteArray, 0 ); - BAToChar( byteArray, 1 ); - BAToChar( byteArray, 3 ); - BAToChar( byteArray, 5 ); - BAToChar( byteArray, 7 ); - BAToChar( byteArray, 9 ); - BAToChar( byteArray, 11 ); - BAToChar( byteArray, 13 ); - BAToChar( byteArray, 15 ); -} - -/* -This example of the BitConverter::ToChar(unsigned char[ ], int) -method generates the following output. It converts elements of a -byte array to __wchar_t values. - -initial unsigned char array ---------------------------- -20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20 - -index array elements __wchar_t ------ -------------- --------- - 0 20-00 - 1 00-00 - 3 2A-00 * - 5 41-00 A - 7 7D-00 } - 9 C5-00 Å - 11 A8-03 Ψ - 13 29-04 Щ - 15 AC-20 € -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp deleted file mode 100644 index 9e797cb8ced..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// -// Example of the BitConverter::ToDouble method. -using namespace System; - -// Convert eight byte array elements to a double and display it. -void BAToDouble( array^bytes, int index ) -{ - double value = BitConverter::ToDouble( bytes, index ); - Console::WriteLine( "{0,5}{1,27}{2,27:E16}", index, BitConverter::ToString( bytes, index, 8 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {0,0,0,0,0,0,0,0,240,63,0,0,0,0,0,224,111,64,0,0,224,255,255,255,239,65,0,0,0,0,0,0,112,63,0,0,0,0,0,0,240,61,223,136,30,28,254,116,170,1,250,89,140,66,202,192,243,63,251,89,140,66,202,192,243,63,252,89,140,66,202,192,243,63,82,211,187,188,232,126,61,126,255,255,255,255,255,255,239,255,255,255,255,255,255,239,127,1,0,0,0,0,0,0,0,248,255,0,0,0,0,0,0,240,255,0,0,0,0,0,0,240,127}; - Console::WriteLine( "This example of the BitConverter::ToDouble( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to double values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,27}{2,27:E16}", "index", "array elements", "double" ); - Console::WriteLine( "{0,5}{1,27}{2,27:E16}", "-----", "--------------", "------" ); - - // Convert byte array elements to double values. - BAToDouble( byteArray, 0 ); - BAToDouble( byteArray, 2 ); - BAToDouble( byteArray, 10 ); - BAToDouble( byteArray, 18 ); - BAToDouble( byteArray, 26 ); - BAToDouble( byteArray, 34 ); - BAToDouble( byteArray, 42 ); - BAToDouble( byteArray, 50 ); - BAToDouble( byteArray, 58 ); - BAToDouble( byteArray, 66 ); - BAToDouble( byteArray, 74 ); - BAToDouble( byteArray, 82 ); - BAToDouble( byteArray, 89 ); - BAToDouble( byteArray, 97 ); - BAToDouble( byteArray, 99 ); - BAToDouble( byteArray, 107 ); - BAToDouble( byteArray, 115 ); -} - -/* -This example of the BitConverter.ToDouble( byte( ), int ) -method generates the following output. It converts elements -of a byte array to double values. - -initial byte array ------------------- -00-00-00-00-00-00-00-00-F0-3F-00-00-00-00-00-E0-6F-40-00-00- -E0-FF-FF-FF-EF-41-00-00-00-00-00-00-70-3F-00-00-00-00-00-00- -F0-3D-DF-88-1E-1C-FE-74-AA-01-FA-59-8C-42-CA-C0-F3-3F-FB-59- -8C-42-CA-C0-F3-3F-FC-59-8C-42-CA-C0-F3-3F-52-D3-BB-BC-E8-7E- -3D-7E-FF-FF-FF-FF-FF-FF-EF-FF-FF-FF-FF-FF-FF-EF-7F-01-00-00- -00-00-00-00-00-F8-FF-00-00-00-00-00-00-F0-FF-00-00-00-00-00- -00-F0-7F - -index array elements double ------ -------------- ------ - 0 00-00-00-00-00-00-00-00 0.0000000000000000E+000 - 2 00-00-00-00-00-00-F0-3F 1.0000000000000000E+000 - 10 00-00-00-00-00-E0-6F-40 2.5500000000000000E+002 - 18 00-00-E0-FF-FF-FF-EF-41 4.2949672950000000E+009 - 26 00-00-00-00-00-00-70-3F 3.9062500000000000E-003 - 34 00-00-00-00-00-00-F0-3D 2.3283064365386963E-010 - 42 DF-88-1E-1C-FE-74-AA-01 1.2345678901234500E-300 - 50 FA-59-8C-42-CA-C0-F3-3F 1.2345678901234565E+000 - 58 FB-59-8C-42-CA-C0-F3-3F 1.2345678901234567E+000 - 66 FC-59-8C-42-CA-C0-F3-3F 1.2345678901234569E+000 - 74 52-D3-BB-BC-E8-7E-3D-7E 1.2345678901234569E+300 - 82 FF-FF-FF-FF-FF-FF-EF-FF -1.7976931348623157E+308 - 89 FF-FF-FF-FF-FF-FF-EF-7F 1.7976931348623157E+308 - 97 01-00-00-00-00-00-00-00 4.9406564584124654E-324 - 99 00-00-00-00-00-00-F8-FF NaN - 107 00-00-00-00-00-00-F0-FF -Infinity - 115 00-00-00-00-00-00-F0-7F Infinity -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp deleted file mode 100644 index bd457501a14..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -// -// Example of the BitConverter::ToSingle method. -using namespace System; - -// Convert four byte array elements to a float and display it. -void BAToSingle( array^bytes, int index ) -{ - float value = BitConverter::ToSingle( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,18:E7}", index, BitConverter::ToString( bytes, index, 4 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {0,0,0,0,128,63,0,0,112,65,0,255,127,71,0,0,128,59,0,0,128,47,73,70,131,5,75,6,158,63,77,6,158,63,80,6,158,63,30,55,190,121,255,255,127,255,255,127,127,1,0,0,0,192,255,0,0,128,255,0,0,128,127}; - Console::WriteLine( "This example of the BitConverter::ToSingle( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to float values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,17}{2,18:E7}", "index", "array elements", "float" ); - Console::WriteLine( "{0,5}{1,17}{2,18:E7}", "-----", "--------------", "-----" ); - - // Convert byte array elements to float values. - BAToSingle( byteArray, 0 ); - BAToSingle( byteArray, 2 ); - BAToSingle( byteArray, 6 ); - BAToSingle( byteArray, 10 ); - BAToSingle( byteArray, 14 ); - BAToSingle( byteArray, 18 ); - BAToSingle( byteArray, 22 ); - BAToSingle( byteArray, 26 ); - BAToSingle( byteArray, 30 ); - BAToSingle( byteArray, 34 ); - BAToSingle( byteArray, 38 ); - BAToSingle( byteArray, 42 ); - BAToSingle( byteArray, 45 ); - BAToSingle( byteArray, 49 ); - BAToSingle( byteArray, 51 ); - BAToSingle( byteArray, 55 ); - BAToSingle( byteArray, 59 ); -} - -/* -This example of the BitConverter::ToSingle( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to float values. - -initial unsigned char array ---------------------------- -00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00- -80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37- -BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00- -00-80-7F - -index array elements float ------ -------------- ----- - 0 00-00-00-00 0.0000000E+000 - 2 00-00-80-3F 1.0000000E+000 - 6 00-00-70-41 1.5000000E+001 - 10 00-FF-7F-47 6.5535000E+004 - 14 00-00-80-3B 3.9062500E-003 - 18 00-00-80-2F 2.3283064E-010 - 22 49-46-83-05 1.2345000E-035 - 26 4B-06-9E-3F 1.2345671E+000 - 30 4D-06-9E-3F 1.2345673E+000 - 34 50-06-9E-3F 1.2345676E+000 - 38 1E-37-BE-79 1.2345679E+035 - 42 FF-FF-7F-FF -3.4028235E+038 - 45 FF-FF-7F-7F 3.4028235E+038 - 49 01-00-00-00 1.4012985E-045 - 51 00-00-C0-FF NaN - 55 00-00-80-FF -Infinity - 59 00-00-80-7F Infinity -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp deleted file mode 100644 index 92c948b4d19..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// -// Example of the BitConverter::ToInt16 method. -using namespace System; - -// Convert two byte array elements to a short and display it. -void BAToInt16( array^bytes, int index ) -{ - short value = BitConverter::ToInt16( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,10}", index, BitConverter::ToString( bytes, index, 2 ), value ); -} - -int main() -{ - array^byteArray = {15,0,0,128,16,39,240,216,241,255,127}; - Console::WriteLine( "This example of the BitConverter::ToInt16( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to short values.\n" ); - Console::WriteLine( "initial byte array" ); - Console::WriteLine( "------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,10}", "index", "array elements", "short" ); - Console::WriteLine( "{0,5}{1,17}{2,10}", "-----", "--------------", "-----" ); - - // Convert byte array elements to short values. - BAToInt16( byteArray, 1 ); - BAToInt16( byteArray, 0 ); - BAToInt16( byteArray, 8 ); - BAToInt16( byteArray, 4 ); - BAToInt16( byteArray, 6 ); - BAToInt16( byteArray, 9 ); - BAToInt16( byteArray, 2 ); -} - -/* -This example of the BitConverter::ToInt16( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to short values. - -initial byte array ------------------- -0F-00-00-80-10-27-F0-D8-F1-FF-7F - -index array elements short ------ -------------- ----- - 1 00-00 0 - 0 0F-00 15 - 8 F1-FF -15 - 4 10-27 10000 - 6 F0-D8 -10000 - 9 FF-7F 32767 - 2 00-80 -32768 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp deleted file mode 100644 index d3e8f559b3c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// -// Example of the BitConverter::ToInt64 method. -using namespace System; - -// Convert eight byte array elements to an __int64 and display it. -void BAToInt64( array^bytes, int index ) -{ - __int64 value = BitConverter::ToInt64( bytes, index ); - Console::WriteLine( "{0,5}{1,27}{2,24}", index, BitConverter::ToString( bytes, index, 8 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {0,54,101,196,255,255,255,255,0,0,0,0,0,0,0,0,128,0,202,154,59,0,0,0,0,1,0,0,0,0,255,255,255,255,1,0,0,255,255,255,255,255,255,255,127,86,85,85,85,85,85,255,255,170,170,170,170,170,170,0,0,100,167,179,182,224,13,0,0,156,88,76,73,31,242}; - Console::WriteLine( "This example of the BitConverter::ToInt64( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to __int64 values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "index", "array elements", "__int64" ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "-----", "--------------", "-------" ); - - // Convert byte array elements to __int64 values. - BAToInt64( byteArray, 8 ); - BAToInt64( byteArray, 5 ); - BAToInt64( byteArray, 34 ); - BAToInt64( byteArray, 17 ); - BAToInt64( byteArray, 0 ); - BAToInt64( byteArray, 21 ); - BAToInt64( byteArray, 26 ); - BAToInt64( byteArray, 53 ); - BAToInt64( byteArray, 45 ); - BAToInt64( byteArray, 59 ); - BAToInt64( byteArray, 67 ); - BAToInt64( byteArray, 37 ); - BAToInt64( byteArray, 9 ); -} - -/* -This example of the BitConverter::ToInt64( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to __int64 values. - -initial unsigned char array ---------------------------- -00-36-65-C4-FF-FF-FF-FF-00-00-00-00-00-00-00-00-80-00-CA-9A- -3B-00-00-00-00-01-00-00-00-00-FF-FF-FF-FF-01-00-00-FF-FF-FF- -FF-FF-FF-FF-7F-56-55-55-55-55-55-FF-FF-AA-AA-AA-AA-AA-AA-00- -00-64-A7-B3-B6-E0-0D-00-00-9C-58-4C-49-1F-F2 - -index array elements __int64 ------ -------------- ------- - 8 00-00-00-00-00-00-00-00 0 - 5 FF-FF-FF-00-00-00-00-00 16777215 - 34 01-00-00-FF-FF-FF-FF-FF -16777215 - 17 00-CA-9A-3B-00-00-00-00 1000000000 - 0 00-36-65-C4-FF-FF-FF-FF -1000000000 - 21 00-00-00-00-01-00-00-00 4294967296 - 26 00-00-00-00-FF-FF-FF-FF -4294967296 - 53 AA-AA-AA-AA-AA-AA-00-00 187649984473770 - 45 56-55-55-55-55-55-FF-FF -187649984473770 - 59 00-00-64-A7-B3-B6-E0-0D 1000000000000000000 - 67 00-00-9C-58-4C-49-1F-F2 -1000000000000000000 - 37 FF-FF-FF-FF-FF-FF-FF-7F 9223372036854775807 - 9 00-00-00-00-00-00-00-80 -9223372036854775808 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp deleted file mode 100644 index c882255558e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -// Example of the BitConverter::ToUInt16 method. -using namespace System; - -// Convert two byte array elements to an unsigned short and display it. -void BAToUInt16( array^bytes, int index ) -{ - unsigned short value = BitConverter::ToUInt16( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,16}", index, BitConverter::ToString( bytes, index, 2 ), value ); -} - -int main() -{ - array^byteArray = {15,0,0,255,3,16,39,255,255,127}; - Console::WriteLine( "This example of the BitConverter::ToUInt16( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to unsigned short " - "values.\n" ); - Console::WriteLine( "initial byte array" ); - Console::WriteLine( "------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,16}", "index", "array elements", "unsigned short" ); - Console::WriteLine( "{0,5}{1,17}{2,16}", "-----", "--------------", "--------------" ); - - // Convert byte array elements to unsigned short values. - BAToUInt16( byteArray, 1 ); - BAToUInt16( byteArray, 0 ); - BAToUInt16( byteArray, 3 ); - BAToUInt16( byteArray, 5 ); - BAToUInt16( byteArray, 8 ); - BAToUInt16( byteArray, 7 ); -} - -/* -This example of the BitConverter::ToUInt16( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to unsigned short values. - -initial byte array ------------------- -0F-00-00-FF-03-10-27-FF-FF-7F - -index array elements unsigned short ------ -------------- -------------- - 1 00-00 0 - 0 0F-00 15 - 3 FF-03 1023 - 5 10-27 10000 - 8 FF-7F 32767 - 7 FF-FF 65535 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp deleted file mode 100644 index ea1eb361eda..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -// Example of the BitConverter::ToUInt32 method. -using namespace System; - -// Convert four byte array elements to an unsigned int and display it. -void BAToUInt32( array^bytes, int index ) -{ - unsigned int value = BitConverter::ToUInt32( bytes, index ); - Console::WriteLine( "{0,5}{1,17}{2,15}", index, BitConverter::ToString( bytes, index, 4 ), value ); -} - -int main() -{ - array^byteArray = {15,0,0,0,0,16,0,255,3,0,0,202,154,59,255,255,255,255,127}; - Console::WriteLine( "This example of the BitConverter::ToUInt32( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to unsigned int " - "values.\n" ); - Console::WriteLine( "initial byte array" ); - Console::WriteLine( "------------------" ); - Console::WriteLine( BitConverter::ToString( byteArray ) ); - Console::WriteLine(); - Console::WriteLine( "{0,5}{1,17}{2,15}", "index", "array elements", "unsigned int" ); - Console::WriteLine( "{0,5}{1,17}{2,15}", "-----", "--------------", "------------" ); - - // Convert byte array elements to unsigned int values. - BAToUInt32( byteArray, 1 ); - BAToUInt32( byteArray, 0 ); - BAToUInt32( byteArray, 7 ); - BAToUInt32( byteArray, 3 ); - BAToUInt32( byteArray, 10 ); - BAToUInt32( byteArray, 15 ); - BAToUInt32( byteArray, 14 ); -} - -/* -This example of the BitConverter::ToUInt32( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to unsigned int values. - -initial byte array ------------------- -0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F - -index array elements unsigned int ------ -------------- ------------ - 1 00-00-00-00 0 - 0 0F-00-00-00 15 - 7 FF-03-00-00 1023 - 3 00-00-10-00 1048576 - 10 00-CA-9A-3B 1000000000 - 15 FF-FF-FF-7F 2147483647 - 14 FF-FF-FF-FF 4294967295 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp deleted file mode 100644 index 102a5ced116..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -// Example of the BitConverter::ToUInt64 method. -using namespace System; - -// Convert eight byte array elements to an unsigned __int64 value and -// display it. -void BAToUInt64( array^bytes, int index ) -{ - unsigned __int64 value = BitConverter::ToUInt64( bytes, index ); - Console::WriteLine( "{0,5}{1,27}{2,24}", index, BitConverter::ToString( bytes, index, 8 ), value ); -} - - -// Display a byte array, using multiple lines if necessary. -void WriteMultiLineByteArray( array^bytes ) -{ - const int rowSize = 20; - int iter; - Console::WriteLine( "initial unsigned char array" ); - Console::WriteLine( "---------------------------" ); - for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) - { - Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); - Console::WriteLine( "-" ); - - } - Console::WriteLine( BitConverter::ToString( bytes, iter ) ); - Console::WriteLine(); -} - -int main() -{ - array^byteArray = {255,255,255,0,0,0,0,0,0,0,0,1,0,0,0,100,167,179,182,224,13,0,202,154,59,0,0,0,0,170,170,170,170,170,170,0,0,232,137,4,35,199,138,255,255,255,255,255,255,255,255,127}; - Console::WriteLine( "This example of the BitConverter::ToUInt64( unsigned " - "char[ ], int ) \nmethod generates the following output. It " - "converts elements of a \nbyte array to unsigned __int64 " - "values.\n" ); - WriteMultiLineByteArray( byteArray ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "index", "array elements", "unsigned __int64" ); - Console::WriteLine( "{0,5}{1,27}{2,24}", "-----", "--------------", "----------------" ); - - // Convert byte array elements to unsigned __int64 values. - BAToUInt64( byteArray, 3 ); - BAToUInt64( byteArray, 0 ); - BAToUInt64( byteArray, 21 ); - BAToUInt64( byteArray, 7 ); - BAToUInt64( byteArray, 29 ); - BAToUInt64( byteArray, 13 ); - BAToUInt64( byteArray, 35 ); - BAToUInt64( byteArray, 44 ); - BAToUInt64( byteArray, 43 ); -} - -/* -This example of the BitConverter::ToUInt64( unsigned char[ ], int ) -method generates the following output. It converts elements of a -byte array to unsigned __int64 values. - -initial unsigned char array ---------------------------- -FF-FF-FF-00-00-00-00-00-00-00-00-01-00-00-00-64-A7-B3-B6-E0- -0D-00-CA-9A-3B-00-00-00-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04- -23-C7-8A-FF-FF-FF-FF-FF-FF-FF-FF-7F - -index array elements unsigned __int64 ------ -------------- ---------------- - 3 00-00-00-00-00-00-00-00 0 - 0 FF-FF-FF-00-00-00-00-00 16777215 - 21 00-CA-9A-3B-00-00-00-00 1000000000 - 7 00-00-00-00-01-00-00-00 4294967296 - 29 AA-AA-AA-AA-AA-AA-00-00 187649984473770 - 13 00-00-64-A7-B3-B6-E0-0D 1000000000000000000 - 35 00-00-E8-89-04-23-C7-8A 10000000000000000000 - 44 FF-FF-FF-FF-FF-FF-FF-7F 9223372036854775807 - 43 FF-FF-FF-FF-FF-FF-FF-FF 18446744073709551615 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp deleted file mode 100644 index 32b17db75b6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -using namespace System; -int main() -{ - - // - Boolean raining = false; - Boolean busLate = true; - Console::WriteLine( "raining->ToString() returns {0}", raining.ToString() ); - Console::WriteLine( "busLate->ToString() returns {0}", busLate.ToString() ); - // The example displays the following output: - // raining.ToString() returns False - // busLate.ToString() returns True - // - - // - Boolean val; - String^ input; - input = Boolean::TrueString; - val = Boolean::Parse( input ); - Console::WriteLine( "'{0}' parsed as {1}", input, val ); - // The example displays the following output: - // 'True' parsed as True - // -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp deleted file mode 100644 index 2ece40209b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// Buffer.BlockCopy2.cpp : main project file. - -// -using namespace System; - -// Display the individual bytes in the array in hexadecimal. -void DisplayArray(System::Array^ arr, String^ name) -{ - Console::WindowWidth = 120; - Console::Write("{0,11}:", name); - for (int ctr = 0; ctr < arr->Length; ctr++) - { - array^ bytes; - if (arr->GetType() == array::typeid) - bytes = BitConverter::GetBytes((Int64) arr->GetValue(ctr)); - else - bytes = BitConverter::GetBytes((Int16) arr->GetValue(ctr)); - - for each (Byte byteValue in bytes) - Console::Write(" {0:X2}", byteValue); - } - Console::WriteLine(); -} - -// Display the individual array element values in hexadecimal. -void DisplayArrayValues(Array^ arr, String^ name) -{ - // Get the length of one element in the array. - int elementLength = Buffer::ByteLength(arr) / arr->Length; - String^ formatString = String::Format(" {{0:X{0}}}", 2 * elementLength); - Console::Write( "{0,11}:", name); - for (int ctr = 0; ctr < arr->Length; ctr++) - Console::Write(formatString, arr->GetValue(ctr)); - - Console::WriteLine(); -} - -void main() -{ - // These are the source and destination arrays for BlockCopy. - array^ src = gcnew array { 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270 }; - array^ dest = gcnew array { 17, 18, 19, 20 }; - - // Display the initial value of the arrays in memory. - Console::WriteLine( "Initial values of arrays:"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src" ); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy bytes 5-10 from source to index 7 in destination and display the result. - Buffer::BlockCopy(src, 5, dest, 7, 6); - Console::WriteLine("Buffer::BlockCopy(src, 5, dest, 7, 6 )"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy bytes 16-20 from source to index 22 in destination and display the result. - Buffer::BlockCopy(src, 16, dest, 22, 5); - Console::WriteLine("Buffer.BlockCopy(src, 16, dest, 22, 5)"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy overlapping range of bytes 4-10 to index 5 in source. - Buffer::BlockCopy(src, 4, src, 5, 7 ); - Console::WriteLine("Buffer.BlockCopy( src, 4, src, 5, 7)"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); - DisplayArrayValues(dest, "dest"); - Console::WriteLine(); - - // Copy overlapping range of bytes 16-22 to index 15 in source. - Buffer::BlockCopy(src, 16, src, 15, 7); - Console::WriteLine("Buffer.BlockCopy( src, 16, src, 15, 7)"); - Console::WriteLine(" Array values as Bytes:"); - DisplayArray(src, "src"); - DisplayArray(dest, "dest"); - Console::WriteLine(" Array values:"); - DisplayArrayValues(src, "src"); -} -// The example displays the following output: -// Initial values of arrays: -// Array values as Bytes: -// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 -// Array values: -// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E -// dest: 0000000000000011 0000000000000012 0000000000000013 0000000000000014 -// -// Buffer.BlockCopy(src, 5, dest, 7, 6 ) -// Array values as Bytes: -// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 -// Array values: -// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E -// dest: 0100000000000011 0000000701060105 0000000000000013 0000000000000014 -// -// Buffer.BlockCopy(src, 16, dest, 22, 5) -// Array values as Bytes: -// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 -// Array values: -// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E -// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B -// -// Buffer.BlockCopy( src, 4, src, 5, 7) -// Array values as Bytes: -// src: 02 01 03 01 04 04 01 05 01 06 01 07 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 -// Array values: -// src: 0102 0103 0404 0501 0601 0701 0108 0109 010A 010B 010C 010D 010E -// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B -// -// Buffer.BlockCopy( src, 16, src, 15, 7) -// Array values as Bytes: -// src: 02 01 03 01 04 04 01 05 01 06 01 07 08 01 09 0A 01 0B 01 0C 01 0D 0D 01 0E 01 -// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 -// Array values: -// src: 0102 0103 0404 0501 0601 0701 0108 0A09 0B01 0C01 0D01 010D 010E -// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp deleted file mode 100644 index 2ce360f905c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp +++ /dev/null @@ -1,62 +0,0 @@ - -// -// Example of the Buffer class methods. -using namespace System; - -// Display the array elements from right to left in hexadecimal. -void DisplayArray( array^arr ) -{ - Console::Write( " arr:" ); - for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) - Console::Write( " {0:X4}", arr[ loopX ] ); - Console::WriteLine(); -} - -int main() -{ - - // This array is to be modified and displayed. - array^arr = {258,259,260,261,262,263,264,265,266,267,268,269,270,271}; - Console::WriteLine( "This example of the Buffer class " - "methods generates the following output.\n" - "Note: The array is displayed from right to left.\n" ); - Console::WriteLine( "Initial values of array:\n" ); - - // Display the initial array values and ByteLength. - DisplayArray( arr ); - Console::WriteLine( "\nBuffer::ByteLength( arr ): {0}", Buffer::ByteLength( arr ) ); - - // Copy a region of the array; set a byte within the array. - Console::WriteLine( "\nCall these methods: \n" - " Buffer::BlockCopy( arr, 5, arr, 16, 9 ),\n" - " Buffer::SetByte( arr, 7, 170 ).\n" ); - Buffer::BlockCopy( arr, 5, arr, 16, 9 ); - Buffer::SetByte( arr, 7, 170 ); - - // Display the array and a byte within the array. - Console::WriteLine( "Final values of array:\n" ); - DisplayArray( arr ); - Console::WriteLine( "\nBuffer::GetByte( arr, 26 ): {0}", Buffer::GetByte( arr, 26 ) ); -} - -/* -This example of the Buffer class methods generates the following output. -Note: The array is displayed from right to left. - -Initial values of array: - - arr: 010F 010E 010D 010C 010B 010A 0109 0108 0107 0106 0105 0104 0103 0102 - -Buffer::ByteLength( arr ): 28 - -Call these methods: - Buffer::BlockCopy( arr, 5, arr, 16, 9 ), - Buffer::SetByte( arr, 7, 170 ). - -Final values of array: - - arr: 010F 0101 0801 0701 0601 0501 0109 0108 0107 0106 AA05 0104 0103 0102 - -Buffer::GetByte( arr, 26 ): 15 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp deleted file mode 100644 index 01bfe45c621..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Buffer.BlockCopy.cpp : main project file. - -using namespace System; - -void CopyExample1() -{ - // - const int INT_SIZE = 4; - array^ arr = gcnew array { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - Buffer::BlockCopy(arr, 0 * INT_SIZE, arr, 3 * INT_SIZE, 4 * INT_SIZE); - for each (int value in arr) - Console::Write("{0} ", value); - // The example displays the following output: - // 2 4 6 2 4 6 8 16 18 20 - // -} - -void CopyExample2() -{ - // - const int INT_SIZE = 4; - array^ arr = gcnew array { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - Buffer::BlockCopy(arr, 3 * INT_SIZE, arr, 0 * INT_SIZE, 4 * INT_SIZE); - for each (int value in arr) - Console::Write("{0} ", value); - // The example displays the following output: - // 8 10 12 14 10 12 14 16 18 20 - // -} - -void main() -{ - CopyExample1(); - Console::WriteLine(); - CopyExample2(); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp deleted file mode 100644 index 08596f73850..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// -// Example of the Buffer::ByteLength method. -using namespace System; - -void ArrayInfo( Array^ arr, String^ name ) -{ - int byteLength = Buffer::ByteLength( arr ); - - // Display the array name, type, Length, and ByteLength. - Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", name, arr->GetType(), arr->Length, byteLength ); -} - -int main() -{ - array^bytes = {1,2,3,4,5,6,7,8,9,0}; - array^bools = {true,false,true,false,true}; - array^chars = {' ','$','\"','A','{'}; - array^shorts = {258,259,260,261,262,263}; - array^singles = {1,678,2.37E33F,.00415F,8.9F}; - array^doubles = {2E-22,.003,4.4E44,555E55}; - array^longs = {1,10,100,1000,10000,100000}; - Console::WriteLine( "This example of the Buffer::ByteLength( Array* ) " - "\nmethod generates the following output.\n" ); - Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", "Array name", "Array type", "Length", "ByteLength" ); - Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", "----------", "----------", "------", "----------" ); - - // Display the Length and ByteLength for each array. - ArrayInfo( bytes, "bytes" ); - ArrayInfo( bools, "bools" ); - ArrayInfo( chars, "chars" ); - ArrayInfo( shorts, "shorts" ); - ArrayInfo( singles, "singles" ); - ArrayInfo( doubles, "doubles" ); - ArrayInfo( longs, "longs" ); -} - -/* -This example of the Buffer::ByteLength( Array* ) -method generates the following output. - -Array name Array type Length ByteLength ----------- ---------- ------ ---------- - bytes System.Byte[] 10 10 - bools System.Boolean[] 5 5 - chars System.Char[] 5 10 - shorts System.Int16[] 6 12 - singles System.Single[] 5 20 - doubles System.Double[] 4 32 - longs System.Int32[] 6 24 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp deleted file mode 100644 index 2b8f8c6e6ad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// -// Example of the Buffer::GetByte method. -using namespace System; -#define formatter "{0,10}{1,10}{2,9} {3}" - -// Display the array contents in hexadecimal. -void DisplayArray( Array^ arr, String^ name ) -{ - - // Get the array element width; format the formatting string. - int elemWidth = Buffer::ByteLength( arr ) / arr->Length; - String^ format = String::Format( " {{0:X{0}}}", 2 * elemWidth ); - - // Display the array elements from right to left. - Console::Write( "{0,5}:", name ); - for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) - Console::Write( format, arr->GetValue( loopX ) ); - Console::WriteLine(); -} - -void ArrayInfo( Array^ arr, String^ name, int index ) -{ - unsigned char value = Buffer::GetByte( arr, index ); - - // Display the array name, index, and byte to be viewed. - Console::WriteLine( formatter, name, index, value, String::Format( "0x{0:X2}", value ) ); -} - -int main() -{ - - // These are the arrays to be viewed with GetByte. - array<__int64>^longs = {333333333333333333,666666666666666666,999999999999999999}; - array^ints = {111111111,222222222,333333333,444444444,555555555}; - Console::WriteLine( "This example of the " - "Buffer::GetByte( Array*, int ) \n" - "method generates the following output.\n" - "Note: The arrays are displayed from right to left.\n" ); - Console::WriteLine( " Values of arrays:\n" ); - - // Display the values of the arrays. - DisplayArray( longs, "longs" ); - DisplayArray( ints, "ints" ); - Console::WriteLine(); - Console::WriteLine( formatter, "Array", "index", "value", "" ); - Console::WriteLine( formatter, "-----", "-----", "-----", "----" ); - - // Display the Length and ByteLength for each array. - ArrayInfo( ints, "ints", 0 ); - ArrayInfo( ints, "ints", 7 ); - ArrayInfo( ints, "ints", 10 ); - ArrayInfo( ints, "ints", 17 ); - ArrayInfo( longs, "longs", 0 ); - ArrayInfo( longs, "longs", 6 ); - ArrayInfo( longs, "longs", 10 ); - ArrayInfo( longs, "longs", 17 ); - ArrayInfo( longs, "longs", 21 ); -} - -/* -This example of the Buffer::GetByte( Array*, int ) -method generates the following output. -Note: The arrays are displayed from right to left. - - Values of arrays: - -longs: 0DE0B6B3A763FFFF 094079CD1A42AAAA 04A03CE68D215555 - ints: 211D1AE3 1A7DAF1C 13DE4355 0D3ED78E 069F6BC7 - - Array index value - ----- ----- ----- ---- - ints 0 199 0xC7 - ints 7 13 0x0D - ints 10 222 0xDE - ints 17 26 0x1A - longs 0 85 0x55 - longs 6 160 0xA0 - longs 10 66 0x42 - longs 17 255 0xFF - longs 21 182 0xB6 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp deleted file mode 100644 index 564641225bf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -// Example of the Buffer::SetByte method. -using namespace System; - -// Display the array contents in hexadecimal. -void DisplayArray( Array^ arr, String^ name ) -{ - - // Get the array element width; format the formatting string. - int elemWidth = Buffer::ByteLength( arr ) / arr->Length; - String^ format = String::Format( " {{0:X{0}}}", 2 * elemWidth ); - - // Display the array elements from right to left. - Console::Write( "{0,7}:", name ); - for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) - Console::Write( format, arr->GetValue( loopX ) ); - Console::WriteLine(); -} - -int main() -{ - - // These are the arrays to be modified with SetByte. - array^shorts = gcnew array(10); - array^longs = gcnew array(3); - Console::WriteLine( "This example of the " - "Buffer::SetByte( Array*, int, unsigned char ) \n" - "method generates the following output.\n" - "Note: The arrays are displayed from right to left.\n" ); - Console::WriteLine( " Initial values of arrays:\n" ); - - // Display the initial values of the arrays. - DisplayArray( shorts, "shorts" ); - DisplayArray( longs, "longs" ); - - // Copy two regions of source array to destination array, - // and two overlapped copies from source to source. - Console::WriteLine( "\n Array values after setting byte 3 = 25, \n" - " byte 6 = 64, byte 12 = 121, and byte 17 = 196:\n" ); - Buffer::SetByte( shorts, 3, 25 ); - Buffer::SetByte( shorts, 6, 64 ); - Buffer::SetByte( shorts, 12, 121 ); - Buffer::SetByte( shorts, 17, 196 ); - Buffer::SetByte( longs, 3, 25 ); - Buffer::SetByte( longs, 6, 64 ); - Buffer::SetByte( longs, 12, 121 ); - Buffer::SetByte( longs, 17, 196 ); - - // Display the arrays again. - DisplayArray( shorts, "shorts" ); - DisplayArray( longs, "longs" ); -} - -/* -This example of the Buffer::SetByte( Array*, int, unsigned char ) -method generates the following output. -Note: The arrays are displayed from right to left. - - Initial values of arrays: - - shorts: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 - longs: 0000000000000000 0000000000000000 0000000000000000 - - Array values after setting byte 3 = 25, - byte 6 = 64, byte 12 = 121, and byte 17 = 196: - - shorts: 0000 C400 0000 0079 0000 0000 0040 0000 1900 0000 - longs: 000000000000C400 0000007900000000 0040000019000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp deleted file mode 100644 index 268d4585d1e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp +++ /dev/null @@ -1,106 +0,0 @@ -using namespace System; - -/// -/// Summary description for Class1. -/// -public ref class SystemByteExamples -{ -private: - Byte MemberByte; - -public: - // c'tor() - SystemByteExamples() - { - MemberByte = 0; - } - - // The following example demonstrates using the MinValue and MaxValue fields to - // determine whether an integer value falls within range of a byte. If it does, - // the value is set. If not, an error message is displayed. - - // MemberByte is assumed to exist as a class member - - // -public: - void MinMaxFields( Int32 numberToSet ) - { - if ( numberToSet <= (Int32)Byte::MaxValue && numberToSet >= (Int32)Byte::MinValue ) - { - - // You must explicitly convert an integer to a byte. - MemberByte = (Byte)numberToSet; - - // Displays MemberByte using the ToString() method. - Console::WriteLine( "The MemberByte value is {0}", MemberByte.ToString() ); - } - else - { - Console::WriteLine( "The value {0} is outside of the range of possible Byte values", numberToSet.ToString() ); - } - } - // - - // The following example converts the string representation of a byte - // into its actual numeric value. - - // MemberByte is assumed to exist as a class member - -public: - void ParseByte( String^ stringToConvert ) - { - try - { - MemberByte = Byte::Parse( stringToConvert ); - Console::WriteLine( "The MemberByte value is {0}", MemberByte.ToString() ); - } - catch ( System::OverflowException^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - } - - // The following example checks to see whether a byte passed in is - // greater than, less than, or equal to the member byte. - - // MemberByte is assumed to exist as a class member - - // -public: - void Compare( Byte myByte ) - { - Int32 myCompareResult; - - myCompareResult = MemberByte.CompareTo( myByte ); - - if ( myCompareResult > 0 ) - { - Console::WriteLine( "{0} is less than the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); - } - else - { - if ( myCompareResult < 0 ) - Console::WriteLine( "{0} is greater than the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); - else - Console::WriteLine( "{0} is equal to the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); - } - } - // -}; - -void main() -{ - SystemByteExamples^ sbe = gcnew SystemByteExamples; - Int32 numberToSet; - Byte compareByte; - String^ stringToConvert; - - numberToSet = 120; - stringToConvert = "200"; - compareByte = 201; - - sbe->MinMaxFields( numberToSet ); - sbe->ParseByte( stringToConvert ); - - sbe->Compare( compareByte ); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp deleted file mode 100644 index b8e6646267a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp +++ /dev/null @@ -1,162 +0,0 @@ -// Byte.Parse.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -// Byte.Parse(String) -void Parse1() -{ - // - String^ stringToConvert = " 162"; - Byte byteValue; - try - { - byteValue = Byte::Parse(stringToConvert); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException^) - { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); - } - // The example displays the following output to the console: - // Converted ' 162' to 162. - // -} - -// Byte.Parse(String, NumberStyles) -void Parse2a() -{ - // - String^ value; - NumberStyles style; - Byte number; - - // Parse value with no styles allowed. - style = NumberStyles::None; - value = " 241 "; - try - { - number = Byte::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", value); } - - // Parse value with trailing sign. - style = NumberStyles::Integer | NumberStyles::AllowTrailingSign; - value = " 163+"; - number = Byte::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - - // Parse value with leading sign. - value = " +253 "; - number = Byte::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - // This example displays the following output to the console: - // Unable to parse ' 241 '. - // Converted ' 163+' to 163. - // Converted ' +253 ' to 253. - // -} - -// Byte.Parse(String, IFormatProvider) -void Parse2b() -{ - // - String^ stringToConvert; - Byte byteValue; - - stringToConvert = " 214 "; - try { - byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } - catch (OverflowException^) { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); } - - stringToConvert = " + 214 "; - try { - byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } - catch (OverflowException^) { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); } - - stringToConvert = " +214 "; - try { - byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } - catch (OverflowException^) { - Console::WriteLine("'{0}' is greater than {1} or less than {2}.", - stringToConvert, Byte::MaxValue, Byte::MinValue); } - // The example displays the following output to the console: - // Converted ' 214 ' to 214. - // Unable to parse ' + 214 '. - // Converted ' +214 ' to 214. - // -} - -void Parse3() -{ - // - NumberStyles style; - CultureInfo^ culture; - String^ value; - Byte number; - - // Parse number with decimals. - // NumberStyles.Float includes NumberStyles.AllowDecimalPoint. - style = NumberStyles::Float; - culture = CultureInfo::CreateSpecificCulture("fr-FR"); - value = "12,000"; - - number = Byte::Parse(value, style, culture); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - - culture = CultureInfo::CreateSpecificCulture("en-GB"); - try - { - number = Byte::Parse(value, style, culture); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) { - Console::WriteLine("Unable to parse '{0}'.", value); } - - value = "12.000"; - number = Byte::Parse(value, style, culture); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - // The example displays the following output to the console: - // Converted '12,000' to 12. - // Unable to parse '12,000'. - // Converted '12.000' to 12. - // -}; - -void main() -{ - Parse1(); // Parse(String) - Console::WriteLine(); - Parse2a(); // Parse(String, NumberStyles) - Console::WriteLine(); - Parse2b(); - Console::WriteLine(); - Parse3(); // Parse(String, NumberStyles, IFormatProvider) - Console::WriteLine(); - - Console::ReadLine(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp deleted file mode 100644 index fbad6b4f72e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// Byte.ToString.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -void main() -{ - // - array^ bytes = gcnew array {0, 1, 14, 168, 255}; - array^ providers = {gcnew CultureInfo("en-us"), - gcnew CultureInfo("fr-fr"), - gcnew CultureInfo("de-de"), - gcnew CultureInfo("es-es")}; - for each (Byte byteValue in bytes) - { - for each (CultureInfo^ provider in providers) - Console::Write("{0,3} ({1}) ", - byteValue.ToString(provider), provider->Name); - - Console::WriteLine(); - } - // The example displays the following output to the console: - // 0 (en-US) 0 (fr-FR) 0 (de-DE) 0 (es-ES) - // 1 (en-US) 1 (fr-FR) 1 (de-DE) 1 (es-ES) - // 14 (en-US) 14 (fr-FR) 14 (de-DE) 14 (es-ES) - // 168 (en-US) 168 (fr-FR) 168 (de-DE) 168 (es-ES) - // 255 (en-US) 255 (fr-FR) 255 (de-DE) 255 (es-ES) - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp deleted file mode 100644 index 76bc3225475..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// Byte.ToString2.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -// Byte.ToString() -void Byte1() -{ - // - array^ bytes = gcnew array {0, 1, 14, 168, 255}; - for each (Byte byteValue in bytes) - Console::WriteLine(byteValue); - // The example displays the following output to the console if the current - // culture is en-US: - // 0 - // 1 - // 14 - // 168 - // 255 - // -} - -// Byte.ToString(String) -void Byte2() -{ - // - array^ formats = gcnew array {"C3", "D4", "e1", "E2", "F1", "G", "N1", - "P0", "X4", "0000.0000"}; - Byte number = 240; - for each (String^ format in formats) - Console::WriteLine("'{0}' format specifier: {1}", - format, number.ToString(format)); - - // The example displays the following output to the console if the - // current culture is en-us: - // 'C3' format specifier: $240.000 - // 'D4' format specifier: 0240 - // 'e1' format specifier: 2.4e+002 - // 'E2' format specifier: 2.40E+002 - // 'F1' format specifier: 240.0 - // 'G' format specifier: 240 - // 'N1' format specifier: 240.0 - // 'P0' format specifier: 24,000 % - // 'X4' format specifier: 00F0 - // '0000.0000' format specifier: 0240.0000 - // -} - -// ToString(String, IFormatProvider) -void Byte3() -{ - // - Byte byteValue = 250; - array^ providers = gcnew array { gcnew CultureInfo("en-us"), - gcnew CultureInfo("fr-fr"), - gcnew CultureInfo("es-es"), - gcnew CultureInfo("de-de")}; - - for each (CultureInfo^ provider in providers) - Console::WriteLine("{0} ({1})", - byteValue.ToString("N2", provider), provider->Name); - // The example displays the following output to the console: - // 250.00 (en-US) - // 250,00 (fr-FR) - // 250,00 (es-ES) - // 250,00 (de-DE) - // -} - -void main() -{ - Byte1(); - Console::WriteLine(); - Byte2(); - Console::WriteLine(); - Byte3(); - Console::WriteLine(); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp deleted file mode 100644 index ad5537892ae..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Byte.TryParse.cpp : main project file. -// Byte.TryParse(String, Byte) - -// -using namespace System; - -void main() -{ - array^ byteStrings = gcnew array { nullptr, String::Empty, - "1024", "100.1", "100", - "+100", "-100", "000000000000000100", - "00,100", " 20 ", "FF", "0x1F" }; - Byte byteValue; - for each (String^ byteString in byteStrings) { - bool result = Byte::TryParse(byteString, byteValue); - if (result) - Console::WriteLine("Converted '{0}' to {1}", - byteString, byteValue); - else - Console::WriteLine("Attempted conversion of '{0}' failed.", - byteString); - } -} -// The example displays the following output: -// Attempted conversion of '' failed. -// Attempted conversion of '' failed.` -// Attempted conversion of '1024' failed. -// Attempted conversion of '100.1' failed. -// Converted '100' to 100 -// Converted '+100' to 100 -// Attempted conversion of '-100' failed. -// Converted '000000000000000100' to 100 -// Attempted conversion of '00,100' failed. -// Converted ' 20 ' to 20 -// Attempted conversion of 'FF' failed. -// Attempted conversion of '0x1F' failed.} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp deleted file mode 100644 index e3e81cd2951..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Byte.TryParse2.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -void CallTryParse(String^ byteString, NumberStyles styles); - -void main() -{ - String^ byteString; - NumberStyles styles; - - byteString = "1024"; - styles = NumberStyles::Integer; - CallTryParse(byteString, styles); - - byteString = "100.1"; - styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; - CallTryParse(byteString, styles); - - byteString = "100.0"; - CallTryParse(byteString, styles); - - byteString = "+100"; - styles = NumberStyles::Integer | NumberStyles::AllowLeadingSign - | NumberStyles::AllowTrailingSign; - CallTryParse(byteString, styles); - - byteString = "-100"; - CallTryParse(byteString, styles); - - byteString = "000000000000000100"; - CallTryParse(byteString, styles); - - byteString = "00,100"; - styles = NumberStyles::Integer | NumberStyles::AllowThousands; - CallTryParse(byteString, styles); - - byteString = "2E+3 "; - styles = NumberStyles::Integer | NumberStyles::AllowExponent; - CallTryParse(byteString, styles); - - byteString = "FF"; - styles = NumberStyles::HexNumber; - CallTryParse(byteString, styles); - - byteString = "0x1F"; - CallTryParse(byteString, styles); -} - -void CallTryParse(String^ stringToConvert, NumberStyles styles) -{ - Byte byteValue; - bool result = Byte::TryParse(stringToConvert, styles, - (IFormatProvider^) nullptr , byteValue); - if (result) - Console::WriteLine("Converted '{0}' to {1}", - stringToConvert, byteValue); - else - Console::WriteLine("Attempted conversion of '{0}' failed.", - stringToConvert); -} -// The example displays the following output: -// Attempted conversion of '1024' failed. -// Attempted conversion of '100.1' failed. -// Converted '100.0' to 100 -// Converted '+100' to 100 -// Attempted conversion of '-100' failed. -// Converted '000000000000000100' to 100 -// Converted '00,100' to 100 -// Attempted conversion of '2E+3 ' failed. -// Converted 'FF' to 255 -// Attempted conversion of '0x1F' failed.} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp deleted file mode 100644 index b4230f4b6c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -int main() -{ - char chA = 'A'; - char ch1 = '1'; - String^ str = "test string"; - Console::WriteLine( chA.CompareTo( 'B' ) ); // Output: "-1" (meaning 'A' is 1 less than 'B') - Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True" - Console::WriteLine( Char::GetNumericValue( ch1 ) ); // Output: "1" - Console::WriteLine( Char::IsControl( '\t' ) ); // Output: "True" - Console::WriteLine( Char::IsDigit( ch1 ) ); // Output: "True" - Console::WriteLine( Char::IsLetter( ',' ) ); // Output: "False" - Console::WriteLine( Char::IsLower( 'u' ) ); // Output: "True" - Console::WriteLine( Char::IsNumber( ch1 ) ); // Output: "True" - Console::WriteLine( Char::IsPunctuation( '.' ) ); // Output: "True" - Console::WriteLine( Char::IsSeparator( str, 4 ) ); // Output: "True" - Console::WriteLine( Char::IsSymbol( '+' ) ); // Output: "True" - Console::WriteLine( Char::IsWhiteSpace( str, 4 ) ); // Output: "True" - Console::WriteLine( Char::Parse( "S" ) ); // Output: "S" - Console::WriteLine( Char::ToLower( 'M' ) ); // Output: "m" - Console::WriteLine( 'x' ); // Output: "x" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp deleted file mode 100644 index 317328712b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -int main() -{ - char chA = 'A'; - char chB = 'B'; - Console::WriteLine( chA.CompareTo( 'A' ) ); // Output: "0" (meaning they're equal) - Console::WriteLine( 'b'.CompareTo( chB ) ); // Output: "32" (meaning 'b' is greater than 'B' by 32) - Console::WriteLine( chA.CompareTo( chB ) ); // Output: "-1" (meaning 'A' is less than 'B' by 1) -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp deleted file mode 100644 index 216b8181b48..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -int main() -{ - char chA = 'A'; - char chB = 'B'; - Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True" - Console::WriteLine( 'b'.Equals( chB ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp deleted file mode 100644 index ea6ef6ca1a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "input: 1"; - Console::WriteLine( Char::GetNumericValue( '8' ) ); // Output: "8" - Console::WriteLine( Char::GetNumericValue( str, 7 ) ); // Output: "1" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp deleted file mode 100644 index 6056fad6c22..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch2 = '2'; - String^ str = "Upper Case"; - Console::WriteLine( Char::GetUnicodeCategory( 'a' ).ToString() ); // Output: S"LowercaseLetter" - Console::WriteLine( Char::GetUnicodeCategory( ch2 ).ToString() ); // Output: S"DecimalDigitNumber" - Console::WriteLine( Char::GetUnicodeCategory( str, 6 ).ToString() ); // Output: S"UppercaseLetter" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp deleted file mode 100644 index 9f742e155e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// Char.IsControl1.cpp : main project file. -// Char.IsControl(Char) - -// -using namespace System; - -void main() -{ - int charsWritten = 0; - - for (int ctr = 0x00; ctr <= 0xFFFF; ctr++) - { - wchar_t ch = ctr; - if (Char::IsControl(ch)) - { - Console::Write(L"\U{0:X4} ", ctr); - charsWritten++; - if (charsWritten % 6 == 0) - Console::WriteLine(); - } - } -} -// The example displays the following output: -// U0000 U0001 U0002 U0003 U0004 U0005 -// U0006 U0007 U0008 U0009 U000A U000B -// U000C U000D U000E U000F U0010 U0011 -// U0012 U0013 U0014 U0015 U0016 U0017 -// U0018 U0019 U001A U001B U001C U001D -// U001E U001F U007F U0080 U0081 U0082 -// U0083 U0084 U0085 U0086 U0087 U0088 -// U0089 U008A U008B U008C U008D U008E -// U008F U0090 U0091 U0092 U0093 U0094 -// U0095 U0096 U0097 U0098 U0099 U009A -// U009B U009C U009D U009E U009F -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp deleted file mode 100644 index 0fa25aafc01..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Char.IsControl2.cpp : main project file. - -// Char.IsControl(String, Int32) - -// -using namespace System; - -void main() -{ - String ^ sentence = "This is a " + Environment::NewLine + "two-line sentence."; - for (int ctr = 0; ctr < sentence->Length; ctr++) - { - if (Char::IsControl(sentence, ctr)) - Console::WriteLine("Control character \\U{0} found in position {1}.", - Convert::ToInt32(sentence[ctr]).ToString("X4"), ctr); - } -} -// The example displays the following output: -// Control character \U000D found in position 10. -// Control character \U000A found in position 11. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp deleted file mode 100644 index 9de55fe04c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = '8'; - Console::WriteLine( Char::IsDigit( ch ) ); // Output: "True" - Console::WriteLine( Char::IsDigit( "sample string", 7 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp deleted file mode 100644 index ca86988a709..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = '8'; - Console::WriteLine( Char::IsLetter( ch ) ); // False - Console::WriteLine( Char::IsLetter( "sample string", 7 ) ); // True -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp deleted file mode 100644 index 4ffec1eb61f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "newline:\n"; - Console::WriteLine( Char::IsLetterOrDigit( '8' ) ); // Output: "True" - Console::WriteLine( Char::IsLetterOrDigit( str, 8 ) ); // Output: "False", because it's a newline -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp deleted file mode 100644 index ea6466897e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = 'a'; - Console::WriteLine( Char::IsLower( ch ) ); // Output: "True" - Console::WriteLine( Char::IsLower( "upperCase", 5 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp deleted file mode 100644 index e462ab9c8b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "non-numeric"; - Console::WriteLine( Char::IsNumber( '8' ) ); // Output: "True" - Console::WriteLine( Char::IsNumber( str, 3 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp deleted file mode 100644 index 21b3c010264..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = '.'; - Console::WriteLine( Char::IsPunctuation( ch ) ); // Output: "True" - Console::WriteLine( Char::IsPunctuation( "no punctuation", 3 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp deleted file mode 100644 index 51132b2f14c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "twain1 twain2"; - Console::WriteLine( Char::IsSeparator( 'a' ) ); // Output: "False" - Console::WriteLine( Char::IsSeparator( str, 6 ) ); // Output: "True" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp deleted file mode 100644 index ddec2d22729..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// Char.IsSeparator.cpp : main project file. - -// -using namespace System; - -int main() -{ - for (int ctr = Convert::ToInt32(Char::MinValue); ctr <= Convert::ToInt32(Char::MaxValue); ctr++) - { - wchar_t ch = ctr; - if (Char::IsSeparator(ch)) - Console::WriteLine("\u{0:X4} ({1})", (int) ch, Char::GetUnicodeCategory(ch).ToString()); - } -} -// The example displays the following output: -// 0020 (SpaceSeparator) -// u00A0 (SpaceSeparator) -// u1680 (SpaceSeparator) -// u180E (SpaceSeparator) -// u2000 (SpaceSeparator) -// u2001 (SpaceSeparator) -// u2002 (SpaceSeparator) -// u2003 (SpaceSeparator) -// u2004 (SpaceSeparator) -// u2005 (SpaceSeparator) -// u2006 (SpaceSeparator) -// u2007 (SpaceSeparator) -// u2008 (SpaceSeparator) -// u2009 (SpaceSeparator) -// u200A (SpaceSeparator) -// u2028 (LineSeparator) -// u2029 (ParagraphSeparator) -// u202F (SpaceSeparator) -// u205F (SpaceSeparator) -// u3000 (SpaceSeparator) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp deleted file mode 100644 index d82d071c7a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - - // - escape params specifying Unicode not implemented in v7.0 - Console::WriteLine( Char::IsSurrogate( 'a' ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp deleted file mode 100644 index 27bcc3f6fc2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "non-symbolic characters"; - Console::WriteLine( Char::IsSymbol( '+' ) ); // Output: "True" - Console::WriteLine( Char::IsSymbol( str, 8 ) ); // Output: "False" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp deleted file mode 100644 index f4062420996..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - String^ str = "black matter"; - Console::WriteLine( Char::IsWhiteSpace( 'A' ) ); // Output: "False" - Console::WriteLine( Char::IsWhiteSpace( str, 5 ) ); // Output: "True" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp deleted file mode 100644 index bb4eecacea5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp +++ /dev/null @@ -1,9 +0,0 @@ - -// -using namespace System; -int main() -{ - Console::WriteLine( Char::Parse( "A" ) ); // Output: 'A' -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp deleted file mode 100644 index 6d94d6be514..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; - -// for CultureInfo -void main() -{ - Console::WriteLine( Char::ToLower( 'A' ) ); // Output: "a" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp deleted file mode 100644 index 7c9937fa77e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -// -using namespace System; -int main() -{ - char ch = 'a'; - Console::WriteLine( ch ); // Output: "a" - Console::WriteLine( Char::ToString( 'b' ) ); // Output: "b" -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp deleted file mode 100644 index 6dd27c48dfe..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// CharEnumerator.Current.cpp : main project file. - - -using namespace System; - -void Example1() -{ - // - String ^ title = "A Tale of Two Cities"; - CharEnumerator ^ chEnum = title->GetEnumerator(); - int ctr = 1; - String ^ outputLine1 = nullptr; - String ^ outputLine2 = nullptr; - String ^ outputLine3 = nullptr; - - while (chEnum->MoveNext()) - { - outputLine1 += ctr < 10 || ctr % 10 != 0 ? " " : (ctr / 10) + " "; - outputLine2 += (ctr % 10) + " "; - outputLine3 += chEnum->Current + " "; - ctr++; - } - - Console::WriteLine("The length of the string is {0} characters:", - title->Length); - Console::WriteLine(outputLine1); - Console::WriteLine(outputLine2); - Console::WriteLine(outputLine3); - // The example displays the following output to the console: - // The length of the string is 20 characters: - // 1 2 - // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 - // A T a l e o f T w o C i t i e s - // - Console::ReadLine(); -} - -void Example2() -{ - // - String ^ title = "A Tale of Two Cities"; - int ctr = 1; - String ^ outputLine1 = nullptr; - String ^ outputLine2 = nullptr; - String ^ outputLine3 = nullptr; - - for each (wchar_t ch in title) - { - outputLine1 += ctr < 10 || ctr % 10 != 0 ? " " : (ctr / 10) + " "; - outputLine2 += (ctr % 10) + " "; - outputLine3 += ch + " "; - ctr++; - } - - Console::WriteLine("The length of the string is {0} characters:", - title->Length); - Console::WriteLine(outputLine1); - Console::WriteLine(outputLine2); - Console::WriteLine(outputLine3); - // The example displays the following output to the console: - // The length of the string is 20 characters: - // 1 2 - // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 - // A T a l e o f T w o C i t i e s - // - Console::ReadLine(); -} - -void main() -{ - Example1(); - Console::WriteLine(); - Example2(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp deleted file mode 100644 index de9be7b2fe4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Threading; - -public ref class SamplesStringDictionary -{ -public: - static void Main() - { - // - StringDictionary^ myCollection = gcnew StringDictionary(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesStringDictionary::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp deleted file mode 100644 index 5423aa171ec..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// The following code example demonstrates several of the properties and methods of StringDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues2( StringDictionary^ myCol ); -void PrintKeysAndValues3( StringDictionary^ myCol ); - -int main() -{ - // Creates and initializes a new StringDictionary. - StringDictionary^ myCol = gcnew StringDictionary; - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IEnumerator:" ); - PrintKeysAndValues2( myCol ); - - // Display the contents of the collection using the Keys, Values, Count, and Item properties. - Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); - PrintKeysAndValues3( myCol ); - - // Copies the StringDictionary to an array with DictionaryEntry elements. - array^myArr = gcnew array(myCol->Count); - myCol->CopyTo( myArr, 0 ); - - // Displays the values in the array. - Console::WriteLine( "Displays the elements in the array:" ); - Console::WriteLine( " KEY VALUE" ); - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( " {0,-10} {1}", myArr[ i ].Key, myArr[ i ].Value ); - Console::WriteLine(); - - // Searches for a value. - if ( myCol->ContainsValue( "amarillo" ) ) - Console::WriteLine( "The collection contains the value \"amarillo\"." ); - else - Console::WriteLine( "The collection does not contain the value \"amarillo\"." ); - - Console::WriteLine(); - - // Searches for a key and deletes it. - if ( myCol->ContainsKey( "green" ) ) - myCol->Remove( "green" ); - - Console::WriteLine( "The collection contains the following elements after removing \"green\":" ); - PrintKeysAndValues2( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues2( myCol ); -} - -// Uses the enumerator. -void PrintKeysAndValues2( StringDictionary^ myCol ) -{ - IEnumerator^ myEnumerator = myCol->GetEnumerator(); - DictionaryEntry de; - Console::WriteLine( " KEY VALUE" ); - while ( myEnumerator->MoveNext() ) - { - de = *dynamic_cast(myEnumerator->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -// Uses the Keys, Values, Count, and Item properties. -void PrintKeysAndValues3( StringDictionary^ myCol ) -{ - array^myKeys = gcnew array(myCol->Count); - myCol->Keys->CopyTo( myKeys, 0 ); - Console::WriteLine( " INDEX KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -Displays the elements using the IEnumerator: - KEY VALUE - red rojo - blue azul - green verde - -Displays the elements using the Keys, Values, Count, and Item properties: - INDEX KEY VALUE - 0 red rojo - 1 blue azul - 2 green verde - -Displays the elements in the array: - KEY VALUE - red rojo - blue azul - green verde - -The collection does not contain the value "amarillo". - -The collection contains the following elements after removing "green": - KEY VALUE - red rojo - blue azul - -The collection contains the following elements after it is cleared: - KEY VALUE - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp deleted file mode 100644 index c477bb3710f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -// The following code example demonstrates how to add and remove elements from a StringDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( StringDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ enum0 = myCol->GetEnumerator(); - while ( enum0->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(enum0->Current); - Console::WriteLine( " {0,-10} {1}", de->Key, de->Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new StringDictionary. - StringDictionary^ myCol = gcnew StringDictionary; - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - - // Displays the values in the StringDictionary. - Console::WriteLine( "Initial contents of the StringDictionary:" ); - PrintKeysAndValues( myCol ); - - // Deletes an element. - myCol->Remove( "green" ); - Console::WriteLine( "The collection contains the following elements after removing \"green\":" ); - PrintKeysAndValues( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues( myCol ); -} - -/* -This code produces the following output. - -Initial contents of the StringDictionary: - KEY VALUE - green verde - red rojo - blue azul - -The collection contains the following elements after removing "green": - KEY VALUE - red rojo - blue azul - -The collection contains the following elements after it is cleared: - KEY VALUE - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp deleted file mode 100644 index 854a898a04a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -// The following code example searches for an element in a StringDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( StringDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ enum0 = myCol->GetEnumerator(); - while ( enum0->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(enum0->Current); - Console::WriteLine( " {0,-10} {1}", de->Key, de->Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new StringDictionary. - StringDictionary^ myCol = gcnew StringDictionary; - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - - // Displays the values in the StringDictionary. - Console::WriteLine( "Initial contents of the StringDictionary:" ); - PrintKeysAndValues( myCol ); - - // Searches for a key. - if ( myCol->ContainsKey( "red" ) ) - Console::WriteLine( "The collection contains the key \"red\"." ); - else - Console::WriteLine( "The collection does not contain the key \"red\"." ); - - Console::WriteLine(); - - // Searches for a value. - if ( myCol->ContainsValue( "amarillo" ) ) - Console::WriteLine( "The collection contains the value \"amarillo\"." ); - else - Console::WriteLine( "The collection does not contain the value \"amarillo\"." ); - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the StringDictionary: - KEY VALUE - green verde - red rojo - blue azul - -The collection contains the key "red". - -The collection does not contain the value "amarillo". - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp deleted file mode 100644 index a7c20a92885..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// The following code example enumerates the elements of a StringDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintKeysAndValues1( StringDictionary^ myCol ); -void PrintKeysAndValues2( StringDictionary^ myCol ); -void PrintKeysAndValues3( StringDictionary^ myCol ); - -int main() -{ - // Creates and initializes a new StringDictionary. - StringDictionary^ myCol = gcnew StringDictionary; - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - - // Display the contents of the collection using for each. This is the preferred method. - Console::WriteLine( "Displays the elements using for each:" ); - PrintKeysAndValues1( myCol ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IEnumerator:" ); - PrintKeysAndValues2( myCol ); - - // Display the contents of the collection using the Keys, Values, Count, and Item properties. - Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); - PrintKeysAndValues3( myCol ); -} - -// Uses the for each statement which hides the complexity of the enumerator. -// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. -void PrintKeysAndValues1( StringDictionary^ myCol ) { - Console::WriteLine( " KEY VALUE" ); - for each ( DictionaryEntry^ de in myCol ) - Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintKeysAndValues2( StringDictionary^ myCol ) -{ - IEnumerator^ myEnumerator = myCol->GetEnumerator(); - DictionaryEntry^ de; - Console::WriteLine( " KEY VALUE" ); - while ( myEnumerator->MoveNext() ) - { - de = (DictionaryEntry^)(myEnumerator->Current); - Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); - } - Console::WriteLine(); -} - -// Uses the Keys, Values, Count, and Item properties. -void PrintKeysAndValues3( StringDictionary^ myCol ) -{ - array^myKeys = gcnew array(myCol->Count); - myCol->Keys->CopyTo( myKeys, 0 ); - Console::WriteLine( " INDEX KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -Displays the elements using for each: - KEY VALUE - red rojo - blue azul - green verde - -Displays the elements using the IEnumerator: - KEY VALUE - red rojo - blue azul - green verde - -Displays the elements using the Keys, Values, Count, and Item properties: - INDEX KEY VALUE - 0 red rojo - 1 blue azul - 2 green verde - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp deleted file mode 100644 index b62ad64ac50..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// The following code example enumerates the elements of a StringDictionary. - -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class SamplesStringDictionary -{ -public: - static void Main() - { - // Creates and initializes a new StringDictionary. - StringDictionary^ myCol = gcnew StringDictionary(); - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - - Console::WriteLine("VALUES"); - for each (String^ val in myCol->Values) - { - Console::WriteLine(val); - } - } -}; - -int main() -{ - SamplesStringDictionary::Main(); -} -// This code produces the following output. -// VALUES -// verde -// rojo -// azul -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp deleted file mode 100644 index a412d7c2739..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -public ref class Example -{ -public: - static void Main() - { - // Create an empty ArrayList, and add some elements. - ArrayList^ stringList = gcnew ArrayList(); - - stringList->Add("a"); - stringList->Add("abc"); - stringList->Add("abcdef"); - stringList->Add("abcdefg"); - - // The Item property is an indexer, so the property name is - // not required. - Console::WriteLine("Element {0} is \"{1}\"", 2, stringList[2]); - - // Assigning a value to the property changes the value of - // the indexed element. - stringList[2] = "abcd"; - Console::WriteLine("Element {0} is \"{1}\"", 2, stringList[2]); - - // Accessing an element outside the current element count - // causes an exception. - Console::WriteLine("Number of elements in the list: {0}", - stringList->Count); - try - { - Console::WriteLine("Element {0} is \"{1}\"", - stringList->Count, stringList[stringList->Count]); - } - catch (ArgumentOutOfRangeException^ aoore) - { - Console::WriteLine("stringList({0}) is out of range.", - stringList->Count); - } - - // You cannot use the Item property to add new elements. - try - { - stringList[stringList->Count] = "42"; - } - catch (ArgumentOutOfRangeException^ aoore) - { - Console::WriteLine("stringList({0}) is out of range.", - stringList->Count); - } - - Console::WriteLine(); - for (int i = 0; i < stringList->Count; i++) - { - Console::WriteLine("Element {0} is \"{1}\"", i, - stringList[i]); - } - - Console::WriteLine(); - for each (Object^ o in stringList) - { - Console::WriteLine(o); - } - } -}; - -int main() -{ - Example::Main(); -} -/* - This code example produces the following output: - -Element 2 is "abcdef" -Element 2 is "abcd" -Number of elements in the list: 4 -stringList(4) is out of range. -stringList(4) is out of range. - -Element 0 is "a" -Element 1 is "abc" -Element 2 is "abcd" -Element 3 is "abcdefg" - -a -abc -abcd -abcdefg - */ -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp deleted file mode 100644 index 5a66b7c3b74..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -public ref class ScrambleList : public ArrayList -{ -public: - static void Main() - { - // Create an empty ArrayList, and add some elements. - ScrambleList^ integerList = gcnew ScrambleList(); - - for (int i = 0; i < 10; i++) - { - integerList->Add(i); - } - - Console::WriteLine("Ordered:\n"); - for each (int value in integerList) - { - Console::Write("{0}, ", value); - } - Console::WriteLine("\n\nScrambled:\n"); - - // Scramble the order of the items in the list. - integerList->Scramble(); - - for each (int value in integerList) - { - Console::Write("{0}, ", value); - } - Console::WriteLine("\n"); - } - - void Scramble() - { - int limit = this->Count; - int temp; - int swapindex; - Random^ rnd = gcnew Random(); - for (int i = 0; i < limit; i++) - { - // The Item property of ArrayList is the default indexer. Thus, - // this->default[i] and this[i] are used interchangeably. - temp = (int)this->default[i]; - swapindex = rnd->Next(0, limit - 1); - this[i] = this->default[swapindex]; - this[swapindex] = temp; - } - } -}; - -int main() -{ - ScrambleList::Main(); -} -// The program produces output similar to the following: -// -// Ordered: -// -// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -// -// Scrambled: -// -// 5, 2, 8, 9, 6, 1, 7, 0, 4, 3, -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp deleted file mode 100644 index c56559204dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// The following example shows how to sort the values in an using the default comparer and a custom comparer which reverses the sort order. -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndValues( IEnumerable^ myList ); -ref class myReverserClass: public IComparer -{ -private: - - // Calls CaseInsensitiveComparer.Compare with the parameters reversed. - virtual int Compare( Object^ x, Object^ y ) sealed = IComparer::Compare - { - return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); - } - -}; - -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList initially contains the following values:" ); - PrintIndexAndValues( myAL ); - - // Sorts the values of the ArrayList using the default comparer. - myAL->Sort(); - Console::WriteLine( "After sorting with the default comparer:" ); - PrintIndexAndValues( myAL ); - - // Sorts the values of the ArrayList using the reverse case-insensitive comparer. - IComparer^ myComparer = gcnew myReverserClass; - myAL->Sort( myComparer ); - Console::WriteLine( "After sorting with the reverse case-insensitive comparer:" ); - PrintIndexAndValues( myAL ); -} - -void PrintIndexAndValues( IEnumerable^ myList ) -{ - int i = 0; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( "\t[{0}]:\t{1}", i++, obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. -The ArrayList initially contains the following values: - [0]: The - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - -After sorting with the default comparer: - [0]: brown - [1]: dog - [2]: fox - [3]: jumps - [4]: lazy - [5]: over - [6]: quick - [7]: the - [8]: The - -After sorting with the reverse case-insensitive comparer: - [0]: the - [1]: The - [2]: quick - [3]: over - [4]: lazy - [5]: jumps - [6]: fox - [7]: dog - [8]: brown -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp deleted file mode 100644 index 41bde08602c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// The following example shows how to sort the values in a section of an using the default comparer and a custom comparer which reverses the sort order. -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndValues( IEnumerable^ myList ); -ref class myReverserClass: public IComparer -{ -private: - - // Calls CaseInsensitiveComparer.Compare with the parameters reversed. - virtual int Compare( Object^ x, Object^ y ) = IComparer::Compare - { - return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); - } - -}; - -int main() -{ - - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "QUICK" ); - myAL->Add( "BROWN" ); - myAL->Add( "FOX" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList initially contains the following values:" ); - PrintIndexAndValues( myAL ); - - // Sorts the values of the ArrayList using the default comparer. - myAL->Sort( 1, 3, nullptr ); - Console::WriteLine( "After sorting from index 1 to index 3 with the default comparer:" ); - PrintIndexAndValues( myAL ); - - // Sorts the values of the ArrayList using the reverse case-insensitive comparer. - IComparer^ myComparer = gcnew myReverserClass; - myAL->Sort( 1, 3, myComparer ); - Console::WriteLine( "After sorting from index 1 to index 3 with the reverse case-insensitive comparer:" ); - PrintIndexAndValues( myAL ); -} - -void PrintIndexAndValues( IEnumerable^ myList ) -{ - int i = 0; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( "\t[{0}]:\t{1}", i++, obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. -The ArrayList initially contains the following values: - [0]: The - [1]: QUICK - [2]: BROWN - [3]: FOX - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - -After sorting from index 1 to index 3 with the default comparer: - [0]: The - [1]: BROWN - [2]: FOX - [3]: QUICK - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - -After sorting from index 1 to index 3 with the reverse case-insensitive comparer: - [0]: The - [1]: QUICK - [2]: FOX - [3]: BROWN - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp deleted file mode 100644 index 4ffd521bcd4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -// The following example shows how to copy the elements of an ArrayList to a string array. -// -using namespace System; -using namespace System::Collections; -void PrintIndexAndValues( ArrayList^ myList ); -void PrintIndexAndValues( array^myArr ); -int main() -{ - // Creates and initializes a new ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "The" ); - myAL->Add( "quick" ); - myAL->Add( "brown" ); - myAL->Add( "fox" ); - myAL->Add( "jumps" ); - myAL->Add( "over" ); - myAL->Add( "the" ); - myAL->Add( "lazy" ); - myAL->Add( "dog" ); - - // Displays the values of the ArrayList. - Console::WriteLine( "The ArrayList contains the following values:" ); - PrintIndexAndValues( myAL ); - - // Copies the elements of the ArrayList to a string array. - array^myArr = reinterpret_cast^>(myAL->ToArray( String::typeid )); - - // Displays the contents of the string array. - Console::WriteLine( "The string array contains the following values:" ); - PrintIndexAndValues( myArr ); -} - -void PrintIndexAndValues( ArrayList^ myList ) -{ - int i = 0; - IEnumerator^ myEnum = myList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "\t[{0}]:\t{1}", i++, o ); - } - - Console::WriteLine(); -} - -void PrintIndexAndValues( array^myArr ) -{ - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( "\t[{0}]:\t{1}", i, myArr[ i ] ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -The ArrayList contains the following values: - [0]: The - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - -The string array contains the following values: - [0]: The - [1]: quick - [2]: brown - [3]: fox - [4]: jumps - [5]: over - [6]: the - [7]: lazy - [8]: dog - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp deleted file mode 100644 index 352f55da5ea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example creates a case-sensitive hashtable and a case-insensitive hashtable -// and demonstrates the difference in their behavior, even if both contain the same elements. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; -int main() -{ - - // Create a Hashtable using the default hash code provider and the default comparer. - Hashtable^ myHT1 = gcnew Hashtable; - myHT1->Add( "FIRST", "Hello" ); - myHT1->Add( "SECOND", "World" ); - myHT1->Add( "THIRD", "!" ); - - // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, - // based on the culture of the current thread. - Hashtable^ myHT2 = gcnew Hashtable( gcnew CaseInsensitiveHashCodeProvider,gcnew CaseInsensitiveComparer ); - myHT2->Add( "FIRST", "Hello" ); - myHT2->Add( "SECOND", "World" ); - myHT2->Add( "THIRD", "!" ); - - // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, - // based on the InvariantCulture. - Hashtable^ myHT3 = gcnew Hashtable( CaseInsensitiveHashCodeProvider::DefaultInvariant,CaseInsensitiveComparer::DefaultInvariant ); - myHT3->Add( "FIRST", "Hello" ); - myHT3->Add( "SECOND", "World" ); - myHT3->Add( "THIRD", "!" ); - - // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, - // based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i". - CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); - Hashtable^ myHT4 = gcnew Hashtable( gcnew CaseInsensitiveHashCodeProvider( myCul ),gcnew CaseInsensitiveComparer( myCul ) ); - myHT4->Add( "FIRST", "Hello" ); - myHT4->Add( "SECOND", "World" ); - myHT4->Add( "THIRD", "!" ); - - // Search for a key in each hashtable. - Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT4: {0}", myHT4->ContainsKey( "first" ) ); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -first is in myHT1: False -first is in myHT2: True -first is in myHT3: True -first is in myHT4: False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp deleted file mode 100644 index c12910d57c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp +++ /dev/null @@ -1,183 +0,0 @@ - - -// The following code example implements the CollectionBase class and uses that implementation to create a collection of Int16 objects. -// -#using - -using namespace System; -using namespace System::Collections; - -public ref class Int16Collection: public CollectionBase -{ -public: - - property Int16 Item [int] - { - Int16 get( int index ) - { - return ( (Int16)(List[ index ])); - } - - void set( int index, Int16 value ) - { - List[ index ] = value; - } - } - int Add( Int16 value ) - { - return (List->Add( value )); - } - - int IndexOf( Int16 value ) - { - return (List->IndexOf( value )); - } - - void Insert( int index, Int16 value ) - { - List->Insert( index, value ); - } - - void Remove( Int16 value ) - { - List->Remove( value ); - } - - bool Contains( Int16 value ) - { - // If value is not of type Int16, this will return false. - return (List->Contains( value )); - } - -protected: - virtual void OnInsert( int /*index*/, Object^ /*value*/ ) override - { - // Insert additional code to be run only when inserting values. - } - - virtual void OnRemove( int /*index*/, Object^ /*value*/ ) override - { - // Insert additional code to be run only when removing values. - } - - virtual void OnSet( int /*index*/, Object^ /*oldValue*/, Object^ /*newValue*/ ) override - { - // Insert additional code to be run only when setting values. - } - - virtual void OnValidate( Object^ value ) override - { - if ( value->GetType() != Type::GetType( "System.Int16" ) ) - throw gcnew ArgumentException( "value must be of type Int16.","value" ); - } - -}; - -void PrintIndexAndValues( Int16Collection^ myCol ); -void PrintValues2( Int16Collection^ myCol ); -int main() -{ - // Create and initialize a new CollectionBase. - Int16Collection^ myI16 = gcnew Int16Collection; - - // Add elements to the collection. - myI16->Add( (Int16)1 ); - myI16->Add( (Int16)2 ); - myI16->Add( (Int16)3 ); - myI16->Add( (Int16)5 ); - myI16->Add( (Int16)7 ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Contents of the collection (using enumerator):" ); - PrintValues2( myI16 ); - - // Display the contents of the collection using the Count property and the Item property. - Console::WriteLine( "Initial contents of the collection (using Count and Item):" ); - PrintIndexAndValues( myI16 ); - - // Search the collection with Contains and IndexOf. - Console::WriteLine( "Contains 3: {0}", myI16->Contains( 3 ) ); - Console::WriteLine( "2 is at index {0}.", myI16->IndexOf( 2 ) ); - Console::WriteLine(); - - // Insert an element into the collection at index 3. - myI16->Insert( 3, (Int16)13 ); - Console::WriteLine( "Contents of the collection after inserting at index 3:" ); - PrintIndexAndValues( myI16 ); - - // Get and set an element using the index. - myI16->Item[ 4 ] = 123; - Console::WriteLine( "Contents of the collection after setting the element at index 4 to 123:" ); - PrintIndexAndValues( myI16 ); - - // Remove an element from the collection. - myI16->Remove( (Int16)2 ); - - // Display the contents of the collection using the Count property and the Item property. - Console::WriteLine( "Contents of the collection after removing the element 2:" ); - PrintIndexAndValues( myI16 ); -} - -// Uses the Count property and the Item property. -void PrintIndexAndValues( Int16Collection^ myCol ) -{ - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " [{0}]: {1}", i, myCol->Item[ i ] ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintValues2( Int16Collection^ myCol ) -{ - System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0}", myEnumerator->Current ); - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Contents of the collection (using enumerator): - 1 - 2 - 3 - 5 - 7 - -Initial contents of the collection (using Count and Item): - [0]: 1 - [1]: 2 - [2]: 3 - [3]: 5 - [4]: 7 - -Contains 3: True -2 is at index 1. - -Contents of the collection after inserting at index 3: - [0]: 1 - [1]: 2 - [2]: 3 - [3]: 13 - [4]: 5 - [5]: 7 - -Contents of the collection after setting the element at index 4 to 123: - [0]: 1 - [1]: 2 - [2]: 3 - [3]: 13 - [4]: 123 - [5]: 7 - -Contents of the collection after removing the element 2: - [0]: 1 - [1]: 3 - [2]: 13 - [3]: 123 - [4]: 7 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp deleted file mode 100644 index 5c672dbc203..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp +++ /dev/null @@ -1,118 +0,0 @@ - - -// The following code example implements the CollectionBase class and uses that implementation to create a collection of Int16 objects. -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class Int16Collection: public CollectionBase -{ -public: - - property Int16 Item [int] - { - Int16 get( int index ) - { - return ( (Int16)(List[ index ])); - } - - void set( int index, Int16 value ) - { - List[ index ] = value; - } - } - int Add( Int16 value ) - { - return (List->Add( value )); - } - - int IndexOf( Int16 value ) - { - return (List->IndexOf( value )); - } - - void Insert( int index, Int16 value ) - { - List->Insert( index, value ); - } - - void Remove( Int16 value ) - { - List->Remove( value ); - } - - bool Contains( Int16 value ) - { - // If value is not of type Int16, this will return false. - return (List->Contains( value )); - } - -protected: - virtual void OnInsert( int /*index*/, Object^ /*value*/ ) override - { - // Insert additional code to be run only when inserting values. - } - - virtual void OnRemove( int /*index*/, Object^ /*value*/ ) override - { - // Insert additional code to be run only when removing values. - } - - virtual void OnSet( int /*index*/, Object^ /*oldValue*/, Object^ /*newValue*/ ) override - { - // Insert additional code to be run only when setting values. - } - - virtual void OnValidate( Object^ value ) override - { - if ( value->GetType() != Type::GetType( "System.Int16" ) ) - throw gcnew ArgumentException( "value must be of type Int16.","value" ); - } - -}; - -public ref class SamplesCollectionBase -{ -public: - static void Main() - { - // Create and initialize a new CollectionBase. - Int16Collection^ myCollectionBase = gcnew Int16Collection(); - - // Add elements to the collection. - myCollectionBase->Add( (Int16) 1 ); - myCollectionBase->Add( (Int16) 2 ); - myCollectionBase->Add( (Int16) 3 ); - myCollectionBase->Add( (Int16) 5 ); - myCollectionBase->Add( (Int16) 7 ); - - // - // Get the ICollection interface from the CollectionBase - // derived class. - ICollection^ myCollection = myCollectionBase; - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesCollectionBase::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp deleted file mode 100644 index 8103ba2ad12..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example shows how Compare returns different values depending on the culture associated with the Comparer. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; -int main() -{ - - // Creates the strings to compare. - String^ str1 = "llegar"; - String^ str2 = "lugar"; - Console::WriteLine( "Comparing \"{0}\" and \"{1}\" ...", str1, str2 ); - - // Uses the DefaultInvariant Comparer. - Console::WriteLine( " Invariant Comparer: {0}", Comparer::DefaultInvariant->Compare( str1, str2 ) ); - - // Uses the Comparer based on the culture "es-ES" (Spanish - Spain, international sort). - Comparer^ myCompIntl = gcnew Comparer( gcnew CultureInfo( "es-ES",false ) ); - Console::WriteLine( " International Sort: {0}", myCompIntl->Compare( str1, str2 ) ); - - // Uses the Comparer based on the culture identifier 0x040A (Spanish - Spain, traditional sort). - Comparer^ myCompTrad = gcnew Comparer( gcnew CultureInfo( 0x040A,false ) ); - Console::WriteLine( " Traditional Sort : {0}", myCompTrad->Compare( str1, str2 ) ); -} - -/* -This code produces the following output. - -Comparing "llegar" and "lugar" ... - Invariant Comparer: -1 - International Sort: -1 - Traditional Sort : 1 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp deleted file mode 100644 index f22de93e8e7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp +++ /dev/null @@ -1,258 +0,0 @@ - -// The following code example implements the DictionaryBase class and uses that implementation to create a dictionary of String keys and values that have a Length of 5 or less. -// -using namespace System; -using namespace System::Collections; - -public ref class ShortStringDictionary: public DictionaryBase -{ -public: - - property String^ Item [String^] - { - String^ get( String^ key ) - { - return (dynamic_cast(Dictionary[ key ])); - } - - void set( String^ value, String^ key ) - { - Dictionary[ key ] = value; - } - } - - property ICollection^ Keys - { - ICollection^ get() - { - return (Dictionary->Keys); - } - } - - property ICollection^ Values - { - ICollection^ get() - { - return (Dictionary->Values); - } - } - void Add( String^ key, String^ value ) - { - Dictionary->Add( key, value ); - } - - bool Contains( String^ key ) - { - return (Dictionary->Contains( key )); - } - - void Remove( String^ key ) - { - Dictionary->Remove( key ); - } - - -protected: - virtual void OnInsert( Object^ key, Object^ value ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - - if ( value->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "value must be of type String.","value" ); - else - { - String^ strValue = dynamic_cast(value); - if ( strValue->Length > 5 ) - throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); - } - } - - virtual void OnRemove( Object^ key, Object^ /*value*/ ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - } - - virtual void OnSet( Object^ key, Object^ /*oldValue*/, Object^ newValue ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - - if ( newValue->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "newValue must be of type String.","newValue" ); - else - { - String^ strValue = dynamic_cast(newValue); - if ( strValue->Length > 5 ) - throw gcnew ArgumentException( "newValue must be no more than 5 characters in length.","newValue" ); - } - } - - virtual void OnValidate( Object^ key, Object^ value ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - - if ( value->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "value must be of type String.","value" ); - else - { - String^ strValue = dynamic_cast(value); - if ( strValue->Length > 5 ) - throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); - } - } - -}; - -void PrintKeysAndValues2( ShortStringDictionary^ myCol ); -void PrintKeysAndValues3( ShortStringDictionary^ myCol ); -int main() -{ - // Creates and initializes a new DictionaryBase. - ShortStringDictionary^ mySSC = gcnew ShortStringDictionary; - - // Adds elements to the collection. - mySSC->Add( "One", "a" ); - mySSC->Add( "Two", "ab" ); - mySSC->Add( "Three", "abc" ); - mySSC->Add( "Four", "abcd" ); - mySSC->Add( "Five", "abcde" ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Contents of the collection (using enumerator):" ); - PrintKeysAndValues2( mySSC ); - - // Display the contents of the collection using the Keys property and the Item property. - Console::WriteLine( "Initial contents of the collection (using Keys and Item):" ); - PrintKeysAndValues3( mySSC ); - - // Tries to add a value that is too long. - try - { - mySSC->Add( "Ten", "abcdefghij" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - // Tries to add a key that is too long. - try - { - mySSC->Add( "Eleven", "ijk" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - Console::WriteLine(); - - // Searches the collection with Contains. - Console::WriteLine( "Contains \"Three\": {0}", mySSC->Contains( "Three" ) ); - Console::WriteLine( "Contains \"Twelve\": {0}", mySSC->Contains( "Twelve" ) ); - Console::WriteLine(); - - // Removes an element from the collection. - mySSC->Remove( "Two" ); - - // Displays the contents of the collection. - Console::WriteLine( "After removing \"Two\":" ); - PrintKeysAndValues2( mySSC ); -} - -// Uses the enumerator. -void PrintKeysAndValues2( ShortStringDictionary^ myCol ) -{ - DictionaryEntry myDE; - System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - if ( myEnumerator->Current != nullptr ) - { - myDE = *dynamic_cast(myEnumerator->Current); - Console::WriteLine( " {0,-5} : {1}", myDE.Key, myDE.Value ); - } - - Console::WriteLine(); -} - - -// Uses the Keys property and the Item property. -void PrintKeysAndValues3( ShortStringDictionary^ myCol ) -{ - ICollection^ myKeys = myCol->Keys; - IEnumerator^ myEnum1 = myKeys->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ k = safe_cast(myEnum1->Current); - Console::WriteLine( " {0,-5} : {1}", k, myCol->Item[ k ] ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Contents of the collection (using enumerator): - Three : abc - Five : abcde - Two : ab - One : a - Four : abcd - -Initial contents of the collection (using Keys and Item): - Three : abc - Five : abcde - Two : ab - One : a - Four : abcd - -System.ArgumentException: value must be no more than 5 characters in length. -Parameter name: value - at ShortStringDictionary.OnValidate(Object key, Object value) - at System.Collections.DictionaryBase.System.Collections.IDictionary.Add(Object key, Object value) - at SamplesDictionaryBase.Main() -System.ArgumentException: key must be no more than 5 characters in length. -Parameter name: key - at ShortStringDictionary.OnValidate(Object key, Object value) - at System.Collections.DictionaryBase.System.Collections.IDictionary.Add(Object key, Object value) - at SamplesDictionaryBase.Main() - -Contains "Three": True -Contains "Twelve": False - -After removing "Two": - Three : abc - Five : abcde - One : a - Four : abcd - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp deleted file mode 100644 index 6d4bc281691..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp +++ /dev/null @@ -1,171 +0,0 @@ - -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class ShortStringDictionary: public DictionaryBase -{ -public: - - property String^ Item [String^] - { - String^ get( String^ key ) - { - return (dynamic_cast(Dictionary[ key ])); - } - - void set( String^ value, String^ key ) - { - Dictionary[ key ] = value; - } - } - - property ICollection^ Keys - { - ICollection^ get() - { - return (Dictionary->Keys); - } - } - - property ICollection^ Values - { - ICollection^ get() - { - return (Dictionary->Values); - } - } - void Add( String^ key, String^ value ) - { - Dictionary->Add( key, value ); - } - - bool Contains( String^ key ) - { - return (Dictionary->Contains( key )); - } - - void Remove( String^ key ) - { - Dictionary->Remove( key ); - } - - -protected: - virtual void OnInsert( Object^ key, Object^ value ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - - if ( value->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "value must be of type String.","value" ); - else - { - String^ strValue = dynamic_cast(value); - if ( strValue->Length > 5 ) - throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); - } - } - - virtual void OnRemove( Object^ key, Object^ /*value*/ ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - } - - virtual void OnSet( Object^ key, Object^ /*oldValue*/, Object^ newValue ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - - if ( newValue->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "newValue must be of type String.","newValue" ); - else - { - String^ strValue = dynamic_cast(newValue); - if ( strValue->Length > 5 ) - throw gcnew ArgumentException( "newValue must be no more than 5 characters in length.","newValue" ); - } - } - - virtual void OnValidate( Object^ key, Object^ value ) override - { - if ( key->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "key must be of type String.","key" ); - else - { - String^ strKey = dynamic_cast(key); - if ( strKey->Length > 5 ) - throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); - } - - if ( value->GetType() != Type::GetType( "System.String" ) ) - throw gcnew ArgumentException( "value must be of type String.","value" ); - else - { - String^ strValue = dynamic_cast(value); - if ( strValue->Length > 5 ) - throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); - } - } - -}; - -public ref class SamplesDictionaryBase -{ -public: - static void Main() - { - DictionaryBase^ myDictionary = gcnew ShortStringDictionary(); - - // - for each (DictionaryEntry de in myDictionary) - { - //... - } - // - - // - ICollection^ myCollection = gcnew ShortStringDictionary(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesDictionaryBase::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp deleted file mode 100644 index e7587a1e80f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// A simple example for the DictionaryEntry structure. -using namespace System; -using namespace System::Collections; - -public ref class Example -{ -public: - static void Main() - { - // Create a new hash table. - // - Hashtable^ openWith = gcnew Hashtable(); - - // Add some elements to the hash table. There are no - // duplicate keys, but some of the values are duplicates. - openWith->Add("txt", "notepad.exe"); - openWith->Add("bmp", "paint.exe"); - openWith->Add("dib", "paint.exe"); - openWith->Add("rtf", "wordpad.exe"); - - // When you use foreach to enumerate hash table elements, - // the elements are retrieved as DictionaryEntry objects. - Console::WriteLine(); - // - for each (DictionaryEntry de in openWith) - { - Console::WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); - } - // - } -}; - -int main() -{ - Example::Main(); -} - -/* This code example produces output similar to the following: - -Key = rtf, Value = wordpad.exe -Key = txt, Value = notepad.exe -Key = dib, Value = paint.exe -Key = bmp, Value = paint.exe - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp deleted file mode 100644 index 4378b0f208a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections::Generic; - -ref class Program -{ -public: - // - static void Main() - { - HashSet^ lowNumbers = gcnew HashSet(); - HashSet^ highNumbers = gcnew HashSet(); - - for (int i = 0; i < 6; i++) - { - lowNumbers->Add(i); - } - - for (int i = 3; i < 10; i++) - { - highNumbers->Add(i); - } - - Console::Write("lowNumbers contains {0} elements: ", lowNumbers->Count); - DisplaySet(lowNumbers); - - Console::Write("highNumbers contains {0} elements: ", highNumbers->Count); - DisplaySet(highNumbers); - - Console::WriteLine("highNumbers ExceptWith lowNumbers..."); - highNumbers->ExceptWith(lowNumbers); - - Console::Write("highNumbers contains {0} elements: ", highNumbers->Count); - DisplaySet(highNumbers); - } - /* This example provides output similar to the following: - * lowNumbers contains 6 elements: { 0 1 2 3 4 5 } - * highNumbers contains 7 elements: { 3 4 5 6 7 8 9 } - * highNumbers ExceptWith lowNumbers... - * highNumbers contains 4 elements: { 6 7 8 9 } - */ - // - -private: - static void DisplaySet(HashSet^ set) - { - Console::Write("{"); - for each (int i in set) - { - Console::Write(" {0}", i); - } - Console::WriteLine(" }"); - } -}; - -int main() -{ - Program::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp deleted file mode 100644 index 2ff29223cc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections::Generic; - -ref class Program -{ -public: - static void Main() - { - HashSet ^allVehicles = gcnew HashSet(StringComparer::OrdinalIgnoreCase); - List^ someVehicles = gcnew List(); - - someVehicles->Add("Planes"); - someVehicles->Add("Trains"); - someVehicles->Add("Automobiles"); - - // Add in the vehicles contained in the someVehicles list. - allVehicles->UnionWith(someVehicles); - - Console::WriteLine("The current HashSet contains:\n"); - for each (String^ vehicle in allVehicles) - { - Console::WriteLine(vehicle); - } - - allVehicles->Add("Ships"); - allVehicles->Add("Motorcycles"); - allVehicles->Add("Rockets"); - allVehicles->Add("Helicopters"); - allVehicles->Add("Submarines"); - - Console::WriteLine("\nThe updated HashSet contains:\n"); - for each (String^ vehicle in allVehicles) - { - Console::WriteLine(vehicle); - } - - // Verify that the 'All Vehicles' set contains at least the vehicles in - // the 'Some Vehicles' list. - if (allVehicles->IsSupersetOf(someVehicles)) - { - Console::Write("\nThe 'All' vehicles set contains everything in "); - Console::WriteLine("'Some' vechicles list."); - } - - // Check for Rockets. Here the OrdinalIgnoreCase comparer will compare - // true for the mixed-case vehicle type. - if (allVehicles->Contains("roCKeTs")) - { - Console::WriteLine("\nThe 'All' vehicles set contains 'roCKeTs'"); - } - - allVehicles->ExceptWith(someVehicles); - Console::WriteLine("\nThe excepted HashSet contains:\n"); - for each (String^ vehicle in allVehicles) - { - Console::WriteLine(vehicle); - } - - // Remove all the vehicles that are not 'super cool'. - allVehicles->RemoveWhere(gcnew Predicate(&isNotSuperCool)); - - Console::WriteLine("\nThe super cool vehicles are:\n"); - for each (String^ vehicle in allVehicles) - { - Console::WriteLine(vehicle); - } - } - -private: - // Predicate to determine vehicle 'coolness'. - static bool isNotSuperCool(String^ vehicle) - { - bool superCool = (vehicle == "Helicopters") || (vehicle == "Motorcycles"); - - return !superCool; - } -}; - -int main() -{ - Program::Main(); -} - -// The program writes the following output to the console:: -// -// The current HashSet contains: -// -// Planes -// Trains -// Automobiles -// -// The updated HashSet contains: -// -// Planes -// Trains -// Automobiles -// Ships -// Motorcycles -// Rockets -// Helicopters -// Submarines -// -// The 'All' vehicles set contains everything in 'Some' vechicles list. -// -// The 'All' vehicles set contains 'roCKeTs' -// -// The excepted HashSet contains: -// -// Ships -// Motorcycles -// Rockets -// Helicopters -// Submarines -// -// The super cool vehicles are: -// -// Motorcycles -// Helicopters -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp deleted file mode 100644 index 3533f81fe87..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// The following code example creates and initializes a LinkedList of type String and then displays its contents. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Generic; - -void main() -{ - // Create and initialize a new LinkedList. - LinkedList< String^ > ^ ll = gcnew LinkedList< String^ >; - ll->AddLast(L"red"); - ll->AddLast(L"orange"); - ll->AddLast(L"yellow"); - ll->AddLast(L"orange"); - - // Display the contents of the LinkedList. - if (ll->Count > 0) - { - Console::WriteLine(L"The first item in the list is {0}.", ll->First->Value); - Console::WriteLine(L"The last item in the list is {0}.", ll->Last->Value); - Console::WriteLine(L"The LinkedList contains:"); - - for each (String^ s in ll) - { - Console::WriteLine(L" {0}", s); - } - } - else - { - Console::WriteLine(L"The LinkedList is empty."); - } -} - -/* This code produces the following output. - -The first item in the list is red. -The last item in the list is orange. -The LinkedList contains: - red - orange - yellow - orange -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp deleted file mode 100644 index e6f279e12f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// The following code example creates a LinkedList node, adds it to a LinkedList, and tracks the values of its properties as the LinkedList changes. - - -// -#using - -using namespace System; -using namespace System::Collections::Generic; - -public ref class GenericCollection { - -public: - static void Main() { - - // Create a new LinkedListNode of type String and displays its properties. - LinkedListNode^ lln = gcnew LinkedListNode( "orange" ); - Console::WriteLine( "After creating the node ...." ); - DisplayProperties( lln ); - - // Create a new LinkedList. - LinkedList^ ll = gcnew LinkedList(); - - // Add the "orange" node and display its properties. - ll->AddLast( lln ); - Console::WriteLine( "After adding the node to the empty LinkedList ...." ); - DisplayProperties( lln ); - - // Add nodes before and after the "orange" node and display the "orange" node's properties. - ll->AddFirst( "red" ); - ll->AddLast( "yellow" ); - Console::WriteLine( "After adding red and yellow ...." ); - DisplayProperties( lln ); - - } - - static void DisplayProperties( LinkedListNode^ lln ) { - if ( lln->List == nullptr ) - Console::WriteLine( " Node is not linked." ); - else - Console::WriteLine( " Node belongs to a linked list with {0} elements.", lln->List->Count ); - - if ( lln->Previous == nullptr ) - Console::WriteLine( " Previous node is null." ); - else - Console::WriteLine( " Value of previous node: {0}", lln->Previous->Value ); - - Console::WriteLine( " Value of current node: {0}", lln->Value ); - - if ( lln->Next == nullptr ) - Console::WriteLine( " Next node is null." ); - else - Console::WriteLine( " Value of next node: {0}", lln->Next->Value ); - - Console::WriteLine(); - } - -}; - -int main() -{ - GenericCollection::Main(); -} - -/* - -This code produces the following output. - -After creating the node .... - Node is not linked. - Previous node is null. - Value of current node: orange - Next node is null. - -After adding the node to the empty LinkedList .... - Node belongs to a linked list with 1 elements. - Previous node is null. - Value of current node: orange - Next node is null. - -After adding red and yellow .... - Node belongs to a linked list with 3 elements. - Value of previous node: red - Value of current node: orange - Value of next node: yellow - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp deleted file mode 100644 index 987e041929f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// -using namespace System; -using namespace System::Collections; - -public ref class Example -{ -public: - static void Main() - { - // Create a new hash table. - // - Hashtable^ openWith = gcnew Hashtable(); - - // Add some elements to the hash table. There are no - // duplicate keys, but some of the values are duplicates. - openWith->Add("txt", "notepad.exe"); - openWith->Add("bmp", "paint.exe"); - openWith->Add("dib", "paint.exe"); - openWith->Add("rtf", "wordpad.exe"); - - // The Add method throws an exception if the new key is - // already in the hash table. - try - { - openWith->Add("txt", "winword.exe"); - } - catch(...) - { - Console::WriteLine("An element with Key = \"txt\" already exists."); - } - - // The Item property is the default property, so you - // can omit its name when accessing elements. - Console::WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]); - - // The default Item property can be used to change the value - // associated with a key. - openWith["rtf"] = "winword.exe"; - Console::WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]); - - // If a key does not exist, setting the default Item property - // for that key adds a new key/value pair. - openWith["doc"] = "winword.exe"; - - // ContainsKey can be used to test keys before inserting - // them. - if (!openWith->ContainsKey("ht")) - { - openWith->Add("ht", "hypertrm.exe"); - Console::WriteLine("Value added for key = \"ht\": {0}", openWith["ht"]); - } - - // When you use foreach to enumerate hash table elements, - // the elements are retrieved as KeyValuePair objects. - Console::WriteLine(); - for each( DictionaryEntry de in openWith ) - { - Console::WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); - } - - // To get the values alone, use the Values property. - ICollection^ valueColl = openWith->Values; - - // The elements of the ValueCollection are strongly typed - // with the type that was specified for hash table values. - Console::WriteLine(); - for each( String^ s in valueColl ) - { - Console::WriteLine("Value = {0}", s); - } - - // To get the keys alone, use the Keys property. - ICollection^ keyColl = openWith->Keys; - - // The elements of the KeyCollection are strongly typed - // with the type that was specified for hash table keys. - Console::WriteLine(); - for each( String^ s in keyColl ) - { - Console::WriteLine("Key = {0}", s); - } - - // Use the Remove method to remove a key/value pair. - Console::WriteLine("\nRemove(\"doc\")"); - openWith->Remove("doc"); - - if (!openWith->ContainsKey("doc")) - { - Console::WriteLine("Key \"doc\" is not found."); - } - } -}; - -int main() -{ - Example::Main(); -} - -/* This code example produces the following output: - -An element with Key = "txt" already exists. -For key = "rtf", value = wordpad.exe. -For key = "rtf", value = winword.exe. -Value added for key = "ht": hypertrm.exe - -Key = dib, Value = paint.exe -Key = txt, Value = notepad.exe -Key = ht, Value = hypertrm.exe -Key = bmp, Value = paint.exe -Key = rtf, Value = winword.exe -Key = doc, Value = winword.exe - -Value = paint.exe -Value = notepad.exe -Value = hypertrm.exe -Value = paint.exe -Value = winword.exe -Value = winword.exe - -Key = dib -Key = txt -Key = ht -Key = bmp -Key = rtf -Key = doc - -Remove("doc") -Key "doc" is not found. - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp deleted file mode 100644 index 5b410769391..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp +++ /dev/null @@ -1,36 +0,0 @@ -using namespace System; -using namespace System::Collections; - -public ref class Remarks -{ -public: - static void Main() - { - // Create a new hash table. - // - Hashtable^ myHashtable = gcnew Hashtable(); - - // Add some elements to the hash table. There are no - // duplicate keys, but some of the values are duplicates. - myHashtable->Add("txt", "notepad.exe"); - myHashtable->Add("bmp", "paint.exe"); - myHashtable->Add("dib", "paint.exe"); - myHashtable->Add("rtf", "wordpad.exe"); - - - // When you use foreach to enumerate hash table elements, - // the elements are retrieved as KeyValuePair objects. - // - for each(DictionaryEntry de in myHashtable) - { - // ... - } - // - } -}; - -int main() -{ - Remarks::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp deleted file mode 100644 index a614056e17b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp +++ /dev/null @@ -1,110 +0,0 @@ - -// The following code example creates hash tables using different Hashtable constructors -// and demonstrates the differences in the behavior of the hash tables, -// even if each one contains the same elements. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -ref class myComparer : IEqualityComparer -{ -public: - virtual bool Equals(Object^ x, Object^ y) - { - return x->Equals(y); - } - - virtual int GetHashCode(Object^ obj) - { - return obj->ToString()->ToLower()->GetHashCode(); - } -}; - -// -ref class myCultureComparer : IEqualityComparer -{ -private: - CaseInsensitiveComparer^ myComparer; - -public: - myCultureComparer() - { - myComparer = CaseInsensitiveComparer::DefaultInvariant; - } - - myCultureComparer(CultureInfo^ myCulture) - { - myComparer = gcnew CaseInsensitiveComparer(myCulture); - } - - virtual bool Equals(Object^ x, Object^ y) - { - if (myComparer->Compare(x, y) == 0) - { - return true; - } - else - { - return false; - } - } - - virtual int GetHashCode(Object^ obj) - { - return obj->ToString()->ToLower()->GetHashCode(); - } -}; -// - -int main() -{ - - // Create a hash table using the default hash code provider and the default comparer. - Hashtable^ myHT1 = gcnew Hashtable((IEqualityComparer^)nullptr); - myHT1->Add( "FIRST", "Hello" ); - myHT1->Add( "SECOND", "World" ); - myHT1->Add( "THIRD", "!" ); - - // Create a hash table using the specified IEqualityComparer that uses - // the default Object.Equals to determine equality. - Hashtable^ myHT2 = gcnew Hashtable(gcnew myComparer()); - myHT2->Add( "FIRST", "Hello" ); - myHT2->Add( "SECOND", "World" ); - myHT2->Add( "THIRD", "!" ); - - // Create a hash table using a case-insensitive hash code provider and - // case-insensitive comparer based on the InvariantCulture. - Hashtable^ myHT3 = gcnew Hashtable( - CaseInsensitiveHashCodeProvider::DefaultInvariant, - CaseInsensitiveComparer::DefaultInvariant); - myHT3->Add( "FIRST", "Hello" ); - myHT3->Add( "SECOND", "World" ); - myHT3->Add( "THIRD", "!" ); - - // Create a hash table using an IEqualityComparer that is based on - // the Turkish culture (tr-TR) where "I" is not the uppercase - // version of "i". - CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); - Hashtable^ myHT4 = gcnew Hashtable( gcnew myCultureComparer(myCul) ); - myHT4->Add( "FIRST", "Hello" ); - myHT4->Add( "SECOND", "World" ); - myHT4->Add( "THIRD", "!" ); - - // Search for a key in each hash table. - Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT4: {0}", myHT4->ContainsKey( "first" ) ); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -first is in myHT1: False -first is in myHT2: False -first is in myHT3: True -first is in myHT4: False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp deleted file mode 100644 index ddc083162d8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// The following code example creates hash tables using different Hashtable -// constructors and demonstrates the differences in the behavior of the hash -// tables, even if each one contains the same elements. - -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -ref class myCultureComparer : public IEqualityComparer -{ -public: - CaseInsensitiveComparer^ myComparer; - -public: - myCultureComparer() - { - myComparer = CaseInsensitiveComparer::DefaultInvariant; - } - -public: - myCultureComparer(CultureInfo^ myCulture) - { - myComparer = gcnew CaseInsensitiveComparer(myCulture); - } - -public: - virtual bool Equals(Object^ x, Object^ y) - { - if (myComparer->Compare(x, y) == 0) - { - return true; - } - else - { - return false; - } - } - -public: - virtual int GetHashCode(Object^ obj) - { - // Compare the hash code for the lowercase versions of the strings. - return obj->ToString()->ToLower()->GetHashCode(); - } -}; - -public ref class SamplesHashtable -{ - -public: - static void Main() - { - // Create the dictionary. - SortedList^ mySL = gcnew SortedList(); - mySL->Add("FIRST", "Hello"); - mySL->Add("SECOND", "World"); - mySL->Add("THIRD", "!"); - - // Create a hash table using the default comparer. - Hashtable^ myHT1 = gcnew Hashtable(mySL); - - // Create a hash table using the specified IEqualityComparer that uses - // the CaseInsensitiveComparer.DefaultInvariant to determine equality. - Hashtable^ myHT2 = gcnew Hashtable(mySL, gcnew myCultureComparer()); - - // Create a hash table using an IEqualityComparer that is based on - // the Turkish culture (tr-TR) where "I" is not the uppercase - // version of "i". - CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); - Hashtable^ myHT3 = gcnew Hashtable(mySL, gcnew myCultureComparer(myCul)); - - // Search for a key in each hash table. - Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first")); - Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first")); - Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first")); - } -}; - -int main() -{ - SamplesHashtable::Main(); -}; - -/* -This code produces the following output. -Results vary depending on the system's culture settings. - -first is in myHT1: False -first is in myHT2: True -first is in myHT3: False - -*/ -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp deleted file mode 100644 index aeefb15d534..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -// The following code example creates hash tables using different Hashtable constructors -// and demonstrates the differences in the behavior of the hash tables, -// even if each one contains the same elements. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -ref class myCultureComparer : public IEqualityComparer -{ -public: - CaseInsensitiveComparer^ myComparer; - -public: - myCultureComparer() - { - myComparer = CaseInsensitiveComparer::DefaultInvariant; - } - -public: - myCultureComparer(CultureInfo^ myCulture) - { - myComparer = gcnew CaseInsensitiveComparer(myCulture); - } - -public: - virtual bool Equals(Object^ x, Object^ y) - { - if (myComparer->Compare(x, y) == 0) - { - return true; - } - else - { - return false; - } - } - -public: - virtual int GetHashCode(Object^ obj) - { - // Compare the hash code for the lowercase versions of the strings. - return obj->ToString()->ToLower()->GetHashCode(); - } -}; - -public ref class SamplesHashtable -{ - -public: - static void Main() - { - - // Create the dictionary. - SortedList^ mySL = gcnew SortedList; - mySL->Add( "FIRST", "Hello" ); - mySL->Add( "SECOND", "World" ); - mySL->Add( "THIRD", "!" ); - - // Create a hash table using the default hash code provider and the default comparer. - Hashtable^ myHT1 = gcnew Hashtable( mySL, .8f ); - - // Create a hash table using the specified case-insensitive hash code provider and case-insensitive comparer. - Hashtable^ myHT2 = gcnew Hashtable( mySL, .8f, gcnew myCultureComparer() ); - - // Create a hash table using the specified KeyComparer. - // The KeyComparer uses a case-insensitive hash code provider and a case-insensitive comparer, - // which are based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i". - CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); - Hashtable^ myHT3 = gcnew Hashtable( mySL, .8f, gcnew myCultureComparer( myCul ) ); - - // Search for a key in each hash table. - Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) ); - Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) ); - } -}; - -int main() -{ - SamplesHashtable::Main(); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -first is in myHT1: False -first is in myHT2: True -first is in myHT3: False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp deleted file mode 100644 index 90be7623a99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -// The following code example creates hash tables using different Hashtable constructors -// and demonstrates the differences in the behavior of the hash tables, -// even if each one contains the same elements. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -ref class myCultureComparer : public IEqualityComparer -{ -public: - CaseInsensitiveComparer^ myComparer; - -public: - myCultureComparer() - { - myComparer = CaseInsensitiveComparer::DefaultInvariant; - } - -public: - myCultureComparer(CultureInfo^ myCulture) - { - myComparer = gcnew CaseInsensitiveComparer(myCulture); - } - -public: - virtual bool Equals(Object^ x, Object^ y) - { - if (myComparer->Compare(x, y) == 0) - { - return true; - } - else - { - return false; - } - } - -public: - virtual int GetHashCode(Object^ obj) - { - // Compare the hash code for the lowercase versions of the strings. - return obj->ToString()->ToLower()->GetHashCode(); - } -}; - -public ref class SamplesHashtable -{ - -public: - static void Main() - { - // Create a hash table using the default comparer. - Hashtable^ myHT1 = gcnew Hashtable(3); - myHT1->Add("FIRST", "Hello"); - myHT1->Add("SECOND", "World"); - myHT1->Add("THIRD", "!"); - - // Create a hash table using the specified IEqualityComparer that uses - // the CaseInsensitiveComparer.DefaultInvariant to determine equality. - Hashtable^ myHT2 = gcnew Hashtable(3, gcnew myCultureComparer()); - myHT2->Add("FIRST", "Hello"); - myHT2->Add("SECOND", "World"); - myHT2->Add("THIRD", "!"); - - // Create a hash table using an IEqualityComparer that is based on - // the Turkish culture (tr-TR) where "I" is not the uppercase - // version of "i". - CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); - Hashtable^ myHT3 = gcnew Hashtable(3, gcnew myCultureComparer(myCul)); - myHT3->Add("FIRST", "Hello"); - myHT3->Add("SECOND", "World"); - myHT3->Add("THIRD", "!"); - - // Search for a key in each hash table. - Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first")); - Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first")); - Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first")); - - } -}; - -int main() -{ - SamplesHashtable::Main(); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -first is in myHT1: False -first is in myHT2: True -first is in myHT3: False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp deleted file mode 100644 index a55776fd358..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp +++ /dev/null @@ -1,97 +0,0 @@ - -// The following code example creates hash tables using different Hashtable constructors -// and demonstrates the differences in the behavior of the hash tables, -// even if each one contains the same elements. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -ref class myCultureComparer : public IEqualityComparer -{ -public: - CaseInsensitiveComparer^ myComparer; - -public: - myCultureComparer() - { - myComparer = CaseInsensitiveComparer::DefaultInvariant; - } - -public: - myCultureComparer(CultureInfo^ myCulture) - { - myComparer = gcnew CaseInsensitiveComparer(myCulture); - } - -public: - virtual bool Equals(Object^ x, Object^ y) - { - if (myComparer->Compare(x, y) == 0) - { - return true; - } - else - { - return false; - } - } - -public: - virtual int GetHashCode(Object^ obj) - { - // Compare the hash code for the lowercase versions of the strings. - return obj->ToString()->ToLower()->GetHashCode(); - } -}; - -public ref class SamplesHashtable -{ - -public: - static void Main() - { - // Create a hash table using the default comparer. - Hashtable^ myHT1 = gcnew Hashtable(3, .8f); - myHT1->Add("FIRST", "Hello"); - myHT1->Add("SECOND", "World"); - myHT1->Add("THIRD", "!"); - - // Create a hash table using the specified IEqualityComparer that uses - // the CaseInsensitiveComparer.DefaultInvariant to determine equality. - Hashtable^ myHT2 = gcnew Hashtable(3, .8f, gcnew myCultureComparer()); - myHT2->Add("FIRST", "Hello"); - myHT2->Add("SECOND", "World"); - myHT2->Add("THIRD", "!"); - - // Create a hash table using an IEqualityComparer that is based on - // the Turkish culture (tr-TR) where "I" is not the uppercase - // version of "i". - CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); - Hashtable^ myHT3 = gcnew Hashtable(3, .8f, gcnew myCultureComparer(myCul)); - myHT3->Add("FIRST", "Hello"); - myHT3->Add("SECOND", "World"); - myHT3->Add("THIRD", "!"); - - // Search for a key in each hash table. - Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first")); - Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first")); - Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first")); - - } -}; - -int main() -{ - SamplesHashtable::Main(); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -first is in myHT1: False -first is in myHT2: True -first is in myHT3: False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp deleted file mode 100644 index f1919addfd6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// The following code example implements the ReadOnlyCollectionBase class. -// -using namespace System; -using namespace System::Collections; -public ref class ROCollection: public ReadOnlyCollectionBase -{ -public: - ROCollection( IList^ sourceList ) - { - InnerList->AddRange( sourceList ); - } - - property Object^ Item [int] - { - Object^ get( int index ) - { - return (InnerList[ index ]); - } - - } - int IndexOf( Object^ value ) - { - return (InnerList->IndexOf( value )); - } - - bool Contains( Object^ value ) - { - return (InnerList->Contains( value )); - } - -}; - -void PrintIndexAndValues( ROCollection^ myCol ); -void PrintValues2( ROCollection^ myCol ); -int main() -{ - // Create an ArrayList. - ArrayList^ myAL = gcnew ArrayList; - myAL->Add( "red" ); - myAL->Add( "blue" ); - myAL->Add( "yellow" ); - myAL->Add( "green" ); - myAL->Add( "orange" ); - myAL->Add( "purple" ); - - // Create a new ROCollection that contains the elements in myAL. - ROCollection^ myCol = gcnew ROCollection( myAL ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Contents of the collection (using enumerator):" ); - PrintValues2( myCol ); - - // Display the contents of the collection using the Count property and the Item property. - Console::WriteLine( "Contents of the collection (using Count and Item):" ); - PrintIndexAndValues( myCol ); - - // Search the collection with Contains and IndexOf. - Console::WriteLine( "Contains yellow: {0}", myCol->Contains( "yellow" ) ); - Console::WriteLine( "orange is at index {0}.", myCol->IndexOf( "orange" ) ); - Console::WriteLine(); -} - - -// Uses the Count property and the Item property. -void PrintIndexAndValues( ROCollection^ myCol ) -{ - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " [{0}]: {1}", i, myCol->Item[ i ] ); - Console::WriteLine(); -} - - -// Uses the enumerator. -void PrintValues2( ROCollection^ myCol ) -{ - System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0}", myEnumerator->Current ); - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Contents of the collection (using enumerator): - red - blue - yellow - green - orange - purple - -Contents of the collection (using Count and Item): - [0]: red - [1]: blue - [2]: yellow - [3]: green - [4]: orange - [5]: purple - -Contains yellow: True -orange is at index 4. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp deleted file mode 100644 index aea5c5a39cb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -// The following code example implements the ReadOnlyCollectionBase class. -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class ROCollection: public ReadOnlyCollectionBase -{ -public: - ROCollection( IList^ sourceList ) - { - InnerList->AddRange( sourceList ); - } - - property Object^ Item [int] - { - Object^ get( int index ) - { - return (InnerList[ index ]); - } - - } - int IndexOf( Object^ value ) - { - return (InnerList->IndexOf( value )); - } - - bool Contains( Object^ value ) - { - return (InnerList->Contains( value )); - } - -}; - -public ref class SamplesCollectionBase -{ -public: - static void Main() - { - - // Create an ArrayList. - ArrayList^ myAL = gcnew ArrayList(); - myAL->Add( "red" ); - myAL->Add( "blue" ); - myAL->Add( "yellow" ); - myAL->Add( "green" ); - myAL->Add( "orange" ); - myAL->Add( "purple" ); - - // Create a new ROCollection that contains the elements in myAL. - ROCollection^ myReadOnlyCollection = gcnew ROCollection( myAL ); - - // - // Get the ICollection interface from the ReadOnlyCollectionBase - // derived class. - ICollection^ myCollection = myReadOnlyCollection; - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesCollectionBase::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp deleted file mode 100644 index 89c82b72244..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp +++ /dev/null @@ -1,116 +0,0 @@ - -// - -// The following code example creates SortedList instances using different constructors -// and demonstrates the differences in the behavior of the SortedList instances. - -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -void PrintKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( " -KEY- -VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Create a SortedList using the default comparer. - SortedList^ mySL1 = gcnew SortedList; - Console::WriteLine( "mySL1 (default):" ); - mySL1->Add( "FIRST", "Hello" ); - mySL1->Add( "SECOND", "World" ); - mySL1->Add( "THIRD", "!" ); - - try { mySL1->Add( "first", "Ola!" ); } - catch ( ArgumentException^ e ) { Console::WriteLine( e ); } - - PrintKeysAndValues( mySL1 ); - - // Create a SortedList using the specified case-insensitive comparer. - SortedList^ mySL2 = gcnew SortedList( gcnew CaseInsensitiveComparer ); - Console::WriteLine( "mySL2 (case-insensitive comparer):" ); - mySL2->Add( "FIRST", "Hello" ); - mySL2->Add( "SECOND", "World" ); - mySL2->Add( "THIRD", "!" ); - - try { mySL2->Add( "first", "Ola!" ); } - catch ( ArgumentException^ e ) { Console::WriteLine( e ); } - - PrintKeysAndValues( mySL2 ); - - // Create a SortedList using the specified KeyComparer. - // The KeyComparer uses a case-insensitive hash code provider and a case-insensitive comparer, - // which are based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i". - CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); - SortedList^ mySL3 = gcnew SortedList( gcnew CaseInsensitiveComparer( myCul ) ); - Console::WriteLine( "mySL3 (case-insensitive comparer, Turkish culture):" ); - mySL3->Add( "FIRST", "Hello" ); - mySL3->Add( "SECOND", "World" ); - mySL3->Add( "THIRD", "!" ); - - try { mySL3->Add( "first", "Ola!" ); } - catch ( ArgumentException^ e ) { Console::WriteLine( e ); } - - PrintKeysAndValues( mySL3 ); - - // Create a SortedList using the ComparisonType.InvariantCultureIgnoreCase value. - SortedList^ mySL4 = gcnew SortedList( StringComparer::InvariantCultureIgnoreCase ); - Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" ); - mySL4->Add( "FIRST", "Hello" ); - mySL4->Add( "SECOND", "World" ); - mySL4->Add( "THIRD", "!" ); - - try { mySL4->Add( "first", "Ola!" ); } - catch ( ArgumentException^ e ) { Console::WriteLine( e ); } - - PrintKeysAndValues( mySL4 ); - - Console::WriteLine("\n\nHit ENTER to return"); - Console::ReadLine(); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -mySL1 (default): - -KEY- -VALUE- - first : Ola! - FIRST : Hello - SECOND: World - THIRD : ! - -mySL2 (case-insensitive comparer): -System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' - at System.Collections.SortedList.Add(Object key, Object value) - at SamplesSortedList.Main() - -KEY- -VALUE- - FIRST : Hello - SECOND: World - THIRD : ! - -mySL3 (case-insensitive comparer, Turkish culture): - -KEY- -VALUE- - FIRST : Hello - first : Ola! - SECOND: World - THIRD : ! - -mySL4 (InvariantCultureIgnoreCase): -System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' - at System.Collections.SortedList.Add(Object key, Object value) - at SamplesSortedList.Main() - -KEY- -VALUE- - FIRST : Hello - SECOND: World - THIRD : ! - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp deleted file mode 100644 index 89748fd1f54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp +++ /dev/null @@ -1,126 +0,0 @@ - -// The following code example creates SortedList instances using different constructors -// and demonstrates the differences in the behavior of the SortedList instances. -// - - -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; -void PrintKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( " -KEY- -VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Create the dictionary. - Hashtable^ myHT = gcnew Hashtable; - myHT->Add( "FIRST", "Hello" ); - myHT->Add( "SECOND", "World" ); - myHT->Add( "THIRD", "!" ); - - // Create a SortedList using the default comparer. - SortedList^ mySL1 = gcnew SortedList( myHT ); - Console::WriteLine( "mySL1 (default):" ); - try - { - mySL1->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL1 ); - - // Create a SortedList using the specified case-insensitive comparer. - SortedList^ mySL2 = gcnew SortedList( myHT,gcnew CaseInsensitiveComparer ); - Console::WriteLine( "mySL2 (case-insensitive comparer):" ); - try - { - mySL2->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL2 ); - - // Create a SortedList using the specified CaseInsensitiveComparer, - // which is based on the Turkish culture (tr-TR), where "I" is not - // the uppercase version of "i". - CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); - SortedList^ mySL3 = gcnew SortedList( myHT, gcnew CaseInsensitiveComparer( myCul ) ); - Console::WriteLine( "mySL3 (case-insensitive comparer, Turkish culture):" ); - try - { - mySL3->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL3 ); - - // Create a SortedList using the ComparisonType.InvariantCultureIgnoreCase value. - SortedList^ mySL4 = gcnew SortedList( myHT, StringComparer::InvariantCultureIgnoreCase ); - Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" ); - try - { - mySL4->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL4 ); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -mySL1 (default): - -KEY- -VALUE- - first : Ola! - FIRST : Hello - SECOND: World - THIRD : ! - -mySL2 (case-insensitive comparer): -System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' - at System.Collections.SortedList.Add(Object key, Object value) - at SamplesSortedList.Main() - -KEY- -VALUE- - FIRST : Hello - SECOND: World - THIRD : ! - -mySL3 (case-insensitive comparer, Turkish culture): - -KEY- -VALUE- - FIRST : Hello - first : Ola! - SECOND: World - THIRD : ! - -mySL4 (InvariantCultureIgnoreCase): -System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' - at System.Collections.SortedList.Add(Object key, Object value) - at SamplesSortedList.Main() - -KEY- -VALUE- - FIRST : Hello - SECOND: World - THIRD : ! - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp deleted file mode 100644 index 047062c6747..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// The following code example creates SortedList instances using different constructors -// and demonstrates the differences in the behavior of the SortedList instances. - - - -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; -void PrintKeysAndValues( SortedList^ myList ) -{ - Console::WriteLine( " Capacity is {0}.", myList->Capacity ); - Console::WriteLine( " -KEY- -VALUE-" ); - for ( int i = 0; i < myList->Count; i++ ) - { - Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) ); - - } - Console::WriteLine(); -} - -int main() -{ - - // Create a SortedList using the default comparer. - SortedList^ mySL1 = gcnew SortedList( 3 ); - Console::WriteLine( "mySL1 (default):" ); - mySL1->Add( "FIRST", "Hello" ); - mySL1->Add( "SECOND", "World" ); - mySL1->Add( "THIRD", "!" ); - try - { - mySL1->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL1 ); - - // Create a SortedList using the specified case-insensitive comparer. - SortedList^ mySL2 = gcnew SortedList( gcnew CaseInsensitiveComparer,3 ); - Console::WriteLine( "mySL2 (case-insensitive comparer):" ); - mySL2->Add( "FIRST", "Hello" ); - mySL2->Add( "SECOND", "World" ); - mySL2->Add( "THIRD", "!" ); - try - { - mySL2->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL2 ); - - // Create a SortedList using the specified CaseInsensitiveComparer, - // which is based on the Turkish culture (tr-TR), where "I" is not - // the uppercase version of "i". - CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); - SortedList^ mySL3 = gcnew SortedList(gcnew CaseInsensitiveComparer(myCul), 3); - - Console::WriteLine("mySL3 (case-insensitive comparer, Turkish culture):"); - - mySL3->Add("FIRST", "Hello"); - mySL3->Add("SECOND", "World"); - mySL3->Add("THIRD", "!"); - try - { - mySL3->Add("first", "Ola!"); - } - catch (ArgumentException^ e) - { - Console::WriteLine(e); - } - PrintKeysAndValues(mySL3); - - // Create a SortedList using the - // StringComparer.InvariantCultureIgnoreCase value. - SortedList^ mySL4 = gcnew SortedList( StringComparer::InvariantCultureIgnoreCase, 3 ); - Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" ); - mySL4->Add( "FIRST", "Hello" ); - mySL4->Add( "SECOND", "World" ); - mySL4->Add( "THIRD", "!" ); - try - { - mySL4->Add( "first", "Ola!" ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - PrintKeysAndValues( mySL4 ); -} - -/* -This code produces the following output. Results vary depending on the system's culture settings. - -mySL1 (default): - Capacity is 6. - -KEY- -VALUE- - first : Ola! - FIRST : Hello - SECOND: World - THIRD : ! - -mySL2 (case-insensitive comparer): -System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' - at System.Collections.SortedList.Add(Object key, Object value) - at SamplesSortedList.Main() - Capacity is 3. - -KEY- -VALUE- - FIRST : Hello - SECOND: World - THIRD : ! - -mySL3 (case-insensitive comparer, Turkish culture): - Capacity is 6. - -KEY- -VALUE- - FIRST : Hello - first : Ola! - SECOND: World - THIRD : ! - -mySL4 (InvariantCultureIgnoreCase): -System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' - at System.Collections.SortedList.Add(Object key, Object value) - at SamplesSortedList.Main() - Capacity is 3. - -KEY- -VALUE- - FIRST : Hello - SECOND: World - THIRD : ! - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp deleted file mode 100644 index a4aa7596eb9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// The following code example shows how to create and use masks. -// -#using - -using namespace System; -using namespace System::Collections::Specialized; -int main() -{ - // Creates and initializes a BitVector32 with all bit flags set to FALSE. - BitVector32 myBV; - - // Creates masks to isolate each of the first five bit flags. - int myBit1 = BitVector32::CreateMask(); - int myBit2 = BitVector32::CreateMask( myBit1 ); - int myBit3 = BitVector32::CreateMask( myBit2 ); - int myBit4 = BitVector32::CreateMask( myBit3 ); - int myBit5 = BitVector32::CreateMask( myBit4 ); - Console::WriteLine( "Initial: \t {0}", myBV ); - - // Sets the third bit to TRUE. - myBV[ myBit3 ] = true; - Console::WriteLine( "myBit3 = TRUE \t {0}", myBV ); - - // Combines two masks to access multiple bits at a time. - myBV[ myBit4 + myBit5 ] = true; - Console::WriteLine( "myBit4 + myBit5 = TRUE \t {0}", myBV ); - myBV[ myBit1 | myBit2 ] = true; - Console::WriteLine( "myBit1 | myBit2 = TRUE \t {0}", myBV ); -} - -/* -This code produces the following output. - -Initial: BitVector32 {00000000000000000000000000000000} -myBit3 = TRUE BitVector32 {00000000000000000000000000000100} -myBit4 + myBit5 = TRUE BitVector32 {00000000000000000000000000011100} -myBit1 | myBit2 = TRUE BitVector32 {00000000000000000000000000011111} - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp deleted file mode 100644 index e3796e3bdc3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// The following code example compares a BitVector32 with another BitVector32 and with an Int32. -// -#using - -using namespace System; -using namespace System::Collections::Specialized; - -int main() -{ - // Creates and initializes a BitVector32 with the value 123. - // This is the BitVector32 that will be compared to different types. - BitVector32 myBV(123); - - // Creates and initializes a new BitVector32 which will be set up as sections. - BitVector32 myBVsect(0); - - // Compares myBV and myBVsect. - Console::WriteLine( "myBV : {0}", myBV ); - Console::WriteLine( "myBVsect : {0}", myBVsect ); - if ( myBV.Equals( myBVsect ) ) - Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data ); - else - Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data ); - - Console::WriteLine(); - - // Assigns values to the sections of myBVsect. - BitVector32::Section mySect1 = BitVector32::CreateSection( 5 ); - BitVector32::Section mySect2 = BitVector32::CreateSection( 1, mySect1 ); - BitVector32::Section mySect3 = BitVector32::CreateSection( 20, mySect2 ); - myBVsect[ mySect1 ] = 3; - myBVsect[ mySect2 ] = 1; - myBVsect[ mySect3 ] = 7; - - // Compares myBV and myBVsect. - Console::WriteLine( "myBV : {0}", myBV ); - Console::WriteLine( "myBVsect with values : {0}", myBVsect ); - if ( myBV.Equals( myBVsect ) ) - Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data ); - else - Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data ); - - Console::WriteLine(); - - // Compare myBV with an Int32. - Console::WriteLine( "Comparing myBV with an Int32: " ); - Int32 myInt32 = 123; - - // Using Equals will fail because Int32 is not compatible with BitVector32. - if ( myBV.Equals( myInt32 ) ) - Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) equals myInt32( {1}).", myBV.Data, myInt32 ); - else - Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 ); - - // To compare a BitVector32 with an Int32, use the "==" operator. - if ( myBV.Data == myInt32 ) - Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) equals myInt32( {1}).", myBV.Data, myInt32 ); - else - Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 ); -} - -/* -This code produces the following output. - -myBV : BitVector32 {00000000000000000000000001111011} -myBVsect : BitVector32 {00000000000000000000000000000000} - myBV(123) does not equal myBVsect(0). - -myBV : BitVector32 {00000000000000000000000001111011} -myBVsect with values : BitVector32 {00000000000000000000000001111011} - myBV(123) equals myBVsect(123). - -Comparing myBV with an Int32: - Using BitVector32::Equals, myBV(123) does not equal myInt32(123). - Using the "==" operator, myBV.Data(123) equals myInt32(123). - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp deleted file mode 100644 index 43f50a3e1db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// The following code example uses a BitVector32 as a collection of bit flags. -// -#using - -using namespace System; -using namespace System::Collections::Specialized; -int main() -{ - - // Creates and initializes a BitVector32 with all bit flags set to FALSE. - BitVector32 myBV(0); - - // Creates masks to isolate each of the first five bit flags. - int myBit1 = BitVector32::CreateMask(); - int myBit2 = BitVector32::CreateMask( myBit1 ); - int myBit3 = BitVector32::CreateMask( myBit2 ); - int myBit4 = BitVector32::CreateMask( myBit3 ); - int myBit5 = BitVector32::CreateMask( myBit4 ); - - // Sets the alternating bits to TRUE. - Console::WriteLine( "Setting alternating bits to TRUE:" ); - Console::WriteLine( " Initial: {0}", myBV ); - myBV[ myBit1 ] = true; - Console::WriteLine( " myBit1 = TRUE: {0}", myBV ); - myBV[ myBit3 ] = true; - Console::WriteLine( " myBit3 = TRUE: {0}", myBV ); - myBV[ myBit5 ] = true; - Console::WriteLine( " myBit5 = TRUE: {0}", myBV ); -} - -/* -This code produces the following output. - -Setting alternating bits to TRUE: -Initial: BitVector32 {00000000000000000000000000000000} -myBit1 = TRUE: BitVector32 {00000000000000000000000000000001} -myBit3 = TRUE: BitVector32 {00000000000000000000000000000101} -myBit5 = TRUE: BitVector32 {00000000000000000000000000010101} - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp deleted file mode 100644 index 91d45f3f84b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// The following code example uses a BitVector32 as a collection of sections. -// -#using - -using namespace System; -using namespace System::Collections::Specialized; - -int main() -{ - // Creates and initializes a BitVector32. - BitVector32 myBV(0); - - // Creates four sections in the BitVector32 with maximum values 6, 3, 1, and 15. - // mySect3, which uses exactly one bit, can also be used as a bit flag. - BitVector32::Section mySect1 = BitVector32::CreateSection( 6 ); - BitVector32::Section mySect2 = BitVector32::CreateSection( 3, mySect1 ); - BitVector32::Section mySect3 = BitVector32::CreateSection( 1, mySect2 ); - BitVector32::Section mySect4 = BitVector32::CreateSection( 15, mySect3 ); - - // Displays the values of the sections. - Console::WriteLine( "Initial values:" ); - Console::WriteLine( "\tmySect1: {0}", myBV[ mySect1 ] ); - Console::WriteLine( "\tmySect2: {0}", myBV[ mySect2 ] ); - Console::WriteLine( "\tmySect3: {0}", myBV[ mySect3 ] ); - Console::WriteLine( "\tmySect4: {0}", myBV[ mySect4 ] ); - - // Sets each section to a new value and displays the value of the BitVector32 at each step. - Console::WriteLine( "Changing the values of each section:" ); - Console::WriteLine( "\tInitial: \t {0}", myBV ); - myBV[ mySect1 ] = 5; - Console::WriteLine( "\tmySect1 = 5:\t {0}", myBV ); - myBV[ mySect2 ] = 3; - Console::WriteLine( "\tmySect2 = 3:\t {0}", myBV ); - myBV[ mySect3 ] = 1; - Console::WriteLine( "\tmySect3 = 1:\t {0}", myBV ); - myBV[ mySect4 ] = 9; - Console::WriteLine( "\tmySect4 = 9:\t {0}", myBV ); - - // Displays the values of the sections. - Console::WriteLine( "New values:" ); - Console::WriteLine( "\tmySect1: {0}", myBV[ mySect1 ] ); - Console::WriteLine( "\tmySect2: {0}", myBV[ mySect2 ] ); - Console::WriteLine( "\tmySect3: {0}", myBV[ mySect3 ] ); - Console::WriteLine( "\tmySect4: {0}", myBV[ mySect4 ] ); -} - -/* -This code produces the following output. - -Initial values: - mySect1: 0 - mySect2: 0 - mySect3: 0 - mySect4: 0 -Changing the values of each section: - Initial: BitVector32 {00000000000000000000000000000000} - mySect1 = 5: BitVector32 {00000000000000000000000000000101} - mySect2 = 3: BitVector32 {00000000000000000000000000011101} - mySect3 = 1: BitVector32 {00000000000000000000000000111101} - mySect4 = 9: BitVector32 {00000000000000000000001001111101} -New values: - mySect1: 5 - mySect2: 3 - mySect3: 1 - mySect4: 9 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp deleted file mode 100644 index f4a12c16ce9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp +++ /dev/null @@ -1,222 +0,0 @@ -// The following code example demonstrates several of the properties and methods of HybridDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintKeysAndValues1( IDictionary^ myCol ); -void PrintKeysAndValues2( IDictionary^ myCol ); -void PrintKeysAndValues3( HybridDictionary^ myCol ); -int main() -{ - - // Creates and initializes a new HybridDictionary. - HybridDictionary^ myCol = gcnew HybridDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - myCol->Add( "Plantain Bananas", "1.49" ); - myCol->Add( "Yellow Bananas", "0.79" ); - myCol->Add( "Strawberries", "3.33" ); - myCol->Add( "Cranberries", "5.98" ); - myCol->Add( "Navel Oranges", "1.29" ); - myCol->Add( "Grapes", "1.99" ); - myCol->Add( "Honeydew Melon", "0.59" ); - myCol->Add( "Seedless Watermelon", "0.49" ); - myCol->Add( "Pineapple", "1.49" ); - myCol->Add( "Nectarine", "1.99" ); - myCol->Add( "Plums", "1.69" ); - myCol->Add( "Peaches", "1.99" ); - - // Display the contents of the collection using for each. This is the preferred method. - Console::WriteLine( "Displays the elements using for each:" ); - PrintKeysAndValues1( myCol ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); - PrintKeysAndValues2( myCol ); - - // Display the contents of the collection using the Keys, Values, Count, and Item properties. - Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); - PrintKeysAndValues3( myCol ); - - // Copies the HybridDictionary to an array with DictionaryEntry elements. - array^myArr = gcnew array(myCol->Count); - myCol->CopyTo( myArr, 0 ); - - // Displays the values in the array. - Console::WriteLine( "Displays the elements in the array:" ); - Console::WriteLine( " KEY VALUE" ); - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); - Console::WriteLine(); - - // Searches for a key. - if ( myCol->Contains( "Kiwis" ) ) - Console::WriteLine( "The collection contains the key \"Kiwis\"." ); - else - Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); - - Console::WriteLine(); - - // Deletes a key. - myCol->Remove( "Plums" ); - Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" ); - PrintKeysAndValues1( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues1( myCol ); -} - -// Uses the for each statement which hides the complexity of the enumerator. -// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. -void PrintKeysAndValues1( IDictionary^ myCol ) { - Console::WriteLine( " KEY VALUE" ); - for each ( DictionaryEntry^ de in myCol ) - Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintKeysAndValues2( IDictionary^ myCol ) -{ - IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); - Console::WriteLine( " KEY VALUE" ); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); - - Console::WriteLine(); -} - -// Uses the Keys, Values, Count, and Item properties. -void PrintKeysAndValues3( HybridDictionary^ myCol ) -{ - array^myKeys = gcnew array(myCol->Count); - myCol->Keys->CopyTo( myKeys, 0 ); - Console::WriteLine( " INDEX KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); - Console::WriteLine(); -} - -/* -This code produces output similar to the following: - -Displays the elements using for each: - KEY VALUE - Strawberries 3.33 - Yellow Bananas 0.79 - Cranberries 5.98 - Grapes 1.99 - Granny Smith Apples 0.89 - Seedless Watermelon 0.49 - Honeydew Melon 0.59 - Red Delicious Apples 0.99 - Navel Oranges 1.29 - Fuji Apples 1.29 - Plantain Bananas 1.49 - Gala Apples 1.49 - Pineapple 1.49 - Plums 1.69 - Braeburn Apples 1.49 - Peaches 1.99 - Golden Delicious Apples 1.29 - Nectarine 1.99 - -Displays the elements using the IDictionaryEnumerator: - KEY VALUE - Strawberries 3.33 - Yellow Bananas 0.79 - Cranberries 5.98 - Grapes 1.99 - Granny Smith Apples 0.89 - Seedless Watermelon 0.49 - Honeydew Melon 0.59 - Red Delicious Apples 0.99 - Navel Oranges 1.29 - Fuji Apples 1.29 - Plantain Bananas 1.49 - Gala Apples 1.49 - Pineapple 1.49 - Plums 1.69 - Braeburn Apples 1.49 - Peaches 1.99 - Golden Delicious Apples 1.29 - Nectarine 1.99 - -Displays the elements using the Keys, Values, Count, and Item properties: - INDEX KEY VALUE - 0 Strawberries 3.33 - 1 Yellow Bananas 0.79 - 2 Cranberries 5.98 - 3 Grapes 1.99 - 4 Granny Smith Apples 0.89 - 5 Seedless Watermelon 0.49 - 6 Honeydew Melon 0.59 - 7 Red Delicious Apples 0.99 - 8 Navel Oranges 1.29 - 9 Fuji Apples 1.29 - 10 Plantain Bananas 1.49 - 11 Gala Apples 1.49 - 12 Pineapple 1.49 - 13 Plums 1.69 - 14 Braeburn Apples 1.49 - 15 Peaches 1.99 - 16 Golden Delicious Apples 1.29 - 17 Nectarine 1.99 - -Displays the elements in the array: - KEY VALUE - Strawberries 3.33 - Yellow Bananas 0.79 - Cranberries 5.98 - Grapes 1.99 - Granny Smith Apples 0.89 - Seedless Watermelon 0.49 - Honeydew Melon 0.59 - Red Delicious Apples 0.99 - Navel Oranges 1.29 - Fuji Apples 1.29 - Plantain Bananas 1.49 - Gala Apples 1.49 - Pineapple 1.49 - Plums 1.69 - Braeburn Apples 1.49 - Peaches 1.99 - Golden Delicious Apples 1.29 - Nectarine 1.99 - -The collection does not contain the key "Kiwis". - -The collection contains the following elements after removing "Plums": - KEY VALUE - Strawberries 3.33 - Yellow Bananas 0.79 - Cranberries 5.98 - Grapes 1.99 - Granny Smith Apples 0.89 - Seedless Watermelon 0.49 - Honeydew Melon 0.59 - Red Delicious Apples 0.99 - Navel Oranges 1.29 - Fuji Apples 1.29 - Plantain Bananas 1.49 - Gala Apples 1.49 - Pineapple 1.49 - Braeburn Apples 1.49 - Peaches 1.99 - Golden Delicious Apples 1.29 - Nectarine 1.99 - -The collection contains the following elements after it is cleared: - KEY VALUE - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp deleted file mode 100644 index 5b82c8e92c1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Threading; - -public ref class HybridDictSample -{ -public: - static void Main() - { - // Creates and initializes a new HybridDictionary. - HybridDictionary^ myHybridDictionary = gcnew HybridDictionary(); - - // - for each (DictionaryEntry^ de in myHybridDictionary) - { - //... - } - // - - // - HybridDictionary^ myCollection = gcnew HybridDictionary(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - HybridDictSample::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp deleted file mode 100644 index 1afdca2ae97..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp +++ /dev/null @@ -1,110 +0,0 @@ - - -// The following code example adds to and removes elements from a HybridDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( IDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = safe_cast(myEnum->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new HybridDictionary. - HybridDictionary^ myCol = gcnew HybridDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - myCol->Add( "Plantain Bananas", "1.49" ); - myCol->Add( "Yellow Bananas", "0.79" ); - myCol->Add( "Strawberries", "3.33" ); - myCol->Add( "Cranberries", "5.98" ); - myCol->Add( "Navel Oranges", "1.29" ); - myCol->Add( "Grapes", "1.99" ); - myCol->Add( "Honeydew Melon", "0.59" ); - myCol->Add( "Seedless Watermelon", "0.49" ); - myCol->Add( "Pineapple", "1.49" ); - myCol->Add( "Nectarine", "1.99" ); - myCol->Add( "Plums", "1.69" ); - myCol->Add( "Peaches", "1.99" ); - - // Displays the values in the HybridDictionary in three different ways. - Console::WriteLine( "Initial contents of the HybridDictionary:" ); - PrintKeysAndValues( myCol ); - - // Deletes a key. - myCol->Remove( "Plums" ); - Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" ); - PrintKeysAndValues( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues( myCol ); -} - -/* -This code produces output similar to the following: - -Initial contents of the HybridDictionary: - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Plums 1.69 - Navel Oranges 1.29 - Fuji Apples 1.29 - -The collection contains the following elements after removing "Plums": - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Navel Oranges 1.29 - Fuji Apples 1.29 - -The collection contains the following elements after it is cleared: - KEY VALUE - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp deleted file mode 100644 index 831a5749541..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp +++ /dev/null @@ -1,87 +0,0 @@ - - -// The following code example searches for an element in a HybridDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( IDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = safe_cast(myEnum->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new HybridDictionary. - HybridDictionary^ myCol = gcnew HybridDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - myCol->Add( "Plantain Bananas", "1.49" ); - myCol->Add( "Yellow Bananas", "0.79" ); - myCol->Add( "Strawberries", "3.33" ); - myCol->Add( "Cranberries", "5.98" ); - myCol->Add( "Navel Oranges", "1.29" ); - myCol->Add( "Grapes", "1.99" ); - myCol->Add( "Honeydew Melon", "0.59" ); - myCol->Add( "Seedless Watermelon", "0.49" ); - myCol->Add( "Pineapple", "1.49" ); - myCol->Add( "Nectarine", "1.99" ); - myCol->Add( "Plums", "1.69" ); - myCol->Add( "Peaches", "1.99" ); - - // Displays the values in the HybridDictionary in three different ways. - Console::WriteLine( "Initial contents of the HybridDictionary:" ); - PrintKeysAndValues( myCol ); - - // Searches for a key. - if ( myCol->Contains( "Kiwis" ) ) - Console::WriteLine( "The collection contains the key \"Kiwis\"." ); - else - Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); - - Console::WriteLine(); -} - -/* -This code produces output similar to the following: - -Initial contents of the HybridDictionary: - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Plums 1.69 - Navel Oranges 1.29 - Fuji Apples 1.29 - -The collection does not contain the key "Kiwis". - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp deleted file mode 100644 index b50664695a8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp +++ /dev/null @@ -1,109 +0,0 @@ - - -// The following code example copies the elements of a HybridDictionary to an array. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( IDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = safe_cast(myEnum->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new HybridDictionary. - HybridDictionary^ myCol = gcnew HybridDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - myCol->Add( "Plantain Bananas", "1.49" ); - myCol->Add( "Yellow Bananas", "0.79" ); - myCol->Add( "Strawberries", "3.33" ); - myCol->Add( "Cranberries", "5.98" ); - myCol->Add( "Navel Oranges", "1.29" ); - myCol->Add( "Grapes", "1.99" ); - myCol->Add( "Honeydew Melon", "0.59" ); - myCol->Add( "Seedless Watermelon", "0.49" ); - myCol->Add( "Pineapple", "1.49" ); - myCol->Add( "Nectarine", "1.99" ); - myCol->Add( "Plums", "1.69" ); - myCol->Add( "Peaches", "1.99" ); - - // Displays the values in the HybridDictionary in three different ways. - Console::WriteLine( "Initial contents of the HybridDictionary:" ); - PrintKeysAndValues( myCol ); - - // Copies the HybridDictionary to an array with DictionaryEntry elements. - array^myArr = gcnew array(myCol->Count); - myCol->CopyTo( myArr, 0 ); - - // Displays the values in the array. - Console::WriteLine( "Displays the elements in the array:" ); - Console::WriteLine( " KEY VALUE" ); - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); - Console::WriteLine(); -} - -/* -This code produces output similar to the following: - -Initial contents of the HybridDictionary: - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Plums 1.69 - Navel Oranges 1.29 - Fuji Apples 1.29 - -Displays the elements in the array: - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Plums 1.69 - Navel Oranges 1.29 - Fuji Apples 1.29 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp deleted file mode 100644 index 1966022fe36..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// The following code example enumerates the elements of a HybridDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintKeysAndValues1( IDictionary^ myCol ); -void PrintKeysAndValues2( IDictionary^ myCol ); -void PrintKeysAndValues3( HybridDictionary^ myCol ); - -int main() -{ - // Creates and initializes a new HybridDictionary. - HybridDictionary^ myCol = gcnew HybridDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - myCol->Add( "Plantain Bananas", "1.49" ); - myCol->Add( "Yellow Bananas", "0.79" ); - myCol->Add( "Strawberries", "3.33" ); - myCol->Add( "Cranberries", "5.98" ); - myCol->Add( "Navel Oranges", "1.29" ); - myCol->Add( "Grapes", "1.99" ); - myCol->Add( "Honeydew Melon", "0.59" ); - myCol->Add( "Seedless Watermelon", "0.49" ); - myCol->Add( "Pineapple", "1.49" ); - myCol->Add( "Nectarine", "1.99" ); - myCol->Add( "Plums", "1.69" ); - myCol->Add( "Peaches", "1.99" ); - - // Display the contents of the collection using for each. This is the preferred method. - Console::WriteLine( "Displays the elements using for each:" ); - PrintKeysAndValues1( myCol ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); - PrintKeysAndValues2( myCol ); - - // Display the contents of the collection using the Keys, Values, Count, and Item properties. - Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); - PrintKeysAndValues3( myCol ); -} - -// Uses the foreach statement which hides the complexity of the enumerator. -// NOTE: The foreach statement is the preferred way of enumerating the contents of a collection. -void PrintKeysAndValues1( IDictionary^ myCol ) { - Console::WriteLine( " KEY VALUE" ); - for each ( DictionaryEntry^ de in myCol ) - Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintKeysAndValues2( IDictionary^ myCol ) -{ - IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); - Console::WriteLine( " KEY VALUE" ); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); - - Console::WriteLine(); -} - -// Uses the Keys, Values, Count, and Item properties. -void PrintKeysAndValues3( HybridDictionary^ myCol ) -{ - array^myKeys = gcnew array(myCol->Count); - myCol->Keys->CopyTo( myKeys, 0 ); - Console::WriteLine( " INDEX KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); - Console::WriteLine(); -} - -/* -This code produces output similar to the following: - -Displays the elements using for each: - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Plums 1.69 - Navel Oranges 1.29 - Fuji Apples 1.29 - -Displays the elements using the IDictionaryEnumerator: - KEY VALUE - Seedless Watermelon 0.49 - Nectarine 1.99 - Cranberries 5.98 - Plantain Bananas 1.49 - Honeydew Melon 0.59 - Pineapple 1.49 - Strawberries 3.33 - Grapes 1.99 - Braeburn Apples 1.49 - Peaches 1.99 - Red Delicious Apples 0.99 - Golden Delicious Apples 1.29 - Yellow Bananas 0.79 - Granny Smith Apples 0.89 - Gala Apples 1.49 - Plums 1.69 - Navel Oranges 1.29 - Fuji Apples 1.29 - -Displays the elements using the Keys, Values, Count, and Item properties: - INDEX KEY VALUE - 0 Seedless Watermelon 0.49 - 1 Nectarine 1.99 - 2 Cranberries 5.98 - 3 Plantain Bananas 1.49 - 4 Honeydew Melon 0.59 - 5 Pineapple 1.49 - 6 Strawberries 3.33 - 7 Grapes 1.99 - 8 Braeburn Apples 1.49 - 9 Peaches 1.99 - 10 Red Delicious Apples 0.99 - 11 Golden Delicious Apples 1.29 - 12 Yellow Bananas 0.79 - 13 Granny Smith Apples 0.89 - 14 Gala Apples 1.49 - 15 Plums 1.69 - 16 Navel Oranges 1.29 - 17 Fuji Apples 1.29 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp deleted file mode 100644 index 641e2daadd9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp +++ /dev/null @@ -1,318 +0,0 @@ -// - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -// -public ref class PeopleEnum : IDictionaryEnumerator -{ -private: - // Enumerators are positioned before the first element - // until the first MoveNext() call. - int position; - ArrayList^ _people; - -public: - PeopleEnum(ArrayList^ list) - { - this->Reset(); - _people = list; - } - - virtual bool MoveNext() - { - position++; - return (position < _people->Count); - } - - virtual void Reset() - { - position = -1; - } - - virtual property Object^ Current - { - Object^ get() - { - try - { - return _people[position]; - } - catch (IndexOutOfRangeException^) - { - throw gcnew InvalidOperationException(); - } - } - } - - virtual property DictionaryEntry Entry - { - DictionaryEntry get() - { - return (DictionaryEntry)(Current); - } - } - - virtual property Object^ Key - { - Object^ get() - { - try - { - return ((DictionaryEntry^)_people[position])->Key; - } - catch (IndexOutOfRangeException^) - { - throw gcnew InvalidOperationException(); - } - } - } - - virtual property Object^ Value - { - Object^ get() - { - try - { - return ((DictionaryEntry^)_people[position])->Value; - } - catch (IndexOutOfRangeException^) - { - throw gcnew InvalidOperationException(); - } - } - } -}; - -public ref class People : IOrderedDictionary -{ -private: - ArrayList^ _people; - -public: - People(int numItems) - { - _people = gcnew ArrayList(numItems); - } - - int IndexOfKey(Object^ key) - { - for (int i = 0; i < _people->Count; i++) - { - if (((DictionaryEntry^)_people[i])->Key == key) - return i; - } - - // key not found, return -1. - return -1; - } - - virtual property Object^ default[Object^] - { - Object^ get(Object^ key) - { - return ((DictionaryEntry^)_people[IndexOfKey(key)])->Value; - } - void set(Object^ key, Object^ value) - { - _people[IndexOfKey(key)] = gcnew DictionaryEntry(key, value); - } - } - - // IOrderedDictionary Members - virtual IDictionaryEnumerator^ GetEnumerator() - { - return gcnew PeopleEnum(_people); - } - - virtual void Insert(int index, Object^ key, Object^ value) - { - if (IndexOfKey(key) != -1) - { - throw gcnew ArgumentException("An element with the same key already exists in the collection."); - } - _people->Insert(index, gcnew DictionaryEntry(key, value)); - } - - virtual void RemoveAt(int index) - { - _people->RemoveAt(index); - } - - virtual property Object^ default[int] - { - Object^ get(int index) - { - return ((DictionaryEntry^)_people[index])->Value; - } - void set(int index, Object^ value) - { - Object^ key = ((DictionaryEntry^)_people[index])->Key; - _people[index] = gcnew DictionaryEntry(key, value); - } - } - - // IDictionary Members - - virtual void Add(Object^ key, Object^ value) - { - if (IndexOfKey(key) != -1) - { - throw gcnew ArgumentException("An element with the same key already exists in the collection."); - } - _people->Add(gcnew DictionaryEntry(key, value)); - } - - virtual void Clear() - { - _people->Clear(); - } - - virtual bool Contains(Object^ key) - { - if (IndexOfKey(key) == -1) - { - return false; - } - else - { - return true; - } - } - - virtual property bool IsFixedSize - { - bool get() - { - return false; - } - } - - virtual property bool IsReadOnly - { - bool get() - { - return false; - } - } - - virtual property ICollection^ Keys - { - ICollection^ get() - { - ArrayList^ KeyCollection = gcnew ArrayList(_people->Count); - for (int i = 0; i < _people->Count; i++) - { - KeyCollection->Add( ((DictionaryEntry^)_people[i])->Key ); - } - return KeyCollection; - } - } - - virtual void Remove(Object^ key) - { - _people->RemoveAt(IndexOfKey(key)); - } - - virtual property ICollection^ Values - { - ICollection ^get() - { - ArrayList^ ValueCollection = gcnew ArrayList(_people->Count); - for (int i = 0; i < _people->Count; i++) - { - ValueCollection->Add( ((DictionaryEntry^)_people[i])->Value ); - } - return ValueCollection; - } - } - - // ICollection Members - - virtual void CopyTo(Array^ array, int index) - { - _people->CopyTo(array, index); - } - - virtual property int Count - { - int get() - { - return _people->Count; - } - } - - virtual property bool IsSynchronized - { - bool get() - { - return _people->IsSynchronized; - } - } - - virtual property Object^ SyncRoot - { - Object^ get() - { - return _people->SyncRoot; - } - } - - // IEnumerable Members - - virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator - { - return (IEnumerator^) gcnew PeopleEnum(_people); - } -}; -// - -class App -{ -public: - static void Main() - { - People^ peopleCollection = gcnew People(3); - peopleCollection->Add("John", "Smith"); - peopleCollection->Add("Jim", "Johnson"); - peopleCollection->Add("Sue", "Rabon"); - - Console::WriteLine("Displaying the entries in peopleCollection:"); - for each (DictionaryEntry^ de in peopleCollection) - { - Console::WriteLine("{0} {1}", de->Key, de->Value); - } - Console::WriteLine(); - Console::WriteLine("Displaying the entries in the modified peopleCollection:"); - peopleCollection["Jim"] = "Jackson"; - peopleCollection->Remove("Sue"); - peopleCollection->Insert(0, "Fred", "Anderson"); - - for each (DictionaryEntry^ de in peopleCollection) - { - Console::WriteLine("{0} {1}", de->Key, de->Value); - } - - } -}; - -int main() -{ - App::Main(); -} -/* This code produces output similar to the following: - * - * Displaying the entries in peopleCollection: - * John Smith - * Jim Johnson - * Sue Rabon - * - * Displaying the entries in the modified peopleCollection: - * Fred Anderson - * John Smith - * Jim Jackson - */ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp deleted file mode 100644 index 05fe0cdd917..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp +++ /dev/null @@ -1,297 +0,0 @@ - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class ODEnum : IDictionaryEnumerator -{ -private: - // Enumerators are positioned before the first element - // until the first MoveNext() call. - int position; - ArrayList^ itemlist; - -public: - ODEnum(ArrayList^ list) - { - this->Reset(); - itemlist = list; - } - - virtual bool MoveNext() - { - position++; - return (position < itemlist->Count); - } - - virtual void Reset() - { - position = -1; - } - - virtual property Object^ Current - { - Object^ get() - { - try - { - return itemlist[position]; - } - catch (IndexOutOfRangeException^) - { - throw gcnew InvalidOperationException(); - } - } - } - - virtual property DictionaryEntry Entry - { - DictionaryEntry get() - { - return (DictionaryEntry)(Current); - } - } - - virtual property Object^ Key - { - Object^ get() - { - try - { - return ((DictionaryEntry^)itemlist[position])->Key; - } - catch (IndexOutOfRangeException^) - { - throw gcnew InvalidOperationException(); - } - } - } - - virtual property Object^ Value - { - Object^ get() - { - try - { - return ((DictionaryEntry^)itemlist[position])->Value; - } - catch (IndexOutOfRangeException^) - { - throw gcnew InvalidOperationException(); - } - } - } -}; - -public ref class SimpleOD : IOrderedDictionary -{ -private: - ArrayList^ itemlist; - -public: - SimpleOD(int numItems) - { - itemlist = gcnew ArrayList(numItems); - } - - int IndexOfKey(Object^ key) - { - for (int i = 0; i < itemlist->Count; i++) - { - if (((DictionaryEntry^)itemlist[i])->Key == key) - return i; - } - - // key not found, return -1. - return -1; - } - - virtual property Object^ default[Object^] - { - Object^ get(Object^ key) - { - return ((DictionaryEntry^)itemlist[IndexOfKey(key)])->Value; - } - void set(Object^ key, Object^ value) - { - itemlist[IndexOfKey(key)] = gcnew DictionaryEntry(key, value); - } - } - - // IOrderedDictionary Members - virtual IDictionaryEnumerator^ GetEnumerator() - { - return gcnew ODEnum(itemlist); - } - - virtual void Insert(int index, Object^ key, Object^ value) - { - if (IndexOfKey(key) != -1) - { - throw gcnew ArgumentException("An element with the same key already exists in the collection."); - } - itemlist->Insert(index, gcnew DictionaryEntry(key, value)); - } - - virtual void RemoveAt(int index) - { - itemlist->RemoveAt(index); - } - - virtual property Object^ default[int] - { - Object^ get(int index) - { - return ((DictionaryEntry^)itemlist[index])->Value; - } - void set(int index, Object^ value) - { - Object^ key = ((DictionaryEntry^)itemlist[index])->Key; - itemlist[index] = gcnew DictionaryEntry(Keys, value); - } - } - - // IDictionary Members - - virtual void Add(Object^ key, Object^ value) - { - if (IndexOfKey(key) != -1) - { - throw gcnew ArgumentException("An element with the same key already exists in the collection."); - } - itemlist->Add(gcnew DictionaryEntry(key, value)); - } - - virtual void Clear() - { - itemlist->Clear(); - } - - virtual bool Contains(Object^ key) - { - if (IndexOfKey(key) == -1) - { - return false; - } - else - { - return true; - } - } - - virtual property bool IsFixedSize - { - bool get() - { - return false; - } - } - - virtual property bool IsReadOnly - { - bool get() - { - return false; - } - } - - virtual property ICollection^ Keys - { - ICollection^ get() - { - ArrayList^ KeyCollection = gcnew ArrayList(itemlist->Count); - for (int i = 0; i < itemlist->Count; i++) - { - KeyCollection[i] = ((DictionaryEntry^)itemlist[i])->Key; - } - return KeyCollection; - } - } - - virtual void Remove(Object^ key) - { - itemlist->RemoveAt(IndexOfKey(key)); - } - - virtual property ICollection^ Values - { - ICollection ^get() - { - ArrayList^ ValueCollection = gcnew ArrayList(itemlist->Count); - for (int i = 0; i < itemlist->Count; i++) - { - ValueCollection[i] = ((DictionaryEntry^)itemlist[i])->Value; - } - return ValueCollection; - } - } - - // ICollection Members - - virtual void CopyTo(Array^ array, int index) - { - itemlist->CopyTo(array, index); - } - - virtual property int Count - { - int get() - { - return itemlist->Count; - } - } - - virtual property bool IsSynchronized - { - bool get() - { - return itemlist->IsSynchronized; - } - } - - virtual property Object^ SyncRoot - { - Object^ get() - { - return itemlist->SyncRoot; - } - } - - // IEnumerable Members - - virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator - { - return (IEnumerator^) gcnew ODEnum(itemlist); - } -}; - -class App -{ -public: - static void Main() - { - int index = 1; - - SimpleOD^ myOrderedDictionary = gcnew SimpleOD(2); - myOrderedDictionary->Add("Way", "ToGo"); - myOrderedDictionary->Add("Far", "Out"); - - Object^ obj; - // - obj = myOrderedDictionary[index]; - // - // - for each (DictionaryEntry de in myOrderedDictionary) - { - //... - } - // - } -}; - -int main() -{ - App::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp deleted file mode 100644 index d1760135b98..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// The following code example demonstrates several of the properties and methods of ListDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintKeysAndValues1( IDictionary^ myCol ); -void PrintKeysAndValues2( IDictionary^ myCol ); -void PrintKeysAndValues3( ListDictionary^ myCol ); - -int main() -{ - // Creates and initializes a new ListDictionary. - ListDictionary^ myCol = gcnew ListDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - - // Display the contents of the collection using for each. This is the preferred method. - Console::WriteLine( "Displays the elements using for each:" ); - PrintKeysAndValues1( myCol ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); - PrintKeysAndValues2( myCol ); - - // Display the contents of the collection using the Keys, Values, Count, and Item properties. - Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); - PrintKeysAndValues3( myCol ); - - // Copies the ListDictionary to an array with DictionaryEntry elements. - array^myArr = gcnew array(myCol->Count); - myCol->CopyTo( myArr, 0 ); - - // Displays the values in the array. - Console::WriteLine( "Displays the elements in the array:" ); - Console::WriteLine( " KEY VALUE" ); - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); - Console::WriteLine(); - - // Searches for a key. - if ( myCol->Contains( "Kiwis" ) ) - Console::WriteLine( "The collection contains the key \"Kiwis\"." ); - else - Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); - - Console::WriteLine(); - - // Deletes a key. - myCol->Remove( "Plums" ); - Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" ); - PrintKeysAndValues2( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues2( myCol ); -} - -// Uses the for each statement which hides the complexity of the enumerator. -// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. -void PrintKeysAndValues1( IDictionary^ myCol ) { - Console::WriteLine( " KEY VALUE" ); - for each ( DictionaryEntry^ de in myCol ) - Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintKeysAndValues2( IDictionary^ myCol ) -{ - IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); - Console::WriteLine( " KEY VALUE" ); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); - Console::WriteLine(); -} - -// Uses the Keys, Values, Count, and Item properties. -void PrintKeysAndValues3( ListDictionary^ myCol ) -{ - array^myKeys = gcnew array(myCol->Count); - myCol->Keys->CopyTo( myKeys, 0 ); - Console::WriteLine( " INDEX KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -Displays the elements using for each: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -Displays the elements using the IDictionaryEnumerator: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -Displays the elements using the Keys, Values, Count, and Item properties: - INDEX KEY VALUE - 0 Braeburn Apples 1.49 - 1 Fuji Apples 1.29 - 2 Gala Apples 1.49 - 3 Golden Delicious Apples 1.29 - 4 Granny Smith Apples 0.89 - 5 Red Delicious Apples 0.99 - -Displays the elements in the array: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -The collection does not contain the key "Kiwis". - -The collection contains the following elements after removing "Plums": - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -The collection contains the following elements after it is cleared: - KEY VALUE - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp deleted file mode 100644 index 0f3452dcd52..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Threading; - -public ref class SamplesListDictionary -{ -public: - static void Main() - { - // - ListDictionary^ myCollection = gcnew ListDictionary(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } - - static void Dummy() - { - ListDictionary^ myListDictionary = gcnew ListDictionary(); - // - for each (DictionaryEntry de in myListDictionary) - { - //... - } - // - } -}; - -int main() -{ - SamplesListDictionary::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp deleted file mode 100644 index ef13cdd9540..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -// The following code example adds to and removes elements from a ListDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( IDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = safe_cast(myEnum->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new ListDictionary. - ListDictionary^ myCol = gcnew ListDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - - // Displays the values in the ListDictionary in three different ways. - Console::WriteLine( "Initial contents of the ListDictionary:" ); - PrintKeysAndValues( myCol ); - - // Deletes a key. - myCol->Remove( "Gala Apples" ); - Console::WriteLine( "The collection contains the following elements after removing \"Gala Apples\":" ); - PrintKeysAndValues( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues( myCol ); -} - -/* -This code produces the following output. - -Initial contents of the ListDictionary: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -The collection contains the following elements after removing "Gala Apples": - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -The collection contains the following elements after it is cleared: - KEY VALUE - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp deleted file mode 100644 index ba69388921b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -// The following code example searches for an element in a ListDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( IDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = safe_cast(myEnum->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new ListDictionary. - ListDictionary^ myCol = gcnew ListDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - - // Displays the values in the ListDictionary in three different ways. - Console::WriteLine( "Initial contents of the ListDictionary:" ); - PrintKeysAndValues( myCol ); - - // Searches for a key. - if ( myCol->Contains( "Kiwis" ) ) - Console::WriteLine( "The collection contains the key \"Kiwis\"." ); - else - Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the ListDictionary: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -The collection does not contain the key "Kiwis". - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp deleted file mode 100644 index 772edf629f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -// The following code example copies the elements of a ListDictionary to an array. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintKeysAndValues( IDictionary^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry de = safe_cast(myEnum->Current); - Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); - } - - Console::WriteLine(); -} - -int main() -{ - - // Creates and initializes a new ListDictionary. - ListDictionary^ myCol = gcnew ListDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - - // Displays the values in the ListDictionary in three different ways. - Console::WriteLine( "Initial contents of the ListDictionary:" ); - PrintKeysAndValues( myCol ); - - // Copies the ListDictionary to an array with DictionaryEntry elements. - array^myArr = gcnew array(myCol->Count); - myCol->CopyTo( myArr, 0 ); - - // Displays the values in the array. - Console::WriteLine( "Displays the elements in the array:" ); - Console::WriteLine( " KEY VALUE" ); - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the ListDictionary: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -Displays the elements in the array: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp deleted file mode 100644 index 2a525d94ac8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// The following code example enumerates the elements of a ListDictionary. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintKeysAndValues1( IDictionary^ myCol ); -void PrintKeysAndValues2( IDictionary^ myCol ); -void PrintKeysAndValues3( ListDictionary^ myCol ); - -int main() -{ - // Creates and initializes a new ListDictionary. - ListDictionary^ myCol = gcnew ListDictionary; - myCol->Add( "Braeburn Apples", "1.49" ); - myCol->Add( "Fuji Apples", "1.29" ); - myCol->Add( "Gala Apples", "1.49" ); - myCol->Add( "Golden Delicious Apples", "1.29" ); - myCol->Add( "Granny Smith Apples", "0.89" ); - myCol->Add( "Red Delicious Apples", "0.99" ); - - // Display the contents of the collection using for each. This is the preferred method. - Console::WriteLine( "Displays the elements using for each:" ); - PrintKeysAndValues1( myCol ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); - PrintKeysAndValues2( myCol ); - - // Display the contents of the collection using the Keys, Values, Count, and Item properties. - Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); - PrintKeysAndValues3( myCol ); -} - -// Uses the for each statement which hides the complexity of the enumerator. -// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. -void PrintKeysAndValues1( IDictionary^ myCol ) { - Console::WriteLine( " KEY VALUE" ); - for each ( DictionaryEntry^ de in myCol ) - Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintKeysAndValues2( IDictionary^ myCol ) -{ - IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); - Console::WriteLine( " KEY VALUE" ); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); - - Console::WriteLine(); -} - -// Uses the Keys, Values, Count, and Item properties. -void PrintKeysAndValues3( ListDictionary^ myCol ) -{ - array^myKeys = gcnew array(myCol->Count); - myCol->Keys->CopyTo( myKeys, 0 ); - Console::WriteLine( " INDEX KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -Displays the elements using for each: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -Displays the elements using the IDictionaryEnumerator: - KEY VALUE - Braeburn Apples 1.49 - Fuji Apples 1.29 - Gala Apples 1.49 - Golden Delicious Apples 1.29 - Granny Smith Apples 0.89 - Red Delicious Apples 0.99 - -Displays the elements using the Keys, Values, Count, and Item properties: - INDEX KEY VALUE - 0 Braeburn Apples 1.49 - 1 Fuji Apples 1.29 - 2 Gala Apples 1.49 - 3 Golden Delicious Apples 1.29 - 4 Granny Smith Apples 0.89 - 5 Red Delicious Apples 0.99 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp deleted file mode 100644 index e3a242ae17f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -// The following example uses BaseAdd to create a new NameObjectCollectionBase with elements from another dictionary. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -public ref class MyCollection: public NameObjectCollectionBase -{ -private: - DictionaryEntry _de; - -public: - - property DictionaryEntry Item [ int ] - { - // Gets a key-and-value pair (DictionaryEntry) using an index. - DictionaryEntry get( int index ) - { - _de.Key = this->BaseGetKey( index ); - _de.Value = this->BaseGet( index ); - return (_de); - } - } - - // Adds elements from an IDictionary* into the new collection. - MyCollection( IDictionary^ d ) - { - IEnumerator^ myEnum = d->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(myEnum->Current); - this->BaseAdd( safe_cast(de->Key), de->Value ); - } - } -}; - -int main() -{ - // Creates and initializes a new MyCollection instance. - IDictionary^ d = gcnew ListDictionary; - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myCol = gcnew MyCollection( d ); - - // Displays the keys and values of the MyCollection instance. - for ( int i = 0; i < myCol->Count; i++ ) - { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol->Item[ i ].Key, myCol->Item[ i ].Value ); - } -} - -/* -This code produces the following output. - -[0] : red, apple -[1] : yellow, banana -[2] : green, pear - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp deleted file mode 100644 index 7dfd2cf7f8b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -// The following example uses BaseClear to remove all elements from a NameObjectCollectionBase. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -public ref class MyCollection: public NameObjectCollectionBase -{ -private: - DictionaryEntry _de; - -public: - - property DictionaryEntry Item [ int ] - { - // Gets a key-and-value pair (DictionaryEntry) using an index. - DictionaryEntry get( int index ) - { - _de.Key = this->BaseGetKey( index ); - _de.Value = this->BaseGet( index ); - return (_de); - } - } - - // Adds elements from an IDictionary* into the new collection. - MyCollection( IDictionary^ d ) - { - IEnumerator^ myEnum = d->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(myEnum->Current); - this->BaseAdd( safe_cast(de->Key), de->Value ); - } - } - - // Clears all the elements in the collection. - void Clear() - { - this->BaseClear(); - } -}; - -static void PrintKeysAndValues( MyCollection^ myCol ) -{ - for ( int i = 0; i < myCol->Count; i++ ) - { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol->Item[ i ].Key, myCol->Item[ i ].Value ); - - } -} - -int main() -{ - // Creates and initializes a new MyCollection instance. - IDictionary^ d = gcnew ListDictionary; - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myCol = gcnew MyCollection( d ); - Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - - // Removes all elements from the collection. - myCol->Clear(); - Console::WriteLine( "After clearing the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); -} - -/* -This code produces the following output. - -Initial state of the collection (Count = 3): -[0] : red, apple -[1] : yellow, banana -[2] : green, pear -After clearing the collection (Count = 0): - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp deleted file mode 100644 index d7954215945..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp +++ /dev/null @@ -1,92 +0,0 @@ - -// The following example uses BaseGetKey and BaseGet to get specific keys and values. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Gets a key-and-value pair (DictionaryEntry) using an index. -public: - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get( int index ) { - _de->Key = this->BaseGetKey( index ); - _de->Value = this->BaseGet( index ); - return( _de ); - } - } - - // Gets or sets the value associated with the specified key. - property Object^ default[ String^ ] { - Object^ get(String^ key) { - return( this->BaseGet( key ) ); - } - void set( String^ key, Object^ value ) { - this->BaseSet( key, value ); - } - } - - // Adds elements from an IDictionary into the new collection. - MyCollection( IDictionary^ d ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - } -}; - -public ref class SamplesNameObjectCollectionBase { - -public: - static void Main() { - - // Creates and initializes a new MyCollection instance. - IDictionary^ d = gcnew ListDictionary(); - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myCol = gcnew MyCollection( d ); - Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - - // Gets specific keys and values. - Console::WriteLine( "The key at index 0 is {0}.", myCol[0]->Key ); - Console::WriteLine( "The value at index 0 is {0}.", myCol[0]->Value ); - Console::WriteLine( "The value associated with the key \"green\" is {0}.", myCol["green"] ); - - } - - static void PrintKeysAndValues( MyCollection^ myCol ) { - for ( int i = 0; i < myCol->Count; i++ ) { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); - } - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - -/* -This code produces the following output. - -Initial state of the collection (Count = 3): -[0] : red, apple -[1] : yellow, banana -[2] : green, pear -The key at index 0 is red. -The value at index 0 is apple. -The value associated with the key "green" is pear. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp deleted file mode 100644 index c96322f4cfa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// The following example uses BaseGetAllKeys and BaseGetAllValues to get an array of the keys or an array of the values. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Gets a key-and-value pair (DictionaryEntry) using an index. -public: - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get(int index) { - _de->Key = this->BaseGetKey( index ); - _de->Value = this->BaseGet( index ); - return( _de ); - } - } - - // Adds elements from an IDictionary into the new collection. - MyCollection( IDictionary^ d ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - } - - // Gets a String array that contains all the keys in the collection. - property array^ AllKeys { - array^ get() { - return( this->BaseGetAllKeys() ); - } - } - - // Gets an Object array that contains all the values in the collection. - property Array^ AllValues { - Array^ get() { - return( this->BaseGetAllValues() ); - } - } - - // Gets a String array that contains all the values in the collection. - property array^ AllStringValues { - array^ get() { - return( (array^) this->BaseGetAllValues( System::String::typeid ) ); - } - } -}; - -public ref class SamplesNameObjectCollectionBase { - -public: - static void Main() { - - // Creates and initializes a new MyCollection instance. - IDictionary^ d = gcnew ListDictionary(); - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myCol = gcnew MyCollection( d ); - Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - - // Displays the list of keys. - Console::WriteLine( "The list of keys:" ); - for each ( String^ s in myCol->AllKeys ) { - Console::WriteLine( " {0}", s ); - } - - // Displays the list of values of type Object. - Console::WriteLine( "The list of values (Object):" ); - for each ( Object^ o in myCol->AllValues ) { - Console::WriteLine( " {0}", o->ToString() ); - } - - // Displays the list of values of type String. - Console::WriteLine( "The list of values (String):" ); - for each ( String^ s in myCol->AllValues ) { - Console::WriteLine( " {0}", s ); - } - } - -public: - static void PrintKeysAndValues( MyCollection^ myCol ) { - for ( int i = 0; i < myCol->Count; i++ ) { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); - } - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - -/* -This code produces the following output. - -Initial state of the collection (Count = 3): -[0] : red, apple -[1] : yellow, banana -[2] : green, pear -The list of keys: - red - yellow - green -The list of values (Object): - apple - banana - pear -The list of values (String): - apple - banana - pear - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp deleted file mode 100644 index 663a6cd5536..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// The following example uses BaseHasKeys to determine if the collection contains keys that are not a null reference. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Gets a key-and-value pair (DictionaryEntry) using an index. -public: - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get(int index) { - _de->Key = this->BaseGetKey( index ); - _de->Value = this->BaseGet( index ); - return( _de ); - } - } - - // Creates an empty collection. - MyCollection() { - _de = gcnew DictionaryEntry(); - } - - // Adds an entry to the collection. - void Add( String^ key, Object^ value ) { - this->BaseAdd( key, value ); - } - - // Gets a value indicating whether the collection contains keys that are not a null reference. - property Boolean HasKeys { - Boolean get() { - return( this->BaseHasKeys() ); - } - } -}; - -void PrintKeysAndValues( MyCollection^ myCol ) { - for ( int i = 0; i < myCol->Count; i++ ) { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); - } -} - -int main() { - - // Creates an empty MyCollection instance. - MyCollection^ myCol = gcnew MyCollection(); - Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - Console::WriteLine( "HasKeys? {0}", myCol->HasKeys ); - - Console::WriteLine(); - - // Adds an item to the collection. - myCol->Add( "blue", "sky" ); - Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - Console::WriteLine( "HasKeys? {0}", myCol->HasKeys ); - -} - -/* -This code produces the following output. - -Initial state of the collection (Count = 0): -HasKeys? False - -Initial state of the collection (Count = 1): -[0] : blue, sky -HasKeys? True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp deleted file mode 100644 index de50b6634e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// The following example uses BaseRemove and BaseRemoveAt to remove elements from a NameObjectCollectionBase. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Gets a key-and-value pair (DictionaryEntry) using an index. -public: - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get(int index) { - _de->Key = this->BaseGetKey( index ); - _de->Value = this->BaseGet( index ); - return( _de ); - } - } - - // Adds elements from an IDictionary into the new collection. - MyCollection( IDictionary^ d ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - } - - // Removes an entry with the specified key from the collection. - void Remove( String^ key ) { - this->BaseRemove( key ); - } - - // Removes an entry in the specified index from the collection. - void Remove( int index ) { - this->BaseRemoveAt( index ); - } -}; - -public ref class SamplesNameObjectCollectionBase { - -public: - static void Main() { - - // Creates and initializes a new MyCollection instance. - IDictionary^ d = gcnew ListDictionary(); - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myCol = gcnew MyCollection( d ); - Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - - // Removes an element at a specific index. - myCol->Remove( 1 ); - Console::WriteLine( "After removing the element at index 1 (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - - // Removes an element with a specific key. - myCol->Remove( "red" ); - Console::WriteLine( "After removing the element with the key \"red\" (Count = {0}):", myCol->Count ); - PrintKeysAndValues( myCol ); - - } - - static void PrintKeysAndValues( MyCollection^ myCol ) { - for ( int i = 0; i < myCol->Count; i++ ) { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); - } - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - -/* -This code produces the following output. - -Initial state of the collection (Count = 3): -[0] : red, apple -[1] : yellow, banana -[2] : green, pear -After removing the element at index 1 (Count = 2): -[0] : red, apple -[1] : green, pear -After removing the element with the key "red" (Count = 1): -[0] : green, pear - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp deleted file mode 100644 index e9c37f870ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// The following example uses BaseSet to set the value of a specific element. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - - // Gets or sets the value at the specified index. -public: - property Object^ default[ int ] { - Object^ get(int index) { - return( this->BaseGet( index ) ); - } - void set( int index, Object^ value ) { - this->BaseSet( index, value ); - } - } - - // Gets or sets the value associated with the specified key. - property Object^ default[ String^ ] { - Object^ get(String^ key) { - return( this->BaseGet( key ) ); - } - void set( String^ key, Object^ value ) { - this->BaseSet( key, value ); - } - } - - // Gets a String array that contains all the keys in the collection. - property array^ AllKeys { - array^ get() { - return( this->BaseGetAllKeys() ); - } - } - - // Adds elements from an IDictionary into the new collection. - MyCollection( IDictionary^ d ) { - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - } - -}; - -public ref class SamplesNameObjectCollectionBase { - -public: - static void Main() { - - // Creates and initializes a new MyCollection instance. - IDictionary^ d = gcnew ListDictionary(); - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myCol = gcnew MyCollection( d ); - Console::WriteLine( "Initial state of the collection:" ); - PrintKeysAndValues2( myCol ); - Console::WriteLine(); - - // Sets the value at index 1. - myCol[1] = "sunflower"; - Console::WriteLine( "After setting the value at index 1:" ); - PrintKeysAndValues2( myCol ); - Console::WriteLine(); - - // Sets the value associated with the key "red". - myCol["red"] = "tulip"; - Console::WriteLine( "After setting the value associated with the key \"red\":" ); - PrintKeysAndValues2( myCol ); - - } - - static void PrintKeysAndValues2( MyCollection^ myCol ) { - for each ( String^ s in myCol->AllKeys ) { - Console::WriteLine( "{0}, {1}", s, myCol[s] ); - } - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - -/* -This code produces the following output. - -Initial state of the collection: -red, apple -yellow, banana -green, pear - -After setting the value at index 1: -red, apple -yellow, sunflower -green, pear - -After setting the value associated with the key "red": -red, tulip -yellow, sunflower -green, pear - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp deleted file mode 100644 index c7f2f6f2036..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// The following example creates a read-only collection. -// For an expanded version of this example, see the NameObjectCollectionBase class topic. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Gets a key-and-value pair (DictionaryEntry) using an index. -public: - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get( int index ) { - _de->Key = this->BaseGetKey( index ); - _de->Value = this->BaseGet( index ); - return( _de ); - } - } - - // Adds elements from an IDictionary into the new collection. - MyCollection( IDictionary^ d, Boolean bReadOnly ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - this->IsReadOnly = bReadOnly; - } - - // Adds an entry to the collection. - void Add( String^ key, Object^ value ) { - this->BaseAdd( key, value ); - } -}; - -public ref class SamplesNameObjectCollectionBase { - -public: - static void Main() { - - // Creates and initializes a new MyCollection that is read-only. - IDictionary^ d = gcnew ListDictionary(); - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myROCol = gcnew MyCollection( d, true ); - - // Tries to add a new item. - try { - myROCol->Add( "blue", "sky" ); - } - catch ( NotSupportedException^ e ) { - Console::WriteLine( e->ToString() ); - } - - // Displays the keys and values of the MyCollection. - Console::WriteLine( "Read-Only Collection:" ); - PrintKeysAndValues( myROCol ); - } - - static void PrintKeysAndValues( MyCollection^ myCol ) { - for ( int i = 0; i < myCol->Count; i++ ) { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); - } - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - -/* -This code produces the following output. - -System.NotSupportedException: Collection is read-only. - at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value) - at SamplesNameObjectCollectionBase.Main() -Read-Only Collection: -[0] : red, apple -[1] : yellow, banana -[2] : green, pear - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp deleted file mode 100644 index 8f68c652453..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// The following example shows how to implement and use the NameObjectCollectionBase class. - -// -#using -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class MyCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Creates an empty collection. -public: - MyCollection() { - _de = gcnew DictionaryEntry(); - } - - // Adds elements from an IDictionary into the new collection. - MyCollection( IDictionary^ d, Boolean bReadOnly ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - this->IsReadOnly = bReadOnly; - } - - // Gets a key-and-value pair (DictionaryEntry) using an index. - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get(int index) { - _de->Key = this->BaseGetKey(index); - _de->Value = this->BaseGet(index); - return( _de ); - } - } - - // Gets or sets the value associated with the specified key. - property Object^ default[ String^ ] { - Object^ get(String^ key) { - return( this->BaseGet( key ) ); - } - void set( String^ key, Object^ value ) { - this->BaseSet( key, value ); - } - } - - // Gets a String array that contains all the keys in the collection. - property array^ AllKeys { - array^ get() { - return( (array^)this->BaseGetAllKeys() ); - } - } - - // Gets an Object array that contains all the values in the collection. - property Array^ AllValues { - Array^ get() { - return( this->BaseGetAllValues() ); - } - } - - // Gets a String array that contains all the values in the collection. - property array^ AllStringValues { - array^ get() { - return( (array^) this->BaseGetAllValues( String ::typeid )); - } - } - - // Gets a value indicating if the collection contains keys that are not null. - property Boolean HasKeys { - Boolean get() { - return( this->BaseHasKeys() ); - } - } - - // Adds an entry to the collection. - void Add( String^ key, Object^ value ) { - this->BaseAdd( key, value ); - } - - // Removes an entry with the specified key from the collection. - void Remove( String^ key ) { - this->BaseRemove( key ); - } - - // Removes an entry in the specified index from the collection. - void Remove( int index ) { - this->BaseRemoveAt( index ); - } - - // Clears all the elements in the collection. - void Clear() { - this->BaseClear(); - } -}; - -public ref class SamplesNameObjectCollectionBase { - -public: - static void Main() { - // Creates and initializes a new MyCollection that is read-only. - IDictionary^ d = gcnew ListDictionary(); - d->Add( "red", "apple" ); - d->Add( "yellow", "banana" ); - d->Add( "green", "pear" ); - MyCollection^ myROCol = gcnew MyCollection( d, true ); - - // Tries to add a new item. - try { - myROCol->Add( "blue", "sky" ); - } - catch ( NotSupportedException^ e ) { - Console::WriteLine( e->ToString() ); - } - - // Displays the keys and values of the MyCollection. - Console::WriteLine( "Read-Only Collection:" ); - PrintKeysAndValues( myROCol ); - - // Creates and initializes an empty MyCollection that is writable. - MyCollection^ myRWCol = gcnew MyCollection(); - - // Adds new items to the collection. - myRWCol->Add( "purple", "grape" ); - myRWCol->Add( "orange", "tangerine" ); - myRWCol->Add( "black", "berries" ); - Console::WriteLine( "Writable Collection (after adding values):" ); - PrintKeysAndValues( myRWCol ); - - // Changes the value of one element. - myRWCol["orange"] = "grapefruit"; - Console::WriteLine( "Writable Collection (after changing one value):" ); - PrintKeysAndValues( myRWCol ); - - // Removes one item from the collection. - myRWCol->Remove( "black" ); - Console::WriteLine( "Writable Collection (after removing one value):" ); - PrintKeysAndValues( myRWCol ); - - // Removes all elements from the collection. - myRWCol->Clear(); - Console::WriteLine( "Writable Collection (after clearing the collection):" ); - PrintKeysAndValues( myRWCol ); - } - - // Prints the indexes, keys, and values. - static void PrintKeysAndValues( MyCollection^ myCol ) { - for ( int i = 0; i < myCol->Count; i++ ) { - Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); - } - } - - // Prints the keys and values using AllKeys. - static void PrintKeysAndValues2( MyCollection^ myCol ) { - for each ( String^ s in myCol->AllKeys ) { - Console::WriteLine( "{0}, {1}", s, myCol[s] ); - } - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - -/* -This code produces the following output. - -System.NotSupportedException: Collection is read-only. - at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value) - at SamplesNameObjectCollectionBase.Main() -Read-Only Collection: -[0] : red, apple -[1] : yellow, banana -[2] : green, pear -Writable Collection (after adding values): -[0] : purple, grape -[1] : orange, tangerine -[2] : black, berries -Writable Collection (after changing one value): -[0] : purple, grape -[1] : orange, grapefruit -[2] : black, berries -Writable Collection (after removing one value): -[0] : purple, grape -[1] : orange, grapefruit -Writable Collection (after clearing the collection): - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp deleted file mode 100644 index 7865c4fe20e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Threading; - -public ref class DerivedCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Creates an empty collection. -public: - DerivedCollection() { - _de = gcnew DictionaryEntry(); - } - - // Adds elements from an IDictionary into the new collection. - DerivedCollection( IDictionary^ d, Boolean bReadOnly ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - this->IsReadOnly = bReadOnly; - } - - // Gets a key-and-value pair (DictionaryEntry) using an index. - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get(int index) { - _de->Key = this->BaseGetKey(index); - _de->Value = this->BaseGet(index); - return( _de ); - } - } - - // Gets or sets the value associated with the specified key. - property Object^ default[ String^ ] { - Object^ get(String^ key) { - return( this->BaseGet( key ) ); - } - void set( String^ key, Object^ value ) { - this->BaseSet( key, value ); - } - } - - // Gets a String array that contains all the keys in the collection. - property array^ AllKeys { - array^ get() { - return( (array^)this->BaseGetAllKeys() ); - } - } - - // Gets an Object array that contains all the values in the collection. - property Array^ AllValues { - Array^ get() { - return( this->BaseGetAllValues() ); - } - } - - // Gets a String array that contains all the values in the collection. - property array^ AllStringValues { - array^ get() { - return( (array^) this->BaseGetAllValues( String ::typeid )); - } - } - - // Gets a value indicating if the collection contains keys that are not null. - property Boolean HasKeys { - Boolean get() { - return( this->BaseHasKeys() ); - } - } - - // Adds an entry to the collection. - void Add( String^ key, Object^ value ) { - this->BaseAdd( key, value ); - } - - // Removes an entry with the specified key from the collection. - void Remove( String^ key ) { - this->BaseRemove( key ); - } - - // Removes an entry in the specified index from the collection. - void Remove( int index ) { - this->BaseRemoveAt( index ); - } - - // Clears all the elements in the collection. - void Clear() { - this->BaseClear(); - } -}; - -public ref class SamplesNameObjectCollectionBase -{ -public: - static void Main() - { - // - // Create a collection derived from NameObjectCollectionBase - ICollection^ myCollection = gcnew DerivedCollection(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesNameObjectCollectionBase::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp deleted file mode 100644 index 6d13a5bf9be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// The following code example demonstrates several of the properties and methods of NameValueCollection. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintKeysAndValues( NameValueCollection^ myCol ); -void PrintKeysAndValues2( NameValueCollection^ myCol ); - -int main() -{ - // Creates and initializes a new NameValueCollection. - NameValueCollection^ myCol = gcnew NameValueCollection; - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - myCol->Add( "red", "rouge" ); - - // Displays the values in the NameValueCollection in two different ways. - Console::WriteLine( "Displays the elements using the AllKeys property and the Item (indexer) property:" ); - PrintKeysAndValues( myCol ); - Console::WriteLine( "Displays the elements using GetKey and Get:" ); - PrintKeysAndValues2( myCol ); - - // Gets a value either by index or by key. - Console::WriteLine( "Index 1 contains the value {0}.", myCol[ 1 ] ); - Console::WriteLine( "Key \"red\" has the value {0}.", myCol[ "red" ] ); - Console::WriteLine(); - - // Copies the values to a string array and displays the string array. - array^myStrArr = gcnew array(myCol->Count); - myCol->CopyTo( myStrArr, 0 ); - Console::WriteLine( "The string array contains:" ); - for each ( String^ s in myStrArr ) - Console::WriteLine( " {0}", s ); - Console::WriteLine(); - - // Searches for a key and deletes it. - myCol->Remove( "green" ); - Console::WriteLine( "The collection contains the following elements after removing \"green\":" ); - PrintKeysAndValues( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "The collection contains the following elements after it is cleared:" ); - PrintKeysAndValues( myCol ); -} - -void PrintKeysAndValues( NameValueCollection^ myCol ) -{ - Console::WriteLine( " KEY VALUE" ); - for each ( String^ s in myCol->AllKeys ) - Console::WriteLine( " {0,-10} {1}", s, myCol[s] ); - Console::WriteLine(); -} - -void PrintKeysAndValues2( NameValueCollection^ myCol ) -{ - Console::WriteLine( " [INDEX] KEY VALUE" ); - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " [{0}] {1,-10} {2}", i, myCol->GetKey( i ), myCol->Get( i ) ); - Console::WriteLine(); -} - -/* - -This code produces the following output. - -Displays the elements using the AllKeys property and the Item (indexer) property: - KEY VALUE - red rojo,rouge - green verde - blue azul - -Displays the elements using GetKey and Get: - [INDEX] KEY VALUE - [0] red rojo,rouge - [1] green verde - [2] blue azul - -Index 1 contains the value verde. -Key "red" has the value rojo,rouge. - -The string array contains: - rojo,rouge - verde - azul - -The collection contains the following elements after removing "green": - KEY VALUE - red rojo,rouge - blue azul - -The collection contains the following elements after it is cleared: - KEY VALUE - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp deleted file mode 100644 index c59ed515e67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp +++ /dev/null @@ -1,138 +0,0 @@ -// -// The following code example enumerates the elements of a OrderedDictionary. -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class OrderedDictionarySample -{ -public: - static void Main() - { - // - // Creates and initializes a OrderedDictionary. - OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary(); - myOrderedDictionary->Add("testKey1", "testValue1"); - myOrderedDictionary->Add("testKey2", "testValue2"); - myOrderedDictionary->Add("keyToDelete", "valueToDelete"); - myOrderedDictionary->Add("testKey3", "testValue3"); - - ICollection^ keyCollection = myOrderedDictionary->Keys; - ICollection^ valueCollection = myOrderedDictionary->Values; - - // Display the contents using the key and value collections - DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count); - // - - // - // Modifying the OrderedDictionary - if (!myOrderedDictionary->IsReadOnly) - { - // Insert a new key to the beginning of the OrderedDictionary - myOrderedDictionary->Insert(0, "insertedKey1", "insertedValue1"); - - // Modify the value of the entry with the key "testKey2" - myOrderedDictionary["testKey2"] = "modifiedValue"; - - // Remove the last entry from the OrderedDictionary: "testKey3" - myOrderedDictionary->RemoveAt(myOrderedDictionary->Count - 1); - - // Remove the "keyToDelete" entry, if it exists - if (myOrderedDictionary->Contains("keyToDelete")) - { - myOrderedDictionary->Remove("keyToDelete"); - } - } - // - - Console::WriteLine( - "{0}Displaying the entries of a modified OrderedDictionary.", - Environment::NewLine); - DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count); - - // - // Clear the OrderedDictionary and add new values - myOrderedDictionary->Clear(); - myOrderedDictionary->Add("newKey1", "newValue1"); - myOrderedDictionary->Add("newKey2", "newValue2"); - myOrderedDictionary->Add("newKey3", "newValue3"); - - // Display the contents of the "new" Dictionary using an enumerator - IDictionaryEnumerator^ myEnumerator = - myOrderedDictionary->GetEnumerator(); - - Console::WriteLine( - "{0}Displaying the entries of a \"new\" OrderedDictionary.", - Environment::NewLine); - - DisplayEnumerator(myEnumerator); - // - } - - // - // Displays the contents of the OrderedDictionary from its keys and values - static void DisplayContents( - ICollection^ keyCollection, ICollection^ valueCollection, int dictionarySize) - { - array^ myKeys = gcnew array(dictionarySize); - array^ myValues = gcnew array(dictionarySize); - keyCollection->CopyTo(myKeys, 0); - valueCollection->CopyTo(myValues, 0); - - // Displays the contents of the OrderedDictionary - Console::WriteLine(" INDEX KEY VALUE"); - for (int i = 0; i < dictionarySize; i++) - { - Console::WriteLine(" {0,-5} {1,-25} {2}", - i, myKeys[i], myValues[i]); - } - Console::WriteLine(); - } - // - - // - // Displays the contents of the OrderedDictionary using its enumerator - static void DisplayEnumerator(IDictionaryEnumerator^ myEnumerator) - { - Console::WriteLine(" KEY VALUE"); - while (myEnumerator->MoveNext()) - { - Console::WriteLine(" {0,-25} {1}", - myEnumerator->Key, myEnumerator->Value); - } - } - // -}; - -int main() -{ - OrderedDictionarySample::Main(); -} - -/* -This code produces the following output. - - INDEX KEY VALUE - 0 testKey1 testValue1 - 1 testKey2 testValue2 - 2 keyToDelete valueToDelete - 3 testKey3 testValue3 - - -Displaying the entries of a modified OrderedDictionary. - INDEX KEY VALUE - 0 insertedKey1 insertedValue1 - 1 testKey1 testValue1 - 2 testKey2 modifiedValue - - -Displaying the entries of a "new" OrderedDictionary. - KEY VALUE - newKey1 newValue1 - newKey2 newValue2 - newKey3 newValue3 - -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp deleted file mode 100644 index 42c6ceb624c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -public ref class OrderedDictionarySample -{ -public: - static void Main() - { - OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary(); - // - for each (DictionaryEntry de in myOrderedDictionary) - { - //... - } - // - } -}; - -int main() -{ - OrderedDictionarySample::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp deleted file mode 100644 index 427029d212e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Threading; - -public ref class SamplesStringCollection -{ -public: - static void Main() - { - // - StringCollection^ myCollection = gcnew StringCollection(); - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesStringCollection::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp deleted file mode 100644 index c05a22e2367..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp +++ /dev/null @@ -1,182 +0,0 @@ -// The following code example demonstrates several of the properties and methods of StringCollection. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -void PrintValues1( StringCollection^ myCol ); -void PrintValues2( StringCollection^ myCol ); -void PrintValues3( StringCollection^ myCol ); - -int main() -{ - - // Create and initializes a new StringCollection. - StringCollection^ myCol = gcnew StringCollection; - - // Add a range of elements from an array to the end of the StringCollection. - array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; - myCol->AddRange( myArr ); - - // Display the contents of the collection using for each. This is the preferred method. - Console::WriteLine( "Displays the elements using for each:" ); - PrintValues1( myCol ); - - // Display the contents of the collection using the enumerator. - Console::WriteLine( "Displays the elements using the IEnumerator:" ); - PrintValues2( myCol ); - - // Display the contents of the collection using the Count and Item properties. - Console::WriteLine( "Displays the elements using the Count and Item properties:" ); - PrintValues3( myCol ); - - // Add one element to the end of the StringCollection and insert another at index 3. - myCol->Add( "* white" ); - myCol->Insert( 3, "* gray" ); - Console::WriteLine( "After adding \"* white\" to the end and inserting \"* gray\" at index 3:" ); - PrintValues1( myCol ); - - // Remove one element from the StringCollection. - myCol->Remove( "yellow" ); - Console::WriteLine( "After removing \"yellow\":" ); - PrintValues1( myCol ); - - // Remove all occurrences of a value from the StringCollection. - int i = myCol->IndexOf( "RED" ); - while ( i > -1 ) - { - myCol->RemoveAt( i ); - i = myCol->IndexOf( "RED" ); - } - - - // Verify that all occurrences of "RED" are gone. - if ( myCol->Contains( "RED" ) ) - Console::WriteLine( "*** The collection still contains \"RED\"." ); - - Console::WriteLine( "After removing all occurrences of \"RED\":" ); - PrintValues1( myCol ); - - // Copy the collection to a new array starting at index 0. - array^myArr2 = gcnew array(myCol->Count); - myCol->CopyTo( myArr2, 0 ); - Console::WriteLine( "The new array contains:" ); - for ( i = 0; i < myArr2->Length; i++ ) - { - Console::WriteLine( " [{0}] {1}", i, myArr2[ i ] ); - - } - Console::WriteLine(); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "After clearing the collection:" ); - PrintValues1( myCol ); -} - - -// Uses the for each statement which hides the complexity of the enumerator. -// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. -void PrintValues1( StringCollection^ myCol ) { - for each ( Object^ obj in myCol ) - Console::WriteLine( " {0}", obj ); - Console::WriteLine(); -} - -// Uses the enumerator. -void PrintValues2( StringCollection^ myCol ) -{ - StringEnumerator^ myEnumerator = myCol->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( " {0}", myEnumerator->Current ); - - Console::WriteLine(); -} - - -// Uses the Count and Item properties. -void PrintValues3( StringCollection^ myCol ) -{ - for ( int i = 0; i < myCol->Count; i++ ) - Console::WriteLine( " {0}", myCol[ i ] ); - Console::WriteLine(); -} - -/* -This code produces the following output. - -Displays the elements using the IEnumerator: - RED - orange - yellow - RED - green - blue - RED - indigo - violet - RED - -Displays the elements using the Count and Item properties: - RED - orange - yellow - RED - green - blue - RED - indigo - violet - RED - -After adding "* white" to the end and inserting "* gray" at index 3: - RED - orange - yellow - * gray - RED - green - blue - RED - indigo - violet - RED - * white - -After removing "yellow": - RED - orange - * gray - RED - green - blue - RED - indigo - violet - RED - * white - -After removing all occurrences of "RED": - orange - * gray - green - blue - indigo - violet - * white - -The new array contains: - [0] orange - [1] * gray - [2] green - [3] blue - [4] indigo - [5] violet - [6] * white - -After clearing the collection: - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp deleted file mode 100644 index 841b997b1e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -// The following code example adds new elements to the StringCollection. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintValues( IEnumerable^ myCol ); -int main() -{ - - // Creates and initializes a new StringCollection. - StringCollection^ myCol = gcnew StringCollection; - Console::WriteLine( "Initial contents of the StringCollection:" ); - PrintValues( myCol ); - - // Adds a range of elements from an array to the end of the StringCollection. - array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; - myCol->AddRange( myArr ); - Console::WriteLine( "After adding a range of elements:" ); - PrintValues( myCol ); - - // Adds one element to the end of the StringCollection and inserts another at index 3. - myCol->Add( "* white" ); - myCol->Insert( 3, "* gray" ); - Console::WriteLine( "After adding \"* white\" to the end and inserting \"* gray\" at index 3:" ); - PrintValues( myCol ); -} - -void PrintValues( IEnumerable^ myCol ) -{ - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the StringCollection: - -After adding a range of elements: - RED - orange - yellow - RED - green - blue - RED - indigo - violet - RED - -After adding "* white" to the end and inserting "* gray" at index 3: - RED - orange - yellow - * gray - RED - green - blue - RED - indigo - violet - RED - * white - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp deleted file mode 100644 index 9d9a32b8e90..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp +++ /dev/null @@ -1,58 +0,0 @@ - - -// The following code example searches the StringCollection for an element. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintValues( IEnumerable^ myCol ); -int main() -{ - - // Creates and initializes a new StringCollection. - StringCollection^ myCol = gcnew StringCollection; - array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; - myCol->AddRange( myArr ); - Console::WriteLine( "Initial contents of the StringCollection:" ); - PrintValues( myCol ); - - // Checks whether the collection contains "orange" and, if so, displays its index. - if ( myCol->Contains( "orange" ) ) - Console::WriteLine( "The collection contains \"orange\" at index {0}.", myCol->IndexOf( "orange" ) ); - else - Console::WriteLine( "The collection does not contain \"orange\"." ); -} - -void PrintValues( IEnumerable^ myCol ) -{ - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the StringCollection: - RED - orange - yellow - RED - green - blue - RED - indigo - violet - RED - -The collection contains "orange" at index 1. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp deleted file mode 100644 index f90440e4676..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -// The following code example copies a StringCollection to an array. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintValues( IEnumerable^ myCol ); -int main() -{ - - // Creates and initializes a new StringCollection. - StringCollection^ myCol = gcnew StringCollection; - array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; - myCol->AddRange( myArr ); - Console::WriteLine( "Initial contents of the StringCollection:" ); - PrintValues( myCol ); - - // Copies the collection to a new array starting at index 0. - array^myArr2 = gcnew array(myCol->Count); - myCol->CopyTo( myArr2, 0 ); - Console::WriteLine( "The new array contains:" ); - for ( int i = 0; i < myArr2->Length; i++ ) - { - Console::WriteLine( " [{0}] {1}", i, myArr2[ i ] ); - - } - Console::WriteLine(); -} - -void PrintValues( IEnumerable^ myCol ) -{ - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the StringCollection: - RED - orange - yellow - RED - green - blue - RED - indigo - violet - RED - -The new array contains: - [0] RED - [1] orange - [2] yellow - [3] RED - [4] green - [5] blue - [6] RED - [7] indigo - [8] violet - [9] RED - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp deleted file mode 100644 index 98e049d1393..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -// The following code example removes elements from the StringCollection. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void PrintValues( IEnumerable^ myCol ); -int main() -{ - - // Creates and initializes a new StringCollection. - StringCollection^ myCol = gcnew StringCollection; - array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; - myCol->AddRange( myArr ); - Console::WriteLine( "Initial contents of the StringCollection:" ); - PrintValues( myCol ); - - // Removes one element from the StringCollection. - myCol->Remove( "yellow" ); - Console::WriteLine( "After removing \"yellow\":" ); - PrintValues( myCol ); - - // Removes all occurrences of a value from the StringCollection. - int i = myCol->IndexOf( "RED" ); - while ( i > -1 ) - { - myCol->RemoveAt( i ); - i = myCol->IndexOf( "RED" ); - } - - Console::WriteLine( "After removing all occurrences of \"RED\":" ); - PrintValues( myCol ); - - // Clears the entire collection. - myCol->Clear(); - Console::WriteLine( "After clearing the collection:" ); - PrintValues( myCol ); -} - -void PrintValues( IEnumerable^ myCol ) -{ - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ obj = safe_cast(myEnum->Current); - Console::WriteLine( " {0}", obj ); - } - - Console::WriteLine(); -} - -/* -This code produces the following output. - -Initial contents of the StringCollection: - RED - orange - yellow - RED - green - blue - RED - indigo - violet - RED - -After removing "yellow": - RED - orange - RED - green - blue - RED - indigo - violet - RED - -After removing all occurrences of "RED": - orange - green - blue - indigo - violet - -After clearing the collection: - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp deleted file mode 100644 index 5bf34579a7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -// The following code example shows how a StringDictionary can be copied to an array. -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -void main() -{ - - // Creates and initializes a new StringDictionary. - StringDictionary^ myCol = gcnew StringDictionary; - myCol->Add( "red", "rojo" ); - myCol->Add( "green", "verde" ); - myCol->Add( "blue", "azul" ); - - // Displays the values in the StringDictionary. - Console::WriteLine( "KEYS\tVALUES in the StringDictionary" ); - IEnumerator^ myEnum = myCol->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ myDE = safe_cast(myEnum->Current); - Console::WriteLine( "{0}\t{1}", myDE->Key, myDE->Value ); - Console::WriteLine(); - - // Creates an array with DictionaryEntry elements. - array^myArr = gcnew array(3); - - // Copies the StringDictionary to the array. - myCol->CopyTo( myArr, 0 ); - - // Displays the values in the array. - Console::WriteLine( "KEYS\tVALUES in the array" ); - for ( int i = 0; i < myArr->Length; i++ ) - Console::WriteLine( "{0}\t{1}", myArr[ i ].Key, myArr[ i ].Value ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -KEYS VALUES in the StringDictionary -green verde -red rojo -blue azul - -KEYS VALUES in the array -green verde -red rojo -blue azul - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp deleted file mode 100644 index c6cea926c77..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// The following code example demonstrates several of the properties and methods of StringEnumerator. -// -#using - -using namespace System; -using namespace System::Collections::Specialized; -int main() -{ - - // Creates and initializes a StringCollection. - StringCollection^ myCol = gcnew StringCollection; - array^myArr = {"red","orange","yellow","green","blue","indigo","violet"}; - myCol->AddRange( myArr ); - - // Enumerates the elements in the StringCollection. - StringEnumerator^ myEnumerator = myCol->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( "{0}", myEnumerator->Current ); - - Console::WriteLine(); - - // Resets the enumerator and displays the first element again. - myEnumerator->Reset(); - if ( myEnumerator->MoveNext() ) - Console::WriteLine( "The first element is {0}.", myEnumerator->Current ); -} - -/* -This code produces the following output. - -red -orange -yellow -green -blue -indigo -violet - -The first element is red. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp deleted file mode 100644 index d9dc7f158c6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// This sample opens a file whose name is passed to it as a parameter. -// It reads each line in the file and replaces every occurrence of 4 -// space characters with a tab character. -// -// It takes two command-line arguments: the input file name, and -// the output file name. -// -// Usage: -// -// INSERTTABS inputfile.txt outputfile.txt -// -// -using namespace System; -using namespace System::IO; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - const int tabSize = 4; - String^ usageText = "Usage: INSERTTABS inputfile.txt outputfile.txt"; - StreamWriter^ writer = nullptr; - if ( args->Length < 3 ) - { - Console::WriteLine( usageText ); - return 1; - } - - try - { - // Attempt to open output file. - writer = gcnew StreamWriter( args[ 2 ] ); - // Redirect standard output from the console to the output file. - Console::SetOut( writer ); - // Redirect standard input from the console to the input file. - Console::SetIn( gcnew StreamReader( args[ 1 ] ) ); - } - catch ( IOException^ e ) - { - TextWriter^ errorWriter = Console::Error; - errorWriter->WriteLine( e->Message ); - errorWriter->WriteLine( usageText ); - return 1; - } - - String^ line; - while ( (line = Console::ReadLine()) != nullptr ) - { - String^ newLine = line->Replace( ((String^)"")->PadRight( tabSize, ' ' ), "\t" ); - Console::WriteLine( newLine ); - } - - writer->Close(); - - // Recover the standard output stream so that a - // completion message can be displayed. - StreamWriter^ standardOutput = gcnew StreamWriter( Console::OpenStandardOutput() ); - standardOutput->AutoFlush = true; - Console::SetOut( standardOutput ); - Console::WriteLine( "INSERTTABS has completed the processing of {0}.", args[ 1 ] ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp deleted file mode 100644 index 05916a9e0cd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -using namespace System; - -// This sample converts tab-delmited input and converts it to -// comma-delimited output. Furthermore, it converts all boolean -// input to numeric representations. -// System.Console.Write -// System.Console.WriteLine -// System.Console.ReadLine -// -int main() -{ - array^lineInputArr = {"1 2.2 hello TRUE","2 5.22 bye FALSE","3 6.38 see ya' TRUE"}; - for ( Int32 i = 0; i < 3; i++ ) - { - String^ lineInput = lineInputArr->GetValue( i )->ToString(); - String^ aChar = "\t"; - array^fields = lineInput->Split( aChar->ToCharArray() ); - Boolean isFirstField = true; - for ( Int32 i = 0; i < fields->Length; i++ ) - { - if ( isFirstField ) - isFirstField = false; - else - Console::Write( "," ); - - // If the field represents a boolean, replace with a numeric representation. - try - { - Console::Write( Convert::ToByte( Convert::ToBoolean( fields[ i ] ) ) ); - } - catch ( FormatException^ ) - { - Console::Write( fields[ i ] ); - } - - - } - Console::WriteLine(); - - } -} - -// -/* -usage examples: -To convert tab-delimited input from the keyboard and display -the output (type CTRL+Z to mark the end of input): - REFORMAT - -To input tab-delimited data from a file and display the output: - REFORMAT commas.txt - -To convert tab-delimited data from a file and output the conversion -to a file: - REFORMAT commas.txt - -Example input: -1 2.2 hello TRUE -2 5.22 bye FALSE -3 6.38 see ya' TRUE - -Example output: -1,2.2,hello,1 -2,5.22,bye,0 -3,6.38,see ya',1 - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp deleted file mode 100644 index 28ce20635b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// System.Console.OpenStandartInput -// - -using namespace System; -using namespace System::Text; -using namespace System::IO; - -int main() -{ - Stream^ inputStream = Console::OpenStandardInput(); - array^bytes = gcnew array(100); - Console::WriteLine( "To decode, type or paste the UTF7 encoded string and press enter:" ); - Console::WriteLine( "(Example: \"M+APw-nchen ist wundervoll\")" ); - int outputLength = inputStream->Read( bytes, 0, 100 ); - array^chars = Encoding::UTF7->GetChars( bytes, 0, outputLength ); - Console::WriteLine( "Decoded string:" ); - Console::WriteLine( gcnew String( chars ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp deleted file mode 100644 index 46250e779de..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::Clear(); - - DateTime dat = DateTime::Now; - - Console::WriteLine("\nToday is {0:d} at {0:T}.", dat); - Console::Write("\nPress any key to continue... "); - Console::ReadLine(); -} -// The example displays output like the following: -// Today is 10/26/2015 at 12:22:22 PM. -// -// Press any key to continue... - -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp deleted file mode 100644 index 33019ead3ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// Console.ReadLine.cpp : main project file. - -// -using namespace System; - -void main() -{ - String^ line; - Console::WriteLine("Enter one or more lines of text (press CTRL+Z to exit):"); - Console::WriteLine(); - do { - Console::Write(" "); - line = Console::ReadLine(); - if (line != nullptr) - Console::WriteLine(" " + line); - } while (line != nullptr); -} -// The following displays possible output from this example: -// Enter one or more lines of text (press CTRL+Z to exit): -// -// This is line #1. -// This is line #1. -// This is line #2 -// This is line #2 -// ^Z -// -// >} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp deleted file mode 100644 index 11038946fd4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Console.SetError.cpp : main project file. - -// -using namespace System; -using namespace System::IO; -using namespace System::Reflection; - -ref class RedirectStdErr; - -void main() -{ - // Define file to receive error stream. - DateTime appStart = DateTime::Now; - String^ fn = "c:\\temp\\errlog" + appStart.ToString("yyyyMMddHHmm") + ".log"; - TextWriter^ errStream = gcnew StreamWriter(fn); - String^ appName = Assembly::GetExecutingAssembly()->Location; - appName = appName->Substring(appName->LastIndexOf('\\') + 1); - // Redirect standard error stream to file. - Console::SetError(errStream); - // Write file header. - Console::Error->WriteLine("Error Log for Application {0}", appName); - Console::Error->WriteLine(); - Console::Error->WriteLine("Application started at {0}.", appStart); - Console::Error->WriteLine(); - // - // Application code along with error output - // - // Close redirected error stream. - Console::Error->Close(); -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp deleted file mode 100644 index a6753c8b965..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Console.WriteLine.cpp : main project file. - -// -using namespace System; - -void main() -{ - array^ lines = gcnew array { "This is the first line.", - "This is the second line." }; - // Output the lines using the default newline sequence. - Console::WriteLine("With the default new line characters:"); - Console::WriteLine(); - for each (String^ line in lines) - Console::WriteLine(line); - - Console::WriteLine(); - - // Redefine the newline characters to double space. - Console::Out->NewLine = "\r\n\r\n"; - // Output the lines using the new newline sequence. - Console::WriteLine("With redefined new line characters:"); - Console::WriteLine(); - for each (String^ line in lines) - Console::WriteLine(line); -} -// The example displays the following output: -// With the default new line characters: -// -// This is the first line. -// This is the second line. -// -// With redefined new line characters: -// -// -// -// This is the first line. -// -// This is the second line. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp deleted file mode 100644 index 0a1a1d1bd9d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// Console.WriteLine1.cpp : main project file. - -// -using namespace System; - -void main() -{ - // Assign 10 random integers to an array. - Random^ rnd = gcnew Random(); - array^ numbers = gcnew array(10); - for (int ctr = 0; ctr <= numbers->GetUpperBound(0); ctr++) - numbers[ctr] = rnd->Next(); - - // Determine whether the numbers are even or odd. - for each (Int32 number in numbers) { - bool even = (number % 2 == 0); - Console::WriteLine("Is {0} even:", number); - Console::WriteLine(even); - Console::WriteLine(); - } -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp deleted file mode 100644 index 821a9d93340..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ values = { true, 12.632, 17908, "stringValue", - 'a', (Decimal) 16907.32 }; - for each (Object^ value in values) - Console::WriteLine(value); -} -// The example displays the following output: -// True -// 12.632 -// 17908 -// stringValue -// a -// 16907.32 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp deleted file mode 100644 index 8cf3b32eb2d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -int CountLetters(String^ value); -int CountWhitespace(String^ value); - -void main() -{ - String^ value = "This is a test string."; - - - Console::WriteLine("The string '{0}' consists of:" + - "{4}{1} characters{4}{2} letters{4}" + - "{3} white-space characters", - value, value->Length, CountLetters(value), - CountWhitespace(value), Environment::NewLine); -} - -int CountLetters(String^ value) -{ - int nLetters = 0; - for each (Char ch in value) { - if (Char::IsLetter(ch)) - nLetters++; - } - return nLetters; -} - -int CountWhitespace(String^ value) -{ - int nWhitespace = 0; - for each (Char ch in value) { - if (Char::IsWhiteSpace(ch)) - nWhitespace++; - } - return nWhitespace; -} -// The example displays the following output: -// The string 'This is a test string.' consists of: -// 22 characters -// 17 letters -// 4 white-space characters -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp deleted file mode 100644 index 0e3d6bf7e2a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// ConsoleKey.cpp : main project file. - - -// -using namespace System; -using namespace System::Text; - -void main() -{ - ConsoleKeyInfo input; - do { - Console::WriteLine("Press a key, together with Alt, Ctrl, or Shift."); - Console::WriteLine("Press Esc to exit."); - input = Console::ReadKey(true); - - StringBuilder^ output = gcnew StringBuilder( - String::Format("You pressed {0}", input.Key.ToString())); - bool modifiers = false; - - if ((input.Modifiers & ConsoleModifiers::Alt) == ConsoleModifiers::Alt) { - output->Append(", together with " + ConsoleModifiers::Alt.ToString()); - modifiers = true; - } - if ((input.Modifiers & ConsoleModifiers::Control) == ConsoleModifiers::Control) - { - if (modifiers) { - output->Append(" and "); - } - else { - output->Append(", together with "); - modifiers = true; - } - output->Append(ConsoleModifiers::Control.ToString()); - } - if ((input.Modifiers & ConsoleModifiers::Shift) == ConsoleModifiers::Shift) - { - if (modifiers) { - output->Append(" and "); - } - else { - output->Append(", together with "); - modifiers = true; - } - output->Append(ConsoleModifiers::Shift.ToString()); - } - output->Append("."); - Console::WriteLine(output->ToString()); - Console::WriteLine(); - } while (input.Key != ConsoleKey::Escape); -} -// The output from a sample console session might appear as follows: -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed D. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed X, along with Shift. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed L, along with Control and Shift. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed P, along with Alt and Control and Shift. -// -// Press a key, along with Alt, Ctrl, or Shift. -// Press Esc to exit. -// You pressed Escape. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp deleted file mode 100644 index 1aea3c7af8b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// ConsoleKeyInfo.Equals.cpp : main project file. - -// ConsoleKeyInfo.Equals(Object) - -// -using namespace System; -using namespace System::Text; - -static String^ KeyCombination(ConsoleKeyInfo sourceCki); - -void main() -{ - String^ k1 = "\nEnter a key ......... "; - String^ k2 = "\nEnter another key ... "; - String^ key1 = ""; - String^ key2 = ""; - String^ areKeysEqual = "The {0} and {1} keys are {2}equal."; - String^ equalValue = ""; - String^ prompt = "Press the escape key (ESC) to quit, " + - "or any other key to continue."; - ConsoleKeyInfo cki1; - ConsoleKeyInfo cki2; - // - // The Console.TreatControlCAsInput property prevents this example from - // ending if you press CTL+C, however all other operating system keys and - // shortcuts, such as ALT+TAB or the Windows Logo key, are still in effect. - // - Console::TreatControlCAsInput = true; - - // Request that the user enter two key presses. A key press and any - // combination shift, CTRL, and ALT modifier keys is permitted. - do - { - Console::Write(k1); - cki1 = Console::ReadKey(false); - Console::Write(k2); - cki2 = Console::ReadKey(false); - Console::WriteLine(); - - key1 = KeyCombination(cki1); - key2 = KeyCombination(cki2); - if (cki1.Equals(cki2)) - equalValue = ""; - else - equalValue = "not "; - - Console::WriteLine(areKeysEqual, key1, key2, equalValue); - - Console::WriteLine(prompt); - cki1 = Console::ReadKey(true); - } while (cki1.Key != ConsoleKey::Escape); -// Note: This example requires the Escape (Esc) key. -} - -// The KeyCombination() method creates a string that specifies what -// key and what combination of shift, CTRL, and ALT modifier keys -// were pressed simultaneously. - -static String^ KeyCombination(ConsoleKeyInfo sourceCki) -{ - StringBuilder^ sb = gcnew StringBuilder(); - sb->Length = 0; - String^ keyCombo; - if (sourceCki.Modifiers != ConsoleModifiers()) - { - if ((sourceCki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) - sb->Append("ALT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) - sb->Append("SHIFT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) - sb->Append("CTL+"); - } - sb->Append(sourceCki.Key.ToString()); - keyCombo = sb->ToString(); - return keyCombo; -} -/* -This example produces results similar to the following output: - -Enter a key ......... a -Enter another key ... a -The A and A keys are equal. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... a -Enter another key ... A -The A and SHIFT+A keys are not equal. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... S -Enter another key ... -The ALT+SHIFT+S and ALT+CTL+F keys are not equal. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... -Enter another key ... -The UpArrow and UpArrow keys are equal. -Press the escape key (ESC) to quit, or any other key to continue. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp deleted file mode 100644 index 504f7fe19df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// ConsoleKeyInfo.GetHashCode.cpp : main project file. - - -// -using namespace System; -using namespace System::Text; - -String^ KeyCombination(ConsoleKeyInfo sourceCki); - -void main() -{ - String^ k1 = "\nEnter a key ......... "; - String^ key1 = ""; - String^ hashCodeFmt = "The hash code for the {0} key is {1}."; - String^ prompt = "Press the escape key (ESC) to quit, " + - "or any other key to continue."; - ConsoleKeyInfo cki1; - int hashCode = 0; - - // The Console.TreatControlCAsInput property prevents this example from - // ending if you press CTL+C, however all other operating system keys and - // shortcuts, such as ALT+TAB or the Windows Logo key, are still in effect. - // - Console::TreatControlCAsInput = true; - - // Request that the user enter two key presses. A key press and any - // combination shift, CTRL, and ALT modifier keys is permitted. - do - { - Console::Write(k1); - cki1 = Console::ReadKey(false); - Console::WriteLine(); - - key1 = KeyCombination(cki1); - hashCode = cki1.GetHashCode(); - Console::WriteLine(hashCodeFmt, key1, hashCode); - - Console::WriteLine(prompt); - cki1 = Console::ReadKey(true); - } while (cki1.Key != ConsoleKey::Escape); - // Note: This example requires the Escape (Esc) key. -} - -// The KeyCombination() method creates a string that specifies what -// key and what combination of shift, CTRL, and ALT modifier keys -// were pressed simultaneously. - -static String^ KeyCombination(ConsoleKeyInfo sourceCki) -{ - StringBuilder^ sb = gcnew StringBuilder(); - sb->Length = 0; - String^ keyCombo; - if (sourceCki.Modifiers != (ConsoleModifiers) 0) - { - if ((sourceCki.Modifiers & ConsoleModifiers::Alt) != (ConsoleModifiers) 0) - sb->Append("ALT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Shift) != (ConsoleModifiers) 0) - sb->Append("SHIFT+"); - if ((sourceCki.Modifiers & ConsoleModifiers::Control) != (ConsoleModifiers) 0) - sb->Append("CTL+"); - } - sb->Append(sourceCki.Key.ToString()); - keyCombo = sb->ToString(); - return keyCombo; -} - - -/* -This example produces results similar to the following output: - -Enter a key ......... a -The hash code for the A key is 97. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... S -The hash code for the SHIFT+S key is 83. -Press the escape key (ESC) to quit, or any other key to continue. - -Enter a key ......... -The hash code for the ALT+SHIFT+CTL+J key is 7. -Press the escape key (ESC) to quit, or any other key to continue. - -*/ -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp deleted file mode 100644 index ec5dbbee4ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp +++ /dev/null @@ -1,593 +0,0 @@ -using namespace System; - -public ref class ConvertSnippet -{ -// -public: - void ConvertDoubleBool( double doubleVal ) - { - bool boolVal; - - // Double to bool conversion cannot overflow. - boolVal = System::Convert::ToBoolean( doubleVal ); - System::Console::WriteLine( " {0} as a Boolean is: {1}.", - doubleVal, boolVal ); - - // bool to double conversion cannot overflow. - doubleVal = System::Convert::ToDouble( boolVal ); - System::Console::WriteLine( " {0} as a double is: {1}.", - boolVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleByte( double doubleVal ) - { - Byte byteVal = 0; - - // Double to Byte conversion can overflow. - try - { - byteVal = System::Convert::ToByte( doubleVal ); - System::Console::WriteLine( " {0} as a Byte is: {1}.", - doubleVal, byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in double-to-Byte conversion." ); - } - - // Byte to double conversion cannot overflow. - doubleVal = System::Convert::ToDouble( byteVal ); - System::Console::WriteLine( " {0} as a double is: {1}.", - byteVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleInt( double doubleVal ) - { - int intVal = 0; - - // Double to int conversion can overflow. - try - { - intVal = System::Convert::ToInt32( doubleVal ); - System::Console::WriteLine( " {0} as an int is: {1}", - doubleVal, intVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in double-to-int conversion." ); - } - - // Int to double conversion cannot overflow. - doubleVal = System::Convert::ToDouble( intVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - intVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleDecimal( double doubleVal ) - { - Decimal decimalVal; - - // Conversion from double to decimal cannot overflow. - decimalVal = System::Convert::ToDecimal( doubleVal ); - System::Console::WriteLine( " {0} as a decimal is: {1}", - doubleVal, decimalVal ); - - // Decimal to double conversion can overflow. - try - { - doubleVal = System::Convert::ToDouble( decimalVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - decimalVal, doubleVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in decimal-to-double conversion." ); - } - } - // - - // -public: - void CovertDoubleFloat( double doubleVal ) - { - float floatVal = 0; - - // A conversion from Double to Single cannot overflow. - floatVal = System::Convert::ToSingle( doubleVal ); - System::Console::WriteLine( " {0} as a float is {1}", - doubleVal, floatVal ); - - // A conversion from Single to Double cannot overflow. - doubleVal = System::Convert::ToDouble( floatVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - floatVal, doubleVal ); - } - // - - // -public: - void ConvertDoubleString( double doubleVal ) - { - String^ stringVal; - - // A conversion from Double to String cannot overflow. - stringVal = System::Convert::ToString( doubleVal ); - System::Console::WriteLine( " {0} as a String is: {1}", - doubleVal, stringVal ); - try - { - doubleVal = System::Convert::ToDouble( stringVal ); - System::Console::WriteLine( " {0} as a double is: {1}", - stringVal, doubleVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Conversion from String-to-double overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( "The String was not formatted as a double." ); - } - catch ( System::ArgumentException^ ) - { - System::Console::WriteLine( "The String pointed to null." ); - } - } - // - - // -public: - void ConvertLongChar( Int64 longVal ) - { - Char charVal = 'a'; - - try - { - charVal = System::Convert::ToChar( longVal ); - System::Console::WriteLine( " {0} as a char is {1}", - longVal, charVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in long-to-char conversion." ); - } - - - // A conversion from Char to long cannot overflow. - longVal = System::Convert::ToInt64( charVal ); - System::Console::WriteLine( " {0} as an Int64 is {1}", - charVal, longVal ); - } - - - // - // - void ConvertLongByte( Int64 longVal ) - { - Byte byteVal = 0; - - // A conversion from Long to Byte can overflow. - try - { - byteVal = System::Convert::ToByte( longVal ); - System::Console::WriteLine( " {0} as a Byte is {1}", - longVal, byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in long-to-Byte conversion." ); - } - - // A conversion from Byte to long cannot overflow. - longVal = System::Convert::ToInt64( byteVal ); - System::Console::WriteLine( " {0} as an Int64 is {1}", - byteVal, longVal ); - } - // - - // -public: - void ConvertLongDecimal( Int64 longVal ) - { - Decimal decimalVal; - - // Long to decimal conversion cannot overflow. - decimalVal = System::Convert::ToDecimal( longVal ); - System::Console::WriteLine( " {0} as a decimal is {1}", - longVal, decimalVal ); - - // Decimal to long conversion can overflow. - try - { - longVal = System::Convert::ToInt64( decimalVal ); - System::Console::WriteLine( " {0} as a long is {1}", - decimalVal, longVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in decimal-to-long conversion." ); - } - } - // - - // -public: - void ConvertLongFloat( Int64 longVal ) - { - float floatVal; - - // A conversion from Long to float cannot overflow. - floatVal = System::Convert::ToSingle( longVal ); - System::Console::WriteLine( " {0} as a float is {1}", - longVal, floatVal ); - - // A conversion from float to long can overflow. - try - { - longVal = System::Convert::ToInt64( floatVal ); - System::Console::WriteLine( " {0} as a long is {1}", - floatVal, longVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( "Overflow in float-to-long conversion." ); - } - } - // - - // -public: - void ConvertStringBoolean( String^ stringVal ) - { - bool boolVal = false; - - try - { - boolVal = System::Convert::ToBoolean( stringVal ); - if ( boolVal ) - { - System::Console::WriteLine( - "String was equal to System::Boolean::TrueString." ); - } - else - { - System::Console::WriteLine( - "String was equal to System::Boolean::FalseString." ); - } - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( "The String must equal System::Boolean::TrueString " + - "or System::Boolean::FalseString." ); - } - - // A conversion from bool to String will always succeed. - stringVal = System::Convert::ToString( boolVal ); - System::Console::WriteLine( " {0} as a String is {1}", - boolVal, stringVal ); - } - // - - // -public: - void ConvertStringByte( String^ stringVal ) - { - Byte byteVal = 0; - - try - { - byteVal = System::Convert::ToByte( stringVal ); - System::Console::WriteLine( " {0} as a Byte is: {1}", - stringVal, byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "Conversion from String to Byte overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is not formatted as a Byte." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( "The String is 0." ); - } - - //The conversion from Byte to String is always valid. - stringVal = System::Convert::ToString( byteVal ); - System::Console::WriteLine( " {0} as a String is {1}", - byteVal, stringVal ); - } - // - - // -public: - void ConvertStringChar( String^ stringVal ) - { - Char charVal = 'a'; - - // A String must be one character long to convert to char. - try - { - charVal = System::Convert::ToChar( stringVal ); - System::Console::WriteLine( " {0} as a char is {1}", - stringVal, charVal ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is longer than one character." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( "The String is 0." ); - } - - // A char to String conversion will always succeed. - stringVal = System::Convert::ToString( charVal ); - System::Console::WriteLine( "The character as a String is {0}", - stringVal ); - } - // - - // -public: - void ConvertStringDecimal( String^ stringVal ) - { - Decimal decimalVal = 0; - - try - { - decimalVal = System::Convert::ToDecimal( stringVal ); - System::Console::WriteLine( "The String as a decimal is {0}.", - decimalVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The conversion from String to decimal overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is not formatted as a decimal." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( "The String is 0." ); - } - - // Decimal to String conversion will not overflow. - stringVal = System::Convert::ToString( decimalVal ); - System::Console::WriteLine( - "The decimal as a String is {0}.", stringVal ); - } - // - - // -public: - void ConvertStringFloat( String^ stringVal ) - { - float floatVal = 0; - - try - { - floatVal = System::Convert::ToSingle( stringVal ); - System::Console::WriteLine( - "The String as a float is {0}.", floatVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The conversion from String-to-float overflowed." ); - } - catch ( System::FormatException^ ) - { - System::Console::WriteLine( - "The String is not formatted as a float." ); - } - catch ( System::ArgumentNullException^ ) - { - System::Console::WriteLine( - "The String is 0." ); - } - - // Float to String conversion will not overflow. - stringVal = System::Convert::ToString( floatVal ); - System::Console::WriteLine( - "The float as a String is {0}.", stringVal ); - } - // - - // -public: - void ConvertCharDecimal( Char charVal ) - { - Decimal decimalVal = 0; - - // Char to decimal conversion is not supported and will always - // throw an InvalidCastException. - try - { - decimalVal = System::Convert::ToDecimal( charVal ); - } - catch ( System::InvalidCastException^ ) - { - System::Console::WriteLine( - "Char-to-Decimal conversion is not supported by the .NET Framework." ); - } - - //Decimal to char conversion is also not supported. - try - { - charVal = System::Convert::ToChar( decimalVal ); - } - catch ( System::InvalidCastException^ ) - { - System::Console::WriteLine( - "Decimal-to-Char conversion is not supported by the .NET Framework." ); - } - } - // - - // -public: - void ConvertByteDecimal( Byte byteVal ) - { - Decimal decimalVal; - - // Byte to decimal conversion will not overflow. - decimalVal = System::Convert::ToDecimal( byteVal ); - System::Console::WriteLine( "The Byte as a decimal is {0}.", - decimalVal ); - - // Decimal to Byte conversion can overflow. - try - { - byteVal = System::Convert::ToByte( decimalVal ); - System::Console::WriteLine( "The Decimal as a Byte is {0}.", - byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The decimal value is too large for a Byte." ); - } - } - // - - // -public: - void ConvertByteSingle( Byte byteVal ) - { - float floatVal; - - // Byte to float conversion will not overflow. - floatVal = System::Convert::ToSingle( byteVal ); - System::Console::WriteLine( "The Byte as a float is {0}.", - floatVal ); - - // Float to Byte conversion can overflow. - try - { - byteVal = System::Convert::ToByte( floatVal ); - System::Console::WriteLine( "The float as a Byte is {0}.", - byteVal ); - } - catch ( System::OverflowException^ ) - { - System::Console::WriteLine( - "The float value is too large for a Byte." ); - } - } - // - - // -public: - void ConvertBoolean() - { - const int year = 1979; - const int month = 7; - const int day = 28; - const int hour = 13; - const int minute = 26; - const int second = 15; - const int millisecond = 53; - DateTime dateTime( year, month, day, hour, - minute, second, millisecond ); - bool boolVal; - - // System::InvalidCastException is always thrown. - try - { - boolVal = System::Convert::ToBoolean( dateTime ); - } - catch ( System::InvalidCastException^ ) - { - System::Console::WriteLine( "Conversion from DateTime to Boolean "+ - "is not supported by the .NET Framework." ); - } - } - // - - void ConvertDoubles( double doubleVal ) - { - ConvertDoubleBool( doubleVal ); - ConvertDoubleByte( doubleVal ); - ConvertDoubleInt( doubleVal ); - ConvertDoubleDecimal( doubleVal ); - CovertDoubleFloat( doubleVal ); - ConvertDoubleString( doubleVal ); - } - - void ConvertLongs( Int64 longVal ) - { - ConvertLongChar( longVal ); - ConvertLongByte( longVal ); - ConvertLongDecimal( longVal ); - ConvertLongFloat( longVal ); - } - - void ConvertStrings( String^ stringVal ) - { - ConvertStringBoolean( stringVal ); - ConvertStringByte( stringVal ); - ConvertStringChar( stringVal ); - ConvertStringDecimal( stringVal ); - ConvertStringFloat( stringVal ); - } - - void ConvertChars( Char charVal ) - { - ConvertCharDecimal( charVal ); - } - - void ConvertBytes( Byte byteVal ) - { - ConvertByteDecimal( byteVal ); - ConvertByteSingle( byteVal ); - } -}; - -int main() -{ - ConvertSnippet^ snippet = gcnew ConvertSnippet; - - double doubleVal; - System::Console::WriteLine( "Enter the double value: " ); - doubleVal = System::Convert::ToDouble( System::Console::ReadLine() ); - snippet->ConvertDoubles( doubleVal ); - - Int64 longVal; - System::Console::WriteLine( "Enter the Int64 value: " ); - longVal = System::Convert::ToInt64( System::Console::ReadLine() ); - snippet->ConvertLongs( longVal ); - - String^ stringVal; - System::Console::WriteLine( "Enter the String value: " ); - stringVal = System::Console::ReadLine(); - snippet->ConvertStrings( stringVal ); - - Char charVal; - System::Console::WriteLine( "Enter the char value: " ); - charVal = System::Convert::ToChar( System::Console::ReadLine() ); - snippet->ConvertChars( charVal ); - - Byte byteVal; - System::Console::WriteLine( "Enter the Byte value: " ); - byteVal = System::Convert::ToByte( System::Console::ReadLine() ); - snippet->ConvertBytes( byteVal ); - - snippet->ConvertBoolean(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp deleted file mode 100644 index 6ae7e65bdc1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// ToInt_Str_Int32.cpp : main project file. - -//#include "stdafx.h" - -using namespace System; - -int main(array ^args) -{ - // - // Create a hexadecimal value out of range of the integer type. - String^ value1 = Convert::ToString((static_cast<__int64>(int::MaxValue)) + 1, 16); - // Convert it back to a number. - try { - int number = Convert::ToInt32(value1, 16); - Console::WriteLine("0x{0} converts to {1}.", value1, number); - } - catch (OverflowException ^e) { - Console::WriteLine("Unable to convert '0x{0}' to an integer.", value1); - } - // The example displays the following output: - // 0x80000000 converts to -2147483648. - // - - // - __int64 sourceNumber2 = (static_cast<__int64>(int::MaxValue)) + 1; - bool isNegative = Math::Sign(sourceNumber2) == -1; - String^ value2 = Convert::ToString(sourceNumber2, 16); - int targetNumber; - try { - targetNumber = Convert::ToInt32(value2, 16); - if (!(isNegative) & (targetNumber & 0x80000000) != 0) - throw gcnew OverflowException(); - else - Console::WriteLine("0x{0} converts to {1}.", value2, targetNumber); - } - catch (OverflowException ^e) { - Console::WriteLine("Unable to convert '0x{0}' to an integer.", value2); - } - // The example displays the following output: - // Unable to convert '0x80000000' to an integer. - // - //Console::Write("Press any key..."); - //Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp deleted file mode 100644 index 7cff3673fb0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Convert.ToBoolean2.cpp : main project file. - -// -using namespace System; - -void main() -{ - array^ values = gcnew array { nullptr, String::Empty, - "true", "TrueString", - "False", " false ", - "-1", "0" }; - for each (String^ value in values) { - try - { - Console::WriteLine("Converted '{0}' to {1}.", value, - Convert::ToBoolean(value)); - } - catch (FormatException^ e) - { - Console::WriteLine("Unable to convert '{0}' to a Boolean.", value); - } - } -} -// The example displays the following output: -// Converted '' to False. -// Unable to convert '' to a Boolean. -// Converted 'true' to True. -// Unable to convert 'TrueString' to a Boolean. -// Converted 'False' to False. -// Converted ' false ' to False. -// Unable to convert '-1' to a Boolean. -// Unable to convert '0' to a Boolean. -// - - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp deleted file mode 100644 index ed404e69c09..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp +++ /dev/null @@ -1,303 +0,0 @@ -// Convert.ToBoolean.cpp : main project file. - -using namespace System; - -void ToByte() -{ - // - array^ bytes = gcnew array { Byte::MinValue, 100, 200, Byte::MaxValue }; - bool result; - - for each (Byte byteValue in bytes) - { - result = Convert::ToBoolean(byteValue); - Console::WriteLine("{0,-5} --> {1}", byteValue, result); - } - // The example displays the following output: - // 0 --> False - // 100 --> True - // 200 --> True - // 255 --> True - // -} - -void ToDecimal() -{ - // - array^ numbers = gcnew array { Decimal::MinValue, (Decimal) -12034.87, - (Decimal) -100, (Decimal) 0, (Decimal) 300, - (Decimal) 6790823.45, Decimal::MaxValue }; - bool result; - - for each (Decimal number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-30} --> {1}", number, result); - } - // The example displays the following output: - // -79228162514264337593543950335 --> True - // -12034.87 --> True - // -100 --> True - // 0 --> False - // 300 --> True - // 6790823.45 --> True - // 79228162514264337593543950335 --> True - // -} - -void ToInt16() -{ - // - array^ numbers = gcnew array { Int16::MinValue, -10000, -154, 0, 216, 21453, - Int16::MaxValue }; - bool result; - - for each (Int16 number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-7:N0} --> {1}", number, result); - } - // The example displays the following output: - // -32,768 --> True - // -10,000 --> True - // -154 --> True - // 0 --> False - // 216 --> True - // 21,453 --> True - // 32,767 --> True - // -} - -void ToInt32() -{ - // - array^ numbers = gcnew array { Int32::MinValue, -201649, -68, 0, 612, 4038907, - Int32::MaxValue }; - bool result; - - for each (int number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-15:N0} --> {1}", number, result); - } - // The example displays the following output: - // -2,147,483,648 --> True - // -201,649 --> True - // -68 --> True - // 0 --> False - // 612 --> True - // 4,038,907 --> True - // 2,147,483,647 --> True - // -} - -void ToInt64() -{ - // - array^ numbers = gcnew array { Int64::MinValue, -2016493, -689, 0, 6121, - 403890774, Int64::MaxValue }; - bool result; - - for each (Int64 number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-26:N0} --> {1}", number, result); - } - // The example displays the following output: - // -9,223,372,036,854,775,808 --> True - // -2,016,493 --> True - // -689 --> True - // 0 --> False - // 6,121 --> True - // 403,890,774 --> True - // 9,223,372,036,854,775,807 --> True - // -} - -void ToObject() -{ - // - array^ objects = gcnew array { 16.33, -24, 0, "12", "12.7", String::Empty, - "1String", "True", "false", nullptr, - gcnew System::Collections::ArrayList }; - - for each (Object^ obj in objects) - { - Console::Write("{0,-40} --> ", - obj == nullptr ? "null" : - String::Format("{0} ({1})", obj, obj->GetType()->Name)); - try { - Console::WriteLine("{0}", Convert::ToBoolean((Object^) obj)); - } - catch (FormatException^) { - Console::WriteLine("Bad Format"); - } - catch (InvalidCastException^) { - Console::WriteLine("No Conversion"); - } - } - // The example displays the following output: - // 16.33 (Double) --> True - // -24 (Int32) --> True - // 0 (Int32) --> False - // 12 (String) --> Bad Format - // 12.7 (String) --> Bad Format - // (String) --> Bad Format - // 1String (String) --> Bad Format - // True (String) --> True - // false (String) --> False - // null --> False - // System.Collections.ArrayList (ArrayList) --> No Conversion - // -} - -void ToSByte() -{ - // - array^ numbers = gcnew array { SByte::MinValue, -1, 0, 10, 100, SByte::MaxValue }; - bool result; - - for each (SByte number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-5} --> {1}", number, result); - } - // The example displays the following output: - // -128 --> True - // -1 --> True - // 0 --> False - // 10 --> True - // 100 --> True - // 127 --> True - // -} - -void ToSingle() -{ - // - array^ numbers = gcnew array { Single::MinValue, (float) -193.0012, (float) 20e-15f, 0, - (float) 10551e-10, (float) 100.3398, Single::MaxValue }; - bool result; - - for each (float number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-15} --> {1}", number, result); - } - // The example displays the following output: - // -3.402823E+38 --> True - // -193.0012 --> True - // 2E-14 --> True - // 0 --> False - // 1.0551E-06 --> True - // 100.3398 --> True - // 3.402823E+38 --> True - // -} - -void ToUInt16() -{ - // - array^ numbers = gcnew array { UInt16::MinValue, 216, 21453, UInt16::MaxValue }; - bool result; - - for each (unsigned short number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-7:N0} --> {1}", number, result); - } - // The example displays the following output: - // 0 --> False - // 216 --> True - // 21,453 --> True - // 65,535 --> True - // -} - -void ToUInt32() -{ - // - array^ numbers = gcnew array { UInt32::MinValue, 612, 4038907, Int32::MaxValue }; - bool result; - - for each (unsigned int number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-15:N0} --> {1}", number, result); - } - // The example displays the following output: - // 0 --> False - // 612 --> True - // 4,038,907 --> True - // 2,147,483,647 --> True - // -} - -void ToUInt64() -{ - // - array^ numbers = gcnew array { UInt64::MinValue, 6121, 403890774, UInt64::MaxValue }; - bool result; - - for each (UInt64 number in numbers) - { - result = Convert::ToBoolean(number); - Console::WriteLine("{0,-26:N0} --> {1}", number, result); - } - // The example displays the following output: - // 0 --> False - // 6,121 --> True - // 403,890,774 --> True - // 18,446,744,073,709,551,615 --> True - // -} - -void main() -{ - Console::WriteLine("ToByte:"); - ToByte(); - Console::WriteLine(); - - Console::WriteLine("ToDecimal:"); - ToDecimal(); - Console::WriteLine(); - - Console::WriteLine("ToInt16:"); - ToInt16(); - Console::WriteLine(); - - Console::WriteLine("ToInt32:"); - ToInt32(); - Console::WriteLine(); - - Console::WriteLine("ToInt64:"); - ToInt64(); - Console::WriteLine(); - - Console::WriteLine("ToObject:"); - ToObject(); - Console::WriteLine(); - - Console::WriteLine("ToSByte:"); - ToSByte(); - Console::WriteLine(); - - Console::WriteLine("ToSingle:"); - ToSingle(); - Console::WriteLine(); - - Console::WriteLine("ToUInt16:"); - ToUInt16(); - Console::WriteLine(); - - Console::WriteLine("ToUInt32:"); - ToUInt32(); - Console::WriteLine(); - - Console::WriteLine("ToUInt64:"); - ToUInt64(); - Console::WriteLine(); - - Console::ReadLine(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp deleted file mode 100644 index 868a76dd151..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -ref class DummyProvider: public IFormatProvider -{ -public: - - // Normally, GetFormat returns an object of the requested type - // (usually itself) if it is able; otherwise, it returns Nothing. - virtual Object^ GetFormat( Type^ argType ) - { - // Here, GetFormat displays the name of argType, after removing - // the namespace information. GetFormat always returns null. - String^ argStr = argType->ToString(); - if ( argStr->Equals( "" ) ) - argStr = "Empty"; - - argStr = argStr->Substring( argStr->LastIndexOf( '.' ) + 1 ); - Console::Write( "{0,-20}", argStr ); - return (Object^)0; - } -}; - -int main() -{ - // Create an instance of IFormatProvider. - DummyProvider^ provider = gcnew DummyProvider; - String^ format = "{0,-17}{1,-17}{2}"; - - // Convert these values using DummyProvider. - String^ Int32A = "-252645135"; - String^ DoubleA = "61680.3855"; - String^ DayTimeA = "2001/9/11 13:45"; - String^ BoolA = "True"; - String^ StringA = "Qwerty"; - String^ CharA = "$"; - Console::WriteLine( "This example of selected " - "Convert::To( String*, IFormatProvider* ) \nmethods " - "generates the following output. The example displays the " - "\nprovider type if the IFormatProvider is called." ); - Console::WriteLine( "\nNote: For the " - "ToBoolean, ToString, and ToChar methods, the \n" - "IFormatProvider object is not referenced." ); - - // The format provider is called for the following conversions. - Console::WriteLine(); - Console::WriteLine( format, "ToInt32", Int32A, Convert::ToInt32( Int32A, provider ) ); - Console::WriteLine( format, "ToDouble", DoubleA, Convert::ToDouble( DoubleA, provider ) ); - Console::WriteLine( format, "ToDateTime", DayTimeA, Convert::ToDateTime( DayTimeA, provider ) ); - - // The format provider is not called for these conversions. - Console::WriteLine(); - Console::WriteLine( format, "ToBoolean", BoolA, Convert::ToBoolean( BoolA, provider ) ); - Console::WriteLine( format, "ToString", StringA, Convert::ToString( StringA, provider ) ); - Console::WriteLine( format, "ToChar", CharA, Convert::ToChar( CharA, provider ) ); -} - -/* -This example of selected Convert::To( String*, IFormatProvider* ) -methods generates the following output. The example displays the -provider type if the IFormatProvider is called. - -Note: For the ToBoolean, ToString, and ToChar methods, the -IFormatProvider object is not referenced. - -NumberFormatInfo ToInt32 -252645135 -252645135 -NumberFormatInfo ToDouble 61680.3855 61680.3855 -DateTimeFormatInfo ToDateTime 2001/9/11 13:45 9/11/2001 1:45:00 PM - -ToBoolean True True -ToString Qwerty Qwerty -ToChar $ $ -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp deleted file mode 100644 index feecf23e2a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp +++ /dev/null @@ -1,105 +0,0 @@ - -// -// Example of the Convert::ToInt16( String* ) and -// Convert::ToInt16( String*, IFormatProvider* ) methods. -using namespace System; -using namespace System::Globalization; -const __wchar_t * protoFmt = L"{0,-20}{1,-20}{2}"; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - -void ConvertToInt16( String^ numericStr, IFormatProvider^ provider ) -{ - Object^ defaultValue; - Object^ providerValue; - - // Convert numericStr to Int16 without a format provider. - try - { - defaultValue = Convert::ToInt16( numericStr ); - } - catch ( Exception^ ex ) - { - defaultValue = GetExceptionType( ex ); - } - - - // Convert numericStr to Int16 with a format provider. - try - { - providerValue = Convert::ToInt16( numericStr, provider ); - } - catch ( Exception^ ex ) - { - providerValue = GetExceptionType( ex ); - } - - Console::WriteLine( gcnew String( protoFmt ), numericStr, defaultValue, providerValue ); -} - -int main() -{ - - // Create a NumberFormatInfo object and set several of its - // properties that apply to numbers. - NumberFormatInfo^ provider = gcnew NumberFormatInfo; - - // These properties affect the conversion. - provider->NegativeSign = "neg "; - provider->PositiveSign = "pos "; - - // These properties do not affect the conversion. - // The input string cannot have decimal and group separators. - provider->NumberDecimalSeparator = "."; - provider->NumberGroupSeparator = ","; - array^sizes = {3}; - provider->NumberGroupSizes = sizes; - provider->NumberNegativePattern = 0; - Console::WriteLine( "This example of\n" - " Convert::ToInt16( String* ) and \n" - " Convert::ToInt16( String*, IFormatProvider* ) " - "\ngenerates the following output. It converts " - "several strings to \nshort values, using " - "default formatting or a NumberFormatInfo object.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "String to convert", "Default/exception", "Provider/exception" ); - Console::WriteLine( gcnew String( protoFmt ), "-----------------", "-----------------", "------------------" ); - - // Convert strings, with and without an IFormatProvider. - ConvertToInt16( "12345", provider ); - ConvertToInt16( "+12345", provider ); - ConvertToInt16( "pos 12345", provider ); - ConvertToInt16( "-12345", provider ); - ConvertToInt16( "neg 12345", provider ); - ConvertToInt16( "12345.", provider ); - ConvertToInt16( "12,345", provider ); - ConvertToInt16( "(12345)", provider ); - ConvertToInt16( "32768", provider ); - ConvertToInt16( "-32769", provider ); -} - -/* -This example of - Convert::ToInt16( String* ) and - Convert::ToInt16( String*, IFormatProvider* ) -generates the following output. It converts several strings to -short values, using default formatting or a NumberFormatInfo object. - -String to convert Default/exception Provider/exception ------------------ ----------------- ------------------ -12345 12345 12345 -+12345 12345 FormatException -pos 12345 FormatException 12345 --12345 -12345 FormatException -neg 12345 FormatException -12345 -12345. FormatException FormatException -12,345 FormatException FormatException -(12345) FormatException FormatException -32768 OverflowException OverflowException --32769 OverflowException FormatException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp deleted file mode 100644 index 3336b2aa23d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp +++ /dev/null @@ -1,100 +0,0 @@ - -// -// Example of the Convert::ToSByte( String* ) and -// Convert::ToSByte( String*, IFormatProvider* ) methods. -using namespace System; -using namespace System::Globalization; -const __wchar_t * protoFmt = L"{0,-20}{1,-20}{2}"; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - -void ConvertToSByte( String^ numericStr, IFormatProvider^ provider ) -{ - Object^ defaultValue; - Object^ providerValue; - - // Convert numericStr to SByte without a format provider. - try - { - defaultValue = Convert::ToSByte( numericStr ); - } - catch ( Exception^ ex ) - { - defaultValue = GetExceptionType( ex ); - } - - - // Convert numericStr to SByte with a format provider. - try - { - providerValue = Convert::ToSByte( numericStr, provider ); - } - catch ( Exception^ ex ) - { - providerValue = GetExceptionType( ex ); - } - - Console::WriteLine( gcnew String( protoFmt ), numericStr, defaultValue, providerValue ); -} - -int main() -{ - - // Create a NumberFormatInfo object and set several of its - // properties that apply to numbers. - NumberFormatInfo^ provider = gcnew NumberFormatInfo; - - // These properties affect the conversion. - provider->NegativeSign = "neg "; - provider->PositiveSign = "pos "; - - // These properties do not affect the conversion. - // The input string cannot have decimal and group separators. - provider->NumberDecimalSeparator = "."; - provider->NumberNegativePattern = 0; - Console::WriteLine( "This example of\n" - " Convert::ToSByte( String* ) and \n" - " Convert::ToSByte( String*, IFormatProvider* ) " - "\ngenerates the following output. It converts " - "several strings to \nSByte values, using " - "default formatting or a NumberFormatInfo object.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "String to convert", "Default/exception", "Provider/exception" ); - Console::WriteLine( gcnew String( protoFmt ), "-----------------", "-----------------", "------------------" ); - - // Convert strings, with and without an IFormatProvider. - ConvertToSByte( "123", provider ); - ConvertToSByte( "+123", provider ); - ConvertToSByte( "pos 123", provider ); - ConvertToSByte( "-123", provider ); - ConvertToSByte( "neg 123", provider ); - ConvertToSByte( "123.", provider ); - ConvertToSByte( "(123)", provider ); - ConvertToSByte( "128", provider ); - ConvertToSByte( "-129", provider ); -} - -/* -This example of - Convert::ToSByte( String* ) and - Convert::ToSByte( String*, IFormatProvider* ) -generates the following output. It converts several strings to -SByte values, using default formatting or a NumberFormatInfo object. - -String to convert Default/exception Provider/exception ------------------ ----------------- ------------------ -123 123 123 -+123 123 FormatException -pos 123 FormatException 123 --123 -123 FormatException -neg 123 FormatException -123 -123. FormatException FormatException -(123) FormatException FormatException -128 OverflowException OverflowException --129 OverflowException FormatException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp deleted file mode 100644 index 819130067f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// -// Example of Convert::ToString( non-numeric types, IFormatProvider ). -using namespace System; -using namespace System::Globalization; - -#define null (Object^)0 - -// An instance of this class can be passed to methods that require -// an IFormatProvider. -ref class DummyProvider: public IFormatProvider -{ -public: - - // Normally, GetFormat returns an object of the requested type - // (usually itself) if it is able; otherwise, it returns Nothing. - virtual Object^ GetFormat( Type^ argType ) - { - // Here, the type of argType is displayed, and GetFormat - // always returns Nothing. - Console::Write( "{0,-40}", argType->ToString() ); - return null; - } -}; - -int main() -{ - // Create an instance of the IFormatProvider. - DummyProvider^ provider = gcnew DummyProvider; - String^ converted; - - // Convert these values using DummyProvider. - int Int32A = -252645135; - double DoubleA = 61680.3855; - Object^ ObjDouble = -98765.4321; - DateTime DayTimeA = DateTime(2001,9,11,13,45,0); - bool BoolA = true; - String^ StringA = "Qwerty"; - Char CharA = '$'; - TimeSpan TSpanA = TimeSpan(0,18,0); - Object^ ObjOther = static_cast(provider); - Console::WriteLine( "This example of " - "Convert::ToString( non-numeric, IFormatProvider* ) \n" - "generates the following output. The provider type, " - "argument type, \nand argument value are displayed." ); - Console::WriteLine( "\nNote: The IFormatProvider object is " - "not called for Boolean, String, \nChar, TimeSpan, " - "and non-numeric Object." ); - - // The format provider is called for these conversions. - Console::WriteLine(); - converted = Convert::ToString( Int32A, provider ); - Console::WriteLine( "int {0}", converted ); - converted = Convert::ToString( DoubleA, provider ); - Console::WriteLine( "double {0}", converted ); - converted = Convert::ToString( ObjDouble, provider ); - Console::WriteLine( "Object {0}", converted ); - converted = Convert::ToString( DayTimeA, provider ); - Console::WriteLine( "DateTime {0}", converted ); - - // The format provider is not called for these conversions. - Console::WriteLine(); - converted = Convert::ToString( BoolA, provider ); - Console::WriteLine( "bool {0}", converted ); - converted = Convert::ToString( StringA, provider ); - Console::WriteLine( "String {0}", converted ); - converted = Convert::ToString( CharA, provider ); - Console::WriteLine( "Char {0}", converted ); - converted = Convert::ToString( TSpanA, provider ); - Console::WriteLine( "TimeSpan {0}", converted ); - converted = Convert::ToString( ObjOther, provider ); - Console::WriteLine( "Object {0}", converted ); -} - -/* -This example of Convert::ToString( non-numeric, IFormatProvider* ) -generates the following output. The provider type, argument type, -and argument value are displayed. - -Note: The IFormatProvider object is not called for Boolean, String, -Char, TimeSpan, and non-numeric Object. - -System.Globalization.NumberFormatInfo int -252645135 -System.Globalization.NumberFormatInfo double 61680.3855 -System.Globalization.NumberFormatInfo Object -98765.4321 -System.Globalization.DateTimeFormatInfo DateTime 9/11/2001 1:45:00 PM - -bool True -String Qwerty -Char $ -TimeSpan 00:18:00 -Object DummyProvider -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp deleted file mode 100644 index 2e233191f16..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp +++ /dev/null @@ -1,458 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; - -// Define the types of averaging available in the class -// implementing IConvertible. -public enum class AverageType : short -{ - None = 0, - GeometricMean = 1, - ArithmeticMean = 2, - Median = 3 -}; - - -// Pass an instance of this class to methods that require an -// IFormatProvider. The class instance determines the type of -// average to calculate. -ref class AverageInfo: public IFormatProvider -{ -protected: - AverageType AvgType; - -public: - - // Specify the type of averaging in the constructor. - AverageInfo( AverageType avgType ) - { - this->AvgType = avgType; - } - - - // This method returns a reference to the containing object - // if an object of AverageInfo type is requested. - virtual Object^ GetFormat( Type^ argType ) - { - if ( argType == AverageInfo::typeid) - return this; - else - return (Object^)0; - } - - - property AverageType TypeOfAverage - { - - // Use this property to set or get the type of averaging. - AverageType get() - { - return this->AvgType; - } - - void set( AverageType value ) - { - this->AvgType = value; - } - - } - -}; - - -// This class encapsulates an array of double values and implements -// the IConvertible interface. Most of the IConvertible methods -// return an average of the array elements in one of three types: -// arithmetic mean, geometric mean, or median. -ref class DataSet: public IConvertible -{ -private: - static Object^ null = nullptr; - -protected: - ArrayList^ data; - AverageInfo^ defaultProvider; - - // This method unboxes a boxed double. - double UnBoxDouble( Object^ obj ) - { - return *static_cast(obj); - } - - -public: - - // Construct the object and add an initial list of values. - // Create a default format provider. - DataSet( ... array^values ) - { - data = gcnew ArrayList( (Array^)values ); - defaultProvider = gcnew AverageInfo( AverageType::ArithmeticMean ); - } - - - // Add additional values with this method. - int Add( double value ) - { - data->Add( value ); - return data->Count; - } - - - property double Item[ int ] - { - - // Get, set, and add values with this indexer property. - double get( int index ) - { - if ( index >= 0 && index < data->Count ) - return UnBoxDouble( data[ index ] ); - else - throw gcnew InvalidOperationException( "[DataSet.get] Index out of range." ); - } - - void set( int index, double value ) - { - if ( index >= 0 && index < data->Count ) - data[ index ] = value; - else - if ( index == data->Count ) - data->Add( value ); - else - throw gcnew InvalidOperationException( "[DataSet.set] Index out of range." ); - } - - } - - property int Count - { - - // This property returns the number of elements in the object. - int get() - { - return data->Count; - } - - } - -protected: - - // This method calculates the average of the object's elements. - double Average( AverageType avgType ) - { - double SumProd; - if ( data->Count == 0 ) - return 0.0; - - switch ( avgType ) - { - case AverageType::GeometricMean: - SumProd = 1.0; - for ( int Index = 0; Index < data->Count; Index++ ) - SumProd *= UnBoxDouble( data[ Index ] ); - - // This calculation will not fail with negative - // elements. - return Math::Sign( SumProd ) * Math::Pow( Math::Abs( SumProd ), 1.0 / data->Count ); - - case AverageType::ArithmeticMean: - SumProd = 0.0; - for ( int Index = 0; Index < data->Count; Index++ ) - SumProd += UnBoxDouble( data[ Index ] ); - return SumProd / data->Count; - - case AverageType::Median: - if ( data->Count % 2 == 0 ) - return (UnBoxDouble( data[ data->Count / 2 ] ) + UnBoxDouble( data[ data->Count / 2 - 1 ] )) / 2.0; - else - return UnBoxDouble( data[ data->Count / 2 ] ); - - default: - return 0.0; - } - } - - - // Get the AverageInfo object from the caller's format provider, - // or use the local default. - AverageInfo^ GetAverageInfo( IFormatProvider^ provider ) - { - AverageInfo^ avgInfo = nullptr; - if ( provider != nullptr ) - avgInfo = static_cast(provider->GetFormat( AverageInfo::typeid )); - - if ( avgInfo == nullptr ) - return defaultProvider; - else - return avgInfo; - } - - - // Calculate the average and limit the range. - double CalcNLimitAverage( double min, double max, IFormatProvider^ provider ) - { - - // Get the format provider and calculate the average. - AverageInfo^ avgInfo = GetAverageInfo( provider ); - double avg = Average( avgInfo->TypeOfAverage ); - - // Limit the range, based on the minimum and maximum values - // for the type. - return avg > max ? max : avg < min ? min : avg; - } - - -public: - - // The following elements are required by IConvertible. - // None of these conversion functions throw exceptions. When - // the data is out of range for the type, the appropriate - // MinValue or MaxValue is used. - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean( IFormatProvider^ provider ) - { - - // ToBoolean is false if the dataset is empty. - if ( data->Count <= 0 ) - return false; - // For median averaging, ToBoolean is true if any - // non-discarded elements are nonzero. - else - - // For median averaging, ToBoolean is true if any - // non-discarded elements are nonzero. - if ( AverageType::Median == GetAverageInfo( provider )->TypeOfAverage ) - { - if ( data->Count % 2 == 0 ) - return (UnBoxDouble( data[ data->Count / 2 ] ) != 0.0 || UnBoxDouble( data[ data->Count / 2 - 1 ] ) != 0.0); - else - return UnBoxDouble( data[ data->Count / 2 ] ) != 0.0; - } - // For arithmetic or geometric mean averaging, ToBoolean is - // true if any element of the dataset is nonzero. - else - { - for ( int Index = 0; Index < data->Count; Index++ ) - if ( UnBoxDouble( data[ Index ] ) != 0.0 ) - return true; - return false; - } - } - - virtual Byte ToByte( IFormatProvider^ provider ) - { - return Convert::ToByte( CalcNLimitAverage( Byte::MinValue, Byte::MaxValue, provider ) ); - } - - virtual Char ToChar( IFormatProvider^ provider ) - { - return Convert::ToChar( Convert::ToUInt16( CalcNLimitAverage( Char::MinValue, Char::MaxValue, provider ) ) ); - } - - - // Convert to DateTime by adding the calculated average as - // seconds to the current date and time. A valid DateTime is - // always returned. - virtual DateTime ToDateTime( IFormatProvider^ provider ) - { - double seconds = Average( GetAverageInfo( provider )->TypeOfAverage ); - try - { - return DateTime::Now.AddSeconds( seconds ); - } - catch ( ArgumentOutOfRangeException^ ) - { - return seconds < 0.0 ? DateTime::MinValue : DateTime::MaxValue; - } - - } - - virtual Decimal ToDecimal( IFormatProvider^ provider ) - { - - // The Double conversion rounds Decimal.MinValue and - // Decimal.MaxValue to invalid Decimal values, so the - // following limits must be used. - return Convert::ToDecimal( CalcNLimitAverage( -79228162514264330000000000000.0, 79228162514264330000000000000.0, provider ) ); - } - - virtual double ToDouble( IFormatProvider^ provider ) - { - return Average( GetAverageInfo( provider )->TypeOfAverage ); - } - - virtual short ToInt16( IFormatProvider^ provider ) - { - return Convert::ToInt16( CalcNLimitAverage( Int16::MinValue, Int16::MaxValue, provider ) ); - } - - virtual int ToInt32( IFormatProvider^ provider ) - { - return Convert::ToInt32( CalcNLimitAverage( Int32::MinValue, Int32::MaxValue, provider ) ); - } - - virtual __int64 ToInt64( IFormatProvider^ provider ) - { - - // The Double conversion rounds Int64.MinValue and - // Int64.MaxValue to invalid Int64 values, so the following - // limits must be used. - return Convert::ToInt64( CalcNLimitAverage( -9223372036854775000, 9223372036854775000, provider ) ); - } - - virtual signed char ToSByte( IFormatProvider^ provider ) - { - return Convert::ToSByte( CalcNLimitAverage( SByte::MinValue, SByte::MaxValue, provider ) ); - } - - virtual float ToSingle( IFormatProvider^ provider ) - { - return Convert::ToSingle( CalcNLimitAverage( Single::MinValue, Single::MaxValue, provider ) ); - } - - virtual UInt16 ToUInt16( IFormatProvider^ provider ) - { - return Convert::ToUInt16( CalcNLimitAverage( UInt16::MinValue, UInt16::MaxValue, provider ) ); - } - - virtual UInt32 ToUInt32( IFormatProvider^ provider ) - { - return Convert::ToUInt32( CalcNLimitAverage( UInt32::MinValue, UInt32::MaxValue, provider ) ); - } - - virtual UInt64 ToUInt64( IFormatProvider^ provider ) - { - - // The Double conversion rounds UInt64.MaxValue to an invalid - // UInt64 value, so the following limit must be used. - return Convert::ToUInt64( CalcNLimitAverage( 0, 18446744073709550000.0, provider ) ); - } - - virtual Object^ ToType( Type^ conversionType, IFormatProvider^ provider ) - { - return Convert::ChangeType( Average( GetAverageInfo( provider )->TypeOfAverage ), conversionType ); - } - - virtual String^ ToString( IFormatProvider^ provider ) - { - AverageType avgType = GetAverageInfo( provider )->TypeOfAverage; - return String::Format( "( {0}: {1:G10} )", avgType, Average( avgType ) ); - } - -}; - - -// Display a DataSet with three different format providers. -void DisplayDataSet( DataSet^ ds ) -{ - IFormatProvider^ null = nullptr; - String^ fmt = "{0,-12}{1,20}{2,20}{3,20}"; - AverageInfo^ median = gcnew AverageInfo( AverageType::Median ); - AverageInfo^ geMean = gcnew AverageInfo( AverageType::GeometricMean ); - - // Display the dataset elements. - if ( ds->Count > 0 ) - { - Console::Write( "\nDataSet: [{0}", ds->Item[ 0 ] ); - for ( int iX = 1; iX < ds->Count; iX++ ) - Console::Write( ", {0}", ds->Item[ iX ] ); - Console::WriteLine( "]\n" ); - } - - Console::WriteLine( fmt, "Convert::", "Default", "Geometric Mean", "Median" ); - Console::WriteLine( fmt, "---------", "-------", "--------------", "------" ); - Console::WriteLine( fmt, "ToBoolean", Convert::ToBoolean( ds, null ), Convert::ToBoolean( ds, geMean ), Convert::ToBoolean( ds, median ) ); - Console::WriteLine( fmt, "ToByte", Convert::ToByte( ds, null ), Convert::ToByte( ds, geMean ), Convert::ToByte( ds, median ) ); - Console::WriteLine( fmt, "ToChar", Convert::ToChar( ds, null ), Convert::ToChar( ds, geMean ), Convert::ToChar( ds, median ) ); - Console::WriteLine( "{0,-12}{1,20:yyyy-MM-dd HH:mm:ss}" - "{2,20:yyyy-MM-dd HH:mm:ss}{3,20:yyyy-MM-dd HH:mm:ss}", "ToDateTime", Convert::ToDateTime( ds, null ), Convert::ToDateTime( ds, geMean ), Convert::ToDateTime( ds, median ) ); - Console::WriteLine( fmt, "ToDecimal", Convert::ToDecimal( ds, null ), Convert::ToDecimal( ds, geMean ), Convert::ToDecimal( ds, median ) ); - Console::WriteLine( fmt, "ToDouble", Convert::ToDouble( ds, null ), Convert::ToDouble( ds, geMean ), Convert::ToDouble( ds, median ) ); - Console::WriteLine( fmt, "ToInt16", Convert::ToInt16( ds, null ), Convert::ToInt16( ds, geMean ), Convert::ToInt16( ds, median ) ); - Console::WriteLine( fmt, "ToInt32", Convert::ToInt32( ds, null ), Convert::ToInt32( ds, geMean ), Convert::ToInt32( ds, median ) ); - Console::WriteLine( fmt, "ToInt64", Convert::ToInt64( ds, null ), Convert::ToInt64( ds, geMean ), Convert::ToInt64( ds, median ) ); - Console::WriteLine( fmt, "ToSByte", Convert::ToSByte( ds, null ), Convert::ToSByte( ds, geMean ), Convert::ToSByte( ds, median ) ); - Console::WriteLine( fmt, "ToSingle", Convert::ToSingle( ds, null ), Convert::ToSingle( ds, geMean ), Convert::ToSingle( ds, median ) ); - Console::WriteLine( fmt, "ToUInt16", Convert::ToUInt16( ds, null ), Convert::ToUInt16( ds, geMean ), Convert::ToUInt16( ds, median ) ); - Console::WriteLine( fmt, "ToUInt32", Convert::ToUInt32( ds, null ), Convert::ToUInt32( ds, geMean ), Convert::ToUInt32( ds, median ) ); - Console::WriteLine( fmt, "ToUInt64", Convert::ToUInt64( ds, null ), Convert::ToUInt64( ds, geMean ), Convert::ToUInt64( ds, median ) ); -} - -int main() -{ - Console::WriteLine( "This example of the " - "Convert::To( Object*, IFormatProvider* ) methods " - "\ngenerates the following output. The example " - "displays the values \nreturned by the methods, " - "using several IFormatProvider objects.\n" ); - - // To call a [ParamArray] method in C++, you cannot just - // list the parameters, you need to build an array. - array^dataElem = gcnew array(6); - dataElem[ 0 ] = 10.5; - dataElem[ 1 ] = 22.2; - dataElem[ 2 ] = 45.9; - dataElem[ 3 ] = 88.7; - dataElem[ 4 ] = 156.05; - dataElem[ 5 ] = 297.6; - DataSet^ ds1 = gcnew DataSet( dataElem ); - DisplayDataSet( ds1 ); - dataElem = gcnew array(5); - dataElem[ 0 ] = 359999.95; - dataElem[ 1 ] = 425000; - dataElem[ 2 ] = 499999.5; - dataElem[ 3 ] = 775000; - dataElem[ 4 ] = 1695000; - DataSet^ ds2 = gcnew DataSet( dataElem ); - DisplayDataSet( ds2 ); -} - -/* -This example of the Convert::To( Object*, IFormatProvider* ) methods -generates the following output. The example displays the values -returned by the methods, using several IFormatProvider objects. - -DataSet: [10.5, 22.2, 45.9, 88.7, 156.05, 297.6] - -Convert:: Default Geometric Mean Median ---------- ------- -------------- ------ -ToBoolean True True True -ToByte 103 59 67 -ToChar g ; C -ToDateTime 2003-05-13 15:30:23 2003-05-13 15:29:39 2003-05-13 15:29:47 -ToDecimal 103.491666666667 59.4332135445164 67.3 -ToDouble 103.491666666667 59.4332135445164 67.3 -ToInt16 103 59 67 -ToInt32 103 59 67 -ToInt64 103 59 67 -ToSByte 103 59 67 -ToSingle 103.4917 59.43321 67.3 -ToUInt16 103 59 67 -ToUInt32 103 59 67 -ToUInt64 103 59 67 - -DataSet: [359999.95, 425000, 499999.5, 775000, 1695000] - -Convert:: Default Geometric Mean Median ---------- ------- -------------- ------ -ToBoolean True True True -ToByte 255 255 255 -ToChar ? ? ? -ToDateTime 2003-05-22 08:05:19 2003-05-20 22:54:57 2003-05-19 10:21:59 -ToDecimal 750999.89 631577.237188435 499999.5 -ToDouble 750999.89 631577.237188435 499999.5 -ToInt16 32767 32767 32767 -ToInt32 751000 631577 500000 -ToInt64 751000 631577 500000 -ToSByte 127 127 127 -ToSingle 750999.9 631577.3 499999.5 -ToUInt16 65535 65535 65535 -ToUInt32 751000 631577 500000 -ToUInt64 751000 631577 500000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp deleted file mode 100644 index caf5fe1bc43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; - -void main() -{ - DateTime^ date1 = gcnew DateTime(2008, 6, 1, 7, 47, 0); - Console::WriteLine(date1->ToString()); - - // Get date-only portion of date, without its time. - DateTime dateOnly = date1->Date; - // Display date using short date string. - Console::WriteLine(dateOnly.ToString("d")); - // Display date using 24-hour clock. - Console::WriteLine(dateOnly.ToString("g")); - Console::WriteLine(dateOnly.ToString(L"MM/dd/yyyy HH:mm")); -} -// The example displays the following output to the console: -// 6/1/2008 7:47:00 AM -// 6/1/2008 -// 6/1/2008 12:00 AM -// 06/01/2008 00:00 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp deleted file mode 100644 index 1c991227a37..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp +++ /dev/null @@ -1,31 +0,0 @@ -using namespace System; - -int main() -{ - // - System::DateTime moment = System::DateTime( - 1999, 1, 13, 3, 57, 32, 11 ); - - // Year gets 1999. - int year = moment.Year; - - // Month gets 1 (January). - int month = moment.Month; - - // Day gets 13. - int day = moment.Day; - - // Hour gets 3. - int hour = moment.Hour; - - // Minute gets 57. - int minute = moment.Minute; - - // Second gets 32. - int second = moment.Second; - - // Millisecond gets 11. - int millisecond = moment.Millisecond; - - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp deleted file mode 100644 index 26954f5c7f6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// DateTime.TryParse1.cpp : Defines the entry point for the console application. -// - -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - array^ dateStrings = { "05/01/2009 14:57:32.8", "2009-05-01 14:57:32.8", - "2009-05-01T14:57:32.8375298-04:00", - "5/01/2008 14:57:32.80 -07:00", - "1 May 2008 2:57:32.8 PM", "16-05-2009 1:00:32 PM", - "Fri, 15 May 2009 20:10:57 GMT" }; - DateTime dateValue; - - Console::WriteLine("Attempting to parse strings using {0} culture.", - CultureInfo::CurrentCulture->Name); - for each (String^ dateString in dateStrings) - { - if (DateTime::TryParse(dateString, dateValue)) - Console::WriteLine(" Converted '{0}' to {1} ({2}).", dateString, - dateValue, dateValue.Kind); - else - Console::WriteLine(" Unable to parse '{0}'.", dateString); - } -} -// The example displays the following output: -// Attempting to parse strings using en-US culture. -// Converted '05/01/2009 14:57:32.8' to 5/1/2009 2:57:32 PM (Unspecified). -// Converted '2009-05-01 14:57:32.8' to 5/1/2009 2:57:32 PM (Unspecified). -// Converted '2009-05-01T14:57:32.8375298-04:00' to 5/1/2009 11:57:32 AM (Local). -// Converted '5/01/2008 14:57:32.80 -07:00' to 5/1/2008 2:57:32 PM (Local). -// Converted '1 May 2008 2:57:32.8 PM' to 5/1/2008 2:57:32 PM (Unspecified). -// Unable to parse '16-05-2009 1:00:32 PM'. -// Converted 'Fri, 15 May 2009 20:10:57 GMT' to 5/15/2009 1:10:57 PM (Local). -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp deleted file mode 100644 index 224dd1602e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -// Example of the Decimal::Compare and static Decimal::Equals methods. -using namespace System; -const __wchar_t * protoFmt = L"{0,-45}{1}"; - -// Compare Decimal parameters, and display them with the results. -void CompareDecimals( Decimal Left, Decimal Right, String^ RightText ) -{ - String^ dataFmt = gcnew String( protoFmt ); - Console::WriteLine(); - Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); - Console::WriteLine( dataFmt, "Decimal::Equals( Left, Right )", Decimal::Equals( Left, Right ) ); - Console::WriteLine( dataFmt, "Decimal::Compare( Left, Right )", Decimal::Compare( Left, Right ) ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal::Equals( Decimal, Decimal " - ") and \nDecimal::Compare( Decimal, Decimal ) " - "methods generates the \nfollowing output. It creates " - "several different Decimal \nvalues and compares them " - "with the following reference value.\n" ); - - // Create a reference Decimal value. - Decimal Left = Decimal(123.456); - Console::WriteLine( gcnew String( protoFmt ), "Left: Decimal( 123.456 )", Left ); - - // Create Decimal values to compare with the reference. - CompareDecimals( Left, Decimal(1.2345600E+2), "Decimal( 1.2345600E+2 )" ); - CompareDecimals( Left, Decimal::Parse( "123.4561" ), "Decimal::Parse( \"123.4561\" )" ); - CompareDecimals( Left, Decimal::Parse( "123.4559" ), "Decimal::Parse( \"123.4559\" )" ); - CompareDecimals( Left, Decimal::Parse( "123.456000" ), "Decimal::Parse( \"123.456000\" )" ); - CompareDecimals( Left, Decimal(123456000,0,0,false,6), "Decimal( 123456000, 0, 0, false, 6 )" ); -} - -/* -This example of the Decimal::Equals( Decimal, Decimal ) and -Decimal::Compare( Decimal, Decimal ) methods generates the -following output. It creates several different Decimal -values and compares them with the following reference value. - -Left: Decimal( 123.456 ) 123.456 - -Right: Decimal( 1.2345600E+2 ) 123.456 -Decimal::Equals( Left, Right ) True -Decimal::Compare( Left, Right ) 0 - -Right: Decimal::Parse( "123.4561" ) 123.4561 -Decimal::Equals( Left, Right ) False -Decimal::Compare( Left, Right ) -1 - -Right: Decimal::Parse( "123.4559" ) 123.4559 -Decimal::Equals( Left, Right ) False -Decimal::Compare( Left, Right ) 1 - -Right: Decimal::Parse( "123.456000" ) 123.456000 -Decimal::Equals( Left, Right ) True -Decimal::Compare( Left, Right ) 0 - -Right: Decimal( 123456000, 0, 0, false, 6 ) 123.456000 -Decimal::Equals( Left, Right ) True -Decimal::Compare( Left, Right ) 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp deleted file mode 100644 index e155f61c420..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -// Example of the Decimal::CompareTo and Decimal::Equals instance -// methods. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Compare the Decimal to the Object parameters, -// and display the Object parameters with the results. -void CompDecimalToObject( Decimal Left, Object^ Right, String^ RightText ) -{ - Console::WriteLine( "{0,-46}{1}", String::Concat( "Object: ", RightText ), Right ); - Console::WriteLine( "{0,-46}{1}", "Left.Equals( Object )", Left.Equals( Right ) ); - Console::Write( "{0,-46}", "Left.CompareTo( Object )" ); - try - { - - // Catch the exception if CompareTo( ) throws one. - Console::WriteLine( "{0}\n", Left.CompareTo( Right ) ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "{0}\n", GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the Decimal::Equals( Object* ) and \n" - "Decimal::CompareTo( Object* ) methods generates the \n" - "following output. It creates several different " - "Decimal \nvalues and compares them with the following " - "reference value.\n" ); - - // Create a reference Decimal value. - Decimal Left = Decimal(987.654); - Console::WriteLine( "{0,-46}{1}\n", "Left: Decimal( 987.654 )", Left ); - - // Create objects to compare with the reference. - CompDecimalToObject( Left, Decimal(9.8765400E+2), "Decimal( 9.8765400E+2 )" ); - CompDecimalToObject( Left, Decimal::Parse( "987.6541" ), "Decimal::Parse( \"987.6541\" )" ); - CompDecimalToObject( Left, Decimal::Parse( "987.6539" ), "Decimal::Parse( \"987.6539\" )" ); - CompDecimalToObject( Left, Decimal(987654000,0,0,false,6), "Decimal( 987654000, 0, 0, false, 6 )" ); - CompDecimalToObject( Left, 9.8765400E+2, "Double 9.8765400E+2" ); - CompDecimalToObject( Left, "987.654", "String \"987.654\"" ); -} - -/* -This example of the Decimal::Equals( Object* ) and -Decimal::CompareTo( Object* ) methods generates the -following output. It creates several different Decimal -values and compares them with the following reference value. - -Left: Decimal( 987.654 ) 987.654 - -Object: Decimal( 9.8765400E+2 ) 987.654 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: Decimal::Parse( "987.6541" ) 987.6541 -Left.Equals( Object ) False -Left.CompareTo( Object ) -1 - -Object: Decimal::Parse( "987.6539" ) 987.6539 -Left.Equals( Object ) False -Left.CompareTo( Object ) 1 - -Object: Decimal( 987654000, 0, 0, false, 6 ) 987.654000 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: Double 9.8765400E+2 987.654 -Left.Equals( Object ) False -Left.CompareTo( Object ) ArgumentException - -Object: String "987.654" 987.654 -Left.Equals( Object ) False -Left.CompareTo( Object ) ArgumentException -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp deleted file mode 100644 index 52935e71178..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp +++ /dev/null @@ -1,117 +0,0 @@ - -// -// Example of the Decimal( int __gc [ ] ) constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( array^bits ) -{ - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {{ 0x{0:X}", bits[ 0 ] ); - String^ valOrExc; - for ( int index = 1; index < bits->Length; index++ ) - ctor = String::Concat( ctor, String::Format( ", 0x{0:X}", bits[ index ] ) ); - ctor = String::Concat( ctor, " } )" ); - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(bits); - - // Format the Decimal value for display. - valOrExc = decimalNum.ToString(); - } - catch ( Exception^ ex ) - { - - // Save the exception type if an exception was thrown. - valOrExc = GetExceptionType( ex ); - } - - - // Display the constructor and Decimal value or exception. - int ctorLen = 76 - valOrExc->Length; - - // Display the data on one line if it will fit. - if ( ctorLen > ctor->Length ) - Console::WriteLine( "{0}{1}", ctor->PadRight( ctorLen ), valOrExc ); - // Otherwise, display the data on two lines. - else - { - Console::WriteLine( "{0}", ctor ); - Console::WriteLine( "{0,76}", valOrExc ); - } -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( int __gc [ ] ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-38}{1,38}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-38}{1,38}", "-----------", "------------------" ); - - // Construct Decimal objects from integer arrays. - array^zero = {0,0,0,0}; - CreateDecimal( zero ); - array^arrayShort = {0,0,0}; - CreateDecimal( arrayShort ); - array^arrayLong = {0,0,0,0,0}; - CreateDecimal( arrayLong ); - array^word0Data = {1000000000,0,0,0}; - CreateDecimal( word0Data ); - array^word1Data = {0,1000000000,0,0}; - CreateDecimal( word1Data ); - array^word2Data = {0,0,1000000000,0}; - CreateDecimal( word2Data ); - array^word3Data = {0,0,0,1000000000}; - CreateDecimal( word3Data ); - array^decMax = { -1,-1,-1,0}; - CreateDecimal( decMax ); - array^decMin = { -1,-1,-1,0x80000000}; - CreateDecimal( decMin ); - array^fracDig16 = { -1,0,0,0x100000}; - CreateDecimal( fracDig16 ); - array^fracDig28 = { -1,0,0,0x1C0000}; - CreateDecimal( fracDig28 ); - array^fracDig29 = { -1,0,0,0x1D0000}; - CreateDecimal( fracDig29 ); - array^reserved = { -1,0,0,0x1C0001}; - CreateDecimal( reserved ); - array^Same4Words = {0xF0000,0xF0000,0xF0000,0xF0000}; - CreateDecimal( Same4Words ); -} - -/* -This example of the Decimal( int __gc [ ] ) constructor -generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( { 0x0, 0x0, 0x0, 0x0 } ) 0 -Decimal( { 0x0, 0x0, 0x0 } ) ArgumentException -Decimal( { 0x0, 0x0, 0x0, 0x0, 0x0 } ) ArgumentException -Decimal( { 0x3B9ACA00, 0x0, 0x0, 0x0 } ) 1000000000 -Decimal( { 0x0, 0x3B9ACA00, 0x0, 0x0 } ) 4294967296000000000 -Decimal( { 0x0, 0x0, 0x3B9ACA00, 0x0 } ) 18446744073709551616000000000 -Decimal( { 0x0, 0x0, 0x0, 0x3B9ACA00 } ) ArgumentException -Decimal( { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0 } ) - 79228162514264337593543950335 -Decimal( { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x80000000 } ) - -79228162514264337593543950335 -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x100000 } ) 0.0000004294967295 -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1C0000 } ) 0.0000000000000000004294967295 -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1D0000 } ) ArgumentException -Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1C0001 } ) ArgumentException -Decimal( { 0xF0000, 0xF0000, 0xF0000, 0xF0000 } ) - 18133887298.441562272235520 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp deleted file mode 100644 index c0aef542fb3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -// -// Example of the Decimal( int, int, int, bool, unsigned char ) -// constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( int low, int mid, int high, bool isNeg, unsigned char scale ) -{ - - // Format the constructor for display. - array^boxedParams = gcnew array(5); - boxedParams[ 0 ] = low; - boxedParams[ 1 ] = mid; - boxedParams[ 2 ] = high; - boxedParams[ 3 ] = isNeg; - boxedParams[ 4 ] = scale; - String^ ctor = String::Format( "Decimal( {0}, {1}, {2}, {3}, {4} )", boxedParams ); - String^ valOrExc; - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(low,mid,high,isNeg,scale); - - // Format and save the Decimal value. - valOrExc = decimalNum.ToString(); - } - catch ( Exception^ ex ) - { - - // Save the exception type if an exception was thrown. - valOrExc = GetExceptionType( ex ); - } - - - // Display the constructor and Decimal value or exception. - int ctorLen = 76 - valOrExc->Length; - - // Display the data on one line if it will fit. - if ( ctorLen > ctor->Length ) - Console::WriteLine( "{0}{1}", ctor->PadRight( ctorLen ), valOrExc ); - // Otherwise, display the data on two lines. - else - { - Console::WriteLine( "{0}", ctor ); - Console::WriteLine( "{0,76}", valOrExc ); - } -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( int, int, " - "int, bool, unsigned char ) \nconstructor " - "generates the following output.\n" ); - Console::WriteLine( "{0,-38}{1,38}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-38}{1,38}", "-----------", "------------------" ); - - // Construct Decimal objects from double values. - CreateDecimal( 0, 0, 0, false, 0 ); - CreateDecimal( 0, 0, 0, false, 27 ); - CreateDecimal( 0, 0, 0, true, 0 ); - CreateDecimal( 1000000000, 0, 0, false, 0 ); - CreateDecimal( 0, 1000000000, 0, false, 0 ); - CreateDecimal( 0, 0, 1000000000, false, 0 ); - CreateDecimal( 1000000000, 1000000000, 1000000000, false, 0 ); - CreateDecimal( -1, -1, -1, false, 0 ); - CreateDecimal( -1, -1, -1, true, 0 ); - CreateDecimal( -1, -1, -1, false, 15 ); - CreateDecimal( -1, -1, -1, false, 28 ); - CreateDecimal( -1, -1, -1, false, 29 ); - CreateDecimal( Int32::MaxValue, 0, 0, false, 18 ); - CreateDecimal( Int32::MaxValue, 0, 0, false, 28 ); - CreateDecimal( Int32::MaxValue, 0, 0, true, 28 ); -} - -/* -This example of the Decimal( int, int, int, bool, unsigned char ) -constructor generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( 0, 0, 0, False, 0 ) 0 -Decimal( 0, 0, 0, False, 27 ) 0 -Decimal( 0, 0, 0, True, 0 ) 0 -Decimal( 1000000000, 0, 0, False, 0 ) 1000000000 -Decimal( 0, 1000000000, 0, False, 0 ) 4294967296000000000 -Decimal( 0, 0, 1000000000, False, 0 ) 18446744073709551616000000000 -Decimal( 1000000000, 1000000000, 1000000000, False, 0 ) - 18446744078004518913000000000 -Decimal( -1, -1, -1, False, 0 ) 79228162514264337593543950335 -Decimal( -1, -1, -1, True, 0 ) -79228162514264337593543950335 -Decimal( -1, -1, -1, False, 15 ) 79228162514264.337593543950335 -Decimal( -1, -1, -1, False, 28 ) 7.9228162514264337593543950335 -Decimal( -1, -1, -1, False, 29 ) ArgumentOutOfRangeException -Decimal( 2147483647, 0, 0, False, 18 ) 0.000000002147483647 -Decimal( 2147483647, 0, 0, False, 28 ) 0.0000000000000000002147483647 -Decimal( 2147483647, 0, 0, True, 28 ) -0.0000000000000000002147483647 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp deleted file mode 100644 index ecdc7081878..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( int ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( int value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-30}{1,16}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( int ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-30}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-30}{1,16}", "-----------", "-----" ); - - // Construct Decimal objects from int values. - CreateDecimal( Int32::MinValue, "Int32::MinValue" ); - CreateDecimal( Int32::MaxValue, "Int32::MaxValue" ); - CreateDecimal( 0, "0" ); - CreateDecimal( 999999999, "999999999" ); - CreateDecimal( 0x40000000, "0x40000000" ); - CreateDecimal( (int)0xC0000000, "(int)0xC0000000" ); -} - -/* -This example of the Decimal( int ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( Int32::MinValue ) -2147483648 -Decimal( Int32::MaxValue ) 2147483647 -Decimal( 0 ) 0 -Decimal( 999999999 ) 999999999 -Decimal( 0x40000000 ) 1073741824 -Decimal( (int)0xC0000000 ) -1073741824 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp deleted file mode 100644 index 1e66c122bf6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( __int64 ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( __int64 value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-35}{1,22}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( __int64 ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-35}{1,22}", "Constructor", "Value" ); - Console::WriteLine( "{0,-35}{1,22}", "-----------", "-----" ); - - // Construct Decimal objects from __int64 values. - CreateDecimal( Int64::MinValue, "Int64::MinValue" ); - CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); - CreateDecimal( 0, "0" ); - CreateDecimal( 999999999999999999, "999999999999999999" ); - CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); - CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); -} - -/* -This example of the Decimal( __int64 ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( Int64::MinValue ) -9223372036854775808 -Decimal( Int64::MaxValue ) 9223372036854775807 -Decimal( 0 ) 0 -Decimal( 999999999999999999 ) 999999999999999999 -Decimal( 0x2000000000000000 ) 2305843009213693952 -Decimal( 0xE000000000000000 ) -2305843009213693952 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp deleted file mode 100644 index 4882d3004fb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( unsigned int ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( unsigned int value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-30}{1,16}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( unsigned " - "int ) constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-30}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-30}{1,16}", "-----------", "-----" ); - - // Construct Decimal objects from unsigned int values. - CreateDecimal( UInt32::MinValue, "UInt32::MinValue" ); - CreateDecimal( UInt32::MaxValue, "UInt32::MaxValue" ); - CreateDecimal( Int32::MaxValue, "Int32::MaxValue" ); - CreateDecimal( 999999999, "999999999" ); - CreateDecimal( 0x40000000, "0x40000000" ); - CreateDecimal( 0xC0000000, "0xC0000000" ); -} - -/* -This example of the Decimal( unsigned int ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( UInt32::MinValue ) 0 -Decimal( UInt32::MaxValue ) 4294967295 -Decimal( Int32::MaxValue ) 2147483647 -Decimal( 999999999 ) 999999999 -Decimal( 0x40000000 ) 1073741824 -Decimal( 0xC0000000 ) 3221225472 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp deleted file mode 100644 index d09060bdbb9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -// Example of the Decimal( unsigned __int64 ) constructor. -using namespace System; - -// Create a Decimal object and display its value. -void CreateDecimal( unsigned __int64 value, String^ valToStr ) -{ - Decimal decimalNum = Decimal(value); - - // Format the constructor for display. - String^ ctor = String::Format( "Decimal( {0} )", valToStr ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-33}{1,22}", ctor, decimalNum ); -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( unsigned " - "__int64 ) constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-33}{1,22}", "Constructor", "Value" ); - Console::WriteLine( "{0,-33}{1,22}", "-----------", "-----" ); - - // Construct Decimal objects from unsigned __int64 values. - CreateDecimal( UInt64::MinValue, "UInt64::MinValue" ); - CreateDecimal( UInt64::MaxValue, "UInt64::MaxValue" ); - CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); - CreateDecimal( 999999999999999999, "999999999999999999" ); - CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); - CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); -} - -/* -This example of the Decimal( unsigned __int64 ) constructor -generates the following output. - -Constructor Value ------------ ----- -Decimal( UInt64::MinValue ) 0 -Decimal( UInt64::MaxValue ) 18446744073709551615 -Decimal( Int64::MaxValue ) 9223372036854775807 -Decimal( 999999999999999999 ) 999999999999999999 -Decimal( 0x2000000000000000 ) 2305843009213693952 -Decimal( 0xE000000000000000 ) 16140901064495857664 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp deleted file mode 100644 index 3ffa533351d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -// Example of the Decimal( double ) constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( double value, String^ valToStr ) -{ - - // Format and display the constructor. - Console::Write( "{0,-34}", String::Format( "Decimal( {0} )", valToStr ) ); - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(value); - - // Display the value if it was created successfully. - Console::WriteLine( "{0,31}", decimalNum ); - } - catch ( Exception^ ex ) - { - - // Display the exception type if an exception was thrown. - Console::WriteLine( "{0,31}", GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( double ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-34}{1,31}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-34}{1,31}", "-----------", "------------------" ); - - // Construct Decimal objects from double values. - CreateDecimal( 1.23456789E+5, "1.23456789E+5" ); - CreateDecimal( 1.234567890123E+15, "1.234567890123E+15" ); - CreateDecimal( 1.2345678901234567E+25, "1.2345678901234567E+25" ); - CreateDecimal( 1.2345678901234567E+35, "1.2345678901234567E+35" ); - CreateDecimal( 1.23456789E-5, "1.23456789E-5" ); - CreateDecimal( 1.234567890123E-15, "1.234567890123E-15" ); - CreateDecimal( 1.2345678901234567E-25, "1.2345678901234567E-25" ); - CreateDecimal( 1.2345678901234567E-35, "1.2345678901234567E-35" ); - CreateDecimal( 1.0 / 7.0, "1.0 / 7.0" ); -} - -/* -This example of the Decimal( double ) constructor -generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( 1.23456789E+5 ) 123456.789 -Decimal( 1.234567890123E+15 ) 1234567890123000 -Decimal( 1.2345678901234567E+25 ) 12345678901234600000000000 -Decimal( 1.2345678901234567E+35 ) OverflowException -Decimal( 1.23456789E-5 ) 0.0000123456789 -Decimal( 1.234567890123E-15 ) 0.000000000000001234567890123 -Decimal( 1.2345678901234567E-25 ) 0.0000000000000000000000001235 -Decimal( 1.2345678901234567E-35 ) 0 -Decimal( 1.0 / 7.0 ) 0.142857142857143 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp deleted file mode 100644 index f2052b72799..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -// Example of the Decimal( float ) constructor. -using namespace System; - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Create a Decimal object and display its value. -void CreateDecimal( float value, String^ valToStr ) -{ - - // Format and display the constructor. - Console::Write( "{0,-27}", String::Format( "Decimal( {0} )", valToStr ) ); - try - { - - // Construct the Decimal value. - Decimal decimalNum = Decimal(value); - - // Display the value if it was created successfully. - Console::WriteLine( "{0,31}", decimalNum ); - } - catch ( Exception^ ex ) - { - - // Display the exception type if an exception was thrown. - Console::WriteLine( "{0,31}", GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the Decimal( float ) " - "constructor \ngenerates the following output.\n" ); - Console::WriteLine( "{0,-27}{1,31}", "Constructor", "Value or Exception" ); - Console::WriteLine( "{0,-27}{1,31}", "-----------", "------------------" ); - - // Construct Decimal objects from float values. - CreateDecimal( 1.2345E+5, "1.2345E+5" ); - CreateDecimal( 1.234567E+15, "1.234567E+15" ); - CreateDecimal( 1.23456789E+25, "1.23456789E+25" ); - CreateDecimal( 1.23456789E+35, "1.23456789E+35" ); - CreateDecimal( 1.2345E-5, "1.2345E-5" ); - CreateDecimal( 1.234567E-15, "1.234567E-15" ); - CreateDecimal( 1.23456789E-25, "1.23456789E-25" ); - CreateDecimal( 1.23456789E-35, "1.23456789E-35" ); - CreateDecimal( 1.0 / 7.0, "1.0 / 7.0" ); -} - -/* -This example of the Decimal( float ) constructor -generates the following output. - -Constructor Value or Exception ------------ ------------------ -Decimal( 1.2345E+5 ) 123450 -Decimal( 1.234567E+15 ) 1234567000000000 -Decimal( 1.23456789E+25 ) 12345680000000000000000000 -Decimal( 1.23456789E+35 ) OverflowException -Decimal( 1.2345E-5 ) 0.000012345 -Decimal( 1.234567E-15 ) 0.000000000000001234567 -Decimal( 1.23456789E-25 ) 0.0000000000000000000000001235 -Decimal( 1.23456789E-35 ) 0 -Decimal( 1.0 / 7.0 ) 0.1428571 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp deleted file mode 100644 index 7f0743a1a5e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -// Example of the Decimal fields. -using namespace System; -int main() -{ - String^ numberFmt = "{0,-25}{1,45:N0}"; - String^ exprFmt = "{0,-55}{1,15}"; - Console::WriteLine( "This example of the fields of the Decimal structure " - "\ngenerates the following output.\n" ); - Console::WriteLine( numberFmt, "Field or Expression", "Value" ); - Console::WriteLine( numberFmt, "-------------------", "-----" ); - - // Display the values of the Decimal fields. - Console::WriteLine( numberFmt, "Decimal::MaxValue", Decimal::MaxValue ); - Console::WriteLine( numberFmt, "Decimal::MinValue", Decimal::MinValue ); - Console::WriteLine( numberFmt, "Decimal::MinusOne", Decimal::MinusOne ); - Console::WriteLine( numberFmt, "Decimal::One", Decimal::One ); - Console::WriteLine( numberFmt, "Decimal::Zero", Decimal::Zero ); - Console::WriteLine(); - - // Display the values of expressions of the Decimal fields. - Console::WriteLine( exprFmt, "( Decimal::MinusOne + Decimal::One ) == Decimal::Zero", (Decimal::MinusOne + Decimal::One) == Decimal::Zero ); - Console::WriteLine( exprFmt, "Decimal::MaxValue + Decimal::MinValue", Decimal::MaxValue + Decimal::MinValue ); - Console::WriteLine( exprFmt, "Decimal::MinValue / Decimal::MaxValue", Decimal::MinValue / Decimal::MaxValue ); - Console::WriteLine( "{0,-40}{1,30}", "100000000000000M / Decimal::MaxValue", Convert::ToDecimal( 100000000000000 ) / Decimal::MaxValue ); -} - -/* -This example of the fields of the Decimal structure -generates the following output. - -Field or Expression Value -------------------- ----- -Decimal::MaxValue 79,228,162,514,264,337,593,543,950,335 -Decimal::MinValue -79,228,162,514,264,337,593,543,950,335 -Decimal::MinusOne -1 -Decimal::One 1 -Decimal::Zero 0 - -( Decimal::MinusOne + Decimal::One ) == Decimal::Zero True -Decimal::MaxValue + Decimal::MinValue 0 -Decimal::MinValue / Decimal::MaxValue -1 -100000000000000M / Decimal::MaxValue 0.0000000000000012621774483536 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp deleted file mode 100644 index 5ec1281cf67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example of the Decimal::Negate, Decimal::Floor, and -// Decimal::Truncate methods. -using namespace System; - -// Display Decimal parameters and the method results. -void ShowDecimalFloorNegTrunc( Decimal Argument ) -{ - String^ dataFmt = "{0,-30}{1,26}"; - Console::WriteLine(); - Console::WriteLine( dataFmt, "Decimal Argument", Argument ); - Console::WriteLine( dataFmt, "Decimal::Negate( Argument )", Decimal::Negate( Argument ) ); - Console::WriteLine( dataFmt, "Decimal::Floor( Argument )", Decimal::Floor( Argument ) ); - Console::WriteLine( dataFmt, "Decimal::Truncate( Argument )", Decimal::Truncate( Argument ) ); -} - -int main() -{ - Console::WriteLine( "This example of the \n" - " Decimal::Negate( Decimal ), \n" - " Decimal::Floor( Decimal ), and \n" - " Decimal::Truncate( Decimal ) \n" - "methods generates the following output." ); - - // Create pairs of Decimal objects. - ShowDecimalFloorNegTrunc( Decimal::Parse( "0" ) ); - ShowDecimalFloorNegTrunc( Decimal::Parse( "123.456" ) ); - ShowDecimalFloorNegTrunc( Decimal::Parse( "-123.456" ) ); - ShowDecimalFloorNegTrunc( Decimal(1230000000,0,0,true,7) ); - ShowDecimalFloorNegTrunc( Decimal::Parse( "-9999999999.9999999999" ) ); -} - -/* -This example of the - Decimal::Negate( Decimal ), - Decimal::Floor( Decimal ), and - Decimal::Truncate( Decimal ) -methods generates the following output. - -Decimal Argument 0 -Decimal::Negate( Argument ) 0 -Decimal::Floor( Argument ) 0 -Decimal::Truncate( Argument ) 0 - -Decimal Argument 123.456 -Decimal::Negate( Argument ) -123.456 -Decimal::Floor( Argument ) 123 -Decimal::Truncate( Argument ) 123 - -Decimal Argument -123.456 -Decimal::Negate( Argument ) 123.456 -Decimal::Floor( Argument ) -124 -Decimal::Truncate( Argument ) -123 - -Decimal Argument -123.0000000 -Decimal::Negate( Argument ) 123.0000000 -Decimal::Floor( Argument ) -123 -Decimal::Truncate( Argument ) -123 - -Decimal Argument -9999999999.9999999999 -Decimal::Negate( Argument ) 9999999999.9999999999 -Decimal::Floor( Argument ) -10000000000 -Decimal::Truncate( Argument ) -9999999999 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp deleted file mode 100644 index ac862b815f9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -using namespace System; - -int main() -{ - // Define an array of Decimal values. - array^ values = gcnew array { Decimal::One, - Decimal::Parse("100000000000000"), - Decimal::Parse("10000000000000000000000000000"), - Decimal::Parse("100000000000000.00000000000000"), - Decimal::Parse("1.0000000000000000000000000000"), - Decimal::Parse("123456789"), - Decimal::Parse("0.123456789"), - Decimal::Parse("0.000000000123456789"), - Decimal::Parse("0.000000000000000000123456789"), - Decimal::Parse("4294967295.0"), - Decimal::Parse("18446744073709551615.0"), - Decimal::MaxValue, Decimal::MinValue, - Decimal::Parse("-7.9228162514264337593543950335") }; - - Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", - "Argument", "Bits[3]", "Bits[2]", "Bits[1]", "Bits[0]" ); - Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", - "--------", "-------", "-------", "-------", "-------" ); - - for each (Decimal value in values) - { - array^ bits = Decimal::GetBits(value); - Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", - value, bits[3], bits[2], bits[1], bits[0] ); - } -} - -/* -This example of the Decimal::GetBits( Decimal ) method -generates the following output. It displays the argument -as a Decimal and the result array in hexadecimal. - - Argument Bits[3] Bits[2] Bits[1] Bits[0] - -------- ------- ------- ------- ------- - 1 00000000 00000000 00000000 00000001 - 100000000000000 00000000 00000000 00005AF3 107A4000 - 10000000000000000000000000000 00000000 204FCE5E 3E250261 10000000 - 100000000000000.00000000000000 000E0000 204FCE5E 3E250261 10000000 - 1.0000000000000000000000000000 001C0000 204FCE5E 3E250261 10000000 - 123456789 00000000 00000000 00000000 075BCD15 - 0.123456789 00090000 00000000 00000000 075BCD15 - 0.000000000123456789 00120000 00000000 00000000 075BCD15 - 0.000000000000000000123456789 001B0000 00000000 00000000 075BCD15 - 4294967295 00000000 00000000 00000000 FFFFFFFF - 18446744073709551615 00000000 00000000 FFFFFFFF FFFFFFFF - 79228162514264337593543950335 00000000 FFFFFFFF FFFFFFFF FFFFFFFF - -79228162514264337593543950335 80000000 FFFFFFFF FFFFFFFF FFFFFFFF --7.9228162514264337593543950335 801C0000 FFFFFFFF FFFFFFFF FFFFFFFF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp deleted file mode 100644 index f99684b6727..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -// Example of the Decimal::GetTypeCode method. -using namespace System; -int main() -{ - Console::WriteLine( "This example of the " - "Decimal::GetTypeCode( ) \nmethod " - "generates the following output.\n" ); - - // Create a Decimal object and get its type code. - Decimal aDecimal = Decimal(1.0); - TypeCode typCode = aDecimal.GetTypeCode(); - Console::WriteLine( "Type Code: \"{0}\"", typCode ); - Console::WriteLine( "Numeric value: {0}", (int)typCode ); -} - -/* -This example of the Decimal::GetTypeCode( ) -method generates the following output. - -Type Code: "Decimal" -Numeric value: 15 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp deleted file mode 100644 index ec780d29082..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -// Example of the Decimal::Multiply, Decimal::Divide, and -// Decimal::Remainder methods. -using namespace System; - -// Display Decimal parameters and their product, quotient, and -// remainder. -void ShowDecimalProQuoRem( Decimal Left, Decimal Right ) -{ - String^ dataFmt = "{0,-35}{1,31}"; - Console::WriteLine(); - Console::WriteLine( dataFmt, "Decimal Left", Left ); - Console::WriteLine( dataFmt, "Decimal Right", Right ); - Console::WriteLine( dataFmt, "Decimal::Multiply( Left, Right )", Decimal::Multiply( Left, Right ) ); - Console::WriteLine( dataFmt, "Decimal::Divide( Left, Right )", Decimal::Divide( Left, Right ) ); - Console::WriteLine( dataFmt, "Decimal::Remainder( Left, Right )", Decimal::Remainder( Left, Right ) ); -} - -int main() -{ - Console::WriteLine( "This example of the \n" - " Decimal::Multiply( Decimal, Decimal ), \n" - " Decimal::Divide( Decimal, Decimal ), and \n" - " Decimal::Remainder( Decimal, Decimal ) \n" - "methods generates the following output. It displays " - "the product, \nquotient, and remainder of several " - "pairs of Decimal objects." ); - - // Create pairs of Decimal objects. - ShowDecimalProQuoRem( Decimal::Parse( "1000" ), Decimal::Parse( "7" ) ); - ShowDecimalProQuoRem( Decimal::Parse( "-1000" ), Decimal::Parse( "7" ) ); - ShowDecimalProQuoRem( Decimal(1230000000,0,0,false,7), Decimal::Parse( "0.0012300" ) ); - ShowDecimalProQuoRem( Decimal::Parse( "12345678900000000" ), Decimal::Parse( "0.0000000012345678" ) ); - ShowDecimalProQuoRem( Decimal::Parse( "123456789.0123456789" ), Decimal::Parse( "123456789.1123456789" ) ); -} - -/* -This example of the - Decimal::Multiply( Decimal, Decimal ), - Decimal::Divide( Decimal, Decimal ), and - Decimal::Remainder( Decimal, Decimal ) -methods generates the following output. It displays the product, -quotient, and remainder of several pairs of Decimal objects. - -Decimal Left 1000 -Decimal Right 7 -Decimal::Multiply( Left, Right ) 7000 -Decimal::Divide( Left, Right ) 142.85714285714285714285714286 -Decimal::Remainder( Left, Right ) 6 - -Decimal Left -1000 -Decimal Right 7 -Decimal::Multiply( Left, Right ) -7000 -Decimal::Divide( Left, Right ) -142.85714285714285714285714286 -Decimal::Remainder( Left, Right ) -6 - -Decimal Left 123.0000000 -Decimal Right 0.0012300 -Decimal::Multiply( Left, Right ) 0.15129000000000 -Decimal::Divide( Left, Right ) 100000 -Decimal::Remainder( Left, Right ) 0 - -Decimal Left 12345678900000000 -Decimal Right 0.0000000012345678 -Decimal::Multiply( Left, Right ) 15241577.6390794200000000 -Decimal::Divide( Left, Right ) 10000000729000059778004901.796 -Decimal::Remainder( Left, Right ) 0.000000000983 - -Decimal Left 123456789.0123456789 -Decimal Right 123456789.1123456789 -Decimal::Multiply( Left, Right ) 15241578765584515.651425087878 -Decimal::Divide( Left, Right ) 0.9999999991899999933660999449 -Decimal::Remainder( Left, Right ) 123456789.0123456789 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp deleted file mode 100644 index 2447a44f013..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -// Example of the Decimal::FromOACurrency method. -using namespace System; -#define dataFmt "{0,21}{1,25}" - -// Display the Decimal::FromOACurrency parameter and Decimal result. -void ShowDecimalFromOACurrency( __int64 Argument ) -{ - Decimal decCurrency = Decimal::FromOACurrency( Argument ); - Console::WriteLine( dataFmt, Argument, decCurrency ); -} - -int main() -{ - Console::WriteLine( "This example of the " - "Decimal::FromOACurrency( ) method generates \nthe " - "following output. It displays the OLE Automation " - "Currency \nvalue as an __int64 and the result as a " - "Decimal.\n" ); - Console::WriteLine( dataFmt, "OA Currency", "Decimal Value" ); - Console::WriteLine( dataFmt, "-----------", "-------------" ); - - // Convert OLE Automation Currency values to Decimal objects. - ShowDecimalFromOACurrency( 0L ); - ShowDecimalFromOACurrency( 1L ); - ShowDecimalFromOACurrency( 100000L ); - ShowDecimalFromOACurrency( 100000000000L ); - ShowDecimalFromOACurrency( 1000000000000000000L ); - ShowDecimalFromOACurrency( 1000000000000000001L ); - ShowDecimalFromOACurrency( Int64::MaxValue ); - ShowDecimalFromOACurrency( Int64::MinValue ); - ShowDecimalFromOACurrency( 123456789L ); - ShowDecimalFromOACurrency( 1234567890000L ); - ShowDecimalFromOACurrency( 1234567890987654321 ); - ShowDecimalFromOACurrency( 4294967295L ); -} - -/* -This example of the Decimal::FromOACurrency( ) method generates -the following output. It displays the OLE Automation Currency -value as an __int64 and the result as a Decimal. - - OA Currency Decimal Value - ----------- ------------- - 0 0 - 1 0.0001 - 100000 10 - 100000000000 10000000 - 1000000000000000000 100000000000000 - 1000000000000000001 100000000000000.0001 - 9223372036854775807 922337203685477.5807 - -9223372036854775808 -922337203685477.5808 - 123456789 12345.6789 - 1234567890000 123456789 - 1234567890987654321 123456789098765.4321 - 4294967295 429496.7295 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp deleted file mode 100644 index 047800b7566..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -// Example of the Decimal::ToOACurrency method. -using namespace System; -#define dataFmt "{0,31}{1,27}" - -// Get the exception type name; remove the namespace prefix. -String^ GetExceptionType( Exception^ ex ) -{ - String^ exceptionType = ex->GetType()->ToString(); - return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); -} - - -// Display the Decimal::ToOACurrency parameter and the result -// or exception. -void ShowDecimalToOACurrency( Decimal Argument ) -{ - - // Catch the exception if ToOACurrency( ) throws one. - try - { - __int64 oaCurrency = Decimal::ToOACurrency( Argument ); - Console::WriteLine( dataFmt, Argument, oaCurrency ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( dataFmt, Argument, GetExceptionType( ex ) ); - } - -} - -int main() -{ - Console::WriteLine( "This example of the " - "Decimal::ToOACurrency( ) method generates \nthe " - "following output. It displays the argument as a " - "Decimal \nand the OLE Automation Currency value " - "as an __int64.\n" ); - Console::WriteLine( dataFmt, "Argument", "OA Currency or Exception" ); - Console::WriteLine( dataFmt, "--------", "------------------------" ); - - // Convert Decimal values to OLE Automation Currency values. - ShowDecimalToOACurrency( Decimal(0) ); - ShowDecimalToOACurrency( Decimal(1) ); - ShowDecimalToOACurrency( Decimal::Parse( "1.0000000000000000000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "100000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "100000000000000.00000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "10000000000000000000000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "0.000000000123456789" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "0.123456789" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "123456789" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "123456789000000000" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "4294967295" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "18446744073709551615" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "-79.228162514264337593543950335" ) ); - ShowDecimalToOACurrency( Decimal::Parse( "-79228162514264.337593543950335" ) ); -} - -/* -This example of the Decimal::ToOACurrency( ) method generates -the following output. It displays the argument as a Decimal -and the OLE Automation Currency value as an __int64. - - Argument OA Currency or Exception - -------- ------------------------ - 0 0 - 1 10000 - 1.0000000000000000000000000000 10000 - 100000000000000 1000000000000000000 - 100000000000000.00000000000000 1000000000000000000 - 10000000000000000000000000000 OverflowException - 0.000000000123456789 0 - 0.123456789 1235 - 123456789 1234567890000 - 123456789000000000 OverflowException - 4294967295 42949672950000 - 18446744073709551615 OverflowException --79.228162514264337593543950335 -792282 --79228162514264.337593543950335 -792281625142643376 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp deleted file mode 100644 index 9aec6164459..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -// -// Example of the Decimal::ToSingle and Decimal::ToDouble methods. -using namespace System; -#define formatter "{0,30}{1,17}{2,23}" - -// Convert the Decimal argument; no exceptions are thrown. -void DecimalToSgl_Dbl( Decimal argument ) -{ - Object^ SingleValue; - Object^ DoubleValue; - - // Convert the argument to a float value. - SingleValue = Decimal::ToSingle( argument ); - - // Convert the argument to a double value. - DoubleValue = Decimal::ToDouble( argument ); - Console::WriteLine( formatter, argument, SingleValue, DoubleValue ); -} - -int main() -{ - Console::WriteLine( "This example of the \n" - " Decimal::ToSingle( Decimal ) and \n" - " Decimal::ToDouble( Decimal ) \nmethods " - "generates the following output. It \ndisplays " - "several converted Decimal values.\n" ); - Console::WriteLine( formatter, "Decimal argument", "float", "double" ); - Console::WriteLine( formatter, "----------------", "-----", "------" ); - - // Convert Decimal values and display the results. - DecimalToSgl_Dbl( Decimal::Parse( "0.0000000000000000000000000001" ) ); - DecimalToSgl_Dbl( Decimal::Parse( "0.0000000000123456789123456789" ) ); - DecimalToSgl_Dbl( Decimal::Parse( "123" ) ); - DecimalToSgl_Dbl( Decimal(123000000,0,0,false,6) ); - DecimalToSgl_Dbl( Decimal::Parse( "123456789.123456789" ) ); - DecimalToSgl_Dbl( Decimal::Parse( "123456789123456789123456789" ) ); - DecimalToSgl_Dbl( Decimal::MinValue ); - DecimalToSgl_Dbl( Decimal::MaxValue ); -} - -/* -This example of the - Decimal::ToSingle( Decimal ) and - Decimal::ToDouble( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument float double - ---------------- ----- ------ -0.0000000000000000000000000001 1E-28 1E-28 -0.0000000000123456789123456789 1.234568E-11 1.23456789123457E-11 - 123 123 123 - 123.000000 123 123 - 123456789.123456789 1.234568E+08 123456789.123457 - 123456789123456789123456789 1.234568E+26 1.23456789123457E+26 --79228162514264337593543950335 -7.922816E+28 -7.92281625142643E+28 - 79228162514264337593543950335 7.922816E+28 7.92281625142643E+28 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp deleted file mode 100644 index 5c947137978..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// CorrelationManager.cpp : main project file. - - -// -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Text; -using namespace System::Diagnostics; -using namespace System::Threading; - -void ThreadProc() -{ - TraceSource^ ts = gcnew TraceSource("MyApp"); - int i = ts->Listeners->Add(gcnew ConsoleTraceListener()); - ts->Listeners[i]->TraceOutputOptions = TraceOptions::LogicalOperationStack; - ts->Switch = gcnew SourceSwitch("MyAPP", "Verbose"); - // Add another logical operation. - Trace::CorrelationManager->StartLogicalOperation("WorkerThread"); - - ts->TraceEvent(TraceEventType::Error, 1, "Trace an error event."); - Trace::CorrelationManager->StopLogicalOperation(); -} - -void main() -{ - TraceSource^ ts = gcnew TraceSource("MyApp"); - int i = ts->Listeners->Add(gcnew ConsoleTraceListener()); - ts->Listeners[i]->TraceOutputOptions = TraceOptions::LogicalOperationStack; - ts->Switch = gcnew SourceSwitch("MyAPP", "Verbose"); - // Start the logical operation on the Main thread. - Trace::CorrelationManager->StartLogicalOperation("MainThread"); - - ts->TraceEvent(TraceEventType::Error, 1, "Trace an error event."); - Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); -// Start the worker thread. - t->Start(); -// Give the worker thread a chance to execute. - Thread::Sleep(1000); - Trace::CorrelationManager->StopLogicalOperation();} - - - -// This sample generates the following output: -//MyApp Error: 1 : Trace an error event. -// LogicalOperationStack=MainThread -//MyApp Error: 1 : Trace an error event. -// LogicalOperationStack=WorkerThread, MainThread -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp deleted file mode 100644 index 519ff58fbcd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// - -using namespace System; -using namespace System::Collections; -using namespace System::Diagnostics; -using namespace System::Reflection; - -ref class HashtableDebugView; - -// -[DebuggerDisplay("{value}", Name = "{key}")] -ref class KeyValuePairs -{ -private: - IDictionary^ dictionary; - Object^ key; - Object^ value; - -public: - KeyValuePairs(IDictionary^ dictionary, Object^ key, Object^ value) - { - this->value = value; - this->key = key; - this->dictionary = dictionary; - } -}; -// - -// -[DebuggerDisplay("Count = {Count}")] -// -[DebuggerTypeProxy(HashtableDebugView::typeid)] -ref class MyHashtable : Hashtable -// -{ -private: - static const String^ TestString = "This should not appear in the debug window."; - -internal: - ref class HashtableDebugView - { - private: - Hashtable^ hashtable; - public: - static const String^ TestString = "This should appear in the debug window."; - HashtableDebugView(Hashtable^ hashtable) - { - this->hashtable = hashtable; - } - - // - [DebuggerBrowsable(DebuggerBrowsableState::RootHidden)] - property array^ Keys - { - array^ get() - { - array^ keys = gcnew array(hashtable->Count); - - IEnumerator^ ie = hashtable->Keys->GetEnumerator(); - int i = 0; - Object^ key; - while (ie->MoveNext()) - { - key = ie->Current; - keys[i] = gcnew KeyValuePairs(hashtable, key, hashtable[key]); - i++; - } - return keys; - } - } - // - }; -}; -// - -public ref class DebugViewTest -{ -private: - // The following constant will appear in the debug window for DebugViewTest. - static const String^ TabString = " "; -public: - // - // The following DebuggerBrowsableAttribute prevents the property following it - // from appearing in the debug window for the class. - [DebuggerBrowsable(DebuggerBrowsableState::Never)] - static String^ y = "Test String"; - // - - static void Main() - { - MyHashtable^ myHashTable = gcnew MyHashtable(); - myHashTable->Add("one", 1); - myHashTable->Add("two", 2); - Console::WriteLine(myHashTable->ToString()); - Console::WriteLine("In Main."); - } -}; - -int main() -{ - DebugViewTest::Main(); -} -// - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp deleted file mode 100644 index 6ac933cf809..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp +++ /dev/null @@ -1,99 +0,0 @@ -// - -/////////////////////////////////////////////////////////////////////// -// -// EventSchemaTraceListener.cpp : main project file. -// Expected Output: -// 1) -// EventSchemaTraceListener CPP Sample -// -// IsThreadSafe? True -// BufferSize = 65536 -// MaximumFileSize = 20480000 -// MaximumNumberOfFiles = 2 -// Name = eventListener -// TraceLogRetentionOption = LimitedCircularFiles -// TraceOutputOptions = DateTime, Timestamp, ProcessId -// -// Press the enter key to exit -// -// 2) An output file is created named TraceOutput.xml. It will be -// opened and displayed in Microsoft Notepad. -// -// NOTE 1: -// Under certain circumstances, the VS C++ compiler will treat -// Console::WriteLine("MyText = " + MyVar); -// differently then the VS CSharp compiler. -// The C++ compiler will produce error C3063, whereas the -// CSharp compiler accepts the statement. -// This occurs when the VS C++ compiler cannot determine the -// datatype of "MyVar" because it is an enumeration type. -// The solution is: -// Use either of the following two methods: -// Console::WriteLine("MyText = {0} " , MyVar); -// Console::WriteLine("MyText = " + MyVar.ToString()); -// -// Although not specific to this particular pieces of code, -// this is demonstrated below in the Display function: The -// last two members, TraceLogRetentionOption, and -// TraceOutputOptions, are enumerations, and cannot simply be -// concatenated into Console::WriteLine. -// -/////////////////////////////////////////////////////////////////////// -#using -#using - -#define NOCONFIGFILE 1 -using namespace System; -using namespace System::IO; -using namespace System::Diagnostics; - - -[STAThreadAttribute] -void main() -{ - Console::WriteLine("EventSchemaTraceListener CPP Sample\n"); - - File::Delete("TraceOutput.xml"); - TraceSource ^ ts = gcnew TraceSource("TestSource"); - - -#if NOCONFIGFILE - ts->Listeners->Add(gcnew EventSchemaTraceListener("TraceOutput.xml", - "eventListener", 65536, - TraceLogRetentionOption::LimitedCircularFiles, - 20480000, 2)); - ts->Listeners["eventListener"]->TraceOutputOptions = - TraceOptions::DateTime | - TraceOptions::ProcessId | - TraceOptions::Timestamp; -#endif - - EventSchemaTraceListener ^ ESTL = - (EventSchemaTraceListener^)(ts->Listeners["eventListener"]); - - - Console::WriteLine("IsThreadSafe? = " + ESTL->IsThreadSafe); - Console::WriteLine("BufferSize = " + ESTL->BufferSize); - Console::WriteLine("MaximumFileSize = " + ESTL->MaximumFileSize); - Console::WriteLine("MaximumNumberOfFiles = " + ESTL->MaximumNumberOfFiles); - Console::WriteLine("Name = " + ESTL->Name); - Console::WriteLine("TraceLogRetentionOption = " + ESTL->TraceLogRetentionOption.ToString()); - Console::WriteLine("TraceOutputOptions = {0}\n", ESTL->TraceOutputOptions); - - ts->Switch->Level = SourceLevels::All; - String ^ testString = "" - + "" - + "11"; - - UnescapedXmlDiagnosticData ^ unXData = gcnew UnescapedXmlDiagnosticData(testString); - ts->TraceData(TraceEventType::Error, 38, unXData); - ts->TraceEvent(TraceEventType::Error, 38, testString); - ts->Flush(); - ts->Close(); - - Process::Start("notepad.exe", "TraceOutput.xml"); - Console::WriteLine("\nPress the enter key to exit"); - Console::ReadLine(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp deleted file mode 100644 index 07d517d64ac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp +++ /dev/null @@ -1,187 +0,0 @@ -// -// InstanceData_CopyTo.cpp : main project file. -#using - -using namespace System; -using namespace System::Diagnostics; - - -/////////////////////////////////////////////////////////////////////// -// -// FORWARD DECLARATIONS -// -/////////////////////////////////////////////////////////////////////// - -// Console Utility Functions: -void InitConsole(); // Init console size -void TitleBlock(); // Write the title block -void CW(String^strText , // Write a colored string - String^ C = "", int LF = 1); - - -// InstanceData subroutines -// Display the contents of an InstanceData object. -void ProcessInstanceDataObject(String^ name, CounterSample CSRef); - -// Display the contents of an InstanceDataCollection. -void ProcessInstanceDataCollection(InstanceDataCollection^ idCol); - - - - -/////////////////////////////////////////////////////////////////////// -// -// MAIN PROGRAM -// -/////////////////////////////////////////////////////////////////////// - -void main() -{ - InitConsole(); - TitleBlock(); - - String^ categoryName; - String^ catNumStr; - int categoryNum; - - - array^ categories = - PerformanceCounterCategory::GetCategories(); - - // Create and sort an array of category names. - array^ categoryNames = gcnew array(categories->Length); - int catX; - for(catX=0; catX < categories->Length; catX++) - categoryNames[catX] = categories[catX]->CategoryName; - Array::Sort(categoryNames); - - while(1) - { - CW("These PerformanceCounterCategory categories are registered \n" - +"on this computer:","Red"); - - for(catX=0; catX < categories->Length; catX++) - Console::WriteLine("{0,4} - {1}", catX+1, categoryNames[catX]); - - // Ask the user to choose a category. - Console::Write("\nEnter a category number from the above list: "); - catNumStr = Console::ReadLine(); - - // Validate the entered category number. - try { - categoryNum = int::Parse(catNumStr); - if (categoryNum < 1 || categoryNum > categories->Length) - throw gcnew Exception(String::Format("The category number "+ - " must be in the range 1..{0}.", categories->Length)); - categoryName = categoryNames[(categoryNum-1)]; - - // Process the InstanceDataCollectionCollection for this category. - PerformanceCounterCategory^ pcc = - gcnew PerformanceCounterCategory(categoryName); - InstanceDataCollectionCollection^ idColCol = pcc->ReadCategory(); - array^ idColArray = - gcnew array(idColCol->Count); - - CW("\nInstanceDataCollectionCollection for \"" +categoryName+"\" " - +"has "+idColCol->Count+" elements.","Blue"); - - idColCol->CopyTo(idColArray, 0); - - for each ( InstanceDataCollection ^ idCol in idColArray ) - ProcessInstanceDataCollection(idCol); - } - catch(Exception^ ex) - { - Console::WriteLine("\"{0}\" is not a valid category number." + - "\n{1}", catNumStr, ex->Message); - } - - CW("\n\nRun again (Y,N)?","Yellow"); - catNumStr = Console::ReadLine(); - if ("Y" != catNumStr && "y" != catNumStr) break; - } -} - - -/////////////////////////////////////////////////////////////////////// -// -// SUBROUTINES -// -/////////////////////////////////////////////////////////////////////// - -void InitConsole() -{ - Console::BufferHeight = 4000; - Console::WindowHeight = 40; -} - -void TitleBlock() -{ -Console::Title = "InstDataCopyTo.cpp Sample"; - -CW( - "///////////////////////////////////////////////////////////////////\n" -+"//\n" -+"// PROGRAM instdatacopyto.cpp\n" -+"// PURPOSE Show how to use InstanceData objects\n" -+"// OUTPUT 1) Displays a numbered list of PerformanceCounter\n" -+"// categories that exist on the local computer.\n" -+"// 2) Prompts the user to select a category.\n" -+"// 3) Displays the instance data associated with each\n" -+"// instance of the PerformanceCounter in the\n" -+"// selected PerformanceCounterCategory\n" -+"//\n" -+ "///////////////////////////////////////////////////////////////////\n" -,"Yellow"); -} - - -// Utility function: ConsoleWrite: Write a colored string -void CW(String^ strText , String^ C, int LF) -{ - if (C != "") Console::ForegroundColor = *dynamic_cast - (Enum::Parse(ConsoleColor::typeid, C)); - Console::Write(strText); - Console::ResetColor(); - Console::Write("\n{0}",LF?"\n":""); -} - -// Display the contents of an InstanceDataCollection. -void ProcessInstanceDataCollection(InstanceDataCollection ^ idCol) -{ - array^ instDataArray = gcnew array(idCol->Count); - - CW("\n InstanceDataCollection for \"" - + idCol->CounterName + "\" has " + idCol->Count + " elements.", "Red"); - - // Copy and process the InstanceData array. - idCol->CopyTo(instDataArray, 0); - - int idX; - for(idX=0; idX < instDataArray->Length; idX++) - ProcessInstanceDataObject(instDataArray[idX]->InstanceName, - instDataArray[idX]->Sample); -} - - -// Display the contents of an InstanceData object. -void ProcessInstanceDataObject(String ^ name, CounterSample CSRef) -{ - InstanceData ^ instData = gcnew InstanceData(name, CSRef); - CW(" Data from InstanceData object:","Red",0); - - CW(" InstanceName: "+instData->InstanceName,"Green",0); - CW(" RawValue: " + instData->RawValue); - - CounterSample sample = instData->Sample; - Console::Write(" Data from CounterSample object:\n" + - " CounterType: {0,-27} SystemFrequency: {1}\n" + - " BaseValue: {2,-27} RawValue: {3}\n" + - " CounterFrequency: {4,-27} CounterTimeStamp: {5}\n" + - " TimeStamp: {6,-27} TimeStamp100nSec: {7}\n\n", - sample.CounterType, sample.SystemFrequency, sample.BaseValue, - sample.RawValue, sample.CounterFrequency, sample.CounterTimeStamp, - sample.TimeStamp, sample.TimeStamp100nSec); -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp deleted file mode 100644 index 63ae0eabe00..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; - -ref class PerfCounterCatGetCountMod -{ - // -public: - static void Main(array^ args) - { - String^ categoryName = ""; - String^ machineName = ""; - String^ instanceName = ""; - PerformanceCounterCategory^ pcc; - array^ counters; - - // Copy the supplied arguments into the local variables. - try - { - categoryName = args[1]; - machineName = args[2]=="."? "": args[2]; - instanceName = args[3]; - } - catch (...) - { - // Ignore the exception from non-supplied arguments. - } - - try - { - // Create the appropriate PerformanceCounterCategory object. - if (machineName->Length>0) - { - pcc = gcnew PerformanceCounterCategory(categoryName, machineName); - } - else - { - pcc = gcnew PerformanceCounterCategory(categoryName); - } - - // Get the counters for this instance or a single instance - // of the selected category. - if (instanceName->Length > 0) - { - counters = pcc->GetCounters(instanceName); - } - else - { - counters = pcc->GetCounters(); - } - - } - catch (Exception^ ex) - { - Console::WriteLine("Unable to get counter information for " + - (instanceName->Length>0? "instance \"{2}\" in ": "single-instance ") + - "category \"{0}\" on " + (machineName->Length>0? "computer \"{1}\":": "this computer:"), - categoryName, machineName, instanceName); - Console::WriteLine(ex->Message); - return; - } - - // Display the counter names if GetCounters was successful. - if (counters != nullptr) - { - Console::WriteLine("These counters exist in " + - (instanceName->Length > 0 ? "instance \"{1}\" of" : "single instance") + - " category {0} on " + (machineName->Length > 0 ? "computer \"{2}\":": "this computer:"), - categoryName, instanceName, machineName); - - // Display a numbered list of the counter names. - int objX; - for(objX = 0; objX < counters->Length; objX++) - { - Console::WriteLine("{0,4} - {1}", objX + 1, counters[objX]->CounterName); - } - } - } - // -}; - -int main() -{ - PerfCounterCatGetCountMod::Main(Environment::GetCommandLineArgs()); -} -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp deleted file mode 100644 index 3a2934fc5ec..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; - -ref class PerfCounterCatGetInstMod -{ - // -public: - static void Main(array^ args) - { - String^ categoryName = ""; - String^ machineName = ""; - PerformanceCounterCategory^ pcc; - array^ instances; - - // Copy the supplied arguments into the local variables. - try - { - categoryName = args[1]; - machineName = args[2]=="."? "": args[2]; - } - catch (...) - { - // Ignore the exception from non-supplied arguments. - } - - try - { - // Create the appropriate PerformanceCounterCategory object. - if (machineName->Length > 0) - { - pcc = gcnew PerformanceCounterCategory(categoryName, machineName); - } - else - { - pcc = gcnew PerformanceCounterCategory(categoryName); - } - - // Get the instances associated with this category. - instances = pcc->GetInstanceNames(); - - } - catch (Exception^ ex) - { - Console::WriteLine("Unable to get instance information for " + - "category \"{0}\" on " + - (machineName->Length>0? "computer \"{1}\":": "this computer:"), - categoryName, machineName); - Console::WriteLine(ex->Message); - return; - } - - //If an empty array is returned, the category has a single instance. - if (instances->Length==0) - { - Console::WriteLine("Category \"{0}\" on " + - (machineName->Length>0? "computer \"{1}\"": "this computer") + - " is single-instance.", pcc->CategoryName, pcc->MachineName); - } - else - { - // Otherwise, display the instances. - Console::WriteLine("These instances exist in category \"{0}\" on " + - (machineName->Length>0? "computer \"{1}\".": "this computer:"), - pcc->CategoryName, pcc->MachineName); - - Array::Sort(instances); - int objX; - for (objX = 0; objX < instances->Length; objX++) - { - Console::WriteLine("{0,4} - {1}", objX+1, instances[objX]); - } - } - } - // -}; - -int main() -{ - PerfCounterCatGetInstMod::Main(Environment::GetCommandLineArgs()); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp deleted file mode 100644 index 598438b1a46..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Diagnostics; - -ref class PerfCounterCatGetCatMod -{ - // -public: - static void Main(array^ args) - { - String^ machineName = ""; - array^ categories; - - // Copy the machine name argument into the local variable. - try - { - machineName = args[1]=="."? "": args[1]; - } - catch (...) - { - } - - // Generate a list of categories registered on the specified computer. - try - { - if (machineName->Length > 0) - { - categories = PerformanceCounterCategory::GetCategories(machineName); - } - else - { - categories = PerformanceCounterCategory::GetCategories(); - } - } - catch(Exception^ ex) - { - Console::WriteLine("Unable to get categories on " + - (machineName->Length > 0 ? "computer \"{0}\":": "this computer:"), machineName); - Console::WriteLine(ex->Message); - return; - } - - Console::WriteLine("These categories are registered on " + - (machineName->Length > 0 ? "computer \"{0}\":": "this computer:"), machineName); - - // Create and sort an array of category names. - array^ categoryNames = gcnew array(categories->Length); - int objX; - for (objX = 0; objX < categories->Length; objX++) - { - categoryNames[objX] = categories[objX]->CategoryName; - } - Array::Sort(categoryNames); - - for (objX = 0; objX < categories->Length; objX++) - { - Console::WriteLine("{0,4} - {1}", objX + 1, categoryNames[objX]); - } - } - // -}; - -int main() -{ - PerfCounterCatGetCatMod::Main(Environment::GetCommandLineArgs()); -} -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp deleted file mode 100644 index 43756bed5b8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// -///////////////////////////////////////////////////////////////////////////////// -// -// NAME TraceSource2.cpp : main project file -// -///////////////////////////////////////////////////////////////////////////////// - - - -// The following configuration file can be used with this sample. -// When using a configuration file #define ConfigFile. -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// -// - -#define TRACE -//#define ConfigFile - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Diagnostics; -using namespace System::Reflection; -using namespace System::IO; -using namespace System::Security::Permissions; - -void DisplayProperties(TraceSource^ ts); // Forward Declaration - - -int main() -{ - TraceSource^ ts = gcnew TraceSource("TraceTest"); - - try - { - // Initialize trace switches. -#if(!ConfigFile) - SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose"); - ts->Switch = sourceSwitch; - int idxConsole = ts->Listeners->Add(gcnew System::Diagnostics::ConsoleTraceListener()); - ts->Listeners[idxConsole]->Name = "console"; -#endif - DisplayProperties(ts); - ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::Callstack; - ts->TraceEvent(TraceEventType::Warning, 1); - ts->Listeners["console"]->TraceOutputOptions = TraceOptions::DateTime; - // Issue file not found message as a warning. - ts->TraceEvent(TraceEventType::Warning, 2, "File Test not found"); - // Issue file not found message as a verbose event using a formatted string. - ts->TraceEvent(TraceEventType::Verbose, 3, "File {0} not found.", "test"); - // Issue file not found message as information. - ts->TraceInformation("File {0} not found.", "test"); - ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::LogicalOperationStack; - // Issue file not found message as an error event. - ts->TraceEvent(TraceEventType::Error, 4, "File {0} not found.", "test"); - - // Test the filter on the ConsoleTraceListener. - ts->Listeners["console"]->Filter = gcnew SourceFilter("No match"); - ts->TraceData(TraceEventType::Error, 5, - "SourceFilter should reject this message for the console trace listener."); - ts->Listeners["console"]->Filter = gcnew SourceFilter("TraceTest"); - ts->TraceData(TraceEventType::Error, 6, - "SourceFilter should let this message through on the console trace listener."); - ts->Listeners["console"]->Filter = nullptr; - - // Use the TraceData method. - ts->TraceData(TraceEventType::Warning, 7, gcnew array{ "Message 1", "Message 2" }); - - // Activity tests. - ts->TraceEvent(TraceEventType::Start, 9, "Will not appear until the switch is changed."); - ts->Switch->Level = SourceLevels::ActivityTracing | SourceLevels::Critical; - ts->TraceEvent(TraceEventType::Suspend, 10, "Switch includes ActivityTracing, this should appear"); - ts->TraceEvent(TraceEventType::Critical, 11, "Switch includes Critical, this should appear"); - ts->Flush(); - ts->Close(); - Console::WriteLine("Press enter key to exit."); - Console::Read(); - } - catch (Exception ^e) - { - // Catch any unexpected exception. - Console::WriteLine("Unexpected exception: " + e->ToString()); - Console::Read(); - } -} - - -void DisplayProperties(TraceSource^ ts) -{ - Console::WriteLine("TraceSource name = " + ts->Name); -// Console::WriteLine("TraceSource switch level = " + ts->Switch->Level); // error C3063: operator '+': all operands must have the same enumeration type - Console::WriteLine("TraceSource switch level = {0}", ts->Switch->Level); // SUCCESS: does compile. Weird - Console::WriteLine("TraceSource Attributes Count " + ts->Attributes->Count); // SUCCESS: also compiles. Really weird - Console::WriteLine("TraceSource Attributes Count = {0}", ts->Attributes->Count); // SUCCESS: okay, I give up. Somebody call me a cab. - - Console::WriteLine("TraceSource switch = " + ts->Switch->DisplayName); - array^ switches = SwitchAttribute::GetAll(TraceSource::typeid->Assembly); - - for (int i = 0; i < switches->Length; i++) - { - Console::WriteLine("Switch name = " + switches[i]->SwitchName); - Console::WriteLine("Switch type = " + switches[i]->SwitchType); - } - -#if(ConfigFile) - // Get the custom attributes for the TraceSource. - Console::WriteLine("Number of custom trace source attributes = " - + ts.Attributes.Count); - foreach (DictionaryEntry de in ts.Attributes) - Console::WriteLine("Custom trace source attribute = " - + de.Key + " " + de.Value); - // Get the custom attributes for the trace source switch. - foreach (DictionaryEntry de in ts.Switch.Attributes) - Console::WriteLine("Custom switch attribute = " - + de.Key + " " + de.Value); -#endif - Console::WriteLine("Number of listeners = " + ts->Listeners->Count); - for each (TraceListener ^ traceListener in ts->Listeners) - { - Console::Write("TraceListener: " + traceListener->Name + "\t"); - // The following output can be used to update the configuration file. - Console::WriteLine("AssemblyQualifiedName = " + - (traceListener->GetType()->AssemblyQualifiedName)); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp deleted file mode 100644 index b208ee69e6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// ToStringCPP.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -int main(array ^args) -{ - double value = 16325.62901; - String^ specifier; - CultureInfo^ culture; - - // Use standard numeric format specifiers. - specifier = "G"; - culture = CultureInfo::CreateSpecificCulture("eu-ES"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16325,62901 - Console::WriteLine(value.ToString(specifier, CultureInfo::InvariantCulture)); - // Displays: 16325.62901 - - specifier = "C"; - culture = CultureInfo::CreateSpecificCulture("en-US"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: $16,325.63 - culture = CultureInfo::CreateSpecificCulture("en-GB"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: £16,325.63 - - specifier = "E04"; - culture = CultureInfo::CreateSpecificCulture("sv-SE"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 1,6326E+004 - culture = CultureInfo::CreateSpecificCulture("en-NZ"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 1.6326E+004 - - specifier = "F"; - culture = CultureInfo::CreateSpecificCulture("fr-FR"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16325,63 - culture = CultureInfo::CreateSpecificCulture("en-CA"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16325.63 - - specifier = "N"; - culture = CultureInfo::CreateSpecificCulture("es-ES"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16.325,63 - culture = CultureInfo::CreateSpecificCulture("fr-CA"); - Console::WriteLine(value.ToString(specifier, culture)); - // Displays: 16 325,63 - - specifier = "P"; - culture = CultureInfo::InvariantCulture; - Console::WriteLine((value/10000).ToString(specifier, culture)); - // Displays: 163.26 % - culture = CultureInfo::CreateSpecificCulture("ar-EG"); - Console::WriteLine((value/10000).ToString(specifier, culture)); - // Displays: 163.256 % - - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp deleted file mode 100644 index 69e9a30d33e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp +++ /dev/null @@ -1,223 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ numbers= {1054.32179, -195489100.8377, 1.0437E21, - -1.0573e-05}; - array^ specifiers = { "C", "E", "e", "F", "G", "N", "P", - "R", "#,000.000", "0.###E-000", - "000,000,000,000.00###" }; - for each (Double number in numbers) - { - Console::WriteLine("Formatting of {0}:", number); - for each (String^ specifier in specifiers) { - Console::WriteLine(" {0,-22} {1}", - specifier + ":", number.ToString(specifier)); - // Add precision specifiers from 0 to 3. - if (specifier->Length == 1 & ! specifier->Equals("R")) { - for (int precision = 0; precision <= 3; precision++) { - String^ pSpecifier = String::Format("{0}{1}", specifier, precision); - Console::WriteLine(" {0,-22} {1}", - pSpecifier + ":", number.ToString(pSpecifier)); - } - Console::WriteLine(); - } - } - Console::WriteLine(); - } -} -// The example displays the following output: -// Formatting of 1054.32179: -// C: $1,054.32 -// C0: $1,054 -// C1: $1,054.3 -// C2: $1,054.32 -// C3: $1,054.322 -// -// E: 1.054322E+003 -// E0: 1E+003 -// E1: 1.1E+003 -// E2: 1.05E+003 -// E3: 1.054E+003 -// -// e: 1.054322e+003 -// e0: 1e+003 -// e1: 1.1e+003 -// e2: 1.05e+003 -// e3: 1.054e+003 -// -// F: 1054.32 -// F0: 1054 -// F1: 1054.3 -// F2: 1054.32 -// F3: 1054.322 -// -// G: 1054.32179 -// G0: 1054.32179 -// G1: 1E+03 -// G2: 1.1E+03 -// G3: 1.05E+03 -// -// N: 1,054.32 -// N0: 1,054 -// N1: 1,054.3 -// N2: 1,054.32 -// N3: 1,054.322 -// -// P: 105,432.18 % -// P0: 105,432 % -// P1: 105,432.2 % -// P2: 105,432.18 % -// P3: 105,432.179 % -// -// R: 1054.32179 -// #,000.000: 1,054.322 -// 0.###E-000: 1.054E003 -// 000,000,000,000.00###: 000,000,001,054.32179 -// -// Formatting of -195489100.8377: -// C: ($195,489,100.84) -// C0: ($195,489,101) -// C1: ($195,489,100.8) -// C2: ($195,489,100.84) -// C3: ($195,489,100.838) -// -// E: -1.954891E+008 -// E0: -2E+008 -// E1: -2.0E+008 -// E2: -1.95E+008 -// E3: -1.955E+008 -// -// e: -1.954891e+008 -// e0: -2e+008 -// e1: -2.0e+008 -// e2: -1.95e+008 -// e3: -1.955e+008 -// -// F: -195489100.84 -// F0: -195489101 -// F1: -195489100.8 -// F2: -195489100.84 -// F3: -195489100.838 -// -// G: -195489100.8377 -// G0: -195489100.8377 -// G1: -2E+08 -// G2: -2E+08 -// G3: -1.95E+08 -// -// N: -195,489,100.84 -// N0: -195,489,101 -// N1: -195,489,100.8 -// N2: -195,489,100.84 -// N3: -195,489,100.838 -// -// P: -19,548,910,083.77 % -// P0: -19,548,910,084 % -// P1: -19,548,910,083.8 % -// P2: -19,548,910,083.77 % -// P3: -19,548,910,083.770 % -// -// R: -195489100.8377 -// #,000.000: -195,489,100.838 -// 0.###E-000: -1.955E008 -// 000,000,000,000.00###: -000,195,489,100.8377 -// -// Formatting of 1.0437E+21: -// C: $1,043,700,000,000,000,000,000.00 -// C0: $1,043,700,000,000,000,000,000 -// C1: $1,043,700,000,000,000,000,000.0 -// C2: $1,043,700,000,000,000,000,000.00 -// C3: $1,043,700,000,000,000,000,000.000 -// -// E: 1.043700E+021 -// E0: 1E+021 -// E1: 1.0E+021 -// E2: 1.04E+021 -// E3: 1.044E+021 -// -// e: 1.043700e+021 -// e0: 1e+021 -// e1: 1.0e+021 -// e2: 1.04e+021 -// e3: 1.044e+021 -// -// F: 1043700000000000000000.00 -// F0: 1043700000000000000000 -// F1: 1043700000000000000000.0 -// F2: 1043700000000000000000.00 -// F3: 1043700000000000000000.000 -// -// G: 1.0437E+21 -// G0: 1.0437E+21 -// G1: 1E+21 -// G2: 1E+21 -// G3: 1.04E+21 -// -// N: 1,043,700,000,000,000,000,000.00 -// N0: 1,043,700,000,000,000,000,000 -// N1: 1,043,700,000,000,000,000,000.0 -// N2: 1,043,700,000,000,000,000,000.00 -// N3: 1,043,700,000,000,000,000,000.000 -// -// P: 104,370,000,000,000,000,000,000.00 % -// P0: 104,370,000,000,000,000,000,000 % -// P1: 104,370,000,000,000,000,000,000.0 % -// P2: 104,370,000,000,000,000,000,000.00 % -// P3: 104,370,000,000,000,000,000,000.000 % -// -// R: 1.0437E+21 -// #,000.000: 1,043,700,000,000,000,000,000.000 -// 0.###E-000: 1.044E021 -// 000,000,000,000.00###: 1,043,700,000,000,000,000,000.00 -// -// Formatting of -1.0573E-05: -// C: $0.00 -// C0: $0 -// C1: $0.0 -// C2: $0.00 -// C3: $0.000 -// -// E: -1.057300E-005 -// E0: -1E-005 -// E1: -1.1E-005 -// E2: -1.06E-005 -// E3: -1.057E-005 -// -// e: -1.057300e-005 -// e0: -1e-005 -// e1: -1.1e-005 -// e2: -1.06e-005 -// e3: -1.057e-005 -// -// F: 0.00 -// F0: 0 -// F1: 0.0 -// F2: 0.00 -// F3: 0.000 -// -// G: -1.0573E-05 -// G0: -1.0573E-05 -// G1: -1E-05 -// G2: -1.1E-05 -// G3: -1.06E-05 -// -// N: 0.00 -// N0: 0 -// N1: 0.0 -// N2: 0.00 -// N3: 0.000 -// -// P: 0.00 % -// P0: 0 % -// P1: 0.0 % -// P2: 0.00 % -// P3: -0.001 % -// -// R: -1.0573E-05 -// #,000.000: 000.000 -// 0.###E-000: -1.057E-005 -// 000,000,000,000.00###: -000,000,000,000.00001 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp deleted file mode 100644 index 7d153608b4c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp +++ /dev/null @@ -1,150 +0,0 @@ -using namespace System; - -int main() -{ - // - Double d = 4.55; - // - - // - Console::WriteLine( "A double is of type {0}.", d.GetType() ); - // - - // - bool done = false; - String^ inp; - do - { - Console::Write( "Enter a real number: " ); - inp = Console::ReadLine(); - try - { - d = Double::Parse( inp ); - Console::WriteLine( "You entered {0}.", d ); - done = true; - } - catch ( FormatException^ ) - { - Console::WriteLine( "You did not enter a number." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred while parsing your response: {0}", e ); - } - - } - while ( !done ); - // - - // - if ( d > Double::MaxValue ) - { - Console::WriteLine( "Your number is bigger than a double." ); - } - // - - // - if ( d < Double::MinValue ) - { - Console::WriteLine( "Your number is smaller than a double." ); - } - // - - // - Console::WriteLine( "Epsilon, or the permittivity of a vacuum, has value {0}", Double::Epsilon ); - // - - // - Double zero = 0; - - // This condition will return false. - if ( (0 / zero) == Double::NaN ) - { - Console::WriteLine( "0 / 0 can be tested with Double::NaN." ); - } - else - { - Console::WriteLine( "0 / 0 cannot be tested with Double::NaN; use Double::IsNan() instead." ); - } - // - - // - // This will return true. - if ( Double::IsNaN( 0 / zero ) ) - { - Console::WriteLine( "Double::IsNan() can determine whether a value is not-a-number." ); - } - // - - // - // This will equal Infinity. - Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Double::NegativeInfinity) ); - // - - // - // This will equal Infinity. - Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Double::PositiveInfinity + 10.0) ); - // - - // - // This will return S"true". - Console::WriteLine( "IsInfinity(3.0 / 0) == {0}.", Double::IsInfinity( 3.0 / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return S"true". - Console::WriteLine( "IsPositiveInfinity(4.0 / 0) == {0}.", Double::IsPositiveInfinity( 4.0 / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return S"true". - Console::WriteLine( "IsNegativeInfinity(-5.0 / 0) == {0}.", Double::IsNegativeInfinity( -5.0 / zero ) ? (String^)"true" : "false" ); - // - - // - Double a; - a = 500; - Object^ obj1; - // - - // - // The variables point to the same objects. - Object^ obj2; - obj1 = a; - obj2 = obj1; - if ( Double::ReferenceEquals( obj1, obj2 ) ) - { - Console::WriteLine( "The variables point to the same double object." ); - } - else - { - Console::WriteLine( "The variables point to different double objects." ); - } - // - - // - obj1 = (Double)450; - if ( a.CompareTo( obj1 ) < 0 ) - { - Console::WriteLine( "{0} is less than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) > 0 ) - { - Console::WriteLine( "{0} is greater than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) == 0 ) - { - Console::WriteLine( "{0} equals {1}.", a, obj1 ); - } - // - - // - obj1 = (Double)500; - if ( a.Equals( obj1 ) ) - { - Console::WriteLine( "The value type and reference type values are equal." ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp deleted file mode 100644 index 9a426f16689..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -void main() -{ - if (Environment::OSVersion->Platform == PlatformID::Win32NT) - { - // Change the directory to %WINDIR% - Environment::CurrentDirectory = Environment::GetEnvironmentVariable( "windir" ); - DirectoryInfo^ info = gcnew DirectoryInfo( "." ); - - Console::WriteLine("Directory Info: {0}", info->FullName); - } - else - { - Console::WriteLine("This example runs on Windows only."); - } -} -// The example displays output like the following on a .NET implementation running on Windows: -// Directory Info: C:\windows -// The example displays the following output on a .NET implementation on Unix-based systems: -// This example runs on Windows only. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp deleted file mode 100644 index dcea5c7890b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -// -// Example for the Exception( ) constructor. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception with a predefined message. - public ref class NotEvenException: public Exception - { - public: - NotEvenException() - : Exception( "The argument to a function requiring " - "even input is not divisible by 2." ) - {} - - }; - - - // Half throws a base exception if the input is not even. - int Half( int input ) - { - if ( input % 2 != 0 ) - throw gcnew Exception; - else - return input / 2; - } - - - // Half2 throws a derived exception if the input is not even. - int Half2( int input ) - { - if ( input % 2 != 0 ) - throw gcnew NotEvenException; - else - return input / 2; - } - - - // CalcHalf calls Half and catches any thrown exceptions. - void CalcHalf( int input ) - { - try - { - int halfInput = Half( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - - - // CalcHalf2 calls Half2 and catches any thrown exceptions. - void CalcHalf2( int input ) - { - try - { - int halfInput = Half2( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of the Exception( ) constructor " - "generates the following output." ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "parameterless constructor of the base class.\n" ); - NDP_UE_CPP::CalcHalf( 12 ); - NDP_UE_CPP::CalcHalf( 15 ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "parameterless constructor of a derived class.\n" ); - NDP_UE_CPP::CalcHalf2( 24 ); - NDP_UE_CPP::CalcHalf2( 27 ); -} - -/* -This example of the Exception( ) constructor generates the following output. - -Here, an exception is thrown using the -parameterless constructor of the base class. - -Half of 12 is 6. -System.Exception: Exception of type System.Exception was thrown. - at NDP_UE_CPP.Half(Int32 input) - at NDP_UE_CPP.CalcHalf(Int32 input) - -Here, an exception is thrown using the -parameterless constructor of a derived class. - -Half of 24 is 12. -NDP_UE_CPP.NotEvenException: The argument to a function requiring even input is - not divisible by 2. - at NDP_UE_CPP.Half2(Int32 input) - at NDP_UE_CPP.CalcHalf2(Int32 input) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp deleted file mode 100644 index 680a5c851ed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp +++ /dev/null @@ -1,116 +0,0 @@ - -// -// Example for the Exception( String* ) constructor. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception with a specifiable message. - public ref class NotEvenException: public Exception - { - private: - static String^ notEvenMessage = "The argument to a function requiring " - "even input is not divisible by 2."; - - public: - NotEvenException() - : Exception( notEvenMessage ) - {} - - NotEvenException( String^ auxMessage ) - : Exception( String::Format( "{0} - {1}", auxMessage, notEvenMessage ) ) - {} - - }; - - - // Half throws a base exception if the input is not even. - int Half( int input ) - { - if ( input % 2 != 0 ) - throw gcnew Exception( String::Format( "The argument {0} is not divisible by 2.", input ) ); - else - return input / 2; - } - - - // Half2 throws a derived exception if the input is not even. - int Half2( int input ) - { - if ( input % 2 != 0 ) - throw gcnew NotEvenException( String::Format( "Invalid argument: {0}", input ) ); - else - return input / 2; - } - - - // CalcHalf calls Half and catches any thrown exceptions. - void CalcHalf( int input ) - { - try - { - int halfInput = Half( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - - - // CalcHalf2 calls Half2 and catches any thrown exceptions. - void CalcHalf2( int input ) - { - try - { - int halfInput = Half2( input ); - Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of the Exception( String* )\n" - "constructor generates the following output." ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "constructor of the base class.\n" ); - NDP_UE_CPP::CalcHalf( 18 ); - NDP_UE_CPP::CalcHalf( 21 ); - Console::WriteLine( "\nHere, an exception is thrown using the \n" - "constructor of a derived class.\n" ); - NDP_UE_CPP::CalcHalf2( 30 ); - NDP_UE_CPP::CalcHalf2( 33 ); -} - -/* -This example of the Exception( String* ) -constructor generates the following output. - -Here, an exception is thrown using the -constructor of the base class. - -Half of 18 is 9. -System.Exception: The argument 21 is not divisible by 2. - at NDP_UE_CPP.Half(Int32 input) - at NDP_UE_CPP.CalcHalf(Int32 input) - -Here, an exception is thrown using the -constructor of a derived class. - -Half of 30 is 15. -NDP_UE_CPP.NotEvenException: Invalid argument: 33 - The argument to a function -requiring even input is not divisible by 2. - at NDP_UE_CPP.Half2(Int32 input) - at NDP_UE_CPP.CalcHalf2(Int32 input) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp deleted file mode 100644 index c1923e2fbc7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp +++ /dev/null @@ -1,109 +0,0 @@ - -// -// Example for the Exception( String*, Exception* ) constructor. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception with a specifiable message and inner exception. - public ref class LogTableOverflowException: public Exception - { - private: - static String^ overflowMessage = "The log table has overflowed."; - - public: - LogTableOverflowException() - : Exception( overflowMessage ) - {} - - LogTableOverflowException( String^ auxMessage ) - : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ) ) - {} - - LogTableOverflowException( String^ auxMessage, Exception^ inner ) - : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) - {} - - }; - - public ref class LogTable - { - public: - LogTable( int numElements ) - { - logArea = gcnew array(numElements); - elemInUse = 0; - } - - - protected: - array^logArea; - int elemInUse; - - public: - - // The AddRecord method throws a derived exception - // if the array bounds exception is caught. - int AddRecord( String^ newRecord ) - { - try - { - logArea[ elemInUse ] = newRecord; - return elemInUse++; - } - catch ( Exception^ ex ) - { - throw gcnew LogTableOverflowException( String::Format( "Record \"{0}\" was not logged.", newRecord ),ex ); - } - - } - - }; - - - // Create a log table and force an overflow. - void ForceOverflow() - { - LogTable^ log = gcnew LogTable( 4 ); - try - { - for ( int count = 1; ; count++ ) - { - log->AddRecord( String::Format( "Log record number {0}", count ) ); - - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of the Exception( String*, Exception* )\n" - "constructor generates the following output." ); - Console::WriteLine( "\nExample of a derived exception " - "that references an inner exception:\n" ); - NDP_UE_CPP::ForceOverflow(); -} - -/* -This example of the Exception( String*, Exception* ) -constructor generates the following output. - -Example of a derived exception that references an inner exception: - -NDP_UE_CPP.LogTableOverflowException: The log table has overflowed. - Record "L -og record number 5" was not logged. ---> System.IndexOutOfRangeException: Index - was outside the bounds of the array. - at NDP_UE_CPP.LogTable.AddRecord(String newRecord) - --- End of inner exception stack trace --- - at NDP_UE_CPP.LogTable.AddRecord(String newRecord) - at NDP_UE_CPP.ForceOverflow() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp deleted file mode 100644 index 38d74dc3b35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp +++ /dev/null @@ -1,137 +0,0 @@ - -// -// Example for the Exception::GetBaseException method. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Define two derived exceptions to demonstrate nested exceptions. - ref class SecondLevelException: public Exception - { - public: - SecondLevelException( String^ message, Exception^ inner ) - : Exception( message, inner ) - {} - - }; - - ref class ThirdLevelException: public Exception - { - public: - ThirdLevelException( String^ message, Exception^ inner ) - : Exception( message, inner ) - {} - - }; - - - // DivideBy0 forces a division by 0 and throws a second exception. - void DivideBy0() - { - try - { - int zero = 0; - int ecks = 1 / zero; - } - catch ( Exception^ ex ) - { - throw gcnew SecondLevelException( "Forced a division by 0 and threw " - "a second exception.",ex ); - } - - } - - - // This function catches the exception from the called function - // DivideBy0( ) and throws another in response. - void Rethrow() - { - try - { - DivideBy0(); - } - catch ( Exception^ ex ) - { - throw gcnew ThirdLevelException( "Caught the second exception and " - "threw a third in response.",ex ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of Exception.GetBaseException " - "generates the following output." ); - Console::WriteLine( "\nThe program forces a division by 0, " - "then throws the exception \ntwice more, " - "using a different derived exception each time.\n" ); - try - { - - // This function calls another that forces a division by 0. - NDP_UE_CPP::Rethrow(); - } - catch ( Exception^ e ) - { - Exception^ current; - Console::WriteLine( "Unwind the nested exceptions using " - "the InnerException property:\n" ); - - // This code unwinds the nested exceptions using the - // InnerException property. - current = e; - while ( current != (Object^)0 ) - { - Console::WriteLine( current->ToString() ); - Console::WriteLine(); - current = current->InnerException; - } - - // Display the innermost exception. - Console::WriteLine( "Display the base exception using the \n" - "GetBaseException method:\n" ); - Console::WriteLine( e->GetBaseException()->ToString() ); - } - -} - -/* -This example of Exception.GetBaseException generates the following output. - -The program forces a division by 0, then throws the exception -twice more, using a different derived exception each time. - -Unwind the nested exceptions using the InnerException property: - -NDP_UE_CPP.ThirdLevelException: Caught the second exception and threw a third i -n response. ---> NDP_UE_CPP.SecondLevelException: Forced a division by 0 and th -rew a second exception. ---> System.DivideByZeroException: Attempted to divide -by zero. - at NDP_UE_CPP.DivideBy0() - --- End of inner exception stack trace --- - at NDP_UE_CPP.DivideBy0() - at NDP_UE_CPP.Rethrow() - --- End of inner exception stack trace --- - at NDP_UE_CPP.Rethrow() - at main() - -NDP_UE_CPP.SecondLevelException: Forced a division by 0 and threw a second exce -ption. ---> System.DivideByZeroException: Attempted to divide by zero. - at NDP_UE_CPP.DivideBy0() - --- End of inner exception stack trace --- - at NDP_UE_CPP.DivideBy0() - at NDP_UE_CPP.Rethrow() - -System.DivideByZeroException: Attempted to divide by zero. - at NDP_UE_CPP.DivideBy0() - -Display the base exception using the -GetBaseException method: - -System.DivideByZeroException: Attempted to divide by zero. - at NDP_UE_CPP.DivideBy0() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp deleted file mode 100644 index 02481fe745f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp +++ /dev/null @@ -1,149 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Soap; - -// Define a serializable derived exception class. - -[Serializable] -ref class SecondLevelException: public Exception, public ISerializable -{ -public: - - // This public constructor is used by class instantiators. - SecondLevelException( String^ message, Exception^ inner ) - : Exception( message, inner ) - { - HelpLink = "http://MSDN.Microsoft.com"; - Source = "Exception_Class_Samples"; - } - - -protected: - - // This protected constructor is used for deserialization. - SecondLevelException( SerializationInfo^ info, StreamingContext context ) - : Exception( info, context ) - {} - - -public: - - // GetObjectData performs a custom serialization. - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] - virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override - { - - // Change the case of two properties, and then use the - // method of the base class. - HelpLink = HelpLink->ToLower(); - Source = Source->ToUpperInvariant(); - Exception::GetObjectData( info, context ); - } - -}; - -int main() -{ - Console::WriteLine( "This example of the Exception constructor " - "and Exception.GetObjectData\nwith Serialization" - "Info and StreamingContext parameters " - "generates \nthe following output.\n" ); - try - { - - // This code forces a division by 0 and catches the - // resulting exception. - try - { - int zero = 0; - int ecks = 1 / zero; - } - catch ( Exception^ ex ) - { - - // Create a new exception to throw again. - SecondLevelException^ newExcept = gcnew SecondLevelException( "Forced a division by 0 and threw " - "another exception.",ex ); - Console::WriteLine( "Forced a division by 0, caught the " - "resulting exception, \n" - "and created a derived exception:\n" ); - Console::WriteLine( "HelpLink: {0}", newExcept->HelpLink ); - Console::WriteLine( "Source: {0}", newExcept->Source ); - - // This FileStream is used for the serialization. - FileStream^ stream = gcnew FileStream( "NewException.dat",FileMode::Create ); - try - { - - // Serialize the derived exception. - SoapFormatter^ formatter = gcnew SoapFormatter( nullptr,StreamingContext(StreamingContextStates::File) ); - formatter->Serialize( stream, newExcept ); - - // Rewind the stream and deserialize the - // exception. - stream->Position = 0; - SecondLevelException^ deserExcept = dynamic_cast(formatter->Deserialize( stream )); - Console::WriteLine( "\nSerialized the exception, and then " - "deserialized the resulting stream " - "into a \nnew exception. " - "The deserialization changed the case " - "of certain properties:\n" ); - - // Throw the deserialized exception again. - throw deserExcept; - } - catch ( SerializationException^ se ) - { - Console::WriteLine( "Failed to serialize: {0}", se->ToString() ); - } - finally - { - stream->Close(); - } - - } - - } - catch ( Exception^ ex ) - { - Console::WriteLine( "HelpLink: {0}", ex->HelpLink ); - Console::WriteLine( "Source: {0}", ex->Source ); - Console::WriteLine(); - Console::WriteLine( ex->ToString() ); - } - -} - -/* -This example of the Exception constructor and Exception.GetObjectData -with SerializationInfo and StreamingContext parameters generates -the following output. - -Forced a division by 0, caught the resulting exception, -and created a derived exception: - -HelpLink: http://MSDN.Microsoft.com -Source: Exception_Class_Samples - -Serialized the exception, and then deserialized the resulting stream into a -new exception. The deserialization changed the case of certain properties: - -HelpLink: http://msdn.microsoft.com -Source: EXCEPTION_CLASS_SAMPLES - -SecondLevelException: Forced a division by 0 and threw another exception. ---> S -ystem.DivideByZeroException: Attempted to divide by zero. - at main() - --- End of inner exception stack trace --- - at main() - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp deleted file mode 100644 index b3714fff6d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -// Example for the Exception::HResult property. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Create the derived exception class. - ref class SecondLevelException: public Exception - { - private: - static int SecondLevelHResult = (int)0x81234567; - - public: - - // Set HResult for this exception, and include it in - // the exception message. - SecondLevelException( String^ message, Exception^ inner ) - : Exception( String::Format( "(HRESULT:0x{1:X8}) {0}", message, SecondLevelHResult ), inner ) - { - HResult = SecondLevelHResult; - } - - }; - - - // This function forces a division by 0 and throws - // a second exception. - void DivideBy0() - { - try - { - try - { - int zero = 0; - int ecks = 1 / zero; - } - catch ( Exception^ ex ) - { - throw gcnew SecondLevelException( "Forced a division by 0 and threw " - "a second exception.",ex ); - } - - } - catch ( Exception^ ex ) - { - Console::WriteLine( ex->ToString() ); - } - - } - -} - -int main() -{ - NDP_UE_CPP::DivideBy0(); -} - -/* -This example of Exception::HResult generates the following output. - -NDP_UE_CPP.SecondLevelException: (HRESULT:0x81234567) Forced a division by 0 an -d threw a second exception. ---> System.DivideByZeroException: Attempted to div -ide by zero. - at NDP_UE_CPP.DivideBy0() - --- End of inner exception stack trace --- - at NDP_UE_CPP.DivideBy0() -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj deleted file mode 100644 index 62a1c06daf2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - NDP_UE_CPP - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp deleted file mode 100644 index 5597ab64333..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -// -// Example for the Exception::HelpLink, Exception::Source, -// Exception::StackTrace, and Exception::TargetSite properties. -using namespace System; - -namespace NDP_UE_CPP -{ - - // Derive an exception; the constructor sets the HelpLink and - // Source properties. - public ref class LogTableOverflowException: public Exception - { - private: - static String^ overflowMessage = "The log table has overflowed."; - - public: - LogTableOverflowException( String^ auxMessage, Exception^ inner ) - : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) - { - this->HelpLink = "https://learn.microsoft.com"; - this->Source = "Exception_Class_Samples"; - } - - }; - - public ref class LogTable - { - public: - LogTable( int numElements ) - { - logArea = gcnew array(numElements); - elemInUse = 0; - } - - - protected: - array^logArea; - int elemInUse; - - public: - - // The AddRecord method throws a derived exception if - // the array bounds exception is caught. - int AddRecord( String^ newRecord ) - { - try - { - logArea[ elemInUse ] = newRecord; - return elemInUse++; - } - catch ( Exception^ ex ) - { - throw gcnew LogTableOverflowException( String::Format( "Record \"{0}\" was not logged.", newRecord ),ex ); - } - - } - - }; - - - // Create a log table and force an overflow. - void ForceOverflow() - { - LogTable^ log = gcnew LogTable( 4 ); - try - { - for ( int count = 1; ; count++ ) - { - log->AddRecord( String::Format( "Log record number {0}", count ) ); - - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "\nMessage ---\n{0}", ex->Message ); - Console::WriteLine( "\nHelpLink ---\n{0}", ex->HelpLink ); - Console::WriteLine( "\nSource ---\n{0}", ex->Source ); - Console::WriteLine( "\nStackTrace ---\n{0}", ex->StackTrace ); - Console::WriteLine( "\nTargetSite ---\n{0}", ex->TargetSite->ToString() ); - } - - } - -} - -int main() -{ - Console::WriteLine( "This example of \n Exception::Message, \n" - " Exception::HelpLink, \n Exception::Source, \n" - " Exception::StackTrace, and \n Exception::" - "TargetSite \ngenerates the following output." ); - NDP_UE_CPP::ForceOverflow(); -} - -/* -This example of - Exception::Message, - Exception::HelpLink, - Exception::Source, - Exception::StackTrace, and - Exception::TargetSite -generates the following output. - -Message --- -The log table has overflowed. - Record "Log record number 5" was not logged. - -HelpLink --- -https://learn.microsoft.com - -Source --- -Exception_Class_Samples - -StackTrace --- - at NDP_UE_CPP.LogTable.AddRecord(String newRecord) - at NDP_UE_CPP.ForceOverflow() - -TargetSite --- -Int32 AddRecord(System.String) -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp deleted file mode 100644 index f572f53062b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp +++ /dev/null @@ -1,79 +0,0 @@ - -// -using namespace System; - -// Define an Enum without FlagsAttribute. -public enum class SingleHue : short -{ - None = 0, - Black = 1, - Red = 2, - Green = 4, - Blue = 8 -}; - -// Define an Enum with FlagsAttribute. -[Flags] -enum class MultiHue : short -{ - None = 0, - Black = 1, - Red = 2, - Green = 4, - Blue = 8 -}; - -int main() -{ - // Display all possible combinations of values. - Console::WriteLine( - "All possible combinations of values without FlagsAttribute:"); - for (int val = 0; val <= 16; val++) - Console::WriteLine("{0,3} - {1:G}", val, (SingleHue)val); - - Console::WriteLine( - "\nAll possible combinations of values with FlagsAttribute:"); - - // Display all combinations of values, and invalid values. - for (int val = 0; val <= 16; val++ ) - Console::WriteLine("{0,3} - {1:G}", val, (MultiHue)val); -} -// The example displays the following output: -// All possible combinations of values without FlagsAttribute: -// 0 - None -// 1 - Black -// 2 - Red -// 3 - 3 -// 4 - Green -// 5 - 5 -// 6 - 6 -// 7 - 7 -// 8 - Blue -// 9 - 9 -// 10 - 10 -// 11 - 11 -// 12 - 12 -// 13 - 13 -// 14 - 14 -// 15 - 15 -// 16 - 16 -// -// All possible combinations of values with FlagsAttribute: -// 0 - None -// 1 - Black -// 2 - Red -// 3 - Black, Red -// 4 - Green -// 5 - Black, Green -// 6 - Red, Green -// 7 - Black, Red, Green -// 8 - Blue -// 9 - Black, Blue -// 10 - Red, Blue -// 11 - Black, Red, Blue -// 12 - Green, Blue -// 13 - Black, Green, Blue -// 14 - Red, Green, Blue -// 15 - Black, Red, Green, Blue -// 16 - 16 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp deleted file mode 100644 index 71b62c4c010..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -using namespace System; - -[Flags] -enum class PhoneService -{ - None = 0, - LandLine = 1, - Cell = 2, - Fax = 4, - Internet = 8, - Other = 16 -}; - -void main() -{ - // Define three variables representing the types of phone service - // in three households. - PhoneService household1 = PhoneService::LandLine | PhoneService::Cell | - PhoneService::Internet; - PhoneService household2 = PhoneService::None; - PhoneService household3 = PhoneService::Cell | PhoneService::Internet; - - // Store the variables in an array for ease of access. - array^ households = { household1, household2, household3 }; - - // Which households have no service? - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has phone service: {1}", - ctr + 1, - households[ctr] == PhoneService::None ? - "No" : "Yes"); - Console::WriteLine(); - - // Which households have cell phone service? - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has cell phone service: {1}", - ctr + 1, - (households[ctr] & PhoneService::Cell) == PhoneService::Cell ? - "Yes" : "No"); - Console::WriteLine(); - - // Which households have cell phones and land lines? - PhoneService cellAndLand = PhoneService::Cell | PhoneService::LandLine; - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has cell and land line service: {1}", - ctr + 1, - (households[ctr] & cellAndLand) == cellAndLand ? - "Yes" : "No"); - Console::WriteLine(); - - // List all types of service of each household?// - for (int ctr = 0; ctr < households->Length; ctr++) - Console::WriteLine("Household {0} has: {1:G}", - ctr + 1, households[ctr]); - Console::WriteLine(); -} -// The example displays the following output: -// Household 1 has phone service: Yes -// Household 2 has phone service: No -// Household 3 has phone service: Yes -// -// Household 1 has cell phone service: Yes -// Household 2 has cell phone service: No -// Household 3 has cell phone service: Yes -// -// Household 1 has cell and land line service: Yes -// Household 2 has cell and land line service: No -// Household 3 has cell and land line service: No -// -// Household 1 has: LandLine, Cell, Internet -// Household 2 has: None -// Household 3 has: Cell, Internet -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp deleted file mode 100644 index 55b8b589334..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp +++ /dev/null @@ -1,44 +0,0 @@ -using namespace System; -using namespace System::Linq; -using namespace System::Collections; -using namespace System::Collections::Generic; - -// -// Declare a delegate -delegate String ^ MyDel(String ^); - -// Create wrapper class and function that takes in a string and converts it to uppercase -ref class DelegateWrapper { -public: - String ^ ToUpper(String ^ s) { - return s->ToUpper(); - } -}; - -int main() { - // Declare delegate - DelegateWrapper ^ delegateWrapper = gcnew DelegateWrapper; - MyDel ^ DelInst = gcnew MyDel(delegateWrapper, &DelegateWrapper::ToUpper); - - // Cast into Func - Func ^ selector = reinterpret_cast ^>(DelInst); - - // Create an array of strings - array ^ words = { "orange", "apple", "Article", "elephant" }; - - // Query the array and select strings according to the selector method - Generic::IEnumerable ^ aWords = Enumerable::Select((Generic::IEnumerable^)words, selector); - - // Output the results to the console - for each(String ^ word in aWords) - Console::WriteLine(word); - /* - This code example produces the following output: - - ORANGE - APPLE - ARTICLE - ELEPHANT - */ -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp deleted file mode 100644 index 8583565fa53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; - -const int maxGarbage = 1000; - -void MakeSomeGarbage() -{ - Version^ vt; - for ( int i = 0; i < maxGarbage; i++ ) { - // Create objects and release them to fill up memory with unused objects. - vt = gcnew Version; - } -} - -void main() -{ - // Put some objects in memory. - MakeSomeGarbage(); - Console::WriteLine("Memory used before collection: {0:N0}", - GC::GetTotalMemory( false ) ); - - // Collect all generations of memory. - GC::Collect(); - Console::WriteLine("Memory used after full collection: {0:N0}", - GC::GetTotalMemory( true ) ); -} -// The output from the example resembles the following: -// Memory used before collection: 79,392 -// Memory used after full collection: 52,640 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp deleted file mode 100644 index e3587de2c56..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp +++ /dev/null @@ -1,72 +0,0 @@ - -// -using namespace System; -ref class MyGCCollectClass -{ -private: - static const long maxGarbage = 1000; - -public: - void MakeSomeGarbage() - { - Version^ vt; - for ( int i = 0; i < maxGarbage; i++ ) - { - - // Create objects and release them to fill up memory - // with unused objects. - vt = gcnew Version; - - } - } - -}; - -int main() -{ - - // Create a strong reference to an Object. - MyGCCollectClass^ myGCCol = gcnew MyGCCollectClass; - - // Put some objects in memory. - myGCCol->MakeSomeGarbage(); - - // Get the generation of managed memory where myGCCol is stored. - Console::WriteLine( "The object is in generation: {0}", GC::GetGeneration( myGCCol ) ); - - // Perform a full garbage collection. - // Because there is a strong reference to myGCCol, it will - // not be garbage collected. - GC::Collect(); - - // Get the generation of managed memory where myGCCol is stored. - Console::WriteLine( "The object is in generation: {0}", GC::GetGeneration( myGCCol ) ); - - // Create a WeakReference to myGCCol. - WeakReference^ wkref = gcnew WeakReference( myGCCol ); - - // Remove the strong reference to myGCCol. - myGCCol = nullptr; - - // Get the generation of managed memory where wkref is stored. - Console::WriteLine( "The WeakReference to the object is in generation: {0}", GC::GetGeneration( wkref ) ); - - // Perform another full garbage collection. - // A WeakReference will not survive a garbage collection. - GC::Collect(); - - // Try to get the generation of managed memory where wkref is stored. - // Because it has been collected, an exception will be thrown. - try - { - Console::WriteLine( "The WeakReference to the object is in generation: {0}", GC::GetGeneration( wkref ) ); - Console::Read(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The WeakReference to the object has been garbage collected: ' {0}'", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp deleted file mode 100644 index b457b3d8f57..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp +++ /dev/null @@ -1,108 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Runtime::InteropServices; - -// A simple class that exposes two static Win32 functions. -// One is a delegate type and the other is an enumerated type. -public ref class MyWin32 -{ -public: - - // An enumerated type for the control messages sent to the handler routine. - enum class CtrlTypes - { - CTRL_C_EVENT = 0, - CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT = 5, - CTRL_SHUTDOWN_EVENT - }; - - delegate Boolean HandlerRoutine( // A delegate type to be used as the Handler Routine for SetConsoleCtrlHandler. - CtrlTypes CtrlType ); - - // Declare the SetConsoleCtrlHandler function as external and receiving a delegate. - - [DllImport("Kernel32")] - static Boolean SetConsoleCtrlHandler( HandlerRoutine^ Handler, Boolean Add ); -}; - -public ref class MyApp -{ -private: - - // A private static handler function in the MyApp class. - static Boolean Handler( MyWin32::CtrlTypes CtrlType ) - { - String^ message = "This message should never be seen!"; - - // A switch to handle the event type. - switch ( CtrlType ) - { - case MyWin32::CtrlTypes::CTRL_C_EVENT: - message = "A CTRL_C_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_BREAK_EVENT: - message = "A CTRL_BREAK_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_CLOSE_EVENT: - message = "A CTRL_CLOSE_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_LOGOFF_EVENT: - message = "A CTRL_LOGOFF_EVENT was raised by the user."; - break; - - case MyWin32::CtrlTypes::CTRL_SHUTDOWN_EVENT: - message = "A CTRL_SHUTDOWN_EVENT was raised by the user."; - break; - } - - // Use interop to display a message for the type of event. - Console::WriteLine( message ); - return true; - } - - -public: - static void Test() - { - - // Use interop to set a console control handler. - MyWin32::HandlerRoutine^ hr = gcnew MyWin32::HandlerRoutine( Handler ); - MyWin32::SetConsoleCtrlHandler( hr, true ); - - // Give the user some time to raise a few events. - Console::WriteLine( "Waiting 30 seconds for console ctrl events..." ); - - // The Object hr is not referred to again. - // The garbage collector can detect that the object has no - // more managed references and might clean it up here while - // the unmanaged SetConsoleCtrlHandler method is still using it. - // Force a garbage collection to demonstrate how the hr - // object will be handled. - GC::Collect(); - GC::WaitForPendingFinalizers(); - GC::Collect(); - Thread::Sleep( 30000 ); - - // Display a message to the console when the unmanaged method - // has finished its work. - Console::WriteLine( "Finished!" ); - - // Call GC::KeepAlive(hr) at this point to maintain a reference to hr. - // This will prevent the garbage collector from collecting the - // object during the execution of the SetConsoleCtrlHandler method. - GC::KeepAlive( hr ); - } - -}; - -int main() -{ - MyApp::Test(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp deleted file mode 100644 index 9a8cc79ec77..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -using namespace System; -ref class MyFinalizeObject -{ -public: - static MyFinalizeObject^ currentInstance = nullptr; - -private: - bool hasFinalized; - -public: - MyFinalizeObject() - { - hasFinalized = false; - } - - ~MyFinalizeObject() - { - if ( !hasFinalized ) - { - Console::WriteLine( "First finalization" ); - - // Put this object back into a root by creating - // a reference to it. - MyFinalizeObject::currentInstance = this; - - // Indicate that this instance has finalized once. - hasFinalized = true; - - // Place a reference to this object back in the - // finalization queue. - GC::ReRegisterForFinalize( this ); - } - else - { - Console::WriteLine( "Second finalization" ); - } - } - -}; - -int main() -{ - - // Create a MyFinalizeObject. - MyFinalizeObject^ mfo = gcnew MyFinalizeObject; - - // Release the reference to mfo. - mfo = nullptr; - - // Force a garbage collection. - GC::Collect(); - - // At this point mfo will have gone through the first Finalize. - // There should now be a reference to mfo in the static - // MyFinalizeObject::currentInstance field. Setting this value - // to 0 and forcing another garbage collection will now - // cause the object to Finalize permanently. - MyFinalizeObject::currentInstance = nullptr; - GC::Collect(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp deleted file mode 100644 index c542afe35eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// -using namespace System; -ref class MyFinalizeObject -{ -private: - - // Make this number very large to cause the finalizer to - // do more work. - literal int maxIterations = 10000; - ~MyFinalizeObject() - { - Console::WriteLine( "Finalizing a MyFinalizeObject" ); - - // Do some work. - for ( int i = 0; i < maxIterations; i++ ) - { - - // This method performs no operation on i, but prevents - // the JIT compiler from optimizing away the code inside - // the loop. - GC::KeepAlive( i ); - - } - } - -}; - - -// You can increase this number to fill up more memory. -const int numMfos = 1000; - -// You can increase this number to cause more -// post-finalization work to be done. -const int maxIterations = 100; -int main() -{ - MyFinalizeObject^ mfo = nullptr; - - // Create and release a large number of objects - // that require finalization. - for ( int j = 0; j < numMfos; j++ ) - { - mfo = gcnew MyFinalizeObject; - - } - - //Release the last object created in the loop. - mfo = nullptr; - - //Force garbage collection. - GC::Collect(); - - // Wait for all finalizers to complete before continuing. - // Without this call to GC::WaitForPendingFinalizers, - // the worker loop below might execute at the same time - // as the finalizers. - // With this call, the worker loop executes only after - // all finalizers have been called. - GC::WaitForPendingFinalizers(); - - // Worker loop to perform post-finalization code. - for ( int i = 0; i < maxIterations; i++ ) - { - Console::WriteLine( "Doing some post-finalize work" ); - - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp deleted file mode 100644 index 4e3179203c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// The following code example shows how the result of GetWeekOfYear varies depending on the -// FirstDayOfWeek and the CalendarWeekRule used. -// If the specified date is the last day of the year, GetWeekOfYear returns the total number of weeks in that year. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Gets the Calendar instance associated with a CultureInfo. - CultureInfo^ myCI = gcnew CultureInfo( "en-US" ); - Calendar^ myCal = myCI->Calendar; - - // Gets the DTFI properties required by GetWeekOfYear. - CalendarWeekRule myCWR = myCI->DateTimeFormat->CalendarWeekRule; - DayOfWeek myFirstDOW = myCI->DateTimeFormat->FirstDayOfWeek; - - // Displays the number of the current week relative to the beginning of the year. - Console::WriteLine( "The CalendarWeekRule used for the en-US culture is {0}.", myCWR ); - Console::WriteLine( "The FirstDayOfWeek used for the en-US culture is {0}.", myFirstDOW ); - Console::WriteLine( "Therefore, the current week is Week {0} of the current year.", myCal->GetWeekOfYear( DateTime::Now, myCWR, myFirstDOW ) ); - - // Displays the total number of weeks in the current year. - DateTime LastDay = System::DateTime( DateTime::Now.Year, 12, 31 ); - Console::WriteLine( "There are {0} weeks in the current year ( {1}).", myCal->GetWeekOfYear( LastDay, myCWR, myFirstDOW ), LastDay.Year ); -} - -/* -This code produces the following output. Results vary depending on the system date. - -The CalendarWeekRule used for the en-US culture is FirstDay. -The FirstDayOfWeek used for the en-US culture is Sunday. -Therefore, the current week is Week 1 of the current year. -There are 53 weeks in the current year (2001). -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp deleted file mode 100644 index 0df7a5a06b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp +++ /dev/null @@ -1,77 +0,0 @@ - -// The following code example demonstrates the members of the Calendar class. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine( " Hour: {0}", myCal->GetHour( myDT ) ); - Console::WriteLine( " Minute: {0}", myCal->GetMinute( myDT ) ); - Console::WriteLine( " Second: {0}", myCal->GetSecond( myDT ) ); - Console::WriteLine( " Milliseconds: {0}", myCal->GetMilliseconds( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Uses the default calendar of the InvariantCulture. - Calendar^ myCal = CultureInfo::InvariantCulture->Calendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds 5 to every component of the DateTime. - myDT = myCal->AddYears( myDT, 5 ); - myDT = myCal->AddMonths( myDT, 5 ); - myDT = myCal->AddWeeks( myDT, 5 ); - myDT = myCal->AddDays( myDT, 5 ); - myDT = myCal->AddHours( myDT, 5 ); - myDT = myCal->AddMinutes( myDT, 5 ); - myDT = myCal->AddSeconds( myDT, 5 ); - myDT = myCal->AddMilliseconds( myDT, 5 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding 5 to each component of the DateTime:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar: -Era: 1 -Year: 2002 -Month: 4 -DayOfYear: 93 -DayOfMonth: 3 -DayOfWeek: Wednesday -Hour: 0 -Minute: 0 -Second: 0 -Milliseconds: 0 - -After adding 5 to each component of the DateTime: -Era: 1 -Year: 2007 -Month: 10 -DayOfYear: 286 -DayOfMonth: 13 -DayOfWeek: Saturday -Hour: 5 -Minute: 5 -Second: 5 -Milliseconds: 5 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp deleted file mode 100644 index 865e7a9526e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -// The following code example compares different implementations of the Calendar class. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates an instance of every Calendar type. - array^myCals = gcnew array(8); - myCals[ 0 ] = gcnew GregorianCalendar; - myCals[ 1 ] = gcnew HebrewCalendar; - myCals[ 2 ] = gcnew HijriCalendar; - myCals[ 3 ] = gcnew JapaneseCalendar; - myCals[ 4 ] = gcnew JulianCalendar; - myCals[ 5 ] = gcnew KoreanCalendar; - myCals[ 6 ] = gcnew TaiwanCalendar; - myCals[ 7 ] = gcnew ThaiBuddhistCalendar; - - // For each calendar, displays the current year, the number of months in that year, - // and the number of days in each month of that year. - int i; - int j; - int iYear; - int iMonth; - int iDay; - DateTime myDT = DateTime::Today; - for ( i = 0; i < myCals->Length; i++ ) - { - iYear = myCals[ i ]->GetYear( myDT ); - Console::WriteLine(); - Console::WriteLine( " {0}, Year: {1}", myCals[ i ]->GetType(), myCals[ i ]->GetYear( myDT ) ); - Console::WriteLine( " MonthsInYear: {0}", myCals[ i ]->GetMonthsInYear( iYear ) ); - Console::WriteLine( " DaysInYear: {0}", myCals[ i ]->GetDaysInYear( iYear ) ); - Console::WriteLine( " Days in each month:" ); - Console::Write( " " ); - for ( j = 1; j <= myCals[ i ]->GetMonthsInYear( iYear ); j++ ) - Console::Write( " {0, -5}", myCals[ i ]->GetDaysInMonth( iYear, j ) ); - Console::WriteLine(); - iMonth = myCals[ i ]->GetMonth( myDT ); - iDay = myCals[ i ]->GetDayOfMonth( myDT ); - Console::WriteLine( " IsLeapDay: {0}", myCals[ i ]->IsLeapDay( iYear, iMonth, iDay ) ); - Console::WriteLine( " IsLeapMonth: {0}", myCals[ i ]->IsLeapMonth( iYear, iMonth ) ); - Console::WriteLine( " IsLeapYear: {0}", myCals[ i ]->IsLeapYear( iYear ) ); - - } -} - -/* -This code produces the following output. The results vary depending on the date. - -System::Globalization::GregorianCalendar, Year: 2002 -MonthsInYear: 12 -DaysInYear: 365 -Days in each month: -31 28 31 30 31 30 31 31 30 31 30 31 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: False - -System::Globalization::HebrewCalendar, Year: 5763 -MonthsInYear: 13 -DaysInYear: 385 -Days in each month: -30 30 30 29 30 30 29 30 29 30 29 30 29 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: True - -System::Globalization::HijriCalendar, Year: 1423 -MonthsInYear: 12 -DaysInYear: 355 -Days in each month: -30 29 30 29 30 29 30 29 30 29 30 30 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: True - -System::Globalization::JapaneseCalendar, Year: 14 -MonthsInYear: 12 -DaysInYear: 365 -Days in each month: -31 28 31 30 31 30 31 31 30 31 30 31 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: False - -System::Globalization::JulianCalendar, Year: 2002 -MonthsInYear: 12 -DaysInYear: 365 -Days in each month: -31 28 31 30 31 30 31 31 30 31 30 31 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: False - -System::Globalization::KoreanCalendar, Year: 4335 -MonthsInYear: 12 -DaysInYear: 365 -Days in each month: -31 28 31 30 31 30 31 31 30 31 30 31 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: False - -System::Globalization::TaiwanCalendar, Year: 91 -MonthsInYear: 12 -DaysInYear: 365 -Days in each month: -31 28 31 30 31 30 31 31 30 31 30 31 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: False - -System::Globalization::ThaiBuddhistCalendar, Year: 2545 -MonthsInYear: 12 -DaysInYear: 365 -Days in each month: -31 28 31 30 31 30 31 31 30 31 30 31 -IsLeapDay: False -IsLeapMonth: False -IsLeapYear: False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp deleted file mode 100644 index 868fb637de7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// The following code example shows the values returned by each method for different types of characters. -// -using namespace System; -using namespace System::Globalization; -void PrintProperties( Char c ); -int main() -{ - Console::WriteLine( " c Num Dig Dec UnicodeCategory" ); - Console::Write( "U+0061 LATIN SMALL LETTER A " ); - PrintProperties( L'a' ); - Console::Write( "U+0393 GREEK CAPITAL LETTER GAMMA " ); - PrintProperties( L'\u0393' ); - Console::Write( "U+0039 DIGIT NINE " ); - PrintProperties( L'9' ); - Console::Write( "U+00B2 SUPERSCRIPT TWO " ); - PrintProperties( L'\u00B2' ); - Console::Write( "U+00BC VULGAR FRACTION ONE QUARTER " ); - PrintProperties( L'\u00BC' ); - Console::Write( "U+0BEF TAMIL DIGIT NINE " ); - PrintProperties( L'\u0BEF' ); - Console::Write( "U+0BF0 TAMIL NUMBER TEN " ); - PrintProperties( L'\u0BF0' ); - Console::Write( "U+0F33 TIBETAN DIGIT HALF ZERO " ); - PrintProperties( L'\u0F33' ); - Console::Write( "U+2788 CIRCLED SANS-SERIF DIGIT NINE " ); - PrintProperties( L'\u2788' ); -} - -void PrintProperties( Char c ) -{ - Console::Write( " {0,-3}", c ); - Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( c ) ); - Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( c ) ); - Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( c ) ); - Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( c ) ); -} - -/* -This code produces the following output. Some characters might not display at the console. - - c Num Dig Dec UnicodeCategory -U+0061 LATIN SMALL LETTER A a -1 -1 -1 LowercaseLetter -U+0393 GREEK CAPITAL LETTER GAMMA Γ -1 -1 -1 UppercaseLetter -U+0039 DIGIT NINE 9 9 9 9 DecimalDigitNumber -U+00B2 SUPERSCRIPT TWO ² 2 2 -1 OtherNumber -U+00BC VULGAR FRACTION ONE QUARTER ¼ 0.25 -1 -1 OtherNumber -U+0BEF TAMIL DIGIT NINE ௯ 9 9 9 DecimalDigitNumber -U+0BF0 TAMIL NUMBER TEN ௰ 10 -1 -1 OtherNumber -U+0F33 TIBETAN DIGIT HALF ZERO ༳ -0.5 -1 -1 OtherNumber -U+2788 CIRCLED SANS-SERIF DIGIT NINE ➈ 9 9 -1 OtherNumber - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp deleted file mode 100644 index 1ff91fb5a7e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// The following code example shows the values returned by each method for different types of characters. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // The String to get information for. - String^ s = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788"; - Console::WriteLine( "String: {0}", s ); - - // Print the values for each of the characters in the string. - Console::WriteLine( "index c Num Dig Dec UnicodeCategory" ); - for ( int i = 0; i < s->Length; i++ ) - { - Console::Write( "{0,-5} {1,-3}", i, s[ i ] ); - Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( s, i ) ); - Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( s, i ) ); - Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( s, i ) ); - Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( s, i ) ); - - } -} - -/* -This code produces the following output. Some characters might not display at the console. - -String: a9Γ²¼௯௰➈ -index c Num Dig Dec UnicodeCategory -0 a -1 -1 -1 LowercaseLetter -1 9 9 9 9 DecimalDigitNumber -2 Γ -1 -1 -1 UppercaseLetter -3 ² 2 2 -1 OtherNumber -4 ¼ 0.25 -1 -1 OtherNumber -5 ௯ 9 9 9 DecimalDigitNumber -6 ௰ 10 -1 -1 OtherNumber -7 ➈ 9 9 -1 OtherNumber - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp deleted file mode 100644 index 96de17a4d52..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// The following code example compares portions of two strings using the different CompareInfo instances: -// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort, -// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and -// a CompareInfo instance associated with the InvariantCulture. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "calle"; - String^ myStr2 = "calor"; - - // Uses GetCompareInfo to create the CompareInfo that uses the S"es-ES" culture with international sort. - CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" ); - - // Uses GetCompareInfo to create the CompareInfo that uses the S"es-ES" culture with traditional sort. - CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A ); - - // Uses the CompareInfo property of the InvariantCulture. - CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo; - - // Compares two strings using myCompIntl. - Console::WriteLine( "Comparing \" {0}\" and \" {1}\"", myStr1->Substring( 2, 2 ), myStr2->Substring( 2, 2 ) ); - Console::WriteLine( " With myCompIntl->Compare: {0}", myCompIntl->Compare( myStr1, 2, 2, myStr2, 2, 2 ) ); - Console::WriteLine( " With myCompTrad->Compare: {0}", myCompTrad->Compare( myStr1, 2, 2, myStr2, 2, 2 ) ); - Console::WriteLine( " With myCompInva->Compare: {0}", myCompInva->Compare( myStr1, 2, 2, myStr2, 2, 2 ) ); -} - -/* -This code produces the following output. - -Comparing S"ll" and S"lo" -With myCompIntl.Compare: -1 -With myCompTrad.Compare: 1 -With myCompInva.Compare: -1 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp deleted file mode 100644 index 4c7273f97da..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// The following code example compares portions of two strings using different CompareOptions settings. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "My Uncle Bill's clients"; - String^ myStr2 = "My uncle bills clients"; - - // Creates a CompareInfo that uses the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // Compares two strings using myComp. - Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 3, 10 ), myStr2->Substring( 3, 10 ) ); - Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10 ) ); - Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::None ) ); - Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::Ordinal ) ); - Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::StringSort ) ); - Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::IgnoreCase ) ); - Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::IgnoreSymbols ) ); - Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) ); -} - -/* -This code produces the following output. - -Comparing "Uncle Bill" and "uncle bill" - With no CompareOptions : 1 - With None : 1 - With Ordinal : -32 - With StringSort : 1 - With IgnoreCase : 0 - With IgnoreSymbols : 1 - With IgnoreCase and IgnoreSymbols : 0 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp deleted file mode 100644 index 678b54b5912..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// The following code example compares portions of two strings using the different CompareInfo instances: -// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort, -// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and -// a CompareInfo instance associated with the InvariantCulture. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "calle"; - String^ myStr2 = "calor"; - - // Uses GetCompareInfo to create the CompareInfo that - // uses the S"es-ES" culture with international sort. - CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" ); - - // Uses GetCompareInfo to create the CompareInfo that - // uses the S"es-ES" culture with traditional sort. - CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A ); - - // Uses the CompareInfo property of the InvariantCulture. - CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo; - - // Compares two strings using myCompIntl. - Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 2 ), myStr2->Substring( 2 ) ); - Console::WriteLine( " With myCompIntl::Compare: {0}", myCompIntl->Compare( myStr1, 2, myStr2, 2 ) ); - Console::WriteLine( " With myCompTrad::Compare: {0}", myCompTrad->Compare( myStr1, 2, myStr2, 2 ) ); - Console::WriteLine( " With myCompInva::Compare: {0}", myCompInva->Compare( myStr1, 2, myStr2, 2 ) ); -} - -/* -This code produces the following output. - -Comparing "lle" and "lor" - With myCompIntl::Compare: -1 - With myCompTrad::Compare: 1 - With myCompInva::Compare: -1 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp deleted file mode 100644 index b180520da7d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// The following code example compares portions of two strings using different CompareOptions settings. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "My Uncle Bill's clients"; - String^ myStr2 = "My uncle bills clients"; - - // Creates a CompareInfo that uses the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // Compares two strings using myComp. - Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 10 ), myStr2->Substring( 10 ) ); - Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, 10, myStr2, 10 ) ); - Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::None ) ); - Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::Ordinal ) ); - Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::StringSort ) ); - Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::IgnoreCase ) ); - Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::IgnoreSymbols ) ); - Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, 10, myStr2, 10, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) ); -} - -/* -This code produces the following output. - -Comparing "ill's clients" and "ills clients" - With no CompareOptions : 1 - With None : 1 - With Ordinal : -76 - With StringSort : -1 - With IgnoreCase : 1 - With IgnoreSymbols : 0 - With IgnoreCase and IgnoreSymbols : 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp deleted file mode 100644 index f479b4c5433..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -// The following code example compares two strings using the different CompareInfo instances: -// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort, -// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and -// a CompareInfo instance associated with the InvariantCulture. -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "calle"; - String^ myStr2 = "calor"; - - // Uses GetCompareInfo to create the CompareInfo that - // uses the S"es-ES" culture with international sort. - CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" ); - - // Uses GetCompareInfo to create the CompareInfo that - // uses the S"es-ES" culture with traditional sort. - CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A ); - - // Uses the CompareInfo property of the InvariantCulture. - CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo; - - // Compares two strings using myCompIntl. - Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 ); - Console::WriteLine( " With myCompIntl::Compare: {0}", myCompIntl->Compare( myStr1, myStr2 ) ); - Console::WriteLine( " With myCompTrad::Compare: {0}", myCompTrad->Compare( myStr1, myStr2 ) ); - Console::WriteLine( " With myCompInva::Compare: {0}", myCompInva->Compare( myStr1, myStr2 ) ); -} - -/* -This code produces the following output. - -Comparing "calle" and "calor" - With myCompIntl::Compare: -1 - With myCompTrad::Compare: 1 - With myCompInva::Compare: -1 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp deleted file mode 100644 index 2e1193e0288..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// The following code example compares two strings using different CompareOptions settings. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "My Uncle Bill's clients"; - String^ myStr2 = "My uncle bills clients"; - - // Creates a CompareInfo which uses the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // Compares two strings using myComp. - Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 ); - Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, myStr2 ) ); - Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::None ) ); - Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::Ordinal ) ); - Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::StringSort ) ); - Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::IgnoreCase ) ); - Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::IgnoreSymbols ) ); - Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, myStr2, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) ); -} - -/* -This code produces the following output. - -Comparing "My Uncle Bill's clients" and "My uncle bills clients" - With no CompareOptions : 1 - With None : 1 - With Ordinal : -32 - With StringSort : -1 - With IgnoreCase : 1 - With IgnoreSymbols : 1 - With IgnoreCase and IgnoreSymbols : 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp deleted file mode 100644 index b82a9f2e5ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp +++ /dev/null @@ -1,118 +0,0 @@ - -// The following code example determines the indexes of the first and last occurrences of a character or a substring within a string. -// -using namespace System; -using namespace System::Globalization; -void PrintMarker( String^ Prefix, int First, int Last ) -{ - - // Determines the size of the array to create. - int mySize; - if ( Last > First ) - mySize = Last; - else - mySize = First; - - if ( mySize > -1 ) - { - - // Creates an array of Char to hold the markers. - array^myCharArr = gcnew array(mySize + 1); - - // Inserts the appropriate markers. - if ( First > -1 ) - myCharArr[ First ] = 'f'; - if ( Last > -1 ) - myCharArr[ Last ] = 'l'; - if ( First == Last ) - myCharArr[ First ] = 'b'; - - // Displays the array of Char as a String. - Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) ); - } - else - Console::WriteLine( Prefix ); -} - -int main() -{ - - // Creates CompareInfo for the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // Searches for the ligature Æ. - String^ myStr = "Is AE or ae the same as Æ or æ?"; - Console::WriteLine(); - Console::WriteLine( "No options : {0}", myStr ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE" ), myComp->LastIndexOf( myStr, "AE" ) ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae" ), myComp->LastIndexOf( myStr, "ae" ) ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ' ), myComp->LastIndexOf( myStr, L'Æ' ) ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ' ), myComp->LastIndexOf( myStr, L'æ' ) ); - Console::WriteLine( "Ordinal : {0}", myStr ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "AE", CompareOptions::Ordinal ) ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "ae", CompareOptions::Ordinal ) ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Æ', CompareOptions::Ordinal ) ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'æ', CompareOptions::Ordinal ) ); - Console::WriteLine( "IgnoreCase : {0}", myStr ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "AE", CompareOptions::IgnoreCase ) ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "ae", CompareOptions::IgnoreCase ) ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Æ', CompareOptions::IgnoreCase ) ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'æ', CompareOptions::IgnoreCase ) ); - - // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. - myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?"; - Console::WriteLine(); - Console::WriteLine( "No options : {0}", myStr ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308" ), myComp->LastIndexOf( myStr, "U\u0308" ) ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308" ), myComp->LastIndexOf( myStr, "u\u0308" ) ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü' ), myComp->LastIndexOf( myStr, L'Ü' ) ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü' ), myComp->LastIndexOf( myStr, L'ü' ) ); - Console::WriteLine( "Ordinal : {0}", myStr ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "U\u0308", CompareOptions::Ordinal ) ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "u\u0308", CompareOptions::Ordinal ) ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Ü', CompareOptions::Ordinal ) ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'ü', CompareOptions::Ordinal ) ); - Console::WriteLine( "IgnoreCase : {0}", myStr ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "U\u0308", CompareOptions::IgnoreCase ) ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "u\u0308", CompareOptions::IgnoreCase ) ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Ü', CompareOptions::IgnoreCase ) ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'ü', CompareOptions::IgnoreCase ) ); -} - -/* -This code produces the following output. - -No options : Is AE or ae the same as Æ or æ? - AE : f l - ae : f l - Æ : f l - æ : f l -Ordinal : Is AE or ae the same as Æ or æ? - AE : b - ae : b - Æ : b - æ : b -IgnoreCase : Is AE or ae the same as Æ or æ? - AE : f l - ae : f l - Æ : f l - æ : f l - -No options : Is U" or u" the same as Ü or ü? - U" : f l - u" : f l - Ü : f l - ü : f l -Ordinal : Is U" or u" the same as Ü or ü? - U" : b - u" : b - Ü : b - ü : b -IgnoreCase : Is U" or u" the same as Ü or ü? - U" : f l - u" : f l - Ü : f l - ü : f l - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp deleted file mode 100644 index f5d3d8ae905..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp +++ /dev/null @@ -1,205 +0,0 @@ - -// The following code example determines the indexes of the first and last occurrences of a character or a substring within a portion of a string. -// Note that IndexOf and LastIndexOf are searching in different portions of the string, even with the same StartIndex parameter. -// -using namespace System; -using namespace System::Globalization; -void PrintMarker( String^ Prefix, int First, int Last ) -{ - - // Determines the size of the array to create. - int mySize; - if ( Last > First ) - mySize = Last; - else - mySize = First; - - if ( mySize > -1 ) - { - - // Creates an array of Char to hold the markers. - array^myCharArr = gcnew array(mySize + 1); - - // Inserts the appropriate markers. - if ( First > -1 ) - myCharArr[ First ] = 'f'; - if ( Last > -1 ) - myCharArr[ Last ] = 'l'; - if ( First == Last ) - myCharArr[ First ] = 'b'; - - // Displays the array of Char as a String. - Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) ); - } - else - Console::WriteLine( Prefix ); -} - -int main() -{ - - // Creates CompareInfo for the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // iS is the starting index of the substring. - int iS = 20; - - // myT1 is the string used for padding. - String^ myT1; - - // Searches for the ligature Æ. - String^ myStr = "Is AE or ae the same as Æ or æ?"; - Console::WriteLine(); - myT1 = gcnew String( '-',iS ); - Console::WriteLine( "IndexOf( String, *, {0}, * )", iS ); - Console::WriteLine( "Original : {0}", myStr ); - Console::WriteLine( "No options : {0}{1}", myT1, myStr->Substring( iS ) ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS ), -1 ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS ), -1 ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS ), -1 ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS ), -1 ); - Console::WriteLine( "Ordinal : {0}{1}", myT1, myStr->Substring( iS ) ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, CompareOptions::Ordinal ), -1 ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, CompareOptions::Ordinal ), -1 ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, CompareOptions::Ordinal ), -1 ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, CompareOptions::Ordinal ), -1 ); - Console::WriteLine( "IgnoreCase : {0}{1}", myT1, myStr->Substring( iS ) ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, CompareOptions::IgnoreCase ), -1 ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, CompareOptions::IgnoreCase ), -1 ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, CompareOptions::IgnoreCase ), -1 ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, CompareOptions::IgnoreCase ), -1 ); - myT1 = gcnew String( '-',myStr->Length - iS - 1 ); - Console::WriteLine( "LastIndexOf( String, *, {0}, * )", iS ); - Console::WriteLine( "Original : {0}", myStr ); - Console::WriteLine( "No options : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); - PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS ) ); - PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS ) ); - PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS ) ); - PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS ) ); - Console::WriteLine( "Ordinal : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); - PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS, CompareOptions::Ordinal ) ); - PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS, CompareOptions::Ordinal ) ); - PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS, CompareOptions::Ordinal ) ); - PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS, CompareOptions::Ordinal ) ); - Console::WriteLine( "IgnoreCase : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); - PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS, CompareOptions::IgnoreCase ) ); - PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS, CompareOptions::IgnoreCase ) ); - PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS, CompareOptions::IgnoreCase ) ); - PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS, CompareOptions::IgnoreCase ) ); - - // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. - myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?"; - Console::WriteLine(); - myT1 = gcnew String( '-',iS ); - Console::WriteLine( "IndexOf( String, *, {0}, * )", iS ); - Console::WriteLine( "Original : {0}", myStr ); - Console::WriteLine( "No options : {0}{1}", myT1, myStr->Substring( iS ) ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS ), -1 ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS ), -1 ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS ), -1 ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS ), -1 ); - Console::WriteLine( "Ordinal : {0}{1}", myT1, myStr->Substring( iS ) ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, CompareOptions::Ordinal ), -1 ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, CompareOptions::Ordinal ), -1 ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, CompareOptions::Ordinal ), -1 ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, CompareOptions::Ordinal ), -1 ); - Console::WriteLine( "IgnoreCase : {0}{1}", myT1, myStr->Substring( iS ) ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, CompareOptions::IgnoreCase ), -1 ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, CompareOptions::IgnoreCase ), -1 ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, CompareOptions::IgnoreCase ), -1 ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, CompareOptions::IgnoreCase ), -1 ); - myT1 = gcnew String( '-',myStr->Length - iS - 1 ); - Console::WriteLine( "LastIndexOf( String, *, {0}, * )", iS ); - Console::WriteLine( "Original : {0}", myStr ); - Console::WriteLine( "No options : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); - PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS ) ); - PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS ) ); - PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS ) ); - PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS ) ); - Console::WriteLine( "Ordinal : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); - PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS, CompareOptions::Ordinal ) ); - PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS, CompareOptions::Ordinal ) ); - PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS, CompareOptions::Ordinal ) ); - PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS, CompareOptions::Ordinal ) ); - Console::WriteLine( "IgnoreCase : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); - PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS, CompareOptions::IgnoreCase ) ); - PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS, CompareOptions::IgnoreCase ) ); - PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS, CompareOptions::IgnoreCase ) ); - PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS, CompareOptions::IgnoreCase ) ); -} - -/* -This code produces the following output. - -IndexOf( String, *, 20, * ) -Original : Is AE or ae the same as Æ or æ? -No options : -------------------- as Æ or æ? - AE : f - ae : f - Æ : f - æ : f -Ordinal : -------------------- as Æ or æ? - AE : - ae : - Æ : f - æ : f -IgnoreCase : -------------------- as Æ or æ? - AE : f - ae : f - Æ : f - æ : f -LastIndexOf( String, *, 20, * ) -Original : Is AE or ae the same as Æ or æ? -No options : Is AE or ae the same ---------- - AE : l - ae : l - Æ : l - æ : l -Ordinal : Is AE or ae the same ---------- - AE : l - ae : l - Æ : - æ : -IgnoreCase : Is AE or ae the same ---------- - AE : l - ae : l - Æ : l - æ : l - -IndexOf( String, *, 20, * ) -Original : Is U" or u" the same as Ü or ü? -No options : -------------------- as Ü or ü? - U" : f - u" : f - Ü : f - ü : f -Ordinal : -------------------- as Ü or ü? - U" : - u" : - Ü : f - ü : f -IgnoreCase : -------------------- as Ü or ü? - U" : f - u" : f - Ü : f - ü : f -LastIndexOf( String, *, 20, * ) -Original : Is U" or u" the same as Ü or ü? -No options : Is U" or u" the same ---------- - U" : l - u" : l - Ü : l - ü : l -Ordinal : Is U" or u" the same ---------- - U" : l - u" : l - Ü : - ü : -IgnoreCase : Is U" or u" the same ---------- - U" : l - u" : l - Ü : l - ü : l - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp deleted file mode 100644 index 381970926e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp +++ /dev/null @@ -1,134 +0,0 @@ - -// The following code example determines the indexes of the first and last occurrences of a character or a substring within a portion of a string. -// -using namespace System; -using namespace System::Globalization; -void PrintMarker( String^ Prefix, int First, int Last ) -{ - - // Determines the size of the array to create. - int mySize; - if ( Last > First ) - mySize = Last; - else - mySize = First; - - if ( mySize > -1 ) - { - - // Creates an array of Char to hold the markers. - array^myCharArr = gcnew array(mySize + 1); - - // Inserts the appropriate markers. - if ( First > -1 ) - myCharArr[ First ] = 'f'; - if ( Last > -1 ) - myCharArr[ Last ] = 'l'; - if ( First == Last ) - myCharArr[ First ] = 'b'; - - // Displays the array of Char as a String. - Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) ); - } - else - Console::WriteLine( Prefix ); -} - -int main() -{ - - // Creates CompareInfo for the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // iS is the starting index of the substring. - int iS = 8; - - // iL is the length of the substring. - int iL = 18; - - // myT1 and myT2 are the strings used for padding. - String^ myT1 = gcnew String( '-',iS ); - String^ myT2; - - // Searches for the ligature Æ. - String^ myStr = "Is AE or ae the same as Æ or æ?"; - myT2 = gcnew String( '-',myStr->Length - iS - iL ); - Console::WriteLine(); - Console::WriteLine( "Original : {0}", myStr ); - Console::WriteLine( "No options : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL ) ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL ) ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL ) ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL ) ); - Console::WriteLine( "Ordinal : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL, CompareOptions::Ordinal ) ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL, CompareOptions::Ordinal ) ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL, CompareOptions::Ordinal ) ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL, CompareOptions::Ordinal ) ); - Console::WriteLine( "IgnoreCase : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); - PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - - // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. - myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?"; - myT2 = gcnew String( '-',myStr->Length - iS - iL ); - Console::WriteLine(); - Console::WriteLine( "Original : {0}", myStr ); - Console::WriteLine( "No options : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL ) ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL ) ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL ) ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL ) ); - Console::WriteLine( "Ordinal : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL, CompareOptions::Ordinal ) ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL, CompareOptions::Ordinal ) ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL, CompareOptions::Ordinal ) ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL, CompareOptions::Ordinal ) ); - Console::WriteLine( "IgnoreCase : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); - PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); - PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); -} - -/* -This code produces the following output. - -Original : Is AE or ae the same as Æ or æ? -No options : -------- ae the same as Æ ----- - AE : b - ae : b - Æ : b - æ : b -Ordinal : -------- ae the same as Æ ----- - AE : - ae : b - Æ : b - æ : -IgnoreCase : -------- ae the same as Æ ----- - AE : f l - ae : f l - Æ : f l - æ : f l - -Original : Is U" or u" the same as Ü or ü? -No options : -------- u" the same as Ü ----- - U" : b - u" : b - Ü : b - ü : b -Ordinal : -------- u" the same as Ü ----- - U" : - u" : b - Ü : b - ü : -IgnoreCase : -------- u" the same as Ü ----- - U" : f l - u" : f l - Ü : f l - ü : f l - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp deleted file mode 100644 index 67bd06172ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// The following code example determines whether a String* is the prefix or suffix of another String*. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "calle"; - String^ myStr2 = "llegar"; - String^ myXfix = "lle"; - - // Uses the CompareInfo property of the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - - // Determines whether myXfix is a prefix of S"calle" and S"llegar". - Console::WriteLine( "IsPrefix( {0}, {1}) : {2}", myStr1, myXfix, myComp->IsPrefix( myStr1, myXfix ) ); - Console::WriteLine( "IsPrefix( {0}, {1}) : {2}", myStr2, myXfix, myComp->IsPrefix( myStr2, myXfix ) ); - - // Determines whether myXfix is a suffix of S"calle" and S"llegar". - Console::WriteLine( "IsSuffix( {0}, {1}) : {2}", myStr1, myXfix, myComp->IsSuffix( myStr1, myXfix ) ); - Console::WriteLine( "IsSuffix( {0}, {1}) : {2}", myStr2, myXfix, myComp->IsSuffix( myStr2, myXfix ) ); -} - -/* -This code produces the following output. - -IsPrefix(calle, lle) : False -IsPrefix(llegar, lle) : True -IsSuffix(calle, lle) : True -IsSuffix(llegar, lle) : False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp deleted file mode 100644 index 4873c4342d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// The following code example determines whether a String* is the prefix or suffix of another String* using CompareOptions. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the strings to compare. - String^ myStr1 = "calle"; - String^ myStr2 = "llegar"; - String^ myXfix = "LLE"; - - // Uses the CompareInfo property of the InvariantCulture. - CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; - Console::WriteLine( "IsSuffix \"{0}\", \"{1}\"", myStr1, myXfix ); - Console::WriteLine( " With no CompareOptions : {0}", myComp->IsSuffix( myStr1, myXfix ) ); - Console::WriteLine( " With None : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::None ) ); - Console::WriteLine( " With Ordinal : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::Ordinal ) ); - Console::WriteLine( " With IgnoreCase : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::IgnoreCase ) ); - Console::WriteLine( "IsPrefix \"{0}\", \"{1}\"", myStr2, myXfix ); - Console::WriteLine( " With no CompareOptions : {0}", myComp->IsPrefix( myStr2, myXfix ) ); - Console::WriteLine( " With None : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::None ) ); - Console::WriteLine( " With Ordinal : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::Ordinal ) ); - Console::WriteLine( " With IgnoreCase : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::IgnoreCase ) ); -} - -/* -This code produces the following output. - -IsSuffix "calle", "LLE" - With no CompareOptions : False - With None : False - With Ordinal : False - With IgnoreCase : True -IsPrefix "llegar", "LLE" - With no CompareOptions : False - With None : False - With Ordinal : False - With IgnoreCase : True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp deleted file mode 100644 index 36c0e20d3fc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// The following code example shows that CultureInfo::Clone also clones the DateTimeFormatInfo and -// NumberFormatInfo instances associated with the CultureInfo. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a CultureInfo. - CultureInfo^ myCI = gcnew CultureInfo( "en-US",false ); - - // Clones myCI and modifies the DTFI and NFI instances associated with the clone. - CultureInfo^ myCIclone = dynamic_cast(myCI->Clone()); - myCIclone->DateTimeFormat->AMDesignator = "a.m."; - myCIclone->DateTimeFormat->DateSeparator = "-"; - myCIclone->NumberFormat->CurrencySymbol = "USD"; - myCIclone->NumberFormat->NumberDecimalDigits = 4; - - // Displays the properties of the DTFI and NFI instances associated with the original and with the clone. - Console::WriteLine( "DTFI/NFI PROPERTY\tORIGINAL\tMODIFIED CLONE" ); - Console::WriteLine( "DTFI.AMDesignator\t{0}\t\t{1}", myCI->DateTimeFormat->AMDesignator, myCIclone->DateTimeFormat->AMDesignator ); - Console::WriteLine( "DTFI.DateSeparator\t{0}\t\t{1}", myCI->DateTimeFormat->DateSeparator, myCIclone->DateTimeFormat->DateSeparator ); - Console::WriteLine( "NFI.CurrencySymbol\t{0}\t\t{1}", myCI->NumberFormat->CurrencySymbol, myCIclone->NumberFormat->CurrencySymbol ); - Console::WriteLine( "NFI.NumberDecimalDigits\t{0}\t\t{1}", myCI->NumberFormat->NumberDecimalDigits, myCIclone->NumberFormat->NumberDecimalDigits ); -} - -/* -This code produces the following output. - -DTFI/NFI PROPERTY ORIGINAL MODIFIED CLONE -DTFI.AMDesignator AM a.m. -DTFI.DateSeparator / - -NFI.CurrencySymbol $ USD -NFI.NumberDecimalDigits 2 4 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp deleted file mode 100644 index 39d0500f201..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -using namespace System::Threading; - -int main() -{ - // Display the name of the current thread culture. - Console::WriteLine("CurrentCulture is {0}.", CultureInfo::CurrentCulture->Name); - - // Change the current culture to th-TH. - CultureInfo::CurrentCulture = gcnew CultureInfo("th-TH",false); - Console::WriteLine("CurrentCulture is now {0}.", CultureInfo::CurrentCulture->Name); - - // Displays the name of the CurrentUICulture of the current thread. - Console::WriteLine("CurrentUICulture is {0}.", CultureInfo::CurrentCulture->Name); - - // Changes the CurrentUICulture of the current thread to ja-JP. - CultureInfo::CurrentUICulture = gcnew CultureInfo("ja-JP",false); - Console::WriteLine("CurrentUICulture is now {0}.", CultureInfo::CurrentCulture->Name); -} -// The example displays the following output: -// CurrentCulture is en-US. -// CurrentCulture is now th-TH. -// CurrentUICulture is en-US. -// CurrentUICulture is now ja-JP. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp deleted file mode 100644 index 895e3754d36..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// The following code example displays several properties of the neutral cultures. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Displays several properties of the neutral cultures. - Console::WriteLine( "CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME" ); - System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::NeutralCultures )->GetEnumerator(); - while ( enum0->MoveNext() ) - { - CultureInfo^ ci = safe_cast(enum0->Current); - Console::Write( "{0,-7}", ci->Name ); - Console::Write( " {0,-3}", ci->TwoLetterISOLanguageName ); - Console::Write( " {0,-3}", ci->ThreeLetterISOLanguageName ); - Console::Write( " {0,-3}", ci->ThreeLetterWindowsLanguageName ); - Console::Write( " {0,-40}", ci->DisplayName ); - Console::WriteLine( " {0,-40}", ci->EnglishName ); - } -} - -/* -This code produces the following output. This output has been cropped for brevity. - -CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME -ar ar ara ARA Arabic Arabic -bg bg bul BGR Bulgarian Bulgarian -ca ca cat CAT Catalan Catalan -zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) -cs cs ces CSY Czech Czech -da da dan DAN Danish Danish -de de deu DEU German German -el el ell ELL Greek Greek -en en eng ENU English English -es es spa ESP Spanish Spanish -fi fi fin FIN Finnish Finnish -zh zh zho CHS Chinese Chinese -zh-Hant zh zho CHT Chinese (Traditional) Chinese (Traditional) -zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy -zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp deleted file mode 100644 index c7d200f5865..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example determines which cultures using the Chinese language are neutral cultures. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Lists the cultures that use the Chinese language and determines if each is a neutral culture. - System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::AllCultures )->GetEnumerator(); - while ( enum0->MoveNext() ) - { - CultureInfo^ ci = safe_cast(enum0->Current); - if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) ) - { - Console::Write( "{0,-7} {1,-40}", ci->Name, ci->EnglishName ); - if ( ci->IsNeutralCulture ) - { - Console::WriteLine( ": neutral" ); - } - else - { - Console::WriteLine( ": specific" ); - } - } - } -} - -/* -This code produces the following output. - -zh-Hans Chinese (Simplified) : neutral -zh-TW Chinese (Traditional, Taiwan) : specific -zh-CN Chinese (Simplified, PRC) : specific -zh-HK Chinese (Traditional, Hong Kong S.A.R.) : specific -zh-SG Chinese (Simplified, Singapore) : specific -zh-MO Chinese (Traditional, Macao S.A.R.) : specific -zh Chinese : neutral -zh-Hant Chinese (Traditional) : neutral -zh-CHS Chinese (Simplified) Legacy : neutral -zh-CHT Chinese (Traditional) Legacy : neutral - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp deleted file mode 100644 index bc3ff941693..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// The following code example displays the parent culture of each specific -// culture using the Chinese language. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Prints the header. - Console::WriteLine( "SPECIFIC CULTURE PARENT CULTURE" ); - - // Determines the specific cultures that use the Chinese language, - // and displays the parent culture. - System::Collections::IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator(); - while ( en->MoveNext() ) - { - CultureInfo^ ci = safe_cast(en->Current); - if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) ) - { - Console::Write( "0x{0} {1} {2,-40}", ci->LCID.ToString( "X4" ), ci->Name, ci->EnglishName ); - Console::WriteLine( "0x{0} {1} {2}", ci->Parent->LCID.ToString( "X4" ), ci->Parent->Name, ci->Parent->EnglishName ); - } - } -} - -/* -This code produces the following output. - -SPECIFIC CULTURE PARENT CULTURE -0x0404 zh-TW Chinese (Traditional, Taiwan) 0x7C04 zh-CHT Chinese (Traditional) Legacy -0x0804 zh-CN Chinese (Simplified, PRC) 0x0004 zh-CHS Chinese (Simplified) Legacy -0x0C04 zh-HK Chinese (Traditional, Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy -0x1004 zh-SG Chinese (Simplified, Singapore) 0x0004 zh-CHS Chinese (Simplified) Legacy -0x1404 zh-MO Chinese (Traditional, Macao S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp deleted file mode 100644 index c2e98b06394..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// The following code example shows that CultureInfo::ReadOnly also protects the -// DateTimeFormatInfo and NumberFormatInfo instances associated with the CultureInfo. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates a CultureInfo. - CultureInfo^ myCI = gcnew CultureInfo( "en-US" ); - - // Creates a read-only CultureInfo based on myCI -> - CultureInfo^ myReadOnlyCI = CultureInfo::ReadOnly( myCI ); - - // Display the read-only status of each CultureInfo and their DateTimeFormat and NumberFormat properties. - Console::WriteLine( "myCI is {0}.", myCI->IsReadOnly ? (String^)"read only" : "writable" ); - Console::WriteLine( "myCI -> DateTimeFormat is {0}.", myCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" ); - Console::WriteLine( "myCI -> NumberFormat is {0}.", myCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" ); - Console::WriteLine( "myReadOnlyCI is {0}.", myReadOnlyCI->IsReadOnly ? (String^)"read only" : "writable" ); - Console::WriteLine( "myReadOnlyCI -> DateTimeFormat is {0}.", myReadOnlyCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" ); - Console::WriteLine( "myReadOnlyCI -> NumberFormat is {0}.", myReadOnlyCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" ); -} - -/* -This code produces the following output. - -myCI is writable. -myCI -> DateTimeFormat is writable. -myCI -> NumberFormat is writable. -myReadOnlyCI is read only. -myReadOnlyCI -> DateTimeFormat is read only. -myReadOnlyCI -> NumberFormat is read only. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp deleted file mode 100644 index 5a683e17740..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp +++ /dev/null @@ -1,63 +0,0 @@ - -// The following code example shows how to create a CultureInfo for S"Spanish - Spain" -// with the international sort and another with the traditional sort. -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes the CultureInfo which uses the international sort. - CultureInfo^ myCIintl = gcnew CultureInfo( "es-ES",false ); - - // Creates and initializes the CultureInfo which uses the traditional sort. - CultureInfo^ myCItrad = gcnew CultureInfo( 0x040A,false ); - - // Displays the properties of each culture. - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL" ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl->CompareInfo, myCItrad->CompareInfo ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl->DisplayName, myCItrad->DisplayName ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl->EnglishName, myCItrad->EnglishName ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl->IsNeutralCulture, myCItrad->IsNeutralCulture ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl->IsReadOnly, myCItrad->IsReadOnly ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "LCID", myCIintl->LCID, myCItrad->LCID ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Name", myCIintl->Name, myCItrad->Name ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl->NativeName, myCItrad->NativeName ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Parent", myCIintl->Parent, myCItrad->Parent ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl->TextInfo, myCItrad->TextInfo ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl->ThreeLetterISOLanguageName, myCItrad->ThreeLetterISOLanguageName ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl->ThreeLetterWindowsLanguageName, myCItrad->ThreeLetterWindowsLanguageName ); - Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TwoLetterISOLanguageName", myCIintl->TwoLetterISOLanguageName, myCItrad->TwoLetterISOLanguageName ); - Console::WriteLine(); - - // Compare two strings using myCIintl -> - Console::WriteLine( "Comparing \"llegar\" and \"lugar\"" ); - Console::WriteLine( " With myCIintl -> CompareInfo -> Compare: {0}", myCIintl->CompareInfo->Compare( "llegar", "lugar" ) ); - Console::WriteLine( " With myCItrad -> CompareInfo -> Compare: {0}", myCItrad->CompareInfo->Compare( "llegar", "lugar" ) ); -} - -/* -This code produces the following output. - -PROPERTY INTERNATIONAL TRADITIONAL -CompareInfo CompareInfo - es-ES CompareInfo - es-ES_tradnl -DisplayName Spanish (Spain) Spanish (Spain) -EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort) -IsNeutralCulture False False -IsReadOnly False False -LCID 3082 1034 -Name es-ES es-ES -NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional) -Parent es es -TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl -ThreeLetterISOLanguageName spa spa -ThreeLetterWindowsLanguageName ESN ESP -TwoLetterISOLanguageName es es - -Comparing "llegar" and "lugar" - With myCIintl -> CompareInfo -> Compare: -1 - With myCItrad -> CompareInfo -> Compare: 1 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp deleted file mode 100644 index c9f0bdb0a61..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of FullDateTimePattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->FullDateTimePattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. The question marks take the place of native script characters. - -CULTURE PROPERTY VALUE -en-US dddd, MMMM dd, yyyy h:mm:ss tt -ja-JP yyyy'å¹´'M'月'd'æ—¥' H:mm:ss -fr-FR dddd d MMMM yyyy HH:mm:ss - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp deleted file mode 100644 index 64fb0d7708a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of LongDatePattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->LongDatePattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output: - -CULTURE PROPERTY VALUE -en-US dddd, MMMM dd, yyyy -ja-JP yyyy'å¹´'M'月'd'æ—¥' -fr-FR dddd d MMMM yyyy - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp deleted file mode 100644 index 035bc98e2a0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of LongTimePattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->LongTimePattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. - -CULTURE PROPERTY VALUE -en-US h:mm:ss tt -ja-JP H:mm:ss -fr-FR HH:mm:ss - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp deleted file mode 100644 index 29e0b173c0f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of MonthDayPattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->MonthDayPattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. The question marks take the place of native script characters. - -CULTURE PROPERTY VALUE -en-US MMMM dd -ja-JP M'?'d'?' -fr-FR d MMMM - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp deleted file mode 100644 index 6f5088a4914..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of RFC1123Pattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->RFC1123Pattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. - -CULTURE PROPERTY VALUE -en-US ddd, dd MMM yyyy HH':'mm':'ss 'GMT' -ja-JP ddd, dd MMM yyyy HH':'mm':'ss 'GMT' -fr-FR ddd, dd MMM yyyy HH':'mm':'ss 'GMT' - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp deleted file mode 100644 index 7bc1dc8a065..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of ShortTimePattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->ShortTimePattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. - -CULTURE PROPERTY VALUE -en-US h:mm tt -ja-JP H:mm -fr-FR HH:mm - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp deleted file mode 100644 index e49b6b214a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of SortableDateTimePattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->SortableDateTimePattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. - -CULTURE PROPERTY VALUE -en-US yyyy'-'MM'-'dd'T'HH':'mm':'ss -ja-JP yyyy'-'MM'-'dd'T'HH':'mm':'ss -fr-FR yyyy'-'MM'-'dd'T'HH':'mm':'ss - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp deleted file mode 100644 index f3e77ca4e46..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// The following code example displays the value of UniversalSortableDateTimePattern -// for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->UniversalSortableDateTimePattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. - -CULTURE PROPERTY VALUE -en-US yyyy'-'MM'-'dd HH':'mm':'ss'Z' -ja-JP yyyy'-'MM'-'dd HH':'mm':'ss'Z' -fr-FR yyyy'-'MM'-'dd HH':'mm':'ss'Z' - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp deleted file mode 100644 index 549fe6aecfd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// The following code example displays the value of YearMonthPattern for selected cultures. -// -using namespace System; -using namespace System::Globalization; -void PrintPattern( String^ myCulture ) -{ - CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); - DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; - Console::WriteLine( " {0} {1}", myCulture, myDTFI->YearMonthPattern ); -} - -int main() -{ - - // Displays the values of the pattern properties. - Console::WriteLine( " CULTURE PROPERTY VALUE" ); - PrintPattern( "en-US" ); - PrintPattern( "ja-JP" ); - PrintPattern( "fr-FR" ); -} - -/* -This code produces the following output. The question marks take the place of native script characters. - - CULTURE PROPERTY VALUE - en-US MMMM yyyy - ja-JP yyyyå¹´M月 - fr-FR MMMM yyyy - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp deleted file mode 100644 index cde0e811c88..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month in each of -// 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, GregorianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: 28 28 28 29 28 -Era 1: 28 28 28 29 28 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp deleted file mode 100644 index a15e780eff2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, GregorianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: 365 365 365 366 365 -Era 1: 365 365 365 366 365 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp deleted file mode 100644 index 990c729f21e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// The following code example shows that DTFI ignores the punctuation in the -// era name only if the calendar is Gregorian and the culture uses the era name "A.D.". -// -using namespace System; -using namespace System::Globalization; -using namespace System::Collections; -int main() -{ - - // Creates strings with punctuation and without. - String^ strADPunc = "A.D."; - String^ strADNoPunc = "AD"; - String^ strCEPunc = "C.E."; - String^ strCENoPunc = "CE"; - - // Calls DTFI::GetEra for each culture that uses GregorianCalendar as the default calendar. - Console::WriteLine( " ----- AD ----- ----- CE -----" ); - Console::WriteLine( "CULTURE PUNC NO PUNC PUNC NO PUNC CALENDAR" ); - IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator(); - while ( en->MoveNext() ) - { - CultureInfo^ myCI = safe_cast(en->Current); - Console::Write( "{0, -12}", myCI ); - Console::Write( "{0,-7}{1,-9}", myCI->DateTimeFormat->GetEra( strADPunc ), myCI->DateTimeFormat->GetEra( strADNoPunc ) ); - Console::Write( "{0, -7}{1, -9}", myCI->DateTimeFormat->GetEra( strCEPunc ), myCI->DateTimeFormat->GetEra( strCENoPunc ) ); - Console::Write( "{0}", myCI->Calendar ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. This output has been cropped for brevity. - - ----- AD ----- ----- CE ----- -CULTURE PUNC NO PUNC PUNC NO PUNC CALENDAR -ar-SA -1 -1 -1 -1 System.Globalization.HijriCalendar -ar-IQ 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-EG 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-LY 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-DZ 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-MA 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-TN 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-OM 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-YE 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-SY 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-JO 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-LB 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-KW 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-AE 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-BH 1 1 -1 -1 System.Globalization.GregorianCalendar -ar-QA 1 1 -1 -1 System.Globalization.GregorianCalendar -bg-BG 1 1 -1 -1 System.Globalization.GregorianCalendar -ca-ES -1 -1 -1 -1 System.Globalization.GregorianCalendar -zh-TW -1 -1 -1 -1 System.Globalization.GregorianCalendar -zh-CN -1 -1 -1 -1 System.Globalization.GregorianCalendar -zh-HK 1 1 -1 -1 System.Globalization.GregorianCalendar -zh-SG 1 1 -1 -1 System.Globalization.GregorianCalendar -zh-MO 1 1 -1 -1 System.Globalization.GregorianCalendar -cs-CZ -1 -1 -1 -1 System.Globalization.GregorianCalendar -da-DK 1 1 -1 -1 System.Globalization.GregorianCalendar - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp deleted file mode 100644 index dfe3801afab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, GregorianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp deleted file mode 100644 index e69e21eeaba..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the second -// month (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, GregorianCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, GregorianCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp deleted file mode 100644 index 140956b9f7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in five years -// in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 2001; y <= 2005; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, GregorianCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, GregorianCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -2001: False False False False False False False False False False False False -2002: False False False False False False False False False False False False -2003: False False False False False False False False False False False False -2004: False False False False False False False False False False False False -2005: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp deleted file mode 100644 index 6331dd01784..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, GregorianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp deleted file mode 100644 index 1a0b6a1e910..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// The following code example prints a DateTime using a GregorianCalendar that is localized. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes three different CultureInfo. - CultureInfo^ myCIdeDE = gcnew CultureInfo( "de-DE",false ); - CultureInfo^ myCIenUS = gcnew CultureInfo( "en-US",false ); - CultureInfo^ myCIfrFR = gcnew CultureInfo( "fr-FR",false ); - CultureInfo^ myCIruRU = gcnew CultureInfo( "ru-RU",false ); - - // Creates a Localized GregorianCalendar. - // GregorianCalendarTypes::Localized is the default when using the GregorianCalendar constructor with->Item[Out] parameters. - Calendar^ myCal = gcnew GregorianCalendar; - - // Sets the DateTimeFormatInfo::Calendar property to a Localized GregorianCalendar. - // Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR, - myCIruRU->DateTimeFormat->Calendar = myCal; - - // Creates a DateTime. - DateTime myDT = DateTime(2002,1,3,13,30,45); - - // Displays the DateTime. - Console::WriteLine( "de-DE: {0}", myDT.ToString( "F", myCIdeDE ) ); - Console::WriteLine( "en-US: {0}", myDT.ToString( "F", myCIenUS ) ); - Console::WriteLine( "fr-FR: {0}", myDT.ToString( "F", myCIfrFR ) ); - Console::WriteLine( "ru-RU: {0}", myDT.ToString( "F", myCIruRU ) ); -} - -/* -The example displays the following output: - de-DE: Donnerstag, 3. Januar 2002 13:30:45 - en-US: Thursday, January 03, 2002 1:30:45 PM - fr-FR: jeudi 3 janvier 2002 13:30:45 - ru-RU: 3 ÑÐ½Ð²Ð°Ñ€Ñ 2002 г. 13:30:45 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp deleted file mode 100644 index 698b5b3e06f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example demonstrates how to determine the GregorianCalendar -// version supported by the culture. -// -using namespace System; -using namespace System::Globalization; -using namespace System::Collections; -int main() -{ - - // Calendar* myOptCals[] = new CultureInfo(S"ar-SA") -> OptionalCalendars; - CultureInfo^ MyCI = gcnew CultureInfo( "ar-SA" ); - array^myOptCals = MyCI->OptionalCalendars; - - // Checks which ones are GregorianCalendar then determines the GregorianCalendar version. - Console::WriteLine( "The ar-SA culture supports the following calendars:" ); - IEnumerator^ myEnum = myOptCals->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Calendar^ cal = safe_cast(myEnum->Current); - if ( cal->GetType() == GregorianCalendar::typeid ) - { - GregorianCalendar^ myGreCal = dynamic_cast(cal); - GregorianCalendarTypes calType = myGreCal->CalendarType; - Console::WriteLine( " {0} ( {1})", cal, calType ); - } - else - Console::WriteLine( " {0}", cal ); - } -} - -/* -This code produces the following output. - -The ar-SA culture supports the following calendars: - System.Globalization.HijriCalendar - System.Globalization.GregorianCalendar ( USEnglish) - System.Globalization.GregorianCalendar ( MiddleEastFrench) - System.Globalization.GregorianCalendar ( Arabic) - System.Globalization.GregorianCalendar ( Localized) - System.Globalization.GregorianCalendar ( TransliteratedFrench) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp deleted file mode 100644 index 372b38993c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Gregorian calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the GregorianCalendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar: - Era: 1 - Year: 2002 - Month: 4 - DayOfYear: 93 - DayOfMonth: 3 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 2005 - Month: 2 - DayOfYear: 34 - DayOfMonth: 3 - DayOfWeek: Thursday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp deleted file mode 100644 index f3640634df9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create an instance of the calendar. - GregorianCalendar^ myCal = gcnew GregorianCalendar; - Console::WriteLine( myCal ); - - // Display the MinSupportedDateTime. - DateTime myMin = myCal->MinSupportedDateTime; - Console::WriteLine( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::WriteLine( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.GregorianCalendar -MinSupportedDateTime: 01/01/0001 -MaxSupportedDateTime: 12/31/9999 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp deleted file mode 100644 index bc4213e8f2e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month in each of -// 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 5761 5762 5763 5764 5765 -CurrentEra: 29 29 30 30 29 -Era 1: 29 29 30 30 29 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp deleted file mode 100644 index 57e2ea00d8c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, HebrewCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 5761 5762 5763 5764 5765 -CurrentEra: 12 12 13 12 13 -Era 1: 12 12 13 12 13 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp deleted file mode 100644 index 9c1c73168c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the second month -// (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 5761; y <= 5765; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HebrewCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 5761; y <= 5765; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 5761 5762 5763 5764 5765 -CurrentEra: False False False False False -Era 1: False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp deleted file mode 100644 index 1da1268009b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in five years -// in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 5761; y <= 5765; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, HebrewCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, HebrewCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -5761: False False False False False False False False False False False False -5762: False False False False False False False False False False False False -5763: False False False False False False True False False False False False False -5764: False False False False False False False False False False False False -5765: False False False False False False True False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp deleted file mode 100644 index f7458927a3b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, HebrewCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 5761 5762 5763 5764 5765 -CurrentEra: False False True False True -Era 1: False False True False True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp deleted file mode 100644 index cadc36701b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Hebrew calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Hebrew calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the Hebrew calendar: - Era: 1 - Year: 5762 - Month: 7 - DayOfYear: 198 - DayOfMonth: 21 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 5765 - Month: 5 - DayOfYear: 138 - DayOfMonth: 21 - DayOfWeek: Monday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp deleted file mode 100644 index d739184677c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HebrewCalendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, HebrewCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 5761; y <= 5765; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 5761 5762 5763 5764 5765 -CurrentEra: 353 354 385 355 383 -Era 1: 353 354 385 355 383 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp deleted file mode 100644 index 6355880b6f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create an instance of the calendar. - HebrewCalendar^ myCal = gcnew HebrewCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.HebrewCalendar -MinSupportedDateTime: 04/07/5343 (in Gregorian, 01/01/1583) -MaxSupportedDateTime: 13/29/5999 (in Gregorian, 09/29/2239) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp deleted file mode 100644 index b31c1af503b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// The following code example calls GetDaysInMonth for the twelfth month in -// each of 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 12, HijriCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 12, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. The results might vary depending on -the settings in Regional and Language Options (or Regional Options or Regional Settings). - -YEAR 1421 1422 1423 1424 1425 -CurrentEra: 29 29 30 29 29 -Era 1: 29 29 30 29 29 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp deleted file mode 100644 index 036e38f6962..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, HijriCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. The results might vary depending on -the settings in Regional and Language Options (or Regional Options or Regional Settings). - -YEAR 1421 1422 1423 1424 1425 -CurrentEra: 354 354 355 354 354 -Era 1: 354 354 355 354 354 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp deleted file mode 100644 index f922542fad0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, HijriCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. The results might vary depending on -the settings in Regional and Language Options (or Regional Options or Regional Settings). - -YEAR 1421 1422 1423 1424 1425 -CurrentEra: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp deleted file mode 100644 index 8ad91079056..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp +++ /dev/null @@ -1,53 +0,0 @@ - -// The following code example shows how HijriAdjustment affects the date. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Creates a DateTime and initializes it to the second day of the first month of the year 1422. - DateTime myDT = DateTime(1422,1,2,myCal); - - // Displays the current values of the DateTime. - Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); - Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); - Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); - - // Sets the HijriAdjustment property to 2. - myCal->HijriAdjustment = 2; - Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); - Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); - Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); - - // Sets the HijriAdjustment property to -2. - myCal->HijriAdjustment = -2; - Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); - Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); - Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); -} - -/* -This code produces the following output. Results vary depending on the registry settings. - -HijriAdjustment is 0. -Year is 1422. -Month is 1. -Day is 2. -HijriAdjustment is 2. -Year is 1422. -Month is 1. -Day is 4. -HijriAdjustment is -2. -Year is 1421. -Month is 12. -Day is 29. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp deleted file mode 100644 index 374dfbf3d96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the second -// month (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 1421; y <= 1425; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, HijriCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HijriCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1421; y <= 1425; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 1421 1422 1423 1424 1425 -CurrentEra: False False False False False -Era 1: False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp deleted file mode 100644 index aa01d2f822d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in -// five years in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 1421; y <= 1425; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, HijriCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, HijriCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -1421: False False False False False False False False False False False False -1422: False False False False False False False False False False False False -1423: False False False False False False False False False False False False -1424: False False False False False False False False False False False False -1425: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp deleted file mode 100644 index e3896e85af1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, HijriCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1421; y <= 1425; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 1421 1422 1423 1424 1425 -CurrentEra: False False True False False -Era 1: False False True False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp deleted file mode 100644 index 8585d7966f6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Hijri calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the HijriCalendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Hijri calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the Hijri calendar: - Era: 1 - Year: 1423 - Month: 1 - DayOfYear: 21 - DayOfMonth: 21 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 1425 - Month: 11 - DayOfYear: 316 - DayOfMonth: 21 - DayOfWeek: Saturday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp deleted file mode 100644 index 4c8f361ea5f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create an instance of the calendar. - HijriCalendar^ myCal = gcnew HijriCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.HijriCalendar -MinSupportedDateTime: 01/01/0001 (in Gregorian, 07/18/0622) -MaxSupportedDateTime: 04/03/9666 (in Gregorian, 12/31/9999) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp deleted file mode 100644 index 41a3f5fffa3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// The following code example displays the values contained in the Eras property. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::WriteLine( "Eras[ {0}] = {1}", i, myCal->Eras[ i ] ); - - } -} - -/* -This code produces the following output. - -Eras->Item[0] = 4 -Eras->Item[1] = 3 -Eras->Item[2] = 2 -Eras->Item[3] = 1 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp deleted file mode 100644 index 18dc3f18f24..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month in each -// of 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, JapaneseCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 1 2 3 4 5 -CurrentEra: 28 28 28 29 28 -Era 4: 28 28 28 29 28 -Era 3: 28 28 29 28 28 -Era 2: 29 28 28 28 29 -Era 1: 29 28 28 28 29 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp deleted file mode 100644 index b7c757179f0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, JapaneseCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 1 2 3 4 5 -CurrentEra: 365 365 365 366 365 -Era 4: 365 365 365 366 365 -Era 3: 365 365 366 365 365 -Era 2: 366 365 365 365 366 -Era 1: 366 365 365 365 366 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp deleted file mode 100644 index 8fff71ba264..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - } -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp deleted file mode 100644 index 085173db873..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Creates a holder for the last day of the second month (February)-> - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 1; y <= 5; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, JapaneseCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, JapaneseCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1; y <= 5; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - } - Console::WriteLine(); - } -} -/* -This code produces the following output. - -YEAR 1 2 3 4 5 -CurrentEra: False True False False False -Era 5: False True False False False -Era 4: False False False True False -Era 3: False False True False False -Era 2: True False False False True -Era 1: True False False False True - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp deleted file mode 100644 index de254b59da9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months -// in five years in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 1; y <= 5; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JapaneseCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -1: False False False False False False False False False False False False -2: False False False False False False False False False False False False -3: False False False False False False False False False False False False -4: False False False False False False False False False False False False -5: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp deleted file mode 100644 index 5a922425510..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp +++ /dev/null @@ -1,41 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Creates and initializes a JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, JapaneseCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 1; y <= 5; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - } -} -/* -This code produces the following output. - -YEAR 1 2 3 4 5 -CurrentEra: False True False False False -Era 5: False True False False False -Era 4: False False False True False -Era 3: False False True False False -Era 2: True False False False True -Era 1: True False False False True - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp deleted file mode 100644 index b5ce5f316e5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Japanese calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the JapaneseCalendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Japanese calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the Japanese calendar: - Era: 4 - Year: 14 - Month: 4 - DayOfYear: 93 - DayOfMonth: 3 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 4 - Year: 17 - Month: 2 - DayOfYear: 34 - DayOfMonth: 3 - DayOfWeek: Thursday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp deleted file mode 100644 index d982671caed..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create an instance of the calendar. - JapaneseCalendar^ myCal = gcnew JapaneseCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.JapaneseCalendar -MinSupportedDateTime: 09/08/0001 (in Gregorian, 09/08/1868) -MaxSupportedDateTime: 12/31/8011 (in Gregorian, 12/31/9999) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp deleted file mode 100644 index 34d49e99fe2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month in -// each of 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, JulianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: 28 28 28 29 28 -Era 1: 28 28 28 29 28 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp deleted file mode 100644 index 3e36971f4c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, JulianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: 365 365 365 366 365 -Era 1: 365 365 365 366 365 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp deleted file mode 100644 index 113ce8b1c77..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, JulianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp deleted file mode 100644 index b8036ac7e05..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the -// second month (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, JulianCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, JulianCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp deleted file mode 100644 index b2d0997f2f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in -// five years in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 2001; y <= 2005; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, JulianCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JulianCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -2001: False False False False False False False False False False False False -2002: False False False False False False False False False False False False -2003: False False False False False False False False False False False False -2004: False False False False False False False False False False False False -2005: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp deleted file mode 100644 index 5436dfbd8b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, JulianCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2001; y <= 2005; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2001 2002 2003 2004 2005 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp deleted file mode 100644 index e14dd6e99a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Julian calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the JulianCalendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar: - Era: 1 - Year: 2002 - Month: 3 - DayOfYear: 80 - DayOfMonth: 21 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 2005 - Month: 1 - DayOfYear: 21 - DayOfMonth: 21 - DayOfWeek: Thursday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp deleted file mode 100644 index 5aa56fb4924..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create an instance of the calendar. - JulianCalendar^ myCal = gcnew JulianCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.JulianCalendar -MinSupportedDateTime: 01/03/0001 (in Gregorian, 01/01/0001) -MaxSupportedDateTime: 10/19/9999 (in Gregorian, 12/31/9999) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp deleted file mode 100644 index 6b3c77a66da..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month -// in each of 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 4334 4335 4336 4337 4338 -CurrentEra: 28 28 28 29 28 -Era 1: 28 28 28 29 28 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp deleted file mode 100644 index 5211726ccf0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, KoreanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 4334 4335 4336 4337 4338 -CurrentEra: 365 365 365 366 365 -Era 1: 365 365 365 366 365 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp deleted file mode 100644 index 33b5c948bd3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, KoreanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 4334 4335 4336 4337 4338 -CurrentEra: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp deleted file mode 100644 index d973b468e66..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the second -// month (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 4334; y <= 4338; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, KoreanCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 4334; y <= 4338; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 4334 4335 4336 4337 4338 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp deleted file mode 100644 index 3446270064d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in five years in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 4334; y <= 4338; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, KoreanCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, KoreanCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -4334: False False False False False False False False False False False False -4335: False False False False False False False False False False False False -4336: False False False False False False False False False False False False -4337: False False False False False False False False False False False False -4338: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp deleted file mode 100644 index 5e2e16c671d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, KoreanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 4334; y <= 4338; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 4334 4335 4336 4337 4338 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp deleted file mode 100644 index 0af45b0db54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Korean calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the KoreanCalendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Korean calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the Korean calendar: - Era: 1 - Year: 4335 - Month: 4 - DayOfYear: 93 - DayOfMonth: 3 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 4338 - Month: 2 - DayOfYear: 34 - DayOfMonth: 3 - DayOfWeek: Thursday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp deleted file mode 100644 index 00de6b90a65..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - - // Create an instance of the calendar. - KoreanCalendar^ myCal = gcnew KoreanCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.KoreanCalendar -MinSupportedDateTime: 01/01/2334 (in Gregorian, 01/01/0001) -MaxSupportedDateTime: 12/31/12332 (in Gregorian, 12/31/9999) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp deleted file mode 100644 index 0725c178ee9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -using namespace System::Text; -int main() -{ - - // Gets the InvariantInfo. - NumberFormatInfo^ myInv = NumberFormatInfo::InvariantInfo; - - // Gets a UnicodeEncoding to display the Unicode value of symbols. - UnicodeEncoding^ myUE = gcnew UnicodeEncoding( true,false ); - array^myCodes; - - // Displays the default values for each of the properties. - Console::WriteLine( "InvariantInfo:\nNote: Symbols might not display correctly on the console, \ntherefore, Unicode values are included." ); - Console::WriteLine( "\tCurrencyDecimalDigits\t\t {0}", myInv->CurrencyDecimalDigits ); - Console::WriteLine( "\tCurrencyDecimalSeparator\t {0}", myInv->CurrencyDecimalSeparator ); - Console::WriteLine( "\tCurrencyGroupSeparator\t\t {0}", myInv->CurrencyGroupSeparator ); - Console::WriteLine( "\tCurrencyGroupSizes\t\t {0}", myInv->CurrencyGroupSizes[ 0 ] ); - Console::WriteLine( "\tCurrencyNegativePattern\t\t {0}", myInv->CurrencyNegativePattern ); - Console::WriteLine( "\tCurrencyPositivePattern\t\t {0}", myInv->CurrencyPositivePattern ); - myCodes = myUE->GetBytes( myInv->CurrencySymbol ); - Console::WriteLine( "\tCurrencySymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->CurrencySymbol, myCodes[ 0 ], myCodes[ 1 ] ); - Console::WriteLine( "\tNaNSymbol\t\t\t {0}", myInv->NaNSymbol ); - Console::WriteLine( "\tNegativeInfinitySymbol\t\t {0}", myInv->NegativeInfinitySymbol ); - Console::WriteLine( "\tNegativeSign\t\t\t {0}", myInv->NegativeSign ); - Console::WriteLine( "\tNumberDecimalDigits\t\t {0}", myInv->NumberDecimalDigits ); - Console::WriteLine( "\tNumberDecimalSeparator\t\t {0}", myInv->NumberDecimalSeparator ); - Console::WriteLine( "\tNumberGroupSeparator\t\t {0}", myInv->NumberGroupSeparator ); - Console::WriteLine( "\tNumberGroupSizes\t\t {0}", myInv->NumberGroupSizes[ 0 ] ); - Console::WriteLine( "\tNumberNegativePattern\t\t {0}", myInv->NumberNegativePattern ); - Console::WriteLine( "\tPercentDecimalDigits\t\t {0}", myInv->PercentDecimalDigits ); - Console::WriteLine( "\tPercentDecimalSeparator\t\t {0}", myInv->PercentDecimalSeparator ); - Console::WriteLine( "\tPercentGroupSeparator\t\t {0}", myInv->PercentGroupSeparator ); - Console::WriteLine( "\tPercentGroupSizes\t\t {0}", myInv->PercentGroupSizes[ 0 ] ); - Console::WriteLine( "\tPercentNegativePattern\t\t {0}", myInv->PercentNegativePattern ); - Console::WriteLine( "\tPercentPositivePattern\t\t {0}", myInv->PercentPositivePattern ); - myCodes = myUE->GetBytes( myInv->PercentSymbol ); - Console::WriteLine( "\tPercentSymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->PercentSymbol, myCodes[ 0 ], myCodes[ 1 ] ); - myCodes = myUE->GetBytes( myInv->PerMilleSymbol ); - Console::WriteLine( "\tPerMilleSymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->PerMilleSymbol, myCodes[ 0 ], myCodes[ 1 ] ); - Console::WriteLine( "\tPositiveInfinitySymbol\t\t {0}", myInv->PositiveInfinitySymbol ); - Console::WriteLine( "\tPositiveSign\t\t\t {0}", myInv->PositiveSign ); -} - -/* - -This code produces the following output. - -InvariantInfo: -Note: Symbols might not display correctly on the console, -therefore, Unicode values are included. -CurrencyDecimalDigits 2 -CurrencyDecimalSeparator . -CurrencyGroupSeparator , -CurrencyGroupSizes 3 -CurrencyNegativePattern 0 -CurrencyPositivePattern 0 -CurrencySymbol (U+00a4) -NaNSymbol NaN -NegativeInfinitySymbol -Infinity -NegativeSign - -NumberDecimalDigits 2 -NumberDecimalSeparator . -NumberGroupSeparator , -NumberGroupSizes 3 -NumberNegativePattern 1 -PercentDecimalDigits 2 -PercentDecimalSeparator . -PercentGroupSeparator , -PercentGroupSizes 3 -PercentNegativePattern 0 -PercentPositivePattern 0 -PercentSymbol % (U+0025) -PerMilleSymbol % (U+2030) -PositiveInfinitySymbol Infinity -PositiveSign + - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp deleted file mode 100644 index 1a0bf689d64..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// The following code example creates instances of -// T:System.Globalization.RegionInfo using culture names. - -// -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; - -namespace Sample -{ - public ref class SamplesRegionInfo - { - public: - static void Work() - { - - // Creates an array containing culture names. - array ^ commonCultures = - {"", "ar", "ar-DZ", "en", "en-US"}; - - // Creates a RegionInfo for each of the culture names. - // Note that "ar" is the culture name for the neutral - // culture "Arabic", but it is also the region name for - // the country/region "Argentina"; therefore, it does not - // fail as expected. - Console::WriteLine("Without checks..."); - for each (String^ cultureID in commonCultures) - { - try - { - RegionInfo^ region = - gcnew RegionInfo(cultureID); - } - - catch (ArgumentException^ ex) - { - Console::WriteLine(ex); - } - } - - Console::WriteLine(); - - Console::WriteLine("Checking the culture" - " names first..."); - - for each (String^ cultureID in commonCultures) - { - if (cultureID->Length == 0) - { - Console::WriteLine( - "The culture is the invariant culture."); - } - else - { - CultureInfo^ culture = - gcnew CultureInfo(cultureID, false); - if (culture->IsNeutralCulture) - { - Console::WriteLine("The culture {0} is " - "a neutral culture.", cultureID); - } - else - { - Console::WriteLine("The culture {0} is " - "a specific culture.", cultureID); - try - { - RegionInfo^ region = - gcnew RegionInfo(cultureID); - } - catch (ArgumentException^ ex) - { - Console::WriteLine(ex); - } - } - } - } - Console::ReadLine(); - } - }; -} - -int main() -{ - Sample::SamplesRegionInfo::Work(); - return 0; -} - -/* -This code produces the following output. - -Without checks... -System.ArgumentException: Region name '' is not supported. -Parameter name: name -at System.Globalization.RegionInfo..ctor(String name) -at SamplesRegionInfo.Main() -System.ArgumentException: Region name 'en' is not supported. -Parameter name: name -at System.Globalization.CultureTableRecord..ctor(String regionName, - Boolean useUserOverride) -at System.Globalization.RegionInfo..ctor(String name) -at SamplesRegionInfo.Main() - -Checking the culture names first... -The culture is the invariant culture. -The culture ar is a neutral culture. -The culture ar-DZ is a specific culture. -The culture en is a neutral culture. -The culture en-US is a specific culture. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp deleted file mode 100644 index afae697de7f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// The following code example demonstrates several members of the RegionInfo class. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Displays the property values of the RegionInfo for "US". - RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); - Console::WriteLine( " Name: {0}", myRI1->Name ); - Console::WriteLine( " DisplayName: {0}", myRI1->DisplayName ); - Console::WriteLine( " EnglishName: {0}", myRI1->EnglishName ); - Console::WriteLine( " IsMetric: {0}", myRI1->IsMetric ); - Console::WriteLine( " ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName ); - Console::WriteLine( " ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName ); - Console::WriteLine( " TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName ); - Console::WriteLine( " CurrencySymbol: {0}", myRI1->CurrencySymbol ); - Console::WriteLine( " ISOCurrencySymbol: {0}", myRI1->ISOCurrencySymbol ); - Console::WriteLine(); - - // Compares the RegionInfo above with another RegionInfo created using CultureInfo. - RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID ); - if ( myRI1->Equals( myRI2 ) ) - Console::WriteLine( "The two RegionInfo instances are equal." ); - else - Console::WriteLine( "The two RegionInfo instances are NOT equal." ); -} - -/* -This code produces the following output. - - Name: US - DisplayName: United States - EnglishName: United States - IsMetric: False - ThreeLetterISORegionName: USA - ThreeLetterWindowsRegionName: USA - TwoLetterISORegionName: US - CurrencySymbol: $ - ISOCurrencySymbol: USD - -The two RegionInfo instances are equal. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp deleted file mode 100644 index 59f19db370c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// The following code example compares two instances of RegionInfo that were created differently. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates a RegionInfo using the ISO 3166 two-letter code. - RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); - - // Creates a RegionInfo using a CultureInfo.LCID. - RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID ); - - // Compares the two instances. - if ( myRI1->Equals( myRI2 ) ) - Console::WriteLine( "The two RegionInfo instances are equal." ); - else - Console::WriteLine( "The two RegionInfo instances are NOT equal." ); -} - -/* -This code produces the following output. - -The two RegionInfo instances are equal. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp deleted file mode 100644 index b61096e79cc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example displays the properties of the RegionInfo class. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Displays the property values of the RegionInfo for "US". - RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); - Console::WriteLine( " Name: {0}", myRI1->Name ); - Console::WriteLine( " DisplayName: {0}", myRI1->DisplayName ); - Console::WriteLine( " EnglishName: {0}", myRI1->EnglishName ); - Console::WriteLine( " IsMetric: {0}", myRI1->IsMetric ); - Console::WriteLine( " ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName ); - Console::WriteLine( " ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName ); - Console::WriteLine( " TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName ); - Console::WriteLine( " CurrencySymbol: {0}", myRI1->CurrencySymbol ); - Console::WriteLine( " ISOCurrencySymbol: {0}", myRI1->ISOCurrencySymbol ); -} - -/* -This code produces the following output. - - Name: US - DisplayName: United States - EnglishName: United States - IsMetric: False - ThreeLetterISORegionName: USA - ThreeLetterWindowsRegionName: USA - TwoLetterISORegionName: US - CurrencySymbol: $ - ISOCurrencySymbol: USD - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp deleted file mode 100644 index 1b59bd014bf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example compares SortKey objects created with -// cultures that have different sort orders. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates a SortKey using the en-US culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - CompareInfo^ myComp_enUS = MyCI->CompareInfo; - SortKey^ mySK1 = myComp_enUS->GetSortKey( "llama" ); - - // Creates a SortKey using the es-ES culture with international sort. - MyCI = gcnew CultureInfo( "es-ES",false ); - CompareInfo^ myComp_esES = MyCI->CompareInfo; - SortKey^ mySK2 = myComp_esES->GetSortKey( "llama" ); - - // Creates a SortKey using the es-ES culture with traditional sort. - MyCI = gcnew CultureInfo( 0x040A,false ); - CompareInfo^ myComp_es = MyCI->CompareInfo; - SortKey^ mySK3 = myComp_es->GetSortKey( "llama" ); - - // Compares the en-US SortKey with each of the es-ES SortKey objects. - Console::WriteLine( "Comparing \"llama\" in en-US and in es-ES with international sort : {0}", SortKey::Compare( mySK1, mySK2 ) ); - Console::WriteLine( "Comparing \"llama\" in en-US and in es-ES with traditional sort : {0}", SortKey::Compare( mySK1, mySK3 ) ); -} - -/* -This code produces the following output. - -Comparing S"llama" in en-US and in es-ES with international sort : 0 -Comparing S"llama" in en-US and in es-ES with traditional sort : -1 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp deleted file mode 100644 index 3f300f6813f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp +++ /dev/null @@ -1,80 +0,0 @@ - -// The following code example shows the results of SortKey->Equals -// when compared with different SortKey objects. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates two identical en-US cultures and one de-DE culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - CompareInfo^ myComp_enUS1 = MyCI->CompareInfo; - MyCI = gcnew CultureInfo( "en-US",false ); - CompareInfo^ myComp_enUS2 = MyCI->CompareInfo; - MyCI = gcnew CultureInfo( "de-DE",false ); - CompareInfo^ myComp_deDE = MyCI->CompareInfo; - - // Creates the base SortKey to compare with all the others. - SortKey^ mySK1 = myComp_enUS1->GetSortKey( "cant", CompareOptions::StringSort ); - - // Creates a SortKey that is derived exactly the same way as the base SortKey. - SortKey^ mySK2 = myComp_enUS1->GetSortKey( "cant", CompareOptions::StringSort ); - - // Creates a SortKey that uses word sort, which is the default sort. - SortKey^ mySK3 = myComp_enUS1->GetSortKey( "cant" ); - - // Creates a SortKey for a different String*. - SortKey^ mySK4 = myComp_enUS1->GetSortKey( "can't", CompareOptions::StringSort ); - - // Creates a SortKey from a different CompareInfo with the same culture. - SortKey^ mySK5 = myComp_enUS2->GetSortKey( "cant", CompareOptions::StringSort ); - - // Creates a SortKey from a different CompareInfo with a different culture. - SortKey^ mySK6 = myComp_deDE->GetSortKey( "cant", CompareOptions::StringSort ); - - // Compares the base SortKey with itself. - Console::WriteLine( "Comparing the base SortKey with itself: {0}", mySK1->Equals( mySK1 ) ); - Console::WriteLine(); - - // Prints the header for the table. - Console::WriteLine( "CompareInfo Culture OriginalString CompareOptions Equals()" ); - - // Compares the base SortKey with a SortKey that is - // created from the same CompareInfo with the same String* and the same CompareOptions. - Console::WriteLine( "same same same same {0}", mySK1->Equals( mySK2 ) ); - - // Compares the base SortKey with a SortKey that is - // created from the same CompareInfo with the same String* but with different CompareOptions. - Console::WriteLine( "same same same different {0}", mySK1->Equals( mySK3 ) ); - - // Compares the base SortKey with a SortKey that is - // created from the same CompareInfo with the different String* - // but with the same CompareOptions. - Console::WriteLine( "same same different same {0}", mySK1->Equals( mySK4 ) ); - - // Compares the base SortKey with a SortKey that is - // created from a different CompareInfo (same culture) - // with the same String* and the same CompareOptions. - Console::WriteLine( "different same same same {0}", mySK1->Equals( mySK5 ) ); - - // Compares the base SortKey with a SortKey that is - // created from a different CompareInfo (different culture) - // with the same String* and the same CompareOptions. - Console::WriteLine( "different different same same {0}", mySK1->Equals( mySK6 ) ); -} - -/* -This code produces the following output. - -Comparing the base SortKey with itself: True - -CompareInfo Culture OriginalString CompareOptions Equals() -same same same same True -same same same different False -same same different same False -different same same same True -different different same same False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp deleted file mode 100644 index 59e7fbd6cec..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month in each -// of 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, TaiwanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 90 91 92 93 94 -CurrentEra: 28 28 28 29 28 -Era 1: 28 28 28 29 28 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp deleted file mode 100644 index be31d941d3e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, TaiwanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 90 91 92 93 94 -CurrentEra: 365 365 365 366 365 -Era 1: 365 365 365 366 365 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp deleted file mode 100644 index 5dd8e46be7e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, TaiwanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 90 91 92 93 94 -CurrentEra: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp deleted file mode 100644 index 89fc7fb7e6f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t{0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 90; y <= 94; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, TaiwanCalendar::CurrentEra ); - Console::Write( "\t{0}", myCal->IsLeapDay( y, 2, iLastDay, TaiwanCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 90; y <= 94; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t{0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 90 91 92 93 94 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp deleted file mode 100644 index 914453cabe8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in five years in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 90; y <= 94; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, TaiwanCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, TaiwanCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -90: False False False False False False False False False False False False -91: False False False False False False False False False False False False -92: False False False False False False False False False False False False -93: False False False False False False False False False False False False -94: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp deleted file mode 100644 index dc8bffdcf80..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, TaiwanCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 90; y <= 94; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 90 91 92 93 94 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp deleted file mode 100644 index 99c84b107ab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the Taiwan calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the TaiwanCalendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Taiwan calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the Taiwan calendar: - Era: 1 - Year: 91 - Month: 4 - DayOfYear: 93 - DayOfMonth: 3 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 94 - Month: 2 - DayOfYear: 34 - DayOfMonth: 3 - DayOfWeek: Thursday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp deleted file mode 100644 index 3deda76056f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// The following code example gets the minimum value and the maximum value of the calendar. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Create an instance of the calendar. - TaiwanCalendar^ myCal = gcnew TaiwanCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.TaiwanCalendar -MinSupportedDateTime: 01/01/0001 (in Gregorian, 01/01/1912) -MaxSupportedDateTime: 12/31/8088 (in Gregorian, 12/31/9999) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp deleted file mode 100644 index 9e73e264824..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// The following code example shows the values returned by TextElementEnumerator. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a String containing the following: - // - a surrogate pair (high surrogate U+D800 and low surrogate U+DC00) - // - a combining character sequence (the Latin small letter S"a" followed by the combining grave accent) - // - a base character (the ligature S"") - String^ myString = L"\xD800\xDC00" - L"a\u0300\u00C6"; - - // Creates and initializes a TextElementEnumerator for myString. - TextElementEnumerator^ myTEE = StringInfo::GetTextElementEnumerator( myString ); - - // Displays the values returned by ElementIndex, Current and GetTextElement. - // Current and GetTextElement return a String* containing the entire text element. - Console::WriteLine( "Index\tCurrent\tGetTextElement" ); - myTEE->Reset(); - while ( myTEE->MoveNext() ) - Console::WriteLine( "[{0}]:\t {1}\t {2}", myTEE->ElementIndex, myTEE->Current, myTEE->GetTextElement() ); -} - -/* -This code produces the following output. The question marks take the place of high and low surrogates. - -Index Current GetTextElement -[0]: ð€€ ð€€ -[2]: aÌ€ aÌ€ -[4]: Æ Æ - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp deleted file mode 100644 index c77a0736012..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// The following code example changes the casing of a String*. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Defines the String* with mixed casing. - String^ myString = "wAr aNd pEaCe"; - - // Creates a TextInfo based on the S"en-US" culture. - CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); - TextInfo^ myTI = MyCI->TextInfo; - - // Changes a String* to lowercase. - Console::WriteLine( "\"{0}\" to lowercase: {1}", myString, myTI->ToLower( myString ) ); - - // Changes a String* to uppercase. - Console::WriteLine( "\"{0}\" to uppercase: {1}", myString, myTI->ToUpper( myString ) ); - - // Changes a String* to titlecase. - Console::WriteLine( "\"{0}\" to titlecase: {1}", myString, myTI->ToTitleCase( myString ) ); -} - -/* -This code produces the following output. - -S"wAr aNd pEaCe" to lowercase: war and peace -S"wAr aNd pEaCe" to uppercase: WAR AND PEACE -S"wAr aNd pEaCe" to titlecase: War And Peace - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp deleted file mode 100644 index 88271b26c94..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example calls GetDaysInMonth for the second month in each of 5 -// years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, ThaiBuddhistCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2544 2545 2546 2547 2548 -CurrentEra: 28 28 28 29 28 -Era 1: 28 28 28 29 28 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp deleted file mode 100644 index 9aa2d9d8dee..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetDaysInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, ThaiBuddhistCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2544 2545 2546 2547 2548 -CurrentEra: 365 365 365 366 365 -Era 1: 365 365 365 366 365 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp deleted file mode 100644 index 3a8a6d35a73..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls GetMonthsInYear for 5 years in each era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Displays the value of the CurrentEra property. - Console::Write( "CurrentEra:" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, ThaiBuddhistCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Displays the values in the Eras property. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2544 2545 2546 2547 2548 -CurrentEra: 12 12 12 12 12 -Era 1: 12 12 12 12 12 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp deleted file mode 100644 index 356591167c0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp +++ /dev/null @@ -1,55 +0,0 @@ - -// The following code example calls IsLeapDay for the last day of the -// second month (February) for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Creates a holder for the last day of the second month (February). - int iLastDay; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 2544; y <= 2548; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, ThaiBuddhistCalendar::CurrentEra ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, ThaiBuddhistCalendar::CurrentEra ) ); - - } - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2544; y <= 2548; y++ ) - { - iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); - Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); - - } - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2544 2545 2546 2547 2548 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp deleted file mode 100644 index 23dd963fa16..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp +++ /dev/null @@ -1,35 +0,0 @@ - -// The following code example calls IsLeapMonth for all the months in five years in the current era. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Checks all the months in five years in the current era. - int iMonthsInYear; - for ( int y = 2544; y <= 2548; y++ ) - { - Console::Write( " {0}:\t", y ); - iMonthsInYear = myCal->GetMonthsInYear( y, ThaiBuddhistCalendar::CurrentEra ); - for ( int m = 1; m <= iMonthsInYear; m++ ) - Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, ThaiBuddhistCalendar::CurrentEra ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -2544: False False False False False False False False False False False False -2545: False False False False False False False False False False False False -2546: False False False False False False False False False False False False -2547: False False False False False False False False False False False False -2548: False False False False False False False False False False False False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp deleted file mode 100644 index f8db76f0cbb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// The following code example calls IsLeapYear for five years in each of the eras. -// -using namespace System; -using namespace System::Globalization; -int main() -{ - - // Creates and initializes a ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Displays the header. - Console::Write( "YEAR\t" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", y ); - Console::WriteLine(); - - // Checks five years in the current era. - Console::Write( "CurrentEra:" ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, ThaiBuddhistCalendar::CurrentEra ) ); - Console::WriteLine(); - - // Checks five years in each of the eras. - for ( int i = 0; i < myCal->Eras->Length; i++ ) - { - Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); - for ( int y = 2544; y <= 2548; y++ ) - Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); - Console::WriteLine(); - - } -} - -/* -This code produces the following output. - -YEAR 2544 2545 2546 2547 2548 -CurrentEra: False False False True False -Era 1: False False False True False - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp deleted file mode 100644 index 814657e163c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// The following code example displays the values of several components of a DateTime in terms of the ThaiBuddhist calendar. -// -using namespace System; -using namespace System::Globalization; -void DisplayValues( Calendar^ myCal, DateTime myDT ) -{ - Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); - Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); - Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); - Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); - Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); - Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); - Console::WriteLine(); -} - -int main() -{ - - // Sets a DateTime to April 3, 2002 of the Gregorian calendar. - DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); - - // Creates an instance of the ThaiBuddhistCalendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - - // Displays the values of the DateTime. - Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the ThaiBuddhist calendar:" ); - DisplayValues( myCal, myDT ); - - // Adds two years and ten months. - myDT = myCal->AddYears( myDT, 2 ); - myDT = myCal->AddMonths( myDT, 10 ); - - // Displays the values of the DateTime. - Console::WriteLine( "After adding two years and ten months:" ); - DisplayValues( myCal, myDT ); -} - -/* -This code produces the following output. - -April 3, 2002 of the Gregorian calendar equals the following in the ThaiBuddhist calendar: - Era: 1 - Year: 2545 - Month: 4 - DayOfYear: 93 - DayOfMonth: 3 - DayOfWeek: Wednesday - -After adding two years and ten months: - Era: 1 - Year: 2548 - Month: 2 - DayOfYear: 34 - DayOfMonth: 3 - DayOfWeek: Thursday - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp deleted file mode 100644 index a3628cd7019..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// The following code example gets the minimum date and the maximum date of the calendar. -// -using namespace System; -using namespace System::Globalization; - -int main() -{ - // Create an instance of the calendar. - ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; - Console::WriteLine( myCal ); - - // Create an instance of the GregorianCalendar. - GregorianCalendar^ myGre = gcnew GregorianCalendar; - - // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMin = myCal->MinSupportedDateTime; - Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); - - // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. - DateTime myMax = myCal->MaxSupportedDateTime; - Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); - Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); -} - -/* -This code produces the following output. - -System.Globalization.ThaiBuddhistCalendar -MinSupportedDateTime: 01/01/0544 (in Gregorian, 01/01/0001) -MaxSupportedDateTime: 12/31/10542 (in Gregorian, 12/31/9999) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp deleted file mode 100644 index 8b5d97c0b94..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp +++ /dev/null @@ -1,144 +0,0 @@ - - -// -#using - -using namespace System; - -/// Class that implements IConvertible -ref class Complex: public IConvertible -{ -private: - double x; - double y; - -public: - Complex( double x, double y ) - { - this->x = x; - this->y = y; - } - - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean( IFormatProvider^ /*provider*/ ) = IConvertible::ToBoolean - { - if ( (x != 0.0) || (y != 0.0) ) - return true; - else - return false; - } - - double GetDoubleValue() - { - return Math::Sqrt( x * x + y * y ); - } - - virtual Byte ToByte( IFormatProvider^ /*provider*/ ) = IConvertible::ToByte - { - return Convert::ToByte( GetDoubleValue() ); - } - - virtual Char ToChar( IFormatProvider^ /*provider*/ ) = IConvertible::ToChar - { - return Convert::ToChar( GetDoubleValue() ); - } - - virtual DateTime ToDateTime( IFormatProvider^ /*provider*/ ) = IConvertible::ToDateTime - { - return Convert::ToDateTime( GetDoubleValue() ); - } - - virtual Decimal ToDecimal( IFormatProvider^ /*provider*/ ) = IConvertible::ToDecimal - { - return Convert::ToDecimal( GetDoubleValue() ); - } - - virtual double ToDouble( IFormatProvider^ /*provider*/ ) = IConvertible::ToDouble - { - return GetDoubleValue(); - } - - virtual short ToInt16( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt16 - { - return Convert::ToInt16( GetDoubleValue() ); - } - - virtual int ToInt32( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt32 - { - return Convert::ToInt32( GetDoubleValue() ); - } - - virtual Int64 ToInt64( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt64 - { - return Convert::ToInt64( GetDoubleValue() ); - } - - virtual signed char ToSByte( IFormatProvider^ /*provider*/ ) = IConvertible::ToSByte - { - return Convert::ToSByte( GetDoubleValue() ); - } - - virtual float ToSingle( IFormatProvider^ /*provider*/ ) = IConvertible::ToSingle - { - return Convert::ToSingle( GetDoubleValue() ); - } - - virtual String^ ToString( IFormatProvider^ /*provider*/ ) = IConvertible::ToString - { - return String::Format( "( {0} , {1} )", x, y ); - } - - virtual Object^ ToType( Type^ conversionType, IFormatProvider^ /*provider*/ ) = IConvertible::ToType - { - return Convert::ChangeType( GetDoubleValue(), conversionType ); - } - - virtual UInt16 ToUInt16( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt16 - { - return Convert::ToUInt16( GetDoubleValue() ); - } - - virtual UInt32 ToUInt32( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt32 - { - return Convert::ToUInt32( GetDoubleValue() ); - } - - virtual UInt64 ToUInt64( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt64 - { - return Convert::ToUInt64( GetDoubleValue() ); - } - -}; - -void WriteObjectInfo( Object^ testObject ) -{ - TypeCode typeCode = Type::GetTypeCode( testObject->GetType() ); - switch ( typeCode ) - { - case TypeCode::Boolean: - Console::WriteLine( "Boolean: {0}", testObject ); - break; - - case TypeCode::Double: - Console::WriteLine( "Double: {0}", testObject ); - break; - - default: - Console::WriteLine( "{0}: {1}", typeCode, testObject ); - break; - } -} - -int main() -{ - Complex^ testComplex = gcnew Complex( 4,7 ); - WriteObjectInfo( testComplex ); - WriteObjectInfo( Convert::ToBoolean( testComplex ) ); - WriteObjectInfo( Convert::ToDecimal( testComplex ) ); - WriteObjectInfo( Convert::ToString( testComplex ) ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp deleted file mode 100644 index 7ec610d0749..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// The following example demonstrates how to create a class that -// implements the IDisposable interface and the IDisposable.Dispose -// method with finalization to clean up unmanaged resources. -// -public ref class MyResource: public IDisposable -{ -private: - - // Pointer to an external unmanaged resource. - IntPtr handle; - - // A managed resource this class uses. - Component^ component; - - // Track whether Dispose has been called. - bool disposed; - -public: - // The class constructor. - MyResource( IntPtr handle, Component^ component ) - { - this->handle = handle; - this->component = component; - disposed = false; - } - - // This method is called if the user explicitly disposes of the - // object (by calling the Dispose method in other managed languages, - // or the destructor in C++). The compiler emits as a call to - // GC::SuppressFinalize( this ) for you, so there is no need to - // call it here. - ~MyResource() - { - // Dispose of managed resources. - component->~Component(); - - // Call C++ finalizer to clean up unmanaged resources. - this->!MyResource(); - - // Mark the class as disposed. This flag allows you to throw an - // exception if a disposed object is accessed. - disposed = true; - } - - // Use interop to call the method necessary to clean up the - // unmanaged resource. - // - [System::Runtime::InteropServices::DllImport("Kernel32")] - static Boolean CloseHandle( IntPtr handle ); - - // The C++ finalizer destructor ensures that unmanaged resources get - // released if the user releases the object without explicitly - // disposing of it. - // - !MyResource() - { - // Call the appropriate methods to clean up unmanaged - // resources here. If disposing is false when Dispose(bool, - // disposing) is called, only the following code is executed. - CloseHandle( handle ); - handle = IntPtr::Zero; - } - -}; - -void main() -{ - // Insert code here to create and use the MyResource object. - MyResource^ mr = gcnew MyResource((IntPtr) 42, (Component^) gcnew Button()); - mr->~MyResource(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp deleted file mode 100644 index f1c0b919c12..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - int i = 0; - - // Create random data to write to the stream. - array^writeArray = gcnew array(1000); - (gcnew Random)->NextBytes( writeArray ); - BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); - BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); - try - { - - // Write the data to the stream. - Console::WriteLine( "Writing the data." ); - for ( i = 0; i < writeArray->Length; i++ ) - { - binWriter->Write( writeArray[ i ] ); - - } - - // Set the stream position to the beginning of the stream. - binReader->BaseStream->Position = 0; - - // Read and verify the data from the stream. - for ( i = 0; i < writeArray->Length; i++ ) - { - if ( binReader->ReadByte() != writeArray[ i ] ) - { - Console::WriteLine( "Error writing the data." ); - return -1; - } - - } - Console::WriteLine( "The data was written and verified." ); - } - // Catch the EndOfStreamException and write an error message. - catch ( EndOfStreamException^ e ) - { - Console::WriteLine( "Error writing the data.\n{0}", e->GetType()->Name ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp deleted file mode 100644 index a47e5998074..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - const int arrayLength = 1000; - - // Create random data to write to the stream. - array^dataArray = gcnew array(arrayLength); - (gcnew Random)->NextBytes( dataArray ); - BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); - - // Write the data to the stream. - Console::WriteLine( "Writing the data." ); - binWriter->Write( dataArray ); - - // Create the reader using the stream from the writer. - BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); - - // Set the stream position to the beginning of the stream. - binReader->BaseStream->Position = 0; - - // Read and verify the data. - array^verifyArray = binReader->ReadBytes( arrayLength ); - if ( verifyArray->Length != arrayLength ) - { - Console::WriteLine( "Error writing the data." ); - return -1; - } - - for ( int i = 0; i < arrayLength; i++ ) - { - if ( verifyArray[ i ] != dataArray[ i ] ) - { - Console::WriteLine( "Error writing the data." ); - return -1; - } - - } - Console::WriteLine( "The data was written and verified." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp deleted file mode 100644 index f77f117e2d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - int i; - array^invalidPathChars = Path::InvalidPathChars; - MemoryStream^ memStream = gcnew MemoryStream; - BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); - - // Write to memory. - binWriter->Write( "Invalid file path characters are: " ); - for ( i = 0; i < invalidPathChars->Length; i++ ) - { - binWriter->Write( invalidPathChars[ i ] ); - - } - - // Create the reader using the same MemoryStream - // as used with the writer. - BinaryReader^ binReader = gcnew BinaryReader( memStream ); - - // Set Position to the beginning of the stream. - binReader->BaseStream->Position = 0; - - // Read the data from memory and write it to the console. - Console::Write( binReader->ReadString() ); - array^memoryData = gcnew array(memStream->Length - memStream->Position); - for ( i = 0; i < memoryData->Length; i++ ) - { - memoryData[ i ] = binReader->ReadChar(); - - } - Console::WriteLine( memoryData ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp deleted file mode 100644 index 1e60a82c46f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - int i; - array^invalidPathChars = Path::InvalidPathChars; - MemoryStream^ memStream = gcnew MemoryStream; - BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); - - // Write to memory. - binWriter->Write( "Invalid file path characters are: " ); - for ( i = 0; i < invalidPathChars->Length; i++ ) - { - binWriter->Write( invalidPathChars[ i ] ); - - } - - // Create the reader using the same MemoryStream - // as used with the writer. - BinaryReader^ binReader = gcnew BinaryReader( memStream ); - - // Set Position to the beginning of the stream. - binReader->BaseStream->Position = 0; - - // Read the data from memory and write it to the console. - Console::Write( binReader->ReadString() ); - array^memoryData = gcnew array(memStream->Length - memStream->Position); - for ( i = 0; i < memoryData->Length; i++ ) - { - memoryData[ i ] = Convert::ToChar( binReader->Read() ); - - } - Console::WriteLine( memoryData ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp deleted file mode 100644 index 18e3d52cf62..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - array^invalidPathChars = Path::InvalidPathChars; - MemoryStream^ memStream = gcnew MemoryStream; - BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); - - // Write to memory. - binWriter->Write( "Invalid file path characters are: " ); - binWriter->Write( Path::InvalidPathChars ); - - // Create the reader using the same MemoryStream - // as used with the writer. - BinaryReader^ binReader = gcnew BinaryReader( memStream ); - - // Set Position to the beginning of the stream. - binReader->BaseStream->Position = 0; - - // Read the data from memory and write it to the console. - Console::Write( binReader->ReadString() ); - Console::WriteLine( binReader->ReadChars( (int)(memStream->Length - memStream->Position) ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp deleted file mode 100644 index 591906554cb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - array^invalidPathChars = Path::InvalidPathChars; - MemoryStream^ memStream = gcnew MemoryStream; - BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); - - // Write to memory. - binWriter->Write( "Invalid file path characters are: " ); - binWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length ); - - // Create the reader using the same MemoryStream - // as used with the writer. - BinaryReader^ binReader = gcnew BinaryReader( memStream ); - - // Set Position to the beginning of the stream. - binReader->BaseStream->Position = 0; - - // Read the data from memory and write it to the console. - Console::Write( binReader->ReadString() ); - int arraySize = (int)(memStream->Length - memStream->Position); - array^memoryData = gcnew array(arraySize); - binReader->Read( memoryData, 0, arraySize ); - Console::WriteLine( memoryData ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp deleted file mode 100644 index 68e90396c8a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - int i; - const int arrayLength = 1000; - - // Create random data to write to the stream. - array^dataArray = gcnew array(arrayLength); - Random^ randomGenerator = gcnew Random; - for ( i = 0; i < arrayLength; i++ ) - { - dataArray[ i ] = 100.1 * randomGenerator->NextDouble(); - - } - BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); - try - { - - // Write data to the stream. - Console::WriteLine( "Writing data to the stream." ); - i = 0; - for ( i = 0; i < arrayLength; i++ ) - { - binWriter->Write( dataArray[ i ] ); - - } - - // Create a reader using the stream from the writer. - BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); - - // Return to the beginning of the stream. - binReader->BaseStream->Position = 0; - try - { - - // Read and verify the data. - i = 0; - Console::WriteLine( "Verifying the written data." ); - for ( i = 0; i < arrayLength; i++ ) - { - if ( binReader->ReadDouble() != dataArray[ i ] ) - { - Console::WriteLine( "Error writing data." ); - break; - } - - } - Console::WriteLine( "The data was written and verified." ); - } - catch ( EndOfStreamException^ e ) - { - Console::WriteLine( "Error writing data: {0}.", e->GetType()->Name ); - } - - } - finally - { - binWriter->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp deleted file mode 100644 index 432c26e3d9c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -public ref class BinReadWrite -{ -public: - static void Main() - { - String^ testfile = "C:\\temp\\testfile.bin"; - - // create a test file using BinaryWriter - FileStream^ fs = File::Create(testfile); - UTF8Encoding^ utf8 = gcnew UTF8Encoding(); - - BinaryWriter^ bw = gcnew BinaryWriter(fs, utf8); - // write a series of bytes to the file, each time incrementing - // the value from 0 - 127 - int pos; - - for (pos = 0; pos < 128; pos++) - { - bw->Write((Byte)pos); - } - - // reset the stream position for the next write pass - bw->Seek(0, SeekOrigin::Begin); - // write marks in file with the value of 255 going forward - for (pos = 0; pos < 120; pos += 8) - { - bw->Seek(7, SeekOrigin::Current); - bw->Write((Byte)255); - } - - // reset the stream position for the next write pass - bw->Seek(0, SeekOrigin::End); - // write marks in file with the value of 254 going backward - for (pos = 128; pos > 6; pos -= 6) - { - bw->Seek(-6, SeekOrigin::Current); - bw->Write((Byte)254); - bw->Seek(-1, SeekOrigin::Current); - } - - // now dump the contents of the file using the original file stream - fs->Seek(0, SeekOrigin::Begin); - array^ rawbytes = gcnew array(fs->Length); - fs->Read(rawbytes, 0, (int)fs->Length); - - int i = 0; - for each (Byte b in rawbytes) - { - switch (b) - { - case 254: - { - Console::Write("-%- "); - } - break; - - case 255: - { - Console::Write("-*- "); - } - break; - - default: - { - Console::Write("{0:d3} ", b); - } - break; - } - i++; - if (i == 16) - { - Console::WriteLine(); - i = 0; - } - } - fs->Close(); - } -}; - -int main() -{ - BinReadWrite::Main(); -} - -//The output from the program is this: -// -// 000 001 -%- 003 004 005 006 -*- -%- 009 010 011 012 013 -%- -*- -// 016 017 018 019 -%- 021 022 -*- 024 025 -%- 027 028 029 030 -*- -// -%- 033 034 035 036 037 -%- -*- 040 041 042 043 -%- 045 046 -*- -// 048 049 -%- 051 052 053 054 -*- -%- 057 058 059 060 061 -%- -*- -// 064 065 066 067 -%- 069 070 -*- 072 073 -%- 075 076 077 078 -*- -// -%- 081 082 083 084 085 -%- -*- 088 089 090 091 -%- 093 094 -*- -// 096 097 -%- 099 100 101 102 -*- -%- 105 106 107 108 109 -%- -*- -// 112 113 114 115 -%- 117 118 -*- 120 121 -%- 123 124 125 126 127 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp deleted file mode 100644 index c0d99cbb370..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp +++ /dev/null @@ -1,168 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Globalization; -using namespace System::Net; -using namespace System::Net::Sockets; -static const int streamBufferSize = 1000; -public ref class Client -{ -private: - literal int dataArraySize = 100; - literal int numberOfLoops = 10000; - Client(){} - - -public: - static void ReceiveData( Stream^ netStream, Stream^ bufStream ) - { - DateTime startTime; - Double networkTime; - Double bufferedTime = 0; - int bytesReceived = 0; - array^receivedData = gcnew array(dataArraySize); - - // Receive data using the NetworkStream. - Console::WriteLine( "Receiving data using NetworkStream." ); - startTime = DateTime::Now; - while ( bytesReceived < numberOfLoops * receivedData->Length ) - { - bytesReceived += netStream->Read( receivedData, 0, receivedData->Length ); - } - - networkTime = (DateTime::Now - startTime).TotalSeconds; - Console::WriteLine( "{0} bytes received in {1} seconds.\n", bytesReceived.ToString(), networkTime.ToString( "F1" ) ); - - // - // Receive data using the BufferedStream. - Console::WriteLine( "Receiving data using BufferedStream." ); - bytesReceived = 0; - startTime = DateTime::Now; - while ( bytesReceived < numberOfLoops * receivedData->Length ) - { - bytesReceived += bufStream->Read( receivedData, 0, receivedData->Length ); - } - - bufferedTime = (DateTime::Now - startTime).TotalSeconds; - Console::WriteLine( "{0} bytes received in {1} seconds.\n", bytesReceived.ToString(), bufferedTime.ToString( "F1" ) ); - - // - // Print the ratio of read times. - Console::WriteLine( "Receiving data using the buffered " - "network stream was {0} {1} than using the network " - "stream alone.", (networkTime / bufferedTime).ToString( "P0" ), bufferedTime < networkTime ? (String^)"faster" : "slower" ); - } - - static void SendData( Stream^ netStream, Stream^ bufStream ) - { - DateTime startTime; - Double networkTime; - Double bufferedTime; - - // Create random data to send to the server. - array^dataToSend = gcnew array(dataArraySize); - (gcnew Random)->NextBytes( dataToSend ); - - // Send the data using the NetworkStream. - Console::WriteLine( "Sending data using NetworkStream." ); - startTime = DateTime::Now; - for ( int i = 0; i < numberOfLoops; i++ ) - { - netStream->Write( dataToSend, 0, dataToSend->Length ); - - } - networkTime = (DateTime::Now - startTime).TotalSeconds; - Console::WriteLine( "{0} bytes sent in {1} seconds.\n", (numberOfLoops * dataToSend->Length).ToString(), networkTime.ToString( "F1" ) ); - - // - // Send the data using the BufferedStream. - Console::WriteLine( "Sending data using BufferedStream." ); - startTime = DateTime::Now; - for ( int i = 0; i < numberOfLoops; i++ ) - { - bufStream->Write( dataToSend, 0, dataToSend->Length ); - - } - bufStream->Flush(); - bufferedTime = (DateTime::Now - startTime).TotalSeconds; - Console::WriteLine( "{0} bytes sent in {1} seconds.\n", (numberOfLoops * dataToSend->Length).ToString(), bufferedTime.ToString( "F1" ) ); - - // - // Print the ratio of write times. - Console::WriteLine( "Sending data using the buffered " - "network stream was {0} {1} than using the network " - "stream alone.\n", (networkTime / bufferedTime).ToString( "P0" ), bufferedTime < networkTime ? (String^)"faster" : "slower" ); - } - -}; - -int main( int argc, char *argv[] ) -{ - - // Check that an argument was specified when the - // program was invoked. - if ( argc == 1 ) - { - Console::WriteLine( "Error: The name of the host computer" - " must be specified when the program is invoked." ); - return -1; - } - - String^ remoteName = gcnew String( argv[ 1 ] ); - - // Create the underlying socket and connect to the server. - Socket^ clientSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - clientSocket->Connect( gcnew IPEndPoint( Dns::Resolve( remoteName )->AddressList[ 0 ],1800 ) ); - Console::WriteLine( "Client is connected.\n" ); - - // - // Create a NetworkStream that owns clientSocket and - // then create a BufferedStream on top of the NetworkStream. - NetworkStream^ netStream = gcnew NetworkStream( clientSocket,true ); - BufferedStream^ bufStream = gcnew BufferedStream( netStream,streamBufferSize ); - - // - try - { - - // - // Check whether the underlying stream supports seeking. - Console::WriteLine( "NetworkStream {0} seeking.\n", bufStream->CanSeek ? (String^)"supports" : "does not support" ); - - // - // Send and receive data. - // - if ( bufStream->CanWrite ) - { - Client::SendData( netStream, bufStream ); - } - - // - // - if ( bufStream->CanRead ) - { - Client::ReceiveData( netStream, bufStream ); - } - - // - } - finally - { - - // - // When bufStream is closed, netStream is in turn closed, - // which in turn shuts down the connection and closes - // clientSocket. - Console::WriteLine( "\nShutting down connection." ); - bufStream->Close(); - - // - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp deleted file mode 100644 index fef12f4fa47..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -int main() -{ - - // This is a Windows Sockets 2 error code. - const int WSAETIMEDOUT = 10060; - Socket^ serverSocket; - int bytesReceived; - int totalReceived = 0; - array^receivedData = gcnew array(2000000); - - // Create random data to send to the client. - array^dataToSend = gcnew array(2000000); - (gcnew Random)->NextBytes( dataToSend ); - IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; - IPEndPoint^ ipEndpoint = gcnew IPEndPoint( ipAddress,1800 ); - - // Create a socket and listen for incoming connections. - Socket^ listenSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - try - { - listenSocket->Bind( ipEndpoint ); - listenSocket->Listen( 1 ); - - // Accept a connection and create a socket to handle it. - serverSocket = listenSocket->Accept(); - Console::WriteLine( "Server is connected.\n" ); - } - finally - { - listenSocket->Close(); - } - - try - { - - // Send data to the client. - Console::Write( "Sending data ... " ); - int bytesSent = serverSocket->Send( dataToSend, 0, dataToSend->Length, SocketFlags::None ); - Console::WriteLine( "{0} bytes sent.\n", bytesSent.ToString() ); - - // Set the timeout for receiving data to 2 seconds. - serverSocket->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::ReceiveTimeout, 2000 ); - - // Receive data from the client. - Console::Write( "Receiving data ... " ); - try - { - do - { - bytesReceived = serverSocket->Receive( receivedData, 0, receivedData->Length, SocketFlags::None ); - totalReceived += bytesReceived; - } - while ( bytesReceived != 0 ); - } - catch ( SocketException^ e ) - { - if ( e->ErrorCode == WSAETIMEDOUT ) - { - - // Data was not received within the given time. - // Assume that the transmission has ended. - } - else - { - Console::WriteLine( "{0}: {1}\n", e->GetType()->Name, e->Message ); - } - } - finally - { - Console::WriteLine( "{0} bytes received.\n", totalReceived.ToString() ); - } - - } - finally - { - serverSocket->Shutdown( SocketShutdown::Both ); - Console::WriteLine( "Connection shut down." ); - serverSocket->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp deleted file mode 100644 index c11186b5225..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp +++ /dev/null @@ -1,163 +0,0 @@ - -// -// -// -// -// -using namespace System; -class Class1 -{ -public: - void PrintFileSystemEntries( String^ path ) - { - try - { - - // Obtain the file system entries in the directory path. - array^directoryEntries = System::IO::Directory::GetFileSystemEntries( path ); - for ( int i = 0; i < directoryEntries->Length; i++ ) - { - System::Console::WriteLine( directoryEntries[ i ] ); - - } - } - catch ( ArgumentNullException^ ) - { - System::Console::WriteLine( "Path is a null reference." ); - } - catch ( System::Security::SecurityException^ ) - { - System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); - } - catch ( ArgumentException^ ) - { - System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." ); - } - catch ( System::IO::DirectoryNotFoundException^ ) - { - System::Console::WriteLine( "The path encapsulated in the \HelloServer' Directory object does not exist." ); - } - - } - - void PrintFileSystemEntries( String^ path, String^ pattern ) - { - try - { - - // Obtain the file system entries in the directory - // path that match the pattern. - array^directoryEntries = System::IO::Directory::GetFileSystemEntries( path, pattern ); - for ( int i = 0; i < directoryEntries->Length; i++ ) - { - System::Console::WriteLine( directoryEntries[ i ] ); - - } - } - catch ( ArgumentNullException^ ) - { - System::Console::WriteLine( "Path is a null reference." ); - } - catch ( System::Security::SecurityException^ ) - { - System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); - } - catch ( ArgumentException^ ) - { - System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." ); - } - catch ( System::IO::DirectoryNotFoundException^ ) - { - System::Console::WriteLine( "The path encapsulated in the \HelloServer' Directory object does not exist." ); - } - - } - - - // Print out all logical drives on the system. - void GetLogicalDrives() - { - try - { - array^drives = System::IO::Directory::GetLogicalDrives(); - for ( int i = 0; i < drives->Length; i++ ) - { - System::Console::WriteLine( drives[ i ] ); - - } - } - catch ( System::IO::IOException^ ) - { - System::Console::WriteLine( "An I/O error occurs." ); - } - catch ( System::Security::SecurityException^ ) - { - System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); - } - - } - - void GetParent( String^ path ) - { - try - { - System::IO::DirectoryInfo^ directoryInfo = System::IO::Directory::GetParent( path ); - System::Console::WriteLine( directoryInfo->FullName ); - } - catch ( ArgumentNullException^ ) - { - System::Console::WriteLine( "Path is a null reference." ); - } - catch ( ArgumentException^ ) - { - System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, or \HelloServer' contains invalid characters." ); - } - - } - - void Move( String^ sourcePath, String^ destinationPath ) - { - try - { - System::IO::Directory::Move( sourcePath, destinationPath ); - System::Console::WriteLine( "The directory move is complete." ); - } - catch ( ArgumentNullException^ ) - { - System::Console::WriteLine( "Path is a null reference." ); - } - catch ( System::Security::SecurityException^ ) - { - System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); - } - catch ( ArgumentException^ ) - { - System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." ); - } - catch ( System::IO::IOException^ ) - { - System::Console::WriteLine( "An attempt was made to move a \HelloServer' directory to a different \HelloServer' volume, or destDirName \HelloServer' already exists." ); - } - - } - -}; - -int main() -{ - Class1 * snippets = new Class1; - String^ path = System::IO::Directory::GetCurrentDirectory(); - String^ filter = "*.exe"; - snippets->PrintFileSystemEntries( path ); - snippets->PrintFileSystemEntries( path, filter ); - snippets->GetLogicalDrives(); - snippets->GetParent( path ); - snippets->Move( "C:\\proof", "C:\\Temp" ); - return 0; -} - -// -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp deleted file mode 100644 index 4223289ec56..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -using namespace System; -using namespace System::IO; - -ref class App -{ -public: - static void Main() - { - // Specify the directory you want to manipulate. - String^ path = "c:\\"; - String^ searchPattern = "c*"; - - DirectoryInfo^ di = gcnew DirectoryInfo(path); - array^ directories = - di->GetDirectories(searchPattern, SearchOption::TopDirectoryOnly); - - array^ files = - di->GetFiles(searchPattern, SearchOption::TopDirectoryOnly); - - Console::WriteLine( - "Directories that begin with the letter \"c\" in {0}", path); - for each (DirectoryInfo^ dir in directories) - { - Console::WriteLine( - "{0,-25} {1,25}", dir->FullName, dir->LastWriteTime); - } - - Console::WriteLine(); - Console::WriteLine( - "Files that begin with the letter \"c\" in {0}", path); - for each (FileInfo^ file in files) - { - Console::WriteLine( - "{0,-25} {1,25}", file->Name, file->LastWriteTime); - } - } // Main() -}; // App() - -int main() -{ - App::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp deleted file mode 100644 index 5bae2a921c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -// This sample shows how to set the current directory and how to determine -// the root directory. -using namespace System; -using namespace System::IO; -int main() -{ - - // Create string for a directory. This value should be an existing directory - // or the sample will throw a DirectoryNotFoundException. - String^ dir = "C:\\test"; - try - { - - //Set the current directory. - Directory::SetCurrentDirectory( dir ); - } - catch ( DirectoryNotFoundException^ e ) - { - Console::WriteLine( "The specified directory does not exist. {0}", e ); - } - - - // Print to console the results. - Console::WriteLine( "Root directory: {0}", Directory::GetDirectoryRoot( dir ) ); - Console::WriteLine( "Current directory: {0}", Directory::GetCurrentDirectory() ); -} - -// The output of this sample depends on what value you assign to the variable dir. -// If the directory c:\test exists, the output for this sample is: -// Root directory: C:\ -// Current directory: C:\test -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp deleted file mode 100644 index fc1124722e1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ fileName = "Test@##@.dat"; - - // Create random data to write to the file. - array^dataArray = gcnew array(100000); - (gcnew Random)->NextBytes( dataArray ); - FileStream^ fileStream = gcnew FileStream( fileName,FileMode::Create ); - try - { - - // Write the data to the file, byte by byte. - for ( int i = 0; i < dataArray->Length; i++ ) - { - fileStream->WriteByte( dataArray[ i ] ); - - } - - // Set the stream position to the beginning of the file. - fileStream->Seek( 0, SeekOrigin::Begin ); - - // Read and verify the data. - for ( int i = 0; i < fileStream->Length; i++ ) - { - if ( dataArray[ i ] != fileStream->ReadByte() ) - { - Console::WriteLine( "Error writing data." ); - return -1; - } - - } - Console::WriteLine( "The data was written to {0} " - "and verified.", fileStream->Name ); - } - finally - { - fileStream->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp deleted file mode 100644 index e6d0b8b59b5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp +++ /dev/null @@ -1,156 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Threading; - -// Maintain state information to be passed to -// EndWriteCallback and EndReadCallback. -ref class State -{ -private: - - // fStream is used to read and write to the file. - FileStream^ fStream; - - // writeArray stores data that is written to the file. - array^writeArray; - - // readArray stores data that is read from the file. - array^readArray; - - // manualEvent signals the main thread - // when verification is complete. - ManualResetEvent^ manualEvent; - -public: - State( FileStream^ fStream, array^writeArray, ManualResetEvent^ manualEvent ) - { - this->fStream = fStream; - this->writeArray = writeArray; - this->manualEvent = manualEvent; - readArray = gcnew array(writeArray->Length); - } - - - property FileStream^ FStream - { - FileStream^ get() - { - return fStream; - } - - } - - property array^ WriteArray - { - array^ get() - { - return writeArray; - } - - } - - property array^ ReadArray - { - array^ get() - { - return readArray; - } - - } - - property ManualResetEvent^ ManualEvent - { - ManualResetEvent^ get() - { - return manualEvent; - } - - } - -}; - -ref class FStream -{ -private: - - // When BeginRead is finished reading data from the file, the - // EndReadCallback method is called to end the asynchronous - // read operation and then verify the data. - // - static void EndReadCallback( IAsyncResult^ asyncResult ) - { - State^ tempState = dynamic_cast(asyncResult->AsyncState); - int readCount = tempState->FStream->EndRead( asyncResult ); - int i = 0; - while ( i < readCount ) - { - if ( tempState->ReadArray[ i ] != tempState->WriteArray[ i++ ] ) - { - Console::WriteLine( "Error writing data." ); - tempState->FStream->Close(); - return; - } - } - - Console::WriteLine( "The data was written to {0} " - "and verified.", tempState->FStream->Name ); - tempState->FStream->Close(); - - // Signal the main thread that the verification is finished. - tempState->ManualEvent->Set(); - } - - -public: - - // - // When BeginWrite is finished writing data to the file, the - // EndWriteCallback method is called to end the asynchronous - // write operation and then read back and verify the data. - // - static void EndWriteCallback( IAsyncResult^ asyncResult ) - { - State^ tempState = dynamic_cast(asyncResult->AsyncState); - FileStream^ fStream = tempState->FStream; - fStream->EndWrite( asyncResult ); - - // Asynchronously read back the written data. - fStream->Position = 0; - asyncResult = fStream->BeginRead( tempState->ReadArray, 0, tempState->ReadArray->Length, gcnew AsyncCallback( &FStream::EndReadCallback ), tempState ); - - // Concurrently do other work, such as - // logging the write operation. - } - -}; - - -// -// -int main() -{ - - // Create a synchronization object that gets - // signaled when verification is complete. - ManualResetEvent^ manualEvent = gcnew ManualResetEvent( false ); - - // Create the data to write to the file. - array^writeArray = gcnew array(100000); - (gcnew Random)->NextBytes( writeArray ); - FileStream^ fStream = gcnew FileStream( "Test#@@#.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::None,4096,true ); - - // Check that the FileStream was opened asynchronously. - Console::WriteLine( "fStream was {0}opened asynchronously.", fStream->IsAsync ? (String^)"" : "not " ); - - // Asynchronously write to the file. - IAsyncResult^ asyncResult = fStream->BeginWrite( writeArray, 0, writeArray->Length, gcnew AsyncCallback( &FStream::EndWriteCallback ), gcnew State( fStream,writeArray,manualEvent ) ); - - // Concurrently do other work and then wait - // for the data to be written and verified. - manualEvent->WaitOne( 5000, false ); -} - -// -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp deleted file mode 100644 index c9d04e24506..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp +++ /dev/null @@ -1,144 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -int main() -{ - UnicodeEncoding^ uniEncoding = gcnew UnicodeEncoding; - String^ lastRecordText = "The last processed record number was: "; - int textLength = uniEncoding->GetByteCount( lastRecordText ); - int recordNumber = 13; - int byteCount = uniEncoding->GetByteCount( recordNumber.ToString() ); - String^ tempString; - - // - FileStream^ fileStream = gcnew FileStream( "Test#@@#.dat",FileMode::OpenOrCreate,FileAccess::ReadWrite,FileShare::ReadWrite ); - - // - try - { - - // - // Write the original file data. - if ( fileStream->Length == 0 ) - { - tempString = String::Concat( lastRecordText, recordNumber.ToString() ); - fileStream->Write( uniEncoding->GetBytes( tempString ), 0, uniEncoding->GetByteCount( tempString ) ); - } - - // - // Allow the user to choose the operation. - Char consoleInput = 'R'; - array^readText = gcnew array(fileStream->Length); - while ( consoleInput != 'X' ) - { - Console::Write( "\nEnter 'R' to read, 'W' to write, 'L' to " - "lock, 'U' to unlock, anything else to exit: " ); - if ( (tempString = Console::ReadLine())->Length == 0 ) - { - break; - } - consoleInput = Char::ToUpper( tempString[0] ); - switch ( consoleInput ) - { - case 'R': - try - { - fileStream->Seek( 0, SeekOrigin::Begin ); - fileStream->Read( readText, 0, (int)fileStream->Length ); - tempString = gcnew String( uniEncoding->GetChars( readText, 0, readText->Length ) ); - Console::WriteLine( tempString ); - recordNumber = Int32::Parse( tempString->Substring( tempString->IndexOf( ':' ) + 2 ) ); - } - // Catch the IOException generated if the - // specified part of the file is locked. - catch ( IOException^ e ) - { - Console::WriteLine( "{0}: The read " - "operation could not be performed " - "because the specified part of the " - "file is locked.", e->GetType()->Name ); - } - - break; - - // - // Update the file. - case 'W': - try - { - fileStream->Seek( textLength, SeekOrigin::Begin ); - fileStream->Read( readText, textLength - 1, byteCount ); - tempString = gcnew String( uniEncoding->GetChars( readText, textLength - 1, byteCount ) ); - recordNumber = Int32::Parse( tempString ) + 1; - fileStream->Seek( textLength, SeekOrigin::Begin ); - fileStream->Write( uniEncoding->GetBytes( recordNumber.ToString() ), 0, byteCount ); - fileStream->Flush(); - Console::WriteLine( "Record has been updated." ); - } - // - // - // Catch the IOException generated if the - // specified part of the file is locked. - catch ( IOException^ e ) - { - Console::WriteLine( "{0}: The write operation could not " - "be performed because the specified " - "part of the file is locked.", e->GetType()->Name ); - } - - - // - break; - - // Lock the specified part of the file. - case 'L': - try - { - fileStream->Lock( textLength - 1, byteCount ); - Console::WriteLine( "The specified part " - "of file has been locked." ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "{0}: The specified part of file is" - " already locked.", e->GetType()->Name ); - } - - break; - - // - // Unlock the specified part of the file. - case 'U': - try - { - fileStream->Unlock( textLength - 1, byteCount ); - Console::WriteLine( "The specified part " - "of file has been unlocked." ); - } - catch ( IOException^ e ) - { - Console::WriteLine( "{0}: The specified part of file is " - "not locked by the current process.", e->GetType()->Name ); - } - - break; - - default: - - // - // Exit the program. - consoleInput = 'X'; - break; - } - } - } - finally - { - fileStream->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp deleted file mode 100644 index af3bee22a32..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp +++ /dev/null @@ -1,61 +0,0 @@ -using namespace System; -using namespace System::IO; -using namespace System::IO::IsolatedStorage; - -public ref class IsoFileGetStoreSample -{ -public: - static void Main() - { - IsolatedStorageFile^ isoFile; - - // remarks for GetMachineStoreForApplication() - // - isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application | - IsolatedStorageScope::Machine, (Type^)nullptr); - // - isoFile->Close(); - - // remarks for GetMachineStoreForAssembly() - // - isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | - IsolatedStorageScope::Machine, (Type^)nullptr, (Type^)nullptr); - // - isoFile->Close(); - - // remarks for GetMachineStoreForDomain() - // - isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | - IsolatedStorageScope::Domain | IsolatedStorageScope::Machine, - (Type^)nullptr, (Type^)nullptr); - // - isoFile->Close(); - - // remarks for GetUserStoreForApplication() - // - isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application | - IsolatedStorageScope::User, (Type^)nullptr); - // - isoFile->Close(); - - // remarks for GetUserStoreForAssembly() - // - isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | - IsolatedStorageScope::User, (Type^)nullptr, (Type^)nullptr); - // - isoFile->Close(); - - // remarks for GetUserStoreForDomain() - // - isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | - IsolatedStorageScope::Domain | IsolatedStorageScope::User, - (Type^)nullptr, (Type^)nullptr); - // - isoFile->Close(); - } -}; - -int main() -{ - IsoFileGetStoreSample::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp deleted file mode 100644 index daaf6e6e7ea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp +++ /dev/null @@ -1,422 +0,0 @@ - -// -// This sample demonstrates methods of classes found in the System.IO IsolatedStorage namespace. -using namespace System; -using namespace System::IO; -using namespace System::IO::IsolatedStorage; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; - -public ref class LoginPrefs -{ -private: - String^ userName; - String^ newsUrl; - String^ sportsUrl; - bool newPrefs; - -public: - - // - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - bool GetPrefsForUser() - { - try - { - - // - // Retrieve an IsolatedStorageFile for the current Domain and Assembly. - IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr, nullptr ); - IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile ); - - // - // farThe code executes to this point only if a file corresponding to the username exists. - // Though you can perform operations on the stream, you cannot get a handle to the file. - try - { - IntPtr aFileHandle = isoStream->Handle; - Console::WriteLine( "A pointer to a file handle has been obtained. {0} {1}", aFileHandle, aFileHandle.GetHashCode() ); - } - catch ( Exception^ e ) - { - - // Handle the exception. - Console::WriteLine( "Expected exception" ); - Console::WriteLine( e->ToString() ); - } - - StreamReader^ reader = gcnew StreamReader( isoStream ); - - // Read the data. - this->NewsUrl = reader->ReadLine(); - this->SportsUrl = reader->ReadLine(); - reader->Close(); - isoFile->Close(); - isoStream->Close(); - return false; - } - catch ( Exception^ e ) - { - - // Expected exception if a file cannot be found. This indicates that we have a new user. - String^ errorMessage = e->ToString(); - return true; - } - - } - - - // - // - bool GetIsoStoreInfo() - { - - // Get a User store with type evidence for the current Domain and the Assembly. - IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); - - // - array^dirNames = isoFile->GetDirectoryNames( "*" ); - array^fileNames = isoFile->GetFileNames( "*" ); - - // List directories currently in this Isolated Storage. - if ( dirNames->Length > 0 ) - { - for ( int i = 0; i < dirNames->Length; ++i ) - { - Console::WriteLine( "Directory Name: {0}", dirNames[ i ] ); - - } - } - - - // List the files currently in this Isolated Storage. - // The list represents all users who have personal preferences stored for this application. - if ( fileNames->Length > 0 ) - { - for ( int i = 0; i < fileNames->Length; ++i ) - { - Console::WriteLine( "File Name: {0}", fileNames[ i ] ); - - } - } - - - // - isoFile->Close(); - return true; - } - - - // - // - double SetPrefsForUser() - { - try - { - - // - IsolatedStorageFile^ isoFile; - isoFile = IsolatedStorageFile::GetUserStoreForDomain(); - - // Open or create a writable file. - IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,isoFile ); - StreamWriter^ writer = gcnew StreamWriter( isoStream ); - writer->WriteLine( this->NewsUrl ); - writer->WriteLine( this->SportsUrl ); - - // Calculate the amount of space used to record the user's preferences. - double d = isoFile->CurrentSize / isoFile->MaximumSize; - Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() ); - Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() ); - writer->Close(); - isoFile->Close(); - isoStream->Close(); - return d; - - // - } - catch ( Exception^ e ) - { - // Add code here to handle the exception. - Console::WriteLine( e->ToString() ); - return 0.0; - } - - } - - - // - // - void DeleteFiles() - { - - // - try - { - IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); - array^dirNames = isoFile->GetDirectoryNames( "*" ); - array^fileNames = isoFile->GetFileNames( "*" ); - - // - // List the files currently in this Isolated Storage. - // The list represents all users who have personal - // preferences stored for this application. - if ( fileNames->Length > 0 ) - { - for ( int i = 0; i < fileNames->Length; ++i ) - { - - //Delete the files. - isoFile->DeleteFile( fileNames[ i ] ); - - } - fileNames = isoFile->GetFileNames( "*" ); - } - isoFile->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - - } - - - // - // - // This method deletes directories in the specified Isolated Storage, after first - // deleting the files they contain. In this example, the Archive directory is deleted. - // There should be no other directories in this Isolated Storage. - void DeleteDirectories() - { - try - { - IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); - array^dirNames = isoFile->GetDirectoryNames( "*" ); - array^fileNames = isoFile->GetFileNames( "Archive\\*" ); - - // Delete the current files within the Archive directory. - if ( fileNames->Length > 0 ) - { - for ( int i = 0; i < fileNames->Length; ++i ) - { - - //delete files - isoFile->DeleteFile( String::Concat("Archive\\", fileNames[ i ]) ); - - } - fileNames = isoFile->GetFileNames( "Archive\\*" ); - } - if ( dirNames->Length > 0 ) - { - for ( int i = 0; i < dirNames->Length; ++i ) - { - - // Delete the Archive directory. - isoFile->DeleteDirectory( dirNames[ i ] ); - - } - } - dirNames = isoFile->GetDirectoryNames( "*" ); - isoFile->Remove(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - - } - - - // - // - double SetNewPrefsForUser() - { - try - { - Byte inputChar; - IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); - - // If this is not a new user, archive the old preferences and - // overwrite them using the new preferences. - if ( !this->NewPrefs ) - { - if ( isoFile->GetDirectoryNames( "Archive" )->Length == 0 ) - isoFile->CreateDirectory( "Archive" ); - else - { - - // - // This is the stream to which data will be written. - IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile ); - - // This is the stream from which data will be read. - Console::WriteLine( "Is the source file readable? {0}", (source->CanRead ? (String^)"true" : "false") ); - Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." ); - - // Open or create a writable file. - IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile ); - - // - // - Console::WriteLine( "Is the target file writable? {0}", (target->CanWrite ? (String^)"true" : "false") ); - - // - // Stream the old file to a new file in the Archive directory. - if ( source->IsAsync && target->IsAsync ) - { - - // IsolatedStorageFileStreams cannot be asynchronous. However, you - // can use the asynchronous BeginRead and BeginWrite functions - // with some possible performance penalty. - Console::WriteLine( "IsolatedStorageFileStreams cannot be asynchronous." ); - } - else - { - - // - Console::WriteLine( "Writing data to the new file." ); - while ( source->Position < source->Length ) - { - inputChar = (Byte)source->ReadByte(); - target->WriteByte( (Byte)source->ReadByte() ); - } - - // Determine the size of the IsolatedStorageFileStream - // by checking its Length property. - Console::WriteLine( "Total Bytes Read: {0}", source->Length.ToString() ); - - // - } - - // After you have read and written to the streams, close them. - target->Close(); - source->Close(); - } - } - - // - // Open or create a writable file, no larger than 10k - IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,10240,isoFile ); - - // - isoStream->Position = 0; // Position to overwrite the old data. - - // - // - StreamWriter^ writer = gcnew StreamWriter( isoStream ); - - // Update the data based on the new inputs. - writer->WriteLine( this->NewsUrl ); - writer->WriteLine( this->SportsUrl ); - - // Calculate the amount of space used to record this user's preferences. - double d = isoFile->CurrentSize / isoFile->MaximumSize; - Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() ); - Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() ); - - // - // StreamWriter.Close implicitly closes isoStream. - writer->Close(); - isoFile->Close(); - return d; - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - return 0.0; - } - - } - - LoginPrefs( String^ aUserName ) - { - userName = aUserName; - newPrefs = GetPrefsForUser(); - } - - - property String^ NewsUrl - { - String^ get() - { - return newsUrl; - } - - void set( String^ value ) - { - newsUrl = value; - } - - } - - property String^ SportsUrl - { - String^ get() - { - return sportsUrl; - } - - void set( String^ value ) - { - sportsUrl = value; - } - - } - - property bool NewPrefs - { - bool get() - { - return newPrefs; - } - - } - -}; - -void GatherInfoFromUser( LoginPrefs^ lp ) -{ - Console::WriteLine( "Please enter the URL of your news site." ); - lp->NewsUrl = Console::ReadLine(); - Console::WriteLine( "Please enter the URL of your sports site." ); - lp->SportsUrl = Console::ReadLine(); -} - -int main() -{ - - // Prompt the user for their username. - Console::WriteLine( "Enter your login ID:" ); - - // Does no error checking. - LoginPrefs^ lp = gcnew LoginPrefs( Console::ReadLine() ); - if ( lp->NewPrefs ) - { - Console::WriteLine( "Please set preferences for a new user." ); - GatherInfoFromUser( lp ); - - // Write the new preferences to storage. - double percentUsed = lp->SetPrefsForUser(); - Console::WriteLine( "Your preferences have been written. Current space used is {0}%", percentUsed ); - } - else - { - Console::WriteLine( "Welcome back." ); - Console::WriteLine( "Your preferences have expired, please reset them." ); - GatherInfoFromUser( lp ); - lp->SetNewPrefsForUser(); - Console::WriteLine( "Your news site has been set to {0}\n and your sports site has been set to {1}.", lp->NewsUrl, lp->SportsUrl ); - } - - lp->GetIsoStoreInfo(); - Console::WriteLine( "Enter 'd' to delete the IsolatedStorage files and exit, or press any other key to exit without deleting files." ); - String^ consoleInput = Console::ReadLine(); - if ( consoleInput->Equals( "d" ) ) - { - lp->DeleteFiles(); - lp->DeleteDirectories(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp deleted file mode 100644 index 6d60f8f19f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp +++ /dev/null @@ -1,74 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - int count; - array^byteArray; - array^charArray; - UnicodeEncoding^ uniEncoding = gcnew UnicodeEncoding; - - // Create the data to write to the stream. - array^firstString = uniEncoding->GetBytes( "Invalid file path characters are: " ); - array^secondString = uniEncoding->GetBytes( Path::InvalidPathChars ); - - // - MemoryStream^ memStream = gcnew MemoryStream( 100 ); - // - try - { - // - // Write the first string to the stream. - memStream->Write( firstString, 0, firstString->Length ); - // - - // - // Write the second string to the stream, byte by byte. - count = 0; - while ( count < secondString->Length ) - { - memStream->WriteByte( secondString[ count++ ] ); - } - // - - - // - // Write the stream properties to the console. - Console::WriteLine( "Capacity = {0}, Length = {1}, " - "Position = {2}\n", memStream->Capacity.ToString(), memStream->Length.ToString(), memStream->Position.ToString() ); - // - - // - // Set the stream position to the beginning of the stream. - memStream->Seek( 0, SeekOrigin::Begin ); - // - - // - // Read the first 20 bytes from the stream. - byteArray = gcnew array(memStream->Length); - count = memStream->Read( byteArray, 0, 20 ); - // - - // - // Read the remaining bytes, byte by byte. - while ( count < memStream->Length ) - { - byteArray[ count++ ] = Convert::ToByte( memStream->ReadByte() ); - } - // - - // Decode the Byte array into a Char array - // and write it to the console. - charArray = gcnew array(uniEncoding->GetCharCount( byteArray, 0, count )); - uniEncoding->GetDecoder()->GetChars( byteArray, 0, count, charArray, 0 ); - Console::WriteLine( charArray ); - } - finally - { - memStream->Close(); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp deleted file mode 100644 index ea4a47ab8ca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp +++ /dev/null @@ -1,307 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -void ChangeExtension() -{ - String^ goodFileName = "C:\\mydir\\myfile.com.extension"; - String^ badFileName = "C:\\mydir\\"; - String^ result; - result = Path::ChangeExtension( goodFileName, ".old" ); - Console::WriteLine( "ChangeExtension({0}, '.old') returns '{1}'", goodFileName, result ); - result = Path::ChangeExtension( goodFileName, "" ); - Console::WriteLine( "ChangeExtension({0}, '') returns '{1}'", goodFileName, result ); - result = Path::ChangeExtension( badFileName, ".old" ); - Console::WriteLine( "ChangeExtension({0}, '.old') returns '{1}'", badFileName, result ); - - // This code produces output similar to the following: - // - // ChangeExtension(C:\mydir\myfile.com.extension, '.old') returns 'C:\mydir\myfile.com.old' - // ChangeExtension(C:\mydir\myfile.com.extension, '') returns 'C:\mydir\myfile.com.' - // ChangeExtension(C:\mydir\, '.old') returns 'C:\mydir\.old' - // - Console::WriteLine(); -} - -void Combine() -{ - // - String^ path1 = " C:\\mydir1"; - String^ path2 = "mydir2"; - String^ path3 = " mydir3"; - String^ combinedPaths; - combinedPaths = Path::Combine( path1, path2 ); - Console::WriteLine( "Combine('{0}', '{1}') returns '{2}'", path1, path2, combinedPaths ); - combinedPaths = Path::Combine( path1, path3 ); - Console::WriteLine( "Combine('{0}', '{1}') returns '{2}'", path1, path3, combinedPaths ); - - // This code produces output similar to the following: - // - // Combine(' C:\mydir1', 'mydir2') returns ' C:\mydir1\mydir2' - // Combine(' C:\mydir1', ' mydir3') returns ' C:\mydir1\ mydir3' - // - Console::WriteLine(); -} - -void GetDirectoryName() -{ - // - String^ filePath = "C:\\MyDir\\MySubDir\\myfile.ext"; - String^ directoryName; - int i = 0; - - while (filePath != nullptr) - { - directoryName = Path::GetDirectoryName(filePath); - Console::WriteLine("GetDirectoryName('{0}') returns '{1}'", - filePath, directoryName); - filePath = directoryName; - if (i == 1) - { - filePath = directoryName + "\\"; // this will preserve the previous path - } - i++; - } - /* - This code produces the following output: - - GetDirectoryName('C:\MyDir\MySubDir\myfile.ext') returns 'C:\MyDir\MySubDir' - GetDirectoryName('C:\MyDir\MySubDir') returns 'C:\MyDir' - GetDirectoryName('C:\MyDir\') returns 'C:\MyDir' - GetDirectoryName('C:\MyDir') returns 'C:\' - GetDirectoryName('C:\') returns '' - */ - // - Console::WriteLine(); -} - -void GetExtension() -{ - // - String^ fileName = "C:\\mydir.old\\myfile.ext"; - String^ path = "C:\\mydir.old\\"; - String^ extension; - extension = Path::GetExtension( fileName ); - Console::WriteLine( "GetExtension('{0}') returns '{1}'", fileName, extension ); - extension = Path::GetExtension( path ); - Console::WriteLine( "GetExtension('{0}') returns '{1}'", path, extension ); - - // This code produces output similar to the following: - // - // GetExtension('C:\mydir.old\myfile.ext') returns '.ext' - // GetExtension('C:\mydir.old\') returns '' - // - Console::WriteLine(); -} - -void GetFileName() -{ - // - String^ fileName = "C:\\mydir\\myfile.ext"; - String^ path = "C:\\mydir\\"; - String^ result; - result = Path::GetFileName( fileName ); - Console::WriteLine( "GetFileName('{0}') returns '{1}'", fileName, result ); - result = Path::GetFileName( path ); - Console::WriteLine( "GetFileName('{0}') returns '{1}'", path, result ); - - // This code produces output similar to the following: - // - // GetFileName('C:\mydir\myfile.ext') returns 'myfile.ext' - // GetFileName('C:\mydir\') returns '' - // - Console::WriteLine(); -} - -void GetFileNameWithoutExtension() -{ - // - String^ fileName = "C:\\mydir\\myfile.ext"; - String^ path = "C:\\mydir\\"; - String^ result; - result = Path::GetFileNameWithoutExtension( fileName ); - Console::WriteLine( "GetFileNameWithoutExtension('{0}') returns '{1}'", fileName, result ); - result = Path::GetFileName( path ); - Console::WriteLine( "GetFileName('{0}') returns '{1}'", path, result ); - - // This code produces output similar to the following: - // - // GetFileNameWithoutExtension('C:\mydir\myfile.ext') returns 'myfile' - // GetFileName('C:\mydir\') returns '' - // - Console::WriteLine(); -} - -void GetFullPath() -{ - // - String^ fileName = "myfile.ext"; - String^ path = "\\mydir\\"; - String^ fullPath; - fullPath = Path::GetFullPath( path ); - Console::WriteLine( "GetFullPath('{0}') returns '{1}'", path, fullPath ); - fullPath = Path::GetFullPath( fileName ); - Console::WriteLine( "GetFullPath('{0}') returns '{1}'", fileName, fullPath ); - - // Output is based on your current directory, except - // in the last case, where it is based on the root drive - // GetFullPath('mydir') returns 'C:\temp\Demo\mydir' - // GetFullPath('myfile.ext') returns 'C:\temp\Demo\myfile.ext' - // GetFullPath('\mydir') returns 'C:\mydir' - // - Console::WriteLine(); -} - -void GetPathRoot() -{ - // - String^ path = "\\mydir\\"; - String^ fileName = "myfile.ext"; - String^ fullPath = "C:\\mydir\\myfile.ext"; - String^ pathRoot; - pathRoot = Path::GetPathRoot( path ); - Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", path, pathRoot ); - pathRoot = Path::GetPathRoot( fileName ); - Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", fileName, pathRoot ); - pathRoot = Path::GetPathRoot( fullPath ); - Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", fullPath, pathRoot ); - - // This code produces output similar to the following: - // - // GetPathRoot('\mydir\') returns '\' - // GetPathRoot('myfile.ext') returns '' - // GetPathRoot('C:\mydir\myfile.ext') returns 'C:\' - // - Console::WriteLine(); -} - -void GetTempFileName() -{ - // - String^ fileName = Path::GetTempFileName(); - FileInfo^ fileInfo = gcnew FileInfo( fileName ); - Console::WriteLine( "File '{0}' created of size {1} bytes", fileName, (fileInfo->Length).ToString() ); - - // Write some text to the file. - FileStream^ f = gcnew FileStream( fileName,FileMode::Open ); - StreamWriter^ s = gcnew StreamWriter( f ); - s->WriteLine( "Output to the file" ); - s->Close(); - f->Close(); - fileInfo->Refresh(); - Console::WriteLine( "File '{0}' now has size {1} bytes", fileName, (fileInfo->Length).ToString() ); - - // This code produces output similar to the following: - // - // File 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp38.tmp' created of size 0 bytes - // File 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp38.tmp' now has size 20 bytes - // - Console::WriteLine(); -} - -void GetTempPath() -{ - // - String^ tempPath = Path::GetTempPath(); - Console::WriteLine( "Temporary path is '{0}'", tempPath ); - DirectoryInfo^ tempDir = gcnew DirectoryInfo( tempPath ); - Console::WriteLine( "{0} contains {1} files", tempPath, (tempDir->GetFiles()->Length).ToString() ); - - // This code produces output similar to the following: - // - // Temporary path is 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\' - // D:\Documents and Settings\cliffc\Local Settings\Temp\8\ contains 6 files - // - Console::WriteLine(); -} - -void HasExtension() -{ - // - String^ fileName1 = "myfile.ext"; - String^ fileName2 = "mydir\\myfile"; - String^ path = "C:\\mydir.ext\\"; - bool result; - result = Path::HasExtension( fileName1 ); - Console::WriteLine( "HasExtension('{0}') returns {1}", fileName1, result.ToString() ); - result = Path::HasExtension( fileName2 ); - Console::WriteLine( "HasExtension('{0}') returns {1}", fileName2, result.ToString() ); - result = Path::HasExtension( path ); - Console::WriteLine( "HasExtension('{0}') returns {1}", path, result.ToString() ); - - // This code produces output similar to the following: - // - // HasExtension('myfile.ext') returns True - // HasExtension('mydir\myfile') returns False - // HasExtension('C:\mydir.ext\') returns False - // - Console::WriteLine(); -} - -void IsPathRooted() -{ - // - String^ fileName = "C:\\mydir\\myfile.ext"; - String^ UncPath = "\\\\myPc\\mydir\\myfile"; - String^ relativePath = "mydir\\sudir\\"; - bool result; - result = Path::IsPathRooted( fileName ); - Console::WriteLine( "IsPathRooted('{0}') returns {1}", fileName, result.ToString() ); - result = Path::IsPathRooted( UncPath ); - Console::WriteLine( "IsPathRooted('{0}') returns {1}", UncPath, result.ToString() ); - result = Path::IsPathRooted( relativePath ); - Console::WriteLine( "IsPathRooted('{0}') returns {1}", relativePath, result.ToString() ); - - // This code produces output similar to the following: - // - // IsPathRooted('C:\mydir\myfile.ext') returns True - // IsPathRooted('\\myPc\mydir\myfile') returns True - // IsPathRooted('mydir\sudir\') returns False - // - Console::WriteLine(); -} - -void StaticProperties() -{ - // - Console::WriteLine( "Path::AltDirectorySeparatorChar={0}", (Path::AltDirectorySeparatorChar).ToString() ); - Console::WriteLine( "Path::DirectorySeparatorChar={0}", (Path::DirectorySeparatorChar).ToString() ); - Console::WriteLine( "Path::PathSeparator={0}", (Path::PathSeparator).ToString() ); - Console::WriteLine( "Path::VolumeSeparatorChar={0}", (Path::VolumeSeparatorChar).ToString() ); - Console::Write( "Path::InvalidPathChars=" ); - for ( int i = 0; i < Path::InvalidPathChars->Length; i++ ) - Console::Write( Path::InvalidPathChars[ i ] ); - Console::WriteLine(); - - // This code produces output similar to the following: - // Note that the InvalidPathCharacters contain characters - // outside of the printable character set. - // - // Path.AltDirectorySeparatorChar=/ - // Path.DirectorySeparatorChar=\ - // Path.PathSeparator=; - // Path.VolumeSeparatorChar=: - // - Console::WriteLine(); -} - -int main( void ) -{ - Console::WriteLine(); - StaticProperties(); - ChangeExtension(); - Combine(); - GetDirectoryName(); - GetExtension(); - GetFileName(); - GetFileNameWithoutExtension(); - GetFullPath(); - GetPathRoot(); - GetTempFileName(); - GetTempPath(); - HasExtension(); - IsPathRooted(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp deleted file mode 100644 index 2aed9679b07..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::IO::Pipes; - -ref class PipeClient -{ -public: - static void Main(array^ args) - { - if (args->Length > 1) - { - PipeStream^ pipeClient = gcnew AnonymousPipeClientStream(PipeDirection::In, args[1]); - - Console::WriteLine("[CLIENT] Current TransmissionMode: {0}.", - pipeClient->TransmissionMode); - - StreamReader^ sr = gcnew StreamReader(pipeClient); - - // Display the read text to the console - String^ temp; - - // Wait for 'sync message' from the server. - do - { - Console::WriteLine("[CLIENT] Wait for sync..."); - temp = sr->ReadLine(); - } - while (!temp->StartsWith("SYNC")); - - // Read the server data and echo to the console. - while ((temp = sr->ReadLine()) != nullptr) - { - Console::WriteLine("[CLIENT] Echo: " + temp); - } - sr->Close(); - pipeClient->Close(); - } - Console::Write("[CLIENT] Press Enter to continue..."); - Console::ReadLine(); - } -}; - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - PipeClient::Main(args); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp deleted file mode 100644 index 26174ff6fe9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::IO::Pipes; -using namespace System::Diagnostics; - -ref class PipeServer -{ -public: - static void Main() - { - Process^ pipeClient = gcnew Process(); - - pipeClient->StartInfo->FileName = "pipeClient.exe"; - - AnonymousPipeServerStream^ pipeServer = - gcnew AnonymousPipeServerStream(PipeDirection::Out, - HandleInheritability::Inheritable); - - Console::WriteLine("[SERVER] Current TransmissionMode: {0}.", - pipeServer->TransmissionMode); - - // Pass the client process a handle to the server. - pipeClient->StartInfo->Arguments = - pipeServer->GetClientHandleAsString(); - pipeClient->StartInfo->UseShellExecute = false; - pipeClient->Start(); - - pipeServer->DisposeLocalCopyOfClientHandle(); - - try - { - // Read user input and send that to the client process. - StreamWriter^ sw = gcnew StreamWriter(pipeServer); - - sw->AutoFlush = true; - // Send a 'sync message' and wait for client to receive it. - sw->WriteLine("SYNC"); - pipeServer->WaitForPipeDrain(); - // Send the console input to the client process. - Console::Write("[SERVER] Enter text: "); - sw->WriteLine(Console::ReadLine()); - sw->Close(); - } - // Catch the IOException that is raised if the pipe is broken - // or disconnected. - catch (IOException^ e) - { - Console::WriteLine("[SERVER] Error: {0}", e->Message); - } - pipeServer->Close(); - pipeClient->WaitForExit(); - pipeClient->Close(); - Console::WriteLine("[SERVER] Client quit. Server terminating."); - } -}; - -int main() -{ - PipeServer::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp deleted file mode 100644 index 8908a781218..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp +++ /dev/null @@ -1,160 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::IO::Pipes; -using namespace System::Text; -using namespace System::Threading; - -// Defines the data protocol for reading and writing strings on our stream -public ref class StreamString -{ -private: - Stream^ ioStream; - UnicodeEncoding^ streamEncoding; - -public: - StreamString(Stream^ ioStream) - { - this->ioStream = ioStream; - streamEncoding = gcnew UnicodeEncoding(); - } - - String^ ReadString() - { - int len; - - len = ioStream->ReadByte() * 256; - len += ioStream->ReadByte(); - array^ inBuffer = gcnew array(len); - ioStream->Read(inBuffer, 0, len); - - return streamEncoding->GetString(inBuffer); - } - - int WriteString(String^ outString) - { - array^ outBuffer = streamEncoding->GetBytes(outString); - int len = outBuffer->Length; - if (len > UInt16::MaxValue) - { - len = (int)UInt16::MaxValue; - } - ioStream->WriteByte((Byte)(len / 256)); - ioStream->WriteByte((Byte)(len & 255)); - ioStream->Write(outBuffer, 0, len); - ioStream->Flush(); - - return outBuffer->Length + 2; - } -}; - -// Contains the method executed in the context of the impersonated user -public ref class ReadFileToStream -{ -private: - String^ fn; - StreamString ^ss; - -public: - ReadFileToStream(StreamString^ str, String^ filename) - { - fn = filename; - ss = str; - } - - void Start() - { - String^ contents = File::ReadAllText(fn); - ss->WriteString(contents); - } -}; - -public ref class PipeServer -{ -private: - static int numThreads = 4; - -public: - static void Main() - { - int i; - array^ servers = gcnew array(numThreads); - - Console::WriteLine("\n*** Named pipe server stream with impersonation example ***\n"); - Console::WriteLine("Waiting for client connect...\n"); - for (i = 0; i < numThreads; i++) - { - servers[i] = gcnew Thread(gcnew ThreadStart(&ServerThread)); - servers[i]->Start(); - } - Thread::Sleep(250); - while (i > 0) - { - for (int j = 0; j < numThreads; j++) - { - if (servers[j] != nullptr) - { - if (servers[j]->Join(250)) - { - Console::WriteLine("Server thread[{0}] finished.", servers[j]->ManagedThreadId); - servers[j] = nullptr; - i--; // decrement the thread watch count - } - } - } - } - Console::WriteLine("\nServer threads exhausted, exiting."); - } - -private: - static void ServerThread() - { - NamedPipeServerStream^ pipeServer = - gcnew NamedPipeServerStream("testpipe", PipeDirection::InOut, numThreads); - - int threadId = Thread::CurrentThread->ManagedThreadId; - - // Wait for a client to connect - pipeServer->WaitForConnection(); - - Console::WriteLine("Client connected on thread[{0}].", threadId); - try - { - // - // Read the request from the client. Once the client has - // written to the pipe its security token will be available. - - StreamString^ ss = gcnew StreamString(pipeServer); - - // Verify our identity to the connected client using a - // string that the client anticipates. - - ss->WriteString("I am the one true server!"); - String^ filename = ss->ReadString(); - - // Read in the contents of the file while impersonating the client. - ReadFileToStream^ fileReader = gcnew ReadFileToStream(ss, filename); - - // Display the name of the user we are impersonating. - Console::WriteLine("Reading file: {0} on thread[{1}] as user: {2}.", - filename, threadId, pipeServer->GetImpersonationUserName()); - pipeServer->RunAsClient(gcnew PipeStreamImpersonationWorker(fileReader, &ReadFileToStream::Start)); - // - } - // Catch the IOException that is raised if the pipe is broken - // or disconnected. - catch (IOException^ e) - { - Console::WriteLine("ERROR: {0}", e->Message); - } - pipeServer->Close(); - } -}; - -int main() -{ - PipeServer::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp deleted file mode 100644 index 17fffe2f8bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO::Ports; - -ref class PortDataReceived -{ -public: - static void Main() - { - // - SerialPort^ mySerialPort = gcnew SerialPort("COM1"); - - mySerialPort->BaudRate = 9600; - mySerialPort->Parity = Parity::None; - mySerialPort->StopBits = StopBits::One; - mySerialPort->DataBits = 8; - mySerialPort->Handshake = Handshake::None; - mySerialPort->RtsEnable = true; - // - - mySerialPort->DataReceived += gcnew SerialDataReceivedEventHandler(DataReceivedHandler); - - mySerialPort->Open(); - - Console::WriteLine("Press any key to continue..."); - Console::WriteLine(); - Console::ReadKey(); - mySerialPort->Close(); - } - -private: - static void DataReceivedHandler( - Object^ sender, - SerialDataReceivedEventArgs^ e) - { - SerialPort^ sp = (SerialPort^)sender; - String^ indata = sp->ReadExisting(); - Console::WriteLine("Data Received:"); - Console::Write(indata); - } -}; - -int main() -{ - PortDataReceived::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp deleted file mode 100644 index 86631d9ff20..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp +++ /dev/null @@ -1,207 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO::Ports; -using namespace System::Threading; - -public ref class PortChat -{ -private: - static bool _continue; - static SerialPort^ _serialPort; - - // -public: - static void Main() - { - String^ name; - String^ message; - StringComparer^ stringComparer = StringComparer::OrdinalIgnoreCase; - Thread^ readThread = gcnew Thread(gcnew ThreadStart(PortChat::Read)); - - // Create a new SerialPort object with default settings. - _serialPort = gcnew SerialPort(); - - // Allow the user to set the appropriate properties. - _serialPort->PortName = SetPortName(_serialPort->PortName); - _serialPort->BaudRate = SetPortBaudRate(_serialPort->BaudRate); - _serialPort->Parity = SetPortParity(_serialPort->Parity); - _serialPort->DataBits = SetPortDataBits(_serialPort->DataBits); - _serialPort->StopBits = SetPortStopBits(_serialPort->StopBits); - _serialPort->Handshake = SetPortHandshake(_serialPort->Handshake); - - // Set the read/write timeouts - _serialPort->ReadTimeout = 500; - _serialPort->WriteTimeout = 500; - - _serialPort->Open(); - _continue = true; - readThread->Start(); - - Console::Write("Name: "); - name = Console::ReadLine(); - - Console::WriteLine("Type QUIT to exit"); - - while (_continue) - { - message = Console::ReadLine(); - - if (stringComparer->Equals("quit", message)) - { - _continue = false; - } - else - { - _serialPort->WriteLine( - String::Format("<{0}>: {1}", name, message) ); - } - } - - readThread->Join(); - _serialPort->Close(); - } - - static void Read() - { - while (_continue) - { - try - { - String^ message = _serialPort->ReadLine(); - Console::WriteLine(message); - } - catch (TimeoutException ^) { } - } - } - // - - // - static String^ SetPortName(String^ defaultPortName) - { - String^ portName; - - Console::WriteLine("Available Ports:"); - for each (String^ s in SerialPort::GetPortNames()) - { - Console::WriteLine(" {0}", s); - } - - Console::Write("Enter COM port value (Default: {0}): ", defaultPortName); - portName = Console::ReadLine(); - - if (portName == "") - { - portName = defaultPortName; - } - return portName; - } - // - - static Int32 SetPortBaudRate(Int32 defaultPortBaudRate) - { - String^ baudRate; - - Console::Write("Baud Rate(default:{0}): ", defaultPortBaudRate); - baudRate = Console::ReadLine(); - - if (baudRate == "") - { - baudRate = defaultPortBaudRate.ToString(); - } - - return Int32::Parse(baudRate); - } - - // - static Parity SetPortParity(Parity defaultPortParity) - { - String^ parity; - - Console::WriteLine("Available Parity options:"); - for each (String^ s in Enum::GetNames(Parity::typeid)) - { - Console::WriteLine(" {0}", s); - } - - Console::Write("Enter Parity value (Default: {0}):", defaultPortParity.ToString()); - parity = Console::ReadLine(); - - if (parity == "") - { - parity = defaultPortParity.ToString(); - } - - return (Parity)Enum::Parse(Parity::typeid, parity); - } - // - - static Int32 SetPortDataBits(Int32 defaultPortDataBits) - { - String^ dataBits; - - Console::Write("Enter DataBits value (Default: {0}): ", defaultPortDataBits); - dataBits = Console::ReadLine(); - - if (dataBits == "") - { - dataBits = defaultPortDataBits.ToString(); - } - - return Int32::Parse(dataBits); - } - - // - static StopBits SetPortStopBits(StopBits defaultPortStopBits) - { - String^ stopBits; - - Console::WriteLine("Available Stop Bits options:"); - for each (String^ s in Enum::GetNames(StopBits::typeid)) - { - Console::WriteLine(" {0}", s); - } - - Console::Write("Enter StopBits value (None is not supported and \n" + - "raises an ArgumentOutOfRangeException. \n (Default: {0}):", defaultPortStopBits.ToString()); - stopBits = Console::ReadLine(); - - if (stopBits == "") - { - stopBits = defaultPortStopBits.ToString(); - } - - return (StopBits)Enum::Parse(StopBits::typeid, stopBits); - } - // - - // - static Handshake SetPortHandshake(Handshake defaultPortHandshake) - { - String^ handshake; - - Console::WriteLine("Available Handshake options:"); - for each (String^ s in Enum::GetNames(Handshake::typeid)) - { - Console::WriteLine(" {0}", s); - } - - Console::Write("Enter Handshake value (Default: {0}):", defaultPortHandshake.ToString()); - handshake = Console::ReadLine(); - - if (handshake == "") - { - handshake = defaultPortHandshake.ToString(); - } - - return (Handshake)Enum::Parse(Handshake::typeid, handshake); - } - // -}; - -int main() -{ - PortChat::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp deleted file mode 100644 index a1f9f662b60..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp +++ /dev/null @@ -1,177 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -ref class StreamReaderSample: public TextReader -{ -public: - - // - StreamReaderSample() - { - printInfo(); - usePeek(); - usePosition(); - useNull(); - useReadLine(); - useReadToEnd(); - } - - -private: - - //All Overloaded Constructors for StreamReader - // - void getNewStreamReader() - { - - //Get a new StreamReader in ASCII format from a - //file using a buffer and byte order mark detection - StreamReader^ srAsciiFromFileFalse512 = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII,false,512 ); - - //Get a new StreamReader in ASCII format from a - //file with byte order mark detection = false - StreamReader^ srAsciiFromFileFalse = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII,false ); - - //Get a new StreamReader in ASCII format from a file - StreamReader^ srAsciiFromFile = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII ); - - //Get a new StreamReader from a - //file with byte order mark detection = false - StreamReader^ srFromFileFalse = gcnew StreamReader( "C:\\Temp\\Test.txt",false ); - - //Get a new StreamReader from a file - StreamReader^ srFromFile = gcnew StreamReader( "C:\\Temp\\Test.txt" ); - - //Get a new StreamReader in ASCII format from a - //FileStream with byte order mark detection = false and a buffer - StreamReader^ srAsciiFromStreamFalse512 = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII,false,512 ); - - //Get a new StreamReader in ASCII format from a - //FileStream with byte order mark detection = false - StreamReader^ srAsciiFromStreamFalse = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII,false ); - - //Get a new StreamReader in ASCII format from a FileStream - StreamReader^ srAsciiFromStream = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - - //Get a new StreamReader from a - //FileStream with byte order mark detection = false - StreamReader^ srFromStreamFalse = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),false ); - - //Get a new StreamReader from a FileStream - StreamReader^ srFromStream = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ) ); - } - - - // - // - void printInfo() - { - - // - // - StreamReader^ srEncoding = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - Console::WriteLine( "Encoding: {0}", srEncoding->CurrentEncoding->EncodingName ); - srEncoding->Close(); - - // - } - - void usePeek() - { - - // - StreamReader^ srPeek = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - - // set the file pointer to the beginning - srPeek->BaseStream->Seek( 0, SeekOrigin::Begin ); - - // cycle while there is a next char - while ( srPeek->Peek() > -1 ) - { - Console::Write( srPeek->ReadLine() ); - } - - srPeek->Close(); - - // - } - - void usePosition() - { - - // - StreamReader^ srRead = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - - // set the file pointer to the beginning - srRead->BaseStream->Seek( 0, SeekOrigin::Begin ); - srRead->BaseStream->Position = 0; - while ( srRead->BaseStream->Position < srRead->BaseStream->Length ) - { - array<__wchar_t>^buffer = gcnew array<__wchar_t>(1); - srRead->Read( buffer, 0, 1 ); - Console::Write( buffer[ 0 ].ToString() ); - srRead->BaseStream->Position = srRead->BaseStream->Position + 1; - } - - srRead->DiscardBufferedData(); - srRead->Close(); - - // - } - - void useNull() - { - - // - StreamReader^ srNull = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - if ( !srNull->Equals( StreamReader::Null ) ) - { - srNull->BaseStream->Seek( 0, SeekOrigin::Begin ); - Console::WriteLine( srNull->ReadToEnd() ); - } - - srNull->Close(); - - // - } - - void useReadLine() - { - - // - StreamReader^ srReadLine = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - srReadLine->BaseStream->Seek( 0, SeekOrigin::Begin ); - while ( srReadLine->Peek() > -1 ) - { - Console::WriteLine( srReadLine->ReadLine() ); - } - - srReadLine->Close(); - - // - } - - void useReadToEnd() - { - - // - StreamReader^ srReadToEnd = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); - srReadToEnd->BaseStream->Seek( 0, SeekOrigin::Begin ); - Console::WriteLine( srReadToEnd->ReadToEnd() ); - srReadToEnd->Close(); - - // - // - } - - // - // -}; - - -// -void main( int argc ) -{ - StreamReaderSample^ srs = gcnew StreamReaderSample; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp deleted file mode 100644 index a901e502b87..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// -using namespace System; -using namespace System::IO; -using namespace System::Runtime; -using namespace System::Reflection; -using namespace System::Runtime::Remoting::Lifetime; -using namespace System::Security::Permissions; - -namespace StreamWriterSample -{ - public ref class Logger - { -// - public: - //Constructors - Logger() - { - BeginWrite(); - } - - Logger( String^ logFile ) - { - BeginWrite( logFile ); - } - - //Destructor - ~Logger() - { - EndWrite(); - } - - // - void CreateTextFile( String^ fileName, String^ textToAdd ) - { - String^ logFile = String::Concat( DateTime::Now.ToShortDateString() - ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ); - - FileStream^ fs = gcnew FileStream( fileName, - FileMode::CreateNew, FileAccess::Write, FileShare::None ); - - StreamWriter^ swFromFile = gcnew StreamWriter( logFile ); - swFromFile->Write( textToAdd ); - swFromFile->Flush(); - swFromFile->Close(); - - StreamWriter^ swFromFileStream = gcnew StreamWriter( fs ); - swFromFileStream->Write( textToAdd ); - swFromFileStream->Flush(); - swFromFileStream->Close(); - - StreamWriter^ swFromFileStreamDefaultEnc = - gcnew System::IO::StreamWriter( fs, - System::Text::Encoding::Default ); - swFromFileStreamDefaultEnc->Write( textToAdd ); - swFromFileStreamDefaultEnc->Flush(); - swFromFileStreamDefaultEnc->Close(); - - StreamWriter^ swFromFileTrue = - gcnew StreamWriter( fileName,true ); - swFromFileTrue->Write( textToAdd ); - swFromFileTrue->Flush(); - swFromFileTrue->Close(); - - StreamWriter^ swFromFileTrueUTF8Buffer = - gcnew StreamWriter( fileName, - true, System::Text::Encoding::UTF8, 512 ); - swFromFileTrueUTF8Buffer->Write( textToAdd ); - swFromFileTrueUTF8Buffer->Flush(); - swFromFileTrueUTF8Buffer->Close(); - - StreamWriter^ swFromFileTrueUTF8 = - gcnew StreamWriter( fileName, true, - System::Text::Encoding::UTF8 ); - swFromFileTrueUTF8->Write( textToAdd ); - swFromFileTrueUTF8->Flush(); - swFromFileTrueUTF8->Close(); - - StreamWriter^ swFromFileStreamUTF8Buffer = - gcnew StreamWriter( fs, System::Text::Encoding::UTF8, 512 ); - swFromFileStreamUTF8Buffer->Write( textToAdd ); - swFromFileStreamUTF8Buffer->Flush(); - swFromFileStreamUTF8Buffer->Close(); - } - // - - // - private: - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - void BeginWrite( String^ logFile ) - { - // - // - StreamWriter^ sw = gcnew StreamWriter( logFile,true ); - - // - // - // Gets or sets a value indicating whether the StreamWriter - // will flush its buffer to the underlying stream after every - // call to StreamWriter.Write. - sw->AutoFlush = true; - // - // - if ( sw->Equals( StreamWriter::Null ) ) - { - sw->WriteLine( "The store can be written to, but not read from." ); - } - // - // - sw->Write( Char::Parse( " " ) ); - // - // - String^ hello = "Hellow World!"; - array^ buffer = hello->ToCharArray(); - sw->Write( buffer ); - // - // - String^ helloWorld = "Hellow World!"; - // writes out "low World" - sw->Write( helloWorld ); - // - // - sw->WriteLine( "---Begin Log Entry---" ); - // - // - // Write out the current text encoding - sw->WriteLine( "Encoding: {0}", - sw->Encoding->ToString() ); - // - // - // Display the Format Provider - sw->WriteLine( "Format Provider: {0} ", - sw->FormatProvider->ToString() ); - // - // - // Set the characters you would like to designate a new line - sw->NewLine = "\r\n"; - // - // - ILease^ obj = dynamic_cast(sw->InitializeLifetimeService()); - if ( obj != nullptr ) - { - sw->WriteLine( "Object initialized lease " + - "time remaining: {0}.", - obj->CurrentLeaseTime.ToString() ); - } - // - // - ILease^ lease = dynamic_cast(sw->GetLifetimeService()); - if ( lease != nullptr ) - { - sw->WriteLine( "Object lease time remaining: {0}.", - lease->CurrentLeaseTime.ToString() ); - } - // - - // - // update underlying file - sw->Flush(); - // - // - // close the file by closing the writer - sw->Close(); - // - // - } - // - - void BeginWrite() - { - BeginWrite( String::Concat( DateTime::Now.ToShortDateString() - ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ) ); - } - - void EndWrite( String^ logFile ) - { - StreamWriter^ sw = gcnew StreamWriter( logFile,true ); - - // Set the file pointer to the end of file. - sw->BaseStream->Seek( 0, SeekOrigin::End ); - // Write text to the file. - sw->WriteLine( "---End Log Entry---\r\n" ); - // Update the underlying file. - sw->Flush(); - // Close the file by closing the writer. - sw->Close(); - } - - void EndWrite() - { - EndWrite( String::Concat( DateTime::Now.ToShortDateString() - ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ) ); - } - // - }; -} -// - -int main() -{ - StreamWriterSample::Logger^ l = gcnew StreamWriterSample::Logger; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp deleted file mode 100644 index 0e1c9ac1f5b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - String^ textReaderText = "TextReader is the abstract base " - "class of StreamReader and StringReader, which read " - "characters from streams and strings, respectively.\n\n" - "Create an instance of TextReader to open a text file " - "for reading a specified range of characters, or to " - "create a reader based on an existing stream.\n\n" - "You can also use an instance of TextReader to read " - "text from a custom backing store using the same " - "APIs you would use for a string or a stream.\n\n"; - Console::WriteLine( "Original text:\n\n{0}", textReaderText ); - - // - // From textReaderText, create a continuous paragraph - // with two spaces between each sentence. - String^ aLine; - String^ aParagraph; - StringReader^ strReader = gcnew StringReader( textReaderText ); - while ( true ) - { - aLine = strReader->ReadLine(); - if ( aLine != nullptr ) - { - aParagraph = String::Concat( aParagraph, aLine, " " ); - } - else - { - aParagraph = String::Concat( aParagraph, "\n" ); - break; - } - } - - Console::WriteLine( "Modified text:\n\n{0}", aParagraph ); - - // - // Re-create textReaderText from aParagraph. - int intCharacter; - Char convertedCharacter; - StringWriter^ strWriter = gcnew StringWriter; - strReader = gcnew StringReader( aParagraph ); - while ( true ) - { - intCharacter = strReader->Read(); - - // Check for the end of the string - // before converting to a character. - if ( intCharacter == -1 ) - break; - - - // - convertedCharacter = Convert::ToChar( intCharacter ); - if ( convertedCharacter == '.' ) - { - strWriter->Write( ".\n\n" ); - - // Bypass the spaces between sentences. - strReader->Read(); - strReader->Read(); - } - // - else - { - strWriter->Write( convertedCharacter ); - } - } - - Console::WriteLine( "\nOriginal text:\n\n{0}", strWriter->ToString() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp deleted file mode 100644 index 8c1ec78fa24..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -int main() -{ - StringWriter^ strWriter = gcnew StringWriter; - - // - // Use the three overloads of the Write method that are - // overridden by the StringWriter class. - strWriter->Write( "file path characters are: " ); - strWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length ); - strWriter->Write( Char::Parse( "." ) ); - - // - // - // Use the underlying StringBuilder for more complex - // manipulations of the string. - strWriter->GetStringBuilder()->Insert( 0, "Invalid " ); - - // - // - Console::WriteLine( "The following string is {0} encoded.\n{1}", strWriter->Encoding->EncodingName, strWriter->ToString() ); - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp deleted file mode 100644 index 3314eaac96a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -using namespace System; -using namespace System::Globalization; -using namespace System::IO; -int main() -{ - StringWriter^ strWriter = gcnew StringWriter( gcnew CultureInfo( "ar-DZ" ) ); - strWriter->Write( DateTime::Now ); - - // - Console::WriteLine( "Current date and time using the invariant culture: {0}\n" - "Current date and time using the Algerian culture: {1}", DateTime::Now.ToString(), strWriter->ToString() ); - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp deleted file mode 100644 index 10ced5c03d7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Text; -int main() -{ - StringBuilder^ strBuilder = gcnew StringBuilder( "file path characters are: " ); - StringWriter^ strWriter = gcnew StringWriter( strBuilder ); - strWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length ); - - // - strWriter->Close(); - - // Since the StringWriter is closed, an exception will - // be thrown if the Write method is called. However, - // the StringBuilder can still manipulate the string. - strBuilder->Insert( 0, "Invalid " ); - Console::WriteLine( strWriter->ToString() ); - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp deleted file mode 100644 index e9352f717a0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::IO; - -// -void WriteText( TextWriter^ textWriter ) -{ - textWriter->Write( "Invalid file path characters are: " ); - textWriter->Write( Path::InvalidPathChars ); - textWriter->Write( Char::Parse( "." ) ); -} - - -// -// -void ReadText( TextReader^ textReader ) -{ - Console::WriteLine( "From {0} - {1}", textReader->GetType()->Name, textReader->ReadToEnd() ); -} - - -// -int main() -{ - - // - TextWriter^ stringWriter = gcnew StringWriter; - TextWriter^ streamWriter = gcnew StreamWriter( "InvalidPathChars.txt" ); - - // - WriteText( stringWriter ); - WriteText( streamWriter ); - streamWriter->Close(); - - // - TextReader^ stringReader = gcnew StringReader( stringWriter->ToString() ); - TextReader^ streamReader = gcnew StreamReader( "InvalidPathChars.txt" ); - - // - ReadText( stringReader ); - ReadText( streamReader ); - streamReader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp deleted file mode 100644 index bcc6eb8fc3a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -// This sample shows the differences between dates from methods that use -//coordinated universal time (UTC) format and those that do not. -using namespace System; -using namespace System::IO; -int main() -{ - - // Set the directory. - String^ n = "C:\\test\\newdir"; - - //Create two variables to use to set the time. - DateTime dtime1 = DateTime(2002,1,3); - DateTime dtime2 = DateTime(1999,1,1); - - //Create the directory. - try - { - Directory::CreateDirectory( n ); - } - catch ( IOException^ e ) - { - Console::WriteLine( e ); - } - - - //Set the creation and last access times to a variable DateTime value. - Directory::SetCreationTime( n, dtime1 ); - Directory::SetLastAccessTimeUtc( n, dtime1 ); - - // Print to console the results. - Console::WriteLine( "Creation Date: {0}", Directory::GetCreationTime( n ) ); - Console::WriteLine( "UTC creation Date: {0}", Directory::GetCreationTimeUtc( n ) ); - Console::WriteLine( "Last write time: {0}", Directory::GetLastWriteTime( n ) ); - Console::WriteLine( "UTC last write time: {0}", Directory::GetLastWriteTimeUtc( n ) ); - Console::WriteLine( "Last access time: {0}", Directory::GetLastAccessTime( n ) ); - Console::WriteLine( "UTC last access time: {0}", Directory::GetLastAccessTimeUtc( n ) ); - - //Set the last write time to a different value. - Directory::SetLastWriteTimeUtc( n, dtime2 ); - Console::WriteLine( "Changed last write time: {0}", Directory::GetLastWriteTimeUtc( n ) ); -} - -// Obviously, since this sample deals with dates and times, the output will vary -// depending on when you run the executable. Here is one example of the output: -//Creation Date: 1/3/2002 12:00:00 AM -//UTC creation Date: 1/3/2002 8:00:00 AM -//Last write time: 12/31/1998 4:00:00 PM -//UTC last write time: 1/1/1999 12:00:00 AM -//Last access time: 1/2/2002 4:00:00 PM -//UTC last access time: 1/3/2002 12:00:00 AM -//Changed last write time: 1/1/1999 12:00:00 AM -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp deleted file mode 100644 index ced314ab27c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// MinValue.cpp : main project file. - -using namespace System; - -int main(array ^args) -{ - // - array^ numbersToConvert = {162345, 32183, -54000}; - Int16 newNumber; - for each (Int64 number in numbersToConvert) - { - if (number >= Int16::MinValue && number <= Int16::MaxValue) - { - newNumber = Convert::ToInt16(number); - Console::WriteLine("Successfully converted {0} to an Int16.", - newNumber); - } - else - { - Console::WriteLine("Unable to convert {0} to an Int16.", number); - } - } - // The example displays the following output: - // Unable to convert 162345 to an Int16. - // Successfully converted 32183 to an Int16. - // Unable to convert -54000 to an Int16. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp deleted file mode 100644 index aeaef4e7bea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Parse1.cpp : main project file. -// Code example for Int16.Parse(String) - -using namespace System; - -int main(array ^args) -{ - // - String^ value; - Int16 number; - - value = " 12603 "; - try - { - number = Int16::Parse(value); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", - value); - } - - value = " 16,054"; - try - { - number = Int16::Parse(value); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", - value); - } - - value = " -17264"; - try - { - number = Int16::Parse(value); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", - value); - } - // The example displays the following output to the console: - // Converted ' 12603 ' to 12603. - // Unable to convert ' 16,054' to a 16-bit signed integer. - // Converted ' -17264' to -17264. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp deleted file mode 100644 index 0b5222a1f6f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// Parse2.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -ref class ParseSample -{ -public: - static void Main() - { - String^ value; - NumberStyles style; - - // Parse a number with a thousands separator (throws an exception). - value = "14,644"; - style = NumberStyles::None; - ParseSample::ParseToInt16(value, style); - - style = NumberStyles::AllowThousands; - ParseToInt16(value, style); - - // Parse a number with a thousands separator and decimal point. - value = "14,644.00"; - style = NumberStyles::AllowThousands | NumberStyles::Integer | - NumberStyles::AllowDecimalPoint; - ParseToInt16(value, style); - - // Parse a number with a fractional component (throws an exception). - value = "14,644.001"; - ParseToInt16(value, style); - - // Parse a number in exponential notation. - value = "145E02"; - style = style | NumberStyles::AllowExponent; - ParseToInt16(value, style); - - // Parse a number in exponential notation with a positive sign. - value = "145E+02"; - ParseToInt16(value, style); - - // Parse a number in exponential notation with a negative sign - // (throws an exception). - value = "145E-02"; - ParseToInt16(value, style); - } - -private: - static void ParseToInt16(String^ value, NumberStyles style) - { - try - { - Int16 number = Int16::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}' with style {1}.", value, - style); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0}' is out of range of the Int16 type.", value); - } - } -}; - -int main() -{ - ParseSample::Main(); - Console::ReadLine(); - return 0; -} -// The example displays the following output: -// Unable to parse '14,644' with style None. -// Converted '14,644' to 14644. -// Converted '14,644.00' to 14644. -// '14,644.001' is out of range of the Int16 type. -// Converted '145E02' to 14500. -// Converted '145E+02' to 14500. -// '145E-02' is out of range of the Int16 type. -// - - - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp deleted file mode 100644 index e17d9457ac6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Parse3.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -int main(array ^args) -{ - // - String^ value; - Int16 number; - NumberStyles style; - - // Parse string using "." as the thousands separator - // and " " as the decimal separator. - value = "19 694,00"; - style = NumberStyles::AllowDecimalPoint | NumberStyles::AllowThousands; - CultureInfo^ provider = gcnew CultureInfo("fr-FR"); - - number = Int16::Parse(value, style, provider); - Console::WriteLine("'{0}' converted to {1}.", value, number); - // Displays: - // '19 694,00' converted to 19694. - - try - { - number = Int16::Parse(value, style, CultureInfo::InvariantCulture); - Console::WriteLine("'{0}' converted to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", value); - } - // Displays: - // Unable to parse '19 694,00'. - - // Parse string using "$" as the currency symbol for en_GB and - // en-US cultures. - value = "$6,032.00"; - style = NumberStyles::Number | NumberStyles::AllowCurrencySymbol; - provider = gcnew CultureInfo("en-GB"); - - try - { - number = Int16::Parse(value, style, CultureInfo::InvariantCulture); - Console::WriteLine("'{0}' converted to {1}.", value, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", value); - } - // Displays: - // Unable to parse '$6,032.00'. - - provider = gcnew CultureInfo("en-US"); - number = Int16::Parse(value, style, provider); - Console::WriteLine("'{0}' converted to {1}.", value, number); - // Displays: - // '$6,032.00' converted to 6032. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp deleted file mode 100644 index 111fb90e90d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// Parse4.cpp : main project file. - -using namespace System; -using namespace System::Globalization; - -int main(array ^args) -{ - // - String^ stringToConvert; - Int16 number; - - stringToConvert = " 214 "; - try - { - number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0'} is out of range of the Int16 data type.", - stringToConvert); - } - - stringToConvert = " + 214"; - try - { - number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0'} is out of range of the Int16 data type.", - stringToConvert); - } - - stringToConvert = " +214 "; - try - { - number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - } - catch (FormatException ^e) - { - Console::WriteLine("Unable to parse '{0}'.", stringToConvert); - } - catch (OverflowException ^e) - { - Console::WriteLine("'{0'} is out of range of the Int16 data type.", - stringToConvert); - } - // The example displays the following output to the console: - // Converted ' 214 ' to 214. - // Unable to parse ' + 214'. - // Converted ' +214 ' to 214. - // - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp deleted file mode 100644 index 3eb4dcbf5d3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ values = { "+13230", "-0", "1,390,146", "$190,235,421,127", - "0xFA1B", "163042", "-10", "007", "2147483647", - "2147483648", "16e07", "134985.0", "-12034", - "-2147483648", "-2147483649" }; - for each (String^ value in values) - { - try { - Int32 number = Int32::Parse(value); - Console::WriteLine("{0} --> {1}", value, number); - } - catch (FormatException^ e) { - Console::WriteLine("{0}: Bad Format", value); - } - catch (OverflowException^ e) { - Console::WriteLine("{0}: Overflow", value); - } - } -} -// The example displays the following output: -// +13230 --> 13230 -// -0 --> 0 -// 1,390,146: Bad Format -// $190,235,421,127: Bad Format -// 0xFA1B: Bad Format -// 163042 --> 163042 -// -10 --> -10 -// 007 --> 7 -// 2147483647 --> 2147483647 -// 2147483648: Overflow -// 16e07: Bad Format -// 134985.0: Bad Format -// -12034 --> -12034 -// -2147483648 --> -2147483648 -// -2147483649: Overflow -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp deleted file mode 100644 index 763b56c34a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -public ref class ParseInt32 -{ -public: - static void Main() - { - Convert("104.0", NumberStyles::AllowDecimalPoint); - Convert("104.9", NumberStyles::AllowDecimalPoint); - Convert(" $17,198,064.42", NumberStyles::AllowCurrencySymbol | - NumberStyles::Number); - Convert("103E06", NumberStyles::AllowExponent); - Convert("-1,345,791", NumberStyles::AllowThousands); - Convert("(1,345,791)", NumberStyles::AllowThousands | - NumberStyles::AllowParentheses); - } - -private: - static void Convert(String^ value, NumberStyles style) - { - try - { - int number = Int32::Parse(value, style); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) - { - Console::WriteLine("Unable to convert '{0}'.", value); - } - catch (OverflowException^) - { - Console::WriteLine("'{0}' is out of range of the Int32 type.", value); - } - } -}; - -int main() -{ - ParseInt32::Main(); -} -// The example displays the following output to the console: -// Converted '104.0' to 104. -// '104.9' is out of range of the Int32 type. -// ' $17,198,064.42' is out of range of the Int32 type. -// Converted '103E06' to 103000000. -// Unable to convert '-1,345,791'. -// Converted '(1,345,791)' to -1345791. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp deleted file mode 100644 index 6d7ea5b521f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -public ref class ParseInt32 -{ -public: - static void Main() - { - Convert("12,000", NumberStyles::Float | NumberStyles::AllowThousands, - gcnew CultureInfo("en-GB")); - Convert("12,000", NumberStyles::Float | NumberStyles::AllowThousands, - gcnew CultureInfo("fr-FR")); - Convert("12,000", NumberStyles::Float, gcnew CultureInfo("en-US")); - - Convert("12 425,00", NumberStyles::Float | NumberStyles::AllowThousands, - gcnew CultureInfo("sv-SE")); - Convert("12,425.00", NumberStyles::Float | NumberStyles::AllowThousands, - NumberFormatInfo::InvariantInfo); - Convert("631,900", NumberStyles::Integer | NumberStyles::AllowDecimalPoint, - gcnew CultureInfo("fr-FR")); - Convert("631,900", NumberStyles::Integer | NumberStyles::AllowDecimalPoint, - gcnew CultureInfo("en-US")); - Convert("631,900", NumberStyles::Integer | NumberStyles::AllowThousands, - gcnew CultureInfo("en-US")); - } - -private: - static void Convert(String^ value, NumberStyles style, - IFormatProvider^ provider) - { - try - { - int number = Int32::Parse(value, style, provider); - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - catch (FormatException^) - { - Console::WriteLine("Unable to convert '{0}'.", value); - } - catch (OverflowException^) - { - Console::WriteLine("'{0}' is out of range of the Int32 type.", value); - } - } -}; - -int main() -{ - ParseInt32::Main(); -} -// This example displays the following output to the console: -// Converted '12,000' to 12000. -// Converted '12,000' to 12. -// Unable to convert '12,000'. -// Converted '12 425,00' to 12425. -// Converted '12,425.00' to 12425. -// '631,900' is out of range of the Int32 type. -// Unable to convert '631,900'. -// Converted '631,900' to 631900. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp deleted file mode 100644 index 490a4147b45..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -using namespace System; - -void main() -{ - int value = -16325; - // Display value using default ToString method. - Console::WriteLine(value.ToString()); - // Display value using some standard format specifiers. - Console::WriteLine(value.ToString("G")); - Console::WriteLine(value.ToString("C")); - Console::WriteLine(value.ToString("D")); - Console::WriteLine(value.ToString("F")); - Console::WriteLine(value.ToString("N")); - Console::WriteLine(value.ToString("X")); -} -// The example displays the following output: -// -16325 -// -16325 -// ($16,325.00) -// -16325 -// -16325.00 -// -16,325.00 -// FFFFC03B -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp deleted file mode 100644 index 9db3bc117d2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - int value = -16325; - // Display value using the invariant culture. - Console::WriteLine(value.ToString(CultureInfo::InvariantCulture)); - // Display value using the en-GB culture. - Console::WriteLine(value.ToString(CultureInfo::CreateSpecificCulture("en-GB"))); - // Display value using the de-DE culture. - Console::WriteLine(value.ToString(CultureInfo::CreateSpecificCulture("de-DE"))); -} -// The example displays the following output: -// -16325 -// -16325 -// -16325 -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp deleted file mode 100644 index 890b1ae948c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -using namespace System; - -void main() -{ - int value = -16325; - String^ specifier; - - // Use standard numeric format specifiers. - specifier = "G"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "C"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "D8"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "E4"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "e3"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "F"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "N"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "P"; - Console::WriteLine("{0}: {1}", specifier, (value/100000).ToString(specifier)); - - specifier = "X"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - // Use custom numeric format specifiers. - specifier = "0,0.000"; - Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); - - specifier = "#,#.00#;(#,#.00#)"; - Console::WriteLine("{0}: {1}", specifier, (value*-1).ToString(specifier)); -} -// The example displays the following output: -// G: -16325 -// C: ($16,325.00) -// D8: -00016325 -// E4: -1.6325E+004 -// e3: -1.633e+004 -// F: -16325.00 -// N: -16,325.00 -// P: 0.00 % -// X: FFFFC03B -// 0,0.000: -16,325.000 -// #,#.00#;(#,#.00#): 16,325.00 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp deleted file mode 100644 index 60f27268433..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - // Define cultures whose formatting conventions are to be used. - array^ cultures = { CultureInfo::CreateSpecificCulture("en-US"), - CultureInfo::CreateSpecificCulture("fr-FR"), - CultureInfo::CreateSpecificCulture("es-ES") }; - int positiveNumber = 1679; - int negativeNumber = -3045; - array^ specifiers = {"G", "C", "D8", "E2", "F", "N", "P", "X8"}; - - for each (String^ specifier in specifiers) - { - for each (CultureInfo^ culture in cultures) - { - // Display values with "G" format specifier. - Console::WriteLine("{0} format using {1} culture: {2, 16} {3, 16}", - specifier, culture->Name, - positiveNumber.ToString(specifier, culture), - negativeNumber.ToString(specifier, culture)); - } - Console::WriteLine(); - } -} -// The example displays the following output: -// G format using en-US culture: 1679 -3045 -// G format using fr-FR culture: 1679 -3045 -// G format using es-ES culture: 1679 -3045 -// -// C format using en-US culture: $1,679.00 ($3,045.00) -// C format using fr-FR culture: 1 679,00 € -3 045,00 € -// C format using es-ES culture: 1.679,00 € -3.045,00 € -// -// D8 format using en-US culture: 00001679 -00003045 -// D8 format using fr-FR culture: 00001679 -00003045 -// D8 format using es-ES culture: 00001679 -00003045 -// -// E2 format using en-US culture: 1.68E+003 -3.05E+003 -// E2 format using fr-FR culture: 1,68E+003 -3,05E+003 -// E2 format using es-ES culture: 1,68E+003 -3,05E+003 -// -// F format using en-US culture: 1679.00 -3045.00 -// F format using fr-FR culture: 1679,00 -3045,00 -// F format using es-ES culture: 1679,00 -3045,00 -// -// N format using en-US culture: 1,679.00 -3,045.00 -// N format using fr-FR culture: 1 679,00 -3 045,00 -// N format using es-ES culture: 1.679,00 -3.045,00 -// -// P format using en-US culture: 167,900.00 % -304,500.00 % -// P format using fr-FR culture: 167 900,00 % -304 500,00 % -// P format using es-ES culture: 167.900,00 % -304.500,00 % -// -// X8 format using en-US culture: 0000068F FFFFF41B -// X8 format using fr-FR culture: 0000068F FFFFF41B -// X8 format using es-ES culture: 0000068F FFFFF41B -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp deleted file mode 100644 index 8772bdc80e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// ConsoleApplication1.cpp : Defines the entry point for the console application. -// - - -// -using namespace System; - - - void TryToParse(String^ value) - { - Int32 number; - bool result = Int32::TryParse(value, number); - if (result) { - Console::WriteLine("Converted '{0}' to {1}.", value, number); - } - else { - if (value == nullptr) value = ""; - Console::WriteLine("Attempted conversion of '{0}' failed.", value); - } - } - - -void main() -{ - TryToParse(nullptr); - TryToParse("160519"); - TryToParse("9432.0"); - TryToParse("16,667"); - TryToParse(" -322 "); - TryToParse("+4302"); - TryToParse("(100);"); - TryToParse("01FA"); -} -// The example displays the following output: -// Attempted conversion of '' failed. -// Converted '160519' to 160519. -// Attempted conversion of '9432.0' failed. -// Attempted conversion of '16,667' failed. -// Converted ' -322 ' to -322. -// Converted '+4302' to 4302. -// Attempted conversion of '(100);' failed. -// Attempted conversion of '01FA' failed. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp deleted file mode 100644 index 0639d8b9dc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// Int32.TryParse2.cpp : Defines the entry point for the console application. -// - - -// -using namespace System; -using namespace System::Globalization; - -void CallTryParse(String^ stringToConvert, NumberStyles styles) -{ - Int32 number; - CultureInfo^ provider; - - // If currency symbol is allowed, use en-US culture. - if (((Int32) (styles & NumberStyles::AllowCurrencySymbol)) > 0) - provider = gcnew CultureInfo("en-US"); - else - provider = CultureInfo::InvariantCulture; - - bool result = Int32::TryParse(stringToConvert, styles, - provider, number); - if (result) - Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); - else - Console::WriteLine("Attempted conversion of '{0}' failed.", - Convert::ToString(stringToConvert)); -} - -void main() -{ - String^ numericString; - NumberStyles styles; - - numericString = "106779"; - styles = NumberStyles::Integer; - CallTryParse(numericString, styles); - - numericString = "-30677"; - styles = NumberStyles::None; - CallTryParse(numericString, styles); - - styles = NumberStyles::AllowLeadingSign; - CallTryParse(numericString, styles); - - numericString = "301677-"; - CallTryParse(numericString, styles); - - styles = styles | NumberStyles::AllowTrailingSign; - CallTryParse(numericString, styles); - - numericString = "$10634"; - styles = NumberStyles::Integer; - CallTryParse(numericString, styles); - - styles = NumberStyles::Integer | NumberStyles::AllowCurrencySymbol; - CallTryParse(numericString, styles); - - numericString = "10345.00"; - styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; - CallTryParse(numericString, styles); - - numericString = "10345.72"; - styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; - CallTryParse(numericString, styles); - - numericString = "22,593"; - styles = NumberStyles::Integer | NumberStyles::AllowThousands; - CallTryParse(numericString, styles); - - numericString = "12E-01"; - styles = NumberStyles::Integer | NumberStyles::AllowExponent; - CallTryParse(numericString, styles); - - numericString = "12E03"; - CallTryParse(numericString, styles); - - numericString = "80c1"; - CallTryParse(numericString, NumberStyles::HexNumber); - - numericString = "0x80C1"; - CallTryParse(numericString, NumberStyles::HexNumber); - Console::ReadLine(); -} -// The example displays the following output: -// Converted '106779' to 106779. -// Attempted conversion of '-30677' failed. -// Converted '-30677' to -30677. -// Attempted conversion of '301677-' failed. -// Converted '301677-' to -301677. -// Attempted conversion of '$10634' failed. -// Converted '$10634' to 10634. -// Converted '10345.00' to 10345. -// Attempted conversion of '10345.72' failed. -// Converted '22,593' to 22593. -// Attempted conversion of '12E-01' failed. -// Converted '12E03' to 12000. -// Converted '80c1' to 32961. -// Attempted conversion of '0x80C1' failed. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp deleted file mode 100644 index 8a1d8bb47db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example for the Math::E field. -using namespace System; - -// Approximate E with a power series. -void CalcPowerSeries() -{ - double factorial = 1.0; - double PS = 0.0; - - // Stop iterating when the series converges, - // and prevent a runaway process. - for ( int n = 0; n < 999 && Math::Abs( Math::E - PS ) > 1.0E-15; n++ ) - { - - // Calculate a running factorial. - if ( n > 0 ) - factorial *= (double)n; - - // Calculate and display the power series. - PS += 1.0 / factorial; - Console::WriteLine( "PS({0:D2}) == {1:E16}, Math::E - PS({0:D2}) == {2:E16}", n, PS, Math::E - PS ); - - } -} - -int main() -{ - Console::WriteLine( "This example of Math::E == {0:E16}\n" - "generates the following output.\n", Math::E ); - Console::WriteLine( "Define the power series PS(n) = Sum(k->0,n)[1/k!]" ); - Console::WriteLine( " (limit n->infinity)PS(n) == e" ); - Console::WriteLine( "Display PS(n) and Math::E - PS(n), " - "and stop when delta < 1.0E-15\n" ); - CalcPowerSeries(); -} - -/* -This example of Math::E == 2.7182818284590451E+000 -generates the following output. - -Define the power series PS(n) = Sum(k->0,n)[1/k!] - (limit n->infinity)PS(n) == e -Display PS(n) and Math::E - PS(n), and stop when delta < 1.0E-15 - -PS(00) == 1.0000000000000000E+000, Math::E - PS(00) == 1.7182818284590451E+000 -PS(01) == 2.0000000000000000E+000, Math::E - PS(01) == 7.1828182845904509E-001 -PS(02) == 2.5000000000000000E+000, Math::E - PS(02) == 2.1828182845904509E-001 -PS(03) == 2.6666666666666665E+000, Math::E - PS(03) == 5.1615161792378572E-002 -PS(04) == 2.7083333333333330E+000, Math::E - PS(04) == 9.9484951257120535E-003 -PS(05) == 2.7166666666666663E+000, Math::E - PS(05) == 1.6151617923787498E-003 -PS(06) == 2.7180555555555554E+000, Math::E - PS(06) == 2.2627290348964380E-004 -PS(07) == 2.7182539682539684E+000, Math::E - PS(07) == 2.7860205076724043E-005 -PS(08) == 2.7182787698412700E+000, Math::E - PS(08) == 3.0586177750535626E-006 -PS(09) == 2.7182815255731922E+000, Math::E - PS(09) == 3.0288585284310443E-007 -PS(10) == 2.7182818011463845E+000, Math::E - PS(10) == 2.7312660577649694E-008 -PS(11) == 2.7182818261984929E+000, Math::E - PS(11) == 2.2605521898810821E-009 -PS(12) == 2.7182818282861687E+000, Math::E - PS(12) == 1.7287637987806193E-010 -PS(13) == 2.7182818284467594E+000, Math::E - PS(13) == 1.2285727990501982E-011 -PS(14) == 2.7182818284582302E+000, Math::E - PS(14) == 8.1490370007486490E-013 -PS(15) == 2.7182818284589949E+000, Math::E - PS(15) == 5.0182080713057076E-014 -PS(16) == 2.7182818284590429E+000, Math::E - PS(16) == 2.2204460492503131E-015 -PS(17) == 2.7182818284590455E+000, Math::E - PS(17) == -4.4408920985006262E-016 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp deleted file mode 100644 index a74b9251364..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// -// Example for the Math::Exp( double ) method. -using namespace System; - -// Evaluate logarithmic/exponential identity with a given argument. -void UseLnExp( double arg ) -{ - - // Evaluate e ^ ln(X) == ln(e ^ X) == X. - Console::WriteLine( "\n Math::Exp(Math::Log({0})) == {1:E16}\n" - " Math::Log(Math::Exp({0})) == {2:E16}", arg, Math::Exp( Math::Log( arg ) ), Math::Log( Math::Exp( arg ) ) ); -} - - -// Evaluate exponential identities that are functions of two arguments. -void UseTwoArgs( double argX, double argY ) -{ - - // Evaluate (e ^ X) * (e ^ Y) == e ^ (X + Y). - Console::WriteLine( "\nMath::Exp({0}) * Math::Exp({1}) == {2:E16}" - "\n Math::Exp({0} + {1}) == {3:E16}", argX, argY, Math::Exp( argX ) * Math::Exp( argY ), Math::Exp( argX + argY ) ); - - // Evaluate (e ^ X) ^ Y == e ^ (X * Y). - Console::WriteLine( " Math::Pow(Math::Exp({0}), {1}) == {2:E16}" - "\n Math::Exp({0} * {1}) == {3:E16}", argX, argY, Math::Pow( Math::Exp( argX ), argY ), Math::Exp( argX * argY ) ); - - // Evaluate X ^ Y == e ^ (Y * ln(X)). - Console::WriteLine( " Math::Pow({0}, {1}) == {2:E16}" - "\nMath::Exp({1} * Math::Log({0})) == {3:E16}", argX, argY, Math::Pow( argX, argY ), Math::Exp( argY * Math::Log( argX ) ) ); -} - -int main() -{ - Console::WriteLine( "This example of Math::Exp( double ) " - "generates the following output.\n" ); - Console::WriteLine( "Evaluate [e ^ ln(X) == ln(e ^ X) == X] " - "with selected values for X:" ); - UseLnExp( 0.1 ); - UseLnExp( 1.2 ); - UseLnExp( 4.9 ); - UseLnExp( 9.9 ); - Console::WriteLine( "\nEvaluate these identities with " - "selected values for X and Y:" ); - Console::WriteLine( " (e ^ X) * (e ^ Y) == e ^ (X + Y)" ); - Console::WriteLine( " (e ^ X) ^ Y == e ^ (X * Y)" ); - Console::WriteLine( " X ^ Y == e ^ (Y * ln(X))" ); - UseTwoArgs( 0.1, 1.2 ); - UseTwoArgs( 1.2, 4.9 ); - UseTwoArgs( 4.9, 9.9 ); -} - -/* -This example of Math::Exp( double ) generates the following output. - -Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X: - - Math::Exp(Math::Log(0.1)) == 1.0000000000000001E-001 - Math::Log(Math::Exp(0.1)) == 1.0000000000000008E-001 - - Math::Exp(Math::Log(1.2)) == 1.2000000000000000E+000 - Math::Log(Math::Exp(1.2)) == 1.2000000000000000E+000 - - Math::Exp(Math::Log(4.9)) == 4.9000000000000012E+000 - Math::Log(Math::Exp(4.9)) == 4.9000000000000004E+000 - - Math::Exp(Math::Log(9.9)) == 9.9000000000000004E+000 - Math::Log(Math::Exp(9.9)) == 9.9000000000000004E+000 - -Evaluate these identities with selected values for X and Y: - (e ^ X) * (e ^ Y) == e ^ (X + Y) - (e ^ X) ^ Y == e ^ (X * Y) - X ^ Y == e ^ (Y * ln(X)) - -Math::Exp(0.1) * Math::Exp(1.2) == 3.6692966676192444E+000 - Math::Exp(0.1 + 1.2) == 3.6692966676192444E+000 - Math::Pow(Math::Exp(0.1), 1.2) == 1.1274968515793757E+000 - Math::Exp(0.1 * 1.2) == 1.1274968515793757E+000 - Math::Pow(0.1, 1.2) == 6.3095734448019331E-002 -Math::Exp(1.2 * Math::Log(0.1)) == 6.3095734448019344E-002 - -Math::Exp(1.2) * Math::Exp(4.9) == 4.4585777008251705E+002 - Math::Exp(1.2 + 4.9) == 4.4585777008251716E+002 - Math::Pow(Math::Exp(1.2), 4.9) == 3.5780924170885260E+002 - Math::Exp(1.2 * 4.9) == 3.5780924170885277E+002 - Math::Pow(1.2, 4.9) == 2.4433636334442981E+000 -Math::Exp(4.9 * Math::Log(1.2)) == 2.4433636334442981E+000 - -Math::Exp(4.9) * Math::Exp(9.9) == 2.6764450551890982E+006 - Math::Exp(4.9 + 9.9) == 2.6764450551891015E+006 - Math::Pow(Math::Exp(4.9), 9.9) == 1.1684908531676833E+021 - Math::Exp(4.9 * 9.9) == 1.1684908531676829E+021 - Math::Pow(4.9, 9.9) == 6.8067718210957060E+006 -Math::Exp(9.9 * Math::Log(4.9)) == 6.8067718210956985E+006 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp deleted file mode 100644 index aa7f305520b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// Example for the Math::Log( double ) and Math::Log( double, double ) methods. -using namespace System; - -// Evaluate logarithmic identities that are functions of two arguments. -void UseBaseAndArg( double argB, double argX ) -{ - - // Evaluate log(B)[X] == 1 / log(X)[B]. - Console::WriteLine( "\n Math::Log({1}, {0}) == {2:E16}" - "\n 1.0 / Math::Log({0}, {1}) == {3:E16}", argB, argX, Math::Log( argX, argB ), 1.0 / Math::Log( argB, argX ) ); - - // Evaluate log(B)[X] == ln[X] / ln[B]. - Console::WriteLine( " Math::Log({1}) / Math::Log({0}) == {2:E16}", argB, argX, Math::Log( argX ) / Math::Log( argB ) ); - - // Evaluate log(B)[X] == log(B)[e] * ln[X]. - Console::WriteLine( "Math::Log(Math::E, {0}) * Math::Log({1}) == {2:E16}", argB, argX, Math::Log( Math::E, argB ) * Math::Log( argX ) ); -} - -void main() -{ - Console::WriteLine( "This example of Math::Log( double ) and " - "Math::Log( double, double )\n" - "generates the following output.\n" ); - Console::WriteLine( "Evaluate these identities with " - "selected values for X and B (base):" ); - Console::WriteLine( " log(B)[X] == 1 / log(X)[B]" ); - Console::WriteLine( " log(B)[X] == ln[X] / ln[B]" ); - Console::WriteLine( " log(B)[X] == log(B)[e] * ln[X]" ); - UseBaseAndArg( 0.1, 1.2 ); - UseBaseAndArg( 1.2, 4.9 ); - UseBaseAndArg( 4.9, 9.9 ); - UseBaseAndArg( 9.9, 0.1 ); -} - -/* -This example of Math::Log( double ) and Math::Log( double, double ) -generates the following output. - -Evaluate these identities with selected values for X and B (base): - log(B)[X] == 1 / log(X)[B] - log(B)[X] == ln[X] / ln[B] - log(B)[X] == log(B)[e] * ln[X] - - Math::Log(1.2, 0.1) == -7.9181246047624818E-002 - 1.0 / Math::Log(0.1, 1.2) == -7.9181246047624818E-002 - Math::Log(1.2) / Math::Log(0.1) == -7.9181246047624818E-002 -Math::Log(Math::E, 0.1) * Math::Log(1.2) == -7.9181246047624804E-002 - - Math::Log(4.9, 1.2) == 8.7166610085093179E+000 - 1.0 / Math::Log(1.2, 4.9) == 8.7166610085093161E+000 - Math::Log(4.9) / Math::Log(1.2) == 8.7166610085093179E+000 -Math::Log(Math::E, 1.2) * Math::Log(4.9) == 8.7166610085093179E+000 - - Math::Log(9.9, 4.9) == 1.4425396251981288E+000 - 1.0 / Math::Log(4.9, 9.9) == 1.4425396251981288E+000 - Math::Log(9.9) / Math::Log(4.9) == 1.4425396251981288E+000 -Math::Log(Math::E, 4.9) * Math::Log(9.9) == 1.4425396251981288E+000 - - Math::Log(0.1, 9.9) == -1.0043839404494075E+000 - 1.0 / Math::Log(9.9, 0.1) == -1.0043839404494075E+000 - Math::Log(0.1) / Math::Log(9.9) == -1.0043839404494075E+000 -Math::Log(Math::E, 9.9) * Math::Log(0.1) == -1.0043839404494077E+000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp deleted file mode 100644 index e16651faef4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp +++ /dev/null @@ -1,120 +0,0 @@ - -// -// Example for the trigonometric Math.Sin( double ) -// and Math.Cos( double ) methods. -using namespace System; - -// Evaluate trigonometric identities with a given angle. -void UseSineCosine( double degrees ) -{ - double angle = Math::PI * degrees / 180.0; - double sinAngle = Math::Sin( angle ); - double cosAngle = Math::Cos( angle ); - - // Evaluate sin^2(X) + cos^2(X) == 1. - Console::WriteLine( "\n Math::Sin({0} deg) == {1:E16}\n" - " Math::Cos({0} deg) == {2:E16}", degrees, Math::Sin( angle ), Math::Cos( angle ) ); - Console::WriteLine( "(Math::Sin({0} deg))^2 + (Math::Cos({0} deg))^2 == {1:E16}", degrees, sinAngle * sinAngle + cosAngle * cosAngle ); - - // Evaluate sin(2 * X) == 2 * sin(X) * cos(X). - Console::WriteLine( " Math::Sin({0} deg) == {1:E16}", 2.0 * degrees, Math::Sin( 2.0 * angle ) ); - Console::WriteLine( " 2 * Math::Sin({0} deg) * Math::Cos({0} deg) == {1:E16}", degrees, 2.0 * sinAngle * cosAngle ); - - // Evaluate cos(2 * X) == cos^2(X) - sin^2(X). - Console::WriteLine( " Math::Cos({0} deg) == {1:E16}", 2.0 * degrees, Math::Cos( 2.0 * angle ) ); - Console::WriteLine( "(Math::Cos({0} deg))^2 - (Math::Sin({0} deg))^2 == {1:E16}", degrees, cosAngle * cosAngle - sinAngle * sinAngle ); -} - - -// Evaluate trigonometric identities that are functions of two angles. -void UseTwoAngles( double degreesX, double degreesY ) -{ - double angleX = Math::PI * degreesX / 180.0; - double angleY = Math::PI * degreesY / 180.0; - - // Evaluate sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y). - Console::WriteLine( "\n Math::Sin({0} deg) * Math::Cos({1} deg) +\n" - " Math::Cos({0} deg) * Math::Sin({1} deg) == {2:E16}", degreesX, degreesY, Math::Sin( angleX ) * Math::Cos( angleY ) + Math::Cos( angleX ) * Math::Sin( angleY ) ); - Console::WriteLine( " Math::Sin({0} deg) == {1:E16}", degreesX + degreesY, Math::Sin( angleX + angleY ) ); - - // Evaluate cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y). - Console::WriteLine( " Math::Cos({0} deg) * Math::Cos({1} deg) -\n" - " Math::Sin({0} deg) * Math::Sin({1} deg) == {2:E16}", degreesX, degreesY, Math::Cos( angleX ) * Math::Cos( angleY ) - Math::Sin( angleX ) * Math::Sin( angleY ) ); - Console::WriteLine( " Math::Cos({0} deg) == {1:E16}", degreesX + degreesY, Math::Cos( angleX + angleY ) ); -} - -int main() -{ - Console::WriteLine( "This example of trigonometric " - "Math::Sin( double ) and Math::Cos( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "Convert selected values for X to radians \n" - "and evaluate these trigonometric identities:" ); - Console::WriteLine( " sin^2(X) + cos^2(X) == 1\n" - " sin(2 * X) == 2 * sin(X) * cos(X)" ); - Console::WriteLine( " cos(2 * X) == cos^2(X) - sin^2(X)" ); - UseSineCosine( 15.0 ); - UseSineCosine( 30.0 ); - UseSineCosine( 45.0 ); - Console::WriteLine( "\nConvert selected values for X and Y to radians \n" - "and evaluate these trigonometric identities:" ); - Console::WriteLine( " sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y)" ); - Console::WriteLine( " cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y)" ); - UseTwoAngles( 15.0, 30.0 ); - UseTwoAngles( 30.0, 45.0 ); -} - -/* -This example of trigonometric Math::Sin( double ) and Math::Cos( double ) -generates the following output. - -Convert selected values for X to radians -and evaluate these trigonometric identities: - sin^2(X) + cos^2(X) == 1 - sin(2 * X) == 2 * sin(X) * cos(X) - cos(2 * X) == cos^2(X) - sin^2(X) - - Math::Sin(15 deg) == 2.5881904510252074E-001 - Math::Cos(15 deg) == 9.6592582628906831E-001 -(Math::Sin(15 deg))^2 + (Math::Cos(15 deg))^2 == 1.0000000000000000E+000 - Math::Sin(30 deg) == 4.9999999999999994E-001 - 2 * Math::Sin(15 deg) * Math::Cos(15 deg) == 4.9999999999999994E-001 - Math::Cos(30 deg) == 8.6602540378443871E-001 -(Math::Cos(15 deg))^2 - (Math::Sin(15 deg))^2 == 8.6602540378443871E-001 - - Math::Sin(30 deg) == 4.9999999999999994E-001 - Math::Cos(30 deg) == 8.6602540378443871E-001 -(Math::Sin(30 deg))^2 + (Math::Cos(30 deg))^2 == 1.0000000000000000E+000 - Math::Sin(60 deg) == 8.6602540378443860E-001 - 2 * Math::Sin(30 deg) * Math::Cos(30 deg) == 8.6602540378443860E-001 - Math::Cos(60 deg) == 5.0000000000000011E-001 -(Math::Cos(30 deg))^2 - (Math::Sin(30 deg))^2 == 5.0000000000000022E-001 - - Math::Sin(45 deg) == 7.0710678118654746E-001 - Math::Cos(45 deg) == 7.0710678118654757E-001 -(Math::Sin(45 deg))^2 + (Math::Cos(45 deg))^2 == 1.0000000000000000E+000 - Math::Sin(90 deg) == 1.0000000000000000E+000 - 2 * Math::Sin(45 deg) * Math::Cos(45 deg) == 1.0000000000000000E+000 - Math::Cos(90 deg) == 6.1230317691118863E-017 -(Math::Cos(45 deg))^2 - (Math::Sin(45 deg))^2 == 2.2204460492503131E-016 - -Convert selected values for X and Y to radians -and evaluate these trigonometric identities: - sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y) - cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y) - - Math::Sin(15 deg) * Math::Cos(30 deg) + - Math::Cos(15 deg) * Math::Sin(30 deg) == 7.0710678118654746E-001 - Math::Sin(45 deg) == 7.0710678118654746E-001 - Math::Cos(15 deg) * Math::Cos(30 deg) - - Math::Sin(15 deg) * Math::Sin(30 deg) == 7.0710678118654757E-001 - Math::Cos(45 deg) == 7.0710678118654757E-001 - - Math::Sin(30 deg) * Math::Cos(45 deg) + - Math::Cos(30 deg) * Math::Sin(45 deg) == 9.6592582628906831E-001 - Math::Sin(75 deg) == 9.6592582628906820E-001 - Math::Cos(30 deg) * Math::Cos(45 deg) - - Math::Sin(30 deg) * Math::Sin(45 deg) == 2.5881904510252085E-001 - Math::Cos(75 deg) == 2.5881904510252096E-001 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp deleted file mode 100644 index c3fdb8d9939..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp +++ /dev/null @@ -1,115 +0,0 @@ - -// -// Example for the hyperbolic Math.Sinh( double ) -// and Math.Cosh( double ) methods. -using namespace System; - -// Evaluate hyperbolic identities with a given argument. -void UseSinhCosh( double arg ) -{ - double sinhArg = Math::Sinh( arg ); - double coshArg = Math::Cosh( arg ); - - // Evaluate cosh^2(X) - sinh^2(X) == 1. - Console::WriteLine( "\n Math::Sinh({0}) == {1:E16}\n" - " Math::Cosh({0}) == {2:E16}", arg, Math::Sinh( arg ), Math::Cosh( arg ) ); - Console::WriteLine( "(Math::Cosh({0}))^2 - (Math::Sinh({0}))^2 == {1:E16}", arg, coshArg * coshArg - sinhArg * sinhArg ); - - // Evaluate sinh(2 * X) == 2 * sinh(X) * cosh(X). - Console::WriteLine( " Math::Sinh({0}) == {1:E16}", 2.0 * arg, Math::Sinh( 2.0 * arg ) ); - Console::WriteLine( " 2 * Math::Sinh({0}) * Math::Cosh({0}) == {1:E16}", arg, 2.0 * sinhArg * coshArg ); - - // Evaluate cosh(2 * X) == cosh^2(X) + sinh^2(X). - Console::WriteLine( " Math::Cosh({0}) == {1:E16}", 2.0 * arg, Math::Cosh( 2.0 * arg ) ); - Console::WriteLine( "(Math::Cosh({0}))^2 + (Math::Sinh({0}))^2 == {1:E16}", arg, coshArg * coshArg + sinhArg * sinhArg ); -} - - -// Evaluate hyperbolic identities that are functions of two arguments. -void UseTwoArgs( double argX, double argY ) -{ - - // Evaluate sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y). - Console::WriteLine( "\n Math::Sinh({0}) * Math::Cosh({1}) +\n" - " Math::Cosh({0}) * Math::Sinh({1}) == {2:E16}", argX, argY, Math::Sinh( argX ) * Math::Cosh( argY ) + Math::Cosh( argX ) * Math::Sinh( argY ) ); - Console::WriteLine( " Math::Sinh({0}) == {1:E16}", argX + argY, Math::Sinh( argX + argY ) ); - - // Evaluate cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y). - Console::WriteLine( " Math::Cosh({0}) * Math::Cosh({1}) +\n" - " Math::Sinh({0}) * Math::Sinh({1}) == {2:E16}", argX, argY, Math::Cosh( argX ) * Math::Cosh( argY ) + Math::Sinh( argX ) * Math::Sinh( argY ) ); - Console::WriteLine( " Math::Cosh({0}) == {1:E16}", argX + argY, Math::Cosh( argX + argY ) ); -} - -int main() -{ - Console::WriteLine( "This example of hyperbolic " - "Math::Sinh( double ) and Math::Cosh( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "Evaluate these hyperbolic identities " - "with selected values for X:" ); - Console::WriteLine( " cosh^2(X) - sinh^2(X) == 1\n" - " sinh(2 * X) == 2 * sinh(X) * cosh(X)" ); - Console::WriteLine( " cosh(2 * X) == cosh^2(X) + sinh^2(X)" ); - UseSinhCosh( 0.1 ); - UseSinhCosh( 1.2 ); - UseSinhCosh( 4.9 ); - Console::WriteLine( "\nEvaluate these hyperbolic identities " - "with selected values for X and Y:" ); - Console::WriteLine( " sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y)" ); - Console::WriteLine( " cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y)" ); - UseTwoArgs( 0.1, 1.2 ); - UseTwoArgs( 1.2, 4.9 ); -} - -/* -This example of hyperbolic Math::Sinh( double ) and Math::Cosh( double ) -generates the following output. - -Evaluate these hyperbolic identities with selected values for X: - cosh^2(X) - sinh^2(X) == 1 - sinh(2 * X) == 2 * sinh(X) * cosh(X) - cosh(2 * X) == cosh^2(X) + sinh^2(X) - - Math::Sinh(0.1) == 1.0016675001984403E-001 - Math::Cosh(0.1) == 1.0050041680558035E+000 -(Math::Cosh(0.1))^2 - (Math::Sinh(0.1))^2 == 9.9999999999999989E-001 - Math::Sinh(0.2) == 2.0133600254109399E-001 - 2 * Math::Sinh(0.1) * Math::Cosh(0.1) == 2.0133600254109396E-001 - Math::Cosh(0.2) == 1.0200667556190759E+000 -(Math::Cosh(0.1))^2 + (Math::Sinh(0.1))^2 == 1.0200667556190757E+000 - - Math::Sinh(1.2) == 1.5094613554121725E+000 - Math::Cosh(1.2) == 1.8106555673243747E+000 -(Math::Cosh(1.2))^2 - (Math::Sinh(1.2))^2 == 1.0000000000000000E+000 - Math::Sinh(2.4) == 5.4662292136760939E+000 - 2 * Math::Sinh(1.2) * Math::Cosh(1.2) == 5.4662292136760939E+000 - Math::Cosh(2.4) == 5.5569471669655064E+000 -(Math::Cosh(1.2))^2 + (Math::Sinh(1.2))^2 == 5.5569471669655064E+000 - - Math::Sinh(4.9) == 6.7141166550932297E+001 - Math::Cosh(4.9) == 6.7148613134003227E+001 -(Math::Cosh(4.9))^2 - (Math::Sinh(4.9))^2 == 1.0000000000000000E+000 - Math::Sinh(9.8) == 9.0168724361884615E+003 - 2 * Math::Sinh(4.9) * Math::Cosh(4.9) == 9.0168724361884615E+003 - Math::Cosh(9.8) == 9.0168724916400624E+003 -(Math::Cosh(4.9))^2 + (Math::Sinh(4.9))^2 == 9.0168724916400606E+003 - -Evaluate these hyperbolic identities with selected values for X and Y: - sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y) - cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y) - - Math::Sinh(0.1) * Math::Cosh(1.2) + - Math::Cosh(0.1) * Math::Sinh(1.2) == 1.6983824372926155E+000 - Math::Sinh(1.3) == 1.6983824372926160E+000 - Math::Cosh(0.1) * Math::Cosh(1.2) + - Math::Sinh(0.1) * Math::Sinh(1.2) == 1.9709142303266281E+000 - Math::Cosh(1.3) == 1.9709142303266285E+000 - - Math::Sinh(1.2) * Math::Cosh(4.9) + - Math::Cosh(1.2) * Math::Sinh(4.9) == 2.2292776360739879E+002 - Math::Sinh(6.1) == 2.2292776360739885E+002 - Math::Cosh(1.2) * Math::Cosh(4.9) + - Math::Sinh(1.2) * Math::Sinh(4.9) == 2.2293000647511826E+002 - Math::Cosh(6.1) == 2.2293000647511832E+002 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp deleted file mode 100644 index 00a5cb83a3d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// -// Example for the hyperbolic Math::Tanh( double ) method. -using namespace System; - -// Evaluate hyperbolic identities with a given argument. -void UseTanh( double arg ) -{ - double tanhArg = Math::Tanh( arg ); - - // Evaluate tanh(X) == sinh(X) / cosh(X). - Console::WriteLine( "\n Math::Tanh({0}) == {1:E16}\n" - " Math::Sinh({0}) / Math::Cosh({0}) == {2:E16}", arg, tanhArg, (Math::Sinh( arg ) / Math::Cosh( arg )) ); - - // Evaluate tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)). - Console::WriteLine( " 2 * Math::Tanh({0}) /", arg, 2.0 * tanhArg ); - Console::WriteLine( " (1 + (Math::Tanh({0}))^2) == {1:E16}", arg, 2.0 * tanhArg / (1.0 + tanhArg * tanhArg) ); - Console::WriteLine( " Math::Tanh({0}) == {1:E16}", 2.0 * arg, Math::Tanh( 2.0 * arg ) ); -} - - -// Evaluate a hyperbolic identity that is a function of two arguments. -void UseTwoArgs( double argX, double argY ) -{ - - // Evaluate tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)). - Console::WriteLine( "\n (Math::Tanh({0}) + Math::Tanh({1})) /\n" - "(1 + Math::Tanh({0}) * Math::Tanh({1})) == {2:E16}", argX, argY, (Math::Tanh( argX ) + Math::Tanh( argY )) / (1.0 + Math::Tanh( argX ) * Math::Tanh( argY )) ); - Console::WriteLine( " Math::Tanh({0}) == {1:E16}", argX + argY, Math::Tanh( argX + argY ) ); -} - -int main() -{ - Console::WriteLine( "This example of hyperbolic Math::Tanh( double )\n" - "generates the following output." ); - Console::WriteLine( "\nEvaluate these hyperbolic identities " - "with selected values for X:" ); - Console::WriteLine( " tanh(X) == sinh(X) / cosh(X)" ); - Console::WriteLine( " tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))" ); - UseTanh( 0.1 ); - UseTanh( 1.2 ); - UseTanh( 4.9 ); - Console::WriteLine( "\nEvaluate [tanh(X + Y) == " - "(tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]" - "\nwith selected values for X and Y:" ); - UseTwoArgs( 0.1, 1.2 ); - UseTwoArgs( 1.2, 4.9 ); -} - -/* -This example of hyperbolic Math::Tanh( double ) -generates the following output. - -Evaluate these hyperbolic identities with selected values for X: - tanh(X) == sinh(X) / cosh(X) - tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)) - - Math::Tanh(0.1) == 9.9667994624955819E-002 - Math::Sinh(0.1) / Math::Cosh(0.1) == 9.9667994624955819E-002 - 2 * Math::Tanh(0.1) / - (1 + (Math::Tanh(0.1))^2) == 1.9737532022490401E-001 - Math::Tanh(0.2) == 1.9737532022490401E-001 - - Math::Tanh(1.2) == 8.3365460701215521E-001 - Math::Sinh(1.2) / Math::Cosh(1.2) == 8.3365460701215521E-001 - 2 * Math::Tanh(1.2) / - (1 + (Math::Tanh(1.2))^2) == 9.8367485769368024E-001 - Math::Tanh(2.4) == 9.8367485769368024E-001 - - Math::Tanh(4.9) == 9.9988910295055444E-001 - Math::Sinh(4.9) / Math::Cosh(4.9) == 9.9988910295055433E-001 - 2 * Math::Tanh(4.9) / - (1 + (Math::Tanh(4.9))^2) == 9.9999999385024030E-001 - Math::Tanh(9.8) == 9.9999999385024030E-001 - -Evaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))] -with selected values for X and Y: - - (Math::Tanh(0.1) + Math::Tanh(1.2)) / -(1 + Math::Tanh(0.1) * Math::Tanh(1.2)) == 8.6172315931330645E-001 - Math::Tanh(1.3) == 8.6172315931330634E-001 - - (Math::Tanh(1.2) + Math::Tanh(4.9)) / -(1 + Math::Tanh(1.2) * Math::Tanh(4.9)) == 9.9998993913939649E-001 - Math::Tanh(6.1) == 9.9998993913939649E-001 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp deleted file mode 100644 index 3caae363b62..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Equals.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -#using - -using namespace System; -using namespace System::Numerics; - -void main() -{ - BigInteger bigIntValue; - - Byte byteValue = 16; - bigIntValue = BigInteger(byteValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - byteValue.GetType()->Name, byteValue, - bigIntValue.Equals((Int64)byteValue)); - - SByte sbyteValue = -16; - bigIntValue = BigInteger(sbyteValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - sbyteValue.GetType()->Name, sbyteValue, - bigIntValue.Equals((Int64)sbyteValue)); - - Int16 shortValue = 1233; - bigIntValue = BigInteger(shortValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - shortValue.GetType()->Name, shortValue, - bigIntValue.Equals((Int64)shortValue)); - - UInt16 ushortValue = 64000; - bigIntValue = BigInteger(ushortValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - ushortValue.GetType()->Name, ushortValue, - bigIntValue.Equals((Int64)ushortValue)); - - int intValue = -1603854; - bigIntValue = BigInteger(intValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - intValue.GetType()->Name, intValue, - bigIntValue.Equals((Int64)intValue)); - - UInt32 uintValue = 1223300; - bigIntValue = BigInteger(uintValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - uintValue.GetType()->Name, uintValue, - bigIntValue.Equals((Int64)uintValue)); - - Int64 longValue = -123822229012; - bigIntValue = BigInteger(longValue); - Console::WriteLine("{0} {1} = {2} {3} : {4}", - bigIntValue.GetType()->Name, bigIntValue, - longValue.GetType()->Name, longValue, - bigIntValue.Equals((Int64)longValue)); -} -/* -The example displays output like the following: - BigInteger 16 = Byte 16 : True - BigInteger -16 = SByte -16 : True - BigInteger 1233 = Int16 1233 : True - BigInteger 64000 = UInt16 64000 : True - BigInteger -1603854 = Int32 -1603854 : True - BigInteger 1223300 = UInt32 1223300 : True - BigInteger -123822229012 = Int64 -123822229012 : True -*/ -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp deleted file mode 100644 index c480f604daa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// Equals2.cpp : Defines the entry point for the console application. -// - -// -#using - -using namespace System; -using namespace System::Numerics; - - -void main() -{ - const Int64 LIGHT_YEAR = 5878625373183; - - BigInteger altairDistance = 17 * LIGHT_YEAR; - BigInteger epsilonIndiDistance = 12 * LIGHT_YEAR; - BigInteger ursaeMajoris47Distance = 46 * LIGHT_YEAR; - Int64 tauCetiDistance = 12 * LIGHT_YEAR; - UInt64 procyon2Distance = 12 * LIGHT_YEAR; - Object^ wolf424ABDistance = 14 * LIGHT_YEAR; - - Console::WriteLine("Approx. equal distances from Epsilon Indi to:"); - Console::WriteLine(" Altair: {0}", - epsilonIndiDistance.Equals(altairDistance)); - Console::WriteLine(" Ursae Majoris 47: {0}", - epsilonIndiDistance.Equals(ursaeMajoris47Distance)); - Console::WriteLine(" TauCeti: {0}", - epsilonIndiDistance.Equals(tauCetiDistance)); - Console::WriteLine(" Procyon 2: {0}", - epsilonIndiDistance.Equals(procyon2Distance)); - Console::WriteLine(" Wolf 424 AB: {0}", - epsilonIndiDistance.Equals(wolf424ABDistance)); -} -/* -The example displays output like the following: - Approx. equal distances from Epsilon Indi to: - Altair: False - Ursae Majoris 47: False - TauCeti: True - Procyon 2: True - Wolf 424 AB: False -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp deleted file mode 100644 index f6ba5145e9c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -// Example for the OperatingSystem::Clone method. -using namespace System; - -// Copy, clone, and duplicate an OperatingSystem object. -void CopyOperatingSystemObjects() -{ - - // The Version object does not need to correspond to an - // actual OS version. - Version^ verMMBVer = gcnew Version( 5,6,7,8 ); - OperatingSystem^ opCreate1 = gcnew OperatingSystem( PlatformID::Win32NT,verMMBVer ); - - // Create another OperatingSystem object with the same - // parameters as opCreate1. - OperatingSystem^ opCreate2 = gcnew OperatingSystem( PlatformID::Win32NT,verMMBVer ); - - // Clone opCreate1 and copy the opCreate1 reference. - OperatingSystem^ opClone = safe_cast(opCreate1->Clone()); - OperatingSystem^ opCopy = opCreate1; - - // Compare the various objects for equality. - Console::WriteLine( "{0,-50}{1}", "Is the second object the same as the original?", opCreate1->Equals( opCreate2 ) ); - Console::WriteLine( "{0,-50}{1}", "Is the object clone the same as the original?", opCreate1->Equals( opClone ) ); - Console::WriteLine( "{0,-50}{1}", "Is the copied object the same as the original?", opCreate1->Equals( opCopy ) ); -} - -int main() -{ - Console::WriteLine( "This example of OperatingSystem::Clone( ) " - "generates the following output.\n" ); - Console::WriteLine( "Create an OperatingSystem object, and then " - "create another object with the \n" - "same parameters. Clone and copy the original " - "object, and then compare \n" - "each object with the original " - "using the Equals( ) method. Equals( ) \n" - "returns true only when both " - "references refer to the same object.\n" ); - CopyOperatingSystemObjects(); -} - -/* -This example of OperatingSystem::Clone( ) generates the following output. - -Create an OperatingSystem object, and then create another object with the -same parameters. Clone and copy the original object, and then compare -each object with the original using the Equals( ) method. Equals( ) -returns true only when both references refer to the same object. - -Is the second object the same as the original? False -Is the object clone the same as the original? False -Is the copied object the same as the original? True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp deleted file mode 100644 index 51ca7637c6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp +++ /dev/null @@ -1,60 +0,0 @@ - -// -// Example for the OperatingSystem constructor and the -// OperatingSystem::ToString( ) method. -using namespace System; - -// Create and display an OperatingSystem object. -void BuildOSObj( PlatformID pID, Version^ ver ) -{ - OperatingSystem^ os = gcnew OperatingSystem( pID,ver ); - Console::WriteLine( " {0}", os->ToString() ); -} - -void BuildOperatingSystemObjects() -{ - - // The Version object does not need to correspond to an - // actual OS version. - Version^ verNull = gcnew Version; - Version^ verMajMin = gcnew Version( 3,11 ); - Version^ verMMBld = gcnew Version( 5,25,625 ); - Version^ verMMBVer = gcnew Version( 5,6,7,8 ); - Version^ verString = gcnew Version( "3.5.8.13" ); - - // All PlatformID members are shown here. - BuildOSObj( PlatformID::Win32NT, verNull ); - BuildOSObj( PlatformID::Win32S, verMajMin ); - BuildOSObj( PlatformID::Win32Windows, verMMBld ); - BuildOSObj( PlatformID::WinCE, verMMBVer ); - BuildOSObj( PlatformID::Win32NT, verString ); -} - -int main() -{ - Console::WriteLine( "This example of the OperatingSystem constructor and \n" - "OperatingSystem::ToString( ) generates the following " - "output.\n" ); - Console::WriteLine( "Create and display several different " - "OperatingSystem objects:\n" ); - BuildOperatingSystemObjects(); - Console::WriteLine( "\nThe OS version of the host computer is:\n\n {0}", Environment::OSVersion->ToString() ); -} - -/* -This example of the OperatingSystem constructor and -OperatingSystem::ToString( ) generates the following output. - -Create and display several different OperatingSystem objects: - - Microsoft Windows NT 0.0 - Microsoft Win32S 3.11 - Microsoft Windows 98 5.25.625 - Microsoft Windows CE 5.6.7.8 - Microsoft Windows NT 3.5.8.13 - -The OS version of the host computer is: - - Microsoft Windows NT 5.1.2600.0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp deleted file mode 100644 index 955079bbbca..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example for the OperatingSystem.Platform and -// OperatingSystem.Version properties. -using namespace System; - -// Create an OperatingSystem object and display the Platform -// and Version properties. -void BuildOSObj( PlatformID pID, Version^ ver ) -{ - OperatingSystem^ opSys = gcnew OperatingSystem( pID,ver ); - PlatformID platform = opSys->Platform; - Version^ version = opSys->Version; - Console::WriteLine( " Platform: {0,-15} Version: {1}", platform, version ); -} - -void BuildOperatingSystemObjects() -{ - - // The Version object does not need to correspond to an - // actual OS version. - Version^ verNull = gcnew Version; - Version^ verString = gcnew Version( "3.5.8.13" ); - Version^ verMajMin = gcnew Version( 6,10 ); - Version^ verMMBld = gcnew Version( 5,25,5025 ); - Version^ verMMBVer = gcnew Version( 5,6,7,8 ); - - // All PlatformID members are shown here. - BuildOSObj( PlatformID::Win32NT, verNull ); - BuildOSObj( PlatformID::Win32S, verString ); - BuildOSObj( PlatformID::Win32Windows, verMajMin ); - BuildOSObj( PlatformID::WinCE, verMMBld ); - BuildOSObj( PlatformID::Win32NT, verMMBVer ); -} - -int main() -{ - Console::WriteLine( "This example of OperatingSystem::Platform " - "and OperatingSystem::Version \n" - "generates the following output.\n" ); - Console::WriteLine( "Create several OperatingSystem objects " - "and display their properties:\n" ); - BuildOperatingSystemObjects(); - Console::WriteLine( "\nThe operating system of the host computer is:\n" ); - BuildOSObj( Environment::OSVersion->Platform, Environment::OSVersion->Version ); -} - -/* -This example of OperatingSystem::Platform and OperatingSystem::Version -generates the following output. - -Create several OperatingSystem objects and display their properties: - - Platform: Win32NT Version: 0.0 - Platform: Win32S Version: 3.5.8.13 - Platform: Win32Windows Version: 6.10 - Platform: WinCE Version: 5.25.5025 - Platform: Win32NT Version: 5.6.7.8 - -The operating system of the host computer is: - - Platform: Win32NT Version: 5.1.2600.0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp deleted file mode 100644 index cb05859164c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp +++ /dev/null @@ -1,95 +0,0 @@ - -// -// Example of the Random class constructors and Random::NextDouble() -// method. -using namespace System; -using namespace System::Threading; - -// Generate random numbers from the specified Random object. -void RunIntNDoubleRandoms(Random^ randObj) -{ - - // Generate the first six random integers. - for (int j = 0; j < 6; j++) - Console::Write(" {0,10} ", randObj->Next()); - Console::WriteLine(); - - // Generate the first six random doubles. - for (int j = 0; j < 6; j++) - Console::Write(" {0:F8} ", randObj->NextDouble()); - Console::WriteLine(); -} - - -// Create a Random object with the specified seed. -void FixedSeedRandoms(int seed) -{ - Console::WriteLine("\nRandom numbers from a Random object with seed = {0}:", seed); - Random^ fixRand = gcnew Random(seed); - RunIntNDoubleRandoms(fixRand); -} - - -// Create a random object with a timer-generated seed. -void AutoSeedRandoms() -{ - - // Wait to allow the timer to advance. - Thread::Sleep(1); - Console::WriteLine("\nRandom numbers from a Random object " - "with an auto-generated seed:"); - Random^ autoRand = gcnew Random; - RunIntNDoubleRandoms(autoRand); -} - -int main() -{ - Console::WriteLine("This example of the Random class constructors and Random" - "::NextDouble() \ngenerates the following output.\n"); - Console::WriteLine("Create Random objects, and then generate and " - "display six integers and \nsix doubles from each."); - FixedSeedRandoms(123); - FixedSeedRandoms(123); - FixedSeedRandoms(456); - FixedSeedRandoms(456); - AutoSeedRandoms(); - AutoSeedRandoms(); - AutoSeedRandoms(); -} - -/* -This example of the Random class constructors and Random::NextDouble() -generates an output similar to the following: - -Create Random objects, and then generate and display six integers and -six doubles from each. - -Random numbers from a Random object with seed = 123: - 2114319875 1949518561 1596751841 1742987178 1586516133 103755708 - 0.01700087 0.14935942 0.19470390 0.63008947 0.90976122 0.49519146 - -Random numbers from a Random object with seed = 123: - 2114319875 1949518561 1596751841 1742987178 1586516133 103755708 - 0.01700087 0.14935942 0.19470390 0.63008947 0.90976122 0.49519146 - -Random numbers from a Random object with seed = 456: - 2044805024 1323311594 1087799997 1907260840 179380355 120870348 - 0.21988117 0.21026556 0.39236514 0.42420498 0.24102703 0.47310170 - -Random numbers from a Random object with seed = 456: - 2044805024 1323311594 1087799997 1907260840 179380355 120870348 - 0.21988117 0.21026556 0.39236514 0.42420498 0.24102703 0.47310170 - -Random numbers from a Random object with an auto-generated seed: - 1624372556 1894939458 302472229 588108304 23919954 1085111949 - 0.14595512 0.30162298 0.92267372 0.55707657 0.25430079 0.74143239 - -Random numbers from a Random object with an auto-generated seed: - 2105952511 1753605347 280739490 876793040 1129567796 524571616 - 0.62652210 0.31846701 0.15984073 0.24458755 0.62160607 0.54857684 - -Random numbers from a Random object with an auto-generated seed: - 440048819 1612271236 259006751 1165477776 87731991 2111514930 - 0.10708907 0.33531104 0.39700773 0.93209853 0.98891135 0.35572129 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp deleted file mode 100644 index 167584f6cc6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp +++ /dev/null @@ -1,99 +0,0 @@ - -// -// Example of the Random::Next() methods. -using namespace System; - -// Generate random numbers with no bounds specified. -void NoBoundsRandoms(int seed) -{ - Console::WriteLine("\nRandom object, seed = {0}, no bounds:", seed); - Random^ randObj = gcnew Random(seed); - - // Generate six random integers from 0 to int.MaxValue. - for (int j = 0; j < 6; j++) - Console::Write("{0,11} ", randObj->Next()); - Console::WriteLine(); -} - - -// Generate random numbers with an upper bound specified. -void UpperBoundRandoms(int seed, int upper) -{ - Console::WriteLine("\nRandom object, seed = {0}, upper bound = {1}:", seed, upper); - Random^ randObj = gcnew Random(seed); - - // Generate six random integers from 0 to the upper bound. - for (int j = 0; j < 6; j++) - Console::Write("{0,11} ", randObj->Next(upper)); - Console::WriteLine(); -} - - -// Generate random numbers with both bounds specified. -void BothBoundsRandoms(int seed, int lower, int upper) -{ - Console::WriteLine("\nRandom object, seed = {0}, lower = {1}, upper = {2}:", seed, lower, upper); - Random^ randObj = gcnew Random(seed); - - // Generate six random integers from the lower to - // upper bounds. - for (int j = 0; j < 6; j++) - Console::Write("{0,11} ", randObj->Next(lower, upper)); - Console::WriteLine(); -} - -int main() -{ - Console::WriteLine("This example of the Random::Next() methods\n" - "generates the following output.\n"); - Console::WriteLine("Create Random objects all with the same seed and " - "generate\nsequences of numbers with different " - "bounds. Note the effect\nthat the various " - "combinations of bounds have on the sequences."); - NoBoundsRandoms(234); - UpperBoundRandoms(234, Int32::MaxValue); - UpperBoundRandoms(234, 2000000000); - UpperBoundRandoms(234, 200000000); - BothBoundsRandoms(234, 0, Int32::MaxValue); - BothBoundsRandoms(234, Int32::MinValue, Int32::MaxValue); - BothBoundsRandoms(234, -2000000000, 2000000000); - BothBoundsRandoms(234, -200000000, 200000000); - BothBoundsRandoms(234, -2000, 2000); -} - -/* -This example of the Random::Next() methods -generates the following output. - -Create Random objects all with the same seed and generate -sequences of numbers with different bounds. Note the effect -that the various combinations of bounds have on the sequences. - -Random object, seed = 234, no bounds: - 2091148258 1024955023 711273344 1081917183 1833298756 109460588 - -Random object, seed = 234, upper bound = 2147483647: - 2091148258 1024955023 711273344 1081917183 1833298756 109460588 - -Random object, seed = 234, upper bound = 2000000000: - 1947533580 954563751 662424922 1007613896 1707392518 101943116 - -Random object, seed = 234, upper bound = 200000000: - 194753358 95456375 66242492 100761389 170739251 10194311 - -Random object, seed = 234, lower = 0, upper = 2147483647: - 2091148258 1024955023 711273344 1081917183 1833298756 109460588 - -Random object, seed = 234, lower = -2147483648, upper = 2147483647: - 2034812868 -97573602 -724936960 16350718 1519113864 -1928562472 - -Random object, seed = 234, lower = -2000000000, upper = 2000000000: - 1895067160 -90872498 -675150156 15227793 1414785036 -1796113767 - -Random object, seed = 234, lower = -200000000, upper = 200000000: - 189506716 -9087250 -67515016 1522779 141478503 -179611377 - -Random object, seed = 234, lower = -2000, upper = 2000: - 1895 -91 -676 15 1414 -1797 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp deleted file mode 100644 index fad6b704dab..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random(); - array^ malePetNames = { "Rufus", "Bear", "Dakota", "Fido", - "Vanya", "Samuel", "Koani", "Volodya", - "Prince", "Yiska" }; - array^ femalePetNames = { "Maggie", "Penny", "Saya", "Princess", - "Abby", "Laila", "Sadie", "Olivia", - "Starlight", "Talla" }; - - // Generate random indexes for pet names. - int mIndex = rnd->Next(malePetNames->Length); - int fIndex = rnd->Next(femalePetNames->Length); - - // Display the result. - Console::WriteLine("Suggested pet name of the day: "); - Console::WriteLine(" For a male: {0}", malePetNames[mIndex]); - Console::WriteLine(" For a female: {0}", femalePetNames[fIndex]); -} -// The example displays output similar to the following: -// Suggested pet name of the day: -// For a male: Koani -// For a female: Maggie -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp deleted file mode 100644 index 6f5970848da..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random(); - - Console::WriteLine("\n20 random integers from -100 to 100:"); - for (int ctr = 1; ctr <= 20; ctr++) - { - Console::Write("{0,6}", rnd->Next(-100, 101)); - if (ctr % 5 == 0) Console::WriteLine(); - } - - Console::WriteLine("\n20 random integers from 1000 to 10000:"); - for (int ctr = 1; ctr <= 20; ctr++) - { - Console::Write("{0,8}", rnd->Next(1000, 10001)); - if (ctr % 5 == 0) Console::WriteLine(); - } - - Console::WriteLine("\n20 random integers from 1 to 10:"); - for (int ctr = 1; ctr <= 20; ctr++) - { - Console::Write("{0,6}", rnd->Next(1, 11)); - if (ctr % 5 == 0) Console::WriteLine(); - } -} -// The example displays output similar to the following: -// 20 random integers from -100 to 100: -// 65 -95 -10 90 -35 -// -83 -16 -15 -19 41 -// -67 -93 40 12 62 -// -80 -95 67 -81 -21 -// -// 20 random integers from 1000 to 10000: -// 4857 9897 4405 6606 1277 -// 9238 9113 5151 8710 1187 -// 2728 9746 1719 3837 3736 -// 8191 6819 4923 2416 3028 -// -// 20 random integers from 1 to 10: -// 9 8 5 9 9 -// 9 1 2 3 8 -// 1 4 8 10 5 -// 9 7 9 10 5 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp deleted file mode 100644 index 6f999eb0477..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::Write("Number of random numbers to generate: "); - String^ line = Console::ReadLine(); - unsigned int numbers = 0; - Random^ rnd = gcnew Random(); - - if (!UInt32::TryParse(line, numbers)) - numbers = 10; - - for (unsigned int ctr = 1; ctr <= numbers; ctr++) - Console::WriteLine("{0,15:N0}", rnd->Next()); -} -// The example displays output like the following when asked to generate -// 15 random numbers: -// Number of random numbers to generate: 15 -// 1,733,189,596 -// 566,518,090 -// 1,166,108,546 -// 1,931,426,514 -// 1,341,108,291 -// 1,012,698,049 -// 890,578,409 -// 1,377,589,722 -// 2,108,384,181 -// 1,532,939,448 -// 762,207,767 -// 815,074,920 -// 1,521,208,785 -// 1,950,436,671 -// 1,266,596,666 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp deleted file mode 100644 index 9b547303cfa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; - -void main() -{ - Random^ rnd = gcnew Random(); - array^ malePetNames = { "Rufus", "Bear", "Dakota", "Fido", - "Vanya", "Samuel", "Koani", "Volodya", - "Prince", "Yiska" }; - array^ femalePetNames = { "Maggie", "Penny", "Saya", "Princess", - "Abby", "Laila", "Sadie", "Olivia", - "Starlight", "Talla" }; - - // Generate random indexes for pet names. - int mIndex = rnd->Next(0, malePetNames->Length); - int fIndex = rnd->Next(0, femalePetNames->Length); - - // Display the result. - Console::WriteLine("Suggested pet name of the day: "); - Console::WriteLine(" For a male: {0}", malePetNames[mIndex]); - Console::WriteLine(" For a female: {0}", femalePetNames[fIndex]); -} -// The example displays the following output: -// Suggested pet name of the day: -// For a male: Koani -// For a female: Maggie -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp deleted file mode 100644 index 9e0bb8434a9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// SampleEx.cpp : main project file. - -// -using namespace System; - -// This derived class converts the uniformly distributed random -// numbers generated by base.Sample() to another distribution. -public ref class RandomProportional : Random -{ - // The Sample method generates a distribution proportional to the value - // of the random numbers, in the range [0.0, 1.0]. -protected: - virtual double Sample() override - { - return Math::Sqrt(Random::Sample()); - } - -public: - RandomProportional() - {} - - virtual int Next() override - { - return (int) (Sample() * Int32::MaxValue); - } -}; - -int main(array ^args) -{ - const int rows = 4, cols = 6; - const int runCount = 1000000; - const int distGroupCount = 10; - const double intGroupSize = - ((double) Int32::MaxValue + 1.0) / (double)distGroupCount; - - RandomProportional ^randObj = gcnew RandomProportional(); - - array^ intCounts = gcnew array(distGroupCount); - array^ realCounts = gcnew array(distGroupCount); - - Console::WriteLine( - "\nThe derived RandomProportional class overrides " + - "the Sample method to \ngenerate random numbers " + - "in the range [0.0, 1.0]. The distribution \nof " + - "the numbers is proportional to their numeric values. " + - "For example, \nnumbers are generated in the " + - "vicinity of 0.75 with three times the \n" + - "probability of those generated near 0.25."); - Console::WriteLine( - "\nRandom doubles generated with the NextDouble() " + - "method:\n"); - - // Generate and display [rows * cols] random doubles. - for (int i = 0; i < rows; i++) - { - for (int j = 0; j < cols; j++) - Console::Write("{0,12:F8}", randObj->NextDouble()); - Console::WriteLine(); - } - - Console::WriteLine( - "\nRandom integers generated with the Next() " + - "method:\n"); - - // Generate and display [rows * cols] random integers. - for (int i = 0; i < rows; i++) - { - for (int j = 0; j < cols; j++) - Console::Write("{0,12}", randObj->Next()); - Console::WriteLine(); - } - - Console::WriteLine( - "\nTo demonstrate the proportional distribution, " + - "{0:N0} random \nintegers and doubles are grouped " + - "into {1} equal value ranges. This \n" + - "is the count of values in each range:\n", - runCount, distGroupCount); - Console::WriteLine( - "{0,21}{1,10}{2,20}{3,10}", "Integer Range", - "Count", "Double Range", "Count"); - Console::WriteLine( - "{0,21}{1,10}{2,20}{3,10}", "-------------", - "-----", "------------", "-----"); - - // Generate random integers and doubles, and then count - // them by group. - for (int i = 0; i < runCount; i++) - { - intCounts[ (int)((double)randObj->Next() / - intGroupSize) ]++; - realCounts[ (int)(randObj->NextDouble() * - (double)distGroupCount) ]++; - } - - // Display the count of each group. - for (int i = 0; i < distGroupCount; i++) - Console::WriteLine( - "{0,10}-{1,10}{2,10:N0}{3,12:N5}-{4,7:N5}{5,10:N0}", - (int)((double)i * intGroupSize), - (int)((double)(i + 1) * intGroupSize - 1.0), - intCounts[ i ], - ((double)i) / (double)distGroupCount, - ((double)(i + 1)) / (double)distGroupCount, - realCounts[ i ]); - return 0; -} - -/* -This example of Random.Sample() displays output similar to the following: - - The derived RandomProportional class overrides the Sample method to - generate random numbers in the range [0.0, 1.0). The distribution - of the numbers is proportional to the number values. For example, - numbers are generated in the vicinity of 0.75 with three times the - probability of those generated near 0.25. - - Random doubles generated with the NextDouble() method: - - 0.59455719 0.17589882 0.83134398 0.35795862 0.91467727 0.54022658 - 0.93716947 0.54817519 0.94685080 0.93705478 0.18582318 0.71272428 - 0.77708682 0.95386216 0.70412393 0.86099417 0.08275804 0.79108316 - 0.71019941 0.84205103 0.41685082 0.58186880 0.89492302 0.73067715 - - Random integers generated with the Next() method: - - 1570755704 1279192549 1747627711 1705700211 1372759203 1849655615 - 2046235980 1210843924 1554274149 1307936697 1480207570 1057595022 - 337854215 844109928 2028310798 1386669369 2073517658 1291729809 - 1537248240 1454198019 1934863511 1640004334 2032620207 534654791 - - To demonstrate the proportional distribution, 1,000,000 random - integers and doubles are grouped into 10 equal value ranges. This - is the count of values in each range: - - Integer Range Count Double Range Count - ------------- ----- ------------ ----- - 0- 214748363 10,079 0.00000-0.10000 10,148 - 214748364- 429496728 29,835 0.10000-0.20000 29,849 - 429496729- 644245093 49,753 0.20000-0.30000 49,948 - 644245094- 858993458 70,325 0.30000-0.40000 69,656 - 858993459-1073741823 89,906 0.40000-0.50000 90,337 - 1073741824-1288490187 109,868 0.50000-0.60000 110,225 - 1288490188-1503238552 130,388 0.60000-0.70000 129,986 - 1503238553-1717986917 149,231 0.70000-0.80000 150,428 - 1717986918-1932735282 170,234 0.80000-0.90000 169,610 - 1932735283-2147483647 190,381 0.90000-1.00000 189,813 -*/ -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp deleted file mode 100644 index 8fba2211c96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; - -void main() -{ - // Instantiate random number generator using system-supplied value as seed. - Random^ rand = gcnew Random(); - // Generate and display 5 random byte (integer) values. - array^ bytes = gcnew array(4); - rand->NextBytes(bytes); - Console::WriteLine("Five random byte values:"); - for each (Byte byteValue in bytes) - Console::Write("{0, 5}", byteValue); - Console::WriteLine(); - // Generate and display 5 random integers. - Console::WriteLine("Five random integer values:"); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,15:N0}", rand->Next()); - Console::WriteLine(); - // Generate and display 5 random integers between 0 and 100.// - Console::WriteLine("Five random integers between 0 and 100:"); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N0}", rand->Next(101)); - Console::WriteLine(); - // Generate and display 5 random integers from 50 to 100. - Console::WriteLine("Five random integers between 50 and 100:"); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N0}", rand->Next(50, 101)); - Console::WriteLine(); - // Generate and display 5 random floating point values from 0 to 1. - Console::WriteLine("Five Doubles."); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N3}", rand->NextDouble()); - Console::WriteLine(); - // Generate and display 5 random floating point values from 0 to 5. - Console::WriteLine("Five Doubles between 0 and 5."); - for (int ctr = 0; ctr <= 4; ctr++) - Console::Write("{0,8:N3}", rand->NextDouble() * 5); -} -// The example displays output like the following: -// Five random byte values: -// 194 185 239 54 116 -// Five random integer values: -// 507,353,531 1,509,532,693 2,125,074,958 1,409,512,757 652,767,128 -// Five random integers between 0 and 100: -// 16 78 94 79 52 -// Five random integers between 50 and 100: -// 56 66 96 60 65 -// Five Doubles. -// 0.943 0.108 0.744 0.563 0.415 -// Five Doubles between 0 and 5. -// 2.934 3.130 0.292 1.432 4.369 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp deleted file mode 100644 index 44abeeae6c3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -class MethodBodyDemo -{ -public: - - // This class will demonstrate how to create a method body using - // the MethodBuilder::CreateMethodBody(Byte[], int) method. - static Type^ BuildDynType() - { - Type^ addType = nullptr; - AppDomain^ currentDom = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBldr = currentDom->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - - // The dynamic assembly space has been created. Next, create a module - // within it. The type Point will be reflected into this module. - ModuleBuilder^ myModuleBldr = myAsmBldr->DefineDynamicModule( "MyModule" ); - TypeBuilder^ myTypeBldr = myModuleBldr->DefineType( "Adder" ); - array^temp0 = {int::typeid,int::typeid}; - MethodBuilder^ myMthdBldr = myTypeBldr->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, temp0 ); - - // Build the array of Bytes holding the MSIL instructions. - - /* 02h is the opcode for ldarg.0 */ - /* 03h is the opcode for ldarg.1 */ - /* 58h is the opcode for add */ - /* 2Ah is the opcode for ret */ - array^temp1 = {0x02,0x03,0x58,0x2A}; - array^ILcodes = temp1; - myMthdBldr->CreateMethodBody( ILcodes, ILcodes->Length ); - addType = myTypeBldr->CreateType(); - return addType; - } - -}; - -int main() -{ - Type^ myType = MethodBodyDemo::BuildDynType(); - Console::WriteLine( "---" ); - Console::Write( "Enter the first integer to add: " ); - int aVal = Convert::ToInt32( Console::ReadLine() ); - Console::Write( "Enter the second integer to add: " ); - int bVal = Convert::ToInt32( Console::ReadLine() ); - Object^ adderInst = Activator::CreateInstance( myType, gcnew array(0) ); - array^temp1 = {aVal,bVal}; - Console::WriteLine( "The value of adding {0} to {1} is: {2}.", aVal, bVal, myType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, adderInst, temp1 ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp deleted file mode 100644 index bd325cd3b40..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Get a Type object. - Type^ t = int::typeid; - // Instantiate an Assembly class to the assembly housing the Integer type. - Assembly^ assem = Assembly::GetAssembly(t); - // Display the name of the assembly. - Console::WriteLine("Name: {0}", assem->FullName); - // Get the location of the assembly using the file: protocol. - Console::WriteLine("CodeBase: {0}", assem->CodeBase); -} -// The example displays output like the following: -// Name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 -// CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp deleted file mode 100644 index 21eed0e53a5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp +++ /dev/null @@ -1,182 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; - -void Snippet1() -{ - Assembly^ SampleAssembly; - // Instantiate a target object. - Int32 Integer1(0); - Type^ Type1; - // Set the Type instance to the target class type. - Type1 = Integer1.GetType(); - // Instantiate an Assembly class to the assembly housing the Integer type. - SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); - // Gets the location of the assembly using file: protocol. - Console::WriteLine( "CodeBase= {0}", SampleAssembly->CodeBase ); -} -void Snippet2() -{ - // - Assembly^ SampleAssembly; - // Instantiate a target object. - Int32 Integer1(0); - Type^ Type1; - // Set the Type instance to the target class type. - Type1 = Integer1.GetType(); - // Instantiate an Assembly class to the assembly housing the Integer type. - SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); - // Write the display name of assembly including base name and version. - Console::WriteLine( "FullName= {0}", SampleAssembly->FullName ); - // The example displays the following output: - // FullName=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - // -} -void Snippet3() -{ - // - Assembly^ SampleAssembly; - // Instantiate a target object. - Int32 Integer1(0); - Type^ Type1; - // Set the Type instance to the target class type. - Type1 = Integer1.GetType(); - // Instantiate an Assembly class to the assembly housing the Integer type. - SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); - // Display the physical location of the assembly containing the manifest. - Console::WriteLine( "Location= {0}", SampleAssembly->Location ); - // The example displays the following output: - // Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll - // -} - -void Snippet5() -{ - // - Assembly^ SampleAssembly; - // Instantiate a target object. - Int32 Integer1(0); - Type^ Type1; - // Set the Type instance to the target class type. - Type1 = Integer1.GetType(); - // Instantiate an Assembly class to the assembly housing the Integer type. - SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); - // Display the name of the assembly currently executing - Console::WriteLine( "GetExecutingAssembly= {0}", Assembly::GetExecutingAssembly()->FullName ); - // The example displays the following output: - // GetExecutingAssembly=assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null - // -} -void Snippet6() -{ - // - Assembly^ SampleAssembly; - // Load the assembly by providing the location of the assembly file. - SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); - for each ( Type^ ExportedType in SampleAssembly->GetExportedTypes() ) - { - Console::WriteLine( ExportedType ); - } - // -} -void Snippet7() -{ - // - Assembly^ SampleAssembly; - // Load the assembly by providing the type name. - SampleAssembly = Assembly::Load( "MyAssembly" ); - for each ( String^ Resource in SampleAssembly->GetManifestResourceNames() ) - { - Console::WriteLine( Resource ); - } - // -} -void Snippet8() -{ - // - Assembly^ SampleAssembly; - SampleAssembly = Assembly::Load( "System.Data" ); - array^ Types = SampleAssembly->GetTypes(); - for each ( Type^ oType in Types ) - { - Console::WriteLine( oType->Name ); - } - // -} -void Snippet9() -{ - // - Assembly^ SampleAssembly; - SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); - - // Obtain a reference to the first class contained in the assembly. - Type^ oType = SampleAssembly->GetTypes()[ 0 ]; - // Obtain a reference to the public properties of the type. - array^ Props = oType->GetProperties(); - // Display information about public properties of assembly type. - // Prop = Prop1 - // DeclaringType = Sample::Assembly.Class1 - // Type = System::String - // Readable = True - // Writable = False - for each ( PropertyInfo^ Prop in Props ) - { - Console::WriteLine( "Prop= {0}", Prop->Name ); - Console::WriteLine( " DeclaringType= {0}", Prop->DeclaringType ); - Console::WriteLine( " Type= {0}", Prop->PropertyType ); - Console::WriteLine( " Readable= {0}", Prop->CanRead ); - Console::WriteLine( " Writable= {0}", Prop->CanWrite ); - } - // -} -void Snippet10() -{ - // - Assembly^ SampleAssembly; - SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); - array^ Methods = SampleAssembly->GetTypes()[ 0 ]->GetMethods(); - // Obtain a reference to the method members - for each ( MethodInfo^ Method in Methods ) - { - Console::WriteLine( "Method Name= {0}", Method->Name ); - } - // -} -void Snippet11() -{ - // - Assembly^ SampleAssembly; - SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); - // Obtain a reference to a method known to exist in assembly. - MethodInfo^ Method = SampleAssembly->GetTypes()[ 0 ]->GetMethod( "Method1" ); - // Obtain a reference to the parameters collection of the MethodInfo instance. - array^ Params = Method->GetParameters(); - // Display information about method parameters. - // Param = sParam1 - // Type = System::String - // Position = 0 - // Optional=False - for each ( ParameterInfo^ Param in Params ) - { - Console::WriteLine( "Param= {0}", Param->Name ); - Console::WriteLine( " Type= {0}", Param->ParameterType ); - Console::WriteLine( " Position= {0}", Param->Position ); - Console::WriteLine( " Optional= {0}", Param->IsOptional ); - } - // - Console::ReadLine(); -} - -void main() -{ - Snippet1(); - Snippet2(); - Snippet3(); - Snippet5(); - Snippet6(); - Snippet7(); - Snippet8(); - Snippet9(); - Snippet10(); - Snippet11(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp deleted file mode 100644 index 3c54fa6e1c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Instantiate a target object. - int integer1 = 1632; - // Instantiate an Assembly class to the assembly housing the Integer type. - Assembly^ systemAssembly = integer1.GetType()->Assembly; - // Get the location of the assembly using the file: protocol. - Console::WriteLine("CodeBase = {0}", systemAssembly->CodeBase); -} -// The example displays output like the following: -// CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp deleted file mode 100644 index a109f1df474..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Instantiate a target object. - Int32 integer1 = 0; - // Set the Type instance to the target class type. - Type^ type1 = integer1.GetType(); - // Instantiate an Assembly class to the assembly housing the Integer type. - Assembly^ sampleAssembly = Assembly::GetAssembly(integer1.GetType()); - // Display the name of the assembly that is calling the method. - Console::WriteLine("GetCallingAssembly = {0}", Assembly::GetCallingAssembly()->FullName); -} -// The example displays output like the following: -// GetCallingAssembly = Example, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp deleted file mode 100644 index ba2e35bfbb6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp +++ /dev/null @@ -1,137 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ DynamicDotProductGen() -{ - Type^ ivType = nullptr; - array^temp0 = {int::typeid,int::typeid,int::typeid}; - array^ctorParams = temp0; - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "IntVectorAsm"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ IntVectorModule = myAsmBuilder->DefineDynamicModule( "IntVectorModule", "Vector.dll" ); - TypeBuilder^ ivTypeBld = IntVectorModule->DefineType( "IntVector", TypeAttributes::Public ); - FieldBuilder^ xField = ivTypeBld->DefineField( "x", int::typeid, FieldAttributes::Private ); - FieldBuilder^ yField = ivTypeBld->DefineField( "y", int::typeid, FieldAttributes::Private ); - FieldBuilder^ zField = ivTypeBld->DefineField( "z", int::typeid, FieldAttributes::Private ); - Type^ objType = Type::GetType( "System.Object" ); - ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); - ConstructorBuilder^ ivCtor = ivTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); - ILGenerator^ ctorIL = ivCtor->GetILGenerator(); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Call, objCtor ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_1 ); - ctorIL->Emit( OpCodes::Stfld, xField ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_2 ); - ctorIL->Emit( OpCodes::Stfld, yField ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_3 ); - ctorIL->Emit( OpCodes::Stfld, zField ); - ctorIL->Emit( OpCodes::Ret ); - - // This method will find the dot product of the stored vector - // with another. - array^temp1 = {ivTypeBld}; - array^dpParams = temp1; - - // Here, you create a MethodBuilder containing the - // name, the attributes (public, static, private, and so on), - // the return type (int, in this case), and a array of Type - // indicating the type of each parameter. Since the sole parameter - // is a IntVector, the very class you're creating, you will - // pass in the TypeBuilder (which is derived from Type) instead of - // a Type object for IntVector, avoiding an exception. - // -- This method would be declared in C# as: - // public int DotProduct(IntVector aVector) - MethodBuilder^ dotProductMthd = ivTypeBld->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, dpParams ); - - // A ILGenerator can now be spawned, attached to the MethodBuilder. - ILGenerator^ mthdIL = dotProductMthd->GetILGenerator(); - - // Here's the body of our function, in MSIL form. We're going to find the - // "dot product" of the current vector instance with the passed vector - // instance. For reference purposes, the equation is: - // (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product - // First, you'll load the reference to the current instance "this" - // stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent - // instruction, will pop the reference off the stack and look up the - // field "x", specified by the FieldInfo token "xField". - mthdIL->Emit( OpCodes::Ldarg_0 ); - mthdIL->Emit( OpCodes::Ldfld, xField ); - - // That completed, the value stored at field "x" is now atop the stack. - // Now, you'll do the same for the Object reference we passed as a - // parameter, stored in argument 1 (ldarg.1). After Ldfld executed, - // you'll have the value stored in field "x" for the passed instance - // atop the stack. - mthdIL->Emit( OpCodes::Ldarg_1 ); - mthdIL->Emit( OpCodes::Ldfld, xField ); - - // There will now be two values atop the stack - the "x" value for the - // current vector instance, and the "x" value for the passed instance. - // You'll now multiply them, and push the result onto the evaluation stack. - mthdIL->Emit( OpCodes::Mul_Ovf_Un ); - - // Now, repeat this for the "y" fields of both vectors. - mthdIL->Emit( OpCodes::Ldarg_0 ); - mthdIL->Emit( OpCodes::Ldfld, yField ); - mthdIL->Emit( OpCodes::Ldarg_1 ); - mthdIL->Emit( OpCodes::Ldfld, yField ); - mthdIL->Emit( OpCodes::Mul_Ovf_Un ); - - // At this time, the results of both multiplications should be atop - // the stack. You'll now add them and push the result onto the stack. - mthdIL->Emit( OpCodes::Add_Ovf_Un ); - - // Multiply both "z" field and push the result onto the stack. - mthdIL->Emit( OpCodes::Ldarg_0 ); - mthdIL->Emit( OpCodes::Ldfld, zField ); - mthdIL->Emit( OpCodes::Ldarg_1 ); - mthdIL->Emit( OpCodes::Ldfld, zField ); - mthdIL->Emit( OpCodes::Mul_Ovf_Un ); - - // Finally, add the result of multiplying the "z" fields with the - // result of the earlier addition, and push the result - the dot product - - // onto the stack. - mthdIL->Emit( OpCodes::Add_Ovf_Un ); - - // The "ret" opcode will pop the last value from the stack and return it - // to the calling method. You're all done! - mthdIL->Emit( OpCodes::Ret ); - ivType = ivTypeBld->CreateType(); - return ivType; -} - -int main() -{ - Type^ IVType = nullptr; - Object^ aVector1 = nullptr; - Object^ aVector2 = nullptr; - array^temp2 = {int::typeid,int::typeid,int::typeid}; - array^aVtypes = temp2; - array^temp3 = {10,10,10}; - array^aVargs1 = temp3; - array^temp4 = {20,20,20}; - array^aVargs2 = temp4; - - // Call the method to build our dynamic class. - IVType = DynamicDotProductGen(); - Console::WriteLine( "---" ); - ConstructorInfo^ myDTctor = IVType->GetConstructor( aVtypes ); - aVector1 = myDTctor->Invoke( aVargs1 ); - aVector2 = myDTctor->Invoke( aVargs2 ); - array^passMe = gcnew array(1); - passMe[ 0 ] = dynamic_cast(aVector2); - Console::WriteLine( "(10, 10, 10) . (20, 20, 20) = {0}", IVType->InvokeMember( "DotProduct", BindingFlags::InvokeMethod, nullptr, aVector1, passMe ) ); -} - -// +++ OUTPUT +++ -// --- -// (10, 10, 10) . (20, 20, 20) = 600 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp deleted file mode 100644 index 210c6ee6489..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -ref class AsmBuilderGetFileDemo -{ -public: - static String^ myResourceFileName = "MyResource.txt"; - static FileInfo^ CreateResourceFile() - { - FileInfo^ f = gcnew FileInfo( myResourceFileName ); - StreamWriter^ sw = f->CreateText(); - sw->WriteLine( "Hello, world!" ); - sw->Close(); - return f; - } - - static AssemblyBuilder^ BuildDynAssembly() - { - String^ myAsmFileName = "MyAsm.dll"; - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - myAsmBuilder->AddResourceFile( "MyResource", myResourceFileName ); - - // To confirm that the resource file has been added to the manifest, - // we will save the assembly as MyAsm.dll. You can view the manifest - // and confirm the presence of the resource file by running - // "ildasm MyAsm.dll" from the prompt in the directory where you executed - // the compiled code. - myAsmBuilder->Save( myAsmFileName ); - return myAsmBuilder; - } - -}; - -int main() -{ - FileStream^ myResourceFS = nullptr; - AsmBuilderGetFileDemo::CreateResourceFile(); - Console::WriteLine( "The contents of MyResource.txt, via GetFile:" ); - AssemblyBuilder^ myAsm = AsmBuilderGetFileDemo::BuildDynAssembly(); - try - { - myResourceFS = myAsm->GetFile( AsmBuilderGetFileDemo::myResourceFileName ); - } - catch ( NotSupportedException^ ) - { - Console::WriteLine( "---" ); - Console::WriteLine( "System::Reflection::Emit::AssemblyBuilder::GetFile\nis not supported in this SDK build." ); - Console::WriteLine( "The file data will now be retrieved directly, via a new FileStream." ); - Console::WriteLine( "---" ); - myResourceFS = gcnew FileStream( AsmBuilderGetFileDemo::myResourceFileName,FileMode::Open ); - } - - StreamReader^ sr = gcnew StreamReader( myResourceFS,System::Text::Encoding::ASCII ); - Console::WriteLine( sr->ReadToEnd() ); - sr->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp deleted file mode 100644 index 90c18c11fa1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -class TypeBuilderMemberDemo -{ -public: - static void DefineDynamicModuleDemo1() - { - // - AppDomain^ myAppDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyAssembly"; - AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( - myAsmName, AssemblyBuilderAccess::Run ); - - // Create a transient dynamic module. Since no DLL name is specified with - // this constructor, it cannot be saved. - ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( "MyModule1" ); - // - } - - static void DefineDynamicModuleDemo2() - { - // - AppDomain^ myAppDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyAssembly"; - AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( - myAsmName, AssemblyBuilderAccess::Run ); - - // Create a transient dynamic module. Since no DLL name is specified with - // this constructor, it can not be saved. By specifying the second parameter - // of the constructor as false, we can suppress the emission of symbol info. - ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( - "MyModule2", false ); - // - } - - static void DefineDynamicModuleDemo3() - { - // - AppDomain^ myAppDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyAssembly"; - AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( - myAsmName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module that can be saved as the specified DLL name. - ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( - "MyModule3", "MyModule3.dll" ); - // - } - - static void DefineDynamicModuleDemo4() - { - // - AppDomain^ myAppDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyAssembly"; - AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( - myAsmName, AssemblyBuilderAccess::Run ); - - // Create a dynamic module that can be saved as the specified DLL name. By - // specifying the third parameter as true, we can allow the emission of symbol info. - ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( - "MyModule4", "MyModule4.dll", true ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp deleted file mode 100644 index 7ecadcfc345..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp +++ /dev/null @@ -1,236 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// The Point class is the class we will reflect on and copy into our -// dynamic assembly. The public static function PointMain() will be used -// as our entry point. -// -// We are constructing the type seen here dynamically, and will write it -// out into a .exe file for later execution from the command-line. -// --- -// __gc class Point { -// -// private: -// int x; -// int y; -// -// public: -// Point(int ix, int iy) { -// -// this->x = ix; -// this->y = iy; -// -// } -// -// int DotProduct (Point* p) { -// -// return ((this->x * p->x) + (this->y * p->y)); -// -// } -// -// static void PointMain() { -// -// Console::Write(S"Enter the 'x' value for point 1: "); -// int x1 = Convert::ToInt32(Console::ReadLine()); -// -// Console::Write(S"Enter the 'y' value for point 1: "); -// int y1 = Convert::ToInt32(Console::ReadLine()); -// -// Console::Write(S"Enter the 'x' value for point 2: "); -// int x2 = Convert::ToInt32(Console::ReadLine()); -// -// Console::Write(S"Enter the 'y' value for point 2: "); -// int y2 = Convert::ToInt32(Console::ReadLine()); -// -// Point* p1 = new Point(x1, y1); -// Point* p2 = new Point(x2, y2); -// -// Console::WriteLine(S"( {0}, {1}) . ( {2}, {3}) = {4}.", -// __box(x1), __box(y1), __box(x2), __box(y2), p1->DotProduct(p2)); -// -// } -// -// }; -// --- -Type^ BuildDynAssembly() -{ - Type^ pointType = nullptr; - AppDomain^ currentDom = Thread::GetDomain(); - Console::Write( "Please enter a name for your new assembly: " ); - StringBuilder^ asmFileNameBldr = gcnew StringBuilder; - asmFileNameBldr->Append( Console::ReadLine() ); - asmFileNameBldr->Append( ".exe" ); - String^ asmFileName = asmFileNameBldr->ToString(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBldr = currentDom->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - - // We've created a dynamic assembly space - now, we need to create a module - // within it to reflect the type Point into. - ModuleBuilder^ myModuleBldr = myAsmBldr->DefineDynamicModule( asmFileName, asmFileName ); - TypeBuilder^ myTypeBldr = myModuleBldr->DefineType( "Point" ); - FieldBuilder^ xField = myTypeBldr->DefineField( "x", int::typeid, FieldAttributes::Private ); - FieldBuilder^ yField = myTypeBldr->DefineField( "y", int::typeid, FieldAttributes::Private ); - - // Build the constructor. - Type^ objType = Type::GetType( "System.Object" ); - ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); - array^temp4 = {int::typeid,int::typeid}; - array^ctorParams = temp4; - ConstructorBuilder^ pointCtor = myTypeBldr->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); - ILGenerator^ ctorIL = pointCtor->GetILGenerator(); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Call, objCtor ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_1 ); - ctorIL->Emit( OpCodes::Stfld, xField ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_2 ); - ctorIL->Emit( OpCodes::Stfld, yField ); - ctorIL->Emit( OpCodes::Ret ); - - // Build the DotProduct method. - Console::WriteLine( "Constructor built." ); - array^temp0 = {myTypeBldr}; - MethodBuilder^ pointDPBldr = myTypeBldr->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, temp0 ); - ILGenerator^ dpIL = pointDPBldr->GetILGenerator(); - dpIL->Emit( OpCodes::Ldarg_0 ); - dpIL->Emit( OpCodes::Ldfld, xField ); - dpIL->Emit( OpCodes::Ldarg_1 ); - dpIL->Emit( OpCodes::Ldfld, xField ); - dpIL->Emit( OpCodes::Mul_Ovf_Un ); - dpIL->Emit( OpCodes::Ldarg_0 ); - dpIL->Emit( OpCodes::Ldfld, yField ); - dpIL->Emit( OpCodes::Ldarg_1 ); - dpIL->Emit( OpCodes::Ldfld, yField ); - dpIL->Emit( OpCodes::Mul_Ovf_Un ); - dpIL->Emit( OpCodes::Add_Ovf_Un ); - dpIL->Emit( OpCodes::Ret ); - - // Build the PointMain method. - Console::WriteLine( "DotProduct built." ); - MethodBuilder^ pointMainBldr = myTypeBldr->DefineMethod( "PointMain", static_cast(MethodAttributes::Public | MethodAttributes::Static), void::typeid, nullptr ); - pointMainBldr->InitLocals = true; - ILGenerator^ pmIL = pointMainBldr->GetILGenerator(); - - // We have four methods that we wish to call, and must represent as - // MethodInfo tokens: - // - void Console::WriteLine(String*) - // - String* Console::ReadLine() - // - int Convert::Int32(String*) - // - void Console::WriteLine(String*, Object*[]) - array^temp1 = {String::typeid}; - MethodInfo^ writeMI = Console::typeid->GetMethod( "Write", temp1 ); - MethodInfo^ readLineMI = Console::typeid->GetMethod( "ReadLine", gcnew array(0) ); - array^temp2 = {String::typeid}; - MethodInfo^ convertInt32MI = Convert::typeid->GetMethod( "ToInt32", temp2 ); - array^temp5 = {String::typeid,array::typeid}; - array^wlParams = temp5; - MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", wlParams ); - - // Although we could just refer to the local variables by - // index (short ints for Ldloc/Stloc, bytes for LdLoc_S/Stloc_S), - // this time, we'll use LocalBuilders for clarity and to - // demonstrate their usage and syntax. - LocalBuilder^ x1LB = pmIL->DeclareLocal( int::typeid ); - LocalBuilder^ y1LB = pmIL->DeclareLocal( int::typeid ); - LocalBuilder^ x2LB = pmIL->DeclareLocal( int::typeid ); - LocalBuilder^ y2LB = pmIL->DeclareLocal( int::typeid ); - LocalBuilder^ point1LB = pmIL->DeclareLocal( myTypeBldr ); - LocalBuilder^ point2LB = pmIL->DeclareLocal( myTypeBldr ); - LocalBuilder^ tempObjArrLB = pmIL->DeclareLocal( array::typeid ); - pmIL->Emit( OpCodes::Ldstr, "Enter the 'x' value for point 1: " ); - pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); - pmIL->Emit( OpCodes::Stloc, x1LB ); - pmIL->Emit( OpCodes::Ldstr, "Enter the 'y' value for point 1: " ); - pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); - pmIL->Emit( OpCodes::Stloc, y1LB ); - pmIL->Emit( OpCodes::Ldstr, "Enter the 'x' value for point 2: " ); - pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); - pmIL->Emit( OpCodes::Stloc, x2LB ); - pmIL->Emit( OpCodes::Ldstr, "Enter the 'y' value for point 2: " ); - pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); - pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); - pmIL->Emit( OpCodes::Stloc, y2LB ); - pmIL->Emit( OpCodes::Ldloc, x1LB ); - pmIL->Emit( OpCodes::Ldloc, y1LB ); - pmIL->Emit( OpCodes::Newobj, pointCtor ); - pmIL->Emit( OpCodes::Stloc, point1LB ); - pmIL->Emit( OpCodes::Ldloc, x2LB ); - pmIL->Emit( OpCodes::Ldloc, y2LB ); - pmIL->Emit( OpCodes::Newobj, pointCtor ); - pmIL->Emit( OpCodes::Stloc, point2LB ); - pmIL->Emit( OpCodes::Ldstr, "( {0}, {1}) . ( {2}, {3}) = {4}." ); - pmIL->Emit( OpCodes::Ldc_I4_5 ); - pmIL->Emit( OpCodes::Newarr, Object::typeid ); - pmIL->Emit( OpCodes::Stloc, tempObjArrLB ); - pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); - pmIL->Emit( OpCodes::Ldc_I4_0 ); - pmIL->Emit( OpCodes::Ldloc, x1LB ); - pmIL->Emit( OpCodes::Box, int::typeid ); - pmIL->Emit( OpCodes::Stelem_Ref ); - pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); - pmIL->Emit( OpCodes::Ldc_I4_1 ); - pmIL->Emit( OpCodes::Ldloc, y1LB ); - pmIL->Emit( OpCodes::Box, int::typeid ); - pmIL->Emit( OpCodes::Stelem_Ref ); - pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); - pmIL->Emit( OpCodes::Ldc_I4_2 ); - pmIL->Emit( OpCodes::Ldloc, x2LB ); - pmIL->Emit( OpCodes::Box, int::typeid ); - pmIL->Emit( OpCodes::Stelem_Ref ); - pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); - pmIL->Emit( OpCodes::Ldc_I4_3 ); - pmIL->Emit( OpCodes::Ldloc, y2LB ); - pmIL->Emit( OpCodes::Box, int::typeid ); - pmIL->Emit( OpCodes::Stelem_Ref ); - pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); - pmIL->Emit( OpCodes::Ldc_I4_4 ); - pmIL->Emit( OpCodes::Ldloc, point1LB ); - pmIL->Emit( OpCodes::Ldloc, point2LB ); - pmIL->EmitCall( OpCodes::Callvirt, pointDPBldr, nullptr ); - pmIL->Emit( OpCodes::Box, int::typeid ); - pmIL->Emit( OpCodes::Stelem_Ref ); - pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); - pmIL->EmitCall( OpCodes::Call, writeLineMI, nullptr ); - pmIL->Emit( OpCodes::Ret ); - Console::WriteLine( "PointMain (entry point) built." ); - pointType = myTypeBldr->CreateType(); - Console::WriteLine( "Type completed." ); - myAsmBldr->SetEntryPoint( pointMainBldr ); - myAsmBldr->Save( asmFileName ); - Console::WriteLine( "Assembly saved as ' {0}'.", asmFileName ); - Console::WriteLine( "Type ' {0}' at the prompt to run your new dynamically generated dot product calculator.", asmFileName ); - - // After execution, this program will have generated and written to disk, - // in the directory you executed it from, a program named - // .exe. You can run it by typing - // the name you gave it during execution, in the same directory where - // you executed this program. - return pointType; -} - -int main() -{ - Type^ myType = BuildDynAssembly(); - Console::WriteLine( "---" ); - - // Let's invoke the type 'Point' created in our dynamic assembly. - array^temp3 = {nullptr,nullptr}; - Object^ ptInstance = Activator::CreateInstance( myType, temp3 ); - myType->InvokeMember( "PointMain", BindingFlags::InvokeMethod, nullptr, ptInstance, gcnew array(0) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp deleted file mode 100644 index 5fc4617dce5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ DynamicPointTypeGen() -{ - Type^ pointType = nullptr; - array^temp0 = {int::typeid,int::typeid,int::typeid}; - array^ctorParams = temp0; - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ pointModule = myAsmBuilder->DefineDynamicModule( "PointModule", "Point.dll" ); - TypeBuilder^ pointTypeBld = pointModule->DefineType( "Point", TypeAttributes::Public ); - FieldBuilder^ xField = pointTypeBld->DefineField( "x", int::typeid, FieldAttributes::Public ); - FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public ); - FieldBuilder^ zField = pointTypeBld->DefineField( "z", int::typeid, FieldAttributes::Public ); - Type^ objType = Type::GetType( "System.Object" ); - ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); - ConstructorBuilder^ pointCtor = pointTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); - ILGenerator^ ctorIL = pointCtor->GetILGenerator(); - - // NOTE: ldarg.0 holds the "this" reference - ldarg.1, ldarg.2, and ldarg.3 - // hold the actual passed parameters. ldarg.0 is used by instance methods - // to hold a reference to the current calling bject instance. Static methods - // do not use arg.0, since they are not instantiated and hence no reference - // is needed to distinguish them. - ctorIL->Emit( OpCodes::Ldarg_0 ); - - // Here, we wish to create an instance of System::Object by invoking its - // constructor, as specified above. - ctorIL->Emit( OpCodes::Call, objCtor ); - - // Now, we'll load the current instance in arg 0, along - // with the value of parameter "x" stored in arg 1, into stfld. - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_1 ); - ctorIL->Emit( OpCodes::Stfld, xField ); - - // Now, we store arg 2 "y" in the current instance with stfld. - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_2 ); - ctorIL->Emit( OpCodes::Stfld, yField ); - - // Last of all, arg 3 "z" gets stored in the current instance. - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_3 ); - ctorIL->Emit( OpCodes::Stfld, zField ); - - // Our work complete, we return. - ctorIL->Emit( OpCodes::Ret ); - - // Now, let's create three very simple methods so we can see our fields. - array^temp1 = {"GetX","GetY","GetZ"}; - array^mthdNames = temp1; - System::Collections::IEnumerator^ myEnum = mthdNames->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ mthdName = safe_cast(myEnum->Current); - MethodBuilder^ getFieldMthd = pointTypeBld->DefineMethod( mthdName, MethodAttributes::Public, int::typeid, nullptr ); - ILGenerator^ mthdIL = getFieldMthd->GetILGenerator(); - mthdIL->Emit( OpCodes::Ldarg_0 ); - if ( mthdName->Equals( "GetX" ) ) - mthdIL->Emit( OpCodes::Ldfld, xField ); - else - if ( mthdName->Equals( "GetY" ) ) - mthdIL->Emit( OpCodes::Ldfld, yField ); - else - if ( mthdName->Equals( "GetZ" ) ) - mthdIL->Emit( OpCodes::Ldfld, zField ); - - - - mthdIL->Emit( OpCodes::Ret ); - } - - pointType = pointTypeBld->CreateType(); - - // Let's save it, just for posterity. - myAsmBuilder->Save( "Point.dll" ); - return pointType; -} - -int main() -{ - Type^ myDynamicType = nullptr; - Object^ aPoint = nullptr; - array^temp2 = {int::typeid,int::typeid,int::typeid}; - array^aPtypes = temp2; - array^temp3 = {4,5,6}; - array^aPargs = temp3; - - // Call the method to build our dynamic class. - myDynamicType = DynamicPointTypeGen(); - Console::WriteLine( "Some information about my new Type '{0}':", myDynamicType->FullName ); - Console::WriteLine( "Assembly: '{0}'", myDynamicType->Assembly ); - Console::WriteLine( "Attributes: '{0}'", myDynamicType->Attributes ); - Console::WriteLine( "Module: '{0}'", myDynamicType->Module ); - Console::WriteLine( "Members: " ); - System::Collections::IEnumerator^ myEnum = myDynamicType->GetMembers()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MemberInfo^ member = safe_cast(myEnum->Current); - Console::WriteLine( "-- {0} {1};", member->MemberType, member->Name ); - } - - Console::WriteLine( "---" ); - - // Let's take a look at the constructor we created. - ConstructorInfo^ myDTctor = myDynamicType->GetConstructor( aPtypes ); - Console::WriteLine( "Constructor: {0};", myDTctor ); - Console::WriteLine( "---" ); - - // Now, we get to use our dynamically-created class by invoking the constructor. - aPoint = myDTctor->Invoke( aPargs ); - Console::WriteLine( "aPoint is type {0}.", aPoint->GetType() ); - - // Finally, let's reflect on the instance of our new type - aPoint - and - // make sure everything proceeded according to plan. - Console::WriteLine( "aPoint.x = {0}", myDynamicType->InvokeMember( "GetX", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) ); - Console::WriteLine( "aPoint.y = {0}", myDynamicType->InvokeMember( "GetY", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) ); - Console::WriteLine( "aPoint.z = {0}", myDynamicType->InvokeMember( "GetZ", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) ); - - // +++ OUTPUT +++ - // Some information about my new Type 'Point': - // Assembly: 'MyDynamicAssembly, Version=0.0.0.0' - // Attributes: 'AutoLayout, AnsiClass, NotPublic, Public' - // Module: 'PointModule' - // Members: - // -- Field x; - // -- Field y; - // -- Field z; - // -- Method GetHashCode; - // -- Method Equals; - // -- Method ToString; - // -- Method GetType; - // -- Constructor .ctor; - // --- - // Constructor: Void .ctor(Int32, Int32, Int32); - // --- - // aPoint is type Point. - // aPoint.x = 4 - // aPoint.y = 5 - // aPoint.z = 6 -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp deleted file mode 100644 index 0529bd4ec8c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp +++ /dev/null @@ -1,118 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// We will apply this custom attribute to our dynamic type. -public ref class ClassCreator: public Attribute -{ -private: - String^ creator; - -public: - - property String^ Creator - { - String^ get() - { - return creator; - } - - } - ClassCreator( String^ name ) - { - this->creator = name; - } - -}; - - -// We will apply this dynamic attribute to our dynamic method. -public ref class DateLastUpdated: public Attribute -{ -private: - String^ dateUpdated; - -public: - - property String^ DateUpdated - { - String^ get() - { - return dateUpdated; - } - - } - DateLastUpdated( String^ theDate ) - { - this->dateUpdated = theDate; - } - -}; - -Type^ BuildTypeWithCustomAttributesOnMethod() -{ - AppDomain^ currentDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyAssembly"; - AssemblyBuilder^ myAsmBuilder = currentDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); - ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyModule" ); - - // First, we'll build a type with a custom attribute attached. - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyType", TypeAttributes::Public ); - array^temp6 = {String::typeid}; - array^ctorParams = temp6; - ConstructorInfo^ classCtorInfo = ClassCreator::typeid->GetConstructor( ctorParams ); - array^temp0 = {"Joe Programmer"}; - CustomAttributeBuilder^ myCABuilder = gcnew CustomAttributeBuilder( classCtorInfo,temp0 ); - myTypeBuilder->SetCustomAttribute( myCABuilder ); - - // Now, let's build a method and add a custom attribute to it. - array^temp1 = gcnew array(0); - MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, temp1 ); - array^temp7 = {String::typeid}; - ctorParams = temp7; - classCtorInfo = DateLastUpdated::typeid->GetConstructor( ctorParams ); - array^temp2 = {DateTime::Now.ToString()}; - CustomAttributeBuilder^ myCABuilder2 = gcnew CustomAttributeBuilder( classCtorInfo,temp2 ); - myMethodBuilder->SetCustomAttribute( myCABuilder2 ); - ILGenerator^ myIL = myMethodBuilder->GetILGenerator(); - myIL->EmitWriteLine( "Hello, world!" ); - myIL->Emit( OpCodes::Ret ); - return myTypeBuilder->CreateType(); -} - -int main() -{ - Type^ myType = BuildTypeWithCustomAttributesOnMethod(); - Object^ myInstance = Activator::CreateInstance( myType ); - array^customAttrs = myType->GetCustomAttributes( true ); - Console::WriteLine( "Custom Attributes for Type 'MyType':" ); - Object^ attrVal = nullptr; - System::Collections::IEnumerator^ myEnum = customAttrs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ customAttr = safe_cast(myEnum->Current); - array^temp3 = gcnew array(0); - attrVal = ClassCreator::typeid->InvokeMember( "Creator", BindingFlags::GetProperty, nullptr, customAttr, temp3 ); - Console::WriteLine( "-- Attribute: [{0} = \"{1}\"]", customAttr, attrVal ); - } - - Console::WriteLine( "Custom Attributes for Method 'HelloWorld()' in 'MyType':" ); - customAttrs = myType->GetMember( "HelloWorld" )[ 0 ]->GetCustomAttributes( true ); - System::Collections::IEnumerator^ myEnum2 = customAttrs->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - Object^ customAttr = safe_cast(myEnum2->Current); - array^temp4 = gcnew array(0); - attrVal = DateLastUpdated::typeid->InvokeMember( "DateUpdated", BindingFlags::GetProperty, nullptr, customAttr, temp4 ); - Console::WriteLine( "-- Attribute: [{0} = \"{1}\"]", customAttr, attrVal ); - } - - Console::WriteLine( "---" ); - array^temp5 = gcnew array(0); - Console::WriteLine( myType->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, nullptr, myInstance, temp5 ) ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp deleted file mode 100644 index 2c62a49f16a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp +++ /dev/null @@ -1,89 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ BuildMyType() -{ - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); - ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyJumpTableDemo" ); - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "JumpTableDemo", TypeAttributes::Public ); - array^temp0 = {int::typeid}; - MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "SwitchMe", static_cast(MethodAttributes::Public | MethodAttributes::Static), String::typeid, temp0 ); - ILGenerator^ myIL = myMthdBuilder->GetILGenerator(); - Label defaultCase = myIL->DefineLabel(); - Label endOfMethod = myIL->DefineLabel(); - - // We are initializing our jump table. Note that the labels - // will be placed later using the MarkLabel method. - array diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp deleted file mode 100644 index 06f186f7b7b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -class MyDynamicAssembly -{ -public: - static void BuildDynamicMethod( TypeBuilder^ myTypeBuilder, - array^ mthdParamTypes, - Type^ returnType, - int addrOfLegacyNumberObject ) - { - // - MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod", - MethodAttributes::Public, - returnType, mthdParamTypes ); - - // We will assume that an external unmanaged type "LegacyNumber" has been loaded, and - // that it has a method "ToString" which returns a String. - - MethodInfo^ unmanagedMthdMI = Type::GetType( "LegacyNumber" )->GetMethod( "ToString" ); - ILGenerator^ myMthdIL = myMthdBuilder->GetILGenerator(); - - // Code to emit various IL opcodes here ... - - // Load a reference to the specific Object instance onto the stack. - - myMthdIL->Emit( OpCodes::Ldc_I4, addrOfLegacyNumberObject ); - myMthdIL->Emit( OpCodes::Ldobj, Type::GetType( "LegacyNumber" ) ); - - // Make the call to the unmanaged type method, telling it that the method is - // the member of a specific instance, to expect a String - // as a return value, and that there are no explicit parameters. - myMthdIL->EmitCalli( OpCodes::Calli, - System::Runtime::InteropServices::CallingConvention::ThisCall, - String::typeid, - gcnew array( 0 ) ); - - // More IL code emission here ... - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp deleted file mode 100644 index cc26ae7bb54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp +++ /dev/null @@ -1,116 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ CreateDynamicType() -{ - array^ctorParams = {int::typeid,int::typeid}; - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); - ModuleBuilder^ pointModule = myAsmBuilder->DefineDynamicModule( "PointModule", "Point.dll" ); - TypeBuilder^ pointTypeBld = pointModule->DefineType( "Point", TypeAttributes::Public ); - FieldBuilder^ xField = pointTypeBld->DefineField( "x", int::typeid, FieldAttributes::Public ); - FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public ); - Type^ objType = Type::GetType( "System.Object" ); - ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); - ConstructorBuilder^ pointCtor = pointTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); - ILGenerator^ ctorIL = pointCtor->GetILGenerator(); - - // First, you build the constructor. - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Call, objCtor ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_1 ); - ctorIL->Emit( OpCodes::Stfld, xField ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_2 ); - ctorIL->Emit( OpCodes::Stfld, yField ); - ctorIL->Emit( OpCodes::Ret ); - - // Now, you'll build a method to output some information on the - // inside your dynamic class. This method will have the following - // definition in C#: - // public void WritePoint() - MethodBuilder^ writeStrMthd = pointTypeBld->DefineMethod( "WritePoint", MethodAttributes::Public, void::typeid, nullptr ); - ILGenerator^ writeStrIL = writeStrMthd->GetILGenerator(); - - // The below ILGenerator created demonstrates a few ways to create - // String* output through STDIN. - // ILGenerator::EmitWriteLine(String*) will generate a ldstr and a - // call to WriteLine for you. - writeStrIL->EmitWriteLine( "The value of this current instance is:" ); - - // Here, you will do the hard work yourself. First, you need to create - // the String* we will be passing and obtain the correct WriteLine overload - // for said String*. In the below case, you are substituting in two values, - // so the chosen overload is Console::WriteLine(String*, Object*, Object*). - String^ inStr = "( {0}, {1})"; - array^wlParams = {String::typeid,Object::typeid,Object::typeid}; - - // We need the MethodInfo to pass into EmitCall later. - MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", wlParams ); - - // Push the String* with the substitutions onto the stack. - // This is the first argument for WriteLine - the String* one. - writeStrIL->Emit( OpCodes::Ldstr, inStr ); - - // Since the second argument is an Object*, and it corresponds to - // to the substitution for the value of our integer field, you - // need to box that field to an Object*. First, push a reference - // to the current instance, and then push the value stored in - // field 'x'. We need the reference to the current instance (stored - // in local argument index 0) so Ldfld can load from the correct - // instance (this one). - writeStrIL->Emit( OpCodes::Ldarg_0 ); - writeStrIL->Emit( OpCodes::Ldfld, xField ); - - // Now, we execute the box opcode, which pops the value of field 'x', - // returning a reference to the integer value boxed as an Object*. - writeStrIL->Emit( OpCodes::Box, int::typeid ); - - // Atop the stack, you'll find our String* inStr, followed by a reference - // to the boxed value of 'x'. Now, you need to likewise box field 'y'. - writeStrIL->Emit( OpCodes::Ldarg_0 ); - writeStrIL->Emit( OpCodes::Ldfld, yField ); - writeStrIL->Emit( OpCodes::Box, int::typeid ); - - // Now, you have all of the arguments for your call to - // Console::WriteLine(String*, Object*, Object*) atop the stack: - // the String* InStr, a reference to the boxed value of 'x', and - // a reference to the boxed value of 'y'. - // Call Console::WriteLine(String*, Object*, Object*) with EmitCall. - writeStrIL->EmitCall( OpCodes::Call, writeLineMI, nullptr ); - - // Lastly, EmitWriteLine can also output the value of a field - // using the overload EmitWriteLine(FieldInfo). - writeStrIL->EmitWriteLine( "The value of 'x' is:" ); - writeStrIL->EmitWriteLine( xField ); - writeStrIL->EmitWriteLine( "The value of 'y' is:" ); - writeStrIL->EmitWriteLine( yField ); - - // Since we return no value (void), the ret opcode will not - // return the top stack value. - writeStrIL->Emit( OpCodes::Ret ); - return pointTypeBld->CreateType(); -} - -int main() -{ - array^ctorParams = gcnew array(2); - Console::Write( "Enter a integer value for X: " ); - String^ myX = Console::ReadLine(); - Console::Write( "Enter a integer value for Y: " ); - String^ myY = Console::ReadLine(); - Console::WriteLine( "---" ); - ctorParams[ 0 ] = Convert::ToInt32( myX ); - ctorParams[ 1 ] = Convert::ToInt32( myY ); - Type^ ptType = CreateDynamicType(); - Object^ ptInstance = Activator::CreateInstance( ptType, ctorParams ); - ptType->InvokeMember( "WritePoint", BindingFlags::InvokeMethod, nullptr, ptInstance, gcnew array(0) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp deleted file mode 100644 index a8bc130aeb6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp +++ /dev/null @@ -1,159 +0,0 @@ -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -int main() -{ - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "AdderExceptionAsm"; - AssemblyBuilder^ myAsmBldr = myDomain->DefineDynamicAssembly( myAsmName, - AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ myModBldr = myAsmBldr->DefineDynamicModule( myAsmName->Name, - myAsmName->Name + ".dll" ); - TypeBuilder^ myTypeBldr = myModBldr->DefineType( "Adder" ); - array^adderParams = {int::typeid,int::typeid}; - - // This method will add two numbers which are 100 or less. If either of the - // passed integer vales are greater than 100, it will throw an exception. - MethodBuilder^ adderBldr = myTypeBldr->DefineMethod( "DoAdd", - static_cast(MethodAttributes::Public | MethodAttributes::Static), - int::typeid, adderParams ); - ILGenerator^ adderIL = adderBldr->GetILGenerator(); - - // Types and methods used in the code to throw, catch, and - // display OverflowException. Note that if the catch block were - // for a more general type, such as Exception, we would need - // a MethodInfo for that type's ToString method. - // - Type^ overflow = OverflowException::typeid; - ConstructorInfo^ exCtorInfo = overflow->GetConstructor( - gcnew array { String::typeid }); - MethodInfo^ exToStrMI = overflow->GetMethod( "ToString" ); - MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", - gcnew array { String::typeid, Object::typeid } ); - - LocalBuilder^ tmp1 = adderIL->DeclareLocal( int::typeid ); - LocalBuilder^ tmp2 = adderIL->DeclareLocal( overflow ); - - // In order to successfully branch, we need to create labels - // representing the offset IL instruction block to branch to. - // These labels, when the MarkLabel(Label) method is invoked, - // will specify the IL instruction to branch to. - // - Label failed = adderIL->DefineLabel(); - Label endOfMthd = adderIL->DefineLabel(); - - // Begin the try block. - Label exBlock = adderIL->BeginExceptionBlock(); - - // First, load argument 0 and the integer value of S"100" onto the - // stack. If arg0 > 100, branch to the label S"failed", which is marked - // as the address of the block that throws an exception. - adderIL->Emit( OpCodes::Ldarg_0 ); - adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); - adderIL->Emit( OpCodes::Bgt_S, failed ); - - // Now, check to see if argument 1 was greater than 100. If it was, - // branch to S"failed." Otherwise, fall through and perform the addition, - // branching unconditionally to the instruction at the label S"endOfMthd". - adderIL->Emit( OpCodes::Ldarg_1 ); - adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); - adderIL->Emit( OpCodes::Bgt_S, failed ); - - adderIL->Emit( OpCodes::Ldarg_0 ); - adderIL->Emit( OpCodes::Ldarg_1 ); - adderIL->Emit( OpCodes::Add_Ovf_Un ); - // Store the result of the addition. - adderIL->Emit( OpCodes::Stloc_S, tmp1 ); - adderIL->Emit( OpCodes::Br_S, endOfMthd ); - - // If one of the arguments was greater than 100, we need to throw an - // exception. We'll use "OverflowException" with a customized message. - // First, we load our message onto the stack, and then create a new - // exception Object using the constructor overload that accepts a - // String* message. - adderIL->MarkLabel( failed ); - adderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 100 for add." ); - adderIL->Emit( OpCodes::Newobj, exCtorInfo ); - - // We're going to need to refer to that exception Object later, so let's - // store it in a temporary variable. Since the store function pops the - // the value/reference off the stack, and we'll need it to throw the - // exception, we will subsequently load it back onto the stack as well. - adderIL->Emit( OpCodes::Stloc_S, tmp2 ); - adderIL->Emit( OpCodes::Ldloc_S, tmp2 ); - - // Throw the exception now on the stack. - adderIL->ThrowException( overflow ); - - // Start the catch block for OverflowException. - // - adderIL->BeginCatchBlock( overflow ); - - // When we enter the catch block, the thrown exception - // is on the stack. Store it, then load the format string - // for WriteLine. - // - adderIL->Emit(OpCodes::Stloc_S, tmp2); - adderIL->Emit(OpCodes::Ldstr, "Caught {0}"); - - // Push the thrown exception back on the stack, then - // call its ToString() method. Note that if this catch block - // were for a more general exception type, like Exception, - // it would be necessary to use the ToString for that type. - // - adderIL->Emit(OpCodes::Ldloc_S, tmp2); - adderIL->EmitCall(OpCodes::Callvirt, exToStrMI, nullptr); - - // The format string and the return value from ToString() are - // now on the stack. Call WriteLine(string, object). - // - adderIL->EmitCall( OpCodes::Call, writeLineMI, nullptr ); - - // Since our function has to return an integer value, we'll load -1 onto - // the stack to indicate an error, and store it in local variable tmp1. - adderIL->Emit( OpCodes::Ldc_I4_M1 ); - adderIL->Emit( OpCodes::Stloc_S, tmp1 ); - - // End the exception handling block. - adderIL->EndExceptionBlock(); - - // The end of the method. If no exception was thrown, the correct value - // will be saved in tmp1. If an exception was thrown, tmp1 will be equal - // to -1. Either way, we'll load the value of tmp1 onto the stack and return. - adderIL->MarkLabel( endOfMthd ); - adderIL->Emit( OpCodes::Ldloc_S, tmp1 ); - adderIL->Emit( OpCodes::Ret ); - - Type^ adderType = myTypeBldr->CreateType(); - - Object^ addIns = Activator::CreateInstance( adderType ); - - array^addParams = gcnew array(2); - - Console::Write( "Enter an integer value: " ); - addParams[ 0 ] = Convert::ToInt32( Console::ReadLine() ); - - Console::Write( "Enter another integer value: " ); - addParams[ 1 ] = Convert::ToInt32( Console::ReadLine() ); - - Console::WriteLine( "If either integer was > 100, an exception will be thrown." ); - - Console::WriteLine( "---" ); - Console::WriteLine( " {0} + {1} = {2}", addParams[ 0 ], addParams[ 1 ], adderType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, addIns, addParams ) ); -} - -/* This code produces output similar to the following: - -Enter an integer value: 24 -Enter another integer value: 101 -If either integer was > 100, an exception will be thrown. ---- -Caught System.OverflowException: Arithmetic operation resulted in an overflow. - at Adder.DoAdd(Int32 , Int32 ) - 24 + 101 = -1 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp deleted file mode 100644 index 8b29b655e66..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp +++ /dev/null @@ -1,81 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ BuildAdderType() -{ - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "AdderExceptionAsm"; - AssemblyBuilder^ myAsmBldr = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); - ModuleBuilder^ myModBldr = myAsmBldr->DefineDynamicModule( "AdderExceptionMod" ); - TypeBuilder^ myTypeBldr = myModBldr->DefineType( "Adder" ); - array^adderParams = {int::typeid,int::typeid}; - - // This method will add two numbers which are 100 or less. If either of the - // passed integer vales are greater than 100, it will return the value of -1. - MethodBuilder^ adderBldr = myTypeBldr->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, adderParams ); - ILGenerator^ adderIL = adderBldr->GetILGenerator(); - - // In order to successfully branch, we need to create labels - // representing the offset IL instruction block to branch to. - // These labels, when the MarkLabel(Label) method is invoked, - // will specify the IL instruction to branch to. - Label failed = adderIL->DefineLabel(); - Label endOfMthd = adderIL->DefineLabel(); - - // First, load argument 0 and the integer value of "100" onto the - // stack. If arg0 > 100, branch to the label "failed", which is marked - // as the address of the block that loads -1 onto the stack, bypassing - // the addition. - adderIL->Emit( OpCodes::Ldarg_0 ); - adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); - adderIL->Emit( OpCodes::Bgt_S, failed ); - - // Now, check to see if argument 1 was greater than 100. If it was, - // branch to "failed." Otherwise, fall through and perform the addition, - // branching unconditionally to the instruction at the label "endOfMthd". - adderIL->Emit( OpCodes::Ldarg_1 ); - adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); - adderIL->Emit( OpCodes::Bgt_S, failed ); - adderIL->Emit( OpCodes::Ldarg_0 ); - adderIL->Emit( OpCodes::Ldarg_1 ); - adderIL->Emit( OpCodes::Add_Ovf_Un ); - adderIL->Emit( OpCodes::Br_S, endOfMthd ); - - // If this label is branched to (the failure case), load -1 onto the stack - // and fall through to the return opcode. - adderIL->MarkLabel( failed ); - adderIL->Emit( OpCodes::Ldc_I4_M1 ); - - // The end of the method. If both values were less than 100, the - // correct result will return. If one of the arguments was greater - // than 100, the result will be -1. - adderIL->MarkLabel( endOfMthd ); - adderIL->Emit( OpCodes::Ret ); - return myTypeBldr->CreateType(); -} - -int main() -{ - Type^ adderType = BuildAdderType(); - Object^ addIns = Activator::CreateInstance( adderType ); - array^addParams = gcnew array(2); - Console::Write( "Enter an integer value: " ); - addParams[ 0 ] = Convert::ToInt32( Console::ReadLine() ); - Console::Write( "Enter another integer value: " ); - addParams[ 1 ] = Convert::ToInt32( Console::ReadLine() ); - Console::WriteLine( "---" ); - int adderResult = safe_cast(adderType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, addIns, addParams )); - if ( adderResult != -1 ) - { - Console::WriteLine( " {0} + {1} = {2}", addParams[ 0 ], addParams[ 1 ], adderResult ); - } - else - { - Console::WriteLine( "One of the integers to add was greater than 100!" ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp deleted file mode 100644 index 13c415b9f79..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp +++ /dev/null @@ -1,105 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -void AddMethodDynamically( TypeBuilder^ myTypeBld, - String^ mthdName, - array^ mthdParams, - Type^ returnType, - String^ mthdAction ) -{ - MethodBuilder^ myMthdBld = myTypeBld->DefineMethod( mthdName, static_cast(MethodAttributes::Public | MethodAttributes::Static), returnType, mthdParams ); - ILGenerator^ ILOut = myMthdBld->GetILGenerator(); - int numParams = mthdParams->Length; - for ( Byte x = 0; x < numParams; x++ ) - { - ILOut->Emit( OpCodes::Ldarg_S, x ); - - } - if ( numParams > 1 ) - { - for ( int y = 0; y < (numParams - 1); y++ ) - { - if ( mthdAction->Equals( "A" ) ) - ILOut->Emit( OpCodes::Add ); - else - if ( mthdAction->Equals( "M" ) ) - ILOut->Emit( OpCodes::Mul ); - else - ILOut->Emit( OpCodes::Add ); - - } - } - - ILOut->Emit( OpCodes::Ret ); -}; - -void main() -{ - AppDomain^ myDomain = AppDomain::CurrentDomain; - AssemblyName^ asmName = gcnew AssemblyName; - asmName->Name = "MyDynamicAsm"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( asmName, - AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ myModule = myAsmBuilder->DefineDynamicModule( "MyDynamicAsm", - "MyDynamicAsm.dll" ); - TypeBuilder^ myTypeBld = myModule->DefineType( "MyDynamicType", - TypeAttributes::Public ); - - // Get info from the user to build the method dynamically. - Console::WriteLine( "Let's build a simple method dynamically!" ); - Console::WriteLine( "Please enter a few numbers, separated by spaces." ); - String^ inputNums = Console::ReadLine(); - Console::Write( "Do you want to [A]dd (default) or [M]ultiply these numbers? " ); - String^ myMthdAction = Console::ReadLine()->ToUpper(); - Console::Write( "Lastly, what do you want to name your new dynamic method? " ); - String^ myMthdName = Console::ReadLine(); - - // Process inputNums into an array and create a corresponding Type array - int index = 0; - array^inputNumsList = inputNums->Split(); - array^myMthdParams = gcnew array(inputNumsList->Length); - array^inputValsList = gcnew array(inputNumsList->Length); - for each (String^ inputNum in inputNumsList) - { - inputValsList[ index ] = Convert::ToInt32( inputNum ); - myMthdParams[ index ] = int::typeid; - index++; - } - - - // Now, call the method building method with the parameters, passing the - // TypeBuilder by reference. - AddMethodDynamically( myTypeBld, - myMthdName, - myMthdParams, - int::typeid, - myMthdAction ); - Type^ myType = myTypeBld->CreateType(); - - Console::WriteLine( "---" ); - Console::WriteLine( "The result of {0} the inputted values is: {1}", - ((myMthdAction->Equals( "M" )) ? "multiplying" : "adding"), - myType->InvokeMember( myMthdName, - BindingFlags::InvokeMethod | BindingFlags::Public | BindingFlags::Static, - nullptr, - nullptr, - inputValsList ) ); - Console::WriteLine( "---" ); - - // Let's take a look at the method we created. - // If you are interested in seeing the MSIL generated dynamically for the method - // your program generated, change to the directory where you ran the compiled - // code sample and type "ildasm MyDynamicAsm.dll" at the prompt. When the list - // of manifest contents appears, click on "MyDynamicType" and then on the name of - // of the method you provided during execution. - - myAsmBuilder->Save( "MyDynamicAsm.dll" ); - - MethodInfo^ myMthdInfo = myType->GetMethod( myMthdName ); - Console::WriteLine( "Your Dynamic Method: {0};", myMthdInfo ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp deleted file mode 100644 index e11b9039eea..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -class MyMethodBuilderDemo -{ -public: - static void BuildDynMethod( ModuleBuilder^ myModBuilder ) - { - // - // myModBuilder is an instance of ModuleBuilder. - // Note that for the use of PermissionSet and SecurityAction, - // the namespaces System::Security and System::Security::Permissions - // should be included. - - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyType", - TypeAttributes::Public ); - - array^ temp0 = {int::typeid, int::typeid}; - MethodBuilder^ myMethod1 = myTypeBuilder->DefineMethod( "MyMethod", - MethodAttributes::Public, - int::typeid, temp0 ); - - PermissionSet^ myMethodPermissions = gcnew PermissionSet( - PermissionState::Unrestricted ); - - myMethod1->AddDeclarativeSecurity( SecurityAction::Demand, - myMethodPermissions ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp deleted file mode 100644 index b0197f9c238..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -class MoreMethodBuilderSnippets -{ -public: - static void ContainerMethod( AssemblyBuilder^ myAsmBuilder ) - { - - // - ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MathFunctions" ); - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyMathFunctions", TypeAttributes::Public ); - array^temp0 = {int::typeid,int::typeid}; - MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "Adder", MethodAttributes::Public, int::typeid, temp0 ); - - // Create body via ILGenerator here ... - Type^ myNewType = myTypeBuilder->CreateType(); - Module^ myModule = myMthdBuilder->GetModule(); - array^myModTypes = myModule->GetTypes(); - Console::WriteLine( "Module: {0}", myModule->Name ); - Console::WriteLine( "------- with path {0}", myModule->FullyQualifiedName ); - Console::WriteLine( "------- in assembly {0}", myModule->Assembly->FullName ); - System::Collections::IEnumerator^ myEnum = myModTypes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ myModType = safe_cast(myEnum->Current); - Console::WriteLine( "------- has type {0}", myModType->FullName ); - } - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp deleted file mode 100644 index 8588434c8e6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -class MoreMethodBuilderSnippets -{ -public: - static void ContainerMethod( ModuleBuilder^ myModBuilder ) - { - // - TypeBuilder^ myType1 = myModBuilder->DefineType( "MyMathFunctions", TypeAttributes::Public ); - array^temp0 = {Type::GetType( "System.Int32&" ),int::typeid}; - MethodBuilder^ myMthdBuilder = myType1->DefineMethod( "AddToRefValue", MethodAttributes::Public, void::typeid, temp0 ); - ParameterBuilder^ myParam1 = myMthdBuilder->DefineParameter( 1, ParameterAttributes::Out, "thePool" ); - ParameterBuilder^ myParam2 = myMthdBuilder->DefineParameter( 2, ParameterAttributes::In, "addMeToPool" ); - - // Create body via ILGenerator here, and complete the type. - array^myParams = myMthdBuilder->GetParameters(); - Console::WriteLine( "Method: {0}", myMthdBuilder->Name ); - - for each (ParameterInfo^ myParam in myParams) - { - Console::WriteLine("------- Parameter: {0} {1} at pos {2}, with attribute {3}", - myParam->ParameterType, myParam->Name, myParam->Position, - myParam->Attributes.ToString()); - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp deleted file mode 100644 index 3f7e32af646..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -class MethodBuilderAssortedMembersDemo -{ -public: - static void MemberSnippets( TypeBuilder^ myTypeBuilder ) - { - // - array^ temp0 = { int::typeid, int::typeid }; - MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod", - MethodAttributes::Public, - CallingConventions::HasThis, - int::typeid, - temp0 ); - - // Specifies that the dynamic method declared above has a an MSIL implementation, - // is managed, synchronized (single-threaded) through the body, and that it - // cannot be inlined. - - myMthdBuilder->SetImplementationFlags( (MethodImplAttributes)( - MethodImplAttributes::IL | - MethodImplAttributes::Managed | - MethodImplAttributes::Synchronized | - MethodImplAttributes::NoInlining) ); - - // Create an ILGenerator for the MethodBuilder and emit MSIL here ... - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp deleted file mode 100644 index 43dd7762fff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -class VariousMethodBuilderSnippets -{ -public: - static void ContainerMethod( TypeBuilder^ myDynamicType ) - { - // - array^ temp0 = { String::typeid }; - MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethodReturnsMarshal", - MethodAttributes::Public, - UInt32::typeid, - temp0 ); - - // We want the return value of our dynamic method to be marshalled as - // an 64-bit (8-Byte) signed integer, instead of the default 32-bit - // unsigned int as specified above. The UnmanagedMarshal class can perform - // the type conversion. - - UnmanagedMarshal^ marshalMeAsI8 = UnmanagedMarshal::DefineUnmanagedMarshal( - System::Runtime::InteropServices::UnmanagedType::I8 ); - - myMethod->SetMarshal( marshalMeAsI8 ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp deleted file mode 100644 index f2b05b30c44..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp +++ /dev/null @@ -1,28 +0,0 @@ -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -class VariousMethodBuilderSnippets -{ -public: - static void ContainerMethod( TypeBuilder^ myDynamicType ) - { - // - array^ temp0 = { String::typeid }; - MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethod", - MethodAttributes::Public, - int::typeid, - temp0 ); - - // A 128-bit key in hex form, represented as a Byte array. - array^ keyVal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFF, 0xFF}; - - System::Text::ASCIIEncoding^ encoder = gcnew System::Text::ASCIIEncoding; - array^ symFullName = encoder->GetBytes( "My Dynamic Method" ); - - myMethod->SetSymCustomAttribute( "SymID", keyVal ); - myMethod->SetSymCustomAttribute( "SymFullName", symFullName ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp deleted file mode 100644 index 2f0d3457db5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -// -int main() -{ - - // We need a blank OpCode Object for reference when calling FieldInfo::GetValue(). - OpCode blankOpCode; - Type^ myOpCodesType = Type::GetType( "System.Reflection.Emit.OpCodes" ); - array^listOfOpCodes = myOpCodesType->GetFields(); - Console::WriteLine( "Which OpCodes take single-Byte arguments?" ); - Console::WriteLine( "-----------------------------------------" ); - - // Now, let's reflect on each FieldInfo and create an instance of the OpCode it represents. - System::Collections::IEnumerator^ myEnum = listOfOpCodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FieldInfo^ opCodeFI = safe_cast(myEnum->Current); - Object^ theOpCode = opCodeFI->GetValue( blankOpCode ); - Console::WriteLine( " {0}: {1}", opCodeFI->Name, OpCodes::TakesSingleByteArgument( *dynamic_cast(theOpCode) ) ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp deleted file mode 100644 index 7039d6968a8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp +++ /dev/null @@ -1,90 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ BuildCustomerDataType() -{ - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); - ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyMod" ); - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public ); - FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private ); - FieldBuilder^ acctIDBldr = myTypeBuilder->DefineField( "acctID", String::typeid, FieldAttributes::Private ); - FieldBuilder^ balanceAmtBldr = myTypeBuilder->DefineField( "balanceAmt", double::typeid, FieldAttributes::Private ); - array^temp0 = {String::typeid,String::typeid,double::typeid}; - ConstructorBuilder^ myCtorBuilder = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::HasThis, temp0 ); - ILGenerator^ ctorIL = myCtorBuilder->GetILGenerator(); - Type^ objType = Type::GetType( "System.Object" ); - ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Call, objCtor ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_1 ); - ctorIL->Emit( OpCodes::Stfld, customerNameBldr ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_2 ); - ctorIL->Emit( OpCodes::Stfld, acctIDBldr ); - ctorIL->Emit( OpCodes::Ldarg_0 ); - ctorIL->Emit( OpCodes::Ldarg_3 ); - ctorIL->Emit( OpCodes::Stfld, balanceAmtBldr ); - ctorIL->Emit( OpCodes::Ret ); - - // This method will take an amount from a static pool and add it to the balance. - // Note that we are passing the first parameter, fundsPool, by reference. Therefore, - // we need to inform the MethodBuilder to expect a ref, by declaring the first - // parameter's type to be System::Double& (a reference to a double). - array^temp4 = {Type::GetType( "System.Double&" ),double::typeid}; - MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "AddFundsFromPool", MethodAttributes::Public, double::typeid, temp4 ); - ParameterBuilder^ poolRefBuilder = myMthdBuilder->DefineParameter( 1, ParameterAttributes::Out, "fundsPool" ); - ParameterBuilder^ amountFromPoolBuilder = myMthdBuilder->DefineParameter( 2, ParameterAttributes::In, "amountFromPool" ); - ILGenerator^ mthdIL = myMthdBuilder->GetILGenerator(); - mthdIL->Emit( OpCodes::Ldarg_1 ); - mthdIL->Emit( OpCodes::Ldarg_1 ); - mthdIL->Emit( OpCodes::Ldind_R8 ); - mthdIL->Emit( OpCodes::Ldarg_2 ); - mthdIL->Emit( OpCodes::Sub ); - mthdIL->Emit( OpCodes::Stind_R8 ); - mthdIL->Emit( OpCodes::Ldarg_0 ); - mthdIL->Emit( OpCodes::Ldarg_0 ); - mthdIL->Emit( OpCodes::Ldfld, balanceAmtBldr ); - mthdIL->Emit( OpCodes::Ldarg_2 ); - mthdIL->Emit( OpCodes::Add ); - mthdIL->Emit( OpCodes::Stfld, balanceAmtBldr ); - mthdIL->Emit( OpCodes::Ldarg_0 ); - mthdIL->Emit( OpCodes::Ldfld, balanceAmtBldr ); - mthdIL->Emit( OpCodes::Ret ); - return myTypeBuilder->CreateType(); -} - -int main() -{ - Type^ custType = nullptr; - Object^ custObj = nullptr; - array^custArgTypes = {String::typeid,String::typeid,double::typeid}; - - // Call the method to build our dynamic class. - custType = BuildCustomerDataType(); - Console::WriteLine( "---" ); - ConstructorInfo^ myCustCtor = custType->GetConstructor( custArgTypes ); - double initialBalance = 100.00; - array^temp5 = {"Joe Consumer","5678-XYZ",initialBalance}; - custObj = myCustCtor->Invoke( temp5 ); - array^myMemberInfo = custType->GetMember( "AddFundsFromPool" ); - double thePool = 1000.00; - Console::WriteLine( "The pool is currently ${0}", thePool ); - Console::WriteLine( "The original balance of the account instance is ${0}", initialBalance ); - double amountFromPool = 50.00; - Console::WriteLine( "The amount to be subtracted from the pool and added to the account is ${0}", amountFromPool ); - Console::WriteLine( "---" ); - Console::WriteLine( "Calling {0} ...", myMemberInfo[ 0 ] ); - Console::WriteLine( "---" ); - array^passMe = {thePool,amountFromPool}; - Console::WriteLine( "The new balance in the account instance is ${0}", custType->InvokeMember( "AddFundsFromPool", BindingFlags::InvokeMethod, nullptr, custObj, passMe ) ); - thePool = safe_cast(passMe[ 0 ]); - Console::WriteLine( "The new amount in the pool is ${0}", thePool ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp deleted file mode 100644 index 8f782758f2a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -Type^ BuildDynamicTypeWithProperties() -{ - AppDomain^ myDomain = Thread::GetDomain(); - AssemblyName^ myAsmName = gcnew AssemblyName; - myAsmName->Name = "MyDynamicAssembly"; - - // To generate a persistable assembly, specify AssemblyBuilderAccess::RunAndSave. - AssemblyBuilder^ myAsmBuilder = - myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); - - // Generate a persistable single-module assembly. - ModuleBuilder^ myModBuilder = - myAsmBuilder->DefineDynamicModule( myAsmName->Name, myAsmName->Name + ".dll" ); - TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public ); - - // Define a private field to hold the property value. - FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private ); - - // The last argument of DefineProperty is an empty array of Type - // objects, because the property has no parameters. (Alternatively, - // you can specify a null value.) - PropertyBuilder^ custNamePropBldr = - myTypeBuilder->DefineProperty( "CustomerName", PropertyAttributes::HasDefault, String::typeid, gcnew array(0) ); - - // The property set and property get methods require a special - // set of attributes. - MethodAttributes getSetAttr = - MethodAttributes::Public | MethodAttributes::SpecialName | - MethodAttributes::HideBySig; - - // Define the "get" accessor method for CustomerName. - MethodBuilder^ custNameGetPropMthdBldr = - myTypeBuilder->DefineMethod( "get_CustomerName", - getSetAttr, - String::typeid, - Type::EmptyTypes ); - - ILGenerator^ custNameGetIL = custNameGetPropMthdBldr->GetILGenerator(); - custNameGetIL->Emit( OpCodes::Ldarg_0 ); - custNameGetIL->Emit( OpCodes::Ldfld, customerNameBldr ); - custNameGetIL->Emit( OpCodes::Ret ); - - // Define the "set" accessor method for CustomerName. - array^temp2 = {String::typeid}; - MethodBuilder^ custNameSetPropMthdBldr = - myTypeBuilder->DefineMethod( "set_CustomerName", - getSetAttr, - nullptr, - temp2 ); - - ILGenerator^ custNameSetIL = custNameSetPropMthdBldr->GetILGenerator(); - custNameSetIL->Emit( OpCodes::Ldarg_0 ); - custNameSetIL->Emit( OpCodes::Ldarg_1 ); - custNameSetIL->Emit( OpCodes::Stfld, customerNameBldr ); - custNameSetIL->Emit( OpCodes::Ret ); - - // Last, we must map the two methods created above to our PropertyBuilder to - // their corresponding behaviors, "get" and "set" respectively. - custNamePropBldr->SetGetMethod( custNameGetPropMthdBldr ); - custNamePropBldr->SetSetMethod( custNameSetPropMthdBldr ); - - Type^ retval = myTypeBuilder->CreateType(); - - // Save the assembly so it can be examined with Ildasm.exe, - // or referenced by a test program. - myAsmBuilder->Save(myAsmName->Name + ".dll"); - return retval; -} - -int main() -{ - Type^ custDataType = BuildDynamicTypeWithProperties(); - array^custDataPropInfo = custDataType->GetProperties(); - System::Collections::IEnumerator^ myEnum = custDataPropInfo->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - PropertyInfo^ pInfo = safe_cast(myEnum->Current); - Console::WriteLine( "Property '{0}' created!", pInfo ); - } - - Console::WriteLine( "---" ); - - // Note that when invoking a property, you need to use the proper BindingFlags - - // BindingFlags::SetProperty when you invoke the "set" behavior, and - // BindingFlags::GetProperty when you invoke the "get" behavior. Also note that - // we invoke them based on the name we gave the property, as expected, and not - // the name of the methods we bound to the specific property behaviors. - Object^ custData = Activator::CreateInstance( custDataType ); - array^temp3 = {"Joe User"}; - custDataType->InvokeMember( "CustomerName", BindingFlags::SetProperty, nullptr, custData, temp3 ); - Console::WriteLine( "The customerName field of instance custData has been set to '{0}'.", custDataType->InvokeMember( "CustomerName", BindingFlags::GetProperty, nullptr, custData, gcnew array(0) ) ); -} - -// --- O U T P U T --- -// The output should be as follows: -// ------------------- -// Property 'System.String CustomerName' created! -// --- -// The customerName field of instance custData has been set to 'Joe User'. -// ------------------- -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp deleted file mode 100644 index bfeecb340d6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Threading; -using namespace System::Text; -using namespace System::Resources; -using namespace System::Collections; -using namespace System::IO; - -// Helper class called when a resolve type event is raised. -ref class TypeResolveHandler -{ -private: - Module^ m_Module; - -public: - TypeResolveHandler( Module^ mod ) - { - m_Module = mod; - } - - Assembly^ ResolveEvent( Object^ sender, ResolveEventArgs^ args ); -}; - -ref class NestedEnum -{ -internal: - static TypeBuilder^ enumType = nullptr; - static Type^ tNested = nullptr; - static Type^ tNesting = nullptr; - -public: - static void Main() - { - AssemblyName^ asmName = gcnew AssemblyName; - asmName->Name = "NestedEnum"; - AssemblyBuilder^ asmBuild = Thread::GetDomain()->DefineDynamicAssembly( asmName, AssemblyBuilderAccess::RunAndSave ); - ModuleBuilder^ modBuild = asmBuild->DefineDynamicModule( "ModuleOne", "NestedEnum.dll" ); - - // Hook up the event listening. - TypeResolveHandler^ typeResolveHandler = gcnew TypeResolveHandler( modBuild ); - - // Add a listener for the type resolve events. - AppDomain^ currentDomain = Thread::GetDomain(); - ResolveEventHandler^ resolveHandler = gcnew ResolveEventHandler( typeResolveHandler, &TypeResolveHandler::ResolveEvent ); - currentDomain->TypeResolve += resolveHandler; - TypeBuilder^ tb = modBuild->DefineType( "AType", TypeAttributes::Public ); - TypeBuilder^ eb = tb->DefineNestedType( "AnEnum", static_cast(TypeAttributes::NestedPublic | TypeAttributes::Sealed), Enum::typeid, 0 ); - eb->DefineField( "value__", int::typeid, static_cast(FieldAttributes::Private | FieldAttributes::SpecialName) ); - FieldBuilder^ fb = eb->DefineField( "Field1", eb, static_cast(FieldAttributes::Public | FieldAttributes::Literal | FieldAttributes::Static) ); - fb->SetConstant( 1 ); - enumType = eb; - - // Comment out this field. - // When this field is defined, the loader cannot determine the size - // of the type. Therefore, a TypeResolve event is generated when the - // nested type is completed. - tb->DefineField( "Field2", eb, FieldAttributes::Public ); - tNesting = tb->CreateType(); - if ( tNesting == nullptr ) - Console::WriteLine( "NestingType CreateType failed but didn't throw!" ); - - try - { - tNested = eb->CreateType(); - if ( tNested == nullptr ) - Console::WriteLine( "NestedType CreateType failed but didn't throw!" ); - } - catch ( Exception^ ) - { - - // This is needed because you might have already completed the type in the TypeResolve event. - } - - if ( tNested != nullptr ) - { - Type^ x = tNested->DeclaringType; - if ( x == nullptr ) - Console::WriteLine( "Declaring type is null." ); - else - Console::WriteLine( x->Name ); - } - - asmBuild->Save( "NestedEnum.dll" ); - - // Remove the listener for the type resolve events. - currentDomain->TypeResolve -= resolveHandler; - } - -}; - -Assembly^ TypeResolveHandler::ResolveEvent( Object^ sender, ResolveEventArgs^ args ) -{ - Console::WriteLine( args->Name ); - - // Use args.Name to look up the type name. In this case, you are getting AnEnum. - try - { - NestedEnum::tNested = NestedEnum::enumType->CreateType(); - } - catch ( Exception^ ) - { - - // This is needed to throw away InvalidOperationException. - // Loader might send the TypeResolve event more than once - // and the type might be complete already. - } - - - // Complete the type. - return m_Module->Assembly; -} - -int main() -{ - NestedEnum::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp deleted file mode 100644 index 8f8a66f0c27..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Test -{ -public: - virtual String^ ToString() override - { - return "An instance of class Test!"; - } -}; - -int main() -{ - Test^ target = gcnew Test(); - MethodInfo^ toStringInfo = target->GetType()->GetMethod("ToString"); - Console::WriteLine("{0} is defined in {1}", toStringInfo->Name, - toStringInfo->Module->Name); - - MethodInfo^ getHashCodeInfo = target->GetType()->GetMethod("GetHashCode"); - Console::WriteLine("{0} is defined in {1}", getHashCodeInfo->Name, - getHashCodeInfo->Module->Name); -} - -/* -* This example produces the following console output: -* -* ToString is defined in source.exe -* GetHashCode is defined in mscorlib.dll -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp deleted file mode 100644 index 2ba285b7284..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -// The base class Parent contains an overloaded method PrintCall. -// -public ref class Parent -{ -public: - virtual void PrintCall() - { - Console::WriteLine("Parent's PrintCall()"); - } -public: - virtual void PrintCall(int x) - { - Console::WriteLine("Parent's PrintCall({0})", x); - } -}; - -// The derived class Child hides one overload of the inherited -// method PrintCall. -// -public ref class Child : public Parent -{ -public: - void PrintCall(int i) new - { - Console::WriteLine("Child's PrintCall({0})", i); - } -}; - -int main() -{ - Child^ childInstance = gcnew Child(); - - // In C#, the method in the derived class hides by name and by - // signature, so the overload in the derived class hides only one - // of the overloads in the base class. - // - Console::WriteLine("------ List the overloads of PrintCall in the " + - "derived class Child ------"); - Type^ t = childInstance->GetType(); - for each(MethodInfo^ minfo in t->GetMethods()) - { - if (minfo->Name == "PrintCall") - { - Console::WriteLine("Overload of PrintCall: {0}" + - " IsHideBySig = {1}, DeclaringType = {2}", - minfo, minfo->IsHideBySig, minfo->DeclaringType); - } - } - - // The method PrintCall in the derived class hides one overload of the - // method in Parent. Contrast this with Visual Basic, which hides by - // name instead of by name and signature. In Visual Basic, the - // parameterless overload of PrintCall would be unavailable from Child. - // - Console::WriteLine( - "------ Call the overloads of PrintCall available in Child ------"); - childInstance->PrintCall(); - childInstance->PrintCall(42); - - // If Child is cast to the base type Parent, both overloads of the - // shadowed method can be called. - // - Console::WriteLine( - "------ Call the shadowed overloads of PrintCall ------"); - Parent^ parentInstance = childInstance; - parentInstance->PrintCall(); - parentInstance->PrintCall(42); -} - -/* This code example produces the following output: - ------- List the overloads of PrintCall in the derived class Child ------ -Overload of PrintCall: Void PrintCall(Int32) IsHideBySig = True, DeclaringType = Child -Overload of PrintCall: Void PrintCall() IsHideBySig = True, DeclaringType = Parent -Overload of PrintCall: Void PrintCall(Int32) IsHideBySig = True, DeclaringType = Parent ------- Call the overloads of PrintCall available in Child ------ -Parent's PrintCall() -Child's PrintCall(42) ------- Call the shadowed overloads of PrintCall ------ -Parent's PrintCall() -Parent's PrintCall(42) - -*/ - -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp deleted file mode 100644 index 2fca1e3a971..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp +++ /dev/null @@ -1,17 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - array^moduleArray; - moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); - - // In a simple project with only one module, the module at index - // 0 will be the module containing this class. - Module^ myModule = moduleArray[ 0 ]; - Assembly^ myAssembly = myModule->Assembly; - Console::WriteLine( "myModule.Assembly = {0}.", myAssembly->FullName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp deleted file mode 100644 index 82159ee05f7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; -public ref class MySecondClass{}; - - -// This class does not fit the filter criterion My*. -public ref class YourClass{}; - -int main() -{ - array^moduleArray; - moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); - - // In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - Module^ myModule = moduleArray[ 0 ]; - array^tArray; - tArray = myModule->FindTypes( Module::FilterTypeName, "My*" ); - IEnumerator^ myEnum = tArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ t = safe_cast(myEnum->Current); - Console::WriteLine( "Found a module beginning with My*: {0}.", t->Name ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp deleted file mode 100644 index 3aa584f6d2c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; -public ref class MyMainClass{}; - -public ref class MySecondClass{}; - - -// This class does not fit the filter criteria my*. -public ref class YourClass{}; - -int main() -{ - array^moduleArray; - moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); - - // In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - Module^ myModule = moduleArray[ 0 ]; - array^tArray; - tArray = myModule->FindTypes( Module::FilterTypeNameIgnoreCase, "my*" ); - IEnumerator^ myEnum = tArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ t = safe_cast(myEnum->Current); - Console::WriteLine( "Found a module beginning with my*: {0}", t->Name ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp deleted file mode 100644 index 68633196a7c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - array^moduleArray; - moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); - - // In a simple project with only one module, the module at index - // 0 will be the module containing this class. - Module^ myModule = moduleArray[ 0 ]; - Console::WriteLine( "myModule.FullyQualifiedName = {0}", myModule->FullyQualifiedName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp deleted file mode 100644 index 38137adc219..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; - -namespace ReflectionModule_Examples -{ - - //Define a module-level attribute. - //A very simple custom attribute. - - [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)] - public ref class MySimpleAttribute: public Attribute - { - private: - String^ name; - - public: - MySimpleAttribute( String^ newName ) - { - name = newName; - } - - }; - - - [module:MySimpleAttribute("module-level")]; - ref class MyMainClass{}; - -} - -int main() -{ - array^moduleArray; - moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false ); - - // In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - System::Reflection::Module^ myModule = moduleArray[ 0 ]; - array^attributes; - attributes = myModule->GetCustomAttributes( true ); - IEnumerator^ myEnum = attributes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "Found this attribute on myModule: {0}.", o ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp deleted file mode 100644 index 3cf8509d34b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections; - -namespace ReflectionModule_Examples -{ - - // Define a very simple custom attribute - - [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)] - public ref class MySimpleAttribute: public Attribute - { - private: - String^ name; - - public: - MySimpleAttribute( String^ newName ) - { - name = newName; - } - - }; - -} - - -//Define a module-level attribute. - -[module:ReflectionModule_Examples::MySimpleAttribute("module-level")]; -int main() -{ - array^moduleArray; - moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false ); - - // In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - System::Reflection::Module^ myModule = moduleArray[ 0 ]; - array^attributes; - - //Get only MySimpleAttribute attributes for this module. - attributes = myModule->GetCustomAttributes( myModule->GetType( "ReflectionModule_Examples.MySimpleAttribute", false, false ), true ); - IEnumerator^ myEnum = attributes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "Found this attribute on myModule: {0}", o ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp deleted file mode 100644 index e7972909d1e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -namespace ReflectionModule_Examples -{ - public ref class MyMainClass{}; - -} - -int main() -{ - array^moduleArray; - moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false ); - - //In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - Module^ myModule = moduleArray[ 0 ]; - Type^ myType; - myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass" ); - Console::WriteLine( "Got type: {0}", myType ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp deleted file mode 100644 index 7c898abb0c9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -namespace ReflectionModule_Examples -{ - public ref class MyMainClass{}; - -} - -int main() -{ - array^moduleArray; - moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false ); - - //In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - Module^ myModule = moduleArray[ 0 ]; - Type^ myType; - myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false ); - Console::WriteLine( "Got type: {0}", myType ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp deleted file mode 100644 index 3759068bbe0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -namespace ReflectionModule_Examples -{ - public ref class MyMainClass{}; - -} - -int main() -{ - array^moduleArray; - moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false ); - - //In a simple project with only one module, the module at index - // 0 will be the module containing this class. - Module^ myModule = moduleArray[ 0 ]; - Type^ myType; - myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false, false ); - Console::WriteLine( "Got type: {0}", myType ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp deleted file mode 100644 index 651c5025f0d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; - -namespace ReflectionModule_Examples -{ - - //A very simple custom attribute. - - [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)] - public ref class MySimpleAttribute: public Attribute - { - private: - String^ name; - - public: - MySimpleAttribute( String^ newName ) - { - name = newName; - } - - }; - -} - - -//Define a module-level attribute. - -[module:ReflectionModule_Examples::MySimpleAttribute("module-level")]; -int main() -{ - array^moduleArray; - moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false ); - - //In a simple project with only one module, the module at index - // 0 will be the module containing these classes. - System::Reflection::Module^ myModule = moduleArray[ 0 ]; - Type^ myType; - myType = myModule->GetType( "ReflectionModule_Examples.MySimpleAttribute" ); - Console::WriteLine( "IsDefined(MySimpleAttribute) = {0}", myModule->IsDefined( myType, false ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp deleted file mode 100644 index 41922a945e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - array^moduleArray; - moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); - - //In a simple project with only one module, the module at index - // 0 will be the module containing this class. - Module^ myModule = moduleArray[ 0 ]; - Console::WriteLine( "myModule->IsResource() = {0}", myModule->IsResource() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp deleted file mode 100644 index bd17af9afb2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp +++ /dev/null @@ -1,16 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -int main() -{ - array^moduleArray; - moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); - - //In a simple project with only one module, the module at index - // 0 will be the module containing this class. - Module^ myModule = moduleArray[ 0 ]; - Console::WriteLine( "myModule->ToString returns: {0}", myModule ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp deleted file mode 100644 index c07a0a5476f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Resources; -using namespace System::Collections; -void main() -{ - - // Create a ResXResourceReader for the file items.resx. - ResXResourceReader^ rsxr = gcnew ResXResourceReader( "items.resx" ); - - - // Iterate through the resources and display the contents to the console. - IEnumerator^ myEnum = rsxr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ d = safe_cast(myEnum->Current); - Console::WriteLine( "{0}:\t {1}", d->Key, d->Value ); - } - - - //Close the reader. - rsxr->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp deleted file mode 100644 index d1d5faf2d6d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp +++ /dev/null @@ -1,112 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Resources; -using namespace System::ComponentModel::Design; - -namespace UseDataNodesExample -{ - public ref class Program - { - public: - static void Main() - { - Console::WriteLine("\nEnumerating as data items..."); - EnumResourceItems("Resource1.resx", false); - - Console::WriteLine("\nEnumerating as data nodes..."); - EnumResourceItems("Resource1.resx", true); - } - - static void EnumResourceItems(String^ resxFile, bool useDataNodes) - { - ResXResourceReader^ reader = gcnew ResXResourceReader(resxFile); - - reader->UseResXDataNodes = useDataNodes; - - // - // Enumerate using IEnumerable.GetEnumerator(). - Console::WriteLine("\n Default enumerator:"); - for each (DictionaryEntry entry in reader) - { - ShowResourceItem(entry, useDataNodes); - } - // - - // - // Enumerate using GetMetadataEnumerator() - IDictionaryEnumerator^ metadataEnumerator = reader->GetMetadataEnumerator(); - - Console::WriteLine("\n MetadataEnumerator:"); - while (metadataEnumerator->MoveNext()) - { - ShowResourceItem(metadataEnumerator->Entry, useDataNodes); - } - // - - // - // Enumerate using GetEnumerator() - IDictionaryEnumerator^ enumerator = reader->GetEnumerator(); - - Console::WriteLine("\n Enumerator:"); - while (enumerator->MoveNext()) - { - ShowResourceItem(enumerator->Entry, useDataNodes); - } - // - delete reader; - } - - static void ShowResourceItem(DictionaryEntry entry, bool isDataNode) - { - // Use a nullptr type resolver. - ITypeResolutionService^ typeres = nullptr; - ResXDataNode^ dnode; - - if (isDataNode) - { - // Display from node info. - dnode = (ResXDataNode^)entry.Value; - Console::WriteLine(" {0}={1}", dnode->Name, dnode->GetValue(typeres)); - } - else - { - // Display as DictionaryEntry info. - Console::WriteLine(" {0}={1}", entry.Key, entry.Value); - } - } - }; -} - -int main() -{ - UseDataNodesExample::Program::Main(); -} -// The example program will have the following output: -// -// Enumerating as data items... -// -// Default enumerator: -// DataSample=Sample DATA value -// -// MetadataEnumerator: -// MetadataSample=Sample METADATA value -// -// Enumerator: -// DataSample=Sample DATA value -// -// Enumerating as data nodes... -// -// Default enumerator: -// DataSample=Sample DATA value -// MetadataSample=Sample METADATA value -// -// MetadataEnumerator: -// -// Enumerator: -// DataSample=Sample DATA value -// MetadataSample=Sample METADATA value -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp deleted file mode 100644 index 07b62bf13b4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::Resources; -using namespace System::Collections; -int main() -{ - - // Create a ResourceReader for the file items.resources. - ResourceReader^ rr = gcnew ResourceReader( "items.resources" ); - - // Create an IDictionaryEnumerator* to iterate through the resources. - IDictionaryEnumerator^ id = rr->GetEnumerator(); - - // Iterate through the resources and display the contents to the console. - while ( id->MoveNext() ) - Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value ); - - rr->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp deleted file mode 100644 index 8f81922ead1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::Resources; -using namespace System::Collections; -int main() -{ - - // Create a ResourceSet for the file items.resources. - ResourceSet^ rs = gcnew ResourceSet( "items.resources" ); - - // Create an IDictionaryEnumerator* to read the data in the ResourceSet. - IDictionaryEnumerator^ id = rs->GetEnumerator(); - - // Iterate through the ResourceSet and display the contents to the console. - while ( id->MoveNext() ) - Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value ); - - rs->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp deleted file mode 100644 index b782b33e9ef..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::Resources; -using namespace System::IO; -int main() -{ - - // Create a file stream to encapsulate items.resources. - FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); - - // Open a resource writer to write from the stream. - IResourceWriter^ writer = gcnew ResourceWriter( fs ); - - // Add resources to the resource writer. - writer->AddResource( "String 1", "First String" ); - writer->AddResource( "String 2", "Second String" ); - writer->AddResource( "String 3", "Third String" ); - - // Write the resources to the stream, and close it. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp deleted file mode 100644 index f96fb6c9ed2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::Resources; -using namespace System::IO; -int main() -{ - // Create a file stream to encapsulate items.resources. - FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); - - // Open a resource writer to write from the stream. - IResourceWriter^ writer = gcnew ResourceWriter( fs ); - - // Add resources to the resource writer. - writer->AddResource( "String 1", "First String" ); - writer->AddResource( "String 2", "Second String" ); - writer->AddResource( "String 3", "Third String" ); - - // Write the resources to the stream, - // and clean up all resources associated with the writer. - // Calling Dispose is equivalent to calling Close. - writer->~IResourceWriter(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp deleted file mode 100644 index ae4c0f1b512..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Resources; -using namespace System::IO; -int main() -{ - - // Create a file stream to encapsulate items.resources. - FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); - - // Open a resource writer to write from the stream. - IResourceWriter^ writer = gcnew ResourceWriter( fs ); - - // Add resources to the resource writer. - writer->AddResource( "String 1", "First String" ); - writer->AddResource( "String 2", "Second String" ); - writer->AddResource( "String 3", "Third String" ); - - // Generate the resources, and close the writer. - writer->Generate(); - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp deleted file mode 100644 index caaabb17d70..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::CompilerServices; - -[assembly:RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]; - -void run() -{ - Console::WriteLine("The RuntimeCompatibilityAttribute was applied to disable exception wrapping."); -} - -int main() -{ - run(); - - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp deleted file mode 100644 index 851d140008f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::CompilerServices; - -[assembly:RuntimeCompatibilityAttribute(WrapNonExceptionThrows = true)]; - -void run() -{ - try - { - throw gcnew String("This is a string"); - - } - catch(RuntimeWrappedException^ e) - { - Console::WriteLine("RuntimeWrappedException caught!"); - } -} - -int main() -{ - run(); - - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp deleted file mode 100644 index cc68dfa8f88..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// Convert::cpp -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; - -enum class RegKind -{ - RegKind_Default, RegKind_Register, RegKind_None -}; - -ref class ConversionEventHandler: public ITypeLibImporterNotifySink -{ -public: - virtual void ReportEvent( ImporterEventKind eventKind, int eventCode, String^ eventMsg ) - { - - // handle warning event here... - } - - virtual Assembly^ ResolveRef( Object^ typeLib ) - { - - // resolve reference here and return a correct assembly... - return nullptr; - } - -}; - - -[DllImport("oleaut32.dll",CharSet=CharSet::Unicode,PreserveSig=false)] -extern void LoadTypeLibEx( String^ strTypeLibName, RegKind regkind, - [MarshalAs(UnmanagedType::Interface)] interior_ptr typeLib ); - -int main() -{ - Object^ typeLib = gcnew Object; - LoadTypeLibEx( "SHDocVw.dll", RegKind::RegKind_None, &typeLib ); - if ( typeLib == nullptr ) - { - Console::WriteLine( "LoadTypeLibEx failed." ); - return 0; - } - - TypeLibConverter^ converter = gcnew TypeLibConverter; - ConversionEventHandler^ eventHandler = gcnew ConversionEventHandler; - AssemblyBuilder^ asmb = converter->ConvertTypeLibToAssembly( typeLib, "ExplorerLib.dll", (System::Runtime::InteropServices::TypeLibImporterFlags)0, eventHandler, nullptr, nullptr, nullptr, nullptr ); - asmb->Save( "ExplorerLib.dll" ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp deleted file mode 100644 index ba7d39004e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::InteropServices; - -// Force the layout of your fields to the C-style struct layout. -// Without this, the .NET Framework will reorder your fields. - -[StructLayoutAttribute(LayoutKind::Sequential)] -value struct Vertex -{ -public: - float x; - float y; - float z; -}; - - -// Add [In] or [In, Out] attributes as appropriate. -// Marshal as a C-style array of Vertex, where the second (SizeParamIndex is zero-based) -// parameter (size) contains the count of array elements. - -[DllImport("SomeDLL.dll")] -extern void SomeUnsafeMethod( [MarshalAs(UnmanagedType::LPArray,SizeParamIndex=1)]array^data, long size ); -int main() -{ - array^verts = gcnew array(3); - SomeUnsafeMethod( verts, verts->Length ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp deleted file mode 100644 index e4e62835e32..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; -using namespace System::Runtime::InteropServices; - -[ComImport, -GuidAttribute("00020406-0000-0000-C000-000000000046"), -InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown), -ComVisible(false)] -interface class UCOMICreateITypeLib -{ - void CreateTypeInfo(); - void SetName(); - void SetVersion(); - void SetGuid(); - void SetDocString(); - void SetHelpFileName(); - void SetHelpContext(); - void SetLcid(); - void SetLibFlags(); - void SaveAllChanges(); -}; - -public ref class ConversionEventHandler: public ITypeLibExporterNotifySink -{ -public: - virtual void ReportEvent( ExporterEventKind eventKind, int eventCode, String^ eventMsg ) - { - // Handle the warning event here. - } - - virtual Object^ ResolveRef( Assembly^ a ) - { - // Resolve the reference here and return a correct type library. - return nullptr; - } -}; - -int main() -{ - Assembly^ a = Assembly::LoadFrom( "MyAssembly.dll" ); - TypeLibConverter^ converter = gcnew TypeLibConverter; - ConversionEventHandler^ eventHandler = gcnew ConversionEventHandler; - UCOMICreateITypeLib^ typeLib = dynamic_cast(converter->ConvertAssemblyToTypeLib( a, "MyTypeLib.dll", static_cast(0), eventHandler )); - typeLib->SaveAllChanges(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp deleted file mode 100644 index 08370f3519c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp +++ /dev/null @@ -1,150 +0,0 @@ - -//#pragma comment(linker, "/CLRUNMANAGEDCODECHECK:NO") -// -// The following HTML code can be used to call the user control in this sample. -// -// -// -// -// -//

-// -// -// To run this test control you must create a strong name key, snkey.snk, and -// a code group that gives full trust to assemblies signed with snkey.snk. -// The user control displays an OpenFileDialog box, then displays a text box containing the name of -// the file selected and a list box that displays the contents of the file. The selected file must -// contain text in order for the control to display the data properly. -// Caution This sample demonstrates the use of the Assert method. Calling Assert removes the -// requirement that all code in the call chain must be granted permission to access the specified -// resource, it can open up security vulnerabilities if used incorrectly or inappropriately. Therefore, -// it should be used with great caution. Assert should always be followed with a RevertAssert -// command to restore the security settings. -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::IO; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; - -// This strong name key is used to create a code group that gives permissions to this assembly. -// The AllowPartiallyTrustedCallersAttribute requires the assembly to be signed with a strong name key. -// This attribute is necessary since the control is called by either an intranet or Internet -// Web page that should be running under restricted permissions. -// The userControl1 displays an OpenFileDialog box, then displays a text box containing the name of -// the file selected and a list box that displays the contents of the file. The selected file must -// contain text in order for the control to display the data properly. - -[assembly:AssemblyKeyFile("snKey.snk")]; -[assembly:AssemblyVersion("1.0.0.0")]; -[assembly:AllowPartiallyTrustedCallers]; -public ref class UserControl1: public System::Windows::Forms::UserControl -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::ListBox^ listBox1; - - // Required designer variable. - System::ComponentModel::Container^ components; - -public: -// Demand the zone requirement for the calling application. -[ZoneIdentityPermission(SecurityAction::Demand, Zone = SecurityZone::Intranet)] - UserControl1() - { - - // This call is required by the Windows.Forms Form Designer. - InitializeComponent(); - - // The OpenFileDialog box should not require any special permissions. - OpenFileDialog^ fileDialog = gcnew OpenFileDialog; - if ( fileDialog->ShowDialog() == DialogResult::OK ) - { - - // Reading the name of the selected file from the OpenFileDialog box - // and reading the file requires FileIOPermission. The user control should - // have this permission granted through its code group; the Web page that calls the - // control should not have this permission. The Assert command prevents a stack walk - // that would fail because the caller does not have the required FileIOPermission. - // The use of Assert can open up security vulnerabilities if used incorrectly or - // inappropriately. Therefore, it should be used with great caution. - // The Assert command should be followed by a RevertAssert as soon as the file operation - // is completed. - (gcnew FileIOPermission( PermissionState::Unrestricted ))->Assert(); - textBox1->Text = fileDialog->FileName; - - // Display the contents of the file in the text box. - FileStream^ fsIn = gcnew FileStream( textBox1->Text,FileMode::Open,FileAccess::Read,FileShare::Read ); - StreamReader^ sr = gcnew StreamReader( fsIn ); - - // Process every line in the file - for ( String ^ Line = sr->ReadLine(); Line != nullptr; Line = sr->ReadLine() ) - { - listBox1->Items->Add( Line ); - - } - - // file operations. - FileIOPermission::RevertAssert(); - } - } - -private: - - ///

- /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 208, 112 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 320, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - this->textBox1->TextChanged += gcnew System::EventHandler( this,&UserControl1::textBox1_TextChanged ); - - // - // listBox1 - // - this->listBox1->Location = System::Drawing::Point( 200, 184 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 336, 108 ); - this->listBox1->TabIndex = 1; - - // - // UserControl1 - // - this->Controls->Add( this->listBox1 ); - this->Controls->Add( this->textBox1 ); - this->Name = "UserControl1"; - this->Size = System::Drawing::Size( 592, 400 ); - this->Load += gcnew System::EventHandler( this,&UserControl1::UserControl1_Load ); - this->ResumeLayout( false ); - } - - void UserControl1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - - void textBox1_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - -}; - -//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp deleted file mode 100644 index 5a67133635d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp +++ /dev/null @@ -1,320 +0,0 @@ -// This class creates a custom crytographic object based on the asymmetric -// algorithm by extending the abstract base class AsymmetricAlgorithm. -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Text; -using namespace System::Security::Cryptography; -using namespace System::Reflection; - -[assembly: AssemblyKeyFile("CustomCrypto.snk")]; -[assembly: AssemblyVersion("1.0.0.0")]; -[assembly: CLSCompliant(true)]; -namespace Contoso -{ - // Define a CustomCrypto class that inherits from the AsymmetricAlgorithm - // class. - public ref class CustomCrypto : - public System::Security::Cryptography::AsymmetricAlgorithm - { - // Declare local member variables. - private: - CspParameters^ cryptoServiceParameters; - array^ customValidKeySizes; - - // Initialize a CustomCrypto with the default key size of 8. - public: - CustomCrypto() - { - customValidKeySizes = - gcnew array{gcnew KeySizes(8, 64, 8)}; - this->KeySize = 8; - } - - // Initialize a CustomCrypto with the specified key size. - public: - CustomCrypto(int keySize) - { - customValidKeySizes = - gcnew array{gcnew KeySizes(8, 64, 8)}; - this->KeySize = keySize; - } - - // Accessor function for keySizes member variable. - public: - property array^ LegalKeySizes - { - virtual array^ get() override - { - return (array^)customValidKeySizes->Clone(); - } - } - - // Modify the KeySizeValue property inherited from the Asymmetric - // class. Prior to setting the value, ensure it falls within the - // range identified in the local keySizes member variable. - // - public: - property int KeySize - { - virtual int get() override - { - return KeySizeValue; - } - - virtual void set(int value) override - { - for (int i = 0; i < customValidKeySizes->Length; i++) - { - if (customValidKeySizes[i]->SkipSize == 0) - { - if (customValidKeySizes[i]->MinSize == value) - { - KeySizeValue = value; - return; - } - } - else - { - for (int j = customValidKeySizes[i]->MinSize; - j <= customValidKeySizes[i]->MaxSize; - j += customValidKeySizes[i]->SkipSize) - { - if (j == value) - { - KeySizeValue = value; - return; - } - } - } - } - - // If the key does not fall within the range identified - // in the keySizes member variable, throw an exception. - throw gcnew CryptographicException("Invalid key size."); - } - } - // - - // Initialize the parameters with default values. - public: - void InitializeParameters() - { - cryptoServiceParameters = gcnew CspParameters(); - cryptoServiceParameters->ProviderName = "Contoso"; - cryptoServiceParameters->KeyContainerName = "SecurityBin1"; - cryptoServiceParameters->KeyNumber = 1; - cryptoServiceParameters->ProviderType = 2; - } - - // Parse specified xmlString for values to populate the CspParams - // - // Expected XML schema: - // - // - // - // - // - // - public: - virtual void FromXmlString(String^ xmlString) override - { - if (xmlString != nullptr) - { - XmlDocument^ document = gcnew XmlDocument(); - document->LoadXml(xmlString); - XmlNode^ firstNode = document->FirstChild; - XmlNodeList^ nodeList; - - // Assemble parameters from values in each XML element. - cryptoServiceParameters = gcnew CspParameters(); - - // KeyContainerName is optional. - nodeList = - document->GetElementsByTagName("KeyContainerName"); - if (nodeList->Count > 0) - { - cryptoServiceParameters->KeyContainerName = - nodeList->Item(0)->InnerText; - } - - // KeyNumber is optional. - nodeList = document->GetElementsByTagName("KeyNumber"); - if (nodeList->Count > 0) - { - cryptoServiceParameters->KeyNumber = - Int32::Parse(nodeList->Item(0)->InnerText); - } - - // ProviderName is optional. - nodeList = document->GetElementsByTagName("ProviderName"); - if (nodeList->Count > 0) - { - cryptoServiceParameters->ProviderName = - nodeList->Item(0)->InnerText; - } - - // ProviderType is optional. - nodeList = document->GetElementsByTagName("ProviderType"); - if (nodeList->Count > 0) - { - cryptoServiceParameters->ProviderType = - Int32::Parse(nodeList->Item(0)->InnerText); - } - } - else - { - throw gcnew ArgumentNullException("xmlString"); - } - } - // - - // Create an XML string representation of the parameters in the - // current customCrypto object. - // - public: - virtual String^ ToXmlString(bool includePrivateParameters) override - { - String^ keyContainerName = ""; - String^ keyNumber = ""; - String^ providerName = ""; - String^ providerType = ""; - - if (cryptoServiceParameters != nullptr) - { - keyContainerName = - cryptoServiceParameters->KeyContainerName; - keyNumber = cryptoServiceParameters->KeyNumber.ToString(); - providerName = cryptoServiceParameters->ProviderName; - providerType = - cryptoServiceParameters->ProviderType.ToString(); - } - - StringBuilder^ sb = gcnew StringBuilder(); - sb->Append(""); - - sb->Append(""); - sb->Append(keyContainerName); - sb->Append(""); - - sb->Append(""); - sb->Append(keyNumber); - sb->Append(""); - - sb->Append(""); - sb->Append(providerName); - sb->Append(""); - - sb->Append(""); - sb->Append(providerType); - sb->Append(""); - - sb->Append(""); - return(sb->ToString()); - } - // - - // Return the name for the key exchange algorithm. - // - public: - property String^ KeyExchangeAlgorithm - { - virtual String^ get() override - { - return "RSA-PKCS1-KeyEx"; - } - } - // - - // Retrieves the name of the signature alogrithm. - // - // This example uses the SHA1 algorithm. - // Due to collision problems with SHA1, Microsoft recommends SHA256 or better. - - public: - property String^ SignatureAlgorithm - { - virtual String^ get() override - { - return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; - } - } - // - - // Required member for implementing the AsymmetricAlgorithm class. - protected: - virtual ~CustomCrypto() - { - } - - // Call the Create method using the CustomCrypto assembly name. - // - // The create function attempts to create a CustomCrypto - // object using the assembly name. This functionality requires - // modification of the machine.config file. Add the following - // section to the configuration element and modify the values - // of the cryptoClass to reflect what isinstalled - // in your machines GAC. - // - // - // - // - // - // - // - // - // - // - // - - public: - static CustomCrypto^ Create() - { - return Create("CustomCrypto"); - } - // - - // Create a CustomCrypto object by calling CrytoConfig's - // CreateFromName method and casting the type to CustomCrypto. - // - // The create function attempts to create a CustomCrypto object - // using the assembly name. This functionality requires - // modification of the machine.config file. Add the following - // section to the configuration element and modify the values - // of the cryptoClass to reflect what is installed - // in your machines GAC. - // - // - // - // - // - // - // - // - // - // - // - - public: - static CustomCrypto^ Create(String^ algorithmName) - { - return (CustomCrypto^) - CryptoConfig::CreateFromName(algorithmName); - } - // - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp deleted file mode 100644 index 0de4308d5f7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp +++ /dev/null @@ -1,129 +0,0 @@ - -// This sample demonstrates how to implement a custom asymmetric algorithm -// inherited from the AsymmetricAlgorithm base class. -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Text; -using namespace System::Security::Cryptography; - -// Display the properties of the specified CustomCrypto object to the -// console. -static void DisplayProperties(Contoso::CustomCrypto^ customCryptoAlgorithm) -{ - // Retrieve the class description for the customCrypto object. - // - String^ classDescription = customCryptoAlgorithm->ToString(); - // - - Console::WriteLine(classDescription); - Console::WriteLine("KeyExchangeAlgorithm: {0}", - customCryptoAlgorithm->KeyExchangeAlgorithm); - Console::WriteLine("SignatureAlgorithm: {0}", - customCryptoAlgorithm->SignatureAlgorithm); - Console::WriteLine("KeySize: {0}", - customCryptoAlgorithm->KeySize); - Console::WriteLine("Parameters described in Xml format:"); - Console::WriteLine(customCryptoAlgorithm->ToXmlString(true)); - - // Display the MinSize, MaxSize, and SkipSize properties of - // each KeySize item in the local keySizes member variable. - // - array^ legalKeySizes = customCryptoAlgorithm->LegalKeySizes; - for (int i = 0; i < legalKeySizes->Length; i++) - { - Console::WriteLine( - "Keysize{0} min, max, step: {1}, {2}, {3}, ", i, - legalKeySizes[i]->MinSize, - legalKeySizes[i]->MaxSize, - legalKeySizes[i]->SkipSize); - } - // -} - -[STAThread] -int main() -{ - // Construct a CustomCrypto object and initialize its - // CspParameters. - Contoso::CustomCrypto^ customCryptoAlgorithm = gcnew Contoso::CustomCrypto(); - customCryptoAlgorithm->InitializeParameters(); - - // Display properties of the current customCrypto object. - Console::WriteLine( - "*** CustomCrypto created with default parameters:"); - DisplayProperties(customCryptoAlgorithm); - - // Release all the resources used by this instance of - // CustomCrypto. - // - customCryptoAlgorithm->Clear(); - // - - customCryptoAlgorithm = gcnew Contoso::CustomCrypto(64); - // Create new parameters and set them by using the FromXmlString - // method. - String^ parameterXml = "" + - "Contoso" + - "SecurityBin2" + - "1" + - "2" + - ""; - customCryptoAlgorithm->FromXmlString(parameterXml); - - // Display the properties of a customCrypto object created with - // custom parameters. - Console::WriteLine( - "{0}*** CustomCrypto created with custom parameters:", Environment::NewLine); - DisplayProperties(customCryptoAlgorithm); - - // Create an object by using the assembly name. - Contoso::CustomCrypto^ cryptoFromAssembly = - Contoso::CustomCrypto::Create("CustomCrypto"); - if (cryptoFromAssembly != nullptr) - { - Console::WriteLine("{0}*** Successfully created " + - "CustomCrypto from the Create method.", Environment::NewLine); - DisplayProperties(cryptoFromAssembly); - } - else - { - Console::WriteLine("Unable to create CustomCrypto from " + - "the Create method."); - } - - Console::WriteLine( - "This sample completed successfully; press Enter to exit."); - Console::ReadLine(); -} - -// -// This sample produces the following output: -// -// *** CustomCrypto created with default parameters: -// Contoso.vbCustomCrypto -// KeyExchangeAlgorithm: RSA-PKCS1-KeyEx -// SignatureAlgorithm: http://www.w3.org/2000/09/xmldsig#rsa-sha1 -// KeySize: 8 -// Parameters described in Xml format: -// SecurityBin1 -// 1Contoso -// 2 -// Keysize0 min, max, step: 8, 64, 8, -// -// *** CustomCrypto created with custom parameters: -// Contoso.vbCustomCrypto -// KeyExchangeAlgorithm: RSA-PKCS1-KeyEx -// SignatureAlgorithm: http://www.w3.org/2000/09/xmldsig#rsa-sha1 -// KeySize: 64 -// Parameters described in Xml format: -// SecurityBin2 -// 1Contoso -// 2 -// Keysize0 min, max, step: 8, 64, 8, -// Unable to create CustomCrypto from the Create method -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp deleted file mode 100644 index 713b1c01bb2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp +++ /dev/null @@ -1,199 +0,0 @@ -// This sample demonstrates how to use each member of the CryptoAPITransform -// class. -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Collections; -using namespace System::Text; - -ref class Members -{ -private: - - // Use a public service provider for encryption and decryption. - static DESCryptoServiceProvider^ des = gcnew DESCryptoServiceProvider; - -public: - [STAThread] - static void Main() - { - String^ message = L"012345678901234567890"; - array^sourceBytes = Encoding::ASCII->GetBytes( message ); - Console::WriteLine( L"** Phrase to be encoded: {0}", message ); - array^encodedBytes = EncodeBytes( sourceBytes ); - Console::WriteLine( L"** Phrase after encoding: {0}", - Encoding::ASCII->GetString( encodedBytes ) ); - array^decodedBytes = DecodeBytes( encodedBytes ); - Console::WriteLine( L"** Phrase after decoding: {0}", - Encoding::ASCII->GetString( decodedBytes ) ); - Console::WriteLine( L"Sample ended successfully; " - L"press Enter to continue." ); - Console::ReadLine(); - } - -private: - // Encode the specified byte array by using CryptoAPITranform. - static array^ EncodeBytes( array^sourceBytes ) - { - int currentPosition = 0; - array^targetBytes = gcnew array(1024); - int sourceByteLength = sourceBytes->Length; - - // Create a DES encryptor from this instance to perform encryption. - CryptoAPITransform^ cryptoTransform = - static_cast(des->CreateEncryptor()); - - // Retrieve the block size to read the bytes. - // - int inputBlockSize = cryptoTransform->InputBlockSize; - // - - // Retrieve the key handle. - // - IntPtr keyHandle = cryptoTransform->KeyHandle; - // - - // Retrieve the block size to write the bytes. - // - int outputBlockSize = cryptoTransform->OutputBlockSize; - // - - try - { - // Determine if multiple blocks can be transformed. - // - if ( cryptoTransform->CanTransformMultipleBlocks ) - // - { - int numBytesRead = 0; - while ( sourceByteLength - currentPosition >= inputBlockSize ) - { - // Transform the bytes from currentPosition in the - // sourceBytes array, writing the bytes to the targetBytes - // array. - // - numBytesRead = cryptoTransform->TransformBlock( - sourceBytes, currentPosition, inputBlockSize, - targetBytes, currentPosition ); - // - // Advance the current position in the sourceBytes array. - currentPosition += numBytesRead; - } - - // Transform the final block of bytes. - // - array^finalBytes = cryptoTransform->TransformFinalBlock( - sourceBytes, currentPosition, sourceByteLength - currentPosition ); - // - - // Copy the contents of the finalBytes array to the - // targetBytes array. - finalBytes->CopyTo( targetBytes, currentPosition ); - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Caught unexpected exception:{0}", ex ); - } - - // Determine if the current transform can be reused. - // - if ( !cryptoTransform->CanReuseTransform ) - // - { - // Free up any used resources. - // - cryptoTransform->Clear(); - // - } - - // Trim the extra bytes in the array that were not used. - return TrimArray( targetBytes ); - } - - // Decode the specified byte array using CryptoAPITranform. - static array^ DecodeBytes( array^sourceBytes ) - { - array^targetBytes = gcnew array(1024); - int currentPosition = 0; - - // Create a DES decryptor from this instance to perform decryption. - CryptoAPITransform^ cryptoTransform = - static_cast(des->CreateDecryptor()); - int inputBlockSize = cryptoTransform->InputBlockSize; - int sourceByteLength = sourceBytes->Length; - try - { - int numBytesRead = 0; - while ( sourceByteLength - currentPosition >= inputBlockSize ) - { - // Transform the bytes from currentposition in the - // sourceBytes array, writing the bytes to the targetBytes - // array. - numBytesRead = cryptoTransform->TransformBlock( - sourceBytes, currentPosition, inputBlockSize, - targetBytes, currentPosition ); - - // Advance the current position in the source array. - currentPosition += numBytesRead; - } - - // Transform the final block of bytes. - array^finalBytes = cryptoTransform->TransformFinalBlock( - sourceBytes, currentPosition, sourceByteLength - currentPosition ); - - // Copy the contents of the finalBytes array to the targetBytes - // array. - finalBytes->CopyTo( targetBytes, currentPosition ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Caught unexpected exception:{0}", ex ); - } - - // Strip out the second block of bytes. - Array::Copy(targetBytes, (inputBlockSize * 2), targetBytes, inputBlockSize, targetBytes->Length - (inputBlockSize * 2)); - - - // Trim the extra bytes in the array that were not used. - return TrimArray( targetBytes ); - } - - // Resize the dimensions of the array to a size that contains only valid - // bytes. - static array^ TrimArray( array^targetArray ) - { - IEnumerator^ enum1 = targetArray->GetEnumerator(); - int i = 0; - while ( enum1->MoveNext() ) - { - if ( enum1->Current->ToString()->Equals( L"0" ) ) - { - break; - } - i++; - } - - // Create a new array with the number of valid bytes. - array^returnedArray = gcnew array(i); - for ( int j = 0; j < i; j++ ) - { - returnedArray[ j ] = targetArray[ j ]; - } - return returnedArray; - } -}; - -int main() -{ - Members::Main(); -} - -// -// This sample produces the following output: -// -// ** Phrase to be encoded: 012345678901234567890 -// ** Phrase after encoding: AIGC(+b7X?^djAU?15ve?o -// ** Phrase after decoding: 012345678901234567890 -// Sample ended successfully; press Enter to continue. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp deleted file mode 100644 index 49ba079bd65..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// This sample demonstrates how to use each member of the CryptoConfig class. -// -using namespace System; -using namespace System::Security::Cryptography; - -int main() -{ - // Create a CryptoConfig object to store configuration information. - // - CryptoConfig^ cryptoConfig = gcnew CryptoConfig; - // - - // Retrieve the class path for CryptoConfig. - // - String^ classDescription = cryptoConfig->ToString(); - // - - // Create a new SHA1 provider. - // - SHA1CryptoServiceProvider^ SHA1alg = - dynamic_cast( - CryptoConfig::CreateFromName( L"SHA1" )); - // - - // Create an RSAParameters with the TestContainer key container. - // - CspParameters^ parameters = gcnew CspParameters; - parameters->KeyContainerName = L"TestContainer"; - array^argsArray = gcnew array(1){ - parameters - }; - - // Instantiate the RSA provider instance accessing the TestContainer - // key container. - RSACryptoServiceProvider^ rsaProvider = - static_cast( - CryptoConfig::CreateFromName( L"RSA", argsArray )); - // - - // Use the MapNameToOID method to get an object identifier - // (OID) from the string name of the SHA1 algorithm. - // - String^ sha1Oid = CryptoConfig::MapNameToOID( L"SHA1" ); - // - - // Encode the specified object identifier. - // - array^encodedMessage = CryptoConfig::EncodeOID( sha1Oid ); - - // - // Display the results to the console. - Console::WriteLine( L"** {0} **", classDescription ); - Console::WriteLine( L"Created an RSA provider with a KeyContainerName called {0}.", - parameters->KeyContainerName ); - Console::WriteLine( L"Object identifier from the SHA1 name:{0}", - sha1Oid ); - Console::WriteLine( L"The object identifier encoded: {0}", - System::Text::Encoding::ASCII->GetString( encodedMessage ) ); - Console::WriteLine( L"This sample completed successfully; press Enter to exit." ); - Console::ReadLine(); -} - -// -// This sample produces the following output: -// -// ** System.Security.Cryptography.CryptoConfig ** -// Created an RSA provider with a KeyContainerName called TestContainer. -// Object identifier from the SHA1 name:1.3.14.3.2.26 -// The object identifier encoded: HH*((*H9 -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp deleted file mode 100644 index fc83f952401..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp +++ /dev/null @@ -1,243 +0,0 @@ -// This sample demonstrates how to use each member of the -// CryptographicException class. -// -using namespace System; -using namespace System::Text; -using namespace System::Security::Cryptography; -using namespace System::Runtime::Serialization; - -ref class CryptographicExceptionMembers -{ -public: - - static void Run() - { - CryptographicExceptionMembers^ testRun = gcnew CryptographicExceptionMembers; - testRun->TestConstructors(); - testRun->ShowProperties(); - Console::WriteLine( L"This sample ended successfully; " - L" press Enter to exit." ); - Console::ReadLine(); - } - -private: - // Test each public implementation of the CryptographicException - // constructors. - void TestConstructors() - { - EmptyConstructor(); - IntConstructor(); - StringConstructor(); - StringExceptionConstructor(); - StringStringConstructor(); - } - - void EmptyConstructor() - { - // Construct a CryptographicException with no parameters. - // - CryptographicException^ cryptographicException = gcnew CryptographicException; - - // - Console::WriteLine( L"Created an empty CryptographicException." ); - } - - void IntConstructor() - { - // Construct a CryptographicException using the error code for an - // unexpected operation exception. - // - int exceptionNumber = (int)0x80131431; - CryptographicException^ cryptographicException = gcnew CryptographicException( exceptionNumber ); - // - - Console::WriteLine( L"Created a CryptographicException with the " - L"following error code: {0}", exceptionNumber ); - } - - void StringConstructor() - { - // Construct a CryptographicException using a custom error message. - // - String^ errorMessage = (L"Unexpected Operation exception."); - CryptographicException^ cryptographicException = gcnew CryptographicException( errorMessage ); - // - - Console::WriteLine( L"Created a CryptographicException with the " - L"following error message: {0}", errorMessage ); - } - - void StringExceptionConstructor() - { - // Construct a CryptographicException using a custom error message - // and an inner exception. - // - String^ errorMessage = (L"The current operation is not supported."); - NullReferenceException^ nullException = gcnew NullReferenceException; - CryptographicException^ cryptographicException = gcnew CryptographicException( errorMessage,nullException ); - // - - Console::WriteLine( L"Created a CryptographicException with the " - L"following error message: {0} and the inner exception of {1}", errorMessage, nullException ); - } - - void StringStringConstructor() - { - // Create a CryptographicException using a time format and a the - // current date. - // - String^ dateFormat = L"{0:t}"; - String^ timeStamp = (DateTime::Now.ToString()); - CryptographicException^ cryptographicException = gcnew CryptographicException( dateFormat,timeStamp ); - // - - Console::WriteLine( L"Created a CryptographicException with ({0}) as the format and ({1}) as the message.", dateFormat, timeStamp ); - } - - // Construct an invalid DSACryptoServiceProvider to throw a - // CryptographicException for introspection. - void ShowProperties() - { - try - { - // Create a DSACryptoServiceProvider with invalid provider type - // code to throw a CryptographicException exception. - CspParameters^ cspParams = gcnew CspParameters( 44 ); - DSACryptoServiceProvider^ DSAalg = gcnew DSACryptoServiceProvider( cspParams ); - } - catch ( CryptographicException^ ex ) - { - // Retrieve the link to the help file for the exception. - // - String^ helpLink = ex->HelpLink; - // - - // Retrieve the exception that caused the current - // CryptographicException exception. - // - System::Exception^ innerException = ex->InnerException; - // - - String^ innerExceptionMessage = L""; - if ( innerException != nullptr ) - { - innerExceptionMessage = innerException->ToString(); - } - - // Retrieve the message that describes the exception. - // - String^ message = ex->Message; - // - - // Retrieve the name of the application that caused the exception. - // - String^ exceptionSource = ex->Source; - // - - // Retrieve the call stack at the time the exception occurred. - // - String^ stackTrace = ex->StackTrace; - // - - // Retrieve the method that threw the exception. - // - System::Reflection::MethodBase^ targetSite = ex->TargetSite; - // - - String^ siteName = targetSite->Name; - - // Retrieve the entire exception as a single string. - // - String^ entireException = ex->ToString(); - // - - // GetObjectData - setSerializationInfo( &ex ); - - // Get the root exception that caused the current - // CryptographicException exception. - // - System::Exception^ baseException = ex->GetBaseException(); - // - - String^ baseExceptionMessage = L""; - if ( baseException != nullptr ) - { - baseExceptionMessage = baseException->Message; - } - Console::WriteLine( L"Caught an expected exception:" ); - Console::WriteLine( entireException ); - Console::WriteLine( L"\n" ); - Console::WriteLine( L"Properties of the exception are as follows:" ); - Console::WriteLine( L"Message: {0}", message ); - Console::WriteLine( L"Source: {0}", exceptionSource ); - Console::WriteLine( L"Stack trace: {0}", stackTrace ); - Console::WriteLine( L"Help link: {0}", helpLink ); - Console::WriteLine( L"Target site's name: {0}", siteName ); - Console::WriteLine( L"Base exception message: {0}", baseExceptionMessage ); - Console::WriteLine( L"Inner exception message: {0}", innerExceptionMessage ); - } - - } - - void setSerializationInfo( interior_ptr ex ) - { - // Insert information about the exception into a serialized object. - // - FormatterConverter^ formatConverter = gcnew FormatterConverter; - SerializationInfo^ serializationInfo = gcnew SerializationInfo( ( *ex)->GetType(),formatConverter ); - StreamingContext streamingContext = StreamingContext(StreamingContextStates::All); - ( *ex)->GetObjectData( serializationInfo, streamingContext ); - // - } - -}; - -void main() -{ - CryptographicExceptionMembers::Run(); -} - -// -// This sample produces the following output: -// -// Created an empty CryptographicException. -// Created a CryptographicException with the following error code: -2146233295 -// Created a CryptographicException with the following error message: -// Unexpected Operation exception. -// Created a CryptographicException with the following error message: The -// current operation is not supported. and the inner exception of -// System.NullReferenceException: Object reference not set to an instance of -// an object. -// Created a CryptographicException with ({0:t}) as the format and (2/24/2004 -// 2:13:15 PM) as the message. -// Caught an expected exception: -// System.Security.Cryptography.CryptographicException: CryptoAPI -// cryptographic service provider (CSP) for this implementation could not be -// acquired. -// at System.Security.Cryptography.DSACryptoServiceProvider..ctor(Int32 -// dwKeySize, CspParameters parameters) -// at System.Security.Cryptography.DSACryptoServiceProvider..ctor( -// CspParametersparameters) -// at CryptographicExceptionMembers.ShowProperties() in c:\inetpub\ -// vssolutions\test\testbuild\consoleapplication1\class1.cs:line 109 -// -// -// Properties of the exception are as follows: -// Message: CryptoAPI cryptographic service provider (CSP) for this -// implementation could not be acquired. -// Source: mscorlib -// Stack trace: -// at System.Security.Cryptography.DSACryptoServiceProvider..ctor( -// Int32 dwKeySize, CspParameters parameters) -// at System.Security.Cryptography.DSACryptoServiceProvider..ctor( -// CspParameters parameters) -// at CryptographicExceptionMembers.ShowProperties() in c:\inetpub\ -// vssolutions\test\testbuild\consoleapplication1\class1.cs:line 109 -// Help link: -// Target site's name: .ctor -// Base exception message: CryptoAPI cryptographic service provider (CSP) for -// this implementation could not be acquired. -// Inner exception message: -// This sample ended successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp deleted file mode 100644 index 463fd5703f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Security::Cryptography; -int main() -{ - try - { - - //Create a new instance of DSA. - DSA^ DSA = DSA::Create(); - - //The hash to sign. - array^Hash = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135}; - - //Create an DSASignatureFormatter object and pass it the - //DSA instance to transfer the key information. - DSASignatureFormatter^ DSAFormatter = gcnew DSASignatureFormatter( DSA ); - - //Set the hash algorithm to SHA1. - DSAFormatter->SetHashAlgorithm( "SHA1" ); - - //Create a signature for HashValue and return it. - array^SignedHash = DSAFormatter->CreateSignature( Hash ); - - //Create an DSASignatureDeformatter object and pass it the - //DSA instance to transfer the key information. - DSASignatureDeformatter^ DSADeformatter = gcnew DSASignatureDeformatter( DSA ); - - //Verify the hash and display the results to the console. - if ( DSADeformatter->VerifySignature( Hash, SignedHash ) ) - { - Console::WriteLine( "The signature was verified." ); - } - else - { - Console::WriteLine( "The signature was not verified." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp deleted file mode 100644 index bc448969175..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Security::Cryptography; -int main() -{ - try - { - - //Create a new instance of DSA. - DSA^ DSA = DSA::Create(); - - //The hash to sign. - array^Hash = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135}; - - //Create an DSASignatureFormatter Object* and pass it the - //DSA instance to transfer the key information. - DSASignatureFormatter^ DSAFormatter = gcnew DSASignatureFormatter( DSA ); - - //Set the hash algorithm to SHA1. - DSAFormatter->SetHashAlgorithm( "SHA1" ); - - //Create a signature for HashValue and return it. - array^SignedHash = DSAFormatter->CreateSignature( Hash ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp deleted file mode 100644 index 2d3ec8ddc55..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; -class MyMainClass -{ -public: - static void DecodeFromFile( String^ inFileName, String^ outFileName ) - { - FromBase64Transform^ myTransform = gcnew FromBase64Transform( FromBase64TransformMode::IgnoreWhiteSpaces ); - array^myOutputBytes = gcnew array(myTransform->OutputBlockSize); - - //Open the input and output files. - FileStream^ myInputFile = gcnew FileStream( inFileName,FileMode::Open,FileAccess::Read ); - FileStream^ myOutputFile = gcnew FileStream( outFileName,FileMode::Create,FileAccess::Write ); - - //Retrieve the file contents into a Byte array. - array^myInputBytes = gcnew array(myInputFile->Length); - myInputFile->Read( myInputBytes, 0, myInputBytes->Length ); - - //Transform the data in chunks the size of InputBlockSize. - int i = 0; - while ( myInputBytes->Length - i > 4 ) - { - myTransform->TransformBlock( myInputBytes, i, 4, myOutputBytes, 0 ); - - /*myTransform->InputBlockSize*/ - i += 4; - - /*myTransform->InputBlockSize*/ - myOutputFile->Write( myOutputBytes, 0, myTransform->OutputBlockSize ); - } - - - //Transform the final block of data. - myOutputBytes = myTransform->TransformFinalBlock( myInputBytes, i, myInputBytes->Length - i ); - myOutputFile->Write( myOutputBytes, 0, myOutputBytes->Length ); - - //Free up any used resources. - myTransform->Clear(); - myInputFile->Close(); - myOutputFile->Close(); - } - -}; - -int main() -{ - MyMainClass * m = new MyMainClass; - - //Insert your file names into this method call. - m->DecodeFromFile( "c:\\encoded.txt", "c:\\roundtrip.txt" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp deleted file mode 100644 index 7ac5fae23ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// This sample demonstrates how to use each member of the KeySizes class. -// - -using namespace System; -using namespace System::Security::Cryptography; - -namespace CryptographySample -{ - ref class KeySizesMembers - { - public: - static void Work() - { - // Initializes a new instance of the KeySizes class - // with the specified key values. - // - int minSize = 64; - int maxSize = 1024; - int skipSize = 64; - KeySizes^ keySizes = - gcnew KeySizes(minSize, maxSize, skipSize); - // - - // Show the values of the keys. - ShowKeys(gcnew array(1) {keySizes}, - "Custom Keys"); - - // Create a new symmetric algorithm and display its - // key values. - Aes^ aes = Aes::Create(); - ShowKeys(aes->LegalKeySizes, aes->ToString()); - Console::WriteLine("aes.blocksize:{0}", - aes->BlockSize); - - // Create a new RSA algorithm and display its key values. - RSA^ rsa = RSA::Create(); - ShowKeys(rsa->LegalKeySizes, rsa->ToString()); - Console::WriteLine("RSA KeySize =" - " {0}", - rsa->KeySize); - - Console::WriteLine("This sample completed successfully; " - "press Enter to exit."); - Console::ReadLine(); - } - - private: - // Display specified KeySize properties to the console. - static void ShowKeys(array ^ keySizes, - String^ objectName) - { - // Retrieve the first KeySizes in the array. - KeySizes^ firstKeySize = keySizes[0]; - - // Retrieve the minimum key size in bits. - // - int minKeySize = firstKeySize->MinSize; - // - - // Retrieve the maximum key size in bits. - // - int maxKeySize = firstKeySize->MaxSize; - // - - // Retrieve the interval between valid key size in bits. - // - int skipKeySize = firstKeySize->SkipSize; - // - - Console::Write("\n KeySizes retrieved from the "); - Console::WriteLine("{0} object.", objectName); - Console::WriteLine("Minimum key size bits: {0}", - minKeySize); - Console::WriteLine("Maximum key size bits: {0}", - maxKeySize); - Console::WriteLine("Interval between key size bits: {0}", - skipKeySize); - } - }; -} - -using namespace CryptographySample; - -int main() -{ - KeySizesMembers::Work(); -} -// -// This sample produces the following output: -// -// KeySizes retrieved from the Custom Keys object. -// Minimum key size bits: 64 -// Maximum key size bits: 1024 -// Interval between key size bits: 64 -// -// KeySizes retrieved from the -// System.Security.Cryptography.Aes object. -// Minimum key size bits: 128 -// Maximum key size bits: 256 -// Interval between key size bits: 64 -// aes.blocksize:128 -// -// KeySizes retrieved from the -// System.Security.Cryptography.RSA object. -// Minimum key size bits: 512 -// Maximum key size bits: 16384 -// Interval between key size bits: 64 -// RSA KeySize = 2048 -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp deleted file mode 100644 index d25c4d73ac5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// This sample demonstrates how to extend the KeyedHashAlgorithm class. -// -using namespace System; -using namespace System::Security::Cryptography; - -namespace Contoso -{ - public ref class ContosoKeyedHash: public KeyedHashAlgorithm - { - private: - KeyedHashAlgorithm^ keyedCrypto; - - public: - ContosoKeyedHash( array^ rgbKey ) - { - Init( L"System.Security.Cryptography.KeyedHashAlgorithm", rgbKey ); - } - - ContosoKeyedHash( String^ keyedHashName, array^ rgbKey ) - { - Init( keyedHashName, rgbKey ); - } - - void Init( String^ keyedHashName, array^ rgbKey ) - { - // Make sure we know which algorithm to use - if ( rgbKey != nullptr ) - { - KeyValue = rgbKey; - HashSizeValue = 160; - - // Create a KeyedHashAlgorithm encryptor - if ( keyedHashName == nullptr ) - { - - // - keyedCrypto = KeyedHashAlgorithm::Create(); - // - } - else - { - // - keyedCrypto = KeyedHashAlgorithm::Create( keyedHashName ); - // - } - } - else - { - throw gcnew ArgumentNullException( L"rgbKey" ); - } - } - - // Override abstract methods from the HashAlgorithm class. - virtual void Initialize() override {} - - property array^ Key - { - // - virtual array^ get() override - { - return dynamic_cast^>(keyedCrypto->Key->Clone()); - } - - virtual void set( array^value ) override - { - keyedCrypto->Key = dynamic_cast^>(value->Clone()); - } - } - // - - protected: - virtual void HashCore( array^ , int /*ibStart*/, int /*cbSize*/ ) override {} - - virtual array^ HashFinal() override - { - return gcnew array(0); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp deleted file mode 100644 index 3c77ea0c947..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// This sample demonstrates how to derive from -// the MaskGenerationMethod class. -// -#using - -using namespace System; -using namespace System::Security::Cryptography; - -namespace Contoso -{ - // - ref class MaskGenerator: MaskGenerationMethod - { - private: - String^ hashNameValue; - - public: - // Initialize a mask to encrypt using the SHA256 algorithm. - MaskGenerator() - { - hashNameValue = "SHA256"; - } - - // - // Create a mask with the specified seed. - // - virtual array^ GenerateMask(array^ seed, int maskLength) override - { - HashAlgorithm^ hash; - array^ rgbCounter = gcnew array(4); - array^ targetRgb = gcnew array(maskLength); - UInt32 counter = 0; - for (int inc = 0; inc < targetRgb->Length; ) - { - ConvertIntToByteArray(counter++, rgbCounter); - hash = (HashAlgorithm^)CryptoConfig::CreateFromName( - hashNameValue); - array^ temp = gcnew array( - 4 + seed->Length); - Buffer::BlockCopy(rgbCounter, 0, temp, 0, 4); - Buffer::BlockCopy(seed, 0, temp, 4, seed->Length); - hash->ComputeHash(temp); - if (targetRgb->Length - inc > hash->HashSize / 8) - { - Buffer::BlockCopy(hash->Hash, 0, targetRgb, inc, - hash->Hash->Length); - } - else - { - Buffer::BlockCopy(hash->Hash, 0, targetRgb, inc, - targetRgb->Length - inc); - } - - inc += hash->Hash->Length; - } - return targetRgb; - } - - private: - // - // Convert the specified integer to the byte array. - void ConvertIntToByteArray(UInt32 source, - array^ targetBytes) - { - UInt32 remainder; - int inc = 0; - - // Clear the array prior to filling it. - Array::Clear(targetBytes, 0, targetBytes->Length); - while (source > 0) - { - remainder = source % 256; - targetBytes[ 3 - inc ] = (Byte)remainder; - source = (source - remainder) / 256; - inc++; - } - } - }; - - // This class demonstrates how to create the MaskGenerator class - // and call its GenerateMask member. - ref class MaskGeneratorImpl - { - public: - void static Work() - { - array^ seed = gcnew array(4){ - 0x01,0x02,0x03,0x04}; - int length = 16; - MaskGenerator^ maskGenerator = gcnew MaskGenerator; - array^ mask = maskGenerator->GenerateMask(seed, - length); - Console::WriteLine("Generated the following mask:"); - Console::WriteLine(System::Text::Encoding:: - ASCII::get()->GetString(mask)); - Console::WriteLine("This sample completed successfully;" - " press Enter to exit."); - Console::ReadLine(); - } - }; -} - -void main() -{ - Contoso::MaskGeneratorImpl::Work(); -} - -// -// This sample produces the following output: -// -// Generated the following mask: -// ?"TFd(?~OtO? -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp deleted file mode 100644 index 18a61d351be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Security::Cryptography; -int main() -{ - try - { - - //initialze the Byte arrays to the public key information. - array^PublicKey = {214,46,220,83,160,73,40,39,201,155,19,202,3,11,191,178,56,74,90,36,248,103,18,144,170,163,145,87,54,61,34,220,222,207,137,149,173,14,92,120,206,222,158,28,40,24,30,16,175,108,128,35,230,118,40,121,113,125,216,130,11,24,90,48,194,240,105,44,76,34,57,249,228,125,80,38,9,136,29,117,207,139,168,181,85,137,126,10,126,242,120,247,121,8,100,12,201,171,38,226,193,180,190,117,177,87,143,242,213,11,44,180,113,93,106,99,179,68,175,211,164,116,64,148,226,254,172,147}; - array^Exponent = {1,0,1}; - - //Values to store encrypted symmetric keys. - array^EncryptedSymmetricKey; - array^EncryptedSymmetricIV; - - //Create a new instance of RSACryptoServiceProvider. - RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; - - //Create a new instance of RSAParameters. - RSAParameters RSAKeyInfo; - - //Set RSAKeyInfo to the public key values. - RSAKeyInfo.Modulus = PublicKey; - RSAKeyInfo.Exponent = Exponent; - - //Import key parameters into RSA. - RSA->ImportParameters( RSAKeyInfo ); - - //Create a new instance of the Aes class. - Aes^ aes = Aes::Create(); - - //Encrypt the symmetric key and IV. - EncryptedSymmetricKey = RSA->Encrypt( aes->Key, false ); - EncryptedSymmetricIV = RSA->Encrypt( aes->IV, false ); - Console::WriteLine( "Aes Key and IV have been encrypted with RSACryptoServiceProvider." ); - } - catch ( CryptographicException^ e ) - { - - //Catch and display a CryptographicException - //to the console. - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp deleted file mode 100644 index 92218fec226..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using - -using namespace System; -using namespace System::Security::Cryptography; -void main() -{ - // - try - { - //Create a new RSACryptoServiceProvider Object*. - RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; - - //Export the key information to an RSAParameters object. - //Pass false to export the public key information or pass - //true to export public and private key information. - RSAParameters RSAParams = RSA->ExportParameters( false ); - } - catch ( CryptographicException^ e ) - { - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( e->Message ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp deleted file mode 100644 index a5bf383b029..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using - -using namespace System; -using namespace System::Security::Cryptography; - -int main() -{ - // - try - { - //Create a new RSACryptoServiceProvider object. - RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; - - //Export the key information to an RSAParameters object. - //Pass false to export the public key information or pass - //true to export public and private key information. - RSAParameters RSAParams = RSA->ExportParameters( false ); - - //Create another RSACryptoServiceProvider object. - RSACryptoServiceProvider^ RSA2 = gcnew RSACryptoServiceProvider; - - //Import the key information from the other - //RSACryptoServiceProvider object. - RSA2->ImportParameters( RSAParams ); - } - catch ( CryptographicException^ e ) - { - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( e->Message ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp deleted file mode 100644 index 9f6ac45281c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; -array^ RSAEncrypt( array^DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) -{ - try - { - - //Create a new instance of RSACryptoServiceProvider. - RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; - - //Import the RSA Key information. This only needs - //toinclude the public key information. - RSA->ImportParameters( RSAKeyInfo ); - - //Encrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - - array^encryptedData = RSA->Encrypt( DataToEncrypt, DoOAEPPadding ); - delete RSA; - return encryptedData; - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - return nullptr; - } - -} - -array^ RSADecrypt( array^DataToDecrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) -{ - try - { - - //Create a new instance of RSACryptoServiceProvider. - RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; - - //Import the RSA Key information. This needs - //to include the private key information. - RSA->ImportParameters( RSAKeyInfo ); - - //Decrypt the passed byte array and specify OAEP padding. - //OAEP padding is only available on Microsoft Windows XP or - //later. - - array^decryptedData = RSA->Decrypt( DataToDecrypt, DoOAEPPadding ); - delete RSA; - return decryptedData; - } - //Catch and display a CryptographicException - //to the console. - catch ( CryptographicException^ e ) - { - Console::WriteLine( e ); - return nullptr; - } - -} - -int main() -{ - try - { - - //Create a UnicodeEncoder to convert between byte array and string. - UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; - - //Create byte arrays to hold original, encrypted, and decrypted data. - array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); - array^encryptedData; - array^decryptedData; - - //Create a new instance of RSACryptoServiceProvider to generate - //public and private key data. - RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; - - //Pass the data to ENCRYPT, the public key information - //(using RSACryptoServiceProvider.ExportParameters(false), - //and a boolean flag specifying no OAEP padding. - encryptedData = RSAEncrypt( dataToEncrypt, RSA->ExportParameters( false ), false ); - - //Pass the data to DECRYPT, the private key information - //(using RSACryptoServiceProvider.ExportParameters(true), - //and a boolean flag specifying no OAEP padding. - decryptedData = RSADecrypt( encryptedData, RSA->ExportParameters( true ), false ); - - //Display the decrypted plaintext to the console. - Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); - delete RSA; - } - catch ( ArgumentNullException^ ) - { - - //Catch this exception in case the encryption did - //not succeed. - Console::WriteLine( "Encryption failed." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp deleted file mode 100644 index cb8ce0d69c9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// This sample demonstrates how to encode and decode a string using -// the RSAOAEPKeyExchangeFormatter and RSAOAEPKeyExchangeDeformatter classes. -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; - -ref class RSAEncoder -{ -private: - // Use a member variable to hold the RSA key for encoding and decoding. - RSA^ rsaKey; - -public: - [STAThread] - static void Main() - { - String^ message = L"A phrase to be encoded."; - RSAEncoder^ rsaEncoder = gcnew RSAEncoder; - rsaEncoder->InitializeKey( RSA::Create() ); - Console::WriteLine( L"Encoding the following message:" ); - Console::WriteLine( message ); - array^encodedMessage = rsaEncoder->EncodeMessage( message ); - Console::WriteLine( L"Resulting message encoded:" ); - Console::WriteLine( Encoding::ASCII->GetString( encodedMessage ) ); - String^ decodedMessage = rsaEncoder->DecodeMessage( encodedMessage ); - Console::WriteLine( L"Resulting message decoded:" ); - Console::WriteLine( decodedMessage ); - - // Construct a formatter to demonstrate how to set each property. - rsaEncoder->ConstructFormatter(); - - // Construct a deformatter to demonstrate how to set each property. - rsaEncoder->ConstructDeformatter(); - Console::WriteLine( L"This sample completed successfully, " - L" press enter to continue." ); - Console::ReadLine(); - } - - -private: - // Initialize an rsaKey member variable with the specified RSA key. - void InitializeKey( RSA^ key ) - { - rsaKey = key; - } - - // Use the RSAOAEPKeyExchangeDeformatter class to decode the - // specified message. - array^ EncodeMessage( String^ message ) - { - array^encodedMessage = nullptr; - try - { - - // Construct a formatter with the specified RSA key. - // - RSAOAEPKeyExchangeFormatter^ keyEncryptor = - gcnew RSAOAEPKeyExchangeFormatter( rsaKey ); - // - - // Convert the message to bytes to create the encrypted data. - // - array^byteMessage = Encoding::ASCII->GetBytes( message ); - encodedMessage = keyEncryptor->CreateKeyExchange( byteMessage ); - // - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Unexpected exception caught:{0}", ex ); - } - - return encodedMessage; - } - - // Use the RSAOAEPKeyExchangeDeformatter class to decode the - // specified message. - String^ DecodeMessage( array^encodedMessage ) - { - String^ decodedMessage = nullptr; - try - { - // Construct a deformatter with the specified RSA key. - // - RSAOAEPKeyExchangeDeformatter^ keyDecryptor = - gcnew RSAOAEPKeyExchangeDeformatter( rsaKey ); - // - - // Decrypt the encoded message. - // - array^decodedBytes = keyDecryptor->DecryptKeyExchange( encodedMessage ); - // - - // Retrieve a string representation of the decoded message. - decodedMessage = Encoding::ASCII->GetString( decodedBytes ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Unexpected exception caught:{0}", ex ); - } - - return decodedMessage; - } - - - // Create an RSAOAEPKeyExchangeFormatter object with a new RSA key. - // Display its properties to the console. - void ConstructFormatter() - { - // Construct an empty Optimal Asymmetric Encryption Padding (OAEP) - // key exchange. - // - RSAOAEPKeyExchangeFormatter^ rsaFormatter = gcnew RSAOAEPKeyExchangeFormatter; - // - - // Create an RSA and set it into the specified - // RSAOAEPKeyExchangeFormatter. - // - RSA^ key = RSA::Create(); - rsaFormatter->SetKey( key ); - // - - // Create a random number using the RNGCryptoServiceProvider provider. - // - RandomNumberGenerator^ ring = RandomNumberGenerator::Create(); - rsaFormatter->Rng = ring; - // - - // Export InverseQ and set it into the RSAOAEPKeyExchangeFormatter. - // - rsaFormatter->Parameter = key->ExportParameters( true ).InverseQ; - // - - Console::WriteLine(); - Console::WriteLine( L"**{0}**", rsaFormatter ); - Console::Write( L"The following random number was generated using the " ); - Console::WriteLine( L"class:" ); - Console::WriteLine( rsaFormatter->Rng ); - Console::WriteLine(); - Console::Write( L"The RSA formatter contains the following InverseQ" ); - Console::WriteLine( L" parameter:" ); - Console::WriteLine( Encoding::ASCII->GetString( rsaFormatter->Parameter ) ); - Console::WriteLine(); - - // - String^ xmlParameters = rsaFormatter->Parameters; - // - - Console::WriteLine( L"The RSA formatter has the following parameters:" ); - Console::WriteLine( xmlParameters ); - } - - // Create an RSAOAEPKeyExchangeDeformatter object with a new RSA key. - // Display its properties to the console. - void ConstructDeformatter() - { - // Construct an empty OAEP key exchange. - // - RSAOAEPKeyExchangeDeformatter^ rsaDeformatter = - gcnew RSAOAEPKeyExchangeDeformatter; - // - - // Create an RSAKey and set it into the specified - // RSAOAEPKeyExchangeFormatter. - // - RSA^ key = RSA::Create(); - rsaDeformatter->SetKey( key ); - // - - Console::WriteLine(); - Console::WriteLine( L"**{0}**", rsaDeformatter ); - - // - String^ xmlParameters = rsaDeformatter->Parameters; - // - - Console::WriteLine(); - Console::WriteLine( L"The RSA deformatter has the following " ); - Console::WriteLine( L"parameters:{0}", xmlParameters ); - } -}; - -int main() -{ - RSAEncoder::Main(); -} - -// -// This sample produces the following output: -// -// Encoding the following message: -// A phrase to be encoded. -// Resulting message encoded: %?}T:v??xu?eD)YucItjwu¦ALH HB,Uj??2xq?.?s45 -// ?f?L2?=X?CPzWx???"q5?6&N"AE,Z+T?(]S?_7~,?G{?VV!:S?df? -// Resulting message decoded: -// A phrase to be encoded. -// -// **System.Security.Cryptography.RSAOAEPKeyExchangeFormatter** -// The following random number was generated using the class: -// System.Security.Cryptography.RNGCryptoServiceProvider -// -// The RSA formatter contains the following InverseQ parameter: -// 3MM??]D#?mBq_;:ws^1?ko??,_ ??A[hyWcP$?`v.>@?^!dU%\?H0N'??Ca?Ns -// -// The RSA formatter has the following parameters: -// -// -// **System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter** -// -// The RSA deformatter has the following -// parameters: -// This sample completed successfully, press enter to continue. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp deleted file mode 100644 index 1cf5a6c9d9b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// This sample demonstrates how to use each member of the ToBase64Transform -// class. The file named members.cs is read in and written out as a -// transformed file named members.enc. -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Cryptography; - -ref class Members -{ -public: - [STAThread] - static void Main() - { - String^ appPath = (String::Concat( - System::IO::Directory::GetCurrentDirectory(), L"\\" )); - - // Insert your file names into this method call. - EncodeFromFile( String::Concat( appPath, L"members.cpp" ), - String::Concat( appPath, L"members.enc" ) ); - Console::WriteLine( L"This sample completed successfully; " - L"press Enter to exit." ); - Console::ReadLine(); - } - -private: - // Read in the specified source file and write out an encoded target file. - static void EncodeFromFile( String^ sourceFile, String^ targetFile ) - { - // Verify members.cpp exists at the specified directory. - if ( !File::Exists( sourceFile ) ) - { - Console::Write( L"Unable to locate source file located at " ); - Console::WriteLine( L"{0}.", sourceFile ); - Console::Write( L"Please correct the path and run the " ); - Console::WriteLine( L"sample again." ); - return; - } - - // Retrieve the input and output file streams. - FileStream^ inputFileStream = gcnew FileStream( - sourceFile,FileMode::Open,FileAccess::Read ); - FileStream^ outputFileStream = gcnew FileStream( - targetFile,FileMode::Create,FileAccess::Write ); - - // Create a new ToBase64Transform object to convert to base 64. - // - ToBase64Transform^ base64Transform = gcnew ToBase64Transform; - // - - // Create a new byte array with the size of the output block size. - // - array^outputBytes = gcnew array( - base64Transform->OutputBlockSize); - // - - // Retrieve the file contents into a byte array. - array^inputBytes = gcnew array(inputFileStream->Length); - inputFileStream->Read( inputBytes, 0, inputBytes->Length ); - - // Verify that multiple blocks can not be transformed. - // - if ( !base64Transform->CanTransformMultipleBlocks ) - // - { - // Initializie the offset size. - int inputOffset = 0; - - // Iterate through inputBytes transforming by blockSize. - // - // - int inputBlockSize = base64Transform->InputBlockSize; - // - while ( inputBytes->Length - inputOffset > inputBlockSize ) - { - base64Transform->TransformBlock( - inputBytes, - inputOffset, - inputBytes->Length - inputOffset, - outputBytes, - 0 ); - - inputOffset += base64Transform->InputBlockSize; - outputFileStream->Write( - outputBytes, - 0, - base64Transform->OutputBlockSize ); - } - // - - // Transform the final block of data. - // - outputBytes = base64Transform->TransformFinalBlock( - inputBytes, - inputOffset, - inputBytes->Length - inputOffset ); - // - outputFileStream->Write( outputBytes, 0, outputBytes->Length ); - Console::WriteLine( L"Created encoded file at {0}", targetFile ); - } - - // Determine if the current transform can be reused. - // - if ( !base64Transform->CanReuseTransform ) - // - { - // Free up any used resources. - // - base64Transform->Clear(); - // - } - - // Close file streams. - inputFileStream->Close(); - outputFileStream->Close(); - } -}; - -int main() -{ - Members::Main(); -} - -// -// This sample produces the following output: -// -// Created encoded file at C:\ConsoleApplication1\\membersvcs.enc -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp deleted file mode 100644 index 080c61111a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp +++ /dev/null @@ -1,132 +0,0 @@ - - -// -// -// This example signs a file specified by a URI -// using a detached signature. It then verifies -// the signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ Key ) -{ - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml; - - // Assign the key to the SignedXml object. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - - // Add the passed URI to the reference object. - reference->Uri = URIString; - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); - xmlDigitalSignature->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyDetachedSignature( String^ XmlSigFileName ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Load the passed XML file into the document. - xmlDocument->Load( XmlSigFileName ); - - // Create a new SignedXMl object. - SignedXml^ signedXml = gcnew SignedXml; - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// - -[STAThread] -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // The URI to sign. - String^ resourceToSign = "http://www.microsoft.com"; - - // The name of the file to which to save the XML signature. - String^ XmlFileName = "xmldsig.xml"; - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - Console::WriteLine( "Signing: {0}", resourceToSign ); - - // Sign the detached resourceand save the signature in an XML file. - SignDetachedResource( resourceToSign, XmlFileName, Key ); - Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - - //Verify the XML signature in the XML file. - bool result = VerifyDetachedSignature( XmlFileName ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp deleted file mode 100644 index 780d8fbafbf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp +++ /dev/null @@ -1,171 +0,0 @@ - - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", Key ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp deleted file mode 100644 index d4942102cf3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp +++ /dev/null @@ -1,132 +0,0 @@ - - -// -// -// This example signs a file specified by a URI -// using a detached signature. It then verifies -// the signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignDetachedResource( String^ URIString, String^ XmlSigFileName, DSA^ DSAKey ) -{ - - // Create a SignedXml Object*. - SignedXml^ signedXml = gcnew SignedXml; - - // Assign the DSA key to the SignedXml object. - signedXml->SigningKey = DSAKey; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - - // Add the passed URI to the reference object. - reference->Uri = URIString; - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add a DSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew DSAKeyValue( safe_cast(DSAKey) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); - xmlDigitalSignature->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyDetachedSignature( String^ XmlSigFileName ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Load the passed XML file into the document. - xmlDocument->Load( XmlSigFileName ); - - // Create a new SignedXMl object. - SignedXml^ signedXml = gcnew SignedXml; - - // Find the S"Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// - -[STAThread] -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // The URI to sign. - String^ resourceToSign = "http://www.microsoft.com"; - - // The name of the file to which to save the XML signature. - String^ XmlFileName = "xmldsig.xml"; - try - { - - // Generate a DSA signing key. - DSA^ DSAKey = DSA::Create(); - Console::WriteLine( "Signing: {0}", resourceToSign ); - - // Sign the detached resourceand save the signature in an XML file. - SignDetachedResource( resourceToSign, XmlFileName, DSAKey ); - Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - - //Verify the XML signature in the XML file. - bool result = VerifyDetachedSignature( XmlFileName ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp deleted file mode 100644 index 20276a9a84d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp +++ /dev/null @@ -1,174 +0,0 @@ - - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, DSA^ DSAKey ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the DSA key to the SignedXml document. - signedXml->SigningKey = DSAKey; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add a transformation to the reference. - Transform^ trns = gcnew XmlDsigC14NTransform; - reference->AddTransform( trns ); - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add a DSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew DSAKeyValue( safe_cast(DSAKey) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate a DSA signing key. - DSA^ DSAKey = DSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", DSAKey ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp deleted file mode 100644 index aca4a856e3f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - -// -// -// This example signs a file specified by a URI -// using a detached signature. It then verifies -// the signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ Key, String^ Certificate ) -{ - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml; - - // Assign the key to the SignedXml object. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - - // Add the passed URI to the reference object. - reference->Uri = URIString; - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Create a new KeyInfo object. - KeyInfo^ keyInfo = gcnew KeyInfo; - - // Load the X509 certificate. - X509Certificate^ MSCert = X509Certificate::CreateFromCertFile( Certificate ); - - // Load the certificate into a KeyInfoX509Data object - // and add it to the KeyInfo object. - keyInfo->AddClause( gcnew KeyInfoX509Data( MSCert ) ); - - // Add the KeyInfo object to the SignedXml object. - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); - xmlDigitalSignature->WriteTo( xmltw ); - xmltw->Close(); -} - - -// - -[STAThread] -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // The URI to sign. - String^ resourceToSign = "http://www.microsoft.com"; - - // The name of the file to which to save the XML signature. - String^ XmlFileName = "xmldsig.xml"; - - // The name of the X509 certificate - String^ Certificate = "microsoft.cer"; - try - { - - // Generate a signing key. This key should match the certificate. - RSA^ Key = RSA::Create(); - Console::WriteLine( "Signing: {0}", resourceToSign ); - - // Sign the detached resource and save the signature in an XML file. - SignDetachedResource( resourceToSign, XmlFileName, Key, Certificate ); - Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp deleted file mode 100644 index 31aee98e1a6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp +++ /dev/null @@ -1,135 +0,0 @@ - - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, String^ Certificate ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Create a new KeyInfo object. - KeyInfo^ keyInfo = gcnew KeyInfo; - - // Load the X509 certificate. - X509Certificate^ MSCert = X509Certificate::CreateFromCertFile( Certificate ); - - // Load the certificate into a KeyInfoX509Data object - // and add it to the KeyInfo object. - keyInfo->AddClause( gcnew KeyInfoX509Data( MSCert ) ); - - // Add the KeyInfo object to the SignedXml object. - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - String^ Certificate = "microsoft.cer"; - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", Key, Certificate ); - Console::WriteLine( "XML file signed." ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp deleted file mode 100644 index 43ae77e2392..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp +++ /dev/null @@ -1,170 +0,0 @@ - - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ RSAKey ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the RSA key to the SignedXml document. - signedXml->SigningKey = RSAKey; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add a RSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(RSAKey) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate a RSA signing key. - RSA^ RSAKey = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", RSAKey ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml" ); - - // Display the results of the signature verification to \ - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp deleted file mode 100644 index 8d9b7b1fc42..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp +++ /dev/null @@ -1,172 +0,0 @@ - - -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ RSAKey ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the RSA key to the SignedXml document. - signedXml->SigningKey = RSAKey; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add a transformation to the reference. - Transform^ trns = gcnew XmlDsigC14NTransform; - reference->AddTransform( trns ); - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(RSAKey) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate an RSA signing key. - RSA^ RSAKey = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", RSAKey ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp deleted file mode 100644 index fa1867d2679..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp +++ /dev/null @@ -1,124 +0,0 @@ - - -// -// -// This example signs a file specified by a URI -// using a detached signature. It then verifies -// the signed XML. -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. This method does not -// save the public key within the XML file. This file cannot be verified unless -// the verifying code has the key with which it was signed. -void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ Key ) -{ - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml; - - // Assign the key to the SignedXml object. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - - // Add the passed URI to the reference object. - reference->Uri = URIString; - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); - xmlDigitalSignature->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file against an asymmetric -// algorithm and return the result. -static Boolean VerifyDetachedSignature( String^ XmlSigFileName, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Load the passedXML file into the document. - xmlDocument->Load( XmlSigFileName ); - - // Create a new SignedXml object. - SignedXml^ signedXml = gcnew SignedXml; - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( dynamic_cast(nodeList[ 0 ]) ); - - // Check the signature against the passed asymmetric key - // and return the result. - return signedXml->CheckSignature( Key ); -} - -int main() -{ - - // The URI to sign. - String^ resourceToSign = "http://www.microsoft.com"; - - // The name of the file to which to save the XML signature. - String^ XmlFileName = "xmldsig.xml"; - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - Console::WriteLine( "Signing: {0}", resourceToSign ); - - // Sign the detached resourceand save the signature in an XML file. - SignDetachedResource( resourceToSign, XmlFileName, Key ); - Console::WriteLine( "XML Signature was successfully computed and saved to {0}.", XmlFileName ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - - //Verify the XML signature in the XML file against the key. - bool result = VerifyDetachedSignature( XmlFileName, Key ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp deleted file mode 100644 index 270360c4f71..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp +++ /dev/null @@ -1,159 +0,0 @@ - - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. This method does not -// save the public key within the XML file. This file cannot be verified unless -// the verifying code has the key with which it was signed. -void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file against an asymmetric -// algorithm and return the result. -Boolean VerifyXmlFile( String^ Name, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature( Key ); -} - - -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument Object*. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "signedExample.xml", Key ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml", Key ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp deleted file mode 100644 index 979040a9f1c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp +++ /dev/null @@ -1,117 +0,0 @@ - - -// -// -// This example signs a file specified by a URI -// using a detached signature. It then verifies -// the signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. -void SignDetachedResource( String^ URIString, String^ XmlSigFileName, KeyedHashAlgorithm^ Key ) -{ - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - - // Add the passed URI to the reference object. - reference->Uri = URIString; - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Compute the signature. - signedXml->ComputeSignature( Key ); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); - xmlDigitalSignature->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -Boolean VerifyDetachedSignature( String^ XmlSigFileName, KeyedHashAlgorithm^ Key ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Load the passedXML file into the document. - xmlDocument->Load( XmlSigFileName ); - - // Create a new SignedXml object and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml; - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature( Key ); -} - -int main() -{ - try - { - - // The URI to sign. - String^ resourceToSign = "http://www.microsoft.com"; - - // The name of the file to which to save the XML signature. - String^ XmlFileName = "xmlsig.xml"; - - // Generate a signing key. - HMACSHA256^ Key = gcnew HMACSHA256; - Console::WriteLine( "Signing: {0}", resourceToSign ); - - // Sign the detached resourceand save the signature in an XML file. - SignDetachedResource( resourceToSign, XmlFileName, Key ); - Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - - //Verify the XML signature in the XML file. - bool result = VerifyDetachedSignature( XmlFileName, Key ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp deleted file mode 100644 index 5ea1b276c55..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp +++ /dev/null @@ -1,160 +0,0 @@ - - -// -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, KeyedHashAlgorithm^ Key ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using its name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXML object. - signedXml->AddReference( reference ); - - // Compute the signature. - signedXml->ComputeSignature( Key ); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// Verify the signature of an XML file and return the result. -Boolean VerifyXmlFile( String^ Name, KeyedHashAlgorithm^ Key ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXMl object and pass it - // the XMl document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the "Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature( Key ); -} - - -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument object. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode object. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the filename specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -int main() -{ - try - { - - // Generate a signing key. - HMACSHA256^ Key = gcnew HMACSHA256; - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", Key ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying Signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml", Key ); - - // Display the results of the signature verification to \ - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp deleted file mode 100644 index 24b3bee5ff8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp +++ /dev/null @@ -1,134 +0,0 @@ - - -// -// -// This example signs a file specified by a URI -// using a detached signature. It then verifies -// the signed XML. -// -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ RSAKey ) -{ - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml; - - // Assign the key to the SignedXml object. - signedXml->SigningKey = RSAKey; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - - // Add the passed URI to the reference object. - reference->Uri = URIString; - - // Add a transformation if the URI is an XML file. - if ( URIString->EndsWith( "xml" ) ) - { - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(RSAKey) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement object. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Save the signed XML document to a file specified - // using the passed string. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); - xmlDigitalSignature->WriteTo( xmltw ); - xmltw->Close(); - } -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyDetachedSignature( String^ XmlSigFileName ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Load the passed XML file into the document. - xmlDocument->Load( XmlSigFileName ); - - // Create a new SignedXMl object. - SignedXml^ signedXml = gcnew SignedXml; - - // Find the S"Signature" node and create a new - // XmlNodeList object. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// -int main() -{ - - // The URI to sign. - String^ resourceToSign = "http://www.microsoft.com"; - - // The name of the file to which to save the XML signature. - String^ XmlFileName = "xmldsig.xml"; - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - Console::WriteLine( "Signing: {0}", resourceToSign ); - - // Sign the detached resourceand save the signature in an XML file. - SignDetachedResource( resourceToSign, XmlFileName, Key ); - Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - - //Verify the XML signature in the XML file. - bool result = VerifyDetachedSignature( XmlFileName ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp deleted file mode 100644 index 19f81fd3bec..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp +++ /dev/null @@ -1,168 +0,0 @@ - - -// -// This example signs an XML file using an -// envelope signature. It then verifies the -// signed XML. -#using -#using - -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; -using namespace System::Xml; - -// -// Sign an XML file and save the signature in a new file. -void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) -{ - - // Create a new XML document. - XmlDocument^ doc = gcnew XmlDocument; - - // Format the document to ignore white spaces. - doc->PreserveWhitespace = false; - - // Load the passed XML file using it's name. - doc->Load( gcnew XmlTextReader( FileName ) ); - - // Create a SignedXml Object*. - SignedXml^ signedXml = gcnew SignedXml( doc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = ""; - - // Add an enveloped transformation to the reference. - XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; - reference->AddTransform( env ); - - // Add the reference to the SignedXml Object*. - signedXml->AddReference( reference ); - - // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). - KeyInfo^ keyInfo = gcnew KeyInfo; - keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(Key) ) ); - signedXml->KeyInfo = keyInfo; - - // Compute the signature. - signedXml->ComputeSignature(); - - // Get the XML representation of the signature and save - // it to an XmlElement Object*. - XmlElement^ xmlDigitalSignature = signedXml->GetXml(); - - // Append the element to the XML document. - doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); - if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) - { - doc->RemoveChild( doc->FirstChild ); - } - - - // Save the signed XML document to a file specified - // using the passed String*. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); - doc->WriteTo( xmltw ); - xmltw->Close(); -} - - -// -// -// Verify the signature of an XML file and return the result. -Boolean VerifyXmlFile( String^ Name ) -{ - - // Create a new XML document. - XmlDocument^ xmlDocument = gcnew XmlDocument; - - // Format using white spaces. - xmlDocument->PreserveWhitespace = true; - - // Load the passed XML file into the document. - xmlDocument->Load( Name ); - - // Create a new SignedXml Object* and pass it - // the XML document class. - SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); - - // Find the S"Signature" node and create a new - // XmlNodeList Object*. - XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); - - // Load the signature node. - signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); - - // Check the signature and return the result. - return signedXml->CheckSignature(); -} - - -// -// Create example data to sign. -void CreateSomeXml( String^ FileName ) -{ - - // Create a new XmlDocument Object*. - XmlDocument^ document = gcnew XmlDocument; - - // Create a new XmlNode Object*. - XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); - - // Add some text to the node. - node->InnerText = "Example text to be signed."; - - // Append the node to the document. - document->AppendChild( node ); - - // Save the XML document to the file name specified. - XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); - document->WriteTo( xmltw ); - xmltw->Close(); -} - -void main() -{ - try - { - - // Generate a signing key. - RSA^ Key = RSA::Create(); - - // Create an XML file to sign. - CreateSomeXml( "Example.xml" ); - Console::WriteLine( "New XML file created." ); - - // Sign the XML that was just created and save it in a - // new file. - SignXmlFile( "Example.xml", "SignedExample.xml", Key ); - Console::WriteLine( "XML file signed." ); - - // Verify the signature of the signed XML. - Console::WriteLine( "Verifying signature..." ); - bool result = VerifyXmlFile( "SignedExample.xml" ); - - // Display the results of the signature verification to - // the console. - if ( result ) - { - Console::WriteLine( "The XML signature is valid." ); - } - else - { - Console::WriteLine( "The XML signature is not valid." ); - } - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp deleted file mode 100644 index 35c00691bbc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp +++ /dev/null @@ -1,219 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; - -namespace CryptographyXmlDsigBase64Transform -{ - ref class Example - { - public: - static void Produce() - { - - // Encrypt an XML message - EncryptXML(LoadXMLDoc()); - - // Using XmlDsigBase64Transform resolving a Uri. - Uri^ baseUri = gcnew Uri("http://www.microsoft.com"); - String^ relativeUri = "msdn"; - Uri^ absoluteUri = ResolveUris(baseUri, relativeUri); - Console::WriteLine("This sample completed successfully; " - "press Enter to exit."); - Console::ReadLine(); - } - - - private: - - // Encrypt the text in the specified XmlDocument. - static void EncryptXML(XmlDocument^ xmlDoc) - { - - // - XmlDsigBase64Transform^ xmlTransform = - gcnew XmlDsigBase64Transform; - // - // Ensure the transform is using the proper algorithm. - // - xmlTransform->Algorithm = - SignedXml::XmlDsigBase64TransformUrl; - // - // Retrieve the XML representation of the current - // transform. - // - XmlElement^ xmlInTransform = xmlTransform->GetXml(); - // - Console::WriteLine("Xml representation of the " - "current transform: "); - Console::WriteLine(xmlInTransform->OuterXml); - - // Retrieve the valid input types for the current - // transform. - // - array^ validInTypes = xmlTransform->InputTypes; - // - // Verify the xmlTransform can accept the XMLDocument - // as an input type. - for each (Type^ validInType in validInTypes) - { - if (validInType == xmlDoc->GetType()) - { - - // Demonstrate loading the entire Xml Document. - // - xmlTransform->LoadInput(xmlDoc); - // - // This transform is created for demonstration - // purposes. - XmlDsigBase64Transform^ secondTransform = - gcnew XmlDsigBase64Transform; - // - String^ classDescription = - secondTransform->ToString(); - // - // This call does not perform as expected. - // LoadInnerXml is overridden by the - // XmlDsigBase64Transform class, but is - // stubbed out. - // - secondTransform->LoadInnerXml( - xmlDoc->SelectNodes("//.")); - // - break; - } - - } - - // - array^ validOutTypes = xmlTransform->OutputTypes; - // - for each (Type^ validOutType in validOutTypes) - { - if (validOutType == Stream::typeid) - { - try - { - - // - Type^ streamType = Stream::typeid; - CryptoStream^ outputStream = - (CryptoStream^)(xmlTransform->GetOutput( - streamType)); - // - // Read the CryptoStream into a stream reader. - StreamReader^ streamReader = - gcnew StreamReader(outputStream); - - // Read the stream into a string. - String^ outputMessage = - streamReader->ReadToEnd(); - - // Close the streams. - outputStream->Close(); - streamReader->Close(); - - // Display to the console the Xml before and - // after encryption. - Console::WriteLine("Encoding the following " - "message: {0}", xmlDoc->InnerText); - Console::WriteLine("Message encoded: {0}", - outputMessage); - } - catch (CryptographicException^ ex) - { - Console::WriteLine("Cryptographic exception " - "caught: {0}", ex); - } - - break; - } - else - { - - // - Object^ outputObject = xmlTransform->GetOutput(); - // - } - - } - } - - - // Create an XML document with Element and Text nodes. - static XmlDocument^ LoadXMLDoc() - { - XmlDocument^ xmlDoc = gcnew XmlDocument; - XmlNode^ mainNode = - xmlDoc->CreateNode(XmlNodeType::Element, - "ContosoMessages", "http://www.contoso.com"); - XmlNode^ textNode = xmlDoc->CreateTextNode("Some text " - "to encode."); - mainNode->AppendChild(textNode); - xmlDoc->AppendChild(mainNode); - Console::WriteLine("Created the following XML Document " - "for transformation: "); - Console::WriteLine(xmlDoc->InnerXml); - return xmlDoc; - } - - - // Resolve the specified base and relative Uri's. - static Uri^ ResolveUris(Uri^ baseUri, String^ relativeUri) - { - - // - XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver; - xmlResolver->Credentials = - System::Net::CredentialCache::DefaultCredentials; - XmlDsigBase64Transform^ xmlTransform = - gcnew XmlDsigBase64Transform; - xmlTransform->Resolver = xmlResolver; - // - Uri^ absoluteUri = xmlResolver->ResolveUri(baseUri, - relativeUri); - if (absoluteUri != nullptr) - { - Console::WriteLine("Resolved the base Uri and " - "relative Uri to the following:"); - Console::WriteLine(absoluteUri); - } - else - { - Console::WriteLine("Unable to resolve the base " - "Uri and relative Uri"); - } - - return absoluteUri; - } - - }; - -} - -int main() -{ - CryptographyXmlDsigBase64Transform::Example::Produce(); -} - -// -// This sample produces the following output: -// -// Created the following XML Document for transformation: -// Some text to encode. -// -// Xml representation of the current transform: -// -// Encoding the following message: Some text to encode. -// Message encoded: Jmr^ -// Resolved the base Uri and relative Uri to the following: -// http://www.microsoft.com/msdn -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp deleted file mode 100644 index 9c590aba971..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp +++ /dev/null @@ -1,334 +0,0 @@ -// -#using -#using -#using -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Security::Cryptography::X509Certificates; - -ref class Class1 -{ -private: - static String^ Certificate = L"..\\..\\my509.cer"; - -public: - [STAThread] - static void Main() - { - // Encrypt an XML message - XmlDocument^ productsXml = LoadProducts(); - ShowTransformProperties( productsXml ); - SignDocument( productsXml ); - ShowTransformProperties( productsXml ); - - // Use XmlDsigC14NTransform to resolve a Uri. - Uri^ baseUri = gcnew Uri( L"http://www.contoso.com" ); - String^ relativeUri = L"xml"; - Uri^ absoluteUri = ResolveUris( baseUri, relativeUri ); - Console::WriteLine( L"This sample completed successfully; " - L"press Enter to exit." ); - Console::ReadLine(); - } - - -private: - // Encrypt the text in the specified XmlDocument. - static void ShowTransformProperties( XmlDocument^ xmlDoc ) - { - // - XmlDsigC14NTransform^ xmlTransform = - gcnew XmlDsigC14NTransform( true ); - // - - // Ensure the transform is using the appropriate algorithm. - // - xmlTransform->Algorithm = - SignedXml::XmlDsigExcC14NTransformUrl; - // - - // Retrieve the XML representation of the current transform. - // - XmlElement^ xmlInTransform = xmlTransform->GetXml(); - // - - Console::WriteLine( L"\nXml representation of the current transform: " ); - Console::WriteLine( xmlInTransform->OuterXml ); - - // Retrieve the valid input types for the current transform. - // - array^validInTypes = xmlTransform->InputTypes; - // - - // Verify the xmlTransform can accept the XMLDocument as an - // input type. - for ( int i = 0; i < validInTypes->Length; i++ ) - { - if ( validInTypes[ i ] == xmlDoc->GetType() ) - { - // Load the document into the transfrom. - // - xmlTransform->LoadInput( xmlDoc ); - // - - // - XmlDsigC14NTransform^ secondTransform = gcnew XmlDsigC14NTransform; - // - - // - String^ classDescription = secondTransform->ToString(); - // - - // This call does not perform as expected. - // This transform does not contain inner XML elements - // - secondTransform->LoadInnerXml( xmlDoc->SelectNodes( L"//." ) ); - // - - break; - } - } - - // - array^validOutTypes = xmlTransform->OutputTypes; - // - - for ( int i = 0; i < validOutTypes->Length; i++ ) - { - if ( validOutTypes[ i ] == System::IO::Stream::typeid ) - { - try - { - - // - Type^ streamType = System::IO::Stream::typeid; - MemoryStream^ outputStream = static_cast( - xmlTransform->GetOutput( streamType )); - // - - // Read the CryptoStream into a stream reader. - StreamReader^ streamReader = - gcnew StreamReader( outputStream ); - - // Read the stream into a string. - String^ outputMessage = streamReader->ReadToEnd(); - - // Close the streams. - outputStream->Close(); - streamReader->Close(); - - // Display to the console the Xml before and after - // encryption. - Console::WriteLine( L"Encoding the following xml: {0}", - xmlDoc->OuterXml ); - Console::WriteLine( L"Message encoded: {0}", outputMessage ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Unexpected exception caught: {0}", ex ); - } - - break; - } - else - { - // - Object^ outputObject = xmlTransform->GetOutput(); - // - } - } - } - - // Create an XML document describing various products. - static XmlDocument^ LoadProducts() - { - XmlDocument^ xmlDoc = gcnew XmlDocument; - String^ contosoProducts = L""; - contosoProducts = String::Concat( contosoProducts, - L"123"); - contosoProducts = String::Concat( contosoProducts, - L"Router"); - contosoProducts = String::Concat( contosoProducts, - L"456"); - contosoProducts = String::Concat( contosoProducts, - L"Keyboard"); - - // Include a comment to test the comments feature of the transform. - contosoProducts = String::Concat( contosoProducts, - L"" ); - - // Include the CDATA tag to test the transform results. - contosoProducts = String::Concat( contosoProducts, - L"" ); - contosoProducts = String::Concat( contosoProducts, - L"" ); - - xmlDoc->LoadXml( contosoProducts ); - return xmlDoc; - } - - // Create a signature and add it to the specified document. - static void SignDocument( XmlDocument^ xmlDoc ) - { - // Generate a signing key. - RSA^ Key = RSA::Create(); - - // Create a SignedXml object. - SignedXml^ signedXml = gcnew SignedXml( xmlDoc ); - - // Add the key to the SignedXml document. - signedXml->SigningKey = Key; - - // Create a reference to be signed. - Reference^ reference = gcnew Reference; - reference->Uri = L""; - - // Add an enveloped transformation to the reference. - reference->AddTransform( gcnew XmlDsigC14NTransform ); - - // Add the reference to the SignedXml object. - signedXml->AddReference( reference ); - try - { - // Create a new KeyInfo object. - KeyInfo^ keyInfo = gcnew KeyInfo; - - // Load the X509 certificate. - X509Certificate^ MSCert = - X509Certificate::CreateFromCertFile( Certificate ); - - // Load the certificate into a KeyInfoX509Data object - // and add it to the KeyInfo object. - keyInfo->AddClause( gcnew KeyInfoX509Data( MSCert ) ); - - // Add the KeyInfo object to the SignedXml object. - signedXml->KeyInfo = keyInfo; - } - catch ( FileNotFoundException^ ) - { - Console::WriteLine( L"Unable to locate the following file: {0}", - Certificate ); - } - catch ( CryptographicException^ ex ) - { - Console::WriteLine( L"Unexpected exception caught while creating " - L"the certificate:{0}", ex ); - } - - // Compute the signature. - signedXml->ComputeSignature(); - - // Add the signature branch to the original tree so it is enveloped. - xmlDoc->DocumentElement->AppendChild( signedXml->GetXml() ); - } - - // Resolve the specified base and relative Uri's . - static Uri^ ResolveUris( Uri^ baseUri, String^ relativeUri ) - { - // - XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver; - xmlResolver->Credentials = - System::Net::CredentialCache::DefaultCredentials; - XmlDsigC14NTransform^ xmlTransform = gcnew XmlDsigC14NTransform; - xmlTransform->Resolver = xmlResolver; - // - - Uri^ absoluteUri = xmlResolver->ResolveUri( baseUri, relativeUri ); - if ( absoluteUri != nullptr ) - { - Console::WriteLine( - L"\nResolved the base Uri and relative Uri to the following:" ); - Console::WriteLine( absoluteUri ); - } - else - { - Console::WriteLine( L"Unable to resolve the base Uri and relative Uri" ); - } - - return absoluteUri; - } -}; - -int main() -{ - Class1::Main(); -} - -// -// This sample produces the following output: -// -// Xml representation of the current transform: -// -// Encoding the following xml: 123Rou -// ter456Keyboard -// Message encoded: 123Rou -// ter456Keyboard'http:\\www.contoso.com\partner.asp?h1=en&h2=cr' -// Xml representation of the current transform: -// -// Encoding the following xml: 123Rou -// ter456Keyboard -// BFN2s0/NA2NGgb/R0mvfnNM0Ito= -// vSfZUG5xHuNxzOSEbQjN -// dtEt1D+O7I1LTJ13RrwLaJSfQPrdT/s8IeaA+idw2f2WGuGrdqMJUddpE4GxfK61HmPQ6S7lBG+ -// +ND+YaUYf2AtTRs3SnToXQQrARa/pHVjsKxYHR/9tjy6maHBwxjgjFQABvYZu0gZHYRuXvvfxv0 -// 8=MIICCzCCAXSgAwIBAgIQ5eVQY8pRZ5xBF2WLkYPjijANBgkqhkiG -// 9w0BAQQFADAbMRkwFwYDVQQDExBHcmVnc0NlcnRpZmljYXRlMB4XDTAzMDkxNzIzMzU0N1oXDTM -// 5MTIzMT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gkqhkiG9w0BAQ -// EFAAOBjQAwgYkCgYEAmFJ4v7rS3BYTXgVW9PgBFfTYAcB/m9mOFCmUrrChcBpoEtu/tSESlNfEH -// pECIdqg9vUrCNSkY08HRn3ueNeBSnSpssWd8/XoOboWLh1nd+79Y5uZd1WOJI4s0XM0MegZgCoJ -// cEEhpxCd/HOPIQvEsbpN/DuFiovZLo+Ek3hHoxMCAwEAAaNQME4wTAYDVR0BBEUwQ4AQaCb19dl -// yf/zSxPVYQZY9AKEdMBsxGTAXBgNVBAMTEEdyZWdzQ2VydGlmaWNhdGWCEOXlUGPKUWecQRdli5 -// GD44owDQYJKoZIhvcNAQEEBQADgYEAZuZaFDGDJogh7FuT0hfaMAVlRONv6wWVBJVV++eUo38Xu -// RfJ5nNJ0UnhiV2sEtLobYBPEIrNhuk8skdU0AHgx4ILiA4rR96ifWwxtrFQF+h+DL2ZB7xhwcOJ -// +Pa7IC4wIaEp/oBmmX+JHSzfQt6/If4ohwikfxfljKMyIcMlwl4=
-// -// Resolved the base Uri and relative Uri to the following: -// http://www.contoso.com/xml -// This sample completed successfully; press Enter to exit. -//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp deleted file mode 100644 index bf4107ed47b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp +++ /dev/null @@ -1,290 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Security::Cryptography::X509Certificates; - -public ref class EnvelopedSignatureSample -{ -private: - static String^ Certificate = "..\\..\\my509.cer"; - - // Encrypt the text in the specified XmlDocument. -public: - static void ShowTransformProperties(XmlDocument^ xmlDoc) - { - // - XmlDsigEnvelopedSignatureTransform^ xmlTransform = - gcnew XmlDsigEnvelopedSignatureTransform(); - // - - // Ensure the transform is using the proper algorithm. - // - xmlTransform->Algorithm = - SignedXml::XmlDsigEnvelopedSignatureTransformUrl; - // - - // Retrieve the XML representation of the current transform. - // - XmlElement^ xmlInTransform = xmlTransform->GetXml(); - // - - Console::WriteLine("\nXml representation of the current transform: "); - Console::WriteLine(xmlInTransform->OuterXml); - - // Retrieve the valid input types for the current transform. - // - array^ validInTypes = xmlTransform->InputTypes; - // - - // Verify the xmlTransform can accept the XMLDocument as an - // input type. - for (int i = 0; i < validInTypes->Length; i++) - { - if (validInTypes[i] == xmlDoc->GetType()) - { - // Load the document into the transfrom. - // - xmlTransform->LoadInput(xmlDoc); - // - - // - bool IncludeComments = true; - // This transform is created for demonstration purposes. - XmlDsigEnvelopedSignatureTransform^ secondTransform = - gcnew XmlDsigEnvelopedSignatureTransform(IncludeComments); - // - - // - String^ classDescription = secondTransform->ToString(); - // - - // This call does not perform as expected. - // - // An enveloped signature has no inner XML elements - secondTransform->LoadInnerXml(xmlDoc->SelectNodes("//.")); - // - - break; - } - } - - // - array^ validOutTypes = xmlTransform->OutputTypes; - // - - for (int i = validOutTypes->Length-1; i >= 0; i--) - { - if (validOutTypes[i] == System::Xml::XmlDocument::typeid) - { - // - Type^ xmlDocumentType = System::Xml::XmlDocument::typeid; - XmlDocument^ xmlDocumentOutput = (XmlDocument^) - xmlTransform->GetOutput(xmlDocumentType); - // - - // Display to the console the Xml before and after - // encryption. - Console::WriteLine("Result of the GetOutput method call" + - " from the current transform: " + - xmlDocumentOutput->OuterXml); - - break; - } - else if (validOutTypes[i] == System::Xml::XmlNodeList::typeid) - { - Type^ xmlNodeListType = System::Xml::XmlNodeList::typeid; - XmlNodeList^ xmlNodes = (XmlNodeList^) - xmlTransform->GetOutput(xmlNodeListType); - - // Display to the console the Xml before and after - // encryption. - Console::WriteLine("Encoding the following message: " + - xmlDoc->InnerText); - - Console::WriteLine("Nodes of the XmlNodeList retrieved " + - "from GetOutput:"); - for (int j = 0; j < xmlNodes->Count; j++) - { - Console::WriteLine("Node " + j + - " has the following name: " + - xmlNodes->Item(j)->Name + - " and the following InnerXml: " + - xmlNodes->Item(j)->InnerXml); - } - - break; - } - else - { - // - Object^ outputObject = xmlTransform->GetOutput(); - // - } - } - } - - // Create an XML document describing various products. -public: - static XmlDocument^ LoadProducts() - { - XmlDocument^ xmlDoc = gcnew XmlDocument(); - - String^ contosoProducts = "" + - "123Router" + - "" + - "456Keyboard" + - "" + - "789Monitor" + - "" + - ""; - - xmlDoc->LoadXml(contosoProducts); - return xmlDoc; - } - - // Create a signature and add it to the specified document. -public: - static void SignDocument(XmlDocument^ xmlDoc) - { - // Generate a signing key. - RSA^ key = RSA::Create(); - - // Create a SignedXml object. - SignedXml^ signedDocument = gcnew SignedXml(xmlDoc); - - // Add the key to the SignedXml document. - signedDocument->SigningKey = key; - - // Create a reference to be signed. - Reference^ referenceToBeSigned = gcnew Reference(); - referenceToBeSigned->Uri = ""; - - // Add an enveloped transformation to the reference. - referenceToBeSigned->AddTransform( - gcnew XmlDsigEnvelopedSignatureTransform()); - - // Add the reference to the SignedXml object. - signedDocument->AddReference(referenceToBeSigned); - - if(File::Exists(Certificate)) - { - // Create a new KeyInfo object. - KeyInfo^ info = gcnew KeyInfo(); - - // Load the X509 certificate. - X509Certificate^ certFromFile = - X509Certificate::CreateFromCertFile(Certificate); - - // Load the certificate into a KeyInfoX509Data object - // and add it to the KeyInfo object. - info->AddClause(gcnew KeyInfoX509Data(certFromFile)); - - // Add the KeyInfo object to the SignedXml object. - signedDocument->KeyInfo = info; - } - else - { - Console::WriteLine("Unable to locate the following file: " + - Certificate); - } - - // Compute the signature. - signedDocument->ComputeSignature(); - - // Add the signature branch to the original tree so it is enveloped. - xmlDoc->DocumentElement->AppendChild(signedDocument->GetXml()); - } - - // Resolve the specified base and relative Uri's . -public: - static Uri^ ResolveUris(Uri^ baseUri, String^ relativeUri) - { - // - XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver(); - xmlResolver->Credentials = - System::Net::CredentialCache::DefaultCredentials; - - XmlDsigEnvelopedSignatureTransform^ xmlTransform = - gcnew XmlDsigEnvelopedSignatureTransform(); - xmlTransform->Resolver = xmlResolver; - // - - Uri^ absoluteUri = xmlResolver->ResolveUri(baseUri, relativeUri); - - if (absoluteUri != nullptr) - { - Console::WriteLine( - "\nResolved the base Uri and relative Uri to the following:"); - Console::WriteLine(absoluteUri->ToString()); - } - else - { - Console::WriteLine( - "Unable to resolve the base Uri and relative Uri"); - } - return absoluteUri; - } -}; - -[STAThread] -int main() -{ - // Encrypt an XML message - XmlDocument^ productsXml = EnvelopedSignatureSample::LoadProducts(); - EnvelopedSignatureSample::ShowTransformProperties(productsXml); - - EnvelopedSignatureSample::SignDocument(productsXml); - EnvelopedSignatureSample::ShowTransformProperties(productsXml); - - // Use XmlDsigEnvelopedSignatureTransform to resolve a Uri. - Uri^ baseUri = gcnew Uri("http://www.contoso.com"); - String^ relativeUri = "xml"; - Uri^ absoluteUri = - EnvelopedSignatureSample::ResolveUris(baseUri, relativeUri); - - Console::WriteLine("This sample completed successfully; " + - "press Enter to exit."); - Console::ReadLine(); -} - -// -// This sample produces the following output: -// -// Xml representation of the current transform: -// -// Result of the GetOutput method call from the current transform: -// 123Router -// 456Keyboard789 -// Monitor -// Unable to load the following file: ..\\my509.cer -// -// Xml representation of the current transform: -// -// Result of the GetOutput method call from the current transform: -// 123Router -// 456Keyboard789 -// Monitor -// -// KvPW6HUiIUMEDS0YSoT -// gpo2JPbA=c/njCGDru/a -// WAmWG83I+mWO040xOzxvmNx0b0o8ZyPc9j5VwApdAt103OGBtB1H6EkOvt7Ekw+PVuUo8m5LzLP -// yaTxUDMbb2kZZ5itSkGD4rmMUMUMuzrkAoquJZjxeOydBJ2CMehV2rE3RMPLIwRX176DZVy5JKU -// 6Cb7PR2Rpw= -// -// Resolved the base Uri and relative Uri to the following: -// http://www.contoso.com/xml -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp deleted file mode 100644 index 5a53f0d8e0a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp +++ /dev/null @@ -1,261 +0,0 @@ -// -#using -#using -#using -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::Xml; -using namespace System::Text; - -ref class Class1 -{ -public: - [STAThread] - static void Main() - { - XmlDocument^ productsXml = LoadProducts(); - XmlNodeList^ xsltNodeList = GetXsltAsNodeList(); - TransformDoc( productsXml, xsltNodeList ); - - // Use XmlDsigXsltTransform to resolve a Uri. - Uri^ baseUri = gcnew Uri( L"http://www.contoso.com" ); - String^ relativeUri = L"xml"; - Uri^ absoluteUri = ResolveUris( baseUri, relativeUri ); - Console::WriteLine( L"This sample completed successfully; " - L"press Enter to exit." ); - Console::ReadLine(); - } - -private: - static void TransformDoc( XmlDocument^ xmlDoc, XmlNodeList^ xsltNodeList ) - { - try - { - // Construct a new XmlDsigXsltTransform. - // - XmlDsigXsltTransform^ xmlTransform = gcnew XmlDsigXsltTransform; - // - - // Load the Xslt tranform as a node list. - // - xmlTransform->LoadInnerXml( xsltNodeList ); - // - - // Load the Xml document to perform the tranform on. - // - XmlNamespaceManager^ namespaceManager; - namespaceManager = gcnew XmlNamespaceManager( xmlDoc->NameTable ); - XmlNodeList^ productsNodeList; - productsNodeList = xmlDoc->SelectNodes( L"//.", namespaceManager ); - xmlTransform->LoadInput( productsNodeList ); - // - - // Retrieve the output from the transform. - // - Stream^ outputStream = (Stream^)xmlTransform->GetOutput( - System::IO::Stream::typeid ); - // - - // Read the output stream into a stream reader. - StreamReader^ streamReader = gcnew StreamReader( outputStream ); - - // Read the stream into a string. - String^ outputMessage = streamReader->ReadToEnd(); - - // Close the streams. - outputStream->Close(); - streamReader->Close(); - - // Display to the console the Xml before and after - // encryption. - Console::WriteLine( L"\nResult of transformation: {0}", outputMessage ); - ShowTransformProperties( xmlTransform ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Caught exception in TransformDoc method: {0}", ex ); - } - } - - static XmlNodeList^ GetXsltAsNodeList() - { - String^ transformXml = L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"
ProductIdName
" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"" ); - transformXml = String::Concat( transformXml, - L"
" ); - Console::WriteLine( L"\nCreated the following Xslt tranform:" ); - Console::WriteLine( transformXml ); - XmlDocument^ xmlDoc = gcnew XmlDocument; - xmlDoc->LoadXml( transformXml ); - return xmlDoc->GetElementsByTagName( L"xsl:transform" ); - } - - // Encrypt the text in the specified XmlDocument. - static void ShowTransformProperties( XmlDsigXsltTransform^ xmlTransform ) - { - // - String^ classDescription = xmlTransform->ToString(); - // - Console::WriteLine( L"\n** Summary for {0} **", classDescription ); - - // Retrieve the XML representation of the current transform. - // - XmlElement^ xmlInTransform = xmlTransform->GetXml(); - // - Console::WriteLine( L"Xml representation of the current transform:\n{0}", - xmlInTransform->OuterXml ); - - // Ensure the transform is using the proper algorithm. - // - xmlTransform->Algorithm = SignedXml::XmlDsigXsltTransformUrl; - // - Console::WriteLine( L"Algorithm used: {0}", classDescription ); - - // Retrieve the valid input types for the current transform. - // - array^validInTypes = xmlTransform->InputTypes; - // - Console::WriteLine( L"Transform accepts the following inputs:" ); - for ( int i = 0; i < validInTypes->Length; i++ ) - { - Console::WriteLine( L"\t{0}", validInTypes[ i ] ); - - } - - // - array^validOutTypes = xmlTransform->OutputTypes; - // - Console::WriteLine( L"Transform outputs in the following types:" ); - for ( int i = validOutTypes->Length - 1; i >= 0; i-- ) - { - Console::WriteLine( L"\t {0}", validOutTypes[ i ] ); - if ( validOutTypes[ i ] == Object::typeid ) - { - // - Object^ outputObject = xmlTransform->GetOutput(); - // - } - } - } - - // Create an XML document describing various products. - static XmlDocument^ LoadProducts() - { - String^ contosoProducts = L""; - contosoProducts = String::Concat( contosoProducts, - L"" ); - contosoProducts = String::Concat( contosoProducts, - L"1" ); - contosoProducts = String::Concat( contosoProducts, - L"Widgets" ); - contosoProducts = String::Concat( contosoProducts, - L"2" ); - contosoProducts = String::Concat( contosoProducts, - L"Gadgits" ); - contosoProducts = String::Concat( contosoProducts, - L"" ); - Console::WriteLine( - L"\nCreated the following Xml document for tranformation:" ); - Console::WriteLine( contosoProducts ); - XmlDocument^ xmlDoc = gcnew XmlDocument; - xmlDoc->LoadXml( contosoProducts ); - return xmlDoc; - } - - // Resolve the specified base and relative Uri's . - static Uri^ ResolveUris( Uri^ baseUri, String^ relativeUri ) - { - // - XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver; - xmlResolver->Credentials = - System::Net::CredentialCache::DefaultCredentials; - - XmlDsigXsltTransform^ xmlTransform = gcnew XmlDsigXsltTransform; - xmlTransform->Resolver = xmlResolver; - // - - Uri^ absoluteUri = xmlResolver->ResolveUri( baseUri, relativeUri ); - if ( absoluteUri != nullptr ) - { - Console::WriteLine( - L"\nResolved the base Uri and relative Uri to the following:" ); - Console::WriteLine( absoluteUri ); - } - else - { - Console::WriteLine( L"Unable to resolve the base Uri and relative Uri" ); - } - - return absoluteUri; - } -}; - -int main() -{ - Class1::Main(); -} - -// -// This sample produces the following output: -// -// Created the following Xml document for tranformation: -// 1Widgets2Gadgits -// -// Created the following Xslt tranform: -//
ProductIdName
-// -// Result of transformation:
ProductIdName
1Widgets
2Gadgits
-// -// ** Summary for System.Security.Cryptography.Xml.XmlDsigXsltTransform ** -// Xml representation of the current transform: -// -// Algorithm used: System.Security.Cryptography.Xml.XmlDsigXsltTransform -// Transform accepts the following inputs: -// System.IO.Stream -// System.Xml.XmlDocument -// System.Xml.XmlNodeList -// Transform outputs in the following types: -// System.IO.Stream -// -// Resolved the base Uri and relative Uri to the following: -// http://www.contoso.com/xml -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp deleted file mode 100644 index cef1b5fb817..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp +++ /dev/null @@ -1,164 +0,0 @@ - -// -// This sample demonstrates the use of the PermissionSet class. -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Permissions; -using namespace System::Security; -using namespace System::IO; -using namespace System::Collections; -void PermissionSetDemo() -{ - Console::WriteLine( "Executing PermissionSetDemo" ); - try - { - // - // Open a new PermissionSet. - PermissionSet^ ps1 = gcnew PermissionSet( PermissionState::None ); - - Console::WriteLine( "Adding permission to open a file from a file dialog box." ); - - // - // Add a permission to the permission set. - ps1->AddPermission( gcnew FileDialogPermission( FileDialogPermissionAccess::Open ) ); - // - - Console::WriteLine( "Demanding permission to open a file." ); - ps1->Demand(); - Console::WriteLine( "Demand succeeded." ); - // - Console::WriteLine( "Adding permission to save a file from a file dialog box." ); - ps1->AddPermission( gcnew FileDialogPermission( FileDialogPermissionAccess::Save ) ); - Console::WriteLine( "Demanding permission to open and save a file." ); - ps1->Demand(); - Console::WriteLine( "Demand succeeded." ); - Console::WriteLine( "Adding permission to read environment variable USERNAME." ); - ps1->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) ); - ps1->Demand(); - Console::WriteLine( "Demand succeeded." ); - Console::WriteLine( "Adding permission to read environment variable COMPUTERNAME." ); - ps1->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"COMPUTERNAME" ) ); - - // - // Demand all the permissions in the set. - Console::WriteLine( "Demand all permissions." ); - ps1->Demand(); - // - - Console::WriteLine( "Demand succeeded." ); - - // - // Display the number of permissions in the set. - Console::WriteLine( "Number of permissions = {0}", ps1->Count ); - // - - // - // Display the value of the IsSynchronized property. - Console::WriteLine( "IsSynchronized property = {0}", ps1->IsSynchronized ); - // - - // - // Display the value of the IsReadOnly property. - Console::WriteLine( "IsReadOnly property = {0}", ps1->IsReadOnly ); - // - - // - // Display the value of the SyncRoot property. - Console::WriteLine( "SyncRoot property = {0}", ps1->SyncRoot ); - // - - // - // Display the result of a call to the ContainsNonCodeAccessPermissions method. - // Gets a value indicating whether the PermissionSet contains permissions - // that are not derived from CodeAccessPermission. - // Returns true if the PermissionSet contains permissions that are not - // derived from CodeAccessPermission; otherwise, false. - Console::WriteLine( "ContainsNonCodeAccessPermissions method returned {0}", ps1->ContainsNonCodeAccessPermissions() ); - // - - // - Console::WriteLine( "Value of the permission set ToString = \n{0}", ps1->ToString() ); - // - - PermissionSet^ ps2 = gcnew PermissionSet( PermissionState::None ); - - // - // Create a second permission set and compare it to the first permission set. - ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) ); - ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Write,"COMPUTERNAME" ) ); - IEnumerator^ list = ps1->GetEnumerator(); - Console::WriteLine("Permissions in first permission set:"); - while (list->MoveNext()) - Console::WriteLine(list->Current->ToString()); - Console::WriteLine( "Second permission IsSubsetOf first permission = {0}", ps2->IsSubsetOf( ps1 ) ); - // - - // - // Display the intersection of two permission sets. - PermissionSet^ ps3 = ps2->Intersect( ps1 ); - Console::WriteLine( "The intersection of the first permission set and the second permission set = {0}", ps3 ); - // - - // Create a new permission set. - PermissionSet^ ps4 = gcnew PermissionSet( PermissionState::None ); - ps4->AddPermission( gcnew FileIOPermission( FileIOPermissionAccess::Read,"C:\\Temp\\Testfile.txt" ) ); - ps4->AddPermission( gcnew FileIOPermission( static_cast(FileIOPermissionAccess::Read | FileIOPermissionAccess::Write | FileIOPermissionAccess::Append),"C:\\Temp\\Testfile.txt" ) ); - // - - // Display the union of two permission sets. - PermissionSet^ ps5 = ps3->Union( ps4 ); - Console::WriteLine( "The union of permission set 3 and permission set 4 = {0}", ps5 ); - // - - // - // Remove FileIOPermission from the permission set. - ps5->RemovePermission( FileIOPermission::typeid ); - Console::WriteLine( "The last permission set after removing FileIOPermission = {0}", ps5 ); - // - - // - // Change the permission set using SetPermission. - ps5->SetPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::AllAccess,"USERNAME" ) ); - Console::WriteLine( "Permission set after SetPermission = {0}", ps5 ); - // - - // - // Display result of ToXml and FromXml operations. - PermissionSet^ ps6 = gcnew PermissionSet( PermissionState::None ); - ps6->FromXml( ps5->ToXml() ); - Console::WriteLine( "Result of ToFromXml = {0}\n", ps6 ); - // - - // - // Display results of PermissionSet::GetEnumerator. - IEnumerator^ psEnumerator = ps1->GetEnumerator(); - while ( psEnumerator->MoveNext() ) - { - Console::WriteLine( psEnumerator->Current ); - } - // - - // - // Check for an unrestricted permission set. - PermissionSet^ ps7 = gcnew PermissionSet( PermissionState::Unrestricted ); - Console::WriteLine( "Permission set is unrestricted = {0}", ps7->IsUnrestricted() ); - // - - // - // Create and display a copy of a permission set. - ps7 = ps5->Copy(); - Console::WriteLine( "Result of copy = {0}", ps7 ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -int main() -{ - PermissionSetDemo(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp deleted file mode 100644 index 67c13f7830e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#using "NameIdPermission.dll" -// -using namespace System; -using namespace System::IO; -using namespace System::Runtime::Remoting; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Reflection; -using namespace MyPermission; - -// Use the command line option '/keyfile' or appropriate project settings to sign this assembly. -[assembly:System::Security::AllowPartiallyTrustedCallersAttribute]; -[AttributeUsage(AttributeTargets::Method|AttributeTargets::Constructor|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Assembly,AllowMultiple=true,Inherited=false)] -[Serializable] -public ref class NameIdPermissionAttribute: public CodeAccessSecurityAttribute -{ -private: - String^ m_Name; - bool m_unrestricted; - -public: - NameIdPermissionAttribute( SecurityAction action ) - : CodeAccessSecurityAttribute( action ) - { - m_Name = nullptr; - m_unrestricted = false; - } - - - property String^ Name - { - String^ get() - { - return m_Name; - } - - void set( String^ value ) - { - m_Name = value; - } - - } - virtual IPermission^ CreatePermission() override - { - if ( m_unrestricted ) - { - throw gcnew ArgumentException( "Unrestricted permissions not allowed in identity permissions." ); - } - else - { - if ( m_Name == nullptr ) - return gcnew NameIdPermission( PermissionState::None ); - return gcnew NameIdPermission( m_Name ); - } - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp deleted file mode 100644 index e1cfddf9959..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp +++ /dev/null @@ -1,234 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Security::Permissions; -using namespace System::Security::Cryptography; -using namespace System::Security; -using namespace System::IO; - -[assembly:DataProtectionPermissionAttribute( -SecurityAction::RequestMinimum, -Flags=DataProtectionPermissionFlags::ProtectData)]; -public ref class DataProtect -{ -private: - - // Create a byte array for additional entropy when using the - // Protect and Unprotect methods. - static array^ s_additionalEntropy = {9,8,7,6,5}; - static array^ encryptedSecret; - static array^ originalData; - -public: - static void Main() - { - - // - Console::WriteLine( "Creating a permission with the Flags property =" - " ProtectData." ); - DataProtectionPermission ^ sp = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData ); - - ProtectData(); - // - sp->PermitOnly(); - // The following code results in an exception due to an attempt - // to unprotect data. - UnprotectData(); - - // Remove the restrictive permission. - CodeAccessPermission::RevertPermitOnly(); - - // The untprotect call will now succeed. - UnprotectData(); - - // Demonstrate the behavior of the class members. - ShowMembers(); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadKey(); - return; - } - - -private: - - - // The following method is intended to demonstrate only the behavior of - // DataProtectionPermission class members,and not their practical usage. - // Most properties and methods in this class are used for the resolution - // and enforcement of security policy by the security infrastructure code. - static void ShowMembers() - { - Console::WriteLine( "Creating four DataProtectionPermissions" ); - Console::WriteLine( "Creating the first permission with the Flags " - "property = ProtectData." ); - DataProtectionPermission ^ sp1 = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData ); - Console::WriteLine( "Creating the second permission with the Flags " - "property = AllFlags." ); - DataProtectionPermission ^ sp2 = gcnew DataProtectionPermission( DataProtectionPermissionFlags::AllFlags ); - Console::WriteLine( "Creating the third permission with a permission " - "state = Unrestricted." ); - - // - DataProtectionPermission ^ sp3 = gcnew DataProtectionPermission( PermissionState::Unrestricted ); - - // - Console::WriteLine( "Creating the fourth permission with a permission" - " state = None." ); - DataProtectionPermission ^ sp4 = gcnew DataProtectionPermission( PermissionState::None ); - - // - bool rc = sp2->IsSubsetOf( sp3 ); - Console::WriteLine( "Is the permission with all flags set (AllFlags) " - "a subset of \n \tthe permission with an Unrestricted " - "permission state? {0}", (rc ? (String^)"Yes" : "No") ); - rc = sp1->IsSubsetOf( sp2 ); - Console::WriteLine( "Is the permission with ProtectData access a " - "subset of the permission with \n" - "\tAllFlags set? {0}", (rc ? (String^)"Yes" : "No") ); - - // - // - rc = sp3->IsUnrestricted(); - Console::WriteLine( "Is the third permission unrestricted? {0}", (rc ? (String^)"Yes" : "No") ); - - // - // - Console::WriteLine( "Copying the second permission to the fourth " - "permission." ); - sp4 = dynamic_cast(sp2->Copy()); - rc = sp4->Equals( sp2 ); - Console::WriteLine( "Is the fourth permission equal to the second " - "permission? {0}", (rc ? (String^)"Yes" : "No") ); - - // - // - Console::WriteLine( "Creating the intersection of the second and " - "first permissions." ); - sp4 = dynamic_cast(sp2->Intersect( sp1 )); - Console::WriteLine( "The value of the Flags property is: {0}", sp4->Flags ); - - // - // - Console::WriteLine( "Creating the union of the second and first " - "permissions." ); - sp4 = dynamic_cast(sp2->Union( sp1 )); - Console::WriteLine( "Result of the union of the second permission " - "with the first: {0}", sp4->Flags ); - - // - // - Console::WriteLine( "Using an XML round trip to reset the fourth " - "permission." ); - sp4->FromXml( sp2->ToXml() ); - rc = sp4->Equals( sp2 ); - Console::WriteLine( "Does the XML round trip result equal the " - "original permission? {0}", (rc ? (String^)"Yes" : "No") ); - - // - } - - -public: - - // Create a simple byte array containing data to be encrypted. - static void ProtectData() - { - array^secret = {0,1,2,3,4,1,2,3,4}; - - //Encrypt the data. - encryptedSecret = Protect( secret ); - Console::WriteLine( "The encrypted byte array is:" ); - if ( encryptedSecret != nullptr ) - PrintValues( encryptedSecret ); - } - - - // Decrypt the data and store in a byte array. - static void UnprotectData() - { - originalData = Unprotect( encryptedSecret ); - if ( originalData != nullptr ) - { - Console::WriteLine( "\r\nThe original data is:" ); - PrintValues( originalData ); - } - } - - - // Encrypt data in the specified byte array. - static array^ Protect( array^data ) - { - try - { - - // Encrypt the data using DataProtectionScope.CurrentUser. - // The result can be decrypted only by the user who encrypted - // the data. - return ProtectedData::Protect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "Data was not encrypted. " - "An error has occurred." ); - Console::WriteLine( e ); - return nullptr; - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Insufficient permissions. " - "An error has occurred." ); - Console::WriteLine( e ); - return nullptr; - } - - } - - - // Decrypt data in the specified byte array. - static array^ Unprotect( array^data ) - { - try - { - - //Decrypt the data using DataProtectionScope.CurrentUser. - return ProtectedData::Unprotect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "Data was not decrypted. " - "An error has occurred." ); - Console::WriteLine( e ); - return nullptr; - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Insufficient permissions. " - "An error has occurred." ); - Console::WriteLine( e ); - return nullptr; - } - - } - - static void PrintValues( array^myArr ) - { - System::Collections::IEnumerator^ myEnum = myArr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte i = safe_cast(myEnum->Current); - Console::Write( "\t{0}", i ); - } - - Console::WriteLine(); - } - -}; - -int main() -{ - DataProtect::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp deleted file mode 100644 index 8f6d1b640df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp +++ /dev/null @@ -1,534 +0,0 @@ - -// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml, -// GetPathList and SetPathList methods, and the AllFiles and AllLocalFiles properties -// of the FileIOPermission class. -// -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -// This class generates FileIOPermission objects. - -[assembly:CLSCompliant(true)]; -private ref class FileIOGenerator -{ -private: - array^myFile; - array^myAccess; - int fileIndex; - -public: - FileIOGenerator() - { - array^tempFile = {"C:\\Examples\\Test\\TestFile.txt","C:\\Examples\\Test\\","C:\\Examples\\Test\\..","C:\\Temp"}; - myFile = tempFile; - array^ tempAccess = {FileIOPermissionAccess::AllAccess,FileIOPermissionAccess::Append,FileIOPermissionAccess::NoAccess,FileIOPermissionAccess::PathDiscovery,FileIOPermissionAccess::Read,FileIOPermissionAccess::Write}; - myAccess = tempAccess; - ResetIndex(); - } - - void ResetIndex() - { - fileIndex = 0; - } - - - // Create a file path. - // - bool CreateFilePath( [Out]interior_ptr file ) - { - if ( fileIndex == myFile->Length ) - { - *file = ""; - fileIndex++; - return true; - } - - if ( fileIndex > myFile->Length ) - { - *file = ""; - return false; - } - - *file = myFile[ fileIndex++ ]; - try - { - return true; - } - catch ( Exception^ e ) - { - Console::WriteLine( "Cannot create FileIOPermission: {0} {1}", *file, e ); - *file = ""; - return true; - } - - } - - // -}; - -public ref class FileIOPermissionDemo -{ -private: - - // IsSubsetOf determines whether the current permission is a subset of the specified permission. - // This method compares various FileIOPermission paths with FileIOPermissionAccess set to AllAccess. - // - bool IsSubsetOfDemo() - { - bool returnValue = true; - String^ fileIO1; - String^ fileIO2; - FileIOPermission^ fileIOPerm1; - FileIOPermission^ fileIOPerm2; - FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; - FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; - fileIOGen1->ResetIndex(); - while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) - { - if (fileIO1 == "") - fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::AllAccess, fileIO1); - - Console::WriteLine( "**********************************************************\n" ); - fileIOGen2->ResetIndex(); - while ( fileIOGen2->CreateFilePath( &fileIO2 ) ) - { - if (fileIO2 == "") - fileIOPerm2 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::AllAccess, fileIO2); - String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1; - String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2; - if ( fileIOPerm2 == nullptr ) - continue; - try - { - if ( fileIOPerm1->IsSubsetOf( fileIOPerm2 ) ) - { - Console::WriteLine( "{0} is a subset of {1}\n", firstPermission, secondPermission ); - } - else - { - Console::WriteLine( "{0} is not a subset of {1}\n", firstPermission, secondPermission ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown for subset :{0}\n{1}\n{2}", (fileIO1->Equals( "" ) ? "null" : fileIO1), (fileIO2->Equals( "" ) ? "null" : fileIO2), e ); - } - - } - } - - return returnValue; - } - - - // - // Union creates a new permission that is the union of the current permission and the specified permission. - // - bool UnionDemo() - { - bool returnValue = true; - String^ fileIO1; - String^ fileIO2; - FileIOPermission^ fileIOPerm1; - FileIOPermission^ fileIOPerm2; - IPermission^ fileIOPerm3; - FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; - FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; - fileIOGen1->ResetIndex(); - while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) - { - if (fileIO1 == "") - fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); - - Console::WriteLine( "**********************************************************\n" ); - fileIOGen2->ResetIndex(); - while ( fileIOGen2->CreateFilePath( &fileIO2 ) ) - { - if (fileIO2 == "") - fileIOPerm2 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2); - try - { - if ( fileIOPerm2 == nullptr ) - continue; - String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1; - String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2; - fileIOPerm3 = dynamic_cast(fileIOPerm1->Union( fileIOPerm2 )); - fileIOPerm3 = fileIOPerm1->Union( fileIOPerm2 ); - if ( fileIOPerm3 == nullptr ) - { - Console::WriteLine( "The union of {0} and {1} is null.", firstPermission, secondPermission ); - } - else - { - Console::WriteLine( "The union of {0} and {1} = \n\t{2}", firstPermission, secondPermission, (dynamic_cast(fileIOPerm3))->GetPathList( FileIOPermissionAccess::Read )[ 0 ] ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown for union {0}", e ); - returnValue = false; - } - - } - } - - return returnValue; - } - - - // - // Intersect creates and returns a new permission that is the intersection of the current - // permission and the permission specified. - // - bool IntersectDemo() - { - bool returnValue = true; - String^ fileIO1; - String^ fileIO2; - FileIOPermission^ fileIOPerm1; - FileIOPermission^ fileIOPerm2; - FileIOPermission^ fileIOPerm3; - FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; - FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; - fileIOGen1->ResetIndex(); - while ( fileIOGen1->CreateFilePath ( &fileIO1 ) ) - { - if (fileIO1 == "") - fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); - - Console::WriteLine( "**********************************************************\n" ); - fileIOGen2->ResetIndex(); - while ( fileIOGen2->CreateFilePath( &fileIO2 ) ) - { - if (fileIO2 == "") - fileIOPerm2 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2); - String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1; - String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2; - try - { - fileIOPerm3 = dynamic_cast(fileIOPerm1->Intersect( fileIOPerm2 )); - if ( fileIOPerm3 != nullptr && fileIOPerm3->GetPathList( FileIOPermissionAccess::Read ) != nullptr ) - { - Console::WriteLine( "The intersection of {0} and \n\t{1} = \n\t{2}", firstPermission, secondPermission, (dynamic_cast(fileIOPerm3))->GetPathList( FileIOPermissionAccess::Read )[ 0 ] ); - } - else - { - Console::WriteLine( "The intersection of {0} and {1} is null.", firstPermission, secondPermission ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown for intersection {0}", e ); - returnValue = false; - } - - } - } - - return returnValue; - } - - - // - //Copy creates and returns an identical copy of the current permission. - // - bool CopyDemo() - { - bool returnValue = true; - String^ fileIO1; - FileIOPermission^ fileIOPerm1; - FileIOPermission^ fileIOPerm2; - FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; - FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; - fileIOGen1->ResetIndex(); - while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) - { - if (fileIO1 == "") - fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); - - Console::WriteLine( "**********************************************************\n" ); - fileIOGen2->ResetIndex(); - try - { - fileIOPerm2 = dynamic_cast(fileIOPerm1->Copy()); - if ( fileIOPerm2 != nullptr ) - { - Console::WriteLine( "Result of copy = {0}\n", fileIOPerm2 ); - } - else - { - Console::WriteLine( "Result of copy is null. \n" ); - } - } - catch ( Exception^ e ) - { - { - if ( fileIO1->Equals( "" ) ) - { - Console::WriteLine( "The target FileIOPermission is empty, copy failed." ); - } - else - Console::WriteLine( e ); - } - continue; - } - - } - - return returnValue; - } - - - // - // ToXml creates an XML encoding of the permission and its current state; - // FromXml reconstructs a permission with the specified state from the XML encoding. - // - bool ToFromXmlDemo() - { - bool returnValue = true; - String^ fileIO1; - FileIOPermission^ fileIOPerm1; - FileIOPermission^ fileIOPerm2; - FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; - FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; - fileIOGen1->ResetIndex(); - while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) - { - if (fileIO1 == "") - fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); - else - fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); - - Console::WriteLine( "********************************************************\n" ); - fileIOGen2->ResetIndex(); - try - { - fileIOPerm2 = gcnew FileIOPermission( PermissionState::None ); - fileIOPerm2->FromXml( fileIOPerm1->ToXml() ); - Console::WriteLine( "Result of ToFromXml = {0}\n", fileIOPerm2 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "ToFromXml failed :{0}{1}", fileIOPerm1, e ); - continue; - } - - } - - return returnValue; - } - - - // - // AddPathList adds access for the specified files and directories to the existing state of the permission. - // SetPathList sets the specified access to the specified files and directories, replacing the existing state - // of the permission. - // GetPathList gets all files and directories that have the specified FileIOPermissionAccess. - // - bool SetGetPathListDemo() - { - try - { - Console::WriteLine( "********************************************************\n" ); - FileIOPermission^ fileIOPerm1; - Console::WriteLine( "Creating a FileIOPermission with AllAccess rights for 'C:\\Examples\\Test\\TestFile.txt" ); - - // - fileIOPerm1 = gcnew FileIOPermission( FileIOPermissionAccess::AllAccess,"C:\\Examples\\Test\\TestFile.txt" ); - - // - Console::WriteLine( "Adding 'C:\\Temp' to the write access list, and \n 'C:\\Examples\\Test' to read access." ); - fileIOPerm1->AddPathList( FileIOPermissionAccess::Write, "C:\\Temp" ); - fileIOPerm1->AddPathList( FileIOPermissionAccess::Read, "C:\\Examples\\Test" ); - array^paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Read ); - Console::WriteLine( "Read access before SetPathList = " ); - IEnumerator^ myEnum = paths->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ path = safe_cast(myEnum->Current); - Console::WriteLine( "\t{0}", path ); - } - - Console::WriteLine( "Setting the read access list to \n'C:\\Temp'" ); - fileIOPerm1->SetPathList( FileIOPermissionAccess::Read, "C:\\Temp" ); - paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Read ); - Console::WriteLine( "Read access list after SetPathList = " ); - IEnumerator^ myEnum1 = paths->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ path = safe_cast(myEnum1->Current); - Console::WriteLine( "\t{0}", path ); - } - - paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Write ); - Console::WriteLine( "Write access list after SetPathList = " ); - IEnumerator^ myEnum2 = paths->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - String^ path = safe_cast(myEnum2->Current); - Console::WriteLine( "\t{0}", path ); - } - - Console::WriteLine( "Write access = \n{0}", fileIOPerm1->GetPathList( FileIOPermissionAccess::AllAccess ) ); - } - catch ( ArgumentException^ e ) - { - - // FileIOPermissionAccess.AllAccess can not be used as a parameter for GetPathList. - Console::WriteLine( "An ArgumentException occurred as a result of using AllAccess. This property cannot be used as a parameter in GetPathList because it represents more than one type of file variable access. : \n{0}", e ); - } - - return true; - } - - - // - // The AllFiles property gets or sets the permitted access to all files. - // The AllLocalFiles property gets or sets the permitted access to all local files. - // - bool AllFilesDemo() - { - try - { - Console::WriteLine( "********************************************************\n" ); - FileIOPermission^ fileIOPerm1; - Console::WriteLine( "Creating a FileIOPermission and adding read access for all files" ); - fileIOPerm1 = gcnew FileIOPermission( FileIOPermissionAccess::AllAccess,"C:\\Examples\\Test\\TestFile.txt" ); - fileIOPerm1->AllFiles = FileIOPermissionAccess::Read; - Console::WriteLine( "AllFiles access = {0}", fileIOPerm1->AllFiles ); - Console::WriteLine( "Adding AllAccess rights for local files." ); - fileIOPerm1->AllLocalFiles = FileIOPermissionAccess::AllAccess; - Console::WriteLine( "AllLocalFiles access = {0}", fileIOPerm1->AllLocalFiles ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e ); - return false; - } - - return true; - } - - -public: - - // - // Invoke all demos. - bool RunDemo() - { - bool ret = true; - bool retTmp; - - // Call the IsSubsetOfPath demo. - if ( retTmp = IsSubsetOfDemo() ) - Console::WriteLine( "IsSubsetOf demo completed successfully." ); - else - Console::WriteLine( "IsSubsetOf demo failed." ); - - ret = retTmp && ret; - - // Call the Union demo. - if ( retTmp = UnionDemo() ) - Console::WriteLine( "Union demo completed successfully." ); - else - Console::WriteLine( "Union demo failed." ); - - ret = retTmp && ret; - - // Call the Intersect demo. - if ( retTmp = IntersectDemo() ) - Console::WriteLine( "Intersect demo completed successfully." ); - else - Console::WriteLine( "Intersect demo failed." ); - - ret = retTmp && ret; - - // Call the Copy demo. - if ( retTmp = CopyDemo() ) - Console::WriteLine( "Copy demo completed successfully." ); - else - Console::WriteLine( "Copy demo failed." ); - - ret = retTmp && ret; - - // Call the ToFromXml demo. - if ( retTmp = ToFromXmlDemo() ) - Console::WriteLine( "ToFromXml demo completed successfully." ); - else - Console::WriteLine( "ToFromXml demo failed." ); - - ret = retTmp && ret; - - // Call the SetGetPathList demo. - if ( retTmp = SetGetPathListDemo() ) - Console::WriteLine( "SetGetPathList demo completed successfully." ); - else - Console::WriteLine( "SetGetPathList demo failed." ); - - ret = retTmp && ret; - - // Call the AllFiles demo. - if ( retTmp = AllFilesDemo() ) - Console::WriteLine( "AllFiles demo completed successfully." ); - else - Console::WriteLine( "AllFiles demo failed." ); - - ret = retTmp && ret; - return (ret); - } - -}; - - -// Test harness. -int main() -{ - try - { - FileIOPermissionDemo^ democase = gcnew FileIOPermissionDemo; - bool ret = democase->RunDemo(); - if ( ret ) - { - Console::WriteLine( "FileIOPermission demo completed successfully." ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 100; - } - else - { - Console::WriteLine( "FileIOPermission demo failed." ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "FileIOPermission demo failed" ); - Console::WriteLine( e ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - -} - -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp deleted file mode 100644 index 6593317f496..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp +++ /dev/null @@ -1,95 +0,0 @@ - -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; - -int main() -{ - try - { - FileIOPermission^ fileIOPerm1; - fileIOPerm1 = gcnew FileIOPermission(PermissionState::Unrestricted); - - // Tests for: SetPathList(FileIOPermissionAccess,String) - - // Test the Read list - fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, "C:\\documents"); - - Console::WriteLine("Read access before SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) - { - Console::WriteLine("\t" + path); - } - - // - fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, "C:\\temp"); - // - - Console::WriteLine("Read access after SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) - { - Console::WriteLine("\t" + path); - } - - // Test the Write list - fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, "C:\\temp"); - - Console::WriteLine("Write access before SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) - { - Console::WriteLine("\t" + path); - } - // - fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, "C:\\documents"); - // - - Console::WriteLine("Write access after SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) - { - Console::WriteLine("\t" + path); - } - - // Tests for: SetPathList(FileIOPermissionAccess,String[]) - - // Test the Read list - fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, gcnew array {"C:\\pictures", "C:\\music"}); - - Console::WriteLine("Read access before SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) - { - Console::WriteLine("\t" + path); - } - - // - fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, gcnew array {"C:\\temp", "C:\\Documents"}); - // - - Console::WriteLine("Read access after SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) - { - Console::WriteLine("\t" + path); - } - - // Test the Write list - fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, gcnew array {"C:\\temp", "C:\\Documents"}); - - Console::WriteLine("Write access before SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) - { - Console::WriteLine("\t" + path); - } - // - fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, gcnew array {"C:\\pictures", "C:\\music"}); - // - - Console::WriteLine("Write access after SetPathList = "); - for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) - { - Console::WriteLine("\t" + path); - } - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - } -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp deleted file mode 100644 index da97ffa6c9f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -// -// This sample demonstrates the use of the FileIOPermissionAttribute class. -// The sample follows the recommended procedure of first granting PermitOnly permissions, -// then using a Deny on that set of granted permissions. -using namespace System; -using namespace System::Reflection; -using namespace System::Security::Permissions; -using namespace System::Security; -using namespace System::IO; -void PermitOnlyMethod(); -void PermitOnlyTestMethod(); -void TestFailed(); - - -// This method demonstrates the use of the FileIOPermissionAttribute to create a PermitOnly permission. -// -// -// Set the Read property. -[FileIOPermissionAttribute(SecurityAction::PermitOnly,Read="C:\\")] -// -// -// Set the PathDiscovery property. -[FileIOPermissionAttribute(SecurityAction::PermitOnly, -PathDiscovery="C:\\Documents and Settings\\All Users")] -// -// -// Set the Append property. -[FileIOPermissionAttribute(SecurityAction::PermitOnly, -Append="C:\\Documents and Settings\\All Users\\Application Data")] -// -// -// Set the Write property. -[FileIOPermissionAttribute(SecurityAction::PermitOnly, -Write="C:\\Documents and Settings\\All Users\\Application Data\\Microsoft")] -// -// -// Set the All property. -[FileIOPermissionAttribute(SecurityAction::PermitOnly, -All="C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network")] -// - -void PermitOnlyMethod() -{ - Console::WriteLine( "Executing PermitOnlyMethod." ); - Console::WriteLine( "PermitOnly the Read permission for drive C." ); - Console::WriteLine( "PermitOnly the PathDiscovery permission for \n\tC:\\Documents and Settings\\All Users." ); - Console::WriteLine( "PermitOnly the Append permission for \n\tC:\\Documents and Settings\\All Users\\Application Data." ); - Console::WriteLine( "PermitOnly the Write permission for \n\tC:\\Documents and Settings\\All Users\\Application Data\\Microsoft." ); - Console::WriteLine( "PermitOnly the All permission for \n\tC:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network." ); - PermitOnlyTestMethod(); -} -// - -void PermitOnlyTestMethod() -{ - Console::WriteLine("Executing PermitOnlyTestMethod."); - try - { - PermissionSet^ ps = gcnew PermissionSet(PermissionState::None); - ps->AddPermission(gcnew FileIOPermission(FileIOPermissionAccess::Write, - "C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network\\SomeFile")); - Console::WriteLine("Demanding permission to write " + - "'C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network\\SomeFile'"); - ps->Demand(); - Console::WriteLine("Demand succeeded."); - ps->AddPermission( - gcnew FileIOPermission(FileIOPermissionAccess::Write, - "C:\\")); - Console::WriteLine("Demanding permission to write to drive C."); - - // This demand should cause an exception. - ps->Demand(); - // The TestFailed method is called if an exception is not thrown. - TestFailed(); - } - catch (Exception^ e) - { - Console::WriteLine("An exception was thrown because of a write demand: " + e->Message); - } -} - -void TestFailed() -{ - Console::WriteLine( "Executing TestFailed." ); - Console::WriteLine( "Throwing an exception." ); - throw gcnew Exception; -} - -int main() -{ - try - { - PermitOnlyMethod(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp deleted file mode 100644 index 0f1fb73c3e7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp +++ /dev/null @@ -1,260 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -public ref class GacIdentityPermissionDemo -{ -private: - - // - // IsSubsetOf determines whether the current permission is a subset of the specified permission. - bool IsSubsetOfDemo() - { - try - { - - // - GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; - GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission( PermissionState::None ); - if ( Gac1->Equals( Gac2 ) ) - Console::WriteLine( "GacIdentityPermission() equals GacIdentityPermission(PermissionState.None)." ); - - - // - if ( Gac1->IsSubsetOf( Gac2 ) ) - { - Console::WriteLine( "{0} is a subset of {1}", Gac1, Gac2 ); - } - else - { - Console::WriteLine( "{0} is not a subset of {1}", Gac1, Gac2 ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown : {0}", e ); - return false; - } - - return true; - } - - - // - // - // Union creates a new permission that is the union of the current permission - // and the specified permission. - bool UnionDemo() - { - - // - GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission( PermissionState::None ); - - // - // - GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; - - // - try - { - GacIdentityPermission ^ p3 = dynamic_cast(Gac1->Union( Gac2 )); - if ( p3 != nullptr ) - { - Console::WriteLine( "The union of two GacIdentityPermissions was successful." ); - } - else - { - Console::WriteLine( "The union of two GacIdentityPermissions failed." ); - return false; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown : {0}", e ); - return false; - } - - return true; - } - - - // - // - // Intersect creates and returns a new permission that is the intersection of the - // current permission and the specified permission. - bool IntersectDemo() - { - GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; - GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; - try - { - GacIdentityPermission ^ p3 = dynamic_cast(Gac1->Intersect( Gac2 )); - if ( p3 != nullptr ) - { - Console::WriteLine( "The intersection of the two permissions = {0}\n", p3 ); - } - else - { - Console::WriteLine( "The intersection of the two permissions is null.\n" ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception was thrown : {0}", e ); - return false; - } - - return true; - } - - - // - // - //Copy creates and returns an identical copy of the current permission. - bool CopyDemo() - { - GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; - GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; - Console::WriteLine( "**************************************************************************" ); - try - { - Gac2 = dynamic_cast(Gac1->Copy()); - if ( Gac2 != nullptr ) - { - Console::WriteLine( "Result of copy = {0}\n", Gac2 ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Copy failed : {0}{1}", Gac1, e ); - return false; - } - - return true; - } - - - // - // - // ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a - // permission with the specified state from the XML encoding. - bool ToFromXmlDemo() - { - GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; - GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; - Console::WriteLine( "**************************************************************************" ); - try - { - Gac2 = gcnew GacIdentityPermission( PermissionState::None ); - Gac2->FromXml( Gac1->ToXml() ); - bool result = Gac2->Equals( Gac1 ); - if ( Gac2->IsSubsetOf( Gac1 ) && Gac1->IsSubsetOf( Gac2 ) ) - { - Console::WriteLine( "Result of ToFromXml = {0}", Gac2 ); - } - else - { - Console::WriteLine( Gac2 ); - Console::WriteLine( Gac1 ); - return false; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "ToFromXml failed. {0}", e ); - return false; - } - - return true; - } - - -public: - - // - // Invoke all demos. - bool RunDemo() - { - bool returnCode = true; - bool tempReturnCode; - - // Call the IsSubsetOf demo. - if ( tempReturnCode = IsSubsetOfDemo() ) - Console::WriteLine( "IsSubsetOf demo completed successfully." ); - else - Console::WriteLine( "Subset demo failed." ); - - returnCode = tempReturnCode && returnCode; - - // Call the Union demo. - if ( tempReturnCode = UnionDemo() ) - Console::WriteLine( "Union demo completed successfully." ); - else - Console::WriteLine( "Union demo failed." ); - - returnCode = tempReturnCode && returnCode; - - // Call the Intersect demo. - if ( tempReturnCode = IntersectDemo() ) - Console::WriteLine( "Intersect demo completed successfully." ); - else - Console::WriteLine( "Intersect demo failed." ); - - returnCode = tempReturnCode && returnCode; - - // Call the Copy demo. - if ( tempReturnCode = CopyDemo() ) - Console::WriteLine( "Copy demo completed successfully." ); - else - Console::WriteLine( "Copy demo failed." ); - - returnCode = tempReturnCode && returnCode; - - // Call the ToFromXML demo. - if ( tempReturnCode = ToFromXmlDemo() ) - Console::WriteLine( "ToFromXML demo completed successfully." ); - else - Console::WriteLine( "ToFromXml demo failed." ); - - returnCode = tempReturnCode && returnCode; - return (returnCode); - } - -}; - - -// Test harness. -int main() -{ - try - { - GacIdentityPermissionDemo^ testcase = gcnew GacIdentityPermissionDemo; - bool returnCode = testcase->RunDemo(); - if ( returnCode ) - { - Console::WriteLine( "The GacIdentityPermission demo completed successfully." ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 100; - } - else - { - Console::WriteLine( "The GacIdentityPermission demo failed." ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "The GacIdentityPermission demo failed." ); - Console::WriteLine( e ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp deleted file mode 100644 index 19d961987aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -// To run this sample you must create a strong-name key named snkey.snk -// using the Strong Name tool (sn.exe). Both the library assembly and the -// application assembly that calls it must be signed with that key. -// To run successfully, the application assembly must be in the global -// assembly cache. -// This console application can be created using the following code. - -//#using -//#using -//using namespace System; -//using namespace System::Security; -//using namespace System::Reflection; -//using namespace ClassLibrary1; -//[assembly: AssemblyVersion(S"1.0.555.0")] -//[assembly: AssemblyKeyFile(S"snKey.snk")]; -//int main() -//{ -// try -// { -// Class1* myLib = new Class1(); -// myLib->DoNothing(); -// -// Console::WriteLine(S"Exiting the sample."); -// } -// catch (Exception* e) -// { -// Console::WriteLine(e->Message); -// } -//} -using namespace System; -using namespace System::Security::Permissions; - -namespace ClassLibrary1 -{ - // - // Demand that the calling program be in the global assembly cache. - [GacIdentityPermissionAttribute(SecurityAction::Demand)] - public ref class Class1 - // - { - public: - void DoNothing() - { - Console::WriteLine( "Exiting the library program." ); - } - }; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp deleted file mode 100644 index 6d805d4667a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp +++ /dev/null @@ -1,243 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Threading; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Principal; -using namespace System::Security::Permissions; -using namespace System::Diagnostics; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -// -// The following class is an example of code that exposes external process management. -// Add the LicenseProviderAttribute to the control. - -[LicenseProvider(LicFileLicenseProvider::typeid)] -public ref class MyControl: public System::Windows::Forms::Control -{ -private: - - // Create a new, null license. - License^ license; - -public: - [HostProtection(ExternalProcessMgmt=true)] - MyControl() - { - license = nullptr; - - // Determine if a valid license can be granted. - bool isValid = LicenseManager::IsValid( MyControl::typeid ); - Console::WriteLine( "The result of the IsValid method call is {0}", isValid ); - } - -}; -// - -// If this application is run on a server that implements host protection, the HostProtection attribute -// is applied. If the application is run on a server that is not host-protected, the attribute -// evaporates; it is not detected and therefore not applied. HostProtection can be configured with -// members of the HostProtectionResource enumeration to customize the protection offered. -// The primary intent of this sample is to show situations in which the HostProtection attribute -// might be meaningfully used. The environment required to demonstrate a particular HostProtection is -// too complex to invoke within the scope of this sample. -public ref class HostProtectionExample -{ -public: - static int Success = 100; - -private: - - // - // Use the enumeration flags to indicate that this method exposes shared state and - // self-affecting process management. - // Either of the following attribute statements can be used to set the - // resource flags. - // Exit the sample when an exception is thrown. - - [HostProtection(SharedState=true,SelfAffectingProcessMgmt=true)] - [HostProtection(Resources=HostProtectionResource::SharedState| - HostProtectionResource::SelfAffectingProcessMgmt)] - static void Exit( String^ Message, int Code ) - { - Console::WriteLine( "\nFAILED: {0} {1}", Message, Code ); - Environment::ExitCode = Code; - Environment::Exit( Code ); - } - // - - // - // Use the enumeration flags to indicate that this method exposes shared state, - // self-affecting process management, and self-affecting threading. - // This method allows the user to quit the sample. - - [HostProtection(SharedState=true,SelfAffectingProcessMgmt=true, - SelfAffectingThreading=true,UI=true)] - static void ExecuteBreak() - { - Console::WriteLine( "Executing Debugger.Break." ); - Debugger::Break(); - Debugger::Log( 1, "info", "test message" ); - } - // - - // - // Use the enumeration flags to indicate that this method exposes shared state, - // self-affecting threading and the security infrastructure. - // ApplyIdentity sets the current identity. - - [HostProtection(SharedState=true,SelfAffectingThreading=true, - SecurityInfrastructure=true)] - static int ApplyIdentity() - { - array^roles = {"User"}; - try - { - AppDomain^ mAD = AppDomain::CurrentDomain; - GenericPrincipal^ mGenPr = gcnew GenericPrincipal( WindowsIdentity::GetCurrent(),roles ); - mAD->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal ); - mAD->SetThreadPrincipal( mGenPr ); - return Success; - } - catch ( Exception^ e ) - { - Exit( e->ToString(), 5 ); - } - - return 0; - } - // - -public: - - // The following method is started on a separate thread. - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - static void WatchFileEvents() - { - try - { - Console::WriteLine( "In the child thread." ); - FileSystemWatcher^ watcher = gcnew FileSystemWatcher; - watcher->Path = "C:\\Temp"; - - // Watch for changes in LastAccess and LastWrite times, and - // name changes to files or directories. - watcher->NotifyFilter = static_cast(NotifyFilters::LastAccess | NotifyFilters::LastWrite | NotifyFilters::FileName | NotifyFilters::DirectoryName); - - // Watch only text files. - watcher->Filter = "*.txt"; - - // Add event handlers. - watcher->Changed += gcnew FileSystemEventHandler( OnChanged ); - watcher->Created += gcnew FileSystemEventHandler( OnChanged ); - watcher->Deleted += gcnew FileSystemEventHandler( OnChanged ); - - // Begin watching. - watcher->EnableRaisingEvents = true; - - // Wait for the user to quit the program. - Console::WriteLine( "Event handlers have been enabled." ); - while ( Console::Read() != 'q' ) - ; - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - - } - - -private: - - // - // Use the enumeration flags to indicate that this method exposes synchronization - // and external threading. - - [HostProtection(Synchronization=true,ExternalThreading=true)] - static void StartThread() - { - Thread^ t = gcnew Thread( gcnew ThreadStart( WatchFileEvents ) ); - - // Start the new thread. On a uniprocessor, the thread is not given - // any processor time until the main thread yields the processor. - t->Start(); - - // Give the new thread a chance to execute. - Thread::Sleep( 1000 ); - } - // - -public: - - // Call methods that show the use of the HostProtectionResource enumeration. - [HostProtection(Resources=HostProtectionResource::All)] - static int Main() - { - try - { - - // Show use of the HostProtectionResource.SharedState, - // HostProtectionResource.SelfAffectingThreading, and - // HostProtectionResource.Security enumeration values. - ApplyIdentity(); - Directory::CreateDirectory( "C:\\Temp" ); - - // Show use of the HostProtectionResource.Synchronization and - // HostProtectionResource.ExternalThreading enumeration values. - StartThread(); - Console::WriteLine( "In the main thread." ); - Console::WriteLine( "Deleting and creating 'MyTestFile.txt'." ); - if ( File::Exists( "C:\\Temp\\MyTestFile.txt" ) ) - { - File::Delete( "C:\\Temp\\MyTestFile.txt" ); - } - StreamWriter^ sr = File::CreateText( "C:\\Temp\\MyTestFile.txt" ); - sr->WriteLine( "This is my file." ); - sr->Close(); - Thread::Sleep( 1000 ); - - // Show use of the HostProtectionResource.SharedState, - // HostProtectionResource.SelfProcessMgmt, - // HostProtectionResource.SelfAffectingThreading, and - // HostProtectionResource.UI enumeration values. - ExecuteBreak(); - - // Show the use of the HostProtectionResource.ExternalProcessManagement enumeration value. - MyControl^ myControl = gcnew MyControl; - Console::WriteLine( "Enter 'q' to quit the sample." ); - return 100; - } - catch ( Exception^ e ) - { - Exit( e->ToString(), 0 ); - return 0; - } - } - - // Define the event handlers. - private: - static void OnChanged( Object^ /*source*/, FileSystemEventArgs^ e ) - { - - // Specify whether a file is changed, created, or deleted. - Console::WriteLine( "In the OnChanged event handler." ); - Console::WriteLine( "File: {0} {1}", e->FullPath, e->ChangeType ); - } - -}; - -int main() -{ - return HostProtectionExample::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp deleted file mode 100644 index ac08770304c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp +++ /dev/null @@ -1,296 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Cryptography; - -public ref class KeyContainerPermissionDemo -{ -private: - static CspParameters^ cspParams = gcnew CspParameters; - static RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider; - static String^ providerName; - static int providerType; - static String^ myKeyContainerName; - - // Create three KeyContainerPermissionAccessEntry objects, each with a different constructor. - // - static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry1 = gcnew KeyContainerPermissionAccessEntry( "MyKeyContainer",KeyContainerPermissionFlags::Create ); - - // - // - static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry2 = gcnew KeyContainerPermissionAccessEntry( cspParams,KeyContainerPermissionFlags::Open ); - - // - // - static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry3 = gcnew KeyContainerPermissionAccessEntry( "Machine",providerName,providerType,myKeyContainerName,1,KeyContainerPermissionFlags::Open ); - -public: - - // - static int Main() - { - try - { - - // Create a key container for use in the sample. - GenKey_SaveInContainer( "MyKeyContainer" ); - - // Initialize property values for creating a KeyContainerPermissionAccessEntry object. - myKeyContainerName = rsa->CspKeyContainerInfo->KeyContainerName; - providerName = rsa->CspKeyContainerInfo->ProviderName; - providerType = rsa->CspKeyContainerInfo->ProviderType; - cspParams->KeyContainerName = myKeyContainerName; - cspParams->ProviderName = providerName; - cspParams->ProviderType = providerType; - - // Display the KeyContainerPermissionAccessEntry properties using - // the third KeyContainerPermissionAccessEntry object. - DisplayAccessEntryMembers(); - - // - // Add access entry objects to a key container permission. - KeyContainerPermission ^ keyContainerPerm1 = gcnew KeyContainerPermission( PermissionState::Unrestricted ); - Console::WriteLine( "Is the permission unrestricted? {0}", keyContainerPerm1->IsUnrestricted() ); - keyContainerPerm1->AccessEntries->Add( keyContainerPermAccEntry1 ); - keyContainerPerm1->AccessEntries->Add( keyContainerPermAccEntry2 ); - - // - // Display the permission. - System::Console::WriteLine( keyContainerPerm1->ToXml() ); - - // - // Create an array of KeyContainerPermissionAccessEntry objects - array^keyContainerPermAccEntryArray = {keyContainerPermAccEntry1,keyContainerPermAccEntry2}; - - // Create a new KeyContainerPermission using the array. - KeyContainerPermission ^ keyContainerPerm2 = gcnew KeyContainerPermission( KeyContainerPermissionFlags::AllFlags,keyContainerPermAccEntryArray ); - - // - DisplayPermissionMembers( keyContainerPerm2, keyContainerPermAccEntryArray ); - - // Demonstrate the effect of a deny for opening a key container. - DenyOpen(); - - // Demonstrate the deletion of a key container. - DeleteContainer(); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadKey(); - return 0; - - // Close the current try block that did not expect an exception. - } - catch ( Exception^ e ) - { - Console::WriteLine( "Unexpected exception thrown: {0}", e->Message ); - return 0; - } - - } - - -private: - static void DisplayAccessEntryMembers() - { - - // - Console::WriteLine( "\nKeycontainerName is {0}", keyContainerPermAccEntry3->KeyContainerName ); - - // - // - Console::WriteLine( "KeySpec is {0}", (1 == keyContainerPermAccEntry3->KeySpec ? "AT_KEYEXCHANGE " : "AT_SIGNATURE") ); - - // - // - Console::WriteLine( "KeyStore is {0}", keyContainerPermAccEntry3->KeyStore ); - - // - // - Console::WriteLine( "ProviderName is {0}", keyContainerPermAccEntry3->ProviderName ); - - // - // - Console::WriteLine( "ProviderType is {0}", (1 == keyContainerPermAccEntry3->ProviderType ? "PROV_RSA_FULL" : keyContainerPermAccEntry3->ProviderType.ToString()) ); - - // - // - Console::WriteLine( "Hashcode = {0}", keyContainerPermAccEntry3->GetHashCode() ); - - // - // - Console::WriteLine( "Are the KeyContainerPermissionAccessEntry objects equal? {0}", keyContainerPermAccEntry3->Equals( keyContainerPermAccEntry2 ) ); - - // - } - - static void DisplayPermissionMembers( KeyContainerPermission ^ keyContainerPerm2, array^keyContainerPermAccEntryArray ) - { - - // Display the KeyContainerPermission properties. - // - Console::WriteLine( "\nFlags value is {0}", keyContainerPerm2->Flags ); - - // - // - KeyContainerPermission ^ keyContainerPerm3 = dynamic_cast(keyContainerPerm2->Copy()); - Console::WriteLine( "Is the copy equal to the original? {0}", keyContainerPerm3->Equals( keyContainerPerm2 ) ); - - // - // - // Perform an XML roundtrip. - keyContainerPerm3->FromXml( keyContainerPerm2->ToXml() ); - Console::WriteLine( "Was the XML roundtrip successful? {0}", keyContainerPerm3->Equals( keyContainerPerm2 ) ); - - // - KeyContainerPermission ^ keyContainerPerm4 = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Open,keyContainerPermAccEntryArray ); - - // - KeyContainerPermission ^ keyContainerPerm5 = dynamic_cast(keyContainerPerm2->Intersect( keyContainerPerm4 )); - Console::WriteLine( "Flags value after the intersection is {0}", keyContainerPerm5->Flags ); - - // - // - keyContainerPerm5 = dynamic_cast(keyContainerPerm2->Union( keyContainerPerm4 )); - - // - // - Console::WriteLine( "Flags value after the union is {0}", keyContainerPerm5->Flags ); - - // - // - Console::WriteLine( "Is one permission a subset of the other? {0}", keyContainerPerm4->IsSubsetOf( keyContainerPerm2 ) ); - - // - } - - static void GenKey_SaveInContainer( String^ containerName ) - { - - // Create the CspParameters object and set the key container - // name used to store the RSA key pair. - cspParams = gcnew CspParameters; - cspParams->KeyContainerName = containerName; - - // Create a new instance of RSACryptoServiceProvider that accesses - // the key container identified by the containerName parameter. - rsa = gcnew RSACryptoServiceProvider( cspParams ); - - // Display the key information to the console. - Console::WriteLine( "\nKey added to container: \n {0}", rsa->ToXmlString( true ) ); - } - - static void GetKeyFromContainer( String^ containerName ) - { - try - { - cspParams = gcnew CspParameters; - cspParams->KeyContainerName = containerName; - - // Create a new instance of RSACryptoServiceProvider that accesses - // the key container identified by the containerName parameter. - // If the key container does not exist, a new one is created. - rsa = gcnew RSACryptoServiceProvider( cspParams ); - - // Use the rsa object to access the key. - // Display the key information to the console. - Console::WriteLine( "\nKey retrieved from container : \n {0}", rsa->ToXmlString( true ) ); - Console::WriteLine( "KeycontainerName is {0}", rsa->CspKeyContainerInfo->KeyContainerName ); - Console::WriteLine( "ProviderName is {0}", rsa->CspKeyContainerInfo->ProviderName ); - Console::WriteLine( "ProviderType is {0}", (1 == rsa->CspKeyContainerInfo->ProviderType ? "PROV_RSA_FULL" : rsa->CspKeyContainerInfo->ProviderType.ToString()) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception thrown: {0}", e->Message ); - } - - } - - static void DeleteKeyContainer( String^ containerName ) - { - - // Create the CspParameters object and set the key container - // name used to store the RSA key pair. - cspParams = gcnew CspParameters; - cspParams->KeyContainerName = containerName; - - // Create a new instance of RSACryptoServiceProvider that accesses - // the key container. - rsa = gcnew RSACryptoServiceProvider( cspParams ); - - // Do not persist the key entry, effectively deleting the key. - rsa->PersistKeyInCsp = false; - - // Call Clear to release the key container resources. - rsa->Clear(); - Console::WriteLine( "\nKey container released." ); - } - - static void DenyOpen() - { - try - { - - // - // Create a KeyContainerPermission with the right to open the key container. - KeyContainerPermission ^ keyContainerPerm = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Open ); - - // - // Demonstrate the results of a deny for an open action. - keyContainerPerm->Deny(); - - // The next line causes an exception to be thrown when the infrastructure code attempts - // to open the key container. - CspKeyContainerInfo ^ info = gcnew CspKeyContainerInfo( cspParams ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Expected exception thrown: {0}", e->Message ); - } - - - // Revert the deny. - CodeAccessPermission::RevertDeny(); - } - - static void DeleteContainer() - { - try - { - - // Create a KeyContainerPermission with the right to create a key container. - KeyContainerPermission ^ keyContainerPerm = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Create ); - - // Deny the ability to create a key container. - // This deny is used to show the key container has been successfully deleted. - keyContainerPerm->Deny(); - - // Retrieve the key from the container. - // This code executes successfully because the key container already exists. - // The deny for permission to create a key container does not affect this method call. - GetKeyFromContainer( "MyKeyContainer" ); - - // Delete the key and the container. - DeleteKeyContainer( "MyKeyContainer" ); - - // Attempt to obtain the key from the deleted key container. - // This time the method call results in an exception because of - // an attempt to create a new key container. - Console::WriteLine( "\nAttempt to create a new key container with create permission denied." ); - GetKeyFromContainer( "MyKeyContainer" ); - } - catch ( CryptographicException^ e ) - { - Console::WriteLine( "Expected exception thrown: {0}", e->Message ); - } - - } - -}; - -int main() -{ - return KeyContainerPermissionDemo::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp deleted file mode 100644 index 953013ec45d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp +++ /dev/null @@ -1,280 +0,0 @@ -#define debug 0 - -// -//#define debug -// This custom permission is intended only for the purposes of illustration. -// The following code shows how to create a custom permission that inherits -// from CodeAccessPermission. The code implements all required overrides. -// A wildcard character ('*') is implemented for the Name property. - -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; -using namespace System::Security::Policy; -using namespace System::Collections; -using namespace System::Text; - -[assembly:System::Reflection::AssemblyKeyFile("Key.snk")]; -[assembly:System::Security::AllowPartiallyTrustedCallersAttribute]; - -[Serializable] -public ref class NameIdPermission: public CodeAccessPermission, public IUnrestrictedPermission -{ -private: - String^ m_Name; - bool m_Unrestricted; - -public: - NameIdPermission( String^ name ) - { - m_Name = name; - } - - NameIdPermission( PermissionState state ) - { - if ( state == PermissionState::None ) - { - m_Name = ""; - } - else if ( state == PermissionState::Unrestricted ) - { - throw gcnew ArgumentException( "Unrestricted state is not allowed for identity permissions." ); - } - else - { - throw gcnew ArgumentException( "Invalid permission state." ); - } - } - - property String^ Name - { - String^ get() - { - return m_Name; - } - void set( String^ value ) - { - m_Name = value; - } - } - - // -public: - virtual IPermission^ Copy() override - { - String^ name = m_Name; - return gcnew NameIdPermission( name ); - } - // - - // -public: - virtual bool IsUnrestricted() - { - // Always false, unrestricted state is not allowed. - return m_Unrestricted; - } - // - -private: - bool VerifyType( IPermission^ target ) - { - return dynamic_cast(target) != nullptr; - } - - // -public: - virtual bool IsSubsetOf( IPermission^ target ) override - { -#if ( debug ) - Console::WriteLine( "************* Entering IsSubsetOf *********************" ); -#endif - - if ( target == nullptr ) - { - Console::WriteLine( "IsSubsetOf: target == null" ); - return false; - } - -#if ( debug ) - Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name ); - Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name ); -#endif - - try - { - NameIdPermission^ operand = dynamic_cast(target); - - // The following check for unrestricted permission is only included as an example for - // permissions that allow the unrestricted state. It is of no value for this permission. - if ( true == operand->m_Unrestricted ) - { - return true; - } - else if ( true == this->m_Unrestricted ) - { - return false; - } - - if ( this->m_Name != nullptr ) - { - if ( operand->m_Name == nullptr ) - { - return false; - } - if ( this->m_Name->Equals( "" ) ) - { - return true; - } - } - - if ( this->m_Name->Equals( operand->m_Name ) ) - { - return true; - } - else - { - // Check for wild card character '*'. - int i = operand->m_Name->LastIndexOf( "*" ); - - if ( i > 0 ) - { - String^ prefix = operand->m_Name->Substring( 0, i ); - if ( this->m_Name->StartsWith( prefix ) ) - { - return true; - } - } - } - return false; - } - catch ( InvalidCastException^ ) - { - throw gcnew ArgumentException( String::Format( "Argument_WrongType", this->GetType()->FullName ) ); - } - } - // - - // -public: - virtual IPermission^ Intersect( IPermission^ target ) override - { - Console::WriteLine( "************* Entering Intersect *********************" ); - if ( target == nullptr ) - { - return nullptr; - } - -#if ( debug ) - Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name ); - Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name ); -#endif - - if ( !VerifyType( target ) ) - { - throw gcnew ArgumentException( String::Format( "Argument is wrong type.", this->GetType()->FullName ) ); - } - - NameIdPermission^ operand = dynamic_cast(target); - - if ( operand->IsSubsetOf( this ) ) - { - return operand->Copy(); - } - else if ( this->IsSubsetOf( operand ) ) - { - return this->Copy(); - } - else - { - return nullptr; - } - } - // - - // -public: - virtual IPermission^ Union( IPermission^ target ) override - { -#if ( debug ) - Console::WriteLine( "************* Entering Union *********************" ); -#endif - - if ( target == nullptr ) - { - return this; - } - -#if ( debug ) - Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name ); - Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name ); -#endif - - if ( !VerifyType( target ) ) - { - throw gcnew ArgumentException( String::Format( "Argument_WrongType", this->GetType()->FullName ) ); - } - - NameIdPermission^ operand = dynamic_cast(target); - - if ( operand->IsSubsetOf( this ) ) - { - return this->Copy(); - } - else if ( this->IsSubsetOf( operand ) ) - { - return operand->Copy(); - } - else - { - return nullptr; - } - } - // - - // -public: - virtual void FromXml( SecurityElement^ e ) override - { - // The following code for unrestricted permission is only included as an example for - // permissions that allow the unrestricted state. It is of no value for this permission. - String^ elUnrestricted = e->Attribute("Unrestricted"); - if ( nullptr != elUnrestricted ) - { - m_Unrestricted = Boolean::Parse( elUnrestricted ); - return; - } - - String^ elName = e->Attribute("Name"); - m_Name = elName == nullptr ? nullptr : elName; - } - // - - // -public: - virtual SecurityElement^ ToXml() override - { - // Use the SecurityElement class to encode the permission to XML. - SecurityElement^ esd = gcnew SecurityElement( "IPermission" ); - String^ name = NameIdPermission::typeid->AssemblyQualifiedName; - esd->AddAttribute( "class", name ); - esd->AddAttribute( "version", "1.0" ); - - // The following code for unrestricted permission is only included as an example for - // permissions that allow the unrestricted state. It is of no value for this permission. - if ( m_Unrestricted ) - { - esd->AddAttribute( "Unrestricted", true.ToString() ); - } - - if ( m_Name != nullptr ) - { - esd->AddAttribute( "Name", m_Name ); - } - - return esd; - } - // -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp deleted file mode 100644 index 603984a43af..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// -// To execute this sample you will need two certification files, MyCert1.cer and MyCert2.cer. -// The certification files can be created using the Certification Creation Tool, MakeCert.exe, -// which runs from the command line. Usage: MakeCert MyCert1.cer - -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; - -// Demonstrate all methods. -void main() -{ - Console::WriteLine("Welcome to the PublisherIdentityPermission CPP sample\n"); - - array^publisherCertificate = gcnew array(2); - PublisherIdentityPermission ^ publisherPerm1; - PublisherIdentityPermission ^ publisherPerm2; - - // Initialize the PublisherIdentityPermissions for use in the sample -// - FileStream ^ fs1 = gcnew FileStream("MyCert1.cer", FileMode::Open); - array^certSBytes1 = gcnew array((int)fs1->Length); - fs1->Read(certSBytes1, 0, (int)fs1->Length); - publisherCertificate[0] = gcnew X509Certificate(certSBytes1); - fs1->Close(); - - FileStream ^ fs2 = gcnew FileStream("MyCert2.cer", FileMode::Open); - array^certSBytes2 = gcnew array((int)fs2->Length); - fs2->Read(certSBytes2, 0, (int)fs2->Length); - publisherCertificate[1] = gcnew X509Certificate(certSBytes2); - fs2->Close(); -// - - publisherPerm1 = gcnew PublisherIdentityPermission(publisherCertificate[0]); - publisherPerm2 = gcnew PublisherIdentityPermission(publisherCertificate[1]); - -// - Console::WriteLine("\n******************** IsSubsetOf DEMO ********************\n"); - // IsSubsetOf determines whether the current permission is a subset of the specified permission. - if (publisherPerm2->IsSubsetOf(publisherPerm1)) - Console::WriteLine(publisherPerm2->Certificate->Subject + " is a subset of " + - publisherPerm1->Certificate->Subject); - else - Console::WriteLine(publisherPerm2->Certificate->Subject + " is not a subset of " + - publisherPerm1->Certificate->Subject); -// - -// - Console::WriteLine("\n******************** Copy DEMO ********************\n"); - // Copy creates and returns an identical copy of the current permission. -// - // Create an empty PublisherIdentityPermission to serve as the target of the copy. - publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None); - publisherPerm2 = (PublisherIdentityPermission^)publisherPerm1->Copy(); - Console::WriteLine("Result of copy = " + publisherPerm2); -// -// - - -// - Console::WriteLine("\n******************** Union DEMO ********************\n"); - PublisherIdentityPermission ^ publisherPerm3 = (PublisherIdentityPermission ^)publisherPerm1->Union(publisherPerm2); - - if (publisherPerm3 == nullptr) - Console::WriteLine("The union of " + publisherPerm1 + " and " + - publisherPerm2->Certificate->Subject + " is null."); - else - Console::WriteLine("The union of " + publisherPerm1->Certificate->Subject + " and " + - publisherPerm2->Certificate->Subject + " = " + - publisherPerm3->Certificate->Subject); -// - - -// - // Intersect creates and returns a new permission that is the intersection of the current - // permission and the permission specified. - Console::WriteLine("\n******************** Intersect DEMO ********************\n"); - publisherPerm3 = (PublisherIdentityPermission^)publisherPerm1->Intersect(publisherPerm2); - if (publisherPerm3 != nullptr) - Console::WriteLine("The intersection of " + publisherPerm1->Certificate->Subject + - " and " + publisherPerm2->Certificate->Subject + " = " + - publisherPerm3->Certificate->Subject); - else - Console::WriteLine("The intersection of " + publisherPerm1->Certificate->Subject + " and " + - publisherPerm2->Certificate->Subject + " is null."); - // - - -// -// ToXml creates an XML encoding of the permission and its current state; -// FromXml reconstructs a permission with the specified state from the XML encoding. - Console::WriteLine("\n******************** ToXml DEMO ********************\n"); - publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None); - publisherPerm2->FromXml(publisherPerm1->ToXml()); - Console::WriteLine("Result of ToFromXml = " + publisherPerm2); -// - - Console::WriteLine("Press Enter to return"); - Console::ReadLine(); -} - -/* -Expected output: - -Welcome to the PublisherIdentityPermission CPP sample - - -******************** IsSubsetOf DEMO ******************** - -CN=Joe's-Software-Emporium is not a subset of CN=Joe's-Software-Emporium - -******************** Copy DEMO ******************** - -Result of copy = - - -******************** Union DEMO ******************** - -The union of CN=Joe's-Software-Emporium and CN=Joe's-Software-Emporium = CN=Joe' -s-Software-Emporium - -******************** Intersect DEMO ******************** - -The intersection of CN=Joe's-Software-Emporium and CN=Joe's-Software-Emporium = -CN=Joe's-Software-Emporium - -******************** ToXml DEMO ******************** - -Result of ToFromXml = - -Press Enter to return -*/ - -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp deleted file mode 100644 index cfad634f423..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp +++ /dev/null @@ -1,457 +0,0 @@ - -// -// This sample demonstrates the use of the SecurityPermissionAttribute. -using namespace System; -using namespace System::Security::Permissions; -using namespace System::Security; -class MyClass -{ -public: - static void PermissionDemo() - { - try - { - DenySecurityPermissions(); - DenyAllSecurityPermissions(); - DoNotDenySecurityPermissions(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - - } - - - // This method demonstrates the use of the SecurityPermissionAttribute to deny individual security permissions. - // - // Set the Assertion property. - [SecurityPermissionAttribute(SecurityAction::Deny,Assertion=true)] - // - // - // Set the ControlAppDomain property. - [SecurityPermissionAttribute(SecurityAction::Deny,ControlAppDomain=true)] - // - // - // Set the ControlDomainPolicy property. - [SecurityPermissionAttribute(SecurityAction::Deny,ControlDomainPolicy=true)] - // - // - [SecurityPermissionAttribute(SecurityAction::Deny,ControlEvidence=true)] - // Set the ControlEvidence property. - // - // - [SecurityPermissionAttribute(SecurityAction::Deny,ControlPolicy=true)] - // Set the ControlPolicy property. - // - // - [SecurityPermissionAttribute(SecurityAction::Deny,ControlPrincipal=true)] - // Set the ControlPrincipal property. - // - // - // Set the ControlThread property. - [SecurityPermissionAttribute(SecurityAction::Deny,ControlThread=true)] - // - // - // Set the Execution property. - [SecurityPermissionAttribute(SecurityAction::Deny,Execution=true)] - // - // - // Set the Flags property. - [SecurityPermissionAttribute(SecurityAction::Deny,Flags=SecurityPermissionFlag::NoFlags)] - // - // - // Set the Infrastructure property. - [SecurityPermissionAttribute(SecurityAction::Deny,Infrastructure=true)] - // - // - // Set the RemotingConfiguration property. - [SecurityPermissionAttribute(SecurityAction::Deny,RemotingConfiguration=true)] - // - // - // Set the SerializationFormatter property. - [SecurityPermissionAttribute(SecurityAction::Deny,SerializationFormatter=true)] - // - // - // Set the SkipVerification property. - [SecurityPermissionAttribute(SecurityAction::Deny,SkipVerification=true)] - // - // - // Set the UnmanagedCode property. - [SecurityPermissionAttribute(SecurityAction::Deny,UnmanagedCode=true)] - // - - static void DenySecurityPermissions() - { - Console::WriteLine( "Executing DenySecurityPermissions." ); - Console::WriteLine( "Denied all permissions individually." ); - TestSecurityPermissions(); - } - - - // This method demonstrates the use of SecurityPermissionFlag::AllFlags to deny all security permissions. - - [SecurityPermissionAttribute(SecurityAction::Deny,Flags=SecurityPermissionFlag::AllFlags)] - static void DenyAllSecurityPermissions() - { - Console::WriteLine( "\nExecuting DenyAllSecurityPermissions." ); - Console::WriteLine( "Denied all permissions using SecurityPermissionFlag::AllFlags." ); - TestSecurityPermissions(); - } - - - // This method demonstrates the effect of not denying security permissions. - static void DoNotDenySecurityPermissions() - { - Console::WriteLine( "\nExecuting DoNotDenySecurityPermissions." ); - Console::WriteLine( "No permissions have been denied." ); - DemandSecurityPermissions(); - } - - static void TestSecurityPermissions() - { - Console::WriteLine( "\nExecuting TestSecurityPermissions.\n" ); - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Assertion ); - Console::WriteLine( "Demanding SecurityPermissionFlag::Assertion" ); - - // This demand should cause an exception. - sp->Demand(); - - // The TestFailed method is called if an exception is not thrown. - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlAppDomain ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlAppDomain" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlDomainPolicy ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlDomainPolicy" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlEvidence ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlEvidence" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPolicy ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPolicy" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPrincipal ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPrincipal" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlThread ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlThread" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Execution ); - Console::WriteLine( "Demanding SecurityPermissionFlag::Execution" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::Execution failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Infrastructure ); - Console::WriteLine( "Demanding SecurityPermissionFlag::Infrastructure" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::RemotingConfiguration ); - Console::WriteLine( "Demanding SecurityPermissionFlag::RemotingConfiguration" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SerializationFormatter ); - Console::WriteLine( "Demanding SecurityPermissionFlag::SerializationFormatter" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SkipVerification ); - Console::WriteLine( "Demanding SecurityPermissionFlag::SkipVerification" ); - sp->Demand(); - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::UnmanagedCode ); - Console::WriteLine( "Demanding SecurityPermissionFlag::UnmanagedCode" ); - - // This demand should cause an exception. - sp->Demand(); - - // The TestFailed method is called if an exception is not thrown. - TestFailed(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode failed: {0}", e->Message ); - } - - } - - static void TestFailed() - { - Console::WriteLine( "In TestFailed method." ); - Console::WriteLine( "Throwing an exception." ); - throw gcnew Exception; - } - -// - static void DemandSecurityPermissions() - { - Console::WriteLine( "\nExecuting DemandSecurityPermissions.\n" ); - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Assertion ); - Console::WriteLine( "Demanding SecurityPermissionFlag::Assertion" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlAppDomain ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlAppDomain" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlDomainPolicy ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlDomainPolicy" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlEvidence ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlEvidence" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPolicy ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPolicy" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPrincipal ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPrincipal" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlThread ); - Console::WriteLine( "Demanding SecurityPermissionFlag::ControlThread" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Execution ); - Console::WriteLine( "Demanding SecurityPermissionFlag::Execution" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::Execution succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::Execution failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Infrastructure ); - Console::WriteLine( "Demanding SecurityPermissionFlag::Infrastructure" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::RemotingConfiguration ); - Console::WriteLine( "Demanding SecurityPermissionFlag::RemotingConfiguration" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SerializationFormatter ); - Console::WriteLine( "Demanding SecurityPermissionFlag::SerializationFormatter" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SkipVerification ); - Console::WriteLine( "Demanding SecurityPermissionFlag::SkipVerification" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification failed: {0}", e->Message ); - } - - try - { - SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::UnmanagedCode ); - Console::WriteLine( "Demanding SecurityPermissionFlag::UnmanagedCode" ); - sp->Demand(); - Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode succeeded." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode failed: {0}", e->Message ); - } - - } -// - -}; - -int main() -{ - MyClass::PermissionDemo(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp deleted file mode 100644 index 1cf6f037e02..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp +++ /dev/null @@ -1,143 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Security::Permissions; -using namespace System::Security::Cryptography; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::Security; -using namespace System::IO; - -[assembly:StorePermissionAttribute(SecurityAction::RequestMinimum, -Flags=StorePermissionFlags::DeleteStore)]; -void AddToStore( X509Certificate2 ^ cert ); -void ShowMembers(); -int main() -{ - - // - Console::WriteLine( "Creating a permission with Flags = OpenStore." ); - StorePermission^ sp = gcnew StorePermission( StorePermissionFlags::OpenStore ); - - // - //Create a new X509 store named teststore from the local certificate store. - //You must put in a valid path to a certificate in the following constructor. - X509Certificate2^ certificate = gcnew X509Certificate2( "c:\\certificates\\*****.cer" ); - - // Deny the permission to open a store. - sp->Deny(); - - // The following code results in an exception due to an attempt to open a store. - AddToStore( certificate ); - - // Remove the deny for opening a store. - CodeAccessPermission::RevertDeny(); - - // The following code results in an exception due to an attempt to add a certificate. - // The exception is thrown due to a StorePermissionAttribute on the method denying AddToStore permission. - AddToStore( certificate ); - - // The current code is not affected by the attribute in the previously called method, so the following - // intructions execute without an exception. - X509Store^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser ); - store->Open( OpenFlags::ReadWrite ); - store->Add( certificate ); - - // Demonstrate the behavior of the class members. - ShowMembers(); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadKey(); -} - - -// -//Deny the permission the ability to add to a store. - -[StorePermission(SecurityAction::Deny,Flags=StorePermissionFlags::AddToStore)] -void AddToStore( X509Certificate2^ cert ) -{ - try - { - X509Store^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser ); - store->Open( OpenFlags::ReadWrite ); - - // The following attempt to add a certificate results in an exception being thrown. - store->Add( cert ); - return; - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Security exception thrown when attempting: {0}", - (dynamic_cast(e->FirstPermissionThatFailed))->Flags ); - return; - } - -} - - -// -// The following function is intended to demonstrate only the behavior of -// StorePermission class members,and not their practical usage. Most properties -// and methods in this class are used for the resolution and enforcement of -// security policy by the security infrastructure code. -void ShowMembers() -{ - Console::WriteLine( "Creating first permission with Flags = OpenStore." ); - StorePermission^ sp1 = gcnew StorePermission( StorePermissionFlags::OpenStore ); - Console::WriteLine( "Creating second permission with Flags = AllFlags." ); - StorePermission^ sp2 = gcnew StorePermission( StorePermissionFlags::AllFlags ); - Console::WriteLine( "Creating third permission as Unrestricted." ); - - // - StorePermission^ sp3 = gcnew StorePermission( PermissionState::Unrestricted ); - - // - Console::WriteLine( "Creating fourth permission with a permission state of none." ); - StorePermission^ sp4 = gcnew StorePermission( PermissionState::None ); - - // - bool rc = sp2->IsSubsetOf( sp3 ); - Console::WriteLine( "Is the permission with complete store access (AllFlags) a subset of \n" - "\tthe permission with an Unrestricted permission state? {0}", (rc ? (String^)"Yes" : "No") ); - rc = sp1->IsSubsetOf( sp2 ); - Console::WriteLine( "Is the permission with OpenStore access a subset of the permission with \n" - "\tcomplete store access (AllFlags)? {0}", (rc ? (String^)"Yes" : "No") ); - - // - // - rc = sp3->IsUnrestricted(); - Console::WriteLine( "Is the third permission unrestricted? {0}", (rc ? (String^)"Yes" : "No") ); - - // - // - Console::WriteLine( "Copying the second permission to the fourth permission." ); - sp4 = dynamic_cast(sp2->Copy()); - rc = sp4->Equals( sp2 ); - Console::WriteLine( "Is the fourth permission equal to the second permission? {0}", (rc ? (String^)"Yes" : "No") ); - - // - // - Console::WriteLine( "Creating the intersection of the second and first permissions." ); - sp4 = dynamic_cast(sp2->Intersect( sp1 )); - Console::WriteLine( "Value of the Flags property is: {0}", sp4->Flags ); - - // - // - Console::WriteLine( "Creating the union of the second and first permissions." ); - sp4 = dynamic_cast(sp2->Union( sp1 )); - Console::WriteLine( "Result of the union of the second permission with the first: {0}", sp4->Flags ); - - // - // - Console::WriteLine( "Using an XML roundtrip to reset the fourth permission." ); - sp4->FromXml( sp2->ToXml() ); - rc = sp4->Equals( sp2 ); - Console::WriteLine( "Does the XML roundtrip result equal the original permission? {0}", (rc ? (String^)"Yes" : "No") ); - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp deleted file mode 100644 index 6fbc207a89a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp +++ /dev/null @@ -1,244 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Runtime::InteropServices; - -// This class generates StrongNameIdentityPermission objects. - -[assembly:CLSCompliant(true)]; - -public ref class StrongNameIdentityDemo -{ -private: - // Public key - static array^b1 = {0,36,0,0,4,128,0,0,148,0,0,0,6,2,0,0,0,36,0,0,82,83,65,49,0,4,0,0,1,0,1,0,237,146,145,51,34,97,123,196,90,174,41,170,173,221,41,193,175,39,7,151,178,0,230,152,218,8,206,206,170,84,111,145,26,208,158,240,246,219,228,34,31,163,11,130,16,199,111,224,4,112,46,84,0,104,229,38,39,63,53,189,0,157,32,38,34,109,0,171,114,244,34,59,9,232,150,192,247,175,104,143,171,42,219,66,66,194,191,218,121,59,92,42,37,158,13,108,210,189,9,203,204,32,48,91,212,101,193,19,227,107,25,133,70,2,220,83,206,71,102,245,104,252,87,109,190,56,34,180}; - static StrongNamePublicKeyBlob^ blob = gcnew StrongNamePublicKeyBlob( b1 ); - - // Use this version number. - static Version^ v1 = gcnew Version( "1.0.0.0" ); - - // - // IsSubsetOf determines whether the current permission is a subset of the specified permission. - bool IsSubsetOfDemo() - { - bool returnValue = true; - - StrongNameIdentityPermission^ snIdPerm1; - StrongNameIdentityPermission^ snIdPerm2; - - // - snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); - // - snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); - - if (snIdPerm1->IsSubsetOf(snIdPerm2)) - { - - Console::WriteLine("MyCompany.MyDepartment.* is a subset " + - "of MyCompany.MyDepartment.MyFile \n"); - } - else - { - Console::WriteLine("MyCompany.MyDepartment.*" + - " is not a subset of MyCompany.MyDepartment.MyFile \n"); - } - - return returnValue; - } - - - // - // - // Union creates a new permission that is the union of the current permission and the specified permission. - bool UnionDemo() - { - bool returnValue = true; - StrongNameIdentityPermission^ snIdPerm1; - StrongNameIdentityPermission^ snIdPerm2; - IPermission^ snIdPerm3; - snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); - snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); - snIdPerm3 = dynamic_cast(snIdPerm1->Union( snIdPerm2 )); - snIdPerm3 = snIdPerm1->Union( snIdPerm2 ); - - try - { - Console::WriteLine("The union of MyCompany.MyDepartment.*" + - "and MyCompany.MyDepartment.MyFile is " + - (dynamic_cast(snIdPerm3))->Name); - } - catch (Exception^ e) - { - Console::WriteLine("An expected exception was thrown: " + e->Message); - } - - - return returnValue; - } - - - // - // - // Intersect creates and returns a new permission that is the intersection of the current - // permission and the permission specified. - bool IntersectDemo() - { - bool returnValue = true; - StrongNameIdentityPermission^ snIdPerm1; - StrongNameIdentityPermission^ snIdPerm2; - StrongNameIdentityPermission^ snIdPerm3; - snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); - snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); - - try - { - - snIdPerm3 = dynamic_cast(snIdPerm1->Intersect(snIdPerm2)); - - Console::WriteLine("The intersection of MyCompany.MyDepartment.*" + - "and MyCompany.MyDepartment.MyFile is " + - (dynamic_cast(snIdPerm3))->Name); - } - catch (Exception^ e) - { - Console::WriteLine("An exception was thrown: " + e); - returnValue = false; - } - - return returnValue; - - } - - - // - // - //Copy creates and returns an identical copy of the current permission. - bool CopyDemo() - { - bool returnValue = true; - StrongNameIdentityPermission^ snIdPerm1; - StrongNameIdentityPermission^ snIdPerm2; - snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); - // - snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None); - // - - snIdPerm2 = dynamic_cast(snIdPerm1->Copy()); - Console::WriteLine("Result of copy = " + snIdPerm2->ToString() + "\n"); - - return returnValue; - } - - - // - // - // ToXml creates an XML encoding of the permission and its current state; - //FromXml reconstructs a permission with the specified state from the XML encoding. - bool ToFromXmlDemo() - { - bool returnValue = true; - StrongNameIdentityPermission^ snIdPerm1; - StrongNameIdentityPermission^ snIdPerm2; - snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); - snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None); - snIdPerm2->FromXml(snIdPerm1->ToXml()); - Console::WriteLine("Result of ToFromXml = " + snIdPerm2->ToString() + "\n"); - - return returnValue; - } - - -public: - - // - // Invoke all demos. - bool RunDemo() - { - bool ret = true; - bool retTmp; - - // Call the IsSubsetOf demo. - if ( retTmp = IsSubsetOfDemo() ) - Console::WriteLine( "IsSubsetOf demo completed successfully." ); - else - Console::WriteLine( "IsSubsetOf demo failed." ); - - ret = retTmp && ret; - - // Call the Union demo. - if ( retTmp = UnionDemo() ) - Console::WriteLine( "Union demo completed successfully." ); - else - Console::WriteLine( "Union demo failed." ); - - ret = retTmp && ret; - - // Call the Intersect demo. - if ( retTmp = IntersectDemo() ) - Console::WriteLine( "Intersect demo completed successfully." ); - else - Console::WriteLine( "Intersect demo failed." ); - - ret = retTmp && ret; - - // Call the Copy demo. - if ( retTmp = CopyDemo() ) - Console::WriteLine( "Copy demo completed successfully" ); - else - Console::WriteLine( "Copy demo failed." ); - - ret = retTmp && ret; - - // Call the ToFromXml demo. - if ( retTmp = ToFromXmlDemo() ) - Console::WriteLine( "ToFromXml demo completed successfully" ); - else - Console::WriteLine( "ToFromXml demo failed." ); - - ret = retTmp && ret; - Console::WriteLine( "********************************************************\n" ); - return (ret); - } - -}; - - -// Test harness. -int main() -{ - try - { - StrongNameIdentityDemo^ democase = gcnew StrongNameIdentityDemo; - bool ret = democase->RunDemo(); - if ( ret ) - { - Console::WriteLine( "StrongNameIdentity demo completed successfully." ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 100; - } - else - { - Console::WriteLine( "StrongNameIdentity demo failed." ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "StrongNameIdentity demo failed." ); - Console::WriteLine( e ); - Console::WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - -} - -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp deleted file mode 100644 index 2ff0e156c43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// UIPermCPP.cpp : main project file. - - - -// -// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml and FromXml methods -// of the UIPermission class. - -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Runtime::InteropServices; - -void IsSubsetOfDemo(); // Forward references -void CopyDemo(); -void UnionDemo(); -void IntersectDemo(); -void ToFromXmlDemo(); - - -int main() -{ - IsSubsetOfDemo(); - CopyDemo(); - UnionDemo(); - IntersectDemo(); - ToFromXmlDemo(); -} - - - -// -// IsSubsetOf determines whether the current permission is a subset of the specified permission. - -void IsSubsetOfDemo() -{ - Console::WriteLine("\n********************** IsSubsetOf() Demo **********************\n"); -// - UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); -// - UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows); - - Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm1->Window, - uiPerm1->IsSubsetOf(uiPerm2)?"":"not ", uiPerm2->Window); - - Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm2->Window, - uiPerm2->IsSubsetOf(uiPerm1)?"":"not ", uiPerm1->Window); - -// - uiPerm1 = gcnew UIPermission(UIPermissionClipboard::AllClipboard); -// - uiPerm2 = gcnew UIPermission(UIPermissionClipboard::OwnClipboard); - - Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm1->Clipboard, - uiPerm1->IsSubsetOf(uiPerm2)?"":"not ", uiPerm2->Clipboard); - - Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm2->Clipboard, - uiPerm2->IsSubsetOf(uiPerm1)?"":"not ", uiPerm1->Clipboard); -} -// - - - -// - // Union creates a new permission that is the union of the current permission - // and the specified permission. -void UnionDemo() -{ - Console::WriteLine("\n************************ Union() Demo *************************\n"); - - UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); - UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows); - - UIPermission ^ p3 = dynamic_cast(uiPerm1->Union(uiPerm2)); - Console::WriteLine(" The union of {0} and \n\t{1} = {2} ", uiPerm1->Window, - uiPerm2->Window, (nullptr != p3)?p3->Window.ToString():"null"); -} -// - -// -// Intersect creates and returns a new permission that is the intersection of the -// current permission and the permission specified. -void IntersectDemo() -{ - Console::WriteLine("\n********************** Intersect() Demo ***********************\n"); -// - UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows,UIPermissionClipboard::OwnClipboard); -// - UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows,UIPermissionClipboard::NoClipboard); - UIPermission ^ p3 = (UIPermission^)uiPerm1->Intersect(uiPerm2); - - Console::WriteLine(" The intersection of {0} and \n\t{1} = {2} ", uiPerm1->Window, - uiPerm1->Window, (nullptr != p3)?p3->Window.ToString():"null"); - - Console::WriteLine(" The intersection of " + uiPerm1->Clipboard.ToString() + " and \n\t" + - uiPerm2->Clipboard.ToString() + " is " + p3->Clipboard.ToString()); -} -// - - -// -//Copy creates and returns an identical copy of the current permission. -void CopyDemo() -{ - Console::WriteLine("\n************************* Copy() Demo *************************\n"); - - UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); - // - UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None); - // - uiPerm2 = (UIPermission ^)uiPerm1->Copy(); - if (uiPerm2 != nullptr) - Console::WriteLine("The copy succeeded: " + uiPerm2->ToString()); -} -// - -// - -// ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a -// permission with the specified state from the XML encoding. -void ToFromXmlDemo() -{ - Console::WriteLine("\n********************** To/From XML() Demo *********************\n"); - - UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); - UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None); - uiPerm2->FromXml(uiPerm1->ToXml()); - bool result = uiPerm2->Equals(uiPerm1); - if (result) - Console::WriteLine("Result of ToFromXml = " + uiPerm2->ToString()); - else - { - Console::WriteLine(uiPerm2->ToString()); - Console::WriteLine(uiPerm1->ToString()); - } -} -// -// - -/* -// This code example creates the following output: - -********************** IsSubsetOf() Demo ********************** - - SafeTopLevelWindows is not a subset of SafeSubWindows - SafeSubWindows is a subset of SafeTopLevelWindows - AllClipboard is not a subset of OwnClipboard - OwnClipboard is a subset of AllClipboard - -************************* Copy() Demo ************************* - -The copy succeeded: - - -************************ Union() Demo ************************* - - The union of SafeTopLevelWindows and - SafeSubWindows = SafeTopLevelWindows - -********************** Intersect() Demo *********************** - - The intersection of SafeTopLevelWindows and - SafeTopLevelWindows = SafeSubWindows - The intersection of OwnClipboard and - NoClipboard is NoClipboard - -********************** To/From XML() Demo ********************* - -Result of ToFromXml = - -*/ \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp deleted file mode 100644 index ba4df789e20..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Runtime::InteropServices; - -void IsSubsetOfDemo(); // Forward references -void CopyDemo(); -void IntersectDemo(); -void ToFromXmlDemo(); - -void main() -{ - IsSubsetOfDemo(); - CopyDemo(); - IntersectDemo(); - ToFromXmlDemo(); - - Console::WriteLine("\n\nPress ENTER to return"); - Console::ReadLine(); -} - -// -// IsSubsetOf determines whether the current permission is a subset of the specified permission. -void IsSubsetOfDemo() -{ - // - UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/"); - // - UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/*"); - - if (permIdPerm1->IsSubsetOf(permIdPerm2)) - Console::WriteLine(permIdPerm1->Url + " is a subset of " + permIdPerm2->Url); - else Console::WriteLine(permIdPerm1->Url + " is not a subset of " + permIdPerm2->Url); - if (permIdPerm2->IsSubsetOf(permIdPerm1)) - Console::WriteLine(permIdPerm2->Url + " is a subset of " + permIdPerm1->Url); - else Console::WriteLine(permIdPerm2->Url + " is not a subset of " + permIdPerm1->Url); -} -// - -// -// Intersect creates and returns a gcnew permission that is the intersection of the -// current permission and the permission specified. -void IntersectDemo() -{ - - UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/"); - UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/*"); - UrlIdentityPermission ^ p3 = (UrlIdentityPermission^)permIdPerm1->Intersect(permIdPerm2); - - if (p3 != nullptr) - Console::WriteLine("The intersection of " + permIdPerm1->Url + " and \n\t" + - permIdPerm2->Url + " is " + p3->Url + "\n"); - else Console::WriteLine("The intersection of " + permIdPerm1->Url + - " and \n\t" + permIdPerm2->Url + " is null.\n"); -} -// - -// -//Copy creates and returns an identical copy of the current permission. -void CopyDemo() -{ - UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/*"); - // - UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None); - // - permIdPerm2 = (UrlIdentityPermission^)permIdPerm1->Copy(); - if (permIdPerm2) - Console::WriteLine("The copy succeeded: " + permIdPerm2->ToString() + " \n"); -} -// - -// -// ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a -// permission with the specified state from the XML encoding. -void ToFromXmlDemo() -{ - UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/*"); - UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None); - permIdPerm2->FromXml(permIdPerm1->ToXml()); - bool result = permIdPerm2->Equals(permIdPerm1); - if (result) - Console::WriteLine("Result of ToFromXml = " + permIdPerm2->ToString()); - else - { - Console::WriteLine(permIdPerm2->ToString()); - Console::WriteLine(permIdPerm1->ToString()); - } - -} -// - - - -// -// This code example creates the following output: - -//http://www.fourthcoffee.com/process/ is a subset of http://www.fourthcoffee.com/ -//* -//http://www.fourthcoffee.com/* is not a subset of http://www.fourthcoffee.com/pro -//cess/ -//The copy succeeded: - - -//The union of http://www.fourthcoffee.com/process/ and -// http://www.fourthcoffee.com/* failed. -//The operation is ambiguous because the permission represents multiple identities -//. -//The intersection of http://www.fourthcoffee.com/process/ and -// http://www.fourthcoffee.com/* is http://www.fourthcoffee.com/process/ - -//Result of ToFromXml = \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp deleted file mode 100644 index 374ca3601e0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp +++ /dev/null @@ -1,220 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; -using namespace System::Globalization; -public ref class Evidence_Example -{ -public: - bool CreateEvidence() - { - bool retVal = true; - try - { - // Create empty evidence using the default contructor. - // - Evidence^ ev1 = gcnew Evidence; - Console::WriteLine( "Created empty evidence with the default constructor." ); - - // - // Constructor used to create null host evidence. - Evidence^ ev2a = gcnew Evidence( nullptr ); - Console::WriteLine( "Created an Evidence object with null host evidence." ); - - // Constructor used to create host evidence. - // - Url^ url = gcnew Url( "http://www.treyresearch.com" ); - Console::WriteLine( "Adding host evidence {0}", url ); - ev2a->AddHost( url ); - Evidence^ ev2b = gcnew Evidence( ev2a ); - Console::WriteLine( "Copy evidence into new evidence" ); - IEnumerator^ enum1 = ev2b->GetHostEnumerator(); - enum1->MoveNext(); - Console::WriteLine( enum1->Current ); - - // - // Constructor used to create both host and assembly evidence. - // - array^oa1 = {}; - Site^ site = gcnew Site( "www.wideworldimporters.com" ); - array^oa2 = {url,site}; - Evidence^ ev3a = gcnew Evidence( oa1,oa2 ); - enum1 = ev3a->GetHostEnumerator(); - IEnumerator^ enum2 = ev3a->GetAssemblyEnumerator(); - enum2->MoveNext(); - Object^ obj1 = enum2->Current; - enum2->MoveNext(); - Console::WriteLine( "URL = {0} Site = {1}", obj1, enum2->Current ); - - // - // Constructor used to create null host and null assembly evidence. - Evidence^ ev3b = gcnew Evidence( (array^)nullptr, (array^)nullptr ); - Console::WriteLine( "Create new evidence with null host and assembly evidence" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Fatal error: {0}", e ); - return false; - } - - return retVal; - } - - Evidence^ DemonstrateEvidenceMembers() - { - Evidence^ myEvidence = gcnew Evidence; - String^ sPubKeyBlob = "00240000048000009400000006020000" - "00240000525341310004000001000100" - "19390E945A40FB5730204A25FA5DC4DA" - "B18688B412CB0EDB87A6EFC50E2796C9" - "B41AD3040A7E46E4A02516C598678636" - "44A0F74C39B7AB9C38C01F10AF4A5752" - "BFBCDF7E6DD826676AD031E7BCE63393" - "495BAD2CA4BE03B529A73C95E5B06BE7" - "35CA0F622C63E8F54171BD73E4C8F193" - "CB2664163719CA41F8159B8AC88F8CD3"; - array^pubkey = HexsToArray( sPubKeyBlob ); - - // Create a strong name. - StrongName^ mSN = gcnew StrongName( gcnew StrongNamePublicKeyBlob( pubkey ),"SN01",gcnew Version( "0.0.0.0" ) ); - - // Create assembly and host evidence. - // - Console::WriteLine( "Adding assembly evidence." ); - myEvidence->AddAssembly( "SN01" ); - myEvidence->AddAssembly( gcnew Version( "0.0.0.0" ) ); - myEvidence->AddAssembly( mSN ); - Console::WriteLine( "Count of evidence items = {0}", myEvidence->Count ); - // - - // - Url^ url = gcnew Url( "http://www.treyresearch.com" ); - Console::WriteLine( "Adding host evidence {0}", url ); - myEvidence->AddHost( url ); - PrintEvidence( myEvidence ).ToString(); - Console::WriteLine( "Count of evidence items = {0}", myEvidence->Count ); - // - - // - Console::WriteLine( "\nCopy the evidence to an array using CopyTo, then display the array." ); - array^evidenceArray = gcnew array(myEvidence->Count); - myEvidence->CopyTo( evidenceArray, 0 ); - for each (Object^ obj in evidenceArray) - { - Console::WriteLine(obj->ToString()); - } - // - - Console::WriteLine( "\nDisplay the contents of the properties." ); - Console::WriteLine( "Locked is the only property normally used by code." ); - Console::WriteLine( "IsReadOnly, IsSynchronized, and SyncRoot properties are not normally used." ); - - // - Console::WriteLine( "\nThe default value for the Locked property = {0}", myEvidence->Locked ); - // - - // - Console::WriteLine( "\nGet the hashcode for the evidence." ); - Console::WriteLine( "HashCode = {0}", myEvidence->GetHashCode() ); - // - - // - Console::WriteLine( "\nGet the type for the evidence." ); - Console::WriteLine( "Type = {0}", myEvidence->GetType() ); - // - - // - Console::WriteLine( "\nMerge new evidence with the current evidence." ); - array^oa1 = {}; - Site^ site = gcnew Site( "www.wideworldimporters.com" ); - array^oa2 = {url,site}; - Evidence^ newEvidence = gcnew Evidence( oa1,oa2 ); - myEvidence->Merge( newEvidence ); - Console::WriteLine( "Evidence count = {0}", PrintEvidence( myEvidence ) ); - // - - // - Console::WriteLine( "\nRemove URL evidence." ); - myEvidence->RemoveType( url->GetType() ); - Console::WriteLine( "Evidence count is now: {0}", myEvidence->Count ); - // - - // - Console::WriteLine( "\nMake a copy of the current evidence." ); - Evidence^ evidenceCopy = gcnew Evidence( myEvidence ); - Console::WriteLine( "Count of new evidence items = {0}", evidenceCopy->Count ); - Console::WriteLine( "Does the copy equal the current evidence? {0}", myEvidence->Equals( evidenceCopy ) ); - // - - // - Console::WriteLine( "\nClear the current evidence." ); - myEvidence->Clear(); - Console::WriteLine( "Count is now {0}", myEvidence->Count ); - // - - return myEvidence; - } - - static int PrintEvidence( Evidence^ myEvidence ) - { - // - int p = 0; - Console::WriteLine( "\nCurrent evidence = " ); - if ( nullptr == myEvidence ) - return 0; - - IEnumerator^ list = myEvidence->GetEnumerator(); - IEnumerator^ myEnum1 = list; - while ( myEnum1->MoveNext() ) - { - Object^ obj = safe_cast(myEnum1->Current); - Console::WriteLine( obj ); - p++; - } - // - - Console::WriteLine( "\n" ); - return p; - } - - // Convert a hexadecimal string to an array. - static array^ HexsToArray( String^ sHexString ) - { - array^arr = gcnew array(sHexString->Length / 2); - for ( int i = 0; i < sHexString->Length; i += 2 ) - { - arr[ i / 2 ] = Byte::Parse( sHexString->Substring( i, 2 ), NumberStyles::HexNumber ); - - } - return arr; - } -}; - - -// Main method. -int main() -{ - try - { - Evidence_Example^ EvidenceTest = gcnew Evidence_Example; - bool ret = EvidenceTest->CreateEvidence(); - if ( ret ) - { - Console::WriteLine( "Evidence successfully created." ); - } - else - { - Console::WriteLine( "Evidence creation failed." ); - } - EvidenceTest->DemonstrateEvidenceMembers(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - Environment::ExitCode = 101; - } -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp deleted file mode 100644 index 6c337fe9923..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp +++ /dev/null @@ -1,314 +0,0 @@ -// This sample demonstrates how to use each member of the FileCodeGroup class. -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; -using namespace System::Reflection; - -ref class Members -{ -public: - [STAThread] - static void Main() - { - FileCodeGroup^ fileCodeGroup = constructDefaultGroup(); - - // Create a deep copy of the FileCodeGroup. - // - FileCodeGroup^ copyCodeGroup = - dynamic_cast(fileCodeGroup->Copy()); - // - - CompareTwoCodeGroups( fileCodeGroup, copyCodeGroup ); - addPolicy( &fileCodeGroup ); - addXmlMember( &fileCodeGroup ); - updateMembershipCondition( &fileCodeGroup ); - addChildCodeGroup( &fileCodeGroup ); - Console::Write( L"Comparing the resolved code group " ); - Console::WriteLine( L"with the initial code group." ); - FileCodeGroup^ resolvedCodeGroup = - ResolveGroupToEvidence( fileCodeGroup ); - if ( CompareTwoCodeGroups( fileCodeGroup, resolvedCodeGroup ) ) - { - PrintCodeGroup( resolvedCodeGroup ); - } - else - { - PrintCodeGroup( fileCodeGroup ); - } - - Console::WriteLine( L"This sample completed successfully; press Enter to exit." ); - Console::ReadLine(); - } - -private: - // Construct a new FileCodeGroup with Read, Write, Append - // and PathDiscovery access. - static FileCodeGroup^ constructDefaultGroup() - { - // Construct a new file code group that has complete access to - // files in the specified path. - // - FileCodeGroup^ fileCodeGroup = gcnew FileCodeGroup( - gcnew AllMembershipCondition,FileIOPermissionAccess::AllAccess ); - // - - // Set the name of the file code group. - // - fileCodeGroup->Name = L"TempCodeGroup"; - // - - // Set the description of the file code group. - // - fileCodeGroup->Description = L"Temp folder permissions group"; - // - - // Retrieve the string representation of the fileCodeGroup’s - // attributes. FileCodeGroup does not use AttributeString, so the - // value should be null. - // - if ( fileCodeGroup->AttributeString != nullptr ) - { - throw gcnew NullReferenceException( - L"The AttributeString property should be null." ); - } - // - - return fileCodeGroup; - } - - // Add file permission to restrict write access to all files on the - // local machine. - static void addPolicy( interior_ptr fileCodeGroup ) - { - // Set the PolicyStatement property to a policy with read access to - // the root directory of drive C. - // - FileIOPermission^ rootFilePermissions = - gcnew FileIOPermission( PermissionState::None ); - rootFilePermissions->AllLocalFiles = - FileIOPermissionAccess::Read; - rootFilePermissions->SetPathList( - FileIOPermissionAccess::Read, L"C:\\" ); - NamedPermissionSet^ namedPermissions = - gcnew NamedPermissionSet( L"RootPermissions" ); - namedPermissions->AddPermission( rootFilePermissions ); - ( *fileCodeGroup )->PolicyStatement = - gcnew PolicyStatement( namedPermissions ); - // - } - - // Set the membership condition of the specified FileCodeGroup - // to the Intranet zone. - static void updateMembershipCondition( interior_ptr fileCodeGroup ) - { - // - ZoneMembershipCondition^ zoneCondition = - gcnew ZoneMembershipCondition( SecurityZone::Intranet ); - ( *fileCodeGroup )->MembershipCondition = zoneCondition; - // - } - - // Add a child group with read-access file permission to the specified - // code group. - static void addChildCodeGroup( interior_ptr fileCodeGroup ) - { - // Create a file code group with read-access permission. - // - FileCodeGroup^ tempFolderCodeGroup = gcnew FileCodeGroup( - gcnew AllMembershipCondition,FileIOPermissionAccess::Read ); - - // Set the name of the child code group and add it to - // the specified code group. - tempFolderCodeGroup->Name = L"Read-only group"; - ( *fileCodeGroup )->AddChild( tempFolderCodeGroup ); - // - } - - // Compare the two specified file code groups for equality. - static bool CompareTwoCodeGroups( FileCodeGroup^ firstCodeGroup, - FileCodeGroup^ secondCodeGroup ) - { - // - if ( firstCodeGroup->Equals( secondCodeGroup ) ) - // - { - Console::WriteLine( L"The two code groups are equal." ); - return true; - } - else - { - Console::WriteLine( L"The two code groups are not equal." ); - return false; - } - } - - // Retrieve the resolved policy based on Evidence from the executing - // assembly found in the specified code group. - static String^ ResolveEvidence( CodeGroup^ fileCodeGroup ) - { - String^ policyString = L""; - - // Resolve the policy based on evidence in the executing assembly. - // - Assembly^ assembly = Members::typeid->Assembly; - Evidence^ executingEvidence = assembly->Evidence; - PolicyStatement^ policy = fileCodeGroup->Resolve( executingEvidence ); - // - - if ( policy != nullptr ) - { - policyString = policy->ToString(); - } - - return policyString; - } - - // Retrieve the resolved code group based on the Evidence from - // the executing assembly found in the specified code group. - static FileCodeGroup^ ResolveGroupToEvidence( FileCodeGroup^ fileCodeGroup ) - { - // Resolve matching code groups to the executing assembly. - // - Assembly^ assembly = Members::typeid->Assembly; - Evidence^ evidence = assembly->Evidence; - CodeGroup^ codeGroup = fileCodeGroup->ResolveMatchingCodeGroups( evidence ); - // - - return dynamic_cast(codeGroup); - } - - // If a domain attribute is not found in the specified FileCodeGroup, - // add a child XML element identifying a custom membership condition. - static void addXmlMember( interior_ptr fileCodeGroup ) - { - // - SecurityElement^ xmlElement = ( *fileCodeGroup )->ToXml(); - // - - SecurityElement^ rootElement = gcnew SecurityElement( L"CodeGroup" ); - if ( xmlElement->Attribute(L"domain") == nullptr ) - { - // - SecurityElement^ newElement = gcnew SecurityElement( - L"CustomMembershipCondition" ); - newElement->AddAttribute( L"class", L"CustomMembershipCondition" ); - newElement->AddAttribute( L"version", L"1" ); - newElement->AddAttribute( L"domain", L"contoso.com" ); - rootElement->AddChild( newElement ); - ( *fileCodeGroup )->FromXml( rootElement ); - // - } - - Console::WriteLine( L"Added a custom membership condition:" ); - Console::WriteLine( rootElement ); - } - - // Print the properties of the specified code group to the console. - static void PrintCodeGroup( CodeGroup^ codeGroup ) - { - // Compare the type of the specified object with the FileCodeGroup - // type. - // - if ( !codeGroup->GetType()->Equals( FileCodeGroup::typeid ) ) - // - { - throw gcnew ArgumentException( L"Expected the FileCodeGroup type." ); - } - - String^ codeGroupName = codeGroup->Name; - String^ membershipCondition = codeGroup->MembershipCondition->ToString(); - - // - String^ permissionSetName = codeGroup->PermissionSetName; - // - - // - int hashCode = codeGroup->GetHashCode(); - // - - String^ mergeLogic = L""; - - // - if ( codeGroup->MergeLogic->Equals( L"Union" ) ) - { - mergeLogic = L" with Union merge logic"; - } - // - - // Retrieve the class path for FileCodeGroup. - // - String^ fileGroupClass = codeGroup->ToString(); - - // - // Write summary to the console window. - Console::WriteLine( L"\n*** {0} summary ***", fileGroupClass ); - Console::Write( L"A FileCodeGroup named " ); - Console::Write( L"{0}{1}", codeGroupName, mergeLogic ); - Console::Write( L" has been created with hash code{0}.", hashCode ); - Console::Write( L"This code group contains a {0}", membershipCondition ); - Console::Write( L" membership condition with the " ); - Console::Write( L"{0} permission set. ", permissionSetName ); - Console::Write( L"The code group has the following security policy: " ); - Console::WriteLine( ResolveEvidence( codeGroup ) ); - int childCount = codeGroup->Children->Count; - if ( childCount > 0 ) - { - Console::Write( L"There are {0}", childCount ); - Console::WriteLine( L" child code groups in this code group." ); - - // Iterate through the child code groups to display their names - // and remove them from the specified code group. - for ( int i = 0; i < childCount; i++ ) - { - // Get child code group as type FileCodeGroup. - // - FileCodeGroup^ childCodeGroup = - dynamic_cast(codeGroup->Children->default[ i ]); - - // - Console::Write( L"Removing the {0}.", childCodeGroup->Name ); - // Remove child code group. - - // - codeGroup->RemoveChild( childCodeGroup ); - // - } - Console::WriteLine(); - } - else - { - Console::Write( L"There are no child code groups" ); - Console::WriteLine( L" in this code group." ); - } - } -}; - -int main() -{ - Members::Main(); -} - -// -// This sample produces the following output: -// -// The two code groups are equal. -// Added a custom membership condition: -// -// -// -// Comparing the resolved code group with the initial code group. -// The two code groups are not equal. -// -// *** System.Security.Policy.FileCodeGroup summary *** -// A FileCodeGroup named with Union merge logic has been created with hash -// code 113151473. This code group contains a Zone - Intranet membership -// condition with the Same directory FileIO - NoAccess permission set. The -// code group has the following security policy: -// There are 1 child code groups in this code group. -// Removing the Read-only group. -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp deleted file mode 100644 index e8c9be6b48e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp +++ /dev/null @@ -1,359 +0,0 @@ -// This sample demonstrates how to use each member of the FirstMatchCodeGroup -// class. -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; -using namespace System::Reflection; - -ref class Members -{ -public: - [STAThread] - static void Main() - { - // Create a new FirstMatchCodeGroup. - FirstMatchCodeGroup^ codeGroup = constructDefaultGroup(); - - // Create a deep copy of the FirstMatchCodeGroup. - // - FirstMatchCodeGroup^ copyCodeGroup = - dynamic_cast(codeGroup->Copy()); - // - - // Compare the original code group with the copy. - CompareTwoCodeGroups( codeGroup, copyCodeGroup ); - - addPolicy( &codeGroup ); - addXmlMember( &codeGroup ); - updateMembershipCondition( &codeGroup ); - addChildCodeGroup( &codeGroup ); - - Console::Write( L"Comparing the resolved code group " ); - Console::WriteLine( L"with the initial code group." ); - FirstMatchCodeGroup^ resolvedCodeGroup = - ResolveGroupToEvidence( codeGroup ); - if ( CompareTwoCodeGroups( codeGroup, resolvedCodeGroup ) ) - { - PrintCodeGroup( resolvedCodeGroup ); - } - else - { - PrintCodeGroup( codeGroup ); - } - - Console::WriteLine( L"This sample completed successfully; " - L"press Enter to exit." ); - Console::ReadLine(); - } - -private: - // Create a FirstMatchCodeGroup with an exclusive policy and membership - // condition. - static FirstMatchCodeGroup^ constructDefaultGroup() - { - // Construct a new FirstMatchCodeGroup with Read, Write, Append - // and PathDiscovery access. - // Create read access permission to the root directory on drive C. - // - FileIOPermission^ rootFilePermissions = - gcnew FileIOPermission( PermissionState::None ); - rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read; - rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" ); - - // Add a permission to a named permission set. - NamedPermissionSet^ namedPermissions = - gcnew NamedPermissionSet( L"RootPermissions" ); - namedPermissions->AddPermission( rootFilePermissions ); - - // Create a PolicyStatement with exclusive rights to the policy. - PolicyStatement^ policy = gcnew PolicyStatement( - namedPermissions,PolicyStatementAttribute::Exclusive ); - - // Create a FirstMatchCodeGroup with a membership condition that - // matches all code, and an exclusive policy. - FirstMatchCodeGroup^ codeGroup = gcnew FirstMatchCodeGroup( - gcnew AllMembershipCondition,policy ); - // - - // Set the name of the first match code group. - // - codeGroup->Name = L"TempCodeGroup"; - // - - // Set the description of the first match code group. - // - codeGroup->Description = L"Temp folder permissions group"; - // - return codeGroup; - } - - // Add file permission to restrict write access to all files - // on the local machine. - static void addPolicy( interior_ptr codeGroup ) - { - // Set the PolicyStatement property to a policy with read access to - // the root directory on drive C. - // - FileIOPermission^ rootFilePermissions = - gcnew FileIOPermission( PermissionState::None ); - rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read; - rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" ); - - NamedPermissionSet^ namedPermissions = - gcnew NamedPermissionSet( L"RootPermissions" ); - namedPermissions->AddPermission( rootFilePermissions ); - - // Create a PolicyStatement with exclusive rights to the policy. - PolicyStatement^ policy = gcnew PolicyStatement( - namedPermissions,PolicyStatementAttribute::Exclusive ); - ( *codeGroup )->PolicyStatement = policy; - // - } - - // Set the membership condition of the code group. - static void updateMembershipCondition( - interior_ptr codeGroup ) - { - // Set the membership condition of the specified FirstMatchCodeGroup - // to the Intranet zone. - // - ZoneMembershipCondition^ zoneCondition = - gcnew ZoneMembershipCondition( SecurityZone::Intranet ); - ( *codeGroup )->MembershipCondition = zoneCondition; - // - } - - // Create a child code group with read-access file permissions and add it - // to the specified code group. - static void addChildCodeGroup( interior_ptr codeGroup ) - { - // Create a first match code group with read access. - // - FileIOPermission^ rootFilePermissions = gcnew FileIOPermission( - PermissionState::None ); - rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read; - rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" ); - - PermissionSet^ permissions = gcnew PermissionSet( - PermissionState::Unrestricted ); - permissions->AddPermission( rootFilePermissions ); - - FirstMatchCodeGroup^ tempFolderCodeGroup = - gcnew FirstMatchCodeGroup( gcnew AllMembershipCondition, - gcnew PolicyStatement( permissions ) ); - - // Set the name of the child code group and add it to - // the specified code group. - tempFolderCodeGroup->Name = L"Read-only code group"; - ( *codeGroup )->AddChild( tempFolderCodeGroup ); - // - } - - // Compare the two FirstMatchCodeGroups. - static bool CompareTwoCodeGroups( FirstMatchCodeGroup^ firstCodeGroup, - FirstMatchCodeGroup^ secondCodeGroup ) - { - // Compare the two specified FirstMatchCodeGroups for equality. - // - if ( firstCodeGroup->Equals( secondCodeGroup ) ) - // - { - Console::WriteLine( L"The two code groups are equal." ); - return true; - } - else - { - Console::WriteLine( L"The two code groups are not equal." ); - return false; - } - } - - // Retrieve the resolved policy based on executing evidence found - // in the specified code group. - static String^ ResolveEvidence( CodeGroup^ codeGroup ) - { - String^ policyString = L"None"; - - // Resolve the policy based on the executing assembly's evidence. - // - Assembly^ assembly = Members::typeid->Assembly; - Evidence^ executingEvidence = assembly->Evidence; - - PolicyStatement^ policy = codeGroup->Resolve( executingEvidence ); - // - - if ( policy != nullptr ) - { - policyString = policy->ToString(); - } - - return policyString; - } - - // Retrieve the resolved code group based on the evidence from the - // specified code group. - static FirstMatchCodeGroup^ ResolveGroupToEvidence( - FirstMatchCodeGroup^ codeGroup ) - { - // Resolve matching code groups to the executing assembly. - // - Assembly^ assembly = Members::typeid->Assembly; - Evidence^ evidence = assembly->Evidence; - CodeGroup^ resolvedCodeGroup = - codeGroup->ResolveMatchingCodeGroups( evidence ); - // - - return dynamic_cast(resolvedCodeGroup); - } - - // If a domain attribute is not found in the specified - // FirstMatchCodeGroup, add a child XML element identifying a custom - // membership condition. - static void addXmlMember( interior_ptr codeGroup ) - { - // - SecurityElement^ xmlElement = ( *codeGroup )->ToXml(); - // - - SecurityElement^ rootElement = gcnew SecurityElement( L"CodeGroup" ); - - if ( xmlElement->Attribute(L"domain") == nullptr ) - { - // - SecurityElement^ newElement = gcnew SecurityElement( - L"CustomMembershipCondition" ); - newElement->AddAttribute( L"class", L"CustomMembershipCondition" ); - newElement->AddAttribute( L"version", L"1" ); - newElement->AddAttribute( L"domain", L"contoso.com" ); - rootElement->AddChild( newElement ); - ( *codeGroup )->FromXml( rootElement ); - // - } - - Console::WriteLine( L"Added a custom membership condition:" ); - Console::WriteLine( rootElement ); - } - - // Print the properties of the specified code group to the console. - static void PrintCodeGroup( CodeGroup^ codeGroup ) - { - // Compare the type of the specified object with the - // FirstMatchCodeGroup type. - // - if ( !codeGroup->GetType()->Equals( FirstMatchCodeGroup::typeid ) ) - // - { - throw gcnew ArgumentException( L"Expected the FirstMatchCodeGroup type." ); - } - - String^ codeGroupName = codeGroup->Name; - String^ membershipCondition = codeGroup->MembershipCondition->ToString(); - - // - String^ permissionSetName = codeGroup->PermissionSetName; - // - - // - int hashCode = codeGroup->GetHashCode(); - // - - String^ mergeLogic = L""; - // - if ( codeGroup->MergeLogic->Equals( L"First Match" ) ) - // - { - mergeLogic = L"with first-match merge logic"; - } - - // Retrieve the class path for the FirstMatchCodeGroup. - // - String^ firstMatchGroupClass = codeGroup->ToString(); - // - - String^ attributeString = L""; - // Retrieve the string representation of the FirstMatchCodeGroup's - // attributes. - // - if ( codeGroup->AttributeString != nullptr ) - { - attributeString = codeGroup->AttributeString; - } - // - - // Write a summary to the console window. - Console::WriteLine( L"\n*** {0} summary ***", firstMatchGroupClass ); - Console::Write( L"A FirstMatchCodeGroup named " ); - Console::Write( L"{0}{1}", codeGroupName, mergeLogic ); - Console::Write( L" has been created with hash code({0}).", hashCode ); - Console::Write( L"\nThis code group contains a {0}", membershipCondition ); - Console::Write( L" membership condition with the " ); - Console::WriteLine( L"{0} permission set.", permissionSetName ); - - Console::Write( L"The code group contains the following policy: " ); - Console::Write( ResolveEvidence( codeGroup ) ); - Console::Write( L"\nIt also contains the following attributes: " ); - Console::WriteLine( attributeString ); - - int childCount = codeGroup->Children->Count; - if ( childCount > 0 ) - { - Console::Write( L"There are {0}", childCount ); - Console::WriteLine( L" child elements in the code group." ); - - // Iterate through the child code groups to display their names - // and then remove them from the specified code group. - for ( int i = 0; i < childCount; i++ ) - { - // Retrieve a child code group, which has been cast as a - // FirstMatchCodeGroup type. - // - FirstMatchCodeGroup^ childCodeGroup = - dynamic_cast(codeGroup->Children->default[ i ]); - // - - Console::Write( L"Removing the {0}.", childCodeGroup->Name ); - // Remove the child code group. - // - codeGroup->RemoveChild( childCodeGroup ); - // - } - Console::WriteLine(); - } - else - { - Console::WriteLine( L" No child code groups were found in this" - L" code group." ); - } - } -}; - -int main() -{ - Members::Main(); -} -// -// This sample produces the following output: -// -// The two code groups are equal. -// Added a custom membership condition: -// -// -// -// -// Comparing the resolved code group with the initial code group. -// The two code groups are not equal. -// -// *** System.Security.Policy.FirstMatchCodeGroup summary *** -// A FirstMatchCodeGroup named with first-match merge logic has been created -// with hash code(113151525). -// This code group contains a Zone - Intranet membership condition with the -// permission set. The code group contains the following policy: -// It also contains the following attributes: -// There are 1 child elements in the code group. -// Removing the Read-only code group. -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp deleted file mode 100644 index 0e0dece2b02..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Policy; -using namespace System::Security; -using namespace System::Security::Permissions; - -[STAThread] -int main() -{ - - // - GacInstalled ^ myGacInstalled = gcnew GacInstalled; - // - - // - array^hostEvidence = {myGacInstalled}; - array^assemblyEvidence = {}; - Evidence^ myEvidence = gcnew Evidence( hostEvidence,assemblyEvidence ); - GacIdentityPermission ^ myPerm = dynamic_cast - (myGacInstalled->CreateIdentityPermission( myEvidence )); - Console::WriteLine( myPerm->ToXml() ); - // - - // - GacInstalled ^ myGacInstalledCopy = - dynamic_cast(myGacInstalled->Copy()); - bool result = myGacInstalled->Equals( myGacInstalledCopy ); - // - - // - Console::WriteLine( "Hashcode = {0}", myGacInstalled->GetHashCode() ); - // - - // - Console::WriteLine( myGacInstalled->ToString() ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp deleted file mode 100644 index e3e119284e8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp +++ /dev/null @@ -1,227 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Collections; -public ref class GacMembershipConditionDemo -{ -private: - - // Demonstrate the Copy method, which creates an identical - // copy of the current permission. - bool CopyDemo() - { - Console::WriteLine( - "************************************************************"); - // - GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; - Console::WriteLine("Original membership condition = "); - Console::WriteLine(Gac1->ToXml()); - try - { - IMembershipCondition^ membershipCondition = Gac1->Copy(); - Console::WriteLine("Result of Copy = "); - Console::WriteLine( - (dynamic_cast(membershipCondition)) - ->ToXml()); - } - catch (Exception^ e) - { - Console::WriteLine("Copy failed : {0}{1}", Gac1, e); - return false; - } - // - - return true; - } - - // Demonstrate the Check method, which determines whether the specified - // evidence satisfies the membership condition. - bool CheckDemo() - { - Console::WriteLine( - "************************************************************"); - // - GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; - GacInstalled ^ myGac = gcnew GacInstalled; - try - { - array^hostEvidence = {myGac}; - array^assemblyEvidence = {}; - Evidence^ myEvidence = - gcnew Evidence(hostEvidence,assemblyEvidence); - bool retCode = Gac1->Check(myEvidence); - Console::WriteLine("Result of Check = {0}\n", retCode); - } - catch (Exception^ e) - { - Console::WriteLine("Check failed : {0}{1}", Gac1, e); - return false; - } - // - - return true; - } - - // Demonstrate the GetHashCode method, which returns a hash code - // for the specified membership condition. - bool GetHashCodeDemo() - { - Console::WriteLine( - "************************************************************"); - // - GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; - try - { - Console::WriteLine( - "Result of GetHashCode for a GacMembershipCondition = {0}\n", - Gac1->GetHashCode()); - } - catch (Exception^ e) - { - Console::WriteLine("GetHashCode failed : {0}{1}", Gac1, e); - return false; - } - // - - return true; - } - - // Demonstrate the ToXml and FromXml methods, including the overloads. - // ToXml creates an XML encoding of the membership condition and its - // current state; FromXml reconstructs a membership condition with the - // specified state from the XML encoding. - bool ToFromXmlDemo() - { - Console::WriteLine( - "************************************************************"); - try - { - // - GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; - GacMembershipCondition ^ Gac2 = gcnew GacMembershipCondition; - - // Roundtrip a GacMembershipCondition to and from an XML encoding. - Gac2->FromXml(Gac1->ToXml()); - bool result = Gac2->Equals(Gac1); - if (result) - { - Console::WriteLine("Result of ToXml() = {0}", Gac2->ToXml()); - Console::WriteLine( - "Result of ToFromXml roundtrip = {0}", Gac2); - } - else - { - Console::WriteLine(Gac2->ToString()); - Console::WriteLine(Gac1->ToString()); - return false; - } - // - - // - GacMembershipCondition ^ Gac3 = gcnew GacMembershipCondition; - GacMembershipCondition ^ Gac4 = gcnew GacMembershipCondition; - IEnumerator^ policyEnumerator = SecurityManager::PolicyHierarchy(); - while (policyEnumerator->MoveNext()) - { - PolicyLevel^ currentLevel = - dynamic_cast(policyEnumerator->Current); - if (currentLevel->Label->Equals("Machine")) - { - Console::WriteLine("Result of ToXml(level) = {0}", - Gac3->ToXml(currentLevel)); - Gac4->FromXml(Gac3->ToXml(), currentLevel); - Console::WriteLine( - "Result of FromXml(element, level) = {0}", Gac4); - } - } - // - } - catch (Exception^ e) - { - Console::WriteLine("ToFromXml failed. {0}", e); - return false; - } - - return true; - } - -public: - - // Invoke all demos. - bool RunDemo() - { - bool returnCode = true; - bool tempReturnCode; - - // Call the Copy demo. - if (tempReturnCode = CopyDemo()) - Console::WriteLine("Copy demo completed successfully."); - else - Console::WriteLine("Copy demo failed."); - - returnCode = tempReturnCode && returnCode; - - // Call the Check demo. - if (tempReturnCode = CheckDemo()) - Console::WriteLine("Check demo completed successfully."); - else - Console::WriteLine("Check demo failed."); - - returnCode = tempReturnCode && returnCode; - - // Call the GetHashCode demo. - if (tempReturnCode = GetHashCodeDemo()) - Console::WriteLine("GetHashCode demo completed successfully."); - else - Console::WriteLine("GetHashCode demo failed."); - - returnCode = tempReturnCode && returnCode; - - // Call the ToFromXml demo. - if (tempReturnCode = ToFromXmlDemo()) - Console::WriteLine("ToFromXml demo completed successfully."); - else - Console::WriteLine("ToFromXml demo failed."); - - returnCode = tempReturnCode && returnCode; - return (returnCode); - } -}; - -// Test harness. -int main() -{ - try - { - GacMembershipConditionDemo^ testcase = - gcnew GacMembershipConditionDemo; - bool returnCode = testcase->RunDemo(); - if (returnCode) - { - Console::WriteLine( - "The GacMembershipCondition demo completed successfully."); - Console::WriteLine("Press the Enter key to exit."); - Console::ReadLine(); - System::Environment::ExitCode = 100; - } - else - { - Console::WriteLine("The GacMembershipCondition demo failed."); - Console::WriteLine("Press the ENTER key to exit."); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } - } - catch (Exception^ e) - { - Console::WriteLine("The GacIdentityPermission demo failed."); - Console::WriteLine(e); - Console::WriteLine("Press the Enter key to exit."); - Console::ReadLine(); - System::Environment::ExitCode = 101; - } -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp deleted file mode 100644 index c41e32df504..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp +++ /dev/null @@ -1,224 +0,0 @@ -// This sample demonstrates how to use each member of the PolicyStatement -// class. -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Principal; -using namespace System::Security::Permissions; - -ref class Members -{ -public: - [STAThread] - static void Main() - { - // Create two new policy statements. - PolicyStatement^ policyStatement = firstConstructorTest(); - PolicyStatement^ policyStatement2 = secondConstructorTest(); - - // Add attributes to the first policy statement. - // - policyStatement->Attributes = PolicyStatementAttribute::All; - // - - // Create a copy of the first policy statement. - PolicyStatement^ policyStatementCopy = createCopy( policyStatement ); - addXmlMember( &policyStatementCopy ); - - summarizePolicyStatment( policyStatement ); - Console::Write( L"This sample completed successfully; " ); - Console::WriteLine( L"press Enter to exit." ); - Console::ReadLine(); - } - -private: - // Construct a PolicyStatement with an Unrestricted permission set. - static PolicyStatement^ firstConstructorTest() - { - // Construct the permission set. - // - PermissionSet^ permissions = gcnew PermissionSet( - PermissionState::Unrestricted ); - permissions->AddPermission( gcnew SecurityPermission( - SecurityPermissionFlag::Execution ) ); - permissions->AddPermission( gcnew ZoneIdentityPermission( - SecurityZone::MyComputer ) ); - - // Create a policy statement based on the newly created permission - // set. - PolicyStatement^ policyStatement = gcnew PolicyStatement( - permissions ); - // - - return policyStatement; - } - - // Construct a PolicyStatement with an Unrestricted permission set and - // the LevelFinal attribute. - static PolicyStatement^ secondConstructorTest() - { - // Construct the permission set. - // - PermissionSet^ permissions = gcnew PermissionSet( - PermissionState::Unrestricted ); - permissions->AddPermission( gcnew SecurityPermission( - SecurityPermissionFlag::Execution ) ); - permissions->AddPermission( gcnew ZoneIdentityPermission( - SecurityZone::MyComputer ) ); - - PolicyStatementAttribute levelFinalAttribute = - PolicyStatementAttribute::LevelFinal; - - // Create a new policy statement with the specified permission set. - // The LevelFinal attribute is set to prevent the evaluation of lower - // policy levels in a resolve operation. - PolicyStatement^ policyStatement = gcnew PolicyStatement( - permissions,levelFinalAttribute ); - // - - return policyStatement; - } - - // Add a named permission set to the specified PolicyStatement. - static void AddPermissions( interior_ptrpolicyStatement ) - { - // Construct a NamedPermissionSet with basic permissions. - // - NamedPermissionSet^ allPerms = gcnew NamedPermissionSet( - L"allPerms" ); - allPerms->AddPermission( gcnew SecurityPermission( - SecurityPermissionFlag::Execution ) ); - allPerms->AddPermission( gcnew ZoneIdentityPermission( - SecurityZone::MyComputer ) ); - allPerms->AddPermission( gcnew SiteIdentityPermission( - L"www.contoso.com" ) ); - - ( *policyStatement)->PermissionSet = allPerms; - // - } - - // If a class attribute is not found in the specified PolicyStatement, - // add a child XML element with an added class attribute. - static void addXmlMember( interior_ptrpolicyStatement ) - { - // - SecurityElement^ xmlElement = ( *policyStatement)->ToXml(); - // - if ( xmlElement->Attribute(L"class") == nullptr ) - { - // - SecurityElement^ newElement = gcnew SecurityElement( - L"PolicyStatement" ); - newElement->AddAttribute( L"class", ( - *policyStatement)->ToString() ); - newElement->AddAttribute( L"version", L"1.1" ); - - newElement->AddChild( gcnew SecurityElement( L"PermissionSet" ) ); - - ( *policyStatement)->FromXml( newElement ); - // - - Console::Write( L"Added the class attribute and modified its " ); - Console::WriteLine( L"version number.\n{0}", newElement ); - } - } - - // Verify that the type of the specified object is a PolicyStatement type - // then create a copy of the object. - static PolicyStatement^ createCopy( Object^ sourceObject ) - { - PolicyStatement^ returnedStatement = gcnew PolicyStatement( nullptr ); - // Compare specified object type with the PolicyStatement type. - // - if ( sourceObject->GetType()->Equals( PolicyStatement::typeid ) ) - // - { - returnedStatement = getCopy( - static_cast(sourceObject) ); - } - else - { - throw gcnew ArgumentException( - L"Expected the PolicyStatement type." ); - } - - return returnedStatement; - } - - // Return a copy of the specified PolicyStatement if the result of the - // Copy command is an equivalent object. Otherwise, return the - // original PolicyStatement object. - static PolicyStatement^ getCopy( PolicyStatement^ policyStatement ) - { - // Create an equivalent copy of the policy statement. - // - PolicyStatement^ policyStatementCopy = policyStatement->Copy(); - // - - // Compare the specified objects for equality. - // - if ( !policyStatementCopy->Equals( policyStatement ) ) - // - { - return policyStatementCopy; - } - else - { - return policyStatement; - } - } - - // Summarize the attributes of the specified PolicyStatement on the - // console window. - static void summarizePolicyStatment( PolicyStatement^ policyStatement ) - { - // Retrieve the class path for policyStatement. - // - String^ policyStatementClass = policyStatement->ToString(); - // - - // - int hashCode = policyStatement->GetHashCode(); - // - - String^ attributeString = L""; - - // Retrieve the string representation of the PolicyStatement - // attributes. - // - if ( policyStatement->AttributeString != nullptr ) - { - attributeString = policyStatement->AttributeString; - } - // - - // Write a summary to the console window. - Console::WriteLine( L"\n*** {0} summary ***", policyStatementClass ); - Console::Write( L"This PolicyStatement has been created with hash " ); - Console::Write( L"code({0}) ", hashCode ); - - Console::Write( L"and contains the following attributes: " ); - Console::WriteLine( attributeString ); - } -}; - -int main() -{ - Members::Main(); -} - -// -// This sample produces the following output: -// -// Added the class attribute and modified the version number. -// -// -// -// -// *** System.Security.Policy.PolicyStatement summary *** -// PolicyStatement has been created with hash code(20) containing the -// following attributes: Exclusive LevelFinal -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp deleted file mode 100644 index 00423830711..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp +++ /dev/null @@ -1,81 +0,0 @@ - -// This sample demonstrates how to call each member of the GenericIdentity -// class. -// -using namespace System; -using namespace System::Security::Principal; -void ShowIdentityPreferences( GenericIdentity^ genericIdentity ); -GenericIdentity^ GetGenericIdentity(); - -[STAThread] -int main() -{ - // Create a GenericIdentity object with no authentication type - // specified. - // - GenericIdentity^ defaultIdentity = gcnew GenericIdentity( "DefaultUser" ); - // - - // Retrieve a GenericIdentity created from current WindowsIdentity - // values. - GenericIdentity^ currentIdentity = GetGenericIdentity(); - ShowIdentityPreferences( gcnew GenericIdentity( "" ) ); - ShowIdentityPreferences( defaultIdentity ); - ShowIdentityPreferences( currentIdentity ); - Console::WriteLine( "The sample completed successfully; " - "press Enter to continue." ); - Console::ReadLine(); -} - -// Print identity preferences to the console window. -void ShowIdentityPreferences( GenericIdentity^ genericIdentity ) -{ - // Retrieve the name of the generic identity object. - // - String^ identityName = genericIdentity->Name; - // - - // Retrieve the authentication type of the generic identity object. - // - String^ identityAuthenticationType = genericIdentity->AuthenticationType; - // - - Console::WriteLine( "Name: {0}", identityName ); - Console::WriteLine( "Type: {0}", identityAuthenticationType ); - - // Verify that the user's identity has been authenticated - // (was created with a valid name). - // - if ( genericIdentity->IsAuthenticated ) - // - { - Console::WriteLine( "The user's identity has been authenticated." ); - } - else - { - Console::WriteLine( "The user's identity has not been " - "authenticated." ); - } - - Console::WriteLine( "~~~~~~~~~~~~~~~~~~~~~~~~~" ); -} - - -// Create generic identity based on values from the current -// WindowsIdentity. -GenericIdentity^ GetGenericIdentity() -{ - // Get values from the current WindowsIdentity. - // - WindowsIdentity^ windowsIdentity = WindowsIdentity::GetCurrent(); - - // Construct a GenericIdentity object based on the current Windows - // identity name and authentication type. - String^ authenticationType = windowsIdentity->AuthenticationType; - String^ userName = windowsIdentity->Name; - GenericIdentity^ authenticatedGenericIdentity = gcnew GenericIdentity( userName,authenticationType ); - // - - return authenticatedGenericIdentity; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp deleted file mode 100644 index 9f65a364819..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// This sample demonstrates how to call each member of the GenericPrincipal -// class. -// -using namespace System; -using namespace System::Security::Principal; - -ref class GenericPrincipalMembers -{ -public: - [STAThread] - static void Main() - { - // Retrieve a GenericPrincipal that is based on the current user's - // WindowsIdentity. - GenericPrincipal^ genericPrincipal = GetGenericPrincipal(); - - // Retrieve the generic identity of the GenericPrincipal object. - // - GenericIdentity^ principalIdentity = - dynamic_cast(genericPrincipal->Identity); - // - - // Display the identity name and authentication type. - if ( principalIdentity->IsAuthenticated ) - { - Console::WriteLine( principalIdentity->Name ); - Console::WriteLine( L"Type:{0}", - principalIdentity->AuthenticationType ); - } - - // Verify that the generic principal has been assigned the - // NetworkUser role. - // - if ( genericPrincipal->IsInRole( L"NetworkUser" ) ) - { - Console::WriteLine( L"User belongs to the NetworkUser role." ); - } - // - Console::WriteLine( L"The sample completed successfully; " - L"press Enter to continue." ); - Console::ReadLine(); - } - -private: - // Create a generic principal based on values from the current - // WindowsIdentity. - static GenericPrincipal^ GetGenericPrincipal() - { - // Use values from the current WindowsIdentity to construct - // a set of GenericPrincipal roles. - // - WindowsIdentity^ windowsIdentity = WindowsIdentity::GetCurrent(); - array^roles = gcnew array(10); - if ( windowsIdentity->IsAuthenticated ) - { - - // Add custom NetworkUser role. - roles[ 0 ] = L"NetworkUser"; - } - - if ( windowsIdentity->IsGuest ) - { - - // Add custom GuestUser role. - roles[ 1 ] = L"GuestUser"; - } - - if ( windowsIdentity->IsSystem ) - { - - // Add custom SystemUser role. - roles[ 2 ] = L"SystemUser"; - } - - // Construct a GenericIdentity object based on the current Windows - // identity name and authentication type. - String^ authenticationType = windowsIdentity->AuthenticationType; - String^ userName = windowsIdentity->Name; - GenericIdentity^ genericIdentity = gcnew GenericIdentity( - userName,authenticationType ); - - // Construct a GenericPrincipal object based on the generic identity - // and custom roles for the user. - GenericPrincipal^ genericPrincipal = gcnew GenericPrincipal( - genericIdentity,roles ); - // - - return genericPrincipal; - } -}; - -int main() -{ - GenericPrincipalMembers::Main(); -} - - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp deleted file mode 100644 index 3ded7b386b6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -using namespace System; -using namespace System::Threading; -using namespace System::Security::Permissions; -using namespace System::Security::Principal; - -class SecurityPrincipalDemo -{ - // -public: - static void DemonstrateWindowsBuiltInRoleEnum() - { - AppDomain^ myDomain = Thread::GetDomain(); - - myDomain->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal ); - WindowsPrincipal^ myPrincipal = dynamic_cast(Thread::CurrentPrincipal); - - Console::WriteLine( "{0} belongs to: ", myPrincipal->Identity->Name ); - - Array^ wbirFields = Enum::GetValues( WindowsBuiltInRole::typeid ); - - for each ( Object^ roleName in wbirFields ) - { - try - { - Console::WriteLine( "{0}? {1}.", roleName, - myPrincipal->IsInRole( *dynamic_cast(roleName) ) ); - } - catch ( Exception^ ) - { - Console::WriteLine( "{0}: Could not obtain role for this RID.", - roleName ); - } - } - } - // -}; - -int main() -{ - SecurityPrincipalDemo::DemonstrateWindowsBuiltInRoleEnum(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp deleted file mode 100644 index 1379e071f99..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp +++ /dev/null @@ -1,220 +0,0 @@ - -// This sample demonstrates how to use each member of the WindowsIdentity -// class. -// -using namespace System; -using namespace System::Security::Principal; -void IntPtrConstructor( IntPtr logonToken ); -void IntPtrStringConstructor( IntPtr logonToken ); -void IntPrtStringTypeBoolConstructor( IntPtr logonToken ); -void IntPtrStringTypeConstructor( IntPtr logonToken ); -void UseProperties( IntPtr logonToken ); -IntPtr LogonUser(); -void GetAnonymousUser(); -void ImpersonateIdentity( IntPtr logonToken ); - -[STAThread] -int main() -{ - - // Retrieve the Windows account token for the current user. - IntPtr logonToken = LogonUser(); - - // Constructor implementations. - IntPtrConstructor( logonToken ); - IntPtrStringConstructor( logonToken ); - IntPtrStringTypeConstructor( logonToken ); - IntPrtStringTypeBoolConstructor( logonToken ); - - // Property implementations. - UseProperties( logonToken ); - - // Method implementations. - GetAnonymousUser(); - ImpersonateIdentity( logonToken ); - Console::WriteLine( "This sample completed successfully; " - "press Enter to exit." ); - Console::ReadLine(); -} - - -// Create a WindowsIdentity object for the user represented by the -// specified Windows account token. - // -void IntPtrConstructor( IntPtr logonToken ) -{ - - // Construct a WindowsIdentity object using the input account token. - WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken ); - - Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); -} - // - -// Create a WindowsIdentity object for the user represented by the -// specified account token and authentication type. - // -void IntPtrStringConstructor( IntPtr logonToken ) -{ - - // Construct a WindowsIdentity object using the input account token - // and the specified authentication type. - String^ authenticationType = "WindowsAuthentication"; - WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType ); - - Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); -} - - // - - -// Create a WindowsIdentity object for the user represented by the -// specified account token, authentication type and Windows account -// type. - // -void IntPtrStringTypeConstructor( IntPtr logonToken ) -{ - - // Construct a WindowsIdentity object using the input account token, - // and the specified authentication type and Windows account type. - String^ authenticationType = "WindowsAuthentication"; - WindowsAccountType guestAccount = WindowsAccountType::Guest; - WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType,guestAccount ); - - Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); -} - // - -// Create a WindowsIdentity object for the user represented by the -// specified account token, authentication type, Windows account type and -// Boolean authentication flag. - // -void IntPrtStringTypeBoolConstructor( IntPtr logonToken ) -{ - - // Construct a WindowsIdentity object using the input account token, - // and the specified authentication type, Windows account type, and - // authentication flag. - String^ authenticationType = "WindowsAuthentication"; - WindowsAccountType guestAccount = WindowsAccountType::Guest; - bool isAuthenticated = true; - WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType,guestAccount,isAuthenticated ); - - Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); -} - // - -// Access the properties of a WindowsIdentity object. -void UseProperties( IntPtr logonToken ) -{ - WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken ); - String^ propertyDescription = "The windows identity named "; - - // Retrieve the Windows logon name from the Windows identity object. - // - propertyDescription = String::Concat( propertyDescription, windowsIdentity->Name ); - - // - // Verify that the user account is not considered to be an Anonymous - // account by the system. - // - if ( !windowsIdentity->IsAnonymous ) - { - propertyDescription = String::Concat( propertyDescription, ", is not an Anonymous account" ); - } - // - - - // Verify that the user account has been authenticated by Windows. - // - if ( windowsIdentity->IsAuthenticated ) - { - propertyDescription = String::Concat( propertyDescription, ", is authenticated" ); - } - // - - // Verify that the user account is considered to be a System account - // by the system. - // - if ( windowsIdentity->IsSystem ) - { - propertyDescription = String::Concat( propertyDescription, ", is a System account" ); - } - // - - // Verify that the user account is considered to be a Guest account - // by the system. - // - if ( windowsIdentity->IsGuest ) - { - propertyDescription = String::Concat( propertyDescription, ", is a Guest account" ); - } - // - - // Retrieve the authentication type for the - // - String^ authenticationType = windowsIdentity->AuthenticationType; - - // Append the authenication type to the output message. - if ( authenticationType != nullptr ) - { - propertyDescription = String::Format( "{0} and uses {1} authentication type.", propertyDescription, authenticationType ); - } - // - - Console::WriteLine( propertyDescription ); -} - - -// Retrieve the account token from the current WindowsIdentity object -// instead of calling the unmanaged LogonUser method in the advapi32.dll. -IntPtr LogonUser() -{ - - // - // - IntPtr accountToken = WindowsIdentity::GetCurrent()->Token; - - // - // - return accountToken; -} - - -// Get the WindowsIdentity object for an Anonymous user. -void GetAnonymousUser() -{ - - // Retrieve a WindowsIdentity object that represents an anonymous - // Windows user. - // - WindowsIdentity^ windowsIdentity = WindowsIdentity::GetAnonymous(); - - // -} - - -// Impersonate a Windows identity. -// -void ImpersonateIdentity( IntPtr logonToken ) -{ - - // Retrieve the Windows identity using the specified token. - WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken ); - - // Create a WindowsImpersonationContext object by impersonating the - // Windows identity. - WindowsImpersonationContext^ impersonationContext = windowsIdentity->Impersonate(); - Console::WriteLine( "Name of the identity after impersonation: {0}.", WindowsIdentity::GetCurrent()->Name ); - - // Stop impersonating the user. - impersonationContext->Undo(); - - // Check the identity name. - Console::Write( "Name of the identity after performing an Undo on the" ); - Console::WriteLine( " impersonation: {0}", WindowsIdentity::GetCurrent()->Name ); -} - -// -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp deleted file mode 100644 index 6f27c73ab00..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -using namespace System; -using namespace System::Security; - -int main(array ^args) -{ - // Define the string value to assign to a new secure string. - Char chars[4] = { 't', 'e', 's', 't' }; - // Instantiate the secure string. - SecureString^ testString = gcnew SecureString(); - // Assign the character array to the secure string. - for each (Char ch in chars) - { - testString->AppendChar(ch); - } - // Display secure string length. - Console::WriteLine("The length of the string is {0} characters.", - testString->Length); - - delete testString; - return 0; -} -// The example displays the following output: -// The length of the string is 4 characters. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp deleted file mode 100644 index 103271ae878..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -using namespace System; -using namespace System::Security; - -int main(array ^args) -{ - // Define the string value to be assigned to the secure string. - String^ initString = "TestString"; - // Instantiate the secure string. - SecureString^ testString = gcnew SecureString(); - // Assign the character array to the secure string. - for each (Char ch in initString) - { - testString->AppendChar(ch); - } - // Display secure string length. - Console::WriteLine("The length of the string is {0} characters.", - testString->Length); - - delete testString; - return 0; -} -// The example displays the following output: -// The length of the string is 10 characters. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp deleted file mode 100644 index 41c475aa884..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp +++ /dev/null @@ -1,243 +0,0 @@ - -#using "System.Data.dll" - -// -using namespace System; -using namespace System::Data; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Policy; -using namespace System::Reflection; -using namespace System::Runtime::Serialization; - -namespace SecurityExceptionSample -{ - [assembly:KeyContainerPermissionAttribute( - SecurityAction::RequestRefuse, - Flags=KeyContainerPermissionFlags::Import)]; - ref class TestSecurityException - { - public: - void MakeTest() - { - try - { - // Deny a permission. - KeyContainerPermission^ keyContainerDecryptPermission = - gcnew KeyContainerPermission( - KeyContainerPermissionFlags::Decrypt); - keyContainerDecryptPermission->Deny(); - - // Demand the denied permission and display - // the exception properties. - Display("Demanding a denied permission. \n\n"); - DemandDeniedPermission(); - Display("*******************************************" - "**************\n"); - CodeAccessPermission::RevertDeny(); - - // Demand the permission refused - // in the assembly-level attribute. - Display("Demanding a refused permission. \n\n"); - DemandRefusedPermission(); - Display("*******************************************" - "**************\n"); - - // Demand the permission implicitly refused through a - // PermitOnly attribute. Permit only the permission that - // will cause the failure and the security permissions - // necessary to display the results of the failure. - PermissionSet^ permitOnlySet = gcnew PermissionSet( - PermissionState::None); - permitOnlySet->AddPermission(gcnew KeyContainerPermission( - KeyContainerPermissionFlags::Import)); - permitOnlySet->AddPermission(gcnew SecurityPermission( - SecurityPermissionFlag::ControlEvidence | - SecurityPermissionFlag::ControlPolicy | - SecurityPermissionFlag::SerializationFormatter)); - permitOnlySet->PermitOnly(); - Display("Demanding an implicitly refused permission. \n\n"); - DemandPermitOnly(); - } - catch (SecurityException^ exception) - { - Display("*******************************************" - "**************\n"); - - // - Display("Displaying an exception using the ToString " - "method: "); - Display(exception->ToString()); - // - } - - } - - private: - void DemandDeniedPermission() - { - try - { - KeyContainerPermission^ keyContainerDecryptPermission = - gcnew KeyContainerPermission( - KeyContainerPermissionFlags::Decrypt); - keyContainerDecryptPermission->Demand(); - } - catch (SecurityException^ exception) - { - // - Display("The denied permission is: {0}", - exception->DenySetInstance); - // - - // - Display("The demanded permission is: {0}", - exception->Demanded); - // - - // - Display("The security action is: {0}", - exception->Action); - // - - // - Display("The method is: {0}", exception->Method); - // - - // - Display("The permission state at the time " - "of the exception was: {0}", - exception->PermissionState); - // - - // - Display("The permission that failed was: {0}", - exception->FirstPermissionThatFailed); - // - - // - Display("The permission type is: {0}", - exception->PermissionType); - // - - // - Display("Demonstrating the use of the GetObjectData " - "method."); - SerializationInfo^ entryPointSerializatonInfo = - gcnew SerializationInfo(TestSecurityException::typeid, - gcnew FormatterConverter); - exception->GetObjectData(entryPointSerializatonInfo, - *gcnew StreamingContext(StreamingContextStates::All)); - Display("The FirstPermissionThatFailed from the call" - " to GetObjectData is: "); - Display(entryPointSerializatonInfo->GetString( - "FirstPermissionThatFailed")); - // - } - } - - void DemandRefusedPermission() - { - try - { - KeyContainerPermission^ keyContainerImportPermission = - gcnew KeyContainerPermission( - KeyContainerPermissionFlags::Import); - keyContainerImportPermission->Demand(); - } - catch (SecurityException^ exception) - { - // - Display("The refused permission set is: {0}", - exception->RefusedSet); - // - - // - Display("The exception message is: {0}", - exception->Message); - // - - // - Display("The failed assembly is: {0}", - exception->FailedAssemblyInfo->EscapedCodeBase); - // - - // - Display("The granted set is: \n{0}", - exception->GrantedSet); - // - - Display("The permission that failed is: {0}", - exception->FirstPermissionThatFailed); - Display("The permission type is: {0}", - exception->PermissionType); - - // - Display("The source is: {0}", exception->Source); - // - } - } - - void DemandPermitOnly() - { - try - { - KeyContainerPermission^ keyContainerDecryptPermission = - gcnew KeyContainerPermission( - KeyContainerPermissionFlags::Decrypt); - keyContainerDecryptPermission->Demand(); - } - catch (SecurityException^ exception) - { - // - Display("The permitted permission is: {0}", - exception->PermitOnlySetInstance); - // - Display("The demanded permission is: {0}", - exception->Demanded); - Display("The security action is: {0}", - exception->Action); - Display("The method is: {0}", exception->Method); - Display("The permission state at the time of the " - "exception was: {0}", exception->PermissionState); - Display("The permission that failed was: {0}", - exception->FirstPermissionThatFailed); - Display("The permission type is: {0}", - exception->PermissionType); - - // - // Demonstrate the SecurityException constructor - // by throwing the exception again. - Display("Rethrowing the exception thrown as a " - "result of a PermitOnly security action."); - throw gcnew SecurityException(exception->Message, - exception->DenySetInstance, - exception->PermitOnlySetInstance, - exception->Method, exception->Demanded, - exception->FirstPermissionThatFailed); - // - } - } - - void Display(String^ line) - { - Console::WriteLine(line); - } - - void Display(String^ format, Object^ arg) - { - Console::WriteLine(format, arg); - } - }; -} - -using namespace SecurityExceptionSample; - -int main() -{ - TestSecurityException^ test = gcnew TestSecurityException; - test->MakeTest(); - Console::WriteLine("Press the enter key to exit."); - Console::Read(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp deleted file mode 100644 index 93d345d1108..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp +++ /dev/null @@ -1,272 +0,0 @@ - -// -// This sample demonstrates how to set code access permissions programmatically. It creates a -// new parent and child code group pair, and allows the user to optionally delete the child group -// and/or the parent code group. It also shows the result of a ResolvePolicy call, and displays -// the permissions for the three security levels; Enterprise, Machine, and User. -using namespace System; -using namespace System::Collections; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Security::Permissions; -using namespace System::Reflection; -using namespace System::Globalization; - -array^ GetKey(); -void ListPermissionSets( PolicyLevel^ pLevel ); -bool ComparePolicyLevels( PolicyLevel^ pLevel1, PolicyLevel^ pLevel2 ); -void CreateAPolicyLevel(); -void CheckEvidence( PolicyLevel^ pLevel, Evidence^ evidence ); -void CheckEvidence( Evidence^ evidence ); -void ListMachinePermissionSets(); - -int main() -{ - Console::WriteLine( "*************************************************************************************" ); - Console::WriteLine( "Create an AppDomain policy level." ); - Console::WriteLine( "Use the AppDomain to demonstrate PolicyLevel methods and properties." ); - Console::WriteLine( "*************************************************************************************" ); - CreateAPolicyLevel(); - array^temp0 = {gcnew Zone( SecurityZone::Intranet )}; - Evidence^ intranetZoneEvidence = gcnew Evidence( temp0,nullptr ); - Console::WriteLine( "*************************************************************************************" ); - Console::WriteLine( "Show the result of ResolvePolicy on this computer for LocalIntranet zone evidence." ); - Console::WriteLine( "*************************************************************************************" ); - CheckEvidence( intranetZoneEvidence ); - Console::WriteLine( "*************************************************************************************" ); - Console::WriteLine( "Enumerate the permission sets for Machine policy level." ); - Console::WriteLine( "*************************************************************************************" ); - ListMachinePermissionSets(); - Console::Out->WriteLine( "Press the Enter key to exit." ); - Console::ReadLine(); -} - -void CreateAPolicyLevel() -{ - try - { - // - // Create an AppDomain policy level. - PolicyLevel^ pLevel = PolicyLevel::CreateAppDomainLevel(); - // - - // The root code group of the policy level combines all - // permissions of its children. - UnionCodeGroup^ rootCodeGroup; - PermissionSet^ ps = gcnew PermissionSet( PermissionState::None ); - ps->AddPermission( gcnew SecurityPermission( SecurityPermissionFlag::Execution ) ); - rootCodeGroup = gcnew UnionCodeGroup( gcnew AllMembershipCondition,gcnew PolicyStatement( ps,PolicyStatementAttribute::Nothing ) ); - - // This code group grants FullTrust to assemblies with the strong - // name key from this assembly. - UnionCodeGroup^ myCodeGroup = gcnew UnionCodeGroup( gcnew StrongNameMembershipCondition( gcnew StrongNamePublicKeyBlob( GetKey() ),nullptr,nullptr ),gcnew PolicyStatement( gcnew PermissionSet( PermissionState::Unrestricted ),PolicyStatementAttribute::Nothing ) ); - myCodeGroup->Name = "My CodeGroup"; - - - // - // Add the code groups to the policy level. - rootCodeGroup->AddChild( myCodeGroup ); - pLevel->RootCodeGroup = rootCodeGroup; - Console::WriteLine( "Permissions granted to all code running in this AppDomain level: " ); - Console::WriteLine( rootCodeGroup->ToXml() ); - Console::WriteLine( "Child code groups in RootCodeGroup:" ); - IList^ codeGroups = pLevel->RootCodeGroup->Children; - IEnumerator^ codeGroup = codeGroups->GetEnumerator(); - while ( codeGroup->MoveNext() ) - { - Console::WriteLine( "\t{0}", (dynamic_cast(codeGroup->Current))->Name ); - } - // - - // - Console::WriteLine( "Demonstrate adding and removing named permission sets." ); - Console::WriteLine( "Original named permission sets:" ); - ListPermissionSets( pLevel ); - NamedPermissionSet^ myInternet = pLevel->GetNamedPermissionSet( "Internet" ); - // - - myInternet->Name = "MyInternet"; - - // - pLevel->AddNamedPermissionSet( myInternet ); - // - - Console::WriteLine( "\nNew named permission sets:" ); - ListPermissionSets( pLevel ); - myInternet->RemovePermission( System::Security::Permissions::FileDialogPermission::typeid ); - - // - pLevel->ChangeNamedPermissionSet( "MyInternet", myInternet ); - // - - // - pLevel->RemoveNamedPermissionSet( "MyInternet" ); - // - - Console::WriteLine( "\nCurrent permission sets:" ); - ListPermissionSets( pLevel ); - pLevel->AddNamedPermissionSet( myInternet ); - Console::WriteLine( "\nUpdated named permission sets:" ); - ListPermissionSets( pLevel ); - - // - pLevel->Reset(); - // - - Console::WriteLine( "\nReset named permission sets:" ); - ListPermissionSets( pLevel ); - - // - Console::WriteLine( "\nType property = {0}", pLevel->Type ); - // - - // - Console::WriteLine( "The result of GetHashCode is {0}", pLevel->GetHashCode() ); - // - - Console::WriteLine( "StoreLocation property for the AppDomain level is empty, since AppDomain policy " - "cannot be saved to a file." ); - Console::WriteLine( "StoreLocation property = {0}", pLevel->StoreLocation ); - - // - PolicyLevel^ pLevelCopy = PolicyLevel::CreateAppDomainLevel(); - // - - // Create a copy of the PolicyLevel using ToXml/FromXml. - pLevelCopy->FromXml( pLevel->ToXml() ); - if ( ComparePolicyLevels( pLevel, pLevelCopy ) ) - { - Console::WriteLine( "The ToXml/FromXml roundtrip was successful." ); - } - else - { - Console::WriteLine( "ToXml/FromXml roundtrip failed." ); - } - Console::WriteLine( "Show the result of resolving policy for evidence unique to the AppDomain policy level." ); - array^temp1 = {myCodeGroup}; - Evidence^ myEvidence = gcnew Evidence( temp1,nullptr ); - CheckEvidence( pLevel, myEvidence ); - return; - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - return; - } -} - - -// Compare two PolicyLevels using ToXml and FromXml. -bool ComparePolicyLevels( PolicyLevel^ pLevel1, PolicyLevel^ pLevel2 ) -{ - bool retVal = false; - PolicyLevel^ firstCopy = PolicyLevel::CreateAppDomainLevel(); - PolicyLevel^ secondCopy = PolicyLevel::CreateAppDomainLevel(); - - // Create copies of the two PolicyLevels passed in. - // Convert the two PolicyLevels to their canonical form using ToXml and FromXml. - firstCopy->FromXml( pLevel1->ToXml() ); - secondCopy->FromXml( pLevel2->ToXml() ); - if ( firstCopy->ToXml()->ToString()->CompareTo( secondCopy->ToXml()->ToString() ) == 0 ) - retVal = true; - - return retVal; -} - - -// -// Demonstrate the use of ResolvePolicy for the supplied evidence and a specified policy level. -void CheckEvidence( PolicyLevel^ pLevel, Evidence^ evidence ) -{ - // Display the code groups to which the evidence belongs. - Console::WriteLine( "\tResolvePolicy for the given evidence: " ); - IEnumerator^ codeGroup = evidence->GetEnumerator(); - while ( codeGroup->MoveNext() ) - { - Console::WriteLine( "\t\t{0}", (dynamic_cast(codeGroup->Current))->Name ); - } - - Console::WriteLine( "The current evidence belongs to the following root CodeGroup:" ); - - // pLevel is the current PolicyLevel, evidence is the Evidence to be resolved. - CodeGroup^ cg1 = pLevel->ResolveMatchingCodeGroups( evidence ); - Console::WriteLine( "{0} Level", pLevel->Label ); - Console::WriteLine( "\tRoot CodeGroup = {0}", cg1->Name ); - - // Show how Resolve is used to determine the set of permissions that - // the security system grants to code, based on the evidence. - // Show the granted permissions. - Console::WriteLine( "\nCurrent permissions granted:" ); - PolicyStatement^ pState = pLevel->Resolve( evidence ); - Console::WriteLine( pState->ToXml() ); - return; -} -// - -// -void ListPermissionSets( PolicyLevel^ pLevel ) -{ - IList^ namedPermissions = pLevel->NamedPermissionSets; - IEnumerator^ namedPermission = namedPermissions->GetEnumerator(); - while ( namedPermission->MoveNext() ) - { - Console::WriteLine( "\t{0}", (dynamic_cast(namedPermission->Current))->Name ); - } -} -// - -array^ GetKey() -{ - return Assembly::GetCallingAssembly()->GetName()->GetPublicKey(); -} - -// -// Demonstrate the use of ResolvePolicy for passed in evidence. -void CheckEvidence( Evidence^ evidence ) -{ - // Display the code groups to which the evidence belongs. - Console::WriteLine( "ResolvePolicy for the given evidence." ); - Console::WriteLine( "\tCurrent evidence belongs to the following code groups:" ); - IEnumerator^ policyEnumerator = SecurityManager::PolicyHierarchy(); - - // Resolve the evidence at all the policy levels. - while ( policyEnumerator->MoveNext() ) - { - PolicyLevel^ currentLevel = dynamic_cast(policyEnumerator->Current); - CodeGroup^ cg1 = currentLevel->ResolveMatchingCodeGroups( evidence ); - Console::WriteLine( "\n\t{0} Level", currentLevel->Label ); - Console::WriteLine( "\t\tCodeGroup = {0}", cg1->Name ); - IEnumerator^ cgE1 = cg1->Children->GetEnumerator(); - while ( cgE1->MoveNext() ) - { - Console::WriteLine( "\t\t\tGroup = {0}", (dynamic_cast(cgE1->Current))->Name ); - } - - Console::WriteLine( "\tStoreLocation = {0}", currentLevel->StoreLocation ); - } - - return; -} -// - -// -void ListMachinePermissionSets() -{ - Console::WriteLine( "\nPermission sets in Machine policy level:" ); - IEnumerator^ policyEnumerator = SecurityManager::PolicyHierarchy(); - while ( policyEnumerator->MoveNext() ) - { - PolicyLevel^ currentLevel = dynamic_cast(policyEnumerator->Current); - if ( currentLevel->Label->Equals( "Machine" ) ) - { - IList^ namedPermissions = currentLevel->NamedPermissionSets; - IEnumerator^ namedPermission = namedPermissions->GetEnumerator(); - while ( namedPermission->MoveNext() ) - { - Console::WriteLine( "\t{0}", (dynamic_cast(namedPermission->Current))->Name ); - } - } - } -} -// -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp deleted file mode 100644 index b32ab193862..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp +++ /dev/null @@ -1,163 +0,0 @@ -using namespace System; - -class SingleSample -{ -public: - SingleSample() - { - - // - Single s = 4.55F; - // - - // - Console::WriteLine( "A Single is of type {0}.", s.GetType() ); - // - - // - bool done = false; - String^ inp; - do - { - Console::Write( "Enter a real number: " ); - inp = Console::ReadLine(); - try - { - s = Single::Parse( inp ); - Console::WriteLine( "You entered {0}.", s ); - done = true; - } - catch ( FormatException^ ) - { - Console::WriteLine( "You did not enter a number." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "An exception occurred while parsing your response: {0}", e ); - } - } - while ( !done ); - // - - // - if ( s > Single::MaxValue ) - { - Console::WriteLine( "Your number is larger than a Single." ); - } - // - - // - if ( s < Single::MinValue ) - { - Console::WriteLine( "Your number is smaller than a Single." ); - } - // - - // - Console::WriteLine( "Epsilon, or the permittivity of a vacuum, has value {0}", Single::Epsilon ); - // - - // - Single zero = 0; - - // This condition will return false. - if ( (0 / zero) == Single::NaN ) - { - Console::WriteLine( "0 / 0 can be tested with Single::NaN." ); - } - else - { - Console::WriteLine( "0 / 0 cannot be tested with Single::NaN; use Single::IsNan() instead." ); - } - // - - // - // This will return true. - if ( Single::IsNaN( 0 / zero ) ) - { - Console::WriteLine( "Single::IsNan() can determine whether a value is not-a-number." ); - } - // - - // - // This will equal Infinity. - Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Single::NegativeInfinity) ); - // - - // - // This will equal Infinity. - Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Single::PositiveInfinity + 10.0) ); - // - - // - // This will return S"true". - Console::WriteLine( "IsInfinity(3.0F / 0) == {0}.", Single::IsInfinity( 3.0F / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return true. - Console::WriteLine( "IsPositiveInfinity(4.0F / 0) == {0}.", Single::IsPositiveInfinity( 4.0F / zero ) ? (String^)"true" : "false" ); - // - - // - // This will return true. - Console::WriteLine( "IsNegativeInfinity(-5.0F / 0) == {0}.", Single::IsNegativeInfinity( -5.0F / zero ) ? (String^)"true" : "false" ); - // - - // - Single a; - a = 500; - - Object^ obj1; - // - - // - // The variables point to the same objects. - Object^ obj2; - obj1 = a; - obj2 = obj1; - - if ( Single::ReferenceEquals( obj1, obj2 ) ) - { - Console::WriteLine( "The variables point to the same Single object." ); - } - else - { - Console::WriteLine( "The variables point to different Single objects." ); - } - // - - // - obj1 = (Single)450; - - if ( a.CompareTo( obj1 ) < 0 ) - { - Console::WriteLine( " {0} is less than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) > 0 ) - { - Console::WriteLine( " {0} is greater than {1}.", a, obj1 ); - } - - if ( a.CompareTo( obj1 ) == 0 ) - { - Console::WriteLine( " {0} equals {1}.", a, obj1 ); - } - // - - // - obj1 = (Single)500; - - if ( a.Equals( obj1 ) ) - { - Console::WriteLine( "The value type and reference type values are equal." ); - } - // - } -}; - -int main() -{ - new SingleSample; -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp deleted file mode 100644 index 851ef4dcfad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp +++ /dev/null @@ -1,10 +0,0 @@ -// -using namespace System; -using namespace System::Text; - -void main() -{ - String^ characters = "abc" + L'0' + "def"; - Console::WriteLine(characters->Length); // Displays 7 -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp deleted file mode 100644 index 9da4bfb57cf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; - -void main() -{ - // Create upper-case characters from their Unicode code units. - String^ stringUpper = "\x0041\x0042\x0043"; - - // Create lower-case characters from their Unicode code units. - String^ stringLower = "\x0061\x0062\x0063"; - - // Display the strings. - Console::WriteLine("Comparing '{0}' and '{1}':", - stringUpper, stringLower); - - // Compare the uppercased strings; the result is true. - Console::WriteLine("The Strings are equal when capitalized? {0}", - String::Compare(stringUpper->ToUpper(), stringLower->ToUpper()) == 0 - ? "true" : "false"); - - // The previous method call is equivalent to this Compare method, which ignores case. - Console::WriteLine("The Strings are equal when case is ignored? {0}", - String::Compare(stringUpper, stringLower, true) == 0 - ? "true" : "false"); -} -// The example displays the following output: -// Comparing 'ABC' and 'abc': -// The Strings are equal when capitalized? true -// The Strings are equal when case is ignored? true -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp deleted file mode 100644 index ceae78e341d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -public ref class Example -{ -public: - static void Main() - { - String^ string1 = "brother"; - String^ string2 = "Brother"; - String^ relation; - int result; - - // Cultural (linguistic) comparison. - result = String::Compare(string1, string2, gcnew CultureInfo("en-US"), - CompareOptions::None); - if (result > 0) - relation = "comes after"; - else if (result == 0) - relation = "is the same as"; - else - relation = "comes before"; - - Console::WriteLine("'{0}' {1} '{2}'.", - string1, relation, string2); - - // Cultural (linguistic) case-insensitive comparison. - result = String::Compare(string1, string2, gcnew CultureInfo("en-US"), - CompareOptions::IgnoreCase); - if (result > 0) - relation = "comes after"; - else if (result == 0) - relation = "is the same as"; - else - relation = "comes before"; - - Console::WriteLine("'{0}' {1} '{2}'.", - string1, relation, string2); - - // Culture-insensitive ordinal comparison. - result = String::CompareOrdinal(string1, string2); - if (result > 0) - relation = "comes after"; - else if (result == 0) - relation = "is the same as"; - else - relation = "comes before"; - - Console::WriteLine("'{0}' {1} '{2}'.", - string1, relation, string2); - } -}; - -int main() -{ - Example::Main(); -} - - -// The example produces the following output: -// 'brother' comes before 'Brother'. -// 'brother' is the same as 'Brother'. -// 'brother' comes after 'Brother'. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp deleted file mode 100644 index 403d3a1c663..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp +++ /dev/null @@ -1,197 +0,0 @@ -using namespace System; -using namespace System::Globalization; - -public ref class Example -{ -public: - static void Main() - { - Console::WriteLine("Hi!"); - } -}; - -int main() -{ - Example::Main(); -} - -// System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32) -public ref class CompareSample1_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -// System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32) -public ref class CompareSample1_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32,System.Boolean) -public class CompareSample2_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32,System.Boolean) -public class CompareSample2_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32, -// System.Boolean,System.Globalization.CultureInfo) -public class CompareSample3_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32, -// System.Boolean,System.Globalization.CultureInfo) -public class CompareSample3_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32, -// System.Int32,System.StringComparison) -public class CompareSample4_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.Int32,System.String,System.Int32, -// System.Int32,System.StringComparison) -public class CompareSample4_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String) -public class CompareSample5_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String) -public class CompareSample5_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean) -public class CompareSample6_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean) -public class CompareSample6_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean,System.Globalization.CultureInfo) -public class CompareSample7_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.Boolean,System.Globalization.CultureInfo) -public class CompareSample7_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.StringComparison) -public class CompareSample8_1 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, true) == 0); - } - // -}; - -//System.String.Compare(System.String,System.String,System.StringComparison) -public class CompareSample8_2 -{ - // - static bool IsFileURI(String^ path) - { - return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp deleted file mode 100644 index 3c33eb9d8a7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// -// This example demonstrates the -// System.String.Compare(String, String, StringComparison) method. - -using namespace System; -using namespace System::Threading; - -void Test(int testStringIndex, int searchStringIndex, - StringComparison comparison, array^ testI, - array^ testNames) -{ - String^ resultFormat = "{0} is {1} {2}"; - String^ resultString = "equal to"; - int comparisonValue = 0; - - comparisonValue = String::Compare(testI[testStringIndex], - testI[searchStringIndex], comparison); - if (comparisonValue < 0) - { - resultString = "less than"; - } - else if (comparisonValue > 0) - { - resultString = "greater than"; - } - Console::WriteLine(resultFormat, testNames[testStringIndex], resultString, - testNames[searchStringIndex]); -} - -int main() -{ - String^ introMessage = - "Compare three versions of the letter I using different " + - "values of StringComparison."; - - // Define an array of strings where each element contains a version of - // the letter I. (An array of strings is used so you can easily modify - // this code example to test additional or different combinations of - // strings.) - - array^ letterVariation = gcnew array(3); - // LATIN SMALL LETTER I (U+0069) - letterVariation[0] = "i"; - // LATIN SMALL LETTER DOTLESS I (U+0131) - letterVariation[1] = L"\u0131"; - // LATIN CAPITAL LETTER I (U+0049) - letterVariation[2] = "I"; - - array^ unicodeNames = { - "LATIN SMALL LETTER I (U+0069)", - "LATIN SMALL LETTER DOTLESS I (U+0131)", - "LATIN CAPITAL LETTER I (U+0049)"}; - - array^ comparisonValues = { - StringComparison::CurrentCulture, - StringComparison::CurrentCultureIgnoreCase, - StringComparison::InvariantCulture, - StringComparison::InvariantCultureIgnoreCase, - StringComparison::Ordinal, - StringComparison::OrdinalIgnoreCase}; - - Console::Clear(); - Console::WriteLine(introMessage); - - // Display the current culture because the culture-specific comparisons - // can produce different results with different cultures. - Console::WriteLine("The current culture is {0}.{1}", - Thread::CurrentThread->CurrentCulture->Name, Environment::NewLine); - - // Determine the relative sort order of three versions of the letter I. - for each (StringComparison stringCmp in comparisonValues) - { - Console::WriteLine("StringComparison.{0}:", stringCmp); - - // LATIN SMALL LETTER I (U+0069) : LATIN SMALL LETTER DOTLESS I - // (U+0131) - Test(0, 1, stringCmp, letterVariation, unicodeNames); - - // LATIN SMALL LETTER I (U+0069) : LATIN CAPITAL LETTER I (U+0049) - Test(0, 2, stringCmp, letterVariation, unicodeNames); - - // LATIN SMALL LETTER DOTLESS I (U+0131) : LATIN CAPITAL LETTER I - // (U+0049) - Test(1, 2, stringCmp, letterVariation, unicodeNames); - - Console::WriteLine(); - } -} - -/* -This code example produces the following results: - -Compare three versions of the letter I using different values of -StringComparison. -The current culture is en-US. - -StringComparison.CurrentCulture: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is less than LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.CurrentCultureIgnoreCase: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.InvariantCulture: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is less than LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.InvariantCultureIgnoreCase: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.Ordinal: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is greater than LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -StringComparison.OrdinalIgnoreCase: -LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER - DOTLESS I (U+0131) -LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) -LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN - CAPITAL LETTER I (U+0049) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp deleted file mode 100644 index 85a57be8c79..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// -// This example demonstrates the -// System.String.EndsWith(String, StringComparison) method. - -using namespace System; -using namespace System::Threading; - -void Test(String^ testString, String^ searchString, - StringComparison comparison) -{ - String^ resultFormat = "\"{0}\" {1} with \"{2}\"."; - String^ resultString = "does not end"; - - if (testString->EndsWith(searchString, comparison)) - { - resultString = "ends"; - } - Console::WriteLine(resultFormat, testString, resultString, searchString); -} - -int main() -{ - String^ introMessage = - "Determine whether a string ends with another string, " + - "using\ndifferent values of StringComparison."; - - array^ comparisonValues = { - StringComparison::CurrentCulture, - StringComparison::CurrentCultureIgnoreCase, - StringComparison::InvariantCulture, - StringComparison::InvariantCultureIgnoreCase, - StringComparison::Ordinal, - StringComparison::OrdinalIgnoreCase}; - - Console::WriteLine(introMessage); - - // Display the current culture because the culture-specific comparisons - // can produce different results with different cultures. - Console::WriteLine("The current culture is {0}.\n", - Thread::CurrentThread->CurrentCulture->Name); - // Perform two tests for each StringComparison - for each (StringComparison stringCmp in comparisonValues) - { - Console::WriteLine("StringComparison.{0}:", stringCmp); - Test("abcXYZ", "XYZ", stringCmp); - Test("abcXYZ", "xyz", stringCmp); - Console::WriteLine(); - } -} - -/* -This code example produces the following results: - -Determine whether a string ends with another string, using -different values of StringComparison. -The current culture is en-US. - -StringComparison.CurrentCulture: -"abcXYZ" ends with "XYZ". -"abcXYZ" does not end with "xyz". - -StringComparison.CurrentCultureIgnoreCase: -"abcXYZ" ends with "XYZ". -"abcXYZ" ends with "xyz". - -StringComparison.InvariantCulture: -"abcXYZ" ends with "XYZ". -"abcXYZ" does not end with "xyz". - -StringComparison.InvariantCultureIgnoreCase: -"abcXYZ" ends with "XYZ". -"abcXYZ" ends with "xyz". - -StringComparison.Ordinal: -"abcXYZ" ends with "XYZ". -"abcXYZ" does not end with "xyz". - -StringComparison.OrdinalIgnoreCase: -"abcXYZ" ends with "XYZ". -"abcXYZ" ends with "xyz". - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp deleted file mode 100644 index ecbc4947741..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Example for the String Equality operator. -using namespace System; -void CompareAndDisplay( String^ Comparand ) -{ - String^ Lower = "abcd"; - Console::WriteLine( "\"{0}\" == \"{1}\" ? {2}", Lower, Comparand, Lower == Comparand ); -} - -int main() -{ - Console::WriteLine( "This example of the String Equality operator\n" - "generates the following output.\n" ); - CompareAndDisplay( "ijkl" ); - CompareAndDisplay( "ABCD" ); - CompareAndDisplay( "abcd" ); -} - -/* -This example of the String Equality operator -generates the following output. - -"abcd" == "ijkl" ? False -"abcd" == "ABCD" ? False -"abcd" == "abcd" ? True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp deleted file mode 100644 index 546e49f2c89..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Format4.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - String^ formatString = " {0,10} ({0,8:X8})\n" + - "And {1,10} ({1,8:X8})\n" + - " = {2,10} ({2,8:X8})"; - int value1 = 16932; - int value2 = 15421; - String^ result = String::Format(formatString, - value1, value2, value1 & value2); - Console::WriteLine(result); -} -// The example displays the following output: -// 16932 (00004224) -// And 15421 (00003C3D) -// = 36 (00000024) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp deleted file mode 100644 index 8415cc4c1df..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// Format5.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - DateTime date1 = DateTime(2009, 7, 1); - TimeSpan hiTime = TimeSpan(14, 17, 32); - Decimal hiTemp = (Decimal) 62.1; - TimeSpan loTime = TimeSpan(3, 16, 10); - Decimal loTemp = (Decimal)54.8; - - String^ result1 = String::Format("Temperature on {0:d}:\n{1,11}: {2} degrees (hi)\n{3,11}: {4} degrees (lo)", - date1, hiTime, hiTemp, loTime, loTemp); - Console::WriteLine(result1); - Console::WriteLine(); - - String^ result2 = String::Format("Temperature on {0:d}:\n{1,11}: {2} degrees (hi)\n{3,11}: {4} degrees (lo)", - gcnew array { date1, hiTime, hiTemp, loTime, loTemp }); - Console::WriteLine(result2); -} -// The example displays the following output: -// Temperature on 7/1/2009: -// 14:17:32: 62.1 degrees (hi) -// 03:16:10: 54.8 degrees (lo) -// Temperature on 7/1/2009: -// 14:17:32: 62.1 degrees (hi) -// 03:16:10: 54.8 degrees (lo) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp deleted file mode 100644 index 166e0c1c832..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// Format7.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - DateTime birthdate = DateTime(1993, 7, 28); - array^ dates = gcnew array { DateTime(1993, 8, 16), - DateTime(1994, 7, 28), - DateTime(2000, 10, 16), - DateTime(2003, 7, 27), - DateTime(2007, 5, 27) }; - - for each (DateTime dateValue in dates) - { - TimeSpan interval = dateValue - birthdate; - // Get the approximate number of years, without accounting for leap years. - int years = ((int)interval.TotalDays) / 365; - // See if adding the number of years exceeds dateValue. - String^ output; - if (birthdate.AddYears(years) <= dateValue) { - output = String::Format("You are now {0} years old.", years); - Console::WriteLine(output); - } - else { - output = String::Format("You are now {0} years old.", years - 1); - Console::WriteLine(output); - } - } -} -// The example displays the following output: -// You are now 0 years old. -// You are now 1 years old. -// You are now 7 years old. -// You are now 9 years old. -// You are now 13 years old. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp deleted file mode 100644 index 30af678140b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// Format_ParamArray1.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -ref class CityInfo -{ -public: - CityInfo(String^ name, int population, Decimal area, int year) - { - this->Name = name; - this->Population = population; - this->Area = area; - this->Year = year; - } - - String^ Name; - int Population; - Decimal Area; - int Year; -}; - -ref class Example -{ -public: - static void ShowPopulationData(CityInfo^ city) - { - array^ args = gcnew array { city->Name, city->Year, city->Population, city->Area }; - String^ result = String::Format("{0} in {1}: Population {2:N0}, Area {3:N1} sq. feet", - args); - Console::WriteLine(result); - } -}; - -void main() -{ - CityInfo^ nyc2010 = gcnew CityInfo("New York", 8175133, (Decimal) 302.64, 2010); - Example::ShowPopulationData(nyc2010); - CityInfo^ sea2010 = gcnew CityInfo("Seattle", 608660, (Decimal) 83.94, 2010); - Example::ShowPopulationData(sea2010); -} -// The example displays the following output: -// New York in 2010: Population 8,175,133, Area 302.6 sq. feet -// Seattle in 2010: Population 608,660, Area 83.9 sq. feet -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp deleted file mode 100644 index 1acc61d5d34..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// FormatExample2.cpp : Defines the entry point for the console application. -// - -// #include "stdafx.h" - -// -using namespace System; - -ref class CustomerFormatter : IFormatProvider, ICustomFormatter -{ -public: - virtual Object^ GetFormat(Type^ formatType) - { - if (formatType == ICustomFormatter::typeid) - return this; - else - return nullptr; - } - - virtual String^ Format(String^ format, - Object^ arg, - IFormatProvider^ formatProvider) - { - if (!this->Equals(formatProvider)) - { - return nullptr; - } - else - { - if (String::IsNullOrEmpty(format)) - format = "G"; - - String^ customerString = arg->ToString(); - if (customerString->Length < 8) - customerString = customerString->PadLeft(8, '0'); - - format = format->ToUpper(); - if (format == L"G") - return customerString->Substring(0, 1) + "-" + - customerString->Substring(1, 5) + "-" + - customerString->Substring(6); - else if (format == L"S") - return customerString->Substring(0, 1) + "/" + - customerString->Substring(1, 5) + "/" + - customerString->Substring(6); - else if (format == L"P") - return customerString->Substring(0, 1) + "." + - customerString->Substring(1, 5) + "." + - customerString->Substring(6); - else - throw gcnew FormatException( - String::Format("The '{0}' format specifier is not supported.", format)); - } - } -}; - -void main() -{ - int acctNumber = 79203159; - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0}", acctNumber)); - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:G}", acctNumber)); - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:S}", acctNumber)); - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:P}", acctNumber)); - try { - Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:X}", acctNumber)); - } - catch (FormatException^ e) { - Console::WriteLine(e->Message); - } -} -// The example displays the following output: -// 7-92031-59 -// 7-92031-59 -// 7/92031/59 -// 7.92031.59 -// The 'X' format specifier is not supported. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp deleted file mode 100644 index a0a958f9dc8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// FormatExample4.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - - -// -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ - Dictionary^ temperatureInfo = gcnew Dictionary(); - temperatureInfo->Add(DateTime(2010, 6, 1, 14, 0, 0), 87.46); - temperatureInfo->Add(DateTime(2010, 12, 1, 10, 0, 0), 36.81); - - Console::WriteLine("Temperature Information:\n"); - String^ output; - for each (KeyValuePair^ item in temperatureInfo) - { - output = String::Format("Temperature at {0,8:t} on {0,9:d}: {1,5:N1}°F", - item->Key, item->Value); - Console::WriteLine(output); - } -} -// The example displays the following output: -// Temperature Information: -// -// Temperature at 2:00 PM on 6/1/2010: 87.5°F -// Temperature at 10:00 AM on 12/1/2010: 36.8°F -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp deleted file mode 100644 index 34c12932dfc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// FormatOverload1.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - DateTime^ dat = gcnew DateTime(2012, 1, 17, 9, 30, 0); - String^ city = "Chicago"; - int temp = -16; - String^ output = String::Format("At {0} in {1}, the temperature was {2} degrees.", - dat, city, temp); - Console::WriteLine(output); -} -// The example displays the following output: -// At 1/17/2012 9:30:00 AM in Chicago, the temperature was -16 degrees. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp deleted file mode 100644 index 6ac7fe64f84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// FormatOverload2.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - // Create array of 5-tuples with population data for three U.S. cities, 1940-1950. - array^>^ cities = gcnew array^> - { gcnew Tuple("Los Angeles", DateTime(1940, 1, 1), 1504277, - DateTime(1950, 1, 1), 1970358), - gcnew Tuple("New York", DateTime(1940, 1, 1), 7454995, - DateTime(1950, 1, 1), 7891957), - gcnew Tuple("Chicago", DateTime(1940, 1, 1), 3396808, - DateTime(1950, 1, 1), 3620962), - gcnew Tuple("Detroit", DateTime(1940, 1, 1), 1623452, - DateTime(1950, 1, 1), 1849568) }; - - // Display header - String^ header = String::Format("{0,-12}{1,8}{2,12}{1,8}{2,12}{3,14}\n", - "City", "Year", "Population", "Change (%)"); - Console::WriteLine(header); - String^ output; - for each (Tuple^ city in cities) { - output = String::Format("{0,-12}{1,8:yyyy}{2,12:N0}{3,8:yyyy}{4,12:N0}{5,14:P1}", - city->Item1, city->Item2, city->Item3, city->Item4, city->Item5, - (city->Item5 - city->Item3)/ (double)city->Item3); - Console::WriteLine(output); - } -} -// The example displays the following output: -// City Year Population Year Population Change (%) -// -// Los Angeles 1940 1,504,277 1950 1,970,358 31.0 % -// New York 1940 7,454,995 1950 7,891,957 5.9 % -// Chicago 1940 3,396,808 1950 3,620,962 6.6 % -// Detroit 1940 1,623,452 1950 1,849,568 13.9 % -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp deleted file mode 100644 index c0e1e10820b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// FormatSyntax1.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -using namespace System; - -void main() -{ - String^ value = -// -String::Format("{0,-10:C}", (Decimal) 126347.89); -// -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp deleted file mode 100644 index a5be70b67be..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// Interceptor2.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; -using namespace System::Globalization; - -ref class InterceptProvider : IFormatProvider, ICustomFormatter -{ -public: - virtual Object^ GetFormat(Type^ formatType) - { - if (formatType == ICustomFormatter::typeid) - return this; - else - return nullptr; - } - - virtual String^ Format(String^ format, Object^ obj, IFormatProvider^ provider) - { - // Display information about method call. - String^ formatString = format != nullptr ? format : ""; - Console::WriteLine("Provider: {0}, Object: {1}, Format String: {2}", - provider, obj != nullptr ? obj : "", formatString); - - if (obj == nullptr) return String::Empty; - - // If this is a byte and the "R" format string, format it with Roman numerals. - if (obj->GetType() == Byte::typeid && formatString->ToUpper()->Equals("R")) { - Byte value = (Byte) obj; - int remainder; - int result; - String^ returnString = String::Empty; - - // Get the hundreds digit(s) - result = Math::DivRem(value, 100, remainder); - if (result > 0) - returnString = gcnew String('C', result); - value = (Byte) remainder; - // Get the 50s digit - result = Math::DivRem(value, 50, remainder); - if (result == 1) - returnString += "L"; - value = (Byte) remainder; - // Get the tens digit. - result = Math::DivRem(value, 10, remainder); - if (result > 0) - returnString += gcnew String('X', result); - value = (Byte) remainder; - // Get the fives digit. - result = Math::DivRem(value, 5, remainder); - if (result > 0) - returnString += "V"; - value = (Byte) remainder; - // Add the ones digit. - if (remainder > 0) - returnString += gcnew String('I', remainder); - - // Check whether we have too many X characters. - int pos = returnString->IndexOf("XXXX"); - if (pos >= 0) { - int xPos = returnString->IndexOf("L"); - if ((xPos >= 0) & (xPos == pos - 1)) - returnString = returnString->Replace("LXXXX", "XC"); - else - returnString = returnString->Replace("XXXX", "XL"); - } - // Check whether we have too many I characters - pos = returnString->IndexOf("IIII"); - if (pos >= 0) - if (returnString->IndexOf("V") >= 0) - returnString = returnString->Replace("VIIII", "IX"); - else - returnString = returnString->Replace("IIII", "IV"); - - return returnString; - } - - // Use default for all other formatting. - if (obj->GetType() == IFormattable::typeid) - return ((IFormattable^) obj)->ToString(format, CultureInfo::CurrentCulture); - else - return obj->ToString(); - } -}; - -void main() -{ - int n = 10; - double value = 16.935; - DateTime day = DateTime::Now; - InterceptProvider^ provider = gcnew InterceptProvider(); - Console::WriteLine(String::Format(provider, "{0:N0}: {1:C2} on {2:d}\n", n, value, day)); - Console::WriteLine(String::Format(provider, "{0}: {1:F}\n", "Today: ", - (DayOfWeek) DateTime::Now.DayOfWeek)); - Console::WriteLine(String::Format(provider, "{0:X}, {1}, {2}\n", - (Byte) 2, (Byte) 12, (Byte) 199)); - Console::WriteLine(String::Format(provider, "{0:R}, {1:R}, {2:R}\n", - (Byte) 2, (Byte) 12, (Byte) 199)); -} -// The example displays the following output: -// Provider: InterceptProvider, Object: 10, Format String: N0 -// Provider: InterceptProvider, Object: 16.935, Format String: C2 -// Provider: InterceptProvider, Object: 1/31/2013 6:10:28 PM, Format String: d -// 10: $16.94 on 1/31/2013 -// -// Provider: InterceptProvider, Object: Today: , Format String: -// Provider: InterceptProvider, Object: Thursday, Format String: F -// Today: : Thursday -// -// Provider: InterceptProvider, Object: 2, Format String: X -// Provider: InterceptProvider, Object: 12, Format String: -// Provider: InterceptProvider, Object: 199, Format String: -// 2, 12, 199 -// -// Provider: InterceptProvider, Object: 2, Format String: R -// Provider: InterceptProvider, Object: 12, Format String: R -// Provider: InterceptProvider, Object: 199, Format String: R -// II, XII, CXCIX -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp deleted file mode 100644 index d74de7f473c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp +++ /dev/null @@ -1,80 +0,0 @@ -using namespace System; -using namespace System::Text; - -ref class Example -{ - public: - static void Snippet31() - { - // - String^ s = String::Format("At {0}, the temperature is {1}°C.", - DateTime::Now, 20.4); - // Output similar to: 'At 4/10/2015 9:29:41 AM, the temperature is 20.4°C.' - // - Console::WriteLine(s); - } - - static void Snippet32() - { - // - String^ s = String::Format("It is now {0:d} at {0:t}", - DateTime::Now); - // Output similar to: 'It is now 4/10/2015 at 10:04 AM' - // - Console::WriteLine(s); - } - - static void Snippet33() - { - // - array^ years = { 2013, 2014, 2015 }; - array^ population = { 1025632, 1105967, 1148203 }; - StringBuiler^ sb = gcnew StringBuilder(); - sb->Append(String::Format("{0,6} {1,15}\n\n", "Year", "Population")); - for(int index = 0; index < years->Length; index++) - sb->AppendFormat("{0,6} {1,15:N0}\n", - years[index], population[index]); - // Result: - // Year Population - // - // 2013 1,025,632 - // 2014 1,105,967 - // 2015 1,148,203 - // - Console::WriteLine(sb); - } - - static void Snippet34() - { - // - array^ years = { 2013, 2014, 2015 }; - array^ population = { 1025632, 1105967, 1148203 }; - String^ s = String::Format("{0,-10} {1,-10}\n\n", "Year", "Population"); - for(int index = 0; index < years->Length; index++) - s += String::Format("{0,-10} {1,-10:N0}\n", - years[index], population[index]); - // Result: - // Year Population - // - // 2013 1,025,632 - // 2014 1,105,967 - // 2015 1,148,203 - // - Console::WriteLine("\n{0}", s); - } -}; - -void main() -{ - // - Decimal temp = (Decimal)20.4; - String^ s = String::Format("The temperature is {0}°C.", temp); - Console::WriteLine(s); - // Displays 'The temperature is 20.4°C.' - // - - Example::Snippet31(); - Example::Snippet32(); - Example::Snippet33(); - Example::Snippet34(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp deleted file mode 100644 index 068c5e9cd1c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp +++ /dev/null @@ -1,37 +0,0 @@ -using namespace System; - -ref class Example -{ - public: - - void Main() - { - // - Decimal pricePerOunce = (Decimal)17.36; - String^ s = String::Format("The current price is {0} per ounce.", - pricePerOunce); - // Result: The current price is 17.36 per ounce. - // - Console::WriteLine(s); - ShowFormatted(); - } - - void ShowFormatted() - { - // - Decimal pricePerOunce = (Decimal)17.36; - String^ s = String::Format("The current price is {0:C2} per ounce.", - pricePerOunce); - // Result if current culture is en-US: - // The current price is $17.36 per ounce. - // - Console::WriteLine(s); - } -}; - - -void main() -{ - Example^ ex = gcnew Example(); - ex->Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp deleted file mode 100644 index cf52d962e88..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -using namespace System; - -void EnumerateAndDisplay(String^ phrase) -{ - Console::WriteLine("The characters in the string \"{0}\" are:", - phrase); - - int CharCount = 0; - int controlChars = 0; - int alphanumeric = 0; - int punctuation = 0; - - for each (Char ch in phrase) { - Console::Write("'{0}' ", (! Char::IsControl(ch)) ? ch.ToString() : - "0x" + Convert::ToUInt16(ch).ToString("X4")); - if (Char::IsLetterOrDigit(ch)) - alphanumeric++; - else if (Char::IsControl(ch)) - controlChars++; - else if (Char::IsPunctuation(ch)) - punctuation++; - CharCount++; - } - - Console::WriteLine("\n Total characters: {0,3}", CharCount); - Console::WriteLine(" Alphanumeric characters: {0,3}", alphanumeric); - Console::WriteLine(" Punctuation characters: {0,3}", punctuation); - Console::WriteLine(" Control Characters: {0,3}\n", controlChars); -} - -int main() -{ - EnumerateAndDisplay("Test Case"); - EnumerateAndDisplay("This is a sentence."); - EnumerateAndDisplay("Has\ttwo\ttabs"); - EnumerateAndDisplay("Two\nnew\nlines"); -} -// The example displays the following output: -// The characters in the string "Test Case" are: -// 'T' 'e' 's' 't' ' ' 'C' 'a' 's' 'e' -// Total characters: 9 -// Alphanumeric characters: 8 -// Punctuation characters: 0 -// Control Characters: 0 -// -// The characters in the string "This is a sentence." are: -// 'T' 'h' 'i' 's' ' ' 'i' 's' ' ' 'a' ' ' 's' 'e' 'n' 't' 'e' 'n' 'c' 'e' '.' -// Total characters: 19 -// Alphanumeric characters: 15 -// Punctuation characters: 1 -// Control Characters: 0 -// -// The characters in the string "Has two tabs" are: -// 'H' 'a' 's' '0x0009' 't' 'w' 'o' '0x0009' 't' 'a' 'b' 's' -// Total characters: 12 -// Alphanumeric characters: 10 -// Punctuation characters: 0 -// Control Characters: 2 -// -// The characters in the string "Two -// new -// lines" are: -// 'T' 'w' 'o' '0x000A' 'n' 'e' 'w' '0x000A' 'l' 'i' 'n' 'e' 's' -// Total characters: 13 -// Alphanumeric characters: 11 -// Punctuation characters: 0 -// Control Characters: 2 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp deleted file mode 100644 index d0860d3d34b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -void DisplayHashCode( String^ Operand ) -{ - int HashCode = Operand->GetHashCode(); - Console::WriteLine( "The hash code for \"{0}\" is: 0x{1:X8}, {1}", Operand, HashCode ); -} - -int main() -{ - DisplayHashCode( "" ); - DisplayHashCode( "a" ); - DisplayHashCode( "ab" ); - DisplayHashCode( "abc" ); - DisplayHashCode( "abd" ); - DisplayHashCode( "abe" ); - DisplayHashCode( "abcdef" ); - DisplayHashCode( "abcdeg" ); - DisplayHashCode( "abcdeh" ); - DisplayHashCode( "abcdei" ); - DisplayHashCode( "Abcdeg" ); - DisplayHashCode( "Abcdeh" ); - DisplayHashCode( "Abcdei" ); -} - -/* -This example displays output like the following: - The hash code for "" is: 0x2D2816FE, 757602046 - The hash code for "a" is: 0xCDCAB7BF, -842352705 - The hash code for "ab" is: 0xCDE8B7BF, -840386625 - The hash code for "abc" is: 0x2001D81A, 536991770 - The hash code for "abd" is: 0xC2A94CB5, -1029092171 - The hash code for "abe" is: 0x6550C150, 1699791184 - The hash code for "abcdef" is: 0x1762906D, 392335469 - The hash code for "abcdeg" is: 0x1763906D, 392401005 - The hash code for "abcdeh" is: 0x175C906D, 391942253 - The hash code for "abcdei" is: 0x175D906D, 392007789 - The hash code for "Abcdeg" is: 0x1763954D, 392402253 - The hash code for "Abcdeh" is: 0x175C954D, 391943501 - The hash code for "Abcdei" is: 0x175D954D, 392009037 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp deleted file mode 100644 index 129189e1c03..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -using namespace System; - -void main() -{ - // Create a Unicode String with 5 Greek Alpha characters. - String^ szGreekAlpha = gcnew String(L'\x0391',5); - - // Create a Unicode String with a 3 Greek Omega characters. - String^ szGreekOmega = L"\x03A9\x03A9\x03A9"; - - String^ szGreekLetters = String::Concat(szGreekOmega, szGreekAlpha, - szGreekOmega->Clone()); - - // Display the entire string. - Console::WriteLine(szGreekLetters); - - // The first index of Alpha. - int ialpha = szGreekLetters->IndexOf( L'\x0391'); - // The first index of Omega. - int iomega = szGreekLetters->IndexOf(L'\x03A9'); - - Console::WriteLine("First occurrence of the Greek letter Alpha: Index {0}", - ialpha); - Console::WriteLine("First occurrence of the Greek letter Omega: Index {0}", - iomega); -} -// The example displays the following output: -// The string: OOO?????OOO -// First occurrence of the Greek letter Alpha: Index 3 -// First occurrence of the Greek letter Omega: Index 0 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp deleted file mode 100644 index 536ce88ab56..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -// Example for the String::IndexOf( Char, int, int ) method. -using namespace System; -void FindAllChar( Char target, String^ searched ) -{ - Console::Write( "The character '{0}' occurs at position(s): ", target ); - int startIndex = -1; - int hitCount = 0; - - // Search for all occurrences of the target. - while ( true ) - { - startIndex = searched->IndexOf( target, startIndex + 1, searched->Length - startIndex - 1 ); - - // Exit the loop if the target is not found. - if ( startIndex < 0 ) - break; - - Console::Write( "{0}, ", startIndex ); - hitCount++; - } - - Console::WriteLine( "occurrences: {0}", hitCount ); -} - -int main() -{ - String^ br1 = "0----+----1----+----2----+----3----+----" - "4----+----5----+----6----+----7"; - String^ br2 = "0123456789012345678901234567890123456789" - "0123456789012345678901234567890"; - String^ str = "ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi " - "ABCDEFGHI abcdefghi ABCDEFGHI"; - Console::WriteLine( "This example of String::IndexOf( Char, int, int )\n" - "generates the following output." ); - Console::WriteLine( "{0}{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); - FindAllChar( 'A', str ); - FindAllChar( 'a', str ); - FindAllChar( 'I', str ); - FindAllChar( 'i', str ); - FindAllChar( '@', str ); - FindAllChar( ' ', str ); -} - -/* -This example of String::IndexOf( Char, int, int ) -generates the following output. - -0----+----1----+----2----+----3----+----4----+----5----+----6----+----7 -01234567890123456789012345678901234567890123456789012345678901234567890 -ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi ABCDEFGHI - -The character 'A' occurs at position(s): 0, 20, 40, 60, occurrences: 4 -The character 'a' occurs at position(s): 10, 30, 50, occurrences: 3 -The character 'I' occurs at position(s): 8, 28, 48, 68, occurrences: 4 -The character 'i' occurs at position(s): 18, 38, 58, occurrences: 3 -The character '@' occurs at position(s): occurrences: 0 -The character ' ' occurs at position(s): 9, 19, 29, 39, 49, 59, occurrences: 6 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp deleted file mode 100644 index 777e7856dd8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ str = "animal"; - String^ toFind = "n"; - int index = str->IndexOf("n"); - Console::WriteLine("Found '{0}' in '{1}' at position {2}", - toFind, str, index); - -} -// The example displays the following output: -// Found 'n' in 'animal' at position 1 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp deleted file mode 100644 index fb115d56be2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -// Example for the String Inequality operator. -using namespace System; -void CompareAndDisplay( String^ Comparand ) -{ - String^ Lower = "abcd"; - Console::WriteLine( "\"{0}\" != \"{1}\" ? {2}", Lower, Comparand, Lower != Comparand ); -} - -int main() -{ - Console::WriteLine( "This example of the String Inequality operator\n" - "generates the following output.\n" ); - CompareAndDisplay( "ijkl" ); - CompareAndDisplay( "ABCD" ); - CompareAndDisplay( "abcd" ); -} - -/* -This example of the String Inequality operator -generates the following output. - -"abcd" != "ijkl" ? True -"abcd" != "ABCD" ? True -"abcd" != "abcd" ? False -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp deleted file mode 100644 index 9a0970cfcc3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -using namespace System; - -void main() -{ - int n = 0; - for (int ctr = 0x20; ctr <= 0x017F; ctr++) { - String^ string1 = Convert::ToChar(ctr).ToString(); - String^ upperString = string1->ToUpper(); - if (string1 != upperString) { - Console::Write(L"{0} (\u+{1}) --> {2} (\u+{3}) ", - string1, - Convert::ToUInt16(string1[0]).ToString("X4"), - upperString, - Convert::ToUInt16(upperString[0]).ToString("X4")); - n++; - if (n % 2 == 0) Console::WriteLine(); - } - } -} -// The example displays the following output: -// a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042) -// c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044) -// e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046) -// g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048) -// i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A) -// k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C) -// m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E) -// o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050) -// q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052) -// s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054) -// u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056) -// w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058) -// y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A) -// à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> à (\u+00C1) -// â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3) -// ä (\u+00E4) --> Ä (\u+00C4) Ã¥ (\u+00E5) --> Ã… (\u+00C5) -// æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7) -// è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9) -// ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB) -// ì (\u+00EC) --> ÃŒ (\u+00CC) í (\u+00ED) --> à (\u+00CD) -// î (\u+00EE) --> ÃŽ (\u+00CE) ï (\u+00EF) --> à (\u+00CF) -// ð (\u+00F0) --> à (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1) -// ò (\u+00F2) --> Ã’ (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3) -// ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5) -// ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8) -// ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA) -// û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC) -// ý (\u+00FD) --> à (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE) -// ÿ (\u+00FF) --> Ÿ (\u+0178) Ä (\u+0101) --> Ä€ (\u+0100) -// ă (\u+0103) --> Ä‚ (\u+0102) Ä… (\u+0105) --> Ä„ (\u+0104) -// ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108) -// Ä‹ (\u+010B) --> ÄŠ (\u+010A) Ä (\u+010D) --> ÄŒ (\u+010C) -// Ä (\u+010F) --> ÄŽ (\u+010E) Ä‘ (\u+0111) --> Ä (\u+0110) -// Ä“ (\u+0113) --> Ä’ (\u+0112) Ä• (\u+0115) --> Ä” (\u+0114) -// Ä— (\u+0117) --> Ä– (\u+0116) Ä™ (\u+0119) --> Ę (\u+0118) -// Ä› (\u+011B) --> Äš (\u+011A) Ä (\u+011D) --> Äœ (\u+011C) -// ÄŸ (\u+011F) --> Äž (\u+011E) Ä¡ (\u+0121) --> Ä  (\u+0120) -// Ä£ (\u+0123) --> Ä¢ (\u+0122) Ä¥ (\u+0125) --> Ĥ (\u+0124) -// ħ (\u+0127) --> Ħ (\u+0126) Ä© (\u+0129) --> Ĩ (\u+0128) -// Ä« (\u+012B) --> Ī (\u+012A) Ä­ (\u+012D) --> Ĭ (\u+012C) -// į (\u+012F) --> Ä® (\u+012E) ı (\u+0131) --> I (\u+0049) -// ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ä´ (\u+0134) -// Ä· (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139) -// ļ (\u+013C) --> Ä» (\u+013B) ľ (\u+013E) --> Ľ (\u+013D) -// Å€ (\u+0140) --> Ä¿ (\u+013F) Å‚ (\u+0142) --> Å (\u+0141) -// Å„ (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Å… (\u+0145) -// ň (\u+0148) --> Ň (\u+0147) Å‹ (\u+014B) --> ÅŠ (\u+014A) -// Å (\u+014D) --> ÅŒ (\u+014C) Å (\u+014F) --> ÅŽ (\u+014E) -// Å‘ (\u+0151) --> Å (\u+0150) Å“ (\u+0153) --> Å’ (\u+0152) -// Å• (\u+0155) --> Å” (\u+0154) Å— (\u+0157) --> Å– (\u+0156) -// Å™ (\u+0159) --> Ř (\u+0158) Å› (\u+015B) --> Åš (\u+015A) -// Å (\u+015D) --> Åœ (\u+015C) ÅŸ (\u+015F) --> Åž (\u+015E) -// Å¡ (\u+0161) --> Å  (\u+0160) Å£ (\u+0163) --> Å¢ (\u+0162) -// Å¥ (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166) -// Å© (\u+0169) --> Ũ (\u+0168) Å« (\u+016B) --> Ū (\u+016A) -// Å­ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Å® (\u+016E) -// ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172) -// ŵ (\u+0175) --> Å´ (\u+0174) Å· (\u+0177) --> Ŷ (\u+0176) -// ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Å» (\u+017B) -// ž (\u+017E) --> Ž (\u+017D) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp deleted file mode 100644 index befd0ecbf85..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ charsToTrim = { L'*', L' ', L'\\' }; - String^ banner = "*** Much Ado About Nothing ***"; - String^ result = banner->Trim(charsToTrim); - Console::WriteLine("Trimmmed\n {0}\nto\n '{1}'", banner, result); -} -// The example displays the following output: -// Trimmmed -// *** Much Ado About Nothing *** -// to -// 'Much Ado About Nothing' -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp deleted file mode 100644 index bd9807b395d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -using namespace System; - -void main() -{ - Console::Write("Enter your first name: "); - String^ firstName = Console::ReadLine(); - - Console::Write("Enter your middle name or initial: "); - String^ middleName = Console::ReadLine(); - - Console::Write("Enter your last name: "); - String^ lastName = Console::ReadLine(); - - Console::WriteLine(); - Console::WriteLine("You entered '{0}', '{1}', and '{2}'.", - firstName, middleName, lastName); - - String^ name = ((firstName->Trim() + " " + middleName->Trim())->Trim() + " " + - lastName->Trim())->Trim(); - Console::WriteLine("The result is " + name + "."); -} -// The following is possible output from this example: -// Enter your first name: John -// Enter your middle name or initial: -// Enter your last name: Doe -// -// You entered ' John ', '', and ' Doe'. -// The result is John Doe. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp deleted file mode 100644 index 19daa2e0cd4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// This example demonstrates members of the -// System::StringComparer class. - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Generic; -using namespace System::Globalization; -using namespace System::Threading; - -void Display(List^ stringList, String^ title) -{ - Char firstChar; - int codePoint; - Console::WriteLine(title); - for each (String^ s in stringList) - { - firstChar = s[0]; - codePoint = Convert::ToInt32(firstChar); - Console::WriteLine("0x{0:x}", codePoint); - } - Console::WriteLine(); -} - -int main() -{ - // Create a list of string. - List^ stringList = gcnew List(); - - // Get the tr-TR (Turkish-Turkey) culture. - CultureInfo^ turkishCulture = gcnew CultureInfo("tr-TR"); - - // Get the culture that is associated with the current thread. - CultureInfo^ currentCulture = Thread::CurrentThread->CurrentCulture; - - // Get the standard StringComparers. - StringComparer^ invariant = StringComparer::InvariantCulture; - StringComparer^ invariantIgnoreCase = - StringComparer::InvariantCultureIgnoreCase; - StringComparer^ current = StringComparer::CurrentCulture; - StringComparer^ currentIgnoreCase = - StringComparer::CurrentCultureIgnoreCase; - StringComparer^ ordinal = StringComparer::Ordinal; - StringComparer^ ordinalIgnoreCase = StringComparer::OrdinalIgnoreCase; - - // Create a StringComparer that uses the Turkish culture and ignores - // case. - StringComparer^ turkishIgnoreCase = - StringComparer::Create(turkishCulture, true); - - // Define three strings consisting of different versions of the - // letter I. LATIN CAPITAL LETTER I (U+0049) - String^ capitalLetterI = "I"; - - // LATIN SMALL LETTER I (U+0069) - String^ smallLetterI = "i"; - - // LATIN SMALL LETTER DOTLESS I (U+0131) - String^ smallLetterDotlessI = L"\u0131"; - - // Add the three strings to the list. - stringList->Add(capitalLetterI); - stringList->Add(smallLetterI); - stringList->Add(smallLetterDotlessI); - - // Display the original list order. - Display(stringList, "The original order of the list entries..."); - - // Sort the list using the invariant culture. - stringList->Sort(invariant); - Display(stringList, "Invariant culture..."); - stringList->Sort(invariantIgnoreCase); - Display(stringList, "Invariant culture, ignore case..."); - - // Sort the list using the current culture. - Console::WriteLine("The current culture is \"{0}\".", - currentCulture->Name); - stringList->Sort(current); - Display(stringList, "Current culture..."); - stringList->Sort(currentIgnoreCase); - Display(stringList, "Current culture, ignore case..."); - - // Sort the list using the ordinal value of the character code points. - stringList->Sort(ordinal); - Display(stringList, "Ordinal..."); - stringList->Sort(ordinalIgnoreCase); - Display(stringList, "Ordinal, ignore case..."); - - // Sort the list using the Turkish culture, which treats LATIN SMALL - // LETTER DOTLESS I differently than LATIN SMALL LETTER I. - stringList->Sort(turkishIgnoreCase); - Display(stringList, "Turkish culture, ignore case..."); -} -/* -This code example produces the following results: - -The original order of the list entries... -0x49 -0x69 -0x131 - -Invariant culture... -0x69 -0x49 -0x131 - -Invariant culture, ignore case... -0x49 -0x69 -0x131 - -The current culture is "en-US". -Current culture... -0x69 -0x49 -0x131 - -Current culture, ignore case... -0x49 -0x69 -0x131 - -Ordinal... -0x49 -0x69 -0x131 - -Ordinal, ignore case... -0x69 -0x49 -0x131 - -Turkish culture, ignore case... -0x131 -0x49 -0x69 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp deleted file mode 100644 index b1cbd4a7c59..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp +++ /dev/null @@ -1,67 +0,0 @@ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Text; -int main() -{ - - // The encoding. - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - - // A Unicode string with two characters outside the ASCII code range. - String^ unicodeString = L"This Unicode String* contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3)."; - Console::WriteLine( "Original String*:" ); - Console::WriteLine( unicodeString ); - - // Save positions of the special characters for later reference. - int indexOfPi = unicodeString->IndexOf( L'\u03a0' ); - int indexOfSigma = unicodeString->IndexOf( L'\u03a3' ); - - // Encode string. - array^encodedBytes = ascii->GetBytes( unicodeString ); - Console::WriteLine(); - Console::WriteLine( "Encoded bytes:" ); - IEnumerator^ myEnum = encodedBytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "->Item[ {0}]", b ); - } - - Console::WriteLine(); - - // Notice that the special characters have been replaced with - // the value 63, which is the ASCII character code for '?'. - Console::WriteLine(); - Console::WriteLine( "Value at position of Pi character: {0}", encodedBytes[ indexOfPi ] ); - Console::WriteLine( "Value at position of Sigma character: {0}", encodedBytes[ indexOfSigma ] ); - - // Decode bytes back to string. - // Notice missing Pi and Sigma characters. - String^ decodedString = ascii->GetString( encodedBytes ); - Console::WriteLine(); - Console::WriteLine( "Decoded bytes:" ); - Console::WriteLine( decodedString ); -} -// The example displays the following output: -// Original string: -// This Unicode string contains two characters with codes outside the ASCII code ra -// nge, Pi (Π) and Sigma (Σ). -// -// Encoded bytes: -// [84][104][105][115][32][85][110][105][99][111][100][101][32][115][116][114][105] -// [110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][ -// 104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][1 -// 00][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][ -// 83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][1 -// 05][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41] -// [46] -// -// Value at position of Pi character: 63 -// Value at position of Sigma character: 63 -// -// Decoded bytes: -// This Unicode string contains two characters with codes outside the ASCII code ra -// nge, Pi (?) and Sigma (?). -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp deleted file mode 100644 index 6c219637683..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int byteCount = ascii->GetByteCount( chars, 1, 2 ); - Console::WriteLine( " {0} bytes needed to encode characters.", byteCount.ToString() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp deleted file mode 100644 index 9cca1f732fb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - String^ chars = "ASCII Encoding Example"; - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int byteCount = ascii->GetByteCount( chars ); - Console::WriteLine( " {0} bytes needed to encode string.", byteCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp deleted file mode 100644 index 8c299b71779..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - String^ chars = "ASCII Encoding Example"; - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int byteCount = ascii->GetByteCount( chars->ToCharArray(), 6, 8 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = ascii->GetBytes( chars, 6, 8, bytes, 0 ); - Console::WriteLine( " {0} bytes used to encode string.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp deleted file mode 100644 index 50c3b1c6605..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int byteCount = ascii->GetByteCount( chars, 1, 2 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = ascii->GetBytes( chars, 1, 2, bytes, 0 ); - Console::WriteLine( " {0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp deleted file mode 100644 index 9a924b51b64..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - array^bytes = {65,83,67,73,73,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int charCount = ascii->GetCharCount( bytes, 6, 8 ); - Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp deleted file mode 100644 index 7185ebd1815..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {65,83,67,73,73,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int charCount = ascii->GetCharCount( bytes, 6, 8 ); - chars = gcnew array(charCount); - int charsDecodedCount = ascii->GetChars( bytes, 6, 8, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp deleted file mode 100644 index 2f2f78f27ff..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int charCount = 2; - int maxByteCount = ascii->GetMaxByteCount( charCount ); - Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp deleted file mode 100644 index b6d834c02f9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - int byteCount = 8; - int maxCharCount = ascii->GetMaxCharCount( byteCount ); - Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp deleted file mode 100644 index b8f188b7df6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::Text; - -int main() -{ - // Define a string. - String^ original = "ASCII Encoding Example"; - // Instantiate an ASCII encoding object. - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - - // Create an ASCII byte array. - array^ bytes = ascii->GetBytes(original); - - // Display encoded bytes. - Console::Write("Encoded bytes (in hex): "); - for each (Byte value in bytes) - Console::Write("{0:X2} ", value); - Console::WriteLine(); - - // Decode the bytes and display the resulting Unicode string. - String^ decoded = ascii->GetString(bytes); - Console::WriteLine("Decoded string: '{0}'", decoded); -} -// The example displays the following output: -// Encoded bytes (in hex): 41 53 43 49 49 20 45 6E 63 6F 64 69 6E 67 20 45 78 61 6D 70 6C 65 -// Decoded string: 'ASCII Encoding Example' -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp deleted file mode 100644 index 962a0f07f41..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - ASCIIEncoding^ ascii = gcnew ASCIIEncoding; - String^ encodingName = ascii->EncodingName; - Console::WriteLine( "Encoding name: {0}", encodingName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp deleted file mode 100644 index 370f5662328..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; - Decoder^ uniDecoder = Encoding::Unicode->GetDecoder(); - int charCount = uniDecoder->GetCharCount( bytes, 0, bytes->Length ); - Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); -} - -/* This code example produces the following output. - -7 characters needed to decode bytes. - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp deleted file mode 100644 index 7183cd449b3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; - Decoder^ uniDecoder = Encoding::Unicode->GetDecoder(); - int charCount = uniDecoder->GetCharCount( bytes, 0, bytes->Length ); - chars = gcnew array(charCount); - int charsDecodedCount = uniDecoder->GetChars( bytes, 0, bytes->Length, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -/* This code example produces the following output. - -7 characters used to decode bytes. -Decoded chars: [U][n][i][c][o][d][e] - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp deleted file mode 100644 index 70bd454cc25..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // A Decoder is obtained from an Encoding. - UnicodeEncoding^ uni = gcnew UnicodeEncoding; - Decoder^ dec1 = uni->GetDecoder(); - - // A more direct technique. - Decoder^ dec2 = Encoding::Unicode->GetDecoder(); - - // dec1 and dec2 seem to be the same. - Console::WriteLine( dec1 ); - Console::WriteLine( dec2 ); - - // Note that their hash codes differ. - Console::WriteLine( dec1->GetHashCode() ); - Console::WriteLine( dec2->GetHashCode() ); -} - -/* This code example produces the following output. - -System.Text.UnicodeEncoding+Decoder -System.Text.UnicodeEncoding+Decoder -54267293 -18643596 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp deleted file mode 100644 index 74bd7968408..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp +++ /dev/null @@ -1,125 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -void ShowArray( Array^ theArray ) -{ - IEnumerator^ myEnum = theArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::Write( "[{0}]", o ); - } - - Console::WriteLine( "\n" ); -} - -int main() -{ - - // The characters to encode. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - - // Encode characters using an Encoding Object*. - Encoding^ encoding = Encoding::UTF7; - Console::WriteLine( "Using Encoding\n--------------" ); - - // Encode complete array for comparison. - array^allCharactersFromEncoding = encoding->GetBytes( chars ); - Console::WriteLine( "All characters encoded:" ); - ShowArray( allCharactersFromEncoding ); - - // Encode characters, one-by-one. - // The Encoding Object* will NOT maintain state between calls. - array^firstchar = encoding->GetBytes( chars, 0, 1 ); - Console::WriteLine( "First character:" ); - ShowArray( firstchar ); - array^secondchar = encoding->GetBytes( chars, 1, 1 ); - Console::WriteLine( "Second character:" ); - ShowArray( secondchar ); - array^thirdchar = encoding->GetBytes( chars, 2, 1 ); - Console::WriteLine( "Third character:" ); - ShowArray( thirdchar ); - array^fourthchar = encoding->GetBytes( chars, 3, 1 ); - Console::WriteLine( "Fourth character:" ); - ShowArray( fourthchar ); - - // Now, encode characters using an Encoder Object*. - Encoder^ encoder = encoding->GetEncoder(); - Console::WriteLine( "Using Encoder\n-------------" ); - - // Encode complete array for comparison. - array^allCharactersFromEncoder = gcnew array(encoder->GetByteCount( chars, 0, chars->Length, true )); - encoder->GetBytes( chars, 0, chars->Length, allCharactersFromEncoder, 0, true ); - Console::WriteLine( "All characters encoded:" ); - ShowArray( allCharactersFromEncoder ); - - // Do not flush state; i.e. maintain state between calls. - bool bFlushState = false; - - // Encode characters one-by-one. - // By maintaining state, the Encoder will not store extra bytes in the output. - array^firstcharNoFlush = gcnew array(encoder->GetByteCount( chars, 0, 1, bFlushState )); - encoder->GetBytes( chars, 0, 1, firstcharNoFlush, 0, bFlushState ); - Console::WriteLine( "First character:" ); - ShowArray( firstcharNoFlush ); - array^secondcharNoFlush = gcnew array(encoder->GetByteCount( chars, 1, 1, bFlushState )); - encoder->GetBytes( chars, 1, 1, secondcharNoFlush, 0, bFlushState ); - Console::WriteLine( "Second character:" ); - ShowArray( secondcharNoFlush ); - array^thirdcharNoFlush = gcnew array(encoder->GetByteCount( chars, 2, 1, bFlushState )); - encoder->GetBytes( chars, 2, 1, thirdcharNoFlush, 0, bFlushState ); - Console::WriteLine( "Third character:" ); - ShowArray( thirdcharNoFlush ); - - // Must flush state on last call to GetBytes(). - bFlushState = true; - array^fourthcharNoFlush = gcnew array(encoder->GetByteCount( chars, 3, 1, bFlushState )); - encoder->GetBytes( chars, 3, 1, fourthcharNoFlush, 0, bFlushState ); - Console::WriteLine( "Fourth character:" ); - ShowArray( fourthcharNoFlush ); -} - -/* This code example produces the following output. - -Using Encoding --------------- -All characters encoded: -[43][65][54][65][68][111][119][79][109][65][54][107][45] - -First character: -[43][65][54][65][45] - -Second character: -[43][65][54][77][45] - -Third character: -[43][65][54][89][45] - -Fourth character: -[43][65][54][107][45] - -Using Encoder -------------- -All characters encoded: -[43][65][54][65][68][111][119][79][109][65][54][107][45] - -First character: -[43][65][54] - -Second character: -[65][68][111] - -Third character: -[119][79][109] - -Fourth character: -[65][54][107][45] - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp deleted file mode 100644 index d8af6efc812..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - Encoder^ uniEncoder = Encoding::Unicode->GetEncoder(); - int byteCount = uniEncoder->GetByteCount( chars, 0, chars->Length, true ); - Console::WriteLine( "{0} bytes needed to encode characters.", byteCount ); -} - -/* This code example produces the following output. - -8 bytes needed to encode characters. - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp deleted file mode 100644 index 1430f4918f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - Encoder^ uniEncoder = Encoding::Unicode->GetEncoder(); - int byteCount = uniEncoder->GetByteCount( chars, 0, chars->Length, true ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = uniEncoder->GetBytes( chars, 0, chars->Length, bytes, 0, true ); - Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -/* This code example produces the following output. - -8 bytes used to encode characters. -Encoded bytes: [160][3][163][3][166][3][169][3] - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp deleted file mode 100644 index 0f8e033017f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // An Encoder is obtained from an Encoding. - UnicodeEncoding^ uni = gcnew UnicodeEncoding; - Encoder^ enc1 = uni->GetEncoder(); - - // A more direct technique. - Encoder^ enc2 = Encoding::Unicode->GetEncoder(); - - // enc1 and enc2 seem to be the same. - Console::WriteLine( enc1 ); - Console::WriteLine( enc2 ); - - // Note that their hash codes differ. - Console::WriteLine( enc1->GetHashCode() ); - Console::WriteLine( enc2->GetHashCode() ); -} - -/* This code example produces the following output. - -System.Text.EncoderNLS -System.Text.EncoderNLS -54267293 -18643596 - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp deleted file mode 100644 index 3ea34429d23..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp +++ /dev/null @@ -1,65 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - - // Create an ASCII encoding. - Encoding^ ascii = Encoding::ASCII; - - // A Unicode String* with two characters outside the ASCII code range. - String^ unicodeString = L"This unicode string contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3)."; - Console::WriteLine( "Original string:" ); - Console::WriteLine( unicodeString ); - - // Save the positions of the special characters for later reference. - int indexOfPi = unicodeString->IndexOf( L'\u03a0' ); - int indexOfSigma = unicodeString->IndexOf( L'\u03a3' ); - - // Encode the String*. - array^encodedBytes = ascii->GetBytes( unicodeString ); - Console::WriteLine(); - Console::WriteLine( "Encoded bytes:" ); - IEnumerator^ myEnum = encodedBytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); - - // Notice that the special characters have been replaced with - // the value 63, which is the ASCII character code for '?'. - Console::WriteLine(); - Console::WriteLine( "Value at position of Pi character: {0}", encodedBytes[ indexOfPi ] ); - Console::WriteLine( "Value at position of Sigma character: {0}", encodedBytes[ indexOfSigma ] ); - - // Decode bytes back to String*. - // Notice the missing Pi and Sigma characters. - String^ decodedString = ascii->GetString( encodedBytes ); - Console::WriteLine(); - Console::WriteLine( "Decoded bytes:" ); - Console::WriteLine( decodedString ); -} - -/* -This code produces the following output. - -Original string: -This unicode string contains two characters with codes outside the ASCII code range, Pi (Π) and Sigma (Σ). - -Encoded bytes: -[84][104][105][115][32][117][110][105][99][111][100][101][32][115][116][114][105][110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][100][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][105][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41][46] - -Value at position of Pi character: 63 -Value at position of Sigma character: 63 - -Decoded bytes: -This unicode string contains two characters with codes outside the ASCII code range, Pi (?) and Sigma (?). - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp deleted file mode 100644 index 8e692e11ce8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp +++ /dev/null @@ -1,19 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -int main() -{ - - // Read a text file saved with Big Endian Unicode encoding. - System::Text::Encoding^ encoding = System::Text::Encoding::BigEndianUnicode; - StreamReader^ reader = gcnew StreamReader( "TextFile.txt",encoding ); - String^ line = reader->ReadLine(); - while ( line != nullptr ) - { - Console::WriteLine( line ); - line = reader->ReadLine(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp deleted file mode 100644 index 1c3ea4a7481..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp +++ /dev/null @@ -1,176 +0,0 @@ - -// The following code example determines the Windows code page that most closely corresponds to each encoding. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Print the header. - Console::Write( "CodePage identifier and name " ); - Console::WriteLine( "WindowsCodePage" ); - - // For every encoding, get the Windows code page for it. - System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EncodingInfo ^ ei = safe_cast(myEnum->Current); - Encoding^ e = ei->GetEncoding(); - Console::Write( "{0,-6} {1,-25} ", ei->CodePage, ei->Name ); - Console::Write( "{0,-6} ", e->WindowsCodePage ); - - // Mark the ones that are different. - if ( ei->CodePage != e->WindowsCodePage ) - Console::Write( "*" ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -CodePage identifier and name WindowsCodePage -37 IBM037 1252 * -437 IBM437 1252 * -500 IBM500 1252 * -708 ASMO-708 1256 * -720 DOS-720 1256 * -737 ibm737 1253 * -775 ibm775 1257 * -850 ibm850 1252 * -852 ibm852 1250 * -855 IBM855 1252 * -857 ibm857 1254 * -858 IBM00858 1252 * -860 IBM860 1252 * -861 ibm861 1252 * -862 DOS-862 1255 * -863 IBM863 1252 * -864 IBM864 1256 * -865 IBM865 1252 * -866 cp866 1251 * -869 ibm869 1253 * -870 IBM870 1250 * -874 windows-874 874 -875 cp875 1253 * -932 shift_jis 932 -936 gb2312 936 -949 ks_c_5601-1987 949 -950 big5 950 -1026 IBM1026 1254 * -1047 IBM01047 1252 * -1140 IBM01140 1252 * -1141 IBM01141 1252 * -1142 IBM01142 1252 * -1143 IBM01143 1252 * -1144 IBM01144 1252 * -1145 IBM01145 1252 * -1146 IBM01146 1252 * -1147 IBM01147 1252 * -1148 IBM01148 1252 * -1149 IBM01149 1252 * -1200 utf-16 1200 -1201 unicodeFFFE 1200 * -1250 windows-1250 1250 -1251 windows-1251 1251 -1252 Windows-1252 1252 -1253 windows-1253 1253 -1254 windows-1254 1254 -1255 windows-1255 1255 -1256 windows-1256 1256 -1257 windows-1257 1257 -1258 windows-1258 1258 -1361 Johab 949 * -10000 macintosh 1252 * -10001 x-mac-japanese 932 * -10002 x-mac-chinesetrad 950 * -10003 x-mac-korean 949 * -10004 x-mac-arabic 1256 * -10005 x-mac-hebrew 1255 * -10006 x-mac-greek 1253 * -10007 x-mac-cyrillic 1251 * -10008 x-mac-chinesesimp 936 * -10010 x-mac-romanian 1250 * -10017 x-mac-ukrainian 1251 * -10021 x-mac-thai 874 * -10029 x-mac-ce 1250 * -10079 x-mac-icelandic 1252 * -10081 x-mac-turkish 1254 * -10082 x-mac-croatian 1250 * -12000 utf-32 1200 * -12001 utf-32BE 1200 * -20000 x-Chinese-CNS 950 * -20001 x-cp20001 950 * -20002 x-Chinese-Eten 950 * -20003 x-cp20003 950 * -20004 x-cp20004 950 * -20005 x-cp20005 950 * -20105 x-IA5 1252 * -20106 x-IA5-German 1252 * -20107 x-IA5-Swedish 1252 * -20108 x-IA5-Norwegian 1252 * -20127 us-ascii 1252 * -20261 x-cp20261 1252 * -20269 x-cp20269 1252 * -20273 IBM273 1252 * -20277 IBM277 1252 * -20278 IBM278 1252 * -20280 IBM280 1252 * -20284 IBM284 1252 * -20285 IBM285 1252 * -20290 IBM290 932 * -20297 IBM297 1252 * -20420 IBM420 1256 * -20423 IBM423 1253 * -20424 IBM424 1255 * -20833 x-EBCDIC-KoreanExtended 949 * -20838 IBM-Thai 874 * -20866 koi8-r 1251 * -20871 IBM871 1252 * -20880 IBM880 1251 * -20905 IBM905 1254 * -20924 IBM00924 1252 * -20932 EUC-JP 932 * -20936 x-cp20936 936 * -20949 x-cp20949 949 * -21025 cp1025 1251 * -21866 koi8-u 1251 * -28591 iso-8859-1 1252 * -28592 iso-8859-2 1250 * -28593 iso-8859-3 1254 * -28594 iso-8859-4 1257 * -28595 iso-8859-5 1251 * -28596 iso-8859-6 1256 * -28597 iso-8859-7 1253 * -28598 iso-8859-8 1255 * -28599 iso-8859-9 1254 * -28603 iso-8859-13 1257 * -28605 iso-8859-15 1252 * -29001 x-Europa 1252 * -38598 iso-8859-8-i 1255 * -50220 iso-2022-jp 932 * -50221 csISO2022JP 932 * -50222 iso-2022-jp 932 * -50225 iso-2022-kr 949 * -50227 x-cp50227 936 * -51932 euc-jp 932 * -51936 EUC-CN 936 * -51949 euc-kr 949 * -52936 hz-gb-2312 936 * -54936 GB18030 936 * -57002 x-iscii-de 57002 -57003 x-iscii-be 57003 -57004 x-iscii-ta 57004 -57005 x-iscii-te 57005 -57006 x-iscii-as 57006 -57007 x-iscii-or 57007 -57008 x-iscii-ka 57008 -57009 x-iscii-ma 57009 -57010 x-iscii-gu 57010 -57011 x-iscii-pa 57011 -65000 utf-7 1200 * -65001 utf-8 1200 * - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp deleted file mode 100644 index 90b8851bb09..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -// -using namespace System; -using namespace System::Text; - -int main() -{ - String^ unicodeString = "This string contains the unicode character Pi (\u03a0)"; - - // Create two different encodings. - Encoding^ ascii = Encoding::ASCII; - Encoding^ unicode = Encoding::Unicode; - - // Convert the string into a byte array. - array^unicodeBytes = unicode->GetBytes( unicodeString ); - - // Perform the conversion from one encoding to the other. - array^asciiBytes = Encoding::Convert( unicode, ascii, unicodeBytes ); - - // Convert the new Byte into[] a char and[] then into a string. - array^asciiChars = gcnew array(ascii->GetCharCount( asciiBytes, 0, asciiBytes->Length )); - ascii->GetChars( asciiBytes, 0, asciiBytes->Length, asciiChars, 0 ); - String^ asciiString = gcnew String( asciiChars ); - - // Display the strings created before and after the conversion. - Console::WriteLine( "Original String*: {0}", unicodeString ); - Console::WriteLine( "Ascii converted String*: {0}", asciiString ); -} -// The example displays the following output: -// Original string: This string contains the unicode character Pi (Π) -// Ascii converted string: This string contains the unicode character Pi (?) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp deleted file mode 100644 index cfdede118a3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// The following code example gets two instances of the same encoding (one by codepage and another by name), and checks their equality. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Get a UTF-32 encoding by codepage. - Encoding^ e1 = Encoding::GetEncoding( 12000 ); - - // Get a UTF-32 encoding by name. - Encoding^ e2 = Encoding::GetEncoding( "utf-32" ); - - // Check their equality. - Console::WriteLine( "e1 equals e2? {0}", e1->Equals( e2 ) ); -} - -/* -This code produces the following output. - -e1 equals e2? True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp deleted file mode 100644 index b6762b0e360..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// The following code example determines the number of bytes required to encode a character array, -// encodes the characters, and displays the resulting bytes. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndBytes( array^chars, Encoding^ enc ); -void PrintHexBytes( array^bytes ); -int main() -{ - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - // a high-surrogate value (U+D8FF) - // a low-surrogate value (U+DCFF) - array^myChars = gcnew array{ - L'z','a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF' - }; - - // Get different encodings. - Encoding^ u7 = Encoding::UTF7; - Encoding^ u8 = Encoding::UTF8; - Encoding^ u16LE = Encoding::Unicode; - Encoding^ u16BE = Encoding::BigEndianUnicode; - Encoding^ u32 = Encoding::UTF32; - - // Encode the entire array, and print out the counts and the resulting bytes. - PrintCountsAndBytes( myChars, u7 ); - PrintCountsAndBytes( myChars, u8 ); - PrintCountsAndBytes( myChars, u16LE ); - PrintCountsAndBytes( myChars, u16BE ); - PrintCountsAndBytes( myChars, u32 ); -} - -void PrintCountsAndBytes( array^chars, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-30} :", enc ); - - // Display the exact byte count. - int iBC = enc->GetByteCount( chars ); - Console::Write( " {0,-3}", iBC ); - - // Display the maximum byte count. - int iMBC = enc->GetMaxByteCount( chars->Length ); - Console::Write( " {0,-3} :", iMBC ); - - // Encode the array of chars. - array^bytes = enc->GetBytes( chars ); - - // Display all the encoded bytes. - PrintHexBytes( bytes ); -} - -void PrintHexBytes( array^bytes ) -{ - if ( (bytes == nullptr) || (bytes->Length == 0) ) - Console::WriteLine( "" ); - else - { - for ( int i = 0; i < bytes->Length; i++ ) - Console::Write( "{0:X2} ", bytes[ i ] ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D -System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF -System.Text.UnicodeEncoding : 14 16 :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC -System.Text.UnicodeEncoding : 14 16 :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF -System.Text.UTF32Encoding : 24 32 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp deleted file mode 100644 index 2fd11ecfbd4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// The following code example determines the number of bytes required to encode three characters from a character array, -// encodes the characters, and displays the resulting bytes. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ); -void PrintHexBytes( array^bytes ); -int main() -{ - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - // a high-surrogate value (U+D8FF) - // a low-surrogate value (U+DCFF) - array^myChars = gcnew array{ - L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF' - }; - - // Get different encodings. - Encoding^ u7 = Encoding::UTF7; - Encoding^ u8 = Encoding::UTF8; - Encoding^ u16LE = Encoding::Unicode; - Encoding^ u16BE = Encoding::BigEndianUnicode; - Encoding^ u32 = Encoding::UTF32; - - // Encode three characters starting at index 4, and print out the counts and the resulting bytes. - PrintCountsAndBytes( myChars, 4, 3, u7 ); - PrintCountsAndBytes( myChars, 4, 3, u8 ); - PrintCountsAndBytes( myChars, 4, 3, u16LE ); - PrintCountsAndBytes( myChars, 4, 3, u16BE ); - PrintCountsAndBytes( myChars, 4, 3, u32 ); -} - -void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-30} :", enc ); - - // Display the exact byte count. - int iBC = enc->GetByteCount( chars, index, count ); - Console::Write( " {0,-3}", iBC ); - - // Display the maximum byte count. - int iMBC = enc->GetMaxByteCount( count ); - Console::Write( " {0,-3} :", iMBC ); - - // Encode the array of chars. - array^bytes = enc->GetBytes( chars, index, count ); - - // The following is an alternative way to encode the array of chars: - // byte[] bytes = new byte[iBC]; - // enc.GetBytes( chars, index, count, bytes, bytes.GetLowerBound(0) ); - // Display all the encoded bytes. - PrintHexBytes( bytes ); -} - -void PrintHexBytes( array^bytes ) -{ - if ( (bytes == nullptr) || (bytes->Length == 0) ) - Console::WriteLine( "" ); - else - { - for ( int i = 0; i < bytes->Length; i++ ) - Console::Write( "{0:X2} ", bytes[ i ] ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D -System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF -System.Text.UnicodeEncoding : 6 8 :B2 03 FF D8 FF DC -System.Text.UnicodeEncoding : 6 8 :03 B2 D8 FF DC FF -System.Text.UTF32Encoding : 8 16 :B2 03 00 00 FF FC 04 00 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp deleted file mode 100644 index bf43b1262a2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp +++ /dev/null @@ -1,121 +0,0 @@ - -// The following code example determines the number of bytes required to encode a string or a range in the string, -// encodes the characters, and displays the resulting bytes. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndBytes( String^ s, Encoding^ enc ); -void PrintCountsAndBytes( String^ s, int index, int count, Encoding^ enc ); -void PrintHexBytes( array^bytes ); -int main() -{ - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - // a high-surrogate value (U+D8FF) - // a low-surrogate value (U+DCFF) - String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; - - // Get different encodings. - Encoding^ u7 = Encoding::UTF7; - Encoding^ u8 = Encoding::UTF8; - Encoding^ u16LE = Encoding::Unicode; - Encoding^ u16BE = Encoding::BigEndianUnicode; - Encoding^ u32 = Encoding::UTF32; - - // Encode the entire string, and print out the counts and the resulting bytes. - Console::WriteLine( "Encoding the entire string:" ); - PrintCountsAndBytes( myStr, u7 ); - PrintCountsAndBytes( myStr, u8 ); - PrintCountsAndBytes( myStr, u16LE ); - PrintCountsAndBytes( myStr, u16BE ); - PrintCountsAndBytes( myStr, u32 ); - Console::WriteLine(); - - // Encode three characters starting at index 4, and print out the counts and the resulting bytes. - Console::WriteLine( "Encoding the characters from index 4 through 6:" ); - PrintCountsAndBytes( myStr, 4, 3, u7 ); - PrintCountsAndBytes( myStr, 4, 3, u8 ); - PrintCountsAndBytes( myStr, 4, 3, u16LE ); - PrintCountsAndBytes( myStr, 4, 3, u16BE ); - PrintCountsAndBytes( myStr, 4, 3, u32 ); -} - -void PrintCountsAndBytes( String^ s, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-30} :", enc ); - - // Display the exact byte count. - int iBC = enc->GetByteCount( s ); - Console::Write( " {0,-3}", iBC ); - - // Display the maximum byte count. - int iMBC = enc->GetMaxByteCount( s->Length ); - Console::Write( " {0,-3} :", iMBC ); - - // Encode the entire string. - array^bytes = enc->GetBytes( s ); - - // Display all the encoded bytes. - PrintHexBytes( bytes ); -} - -void PrintCountsAndBytes( String^ s, int index, int count, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-30} :", enc ); - - // Display the exact byte count. - int iBC = enc->GetByteCount( s->ToCharArray(), index, count ); - Console::Write( " {0,-3}", iBC ); - - // Display the maximum byte count. - int iMBC = enc->GetMaxByteCount( count ); - Console::Write( " {0,-3} :", iMBC ); - - // Encode a range of characters in the string. - array^bytes = gcnew array(iBC); - enc->GetBytes( s, index, count, bytes, bytes->GetLowerBound( 0 ) ); - - // Display all the encoded bytes. - PrintHexBytes( bytes ); -} - -void PrintHexBytes( array^bytes ) -{ - if ( (bytes == nullptr) || (bytes->Length == 0) ) - Console::WriteLine( "" ); - else - { - for ( int i = 0; i < bytes->Length; i++ ) - Console::Write( "{0:X2} ", bytes[ i ] ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -Encoding the entire string: -System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D -System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF -System.Text.UnicodeEncoding : 14 16 :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC -System.Text.UnicodeEncoding : 14 16 :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF -System.Text.UTF32Encoding : 24 32 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 - -Encoding the characters from index 4 through 6: -System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D -System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF -System.Text.UnicodeEncoding : 6 8 :B2 03 FF D8 FF DC -System.Text.UnicodeEncoding : 6 8 :03 B2 D8 FF DC FF -System.Text.UTF32Encoding : 8 16 :B2 03 00 00 FF FC 04 00 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp deleted file mode 100644 index 14988aae74c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// The following code example encodes a string into an array of bytes, -// and then decodes the bytes into an array of characters. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndChars( array^bytes, Encoding^ enc ); -int main() -{ - - // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order. - Encoding^ u32LE = Encoding::GetEncoding( "utf-32" ); - Encoding^ u32BE = Encoding::GetEncoding( "utf-32BE" ); - - // Use a string containing the following characters: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - String^ myStr = "za\u0306\u01FD\u03B2"; - - // Encode the string using the big-endian byte order. - array^barrBE = gcnew array(u32BE->GetByteCount( myStr )); - u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 ); - - // Encode the string using the little-endian byte order. - array^barrLE = gcnew array(u32LE->GetByteCount( myStr )); - u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 ); - - // Get the char counts, and decode the byte arrays. - Console::Write( "BE array with BE encoding : " ); - PrintCountsAndChars( barrBE, u32BE ); - Console::Write( "LE array with LE encoding : " ); - PrintCountsAndChars( barrLE, u32LE ); -} - -void PrintCountsAndChars( array^bytes, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-25} :", enc ); - - // Display the exact character count. - int iCC = enc->GetCharCount( bytes ); - Console::Write( " {0,-3}", iCC ); - - // Display the maximum character count. - int iMCC = enc->GetMaxCharCount( bytes->Length ); - Console::Write( " {0,-3} :", iMCC ); - - // Decode the bytes and display the characters. - array^chars = enc->GetChars( bytes ); - Console::WriteLine( chars ); -} - -/* -This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. - -BE array with BE encoding : System.Text.UTF32Encoding : 5 12 :zăǽβ -LE array with LE encoding : System.Text.UTF32Encoding : 5 12 :zăǽβ - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp deleted file mode 100644 index 5d42df4246f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp +++ /dev/null @@ -1,69 +0,0 @@ - -// The following code example encodes a string into an array of bytes, -// and then decodes a range of the bytes into an array of characters. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndChars( array^bytes, int index, int count, Encoding^ enc ); -int main() -{ - - // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order. - Encoding^ u32LE = Encoding::GetEncoding( "utf-32" ); - Encoding^ u32BE = Encoding::GetEncoding( "utf-32BE" ); - - // Use a string containing the following characters: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - String^ myStr = "za\u0306\u01FD\u03B2"; - - // Encode the string using the big-endian byte order. - array^barrBE = gcnew array(u32BE->GetByteCount( myStr )); - u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 ); - - // Encode the string using the little-endian byte order. - array^barrLE = gcnew array(u32LE->GetByteCount( myStr )); - u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 ); - - // Get the char counts, decode eight bytes starting at index 0, - // and print out the counts and the resulting bytes. - Console::Write( "BE array with BE encoding : " ); - PrintCountsAndChars( barrBE, 0, 8, u32BE ); - Console::Write( "LE array with LE encoding : " ); - PrintCountsAndChars( barrLE, 0, 8, u32LE ); -} - -void PrintCountsAndChars( array^bytes, int index, int count, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-25} :", enc ); - - // Display the exact character count. - int iCC = enc->GetCharCount( bytes, index, count ); - Console::Write( " {0,-3}", iCC ); - - // Display the maximum character count. - int iMCC = enc->GetMaxCharCount( count ); - Console::Write( " {0,-3} :", iMCC ); - - // Decode the bytes and display the characters. - array^chars = enc->GetChars( bytes, index, count ); - - // The following is an alternative way to decode the bytes: - // Char[] chars = new Char[iCC]; - // enc->GetChars( bytes, index, count, chars, 0 ); - Console::WriteLine( chars ); -} - -/* -This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. - -BE array with BE encoding : System.Text.UTF32Encoding : 2 6 :za -LE array with LE encoding : System.Text.UTF32Encoding : 2 6 :za - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp deleted file mode 100644 index 8b3e3c0da25..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp +++ /dev/null @@ -1,41 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - Encoding^ unicode = Encoding::Unicode; - - // Get the preamble for the Unicode encoder. - // In this case the preamblecontains the Byte order mark (BOM). - array^preamble = unicode->GetPreamble(); - - // Make sure a preamble was returned - // and is large enough to contain a BOM. - if ( preamble->Length >= 2 ) - { - - // if (preamble->Item[0] == 0xFE && preamble->Item[1] == 0xFF) - if ( preamble[ 0 ] == 0xFE && preamble[ 1 ] == 0xFF ) - { - Console::WriteLine( "The Unicode encoder is encoding in big-endian order." ); - } - // else if (preamble->Item[0] == 0xFF && preamble->Item[1] == 0xFE) - else - - // else if (preamble->Item[0] == 0xFF && preamble->Item[1] == 0xFE) - if ( preamble[ 0 ] == 0xFF && preamble[ 1 ] == 0xFE ) - { - Console::WriteLine( "The Unicode encoder is encoding in little-endian order." ); - } - } -} - -/* -This code produces the following output. - -The Unicode encoder is encoding in little-endian order. - -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp deleted file mode 100644 index 79ba4ed7a77..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp +++ /dev/null @@ -1,173 +0,0 @@ - -// The following code example checks the values of the Boolean properties of each encoding. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Print the header. - Console::Write( "CodePage identifier and name " ); - Console::Write( "BrDisp BrSave " ); - Console::Write( "MNDisp MNSave " ); - Console::WriteLine( "1-Byte ReadOnly " ); - - // For every encoding, get the property values. - System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EncodingInfo ^ ei = safe_cast(myEnum->Current); - Encoding^ e = ei->GetEncoding(); - Console::Write( "{0,-6} {1,-25} ", ei->CodePage, ei->Name ); - Console::Write( "{0,-8} {1,-8} ", e->IsBrowserDisplay, e->IsBrowserSave ); - Console::Write( "{0,-8} {1,-8} ", e->IsMailNewsDisplay, e->IsMailNewsSave ); - Console::WriteLine( "{0,-8} {1,-8} ", e->IsSingleByte, e->IsReadOnly ); - } -} - -/* -This code produces the following output. - -CodePage identifier and name BrDisp BrSave MNDisp MNSave 1-Byte ReadOnly -37 IBM037 False False False False True True -437 IBM437 False False False False True True -500 IBM500 False False False False True True -708 ASMO-708 True True False False True True -720 DOS-720 True True False False True True -737 ibm737 False False False False True True -775 ibm775 False False False False True True -850 ibm850 False False False False True True -852 ibm852 True True False False True True -855 IBM855 False False False False True True -857 ibm857 False False False False True True -858 IBM00858 False False False False True True -860 IBM860 False False False False True True -861 ibm861 False False False False True True -862 DOS-862 True True False False True True -863 IBM863 False False False False True True -864 IBM864 False False False False True True -865 IBM865 False False False False True True -866 cp866 True True False False True True -869 ibm869 False False False False True True -870 IBM870 False False False False True True -874 windows-874 True True True True True True -875 cp875 False False False False True True -932 shift_jis True True True True False True -936 gb2312 True True True True False True -949 ks_c_5601-1987 True True True True False True -950 big5 True True True True False True -1026 IBM1026 False False False False True True -1047 IBM01047 False False False False True True -1140 IBM01140 False False False False True True -1141 IBM01141 False False False False True True -1142 IBM01142 False False False False True True -1143 IBM01143 False False False False True True -1144 IBM01144 False False False False True True -1145 IBM01145 False False False False True True -1146 IBM01146 False False False False True True -1147 IBM01147 False False False False True True -1148 IBM01148 False False False False True True -1149 IBM01149 False False False False True True -1200 utf-16 False True False False False True -1201 unicodeFFFE False False False False False True -1250 windows-1250 True True True True True True -1251 windows-1251 True True True True True True -1252 Windows-1252 True True True True True True -1253 windows-1253 True True True True True True -1254 windows-1254 True True True True True True -1255 windows-1255 True True True True True True -1256 windows-1256 True True True True True True -1257 windows-1257 True True True True True True -1258 windows-1258 True True True True True True -1361 Johab False False False False False True -10000 macintosh False False False False True True -10001 x-mac-japanese False False False False False True -10002 x-mac-chinesetrad False False False False False True -10003 x-mac-korean False False False False False True -10004 x-mac-arabic False False False False True True -10005 x-mac-hebrew False False False False True True -10006 x-mac-greek False False False False True True -10007 x-mac-cyrillic False False False False True True -10008 x-mac-chinesesimp False False False False False True -10010 x-mac-romanian False False False False True True -10017 x-mac-ukrainian False False False False True True -10021 x-mac-thai False False False False True True -10029 x-mac-ce False False False False True True -10079 x-mac-icelandic False False False False True True -10081 x-mac-turkish False False False False True True -10082 x-mac-croatian False False False False True True -12000 utf-32 False False False False False True -12001 utf-32BE False False False False False True -20000 x-Chinese-CNS False False False False False True -20001 x-cp20001 False False False False False True -20002 x-Chinese-Eten False False False False False True -20003 x-cp20003 False False False False False True -20004 x-cp20004 False False False False False True -20005 x-cp20005 False False False False False True -20105 x-IA5 False False False False True True -20106 x-IA5-German False False False False True True -20107 x-IA5-Swedish False False False False True True -20108 x-IA5-Norwegian False False False False True True -20127 us-ascii False False True True True True -20261 x-cp20261 False False False False False True -20269 x-cp20269 False False False False True True -20273 IBM273 False False False False True True -20277 IBM277 False False False False True True -20278 IBM278 False False False False True True -20280 IBM280 False False False False True True -20284 IBM284 False False False False True True -20285 IBM285 False False False False True True -20290 IBM290 False False False False True True -20297 IBM297 False False False False True True -20420 IBM420 False False False False True True -20423 IBM423 False False False False True True -20424 IBM424 False False False False True True -20833 x-EBCDIC-KoreanExtended False False False False True True -20838 IBM-Thai False False False False True True -20866 koi8-r True True True True True True -20871 IBM871 False False False False True True -20880 IBM880 False False False False True True -20905 IBM905 False False False False True True -20924 IBM00924 False False False False True True -20932 EUC-JP False False False False False True -20936 x-cp20936 False False False False False True -20949 x-cp20949 False False False False False True -21025 cp1025 False False False False True True -21866 koi8-u True True True True True True -28591 iso-8859-1 True True True True True True -28592 iso-8859-2 True True True True True True -28593 iso-8859-3 False False True True True True -28594 iso-8859-4 True True True True True True -28595 iso-8859-5 True True True True True True -28596 iso-8859-6 True True True True True True -28597 iso-8859-7 True True True True True True -28598 iso-8859-8 True True False False True True -28599 iso-8859-9 True True True True True True -28603 iso-8859-13 False False True True True True -28605 iso-8859-15 False True True True True True -29001 x-Europa False False False False True True -38598 iso-8859-8-i True True True True True True -50220 iso-2022-jp False False True True False True -50221 csISO2022JP False True True True False True -50222 iso-2022-jp False False False False False True -50225 iso-2022-kr False False True False False True -50227 x-cp50227 False False False False False True -51932 euc-jp True True True True False True -51936 EUC-CN False False False False False True -51949 euc-kr False False True True False True -52936 hz-gb-2312 True True True True False True -54936 GB18030 True True True True False True -57002 x-iscii-de False False False False False True -57003 x-iscii-be False False False False False True -57004 x-iscii-ta False False False False False True -57005 x-iscii-te False False False False False True -57006 x-iscii-as False False False False False True -57007 x-iscii-or False False False False False True -57008 x-iscii-ka False False False False False True -57009 x-iscii-ma False False False False False True -57010 x-iscii-gu False False False False False True -57011 x-iscii-pa False False False False False True -65001 utf-8 True True True True False True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp deleted file mode 100644 index 53f98f67454..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp +++ /dev/null @@ -1,52 +0,0 @@ - -// The following code example retrieves the different names for each encoding -// and displays the encodings with one or more names that are different from EncodingInfo.Name. -// It displays EncodingName but does not compare against it. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Print the header. - Console::Write( "Name " ); - Console::Write( "CodePage " ); - Console::Write( "BodyName " ); - Console::Write( "HeaderName " ); - Console::Write( "WebName " ); - Console::WriteLine( "Encoding.EncodingName" ); - - // For every encoding, compare the name properties with EncodingInfo.Name. - // Display only the encodings that have one or more different names. - System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EncodingInfo ^ ei = safe_cast(myEnum->Current); - Encoding^ e = ei->GetEncoding(); - if ( !ei->Name->Equals( e->BodyName ) || !ei->Name->Equals( e->HeaderName ) || !ei->Name->Equals( e->WebName ) ) - { - Console::Write( "{0,-18} ", ei->Name ); - Console::Write( "{0,-9} ", e->CodePage ); - Console::Write( "{0,-18} ", e->BodyName ); - Console::Write( "{0,-18} ", e->HeaderName ); - Console::Write( "{0,-18} ", e->WebName ); - Console::WriteLine( "{0} ", e->EncodingName ); - } - } -} - -/* -This code produces the following output. - -Name CodePage BodyName HeaderName WebName Encoding.EncodingName -shift_jis 932 iso-2022-jp iso-2022-jp shift_jis Japanese (Shift-JIS) -windows-1250 1250 iso-8859-2 windows-1250 windows-1250 Central European (Windows) -windows-1251 1251 koi8-r windows-1251 windows-1251 Cyrillic (Windows) -Windows-1252 1252 iso-8859-1 Windows-1252 Windows-1252 Western European (Windows) -windows-1253 1253 iso-8859-7 windows-1253 windows-1253 Greek (Windows) -windows-1254 1254 iso-8859-9 windows-1254 windows-1254 Turkish (Windows) -csISO2022JP 50221 iso-2022-jp iso-2022-jp csISO2022JP Japanese (JIS-Allow 1 byte Kana) -iso-2022-kr 50225 iso-2022-kr euc-kr iso-2022-kr Korean (ISO) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp deleted file mode 100644 index 7b3357371c8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Web; -int main() -{ - - // Use UTF8 encoding. - Encoding^ encoding = Encoding::UTF8; - StreamWriter^ writer = gcnew StreamWriter( "Encoding.html",false,encoding ); - writer->WriteLine( "" ); - - // Write charset attribute to the html file. - // writer -> WriteLine(S""); - writer->WriteLine( String::Concat( "" ) ); - writer->WriteLine( "" ); - writer->WriteLine( "

{0}

", HttpUtility::HtmlEncode( encoding->EncodingName ) ); - writer->WriteLine( "" ); - writer->Flush(); - writer->Close(); -} - -/* -This code produces the following output in an HTML file. - - - - -

Unicode (UTF-8)

- - -*/ -//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp deleted file mode 100644 index 60ac3dd0f2b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp +++ /dev/null @@ -1,188 +0,0 @@ - -// The following code example retrieves the different names for each encoding -// and compares them with the equivalent Encoding names. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Print the header. - Console::Write( "Info.CodePage " ); - Console::Write( "Info.Name " ); - Console::Write( "Info.DisplayName" ); - Console::WriteLine(); - - // Display the EncodingInfo names for every encoding, and compare with the equivalent Encoding names. - System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EncodingInfo ^ ei = safe_cast(myEnum->Current); - Encoding^ e = ei->GetEncoding(); - Console::Write( "{0,-15}", ei->CodePage ); - if ( ei->CodePage == e->CodePage ) - Console::Write( " " ); - else - Console::Write( "*** " ); - Console::Write( "{0,-25}", ei->Name ); - if ( ei->CodePage == e->CodePage ) - Console::Write( " " ); - else - Console::Write( "*** " ); - Console::Write( "{0,-25}", ei->DisplayName ); - if ( ei->CodePage == e->CodePage ) - Console::Write( " " ); - else - Console::Write( "*** " ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -Info.CodePage Info.Name Info.DisplayName -37 IBM037 IBM EBCDIC (US-Canada) -437 IBM437 OEM United States -500 IBM500 IBM EBCDIC (International) -708 ASMO-708 Arabic (ASMO 708) -720 DOS-720 Arabic (DOS) -737 ibm737 Greek (DOS) -775 ibm775 Baltic (DOS) -850 ibm850 Western European (DOS) -852 ibm852 Central European (DOS) -855 IBM855 OEM Cyrillic -857 ibm857 Turkish (DOS) -858 IBM00858 OEM Multilingual Latin I -860 IBM860 Portuguese (DOS) -861 ibm861 Icelandic (DOS) -862 DOS-862 Hebrew (DOS) -863 IBM863 French Canadian (DOS) -864 IBM864 Arabic (864) -865 IBM865 Nordic (DOS) -866 cp866 Cyrillic (DOS) -869 ibm869 Greek, Modern (DOS) -870 IBM870 IBM EBCDIC (Multilingual Latin-2) -874 windows-874 Thai (Windows) -875 cp875 IBM EBCDIC (Greek Modern) -932 shift_jis Japanese (Shift-JIS) -936 gb2312 Chinese Simplified (GB2312) -949 ks_c_5601-1987 Korean -950 big5 Chinese Traditional (Big5) -1026 IBM1026 IBM EBCDIC (Turkish Latin-5) -1047 IBM01047 IBM Latin-1 -1140 IBM01140 IBM EBCDIC (US-Canada-Euro) -1141 IBM01141 IBM EBCDIC (Germany-Euro) -1142 IBM01142 IBM EBCDIC (Denmark-Norway-Euro) -1143 IBM01143 IBM EBCDIC (Finland-Sweden-Euro) -1144 IBM01144 IBM EBCDIC (Italy-Euro) -1145 IBM01145 IBM EBCDIC (Spain-Euro) -1146 IBM01146 IBM EBCDIC (UK-Euro) -1147 IBM01147 IBM EBCDIC (France-Euro) -1148 IBM01148 IBM EBCDIC (International-Euro) -1149 IBM01149 IBM EBCDIC (Icelandic-Euro) -1200 utf-16 Unicode -1201 unicodeFFFE Unicode (Big-Endian) -1250 windows-1250 Central European (Windows) -1251 windows-1251 Cyrillic (Windows) -1252 Windows-1252 Western European (Windows) -1253 windows-1253 Greek (Windows) -1254 windows-1254 Turkish (Windows) -1255 windows-1255 Hebrew (Windows) -1256 windows-1256 Arabic (Windows) -1257 windows-1257 Baltic (Windows) -1258 windows-1258 Vietnamese (Windows) -1361 Johab Korean (Johab) -10000 macintosh Western European (Mac) -10001 x-mac-japanese Japanese (Mac) -10002 x-mac-chinesetrad Chinese Traditional (Mac) -10003 x-mac-korean Korean (Mac) -10004 x-mac-arabic Arabic (Mac) -10005 x-mac-hebrew Hebrew (Mac) -10006 x-mac-greek Greek (Mac) -10007 x-mac-cyrillic Cyrillic (Mac) -10008 x-mac-chinesesimp Chinese Simplified (Mac) -10010 x-mac-romanian Romanian (Mac) -10017 x-mac-ukrainian Ukrainian (Mac) -10021 x-mac-thai Thai (Mac) -10029 x-mac-ce Central European (Mac) -10079 x-mac-icelandic Icelandic (Mac) -10081 x-mac-turkish Turkish (Mac) -10082 x-mac-croatian Croatian (Mac) -12000 utf-32 Unicode (UTF-32) -12001 utf-32BE Unicode (UTF-32 Big-Endian) -20000 x-Chinese-CNS Chinese Traditional (CNS) -20001 x-cp20001 TCA Taiwan -20002 x-Chinese-Eten Chinese Traditional (Eten) -20003 x-cp20003 IBM5550 Taiwan -20004 x-cp20004 TeleText Taiwan -20005 x-cp20005 Wang Taiwan -20105 x-IA5 Western European (IA5) -20106 x-IA5-German German (IA5) -20107 x-IA5-Swedish Swedish (IA5) -20108 x-IA5-Norwegian Norwegian (IA5) -20127 us-ascii US-ASCII -20261 x-cp20261 T.61 -20269 x-cp20269 ISO-6937 -20273 IBM273 IBM EBCDIC (Germany) -20277 IBM277 IBM EBCDIC (Denmark-Norway) -20278 IBM278 IBM EBCDIC (Finland-Sweden) -20280 IBM280 IBM EBCDIC (Italy) -20284 IBM284 IBM EBCDIC (Spain) -20285 IBM285 IBM EBCDIC (UK) -20290 IBM290 IBM EBCDIC (Japanese katakana) -20297 IBM297 IBM EBCDIC (France) -20420 IBM420 IBM EBCDIC (Arabic) -20423 IBM423 IBM EBCDIC (Greek) -20424 IBM424 IBM EBCDIC (Hebrew) -20833 x-EBCDIC-KoreanExtended IBM EBCDIC (Korean Extended) -20838 IBM-Thai IBM EBCDIC (Thai) -20866 koi8-r Cyrillic (KOI8-R) -20871 IBM871 IBM EBCDIC (Icelandic) -20880 IBM880 IBM EBCDIC (Cyrillic Russian) -20905 IBM905 IBM EBCDIC (Turkish) -20924 IBM00924 IBM Latin-1 -20932 EUC-JP Japanese (JIS 0208-1990 and 0212-1990) -20936 x-cp20936 Chinese Simplified (GB2312-80) -20949 x-cp20949 Korean Wansung -21025 cp1025 IBM EBCDIC (Cyrillic Serbian-Bulgarian) -21866 koi8-u Cyrillic (KOI8-U) -28591 iso-8859-1 Western European (ISO) -28592 iso-8859-2 Central European (ISO) -28593 iso-8859-3 Latin 3 (ISO) -28594 iso-8859-4 Baltic (ISO) -28595 iso-8859-5 Cyrillic (ISO) -28596 iso-8859-6 Arabic (ISO) -28597 iso-8859-7 Greek (ISO) -28598 iso-8859-8 Hebrew (ISO-Visual) -28599 iso-8859-9 Turkish (ISO) -28603 iso-8859-13 Estonian (ISO) -28605 iso-8859-15 Latin 9 (ISO) -29001 x-Europa Europa -38598 iso-8859-8-i Hebrew (ISO-Logical) -50220 iso-2022-jp Japanese (JIS) -50221 csISO2022JP Japanese (JIS-Allow 1 byte Kana) -50222 iso-2022-jp Japanese (JIS-Allow 1 byte Kana - SO/SI) -50225 iso-2022-kr Korean (ISO) -50227 x-cp50227 Chinese Simplified (ISO-2022) -51932 euc-jp Japanese (EUC) -51936 EUC-CN Chinese Simplified (EUC) -51949 euc-kr Korean (EUC) -52936 hz-gb-2312 Chinese Simplified (HZ) -54936 GB18030 Chinese Simplified (GB18030) -57002 x-iscii-de ISCII Devanagari -57003 x-iscii-be ISCII Bengali -57004 x-iscii-ta ISCII Tamil -57005 x-iscii-te ISCII Telugu -57006 x-iscii-as ISCII Assamese -57007 x-iscii-or ISCII Oriya -57008 x-iscii-ka ISCII Kannada -57009 x-iscii-ma ISCII Malayalam -57010 x-iscii-gu ISCII Gujarati -57011 x-iscii-pa ISCII Punjabi -65000 utf-7 Unicode (UTF-7) -65001 utf-8 Unicode (UTF-8) - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp deleted file mode 100644 index b70e9f7092d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// This sample demonstrates how to use each member of the StringBuilder class. -// -using namespace System; -using namespace System::Text; - -ref class Constructors -{ -public: - static void Main() - { - ConstructorWithNothing(); - ConstructorWithCapacity(); - ConstructorWithString(); - ConstructorWithCapacityAndMax(); - ConstructorWithSubstring(); - ConstructorWithStringAndMax(); - - Console::Write( L"This sample completed successfully; " ); - Console::WriteLine( L"press Enter to exit." ); - Console::ReadLine(); - } - -private: - static void ConstructorWithNothing() - { - // Initialize a new StringBuilder object. - // - StringBuilder^ stringBuilder = gcnew StringBuilder; - // - } - - static void ConstructorWithCapacity() - { - // Initialize a new StringBuilder object with the specified capacity. - // - int capacity = 255; - StringBuilder^ stringBuilder = gcnew StringBuilder( capacity ); - // - } - - static void ConstructorWithString() - { - // Initialize a new StringBuilder object with the specified string. - // - String^ initialString = L"Initial string."; - StringBuilder^ stringBuilder = gcnew StringBuilder( initialString ); - // - } - - static void ConstructorWithCapacityAndMax() - { - // Initialize a new StringBuilder object with the specified capacity - // and maximum capacity. - // - int capacity = 255; - int maxCapacity = 1024; - StringBuilder^ stringBuilder = gcnew StringBuilder( capacity,maxCapacity ); - // - } - - static void ConstructorWithSubstring() - { - // Initialize a new StringBuilder object with the specified substring. - // - String^ initialString = L"Initial string for stringbuilder."; - int startIndex = 0; - int substringLength = 14; - int capacity = 255; - StringBuilder^ stringBuilder = gcnew StringBuilder( - initialString,startIndex,substringLength,capacity ); - // - } - - static void ConstructorWithStringAndMax() - { - // Initialize a new StringBuilder object with the specified string - // and maximum capacity. - // - String^ initialString = L"Initial string. "; - int capacity = 255; - StringBuilder^ stringBuilder = gcnew StringBuilder( - initialString,capacity ); - // - - // Ensure that appending the specified string will not exceed the - // maximum capacity of the object. - // - String^ phraseToAdd = L"Sentence to be appended."; - if ( (stringBuilder->Length + phraseToAdd->Length) <= - stringBuilder->MaxCapacity ) - { - stringBuilder->Append( phraseToAdd ); - } - // - - // Retrieve the string value of the StringBuilder object. - // - String^ builderResults = stringBuilder->ToString(); - // - - // Retrieve the last 10 characters of the StringBuilder object. - // - int sentenceLength = 10; - int startPosition = stringBuilder->Length - sentenceLength; - String^ endPhrase = stringBuilder->ToString( startPosition, - sentenceLength ); - // - - // Retrieve the last character of the StringBuilder object. - // - int lastCharacterPosition = stringBuilder->Length - 1; - char lastCharacter = static_cast( - stringBuilder->default[ lastCharacterPosition ] ); - // - } -}; - -int main() -{ - Constructors::Main(); -} - -// -// This sample produces the following output: -// -// This sample completed successfully; press Enter to exit. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp deleted file mode 100644 index 86fc73cb09c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// The following code example uses an encoder and a decoder to encode a string into an array of bytes, -// and then decode the bytes into an array of characters. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Get an encoder and a decoder from UTF32Encoding. - UTF32Encoding ^ u32 = gcnew UTF32Encoding( false,true,true ); - Encoder^ myEnc = u32->GetEncoder(); - Decoder^ myDec = u32->GetDecoder(); - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - array^myChars = gcnew array(5){ - L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2' - }; - Console::Write( "The original characters : " ); - Console::WriteLine( myChars ); - - // Encode the character array. - int iBC = myEnc->GetByteCount( myChars, 0, myChars.Length, true ); - array^myBytes = gcnew array(iBC); - myEnc->GetBytes( myChars, 0, myChars.Length, myBytes, 0, true ); - - // Print the resulting bytes. - Console::Write( "Using the encoder : " ); - for ( int i = 0; i < myBytes.Length; i++ ) - Console::Write( "{0:X2} ", myBytes[ i ] ); - Console::WriteLine(); - - // Decode the byte array back into an array of characters. - int iCC = myDec->GetCharCount( myBytes, 0, myBytes.Length, true ); - array^myDecodedChars = gcnew array(iCC); - myDec->GetChars( myBytes, 0, myBytes.Length, myDecodedChars, 0, true ); - - // Print the resulting characters. - Console::Write( "Using the decoder : " ); - Console::WriteLine( myDecodedChars ); -} - -/* -This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. - -The original characters : za?? -Using the encoder : 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 -Using the decoder : za?? - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp deleted file mode 100644 index a627b7388d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -// The following code example creates instances of the UTF32Encoding class using different parameter values and then checks them for equality. -// -using namespace System; -using namespace System::Text; -void CompareEncodings( UTF32Encoding ^ a, String^ name ); -int main() -{ - - // Create different instances of UTF32Encoding. - UTF32Encoding ^ u32 = gcnew UTF32Encoding; - UTF32Encoding ^ u32tt = gcnew UTF32Encoding( true,true ); - UTF32Encoding ^ u32tf = gcnew UTF32Encoding( true,false ); - UTF32Encoding ^ u32ft = gcnew UTF32Encoding( false,true ); - UTF32Encoding ^ u32ff = gcnew UTF32Encoding( false,false ); - - // Compare these instances with instances created using the ctor with three parameters. - CompareEncodings( u32, "u32 " ); - CompareEncodings( u32tt, "u32tt" ); - CompareEncodings( u32tf, "u32tf" ); - CompareEncodings( u32ft, "u32ft" ); - CompareEncodings( u32ff, "u32ff" ); -} - -void CompareEncodings( UTF32Encoding ^ a, String^ name ) -{ - - // Create different instances of UTF32Encoding using the ctor with three parameters. - UTF32Encoding ^ u32ttt = gcnew UTF32Encoding( true,true,true ); - UTF32Encoding ^ u32ttf = gcnew UTF32Encoding( true,true,false ); - UTF32Encoding ^ u32tft = gcnew UTF32Encoding( true,false,true ); - UTF32Encoding ^ u32tff = gcnew UTF32Encoding( true,false,false ); - UTF32Encoding ^ u32ftt = gcnew UTF32Encoding( false,true,true ); - UTF32Encoding ^ u32ftf = gcnew UTF32Encoding( false,true,false ); - UTF32Encoding ^ u32fft = gcnew UTF32Encoding( false,false,true ); - UTF32Encoding ^ u32fff = gcnew UTF32Encoding( false,false,false ); - - // Compare the specified instance with each of the instances that were just created. - Console::WriteLine( "{0} and u32ttt : {1}", name, a->Equals( u32ttt ) ); - Console::WriteLine( "{0} and u32ttf : {1}", name, a->Equals( u32ttf ) ); - Console::WriteLine( "{0} and u32tft : {1}", name, a->Equals( u32tft ) ); - Console::WriteLine( "{0} and u32tff : {1}", name, a->Equals( u32tff ) ); - Console::WriteLine( "{0} and u32ftt : {1}", name, a->Equals( u32ftt ) ); - Console::WriteLine( "{0} and u32ftf : {1}", name, a->Equals( u32ftf ) ); - Console::WriteLine( "{0} and u32fft : {1}", name, a->Equals( u32fft ) ); - Console::WriteLine( "{0} and u32fff : {1}", name, a->Equals( u32fff ) ); -} - -/* -This code produces the following output. - -u32 vs u32ttt : False -u32 vs u32ttf : False -u32 vs u32tft : False -u32 vs u32tff : False -u32 vs u32ftt : False -u32 vs u32ftf : False -u32 vs u32fft : False -u32 vs u32fff : True -u32tt vs u32ttt : False -u32tt vs u32ttf : True -u32tt vs u32tft : False -u32tt vs u32tff : False -u32tt vs u32ftt : False -u32tt vs u32ftf : False -u32tt vs u32fft : False -u32tt vs u32fff : False -u32tf vs u32ttt : False -u32tf vs u32ttf : False -u32tf vs u32tft : False -u32tf vs u32tff : True -u32tf vs u32ftt : False -u32tf vs u32ftf : False -u32tf vs u32fft : False -u32tf vs u32fff : False -u32ft vs u32ttt : False -u32ft vs u32ttf : False -u32ft vs u32tft : False -u32ft vs u32tff : False -u32ft vs u32ftt : False -u32ft vs u32ftf : True -u32ft vs u32fft : False -u32ft vs u32fff : False -u32ff vs u32ttt : False -u32ff vs u32ttf : False -u32ff vs u32tft : False -u32ff vs u32tff : False -u32ff vs u32ftt : False -u32ff vs u32ftf : False -u32ff vs u32fft : False -u32ff vs u32fff : True - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp deleted file mode 100644 index c1436193d7b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp +++ /dev/null @@ -1,70 +0,0 @@ - -// The following code example demonstrates the behavior of UTF32Encoding with error detection enabled and without. -// -using namespace System; -using namespace System::Text; -void PrintDecodedString( array^bytes, Encoding^ enc ); -int main() -{ - - // Create an instance of UTF32Encoding using little-endian byte order. - // This will be used for encoding. - UTF32Encoding^ u32LE = gcnew UTF32Encoding( false,true ); - - // Create two instances of UTF32Encoding using big-endian byte order: one with error detection and one without. - // These will be used for decoding. - UTF32Encoding^ u32withED = gcnew UTF32Encoding( true,true,true ); - UTF32Encoding^ u32noED = gcnew UTF32Encoding( true,true,false ); - - // Create byte arrays from the same string containing the following characters: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; - - // Encode the string using little-endian byte order. - array^myBytes = gcnew array(u32LE->GetByteCount( myStr )); - u32LE->GetBytes( myStr, 0, myStr->Length, myBytes, 0 ); - - // Decode the byte array with error detection. - Console::WriteLine( "Decoding with error detection:" ); - PrintDecodedString( myBytes, u32withED ); - - // Decode the byte array without error detection. - Console::WriteLine( "Decoding without error detection:" ); - PrintDecodedString( myBytes, u32noED ); -} - - -// Decode the bytes and display the string. -void PrintDecodedString( array^bytes, Encoding^ enc ) -{ - try - { - Console::WriteLine( " Decoded string: {0}", enc->GetString( bytes, 0, bytes->Length ) ); - } - catch ( System::ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - Console::WriteLine(); -} - -// -/* -This code produces the following output. - -Decoding with error detection: -System.ArgumentException: Invalid byte was found at byte index 3. - at System.Text.UTF32Encoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder) - at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding) - at System.Text.UTF32Encoding.GetString(Byte[] bytes, Int32 index, Int32 count) - at SamplesUTF32Encoding.PrintDecodedString(Byte[] bytes, Encoding enc) - -Decoding without error detection: - Decoded string: - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp deleted file mode 100644 index 019b60c8871..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp +++ /dev/null @@ -1,87 +0,0 @@ - -// The following code example determines the number of bytes required to encode three characters from a character array, -// then encodes the characters and displays the resulting bytes. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ); -void PrintHexBytes( array^bytes ); -int main() -{ - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - // a high-surrogate value (U+D8FF) - // a low-surrogate value (U+DCFF) - array^myChars = gcnew array(7){ - L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF' - }; - - // Create instances of different encodings. - UTF7Encoding^ u7 = gcnew UTF7Encoding; - UTF8Encoding^ u8Nobom = gcnew UTF8Encoding( false,true ); - UTF8Encoding^ u8Bom = gcnew UTF8Encoding( true,true ); - UTF32Encoding ^ u32Nobom = gcnew UTF32Encoding( false,false,true ); - UTF32Encoding ^ u32Bom = gcnew UTF32Encoding( false,true,true ); - - // Encode three characters starting at index 4 and print out the counts and the resulting bytes. - PrintCountsAndBytes( myChars, 4, 3, u7 ); - PrintCountsAndBytes( myChars, 4, 3, u8Nobom ); - PrintCountsAndBytes( myChars, 4, 3, u8Bom ); - PrintCountsAndBytes( myChars, 4, 3, u32Nobom ); - PrintCountsAndBytes( myChars, 4, 3, u32Bom ); -} - -void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-25} :", enc ); - - // Display the exact byte count. - int iBC = enc->GetByteCount( chars, index, count ); - Console::Write( " {0,-3}", iBC ); - - // Display the maximum byte count. - int iMBC = enc->GetMaxByteCount( count ); - Console::Write( " {0,-3} :", iMBC ); - - // Get the byte order mark, if any. - array^preamble = enc->GetPreamble(); - - // Combine the preamble and the encoded bytes. - array^bytes = gcnew array(preamble->Length + iBC); - Array::Copy( preamble, bytes, preamble->Length ); - enc->GetBytes( chars, index, count, bytes, preamble->Length ); - - // Display all the encoded bytes. - PrintHexBytes( bytes ); -} - -void PrintHexBytes( array^bytes ) -{ - if ( (bytes == nullptr) || (bytes->Length == 0) ) - Console::WriteLine( "" ); - else - { - for ( int i = 0; i < bytes->Length; i++ ) - Console::Write( "{0:X2} ", bytes[ i ] ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D -System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF -System.Text.UTF8Encoding : 6 12 :EF BB BF CE B2 F1 8F B3 BF -System.Text.UTF32Encoding : 8 12 :B2 03 00 00 FF FC 04 00 -System.Text.UTF32Encoding : 8 12 :FF FE 00 00 B2 03 00 00 FF FC 04 00 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp deleted file mode 100644 index d554ef4eb8b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp +++ /dev/null @@ -1,85 +0,0 @@ - -// The following code example determines the number of bytes required to encode a string, -// then encodes the string and displays the resulting bytes. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndBytes( String^ s, Encoding^ enc ); -void PrintHexBytes( array^bytes ); -int main() -{ - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - // a high-surrogate value (U+D8FF) - // a low-surrogate value (U+DCFF) - String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; - - // Create instances of different encodings. - UTF7Encoding^ u7 = gcnew UTF7Encoding; - UTF8Encoding^ u8Nobom = gcnew UTF8Encoding( false,true ); - UTF8Encoding^ u8Bom = gcnew UTF8Encoding( true,true ); - UTF32Encoding ^ u32Nobom = gcnew UTF32Encoding( false,false,true ); - UTF32Encoding ^ u32Bom = gcnew UTF32Encoding( false,true,true ); - - // Get the byte counts and the bytes. - PrintCountsAndBytes( myStr, u7 ); - PrintCountsAndBytes( myStr, u8Nobom ); - PrintCountsAndBytes( myStr, u8Bom ); - PrintCountsAndBytes( myStr, u32Nobom ); - PrintCountsAndBytes( myStr, u32Bom ); -} - -void PrintCountsAndBytes( String^ s, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-25} :", enc ); - - // Display the exact byte count. - int iBC = enc->GetByteCount( s ); - Console::Write( " {0,-3}", iBC ); - - // Display the maximum byte count. - int iMBC = enc->GetMaxByteCount( s->Length ); - Console::Write( " {0,-3} :", iMBC ); - - // Get the byte order mark, if any. - array^preamble = enc->GetPreamble(); - - // Combine the preamble and the encoded bytes. - array^bytes = gcnew array(preamble->Length + iBC); - Array::Copy( preamble, bytes, preamble->Length ); - enc->GetBytes( s, 0, s->Length, bytes, preamble->Length ); - - // Display all the encoded bytes. - PrintHexBytes( bytes ); -} - -void PrintHexBytes( array^bytes ) -{ - if ( (bytes == nullptr) || (bytes->Length == 0) ) - Console::WriteLine( "" ); - else - { - for ( int i = 0; i < bytes->Length; i++ ) - Console::Write( "{0:X2} ", bytes[ i ] ); - Console::WriteLine(); - } -} - -/* -This code produces the following output. - -System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D -System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF -System.Text.UTF8Encoding : 12 24 :EF BB BF 7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF -System.Text.UTF32Encoding : 24 28 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 -System.Text.UTF32Encoding : 24 28 :FF FE 00 00 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp deleted file mode 100644 index beeadd8f48b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// The following code example encodes a string into an array of bytes, and then decodes the bytes into an array of characters. -// -using namespace System; -using namespace System::Text; -void PrintCountsAndChars( array^bytes, Encoding^ enc ); -int main() -{ - - // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order. - UTF32Encoding^ u32LE = gcnew UTF32Encoding( false,true,true ); - UTF32Encoding^ u32BE = gcnew UTF32Encoding( true,true,true ); - - // Create byte arrays from the same string containing the following characters: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; - - // barrBE uses the big-endian byte order. - array^barrBE = gcnew array(u32BE->GetByteCount( myStr )); - u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 ); - - // barrLE uses the little-endian byte order. - array^barrLE = gcnew array(u32LE->GetByteCount( myStr )); - u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 ); - - // Get the char counts and decode the byte arrays. - Console::Write( "BE array with BE encoding : " ); - PrintCountsAndChars( barrBE, u32BE ); - Console::Write( "LE array with LE encoding : " ); - PrintCountsAndChars( barrLE, u32LE ); - - // Decode the byte arrays using an encoding with a different byte order. - Console::Write( "BE array with LE encoding : " ); - try - { - PrintCountsAndChars( barrBE, u32LE ); - } - catch ( System::ArgumentException^ e ) - { - Console::WriteLine( e->Message ); - } - - Console::Write( "LE array with BE encoding : " ); - try - { - PrintCountsAndChars( barrLE, u32BE ); - } - catch ( System::ArgumentException^ e ) - { - Console::WriteLine( e->Message ); - } - -} - -void PrintCountsAndChars( array^bytes, Encoding^ enc ) -{ - - // Display the name of the encoding used. - Console::Write( "{0,-25} :", enc ); - - // Display the exact character count. - int iCC = enc->GetCharCount( bytes ); - Console::Write( " {0,-3}", iCC ); - - // Display the maximum character count. - int iMCC = enc->GetMaxCharCount( bytes->Length ); - Console::Write( " {0,-3} :", iMCC ); - - // Decode the bytes and display the characters. - array^chars = gcnew array(iCC); - enc->GetChars( bytes, 0, bytes->Length, chars, 0 ); - Console::WriteLine( chars ); -} - -/* -This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. - -BE array with BE encoding : System.Text.UTF32Encoding : 7 14 :za??ß? -LE array with LE encoding : System.Text.UTF32Encoding : 7 14 :za??ß? -BE array with LE encoding : System.Text.UTF32Encoding :Invalid byte was found at byte index 3. -LE array with BE encoding : System.Text.UTF32Encoding :Invalid byte was found at byte index 3. - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp deleted file mode 100644 index 9d05673135c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// The following code example retrieves and displays the byte order mark for different UTF32Encoding instances. -// -using namespace System; -using namespace System::Text; - -void PrintHexBytes( array^bytes ); - -int main() -{ - - // Create instances of UTF32Encoding, with the byte order mark and without. - UTF32Encoding ^ u32LeNone = gcnew UTF32Encoding; - UTF32Encoding ^ u32BeNone = gcnew UTF32Encoding( true,false ); - UTF32Encoding ^ u32LeBom = gcnew UTF32Encoding( false,true ); - UTF32Encoding ^ u32BeBom = gcnew UTF32Encoding( true,true ); - - // Display the preamble for each instance. - PrintHexBytes( u32LeNone->GetPreamble() ); - PrintHexBytes( u32BeNone->GetPreamble() ); - PrintHexBytes( u32LeBom->GetPreamble() ); - PrintHexBytes( u32BeBom->GetPreamble() ); -} - -void PrintHexBytes( array^bytes ) -{ - if ( (bytes == nullptr) || (bytes->Length == 0) ) - Console::WriteLine( "" ); - else - { - for ( int i = 0; i < bytes->Length; i++ ) - Console::Write( "{0:X2} ", bytes[ i ] ); - Console::WriteLine(); - } -} - -/* -This example displays the following output: - FF FE 00 00 - - FF FE 00 00 - 00 00 FE FF -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp deleted file mode 100644 index c84f8ce2a84..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - - // Create a UTF-7 encoding. - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - - // A Unicode string with two characters outside a 7-bit code range. - String^ unicodeString = L"This Unicode string contains two characters with codes outside a 7-bit code range, Pi (\u03a0) and Sigma (\u03a3)."; - Console::WriteLine( "Original string:" ); - Console::WriteLine( unicodeString ); - - // Encode the string. - array^encodedBytes = utf7->GetBytes( unicodeString ); - Console::WriteLine(); - Console::WriteLine( "Encoded bytes:" ); - IEnumerator^ myEnum = encodedBytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); - - // Decode bytes back to string. - // Notice Pi and Sigma characters are still present. - String^ decodedString = utf7->GetString( encodedBytes ); - Console::WriteLine(); - Console::WriteLine( "Decoded bytes:" ); - Console::WriteLine( decodedString ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp deleted file mode 100644 index ddc015fa0f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - int byteCount = utf7->GetByteCount( chars, 1, 2 ); - Console::WriteLine( "{0} bytes needed to encode characters.", byteCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp deleted file mode 100644 index 97b50574c01..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - int byteCount = utf7->GetByteCount( chars, 1, 2 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = utf7->GetBytes( chars, 1, 2, bytes, 0 ); - Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp deleted file mode 100644 index b5e8fc2023a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {85,84,70,55,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - int charCount = utf7->GetCharCount( bytes, 2, 8 ); - chars = gcnew array(charCount); - int charsDecodedCount = utf7->GetChars( bytes, 2, 8, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp deleted file mode 100644 index 7fb0ea443fe..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {99,43,65,119,67,103,111,65,45}; - Decoder^ utf7Decoder = Encoding::UTF7->GetDecoder(); - int charCount = utf7Decoder->GetCharCount( bytes, 0, bytes->Length ); - chars = gcnew array(charCount); - int charsDecodedCount = utf7Decoder->GetChars( bytes, 0, bytes->Length, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp deleted file mode 100644 index 60c28256953..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars = {'a','b','c',L'\u0300',L'\ua0a0'}; - array^bytes; - Encoder^ utf7Encoder = Encoding::UTF7->GetEncoder(); - int byteCount = utf7Encoder->GetByteCount( chars, 2, 3, true ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = utf7Encoder->GetBytes( chars, 2, 3, bytes, 0, true ); - Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp deleted file mode 100644 index e368c581615..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - int charCount = 2; - int maxByteCount = utf7->GetMaxByteCount( charCount ); - Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp deleted file mode 100644 index e11609a9b4f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - int byteCount = 8; - int maxCharCount = utf7->GetMaxCharCount( byteCount ); - Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp deleted file mode 100644 index 3474715e028..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - String^ encodingName = utf7->EncodingName; - Console::WriteLine( "Encoding name: {0}", encodingName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp deleted file mode 100644 index 0af6372132d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -void ShowArray( Array^ theArray ) -{ - IEnumerator^ myEnum = theArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::Write( "[{0}]", o ); - } - - Console::WriteLine(); -} - -int main() -{ - - // A few optional characters. - String^ chars = "!@#$"; - - // The default Encoding does not allow optional characters. - // Alternate Byte values are used. - UTF7Encoding^ utf7 = gcnew UTF7Encoding; - array^bytes1 = utf7->GetBytes( chars ); - Console::WriteLine( "Default UTF7 Encoding:" ); - ShowArray( bytes1 ); - - // Convert back to characters. - Console::WriteLine( "Characters:" ); - ShowArray( utf7->GetChars( bytes1 ) ); - - // Now, allow optional characters. - // Optional characters are encoded with their normal code points. - UTF7Encoding^ utf7AllowOptionals = gcnew UTF7Encoding( true ); - array^bytes2 = utf7AllowOptionals->GetBytes( chars ); - Console::WriteLine( "UTF7 Encoding with optional characters allowed:" ); - ShowArray( bytes2 ); - - // Convert back to characters. - Console::WriteLine( "Characters:" ); - ShowArray( utf7AllowOptionals->GetChars( bytes2 ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp deleted file mode 100644 index 0f2e71a46f4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// The following code example encodes a string into an array of bytes, and then decodes the bytes back into a string. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Create an instance of UTF7Encoding. - UTF7Encoding^ u7 = gcnew UTF7Encoding( true ); - - // Create byte arrays from the same string containing the following characters: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - String^ myStr = "za\u0306\u01FD\u03B2"; - - // Encode the string. - array^myBArr = gcnew array(u7->GetByteCount( myStr )); - u7->GetBytes( myStr, 0, myStr->Length, myBArr, 0 ); - - // Decode the byte array. - Console::WriteLine( "The new string is: {0}", u7->GetString( myBArr, 0, myBArr->Length ) ); -} - -/* -This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. - -The new string is: za?? - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp deleted file mode 100644 index 207ede33c02..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -//using namespace System::Collections; - -int main() -{ - // Create a UTF-8 encoding. - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - - // A Unicode string with two characters outside an 8-bit code range. - String^ unicodeString = L"This Unicode string has 2 characters " + - L"outside the ASCII range:\n" + - L"Pi (\u03a0), and Sigma (\u03a3)."; - Console::WriteLine("Original string:"); - Console::WriteLine(unicodeString); - - // Encode the string. - array^ encodedBytes = utf8->GetBytes(unicodeString ); - Console::WriteLine(); - Console::WriteLine("Encoded bytes:"); - for (int ctr = 0; ctr < encodedBytes->Length; ctr++) { - Console::Write( "{0:X2} ", encodedBytes[ctr]); - if ((ctr + 1) % 25 == 0) - Console::WriteLine(); - } - - Console::WriteLine(); - - // Decode bytes back to string. - String^ decodedString = utf8->GetString(encodedBytes); - Console::WriteLine(); - Console::WriteLine("Decoded bytes:"); - Console::WriteLine(decodedString); -} -// The example displays the following output: -// Original string: -// This Unicode string has 2 characters outside the ASCII range: -// Pi (Ï€), and Sigma (Σ). -// -// Encoded bytes: -// 54 68 69 73 20 55 6E 69 63 6F 64 65 20 73 74 72 69 6E 67 20 68 61 73 20 32 -// 20 63 68 61 72 61 63 74 65 72 73 20 6F 75 74 73 69 64 65 20 74 68 65 20 41 -// 53 43 49 49 20 72 61 6E 67 65 3A 20 0D 0A 50 69 20 28 CE A0 29 2C 20 61 6E -// 64 20 53 69 67 6D 61 20 28 CE A3 29 2E -// -// Decoded bytes: -// This Unicode string has 2 characters outside the ASCII range: -// Pi (Ï€), and Sigma (Σ). -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp deleted file mode 100644 index 5e6ae2e299e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -void DescribeEquivalence( Boolean isEquivalent ) -{ - Console::WriteLine( "{0} equivalent encoding.", (isEquivalent ? (String^)"An" : "Not an") ); -} - -int main() -{ - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - UTF8Encoding^ utf8true = gcnew UTF8Encoding( true ); - UTF8Encoding^ utf8truetrue = gcnew UTF8Encoding( true,true ); - UTF8Encoding^ utf8falsetrue = gcnew UTF8Encoding( false,true ); - DescribeEquivalence( utf8->Equals( utf8 ) ); - DescribeEquivalence( utf8->Equals( utf8true ) ); - DescribeEquivalence( utf8->Equals( utf8truetrue ) ); - DescribeEquivalence( utf8->Equals( utf8falsetrue ) ); - DescribeEquivalence( utf8true->Equals( utf8 ) ); - DescribeEquivalence( utf8true->Equals( utf8true ) ); - DescribeEquivalence( utf8true->Equals( utf8truetrue ) ); - DescribeEquivalence( utf8true->Equals( utf8falsetrue ) ); - DescribeEquivalence( utf8truetrue->Equals( utf8 ) ); - DescribeEquivalence( utf8truetrue->Equals( utf8true ) ); - DescribeEquivalence( utf8truetrue->Equals( utf8truetrue ) ); - DescribeEquivalence( utf8truetrue->Equals( utf8falsetrue ) ); - DescribeEquivalence( utf8falsetrue->Equals( utf8 ) ); - DescribeEquivalence( utf8falsetrue->Equals( utf8true ) ); - DescribeEquivalence( utf8falsetrue->Equals( utf8truetrue ) ); - DescribeEquivalence( utf8falsetrue->Equals( utf8falsetrue ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp deleted file mode 100644 index 5adc3b4928a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - int byteCount = utf8->GetByteCount( chars, 1, 2 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = utf8->GetBytes( chars, 1, 2, bytes, 0 ); - Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp deleted file mode 100644 index e89bbb84c9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - String^ chars = "UTF8 Encoding Example"; - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - int byteCount = utf8->GetByteCount( chars->ToCharArray(), 0, 13 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = utf8->GetBytes( chars, 0, 13, bytes, 0 ); - Console::WriteLine( "{0} bytes used to encode string.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp deleted file mode 100644 index 7456dd1e21a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - array^bytes = {85,84,70,56,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - int charCount = utf8->GetCharCount( bytes, 2, 8 ); - Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp deleted file mode 100644 index 6d629f2db9b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {85,84,70,56,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - int charCount = utf8->GetCharCount( bytes, 2, 13 ); - chars = gcnew array(charCount); - int charsDecodedCount = utf8->GetChars( bytes, 2, 13, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp deleted file mode 100644 index 3e5900dd0e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {99,204,128,234,130,160}; - Decoder^ utf8Decoder = Encoding::UTF8->GetDecoder(); - int charCount = utf8Decoder->GetCharCount( bytes, 0, bytes->Length ); - chars = gcnew array(charCount); - int charsDecodedCount = utf8Decoder->GetChars( bytes, 0, bytes->Length, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp deleted file mode 100644 index 2969f330f96..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars = {'a','b','c',L'\u0300',L'\ua0a0'}; - array^bytes; - Encoder^ utf8Encoder = Encoding::UTF8->GetEncoder(); - int byteCount = utf8Encoder->GetByteCount( chars, 2, 3, true ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = utf8Encoder->GetBytes( chars, 2, 3, bytes, 0, true ); - Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp deleted file mode 100644 index 00934592f35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Many ways to instantiate a UTF8 encoding. - UTF8Encoding^ UTF8a = gcnew UTF8Encoding; - Encoding^ UTF8b = Encoding::UTF8; - Encoding^ UTF8c = gcnew UTF8Encoding( true,true ); - Encoding^ UTF8d = gcnew UTF8Encoding( false,false ); - - // But not all are the same. - Console::WriteLine( UTF8a->GetHashCode() ); - Console::WriteLine( UTF8b->GetHashCode() ); - Console::WriteLine( UTF8c->GetHashCode() ); - Console::WriteLine( UTF8d->GetHashCode() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp deleted file mode 100644 index eaf84b21006..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - int charCount = 2; - int maxByteCount = utf8->GetMaxByteCount( charCount ); - Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp deleted file mode 100644 index 624c31a8ccf..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - int byteCount = 8; - int maxCharCount = utf8->GetMaxCharCount( byteCount ); - Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp deleted file mode 100644 index 8bc22343a5c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; - -void ShowArray(array^ bytes) -{ - for each (Byte b in bytes) - Console::Write( "{0:X2} ", b); - - Console::WriteLine(); -} - -int main() -{ - // The default constructor does not provide a preamble. - UTF8Encoding^ UTF8NoPreamble = gcnew UTF8Encoding; - UTF8Encoding^ UTF8WithPreamble = gcnew UTF8Encoding( true ); - array^preamble; - preamble = UTF8NoPreamble->GetPreamble(); - Console::WriteLine( "UTF8NoPreamble" ); - Console::WriteLine( " preamble length: {0}", preamble->Length ); - Console::Write( " preamble: " ); - ShowArray( preamble ); - Console::WriteLine(); - - preamble = UTF8WithPreamble->GetPreamble(); - Console::WriteLine( "UTF8WithPreamble" ); - Console::WriteLine( " preamble length: {0}", preamble->Length ); - Console::Write( " preamble: " ); - ShowArray( preamble ); -} -// The example displays the following output: -// UTF8NoPreamble -// preamble length: 0 -// preamble: -// -// UTF8WithPreamble -// preamble length: 3 -// preamble: EF BB BF -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp deleted file mode 100644 index 862c4ca0aec..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - String^ encodingName = utf8->EncodingName; - Console::WriteLine( "Encoding name: {0}", encodingName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp deleted file mode 100644 index 0dafbdef102..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -void ShowArray( Array^ theArray ) -{ - IEnumerator^ myEnum = theArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::Write( "[{0}]", o ); - } - - Console::WriteLine(); -} - -int main() -{ - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - UTF8Encoding^ utf8EmitBOM = gcnew UTF8Encoding( true ); - Console::WriteLine( "utf8 preamble:" ); - ShowArray( utf8->GetPreamble() ); - Console::WriteLine( "utf8EmitBOM:" ); - ShowArray( utf8EmitBOM->GetPreamble() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp deleted file mode 100644 index 9f6b9081759..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -// -using namespace System; -using namespace System::Text; - -void ShowArray(Array^ theArray) -{ - for each (Byte b in theArray) { - Console::Write( "{0:X2} ", b); - } - Console::WriteLine(); -} - -int main() -{ - UTF8Encoding^ utf8 = gcnew UTF8Encoding; - UTF8Encoding^ utf8ThrowException = gcnew UTF8Encoding(false,true); - - // This array contains two high surrogates in a row (\uD801, \uD802). - array^chars = {'a','b','c',L'\xD801',L'\xD802','d'}; - - // The following method call will not throw an exception. - array^bytes = utf8->GetBytes( chars ); - ShowArray( bytes ); - Console::WriteLine(); - - try { - - // The following method call will throw an exception. - bytes = utf8ThrowException->GetBytes( chars ); - } - catch (EncoderFallbackException^ e ) { - Console::WriteLine("{0} exception\nMessage:\n{1}", - e->GetType()->Name, e->Message); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp deleted file mode 100644 index c498942c8f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - - // The encoding. - UnicodeEncoding^ unicode = gcnew UnicodeEncoding; - - // Create a String* that contains Unicode characters. - String^ unicodeString = L"This Unicode string contains two characters with codes outside the traditional ASCII code range, Pi (\u03a0) and Sigma (\u03a3)."; - Console::WriteLine( "Original string:" ); - Console::WriteLine( unicodeString ); - - // Encode the String*. - array^encodedBytes = unicode->GetBytes( unicodeString ); - Console::WriteLine(); - Console::WriteLine( "Encoded bytes:" ); - IEnumerator^ myEnum = encodedBytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); - - // Decode bytes back to String*. - // Notice Pi and Sigma characters are still present. - String^ decodedString = unicode->GetString( encodedBytes ); - Console::WriteLine(); - Console::WriteLine( "Decoded bytes:" ); - Console::WriteLine( decodedString ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp deleted file mode 100644 index 39d50f0b408..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp +++ /dev/null @@ -1,10 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - Console::WriteLine( "Unicode character size: {0} bytes", UnicodeEncoding::CharSize ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp deleted file mode 100644 index 7f46e6d47b0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// The following code example uses an encoder and a decoder to encode a string into an array of bytes, -// and then decode the bytes into an array of characters. -// -using namespace System; -using namespace System::Text; -int main() -{ - - // Get an encoder and a decoder from UnicodeEncoding. - UnicodeEncoding^ u16 = gcnew UnicodeEncoding( false,true,true ); - Encoder^ myEnc = u16->GetEncoder(); - Decoder^ myDec = u16->GetDecoder(); - - // The characters to encode: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - array^myChars = gcnew array(5){ - L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2' - }; - Console::Write( "The original characters : " ); - Console::WriteLine( myChars ); - - // Encode the character array. - int iBC = myEnc->GetByteCount( myChars, 0, myChars->Length, true ); - array^myBytes = gcnew array(iBC); - myEnc->GetBytes( myChars, 0, myChars->Length, myBytes, 0, true ); - - // Print the resulting bytes. - Console::Write( "Using the encoder : " ); - for ( int i = 0; i < myBytes->Length; i++ ) - Console::Write( "{0:X2} ", myBytes[ i ] ); - Console::WriteLine(); - - // Decode the byte array back into an array of characters. - int iCC = myDec->GetCharCount( myBytes, 0, myBytes->Length, true ); - array^myDecodedChars = gcnew array(iCC); - myDec->GetChars( myBytes, 0, myBytes->Length, myDecodedChars, 0, true ); - - // Print the resulting characters. - Console::Write( "Using the decoder : " ); - Console::WriteLine( myDecodedChars ); -} - -/* -This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. - -The original characters : za??ß -Using the encoder : 7A 00 61 00 06 03 FD 01 B2 03 -Using the decoder : za??ß - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp deleted file mode 100644 index de042ae169e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// The following code example demonstrates the behavior of UnicodeEncoding with error detection enabled and without. -// -using namespace System; -using namespace System::Text; -void PrintDecodedString( array^bytes, Encoding^ enc ); -int main() -{ - - // Create an instance of UnicodeEncoding using little-endian byte order. - // This will be used for encoding. - UnicodeEncoding^ u16LE = gcnew UnicodeEncoding( false,true ); - - // Create two instances of UnicodeEncoding using big-endian byte order: one with error detection and one without. - // These will be used for decoding. - UnicodeEncoding^ u16withED = gcnew UnicodeEncoding( true,true,true ); - UnicodeEncoding^ u16noED = gcnew UnicodeEncoding( true,true,false ); - - // Create byte arrays from the same string containing the following characters: - // Latin Small Letter Z (U+007A) - // Latin Small Letter A (U+0061) - // Combining Breve (U+0306) - // Latin Small Letter AE With Acute (U+01FD) - // Greek Small Letter Beta (U+03B2) - // Latin Capital Letter U with Diaeresis (U+00DC) - String^ myStr = "za\u0306\u01FD\u03B2\u00DC"; - - // Encode the string using little-endian byte order. - array^myBytes = gcnew array(u16LE->GetByteCount( myStr )); - u16LE->GetBytes( myStr, 0, myStr->Length, myBytes, 0 ); - - // Decode the byte array with error detection. - Console::WriteLine( "Decoding with error detection:" ); - PrintDecodedString( myBytes, u16withED ); - - // Decode the byte array without error detection. - Console::WriteLine( "Decoding without error detection:" ); - PrintDecodedString( myBytes, u16noED ); -} - - -// Decode the bytes and display the string. -void PrintDecodedString( array^bytes, Encoding^ enc ) -{ - try - { - Console::WriteLine( " Decoded string: {0}", enc->GetString( bytes, 0, bytes->Length ) ); - } - catch ( System::ArgumentException^ e ) - { - Console::WriteLine( e ); - } - - Console::WriteLine(); -} - -// -/* BUGBUG: Reproduce this output in retail build, then add to the snippet. -This code produces the following output. - -Decoding with error detection: -System.ArgumentException: Invalid byte was found at byte index 3. - at System.Text.UnicodeEncoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder) - at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding) - at System.Text.UnicodeEncoding.GetString(Byte[] bytes, Int32 index, Int32 count) - at SamplesUnicodeEncoding.PrintDecodedString(Byte[] bytes, Encoding enc) - -Decoding without error detection: - Decoded string: - -*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp deleted file mode 100644 index bbefc038187..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,31 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - - // Unicode characters. - - // Pi - // Sigma - array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; - UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; - int byteCount = Unicode->GetByteCount( chars, 1, 2 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = Unicode->GetBytes( chars, 1, 2, bytes, 0 ); - Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp deleted file mode 100644 index 25dee60bee6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^bytes; - String^ chars = "Unicode Encoding Example"; - UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; - int byteCount = Unicode->GetByteCount( chars->ToCharArray(), 8, 8 ); - bytes = gcnew array(byteCount); - int bytesEncodedCount = Unicode->GetBytes( chars, 8, 8, bytes, 0 ); - Console::WriteLine( "{0} bytes used to encode string.", bytesEncodedCount ); - Console::Write( "Encoded bytes: " ); - IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp deleted file mode 100644 index 0925c759295..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; - UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; - int charCount = Unicode->GetCharCount( bytes, 2, 8 ); - Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp deleted file mode 100644 index e68162a021c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^chars; - array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; - UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; - int charCount = Unicode->GetCharCount( bytes, 2, 8 ); - chars = gcnew array(charCount); - int charsDecodedCount = Unicode->GetChars( bytes, 2, 8, chars, 0 ); - Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); - Console::Write( "Decoded chars: " ); - IEnumerator^ myEnum = chars->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Char c = safe_cast(myEnum->Current); - Console::Write( "[{0}]", c.ToString() ); - } - - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp deleted file mode 100644 index 08545fa0a5e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; - int charCount = 2; - int maxByteCount = Unicode->GetMaxByteCount( charCount ); - Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp deleted file mode 100644 index c956533d9a8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp +++ /dev/null @@ -1,13 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; - int byteCount = 8; - int maxCharCount = Unicode->GetMaxCharCount( byteCount ); - Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp deleted file mode 100644 index b2e176ae267..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp +++ /dev/null @@ -1,30 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -using namespace System::Collections; -int main() -{ - array^byteOrderMark; - byteOrderMark = Encoding::Unicode->GetPreamble(); - Console::WriteLine( "Default (little-endian) Unicode Preamble:" ); - IEnumerator^ myEnum = byteOrderMark->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } - - Console::WriteLine( "\n" ); - UnicodeEncoding^ bigEndianUnicode = gcnew UnicodeEncoding( true,true ); - byteOrderMark = bigEndianUnicode->GetPreamble(); - Console::WriteLine( "Big-endian Unicode Preamble:" ); - myEnum = byteOrderMark->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( "[{0}]", b ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp deleted file mode 100644 index 13dd01a98bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -int main() -{ - UnicodeEncoding^ unicode = gcnew UnicodeEncoding; - String^ encodingName = unicode->EncodingName; - Console::WriteLine( "Encoding name: {0}", encodingName ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp deleted file mode 100644 index e295b687fdd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Text; -void DescribeEquivalence( Boolean isEquivalent ) -{ - Console::WriteLine( " {0} equivalent encoding.", (isEquivalent ? (String^)"An" : "Not an") ); -} - -int main() -{ - - // Create a UnicodeEncoding without parameters. - UnicodeEncoding^ unicode = gcnew UnicodeEncoding; - - // Create a UnicodeEncoding to support little-endian Byte ordering - // and include the Unicode Byte order mark. - UnicodeEncoding^ unicodeLittleEndianBOM = gcnew UnicodeEncoding( false,true ); - - // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. - DescribeEquivalence( unicode->Equals( unicodeLittleEndianBOM ) ); - - // Create a UnicodeEncoding to support little-endian Byte ordering - // and not include the Unicode Byte order mark. - UnicodeEncoding^ unicodeLittleEndianNoBOM = gcnew UnicodeEncoding( false,false ); - - // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. - DescribeEquivalence( unicode->Equals( unicodeLittleEndianNoBOM ) ); - - // Create a UnicodeEncoding to support big-endian Byte ordering - // and include the Unicode Byte order mark. - UnicodeEncoding^ unicodeBigEndianBOM = gcnew UnicodeEncoding( true,true ); - - // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. - DescribeEquivalence( unicode->Equals( unicodeBigEndianBOM ) ); - - // Create a UnicodeEncoding to support big-endian Byte ordering - // and not include the Unicode Byte order mark. - UnicodeEncoding^ unicodeBigEndianNoBOM = gcnew UnicodeEncoding( true,false ); - - // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. - DescribeEquivalence( unicode->Equals( unicodeBigEndianNoBOM ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp deleted file mode 100644 index ea0fa55c83a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -namespace SystemThreadingExample -{ - public ref class Example - { - private: - static ManualResetEvent^ dummyEvent = - gcnew ManualResetEvent(false); - - static Mutex^ orphanMutex1 = gcnew Mutex; - static Mutex^ orphanMutex2 = gcnew Mutex; - static Mutex^ orphanMutex3 = gcnew Mutex; - static Mutex^ orphanMutex4 = gcnew Mutex; - static Mutex^ orphanMutex5 = gcnew Mutex; - - public: - static void ProduceAbandonMutexException(void) - { - - // Start a thread that grabs all five mutexes, and then - // abandons them. - Thread^ abandonThread = - gcnew Thread(gcnew ThreadStart(AbandonMutex)); - - abandonThread->Start(); - - // Make sure the thread is finished. - abandonThread->Join(); - - // Wait on one of the abandoned mutexes. The WaitOne - // throws an AbandonedMutexException. - try - { - orphanMutex1->WaitOne(); - Console::WriteLine("WaitOne succeeded."); - } - catch (AbandonedMutexException^ ex) - { - Console::WriteLine("Exception in WaitOne: {0}", - ex->Message); - } - finally - { - - // Whether or not the exception was thrown, - // the current thread owns the mutex, and - // must release it. - orphanMutex1->ReleaseMutex(); - } - - - // Create an array of wait handles, consisting of one - // ManualResetEvent and two mutexes, using two more of - // the abandoned mutexes. - array ^ waitFor = {dummyEvent, - orphanMutex2, orphanMutex3}; - - // WaitAny returns when any of the wait handles in the - // array is signaled. Either of the two abandoned mutexes - // satisfy the wait, but lower of the two index values is - // returned by MutexIndex. Note that the Try block and - // the Catch block obtain the index in different ways. - try - { - int index = WaitHandle::WaitAny(waitFor); - Console::WriteLine("WaitAny succeeded."); - (safe_cast(waitFor[index]))->ReleaseMutex(); - } - catch (AbandonedMutexException^ ex) - { - Console::WriteLine("Exception in WaitAny at index {0}" - "\r\n\tMessage: {1}", ex->MutexIndex, - ex->Message); - (safe_cast(waitFor[ex->MutexIndex]))-> - ReleaseMutex(); - } - - orphanMutex3->ReleaseMutex(); - - // Use two more of the abandoned mutexes for the WaitAll - // call. WaitAll doesn't return until all wait handles - // are signaled, so the ManualResetEvent must be signaled - // by calling Set(). - dummyEvent->Set(); - waitFor[1] = orphanMutex4; - waitFor[2] = orphanMutex5; - - // Because WaitAll requires all the wait handles to be - // signaled, both mutexes must be released even if the - // exception is thrown. Thus, the ReleaseMutex calls are - // placed in the Finally block. Again, MutexIndex returns - // the lower of the two index values for the abandoned - // mutexes. - // - try - { - WaitHandle::WaitAll(waitFor); - Console::WriteLine("WaitAll succeeded."); - } - catch (AbandonedMutexException^ ex) - { - Console::WriteLine("Exception in WaitAny at index {0}" - "\r\n\tMessage: {1}", ex->MutexIndex, - ex->Message); - } - finally - { - orphanMutex4->ReleaseMutex(); - orphanMutex5->ReleaseMutex(); - } - - } - - - private: - [MTAThread] - static void AbandonMutex() - { - orphanMutex1->WaitOne(); - orphanMutex2->WaitOne(); - orphanMutex3->WaitOne(); - orphanMutex4->WaitOne(); - orphanMutex5->WaitOne(); - Console::WriteLine( - "Thread exits without releasing the mutexes."); - } - }; -} - -//Entry point of example application -[MTAThread] -int main(void) -{ - SystemThreadingExample::Example::ProduceAbandonMutexException(); -} - -// This code example produces the following output: -// Thread exits without releasing the mutexes. -// Exception in WaitOne: The wait completed due to an abandoned mutex. -// Exception in WaitAny at index 1 -// Message: The wait completed due to an abandoned mutex. -// Exception in WaitAll at index -1 -// Message: The wait completed due to an abandoned mutex. - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp deleted file mode 100644 index 286d1b48439..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class MyMainClass -{ -public: - static void MyReadThreadProc() - { - while ( true ) - { - - //The value will not be read until the writer has written - // at least once since the last read. - myResetEvent->WaitOne(); - Console::WriteLine( " {0} reading value: {1}", Thread::CurrentThread->Name, number ); - } - } - - - //Initially not signaled. - static AutoResetEvent^ myResetEvent = gcnew AutoResetEvent( false ); - static int number; - literal int numIterations = 100; -}; - -int main() -{ - - //Create and start the reader thread. - Thread^ myReaderThread = gcnew Thread( gcnew ThreadStart( MyMainClass::MyReadThreadProc ) ); - myReaderThread->Name = "ReaderThread"; - myReaderThread->Start(); - for ( int i = 1; i <= MyMainClass::numIterations; i++ ) - { - Console::WriteLine( "Writer thread writing value: {0}", i ); - MyMainClass::number = i; - - //Signal that a value has been written. - MyMainClass::myResetEvent->Set(); - - //Give the Reader thread an opportunity to act. - Thread::Sleep( 1 ); - - } - - //Terminate the reader thread. - myReaderThread->Abort(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp deleted file mode 100644 index 96444ba3776..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp +++ /dev/null @@ -1,105 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -ref class Example -{ -private: - static AutoResetEvent^ event_1 = gcnew AutoResetEvent(true); - static AutoResetEvent^ event_2 = gcnew AutoResetEvent(false); - - static void ThreadProc() - { - String^ name = Thread::CurrentThread->Name; - - Console::WriteLine("{0} waits on AutoResetEvent #1.", name); - event_1->WaitOne(); - Console::WriteLine("{0} is released from AutoResetEvent #1.", name); - - Console::WriteLine("{0} waits on AutoResetEvent #2.", name); - event_2->WaitOne(); - Console::WriteLine("{0} is released from AutoResetEvent #2.", name); - - Console::WriteLine("{0} ends.", name); - } - -public: - static void Demo() - { - Console::WriteLine("Press Enter to create three threads and start them.\r\n" + - "The threads wait on AutoResetEvent #1, which was created\r\n" + - "in the signaled state, so the first thread is released.\r\n" + - "This puts AutoResetEvent #1 into the unsignaled state."); - Console::ReadLine(); - - for (int i = 1; i < 4; i++) - { - Thread^ t = gcnew Thread(gcnew ThreadStart(&ThreadProc)); - t->Name = "Thread_" + i; - t->Start(); - } - Thread::Sleep(250); - - for (int i = 0; i < 2; i++) - { - Console::WriteLine("Press Enter to release another thread."); - Console::ReadLine(); - event_1->Set(); - Thread::Sleep(250); - } - - Console::WriteLine("\r\nAll threads are now waiting on AutoResetEvent #2."); - for (int i = 0; i < 3; i++) - { - Console::WriteLine("Press Enter to release a thread."); - Console::ReadLine(); - event_2->Set(); - Thread::Sleep(250); - } - - // Visual Studio: Uncomment the following line. - //Console::Readline(); - } -}; - -void main() -{ - Example::Demo(); -} - -/* This example produces output similar to the following: - -Press Enter to create three threads and start them. -The threads wait on AutoResetEvent #1, which was created -in the signaled state, so the first thread is released. -This puts AutoResetEvent #1 into the unsignaled state. - -Thread_1 waits on AutoResetEvent #1. -Thread_1 is released from AutoResetEvent #1. -Thread_1 waits on AutoResetEvent #2. -Thread_3 waits on AutoResetEvent #1. -Thread_2 waits on AutoResetEvent #1. -Press Enter to release another thread. - -Thread_3 is released from AutoResetEvent #1. -Thread_3 waits on AutoResetEvent #2. -Press Enter to release another thread. - -Thread_2 is released from AutoResetEvent #1. -Thread_2 waits on AutoResetEvent #2. - -All threads are now waiting on AutoResetEvent #2. -Press Enter to release a thread. - -Thread_2 is released from AutoResetEvent #2. -Thread_2 ends. -Press Enter to release a thread. - -Thread_1 is released from AutoResetEvent #2. -Thread_1 ends. -Press Enter to release a thread. - -Thread_3 is released from AutoResetEvent #2. -Thread_3 ends. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp deleted file mode 100644 index 9545b8e2fae..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// -using namespace System; -using namespace System::Threading; -using namespace System::Security::AccessControl; -using namespace System::Security::Permissions; - -public ref class Example -{ -public: - [SecurityPermissionAttribute(SecurityAction::Demand,Flags=SecurityPermissionFlag::UnmanagedCode)] - static void Main() - { - // - String^ ewhName = L"EventWaitHandleExample5"; - - EventWaitHandle^ ewh = nullptr; - bool doesNotExist = false; - bool unauthorized = false; - - // The value of this variable is set by the event - // constructor. It is true if the named system event was - // created, and false if the named event already existed. - // - bool wasCreated; - - // Attempt to open the named event. - try - { - // Open the event with (EventWaitHandleRights.Synchronize - // | EventWaitHandleRights.Modify), to wait on and - // signal the named event. - // - ewh = EventWaitHandle::OpenExisting( ewhName ); - } - catch ( WaitHandleCannotBeOpenedException^ ) - { - Console::WriteLine( L"Named event does not exist." ); - doesNotExist = true; - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); - unauthorized = true; - } - // - - // There are three cases: (1) The event does not exist. - // (2) The event exists, but the current user doesn't - // have access. (3) The event exists and the user has - // access. - // - if ( doesNotExist ) - { - // - // The event does not exist, so create it. - - // Create an access control list (ACL) that denies the - // current user the right to wait on or signal the - // event, but allows the right to read and change - // security information for the event. - // - String^ user = String::Concat( Environment::UserDomainName, L"\\", - Environment::UserName ); - EventWaitHandleSecurity^ ewhSec = gcnew EventWaitHandleSecurity; - //following constructor fails - EventWaitHandleAccessRule^ rule = gcnew EventWaitHandleAccessRule( - user, - static_cast( - EventWaitHandleRights::Synchronize | - EventWaitHandleRights::Modify), - AccessControlType::Deny ); - ewhSec->AddAccessRule( rule ); - - rule = gcnew EventWaitHandleAccessRule( user, - static_cast( - EventWaitHandleRights::ReadPermissions | - EventWaitHandleRights::ChangePermissions), - AccessControlType::Allow ); - ewhSec->AddAccessRule( rule ); - - // Create an EventWaitHandle object that represents - // the system event named by the constant 'ewhName', - // initially signaled, with automatic reset, and with - // the specified security access. The Boolean value that - // indicates creation of the underlying system object - // is placed in wasCreated. - // - ewh = gcnew EventWaitHandle( true, - EventResetMode::AutoReset, - ewhName, - wasCreated, - ewhSec ); - - // If the named system event was created, it can be - // used by the current instance of this program, even - // though the current user is denied access. The current - // program owns the event. Otherwise, exit the program. - // - if ( wasCreated ) - { - Console::WriteLine( L"Created the named event." ); - } - else - { - Console::WriteLine( L"Unable to create the event." ); - return; - } - // - } - else if ( unauthorized ) - { - // - // Open the event to read and change the access control - // security. The access control security defined above - // allows the current user to do this. - // - try - { - ewh = EventWaitHandle::OpenExisting( ewhName, - static_cast( - EventWaitHandleRights::ReadPermissions | - EventWaitHandleRights::ChangePermissions) ); - - // Get the current ACL. This requires - // EventWaitHandleRights.ReadPermissions. - EventWaitHandleSecurity^ ewhSec = ewh->GetAccessControl(); - String^ user = String::Concat( Environment::UserDomainName, L"\\", - Environment::UserName ); - - // First, the rule that denied the current user - // the right to enter and release the event must - // be removed. - EventWaitHandleAccessRule^ rule = gcnew EventWaitHandleAccessRule( - user, - static_cast( - EventWaitHandleRights::Synchronize | - EventWaitHandleRights::Modify), - AccessControlType::Deny ); - ewhSec->RemoveAccessRule( rule ); - - // Now grant the user the correct rights. - // - rule = gcnew EventWaitHandleAccessRule( user, - static_cast( - EventWaitHandleRights::Synchronize | - EventWaitHandleRights::Modify), - AccessControlType::Allow ); - ewhSec->AddAccessRule( rule ); - - // Update the ACL. This requires - // EventWaitHandleRights.ChangePermissions. - ewh->SetAccessControl( ewhSec ); - Console::WriteLine( L"Updated event security." ); - - // Open the event with (EventWaitHandleRights.Synchronize - // | EventWaitHandleRights.Modify), the rights required - // to wait on and signal the event. - // - ewh = EventWaitHandle::OpenExisting( ewhName ); - // - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unable to change permissions: {0}", - ex->Message ); - return; - } - - } - - // Wait on the event, and hold it until the program - // exits. - // - try - { - Console::WriteLine( L"Wait on the event." ); - ewh->WaitOne(); - Console::WriteLine( L"Event was signaled." ); - Console::WriteLine( L"Press the Enter key to signal the event and exit." ); - Console::ReadLine(); - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); - } - finally - { - ewh->Set(); - } - } -}; - -int main() -{ - Example::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp deleted file mode 100644 index 37370e944c5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -// -// This example demonstrates a thread-safe method that adds to a -// running total. It cannot be run directly. You can compile it -// as a library, or add the class to a project. -#using - -using namespace System::Threading; -public ref class ThreadSafe -{ -private: - - // totalValue contains a running total that can be updated - // by multiple threads. It must be protected from unsynchronized - // access. - int totalValue; - -public: - - property int Total - { - - // The Total property returns the running total. - int get() - { - return totalValue; - } - - } - - // AddToTotal safely adds a value to the running total. - int AddToTotal( int addend ) - { - int initialValue; - int computedValue; - do - { - - // Save the current running total in a local variable. - initialValue = totalValue; - - // Add the new value to the running total. - computedValue = initialValue + addend; - - // CompareExchange compares totalValue to initialValue. If - // they are not equal, then another thread has updated the - // running total since this loop started. CompareExchange - // does not update totalValue. CompareExchange returns the - // contents of totalValue, which do not equal initialValue, - // so the loop executes again. - } - while ( initialValue != Interlocked::CompareExchange( totalValue, computedValue, initialValue ) ); - - - // If no other thread updated the running total, then - // totalValue and initialValue are equal when CompareExchange - // compares them, and computedValue is stored in totalValue. - // CompareExchange returns the value that was in totalValue - // before the update, which is equal to initialValue, so the - // loop ends. - // The function returns computedValue, not totalValue, because - // totalValue could be changed by another thread between - // the time the loop ends and the function returns. - return computedValue; - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp deleted file mode 100644 index a04b9df75bd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp +++ /dev/null @@ -1,71 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -const int numThreads = 10; -const int numThreadIterations = 5; -ref class MyInterlockedExchangeExampleClass -{ -public: - static void MyThreadProc() - { - for ( int i = 0; i < numThreadIterations; i++ ) - { - UseResource(); - - //Wait 1 second before next attempt. - Thread::Sleep( 1000 ); - - } - } - - -private: - //A simple method that denies reentrancy. - static bool UseResource() - { - - //0 indicates that the method is not in use. - if ( 0 == Interlocked::Exchange( usingResource, 1 ) ) - { - Console::WriteLine( " {0} acquired the lock", Thread::CurrentThread->Name ); - - //Code to access a resource that is not thread safe would go here. - //Simulate some work - Thread::Sleep( 500 ); - Console::WriteLine( " {0} exiting lock", Thread::CurrentThread->Name ); - - //Release the lock - Interlocked::Exchange( usingResource, 0 ); - return true; - } - else - { - Console::WriteLine( " {0} was denied the lock", Thread::CurrentThread->Name ); - return false; - } - } - - - //0 for false, 1 for true. - static int usingResource; -}; - -int main() -{ - Thread^ myThread; - Random^ rnd = gcnew Random; - for ( int i = 0; i < numThreads; i++ ) - { - myThread = gcnew Thread( gcnew ThreadStart( MyInterlockedExchangeExampleClass::MyThreadProc ) ); - myThread->Name = String::Format( "Thread {0}", i + 1 ); - - //Wait a random amount of time before starting next thread. - Thread::Sleep( rnd->Next( 0, 1000 ) ); - myThread->Start(); - - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp deleted file mode 100644 index f89e7184409..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -ref class Example -{ -private: - // mre is used to block and release threads manually. It is - // created in the unsignaled state. - static ManualResetEvent^ mre = gcnew ManualResetEvent(false); - - static void ThreadProc() - { - String^ name = Thread::CurrentThread->Name; - - Console::WriteLine(name + " starts and calls mre->WaitOne()"); - - mre->WaitOne(); - - Console::WriteLine(name + " ends."); - } - -public: - static void Demo() - { - Console::WriteLine("\nStart 3 named threads that block on a ManualResetEvent:\n"); - - for(int i = 0; i <=2 ; i++) - { - Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); - t->Name = "Thread_" + i; - t->Start(); - } - - Thread::Sleep(500); - Console::WriteLine("\nWhen all three threads have started, press Enter to call Set()" + - "\nto release all the threads.\n"); - Console::ReadLine(); - - mre->Set(); - - Thread::Sleep(500); - Console::WriteLine("\nWhen a ManualResetEvent is signaled, threads that call WaitOne()" + - "\ndo not block. Press Enter to show this.\n"); - Console::ReadLine(); - - for(int i = 3; i <= 4; i++) - { - Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); - t->Name = "Thread_" + i; - t->Start(); - } - - Thread::Sleep(500); - Console::WriteLine("\nPress Enter to call Reset(), so that threads once again block" + - "\nwhen they call WaitOne().\n"); - Console::ReadLine(); - - mre->Reset(); - - // Start a thread that waits on the ManualResetEvent. - Thread^ t5 = gcnew Thread(gcnew ThreadStart(ThreadProc)); - t5->Name = "Thread_5"; - t5->Start(); - - Thread::Sleep(500); - Console::WriteLine("\nPress Enter to call Set() and conclude the demo."); - Console::ReadLine(); - - mre->Set(); - - // If you run this example in Visual Studio, uncomment the following line: - //Console::ReadLine(); - } -}; - -int main() -{ - Example::Demo(); -} - -/* This example produces output similar to the following: - -Start 3 named threads that block on a ManualResetEvent: - -Thread_0 starts and calls mre->WaitOne() -Thread_1 starts and calls mre->WaitOne() -Thread_2 starts and calls mre->WaitOne() - -When all three threads have started, press Enter to call Set() -to release all the threads. - - -Thread_2 ends. -Thread_1 ends. -Thread_0 ends. - -When a ManualResetEvent is signaled, threads that call WaitOne() -do not block. Press Enter to show this. - - -Thread_3 starts and calls mre->WaitOne() -Thread_3 ends. -Thread_4 starts and calls mre->WaitOne() -Thread_4 ends. - -Press Enter to call Reset(), so that threads once again block -when they call WaitOne(). - - -Thread_5 starts and calls mre->WaitOne() - -Press Enter to call Set() and conclude the demo. - -Thread_5 ends. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp deleted file mode 100644 index b46723cfa04..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp +++ /dev/null @@ -1,82 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -const int numIterations = 1; -const int numThreads = 3; - -ref class Test -{ -public: - - // Create a new Mutex. The creating thread owns the - // Mutex. - static Mutex^ mut = gcnew Mutex( true ); - static void MyThreadProc() - { - for ( int i = 0; i < numIterations; i++ ) - { - UseResource(); - - } - } - - -private: - - // This method represents a resource that must be synchronized - // so that only one thread at a time can enter. - static void UseResource() - { - - //Wait until it is OK to enter. - mut->WaitOne(); - Console::WriteLine( "{0} has entered protected the area", Thread::CurrentThread->Name ); - - // Place code to access non-reentrant resources here. - // Simulate some work. - Thread::Sleep( 500 ); - Console::WriteLine( "{0} is leaving protected the area\r\n", Thread::CurrentThread->Name ); - - // Release the Mutex. - mut->ReleaseMutex(); - } - -}; - -int main() -{ - - // Initialize the Mutex. - Mutex^ mut = Test::mut; - - // Create the threads that will use the protected resource. - for ( int i = 0; i < numThreads; i++ ) - { - Thread^ myThread = gcnew Thread( gcnew ThreadStart( Test::MyThreadProc ) ); - myThread->Name = String::Format( "Thread {0}", i + 1 ); - myThread->Start(); - - } - - // Wait one second before allowing other threads to - // acquire the Mutex. - Console::WriteLine( "Creating thread owns the Mutex." ); - Thread::Sleep( 1000 ); - Console::WriteLine( "Creating thread releases the Mutex.\r\n" ); - mut->ReleaseMutex(); -} -// The example displays output like the following: -// Creating thread owns the Mutex. -// Creating thread releases the Mutex. -// -// Thread1 has entered the protected area -// Thread1 is leaving the protected area -// -// Thread2 has entered the protected area -// Thread2 is leaving the protected area -// -// Thread3 has entered the protected area -// Thread3 is leaving the protected area -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp deleted file mode 100644 index 4079eedaa6e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -int main() -{ - // Create the named mutex. Only one system object named - // "MyMutex" can exist; the local Mutex object represents - // this system object, regardless of which process or thread - // caused "MyMutex" to be created. - Mutex^ m = gcnew Mutex( false,"MyMutex" ); - - // Try to gain control of the named mutex. If the mutex is - // controlled by another thread, wait for it to be released. - Console::WriteLine( "Waiting for the Mutex." ); - m->WaitOne(); - - // Keep control of the mutex until the user presses - // ENTER. - Console::WriteLine( "This application owns the mutex. " - "Press ENTER to release the mutex and exit." ); - Console::ReadLine(); - m->ReleaseMutex(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp deleted file mode 100644 index a8d967c7296..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp +++ /dev/null @@ -1,56 +0,0 @@ - -// -// This example shows how a named mutex is used to signal between -// processes or threads. -// Run this program from two (or more) command windows. Each process -// creates a Mutex object that represents the named mutex "MyMutex". -// The named mutex is a system object whose lifetime is bounded by the -// lifetimes of the Mutex objects that represent it. The named mutex -// is created when the first process creates its local Mutex; in this -// example, the named mutex is owned by the first process. The named -// mutex is destroyed when all the Mutex objects that represent it -// have been released. -// The second process (and any subsequent process) waits for earlier -// processes to release the named mutex. -using namespace System; -using namespace System::Threading; -int main() -{ - - // Set this variable to false if you do not want to request - // initial ownership of the named mutex. - bool requestInitialOwnership = true; - bool mutexWasCreated; - - // Request initial ownership of the named mutex by passing - // true for the first parameter. Only one system object named - // "MyMutex" can exist; the local Mutex object represents - // this system object. If "MyMutex" is created by this call, - // then mutexWasCreated contains true; otherwise, it contains - // false. - Mutex^ m = gcnew Mutex( requestInitialOwnership, "MyMutex", mutexWasCreated ); - - // This thread owns the mutex only if it both requested - // initial ownership and created the named mutex. Otherwise, - // it can request the named mutex by calling WaitOne. - if ( !(requestInitialOwnership && mutexWasCreated) ) - { - Console::WriteLine( "Waiting for the named mutex." ); - m->WaitOne(); - } - - - // Once the process has gained control of the named mutex, - // hold onto it until the user presses ENTER. - Console::WriteLine( "This process owns the named mutex. " - "Press ENTER to release the mutex and exit." ); - Console::ReadLine(); - - // Call ReleaseMutex to allow other threads to gain control - // of the named mutex. If you keep a reference to the local - // Mutex, you can call WaitOne to request control of the - // named mutex. - m->ReleaseMutex(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp deleted file mode 100644 index 958035c2e03..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp +++ /dev/null @@ -1,66 +0,0 @@ - -// -// This example shows how a Mutex is used to synchronize access -// to a protected resource. Unlike Monitor, Mutex can be used with -// WaitHandle.WaitAll and WaitAny, and can be passed across -// AppDomain boundaries. -using namespace System; -using namespace System::Threading; -const int numIterations = 1; -const int numThreads = 3; -ref class Test -{ -public: - - // Create a new Mutex. The creating thread does not own the - // Mutex. - static Mutex^ mut = gcnew Mutex; - static void MyThreadProc() - { - for ( int i = 0; i < numIterations; i++ ) - { - UseResource(); - - } - } - - -private: - - // This method represents a resource that must be synchronized - // so that only one thread at a time can enter. - static void UseResource() - { - - //Wait until it is OK to enter. - mut->WaitOne(); - Console::WriteLine( "{0} has entered protected the area", Thread::CurrentThread->Name ); - - // Place code to access non-reentrant resources here. - // Simulate some work. - Thread::Sleep( 500 ); - Console::WriteLine( "{0} is leaving protected the area\r\n", Thread::CurrentThread->Name ); - - // Release the Mutex. - mut->ReleaseMutex(); - } - -}; - -int main() -{ - - // Create the threads that will use the protected resource. - for ( int i = 0; i < numThreads; i++ ) - { - Thread^ myThread = gcnew Thread( gcnew ThreadStart( Test::MyThreadProc ) ); - myThread->Name = String::Format( "Thread {0}", i + 1 ); - myThread->Start(); - - } - - // The main thread exits, but the application continues to - // run until all foreground threads have exited. -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp deleted file mode 100644 index 26673315e5e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp +++ /dev/null @@ -1,197 +0,0 @@ -// -using namespace System; -using namespace System::Threading; -using namespace System::Security::AccessControl; -using namespace System::Security::Permissions; - -public ref class Example -{ -public: - [SecurityPermissionAttribute(SecurityAction::Demand,Flags=SecurityPermissionFlag::UnmanagedCode)] - static void Main() - { - // - String^ mutexName = L"MutexExample4"; - - Mutex^ m = nullptr; - bool doesNotExist = false; - bool unauthorized = false; - - // The value of this variable is set by the mutex - // constructor. It is true if the named system mutex was - // created, and false if the named mutex already existed. - // - bool mutexWasCreated = false; - - // Attempt to open the named mutex. - try - { - // Open the mutex with (MutexRights.Synchronize | - // MutexRights.Modify), to enter and release the - // named mutex. - // - m = Mutex::OpenExisting( mutexName ); - } - catch ( WaitHandleCannotBeOpenedException^ ) - { - Console::WriteLine( L"Mutex does not exist." ); - doesNotExist = true; - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); - unauthorized = true; - } - // - - // There are three cases: (1) The mutex does not exist. - // (2) The mutex exists, but the current user doesn't - // have access. (3) The mutex exists and the user has - // access. - // - if ( doesNotExist ) - { - // - // The mutex does not exist, so create it. - // Create an access control list (ACL) that denies the - // current user the right to enter or release the - // mutex, but allows the right to read and change - // security information for the mutex. - // - String^ user = String::Concat( Environment::UserDomainName, L"\\", - Environment::UserName ); - MutexSecurity^ mSec = gcnew MutexSecurity; - - MutexAccessRule^ rule = gcnew MutexAccessRule( user, - static_cast( - MutexRights::Synchronize | - MutexRights::Modify), - AccessControlType::Deny ); - mSec->AddAccessRule( rule ); - - rule = gcnew MutexAccessRule( user, - static_cast( - MutexRights::ReadPermissions | - MutexRights::ChangePermissions), - AccessControlType::Allow ); - mSec->AddAccessRule( rule ); - - // Create a Mutex object that represents the system - // mutex named by the constant 'mutexName', with - // initial ownership for this thread, and with the - // specified security access. The Boolean value that - // indicates creation of the underlying system object - // is placed in mutexWasCreated. - // - m = gcnew Mutex( true,mutexName, mutexWasCreated,mSec ); - - // If the named system mutex was created, it can be - // used by the current instance of this program, even - // though the current user is denied access. The current - // program owns the mutex. Otherwise, exit the program. - // - if ( mutexWasCreated ) - { - Console::WriteLine( L"Created the mutex." ); - } - else - { - Console::WriteLine( L"Unable to create the mutex." ); - return; - } - // - } - else if ( unauthorized ) - { - // - // Open the mutex to read and change the access control - // security. The access control security defined above - // allows the current user to do this. - // - try - { - m = Mutex::OpenExisting( mutexName, - static_cast( - MutexRights::ReadPermissions | - MutexRights::ChangePermissions) ); - - // Get the current ACL. This requires - // MutexRights.ReadPermissions. - MutexSecurity^ mSec = m->GetAccessControl(); - - String^ user = String::Concat( Environment::UserDomainName, - L"\\", Environment::UserName ); - - // First, the rule that denied the current user - // the right to enter and release the mutex must - // be removed. - MutexAccessRule^ rule = gcnew MutexAccessRule( user, - static_cast( - MutexRights::Synchronize | - MutexRights::Modify), - AccessControlType::Deny ); - mSec->RemoveAccessRule( rule ); - - // Now grant the user the correct rights. - // - rule = gcnew MutexAccessRule( user, - static_cast( - MutexRights::Synchronize | - MutexRights::Modify), - AccessControlType::Allow ); - mSec->AddAccessRule( rule ); - - // Update the ACL. This requires - // MutexRights.ChangePermissions. - m->SetAccessControl( mSec ); - - Console::WriteLine( L"Updated mutex security." ); - - // Open the mutex with (MutexRights.Synchronize - // | MutexRights.Modify), the rights required to - // enter and release the mutex. - // - m = Mutex::OpenExisting( mutexName ); - // - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( - L"Unable to change permissions: {0}", ex->Message ); - return; - } - } - - // If this program created the mutex, it already owns - // the mutex. - // - if ( !mutexWasCreated ) - { - // Enter the mutex, and hold it until the program - // exits. - // - try - { - Console::WriteLine( L"Wait for the mutex." ); - m->WaitOne(); - Console::WriteLine( L"Entered the mutex." ); - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unauthorized access: {0}", - ex->Message ); - } - } - - Console::WriteLine( L"Press the Enter key to exit." ); - Console::ReadLine(); - m->ReleaseMutex(); - m->Dispose(); - } -}; - -int main() -{ - Example::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp deleted file mode 100644 index 6395c7d937d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -namespace SystemThreadingExample -{ - public ref class Work - { - public: - void StartThreads() - { - // Start a thread that calls a parameterized static method. - Thread^ newThread = gcnew - Thread(gcnew ParameterizedThreadStart(Work::DoWork)); - newThread->Start(42); - - // Start a thread that calls a parameterized instance method. - Work^ someWork = gcnew Work; - newThread = gcnew Thread( - gcnew ParameterizedThreadStart(someWork, - &Work::DoMoreWork)); - newThread->Start("The answer."); - } - - static void DoWork(Object^ data) - { - Console::WriteLine("Static thread procedure. Data='{0}'", - data); - } - - void DoMoreWork(Object^ data) - { - Console::WriteLine("Instance thread procedure. Data='{0}'", - data); - } - }; -} - -//Entry point of example application -int main() -{ - SystemThreadingExample::Work^ samplework = - gcnew SystemThreadingExample::Work(); - samplework->StartThreads(); -} -// This example displays output like the following: -// Static thread procedure. Data='42' -// Instance thread procedure. Data='The answer.' -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp deleted file mode 100644 index 36560d92fa5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -int main() -{ - ReaderWriterLock^ rwLock = gcnew ReaderWriterLock; - rwLock->AcquireWriterLock( Timeout::Infinite ); - rwLock->AcquireReaderLock( Timeout::Infinite ); - if ( rwLock->IsReaderLockHeld ) - { - Console::WriteLine( "Reader lock held." ); - rwLock->ReleaseReaderLock(); - } - else - if ( rwLock->IsWriterLockHeld ) - { - Console::WriteLine( "Writer lock held." ); - rwLock->ReleaseWriterLock(); - } - else - { - Console::WriteLine( "No locks held." ); - } - - - if ( rwLock->IsReaderLockHeld ) - { - Console::WriteLine( "Reader lock held." ); - rwLock->ReleaseReaderLock(); - } - else - if ( rwLock->IsWriterLockHeld ) - { - Console::WriteLine( "Writer lock held." ); - rwLock->ReleaseWriterLock(); - } - else - { - Console::WriteLine( "No locks held." ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp deleted file mode 100644 index 1aca8464071..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp +++ /dev/null @@ -1,320 +0,0 @@ -// -// This example shows a ReaderWriterLock protecting a shared -// resource that is read concurrently and written exclusively -// by multiple threads. -// -// The complete code is located in the ReaderWriterLock -// class topic. -using namespace System; -using namespace System::Threading; -public ref class Test -{ -public: - - // Declaring the ReaderWriterLock at the class level - // makes it visible to all threads. - static ReaderWriterLock^ rwl = gcnew ReaderWriterLock; - - // For this example, the shared resource protected by the - // ReaderWriterLock is just an integer. - static int resource = 0; - - // - literal int numThreads = 26; - static bool running = true; - - // Statistics. - static int readerTimeouts = 0; - static int writerTimeouts = 0; - static int reads = 0; - static int writes = 0; - static void ThreadProc() - { - Random^ rnd = gcnew Random; - - // As long as a thread runs, it randomly selects - // various ways to read and write from the shared - // resource. Each of the methods demonstrates one - // or more features of ReaderWriterLock. - while ( running ) - { - double action = rnd->NextDouble(); - if ( action < .8 ) - ReadFromResource( 10 ); - else - if ( action < .81 ) - ReleaseRestore( rnd, 50 ); - else - if ( action < .90 ) - UpgradeDowngrade( rnd, 100 ); - else - WriteToResource( rnd, 100 ); - } - } - - - // - // Shows how to request and release a reader lock, and - // how to handle time-outs. - static void ReadFromResource( int timeOut ) - { - try - { - rwl->AcquireReaderLock( timeOut ); - try - { - - // It is safe for this thread to read from - // the shared resource. - Display( String::Format( "reads resource value {0}", resource ) ); - Interlocked::Increment( reads ); - } - finally - { - - // Ensure that the lock is released. - rwl->ReleaseReaderLock(); - } - - } - catch ( ApplicationException^ ) - { - - // The reader lock request timed out. - Interlocked::Increment( readerTimeouts ); - } - - } - - - // - // - // Shows how to request and release the writer lock, and - // how to handle time-outs. - static void WriteToResource( Random^ rnd, int timeOut ) - { - try - { - rwl->AcquireWriterLock( timeOut ); - try - { - - // It is safe for this thread to read or write - // from the shared resource. - resource = rnd->Next( 500 ); - Display( String::Format( "writes resource value {0}", resource ) ); - Interlocked::Increment( writes ); - } - finally - { - - // Ensure that the lock is released. - rwl->ReleaseWriterLock(); - } - - } - catch ( ApplicationException^ ) - { - - // The writer lock request timed out. - Interlocked::Increment( writerTimeouts ); - } - - } - - - // - // - // Shows how to request a reader lock, upgrade the - // reader lock to the writer lock, and downgrade to a - // reader lock again. - static void UpgradeDowngrade( Random^ rnd, int timeOut ) - { - try - { - rwl->AcquireReaderLock( timeOut ); - try - { - - // It is safe for this thread to read from - // the shared resource. - Display( String::Format( "reads resource value {0}", resource ) ); - Interlocked::Increment( reads ); - - // If it is necessary to write to the resource, - // you must either release the reader lock and - // then request the writer lock, or upgrade the - // reader lock. Note that upgrading the reader lock - // puts the thread in the write queue, behind any - // other threads that might be waiting for the - // writer lock. - try - { - LockCookie lc = rwl->UpgradeToWriterLock( timeOut ); - try - { - - // It is safe for this thread to read or write - // from the shared resource. - resource = rnd->Next( 500 ); - Display( String::Format( "writes resource value {0}", resource ) ); - Interlocked::Increment( writes ); - } - finally - { - - // Ensure that the lock is released. - rwl->DowngradeFromWriterLock( lc ); - } - - } - catch ( ApplicationException^ ) - { - - // The upgrade request timed out. - Interlocked::Increment( writerTimeouts ); - } - - - // When the lock has been downgraded, it is - // still safe to read from the resource. - Display( String::Format( "reads resource value {0}", resource ) ); - Interlocked::Increment( reads ); - } - finally - { - - // Ensure that the lock is released. - rwl->ReleaseReaderLock(); - } - - } - catch ( ApplicationException^ ) - { - - // The reader lock request timed out. - Interlocked::Increment( readerTimeouts ); - } - - } - - - // - // - // Shows how to release all locks and later restore - // the lock state. Shows how to use sequence numbers - // to determine whether another thread has obtained - // a writer lock since this thread last accessed the - // resource. - static void ReleaseRestore( Random^ rnd, int timeOut ) - { - int lastWriter; - try - { - rwl->AcquireReaderLock( timeOut ); - try - { - - // It is safe for this thread to read from - // the shared resource. Cache the value. (You - // might do this if reading the resource is - // an expensive operation.) - int resourceValue = resource; - Display( String::Format( "reads resource value {0}", resourceValue ) ); - Interlocked::Increment( reads ); - - // Save the current writer sequence number. - lastWriter = rwl->WriterSeqNum; - - // Release the lock, and save a cookie so the - // lock can be restored later. - LockCookie lc = rwl->ReleaseLock(); - - // Wait for a random interval (up to a - // quarter of a second), and then restore - // the previous state of the lock. Note that - // there is no timeout on the Restore method. - Thread::Sleep( rnd->Next( 250 ) ); - rwl->RestoreLock( lc ); - - // Check whether other threads obtained the - // writer lock in the interval. If not, then - // the cached value of the resource is still - // valid. - if ( rwl->AnyWritersSince( lastWriter ) ) - { - resourceValue = resource; - Interlocked::Increment( reads ); - Display( String::Format( "resource has changed {0}", resourceValue ) ); - } - else - { - Display( String::Format( "resource has not changed {0}", resourceValue ) ); - } - } - finally - { - - // Ensure that the lock is released. - rwl->ReleaseReaderLock(); - } - - } - catch ( ApplicationException^ ) - { - - // The reader lock request timed out. - Interlocked::Increment( readerTimeouts ); - } - - } - - - // - // Helper method briefly displays the most recent - // thread action. Comment out calls to Display to - // get a better idea of throughput. - static void Display( String^ msg ) - { - Console::Write( "Thread {0} {1}. \r", Thread::CurrentThread->Name, msg ); - } - - // -}; - - -// -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // Start a series of threads. Each thread randomly - // performs reads and writes on the shared resource. - array^t = gcnew array(Test::numThreads); - for ( int i = 0; i < Test::numThreads; i++ ) - { - t[ i ] = gcnew Thread( gcnew ThreadStart( Test::ThreadProc ) ); - t[ i ]->Name = gcnew String( Convert::ToChar( i + 65 ),1 ); - t[ i ]->Start(); - if ( i > 10 ) - Thread::Sleep( 300 ); - - } - - // Tell the threads to shut down, then wait until they all - // finish. - Test::running = false; - for ( int i = 0; i < Test::numThreads; i++ ) - { - t[ i ]->Join(); - - } - - // Display statistics. - Console::WriteLine( "\r\n {0} reads, {1} writes, {2} reader time-outs, {3} writer time-outs.", Test::reads, Test::writes, Test::readerTimeouts, Test::writerTimeouts ); - Console::WriteLine( "Press ENTER to exit." ); - Console::ReadLine(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp deleted file mode 100644 index c9829906328..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -#using -using namespace System; -using namespace System::Threading; - -public ref class Example -{ -public: - static void main() - { - // Create a Semaphore object that represents the named - // system semaphore "SemaphoreExample3". The semaphore has a - // maximum count of five. The initial count is also five. - // There is no point in using a smaller initial count, - // because the initial count is not used if this program - // doesn't create the named system semaphore, and with - // this method overload there is no way to tell. Thus, this - // program assumes that it is competing with other - // programs for the semaphore. - // - Semaphore^ sem = gcnew Semaphore( 5,5,L"SemaphoreExample3" ); - - // Attempt to enter the semaphore three times. If another - // copy of this program is already running, only the first - // two requests can be satisfied. The third blocks. Note - // that in a real application, timeouts should be used - // on the WaitOne calls, to avoid deadlocks. - // - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore once." ); - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore twice." ); - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore three times." ); - - // The thread executing this program has entered the - // semaphore three times. If a second copy of the program - // is run, it will block until this program releases the - // semaphore at least once. - // - Console::WriteLine( L"Enter the number of times to call Release." ); - int n; - if ( Int32::TryParse( Console::ReadLine(),n ) ) - { - sem->Release( n ); - } - - int remaining = 3 - n; - if ( remaining > 0 ) - { - Console::WriteLine( L"Press Enter to release the remaining " - L"count ({0}) and exit the program.", remaining ); - Console::ReadLine(); - sem->Release( remaining ); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp deleted file mode 100644 index a51b308ac9e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -#using -using namespace System; -using namespace System::Threading; - -public ref class Example -{ -public: - static void main() - { - // The value of this variable is set by the semaphore - // constructor. It is true if the named system semaphore was - // created, and false if the named semaphore already existed. - // - bool semaphoreWasCreated; - - // Create a Semaphore object that represents the named - // system semaphore "SemaphoreExample". The semaphore has a - // maximum count of five, and an initial count of two. The - // Boolean value that indicates creation of the underlying - // system object is placed in semaphoreWasCreated. - // - Semaphore^ sem = gcnew Semaphore( 2,5,L"SemaphoreExample", - semaphoreWasCreated ); - if ( semaphoreWasCreated ) - { - // If the named system semaphore was created, its count is - // set to the initial count requested in the constructor. - // In effect, the current thread has entered the semaphore - // three times. - // - Console::WriteLine( L"Entered the semaphore three times." ); - } - else - { - // If the named system semaphore was not created, - // attempt to enter it three times. If another copy of - // this program is already running, only the first two - // requests can be satisfied. The third blocks. - // - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore once." ); - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore twice." ); - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore three times." ); - } - - // The thread executing this program has entered the - // semaphore three times. If a second copy of the program - // is run, it will block until this program releases the - // semaphore at least once. - // - Console::WriteLine( L"Enter the number of times to call Release." ); - int n; - if ( Int32::TryParse( Console::ReadLine(), n ) ) - { - sem->Release( n ); - } - - int remaining = 3 - n; - if ( remaining > 0 ) - { - Console::WriteLine( L"Press Enter to release the remaining " - L"count ({0}) and exit the program.", remaining ); - Console::ReadLine(); - sem->Release( remaining ); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp deleted file mode 100644 index 471a8d1e8b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// -#using -using namespace System; -using namespace System::Threading; -using namespace System::Security::AccessControl; -using namespace System::Security::Permissions; - -public ref class Example -{ -public: - [SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)] - static void main() - { - // - String^ semaphoreName = L"SemaphoreExample5"; - - Semaphore^ sem = nullptr; - bool doesNotExist = false; - bool unauthorized = false; - - // Attempt to open the named semaphore. - try - { - // Open the semaphore with (SemaphoreRights.Synchronize - // | SemaphoreRights.Modify), to enter and release the - // named semaphore. - // - sem = Semaphore::OpenExisting( semaphoreName ); - } - catch ( WaitHandleCannotBeOpenedException^ ex ) - { - Console::WriteLine( L"Semaphore does not exist." ); - doesNotExist = true; - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); - unauthorized = true; - } - // - - // There are three cases: (1) The semaphore does not exist. - // (2) The semaphore exists, but the current user doesn't - // have access. (3) The semaphore exists and the user has - // access. - // - if ( doesNotExist ) - { - // - // The semaphore does not exist, so create it. - // - // The value of this variable is set by the semaphore - // constructor. It is true if the named system semaphore was - // created, and false if the named semaphore already existed. - // - bool semaphoreWasCreated; - - // Create an access control list (ACL) that denies the - // current user the right to enter or release the - // semaphore, but allows the right to read and change - // security information for the semaphore. - // - String^ user = String::Concat( Environment::UserDomainName, - L"\\", Environment::UserName ); - SemaphoreSecurity^ semSec = gcnew SemaphoreSecurity; - - SemaphoreAccessRule^ rule = gcnew SemaphoreAccessRule( user, - static_cast( - SemaphoreRights::Synchronize | - SemaphoreRights::Modify ), - AccessControlType::Deny ); - semSec->AddAccessRule( rule ); - - rule = gcnew SemaphoreAccessRule( user, - static_cast( - SemaphoreRights::ReadPermissions | - SemaphoreRights::ChangePermissions ), - AccessControlType::Allow ); - semSec->AddAccessRule( rule ); - - // Create a Semaphore object that represents the system - // semaphore named by the constant 'semaphoreName', with - // maximum count three, initial count three, and the - // specified security access. The Boolean value that - // indicates creation of the underlying system object is - // placed in semaphoreWasCreated. - // - sem = gcnew Semaphore( 3,3,semaphoreName,semaphoreWasCreated,semSec ); - - // If the named system semaphore was created, it can be - // used by the current instance of this program, even - // though the current user is denied access. The current - // program enters the semaphore. Otherwise, exit the - // program. - // - if ( semaphoreWasCreated ) - { - Console::WriteLine( L"Created the semaphore." ); - } - else - { - Console::WriteLine( L"Unable to create the semaphore." ); - return; - } - // - - } - else if ( unauthorized ) - { - // - // Open the semaphore to read and change the access - // control security. The access control security defined - // above allows the current user to do this. - // - try - { - sem = Semaphore::OpenExisting( semaphoreName, - static_cast( - SemaphoreRights::ReadPermissions | - SemaphoreRights::ChangePermissions )); - - // Get the current ACL. This requires - // SemaphoreRights.ReadPermissions. - SemaphoreSecurity^ semSec = sem->GetAccessControl(); - - String^ user = String::Concat( Environment::UserDomainName, - L"\\", Environment::UserName ); - - // First, the rule that denied the current user - // the right to enter and release the semaphore must - // be removed. - SemaphoreAccessRule^ rule = gcnew SemaphoreAccessRule( user, - static_cast( - SemaphoreRights::Synchronize | - SemaphoreRights::Modify ), - AccessControlType::Deny ); - semSec->RemoveAccessRule( rule ); - - // Now grant the user the correct rights. - // - rule = gcnew SemaphoreAccessRule( user, - static_cast( - SemaphoreRights::Synchronize | - SemaphoreRights::Modify ), - AccessControlType::Allow ); - semSec->AddAccessRule( rule ); - - // Update the ACL. This requires - // SemaphoreRights.ChangePermissions. - sem->SetAccessControl( semSec ); - - Console::WriteLine( L"Updated semaphore security." ); - - // Open the semaphore with (SemaphoreRights.Synchronize - // | SemaphoreRights.Modify), the rights required to - // enter and release the semaphore. - // - sem = Semaphore::OpenExisting( semaphoreName ); - // - - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unable to change permissions: {0}", ex->Message ); - return; - } - } - - // Enter the semaphore, and hold it until the program - // exits. - // - try - { - sem->WaitOne(); - Console::WriteLine( L"Entered the semaphore." ); - Console::WriteLine( L"Press the Enter key to exit." ); - Console::ReadLine(); - sem->Release(); - } - catch ( UnauthorizedAccessException^ ex ) - { - Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp deleted file mode 100644 index 13cb5b616e3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -#using -using namespace System; -using namespace System::Threading; - -public ref class Example -{ -private: - // A semaphore that simulates a limited resource pool. - // - static Semaphore^ _pool; - - // A padding interval to make the output more orderly. - static int _padding; - -public: - static void Main() - { - // Create a semaphore that can satisfy up to three - // concurrent requests. Use an initial count of zero, - // so that the entire semaphore count is initially - // owned by the main program thread. - // - _pool = gcnew Semaphore( 0,3 ); - - // Create and start five numbered threads. - // - for ( int i = 1; i <= 5; i++ ) - { - Thread^ t = gcnew Thread( - gcnew ParameterizedThreadStart( Worker ) ); - - // Start the thread, passing the number. - // - t->Start( i ); - } - - // Wait for half a second, to allow all the - // threads to start and to block on the semaphore. - // - Thread::Sleep( 500 ); - - // The main thread starts out holding the entire - // semaphore count. Calling Release(3) brings the - // semaphore count back to its maximum value, and - // allows the waiting threads to enter the semaphore, - // up to three at a time. - // - Console::WriteLine( L"Main thread calls Release(3)." ); - _pool->Release( 3 ); - - Console::WriteLine( L"Main thread exits." ); - } - -private: - static void Worker( Object^ num ) - { - // Each worker thread begins by requesting the - // semaphore. - Console::WriteLine( L"Thread {0} begins and waits for the semaphore.", num ); - _pool->WaitOne(); - - // A padding interval to make the output more orderly. - int padding = Interlocked::Add( _padding, 100 ); - - Console::WriteLine( L"Thread {0} enters the semaphore.", num ); - - // The thread's "work" consists of sleeping for - // about a second. Each thread "works" a little - // longer, just to make the output more orderly. - // - Thread::Sleep( 1000 + padding ); - - Console::WriteLine( L"Thread {0} releases the semaphore.", num ); - Console::WriteLine( L"Thread {0} previous semaphore count: {1}", - num, _pool->Release() ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp deleted file mode 100644 index 91f6e6c03f5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using -using namespace System; -using namespace System::Threading; - -public ref class Example -{ -private: - // A semaphore that can satisfy at most two concurrent - // requests. - // - static Semaphore^ _pool = gcnew Semaphore( 2,2 ); - -public: - static void main() - { - // Create and start two threads, A and B. - // - Thread^ tA = gcnew Thread( gcnew ThreadStart( ThreadA ) ); - tA->Start(); - - Thread^ tB = gcnew Thread( gcnew ThreadStart( ThreadB ) ); - tB->Start(); - } - -private: - static void ThreadA() - { - // Thread A enters the semaphore and simulates a task - // that lasts a second. - // - _pool->WaitOne(); - Console::WriteLine( L"Thread A entered the semaphore." ); - - Thread::Sleep( 1000 ); - - try - { - _pool->Release(); - Console::WriteLine( L"Thread A released the semaphore." ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"Thread A: {0}", ex->Message ); - } - } - - static void ThreadB() - { - // Thread B simulates a task that lasts half a second, - // then enters the semaphore. - // - Thread::Sleep( 500 ); - - _pool->WaitOne(); - Console::WriteLine( L"Thread B entered the semaphore." ); - - // Due to a programming error, Thread B releases the - // semaphore twice. To fix the program, delete one line. - _pool->Release(); - _pool->Release(); - Console::WriteLine( L"Thread B exits successfully." ); - } -}; -/* This code example produces the following output: - -Thread A entered the semaphore. -Thread B entered the semaphore. -Thread B exits successfully. -Thread A: Adding the given count to the semaphore would cause it to exceed its maximum count. - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp deleted file mode 100644 index 4ae633572bc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class Test -{ -private: - Test(){} - - -public: - static void TestMethod() - { - try - { - while ( true ) - { - Console::WriteLine( "New thread running." ); - Thread::Sleep( 1000 ); - } - } - catch ( ThreadAbortException^ abortException ) - { - Console::WriteLine( dynamic_cast(abortException->ExceptionState) ); - } - - } - -}; - -int main() -{ - Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::TestMethod ) ); - newThread->Start(); - Thread::Sleep( 1000 ); - - // Abort newThread. - Console::WriteLine( "Main aborting new thread." ); - newThread->Abort( "Information from main." ); - - // Wait for the thread to terminate. - newThread->Join(); - Console::WriteLine( "New thread terminated - main exiting." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp deleted file mode 100644 index 14f5dab19a1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class ApartmentTest -{ -public: - static void ThreadMethod() - { - Thread::Sleep( 1000 ); - } - -}; - -int main() -{ - Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ApartmentTest::ThreadMethod ) ); - newThread->SetApartmentState(ApartmentState::MTA); - - Console::WriteLine( "ThreadState: {0}, ApartmentState: {1}", newThread->ThreadState.ToString(), newThread->GetApartmentState().ToString() ); - newThread->Start(); - - // Wait for newThread to start and go to sleep. - Thread::Sleep( 300 ); - try - { - - // This causes an exception since newThread is sleeping. - newThread->SetApartmentState(ApartmentState::STA); - } - catch ( ThreadStateException^ stateException ) - { - Console::WriteLine( "\n{0} caught:\n" - "Thread is not in the Unstarted or Running state.", stateException->GetType()->Name ); - Console::WriteLine( "ThreadState: {0}, ApartmentState: {1}", newThread->ThreadState.ToString(), newThread->GetApartmentState().ToString() ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp deleted file mode 100644 index 99ee37687eb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -using namespace System::Threading; - -public ref class MyUtility -{ -public: - void PerformTask() - { - // Code in this region can be aborted without affecting - // other tasks. - // - Thread::BeginCriticalRegion(); - // - // The host might decide to unload the application domain - // if a failure occurs in this code region. - // - Thread::EndCriticalRegion(); - // - // Code in this region can be aborted without affecting - // other tasks. - } -}; -// - -int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp deleted file mode 100644 index 2fd262cc0fa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System::Threading; -using namespace System::Security::Permissions; - -public ref class MyUtility -{ -public: - [SecurityPermissionAttribute(SecurityAction::Demand, ControlThread=true)] - void PerformTask() - { - // Code that does not have thread affinity goes here. - // - Thread::BeginThreadAffinity(); - // - // Code that has thread affinity goes here. - // - Thread::EndThreadAffinity(); - // - // More code that does not have thread affinity. - } -}; -// - -int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp deleted file mode 100644 index e91e5179e09..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Threading; -using namespace System::Windows::Forms; -ref class UICulture: public Form -{ -public: - UICulture() - { - - // Set the user interface to display in the - // same culture as that set in Control Panel. - Thread::CurrentThread->CurrentUICulture = Thread::CurrentThread->CurrentCulture; - - // Add additional code. - } -}; - - -int main() -{ - Application::Run( gcnew UICulture ); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp deleted file mode 100644 index 1ae83042eb2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Principal; -using namespace System::Threading; - -int main() -{ - array^rolesArray = {"managers","executives"}; - try - { - - // Set the principal to a new generic principal. - Thread::CurrentPrincipal = gcnew GenericPrincipal( gcnew GenericIdentity( "Bob","Passport" ),rolesArray ); - } - catch ( SecurityException^ secureException ) - { - Console::WriteLine( "{0}: Permission to set Principal " - "is denied.", secureException->GetType()->Name ); - } - - IPrincipal^ threadPrincipal = Thread::CurrentPrincipal; - Console::WriteLine( "Name: {0}\nIsAuthenticated: {1}" - "\nAuthenticationType: {2}", threadPrincipal->Identity->Name, threadPrincipal->Identity->IsAuthenticated.ToString(), threadPrincipal->Identity->AuthenticationType ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp deleted file mode 100644 index 88a93c82f9d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class Slot -{ -private: - static Random^ randomGenerator; - static LocalDataStoreSlot^ localSlot; - static Slot() - { - randomGenerator = gcnew Random; - localSlot = Thread::AllocateDataSlot(); - } - - -public: - static void SlotTest() - { - - // Set different data in each thread's data slot. - Thread::SetData( localSlot, randomGenerator->Next( 1, 200 ) ); - - // Write the data from each thread's data slot. - Console::WriteLine( "Data in thread_{0}'s data slot: {1,3}", AppDomain::GetCurrentThreadId().ToString(), Thread::GetData( localSlot )->ToString() ); - - // Allow other threads time to execute SetData to show - // that a thread's data slot is unique to the thread. - Thread::Sleep( 1000 ); - Console::WriteLine( "Data in thread_{0}'s data slot: {1,3}", AppDomain::GetCurrentThreadId().ToString(), Thread::GetData( localSlot )->ToString() ); - } - -}; - -int main() -{ - array^newThreads = gcnew array(4); - for ( int i = 0; i < newThreads->Length; i++ ) - { - newThreads[ i ] = gcnew Thread( gcnew ThreadStart( &Slot::SlotTest ) ); - newThreads[ i ]->Start(); - - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp deleted file mode 100644 index 7e368cd0a1c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -ref class ThreadData -{ -private: - [ThreadStatic] - static int threadSpecificData; - -public: - static void ThreadStaticDemo() - { - // Store the managed thread id for each thread in the static - // variable. - threadSpecificData = Thread::CurrentThread->ManagedThreadId; - - // Allow other threads time to execute the same code, to show - // that the static data is unique to each thread. - Thread::Sleep( 1000 ); - - // Display the static data. - Console::WriteLine( "Data for managed thread {0}: {1}", - Thread::CurrentThread->ManagedThreadId, threadSpecificData ); - } -}; - -int main() -{ - for ( int i = 0; i < 3; i++ ) - { - Thread^ newThread = - gcnew Thread( gcnew ThreadStart( ThreadData::ThreadStaticDemo )); - newThread->Start(); - } -} - -/* This code example produces output similar to the following: - -Data for managed thread 4: 4 -Data for managed thread 5: 5 -Data for managed thread 3: 3 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp deleted file mode 100644 index 497071f1d0f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class Test -{ -private: - Test(){} - - -public: - static void ThreadMethod() - { - Console::WriteLine( "Thread {0} started in {1} with AppDomainID = {2}.", AppDomain::GetCurrentThreadId().ToString(), Thread::GetDomain()->FriendlyName, Thread::GetDomainID().ToString() ); - } - -}; - -int main() -{ - Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::ThreadMethod ) ); - newThread->Start(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp deleted file mode 100644 index 533813e424f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -// -using namespace System; -using namespace System::Security::Permissions; -using namespace System::Threading; - -ref class StayAwake -{ -private: - bool sleepSwitch; - -public: - - property bool SleepSwitch - { - void set( bool value ) - { - sleepSwitch = value; - } - - } - StayAwake() - { - sleepSwitch = false; - } - - void ThreadMethod() - { - Console::WriteLine( "newThread is executing ThreadMethod." ); - while ( !sleepSwitch ) - { - - // Use SpinWait instead of Sleep to demonstrate the - // effect of calling Interrupt on a running thread. - Thread::SpinWait( 10000000 ); - } - - try - { - Console::WriteLine( "newThread going to sleep." ); - - // When newThread goes to sleep, it is immediately - // woken up by a ThreadInterruptedException. - Thread::Sleep( Timeout::Infinite ); - } - catch ( ThreadInterruptedException^ /*e*/ ) - { - Console::WriteLine( "newThread cannot go to sleep - " - "interrupted by main thread." ); - } - - } - -}; - -int main() -{ - StayAwake^ stayAwake = gcnew StayAwake; - Thread^ newThread = gcnew Thread( gcnew ThreadStart( stayAwake, &StayAwake::ThreadMethod ) ); - newThread->Start(); - - // The following line causes an exception to be thrown - // in ThreadMethod if newThread is currently blocked - // or becomes blocked in the future. - newThread->Interrupt(); - Console::WriteLine( "Main thread calls Interrupt on newThread." ); - - // Then tell newThread to go to sleep. - stayAwake->SleepSwitch = true; - - // Wait for newThread to end. - newThread->Join(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp deleted file mode 100644 index 7743178ff7e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -ref class BackgroundTest -{ -private: - int maxIterations; - -public: - BackgroundTest(int maxIterations) - { - this->maxIterations = maxIterations; - } - - void RunLoop() - { - for (int i = 0; i < maxIterations; i++ ) - { - Console::WriteLine("{0} count: {1}", - Thread::CurrentThread->IsBackground ? - "Background Thread" : "Foreground Thread", i); - Thread::Sleep(250); - - } - Console::WriteLine("{0} finished counting.", - Thread::CurrentThread->IsBackground ? - "Background Thread" : "Foreground Thread"); - } -}; - -int main() -{ - BackgroundTest^ shortTest = gcnew BackgroundTest( 10 ); - Thread^ foregroundThread = gcnew Thread( gcnew ThreadStart( shortTest, &BackgroundTest::RunLoop ) ); - foregroundThread->Name = "ForegroundThread"; - BackgroundTest^ longTest = gcnew BackgroundTest( 50 ); - Thread^ backgroundThread = gcnew Thread( gcnew ThreadStart( longTest, &BackgroundTest::RunLoop ) ); - backgroundThread->Name = "BackgroundThread"; - backgroundThread->IsBackground = true; - foregroundThread->Start(); - backgroundThread->Start(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp deleted file mode 100644 index 9ae320e27d8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class IsThreadPool -{ -public: - - // - static void ThreadMethod() - { - Console::WriteLine( "ThreadOne, executing ThreadMethod, " - "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " ); - } - - - // - static void WorkMethod( Object^ stateInfo ) - { - Console::WriteLine( "ThreadTwo, executing WorkMethod, " - "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " ); - - // Signal that this thread is finished. - dynamic_cast(stateInfo)->Set(); - } - -}; - -int main() -{ - AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); - Thread^ regularThread = gcnew Thread( gcnew ThreadStart( &IsThreadPool::ThreadMethod ) ); - regularThread->Start(); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &IsThreadPool::WorkMethod ), autoEvent ); - - // Wait for foreground thread to end. - regularThread->Join(); - - // Wait for background thread to end. - autoEvent->WaitOne(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp deleted file mode 100644 index 7ef570a3bad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -ref class Slot -{ -private: - static Random^ randomGenerator = gcnew Random(); - -public: - static void SlotTest() - { - // Set random data in each thread's data slot. - int slotData = randomGenerator->Next(1, 200); - int threadId = Thread::CurrentThread->ManagedThreadId; - - Thread::SetData( - Thread::GetNamedDataSlot("Random"), - slotData); - - // Show what was saved in the thread's data slot. - Console::WriteLine("Data stored in thread_{0}'s data slot: {1,3}", - threadId, slotData); - - // Allow other threads time to execute SetData to show - // that a thread's data slot is unique to itself. - Thread::Sleep(1000); - - int newSlotData = - (int)Thread::GetData(Thread::GetNamedDataSlot("Random")); - - if (newSlotData == slotData) - { - Console::WriteLine("Data in thread_{0}'s data slot is still: {1,3}", - threadId, newSlotData); - } - else - { - Console::WriteLine("Data in thread_{0}'s data slot changed to: {1,3}", - threadId, newSlotData); - } - } -}; - -ref class Test -{ -public: - static void Main() - { - array^ newThreads = gcnew array(4); - int i; - for (i = 0; i < newThreads->Length; i++) - { - newThreads[i] = - gcnew Thread(gcnew ThreadStart(&Slot::SlotTest)); - newThreads[i]->Start(); - } - Thread::Sleep(2000); - for (i = 0; i < newThreads->Length; i++) - { - newThreads[i]->Join(); - Console::WriteLine("Thread_{0} finished.", - newThreads[i]->ManagedThreadId); - } - } -}; - -int main() -{ - Test::Main(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp deleted file mode 100644 index 3f8ee654cfc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -static TimeSpan waitTime = TimeSpan(0,0,1); - -ref class Test -{ -public: - static void Work() - { - Thread::Sleep( waitTime ); - } - -}; - -int main() -{ - Thread^ newThread = gcnew Thread( gcnew ThreadStart( Test::Work ) ); - newThread->Start(); - if ( newThread->Join( waitTime + waitTime ) ) - { - Console::WriteLine( "New thread terminated." ); - } - else - { - Console::WriteLine( "Join timed out." ); - } -} -// The example displays the following output: -// New thread terminated. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp deleted file mode 100644 index d4ca56d299c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class Work -{ -private: - Work(){} - - -public: - static void DoWork(){} - -}; - -int main() -{ - Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Work::DoWork ) ); - newThread->Start(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp deleted file mode 100644 index 0ac57be1362..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class Work -{ -public: - Work(){} - - void DoWork(){} - -}; - -int main() -{ - Work^ threadWork = gcnew Work; - Thread^ newThread = gcnew Thread( gcnew ThreadStart( threadWork, &Work::DoWork ) ); - newThread->Start(); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp deleted file mode 100644 index 2f2ccf1a8d9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -ref class Example -{ -public: - - // This thread procedure performs the task. - static void ThreadProc(Object^ stateInfo) - { - - // No state object was passed to QueueUserWorkItem, so stateInfo is 0. - Console::WriteLine( "Hello from the thread pool." ); - } -}; - -int main() -{ - // Queue the task. - ThreadPool::QueueUserWorkItem(gcnew WaitCallback(Example::ThreadProc)); - - Console::WriteLine("Main thread does some work, then sleeps."); - - Thread::Sleep(1000); - Console::WriteLine("Main thread exits."); - return 0; -} -// The example displays output like the following: -// Main thread does some work, then sleeps. -// Hello from the thread pool. -// Main thread exits. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp deleted file mode 100644 index 94c24506593..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -public ref class Fibonacci -{ -private: - ManualResetEvent^ _doneEvent; - - int Calculate(int n) - { - if (n <= 1) - { - return n; - } - return Calculate(n - 1) + Calculate(n - 2); - } - -public: - - int ID; - int N; - int FibOfN; - - Fibonacci(int id, int n, ManualResetEvent^ doneEvent) - { - ID = id; - N = n; - _doneEvent = doneEvent; - } - - void Calculate() - { - FibOfN = Calculate(N); - } - - void SetDone() - { - _doneEvent->Set(); - } -}; - -public ref struct Example -{ -public: - - static void ThreadProc(Object^ stateInfo) - { - Fibonacci^ f = dynamic_cast(stateInfo); - Console::WriteLine("Thread {0} started...", f->ID); - f->Calculate(); - Console::WriteLine("Thread {0} result calculated...", f->ID); - f->SetDone(); - } -}; - - -void main() -{ - const int FibonacciCalculations = 5; - - array^ doneEvents = gcnew array(FibonacciCalculations); - array^ fibArray = gcnew array(FibonacciCalculations); - Random^ rand = gcnew Random(); - - Console::WriteLine("Launching {0} tasks...", FibonacciCalculations); - - for (int i = 0; i < FibonacciCalculations; i++) - { - doneEvents[i] = gcnew ManualResetEvent(false); - Fibonacci^ f = gcnew Fibonacci(i, rand->Next(20, 40), doneEvents[i]); - fibArray[i] = f; - ThreadPool::QueueUserWorkItem(gcnew WaitCallback(Example::ThreadProc), f); - } - - WaitHandle::WaitAll(doneEvents); - Console::WriteLine("All calculations are complete."); - - for (int i = 0; i < FibonacciCalculations; i++) - { - Fibonacci^ f = fibArray[i]; - Console::WriteLine("Fibonacci({0}) = {1}", f->N, f->FibOfN); - } -} -// Output is similar to: -// Launching 5 tasks... -// Thread 3 started... -// Thread 2 started... -// Thread 1 started... -// Thread 0 started... -// Thread 4 started... -// Thread 4 result calculated... -// Thread 1 result calculated... -// Thread 2 result calculated... -// Thread 0 result calculated... -// Thread 3 result calculated... -// All calculations are complete. -// Fibonacci(30) = 832040 -// Fibonacci(24) = 46368 -// Fibonacci(26) = 121393 -// Fibonacci(36) = 14930352 -// Fibonacci(20) = 6765 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp deleted file mode 100644 index 290d35f3698..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp +++ /dev/null @@ -1,86 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -// TaskInfo contains data that will be passed to the callback -// method. -public ref class TaskInfo -{ -public: - TaskInfo() - { - Handle = nullptr; - OtherInfo = "default"; - } - - RegisteredWaitHandle^ Handle; - String^ OtherInfo; -}; - -ref class Example -{ -public: - - // The callback method executes when the registered wait times out, - // or when the WaitHandle (in this case AutoResetEvent) is signaled. - // WaitProc unregisters the WaitHandle the first time the event is - // signaled. - static void WaitProc( Object^ state, bool timedOut ) - { - - // The state Object must be cast to the correct type, because the - // signature of the WaitOrTimerCallback delegate specifies type - // Object. - TaskInfo^ ti = static_cast(state); - String^ cause = "TIMED OUT"; - if ( !timedOut ) - { - cause = "SIGNALED"; - - // If the callback method executes because the WaitHandle is - // signaled, stop future execution of the callback method - // by unregistering the WaitHandle. - if ( ti->Handle != nullptr ) - ti->Handle->Unregister( nullptr ); - } - - Console::WriteLine( "WaitProc( {0}) executes on thread {1}; cause = {2}.", ti->OtherInfo, Thread::CurrentThread->GetHashCode(), cause ); - } - -}; - -int main() -{ - - // The main thread uses AutoResetEvent to signal the - // registered wait handle, which executes the callback - // method. - AutoResetEvent^ ev = gcnew AutoResetEvent( false ); - TaskInfo^ ti = gcnew TaskInfo; - ti->OtherInfo = "First task"; - - // The TaskInfo for the task includes the registered wait - // handle returned by RegisterWaitForSingleObject. This - // allows the wait to be terminated when the object has - // been signaled once (see WaitProc). - ti->Handle = ThreadPool::RegisterWaitForSingleObject( ev, gcnew WaitOrTimerCallback( Example::WaitProc ), ti, 1000, false ); - - // The main thread waits three seconds, to demonstrate the - // time-outs on the queued thread, and then signals. - Thread::Sleep( 3100 ); - Console::WriteLine( "Main thread signals." ); - ev->Set(); - - // The main thread sleeps, which should give the callback - // method time to execute. If you comment out this line, the - // program usually ends before the ThreadPool thread can execute. - Thread::Sleep( 1000 ); - - // If you start a thread yourself, you can wait for it to end - // by calling Thread::Join. This option is not available with - // thread pool threads. - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp deleted file mode 100644 index 4d728332eac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp +++ /dev/null @@ -1,114 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Permissions; -using namespace System::Threading; - -ref class ThreadPoolTest -{ -private: - - // Maintains state information to be passed to EndWriteCallback. - // This information allows the callback to end the asynchronous - // write operation and signal when it is finished. - ref class State - { - public: - FileStream^ fStream; - AutoResetEvent^ autoEvent; - State( FileStream^ fStream, AutoResetEvent^ autoEvent ) - { - this->fStream = fStream; - this->autoEvent = autoEvent; - } - - }; - - -public: - ThreadPoolTest(){} - - static void EndWriteCallback( IAsyncResult^ asyncResult ) - { - Console::WriteLine( "Starting EndWriteCallback." ); - State^ stateInfo = dynamic_cast(asyncResult->AsyncState); - int workerThreads; - int portThreads; - try - { - ThreadPool::GetAvailableThreads( workerThreads, portThreads ); - Console::WriteLine( "\nAvailable worker threads: \t{0}" - "\nAvailable completion port threads: {1}\n", workerThreads.ToString(), portThreads.ToString() ); - stateInfo->fStream->EndWrite( asyncResult ); - - // Sleep so the other thread has a chance to run - // before the current thread ends. - Thread::Sleep( 1500 ); - } - catch ( Exception^ e ) - { - } - finally - { - - // Signal that the current thread is finished. - stateInfo->autoEvent->Set(); - Console::WriteLine( "Ending EndWriteCallback." ); - } - - } - - static void WorkItemMethod( Object^ mainEvent ) - { - Console::WriteLine( "\nStarting WorkItem.\n" ); - AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); - - // Create some data. - const int ArraySize = 10000; - const int BufferSize = 1000; - array^byteArray = gcnew array(ArraySize); - (gcnew Random)->NextBytes( byteArray ); - - // Create two files and two State objects. - FileStream^ fileWriter1 = gcnew FileStream( "C:\\Test1@##.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite,BufferSize,true ); - FileStream^ fileWriter2 = gcnew FileStream( "C:\\Test2@##.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite,BufferSize,true ); - State^ stateInfo1 = gcnew State( fileWriter1,autoEvent ); - State^ stateInfo2 = gcnew State( fileWriter2,autoEvent ); - - // Asynchronously write to the files. - fileWriter1->BeginWrite( byteArray, 0, byteArray->Length, gcnew AsyncCallback( &ThreadPoolTest::EndWriteCallback ), stateInfo1 ); - fileWriter2->BeginWrite( byteArray, 0, byteArray->Length, gcnew AsyncCallback( &ThreadPoolTest::EndWriteCallback ), stateInfo2 ); - - // Wait for each callback to finish. - autoEvent->WaitOne(); - autoEvent->WaitOne(); - fileWriter1->Close(); - fileWriter2->Close(); - Console::WriteLine( "\nEnding WorkItem.\n" ); - - // Signal Main that the work item is finished. - dynamic_cast(mainEvent)->Set(); - } - -}; - -int main() -{ - AutoResetEvent^ mainEvent = gcnew AutoResetEvent( false ); - int workerThreads; - int portThreads; - ThreadPool::GetMaxThreads( workerThreads, portThreads ); - Console::WriteLine( "\nMaximum worker threads: \t{0}" - "\nMaximum completion port threads: {1}", workerThreads.ToString(), portThreads.ToString() ); - ThreadPool::GetAvailableThreads( workerThreads, portThreads ); - Console::WriteLine( "\nAvailable worker threads: \t{0}" - "\nAvailable completion port threads: {1}\n", workerThreads.ToString(), portThreads.ToString() ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &ThreadPoolTest::WorkItemMethod ), mainEvent ); - - // Since ThreadPool threads are background threads, - // wait for the work item to signal before ending main(). - mainEvent->WaitOne( 5000, false ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp deleted file mode 100644 index 654530d80b8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -int main() -{ - int minWorker; - int minIOC; - - // Get the current settings. - ThreadPool::GetMinThreads( minWorker, minIOC ); - - // Change the minimum number of worker threads to four, but - // keep the old setting for minimum asynchronous I/O - // completion threads. - if ( ThreadPool::SetMinThreads( 4, minIOC ) ) - { - - // The minimum number of threads was set successfully. - } - else - { - - // The minimum number of threads was not changed. - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp deleted file mode 100644 index 3295346dbdc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp +++ /dev/null @@ -1,49 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class Work -{ -public: - static void DoWork() - { - Console::WriteLine( "Static thread procedure." ); - } - - int Data; - void DoMoreWork() - { - Console::WriteLine( "Instance thread procedure. Data={0}", Data ); - } - -}; - -int main() -{ - - // To start a thread using an instance method for the thread - // procedure, specify the object as the first argument of the - // ThreadStart constructor. - // - Work^ w = gcnew Work; - w->Data = 42; - ThreadStart^ threadDelegate = gcnew ThreadStart( w, &Work::DoMoreWork ); - Thread^ newThread = gcnew Thread( threadDelegate ); - newThread->Start(); - - // To start a thread using a static thread procedure, specify - // only the address of the procedure. This is a change from - // earlier versions of the .NET Framework, which required - // two arguments, the first of which was null (0). - // - threadDelegate = gcnew ThreadStart( &Work::DoWork ); - newThread = gcnew Thread( threadDelegate ); - newThread->Start(); -} - -/* This code example produces the following output (the order - of the lines might vary): -Static thread procedure. -Instance thread procedure. Data=42 - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp deleted file mode 100644 index 4dd79b85f2c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -ref class StatusChecker -{ -private: - int invokeCount, maxCount; - -public: - StatusChecker(int count) - { - invokeCount = 0; - maxCount = count; - } - - // This method is called by the timer delegate. - void CheckStatus(Object^ stateInfo) - { - AutoResetEvent^ autoEvent = dynamic_cast(stateInfo); - Console::WriteLine("{0:h:mm:ss.fff} Checking status {1,2}.", - DateTime::Now, ++invokeCount); - - if (invokeCount == maxCount) { - // Reset the counter and signal the waiting thread. - invokeCount = 0; - autoEvent->Set(); - } - } -}; - -ref class TimerExample -{ -public: - static void Main() - { - // Create an AutoResetEvent to signal the timeout threshold in the - // timer callback has been reached. - AutoResetEvent^ autoEvent = gcnew AutoResetEvent(false); - - StatusChecker^ statusChecker = gcnew StatusChecker(10); - - // Create a delegate that invokes methods for the timer. - TimerCallback^ tcb = - gcnew TimerCallback(statusChecker, &StatusChecker::CheckStatus); - - // Create a timer that invokes CheckStatus after one second, - // and every 1/4 second thereafter. - Console::WriteLine("{0:h:mm:ss.fff} Creating timer.\n", - DateTime::Now); - Timer^ stateTimer = gcnew Timer(tcb, autoEvent, 1000, 250); - - // When autoEvent signals, change the period to every half second. - autoEvent->WaitOne(5000, false); - stateTimer->Change(0, 500); - Console::WriteLine("\nChanging period to .5 seconds.\n"); - - // When autoEvent signals the second time, dispose of the timer. - autoEvent->WaitOne(5000, false); - stateTimer->~Timer(); - Console::WriteLine("\nDestroying timer."); - } -}; - -int main() -{ - TimerExample::Main(); -} -// The example displays output like the following: -// 11:59:54.202 Creating timer. -// -// 11:59:55.217 Checking status 1. -// 11:59:55.466 Checking status 2. -// 11:59:55.716 Checking status 3. -// 11:59:55.968 Checking status 4. -// 11:59:56.218 Checking status 5. -// 11:59:56.470 Checking status 6. -// 11:59:56.722 Checking status 7. -// 11:59:56.972 Checking status 8. -// 11:59:57.223 Checking status 9. -// 11:59:57.473 Checking status 10. -// -// Changing period to .5 seconds. -// -// 11:59:57.474 Checking status 1. -// 11:59:57.976 Checking status 2. -// 11:59:58.476 Checking status 3. -// 11:59:58.977 Checking status 4. -// 11:59:59.477 Checking status 5. -// 11:59:59.977 Checking status 6. -// 12:00:00.478 Checking status 7. -// 12:00:00.980 Checking status 8. -// 12:00:01.481 Checking status 9. -// 12:00:01.981 Checking status 10. -// -// Destroying timer. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp deleted file mode 100644 index ec633fe45b1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp +++ /dev/null @@ -1,59 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class StatusChecker -{ -private: - int invokeCount; - int maxCount; - -public: - StatusChecker( int count ) - : invokeCount( 0 ), maxCount( count ) - {} - - - // This method is called by the timer delegate. - void CheckStatus( Object^ stateInfo ) - { - AutoResetEvent^ autoEvent = dynamic_cast(stateInfo); - Console::WriteLine( "{0} Checking status {1,2}.", DateTime::Now.ToString( "h:mm:ss.fff" ), (++invokeCount).ToString() ); - if ( invokeCount == maxCount ) - { - - // Reset the counter and signal main. - invokeCount = 0; - autoEvent->Set(); - } - } - -}; - -int main() -{ - AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); - StatusChecker^ statusChecker = gcnew StatusChecker( 10 ); - - // Create the delegate that invokes methods for the timer. - TimerCallback^ timerDelegate = gcnew TimerCallback( statusChecker, &StatusChecker::CheckStatus ); - TimeSpan delayTime = TimeSpan(0,0,1); - TimeSpan intervalTime = TimeSpan(0,0,0,0,250); - - // Create a timer that signals the delegate to invoke CheckStatus - // after one second, and every 1/4 second thereafter. - Console::WriteLine( "{0} Creating timer.\n", DateTime::Now.ToString( "h:mm:ss.fff" ) ); - Timer^ stateTimer = gcnew Timer( timerDelegate,autoEvent,delayTime,intervalTime ); - - // When autoEvent signals, change the period to every 1/2 second. - autoEvent->WaitOne( 5000, false ); - stateTimer->Change( TimeSpan(0), intervalTime + intervalTime ); - Console::WriteLine( "\nChanging period.\n" ); - - // When autoEvent signals the second time, dispose of the timer. - autoEvent->WaitOne( 5000, false ); - stateTimer->~Timer(); - Console::WriteLine( "\nDestroying timer." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp deleted file mode 100644 index 2de583f098d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp +++ /dev/null @@ -1,125 +0,0 @@ -// -using namespace System; -using namespace System::Threading; - -public ref class Example -{ -private: - // The EventWaitHandle used to demonstrate the difference - // between AutoReset and ManualReset synchronization events. - // - static EventWaitHandle^ ewh; - - // A counter to make sure all threads are started and - // blocked before any are released. A Long is used to show - // the use of the 64-bit Interlocked methods. - // - static __int64 threadCount = 0; - - // An AutoReset event that allows the main thread to block - // until an exiting thread has decremented the count. - // - static EventWaitHandle^ clearCount = - gcnew EventWaitHandle( false,EventResetMode::AutoReset ); - -public: - [MTAThread] - static void main() - { - // Create an AutoReset EventWaitHandle. - // - ewh = gcnew EventWaitHandle( false,EventResetMode::AutoReset ); - - // Create and start five numbered threads. Use the - // ParameterizedThreadStart delegate, so the thread - // number can be passed as an argument to the Start - // method. - for ( int i = 0; i <= 4; i++ ) - { - Thread^ t = gcnew Thread( - gcnew ParameterizedThreadStart( ThreadProc ) ); - t->Start( i ); - } - - // Wait until all the threads have started and blocked. - // When multiple threads use a 64-bit value on a 32-bit - // system, you must access the value through the - // Interlocked class to guarantee thread safety. - // - while ( Interlocked::Read( threadCount ) < 5 ) - { - Thread::Sleep( 500 ); - } - - // Release one thread each time the user presses ENTER, - // until all threads have been released. - // - while ( Interlocked::Read( threadCount ) > 0 ) - { - Console::WriteLine( L"Press ENTER to release a waiting thread." ); - Console::ReadLine(); - - // SignalAndWait signals the EventWaitHandle, which - // releases exactly one thread before resetting, - // because it was created with AutoReset mode. - // SignalAndWait then blocks on clearCount, to - // allow the signaled thread to decrement the count - // before looping again. - // - WaitHandle::SignalAndWait( ewh, clearCount ); - } - Console::WriteLine(); - - // Create a ManualReset EventWaitHandle. - // - ewh = gcnew EventWaitHandle( false,EventResetMode::ManualReset ); - - // Create and start five more numbered threads. - // - for ( int i = 0; i <= 4; i++ ) - { - Thread^ t = gcnew Thread( - gcnew ParameterizedThreadStart( ThreadProc ) ); - t->Start( i ); - } - - // Wait until all the threads have started and blocked. - // - while ( Interlocked::Read( threadCount ) < 5 ) - { - Thread::Sleep( 500 ); - } - - // Because the EventWaitHandle was created with - // ManualReset mode, signaling it releases all the - // waiting threads. - // - Console::WriteLine( L"Press ENTER to release the waiting threads." ); - Console::ReadLine(); - ewh->Set(); - - } - - static void ThreadProc( Object^ data ) - { - int index = static_cast(data); - - Console::WriteLine( L"Thread {0} blocks.", data ); - // Increment the count of blocked threads. - Interlocked::Increment( threadCount ); - - // Wait on the EventWaitHandle. - ewh->WaitOne(); - - Console::WriteLine( L"Thread {0} exits.", data ); - // Decrement the count of blocked threads. - Interlocked::Decrement( threadCount ); - - // After signaling ewh, the main thread blocks on - // clearCount until the signaled thread has - // decremented the count. Signal it now. - // - clearCount->Set(); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp deleted file mode 100644 index 77becf280e4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Permissions; -using namespace System::Threading; - -ref class State -{ -public: - String^ fileName; - array^byteArray; - ManualResetEvent^ manualEvent; - State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent ) - : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent ) - {} - -}; - -ref class Writer -{ -private: - static int workItemCount = 0; - Writer(){} - - -public: - static void WriteToFile( Object^ state ) - { - int workItemNumber = workItemCount; - Interlocked::Increment( workItemCount ); - Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() ); - State^ stateInfo = dynamic_cast(state); - FileStream^ fileWriter; - - // Create and write to the file. - try - { - fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create ); - fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length ); - } - finally - { - if ( fileWriter != nullptr ) - { - fileWriter->Close(); - } - - // Signal main() that the work item has finished. - Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() ); - stateInfo->manualEvent->Set(); - } - - } - -}; - -void main() -{ - const int numberOfFiles = 5; - String^ dirName = "C:\\TestTest"; - String^ fileName; - array^byteArray; - Random^ randomGenerator = gcnew Random; - array^manualEvents = gcnew array(numberOfFiles); - State^ stateInfo; - if ( !Directory::Exists( dirName ) ) - { - Directory::CreateDirectory( dirName ); - } - - - // Queue the work items that create and write to the files. - for ( int i = 0; i < numberOfFiles; i++ ) - { - fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" ); - - // Create random data to write to the file. - byteArray = gcnew array(1000000); - randomGenerator->NextBytes( byteArray ); - manualEvents[ i ] = gcnew ManualResetEvent( false ); - stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo ); - - } - - // Since ThreadPool threads are background threads, - // wait for the work items to signal before exiting. - WaitHandle::WaitAll( manualEvents ); - Console::WriteLine( "Files written - main exiting." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp deleted file mode 100644 index 8cad6cf4acd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Permissions; -using namespace System::Threading; - -// Maintain state to pass to WriteToFile. -ref class State -{ -public: - String^ fileName; - array^byteArray; - ManualResetEvent^ manualEvent; - State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent ) - : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent ) - {} - -}; - -ref class Writer -{ -private: - static int workItemCount = 0; - Writer(){} - - -public: - static void WriteToFile( Object^ state ) - { - int workItemNumber = workItemCount; - Interlocked::Increment( workItemCount ); - Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() ); - State^ stateInfo = dynamic_cast(state); - FileStream^ fileWriter; - - // Create and write to the file. - try - { - fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create ); - fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length ); - } - finally - { - if ( fileWriter != nullptr ) - { - fileWriter->Close(); - } - - // Signal main() that the work item has finished. - Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() ); - stateInfo->manualEvent->Set(); - } - - } - -}; - -int main() -{ - const int numberOfFiles = 5; - String^ dirName = "C:\\TestTest"; - String^ fileName; - array^byteArray; - Random^ randomGenerator = gcnew Random; - array^manualEvents = gcnew array(numberOfFiles); - State^ stateInfo; - if ( !Directory::Exists( dirName ) ) - { - Directory::CreateDirectory( dirName ); - } - - - // Queue the work items that create and write to the files. - for ( int i = 0; i < numberOfFiles; i++ ) - { - fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" ); - - // Create random data to write to the file. - byteArray = gcnew array(1000000); - randomGenerator->NextBytes( byteArray ); - manualEvents[ i ] = gcnew ManualResetEvent( false ); - stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo ); - - } - - // Since ThreadPool threads are background threads, - // wait for the work items to signal before exiting. - if ( WaitHandle::WaitAll( manualEvents, 5000, false ) ) - { - Console::WriteLine( "Files written - main exiting." ); - } - else - { - - // The wait operation times out. - Console::WriteLine( "Error writing files - main exiting." ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp deleted file mode 100644 index 6044e88bdcc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp +++ /dev/null @@ -1,102 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Security::Permissions; -using namespace System::Threading; - -// Maintain state to pass to WriteToFile. -ref class State -{ -public: - String^ fileName; - array^byteArray; - ManualResetEvent^ manualEvent; - State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent ) - : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent ) - {} - -}; - -ref class Writer -{ -private: - static int workItemCount = 0; - Writer(){} - - -public: - static void WriteToFile( Object^ state ) - { - int workItemNumber = workItemCount; - Interlocked::Increment( workItemCount ); - Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() ); - State^ stateInfo = dynamic_cast(state); - FileStream^ fileWriter; - - // Create and write to the file. - try - { - fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create ); - fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length ); - } - finally - { - if ( fileWriter != nullptr ) - { - fileWriter->Close(); - } - - // Signal main() that the work item has finished. - Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() ); - stateInfo->manualEvent->Set(); - } - - } - -}; - -int main() -{ - const int numberOfFiles = 5; - String^ dirName = "C:\\TestTest"; - String^ fileName; - array^byteArray; - Random^ randomGenerator = gcnew Random; - array^manualEvents = gcnew array(numberOfFiles); - State^ stateInfo; - if ( !Directory::Exists( dirName ) ) - { - Directory::CreateDirectory( dirName ); - } - - - // Queue the work items that create and write to the files. - for ( int i = 0; i < numberOfFiles; i++ ) - { - fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" ); - - // Create random data to write to the file. - byteArray = gcnew array(1000000); - randomGenerator->NextBytes( byteArray ); - manualEvents[ i ] = gcnew ManualResetEvent( false ); - stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo ); - - } - - // Since ThreadPool threads are background threads, - // wait for the work items to signal before exiting. - if ( WaitHandle::WaitAll( manualEvents, TimeSpan(0,0,5), false ) ) - { - Console::WriteLine( "Files written - main exiting." ); - } - else - { - - // The wait operation times out. - Console::WriteLine( "Error writing files - main exiting." ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp deleted file mode 100644 index 5873df3b3ad..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Threading; -ref class Search -{ -private: - - // Maintain state information to pass to FindCallback. - ref class State - { - public: - AutoResetEvent^ autoEvent; - String^ fileName; - State( AutoResetEvent^ autoEvent, String^ fileName ) - : autoEvent( autoEvent ), fileName( fileName ) - {} - - }; - - -public: - array^autoEvents; - array^diskLetters; - - // Search for stateInfo->fileName. - void FindCallback( Object^ state ) - { - State^ stateInfo = dynamic_cast(state); - - // Signal if the file is found. - if ( File::Exists( stateInfo->fileName ) ) - { - stateInfo->autoEvent->Set(); - } - } - - Search() - { - - // Retrieve an array of disk letters. - diskLetters = Environment::GetLogicalDrives(); - autoEvents = gcnew array(diskLetters->Length); - for ( int i = 0; i < diskLetters->Length; i++ ) - { - autoEvents[ i ] = gcnew AutoResetEvent( false ); - - } - } - - - // Search for fileName in the root directory of all disks. - void FindFile( String^ fileName ) - { - for ( int i = 0; i < diskLetters->Length; i++ ) - { - Console::WriteLine( "Searching for {0} on {1}.", fileName, diskLetters[ i ] ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( this, &Search::FindCallback ), gcnew State( autoEvents[ i ],String::Concat( diskLetters[ i ], fileName ) ) ); - - } - - // Wait for the first instance of the file to be found. - int index = WaitHandle::WaitAny( autoEvents, 3000, false ); - if ( index == WaitHandle::WaitTimeout ) - { - Console::WriteLine( "\n{0} not found.", fileName ); - } - else - { - Console::WriteLine( "\n{0} found on {1}.", fileName, diskLetters[ index ] ); - } - } - -}; - -int main() -{ - Search^ search = gcnew Search; - search->FindFile( "SomeFile.dat" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp deleted file mode 100644 index c8fbef542b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp +++ /dev/null @@ -1,83 +0,0 @@ - -// -using namespace System; -using namespace System::IO; -using namespace System::Threading; -ref class Search -{ -private: - - // Maintain state information to pass to FindCallback. - ref class State - { - public: - AutoResetEvent^ autoEvent; - String^ fileName; - State( AutoResetEvent^ autoEvent, String^ fileName ) - : autoEvent( autoEvent ), fileName( fileName ) - {} - - }; - - -public: - array^autoEvents; - array^diskLetters; - - // Search for stateInfo->fileName. - void FindCallback( Object^ state ) - { - State^ stateInfo = dynamic_cast(state); - - // Signal if the file is found. - if ( File::Exists( stateInfo->fileName ) ) - { - stateInfo->autoEvent->Set(); - } - } - - Search() - { - - // Retrieve an array of disk letters. - diskLetters = Environment::GetLogicalDrives(); - autoEvents = gcnew array(diskLetters->Length); - for ( int i = 0; i < diskLetters->Length; i++ ) - { - autoEvents[ i ] = gcnew AutoResetEvent( false ); - - } - } - - - // Search for fileName in the root directory of all disks. - void FindFile( String^ fileName ) - { - for ( int i = 0; i < diskLetters->Length; i++ ) - { - Console::WriteLine( "Searching for {0} on {1}.", fileName, diskLetters[ i ] ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( this, &Search::FindCallback ), gcnew State( autoEvents[ i ],String::Concat( diskLetters[ i ], fileName ) ) ); - - } - - // Wait for the first instance of the file to be found. - int index = WaitHandle::WaitAny( autoEvents, TimeSpan(0,0,3), false ); - if ( index == WaitHandle::WaitTimeout ) - { - Console::WriteLine( "\n{0} not found.", fileName ); - } - else - { - Console::WriteLine( "\n{0} found on {1}.", fileName, diskLetters[ index ] ); - } - } - -}; - -int main() -{ - Search^ search = gcnew Search; - search->FindFile( "SomeFile.dat" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp deleted file mode 100644 index 1e895c2aace..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp +++ /dev/null @@ -1,37 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class WaitOne -{ -private: - WaitOne(){} - - -public: - static void WorkMethod( Object^ stateInfo ) - { - Console::WriteLine( "Work starting." ); - - // Simulate time spent working. - Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) ); - - // Signal that work is finished. - Console::WriteLine( "Work ending." ); - dynamic_cast(stateInfo)->Set(); - } - -}; - -int main() -{ - Console::WriteLine( "Main starting." ); - AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent ); - - // Wait for work method to signal. - autoEvent->WaitOne( ); - Console::WriteLine( "Work method signaled.\nMain ending." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp deleted file mode 100644 index 2d2d9d3a98f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class WaitOne -{ -private: - WaitOne(){} - - -public: - static void WorkMethod( Object^ stateInfo ) - { - Console::WriteLine( "Work starting." ); - - // Simulate time spent working. - Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) ); - - // Signal that work is finished. - Console::WriteLine( "Work ending." ); - dynamic_cast(stateInfo)->Set(); - } - -}; - -int main() -{ - Console::WriteLine( "Main starting." ); - AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent ); - - // Wait for work method to signal. - if ( autoEvent->WaitOne( 1000 ) ) - { - Console::WriteLine( "Work method signaled." ); - } - else - { - Console::WriteLine( "Timed out waiting for work " - "method to signal." ); - } - - Console::WriteLine( "Main ending." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp deleted file mode 100644 index d43bd113677..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; -ref class WaitOne -{ -private: - WaitOne(){} - - -public: - static void WorkMethod( Object^ stateInfo ) - { - Console::WriteLine( "Work starting." ); - - // Simulate time spent working. - Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) ); - - // Signal that work is finished. - Console::WriteLine( "Work ending." ); - dynamic_cast(stateInfo)->Set(); - } - -}; - -int main() -{ - Console::WriteLine( "Main starting." ); - AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); - ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent ); - - // Wait for work method to signal. - if ( autoEvent->WaitOne( TimeSpan(0,0,1), false ) ) - { - Console::WriteLine( "Work method signaled." ); - } - else - { - Console::WriteLine( "Timed out waiting for work " - "method to signal." ); - } - - Console::WriteLine( "Main ending." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp deleted file mode 100644 index fba1b99c662..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp +++ /dev/null @@ -1,64 +0,0 @@ - -// -// Example of the TimeSpan::Compare( TimeSpan, TimeSpan ) and -// TimeSpan::Equals( TimeSpan, TimeSpan ) methods. -using namespace System; -const __wchar_t * protoFmt = L"{0,-38}{1}"; - -// Compare TimeSpan parameters, and display them with the results. -void CompareTimeSpans( TimeSpan Left, TimeSpan Right, String^ RightText ) -{ - String^ dataFmt = gcnew String( protoFmt ); - Console::WriteLine(); - Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); - Console::WriteLine( dataFmt, "TimeSpan::Equals( Left, Right )", TimeSpan::Equals( Left, Right ) ); - Console::WriteLine( dataFmt, "TimeSpan::Compare( Left, Right )", TimeSpan::Compare( Left, Right ) ); -} - -int main() -{ - TimeSpan Left = TimeSpan(2,0,0); - Console::WriteLine( "This example of the TimeSpan::Equals( TimeSpan, TimeSpan " - ") and \nTimeSpan::Compare( TimeSpan, TimeSpan ) " - "methods generates the \nfollowing output by creating " - "several different TimeSpan \nobjects and comparing " - "them with a 2-hour TimeSpan.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "Left: TimeSpan( 2, 0, 0 )", Left ); - - // Create objects to compare with a 2-hour TimeSpan. - CompareTimeSpans( Left, TimeSpan(0,120,0), "TimeSpan( 0, 120, 0 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,1), "TimeSpan( 2, 0, 1 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,-1), "TimeSpan( 2, 0, -1 )" ); - CompareTimeSpans( Left, TimeSpan(72000000000), "TimeSpan( 72000000000 )" ); - CompareTimeSpans( Left, TimeSpan::FromDays( 1.0 / 12. ), "TimeSpan::FromDays( 1 / 12 )" ); -} - -/* -This example of the TimeSpan::Equals( TimeSpan, TimeSpan ) and -TimeSpan::Compare( TimeSpan, TimeSpan ) methods generates the -following output by creating several different TimeSpan -objects and comparing them with a 2-hour TimeSpan. - -Left: TimeSpan( 2, 0, 0 ) 02:00:00 - -Right: TimeSpan( 0, 120, 0 ) 02:00:00 -TimeSpan::Equals( Left, Right ) True -TimeSpan::Compare( Left, Right ) 0 - -Right: TimeSpan( 2, 0, 1 ) 02:00:01 -TimeSpan::Equals( Left, Right ) False -TimeSpan::Compare( Left, Right ) -1 - -Right: TimeSpan( 2, 0, -1 ) 01:59:59 -TimeSpan::Equals( Left, Right ) False -TimeSpan::Compare( Left, Right ) 1 - -Right: TimeSpan( 72000000000 ) 02:00:00 -TimeSpan::Equals( Left, Right ) True -TimeSpan::Compare( Left, Right ) 0 - -Right: TimeSpan::FromDays( 1 / 12 ) 02:00:00 -TimeSpan::Equals( Left, Right ) True -TimeSpan::Compare( Left, Right ) 0 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp deleted file mode 100644 index 3c27f181be1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp +++ /dev/null @@ -1,78 +0,0 @@ - -// -// Example of the TimeSpan::CompareTo( Object* ) and -// TimeSpan::Equals( Object* ) methods. -using namespace System; - -// Compare the TimeSpan to the Object parameters, -// and display the Object parameters with the results. -void CompTimeSpanToObject( TimeSpan Left, Object^ Right, String^ RightText ) -{ - Console::WriteLine( "{0,-33}{1}", String::Concat( "Object: ", RightText ), Right ); - Console::WriteLine( "{0,-33}{1}", "Left.Equals( Object )", Left.Equals( Right ) ); - Console::Write( "{0,-33}", "Left.CompareTo( Object )" ); - - // Catch the exception if CompareTo( ) throws one. - try - { - Console::WriteLine( "{0}\n", Left.CompareTo( Right ) ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Error: {0}\n", ex->Message ); - } - -} - -int main() -{ - TimeSpan Left = TimeSpan(0,5,0); - Console::WriteLine( "This example of the TimeSpan::Equals( Object* ) " - "and \nTimeSpan::CompareTo( Object* ) methods generates " - "the \nfollowing output by creating several different " - "TimeSpan \nobjects and comparing them with a " - "5-minute TimeSpan.\n" ); - Console::WriteLine( "{0,-33}{1}\n", "Left: TimeSpan( 0, 5, 0 )", Left ); - - // Create objects to compare with a 5-minute TimeSpan. - CompTimeSpanToObject( Left, TimeSpan(0,0,300), "TimeSpan( 0, 0, 300 )" ); - CompTimeSpanToObject( Left, TimeSpan(0,5,1), "TimeSpan( 0, 5, 1 )" ); - CompTimeSpanToObject( Left, TimeSpan(0,5,-1), "TimeSpan( 0, 5, -1 )" ); - CompTimeSpanToObject( Left, TimeSpan(3000000000), "TimeSpan( 3000000000 )" ); - CompTimeSpanToObject( Left, 3000000000L, "__int64 3000000000L" ); - CompTimeSpanToObject( Left, "00:05:00", "String \"00:05:00\"" ); -} - -/* -This example of the TimeSpan::Equals( Object* ) and -TimeSpan::CompareTo( Object* ) methods generates the -following output by creating several different TimeSpan -objects and comparing them with a 5-minute TimeSpan. - -Left: TimeSpan( 0, 5, 0 ) 00:05:00 - -Object: TimeSpan( 0, 0, 300 ) 00:05:00 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: TimeSpan( 0, 5, 1 ) 00:05:01 -Left.Equals( Object ) False -Left.CompareTo( Object ) -1 - -Object: TimeSpan( 0, 5, -1 ) 00:04:59 -Left.Equals( Object ) False -Left.CompareTo( Object ) 1 - -Object: TimeSpan( 3000000000 ) 00:05:00 -Left.Equals( Object ) True -Left.CompareTo( Object ) 0 - -Object: __int64 3000000000L 3000000000 -Left.Equals( Object ) False -Left.CompareTo( Object ) Error: Object must be of type TimeSpan. - -Object: String "00:05:00" 00:05:00 -Left.Equals( Object ) False -Left.CompareTo( Object ) Error: Object must be of type TimeSpan. -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp deleted file mode 100644 index f60d07081bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp +++ /dev/null @@ -1,45 +0,0 @@ - -// -// Example of the TimeSpan( int, int, int ) constructor. -using namespace System; - -// Create a TimeSpan object and display its value. -static void CreateTimeSpan( int hours, int minutes, int seconds ) -{ - TimeSpan elapsedTime = TimeSpan(hours,minutes,seconds); - - // Format the constructor for display. - String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2} )", hours, minutes, seconds ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-37}{1,16}", ctor, elapsedTime.ToString() ); -} - -int main() -{ - Console::WriteLine( "This example of the TimeSpan( int, int, int ) " - "\nconstructor generates the following output.\n" ); - Console::WriteLine( "{0,-37}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-37}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 10, 20, 30 ); - CreateTimeSpan( -10, 20, 30 ); - CreateTimeSpan( 0, 0, 37230 ); - CreateTimeSpan( 1000, 2000, 3000 ); - CreateTimeSpan( 1000, -2000, -3000 ); - CreateTimeSpan( 999999, 999999, 999999 ); -} - -/* -This example of the TimeSpan( int, int, int ) -constructor generates the following output. - -Constructor Value ------------ ----- -TimeSpan( 10, 20, 30 ) 10:20:30 -TimeSpan( -10, 20, 30 ) -09:39:30 -TimeSpan( 0, 0, 37230 ) 10:20:30 -TimeSpan( 1000, 2000, 3000 ) 43.02:10:00 -TimeSpan( 1000, -2000, -3000 ) 40.05:50:00 -TimeSpan( 999999, 999999, 999999 ) 42372.15:25:39 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp deleted file mode 100644 index 4a1c4233cf3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp +++ /dev/null @@ -1,42 +0,0 @@ - -// -using namespace System; - -// Create a TimeSpan object and display its value. -void CreateTimeSpan( int days, int hours, int minutes, int seconds ) -{ - TimeSpan elapsedTime = TimeSpan(days,hours,minutes,seconds); - - // Format the constructor for display. - array^boxedParams = gcnew array(4); - boxedParams[ 0 ] = days; - boxedParams[ 1 ] = hours; - boxedParams[ 2 ] = minutes; - boxedParams[ 3 ] = seconds; - String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2}, {3} )", boxedParams ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-44}{1,16}", ctor, elapsedTime.ToString() ); -} - -int main() -{ - Console::WriteLine( "{0,-44}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-44}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 10, 20, 30, 40 ); - CreateTimeSpan( -10, 20, 30, 40 ); - CreateTimeSpan( 0, 0, 0, 937840 ); - CreateTimeSpan( 1000, 2000, 3000, 4000 ); - CreateTimeSpan( 1000, -2000, -3000, -4000 ); - CreateTimeSpan( 999999, 999999, 999999, 999999 ); -} -// The example displays the following output: -// Constructor Value -// ----------- ----- -// TimeSpan( 10, 20, 30, 40 ) 10.20:30:40 -// TimeSpan( -10, 20, 30, 40 ) -9.03:29:20 -// TimeSpan( 0, 0, 0, 937840 ) 10.20:30:40 -// TimeSpan( 1000, 2000, 3000, 4000 ) 1085.11:06:40 -// TimeSpan( 1000, -2000, -3000, -4000 ) 914.12:53:20 -// TimeSpan( 999999, 999999, 999999, 999999 ) 1042371.15:25:39 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp deleted file mode 100644 index 2806b7c4188..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp +++ /dev/null @@ -1,51 +0,0 @@ - -// -// Example of the TimeSpan( int, int, int, int, int ) constructor. -using namespace System; - -// Create a TimeSpan object and display its value. -void CreateTimeSpan( int days, int hours, int minutes, int seconds, int millisec ) -{ - TimeSpan elapsedTime = TimeSpan(days,hours,minutes,seconds,millisec); - - // Format the constructor for display. - array^boxedParams = gcnew array(5); - boxedParams[ 0 ] = days; - boxedParams[ 1 ] = hours; - boxedParams[ 2 ] = minutes; - boxedParams[ 3 ] = seconds; - boxedParams[ 4 ] = millisec; - String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2}, {3}, {4} )", boxedParams ); - - // Display the constructor and its value. - Console::WriteLine( "{0,-48}{1,24}", ctor, elapsedTime.ToString() ); -} - -int main() -{ - Console::WriteLine( "This example of the TimeSpan( int, int, int, int, int ) " - "\nconstructor generates the following output.\n" ); - Console::WriteLine( "{0,-48}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-48}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 10, 20, 30, 40, 50 ); - CreateTimeSpan( -10, 20, 30, 40, 50 ); - CreateTimeSpan( 0, 0, 0, 0, 937840050 ); - CreateTimeSpan( 1111, 2222, 3333, 4444, 5555 ); - CreateTimeSpan( 1111, -2222, -3333, -4444, -5555 ); - CreateTimeSpan( 99999, 99999, 99999, 99999, 99999 ); -} - -/* -This example of the TimeSpan( int, int, int, int, int ) -constructor generates the following output. - -Constructor Value ------------ ----- -TimeSpan( 10, 20, 30, 40, 50 ) 10.20:30:40.0500000 -TimeSpan( -10, 20, 30, 40, 50 ) -9.03:29:19.9500000 -TimeSpan( 0, 0, 0, 0, 937840050 ) 10.20:30:40.0500000 -TimeSpan( 1111, 2222, 3333, 4444, 5555 ) 1205.22:47:09.5550000 -TimeSpan( 1111, -2222, -3333, -4444, -5555 ) 1016.01:12:50.4450000 -TimeSpan( 99999, 99999, 99999, 99999, 99999 ) 104236.05:27:18.9990000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp deleted file mode 100644 index d5dd9f79124..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -// Example of the TimeSpan( __int64 ) constructor. -using namespace System; - -// Create a TimeSpan object and display its value. -void CreateTimeSpan( __int64 ticks ) -{ - TimeSpan elapsedTime = TimeSpan(ticks); - - // Format the constructor for display. - String^ ctor = String::Format( "TimeSpan( {0} )", ticks ); - - // Pad the end of a TimeSpan string with spaces if - // it does not contain milliseconds. - String^ elapsedStr = elapsedTime.ToString(); - int pointIndex = elapsedStr->IndexOf( ':' ); - pointIndex = elapsedStr->IndexOf( '.', pointIndex ); - if ( pointIndex < 0 ) - elapsedStr = String::Concat( elapsedStr, " " ); - - - // Display the constructor and its value. - Console::WriteLine( "{0,-33}{1,24}", ctor, elapsedStr ); -} - -int main() -{ - Console::WriteLine( "This example of the TimeSpan( __int64 ) constructor " - "\ngenerates the following output.\n" ); - Console::WriteLine( "{0,-33}{1,16}", "Constructor", "Value" ); - Console::WriteLine( "{0,-33}{1,16}", "-----------", "-----" ); - CreateTimeSpan( 1 ); - CreateTimeSpan( 999999 ); - CreateTimeSpan( -1000000000000 ); - CreateTimeSpan( 18012202000000 ); - CreateTimeSpan( 999999999999999999 ); - CreateTimeSpan( 1000000000000000000 ); -} - -/* -This example of the TimeSpan( __int64 ) constructor -generates the following output. - -Constructor Value ------------ ----- -TimeSpan( 1 ) 00:00:00.0000001 -TimeSpan( 999999 ) 00:00:00.0999999 -TimeSpan( -1000000000000 ) -1.03:46:40 -TimeSpan( 18012202000000 ) 20.20:20:20.2000000 -TimeSpan( 999999999999999999 ) 1157407.09:46:39.9999999 -TimeSpan( 1000000000000000000 ) 1157407.09:46:40 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp deleted file mode 100644 index 82a2aebbbc8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -// Example of the TimeSpan::Duration( ) and TimeSpan::Negate( ) methods, -// and the TimeSpan Unary Negation and Unary Plus operators. -using namespace System; -const __wchar_t * protoFmt = L"{0,22}{1,22}{2,22}"; -void ShowDurationNegate( TimeSpan interval ) -{ - - // Display the TimeSpan value and the results of the - // Duration and Negate methods. - Console::WriteLine( gcnew String( protoFmt ), interval, interval.Duration(), interval.Negate() ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::Duration( ), " - "TimeSpan::Negate( ), \nand the TimeSpan Unary " - "Negation and Unary Plus operators \n" - "generates the following output.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "TimeSpan", "Duration( )", "Negate( )" ); - Console::WriteLine( gcnew String( protoFmt ), "--------", "-----------", "---------" ); - - // Create TimeSpan objects and apply the Unary Negation - // and Unary Plus operators to them. - ShowDurationNegate( TimeSpan(1) ); - ShowDurationNegate( TimeSpan( -1234567) ); - ShowDurationNegate( +TimeSpan(0,0,10,-20,-30) ); - ShowDurationNegate( +TimeSpan(0,-10,20,-30,40) ); - ShowDurationNegate( -TimeSpan(1,10,20,40,160) ); - ShowDurationNegate( -TimeSpan( -10,-20,-30,-40,-50) ); -} - -/* -This example of TimeSpan::Duration( ), TimeSpan::Negate( ), -and the TimeSpan Unary Negation and Unary Plus operators -generates the following output. - - TimeSpan Duration( ) Negate( ) - -------- ----------- --------- - 00:00:00.0000001 00:00:00.0000001 -00:00:00.0000001 - -00:00:00.1234567 00:00:00.1234567 00:00:00.1234567 - 00:09:39.9700000 00:09:39.9700000 -00:09:39.9700000 - -09:40:29.9600000 09:40:29.9600000 09:40:29.9600000 - -1.10:20:40.1600000 1.10:20:40.1600000 1.10:20:40.1600000 - 10.20:30:40.0500000 10.20:30:40.0500000 -10.20:30:40.0500000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp deleted file mode 100644 index c72d87bcf54..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan fields. -using namespace System; - -// Pad the end of a TimeSpan string with spaces if it does not -// contain milliseconds. -String^ Align( TimeSpan interval ) -{ - String^ intervalStr = interval.ToString(); - int pointIndex = intervalStr->IndexOf( ':' ); - pointIndex = intervalStr->IndexOf( '.', pointIndex ); - if ( pointIndex < 0 ) - intervalStr = String::Concat( intervalStr, " " ); - - return intervalStr; -} - -int main() -{ - String^ numberFmt = "{0,-22}{1,18:N0}"; - String^ timeFmt = "{0,-22}{1,26}"; - Console::WriteLine( "This example of the fields of the TimeSpan class" - "\ngenerates the following output.\n" ); - Console::WriteLine( numberFmt, "Field", "Value" ); - Console::WriteLine( numberFmt, "-----", "-----" ); - - // Display the maximum, minimum, and zero TimeSpan values. - Console::WriteLine( timeFmt, "Maximum TimeSpan", Align( TimeSpan::MaxValue ) ); - Console::WriteLine( timeFmt, "Minimum TimeSpan", Align( TimeSpan::MinValue ) ); - Console::WriteLine( timeFmt, "Zero TimeSpan", Align( TimeSpan::Zero ) ); - Console::WriteLine(); - - // Display the ticks-per-time-unit fields. - Console::WriteLine( numberFmt, "Ticks per day", TimeSpan::TicksPerDay ); - Console::WriteLine( numberFmt, "Ticks per hour", TimeSpan::TicksPerHour ); - Console::WriteLine( numberFmt, "Ticks per minute", TimeSpan::TicksPerMinute ); - Console::WriteLine( numberFmt, "Ticks per second", TimeSpan::TicksPerSecond ); - Console::WriteLine( numberFmt, "Ticks per millisecond", TimeSpan::TicksPerMillisecond ); -} - -/* -This example of the fields of the TimeSpan class -generates the following output. - -Field Value ------ ----- -Maximum TimeSpan 10675199.02:48:05.4775807 -Minimum TimeSpan -10675199.02:48:05.4775808 -Zero TimeSpan 00:00:00 - -Ticks per day 864,000,000,000 -Ticks per hour 36,000,000,000 -Ticks per minute 600,000,000 -Ticks per second 10,000,000 -Ticks per millisecond 10,000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp deleted file mode 100644 index 1ad4da8b17d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromDays( double ) method. -using namespace System; -void GenTimeSpanFromDays( double days ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of days. - TimeSpan interval = TimeSpan::FromDays( days ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", days, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromDays( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromDays", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "--------", "--------" ); - GenTimeSpanFromDays( 0.000000006 ); - GenTimeSpanFromDays( 0.000000017 ); - GenTimeSpanFromDays( 0.000123456 ); - GenTimeSpanFromDays( 1.234567898 ); - GenTimeSpanFromDays( 12345.678987654 ); - GenTimeSpanFromDays( 0.000011574 ); - GenTimeSpanFromDays( 0.000694444 ); - GenTimeSpanFromDays( 0.041666666 ); - GenTimeSpanFromDays( 1 ); - GenTimeSpanFromDays( 20.84745602 ); -} - -/* -This example of TimeSpan::FromDays( double ) -generates the following output. - - FromDays TimeSpan - -------- -------- - 6E-09 00:00:00.0010000 - 1.7E-08 00:00:00.0010000 - 0.000123456 00:00:10.6670000 - 1.234567898 1.05:37:46.6660000 - 12345.678987654 12345.16:17:44.5330000 - 1.1574E-05 00:00:01 - 0.000694444 00:01:00 - 0.041666666 01:00:00 - 1 1.00:00:00 - 20.84745602 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp deleted file mode 100644 index 291263f4c76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromHours( double ) method. -using namespace System; -void GenTimeSpanFromHours( double hours ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of hours. - TimeSpan interval = TimeSpan::FromHours( hours ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", hours, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromHours( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromHours", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "---------", "--------" ); - GenTimeSpanFromHours( 0.0000002 ); - GenTimeSpanFromHours( 0.0000003 ); - GenTimeSpanFromHours( 0.0012345 ); - GenTimeSpanFromHours( 12.3456789 ); - GenTimeSpanFromHours( 123456.7898765 ); - GenTimeSpanFromHours( 0.0002777 ); - GenTimeSpanFromHours( 0.0166666 ); - GenTimeSpanFromHours( 1 ); - GenTimeSpanFromHours( 24 ); - GenTimeSpanFromHours( 500.3389445 ); -} - -/* -This example of TimeSpan::FromHours( double ) -generates the following output. - - FromHours TimeSpan - --------- -------- - 2E-07 00:00:00.0010000 - 3E-07 00:00:00.0010000 - 0.0012345 00:00:04.4440000 - 12.3456789 12:20:44.4440000 - 123456.7898765 5144.00:47:23.5550000 - 0.0002777 00:00:01 - 0.0166666 00:01:00 - 1 01:00:00 - 24 1.00:00:00 - 500.3389445 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp deleted file mode 100644 index abaa9a05413..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromMilliseconds( double ) method. -using namespace System; -void GenTimeSpanFromMillisec( Double millisec ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of milliseconds. - TimeSpan interval = TimeSpan::FromMilliseconds( millisec ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", millisec, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromMilliseconds( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromMilliseconds", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "----------------", "--------" ); - GenTimeSpanFromMillisec( 1 ); - GenTimeSpanFromMillisec( 1.5 ); - GenTimeSpanFromMillisec( 12345.6 ); - GenTimeSpanFromMillisec( 123456789.8 ); - GenTimeSpanFromMillisec( 1234567898765.4 ); - GenTimeSpanFromMillisec( 1000 ); - GenTimeSpanFromMillisec( 60000 ); - GenTimeSpanFromMillisec( 3600000 ); - GenTimeSpanFromMillisec( 86400000 ); - GenTimeSpanFromMillisec( 1801220200 ); -} - -/* -This example of TimeSpan::FromMilliseconds( double ) -generates the following output. - - FromMilliseconds TimeSpan - ---------------- -------- - 1 00:00:00.0010000 - 1.5 00:00:00.0020000 - 12345.6 00:00:12.3460000 - 123456789.8 1.10:17:36.7900000 - 1234567898765.4 14288.23:31:38.7650000 - 1000 00:00:01 - 60000 00:01:00 - 3600000 01:00:00 - 86400000 1.00:00:00 - 1801220200 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp deleted file mode 100644 index 79a767372f3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromMinutes( double ) method. -using namespace System; -void GenTimeSpanFromMinutes( double minutes ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of minutes. - TimeSpan interval = TimeSpan::FromMinutes( minutes ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", minutes, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromMinutes( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromMinutes", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "-----------", "--------" ); - GenTimeSpanFromMinutes( 0.00001 ); - GenTimeSpanFromMinutes( 0.00002 ); - GenTimeSpanFromMinutes( 0.12345 ); - GenTimeSpanFromMinutes( 1234.56789 ); - GenTimeSpanFromMinutes( 12345678.98765 ); - GenTimeSpanFromMinutes( 0.01666 ); - GenTimeSpanFromMinutes( 1 ); - GenTimeSpanFromMinutes( 60 ); - GenTimeSpanFromMinutes( 1440 ); - GenTimeSpanFromMinutes( 30020.33667 ); -} - -/* -This example of TimeSpan::FromMinutes( double ) -generates the following output. - - FromMinutes TimeSpan - ----------- -------- - 1E-05 00:00:00.0010000 - 2E-05 00:00:00.0010000 - 0.12345 00:00:07.4070000 - 1234.56789 20:34:34.0730000 - 12345678.98765 8573.09:18:59.2590000 - 0.01666 00:00:01 - 1 00:01:00 - 60 01:00:00 - 1440 1.00:00:00 - 30020.33667 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp deleted file mode 100644 index 7ff5d2de047..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromSeconds( double ) method. -using namespace System; -void GenTimeSpanFromSeconds( double seconds ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of seconds. - TimeSpan interval = TimeSpan::FromSeconds( seconds ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", seconds, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromSeconds( double )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromSeconds", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "-----------", "--------" ); - GenTimeSpanFromSeconds( 0.001 ); - GenTimeSpanFromSeconds( 0.0015 ); - GenTimeSpanFromSeconds( 12.3456 ); - GenTimeSpanFromSeconds( 123456.7898 ); - GenTimeSpanFromSeconds( 1234567898.7654 ); - GenTimeSpanFromSeconds( 1 ); - GenTimeSpanFromSeconds( 60 ); - GenTimeSpanFromSeconds( 3600 ); - GenTimeSpanFromSeconds( 86400 ); - GenTimeSpanFromSeconds( 1801220.2 ); -} - -/* -This example of TimeSpan::FromSeconds( double ) -generates the following output. - - FromSeconds TimeSpan - ----------- -------- - 0.001 00:00:00.0010000 - 0.0015 00:00:00.0020000 - 12.3456 00:00:12.3460000 - 123456.7898 1.10:17:36.7900000 - 1234567898.7654 14288.23:31:38.7650000 - 1 00:00:01 - 60 00:01:00 - 3600 01:00:00 - 86400 1.00:00:00 - 1801220.2 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp deleted file mode 100644 index 489db154b67..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp +++ /dev/null @@ -1,58 +0,0 @@ - -// -// Example of the TimeSpan::FromTicks( __int64 ) method. -using namespace System; -void GenTimeSpanFromTicks( __int64 ticks ) -{ - - // Create a TimeSpan object and TimeSpan string from - // a number of ticks. - TimeSpan interval = TimeSpan::FromTicks( ticks ); - String^ timeInterval = interval.ToString(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,21}{1,26}", ticks, timeInterval ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::FromTicks( __int64 )\n" - "generates the following output.\n" ); - Console::WriteLine( "{0,21}{1,18}", "FromTicks", "TimeSpan" ); - Console::WriteLine( "{0,21}{1,18}", "---------", "--------" ); - GenTimeSpanFromTicks( 1 ); - GenTimeSpanFromTicks( 12345 ); - GenTimeSpanFromTicks( 123456789 ); - GenTimeSpanFromTicks( 1234567898765 ); - GenTimeSpanFromTicks( 12345678987654321 ); - GenTimeSpanFromTicks( 10000000 ); - GenTimeSpanFromTicks( 600000000 ); - GenTimeSpanFromTicks( 36000000000 ); - GenTimeSpanFromTicks( 864000000000 ); - GenTimeSpanFromTicks( 18012202000000 ); -} - -/* -This example of TimeSpan::FromTicks( __int64 ) -generates the following output. - - FromTicks TimeSpan - --------- -------- - 1 00:00:00.0000001 - 12345 00:00:00.0012345 - 123456789 00:00:12.3456789 - 1234567898765 1.10:17:36.7898765 - 12345678987654321 14288.23:31:38.7654321 - 10000000 00:00:01 - 600000000 00:01:00 - 36000000000 01:00:00 - 864000000000 1.00:00:00 - 18012202000000 20.20:20:20.2000000 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp deleted file mode 100644 index 9c57a8242fa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -// -// Example for the TimeSpan::GetHashCode( ) method. -using namespace System; -void DisplayHashCode( TimeSpan interval ) -{ - - // Create a hash code and a string representation of - // the TimeSpan parameter. - String^ timeInterval = interval.ToString(); - int hashCode = interval.GetHashCode(); - - // Pad the end of the TimeSpan string with spaces if it - // does not contain milliseconds. - int pIndex = timeInterval->IndexOf( ':' ); - pIndex = timeInterval->IndexOf( '.', pIndex ); - if ( pIndex < 0 ) - timeInterval = String::Concat( timeInterval, " " ); - - Console::WriteLine( "{0,22} 0x{1:X8}, {1}", timeInterval, hashCode ); -} - -int main() -{ - Console::WriteLine( "This example of TimeSpan::GetHashCode( ) generates " - "the following \noutput, which displays " - "the hash codes of representative TimeSpan \n" - "objects in hexadecimal and decimal formats.\n" ); - Console::WriteLine( "{0,22} {1,10}", "TimeSpan ", "Hash Code" ); - Console::WriteLine( "{0,22} {1,10}", "-------- ", "---------" ); - DisplayHashCode( TimeSpan(0) ); - DisplayHashCode( TimeSpan(1) ); - DisplayHashCode( TimeSpan(0,0,0,0,1) ); - DisplayHashCode( TimeSpan(0,0,1) ); - DisplayHashCode( TimeSpan(0,1,0) ); - DisplayHashCode( TimeSpan(1,0,0) ); - DisplayHashCode( TimeSpan(36000000001) ); - DisplayHashCode( TimeSpan(0,1,0,0,1) ); - DisplayHashCode( TimeSpan(1,0,1) ); - DisplayHashCode( TimeSpan(1,0,0,0) ); - DisplayHashCode( TimeSpan(864000000001) ); - DisplayHashCode( TimeSpan(1,0,0,0,1) ); - DisplayHashCode( TimeSpan(1,0,0,1) ); - DisplayHashCode( TimeSpan(100,0,0,0) ); - DisplayHashCode( TimeSpan(100,0,0,0,1) ); - DisplayHashCode( TimeSpan(100,0,0,1) ); -} - -/* -This example of TimeSpan::GetHashCode( ) generates the following -output, which displays the hash codes of representative TimeSpan -objects in hexadecimal and decimal formats. - - TimeSpan Hash Code - -------- --------- - 00:00:00 0x00000000, 0 - 00:00:00.0000001 0x00000001, 1 - 00:00:00.0010000 0x00002710, 10000 - 00:00:01 0x00989680, 10000000 - 00:01:00 0x23C34600, 600000000 - 01:00:00 0x61C46808, 1640261640 - 01:00:00.0000001 0x61C46809, 1640261641 - 01:00:00.0010000 0x61C48F18, 1640271640 - 01:00:01 0x625CFE88, 1650261640 - 1.00:00:00 0x2A69C0C9, 711573705 - 1.00:00:00.0000001 0x2A69C0C8, 711573704 - 1.00:00:00.0010000 0x2A69E7D9, 711583705 - 1.00:00:01 0x2B025649, 721573449 - 100.00:00:00 0x914F4E94, -1857073516 - 100.00:00:00.0010000 0x914F6984, -1857066620 - 100.00:00:01 0x91E7D814, -1847076844 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp deleted file mode 100644 index 6e3817f134c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -using namespace System; - -static void ShowTimeSpanProperties(TimeSpan interval) -{ - Console::WriteLine("{0,21}", interval ); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Days", interval.Days, "TotalDays", - interval.TotalDays); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Hours", interval.Hours, "TotalHours", - interval.TotalHours); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Minutes", interval.Minutes, "TotalMinutes", - interval.TotalMinutes); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Seconds", interval.Seconds, "TotalSeconds", - interval.TotalSeconds); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", - "Milliseconds", interval.Milliseconds, - "TotalMilliseconds", interval.TotalMilliseconds); - Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N0}", - nullptr, nullptr, "Ticks", interval.Ticks); -} - -void main() -{ - // Create and display a TimeSpan value of 1 tick. - Console::Write("\n{0,-45}", "TimeSpan( 1 )"); - ShowTimeSpanProperties(TimeSpan(1)); - - // Create a TimeSpan value with a large number of ticks. - Console::Write("\n{0,-45}", "TimeSpan( 111222333444555 )"); - ShowTimeSpanProperties( TimeSpan(111222333444555)); - - // This TimeSpan has all fields specified. - Console::Write("\n{0,-45}", "TimeSpan( 10, 20, 30, 40, 50 )"); - ShowTimeSpanProperties( TimeSpan(10,20,30,40,50)); - - // This TimeSpan has all fields overflowing. - Console::Write("\n{0,-45}", "TimeSpan( 1111, 2222, 3333, 4444, 5555 )"); - ShowTimeSpanProperties( TimeSpan(1111,2222,3333,4444,5555)); - - // This TimeSpan is based on a number of days. - Console::Write("\n{0,-45}", "FromDays( 20.84745602 )"); - ShowTimeSpanProperties( TimeSpan::FromDays( 20.84745602 )); -} -// The example displays the following output if the current culture is en-US: -// TimeSpan( 1 ) 00:00:00.0000001 -// Days 0 TotalDays 0.000 -// Hours 0 TotalHours 0.000 -// Minutes 0 TotalMinutes 0.000 -// Seconds 0 TotalSeconds 0.000 -// Milliseconds 0 TotalMilliseconds 0.000 -// Ticks 1 -// -// TimeSpan( 111222333444555 ) 128.17:30:33.3444555 -// Days 128 TotalDays 128.730 -// Hours 17 TotalHours 3,089.509 -// Minutes 30 TotalMinutes 185,370.556 -// Seconds 33 TotalSeconds 11,122,233.344 -// Milliseconds 344 TotalMilliseconds 11,122,233,344.456 -// Ticks 111,222,333,444,555 -// -// TimeSpan( 10, 20, 30, 40, 50 ) 10.20:30:40.0500000 -// Days 10 TotalDays 10.855 -// Hours 20 TotalHours 260.511 -// Minutes 30 TotalMinutes 15,630.668 -// Seconds 40 TotalSeconds 937,840.050 -// Milliseconds 50 TotalMilliseconds 937,840,050.000 -// Ticks 9,378,400,500,000 -// -// TimeSpan( 1111, 2222, 3333, 4444, 5555 ) 1205.22:47:09.5550000 -// Days 1205 TotalDays 1,205.949 -// Hours 22 TotalHours 28,942.786 -// Minutes 47 TotalMinutes 1,736,567.159 -// Seconds 9 TotalSeconds 104,194,029.555 -// Milliseconds 555 TotalMilliseconds 104,194,029,555.000 -// Ticks 1,041,940,295,550,000 -// -// FromDays( 20.84745602 ) 20.20:20:20.2000000 -// Days 20 TotalDays 20.847 -// Hours 20 TotalHours 500.339 -// Minutes 20 TotalMinutes 30,020.337 -// Seconds 20 TotalSeconds 1,801,220.200 -// Milliseconds 200 TotalMilliseconds 1,801,220,200.000 -// Ticks 18,012,202,000,000 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp deleted file mode 100644 index 526f4e39d00..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp +++ /dev/null @@ -1,76 +0,0 @@ - -// -// Example of the TimeSpan relational operators. -using namespace System; -const __wchar_t * protoFmt = L"{0,35} {1}"; - -// Compare TimeSpan parameters, and display them with the results. -void CompareTimeSpans( TimeSpan Left, TimeSpan Right, String^ RightText ) -{ - String^ dataFmt = gcnew String( protoFmt ); - Console::WriteLine(); - Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); - Console::WriteLine( dataFmt, "Left == Right", Left == Right ); - Console::WriteLine( dataFmt, "Left > Right", Left > Right ); - Console::WriteLine( dataFmt, "Left >= Right", Left >= Right ); - Console::WriteLine( dataFmt, "Left != Right", Left != Right ); - Console::WriteLine( dataFmt, "Left < Right", Left < Right ); - Console::WriteLine( dataFmt, "Left <= Right", Left <= Right ); -} - -int main() -{ - TimeSpan Left = TimeSpan(2,0,0); - Console::WriteLine( "This example of the TimeSpan relational operators " - "generates \nthe following output. It creates several " - "different TimeSpan \nobjects and compares them with " - "a 2-hour TimeSpan.\n" ); - Console::WriteLine( gcnew String( protoFmt ), "Left: TimeSpan( 2, 0, 0 )", Left ); - - // Create objects to compare with a 2-hour TimeSpan. - CompareTimeSpans( Left, TimeSpan(0,120,0), "TimeSpan( 0, 120, 0 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,1), "TimeSpan( 2, 0, 1 )" ); - CompareTimeSpans( Left, TimeSpan(2,0,-1), "TimeSpan( 2, 0, -1 )" ); - CompareTimeSpans( Left, TimeSpan::FromDays( 1.0 / 12. ), "TimeSpan::FromDays( 1 / 12 )" ); -} - -/* -This example of the TimeSpan relational operators generates -the following output. It creates several different TimeSpan -objects and compares them with a 2-hour TimeSpan. - - Left: TimeSpan( 2, 0, 0 ) 02:00:00 - - Right: TimeSpan( 0, 120, 0 ) 02:00:00 - Left == Right True - Left > Right False - Left >= Right True - Left != Right False - Left < Right False - Left <= Right True - - Right: TimeSpan( 2, 0, 1 ) 02:00:01 - Left == Right False - Left > Right False - Left >= Right False - Left != Right True - Left < Right True - Left <= Right True - - Right: TimeSpan( 2, 0, -1 ) 01:59:59 - Left == Right False - Left > Right True - Left >= Right True - Left != Right True - Left < Right False - Left <= Right False - -Right: TimeSpan::FromDays( 1 / 12 ) 02:00:00 - Left == Right True - Left > Right False - Left >= Right True - Left != Right False - Left < Right False - Left <= Right True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp deleted file mode 100644 index e1a104a5583..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp +++ /dev/null @@ -1,61 +0,0 @@ - -// -// Example of selected TimeZone class elements. -using namespace System; -using namespace System::Globalization; -int main() -{ - String^ dataFmt = "{0,-30}{1}"; - String^ timeFmt = "{0,-30}{1:yyyy-MM-dd HH:mm}"; - Console::WriteLine( "This example of selected TimeZone class " - "elements generates the following \n" - "output, which varies depending on the " - "time zone in which it is run.\n" ); - - // Get the local time zone and the current local time and year. - TimeZone^ localZone = TimeZone::CurrentTimeZone; - DateTime currentDate = DateTime::Now; - int currentYear = currentDate.Year; - - // Display the names for standard time and daylight saving - // time for the local time zone. - Console::WriteLine( dataFmt, "Standard time name:", localZone->StandardName ); - Console::WriteLine( dataFmt, "Daylight saving time name:", localZone->DaylightName ); - - // Display the current date and time and show if they occur - // in daylight saving time. - Console::WriteLine( String::Concat( "\n", timeFmt ), "Current date and time:", currentDate ); - Console::WriteLine( dataFmt, "Daylight saving time?", localZone->IsDaylightSavingTime( currentDate ) ); - - // Get the current Coordinated Universal Time (UTC) and UTC - // offset. - DateTime currentUTC = localZone->ToUniversalTime( currentDate ); - TimeSpan currentOffset = localZone->GetUtcOffset( currentDate ); - Console::WriteLine( timeFmt, "Coordinated Universal Time:", currentUTC ); - Console::WriteLine( dataFmt, "UTC offset:", currentOffset ); - - // Get the DaylightTime object for the current year. - DaylightTime^ daylight = localZone->GetDaylightChanges( currentYear ); - - // Display the daylight saving time range for the current year. - Console::WriteLine( "\nDaylight saving time for year {0}:", currentYear ); - Console::WriteLine( "{0:yyyy-MM-dd HH:mm} to " - "{1:yyyy-MM-dd HH:mm}, delta: {2}", daylight->Start, daylight->End, daylight->Delta ); -} - -/* -This example of selected TimeZone class elements generates the following -output, which varies depending on the time zone in which it is run. - -Standard time name: Pacific Standard Time -Daylight saving time name: Pacific Daylight Time - -Current date and time: 2006-01-06 16:47 -Daylight saving time? False -Coordinated Universal Time: 2006-01-07 00:47 -UTC offset: -08:00:00 - -Daylight saving time for year 2006: -2006-04-02 02:00 to 2006-10-29 02:00, delta: 01:00:00 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp deleted file mode 100644 index 3ac30b92e74..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -namespace Example -{ - public ref class Test - { - public: - static void CreateConstructedType(void) - { - Console::WriteLine("\r\n--- Create a constructed type" - " from the generic Dictionary`2 type."); - - // Create a type object representing - // the generic Dictionary`2 type. - Type^ genericType = Type::GetType( - "System.Collections.Generic.Dictionary`2"); - if (genericType != nullptr) - { - DisplayTypeInfo(genericType); - } - else - { - Console::WriteLine("The type is not found"); - return; - } - - // Create an array of types to substitute for the type - // parameters of Dictionary`2. - // The key is of type string, and the type to be - // contained in the Dictionary`2 is Test. - array^ typeArgs = {String::typeid, Test::typeid}; - Type^ constructedType = - genericType->MakeGenericType(typeArgs); - DisplayTypeInfo(constructedType); - - // Compare the type objects obtained above to type objects - // obtained using typeof() and GetGenericTypeDefinition(). - Console::WriteLine("\r\n--- Compare types obtained by" - " different methods:"); - - Type^ definedType = Dictionary::typeid; - Console::WriteLine("\tAre the constructed types " - "equal? {0}", definedType == constructedType); - Console::WriteLine("\tAre the generic types equal? {0}", - definedType->GetGenericTypeDefinition() == genericType); - } - - private: - static void DisplayTypeInfo(Type^ typeToDisplay) - { - Console::WriteLine("\r\n{0}", typeToDisplay); - Console::WriteLine("\tIs this a generic type definition? " - "{0}", typeToDisplay->IsGenericTypeDefinition); - Console::WriteLine("\tIs it a generic type? " - "{0}", typeToDisplay->IsGenericType); - - array^ typeArguments = - typeToDisplay->GetGenericArguments(); - Console::WriteLine("\tList type arguments ({0}):", - typeArguments->Length); - - for each (Type^ typeArgument in typeArguments) - { - Console::WriteLine("\t\t{0}", typeArgument); - } - } - }; -} - -int main(void) -{ - Example::Test::CreateConstructedType(); -} - -/* This example produces the following output: - ---- Create a constructed type from the generic Dictionary`2 type. - -System.Collections.Generic.Dictionary`2[KeyType,ValueType] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - K - V - -System.Collections.Generic.Dictionary`2[System.String, Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - ---- Compare types obtained by different methods: - Are the constructed types equal? True - Are the generic types equal? True - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp deleted file mode 100644 index 8720dbc53fd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// -using namespace System; -using namespace System::Collections; -using namespace System::Reflection; - -// Define a sample interface to use as an interface constraint. -interface class ITest{}; - -// Define a base type to use as a class constraint. -public ref class Base{}; - -// Define the generic type to examine. The first generic type parameter, -// T, derives from the class Base and implements ITest. This demonstrates -// a base class constraint and an interface constraint. In the .NET -// Framework version 2.0, C++ has no way of expressing special constraints. -// See the C# example code. -// -generic - where T : Base, ITest -ref class Test {}; - -// Define a type that derives from Base and implements interface -// ITest. This type satisfies the constraint on T in class Test. -public ref class Derived: public Base, public ITest {}; - -public ref class Example -{ -public: - static void Main() - { - // Create a constructed type from Test, and from it - // get the generic type definition. - // - Type^ def = Test::typeid; - Console::WriteLine( L"\r\nExamining generic type {0}", def ); - - // Get the type parameters of the generic type definition, - // and display them. - // - for each (Type^ tp in def->GetGenericArguments()) - { - Console::WriteLine( L"\r\nType parameter: {0}", tp); - Console::WriteLine( L"\t{0}", - ListGenericParameterAttributes( tp ) ); - - // List the base class and interface constraints. The - // constraints do not appear in any particular order. If - // there are no class or interface constraints, an empty - // array is returned. - // - for each (Type^ constraint in tp->GetGenericParameterConstraints()) - { - Console::WriteLine( L"\t{0}", constraint ); - } - } - } - -private: - - // List the variance and special constraint flags. - // - static String^ ListGenericParameterAttributes( Type^ t ) - { - String^ retval; - GenericParameterAttributes gpa = t->GenericParameterAttributes; - - // Select the variance flag. - GenericParameterAttributes variance = - static_cast( - gpa & GenericParameterAttributes::VarianceMask ); - - if ( variance == GenericParameterAttributes::None ) - retval = L"No variance flag;"; - else - { - if ( (variance & GenericParameterAttributes::Covariant) != - GenericParameterAttributes::None ) - retval = L"Covariant;"; - else - retval = L"Contravariant;"; - } - - // Select the special constraint flags. - GenericParameterAttributes constraints = - static_cast( - gpa & GenericParameterAttributes::SpecialConstraintMask); - - if ( constraints == GenericParameterAttributes::None ) - retval = String::Concat( retval, L" No special constraints" ); - else - { - if ( (constraints & GenericParameterAttributes::ReferenceTypeConstraint) != - GenericParameterAttributes::None ) - retval = String::Concat( retval, L" ReferenceTypeConstraint" ); - - if ( (constraints & GenericParameterAttributes::NotNullableValueTypeConstraint) != - GenericParameterAttributes::None ) - retval = String::Concat( retval, L" NotNullableValueTypeConstraint" ); - - if ( (constraints & GenericParameterAttributes::DefaultConstructorConstraint) != - GenericParameterAttributes::None ) - retval = String::Concat( retval, L" DefaultConstructorConstraint" ); - } - - return retval; - } -}; - -int main() -{ - Example::Main(); -} - -/* This example produces the following output: - -Examining generic type Test`2[T,U] - -Type parameter: T - No variance flag; No special constraints - Base - ITest - -Type parameter: U - No variance flag; No special constraints - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp deleted file mode 100644 index 42acac613e9..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class Test -{ -public: - static void Main() - { - Console::Write( L"\r\n--- Get the generic type that " ); - Console::WriteLine( L"defines a constructed type." ); - - // Create a Dictionary of Test objects, using strings for the - // keys. - Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; - - // Get a Type object representing the constructed type. - // - Type^ constructed = d->GetType(); - DisplayTypeInfo( constructed ); - Type^ myGeneric = constructed->GetGenericTypeDefinition(); - DisplayTypeInfo( myGeneric ); - } - -private: - static void DisplayTypeInfo( Type^ t ) - { - Console::WriteLine( L"\r\n{0}", t ); - Console::WriteLine( L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition ); - Console::WriteLine( L"\tIs it a generic type? {0}", - t->IsGenericType ); - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine( L"\tList type arguments ({0}):", - typeArguments->Length ); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ tParam = safe_cast(myEnum->Current); - Console::WriteLine( L"\t\t{0}", tParam ); - } - } -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Get the generic type that defines a constructed type. - -System.Collections.Generic.Dictionary`2[System.String,Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - -System.Collections.Generic.Dictionary`2[TKey,TValue] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - TKey - TValue - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp deleted file mode 100644 index bd05647c2bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -// Define a base class with two type parameters. -generic< class T,class U > -public ref class Base {}; - -// Define a derived class. The derived class inherits from a constructed -// class that meets the following criteria: -// (1) Its generic type definition is Base. -// (2) It specifies int for the first type parameter. -// (3) For the second type parameter, it uses the same type that is used -// for the type parameter of the derived class. -// Thus, the derived class is a generic type with one type parameter, but -// its base class is an open constructed type with one type argument and -// one type parameter. -generic -public ref class Derived : Base {}; - -public ref class Test -{ -public: - static void Main() - { - Console::WriteLine( - L"\r\n--- Display a generic type and the open constructed"); - Console::WriteLine(L" type from which it is derived."); - - // Create a Type object representing the generic type definition - // for the Derived type. Note the absence of type arguments. - // - Type^ derivedType = Derived::typeid; - DisplayGenericTypeInfo(derivedType); - - // Display its open constructed base type. - DisplayGenericTypeInfo(derivedType->BaseType); - } - - -private: - static void DisplayGenericTypeInfo(Type^ t) - { - Console::WriteLine(L"\r\n{0}", t); - Console::WriteLine(L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition); - Console::WriteLine(L"\tIs it a generic type? {0}", t->IsGenericType); - Console::WriteLine(L"\tDoes it have unassigned generic parameters? {0}", - t->ContainsGenericParameters); - if (t->IsGenericType) - { - - // If this is a generic type, display the type arguments. - // - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine(L"\tList type arguments ({0}):", - typeArguments->Length); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while (myEnum->MoveNext()) - { - Type^ tParam = safe_cast(myEnum->Current); - - // IsGenericParameter is true only for generic type - // parameters. - // - if (tParam->IsGenericParameter) - { - Console::WriteLine( - L"\t\t{0} (unassigned - parameter position {1})", - tParam, tParam->GenericParameterPosition); - } - else - { - Console::WriteLine(L"\t\t{0}", tParam); - } - } - } - } -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Display a generic type and the open constructed - type from which it is derived. - -Derived`1[V] - Is this a generic type definition? True - Is it a generic type? True - Does it have unassigned generic parameters? True - List type arguments (1): - V (unassigned - parameter position 0) - -Base`2[System.Int32,V] - Is this a generic type definition? False - Is it a generic type? True - Does it have unassigned generic parameters? True - List type arguments (2): - System.Int32 - V (unassigned - parameter position 0) - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp deleted file mode 100644 index 7382ca1e398..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class Test -{ -private: - static void DisplayGenericTypeInfo( Type^ t ) - { - Console::WriteLine( L"\r\n{0}", t ); - Console::WriteLine( L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition ); - Console::WriteLine( L"\tIs it a generic type? {0}", - t->IsGenericType ); - - // - if ( t->IsGenericType ) - { - - // If this is a generic type, display the type arguments. - // - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine( L"\tList type arguments ({0}):", - typeArguments->Length ); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ tParam = safe_cast(myEnum->Current); - - // If this is a type parameter, display its - // position. - // - if ( tParam->IsGenericParameter ) - { - Console::WriteLine( - L"\t\t{0}\t(unassigned - parameter position {1})", - tParam, tParam->GenericParameterPosition ); - } - else - { - Console::WriteLine( L"\t\t{0}", tParam ); - } - } - } - // - } - - -public: - static void Main() - { - Console::Write( L"\r\n--- Display information about a " ); - Console::WriteLine( L"constructed type, its" ); - Console::WriteLine( L" generic type definition, and an ordinary type." ); - - // Create a Dictionary of Test objects, using strings for the - // keys. - Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; - - // Display information for the constructed type and its generic - // type definition. - DisplayGenericTypeInfo( d->GetType() ); - DisplayGenericTypeInfo( d->GetType()->GetGenericTypeDefinition() ); - - // Display information for an ordinary type. - DisplayGenericTypeInfo( String::typeid ); - } - -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Display information about a constructed type, its - generic type definition, and an ordinary type. - -System.Collections.Generic.Dictionary[System.String,Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - -System.Collections.Generic.Dictionary[TKey,TValue] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - TKey (unassigned - parameter position 0) - TValue (unassigned - parameter position 1) - -System.String - Is this a generic type definition? False - Is it a generic type? False - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp deleted file mode 100644 index ae4ef65dd24..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - -// -generic public ref class Base {}; - -generic public ref class G {}; - -generic public ref class Derived : Base -{ -public: - G^>^ F; - - ref class Nested {}; -}; -// - - -void main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp deleted file mode 100644 index 39b29ec5a65..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -generic public ref class Base {}; - -generic public ref class G {}; - -generic public ref class Derived : Base -{ -public: - G^>^ F; - - ref class Nested {}; -}; - -void DisplayGenericType(Type^ t, String^ caption) -{ - Console::WriteLine("\n{0}", caption); - Console::WriteLine(" Type: {0}", t); - - Console::WriteLine("\t IsGenericType: {0}", - t->IsGenericType); - Console::WriteLine("\t IsGenericTypeDefinition: {0}", - t->IsGenericTypeDefinition); - Console::WriteLine("\tContainsGenericParameters: {0}", - t->ContainsGenericParameters); - Console::WriteLine("\t IsGenericParameter: {0}", - t->IsGenericParameter); -} - -void main() -{ - // Get the generic type definition for Derived, and the base - // type for Derived. - // - Type^ tDerived = Derived::typeid; - Type^ tDerivedBase = tDerived->BaseType; - - // Declare an array of Derived, and get its type. - // - array^>^ d = gcnew array^>(0); - Type^ tDerivedArray = d->GetType(); - - // Get a generic type parameter, the type of a field, and a - // type that is nested in Derived. Notice that in order to - // get the nested type it is necessary to either (1) specify - // the generic type definition Derived::typeid, as shown here, - // or (2) specify a type parameter for Derived. - // - Type^ tT = Base::typeid->GetGenericArguments()[0]; - Type^ tF = tDerived->GetField("F")->FieldType; - Type^ tNested = Derived::Nested::typeid; - - DisplayGenericType(tDerived, "generic Derived"); - DisplayGenericType(tDerivedBase, "Base type of generic Derived"); - DisplayGenericType(tDerivedArray, "Array of Derived"); - DisplayGenericType(tT, "Type parameter T from generic Base"); - DisplayGenericType(tF, "Field type, G^>^"); - DisplayGenericType(tNested, "Nested type in generic Derived"); -} - -/* This code example produces the following output: - -generic Derived - Type: Derived`1[V] - IsGenericType: True - IsGenericTypeDefinition: True - ContainsGenericParameters: True - IsGenericParameter: False - -Base type of generic Derived - Type: Base`2[System.String,V] - IsGenericType: True - IsGenericTypeDefinition: False - ContainsGenericParameters: True - IsGenericParameter: False - -Array of Derived - Type: Derived`1[System.Int32][] - IsGenericType: False - IsGenericTypeDefinition: False - ContainsGenericParameters: False - IsGenericParameter: False - -Type parameter T from generic Base - Type: T - IsGenericType: False - IsGenericTypeDefinition: False - ContainsGenericParameters: True - IsGenericParameter: True - -Field type, G^>^ - Type: G`1[Derived`1[V]] - IsGenericType: True - IsGenericTypeDefinition: False - ContainsGenericParameters: True - IsGenericParameter: False - -Nested type in generic Derived - Type: Derived`1+Nested[V] - IsGenericType: True - IsGenericTypeDefinition: True - ContainsGenericParameters: True - IsGenericParameter: False - */ -// - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp deleted file mode 100644 index 7382ca1e398..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp +++ /dev/null @@ -1,101 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Collections::Generic; - -public ref class Test -{ -private: - static void DisplayGenericTypeInfo( Type^ t ) - { - Console::WriteLine( L"\r\n{0}", t ); - Console::WriteLine( L"\tIs this a generic type definition? {0}", - t->IsGenericTypeDefinition ); - Console::WriteLine( L"\tIs it a generic type? {0}", - t->IsGenericType ); - - // - if ( t->IsGenericType ) - { - - // If this is a generic type, display the type arguments. - // - array^typeArguments = t->GetGenericArguments(); - Console::WriteLine( L"\tList type arguments ({0}):", - typeArguments->Length ); - System::Collections::IEnumerator^ myEnum = - typeArguments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Type^ tParam = safe_cast(myEnum->Current); - - // If this is a type parameter, display its - // position. - // - if ( tParam->IsGenericParameter ) - { - Console::WriteLine( - L"\t\t{0}\t(unassigned - parameter position {1})", - tParam, tParam->GenericParameterPosition ); - } - else - { - Console::WriteLine( L"\t\t{0}", tParam ); - } - } - } - // - } - - -public: - static void Main() - { - Console::Write( L"\r\n--- Display information about a " ); - Console::WriteLine( L"constructed type, its" ); - Console::WriteLine( L" generic type definition, and an ordinary type." ); - - // Create a Dictionary of Test objects, using strings for the - // keys. - Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; - - // Display information for the constructed type and its generic - // type definition. - DisplayGenericTypeInfo( d->GetType() ); - DisplayGenericTypeInfo( d->GetType()->GetGenericTypeDefinition() ); - - // Display information for an ordinary type. - DisplayGenericTypeInfo( String::typeid ); - } - -}; - -int main() -{ - Test::Main(); -} - -/* This example produces the following output: - ---- Display information about a constructed type, its - generic type definition, and an ordinary type. - -System.Collections.Generic.Dictionary[System.String,Test] - Is this a generic type definition? False - Is it a generic type? True - List type arguments (2): - System.String - Test - -System.Collections.Generic.Dictionary[TKey,TValue] - Is this a generic type definition? True - Is it a generic type? True - List type arguments (2): - TKey (unassigned - parameter position 0) - TValue (unassigned - parameter position 1) - -System.String - Is this a generic type definition? False - Is it a generic type? False - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp deleted file mode 100644 index 8332eed2ff0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -using namespace System; - -private ref class InternalOnly -{ -public: - ref class Nested {}; -}; - -public ref class Example -{ -public: - ref class Nested {}; -}; - - -// Entry point of example -int main() -{ - Type^ classType = InternalOnly::Nested::typeid; - Console::WriteLine( - "Is the {0} class visible outside the assembly? {1}", - classType->FullName, classType->IsVisible); - - classType = Example::Nested::typeid; - Console::WriteLine( - "Is the {0} class visible outside the assembly? {1}", - classType->FullName, classType->IsVisible); -} - -/* This example produces the following output: - -Is the InternalOnly+Nested class visible outside the assembly? False -Is the Example+Nested class visible outside the assembly? True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp deleted file mode 100644 index c9c917bc746..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -public ref class Example -{ -public: - static void Main() - { - // Create a Type object that represents a one-dimensional - // array of Example objects. - Type^ t = Example::typeid->MakeArrayType(); - Console::WriteLine( L"\r\nArray of Example: {0}", t ); - - // Create a Type object that represents a two-dimensional - // array of Example objects. - t = Example::typeid->MakeArrayType( 2 ); - Console::WriteLine( L"\r\nTwo-dimensional array of Example: {0}", t ); - - // Demonstrate an exception when an invalid array rank is - // specified. - try - { - t = Example::typeid->MakeArrayType( -1 ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( L"\r\n{0}", ex ); - } - - // Create a Type object that represents a ByRef parameter - // of type Example. - t = Example::typeid->MakeByRefType(); - Console::WriteLine( L"\r\nByRef Example: {0}", t ); - - // Get a Type object representing the Example class, a - // MethodInfo representing the "Test" method, a ParameterInfo - // representing the parameter of type Example, and finally - // a Type object representing the type of this ByRef parameter. - // Compare this Type object with the Type object created using - // MakeByRefType. - Type^ t2 = Example::typeid; - MethodInfo^ mi = t2->GetMethod( L"Test" ); - ParameterInfo^ pi = mi->GetParameters()[ 0 ]; - Type^ pt = pi->ParameterType; - Console::WriteLine( L"Are the ByRef types equal? {0}", (t == pt) ); - - // Create a Type object that represents a pointer to an - // Example object. - t = Example::typeid->MakePointerType(); - Console::WriteLine( L"\r\nPointer to Example: {0}", t ); - } - - // A sample method with a ByRef parameter. - // - void Test( interior_ptr /*e*/ ) - { - } -}; - -int main() -{ - Example::Main(); -} - -/* This example produces output similar to the following: - -Array of Example: Example[] - -Two-dimensional array of Example: Example[,] - -System.IndexOutOfRangeException: Index was outside the bounds of the array. - at System.RuntimeType.MakeArrayType(Int32 rank) in c:\vbl\ndp\clr\src\BCL\System\RtType.cs:line 2999 - at Example.Main() - -ByRef Example: Example& -Are the ByRef types equal? True - -Pointer to Example: Example* - - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp deleted file mode 100644 index b9aab72110f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// The following code example demonstrates that Type objects are returned -// by the typeid operator, and shows how Type objects are used in reflection -// to explore information about types and to invoke members of types. -// -#using - -using namespace System; -using namespace System::Reflection; - -void main() -{ - // Get a Type object representing the System.String type. - Type^ t = String::typeid; - - MethodInfo^ substr = t->GetMethod("Substring", - gcnew array { int::typeid, int::typeid }); - - Object^ result = - substr->Invoke("Hello, World!", gcnew array { 7, 5 }); - Console::WriteLine("{0} returned \"{1}\".", substr, result); -} - -/* This code example produces the following output: - -System.String Substring(Int32, Int32) returned "World". - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp deleted file mode 100644 index 84ebc81e817..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp +++ /dev/null @@ -1,153 +0,0 @@ - -// -using namespace System; - -/// Class that implements IConvertible* -public ref class Complex: public IConvertible -{ -private: - double x; - double y; - -public: - Complex( double x, double y ) - { - this->x = x; - this->y = y; - } - - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean( IFormatProvider^ provider ) - { - if ( (x != 0.0) || (y != 0.0) ) - return true; - else - return false; - } - - double GetDoubleValue() - { - return Math::Sqrt( x * x + y * y ); - } - - virtual Byte ToByte( IFormatProvider^ provider ) - { - return Convert::ToByte( GetDoubleValue() ); - } - - virtual Char ToChar( IFormatProvider^ provider ) - { - return Convert::ToChar( GetDoubleValue() ); - } - - virtual DateTime ToDateTime( IFormatProvider^ provider ) - { - return Convert::ToDateTime( GetDoubleValue() ); - } - - virtual Decimal ToDecimal( IFormatProvider^ provider ) - { - return Convert::ToDecimal( GetDoubleValue() ); - } - - virtual double ToDouble( IFormatProvider^ provider ) - { - return GetDoubleValue(); - } - - virtual short ToInt16( IFormatProvider^ provider ) - { - return Convert::ToInt16( GetDoubleValue() ); - } - - virtual int ToInt32( IFormatProvider^ provider ) - { - return Convert::ToInt32( GetDoubleValue() ); - } - - virtual Int64 ToInt64( IFormatProvider^ provider ) - { - return Convert::ToInt64( GetDoubleValue() ); - } - - virtual signed char ToSByte( IFormatProvider^ provider ) - { - return Convert::ToSByte( GetDoubleValue() ); - } - - virtual float ToSingle( IFormatProvider^ provider ) - { - return Convert::ToSingle( GetDoubleValue() ); - } - - virtual String^ ToString( IFormatProvider^ provider ) - { - return x.ToString() + ", " + y.ToString(); - } - - virtual Object^ ToType( Type^ conversionType, IFormatProvider^ provider ) - { - return Convert::ChangeType( GetDoubleValue(), conversionType ); - } - - virtual UInt16 ToUInt16( IFormatProvider^ provider ) - { - return Convert::ToUInt16( GetDoubleValue() ); - } - - virtual UInt32 ToUInt32( IFormatProvider^ provider ) - { - return Convert::ToUInt32( GetDoubleValue() ); - } - - virtual UInt64 ToUInt64( IFormatProvider^ provider ) - { - return Convert::ToUInt64( GetDoubleValue() ); - } -}; - - -// -void WriteObjectInfo( Object^ testObject ) -{ - TypeCode typeCode = Type::GetTypeCode( testObject->GetType() ); - switch ( typeCode ) - { - case TypeCode::Boolean: - Console::WriteLine( "Boolean: {0}", testObject ); - break; - - case TypeCode::Double: - Console::WriteLine( "Double: {0}", testObject ); - break; - - default: - Console::WriteLine( "{0}: {1}", typeCode, testObject ); - break; - } -} -// - -void main() -{ - Complex^ testComplex = gcnew Complex( 4,7 ); - WriteObjectInfo( testComplex ); - WriteObjectInfo( Convert::ToBoolean( testComplex ) ); - WriteObjectInfo( Convert::ToDecimal( testComplex ) ); - WriteObjectInfo( Convert::ToString( testComplex ) ); -} - -/* -This code example produces the following results: - -Object: ConsoleApplication2.Complex -Boolean: True -Decimal: 8.06225774829855 -String: ( 4 , 7 ) - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp deleted file mode 100644 index e10fb59e8bb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// Lambda.cpp : main project file. - -//#include "stdafx.h" - -// -using namespace System; -using namespace System::Windows::Forms; - -public delegate void ShowValue(); - - -public ref class Name -{ -private: - String^ instanceName; - -public: - Name(String^ name) - { - instanceName = name; - } - - void DisplayToConsole() - { - Console::WriteLine(this->instanceName); - } - - void DisplayToWindow() - { - MessageBox::Show(this->instanceName); - } -}; - -int main() -{ - Name^ testName = gcnew Name(L"Koani"); - ShowValue^ showMethod; - showMethod = gcnew ShowValue(testName, &Name::DisplayToWindow); - showMethod(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj deleted file mode 100644 index 747bfeb6b76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9EC80F18-EB27-492B-9D70-40C7B2052756} - v4.0 - ManagedCProj - TestWinForms - - - - Application - true - Pure - Unicode - - - Application - false - Pure - Unicode - - - - - - - - - - - - - true - - - false - - - - Level3 - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - - - true - - - Windows - main - - - - - Level3 - WIN32;NDEBUG;%(PreprocessorDefinitions) - Use - - - true - - - Windows - main - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp deleted file mode 100644 index 8dd9c5712f8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -using namespace System; - -public ref class Dummy -{ -// - public: - generic where T:gcnew() - static T Bar() - { - return gcnew T(); - } -// -}; - - -void main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp deleted file mode 100644 index c877a1585fc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; - -public interface class ITest -{ - void Test(String^ greeting); -}; - -public ref class MarshalableExample : MarshalByRefObject, ITest -{ -public: - virtual void Test(String^ greeting) - { - Console::WriteLine("{0} from '{1}'!", greeting, - AppDomain::CurrentDomain->FriendlyName); - } -}; - -void main() -{ - // Construct a path to the current assembly. - String^ assemblyPath = Environment::CurrentDirectory + "\\" + - MarshalableExample::typeid->Assembly->GetName()->Name + ".exe"; - - AppDomain^ ad = AppDomain::CreateDomain("MyDomain"); - - System::Runtime::Remoting::ObjectHandle^ oh = - ad->CreateInstanceFrom(assemblyPath, "MarshalableExample"); - - Object^ obj = oh->Unwrap(); - - - // Three ways to use the newly created object, depending on how - // much is known about the type: Late bound, early bound through - // a mutually known interface, or early binding of a known type. - // - obj->GetType()->InvokeMember("Test", - System::Reflection::BindingFlags::InvokeMethod, - Type::DefaultBinder, obj, gcnew array { "Hello" }); - - ITest^ it = (ITest^) obj; - it->Test("Hi"); - - MarshalableExample^ ex = (MarshalableExample^) obj; - ex->Test("Goodbye"); -} - -/* This example produces the following output: - -Hello from 'MyDomain'! -Hi from 'MyDomain'! -Goodbye from 'MyDomain'! - */ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp deleted file mode 100644 index 41005ae1378..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -using namespace System; - -ref class AppDomainLoad -{ -private: - AppDomainLoad(){} - - -public: - static void CreateAndLoad() - { - try - { -// - AppDomain^ ad = AppDomain::CreateDomain("ChildDomain"); - ad->Load("MyAssembly"); -// - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - Console::WriteLine(ex->StackTrace); - } - } - -}; - -int main() -{ - AppDomainLoad::CreateAndLoad(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp deleted file mode 100644 index f739b8705dd..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// The following example demonstrates using the ForEach method. - -// -using namespace System; - -public ref class SamplesArray -{ -public: - static void Main() - { - // create a three element array of integers - array^ intArray = gcnew array {2, 3, 4}; - - // set a delegate for the ShowSquares method - Action^ action = gcnew Action(ShowSquares); - - Array::ForEach(intArray, action); - } - -private: - static void ShowSquares(int val) - { - Console::WriteLine("{0:d} squared = {1:d}", val, val*val); - } -}; - -int main() -{ - SamplesArray::Main(); -} - -/* -This code produces the following output: - -2 squared = 4 -3 squared = 9 -4 squared = 16 -*/ - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp deleted file mode 100644 index fb3486b04d4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// The following example demonstrates using the Array.GetLength method. - -// -using namespace System; - -public ref class SamplesArray -{ -public: - static void Main() - { - // make a single dimension array - Array^ MyArray1 = Array::CreateInstance(int::typeid, 5); - - // make a 3 dimensional array - Array^ MyArray2 = Array::CreateInstance(int::typeid, 5, 3, 2); - - // make an array container - Array^ BossArray = Array::CreateInstance(Array::typeid, 2); - BossArray->SetValue(MyArray1, 0); - BossArray->SetValue(MyArray2, 1); - - int i = 0, j, rank; - for each (Array^ anArray in BossArray) - { - rank = anArray->Rank; - if (rank > 1) - { - Console::WriteLine("Lengths of {0:d} dimension array[{1:d}]", rank, i); - // show the lengths of each dimension - for (j = 0; j < rank; j++) - { - Console::WriteLine(" Length of dimension({0:d}) = {1:d}", j, anArray->GetLength(j)); - } - } - else - { - Console::WriteLine("Lengths of single dimension array[{0:d}]", i); - } - // show the total length of the entire array or all dimensions - Console::WriteLine(" Total length of the array = {0:d}", anArray->Length); - Console::WriteLine(); - i++; - } - } -}; - -int main() -{ - SamplesArray::Main(); -} - -/* -This code produces the following output: - -Lengths of single dimension array[0] - Total length of the array = 5 - -Lengths of 3 dimension array[1] - Length of dimension(0) = 5 - Length of dimension(1) = 3 - Length of dimension(2) = 2 - Total length of the array = 30 -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp deleted file mode 100644 index 62891bfe86f..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// -using namespace System; - -void main() -{ - // Create a one-dimensional integer array. - array^ integers = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - // Get the upper and lower bound of the array. - int upper = integers->GetUpperBound(0); - int lower = integers->GetLowerBound(0); - Console::WriteLine("Elements from index {0} to {1}:", lower, upper); - // Iterate the array. - for (int ctr = lower; ctr <= upper; ctr++) - Console::Write("{0}{1}{2}", ctr == lower ? " " : "", - integers[ctr], - ctr < upper ? ", " : Environment::NewLine); - - Console::WriteLine(); - - // Create a two-dimensional integer array. - array^ integers2d = { {2, 4}, {3, 9}, {4, 16}, {5, 25}, - {6, 36}, {7, 49}, {8, 64}, {9, 81} }; - // Get the number of dimensions. - int rank = integers2d->Rank; - Console::WriteLine("Number of dimensions: {0}", rank); - for (int ctr = 0; ctr < rank; ctr++) - Console::WriteLine(" Dimension {0}: from {1} to {2}", - ctr, integers2d->GetLowerBound(ctr), - integers2d->GetUpperBound(ctr)); - - // Iterate the 2-dimensional array and display its values. - Console::WriteLine(" Values of array elements:"); - for (int outer = integers2d->GetLowerBound(0); outer <= integers2d->GetUpperBound(0); - outer++) - for (int inner = integers2d->GetLowerBound(1); inner <= integers2d->GetUpperBound(1); - inner++) - Console::WriteLine(" {3}{0}, {1}{4} = {2}", outer, inner, - integers2d->GetValue(outer, inner), "{", "}"); -} -// The example displays the following output: -// Elements from index 0 to 9: -// 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 -// -// Number of dimensions: 2 -// Dimension 0: from 0 to 7 -// Dimension 1: from 0 to 1 -// Values of array elements: -// {0, 0} = 2 -// {0, 1} = 4 -// {1, 0} = 3 -// {1, 1} = 9 -// {2, 0} = 4 -// {2, 1} = 16 -// {3, 0} = 5 -// {3, 1} = 25 -// {4, 0} = 6 -// {4, 1} = 36 -// {5, 0} = 7 -// {5, 1} = 49 -// {6, 0} = 8 -// {6, 1} = 64 -// {7, 0} = 9 -// {7, 1} = 81 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp deleted file mode 100644 index 7d01f577679..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// Byte.Equals.cpp : main project file. - -// -using namespace System; - -void main() -{ - Byte byteVal1 = 0x7f; - Byte byteVal2 = 127; - Object^ objectVal3 = byteVal2; - - Console::WriteLine("byteVal1 = {0}, byteVal2 = {1}, objectVal3 = {2}\n", - byteVal1, byteVal2, objectVal3); - Console::WriteLine("byteVal1 equals byteVal2?: {0}", byteVal1.Equals(byteVal2)); - Console::WriteLine("byteVal1 equals objectVal3?: {0}", byteVal1.Equals(objectVal3)); -} -/* -This example displays the following output: - byteVal1 = 127, byteVal2 = 127, objectVal3 = 127 - - byteVal1 equals byteVal2?: True - byteVal1 equals objectVal3?: True -*/ -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp deleted file mode 100644 index 2b795397fac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -int main() -{ - // Declare a new type called Class1. - CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); - - // Use attributes to mark the class as serializable and obsolete. - CodeAttributeDeclaration^ codeAttrDecl = - gcnew CodeAttributeDeclaration("System.Serializable"); - class1->CustomAttributes->Add(codeAttrDecl); - - CodeAttributeArgument^ codeAttr = - gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression("This class is obsolete.")); - codeAttrDecl = gcnew CodeAttributeDeclaration("System.Obsolete", codeAttr); - class1->CustomAttributes->Add(codeAttrDecl); - - // Create a C# code provider - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Generate code and send the output to the console - provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); -} - -// The CPP code generator produces the following source code for the preceeding example code: -// -//[System.Serializable()] -//[System.Obsolete("This class is obsolete.")] -//public class Class1 { -//} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp deleted file mode 100644 index 5523f2c37c7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -int main() -{ - // Declare a new type called Class1. - CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); - - // Declare a new code attribute - CodeAttributeDeclaration^ codeAttrDecl = gcnew CodeAttributeDeclaration( - "System.CLSCompliantAttribute", - gcnew CodeAttributeArgument(gcnew CodePrimitiveExpression(false))); - class1->CustomAttributes->Add(codeAttrDecl); - - // Create a C# code provider - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Generate code and send the output to the console - provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); -} - -// The CPP code generator produces the following source code for the preceeding example code: -// -//[System.CLSCompliantAttribute(false)] -//public class Class1 { -//} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp deleted file mode 100644 index 4db196685db..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -int main() -{ - // Declare a new type called Class1. - CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); - - // Declares a type constructor that calls a method. - CodeConstructor^ constructor1 = gcnew CodeConstructor(); - constructor1->Attributes = MemberAttributes::Public; - class1->Members->Add(constructor1); - - // Creates a method reference for dict.Init. - CodeMethodReferenceExpression^ methodRef1 = - gcnew CodeMethodReferenceExpression( - gcnew CodeVariableReferenceExpression("dict"), - "Init", - gcnew array { - gcnew CodeTypeReference("System.Decimal"), - gcnew CodeTypeReference("System.Int32")}); - - // Invokes the dict.Init method from the constructor. - CodeMethodInvokeExpression^ invoke1 = - gcnew CodeMethodInvokeExpression(methodRef1, gcnew array {}); - constructor1->Statements->Add(invoke1); - - // Create a C# code provider - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Generate code and send the output to the console - provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); -} - -// The CPP code generator produces the following source code for the preceeding example code: -// -//public class Class1 { -// -// public Class1() { -// dict.Init(); -// } -// } -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp deleted file mode 100644 index dcd7661e4aa..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -int main() -{ - // Declare a new type called Class1. - CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); - - // Declare a new generated code attribute - GeneratedCodeAttribute^ generatedCodeAttribute = - gcnew GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0"); - - // Use the generated code attribute members in the attribute declaration - CodeAttributeDeclaration^ codeAttrDecl = - gcnew CodeAttributeDeclaration(generatedCodeAttribute->GetType()->Name, - gcnew CodeAttributeArgument( - gcnew CodePrimitiveExpression(generatedCodeAttribute->Tool)), - gcnew CodeAttributeArgument( - gcnew CodePrimitiveExpression(generatedCodeAttribute->Version))); - class1->CustomAttributes->Add(codeAttrDecl); - - // Create a C# code provider - CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); - - // Generate code and send the output to the console - provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); -} - -// The CPP code generator produces the following source code for the preceeding example code: -// -// [GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0")] -// public class Class1 { -// } -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp deleted file mode 100644 index 66e77dee281..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp +++ /dev/null @@ -1,59 +0,0 @@ -using namespace System; -using namespace System::Collections; -using namespace System::Threading; - -public ref class Remarks -{ -public: - static void Main() - { - ArrayList^ someCollection = gcnew ArrayList(5); - // - ICollection^ myCollection = someCollection; - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - for each (Object^ item in myCollection); - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } - - static void Dummy() - { - ArrayList^ someCollection = gcnew ArrayList(5); - // - ICollection^ myCollection = someCollection; - bool lockTaken = false; - try - { - Monitor::Enter(myCollection->SyncRoot, lockTaken); - // Some operation on the collection, which is now thread safe. - } - finally - { - if (lockTaken) - { - Monitor::Exit(myCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - Remarks::Main(); -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp deleted file mode 100644 index 95fbc966ac0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; - -ref class TestCollectionsUtils -{ -public: - static void Main() - { - Hashtable^ population1 = CollectionsUtil::CreateCaseInsensitiveHashtable(); - - population1["Trapperville"] = 15; - population1["Doggerton"] = 230; - population1["New Hollow"] = 1234; - population1["McHenry"] = 185; - - // Select cities from the table using mixed case. - Console::WriteLine("Case insensitive hashtable results:\n"); - Console::WriteLine("{0}'s population is: {1}", "Trapperville", population1["trapperville"]); - Console::WriteLine("{0}'s population is: {1}", "Doggerton", population1["DOGGERTON"]); - Console::WriteLine("{0}'s population is: {1}", "New Hollow", population1["New hoLLow"]); - Console::WriteLine("{0}'s population is: {1}", "McHenry", population1["MchenrY"]); - - SortedList^ population2 = CollectionsUtil::CreateCaseInsensitiveSortedList(); - - for each (String^ city in population1->Keys) - { - population2->Add(city, population1[city]); - } - - // Select cities from the sorted list using mixed case. - Console::WriteLine("\nCase insensitive sorted list results:\n"); - Console::WriteLine("{0}'s population is: {1}", "Trapperville", population2["trapPeRVille"]); - Console::WriteLine("{0}'s population is: {1}", "Doggerton", population2["dOGGeRtON"]); - Console::WriteLine("{0}'s population is: {1}", "New Hollow", population2["nEW hOLLOW"]); - Console::WriteLine("{0}'s population is: {1}", "McHenry", population2["MchEnrY"]); - } -}; - -int main() -{ - TestCollectionsUtils::Main(); -} - -// This program displays the following output to the console -// -// Case insensitive hashtable results: -// -// Trapperville's population is: 15 -// Doggerton's population is: 230 -// New Hollow's population is: 1234 -// McHenry's population is: 185 -// -// Case insensitive sorted list results: -// -// Trapperville's population is: 15 -// Doggerton's population is: 230 -// New Hollow's population is: 1234 -// McHenry's population is: 185 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp deleted file mode 100644 index 9fef255cba7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Threading; - -public ref class DerivedCollection : public NameObjectCollectionBase { - -private: - DictionaryEntry^ _de; - - // Creates an empty collection. -public: - DerivedCollection() { - _de = gcnew DictionaryEntry(); - } - - // Adds elements from an IDictionary into the new collection. - DerivedCollection( IDictionary^ d, Boolean bReadOnly ) { - - _de = gcnew DictionaryEntry(); - - for each ( DictionaryEntry^ de in d ) { - this->BaseAdd( (String^) de->Key, de->Value ); - } - this->IsReadOnly = bReadOnly; - } - - // Gets a key-and-value pair (DictionaryEntry) using an index. - property DictionaryEntry^ default[ int ] { - DictionaryEntry^ get(int index) { - _de->Key = this->BaseGetKey(index); - _de->Value = this->BaseGet(index); - return( _de ); - } - } - - // Gets or sets the value associated with the specified key. - property Object^ default[ String^ ] { - Object^ get(String^ key) { - return( this->BaseGet( key ) ); - } - void set( String^ key, Object^ value ) { - this->BaseSet( key, value ); - } - } - - // Gets a String array that contains all the keys in the collection. - property array^ AllKeys { - array^ get() { - return( (array^)this->BaseGetAllKeys() ); - } - } - - // Gets an Object array that contains all the values in the collection. - property Array^ AllValues { - Array^ get() { - return( this->BaseGetAllValues() ); - } - } - - // Gets a String array that contains all the values in the collection. - property array^ AllStringValues { - array^ get() { - return( (array^) this->BaseGetAllValues( String ::typeid )); - } - } - - // Gets a value indicating if the collection contains keys that are not null. - property Boolean HasKeys { - Boolean get() { - return( this->BaseHasKeys() ); - } - } - - // Adds an entry to the collection. - void Add( String^ key, Object^ value ) { - this->BaseAdd( key, value ); - } - - // Removes an entry with the specified key from the collection. - void Remove( String^ key ) { - this->BaseRemove( key ); - } - - // Removes an entry in the specified index from the collection. - void Remove( int index ) { - this->BaseRemoveAt( index ); - } - - // Clears all the elements in the collection. - void Clear() { - this->BaseClear(); - } -}; - -public ref class SamplesNameObjectCollectionBaseKeys -{ -public: - static void Main() - { - // - // Create a collection derived from NameObjectCollectionBase - NameObjectCollectionBase^ myBaseCollection = gcnew DerivedCollection(); - // Get the ICollection from NameObjectCollectionBase.KeysCollection - ICollection^ myKeysCollection = myBaseCollection->Keys; - bool lockTaken = false; - try - { - Monitor::Enter(myKeysCollection->SyncRoot, lockTaken); - for each (Object^ item in myKeysCollection) - { - // Insert your code here. - } - } - finally - { - if (lockTaken) - { - Monitor::Exit(myKeysCollection->SyncRoot); - } - } - // - } -}; - -int main() -{ - SamplesNameObjectCollectionBaseKeys::Main(); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp deleted file mode 100644 index 65a52f0b6cc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - -using namespace System; -using namespace System::IO; - -void main() -{ - try - { -// - Console::WriteLine("Hello World"); - FileStream^ fs = gcnew FileStream("Test.txt", FileMode::Create); - // First, save the standard output. - TextWriter^ tmp = Console::Out; - StreamWriter^ sw = gcnew StreamWriter(fs); - Console::SetOut(sw); - Console::WriteLine("Hello file"); - Console::SetOut(tmp); - Console::WriteLine("Hello World"); - sw->Close(); -// - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - Console::WriteLine(ex->StackTrace); - } -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp deleted file mode 100644 index 829d3eb8423..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Console.WindowLeft.cpp : main project file. - -// -using namespace System; - -void ShowConsoleStatistics() -{ - Console::WriteLine("Console statistics:"); - Console::WriteLine(" Buffer: {0} x {1}", Console::BufferHeight, Console::BufferWidth); - Console::WriteLine(" Window: {0} x {1}", Console::WindowHeight, Console::WindowWidth); - Console::WriteLine(" Window starts at {0}.", Console::WindowLeft); - Console::WriteLine("Press <- or -> to move window, Ctrl+C to exit."); -} - -int main() -{ - ConsoleKeyInfo key; - bool moved = false; - - Console::BufferWidth = 120; - Console::Clear(); - - ShowConsoleStatistics(); - - do { - key = Console::ReadKey(true); - if (key.Key == ConsoleKey::LeftArrow) - { - int pos = Console::WindowLeft - 1; - if (pos >= 0 && pos + Console::WindowWidth <= Console::BufferWidth) - { - Console::WindowLeft = pos; - moved = true; - } - } - else if (key.Key == ConsoleKey::RightArrow) - { - int pos = Console::WindowLeft + 1; - if (pos + Console::WindowWidth <= Console::BufferWidth) - { - Console::WindowLeft = pos; - moved = true; - } - } - if (moved) - { - ShowConsoleStatistics(); - moved = false; - } - Console::WriteLine(); - } while (true); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp deleted file mode 100644 index 2e488e00359..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -//void main(array ^args) -void main() -{ - DateTime dateRecorded(2009, 6, 15); - DateTime startTime(1, 1, 1, 0, 30, 0); - TimeSpan interval(12, 0, 0); - - Double temperature1 = 52.8; - Double temperature2 = 63.5; - - Console::Write("Date: {0:d}:\n Temperature at {1:t}: {2}\n Temperature at {3:t}: {4}\n", - dateRecorded, startTime, temperature1, - startTime.Add(interval), temperature2); - Console::ReadLine(); -} -// The example displays the following output: -// Date: 6/15/2009: -// Temperature at 12:30 AM: 52.8 -// Temperature at 12:30 PM: 63.5 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp deleted file mode 100644 index 33eb3685a6c..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// Convert.ChangeType00.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -ref class InterceptProvider : IFormatProvider -{ -public: - virtual Object^ GetFormat(Type^ formatType) - { - CultureInfo^ culture; - if (formatType == NumberFormatInfo::typeid) { - Console::WriteLine(" Returning a fr-FR numeric format provider."); - - culture = gcnew CultureInfo("fr-FR"); - return culture->NumberFormat; - } - else if (formatType == DateTimeFormatInfo::typeid) { - Console::WriteLine(" Returning an en-US date/time format provider."); - culture = gcnew CultureInfo("en-US"); - return culture->DateTimeFormat; - } - else { - Console::WriteLine(" Requesting a format provider of {0}.", formatType->Name); - return nullptr; - } - } -}; - -void main() -{ - array^ values = gcnew array { 103.5, gcnew DateTime(2010, 12, 26, 14, 34, 0) }; - IFormatProvider^ provider = gcnew InterceptProvider(); - - // Convert value to each of the types represented in TypeCode enum. - for each (Object^ value in values) - { - // Iterate types in TypeCode enum. - for each (TypeCode enumType in (array^) Enum::GetValues(TypeCode::typeid)) - { - if (enumType == TypeCode::DBNull || enumType == TypeCode::Empty) continue; - - try { - Console::WriteLine("{0} ({1}) --> {2} ({3}).", - value, value->GetType()->Name, - Convert::ChangeType(value, enumType, provider), - enumType.ToString()); - } - catch (InvalidCastException^ e) { - Console::WriteLine("Cannot convert a {0} to a {1}", - value->GetType()->Name, enumType.ToString()); - } - catch (OverflowException^ e) { - Console::WriteLine("Overflow: {0} is out of the range of a {1}", - value, enumType.ToString()); - } - } - Console::WriteLine(); - } -} -// The example displays the following output: -// 103.5 (Double) --> 103.5 (Object). -// 103.5 (Double) --> True (Boolean). -// Cannot convert a Double to a Char -// 103.5 (Double) --> 104 (SByte). -// 103.5 (Double) --> 104 (Byte). -// 103.5 (Double) --> 104 (Int16). -// 103.5 (Double) --> 104 (UInt16). -// 103.5 (Double) --> 104 (Int32). -// 103.5 (Double) --> 104 (UInt32). -// 103.5 (Double) --> 104 (Int64). -// 103.5 (Double) --> 104 (UInt64). -// 103.5 (Double) --> 103.5 (Single). -// 103.5 (Double) --> 103.5 (Double). -// 103.5 (Double) --> 103.5 (Decimal). -// Cannot convert a Double to a DateTime -// Returning a fr-FR numeric format provider. -// 103.5 (Double) --> 103,5 (String). -// -// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (Object). -// Cannot convert a DateTime to a Boolean -// Cannot convert a DateTime to a Char -// Cannot convert a DateTime to a SByte -// Cannot convert a DateTime to a Byte -// Cannot convert a DateTime to a Int16 -// Cannot convert a DateTime to a UInt16 -// Cannot convert a DateTime to a Int32 -// Cannot convert a DateTime to a UInt32 -// Cannot convert a DateTime to a Int64 -// Cannot convert a DateTime to a UInt64 -// Cannot convert a DateTime to a Single -// Cannot convert a DateTime to a Double -// Cannot convert a DateTime to a Decimal -// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (DateTime). -// Returning an en-US date/time format provider. -// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (String). -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp deleted file mode 100644 index 36b41bcee35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Convert.ChangeType03.cpp : main project file. - -// -using namespace System; -using namespace System::Globalization; - -public ref class Temperature : IConvertible -{ -private: - Decimal m_Temp; - -public: - Temperature(Decimal temperature) - { - m_Temp = temperature; - } - - property Decimal Celsius { - Decimal get() { return m_Temp; } - } - - property Decimal Kelvin { - Decimal get() { return m_Temp + (Decimal) 273.15; } - } - - property Decimal Fahrenheit { - Decimal get() { return Math::Round((Decimal) (m_Temp * 9 / 5 + 32), 2); } - } - - virtual String^ ToString() - override { - return m_Temp.ToString("N2") + "°C"; - } - - // IConvertible implementations. - virtual TypeCode GetTypeCode() - { - return TypeCode::Object; - } - - virtual bool ToBoolean(IFormatProvider^ provider) - { - if (m_Temp == 0) - return false; - else - return true; - } - - virtual Byte ToByte(IFormatProvider^ provider) - { - if (m_Temp < Byte::MinValue || m_Temp > Byte::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Byte type.", - m_Temp)); - else - return Decimal::ToByte(m_Temp); - } - - virtual Char ToChar(IFormatProvider^ provider) - { - throw gcnew InvalidCastException("Temperature to Char conversion is not supported."); - } - - virtual DateTime ToDateTime(IFormatProvider^ provider) - { - throw gcnew InvalidCastException("Temperature to DateTime conversion is not supported."); - } - - virtual Decimal ToDecimal(IFormatProvider^ provider) - { - return m_Temp; - } - - virtual Double ToDouble(IFormatProvider^ provider) - { - return Decimal::ToDouble(m_Temp); - } - - virtual Int16 ToInt16(IFormatProvider^ provider) - { - if (m_Temp < Int16::MinValue || m_Temp > Int16::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Int16 type.", - m_Temp)); - else - return Decimal::ToInt16(m_Temp); - } - - virtual Int32 ToInt32(IFormatProvider^ provider) - { - if (m_Temp < Int32::MinValue || m_Temp > Int32::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Int32 type.", - m_Temp)); - else - return Decimal::ToInt32(m_Temp); - } - - virtual Int64 ToInt64(IFormatProvider^ provider) - { - if (m_Temp < Int64::MinValue || m_Temp > Int64::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the Int64 type.", - m_Temp)); - else - return Decimal::ToInt64(m_Temp); - } - - virtual SByte ToSByte(IFormatProvider^ provider) - { - if (m_Temp < SByte::MinValue || m_Temp > SByte::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the SByte type.", - m_Temp)); - else - return Decimal::ToSByte(m_Temp); - } - - virtual Single ToSingle(IFormatProvider^ provider) - { - return Decimal::ToSingle(m_Temp); - } - - virtual String^ ToString(IFormatProvider^ provider) - { - return m_Temp.ToString("N2", provider) + "°C"; - } - - virtual Object^ ToType(Type^ conversionType, IFormatProvider^ provider) - { - switch (Type::GetTypeCode(conversionType)) - { - case TypeCode::Boolean: - return ToBoolean(nullptr); - case TypeCode::Byte: - return ToByte(nullptr); - case TypeCode::Char: - return ToChar(nullptr); - case TypeCode::DateTime: - return ToDateTime(nullptr); - case TypeCode::Decimal: - return ToDecimal(nullptr); - case TypeCode::Double: - return ToDouble(nullptr); - case TypeCode::Int16: - return ToInt16(nullptr); - case TypeCode::Int32: - return ToInt32(nullptr); - case TypeCode::Int64: - return ToInt64(nullptr); - case TypeCode::Object: - if (Temperature::typeid->Equals(conversionType)) - return this; - else - throw gcnew InvalidCastException(String::Format("Conversion to a {0} is not supported.", - conversionType->Name)); - case TypeCode::SByte: - return ToSByte(nullptr); - case TypeCode::Single: - return ToSingle(nullptr); - case TypeCode::String: - return ToString(provider); - case TypeCode::UInt16: - return ToUInt16(nullptr); - case TypeCode::UInt32: - return ToUInt32(nullptr); - case TypeCode::UInt64: - return ToUInt64(nullptr); - default: - throw gcnew InvalidCastException(String::Format("Conversion to {0} is not supported.", conversionType->Name)); - } - } - - virtual UInt16 ToUInt16(IFormatProvider^ provider) - { - if (m_Temp < UInt16::MinValue || m_Temp > UInt16::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the UInt16 type.", - m_Temp)); - else - return Decimal::ToUInt16(m_Temp); - } - - virtual UInt32 ToUInt32(IFormatProvider^ provider) - { - if (m_Temp < UInt32::MinValue || m_Temp > UInt32::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the UInt32 type.", - m_Temp)); - else - return Decimal::ToUInt32(m_Temp); - } - - virtual UInt64 ToUInt64(IFormatProvider^ provider) - { - if (m_Temp < UInt64::MinValue || m_Temp > UInt64::MaxValue) - throw gcnew OverflowException(String::Format("{0} is out of range of the UInt64 type.", - m_Temp)); - else - return Decimal::ToUInt64(m_Temp); - } -}; -// - -// -void main() -{ - Temperature^ cool = gcnew Temperature(5); - array^ targetTypes = gcnew array { SByte::typeid, Int16::typeid, Int32::typeid, - Int64::typeid, Byte::typeid, UInt16::typeid, - UInt32::typeid, UInt64::typeid, Decimal::typeid, - Single::typeid, Double::typeid, String::typeid }; - CultureInfo^ provider = gcnew CultureInfo("fr-FR"); - - for each (Type^ targetType in targetTypes) - { - try { - Object^ value = Convert::ChangeType(cool, targetType, provider); - Console::WriteLine("Converted {0} {1} to {2} {3}.", - cool->GetType()->Name, cool->ToString(), - targetType->Name, value); - } - catch (InvalidCastException^) { - Console::WriteLine("Unsupported {0} --> {1} conversion.", - cool->GetType()->Name, targetType->Name); - } - catch (OverflowException^) { - Console::WriteLine("{0} is out of range of the {1} type.", - cool, targetType->Name); - } - } -} -// The example dosplays the following output: -// Converted Temperature 5.00°C to SByte 5. -// Converted Temperature 5.00°C to Int16 5. -// Converted Temperature 5.00°C to Int32 5. -// Converted Temperature 5.00°C to Int64 5. -// Converted Temperature 5.00°C to Byte 5. -// Converted Temperature 5.00°C to UInt16 5. -// Converted Temperature 5.00°C to UInt32 5. -// Converted Temperature 5.00°C to UInt64 5. -// Converted Temperature 5.00°C to Decimal 5. -// Converted Temperature 5.00°C to Single 5. -// Converted Temperature 5.00°C to Double 5. -// Converted Temperature 5.00°C to String 5,00°C. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp deleted file mode 100644 index 162b7f8fc5b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// ChangeType01.cpp : main project file. - -// -using namespace System; - -void main() -{ - Double d = -2.345; - int i = (int) Convert::ChangeType(d, TypeCode::Int32); - - Console::WriteLine("The Double {0} when converted to an Int32 is {1}", d, i); - - String^ s = "12/12/2009"; - DateTime dt = (DateTime)Convert::ChangeType(s, DateTime::typeid); - - Console::WriteLine("The String {0} when converted to a Date is {1}", s, dt); -} -// The example displays the following output: -// The Double -2.345 when converted to an Int32 is -2 -// The String 12/12/2009 when converted to a Date is 12/12/2009 12:00:00 AM -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp deleted file mode 100644 index c114fe2f378..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// Convert.ToByte.cpp : main project file. - -// -using namespace System; - -void main() -{ - bool falseFlag = false; - bool trueFlag = true; - - Console::WriteLine("{0} converts to {1}.", falseFlag, - Convert::ToByte(falseFlag)); - Console::WriteLine("{0} converts to {1}.", trueFlag, - Convert::ToByte(trueFlag)); -} -// The example displays the following output: -// False converts to 0. -// True converts to 1. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp deleted file mode 100644 index d4d8b439ff3..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -using namespace System; - -void main() -{ - DateTime dateValue(2013, 9, 15, 12, 0, 0); - - array^ minutes = { .01667, .08333, .16667, .25, .33333, - .5, .66667, 1, 2, 15, 30, 17, 45, - 60, 180, 60 * 24 }; - - for each (Double minute in minutes) - Console::WriteLine("{0} + {1} minute(s) = {2}", dateValue, minute, - dateValue.AddMinutes(minute)); -} -// The example displays the following output on a system whose current culture is en-US: -// 9/15/2013 12:00:00 PM + 0.01667 minute(s) = 9/15/2013 12:00:01 PM -// 9/15/2013 12:00:00 PM + 0.08333 minute(s) = 9/15/2013 12:00:05 PM -// 9/15/2013 12:00:00 PM + 0.16667 minute(s) = 9/15/2013 12:00:10 PM -// 9/15/2013 12:00:00 PM + 0.25 minute(s) = 9/15/2013 12:00:15 PM -// 9/15/2013 12:00:00 PM + 0.33333 minute(s) = 9/15/2013 12:00:20 PM -// 9/15/2013 12:00:00 PM + 0.5 minute(s) = 9/15/2013 12:00:30 PM -// 9/15/2013 12:00:00 PM + 0.66667 minute(s) = 9/15/2013 12:00:40 PM -// 9/15/2013 12:00:00 PM + 1 minute(s) = 9/15/2013 12:01:00 PM -// 9/15/2013 12:00:00 PM + 2 minute(s) = 9/15/2013 12:02:00 PM -// 9/15/2013 12:00:00 PM + 15 minute(s) = 9/15/2013 12:15:00 PM -// 9/15/2013 12:00:00 PM + 30 minute(s) = 9/15/2013 12:30:00 PM -// 9/15/2013 12:00:00 PM + 17 minute(s) = 9/15/2013 12:17:00 PM -// 9/15/2013 12:00:00 PM + 45 minute(s) = 9/15/2013 12:45:00 PM -// 9/15/2013 12:00:00 PM + 60 minute(s) = 9/15/2013 1:00:00 PM -// 9/15/2013 12:00:00 PM + 180 minute(s) = 9/15/2013 3:00:00 PM -// 9/15/2013 12:00:00 PM + 1440 minute(s) = 9/16/2013 12:00:00 PM -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp deleted file mode 100644 index 6392ec34c1a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - DateTime localDate = DateTime::Now; - array^ cultureNames = { "en-US", "en-GB", "fr-FR", - "de-DE", "ru-RU" }; - - for each (String^ cultureName in cultureNames) { - CultureInfo^ culture = gcnew CultureInfo(cultureName); - Console::WriteLine("{0}: {1}", cultureName, - localDate.ToString(culture)); - } -} -// The example displays the following output: -// en-US: 6/19/2015 10:03:06 AM -// en-GB: 19/06/2015 10:03:06 -// fr-FR: 19/06/2015 10:03:06 -// de-DE: 19.06.2015 10:03:06 -// ru-RU: 19.06.2015 10:03:06 -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp deleted file mode 100644 index 3026aeda282..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// -using namespace System; -using namespace System::Globalization; - -void main() -{ - DateTime localDate = DateTime::Now; - DateTime utcDate = DateTime::UtcNow; - array^ cultureNames = { "en-US", "en-GB", "fr-FR", - "de-DE", "ru-RU" } ; - - for each (String^ cultureName in cultureNames) { - CultureInfo^ culture = gcnew CultureInfo(cultureName); - Console::WriteLine("{0}:", culture->NativeName); - Console::WriteLine(" Local date and time: {0}, {1:G}", - localDate.ToString(culture), localDate.Kind); - Console::WriteLine(" UTC date and time: {0}, {1:G}\n", - utcDate.ToString(culture), utcDate.Kind); - } -} -// The example displays the following output: -// English (United States): -// Local date and time: 6/19/2015 10:35:50 AM, Local -// UTC date and time: 6/19/2015 5:35:50 PM, Utc -// -// English (United Kingdom): -// Local date and time: 19/06/2015 10:35:50, Local -// UTC date and time: 19/06/2015 17:35:50, Utc -// -// français (France): -// Local date and time: 19/06/2015 10:35:50, Local -// UTC date and time: 19/06/2015 17:35:50, Utc -// -// Deutsch (Deutschland): -// Local date and time: 19.06.2015 10:35:50, Local -// UTC date and time: 19.06.2015 17:35:50, Utc -// -// руÑÑкий (РоÑÑиÑ): -// Local date and time: 19.06.2015 10:35:50, Local -// UTC date and time: 19.06.2015 17:35:50, Utc -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp deleted file mode 100644 index e2e407522b7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of decimal values. - array^ values = { Decimal::Parse("78"), - Decimal(78000,0,0,false,3), - Decimal::Parse("78.999"), - Decimal::Parse("255.999"), - Decimal::Parse("256"), - Decimal::Parse("127.999"), - Decimal::Parse("128"), - Decimal::Parse("-0.999"), - Decimal::Parse("-1"), - Decimal::Parse("-128.999"), - Decimal::Parse("-129") }; - for each (Decimal value in values) { - try { - SByte byteValue = (SByte) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, byteValue, - byteValue.GetType()->Name); - } - catch (OverflowException^ e) { - Console::WriteLine("OverflowException: Cannot convert {0}", - value); - } - } -} -// The example displays the following output: -// 78 (Decimal) --> 78 (SByte) -// 78.000 (Decimal) --> 78 (SByte) -// 78.999 (Decimal) --> 78 (SByte) -// OverflowException: Cannot convert 255.999 -// OverflowException: Cannot convert 256 -// 127.999 (Decimal) --> 127 (SByte) -// OverflowException: Cannot convert 128 -// -0.999 (Decimal) --> 0 (SByte) -// -1 (Decimal) --> -1 (SByte) -// -128.999 (Decimal) --> -128 (SByte) -// OverflowException: Cannot convert -129 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp deleted file mode 100644 index ddfc63d3603..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -using namespace System; - -void main() -{ - // Define an array of Decimal values. - array^ values = { Decimal::Parse("0.0000000000000000000000000001"), - Decimal::Parse("0.0000000000123456789123456789"), - Decimal::Parse("123"), - Decimal(123000000, 0, 0, false, 6), - Decimal::Parse("123456789.123456789"), - Decimal::Parse("123456789123456789123456789"), - Decimal::MinValue, Decimal::MaxValue }; - // Convert each value to a double. - for each (Decimal value in values) { - float dblValue = (float) value; - Console::WriteLine("{0} ({1}) --> {2} ({3})", value, - value.GetType()->Name, dblValue, - dblValue.GetType()->Name); - } -} -// The example displays the following output: -// 0.0000000000000000000000000001 (Decimal) --> 1E-28 (Single) -// 0.0000000000123456789123456789 (Decimal) --> 1.234568E-11 (Single) -// 123 (Decimal) --> 123 (Single) -// 123.000000 (Decimal) --> 123 (Single) -// 123456789.123456789 (Decimal) --> 1.234568E+08 (Single) -// 123456789123456789123456789 (Decimal) --> 1.234568E+26 (Single) -// -79228162514264337593543950335 (Decimal) --> -7.922816E+28 (Single) -// 79228162514264337593543950335 (Decimal) --> 7.922816E+28 (Single) -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp deleted file mode 100644 index 2e0fc257300..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -#define TRACE - -#using - -using namespace System; -using namespace System::Diagnostics; - -namespace TestingTracing -{ - // - public ref class ErrorFilter : TraceFilter - { - public: - virtual bool ShouldTrace(TraceEventCache^ cache, String^ source, - TraceEventType eventType, int id, String^ formatOrMessage, - array^ args, Object^ data, array^ dataArray) override - { - return eventType == TraceEventType::Error; - } - }; - // - - ref class TraceTest - { - public: - static void Main() - { - TraceSource^ ts = gcnew TraceSource("TraceTest"); - SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose"); - ts->Switch = sourceSwitch; - ConsoleTraceListener^ ctl = gcnew ConsoleTraceListener(); - ctl->Name = "console"; - ctl->TraceOutputOptions = TraceOptions::DateTime; - ctl->Filter = gcnew ErrorFilter(); - ts->Listeners->Add(ctl); - - ts->TraceEvent(TraceEventType::Warning, 1, "*** This event will be filtered out ***"); - // this event will be get displayed - ts->TraceEvent(TraceEventType::Error, 2, "*** This event will be be displayed ***"); - - ts->Flush(); - ts->Close(); - } - }; -} - -int main() -{ - TestingTracing::TraceTest::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp deleted file mode 100644 index 69b58914b35..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// dllmain.cpp : Defines the entry point for the DLL application. -#include "stdafx.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp deleted file mode 100644 index c6836e32db0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp +++ /dev/null @@ -1,8 +0,0 @@ -// stdafx.cpp : source file that includes just the standard includes -// TestDll.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h deleted file mode 100644 index f3a07375c76..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h +++ /dev/null @@ -1,16 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include - - - -// TODO: reference additional headers your program requires here diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h deleted file mode 100644 index 87c0086de75..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp deleted file mode 100644 index f2d4821f015..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// TestDll.cpp : Defines the exported functions for the DLL application. -// - -#include "stdafx.h" -#include "TestDll.h" - - -// This is an example of an exported variable -// TESTDLL_API int nTestDll=0; - -// This is an example of an exported function. -//TESTDLL_API int fnTestDll(void) -//{ -// return 42; -//} - -// -__declspec(dllexport) int Double(int number) -{ - return number * 2; -} -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h deleted file mode 100644 index 71f013b09d0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h +++ /dev/null @@ -1,22 +0,0 @@ -// The following ifdef block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the TESTDLL_EXPORTS -// symbol defined on the command line. This symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// TESTDLL_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. -#ifdef TESTDLL_EXPORTS -#define TESTDLL_API __declspec(dllexport) -#else -#define TESTDLL_API __declspec(dllimport) -#endif - -// This class is exported from the TestDll.dll -class TESTDLL_API CTestDll { -public: - CTestDll(void); - // TODO: add your methods here. -}; - -extern TESTDLL_API int nTestDll; - -TESTDLL_API int fnTestDll(void); diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj deleted file mode 100644 index 077c9128720..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {FFF28EB8-7F4C-4D3F-B492-C9F17D5CFE1B} - Win32Proj - TestDll - - - - DynamicLibrary - true - Unicode - - - DynamicLibrary - false - true - Unicode - - - - - - - - - - - - - true - - - false - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTDLL_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;TESTDLL_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - true - true - - - - - - - - - - - - - false - - - false - - - - - Create - Create - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp deleted file mode 100644 index 94a5f963ddb..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp +++ /dev/null @@ -1,47 +0,0 @@ - -// -using namespace System; - -public ref class TestClass{}; - -int main() -{ - TestClass^ test = gcnew TestClass; - array^ objectsToCompare = { test, test->ToString(), 123, - (123).ToString(), "some text", - "Some Text" }; - String^ s = "some text"; - for each (Object^ objectToCompare in objectsToCompare) { - try { - Int32 i = s->CompareTo(objectToCompare); - Console::WriteLine("Comparing '{0}' with '{1}': {2}", - s, objectToCompare, i); - } - catch (ArgumentException^ e) { - Console::WriteLine("Bad argument: {0} (type {1})", - objectToCompare, - objectToCompare->GetType()->Name); - Console::WriteLine("Exception information: {0}", e); - } - Console::WriteLine(); - } -} -// The example displays the following output: -// Bad argument: TestClass (type TestClass) -// Exception information: System.ArgumentException: Object must be of type String. -// at System.String.CompareTo(Object value) -// at Example.Main() -// -// Comparing 'some text' with 'TestClass': -1 -// -// Bad argument: 123 (type Int32) -// Exception information: System.ArgumentException: Object must be of type String. -// at System.String.CompareTo(Object value) -// at Example.Main() -// -// Comparing 'some text' with '123': 1 -// -// Comparing 'some text' with 'some text': 0 -// -// Comparing 'some text' with 'Some Text': -1 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp deleted file mode 100644 index ed84d371b80..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp +++ /dev/null @@ -1,54 +0,0 @@ - -// -using namespace System; -const long maxGarbage = 1000; -ref class MyGCCollectClass -{ -public: - void MakeSomeGarbage() - { - Version^ vt; - for ( int i = 0; i < maxGarbage; i++ ) - { - - // Create objects and release them to fill up memory - // with unused objects. - vt = gcnew Version; - - } - } - -}; - -int main() -{ - MyGCCollectClass^ myGCCol = gcnew MyGCCollectClass; - - // Determine the maximum number of generations the system - // garbage collector currently supports. - Console::WriteLine( "The highest generation is {0}", GC::MaxGeneration ); - myGCCol->MakeSomeGarbage(); - - // Determine which generation myGCCol object is stored in. - Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); - - // Determine the best available approximation of the number - // of bytes currently allocated in managed memory. - Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); - - // Perform a collection of generation 0 only. - GC::Collect( 0 ); - - // Determine which generation myGCCol object is stored in. - Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); - Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); - - // Perform a collection of all generations up to and including 2. - GC::Collect( 2 ); - - // Determine which generation myGCCol object is stored in. - Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); - Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp deleted file mode 100644 index b8f17f0074a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ numbersToConvert = gcnew array { 162345, 32183, -54000, - Int64::MaxValue/2 }; - Int32 newNumber; - for each (Int64 number in numbersToConvert) - { - if ((number >= Int32::MinValue) && (number <= Int32::MaxValue)) - { - newNumber = Convert::ToInt32(number); - Console::WriteLine("Successfully converted {0} to an Int32.", - newNumber); - } - else - { - Console::WriteLine("Unable to convert {0} to an Int32.", number); - } - } -} -// The example displays the following output to the console: -// Successfully converted 162345 to an Int32. -// Successfully converted 32183 to an Int32. -// Successfully converted -54000 to an Int32. -// Unable to convert 4611686018427387903 to an Int32. -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp deleted file mode 100644 index c6b41982d9d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -class NotTooSafeStringReverse -{ -public: - static void Main() - { - String^ stringA = "I seem to be turned around!"; - int copylen = stringA->Length; - - // Allocate HGlobal memory for source and destination strings - IntPtr sptr = Marshal::StringToHGlobalAnsi(stringA); - IntPtr dptr = Marshal::AllocHGlobal(copylen + 1); - - char *src = (char *)sptr.ToPointer(); - char *dst = (char *)dptr.ToPointer(); - - if (copylen > 0) - { - // set the source pointer to the end of the string - // to do a reverse copy. - src += copylen - 1; - - while (copylen-- > 0) - { - *dst++ = *src--; - } - *dst = 0; - } - String^ stringB = Marshal::PtrToStringAnsi(dptr); - - Console::WriteLine("Original:\n{0}\n", stringA); - Console::WriteLine("Reversed:\n{0}", stringB); - - // Free HGlobal memory - Marshal::FreeHGlobal(dptr); - Marshal::FreeHGlobal(sptr); - } -}; - -int main() -{ - NotTooSafeStringReverse::Main(); -} - -// The progam has the following output: -// -// Original: -// I seem to be turned around! -// -// Reversed: -// !dnuora denrut eb ot mees I -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp deleted file mode 100644 index 40f37b3e60b..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::IO::Pipes; -using namespace System::Diagnostics; - -ref class PipeStreamExample -{ -private: - static array^ matchSign = {9, 0, 9, 0}; - -public: - static void Main() - { - array^ args = Environment::GetCommandLineArgs(); - if (args->Length < 2) - { - Process^ clientProcess = gcnew Process(); - - clientProcess->StartInfo->FileName = Environment::CommandLine; - - AnonymousPipeServerStream^ pipeServer = - gcnew AnonymousPipeServerStream(PipeDirection::In, - HandleInheritability::Inheritable); - // Pass the client process a handle to the server. - clientProcess->StartInfo->Arguments = pipeServer->GetClientHandleAsString(); - clientProcess->StartInfo->UseShellExecute = false; - Console::WriteLine("[SERVER] Starting client process..."); - clientProcess->Start(); - - pipeServer->DisposeLocalCopyOfClientHandle(); - - try - { - if (WaitForClientSign(pipeServer)) - { - Console::WriteLine("[SERVER] Valid sign code received!"); - } - else - { - Console::WriteLine("[SERVER] Invalid sign code received!"); - } - } - catch (IOException^ e) - { - Console::WriteLine("[SERVER] Error: {0}", e->Message); - } - clientProcess->WaitForExit(); - clientProcess->Close(); - Console::WriteLine("[SERVER] Client quit. Server terminating."); - } - else - { - PipeStream^ pipeClient = - gcnew AnonymousPipeClientStream(PipeDirection::Out, args[1]); - try - { - Console::WriteLine("[CLIENT] Sending sign code..."); - SendClientSign(pipeClient); - } - catch (IOException^ e) - { - Console::WriteLine("[CLIENT] Error: {0}", e->Message); - } - Console::WriteLine("[CLIENT] Terminating."); - } - } - - // -private: - static bool WaitForClientSign(PipeStream^ inStream) - { - array^ inSign = gcnew array(matchSign->Length); - int len = inStream->Read(inSign, 0, matchSign->Length); - bool valid = len == matchSign->Length; - - while (valid && len-- > 0) - { - valid = valid && (matchSign[len] == inSign[len]); - } - return valid; - } - // - - static void SendClientSign(PipeStream^ outStream) - { - outStream->Write(matchSign, 0, matchSign->Length); - } -}; - -int main() -{ - PipeStreamExample::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp deleted file mode 100644 index e08099e7418..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -using namespace System; - -// Define the "titleAuthor" table of the Microsoft "pubs" database. -value struct titleAuthor -{ - public: - // Author ID; format ###-##-#### - String^ au_id; - // Title ID; format AA#### - String^ title_id; - // Author ORD is nullable. - Nullable au_ord; - // Royalty Percent is nullable. - Nullable royaltyper; - - // Display the values of the titleAuthor array elements. - static void Display(String^ dspTitle, - array^ dspAllTitleAuthors) - { - Console::WriteLine("*** {0} ***", dspTitle); - for each (titleAuthor dspTA in dspAllTitleAuthors) { - Console::WriteLine("Author ID ... {0}", dspTA.au_id); - Console::WriteLine("Title ID .... {0}", dspTA.title_id); - Console::WriteLine("Author ORD .. {0}", dspTA.au_ord.HasValue ? - dspTA.au_ord.Value : -1); - Console::WriteLine("Royalty % ... {0}", dspTA.royaltyper.HasValue ? - dspTA.royaltyper.Value : 0); - Console::WriteLine(); - } - } -}; - -void main() -{ - // Declare and initialize the titleAuthor array. - array^ ta = gcnew array(3); - ta[0].au_id = "712-32-1176"; - ta[0].title_id = "PS3333"; - ta[0].au_ord = 1; - ta[0].royaltyper = 100; - - ta[1].au_id = "213-46-8915"; - ta[1].title_id = "BU1032"; -// ta[1].au_ord = nullptr; -// ta[1].royaltyper = nullptr; - - ta[2].au_id = "672-71-3249"; - ta[2].title_id = "TC7777"; -// ta[2].au_ord = nullptr; - ta[2].royaltyper = 40; - - // Display the values of the array elements, and - // display a legend. - titleAuthor::Display("Title Authors Table", ta); - Console::WriteLine("Legend:"); - Console::WriteLine("An Author ORD of -1 means no value is defined."); - Console::WriteLine("A Royalty % of 0 means no value is defined."); -} -// The example displays the following output: -// *** Title Authors Table *** -// Author ID ... 712-32-1176 -// Title ID .... PS3333 -// Author ORD .. 1 -// Royalty % ... 100 -// -// Author ID ... 213-46-8915 -// Title ID .... BU1032 -// Author ORD .. -1 -// Royalty % ... 0 -// -// Author ID ... 672-71-3249 -// Title ID .... TC7777 -// Author ORD .. -1 -// Royalty % ... 40 -// -// Legend: -// An Author ORD of -1 means no value is defined. -// A Royalty % of 0 means no value is defined. -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp deleted file mode 100644 index aed41164638..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -using namespace System; - -void main() -{ - Object^ obj = gcnew Object(); - Console::WriteLine(obj->ToString()); -} -// The example displays the following output: -// System.Object -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp deleted file mode 100644 index 555db31ba29..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; - -namespace Examples -{ - ref class Object1 - { - }; -} - -void main() -{ - Object^ obj1 = gcnew Examples::Object1(); - Console::WriteLine(obj1->ToString()); -} -// The example displays the following output: -// Examples.Object1 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp deleted file mode 100644 index 874d33085c2..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -using namespace System; - -ref class Object2 -{ - private: - Object^ value; - - public: - Object2(Object^ value) - { - this->value = value; - } - - virtual String^ ToString() override - { - return Object::ToString() + ": " + value->ToString(); - } -}; - -void main() -{ - Object2^ obj2 = gcnew Object2(L'a'); - Console::WriteLine(obj2->ToString()); - -} -// The example displays the following output: -// Object2: a -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp deleted file mode 100644 index f2ad3ec6d43..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; - -ref class Example -{}; - -void main() -{ - // Get the assembly from a known type in that assembly. - Type^ t = Example::typeid; - Assembly^ assemFromType = t->Assembly; - Console::WriteLine("Assembly that contains Example:"); - Console::WriteLine(" {0}\n", assemFromType->FullName); - - // Get the currently executing assembly. - Assembly^ currentAssem = Assembly::GetExecutingAssembly(); - Console::WriteLine("Currently executing assembly:"); - Console::WriteLine(" {0}\n", currentAssem->FullName); - - Console::WriteLine("The two Assembly objects are equal: {0}", - assemFromType->Equals(currentAssem)); -} -// The example displays the following output: -// Assembly that contains Example: -// GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -// -// Currently executing assembly: -// GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null -// -// The two Assembly objects are equal: True -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp deleted file mode 100644 index 31f5e221cac..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp +++ /dev/null @@ -1,43 +0,0 @@ - -using namespace System; -using namespace System::Reflection; -using namespace System::Reflection::Emit; - -public ref class CompareGenericTypes -{ -public: - static void Main() - { - try - { - AppDomain^ currentDomain = AppDomain::CurrentDomain; - - AssemblyName^ aName = gcnew AssemblyName("TempAssembly"); - AssemblyBuilder^ ab = currentDomain->DefineDynamicAssembly(aName, AssemblyBuilderAccess::Run); - - ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name); - - TypeBuilder^ tbldr = mb->DefineType("MyNewType", TypeAttributes::Public); - tbldr->DefineGenericParameters("T"); - // - Type^ t1 = tbldr->MakeGenericType(String::typeid); - Type^ t2 = tbldr->MakeGenericType(String::typeid); - bool result = t1->Equals(t2); - // - Console::WriteLine("Types t1 and t2 match: {0:s}", result ? "Yes" : "No"); - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - Console::WriteLine(ex->StackTrace); - } - } -}; - -int main() -{ - CompareGenericTypes::Main(); -} - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp deleted file mode 100644 index 7f81c1fa446..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp +++ /dev/null @@ -1,32 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - -public ref class FieldAttribTest -{ -public: - static int field1 = 99; - - static void Main() - { - Object^ obj = gcnew FieldAttribTest(); - - // - FieldInfo^ fi = obj->GetType()->GetField("field1"); - - if ((fi->Attributes & FieldAttributes::FieldAccessMask) == - FieldAttributes::Public) - { - Console::WriteLine("{0:s} is public. Value: {1:d}", fi->Name, fi->GetValue(obj)); - } - // - } -}; - -int main() -{ - FieldAttribTest::Main(); -} - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp deleted file mode 100644 index 588767ccad5..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - -public ref class ParmInfoTest -{ -public: - static void Main() - { - Object^ obj = gcnew ParmInfoTest; - - // - // Create an array containing the arguments. - array^ args = {"Argument 1", "Argument 2", "Argument 3" }; - - // Initialize a ParameterModifier with the number of parameters. - ParameterModifier p = ParameterModifier(3); - - // Pass the first and third parameters by reference. - p[0] = true; - p[2] = true; - - // The ParameterModifier must be passed as the single element - // of an array. - - array^ mods = { p }; - - // Invoke the method late bound. - obj->GetType()->InvokeMember("MethodName", BindingFlags::InvokeMethod, - nullptr, obj, args, mods, nullptr, nullptr); - // - } - - void MethodName(String^% str1, String^ str2, String^% str3) - { - Console::WriteLine("Called 'MethodName'"); - } -}; - -int main() -{ - ParmInfoTest::Main(); -} - - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp deleted file mode 100644 index 64c01acb0e7..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp +++ /dev/null @@ -1,39 +0,0 @@ -using namespace System; - -ref class FileUtilities -{ - public: - static String^ AppendDirectorySeparator(String^ dir) - { - if (!dir->Trim()->EndsWith(System::IO::Path::DirectorySeparatorChar.ToString())) - return dir->Trim() + System::IO::Path::DirectorySeparatorChar; - else - return dir; - } -}; - - -// -// -// The assembly that exposes its internal types to this assembly should be -// named Assembly1.dll. -// -// The public key of this assembly should correspond to the public key -// specified in the class constructor of the InternalsVisibleTo attribute in the -// Assembly1 assembly. -// -#using as_friend - -using namespace System; - -void main() -{ - String^ dir = L"C:\\Program Files"; - dir = FileUtilities::AppendDirectorySeparator(dir); - Console::WriteLine(dir); -} -// The example displays the following output: -// C:\Program Files\ -// - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp deleted file mode 100644 index d98516de040..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp +++ /dev/null @@ -1,12 +0,0 @@ -// -#using as_friend - -using namespace System; -using namespace Utilities::StringUtilities; - -void main() -{ - String^ s = "The Sign of the Four"; - Console::WriteLine(StringLib::IsFirstLetterUpperCase(s)); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp deleted file mode 100644 index d7d17f47f53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -using namespace System; -using namespace System::Runtime::InteropServices; - -// -[BestFitMapping(false, ThrowOnUnmappableChar = true)] -interface class IMyInterface1 -{ - //Insert code here. -}; -// - -public ref class InteropBFMA : IMyInterface1 -{ -}; - - -int main() -{ - InteropBFMA^ bfma = gcnew InteropBFMA(); - - Console::WriteLine(bfma->GetType()->GetInterfaces()[0]->Name); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp deleted file mode 100644 index 13ef0dc79f1..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -using namespace System; -using namespace System::Runtime::InteropServices; - -// -[StructLayout(LayoutKind::Sequential, CharSet=CharSet::Ansi)] -public ref struct MyPerson -{ -public: - String^ first; - String^ last; -}; -// - - -int main() -{ - -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp deleted file mode 100644 index 75c699ead3d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -[assembly: AssemblyVersion("3.0.0.0")]; -[assembly: ComCompatibleVersion(1,0,0,0)]; -namespace MyNamespace -{ - public ref class TheClass - { - // Insert code. - }; -}; -// - - -int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp deleted file mode 100644 index d6d0e897418..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -using namespace System; -using namespace System::Runtime::InteropServices; - -// -// Some interface -// -[Guid("1F948D8D-D9ED-4CCC-BB61-5C1730E39EE9"), -InterfaceType(ComInterfaceType::InterfaceIsDual)] -public interface class ISomeIFace -{ -}; - -public ref class MyObject : public ISomeIFace -{ -}; - -class DispatchWrapperTest -{ -public: - // - void MyMethod(Object^ o); - - void DoWrap() - { - Object^ o = gcnew MyObject(); - MyMethod(o); // passes o as VT_UNKNOWN - MyMethod(gcnew DispatchWrapper(o)); // passes o as VT_DISPATCH - - //... - } - // -}; - -int main() {} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp deleted file mode 100644 index aefdd15e3e8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::InteropServices; - -private ref class NativeMethods -{ - // Managed class methods don't support varargs so all arguments must be - // explicitly defined. CallingConvention.Cdecl must be used since the - // stack is cleaned up by the caller. - // int printf(const char *format [, argument]...) -public: - [DllImport("msvcrt.dll", CharSet = CharSet::Ansi, - CallingConvention = CallingConvention::Cdecl)] - static int printf(String^ format, int i, double d); - - [DllImport("msvcrt.dll", CharSet = CharSet::Ansi, - CallingConvention = CallingConvention::Cdecl)] - static int printf(String^ format, int i, String^ s); -}; - -void main() -{ - NativeMethods::printf("\nPrint params: %i %f", 99, 99.99); - NativeMethods::printf("\nPrint params: %i %s", 99, "abcd"); -} -// - -// -[DllImport("unmanaged.dll, MyAssembly, Version= 1.0.0.0," - "Culture=neutral, PublicKeyToken=a77e0ba5eab10125")] -int SomeFuncion1(int parm); -// - -// -[DllImport("My.dll", CharSet = CharSet::Ansi, - BestFitMapping = false, - ThrowOnUnmappableChar = true)] -int SomeFuncion2(int parm); -// - -[DllImport("msvcrt.dll", CharSet = CharSet::Ansi, - CallingConvention = CallingConvention::Cdecl)] -int printf(String^ format, ...); - - -namespace znippet4 -{ - // - [DllImport("user32.dll", CharSet = CharSet::Ansi, ExactSpelling = true)] - int MessageBoxA(IntPtr hWnd, String^ Text, - String^ Caption, unsigned int Type); - // -} - -namespace znippet5 -{ - // - [DllImport("user32.dll", SetLastError = true)] - int MessageBoxA(IntPtr hWnd, String^ Text, - String^ Caption, unsigned int Type); - // -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp deleted file mode 100644 index dcb414f56c6..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::InteropServices; - -[assembly: AssemblyVersion("1.2.500.0")]; -[assembly: TypeLibVersion(1,25)]; -namespace MyNamespace -{ - public ref class TheClass - { - // Insert code. - }; -}; -// - - -int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp deleted file mode 100644 index 9bb50f4bd80..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; -using namespace System::Security::Cryptography; -using namespace System::Text; - -class EncryptorExample -{ -public: - static void Main() - { - TripleDESCryptoServiceProvider^ tdesCSP = gcnew TripleDESCryptoServiceProvider(); - - tdesCSP->GenerateKey(); - tdesCSP->GenerateIV(); - String^ quote = - "Things may come to those who wait, but only the " + - "things left by those who hustle. -- Abraham Lincoln"; - array^ encQuote = EncryptString(tdesCSP, quote); - - Console::WriteLine("Encrypted Quote:\n"); - Console::WriteLine(Convert::ToBase64String(encQuote)); - - Console::WriteLine("\nDecrypted Quote:\n"); - Console::WriteLine(DecryptBytes(tdesCSP, encQuote)); - } - - // -public: - static array^ EncryptString(SymmetricAlgorithm^ symAlg, String^ inString) - { - array^ inBlock = UnicodeEncoding::Unicode->GetBytes(inString); - ICryptoTransform^ xfrm = symAlg->CreateEncryptor(); - array^ outBlock = xfrm->TransformFinalBlock(inBlock, 0, inBlock->Length); - - return outBlock; - } - // - - // - static String^ DecryptBytes(SymmetricAlgorithm^ symAlg, array^ inBytes) - { - ICryptoTransform^ xfrm = symAlg->CreateDecryptor(); - array^ outBlock = xfrm->TransformFinalBlock(inBytes, 0, inBytes->Length); - - return UnicodeEncoding::Unicode->GetString(outBlock); - } - // -}; - -int main() -{ - EncryptorExample::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp deleted file mode 100644 index bb909af8192..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp +++ /dev/null @@ -1,39 +0,0 @@ - -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Security::Policy; - -public ref class PrincipalPermTest -{ -public: - void Dummy1() - { - // - PrincipalPermission^ ppBob = gcnew PrincipalPermission("Bob", "Administrator"); - PrincipalPermission^ ppLouise = gcnew PrincipalPermission("Louise", "Administrator"); - IPermission^ pp1 = ppBob->Intersect(ppLouise); - // - } - - void Dummy2() - { - // - IPermission^ pp1 = gcnew PrincipalPermission("", "Administrator"); - // - } - - void Dummy3() - { - // - PrincipalPermission^ ppBob = gcnew PrincipalPermission("Bob", "Administrator"); - PrincipalPermission^ ppLouise = gcnew PrincipalPermission("Louise", "Administrator"); - // - } -}; - - -int main() -{ - -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp deleted file mode 100644 index 80d78080d26..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; -using namespace System::Security; - -int main(array ^args) -{ - SecureString^ testString; - // Define the string value to assign to a new secure string. - Char chars[4] = { 't', 'e', 's', 't' }; - // Instantiate a new secure string. - Char* pChars = &chars[0]; - - testString = gcnew SecureString(pChars, sizeof(chars)/sizeof(chars[0])); - - // Display secure string length. - Console::WriteLine("The length of the string is {0} characters.", - testString->Length); - delete testString; - return 0; -} -// The example displays the following output: -// The length of the string is 4 characters. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp deleted file mode 100644 index 7ff6cd67159..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp +++ /dev/null @@ -1,44 +0,0 @@ - -using namespace System; -using namespace System::Security; - - -public ref class SecurityElementTest -{ -private: - SecurityElement^ xmlRootElement; - -public: - SecurityElementTest() - { - xmlRootElement = gcnew SecurityElement("thetag", " "); - - xmlRootElement->AddAttribute("a", "123"); - xmlRootElement->AddAttribute("b", "456"); - xmlRootElement->AddAttribute("c", "789"); - - xmlRootElement->AddChild(gcnew SecurityElement("first", "text1")); - xmlRootElement->AddChild(gcnew SecurityElement("second", "text2")); - } - - // - String^ SearchForTextOfTag(String^ tag) - { - SecurityElement^ element = this->SearchForChildByTag(tag); - return element->Text; - } - // - -private: - SecurityElement^ SearchForChildByTag(String^ tag) - { - return xmlRootElement->SearchForChildByTag(tag); - } -}; - -int main() -{ - SecurityElementTest^ seTest = gcnew SecurityElementTest(); - - Console::WriteLine("Found the text for : " + seTest->SearchForTextOfTag("second")); -} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp deleted file mode 100644 index 2f65db80fc4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ s1 = "We went to a bookstore, "; - String^ s2 = "a movie, "; - String^ s3 = "and a restaurant."; - - String^ s = String::Concat(s1, s2, s3); - Console::WriteLine(s); -} -// The example displays the following output: -// We went to a bookstore, a movie, and a restaurant. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp deleted file mode 100644 index 013c216996e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Assignment.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" -// -using namespace System; - -void main() -{ - String^ value1 = L"This is a string."; - String^ value2 = value1; - Console::WriteLine(value1); - Console::WriteLine(value2); -} -// The example displays the following output: -// This is a string. -// This is a string. -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp deleted file mode 100644 index a5ea741588d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// Char1_Ctor.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - -void main() -{ - wchar_t characters[] = {L'H',L'e',L'l',L'l',L'o',L' ', - L'W',L'o',L'r',L'l',L'd',L'!',L'\x0000'}; - - Char* charPtr = characters; - String^ value = gcnew String(charPtr); - Console::WriteLine(value); -} -// The example displays the following output: -// Hello world! -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp deleted file mode 100644 index 94226ba6f8d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Char2_Ctor.cpp : Defines the entry point for the console application. -// - -//#include "stdafx.h" - -// -using namespace System; - - -void main() -{ - wchar_t characters[] = {L'H',L'e',L'l',L'l',L'o',L' ', - L'W',L'o',L'r',L'l',L'd',L'!',L'\x0000'}; - - Char* charPtr = characters; - int length = 0; - Char* iterator = charPtr; - - while (*iterator != '\x0000') - { - if (*iterator == L'!' || *iterator == L'.') - break; - *iterator++; - length++; - } - String^ value = gcnew String(charPtr, 0, length); - Console::WriteLine(value); -} -// The example displays the following output: -// Hello World -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp deleted file mode 100644 index 312c24bbe53..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -using namespace System; - -void main() -{ - wchar_t chars[] = { L'a', L'b', L'c', L'd', L'\0', L'A', L'B', - L'C', L'D', L'\0' }; - Char* chPtr = chars; - String^ s = gcnew String(chPtr, 0, - sizeof(chars) / sizeof (wchar_t)); - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - Console::WriteLine(); - - s = gcnew String(chPtr); - - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - Console::WriteLine(); -} -// The example displays the following output: -// 0061 0062 0063 0064 0000 0041 0042 0043 0044 0000 -// 0061 0062 0063 0064 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp deleted file mode 100644 index 3116bd1e648..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -using namespace System; - -void main() -{ - char bytes[] = { 0x61, 0x62, 0x063, 0x064, 0x00, 0x41, 0x42,0x43, - 0x44, 0x00 }; - - char* bytePtr = bytes; - String^ s = gcnew String(bytePtr, 0, sizeof(bytes) / sizeof (char)); - - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - - Console::WriteLine(); - - s = gcnew String(bytePtr); - - for each (Char ch in s) - Console::Write("{0:X4} ", Convert::ToUInt16(ch)); - Console::WriteLine(); -} -// The example displays the following output: -// 0061 0062 0063 0064 0000 0041 0042 0043 0044 0000 -// 0061 0062 0063 0064 -// - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp deleted file mode 100644 index 7902bf7169d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ s; - - Console::WriteLine("The value of the string is '{0}'", s); - - try { - Console::WriteLine("String length is {0}", s->Length); - } - catch (NullReferenceException^ e) { - Console::WriteLine(e->Message); - } -} -// The example displays the following output: -// The value of the string is '' -// Object reference not set to an instance of an object. -// - -void Test() -{ - // - String^ s = ""; - Console::WriteLine("The length of '{0}' is {1}.", s, s->Length); - // The example displays the following output: - // The length of '' is 0. - // -} - - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp deleted file mode 100644 index f7d1b9f1579..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp +++ /dev/null @@ -1,18 +0,0 @@ -using namespace System; - -bool Test( String^ s ) -{ - bool result; - // - result = s == nullptr || s == String::Empty; - // - return result; -} - -int main() -{ - String^ s1; - String^ s2 = ""; - Console::WriteLine( "String s1 {0}.", Test( s1 ) ); - Console::WriteLine( "String s2 {0}.", Test( s2 ) ); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp deleted file mode 100644 index c61179db48d..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -using namespace System; - -void main() -{ - String^ title = "The House of the Seven Gables"; - String^ searchString = "the"; - StringComparison comparison = StringComparison::InvariantCulture; - Console::WriteLine("'{0}':", title); - Console::WriteLine(" Starts with '{0}' ({1:G} comparison): {2}", - searchString, comparison, - title->StartsWith(searchString, comparison)); - - comparison = StringComparison::InvariantCultureIgnoreCase; - Console::WriteLine(" Starts with '{0}' ({1:G} comparison): {2}", - searchString, comparison, - title->StartsWith(searchString, comparison)); - } -// The example displays the following output: -// 'The House of the Seven Gables': -// Starts with 'the' (InvariantCulture comparison): False -// Starts with 'the' (InvariantCultureIgnoreCase comparison): True -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp deleted file mode 100644 index efd8df82bf8..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -using namespace System; - -void main() -{ - array^ strings = gcnew array { {"ABCdef", "abc" }, - {"ABCdef", "abc" }, {"Å“il","oe" }, - { "læring}", "lae" } }; - for (int ctr1 = strings->GetLowerBound(0); ctr1 <= strings->GetUpperBound(0); ctr1++) - { - for each (String^ cmpName in Enum::GetNames(StringComparison::typeid)) - { - StringComparison strCmp = (StringComparison) Enum::Parse(StringComparison::typeid, - cmpName); - String^ instance = strings[ctr1, 0]; - String^ value = strings[ctr1, 1]; - Console::WriteLine("{0} starts with {1}: {2} ({3} comparison)", - instance, value, - instance->StartsWith(value, strCmp), - strCmp); - } - Console::WriteLine(); - } -} - -// The example displays the following output: -// ABCdef starts with abc: False (CurrentCulture comparison) -// ABCdef starts with abc: True (CurrentCultureIgnoreCase comparison) -// ABCdef starts with abc: False (InvariantCulture comparison) -// ABCdef starts with abc: True (InvariantCultureIgnoreCase comparison) -// ABCdef starts with abc: False (Ordinal comparison) -// ABCdef starts with abc: True (OrdinalIgnoreCase comparison) -// -// ABCdef starts with abc: False (CurrentCulture comparison) -// ABCdef starts with abc: True (CurrentCultureIgnoreCase comparison) -// ABCdef starts with abc: False (InvariantCulture comparison) -// ABCdef starts with abc: True (InvariantCultureIgnoreCase comparison) -// ABCdef starts with abc: False (Ordinal comparison) -// ABCdef starts with abc: True (OrdinalIgnoreCase comparison) -// -// Å“il starts with oe: True (CurrentCulture comparison) -// Å“il starts with oe: True (CurrentCultureIgnoreCase comparison) -// Å“il starts with oe: True (InvariantCulture comparison) -// Å“il starts with oe: True (InvariantCultureIgnoreCase comparison) -// Å“il starts with oe: False (Ordinal comparison) -// Å“il starts with oe: False (OrdinalIgnoreCase comparison) -// -// læring} starts with lae: True (CurrentCulture comparison) -// læring} starts with lae: True (CurrentCultureIgnoreCase comparison) -// læring} starts with lae: True (InvariantCulture comparison) -// læring} starts with lae: True (InvariantCultureIgnoreCase comparison) -// læring} starts with lae: False (Ordinal comparison) -// læring} starts with lae: False (OrdinalIgnoreCase comparison) -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp deleted file mode 100644 index e378abfd947..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Text::RegularExpressions; -ref class MyClass -{ -public: - static int i = 0; - static String^ ReplaceCC( Match^ m ) - { - - // Replace each Regex cc match with the number of the occurrence. - i++; - return i.ToString(); - } - -}; - -int main() -{ - String^ sInput; - String^ sRegex; - - // The string to search. - sInput = "aabbccddeeffcccgghhcccciijjcccckkcc"; - - // A very simple regular expression. - sRegex = "cc"; - Regex^ r = gcnew Regex( sRegex ); - - // Assign the replace method to the MatchEvaluator delegate. - MatchEvaluator^ myEvaluator = gcnew MatchEvaluator( &MyClass::ReplaceCC ); - - // Write out the original string. - Console::WriteLine( sInput ); - - // Replace matched characters using the delegate method. - sInput = r->Replace( sInput, myEvaluator ); - - // Write out the modified string. - Console::WriteLine( sInput ); -} -// The example displays the following output: -// aabbccddeeffcccgghhcccciijjcccckkcc -// aabb11ddeeff22cgghh3344iijj5566kk77 -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp deleted file mode 100644 index 8cee8672a42..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - -// -using namespace System; -using namespace System::Threading; - -// ref class ApartmentTest -// { -// public: - static void ThreadMethod() - { - Thread::Sleep( 1000 ); -// } - -}; - -int main() -{ -// Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ApartmentTest::ThreadMethod ) ); - Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ThreadMethod ) ); - - Console::WriteLine("ThreadState: {0}", newThread->ThreadState); - newThread->Start(); - - // Wait for newThread to start and go to sleep. - Thread::Sleep(300); - Console::WriteLine("ThreadState: {0}", newThread->ThreadState); - - // Wait for newThread to restart. - Thread::Sleep(1000); - Console::WriteLine("ThreadState: {0}", newThread->ThreadState); -} -// The example displays the following output: -// ThreadState: Unstarted -// ThreadState: WaitSleepJoin -// ThreadState: Stopped -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp deleted file mode 100644 index 857931694b0..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// -using namespace System; -using namespace System::Threading; -using namespace System::Runtime::Remoting::Contexts; - -[Synchronization(true)] -public ref class SyncingClass : ContextBoundObject -{ -private: - EventWaitHandle^ waitHandle; - -public: - SyncingClass() - { - waitHandle = - gcnew EventWaitHandle(false, EventResetMode::ManualReset); - } - - void Signal() - { - Console::WriteLine("Thread[{0:d4}]: Signalling...", Thread::CurrentThread->GetHashCode()); - waitHandle->Set(); - } - - void DoWait(bool leaveContext) - { - bool signalled; - - waitHandle->Reset(); - Console::WriteLine("Thread[{0:d4}]: Waiting...", Thread::CurrentThread->GetHashCode()); - signalled = waitHandle->WaitOne(3000, leaveContext); - if (signalled) - { - Console::WriteLine("Thread[{0:d4}]: Wait released!!!", Thread::CurrentThread->GetHashCode()); - } - else - { - Console::WriteLine("Thread[{0:d4}]: Wait timeout!!!", Thread::CurrentThread->GetHashCode()); - } - } -}; - -public ref class TestSyncDomainWait -{ -public: - static void Main() - { - SyncingClass^ syncClass = gcnew SyncingClass(); - - Thread^ runWaiter; - - Console::WriteLine("\nWait and signal INSIDE synchronization domain:\n"); - runWaiter = gcnew Thread(gcnew ParameterizedThreadStart(&TestSyncDomainWait::RunWaitKeepContext)); - runWaiter->Start(syncClass); - Thread::Sleep(1000); - Console::WriteLine("Thread[{0:d4}]: Signal...", Thread::CurrentThread->GetHashCode()); - // This call to Signal will block until the timeout in DoWait expires. - syncClass->Signal(); - runWaiter->Join(); - - Console::WriteLine("\nWait and signal OUTSIDE synchronization domain:\n"); - runWaiter = gcnew Thread(gcnew ParameterizedThreadStart(&TestSyncDomainWait::RunWaitLeaveContext)); - runWaiter->Start(syncClass); - Thread::Sleep(1000); - Console::WriteLine("Thread[{0:d4}]: Signal...", Thread::CurrentThread->GetHashCode()); - // This call to Signal is unblocked and will set the wait handle to - // release the waiting thread. - syncClass->Signal(); - runWaiter->Join(); - } - - static void RunWaitKeepContext(Object^ parm) - { - ((SyncingClass^)parm)->DoWait(false); - } - - static void RunWaitLeaveContext(Object^ parm) - { - ((SyncingClass^)parm)->DoWait(true); - } -}; - -int main() -{ - TestSyncDomainWait::Main(); -} -// The output for the example program will be similar to the following: -// -// Wait and signal INSIDE synchronization domain: -// -// Thread[0004]: Waiting... -// Thread[0001]: Signal... -// Thread[0004]: Wait timeout!!! -// Thread[0001]: Signalling... -// -// Wait and signal OUTSIDE synchronization domain: -// -// Thread[0006]: Waiting... -// Thread[0001]: Signal... -// Thread[0001]: Signalling... -// Thread[0006]: Wait released!!! -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp deleted file mode 100644 index 84663c2d1bc..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -using namespace System; -using namespace System::Timers; - -public ref class Example -{ -private: - static System::Timers::Timer^ aTimer; - -public: - static void Demo() - { - // Create a timer and set a two second interval. - aTimer = gcnew System::Timers::Timer(); - aTimer->Interval = 2000; - - // Hook up the Elapsed event for the timer. - aTimer->Elapsed += gcnew System::Timers::ElapsedEventHandler(Example::OnTimedEvent); - - // Have the timer fire repeated events (true is the default) - aTimer->AutoReset = true; - - // Start the timer - aTimer->Enabled = true; - - Console::WriteLine("Press the Enter key to exit the program at any time... "); - Console::ReadLine(); - } - -private: - static void OnTimedEvent(Object^ source, System::Timers::ElapsedEventArgs^ e) - { - Console::WriteLine("The Elapsed event was raised at {0}", e->SignalTime); - } -}; - -int main() -{ - Example::Demo(); -} -// The example displays output like the following: -// Press the Enter key to exit the program at any time... -// The Elapsed event was raised at 5/20/2015 8:48:58 PM -// The Elapsed event was raised at 5/20/2015 8:49:00 PM -// The Elapsed event was raised at 5/20/2015 8:49:02 PM -// The Elapsed event was raised at 5/20/2015 8:49:04 PM -// The Elapsed event was raised at 5/20/2015 8:49:06 PM - -// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp deleted file mode 100644 index 7b4d07bf1ce..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp +++ /dev/null @@ -1,11 +0,0 @@ - -using namespace System; - -// -generic ref class B { }; -generic ref class C : B { }; -// - - -int main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp deleted file mode 100644 index 3c606201207..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp +++ /dev/null @@ -1,12 +0,0 @@ - -using namespace System; -using namespace System::Collections::Generic; - -void main() -{ -// - Type^ t = List::typeid->GetMethod("ConvertAll")->GetGenericArguments()[0]->DeclaringType; -// - Console::WriteLine("Declaring type: {0:s}", t->FullName); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp deleted file mode 100644 index 887160b2c0e..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp +++ /dev/null @@ -1,18 +0,0 @@ - -using namespace System; - -// -generic public ref class B { }; -generic public ref class A -{ -public: - generic B^ GetSomething() - { - return gcnew B(); - } -}; -// - - -int main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp deleted file mode 100644 index 27ef62bdf1a..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp +++ /dev/null @@ -1,26 +0,0 @@ - -using namespace System; - -// -generic - public ref class Base { }; -generic - public ref class Derived : Base { }; -// - -// -generic public ref class Outermost -{ -public: - generic ref class Inner - { - public: - generic ref class Innermost1 {}; - ref class Innermost2 {}; - }; -}; -// - - -int main() {} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp deleted file mode 100644 index c72d08ac108..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -using namespace System; -using namespace System::Reflection; - -ref class TypedReferenceArray -{ -private: - TypedReferenceArray(){} - - -public: - static void GetTypedRefArray() - { - try - { -// - Assembly::Load("mscorlib.dll")->GetType("System.TypedReference[]"); -// - } - catch (Exception^ ex) - { - Console::WriteLine(ex->Message); - Console::WriteLine(ex->StackTrace); - } - } - -}; - -int main() -{ - TypedReferenceArray::GetTypedRefArray(); -} - diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp deleted file mode 100644 index e36381d28c4..00000000000 --- a/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// This example demonstrates the Version.Revision, -// MajorRevision, and MinorRevision properties. -using namespace System; - -int main() -{ - String^ formatStandard = "Standard version:\n" + - " major.minor.build.revision = {0}.{1}.{2}.{3}"; - String^ formatInterim = "Interim version:\n" + - " major.minor.build.majRev/minRev = {0}.{1}.{2}.{3}/{4}"; - - Version^ standardVersion = gcnew Version(2, 4, 1128, 2); - Version^ interimVersion = gcnew Version(2, 4, 1128, (100 << 16) + 2); - - Console::WriteLine(formatStandard, standardVersion->Major, - standardVersion->Minor, standardVersion->Build, - standardVersion->Revision); - Console::WriteLine(formatInterim, interimVersion->Major, - interimVersion->Minor, interimVersion->Build, - interimVersion->MajorRevision, interimVersion->MinorRevision); -}; -/* -This code example produces the following results: - -Standard version: -major.minor.build.revision = 2.4.1128.2 -Interim version: -major.minor.build.majRev/minRev = 2.4.1128.100/2 - -*/ -// diff --git a/snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp b/snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp deleted file mode 100644 index 6f8b7354593..00000000000 --- a/snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::ConstrainedExecution; - -[assembly:ReliabilityContractAttribute( - Consistency::MayCorruptInstance, Cer::None)]; -namespace ReliabilityLibrary -{ - class SomeClass {}; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp deleted file mode 100644 index 248a1274b23..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "http://localhost/baseuri.xml" ); - - //Display information on the attribute node. The value - //returned for BaseURI is 'http://localhost/baseuri.xml'. - XmlAttribute^ attr = doc->DocumentElement->Attributes[ 0 ]; - Console::WriteLine( "Name of the attribute: {0}", attr->Name ); - Console::WriteLine( "Base URI of the attribute: {0}", attr->BaseURI ); - Console::WriteLine( "The value of the attribute: {0}", attr->InnerText ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp deleted file mode 100644 index 7da06cb2507..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create an XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "2elems.xml" ); - - //Create an attribute. - XmlAttribute^ attr; - attr = doc->CreateAttribute( "bk", "genre", "urn:samples" ); - attr->Value = "novel"; - - //Add the attribute to the first book. - XmlElement^ currNode = dynamic_cast(doc->DocumentElement->FirstChild); - currNode->SetAttributeNode( attr ); - - //An attribute cannot be added to two different elements. - //You must clone the attribute and add it to the second book. - XmlAttribute^ attr2; - attr2 = dynamic_cast(attr->CloneNode( true )); - currNode = dynamic_cast(doc->DocumentElement->LastChild); - currNode->SetAttributeNode( attr2 ); - Console::WriteLine( "Display the modified XML...\r\n" ); - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - doc->WriteContentTo( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp deleted file mode 100644 index e610435a6f1..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - Console::WriteLine( "Display information on each of the attributes... \r\n" ); - System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - XmlAttribute^ attr = safe_cast(myEnum->Current); - Console::Write( "{0} = {1}", attr->Name, attr->Value ); - Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp deleted file mode 100644 index d5ae5b95da8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - Console::WriteLine( "Display information on each of the attributes... \r\n" ); - System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - XmlAttribute^ attr = safe_cast(myEnum->Current); - Console::Write( "{0}:{1} = {2}", attr->Prefix, attr->LocalName, attr->Value ); - Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp deleted file mode 100644 index ab859d7c703..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute. - XmlAttribute^ attr; - attr = doc->CreateAttribute( "bk", "genre", "urn:samples" ); - attr->Value = "novel"; - - //Display the attribute's owner document. Note - //that although the attribute has not been inserted - //into the document, it still has an owner document. - Console::WriteLine( attr->OwnerDocument->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp deleted file mode 100644 index dcbf0298041..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute. - XmlAttribute^ attr; - attr = doc->CreateAttribute( "bk", "genre", "urn:samples" ); - attr->Value = "novel"; - - //Try to display the attribute's owner element. - if ( attr->OwnerElement == nullptr ) - Console::WriteLine( "The attribute has not been added to an element\r\n" ); - else - Console::WriteLine( attr->OwnerElement->OuterXml ); - - - //Add the attribute to an element. - doc->DocumentElement->SetAttributeNode( attr ); - - //Display the attribute's owner element. - Console::WriteLine( "Display the owner element..." ); - Console::WriteLine( attr->OwnerElement->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp deleted file mode 100644 index 3adf20c7f03..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new attribute. - XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); - newAttr->Value = "novel"; - - //Create an attribute collection and add the new attribute - //to the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->Append( newAttr ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp deleted file mode 100644 index ac6d9660ec5..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - - //Declare the array. - array^arr = gcnew array(2); - int index = 0; - - //Copy all the attributes into the array. - attrColl->CopyTo( arr, index ); - Console::WriteLine( "Display all the attributes in the array.." ); - System::Collections::IEnumerator^ myEnum = arr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - XmlAttribute^ attr = safe_cast(myEnum->Current); - Console::WriteLine( "{0} = {1}", attr->Name, attr->Value ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp deleted file mode 100644 index cef8075ba6b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new attribute. - XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); - newAttr->Value = "novel"; - - //Create an attribute collection and add the new attribute - //to the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->InsertAfter( newAttr, attrColl[ 0 ] ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp deleted file mode 100644 index e83046a63b2..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new attribute. - XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); - newAttr->Value = "novel"; - - //Create an attribute collection and add the new attribute - //to the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->InsertBefore( newAttr, attrColl[ 0 ] ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp deleted file mode 100644 index 58098e9636e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new attribute. - XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); - newAttr->Value = "novel"; - - //Create an attribute collection and add the new attribute - //to the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->Prepend( newAttr ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp deleted file mode 100644 index 462904f2588..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection and remove an attribute - //from the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->Remove( attrColl[ "genre" ] ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp deleted file mode 100644 index 6b44e2cdb0b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection and remove all attributes - //from the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->RemoveAll(); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp deleted file mode 100644 index 852996d7f61..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection and remove an attribute - //from the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->RemoveAt( 0 ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp deleted file mode 100644 index 1eeb8a09d55..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new attribute. - XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); - newAttr->Value = "novel"; - - //Create an attribute collection and add the new attribute - //to the collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - attrColl->SetNamedItem( newAttr ); - Console::WriteLine( "Display the modified XML...\r\n" ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp deleted file mode 100644 index d05785cb9df..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute collection. - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - Console::WriteLine( "Display all the attributes in the collection...\r\n" ); - for ( int i = 0; i < attrColl->Count; i++ ) - { - Console::Write( "{0} = ", attrColl[ i ]->Name ); - Console::Write( "{0}", attrColl[ i ]->Value ); - Console::WriteLine(); - - } -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp deleted file mode 100644 index 65290b3374d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Define the order data. They will be converted to string - //before being written out. - Int16 custID = 32632; - String^ orderID = "367A54"; - DateTime orderDate = DateTime::Now; - Double price = 19.95; - - //Create a writer that outputs to the console. - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - - //Write an element (this one is the root) - writer->WriteStartElement( "order" ); - - //Write the order date. - writer->WriteAttributeString( "date", XmlConvert::ToString( orderDate, "yyyy-MM-dd" ) ); - - //Write the order time. - writer->WriteAttributeString( "time", XmlConvert::ToString( orderDate, "HH:mm:ss" ) ); - - //Write the order data. - writer->WriteElementString( "orderID", orderID ); - writer->WriteElementString( "custID", XmlConvert::ToString( custID ) ); - writer->WriteElementString( "price", XmlConvert::ToString( price ) ); - - //Write the close tag for the root element - writer->WriteEndElement(); - - //Write the XML and close the writer - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp deleted file mode 100644 index e37f5167c22..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; -using namespace System::Data::SqlClient; -int main() -{ - DataSet^ dsNorthwind = gcnew DataSet; - - //Create the connection string. - String^ sConnect; - sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"; - - //Create a connection object to connect to the northwind db. - SqlConnection^ nwconnect = gcnew SqlConnection( sConnect ); - - //Create a command string to select all the customers in the WA region. - String^ sCommand = "Select * from Customers where Region='WA'"; - - //Create an adapter to load the DataSet. - SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect ); - - //Fill the DataSet with the selected records. - myDataAdapter->Fill( dsNorthwind, "Customers" ); - - //Load the document with the DataSet. - XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind ); - - //Create a shallow clone of the XmlDataDocument. Note that although - //none of the child nodes were copied over, the cloned node does - //have the schema information. - XmlDataDocument^ clone = dynamic_cast(doc->CloneNode( false )); - Console::WriteLine( "Child count: {0}", clone->ChildNodes->Count ); - Console::WriteLine( clone->DataSet->GetXmlSchema() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp deleted file mode 100644 index 8ef5454e02d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; - -int main() -{ - - //Create an XmlDataDocument. - XmlDataDocument^ doc = gcnew XmlDataDocument; - - //Load the schema file. - doc->DataSet->ReadXmlSchema( "store.xsd" ); - - //Load the XML data. - doc->Load( "2books.xml" ); - - //Update the price on the first book using the DataSet methods. - DataTable^ books = doc->DataSet->Tables[ "book" ]; - books->Rows[ 0 ][ "price" ] = "12.95"; - Console::WriteLine( "Display the modified XML data..." ); - doc->Save( Console::Out ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp deleted file mode 100644 index 9ee8eb597d8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; -using namespace System::Data::SqlClient; - -int main() -{ - DataSet^ dsNorthwind = gcnew DataSet; - - //Create the connection string - String^ sConnect; - sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"; - - //Create a connection object to connect to the northwind db. - SqlConnection^ nwconnect = gcnew SqlConnection( sConnect ); - - //Create a command string to select all the customers in the WA region. - String^ sCommand = "Select * from Customers where Region='WA'"; - - //Create an adapter to load the DataSet. - SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect ); - - //Fill the DataSet with the selected records. - myDataAdapter->Fill( dsNorthwind, "Customers" ); - - //Load the document with the DataSet. - XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind ); - - //Create an element representing the first customer record. - DataRow^ row = doc->DataSet->Tables[ 0 ]->Rows[ 0 ]; - XmlElement^ elem = doc->GetElementFromRow( row ); - Console::WriteLine( elem->OuterXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp deleted file mode 100644 index efc4bd880c6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; -using namespace System::Data::SqlClient; -int main() -{ - DataSet^ dsNorthwind = gcnew DataSet; - - //Create the connection string. - String^ sConnect; - sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"; - - //Create a connection object to connect to the northwind db. - SqlConnection^ nwconnect = gcnew SqlConnection( sConnect ); - - //Create a command string to select all the customers in the WA region. - String^ sCommand = "Select * from Customers where Region='WA'"; - - //Create an adapter to load the DataSet. - SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect ); - - //Fill the DataSet with the selected records. - myDataAdapter->Fill( dsNorthwind, "Customers" ); - - //Load the document with the DataSet. - XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind ); - - //Display the XmlDataDocument. - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp deleted file mode 100644 index cf3fc8cd852..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - String^ xmlString = "Oberon's Legacy"; - doc->Load( gcnew StringReader( xmlString ) ); - - // Create an XML declaration. - XmlDeclaration^ xmldecl; - xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); - xmldecl->Encoding = "UTF-8"; - xmldecl->Standalone = "yes"; - - // Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - doc->InsertBefore( xmldecl, root ); - - // Display the modified XML document - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp deleted file mode 100644 index cf3fc8cd852..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - String^ xmlString = "Oberon's Legacy"; - doc->Load( gcnew StringReader( xmlString ) ); - - // Create an XML declaration. - XmlDeclaration^ xmldecl; - xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); - xmldecl->Encoding = "UTF-8"; - xmldecl->Standalone = "yes"; - - // Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - doc->InsertBefore( xmldecl, root ); - - // Display the modified XML document - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp deleted file mode 100644 index 1f39979cb87..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a deep clone. The cloned node - //includes the child node. - XmlDocument^ deep = dynamic_cast(doc->CloneNode( true )); - Console::WriteLine( deep->ChildNodes->Count ); - - //Create a shallow clone. The cloned node does not - //include the child node. - XmlDocument^ shallow = dynamic_cast(doc->CloneNode( false )); - Console::WriteLine( "{0}{1}", shallow->Name, shallow->OuterXml ); - Console::WriteLine( shallow->ChildNodes->Count ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp deleted file mode 100644 index e1c7160ac1f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute. - XmlAttribute^ attr = doc->CreateAttribute( "publisher" ); - attr->Value = "WorldWide Publishing"; - - //Add the new node to the document. - doc->DocumentElement->SetAttributeNode( attr ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp deleted file mode 100644 index b99d05865e3..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a CData section. - XmlCDataSection^ CData; - CData = doc->CreateCDataSection( "All Jane Austen novels 25% off starting 3/23!" ); - - //Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - root->AppendChild( CData ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp deleted file mode 100644 index de2b9a3e426..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a comment. - XmlComment^ newComment; - newComment = doc->CreateComment( "Sample XML document" ); - - //Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - doc->InsertBefore( newComment, root ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp deleted file mode 100644 index 43a191e3ad8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" ); - - //Create a document fragment. - XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); - - //Set the contents of the document fragment. - docFrag->InnerXml = "widget"; - - //Add the children of the document fragment to the - //original document. - doc->DocumentElement->AppendChild( docFrag ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp deleted file mode 100644 index 9ef82e4bbe0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - - //Create a document type node and - //add it to the document. - XmlDocumentType^ doctype; - doctype = doc->CreateDocumentType( "book", nullptr, nullptr, "" ); - doc->AppendChild( doctype ); - - //Create the root element and - //add it to the document. - doc->AppendChild( doc->CreateElement( "book" ) ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp deleted file mode 100644 index 75a61a9cebf..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new node and add it to the document. - //The text node is the content of the price element. - XmlElement^ elem = doc->CreateElement( "price" ); - XmlText^ text = doc->CreateTextNode( "19.95" ); - doc->DocumentElement->AppendChild( elem ); - doc->DocumentElement->LastChild->AppendChild( text ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp deleted file mode 100644 index 726fefbd045..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - String^ xmlData = ""; - doc->Load( gcnew StringReader( xmlData ) ); - - // Create a new element and add it to the document. - XmlElement^ elem = doc->CreateElement( "bk", "genre", "urn:samples" ); - elem->InnerText = "fantasy"; - doc->DocumentElement->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp deleted file mode 100644 index 7bf73f8915c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>Pride And Prejudice" ); - - //Create an entity reference node. The child count should be 0 - //since the node has not been expanded. - XmlEntityReference^ entityref = doc->CreateEntityReference( "h" ); - Console::WriteLine( entityref->ChildNodes->Count ); - - //After the node has been added to the document, its parent node - //is set and the entity reference node is expanded. It now has a child - //node containing the entity replacement text. - doc->DocumentElement->LastChild->AppendChild( entityref ); - Console::WriteLine( entityref->FirstChild->InnerText ); - - //Create and insert an undefined entity reference node. When the entity - //reference node is expanded, because the entity reference is undefined - //the child is an empty text node. - XmlEntityReference^ entityref2 = doc->CreateEntityReference( "p" ); - doc->DocumentElement->LastChild->AppendChild( entityref2 ); - Console::WriteLine( entityref2->FirstChild->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp deleted file mode 100644 index 8a885ff4f33..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new node and add it to the document. - XmlNode^ elem = doc->CreateNode( XmlNodeType::Element, "price", nullptr ); - elem->InnerText = "19.95"; - doc->DocumentElement->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp deleted file mode 100644 index e638f3db6fd..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Oberon's Legacy 5.95" ); - - // Create a new element node. - XmlNode^ newElem = doc->CreateNode( "element", "pages", "" ); - newElem->InnerText = "290"; - Console::WriteLine( "Add the new element to the document..." ); - XmlElement^ root = doc->DocumentElement; - root->AppendChild( newElem ); - Console::WriteLine( "Display the modified XML document..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp deleted file mode 100644 index a51f50b4f52..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Oberon's Legacy 5.95" ); - - // Create a new element node. - XmlNode^ newElem; - newElem = doc->CreateNode( XmlNodeType::Element, "g" , "ISBN" , "https://global.ISBN/list" ); - newElem->InnerText = "1-861001-57-5"; - - // Add the new element to the document - XmlElement^ root = doc->DocumentElement; - root->AppendChild( newElem ); - - // Display the modified XML document - Console::WriteLine( doc->OuterXml ); - - // Output: - // Oberon's Legacy5.951-861001-57-5 -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp deleted file mode 100644 index 27a969f9685..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - - // Create a procesing instruction. - XmlProcessingInstruction^ newPI; - String^ PItext = "type='text/xsl' href='book.xsl'"; - newPI = doc->CreateProcessingInstruction( "xml-stylesheet", PItext ); - - // Display the target and data information. - Console::WriteLine( "", newPI->Target, newPI->Data ); - - // Add the processing instruction node to the document. - doc->AppendChild( newPI ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp deleted file mode 100644 index 4817ff6ccf4..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "EvaCorets" ); - Console::WriteLine( "InnerText before..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Add white space. - XmlNode^ currNode = doc->DocumentElement; - XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" ); - currNode->InsertAfter( sigws, currNode->FirstChild ); - Console::WriteLine(); - Console::WriteLine( "InnerText after..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp deleted file mode 100644 index 7eeb3da5079..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "EvaCorets" ); - Console::WriteLine( "InnerText before..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Add white space. - XmlNode^ currNode = doc->DocumentElement; - XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" ); - currNode->InsertAfter( ws, currNode->FirstChild ); - Console::WriteLine(); - Console::WriteLine( "InnerText after..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp deleted file mode 100644 index af70be8e025..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an XML declaration. - XmlDeclaration^ xmldecl; - xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); - - //Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - doc->InsertBefore( xmldecl, root ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp deleted file mode 100644 index ee5192065b7..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Display the document element. - Console::WriteLine( doc->DocumentElement->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp deleted file mode 100644 index 3240940efc2..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - // Display the DocumentType. - Console::WriteLine( doc->DocumentType->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp deleted file mode 100644 index f9842a8ef80..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "ids.xml" ); - - //Get the first element with an attribute of type ID and value of A111. - //This displays the node . - XmlElement^ elem = doc->GetElementById( "A111" ); - Console::WriteLine( elem->OuterXml ); - - //Get the first element with an attribute of type ID and value of A222. - //This displays the node . - elem = doc->GetElementById( "A222" ); - Console::WriteLine( elem->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp deleted file mode 100644 index 3c1265c6b3c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - - //Display all the book titles. - XmlNodeList^ elemList = doc->GetElementsByTagName( "title" ); - for ( int i = 0; i < elemList->Count; i++ ) - { - Console::WriteLine( elemList[ i ]->InnerXml ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp deleted file mode 100644 index df8b7f49438..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataSet^ dataset; - -public: - void Method() - { -// - XmlDocument^ doc1 = gcnew XmlDocument; - doc1->Load( "books.xml" ); - XmlDocument^ doc2 = doc1->Implementation->CreateDocument(); -// - } -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp deleted file mode 100644 index 2e836430e60..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create another XmlDocument which holds a list of books. - XmlDocument^ doc2 = gcnew XmlDocument; - doc2->Load( "books.xml" ); - - //Import the last book node from doc2 into the original document. - XmlNode^ newBook = doc->ImportNode( doc2->DocumentElement->LastChild, true ); - doc->DocumentElement->AppendChild( newBook ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp deleted file mode 100644 index 893b4782d72..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - //Check if the node is read-only. - if ( doc->DocumentElement->LastChild->FirstChild->IsReadOnly ) - Console::WriteLine( "Entity reference nodes are always read-only" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp deleted file mode 100644 index de9abc8d55b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - - //Load the document with the last book node. - XmlTextReader^ reader = gcnew XmlTextReader( "books.xml" ); - reader->WhitespaceHandling = WhitespaceHandling::None; - reader->MoveToContent(); - reader->Read(); - reader->Skip(); //Skip the first book. - reader->Skip(); //Skip the second book. - doc->Load( reader ); - doc->Save( Console::Out ); -} - -// -XmlDocument ^XMLDOMProcessing::XMLHelperMethods::LoadDocument(bool generateXML) -{ - - XmlDocument ^doc = gcnew XmlDocument(); - doc->PreserveWhitespace = true; - try - {doc->Load("booksData.xml");} - catch (System::IO::FileNotFoundException ^e1) - { - // If no book is found, generate some XML. - - doc->LoadXml(" \n" + - " \n" + - " \n" + - " Pride And Prejudice \n" + - " 24.95 \n" + - " \n" + - " \n" + - " The Handmaid's Tale \n" + - " 29.95 \n" + - " \n" + - ""); - } - - return doc; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp deleted file mode 100644 index e2a7b610d8e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "wrench" ); - - // Add a price element. - XmlElement^ newElem = doc->CreateElement( "price" ); - newElem->InnerText = "10.95"; - doc->DocumentElement->AppendChild( newElem ); - - // Save the document to a file and auto-indent the output. - XmlTextWriter^ writer = gcnew XmlTextWriter( "data.xml", nullptr ); - writer->Formatting = Formatting::Indented; - doc->Save( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp deleted file mode 100644 index c2c17bfded5..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Load XML data which includes white space, but ignore - //any white space in the file. - XmlDocument^ doc = gcnew XmlDocument; - doc->PreserveWhitespace = false; - doc->Load( "book.xml" ); - - //Save the document as is (no white space). - Console::WriteLine( "Display the modified XML..." ); - doc->PreserveWhitespace = true; - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp deleted file mode 100644 index 5f22526fb55..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a reader. - XmlTextReader^ reader = gcnew XmlTextReader( "cd.xml" ); - reader->MoveToContent(); //Move to the cd element node. - - //Create a node representing the cd element node. - XmlNode^ cd = doc->ReadNode( reader ); - - //Insert the new node into the document. - doc->DocumentElement->AppendChild( cd ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp deleted file mode 100644 index 2bfdcba7729..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "wrench" ); - - // Add a price element. - XmlElement^ newElem = doc->CreateElement( "price" ); - newElem->InnerText = "10.95"; - doc->DocumentElement->AppendChild( newElem ); - - // Save the document to a file. White space is - // preserved (no white space). - doc->PreserveWhitespace = true; - doc->Save( "data.xml" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp deleted file mode 100644 index a3dd876f834..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -// -void WriteXml( XmlDocument^ doc ) -{ - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - doc->WriteContentTo( writer ); - writer->Flush(); - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp deleted file mode 100644 index 254d4e4b649..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -// -void WriteXml( XmlDocument^ doc ) -{ - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - doc->WriteTo( writer ); - writer->Flush(); - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp deleted file mode 100644 index f4464977f99..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" ); - - // Create a document fragment. - XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); - - // Set the contents of the document fragment. - docFrag->InnerXml = "widget"; - - // Create a deep clone. The cloned node - // includes child nodes. - XmlNode^ deep = docFrag->CloneNode( true ); - Console::WriteLine( "Name: {0}", deep->Name ); - Console::WriteLine( "OuterXml: {0}", deep->OuterXml ); - - // Create a shallow clone. The cloned node does - // not include any child nodes. - XmlNode^ shallow = docFrag->CloneNode( false ); - Console::WriteLine( "Name: {0}", shallow->Name ); - Console::WriteLine( "OuterXml: {0}", shallow->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp deleted file mode 100644 index 28e3cfe2a6e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - - // Create a document fragment. - XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); - - // Set the contents of the document fragment. - docFrag->InnerXml = "widget"; - - // Display the document fragment. - Console::WriteLine( docFrag->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp deleted file mode 100644 index 8c15797d0b5..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" ); - - // Create a document fragment. - XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); - - // Display the owner document of the document fragment. - Console::WriteLine( docFrag->OwnerDocument->OuterXml ); - - // Add nodes to the document fragment. Notice that the - // new element is created using the owner document of - // the document fragment. - XmlElement^ elem = doc->CreateElement( "item" ); - elem->InnerText = "widget"; - docFrag->AppendChild( elem ); - Console::WriteLine( "Display the document fragment..." ); - Console::WriteLine( docFrag->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp deleted file mode 100644 index 6c4328103ed..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - // Check if the node is read-only. - if ( doc->DocumentType->IsReadOnly ) - Console::WriteLine( "Document type nodes are always read-only" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp deleted file mode 100644 index 7c1b61160cd..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - // Display information on the DocumentType node. - XmlDocumentType^ doctype = doc->DocumentType; - Console::WriteLine( "Name of the document type: {0}", doctype->Name ); - Console::WriteLine( "The internal subset of the document type: {0}", doctype->InternalSubset ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp deleted file mode 100644 index 0b8dd71f455..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Change the value of the first attribute. - root->Attributes[ 0 ]->Value = "fiction"; - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp deleted file mode 100644 index b75667b60fc..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "2books.xml" ); - - // Create a new element. - XmlElement^ elem = doc->CreateElement( "misc" ); - elem->InnerText = "hardcover"; - elem->SetAttribute( "publisher", "WorldWide Publishing" ); - - // Clone the element so we can add one to each of the book nodes. - XmlNode^ elem2 = elem->CloneNode( true ); - - // Add the new elements. - doc->DocumentElement->FirstChild->AppendChild( elem ); - doc->DocumentElement->LastChild->AppendChild( elem2 ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp deleted file mode 100644 index fc626a6df19..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Check to see if the element has a genre attribute. - if ( root->HasAttribute( "genre" ) ) - { - XmlAttribute^ attr = root->GetAttributeNode( "genre" ); - Console::WriteLine( attr->Value ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp deleted file mode 100644 index 43426ae0dd2..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "2books.xml" ); - - // Get and display all the book titles. - XmlElement^ root = doc->DocumentElement; - XmlNodeList^ elemList = root->GetElementsByTagName( "title" ); - for ( int i = 0; i < elemList->Count; i++ ) - { - Console::WriteLine( elemList[ i ]->InnerXml ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp deleted file mode 100644 index ab87fd72095..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Check to see if the element has a genre attribute. - if ( root->HasAttribute( "genre" ) ) - { - String^ genre = root->GetAttribute( "genre" ); - Console::WriteLine( genre ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp deleted file mode 100644 index b0288ee6c7e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Remove all attributes from the root element. - if ( root->HasAttributes ) - root->RemoveAllAttributes(); - - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp deleted file mode 100644 index 1c76c3bca01..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "some textmore text" ); - XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild); - - // Note that InnerText does not include the markup. - Console::WriteLine( "Display the InnerText of the element..." ); - Console::WriteLine( elem->InnerText ); - - // InnerXml includes the markup of the element. - Console::WriteLine( "Display the InnerXml of the element..." ); - Console::WriteLine( elem->InnerXml ); - - // Set InnerText to a string that includes markup. - // The markup is escaped. - elem->InnerText = "Text containing will have char(<) and char(>) escaped."; - Console::WriteLine( elem->OuterXml ); - - // Set InnerXml to a string that includes markup. - // The markup is not escaped. - elem->InnerXml = "Text containing ."; - Console::WriteLine( elem->OuterXml ); -} -// This example produces the following results: -// -// Display the InnerText of the element... -// some textmore text -// Display the InnerXml of the element... -// some textmore text -// Text containing <markup/> will have char(<) and char(>) escaped. -// Text containing . -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp deleted file mode 100644 index 32d168f69fc..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Pride And Prejudice " ); - XmlElement^ currNode = dynamic_cast(doc->DocumentElement->LastChild); - if ( currNode->IsEmpty ) - currNode->InnerXml = "19.95"; - - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp deleted file mode 100644 index 79d6693b5c4..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "1-861001-57-5" - "Pride And Prejudice" - "" ); - - // Display information on the ISBN element. - XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild); - Console::Write( "{0}:{1} = {2}", elem->Prefix, elem->LocalName, elem->InnerText ); - Console::WriteLine( "\t namespaceURI={0}", elem->NamespaceURI ); -} - -// This code produces the following output. -// bk:ISBN = 1-861001-57-5 namespaceURI=urn:samples -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp deleted file mode 100644 index 0523cdebda0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "1-861001-57-5" - "Pride And Prejudice" - "" ); - - // Display information on the ISBN element. - XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild); - Console::Write( "{0} = {1}", elem->Name, elem->InnerText ); - Console::WriteLine( "\t namespaceURI={0}", elem->NamespaceURI ); -} - -// This code produces the following output. -// bk:ISBN = 1-861001-57-5 namespaceURI=urn:samples -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp deleted file mode 100644 index 61bff069bb3..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Create a new element. - XmlElement^ elem = doc->CreateElement( "price" ); - elem->InnerText = "19.95"; - - // Display the new element's owner document. Note - // that although the element has not been inserted - // into the document, it still has an owner document. - Console::WriteLine( elem->OwnerDocument->OuterXml ); - - // Add the new element into the document. - root->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp deleted file mode 100644 index 55d58e8f4df..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - // Remove all attributes and child nodes from the book element. - XmlElement^ root = doc->DocumentElement; - root->RemoveAll(); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp deleted file mode 100644 index b35acf816b6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Remove all attributes from the root element. - root->RemoveAllAttributes(); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp deleted file mode 100644 index b0464c9da27..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Remove the genre attribute. - root->RemoveAttribute( "genre" ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp deleted file mode 100644 index f16ed9f8182..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Remove the ISBN attribute. - root->RemoveAttribute( "ISBN", "urn:samples" ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp deleted file mode 100644 index d65bd739012..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Remove the genre attribute. - root->RemoveAttributeAt( 0 ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp deleted file mode 100644 index 85f87dd21d6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Remove the ISBN attribute. - root->RemoveAttributeNode( "ISBN", "urn:samples" ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp deleted file mode 100644 index 495d6d0bedd..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Add a new attribute. - XmlAttribute^ attr = root->SetAttributeNode( "genre", "urn:samples" ); - attr->Value = "novel"; - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp deleted file mode 100644 index 577c59e10dc..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Note that because WriteContentTo saves only the children of the element - // to the writer none of the attributes are displayed. - Console::WriteLine( "Display the contents of the element..." ); - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - root->WriteContentTo( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp deleted file mode 100644 index dc693bbe781..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - XmlElement^ root = doc->DocumentElement; - - // Add a new attribute. - root->SetAttribute( "genre", "urn:samples", "novel" ); - Console::WriteLine( "Display the modified XML..." ); - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - root->WriteTo( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp deleted file mode 100644 index 557e86ed61a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "http://localhost/uri.xml" ); - - //Display information on the entity reference node. - XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild); - Console::WriteLine( "Name of the entity reference: {0}", entref->Name ); - Console::WriteLine( "Base URI of the entity reference: {0}", entref->BaseURI ); - Console::WriteLine( "The entity replacement text: {0}", entref->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp deleted file mode 100644 index 5df1512470f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - // Check if the node is read-only. - XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild); - if ( entref->IsReadOnly ) - Console::WriteLine( "Entity reference nodes are always read-only" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp deleted file mode 100644 index 0635eed93bf..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - // Display information on the entity reference node. - XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild); - Console::WriteLine( "Name of the entity reference: {0}", entref->Name ); - Console::WriteLine( "The entity replacement text: {0}", entref->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp deleted file mode 100644 index 80c8c8c001b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataSet^ dataset; - -public: - void Method() - { -// - XmlImplementation^ imp = gcnew XmlImplementation; - XmlDocument^ doc1 = imp->CreateDocument(); - XmlDocument^ doc2 = imp->CreateDocument(); -// - } -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp deleted file mode 100644 index da00cfebf0a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - - // Display the first two book nodes. - XmlNode^ book = doc->DocumentElement->FirstChild; - Console::WriteLine( book->OuterXml ); - Console::WriteLine(); - Console::WriteLine( book->NextSibling->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp deleted file mode 100644 index 6b73208b236..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - XmlNode^ lastNode = doc->DocumentElement->LastChild; - Console::WriteLine( "Last book..." ); - Console::WriteLine( lastNode->OuterXml ); - XmlNode^ prevNode = lastNode->PreviousSibling; - Console::WriteLine( "\r\nPrevious book..." ); - Console::WriteLine( prevNode->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp deleted file mode 100644 index 284b8359eb1..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Pride And Prejudice" ); - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - Console::WriteLine( "Display all the attributes for this book..." ); - for ( int i = 0; i < attrColl->Count; i++ ) - { - Console::WriteLine( "{0} = {1}", attrColl->Item( i )->Name, attrColl->Item( i )->Value ); - - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index 4d3bd90411a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Collections; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - " Pride And Prejudice" - "" ); - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - Console::WriteLine( "Display all the attributes for this book..." ); - IEnumerator^ ienum = attrColl->GetEnumerator(); - while ( ienum->MoveNext() ) - { - XmlAttribute^ attr = dynamic_cast(ienum->Current); - Console::WriteLine( "{0} = {1}", attr->Name, attr->Value ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp deleted file mode 100644 index 0f47e848c12..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Pride And Prejudice" ); - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - - // Change the value for the genre attribute. - XmlAttribute^ attr = dynamic_cast(attrColl->GetNamedItem( "genre" )); - attr->Value = "fiction"; - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp deleted file mode 100644 index 8850c3b5bc0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Pride And Prejudice" ); - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - - // Remove the publicationdate attribute. - attrColl->RemoveNamedItem( "publicationdate" ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp deleted file mode 100644 index 6dda24559d4..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Pride And Prejudice" ); - XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; - - // Add a new attribute to the collection. - XmlAttribute^ attr = doc->CreateAttribute( "style" ); - attr->Value = "hardcover"; - attrColl->SetNamedItem( attr ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp deleted file mode 100644 index e1cf039093e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataSet^ dataset; - -public: - void Method( XmlNamespaceManager^ nsmgr ) - { -// - if ( nsmgr->HasNamespace( String::Empty ) ) - { - Console::WriteLine( nsmgr->DefaultNamespace ); - } -// - } -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp deleted file mode 100644 index 38bee9fe649..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -public ref class Sample -{ -public: - Sample() - { - - // Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - - // Add prefix/namespace pairs to the XmlNamespaceManager. - nsmgr->AddNamespace( "", "www.wideworldimporters.com" ); //Adds a default namespace. - nsmgr->AddNamespace( "europe", "www.wideworldimporters.com/europe" ); - nsmgr->PushScope(); //Pushes a namespace scope on the stack. - nsmgr->AddNamespace( "", "www.lucernepublishing.com" ); //Adds another default namespace. - nsmgr->AddNamespace( "partners", "www.lucernepublishing.com/partners" ); - Console::WriteLine( "Show all the prefix/namespace pairs in the XmlNamespaceManager..." ); - ShowAllNamespaces( nsmgr ); - } - - -private: - void ShowAllNamespaces( XmlNamespaceManager^ nsmgr ) - { - do - { - System::Collections::IEnumerator^ myEnum = nsmgr->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ prefix = safe_cast(myEnum->Current); - Console::WriteLine( "Prefix={0}, Namespace={1}", prefix, nsmgr->LookupNamespace( prefix ) ); - } - } - while ( nsmgr->PopScope() ); - } - -}; - -int main() -{ - gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp deleted file mode 100644 index 7e0abed5a53..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; -using namespace System::Xml::Schema; -public ref class Class1 -{ -public: - void Method1() - { - - // - XmlTextReader^ reader = gcnew XmlTextReader( "myfile.xml" ); - XmlNamespaceManager^ nsmanager = gcnew XmlNamespaceManager( reader->NameTable ); - nsmanager->AddNamespace( "msbooks", "www.microsoft.com/books" ); - nsmanager->PushScope(); - nsmanager->AddNamespace( "msstore", "www.microsoft.com/store" ); - while ( reader->Read() ) - { - Console::WriteLine( "Reader Prefix:{0}", reader->Prefix ); - Console::WriteLine( "XmlNamespaceManager Prefix:{0}", nsmanager->LookupPrefix( nsmanager->NameTable->Get( reader->NamespaceURI ) ) ); - } - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp deleted file mode 100644 index cc33f1ca5ec..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Create a new node. - XmlElement^ elem = doc->CreateElement( "price" ); - elem->InnerText = "19.95"; - - //Add the node to the document. - root->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp deleted file mode 100644 index 0e20454fc0c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" ); - XmlNode^ root = doc->FirstChild; - - //Clone the root node. The cloned node includes - //child nodes. This is similar to calling CloneNode(true). - XmlNode^ clone = root->Clone(); - Console::WriteLine( clone->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp deleted file mode 100644 index 5d3608a3e74..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" ); - XmlNode^ root = doc->FirstChild; - - //Create a deep clone. The cloned node - //includes the child nodes. - XmlNode^ deep = root->CloneNode( true ); - Console::WriteLine( deep->OuterXml ); - - //Create a shallow clone. The cloned node does not - //include the child nodes, but does include its attribute. - XmlNode^ shallow = root->CloneNode( false ); - Console::WriteLine( shallow->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp deleted file mode 100644 index 8c9bb154ef8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" ); - XmlNode^ root = doc->FirstChild; - Console::WriteLine( "Display the title element..." ); - Console::WriteLine( root->FirstChild->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index b7fb2e4d051..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - Console::WriteLine( "Display all the books..." ); - XmlNode^ root = doc->DocumentElement; - IEnumerator^ ienum = root->GetEnumerator(); - XmlNode^ book; - while ( ienum->MoveNext() ) - { - book = dynamic_cast(ienum->Current); - Console::WriteLine( book->OuterXml ); - Console::WriteLine(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp deleted file mode 100644 index 7f8efa23a79..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->FirstChild; - - //Create a new attribute. - String^ ns = root->GetNamespaceOfPrefix( "bk" ); - XmlNode^ attr = doc->CreateNode( XmlNodeType::Attribute, "genre", ns ); - attr->Value = "novel"; - - //Add the attribute to the document. - root->Attributes->SetNamedItem( attr ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp deleted file mode 100644 index 24c5ad1996b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->FirstChild; - - //Create a new node. - String^ prefix = root->GetPrefixOfNamespace( "urn:samples" ); - XmlElement^ elem = doc->CreateElement( prefix, "style", "urn:samples" ); - elem->InnerText = "hardcover"; - - //Add the node to the document. - root->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp deleted file mode 100644 index ff8ddddef56..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" ); - XmlNode^ root = doc->FirstChild; - - //Display the contents of the child nodes. - if ( root->HasChildNodes ) - { - for ( int i = 0; i < root->ChildNodes->Count; i++ ) - { - Console::WriteLine( root->ChildNodes[ i ]->InnerText ); - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp deleted file mode 100644 index afa0e8a8997..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "some textmore text" - "" ); - XmlNode^ elem = doc->DocumentElement->FirstChild; - - // Note that InnerText does not include the markup. - Console::WriteLine( "Display the InnerText of the element..." ); - Console::WriteLine( elem->InnerText ); - - // InnerXml includes the markup of the element. - Console::WriteLine( "Display the InnerXml of the element..." ); - Console::WriteLine( elem->InnerXml ); - - // Set InnerText to a string that includes markup. - // The markup is escaped. - elem->InnerText = "Text containing will have char(<) and char(>) escaped."; - Console::WriteLine( elem->OuterXml ); - - // Set InnerXml to a string that includes markup. - // The markup is not escaped. - elem->InnerXml = "Text containing ."; - Console::WriteLine( elem->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp deleted file mode 100644 index bbc72ef7e69..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Create a new node. - XmlElement^ elem = doc->CreateElement( "price" ); - elem->InnerText = "19.95"; - - //Add the node to the document. - root->InsertAfter( elem, root->FirstChild ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp deleted file mode 100644 index 3ebee800a51..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Create a new node. - XmlElement^ elem = doc->CreateElement( "price" ); - elem->InnerText = "19.95"; - - //Add the node to the document. - root->InsertBefore( elem, root->FirstChild ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp deleted file mode 100644 index 9514236fc62..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" ); - XmlNode^ root = doc->FirstChild; - Console::WriteLine( "Display the price element..." ); - Console::WriteLine( root->LastChild->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp deleted file mode 100644 index c78113a0dab..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - XmlNode^ currNode = doc->DocumentElement->FirstChild; - Console::WriteLine( "First book..." ); - Console::WriteLine( currNode->OuterXml ); - XmlNode^ nextNode = currNode->NextSibling; - Console::WriteLine( "\r\nSecond book..." ); - Console::WriteLine( nextNode->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp deleted file mode 100644 index 9465dbc7815..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - // OuterXml includes the markup of current node. - Console::WriteLine( "Display the OuterXml property..." ); - Console::WriteLine( root->OuterXml ); - - // InnerXml does not include the markup of the current node. - // As a result, the attributes are not displayed. - Console::WriteLine(); - Console::WriteLine( "Display the InnerXml property..." ); - Console::WriteLine( root->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp deleted file mode 100644 index 63c23bf93d4..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Create a new node. - XmlElement^ elem = doc->CreateElement( "price" ); - elem->InnerText = "19.95"; - - //Add the node to the document. - root->PrependChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp deleted file mode 100644 index 6b73208b236..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - XmlNode^ lastNode = doc->DocumentElement->LastChild; - Console::WriteLine( "Last book..." ); - Console::WriteLine( lastNode->OuterXml ); - XmlNode^ prevNode = lastNode->PreviousSibling; - Console::WriteLine( "\r\nPrevious book..." ); - Console::WriteLine( prevNode->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp deleted file mode 100644 index 5d7402c67e9..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Remove all attribute and child nodes. - root->RemoveAll(); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp deleted file mode 100644 index 3eeeb8ee336..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Remove the title element. - root->RemoveChild( root->FirstChild ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp deleted file mode 100644 index 8b2b88dc130..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->DocumentElement; - - //Create a new title element. - XmlElement^ elem = doc->CreateElement( "title" ); - elem->InnerText = "The Handmaid's Tale"; - - //Replace the title element. - root->ReplaceChild( elem, root->FirstChild ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp deleted file mode 100644 index fa145876295..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "booksort.xml" ); - XmlNodeList^ nodeList; - XmlNode^ root = doc->DocumentElement; - nodeList = root->SelectNodes( "descendant::book[author/last-name='Austen']" ); - - //Change the price on the books. - System::Collections::IEnumerator^ myEnum = nodeList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - XmlNode^ book = safe_cast(myEnum->Current); - book->LastChild->InnerText = "15.95"; - } - - Console::WriteLine( "Display the modified XML document...." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp deleted file mode 100644 index 7ef2af1b754..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "booksort.xml" ); - XmlNode^ book; - XmlNode^ root = doc->DocumentElement; - book = root->SelectSingleNode( "descendant::book[author/last-name='Austen']" ); - - //Change the price on the book. - book->LastChild->InnerText = "15.95"; - Console::WriteLine( "Display the modified XML document...." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp deleted file mode 100644 index 109df9f1d9a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->FirstChild; - - // Because WriteContentTo saves only the child nodes of the node - // to the writer none of the attributes are displayed. - Console::WriteLine( "Display the contents of the node..." ); - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - root->WriteContentTo( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp deleted file mode 100644 index 7a871794b8e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "" ); - XmlNode^ root = doc->FirstChild; - Console::WriteLine( "Display the root node..." ); - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - root->WriteTo( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp deleted file mode 100644 index d308ff6a9b0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" ); - XmlNode^ root = doc->FirstChild; - Console::WriteLine( "Display the title element..." ); - Console::WriteLine( root[ "title" ]->OuterXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index 931cd16856c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Collections; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "2books.xml" ); - - //Get and display all the book titles. - XmlElement^ root = doc->DocumentElement; - XmlNodeList^ elemList = root->GetElementsByTagName( "title" ); - IEnumerator^ ienum = elemList->GetEnumerator(); - while ( ienum->MoveNext() ) - { - XmlNode^ title = dynamic_cast(ienum->Current); - Console::WriteLine( title->InnerText ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp deleted file mode 100644 index 8fcc0d2c019..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - " First item" - " Second item" - "" ); - - //Get and display the last item node. - XmlElement^ root = doc->DocumentElement; - XmlNodeList^ nodeList = root->GetElementsByTagName( "item" ); - Console::WriteLine( nodeList->Item( 1 )->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp deleted file mode 100644 index 91353be15eb..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " " - "" ); - - //Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - - //Read the attributes on the root element. - reader->MoveToContent(); - if ( reader->HasAttributes ) - { - for ( int i = 0; i < reader->AttributeCount; i++ ) - { - reader->MoveToAttribute( i ); - Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); - - } - reader->MoveToElement(); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp deleted file mode 100644 index d3287716081..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load an XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "http://localhost/uri.xml" ); - reader = gcnew XmlNodeReader( doc ); - - //Parse the file and display the base URI for each node. - while ( reader->Read() ) - { - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp deleted file mode 100644 index 5b0e8725b23..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " " - "" ); - - // Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - - //Read the ISBN attribute. - reader->MoveToContent(); - String^ isbn = reader->GetAttribute( "ISBN" ); - Console::WriteLine( "The ISBN value: {0}", isbn ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp deleted file mode 100644 index 009705ea4c1..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - // Create and load an XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "]>" - "" - "Pride And Prejudice" - "&h;" - "" ); - reader = gcnew XmlNodeReader( doc ); - - // Parse the file and display each node. - while ( reader->Read() ) - { - if ( reader->HasValue ) - Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); - else - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp deleted file mode 100644 index a63f00d1f68..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Pride And Prejudice" - "19.95" - "" - "" ); - - //Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - - //Parse the XML and display the text content of each of the elements. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->IsEmptyElement ) - Console::WriteLine( "<{0}/>", reader->Name ); - else - { - Console::Write( "<{0}> ", reader->Name ); - reader->Read(); //Read the start tag. - if ( reader->IsStartElement() ) - - //Handle nested elements. - Console::Write( "\r\n<{0}>", reader->Name ); - Console::WriteLine( reader->ReadString() ); //Read the text content of the element. - } - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp deleted file mode 100644 index 255f2c6a1da..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" ); - - //Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - - //Read the genre attribute. - reader->MoveToContent(); - reader->MoveToFirstAttribute(); - String^ genre = reader->Value; - Console::WriteLine( "The genre value: {0}", genre ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp deleted file mode 100644 index 2d6857ce16e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " " - "Pride And Prejudice" - "19.95" - "" ); - - //Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - - //Read the attributes on the book element. - reader->MoveToContent(); - while ( reader->MoveToNextAttribute() ) - { - Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); - } - - //Move the reader to the title element. - reader->Read(); - - //Read the title and price elements. - Console::WriteLine( reader->ReadElementString() ); - Console::WriteLine( reader->ReadElementString() ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp deleted file mode 100644 index b596f0cbf8c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - String^ filename = "items.xml"; - XmlNodeReader^ reader = nullptr; - try - { - - //Create an XmlNodeReader to read the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( filename ); - reader = gcnew XmlNodeReader( doc ); - - //Parse the file and display each of the nodes. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "<{0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::CDATA: - Console::Write( reader->Value ); - break; - - case XmlNodeType::ProcessingInstruction: - Console::Write( "", reader->Name, reader->Value ); - break; - - case XmlNodeType::Comment: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::XmlDeclaration: - Console::Write( "" ); - break; - - case XmlNodeType::Document: - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp deleted file mode 100644 index 209660c6243..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " " - "Pride And Prejudice" - "novel" - "" ); - - //Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - - //Parse the XML. If they exist, display the prefix and - //namespace URI of each node. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->Prefix == String::Empty ) - Console::WriteLine( "<{0}>", reader->LocalName ); - else - { - Console::Write( "<{0}:{1}>", reader->Prefix, reader->LocalName ); - Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI ); - } - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp deleted file mode 100644 index fa8f90ee268..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load an XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "" ); - - //Create the reader. - reader = gcnew XmlNodeReader( doc ); - - //Read the misc attribute. The attribute is parsed into multiple - //text and entity reference nodes. - reader->MoveToContent(); - reader->MoveToAttribute( "misc" ); - while ( reader->ReadAttributeValue() ) - { - if ( reader->NodeType == XmlNodeType::EntityReference ) - - //To expand the entity, call ResolveEntity. - Console::WriteLine( "{0} {1}", reader->NodeType, reader->Name ); - else - Console::WriteLine( "{0} {1}", reader->NodeType, reader->Value ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp deleted file mode 100644 index a980ac2665e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load an XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "&h;" - "" ); - - //Create the reader. - reader = gcnew XmlNodeReader( doc ); - reader->MoveToContent(); //Move to the root element. - reader->Read(); //Move to title start tag. - reader->Skip(); //Skip the title element. - - //Read the misc start tag. The reader is now positioned on - //the entity reference node. - reader->ReadStartElement(); - - //You must call ResolveEntity to expand the entity reference. - //The entity replacement text is then parsed and returned as a child node. - Console::WriteLine( "Expand the entity..." ); - reader->ResolveEntity(); - Console::WriteLine( "The entity replacement text is returned as a text node." ); - reader->Read(); - Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value ); - Console::WriteLine( "An EndEntity node closes the entity reference scope." ); - reader->Read(); - Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp deleted file mode 100644 index cb90b873442..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlNodeReader^ reader = nullptr; - try - { - - //Create and load the XML document. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "" - "Pride And Prejudice" - "19.95" - "" ); - - //Load the XmlNodeReader - reader = gcnew XmlNodeReader( doc ); - reader->MoveToContent(); //Move to the book node. - reader->Read(); //Read the book start tag. - reader->Skip(); //Skip the title element. - Console::WriteLine( reader->ReadOuterXml() ); //Read the price element. - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp deleted file mode 100644 index 7658108b64d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; -using namespace System::Xml::Schema; - -public ref class Class1 -{ -// -public: - void DisplayAttributes( XmlReader^ reader ) - { - if ( reader->HasAttributes ) - { - Console::WriteLine( "Attributes of <{0}>", reader->Name ); - while ( reader->MoveToNextAttribute() ) - { - Console::WriteLine( " {0}={1}", reader->Name, reader->Value ); - } - } - } -// -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp deleted file mode 100644 index 4d1aa635c0e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - try - { - - //Load the reader with the XML file. - reader = gcnew XmlTextReader( "elems.xml" ); - - //Parse the XML and display the text content of each of the elements. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->IsEmptyElement ) - Console::WriteLine( "<{0}/>", reader->Name ); - else - { - Console::Write( "<{0}> ", reader->Name ); - reader->Read(); //Read the start tag. - if ( reader->IsStartElement() ) - - //Handle nested elements. - Console::Write( "\r\n<{0}>", reader->Name ); - Console::WriteLine( reader->ReadString() ); //Read the text content of the element. - } - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp deleted file mode 100644 index 05bb06db971..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - String^ _price; - -public: - void Method( XmlReader^ reader ) - { -// - if ( reader->MoveToContent() == XmlNodeType::Element && - reader->Name->Equals( "price" ) ) - { - _price = reader->ReadString(); - } -// - } -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp deleted file mode 100644 index 2ecb603c997..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp +++ /dev/null @@ -1,97 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - static void Main() - { - - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ elementCat = gcnew XmlSchemaElement(); - schema->Items->Add(elementCat); - elementCat->Name = "cat"; - elementCat->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementDog = gcnew XmlSchemaElement(); - schema->Items->Add(elementDog); - elementDog->Name = "dog"; - elementDog->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementRedDog = gcnew XmlSchemaElement(); - schema->Items->Add(elementRedDog); - elementRedDog->Name = "redDog"; - elementRedDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); - - // - XmlSchemaElement^ elementBrownDog = gcnew XmlSchemaElement(); - schema->Items->Add(elementBrownDog); - elementBrownDog->Name = "brownDog"; - elementBrownDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); - - - // - XmlSchemaElement^ elementPets = gcnew XmlSchemaElement(); - schema->Items->Add(elementPets); - elementPets->Name = "pets"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - elementPets->SchemaType = complexType; - - // - XmlSchemaChoice^ choice = gcnew XmlSchemaChoice(); - complexType->Particle = choice; - choice->MinOccurs = 0; - choice->MaxOccursString = "unbounded"; - - // - XmlSchemaElement^ catRef = gcnew XmlSchemaElement(); - choice->Items->Add(catRef); - catRef->RefName = gcnew XmlQualifiedName("cat"); - - // - XmlSchemaElement^ dogRef = gcnew XmlSchemaElement(); - choice->Items->Add(dogRef); - dogRef->RefName = gcnew XmlQualifiedName("dog"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// - - diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp deleted file mode 100644 index d410a9785b7..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - XmlSchemaElement^ thing1 = gcnew XmlSchemaElement(); - thing1->Name = "thing1"; - thing1->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - schema->Items->Add(thing1); - - XmlSchemaElement^ thing2 = gcnew XmlSchemaElement(); - thing2->Name = "thing2"; - thing2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - schema->Items->Add(thing2); - - XmlSchemaElement^ thing3 = gcnew XmlSchemaElement(); - thing3->Name = "thing3"; - thing3->SchemaTypeName = - gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - schema->Items->Add(thing3); - - XmlSchemaElement^ thing4 = gcnew XmlSchemaElement(); - thing4->Name = "thing4"; - thing4->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - schema->Items->Add(thing4); - - XmlSchemaAttribute^ myAttribute = gcnew XmlSchemaAttribute(); - myAttribute->Name = "myAttribute"; - myAttribute->SchemaTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); - schema->Items->Add(myAttribute); - - XmlSchemaComplexType^ myComplexType = gcnew XmlSchemaComplexType(); - myComplexType->Name = "myComplexType"; - - XmlSchemaAll^ complexType_all = gcnew XmlSchemaAll(); - - XmlSchemaElement^ complexType_all_thing1 = gcnew XmlSchemaElement(); - complexType_all_thing1->RefName = gcnew XmlQualifiedName("thing1", ""); - complexType_all->Items->Add(complexType_all_thing1); - - XmlSchemaElement^ complexType_all_thing2 = gcnew XmlSchemaElement(); - complexType_all_thing2->RefName = gcnew XmlQualifiedName("thing2", ""); - complexType_all->Items->Add(complexType_all_thing2); - - XmlSchemaElement^ complexType_all_thing3 = gcnew XmlSchemaElement(); - complexType_all_thing3->RefName = gcnew XmlQualifiedName("thing3", ""); - complexType_all->Items->Add(complexType_all_thing3); - - XmlSchemaElement^ complexType_all_thing4 = gcnew XmlSchemaElement(); - complexType_all_thing4->RefName = gcnew XmlQualifiedName("thing4", ""); - complexType_all->Items->Add(complexType_all_thing4); - - myComplexType->Particle = complexType_all; - - XmlSchemaAttribute^ complexType_myAttribute = gcnew XmlSchemaAttribute(); - complexType_myAttribute->RefName = gcnew XmlQualifiedName("myAttribute", ""); - myComplexType->Attributes->Add(complexType_myAttribute); - - schema->Items->Add(myComplexType); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp deleted file mode 100644 index 0da1a34fd86..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - static void Main() - { - - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType(); - simpleType->Name = "northwestStates"; - schema->Items->Add(simpleType); - - // - XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation(); - simpleType->Annotation = annNorthwestStates; - - // States in the Pacific Northwest of US - XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation(); - annNorthwestStates->Items->Add(docNorthwestStates); - docNorthwestStates->Markup = TextToNodeArray("States in the Pacific Northwest of US"); - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - simpleType->Content = restriction; - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaEnumerationFacet^ enumerationWA = gcnew XmlSchemaEnumerationFacet(); - restriction->Facets->Add(enumerationWA); - enumerationWA->Value = "WA"; - - // - XmlSchemaAnnotation^ annWA = gcnew XmlSchemaAnnotation(); - enumerationWA->Annotation = annWA; - - // Washington - XmlSchemaDocumentation^ docWA = gcnew XmlSchemaDocumentation(); - annWA->Items->Add(docWA); - docWA->Markup = TextToNodeArray("Washington"); - - // - XmlSchemaEnumerationFacet^ enumerationOR = gcnew XmlSchemaEnumerationFacet(); - restriction->Facets->Add(enumerationOR); - enumerationOR->Value = "OR"; - - // - XmlSchemaAnnotation^ annOR = gcnew XmlSchemaAnnotation(); - enumerationOR->Annotation = annOR; - - // Oregon - XmlSchemaDocumentation^ docOR = gcnew XmlSchemaDocumentation(); - annOR->Items->Add(docOR); - docOR->Markup = TextToNodeArray("Oregon"); - - // - XmlSchemaEnumerationFacet^ enumerationID = gcnew XmlSchemaEnumerationFacet(); - - restriction->Facets->Add(enumerationID); - enumerationID->Value = "ID"; - - // - XmlSchemaAnnotation^ annID = gcnew XmlSchemaAnnotation(); - enumerationID->Annotation = annID; - - // Idaho - XmlSchemaDocumentation^ docID = gcnew XmlSchemaDocumentation(); - annID->Items->Add(docID); - docID->Markup = TextToNodeArray("Idaho"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - - static array^ TextToNodeArray(String^ text) - { - XmlDocument^ doc = gcnew XmlDocument(); - array^ temp = {doc->CreateTextNode(text)}; - return temp; - } - -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp deleted file mode 100644 index de4222ca95d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ xeHtmlText = gcnew XmlSchemaElement(); - xeHtmlText->Name = "htmlText"; - - // - XmlSchemaComplexType^ ct = gcnew XmlSchemaComplexType(); - - // - XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence(); - - // - XmlSchemaAny^ any = gcnew XmlSchemaAny(); - any->MinOccurs = 1; - any->MaxOccursString = "unbounded"; - any->Namespace = "http://www.w3.org/1999/xhtml"; - any->ProcessContents = XmlSchemaContentProcessing::Lax; - sequence->Items->Add(any); - - ct->Particle = sequence; - xeHtmlText->SchemaType = ct; - - schema->Items->Add(xeHtmlText); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - schema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp deleted file mode 100644 index 17a9abb810d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - schema->Items->Add(element); - element->Name = "stringElementWithAnyAttribute"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - element->SchemaType = complexType; - - // - XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent(); - complexType->ContentModel = simpleContent; - - // - XmlSchemaSimpleContentExtension^ extension = gcnew XmlSchemaSimpleContentExtension(); - simpleContent->Content = extension; - extension->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAnyAttribute^ anyAttribute = gcnew XmlSchemaAnyAttribute(); - extension->AnyAttribute = anyAttribute; - anyAttribute->Namespace = "##targetNamespace"; - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp deleted file mode 100644 index cb4bdbb1014..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - schema->Items->Add(element); - element->Name = "State"; - - // - XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation(); - element->Annotation = annNorthwestStates; - - // State Name - XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation(); - annNorthwestStates->Items->Add(docNorthwestStates); - docNorthwestStates->Markup = TextToNodeArray("State Name"); - - // Application Information - XmlSchemaAppInfo^ appInfo = gcnew XmlSchemaAppInfo(); - annNorthwestStates->Items->Add(appInfo); - appInfo->Markup = TextToNodeArray("Application Information"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - - Console::WriteLine(args->Message); - } - - static array^ TextToNodeArray(String^ text) - { - XmlDocument^ doc = gcnew XmlDocument(); - array^ nodes = {doc->CreateTextNode(text)}; - return nodes; - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp deleted file mode 100644 index 083c98e686d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaAttribute^ attributeBase = gcnew XmlSchemaAttribute(); - schema->Items->Add(attributeBase); - attributeBase->Name = "mybaseattribute"; - - // - XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType(); - attributeBase->SchemaType = simpleType; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - simpleType->Content = restriction; - restriction->BaseTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet(); - restriction->Facets->Add(maxInclusive); - maxInclusive->Value = "1000"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - schema->Items->Add(complexType); - complexType->Name = "myComplexType"; - - // - XmlSchemaAttribute^ attributeBaseRef = gcnew XmlSchemaAttribute(); - complexType->Attributes->Add(attributeBaseRef); - attributeBaseRef->RefName = gcnew XmlQualifiedName("mybaseattribute"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp deleted file mode 100644 index 465d8de18d4..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaAttributeGroup^ myAttributeGroup = gcnew XmlSchemaAttributeGroup(); - schema->Items->Add(myAttributeGroup); - myAttributeGroup->Name = "myAttributeGroup"; - - // - XmlSchemaAttribute^ someattribute1 = gcnew XmlSchemaAttribute(); - myAttributeGroup->Attributes->Add(someattribute1); - someattribute1->Name = "someattribute1"; - someattribute1->SchemaTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema"); - - - // - XmlSchemaAttribute^ someattribute2 = gcnew XmlSchemaAttribute(); - myAttributeGroup->Attributes->Add(someattribute2); - someattribute2->Name = "someattribute2"; - someattribute2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaComplexType^ myElementType = gcnew XmlSchemaComplexType(); - schema->Items->Add(myElementType); - myElementType->Name = "myElementType"; - - // - XmlSchemaAttributeGroupRef^ myAttributeGroupRef = gcnew XmlSchemaAttributeGroupRef(); - myElementType->Attributes->Add(myAttributeGroupRef); - myAttributeGroupRef->RefName = gcnew XmlQualifiedName("myAttributeGroup"); - - // - XmlSchemaAttributeGroup^ myAttributeGroupA = gcnew XmlSchemaAttributeGroup(); - schema->Items->Add(myAttributeGroupA); - myAttributeGroupA->Name = "myAttributeGroupA"; - - // - XmlSchemaAttribute^ someattribute10 = gcnew XmlSchemaAttribute(); - myAttributeGroupA->Attributes->Add(someattribute10); - someattribute10->Name = "someattribute10"; - someattribute10->SchemaTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAttribute^ someattribute11 = gcnew XmlSchemaAttribute(); - myAttributeGroupA->Attributes->Add(someattribute11); - someattribute11->Name = "someattribute11"; - someattribute11->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAttributeGroup^ myAttributeGroupB = gcnew XmlSchemaAttributeGroup(); - schema->Items->Add(myAttributeGroupB); - myAttributeGroupB->Name = "myAttributeGroupB"; - - // - XmlSchemaAttribute^ someattribute20 = gcnew XmlSchemaAttribute(); - myAttributeGroupB->Attributes->Add(someattribute20); - someattribute20->Name = "someattribute20"; - someattribute20->SchemaTypeName = gcnew XmlQualifiedName("date", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAttributeGroupRef^ myAttributeGroupRefA = gcnew XmlSchemaAttributeGroupRef(); - myAttributeGroupB->Attributes->Add(myAttributeGroupRefA); - myAttributeGroupRefA->RefName = gcnew XmlQualifiedName("myAttributeGroupA"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp deleted file mode 100644 index d73de8b2cf6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ xeSelected = gcnew XmlSchemaElement(); - xeSelected->Name = "selected"; - schema->Items->Add(xeSelected); - - // - XmlSchemaElement^ xeUnselected = gcnew XmlSchemaElement(); - xeUnselected->Name = "unselected"; - schema->Items->Add(xeUnselected); - - // - XmlSchemaElement^ xeDimpled = gcnew XmlSchemaElement(); - xeDimpled->Name = "dimpled"; - schema->Items->Add(xeDimpled); - - // - XmlSchemaElement^ xePerforated = gcnew XmlSchemaElement(); - xePerforated->Name = "perforated"; - schema->Items->Add(xePerforated); - - // - XmlSchemaComplexType^ chadState = gcnew XmlSchemaComplexType(); - schema->Items->Add(chadState); - chadState->Name = "chadState"; - - // - XmlSchemaChoice^ choice = gcnew XmlSchemaChoice(); - chadState->Particle = choice; - choice->MinOccurs = 1; - choice->MaxOccurs = 1; - - // - XmlSchemaElement^ elementSelected = gcnew XmlSchemaElement(); - choice->Items->Add(elementSelected); - elementSelected->RefName = gcnew XmlQualifiedName("selected"); - - // - XmlSchemaElement^ elementUnselected = gcnew XmlSchemaElement(); - choice->Items->Add(elementUnselected); - elementUnselected->RefName = gcnew XmlQualifiedName("unselected"); - - // - XmlSchemaElement^ elementDimpled = gcnew XmlSchemaElement(); - choice->Items->Add(elementDimpled); - elementDimpled->RefName = gcnew XmlQualifiedName("dimpled"); - - // - XmlSchemaElement^ elementPerforated = gcnew XmlSchemaElement(); - choice->Items->Add(elementPerforated); - elementPerforated->RefName = gcnew XmlQualifiedName("perforated"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index b9bf69edc70..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; -using namespace System::Xml::Schema; - -public ref class Class1 -{ - // -public: - void DisplaySchemas( XmlSchemaCollection^ xsc ) - { - XmlSchemaCollectionEnumerator^ ienum = xsc->GetEnumerator(); - while ( ienum->MoveNext() ) - { - XmlSchema^ schema = ienum->Current; - StringWriter^ sw = gcnew StringWriter; - XmlTextWriter^ writer = gcnew XmlTextWriter( sw ); - writer->Formatting = Formatting::Indented; - writer->Indentation = 2; - schema->Write( writer ); - Console::WriteLine( sw ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp deleted file mode 100644 index 9dfc421ef93..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method( XmlSchemaCollection^ xsc ) - { - // - if ( xsc->Contains( "urn:bookstore-schema" ) ) - { - XmlSchema^ schema = xsc[ "urn:bookstore-schema" ]; - StringWriter^ sw = gcnew StringWriter; - XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( sw ); - xmlWriter->Formatting = Formatting::Indented; - xmlWriter->Indentation = 2; - schema->Write( xmlWriter ); - Console::WriteLine( sw ); - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp deleted file mode 100644 index 65680c23fba..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaComplexType^ address = gcnew XmlSchemaComplexType(); - schema->Items->Add(address); - address->Name = "address"; - - // - XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence(); - address->Particle = sequence; - - // - XmlSchemaElement^ elementName = gcnew XmlSchemaElement(); - sequence->Items->Add(elementName); - elementName->Name = "name"; - elementName->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementStreet = gcnew XmlSchemaElement(); - sequence->Items->Add(elementStreet); - elementStreet->Name = "street"; - elementStreet->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementCity = gcnew XmlSchemaElement(); - sequence->Items->Add(elementCity); - elementCity->Name = "city"; - elementCity->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaComplexType^ USAddress = gcnew XmlSchemaComplexType(); - schema->Items->Add(USAddress); - USAddress->Name = "USAddress"; - - // - XmlSchemaComplexContent^ complexContent = gcnew XmlSchemaComplexContent(); - USAddress->ContentModel = complexContent; - - // - XmlSchemaComplexContentExtension^ extensionAddress = gcnew XmlSchemaComplexContentExtension(); - complexContent->Content = extensionAddress; - extensionAddress->BaseTypeName = gcnew XmlQualifiedName("address"); - - // - XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence(); - extensionAddress->Particle = sequence2; - - // - XmlSchemaElement^ elementUSState = gcnew XmlSchemaElement(); - sequence2->Items->Add(elementUSState); - elementUSState->Name = "state"; - elementUSState->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - - // - XmlSchemaElement^ elementZipcode = gcnew XmlSchemaElement(); - sequence2->Items->Add(elementZipcode); - elementZipcode->Name = "zipcode"; - elementZipcode->SchemaTypeName = gcnew XmlQualifiedName("positiveInteger", "http://www.w3.org/2001/XMLSchema"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp deleted file mode 100644 index 8c05936319d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaComplexType^ phoneNumber = gcnew XmlSchemaComplexType(); - phoneNumber->Name = "phoneNumber"; - - // - XmlSchemaSequence^ phoneNumberSequence = gcnew XmlSchemaSequence(); - - // - XmlSchemaElement^ areaCode1 = gcnew XmlSchemaElement(); - areaCode1->MinOccurs = 0; - areaCode1->MaxOccursString = "1"; - areaCode1->Name = "areaCode"; - phoneNumberSequence->Items->Add(areaCode1); - - // - XmlSchemaElement^ prefix1 = gcnew XmlSchemaElement(); - prefix1->MinOccurs = 1; - prefix1->MaxOccursString = "1"; - prefix1->Name = "prefix"; - phoneNumberSequence->Items->Add(prefix1); - - // - XmlSchemaElement^ number1 = gcnew XmlSchemaElement(); - number1->MinOccurs = 1; - number1->MaxOccursString = "1"; - number1->Name = "number"; - phoneNumberSequence->Items->Add(number1); - - phoneNumber->Particle = phoneNumberSequence; - - schema->Items->Add(phoneNumber); - - // - XmlSchemaComplexType^ localPhoneNumber = gcnew XmlSchemaComplexType(); - localPhoneNumber->Name = "localPhoneNumber"; - - // - XmlSchemaComplexContent^ complexContent = gcnew XmlSchemaComplexContent(); - - // - XmlSchemaComplexContentRestriction^ restriction = gcnew XmlSchemaComplexContentRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("phoneNumber", ""); - - // - XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence(); - - // - XmlSchemaElement^ areaCode2 = gcnew XmlSchemaElement(); - areaCode2->MinOccurs = 0; - areaCode2->MaxOccursString = "1"; - areaCode2->Name = "areaCode"; - sequence2->Items->Add(areaCode2); - - // - XmlSchemaElement^ prefix2 = gcnew XmlSchemaElement(); - prefix2->MinOccurs = 1; - prefix2->MaxOccursString = "1"; - prefix2->Name = "prefix"; - sequence2->Items->Add(prefix2); - - // - XmlSchemaElement^ number2 = gcnew XmlSchemaElement(); - number2->MinOccurs = 1; - number2->MaxOccursString = "1"; - number2->Name = "number"; - sequence2->Items->Add(number2); - - restriction->Particle = sequence2; - complexContent->Content = restriction; - localPhoneNumber->ContentModel = complexContent; - - schema->Items->Add(localPhoneNumber); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp deleted file mode 100644 index 6381b6b7526..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ SizeType = gcnew XmlSchemaSimpleType(); - SizeType->Name = "SizeType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaEnumerationFacet^ enumerationSmall = gcnew XmlSchemaEnumerationFacet(); - enumerationSmall->Value = "Small"; - restriction->Facets->Add(enumerationSmall); - - // - XmlSchemaEnumerationFacet^ enumerationMedium = gcnew XmlSchemaEnumerationFacet(); - enumerationMedium->Value = "Medium"; - restriction->Facets->Add(enumerationMedium); - - // - XmlSchemaEnumerationFacet^ enumerationLarge = gcnew XmlSchemaEnumerationFacet(); - enumerationLarge->Value = "Large"; - restriction->Facets->Add(enumerationLarge); - - SizeType->Content = restriction; - - schema->Items->Add(SizeType); - - // - XmlSchemaElement^ elementItem = gcnew XmlSchemaElement(); - elementItem->Name = "Item"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ attributeSize = gcnew XmlSchemaAttribute(); - attributeSize->Name = "Size"; - attributeSize->SchemaTypeName = gcnew XmlQualifiedName("SizeType", ""); - complexType->Attributes->Add(attributeSize); - - elementItem->SchemaType = complexType; - - schema->Items->Add(elementItem); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp deleted file mode 100644 index b7af3eb044a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class ValidXsd -{ -public: - - static void Main() - { - FileStream^ fs; - XmlSchema^ schema; - - try - { - fs = gcnew FileStream("example.xsd", FileMode::Open); - schema = XmlSchema::Read(fs, gcnew ValidationEventHandler(ShowCompileError)); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ShowCompileError); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - schema = compiledSchema; - - if (schema->IsCompiled) - { - // Schema is successfully compiled. - // Do something with it here. - - } - } - catch (XmlSchemaException^ e) - { - Console::WriteLine("LineNumber = {0}", e->LineNumber); - Console::WriteLine("LinePosition = {0}", e->LinePosition); - Console::WriteLine("Message = {0}", e->Message); - } - - } - - static void ShowCompileError(Object^ sender, ValidationEventArgs^ e) - { - Console::WriteLine("Validation Error: {0}", e->Message); - } -}; - -int main() -{ - ValidXsd::Main(); - Console::ReadLine(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp deleted file mode 100644 index 308c590aadf..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ elementThing1 = gcnew XmlSchemaElement(); - schema->Items->Add(elementThing1); - elementThing1->Name = "thing1"; - elementThing1->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementThing2 = gcnew XmlSchemaElement(); - schema->Items->Add(elementThing2); - elementThing2->Name = "thing2"; - elementThing2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementThing3 = gcnew XmlSchemaElement(); - schema->Items->Add(elementThing3); - elementThing3->Name = "thing3"; - elementThing3->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAttribute^ myAttribute = gcnew XmlSchemaAttribute(); - schema->Items->Add(myAttribute); - myAttribute->Name = "myAttribute"; - myAttribute->SchemaTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaGroup^ myGroupOfThings = gcnew XmlSchemaGroup(); - schema->Items->Add(myGroupOfThings); - myGroupOfThings->Name = "myGroupOfThings"; - - // - XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence(); - myGroupOfThings->Particle = sequence; - - // - XmlSchemaElement^ elementThing1Ref = gcnew XmlSchemaElement(); - sequence->Items->Add(elementThing1Ref); - elementThing1Ref->RefName = gcnew XmlQualifiedName("thing1"); - - // - XmlSchemaElement^ elementThing2Ref = gcnew XmlSchemaElement(); - sequence->Items->Add(elementThing2Ref); - elementThing2Ref->RefName = gcnew XmlQualifiedName("thing2"); - - // - XmlSchemaElement^ elementThing3Ref = gcnew XmlSchemaElement(); - sequence->Items->Add(elementThing3Ref); - elementThing3Ref->RefName = gcnew XmlQualifiedName("thing3"); - - // - XmlSchemaComplexType^ myComplexType = gcnew XmlSchemaComplexType(); - schema->Items->Add(myComplexType); - myComplexType->Name = "myComplexType"; - - // - XmlSchemaGroupRef^ myGroupOfThingsRef = gcnew XmlSchemaGroupRef(); - myComplexType->Particle = myGroupOfThingsRef; - myGroupOfThingsRef->RefName = gcnew XmlQualifiedName("myGroupOfThings"); - - // - XmlSchemaAttribute^ myAttributeRef = gcnew XmlSchemaAttribute(); - myComplexType->Attributes->Add(myAttributeRef); - myAttributeRef->RefName = gcnew XmlQualifiedName("myAttribute"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp deleted file mode 100644 index 4f5ccb60525..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaNotation^ notation = gcnew XmlSchemaNotation(); - notation->Name = "jpeg"; - notation->Public = "image/jpeg"; - notation->System = "viewer.exe"; - - schema->Items->Add(notation); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp deleted file mode 100644 index 320ba3c48fc..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Reflection; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class ValidXSD -{ -private: - static void DisplayObjects(Object^ o) - { - DisplayObjects(o, ""); - } - - static void DisplayObjects(Object^ o, String^ indent) - { - Console::WriteLine("{0}{1}", indent, o); - - for each (PropertyInfo^ property1 in o->GetType()->GetProperties()) - { - if (property1->PropertyType->FullName == "System.Xml.Schema.XmlSchemaObjectCollection") - { - XmlSchemaObjectCollection^ childObjectCollection = dynamic_cast(property1->GetValue(o, nullptr)); - - for each (XmlSchemaObject^ schemaObject in childObjectCollection) - { - DisplayObjects(schemaObject, indent + "\t"); - } - } - } - } - - static void ShowCompileError(Object^ sender, ValidationEventArgs^ e) - { - Console::WriteLine("Validation Error: {0}", e->Message); - } - -public: - static int Main() - { - String^ xsd = "example.xsd"; - - FileStream^ fs; - XmlSchema^ schema; - try - { - fs = gcnew FileStream(xsd, FileMode::Open); - schema = XmlSchema::Read(fs, gcnew ValidationEventHandler(ShowCompileError)); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ShowCompileError); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - schema = compiledSchema; - - if (schema->IsCompiled) - { - DisplayObjects(schema); - } - return 0; - } - catch (XmlSchemaException^ e) - { - Console::WriteLine("LineNumber = {0}", e->LineNumber); - Console::WriteLine("LinePosition = {0}", e->LinePosition); - Console::WriteLine("Message = {0}", e->Message); - Console::WriteLine("Source = {0}", e->Source); - return -1; - } - } -}; - -int main() -{ - ValidXSD::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp deleted file mode 100644 index f4e63a564af..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -int main() -{ - XmlSchema^ s = gcnew XmlSchema; - s->TargetNamespace = "myNamespace"; - s->Namespaces->Add( "myImpPrefix", "myImportNamespace" ); - - // Create the element. - XmlSchemaImport^ import = gcnew XmlSchemaImport; - import->Namespace = "myImportNamespace"; - import->SchemaLocation = "http://www.example.com/myImportNamespace"; - s->Includes->Add( import ); - - // Create an element and assign a type from imported schema. - XmlSchemaElement^ elem = gcnew XmlSchemaElement; - elem->SchemaTypeName = gcnew XmlQualifiedName( "importType","myImportNamespace" ); - elem->Name = "element1"; - s->Items->Add( elem ); - s->Write( Console::Out ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp deleted file mode 100644 index 4c7edb2f322..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XMLSchemaExamples -{ - -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ generalPrice = gcnew XmlSchemaElement(); - generalPrice->Name = "generalPrice"; - - // - XmlSchemaComplexType^ ct = gcnew XmlSchemaComplexType(); - - // - XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent(); - - // - XmlSchemaSimpleContentExtension^ simpleContent_extension = gcnew XmlSchemaSimpleContentExtension(); - simpleContent_extension->BaseTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAttribute^ currency = gcnew XmlSchemaAttribute(); - currency->Name = "currency"; - currency->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - simpleContent_extension->Attributes->Add(currency); - - simpleContent->Content = simpleContent_extension; - ct->ContentModel = simpleContent; - generalPrice->SchemaType = ct; - - schema->Items->Add(generalPrice); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp deleted file mode 100644 index 35a881cdd78..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ LotteryNumberType = gcnew XmlSchemaSimpleType(); - LotteryNumberType->Name = "LotteryNumber"; - - // - XmlSchemaSimpleTypeRestriction^ LotteryNumberRestriction = gcnew XmlSchemaSimpleTypeRestriction(); - LotteryNumberRestriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMinInclusiveFacet^ minInclusive = gcnew XmlSchemaMinInclusiveFacet(); - minInclusive->Value = "1"; - LotteryNumberRestriction->Facets->Add(minInclusive); - - // - XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet(); - maxInclusive->Value = "99"; - LotteryNumberRestriction->Facets->Add(maxInclusive); - - LotteryNumberType->Content = LotteryNumberRestriction; - schema->Items->Add(LotteryNumberType); - - // - XmlSchemaSimpleType^ LotteryNumberListType = gcnew XmlSchemaSimpleType(); - LotteryNumberListType->Name = "LotteryNumberList"; - - // - XmlSchemaSimpleTypeList^ list = gcnew XmlSchemaSimpleTypeList(); - list->ItemTypeName = gcnew XmlQualifiedName("LotteryNumber", ""); - LotteryNumberListType->Content = list; - - schema->Items->Add(LotteryNumberListType); - - // - XmlSchemaSimpleType^ LotteryNumbersType = gcnew XmlSchemaSimpleType(); - LotteryNumbersType->Name = "LotteryNumbers"; - - // - XmlSchemaSimpleTypeRestriction^ LotteryNumbersRestriction = gcnew XmlSchemaSimpleTypeRestriction(); - LotteryNumbersRestriction->BaseTypeName = gcnew XmlQualifiedName("LotteryNumberList", ""); - - // - XmlSchemaLengthFacet^ length = gcnew XmlSchemaLengthFacet(); - length->Value = "5"; - LotteryNumbersRestriction->Facets->Add(length); - - LotteryNumbersType->Content = LotteryNumbersRestriction; - - schema->Items->Add(LotteryNumbersType); - - // - XmlSchemaElement^ TodaysLottery = gcnew XmlSchemaElement(); - TodaysLottery->Name = "TodaysLottery"; - TodaysLottery->SchemaTypeName = gcnew XmlQualifiedName("LotteryNumbers", ""); - - schema->Items->Add(TodaysLottery); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp deleted file mode 100644 index 78ec91dd354..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp +++ /dev/null @@ -1,119 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -public ref class Sample -{ -private: - XmlNode^ currNode; - XmlTextReader^ reader; - -public: - Sample() - { - reader = nullptr; - String^ filename = "space.xml"; - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "" - "Eva" - "Corets" - "" ); - Console::WriteLine( "InnerText before..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Add white space. - currNode = doc->DocumentElement; - XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" ); - currNode->InsertAfter( sigws, currNode->FirstChild ); - Console::WriteLine(); - Console::WriteLine( "InnerText after..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Save and then display the file. - doc->Save( filename ); - Console::WriteLine(); - Console::WriteLine( "Reading file..." ); - ReadFile( filename ); - } - - - // Parse the file and print out each node. - void ReadFile( String^ filename ) - { - try - { - reader = gcnew XmlTextReader( filename ); - String^ sNodeType = nullptr; - while ( reader->Read() ) - { - sNodeType = NodeTypeToString( reader->NodeType ); - - // Print the node type, name, and value. - Console::WriteLine( "{0}<{1}> {2}", sNodeType, reader->Name, reader->Value ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - - } - - static String^ NodeTypeToString( XmlNodeType nodetype ) - { - String^ sNodeType = nullptr; - switch ( nodetype ) - { - case XmlNodeType::None: - sNodeType = "None"; - break; - - case XmlNodeType::Element: - sNodeType = "Element"; - break; - - case XmlNodeType::Attribute: - sNodeType = "Attribute"; - break; - - case XmlNodeType::Text: - sNodeType = "Text"; - break; - - case XmlNodeType::Comment: - sNodeType = "Comment"; - break; - - case XmlNodeType::Document: - sNodeType = "Document"; - break; - - case XmlNodeType::Whitespace: - sNodeType = "Whitespace"; - break; - - case XmlNodeType::SignificantWhitespace: - sNodeType = "SignificantWhitespace"; - break; - - case XmlNodeType::EndElement: - sNodeType = "EndElement"; - break; - } - return sNodeType; - } - -}; - -int main() -{ - gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp deleted file mode 100644 index 47a0236b987..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - try - { - - //Load the reader with the XML file. - reader = gcnew XmlTextReader( "http://localhost/baseuri.xml" ); - - //Parse the file and display the base URI for each node. - while ( reader->Read() ) - { - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp deleted file mode 100644 index e63d63dc208..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - try - { - - //Load the reader with the XML file. - reader = gcnew XmlTextReader( "attrs.xml" ); - - //Read the ISBN attribute. - reader->MoveToContent(); - String^ isbn = reader->GetAttribute( "ISBN" ); - Console::WriteLine( "The ISBN value: {0}", isbn ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp deleted file mode 100644 index f61a0885d7c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp +++ /dev/null @@ -1,82 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - String^ filename = "tworeads.xml"; - XmlTextReader^ reader = gcnew XmlTextReader( filename ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Read the first part of the XML document - while ( reader->Read() ) - { - - // Display the elements and stop reading on the book endelement tag - // then go to ReadPart2 to start another reader to read the rest of the file. - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::WriteLine( "Name: {0}", reader->Name ); - break; - - case XmlNodeType::Text: - Console::WriteLine( " Element Text: {0}", reader->Value ); - break; - - case XmlNodeType::EndElement: - - // Stop reading when the reader gets to the end element of the book node. - if ( "book" == reader->LocalName ) - { - Console::WriteLine( "End reading first book..." ); - Console::WriteLine(); - goto ReadPart2; - } - break; - } - } - - - // Read the rest of the XML document - -ReadPart2: - Console::WriteLine( "Begin reading second book..." ); - - // Create a new reader to read the rest of the document. - XmlTextReader^ reader2 = gcnew XmlTextReader( reader->GetRemainder() ); - while ( reader2->Read() ) - { - switch ( reader2->NodeType ) - { - case XmlNodeType::Element: - Console::WriteLine( "Name: {0}", reader2->Name ); - break; - - case XmlNodeType::Text: - Console::WriteLine( " Element Text: {0}", reader2->Value ); - break; - - case XmlNodeType::EndElement: - - // Stop reading when the reader gets to the end element of the book node. - if ( "book" == reader2->LocalName ) - { - Console::WriteLine( "End reading second book..." ); - goto Done; - } - break; - } - } - - -Done: - Console::WriteLine( "Done." ); - reader->Close(); - reader2->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp deleted file mode 100644 index 96ecc78d7af..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - try - { - - //Load the reader with the XML file. - reader = gcnew XmlTextReader( "book1.xml" ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - //Parse the file and display each node. - while ( reader->Read() ) - { - if ( reader->HasValue ) - Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); - else - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp deleted file mode 100644 index a5d564f75ff..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - try - { - - // Load the reader with the XML file. - reader = gcnew XmlTextReader( "book2.xml" ); - - // Parse the file. If they exist, display the prefix and - // namespace URI of each node. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->Prefix == String::Empty ) - Console::WriteLine( "<{0}>", reader->LocalName ); - else - { - Console::Write( "<{0}:{1}>", reader->Prefix, reader->LocalName ); - Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI ); - } - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp deleted file mode 100644 index 21a005822c1..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; - -public ref class Class1 -{ - // -public: - void DisplayAttributes( XmlReader^ reader ) - { - if ( reader->HasAttributes ) - { - Console::WriteLine( "Attributes of <{0}>", reader->Name ); - for ( int i = 0; i < reader->AttributeCount; i++ ) - { - reader->MoveToAttribute( i ); - Console::Write( " {0}={1}", reader->Name, reader->Value ); - - } - reader->MoveToElement(); //Moves the reader back to the element node. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp deleted file mode 100644 index b5a9bd22ca6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - try - { - - //Load the reader with the XML file. - reader = gcnew XmlTextReader( "attrs.xml" ); - - //Read the genre attribute. - reader->MoveToContent(); - reader->MoveToFirstAttribute(); - String^ genre = reader->Value; - Console::WriteLine( "The genre value: {0}", genre ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp deleted file mode 100644 index e6fe1c8a26a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - String^ filename = "items.xml"; - try - { - - // Load the reader with the data file and ignore all white space nodes. - reader = gcnew XmlTextReader( filename ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Parse the file and display each of the nodes. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "<{0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::CDATA: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::ProcessingInstruction: - Console::Write( "", reader->Name, reader->Value ); - break; - - case XmlNodeType::Comment: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::XmlDeclaration: - Console::Write( "" ); - break; - - case XmlNodeType::Document: - break; - - case XmlNodeType::DocumentType: - Console::Write( "Name, reader->Value ); - break; - - case XmlNodeType::EntityReference: - Console::Write( reader->Name ); - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp deleted file mode 100644 index e47fe405c6d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - String^ filename = "binary.xml"; - try - { - reader = gcnew XmlTextReader( filename ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Read the file. Stop at the Base64 element. - while ( reader->Read() ) - { - if ( "Base64" == reader->Name ) - break; - } - - // Read the Base64 data. Write the decoded - // bytes to the console. - Console::WriteLine( "Reading Base64... " ); - int base64len = 0; - array^base64 = gcnew array(1000); - do - { - base64len = reader->ReadBase64( base64, 0, 50 ); - for ( int i = 0; i < base64len; i++ ) - Console::Write( base64[ i ] ); - } - while ( reader->Name->Equals( "Base64" ) ); - - // Read the BinHex data. Write the decoded - // bytes to the console. - Console::WriteLine( "\r\nReading BinHex..." ); - int binhexlen = 0; - array^binhex = gcnew array(1000); - do - { - binhexlen = reader->ReadBinHex( binhex, 0, 50 ); - for ( int i = 0; i < binhexlen; i++ ) - Console::Write( binhex[ i ] ); - } - while ( reader->Name->Equals( "BinHex" ) ); - } - finally - { - Console::WriteLine(); - Console::WriteLine( "Processing of the file {0} complete.", filename ); - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp deleted file mode 100644 index f4197a14142..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; - -// Reads an XML document using ReadChars -int main() -{ - XmlTextReader^ reader = nullptr; - String^ filename = "items.xml"; - try - { - - // Declare variables used by ReadChars - array^buffer; - int iCnt = 0; - int charbuffersize; - - // Load the reader with the data file. Ignore white space. - reader = gcnew XmlTextReader( filename ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Set variables used by ReadChars. - charbuffersize = 10; - buffer = gcnew array(charbuffersize); - - // Parse the file. Read the element content - // using the ReadChars method. - reader->MoveToContent(); - while ( (iCnt = reader->ReadChars( buffer, 0, charbuffersize )) > 0 ) - { - - // Print out chars read and the buffer contents. - Console::WriteLine( " Chars read to buffer:{0}", iCnt ); - Console::WriteLine( " Buffer: [{0}]", gcnew String( buffer,0,iCnt ) ); - - // Clear the buffer. - Array::Clear( buffer, 0, charbuffersize ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp deleted file mode 100644 index f64733ec447..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -void ReadXML( XmlParserContext^ context, String^ xmlFrag, WhitespaceHandling ws ) -{ - - //Create the reader and specify the WhitespaceHandling setting. - XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); - reader->WhitespaceHandling = ws; - - //Parse the XML and display each of the nodes. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::WriteLine( "{0}: <{1}>", reader->NodeType, reader->Name ); - break; - - case XmlNodeType::Text: - Console::WriteLine( "{0}: {1}", reader->NodeType, reader->Value ); - break; - - case XmlNodeType::EndElement: - Console::WriteLine( "{0}: ", reader->NodeType, reader->Name ); - break; - - case XmlNodeType::Whitespace: - Console::WriteLine( "{0}:", reader->NodeType ); - break; - - case XmlNodeType::SignificantWhitespace: - Console::WriteLine( "{0}:", reader->NodeType ); - break; - } - } - - - //Close the reader. - reader->Close(); -} - -int main() -{ - - //Create the XML fragment to be parsed. - String^ xmlFrag = " " - " Pride And Prejudice" - " novel" - ""; - - //Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - - //Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::Default ); - Console::WriteLine( "Read the XML and ignore all white space..." ); - ReadXML( context, xmlFrag, WhitespaceHandling::None ); - Console::WriteLine( "\r\nRead the XML including white space nodes..." ); - ReadXML( context, xmlFrag, WhitespaceHandling::All ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp deleted file mode 100644 index fb1cc689964..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create a writer to write XML to the console. - XmlTextWriter^ writer = nullptr; - writer = gcnew XmlTextWriter( Console::Out ); - - //Use indentation for readability. - writer->Formatting = Formatting::Indented; - writer->Indentation = 4; - - //Write an element (this one is the root). - writer->WriteStartElement( "book" ); - - //Write the title element. - writer->WriteStartElement( "title" ); - writer->WriteString( "Pride And Prejudice" ); - writer->WriteEndElement(); - - //Write the close tag for the root element. - writer->WriteEndElement(); - - //Write the XML to file and close the writer. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp deleted file mode 100644 index f9eaffb0162..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextWriter^ writer = nullptr; - String^ filename = "sampledata.xml"; - writer = gcnew XmlTextWriter( filename, nullptr ); - - //Use indenting for readability. - writer->Formatting = Formatting::Indented; - - //Write the XML delcaration - writer->WriteStartDocument(); - - //Write the ProcessingInstruction node. - String^ PItext = "type=\"text/xsl\" href=\"book.xsl\""; - writer->WriteProcessingInstruction( "xml-stylesheet", PItext ); - - //Write the DocumentType node. - writer->WriteDocType( "book", nullptr, nullptr, "" ); - - //Write a Comment node. - writer->WriteComment( "sample XML" ); - - //Write the root element. - writer->WriteStartElement( "book" ); - - //Write the genre attribute. - writer->WriteAttributeString( "genre", "novel" ); - - //Write the ISBN attribute. - writer->WriteAttributeString( "ISBN", "1-8630-014" ); - - //Write the title. - writer->WriteElementString( "title", "The Handmaid's Tale" ); - - //Write the style element. - writer->WriteStartElement( "style" ); - writer->WriteEntityRef( "h" ); - writer->WriteEndElement(); - - //Write the price. - writer->WriteElementString( "price", "19.95" ); - - //Write CDATA. - writer->WriteCData( "Prices 15% off!!" ); - - //Write the close tag for the root element. - writer->WriteEndElement(); - writer->WriteEndDocument(); - - //Write the XML to file and close the writer. - writer->Flush(); - writer->Close(); - - //Load the file into an XmlDocument to ensure well formed XML. - XmlDocument^ doc = gcnew XmlDocument; - - //Preserve white space for readability. - doc->PreserveWhitespace = true; - - //Load the file. - doc->Load( filename ); - - //Display the XML content to the console. - Console::Write( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp deleted file mode 100644 index 51d524810dc..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create a writer to write XML to the console. - XmlTextWriter^ writer = nullptr; - writer = gcnew XmlTextWriter( Console::Out ); - - //Use indentation for readability. - writer->Formatting = Formatting::Indented; - - //Write an element (this one is the root). - writer->WriteStartElement( "order" ); - - //Write some attributes. - writer->WriteAttributeString( "date", "2/19/01" ); - writer->WriteAttributeString( "orderID", "136A5" ); - - //Write a full end element. Because this element has no - //content, calling WriteEndElement would have written a - //short end tag '/>'. - writer->WriteFullEndElement(); - - //Write the XML to file and close the writer - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp deleted file mode 100644 index 2adeaa8ff54..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextWriter^ writer = nullptr; - String^ filename = "sampledata.xml"; - writer = gcnew XmlTextWriter( filename, nullptr ); - - // Use indenting for readability. - writer->Formatting = Formatting::Indented; - - // Write the root element. - writer->WriteStartElement( "schema" ); - - // Write the namespace declarations. - writer->WriteAttributeString( "xmlns", nullptr, "http://www.w3.org/2001/XMLSchema" ); - writer->WriteAttributeString( "xmlns", "po", nullptr, "http://contoso.com/po" ); - writer->WriteStartElement( "element" ); - writer->WriteAttributeString( "name", "purchaseOrder" ); - - // Write the type attribute. - writer->WriteStartAttribute( nullptr, "type", nullptr ); - writer->WriteQualifiedName( "PurchaseOrder", "http://contoso.com/po" ); - writer->WriteEndAttribute(); - writer->WriteEndElement(); - - // Write the close tag for the root element. - writer->WriteEndElement(); - - // Write the XML to file and close the writer. - writer->Flush(); - writer->Close(); - - // Read the file back in and parse to ensure well formed XML. - XmlDocument^ doc = gcnew XmlDocument; - - // Preserve white space for readability. - doc->PreserveWhitespace = true; - - // Load the file. - doc->Load( filename ); - - // Write the XML content to the console. - Console::Write( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp deleted file mode 100644 index 147d3385162..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create a writer that outputs to the console. - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - - // Write the root element. - writer->WriteStartElement( "Items" ); - - // Write a string using WriteRaw. Note that the special - // characters are not escaped. - writer->WriteStartElement( "Item" ); - writer->WriteString( "Write unescaped text: " ); - writer->WriteRaw( "this & that" ); - writer->WriteEndElement(); - - // Write the same string using WriteString. Note that the - // special characters are escaped. - writer->WriteStartElement( "Item" ); - writer->WriteString( "Write the same string using WriteString: " ); - writer->WriteString( "this & that" ); - writer->WriteEndElement(); - - // Write the close tag for the root element. - writer->WriteEndElement(); - - // Write the XML to file and close the writer. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp deleted file mode 100644 index 7ebefe6b4d0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextWriter^ writer = nullptr; - String^ filename = "sampledata.xml"; - writer = gcnew XmlTextWriter( filename, nullptr ); - - //Use indenting for readability. - writer->Formatting = Formatting::Indented; - - //Write the XML delcaration. - writer->WriteStartDocument(); - - //Write the ProcessingInstruction node. - String^ PItext = "type='text/xsl' href='book.xsl'"; - writer->WriteProcessingInstruction( "xml-stylesheet", PItext ); - - //Write the DocumentType node. - writer->WriteDocType( "book", nullptr, nullptr, "" ); - - //Write a Comment node. - writer->WriteComment( "sample XML" ); - - //Write a root element. - writer->WriteStartElement( "book" ); - - //Write the genre attribute. - writer->WriteAttributeString( "genre", "novel" ); - - //Write the ISBN attribute. - writer->WriteAttributeString( "ISBN", "1-8630-014" ); - - //Write the title. - writer->WriteElementString( "title", "The Handmaid's Tale" ); - - //Write the style element. - writer->WriteStartElement( "style" ); - writer->WriteEntityRef( "h" ); - writer->WriteEndElement(); - - //Write the price. - writer->WriteElementString( "price", "19.95" ); - - //Write CDATA. - writer->WriteCData( "Prices 15% off!!" ); - - //Write the close tag for the root element. - writer->WriteEndElement(); - writer->WriteEndDocument(); - - //Write the XML to file and close the writer. - writer->Flush(); - writer->Close(); - - //Load the file into an XmlDocument to ensure well formed XML. - XmlDocument^ doc = gcnew XmlDocument; - - //Preserve white space for readability. - doc->PreserveWhitespace = true; - - //Load the file. - doc->Load( filename ); - - //Display the XML content to the console. - Console::Write( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp deleted file mode 100644 index d18c68662b6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - String^ filename = "sampledata.xml"; - XmlTextWriter^ writer = gcnew XmlTextWriter( filename, nullptr ); - - //Use indenting for readability. - writer->Formatting = Formatting::Indented; - writer->WriteComment( "sample XML fragment" ); - - //Write an element (this one is the root). - writer->WriteStartElement( "bookstore" ); - - //Write the namespace declaration. - writer->WriteAttributeString( "xmlns", "bk", nullptr, "urn:samples" ); - writer->WriteStartElement( "book" ); - - //Lookup the prefix and then write the ISBN attribute. - String^ prefix = writer->LookupPrefix( "urn:samples" ); - writer->WriteStartAttribute( prefix, "ISBN", "urn:samples" ); - writer->WriteString( "1-861003-78" ); - writer->WriteEndAttribute(); - - //Write the title. - writer->WriteStartElement( "title" ); - writer->WriteString( "The Handmaid's Tale" ); - writer->WriteEndElement(); - - //Write the price. - writer->WriteElementString( "price", "19.95" ); - - //Write the style element. - writer->WriteStartElement( prefix, "style", "urn:samples" ); - writer->WriteString( "hardcover" ); - writer->WriteEndElement(); - - //Write the end tag for the book element. - writer->WriteEndElement(); - - //Write the close tag for the root element. - writer->WriteEndElement(); - - //Write the XML to file and close the writer. - writer->Flush(); - writer->Close(); - - //Read the file back in and parse to ensure well formed XML. - XmlDocument^ doc = gcnew XmlDocument; - - //Preserve white space for readability. - doc->PreserveWhitespace = true; - - //Load the file - doc->Load( filename ); - - //Write the XML content to the console. - Console::Write( doc->InnerXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp deleted file mode 100644 index ef94526fc30..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlTextWriter^ writer = nullptr; - try - { - writer = gcnew XmlTextWriter( Console::Out ); - - // Write an element. - writer->WriteStartElement( "address" ); - - // Write an email address using entities - // for the @ and . characters. - writer->WriteString( "someone" ); - writer->WriteCharEntity( '@' ); - writer->WriteString( "example" ); - writer->WriteCharEntity( '.' ); - writer->WriteString( "com" ); - writer->WriteEndElement(); - } - finally - { - - // Close the writer. - if ( writer != nullptr ) - writer->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp deleted file mode 100644 index e5fd8acae1e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the writer. - XmlTextWriter^ writer = nullptr; - writer = gcnew XmlTextWriter( "ws.html", nullptr ); - - // Write an element (this one is the root). - writer->WriteStartElement( "p" ); - - // Write the xml:space attribute. - writer->WriteAttributeString( "xml", "space", nullptr, "preserve" ); - - // Verify that xml:space is set properly. - if ( writer->XmlSpace == XmlSpace::Preserve ) - Console::WriteLine( "xmlspace is correct!" ); - - - // Write out the HTML elements. Insert white space - // between 'something' and 'Big' - writer->WriteString( "something" ); - writer->WriteWhitespace( " " ); - writer->WriteElementString( "b", "B" ); - writer->WriteString( "ig" ); - - // Write the root end element. - writer->WriteEndElement(); - - // Write the XML to file and close the writer. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp deleted file mode 100644 index be6e39b350c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - Uri^ baseUri = gcnew Uri( "http://servername/tmp/test.xsl" ); - Uri^ fulluri = resolver->ResolveUri( baseUri, "includefile.xsl" ); - - // Get a stream object containing the XSL file - Stream^ s = dynamic_cast(resolver->GetEntity( fulluri, nullptr, Stream::typeid )); - - // Read the stream object displaying the contents of the XSL file - XmlTextReader^ reader = gcnew XmlTextReader( s ); - while ( reader->Read() ) - { - Console::WriteLine( reader->ReadOuterXml() ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp deleted file mode 100644 index ff06ae7ba94..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - try - { - - //Create the string to parse. - String^ xmlFrag = " "; - - //Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - - //Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); - - //Create the XmlValidatingReader . - reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); - - //Read the attributes on the root element. - reader->MoveToContent(); - if ( reader->HasAttributes ) - { - for ( int i = 0; i < reader->AttributeCount; i++ ) - { - reader->MoveToAttribute( i ); - Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); - - } - reader->MoveToElement(); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp deleted file mode 100644 index a62f1c24651..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - XmlTextReader^ txtreader = nullptr; - try - { - - //Create the validating reader. - txtreader = gcnew XmlTextReader( "http://localhost/uri.xml" ); - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - - //Parse the file and display the base URI for each node. - while ( reader->Read() ) - { - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp deleted file mode 100644 index 05e5e364a1d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the validating reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "attrs.xml" ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - - //Read the ISBN attribute. - reader->MoveToContent(); - String^ isbn = reader->GetAttribute( "ISBN" ); - Console::WriteLine( "The ISBN value: {0}", isbn ); - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp deleted file mode 100644 index 2ce1e6eba01..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the validating reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "book1.xml" ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - - //Parse the file and each node and its value. - while ( reader->Read() ) - { - if ( reader->HasValue ) - Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); - else - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); - } - - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp deleted file mode 100644 index bd57e805816..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ txtreader = nullptr; - XmlValidatingReader^ reader = nullptr; - try - { - - //Implement the readers. - txtreader = gcnew XmlTextReader( "elems.xml" ); - reader = gcnew XmlValidatingReader( txtreader ); - - //Parse the XML and display the text content of each of the elements. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->IsEmptyElement ) - Console::WriteLine( "<{0}/>", reader->Name ); - else - { - Console::Write( "<{0}> ", reader->Name ); - reader->Read(); //Read the start tag. - if ( reader->IsStartElement() ) - - //Handle nested elements. - Console::Write( "\r\n<{0}>", reader->Name ); - Console::WriteLine( reader->ReadString() ); //Read the text content of the element. - } - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp deleted file mode 100644 index 3ce23489cc5..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - try - { - - //Create the XML fragment to be parsed. - String^ xmlFrag = ""; - - //Create the XmlParserContext. - XmlParserContext^ context; - String^ subset = ""; - context = gcnew XmlParserContext( nullptr,nullptr,"book",nullptr,nullptr,subset,"","",XmlSpace::None ); - - //Create the reader and set it to not expand general entities. - reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); - reader->ValidationType = ValidationType::None; - reader->EntityHandling = EntityHandling::ExpandCharEntities; - - //Read the misc attribute. Because EntityHandling is set to - //ExpandCharEntities, the attribute is parsed into multiple text - //and entity reference nodes. - reader->MoveToContent(); - reader->MoveToAttribute( "misc" ); - while ( reader->ReadAttributeValue() ) - { - if ( reader->NodeType == XmlNodeType::EntityReference ) - - //To expand the entity, call ResolveEntity. - Console::WriteLine( "{0} {1}", reader->NodeType, reader->Name ); - else - Console::WriteLine( "{0} {1}", reader->NodeType, reader->Value ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp deleted file mode 100644 index cdcfa93664a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the validating reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "attrs.xml" ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - - //Read the genre attribute. - reader->MoveToContent(); - reader->MoveToFirstAttribute(); - String^ genre = reader->Value; - Console::WriteLine( "The genre value: {0}", genre ); - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp deleted file mode 100644 index 805e896e1d7..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp +++ /dev/null @@ -1,79 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ txtreader = nullptr; - XmlValidatingReader^ reader = nullptr; - String^ filename = "items.xml"; - try - { - - //Load the reader with the data file and ignore all white space nodes. - txtreader = gcnew XmlTextReader( filename ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - - //Implement the validating reader over the text reader. - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - - //Parse the file and display each of the nodes. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "<{0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::CDATA: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::ProcessingInstruction: - Console::Write( "", reader->Name, reader->Value ); - break; - - case XmlNodeType::Comment: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::XmlDeclaration: - Console::Write( "" ); - break; - - case XmlNodeType::Document: - break; - - case XmlNodeType::DocumentType: - Console::Write( "Name, reader->Value ); - break; - - case XmlNodeType::EntityReference: - Console::Write( reader->Name ); - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp deleted file mode 100644 index 233a1ec1a99..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - XmlTextReader^ txtreader = nullptr; - try - { - - //Create and load the XmlTextReader with the XML file. - txtreader = gcnew XmlTextReader( "book1.xml" ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - - //Create the XmlValidatingReader over the XmlTextReader. - //Set the reader to not expand general entities. - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - reader->EntityHandling = EntityHandling::ExpandCharEntities; - reader->MoveToContent(); //Move to the root element. - reader->Read(); //Move to title start tag. - reader->Skip(); //Skip the title element. - - //Read the misc start tag. The reader is now positioned on - //the entity reference node. - reader->ReadStartElement(); - - //Because EntityHandling is set to ExpandCharEntities, you must call - //ResolveEntity to expand the entity. The entity replacement text is - //then parsed and returned as a child node. - Console::WriteLine( "Expand the entity..." ); - reader->ResolveEntity(); - Console::WriteLine( "The entity replacement text is returned as a text node." ); - reader->Read(); - Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value ); - Console::WriteLine( "An EndEntity node closes the entity reference scope." ); - reader->Read(); - Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp deleted file mode 100644 index 211a6e4604b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class SchemaCollectionSample -{ -private: - XmlTextReader^ reader; - XmlValidatingReader^ vreader; - Boolean m_success; - -public: - SchemaCollectionSample() - { - reader = nullptr; - vreader = nullptr; - m_success = true; - - //Load the schema collection. - XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection; - String^ schema = "books.xsd"; - String^ schema1 = "schema1.xdr"; - xsc->Add( "urn:bookstore-schema", schema ); //XSD schema - xsc->Add( "urn:newbooks-schema", schema1 ); //XDR schema - String^ doc1 = "booksSchema.xml"; - String^ doc2 = "booksSchemaFail.xml"; - String^ doc3 = "newbooks.xml"; - - //Validate the files using schemas stored in the collection. - Validate( doc1, xsc ); //Should pass. - Validate( doc2, xsc ); //Should fail. - Validate( doc3, xsc ); //Should fail. - } - - -private: - void Validate( String^ filename, XmlSchemaCollection^ xsc ) - { - m_success = true; - Console::WriteLine(); - Console::WriteLine( "Validating XML file {0}...", filename ); - reader = gcnew XmlTextReader( filename ); - - //Create a validating reader. - vreader = gcnew XmlValidatingReader( reader ); - - //Validate using the schemas stored in the schema collection. - vreader->Schemas->Add( xsc ); - - //Set the validation event handler - vreader->ValidationEventHandler += gcnew ValidationEventHandler( this, &SchemaCollectionSample::ValidationCallBack ); - - //Read and validate the XML data. - while ( vreader->Read() ) - {} - - Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful" : "failed") ); - Console::WriteLine(); - - //Close the reader. - vreader->Close(); - } - - void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::Write( "\r\n\tValidation error: {0}", args->Message ); - } - -}; - -int main() -{ - gcnew SchemaCollectionSample; -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp deleted file mode 100644 index bb70d44f9ea..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -public ref class Sample -{ -private: - XmlTextReader^ txtreader; - XmlValidatingReader^ reader; - Boolean m_success; - -public: - Sample() - { - txtreader = nullptr; - reader = nullptr; - m_success = true; - - //Validate file against the XSD schema. - //The validation should fail. - Validate( "notValidXSD.xml" ); - } - - -private: - void Validate( String^ filename ) - { - try - { - Console::WriteLine( "Validating XML file {0}", filename ); - txtreader = gcnew XmlTextReader( filename ); - reader = gcnew XmlValidatingReader( txtreader ); - - // Set the validation event handler - reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationEventHandle ); - - // Read XML data - while ( reader->Read() ) - {} - Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful" : "failed") ); - } - finally - { - - //Close the reader. - if ( reader != nullptr ) - reader->Close(); - } - - } - - - //Display the validation error. - void ValidationEventHandle( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::WriteLine( "\r\n\tValidation error: {0}", args->Message ); - } - -}; - -int main() -{ - gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp deleted file mode 100644 index a803c48b3ad..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -public ref class Sample -{ -private: - XmlTextReader^ txtreader; - XmlValidatingReader^ reader; - Boolean m_success; - -public: - Sample() - { - txtreader = nullptr; - reader = nullptr; - m_success = true; - String^ doc1 = "notValid.xml"; - String^ doc2 = "cdDTD.xml"; - String^ doc3 = "book1.xml"; - - //Parse the files and validate when requested. - Validate( doc1, ValidationType::XDR ); //Validation should fail. - Validate( doc2, ValidationType::DTD ); //Validation should fail. - Validate( doc3, ValidationType::None ); //No validation performed. - } - - -private: - void Validate( String^ filename, ValidationType vt ) - { - try - { - - //Implement the readers. Set the ValidationType. - txtreader = gcnew XmlTextReader( filename ); - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = vt; - - //If the reader is set to validate, set the event handler. - if ( vt == ValidationType::None ) - Console::WriteLine( "\nParsing XML file {0}", filename ); - else - { - Console::WriteLine( "\nValidating XML file {0}", filename ); - m_success = true; - - //Set the validation event handler. - reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationCallBack ); - } - - // Read XML data - while ( reader->Read() ) - {} - if ( vt == ValidationType::None ) - Console::WriteLine( "Finished parsing file." ); - else - Console::WriteLine( "Validation finished. Validation {0}", m_success ? (String^)"successful" : "failed" ); - } - finally - { - - //Close the reader. - if ( reader != nullptr ) - reader->Close(); - } - - } - - - //Display the validation errors. - void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::Write( "\r\n\tValidation error: {0}", args->Message ); - } - -}; - -int main() -{ - gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp deleted file mode 100644 index 15790751077..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp +++ /dev/null @@ -1,117 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -public ref class Sample -{ -private: - XmlNode^ currNode; - XmlTextReader^ reader; - -public: - Sample() - { - String^ filename = "space.xml"; - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" - "Eva" - "Corets" - "" ); - Console::WriteLine( "InnerText before..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Add white space. - currNode = doc->DocumentElement; - XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" ); - currNode->InsertAfter( ws, currNode->FirstChild ); - Console::WriteLine(); - Console::WriteLine( "InnerText after..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Save and then display the file. - doc->Save( filename ); - Console::WriteLine(); - Console::WriteLine( "Reading file..." ); - ReadFile( filename ); - } - - - // Parse the file and display each node. - void ReadFile( String^ filename ) - { - try - { - reader = gcnew XmlTextReader( filename ); - String^ sNodeType = nullptr; - while ( reader->Read() ) - { - sNodeType = NodeTypeToString( reader->NodeType ); - - // Print the node type, name, and value. - Console::WriteLine( "{0}<{1}> {2}", sNodeType, reader->Name, reader->Value ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - - } - - static String^ NodeTypeToString( XmlNodeType nodetype ) - { - String^ sNodeType = nullptr; - switch ( nodetype ) - { - case XmlNodeType::None: - sNodeType = "None"; - break; - - case XmlNodeType::Element: - sNodeType = "Element"; - break; - - case XmlNodeType::Attribute: - sNodeType = "Attribute"; - break; - - case XmlNodeType::Text: - sNodeType = "Text"; - break; - - case XmlNodeType::Comment: - sNodeType = "Comment"; - break; - - case XmlNodeType::Document: - sNodeType = "Document"; - break; - - case XmlNodeType::Whitespace: - sNodeType = "Whitespace"; - break; - - case XmlNodeType::SignificantWhitespace: - sNodeType = "SignificantWhitespace"; - break; - - case XmlNodeType::EndElement: - sNodeType = "EndElement"; - break; - } - return sNodeType; - } - -}; - -int main() -{ - gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp deleted file mode 100644 index fed23d6f782..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; - -int main() -{ - String^ filename = "books.xml"; - String^ stylesheet = "output.xsl"; - - //Load the stylesheet. - XslTransform^ xslt = gcnew XslTransform; - xslt->Load( stylesheet ); - - //Load the file to transform. - XPathDocument^ doc = gcnew XPathDocument( filename ); - - //Create an XmlTextWriter which outputs to the console. - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - - //Transform the file and send the output to the console. - xslt->Transform(doc,nullptr,writer,nullptr); - writer->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp deleted file mode 100644 index 3c119776397..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - schema->Items->Add(element); - element->Name = "stringElementWithAnyAttribute"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - element->SchemaType = complexType; - - // - XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent(); - complexType->ContentModel = simpleContent; - - // - XmlSchemaSimpleContentExtension^ extension = gcnew XmlSchemaSimpleContentExtension(); - simpleContent->Content = extension; - extension->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaAnyAttribute^ anyAttribute = gcnew XmlSchemaAnyAttribute(); - extension->AnyAttribute = anyAttribute; - anyAttribute->Namespace = "##targetNamespace"; - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp deleted file mode 100644 index 92d06d54db3..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlTextReader^ xtr = gcnew XmlTextReader("example.xsd"); - XmlSchema^ schema = XmlSchema::Read(xtr, gcnew ValidationEventHandler(ValidationCallbackOne)); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - for each (XmlSchemaObject^ schemaObject in compiledSchema->Items) - { - if (schemaObject->GetType() == XmlSchemaSimpleType::typeid) - { - XmlSchemaSimpleType^ simpleType = dynamic_cast(schemaObject); - Console::WriteLine("{0} {1}", simpleType->Name, simpleType->Datatype->ValueType); - } - if (schemaObject->GetType() == XmlSchemaComplexType::typeid) - { - XmlSchemaComplexType^ complexType = dynamic_cast(schemaObject); - Console::WriteLine("{0} {1}", complexType->Name, complexType->Datatype->ValueType); - } - } - xtr->Close(); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp deleted file mode 100644 index 78ca73c17ae..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType(); - simpleType->Name = "northwestStates"; - schema->Items->Add(simpleType); - - // - XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation(); - simpleType->Annotation = annNorthwestStates; - - // States in the Pacific Northwest of US - XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation(); - annNorthwestStates->Items->Add(docNorthwestStates); - docNorthwestStates->Markup = TextToNodeArray("States in the Pacific Northwest of US"); - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - simpleType->Content = restriction; - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaEnumerationFacet^ enumerationWA = gcnew XmlSchemaEnumerationFacet(); - restriction->Facets->Add(enumerationWA); - enumerationWA->Value = "WA"; - - // - XmlSchemaAnnotation^ annWA = gcnew XmlSchemaAnnotation(); - enumerationWA->Annotation = annWA; - - // Washington - XmlSchemaDocumentation^ docWA = gcnew XmlSchemaDocumentation(); - annWA->Items->Add(docWA); - docWA->Markup = TextToNodeArray("Washington"); - - // - XmlSchemaEnumerationFacet^ enumerationOR = gcnew XmlSchemaEnumerationFacet(); - restriction->Facets->Add(enumerationOR); - enumerationOR->Value = "OR"; - - // - XmlSchemaAnnotation^ annOR = gcnew XmlSchemaAnnotation(); - enumerationOR->Annotation = annOR; - - // Oregon - XmlSchemaDocumentation^ docOR = gcnew XmlSchemaDocumentation(); - annOR->Items->Add(docOR); - docOR->Markup = TextToNodeArray("Oregon"); - - // - XmlSchemaEnumerationFacet^ enumerationID = gcnew XmlSchemaEnumerationFacet(); - restriction->Facets->Add(enumerationID); - enumerationID->Value = "ID"; - - // - XmlSchemaAnnotation^ annID = gcnew XmlSchemaAnnotation(); - enumerationID->Annotation = annID; - - // Idaho - XmlSchemaDocumentation^ docID = gcnew XmlSchemaDocumentation(); - annID->Items->Add(docID); - docID->Markup = TextToNodeArray("Idaho"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - - static array^ TextToNodeArray(String^ text) - { - XmlDocument^ doc = gcnew XmlDocument(); - array^ nodes = gcnew array {doc->CreateTextNode(text)}; - return nodes; - } - -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp deleted file mode 100644 index cb71c94ba29..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaElement^ elementCat = gcnew XmlSchemaElement(); - schema->Items->Add(elementCat); - elementCat->Name = "cat"; - elementCat->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementDog = gcnew XmlSchemaElement(); - schema->Items->Add(elementDog); - elementDog->Name = "dog"; - elementDog->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaElement^ elementRedDog = gcnew XmlSchemaElement(); - schema->Items->Add(elementRedDog); - elementRedDog->Name = "redDog"; - elementRedDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); - - // - XmlSchemaElement^ elementBrownDog = gcnew XmlSchemaElement(); - schema->Items->Add(elementBrownDog); - elementBrownDog->Name = "brownDog"; - elementBrownDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); - - // - XmlSchemaElement^ elementPets = gcnew XmlSchemaElement(); - schema->Items->Add(elementPets); - elementPets->Name = "pets"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - elementPets->SchemaType = complexType; - - // - XmlSchemaChoice^ choice = gcnew XmlSchemaChoice(); - complexType->Particle = choice; - choice->MinOccurs = 0; - choice->MaxOccursString = "unbounded"; - - // - XmlSchemaElement^ catRef = gcnew XmlSchemaElement(); - choice->Items->Add(catRef); - catRef->RefName = gcnew XmlQualifiedName("cat"); - - // - XmlSchemaElement^ dogRef = gcnew XmlSchemaElement(); - choice->Items->Add(dogRef); - dogRef->RefName = gcnew XmlQualifiedName("dog"); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp deleted file mode 100644 index acf2f9e018f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -class XmlSchemaExamples -{ -public: - - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ RatingType = gcnew XmlSchemaSimpleType(); - RatingType->Name = "RatingType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaTotalDigitsFacet^ totalDigits = gcnew XmlSchemaTotalDigitsFacet(); - totalDigits->Value = "2"; - restriction->Facets->Add(totalDigits); - - // - XmlSchemaFractionDigitsFacet^ fractionDigits = gcnew XmlSchemaFractionDigitsFacet(); - fractionDigits->Value = "1"; - restriction->Facets->Add(fractionDigits); - - RatingType->Content = restriction; - - schema->Items->Add(RatingType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "movie"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ ratingAttribute = gcnew XmlSchemaAttribute(); - ratingAttribute->Name = "rating"; - ratingAttribute->SchemaTypeName = gcnew XmlQualifiedName("RatingType", ""); - complexType->Attributes->Add(ratingAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } -}; - -int main() -{ - XmlSchemaExamples::Main(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp deleted file mode 100644 index 777c38d292a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class ImportIncludeSample -{ -private: - static void ValidationCallBack(Object^ sender, ValidationEventArgs^ args) - { - - if (args->Severity == XmlSeverityType::Warning) - Console::Write("WARNING: "); - else if (args->Severity == XmlSeverityType::Error) - Console::Write("ERROR: "); - - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - schema->ElementFormDefault = XmlSchemaForm::Qualified; - schema->TargetNamespace = "http://www.w3.org/2001/05/XMLInfoset"; - - // - XmlSchemaImport^ import = gcnew XmlSchemaImport(); - import->Namespace = "http://www.example.com/IPO"; - schema->Includes->Add(import); - - // - XmlSchemaInclude^ include = gcnew XmlSchemaInclude(); - include->SchemaLocation = "example.xsd"; - schema->Includes->Add(include); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } - -}; - -int main() -{ - ImportIncludeSample::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp deleted file mode 100644 index 89d0bf0c37b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Xml::Schema; -public ref class XmlSchemaObjectGenerator -{ -private: - static void ValidationCallback( Object^ /*sender*/, ValidationEventArgs^ args ) - { - if ( args->Severity == XmlSeverityType::Warning ) - Console::Write( "WARNING: " ); - else - if ( args->Severity == XmlSeverityType::Error ) - Console::Write( "ERROR: " ); - - Console::WriteLine( args->Message ); - } - - // XmlSchemaObjectGenerator - int main() - { - XmlTextReader^ tr = gcnew XmlTextReader( "empty.xsd" ); - XmlSchema^ schema = XmlSchema::Read( tr, gcnew ValidationEventHandler( XmlSchemaObjectGenerator::ValidationCallback ) ); - schema->ElementFormDefault = XmlSchemaForm::Qualified; - schema->TargetNamespace = "http://www.example.com/Report"; - { - XmlSchemaElement^ element = gcnew XmlSchemaElement; - element->Name = "purchaseReport"; - XmlSchemaComplexType^ element_complexType = gcnew XmlSchemaComplexType; - XmlSchemaSequence^ element_complexType_sequence = gcnew XmlSchemaSequence; - { - XmlSchemaElement^ element_complexType_sequence_element = gcnew XmlSchemaElement; - element_complexType_sequence_element->Name = "region"; - element_complexType_sequence_element->SchemaTypeName = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); - { - XmlSchemaKeyref^ element_complexType_sequence_element_keyref = gcnew XmlSchemaKeyref; - element_complexType_sequence_element_keyref->Name = "dummy2"; - element_complexType_sequence_element_keyref->Selector = gcnew XmlSchemaXPath; - element_complexType_sequence_element_keyref->Selector->XPath = "r:zip/r:part"; - { - XmlSchemaXPath^ field = gcnew XmlSchemaXPath; - field->XPath = "@number"; - element_complexType_sequence_element_keyref->Fields->Add( field ); - } - element_complexType_sequence_element_keyref->Refer = gcnew XmlQualifiedName( "pNumKey","http://www.example.com/Report" ); - element_complexType_sequence_element->Constraints->Add( element_complexType_sequence_element_keyref ); - } - element_complexType_sequence->Items->Add( element_complexType_sequence_element ); - } - element_complexType->Particle = element_complexType_sequence; - { - XmlSchemaAttribute^ element_complexType_attribute = gcnew XmlSchemaAttribute; - element_complexType_attribute->Name = "periodEnding"; - element_complexType_attribute->SchemaTypeName = gcnew XmlQualifiedName( "date","http://www.w3.org/2001/XMLSchema" ); - element_complexType->Attributes->Add( element_complexType_attribute ); - } - element->SchemaType = element_complexType; - { - XmlSchemaKey^ element_key = gcnew XmlSchemaKey; - element_key->Name = "pNumKey"; - element_key->Selector = gcnew XmlSchemaXPath; - element_key->Selector->XPath = "r:parts/r:part"; - { - XmlSchemaXPath^ field = gcnew XmlSchemaXPath; - field->XPath = "@number"; - element_key->Fields->Add( field ); - } - element->Constraints->Add( element_key ); - } - schema->Items->Add( element ); - } - schema->Write( Console::Out ); - - return 0; - } // main -}; -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp deleted file mode 100644 index 47765242264..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); - ZipCodeType->Name = "ZipCodeType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaLengthFacet^ length = gcnew XmlSchemaLengthFacet(); - length->Value = "5"; - restriction->Facets->Add(length); - - ZipCodeType->Content = restriction; - - schema->Items->Add(ZipCodeType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "Address"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); - ZipCodeAttribute->Name = "ZipCode"; - ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); - complexType->Attributes->Add(ZipCodeAttribute); - - element->SchemaType = complexType; - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp deleted file mode 100644 index a66dd7e2553..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ WaitQueueLengthType = gcnew XmlSchemaSimpleType(); - WaitQueueLengthType->Name = "WaitQueueLengthType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMaxExclusiveFacet^ maxExclusive = gcnew XmlSchemaMaxExclusiveFacet(); - maxExclusive->Value = "5"; - restriction->Facets->Add(maxExclusive); - - WaitQueueLengthType->Content = restriction; - - schema->Items->Add(WaitQueueLengthType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "Lobby"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ WaitQueueLengthAttribute = gcnew XmlSchemaAttribute(); - WaitQueueLengthAttribute->Name = "WaitQueueLength"; - WaitQueueLengthAttribute->SchemaTypeName = gcnew XmlQualifiedName("WaitQueueLengthType", ""); - complexType->Attributes->Add(WaitQueueLengthAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp deleted file mode 100644 index f27f5519922..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ WaitQueueLengthType = gcnew XmlSchemaSimpleType(); - WaitQueueLengthType->Name = "WaitQueueLengthType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet(); - maxInclusive->Value = "5"; - restriction->Facets->Add(maxInclusive); - - WaitQueueLengthType->Content = restriction; - - schema->Items->Add(WaitQueueLengthType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "Lobby"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ WaitQueueLengthAttribute = gcnew XmlSchemaAttribute(); - WaitQueueLengthAttribute->Name = "WaitQueueLength"; - WaitQueueLengthAttribute->SchemaTypeName = gcnew XmlQualifiedName("WaitQueueLengthType", ""); - complexType->Attributes->Add(WaitQueueLengthAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp deleted file mode 100644 index b50d96ac18d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); - ZipCodeType->Name = "ZipCodeType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMaxLengthFacet^ maxLength = gcnew XmlSchemaMaxLengthFacet(); - maxLength->Value = "10"; - restriction->Facets->Add(maxLength); - - ZipCodeType->Content = restriction; - - schema->Items->Add(ZipCodeType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "Address"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); - ZipCodeAttribute->Name = "ZipCode"; - ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); - - complexType->Attributes->Add(ZipCodeAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp deleted file mode 100644 index 34816fb1131..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ OrderQuantityType = gcnew XmlSchemaSimpleType(); - OrderQuantityType->Name = "OrderQuantityType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMinExclusiveFacet^ MinExclusive = gcnew XmlSchemaMinExclusiveFacet(); - MinExclusive->Value = "5"; - restriction->Facets->Add(MinExclusive); - - OrderQuantityType->Content = restriction; - - schema->Items->Add(OrderQuantityType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "item"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ OrderQuantityAttribute = gcnew XmlSchemaAttribute(); - OrderQuantityAttribute->Name = "OrderQuantity"; - OrderQuantityAttribute->SchemaTypeName = gcnew XmlQualifiedName("OrderQuantityType", ""); - complexType->Attributes->Add(OrderQuantityAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp deleted file mode 100644 index 8b460bf9a13..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ OrderQuantityType = gcnew XmlSchemaSimpleType(); - OrderQuantityType->Name = "OrderQuantityType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMinInclusiveFacet^ minInclusive = gcnew XmlSchemaMinInclusiveFacet(); - minInclusive->Value = "5"; - restriction->Facets->Add(minInclusive); - - OrderQuantityType->Content = restriction; - - schema->Items->Add(OrderQuantityType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "item"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ OrderQuantityAttribute = gcnew XmlSchemaAttribute(); - OrderQuantityAttribute->Name = "OrderQuantity"; - OrderQuantityAttribute->SchemaTypeName = gcnew XmlQualifiedName("OrderQuantityType", ""); - complexType->Attributes->Add(OrderQuantityAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp deleted file mode 100644 index 7bc0e93f86c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); - ZipCodeType->Name = "ZipCodeType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaMinLengthFacet^ minLength = gcnew XmlSchemaMinLengthFacet(); - minLength->Value = "5"; - restriction->Facets->Add(minLength); - - ZipCodeType->Content = restriction; - - schema->Items->Add(ZipCodeType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "Address"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); - ZipCodeAttribute->Name = "ZipCode"; - ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); - complexType->Attributes->Add(ZipCodeAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp deleted file mode 100644 index c21f9400afa..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); - ZipCodeType->Name = "ZipCodeType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaPatternFacet^ pattern = gcnew XmlSchemaPatternFacet(); - pattern->Value = "[0-9]{5}(-[0-9]{4})?"; - restriction->Facets->Add(pattern); - - ZipCodeType->Content = restriction; - - schema->Items->Add(ZipCodeType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "Address"; - - // - XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); - ZipCodeAttribute->Name = "ZipCode"; - ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); - complexType->Attributes->Add(ZipCodeAttribute); - - element->SchemaType = complexType; - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp deleted file mode 100644 index 2f67440b88f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ StringOrIntType = gcnew XmlSchemaSimpleType(); - StringOrIntType->Name = "StringOrIntType"; - schema->Items->Add(StringOrIntType); - - // - XmlSchemaSimpleTypeUnion^ union1 = gcnew XmlSchemaSimpleTypeUnion(); - StringOrIntType->Content = union1; - - // - XmlSchemaSimpleType^ simpleType1 = gcnew XmlSchemaSimpleType(); - union1->BaseTypes->Add(simpleType1); - - // - XmlSchemaSimpleTypeRestriction^ restriction1 = gcnew XmlSchemaSimpleTypeRestriction(); - restriction1->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - simpleType1->Content = restriction1; - - // - XmlSchemaSimpleType^ simpleType2 = gcnew XmlSchemaSimpleType(); - union1->BaseTypes->Add(simpleType2); - - // - XmlSchemaSimpleTypeRestriction^ restriction2 = gcnew XmlSchemaSimpleTypeRestriction(); - restriction2->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); - simpleType2->Content = restriction2; - - - // - XmlSchemaElement^ elementSize = gcnew XmlSchemaElement(); - elementSize->Name = "size"; - elementSize->SchemaTypeName = gcnew XmlQualifiedName("StringOrIntType"); - schema->Items->Add(elementSize); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp deleted file mode 100644 index 27611f0c5e7..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaComplexType^ customerOrderType = gcnew XmlSchemaComplexType(); - customerOrderType->Name = "customerOrderType"; - - // - XmlSchemaSequence^ sequence1 = gcnew XmlSchemaSequence(); - - // - XmlSchemaElement^ item = gcnew XmlSchemaElement(); - item->MinOccurs = 0; - item->MaxOccursString = "unbounded"; - item->Name = "item"; - - // - XmlSchemaComplexType^ ct1 = gcnew XmlSchemaComplexType(); - - // - XmlSchemaAttribute^ itemID = gcnew XmlSchemaAttribute(); - itemID->Name = "itemID"; - itemID->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - ct1->Attributes->Add(itemID); - - // - item->SchemaType = ct1; - - // - sequence1->Items->Add(item); - customerOrderType->Particle = sequence1; - - // - XmlSchemaAttribute^ CustomerID = gcnew XmlSchemaAttribute(); - CustomerID->Name = "CustomerID"; - CustomerID->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - customerOrderType->Attributes->Add(CustomerID); - - // - schema->Items->Add(customerOrderType); - - // - XmlSchemaElement^ ordersByCustomer = gcnew XmlSchemaElement(); - ordersByCustomer->Name = "ordersByCustomer"; - - // - XmlSchemaComplexType^ ct2 = gcnew XmlSchemaComplexType(); - - // - XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence(); - - // - XmlSchemaElement^ customerOrders = gcnew XmlSchemaElement(); - customerOrders->MinOccurs = 0; - customerOrders->MaxOccursString = "unbounded"; - customerOrders->Name = "customerOrders"; - customerOrders->SchemaTypeName = gcnew XmlQualifiedName("customerOrderType", ""); - - // - sequence2->Items->Add(customerOrders); - - // - ct2->Particle = sequence2; - ordersByCustomer->SchemaType = ct2; - - // - XmlSchemaUnique^ element_unique = gcnew XmlSchemaUnique(); - element_unique->Name = "oneCustomerOrdersforEachCustomerID"; - - // - element_unique->Selector = gcnew XmlSchemaXPath(); - element_unique->Selector->XPath = "customerOrders"; - - // - XmlSchemaXPath^ field = gcnew XmlSchemaXPath(); - field->XPath = "@customerID"; - - // - element_unique->Fields->Add(field); - ordersByCustomer->Constraints->Add(element_unique); - - // - schema->Items->Add(ordersByCustomer); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp deleted file mode 100644 index 82b40e0837b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XMLSchemaExamples -{ -private: - static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - XmlSchema^ schema = gcnew XmlSchema(); - - // - XmlSchemaSimpleType^ NameType = gcnew XmlSchemaSimpleType(); - NameType->Name = "NameType"; - - // - XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); - restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); - - // - XmlSchemaWhiteSpaceFacet^ whiteSpace = gcnew XmlSchemaWhiteSpaceFacet(); - whiteSpace->Value = "collapse"; - restriction->Facets->Add(whiteSpace); - - NameType->Content = restriction; - - schema->Items->Add(NameType); - - // - XmlSchemaElement^ element = gcnew XmlSchemaElement(); - element->Name = "LastName"; - element->SchemaTypeName = gcnew XmlQualifiedName("NameType", ""); - - schema->Items->Add(element); - - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); - schemaSet->Add(schema); - schemaSet->Compile(); - - XmlSchema^ compiledSchema = nullptr; - - for each (XmlSchema^ schema1 in schemaSet->Schemas()) - { - compiledSchema = schema1; - } - - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); - nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); - compiledSchema->Write(Console::Out, nsmgr); - } -}; - -int main() -{ - XMLSchemaExamples::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp b/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp deleted file mode 100644 index 31d19ed131b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::XPath; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - - // Create an XPathNavigator and select all books by Plato. - XPathNavigator^ nav = doc->CreateNavigator(); - XPathNodeIterator^ ni = nav->Select("descendant::book[author/name='Plato']"); - ni->MoveNext(); - - // Get the first matching node and change the book price. - XmlNode^ book = dynamic_cast(ni->Current)->GetNode(); - book->LastChild->InnerText = "12.95"; - Console::WriteLine( book->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp b/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp deleted file mode 100644 index 8bc4192df74..00000000000 --- a/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XML fragment to be parsed. - String^ xmlFrag = "\n" - "\n" - "\n" - "240\n" - "\n" - "\n"; - - // Create the XmlNamespaceManager. - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( gcnew NameTable ); - - // Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); - - // Create the reader. - XmlValidatingReader^ reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); - IXmlLineInfo^ lineInfo = (dynamic_cast(reader)); - if ( lineInfo->HasLineInfo() ) - { - - // Parse the XML and display each node. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition ); - Console::WriteLine( "< {0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition ); - Console::WriteLine( " {0}", reader->Value ); - break; - - case XmlNodeType::EndElement: - Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition ); - Console::WriteLine( "", reader->Name ); - break; - } - } - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp b/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp deleted file mode 100644 index 27ae8903478..00000000000 --- a/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - - // - NameTable^ nt = gcnew NameTable; - Object^ book = nt->Add( "book" ); - Object^ price = nt->Add( "price" ); - - // Create the reader. - XmlReaderSettings ^ settings = gcnew XmlReaderSettings; - settings->NameTable = nt; - XmlReader^ reader = XmlReader::Create( (String^)"books.xml", settings ); - reader->MoveToContent(); - reader->ReadToDescendant( "book" ); - if ( System::Object::ReferenceEquals( book, reader->Name ) ) - { - - // Do additional processing. - } - // - //Close the reader. - reader->Close(); -} - diff --git a/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp b/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp deleted file mode 100644 index 711f1bfbba1..00000000000 --- a/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class Sample -{ -private: - static void Validate(String^ filename, XmlSchemaSet^ schemaSet) - { - Console::WriteLine(); - Console::WriteLine("\r\nValidating XML file {0}...", filename->ToString()); - - XmlSchema^ compiledSchema; - - for each (XmlSchema^ schema in schemaSet->Schemas()) - { - compiledSchema = schema; - } - - XmlReaderSettings^ settings = gcnew XmlReaderSettings(); - settings->Schemas->Add(compiledSchema); - settings->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack); - settings->ValidationType = ValidationType::Schema; - - //Create the schema validating reader. - XmlReader^ vreader = XmlReader::Create(filename, settings); - - while (vreader->Read()) { } - - //Close the reader. - vreader->Close(); - } - - //Display any warnings or errors. - static void ValidationCallBack(Object^ sender, ValidationEventArgs^ args) - { - if (args->Severity == XmlSeverityType::Warning) - Console::WriteLine("\tWarning: Matching schema not found. No validation occurred." + args->Message); - else - Console::WriteLine("\tValidation error: " + args->Message); - } - -public: - static void Main() - { - //Load the XmlSchemaSet. - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - schemaSet->Add("urn:bookstore-schema", "books.xsd"); - - //Validate the file using the schema stored in the schema set. - //Any elements belonging to the namespace "urn:cd-schema" generate - //a warning because there is no schema matching that namespace. - Validate("store.xml", schemaSet); - Console::ReadLine(); - } -}; - -int main() -{ - Sample::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp b/snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp deleted file mode 100644 index 85e97372f69..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::XPath; - -// -public ref class Sample -{ -public: - static void Evaluate( XPathExpression^ expr, XPathNavigator^ nav ) - { - XPathNodeIterator^ i = nav->Select(expr); - switch ( expr->ReturnType ) - { - case XPathResultType::Number: - Console::WriteLine( nav->Evaluate( expr ) ); - break; - - case XPathResultType::NodeSet: - while ( i->MoveNext() ) - Console::WriteLine( i->Current ); - break; - - case XPathResultType::Boolean: - if ( *safe_cast(nav->Evaluate( expr )) ) - Console::WriteLine( "True!" ); - break; - - case XPathResultType::String: - Console::WriteLine( nav->Evaluate( expr ) ); - break; - } - } - -}; - -int main() -{ - XPathDocument^ doc = gcnew XPathDocument( "contosoBooks.xml" ); - XPathNavigator^ nav = doc->CreateNavigator(); - XPathExpression^ expr1 = nav->Compile( ".//price/text()*10" ); // Returns a number. - - XPathExpression^ expr2 = nav->Compile( "bookstore/book/price" ); // Returns a nodeset. - - Sample^ MySample = gcnew Sample; - MySample->Evaluate( expr1, nav ); - MySample->Evaluate( expr2, nav ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp b/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp deleted file mode 100644 index beabf44763b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp +++ /dev/null @@ -1,1166 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::XPath; -using namespace System::Collections; - -ref class XPathNavigatorMethods -{ -public: - - static String^ contosobooks = "C:\\Documents and Settings\\dylanm\\My Documents\\contosoBooks.xml"; - - static void XPathNavigatorMethods_AppendChild1() - { - // XPathNavigator->AppendChild() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlWriter^ pages = navigator->AppendChild(); - pages->WriteElementString("pages", "100"); - pages->Close(); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_AppendChild2() - { - // XPathNavigator->AppendChild(string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - navigator->AppendChild("100"); - - Console::WriteLine(navigator->OuterXml); - // - } - - - static void XPathNavigatorMethods_AppendChild3() - { - // XPathNavigator->AppendChile(XmlReader^) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); - - navigator->AppendChild(pages); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_AppendChild4() - { - // XPathNavigator->AppendChild(XPathNavigator^) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlDocument^ childNodes = gcnew XmlDocument(); - childNodes->Load(gcnew StringReader("100")); - XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); - - - if (childNodesNavigator->MoveToChild("pages", "http://www.contoso.com/books")) - { - navigator->AppendChild(childNodesNavigator); - } - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_AppendChildElement() - { - // XPathNavigator->AppendChildElement(string, string, string, string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - navigator->AppendChildElement(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_Clone() - { - // XPathNavigator->Clone() - - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - // Select all books authored by Melville. - XPathNodeIterator^ nodes = navigator->Select("descendant::book[author/last-name='Melville']"); - - while (nodes->MoveNext()) - { - // Clone the navigator returned by the Current property. - // Use the cloned navigator to get the title element. - XPathNavigator^ clone = nodes->Current->Clone(); - clone->MoveToFirstChild(); - Console::WriteLine("Book title: {0}", clone->Value); - } - // - } - - static void XPathNavigatorMethods_CreateAttribute() - { - // XPathNavigator->CreateAttribute(string, string, string, string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->CreateAttribute("", "discount", "", "1.00"); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_CreateAttributes() - { - // XPathNavigator->CreateAttributes() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlWriter^ attributes = navigator->CreateAttributes(); - - attributes->WriteAttributeString("discount", "1.00"); - attributes->WriteAttributeString("currency", "USD"); - attributes->Close(); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_DeleteSelf() - { - // XPathNavigator->DeleteSelf() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->DeleteSelf(); - - Console::WriteLine("Position after delete: {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_DeleteRange() - { - // XPathNavigator->DeleteRange() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - XPathNavigator^ first = navigator->SelectSingleNode("/bk:bookstore/bk:book[1]", manager); - XPathNavigator^ last = navigator->SelectSingleNode("/bk:bookstore/bk:book[2]", manager); - - navigator->MoveTo(first); - navigator->DeleteRange(last); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_Evaluate1() - { - // XPathNavigator->Evaluate(string) - - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - Double total = (double)navigator->Evaluate("sum(descendant::book/price)"); - Console::WriteLine("Total price for all books: {0}", total.ToString()); - // - } - - static void XPathNavigatorMethods_Evaluate2() - { - // XPathNavigator->Evaluate(XPathExpression) - - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XPathExpression^ query = navigator->Compile("sum(descendant::book/price)"); - - Double total = (double)navigator->Evaluate(query); - Console::WriteLine("Total price for all books: {0}", total.ToString()); - // - } - - static void XPathNavigatorMethods_Evaluate3() - { - // XPathNavigator->Evaluate(string, IXmlNamespaceResolver) - - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - Double total = (double)navigator->Evaluate("sum(descendant::bk:book/bk:price)", manager); - Console::WriteLine("Total price for all books: {0}", total.ToString()); - // - } - - static void XPathNavigatorMethods_Evaluate4() - { - // XPathNavigator->Evaluate(XPathExpression, XPathNodeIterator^) - - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XPathNodeIterator^ nodes = navigator->Select("//book"); - XPathExpression^ query = nodes->Current->Compile("sum(descendant::price)"); - - Double total = (double)navigator->Evaluate(query, nodes); - Console::WriteLine("Total price for all books: {0}", total.ToString()); - // - } - - static void XPathNavigatorMethods_InsertAfter1() - { - // XPathNavigator->InsertAfter() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlWriter^ pages = navigator->InsertAfter(); - pages->WriteElementString("pages", "100"); - pages->Close(); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertAfter2() - { - // XPathNavigator->InsertAfter(string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->InsertAfter("100"); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertAfter3() - { - // XPathNavigator->InsertAfter(XmlReader^) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); - - navigator->InsertAfter(pages); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertAfter4() - { - // XPathNavigator->InsertAfter(XPathNavigator^) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlDocument^ childNodes = gcnew XmlDocument(); - childNodes->Load(gcnew StringReader("100")); - XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); - - navigator->InsertAfter(childNodesNavigator); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertBefore1() - { - // XPathNavigator->InsertBefore() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlWriter^ pages = navigator->InsertBefore(); - pages->WriteElementString("pages", "100"); - pages->Close(); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertBefore2() - { - // XPathNavigator->InsertBefore(string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->InsertBefore("100"); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertBefore3() - { - // XPathNavigator->InsertBefore(XmlReader^) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); - - navigator->InsertBefore(pages); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertBefore4() - { - // XPathNavigator->InsertBefore(XPathNavigator^) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlDocument^ childNodes = gcnew XmlDocument(); - childNodes->Load(gcnew StringReader("100")); - XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); - - navigator->InsertBefore(childNodesNavigator); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertElementAfter() - { - // XPathNavigator->InsertElementAfter(string, string, string, string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->InsertElementAfter(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_InsertElementBefore() - { - // XPathNavigator->InsertElementBefore(string, string, string, string) - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->InsertElementBefore(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_Matches() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - // Select all book nodes. - XPathNodeIterator^ nodes = navigator->SelectDescendants("book", "", false); - - // Select all book nodes that have the matching attribute value. - XPathExpression^ expr = navigator->Compile("book[@genre='novel']"); - while (nodes->MoveNext()) - { - XPathNavigator^ navigator2 = nodes->Current->Clone(); - if (navigator2->Matches(expr)) - { - navigator2->MoveToFirstChild(); - Console::WriteLine("Book title: {0}", navigator2->Value); - } - } - // - } - - static void XPathNavigatorMethods_MoveToFollowing1() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToFollowing(XPathNodeType::Element); - - Console::WriteLine("Position: {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_MoveToFollowing2() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToFollowing("price", "http://www.contoso.com/books"); - - Console::WriteLine("Position: {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_MoveToFollowing3() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToFollowing("price", "http://www.contoso.com/books"); - XPathNavigator^ boundary = navigator->Clone(); - - navigator->MoveToRoot(); - - while (navigator->MoveToFollowing(XPathNodeType::Text, boundary)) - { - Console::WriteLine(navigator->OuterXml); - } - // - } - - static void XPathNavigatorMethods_MoveToFollowing4() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToFollowing("book", "http://www.contoso.com/books"); - XPathNavigator^ boundary = navigator->Clone(); - boundary->MoveToFollowing("first-name", "http://www.contoso.com/books"); - - navigator->MoveToFollowing("price", "http://www.contoso.com/books", boundary); - - Console::WriteLine("Position (after boundary): {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - - navigator->MoveToFollowing("title", "http://www.contoso.com/books", boundary); - - Console::WriteLine("Position (before boundary): {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - // - static void XPathNavigatorMethods_MoveToNext() - { - - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - XPathNodeIterator^ nodeset = navigator->Select("descendant::book[author/last-name='Melville']"); - - while (nodeset->MoveNext()) - { - // Clone iterator here when working with it. - RecursiveWalk(nodeset->Current->Clone()); - } - } - - static void RecursiveWalk(XPathNavigator^ navigator) - { - switch (navigator->NodeType) - { - case XPathNodeType::Element: - if (navigator->Prefix == String::Empty) - Console::WriteLine("<{0}>", navigator->LocalName); - else - Console::Write("<{0}:{1}>", navigator->Prefix, navigator->LocalName); - Console::WriteLine("\t" + navigator->NamespaceURI); - break; - case XPathNodeType::Text: - Console::WriteLine("\t" + navigator->Value); - break; - } - - if (navigator->MoveToFirstChild()) - { - do - { - RecursiveWalk(navigator); - } while (navigator->MoveToNext()); - - navigator->MoveToParent(); - if (navigator->NodeType == XPathNodeType::Element) - Console::WriteLine("", navigator->Name); - } - else - { - if (navigator->NodeType == XPathNodeType::Element) - { - Console::WriteLine("", navigator->Name); - } - } - } - // - - static void XPathNavigatorMethods_PrependChild1() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlWriter^ pages = navigator->PrependChild(); - pages->WriteElementString("pages", "100"); - pages->Close(); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_PrependChild2() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - navigator->PrependChild("100"); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_PrependChild3() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); - - navigator->PrependChild(pages); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_PrependChild4() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlDocument^ childNodes = gcnew XmlDocument(); - childNodes->Load(gcnew StringReader("100")); - XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); - - navigator->PrependChild(childNodesNavigator); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_PrependChildElement() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - navigator->PrependChildElement(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_ReadSubtree() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlReader^ reader = navigator->ReadSubtree(); - - while (reader->Read()) - { - Console::WriteLine(reader->ReadInnerXml()); - } - - reader->Close(); - // - } - - static void XPathNavigatorMethods_ReplaceRange() - { - // XPathNavigator->ReplaceRange() - - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - XPathNavigator^ first = navigator->SelectSingleNode("/bk:bookstore/bk:book[1]", manager); - XPathNavigator^ last = navigator->SelectSingleNode("/bk:bookstore/bk:book[2]", manager); - - navigator->MoveTo(first); - XmlWriter^ newRange = navigator->ReplaceRange(last); - newRange->WriteStartElement("book"); - newRange->WriteAttributeString("genre", ""); - newRange->WriteAttributeString("publicationdate", "2005-04-07"); - newRange->WriteAttributeString("ISBN", "0"); - newRange->WriteStartElement("title"); - newRange->WriteString("New Book"); - newRange->WriteEndElement(); - newRange->WriteStartElement("author"); - newRange->WriteStartElement("first-name"); - newRange->WriteString("First Name"); - newRange->WriteEndElement(); - newRange->WriteStartElement("last-name"); - newRange->WriteString("Last Name"); - newRange->WriteEndElement(); - newRange->WriteEndElement(); - newRange->WriteElementString("price", "$0.00"); - newRange->WriteEndElement(); - newRange->Close(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_ReplaceSelf1() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - navigator->ReplaceSelf("100"); - - Console::WriteLine("Position after delete: {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_ReplaceSelf2() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); - - navigator->ReplaceSelf(pages); - - Console::WriteLine("Position after delete: {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_ReplaceSelf3() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - XmlDocument^ childNodes = gcnew XmlDocument(); - childNodes->Load(gcnew StringReader("100")); - XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); - - navigator->ReplaceSelf(childNodesNavigator); - - Console::WriteLine("Position after delete: {0}", navigator->Name); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_Select1() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XPathNodeIterator^ nodes = navigator->Select("/bookstore/book"); - nodes->MoveNext(); - XPathNavigator^ nodesNavigator = nodes->Current; - - XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false); - - while (nodesText->MoveNext()) - Console::WriteLine(nodesText->Current->Value); - // - } - - static void XPathNavigatorMethods_Select2() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XPathExpression^ query = navigator->Compile("/bookstore/book"); - XPathNodeIterator^ nodes = navigator->Select(query); - XPathNavigator^ nodesNavigator = nodes->Current; - - XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false); - - while (nodesText->MoveNext()) - { - Console::WriteLine(nodesText->Current->Value); - } - // - } - - static void XPathNavigatorMethods_Select3() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - XPathNodeIterator^ nodes = navigator->Select("/bk:bookstore/bk:book/bk:price", manager); - // Move to the first node bk:price node. - if(nodes->MoveNext()) - { - // Now nodes.Current points to the first selected node. - XPathNavigator^ nodesNavigator = nodes->Current; - - // Select all the descendants of the current price node. - XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false); - - while(nodesText->MoveNext()) - { - Console::WriteLine(nodesText->Current->Value); - } - } - // - } - - static void XPathNavigatorMethods_SelectAncestorsChildrenDescendants() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - // Select all the descendant nodes of the book node. - XPathNodeIterator^ bookDescendants = navigator->SelectDescendants("", "http://www.contoso.com/books", false); - - // Display the LocalName of each descendant node. - Console::WriteLine("Descendant nodes of the book node:"); - while (bookDescendants->MoveNext()) - { - Console::WriteLine(bookDescendants->Current->Name); - } - - // Select all the child nodes of the book node. - XPathNodeIterator^ bookChildren = navigator->SelectChildren("", "http://www.contoso.com/books"); - - // Display the LocalName of each child node. - Console::WriteLine("\nChild nodes of the book node:"); - while (bookChildren->MoveNext()) - { - Console::WriteLine(bookChildren->Current->Name); - } - - // Select all the ancestor nodes of the title node. - navigator->MoveToChild("title", "http://www.contoso.com/books"); - - XPathNodeIterator^ bookAncestors = navigator->SelectAncestors("", "http://www.contoso.com/books", false); - - // Display the LocalName of each ancestor node. - Console::WriteLine("\nAncestor nodes of the title node:"); - - while (bookAncestors->MoveNext()) - { - Console::WriteLine(bookAncestors->Current->Name); - } - // - } - - static void XPathNavigatorMethods_SelectSingleNode1() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XPathNavigator^ node = navigator->SelectSingleNode("//title"); - Console::WriteLine(node->InnerXml); - // - } - - static void XPathNavigatorMethods_SelectSingleNode2() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XPathExpression^ query = navigator->Compile("//title"); - - XPathNavigator^ node = navigator->SelectSingleNode(query); - Console::WriteLine(node->InnerXml); - // - } - - static void XPathNavigatorMethods_SelectSingleNode3() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - XPathNavigator^ node = navigator->SelectSingleNode("//bk:title", manager); - Console::WriteLine(node->InnerXml); - // - } - - static void XPathNavigatorMethods_SetTypedValue() - { - // - XmlReaderSettings^ settings = gcnew XmlReaderSettings(); - settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd"); - settings->ValidationType = ValidationType::Schema; - - XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings); - XmlDocument^ document = gcnew XmlDocument(); - document->Load(reader); - - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - Decimal^ price = gcnew Decimal(19.99); - navigator->SetTypedValue(price); - - navigator->MoveToParent(); - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_SetValue() - { - // - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - for each (XPathNavigator^ nav in navigator->Select("//bk:price", manager)) - { - if(nav->Value == "11.99") - { - nav->SetValue("12.99"); - } - } - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorMethods_WriteSubtree() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - XmlWriter^ writer = XmlWriter::Create("contosoBook.xml"); - navigator->WriteSubtree(writer); - - writer->Close(); - // - } - - static void XPathNavigatorMethods_MoveToNextAttribute() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - // Select all book nodes and display all attributes on each book. - XPathNodeIterator^ nodes = navigator->SelectDescendants("book", "", false); - while (nodes->MoveNext()) - { - XPathNavigator^ navigator2 = nodes->Current->Clone(); - navigator2->MoveToFirstAttribute(); - Console::WriteLine("{0} = {1}", navigator2->Name, navigator2->Value); - - while (navigator2->MoveToNextAttribute()) - { - Console::WriteLine("{0} = {1}", navigator2->Name, navigator2->Value); - } - - Console::WriteLine(); - } - // - } - - static void XPathNavigatorMethods_BasicMoveTos() - { - // - // Load the XML document. - XmlDocument^ document = gcnew XmlDocument(); - document->Load("contosoBooks.xml"); - - // Create the XPathNavigator. - XPathNavigator^ navigator = document->CreateNavigator(); - - // Create an XmlNamespaceManager used to handle namespaces - // found in the XML document. - XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable); - manager->AddNamespace("bk", "http://www.contoso.com/books"); - - // Move to the last book node using the SelectSingleNode method. - navigator = navigator->SelectSingleNode("//bk:book[last()]", manager); - Console::WriteLine("Last book node: \n===============\n{0}", navigator->OuterXml); - - // Move to the previous book node and write it to the console - // if the move was successful. - if (navigator->MoveToPrevious()) - { - Console::WriteLine("\nSecond book node: \n=================\n{0}", - navigator->OuterXml); - } - - // Move to the first book node and write it to the console - // if the move was successful. - if (navigator->MoveToFirst()) - { - Console::WriteLine("\nFirst book node: \n================\n{0}", - navigator->OuterXml); - } - - // Move to the parent bookstore node and write it to the console - // if the move was successful. - if (navigator->MoveToParent()) - { - Console::WriteLine("\nParent bookstore node: \n======================\n{0}", - navigator->OuterXml); - } - - // Move to the first child node of the bookstore node and write - // it to the console if the move was successful. - if (navigator->MoveToFirstChild()) - { - Console::WriteLine("\nFirst book node: \n================\n{0}", - navigator->OuterXml); - } - - // Move to the root node and write it to the console. - navigator->MoveToRoot(); - Console::WriteLine("\nRoot node: \n==========\n{0}", - navigator->OuterXml); - // - } - static void XPathNavigatorMethods_TwoWaysToIterateOverXPathNavigator() - { - XPathDocument^ doc = gcnew XPathDocument(gcnew StringReader("")); - XPathNavigator^ nav = doc->CreateNavigator(); - XPathNodeIterator^ nodeIterator = nav->SelectDescendants("", "", false); - - // - while (nodeIterator->MoveNext()) - { - XPathNavigator^ n = nodeIterator->Current; - Console::WriteLine(n->LocalName); - } - // - - // - for each (XPathNavigator^ n in nodeIterator) - Console::WriteLine(n->LocalName); - // - } - - -}; - -int main() -{ - return 0; -}; \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp b/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp deleted file mode 100644 index 98a87366e0c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::XPath; -using namespace System::Collections; - -class XPathNavigatorProperties -{ -public: - - static void XPathNavigatorProperties_CanEdit() - { - // - XPathDocument^ readOnlyDocument = gcnew XPathDocument("books.xml"); - XPathNavigator^ readOnlyNavigator = readOnlyDocument->CreateNavigator(); - - XmlDocument^ editableDocument = gcnew XmlDocument(); - editableDocument->Load("books.xml"); - XPathNavigator^ editableNavigator = editableDocument->CreateNavigator(); - - Console::WriteLine("XPathNavigator.CanEdit from XPathDocument: {0}", readOnlyNavigator->CanEdit); - Console::WriteLine("XPathNavigator.CanEdit from XmlDocument: {0}", editableNavigator->CanEdit); - // - } - - static void XPathNavigatorProperties_InnerXml() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - Console::WriteLine(navigator->InnerXml); - // - } - - static void XPathNavigatorProperties_NavigatorComparer() - { - // - XPathDocument^ document = gcnew XPathDocument("books.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - Hashtable^ table = gcnew Hashtable(XPathNavigator::NavigatorComparer); - - // Add nodes to the Hashtable. - for each (XPathNavigator^ navigator2 in navigator->Select("//book")) - { - Object^ value = navigator2->Evaluate("string(./title)"); - table->Add(navigator2->Clone(), value); - Console::WriteLine("Added book with title {0}", value); - } - - Console::WriteLine(table->Count); - Console::WriteLine("Does the Hashtable have the book \"The Confidence Man\"?"); - Console::WriteLine(table->Contains(navigator->SelectSingleNode("//book[title='The Confidence Man']"))); - // - } - - static void XPathNavigatorProperties_OuterXml() - { - // - XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - - Console::WriteLine(navigator->OuterXml); - // - } - - static void XPathNavigatorProperties_ValueAs() - { - // - XPathDocument^ document = gcnew XPathDocument("valueas.xml"); - XPathNavigator^ navigator = document->CreateNavigator(); - - // ValueAsBoolean - navigator->MoveToChild("root", ""); - navigator->MoveToChild("booleanElement", ""); - bool^ booleanValue = navigator->ValueAsBoolean; - Console::WriteLine(navigator->LocalName + ": " + booleanValue); - - // ValueAsDateTime - navigator->MoveToNext("dateTimeElement", ""); - DateTime^ dateTimeValue = navigator->ValueAsDateTime; - Console::WriteLine(navigator->LocalName + ": " + dateTimeValue); - - // ValueAsDouble, ValueAsInt32, ValueAsInt64, ValueAsSingle - navigator->MoveToNext("numberElement", ""); - Double doubleValue = navigator->ValueAsDouble; - Int32 int32Value = navigator->ValueAsInt; - Int64 int64Value = navigator->ValueAsLong; - Console::WriteLine(navigator->LocalName + ": " + doubleValue); - Console::WriteLine(navigator->LocalName + ": " + int32Value); - Console::WriteLine(navigator->LocalName + ": " + int64Value); - // - } - - static void XPathNavigatorProperties_ValueType() - { - // - // Create an XmlReaderSettings object with the contosoBooks.xsd schema. - XmlReaderSettings^ settings = gcnew XmlReaderSettings(); - settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd"); - settings->ValidationType = ValidationType::Schema; - - // Create an XmlReader object with the contosoBooks.xml file and its schema. - XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings); - - XPathDocument^ document = gcnew XPathDocument(reader); - XPathNavigator^ navigator = document->CreateNavigator(); - - navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); - navigator->MoveToChild("book", "http://www.contoso.com/books"); - navigator->MoveToChild("price", "http://www.contoso.com/books"); - - // Display the current type of the price element. - Console::WriteLine(navigator->ValueType); - - // Get the value of the price element as a string and display it. - String^ price = dynamic_cast(navigator->ValueAs(String::typeid)); - Console::WriteLine(price); - // - } -}; - -int main() -{ - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp b/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp deleted file mode 100644 index 75adbf6a471..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::XPath; - -class XPathValidation -{ -public: - - static void Main() - { - try - { - XmlReaderSettings^ settings = gcnew XmlReaderSettings(); - settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd"); - settings->ValidationType = ValidationType::Schema; - - XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings); - XmlDocument^ document = gcnew XmlDocument(); - document->Load(reader); - - ValidationEventHandler^ eventHandler = gcnew ValidationEventHandler(ValidationEventHandlerOne); - - // the following call to Validate succeeds. - document->Validate(eventHandler); - - // add a node so that the document is no longer valid - XPathNavigator^ navigator = document->CreateNavigator(); - navigator->MoveToFollowing("price", "http://www.contoso.com/books"); - XmlWriter^ writer = navigator->InsertAfter(); - writer->WriteStartElement("anotherNode", "http://www.contoso.com/books"); - writer->WriteEndElement(); - writer->Close(); - - // the document will now fail to successfully validate - document->Validate(eventHandler); - } - catch(Exception^ ex) - { - Console::WriteLine(ex->Message); - } - } - - static void ValidationEventHandlerOne(Object^ sender, ValidationEventArgs^ e) - { - switch (e->Severity) - { - case XmlSeverityType::Error: - Console::WriteLine("Error: {0}", e->Message); - break; - case XmlSeverityType::Warning: - Console::WriteLine("Warning {0}", e->Message); - break; - } - - } -}; - -int main() -{ - XPathValidation::Main(); - Console::ReadLine(); - return 0; -}; -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp deleted file mode 100644 index 47d9622fae0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Encode and decode a name with spaces. - String^ name1 = XmlConvert::EncodeName( "Order Detail" ); - Console::WriteLine( "Encoded name: {0}", name1 ); - Console::WriteLine( "Decoded name: {0}", XmlConvert::DecodeName( name1 ) ); - - // Encode and decode a local name. - String^ name2 = XmlConvert::EncodeLocalName( "a:book" ); - Console::WriteLine( "Encoded local name: {0}", name2 ); - Console::WriteLine( "Decoded local name: {0}", XmlConvert::DecodeName( name2 ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp deleted file mode 100644 index c3d8da70f59..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = gcnew XmlTextReader( "orderData.xml" ); - - //Parse the file and pull out the order date and price. - while ( reader->Read() ) - { - if ( reader->NodeType == XmlNodeType::Element ) - { - if ( reader->Name->Equals( "order" ) ) - { - DateTime orderDate = XmlConvert::ToDateTime( reader->GetAttribute( "date" ) ); - Console::WriteLine( "order date: {0}", orderDate.ToString() ); - } - else - if ( reader->Name->Equals( "price" ) ) - { - Double price = XmlConvert::ToDouble( reader->ReadInnerXml() ); - Console::WriteLine( "price: {0}", price ); - } - } - } - - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp deleted file mode 100644 index a3e011767f0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlTextWriter^ writer = gcnew XmlTextWriter( "out.xml", nullptr ); - String^ tag = "item name"; - try - { - - // Write the root element. - writer->WriteStartElement( "root" ); - writer->WriteStartElement( XmlConvert::VerifyName( tag ) ); - } - catch ( XmlException^ e ) - { - Console::WriteLine( e->Message ); - Console::WriteLine( "Convert to a valid name..." ); - writer->WriteStartElement( XmlConvert::EncodeName( tag ) ); - } - - writer->WriteString( "hammer" ); - writer->WriteEndElement(); - - // Write the end tag for the root element. - writer->WriteEndElement(); - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp deleted file mode 100644 index f69ebbfb60c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; - -int main() -{ - // Create an XmlDataDocument. - XmlDataDocument^ doc = gcnew XmlDataDocument; - - // Load the schema file. - doc->DataSet->ReadXmlSchema( "store.xsd" ); - - // Load the XML data. - doc->Load( "2books.xml" ); - - //Change the price on the first book. - XmlElement^ root = doc->DocumentElement; - DataRow^ row = doc->GetRowFromElement( safe_cast(root->FirstChild) ); - row["price"] = "12.95"; - Console::WriteLine( "Display the modified XML data..." ); - Console::WriteLine( doc->DocumentElement->OuterXml ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp deleted file mode 100644 index 631d04fa9a1..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; -int main() -{ - // Create an XmlDataDocument. - XmlDataDocument^ doc = gcnew XmlDataDocument; - - // Load the schema file. - doc->DataSet->ReadXmlSchema( "store.xsd" ); - - // Load the XML data. - XmlTextReader^ reader = gcnew XmlTextReader( "2books.xml" ); - reader->MoveToContent(); // Moves the reader to the root node. - doc->Load( reader ); - - // Update the price on the first book using the DataSet methods. - DataTable^ books = doc->DataSet->Tables["book"]; - books->Rows[0]["price"] = "12.95"; - Console::WriteLine( "Display the modified XML data..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp deleted file mode 100644 index 2b1b5ca9f4d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Net; -int main() -{ - - // Supply the credentials necessary to access the DTD file stored on the network. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - resolver->Credentials = CredentialCache::DefaultCredentials; - - // Create and load the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->XmlResolver = resolver; // Set the resolver. - doc->Load( "book5.xml" ); - - // Display the entity replacement text which is pulled from the DTD file. - Console::WriteLine( doc->DocumentElement->LastChild->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp b/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp deleted file mode 100644 index cf02bc534b8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XmlDocumentSample -{ -private: - static XmlReader^ reader; - static String^ filename = "bookdtd.xml"; - - // Display the validation error. - static void ValidationCallback(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine("Validation error loading: {0}", filename); - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - ValidationEventHandler^ eventHandler = gcnew ValidationEventHandler(XmlDocumentSample::ValidationCallback); - - try - { - // Create the validating reader and specify DTD validation. - XmlReaderSettings^ settings = gcnew XmlReaderSettings(); - settings->DtdProcessing = DtdProcessing::Parse; - settings->ValidationType = ValidationType::DTD; - settings->ValidationEventHandler += eventHandler; - - reader = XmlReader::Create(filename, settings); - - // Pass the validating reader to the XML document. - // Validation fails due to an undefined attribute, but the - // data is still loaded into the document. - XmlDocument^ doc = gcnew XmlDocument(); - doc->Load(reader); - Console::WriteLine(doc->OuterXml); - } - finally - { - if (reader != nullptr) - reader->Close(); - } - } -}; - -int main() -{ - XmlDocumentSample::Main(); - return 0; -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp b/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp deleted file mode 100644 index 85250f42094..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -public ref class Sample -{ -public: - static void DisplayEntities( XmlNamedNodeMap^ nMap ) - { - for ( int i = 0; i < nMap->Count; i++ ) - { - XmlEntity^ ent = dynamic_cast(nMap->Item( i )); - Console::Write( " {0} ", ent->NodeType ); - Console::Write( " {0} ", ent->Name ); - Console::Write( " {0} ", ent->NotationName ); - Console::Write( " {0} ", ent->PublicId ); - Console::Write( " {0} ", ent->SystemId ); - Console::WriteLine(); - - } - } - -}; - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "doment.xml" ); - Console::WriteLine( "Display information on all entities..." ); - XmlNamedNodeMap^ nMap = doc->DocumentType->Entities; - Sample^ MySample = gcnew Sample; - MySample->DisplayEntities( nMap ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp deleted file mode 100644 index 3424276fabf..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Collections; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "booksort.xml" ); - - // Create an XmlNamespaceManager for resolving namespaces. - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ); - nsmgr->AddNamespace( "bk", "urn:samples" ); - - // Select and display the value of all the ISBN attributes. - XmlNodeList^ nodeList; - XmlElement^ root = doc->DocumentElement; - nodeList = root->SelectNodes( "/bookstore/book/@bk:ISBN", nsmgr ); - IEnumerator^ myEnum = nodeList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - XmlNode^ isbn = safe_cast(myEnum->Current); - Console::WriteLine( isbn->Value ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp deleted file mode 100644 index 3cc1ad791d3..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "booksort.xml" ); - - //Create an XmlNamespaceManager for resolving namespaces. - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ); - nsmgr->AddNamespace( "bk", "urn:samples" ); - - //Select the book node with the matching attribute value. - XmlNode^ book; - XmlElement^ root = doc->DocumentElement; - book = root->SelectSingleNode( "descendant::book->Item[@bk:ISBN='1-861001-57-6']", nsmgr ); - Console::WriteLine( book->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp deleted file mode 100644 index f460ecd9f3d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( L"newbooks.xml" ); - - // Create an XmlNamespaceManager to resolve the default namespace. - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ); - nsmgr->AddNamespace( L"bk", L"urn:newbooks-schema" ); - - // Select the first book written by an author whose last name is Atwood. - XmlNode^ book; - XmlElement^ root = doc->DocumentElement; - book = root->SelectSingleNode( L"descendant::bk:book[bk:author/bk:last-name='Atwood']", nsmgr ); - Console::WriteLine( book->OuterXml ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp b/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp deleted file mode 100644 index ab467b652be..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -public ref class Sample -{ -public: - void Run( String^ args ) - { - // Create and load the XML document. - Console::WriteLine( "Loading file {0} ...", args ); - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( args ); - - //Create the event handlers. - doc->NodeChanged += gcnew XmlNodeChangedEventHandler( this, &Sample::MyNodeChangedEvent ); - doc->NodeInserted += gcnew XmlNodeChangedEventHandler( this, &Sample::MyNodeInsertedEvent ); - - // Change the book price. - doc->DocumentElement->LastChild->InnerText = "5.95"; - - // Add a new element. - XmlElement^ newElem = doc->CreateElement( "style" ); - newElem->InnerText = "hardcover"; - doc->DocumentElement->AppendChild( newElem ); - Console::WriteLine( "\r\nDisplay the modified XML..." ); - Console::WriteLine( doc->OuterXml ); - } - - // Handle the NodeChanged event. -private: - void MyNodeChangedEvent( Object^ /*src*/, XmlNodeChangedEventArgs^ args ) - { - Console::Write( "Node Changed Event: <{0}> changed", args->Node->Name ); - if ( args->Node->Value != nullptr ) - { - Console::WriteLine( " with value {0}", args->Node->Value ); - } - else - Console::WriteLine( "" ); - } - - // Handle the NodeInserted event. - void MyNodeInsertedEvent( Object^ /*src*/, XmlNodeChangedEventArgs^ args ) - { - Console::Write( "Node Inserted Event: <{0}> inserted", args->Node->Name ); - if ( args->Node->Value != nullptr ) - { - Console::WriteLine( " with value {0}", args->Node->Value ); - } - else - Console::WriteLine( "" ); - } -}; -// End class - -int main() -{ - Sample^ mySample = gcnew Sample; - mySample->Run( "book.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp b/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp deleted file mode 100644 index 5e7a6c8360b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -void DisplayNotations( XmlNamedNodeMap^ nMap ) -{ - for ( int i = 0; i < nMap->Count; i++ ) - { - XmlNotation^ note = dynamic_cast(nMap->Item( i )); - Console::Write( " {0} ", note->NodeType ); - Console::Write( " {0} ", note->Name ); - Console::Write( " {0} ", note->PublicId ); - Console::Write( " {0} ", note->SystemId ); - Console::WriteLine(); - - } -} - -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "doment.xml" ); - Console::WriteLine( "Display information on all notations..." ); - XmlNamedNodeMap^ nMap = doc->DocumentType->Notations; - DisplayNotations( nMap ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp deleted file mode 100644 index a3f97a98a5a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::IO; - -// Display any validation errors. -static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) -{ - Console::WriteLine( L"Validation Error: {0}", e->Message ); -} - -int main() -{ - // Set the validation settings. - XmlReaderSettings^ settings = gcnew XmlReaderSettings; - settings->DtdProcessing = DtdProcessing::Parse; - settings->ValidationType = ValidationType::DTD; - settings->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack ); - - // Create the XmlReader object. - XmlReader^ reader = XmlReader::Create( L"itemDTD.xml", settings ); - - // Parse the file. - while ( reader->Read() ) - ; - - return 1; -} -// - diff --git a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp deleted file mode 100644 index 2c42e5cc4eb..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp +++ /dev/null @@ -1,38 +0,0 @@ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::IO; -int main() -{ - - // - // Set the reader settings. - XmlReaderSettings^ settings = gcnew XmlReaderSettings; - settings->IgnoreComments = true; - settings->IgnoreProcessingInstructions = true; - settings->IgnoreWhitespace = true; - - // - // - // Create a resolver with default credentials. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - resolver->Credentials = System::Net::CredentialCache::DefaultCredentials; - - // Set the reader settings object to use the resolver. - settings->XmlResolver = resolver; - - // Create the XmlReader object. - XmlReader^ reader = XmlReader::Create( L"http://ServerName/data/books.xml", settings ); - - // - // Parse the file. - while ( reader->Read() ) - ; - - return 1; -} - diff --git a/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp b/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp deleted file mode 100644 index f202c678601..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp +++ /dev/null @@ -1,50 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::IO; - -// Display any validation errors. -static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) -{ - Console::WriteLine( L"Validation Error:\n {0}", e->Message ); - Console::WriteLine(); -} - -int main() -{ - // Create the XmlSchemaSet class. - XmlSchemaSet^ sc = gcnew XmlSchemaSet; - - // Add the schema to the collection. - sc->Add( L"urn:bookstore-schema", L"books.xsd" ); - - // Set the validation settings. - XmlReaderSettings^ settings = gcnew XmlReaderSettings; - settings->ValidationType = ValidationType::Schema; - settings->Schemas = sc; - settings->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack); - - // Create the XmlReader object. - XmlReader^ reader = XmlReader::Create( L"booksSchemaFail.xml", settings ); - - // Parse the file. - while ( reader->Read() ) - ; - - return 1; -} -// The example displays output like the following: -// Validation Error: -// The element 'book' in namespace 'urn:bookstore-schema' has invalid child element 'author' -// in namespace 'urn:bookstore-schema'. List of possible elements expected: 'title' in -// namespace 'urn:bookstore-schema'. -// -// Validation Error: -// The element 'author' in namespace 'urn:bookstore-schema' has invalid child element 'name' -// in namespace 'urn:bookstore-schema'. List of possible elements expected: 'first-name' in -// namespace 'urn:bookstore-schema'. -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp deleted file mode 100644 index 8ad92c04292..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class Sample -{ -private: - //Display the schema error information. - static void ValidationCallBack( Object^ sender, ValidationEventArgs^ args ) - { - Console::WriteLine( "Invalid XSD schema: {0}", args->Exception->Message ); - } - -public: - static void main() - { - // Create the schema collection. - XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection; - - //Set an event handler to manage invalid schemas. - xsc->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); - - //Add the schema to the collection. - xsc->Add( nullptr, "invalid.xsd" ); - } -}; - -int main() -{ - Sample::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp deleted file mode 100644 index d496898fad0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class Sample -{ -private: - // Display any errors. - static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) - { - Console::WriteLine( "Validation Error: {0}", e->Message ); - } - -public: - static void main() - { - array^ args = Environment::GetCommandLineArgs(); - String^ UserName = args[ 1 ]; - String^ SecurelyStoredPassword = args[ 2 ]; - String^ Domain = args[ 3 ]; - - // - XmlSchemaCollection^ sc = gcnew XmlSchemaCollection; - sc->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); - - // Create a resolver with the necessary credentials. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - System::Net::NetworkCredential^ nc; - nc = gcnew System::Net::NetworkCredential( UserName,SecurelyStoredPassword,Domain ); - resolver->Credentials = nc; - - // Add the new schema to the collection. - sc->Add( nullptr, gcnew XmlTextReader( "sample.xsd" ), resolver ); - // - - if ( sc->Count > 0 ) - { - XmlTextReader^ tr = gcnew XmlTextReader( "notValidXSD.xml" ); - XmlValidatingReader^ rdr = gcnew XmlValidatingReader( tr ); - - rdr->ValidationType = ValidationType::Schema; - rdr->Schemas->Add( sc ); - rdr->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); - while ( rdr->Read() ); - } - } -}; - -int main() -{ - Sample::main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp deleted file mode 100644 index 16126254e5a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::IO; -public ref class ValidXSD -{ -public: - static void main() - { - XmlSchemaCollection^ sc = gcnew XmlSchemaCollection; - sc->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack ); - sc->Add( nullptr, "books.xsd" ); - if ( sc->Count > 0 ) - { - XmlTextReader^ tr = gcnew XmlTextReader( "notValidXSD.xml" ); - XmlValidatingReader^ rdr = gcnew XmlValidatingReader( tr ); - rdr->ValidationType = ValidationType::Schema; - rdr->Schemas->Add( sc ); - rdr->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack ); - while ( rdr->Read() ) - ; - } - } - - -private: - static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) - { - Console::WriteLine( "Validation Error: {0}", e->Message ); - } - -}; - -int main() -{ - ValidXSD::main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp deleted file mode 100644 index 0d338c1f4c0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XmlSchemaInferenceExamples -{ -public: - - static void Main() - { - - } - - static void XmlSchemaInference_OverallExample() - { - // - XmlReader^ reader = XmlReader::Create("contosoBooks.xml"); - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - XmlSchemaInference^ schema = gcnew XmlSchemaInference(); - - schemaSet = schema->InferSchema(reader); - - for each (XmlSchema^ s in schemaSet->Schemas()) - { - s->Write(Console::Out); - } - // - } - - static void XmlSchemaInference_Occurrence() - { - // - XmlReader^ reader = XmlReader::Create("input.xml"); - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - XmlSchemaInference^ schema = gcnew XmlSchemaInference(); - - schema->Occurrence = XmlSchemaInference::InferenceOption::Relaxed; - - schemaSet = schema->InferSchema(reader); - - for each (XmlSchema^ s in schemaSet->Schemas()) - { - s->Write(Console::Out); - } - // - } - - static void XmlSchemaInference_TypeInference() - { - // - XmlReader^ reader = XmlReader::Create("input.xml"); - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - XmlSchemaInference^ schema = gcnew XmlSchemaInference(); - - schema->TypeInference = XmlSchemaInference::InferenceOption::Relaxed; - - schemaSet = schema->InferSchema(reader); - - for each (XmlSchema^ s in schemaSet->Schemas()) - { - s->Write(Console::Out); - } - // - } - - static void XmlSchemaInference_RefinementProcess() - { - // - XmlReader^ reader = XmlReader::Create("item1.xml"); - XmlReader^ reader1 = XmlReader::Create("item2.xml"); - XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); - XmlSchemaInference^ inference = gcnew XmlSchemaInference(); - schemaSet = inference->InferSchema(reader); - - // Display the inferred schema. - Console::WriteLine("Original schema:\n"); - for each (XmlSchema^ schema in schemaSet->Schemas("http://www.contoso.com/items")) - { - schema->Write(Console::Out); - } - - // Use the additional data in item2.xml to refine the original schema. - schemaSet = inference->InferSchema(reader1, schemaSet); - - // Display the refined schema. - Console::WriteLine("\n\nRefined schema:\n"); - for each (XmlSchema^ schema in schemaSet->Schemas("http://www.contoso.com/items")) - { - schema->Write(Console::Out); - } - // - } -}; - -int main() -{ - XmlSchemaInferenceExamples::Main(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp deleted file mode 100644 index 1f3adf25c44..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -static void booksSettingsValidationEventHandler( Object^ /*sender*/, ValidationEventArgs^ e ) -{ - if ( e->Severity == XmlSeverityType::Warning ) - { - Console::Write( L"WARNING: " ); - Console::WriteLine( e->Message ); - } - else - if ( e->Severity == XmlSeverityType::Error ) - { - Console::Write( L"ERROR: " ); - Console::WriteLine( e->Message ); - } -} - -int main() -{ - XmlReaderSettings^ booksSettings = gcnew XmlReaderSettings; - booksSettings->Schemas->Add( L"http://www.contoso.com/books", L"books.xsd" ); - booksSettings->ValidationType = ValidationType::Schema; - booksSettings->ValidationEventHandler += gcnew ValidationEventHandler( booksSettingsValidationEventHandler ); - XmlReader^ books = XmlReader::Create( L"books.xml", booksSettings ); - while ( books->Read() ) - {} - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp deleted file mode 100644 index ccf73e57aee..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Net; -int main() -{ - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" ); - - // Create a secure resolver with default credentials. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,"http://myServer/data/" ); - sResolver->Credentials = CredentialCache::DefaultCredentials; - - // Use the secure resolver to resolve resources. - reader->XmlResolver = sResolver; - - // Parse the file. - while ( reader->Read() ) - { - - // Do any additional processing here. - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp deleted file mode 100644 index 3da4b5ed406..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Security; -using namespace System::Security::Policy; -using namespace System::Net; - -// NOTE: To test, replace www.contoso.com w/ the local string - -// -Object^ GetFile( String^ fileURL, XmlResolver^ resolver ) -{ - // Generate the default PermissionSet using the file URL. - Evidence^ evidence = XmlSecureResolver::CreateEvidenceForUrl( fileURL ); - PermissionSet^ myPermissions = SecurityManager::ResolvePolicy( evidence ); - - // Modify the PermissionSet to only allow access to http://www.contoso.com. - // Create a WebPermission which only allows access to http://www.contoso.com. - WebPermission^ myWebPermission = gcnew WebPermission( - NetworkAccess::Connect,"http://www.contoso.com" ); - // Replace the existing WebPermission in myPermissions with the updated WebPermission. - myPermissions->SetPermission( myWebPermission ); - - // Use the modified PermissionSet to construct the XmlSecureResolver. - XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,myPermissions ); - - // Get the object. - Uri^ fullUri = sResolver->ResolveUri( nullptr, fileURL ); - return sResolver->GetEntity( fullUri, nullptr, nullptr ); -} -// - -int main() -{ - Stream^ s = (Stream^)(GetFile( "http://localhost/data/books.xml", - gcnew XmlUrlResolver )); - XmlTextReader^ reader = gcnew XmlTextReader( s ); -} diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp deleted file mode 100644 index 91be2b8ba6b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XML fragment to be parsed. - String^ xmlFrag = " Pride And Prejudice novel "; - - // Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - nsmgr->AddNamespace( "bk", "urn:sample" ); - - // Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); - - // Parse the XML. If they exist, display the prefix and - // namespace URI of each element. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->Prefix == String::Empty ) - Console::WriteLine( "< {0}>", reader->LocalName ); - else - { - Console::Write( "< {0}: {1}>", reader->Prefix, reader->LocalName ); - Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI ); - } - } - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp deleted file mode 100644 index 5ef9f82c8ce..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XML fragment to be parsed. - String^ xmlFrag = "\n" - "\n" - "\n" - "240\n" - "\n" - "\n"; - - // Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - - // Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); - - // Parse the XML and display each node. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition ); - Console::WriteLine( "< {0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition ); - Console::WriteLine( " {0}", reader->Value ); - break; - - case XmlNodeType::EndElement: - Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition ); - Console::WriteLine( "", reader->Name ); - break; - } - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp deleted file mode 100644 index d7a782ca81e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XML fragment to be parsed. - String^ xmlFrag = "\n" - "\n"; - - // Create the XmlNamespaceManager. - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( gcnew NameTable ); - - // Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::Preserve ); - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); - - // Show attribute value normalization. - reader->Read(); - reader->Normalization = false; - Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr1" ) ); - reader->Normalization = true; - Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr1" ) ); - - // Set Normalization back to false. This allows the reader to accept - // character entities in the � to  range. If Normalization had - // been set to true, character entities in this range throw an exception. - reader->Normalization = false; - reader->Read(); - reader->MoveToContent(); - Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr2" ) ); - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp deleted file mode 100644 index 67a11857486..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = nullptr; - __try - { - - // Create the XML fragment to be parsed. - String^ xmlFrag = ""; - - // Create the XmlParserContext. - XmlParserContext^ context; - String^ subset = ""; - context = gcnew XmlParserContext( nullptr,nullptr,"book",nullptr,nullptr,subset,"","",XmlSpace::None ); - - // Create the reader. - reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); - - // Read the misc attribute. The attribute is parsed - // into multiple text and entity reference nodes. - reader->MoveToContent(); - reader->MoveToAttribute( "misc" ); - while ( reader->ReadAttributeValue() ) - { - if ( reader->NodeType == XmlNodeType::EntityReference ) - Console::WriteLine( " {0} {1}", reader->NodeType, reader->Name ); - else - Console::WriteLine( " {0} {1}", reader->NodeType, reader->Value ); - } - } - __finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp deleted file mode 100644 index 43944b7d4c9..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -int main() -{ - Encoding^ enc = gcnew UTF8Encoding; - array^utf8Buffer = enc->GetBytes( " 12345 " ); - enc = gcnew UnicodeEncoding; - array^unicodeBuffer = enc->GetBytes( " root " ); - MemoryStream^ memStrm = gcnew MemoryStream; - memStrm->Write( unicodeBuffer, 0, unicodeBuffer->Length ); - memStrm->Write( utf8Buffer, 0, utf8Buffer->Length ); - memStrm->Position = 0; - XmlTextReader^ reader = gcnew XmlTextReader( memStrm ); - while ( reader->Read() ) - { - Console::WriteLine( "NodeType: {0}", reader->NodeType ); - if ( XmlNodeType::EndElement == reader->NodeType && "root" == reader->Name ) - break; - if ( XmlNodeType::EndElement == reader->NodeType ) - reader->ResetState(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp deleted file mode 100644 index baa5d62f323..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XML fragment to be parsed. - String^ xmlFrag = " Colour Analysis Color Analysis "; - - // Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - - // Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Parse the XML and display each of the nodes, including the xml:lang setting. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::WriteLine( "{0}: < {1}>", reader->XmlLang, reader->Name ); - break; - - case XmlNodeType::Text: - Console::WriteLine( "{0}: {1}", reader->XmlLang, reader->Value ); - break; - - case XmlNodeType::EndElement: - Console::WriteLine( "{0}: ", reader->XmlLang, reader->Name ); - break; - } - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp deleted file mode 100644 index dcc839cdab3..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Net; -int main() -{ - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" ); - - // Supply the credentials necessary to access the Web server. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - resolver->Credentials = CredentialCache::DefaultCredentials; - reader->XmlResolver = resolver; - - // Parse the file. - while ( reader->Read() ) - { - - // Do any additional processing here. - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp deleted file mode 100644 index ae4be95667f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = gcnew XmlTextReader( "authors.xml" ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Parse the file. Return white space only if an - // xml:space='preserve' attribute is found. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "<{0}>", reader->Name ); - if ( reader->XmlSpace == XmlSpace::Preserve ) - reader->WhitespaceHandling = WhitespaceHandling::Significant; - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - - case XmlNodeType::SignificantWhitespace: - Console::Write( reader->Value ); - break; - } - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp deleted file mode 100644 index 32f5080e71f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - String^ xmlData = "\r\n Oberon's Legacy\r\n 5.95\r\n "; - - // Create the reader. - XmlTextReader^ reader = gcnew XmlTextReader( gcnew StringReader( xmlData ) ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Display each element node. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "<{0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - } - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp deleted file mode 100644 index 7457e02c9e8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - - // Use indenting for readability - writer->Formatting = Formatting::Indented; - - // Write an XML fragment. - writer->WriteStartElement( "book" ); - writer->WriteElementString( "title", "Pride And Prejudice" ); - writer->WriteEndElement(); - writer->Flush(); - - // Write another XML fragment. - writer->WriteStartElement( "cd" ); - writer->WriteElementString( "title", "Americana" ); - writer->WriteEndElement(); - writer->Flush(); - - // Close the writer. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp deleted file mode 100644 index 1b175cb5e4e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -public ref class Sample -{ -private: - static Boolean m_success = true; - -public: - Sample() - { - - // Validate the document using an external XSD schema. Validation should fail. - Validate( "notValidXSD.xml" ); - - // Validate the document using an inline XSD. Validation should succeed. - Validate( "inlineXSD.xml" ); - } - - -private: - - // Display the validation error. - void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::WriteLine( "\r\n\tValidation error: {0}", args->Message ); - } - - void Validate( String^ filename ) - { - m_success = true; - Console::WriteLine( "\r\n******" ); - Console::WriteLine( "Validating XML file {0}", filename ); - XmlTextReader^ txtreader = gcnew XmlTextReader( filename ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - - // Set the validation event handler - reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationCallBack ); - - // Read XML data - while ( reader->Read() ) - {} - - Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful!" : "failed.") ); - - // Close the reader. - reader->Close(); - } - -}; - -int main() -{ - Sample^ validation = gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp deleted file mode 100644 index d4ffcecd285..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "book4.xml" ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - reader->MoveToContent(); - - // Display each of the attribute nodes, including default attributes. - while ( reader->MoveToNextAttribute() ) - { - if ( reader->IsDefault ) - Console::Write( "(default attribute) " ); - - Console::WriteLine( " {0} = {1}", reader->Name, reader->Value ); - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp deleted file mode 100644 index 8704a0b66bd..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class Sample -{ -private: - static void ValidationCallBack( Object^ sender, ValidationEventArgs^ args ) - { - Console::WriteLine( "***Validation error" ); - Console::WriteLine( "\tSeverity: {0}", args->Severity ); - Console::WriteLine( "\tMessage : {0}", args->Message ); - } - -public: - static void main() - { - XmlTextReader^ tr = gcnew XmlTextReader( "booksSchema.xml" ); - XmlValidatingReader^ vr = gcnew XmlValidatingReader( tr ); - vr->Schemas->Add( nullptr, "books.xsd" ); - vr->ValidationType = ValidationType::Schema; - vr->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); - while ( vr->Read() ) - { - if ( vr->NodeType == XmlNodeType::Element ) - { - if ( dynamic_cast(vr->SchemaType) != nullptr ) - { - XmlSchemaComplexType^ sct = dynamic_cast(vr->SchemaType); - Console::WriteLine( " {0}( {1})", vr->Name, sct->Name ); - } - else - { - Object^ value = vr->ReadTypedValue(); - Console::WriteLine( " {0}( {1}): {2}", vr->Name, value->GetType()->Name, value ); - } - } - } - } -}; - -int main() -{ - Sample::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp deleted file mode 100644 index c8b97c43ecc..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - array^args = Environment::GetCommandLineArgs(); - String^ UserName = args[ 1 ]; - String^ SecurelyStoredPassword = args[ 2 ]; - String^ Domain = args[ 3 ]; - - // - // Create the reader. -> - XmlTextReader^ txtreader = gcnew XmlTextReader( "book5.xml" ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - - // Set the credentials necessary to access the DTD file stored on the network. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - resolver->Credentials = System::Net::CredentialCache::DefaultCredentials; - reader->XmlResolver = resolver; - - // Display each of the element nodes. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "< {0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::DocumentType: - Console::Write( "Name, reader->Value ); - break; - - case XmlNodeType::EntityReference: - Console::Write( reader->Name ); - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - } - } - - - // Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp deleted file mode 100644 index ff9fd542be2..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create a writer to write XML to the console. - XmlWriterSettings^ settings = gcnew XmlWriterSettings; - settings->Indent = true; - settings->OmitXmlDeclaration = true; - XmlWriter^ writer = XmlWriter::Create( Console::Out, settings ); - - // Write the book element. - writer->WriteStartElement( L"book" ); - - // Write the title element. - writer->WriteStartElement( L"title" ); - writer->WriteString( L"Pride And Prejudice" ); - writer->WriteEndElement(); - - // Write the close tag for the root element. - writer->WriteEndElement(); - - // Write the XML and close the writer. - writer->Close(); - return 1; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp deleted file mode 100644 index ca3bcbf4373..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -void main() -{ - - // Create an XmlWriter to write XML fragments. - XmlWriterSettings^ settings = gcnew XmlWriterSettings; - settings->ConformanceLevel = ConformanceLevel::Fragment; - settings->Indent = true; - XmlWriter^ writer = XmlWriter::Create( Console::Out, settings ); - - // Write an XML fragment. - writer->WriteStartElement( L"book" ); - writer->WriteElementString( L"title", L"Pride And Prejudice" ); - writer->WriteEndElement(); - writer->Flush(); - - // Write another XML fragment. - writer->WriteStartElement( L"cd" ); - writer->WriteElementString( L"title", L"Americana" ); - writer->WriteEndElement(); - writer->Flush(); - - // Close the writer. - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp deleted file mode 100644 index 59b7bac475a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -void main() -{ - XmlWriter^ writer = nullptr; - writer = XmlWriter::Create( L"sampledata.xml" ); - - // Write the root element. - writer->WriteStartElement( L"book" ); - - // Write the xmlns:bk="urn:book" namespace declaration. - writer->WriteAttributeString( L"xmlns", L"bk", nullptr, L"urn:book" ); - - // Write the bk:ISBN="1-800-925" attribute. - writer->WriteAttributeString( L"ISBN", L"urn:book", L"1-800-925" ); - writer->WriteElementString( L"price", L"19.95" ); - - // Write the close tag for the root element. - writer->WriteEndElement(); - - // Write the XML to file and close the writer. - writer->Flush(); - writer->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp deleted file mode 100644 index cd4481a5f86..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -void main() -{ - XmlReader^ reader = XmlReader::Create( L"test1.xml" ); - XmlWriterSettings^ settings = gcnew XmlWriterSettings; - settings->Indent = true; - XmlWriter^ writer = XmlWriter::Create( Console::Out ); - while ( reader->Read() ) - { - if ( reader->NodeType == XmlNodeType::Element ) - { - writer->WriteStartElement( reader->Name->ToUpper() ); - writer->WriteAttributes( reader, false ); - if ( reader->IsEmptyElement ) - writer->WriteEndElement(); - } - else - if ( reader->NodeType == XmlNodeType::EndElement ) - { - writer->WriteEndElement(); - } - } - - writer->Close(); - reader->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp deleted file mode 100644 index af773508941..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp +++ /dev/null @@ -1,143 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Text; -ref class TestBase64 -{ -private: - static int bufferSize = 4096; - -public: - - // Use the WriteBase64 method to create an XML document. The object - // passed by the user is encoded and included in the document. - void EncodeXmlFile( String^ xmlFileName, FileStream^ fileOld ) - { - array^buffer = gcnew array(bufferSize); - int readByte = 0; - XmlTextWriter^ xw = gcnew XmlTextWriter( xmlFileName,Encoding::UTF8 ); - xw->WriteStartDocument(); - xw->WriteStartElement( "root" ); - - // Create a Char writer. - BinaryReader^ br = gcnew BinaryReader( fileOld ); - - // Set the file pointer to the end. - try - { - do - { - readByte = br->Read( buffer, 0, bufferSize ); - xw->WriteBase64( buffer, 0, readByte ); - } - while ( bufferSize <= readByte ); - } - catch ( Exception^ ex ) - { - EndOfStreamException^ ex1 = gcnew EndOfStreamException; - if ( ex1->Equals( ex ) ) - Console::WriteLine( "We are at end of file" ); - else - Console::WriteLine( ex ); - } - - xw->WriteEndElement(); - xw->WriteEndDocument(); - xw->Flush(); - xw->Close(); - } - - // Use the ReadBase64 method to decode the new XML document - // and generate the original object. - void DecodeOrignalObject( String^ xmlFileName, FileStream^ fileNew ) - { - array^buffer = gcnew array(bufferSize); - int readByte = 0; - - // Create a file to write the bmp back. - BinaryWriter^ bw = gcnew BinaryWriter( fileNew ); - XmlTextReader^ tr = gcnew XmlTextReader( xmlFileName ); - tr->MoveToContent(); - Console::WriteLine( tr->Name ); - do - { - readByte = tr->ReadBase64( buffer, 0, bufferSize ); - bw->Write( buffer, 0, readByte ); - } - while ( readByte >= bufferSize ); - - bw->Flush(); - } - - // Compare the two files. - bool CompareResult( FileStream^ fileOld, FileStream^ fileNew ) - { - int readByteOld = 0; - int readByteNew = 0; - int count; - int readByte = 0; - array^bufferOld = gcnew array(bufferSize); - array^bufferNew = gcnew array(bufferSize); - BinaryReader^ binaryReaderOld = gcnew BinaryReader( fileOld ); - BinaryReader^ binaryReaderNew = gcnew BinaryReader( fileNew ); - binaryReaderOld->BaseStream->Seek( 0, SeekOrigin::Begin ); - binaryReaderNew->BaseStream->Seek( 0, SeekOrigin::Begin ); - do - { - readByteOld = binaryReaderOld->Read( bufferOld, 0, bufferSize ); - readByteNew = binaryReaderNew->Read( bufferNew, 0, bufferSize ); - if ( readByteOld != readByteNew ) - return false; - - for ( count = 0; count < bufferSize; ++count ) - if ( bufferOld[ count ] != bufferNew[ count ] ) - return false; - } - while ( count < readByte ); - - return true; - } - - // Display the usage statement. - void Usage() - { - Console::WriteLine( "TestBase64 sourceFile, targetFile \n" ); - Console::WriteLine( "For example: TestBase64 winlogon.bmp, target.bmp\n" ); - } -}; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - TestBase64^ testBase64 = gcnew TestBase64; - - // Check that the usage is correct. - if ( args->Length < 3 ) - { - testBase64->Usage(); - return 1; - } - - FileStream^ fileOld = gcnew FileStream( args[ 1 ],FileMode::OpenOrCreate,FileAccess::Read,FileShare::Read ); - testBase64->EncodeXmlFile( "temp.xml", fileOld ); - FileStream^ fileNew = gcnew FileStream( args[ 2 ],FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite ); - testBase64->DecodeOrignalObject( "temp.xml", fileNew ); - - // Compare the two files. - if ( testBase64->CompareResult( fileOld, fileNew ) ) - Console::WriteLine( "The recreated binary file {0} is the same as {1}", args[ 2 ], args[ 1 ] ); - else - Console::WriteLine( "The recreated binary file {0} is not the same as {1}", args[ 2 ], args[ 1 ] ); - - fileOld->Flush(); - fileNew->Flush(); - fileOld->Close(); - fileNew->Close(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp deleted file mode 100644 index 1b8726a4f19..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -public ref class Sample -{ -private: - static String^ m_Document = L"sampledata.xml"; - -public: - static void Main() - { - XmlWriter^ writer = nullptr; - try - { - XmlWriterSettings^ settings = gcnew XmlWriterSettings; - settings->Indent = true; - writer = XmlWriter::Create( m_Document,settings ); - writer->WriteComment( L"sample XML fragment" ); - - // Write an element (this one is the root). - writer->WriteStartElement( L"book" ); - - // Write the namespace declaration. - writer->WriteAttributeString( L"xmlns", L"bk", nullptr, L"urn:samples" ); - - // Write the genre attribute. - writer->WriteAttributeString( L"genre", L"novel" ); - - // Write the title. - writer->WriteStartElement( L"title" ); - writer->WriteString( L"The Handmaid's Tale" ); - writer->WriteEndElement(); - - // Write the price. - writer->WriteElementString( L"price", L"19.95" ); - - // Lookup the prefix and write the ISBN element. - String^ prefix = writer->LookupPrefix( L"urn:samples" ); - writer->WriteStartElement( prefix, L"ISBN", L"urn:samples" ); - writer->WriteString( L"1-861003-78" ); - writer->WriteEndElement(); - - // Write the style element (shows a different way to handle prefixes). - writer->WriteElementString( L"style", L"urn:samples", L"hardcover" ); - - // Write the close tag for the root element. - writer->WriteEndElement(); - - // Write the XML to file and close the writer. - writer->Flush(); - writer->Close(); - } - finally - { - if ( writer != nullptr ) - writer->Close(); - } - - } - -}; - -void main() -{ - Sample::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp deleted file mode 100644 index a34c595c6da..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ reader = gcnew XmlTextReader( "books.xml" ); - reader->WhitespaceHandling = WhitespaceHandling::None; - - // Move the reader to the first book element. - reader->MoveToContent(); - reader->Read(); - - // Create a writer that outputs to the console. - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - - // Write the start tag. - writer->WriteStartElement( "myBooks" ); - - // Write the first book. - writer->WriteNode( reader, false ); - - // Skip the second book. - reader->Skip(); - - // Write the last book. - writer->WriteNode( reader, false ); - writer->WriteEndElement(); - - // Close the writer and the reader. - writer->Close(); - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp b/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp deleted file mode 100644 index c26844cce27..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; - -int main() -{ - // - // Create a resolver with default credentials. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - resolver->Credentials = System::Net::CredentialCache::DefaultCredentials; - - // Create the XslTransform object. - XslTransform^ xslt = gcnew XslTransform; - - // Load the stylesheet. - xslt->Load( "http://myServer/data/authors.xsl", resolver ); - - // Transform the file. - xslt->Transform( "books.xml", "books.html", resolver ); - // -} diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp deleted file mode 100644 index c1c69b21c5d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; -int main() -{ - String^ filename = "books.xml"; - String^ stylesheet = "titles.xsl"; - - // Create the reader to load the stylesheet. - // Move the reader to the xsl:stylesheet node. - XmlTextReader^ reader = gcnew XmlTextReader( stylesheet ); - reader->Read(); - reader->Read(); - - // Create the XslTransform object and load the stylesheet. - XslTransform^ xslt = gcnew XslTransform; - xslt->Load( reader ); - - // Load the file to transform. - XPathDocument^ doc = gcnew XPathDocument( filename ); - - // Create an XmlTextWriter which outputs to the console. - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - - // Transform the file and send the output to the console. - xslt->Transform(doc,nullptr,writer); - writer->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp deleted file mode 100644 index 589fa928b67..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; -void TransformFile( XmlReader^ xsltReader, String^ secureURL ); -int main() -{ - String^ stylesheet = "c:\\tmp\\output.xsl"; - String^ myURL = "http://localhost/data"; - XmlTextReader^ reader = gcnew XmlTextReader( stylesheet ); - TransformFile( reader, myURL ); -} - - -// Perform an XSLT transformation where xsltReader is an XmlReader containing -// a stylesheet and secureURI is a trusted URI that can be used to create Evidence. -// -void TransformFile( XmlReader^ xsltReader, String^ secureURL ) -{ - - // Load the stylesheet using a default XmlUrlResolver and Evidence - // created using the trusted URL. - XslTransform^ xslt = gcnew XslTransform; - xslt->Load( xsltReader, gcnew XmlUrlResolver, XmlSecureResolver::CreateEvidenceForUrl( secureURL ) ); - - // Transform the file. - xslt->Transform("books.xml","books.html",gcnew XmlUrlResolver); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp deleted file mode 100644 index 4b4ca81384f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; - -int main() -{ -// - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - - // Modify the XML file. - XmlElement^ root = doc->DocumentElement; - root->FirstChild->LastChild->InnerText = "12.95"; - - // Create an XPathNavigator to use for the transform. - XPathNavigator^ nav = root->CreateNavigator(); - - // Transform the file. - XslTransform^ xslt = gcnew XslTransform; - xslt->Load( "output.xsl" ); - XmlTextWriter^ writer = gcnew XmlTextWriter( "books.html", nullptr ); - xslt->Transform( nav, nullptr, writer, nullptr); -// -} diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp deleted file mode 100644 index 93872c9a3c6..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Xml::XPath; - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - String^ UserName = args[ 1 ]; - String^ SecurelyStoredPassword = args[ 2 ]; - String^ Domain = args[ 3 ]; - - // - // Create the XslTransform object. - XslTransform^ xslt = gcnew XslTransform; - - // Load the stylesheet. - xslt->Load( "titles.xsl" ); - - // Create a resolver and specify the necessary credentials. - XmlUrlResolver^ resolver = gcnew XmlUrlResolver; - System::Net::NetworkCredential^ myCred; - myCred = gcnew System::Net::NetworkCredential( UserName, SecurelyStoredPassword, Domain ); - resolver->Credentials = myCred; - - // Transform the file using the resolver. The resolver is used - // to process the XSLT document() function. - XPathDocument^ doc = gcnew XPathDocument( "books.xml" ); - XmlReader^ reader = xslt->Transform( doc, nullptr, resolver ); - - // Load the reader into a new document for more processing. - XmlDocument^ xmldoc = gcnew XmlDocument; - xmldoc->Load( reader ); - // - - Console::WriteLine( xmldoc->OuterXml ); -} diff --git a/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp b/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp deleted file mode 100644 index 326d279b9ae..00000000000 --- a/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Xsl; - -int main() -{ - // - // Create the XslTransform object. - XslTransform^ xslt = gcnew XslTransform; - - // Load the stylesheet. - xslt->Load( "output.xsl" ); - - // Transform the file. - xslt->Transform("books.xml","books.html"); - // -} diff --git a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp deleted file mode 100644 index df2c6373e93..00000000000 --- a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/*System::Net::HttpWebRequest->AddRange(int, int) -This program demonstrates 'AddRange(int, int)' method of 'HttpWebRequest class. -A new 'HttpWebRequest' Object* is created. The number of characters of the response to be received can be -restricted by the 'AddRange' method.By calling 'AddRange(50, 150)' on the 'HttpWebRequest' Object* the content -of the response page is restricted from the 50th character to 150th charater. The response of the request is -obtained and displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; - -int main() -{ - try - { -// - // Create a New 'HttpWebRequest' object. - HttpWebRequest^ myHttpWebRequest1 = - (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - myHttpWebRequest1->AddRange( 1000); - Console::WriteLine("Call AddRange(1000)"); - Console::Write("Resulting Headers: "); - Console::WriteLine(myHttpWebRequest1->Headers); - - HttpWebRequest^ myHttpWebRequest2 = - (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - myHttpWebRequest2->AddRange(-1000); - Console::WriteLine("Call AddRange(-1000)"); - Console::Write("Resulting Headers: "); - Console::WriteLine(myHttpWebRequest2->Headers); - -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp deleted file mode 100644 index 68d09127497..00000000000 --- a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/*System::Net::HttpWebRequest->AddRange(int, int) -This program demonstrates 'AddRange(int, int)' method of 'HttpWebRequest class. -A new 'HttpWebRequest' Object* is created. The number of characters of the response to be received can be -restricted by the 'AddRange' method.By calling 'AddRange(50, 150)' on the 'HttpWebRequest' Object* the content -of the response page is restricted from the 50th character to 150th charater. The response of the request is -obtained and displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; - -int main() -{ - try - { -// - // Create a New 'HttpWebRequest' object. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - myHttpWebRequest->AddRange( 50, 150 ); - Console::WriteLine("Call AddRange(50, 150)"); - Console::Write("Resulting Request Headers: "); - Console::WriteLine(myHttpWebRequest->Headers); - - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - - // Displays the headers in the response received - Console::Write("Resulting Response Headers: "); - Console::WriteLine(myHttpWebResponse->Headers); - - // Display the contents of the page to the console. - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuffer = gcnew array(256); - int count = streamRead->Read( readBuffer, 0, 256 ); - Console::WriteLine( "\nThe HTML contents of the page from 50th to 150 charaters are :\n " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuffer,0,count ); - Console::WriteLine( outputData ); - count = streamRead->Read( readBuffer, 0, 256 ); - } - streamRead->Close(); - streamResponse->Close(); - myHttpWebResponse->Close(); -// - Console::WriteLine( "\nPress 'Enter' Key to Continue..........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp b/snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp deleted file mode 100644 index 188aacb6278..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System.Runtime.Remoting.ActivatedServiceTypeEntry -// System.Runtime.Remoting.ActivatedServiceTypeEntry.ObjectType -// System.Runtime.Remoting.ActivatedServiceTypeEntry.ToString - -/* -The following example demonstrates the 'ActivatedServiceTypeEntry' class and -the 'ObjectType' property ,'ToString' method of 'ActivatedServiceTypeEntry' class. -It registers a 'TcpChannel' object with the channel services. Then registers the 'HelloServer' -object at the service end that can be activated on request from a client.By using the -'GetRegisteredActivatedServiceTypes' method it gets the registered activated service types -and displays it's information to the console:: -*/ - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -void main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); - - // Create an instance of 'ActivatedServiceTypeEntry' class - // which holds the values for 'HelloServer' type. - ActivatedServiceTypeEntry^ myActivatedServiceTypeEntry = - gcnew ActivatedServiceTypeEntry( HelloServer::typeid ); - - // Register an object Type on the service end so that - // it can be activated on request from a client. - RemotingConfiguration::RegisterActivatedServiceType( - myActivatedServiceTypeEntry ); - -// -// - // Get the registered activated service types. - array^ activatedServiceEntries = - RemotingConfiguration::GetRegisteredActivatedServiceTypes(); - Console::WriteLine( "Information of first registered activated" + - " service type :" ); - Console::WriteLine( "Object type: {0}", - activatedServiceEntries[ 0 ]->ObjectType->ToString() ); - Console::WriteLine( "Description: {0}", - activatedServiceEntries[ 0 ]->ToString() ); -// -// - - Console::WriteLine( "Press enter to stop this process" ); - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp b/snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp deleted file mode 100644 index eaec1a8cfc9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// System.Net.AuthenticationManager.UnRegister(String). -// System.Net.AuthenticationManager.Register. -// Grouping Clause : 1,3 AND 2,3. - -/*This program demonstrates the 'UnRegister(String)' and 'Register' methods of -'AuthenticationManager' class. It gets all the authentication modules registered with the system into an -IEnumerator instance ,unregisters the first authentication module and displays to show that it was -unregistered. Then registers the same module back again and displays all the modules again.*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Collections; - -// -void DisplayAllModules() -{ - IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; - Console::WriteLine( "\n\tThe following modules are now registered with the system:" ); - while ( registeredModules->MoveNext() ) - { - Console::WriteLine( "\n\t\tModule : {0}", registeredModules->Current ); - IAuthenticationModule^ currentAuthenticationModule = dynamic_cast(registeredModules->Current); - Console::WriteLine( "\t\t\t CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate ); - } -} -// - -int main() -{ - try - { -// -// - IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; - // Display all the modules that are already registered with the system. - DisplayAllModules(); - registeredModules->Reset(); - registeredModules->MoveNext(); - // Get the first Authentication module registered with the system. - IAuthenticationModule^ authenticationModule1 = dynamic_cast(registeredModules->Current); - // Call the UnRegister() method to unregister the first authentication module from the system. - String^ authenticationScheme = authenticationModule1->AuthenticationType; - AuthenticationManager::Unregister( authenticationScheme ); - Console::WriteLine( "\nSuccessfully unregistered '{0}'.", authenticationModule1 ); - // Display all modules to see that the module was unregistered. - DisplayAllModules(); -// - // Calling 'Register()' method to register 'authenticationModule1' module back again. - AuthenticationManager::Register( authenticationModule1 ); - Console::WriteLine( "\nSuccessfully re-registered '{0}'.", authenticationModule1 ); - // Display the modules to verify that 'authenticationModule1' has been registered back again. - DisplayAllModules(); -// - Console::WriteLine( "Press any key to continue" ); - Console::ReadLine(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\n The following Exception was raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp b/snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp deleted file mode 100644 index 9d25d5c5604..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp +++ /dev/null @@ -1,104 +0,0 @@ - - -// System::Net::Authorization::Authorization(String*, bool, String*) -/* This program demonstrates the contructor 'Authorization(String*, bool, String*)' of the authorization -* class. -* -* We implement the interface S"IAuthenticationModule*" to make CloneBasic which is a custom authentication module. -* The custom authentication module encodes username and password as base64 strings and then returns -* back an authorization instance. This authorization is internally used by the HttpWebRequest for -* authentication. -* * -* Please Note : This program has to be compiled as a dll. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -namespace CloneBasicAuthentication -{ - public ref class CloneBasic: public IAuthenticationModule - { - private: - String^ m_authenticationType; - bool m_canPreAuthenticate; - - public: - CloneBasic() - { - m_authenticationType = "CloneBasic"; - m_canPreAuthenticate = false; - } - - property String^ AuthenticationType - { - virtual String^ get() - { - return m_authenticationType; - } - } - - property bool CanPreAuthenticate - { - virtual bool get() - { - return m_canPreAuthenticate; - } - } - - // - virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) - { - try - { - String^ message; - - // Check if Challenge String* was raised by a site which requires CloneBasic authentication. - if ( (challenge == nullptr) || ( !challenge->StartsWith( "CloneBasic" )) ) - return nullptr; - NetworkCredential^ myCredentials; - if ( dynamic_cast(credentials) == nullptr ) - { - myCredentials = credentials->GetCredential( request->RequestUri, "CloneBasic" ); - if ( myCredentials == nullptr ) - return nullptr; - } - else - myCredentials = dynamic_cast(credentials); - - // Message encryption scheme : - // a)Concatenate username and password seperated by space; - // b)Apply ASCII encoding to obtain a stream of bytes; - // c)Apply Base64 Encoding to this array of bytes to obtain our encoded authorization message. - message = String::Concat( myCredentials->UserName, " ", myCredentials->Password ); - - // Apply AsciiEncoding to our user name and password to obtain it as an array of bytes. - Encoding^ asciiEncoding = Encoding::ASCII; - array^byteArray = gcnew array(asciiEncoding->GetByteCount( message )); - byteArray = asciiEncoding->GetBytes( message ); - - // Perform Base64 transform. - message = Convert::ToBase64String( byteArray ); - - // The following overloaded contructor sets the 'Message' property of authorization to the base64 String*; - // that we just formed and it also sets the 'Complete' property to true and the connection group id; - // to the domain of the NetworkCredential Object*. - Authorization^ myAuthorization = gcnew Authorization( String::Concat( "CloneBasic ", message, true, request->ConnectionGroupName ) ); - return myAuthorization; - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Raised ...: {0}", e->Message ); - return nullptr; - } - } - // - - virtual Authorization^ PreAuthenticate( WebRequest^ request, ICredentials^ credentials ) - { - return nullptr; - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp b/snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp deleted file mode 100644 index 6f0a633e81e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp +++ /dev/null @@ -1,192 +0,0 @@ - - -// System::Net::Authorization::Authorization(String*, bool);System::Net::Authorization::ProtectionRealm -/* This program demonstrates the 'ProtectionRealm' property and 'Authorization(String*, bool)' constructor of -the S"Authorization" class. The S"IAuthenticationModule*" interface is implemented in 'CloneBasic' to make -it a custom authentication module. The custom authentication module encodes username and password as -base64 strings and then returns back an 'Authorization' instance. The 'Authorization' instance encapsulates -a list of Uri's for which it is applicable using the S"ProtectionRealm" property. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -void GetPage( String^ url, String^ username, String^ passwd ) -{ - try - { - String^ challenge = nullptr; - HttpWebRequest^ myHttpWebRequest = nullptr; - try - { - // Create a 'HttpWebRequest' Object* for the above 'url'. - myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); - - // The following method call throws the 'WebException'. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Release resources of response Object*. - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - for ( int i = 0; i < e->Response->Headers->Count; ++i ) - - // Retrieve the challenge String* from the header S"WWW-Authenticate". - if ( (String::Compare( e->Response->Headers->Keys[ i ], "WWW-Authenticate", true ) == 0) ) - challenge = e->Response->Headers[ i ]; - } - - if ( challenge != nullptr ) - { - // Challenge was raised by the client.Declare your credentials. - NetworkCredential^ myCredentials = gcnew NetworkCredential( username,passwd ); - - // Pass the challenge , 'NetworkCredential' Object* and the 'HttpWebRequest' Object* to the - // 'Authenticate' method of the S"AuthenticationManager" to retrieve an S"Authorization" ; - // instance. - Authorization^ urlAuthorization = AuthenticationManager::Authenticate( challenge, myHttpWebRequest, myCredentials ); - if ( urlAuthorization != nullptr ) - { - Console::WriteLine( "\nSuccessfully Created 'Authorization' object with authorization Message:\n \" {0}\"", urlAuthorization->Message ); - Console::WriteLine( "\n\nThis authorization is valid for the following Uri's:" ); - int count = 0; - System::Collections::IEnumerator^ myEnum = urlAuthorization->ProtectionRealm->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ uri = safe_cast(myEnum->Current); - ++count; - Console::WriteLine( "\nUri->Item[ {0}]: {1}", count, uri ); - } - } - else - Console::WriteLine( "\nAuthorization Object* was returned as 0. Please check if site accepts 'CloneBasic' authentication" ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "\n The following exception was raised : {0}", e->Message ); - } -} - -void PrintUsage() -{ - Console::WriteLine( "\r\nUsage: Try a site which requires CloneBasic(custom made) authentication as below" ); - Console::WriteLine( " Authorization_ProtectionRealm URLname username password" ); - Console::WriteLine( "\nExample:" ); - Console::WriteLine( "\n Authorization_ProtectionRealm http://www.microsoft.com/net/ george george123" ); -} - -// The 'CloneBasic' authentication module class implements 'IAuthenticationModule*'. -public ref class CloneBasic: public IAuthenticationModule -{ -private: - String^ m_authenticationType; - bool m_canPreAuthenticate; - -public: - CloneBasic() - { - m_authenticationType = "CloneBasic"; - m_canPreAuthenticate = false; - } - - property String^ AuthenticationType - { - virtual String^ get() - { - return m_authenticationType; - } - } - - property bool CanPreAuthenticate - { - virtual bool get() - { - return m_canPreAuthenticate; - } - } - - // - // - virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) - { - try - { - String^ message; - - // Check if Challenge String* was raised by a site which requires 'CloneBasic' authentication. - if ( (challenge == nullptr) || ( !challenge->StartsWith( "CloneBasic" )) ) - return nullptr; - NetworkCredential^ myCredentials; - if ( dynamic_cast(credentials) == nullptr ) - { - myCredentials = credentials->GetCredential( request->RequestUri, "CloneBasic" ); - if ( myCredentials == nullptr ) - return nullptr; - } - else - myCredentials = dynamic_cast(credentials); - - // Message encryption scheme : - // a)Concatenate username and password seperated by space; - // b)Apply ASCII encoding to obtain a stream of bytes; - // c)Apply Base64 Encoding to this array of bytes to obtain our encoded authorization message. - message = String::Concat( myCredentials->UserName, " ", myCredentials->Password ); - - // Apply AsciiEncoding to 'message' String* to obtain it as an array of bytes. - Encoding^ ascii = Encoding::ASCII; - array^byteArray = gcnew array(ascii->GetByteCount( message )); - byteArray = ascii->GetBytes( message ); - - // Performing Base64 transformation. - message = Convert::ToBase64String( byteArray ); - Authorization^ myAuthorization = gcnew Authorization( String::Concat( "CloneBasic ", message, true ) ); - array^protectionRealm = gcnew array(1); - protectionRealm[ 0 ] = request->RequestUri->AbsolutePath; - myAuthorization->ProtectionRealm = protectionRealm; - return myAuthorization; - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised in Authenticate method: {0}", e->Message ); - return nullptr; - } - } - // - // - - virtual Authorization^ PreAuthenticate( WebRequest^ request, ICredentials^ credentials ) - { - return nullptr; - } -}; - -// The 'Client' class is defined here to test the above custom authentication module. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - String^ url; - String^ userName; - String^ passwd; - if ( args->Length < 3 ) - { - PrintUsage(); - return 0; - } - else - { - url = args[ 0 ]; - userName = args[ 1 ]; - passwd = args[ 2 ]; - } - - Console::WriteLine(); - CloneBasic^ authenticationModule = gcnew CloneBasic; - AuthenticationManager::Register( authenticationModule ); - AuthenticationManager::Unregister( "Basic" ); - - // Get response from Uri. - GetPage( url, userName, passwd ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp deleted file mode 100644 index 6bc8503b66d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp +++ /dev/null @@ -1,170 +0,0 @@ -// System.Web.Services.Description.Binding.Binding();System.Web.Services.Description.Binding.Name; -// System.Web.Services.Description.Binding.Type;System.Web.Services.Description.Binding.Extensions;System.Web.Services.Description.Binding.Operations; -// System.Web.Services.Description.BindingCollection.Insert; -// System.Web.Services.Description.Binding.ServiceDescription; - -// Grouping Clause : Snippet5 and Snippet8 go together. - -/* The following example demonstrates the constructor 'Binding()' and properties 'Extensions','Name','Operations', - 'ServiceDescription' and 'Type' property of 'Binding' class AND method 'Insert' of 'BindingCollection' class. - The input to the program is a WSDL file 'MathService_input.wsdl' with all information related to SOAP protocol - removed from it. In a way, it tries to simulate a scenario wherein a service initially did not support a protocol, however later - on happen to support it. - In this example, the WSDL file is modified to insert a new Binding for SOAP. The binding is populated based on - WSDL document structure defined in WSDL specification. The ServiceDescription instance is loaded with values - for 'Messages', 'PortTypes','Bindings', and 'Port'. The instance is then written to an external file 'MathService_new.wsdl'. - * */ - -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -ref class MyClass -{ -public: - // Creates a Message with name ="messageName" having one MessagePart with name = "partName". - static Message^ CreateMessage( String^ messageName, String^ partName, String^ element, String^ targetNamespace ) - { - Message^ myMessage = gcnew Message; - myMessage->Name = messageName; - MessagePart^ myMessagePart = gcnew MessagePart; - myMessagePart->Name = partName; - myMessagePart->Element = gcnew XmlQualifiedName( element,targetNamespace ); - myMessage->Parts->Add( myMessagePart ); - return myMessage; - } - - // Used to create Operations under PortType. - static Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) - { - Operation^ myOperation = gcnew Operation; - myOperation->Name = operationName; - OperationMessage^ input = (OperationMessage^)( gcnew OperationInput ); - input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); - OperationMessage^ output = (OperationMessage^)( gcnew OperationOutput ); - output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); - myOperation->Messages->Add( input ); - myOperation->Messages->Add( output ); - return myOperation; - } - -// - // Used to create OperationBinding instances within 'Binding'. -public: - static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) - { - // Create OperationBinding instance for operation. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = operation; - // Create InputBinding for operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - // Create extensibility element for 'SoapOperationBinding'. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation ); - // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - return myOperationBinding; - } -// - - static void Main() - { - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input.wsdl" ); - // Create SOAP Messages. - myServiceDescription->Messages->Add( CreateMessage( "AddSoapIn", "parameters", "Add", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "AddSoapOut", "parameters", "AddResponse", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapIn", "parameters", "Subtract", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapOut", "parameters", "SubtractResponse", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapIn", "parameters", "Multiply", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapOut", "parameters", "MultiplyResponse", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "DivideSoapIn", "parameters", "Divide", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "DivideSoapOut", "parameters", "DivideResponse", myServiceDescription->TargetNamespace ) ); - - // Create a new PortType. - PortType^ soapPortType = gcnew PortType; - soapPortType->Name = "MathServiceSoap"; - soapPortType->Operations->Add( CreateOperation( "Add", "AddSoapIn", "AddSoapOut", myServiceDescription->TargetNamespace ) ); - soapPortType->Operations->Add( CreateOperation( "Subtract", "SubtractSoapIn", "SubtractSoapOut", myServiceDescription->TargetNamespace ) ); - soapPortType->Operations->Add( CreateOperation( "Multiply", "MultiplySoapIn", "MultiplySoapOut", myServiceDescription->TargetNamespace ) ); - soapPortType->Operations->Add( CreateOperation( "Divide", "DivideSoapIn", "DivideSoapOut", myServiceDescription->TargetNamespace ) ); - myServiceDescription->PortTypes->Add( soapPortType ); - -// -// -// - // Create a new Binding for SOAP Protocol. - Binding^ myBinding = gcnew Binding; - myBinding->Name = String::Concat( myServiceDescription->Services->default[ 0 ]->Name, "Soap" ); -// - -// - // Pass the name of the existing porttype 'MathServiceSoap' and the Xml targetNamespace attribute of the Descriptions tag. - myBinding->Type = gcnew XmlQualifiedName( "MathServiceSoap",myServiceDescription->TargetNamespace ); -// - -// - // Create SOAP Extensibility element. - SoapBinding^ mySoapBinding = gcnew SoapBinding; - // SOAP over HTTP. - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - // Add tag soap:binding as an extensibility element. - myBinding->Extensions->Add( mySoapBinding ); -// - -// - // Create OperationBindings for each of the operations defined in asmx file. - OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( addOperationBinding ); - OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( subtractOperationBinding ); - OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( multiplyOperationBinding ); - OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( divideOperationBinding ); -// - - myServiceDescription->Bindings->Insert( 0, myBinding ); -// -// - -// - Console::WriteLine( "\nTarget Namespace of the Service Description to which the binding was added is:{0}", myServiceDescription->Bindings->default[ 0 ]->ServiceDescription->TargetNamespace ); -// - - // Create Port. - Port^ soapPort = gcnew Port; - soapPort->Name = "MathServiceSoap"; - soapPort->Binding = gcnew XmlQualifiedName( myBinding->Name,myServiceDescription->TargetNamespace ); - // Create SoapAddress extensibility element to add to port. - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/BindingCollectionSample/MathService.asmx"; - soapPort->Extensions->Add( mySoapAddressBinding ); - // Add port to the MathService which is the first service in the Service Collection. - myServiceDescription->Services->default[ 0 ]->Ports->Add( soapPort ); - // Save the ServiceDescription instance to an external file. - myServiceDescription->Write( "MathService_new.wsdl" ); - Console::WriteLine( "\nSuccessfully added bindings for SOAP protocol and saved results in file MathService_new.wsdl" ); - Console::WriteLine( "\n This file should be passed to wsdl tool as input to generate proxy" ); - } -}; - -int main() -{ - MyClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp deleted file mode 100644 index 1e66ce14ccb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -// System::Web::Services::Description.BindingCollection;System::Web::Services::Description.BindingCollection::Item->Item[Int32]; -// System::Web::Services::Description.BindingCollection::Item->Item[String];System::Web::Services::Description.BindingCollection::CopyTo -/* The program reads a wsdl document S"MathService::wsdl" and instantiates a -// ServiceDescription instance from the WSDL document.A BindingCollection instance -// is then retrieved from this ServiceDescription instance and it's members are demonstrated. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - Binding^ myBinding; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input.wsdl" ); - Console::WriteLine( "Total Number of bindings : {0}", myServiceDescription->Bindings->Count ); - - // - for ( int i = 0; i < myServiceDescription->Bindings->Count; ++i ) - { - Console::WriteLine( "\nBinding {0}", i ); - - // Get Binding at index i. - myBinding = myServiceDescription->Bindings[ i ]; - Console::WriteLine( "\t Name : {0}", myBinding->Name ); - Console::WriteLine( "\t Type : {0}", myBinding->Type ); - } - // - - // - array^myBindings = gcnew array(myServiceDescription->Bindings->Count); - - // Copy BindingCollection to an Array. - myServiceDescription->Bindings->CopyTo( myBindings, 0 ); - Console::WriteLine( "\n\n Displaying array copied from BindingCollection" ); - for ( int i = 0; i < myServiceDescription->Bindings->Count; ++i ) - { - Console::WriteLine( "\nBinding {0}", i ); - Console::WriteLine( "\t Name : {0}", myBindings[ i ]->Name ); - Console::WriteLine( "\t Type : {0}", myBindings[ i ]->Type ); - } - // - - // - // Get Binding Name = S"MathServiceSoap". - myBinding = myServiceDescription->Bindings[ "MathServiceHttpGet" ]; - if ( myBinding != nullptr ) - { - Console::WriteLine( "\n\nName : {0}", myBinding->Name ); - Console::WriteLine( "Type : {0}", myBinding->Type ); - } - // - - myServiceDescription = nullptr; - myBinding = nullptr; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp deleted file mode 100644 index 3be2280b84d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -// System::Web::Services::Description.BindingCollection;System::Web::Services::Description.Remove;System::Web::Services::Description.Add; -// System::Web::Services::Description.Contains;System::Web::Services::Description.IndexOf -/*The following example reads the contents of a file 'MathService::wsdl' into a ServiceDescription instance. -Removes first binding in the BindingCollection of the ServiceDescription instance and writes the current -'ServiceDescription' instance into a temporary file. -Adds the same binding back again into the instance and writes to another temporary file. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - Binding^ myBinding; - - // - // - // - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input.wsdl" ); - Console::WriteLine( "Total Number of bindings defined are: {0}", myServiceDescription->Bindings->Count ); - myBinding = myServiceDescription->Bindings[ 0 ]; - - // Remove the first binding in the collection. - myServiceDescription->Bindings->Remove( myBinding ); - Console::WriteLine( "Successfully removed binding {0}", myBinding->Name ); - Console::WriteLine( "Total Number of bindings defined now are: {0}", myServiceDescription->Bindings->Count ); - myServiceDescription->Write( "MathService_temp.wsdl" ); - // - - // Add binding to the ServiceDescription instance. - myServiceDescription->Bindings->Add( myBinding ); - // - - if ( myServiceDescription->Bindings->Contains( myBinding ) ) - Console::WriteLine( "Successfully added binding {0}", myBinding->Name ); - // - - Console::WriteLine( "Binding was added at index {0}", myServiceDescription->Bindings->IndexOf( myBinding ) ); - Console::WriteLine( "Total Number of bindings defined now are: {0}", myServiceDescription->Bindings->Count ); - myServiceDescription->Write( "MathService_temp1.wsdl" ); - // - * myServiceDescription = 0; - - myBinding = nullptr; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp deleted file mode 100644 index e138ddb4a2f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Principal; -int main() -{ - GenericIdentity^ ident = gcnew GenericIdentity( "Bob" ); - array^id = gcnew array(1); - id[ 0 ] = "Level1"; - GenericPrincipal^ prpal = gcnew GenericPrincipal( ident,id ); - LogicalCallContextData ^ data = gcnew LogicalCallContextData( prpal ); - - //Enter data into the CallContext - CallContext::SetData( "test data", data ); - Console::WriteLine( data->numOfAccesses ); - ChannelServices::RegisterChannel( gcnew TcpChannel ); - RemotingConfiguration::RegisterActivatedClientType( HelloServiceClass::typeid, "tcp://localhost:8082" ); - HelloServiceClass ^ service = gcnew HelloServiceClass; - if ( service == nullptr ) - { - Console::WriteLine( "Could not locate server." ); - return 0; - } - - // call remote method - Console::WriteLine(); - Console::WriteLine( "Calling remote Object*" ); - Console::WriteLine( service->HelloMethod( "Caveman" ) ); - Console::WriteLine( service->HelloMethod( "Spaceman" ) ); - Console::WriteLine( service->HelloMethod( "Bob" ) ); - Console::WriteLine( "Finished remote Object* call" ); - Console::WriteLine(); - - //Extract the returned data from the call context - LogicalCallContextData ^ returnedData = static_cast(CallContext::GetData( "test data" )); - Console::WriteLine( data->numOfAccesses ); - Console::WriteLine( returnedData->numOfAccesses ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp deleted file mode 100644 index 62c2799b868..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp +++ /dev/null @@ -1,94 +0,0 @@ - -using namespace System; -using namespace System::Text; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Principal; - -// -[Serializable] -public ref class LogicalCallContextData: public ILogicalThreadAffinative -{ -private: - int _nAccesses; - IPrincipal^ _principal; - -public: - - property String^ numOfAccesses - { - String^ get() - { - return String::Format( "The identity of {0} has been accessed {1} times.", _principal->Identity->Name, _nAccesses ); - } - } - - property IPrincipal^ Principal - { - IPrincipal^ get() - { - _nAccesses++; - return _principal; - } - } - - LogicalCallContextData( IPrincipal^ p ) - { - _nAccesses = 0; - _principal = p; - } - -}; -// - -// -using namespace System; -using namespace System::Text; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Principal; -using namespace System::Security::Permissions; - -ref class LogicalCallContextData; - -public ref class HelloServiceClass: public MarshalByRefObject -{ -private: - static int n_instances; - int instanceNum; - -public: - HelloServiceClass() - { - n_instances++; - instanceNum = n_instances; - Console::WriteLine( "{0} has been created. Instance # = {1}", this->GetType()->Name, instanceNum ); - } - - ~HelloServiceClass() - { - Console::WriteLine( "Destroyed instance {0} of HelloServiceClass.", instanceNum ); - } - - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - String^ HelloMethod( String^ name ) - { - //Extract the call context data - LogicalCallContextData^ data = dynamic_cast(CallContext::GetData( "test data" )); - IPrincipal^ myPrincipal = data->Principal; - - //Check the user identity - if ( myPrincipal->Identity->Name == "Bob" ) - { - Console::WriteLine( "\nHello {0}, you are identified!", myPrincipal->Identity->Name ); - Console::WriteLine( data->numOfAccesses ); - } - else - { - Console::WriteLine( "Go away! You are not identified!" ); - return String::Empty; - } - - // calculate and return result to client - return String::Format( "Hi there {0}.", name ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp deleted file mode 100644 index f5539f7655b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// System::Runtime::Remoting::CallContext.FreeNamedDataSlot(String*) -// System::Runtime::Remoting::CallContext.GetHeaders() -// System::Runtime::Remoting::CallContext.SetHeaders(Header->Item[]) - -/* The following example demonstrates 'FreeNamedDataSlot', 'GetHeaders', -and 'SetHeaders' methods of 'CallContext' class. - -In the example 'SetData' method is used to set dataSlot. The 'DataSlot' is freed using -'FreeNamedDataSlot' method by passing the Name parameter. -For Setting header an array of type 'Messaging::Header' is passed with method call. -Headers are set in 'HeaderMethod' of remote Object* using 'SetHeaders' method. -Finally the 'GetHeaders' method is used to get all headers. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Security; -using namespace System::Security::Principal; -using namespace System::Collections; - -int main() -{ -// - // Register the channel. - TcpChannel^ myChannel = gcnew TcpChannel; - ChannelServices::RegisterChannel( myChannel ); - RemotingConfiguration::RegisterActivatedClientType( HelloService::typeid, "Tcp://localhost:8082" ); - - GenericIdentity^ myIdentity = gcnew GenericIdentity( "Bob" ); - array^ idStr = gcnew array(1); - idStr[ 0 ] = "Level1"; - GenericPrincipal^ myPrincipal = gcnew GenericPrincipal( myIdentity, idStr ); - MyLogicalCallContextData ^ myData = gcnew MyLogicalCallContextData( myPrincipal ); - - // Set DataSlot with name parameter. - CallContext::SetData( "test data", myData ); - - // Create a remote Object*. - HelloService ^ myService = gcnew HelloService; - if ( myService == nullptr ) - { - Console::WriteLine( "Cannot locate server." ); - return -1; - } - - // Call the Remote methods. - Console::WriteLine( "Remote method output is {0}", myService->HelloMethod( "Microsoft" ) ); - - MyLogicalCallContextData ^ myReturnData = - (MyLogicalCallContextData^)( CallContext::GetData( "test data" ) ); - if ( myReturnData == nullptr ) - { - Console::WriteLine( "Data is 0." ); - } - else - { - Console::WriteLine( "Data is ' {0}'", myReturnData->numOfAccesses ); - } - - // DataSlot with same Name Parameter which was Set is Freed. - CallContext::FreeNamedDataSlot( "test data" ); - MyLogicalCallContextData ^ myReturnData1 = - (MyLogicalCallContextData^)( CallContext::GetData( "test data" ) ); - if ( myReturnData1 == nullptr ) - { - Console::WriteLine( "FreeNamedDataSlot Successful for test data" ); - } - else - { - Console::WriteLine( "FreeNamedDataSlot Failed for test data" ); - } -// - -// - // Array of Headers with name and values initialized. - array^ myArrSetHeader = { gcnew Header( "Header0","CallContextHeader0" ), - gcnew Header( "Header1","CallContextHeader1" ) }; - - // Pass the Header Array with method call. - // Header will be set in the method by'CallContext::SetHeaders' method in remote Object*. - Console::WriteLine( "Remote HeaderMethod output is {0}", - myService->HeaderMethod( "CallContextHeader", myArrSetHeader ) ); - - array^ myArrGetHeader; - // Get Header Array. - myArrGetHeader = CallContext::GetHeaders(); - if ( nullptr == myArrGetHeader ) - { - Console::WriteLine( "CallContext::GetHeaders Failed" ); - } - else - { - Console::WriteLine( "Headers:" ); - } - - for each ( Header^ myHeader in myArrGetHeader ) - { - Console::WriteLine( "Value in Header '{0}' is '{1}'.", - myHeader->Name, myHeader->Value ); - } -// -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp deleted file mode 100644 index 0881c0e9ab0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// System::Runtime::Remoting::CallContext.SetHeaders(Header->Item[]) - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Security; -using namespace System::Security::Principal; -using namespace System::Security::Permissions; - -// -public ref class HelloService: public MarshalByRefObject -{ -public: - String^ HelloMethod( String^ name ) - { - Console::WriteLine( "Hello {0}", name ); - return "Hello {0}",name; - } - - - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - String^ HeaderMethod( String^ name, array^arrHeader ) - { - Console::WriteLine( "HeaderMethod {0}", name ); - - //Header Set with the header array passed - CallContext::SetHeaders( arrHeader ); - return "HeaderMethod {0}",name; - } -}; -// - -// 'CallContext' and 'ILogicalThreadAffinative*' is needed to pass information between threads -// on either end of a call across an application domain boundary or context boundary. - -[Serializable] -public ref class MyLogicalCallContextData: public ILogicalThreadAffinative -{ -private: - int noOfAccesses; - IPrincipal^ myIprincipal; - -public: - property String^ numOfAccesses - { - String^ get() - { - return String::Format( "The identity of {0} has been accessed {1} times.", - myIprincipal->Identity->Name, noOfAccesses ); - } - } - - property IPrincipal^ Principal - { - IPrincipal^ get() - { - noOfAccesses++; - return myIprincipal; - } - } - - MyLogicalCallContextData( IPrincipal^ p ) - { - noOfAccesses = 0; - myIprincipal = p; - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp deleted file mode 100644 index 9bd8438fc36..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -// System.Runtime.Remoting.Channels.ChannelServices.GetChannel -// System.Runtime.Remoting.Channels.ChannelServices.GetChannelSinkProperties -/* -This example demonstrates the usage of the properties 'GetChannel' and -'GetChannelSinkProperties' of the 'ChannelServices' class. It displays -the registered channel name, priority and channelsinkproperties -for a given proxy and executes a remote method 'HelloMethod'. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Collections; -using namespace System::Collections::Specialized; -int main() -{ - ListDictionary^ myProperties = gcnew ListDictionary; - myProperties->Add( "port", 8085 ); - myProperties->Add( "name", "MyHttpChannel" ); - - // - HttpChannel^ myClientChannel = gcnew HttpChannel( myProperties,gcnew SoapClientFormatterSinkProvider,gcnew SoapServerFormatterSinkProvider ); - ChannelServices::RegisterChannel( myClientChannel, false ); - - // Get the registered channel. - Console::WriteLine( "Channel Name : {0}", ChannelServices::GetChannel( myClientChannel->ChannelName )->ChannelName ); - Console::WriteLine( "Channel Priorty : {0}", ChannelServices::GetChannel( myClientChannel->ChannelName )->ChannelPriority ); - - // - RemotingSamples::HelloServer^ myProxy = dynamic_cast(Activator::GetObject( RemotingSamples::HelloServer::typeid, "http://localhost:8086/SayHello" )); - - // - // Get an IDictionary of properties for a given proxy. - IDictionary^ myDictionary = ChannelServices::GetChannelSinkProperties( myProxy ); - ICollection^ myKeysCollection = myDictionary->Keys; - array^myKeysArray = gcnew array(myKeysCollection->Count); - ICollection^ myValuesCollection = myDictionary->Values; - array^myValuesArray = gcnew array(myValuesCollection->Count); - myKeysCollection->CopyTo( myKeysArray, 0 ); - myValuesCollection->CopyTo( myValuesArray, 0 ); - for ( int iIndex = 0; iIndex < myKeysArray->Length; iIndex++ ) - { - Console::WriteLine( "Property Name : {0} value : {1}", myKeysArray[ iIndex ], myValuesArray[ iIndex ] ); - - } - // - if ( myProxy == nullptr ) - System::Console::WriteLine( "Could not locate server" ); - else - Console::WriteLine( myProxy->HelloMethod( "Caveman" ) ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp deleted file mode 100644 index 21547e27699..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -// System.Runtime.Remoting.Channels.ChannelServices.GetUrlsForObject(MarshalByRefObject) -/* -The following example demonstrates the method 'GetUrlsForObject' -of the class 'ChannelServices'. The example is just a client, it -locates and connects to the server, retrieves a proxy for the remote -object, and calls the 'HelloMethod' on the remote object, passing the -string 'Caveman' as a parameter. The server returns the string -'Hi there Caveman'. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Channels::Http; - -int main() -{ - try - { - TcpChannel^ myTcpChannel = gcnew TcpChannel( 8084 ); - ChannelServices::RegisterChannel( myTcpChannel ); - RemotingSamples::HelloServer ^ myHelloServer = dynamic_cast(Activator::GetObject( RemotingSamples::HelloServer::typeid, "tcp://localhost:8080/SayHello" )); - if ( myHelloServer == nullptr ) - System::Console::WriteLine( "Could not locate server" ); - else - { - - // - array^myURLArray = ChannelServices::GetUrlsForObject( myHelloServer ); - Console::WriteLine( "Number of URLs for the specified Object: {0}", myURLArray->Length ); - for ( int iIndex = 0; iIndex < myURLArray->Length; iIndex++ ) - Console::WriteLine( "URL: {0}", myURLArray[ iIndex ] ); - // - - Console::WriteLine( myHelloServer->HelloMethod( "Caveman" ) ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "The source of exception: {0}", e->Source ); - Console::WriteLine( "The Message of exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp deleted file mode 100644 index 66308d44723..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -// System.Runtime.Remoting.Channels.ChannelServices -// System.Runtime.Remoting.Channels.ChannelServices.RegisteredChannels -// System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(IChannel[]) -/* -The following example demonstrates the property 'RegisteredChannels' -of the class 'ChannelServices', its method 'UnregisterChannel', -and usage of the class 'ChannelServices'. The example demonstrates -the remoting version of a server. When a client calls the -'HelloMethod' on the 'HelloServer' class, the server object appends the -string passed from the client to the string "Hi There" and returns the -resulting string back to the client. -*/ -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Channels::Http; - -int main() -{ - try - { - // - // Create and register 'HttpChannel'. - HttpChannel^ myHttpChannel = gcnew HttpChannel( 8085 ); - ChannelServices::RegisterChannel( myHttpChannel ); - - // Create and register 'TcpChannel'. - TcpChannel^ myTcpChannel = gcnew TcpChannel( 8080 ); - ChannelServices::RegisterChannel( myTcpChannel ); - - // - // Retrieve and print information about the registered channels. - array^myIChannelArray = ChannelServices::RegisteredChannels; - for ( int i = 0; i < myIChannelArray->Length; i++ ) - { - Console::WriteLine( "Name of Channel: {0}", myIChannelArray[ i ]->ChannelName ); - Console::WriteLine( "Priority of Channel: {0}", myIChannelArray[ i ]->ChannelPriority ); - - } - // - RemotingConfiguration::RegisterWellKnownServiceType( Type::GetType( "RemotingSamples.HelloServer,ChannelServices_RegisteredChannels_Share" ), "SayHello", WellKnownObjectMode::SingleCall ); - - // - System::Console::WriteLine( "Hit to unregister the channels..." ); - System::Console::ReadLine(); - - // Unregister the 'HttpChannel' and 'TcpChannel' channels. - ChannelServices::UnregisterChannel( myTcpChannel ); - ChannelServices::UnregisterChannel( myHttpChannel ); - Console::WriteLine( "Unregistered the channels." ); - - // - System::Console::WriteLine( "Hit to exit..." ); - System::Console::ReadLine(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "The source of exception: {0}", e->Source ); - Console::WriteLine( "The Message of exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp deleted file mode 100644 index 9c540f3858a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp +++ /dev/null @@ -1,132 +0,0 @@ - - -// System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage) -/* - The following example demonstrates 'SyncDispatchMessage' method of - 'ChannelServices' class. In the example, 'MyProxy' extends 'RealProxy' - class and overrides its constructor and 'Invoke' messages. In the 'Main' - method, the 'MyProxy' class is instantiated and 'MyPrintMethod' method - is called on it. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; - -// -// Create a custom 'RealProxy'. -public ref class MyProxy: public RealProxy -{ -private: - String^ myURIString; - MarshalByRefObject^ myMarshalByRefObject; - -public: - MyProxy( Type^ myType ) - : RealProxy( myType ) - { - - // RealProxy uses the Type to generate a transparent proxy. - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance(myType)); - - // Get 'ObjRef', for transmission serialization between application domains. - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - - // Get the 'URI' property of 'ObjRef' and store it. - myURIString = myObjRef->URI; - Console::WriteLine( "URI :{0}", myObjRef->URI ); - } - - virtual IMessage^ Invoke ( IMessage^ myIMessage ) override - { - Console::WriteLine( "MyProxy.Invoke Start" ); - Console::WriteLine( "" ); - if ( dynamic_cast(myIMessage) ) - Console::WriteLine( "IMethodCallMessage" ); - - if ( dynamic_cast(myIMessage) ) - Console::WriteLine( "IMethodReturnMessage" ); - - Type^ msgType = myIMessage->GetType(); - Console::WriteLine( "Message Type: {0}", msgType ); - Console::WriteLine( "Message Properties" ); - IDictionary^ myIDictionary = myIMessage->Properties; - - // Set the '__Uri' property of 'IMessage' to 'URI' property of 'ObjRef'. - myIDictionary->default[ "__Uri" ] = myURIString; - IDictionaryEnumerator^ myIDictionaryEnumerator = dynamic_cast(myIDictionary->GetEnumerator()); - while ( myIDictionaryEnumerator->MoveNext() ) - { - Object^ myKey = myIDictionaryEnumerator->Key; - String^ myKeyName = myKey->ToString(); - Object^ myValue = myIDictionaryEnumerator->Value; - Console::WriteLine( "\t{0} : {1}", myKeyName, myIDictionaryEnumerator->Value ); - if ( myKeyName->Equals( "__Args" ) ) - { - array^myObjectArray = (array^)myValue; - for ( int aIndex = 0; aIndex < myObjectArray->Length; aIndex++ ) - Console::WriteLine( "\t\targ: {0} myValue: {1}", aIndex, myObjectArray[ aIndex ] ); - } - - if ( (myKeyName->Equals( "__MethodSignature" )) && (nullptr != myValue) ) - { - array^myObjectArray = (array^)myValue; - for ( int aIndex = 0; aIndex < myObjectArray->Length; aIndex++ ) - Console::WriteLine( "\t\targ: {0} myValue: {1}", aIndex, myObjectArray[ aIndex ] ); - } - } - - IMessage^ myReturnMessage; - myIDictionary->default[ "__Uri" ] = myURIString; - Console::WriteLine( "__Uri {0}", myIDictionary->default[ "__Uri" ] ); - Console::WriteLine( "ChannelServices.SyncDispatchMessage" ); - myReturnMessage = ChannelServices::SyncDispatchMessage( myIMessage ); - - // Push return value and OUT parameters back onto stack. - IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast(myReturnMessage); - Console::WriteLine( "IMethodReturnMessage.ReturnValue: {0}", myMethodReturnMessage->ReturnValue ); - Console::WriteLine( "MyProxy.Invoke - Finish" ); - return myReturnMessage; - } -}; -// - -int main() -{ - try - { - TcpChannel^ myTcpChannel = gcnew TcpChannel( 8086 ); - ChannelServices::RegisterChannel( myTcpChannel, false ); - MyProxy^ myProxyObject = gcnew MyProxy( PrintServer::typeid); - PrintServer^ myPrintServer = dynamic_cast(myProxyObject->GetTransparentProxy()); - if ( myPrintServer == nullptr ) - Console::WriteLine( "Could not locate server" ); - else - Console::WriteLine( myPrintServer->MyPrintMethod( "String1", 1.2, 6 ) ); - Console::WriteLine( "Calling the Proxy" ); - int kValue = myPrintServer->MyPrintMethod( "String1", 1.2, 6 ); - Console::WriteLine( "Checking result" ); - if ( kValue == 6 ) - { - Console::WriteLine( "PrintServer.MyPrintMethod PASSED : returned {0}", kValue ); - } - else - { - Console::WriteLine( "PrintServer.MyPrintMethod FAILED : returned {0}", kValue ); - } - Console::WriteLine( "Sample Done" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "The source of exception: {0}", e->Source ); - Console::WriteLine( "The Message of exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp deleted file mode 100644 index eb8a5c280ac..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -public ref class Class -{ -private: - void Method1() - { - String^ UserName = Console::ReadLine(); - String^ SecurelyStoredPassword = Console::ReadLine(); - String^ Domain = Console::ReadLine(); - - WebRequest^ wReq = WebRequest::Create( "http://www.contoso.com" ); - - // - CredentialCache^ myCache = gcnew CredentialCache; - - myCache->Add( gcnew Uri( "http://www.contoso.com/" ), "Basic", gcnew NetworkCredential( UserName,SecurelyStoredPassword ) ); - myCache->Add( gcnew Uri( "http://www.contoso.com/" ), "Digest", gcnew NetworkCredential( UserName,SecurelyStoredPassword,Domain ) ); - - wReq->Credentials = myCache; - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp deleted file mode 100644 index 1902e81255b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Net; -using namespace System::Windows::Forms; -public ref class Form1: public Form - -{ -protected: - void Method() - { - // - IPHostEntry^ hostInfo = Dns::GetHostEntry( "www.contoso.com" ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp deleted file mode 100644 index 56d68e22b91..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -#using - -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Net; -using namespace System; - -// -//Uses the DnsPermissionAttribute to restrict access only to those who have permission. - -[DnsPermission(SecurityAction::Demand,Unrestricted=true)] -public ref class MyClass -{ -public: - static IPAddress^ GetIPAddress() - { - IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; - return ipAddress; - } - -}; - -int main() -{ - try - { - - //Grants Access. - Console::WriteLine( " Access granted\n The local host IP Address is :{0}", MyClass::GetIPAddress() ); - } - // Denies Access. - catch ( SecurityException^ securityException ) - { - Console::WriteLine( "Access denied" ); - Console::WriteLine( securityException->ToString() ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp deleted file mode 100644 index e4aa5aedcd2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - // - Uri^ proxyURI = gcnew Uri( "http://webproxy:80" ); - GlobalProxySelection::Select = gcnew WebProxy( proxyURI ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp deleted file mode 100644 index 4d4eebf4ef8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -public ref class MyMath: public System::Web::Services::Protocols::HttpGetClientProtocol -{ -public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MyMath() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, - System::Web::Services::Protocols::UrlParameterWriter::typeid)] - [returnvalue:System::Xml::Serialization::XmlRootAttribute("snippet1>",Namespace="http://www.contoso.com/",IsNullable=false)] - int Add( String^ num1, String^ num2 ) - { - array^temp0 = {num1,num2}; - return *dynamic_cast(this->Invoke( "Add", (String::Concat( this->Url, "/Add" )), temp0 )); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( String^ num1, String^ num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", (String::Concat( this->Url, "/Add" )), temp1, callback, asyncState ); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - return *dynamic_cast(this->EndInvoke( asyncResult )); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp deleted file mode 100644 index 984c156653d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Web; -using namespace System::Web::UI; - -// -[System::Xml::Serialization::XmlRootAttribute(Namespace="http://tempuri.org/",IsNullable=true)] -public ref class UserName -{ -public: - String^ Name; - String^ Domain; -}; - -public ref class MyUser: public System::Web::Services::Protocols::HttpPostClientProtocol -{ -public: - MyUser() - { - this->Url = "http://www.contoso.com/username.asmx"; - } - - [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,System::Web::Services::Protocols::HtmlFormParameterWriter::typeid)] - UserName^ GetUserName() - { - return (dynamic_cast(this->Invoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0) ))); - } - - System::IAsyncResult^ BeginGetUserName( System::AsyncCallback^ callback, Object^ asyncState ) - { - return this->BeginInvoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0), callback, asyncState ); - } - - UserName^ EndGetUserName( System::IAsyncResult^ asyncResult ) - { - return (dynamic_cast(this->EndInvoke( asyncResult ))); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp deleted file mode 100644 index 3d8283f1fa7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Web; -using namespace System::Web::UI; - -// -[System::Xml::Serialization::XmlRootAttribute(Namespace="http://tempuri.org/",IsNullable=true)] -public ref class UserName -{ -public: - String^ Name; - String^ Domain; -}; - -public ref class MyUser: public System::Web::Services::Protocols::HttpGetClientProtocol -{ -public: - MyUser() - { - this->Url = "http://www.contoso.com/username.asmx"; - } - - [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,System::Web::Services::Protocols::UrlParameterWriter::typeid)] - UserName^ GetUserName() - { - return (dynamic_cast(this->Invoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0) ))); - } - - System::IAsyncResult^ BeginGetUserName( System::AsyncCallback^ callback, Object^ asyncState ) - { - return this->BeginInvoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0), callback, asyncState ); - } - - UserName^ EndGetUserName( System::IAsyncResult^ asyncResult ) - { - return (dynamic_cast(this->EndInvoke( asyncResult ))); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp deleted file mode 100644 index 57e073dd49c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -public ref class MyMath: public System::Web::Services::Protocols::HttpPostClientProtocol -{ -public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MyMath() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, - System::Web::Services::Protocols::HtmlFormParameterWriter::typeid)] - [returnvalue:System::Xml::Serialization::XmlRootAttribute("snippet1>",Namespace="http://www.contoso.com/",IsNullable=false)] - int Add( String^ num1, String^ num2 ) - { - array^temp2 = {num1,num2}; - return *dynamic_cast(this->Invoke( "Add", (String::Concat( this->Url, "/Add" )), temp2 )); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( String^ num1, String^ num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp3 = {num1,num2}; - return this->BeginInvoke( "Add", (this->Url + "/Add" ), temp3, callback, asyncState ); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - return *dynamic_cast(this->EndInvoke( asyncResult )); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp deleted file mode 100644 index 4c25623d8ec..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using -#using - -using namespace System::Web::Services; -using namespace System; -public ref class Math -{ -public: - - [WebMethod] - int Add( int num1, int num2 ) - { - return num1 + num2; - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp deleted file mode 100644 index 87d6b7f28b3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Xml::Serialization; -using namespace System::Web::Services::Protocols; - -// -namespace MyMath -{ - [XmlRootAttribute("snippet1>",Namespace="http://MyMath/",IsNullable=false)] - public ref class Math: public HttpGetClientProtocol - { - public: - Math() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - [HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, - System::Web::Services::Protocols::UrlParameterWriter::typeid)] - int Add( String^ num1, String^ num2 ) - { - array^temp0 = {num1,num2}; - return *dynamic_cast(this->Invoke( "Add", String::Concat( this->Url, "/Add" ), temp0 )); - } - - IAsyncResult^ BeginAdd( String^ num1, String^ num2, AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", String::Concat( this->Url, "/Add" ), temp1, callback, asyncState ); - } - - int EndAdd( IAsyncResult^ asyncResult ) - { - return *dynamic_cast(this->EndInvoke( asyncResult )); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp deleted file mode 100644 index b705fba6e3b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Web; -using namespace System::Web::UI; -using namespace System::Net; - -namespace MyMath -{ -using namespace System::Xml::Serialization; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - public ref class Math: public SoapHttpClientProtocol - { - public: - int Add( int num1, int num2 ) - { - return num1 + num2; - } - }; -} - -public ref class Page1: public Page -{ -private: - void Page_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // - MyMath::Math^ math = gcnew MyMath::Math; - - // Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server - // for local addresses. - IWebProxy^ proxyObject = gcnew WebProxy( "http://proxyserver:80",true ); - math->Proxy = proxyObject; - - // Call the Add XML Web service method. - int total = math->Add( 8, 5 ); - - // - } -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp deleted file mode 100644 index 16cbdf361c8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp +++ /dev/null @@ -1,16 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -public ref class Sample -{ -public: - void Method() - { - // - HttpWebRequest^ myReq = dynamic_cast(WebRequest::Create( "http://www.contoso.com/" )); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp deleted file mode 100644 index 352469e1bea..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Web; -using namespace System::Web::UI; - -public ref class Page1: public Page -{ -private: - void Page_Load( Object^, EventArgs^ ) - { - HttpWebRequest^ req = dynamic_cast(WebRequest::Create( "http://www.contoso.com/" )); - - // - bool hasChanged = req->RequestUri->Equals( req->Address ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp deleted file mode 100644 index 945bd743eee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Web; -using namespace System::Web::UI; - -public ref class Page1: public Page -{ -private: - void Page_Load( Object^, EventArgs^ ) - { - // - HttpWebRequest^ HttpWReq = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); - HttpWebResponse^ HttpWResp = dynamic_cast(HttpWReq->GetResponse()); - - // Insert code that uses the response object. - HttpWResp->Close(); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp deleted file mode 100644 index 8d014c2ed72..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security::Cryptography::X509Certificates; - -// -public enum class CertificateProblem : UInt32 -{ - CertEXPIRED = 0x800B0101, - CertVALIDITYPERIODNESTING = 0x800B0102, - CertROLE = 0x800B0103, - CertPATHLENCONST = 0x800B0104, - CertCRITICAL = 0x800B0105, - CertPURPOSE = 0x800B0106, - CertISSUERCHAINING = 0x800B0107, - CertMALFORMED = 0x800B0108, - CertUNTRUSTEDROOT = 0x800B0109, - CertCHAINING = 0x800B010A, - CertREVOKED = 0x800B010C, - CertUNTRUSTEDTESTROOT = 0x800B010D, - CertREVOCATION_FAILURE = 0x800B010E, - CertCN_NO_MATCH = 0x800B010F, - CertWRONG_USAGE = 0x800B0110, - CertUNTRUSTEDCA = 0x800B0112 -}; - -public ref class MyCertificateValidation: public ICertificatePolicy -{ -public: - - // Default policy for certificate validation. - static bool DefaultValidate = false; - virtual bool CheckValidationResult( ServicePoint^ /*sp*/, X509Certificate^ /*cert*/, WebRequest^ request, int problem ) - { - bool ValidationResult = false; - Console::WriteLine( "Certificate Problem with accessing {0}", request->RequestUri ); - Console::Write( "Problem code 0x{0:X8},", (int)problem ); - Console::WriteLine( GetProblemMessage( (CertificateProblem)problem ) ); - ValidationResult = DefaultValidate; - return ValidationResult; - } - -private: - String^ GetProblemMessage( CertificateProblem Problem ) - { - String^ ProblemMessage = ""; - CertificateProblem problemList = CertificateProblem( ); - String^ ProblemCodeName = Enum::GetName( problemList.GetType(), Problem ); - if ( ProblemCodeName != nullptr ) - ProblemMessage = String::Concat( ProblemMessage, "-Certificateproblem:", ProblemCodeName ); - else - ProblemMessage = "Unknown Certificate Problem"; - - return ProblemMessage; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp deleted file mode 100644 index ef840b46dcf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; - -public ref class Sample -{ -protected: - void Method( Socket^ mySocket ) - { - // - LingerOption^ myOpts = gcnew LingerOption( true,1 ); - mySocket->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::Linger, myOpts ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp deleted file mode 100644 index c92542655c2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Http; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - String^ SecurelyStoredUserName = ""; - String^ SecurelyStoredPassword = ""; - String^ SecurelyStoredDomain = ""; - - // - NetworkCredential^ myCred = gcnew NetworkCredential( - SecurelyStoredUserName,SecurelyStoredPassword,SecurelyStoredDomain ); - - CredentialCache^ myCache = gcnew CredentialCache; - - myCache->Add( gcnew Uri( "http://www.contoso.com" ), "Basic", myCred ); - myCache->Add( gcnew Uri( "http://app.contoso.com" ), "Basic", myCred ); - - // HttpClient lifecycle management best practices: - // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use - HttpClientHandler^ handler = gcnew HttpClientHandler(); - handler->Credentials = myCache; - HttpClient^ client = gcnew HttpClient(handler); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp deleted file mode 100644 index 4613eef8236..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -using namespace System; -using namespace System::Runtime::Serialization; - -// Class added so sample will compile -ref class Node -{ -public: - Node( int /*i*/ ){} -}; - -// -// A serializable LinkedList example. For the full LinkedList implementation -// see the Serialization sample. -[Serializable] -ref class LinkedList: public ISerializable -{ -private: - Node^ m_head; - Node^ m_tail; - - // Serializes the object. -public: - virtual void GetObjectData( SerializationInfo^ info, StreamingContext /*context*/ ) - { - // Stores the m_head and m_tail references in the SerializationInfo info. - info->AddValue( "head", m_head, m_head->GetType() ); - info->AddValue( "tail", m_tail, m_tail->GetType() ); - } - - // Constructor that is called automatically during deserialization. -private: - // Reconstructs the object from the information in SerializationInfo info - LinkedList( SerializationInfo^ info, StreamingContext /*context*/ ) - { - Node^ temp = gcnew Node( 0 ); - // Retrieves the values of Type temp.GetType() from SerializationInfo info - m_head = dynamic_cast(info->GetValue( "head", temp->GetType() )); - m_tail = dynamic_cast(info->GetValue( "tail", temp->GetType() )); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp deleted file mode 100644 index 1a04a196a24..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - void Method() - { - // - Uri^ myUri = gcnew Uri( "http://www.contoso.com/" ); - ServicePoint^ mySP = ServicePointManager::FindServicePoint( myUri ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp deleted file mode 100644 index 7a9fdb44639..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Windows::Forms; -using namespace System::Web; -using namespace System::Web::Services; - -// Class added so sample will compile -public ref class MyCertificatePolicy: public ICertificatePolicy -{ -public: - virtual bool CheckValidationResult( System::Net::ServicePoint^, System::Security::Cryptography::X509Certificates::X509Certificate^, System::Net::WebRequest^, int ) - { - return true; - } -}; - -public ref class Form1: public Form -{ -public: - void Method( Uri^ myUri ) - { - // - ServicePointManager::CertificatePolicy = gcnew MyCertificatePolicy; - - // Create the request and receive the response - try - { - WebRequest^ myRequest = WebRequest::Create( myUri ); - WebResponse^ myResponse = myRequest->GetResponse(); - ProcessResponse( myResponse ); - myResponse->Close(); - } - // Catch any exceptions - catch ( WebException^ e ) - { - if ( e->Status == WebExceptionStatus::TrustFailure ) - { - // Code for handling security certificate problems goes here. - } - // Other exception handling goes here - } - // - } - - // Method added so sample will compile - void ProcessResponse( WebResponse^ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp deleted file mode 100644 index 40bea86464b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp +++ /dev/null @@ -1,166 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::IO; -using namespace System::Net; - -ref class TraceExtension; - -// Create a SoapExtensionAttribute for the SOAP Extension that can be -// applied to an XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ filename; - int priority; - -public: - TraceExtensionAttribute() - : filename( "c:\\log.txt" ) - {} - - property Type^ ExtensionType - { - virtual Type^ get() override - { - return TraceExtension::typeid; - } - } - - property int Priority - { - virtual int get() override - { - return priority; - } - virtual void set( int value ) override - { - priority = value; - } - } - - property String^ Filename - { - String^ get() - { - return filename; - } - void set( String^ value ) - { - filename = value; - } - } -}; - -// Define a SOAP Extension that traces the SOAP request and SOAP -// response for the XML Web service method the SOAP extension is -// applied to. -public ref class TraceExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // Save the Stream representing the SOAP request or SOAP response into - // a local memory buffer. - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - // When the SOAP extension is accessed for the first time, the XML Web - // service method it is applied to is accessed to store the file - // name passed in, using the corresponding SoapExtensionAttribute. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override - { - return (dynamic_cast(attribute))->Filename; - } - - // The SOAP extension was configured to run using a configuration file - // instead of an attribute applied to a specific XML Web service - // method. - virtual Object^ GetInitializer( Type^ WebServiceType ) override - { - // Return a file name to log the trace information to, based on the - // type. - return String::Format( "C:\\{0}.log", WebServiceType->FullName ); - } - - // Receive the file name stored by GetInitializer and store it in a - // member variable for this specific instance. - virtual void Initialize( Object^ initializer ) override - { - filename = dynamic_cast(initializer); - } - - // If the SoapMessageStage is such that the SoapRequest or - // SoapResponse is still in the SOAP format to be sent or received, - // save it out to a file. - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - case SoapMessageStage::AfterDeserialize: - break; - } - } - - void WriteOutput( SoapMessage^ message ) - { - newStream->Position = 0; - FileStream^ fs = gcnew FileStream( filename, FileMode::Append, - FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - - String^ soapString = ( (SoapServerMessage^)( message ) ) ? - (String^)"SoapResponse" : "SoapRequest"; - w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); - w->Flush(); - Copy( newStream, fs ); - w->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - void WriteInput( SoapMessage^ message ) - { - Copy( oldStream, newStream ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - String^ soapString = (dynamic_cast(message)) ? (String^)"SoapRequest" : "SoapResponse"; - w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); - w->Flush(); - newStream->Position = 0; - Copy( newStream, fs ); - w->Close(); - newStream->Position = 0; - } - - void Copy( Stream^ from, Stream^ to ) - { - TextReader^ reader = gcnew StreamReader( from ); - TextWriter^ writer = gcnew StreamWriter( to ); - writer->WriteLine( reader->ReadToEnd() ); - writer->Flush(); - } -}; -// - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp deleted file mode 100644 index dfe63fe65f3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::IO; - -ref class TraceExtension; - -// Create a SoapExtensionAttribute for our SOAP Extension that can be -// applied to an XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ filename; - int priority; - -public: - TraceExtensionAttribute() - : filename( "c:\\log.txt" ) - {} - - property Type^ ExtensionType - { - virtual Type^ get() override - { - return TraceExtension::typeid; - } - } - - property int Priority - { - virtual int get() override - { - return priority; - } - virtual void set( int value ) override - { - priority = value; - } - } - - property String^ Filename - { - String^ get() - { - return filename; - } - void set( String^ value ) - { - filename = value; - } - } -}; - - -// Define a SOAP Extension that traces the SOAP request and SOAP response -// for the XML Web service method, the SOAP extension is applied to. -public ref class TraceExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // When the SOAP extension is accessed for the first time the XML Web service method it is applied - // is accessed store the filename passed in using the corresponding SoapExtensionAttribute. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override - { - return (dynamic_cast(attribute))->Filename; - } - - // The extension was configured to run using a configuration file instead of an attribute applied to a - // specific XML Web service method. Return a file name based on the class implementing the XML Web service's type. - virtual Object^ GetInitializer( Type^ WebServiceType ) override - { - // Return a file name to log the trace information to based on the passed in type. - return String::Format( "C:\\{0}.log", WebServiceType->FullName ); - } - - // Receive the filename stored by GetInitializer and store it in a member variable - // for this specific instance. - virtual void Initialize( Object^ initializer ) override - { - filename = dynamic_cast(initializer); - } - - // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP - // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Save the Stream representing the SOAP request or SOAP response into a local memory buffer - // -public: - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - // - - void WriteOutput( SoapMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); - w->Flush(); - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - void WriteInput( SoapMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "================================== Request at {0}", DateTime::Now ); - w->Flush(); - newStream->Position = 0; - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - } - - void Copy( Stream^ from, Stream^ to ) - { - TextReader^ reader = gcnew StreamReader( from ); - TextWriter^ writer = gcnew StreamWriter( to ); - writer->WriteLine( reader->ReadToEnd() ); - writer->Flush(); - } -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp deleted file mode 100644 index 98113ace5c6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::IO; - -ref class TraceExtension; - -// Create a SoapExtensionAttribute for our SOAP Extension that can be -// applied to an XML Web service method. - -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ filename; - int priority; - -public: - TraceExtensionAttribute() - : filename( "c:\\log.txt" ) - {} - - property Type^ ExtensionType - { - virtual Type^ get() override - { - return TraceExtension::typeid; - } - } - - property int Priority - { - virtual int get() override - { - return priority; - } - virtual void set( int value ) override - { - priority = value; - } - } - - property String^ Filename - { - String^ get() - { - return filename; - } - void set( String^ value ) - { - filename = value; - } - } -}; - -// Define a SOAP Extension that traces the SOAP request and SOAP response -// for the XML Web service method, the SOAP extension is applied to. -public ref class TraceExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - - // -public: - // When the SOAP extension is accessed for the first time, cache the - // file name passed in by the SoapExtensionAttribute. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override - { - return (dynamic_cast(attribute))->Filename; - } - // - - // The extension was configured to run using a configuration file instead of an attribute applied to a - // specific XML Web service method. Return a file name based on the class implementing the XML Web service's type. - virtual Object^ GetInitializer( Type^ WebServiceType ) override - { - // Return a file name to log the trace information to based on the passed in type. - return String::Format( "C:\\{0}.log", WebServiceType->FullName ); - } - - // Receive the filename stored by GetInitializer and store it in a member variable - // for this specific instance. - virtual void Initialize( Object^ initializer ) override - { - filename = dynamic_cast(initializer); - } - - // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP - // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Save the Stream representing the SOAP request or SOAP response into a local memory buffer - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - void WriteOutput( SoapMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); - w->Flush(); - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - void WriteInput( SoapMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "================================== Request at {0}", DateTime::Now ); - w->Flush(); - newStream->Position = 0; - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - } - - void Copy( Stream^ from, Stream^ to ) - { - TextReader^ reader = gcnew StreamReader( from ); - TextWriter^ writer = gcnew StreamWriter( to ); - writer->WriteLine( reader->ReadToEnd() ); - writer->Flush(); - } -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp deleted file mode 100644 index 8fdb714ad46..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::IO; - -ref class TraceExtension; - -// Create a SoapExtensionAttribute for our SOAP Extension that can be -// applied to an XML Web service method. - -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ filename; - int priority; - -public: - TraceExtensionAttribute() - : filename( "c:\\log.txt" ) - {} - - property Type^ ExtensionType - { - virtual Type^ get() override - { - return TraceExtension::typeid; - } - } - - property int Priority - { - virtual int get() override - { - return priority; - } - virtual void set( int value ) override - { - priority = value; - } - } - - property String^ Filename - { - String^ get() - { - return filename; - } - void set( String^ value ) - { - filename = value; - } - } -}; - -// Define a SOAP Extension that traces the SOAP request and SOAP response -// for the XML Web service method, the SOAP extension is applied to. -public ref class TraceExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // When the SOAP extension is accessed for the first time the XML Web service method it is applied - // is accessed store the filename passed in using the corresponding SoapExtensionAttribute. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override - { - return (dynamic_cast(attribute))->Filename; - } - - virtual Object^ GetInitializer( Type^ filename ) override - { - return dynamic_cast(filename); - } - - // - // Receive the file name stored by GetInitializer and store it in - // a member variable for this specific instance. -public: - virtual void Initialize( Object^ initializer ) override - { - filename = dynamic_cast(initializer); - } - // - - // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP - // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Save the Stream representing the SOAP request or SOAP response into a local memory buffer - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - void WriteOutput( SoapMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); - w->Flush(); - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - void WriteInput( SoapMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "================================== Request at {0}", DateTime::Now ); - w->Flush(); - newStream->Position = 0; - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - } - - void Copy( Stream^ from, Stream^ to ) - { - TextReader^ reader = gcnew StreamReader( from ); - TextWriter^ writer = gcnew StreamWriter( to ); - writer->WriteLine( reader->ReadToEnd() ); - writer->Flush(); - } -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp deleted file mode 100644 index b15566f7bea..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Web; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; - -public ref class Sample: public SoapExtension -{ - // -public: - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - - case SoapMessageStage::AfterDeserialize: - break; - - - } - } - // - - virtual Object^ GetInitializer( LogicalMethodInfo^ /*lmi*/, SoapExtensionAttribute^ /*sea*/ ) override - { - // method added so sample will compile - Object^ myobject = gcnew Object; - return myobject; - } - - virtual void Initialize( Object^ /*o*/ ) override - { - - // method added so sample will compile - } - - void WriteOutput( SoapMessage^ /*message*/ ) - { - - // method added so sample will compile - } - - void WriteInput( SoapMessage^ /*message*/ ) - { - - // method added so sample will compile - } - - virtual Object^ GetInitializer( Type^ filename ) override - { - return dynamic_cast(filename); - } - -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp deleted file mode 100644 index f1845cb9d2d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::IO; - -// Class added so sample will compile -public ref class TraceExtension{}; - -// -// Create a SoapExtensionAttribute for a SOAP extension that can be -// applied to an XML Web service method. - -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - - // Set the name of the log file were SOAP messages will be stored. - TraceExtensionAttribute() - : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of 'TraceExtension' class. - virtual Type^ get() override - { - return TraceExtension::typeid; - } - } - - property int Priority - { - // User can set priority of the 'SoapExtension'. - virtual int get() override - { - return myPriority; - } - - virtual void set( int value ) override - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - - void set( String^ value ) - { - myFilename = value; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp deleted file mode 100644 index 789a774b3b2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Web::Services::Protocols; - -// Following was added to make the sample compile. -public ref class MyHeader: public SoapHeader -{ -public: - String^ MyValue; -}; - -public ref class MyWebService -{ -public: - MyHeader^ myHeader; - int MyWebMethod( int num1, int num2 ) - { - return num1 + num2; - } - -}; - - -// -int main() -{ - MyWebService^ ws = gcnew MyWebService; - try - { - MyHeader^ customHeader = gcnew MyHeader; - customHeader->MyValue = "Header Value for MyValue"; - customHeader->Actor = "http://www.contoso.com/MySoapHeaderHandler"; - ws->myHeader = customHeader; - int results = ws->MyWebMethod( 3, 5 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp deleted file mode 100644 index 20b86237884..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#using -#using - -using namespace System::Web::Services::Protocols; -using namespace System; - -// Following was added to make the sample compile. -public ref class MyHeader: public SoapHeader -{ -public: - String^ MyValue; -}; - -public ref class MyWebService -{ -public: - MyHeader^ myHeader; - int MyWebMethod( int num1, int num2 ) - { - return num1 + num2; - } - -}; - - -// -int main() -{ - MyWebService^ ws = gcnew MyWebService; - try - { - MyHeader^ customHeader = gcnew MyHeader; - customHeader->MyValue = "Header Value for MyValue"; - customHeader->MustUnderstand = true; - ws->myHeader = customHeader; - int results = ws->MyWebMethod( 3, 5 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp deleted file mode 100644 index eb179a86c88..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; - -// Define a SOAP header by deriving from the SoapHeader base class. -// The header contains just one string value. -public ref class MyHeader: public SoapHeader -{ -public: - String^ MyValue; -}; - -public ref class MyWebService -{ -public: - - // Member variable to receive the contents of the MyHeader SOAP header. - MyHeader^ myHeader; - - [WebMethod] - [SoapHeader("myHeader",Direction=SoapHeaderDirection::InOut)] - void Hello(){} - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp deleted file mode 100644 index 2c181c54c3b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Web; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; - -// -public ref class MyHeader: public SoapHeader -{ -public: - String^ MyValue; -}; - -public ref class MyWebService -{ -public: - MyHeader^ myHeader; - - [WebMethod] - [SoapHeader("myHeader", - Direction=SoapHeaderDirection::InOut|SoapHeaderDirection::Fault)] - void MySoapHeaderReceivingMethod() - { - - // Set myHeader->MyValue to some value. - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp deleted file mode 100644 index b46a3f5ba86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -namespace MyMath -{ - - [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] - public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MyMath() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add", - RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int num1, int num2 ) - { - array^temp0 = {num1,num2}; - array^results = this->Invoke( "Add", temp0 ); - return *dynamic_cast(results[ 0 ]); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp deleted file mode 100644 index 1a106c1b0b7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -namespace MyMath -{ - - [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] - public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MyMath() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add", - RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int num1, int num2 ) - { - array^temp1 = {num1,num2}; - array^results = this->Invoke( "Add", temp1 ); - return *dynamic_cast(results[ 0 ]); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp2 = {num1,num2}; - return this->BeginInvoke( "Add", temp2, callback, asyncState ); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp deleted file mode 100644 index 9cdfc4f439d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -namespace MyMath -{ - - [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] - public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MyMath() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add",RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/",Use=System::Web::Services::Description::SoapBindingUse::Literal,ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int num1, int num2 ) - { - array^temp0 = {num1,num2}; - array^results = this->Invoke( "Add", temp0 ); - return *dynamic_cast(results[ 0 ]); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp deleted file mode 100644 index b46a3f5ba86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -namespace MyMath -{ - - [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] - public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MyMath() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add", - RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int num1, int num2 ) - { - array^temp0 = {num1,num2}; - array^results = this->Invoke( "Add", temp0 ); - return *dynamic_cast(results[ 0 ]); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp deleted file mode 100644 index 12e7ead3332..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -namespace EnsureStageExample -{ - public enum class SoapMessageStage - { - BeforeSerialize = 1, - BeforeDeserialize = 2 - }; - - ref class Class1 - { - public: - static void main() - { - // - EnsureStage( (SoapMessageStage)( SoapMessageStage::BeforeSerialize | - SoapMessageStage::BeforeDeserialize ) ); - // - } - - private: - //This method is a standin for the real method so that the example will compile - static void EnsureStage( SoapMessageStage /*sms*/ ){} - }; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp deleted file mode 100644 index e1e657e660b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; - -public ref class Sample -{ - // -protected: - void AcceptMethod( Socket^ listeningSocket ) - { - Socket^ mySocket = listeningSocket->Accept(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp deleted file mode 100644 index 6c46b3b92d7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; - -public ref class Sample -{ -protected: - void Method( Socket^ aSocket, EndPoint^ anEndPoint ) - { - // - try - { - aSocket->Bind( anEndPoint ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Winsock error: {0}", e ); - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp deleted file mode 100644 index 2e51128de63..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Security::Permissions; - -public ref class Sample -{ -protected: - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - void Method( Socket^ aSocket ) - { - // - try - { - aSocket->Shutdown(SocketShutdown::Both); - aSocket->Close(); - } - catch (...) - { - aSocket->Close(); - throw; - } - - if ( aSocket->Connected ) - { - Console::WriteLine( "Winsock error: {0}", Convert::ToString( - System::Runtime::InteropServices::Marshal::GetLastWin32Error() ) ); - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp deleted file mode 100644 index 6693a8bdfcc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; - -static void ConnectAndCheck( Socket^ client, EndPoint^ anEndPoint ) -{ - // - client->Connect( anEndPoint ); - if ( !client->Connected ) - { - Console::WriteLine( "Winsock error: {0}", Convert::ToString( - System::Runtime::InteropServices::Marshal::GetLastWin32Error() ) ); - } - - // This is how you can determine whether a socket is still connected. - bool blockingState = client->Blocking; - try - { - array^tmp = gcnew array(1); - client->Blocking = false; - client->Send( tmp, 0, static_cast(0) ); - Console::WriteLine( L"Connected!" ); - } - catch ( SocketException^ e ) - { - // 10035 == WSAEWOULDBLOCK - if ( e->NativeErrorCode.Equals( 10035 ) ) - { - Console::WriteLine( "Connected from an exception!" ); - } - else - { - Console::WriteLine( "Disconnected: {0}!", e->NativeErrorCode ); - } - } - finally - { - client->Blocking = blockingState; - } - - Console::WriteLine( "Connected: {0}", client->Connected ); - // -} - -[STAThread] -int main() -{ - Socket^ s = gcnew Socket( AddressFamily::InterNetwork, - SocketType::Stream, - ProtocolType::Tcp ); - - String^ host = "localhost"; - int port = 80; - - IPHostEntry^ hostEntry = Dns::Resolve( host ); - IPEndPoint^ EPHost = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],port ); - - ConnectAndCheck( s, EPHost ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp deleted file mode 100644 index 66f68944d86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; - -void CreateAndListen( int port, int backlog ) -{ - // - // create the socket - Socket^ listenSocket = gcnew Socket( AddressFamily::InterNetwork, - SocketType::Stream, - ProtocolType::Tcp ); - - // bind the listening socket to the port - IPAddress^ hostIP = ( Dns::Resolve( IPAddress::Any->ToString() ) )->AddressList[ 0 ]; - IPEndPoint^ ep = gcnew IPEndPoint( hostIP,port ); - listenSocket->Bind( ep ); - - // start listening - listenSocket->Listen( backlog ); - // -} - -[STAThread] -int main() -{ - CreateAndListen( 10042, 10 ); - Console::WriteLine( "enter to exit" ); - Console::Read(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp deleted file mode 100644 index 27d0003bd8b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; - -void MySerializeIPEndPointClassMethod() -{ - // - //Creates an IpEndPoint. - IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; - IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); - - //Serializes the IPEndPoint. - SocketAddress^ socketAddress = ipLocalEndPoint->Serialize(); - - //Verifies that ipLocalEndPoint is now serialized by printing its contents. - Console::WriteLine( "Contents of the socketAddress are: {0}", socketAddress ); - //Checks the Family property. - Console::WriteLine( "The address family of the socketAddress is: {0}", socketAddress->Family ); - //Checks the underlying buffer size. - Console::WriteLine( "The size of the underlying buffer is: {0}", socketAddress->Size ); - // -} - -int main() -{ - MySerializeIPEndPointClassMethod(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp deleted file mode 100644 index 719fbbc6521..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length == 1 ) - { - Console::WriteLine( "Enter a selection" ); - return 0; - } - - if ( args[ 1 ] == "endpointExample" ) - { - // - //Creates an instance of the TcpListener class by providing a local endpoint. - - IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; - IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); - - try - { - TcpListener^ tcpListener = gcnew TcpListener( ipLocalEndPoint ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else - if ( args[ 1 ] == "ipAddressExample" ) - { - // - //Creates an instance of the TcpListener class by providing a local IP address and port number. - - IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; - - try - { - TcpListener^ tcpListener = gcnew TcpListener( ipAddress,13 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else - if ( args[ 1 ] == "portNumberExample" ) - { - // - //Creates an instance of the TcpListener class by providing a local port number. - - IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; - - try - { - TcpListener^ tcpListener = gcnew TcpListener( ipAddress,13 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else - { - IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; - TcpListener^ tcpListener = gcnew TcpListener( ipAddress,13 ); - tcpListener->Start(); - Console::WriteLine( "Waiting for a connection...." ); - - try - { - // - // Accepts the pending client connection and returns a socket for communciation. - Socket^ socket = tcpListener->AcceptSocket(); - Console::WriteLine( "Connection accepted." ); - - String^ responseString = "You have successfully connected to me"; - - //Forms and sends a response string to the connected client. - array^sendBytes = Encoding::ASCII->GetBytes( responseString ); - int i = socket->Send( sendBytes ); - Console::WriteLine( "Message Sent /> : {0}", responseString ); - // - - //Any communication with the remote client using the socket can go here. - - //Closes the tcpListener and the socket. - socket->Shutdown( SocketShutdown::Both ); - socket->Close(); - tcpListener->Stop(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp deleted file mode 100644 index c216c7fe3f7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// -/** -* This program shows how to use the TcpListener class. -* It creates a TcpListener that listens on the specified port (13000). -* To run this program at the command line you enter: -* cs_tcpserver -* Any TcpClient that wants to use this server -* has to explicitly connect to an address obtained by the combination of -* the server on which this TcpServer is running and the port 13000. -* This TcpServer simply echoes back the message sent by the TcpClient, after -* translating it into uppercase. -**/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; - -int main() -{ - try - { - - // Set the TcpListener on port 13000. - Int32 port = 13000; - TcpListener^ server = gcnew TcpListener(IPAddress::Any, port); - - // Start listening for client requests. - server->Start(); - - // Buffer for reading data - array^bytes = gcnew array(256); - String^ data = nullptr; - - // Enter the listening loop. - while ( true ) - { - Console::Write( "Waiting for a connection... " ); - - // Perform a blocking call to accept requests. - // You could also use server.AcceptSocket() here. - TcpClient^ client = server->AcceptTcpClient(); - Console::WriteLine( "Connected!" ); - data = nullptr; - - // Get a stream object for reading and writing - NetworkStream^ stream = client->GetStream(); - Int32 i; - - // Loop to receive all the data sent by the client. - while ( (i = stream->Read( bytes, 0, bytes->Length )) != 0 ) - { - - // Translate data bytes to a ASCII string. - data = System::Text::Encoding::ASCII->GetString( bytes, 0, i ); - Console::WriteLine( String::Format( "Received: {0}", data ) ); - - // Process the data sent by the client. - data = data->ToUpper(); - array^msg = System::Text::Encoding::ASCII->GetBytes( data ); - - // Send back a response. - stream->Write( msg, 0, msg->Length ); - Console::WriteLine( String::Format( "Sent: {0}", data ) ); - } - - // Shutdown and end connection - client->Close(); - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException: {0}", e ); - } - - Console::WriteLine( "\nHit enter to continue..." ); - Console::Read(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp deleted file mode 100644 index 8c3fe289538..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; - -// -// This derived class demonstrate the use of three protected methods belonging to the UdpClient class. -public ref class MyUdpClientDerivedClass: public UdpClient -{ -public: - MyUdpClientDerivedClass() - : UdpClient() - {} - - void UsingProtectedMethods() - { - //Uses the protected Active property belonging to the UdpClient base class to determine if a connection is established. - if ( this->Active ) - { - //Calls the protected Client property belonging to the UdpClient base class. - Socket^ s = this->Client; - - //Uses the Socket returned by Client to set an option that is not available using UdpClient. - s->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::Broadcast, 1 ); - } - } -}; -// - -int main() -{ - MyUdpClientDerivedClass^ myUdpClientDerivedClass = gcnew MyUdpClientDerivedClass; - myUdpClientDerivedClass->UsingProtectedMethods(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp deleted file mode 100644 index 9ac0d6b76e3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp +++ /dev/null @@ -1,280 +0,0 @@ -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; - -public ref class MyUdpClientExample -{ -public: - // MyUdpClientConstructor is just used to illustrate the different constructors available in in the UdpClient class. - static void MyUdpClientConstructor( String^ myConstructorType ) - { - if ( myConstructorType->Equals( "PortNumberExample" ) ) - { - // - //Creates an instance of the UdpClient class to listen on - // the default interface using a particular port. - try - { - UdpClient^ udpClient = gcnew UdpClient( 11000 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( myConstructorType->Equals( "LocalEndPointExample" ) ) - { - // - //Creates an instance of the UdpClient class using a local endpoint. - IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; - IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); - - try - { - UdpClient^ udpClient = gcnew UdpClient( ipLocalEndPoint ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( myConstructorType->Equals( "HostNameAndPortNumExample" ) ) - { - // - //Creates an instance of the UdpClient class with a remote host name and a port number. - try - { - UdpClient^ udpClient = gcnew UdpClient( "www.contoso.com",11000 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( myConstructorType->Equals( "DefaultExample" ) ) - { - // - //Creates an instance of the UdpClient class using the default constructor. - UdpClient^ udpClient = gcnew UdpClient; - // - } - else - { - // Do nothing. - } - } - - // MyUdpClientConnection method is just used to illustrate the different connection methods of UdpClient class. - static void MyUdpClientConnection( String^ myConnectionType ) - { - if ( myConnectionType->Equals( "HostnameAndPortNumExample" ) ) - { - // - //Uses a host name and port number to establish a socket connection. - UdpClient^ udpClient = gcnew UdpClient; - try - { - udpClient->Connect( "www.contoso.com", 11002 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( myConnectionType == "IPAddressAndPortNumExample" ) - { - // - //Uses the IP address and port number to establish a socket connection. - UdpClient^ udpClient = gcnew UdpClient; - IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; - try - { - udpClient->Connect( ipAddress, 11003 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( myConnectionType == "RemoteEndPointExample" ) - { - // - //Uses a remote endpoint to establish a socket connection. - UdpClient^ udpClient = gcnew UdpClient; - IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress,11004 ); - try - { - udpClient->Connect( ipEndPoint ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else - { - // Do nothing. - } - } - - // This class demonstrates sending and receiving using a Udp socket. - static void MyUdpClientCommunicator( String^ mySendType ) - { - if ( mySendType == "EndPointExample" ) - { - // - UdpClient^ udpClient = gcnew UdpClient; - IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress,11004 ); - - array^ sendBytes = Encoding::ASCII->GetBytes( "Is anybody there?" ); - try - { - udpClient->Send( sendBytes, sendBytes->Length, ipEndPoint ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( mySendType == "HostNameAndPortNumberExample" ) - { - // - UdpClient^ udpClient = gcnew UdpClient; - - array^ sendBytes = Encoding::ASCII->GetBytes( "Is anybody there" ); - try - { - udpClient->Send( sendBytes, sendBytes->Length, "www.contoso.com", 11000 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( mySendType == "StraightSendExample" ) - { - // - UdpClient^ udpClient = gcnew UdpClient( "www.contoso.com",11000 ); - array^ sendBytes = Encoding::ASCII->GetBytes( "Is anybody there" ); - try - { - udpClient->Send( sendBytes, sendBytes->Length ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else - { - // Do nothing. - } - - // - //Creates a UdpClient for reading incoming data. - UdpClient^ receivingUdpClient = gcnew UdpClient( 11000 ); - - //Creates an IPEndPoint to record the IP Address and port number of the sender. - // The IPEndPoint will allow you to read datagrams sent from any source. - IPEndPoint^ RemoteIpEndPoint = gcnew IPEndPoint( IPAddress::Any,0 ); - try - { - // Blocks until a message returns on this socket from a remote host. - array^receiveBytes = receivingUdpClient->Receive( RemoteIpEndPoint ); - - String^ returnData = Encoding::ASCII->GetString( receiveBytes ); - - Console::WriteLine( "This is the message you received {0}", returnData ); - Console::WriteLine( "This message was sent from {0} on their port number {1}", - RemoteIpEndPoint->Address, RemoteIpEndPoint->Port ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - - // This example class demonstrates methods used to join and drop multicast groups. - static void MyUdpClientMulticastConfiguration( String^ myAction ) - { - if ( myAction == "JoinMultiCastExample" ) - { - // - UdpClient^ udpClient = gcnew UdpClient; - IPAddress^ multicastIpAddress = Dns::Resolve( "MulticastGroupName" )->AddressList[ 0 ]; - try - { - udpClient->JoinMulticastGroup( multicastIpAddress ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - } - else if ( myAction == "JoinMultiCastWithTimeToLiveExample" ) - { - // - UdpClient^ udpClient = gcnew UdpClient; - // Creates an IPAddress to use to join and drop the multicast group. - IPAddress^ multicastIpAddress = IPAddress::Parse( "239.255.255.255" ); - - try - { - // The packet dies after 50 router hops. - udpClient->JoinMulticastGroup( multicastIpAddress, 50 ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - - // - // Informs the server that you want to remove yourself from the multicast client list. - try - { - udpClient->DropMulticastGroup( multicastIpAddress ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // - - // - // Closes the UDP client by calling the public method Close(). - udpClient->Close(); - // - } - else - { - // Do nothing. - } - } -}; -//end class - -int main() -{ - // For our example, we will use the default constructor. - MyUdpClientExample::MyUdpClientConstructor( "defaultExample" ); - MyUdpClientExample::MyUdpClientConnection( "HostNameAndPortNumExample" ); - MyUdpClientExample::MyUdpClientCommunicator( "EndPointExample" ); - MyUdpClientExample::MyUdpClientMulticastConfiguration( "JoinMultiCastExample" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp deleted file mode 100644 index 12a033e105e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; - -int main() -{ - // - // With this constructor the local port number is arbitrarily assigned. - UdpClient^ udpClient = gcnew UdpClient; - try - { - udpClient->Connect( "host.contoso.com", 11000 ); - - // Send message to the host to which you have connected. - array^sendBytes = Encoding::ASCII->GetBytes( "Is anybody there?" ); - udpClient->Send( sendBytes, sendBytes->Length ); - - // Send message to a different host using optional hostname and port parameters. - UdpClient^ udpClientB = gcnew UdpClient; - udpClientB->Send( sendBytes, sendBytes->Length, "AlternateHostMachineName", 11000 ); - - //IPEndPoint object will allow us to read datagrams sent from any source. - IPEndPoint^ RemoteIpEndPoint = gcnew IPEndPoint( IPAddress::Any,0 ); - - // Block until a message returns on this socket from a remote host. - array^receiveBytes = udpClient->Receive( RemoteIpEndPoint ); - String^ returnData = Encoding::ASCII->GetString( receiveBytes ); - - // Use the IPEndPoint object to determine which of these two hosts responded. - Console::WriteLine( String::Concat( "This is the message you received ", returnData->ToString() ) ); - Console::WriteLine( String::Concat( "This message was sent from ", RemoteIpEndPoint->Address->ToString(), " on their port number ", RemoteIpEndPoint->Port.ToString() ) ); - udpClient->Close(); - udpClientB->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp deleted file mode 100644 index 072abfddaab..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Net; -using namespace System::Net::Http; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method() - { - // - Uri^ siteUri = gcnew Uri("http://www.contoso.com/"); - - // HttpClient lifecycle management best practices: - // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use - HttpClient^ client = gcnew HttpClient; - HttpRequestMessage^ request = gcnew HttpRequestMessage(HttpMethod::Get, siteUri); - HttpResponseMessage^ response = client->Send(request); - // - } -}; - -void main() -{ - Form1^ f = gcnew Form1; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp deleted file mode 100644 index 1d511f22f6b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method() - { - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); - Console::WriteLine( myUri->AbsolutePath ); - // - } -}; - -void main() -{ - Form1^ f = gcnew Form1; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp deleted file mode 100644 index f5adb1e6dc0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com" ); - Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); - Console::WriteLine( myUri->AbsoluteUri ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp deleted file mode 100644 index 2cb8990b9d0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com:8080/" ); - Uri^ myUri = gcnew Uri( baseUri,"shownew.htm?date=today" ); - Console::WriteLine( myUri->Authority ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp deleted file mode 100644 index 0d5b9b87897..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Console::WriteLine( Uri::CheckHostName( "www.contoso.com" ) ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp deleted file mode 100644 index db24745352e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com:8080/" ); - Uri^ myUri = gcnew Uri( baseUri,"shownew.htm?date=today" ); - Console::WriteLine( myUri->Host ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp deleted file mode 100644 index 77b48ab3d82..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm?date=today" ); - - Console::WriteLine( myUri->PathAndQuery ); - // -} - -void Method2() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm?date=today" ); - - Console::WriteLine( myUri->Query ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp deleted file mode 100644 index 2298149c102..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); - Console::WriteLine( myUri->Port ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp deleted file mode 100644 index 2a79562ae4c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); - Console::WriteLine( myUri->Scheme ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp deleted file mode 100644 index 1977347df49..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp deleted file mode 100644 index 74ea933f0d1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ myUri = gcnew Uri( "http://www.contoso.com/Hello%20World.htm",true ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp deleted file mode 100644 index aa310799d84..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com" ); - Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm" ); - Console::WriteLine( myUri->ToString() ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp deleted file mode 100644 index 1cd0cad6310..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp +++ /dev/null @@ -1,12 +0,0 @@ - - -#using - -using namespace System; -void main() -{ - // - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - Uri^ myUri = gcnew Uri( baseUri,"Hello%20World.htm",false ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp deleted file mode 100644 index 7d57c1f31fb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - UriBuilder^ uBuild = gcnew UriBuilder( "http://www.contoso.com/" ); - uBuild->Path = "index.htm"; - uBuild->Fragment = "main"; - Uri^ myUri = uBuild->Uri; - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp deleted file mode 100644 index 8ed7f68ec92..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - UriBuilder^ myUri = gcnew UriBuilder( "http", "www.contoso.com" ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp deleted file mode 100644 index af69e8f961a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - UriBuilder^ myUri = gcnew UriBuilder( "http", "www.contoso.com",8080 ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp deleted file mode 100644 index 6c6a09487e1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - UriBuilder^ myUri = gcnew UriBuilder( "http","www.contoso.com",8080,"index.htm" ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp deleted file mode 100644 index 3e0bf14858e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Security::Principal; -using namespace System::Windows::Forms; - -void main() -{ - // - UriBuilder^ myUri = gcnew UriBuilder( "http","www.contoso.com",8080,"index.htm","#top" ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp deleted file mode 100644 index cecb1ef6072..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -using namespace System; - -// Struct added so sample will compile -public value struct myMath -{ -public: - int Timeout; -}; - -public ref class Sample -{ -public: - void sampleFunction() - { - myMath math = myMath( ); - - // - math.Timeout = 15000; - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp deleted file mode 100644 index 3e503131573..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -using namespace System; - -// Class added so sample will compile -public ref class myMath -{ -public: - String^ Url; - int Add( int /*a*/, int /*b*/ ) - { - return 0; - } -}; - -// Structure added so sample will compile -public value struct myNum -{ -public: - String^ Text; -}; - -public ref class Sample -{ -public: - void sampleFunction() - { - myMath^ math = gcnew myMath; - myNum Num1 = myNum( ); - myNum Num2 = myNum( ); - - // - // Set the URL property to a different Web server than that described in the - // service description. - math->Url = "http://www.contoso.com/math.asmx"; - int total = math->Add( Convert::ToInt32( Num1.Text ), Convert::ToInt32( Num2.Text ) ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp deleted file mode 100644 index bfcfe422816..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Http; - -public ref class Sample -{ -private: - void sampleFunction() - { - // - WebProxy^ proxyObject = gcnew WebProxy("http://proxyserver:80/", true); - - // HttpClient lifecycle management best practices: - // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use - HttpClientHandler^ handler = gcnew HttpClientHandler(); - handler->Proxy = proxyObject; - HttpClient^ client = gcnew HttpClient(handler); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp deleted file mode 100644 index 2a706abc691..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; - -public ref class Sample -{ -private: - void sampleFunction() - { - // - // Initialize the WebRequest. - WebRequest^ myRequest = WebRequest::Create( "http://www.contoso.com" ); - - // Return the response. - WebResponse^ myResponse = myRequest->GetResponse(); - - // Code to use the WebResponse goes here. - - // Close the response to free resources. - myResponse->Close(); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp deleted file mode 100644 index ef3028f80a5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; - -public ref class Sample -{ -private: - void sampleFunction() - { - // - WebRequest^ myRequest = WebRequest::Create( "http://www.contoso.com" ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp deleted file mode 100644 index 557ea7d00c8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class XClass -{ -public: - - /* Apply the XmlAnyElementAttribute to a field returning an array - of XmlElement objects. */ - - [XmlAnyElement] - array^AllElements; -}; - -public ref class Test -{ -public: - void DeserializeObject( String^ filename ) - { - // Create an XmlSerializer. - XmlSerializer^ mySerializer = gcnew XmlSerializer( XClass::typeid ); - - // To read a file, a FileStream is needed. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - - // Deserialize the class. - XClass^ x = dynamic_cast(mySerializer->Deserialize( fs )); - - // Read the element names and values. - System::Collections::IEnumerator^ myEnum = x->AllElements->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - XmlElement^ xel = safe_cast(myEnum->Current); - Console::WriteLine( "{0}: {1}", xel->LocalName, xel->Value ); - } - } -}; - -int main() -{ - Test^ t = gcnew Test; - t->DeserializeObject( "XFile.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp deleted file mode 100644 index 7824f3ba5cb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,132 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; -public ref class Item -{ -public: - - [XmlElement(ElementName="OrderItem")] - String^ ItemName; - String^ ItemCode; - Decimal ItemPrice; - int ItemQuantity; -}; - -public ref class BookItem: public Item -{ -public: - String^ Title; - String^ Author; - String^ ISBN; -}; - -// This is the class that will be serialized. -public ref class MyRootClass -{ -private: - array^items; - -public: - - /* Here is a simple way to serialize the array as XML. Using the - XmlArrayAttribute, assign an element name and namespace. The - IsNullable property determines whether the element will be - generated if the field is set to a null value. If set to true, - the default, setting it to a null value will cause the XML - xsi:null attribute to be generated. */ - - [XmlArray(ElementName="MyStrings", - Namespace="http://www.cpandl.com",IsNullable=true)] - array^MyStringArray; - - /* Here is a more complex example of applying an - XmlArrayAttribute. The Items property can contain both Item - and BookItem objects. Use the XmlArrayItemAttribute to specify - that both types can be inserted into the array. */ - [XmlArrayItem(ElementName="Item", - IsNullable=true, - Type=Item::typeid, - Namespace="http://www.cpandl.com"), - XmlArrayItem(ElementName="BookItem", - IsNullable=true, - Type=BookItem::typeid, - Namespace="http://www.cohowinery.com")] - [XmlArray] - property array^ Items - { - array^ get() - { - return items; - } - - void set( array^value ) - { - items = value; - } - } -}; - -public ref class Run -{ -public: - void SerializeDocument( String^ filename ) - { - // Creates a new XmlSerializer. - XmlSerializer^ s = gcnew XmlSerializer( MyRootClass::typeid ); - - // Writing the file requires a StreamWriter. - TextWriter^ myWriter = gcnew StreamWriter( filename ); - - // Creates an instance of the class to serialize. - MyRootClass^ myRootClass = gcnew MyRootClass; - - /* Uses a basic method of creating an XML array: Create and - populate a string array, and assign it to the - MyStringArray property. */ - array^myString = {"Hello","world","!"}; - myRootClass->MyStringArray = myString; - - /* Uses a more advanced method of creating an array: - create instances of the Item and BookItem, where BookItem - is derived from Item. */ - Item^ item1 = gcnew Item; - BookItem^ item2 = gcnew BookItem; - - // Sets the objects' properties. - item1->ItemName = "Widget1"; - item1->ItemCode = "w1"; - item1->ItemPrice = 231; - item1->ItemQuantity = 3; - item2->ItemCode = "w2"; - item2->ItemPrice = 123; - item2->ItemQuantity = 7; - item2->ISBN = "34982333"; - item2->Title = "Book of Widgets"; - item2->Author = "John Smith"; - - // Fills the array with the items. - array^myItems = {item1,item2}; - - // Sets the class's Items property to the array. - myRootClass->Items = myItems; - - /* Serializes the class, writes it to disk, and closes - the TextWriter. */ - s->Serialize( myWriter, myRootClass ); - myWriter->Close(); - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeDocument( "books.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp deleted file mode 100644 index dc6cfc478ab..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Book -{ -public: - String^ Title; - String^ Author; - String^ ISBN; -}; - -public ref class Library -{ -private: - array^books; - -public: - - [XmlArray(ElementName="My_Books")] - property array^ Books - { - array^ get() - { - return books; - } - - void set( array^value ) - { - books = value; - } - } -}; - -int main() -{ - String^ filename = "ArrayExample.xml"; - XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid ); - TextWriter^ t = gcnew StreamWriter( filename ); - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - ns->Add( "bk", "http://wwww.contoso.com" ); - Book^ b1 = gcnew Book; - b1->Title = "MyBook Title"; - b1->Author = "An Author"; - b1->ISBN = "00000000"; - Book^ b2 = gcnew Book; - b2->Title = "Another Title"; - b2->Author = "Another Author"; - b2->ISBN = "0000000"; - Library^ myLibrary = gcnew Library; - array^myBooks = {b1,b2}; - myLibrary->Books = myBooks; - mySerializer->Serialize( t, myLibrary, ns ); - t->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp deleted file mode 100644 index 84965bcbf7a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp +++ /dev/null @@ -1,111 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; -public ref class Winery -{ -public: - String^ Name; -}; - -public ref class VacationCompany -{ -public: - String^ Name; -}; - -public ref class Enterprises -{ -private: - array^wineries; - array^companies; - -public: - - // Sets the Form property to qualified, and specifies the namespace. - [XmlArray(Form=XmlSchemaForm::Qualified,ElementName="Company", - Namespace="http://www.cohowinery.com")] - property array^ Wineries - { - array^ get() - { - return wineries; - } - void set( array^value ) - { - wineries = value; - } - } - - [XmlArray(Form=XmlSchemaForm::Qualified,ElementName="Company", - Namespace="http://www.treyresearch.com")] - property array^ Companies - { - array^ get() - { - return companies; - } - void set( array^value ) - { - companies = value; - } - } -}; - -int main() -{ - String^ filename = "MyEnterprises.xml"; - - // Creates an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Enterprises::typeid ); - - // Writing file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Creates an instance of the XmlSerializerNamespaces class. - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - - // Adds namespaces and prefixes for the XML document instance. - ns->Add( "winery", "http://www.cohowinery.com" ); - ns->Add( "vacationCompany", "http://www.treyresearch.com" ); - - // Creates an instance of the class that will be serialized. - Enterprises^ myEnterprises = gcnew Enterprises; - - // Creates objects and adds to the array. - Winery^ w1 = gcnew Winery; - w1->Name = "cohowinery"; - array^myWinery = {w1}; - myEnterprises->Wineries = myWinery; - VacationCompany^ com1 = gcnew VacationCompany; - com1->Name = "adventure-works"; - array^myCompany = {com1}; - myEnterprises->Companies = myCompany; - - // Serializes the class, and closes the TextWriter. - mySerializer->Serialize( writer, myEnterprises, ns ); - writer->Close(); -} - -void ReadEnterprises( String^ filename ) -{ - XmlSerializer^ mySerializer = gcnew XmlSerializer( Enterprises::typeid ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Enterprises^ myEnterprises = dynamic_cast(mySerializer->Deserialize( fs )); - for ( int i = 0; i < myEnterprises->Wineries->Length; i++ ) - { - Console::WriteLine( myEnterprises->Wineries[ i ]->Name ); - } - for ( int i = 0; i < myEnterprises->Companies->Length; i++ ) - { - Console::WriteLine( myEnterprises->Companies[ i ]->Name ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp deleted file mode 100644 index b04f9de845e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class MyClass -{ -public: - - [XmlArray(IsNullable=true)] - array^IsNullableIsTrueArray; - - [XmlArray(IsNullable=false)] - array^IsNullableIsFalseArray; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp deleted file mode 100644 index ffc20656b48..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp +++ /dev/null @@ -1,162 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Book -{ -public: - String^ Title; - String^ Author; - String^ ISBN; - - [XmlAttributeAttribute] - String^ Publisher; -}; - -public ref class Periodical -{ -private: - String^ title; - -public: - - property String^ Title - { - String^ get() - { - return title; - } - void set( String^ value ) - { - title = value; - } - } -}; - -public ref class Library -{ -private: - array^books; - array^periodicals; - -public: - - /* This element will be qualified with the prefix - that is associated with the namespace http://wwww.cpandl.com. */ - [XmlArray(ElementName="Titles", - Namespace="http://wwww.cpandl.com")] - property array^ Books - { - array^ get() - { - return books; - } - void set( array^value ) - { - books = value; - } - } - - /* This element will be qualified with the prefix that is - associated with the namespace http://www.proseware.com. */ - [XmlArray(ElementName="Titles",Namespace= - "http://www.proseware.com")] - property array^ Periodicals - { - array^ get() - { - return periodicals; - } - void set( array^value ) - { - periodicals = value; - } - } -}; - -void WriteBook( String^ filename ) -{ - // Creates a new XmlSerializer. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid ); - - // Writing the file requires a StreamWriter. - TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); - - /* Creates an XmlSerializerNamespaces and adds prefixes and - namespaces to be used. */ - XmlSerializerNamespaces^ myNamespaces = gcnew XmlSerializerNamespaces; - myNamespaces->Add( "books", "http://wwww.cpandl.com" ); - myNamespaces->Add( "magazines", "http://www.proseware.com" ); - - // Creates an instance of the class to be serialized. - Library^ myLibrary = gcnew Library; - - // Creates two book objects. - Book^ b1 = gcnew Book; - b1->Title = "My Book Title"; - b1->Author = "An Author"; - b1->ISBN = "000000000"; - b1->Publisher = "Microsoft Press"; - Book^ b2 = gcnew Book; - b2->Title = "Another Book Title"; - b2->Author = "Another Author"; - b2->ISBN = "00000001"; - b2->Publisher = "Another Press"; - - /* Creates an array using the objects, and sets the Books property - to the array. */ - array^myBooks = {b1,b2}; - myLibrary->Books = myBooks; - - // Creates two Periodical objects. - Periodical^ per1 = gcnew Periodical; - per1->Title = "My Magazine Title"; - Periodical^ per2 = gcnew Periodical; - per2->Title = "Another Magazine Title"; - - // Sets the Periodicals property to the array. - array^myPeridocials = {per1,per2}; - myLibrary->Periodicals = myPeridocials; - - // Serializes the myLibrary object. - mySerializer->Serialize( myStreamWriter, myLibrary, myNamespaces ); - myStreamWriter->Close(); -} - -void ReadBook( String^ filename ) -{ - /* Creates an instance of an XmlSerializer - with the class used to read the document. */ - XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid ); - - // A FileStream is needed to read the file. - FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); - Library^ myLibrary = dynamic_cast(mySerializer->Deserialize( myFileStream )); - - // Reads each book in the array returned by the Books property. - for ( int i = 0; i < myLibrary->Books->Length; i++ ) - { - Console::WriteLine( myLibrary->Books[ i ]->Title ); - Console::WriteLine( myLibrary->Books[ i ]->Author ); - Console::WriteLine( myLibrary->Books[ i ]->ISBN ); - Console::WriteLine( myLibrary->Books[ i ]->Publisher ); - Console::WriteLine(); - } - for ( int i = 0; i < myLibrary->Periodicals->Length; i++ ) - { - Console::WriteLine( myLibrary->Periodicals[ i ]->Title ); - } -} - -int main() -{ - WriteBook( "MyLibrary.xml" ); - ReadBook( "MyLibrary.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp deleted file mode 100644 index 78a6040f3fa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class MyClass -{ -public: - - [XmlArrayAttribute] - array^MyStringArray; - - [XmlArrayAttribute] - array^MyIntegerArray; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp deleted file mode 100644 index 9b68919eff8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class MyClass -{ -public: - - [XmlArrayAttribute("MyStrings")] - array^MyStringArray; - - [XmlArrayAttribute(ElementName="MyIntegers")] - array^MyIntegerArray; -}; - -int main() -{ - String^ filename = "MyClass.xml"; - - // Creates a new instance of the XmlSerializer class. - XmlSerializer^ s = gcnew XmlSerializer( MyClass::typeid ); - - // Needs a StreamWriter to write the file. - TextWriter^ myWriter = gcnew StreamWriter( filename ); - MyClass^ myClass = gcnew MyClass; - - // Creates and populates a string array, then assigns - // it to the MyStringArray property. - array^myStrings = {"Hello","World","!"}; - myClass->MyStringArray = myStrings; - - /* Creates and populates an integer array, and assigns - it to the MyIntegerArray property. */ - array^myIntegers = {1,2,3}; - myClass->MyIntegerArray = myIntegers; - - // Serializes the class, and writes it to disk. - s->Serialize( myWriter, myClass ); - myWriter->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp deleted file mode 100644 index 7504aad63a3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,93 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -public ref class Employee -{ -public: - String^ Name; -}; - -public ref class Manager: public Employee -{ -public: - int Level; -}; - -public ref class Group -{ -public: - - /* The XmlArrayItemAttribute allows the XmlSerializer to insert - both the base type (Employee) and derived type (Manager) - into serialized arrays. */ - - [XmlArrayItem(Manager::typeid), - XmlArrayItem(Employee::typeid)] - array^Employees; - - /* Use the XmlArrayItemAttribute to specify types allowed - in an array of Object items. */ - - [XmlArray] - [XmlArrayItem(Int32::typeid, - ElementName="MyNumber"), - XmlArrayItem(String::typeid, - ElementName="MyString"), - XmlArrayItem(Manager::typeid)] - array^ExtraInfo; -}; - -void SerializeObject( String^ filename ) -{ - // Creates a new XmlSerializer. - XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); - - // Writing the XML file to disk requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - Group^ group = gcnew Group; - Manager^ manager = gcnew Manager; - Employee^ emp1 = gcnew Employee; - Employee^ emp2 = gcnew Employee; - manager->Name = "Consuela"; - manager->Level = 3; - emp1->Name = "Seiko"; - emp2->Name = "Martina"; - array^emps = {manager,emp1,emp2}; - group->Employees = emps; - - // Creates an int and a string and assigns to ExtraInfo. - array^temp = {43,"Extra",manager}; - group->ExtraInfo = temp; - - // Serializes the object, and closes the StreamWriter. - s->Serialize( writer, group ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - XmlSerializer^ x = gcnew XmlSerializer( Group::typeid ); - Group^ g = dynamic_cast(x->Deserialize( fs )); - Console::WriteLine( "Members:" ); - System::Collections::IEnumerator^ myEnum = g->Employees->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Employee^ e = safe_cast(myEnum->Current); - Console::WriteLine( "\t{0}", e->Name ); - } -} - -int main() -{ - SerializeObject( "TypeDoc.xml" ); - DeserializeObject( "TypeDoc.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp deleted file mode 100644 index 1ad1f494f35..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -// By default, this class results in XML elements named "Vehicle". -public ref class Vehicle -{ -public: - String^ id; -}; - -// By default, this class results in XML elements named "Car". -public ref class Car: public Vehicle -{ -public: - String^ Maker; -}; - -public ref class Transportation -{ -public: - - /* Specifies acceptable types and the ElementName generated - for each object type. */ - - [XmlArray("Vehicles")] - [XmlArrayItem(Vehicle::typeid,ElementName="Transport"), - XmlArrayItem(Car::typeid,ElementName="Automobile")] - array^MyVehicles; -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp deleted file mode 100644 index 6f0101ea001..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; - -// -public ref class Vehicle -{ -public: - String^ id; -}; - -public ref class Car: public Vehicle -{ -public: - String^ Maker; -}; - -public ref class Transportation -{ -public: - - // Specifies the Form property value. - - [XmlArray("Vehicles")] - [XmlArrayItem(Vehicle::typeid, - Form=XmlSchemaForm::Unqualified), - XmlArrayItem(Car::typeid, - Form=XmlSchemaForm::Qualified)] - array^MyVehicles; -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp deleted file mode 100644 index 10b3c35b2f1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -public ref class Employee -{ -public: - String^ Name; -}; - -public ref class Manager: public Employee -{ -public: - int Level; -}; - -public ref class Group -{ -public: - - [XmlArray(IsNullable=true)] - [XmlArrayItem(Manager::typeid,IsNullable=false), - XmlArrayItem(Employee::typeid,IsNullable=false)] - array^Employees; -}; - -void SerializeObject( String^ filename ) -{ - XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); - - // To write the file, a TextWriter is required. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Creates the object to serialize. - Group^ group = gcnew Group; - - // Creates a null Manager object. - Manager^ mgr = nullptr; - - // Creates a null Employee object. - Employee^ y = nullptr; - array^temp = {mgr,y}; - group->Employees = temp; - - // Serializes the object and closes the TextWriter. - s->Serialize( writer, group ); - writer->Close(); -} - -int main() -{ - SerializeObject( "TypeDoc.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp deleted file mode 100644 index 41cc05bd344..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Vehicle{}; - -public ref class Car: public Vehicle{}; - -// -public ref class Transportation -{ -public: - - // Sets the Namespace property. - - [XmlArrayItem(Car::typeid,Namespace="http://www.cpandl.com")] - array^MyVehicles; -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp deleted file mode 100644 index b249fa9707c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -public ref class Person -{ -public: - String^ Name; -}; - -public ref class Manager: public Person -{ -public: - int Rank; -}; - -public ref class Group -{ -public: - - /* The Type property instructs the XmlSerializer to accept both - the Person and Manager types in the array. */ - - [XmlArrayItem(Type=Manager::typeid), - XmlArrayItem(Type=Person::typeid)] - array^Staff; -}; - -void SerializeOrder( String^ filename ) -{ - // Creates an XmlSerializer. - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid ); - - // Creates the Group object, and two array items. - Group^ myGroup = gcnew Group; - Person^ p1 = gcnew Person; - p1->Name = "Jacki"; - Manager^ p2 = gcnew Manager; - p2->Name = "Megan"; - p2->Rank = 2; - array^myStaff = {p1,p2}; - myGroup->Staff = myStaff; - - // Serializes the object, and closes the StreamWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myGroup ); -} - -int main() -{ - SerializeOrder( "TypeEx.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp deleted file mode 100644 index 153e7b6e3d2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Vehicle -{ -public: - String^ id; -}; - -public ref class Car: public Vehicle -{ -public: - String^ Maker; -}; - -public ref class Transportation -{ -public: - - [XmlArrayItem, - XmlArrayItem(Car::typeid,ElementName="Automobile")] - array^MyVehicles; -}; - -void SerializeObject( String^ filename ) -{ - // Creates an XmlSerializer for the Transportation class. - XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); - - // Writing the XML file to disk requires a TextWriter. - TextWriter^ myTextWriter = gcnew StreamWriter( filename ); - - // Creates the object to serialize. - Transportation^ myTransportation = gcnew Transportation; - - // Creates objects to add to the array. - Vehicle^ myVehicle = gcnew Vehicle; - myVehicle->id = "A12345"; - Car^ myCar = gcnew Car; - myCar->id = "Car 34"; - myCar->Maker = "FamousCarMaker"; - array^temp = {myVehicle,myCar}; - myTransportation->MyVehicles = temp; - - // Serializes the object, and closes the StreamWriter. - MySerializer->Serialize( myTextWriter, myTransportation ); - myTextWriter->Close(); -} - -void DeserializeObject( String^ filename ) -{ - // Creates an XmlSerializer instance. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); - FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); - Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); - for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) - { - Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); - } -} - -int main() -{ - SerializeObject( "XmlArrayItem1.xml" ); - DeserializeObject( "XmlArrayItem1.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp deleted file mode 100644 index 27560a12758..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Vehicle -{ -public: - String^ id; -}; - -public ref class Car: public Vehicle -{ -public: - String^ Maker; -}; - -public ref class Transportation -{ -public: - - [XmlArrayItem(ElementName="Transportation"), - XmlArrayItem(Car::typeid,ElementName="Automobile")] - array^MyVehicles; -}; - -void SerializeObject( String^ filename ) -{ - // Creates an XmlSerializer for the Transportation class. - XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); - - // Writing the XML file to disk requires a TextWriter. - TextWriter^ myTextWriter = gcnew StreamWriter( filename ); - Transportation^ myTransportation = gcnew Transportation; - Vehicle^ myVehicle = gcnew Vehicle; - myVehicle->id = "A12345"; - Car^ myCar = gcnew Car; - myCar->id = "Car 34"; - myCar->Maker = "FamousCarMaker"; - array^myVehicles = {myVehicle,myCar}; - myTransportation->MyVehicles = myVehicles; - - // Serializes the object, and closes the StreamWriter. - MySerializer->Serialize( myTextWriter, myTransportation ); - myTextWriter->Close(); -} - -void DeserializeObject( String^ filename ) -{ - // Creates the serializer with the type to deserialize. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); - FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); - Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); - for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) - { - Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); - } -} - -int main() -{ - SerializeObject( "XmlArrayItem2.xml" ); - DeserializeObject( "XmlArrayItem2.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp deleted file mode 100644 index 8809b40c0af..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Vehicle -{ -public: - String^ id; -}; - -public ref class Car: public Vehicle -{ -public: - String^ Maker; -}; - -public ref class Transportation -{ -public: - - [XmlArrayItem(Vehicle::typeid), - XmlArrayItem(Car::typeid)] - array^MyVehicles; -}; - -void SerializeObject( String^ filename ) -{ - // Creates an XmlSerializer. - XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); - - // Writing the XML file to disk requires a TextWriter. - TextWriter^ myTextWriter = gcnew StreamWriter( filename ); - Transportation^ myTransportation = gcnew Transportation; - Vehicle^ myVehicle = gcnew Vehicle; - myVehicle->id = "A12345"; - Car^ myCar = gcnew Car; - myCar->id = "Car 34"; - myCar->Maker = "FamousCarMaker"; - array^myVehicles = {myVehicle,myCar}; - myTransportation->MyVehicles = myVehicles; - - // Serializes the object, and closes the StreamWriter. - MySerializer->Serialize( myTextWriter, myTransportation ); - myTextWriter->Close(); -} - -void DeserializeObject( String^ filename ) -{ - // Creates the serializer with the type to deserialize. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); - FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); - Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); - for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) - { - Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); - } -} - -int main() -{ - SerializeObject( "XmlArrayItem3.xml" ); - DeserializeObject( "XmlArrayItem3.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp deleted file mode 100644 index 6886a80fe91..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Vehicle -{ -public: - String^ id; -}; - -public ref class Car: public Vehicle -{ -public: - String^ Maker; -}; - -public ref class Transportation -{ -public: - - [XmlArray] - [XmlArrayItem("Transport",Vehicle::typeid), - XmlArrayItem("Automobile",Car::typeid)] - array^MyVehicles; -}; - -void SerializeObject( String^ filename ) -{ - // Creates an XmlSerializer for the Transportation class. - XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); - - // Writing the XML file to disk requires a TextWriter. - TextWriter^ myTextWriter = gcnew StreamWriter( filename ); - Transportation^ myTransportation = gcnew Transportation; - Vehicle^ myVehicle = gcnew Vehicle; - myVehicle->id = "A12345"; - Car^ myCar = gcnew Car; - myCar->id = "Car 34"; - myCar->Maker = "FamousCarMaker"; - array^myVehicles = {myVehicle,myCar}; - myTransportation->MyVehicles = myVehicles; - - // Serializes the object, and closes the StreamWriter. - MySerializer->Serialize( myTextWriter, myTransportation ); - myTextWriter->Close(); -} - -void DeserializeObject( String^ filename ) -{ - // Creates an XmlSerializer. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); - FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); - Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); - for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) - { - Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); - } -} - -int main() -{ - SerializeObject( "XmlArrayItem4.xml" ); - DeserializeObject( "XmlArrayItem4.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp deleted file mode 100644 index ded3d3f240a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Schema; - -public ref class Group -{ -public: - - [XmlAttributeAttribute(Namespace="http://www.cpandl.com")] - String^ GroupName; - - [XmlAttributeAttribute(DataType="base64Binary")] - array^GroupNumber; - - [XmlAttributeAttribute(DataType="date",AttributeName="CreationDate")] - DateTime Today; -}; - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - myGroup->GroupName = ".NET"; - array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )}; - myGroup->GroupNumber = hexByte; - DateTime myDate = DateTime(2001,1,10); - myGroup->Today = myDate; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); -} - -int main() -{ - SerializeObject( "Attributes.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp deleted file mode 100644 index bf8889f6772..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Group -{ -public: - - // Change the XML attribute name. - - [XmlAttributeAttribute(AttributeName="MgrName")] - String^ Name; - /* Use the AttributeName to collect all the XML attributes - in the XML-document instance. */ -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Serializing" ); - - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - /* Set the Name property, which will be generated - as an XML attribute. */ - myGroup->Name = "Wallace"; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - Console::WriteLine( "Deserializing" ); - XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); - Console::WriteLine( myGroup->Name ); -} - -int main() -{ - /* To use the AttributeName to collect all the - XML attributes. Call SerializeObject to generate - an XML document and alter the document by adding - new XML attributes to it. Then comment out the SerializeObject - method, and call DeserializeObject. */ - SerializeObject( "MyAtts.xml" ); - DeserializeObject( "MyAtts.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp deleted file mode 100644 index dbc9a73c48f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class Group -{ -public: - - [XmlAttributeAttribute(DataType="string")] - String^ Name; - - [XmlAttributeAttribute(DataType="base64Binary")] - array^Hex64Code; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp deleted file mode 100644 index 37de504e9b7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; - -// -public ref class Vehicle -{ -public: - - [XmlAttributeAttribute(Form=XmlSchemaForm::Qualified)] - String^ Maker; - - [XmlAttributeAttribute(Form=XmlSchemaForm::Unqualified)] - String^ ModelID; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp deleted file mode 100644 index 8cd4fd710f3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class Car -{ -public: - - [XmlAttributeAttribute(Namespace="Make")] - String^ MakerName; - - [XmlAttributeAttribute(Namespace="Model")] - String^ ModelName; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp deleted file mode 100644 index 4dc40d33dd2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void serializer_UnknownAttribute( Object^ /*sender*/, XmlAttributeEventArgs^ e ) - { - System::Xml::XmlAttribute^ attr = e->Attr; - Console::WriteLine( "Unknown Attribute Name and Value: {0} = '{1}'", - attr->Name, attr->Value ); - Object^ x = e->ObjectBeingDeserialized; - Console::WriteLine( "ObjectBeingDeserialized: {0}", x ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp deleted file mode 100644 index 5d23724e8ea..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp +++ /dev/null @@ -1,113 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -public ref class Instrument -{ -public: - String^ Name; -}; - -public ref class Brass: public Instrument -{ -public: - bool IsValved; -}; - -public ref class Orchestra -{ -public: - array^Instruments; -}; - -void SerializeObject( String^ filename ) -{ - /* Each overridden field, property, or type requires - an XmlAttributes object. */ - XmlAttributes^ attrs = gcnew XmlAttributes; - - /* Create an XmlElementAttribute to override the - field that returns Instrument objects. The overridden field - returns Brass objects instead. */ - XmlElementAttribute^ attr = gcnew XmlElementAttribute; - attr->ElementName = "Brass"; - attr->Type = Brass::typeid; - - // Add the element to the collection of elements. - attrs->XmlElements->Add( attr ); - - // Create the XmlAttributeOverrides object. - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - - /* Add the type of the class that contains the overridden - member and the XmlAttributes to override it with to the - XmlAttributeOverrides object. */ - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - - // Create the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create the object that will be serialized. - Orchestra^ band = gcnew Orchestra; - - // Create an object of the derived type. - Brass^ i = gcnew Brass; - i->Name = "Trumpet"; - i->IsValved = true; - array^myInstruments = {i}; - band->Instruments = myInstruments; - - // Serialize the object. - s->Serialize( writer, band ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - - // Create an XmlElementAttribute to override the Instrument. - XmlElementAttribute^ attr = gcnew XmlElementAttribute; - attr->ElementName = "Brass"; - attr->Type = Brass::typeid; - - // Add the XmlElementAttribute to the collection of objects. - attrs->XmlElements->Add( attr ); - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - - // Create the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Orchestra^ band = dynamic_cast(s->Deserialize( fs )); - Console::WriteLine( "Brass:" ); - - /* The difference between deserializing the overridden - XML document and serializing it is this: To read the derived - object values, you must declare an object of the derived type - (Brass), and cast the Instrument instance to it. */ - Brass^ b; - System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Instrument^ i = safe_cast(myEnum->Current); - b = dynamic_cast(i); - Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved ); - } -} - -int main() -{ - SerializeObject( "Override.xml" ); - DeserializeObject( "Override.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp deleted file mode 100644 index e474a5694c3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp +++ /dev/null @@ -1,102 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -ref class Band; -ref class Instrument; - -/* This is the class that will be overridden. The XmlIncludeAttribute -tells the XmlSerializer that the overriding type exists. */ - -[XmlInclude(Band::typeid)] -public ref class Orchestra -{ -public: - array^Instruments; -}; - -// This is the overriding class. -public ref class Band: public Orchestra -{ -public: - String^ BandName; -}; - -public ref class Instrument -{ -public: - String^ Name; -}; - -void SerializeObject( String^ filename ) -{ - /* Each object that is being overridden requires - an XmlAttributes object. */ - XmlAttributes^ attrs = gcnew XmlAttributes; - - // An XmlRootAttribute allows overriding the Orchestra class. - XmlRootAttribute^ xmlRoot = gcnew XmlRootAttribute; - - // Set the object to the XmlAttribute.XmlRoot property. - attrs->XmlRoot = xmlRoot; - - // Create an XmlAttributeOverrides object. - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - - // Add the XmlAttributes to the XmlAttributeOverrrides. - attrOverrides->Add( Orchestra::typeid, attrs ); - - // Create the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create the object using the derived class. - Band^ band = gcnew Band; - band->BandName = "NewBand"; - - // Create an Instrument. - Instrument^ i = gcnew Instrument; - i->Name = "Trumpet"; - array^myInstruments = {i}; - band->Instruments = myInstruments; - - // Serialize the object. - s->Serialize( writer, band ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlRootAttribute^ attr = gcnew XmlRootAttribute; - attrs->XmlRoot = attr; - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - - // Deserialize the Band object. - Band^ band = dynamic_cast(s->Deserialize( fs )); - Console::WriteLine( "Brass:" ); - System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Instrument^ i = safe_cast(myEnum->Current); - Console::WriteLine( i->Name ); - } -} - -int main() -{ - SerializeObject( "Override.xml" ); - DeserializeObject( "Override.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp deleted file mode 100644 index ae9b594d0f2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -// This is the class that will be serialized. -public ref class Group -{ -public: - String^ GroupName; - - [XmlAttributeAttribute] - int GroupCode; -}; - -public ref class Sample -{ -public: - XmlSerializer^ CreateOverrider() - { - // Create an XmlAttributeOverrides object. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Create an XmlAttributeAttribute to override the base class - object's XmlAttributeAttribute object. Give the overriding object - a new attribute name ("Code"). */ - XmlAttributeAttribute^ xAtt = gcnew XmlAttributeAttribute; - xAtt->AttributeName = "Code"; - - /* Create an instance of the XmlAttributes class and set the - XmlAttribute property to the XmlAttributeAttribute object. */ - XmlAttributes^ attrs = gcnew XmlAttributes; - attrs->XmlAttribute = xAtt; - - /* Add the XmlAttributes object to the XmlAttributeOverrides - and specify the type and member name to override. */ - xOver->Add( Group::typeid, "GroupCode", attrs ); - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); - return xSer; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp deleted file mode 100644 index d9d43cdf6b3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -// This is the class that will be serialized. -public ref class Group -{ -public: - String^ GroupName; - - [XmlAttributeAttribute] - int GroupCode; -}; - -public ref class Sample -{ -public: - XmlSerializer^ CreateOverrider() - { - // Create an XmlSerializer with overriding attributes. - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; - - // Set a new Namespace and ElementName for the root element. - xRoot->Namespace = "http://www.cpandl.com"; - xRoot->ElementName = "NewGroup"; - attrs->XmlRoot = xRoot; - xOver->Add( Group::typeid, attrs ); - - // Get the XmlAttributes object, based on the type. - XmlAttributes^ tempAttrs; - tempAttrs = xOver[ Group::typeid ]; - - // Print the Namespace and ElementName of the root. - Console::WriteLine( tempAttrs->XmlRoot->Namespace ); - Console::WriteLine( tempAttrs->XmlRoot->ElementName ); - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); - return xSer; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp deleted file mode 100644 index 099c81b6664..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -// This is the class that will be serialized. -public ref class Group -{ -public: - String^ GroupName; - - [XmlAttributeAttribute] - int GroupCode; -}; - -public ref class Sample -{ -public: - XmlSerializer^ CreateOverrider() - { - // Create an XmlSerializer with overriding attributes. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Create an XmlAttributeAttribute object and set the - AttributeName property. */ - XmlAttributeAttribute^ xAtt = gcnew XmlAttributeAttribute; - xAtt->AttributeName = "Code"; - - /* Create a new XmlAttributes object and set the - XmlAttributeAttribute object to the XmlAttribute property. */ - XmlAttributes^ attrs = gcnew XmlAttributes; - attrs->XmlAttribute = xAtt; - - /* Add the XmlAttributes to the XmlAttributeOverrides object. The - name of the overridden attribute must be specified. */ - xOver->Add( Group::typeid, "GroupCode", attrs ); - - // Get the XmlAttributes object for the type and member. - XmlAttributes^ tempAttrs; - tempAttrs = xOver[Group::typeid, "GroupCode"]; - Console::WriteLine( tempAttrs->XmlAttribute->AttributeName ); - - // Create the XmlSerializer instance and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); - return xSer; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp deleted file mode 100644 index c0960e934fc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp +++ /dev/null @@ -1,85 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Member -{ -public: - String^ MemberName; -}; - - -// This is the class that will be serialized. -public ref class Group -{ -public: - - // This field will be overridden. - array^Members; -}; - - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Creating XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - // Add an override for the XmlArray. - XmlArrayAttribute^ xArray = gcnew XmlArrayAttribute( "Staff" ); - xArray->Namespace = "http://www.cpandl.com"; - xAttrs->XmlArray = xArray; - xOver->Add( Group::typeid, "Members", xAttrs ); - - // Create the XmlSerializer and return it. - return gcnew XmlSerializer( Group::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - Member^ m = gcnew Member; - m->MemberName = "Paul"; - array^temp = {m}; - myGroup->Members = temp; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); - System::Collections::IEnumerator^ myEnum = myGroup->Members->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Member^ m = safe_cast(myEnum->Current); - Console::WriteLine( m->MemberName ); - } -} - -int main() -{ - SerializeObject( "OverrideArray.xml" ); - DeserializeObject( "OverrideArray.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp deleted file mode 100644 index d2aff93a0ce..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp +++ /dev/null @@ -1,107 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Member -{ -public: - String^ MemberName; -}; - -// This is the class that will be serialized. -public ref class Group -{ -public: - array^Members; -}; - -public ref class NewMember: public Member -{ -public: - int MemberID; -}; - -public ref class RetiredMember: public NewMember -{ -public: - DateTime RetireDate; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - // Add an override for the XmlArrayItem. - XmlArrayItemAttribute^ xArrayItem = gcnew XmlArrayItemAttribute( NewMember::typeid ); - xArrayItem->Namespace = "http://www.cpandl.com"; - xAttrs->XmlArrayItems->Add( xArrayItem ); - - // Add a second override. - XmlArrayItemAttribute^ xArrayItem2 = gcnew XmlArrayItemAttribute( RetiredMember::typeid ); - xArrayItem2->Namespace = "http://www.cpandl.com"; - xAttrs->XmlArrayItems->Add( xArrayItem2 ); - - // Add all overrides to XmlAttribueOverrides object. - xOver->Add( Group::typeid, "Members", xAttrs ); - - // Create the XmlSerializer and return it. - return gcnew XmlSerializer( Group::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - NewMember^ m = gcnew NewMember; - m->MemberName = "Paul"; - m->MemberID = 2; - - // Create a second member. - RetiredMember^ m2 = gcnew RetiredMember; - m2->MemberName = "Renaldo"; - m2->MemberID = 23; - m2->RetireDate = DateTime(2000,10,10); - array^temp = {m,m2}; - myGroup->Members = temp; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); - System::Collections::IEnumerator^ myEnum = myGroup->Members->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Member^ m = safe_cast(myEnum->Current); - Console::WriteLine( m->MemberName ); - } -} - -int main() -{ - SerializeObject( "OverrideArrayItem.xml" ); - DeserializeObject( "OverrideArrayItem.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp deleted file mode 100644 index 080d02f704e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,78 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class Group -{ -public: - - // This is the attribute that will be overridden. - - [XmlAttributeAttribute] - String^ GroupName; - int GroupNumber; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - /* Create an overriding XmlAttributeAttribute set it to - the XmlAttribute property of the XmlAttributes object.*/ - XmlAttributeAttribute^ xAttribute = gcnew XmlAttributeAttribute( "SplinterName" ); - xAttrs->XmlAttribute = xAttribute; - - // Add to the XmlAttributeOverrides. Specify the member name. - xOver->Add( Group::typeid, "GroupName", xAttrs ); - - // Create the XmlSerializer and return it. - return gcnew XmlSerializer( Group::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - /* Set the Name property, which will be generated - as an XML attribute. */ - myGroup->GroupName = ".NET"; - myGroup->GroupNumber = 1; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); - Console::WriteLine( myGroup->GroupName ); - Console::WriteLine( myGroup->GroupNumber ); -} - -int main() -{ - SerializeObject( "OverrideAttribute.xml" ); - DeserializeObject( "OverrideAttribute.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp deleted file mode 100644 index 79e6e301177..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,112 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -public ref class Instrument -{ -public: - String^ Name; -}; - -public ref class Brass: public Instrument -{ -public: - bool IsValved; -}; - -public ref class Orchestra -{ -public: - array^Instruments; -}; - -void SerializeObject( String^ filename ) -{ - /* Each overridden field, property, or type requires - an XmlAttributes object. */ - XmlAttributes^ attrs = gcnew XmlAttributes; - - /* Create an XmlElementAttribute to override the - field that returns Instrument objects. The overridden field - returns Brass objects instead. */ - XmlElementAttribute^ attr = gcnew XmlElementAttribute; - attr->ElementName = "Brass"; - attr->Type = Brass::typeid; - - // Add the element to the collection of elements. - attrs->XmlElements->Add( attr ); - - // Create the XmlAttributeOverrides object. - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - - /* Add the type of the class that contains the overridden - member and the XmlAttributes to override it with to the - XmlAttributeOverrides object. */ - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - - // Create the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create the object that will be serialized. - Orchestra^ band = gcnew Orchestra; - - // Create an object of the derived type. - Brass^ i = gcnew Brass; - i->Name = "Trumpet"; - i->IsValved = true; - array^myInstruments = {i}; - band->Instruments = myInstruments; - - // Serialize the object. - s->Serialize( writer, band ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - - // Create an XmlElementAttribute to override the Instrument. - XmlElementAttribute^ attr = gcnew XmlElementAttribute; - attr->ElementName = "Brass"; - attr->Type = Brass::typeid; - - // Add the element to the collection of elements. - attrs->XmlElements->Add( attr ); - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - - // Create the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Orchestra^ band = dynamic_cast(s->Deserialize( fs )); - Console::WriteLine( "Brass:" ); - - /* The difference between deserializing the overridden - XML document and serializing it is this: To read the derived - object values, you must declare an object of the derived type - (Brass), and cast the Instrument instance to it. */ - Brass^ b; - System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Instrument^ i = safe_cast(myEnum->Current); - b = dynamic_cast(i); - Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved ); - } -} - -int main() -{ - SerializeObject( "Override.xml" ); - DeserializeObject( "Override.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp deleted file mode 100644 index 40f6a96deb7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::ComponentModel; - -// This is the class that will be serialized. -public ref class Pet -{ -public: - - // The default value for the Animal field is "Dog". - - [DefaultValueAttribute("Dog")] - String^ Animal; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - // Add an override for the default value of the GroupName. - Object^ defaultAnimal = "Cat"; - xAttrs->XmlDefaultValue = defaultAnimal; - - // Add all the XmlAttributes to the XmlAttributeOverrides object. - xOver->Add( Pet::typeid, "Animal", xAttrs ); - - // Create the XmlSerializer and return it. - return gcnew XmlSerializer( Pet::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Pet^ myPet = gcnew Pet; - - /* Set the Animal property. If you set it to the default value, - which is "Cat" (the value assigned to the XmlDefaultValue - of the XmlAttributes object), no value will be serialized. - If you change the value to any other value (including "Dog"), - the value will be serialized. - */ - // The default value "Cat" will be assigned (nothing serialized). - myPet->Animal = ""; - - // Uncommenting the next line also results in the default - // value because Cat is the default value (not serialized). - // myPet.Animal = "Cat"; - // Uncomment the next line to see the value serialized: - // myPet.Animal = "fish"; - // This will also be serialized because Dog is not the - // default anymore. - // myPet.Animal = "Dog"; - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myPet ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Pet^ myPet = dynamic_cast(mySerializer->Deserialize( fs )); - Console::WriteLine( myPet->Animal ); -} - -int main() -{ - SerializeObject( "OverrideDefaultValue.xml" ); - DeserializeObject( "OverrideDefaultValue.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp deleted file mode 100644 index dc3a90e6177..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp +++ /dev/null @@ -1,101 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Collections; -using namespace System::Xml; - -public ref class Car -{ -public: - String^ Name; -}; - -public ref class Plane -{ -public: - String^ Name; -}; - -public ref class Truck -{ -public: - String^ Name; -}; - -public ref class Train -{ -public: - String^ Name; -}; - -public ref class Transportation -{ -public: - - // Subsequent code overrides these two XmlElementAttributes. - - [XmlElement(Car::typeid), - XmlElement(Plane::typeid)] - ArrayList^ Vehicles; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributes and XmlAttributeOverrides objects. - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Create an XmlElementAttribute to override - the Vehicles property. */ - XmlElementAttribute^ xElement1 = gcnew XmlElementAttribute( Truck::typeid ); - - // Add the XmlElementAttribute to the collection. - attrs->XmlElements->Add( xElement1 ); - - /* Create a second XmlElementAttribute, and - add it to the collection. */ - XmlElementAttribute^ xElement2 = gcnew XmlElementAttribute( Train::typeid ); - attrs->XmlElements->Add( xElement2 ); - - /* Add the XmlAttributes to the XmlAttributeOverrides, - specifying the member to override. */ - xOver->Add( Transportation::typeid, "Vehicles", attrs ); - - // Create the XmlSerializer, and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver ); - return xSer; -} - -void SerializeObject( String^ filename ) -{ - // Create an XmlSerializer instance. - XmlSerializer^ xSer = CreateOverrider(); - - // Create the object and serialize it. - Transportation^ myTransportation = gcnew Transportation; - - /* Create two new override objects that can be - inserted into the array. */ - myTransportation->Vehicles = gcnew ArrayList; - Truck^ myTruck = gcnew Truck; - myTruck->Name = "MyTruck"; - Train^ myTrain = gcnew Train; - myTrain->Name = "MyTrain"; - myTransportation->Vehicles->Add( myTruck ); - myTransportation->Vehicles->Add( myTrain ); - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myTransportation ); -} - -int main() -{ - SerializeObject( "OverrideElement.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp deleted file mode 100644 index 9b65599120b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public enum class FoodType -{ - // Subsequent code overrides these enumerations. - Low, High -}; - -// This is the class that will be serialized. -public ref class Food -{ -public: - FoodType Type; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - // Add an XmlEnumAttribute for the FoodType.Low enumeration. - XmlEnumAttribute^ xEnum = gcnew XmlEnumAttribute; - xEnum->Name = "Cold"; - xAttrs->XmlEnum = xEnum; - xOver->Add( FoodType::typeid, "Low", xAttrs ); - - // Add an XmlEnumAttribute for the FoodType.High enumeration. - xAttrs = gcnew XmlAttributes; - xEnum = gcnew XmlEnumAttribute; - xEnum->Name = "Hot"; - xAttrs->XmlEnum = xEnum; - xOver->Add( FoodType::typeid, "High", xAttrs ); - - // Create the XmlSerializer, and return it. - return gcnew XmlSerializer( Food::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Food^ myFood = gcnew Food; - - // Set the object properties. - myFood->Type = FoodType::High; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myFood ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Food^ myFood = dynamic_cast(mySerializer->Deserialize( fs )); - Console::WriteLine( myFood->Type ); -} - -int main() -{ - SerializeObject( "OverrideEnum.xml" ); - DeserializeObject( "OverrideEnum.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp deleted file mode 100644 index 1f586f80547..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class Group -{ -public: - - // The GroupName value will be serialized--unless it's overridden. - String^ GroupName; - - /* This field will be ignored when serialized-- - unless it's overridden. */ - - [XmlIgnoreAttribute] - String^ Comment; -}; - - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - - /* Setting XmlIgnore to false overrides the XmlIgnoreAttribute - applied to the Comment field. Thus it will be serialized.*/ - attrs->XmlIgnore = false; - xOver->Add( Group::typeid, "Comment", attrs ); - - /* Use the XmlIgnore to instruct the XmlSerializer to ignore - the GroupName instead. */ - attrs = gcnew XmlAttributes; - attrs->XmlIgnore = true; - xOver->Add( Group::typeid, "GroupName", attrs ); - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); - return xSer; -} - -void SerializeObject( String^ filename ) -{ - // Create an XmlSerializer instance. - XmlSerializer^ xSer = CreateOverrider(); - - // Create the object to serialize and set its properties. - Group^ myGroup = gcnew Group; - myGroup->GroupName = ".NET"; - myGroup->Comment = "My Comment..."; - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Serialize the object and close the TextWriter. - xSer->Serialize( writer, myGroup ); - writer->Close(); -} - -int main() -{ - SerializeObject( "IgnoreXml.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp deleted file mode 100644 index 42c1f3a3503..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class Group -{ -public: - String^ GroupName; - - [XmlAttributeAttribute] - int GroupCode; -}; - -// Return an XmlSerializer for overriding attributes. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributes and XmlAttributeOverrides objects. - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; - - // Set a new Namespace and ElementName for the root element. - xRoot->Namespace = "http://www.cpandl.com"; - xRoot->ElementName = "NewGroup"; - attrs->XmlRoot = xRoot; - - /* Add the XmlAttributes object to the XmlAttributeOverrides. - No member name is needed because the whole class is - overridden. */ - xOver->Add( Group::typeid, attrs ); - - // Get the XmlAttributes object, based on the type. - XmlAttributes^ tempAttrs; - tempAttrs = xOver[ Group::typeid ]; - - // Print the Namespace and ElementName of the root. - Console::WriteLine( tempAttrs->XmlRoot->Namespace ); - Console::WriteLine( tempAttrs->XmlRoot->ElementName ); - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); - return xSer; -} - -void SerializeObject( String^ filename ) -{ - // Create the XmlSerializer using the CreateOverrider method. - XmlSerializer^ xSer = CreateOverrider(); - - // Create the object to serialize. - Group^ myGroup = gcnew Group; - myGroup->GroupName = ".NET"; - myGroup->GroupCode = 123; - - // To write the file, a TextWriter is required. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Serialize the object and close the TextWriter. - xSer->Serialize( writer, myGroup ); - writer->Close(); -} - -int main() -{ - SerializeObject( "OverrideRoot.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp deleted file mode 100644 index e2732ed2c57..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class Group -{ -public: - String^ GroupName; - - // This field will be serialized as XML text. - String^ Comment; -}; - -// Return an XmlSerializer to be used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - /* Create an XmlTextAttribute and assign it to the XmlText - property. This instructs the XmlSerializer to treat the - Comment field as XML text. */ - XmlTextAttribute^ xText = gcnew XmlTextAttribute; - xAttrs->XmlText = xText; - xOver->Add( Group::typeid, "Comment", xAttrs ); - - // Create the XmlSerializer, and return it. - return gcnew XmlSerializer( Group::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - myGroup->GroupName = ".NET"; - myGroup->Comment = "Great Stuff!"; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); - Console::WriteLine( myGroup->GroupName ); - Console::WriteLine( myGroup->Comment ); -} - -int main() -{ - SerializeObject( "OverrideText.xml" ); - DeserializeObject( "OverrideText.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp deleted file mode 100644 index d2cccc13596..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -public ref class Car -{ -public: - int ID; -}; - -public ref class Transportation -{ -public: - array^Cars; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlAttributes and XmlAttributeOverrides objects. - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Create an XmlTypeAttribute and change the name of the - XML type. */ - XmlTypeAttribute^ xType = gcnew XmlTypeAttribute; - xType->TypeName = "Autos"; - - // Set the XmlTypeAttribute to the XmlType property. - attrs->XmlType = xType; - - /* Add the XmlAttributes to the XmlAttributeOverrides, - specifying the member to override. */ - xOver->Add( Car::typeid, attrs ); - - // Create the XmlSerializer, and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver ); - return xSer; -} - -void SerializeObject( String^ filename ) -{ - // Create an XmlSerializer instance. - XmlSerializer^ xSer = CreateOverrider(); - - // Create object and serialize it. - Transportation^ myTransportation = gcnew Transportation; - Car^ c1 = gcnew Car; - c1->ID = 12; - Car^ c2 = gcnew Car; - c2->ID = 44; - array^temp0 = {c1,c2}; - myTransportation->Cars = temp0; - - // To write the file, a TextWriter is required. - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myTransportation ); -} - -int main() -{ - SerializeObject( "XmlType.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp deleted file mode 100644 index eea4fa29c6d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml::Serialization; -public ref class Employee -{ -public: - String^ Name; -}; - -public ref class Manager: public Employee -{ -public: - int Level; -}; - -public ref class Group -{ -public: - - /* Set the element name and namespace of the XML element. - By applying an XmlElementAttribute to an array, you instruct - the XmlSerializer to serialize the array as a series of XML - elements, instead of a nested set of elements. */ - - [XmlElement( - ElementName="Members", - Namespace="http://www.cpandl.com")] - array^Employees; - - [XmlElement(DataType="snippet1>", - ElementName="Building")] - double GroupID; - - [XmlElement(DataType="hexBinary")] - array^HexBytes; - - [XmlElement(DataType="boolean")] - bool IsActive; - - [XmlElement(Type=::Manager::typeid)] - Employee^ Manager; - - [XmlElement(Int32::typeid, - ElementName="ObjectNumber"), - XmlElement(String::typeid, - ElementName="ObjectString")] - ArrayList^ ExtraInfo; -}; - -void SerializeObject( String^ filename ) -{ - // Create the XmlSerializer. - XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); - - // To write the file, a TextWriter is required. - TextWriter^ writer = gcnew StreamWriter( filename ); - - /* Create an instance of the group to serialize, and set - its properties. */ - Group^ group = gcnew Group; - group->GroupID = 10.089f; - group->IsActive = false; - array^temp0 = {Convert::ToByte( 100 )}; - group->HexBytes = temp0; - Employee^ x = gcnew Employee; - Employee^ y = gcnew Employee; - x->Name = "Jack"; - y->Name = "Jill"; - array^temp1 = {x,y}; - group->Employees = temp1; - Manager^ mgr = gcnew Manager; - mgr->Name = "Sara"; - mgr->Level = 4; - group->Manager = mgr; - - /* Add a number and a string to the - ArrayList returned by the ExtraInfo property. */ - group->ExtraInfo = gcnew ArrayList; - group->ExtraInfo->Add( 42 ); - group->ExtraInfo->Add( "Answer" ); - - // Serialize the object, and close the TextWriter. - s->Serialize( writer, group ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - XmlSerializer^ x = gcnew XmlSerializer( Group::typeid ); - Group^ g = dynamic_cast(x->Deserialize( fs )); - Console::WriteLine( g->Manager->Name ); - Console::WriteLine( g->GroupID ); - Console::WriteLine( g->HexBytes[ 0 ] ); - IEnumerator^ myEnum = g->Employees->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Employee^ e = safe_cast(myEnum->Current); - Console::WriteLine( e->Name ); - } -} - -int main() -{ - SerializeObject( "FirstDoc.xml" ); - DeserializeObject( "FirstDoc.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp deleted file mode 100644 index dac3339b9d7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml::Serialization; -public ref class Group -{ -public: - - /* Apply two XmlElementAttributes to the field. Set the DataType - to string an int to allow the ArrayList to accept - both types. The Namespace is also set to different values - for each type. */ - - [XmlElement(DataType="string", - Type=String::typeid, - Namespace="http://www.cpandl.com"), - XmlElement(DataType="snippet1>", - Namespace="http://www.cohowinery.com", - Type=Int32::typeid)] - ArrayList^ ExtraInfo; -}; - -void SerializeObject( String^ filename ) -{ - // A TextWriter is needed to write the file. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); - - // Create the object to serialize. - Group^ myGroup = gcnew Group; - - /* Add a string and an integer to the ArrayList returned - by the ExtraInfo field. */ - myGroup->ExtraInfo = gcnew ArrayList; - myGroup->ExtraInfo->Add( "hello" ); - myGroup->ExtraInfo->Add( 100 ); - - // Serialize the object and close the TextWriter. - s->Serialize( writer, myGroup ); - writer->Close(); -} - -int main() -{ - SerializeObject( "ElementTypes.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp deleted file mode 100644 index c73eab60f3b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// -// This is the class that will be serialized. -public ref class XClass -{ -public: - /* The XML element name will be XName - instead of the default ClassName. */ - [XmlElement(ElementName="XName")] - String^ ClassName; -}; -// - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp deleted file mode 100644 index 323a5e3febf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; - -// -public ref class MyClass -{ -public: - - [XmlElement(Form=XmlSchemaForm::Unqualified)] - String^ ClassName; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp deleted file mode 100644 index 496244672df..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class MyClass -{ -public: - - [XmlElement(IsNullable=false)] - String^ Group; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp deleted file mode 100644 index 217959b7fad..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Employee -{ -public: - String^ Name; -}; - -public ref class Manager: public Employee -{ -public: - int Level; -}; - -public ref class Group -{ -public: - - [XmlElement(Manager::typeid)] - array^Staff; - - [XmlElement(Int32::typeid), - XmlElement(String::typeid), - XmlElement(DateTime::typeid)] - ArrayList^ ExtraInfo; -}; - -void SerializeObject( String^ filename ) -{ - // Create an XmlSerializer instance. - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid ); - - // Create object and serialize it. - Group^ myGroup = gcnew Group; - Manager^ e1 = gcnew Manager; - e1->Name = "Manager1"; - Manager^ m1 = gcnew Manager; - m1->Name = "Manager2"; - m1->Level = 4; - array^emps = {e1,m1}; - myGroup->Staff = emps; - myGroup->ExtraInfo = gcnew ArrayList; - myGroup->ExtraInfo->Add( ".NET" ); - myGroup->ExtraInfo->Add( 42 ); - myGroup->ExtraInfo->Add( DateTime(2001,1,1) ); - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myGroup ); - writer->Close(); -} - -int main() -{ - SerializeObject( "TypeEx.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp deleted file mode 100644 index f06647e1954..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class MyClass -{ -public: - - [XmlElement] - String^ TeacherName; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp deleted file mode 100644 index a92464e29dc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp +++ /dev/null @@ -1,19 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class Transportation -{ -public: - - [XmlElement("Cars")] - String^ Vehicles; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp deleted file mode 100644 index 701b642c490..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp +++ /dev/null @@ -1,96 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -public ref class Instrument -{ -public: - String^ Name; -}; - -public ref class Brass: public Instrument -{ -public: - bool IsValved; -}; - -public ref class Orchestra -{ -public: - array^Instruments; -}; - -void SerializeObject( String^ filename ) -{ - // To write the file, a TextWriter is required. - TextWriter^ writer = gcnew StreamWriter( filename ); - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - - // Creates an XmlElementAttribute that overrides the Instrument type. - XmlElementAttribute^ attr = gcnew XmlElementAttribute( Brass::typeid ); - attr->ElementName = "Brass"; - - // Adds the element to the collection of elements. - attrs->XmlElements->Add( attr ); - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - - // Creates the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - - // Creates the object to serialize. - Orchestra^ band = gcnew Orchestra; - - // Creates an object of the derived type. - Brass^ i = gcnew Brass; - i->Name = "Trumpet"; - i->IsValved = true; - array^myInstruments = {i}; - band->Instruments = myInstruments; - s->Serialize( writer, band ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - - // Creates an XmlElementAttribute that override the Instrument type. - XmlElementAttribute^ attr = gcnew XmlElementAttribute( Brass::typeid ); - attr->ElementName = "Brass"; - - // Adds the element to the collection of elements. - attrs->XmlElements->Add( attr ); - attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); - - // Creates the XmlSerializer using the XmlAttributeOverrides. - XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Orchestra^ band = dynamic_cast(s->Deserialize( fs )); - Console::WriteLine( "Brass:" ); - - /* Deserializing differs from serializing. To read the - derived-object values, declare an object of the derived - type (Brass) and cast the Instrument instance to it. */ - Brass^ b; - System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Instrument^ i = safe_cast(myEnum->Current); - b = dynamic_cast(i); - Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved ); - } -} - -int main() -{ - SerializeObject( "Override.xml" ); - DeserializeObject( "Override.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp deleted file mode 100644 index 000e548b46f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Collections; -using namespace System::Xml; - -public ref class Car -{ -public: - String^ Name; -}; - -public ref class Plane -{ -public: - String^ Name; -}; - -public ref class Truck -{ -public: - String^ Name; -}; - -public ref class Train -{ -public: - String^ Name; -}; - -public ref class Transportation -{ -public: - - // Override these two XmlElementAttributes. - - [XmlElement(Car::typeid), - XmlElement(Plane::typeid)] - ArrayList^ Vehicles; -}; - -XmlSerializer^ CreateOverrider() -{ - // Create XmlAtrributes and XmlAttributeOverrides instances. - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Create an XmlElementAttributes object to override - one of the attributes applied to the Vehicles property. */ - XmlElementAttribute^ xElement1 = gcnew XmlElementAttribute( Truck::typeid ); - - // Add the XmlElementAttribute to the collection. - attrs->XmlElements->Add( xElement1 ); - - /* Create a second XmlElementAttribute and - add it to the collection. */ - XmlElementAttribute^ xElement2 = gcnew XmlElementAttribute( Train::typeid ); - attrs->XmlElements->Add( xElement2 ); - - /* Add the XmlAttributes to the XmlAttributeOverrides, - specifying the member to override. */ - xOver->Add( Transportation::typeid, "Vehicles", attrs ); - - // Create the XmlSerializer, and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver ); - return xSer; -} - -void SerializeObject( String^ filename ) -{ - // Create an XmlSerializer instance. - XmlSerializer^ xSer = CreateOverrider(); - - // Create the object. - Transportation^ myTransportation = gcnew Transportation; - - /* Create two new, overriding objects that can be - inserted into the Vehicles array. */ - myTransportation->Vehicles = gcnew ArrayList; - Truck^ myTruck = gcnew Truck; - myTruck->Name = "MyTruck"; - Train^ myTrain = gcnew Train; - myTrain->Name = "MyTrain"; - myTransportation->Vehicles->Add( myTruck ); - myTransportation->Vehicles->Add( myTrain ); - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myTransportation ); -} - -int main() -{ - SerializeObject( "OverrideElement.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp deleted file mode 100644 index 3933ca7d495..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Truck{ - // Class added so sample will compile -}; - -public ref class Train{ - // Class added so sample will compile -}; - -public ref class Transportation{ - // Class added so sample will compile -}; - -public ref class Sample -{ - // -public: - XmlSerializer^ CreateOverrider() - { - // Create XmlAttributes and XmlAttributeOverrides instances. - - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = - gcnew XmlAttributeOverrides; - - /* Create an XmlElementAttributes to override - the Vehicles property. */ - XmlElementAttribute^ xElement1 = - gcnew XmlElementAttribute( Truck::typeid ); - // Add the XmlElementAttribute to the collection. - attrs->XmlElements->Add( xElement1 ); - - /* Create a second XmlElementAttribute, and - add to the collection. */ - XmlElementAttribute^ xElement2 = - gcnew XmlElementAttribute( Train::typeid ); - attrs->XmlElements->Add( xElement2 ); - - /* Add the XmlAttributes to the XmlAttributeOverrides, - specifying the member to override. */ - xOver->Add( Transportation::typeid, "Vehicles", attrs ); - - // Create the XmlSerializer, and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( - Transportation::typeid,xOver ); - return xSer; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp deleted file mode 100644 index b82f373dbe0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public enum class EmployeeStatus -{ - [XmlEnum(Name = "Single")] - One, - [XmlEnum(Name = "Double")] - Two, - [XmlEnum(Name = "Triple")] - Three -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp deleted file mode 100644 index d494e993e3e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public enum class EmployeeStatus -{ - [XmlEnum("Single")] - One, - [XmlEnum("Double")] - Two, - [XmlEnum("Triple")] - Three -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp deleted file mode 100644 index d7f0debeaec..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public enum class FoodType -{ - // Subsequent code overrides these enumerations. - Low, High -}; - -// This is the class that will be serialized. -public ref class Food -{ -public: - FoodType Type; -}; - -// Return an XmlSerializer used for overriding. -XmlSerializer^ CreateOverrider() -{ - // Create the XmlOverrides and XmlAttributes objects. - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - XmlAttributes^ xAttrs = gcnew XmlAttributes; - - // Add an XmlEnumAttribute for the FoodType.Low enumeration. - XmlEnumAttribute^ xEnum = gcnew XmlEnumAttribute; - xEnum->Name = "Cold"; - xAttrs->XmlEnum = xEnum; - xOver->Add( FoodType::typeid, "Low", xAttrs ); - - // Add an XmlEnumAttribute for the FoodType.High enumeration. - xAttrs = gcnew XmlAttributes; - xEnum = gcnew XmlEnumAttribute; - xEnum->Name = "Hot"; - xAttrs->XmlEnum = xEnum; - xOver->Add( FoodType::typeid, "High", xAttrs ); - - // Create the XmlSerializer, and return it. - return gcnew XmlSerializer( Food::typeid,xOver ); -} - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrider(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Food^ myFood = gcnew Food; - - // Set the object properties. - myFood->Type = FoodType::High; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myFood ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = CreateOverrider(); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Food^ myFood = dynamic_cast(mySerializer->Deserialize( fs )); - Console::WriteLine( myFood->Type ); -} - -int main() -{ - SerializeObject( "OverrideEnum.xml" ); - DeserializeObject( "OverrideEnum.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp deleted file mode 100644 index 7298f812c7a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class Group -{ -public: - - // The XmlSerializer ignores this field. - - [XmlIgnore] - String^ Comment; - - // The XmlSerializer serializes this field. - String^ GroupName; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp deleted file mode 100644 index cbfdda004f2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -ref class Employee; - -ref class Manager; - -ref class Group -{ -public: - array^Employees; -}; - -// Instruct the XmlSerializer to accept Manager types as well. -[XmlInclude(Manager::typeid)] -public ref class Employee -{ -public: - String^ Name; -}; - -public ref class Manager: public Employee -{ -public: - int Level; -}; - -void SerializeObject( String^ filename ) -{ - XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); - TextWriter^ writer = gcnew StreamWriter( filename ); - Group^ group = gcnew Group; - Manager^ manager = gcnew Manager; - Employee^ emp1 = gcnew Employee; - Employee^ emp2 = gcnew Employee; - manager->Name = "Zeus"; - manager->Level = 2; - emp1->Name = "Ares"; - emp2->Name = "Artemis"; - array^emps = {manager,emp1,emp2}; - group->Employees = emps; - s->Serialize( writer, group ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - XmlSerializer^ x = gcnew XmlSerializer( Group::typeid ); - Group^ g = dynamic_cast(x->Deserialize( fs )); - Console::Write( "Members:" ); - System::Collections::IEnumerator^ myEnum = g->Employees->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Employee^ e = safe_cast(myEnum->Current); - Console::WriteLine( "\t{0}", e->Name ); - } -} - -int main() -{ - SerializeObject( "IncludeExample.xml" ); - DeserializeObject( "IncludeExample.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp deleted file mode 100644 index 8ba6ec67f15..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -public ref class Vehicle{}; - -public ref class Car: public Vehicle{}; - -public ref class Truck: public Vehicle{}; - -public ref class Sample -{ -public: - - [WebMethodAttribute] - [XmlInclude(Car::typeid)] - [XmlInclude(Truck::typeid)] - Vehicle^ ReturnVehicle( int i ) - { - if ( i == 0 ) - return gcnew Car; - else - return gcnew Truck; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp deleted file mode 100644 index 1945e706e46..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// placeholder; see complete definition elsewhere in this section -public ref class Order -{ -public: - void ShipItems(){} - -}; - - -// Creates the queue if it does not already exist. -void EnsureQueueExists( String^ path ) -{ - if ( !MessageQueue::Exists( path ) ) - { - MessageQueue::Create( path ); - } -} - -int main() -{ - Console::WriteLine( "Processing Orders" ); - String^ queuePath = ".\\orders"; - EnsureQueueExists( queuePath ); - MessageQueue^ queue = gcnew MessageQueue( queuePath ); - array^temp0 = {"Order"}; - (dynamic_cast(queue->Formatter))->TargetTypeNames = temp0; - while ( true ) - { - Order^ newOrder = dynamic_cast(queue->Receive()->Body); - newOrder->ShipItems(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp deleted file mode 100644 index 057b230d28d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -// -using namespace System; -public ref class Order -{ -public: - int itemId; - int quantity; - String^ address; - void ShipItems() - { - Console::WriteLine( "Order Placed:" ); - Console::WriteLine( "\tItem ID : {0}", itemId ); - Console::WriteLine( "\tQuantity : {0}", quantity ); - Console::WriteLine( "\tShip To : {0}", address ); - - // Add order to the database. - /* Insert code here. */ - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp deleted file mode 100644 index 44d1d0daa09..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// placeholder; see complete definition elsewhere in this section -public ref class Order -{ -public: - int itemId; - int quantity; - String^ address; - void ShipItems(){} - -}; - - -// Creates the queue if it does not already exist. -void EnsureQueueExists( String^ path ) -{ - if ( !MessageQueue::Exists( path ) ) - { - MessageQueue::Create( path ); - } -} - -int main() -{ - String^ queuePath = ".\\orders"; - EnsureQueueExists( queuePath ); - MessageQueue^ queue = gcnew MessageQueue( queuePath ); - Order^ orderRequest = gcnew Order; - orderRequest->itemId = 1025; - orderRequest->quantity = 5; - orderRequest->address = "One Microsoft Way"; - queue->Send( orderRequest ); - - // This line uses a new method you define on the Order class: - // orderRequest.PrintReceipt(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp deleted file mode 100644 index 78b7ac99698..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp deleted file mode 100644 index de9d0304ae4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ -private: - // - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "UnknownNode Name: {0}", e->Name ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp deleted file mode 100644 index 68985474069..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp deleted file mode 100644 index bd6a1e29d72..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - XmlNodeType myNodeType = e->NodeType; - Console::WriteLine( myNodeType ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp deleted file mode 100644 index 88a67fdab41..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Object^ o = e->ObjectBeingDeserialized; - Console::WriteLine( "Object being deserialized: {0}", o ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp deleted file mode 100644 index a4734b7e012..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "UnknownNode Text: {0}", e->Text ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp deleted file mode 100644 index b4318feda2a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Class1 -{ - // -private: - void DeserializeItem( String^ filename ) - { - XmlSerializer^ mySerializer = gcnew XmlSerializer( ObjectToDeserialize::typeid ); - - // Add an instance of the delegate to the event. - mySerializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Class1::Serializer_UnknownNode ); - - // A FileStream is needed to read the file to deserialize. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - ObjectToDeserialize^ o = dynamic_cast(mySerializer->Deserialize( fs )); - } - - void Serializer_UnknownNode( Object^ sender, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "UnknownNode Name: {0}", e->Name ); - Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName ); - Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI ); - Console::WriteLine( "UnknownNode Text: {0}", e->Text ); - Object^ o = e->ObjectBeingDeserialized; - Console::WriteLine( "Object being deserialized {0}", o ); - XmlNodeType myNodeType = e->NodeType; - Console::WriteLine( myNodeType ); - } - // - -public: - - ref class ObjectToDeserialize{}; -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp deleted file mode 100644 index 705ea6b1244..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; - -[XmlRoot(Namespace="www.contoso.com", -ElementName="MyGroupName", -DataType="string", -IsNullable=true)] -public ref class Group -{ -private: - String^ groupNameValue; - -public: - - // Insert code for the Group class. - Group(){} - - Group( String^ groupNameVal ) - { - groupNameValue = groupNameVal; - } - - property String^ GroupName - { - String^ get() - { - return groupNameValue; - } - void set( String^ value ) - { - groupNameValue = value; - } - - } - -}; - -void SerializeGroup() -{ - // Create an instance of the Group class, and an - // instance of the XmlSerializer to serialize it. - Group^ myGroup = gcnew Group( "Redmond" ); - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - - // A FileStream is used to write the file. - FileStream^ fs = gcnew FileStream( "group.xml",FileMode::Create ); - ser->Serialize( fs, myGroup ); - fs->Close(); - Console::WriteLine( myGroup->GroupName ); - Console::WriteLine( "Done" ); - Console::ReadLine(); -} - -int main() -{ - SerializeGroup(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp deleted file mode 100644 index 9780f3bb003..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; - -// Apply the XmlRootAttribute and set the IsNullable property to false. - -[XmlRoot(IsNullable=false)] -public ref class Group -{ -public: - String^ Name; -}; - -void SerializeObject( String^ filename ) -{ - XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create the object to serialize. - Group^ mygroup = nullptr; - - // Serialize the object, and close the TextWriter. - s->Serialize( writer, mygroup ); - writer->Close(); -} - -int main() -{ - Console::WriteLine( "Running" ); - SerializeObject( "NullDoc.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp deleted file mode 100644 index 4d0cd2a4a61..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// - -[XmlRoot(Namespace="http://www.cpandl.com")] -public ref class Group{}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp deleted file mode 100644 index ee176b3d4b4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that is the default root element. -public ref class MyClass -{ -public: - String^ Name; -}; - -XmlSerializer^ CreateOverrider(); -void SerializeOrder( String^ filename ) -{ - // Create an XmlSerializer instance using the method below. - XmlSerializer^ xSer = CreateOverrider(); - - // Create the object, and set its Name property. - MyClass^ myClass = gcnew MyClass; - myClass->Name = "New Class Name"; - - // Serialize the class, and close the TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myClass ); - writer->Close(); -} - -// Return an XmlSerializer to override the root serialization. -XmlSerializer^ CreateOverrider() -{ - // Create an XmlAttributes to override the default root element. - XmlAttributes^ attrs = gcnew XmlAttributes; - - // Create an XmlRootAttribute and set its element name and namespace. - XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; - xRoot->ElementName = "OverriddenRootElementName"; - xRoot->Namespace = "http://www.microsoft.com"; - - // Set the XmlRoot property to the XmlRoot object. - attrs->XmlRoot = xRoot; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Add the XmlAttributes object to the - XmlAttributeOverrides object. */ - xOver->Add( MyClass::typeid, attrs ); - - // Create the Serializer, and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( MyClass::typeid,xOver ); - return xSer; -} - -int main() -{ - SerializeOrder( "OverrideAttribute.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp deleted file mode 100644 index 0bfeccd401c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp +++ /dev/null @@ -1,216 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::IO; -ref class Address; -ref class OrderedItem; - -/* The XmlRootAttribute allows you to set an alternate name - (PurchaseOrder) of the XML element, the element namespace; by - default, the XmlSerializer uses the class name. The attribute - also allows you to set the XML namespace for the element. Lastly, - the attribute sets the IsNullable property, which specifies whether - the xsi:null attribute appears if the class instance is set to - a null reference. */ - -[XmlRootAttribute("PurchaseOrder",Namespace="http://www.cpandl.com", -IsNullable=false)] -public ref class PurchaseOrder -{ -public: - Address^ ShipTo; - String^ OrderDate; - - /* The XmlArrayAttribute changes the XML element name - from the default of "OrderedItems" to "Items". */ - - [XmlArrayAttribute("Items")] - array^OrderedItems; - Decimal SubTotal; - Decimal ShipCost; - Decimal TotalCost; -}; - -public ref class Address -{ -public: - - /* The XmlAttribute instructs the XmlSerializer to serialize the Name - field as an XML attribute instead of an XML element (the default - behavior). */ - - [XmlAttributeAttribute] - String^ Name; - String^ Line1; - - /* Setting the IsNullable property to false instructs the - XmlSerializer that the XML attribute will not appear if - the City field is set to a null reference. */ - - [XmlElementAttribute(IsNullable=false)] - String^ City; - String^ State; - String^ Zip; -}; - -public ref class OrderedItem -{ -public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - Decimal LineTotal; - - /* Calculate is a custom method that calculates the price per item, - and stores the value in a field. */ - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } - -}; - -public ref class Test -{ -public: - static void main() - { - // Read and write purchase orders. - Test^ t = gcnew Test; - t->CreatePO( "po.xml" ); - t->ReadPO( "po.xml" ); - } - -private: - void CreatePO( String^ filename ) - { - // Create an instance of the XmlSerializer class; - // specify the type of object to serialize. - XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); - TextWriter^ writer = gcnew StreamWriter( filename ); - PurchaseOrder^ po = gcnew PurchaseOrder; - - // Create an address to ship and bill to. - Address^ billAddress = gcnew Address; - billAddress->Name = "Teresa Atkinson"; - billAddress->Line1 = "1 Main St."; - billAddress->City = "AnyTown"; - billAddress->State = "WA"; - billAddress->Zip = "00000"; - - // Set ShipTo and BillTo to the same addressee. - po->ShipTo = billAddress; - po->OrderDate = System::DateTime::Now.ToLongDateString(); - - // Create an OrderedItem object. - OrderedItem^ i1 = gcnew OrderedItem; - i1->ItemName = "Widget S"; - i1->Description = "Small widget"; - i1->UnitPrice = (Decimal)5.23; - i1->Quantity = 3; - i1->Calculate(); - - // Insert the item into the array. - array^items = {i1}; - po->OrderedItems = items; - - // Calculate the total cost. - Decimal subTotal = Decimal(0); - System::Collections::IEnumerator^ myEnum = items->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - OrderedItem^ oi = safe_cast(myEnum->Current); - subTotal = subTotal + oi->LineTotal; - } - - po->SubTotal = subTotal; - po->ShipCost = (Decimal)12.51; - po->TotalCost = po->SubTotal + po->ShipCost; - - // Serialize the purchase order, and close the TextWriter. - serializer->Serialize( writer, po ); - writer->Close(); - } - -protected: - void ReadPO( String^ filename ) - { - // Create an instance of the XmlSerializer class; - // specify the type of object to be deserialized. - XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); - - /* If the XML document has been altered with unknown - nodes or attributes, handle them with the - UnknownNode and UnknownAttribute events.*/ - serializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Test::serializer_UnknownNode ); - serializer->UnknownAttribute += gcnew XmlAttributeEventHandler( this, &Test::serializer_UnknownAttribute ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - - // Declare an object variable of the type to be deserialized. - PurchaseOrder^ po; - - /* Use the Deserialize method to restore the object's state with - data from the XML document. */ - po = dynamic_cast(serializer->Deserialize( fs )); - - // Read the order date. - Console::WriteLine( "OrderDate: {0}", po->OrderDate ); - - // Read the shipping address. - Address^ shipTo = po->ShipTo; - ReadAddress( shipTo, "Ship To:" ); - - // Read the list of ordered items. - array^items = po->OrderedItems; - Console::WriteLine( "Items to be shipped:" ); - System::Collections::IEnumerator^ myEnum1 = items->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - OrderedItem^ oi = safe_cast(myEnum1->Current); - Console::WriteLine( "\t{0}\t{1}\t{2}\t{3}\t{4}", oi->ItemName, oi->Description, oi->UnitPrice, oi->Quantity, oi->LineTotal ); - } - - Console::WriteLine( "\t\t\t\t\t Subtotal\t{0}", po->SubTotal ); - Console::WriteLine( "\t\t\t\t\t Shipping\t{0}", po->ShipCost ); - Console::WriteLine( "\t\t\t\t\t Total\t\t{0}", po->TotalCost ); - } - - void ReadAddress( Address^ a, String^ label ) - { - // Read the fields of the Address object. - Console::WriteLine( label ); - Console::WriteLine( "\t{0}", a->Name ); - Console::WriteLine( "\t{0}", a->Line1 ); - Console::WriteLine( "\t{0}", a->City ); - Console::WriteLine( "\t{0}", a->State ); - Console::WriteLine( "\t{0}", a->Zip ); - Console::WriteLine(); - } - -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "Unknown Node:{0}\t{1}", e->Name, e->Text ); - } - - void serializer_UnknownAttribute( Object^ /*sender*/, XmlAttributeEventArgs^ e ) - { - System::Xml::XmlAttribute^ attr = e->Attr; - Console::WriteLine( "Unknown attribute {0}='{1}'", attr->Name, attr->Value ); - } -}; - -int main() -{ - Test::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp deleted file mode 100644 index b488c27b932..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void TestDocument( String^ filename, Type^ objType ) - { - // Using a FileStream, create an XmlTextReader. - Stream^ fs = gcnew FileStream( filename,FileMode::Open ); - XmlReader^ reader = gcnew XmlTextReader( fs ); - XmlSerializer^ serializer = gcnew XmlSerializer( objType ); - if ( serializer->CanDeserialize( reader ) ) - { - Object^ o = serializer->Deserialize( reader ); - } - fs->Close(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp deleted file mode 100644 index 542444fb61a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that will be deserialized. -public ref class OrderedItem -{ -public: - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ ItemName; - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ Description; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal UnitPrice; - - [XmlElement(Namespace="http://www.cpandl.com")] - int Quantity; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void DeserializeObject(String^ filename) -{ - Console::WriteLine("Reading with Stream"); - - // Create an instance of the XmlSerializer. - XmlSerializer^ serializer = gcnew XmlSerializer(OrderedItem::typeid); - - // Declare an object variable of the type to be deserialized. - OrderedItem^ i; - - // Reading the XML document requires a FileStream. - Stream^ reader = gcnew FileStream(filename, FileMode::Open); - - try - { - // Call the Deserialize method to restore the object's state. - i = dynamic_cast(serializer->Deserialize(reader)); - } - finally - { - delete reader; - } - - // Write out the properties of the object. - Console::Write("{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal); -} - -int main() -{ - // Read a purchase order. - DeserializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp deleted file mode 100644 index b803c3b61af..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml::Serialization; - -// This is the class that will be deserialized. -public ref class OrderedItem -{ -public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void DeserializeObject( String^ filename ) -{ - Console::WriteLine( "Reading with TextReader" ); - - // Create an instance of the XmlSerializer specifying type. - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - - /* Create a TextReader to read the file. Specify an - Encoding to use. */ - TextReader^ reader = gcnew StreamReader( filename,Encoding::Unicode ); - - // Declare an object variable of the type to be deserialized. - OrderedItem^ i; - - // Use the Deserialize method to restore the object's state. - i = dynamic_cast(serializer->Deserialize( reader )); - - // Write out the properties of the object. - Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal ); -} - -int main() -{ - // Read a purchase order. - DeserializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp deleted file mode 100644 index 3b2738346ee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// This is the class that will be deserialized. -public ref class OrderedItem -{ -public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void DeserializeObject( String^ filename ) -{ - Console::WriteLine( "Reading with XmlReader" ); - - // Create an instance of the XmlSerializer specifying type and namespace. - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - XmlReader^ reader = gcnew XmlTextReader( fs ); - - // Declare an object variable of the type to be deserialized. - OrderedItem^ i; - - // Use the Deserialize method to restore the object's state. - i = dynamic_cast(serializer->Deserialize( reader )); - - // Write out the properties of the object. - Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal ); -} - -int main() -{ - // Read a purchase order. - DeserializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp deleted file mode 100644 index a9b0d0bf54e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -/* Three classes are included here. Each one will -be used to create three XmlSerializer objects. */ -public ref class Instrument -{ -public: - String^ InstrumentName; -}; - -public ref class Player -{ -public: - String^ PlayerName; -}; - -public ref class Piece -{ -public: - String^ PieceName; -}; - -void GetSerializers() -{ - // Create an array of types. - array^types = gcnew array(3); - types[ 0 ] = Instrument::typeid; - types[ 1 ] = Player::typeid; - types[ 2 ] = Piece::typeid; - - // Create an array for XmlSerializer objects. - array^serializers = gcnew array(3); - serializers = XmlSerializer::FromTypes( types ); - - // Create one Instrument and serialize it. - Instrument^ i = gcnew Instrument; - i->InstrumentName = "Piano"; - - // Create a TextWriter to write with. - TextWriter^ writer = gcnew StreamWriter( "Inst.xml" ); - serializers[ 0 ]->Serialize( writer, i ); - writer->Close(); -} - -int main() -{ - GetSerializers(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp deleted file mode 100644 index deb65e2782e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class OrderedItem -{ -public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Writing With TextWriter" ); - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - OrderedItem^ i = gcnew OrderedItem; - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - i->Calculate(); - - /* Create a StreamWriter to write with. First create a FileStream - object, and create the StreamWriter specifying an Encoding to use. */ - FileStream^ fs = gcnew FileStream( filename,FileMode::Create ); - TextWriter^ writer = gcnew StreamWriter( fs,gcnew UTF8Encoding ); - - // Serialize using the XmlTextWriter. - serializer->Serialize( writer, i ); - writer->Close(); -} - -int main() -{ - // Write a purchase order. - SerializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp deleted file mode 100644 index c635e566468..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class OrderedItem -{ -public: - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ ItemName; - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ Description; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal UnitPrice; - - [XmlElement(Namespace="http://www.cpandl.com")] - int Quantity; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Writing With TextWriter" ); - - // Create an XmlSerializer instance using the type. - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - OrderedItem^ i = gcnew OrderedItem; - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - i->Calculate(); - - // Create an XmlSerializerNamespaces object. - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - - // Add two namespaces with prefixes. - ns->Add( "inventory", "http://www.cpandl.com" ); - ns->Add( "money", "http://www.cohowinery.com" ); - - // Create a StreamWriter to write with. - TextWriter^ writer = gcnew StreamWriter( filename ); - - /* Serialize using the object using the TextWriter - and namespaces. */ - serializer->Serialize( writer, i, ns ); - writer->Close(); -} - -int main() -{ - // Write a purchase order. - SerializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp deleted file mode 100644 index 053d871e78a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class OrderedItem -{ -public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Writing With Stream" ); - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - OrderedItem^ i = gcnew OrderedItem; - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - i->Calculate(); - - // Create a FileStream to write with. - Stream^ writer = gcnew FileStream( filename,FileMode::Create ); - - // Serialize the object, and close the TextWriter - serializer->Serialize( writer, i ); - writer->Close(); -} - -int main() -{ - // Write a purchase order. - SerializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp deleted file mode 100644 index baf2cd1b7c8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class OrderedItem -{ -public: - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ ItemName; - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ Description; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal UnitPrice; - - [XmlElement(Namespace="http://www.cpandl.com")] - int Quantity; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Writing With Stream" ); - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - OrderedItem^ i = gcnew OrderedItem; - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - i->Calculate(); - - // Create an XmlSerializerNamespaces object. - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - - // Add two prefix-namespace pairs. - ns->Add( "inventory", "http://www.cpandl.com" ); - ns->Add( "money", "http://www.cohowinery.com" ); - - // Create a FileStream to write with. - Stream^ writer = gcnew FileStream( filename,FileMode::Create ); - - // Serialize the object, and close the TextWriter - serializer->Serialize( writer, i, ns ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - Console::WriteLine( "Reading with Stream" ); - - // Create an instance of the XmlSerializer. - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - - // Writing the file requires a Stream. - Stream^ reader = gcnew FileStream( filename,FileMode::Open ); - - // Declare an object variable of the type to be deserialized. - OrderedItem^ i; - - /* Use the Deserialize method to restore the object's state - using data from the XML document. */ - i = dynamic_cast(serializer->Deserialize( reader )); - - // Write out the properties of the object. - Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal ); -} - -int main() -{ - // Write a purchase order. - SerializeObject( "simple.xml" ); - DeserializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp deleted file mode 100644 index 1774c451ee4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class OrderedItem -{ -public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Writing With XmlTextWriter" ); - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - OrderedItem^ i = gcnew OrderedItem; - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - i->Calculate(); - - // Create an XmlTextWriter using a FileStream. - Stream^ fs = gcnew FileStream( filename,FileMode::Create ); - XmlWriter^ writer = gcnew XmlTextWriter( fs,Encoding::Unicode ); - - // Serialize using the XmlTextWriter. - serializer->Serialize( writer, i ); - writer->Close(); -} - -int main() -{ - // Write a purchase order. - SerializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp deleted file mode 100644 index 8a82ba5a382..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class OrderedItem -{ -public: - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ ItemName; - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ Description; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal UnitPrice; - - [XmlElement(Namespace="http://www.cpandl.com")] - int Quantity; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal LineTotal; - - // A custom method used to calculate price per item. - void Calculate() - { - LineTotal = UnitPrice * Quantity; - } -}; - -void SerializeObject( String^ filename ) -{ - Console::WriteLine( "Writing With XmlTextWriter" ); - XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); - OrderedItem^ i = gcnew OrderedItem; - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - i->Calculate(); - - // Create an XmlSerializerNamespaces object. - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - - // Add two namespaces with prefixes. - ns->Add( "inventory", "http://www.cpandl.com" ); - ns->Add( "money", "http://www.cohowinery.com" ); - - // Create an XmlTextWriter using a FileStream. - Stream^ fs = gcnew FileStream( filename,FileMode::Create ); - XmlWriter^ writer = gcnew XmlTextWriter( fs,gcnew UTF8Encoding ); - - // Serialize using the XmlTextWriter. - serializer->Serialize( writer, i, ns ); - writer->Close(); -} - -int main() -{ - // Write a purchase order. - SerializeObject( "simple.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp deleted file mode 100644 index cef506f6c43..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class Group -{ -public: - String^ GroupName; -}; - -public ref class Test -{ -public: - static void main() - { - Test^ t = gcnew Test; - - // Deserialize the file containing unknown elements. - t->DeserializeObject( "UnknownAttributes.xml" ); - } - -private: - void Serializer_UnknownAttribute( Object^ sender, XmlAttributeEventArgs^ e ) - { - Console::WriteLine( "Unknown Attribute" ); - Console::WriteLine( "\t{0} {1}", e->Attr->Name, e->Attr->InnerXml ); - Console::WriteLine( "\t LineNumber: {0}", e->LineNumber ); - Console::WriteLine( "\t LinePosition: {0}", e->LinePosition ); - Group^ x = dynamic_cast(e->ObjectBeingDeserialized); - Console::WriteLine( x->GroupName ); - Console::WriteLine( sender ); - } - - void DeserializeObject( String^ filename ) - { - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - - // Add a delegate to handle unknown element events. - ser->UnknownAttribute += gcnew XmlAttributeEventHandler( this, &Test::Serializer_UnknownAttribute ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ g = dynamic_cast(ser->Deserialize( fs )); - fs->Close(); - } -}; - -int main() -{ - Test::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp deleted file mode 100644 index 57d80144134..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp +++ /dev/null @@ -1,79 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Group -{ -public: - - // Only the GroupName field will be known. - String^ GroupName; -}; - -public ref class Test -{ -public: - static void main() - { - Test^ t = gcnew Test; - t->DeserializeObject( "UnknownNodes.xml" ); - } - -private: - void DeserializeObject( String^ filename ) - { - XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - mySerializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Test::serializer_UnknownNode ); - Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); - fs->Close(); - } - -private: - void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) - { - Console::WriteLine( "UnknownNode Name: {0}", e->Name ); - Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName ); - Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI ); - Console::WriteLine( "UnknownNode Text: {0}", e->Text ); - XmlNodeType myNodeType = e->NodeType; - Console::WriteLine( "NodeType: {0}", myNodeType ); - Group^ myGroup = dynamic_cast(e->ObjectBeingDeserialized); - Console::WriteLine( "GroupName: {0}", myGroup->GroupName ); - Console::WriteLine(); - } -}; - -int main() -{ - Test::main(); -} - -/* Paste this XML into a file named UnknownNodes: - - - MyGroup - Large - 444 - West - - 1 - Thing1 - - element - - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp deleted file mode 100644 index 1df7c03435e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp +++ /dev/null @@ -1,181 +0,0 @@ - - -// -// Beginning of the HighSchool.dll -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -namespace HighSchool -{ - public ref class Student - { - public: - String^ Name; - int ID; - }; - - public ref class MyClass - { - public: - array^Students; - }; -} - -namespace College -{ - -using namespace HighSchool; - public ref class Graduate: public HighSchool::Student - { - public: - Graduate(){} - - // Add a new field named University. - String^ University; - - // Use extra types to use this field. - array^Info; - }; - - public ref class Address - { - public: - String^ City; - }; - - public ref class Phone - { - public: - String^ Number; - }; - - public ref class Run - { - public: - static void main() - { - Run^ test = gcnew Run; - test->WriteOverriddenAttributes( "College.xml" ); - test->ReadOverriddenAttributes( "College.xml" ); - } - - private: - void WriteOverriddenAttributes( String^ filename ) - { - // Writing the file requires a TextWriter. - TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); - - // Create an XMLAttributeOverrides class. - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - - // Create the XmlAttributes class. - XmlAttributes^ attrs = gcnew XmlAttributes; - - /* Override the Student class. "Alumni" is the name - of the overriding element in the XML output. */ - XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); - - /* Add the XmlElementAttribute to the collection of - elements in the XmlAttributes object. */ - attrs->XmlElements->Add( attr ); - - /* Add the XmlAttributes to the XmlAttributeOverrides. - "Students" is the name being overridden. */ - attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); - - // Create array of extra types. - array^extraTypes = gcnew array(2); - extraTypes[ 0 ] = Address::typeid; - extraTypes[ 1 ] = Phone::typeid; - - // Create an XmlRootAttribute. - XmlRootAttribute^ root = gcnew XmlRootAttribute( "Graduates" ); - - /* Create the XmlSerializer with the - XmlAttributeOverrides object. */ - XmlSerializer^ mySerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides,extraTypes,root,"http://www.microsoft.com" ); - MyClass ^ myClass = gcnew MyClass; - Graduate^ g1 = gcnew Graduate; - g1->Name = "Jacki"; - g1->ID = 1; - g1->University = "Alma"; - Graduate^ g2 = gcnew Graduate; - g2->Name = "Megan"; - g2->ID = 2; - g2->University = "CM"; - array^myArray = {g1,g2}; - myClass->Students = myArray; - - // Create extra information. - Address^ a1 = gcnew Address; - a1->City = "Ionia"; - Address^ a2 = gcnew Address; - a2->City = "Stamford"; - Phone^ p1 = gcnew Phone; - p1->Number = "555-0101"; - Phone^ p2 = gcnew Phone; - p2->Number = "555-0100"; - array^o1 = {a1,p1}; - array^o2 = {a2,p2}; - g1->Info = o1; - g2->Info = o2; - mySerializer->Serialize( myStreamWriter, myClass ); - myStreamWriter->Close(); - } - - void ReadOverriddenAttributes( String^ filename ) - { - /* The majority of the code here is the same as that in the - WriteOverriddenAttributes method. Because the XML being read - doesn't conform to the schema defined by the DLL, the - XMLAttributesOverrides must be used to create an - XmlSerializer instance to read the XML document.*/ - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); - attrs->XmlElements->Add( attr ); - attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); - array^extraTypes = gcnew array(2); - extraTypes[ 0 ] = Address::typeid; - extraTypes[ 1 ] = Phone::typeid; - XmlRootAttribute^ root = gcnew XmlRootAttribute( "Graduates" ); - XmlSerializer^ readSerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides,extraTypes,root,"http://www.microsoft.com" ); - - // A FileStream object is required to read the file. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - MyClass ^ myClass; - myClass = dynamic_cast(readSerializer->Deserialize( fs )); - - /* Here is the difference between reading and writing an - XML document: You must declare an object of the derived - type (Graduate) and cast the Student instance to it.*/ - Graduate^ g; - Address^ a; - Phone^ p; - System::Collections::IEnumerator^ myEnum = myClass->Students->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Graduate^ grad = safe_cast(myEnum->Current); - g = dynamic_cast(grad); - Console::Write( "{0}\t", g->Name ); - Console::Write( "{0}\t", g->ID ); - Console::Write( "{0}\n", g->University ); - a = dynamic_cast(g->Info[ 0 ]); - Console::WriteLine( a->City ); - p = dynamic_cast(g->Info[ 1 ]); - Console::WriteLine( p->Number ); - } - } - }; -} - -int main() -{ - College::Run::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp deleted file mode 100644 index 173d91e6ff3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Class1 -{ - // -private: - void SerializeObject( String^ filename ) - { - XmlSerializer^ serializer = gcnew XmlSerializer( - OrderedItem::typeid,"http://www.cpandl.com" ); - - // Create an instance of the class to be serialized. - OrderedItem^ i = gcnew OrderedItem; - - // Insert code to set property values. - - // Writing the document requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - // Serialize the object, and close the TextWriter - serializer->Serialize( writer, i ); - writer->Close(); - } - - void DeserializeObject( String^ filename ) - { - XmlSerializer^ serializer = gcnew XmlSerializer( - OrderedItem::typeid,"http://www.cpandl.com" ); - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - - // Declare an object variable of the type to be deserialized. - OrderedItem^ i; - - // Deserialize the object. - i = dynamic_cast(serializer->Deserialize( fs )); - - // Insert code to use the properties and methods of the object. - } - // - -public: - ref class OrderedItem{ - // Members of OrderedItem go here - }; -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp deleted file mode 100644 index 2ce08d9f7a1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Class1 -{ - // -private: - void SerializeObject( String^ filename ) - { - // Create an XmlRootAttribute, and set its properties. - XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; - xRoot->ElementName = "CustomRoot"; - xRoot->Namespace = "http://www.cpandl.com"; - xRoot->IsNullable = true; - - // Construct the XmlSerializer with the XmlRootAttribute. - XmlSerializer^ serializer = gcnew XmlSerializer( - OrderedItem::typeid,xRoot ); - - // Create an instance of the object to serialize. - OrderedItem^ i = gcnew OrderedItem; - // Insert code to set properties of the ordered item. - - // Writing the document requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - serializer->Serialize( writer, i ); - writer->Close(); - } - - void DeserializeObject( String^ filename ) - { - // Create an XmlRootAttribute, and set its properties. - XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; - xRoot->ElementName = "CustomRoot"; - xRoot->Namespace = "http://www.cpandl.com"; - xRoot->IsNullable = true; - - XmlSerializer^ serializer = gcnew XmlSerializer( - OrderedItem::typeid,xRoot ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - // Deserialize the object. - OrderedItem^ i = dynamic_cast(serializer->Deserialize( fs )); - // Insert code to use the object's properties and methods. - } - // - -public: - ref class OrderedItem{ - // Members of OrderedItem go here - }; -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp deleted file mode 100644 index 669af6e0644..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp +++ /dev/null @@ -1,137 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -ref class Address; -ref class Phone; - -// This defines the object that will be serialized. -public ref class Teacher -{ -public: - String^ Name; - Teacher(){} - - /* Note that the Info field returns an array of objects. - Any object can be added to the array by adding the - object type to the array passed to the extraTypes argument. */ - - [XmlArray(ElementName="ExtraInfo",IsNullable=true)] - array^Info; - Phone^ PhoneInfo; -}; - - -// This defines one of the extra types to be included. -public ref class Address -{ -public: - String^ City; - Address(){} - - Address( String^ city ) - { - City = city; - } -}; - -// Another extra type to include. -public ref class Phone -{ -public: - String^ PhoneNumber; - Phone(){} - - Phone( String^ phoneNumber ) - { - PhoneNumber = phoneNumber; - } -}; - -// Another type, derived from Phone -public ref class InternationalPhone: public Phone -{ -public: - String^ CountryCode; - InternationalPhone(){} - - InternationalPhone( String^ countryCode ) - { - CountryCode = countryCode; - } -}; - -public ref class Run -{ -public: - static void main() - { - Run^ test = gcnew Run; - test->SerializeObject( "Teacher.xml" ); - test->DeserializeObject( "Teacher.xml" ); - } - -private: - void SerializeObject( String^ filename ) - { - // Writing the file requires a TextWriter. - TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); - - // Create a Type array. - array^extraTypes = gcnew array(3); - extraTypes[ 0 ] = Address::typeid; - extraTypes[ 1 ] = Phone::typeid; - extraTypes[ 2 ] = InternationalPhone::typeid; - - // Create the XmlSerializer instance. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Teacher::typeid,extraTypes ); - Teacher^ teacher = gcnew Teacher; - teacher->Name = "Mike"; - - // Add extra types to the Teacher object - array^info = gcnew array(2); - info[ 0 ] = gcnew Address( "Springville" ); - info[ 1 ] = gcnew Phone( "555-0100" ); - teacher->Info = info; - teacher->PhoneInfo = gcnew InternationalPhone( "000" ); - mySerializer->Serialize( myStreamWriter, teacher ); - myStreamWriter->Close(); - } - - void DeserializeObject( String^ filename ) - { - // Create a Type array. - array^extraTypes = gcnew array(3); - extraTypes[ 0 ] = Address::typeid; - extraTypes[ 1 ] = Phone::typeid; - extraTypes[ 2 ] = InternationalPhone::typeid; - - // Create the XmlSerializer instance. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Teacher::typeid,extraTypes ); - - // Reading a file requires a FileStream. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Teacher^ teacher = dynamic_cast(mySerializer->Deserialize( fs )); - - // Read the extra information. - Address^ a = dynamic_cast(teacher->Info[ 0 ]); - Phone^ p = dynamic_cast(teacher->Info[ 1 ]); - InternationalPhone^ Ip = dynamic_cast(teacher->PhoneInfo); - Console::WriteLine( teacher->Name ); - Console::WriteLine( a->City ); - Console::WriteLine( p->PhoneNumber ); - Console::WriteLine( Ip->CountryCode ); - } -}; - -int main() -{ - Run::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp deleted file mode 100644 index 0050ba6a3ce..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp +++ /dev/null @@ -1,133 +0,0 @@ - - -// -// Beginning of HighSchool.dll -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -namespace HighSchool -{ - public ref class Student - { - public: - String^ Name; - int ID; - }; - - public ref class MyClass - { - public: - array^Students; - }; -} - -namespace College -{ - -using namespace HighSchool; - public ref class Graduate: public HighSchool::Student - { - public: - Graduate(){} - - // Add a new field named University. - String^ University; - }; - - public ref class Run - { - public: - static void main() - { - Run^ test = gcnew Run; - test->WriteOverriddenAttributes( "College.xml" ); - test->ReadOverriddenAttributes( "College.xml" ); - } - - private: - void WriteOverriddenAttributes( String^ filename ) - { - // Writing the file requires a TextWriter. - TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); - - // Create an XMLAttributeOverrides class. - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - - // Create the XmlAttributes class. - XmlAttributes^ attrs = gcnew XmlAttributes; - - /* Override the Student class. "Alumni" is the name - of the overriding element in the XML output. */ - XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); - - /* Add the XmlElementAttribute to the collection of - elements in the XmlAttributes object. */ - attrs->XmlElements->Add( attr ); - - /* Add the XmlAttributes to the XmlAttributeOverrides. - "Students" is the name being overridden. */ - attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); - - // Create the XmlSerializer. - XmlSerializer^ mySerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides ); - MyClass ^ myClass = gcnew MyClass; - Graduate^ g1 = gcnew Graduate; - g1->Name = "Jackie"; - g1->ID = 1; - g1->University = "Alma Mater"; - Graduate^ g2 = gcnew Graduate; - g2->Name = "Megan"; - g2->ID = 2; - g2->University = "CM"; - array^myArray = {g1,g2}; - myClass->Students = myArray; - mySerializer->Serialize( myStreamWriter, myClass ); - myStreamWriter->Close(); - } - - void ReadOverriddenAttributes( String^ filename ) - { - /* The majority of the code here is the same as that in the - WriteOverriddenAttributes method. Because the XML being read - doesn't conform to the schema defined by the DLL, the - XMLAttributesOverrides must be used to create an - XmlSerializer instance to read the XML document.*/ - XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); - attrs->XmlElements->Add( attr ); - attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); - XmlSerializer^ readSerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides ); - - // To read the file, a FileStream object is required. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - MyClass ^ myClass; - myClass = dynamic_cast(readSerializer->Deserialize( fs )); - - /* Here is the difference between reading and writing an - XML document: You must declare an object of the derived - type (Graduate) and cast the Student instance to it.*/ - Graduate^ g; - System::Collections::IEnumerator^ myEnum = myClass->Students->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Graduate^ grad = safe_cast(myEnum->Current); - g = dynamic_cast(grad); - Console::Write( "{0}\t", g->Name ); - Console::Write( "{0}\t", g->ID ); - Console::Write( "{0}\n", g->University ); - } - } - }; -} - -int main() -{ - College::Run::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp deleted file mode 100644 index 6dabc064fb4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void SerializeObject( String^ filename ) - { - XmlSerializer^ serializer = - gcnew XmlSerializer( OrderedItem::typeid ); - - // Create an instance of the class to be serialized. - OrderedItem^ i = gcnew OrderedItem; - - // Set the public property values. - i->ItemName = "Widget"; - i->Description = "Regular Widget"; - i->Quantity = 10; - i->UnitPrice = (Decimal)2.30; - - // Writing the document requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Serialize the object, and close the TextWriter. - serializer->Serialize( writer, i ); - writer->Close(); - } - -public: - // This is the class that will be serialized. - ref class OrderedItem - { - public: - String^ ItemName; - String^ Description; - Decimal UnitPrice; - int Quantity; - }; - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp deleted file mode 100644 index 01f91598da8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp +++ /dev/null @@ -1,82 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Price -{ -public: - - [XmlAttributeAttribute(Namespace="http://www.cpandl.com")] - String^ currency; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Decimal price; -}; - -[XmlType(Namespace="http://www.cpandl.com")] -public ref class Book -{ -public: - - [XmlElement(Namespace="http://www.cpandl.com")] - String^ TITLE; - - [XmlElement(Namespace="http://www.cohowinery.com")] - Price^ PRICE; -}; - -public ref class Books -{ -public: - - [XmlElement(Namespace="http://www.cohowinery.com")] - Book^ Book; -}; - -public ref class Run -{ -public: - static void main() - { - Run^ test = gcnew Run; - test->SerializeObject( "XmlNamespaces.xml" ); - } - - void SerializeObject( String^ filename ) - { - XmlSerializer^ s = gcnew XmlSerializer( Books::typeid ); - - // Writing a file requires a TextWriter. - TextWriter^ t = gcnew StreamWriter( filename ); - - /* Create an XmlSerializerNamespaces object and add two - prefix-namespace pairs. */ - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - ns->Add( "books", "http://www.cpandl.com" ); - ns->Add( "money", "http://www.cohowinery.com" ); - - // Create a Book instance. - Book^ b = gcnew Book; - b->TITLE = "A Book Title"; - Price^ p = gcnew Price; - p->price = (Decimal)9.95; - p->currency = "US Dollar"; - b->PRICE = p; - Books^ bks = gcnew Books; - bks->Book = b; - s->Serialize( t, bks, ns ); - t->Close(); - } -}; - -int main() -{ - Run::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp deleted file mode 100644 index 825b960ef4a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - XmlSerializerNamespaces^ AddNamespaces() - { - XmlSerializerNamespaces^ xmlNamespaces = - gcnew XmlSerializerNamespaces; - - // Add three prefix-namespace pairs. - xmlNamespaces->Add( "money", "http://www.cpandl.com" ); - xmlNamespaces->Add( "books", "http://www.cohowinery.com" ); - xmlNamespaces->Add( "software", "http://www.microsoft.com" ); - - return xmlNamespaces; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp deleted file mode 100644 index 89a101a18a2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - void PrintNamespacePairs( XmlSerializerNamespaces^ namespaces ) - { - array^ qualifiedNames = namespaces->ToArray(); - for ( int i = 0; i < qualifiedNames->Length; i++ ) - { - Console::WriteLine( "{0}\t{1}", - qualifiedNames[ i ]->Name, qualifiedNames[ i ]->Namespace ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp deleted file mode 100644 index 58d5dd55649..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Sample -{ - // -private: - XmlSerializerNamespaces^ CreateFromQNames() - { - XmlQualifiedName^ q1 = - gcnew XmlQualifiedName( "money","http://www.cohowinery.com" ); - - XmlQualifiedName^ q2 = - gcnew XmlQualifiedName( "books","http://www.cpandl.com" ); - - array^ names = { q1, q2 }; - - return gcnew XmlSerializerNamespaces( names ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp deleted file mode 100644 index fadecdb274e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,99 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Xml::Serialization; -using namespace System::IO; - -public ref class Group1 -{ -public: - - // The XmlTextAttribute with type set to string informs the - // XmlSerializer that strings should be serialized as XML text. - - [XmlText(String::typeid)] - [XmlElement(Int32::typeid)] - [XmlElement(Double::typeid)] - array^All; - Group1() - { - array^temp = {321,"One",2,3.0,"Two"}; - All = temp; - } -}; - -public enum class GroupType -{ - Small, Medium, Large -}; - -public ref class Group2 -{ -public: - - [XmlText(Type=GroupType::typeid)] - GroupType Type; -}; - -public ref class Group3 -{ -public: - - [XmlText(Type=DateTime::typeid)] - DateTime CreationTime; - Group3() - { - CreationTime = DateTime::Now; - } -}; - -public ref class Test -{ -public: - static void main() - { - Test^ t = gcnew Test; - t->SerializeArray( "XmlText1.xml" ); - t->SerializeEnum( "XmlText2.xml" ); - t->SerializeDateTime( "XmlText3.xml" ); - } - -private: - void SerializeArray( String^ filename ) - { - XmlSerializer^ ser = gcnew XmlSerializer( Group1::typeid ); - Group1^ myGroup1 = gcnew Group1; - TextWriter^ writer = gcnew StreamWriter( filename ); - ser->Serialize( writer, myGroup1 ); - writer->Close(); - } - - void SerializeEnum( String^ filename ) - { - XmlSerializer^ ser = gcnew XmlSerializer( Group2::typeid ); - Group2^ myGroup = gcnew Group2; - myGroup->Type = GroupType::Medium; - TextWriter^ writer = gcnew StreamWriter( filename ); - ser->Serialize( writer, myGroup ); - writer->Close(); - } - - void SerializeDateTime( String^ filename ) - { - XmlSerializer^ ser = gcnew XmlSerializer( Group3::typeid ); - Group3^ myGroup = gcnew Group3; - TextWriter^ writer = gcnew StreamWriter( filename ); - ser->Serialize( writer, myGroup ); - writer->Close(); - } -}; - -int main() -{ - Test::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp deleted file mode 100644 index d6719698f71..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Schema; - -public ref class Group -{ -public: - String^ GroupName; - String^ Comment; -}; - -public ref class Test -{ -public: - static void main() - { - Test^ t = gcnew Test; - t->SerializerOrder( "TextOverride.xml" ); - } - - /* Create an instance of the XmlSerializer class that overrides - the default way it serializes an object. */ - XmlSerializer^ CreateOverrider() - { - /* Create instances of the XmlAttributes and - XmlAttributeOverrides classes. */ - XmlAttributes^ attrs = gcnew XmlAttributes; - XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; - - /* Create an XmlTextAttribute to override the default - serialization process. */ - XmlTextAttribute^ xText = gcnew XmlTextAttribute; - attrs->XmlText = xText; - - // Add the XmlAttributes to the XmlAttributeOverrides. - xOver->Add( Group::typeid, "Comment", attrs ); - - // Create the XmlSerializer, and return it. - XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); - return xSer; - } - - void SerializerOrder( String^ filename ) - { - // Create an XmlSerializer instance. - XmlSerializer^ xSer = CreateOverrider(); - - // Create the object and serialize it. - Group^ myGroup = gcnew Group; - myGroup->Comment = "This is a great product."; - TextWriter^ writer = gcnew StreamWriter( filename ); - xSer->Serialize( writer, myGroup ); - } -}; - -int main() -{ - Test::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp deleted file mode 100644 index 0b402e1de87..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// - -[XmlType(Namespace="http://www.cpandl.com", -TypeName="GroupMember")] -public ref class Person -{ -public: - String^ Name; -}; - - -[XmlType(Namespace="http://www.cohowinery.com", -TypeName="GroupAddress")] -public ref class Address -{ -public: - String^ Line1; - String^ Line2; - String^ City; - String^ State; - String^ Zip; -}; - -public ref class Group -{ -public: - array^Staff; - Person^ Manager; - Address^ Location; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp deleted file mode 100644 index 592b8ccb053..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// - -[XmlType(IncludeInSchema=false)] -public ref class ExtraneousInfo{}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp deleted file mode 100644 index 04919033ae5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// - -[XmlType(Namespace="http://www.cpandl.com")] -public ref class Book{}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp deleted file mode 100644 index 87847fcbb3e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// -ref class Person; -ref class Job; -ref class Group -{ -public: - array^Staff; -}; - - -[XmlType(TypeName="Employee", -Namespace="http://www.cpandl.com")] -public ref class Person -{ -public: - String^ PersonName; - Job^ Position; -}; - - -[XmlType(TypeName="Occupation", -Namespace="http://www.cohowinery.com")] -public ref class Job -{ -public: - String^ JobName; -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp deleted file mode 100644 index 7064ebe4ae4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp +++ /dev/null @@ -1,248 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; -public ref class MyTcpClientExample -{ -public: - - // - // MyTcpClientConstructor is just used to illustrate the different constructors available in in the TcpClient class - static void MyTcpClientConstructor( String^ myConstructorType ) - { - if ( myConstructorType == "IPAddressExample" ) - { - - // - //Creates a TCPClient using a local end point. - IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; - IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); - TcpClient^ tcpClientA = gcnew TcpClient( ipLocalEndPoint ); - - // - } - else - if ( myConstructorType == "HostNameExample" ) - { - - // - // Creates a TCPClient using hostname and port. - TcpClient^ tcpClientB = gcnew TcpClient( "www.contoso.com",11000 ); - - // - } - else - if ( myConstructorType == "DefaultExample" ) - { - - // - //Creates a TCPClient using the default constructor. - TcpClient^ tcpClientC = gcnew TcpClient; - - // - } - else - { - - // - TcpClient^ tcpClientD = gcnew TcpClient( AddressFamily::InterNetwork ); - - // - } - } - - - // MyTcpClientConnection class is just used to illustrate the different connection methods of the TcpClient class. - static void MyTcpClientConnection( String^ myConnectionType ) - { - if ( myConnectionType == "HostnameExample" ) - { - - // - //Uses a host name and port number to establish a socket connection. - TcpClient^ tcpClient = gcnew TcpClient; - tcpClient->Connect( "www.contoso.com", 11002 ); - - // - tcpClient->Close(); - } - else - if ( myConnectionType == "IPAddressExample" ) - { - - // - //Uses the IP address and port number to establish a socket connection. - TcpClient^ tcpClient = gcnew TcpClient; - IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; - tcpClient->Connect( ipAddress, 11003 ); - - // - tcpClient->Close(); - } - else - if ( myConnectionType == "RemoteEndPointExample" ) - { - - // - //Uses a remote end point to establish a socket connection. - TcpClient^ tcpClient = gcnew TcpClient; - IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress,11004 ); - tcpClient->Connect( ipEndPoint ); - - // - tcpClient->Close(); - } - else - { - - // Do nothing. - } - } - - - // MyTcpClientPropertySetter is just used to illustrate setting and getting various properties of the TcpClient class. - static void MyTcpClientPropertySetter() - { - TcpClient^ tcpClient = gcnew TcpClient; - - // - // sets the receive buffer size using the ReceiveBufferSize public property. - tcpClient->ReceiveBufferSize = 1024; - - // gets the receive buffer size using the ReceiveBufferSize public property. - if ( tcpClient->ReceiveBufferSize == 1024 ) - Console::WriteLine( "The receive buffer was successfully set to {0}", tcpClient->ReceiveBufferSize ); - - - // - // - //sets the send buffer size using the SendBufferSize public property. - tcpClient->SendBufferSize = 1024; - - // gets the send buffer size using the SendBufferSize public property. - if ( tcpClient->SendBufferSize == 1024 ) - Console::WriteLine( "The send buffer was successfully set to {0}", tcpClient->SendBufferSize ); - - - // - // - // Sets the receive time out using the ReceiveTimeout public property. - tcpClient->ReceiveTimeout = 5; - - // Gets the receive time out using the ReceiveTimeout public property. - if ( tcpClient->ReceiveTimeout == 5 ) - Console::WriteLine( "The receive time out limit was successfully set {0}", tcpClient->ReceiveTimeout ); - - - // - // - // sets the send time out using the SendTimeout public property. - tcpClient->SendTimeout = 5; - - // gets the send time out using the SendTimeout public property. - if ( tcpClient->SendTimeout == 5 ) - Console::WriteLine( "The send time out limit was successfully set {0}", tcpClient->SendTimeout ); - - - // - // - // sets the amount of time to linger after closing, using the LingerOption public property. - LingerOption^ lingerOption = gcnew LingerOption( true,10 ); - tcpClient->LingerState = lingerOption; - - // gets the amount of linger time set, using the LingerOption public property. - if ( tcpClient->LingerState->LingerTime == 10 ) - Console::WriteLine( "The linger state setting was successfully set to {0}", tcpClient->LingerState->LingerTime ); - - - // - // - // Sends data immediately upon calling NetworkStream.Write. - tcpClient->NoDelay = true; - - // Determines if the delay is enabled by using the NoDelay property. - if ( tcpClient->NoDelay) - Console::WriteLine( "The delay was set successfully to {0}", tcpClient->NoDelay ); - - - // - tcpClient->Close(); - } - - static void MyTcpClientCommunicator() - { - - // - TcpClient^ tcpClient = gcnew TcpClient; - - // Uses the GetStream public method to return the NetworkStream. - NetworkStream^ netStream = tcpClient->GetStream(); - if ( netStream->CanWrite ) - { - array^sendBytes = Encoding::UTF8->GetBytes( "Is anybody there?" ); - netStream->Write( sendBytes, 0, sendBytes->Length ); - } - else - { - Console::WriteLine( "You cannot write data to this stream." ); - tcpClient->Close(); - - // Closing the tcpClient instance does not close the network stream. - netStream->Close(); - return; - } - - if ( netStream->CanRead ) - { - - // Reads NetworkStream into a byte buffer. - array^bytes = gcnew array(tcpClient->ReceiveBufferSize); - - // Read can return anything from 0 to numBytesToRead. - // This method blocks until at least one byte is read. - netStream->Read( bytes, 0, (int)tcpClient->ReceiveBufferSize ); - - // Returns the data received from the host to the console. - String^ returndata = Encoding::UTF8->GetString( bytes ); - Console::WriteLine( "This is what the host returned to you: {0}", returndata ); - } - else - { - Console::WriteLine( "You cannot read data from this stream." ); - tcpClient->Close(); - - // Closing the tcpClient instance does not close the network stream. - netStream->Close(); - return; - } - - - // - } - -}; - - -//end class -int main() -{ - - // Using the default constructor. - MyTcpClientExample::MyTcpClientConstructor( "DefaultExample" ); - - // Establish a connection by using the hostname and port number. - MyTcpClientExample::MyTcpClientConnection( "HostnameExample" ); - - // Set and verify all communication parameters before attempting communication. - MyTcpClientExample::MyTcpClientPropertySetter(); - - // Send and receive data using tcpClient class. - MyTcpClientExample::MyTcpClientCommunicator(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp deleted file mode 100644 index 9338142454c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// System::Runtime::Remoting::Lifetime.ClientSponsor::Register(MarshalByRefObject) -// System::Runtime::Remoting::Lifetime.ClientSponsor::Unregister(MarshalByRefObject) -// System::Runtime::Remoting::Lifetime.ClientSponsor::RenewalTime -// System::Runtime::Remoting::Lifetime.ClientSponsor::InitializeLifetimeService() -// System::Runtime::Remoting::Lifetime.ClientSponsor::Renewal(ILease*) -// System::Runtime::Remoting::Lifetime.ClientSponsor::Close() -// System::Runtime::Remoting::Lifetime.ClientSponsor - -/* The following example demonstrates 'RenewalTime', 'Register', 'UnRegister' and -'Close' methods of 'ClientSponsor' class. -A remote Object* is created and registered with 'ClientSponsor' class. The renewal -time is set. Then the leased time is renewed and the method of remote Object* is invoked. -Finally the remote Object* is unregistered. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Lifetime; - -// -int main() -{ - // Register a channel. - TcpChannel^ myChannel = gcnew TcpChannel; - ChannelServices::RegisterChannel( myChannel ); - RemotingConfiguration::RegisterActivatedClientType( - RemotingSamples::HelloService::typeid, "tcp://localhost:8085/" ); - - // Get the remote Object*. - RemotingSamples::HelloService ^ myService = gcnew RemotingSamples::HelloService; - - // Get a sponsor for renewal of time. - ClientSponsor^ mySponsor = gcnew ClientSponsor; - - // Register the service with sponsor. - mySponsor->Register( myService ); - - // Set renewaltime. - mySponsor->RenewalTime = TimeSpan::FromMinutes( 2 ); - - // Renew the lease. - ILease^ myLease = dynamic_cast(mySponsor->InitializeLifetimeService()); - TimeSpan myTime = mySponsor->Renewal( myLease ); - Console::WriteLine( "Renewed time in minutes is {0}", myTime.Minutes ); - - // Call the remote method. - Console::WriteLine( myService->HelloMethod( "World" ) ); - - // Unregister the channel. - mySponsor->Unregister( myService ); - mySponsor->Close(); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp b/snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp deleted file mode 100644 index 92548f77799..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp +++ /dev/null @@ -1,228 +0,0 @@ -// System.Runtime.Remoting.Channels.CommonTransportKeys -// System.Runtime.Remoting.Channels.CommonTransportKeys.IPAddress -// System.Runtime.Remoting.Channels.CommonTransportKeys.ConnectionId -// System.Runtime.Remoting.Channels.CommonTransportKeys.RequestUri -/* -This program demonstrates 'CommonTransportKeys' class and the static members 'IPAddress', 'ConnectionId', -'RequestUri'. 'LoggingClientChannelSinkProvider' and 'LoggingServerChannelSinkProvider' classes are -created which inherits'IClientChannelSinkProvider' and 'IServerChannelSinkProvider' respectively. -'ProcessMessage' method is having 'ITransportHeaders' parameter which gives the required header values. - -Note: This snippet assumes CommonTransportKeys_Server.cs, CommonTransportKeys_Client.cs, -CommonTransportKeys_Share.cs files along with channels.config, server.exe.config, client.exe. -config config files. -*/ -#using - -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Permissions; - -namespace Logging -{ - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - private ref class LoggingClientChannelSink: public BaseChannelObjectWithProperties, public IClientChannelSink - { - private: - IClientChannelSink^ nextSink1; - - public: - LoggingClientChannelSink() - : nextSink1( nullptr ) - {} - - LoggingClientChannelSink( IClientChannelSink^ localNextSink ) - : BaseChannelObjectWithProperties() - { - nextSink1 = localNextSink; - } - - - virtual void ProcessMessage( IMessage^ msg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) = IClientChannelSink::ProcessMessage - { - nextSink1->ProcessMessage( msg, requestHeaders, requestStream, responseHeaders, responseStream ); - } - - virtual void AsyncProcessRequest( IClientChannelSinkStack^ sinkStack, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream1 ) - { - sinkStack->Push( this, nullptr ); - nextSink1->AsyncProcessRequest( sinkStack, msg, headers, stream1 ); - } - - virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ sinkStack, Object^ /*state*/, ITransportHeaders^ headers, Stream^ stream1 ) - { - sinkStack->AsyncProcessResponse( headers, stream1 ); - } - - virtual Stream^ GetRequestStream( IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) - { - return nullptr; - } - - property IClientChannelSink^ NextChannelSink - { - virtual IClientChannelSink^ get() - { - return nextSink1; - } - } - }; - - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - public ref class LoggingClientChannelSinkProvider: public IClientChannelSinkProvider - { - private: - IClientChannelSinkProvider^ next1; - - public: - LoggingClientChannelSinkProvider() - : next1( nullptr ) - {} - - virtual IClientChannelSink^ CreateSink( IChannelSender^ channel1, String^ url1, Object^ remoteChannelData ) - { - IClientChannelSink^ localNextSink = nullptr; - if ( next1 != nullptr ) - { - localNextSink = next1->CreateSink( channel1, url1, remoteChannelData ); - if ( localNextSink == nullptr ) - return nullptr; - } - - return gcnew LoggingClientChannelSink( localNextSink ); - } - - property IClientChannelSinkProvider^ Next - { - virtual IClientChannelSinkProvider^ get() - { - return next1; - } - - virtual void set( IClientChannelSinkProvider^ value ) - { - next1 = value; - } - } - }; - - // - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - private ref class LoggingServerChannelSink: public BaseChannelObjectWithProperties, public IServerChannelSink - { - private: - IServerChannelSink^ nextSink2; - bool bEnabled2; - - public: - LoggingServerChannelSink() - : nextSink2( nullptr ), bEnabled2( true ) - {} - - LoggingServerChannelSink( IServerChannelSink^ localNextSink ) - : BaseChannelObjectWithProperties() - { - nextSink2 = localNextSink; - } - - virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% responseMsg, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) = IServerChannelSink::ProcessMessage - { - if ( bEnabled2 ) - { - Console::WriteLine( "----------Request Headers-----------" ); - - // - Console::WriteLine( "{0}:{1}", CommonTransportKeys::IPAddress, - requestHeaders[ CommonTransportKeys::IPAddress ] ); - // - // - Console::WriteLine( "{0}:{1}", CommonTransportKeys::ConnectionId, - requestHeaders[ CommonTransportKeys::ConnectionId ] ); - // - // - Console::WriteLine( "{0}:{1}", CommonTransportKeys::RequestUri, - requestHeaders[ CommonTransportKeys::RequestUri ] ); - // - } - - sinkStack->Push( this, nullptr ); - ServerProcessing processing = nextSink2->ProcessMessage( sinkStack, requestMsg, requestHeaders, requestStream, responseMsg, responseHeaders, responseStream ); - switch ( processing ) - { - case ServerProcessing::Complete: - sinkStack->Pop( this ); - break; - - case ServerProcessing::OneWay: - sinkStack->Pop( this ); - break; - - case ServerProcessing::Async: - sinkStack->Store( this, nullptr ); - break; - } - return processing; - } - - virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ /*state*/, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream1 ) - { - sinkStack->AsyncProcessResponse( msg, headers, stream1 ); - } - - virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) - { - return nullptr; - } - - property IServerChannelSink^ NextChannelSink - { - virtual IServerChannelSink^ get() - { - return nextSink2; - } - } - }; - - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - public ref class LoggingServerChannelSinkProvider: public IServerChannelSinkProvider - { - private: - IServerChannelSinkProvider^ next2; - - public: - LoggingServerChannelSinkProvider() - : next2( nullptr ) - {} - - LoggingServerChannelSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} - - virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){} - - virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel1 ) - { - IServerChannelSink^ localNextSink = nullptr; - if ( next2 != nullptr ) - localNextSink = next2->CreateSink( channel1 ); - - return gcnew LoggingServerChannelSink( localNextSink ); - } - - property IServerChannelSinkProvider^ Next - { - virtual IServerChannelSinkProvider^ get() - { - return next2; - } - - virtual void set( IServerChannelSinkProvider^ value ) - { - next2 = value; - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp deleted file mode 100644 index 393044fb260..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -// System::Web::Services::Discovery.ContractReference -/* -The following example demonstrates the 'ContractReference' class . -A new instance of 'ContractReference' class is obtained. The -Contract reference Object* is added to the list of references -contained within the discovery document and a '.disco' file is -generated for the Webservice where the reference tags of -ContractReference are reflected. -*/ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -int main() -{ - try - { - - // Get a DiscoveryDocument. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - - // Get a ContractReference. - ContractReference^ myContractReference = gcnew ContractReference; - - // Set the URL to the referenced service description. - myContractReference->Ref = "http://localhost/service1.asmx?wsdl"; - - // Set the URL for an XML Web service implementing the service - // description. - myContractReference->DocRef = "http://localhost/service1.asmx"; - SoapBinding^ myBinding = gcnew SoapBinding; - myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); - myBinding->Address = "http://localhost/service1.asmx"; - - // Add myContractReference to the list of references contained - // in the discovery document. - myDiscoveryDocument->References->Add( myContractReference ); - - // Add Binding to the references collection. - myDiscoveryDocument->References->Add( myBinding ); - - // Open or create a file for writing. - FileStream^ myFileStream = gcnew FileStream( "Service1.disco",FileMode::OpenOrCreate,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - - // Write myDiscoveryDocument into the passed stream. - myDiscoveryDocument->Write( myStreamWriter ); - Console::WriteLine( "The Service1.disco is generated." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error is {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp deleted file mode 100644 index e4861522f0f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// System.Web.Services.Discovery.ContractReference.Contract -/* -The following example demonstrates the 'Contract' property of the 'ContractReference' -class. -It creates an instance of 'DiscoveryDocument' class by reading from a disco file -and gets the first reference to a service description in a 'ContractReference' instance. -Using the 'Contract' property of the 'ContractReference' instance it creates a wsdl -file which works as a service description file. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Net; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Web::Services::Description; - -// -int main() -{ - try - { - // Create the file stream. - FileStream^ discoStream = gcnew FileStream( "Service1_CS.disco",FileMode::Open ); - - // Create the discovery document. - DiscoveryDocument^ myDiscoveryDocument = DiscoveryDocument::Read( discoStream ); - - // Get the first ContractReference in the collection. - ContractReference^ myContractReference = dynamic_cast(myDiscoveryDocument->References[ 0 ]); - - // Set the client protocol. - myContractReference->ClientProtocol = gcnew DiscoveryClientProtocol; - myContractReference->ClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // Get the service description. - ServiceDescription^ myContract = myContractReference->Contract; - - // Create the service description file. - myContract->Write( "MyService1.wsdl" ); - Console::WriteLine( "The WSDL file created is MyService1.wsdl" ); - discoStream->Close(); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Exception: {0}", ex->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp deleted file mode 100644 index e61ce94cb75..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// System.Web.Services.Discovery.ContractReference.DefaultFileName -// System.Web.Services.Discovery.ContractReference.Url -/* -The following example demonstrates the 'DefaultFilename' and 'Url' properties of -'ContractReference' class. It gets the 'DiscoveryDocument' object using the -'Discover' method of 'DiscoveryClientProtocol' class. It gets the 'ContractReference' -object by using the 'References' property of 'DiscoveryDocument' object.Then it displays the -'DefaultFileName' and 'Url' properties of 'ContractReference'. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::Xml::Schema; -using namespace System::Collections; - -int main() -{ - // - // - DiscoveryClientProtocol^ myProtocol = gcnew DiscoveryClientProtocol; - - // Get the DiscoveryDocument. - DiscoveryDocument^ myDiscoveryDocument = myProtocol->Discover( "http://localhost/ContractReference/test_cs.disco" ); - ArrayList^ myArrayList = dynamic_cast(myDiscoveryDocument->References); - - // Get the ContractReference. - ContractReference^ myContractRefrence = dynamic_cast(myArrayList[ 0 ]); - - // Get the DefaultFileName associated with the .disco file. - String^ myFileName = myContractRefrence->DefaultFilename; - - // Get the URL associated with the .disco file. - String^ myUrl = myContractRefrence->Url; - Console::WriteLine( "The DefaulFilename is: {0}", myUrl ); - Console::WriteLine( "The URL is: {0}", myUrl ); - // - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp deleted file mode 100644 index b1f994d4654..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// System::Web::Services::Discovery.ContractReference::ReadDocument -/* -* The following example demonstrates the 'ReadDocument' method of the -* 'ContractReference' class. -* It creates an instance of 'ContractReference' class and calls the -* 'ReadDocument' method passing a service description stream and get a -* 'ServiceDescription' instance. -*/ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Web::Services::Description; - -// -int main() -{ - try - { - // Create the file stream. - FileStream^ wsdlStream = gcnew FileStream( "MyService1_cpp.wsdl",FileMode::Open ); - ContractReference^ myContractReference = gcnew ContractReference; - - // Read the service description from the passed stream. - ServiceDescription^ myServiceDescription = dynamic_cast(myContractReference->ReadDocument( wsdlStream )); - Console::Write( "Target Namespace for the service description is: {0}", myServiceDescription->TargetNamespace ); - wsdlStream->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp deleted file mode 100644 index a906da5b758..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* -System::Web::Services::Discovery.ContractReference::ctor -System::Web::Services::Discovery.ContractReference::Ref -System::Web::Services::Discovery.ContractReference::DocRef -System::Web::Services::Discovery.ContractReference::Namespace - -The following example demonstrates the constructor, the -properties 'Ref', 'DocRef' and 'Namespace'. A sample discovery -document is read and 'Ref', 'DocRef' and 'Namespace' properties -are displayed. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Xml; -using namespace System::Web::Services::Discovery; - -int main() -{ - - // - // - // - // - // Call the Constructor of ContractReference. - ContractReference^ myContractReference = gcnew ContractReference; - // - XmlDocument^ myXmlDocument = gcnew XmlDocument; - - // Read the discovery document for the 'contractRef' tag. - myXmlDocument->Load( "http://localhost/Discoverydoc.disco" ); - XmlNode^ myXmlRoot = myXmlDocument->FirstChild; - XmlNode^ myXmlNode = myXmlRoot[ "scl:contractRef" ]; - XmlAttributeCollection^ myAttributeCollection = myXmlNode->Attributes; - myContractReference->Ref = myAttributeCollection[ 0 ]->Value; - Console::WriteLine( "The URL to the referenced service description is : {0}", myContractReference->Ref ); - // - myContractReference->DocRef = myAttributeCollection[ 1 ]->Value; - Console::WriteLine( "The URL implementing the referenced service description is : {0}", myContractReference->DocRef ); - // - Console::WriteLine( "Namespace for the referenced service description is : {0}", ContractReference::Namespace ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp deleted file mode 100644 index e2220cc74c0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -The following example demonstrates the 'WriteDocument' method of -'ContractReference' class. It creates a 'ContactReference' and a 'FileStream' Object*. -Then it gets the 'ServiceDescription' Object* corresponding to the 'test.wsdl' file. -Using the 'WriteDocument' method, the 'ServiceDescription' Object* is written into the -file stream. -Note: The 'TestInput_cpp::wsdl' file should exist in the same folder. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::IO; -using namespace System::Web::Services::Description; - -int main() -{ - try - { -// - ContractReference^ myContractReference = gcnew ContractReference; - FileStream^ myFileStream = gcnew FileStream( "TestOutput_cpp.wsdl", - FileMode::OpenOrCreate,FileAccess::Write ); - - // Get the ServiceDescription for the test .wsdl file. - ServiceDescription^ myServiceDescription = - ServiceDescription::Read( "TestInput_cpp.wsdl" ); - - // Write the ServiceDescription into the file stream. - myContractReference->WriteDocument( myServiceDescription, myFileStream ); - Console::WriteLine( "ServiceDescription is written " - + "into the file stream successfully." ); - Console::WriteLine( "The number of bytes written into the file stream: {0}", - myFileStream->Length ); - myFileStream->Close(); -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp deleted file mode 100644 index a188fe4e240..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// System::Web::Services::Discovery.ContractReference::ContractReference(String*) - -/* -The following example demonstrates the constructor 'ContractReference(String*)' -of 'ContractReference' class. A 'DiscoveryDocument' Object* is created .The -constructor initializes a new instance of 'ContractReference' using the supplied -reference to a Service Description::The Contract reference Object* is added to the list -of references contained within the discovery document. A '.disco' file is generated -for the webservice, where the reference tags of ContractReference are reflected. -*/ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; - -int main() -{ - try - { - // Create a DiscoveryDocument. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - -// - // Create a ContractReference using a reference to a service description. - ContractReference^ myContractReference = gcnew ContractReference( - "http://localhost/Service1::asmx?wsdl" ); -// - - // Set the URL for an XML Web service implementing the service description. - myContractReference->DocRef = "http://localhost/service1.asmx"; - SoapBinding^ myBinding = gcnew SoapBinding; - myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); - myBinding->Address = "http://localhost/service1.asmx"; - - // Add myContractReference to the list of references contained - // in the discovery document. - myDiscoveryDocument->References->Add( myContractReference ); - myDiscoveryDocument->References->Add( myBinding ); - - // Open or create a file for writing. - FileStream^ myFileStream = gcnew FileStream( "Service1.disco",FileMode::OpenOrCreate,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - - // Write myDiscoveryDocument into the passed stream. - myDiscoveryDocument->Write( myStreamWriter ); - Console::WriteLine( "The Service1.disco is generated." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error is {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp deleted file mode 100644 index ce3f7b776af..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// System::Web::Services::Discovery.ContractReference::ContractReference(String*, String*) - -/* -The following example demonstrates the constructor 'ContractReference(String*, String*)' -of 'ContractReference' class. In this example the 'ContractReference' class constructor -initializes a new instance of the 'ContractReference' class using the supplied references -to a service description and a XML Web service implementing the service description.The -Contract reference Object* is added to the list of references contained within the -discovery document and a '.disco' file is generated for the webservice where the -reference tags of ContractReference are reflected. -*/ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; - -int main() -{ - try - { - // Get a DiscoveryDocument. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - -// - // Create a ContractReference using a service description and - // an XML Web service. - ContractReference^ myContractReference = gcnew ContractReference( - "http://localhost/Service1::asmx?wsdl","http://localhost/Service1::asmx" ); -// - - SoapBinding^ myBinding = gcnew SoapBinding; - myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); - myBinding->Address = "http://localhost/service1.asmx"; - - // Add myContractReference to the list of references contained - // in the discovery document. - myDiscoveryDocument->References->Add( myContractReference ); - myDiscoveryDocument->References->Add( myBinding ); - - // Open or create a file for writing. - FileStream^ myFileStream = gcnew FileStream( "Service1.disco", - FileMode::OpenOrCreate,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - - // Write myDiscoveryDocument into the passed stream. - myDiscoveryDocument->Write( myStreamWriter ); - Console::WriteLine( "The Service1.disco is generated." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error is {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp b/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp deleted file mode 100644 index 14edae82980..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp +++ /dev/null @@ -1,147 +0,0 @@ - - -/* -This program demonstrates 'Item(string)' and 'Count' properties of 'CookieCollection' class. - -This program uses an internal site called "CookiesServer.aspx". The program creates a 'HttpWebRequest' -object with the 'URL' taken from command line argument. When no cookies are initially sent to -the server, it responds with a specific page querying the client for information. The client queries -this information from the user and sends it to the server in the second request. This information is -used by the server to not only structure the page sent subsequently but also construct some cookies to be -set by the client, for future requests. The response and the cookies that are sent from the server are -displayed to the console. - -Note: This program requires the "CookiesServer.aspx" server to be running before the execution of this -program.Please refer the "ReadmeCookiesServer.txt" file for setting up the server. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Text::RegularExpressions; -void DisplayCookies( CookieCollection^ cookies ) -{ - // - // - // Get the cookies in the 'CookieCollection' object using the 'Item' property. - // The 'Item' property in C++ is implemented through Indexers. - // The class that implements indexers is usually a collection of other objects. - // This class provides access to those objects with the '[i]' syntax. - try - { - if ( cookies->Count == 0 ) - { - Console::WriteLine( "No cookies to display" ); - return; - } - - Console::WriteLine( "{0}", cookies[ "UserName" ] ); - Console::WriteLine( "{0}", cookies[ "DateOfBirth" ] ); - Console::WriteLine( "{0}", cookies[ "PlaceOfBirth" ] ); - Console::WriteLine( "" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); - } - // - // -} - -void printUsage() -{ - Console::WriteLine( "Usage : " ); - Console::WriteLine( "CookieCollection_Item_1 " ); - Console::WriteLine( " is the name of the CookiesServer.aspx site installed locally" ); - Console::WriteLine( "\nExample : CookieCollection_Item_1 http://www.MyServer.com/CookiesServer.aspx" ); -} - -void GetPage( Uri^ requestUri ) -{ - try - { - array^output = gcnew array(120); - Stream^ myStream; - Encoding^ asciiEncoding = gcnew ASCIIEncoding; - - // Create the request. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); - - // Get the response without any cookies sent to the server. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - String^ usrName; - String^ dateBirth; - String^ placeBirth; - - // Get the information from the user as requested by the server and send it over to the server. - myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); - myHttpWebRequest->Method = "POST"; - myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; - Console::WriteLine( "\nEnter the values to be sent to the server :\n" ); - Console::Write( "UserName : " ); - usrName = Console::ReadLine(); - Console::Write( "\nDateOfBirth [dd/mm/yyyy]: " ); - dateBirth = Console::ReadLine(); - Regex^ regex = gcnew Regex( "/" ); - String^ convertDate = regex->Replace( dateBirth, "%2F" ); - Console::Write( "\nPlaceOfBirth : " ); - placeBirth = Console::ReadLine(); - Console::WriteLine( "" ); - output = asciiEncoding->GetBytes( String::Format( "UserName={0}&DateOfBirth={1}&PlaceOfBirth={2}&__EVENTTARGET=PlaceOfBirth&__EVENTARGUMENT=", usrName, convertDate, placeBirth ) ); - myHttpWebRequest->ContentLength = output->Length; - myStream = myHttpWebRequest->GetRequestStream(); - myStream->Write( output, 0, output->Length ); - myStream->Close(); - myHttpWebResponse->Close(); - - // Get the response. - myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Output the response to the console. - myStream = myHttpWebResponse->GetResponseStream(); - Console::WriteLine( "Displaying the contents of the page of '{0}' site:", requestUri ); - Console::WriteLine( "" ); - int bytesRead = 0; - while ( (bytesRead = myStream->Read( output, 0, output->Length )) != 0 ) - Console::Write( asciiEncoding->GetString( output, 0, bytesRead ) ); - Console::WriteLine( "" ); - Console::WriteLine( "\nDisplaying the cookies in the response : " ); - Console::WriteLine( "" ); - DisplayCookies( myHttpWebResponse->Cookies ); - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException raised.\nError : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); - } - -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - try - { - if ( args->Length < 2 ) - { - printUsage(); - return 0; - } - GetPage( gcnew Uri( args[ 1 ] ) ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "UriFormatException raised.\nError : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp b/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp deleted file mode 100644 index 5f84293fef8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp +++ /dev/null @@ -1,143 +0,0 @@ - - -/* -This program demonstrates 'Item(int)' properties of 'CookieCollection' class. - -This program uses an internal site called "CookiesServer.aspx". The program creates a 'HttpWebRequest' -object with the 'URL' taken from command line argument. When no cookies are initially sent to -the server, it responds with a specific page querying the client for information. The client queries -this information from the user and sends it to the server in the second request. This information is -used by the server to not only structure the page sent subsequently but also construct some cookies to be -set by the client, for future requests. The response and the cookies that are sent from the server are -displayed to the console. - -Note: This program requires the "CookiesServer.aspx" server to be running before the execution of this -program.Please refer the "ReadmeCookiesServer.txt" file for setting up the server. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Text::RegularExpressions; -void DisplayCookies( CookieCollection^ cookies ) -{ - // - // Get the cookies in the 'CookieCollection' object using the 'Item' property. - // The 'Item' property in C++ is implemented through Indexers. - // The class that implements indexers is usually a collection of other objects. - // This class provides access to those objects with the '[i]' syntax. - try - { - if ( cookies->Count == 0 ) - { - Console::WriteLine( "No cookies to display" ); - return; - } - - for ( int j = 0; j < cookies->Count; j++ ) - Console::WriteLine( "{0}", cookies[ j ] ); - Console::WriteLine( "" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); - } - // -} - -void GetPage( Uri^ requestUri ) -{ - try - { - array^output = gcnew array(120); - Stream^ myStream; - Encoding^ asciiEncoding = gcnew ASCIIEncoding; - - // Create the request. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); - - // Get the response without any cookies sent to the server. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - String^ usrName; - String^ dateBirth; - String^ placeBirth; - - // Get the information from the user as requested by the server and send it over to the server. - myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); - myHttpWebRequest->Method = "POST"; - myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; - Console::WriteLine( "\nEnter the values to be sent to the server :\n" ); - Console::Write( "UserName : " ); - usrName = Console::ReadLine(); - Console::Write( "\nDateOfBirth [dd/mm/yyyy]: " ); - dateBirth = Console::ReadLine(); - Regex^ regex = gcnew Regex( "/" ); - String^ convertDate = regex->Replace( dateBirth, "%2F" ); - Console::Write( "\nPlaceOfBirth : " ); - placeBirth = Console::ReadLine(); - Console::WriteLine( "" ); - output = asciiEncoding->GetBytes( String::Format( "UserName={0}&DateOfBirth={1}&PlaceOfBirth={2}&__EVENTTARGET=PlaceOfBirth&__EVENTARGUMENT=", usrName, convertDate, placeBirth ) ); - myHttpWebRequest->ContentLength = output->Length; - myStream = myHttpWebRequest->GetRequestStream(); - myStream->Write( output, 0, output->Length ); - myStream->Close(); - myHttpWebResponse->Close(); - - // Get the response. - myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Output the response to the console. - myStream = myHttpWebResponse->GetResponseStream(); - Console::WriteLine( "Displaying the contents of the page of '{0}' site:", requestUri ); - Console::WriteLine( "" ); - int bytesRead = 0; - while ( (bytesRead = myStream->Read( output, 0, output->Length )) != 0 ) - Console::Write( asciiEncoding->GetString( output, 0, bytesRead ) ); - Console::WriteLine( "" ); - Console::WriteLine( "\nDisplaying the cookies in the response : " ); - Console::WriteLine( "" ); - DisplayCookies( myHttpWebResponse->Cookies ); - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException raised.\nError : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); - } - -} - -void printUsage() -{ - Console::WriteLine( "Usage : " ); - Console::WriteLine( "CookieCollection_Item_2 " ); - Console::WriteLine( " is the name of the CookiesServer.aspx site installed locally" ); - Console::WriteLine( "\nExample : CookieCollection_Item_2 http://www.MyServer.com/CookiesServer.aspx" ); -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - try - { - if ( args->Length < 2 ) - { - printUsage(); - return 0; - } - GetPage( gcnew Uri( args[ 1 ] ) ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "UriFormatException raised.\nError : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp b/snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp deleted file mode 100644 index 2426daf471f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp +++ /dev/null @@ -1,141 +0,0 @@ - -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Serialization; - -// -// a custom ObjRef class that outputs its status -[System::Security::Permissions::SecurityPermissionAttribute( - System::Security::Permissions::SecurityAction::Demand, - Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::Demand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::InheritanceDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - -public ref class MyObjRef: public ObjRef -{ -private: - - // only instantiate via marshaling or deserialization - MyObjRef(){} - -public: - MyObjRef( MarshalByRefObject^ o, Type^ t ) - : ObjRef( o, t ) - { - Console::WriteLine( "Created MyObjRef." ); - ORDump(); - } - - MyObjRef( SerializationInfo^ i, StreamingContext c ) - : ObjRef( i, c ) - { - Console::WriteLine( "Deserialized MyObjRef." ); - } - - virtual void GetObjectData( SerializationInfo^ s, StreamingContext c ) override - { - - // After calling the base method, change the type from ObjRef to MyObjRef - ObjRef::GetObjectData( s, c ); - s->SetType( GetType() ); - Console::WriteLine( "Serialized MyObjRef." ); - } - - virtual Object^ GetRealObject( StreamingContext context ) override - { - if ( IsFromThisAppDomain() || IsFromThisProcess() ) - { - Console::WriteLine( "Returning actual Object* referenced by MyObjRef." ); - return ObjRef::GetRealObject( context ); - } - else - { - Console::WriteLine( "Returning proxy to remote Object*." ); - return RemotingServices::Unmarshal( this ); - } - } - - void ORDump() - { - Console::WriteLine( " --- Reporting MyObjRef Info --- " ); - Console::WriteLine( "Reference to {0}.", TypeInfo->TypeName ); - Console::WriteLine( "URI is {0}.", URI ); - Console::WriteLine( "\nWriting EnvoyInfo: " ); - if ( EnvoyInfo != nullptr ) - { - IMessageSink^ EISinks = EnvoyInfo->EnvoySinks; - while ( EISinks != nullptr ) - { - Console::WriteLine( "\tSink: {0}", EISinks ); - EISinks = EISinks->NextSink; - } - } - else - Console::WriteLine( "\t {no sinks}" ); - - Console::WriteLine( "\nWriting ChannelInfo: " ); - for ( int i = 0; i < ChannelInfo->ChannelData->Length; i++ ) - Console::WriteLine( "\tChannel: {0}", ChannelInfo->ChannelData[ i ] ); - Console::WriteLine( " ----------------------------- " ); - } -}; - -// a class that uses MyObjRef -public ref class LocalObject: public MarshalByRefObject -{ -public: - - // overriding CreateObjRef will allow us to return a custom ObjRef - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual ObjRef^ CreateObjRef( Type^ t ) override - { - return gcnew MyObjRef( this,t ); - } -}; -// - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Serialization; - -public ref class RemoteObject: public MarshalByRefObject -{ -public: - void Method1( LocalObject^ param ) - { - Console::WriteLine( "Invoked: Method1( {0})", param ); - } - -}; - -int main() -{ - ChannelServices::RegisterChannel( gcnew HttpChannel( 8090 ) ); - RemotingConfiguration::RegisterWellKnownServiceType( RemoteObject::typeid, "RemoteObject", WellKnownObjectMode::Singleton ); - RemoteObject^ RObj = dynamic_cast(Activator::GetObject( RemoteObject::typeid, "http://localhost:8090/RemoteObject" )); - LocalObject^ LObj = gcnew LocalObject; - RObj->Method1( LObj ); - Console::WriteLine( "Press Return to exit..." ); - Console::ReadLine(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp b/snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp deleted file mode 100644 index 3f4dc5fd571..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp +++ /dev/null @@ -1,139 +0,0 @@ - -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Serialization; - -// -// a custom ObjRef class that outputs its status -[System::Security::Permissions::SecurityPermissionAttribute( - System::Security::Permissions::SecurityAction::Demand, - Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::Demand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::InheritanceDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -public ref class MyObjRef: public ObjRef -{ -private: - - // only instantiate using marshaling or deserialization - MyObjRef(){} - -public: - MyObjRef( MarshalByRefObject^ o, Type^ t ) - : ObjRef( o, t ) - { - Console::WriteLine( "Created MyObjRef." ); - ORDump(); - } - - MyObjRef( SerializationInfo^ i, StreamingContext c ) - : ObjRef( i, c ) - { - Console::WriteLine( "Deserialized MyObjRef." ); - } - - virtual void GetObjectData( SerializationInfo^ s, StreamingContext c ) override - { - // After calling the base method, change the type from ObjRef to MyObjRef - ObjRef::GetObjectData( s, c ); - s->SetType( GetType() ); - Console::WriteLine( "Serialized MyObjRef." ); - } - - virtual Object^ GetRealObject( StreamingContext context ) override - { - if ( IsFromThisAppDomain() || IsFromThisProcess() ) - { - Console::WriteLine( "Returning actual Object^ referenced by MyObjRef." ); - return ObjRef::GetRealObject( context ); - } - else - { - Console::WriteLine( "Returning proxy to remote Object^." ); - return RemotingServices::Unmarshal( this ); - } - } - - void ORDump() - { - Console::WriteLine( " --- Reporting MyObjRef Info --- " ); - Console::WriteLine( "Reference to {0}.", TypeInfo->TypeName ); - Console::WriteLine( "URI is {0}.", URI ); - Console::WriteLine( "\nWriting EnvoyInfo: " ); - if ( EnvoyInfo != nullptr ) - { - IMessageSink^ EISinks = EnvoyInfo->EnvoySinks; - while ( EISinks != nullptr ) - { - Console::WriteLine( "\tSink: {0}", EISinks ); - EISinks = EISinks->NextSink; - } - } - else - Console::WriteLine( "\t {no sinks}" ); - - Console::WriteLine( "\nWriting ChannelInfo: " ); - for ( int i = 0; i < ChannelInfo->ChannelData->Length; i++ ) - Console::WriteLine( "\tChannel: {0}", ChannelInfo->ChannelData[ i ] ); - Console::WriteLine( " ----------------------------- " ); - } - -}; - -// a class that uses MyObjRef -public ref class LocalObject: public MarshalByRefObject -{ -public: - - // overriding CreateObjRef will allow us to return a custom ObjRef - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual ObjRef^ CreateObjRef( Type^ t ) override - { - return gcnew MyObjRef( this,t ); - } -}; -// - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Serialization; - -public ref class RemoteObject: public MarshalByRefObject -{ -public: - void Method1( LocalObject^ param ) - { - Console::WriteLine( "Invoked: Method1( {0})", param ); - } -}; - -int main() -{ - ChannelServices::RegisterChannel( gcnew HttpChannel( 8090 ) ); - WellKnownServiceTypeEntry^ wkste = gcnew WellKnownServiceTypeEntry( RemoteObject::typeid,"RemoteObject",WellKnownObjectMode::Singleton ); - RemotingConfiguration::RegisterWellKnownServiceType( wkste ); - RemoteObject^ RObj = dynamic_cast(Activator::GetObject( RemoteObject::typeid, "http://localhost:8090/RemoteObject" )); - LocalObject^ LObj = gcnew LocalObject; - RObj->Method1( LObj ); - Console::WriteLine( "Press Return to exit..." ); - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp deleted file mode 100644 index 30b79abc081..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// System::Net::CredentialCache->Add;System::Net::CredentialCache::CredentialCache(); -// System::Net::CredentialCache::Remove;System::Net::CredentialCache. - -/*This program demontrates the 'Remove' method, 'Add' method and 'CredentialCache' -constructor of the 'CredentialCache' class. It takes an URL creates a 'WebRequest' Object* for the Url. -The program stores a known set of credentials in a credential cache and removes a credential when it -is no longer needed. -*/ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url, String^ userName, String^ password, String^ domainName ) -{ - try - { -// -// - CredentialCache^ myCredentialCache = gcnew CredentialCache; - // Used Dummy names as credentials. They are to be replaced by credentials applicable locally. - myCredentialCache->Add( gcnew Uri( "http://www.microsoft.com/" ), "Basic", gcnew NetworkCredential( "user1","passwd1","domain1" ) ); - myCredentialCache->Add( gcnew Uri( "http://www.msdn.com/" ), "Basic", gcnew NetworkCredential( "user2","passwd2","domain2" ) ); - myCredentialCache->Add( gcnew Uri( url ), "Basic", gcnew NetworkCredential( userName,password,domainName ) ); - Console::WriteLine( "\nAdded your credentials to the program's CredentialCache" ); -// -// - // Create a webrequest with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( url ); - myWebRequest->Credentials = myCredentialCache; - Console::WriteLine( "\nLinked CredentialCache to your request." ); - // Send the request and wait for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); -// - - // Process response here. - - Console::Write( "Response received successfully." ); - - // Call 'Remove' method to dispose credentials for current Uri as not required further. - myCredentialCache->Remove( myWebRequest->RequestUri, "Basic" ); - Console::WriteLine( "\nYour credentials have now been removed from the program's CredentialCache" ); - myWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - if ( e->Response != nullptr ) - { - Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", (dynamic_cast(e->Response))->StatusDescription ); - } - else - { - Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", e->Status ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } - -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 4 ) - { - Console::WriteLine( "\n Usage:" ); - Console::WriteLine( "\n CredentialCache_Add_Remove " ); - Console::WriteLine( "\n Example: CredentialCache_Add_Remove http://www.microsoft.com Catherine cath$ microsoft" ); - } - else if ( args->Length == 4 ) - GetPage( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ] ); - else - { - Console::WriteLine( "\nInvalid arguments." ); - return 0; - } - - Console::WriteLine( " Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp deleted file mode 100644 index 778e10ae046..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp +++ /dev/null @@ -1,82 +0,0 @@ - - -// System::Net::CredentialCache::DefaultCredentials. -/* This program demonstrates the 'DefaultCredentials' property of the 'CredentialCache' -class. -Creates an 'HttpWebRequest' Object* to access the local Uri S"http://localhost"(IIS documentation start page) -Assigns the static property 'DefaultCredentials' of 'CredentialCache' as 'Credentials' for the 'HttpWebRequest' -Object*. DefaultCredentials returns the system credentials for the current security context in which -the application is running. For a client-side application, these are usually the Windows credentials -(user name, password, and domain) of the user running the application. -These credentials are used internally to authenticate the request. -The html contents of the start page are displayed to the console. - -Note: Make sure that S"Windows Authentication" has been set as Directory Security settings -for default web site in IIS -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - try - { - // - // Ensure Directory Security settings for default web site in IIS is "Windows Authentication". - String^ url = "http://localhost"; - - // Create a 'HttpWebRequest' object with the specified url. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); - - // Assign the credentials of the logged in user or the user being impersonated. - myHttpWebRequest->Credentials = CredentialCache::DefaultCredentials; - - // Send the 'HttpWebRequest' and wait for response. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - Console::WriteLine( "Authentication successful" ); - Console::WriteLine( "Response received successfully" ); - - // - Console::WriteLine( "\nPress enter to continue" ); - Console::ReadLine(); - - // Get the stream associated with the response object. - Stream^ receiveStream = myHttpWebResponse->GetResponseStream(); - Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); - - // Pipe the stream to a higher level stream reader with the required encoding format. - StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); - Console::WriteLine( "\r\nResponse stream received" ); - array^read = gcnew array(256); - - // Read 256 characters at a time. - int count = readStream->Read( read, 0, 256 ); - Console::WriteLine( "HTML...\r\n" ); - while ( count > 0 ) - { - // Dump the 256 characters on a string and display the string onto the console. - String^ output = gcnew String( read,0,count ); - Console::Write( output ); - count = readStream->Read( read, 0, 256 ); - } - Console::WriteLine( "" ); - - // Release the resources of response Object*. - myHttpWebResponse->Close(); - - // Release the resources of stream Object*. - readStream->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nException Raised. The following error occurred : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp deleted file mode 100644 index f38f54663af..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp +++ /dev/null @@ -1,86 +0,0 @@ - - -// System::Net::CredentialCache::GetCredential -/*This program demontrates the 'GetCredential' method of the CredentialCache class. It takes an URL -creates a 'WebRequest' Object* for the Url. The program stores a known set of credentials in a credential cache. -'GetCredential' will then retrieve the credentials for the requested Uri. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Collections; - -// -void Display( NetworkCredential^ credential ) -{ - Console::WriteLine( "\nThe credentials are:" ); - Console::WriteLine( "\nUsername : {0} , Password : {1} , Domain : {2}", credential->UserName, credential->Password, credential->Domain ); -} - -void GetPage( String^ url, String^ userName, String^ password, String^ domainName ) -{ - try - { - CredentialCache^ myCredentialCache = gcnew CredentialCache; - - // Dummy names used as credentials. - myCredentialCache->Add( gcnew Uri( "http://microsoft.com/" ), "Basic", gcnew NetworkCredential( "user1","passwd1","domain1" ) ); - myCredentialCache->Add( gcnew Uri( "http://msdn.com/" ), "Basic", gcnew NetworkCredential( "user2","passwd2","domain2" ) ); - myCredentialCache->Add( gcnew Uri( url ), "Basic", gcnew NetworkCredential( userName,password,domainName ) ); - - // Create a webrequest with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( url ); - - // Call 'GetCredential' to obtain the credentials specific to our Uri. - NetworkCredential^ myCredential = myCredentialCache->GetCredential( gcnew Uri( url ), "Basic" ); - Display( myCredential ); - - // Associating only our credentials. - myWebRequest->Credentials = myCredential; - - // Sends the request and waits for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Process response here. - Console::WriteLine( "\nResponse Received." ); - myWebResponse->Close(); - } - catch ( WebException^ e ) - { - if ( e->Response != nullptr ) - Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", (dynamic_cast(e->Response))->StatusDescription ); - else - Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } -} -// - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 4 ) - { - Console::WriteLine( "\n Usage:" ); - Console::WriteLine( "\n CredentialCache_GetCredential " ); - Console::WriteLine( "\n Example: CredentialCache_GetCredential http://www.microsoft.com Catherine cath$ microsoft" ); - } - else - if ( (args->Length == 4) ) - { - GetPage( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ] ); - } - else - { - Console::WriteLine( "\nInvalid arguments." ); - return 0; - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp deleted file mode 100644 index 86beeaa5a72..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp +++ /dev/null @@ -1,92 +0,0 @@ - - -// System::Net::CredentialCache::GetEnumerator -/*This program demontrates the 'GetEnumerator' method of the CredentialCache class. -It takes an URL, creates a 'WebRequest' Object* for the Url. The program stores a known set of credentials -in a credential cache which is then bound to the request. If the url requested has it's credentials in the cache -the response will be OK . 'GetEnumerator' method is used to enlist all the credentials stored in the -'CredentialCache' Object*. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Collections; - -// -void Display( NetworkCredential^ credential ) -{ - Console::WriteLine( "\n\tUsername : {0} , Password : {1} , Domain : {2}", credential->UserName, credential->Password, credential->Domain ); -} - -void GetPage( String^ url, String^ userName, String^ password, String^ domainName ) -{ - try - { - CredentialCache^ myCredentialCache = gcnew CredentialCache; - - // Dummy Credentials used here. - myCredentialCache->Add( gcnew Uri( "http://microsoft.com/" ), "Basic", gcnew NetworkCredential( "user1","passwd1","domain1" ) ); - myCredentialCache->Add( gcnew Uri( "http://msdn.com/" ), "Basic", gcnew NetworkCredential( "user2","passwd2","domain2" ) ); - myCredentialCache->Add( gcnew Uri( url ), "Basic", gcnew NetworkCredential( userName,password,domainName ) ); - - // Creates a webrequest with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( url ); - myWebRequest->Credentials = myCredentialCache; - IEnumerator^ listCredentials = myCredentialCache->GetEnumerator(); - Console::WriteLine( "\nDisplaying credentials stored in CredentialCache: " ); - while ( listCredentials->MoveNext() ) - Display( dynamic_cast(listCredentials->Current) ); - Console::WriteLine( "\nNow Displaying the same using 'foreach' : " ); - - // Can use foreach with CredentialCache(Since GetEnumerator function of IEnumerable* has been implemented by 'CredentialCache' class. - IEnumerator^ myEnum = myCredentialCache->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - NetworkCredential^ credential = safe_cast(myEnum->Current); - Display( credential ); - } - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Process response here. - Console::WriteLine( "\nResponse Received." ); - myWebResponse->Close(); - } - catch ( WebException^ e ) - { - if ( e->Response != nullptr ) - Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", (dynamic_cast(e->Response))->StatusDescription ); - else - Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } -} -// - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 4 ) - { - Console::WriteLine( "\n Usage:" ); - Console::WriteLine( "\n CredentialCache_GetEnumerator " ); - Console::WriteLine( "\n Example: CredentialCache_GetEnumerator http://www.microsoft.com Catherine cath$ microsoft" ); - } - else - if ( args->Length == 4 ) - { - GetPage( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ] ); - } - else - { - Console::WriteLine( "\n Invalid arguments." ); - return 0; - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp deleted file mode 100644 index f2179104c27..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp +++ /dev/null @@ -1,250 +0,0 @@ - - -// System::Runtime::Remoting::Proxies.ProxyAttribute::CreateInstance; -// System::Runtime::Remoting::Proxies.ProxyAttribute::CreateProxy; -// System::Runtime::Remoting::Proxies.RealProxy::SetStubData; -// System::Runtime::Remoting::Proxies.RealProxy::Invoke; -// System::Runtime::Remoting::Proxies.RealProxy::InitializeServerObject; -// System::Runtime::Remoting::Proxies.RealProxy::CreateObjRef; -// System::Runtime::Remoting::Proxies.RealProxy::GetObjectData; -// System::Runtime::Remoting::Proxies.RealProxy::GetTransparentProxy; -// System::Runtime::Remoting::Proxies.RealProxy::GetStubData; -// System::Runtime::Remoting::Proxies.RealProxy::GetProxiedType; -// System::Runtime::Remoting::Proxies.ProxyAttribute; -// System::Runtime::Remoting::Proxies.RealProxy; - -/* The following example demonstrates implementation of methods -'CreateInstance' and 'CreateProxy' of System::Runtime::Remoting::Proxies.ProxyAttribute and methods -'SetStubData', 'Invoke', 'InitializeServerObject', 'CreateObjRef', 'GetStubData', 'GetObjectData', -'GetTransparentProxy', 'GetProxiedType' of System::Runtime::Remoting::Proxies.RealProxy. - -The following program has derived from'ProxyAttribute', 'RealProxy' classes. CustomProxy is implemented by deriving -from 'RealProxy' and overriding 'Invoke' method. The new statement for 'CustomServer' class is intercepted to -derived 'CustomProxyAttribute' by setting 'ProxyAttribute' on the CustomServer class. Implementation of -'RealProxy' and 'ProxyAttribute' methods are shown. -*/ - -// -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Activation; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Security::Permissions; - -ref class CustomServer; - -[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] -public ref class MyProxy: public RealProxy -{ -private: - String^ myUri; - MarshalByRefObject^ myMarshalByRefObject; - -public: - MyProxy() - : RealProxy() - { - Console::WriteLine( "MyProxy Constructor Called..." ); - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( CustomServer::typeid )); - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - myUri = myObjRef->URI; - } - - MyProxy( Type^ type1 ) - : RealProxy( type1 ) - { - Console::WriteLine( "MyProxy Constructor Called..." ); - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( type1 )); - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - myUri = myObjRef->URI; - } - - MyProxy( Type^ type1, MarshalByRefObject^ targetObject ) - : RealProxy( type1 ) - { - Console::WriteLine( "MyProxy Constructor Called..." ); - myMarshalByRefObject = targetObject; - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - myUri = myObjRef->URI; - } - - // - // - virtual IMessage^ Invoke( IMessage^ myMessage ) override - { - Console::WriteLine( "MyProxy 'Invoke method' Called..." ); - if ( dynamic_cast(myMessage) ) - { - Console::WriteLine( "IMethodCallMessage*" ); - } - - if ( dynamic_cast(myMessage) ) - { - Console::WriteLine( "IMethodReturnMessage*" ); - } - - if ( dynamic_cast(myMessage) ) - { - // Initialize a new instance of remote object - IConstructionReturnMessage^ myIConstructionReturnMessage = this->InitializeServerObject( static_cast(myMessage) ); - ConstructionResponse^ constructionResponse = gcnew ConstructionResponse( nullptr,static_cast(myMessage) ); - return constructionResponse; - } - - IDictionary^ myIDictionary = myMessage->Properties; - IMessage^ returnMessage; - myIDictionary[ "__Uri" ] = myUri; - - // Synchronously dispatch messages to server. - returnMessage = ChannelServices::SyncDispatchMessage( myMessage ); - - // Pushing return value and OUT parameters back onto stack. - IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast(returnMessage); - return returnMessage; - } - // - // - - // - virtual ObjRef^ CreateObjRef( Type^ ServerType ) override - { - Console::WriteLine( "CreateObjRef Method Called ..." ); - CustomObjRef ^ myObjRef = gcnew CustomObjRef( myMarshalByRefObject,ServerType ); - myObjRef->URI = myUri; - return myObjRef; - } - // - - // - [System::Security::Permissions::SecurityPermissionAttribute( - System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override - { - // Add your custom data if any here. - RealProxy::GetObjectData( info, context ); - } - // - - [System::Security::Permissions::SecurityPermissionAttribute( - System::Security::Permissions::SecurityAction::Demand, - Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::InheritanceDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - ref class CustomObjRef: public ObjRef - { - public: - CustomObjRef( MarshalByRefObject^ myMarshalByRefObject, Type^ serverType ) - : ObjRef( myMarshalByRefObject, serverType ) - { - Console::WriteLine( "ObjRef 'Constructor' called" ); - } - - // Override this method to store custom data. - virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override - { - ObjRef::GetObjectData( info, context ); - } - }; -}; - -// -[AttributeUsageAttribute(AttributeTargets::Class)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::LinkDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::InheritanceDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -public ref class MyProxyAttribute: public ProxyAttribute -{ -public: - MyProxyAttribute(){} - - // - // Create an instance of ServicedComponentProxy - virtual MarshalByRefObject^ CreateInstance( Type^ serverType ) override - { - return ProxyAttribute::CreateInstance( serverType ); - } - // - - // - // - virtual RealProxy^ CreateProxy( ObjRef^ objRef1, Type^ serverType, Object^ serverObject, Context^ serverContext ) override - { - MyProxy^ myCustomProxy = gcnew MyProxy( serverType ); - if ( serverContext != nullptr ) - { - RealProxy::SetStubData( myCustomProxy, serverContext ); - } - - if ( ( !serverType->IsMarshalByRef) && (serverContext == nullptr) ) - { - throw gcnew RemotingException( "Bad Type for CreateProxy" ); - } - - return myCustomProxy; - } - // - // -}; - -[MyProxyAttribute] -ref class CustomServer: public ContextBoundObject -{ -public: - CustomServer() - { - Console::WriteLine( "CustomServer Base Class constructor called" ); - } - - void HelloMethod( String^ str ) - { - Console::WriteLine( "HelloMethod of Server is invoked with message : {0}", str ); - } -}; -// - -// Acts as a custom proxy user. -int main() -{ - Console::WriteLine( "" ); - Console::WriteLine( "CustomProxy Sample" ); - Console::WriteLine( "================" ); - Console::WriteLine( "" ); - - // - // - // - // Create an instance of MyProxy. - MyProxy^ myProxyInstance = gcnew MyProxy( CustomServer::typeid ); - - // Get a CustomServer proxy. - CustomServer^ myHelloServer = static_cast(myProxyInstance->GetTransparentProxy()); - // - - // Get stubdata. - Console::WriteLine( "GetStubData = {0}", RealProxy::GetStubData( myProxyInstance ) ); - // - - // Get ProxyType. - Console::WriteLine( "Type of object represented by RealProxy is : {0}", myProxyInstance->GetProxiedType() ); - // - - myHelloServer->HelloMethod( "RealProxy Sample" ); - Console::WriteLine( "" ); - - // Get a reference object from server. - Console::WriteLine( "Create an objRef object to be marshalled across Application Domains..." ); - ObjRef^ CustomObjRef = myProxyInstance->CreateObjRef( CustomServer::typeid ); - Console::WriteLine( "URI of 'ObjRef' object = {0}", CustomObjRef->URI ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp deleted file mode 100644 index 1b5f86b7e5c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp +++ /dev/null @@ -1,168 +0,0 @@ -/* -This program demonstrates the 'SocketPermission(PermissionState)', -'SocketPermission(NetworkAccess, TransportType, String*, int) constructors, -'FromXml', 'Intersect', 'AddPermission' methods and 'AllPorts' field -of 'SocketPermission' class. - -This program provides a class called 'DateClient' that functions as a client -for a 'DateServer'. A 'DateServer' is a server that provides the current date on -the server in response to a request from a client. The 'DateClient' class -provides a method called 'GetDate' which returns the current date on the server. -The 'GetDate' is the method that shows the use of 'SocketPermission' class. An -instance of 'SocketPermission' is obtained using the 'FromXml' method. Another -instance of 'SocketPermission' is created with the 'SocketPermission(NetworkAccess, -TransportType, String*, int)' constructor. A third 'SocketPermission' Object* is -formed from the intersection of the above two 'SocketPermission' objects with the -use of the 'Intersect' method of 'SocketPermission' class. This 'SocketPermission' -Object* is used by the 'GetDate' method to verify the permissions of the calling -method. If the calling method has the requisite permissions the 'GetDate' method -connects to the 'DateServer' and returns the current date that the 'DateServer' -sends. If any exception occurs the 'GetDate' method returns an empty String*. - -Note: This program requires 'DateServer_SocketPermission' program executing. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Collections; -using namespace System::Security; -using namespace System::Security::Permissions; - -void PrintUsage() -{ - Console::WriteLine( "Usage : DateClient_SocketPermission_Constructor" ); - Console::WriteLine( "\tDateClient_SocketPermission_Constructor " ); - Console::WriteLine( "\tThe ipaddress argument is the ip address of the Date server." ); - Console::WriteLine( "\tThe port argument is the port of the Date server." ); -} - -public ref class DateClient -{ -private: - Socket^ serverSocket; - Encoding^ asciiEncoding; - IPAddress^ serverAddress; - - int serverPort; - -public: - // The constructor takes the address and port of the remote server. - DateClient( IPAddress^ ipAddress, int port ) - { - serverAddress = ipAddress; - serverPort = port; - serverSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - asciiEncoding = Encoding::ASCII; - } - - String^ GetDate() - { -// -// -// -// -// -// - SocketPermission^ socketPermission1 = gcnew SocketPermission( PermissionState::Unrestricted ); - - // Create a 'SocketPermission' Object* for two ip addresses. - SocketPermission^ socketPermission2 = gcnew SocketPermission( PermissionState::None ); - SecurityElement^ securityElement1 = socketPermission2->ToXml(); - // 'SocketPermission' Object* for 'Connect' permission - SecurityElement^ securityElement2 = gcnew SecurityElement( "ConnectAccess" ); - // Format to specify ip address are ## - // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and - // for 'All'ports for the ip-address. - SecurityElement^ securityElement3 = gcnew SecurityElement( "URI","192.168.144.238#-1#3" ); - // Second 'SocketPermission' ip-address is '192.168.144.240' for 'All' transport types and - // for 'All' ports for the ip-address. - SecurityElement^ securityElement4 = gcnew SecurityElement( "URI","192.168.144.240#-1#3" ); - securityElement2->AddChild( securityElement3 ); - securityElement2->AddChild( securityElement4 ); - securityElement1->AddChild( securityElement2 ); - - // Obtain a 'SocketPermission' Object* using 'FromXml' method. - socketPermission2->FromXml( securityElement1 ); - - Console::WriteLine( "\nDisplays the result of FromXml method : \n" ); - Console::WriteLine( socketPermission2 ); - - // Create another 'SocketPermission' Object* with two ip addresses. - // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and for 'All' ports for the ip-address. - SocketPermission^ socketPermission3 = - gcnew SocketPermission( NetworkAccess::Connect, - TransportType::All, - "192.168.144.238", - SocketPermission::AllPorts ); - - // Second 'SocketPermission' ip-address is '192.168.144.239' for 'All' transport types and for 'All' ports for the ip-address. - socketPermission3->AddPermission( NetworkAccess::Connect, - TransportType::All, - "192.168.144.239", - SocketPermission::AllPorts ); - - Console::WriteLine( "Displays the result of AddPermission method : \n" ); - Console::WriteLine( socketPermission3 ); - - // Find the intersection between two 'SocketPermission' objects. - socketPermission1 = dynamic_cast(socketPermission2->Intersect( socketPermission3 )); - - Console::WriteLine( "Displays the result of Intersect method :\n " ); - Console::WriteLine( socketPermission1 ); - - // Demand that the calling method have the requsite socket permission. - socketPermission1->Demand(); -// -// -// -// -// -// - // Get the current date from the remote date server. - try - { - int bytesReceived; - array^getByte = gcnew array(100); - serverSocket->Connect( gcnew IPEndPoint( serverAddress,serverPort ) ); - bytesReceived = serverSocket->Receive( getByte, getByte->Length, SocketFlags::None ); - return asciiEncoding->GetString( getByte, 0, bytesReceived ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised : {0}", e->Message ); - return ""; - } - } -}; - -// demonstrates the caller of the 'GetDate' method for the 'DateClient' object. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length != 2 ) - { - PrintUsage(); - return 0; - } - - try - { - DateClient^ myDateClient = gcnew DateClient( IPAddress::Parse( args[ 0 ] ),Int32::Parse( args[ 1 ] ) ); - String^ currentDate = myDateClient->GetDate(); - Console::WriteLine( "The current date and time is : " ); - Console::WriteLine( " {0}", currentDate ); - } - // This exception is thrown by the called method in the context of improper permissions. - catch ( SecurityException^ e ) - { - Console::WriteLine( "\nSecurityException raised : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp b/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp deleted file mode 100644 index 427b6c42002..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp +++ /dev/null @@ -1,193 +0,0 @@ -/* -This program demonstrates the 'ToXml' and 'IsUnrestricted' method and 'ConnectList' property of -'SocketPermission' class. - -This program provides a class called 'DateClient' that functions as a client -for a 'DateServer'. A 'DateServer' is a server that provides the current date on -the server in response to a request from a client. The 'DateClient' class -provides a method called 'GetDate' which returns the current date on the server. -The 'GetDate' is the method that shows the use of 'SocketPermission' class. An -instance of 'SocketPermission' is obtained using the 'FromXml' method. Another -instance of 'SocketPermission' is created with the 'SocketPermission(NetworkAccess, -TransportType, String*, int)' constructor. A third 'SocketPermission' Object* is -formed from the union of the above two 'SocketPermission' objects with the use of the -'Union' method of 'SocketPermission' class. This 'SocketPermission' Object* is used by -the 'GetDate' method to verify the permissions of the calling method. If the calling -method has the requisite permissions the 'GetDate' method connects to the 'DateServer' -and returns the current date that the 'DateServer' sends. If any exception occurs -the 'GetDate' method returns an empty String*. - -Note: This program requires 'DateServer_SocketPermission' program executing. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Collections; -using namespace System::Security; -using namespace System::Security::Permissions; - -void PrintUsage() -{ - Console::WriteLine( "Usage : DateClient_SocketPermission_ToXml" ); - Console::WriteLine( "\tDateClient_SocketPermission_ToXml " ); - Console::WriteLine( "\tThe ipaddress argument is the ip address of the Date server." ); - Console::WriteLine( "\tThe port argument is the port of the Date server." ); -} - -public ref class DateClient -{ -private: - Socket^ serverSocket; - Encoding^ asciiEncoding; - IPAddress^ serverAddress; - int serverPort; - - // The constructor takes the address and port of the remote server. -public: - DateClient( IPAddress^ serverIpAddress, int port ) - { - serverAddress = serverIpAddress; - serverPort = port; - serverSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - asciiEncoding = Encoding::ASCII; - } - -private: - - // Print a security element and all its children, in a depth-first manner. - void PrintSecurityElement( SecurityElement^ securityElementObj, int depth ) - { - Console::WriteLine( "Depth : {0}", depth ); - Console::WriteLine( "Tag : {0}", securityElementObj->Tag ); - Console::WriteLine( "Text : {0}", securityElementObj->Text ); - if ( securityElementObj->Children != nullptr ) - Console::WriteLine( "Children : {0}", securityElementObj->Children->Count ); - - if ( securityElementObj->Attributes != nullptr ) - { - IEnumerator^ attributeEnumerator = securityElementObj->Attributes->GetEnumerator(); - while ( attributeEnumerator->MoveNext() ) - Console::WriteLine( "Attribute - \" {0}\" , Value - \" {1}\"", (dynamic_cast(attributeEnumerator))->Key, (dynamic_cast(attributeEnumerator))->Value ); - } - - Console::WriteLine( "" ); - if ( securityElementObj->Children != nullptr ) - { - depth += 1; - for ( int i = 0; i < securityElementObj->Children->Count; i++ ) - PrintSecurityElement( dynamic_cast(securityElementObj->Children[ i ]), depth ); - } - } - - -public: - String^ GetDate() - { - // - // - // - SocketPermission^ socketPermission1 = gcnew SocketPermission( PermissionState::Unrestricted ); - - // Create a 'SocketPermission' Object* for two ip addresses. - SocketPermission^ socketPermission2 = gcnew SocketPermission( PermissionState::None ); - SecurityElement^ securityElement4 = socketPermission2->ToXml(); - - // 'SocketPermission' Object* for 'Connect' permission - SecurityElement^ securityElement1 = gcnew SecurityElement( "ConnectAccess" ); - - // Format to specify ip address are ## - // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and for 'All' ports for the ip-address. - SecurityElement^ securityElement2 = gcnew SecurityElement( "URI","192.168.144.238#-1#3" ); - - // Second 'SocketPermission' ip-address is '192.168.144.240' for 'All' transport types and for 'All' ports for the ip-address. - SecurityElement^ securityElement3 = gcnew SecurityElement( "URI","192.168.144.240#-1#3" ); - securityElement1->AddChild( securityElement2 ); - securityElement1->AddChild( securityElement3 ); - securityElement4->AddChild( securityElement1 ); - - // Obtain a 'SocketPermission' Object* using 'FromXml' method. - socketPermission2->FromXml( securityElement4 ); - - // Create another 'SocketPermission' Object* with two ip addresses. - // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and for 'All' ports for the ip-address. - SocketPermission^ socketPermission3 = gcnew SocketPermission( NetworkAccess::Connect,TransportType::All,"192.168.144.238",SocketPermission::AllPorts ); - - // Second 'SocketPermission' ip-address is '192.168.144.239' for 'All' transport types and for 'All' ports for the ip-address. - socketPermission3->AddPermission( NetworkAccess::Connect, TransportType::All, "192.168.144.239", SocketPermission::AllPorts ); - Console::WriteLine( "\nChecks the Socket permissions using IsUnrestricted method : " ); - if ( socketPermission1->IsUnrestricted() ) - Console::WriteLine( "Socket permission is unrestricted" ); - else - Console::WriteLine( "Socket permission is restricted" ); - - Console::WriteLine(); - Console::WriteLine( "Display result of ConnectList property : \n" ); - IEnumerator^ enumerator = socketPermission3->ConnectList; - while ( enumerator->MoveNext() ) - { - Console::WriteLine( "The hostname is : {0}", dynamic_cast(enumerator->Current)->Hostname ); - Console::WriteLine( "The port is : {0}", dynamic_cast(enumerator->Current)->Port ); - Console::WriteLine( "The Transport type is : {0}", dynamic_cast(enumerator->Current)->Transport ); - } - - Console::WriteLine( "" ); - Console::WriteLine( "Display Security Elements :\n " ); - PrintSecurityElement( socketPermission2->ToXml(), 0 ); - - // Get a 'SocketPermission' Object* which is a union of two other 'SocketPermission' objects. - socketPermission1 = dynamic_cast(socketPermission3->Union( socketPermission2 )); - - // Demand that the calling method have the socket permission. - socketPermission1->Demand(); - // - // - // - - // Get the current date from the remote date server. - try - { - int bytesReceived; - array^getByte = gcnew array(100); - serverSocket->Connect( gcnew IPEndPoint( serverAddress,serverPort ) ); - bytesReceived = serverSocket->Receive( getByte, getByte->Length, static_cast(0) ); - return asciiEncoding->GetString( getByte, 0, bytesReceived ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised : {0}", e->Message ); - return ""; - } - } -}; - -// This class is used to demonstrate the caller of the 'GetDate' method for the 'DateClient' Object*. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length != 2 ) - { - PrintUsage(); - return 0; - } - - try - { - DateClient^ myDateClient = gcnew DateClient( IPAddress::Parse( args[ 0 ] ),Int32::Parse( args[ 1 ] ) ); - String^ currentDate = myDateClient->GetDate(); - Console::WriteLine( "The current date and time is : " ); - Console::WriteLine( " {0}", currentDate ); - } - // This exception is thrown by the called method in the context of improper permissions. - catch ( SecurityException^ e ) - { - Console::WriteLine( "\nSecurityException raised : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp b/snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp deleted file mode 100644 index 94ef69ae84a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// System.Web.Services.Description.InputBinding.InputBinding(); -// System.Web.Services.Description.InputBinding.Extensions -// System.Web.Services.Description.InputBinding -// System.Web.Services.Description.Message.Message(); -// System.Web.Services.Description.Message.Name; -// System.Web.Services.Description.Message.Parts; -// System.Web.Services.Description.MessageCollection.Add; -// System.Web.Services.Description.MessageCollection.Insert; -// System.Web.Services.Description.MessageCollection; -// System.Web.Services.Description.MessagePart.MessagePart(); -// System.Web.Services.Description.MessagePart.Element; -// System.Web.Services.Description.MessagePart.Name; -// System.Web.Services.Description.MessagePart; -// System.Web.Services.Description.MessagePartCollection.Add; -// System.Web.Services.Description.MessagePartCollection.Insert; - -/* - The following program takes input a WSDL file 'MathService_input.wsdl' with all information related to SOAP protocol - removed from it.In a way it tries to simulate a scenario wherein a service initially did not support a protocol, however later - on happen to support it. - In this example, the WSDL file is modified to insert a new Binding for SOAP. The binding is populated based on - WSDL document structure defined in WSDL specification. The ServiceDescription instance is loaded with values - for 'Messages', 'PortTypes','Bindings', and 'Port'. The instance is then written to an external file 'MathService_new.wsdl'. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -ref class MyClass1 -{ - // - // Creates a Message with name = messageName having one MessagePart - // with name = partName. -public: - static Message^ CreateMessage( String^ messageName, String^ partName, String^ element, String^ targetNamespace ) - { - // - // - Message^ myMessage = gcnew Message; - myMessage->Name = messageName; - // - // - // - // - // - MessagePart^ myMessagePart = gcnew MessagePart; - myMessagePart->Name = partName; - myMessagePart->Element = gcnew XmlQualifiedName( element,targetNamespace ); - myMessage->Parts->Add( myMessagePart ); - // - // - // - // - // - return myMessage; - } - // - - // - // Used to create OperationBinding instances within 'Binding'. - static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) - { - // Create OperationBinding for operation. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = operation; - - // - // - // Create InputBinding for operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - - // - // - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add InputBinding and OutputBinding to OperationBinding. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - - // Create an extensibility element for SoapOperationBinding. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation ); - - // Add the extensibility element SoapOperationBinding to OperationBinding. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - return myOperationBinding; - } - // - - // Used to create Operations under PortType. - static Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) - { - Operation^ myOperation = gcnew Operation; - myOperation->Name = operationName; - OperationMessage^ input = dynamic_cast(gcnew OperationInput); - input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); - OperationMessage^ output = dynamic_cast(gcnew OperationOutput); - output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); - myOperation->Messages->Add( input ); - myOperation->Messages->Add( output ); - return myOperation; - } - - static void main() - { - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cpp.wsdl" ); - // Create SOAP messages. - // - Message^ myMessage = gcnew Message; - myMessage->Name = "AddSoapOut"; - // - MessagePart^ myMessagePart = gcnew MessagePart; - myMessagePart->Name = "parameters"; - myMessagePart->Element = gcnew XmlQualifiedName( "AddResponse",myServiceDescription->TargetNamespace ); - myMessage->Parts->Add( myMessagePart ); - // - myServiceDescription->Messages->Add( myMessage ); - // - // - // - Message^ myMessage1 = gcnew Message; - myMessage1->Name = "AddSoapIn"; - // - MessagePart^ myMessagePart1 = gcnew MessagePart; - myMessagePart1->Name = "parameters"; - myMessagePart1->Element = gcnew XmlQualifiedName( "Add",myServiceDescription->TargetNamespace ); - myMessage1->Parts->Insert( 0, myMessagePart1 ); - // - myServiceDescription->Messages->Insert( 16, myMessage1 ); - // - myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapIn", "parameters", "Subtract", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapOut", "parameters", "SubtractResponse", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapIn", "parameters", "Multiply", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapOut", "parameters", "MultiplyResponse", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "DivideSoapIn", "parameters", "Divide", myServiceDescription->TargetNamespace ) ); - myServiceDescription->Messages->Add( CreateMessage( "DivideSoapOut", "parameters", "DivideResponse", myServiceDescription->TargetNamespace ) ); - - // Create a new PortType. - PortType^ soapPortType = gcnew PortType; - soapPortType->Name = "MathServiceSoap"; - soapPortType->Operations->Add( CreateOperation( "Add", "AddSoapIn", "AddSoapOut", myServiceDescription->TargetNamespace ) ); - soapPortType->Operations->Add( CreateOperation( "Subtract", "SubtractSoapIn", "SubtractSoapOut", myServiceDescription->TargetNamespace ) ); - soapPortType->Operations->Add( CreateOperation( "Multiply", "MultiplySoapIn", "MultiplySoapOut", myServiceDescription->TargetNamespace ) ); - soapPortType->Operations->Add( CreateOperation( "Divide", "DivideSoapIn", "DivideSoapOut", myServiceDescription->TargetNamespace ) ); - myServiceDescription->PortTypes->Add( soapPortType ); - - // Create a new Binding for the SOAP protocol. - Binding^ myBinding = gcnew Binding; - myBinding->Name = String::Concat( myServiceDescription->Services[ 0 ]->Name, "Soap" ); - - // Pass the name of the existing PortType MathServiceSoap and the - // Xml TargetNamespace attribute of the Descriptions tag. - myBinding->Type = gcnew XmlQualifiedName( "MathServiceSoap",myServiceDescription->TargetNamespace ); - - // Create a SOAP extensibility element. - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - - // Add tag soap:binding as an extensibility element. - myBinding->Extensions->Add( mySoapBinding ); - - // Create OperationBindings for each of the operations defined - // in the .asmx file. - OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( addOperationBinding ); - OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( subtractOperationBinding ); - OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( multiplyOperationBinding ); - OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace ); - myBinding->Operations->Add( divideOperationBinding ); - myServiceDescription->Bindings->Insert( 0, myBinding ); - Console::WriteLine( "\nTarget namespace of the service description to which the binding was added is: {0}", myServiceDescription->Bindings[ 0 ]->ServiceDescription->TargetNamespace ); - - // Create a Port. - Port^ soapPort = gcnew Port; - soapPort->Name = "MathServiceSoap"; - soapPort->Binding = gcnew XmlQualifiedName( myBinding->Name,myServiceDescription->TargetNamespace ); - - // Create a SoapAddress extensibility element to add to the port. - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/MathService.cs.asmx"; - soapPort->Extensions->Add( mySoapAddressBinding ); - - // Add the port to the MathService, which is the first service in - // the service collection. - myServiceDescription->Services[ 0 ]->Ports->Add( soapPort ); - - // Save the ServiceDescription to an external file. - myServiceDescription->Write( "MathService_new.wsdl" ); - Console::WriteLine( "\nSuccessfully added bindings for SOAP protocol and saved results in the file MathService_new.wsdl" ); - Console::WriteLine( "\n This file should be passed to the WSDL tool as input to generate the proxy" ); - } -}; - -int main() -{ - MyClass1::main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp deleted file mode 100644 index d293d82792a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* -System::Web::Services::Discovery.DiscoveryClientDocumentCollection - -The following example demonstrates the class 'DiscoveryClientDocumentCollection'. -A sample discovery document is read and the 'Keys' and 'Values' properties -are displayed. -*/ - -// -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Collections; -using namespace System::Web::Services::Discovery; - -int main() -{ - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // 'dataservice.disco' is a sample discovery document. - String^ myStringUrl = "http://localhost/dataservice.disco"; - - // 'Discover' method is called to populate the 'Documents' property. - DiscoveryDocument^ myDiscoveryDocument = - myDiscoveryClientProtocol->Discover( myStringUrl ); - - // An instance of the 'DiscoveryClientDocumentCollection' class is created. - DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = - myDiscoveryClientProtocol->Documents; - - // 'Keys' in the collection are retrieved. - ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys; - array^myObjectCollection = - gcnew array(myDiscoveryClientDocumentCollection->Count); - myCollection->CopyTo( myObjectCollection, 0 ); - Console::WriteLine( "The discovery documents in the collection are :" ); - for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection[ iIndex ] ); - - } - Console::WriteLine( "" ); - - // 'Values' in the collection are retrieved. - ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values; - array^myObjectCollection1 = - gcnew array(myDiscoveryClientDocumentCollection->Count); - myCollection1->CopyTo( myObjectCollection1, 0 ); - Console::WriteLine( "The objects in the collection are :" ); - for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection1[ iIndex ] ); - - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp deleted file mode 100644 index f41808e363c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/* -System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Keys -System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Values -System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Contains(String) - -The following example demonstrates the 'Keys', 'Values' properties -and the 'Contains' method. The 'Keys' property returns the names -the discoverydocuments in the 'DiscoveryClientDocumentCollection' and -the 'Values' property returns the type of objects in the -'DiscoveryClientDocumentCollection'. A sample discovery document is read -and the properties 'Keys' and 'Values' and the method 'Contains' are -displayed. -*/ - -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Collections; -using namespace System::Web::Services::Discovery; - -int main() -{ - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // 'dataservice.disco' is a sample discovery document. - String^ myStringUrl = "http://localhost/dataservice.disco"; - - // 'Discover' method is called to populate the 'Documents' property. - myDiscoveryClientProtocol->Discover( myStringUrl ); - DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = - myDiscoveryClientProtocol->Documents; - - // 'Keys' in the collection are retrieved. - // - ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys; - array^myObjectCollection = - gcnew array(myDiscoveryClientDocumentCollection->Count); - myCollection->CopyTo( myObjectCollection, 0 ); - Console::WriteLine( "The discovery documents in the collection are :" ); - for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) - Console::WriteLine( myObjectCollection[ iIndex ] ); - // - - Console::WriteLine( "" ); - - // - // 'Values' in the collection are retrieved. - ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values; - array^myObjectCollection1 = - gcnew array(myDiscoveryClientDocumentCollection->Count); - myCollection1->CopyTo( myObjectCollection1, 0 ); - Console::WriteLine( "The objects in the collection are :" ); - for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) - Console::WriteLine( myObjectCollection1[ iIndex ] ); - // - - Console::WriteLine( "" ); - - // - bool myContains = myDiscoveryClientDocumentCollection->Contains( myStringUrl ); - if ( myContains ) - Console::WriteLine( "The discovery document {0} is present in the Collection", myStringUrl ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp deleted file mode 100644 index e5595a2be7a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/* -System::Web::Services::Discovery.DiscoveryClientDocumentCollection::DiscoveryClientDocumentCollection -System::Web::Services::Discovery.DiscoveryClientDocumentCollection->Add -System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Remove -System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Item - -The following example demonstrates the constructor, the 'Add' and -'Remove' methods and the 'Item' property. The method 'Add', adds a -discovery document Object* to the DiscoveryClientDocumentCollection. -The method 'Remove', removes a discovery document Object* from the -DiscoveryClientDocumentCollection. The Item property is used to -retrieve an Object* in the DiscoveryClientDocumentCollection. A sample -discovery document is read and the methods 'Add', 'Remove' and the -property 'Item' are applied on the sample. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Collections; -using namespace System::Web::Services::Discovery; - -int main() -{ - // - // - // - DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = gcnew DiscoveryClientDocumentCollection; - // - - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - String^ myStringUrl = "http://www.contoso.com/service.disco"; - String^ myStringUrl1 = "http://www.contoso.com/service1.disco"; - myDiscoveryClientDocumentCollection->Add( myStringUrl, myDiscoveryDocument ); - myDiscoveryClientDocumentCollection->Add( myStringUrl1, myDiscoveryDocument ); - // - - myDiscoveryClientDocumentCollection->Remove( myStringUrl1 ); - // - - // - Object^ myObject = myDiscoveryClientDocumentCollection[ myStringUrl ]; - Console::WriteLine( "Object representing the Url : {0}", myObject ); - // - - Console::WriteLine( "" ); - - // 'Keys' in the collection are retrieved. - ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys; - array^myObjectCollection = gcnew array(myDiscoveryClientDocumentCollection->Count); - myCollection->CopyTo( myObjectCollection, 0 ); - Console::WriteLine( "The discovery documents in the collection are :" ); - for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection[ iIndex ] ); - } - Console::WriteLine( "" ); - - // 'Values' in the collection are retrieved. - ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values; - array^myObjectCollection1 = gcnew array(myDiscoveryClientDocumentCollection->Count); - myCollection1->CopyTo( myObjectCollection1, 0 ); - Console::WriteLine( "The objects in the collection are :" ); - for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) - Console::WriteLine( myObjectCollection1[ iIndex ] ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp deleted file mode 100644 index 4f8e4cdbea9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// System::Web::Services::Discovery.DiscoveryClientProtocol->AdditionalInformation - -/* The following example demonstrates 'AdditionalInformation' of DiscoveryClientProtocol -class. -In the example 'SoapBinding' informations is added to a 'DiscoveryClientProtocol' using -'AdditionalInformation' collection. The soap binding added is retrived back and SoapBinding -address is displayed. The resultant document is written back. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Xml; -using namespace System::Web::Services::Discovery; - -int main() -{ - try - { - // dataservice.disco is a sample discovery document. - String^ myStringUrl = "http://localhost/dataservice.disco"; - - // Call the Discover method to populate the Documents property. - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - myDiscoveryClientProtocol->Discover( myStringUrl ); - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Address = "http://schemas.xmlsoap.org/disco/scl/"; - mySoapBinding->Binding = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); - myDiscoveryClientProtocol->AdditionalInformation->Add( mySoapBinding ); - - // Write the information back. - myDiscoveryClientProtocol->WriteAll( "MyDirectory", "results.discomap" ); - System::Collections::IList^ myIList = myDiscoveryClientProtocol->AdditionalInformation; - mySoapBinding = nullptr; - mySoapBinding = dynamic_cast(myIList[ 0 ]); - Console::WriteLine( "The address of the SoapBinding associated with " - "AdditionalInformation is: {0}", mySoapBinding->Address ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp deleted file mode 100644 index 13d35e01f30..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/* -System::Web::Services::Discovery.DiscoveryClientProtocol::DiscoveryClientProtocol -System::Web::Services::Discovery.DiscoveryClientProtocol::Download(String)* - -The following example demonstrates the 'constructor' and the -method 'Download' of the 'DiscoveryClientProtocol' class. The -'Download' method downloads a discovery document into a stream. -A sample discovery document is read and the method 'download' -is applied on it. -*/ - -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Web::Services::Discovery; - -int main() -{ -// -// - // Call the constructor of the DiscoveryClientProtocol class. - DiscoveryClientProtocol^ myDiscoveryClientProtocol = - gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - // 'dataservice.disco' is a sample discovery document. - String^ myStringUrl = "http://localhost:80/dataservice.disco"; - - Stream^ myStream = myDiscoveryClientProtocol->Download( myStringUrl ); - - Console::WriteLine( "Size of the discovery document downloaded" ); - Console::WriteLine( "is : {0} bytes", myStream->Length ); - myStream->Close(); -// -// -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp deleted file mode 100644 index 03531eb4e6d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// System.web.Services.Discovery.DiscoveryClientProtocol.Download(string,string) - -/* -The following example demonstrates the usage of the 'Download' method -of the class 'DiscoveryClientProtocol'. The input to the program is -a discovery file 'MathService_cs.vsdisco'. It generates a 'Stream' -instance of the discovery file 'MathService_cs.vsdisco' from the -'Download' method of 'DiscoveryClientPrototocol' and prints out -the 'contentType' and length in bytes of the discoverydocument. -*/ - -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::Collections; -using namespace System::IO; - -int main() -{ -// - String^ myDiscoFile = "http://localhost/MathService_cs.vsdisco"; - String^ myEncoding = ""; - DiscoveryClientProtocol^ myDiscoveryClientProtocol = - gcnew DiscoveryClientProtocol; - - Stream^ myStream = myDiscoveryClientProtocol->Download( - myDiscoFile, myEncoding ); - Console::WriteLine( "The length of the stream in bytes: {0}", - myStream->Length ); - Console::WriteLine( "The MIME encoding of the downloaded " + - "discovery document: {0}", myEncoding ); - myStream->Close(); -// -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp deleted file mode 100644 index 8f7d7442435..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// System.web.Services.Discovery.DiscoveryClientProtocol.Errors - -/* -The following example demonstrates the usage of the 'Errors' property -of the class 'DiscoveryClientProtocol'. The input to the program is -a discovery file 'MathService_cs.vsdisco', which holds reference -related to 'MathService_cs.asmx' web service. The program is -excecuted first time with existence of the file -'MathService_cs.asmx' in the location as specified in the discovery -file. The file 'MathService_cs.asmx' is removed from the referred -location in a way to simulate a scenario wherein the file related -to web service is missing, and the program is excecuted the second time -to show the exception occuring. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::Collections; - -int main() -{ - -// - String^ myDiscoFile = "http://localhost/MathService_cs.vsdisco"; - String^ myUrlKey = "http://localhost/MathService_cs.asmx?wsdl"; - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - - // Get the discovery document. - DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myDiscoFile ); - IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - { - ContractReference^ myContractReference = dynamic_cast(myEnumerator->Current); - - // Get the DiscoveryClientProtocol from the ContractReference. - myDiscoveryClientProtocol = myContractReference->ClientProtocol; - myDiscoveryClientProtocol->ResolveAll(); - DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol->Errors; - if ( myExceptionDictionary->Contains( myUrlKey ) ) - { - Console::WriteLine( "System generated exceptions." ); - - // Get the exception from the DiscoveryExceptionDictionary. - Exception^ myException = myExceptionDictionary[ myUrlKey ]; - Console::WriteLine( " Source : {0}", myException->Source ); - Console::WriteLine( " Exception : {0}", myException->Message ); - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp deleted file mode 100644 index 256a95000a9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// System::Web::Services::Discovery.DiscoveryClientReferenceCollection - -/* -The following example demonstrates the class -'DiscoveryClientReferenceCollection'. A sample discovery document -is read and the 'Keys' and 'Values' properties are displayed. A -String* containing the URL of a discovery document is passed as -an argument to 'Contains' method of the instance of the class. -*/ - -// -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Collections; -using namespace System::Web::Services::Discovery; - -int main() -{ - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // 'dataservice.vsdisco' is a sample discovery document. - String^ myStringUrl = "http://localhost/dataservice.vsdisco"; - - // Call the Discover method to populate the References property. - DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); - - // Resolve all references found in the discovery document. - myDiscoveryClientProtocol->ResolveAll(); - DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = myDiscoveryClientProtocol->References; - - // Retrieve the keys from the collection. - ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys; - array^myObjectCollection = gcnew array(myDiscoveryClientReferenceCollection->Count); - myCollection->CopyTo( myObjectCollection, 0 ); - Console::WriteLine( "The discovery documents, service descriptions, and XML schema" ); - Console::WriteLine( " definitions in the collection are: " ); - for ( int i = 0; i < myObjectCollection->Length; i++ ) - { - Console::WriteLine( myObjectCollection[ i ] ); - } - Console::WriteLine( "" ); - - // Retrieve the values from the collection. - ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values; - array^myObjectCollection1 = gcnew array(myDiscoveryClientReferenceCollection->Count); - myCollection1->CopyTo( myObjectCollection1, 0 ); - Console::WriteLine( "The objects in the collection are: " ); - for ( int i = 0; i < myObjectCollection1->Length; i++ ) - { - Console::WriteLine( myObjectCollection1[ i ] ); - } - Console::WriteLine( "" ); - String^ myStringUrl1 = "http://localhost/dataservice.vsdisco"; - if ( myDiscoveryClientReferenceCollection->Contains( myStringUrl1 ) ) - { - Console::WriteLine( "The document reference {0} is part of the collection.", myStringUrl1 ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp deleted file mode 100644 index 97d6c8335c8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* -System::Web::Services::Discovery.DiscoveryClientReferenceCollection::DiscoveryClientReferenceCollection -System::Web::Services::Discovery.DiscoveryClientReferenceCollection->Add(DiscoveryReference) -System::Web::Services::Discovery.DiscoveryClientReferenceCollection->Add(DiscoveryReference, url) -System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Remove -System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Item - -The following example demonstrates the 'constructor' and various members of -the class 'DiscoveryClientReferenceCollection'. The 'Add(DiscoveryReference)' -method adds a DocumentReference Object* to the DiscoveryClientDocumentCollection -collection. The Add(url, DiscoveryReference) method adds a DiscoveryReference -with the specified Url. The 'Remove' method removes a DiscoveryReference with -the specified Url from the 'DiscoveryClientReferenceCollection' collection. -The 'Item' property gets or sets a DiscoveryReference Object* from the -'DiscoveryClientReferenceCollection' with the specified Url. -*/ - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Web::Services::Discovery; - -int main() -{ - // - // - // - DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = gcnew DiscoveryClientReferenceCollection; - ContractReference^ myContractReference = gcnew ContractReference; - String^ myStringUrl1 = "http://www.contoso.com/service1.disco"; - myContractReference->Ref = myStringUrl1; - myDiscoveryClientReferenceCollection->Add( myContractReference ); - // - // - - // myDiscoveryClientReferenceCollection is an instance collection. - Object^ myObject = myDiscoveryClientReferenceCollection[ myStringUrl1 ]; - Console::WriteLine( "Object representing the URL: {0}", myObject ); - // - - Console::WriteLine( "" ); - - // - // - DiscoveryDocumentReference^ myDiscoveryDocumentReference = gcnew DiscoveryDocumentReference; - String^ myStringUrl = "http://www.contoso.com/service.disco"; - myDiscoveryClientReferenceCollection->Add( myStringUrl, myDiscoveryDocumentReference ); - // - - myDiscoveryClientReferenceCollection->Remove( myStringUrl ); - // - - // Retrieve the keys in the collection. - ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys; - array^myObjectCollection = gcnew array(myDiscoveryClientReferenceCollection->Count); - myCollection->CopyTo( myObjectCollection, 0 ); - Console::WriteLine( "The discovery documents, service descriptions, and" ); - Console::WriteLine( "XML schema definitions in the collection are:" ); - for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection[ iIndex ] ); - } - Console::WriteLine( "" ); - - // Retrieve the values in the collection. - ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values; - array^myObjectCollection1 = gcnew array(myDiscoveryClientReferenceCollection->Count); - myCollection1->CopyTo( myObjectCollection1, 0 ); - Console::WriteLine( "The objects in the collection are:" ); - for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection1[ iIndex ] ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp deleted file mode 100644 index 58015aa26df..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Keys -System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Values -System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Contains - -The following example demonstrates the 'Keys', 'Values' properties and -the method 'Contains' of the class 'DiscoveryClientReferenceCollection'. A sample -discovery document is read and the 'Keys', 'Values' and 'Contains' properties -are displayed. -*/ - -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Collections; -using namespace System::Web::Services::Discovery; - -int main() -{ -// - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // 'dataservice.disco' is a sample discovery document. - String^ myStringUrl = "http://localhost/dataservice.disco"; - - // Call the Discover method to populate the References property. - DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); - - // Resolve all references found in the discovery document. - myDiscoveryClientProtocol->ResolveAll(); - DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = myDiscoveryClientProtocol->References; - - // Retrieve the keys in the collection. - ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys; - array^myObjectCollection = gcnew array(myDiscoveryClientReferenceCollection->Count); - myCollection->CopyTo( myObjectCollection, 0 ); - Console::WriteLine( "The discovery documents, service descriptions, and XML schema" ); - Console::WriteLine( " definitions in the collection are:" ); - for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection[ iIndex ] ); - } -// - Console::WriteLine( "" ); -// - // Retrieve the values in the collection. - ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values; - array^myObjectCollection1 = gcnew array(myDiscoveryClientReferenceCollection->Count); - myCollection1->CopyTo( myObjectCollection1, 0 ); - Console::WriteLine( "The objects in the collection are:" ); - for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) - { - Console::WriteLine( myObjectCollection1[ iIndex ] ); - } -// - Console::WriteLine( "" ); -// - String^ myStringUrl1 = "http://localhost/dataservice.disco"; - if ( myDiscoveryClientReferenceCollection->Contains( myStringUrl1 ) ) - { - Console::WriteLine( "The document reference {0} is part of the collection.", myStringUrl1 ); - } -// -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp deleted file mode 100644 index 8dc400a665b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// System.Web.Services.DiscoveryClientResult -/* -The following example demonstrates 'DiscoveryClientResult' class. -A 'DiscoveryClientResultCollection' object is obtained by reading a -'.discomap' file which contains the 'DiscoveryClientResult' objects, -representing the details of discovery references. The contents of this -collection are displayed.. -*/ -// -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -int main() -{ - try - { - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - - // Get the collection holding DiscoveryClientResult objects. - DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = myDiscoveryClientProtocol->ReadAll( "results.discomap" ); - Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count ); - Console::WriteLine( "Displaying the items in the collection:" ); - - // Iterate through the collection and display the properties - // of each DiscoveryClientResult in it. - System::Collections::IEnumerator^ myEnum = myDiscoveryClientResultCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DiscoveryClientResult^ myDiscoveryClientResult = safe_cast(myEnum->Current); - Console::WriteLine( "Type of reference in the discovery document: {0}", myDiscoveryClientResult->ReferenceTypeName ); - Console::WriteLine( "Url for the reference: {0}", myDiscoveryClientResult->Url ); - Console::WriteLine( "File for saving the reference: {0}", myDiscoveryClientResult->Filename ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error is {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp deleted file mode 100644 index 0a3223d17da..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// System.Web.Services.Discovery.DiscoveryClientResultCollection - -/* -The following example demonstrates 'DiscoveryClientResultCollection' class. -A 'DiscoveryClientResultCollection' object is obtained by reading a '.discomap' file -which contains the 'DiscoveryClientResult' objects, representing the details of -discovery references. An element from the collection is removed and programmatically -added to 'DiscoveryClientResultCollection' class. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Xml::Schema; -using namespace System::Collections; - -int main() -{ - try - { - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - - // Get the collection of DiscoveryClientResult objects. - DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = - myDiscoveryClientProtocol->ReadAll( "results.discomap" ); - Console::WriteLine( "Removing a DiscoveryClientResult from the collection..." ); - - // Remove the first DiscoveryClientResult from the collection. - myDiscoveryClientResultCollection->Remove( myDiscoveryClientResultCollection[ 0 ] ); - Console::WriteLine( "Adding a DiscoveryClientResult to the collection..." ); - DiscoveryClientResult^ myDiscoveryClientResult = gcnew DiscoveryClientResult; - - // Set the DiscoveryDocumentReference class as the type of - // reference in the discovery document. - myDiscoveryClientResult->ReferenceTypeName = - "System.Web.Services.Discovery.DiscoveryDocumentReference"; - - // Set the URL for the reference. - myDiscoveryClientResult->Url = "http://localhost/Discovery/Service1_cs.asmx?disco"; - - // Set the name of the file in which the reference is saved. - myDiscoveryClientResult->Filename = "Service1_cs.disco"; - - // Add myDiscoveryClientResult to the collection. - myDiscoveryClientResultCollection->Add( myDiscoveryClientResult ); - if ( myDiscoveryClientResultCollection->Contains( myDiscoveryClientResult ) ) - { - Console::WriteLine( "Instance of DiscoveryClientResult found in the Collection" ); - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Error is {0}", ex->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp deleted file mode 100644 index e186c3aeca3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// System.Web.Services.Discovery.DiscoveryClientResultCollection.Remove -// System.Web.Services.Discovery.DiscoveryClientResult() -// System.Web.Services.Discovery.DiscoveryClientResult.ReferenceTypeName -// System.Web.Services.Discovery.DiscoveryClientResult.Url -// System.Web.Services.Discovery.DiscoveryClientResult.Filename -// System.Web.Services.Discovery.DiscoveryClientResultCollection.Add -// System.Web.Services.Discovery.DiscoveryClientResultCollection.Contains -// System.Web.Services.Discovery.DiscoveryClientResultCollection.Item - -/* -The following example demonstrates 'ReferenceTypeName' ,'Url','Filename' properties and the -constructor of 'DiscoveryClientResult' class and 'Remove', 'Add' 'Contains' methods and -'Item' property of 'DiscoveryClientResultCollection' class. -A 'DiscoveryClientResultCollection' object is obtained by reading a '.discomap' file -which contains the 'DiscoveryClientResult' objects, representing the details of -discovery references. An element from the collection is removed and programmatically -added to it to show the usage of methods of 'DiscoveryClientResultCollection' class . -The contents of this collection are displayed.. -*/ - -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; - -int main() -{ - try - { - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - - // Get the collection of DiscoveryClientResult objects. - DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = myDiscoveryClientProtocol->ReadAll( "results.discomap" ); - Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count ); - Console::WriteLine( "Removing a DiscoveryClientResult from the collection..." ); - - // - // Remove the first DiscoveryClientResult from the collection. - myDiscoveryClientResultCollection->Remove( myDiscoveryClientResultCollection[ 0 ] ); - // - - Console::WriteLine( "Adding a DiscoveryClientResult to the collection..." ); - - // - // - // - // - // - // Initialize new instance of the DiscoveryClientResult class. - DiscoveryClientResult^ myDiscoveryClientResult = gcnew DiscoveryClientResult; - - // Set the type of reference in the discovery document as - // DiscoveryDocumentReference. - myDiscoveryClientResult->ReferenceTypeName = "System.Web.Services.Discovery.DiscoveryDocumentReference"; - - // Set the URL for the reference. - myDiscoveryClientResult->Url = "http://localhost/Discovery/Service1_cs.asmx?disco"; - - // Set the name of the file in which the reference is saved. - myDiscoveryClientResult->Filename = "Service1_cs.disco"; - - // Add the DiscoveryClientResult to the collection. - myDiscoveryClientResultCollection->Add( myDiscoveryClientResult ); - // - // - // - // - // - - // - if ( myDiscoveryClientResultCollection->Contains( myDiscoveryClientResult ) ) - { - Console::WriteLine( "The collection contains the specified " - "DiscoveryClientResult instance." ); - } - // - - Console::WriteLine( "Displaying the items in collection" ); - - // - for ( int i = 0; i < myDiscoveryClientResultCollection->Count; i++ ) - { - DiscoveryClientResult^ myClientResult = myDiscoveryClientResultCollection[ i ]; - Console::WriteLine( "DiscoveryClientResult {0}", (i + 1) ); - Console::WriteLine( "Type of reference in the discovery document: {0}", myClientResult->ReferenceTypeName ); - Console::WriteLine( "Url for reference:{0}", myClientResult->Url ); - Console::WriteLine( "File for saving the reference: {0}", myClientResult->Filename ); - } - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error is {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp deleted file mode 100644 index 40ff11fefc4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// System.Web.Services.Discovery.DiscoveryClientResult(Type,String,String) - -/* -The following example demonstrates the DiscoveryClientResult(Type,String,String) -constructor of 'DiscoveryClientResult' class. -A 'DiscoveryClientResultCollection' object is obtained by reading a '.discomap' file -which contains the 'DiscoveryClientResult' objects, representing the details of -discovery references. A 'DiscoveryClientProtocol' object from the collection is -removed. Then a 'DiscoveryClientProtocol' is created suppling the type of reference -in the discovery document, URL for the reference and name of the file in which the -reference is saved.and programmatically added to it. The contents of this collection -are displayed. -*/ - -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Web::Services::Discovery; - -int main() -{ - try - { - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - - // Get the collection of DiscoveryClientResult objects. - DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = - myDiscoveryClientProtocol->ReadAll( "results.discomap" ); - Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count ); - Console::WriteLine( "Removing a DiscoveryClientResult " - "from the collection..." ); - - // Remove first DiscoveryClientResult from the collection. - myDiscoveryClientResultCollection->Remove( myDiscoveryClientResultCollection[ 0 ] ); - Console::WriteLine( "Adding a DiscoveryClientResult " - "to the collection..." ); - - // - // Initialize a new instance of the DiscoveryClientResult class. - DiscoveryClientResult^ myDiscoveryClientResult = - gcnew DiscoveryClientResult( System::Web::Services::Discovery::DiscoveryDocumentReference::typeid, - "http://localhost/Discovery/Service1_cs.asmx?disco","Service1_cs.disco" ); - - // Add the DiscoveryClientResult to the collection. - myDiscoveryClientResultCollection->Add( myDiscoveryClientResult ); - // - - Console::WriteLine( "Displaying the items in the collection" ); - for ( int i = 0; i < myDiscoveryClientResultCollection->Count; i++ ) - { - DiscoveryClientResult^ myClientResult = myDiscoveryClientResultCollection[ i ]; - Console::WriteLine( "DiscoveryClientResult Object {0}", (i + 1) ); - Console::WriteLine( "Type of reference in the discovery document: {0}", myClientResult->ReferenceTypeName ); - Console::WriteLine( "URL for reference: {0}", myClientResult->Url ); - Console::WriteLine( "File for saving the reference: {0}", myClientResult->Filename ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error is {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp deleted file mode 100644 index 331ee9af577..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp +++ /dev/null @@ -1,66 +0,0 @@ - - -// System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoveryClientResultsFile -// System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoveryClientResultsFile.ctor -// System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoveryClientResultsFile.Results -/* -The following example demonstrates the usage of 'DiscoveryClientProtocol. -DiscoveryClientResultsFile' class, constructor 'DiscoveryClientProtocol. -DiscoveryClientResultsFile()' and the property 'Results' of the class. -The input to the program is a VSDisco file 'MathService.vsdisco', which -holds reference to 'MathService' web service. The 'Results' property returns -all valid references of the discovery document 'MathService.vsdisco'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::Net; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -int main() -{ - String^ outputDirectory = "c:\\InetPub\\wwwroot"; - DiscoveryClientProtocol^ myClient = gcnew DiscoveryClientProtocol; - - // Use default credentials to access the URL being discovered. - myClient->Credentials = CredentialCache::DefaultCredentials; - try - { - DiscoveryDocument^ myDocument; - - // Discover the supplied URL to determine if it is a discovery document. - myDocument = myClient->Discover( "http://localhost/MathService_cs.vsdisco" ); - myClient->ResolveAll(); - DiscoveryClientResultCollection^ myCollection = myClient->WriteAll( outputDirectory, "MyDiscoMap.discomap" ); - - // - // - // Get the DiscoveryClientProtocol.DiscoveryClientResultsFile. - DiscoveryClientProtocol::DiscoveryClientResultsFile ^ myResultFile = gcnew DiscoveryClientProtocol::DiscoveryClientResultsFile; - XmlSerializer^ mySerializer = gcnew XmlSerializer( myResultFile->GetType() ); - XmlReader^ reader = gcnew XmlTextReader( "http://localhost/MyDiscoMap.discomap" ); - myResultFile = dynamic_cast(mySerializer->Deserialize( reader )); - - // Get a collection of DiscoveryClientResult objects. - DiscoveryClientResultCollection^ myResultcollection = myResultFile->Results; - Console::WriteLine( "Referred file(s): " ); - System::Collections::IEnumerator^ myEnum = myResultcollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DiscoveryClientResult^ myResult = safe_cast(myEnum->Current); - Console::WriteLine( myResult->Filename ); - } - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp deleted file mode 100644 index 8106396f6fa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - -// System::Web::Services::Discovery.DiscoveryDocument -// System::Web::Services::Discovery.DiscoveryDocument::Write(TextWriter) -/* The following example deomonstrates DiscoveryDocument class and the 'Write(Stream)' method -of the 'DiscoveryDocument' class. -A XmlTextReader Object* is created with a sample discovery file and this -is passed to the Read method to create a DiscoveryDocument. The contents -of this document is displayed onto the console using the Write(TextWriter) -method. -*/ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Collections; -int main() -{ - try - { - - // Create an Object* of the 'DiscoveryDocument'. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - - // Create an XmlTextReader with the sample file. - XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/example_cs.disco" ); - - // Read the given XmlTextReader. - myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); - - // - // Write the DiscoveryDocument into the 'TextWriter'. - FileStream^ myFileStream = gcnew FileStream( "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myDiscoveryDocument->Write( myStreamWriter ); - myStreamWriter->Flush(); - myStreamWriter->Close(); - - // - // Display the contents of the DiscoveryDocument onto the console. - FileStream^ myFileStream1 = gcnew FileStream( "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); - StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); - - // Set the file pointer to the begin. - myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); - Console::WriteLine( "The contents of the DiscoveryDocument are-" ); - while ( myStreamReader->Peek() > -1 ) - { - Console::WriteLine( myStreamReader->ReadLine() ); - } - myStreamReader->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp deleted file mode 100644 index 8643d966691..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// System::Web::Services::Discovery.DiscoveryDocumentReference::ReadDocument(stream) -/* -This program demonstrates the 'ReadDocument(stream)' of 'DiscoveryDocumentReference' -class. Read the contents of the discovery document from the stream and returns -discovery document reference. The references of the 'DiscoveryDocumentReference' -are printed. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::IO; -using namespace System::Collections; -int main() -{ - try - { - // - String^ myUrl = "http://localhost/Sample_cs.vsdisco"; - DiscoveryClientProtocol^ myProtocol = gcnew DiscoveryClientProtocol; - DiscoveryDocumentReference^ myReference = gcnew DiscoveryDocumentReference( myUrl ); - Stream^ myFileStream = myProtocol->Download( myUrl ); - DiscoveryDocument^ myDiscoveryDocument = dynamic_cast(myReference->ReadDocument( myFileStream )); - // - - IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); - Console::WriteLine( "\nThe references to the discovery document are : \n" ); - while ( myEnumerator->MoveNext() ) - { - DiscoveryDocumentReference^ myNewReference = dynamic_cast(myEnumerator->Current); - - // Print the discovery document references on the console. - Console::WriteLine( myNewReference->Url ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp deleted file mode 100644 index 25a62274838..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// System::Web::Services::Discovery.DiscoveryDocumentReference::DiscoveryDocumentReference(String*) -// System::Web::Services::Discovery.DiscoveryDocumentReference::Ref -// System::Web::Services::Discovery.DiscoveryDocumentReference::Url -// System::Web::Services::Discovery.DiscoveryDocumentReference::DefaultFileName -/* -This program demonstrates the 'DiscoveryDocumentReference(String*)' Constructor, 'Ref', -'Url', and 'DefaultFileName' properties of the 'DiscoveryDocumentReference' class. -It creates an instance of 'DiscoveryDocumentReference' and displays the 'Ref', 'Url' and -'DefaultFilename' properties. -*/ -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Discovery; - -int main() -{ - try - { - -// - DiscoveryDocumentReference^ myDiscoveryDocumentReference = - gcnew DiscoveryDocumentReference( - "http://localhost/Sample_cpp.disco" ); -// - - Console::WriteLine( "The reference to the discovery document is:" ); - -// - // Display the discovery document reference. - Console::WriteLine( myDiscoveryDocumentReference->Ref ); -// - Console::WriteLine(); - Console::WriteLine( - "The URL of the referenced discovery document is:" ); - -// - // Display the URL of the referenced discovery document. - Console::WriteLine( myDiscoveryDocumentReference->Url ); -// - Console::WriteLine(); - Console::WriteLine( "The name of the default disco file is:" ); - -// - // Display the name of the default file used for reference. - Console::WriteLine( - myDiscoveryDocumentReference->DefaultFilename ); -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp deleted file mode 100644 index 36a4b5400c3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// System::Web::Services::Discovery.DiscoveryDocumentReference -// System::Web::Services::Discovery.DiscoveryDocumentReference::DiscoveryDocumentReference() -// System::Web::Services::Discovery.DiscoveryDocumentReference::WriteDocument(Object*, Stream) -/* -This program demonstrates the 'DiscoveryDocumentReference' class, default constructor and -'WriteDocument(Object*, Stream)' method of the 'DiscoveryDocumentReference' class. -Discovery file is read by using 'DiscoveryDocument' instance. Write this discovery -document into a file stream and print its contents on the console. -*/ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Discovery; -using namespace System::IO; -using namespace System::Collections; -int main() -{ - try - { - DiscoveryDocument^ myDiscoveryDocument; - XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/Sample_cs::vsdisco" ); - myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); - - // - // Create a new instance of DiscoveryDocumentReference. - DiscoveryDocumentReference^ myDiscoveryDocumentReference = gcnew DiscoveryDocumentReference; - - // - // - FileStream^ myFileStream = gcnew FileStream( "Temp::vsdisco",FileMode::OpenOrCreate,FileAccess::Write ); - myDiscoveryDocumentReference->WriteDocument( myDiscoveryDocument, myFileStream ); - myFileStream->Close(); - - // - FileStream^ myFileStream1 = gcnew FileStream( "Temp::vsdisco",FileMode::OpenOrCreate,FileAccess::Read ); - StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); - - // Initialize the file pointer. - myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); - Console::WriteLine( "The contents of the discovery document are: \n" ); - while ( myStreamReader->Peek() > -1 ) - { - - // Display the contents of the discovery document. - Console::WriteLine( myStreamReader->ReadLine() ); - } - myStreamReader->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp deleted file mode 100644 index c21d85aea5b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -// System::Web::Services::Discovery.DiscoveryDocument::DiscoveryDocument -// System::Web::Services::Discovery.DiscoveryDocument::Namespace -// System::Web::Services::Discovery.DiscoveryDocument::CanRead -// System::Web::Services::Discovery.DiscoveryDocument::Read(XmlReader) -// System::Web::Services::Discovery.DiscoveryDocument::References -/* The following example deomonstrates the 'DiscoveryDocument' constructor, -'Namespace' field, 'References' property and the 'CanRead' and 'Read(XmlReader)' -methods of the 'DiscoveryDocument' class. -The namespace field is displayed onto the console. A XmlTextReader Object* is -created with a sample discovery file and this is passed to the CanRead method -to check whether it is readable. Then we read this file to create a Discovery -document and display the references in the created document. -*/ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Collections; -int main() -{ - try - { - - // Create an Object* of the 'DiscoveryDocument'. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - - // - // Display the 'Namespace' field. - Console::WriteLine( "The namespace is : {0}", DiscoveryDocument::Namespace ); - - // - // Create an XmlTextReader with the sample file. - XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/example.vsdisco" ); - - // - // - // Check whether the given XmlTextReader is readable. - if ( DiscoveryDocument::CanRead( myXmlTextReader ) ) - - // Read the given XmlTextReader. - myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); - else - Console::WriteLine( "The supplied file is not readable" ); - - // - // - // - // Enumerate the 'References' in the DiscoveryDocument. - IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); - Console::WriteLine( "The 'References' in the discovery document are-" ); - while ( myEnumerator->MoveNext() ) - Console::Write( (dynamic_cast(myEnumerator->Current)->Url) ); - - // - Console::WriteLine(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp deleted file mode 100644 index 4354c6bd9c1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// System::Web::Services::Discovery.DiscoveryDocument::Write(Stream) - -/* The following example deomonstrates the 'Write(Stream)' method -of the 'DiscoveryDocument' class. -A XmlTextReader Object* is created with a sample discovery file and this is -passed to the Read method to create a DiscoveryDocument. The contents of this -document are displayed onto the console using the Write(Stream) method. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Collections; - -int main() -{ - try - { - // - // Create an object of the 'DiscoveryDocument'. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - - // Create an XmlTextReader with the sample file. - XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( - "http://localhost/example_Write1_cs.disco" ); - - // Read the given XmlTextReader. - myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); - - // Write the DiscoveryDocument into the stream. - FileStream^ myFileStream = gcnew FileStream( - "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); - myDiscoveryDocument->Write( myFileStream ); - - myFileStream->Flush(); - myFileStream->Close(); - - // Display the contents of the DiscoveryDocument onto the console. - FileStream^ myFileStream1 = gcnew FileStream( - "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); - StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); - - // Set the file pointer to the begin. - myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); - Console::WriteLine( "The contents of the DiscoveryDocument are-" ); - while ( myStreamReader->Peek() > -1 ) - { - Console::WriteLine( myStreamReader->ReadLine() ); - } - myStreamReader->Close(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp deleted file mode 100644 index 7eb75ffdfb5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// System::Web::Services::Discovery.DiscoveryDocument::Write(XmlTextWriter) - -/* The following example deomonstrates the 'Write(XmlTextWriter)' method -of the 'DiscoveryDocument' class. -A XmlTextReader Object* is created with a sample discovery file and this is -passed to the Read method to create a DiscoveryDocument. The contents of this -document are displayed onto the console using the Write(XmlTextWriter) method. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Collections; - -int main() -{ - try - { -// - // Create a DiscoveryDocument. - DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; - - // Create an XmlTextReader with the sample file. - XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( - "http://localhost/example_Write2_cs.disco" ); - - // Read the given XmlTextReader. - myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); - - FileStream^ myFileStream = gcnew FileStream( - "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - - XmlTextWriter^ myXmlTextWriter = gcnew XmlTextWriter( myStreamWriter ); - myDiscoveryDocument->Write( myXmlTextWriter ); - - myXmlTextWriter->Flush(); - myXmlTextWriter->Close(); - - // Display the contents of the DiscoveryDocument on the console. - FileStream^ myFileStream1 = gcnew FileStream( - "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); - StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); - - // Set the file pointer to the beginning. - myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); - Console::WriteLine( "The contents of the DiscoveryDocument are: " ); - while ( myStreamReader->Peek() > -1 ) - { - Console::WriteLine( myStreamReader->ReadLine() ); - } - myStreamReader->Close(); -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp deleted file mode 100644 index b231f74defd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp +++ /dev/null @@ -1,115 +0,0 @@ -// System.Web.Services.Discovery.DiscoveryExceptionDictionary -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Contains -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Item -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Remove -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.DiscoveryExceptionDictionary -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Add -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Keys -// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Values - -/* -The following example demonstrates the usage of the -'DiscoveryExceptionDictionary' class, the constructor -'DiscoveryExceptionDictionary()', the properties 'Item', 'Keys', -'Values' and the methods 'Contains', 'Add' and 'Remove' of the class. -The input to the program is a discovery file 'MathService_cs.disco' -which holds reference related to 'MathService_cs.asmx' web service. -The program is executed first with the file 'MathService_cs.asmx' in -the location as specified in the discovery file. The file -'MathService_cs.asmx' is removed from the referred location in a way to -simulate a scenario wherein the file related to web service is missing, -and the program is excecuted second time to show the exception occuring. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Discovery; -using namespace System::Xml; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Net; - -int main() -{ - String^ myDiscoFile = "http://localhost/MathService_cs.disco"; - String^ myUrlKey = "http://localhost/MathService_cs.asmx?wsdl"; - DiscoveryClientProtocol^ myDiscoveryClientProtocol1 = gcnew DiscoveryClientProtocol; - DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol1->Discover( myDiscoFile ); - IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - { - ContractReference^ myContractReference = dynamic_cast(myEnumerator->Current); - DiscoveryClientProtocol^ myDiscoveryClientProtocol2 = myContractReference->ClientProtocol; - myDiscoveryClientProtocol2->ResolveAll(); - - // - DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol2->Errors; - if ( myExceptionDictionary->Contains( myUrlKey )) - { - Console::WriteLine( "'myExceptionDictionary' contains a discovery exception for the key '{0}'", myUrlKey ); - } - else - { - Console::WriteLine( "'myExceptionDictionary' does not contain a discovery exception for the key '{0}'", myUrlKey ); - } - // - if ( myExceptionDictionary->Contains( myUrlKey ) ) - { - Console::WriteLine( "System generated exceptions." ); - - // - Exception^ myException = myExceptionDictionary[ myUrlKey ]; - Console::WriteLine( " Source : {0}", myException->Source ); - Console::WriteLine( " Exception : {0}", myException->Message ); - // - - Console::WriteLine(); - - // - // Remove the discovery exception.for the key 'myUrlKey'. - myExceptionDictionary->Remove( myUrlKey ); - // - - // - // - DiscoveryExceptionDictionary^ myNewExceptionDictionary = gcnew DiscoveryExceptionDictionary; - - // Add an exception with the custom error message. - Exception^ myNewException = gcnew Exception( "The requested service is not available." ); - myNewExceptionDictionary->Add( myUrlKey, myNewException ); - myExceptionDictionary = myNewExceptionDictionary; - // - // - - Console::WriteLine( "Added exceptions." ); - - // - array^myArray = gcnew array(myExceptionDictionary->Count); - myExceptionDictionary->Keys->CopyTo( (Array^)myArray, 0 ); - Console::WriteLine( " Keys are :" ); - - for each(Object^ myObj in myArray) - { - Console::WriteLine(" " + myObj->ToString()); - } - // - - Console::WriteLine(); - - // - array^myCollectionArray = gcnew array(myExceptionDictionary->Count); - myExceptionDictionary->Values->CopyTo( (Array^)myCollectionArray, 0 ); - Console::WriteLine( " Values are :" ); - for each(Object^ myObj in myCollectionArray) - { - Console::WriteLine(" " + myObj->ToString()); - } - // - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp deleted file mode 100644 index f9a87f28eac..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// System::Web::Services::Discovery.DiscoveryReference::ClientProtocol -// System::Web::Services::Discovery.DiscoveryReference::DefaultFilename -// System::Web::Services::Discovery.DiscoveryReference::WriteDocument(Object*, Stream) -// System::Web::Services::Discovery.DiscoveryReference::ReadDocument(Stream) -// System::Web::Services::Discovery.DiscoveryReference::Url -// System::Web::Services::Discovery.DiscoveryReference::Resolve() -// This program demonstrates 'ClientProtocol', 'WriteDocumant', 'Url' properties -// and 'DefaultFilename', 'readDocument', 'Resolve' methods of 'DiscoveryReference' -// class. DiscoveryReference class is derived in 'MyDiscoveryReferenceClass'. A -// variable of type 'MyDiscoveryReferenceClass' class is taken to demonstrate these -// members. -// Note : The dataservice.disco file should be copied to Inetpub\wwwroot -// - -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Net; - -// Class derived from DiscoveryReference class and overriding its members. -ref class MyDiscoveryReferenceClass: public DiscoveryReference -{ -private: - String^ myDocumentUrl; - -public: - property String^ DefaultFilename - { - virtual String^ get() override - { - return "dataservice.disco"; - } - } - - virtual Object^ ReadDocument( Stream^ stream ) override - { - return stream; - } - - void Resolve() - { - try - { - DiscoveryDocument^ myDiscoveryRefDocument; - myDiscoveryRefDocument = __super::ClientProtocol->Discover( Url ); - } - catch ( Exception^ e ) - { - throw e; - } - } - -protected: - virtual void Resolve( String^ contentType, Stream^ stream ) override {} - -public: - - property String^ Url - { - virtual String^ get() override - { - return myDocumentUrl; - } - - virtual void set( String^ value ) override - { - myDocumentUrl = value; - } - } - virtual void WriteDocument( Object^ document, System::IO::Stream^ stream ) override - { - DiscoveryDocument^ myDiscoveryDocument = dynamic_cast(document); - myDiscoveryDocument->Write( stream ); - } -}; - -int main() -{ - DiscoveryDocument^ myDiscoveryDocument; - StreamReader^ myStreamReader = gcnew StreamReader( "c:\\Inetpub\\wwwroot\\dataservice.disco" ); - FileStream^ myStream = gcnew FileStream( "C:\\MyDiscovery.disco",FileMode::OpenOrCreate ); - Console::WriteLine( "Demonstrating Discovery Reference class." ); - - // Read discovery file. - myDiscoveryDocument = DiscoveryDocument::Read( myStreamReader ); - - // Variable of type DiscoveryReference class defined. - MyDiscoveryReferenceClass^ myDiscoveryReference; - myDiscoveryReference = gcnew MyDiscoveryReferenceClass; - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // Set client protocol. - myDiscoveryReference->ClientProtocol = myDiscoveryClientProtocol; - - // Read the default file name. - Console::WriteLine( "Default file name is: {0}", myDiscoveryReference->DefaultFilename ); - - // Write the document. - myDiscoveryReference->WriteDocument( myDiscoveryDocument, myStream ); - - // Read the document. - myDiscoveryReference->ReadDocument( myStream ); - - // Set the URL. - myDiscoveryReference->Url = "http://localhost/dataservice.disco"; - Console::WriteLine( "Url is: {0}", myDiscoveryReference->Url ); - - // Resolve the URL. - myDiscoveryReference->Resolve(); - myStreamReader->Close(); - myStream->Close(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp deleted file mode 100644 index 2476f726e96..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// System.Web.Services.Discovery.DiscoveryReference - -/* -This program demonstrates 'DiscoveryReference' class. -DiscoveryReference class is derived in 'MyDiscoveryReferenceClass'. A -variable of type 'MyDiscoveryReferenceClass' class is taken to demonstrate -members of 'MyDiscoveryReferenceClass'. -Note : The dataservice.disco file should be copied to c:\Inetpub\wwwroot -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Discovery; -using namespace System::Net; - -// Class derived from DiscoveryReference class and overriding it members. -ref class MyDiscoveryReferenceClass: public DiscoveryReference -{ -private: - String^ myDocumentUrl; - -public: - property String^ DefaultFilename - { - virtual String^ get() override - { - return "dataservice.disco"; - } - } - - virtual Object^ ReadDocument( Stream^ stream ) override - { - return stream; - } - - void Resolve() - { - try - { - DiscoveryDocument^ myDiscoveryRefDocument; - myDiscoveryRefDocument = DiscoveryReference::ClientProtocol->Discover( Url ); - } - catch ( Exception^ e ) - { - throw e; - } - } - -protected: - virtual void Resolve( String^ /*contentType*/, Stream^ /*stream*/ ) override {} - -public: - property String^ Url - { - virtual String^ get() override - { - return myDocumentUrl; - } - - virtual void set( String^ value ) override - { - myDocumentUrl = value; - } - } - - virtual void WriteDocument( Object^ document, System::IO::Stream^ stream ) override - { - DiscoveryDocument^ myDiscoveryDocument = dynamic_cast(document); - myDiscoveryDocument->Write( stream ); - } -}; - -int main() -{ - try - { - DiscoveryDocument^ myDiscoveryDocument; - StreamReader^ myStreamReader = gcnew StreamReader( "c:\\Inetpub\\wwwroot\\dataservice.disco" ); - FileStream^ myStream = gcnew FileStream( "c:\\MyDiscovery.disco",FileMode::OpenOrCreate ); - Console::WriteLine( "Demonstrating DiscoveryReference class." ); - - // Read discovery file. - myDiscoveryDocument = DiscoveryDocument::Read( myStreamReader ); - - // Create a new instance of the DiscoveryReference class. - MyDiscoveryReferenceClass^ myDiscoveryReference; - myDiscoveryReference = gcnew MyDiscoveryReferenceClass; - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // Set the client protocol. - myDiscoveryReference->ClientProtocol = myDiscoveryClientProtocol; - - // Read the default file name. - Console::WriteLine( "Default file name is: {0}", myDiscoveryReference->DefaultFilename ); - - // Write the document. - myDiscoveryReference->WriteDocument( myDiscoveryDocument, myStream ); - - // Read the document. - myDiscoveryReference->ReadDocument( myStream ); - - // Set the URL. - myDiscoveryReference->Url = "http://localhost/dataservice.disco"; - Console::WriteLine( "Url is: {0}", myDiscoveryReference->Url ); - - // Resolve the URL. - myDiscoveryReference->Resolve(); - myStreamReader->Close(); - myStream->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught! - {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp deleted file mode 100644 index 75dcc210381..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Web::Services::Discovery.DiscoveryReferenceCollection::DiscoveryReferenceCollection -// System::Web::Services::Discovery.DiscoveryReferenceCollection->Add(DiscoveryReference) -// System::Web::Services::Discovery.DiscoveryReferenceCollection::Contains(DiscoveryReference) -// System::Web::Services::Discovery.DiscoveryReferenceCollection::Item(int) -// System::Web::Services::Discovery.DiscoveryReferenceCollection::Remove(DiscoveryReference) -// System::Web::Services::Discovery.DiscoveryReferenceCollection - -/* The following example demonstrates the usage of 'DiscoveryReferenceCollection' class, 'Add', 'Contains', -* 'Item'and 'Remove' methods and its constructor. A variable of 'DiscoveryReferenceCollection' -* class is taken. Two 'DiscoveryReference' type member is added to the collection. Using this -* various methods of 'DiscoveryReferenceCollection' class are demonstrated. -*/ - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Discovery; - -// -int main() -{ - DiscoveryDocumentReference^ myDiscoveryDocReference1 = gcnew DiscoveryDocumentReference; - DiscoveryDocumentReference^ myDiscoveryDocReference2 = gcnew DiscoveryDocumentReference; - DiscoveryReference^ myDiscoveryReference; - Console::WriteLine( "Demonstrating DiscoveryReferenceCollection class." ); - - // Create new DiscoveryReferenceCollection. - DiscoveryReferenceCollection^ myDiscoveryReferenceCollection = gcnew DiscoveryReferenceCollection; - - // Access the Count method. - Console::WriteLine( "The number of elements in the collection is: {0}", myDiscoveryReferenceCollection->Count ); - - // Add elements to the collection. - myDiscoveryReferenceCollection->Add( myDiscoveryDocReference1 ); - myDiscoveryReferenceCollection->Add( myDiscoveryDocReference2 ); - Console::WriteLine( "The number of elements in the collection after adding two elements to the collection: {0}", myDiscoveryReferenceCollection->Count ); - - // Call the Contains method. - if ( !myDiscoveryReferenceCollection->Contains( myDiscoveryDocReference1 ) ) - { - throw gcnew Exception( "Element not found in collection." ); - } - - // Access the indexed member. - myDiscoveryReference = dynamic_cast(myDiscoveryReferenceCollection[ 0 ]); - if ( myDiscoveryReference == nullptr ) - { - throw gcnew Exception( "Element not found in collection." ); - } - - // Remove one element from collection. - myDiscoveryReferenceCollection->Remove( myDiscoveryDocReference1 ); - Console::WriteLine( "The number of elements in the collection after removing one element is: {0}", myDiscoveryReferenceCollection->Count ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp deleted file mode 100644 index 36bc202ae4d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - -// System::Web::Services::Discovery.SoapBinding::SoapBinding -// System::Web::Services::Discovery.SoapBinding->Address -// System::Web::Services::Discovery.SoapBinding::Binding -// System::Web::Services::Discovery.SoapBinding::Namespace -// System::Web::Services::Discovery.SoapBinding -/* The following example demonstrates 'Discovery::SoapBinding' class, its -* constructor, 'Address', 'Binding' and 'Namespace' members. A variable -* of type 'SoapBinding' is created. The properties are set. -* Finally the created 'SoapBinding' is added to 'DiscoveryClientProtocol'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Xml; -using namespace System::Web::Services::Discovery; -int main() -{ - try - { - - // - // 'dataservice.disco' is a sample discovery document. - String^ myStringUrl = "http://localhost/dataservice.disco"; - - // Call the Discover method to populate the Documents property. - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); - Console::WriteLine( "Demonstrating the Discovery::SoapBinding class." ); - - // Create a SOAP binding. - SoapBinding^ mySoapBinding = gcnew SoapBinding; - - // Assign an address to the created SOAP binding. - mySoapBinding->Address = "http://schemas.xmlsoap.org/disco/scl/"; - - // Bind the created SOAP binding with a new XmlQualifiedName. - mySoapBinding->Binding = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); - - // Add the created SOAP binding to the DiscoveryClientProtocol. - myDiscoveryClientProtocol->AdditionalInformation->Add( mySoapBinding ); - - // Display the namespace associated with SOAP binding. - Console::WriteLine( "Namespace associated with the SOAP binding is: {0}", SoapBinding::Namespace ); - - // Write all the information of the DiscoveryClientProtocol. - myDiscoveryClientProtocol->WriteAll( ".", "results.discomap" ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp deleted file mode 100644 index cfe2812f5b9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/* -This program demonstrates the 'Constructor' of 'DnsPermission' class. -It creates an instance of 'DnsPermission' class and checks for permission.Then it -creates a 'SecurityElement' Object* and prints it's attributes which hold the XML -encoding of 'DnsPermission' instance . -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class DnsPermissionExample -{ - // -public: - void useDns() - { - // Create a DnsPermission instance. - DnsPermission^ permission = gcnew DnsPermission( PermissionState::Unrestricted ); - - // Check for permission. - permission->Demand(); - // Create a SecurityElement Object* to hold XML encoding of the DnsPermission instance. - SecurityElement^ securityElementObj = permission->ToXml(); - Console::WriteLine( "Tag, Attributes and Values of 'DnsPermission' instance :" ); - Console::WriteLine( "\n\tTag : {0}", securityElementObj->Tag ); - // Print the attributes and values. - PrintKeysAndValues( securityElementObj->Attributes ); - } - -private: - void PrintKeysAndValues( Hashtable^ myList ) - { - // Get the enumerator that can iterate through the hash table. - IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); - Console::WriteLine( "\n\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } - // -}; - -int main() -{ - try - { - DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; - dnsPermissionExampleObj->useDns(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp deleted file mode 100644 index 0e9c78efb39..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* -This program demonstrates the 'Copy' method of 'DnsPermission' class. -It creates an identical copy of 'DnsPermission' instance. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -class DnsPermissionExample -{ - // -public: - void UseDns() - { - // Create a DnsPermission instance. - DnsPermission^ myPermission = gcnew DnsPermission( PermissionState::Unrestricted ); - // Check for permission. - myPermission->Demand(); - // Create an identical copy of the above 'DnsPermission' Object*. - DnsPermission^ myPermissionCopy = dynamic_cast(myPermission->Copy()); - Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); - // Print the attributes and values. - PrintKeysAndValues( myPermission->ToXml()->Attributes ); - Console::WriteLine( "Attribute and values of copied instance :" ); - PrintKeysAndValues( myPermissionCopy->ToXml()->Attributes ); - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable ) - { - // Get the enumerator that can iterate through the hash table. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } - // -}; - -int main() -{ - try - { - DnsPermissionExample * dnsPermissionExampleObj = new DnsPermissionExample; - dnsPermissionExampleObj->UseDns(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp deleted file mode 100644 index 3674b00df6c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* -This program demonstrates the 'FromXml' method of 'DnsPermission' class. -It creates an instance of 'DnsPermission' class and prints the XML encoding of that instance.Then it -creates a 'SecurityElement' Object* and adds the attributes corresponding to the above 'DnsPermission' -Object*. A new 'DnsPermission' instance is reconstructed from the 'SecurityElement' instance by calling -'FromXml' method and it's XML encoding is printed. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class DnsPermissionExample -{ - // -public: - void ConstructDnsPermission() - { - try - { - // Create a DnsPermission instance. - DnsPermission^ permission = gcnew DnsPermission( PermissionState::None ); - // Create a SecurityElement instance by calling the ToXml method on the - // DnsPermission instance. - // Print its attributes, which hold the XML encoding of the DnsPermission - // instance. - Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); - PrintKeysAndValues( permission->ToXml()->Attributes ); - - // Create a SecurityElement instance. - SecurityElement^ securityElementObj = gcnew SecurityElement( "IPermission" ); - // Add attributes and values of the SecurityElement instance corresponding to - // the permission instance. - securityElementObj->AddAttribute( "version", "1" ); - securityElementObj->AddAttribute( "Unrestricted", "true" ); - securityElementObj->AddAttribute( "class", "System.Net.DnsPermission" ); - - // Reconstruct a DnsPermission instance from an XML encoding. - DnsPermission^ permission1 = gcnew DnsPermission( PermissionState::None ); - permission1->FromXml( securityElementObj ); - - // Print the attributes and values of the constructed DnsPermission Object*. - Console::WriteLine( "After reconstruction Attributes and Values of new DnsPermission instance :" ); - PrintKeysAndValues( permission1->ToXml()->Attributes ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "NullReferenceException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - } - -private: - void PrintKeysAndValues( Hashtable^ myList ) - { - // Get the enumerator that can iterate through the hash table. - IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } - // -}; - -int main() -{ - DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; - dnsPermissionExampleObj->ConstructDnsPermission(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp deleted file mode 100644 index 929717f0e2e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -This program demonstrates the 'IsSubsetOf' method of 'DnsPermission' class. -'IsSubsetOf' method returns true, if the current DnsPermission instance allows no -more access to DNS servers than does the specified 'DnsPermission' instance. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class DnsPermissionExample -{ -private: - DnsPermission^ permission; - - // -public: - void useDns() - { - // Create a DnsPermission instance. - permission = gcnew DnsPermission( PermissionState::Unrestricted ); - DnsPermission^ dnsPermission1 = gcnew DnsPermission( PermissionState::None ); - // Check for permission. - permission->Demand(); - dnsPermission1->Demand(); - // Print the attributes and values. - Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); - PrintKeysAndValues( permission->ToXml()->Attributes ); - Console::WriteLine( "Attributes and Values of specified 'DnsPermission' instance :" ); - PrintKeysAndValues( dnsPermission1->ToXml()->Attributes ); - Subset( dnsPermission1 ); - } - -private: - void Subset( DnsPermission^ Permission1 ) - { - if ( permission->IsSubsetOf( Permission1 ) ) - { - Console::WriteLine( "Current 'DnsPermission' instance is a subset of specified 'DnsPermission' instance." ); - } - else - { - Console::WriteLine( "Current 'DnsPermission' instance is not a subset of specified 'DnsPermission' instance." ); - } - } - - void PrintKeysAndValues( Hashtable^ myList ) - { - // Get the enumerator that can iterate through the hash table. - IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } - // -}; - -int main() -{ - try - { - DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; - dnsPermissionExampleObj->useDns(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp deleted file mode 100644 index 0c760523b02..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* -This program demonstrates the 'IsUnrestricted' method of 'DnsPermission' class. -It checks the overall permission state of the Object* and it will return true if the -'DnsPermission' instance was created with unrestricted permission state otherwise false. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class DnsPermissionExample -{ - // -public: - void useDns() - { - // Create a DnsPermission instance. - DnsPermission^ permission = gcnew DnsPermission( PermissionState::Unrestricted ); - // Check for permission. - permission->Demand(); - Console::WriteLine( "Attributes and Values of DnsPermission instance :" ); - // Print the attributes and values. - PrintKeysAndValues( permission->ToXml()->Attributes ); - // Check the permission state. - if ( permission->IsUnrestricted() ) - { - Console::WriteLine( "Overall permissions : Unrestricted" ); - } - else - { - Console::WriteLine( "Overall permissions : Restricted" ); - } - } - -private: - void PrintKeysAndValues( Hashtable^ myList ) - { - // Get the enumerator that can iterate through the hash table. - IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } - // -}; - -int main() -{ - try - { - DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; - dnsPermissionExampleObj->useDns(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp deleted file mode 100644 index d3f14c02e89..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -This program demonstrates 'BeginResolve' and 'EndResolve' methods of Dns class. -It obtains the 'IPHostEntry' Object* by calling 'BeginResolve' and 'EndResolve' method -of 'Dns' class by passing a URL, a callback function and an instance of 'RequestState' -class.Then prints host name, IP address list and aliases. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Threading; - -// -// -public ref class DnsBeginGetHostByName -{ -public: - static System::Threading::ManualResetEvent^ allDone = nullptr; - ref class RequestState - { - public: - IPHostEntry^ host; - RequestState() - { - host = nullptr; - } - }; - - static void RespCallback( IAsyncResult^ ar ) - { - try - { - // Convert the IAsyncResult* Object* to a RequestState Object*. - RequestState^ tempRequestState = dynamic_cast(ar->AsyncState); - - // End the asynchronous request. - tempRequestState->host = Dns::EndResolve( ar ); - allDone->Set(); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - } -}; - -int main() -{ - DnsBeginGetHostByName::allDone = gcnew ManualResetEvent( false ); - - // Create an instance of the RequestState class. - DnsBeginGetHostByName::RequestState^ myRequestState = - gcnew DnsBeginGetHostByName::RequestState; - - // Begin an asynchronous request for information like host name, IP addresses, or - // aliases for specified the specified URI. - IAsyncResult^ asyncResult = Dns::BeginResolve( "www.contoso.com", - gcnew AsyncCallback( DnsBeginGetHostByName::RespCallback ), myRequestState ); - - // Wait until asynchronous call completes. - DnsBeginGetHostByName::allDone->WaitOne(); - Console::WriteLine( "Host name : {0}", myRequestState->host->HostName ); - Console::WriteLine( "\nIP address list : " ); - for ( int index = 0; index < myRequestState->host->AddressList->Length; index++ ) - Console::WriteLine( myRequestState->host->AddressList[ index ] ); - Console::WriteLine( "\nAliases : " ); - for ( int index = 0; index < myRequestState->host->Aliases->Length; index++ ) - Console::WriteLine( myRequestState->host->Aliases[ index ] ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp deleted file mode 100644 index 500d528483d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* -This program demonstrates 'GetHostByAddress(IPAddress)' method of 'Dns' class. -It takes an IP address String* from commandline or uses default value and creates -an instance of IPAddress for the specified IP address String*. Obtains the IPHostEntry -Object* by calling 'GetHostByAddress' method of 'Dns' class and prints host name, -IP address list and aliases. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -class DnsHostByAddress -{ -public: - void DisplayHostAddress( String^ IpAddressString ) - { - // Call 'GetHostByAddress(IPAddress)' method giving an 'IPAddress' Object* as argument. - // Obtain an 'IPHostEntry' instance, containing address information of the specified host. - // - try - { - IPAddress^ hostIPAddress = IPAddress::Parse( IpAddressString ); - IPHostEntry^ hostInfo = Dns::GetHostByAddress( hostIPAddress ); - - // Get the IP address list that resolves to the host names contained in - // the Alias property. - array^address = hostInfo->AddressList; - - // Get the alias names of the addresses in the IP address list. - array^alias = hostInfo->Aliases; - Console::WriteLine( "Host name : {0}", hostInfo->HostName ); - Console::WriteLine( "\nAliases :" ); - for ( int index = 0; index < alias->Length; index++ ) - Console::WriteLine( alias[ index ] ); - Console::WriteLine( "\nIP address list : " ); - for ( int index = 0; index < address->Length; index++ ) - Console::WriteLine( address[ index ] ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( FormatException^ e ) - { - Console::WriteLine( "FormatException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - // - } -}; - -int main() -{ - String^ IpAddressString = ""; - DnsHostByAddress * myDnsHostByAddress = new DnsHostByAddress; - Console::Write( "Type an IP address (press Enter for default, default is '207.46.131.199'): " ); - IpAddressString = Console::ReadLine(); - if ( IpAddressString->Length > 0 ) - myDnsHostByAddress->DisplayHostAddress( IpAddressString ); - else - myDnsHostByAddress->DisplayHostAddress( "207.46.131.199" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp deleted file mode 100644 index a65db62149f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* -This program demonstrates 'GetHostByName' method of 'Dns' class. -It takes a URL String* from commandline or uses default value, and obtains -the 'IPHostEntry' Object* by calling 'GetHostByName' method of 'Dns' class.Then -prints host name, IP address list and aliases. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -public ref class DnsHostByName -{ -public: - void DisplayHostName( String^ hostName ) - { - // Call the GetHostByName method passing a DNS style host name(for example, - // S"www.contoso.com") as an argument. - // Obtain the IPHostEntry instance, that contains information of the specified host. - // - try - { - IPHostEntry^ hostInfo = Dns::GetHostByName( hostName ); - - // Get the IP address list that resolves to the host names contained in the - // Alias property. - array^address = hostInfo->AddressList; - - // Get the alias names of the addresses in the IP address list. - array^alias = hostInfo->Aliases; - Console::WriteLine( "Host name : {0}", hostInfo->HostName ); - Console::WriteLine( "\nAliases : " ); - for ( int index = 0; index < alias->Length; index++ ) - Console::WriteLine( alias[ index ] ); - Console::WriteLine( "\nIP address list : " ); - for ( int index = 0; index < address->Length; index++ ) - Console::WriteLine( address[ index ] ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - // - } -}; - -int main() -{ - String^ hostName = ""; - DnsHostByName^ myDnsHostByName = gcnew DnsHostByName; - Console::Write( "Type a URL (press Enter for default, default is 'www.microsoft.net') : " ); - hostName = Console::ReadLine(); - if ( hostName->Length > 0 ) - myDnsHostByName->DisplayHostName( hostName ); - else - myDnsHostByName->DisplayHostName( "www.microsoft.net" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp deleted file mode 100644 index 975e9204362..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/* -This program demonstrates the 'GetHostName' method of 'Dns' class. -It creates a 'DnsHostName' instance and calls 'GetHostName' method to get the local host -computer name. Then prints the computer name on the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -public ref class DnsHostName -{ - // -public: - void DisplayLocalHostName() - { - try - { - // Get the local computer host name. - String^ hostName = Dns::GetHostName(); - Console::WriteLine( "Computer name : {0}", hostName ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - } - // -}; - -int main() -{ - DnsHostName^ dnsHostNameObj = gcnew DnsHostName; - dnsHostNameObj->DisplayLocalHostName(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp deleted file mode 100644 index f280df48999..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/* -This program demonstrates 'Resolve' method of 'Dns' class. -It takes a URL or IP address String* from commandline or uses default value and obtains the 'IPHostEntry' -Object* by calling 'Resolve' method of 'Dns' class. Then prints host name, IP address list and aliases. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -class DnsResolve -{ -public: - void DisplayHostAddress( String^ hostString ) - { - // Call the Resolve method passing a DNS style host name or an IP address in dotted-quad notation - // (for example, S"www.contoso.com" or S"207.46.131.199") to obtain an IPHostEntry instance that contains - // address information for the specified host. - // - try - { - IPHostEntry^ hostInfo = Dns::Resolve( hostString ); - - // Get the IP address list that resolves to the host names contained in the - // Alias property. - array^address = hostInfo->AddressList; - - // Get the alias names of the addresses in the IP address list. - array^alias = hostInfo->Aliases; - Console::WriteLine( "Host name : {0}", hostInfo->HostName ); - Console::WriteLine( "\nAliases : " ); - for ( int index = 0; index < alias->Length; index++ ) - { - Console::WriteLine( alias[ index ] ); - - } - Console::WriteLine( "\nIP Address list :" ); - for ( int index = 0; index < address->Length; index++ ) - { - Console::WriteLine( address[ index ] ); - - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "NullReferenceException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - // - } -}; - -int main() -{ - String^ hostString = ""; - DnsResolve * myDnsResolve = new DnsResolve; - Console::Write( "Type a URL or IP address (press Enter for default, default is '207.46.131.199') : " ); - hostString = Console::ReadLine(); - if ( hostString->Length > 0 ) - myDnsResolve->DisplayHostAddress( hostString ); - else - myDnsResolve->DisplayHostAddress( "207.46.131.199" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp b/snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp deleted file mode 100644 index 16ae3564724..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -// System::Web::Services::Description.DocumentableItem::Documentation; -/* -The following program demonstrates the property 'Documentation' of abstract class 'DocumentableItem' -The program reads a wsdl document S"MathService::wsdl" and instantiates a ServiceDescription instance -from the WSDL document. -This program demonstrates a generic utility function which can accept any of Types, PortType and Binding -classes as parameters. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; -using namespace System::Collections; - -// Prints documentation associated with a wsdl element. -void PrintDocumentation( DocumentableItem^ myItem ) -{ - Console::WriteLine( "\t {0}", myItem->Documentation ); -} - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_cpp.wsdl" ); - Console::WriteLine( "Documentation Element for type is " ); - PrintDocumentation( myServiceDescription->Types ); - IEnumerator^ myEnum = myServiceDescription->PortTypes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - PortType^ myPortType = safe_cast(myEnum->Current); - Console::WriteLine( "Documentation Element for Port Type {0} is ", myPortType->Name ); - PrintDocumentation( myPortType ); - } - - myEnum = myServiceDescription->Bindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Binding^ myBinding = safe_cast(myEnum->Current); - Console::WriteLine( "Documentation Element for Port Type {0} is ", myBinding->Name ); - PrintDocumentation( myBinding ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp deleted file mode 100644 index dce62908316..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#using - -using namespace System; -using namespace System::EnterpriseServices; - -[STAThread] -int main() -{ - // - try - { - // - String^ applicationName = "Queued Component"; - String^ typeLibraryName = nullptr; - RegistrationHelper^ helper = gcnew RegistrationHelper; - // Call the InstallAssembly method passing it the name of the assembly to - // install as a COM+ application, the COM+ application name, and - // the name of the type library file. - // Setting the application name and the type library to NULL (nothing in Visual Basic .NET - // allows you to use the COM+ application name that is given in the assembly and - // the default type library name. The application name in the assembly metadata - // takes precedence over the application name you provide to InstallAssembly. - helper->InstallAssembly( "C:..\\..\\QueuedComponent.dll", applicationName, typeLibraryName, InstallationFlags::CreateTargetApplication ); - Console::WriteLine( "Registration succeeded: Type library {0} created.", typeLibraryName ); - Console::Read(); - // - - // - // Create a RegistrationConfig object and set its attributes - // Create a RegistrationHelper object, and call the InstallAssemblyFromConfig - // method by passing the RegistrationConfiguration object to it as a - // reference object - RegistrationConfig^ registrationConfiguration = gcnew RegistrationConfig; - registrationConfiguration->AssemblyFile = "C:..\\..\\QueuedComponent.dll"; - registrationConfiguration->Application = "MyApp"; - registrationConfiguration->InstallationFlags = InstallationFlags::CreateTargetApplication; - RegistrationHelper^ helperFromConfig = gcnew RegistrationHelper; - helperFromConfig->InstallAssemblyFromConfig( registrationConfiguration ); - // - } - // - catch ( RegistrationException^ e ) - { - Console::WriteLine( e->Message ); - // - - // - // Check whether the ErrorInfo property of the RegistrationException object is null. - // If there is no extended error information about - // methods related to multiple COM+ objects ErrorInfo will be null. - if ( e->ErrorInfo != nullptr ) - { - // Gets an array of RegistrationErrorInfo objects describing registration errors - array^ registrationErrorInfos = e->ErrorInfo; - - // Iterate through the array of RegistrationErrorInfo objects and disply the - // ErrorString for each object. - System::Collections::IEnumerator^ myEnum = registrationErrorInfos->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - RegistrationErrorInfo^ registrationErrorInfo = (RegistrationErrorInfo^)( myEnum->Current ); - Console::WriteLine( registrationErrorInfo->ErrorString ); - } - } - // - Console::Read(); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp deleted file mode 100644 index 45c9a032b73..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Reflection; - -// -[Synchronization(SynchronizationOption::Required)] -public ref class ContextUtil_ActivityId: public ServicedComponent -{ -public: - void Example() - { - // Display the ActivityID associated with the current COM+ context. - Console::WriteLine( "Activity ID: {0}", ContextUtil::ActivityId ); - } -}; -// - -// -[Synchronization(SynchronizationOption::Required)] -public ref class ContextUtil_ApplicationInstanceId: public ServicedComponent -{ -public: - void Example() - { - // Display the ApplicationInstanceId associated with the current COM+ - // context. - Console::WriteLine( "Application Instance ID: {0}", - ContextUtil::ApplicationInstanceId ); - } -}; -// - -// -[Transaction(TransactionOption::Required)] -public ref class ContextUtil_DisableCommit: public ServicedComponent -{ -public: - void Example() - { - // Set both the consistent bit and the done bit to false for the - // current COM+ context. - ContextUtil::DisableCommit(); - } -}; -// - -// -[Transaction(TransactionOption::Required)] -public ref class ContextUtil_EnableCommit: public ServicedComponent -{ -public: - void Example() - { - // Set the consistent bit to true and the done bit to false for the - // current COM+ context. - ContextUtil::EnableCommit(); - } -}; -// - -// -[Transaction(TransactionOption::Required)] -public ref class ContextUtil_IsInTransaction: public ServicedComponent -{ -public: - void Example() - { - // Display whether the current COM+ context is enlisted in a - // transaction. - Console::WriteLine( "Current context enlisted in transaction: {0}", - ContextUtil::IsInTransaction ); - } -}; -// - -// -[SecurityRole("Role1")] -public ref class ContextUtil_IsSecurityEnabled: public ServicedComponent -{ -public: - void Example() - { - // Display whether role-based security is active for the current COM+ - // context. - Console::WriteLine( "Role-based security active in current context: {0}", - ContextUtil::IsSecurityEnabled ); - } -}; -// - -// -[Transaction(TransactionOption::Required)] -public ref class ContextUtil_TransactionId: public ServicedComponent -{ -public: - void Example() - { - // Display the ID of the transaction in which the current COM+ context - // is enlisted. - Console::WriteLine( "Transaction ID: {0}", ContextUtil::TransactionId ); - } -}; -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp deleted file mode 100644 index 2924b763b8b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Reflection; - -// References: -// System.EnterpriseServices -// -[InterfaceQueuing] -interface class IInterfaceQueuingAttribute_Ctor{}; -// - -// -[InterfaceQueuing(true)] -interface class IInterfaceQueuingAttribute_Ctor_Bool{}; -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp deleted file mode 100644 index 3fbda4b806e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using -using namespace System; -using namespace System::EnterpriseServices; - -// References: -// System.EnterpriseServices - -// -[ObjectPooling(true)] -public ref class ObjectPoolingAttributeCtorBool : public ServicedComponent -{ -}; -// - -// -[ObjectPooling(true, 1, 10)] -public ref class ObjectPoolingAttributeCtorBoolIntInt : - public ServicedComponent -{ -}; -// - -// -[ObjectPooling(1, 10)] -public ref class ObjectPoolingAttributeCtorIntInt : public ServicedComponent -{ -}; -// - -// -[ObjectPooling(false)] -public ref class ObjectPoolingAttributeEnabled : public ServicedComponent -{ -public: - void EnabledExample() - { - // Get the ObjectPoolingAttribute applied to the class. - ObjectPoolingAttribute^ attribute = - (ObjectPoolingAttribute^)Attribute::GetCustomAttribute( - this->GetType(), - ObjectPoolingAttribute::typeid, - false); - - // Display the current value of the attribute's Enabled property. - Console::WriteLine("ObjectPoolingAttribute.Enabled: {0}", - attribute->Enabled); - - // Set the Enabled property value of the attribute. - attribute->Enabled = true; - - // Display the new value of the attribute's Enabled property. - Console::WriteLine("ObjectPoolingAttribute.Enabled: {0}", - attribute->Enabled); - } -}; -// - -// - - -// Test client. -int main() -{ - // Create a new instance of each example class. - ObjectPoolingAttributeEnabled^ enabledExample = - gcnew ObjectPoolingAttributeEnabled(); - - // Demonstrate the ObjectPoolingAttribute properties. - enabledExample->EnabledExample(); -}; - diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp deleted file mode 100644 index 288dac0fdf8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -#using - -using namespace System; -using namespace System::EnterpriseServices; - -// References: -// System.EnterpriseServices - -// - -// Note: Access checks must be performed at the component level to allow access -// to private components. -[assembly: ApplicationAccessControl(false, -AccessChecksLevel=AccessChecksLevelOption::ApplicationComponent)]; - -[PrivateComponent] -public ref class PrivateComponentAttributeExample : public ServicedComponent -{ -public: - void DisplayMessage() - { - // Display some output. - Console::WriteLine("Private component called successfully."); - } -}; -// - -public ref class PrivateComponentAttributeTest : public ServicedComponent -{ -public: - static void Test() - { - // Create a new instance of the example class. - PrivateComponentAttributeExample^ example = - gcnew PrivateComponentAttributeExample(); - - // Call a method on the class. - example->DisplayMessage(); - } -}; - - -// - diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp deleted file mode 100644 index de1dd4ae5ab..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -#using - -using namespace System; -using namespace System::EnterpriseServices; - -// References: -// System.EnterpriseServices - -// An instance of this class will not join an activity, but can share its -// caller's context even if its caller is configured as NotSupported, -// Supported, Required, or RequiresNew. -[Synchronization(SynchronizationOption::Disabled)] -public ref class SynchronizationAttribute_SynchronizationDisabled : - public ServicedComponent -{ -}; - -// An instance of this class will not join an activity, and will share its -// caller's context only if its caller is also configured as NotSupported. -[Synchronization(SynchronizationOption::NotSupported)] -public ref class SynchronizationAttribute_SynchronizationNotSupported : - public ServicedComponent -{ -}; - -// An instance of this class will join its caller's activity if one exists. -[Synchronization(SynchronizationOption::Supported)] -public ref class SynchronizationAttribute_SynchronizationSupported : - public ServicedComponent -{ -}; - -// An instance of this class will join its caller's activity if one exists. -// If not, a new activity will be created for it. -[Synchronization(SynchronizationOption::Required)] -public ref class SynchronizationAttribute_SynchronizationRequired : - public ServicedComponent -{ -}; - -// A new activity will always be created for an instance of this class. -[Synchronization(SynchronizationOption::RequiresNew)] -public ref class SynchronizationAttribute_SynchronizationRequiresNew : - public ServicedComponent -{ -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp deleted file mode 100644 index 95137a20bbc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Reflection; - -// References: -// System.EnterpriseServices - -// An instance of this class will inherit its caller's transaction isolation -// level if available. If not, it will use isolation level Serializable. -[Transaction(Isolation=TransactionIsolationLevel::Any)] -public ref class IsolationAny : public ServicedComponent -{ -}; - -// An instance of this class will read only committed data, but non-repeatable -// reads and phantom rows are still possible. -[Transaction(Isolation=TransactionIsolationLevel::ReadCommitted)] -public ref class IsolationReadCommitted : public ServicedComponent -{ -}; - -// An instance of this class will read committed and uncommitted data, so dirty -// reads, non-repeatable reads, and phantom rows are possible. -[Transaction(Isolation=TransactionIsolationLevel::ReadUncommitted)] -public ref class IsolationReadUncommitted : public ServicedComponent -{ -}; - -// An instance of this class will read only committed data and place shared -// locks on the data, preventing other users from modifying it, but other users -// can still insert rows into the data set, so phantom rows are still possible. -[Transaction(Isolation=TransactionIsolationLevel::RepeatableRead)] -public ref class IsolationRepeatableRead : public ServicedComponent -{ -}; - -// An instance of this class will read only committed data and place a range -// lock on the data set, preventing other users from updating or inserting rows -// into the data set until its transaction is complete. -[Transaction(Isolation=TransactionIsolationLevel::Serializable)] -public ref class IsolationSerializable : public ServicedComponent -{ -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp deleted file mode 100644 index f146dfea078..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Reflection; - -// References: -// System.EnterpriseServices - -// An instance of this class will not participate in transactions, but can -// share its caller's context even if its caller is configured as -// NotSupported, Supported, Required, or RequiresNew. -[Transaction(TransactionOption::Disabled)] -public ref class TransactionDisabled : public ServicedComponent -{ -}; - -// An instance of this class will not participate in transactions, and will -// share its caller's context only if its caller is also configured as -// NotSupported. -[Transaction(TransactionOption::NotSupported)] -public ref class TransactionNotSupported : public ServicedComponent -{ -}; - -// An instance of this class will participate in its caller's transaction -// if one exists. -[Transaction(TransactionOption::Supported)] -public ref class TransactionSupported : public ServicedComponent -{ -}; - -// An instance of this class will participate in its caller's transaction -// if one exists. If not, a new transaction will be created for it. -[Transaction(TransactionOption::Required)] -public ref class TransactionRequired : public ServicedComponent -{ -}; - -// A new transaction will always be created for an instance of this class. -[Transaction(TransactionOption::RequiresNew)] -public ref class TransactionRequiresNew : public ServicedComponent -{ -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp deleted file mode 100644 index 17cf341fc64..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -#using - -using namespace System; -using namespace System::EnterpriseServices; - -// - -[assembly:ApplicationName("Calculator")]; -[assembly:ApplicationActivation(ActivationOption::Library)]; -[assembly:System::Reflection::AssemblyKeyFile("Calculator.snk")]; -public ref class Calculator: public ServicedComponent -{ -public: - int Add( int x, int y ) - { - return (x + y); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp deleted file mode 100644 index c4aa994f1db..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -#using "System.EnterpriseServices.dll" - -using namespace System; - -[assembly: System::Reflection::AssemblyKeyFile("CrmServer.key")]; - -int main () -{ - - // Create a new account object. The object is created in a COM+ server application. - Account^ account = gcnew Account(); - - // Transactionally debit the account. - try - { - account->Filename = System::IO::Path::GetFullPath("JohnDoe"); - account->AllowCommit = true; - account->DebitAccount(3); - } - finally - { - delete account; - } - -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp deleted file mode 100644 index 19de5456c6e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp +++ /dev/null @@ -1,289 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::EnterpriseServices::CompensatingResourceManager; -using namespace System::IO; -using namespace System::Diagnostics; - -// -[assembly: ApplicationActivation(ActivationOption::Server)]; -// -// -[assembly: ApplicationAccessControl(false)]; -// -// -[assembly: ApplicationCrmEnabled]; -// -// -[assembly: Description("A system for ensuring that the correct account " - "balance is stored after a transaction.")]; -// - -// Subroutines to read and write account files. -void WriteAccountBalance(String^ filename, int balance) -{ - StreamWriter^ streamWriter = gcnew StreamWriter(filename); - try - { - streamWriter->WriteLine(balance); - } - finally - { - delete streamWriter; - } -} - -int ReadAccountBalance(String^ filename) -{ - int balance = 0; - if (File::Exists(filename)) - { - StreamReader^ streamReader = gcnew StreamReader(filename); - try - { - String^ line = streamReader->ReadLine(); - balance = Int32::Parse(line); - } - finally - { - delete streamReader; - } - } - return balance; -} - -ref class AccountCompensator; - -// -// A CRM Worker -[Transaction] -public ref class Account : public ServicedComponent -{ - - // A data member for the account file name. -private: - String^ filenameValue; - -public: - property String^ Filename - { - String^ get() - { - return filenameValue; - } - void set( String^ value ) - { - filenameValue = value; - } - } - - // A boolean data member that determines whether to commit or abort the - // transaction. -private: - bool allowCommitValue; - -public: - property bool AllowCommit - { - bool get() - { - return allowCommitValue; - } - void set( bool value ) - { - allowCommitValue = value; - } - } - - // Debit the account, -public: - void DebitAccount(int amount) - { - - // - // Create a new clerk using the AccountCompensator class. - Clerk^ clerk = gcnew Clerk(AccountCompensator::typeid, - "An account transaction compensator", CompensatorOptions::AllPhases); - // - - // - // Create a record of previous account status, and deliver it to the - // clerk. - int balance = ReadAccountBalance(Filename); - - array^ record = gcnew array(2); - record[0] = Filename; - record[1] = balance; - - clerk->WriteLogRecord(record); - clerk->ForceLog(); - // - - // Perform the transaction - balance -= amount; - - Console::WriteLine("{0}: {1}", Filename, balance); - - WriteAccountBalance(Filename, balance); - - // - // Commit or abort the transaction - if (AllowCommit) - { - ContextUtil::SetComplete(); - } - else - { - ContextUtil::SetAbort(); - } - // - - } - -}; -// - -// -// A CRM Compensator -public ref class AccountCompensator : public Compensator -{ -private: - bool receivedPrepareRecord; - -public: - AccountCompensator() - { - receivedPrepareRecord = false; - } - - // -public: - virtual void BeginPrepare() override - { - // nothing to do - } - // - - // -public: - virtual bool PrepareRecord(LogRecord^ log) override - { - - // Check the validity of the record. - if (log == nullptr) - { - return false; - } - array^ record = dynamic_cast^>(log->Record); - if (record == nullptr) - { - return false; - } - if (record->Length != 2) - { - return false; - } - - // The record is valid. - receivedPrepareRecord = true; - return true; - } - // - - // -public: - virtual bool EndPrepare() override - { - // Allow the transaction to proceed onlyif we have received a prepare - // record. - if (receivedPrepareRecord) - { - return true; - } - else - { - return false; - } - } - // - - // -public: - virtual void BeginCommit(bool commit) override - { - // nothing to do - } - // - - // -public: - virtual bool CommitRecord(LogRecord^ log) override - { - // nothing to do - return(false); - } - // - - // -public: - virtual void EndCommit() override - { - // nothing to do - } - // - - // -public: - virtual void BeginAbort(bool abort) override - { - // nothing to do - } - // - - // -public: - virtual bool AbortRecord(LogRecord^ log) override - { - - // Check the validity of the record. - if (log == nullptr) - { - return true; - } - array^ record = dynamic_cast^>(log->Record); - if (record == nullptr) - { - return true; - } - if (record->Length != 2) - { - return true; - } - - // Extract old account data from the record. - String^ filename = (String^) record[0]; - int balance = (int) record[1]; - - // Restore the old state of the account. - WriteAccountBalance(filename, balance); - - return false; - } - // - - // -public: - virtual void EndAbort() override - { - // nothing to do - } - // - -}; -// - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp deleted file mode 100644 index 50d9d6fefaf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Windows::Forms; - -// - -[assembly:ApplicationName("ObjectInspector")]; -[assembly:ApplicationActivation(ActivationOption::Server)]; -[assembly:System::Reflection::AssemblyKeyFile("Inspector.snk")]; -[JustInTimeActivation] -[ObjectPooling(MinPoolSize=2,MaxPoolSize=100,CreationTimeout=1000)] -public ref class ObjectInspector: public ServicedComponent -{ - // -public: - String^ IdentifyObject( Object^ obj ) - { - // Return this object to the pool after use. - ContextUtil::DeactivateOnReturn = true; - - // Get the supplied object's type. - Type^ objType = obj->GetType(); - - // Return its name. - return (objType->FullName); - } - // - - // -protected: - virtual void Activate() override - { - MessageBox::Show( String::Format( "Now entering...\nApplication: {0}\nInstance: {1}\nContext: {2}\n", ContextUtil::ApplicationId.ToString(), ContextUtil::ApplicationInstanceId.ToString(), ContextUtil::ContextId.ToString() ) ); - } - // - - // - virtual void Deactivate() override - { - MessageBox::Show( "Bye Bye!" ); - } - // - - // - // This object can be pooled. - virtual bool CanBePooled() override - { - return (true); - } - // -}; -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp deleted file mode 100644 index 8aff4f6dc96..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::EnterpriseServices; - -// -// Set component name and strong name key. -[assembly:ApplicationName("EmployeeInformation")]; -[assembly:System::Reflection::AssemblyKeyFile("EmployeeInformation.snk")]; -// - -// -// Set component access controls. -[assembly:ApplicationAccessControl(Authentication=AuthenticationOption::Privacy, -ImpersonationLevel=ImpersonationLevelOption::Identify, -AccessChecksLevel=AccessChecksLevelOption::ApplicationComponent)]; -// - -// -// Create a security role for the component. -[assembly:SecurityRole("Manager")]; -// - -// -// Accept a constructor string. - -[ConstructionEnabled] -public ref class EmployeeInformation: public ServicedComponent -{ -private: - - // The employee's user name and salary. - String^ accountName; - double salary; - -public: - - // - // Get the employee's name. All users can call this method. - String^ GetName() - { - return (accountName); - } - // - - // - // Set the employee's salary. Only managers can do this. - void SetSalary( double ammount ) - { - if ( SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) - { - salary = ammount; - } - else - { - throw gcnew UnauthorizedAccessException; - } - } - // - - // - // Get the employee's salary. Only the employee and managers can do this. - double GetSalary() - { - if ( SecurityCallContext::CurrentCall->DirectCaller->AccountName == accountName || SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) - { - return (salary); - } - else - { - throw gcnew UnauthorizedAccessException; - } - } - // - - // -protected: - // Use the constructor string. - // This method is called when the object is instantiated. - virtual void Construct( String^ constructorString ) override - { - accountName = constructorString; - } - // -}; - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp deleted file mode 100644 index 17d849b6a90..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Reflection; - -[assembly:AssemblyKeyFile("..\\common\\key.snk")]; -[assembly:ApplicationName("ReceiptNumberGenerator")]; -[assembly:ApplicationActivation(ActivationOption::Library)]; - -public ref class ReceiptNumberGeneratorClass -{ -public: - - // Generates a new receipt number based on the receipt number - // stored by the Shared Property Manager (SPM) - int GetNextReceiptNumber() - { - bool groupExists; - bool propertyExists; - int nextReceiptNumber = 0; - PropertyLockMode lockMode = PropertyLockMode::SetGet; - PropertyReleaseMode releaseMode = PropertyReleaseMode::Standard; - - // - // Create a shared property group manager. - SharedPropertyGroupManager^ groupManager = gcnew SharedPropertyGroupManager; - // - - // - // - // Create a shared property group. - SharedPropertyGroup^ group = - groupManager->CreatePropertyGroup( "Receipts", lockMode, releaseMode, groupExists ); - // - - // Create a shared property. - SharedProperty^ ReceiptNumber; - ReceiptNumber = group->CreateProperty( "ReceiptNumber", propertyExists ); - // - - // - // Retrieve the value from shared property, and increment the shared - // property value. - nextReceiptNumber = safe_cast(ReceiptNumber->Value); - ReceiptNumber->Value = nextReceiptNumber + 1; - // - - // Return nextReceiptNumber - return nextReceiptNumber; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp deleted file mode 100644 index 720671e07a3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::EnterpriseServices; - -// - -[assembly:System::Reflection::AssemblyKeyFile("Transaction.snk")]; -[Transaction] -public ref class TransactionalComponent: public ServicedComponent -{ -public: - void TransactionalMethod( String^ data ) - { - ContextUtil::DeactivateOnReturn = true; - ContextUtil::MyTransactionVote = TransactionVote::Abort; - - // do work with data - ContextUtil::MyTransactionVote = TransactionVote::Commit; - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp deleted file mode 100644 index fbcca70719e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* The following example demonstrates the 'Add' method of the 'FaultBindingCollection' class -* and constructor and 'Extensions' property of 'FaultBinding'class and 'Documentation' -* property of 'DocumentableItem' class. -* -* This program generates a WSDL file for a service called StockQuote. The StockQuote service -* provides one method called 'GetTradePrice'. The 'GetTradePrice' method takes two arguments, -* a 'tickerSymbol' and 'time' strings. The 'tickerSymbol' is a unique representation of a -* stock and 'time' is the time for which the trading price is to be returned for the stock -* specified. The WSDL file generated for the service supports the SOAP protocol only. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; - -XmlSchemaElement^ CreateComplexTypeXmlElement( String^ minoccurs, String^ maxoccurs, String^ name, bool isNillable, XmlQualifiedName^ schemaTypeName ) -{ - XmlSchemaElement^ myXmlSchemaElement = gcnew XmlSchemaElement; - myXmlSchemaElement->MinOccursString = minoccurs; - myXmlSchemaElement->MaxOccursString = maxoccurs; - myXmlSchemaElement->Name = name; - myXmlSchemaElement->IsNillable = true; - myXmlSchemaElement->SchemaTypeName = schemaTypeName; - return myXmlSchemaElement; -} - -XmlSchemaElement^ CreateOtherXmlElement( String^ name, XmlQualifiedName^ SchemaTypeName ) -{ - XmlSchemaElement^ myXmlSchemaElement = gcnew XmlSchemaElement; - myXmlSchemaElement->Name = name; - myXmlSchemaElement->SchemaTypeName = SchemaTypeName; - return myXmlSchemaElement; -} - -// Creates a Message with name =S"messageName" having one MessagePart with name = S"partName". -Message^ CreateMessage( String^ messageName, String^ partName, String^ element, String^ targetNamespace ) -{ - Message^ myMessage = gcnew Message; - myMessage->Name = messageName; - MessagePart^ myMessagePart = gcnew MessagePart; - myMessagePart->Name = partName; - myMessagePart->Element = gcnew XmlQualifiedName( element,targetNamespace ); - myMessage->Parts->Add( myMessagePart ); - return myMessage; -} - -int main() -{ - ServiceDescription^ myServiceDescription = gcnew ServiceDescription; - myServiceDescription->Name = "StockQuote"; - myServiceDescription->TargetNamespace = "http://www.contoso.com/stockquote.wsdl"; - - // Generate the 'Types' element. - XmlSchema^ myXmlSchema = gcnew XmlSchema; - myXmlSchema->AttributeFormDefault = XmlSchemaForm::Qualified; - myXmlSchema->ElementFormDefault = XmlSchemaForm::Qualified; - myXmlSchema->TargetNamespace = "http://www.contoso.com/stockquote.wsdl"; - - //XmlSchemaElement myXmlSchemaElement; - XmlSchemaComplexType^ myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaComplexType->Name = "GetTradePriceInputType"; - XmlSchemaSequence^ myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "tickerSymbol", true, gcnew XmlQualifiedName( "s:string" ) ) ); - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "time", true, gcnew XmlQualifiedName( "s:string" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlSchema->Items->Add( myXmlSchemaComplexType ); - - myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaComplexType->Name = "GetTradePriceOutputType"; - myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "result", true, gcnew XmlQualifiedName( "s:string" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlSchema->Items->Add( myXmlSchemaComplexType ); - - myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaComplexType->Name = "GetTradePriceStringFaultType"; - myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "error", true, gcnew XmlQualifiedName( "s:string" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlSchema->Items->Add( myXmlSchemaComplexType ); - - myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaComplexType->Name = "GetTradePriceStringIntType"; - myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "error", true, gcnew XmlQualifiedName( "s:int" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlSchema->Items->Add( myXmlSchemaComplexType ); - - myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapIn", gcnew XmlQualifiedName( "s0:GetTradePriceInputType" ) ) ); - myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapOut", gcnew XmlQualifiedName( "s0:GetTradePriceOutputType" ) ) ); - myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapStringFault", gcnew XmlQualifiedName( "s0:GetTradePriceStringFaultType" ) ) ); - myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapIntFault", gcnew XmlQualifiedName( "s0:GetTradePriceIntFaultType" ) ) ); - - myServiceDescription->Types->Schemas->Add( myXmlSchema ); - - // Generate the 'Message' element. - MessageCollection^ myMessageCollection = myServiceDescription->Messages; - myMessageCollection->Add( CreateMessage( "GetTradePriceInput", "parameters", "GetTradePriceSoapIn", myServiceDescription->TargetNamespace ) ); - myMessageCollection->Add( CreateMessage( "GetTradePriceOutput", "parameters", "GetTradePriceSoapOut", myServiceDescription->TargetNamespace ) ); - myMessageCollection->Add( CreateMessage( "GetTradePriceStringFault", "parameters", "GetTradePriceStringSoapFault", myServiceDescription->TargetNamespace ) ); - myMessageCollection->Add( CreateMessage( "GetTradePriceIntFault", "parameters", "GetTradePriceIntSoapFault", myServiceDescription->TargetNamespace ) ); - - // Generate the 'Port Type' element. - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = gcnew PortType; - myPortType->Name = "StockQuotePortType"; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = gcnew Operation; - myOperation->Name = "GetTradePrice"; - OperationMessage^ myOperationMessage; - OperationMessageCollection^ myOperationMessageCollection = myOperation->Messages; - myOperationMessage = dynamic_cast(gcnew OperationInput); - myOperationMessage->Message = gcnew XmlQualifiedName( "s0:GetTradePriceInput" ); - myOperationMessageCollection->Add( myOperationMessage ); - myOperationMessage = dynamic_cast(gcnew OperationOutput); - myOperationMessage->Message = gcnew XmlQualifiedName( "s0:GetTradePriceOutput" ); - myOperationMessageCollection->Add( myOperationMessage ); - OperationFault^ myOperationFault = gcnew OperationFault; - myOperationFault->Name = "ErrorString"; - myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" ); - myOperation->Faults->Add( myOperationFault ); - myOperationFault = gcnew OperationFault; - myOperationFault->Name = "ErrorInt"; - myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" ); - myOperation->Faults->Add( myOperationFault ); - myOperationCollection->Add( myOperation ); - myPortTypeCollection->Add( myPortType ); - - // Generate the 'Binding' element. - ServiceDescriptionFormatExtensionCollection^ myExtensions; - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - Binding^ myBinding = gcnew Binding; - myBinding->Name = "StockQuoteSoapBinding"; - myBinding->Type = gcnew XmlQualifiedName( "s0:StockQuotePortType" ); - myExtensions = myBinding->Extensions; - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Style = SoapBindingStyle::Document; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - myExtensions->Add( mySoapBinding ); - OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myExtensions = myOperationBinding->Extensions; - SoapOperationBinding^ mySoapBindingOperation = gcnew SoapOperationBinding; - mySoapBindingOperation->SoapAction = "http://www.contoso.com/GetTradePrice"; - myExtensions->Add( mySoapBindingOperation ); - myOperationBinding->Name = "GetTradePrice"; - myOperationBinding->Input = gcnew InputBinding; - myExtensions = myOperationBinding->Input->Extensions; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - mySoapBodyBinding->Namespace = "http://www.contoso.com/stockquote"; - myExtensions->Add( mySoapBodyBinding ); - myOperationBinding->Output = gcnew OutputBinding; - myExtensions = myOperationBinding->Output->Extensions; - mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - mySoapBodyBinding->Namespace = "http://www.contoso.com/stockquote"; - myExtensions->Add( mySoapBodyBinding ); - -// -// -// - FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; - FaultBinding^ myFaultBinding = gcnew FaultBinding; - myFaultBinding->Name = "ErrorString"; - // Associate SOAP fault binding to the fault binding of the operation. - myExtensions = myFaultBinding->Extensions; - SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; - mySoapFaultBinding->Use = SoapBindingUse::Literal; - mySoapFaultBinding->Namespace = "http://www.contoso.com/stockquote"; - myExtensions->Add( mySoapFaultBinding ); - myFaultBindingCollection->Add( myFaultBinding ); -// -// -// - - myFaultBinding = gcnew FaultBinding; - myFaultBinding->Name = "ErrorInt"; - // Associate SOAP fault binding to the fault binding of the operation. - myExtensions = myFaultBinding->Extensions; - mySoapFaultBinding = gcnew SoapFaultBinding; - mySoapFaultBinding->Use = SoapBindingUse::Literal; - mySoapFaultBinding->Namespace = "http://www.contoso.com/stockquote"; - myExtensions->Add( mySoapFaultBinding ); - myFaultBindingCollection->Add( myFaultBinding ); - myOperationBindingCollection->Add( myOperationBinding ); - myBindingCollection->Add( myBinding ); - - // Generate the 'Service' element. - ServiceCollection^ myServiceCollection = myServiceDescription->Services; - -// - Service^ myService = gcnew Service; - // Add a simple documentation for the service to ease the readability of the generated WSDL file. - myService->Documentation = "A Simple Stock Quote Service"; - myService->Name = "StockQuoteService"; - PortCollection^ myPortCollection = myService->Ports; - Port^ myPort = gcnew Port; - myPort->Name = "StockQuotePort"; - myPort->Binding = gcnew XmlQualifiedName( "s0:StockQuoteSoapBinding" ); - myExtensions = myPort->Extensions; - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://www.contoso.com/stockquote"; - myExtensions->Add( mySoapAddressBinding ); - myPortCollection->Add( myPort ); - // - myServiceCollection->Add( myService ); - - // Display the WSDL generated to the console. - myServiceDescription->Write( Console::Out ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp deleted file mode 100644 index 5084e6fa169..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/* -* The following example demonstrates the 'Item[String*]' property of -FaultBindingCollection class -* The program removes a fault binding with the name 'ErrorString' -from the WSDL file. It also removes a operation fault with the name -'ErrorString' and displays the resultant WSDL file to the console. -* -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - - // Read the 'StockQuote::wsdl' file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote.wsdl" ); - - // Get the operation fault collection and remove the operation fault with the name 'ErrorString'. - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = myOperationCollection[ 0 ]; - OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; - if ( myOperationFaultCollection->Contains( myOperationFaultCollection[ "ErrorString" ] ) ) - myOperationFaultCollection->Remove( myOperationFaultCollection[ "ErrorString" ] ); - - - // Get the fault binding collection and remove the fault binding with the name 'ErrorString'. - // - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - Binding^ myBinding = myBindingCollection[ 0 ]; - OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; - OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; - FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; - if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) ) - myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] ); - - - // - myServiceDescription->Write( Console::Out ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp deleted file mode 100644 index 5d0f962f077..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/* -* The following example demonstrates the 'Remove', 'CopyTo', 'Insert', -'Contains', 'IndexOf' method and 'Item[int]' property of FaultBindingCollection -class -The program reverses the fault bindings that appear in the WSDL file. -It also reverses the operation faults and displays the resultant WSDL file -to the console. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - - // Read the 'StockQuote::wsdl' file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = myOperationCollection[ 0 ]; - OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; - - // Reverse the operation fault order. - if ( myOperationFaultCollection->Count > 1 ) - { - array^myOperationFaultArray = gcnew array(myOperationFaultCollection->Count); - - // Copy the operation fault to a temporary array. - myOperationFaultCollection->CopyTo( myOperationFaultArray, 0 ); - - // Remove all the operation fault instances in the fault binding collection. - for ( int i = 0; i < myOperationFaultArray->Length; i++ ) - myOperationFaultCollection->Remove( myOperationFaultArray[ i ] ); - - // Insert the operation fault instance in the reverse order. - for ( int i = 0,j = (myOperationFaultArray->Length - 1); i < myOperationFaultArray->Length; i++,j-- ) - myOperationFaultCollection->Insert( i, myOperationFaultArray[ j ] ); - } - - // - // - // - // - // - // - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - Binding^ myBinding = myBindingCollection[ 0 ]; - OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; - OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; - FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; - - // Reverse the fault bindings order. - if ( myFaultBindingCollection->Count > 1 ) - { - FaultBinding^ myFaultBinding = myFaultBindingCollection[ 0 ]; - array^myFaultBindingArray = gcnew array(myFaultBindingCollection->Count); - - // Copy the fault bindings to a temporary array. - myFaultBindingCollection->CopyTo( myFaultBindingArray, 0 ); - - // Remove all the fault binding instances in the fault binding collection. - for ( int i = 0; i < myFaultBindingArray->Length; i++ ) - myFaultBindingCollection->Remove( myFaultBindingArray[ i ] ); - - // Insert the fault binding instance in the reverse order. - for ( int i = 0,j = (myFaultBindingArray->Length - 1); i < myFaultBindingArray->Length; i++,j-- ) - myFaultBindingCollection->Insert( i, myFaultBindingArray[ j ] ); - - // Check if the first element in the collection before the reversal is now the last element. - if ( myFaultBindingCollection->Contains( myFaultBinding ) && myFaultBindingCollection->IndexOf( myFaultBinding ) == (myFaultBindingCollection->Count - 1) ) - - // Display the WSDL generated to the console. - myServiceDescription->Write( Console::Out ); - else - Console::WriteLine( "Error while reversing" ); - } - // - // - // - // - // - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp deleted file mode 100644 index ff1a5cacc7d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// System::Net::FileWebRequest::ContentLength;System::Net::FileWebRequest::RequestUri; - -/* -This program demonstrates 'ContentLength'and 'RequestUri' property of 'FileWebRequest' class. -The path of a file where user would like to write something is obtained from command line argument. -Then a 'WebRequest' Object* is created. The 'ContentLength' property of 'FileWebRequest' is used to -set the length of the file content that was written. -*/ - -#using - -using namespace System::Net; -using namespace System; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the file name as command line parameter where you want to write:" ); - Console::WriteLine( "Usage:FileWebRequest_ContentLen //\nExample:FileWebRequest_ContentLen shafeeque/shaf/hello.txt" ); - } - else - { - try - { - // Create an 'Uri' Object*. - Uri^ myUrl = gcnew Uri( String::Concat( "file://", args[ 1 ] ) ); - FileWebRequest^ myFileWebRequest = nullptr; - -// - myFileWebRequest = (FileWebRequest^)( WebRequest::Create( myUrl ) ); - - Console::WriteLine( "Enter the string you want to write into the file:" ); - String^ userInput = Console::ReadLine(); - ASCIIEncoding^ encoder = gcnew ASCIIEncoding; - array^ byteArray = encoder->GetBytes( userInput ); - - // Set the 'Method' property of 'FileWebRequest' Object* to 'POST' method. - myFileWebRequest->Method = "POST"; - - // The 'ContentLength' property is used to set the content length of the file. - myFileWebRequest->ContentLength = byteArray->Length; -// - -// - // Compare the file name and 'RequestUri' is same or not. - if ( myFileWebRequest->RequestUri->Equals( myUrl ) ) - { - // 'GetRequestStream' method returns the stream handler for writing into the file. - Stream^ readStream = myFileWebRequest->GetRequestStream(); - // Write to the stream - readStream->Write( byteArray, 0, userInput->Length ); - readStream->Close(); - } - - Console::WriteLine( "\nThe String you entered was successfully written into the file." ); - Console::WriteLine( "The content length sent to the server is {0}.", myFileWebRequest->ContentLength ); -// - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( "The ArgumentException is : {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "The UriFormatException is : {0}", e->Message ); - } - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp deleted file mode 100644 index 7203551b787..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp +++ /dev/null @@ -1,118 +0,0 @@ - - -// System::Net::FileWebRequest::BeginGetRequestStream;System::Net::FileWebRequest::EndGetRequestStream; -// Snippet1 and Snippet2 go together -/* -This program demonstrates 'BeginGetRequestStream' and 'EndGetRequestStream' method of 'FileWebRequest' class -The path of the file from where content is to be read is obtained as a command line argument and a 'webRequest' -Object* is created.Using the 'BeginGetRequestStream' method and 'EndGetRequestStream' of 'FileWebRequest' class -a stream Object* is obtained which is used to write into the file. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Threading; - -// -// -public ref class RequestDeclare -{ -public: - FileWebRequest^ myFileWebRequest; - String^ userinput; - RequestDeclare() - { - myFileWebRequest = nullptr; - } - -}; - -ref class FileWebRequest_reqbeginend -{ -public: - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - static void ReadCallback( IAsyncResult^ ar ) - { - try - { - - // State of the request is asynchronous. - RequestDeclare^ requestDeclare = dynamic_cast(ar->AsyncState); - FileWebRequest^ myFileWebRequest = requestDeclare->myFileWebRequest; - String^ sendToFile = requestDeclare->userinput; - - // End the Asynchronus request by calling the 'EndGetRequestStream()' method. - Stream^ readStream = myFileWebRequest->EndGetRequestStream( ar ); - - // Convert the String* into Byte array. - ASCIIEncoding^ encoder = gcnew ASCIIEncoding; - array^byteArray = encoder->GetBytes( sendToFile ); - - // Write to the stream. - readStream->Write( byteArray, 0, sendToFile->Length ); - readStream->Close(); - allDone->Set(); - Console::WriteLine( "\nThe String you entered was successfully written into the file." ); - Console::WriteLine( "\nPress Enter to continue." ); - } - catch ( ApplicationException^ e ) - { - Console::WriteLine( "ApplicationException is : {0}", e->Message ); - } - - } - -}; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); - Console::WriteLine( "Usage:FileWebRequest_reqbeginend //\n" ); - Console::WriteLine( "Example:FileWebRequest_reqbeginend shafeeque/shaf/hello.txt" ); - } - else - { - try - { - - // Place a webrequest. - WebRequest^ myWebRequest = WebRequest::Create( String::Concat( "file://", args[ 1 ] ) ); - - // Create an instance of the 'RequestDeclare' and associate the 'myWebRequest' to it. - RequestDeclare^ requestDeclare = gcnew RequestDeclare; - requestDeclare->myFileWebRequest = dynamic_cast(myWebRequest); - - // Set the 'Method' property of 'FileWebRequest' Object* to 'POST' method. - requestDeclare->myFileWebRequest->Method = "POST"; - Console::WriteLine( "Enter the String* you want to write into the file:" ); - requestDeclare->userinput = Console::ReadLine(); - - // Begin the Asynchronous request for getting file content using 'BeginGetRequestStream()' method . - IAsyncResult^ r = dynamic_cast(requestDeclare->myFileWebRequest->BeginGetRequestStream( gcnew AsyncCallback( &FileWebRequest_reqbeginend::ReadCallback ), requestDeclare )); - FileWebRequest_reqbeginend::allDone->WaitOne(); - Console::Read(); - } - catch ( ProtocolViolationException^ e ) - { - Console::WriteLine( "ProtocolViolationException is : {0}", e->Message ); - } - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( "InvalidOperationException is : {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "UriFormatExceptionException is : {0}", e->Message ); - } - - } -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp deleted file mode 100644 index 0a0ee8a55eb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp +++ /dev/null @@ -1,105 +0,0 @@ - - -// System::Net::FileWebRequest::BeginGetResponse;System::Net::FileWebRequest::EndGetResponse; -// Snippet1 and Snippet2 go together -/* -This program demonstrates 'BeginGetResponse' and 'EndGetResponse' methods of 'FileWebRequest' class. -The path of the file from where content is to be read is obtained as a command line argument and a -'WebRequest' Object* is created. Using the 'BeginGetResponse' method and 'EndGetResponse' of 'FileWebRequest' -class a 'FileWebResponse' Object* is obtained which is used to print the content on the file. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Threading; - -// -// -public ref class RequestDeclare -{ -public: - FileWebRequest^ myFileWebRequest; - RequestDeclare() - { - myFileWebRequest = nullptr; - } - -}; - -ref class FileWebRequest_resbeginend -{ -public: - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - static void RespCallback( IAsyncResult^ ar ) - { - - // State of request is asynchronous. - RequestDeclare^ requestDeclare = dynamic_cast(ar->AsyncState); - FileWebRequest^ myFileWebRequest = requestDeclare->myFileWebRequest; - - // End the Asynchronus request by calling the 'EndGetResponse()' method. - FileWebResponse^ myFileWebResponse = dynamic_cast(myFileWebRequest->EndGetResponse( ar )); - - // Reade the response into Stream. - StreamReader^ streamReader = gcnew StreamReader( myFileWebResponse->GetResponseStream() ); - array^readBuffer = gcnew array(256); - int count = streamReader->Read( readBuffer, 0, 256 ); - Console::WriteLine( "The contents of the file are :\n" ); - while ( count > 0 ) - { - String^ str = gcnew String( readBuffer,0,count ); - Console::WriteLine( str ); - count = streamReader->Read( readBuffer, 0, 256 ); - } - - streamReader->Close(); - - // Release the response Object* resources. - myFileWebResponse->Close(); - allDone->Set(); - Console::WriteLine( "File reading is over." ); - } - -}; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); - Console::WriteLine( "Usage:FileWebRequest_resbeginend //\n" ); - Console::WriteLine( "Example:FileWebRequest_resbeginend shafeeque/shaf/hello.txt" ); - } - else - { - try - { - - // Place a 'Webrequest'. - WebRequest^ myWebRequest = WebRequest::Create( String::Concat( "file://", args[ 1 ] ) ); - - // Create an instance of the 'RequestDeclare' and associating the 'myWebRequest' to it. - RequestDeclare^ myRequestDeclare = gcnew RequestDeclare; - myRequestDeclare->myFileWebRequest = dynamic_cast(myWebRequest); - - // Begin the Asynchronous request for getting file content using 'BeginGetResponse()' method. - IAsyncResult^ asyncResult = dynamic_cast(myRequestDeclare->myFileWebRequest->BeginGetResponse( gcnew AsyncCallback( &FileWebRequest_resbeginend::RespCallback ), myRequestDeclare )); - FileWebRequest_resbeginend::allDone->WaitOne(); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException is : {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "UriFormatException is : {0}", e->Message ); - } - - } -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp deleted file mode 100644 index 7125135810a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Net::FileWebResponse::Close -/*This program demontrates the 'Close' method of 'FileWebResponse' Class. -It takes an Uri from console and creates a 'FileWebRequest' Object* for the Uri::It then gets back -the response Object* from the Uri. The response Object* can be processed as desired. The program then -closes the response Object* and releases resources associated with it. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -// -void GetPage( String^ url ) -{ - try - { - Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); - // Create a FileWebrequest with the specified Uri. - FileWebRequest^ myFileWebRequest = dynamic_cast(WebRequest::Create( fileUrl )); - // Send the 'fileWebRequest' and wait for response. - FileWebResponse^ myFileWebResponse = dynamic_cast(myFileWebRequest->GetResponse()); - // Process the response here. - Console::WriteLine( "\nResponse Received::Trying to Close the response stream.." ); - // Release resources of response Object*. - myFileWebResponse->Close(); - Console::WriteLine( "\nResponse Stream successfully closed." ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} -// - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); - Console::WriteLine( "Usage:FileWebResponse_Close // \nExample:FileWebResponse_Close microsoft/shared/hello.txt" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp deleted file mode 100644 index 5dff4113057..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// System::Net::FileWebResponse::ContentLength;System::Net::FileWebResponse::ContentType. - -/* This program demonstrates the 'ContentLength' and 'ContentType' properties of the 'FileWebResponse' class. -It creates a web request and queries for a response. It then prints the content length -and content type of the entity body in the response onto the console */ - -#using - -using namespace System; -using namespace System::Net; - -// -// -void GetPage( String^ url ) -{ - try - { - Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); - // Create a 'FileWebrequest' Object* with the specified Uri. - FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) ); - // Send the 'fileWebRequest' and wait for response. - FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() ); - // Print the ContentLength and ContentType properties received as headers in the response Object*. - Console::WriteLine( "\nContent length : {0}, Content Type : {1}", myFileWebResponse->ContentLength, myFileWebResponse->ContentType ); - // Release resources of response Object*. - myFileWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} -// -// - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); - Console::WriteLine( "Usage:FileWebResponse_ContentLength_ContentType // \nExample:FileWebResponse_ContentLength_ContentType microsoft/shared/hello.txt" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp deleted file mode 100644 index 37b23a614f8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// System::Net::FileWebResponse::GetResponseStream. - -/* This program demonstrates the 'GetResponseStream' method of the 'FileWebResponse' class. -It creates a 'FileWebRequest' Object* and queries for a response. -The response stream obtained is piped to a higher level stream reader. The reader reads -256 characters at a time, writes them into a String* and then displays the String* onto the console*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ - try - { -// - Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); - // Create a 'FileWebrequest' Object* with the specified Uri. - FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) ); - // Send the 'FileWebRequest' Object* and wait for response. - FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() ); - - // Get the stream Object* associated with the response Object*. - Stream^ receiveStream = myFileWebResponse->GetResponseStream(); - - Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); - // Pipe the stream to a higher level stream reader with the required encoding format. - StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); - Console::WriteLine( "\r\nResponse stream received" ); - - array^ read = gcnew array(256); - // Read 256 characters at a time. - int count = readStream->Read( read, 0, 256 ); - Console::WriteLine( "File Data...\r\n" ); - while ( count > 0 ) - { - // Dump the 256 characters on a String* and display the String* onto the console. - String^ str = gcnew String( read,0,count ); - Console::Write( str ); - count = readStream->Read( read, 0, 256 ); - } - Console::WriteLine( "" ); - // Release resources of stream Object*. - readStream->Close(); - // Release resources of response Object*. - myFileWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); - Console::WriteLine( "Usage:FileWebResponse_GetResponseStream // \nExample:FileWebResponse_GetResponseStream microsoft/shared/hello.txt" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp deleted file mode 100644 index 3d637455677..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// System::Net::FileWebResponse::Headers - -/* This program demonstrates the 'Headers' property of the 'FileWebResponse' class. -It creates a web request and queries for a response. It then prints [Out] all* the response -headers (name -value pairs) onto the console. */ - -#using - -using namespace System; -using namespace System::Net; - -// -void GetPage( String^ url ) -{ - try - { - Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); - // Create a 'FileWebrequest' Object^ with the specified Uri . - FileWebRequest^ myFileWebRequest = (FileWebRequest^)(WebRequest::Create( fileUrl )); - // Send the 'FileWebRequest' and wait for response. - FileWebResponse^ myFileWebResponse = (FileWebResponse^)(myFileWebRequest->GetResponse()); - // Display all Headers present in the response received from the Uri. - Console::WriteLine( "\r\nThe following headers were received in the response:" ); - // Display each header and the key of the response Object^. - for ( int i = 0; i < myFileWebResponse->Headers->Count; ++i ) - Console::WriteLine( "\nHeader Name: {0}, Header value : {1}", - myFileWebResponse->Headers->Keys[ i ], myFileWebResponse->Headers[ (HttpRequestHeader)i ] ); - myFileWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException thrown. The Reason for failure is: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised: {0}", e->Message ); - } - -} -// - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease type the file name as command line parameter as:" ); - Console::WriteLine( "Usage:FileWebResponse_Headers // \nExample:FileWebResponse_Headers microsoft/shared/hello.txt" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp deleted file mode 100644 index 677397be699..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// System::Net::FileWebResponse::ResponseUri - -/* This program demonstrates the 'ResponseUri' property of the 'FileWebResponse' class. -It creates a 'FileWebRequest' Object* and queries for a response. It then displays the Uri of the file -system resource that provided the response. -*/ - -#using - -using namespace System; -using namespace System::Net; - -// -void GetPage( String^ url ) -{ - try - { - Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); - - // Create a 'FileWebrequest' object with the specified Uri . - FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) ); - - // Send the 'fileWebRequest' and wait for response. - FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() ); - Console::WriteLine( "\nThe Uri of the file system resource that provided the response is :\n {0}\n\n", myFileWebResponse->ResponseUri ); - - // Release resources of response object. - myFileWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} -// - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease type the file name as command line parameter as:" ); - Console::WriteLine( "Usage:FileWebResponse_ResponseUri // \nExample:FileWebResponse_ResponseUri microsoft/shared/hello.txt" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp deleted file mode 100644 index 6e09ece8126..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// System.Web.Services.Description.HttpBinding.HttpBinding() -// System.Web.Services.Description.HttpBinding.Namespace -// System.Web.Services.Description.HttpAddressBinding.HttpAddressBinding() - -/* The following program demonstrates the constructor, field 'Namespace' of - class 'HttpBinding' and constructor of class 'HttpAddressBinding'. This program writes all 'HttpPost' binding related information to the input wsdl file and genrates an output file which is later on compiled using wsdl tool. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myDescription = ServiceDescription::Read( "HttpBinding_ctor_Input_CPP.wsdl" ); - - // - // - // Create 'Binding' object. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "MyHttpBindingServiceHttpPost"; - XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:MyHttpBindingServiceHttpPost" ); - myBinding->Type = qualifiedName; - - // Create 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - Console::WriteLine( "HttpBinding Namespace : {0}", HttpBinding::Namespace ); - // - - // Add 'HttpBinding' to 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - // - - // Create 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; - myOperation->Location = "/AddNumbers"; - - // Add 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myOperation ); - - // Create 'InputBinding' object. - InputBinding^ myInput = gcnew InputBinding; - MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; - postMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInput->Extensions->Add( postMimeContentbinding ); - - // Add 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInput; - - // Create 'OutputBinding' object. - OutputBinding^ myOutput = gcnew OutputBinding; - MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; - postMimeXmlbinding->Part = "Body"; - myOutput->Extensions->Add( postMimeXmlbinding ); - - // Add 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - - // Add 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - - // - // Create a 'Port' object. - Port^ postPort = gcnew Port; - postPort->Name = "MyHttpBindingServiceHttpPost"; - postPort->Binding = gcnew XmlQualifiedName( "s0:MyHttpBindingServiceHttpPost" ); - - // Create 'HttpAddressBinding' object. - HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; - postAddressBinding->Location = "http://localhost/HttpBinding_ctor/HttpBinding_ctor_Service.cs.asmx"; - - // Add 'HttpAddressBinding' to 'Port'. - postPort->Extensions->Add( postAddressBinding ); - // - - // Add 'Port' to 'PortCollection' of 'ServiceDescription'. - myDescription->Services[ 0 ]->Ports->Add( postPort ); - - // Write 'ServiceDescription' as a WSDL file. - myDescription->Write( "HttpBinding_ctor_Output_CPP.wsdl" ); - Console::WriteLine( "WSDL file with name 'HttpBinding_ctor_Output_CPP.wsdl' file created Successfully" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp deleted file mode 100644 index a5bf4b16d1a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp +++ /dev/null @@ -1,219 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::IO; -using namespace System::Runtime::Remoting::Messaging; - -// This snippet demonstrates HttpChannel->AddHookChannelUri. -// client code should NOT call this call directly. So, I'm -// writing a class using an implementation that mimics the behavior -// of HttpChannel -// -ref class CustomChannel: public BaseChannelWithProperties, public IChannelReceiverHook, public IChannelReceiver, public IChannel, public IChannelSender -{ -public: - virtual void AddHookChannelUri( String^ channelUri ) - { - if ( channelUri != nullptr ) - { - array^uris = dataStore->ChannelUris; - - // This implementation only allows one URI to be hooked in. - if ( uris == nullptr ) - { - array^newUris = gcnew array(1); - newUris[ 0 ] = channelUri; - dataStore->ChannelUris = newUris; - wantsToListen = false; - } - else - { - String^ msg = "This channel is already listening for data, and can't be hooked into at this stage."; - throw gcnew System::Runtime::Remoting::RemotingException( msg ); - } - } - } - - // The rest of CustomChannel's implementation. - // - ref class TransportSink: public IServerChannelSink - { - public: - - property IServerChannelSink^ NextChannelSink - { - virtual IServerChannelSink^ get() - { - return next; - } - - } - TransportSink( IServerChannelSink^ nextSink ) - { - next = nextSink; - } - - // I am not implementing these because they are - // not needed for my snippet but they must be here. - virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ){} - - virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers ) - { - return nullptr; - } - - virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, IMessage^% msg, ITransportHeaders^% responseHeaders, Stream^% responseStream ) - { - msg = nullptr; - responseHeaders = nullptr; - responseStream = nullptr; - return ServerProcessing::Complete; - } - - - property IDictionary^ Properties - { - virtual IDictionary^ get() - { - return nullptr; - } - } - - private: - IServerChannelSink^ next; - }; - - -private: - TransportSink^ transportSink; - -public: - property IServerChannelSink^ ChannelSinkChain - { - virtual IServerChannelSink^ get() - { - return transportSink->NextChannelSink; - } - } - -public: - CustomChannel() - { - BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); - transportSink = gcnew TransportSink( formatterSink ); - priority = 0; - dataStore = gcnew ChannelDataStore( nullptr ); - wantsToListen = true; - socket = ""; - } - - CustomChannel( int portNum ) - { - BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); - transportSink = gcnew TransportSink( formatterSink ); - priority = 0; - dataStore = gcnew ChannelDataStore( nullptr ); - wantsToListen = false; - socket = String::Format( "http://localhost: {0}", portNum ); - } - - CustomChannel( IDictionary^ properties, IClientChannelSinkProvider^ clientSinkProvider, IServerChannelSinkProvider^ serverSinkProvider ){} - - - property String^ ChannelName - { - virtual String^ get() - { - return "custom"; - } - } - - property Object^ ChannelData - { - virtual Object^ get() - { - return dataStore; - } - } - - property bool WantsToListen - { - virtual bool get() - { - return wantsToListen; - } - } - - property int ChannelPriority - { - virtual int get() - { - return priority; - } - } - - property String^ ChannelScheme - { - virtual String^ get() - { - return "http"; - } - - } - virtual array^ GetUrlsForUri( String^ uri ) - { - array^urls = gcnew array(dataStore->ChannelUris->Length); - int i = 0; - IEnumerator^ myEnum = dataStore->ChannelUris->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ currUri = safe_cast(myEnum->Current); - urls[ i ] = String::Format( "{0} / {1}", socket, currUri ); - i++; - } - - return urls; - } - - virtual void StartListening( Object^ data ){} - - virtual void StopListening( Object^ data ){} - - virtual String^ Parse( String^ url, String^% objectURI ) - { - int lastSlash = url->LastIndexOf( "/" ); - objectURI = ""; - objectURI = url->Substring( lastSlash ); - return socket; - } - - virtual IMessageSink^ CreateMessageSink( String^ url, Object^ remoteChannelData, String^% objectURI ) - { - Parse( url, objectURI ); - return nullptr; - } - -private: - ChannelDataStore^ dataStore; - bool wantsToListen; - int priority; - String^ socket; -}; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - CustomChannel^ channel = gcnew CustomChannel( 8085 ); - channel->AddHookChannelUri( "TempConverter" ); - - //System::Runtime::Remoting::Channels.Http::HttpChannel* channel = new System::Runtime::Remoting::Channels.Http::HttpChannel(8085); - //System::Runtime::Remoting::Channels.Tcp::TcpChannel* channel = new System::Runtime::Remoting::Channels.Tcp::TcpChannel(8085); - System::Console::WriteLine( channel->GetUrlsForUri( "TempConverter" )[ 0 ] ); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp deleted file mode 100644 index 15207731482..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp +++ /dev/null @@ -1,215 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::IO; -using namespace System::Runtime::Remoting::Messaging; - -// This snippet demonstrates HttpChannel::ChannelSinkChain. -// client code should NOT call this call directly. So, I'm -// writing a class that implements the member as HttpChannel -// does. That is, it returns the first sink after the transport -// sink. ie... if the sink chain is transport=>encryption=>formatter -// then this member should return encryption. - -// -ref class CustomChannel: public BaseChannelWithProperties, public IChannelReceiverHook, public IChannelReceiver, public IChannel, public IChannelSender -{ -public: - - property IServerChannelSink^ ChannelSinkChain - { - // TransportSink is a private class defined within CustomChannel. - virtual IServerChannelSink^ get() - { - return transportSink->NextChannelSink; - } - } - - // Rest of CustomChannel's implementation... - // - CustomChannel() - { - BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); - transportSink = gcnew TransportSink( formatterSink ); - priority = 0; - dataStore = gcnew ChannelDataStore( nullptr ); - wantsToListen = true; - socket = ""; - } - - CustomChannel( int portNum ) - { - BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); - transportSink = gcnew TransportSink( formatterSink ); - priority = 0; - dataStore = gcnew ChannelDataStore( nullptr ); - wantsToListen = false; - socket = "http://localhost: {0}",portNum; - } - - CustomChannel( IDictionary^ properties, IClientChannelSinkProvider^ clientSinkProvider, IServerChannelSinkProvider^ serverSinkProvider ){} - - property String^ ChannelName - { - virtual String^ get() - { - return "custom"; - } - - } - - property Object^ ChannelData - { - virtual Object^ get() - { - return dataStore; - } - - } - virtual void AddHookChannelUri( String^ channelUri ) - { - if ( channelUri != nullptr ) - { - array^uris = dataStore->ChannelUris; - if ( uris == nullptr ) - { - array^newUris = gcnew array(1); - newUris[ 0 ] = channelUri; - dataStore->ChannelUris = newUris; - } - else - { - String^ msg = "This channel is already listening for data, and can't be hooked into at this stage."; - throw gcnew System::Runtime::Remoting::RemotingException( msg ); - } - } - } - - property bool WantsToListen - { - virtual bool get() - { - return wantsToListen; - } - - } - - property int ChannelPriority - { - virtual int get() - { - return priority; - } - - } - - property String^ ChannelScheme - { - virtual String^ get() - { - return "http"; - } - - } - virtual array^ GetUrlsForUri( String^ uri ) - { - array^urls = gcnew array(dataStore->ChannelUris->Length); - int i = 0; - IEnumerator^ myEnum = dataStore->ChannelUris->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ currUri = safe_cast(myEnum->Current); - urls[ i ] = String::Format( "{0}/{1}", socket, currUri ); - i++; - } - - return urls; - } - - virtual void StartListening( Object^ data ){} - - virtual void StopListening( Object^ data ){} - - virtual String^ Parse( String^ url, String^% objectURI ) - { - int lastSlash = url->LastIndexOf( "/" ); - objectURI = ""; - objectURI = url->Substring( lastSlash ); - return socket; - } - - virtual IMessageSink^ CreateMessageSink( String^ url, Object^ remoteChannelData, String^% objectURI ) - { - Parse( url, objectURI ); - return nullptr; - } - - ref class TransportSink: public IServerChannelSink - { - public: - - property IServerChannelSink^ NextChannelSink - { - virtual IServerChannelSink^ get() - { - return next; - } - - } - TransportSink( IServerChannelSink^ nextSink ) - { - next = nextSink; - } - - // I am not implementing these because they are - // not needed for my snippet but they must be here. - virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ){} - - virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers ) - { - return nullptr; - } - - virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, IMessage^% msg, ITransportHeaders^% responseHeaders, Stream^% responseStream ) - { - msg = nullptr; - responseHeaders = nullptr; - responseStream = nullptr; - return ServerProcessing::Complete; - } - - property IDictionary^ Properties - { - virtual IDictionary^ get() - { - return nullptr; - } - } - - private: - IServerChannelSink^ next; - }; - -private: - ChannelDataStore^ dataStore; - bool wantsToListen; - int priority; - String^ socket; - TransportSink^ transportSink; -}; - -int main() -{ - CustomChannel^ channel = gcnew CustomChannel( 8085 ); - channel->AddHookChannelUri( "TempConverter" ); - - //System::Runtime::Remoting::Channels.Http::HttpChannel* channel = new System::Runtime::Remoting::Channels.Http::HttpChannel(8085); - //System::Runtime::Remoting::Channels.Tcp::TcpChannel* channel = new System::Runtime::Remoting::Channels.Tcp::TcpChannel(8085); - System::Console::WriteLine( channel->ChannelSinkChain ); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp deleted file mode 100644 index 76d14d8aed8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Collections; - -public ref class HelloService: public MarshalByRefObject{}; - -int main() -{ - // Create a remotable object. - HttpChannel^ httpChannel = gcnew HttpChannel( 8085 ); - WellKnownServiceTypeEntry^ WKSTE = gcnew WellKnownServiceTypeEntry( HelloService::typeid,"Service",WellKnownObjectMode::Singleton ); - RemotingConfiguration::RegisterWellKnownServiceType( WKSTE ); - RemotingConfiguration::ApplicationName = "HelloServer"; - - // Print out the urls for HelloServer. - array^urls = httpChannel->GetUrlsForUri( "HelloServer" ); - IEnumerator^ myEnum = urls->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ url = safe_cast(myEnum->Current); - System::Console::WriteLine( "{0}", url ); - } - - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp deleted file mode 100644 index 6e1b41e8078..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Lifetime; -using namespace SampleNamespace; - -// This assembly contains a remote service and its server host wrapped together. -int main() -{ - - // The following sample uses an HttpChannel constructor - // to create a new HttpChannel that will listen on port 9000. - // System::Runtime::Remoting::Channels.Http::HttpChannel.HttpChannel(int) - // System::Runtime::Remoting::Channels.Http::HttpChannel - // - HttpChannel^ channel = gcnew HttpChannel( 9000 ); - ChannelServices::RegisterChannel( channel, false ); - RemotingConfiguration::RegisterWellKnownServiceType( SampleNamespace::SampleService::typeid, "MySampleService/SampleService::soap", WellKnownObjectMode::Singleton ); - Console::WriteLine( "** Press enter to end the server process. **" ); - Console::ReadLine(); - // - - return 0; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp deleted file mode 100644 index 4b14e0f5e34..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp +++ /dev/null @@ -1,77 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -// System.Web.Services.Protocols.HttpGetClientProtocol.HttpGetClientProtocol -/* The following example demonstrates 'Constructor' of 'HttpGetClientProtocol' class -A variable of type 'HttpGetClientProtocol' is used to set proxy information , -client credentials and Url on the proxy class. -*/ -/* -// The following example is a proxy class generated by the Wsdl.exe -// utility for the Math Web service. The proxy class derives from -// HttpGetClientProtocol, which derives from the abstract -// HttpSimpleClientProtocol class. - -public class MyMath : System.Web.Services.Protocols.HttpGetClientProtocol -{ -[System.Diagnostics.DebuggerStepThroughAttribute()] -public MyMath() -{ -this.Url = "http://localhost/MyMath.Cs.asmx"; -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.Web.Services.Protocols.HttpMethodAttribute( -typeof(System.Web.Services.Protocols.XmlReturnReader), -typeof(System.Web.Services.Protocols.UrlParameterWriter))] -[return: System.Xml.Serialization.XmlRootAttribute("int", -Namespace="http://tempuri.org/", IsNullable=false)] -public int Add(string num1, string num2) -{ -return ((int)(this.Invoke("Add", (this.Url + "/Add"), new object[] { -num1, -num2}))); -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -public System.IAsyncResult BeginAdd(string num1, string num2, -System.AsyncCallback callback, object asyncState) -{ -return this.BeginInvoke("Add", (this.Url + "/Add"), new object[] { -num1, -num2}, callback, asyncState); -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -public int EndAdd(System.IAsyncResult asyncResult) -{ -return ((int)(this.EndInvoke(asyncResult))); -} -} -*/ -public ref class Math: public HttpGetClientProtocol{}; - -int main() -{ - - // - // Math is a proxy class derived from HttpGetClientProtocol. - HttpGetClientProtocol^ myHttpGetClientProtocol = gcnew ::Math; - - // Obtain password from a secure store. - String^ SecurelyStoredPassword = String::Empty; - - // Set the client-side credentials using the Credentials property. - ICredentials^ credentials = gcnew NetworkCredential( "Joe","mydomain",SecurelyStoredPassword ); - myHttpGetClientProtocol->Credentials = credentials; - Console::WriteLine( "Auto redirect is: {0}", myHttpGetClientProtocol->AllowAutoRedirect ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp deleted file mode 100644 index b09c48ea156..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -// System.Web.Services.Protocols.HttpPostClientProtocol.HttpPostClientProtocol -/* The following example demonstrates 'Constructor' of 'HttpPostClientProtocol' class -A variable of type 'HttpPostClientProtocol' is used to set proxy information , -client credentials and Url on the proxy class. -*/ -/* -// The following example is a proxy class generated by the Wsdl.exe utility -// for the Math Web service. The proxy class derives from -// HttpPostClientProtocol, which derives from the abstract -// HttpSimpleClientProtocol class. - -public class MyMath : System.Web.Services.Protocols.HttpPostClientProtocol -{ -[System.Diagnostics.DebuggerStepThroughAttribute()] -public MyMath() -{ -this.Url = "http://localhost/Mymath.Cs.asmx"; -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.Web.Services.Protocols.HttpMethodAttribute( -typeof(System.Web.Services.Protocols.XmlReturnReader), -typeof(System.Web.Services.Protocols.HtmlFormParameterWriter))] -[return: System.Xml.Serialization.XmlRootAttribute("int", -Namespace="http://tempuri.org/", IsNullable=false)] -public int Add(string num1, string num2) -{ -return ((int)(this.Invoke("Add", (this.Url + "/Add"), -new object[] {num1, num2}))); -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -public System.IAsyncResult BeginAdd(string num1, string num2, -System.AsyncCallback callback, object asyncState) -{ -return this.BeginInvoke("Add", (this.Url + "/Add"), -new object[] {num1, num2}, callback, asyncState); -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -public int EndAdd(System.IAsyncResult asyncResult) -{ -return ((int)(this.EndInvoke(asyncResult))); -} -} -*/ -public ref class Math: public HttpPostClientProtocol{}; - -int main() -{ - - // - // Math is a proxy class derived from HttpPostClientProtocol. - HttpPostClientProtocol^ myHttpPostClientProtocol = gcnew ::Math; - - // Obtain password from a secure store. - String^ SecurelyStoredPassword = String::Empty; - - // Set the client-side credentials using the Credentials property. - myHttpPostClientProtocol->Credentials = System::Net::CredentialCache::DefaultCredentials; - - // Allow the server to redirect the request. - myHttpPostClientProtocol->AllowAutoRedirect = true; - Console::WriteLine( "Auto redirect is: {0}", myHttpPostClientProtocol->AllowAutoRedirect ); - - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp deleted file mode 100644 index b891e831c59..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// System.Runtime.Remoting.Channels.Http.HttpClientChannel -// System.Runtime.Remoting.Channels.Http.HttpClientChannel.ChannelName; System.Runtime.Remoting.Channels.Http.HttpClientChannel.ChannelPriority; System.Runtime.Remoting.Channels.Http.HttpClientChannel.Parse(); System.Runtime.Remoting.Channels.Http.HttpClientChannel.Keys; System.Runtime.Remoting.Channels.Http.HttpClientChannel.CreateMessageSink() -/* -The following program demonstrates the 'HttpClientChannel' class and -'ChannelName','ChannelPriority' , 'Keys', properties, and 'Parse', -CreateMessageSink methods of 'HttpClientChannel' class. This program -create and registers 'HttpClientChannel'. This will change the priority -of the 'HttpClientChannel' channel and it displays the property values -of 'HttpClientChannel'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Collections; -using namespace System::Runtime::Remoting::Messaging; - -int main() -{ - try - { - // - // Creating the 'IDictionary' to set the server object properties. - IDictionary^ myDictionary = gcnew Hashtable; - myDictionary[ "name" ] = "HttpClientChannel"; - myDictionary[ "priority" ] = 2; - - // Set the properties along with the constructor. - HttpClientChannel^ myHttpClientChannel = gcnew HttpClientChannel( myDictionary,gcnew BinaryClientFormatterSinkProvider ); - - // Register the server channel. - ChannelServices::RegisterChannel( myHttpClientChannel ); - MyHelloServer ^ myHelloServer1 = dynamic_cast(Activator::GetObject( MyHelloServer::typeid, "http://localhost:8085/SayHello" )); - if ( myHelloServer1 == nullptr ) - System::Console::WriteLine( "Could not locate server" ); - else - { - Console::WriteLine( myHelloServer1->myHelloMethod( "Client" ) ); - - // Get the name of the channel. - Console::WriteLine( "Channel Name :{0}", myHttpClientChannel->ChannelName ); - - // Get the channel priority. - Console::WriteLine( "ChannelPriority :{0}", myHttpClientChannel->ChannelPriority ); - String^ myString; - String^ myObjectURI1; - Console::WriteLine( "Parse :{0}{1}", myHttpClientChannel->Parse( "http://localhost:8085/SayHello", myString ), myString ); - - // Get the key count. - System::Console::WriteLine( "Keys->Count : {0}", myHttpClientChannel->Keys->Count ); - - // Get the channel message sink that delivers message to the specified url. - IMessageSink^ myIMessageSink = myHttpClientChannel->CreateMessageSink( "http://localhost:8085/NewEndPoint", nullptr, myObjectURI1 ); - Console::WriteLine( "The channel message sink that delivers the messages to the URL is : {0}", myIMessageSink ); - Console::WriteLine( "URI of the new channel message sink is: {0}", myObjectURI1 ); - } - // - } - catch ( Exception^ ex ) - { - Console::WriteLine( "The following exception is raised on client side :{0}", ex->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp deleted file mode 100644 index e7549bfa2db..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp +++ /dev/null @@ -1,84 +0,0 @@ - - -// System.Runtime.Remoting.Channels.Http.HttpServerChannel -// System.Runtime.Remoting.Channels.Http.HttpServerChannel.StartListening(); System.Runtime.Remoting.Channels.Http.HttpServerChannel.ChannelName; System.Runtime.Remoting.Channels.Http.HttpServerChannel.ChannelPriority; System.Runtime.Remoting.Channels.Http.HttpServerChannel.ChannelScheme; System.Runtime.Remoting.Channels.Http.HttpServerChannel.GetChannelUri(); System.Runtime.Remoting.Channels.Http.HttpServerChannel.WantsToListen -// System.Runtime.Remoting.Channels.Http.HttpServerChannel.Parse(); System.Runtime.Remoting.Channels.Http.HttpServerChannel.StopListening() -/* The following program demonstrates the 'HttpServerChannel' class, 'ChannelName', -'ChannelPriority', 'ChannelScheme', 'WantsToListen' properties, 'GetChannelUri', -'StartListening', 'StopListening' and 'Parse' methods of 'HttpServerChannel' class. -This program creates and registers 'HttpServerChannel'. This will change the priority -of the 'HttpServerChannel' channel and displays the property values of this class. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -int main() -{ - try - { - String^ myString; - - // - int myPort = 8085; - - // Creating the 'IDictionary' to set the server object properties. - IDictionary^ myDictionary = gcnew Hashtable; - myDictionary[ "name" ] = "MyServerChannel1"; - myDictionary[ "priority" ] = 2; - myDictionary[ "port" ] = 8085; - - // Set the properties along with the constructor. - HttpServerChannel^ myHttpServerChannel = gcnew HttpServerChannel( myDictionary,gcnew BinaryServerFormatterSinkProvider ); - - // Register the server channel. - ChannelServices::RegisterChannel( myHttpServerChannel ); - RemotingConfiguration::RegisterWellKnownServiceType( MyHelloServer::typeid, "SayHello", WellKnownObjectMode::SingleCall ); - myHttpServerChannel->WantsToListen = true; - - // Start listening on a specific port. - myHttpServerChannel->StartListening( myPort ); - - // Get the name of the channel. - Console::WriteLine( "ChannelName : {0}", myHttpServerChannel->ChannelName ); - - // Get the channel priority. - Console::WriteLine( "ChannelPriority : {0}", myHttpServerChannel->ChannelPriority ); - - // Get the schema of the channel. - Console::WriteLine( "ChannelScheme : {0}", myHttpServerChannel->ChannelScheme ); - - // Get the channel URI. - Console::WriteLine( "GetChannelUri : {0}", myHttpServerChannel->GetChannelUri() ); - - // Indicates whether 'IChannelReceiverHook' wants to be hooked into the outside listener service. - Console::WriteLine( "WantsToListen : {0}", myHttpServerChannel->WantsToListen ); - // - - // - // Extract the channel URI and the remote well known object URI from the specified URL. - Console::WriteLine( "Parsed : {0}", myHttpServerChannel->Parse( String::Concat( myHttpServerChannel->GetChannelUri(), "/SayHello" ), myString ) ); - Console::WriteLine( "Remote WellKnownObject : {0}", myString ); - Console::WriteLine( "Hit to stop listening..." ); - Console::ReadLine(); - - // Stop listening to channel. - myHttpServerChannel->StopListening( myPort ); - // - - Console::WriteLine( "Hit to exit..." ); - Console::ReadLine(); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "The following exception is raised on server side : {0}", ex->Message ); - } - -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp deleted file mode 100644 index 6553b346e86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -namespace MyMath -{ - - [System::Web::Services::WebServiceBindingAttribute(Name="MathSoap",Namespace="http://tempuri.org/")] - public ref class Math: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - Math() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int num1, int num2 ) - { - array^temp0 = {num1,num2}; - array^results = this->Invoke( "Add", temp0 ); - return *dynamic_cast(results[ 0 ]); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp deleted file mode 100644 index 21704539710..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*System::Net::HttpVersion::Version10 -This program demonstrates the 'Version10' field of the 'HttpVersion' Class. -The 'Version' property of 'HttpRequestMessage' class identifies the Version of HTTP being used. -Then the default value of 'Version' property is displayed to the console. -The 'Version10' field of the 'HttpVersion' class is assigned to the 'Version' property of the 'HttpRequestMessage' Class. -The changed Version and the 'Version' of the response object are displayed. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Http; - -int main() -{ - try - { - // - // HttpClient lifecycle management best practices: - // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use - HttpClient^ client = gcnew HttpClient(); - - HttpRequestMessage^ request = new HttpRequestMessage(HttpMethod::Get, "http://www.microsoft.com"); - Console::WriteLine("Default HTTP request version is {0}", request.Version); - - request.Version = HttpVersion.Version10; - Console::WriteLine("Request version after assignment is {0}", request.Version); - - HttpResponseMessage^ response = client->Send(request); - Console::WriteLine("Response HTTP version {0}", response.Version); - // - Console::WriteLine("\nPress 'Enter' Key to Continue.............."); - Console::Read(); - } - catch (HttpRequestException^ e) - { - Console::WriteLine("HttpRequestException Caught!"); - Console::WriteLine("Message : {0} ", e->Message); - Console::WriteLine("Source : {0} ", e->Source); - } - catch (Exception^ e) - { - Console::WriteLine("Exception Caught!"); - Console::WriteLine("Source : {0}", e->Source); - Console::WriteLine("Message : {0}", e->Message); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp deleted file mode 100644 index 2b454542d5a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp +++ /dev/null @@ -1,78 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::Xml; - -// System.Web.Services.Protocols.HttpWebClientProtocol.UserAgent -/* The following example demonstrates 'UserAgent' member of 'HttpWebClientProtocol' -class. First the default user agent is displayed. Then the user agent is modified -and displayed. -*/ -/* -The following example is a proxy class generated by the Wsdl.exe utility -for the Math Web service. The proxy class derives from SoapHttpClientProtocol, -which derives from the abstract HttpWebClientProtocol class. - -[System.Web.Services.WebServiceBindingAttribute(Name="MyMathSoap", -Namespace="http://tempuri.org/")] -public class MyMath : System.Web.Services.Protocols.SoapHttpClientProtocol -{ -[System.Diagnostics.DebuggerStepThroughAttribute()] -public MyMath() -{ -this.Url = "http://localhost/Mymath.Cs.asmx"; -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.Web.Services.Protocols.SoapDocumentMethodAttribute( -"http://tempuri.org/Add", -Use=System.Web.Services.Description.SoapBindingUse.Literal, -ParameterStyle= -System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] -public int Add(int num1, int num2) -{ -object[] results = this.Invoke("Add", -new object[] {num1, num2}); -return ((int)(results[0])); -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -public System.IAsyncResult BeginAdd(int num1, int num2, -System.AsyncCallback callback, object asyncState) -{ -return this.BeginInvoke("Add", new object[] {num1, num2}, -callback, asyncState); -} - -[System.Diagnostics.DebuggerStepThroughAttribute()] -public int EndAdd(System.IAsyncResult asyncResult) -{ -object[] results = this.EndInvoke(asyncResult); -return ((int)(results[0])); -} -} -*/ -namespace test -{ - public ref class MyMath: public SoapHttpClientProtocol{}; - -} - -int main() -{ - - // - // MyMath is a proxy class. - test::MyMath^ objMyMath = gcnew test::MyMath; - - // Get the default user agent. - Console::WriteLine( "Default user agent is: {0}", objMyMath->UserAgent ); - objMyMath->UserAgent = "My Agent"; - Console::WriteLine( "Modified user agent is: {0}", objMyMath->UserAgent ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp deleted file mode 100644 index defe1c29135..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp +++ /dev/null @@ -1,92 +0,0 @@ -/* System::Net::HttpWebRequest::Accept -This program demonstrates 'Accept' property of the 'HttpWebRequest' class. -A new 'HttpWebRequest' Object* is created. The 'Accept' property of 'HttpWebRequest' -class is set to 'image/*' that in turn sets the 'Accept' field of HTTP Request Headers to -S"image/*". HTTP Request and Response headers are displayed to the console. -The contents of the page of the requested URI are displayed to the console. -'Accept' property is set with an aim to receive the response in a specific format. - -Note: This program requires http://localhost/CodeSnippetTest::html as Command line parameter. -If the requested page contains any content other than 'image/*' an error of 'status (406) Not Acceptable' -is returned. The functionality of 'Accept' property is supported only by servers that use HTTP 1.1 -protocol.Please refer to RFC 2616 for further information on HTTP Headers. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; - -void GetPage( String^ myUri ) -{ - try - { -// - // Create a 'HttpWebRequest' object. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); - // Set the 'Accept' property to accept an image of any type. - myHttpWebRequest->Accept = "image/*"; - // The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); -// - Console::WriteLine( "\nHTTP Request Headers :\n\n {0}", myHttpWebRequest->Headers ); - Console::WriteLine( "\nHTTP Response Headers :\n\n {0}", myHttpWebResponse->Headers ); - Console::WriteLine( "Press 'Enter' Key to Continue......." ); - Console::Read(); - // Displaying the contents of the page to the console - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuffer = gcnew array(256); - int count = streamRead->Read( readBuffer, 0, 256 ); - Console::WriteLine( "\nThe contents of HTML page are......." ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuffer,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuffer, 0, 256 ); - } - Console::WriteLine( "\nPress 'Enter' Key to Continue......" ); - Console::Read(); - streamRead->Close(); - streamResponse->Close(); - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - try - { - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the Uri address as a command line parameter" ); - Console::WriteLine( "Usage:HttpWebRequest_Accept http://www.microsoft.com/library/homepage/images/ms-banner.gif" ); - } - else - { - GetPage( args[ 1 ] ); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp deleted file mode 100644 index 1e2f153e109..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/* System::Net::HttpWebRequest::AllowAutoRedirect System::Net::HttpWebRequest->Address -This program demonstrates the 'AllowAutoRedirect' and 'Address' properties of the 'HttpWebRequest' Class. -A new 'HttpWebRequest' Object* is created. The 'AllowAutoredirect' property, which redirects a page automatically -to the new Uri, is set to true. Using the 'Address' property, the address of the 'Responding Uri' is printed to -console. The contents of the redirected page are displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// -// - // Create a new HttpWebRequest Object to the mentioned URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - myHttpWebRequest->MaximumAutomaticRedirections = 1; - myHttpWebRequest->AllowAutoRedirect = true; - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); -// - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of Html Page are : " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); - Console::WriteLine( "\nThe Requested Uri is {0}", myHttpWebRequest->RequestUri ); - Console::WriteLine( "\nThe Actual Uri responding to the request is \n {0}", myHttpWebRequest->Address ); -// - Console::WriteLine( "\nPress any Key to Continue.........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException raised!" ); - Console::WriteLine( "\nMessage: {0}", e->Message ); - Console::WriteLine( "\nStatus: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "\nSource : {0}", e->Source ); - Console::WriteLine( "\nMessage : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp deleted file mode 100644 index da5e28f5284..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/*System::Net::HttpWebRequest::AllowWriteStreamBuffering -This program demonstrates 'AllowWriteStreamBuffering' property of 'HttpWebRequestClass'. -A new 'HttpWebRequest' Object* is created. -The 'AllowWriteStreamBuffering' property value is set to false. -If the 'AllowWriteStreamBuffering' is set to false, -then 'ContentLength' property should be set to the length of data to be posted before posting the data -else the Http Status(411) Length required is returned. -Data to be posted to the Uri is requested from the user. -The 'Method' property is set to POST to be able to post data to the Uri. -The 'GetRequestStream' method of the 'HttpWebRequest' class returns a stream Object*. -This stream Object* is used to write data to the Uri. -The HTML contents of the page are displayed to the console after the posted data is accepted by the URL - -Note:This program posts data to the Uri : http://www20.brinkster.com/codesnippets/next.asp. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new 'HttpWebRequest' object to the mentioned Uri. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com/codesnippets/next.asp" ) ); - // Set AllowWriteStreamBuffering to 'false'. - myHttpWebRequest->AllowWriteStreamBuffering = false; - Console::WriteLine( "\nPlease Enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp) uri:" ); - String^ inputData = Console::ReadLine(); - String^ postData = String::Concat( "firstone= ", inputData ); - // Set 'Method' property of 'HttpWebRequest' class to POST. - myHttpWebRequest->Method = "POST"; - ASCIIEncoding^ encodedData = gcnew ASCIIEncoding; - array^ byteArray = encodedData->GetBytes( postData ); - // Set 'ContentType' property of the 'HttpWebRequest' class to S"application/x-www-form-urlencoded". - myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; - // If the AllowWriteStreamBuffering property of HttpWebRequest is set to false, the contentlength has to be set to length of data to be posted else Exception(411) is raised. - myHttpWebRequest->ContentLength = byteArray->Length; - Stream^ newStream = myHttpWebRequest->GetRequestStream(); - newStream->Write( byteArray, 0, byteArray->Length ); - newStream->Close(); - Console::WriteLine( "\nData has been posted to the Uri\n\nPlease wait for the response.........." ); - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); -// - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the Html page are : " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::WriteLine( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); - Console::WriteLine( "\nPress 'Enter' Key to Continue................." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - Console::WriteLine( "\n(The 'ContentLength' property of 'HttpWebRequest' is not set after 'AllowWriteStreamBuffering' is set to 'false'.)" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp deleted file mode 100644 index 452b35e9ca7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* System::Net::HttpWebRequest::BeginGetRequestStream, System::Net::HttpWebRequest::EndGetRequestStream - -This program demonstrates the 'BeginGetRequestStream' and 'EndGetRequestStream' methods of the 'HttpWebRequest' class. -A new 'HttpWebRequest' Object is created. The 'Method' property of the 'HttpWebRequest' Object* is set to -'POST'. The 'ContentType' property is set to S"application/x-www-form-urlencoded". Then, the 'BeginGetRequestStream' -method of 'HttpWebRequest' class starts the Asynchronous writing to the 'HttpWebRequest' Object*. The -'EndGetRequestStream' method of 'HttpWebRequest' class ends the Asynchronous writing of data and returns a -stream Object*. The 'Stream' Object* is used to write data to the 'HttpWebRequest' Object*. - -Note: This program POSTs data to the Uri: http://www20.Brinkster::com/codesnippets/next.asp -*/ -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Threading; -ref class HttpWebRequestBeginGetRequest -{ -public: - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - static void Main() - { - - // - // Create a new HttpWebRequest object. - HttpWebRequest^ request = dynamic_cast(WebRequest::Create( "http://www.contoso.com/example.aspx" )); - - // Set the ContentType property. - request->ContentType = "application/x-www-form-urlencoded"; - - // Set the Method property to 'POST' to post data to the Uri. - request->Method = "POST"; - - // Start the asynchronous operation. - AsyncCallback^ del = gcnew AsyncCallback(GetRequestStreamCallback); - request->BeginGetRequestStream( del, request ); - - // Keep the main thread from continuing while the asynchronous - // operation completes. A real world application - // could do something useful such as updating its user interface. - allDone->WaitOne(); - } - - -private: - static void GetRequestStreamCallback(IAsyncResult^ asynchronousResult) - { - HttpWebRequest^ request = dynamic_cast(asynchronousResult->AsyncState); - - // End the operation - Stream^ postStream = request->EndGetRequestStream(asynchronousResult); - - Console::WriteLine("Please enter the input data to be posted:"); - String^ postData = Console::ReadLine(); - - // Convert the string into a byte array. - array^ByteArray = Encoding::UTF8->GetBytes(postData); - - // Write to the request stream. - postStream->Write(ByteArray, 0, postData->Length); - postStream->Close(); - - // Start the asynchronous operation to get the response - AsyncCallback^ del = gcnew AsyncCallback(GetResponseCallback); - request->BeginGetResponse(del, request); - } - - static void GetResponseCallback(IAsyncResult^ asynchronousResult) - { - HttpWebRequest^ request = dynamic_cast(asynchronousResult->AsyncState); - - // End the operation - HttpWebResponse^ response = dynamic_cast(request->EndGetResponse(asynchronousResult)); - Stream^ streamResponse = response->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader(streamResponse); - String^ responseString = streamRead->ReadToEnd(); - Console::WriteLine(responseString); - // Close the stream object - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse - response->Close(); - allDone->Set(); - } - // -}; - -void main() -{ - HttpWebRequestBeginGetRequest::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp deleted file mode 100644 index fb120510b57..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp +++ /dev/null @@ -1,158 +0,0 @@ - - -// System::Net::HttpWebRequest::BeginGetResponse System::Net::HttpWebRequest::EndGetResponse -/** -* Snippet1, Snippet2, Snippet3 go together. -* This program shows how to use BeginGetResponse and EndGetResponse methods of the -* HttpWebRequest class. -* It uses an asynchronous approach to get the response for the HTTP Web Request. -* The RequestState class is defined to chekc the state of the request. -* After a HttpWebRequest Object* is created, its BeginGetResponse method is used to start -* the asynchronous response phase. -* Finally, the EndGetResponse method is used to end the asynchronous response phase . -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Threading; -public ref class RequestState -{ -private: - - // This class stores the State of the request. - const int BUFFER_SIZE; - -public: - StringBuilder^ requestData; - array^BufferRead; - HttpWebRequest^ request; - HttpWebResponse^ response; - Stream^ streamResponse; - RequestState() - : BUFFER_SIZE( 1024 ) - { - BufferRead = gcnew array(BUFFER_SIZE); - requestData = gcnew StringBuilder( "" ); - request = nullptr; - streamResponse = nullptr; - } - -}; - -ref class HttpWebRequest_BeginGetResponse -{ -public: - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - static int BUFFER_SIZE = 1024; - - // - // - static void RespCallback( IAsyncResult^ asynchronousResult ) - { - try - { - - // State of request is asynchronous. - RequestState^ myRequestState = dynamic_cast(asynchronousResult->AsyncState); - HttpWebRequest^ myHttpWebRequest2 = myRequestState->request; - myRequestState->response = dynamic_cast(myHttpWebRequest2->EndGetResponse( asynchronousResult )); - - // Read the response into a Stream object. - Stream^ responseStream = myRequestState->response->GetResponseStream(); - myRequestState->streamResponse = responseStream; - - // Begin the Reading of the contents of the HTML page and print it to the console. - IAsyncResult^ asynchronousInputRead = responseStream->BeginRead( myRequestState->BufferRead, 0, BUFFER_SIZE, gcnew AsyncCallback( ReadCallBack ), myRequestState ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nException raised!" ); - Console::WriteLine( "\nMessage: {0}", e->Message ); - Console::WriteLine( "\nStatus: {0}", e->Status ); - } - - } - - static void ReadCallBack( IAsyncResult^ asyncResult ) - { - try - { - RequestState^ myRequestState = dynamic_cast(asyncResult->AsyncState); - Stream^ responseStream = myRequestState->streamResponse; - int read = responseStream->EndRead( asyncResult ); - - // Read the HTML page and then print it to the console. - if ( read > 0 ) - { - myRequestState->requestData->Append( Encoding::ASCII->GetString( myRequestState->BufferRead, 0, read ) ); - IAsyncResult^ asynchronousResult = responseStream->BeginRead( myRequestState->BufferRead, 0, BUFFER_SIZE, gcnew AsyncCallback( ReadCallBack ), myRequestState ); - } - else - { - Console::WriteLine( "\nThe contents of the Html page are : " ); - if ( myRequestState->requestData->Length > 1 ) - { - String^ stringContent; - stringContent = myRequestState->requestData->ToString(); - Console::WriteLine( stringContent ); - } - Console::WriteLine( "Press any key to continue.........." ); - Console::ReadLine(); - responseStream->Close(); - allDone->Set(); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nException raised!" ); - Console::WriteLine( "\nMessage: {0}", e->Message ); - Console::WriteLine( "\nStatus: {0}", e->Status ); - } - - } - -}; - -int main() -{ - try - { - - // Create a HttpWebrequest object to the desired URL. - HttpWebRequest^ myHttpWebRequest1 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); - - // Create an instance of the RequestState and assign the previous myHttpWebRequest1 - // object to its request field. - RequestState^ myRequestState = gcnew RequestState; - myRequestState->request = myHttpWebRequest1; - - // Start the asynchronous request. - IAsyncResult^ result = dynamic_cast(myHttpWebRequest1->BeginGetResponse( gcnew AsyncCallback( HttpWebRequest_BeginGetResponse::RespCallback ), myRequestState )); - HttpWebRequest_BeginGetResponse::allDone->WaitOne(); - - // Release the HttpWebResponse resource. - myRequestState->response->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nException raised!" ); - Console::WriteLine( "\nMessage: {0}", e->Message ); - Console::WriteLine( "\nStatus: {0}", e->Status ); - Console::WriteLine( "Press any key to continue.........." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised!" ); - Console::WriteLine( "Source : {0} ", e->Source ); - Console::WriteLine( "Message : {0} ", e->Message ); - Console::WriteLine( "Press any key to continue.........." ); - Console::Read(); - } - -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp deleted file mode 100644 index 6d2c9db2782..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp +++ /dev/null @@ -1,94 +0,0 @@ - - -// System::Net::HttpWebRequest::KeepAlive System::Net::HttpWebRequest::Connection -/** -* This program demonstrates Connection and KeepAlive properties of the -* HttpWebRequest Class. -* Two new HttpWebRequest objects are created. The KeepAlive property of one of -* the objects is set to false that in turn sets the value of Connection field of -* the HTTP request Headers to Close. -* The Connection property of the other HttpWebRequest Object* is assigned the -* value Close. This throws an ArgumentException which is caught. The HTTP request -* Headers are displayed to the console. -* The contents of the HTML page of the requested URI are displayed. -**/ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -// -int main() -{ - try - { - - // Create a new HttpWebRequest object. Make sure that - // a default proxy is set if you are behind a firewall. - HttpWebRequest^ myHttpWebRequest1 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); - myHttpWebRequest1->KeepAlive = false; - - // Assign the response object of HttpWebRequest to a HttpWebResponse variable. - HttpWebResponse^ myHttpWebResponse1 = dynamic_cast(myHttpWebRequest1->GetResponse()); - Console::WriteLine( "\nThe HTTP request Headers for the first request are: \n {0}", myHttpWebRequest1->Headers ); - Console::WriteLine( "Press Enter Key to Continue.........." ); - Console::Read(); - Stream^ streamResponse = myHttpWebResponse1->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "The contents of the Html page are.......\n" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - Console::WriteLine(); - - // Close the Stream object. - streamResponse->Close(); - streamRead->Close(); - - // Release the resources held by response object. - myHttpWebResponse1->Close(); - - // - // Create a new HttpWebRequest object for the specified Uri. - HttpWebRequest^ myHttpWebRequest2 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); - myHttpWebRequest2->Connection = "Close"; - - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse2 = dynamic_cast(myHttpWebRequest2->GetResponse()); - - // Release the resources held by response object. - myHttpWebResponse2->Close(); - Console::WriteLine( "\nThe Http RequestHeaders are \n {0}", myHttpWebRequest2->Headers ); - - // - Console::WriteLine( "\nPress 'Enter' Key to Continue........." ); - Console::Read(); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( "\nThe second HttpWebRequest Object* has raised an Argument Exception as 'Connection' Property is set to 'Close'" ); - Console::WriteLine( "\n {0}", e->Message ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException raised!" ); - Console::WriteLine( "\n {0}", e->Message ); - Console::WriteLine( "\n {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "Source : {0} ", e->Source ); - Console::WriteLine( "Message : {0} ", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp deleted file mode 100644 index 39d85a9efc9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/* -System::Net::HttpWebRequest::Method, System::Net::HttpWebRequest::ContentLength, System::Net::HttpWebRequest::ContentType -System::Net::HttpWebRequest::GetRequestStream -This program the demonstrates 'Method', 'ContentLength', and 'ContentType' properties and the 'GetRequestStream' -method of the HttpWebRequest Class. -It creates a 'HttpWebRequest' Object*. The 'Method' property of 'HttpWebRequestClass' is set to 'POST'. -The 'ContentType' property is set to 'application/x-www-form-urlencoded'. The 'ContentLength' property -is set to the length of the Byte stream to be posted. A new 'Stream' Object* is obtained from the -'GetRequestStream' method of the 'HttpWebRequest' class. Data to be posted is requested from the user. -Data is posted using the stream Object*. The HTML contents of the page are then displayed to the console -after the Posted data is accepted by the URL. -Note: This program POSTs data to the Uri: http://www20.Brinkster::com/codesnippets/next.asp -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { - // Create a new WebRequest Object to the mentioned Uri. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com/codesnippets/next.asp" ) ); - - Console::WriteLine( "\nThe value of 'ContentLength' property before sending the data is {0}", myHttpWebRequest->ContentLength ); - -// -// - // Set the 'Method' property of the 'Webrequest' to 'POST'. - myHttpWebRequest->Method = "POST"; - Console::WriteLine( "\nPlease enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp) Uri :" ); - - // Create a new String* Object* to POST data to the Url. - String^ inputData = Console::ReadLine(); - -// -// - String^ postData = String::Concat( "firstone= ", inputData ); - ASCIIEncoding^ encoding = gcnew ASCIIEncoding; - array^ byte1 = encoding->GetBytes( postData ); - - // Set the content type of the data being posted. - myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; - - // Set the content length of the String* being posted. - myHttpWebRequest->ContentLength = byte1->Length; - - Stream^ newStream = myHttpWebRequest->GetRequestStream(); - - newStream->Write( byte1, 0, byte1->Length ); - Console::WriteLine( "The value of 'ContentLength' property after sending the data is {0}", myHttpWebRequest->ContentLength ); - - // Close the Stream Object*. - newStream->Close(); -// -// -// -// - Console::WriteLine( "\nThe String* entered is successfully posted to the Uri " ); - Console::WriteLine( "Please wait for the response......." ); - - // Assign the response Object* of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - - Console::WriteLine( "\nThe contents of the HTML page are : " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::WriteLine( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - - // Close the Stream object. - streamResponse->Close(); - streamRead->Close(); - - // Release the resources held by response Object*. - myHttpWebResponse->Close(); - Console::WriteLine( "\nPress 'Enter' Key to Continue............." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException raised!" ); - Console::WriteLine( "\n {0}", e->Message ); - Console::WriteLine( "\n {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp deleted file mode 100644 index dbc0defcc7f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/*System::Net::HttpWebRequest::Headers -This program demonstrates the 'Headers' property of 'HttpWebRequest' Class. -A new 'HttpWebRequest' Object* is created. -The (name, value) collection of the Http Headers are displayed to the console. -The contents of the HTML page of the requested URI are displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new 'HttpWebRequest' Object to the mentioned URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - Console::WriteLine( "\nThe HttpHeaders are \n\n\tName\t\tValue\n {0}", myHttpWebRequest->Headers ); - // Print the HTML contents of the page to the console. - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe HTML contents of page the are : \n\n " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); -// - Console::WriteLine( "\nPress 'Enter' Key to Continue........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - Console::WriteLine( "Status : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp deleted file mode 100644 index 2ffbd73948e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -/* -System::Net::HttpWebRequest::IfModifiedSince -This program demonstrates the 'IfModifiedSince' property of the 'HttpWebRequest' class . -A new 'HttpWebrequest' Object* is created. -A new 'DateTime' Object* is created with the value intialized to the present DateTime. -The 'IfModifiedSince' property of 'HttpWebRequest' Object* is compared with the 'DateTime' Object*. -If the requested page has been modified since the time of the DateTime Object* -then the output displays the page has been modified -else the response headers and the contents of the page of the requested Uri are printed to the Console. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -int main() -{ - try - { - - // - // Create a new 'Uri' object with the mentioned string. - Uri^ myUri = gcnew Uri( "http://www.contoso.com" ); - - // Create a new 'HttpWebRequest' object with the above 'Uri' object. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( myUri )); - - // Create a new 'DateTime' object. - DateTime targetDate = DateTime::Now; - // Set a target date of a week ago - targetDate.AddDays(-7.0); - myHttpWebRequest->IfModifiedSince = targetDate; - - try - { - - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - Console::WriteLine( "Response headers \n {0}\n", myHttpWebResponse->Headers ); - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of Html Page are : \n" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); - Console::WriteLine( "\nPress 'Enter' key to continue................." ); - Console::Read(); - } - catch ( WebException^ e ) - { - if (e->Response) - { - if ( ((HttpWebResponse ^)e->Response)->StatusCode == HttpStatusCode::NotModified) - Console::WriteLine("\nThe page has not been modified since {0}", targetDate); - else - Console::WriteLine("\nUnexpected status code = {0}", ((HttpWebResponse ^)e->Response)->StatusCode); - } - else - Console::WriteLine("\nUnexpected Web Exception {0}" + e->Message); - } -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp deleted file mode 100644 index df05ea9c022..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/*System::Net.HttpWebRequest::PipeLined -This program demonstrates 'Pipelined' property of the 'HttpWebRequest' class. -A new 'HttpWebRequest' Object* is created. The 'Pipelined' property is displayed to the console. -HTTP Request and Response Headers are displayed to the console. The contents of the page of the -requested URI are displayed to the console. - -Note:The 'Pipelined' property is supported only by servers that allow Pipelining of requests. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -void GetPage( String^ myUri ) -{ - try - { -// - // Create a 'HttpWebRequest' object. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - // Display the contents of the page to the console. - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuffer = gcnew array(256); - int count = streamRead->Read( readBuffer, 0, 256 ); - Console::WriteLine( "\nThe contents of HTML page are......." ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuffer,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuffer, 0, 256 ); - } - Console::WriteLine( "\nHTTP Request Headers :\n\n {0}", myHttpWebRequest->Headers ); - Console::WriteLine( "\nHTTP Response Headers :\n\n {0}", myHttpWebResponse->Headers ); - streamRead->Close(); - streamResponse->Close(); - // Release the response object resources. - myHttpWebResponse->Close(); - Console::WriteLine( "\n'Pipelined' property is: {0}", myHttpWebRequest->Pipelined ); - Console::WriteLine( "\nPress 'Enter' Key to Continue......" ); - Console::Read(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - try - { - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the Uri address as a command line parameter:" ); - Console::WriteLine( "->Item[ Usage:HttpWebRequest_Pipelined http://www.microsoft.com ]" ); - } - else - { - GetPage( args[ 1 ] ); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp deleted file mode 100644 index c8320fd47ff..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* System::Net::HttpWebRequest::ProtocolVersion -This Program demonstrates the 'ProtocolVersion' property of the 'HttpWebRequest' Class. -The 'ProtocolVersion' is a property that identifies the Version of the Protocol being used. -A new 'HttpWebRequest' Object* is created. Then the default version, being used is displayed onto -the console. It is then set to another version and displayed to the Console::The HTML contents -of the page of the requested Uri are printed to the console. -Note: Here the 'ProtocolVersion' property displays the ProtocolVersion being used. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new 'HttpWebRequest' Object to the mentioned URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.microsoft.com" ) ); - // Use the existing 'ProtocolVersion' , and display it onto the console. - Console::WriteLine( "\nThe 'ProtocolVersion' of the protocol used is {0}", myHttpWebRequest->ProtocolVersion ); - // Set the 'ProtocolVersion' property of the 'HttpWebRequest' to 'Version1::0' . - myHttpWebRequest->ProtocolVersion = HttpVersion::Version10; - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - Console::WriteLine( "\nThe 'ProtocolVersion' of the protocol changed to {0}", myHttpWebRequest->ProtocolVersion ); - Console::WriteLine( "\nThe protocol version of the response Object* is {0}", myHttpWebResponse->ProtocolVersion ); -// - Console::WriteLine( "\nPress any Key to Continue.............." ); - Console::Read(); - Console::Read(); - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the HTML Page are :" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); - Console::WriteLine( "\nPress any Key to Continue.............." ); - Console::Read(); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException raised!" ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - Console::WriteLine( "\nStatus: {0} ", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException raised!" ); - Console::WriteLine( "\nSource : {0}", e->Source ); - Console::WriteLine( "\nMessage : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp deleted file mode 100644 index b5053d05743..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp +++ /dev/null @@ -1,89 +0,0 @@ -/*System::Net::HttpWebRequest::Referer -This program demonstrates the 'Referer' property of the 'HttpWebRequest' class. -A new 'HttpWebRequest' Object* is created. The 'Referer' property is displayed to the console. -HTTP Request and Response Headers are displayed to the console. The contents of the page of the -requested URI are displayed to the console. - -Note: The 'Referer' property is used by the server to store the address of the Uri that has referred -the request to that server.Please refer to RFC 2616 for more information on HTTP Headers. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -void GetPage( String^ myUri ) -{ - try - { -// - // Create a 'HttpWebRequest' object. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); - // Set referer property to http://www.microsoft.com . - myHttpWebRequest->Referer = "http://www.microsoft.com"; - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - // Display the contents of the page to the console. - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuffer = gcnew array(256); - int count = streamRead->Read( readBuffer, 0, 256 ); - Console::WriteLine( "\nThe contents of HTML page are......." ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuffer,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuffer, 0, 256 ); - } - Console::WriteLine( "\nHTTP Request Headers :\n\n {0}", myHttpWebRequest->Headers ); - Console::WriteLine( "\nHTTP Response Headers :\n\n {0}", myHttpWebResponse->Headers ); - streamRead->Close(); - streamResponse->Close(); - // Release the response object resources. - myHttpWebResponse->Close(); - Console::WriteLine( "Referer to the site is: {0}", myHttpWebRequest->Referer ); -// - Console::WriteLine( "\nPress 'Enter' Key to Continue......" ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - try - { - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the Uri address as a command line parameter" ); - Console::WriteLine( "->Item[ Usage:HttpWebRequest_Referer http://www.microsoft.com ]" ); - } - else - { - GetPage( args[ 1 ] ); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp deleted file mode 100644 index a5409b84b58..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* -System::Net::HttpWebRequest::SendChunked -System::Net::HttpWebRequest::TransferEncoding -This program demonstrates the 'TransferEncoding' and 'SendChunked' properties of the 'HttpWebRequest' class. -A new 'HttpWebRequest' Object* is created. The 'SendChunked' property value is set to 'true' and the -'TransferEncoding' property is set to S"gzip". If the 'TransferEncoding' property is set with 'SendChunked' -property set to 'false' then 'InvalidOperationException' is raised. Data to be posted to the Uri is -requested from the user. The HTML contents of the page are displayed to the console after the posted -data is accepted by the URL - -Note: This program requires http://localhost/CodeSnippetTest::asp as command-line parameter. -If the 'TransferEncoding' of type 'gzip' is not implemented by the server an error of status -'(501) Not implemented' is returned. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -void GetPage( String^ myUri ) -{ - try - { -// -// - // A new 'HttpWebRequest' object is created. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); - myHttpWebRequest->SendChunked = true; - // 'TransferEncoding' property is set to 'gzip'. - myHttpWebRequest->TransferEncoding = "gzip"; - Console::WriteLine( "\nPlease Enter the data to be posted to the (http:///CodeSnippetTest::asp) uri:" ); - String^ inputData = Console::ReadLine(); - String^ postData = String::Concat( "testdata= ", inputData ); - // 'Method' property of 'HttpWebRequest' class is set to POST. - myHttpWebRequest->Method = "POST"; - ASCIIEncoding^ encodedData = gcnew ASCIIEncoding; - array^ byteArray = encodedData->GetBytes( postData ); - // 'ContentType' property of the 'HttpWebRequest' class is set to S"application/x-www-form-urlencoded". - myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; - // 'ContentLength' property is set to Length of the data to be posted. - myHttpWebRequest->ContentLength = byteArray->Length; - Stream^ newStream = myHttpWebRequest->GetRequestStream(); - newStream->Write( byteArray, 0, byteArray->Length ); - newStream->Close(); - Console::WriteLine( "\nData has been posted to the Uri\n\nPlease wait for the response.........." ); - // The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - // Displaying the contents of the page to the console - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the HTML page are : " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::WriteLine( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamRead->Close(); - streamResponse->Close(); - myHttpWebResponse->Close(); -// -// - Console::WriteLine( "\nPress 'Enter' Key to Continue................." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - try - { - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the Uri address as a command line parameter:" ); - Console::WriteLine( "[ Usage:HttpWebRequest_Sendchunked http:///CodeSnippetTest.asp ]" ); - } - else - { - GetPage( args[ 1 ] ); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp deleted file mode 100644 index 3d42654bab4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/*System::Net::HttpWebRequest::Time->Item[Out] -This program demonstrates the 'Timeout' property of the HttpWebRequest Class. -A new HttpWebRequest Object is created. The default value of the 'Timeout' property is printed to the console. -It is then set to some value and displayed to the console. If the 'Timeout' property is set to a value less -than the time required to get the response an 'Exception' is raised. The 'Timeout' property measures the time in -milliseconds. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new 'HttpWebRequest' Object to the mentioned URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - Console::WriteLine( "\nThe timeout time of the request before setting the property is {0} milliseconds.", myHttpWebRequest->Timeout ); - // Set the 'Timeout' property of the HttpWebRequest to 10 milliseconds. - myHttpWebRequest->Timeout = 10; - // Display the 'Timeout' property of the 'HttpWebRequest' on the console. - Console::WriteLine( "\nThe timeout time of the request after setting the timeout is {0} milliseconds.", myHttpWebRequest->Timeout ); - // A HttpWebResponse object is created and is GetResponse Property of the HttpWebRequest associated with it - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); -// - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the HTML page are, " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); - Console::WriteLine( "\nPress any Key to Continue............." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException raised!" ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - Console::WriteLine( "\nStatus: {0} ", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "\nSource : {0}", e->Source ); - Console::WriteLine( "\nMessage : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp deleted file mode 100644 index 3ef82849abc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/*System::Net::HttpWebRequest::UserAgent -This program demonstrates the 'UserAgent' property of the 'HttpWebRequest' class. -A new 'HttpWebRequest' Object* is created. The 'UserAgent' property is set to -"Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; COM+ 1.0.2702)". -This in turn sets the 'User-Agent' field of HTTP Request headers. -The response is obtained and displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; - -int main() -{ - try - { -// - // Create a new 'HttpWebRequest' object to the mentioned URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); - myHttpWebRequest->UserAgent = ".NET Framework Test Client"; - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - // Display the contents of the page to the console. - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of HTML Page are :\n" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamRead->Close(); - streamResponse->Close(); - myHttpWebResponse->Close(); -// - Console::WriteLine( "\nHTTP Request Headers :\n {0}", myHttpWebRequest->Headers ); - Console::WriteLine( "\nUserAgent is: {0}", myHttpWebRequest->UserAgent ); - Console::WriteLine( "\nPress 'Enter' Key to Continue..........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Message : {0} ", e->Message ); - Console::WriteLine( "Status : {0} ", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp deleted file mode 100644 index d91c5e15fe4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// System::Net::HttpWebResponse::Close -/* This program demonstrates the 'Close' method of the 'HttpWebResponse' class. -It creates a web request and queries for a response. The response Object* can be processed as desired. -The program then closes the response Object* and releases resources associated with it. -*/ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url ) -{ - try - { -// - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); - // Sends the HttpWebRequest and waits for a response. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - Console::WriteLine( "\nResponse Received::Trying to Close the response stream.." ); - // Releases the resources of the response. - myHttpWebResponse->Close(); - Console::WriteLine( "\nResponse Stream successfully closed" ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_Close http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp deleted file mode 100644 index 3b3d5bf4ec6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ -// - try - { - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - - Console::WriteLine( "The encoding method used is: {0}", myHttpWebResponse->ContentEncoding ); - Console::WriteLine( "The character set used is : {0}", myHttpWebResponse->CharacterSet ); - - char separator = '/'; - String^ contenttype = myHttpWebResponse->ContentType; - // Retrieve 'text' if the content type is of 'text/html. - String^ maintype = contenttype->Substring( 0, contenttype->IndexOf( separator ) ); - // Display only 'text' type. - if ( String::Compare( maintype, "text" ) == 0 ) - { - Console::WriteLine( "\n Content type is 'text'." ); -// - -// - Stream^ receiveStream = myHttpWebResponse->GetResponseStream(); - Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); - StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); - - Console::WriteLine( "\r\nResponse stream received." ); - array^ read = gcnew array(256); - - int count = readStream->Read( read, 0, 256 ); - Console::WriteLine( "\nText retrieved from the URL follows:\r\n" ); - - int index = 0; - while ( index < myHttpWebResponse->ContentLength ) - { - // Dump the 256 characters on a string and display the string onto the console. - String^ str = gcnew String( read,0,count ); - Console::WriteLine( str ); - index += count; - count = readStream->Read( read, 0, 256 ); - } - receiveStream->Close(); - Console::WriteLine( "" ); - } - // Release the resources of response object. - myHttpWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_ContentLength_ContentType http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp deleted file mode 100644 index 30522491953..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// System::Net::HttpWebResponse::GetResponseHeader -/* This program demonstrates the 'GetResponseHeader' method of the 'HttpWebResponse' class. -It creates a web request and queries for a response. If the site requires authentication it -will respond with a challenge String* which is extracted using 'GetResponse()' method. -*/ - -#using - -using namespace System; -using namespace System::Net; - -// -void GetPage( String^ url ) -{ - try - { - Uri^ ourUri = gcnew Uri( url ); - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( ourUri ) ); - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - Console::WriteLine( "\nThe server did not issue any challenge. Please try again with a protected resource URL." ); - // Releases the resources of the response. - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - HttpWebResponse^ response = (HttpWebResponse^)( e->Response ); - if ( response != nullptr ) - { - if ( response->StatusCode == HttpStatusCode::Unauthorized ) - { - String^ challenge = nullptr; - challenge = response->GetResponseHeader( "WWW-Authenticate" ); - if ( challenge != nullptr ) - Console::WriteLine( "\nThe following challenge was raised by the server: {0}", challenge ); - } - else - { - Console::WriteLine( "\nThe following WebException was raised : {0}", e->Message ); - } - } - else - { - Console::WriteLine( "\nResponse Received from server was 0" ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} -// - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter a protected resource url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_GetResponseHeader http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp deleted file mode 100644 index 06388e73b74..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// System::Net::HttpWebResponse::GetResponseStream -/* This program demonstrates the 'GetResponseStream' method of the 'HttpWebResponse' class. -It creates a web request and queries for a response. It then gets the response stream. -This response stream is piped to a higher level stream reader. The reader reads 256 characters at a time, -writes them into a String* and then displays the String* in the console. */ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ - try - { -// - // Creates an HttpWebRequest with the specified URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); - // Sends the HttpWebRequest and waits for the response. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - // Gets the stream associated with the response. - Stream^ receiveStream = myHttpWebResponse->GetResponseStream(); - Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); - // Pipes the stream to a higher level stream reader with the required encoding format. - StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); - Console::WriteLine( "\r\nResponse stream received." ); - array^ read = gcnew array(256); - // Reads 256 characters at a time. - int count = readStream->Read( read, 0, 256 ); - Console::WriteLine( "HTML...\r\n" ); - while ( count > 0 ) - { - // Dumps the 256 characters on a String* and displays the String* to the console. - String^ str = gcnew String( read,0,count ); - Console::Write( str ); - count = readStream->Read( read, 0, 256 ); - } - Console::WriteLine( "" ); - // Releases the resources of the response. - myHttpWebResponse->Close(); - // Releases the resources of the Stream. - readStream->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_GetResponseStream http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp deleted file mode 100644 index 29ad6442cd2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// System::Net::HttpWebResponse::Headers - -/* This program demonstrates the 'Headers' property of the 'HttpWebResponse' class -It creates a web request and queries for a response. It then displays all the response headers -onto the console. */ -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url ) -{ - try - { - // - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); - - // Sends the HttpWebRequest and waits for response. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Displays all the headers present in the response received from the URI. - Console::WriteLine( "\r\nThe following headers were received in the response:" ); - - // Displays each header and its key associated with the response. - for ( int i = 0; i < myHttpWebResponse->Headers->Count; ++i ) - Console::WriteLine( "\nHeader Name: {0}, Value : {1}", - myHttpWebResponse->Headers->Keys[ i ], - myHttpWebResponse->Headers[ (System::Net::HttpRequestHeader)i ] ); - - // Releases the resources of the response. - myHttpWebResponse->Close(); - // - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_Headers http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp deleted file mode 100644 index 07b78aa598f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System::Net::HttpWebResponse::LastModified -/* This program demonstrates the 'LastModified' property of the 'HttpWebResponse' class -It creates a web request and queries for a response. The program checks -if the entity requested was modified any time today. -*/ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url ) -{ - try - { -// - Uri^ myUri = gcnew Uri( url ); - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) - { - Console::WriteLine( "\r\nRequest succeeded and the requested information is in the response , Description : {0}", - myHttpWebResponse->StatusDescription ); - } - DateTime today = DateTime::Now; - // Uses the LastModified property to compare with today's date. - if ( DateTime::Compare( today, myHttpWebResponse->LastModified ) == 0 ) - { - Console::WriteLine( "\nThe requested URI entity was modified today" ); - } - else if ( DateTime::Compare( today, myHttpWebResponse->LastModified ) == 1 ) - { - Console::WriteLine( "\nThe requested URI was last modified on: {0}", - myHttpWebResponse->LastModified ); - } - // Releases the resources of the response. - myHttpWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease type the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_LastModified http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp deleted file mode 100644 index 527ce130a0f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// System::Net::HttpWebResponse::Method;System::Net::HttpWebResponse::Server -/* This program demonstrates the 'Method' and 'Server' properties of the 'HttpWebResponse' class. -It creates a Web request and queries for a response. It evaluates the response method used and the prints -the Web server name to the console*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ -// -// - try - { - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - String^ method; - method = myHttpWebResponse->Method; - if ( String::Compare( method, "GET" ) == 0 ) - { - Console::WriteLine( "\nThe 'GET' method was successfully invoked on the following Web Server : {0}", - myHttpWebResponse->Server ); - } - // Releases the resources of the response. - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -// -// -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_Method_Server http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp deleted file mode 100644 index 932674a8594..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// System::Net::HttpWebResponse::ProtocolVersion -/* This program demonstrates the 'ProtocolVersion' property of the 'HttpWebResponse' class. -It creates a web request and queries for a response. The server should respond using the same version */ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url ) -{ - try - { -// - Uri^ ourUri = gcnew Uri( url ); - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( ourUri ) ); - myHttpWebRequest->ProtocolVersion = HttpVersion::Version10; - // Sends the HttpWebRequest and waits for the response. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - // Ensures that only Http/1.0 responses are accepted. - if ( myHttpWebResponse->ProtocolVersion != HttpVersion::Version10 ) - { - Console::WriteLine( "\nThe server responded with a version other than Http/1.0" ); - } - else if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) - { - Console::WriteLine( "\nRequest sent using version Http/1.0. Successfully received response with version HTTP/1.0 " ); - } - // Releases the resources of the response. - myHttpWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_ProtocolVersion http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp deleted file mode 100644 index 96ee68302ee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// System::Net::HttpWebResponse::ResponseUri -/*This program demonstrates the 'ResponseUri' property of the 'HttpWebResponse' class -It creates a web request and queries for a response. It checks if the original Uri -was redirected by the server. */ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url ) -{ - try - { -// - Uri^ myUri = gcnew Uri( url ); - // Create a 'HttpWebRequest' object for the specified url. - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); - // Send the request and wait for response. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); - if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) - { - Console::WriteLine( "\nRequest succeeded and the requested information is in the response , Description : {0}", - myHttpWebResponse->StatusDescription ); - } - if ( myUri->Equals( myHttpWebResponse->ResponseUri ) ) - { - Console::WriteLine( "\nThe Request Uri was not redirected by the server" ); - } - else - { - Console::WriteLine( "\nThe Request Uri was redirected to : {0}", myHttpWebResponse->ResponseUri ); - } - // Release resources of response Object*. - myHttpWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_ResponseUri http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp deleted file mode 100644 index 21dba8b604f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// System::Net::HttpWebResponse::StatusCode; System::Net::HttpWebResponse::StatusDescription - -/* This program demonstrates the 'StatusCode' and 'StatusDescription' property of the 'HttpWebResponse' class. -It creates a web request and queries for a response. */ - -#using - -using namespace System; -using namespace System::Net; - -// -// -void GetPage( String^ url ) -{ - try - { - // Creates an HttpWebRequest for the specified URL. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); - // Sends the HttpWebRequest and waits for a response. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) - { - Console::WriteLine( "\r\nResponse Status Code is OK and StatusDescription is: {0}", - myHttpWebResponse->StatusDescription ); - } - // Releases the resources of the response. - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); - } -} -// -// - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the url as command line parameter" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "HttpWebResponse_StatusCode_StatusDescription http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp deleted file mode 100644 index ebd4e3a0178..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp +++ /dev/null @@ -1,78 +0,0 @@ - - -/*System::Net::HttpWebRequest::HaveResponse - -This program demonstrates 'HaveResponse' property of 'HttpWebRequest' Class. -A new 'HttpWebRequest' is created. -The 'HaveResponse' property is a ReadOnly, boolean property that indicates -whether the Request Object* has received any response or not. -The default value of 'HaveResponse' property of the 'HttpWebRequest' is displayed to the console. -The HttpWebResponse variable is assigned the response Object* of 'HttpWebRequest'. -The HaveReponse property is tested for its value. -If there is a response then the HTML contents of the page of the requested Uri are displayed to the console -else a message 'The response is not received' is displayed to the console. - -*/ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; -int main() -{ - try - { - - // - // Create a new 'HttpWebRequest' Object. - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); - HttpWebResponse^ myHttpWebResponse; - - // Display the 'HaveResponse' property of the 'HttpWebRequest' object to the console. - Console::WriteLine( "\nThe value of 'HaveResponse' property before a response object is obtained : {0}", myHttpWebRequest->HaveResponse ); - - // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. - myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - if ( myHttpWebRequest->HaveResponse ) - { - Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of Html Page are : \n" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse Resource. - myHttpWebResponse->Close(); - Console::WriteLine( "\nPress 'Enter' key to continue.........." ); - Console::Read(); - } - else - { - Console::WriteLine( "\nThe response is not received " ); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught" ); - Console::WriteLine( "\nSource : {0}", e->Source ); - Console::WriteLine( "\nMessage : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp b/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp deleted file mode 100644 index 28631707a47..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/*System::Net::HttpWebRequest::Proxy -This program demonstrates the 'Proxy' property of the 'HttpWebRequest' class. -A 'HttpWebRequest' Object* and a 'Proxy' Object* is created. The Proxy Object is then assigned to -the 'Proxy' property of the 'HttpWebRequest' Object* and printed onto the console (this is the default -Proxy setting).New Proxy address and the credentials are requested from the User::A new Proxy Object* is -then constructed from the supplied inputs. Then the 'Proxy' property of the request is associated with the new -Proxy Object*. -Note: No credentials are required if the Proxy does not require any authentication. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new request to the mentioned URL. - HttpWebRequest ^ myWebRequest = - (HttpWebRequest ^) (WebRequest::Create("http://www.microsoft.com")); - - // Obtain the 'Proxy' of the Default browser. - IWebProxy ^ proxy = myWebRequest->Proxy; - // Print the Proxy Url to the console. - if (proxy) - { - Console::WriteLine("Proxy: {0}", - proxy->GetProxy(myWebRequest->RequestUri)); - } - else - { - Console::WriteLine("Proxy is null; no proxy will be used"); - } - - WebProxy ^ myProxy = gcnew WebProxy; - - Console::WriteLine("\nPlease enter the new Proxy Address that is to be set:"); - Console::WriteLine("(Example:http://myproxy.example.com:port)"); - String ^ proxyAddress; - - try - { - proxyAddress = Console::ReadLine(); - if (proxyAddress->Length > 0) { - Console::WriteLine("\nPlease enter the Credentials "); - Console::WriteLine("Username:"); - String ^ username; - username = Console::ReadLine(); - Console::WriteLine("\nPassword:"); - String ^ password; - password = Console::ReadLine(); - // Create a new Uri object. - Uri ^ newUri = gcnew Uri(proxyAddress); - // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set. - myProxy->Address = newUri; - // Create a NetworkCredential object and associate it with the Proxy property of request object. - myProxy->Credentials = - gcnew NetworkCredential(username, password); - myWebRequest->Proxy = myProxy; - } - Console::WriteLine("\nThe Address of the new Proxy settings are {0}", - myProxy->Address); - HttpWebResponse ^ myWebResponse = - (HttpWebResponse ^) (myWebRequest->GetResponse()); -// - - // Print the HTML contents of the page to the console. - Stream ^ streamResponse = myWebResponse->GetResponseStream(); - StreamReader ^ streamRead = gcnew StreamReader(streamResponse); - array < Char > ^readBuff = gcnew array < Char > (256); - int count = streamRead->Read(readBuff, 0, 256); - Console::WriteLine("\nThe contents of the HTML pages are :"); - while (count > 0) { - String ^ outputData = gcnew String(readBuff, 0, count); - Console::Write(outputData); - count = streamRead->Read(readBuff, 0, 256); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myWebResponse->Close(); - Console::WriteLine("\nPress any key to continue........."); - Console::Read(); - } - catch(UriFormatException ^ e) - { - Console::WriteLine("\nUriFormatException is thrown. Message: {0}", - e->Message); - Console::WriteLine("\nThe format of the Proxy address you entered is invalid"); - Console::WriteLine("\nPress any key to continue........."); - Console::Read(); - } - } - catch(WebException ^ e) - { - Console::WriteLine("\nWebException raised!"); - Console::WriteLine("\nMessage: {0} ", e->Message); - Console::WriteLine("\nStatus: {0} ", e->Status); - } - catch(Exception ^ e) - { - Console::WriteLine("\nException is raised. "); - Console::WriteLine("\nMessage: {0} ", e->Message); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp deleted file mode 100644 index dc8a4fff2a6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// System.Runtime.Remoting.Channels.IChannelDataStore -// System.Runtime.Remoting.Channels.IChannelDataStore.ChannelUris -// System.Runtime.Remoting.Channels.IChannelDataStore.Item[object] - -/* The following example demonstrates 'ChannelUris', 'Item' and 'IChannelDataStore' -class. -In the example after registering the channel, the object is registered with remoting -infrastructure by calling 'RemotingServices.Marshal' method. After registering the -object the channel information is obtained. From the channel information the required -'IChannelInfo' is collected and displayed. -*/ - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Services; - -// Marshal ByRef Object class. -public ref class MyServiceClass: public MarshalByRefObject -{ -public: - String^ HelloWorld() - { - return "Hello World"; - } -}; - -int main() -{ - // - // - TcpChannel^ myChannel = gcnew TcpChannel( 8085 ); - ChannelServices::RegisterChannel( myChannel ); - MyServiceClass^ myService = gcnew MyServiceClass; - - // After the channel is registered, register the object - // with remoting infrastructure by calling Marshal method. - ObjRef^ myObjRef = RemotingServices::Marshal( myService, "TcpService" ); - - // Get the information contributed by active channel. - IChannelInfo^ myChannelInfo = myObjRef->ChannelInfo; - IChannelDataStore^ myIChannelData; - System::Collections::IEnumerator^ myEnum = myChannelInfo->ChannelData->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ myChannelData = safe_cast(myEnum->Current); - if ( dynamic_cast(myChannelData) ) - { - myIChannelData = dynamic_cast(myChannelData); - System::Collections::IEnumerator^ myEnum1 = myIChannelData->ChannelUris->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - String^ myUri = safe_cast(myEnum1->Current); - Console::WriteLine( "Channel Uris are -> {0}", myUri ); - } - String^ myKey = "Key1"; - myIChannelData[ myKey ] = "My Data"; - Console::WriteLine( myIChannelData[ myKey ] ); - } - } - // - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp deleted file mode 100644 index d2e8a8d8aaa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp +++ /dev/null @@ -1,141 +0,0 @@ - - - -// System.Runtime.Remoting.Channels.IChannelReceiverHook -// System.Runtime.Remoting.Channels.IChannelReceiverHook.WantsToListen -// System.Runtime.Remoting.Channels.IChannelReceiverHook.ChannelScheme - -/* -This example demonstrates the implementation of the 'ChannelScheme' and -'WantsToListen' properties of the 'IChannelReceiverHook' interface. -It creates a customized channel 'MyCustomChannel' by implementing -'IChannelReceiverHook' interface. -*/ - - - -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -// -// Implementation of 'IChannelReceiverHook' interface. -public ref class MyCustomChannel: public IChannelReceiverHook -{ -private: - bool portSet; - -public: - // Constructor for MyCustomChannel. - MyCustomChannel( int /*port*/ ) - { - MyChannelScheme = "http"; - portSet = true; - } - - // Constructor for MyCustomChannel. - MyCustomChannel() - { - MyChannelScheme = "http"; - portSet = false; - } - - property bool WantsToListen - { - // - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual bool get() - { - if ( portSet ) - { - return false; - } - else - { - return true; - } - } - } - // - - // -private: - String^ MyChannelScheme; - -public: - property String^ ChannelScheme - { - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual String^ get() - { - return MyChannelScheme; - } - } - // - - property IServerChannelSink^ ChannelSinkChain - { - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual IServerChannelSink^ get() - { - - // Null implementation. - return nullptr; - } - } - - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual void AddHookChannelUri( String^ /*channelUri*/ ) - { - // Null implementation. - } -}; -// - -int main() -{ - try - { - MyCustomChannel^ myCustomChannelWithPort = gcnew MyCustomChannel( 8085 ); - MyCustomChannel^ myCustomChannelNoPort = gcnew MyCustomChannel; - Console::WriteLine( "Channel Scheme of myCustomChannelWithPort : {0}", - myCustomChannelWithPort->ChannelScheme ); - Console::WriteLine( "Channel Scheme of myCustomChannelNoPort : {0}", - myCustomChannelNoPort->ChannelScheme ); - // 'WantsToListen' is false. It is already listening. - if ( myCustomChannelWithPort->WantsToListen ) - { - Console::WriteLine( "myCustomChannelWithPort wants to listen." ); - } - else - { - Console::WriteLine( "myCustomChannelWithPort doesn't want to listen." ); - } - if ( myCustomChannelNoPort->WantsToListen ) - { - Console::WriteLine( "myCustomChannelNoPort wants to listen." ); - } - else - { - Console::WriteLine( "myCustomChannelNoPort doesn't want to listen." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp deleted file mode 100644 index 76ced6cc1ed..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp +++ /dev/null @@ -1,174 +0,0 @@ - - -// System.Runtime.Remoting.Channels.IChannelReceiver -// System.Runtime.Remoting.Channels.IChannelReceiver.ChannelData -// System.Runtime.Remoting.Channels.IChannelReceiver.GetUrlsForUri -// System.Runtime.Remoting.Channels.IChannelReceiver.StartListening -// System.Runtime.Remoting.Channels.IChannelReceiver.StopListening -/* -This example implements the 'ChannelData' property and 'GetUrlsForUri', -'StartListening' and 'StopListening' method of 'IChannelReceiver' interface. -It creates a server by implementing 'IChannelReceiver' interface to receive -request send by the client. -*/ -#using -#using - -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Threading; -using namespace System::Net::Sockets; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Text::RegularExpressions; - -// -ref class MyCustomChannel: public IChannelReceiver -{ -private: - ChannelDataStore^ myChannelData; - int myChannelPriority; - - // Set the 'ChannelName' to 'MyCustomChannel'. - String^ myChannelName; - - // Implement 'ChannelName' property. - TcpListener^ myTcpListener; - int myPortNo; - bool myListening; - Thread^ myThread; - -public: - MyCustomChannel() - : myChannelPriority( 25 ), myChannelName( "tcp" ), myListening( false ) - {} - - MyCustomChannel( int portNo ) - { - myPortNo = portNo; - array^myURI = gcnew array(1); - myURI[ 0 ] = String::Concat( Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ], ":", portNo ); - - // Store the 'URI' in 'myChannelDataStore'. - myChannelData = gcnew ChannelDataStore( myURI ); - - // Create 'myTcpListener' to listen at the 'myPortNo' port. - myTcpListener = gcnew TcpListener( myPortNo ); - - // Create the thread 'myThread'. - myThread = gcnew Thread( gcnew ThreadStart( myTcpListener, &TcpListener::Start ) ); - this->StartListening( nullptr ); - } - - property String^ ChannelName - { - virtual String^ get() - { - return myChannelName; - } - } - - property int ChannelPriority - { - virtual int get() - { - return myChannelPriority; - } - } - virtual String^ Parse( String^ myUrl, [Out]String^% objectURI ) - { - Regex^ myRegex = gcnew Regex( "/",RegexOptions::RightToLeft ); - - // Check for '/' in 'myUrl' from Right to left. - Match^ myMatch = myRegex->Match(myUrl); - - // Get the object URI. - objectURI = myUrl->Substring( myMatch->Index ); - - // Return the channel url. - return myUrl->Substring( 0, myMatch->Index ); - } - - // Implementation of 'IChannelReceiver' interface. - // - property Object^ ChannelData - { - virtual Object^ get() - { - return myChannelData; - } - } - // - - // - // Create and send the object URL. - virtual array^ GetUrlsForUri( String^ objectURI ) - { - array^myString = gcnew array(1); - myString[ 0 ] = String::Concat( Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ], "/", objectURI ); - return myString; - } - // - - // - // Start listening to the port. - virtual void StartListening( Object^ data ) - { - if ( !myListening ) - { - myTcpListener->Start(); - myListening = true; - Console::WriteLine( "Server Started Listening !!!" ); - } - } - // - - // - // Stop listening to the port. - virtual void StopListening( Object^ data ) - { - if ( myListening ) - { - myTcpListener->Stop(); - myListening = false; - Console::WriteLine( "Server Stopped Listening !!!" ); - } - } - // -}; -// - -int main() -{ - MyCustomChannel^ myChannel = gcnew MyCustomChannel( 8085 ); - ChannelDataStore^ myChannelDataStore = (ChannelDataStore^)myChannel->ChannelData; - Console::WriteLine( "The channel URI is {0}", myChannelDataStore->ChannelUris[ 0 ] ); - array^myUrlArray = myChannel->GetUrlsForUri( "SayHello" ); - Console::WriteLine( "The URL for the objectURI is {0}", myUrlArray[ 0 ] ); - bool continueOption = true; - while ( continueOption ) - { - Console::WriteLine( "" ); - Console::WriteLine( "Select a option .." ); - Console::WriteLine( " 1 - StartListening" ); - Console::WriteLine( " 2 - StopListening" ); - Console::WriteLine( " 3 - Exit" ); - Console::Write( "Option : " ); - int myOption = Int32::Parse( Console::ReadLine() ); - switch ( myOption ) - { - case 1: - myChannel->StartListening( nullptr ); - break; - - case 2: - myChannel->StopListening( nullptr ); - break; - - case 3: - continueOption = false; - break; - } - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp deleted file mode 100644 index f75401a16a4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// System.Runtime.Remoting.Channels.IChannelSender -// System.Runtime.Remoting.Channels.IChannelSender.CreateMessageSink() -/* The following program demonstrates the usage of IChannelSender -interface and its 'CreateMessageSink' method in the namespace -'System.Runtime.Remoting.Channels'. This program creates and -registers an IChannelSender of type 'HttpClientChannel'. -It sets the priority of the channel and it displays the -property values of 'HttpClientChannel'. */ -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Channels::Http; -int main() -{ - try - { - - // Create the 'IDictionary' to set the server object properties. - IDictionary^ myDictionary = gcnew Hashtable; - myDictionary->default[ "name" ] = "HttpClientChannel"; - myDictionary->default[ "priority" ] = 2; - - // Set the properties along with the constructor. - IChannelSender^ myIChannelSender = gcnew HttpClientChannel( myDictionary,gcnew BinaryClientFormatterSinkProvider ); - - // Register the server channel. - ChannelServices::RegisterChannel( myIChannelSender, false ); - MyHelloServer ^ myHelloServer1 = dynamic_cast(Activator::GetObject( MyHelloServer::typeid, "http://localhost:8085/SayHello" )); - if ( myHelloServer1 == nullptr ) - { - Console::WriteLine( "Could not locate server" ); - } - else - { - Console::WriteLine( myHelloServer1->myHelloMethod( "Client" ) ); - - // Get the name of the channel. - Console::WriteLine( "Channel Name :{0}", myIChannelSender->ChannelName ); - - // Get the channel priority. - Console::WriteLine( "ChannelPriority :{0}", myIChannelSender->ChannelPriority ); - String^ myString; - String^ myObjectURI1; - Console::WriteLine( "Parse :{0}{1}", myIChannelSender->Parse( "http://localhost:8085/SayHello", myString ), myString ); - - // - // Get the channel message sink that delivers message to specified url. - IMessageSink^ myIMessageSink = myIChannelSender->CreateMessageSink( "http://localhost:8085/NewEndPoint", nullptr, myObjectURI1 ); - Console::WriteLine( "Channel message sink used :{0}", myIMessageSink ); - - // - Console::WriteLine( "URI of new channel message sink :{0}", myObjectURI1 ); - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Following exception is raised on client side : {0}", ex->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp b/snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp deleted file mode 100644 index 3e874fd030b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* -This program demonstrates the 'GetCredential' method of the 'ICredentials*' interface. -The 'CredentialList' class implements the 'ICredentials*' interface, which stores credentials for multiple -internet resources. The program takes URL, Username, Password, and Domain name from command line and adds -it to an instance of the 'CredentialList' class. An instance of the 'WebRequest' class is obtained and the 'Credentials' -property of the 'WebRequest' class is set to an instance of the 'NetworkCredential' class obtained by calling the -'GetCredential' method of the 'CredentialList' class. Then it sends the request and obtains a response. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Collections; - -// -ref class CredentialList: public ICredentials -{ -private: - ref class CredentialInfo - { - public: - Uri^ uriObj; - String^ authenticationType; - NetworkCredential^ networkCredentialObj; - CredentialInfo( Uri^ uriObj, String^ authenticationType, NetworkCredential^ networkCredentialObj ) - { - this->uriObj = uriObj; - this->authenticationType = authenticationType; - this->networkCredentialObj = networkCredentialObj; - } - }; - - ArrayList^ arrayListObj; - -public: - CredentialList() - { - arrayListObj = gcnew ArrayList; - } - - void Add( Uri^ uriObj, String^ authenticationType, NetworkCredential^ credential ) - { - - // Add a 'CredentialInfo' object into a list. - arrayListObj->Add( gcnew CredentialInfo( uriObj,authenticationType,credential ) ); - } - - // Remove the 'CredentialInfo' object from the list that matches to the given 'Uri' and 'AuthenticationType' - void Remove( Uri^ uriObj, String^ authenticationType ) - { - for ( int index = 0; index < arrayListObj->Count; index++ ) - { - CredentialInfo^ credentialInfo = dynamic_cast(arrayListObj[ index ]); - if ( uriObj->Equals( credentialInfo->uriObj ) && authenticationType->Equals( credentialInfo->authenticationType ) ) - arrayListObj->RemoveAt( index ); - } - } - - virtual NetworkCredential^ GetCredential( Uri^ uriObj, String^ authenticationType ) - { - for ( int index = 0; index < arrayListObj->Count; index++ ) - { - CredentialInfo^ credentialInfoObj = dynamic_cast(arrayListObj[ index ]); - if ( uriObj->Equals( credentialInfoObj->uriObj ) && authenticationType->Equals( credentialInfoObj->authenticationType ) ) - return credentialInfoObj->networkCredentialObj; - } - return nullptr; - } -}; -// - -void GetPage( String^ urlString, String^ UserName, String^ password, String^ DomainName ) -{ - try - { - CredentialList^ credentialListObj = gcnew CredentialList; - - // Dummy names used as credentials. - credentialListObj->Add( gcnew Uri( urlString ), - "Basic", gcnew NetworkCredential( UserName,password,DomainName ) ); - credentialListObj->Add( gcnew Uri( "http://www.msdn.microsoft.com" ), - "Basic", gcnew NetworkCredential( "User1","Passwd1","Domain1" ) ); - - // Create a 'WebRequest' for the specified url. - WebRequest^ myWebRequest = WebRequest::Create( urlString ); - - // Call 'GetCredential' to obtain the credentials specific to a Uri. - myWebRequest->Credentials = credentialListObj->GetCredential( gcnew Uri( urlString ), "Basic" ); - - // Send the request and get the response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // ....Process the response here. - Console::WriteLine( "\n Response Received." ); - myWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException caught !!!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught !!!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} - -int main() -{ - String^ urlString; - String^ username; - String^ password; - String^ domainname; - Console::Write( "Enter a URL(for e.g. http://www.microsoft.com : " ); - urlString = Console::ReadLine(); - Console::Write( "Enter User name : " ); - username = Console::ReadLine(); - Console::Write( "Enter Password :" ); - password = Console::ReadLine(); - Console::Write( "Enter Domain name : " ); - domainname = Console::ReadLine(); - GetPage( urlString, username, password, domainname ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp deleted file mode 100644 index e1b40ce138a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -// System::Runtime::Remoting::Lifetime.ILease* -// System::Runtime::Remoting::Lifetime.ILease*.InitialLeaseTime -// System::Runtime::Remoting::Lifetime.ILease*.CurrentLeaseTime -// System::Runtime::Remoting::Lifetime.ILease*.RenewOnCallTime -// System::Runtime::Remoting::Lifetime.ILease*.SponsorshipTimeout -//System::Runtime::Remoting::Lifetime.ILease*.CurrentState -// System::Runtime::Remoting::Lifetime.ILease*.Register(ISponsor*) -// System::Runtime::Remoting::Lifetime.ILease*.Renew(TimeSpam) -// System::Runtime::Remoting::Lifetime.ILease*.Unregister(ISponsor*) -// System::Runtime::Remoting::Lifetime.ILease*.Register(ISponsor*, TimeSpam) -/* The following example demonstrates 'InitialLeaseTime', 'CurrentLeaseTime', -'RenewOnCallTime', 'SponsorshipTimeout', 'CurrentState', 'Register', 'Renew', -'Unregister' and 'Register' methods of 'ClientSponsor' class. - -In the example using 'RemotingServices::GetLifetimeService' the lease information -of the remote service is obtained. All the properties and methods 'ILease' are demonstrated -using this lease variable. The client registers itself with 'ClientSponsor' class. -After registeration the current lease time is displayed. The lease is expired -and renewed. Then the renewed lease time is displayed. Finally the client unregister itself. -The client again registers itself. This time with initial lease time mentioned at -the time of registeration. The lease time is displayed. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Lifetime; -using namespace RemotingSamples; - -// -int main() -{ - // - // Register the channel. - TcpChannel^ myChannel = gcnew TcpChannel; - ChannelServices::RegisterChannel( myChannel ); - RemotingConfiguration::RegisterActivatedClientType( HelloService::typeid, "Tcp://localhost:8085" ); - TimeSpan myTimeSpan = TimeSpan::FromMinutes( 10 ); - - // Create a remote object. - HelloService ^ myService = gcnew HelloService; - ILease^ myLease; - myLease = dynamic_cast(RemotingServices::GetLifetimeService( myService )); - if ( myLease == nullptr ) - { - Console::WriteLine( "Cannot lease." ); - return -1; - } - - Console::WriteLine( "Initial lease time is {0}", myLease->InitialLeaseTime ); - Console::WriteLine( "Current lease time is {0}", myLease->CurrentLeaseTime ); - Console::WriteLine( "Renew on call time is {0}", myLease->RenewOnCallTime ); - Console::WriteLine( "Sponsorship timeout is {0}", myLease->SponsorshipTimeout ); - Console::WriteLine( "Current lease state is {0}", myLease->CurrentState ); - // - - // Register with a sponser. - ClientSponsor^ mySponsor = gcnew ClientSponsor; - myLease->Register( mySponsor ); - Console::WriteLine( "Wait for lease to expire (approx. 15 seconds)..." ); - System::Threading::Thread::Sleep( myLease->CurrentLeaseTime ); - Console::WriteLine( "Current lease time before renewal is {0}", myLease->CurrentLeaseTime ); - - // Renew the lease time. - myLease->Renew( myTimeSpan ); - Console::WriteLine( "Current lease time after renewal is {0}", myLease->CurrentLeaseTime ); - - // Call the Remote method. - Console::WriteLine( "Remote method output is {0}", myService->HelloMethod( "Microsoft" ) ); - myLease->Unregister( mySponsor ); - GC::Collect(); - GC::WaitForPendingFinalizers(); - - // Register with lease time of 15 minutes. - myLease->Register( mySponsor, TimeSpan::FromMinutes( 15 ) ); - Console::WriteLine( "Registered client with lease time of 15 minutes." ); - Console::WriteLine( "Current lease time is {0}", myLease->CurrentLeaseTime ); - - // Call the Remote method. - Console::WriteLine( "Remote method output is {0}", myService->HelloMethod( "Microsoft" ) ); - myLease->Unregister( mySponsor ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp b/snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp deleted file mode 100644 index 22fe13cf2f0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp +++ /dev/null @@ -1,149 +0,0 @@ - - -// System.Runtime.Remoting.Messaging.IMessage -// System.Runtime.Remoting.Messaging.IMessage.Properties -// System.Runtime.Remoting.Messaging.IMessageSink -// System.Runtime.Remoting.Messaging.IMessageSink.SyncProcessMessage(IMessage) -/* The following example demonstrates 'IMessage.Properties', 'IMessage' interface, -'IMessageSink.SyncProcessMessage' and 'IMessageSink' interface. -In the example the MyProxy is derived from 'RealProxy' class. In MyProxy -'MessageSink' is created using 'CreateMessageSink' method of 'IChannelSender' -interface. The 'IMessageSink' return by 'CreateMessageSink' is used to demonstrate -'IMessageSink.SyncProcessMessage' of 'IMessageSink' interface. The 'Invoke' method -is overridden in 'MyProxy' class.to demonstrate its properties. -*/ -// -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Threading; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Permissions; -using namespace Share; - -public ref class MyProxy: public RealProxy -{ -private: - String^ myUrl; - String^ myObjectURI; - IMessageSink^ myMessageSink; - -public: - [System::Security::Permissions::PermissionSetAttribute(System::Security::Permissions::SecurityAction::LinkDemand)] - - MyProxy( Type^ myType, String^ myUrl1 ) - : RealProxy( myType ) - { - myUrl = myUrl1; - array^myRegisteredChannels = ChannelServices::RegisteredChannels; - IEnumerator^ myEnum = myRegisteredChannels->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - IChannel^ channel = safe_cast(myEnum->Current); - if ( dynamic_cast(channel) ) - { - IChannelSender^ myChannelSender = dynamic_cast(channel); - myMessageSink = myChannelSender->CreateMessageSink( myUrl, nullptr, myObjectURI ); - if ( myMessageSink != nullptr ) - break; - } - } - - if ( myMessageSink == nullptr ) - { - throw gcnew Exception( String::Format( "A supported channel could not be found for myUrl1:{0}", myUrl ) ); - } - } - - virtual IMessage^ Invoke( IMessage^ myMesg ) override - { - Console::WriteLine( "MyProxy.Invoke Start" ); - if ( dynamic_cast(myMesg) ) - Console::WriteLine( "IMethodCallMessage" ); - - if ( dynamic_cast(myMesg) ) - Console::WriteLine( "IMethodReturnMessage" ); - - - // - Console::WriteLine( "Message Properties" ); - IDictionary^ myDictionary = myMesg->Properties; - IDictionaryEnumerator^ myEnum = dynamic_cast(myDictionary->GetEnumerator()); - while ( myEnum->MoveNext() ) - { - Object^ myKey = myEnum->Key; - String^ myKeyName = myKey->ToString(); - Object^ myValue = myEnum->Value; - Console::WriteLine( "{0} : {1}", myKeyName, myEnum->Value ); - if ( myKeyName->Equals( "__Args" ) ) - { - array^myArgs = (array^)myValue; - for ( int myInt = 0; myInt < myArgs->Length; myInt++ ) - Console::WriteLine( "arg: {0} myValue: {1}", myInt, myArgs[ myInt ] ); - } - - if ( (myKeyName->Equals( "__MethodSignature" )) && (nullptr != myValue) ) - { - array^myArgs = (array^)myValue; - for ( int myInt = 0; myInt < myArgs->Length; myInt++ ) - Console::WriteLine( "arg: {0} myValue: {1}", myInt, myArgs[ myInt ] ); - } - } - - Console::WriteLine( "myUrl1 {0} object URI{1}", myUrl, myObjectURI ); - myDictionary->default[ "__Uri" ] = myUrl; - Console::WriteLine( "URI {0}", myDictionary->default[ "__URI" ] ); - - // - // - IMessage^ myRetMsg = myMessageSink->SyncProcessMessage( myMesg ); - if ( dynamic_cast(myRetMsg) ) - { - IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast(myRetMsg); - } - - - // - Console::WriteLine( "MyProxy.Invoke - Finish" ); - return myRetMsg; - } - -}; - - -// -// Main function that drives the whole sample -// -int main() -{ - ChannelServices::RegisterChannel( gcnew HttpChannel, false ); - Console::WriteLine( "Remoting Sample:" ); - Console::WriteLine( "Generate a new MyProxy using the Type" ); - Type^ myType = MyHelloService::typeid; - String^ myUrl1 = "http://localhost/myServiceAccess.soap"; - MyProxy^ myProxy = gcnew MyProxy( myType,myUrl1 ); - Console::WriteLine( "Obtain the transparent proxy from myProxy" ); - MyHelloService^ myService = dynamic_cast(myProxy->GetTransparentProxy()); - Console::WriteLine( "Calling the Proxy" ); - String^ myReturnString = myService->myFunction( "bill" ); - Console::WriteLine( "Checking result : {0}", myReturnString ); - if ( myReturnString->Equals( "Hi there bill, you are using .NET Remoting" ) ) - { - Console::WriteLine( "myService.HelloMethod PASSED : returned {0}", myReturnString ); - } - else - { - Console::WriteLine( "myService.HelloMethod FAILED : returned {0}", myReturnString ); - } -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp deleted file mode 100644 index bf01660d3c3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp +++ /dev/null @@ -1,108 +0,0 @@ - - -// System::Runtime::Remoting::IMethodCallMessage -// System::Runtime::Remoting::IMethodCallMessage.InArgCount -// System::Runtime::Remoting::IMethodCallMessage.InArgs -// System::Runtime::Remoting::IMethodCallMessage.GetArgName(int) -// System::Runtime::Remoting::IMethodCallMessage.GetInArg(int) -/* -The following example demonstrates 'GetInArg', 'GetArgName', 'InArgCount' and 'InArgs' -members of 'IMethodCallMessage*' interface. -In this example custom proxy is accessed by passing message to the Invoke method. -In invoke method check the type of message. If the type is IMethodCallMessage*, then -InArgCount, InArgs, GetArgName(int) and GetInArg(int) of the interface are displayed. -This example also shows how to create a custom proxy. -*/ -// -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; - -// MyProxy extends the CLR Remoting RealProxy. -// In the same class, in the Invoke method, the methods and properties of the -// IMethodCallMessage are demonstrated. - -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::LinkDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::InheritanceDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - -public ref class MyProxy: public RealProxy -{ -public: - MyProxy( Type^ myType ) - : RealProxy( myType ) - { - // This constructor forwards the call to base RealProxy. - // RealProxy uses the Type to generate a transparent proxy. - } - - // - virtual IMessage^ Invoke( IMessage^ myIMessage ) override - { - Console::WriteLine( "MyProxy::Invoke Start" ); - Console::WriteLine( "" ); - ReturnMessage^ myReturnMessage = nullptr; - if ( dynamic_cast(myIMessage) ) - { - Console::WriteLine( "Message is of type 'IMethodCallMessage*'." ); - Console::WriteLine( "" ); - IMethodCallMessage^ myIMethodCallMessage; - myIMethodCallMessage = dynamic_cast(myIMessage); - Console::WriteLine( "InArgCount is : {0}", myIMethodCallMessage->InArgCount ); - IEnumerator^ myEnum = myIMethodCallMessage->InArgs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ myObj = safe_cast(myEnum->Current); - Console::WriteLine( "InArgs is : {0}", myObj ); - } - - for ( int i = 0; i < myIMethodCallMessage->InArgCount; i++ ) - { - Console::WriteLine( "GetArgName({0}) is : {1}", i, myIMethodCallMessage->GetArgName( i ) ); - Console::WriteLine( "GetInArg({0}) is : {0}", i, myIMethodCallMessage->GetInArg( i ) ); - - } - Console::WriteLine( "" ); - } - else - if ( dynamic_cast(myIMessage) ) - Console::WriteLine( "Message is of type 'IMethodReturnMessage*'." ); - - // Build Return Message - myReturnMessage = gcnew ReturnMessage( 5,nullptr,0,nullptr,dynamic_cast(myIMessage) ); - Console::WriteLine( "MyProxy::Invoke - Finish" ); - return myReturnMessage; - } -}; - -// The class used to obtain Metadata. -public ref class MyMarshalByRefClass: public MarshalByRefObject -{ -public: - int MyMethod( String^ str, double dbl, int i ) - { - Console::WriteLine( "MyMarshalByRefClass::MyMethod {0} {1} {2}", str, dbl, i ); - return 0; - } - -}; -// - -// Main routine that drives the whole sample. -int main() -{ - Console::WriteLine( "Generate a new MyProxy." ); - MyProxy^ myProxy = gcnew MyProxy( MyMarshalByRefClass::typeid ); - Console::WriteLine( "Obtain the transparent proxy from myProxy." ); - MyMarshalByRefClass^ myMarshalByRefClassObj = dynamic_cast(myProxy->GetTransparentProxy()); - Console::WriteLine( "Calling the Proxy." ); - Object^ myReturnValue = myMarshalByRefClassObj->MyMethod( "Microsoft", 1.2, 6 ); - Console::WriteLine( "Sample Done." ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp deleted file mode 100644 index 2b4d9d392c7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// System::Runtime::Remoting::Messaging.IMethodMessage*.LogicalCallContext -// System::Runtime::Remoting::Messaging.IMethodMessage*.Uri - -/* -The program demonstrates the 'LogicalCallContext' and 'Uri' properties of -the IMethodMessage* interface. -In the program a remote Object* is created with a method by extending 'MarshalByRefObject'. -A custom proxy is created by extending 'RealProxy' and overriding 'Invoke' -method of 'RealProxy'. In this example custom proxy is accessed by passing message -to the Invoke method. Then the values of 'Uri' and 'LogicalCallContext' properties -are displayed to the console. -*/ - -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Permissions; - -// MyProxy extends the CLR Remoting RealProxy. -// This demonstrate the RealProxy extensiblity. -// -//This sample requires full trust -[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")] -public ref class MyProxy: public RealProxy -{ -private: - String^ stringUri; - MarshalByRefObject^ targetObject; - -public: - MyProxy( Type^ type ) - : RealProxy( type ) - { - targetObject = dynamic_cast(Activator::CreateInstance( type )); - ObjRef^ myObject = RemotingServices::Marshal( targetObject ); - stringUri = myObject->URI; - } - - MyProxy( Type^ type, MarshalByRefObject^ targetObject ) - : RealProxy( type ) - { - this->targetObject = targetObject; - } - - // - virtual IMessage^ Invoke( IMessage^ message ) override - { - message->Properties[ "__Uri" ] = stringUri; - IMethodMessage^ myMethodMessage = dynamic_cast(ChannelServices::SyncDispatchMessage( message )); - Console::WriteLine( "---------IMethodMessage* example-------" ); - Console::WriteLine( "Method name : {0}", myMethodMessage->MethodName ); - Console::WriteLine( "LogicalCallContext has information : {0}", myMethodMessage->LogicalCallContext->HasInfo ); - Console::WriteLine( "Uri : {0}", myMethodMessage->Uri ); - return myMethodMessage; - } - // -}; -// - - -[AttributeUsage(AttributeTargets::Class)] -[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")] -public ref class MyProxyAttribute: public ProxyAttribute -{ -public: - MyProxyAttribute(){} - - virtual MarshalByRefObject^ CreateInstance( Type^ serverType ) override - { - if ( serverType->IsMarshalByRef ) - { - MarshalByRefObject^ targetObject = dynamic_cast(Activator::CreateInstance( serverType )); - MyProxy^ proxy = gcnew MyProxy( serverType,targetObject ); - return dynamic_cast(proxy->GetTransparentProxy()); - } - else - throw gcnew Exception( "Proxies only work on MarshalByRefObject objects and their children" ); - } -}; - -public ref class Zip: public MarshalByRefObject, public ILogicalThreadAffinative -{ -public: - Zip(){} - - int Method1( int i ) - { - return i; - } -}; - -int main() -{ - MyProxy^ proxy = gcnew MyProxy( Zip::typeid ); - Zip^ myZip = dynamic_cast(proxy->GetTransparentProxy()); - CallContext::SetData( "USER", gcnew Zip ); - myZip->Method1( 6 ); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp deleted file mode 100644 index fc6f65fff23..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// System::Runtime::Remoting::Messaging.IMethodMessage* -// System::Runtime::Remoting::Messaging.IMethodMessage*.MethodName -// System::Runtime::Remoting::Messaging.IMethodMessage*.ArgCount -// System::Runtime::Remoting::Messaging.IMethodMessage*.GetArgName -// System::Runtime::Remoting::Messaging.IMethodMessage*.GetArg -// System::Runtime::Remoting::Messaging.IMethodMessage*.HasVarArgs -// System::Runtime::Remoting::Messaging.IMethodMessage*.Args - -/* -The following program demonstrates the 'MethodName', 'ArgCount', 'HasVarArgs', -'Args' properties, 'GetArgName', 'GetArg' methods of 'IMethodMessage*' interface and -'IMethodMessage*' interface. -In this example custom proxy is accessed by passing message to the Invoke method. -The Invoke method calls the methods and properties of 'IMethodMessage*' interface -and displays the result to the console. -*/ - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Permissions; - -public ref class Reverser: public MarshalByRefObject -{ -private: - String^ stringReversed; - -public: - String^ GetReversedString() - { - return stringReversed; - } - - void SetString( String^ temp ) - { - DoReverse( temp ); - } - -private: - - // Exposed reverse as a method to reverse a String*. - void DoReverse( String^ argString ) - { - stringReversed = ""; - for ( int i = argString->Length - 1; i >= 0; i-- ) - { - stringReversed += argString[i]; - } - } -}; - -// -// This class requires full trust -[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")] -public ref class MyProxyClass: public RealProxy -{ -private: - Object^ myObjectInstance; - Type^ myType; - -public: - MyProxyClass( Type^ argType ) - : RealProxy( argType ) - { - myType = argType; - myObjectInstance = Activator::CreateInstance( argType ); - } - - // - // Overriding the Invoke method of RealProxy. - virtual IMessage^ Invoke( IMessage^ message ) override - { - IMethodMessage^ myMethodMessage = dynamic_cast(message); - Console::WriteLine( "**** Begin Invoke ****" ); - Console::WriteLine( "\tType is : {0}", myType ); - Console::WriteLine( "\tMethod name : {0}", myMethodMessage->MethodName ); - for ( int i = 0; i < myMethodMessage->ArgCount; i++ ) - { - Console::WriteLine( "\tArgName is : {0}", myMethodMessage->GetArgName( i ) ); - Console::WriteLine( "\tArgValue is: {0}", myMethodMessage->GetArg( i ) ); - - } - if ( myMethodMessage->HasVarArgs ) - Console::WriteLine( "\t The method have variable arguments!!" ); - else - Console::WriteLine( "\t The method does not have variable arguments!!" ); - - - // Dispatch the method call to the real Object*. - Object^ returnValue = myType->InvokeMember( myMethodMessage->MethodName, BindingFlags::InvokeMethod, nullptr, myObjectInstance, myMethodMessage->Args ); - Console::WriteLine( "**** End Invoke ****" ); - - // Build the return message to pass back to the transparent proxy. - ReturnMessage^ myReturnMessage = gcnew ReturnMessage( returnValue,nullptr,0,nullptr,dynamic_cast(message) ); - return myReturnMessage; - } - // -}; -// - -int main() -{ - MyProxyClass^ myProxy = gcnew MyProxyClass( Reverser::typeid ); - - // The real proxy dynamically creates a transparent proxy. - Reverser^ myReverser = dynamic_cast(myProxy->GetTransparentProxy()); - myReverser->SetString( "Hello World!" ); - Console::WriteLine( "The [Out] result is : {0}", myReverser->GetReversedString() ); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp deleted file mode 100644 index de64597d5f1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.Exception - -/* -The following example demonstrates 'Exception' property of 'IMethodReturnMessage*'interface. -A 'CustomServer' class is defined extending 'MarshalByRefObject'. A custom proxy -is created by extending 'RealProxy' and overriding 'Invoke' method of 'RealProxy'. -The Invoke method calls the methods and properties of 'IMethodMessage*' interface -and display the 'Exception' property value of 'IMethodReturnMessage*' interface to -the console. -*/ - -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; - -public ref class CustomServer: public MarshalByRefObject -{ -public: - void RaiseException() - { - throw gcnew Exception( "Raising an exception." ); - } -}; - -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::LinkDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::InheritanceDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -public ref class MyProxy: public RealProxy -{ -private: - String^ _URI; - MarshalByRefObject^ myMarshalByRefObject; - -public: - MyProxy( Type^ myType ) : RealProxy( myType ) - { - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( myType )); - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - _URI = myObjRef->URI; - } - - // - virtual IMessage^ Invoke( IMessage^ myMessage ) override - { - IMethodCallMessage^ myCallMessage = dynamic_cast(myMessage); - - IMethodReturnMessage^ myIMethodReturnMessage = - RemotingServices::ExecuteMessage( myMarshalByRefObject, myCallMessage ); - if ( myIMethodReturnMessage->Exception != nullptr ) - { - Console::WriteLine( "{0} raised an exception.", - myIMethodReturnMessage->MethodName ); - } - else - { - Console::WriteLine( "{0} does not raise an exception.", - myIMethodReturnMessage->MethodName ); - } - - return myIMethodReturnMessage; - } - // -}; - -int main() -{ - // Create an instance of MyProxy. - MyProxy^ myCustomProxy = gcnew MyProxy( CustomServer::typeid ); - // Get an instance of remote class. - CustomServer^ myHelloServer = dynamic_cast(myCustomProxy->GetTransparentProxy()); - try - { - // Invoke remote method. - myHelloServer->RaiseException(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp deleted file mode 100644 index b77b076d05b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// System::Runtime::Remoting::Messaging.IMethodReturnMessage* -// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.OutArgs -// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.ReturnValue -// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.OutArgCount -// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.GetOutArg -// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.GetOutArgName - -/* -The following example demonstrates 'ReturnValue', 'OutArgCount' properties, -'GetOutArg', 'GetOutArgName' methods of 'IMethodReturnMessage*' interface -and 'IMethodReturnMessage*' interface. -A custom proxy is created by extending 'RealProxy' and overriding 'Invoke' method of -'RealProxy'. The custom proxy is accessed by passing message to the Invoke method. -The Invoke method calls properties of 'IMethodReturnMessage*' interface and -prints the values to the console. -*/ - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::InteropServices; - -public ref class CustomServer: public MarshalByRefObject -{ -public: - String^ HelloMethod( String^ myString, interior_ptr myDoubleValue, - [Out]interior_ptr myIntValue ) - { - *myIntValue = 100; - return myString; - } -}; - -// -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::LinkDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -[System::Security::Permissions::SecurityPermissionAttribute -(System::Security::Permissions::SecurityAction::InheritanceDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -public ref class MyProxy: public RealProxy -{ -private: - String^ stringUri; - MarshalByRefObject^ myMarshalByRefObject; - -public: - MyProxy( Type^ myType ) : RealProxy( myType ) - { - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( myType )); - ObjRef^ myObject = RemotingServices::Marshal( myMarshalByRefObject ); - stringUri = myObject->URI; - } - - // - virtual IMessage^ Invoke( IMessage^ myMessage ) override - { - IMethodCallMessage^ myCallMessage = (IMethodCallMessage^)( myMessage ); - - IMethodReturnMessage^ myIMethodReturnMessage = - RemotingServices::ExecuteMessage( myMarshalByRefObject, myCallMessage ); - - Console::WriteLine( "Method name : {0}", myIMethodReturnMessage->MethodName ); - Console::WriteLine( "The return value is : {0}", myIMethodReturnMessage->ReturnValue ); - - // Get number of 'ref' and 'out' parameters. - int myArgOutCount = myIMethodReturnMessage->OutArgCount; - Console::WriteLine( "The number of 'ref', 'out' parameters are : {0}", - myIMethodReturnMessage->OutArgCount ); - // Gets name and values of 'ref' and 'out' parameters. - for ( int i = 0; i < myArgOutCount; i++ ) - { - Console::WriteLine( "Name of argument {0} is '{1}'.", - i, myIMethodReturnMessage->GetOutArgName( i ) ); - Console::WriteLine( "Value of argument {0} is '{1}'.", - i, myIMethodReturnMessage->GetOutArg( i ) ); - } - Console::WriteLine(); - array^myObjectArray = myIMethodReturnMessage->OutArgs; - for ( int i = 0; i < myObjectArray->Length; i++ ) - Console::WriteLine( "Value of argument {0} is '{1}' in OutArgs", - i, myObjectArray[ i ] ); - return myIMethodReturnMessage; - } - // -}; -// - -int main() -{ - // Create an instance of MyProxy. - MyProxy^ myCustomProxy = gcnew MyProxy( CustomServer::typeid ); - // Get an instance of remote class. - CustomServer^ myHelloServer = - (CustomServer^)( myCustomProxy->GetTransparentProxy() ); - double myDoubleValue = 10.5; - int myIntValue = 200; - // Invoke the remote method. - myHelloServer->HelloMethod( "Hello", &myDoubleValue, &myIntValue ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp b/snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp deleted file mode 100644 index 252026db492..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/* -This program demonstrates the 'Loopback' and 'Broadcast' field of 'IPAddress' class. -It prints the loopback IP address 127.0.0.1 and Broadcast IP address 255.255.255.255 -*/ - -#using - -using namespace System; -using namespace System::Net; - -// -void PrintLoopbackAddress() -{ - // Gets the IP loopback address and converts it to a string. - String^ IpAddressString = IPAddress::Loopback->ToString(); - Console::WriteLine( "Loopback IP address : {0}", IpAddressString ); -} -// - -// -void PrintBroadcastAddress() -{ - // Get the IP Broadcast address and convert it to string. - String^ IpAddressString = IPAddress::Broadcast->ToString(); - Console::WriteLine( "\nBroadcast IP address : {0}", IpAddressString ); -} -// - -int main() -{ - PrintLoopbackAddress(); - PrintBroadcastAddress(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp b/snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp deleted file mode 100644 index e1bb9569466..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -This program demonstrates 'NetworkToHostOrder(short)', 'NetworkToHostOrder(int)' and -'NetworkToHostOrder(long)' methods of 'IPAddress' class. -It takes a String* from commandline for each of above cases and convert it to the corresponding -primitive type(i.e. short, int, long) value. Alternatively it uses default values for each cases. -Then these values are converted from network Byte order to host Byte order by calling the -overloaded 'NetworkToHostOrder' methods of 'IPAddress' class. -*/ - -#using - -using namespace System; -using namespace System::Net; - -// -void NetworkToHostOrder_Short( short networkByte ) -{ - short hostByte; - // Converts a short value from network Byte order to host Byte order. - hostByte = IPAddress::NetworkToHostOrder( networkByte ); - Console::WriteLine( "Network Byte order to Host Byte order of {0} is {1}", networkByte, hostByte ); -} -// - -// -void NetworkToHostOrder_Integer( int networkByte ) -{ - int hostByte; - // Converts an integer value from network Byte order to host Byte order. - hostByte = IPAddress::NetworkToHostOrder( networkByte ); - Console::WriteLine( "Network Byte order to Host Byte order of {0} is {1}", networkByte, hostByte ); -} -// - -// -void NetworkToHostOrder_Long( __int64 networkByte ) -{ - __int64 hostByte; - // Converts a long value from network Byte order to host Byte order. - hostByte = IPAddress::NetworkToHostOrder( networkByte ); - Console::WriteLine( "Network Byte order to Host Byte order of {0} is {1}", networkByte, hostByte ); -} -// - -int main() -{ - try - { - short networkByteShort = 4365; - int networkByteInt = 286064640; - __int64 networkByteLong = 1228638273342013440I64; - String^ networkByteString = ""; - - Console::Write( "'Program converts Network Byte order to Host Byte order for short, int and long values'" ); - Console::Write( "\nEnter a short value for Convertion(press Enter for default, default is '4365') : " ); - networkByteString = Console::ReadLine(); - if ( networkByteString->Length > 0 ) - networkByteShort = Convert::ToInt16( networkByteString ); - NetworkToHostOrder_Short( networkByteShort ); - - networkByteString = ""; - Console::Write( "\nEnter an Integer value for Convertion(press Enter for default, default is '286064640') : " ); - networkByteString = Console::ReadLine(); - if ( networkByteString->Length > 0 ) - networkByteInt = Convert::ToInt32( networkByteString ); - NetworkToHostOrder_Integer( networkByteInt ); - - networkByteString = ""; - Console::Write( "\nEnter a long value for Convertion(press Enter for default, default is '1228638273342013440') : " ); - networkByteString = Console::ReadLine(); - if ( networkByteString->Length > 0 ) - networkByteLong = Convert::ToInt64( networkByteString ); - NetworkToHostOrder_Long( networkByteLong ); - } - catch ( FormatException^ e ) - { - Console::WriteLine( "FormatException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp b/snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp deleted file mode 100644 index c4ef78097fa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -/* -This program demonstrates the 'None' field of 'IPAddress' class. -Provides an IP address indicating that no network interface should be used. -*/ -#using - -using namespace System; -using namespace System::Net; - -// -int main() -{ - - // Gets the IP address indicating that no network interface should be used - // and converts it to a String*. - String^ address = IPAddress::None->ToString(); - Console::WriteLine( "IP address : {0}", address ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp b/snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp deleted file mode 100644 index fdaff450fae..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// System.Net.IPEndPoint.MaxPort; System.Net.IPEndPoint.MinPort; -// System.Net.IPEndPoint.AddressFamily; System.Net.IPEndPoint.IPEndPoint(long,int) -// System.Net.IPEndPoint.Address; System.Net.IPEndPoint.Port; - -/*This program demonstrates the properties 'MaxPort', 'MinPort','Address','Port' -and 'AddressFamily' and a constructor 'IPEndPoint(long,int)' of class 'IPEndPoint'. - -A procedure DoSocketGet is created which internally uses a socket to transmit http "Get" requests to a Web resource. -The program accepts a resource Url, Resolves it to obtain 'IPAddress',Constructs 'IPEndPoint' instance using this -'IPAddress' and port 80.Invokes DoSocketGet procedure to obtain a response and displays the response to a console. - -It then accepts another Url, Resolves it to obtain 'IPAddress'. Assigns this IPAddress and port to the 'IPEndPoint' -and again invokes DoSocketGet to obtain a response and display. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -using namespace System::Net::Sockets; -using namespace System::Runtime::InteropServices; - -String^ DoSocketGet( IPEndPoint^ hostIPEndPoint, String^ getString ); // forward reference - -int main() -{ - try - { - Console::Write( "\nPlease enter an INTRANET Url as shown: [e.g. www.microsoft.com]:" ); - String^ hostString1 = Console::ReadLine(); - -// -// -// -// - IPAddress^ hostIPAddress1 = (Dns::Resolve( hostString1 ))->AddressList[ 0 ]; - Console::WriteLine( hostIPAddress1 ); - IPEndPoint^ hostIPEndPoint = gcnew IPEndPoint( hostIPAddress1,80 ); - Console::WriteLine( "\nIPEndPoint information:{0}", hostIPEndPoint ); - Console::WriteLine( "\n\tMaximum allowed Port Address :{0}", IPEndPoint::MaxPort ); - Console::WriteLine( "\n\tMinimum allowed Port Address :{0}", (int^)IPEndPoint::MinPort ); - Console::WriteLine( "\n\tAddress Family :{0}", hostIPEndPoint->AddressFamily ); -// - Console::Write( "\nPress Enter to continue" ); - Console::ReadLine(); - String^ getString = String::Format( "GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", hostString1 ); - String^ pageContent = DoSocketGet( hostIPEndPoint, getString ); - if ( pageContent != nullptr ) - { - Console::WriteLine( "Default HTML page on {0} is:\r\n{1}", hostString1, pageContent ); - } -// -// -// - - Console::Write( "\n\n\nPlease enter another INTRANET Url as shown[e.g. www.microsoft.com]: " ); - String^ hostString2 = Console::ReadLine(); - -// -// - IPAddress^ hostIPAddress2 = (Dns::Resolve( hostString2 ))->AddressList[ 0 ]; - hostIPEndPoint->Address = hostIPAddress2; - hostIPEndPoint->Port = 80; - - getString = String::Format( "GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", hostString2 ); - pageContent = DoSocketGet( hostIPEndPoint, getString ); - if ( pageContent != nullptr ) - { - Console::WriteLine( "Default HTML page on {0} is:\r\n{1}", hostString2, pageContent ); - } - -// -// - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -String^ DoSocketGet( IPEndPoint^ hostIPEndPoint, String^ getString ) -{ - try - { - // Set up variables and String to write to the server. - Encoding^ ASCII = Encoding::ASCII; - - array^ byteGet = ASCII->GetBytes( getString ); - array^ recvBytes = gcnew array(256); - String^ strRetPage = nullptr; - // Create the Socket for sending data over TCP. - Socket^ mySocket = gcnew Socket( AddressFamily::InterNetwork, - SocketType::Stream,ProtocolType::Tcp ); - // Connect to host using IPEndPoint. - mySocket->Connect( hostIPEndPoint ); - // Send the GET text to the host. - mySocket->Send( byteGet, byteGet->Length, (SocketFlags)( 0 ) ); - // Receive the page, loop until all bytes are received. - Int32 byteCount = mySocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)( 0 ) ); - strRetPage = String::Concat( strRetPage, ASCII->GetString( recvBytes, 0, byteCount ) ); - while ( byteCount > 0 ) - { - byteCount = mySocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)( 0 ) ); - strRetPage = String::Concat( strRetPage, ASCII->GetString( recvBytes, 0, byteCount ) ); - } - return strRetPage; - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - Console::WriteLine( "WinSock Error : {0}", Convert::ToString( Marshal::GetLastWin32Error() ) ); - return nullptr; - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp b/snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp deleted file mode 100644 index f51adc5cf17..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/* -This program demostrates 'AddressList' property of 'IPHostEntry' class. -It takes a URL from commandline(or uses default value) and obtains a -'IPHostEntry' Object* by calling 'GetHostByName' method of 'Dns' class and -prints the host name and IP addresses associated with the specified URL. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -// -void GetIpAddressList( String^ hostString ) -{ - try - { - // Get 'IPHostEntry' object containing information - // like host name, IP addresses, aliases for a host. - IPHostEntry^ hostInfo = Dns::GetHostByName( hostString ); - Console::WriteLine( "Host name : {0}", hostInfo->HostName ); - Console::WriteLine( "IP address List : " ); - for ( int index = 0; index < hostInfo->AddressList->Length; index++ ) - Console::WriteLine( hostInfo->AddressList[ index ] ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// - -int main() -{ - String^ hostString = " "; - - // Create an instance of HostInfoSample class. - Console::Write( "Type a URL(or press Enter for default, default is 'www.microsoft.net') : " ); - hostString = Console::ReadLine(); - if ( hostString->Length > 0 ) - GetIpAddressList( hostString ); - else - GetIpAddressList( "www.microsoft.net" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp b/snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp deleted file mode 100644 index a648e8a91ee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.CreateSink() -// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.GetChannelData() -// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.Next - -/* The following program demonstrates 'CreateSink', 'GetChannelData' - methods and 'Next' property of - 'System.Runtime.Remoting.Channels.ServerChannelSinkStack' class. - It chains together two different sink providers using the 'Next' - property. The return value of 'GetChannelData()' is displayed on - the console. -*/ - -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -ref class MyServerChannelSinkStack -{ -public: - IServerChannelSinkProvider^ myIServerChannelSinkProvider; - IServerChannelSinkProvider^ myIServerChannelSinkProvider1; - IServerChannelSink^ myIServerChannelSink; - IServerChannelSink^ myIServerChannelSink1; - - void MyCreateSinkMethod() - { - Console::Write( "Press Enter to set sink providers and create sinks" ); - Console::ReadLine(); - -// -// - // Create the sink providers. - myIServerChannelSinkProvider = gcnew SoapServerFormatterSinkProvider; - myIServerChannelSinkProvider1 = gcnew BinaryServerFormatterSinkProvider; - // Create the channel sinks. - myIServerChannelSink = myIServerChannelSinkProvider->CreateSink( gcnew HttpChannel ); - myIServerChannelSinkProvider->Next = myIServerChannelSinkProvider1; - - myIServerChannelSink1 = myIServerChannelSinkProvider->Next->CreateSink( gcnew HttpChannel ); -// -// - Console::WriteLine( "Two sink providers have been set" ); - } - - void MyGetChannelDataMethod() - { -// - array^channelUri = gcnew array(5); - IChannelDataStore^ myIChannelDataStore = gcnew ChannelDataStore( channelUri ); - IChannelDataStore^ myIChannelDataStore1 = gcnew ChannelDataStore( channelUri ); - myIServerChannelSinkProvider->GetChannelData( myIChannelDataStore ); - myIServerChannelSinkProvider1->GetChannelData( myIChannelDataStore1 ); -// - - Console::WriteLine( "Number of Uris in first IChannelDataStore: {0}", - myIChannelDataStore->ChannelUris->Length ); - Console::WriteLine( "Number of Uris in second IChannelDataStore: {0}", - myIChannelDataStore1->ChannelUris->Length ); - } -}; - -int main() -{ - MyServerChannelSinkStack^ myNewServerChannelSinkStack = - gcnew MyServerChannelSinkStack; - myNewServerChannelSinkStack->MyCreateSinkMethod(); - myNewServerChannelSinkStack->MyGetChannelDataMethod(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp deleted file mode 100644 index 950c783ff0b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// System::Runtime::Remoting::Lifetime.ISponsor -// System::Runtime::Remoting::Lifetime.ISponsor.Renewal - -/* -The following program demonstrates the 'ISponsor' interface and its 'Renewal' method. -It defines 'MyClientSponsor' which implements 'ISponsor' interface. The server and -client is created. The client registers a sponsor that(after the initial lease time) -renews the lease at different time from that specified in the remote type. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Lifetime; -using namespace System::Security::Permissions; - -// -// -public ref class MyClientSponsor: public MarshalByRefObject, public ISponsor -{ -private: - DateTime lastRenewal; - -public: - MyClientSponsor() - { - lastRenewal = DateTime::Now; - } - - [SecurityPermissionAttribute(SecurityAction::LinkDemand,Flags=SecurityPermissionFlag::Infrastructure)] - virtual TimeSpan Renewal( ILease^ /* lease */ ) - { - Console::WriteLine( "Request to renew the lease time." ); - Console::WriteLine( "Time since last renewal: {0}", - DateTime::Now - lastRenewal ); - - lastRenewal = DateTime::Now; - return TimeSpan::FromSeconds( 20 ); - } -}; -// -// - -int main() -{ - // Load the configuration file. - RemotingConfiguration::Configure( "ISponsor_Client.config" ); - ClientActivatedType ^ clientActivatedObject = gcnew ClientActivatedType; - - ILease^ serverLease = (ILease^)( RemotingServices::GetLifetimeService( - clientActivatedObject ) ); - MyClientSponsor^ sponsor = gcnew MyClientSponsor; - - // Note: If you don't pass an initial time, the first request will be taken - // from the LeaseTime settings specified in the ISponsor_Server.config file. - serverLease->Register( sponsor ); - - Console::WriteLine( "Client-activated Object.\n {0}", - clientActivatedObject->RemoteMethod() ); - Console::WriteLine( "Press enter to end the client application domain." ); - Console::ReadLine(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp b/snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp deleted file mode 100644 index e161a956e00..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -// System.Runtime.Remoting.Channels.ITransportHeaders -// System.Runtime.Remoting.Channels.ITransportHeaders.Item -// System.Runtime.Remoting.Channels.ITransportHeaders.GetEnumerator() -/* The following program demonstrates the 'ITransportHeaders' interface, -its 'Item' property and 'GetEnumerator' method. It implements the 'Item' -property and 'GetEnumerator' method in a class derived from 'ITransportHeaders' -interface. It then adds a few headers to the header list and displays them. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -ref class MyITransportHeadersClass: public ITransportHeaders -{ -private: - - // - // - int myInt; - array^myDictionaryEntry; - -public: - MyITransportHeadersClass() - { - myInt = 0; - myDictionaryEntry = gcnew array(10); - } - - - property Object^ Item [Object^] - { - - // Implement the 'Item' property. - virtual Object^ get( Object^ myKey ) - { - if ( myKey != nullptr ) - { - for ( int i = 0; i <= myInt; i++ ) - if ( myDictionaryEntry[ i ].Key == myKey ) - return myDictionaryEntry[ i ].Value; - } - - return nullptr; - } - - virtual void set( Object^ myKey, Object^ value ) - { - myDictionaryEntry[ myInt ] = DictionaryEntry(myKey,value); - myInt++; - } - - } - - // Implement the 'GetEnumerator' method. - virtual IEnumerator^ GetEnumerator() - { - Hashtable^ myHashtable = gcnew Hashtable; - for ( int j = 0; j < myInt; j++ ) - myHashtable->Add( myDictionaryEntry[ j ].Key, myDictionaryEntry[ j ].Value ); - return myHashtable->GetEnumerator(); - } - - // - // -}; - -int main() -{ - try - { - - // Create and register a 'TcpChannel' object. - TcpChannel^ myTcpChannel = gcnew TcpChannel( 8085 ); - ChannelServices::RegisterChannel( myTcpChannel, false ); - RemotingConfiguration::RegisterWellKnownServiceType( MyHelloServer::typeid, "SayHello", WellKnownObjectMode::SingleCall ); - - // Create an instance of 'myITransportHeadersObj'. - MyITransportHeadersClass^ myITransportHeadersObj = gcnew MyITransportHeadersClass; - ITransportHeaders^ myITransportHeaders = dynamic_cast(myITransportHeadersObj); - - // Add items to the header list. - myITransportHeaders->default[ "Header1" ] = "TransportHeader1"; - myITransportHeaders->default[ "Header2" ] = "TransportHeader2"; - - // Get the 'ITranportHeader' item value with key 'Header2'. - Console::WriteLine( "ITransport Header item value with key 'Header2' is :{0}", myITransportHeaders->default[ "Header2" ] ); - IEnumerator^ myEnumerator = myITransportHeaders->GetEnumerator(); - Console::WriteLine( " -KEY- -VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - - // Display the 'Key' and 'Value' of the current element. - Object^ myEntry = myEnumerator->Current; - DictionaryEntry myDictionaryEntry = *dynamic_cast(myEntry); - Console::WriteLine( " {0}: {1}", myDictionaryEntry.Key, myDictionaryEntry.Value ); - } - Console::WriteLine( "Hit to exit..." ); - Console::ReadLine(); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "The following exception is raised on the server side: {0}", ex->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp b/snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp deleted file mode 100644 index 51a46703a72..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp +++ /dev/null @@ -1,87 +0,0 @@ -/* -This program demonstrates 'Credentials' property, 'GetProxy' and 'IsBypassed' methods of -IWebProxy* interface. -The 'WebProxy_Interface' class implements the 'IWebProxy*' interface. It provides an implementation for the -'GetProxy' and 'IsByPassed' methods and 'ICredentials*' property. The 'GetProxy' method returns the url -of the proxy server as specified in the constructor. The 'IsByPassed' method returns false indicating -that the proxy server must never be bypassed for any requested url. The 'ICredentials*' property stores -the credentials required by the proxy server to authenticate the actual user. -*/ - -#using - -using namespace System; -using namespace System::Net; - -// -// -// -public ref class WebProxy_Interface: public IWebProxy -{ -private: - // The credentials to be used with the web proxy. - ICredentials^ iCredentials; - - // Uri of the associated proxy server. - Uri^ webProxyUri; - -public: - WebProxy_Interface( Uri^ proxyUri ) - { - webProxyUri = proxyUri; - } - - property ICredentials^ Credentials - { - // Get and Set the Credentials property. - virtual ICredentials^ get() - { - return iCredentials; - } - virtual void set( ICredentials^ value ) - { - if ( iCredentials != value ) - { - iCredentials = value; - } - } - } - - // Return the web proxy for the specified destination (destUri). - virtual Uri^ GetProxy( Uri^ destUri ) - { - // Always use the same proxy. - return webProxyUri; - } - - // Return whether the web proxy should be bypassed for the specified destination (hostUri). - virtual bool IsBypassed( Uri^ hostUri ) - { - // Never bypass the proxy. - return false; - } -}; -// -// -// - -int main() -{ - // - WebProxy_Interface^ webProxy_Interface = gcnew WebProxy_Interface( gcnew Uri( "http://proxy.example.com" ) ); - - webProxy_Interface->Credentials = gcnew NetworkCredential( "myusername", "mypassword" ); - - Console::WriteLine( "The web proxy is : {0}", webProxy_Interface->GetProxy( gcnew Uri( "http://www.contoso.com" ) ) ); - - // Check if the webproxy can ne bypassed for the site "http://www.contoso.com". - if ( webProxy_Interface->IsBypassed( gcnew Uri( "http://www.contoso.com" ) ) ) - { - Console::WriteLine( "Web Proxy is by passed" ); - } - else - { - Console::WriteLine( "Web Proxy is not by passed" ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp b/snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp deleted file mode 100644 index a896ff5bdcf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// System::Web::Services::Description.ImportCollection -// System::Web::Services::Description.ImportCollection::Item -// System::Web::Services::Description.ImportCollection::CopyTo -// System::Web::Services::Description.ImportCollection::Contains -// System::Web::Services::Description.ImportCollection::IndexOf -// System::Web::Services::Description.ImportCollection::Remove - -/* The following program demonstrates the methods 'CopyTo', 'Contains', 'IndexOf', 'Remove' -and property 'Item' of class 'ImportCollection'. -The program reads a 'WSDL' document and gets a 'ServiceDescription' instance -An 'ImportCollection' instance is then retrieved from this 'ServiceDescription' -instance and its members have been demonstrated. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuoteService_cpp.wsdl" ); - Console::WriteLine( " ImportCollection Sample " ); - - // - // Get Import Collection. - ImportCollection^ myImportCollection = myServiceDescription->Imports; - Console::WriteLine( "Total Imports in the document = {0}", myServiceDescription->Imports->Count ); - - // Print 'Import' properties to console. - for ( int i = 0; i < myImportCollection->Count; ++i ) - Console::WriteLine( "\tImport Namespace : {0} Import Location : {1} ", - myImportCollection[ i ]->Namespace, myImportCollection[ i ]->Location ); - // - - // - array^myImports = gcnew array(myServiceDescription->Imports->Count); - - // Copy 'ImportCollection' to an array. - myServiceDescription->Imports->CopyTo( myImports, 0 ); - Console::WriteLine( "Imports that are copied to Importarray ..." ); - for ( int i = 0; i < myImports->Length; ++i ) - Console::WriteLine( "\tImport Namespace : {0} Import Location : {1} ", - myImports[ i ]->Namespace, myImports[ i ]->Location ); - // - - // - // - // - // Get Import by Index. - Import^ myImport = myServiceDescription->Imports[ myServiceDescription->Imports->Count - 1 ]; - Console::WriteLine( "Import by Index..." ); - if ( myImportCollection->Contains( myImport ) ) - { - Console::WriteLine( "Import Namespace ' {0} ' is found in 'ImportCollection'.", myImport->Namespace ); - Console::WriteLine( "Index of '{0}' in 'ImportCollection' = {1}", - myImport->Namespace, myImportCollection->IndexOf( myImport ) ); - Console::WriteLine( "Deleting Import from 'ImportCollection'..." ); - myImportCollection->Remove( myImport ); - if ( myImportCollection->IndexOf( myImport ) == -1 ) - Console::WriteLine( "Import is successfully removed from Import Collection." ); - } - // - // - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp b/snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp deleted file mode 100644 index 84b92d63c6b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// System::Web::Services::Description.ImportCollection->Add; -// System::Web::Services::Description.ImportCollection::Insert; -// System::Web::Services::Description.Import::Import(); -// System::Web::Services::Description.Import::Location; -// System::Web::Services::Description.Import::Namespace; -// System::Web::Services::Description.Import::ServiceDescription; -// System::Web::Services::Description.Import; - -/* The following example demonstrates the constructor 'Import()' and properties 'Namespace', 'Location', 'Namespace', -'ServiceDescription' of Import Class. Methods 'Add' and 'Insert' of Class 'ImportCollection' are also demonstrated. -This example uses a sample provided in WSDL specification to explain Import and ImportCollection. -It adds import instances to ImportCollection as suggested in the specification sample and enumerates the same to the console. -Note: This is an illustrative sample using an example from WSDL specification. The real world web service has been assumed. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -// -// -// -// Creates an Import object with namespace and location. -Import^ CreateImport( String^ targetNamespace, String^ targetlocation ) -{ - Import^ myImport = gcnew Import; - myImport->Location = targetlocation; - myImport->Namespace = targetNamespace; - return myImport; -} -// -// -// - -// -void PrintImportCollection( String^ fileName_wsdl ) -{ - // Read import collection properties from generated WSDL file. - ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( fileName_wsdl ); - ImportCollection^ myImportCollection = myServiceDescription1->Imports; - Console::WriteLine( "Enumerating Import Collection for file ' {0}'...", fileName_wsdl ); - - // Print Import properties to console. - for ( int i = 0; i < myImportCollection->Count; ++i ) - { - Console::WriteLine( "Namespace : {0}", myImportCollection[ i ]->Namespace ); - Console::WriteLine( "Location : {0}", myImportCollection[ i ]->Location ); - Console::WriteLine( "ServiceDescription : {0}", myImportCollection[ i ]->ServiceDescription->Name ); - } -} -// - -int main() -{ - Console::WriteLine( "Import Sample" ); - - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); - myServiceDescription->Imports->Add( CreateImport( "http://localhost/stockquote/schemas", "http://localhost/stockquote/stockquote_cpp.xsd" ) ); - // - - // Save the ServiceDescripition to an external file. - myServiceDescription->Write( "StockQuote_cpp.wsdl" ); - Console::WriteLine( "document 'StockQuote_cpp.wsdl'" ); - - // Print the import collection to the console. - PrintImportCollection( "StockQuote_cpp.wsdl" ); - - // - myServiceDescription = ServiceDescription::Read( "StockQuoteService_cpp.wsdl" ); - myServiceDescription->Imports->Insert( 0, CreateImport( "http://localhost/stockquote/definitions", "http://localhost/stockquote/stockquote_cpp.wsdl" ) ); - // - - // Save the ServiceDescripition to an external file. - myServiceDescription->Write( "StockQuoteService_cs::wsdl" ); - Console::WriteLine( "" ); - Console::WriteLine( "document 'StockQuoteService_cpp.wsdl'" ); - - //Print the import collection to the console. - PrintImportCollection( "StockQuoteService_cpp.wsdl" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp deleted file mode 100644 index 052c76a6eb8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// System.Web.Services.Protocols.LogicalMethodInfo.BeginInvoke(object,object[],AsyncCallback,object) -// System.Web.Services.Protocols.LogicalMethodInfo.EndInvoke(object,IAsyncResult) - -/* The following example demonstrates 'BeginInvoke' and 'EndInvoke' methods of -'LogicalMethodInfo' class. The 'Add' method of Math web service is called in asynchronous mode. 'BeginInvoke' -begins asynchronous invocation of method and 'EndInvoke' terminates the invocation -started by 'BeginInvoke'. The return value returned by 'Endinvoke' is displayed. - -Note: The MyMath class is a proxy class generated by the Wsdl.exe utility for -the Math Web Service. This class can also be found in SoapHttpClientProtocol Class example. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Web::Services::Protocols; -using namespace System::Security::Permissions; - -// Automatically generated proxy class for Math Web service. -// This class can also be found in the SoapHttpClientProtocol class example. -namespace MyMath -{ - using namespace System::Diagnostics; - using namespace System::Xml::Serialization; - using namespace System::Web::Services::Protocols; - using namespace System::Web::Services; - - [System::Web::Services::WebServiceBindingAttribute( - Name="MyMathSoap",Namespace="http://tempuri.org/")] - public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - MyMath() - { - this->Url = "http://localhost/Math.asmx"; - } - - [System::Web::Services::Protocols::SoapDocumentMethodAttribute( - "http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int x, int y ) - { - array^ temp2 = { x, y }; - array^ results = this->Invoke( "Add", temp2 ); - return (int)( results[ 0 ] ); - } - - System::IAsyncResult^ BeginAdd( int x, int y, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^ temp3 = {x,y}; - return this->BeginInvoke( "Add", temp3, callback, asyncState ); - } - - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^ results = this->EndInvoke( asyncResult ); - return (int)( results[ 0 ] ); - } - }; -} - -public ref class BeginInvokeClass -{ - // - // -public: - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - static void main() - { - // Get the type information. - // Note: The MyMath class is a proxy class generated by the Wsdl.exe - // utility for the Math Web service. This class can also be found in - // the SoapHttpClientProtocol class example. - Type^ myType = MyMath::MyMath::typeid; - - // Get the method info. - MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); - MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); - - // Create an instance of the LogicalMethodInfo class. - array^ temp0 = { myBeginMethod, myEndMethod }; - LogicalMethodInfo^ myLogicalMethodInfo = - ( LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async ) )[ 0 ]; - - // Get an instance of the proxy class. - MyMath::MyMath^ myMathService = gcnew MyMath::MyMath; - - // Call the MyEndIntimationMethod method to intimate the end of - // the asynchronous call. - AsyncCallback^ myAsyncCallback = gcnew AsyncCallback( MyEndIntimationMethod ); - - // Begin to invoke the Add method. - array^ temp1 = { 10, 10 }; - IAsyncResult^ myAsyncResult = myLogicalMethodInfo->BeginInvoke( - myMathService, temp1, myAsyncCallback, nullptr ); - - // Wait until invoke is complete. - myAsyncResult->AsyncWaitHandle->WaitOne(); - - // Get the result. - array^ myReturnValue; - myReturnValue = myLogicalMethodInfo->EndInvoke( myMathService, myAsyncResult ); - - Console::WriteLine( "Sum of 10 and 10 is {0}", myReturnValue[ 0 ] ); - } - - // This method will be called at the end of the asynchronous call. - static void MyEndIntimationMethod( IAsyncResult^ /*Result*/ ) - { - Console::WriteLine( "Asynchronous call on Add method finished." ); - } - // - // -}; - -int main() -{ - BeginInvokeClass::main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp deleted file mode 100644 index 6845810ce5a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp +++ /dev/null @@ -1,66 +0,0 @@ - - -// All the following have been marked as 1 snippet : Snippet1 -// System::Web::Services::Protocols.LogicalMethodInfo::LogicalMethodInfo(MethodInfo) -// System::Web::Services::Protocols.LogicalMethodInfo::DeclaringType -// System::Web::Services::Protocols.LogicalMethodInfo::Parameters -// System::Web::Services::Protocols.LogicalMethodInfo::ReturnType -// System::Web::Services::Protocols.LogicalMethodInfo::Invoke(Object*, Object*->Item[]) -// System::Web::Services::Protocols.LogicalMethodInfo -/* -This following example demonstrates the constructor, 'DeclaringType', -'Parameters', 'ReturnType' properties and 'Invoke(Object*, Object*->Item[])', -'ToString()' methods of the 'LogicalMethodInfo' class. This example -displays the declaring type, parameters, return type of a method -named 'Add' in the class named 'MyService'. - -Note : The 'LogicalMethodInfo' class should only be used with -'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain -a property named 'MethodInfo' which provides for an instance of -'LogicalMethodInfo'. If you are interested only in the reflection -of a type then use the 'System::Reflection' namespace and not this -class. This class gives information ab->Item[Out] the* method invoked for -a web service and hence should only be used as such. For example -purposes it is being showed in a more simplified scenario. -*/ -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Web::Services::Protocols; - -public ref class MyService -{ -public: - int Add( int xValue, int yValue ) - { - return (xValue + yValue); - } - -}; - -int main() -{ - Type^ myType = MyService::typeid; - MethodInfo^ myMethodInfo = myType->GetMethod( "Add" ); - LogicalMethodInfo^ myLogicalMethodInfo = gcnew LogicalMethodInfo( myMethodInfo ); - Console::WriteLine( "\nPrinting properties of method : {0}\n", myLogicalMethodInfo ); - Console::WriteLine( "\nThe declaring type of the method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0}", myLogicalMethodInfo->DeclaringType ); - Console::WriteLine( "\nThe parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); - array^myParameters = myLogicalMethodInfo->Parameters; - for ( int i = 0; i < myParameters->Length; i++ ) - { - Console::WriteLine( "\t {0}", String::Concat( myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); - } - Console::WriteLine( "\nThe return type of the method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0}", myLogicalMethodInfo->ReturnType ); - MyService^ service = gcnew MyService; - Console::WriteLine( "\nInvoking the method {0}\n", myLogicalMethodInfo->Name ); - array^values = gcnew array(2); - values[ 0 ] = 10; - values[ 1 ] = 10; - Console::WriteLine( "\tThe sum of 10 and 10 is : {0}", myLogicalMethodInfo->Invoke( service, values ) ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp deleted file mode 100644 index 3710797439f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -// All the following have been marked as 1 snippet : Snippet1 -// System::Web::Services::Protocols.LogicalMethodInfo::Create(MethodInfo) -// System::Web::Services::Protocols.LogicalMethodInfo::Name -// System::Web::Services::Protocols.LogicalMethodInfo::InParameters -// System::Web::Services::Protocols.LogicalMethodInfo::OutParameters -// System::Web::Services::Protocols.LogicalMethodInfo::IsVoid -/* -This following example demonstrates the 'Name', -'InParameters', 'OutParameters', 'IsVoid' properties and -'Create(MethodInfo)' method of the 'LogicalMethodInfo' class. -This example displays the parameters, the in parameters and -[Out] parameters. - - -Note : The 'LogicalMethodInfo' class should only be used with -'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain -a property named 'MethodInfo' which provides for an instance of -'LogicalMethodInfo'. If you are interested only in the reflection -of a type then use the 'System::Reflection' namespace and not this -class. This class gives information ab->Item[Out] the* method invoked for -a web service and hence should only be used as such. For example -purposes it is being showed in a more simplified scenario. -*/ -// -#using - -using namespace System; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; -using namespace System::Web::Services::Protocols; - -public ref class MyService -{ -public: - void MyMethod( int inParameter, [Out]interior_ptr outParameter ) - { - *outParameter = inParameter; - } -}; - -int main() -{ - Type^ myType = MyService::typeid; - MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" ); - array^temparray = {myMethodInfo}; - LogicalMethodInfo^ myLogicalMethodInfo = (LogicalMethodInfo::Create( temparray ))[ 0 ]; - Console::WriteLine( "\nPrinting parameters for the method : {0}", myLogicalMethodInfo->Name ); - Console::WriteLine( "\nThe parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); - array^myParameters = myLogicalMethodInfo->Parameters; - for ( int i = 0; i < myParameters->Length; i++ ) - { - Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); - - } - Console::WriteLine( "\nThe in parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); - myParameters = myLogicalMethodInfo->InParameters; - for ( int i = 0; i < myParameters->Length; i++ ) - { - Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); - - } - Console::WriteLine( "\nThe out parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); - myParameters = myLogicalMethodInfo->OutParameters; - for ( int i = 0; i < myParameters->Length; i++ ) - { - Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); - - } - if ( myLogicalMethodInfo->IsVoid ) - Console::WriteLine( "\nThe return type is void" ); - else - Console::WriteLine( "\nThe return type is {0}", myLogicalMethodInfo->ReturnType ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp deleted file mode 100644 index c626ad55b86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// System::Web::Services::Protocols.LogicalMethodInfo::Create(MethodInfo->Item[], LogicalMethodTypes) -// System::Web::Services::Protocols.LogicalMethodInfo::AsyncCallbackParameter -// System::Web::Services::Protocols.LogicalMethodInfo::AsyncStateParameter -// System::Web::Services::Protocols.LogicalMethodInfo::AsyncResultParameter -// System::Web::Services::Protocols.LogicalMethodInfo::BeginMethodInfo -// System::Web::Services::Protocols.LogicalMethodInfo::EndMethodInfo -// System::Web::Services::Protocols.LogicalMethodInfo::IsAsync -// System::Web::Services::Protocols.LogicalMethodTypes::Async - -/* -This following example demonstrates the 'AsyncCallbackParameter', -'AsyncResultParameter', 'AsyncStateParameter', 'BeginMethodInfo', -'EndMethodInfo', 'IsAsync' properties and -'Create(MethodInfo->Item[], LogicalMethodTypes)' method of the -'LogicalMethodInfo' class and the 'Async' enum member of the -'LogicalMethodTypes' enumeration. This example displays the callback, -result and state parameters for asynchronous methods. It also displays -the begin and end for such asynchronous methods. - -Note : The 'LogicalMethodInfo' class should only be used with -'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain -a property named 'MethodInfo' which provides for an instance of -'LogicalMethodInfo'. If you are interested only in the reflection -of a type then use the 'System::Reflection' namespace and not this -class. This class gives information ab->Item[Out] the* method invoked for -a web service and hence should only be used as such. For example -purposes it is being showed in a more simplified scenario. -*/ - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Web::Services::Protocols; - -public ref class MyService: public SoapHttpClientProtocol -{ -public: - IAsyncResult^ BeginAdd( int xValue, int yValue, AsyncCallback^ callback, Object^ asyncState ) - { - array^temp0 = {xValue,yValue}; - return this->BeginInvoke( "Add", temp0, callback, asyncState ); - } - - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } -}; - -int main() -{ - Type^ myType = MyService::typeid; - MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); - MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); - array^temp0 = {myBeginMethod,myEndMethod}; - LogicalMethodInfo^ myLogicalMethodInfo = LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async )[ 0 ]; - Console::WriteLine( "\nThe asynchronous callback parameter of method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0} : {1}", myLogicalMethodInfo->AsyncCallbackParameter->Name, myLogicalMethodInfo->AsyncCallbackParameter->ParameterType ); - Console::WriteLine( "\nThe asynchronous state parameter of method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0} : {1}", myLogicalMethodInfo->AsyncStateParameter->Name, myLogicalMethodInfo->AsyncStateParameter->ParameterType ); - Console::WriteLine( "\nThe asynchronous result parameter of method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0} : {1}", myLogicalMethodInfo->AsyncResultParameter->Name, myLogicalMethodInfo->AsyncResultParameter->ParameterType ); - Console::WriteLine( "\nThe begin method of the asynchronous method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0}", myLogicalMethodInfo->BeginMethodInfo ); - Console::WriteLine( "\nThe end method of the asynchronous method {0} is :\n", myLogicalMethodInfo->Name ); - Console::WriteLine( "\t {0}", myLogicalMethodInfo->EndMethodInfo ); - if ( myLogicalMethodInfo->IsAsync ) - Console::WriteLine( "\n {0} is asynchronous", myLogicalMethodInfo->Name ); - else - Console::WriteLine( "\n {0} is synchronous", myLogicalMethodInfo->Name ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp deleted file mode 100644 index ac1bdd162ab..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// System::Web::Services::Protocols.LogicalMethodTypes::Sync -// System::Web::Services::Protocols.LogicalMethodTypes::LogicalMethodTypes -// System::Web::Services::Protocols.LogicalMethodInfo::MethodInfo -// All the following have been grouped as one snippet : Snippet4 -// System::Web::Services::Protocols.LogicalMethodInfo::GetCustomAttribute(Type) -// System::Web::Services::Protocols.LogicalMethodInfo::GetCustomAttributes(Type) -// System::Web::Services::Protocols.LogicalMethodInfo::ReturnTypeCustomAttributeProvider -// System::Web::Services::Protocols.LogicalMethodInfo::CustomAttributeProvider - -/* -This following example demonstrates the 'MethodInfo', -'ReturnTypeCustomAttributeProvider', 'CustomAttributeProvider', -properties and 'GetCustomAttribute(Type)', -'GetCustomAttributes(Type)' methods of the 'LogicalMethodInfo' class -and 'Sync' enum member of 'LogicalMethodTypes' enumeration. -This example demonstrates custom attributes and return attributes of the -'Add' method. - -Note : The 'LogicalMethodInfo' class should only be used with -'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain -a property named 'MethodInfo' which provides for an instance of -'LogicalMethodInfo'. If you are interested only in the reflection -of a type then use the 'System::Reflection' namespace and not this -class. This class gives information ab[Out] the* method invoked for -a web service and hence should only be used as such. For example -purposes it is being showed in a more simplified scenario. -*/ - -// -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Web::Services::Protocols; - -// Define a custom attribute with one named parameter. - -[AttributeUsage(AttributeTargets::Method|AttributeTargets::ReturnValue, -AllowMultiple=true)] -public ref class MyAttribute: public Attribute -{ -private: - String^ myName; - -public: - MyAttribute( String^ name ) - { - myName = name; - } - - property String^ Name - { - String^ get() - { - return myName; - } - } -}; - -public ref class MyService -{ -public: - - [MyAttribute("This is the first sample attribute")] - [MyAttribute("This is the second sample attribute")] - [returnvalue:MyAttribute("This is the return sample attribute")] - int Add( int xValue, int yValue ) - { - return (xValue + yValue); - } -}; - -int main() -{ - // - Type^ myType = MyService::typeid; - MethodInfo^ myMethodInfo = myType->GetMethod( "Add" ); - - // - // - // Create a synchronous 'LogicalMethodInfo' instance. - array^temparray = {myMethodInfo}; - LogicalMethodInfo^ myLogicalMethodInfo = (LogicalMethodInfo::Create( temparray, LogicalMethodTypes::Sync ))[ 0 ]; - // - // - - // Display the method for which the attributes are being displayed. - Console::WriteLine( "\nDisplaying the attributes for the method : {0}\n", myLogicalMethodInfo->MethodInfo ); - // - - // Displaying a custom attribute of type 'MyAttribute' - Console::WriteLine( "\nDisplaying attribute of type 'MyAttribute'\n" ); - Object^ attribute = myLogicalMethodInfo->GetCustomAttribute( MyAttribute::typeid ); - Console::WriteLine( (dynamic_cast(attribute))->Name ); - - // Display all custom attribute of type 'MyAttribute'. - Console::WriteLine( "\nDisplaying all attributes of type 'MyAttribute'\n" ); - array^attributes = myLogicalMethodInfo->GetCustomAttributes( MyAttribute::typeid ); - for ( int i = 0; i < attributes->Length; i++ ) - Console::WriteLine( (dynamic_cast(attributes[ i ]))->Name ); - - // Display all return attributes of type 'MyAttribute'. - Console::WriteLine( "\nDisplaying all return attributes of type 'MyAttribute'\n" ); - ICustomAttributeProvider^ myCustomAttributeProvider = myLogicalMethodInfo->ReturnTypeCustomAttributeProvider; - if ( myCustomAttributeProvider->IsDefined( MyAttribute::typeid, true ) ) - { - attributes = myCustomAttributeProvider->GetCustomAttributes( true ); - for ( int i = 0; i < attributes->Length; i++ ) - if ( attributes[ i ]->GetType()->Equals( MyAttribute::typeid ) ) - Console::WriteLine( (dynamic_cast(attributes[ i ]))->Name ); - } - - // Display all the custom attributes of type 'MyAttribute'. - Console::WriteLine( "\nDisplaying all attributes of type 'MyAttribute'\n" ); - myCustomAttributeProvider = myLogicalMethodInfo->CustomAttributeProvider; - if ( myCustomAttributeProvider->IsDefined( MyAttribute::typeid, true ) ) - { - attributes = myCustomAttributeProvider->GetCustomAttributes( true ); - for ( int i = 0; i < attributes->Length; i++ ) - if ( attributes[ i ]->GetType()->Equals( MyAttribute::typeid ) ) - Console::WriteLine( (dynamic_cast(attributes[ i ]))->Name ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp deleted file mode 100644 index ce69fb86dfd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// System.Web.Services.Protocols.LogicalMethodInfo.IsBeginMethod(MethodInfo) -// System.Web.Services.Protocols.LogicalMethodInfo.IsEndMethod(MethodInfo) -/* -The following example demonstrates 'IsBeginMethod' and 'IsEndMethod' methods of 'System.Web.Services.Protocols.LogicalMethodInfo' class. The type information of methods of Math web service is taken in a varible of type MethodInfo. Then 'IsBeginMethod' and 'IsEndMethod' is used to query on created MethodInfo variable to find whether the method is begin and end method for asynchronous invocation or not. -Note: The below MyMath class is a proxy class generated by the Wsdl.exe utility for the Math Web Service. This class can be found in SoapHttpClientProtocol Class example also. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Web::Services::Protocols; - -// Automatically generated proxy class for Math Web service. -// This class can also be found in SoapHttpClientProtocol class example. -namespace MyMath -{ -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - - [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap", - Namespace="http://tempuri.org/")] - public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - MyMath() - { - this->Url = "http://localhost/Math.asmx"; - } - - [System::Web::Services::Protocols::SoapDocumentMethodAttribute( - "http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int x, int y ) - { - array^temp0 = {x,y}; - array^results = this->Invoke( "Add", temp0 ); - return *dynamic_cast(results[ 0 ]); - } - - System::IAsyncResult^ BeginAdd( int x, int y, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {x,y}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -int main() -{ - // - // - // Get the type for the proxy class MyMath Web service. - // Note: The MyMath class is a proxy class generated by the Wsdl.exe - // utility for the Math Web service. This class can also be found in - // the SoapHttpClientProtocol class example. - Type^ myType = MyMath::MyMath::typeid; - MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); - MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); - MethodInfo^ myMethod = myType->GetMethod( "Add" ); - Console::WriteLine( "Is 'BeginAdd' a Begin Method : {0}", LogicalMethodInfo::IsBeginMethod( myBeginMethod ) ); - Console::WriteLine( "Is 'Add' a Begin Method : {0}", LogicalMethodInfo::IsBeginMethod( myMethod ) ); - Console::WriteLine( "Is 'EndAdd' an End Method : {0}", LogicalMethodInfo::IsEndMethod( myEndMethod ) ); - // - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp b/snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp deleted file mode 100644 index ae08b9bd296..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp +++ /dev/null @@ -1,141 +0,0 @@ -/* - This program is used as a client of the client proxy class. -*/ - -// System.Web.Services.Protocols.MatchAttribute -// System.Web.Services.Protocols.MatchAttribute.MatchAttribute(string) -// System.Web.Services.Protocols.MatchAttribute.IgnoreCase -// System.Web.Services.Protocols.MatchAttribute.Pattern -// System.Web.Services.Protocols.MatchAttribute.Capture -// System.Web.Services.Protocols.MatchAttribute.Group -// System.Web.Services.Protocols.MatchAttribute.MaxRepeats - -/* - The following example demonstrates the constructor and 'IgnoreCase', - 'Pattern', 'Capture', 'Group', 'MaxRepeats' properties of the - 'MatchAttribute' class. This example shows a simple proxy that - parses the contents of a .html file which has been returned in - response to a web request. The web request which is a HTTP-GET - request is done behind the scenes in the 'Invoke' method of - 'HttpGetClientProtocol'. The .html file returned in response is - parsed with the help of 'MatchAttribute' class and the contents - are available in the 'Headers' instance returned by 'GetHeaders' - method. -*/ - -// -#using -#using - -using namespace System; -using namespace System::Web::Services::Protocols; - -// -// -// -// -// -// -public ref class Example_Headers -{ -public: - - [MatchAttribute("TITLE>(.*?)<")] - String^ Title; - - [MatchAttribute("",Pattern="h1>(.*?)<",IgnoreCase=true)] - String^ H1; - - [MatchAttribute("H2>((([^<,]*),?)+)<",Group=3,Capture=4)] - String^ Element; - - [MatchAttribute("H2>((([^<,]*),?){2,})<",Group=3,MaxRepeats=0)] - array^ Elements1; - - [MatchAttribute("H2>((([^<,]*),?){2,})<",Group=3,MaxRepeats=1)] - array^ Elements2; - - [MatchAttribute("H3 ([^=]*)=([^>]*)",Group=1)] - String^ Attribute; - - [MatchAttribute("H3 ([^=]*)=([^>]*)",Group=2)] - String^ Value; -}; -// -// -// -// -// -// - -public ref class MatchAttribute_Example: public HttpGetClientProtocol -{ -public: - MatchAttribute_Example() - { - Url = "http://localhost"; - } - - [HttpMethodAttribute(TextReturnReader::typeid,UrlParameterWriter::typeid)] - Example_Headers^ GetHeaders() - { - return ((Example_Headers^)(Invoke( "GetHeaders", ( Url + "/MyHeaders.html" ), - gcnew array(0) ))); - } - - System::IAsyncResult^ BeginGetHeaders( System::AsyncCallback^ callback, - Object^ asyncState ) - { - return BeginInvoke( "GetHeaders", ( Url + "/MyHeaders.html" ), - gcnew array(0), callback, asyncState ); - } - - Example_Headers^ EndGetHeaders( System::IAsyncResult^ asyncResult ) - { - return (Example_Headers^)(EndInvoke( asyncResult )); - } -}; -// - -public ref class SvcClient -{ -public: - static void main() - { - Example_Headers^ myHeaders; - MatchAttribute_Example^ mySample = gcnew MatchAttribute_Example; - myHeaders = mySample->GetHeaders(); - - Console::WriteLine( "\nThe Title html tag content is : {0}", - myHeaders->Title ); - - Console::WriteLine( "\nThe H1 html tag content is : {0}", - myHeaders->H1 ); - - Console::WriteLine( "\nThe fifth element in H2 html tag content is : {0}", - myHeaders->Element ); - - Console::WriteLine( "\nThe elements in the H2 html tag are :" + - " (MaxRepeats = 0)" ); - for ( int i = 0; i < myHeaders->Elements1->Length; i++ ) - { - Console::WriteLine( myHeaders->Elements1[ i ] ); - } - - Console::WriteLine( "\nThe elements in the H2 html tag are :" + - " (MaxRepeats = 1)" ); - for ( int i = 0; i < myHeaders->Elements2->Length; i++ ) - { - Console::WriteLine( myHeaders->Elements2[ i ] ); - } - - Console::WriteLine( "\nThe H3 html tag has attribute : {0} = {1}", - myHeaders->Attribute, myHeaders->Value ); - } -}; - -int main() -{ - SvcClient::main(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp deleted file mode 100644 index d02ef6fb793..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp +++ /dev/null @@ -1,145 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - static void CreateQueue( String^ queuePath ) - { - try - { - if ( !MessageQueue::Exists( queuePath ) ) - { - MessageQueue::Create( queuePath ); - } - else - { - Console::WriteLine( "{0} already exists.", queuePath ); - } - } - catch ( MessageQueueException^ e ) - { - Console::WriteLine( e->Message ); - } - - } - - void SendMessage() - { - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Create a new message. - Message^ myMessage = gcnew Message( "Original Message" ); - myMessage->AdministrationQueue = gcnew MessageQueue( ".\\myAdministrationQueue" ); - myMessage->AcknowledgeType = (AcknowledgeTypes)(AcknowledgeTypes::PositiveReceive | AcknowledgeTypes::PositiveArrival); - - // Send the Order to the queue. - myQueue->Send( myMessage ); - return; - } - - String^ ReceiveMessage() - { - // Connect to the a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - myQueue->MessageReadPropertyFilter->CorrelationId = true; - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - String^ returnString = nullptr; - try - { - // Receive and format the message. - Message^ myMessage = myQueue->Receive(); - - // Display message information. - Console::WriteLine( "____________________________________________" ); - Console::WriteLine( "Original message information--" ); - Console::WriteLine( "Body: {0}", myMessage->Body ); - Console::WriteLine( "Id: {0}", myMessage->Id ); - Console::WriteLine( "____________________________________________" ); - returnString = myMessage->Id; - } - catch ( MessageQueueException^ ) - { - // Handle Message Queuing exceptions. - } - // Handle invalid serialization format. - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( e->Message ); - } - - // Catch other exceptions as necessary. - return returnString; - } - - void ReceiveAcknowledgment( String^ messageId, String^ queuePath ) - { - bool found = false; - MessageQueue^ queue = gcnew MessageQueue( queuePath ); - queue->MessageReadPropertyFilter->CorrelationId = true; - queue->MessageReadPropertyFilter->Acknowledgment = true; - try - { - while ( queue->PeekByCorrelationId( messageId ) != nullptr ) - { - Message^ myAcknowledgmentMessage = queue->ReceiveByCorrelationId( messageId ); - - // Output acknowledgment message information. The correlation Id is identical - // to the id of the original message. - Console::WriteLine( "Acknowledgment Message Information--" ); - Console::WriteLine( "Correlation Id: {0}", myAcknowledgmentMessage->CorrelationId ); - Console::WriteLine( "Id: {0}", myAcknowledgmentMessage->Id ); - Console::WriteLine( "Acknowledgment Type: {0}", myAcknowledgmentMessage->Acknowledgment ); - Console::WriteLine( "____________________________________________" ); - found = true; - } - } - catch ( InvalidOperationException^ e ) - { - // This exception would be thrown if there is no (further) acknowledgment message - // with the specified correlation Id. Only output a message if there are no messages; - // not if the loop has found at least one. - if ( !found ) - { - Console::WriteLine( e->Message ); - } - - // Handle other causes of invalid operation exception. - } - - } - -}; - -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Create new queues. - MyNewQueue::CreateQueue( ".\\myQueue" ); - MyNewQueue::CreateQueue( ".\\myAdministrationQueue" ); - - // Send messages to a queue. - myNewQueue->SendMessage(); - - // Receive messages from a queue. - String^ messageId = myNewQueue->ReceiveMessage(); - - // Receive acknowledgment message. - if ( messageId != nullptr ) - { - myNewQueue->ReceiveAcknowledgment( messageId, ".\\myAdministrationQueue" ); - } - - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp deleted file mode 100644 index 1d933075840..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp +++ /dev/null @@ -1,117 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Messaging; -using namespace System::Drawing; -using namespace System::IO; -ref class Order -{ -public: - int orderId; - DateTime orderTime; -}; - -ref class MyNewQueue -{ -public: - static void CreateQueue( String^ queuePath ) - { - try - { - if ( !MessageQueue::Exists( queuePath ) ) - { - MessageQueue::Create( queuePath ); - } - else - { - Console::WriteLine( "{0} already exists.", queuePath ); - } - } - catch ( MessageQueueException^ e ) - { - Console::WriteLine( e->Message ); - } - - } - - void SendMessage() - { - try - { - // Create a new order and set values. - Order^ sentOrder = gcnew Order; - sentOrder->orderId = 3; - sentOrder->orderTime = DateTime::Now; - - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Create the new order. - Message^ myMessage = gcnew Message( sentOrder ); - - // Send the order to the queue. - myQueue->Send( myMessage ); - } - catch ( ArgumentException^ e ) - { - Console::WriteLine( e->Message ); - } - - return; - } - - void ReceiveMessage() - { - // Connect to the a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Set the formatter to indicate body contains an Order. - array^p = gcnew array(1); - p[ 0 ] = Order::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - try - { - // Receive and format the message. - Message^ myMessage = myQueue->Receive(); - Order^ myOrder = dynamic_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( "Order ID: {0}", myOrder->orderId ); - Console::WriteLine( "Sent: {0}", myOrder->orderTime ); - } - catch ( MessageQueueException^ ) - { - // Handle Message Queuing exceptions. - } - // Handle invalid serialization format. - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( e->Message ); - } - - // Catch other exceptions as necessary. - return; - } -}; - -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Create a queue on the local computer. - MyNewQueue::CreateQueue( ".\\myQueue" ); - - // Send a message to a queue. - myNewQueue->SendMessage(); - - // Receive a message from a queue. - myNewQueue->ReceiveMessage(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp deleted file mode 100644 index 9bf2333fbd8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// - -#using -#using - -using namespace System; -using namespace System::Messaging; - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ - //************************************************** - // Sends a string message to a queue. - //************************************************** -public: - void SendMessage( MessagePriority priority, String^ messageBody ) - { - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Create a new message. - Message^ myMessage = gcnew Message; - if ( priority > MessagePriority::Normal ) - { - myMessage->Body = "High Priority: {0}",messageBody; - } - else - { - myMessage->Body = messageBody; - } - - // Set the priority of the message. - myMessage->Priority = priority; - - // Send the Order to the queue. - myQueue->Send( myMessage ); - - return; - } - - //************************************************** - // Receives a message. - //************************************************** - void ReceiveMessage() - { - // Connect to the a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Set the queue to read the priority. By default, it - // is not read. - myQueue->MessageReadPropertyFilter->Priority = true; - - // Set the formatter to indicate body contains a String^. - array^ p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - try - { - // Receive and format the message. - Message^ myMessage = myQueue->Receive(); - - // Display message information. - Console::WriteLine( "Priority: {0}", - myMessage->Priority ); - Console::WriteLine( "Body: {0}", - myMessage->Body ); - } - catch ( MessageQueueException^ ) - { - // Handle Message Queuing exceptions. - } - // Handle invalid serialization format. - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( e->Message ); - } - - // Catch other exceptions as necessary. - - return; - } -}; - -//************************************************** -// Provides an entry point into the application. -// -// This example sends and receives a message from -// a queue. -//************************************************** -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send messages to a queue. - myNewQueue->SendMessage( MessagePriority::Normal, "First Message Body." ); - myNewQueue->SendMessage( MessagePriority::Highest, "Second Message Body." ); - - // Receive messages from a queue. - myNewQueue->ReceiveMessage(); - myNewQueue->ReceiveMessage(); - - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp deleted file mode 100644 index 5210e7417e5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp +++ /dev/null @@ -1,85 +0,0 @@ - - -// System::Web::Services::Description.MessageBinding::MessageBinding(); -// System::Web::Services::Description.MessageBinding::Extensions; -// System::Web::Services::Description.MessageBinding::Name; -/* The following program demonstrates the abstract class 'MessageBinding', it's constructor MessageBinding() -and properties 'Extensions' and 'Name'. -'MessageBinding' is an abstract class from which 'InputBinding' , 'OutputBinding' are derived. -The program contains a utility function which could be used to create either an InputBinding or OutputBinding. -This generic nature is achieved by returning an instance of 'MessageBinding'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -MessageBinding^ CreateInputOutputBinding( String^ myBindName, bool isInputBinding ) -{ - - // - // Value isInputBinding = true ---> return type = InputBinding. - // Value isInputBinding = false --> return type = OutputBinding. - // - // - MessageBinding^ myMessageBinding = nullptr; - switch ( isInputBinding ) - { - case true: - myMessageBinding = gcnew InputBinding; - Console::WriteLine( "Added an InputBinding" ); - break; - - case false: - myMessageBinding = gcnew OutputBinding; - Console::WriteLine( "Added an OutputBinding" ); - break; - } - // - myMessageBinding->Name = myBindName; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myMessageBinding->Extensions->Add( mySoapBodyBinding ); - Console::WriteLine( "Added extensibility element of type : {0}", mySoapBodyBinding->GetType() ); - // - // - - return myMessageBinding; -} - - -// Used to create OperationBinding instances within Binding. -OperationBinding^ CreateOperationBinding( String^ myOperation, String^ targetNamespace ) -{ - // Create OperationBinding for Operation. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = myOperation; - - // Create InputBinding for operation. - InputBinding^ myInputBinding = dynamic_cast(CreateInputOutputBinding( nullptr, true )); - - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = dynamic_cast(CreateInputOutputBinding( nullptr, false )); - - // Add InputBinding and OutputBinding to OperationBinding. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - - // Create an extensibility element for SoapOperationBinding. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, myOperation ); - - // Add the extensibility element SoapOperationBinding to OperationBinding. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - return myOperationBinding; -} - -int main() -{ - /* OperationBinding* addOperationBinding = */ - CreateOperationBinding( "Add", "http://tempuri.org/" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp deleted file mode 100644 index 078f4450a48..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// System::Web::Services::Description.MessageCollection::CopyTo; -// System::Web::Services::Description.MessageCollection::Item Property(Int32); -// System::Web::Services::Description.MessageCollection::Item Property (String); -// System::Web::Services::Description.MessageCollection::Contains; -// System::Web::Services::Description.MessageCollection::IndexOf; -// System::Web::Services::Description.MessageCollection::Remove; - -/* The program reads a WSDL document S"MathService::wsdl" and gets a ServiceDescription instance. -A MessageCollection instance is then retrieved from this ServiceDescription instance and it's -members are demonstrated. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_1.wsdl" ); - Console::WriteLine( "" ); - Console::WriteLine( "MessageCollection Sample" ); - Console::WriteLine( "========================" ); - Console::WriteLine( "" ); - - // - // Get Message Collection. - MessageCollection^ myMessageCollection = myServiceDescription->Messages; - Console::WriteLine( "Total Messages in the document = {0}", myServiceDescription->Messages->Count ); - Console::WriteLine( "" ); - Console::WriteLine( "Enumerating Messages..." ); - Console::WriteLine( "" ); - - // Print messages to console. - for ( int i = 0; i < myMessageCollection->Count; ++i ) - Console::WriteLine( "Message Name : {0}", myMessageCollection[ i ]->Name ); - // - - // - // Create a Message Array. - array^myMessages = gcnew array(myServiceDescription->Messages->Count); - - // Copy MessageCollection to an array. - myServiceDescription->Messages->CopyTo( myMessages, 0 ); - Console::WriteLine( "" ); - Console::WriteLine( "Displaying Messages that were copied to Messagearray ..." ); - Console::WriteLine( "" ); - for ( int i = 0; i < myServiceDescription->Messages->Count; ++i ) - Console::WriteLine( "Message Name : {0}", myMessages[ i ]->Name ); - // - - // - // - // - // - // Get Message by Name = S"AddSoapIn". - Message^ myMessage = myServiceDescription->Messages[ "AddSoapIn" ]; - Console::WriteLine( "" ); - Console::WriteLine( "Getting Message = 'AddSoapIn' {by Name}" ); - if ( myMessageCollection->Contains( myMessage ) ) - { - Console::WriteLine( "" ); - - // Get Message Name = S"AddSoapIn" Index. - Console::WriteLine( "Message 'AddSoapIn' was found in Message Collection." ); - Console::WriteLine( "Index of 'AddSoapIn' in Message Collection = {0}", myMessageCollection->IndexOf( myMessage ) ); - Console::WriteLine( "Deleting Message from Message Collection..." ); - myMessageCollection->Remove( myMessage ); - if ( myMessageCollection->IndexOf( myMessage ) == -1 ) - Console::WriteLine( "Message 'AddSoapIn' was successfully removed from Message Collection." ); - } - // - // - // - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp deleted file mode 100644 index 1b626e5d6ee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp +++ /dev/null @@ -1,106 +0,0 @@ -// System::Web::Services::Description.MessagePartCollection::Item Property(Int32); -// System::Web::Services::Description.MessagePart::Message; -// System::Web::Services::Description.MessagePartCollection::CopyTo; -// System::Web::Services::Description.MessagePartCollection::Item Property (String); -// System::Web::Services::Description.MessagePartCollection::Contains; -// System::Web::Services::Description.MessagePartCollection::IndexOf; -// System::Web::Services::Description.MessagePartCollection::Remove; -// System::Web::Services::Description.MessagePartCollection; - -/* The program reads a wsdl document S"MathService::wsdl" and gets ServiceDescription instance. -A MessagePartCollection instance is then retrieved from each Message and it's members are demonstrated. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - Console::WriteLine( "" ); - Console::WriteLine( "MessagePartCollection Sample" ); - Console::WriteLine( "============================" ); - Console::WriteLine( "" ); - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService.wsdl" ); - - // Get the message collection. - MessageCollection^ myMessageCollection = myServiceDescription->Messages; - Console::WriteLine( "Total Messages in the document = {0}", myServiceDescription->Messages->Count ); - Console::WriteLine( "" ); - Console::WriteLine( "Enumerating PartCollection for each message..." ); - Console::WriteLine( "" ); - - // - // - // Get the message part collection for each message. - for ( int i = 0; i < myMessageCollection->Count; ++i ) - { - Console::WriteLine( "Message : {0}", myMessageCollection[ i ]->Name ); - - // Get the message part collection. - MessagePartCollection^ myMessagePartCollection = myMessageCollection[ i ]->Parts; - - // Display the part collection. - for ( int k = 0; k < myMessagePartCollection->Count; k++ ) - { - Console::WriteLine( "\t Part Name : {0}", myMessagePartCollection[ k ]->Name ); - Console::WriteLine( "\t Message Name : {0}", myMessagePartCollection[ k ]->Message->Name ); - } - Console::WriteLine( "" ); - } - // - // - - Console::WriteLine( "MessagePartCollection for the message AddHttpGetIn." ); - // - // - Message^ myLocalMessage = myServiceDescription->Messages[ "AddHttpPostOut" ]; - if ( myMessageCollection->Contains( myLocalMessage ) ) - { - Console::WriteLine( "Message : {0}", myLocalMessage->Name ); - - // Get the message part collection. - MessagePartCollection^ myMessagePartCollection = myLocalMessage->Parts; - array^myMessagePart = gcnew array(myMessagePartCollection->Count); - - // Copy the MessagePartCollection to an array. - myMessagePartCollection->CopyTo( myMessagePart, 0 ); - for ( int k = 0; k < myMessagePart->Length; k++ ) - Console::WriteLine( "\t Part Name : {0}", myMessagePartCollection[ k ]->Name ); - Console::WriteLine( "" ); - } - // - // - - // - // - // - Console::WriteLine( "Checking if message is AddHttpPostOut..." ); - Message^ myMessage = myServiceDescription->Messages[ "AddHttpPostOut" ]; - if ( myMessageCollection->Contains( myMessage ) ) - { - // Get the mssage part collection. - MessagePartCollection^ myMessagePartCollection = myMessage->Parts; - - // Get the part named Body. - MessagePart^ myMessagePart = myMessage->Parts[ "Body" ]; - if ( myMessagePartCollection->Contains( myMessagePart ) ) - { - // Get the part named Body. - Console::WriteLine( "Index of Body in MessagePart collection = {0}", myMessagePartCollection->IndexOf( myMessagePart ) ); - Console::WriteLine( "Deleting Body from MessagePart collection..." ); - myMessagePartCollection->Remove( myMessagePart ); - if ( myMessagePartCollection->IndexOf( myMessagePart ) == -1 ) - Console::WriteLine( "from the message AddHttpPostOut." ); - } - } - // - // - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp deleted file mode 100644 index 6f8df31e358..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp +++ /dev/null @@ -1,930 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -namespace MessagePropertyFilterExample -{ - public ref class Order - { - private: - int orderIdValue; - DateTime orderTimeValue; - - public: - - property int OrderId - { - int get() - { - return orderIdValue; - } - - void set(int value) - { - orderIdValue = value; - } - } - - property DateTime OrderTime - { - DateTime get() - { - return orderTimeValue; - } - - void set(DateTime value) - { - orderTimeValue = value; - } - - } - }; - - public ref class OrderProcessor - { - public: - - // Creates a new queue-> - static void CreateQueue(String^ queuePath, - bool transactional) - { - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue::Create(queuePath, transactional); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } - } - - // Sends an Order to a queue-> - void SendMessage() - { - // Create a new order and set values. - Order^ sentOrder = gcnew Order; - sentOrder->OrderId = 3; - sentOrder->OrderTime = DateTime::Now; - - // Connect to a queue on the local computer. - MessageQueue^ queue = - gcnew MessageQueue(".\\orderQueue"); - - // Create the new order. - Message^ orderMessage = gcnew Message(sentOrder); - - // Label the message. - orderMessage->Label = "Order Message"; - - // Send the order to the queue-> - queue->Send(orderMessage); - } - - // Receives a message containing an order. - void ReceiveMessage() - { - // Connect to the a queue on the local computer. - MessageQueue^ queue = - gcnew MessageQueue(".\\orderQueue"); - - // Set the formatter to indicate - // the message body contains an order. - array ^targetTypes = gcnew array(1); - targetTypes[0] = Order::typeid; - queue->Formatter = - gcnew XmlMessageFormatter(targetTypes); - - // Declare the message. - Message^ orderMessage; - - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's AcknowledgeType property. - queue->MessageReadPropertyFilter-> - AcknowledgeType = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // AcknowledgeType property. - Console::WriteLine("Message.AcknowledgeType: {0}", - orderMessage->AcknowledgeType); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's AdministrationQueue property. - queue->MessageReadPropertyFilter-> - AdministrationQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // AdministrationQueue property. - Console::WriteLine("Message.AdministrationQueue: {0}", - orderMessage->AdministrationQueue); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's AppSpecific property. - queue->MessageReadPropertyFilter->AppSpecific = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // AppSpecific property. - Console::WriteLine("Message.AppSpecific: {0}", - orderMessage->AppSpecific); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's ArrivedTime property. - queue->MessageReadPropertyFilter->ArrivedTime = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // ArrivedTime property. - Console::WriteLine("Message.ArrivedTime: {0}", - orderMessage->ArrivedTime); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's AttachSenderId property. - queue->MessageReadPropertyFilter->AttachSenderId = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // AttachSenderId property. - Console::WriteLine("Message.AttachSenderId: {0}", - orderMessage->AttachSenderId); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's Authenticated property. - queue->MessageReadPropertyFilter->Authenticated = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // Authenticated property. - Console::WriteLine("Message.Authenticated: {0}", - orderMessage->Authenticated); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's - // AuthenticationProviderName property. - queue->MessageReadPropertyFilter-> - AuthenticationProviderName = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // AuthenticationProviderName property. - Console::WriteLine( - "Message.AuthenticationProviderName: {0}", - orderMessage->AuthenticationProviderName); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's - // AuthenticationProviderType property. - queue->MessageReadPropertyFilter-> - AuthenticationProviderType = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // AuthenticationProviderType property. - Console::WriteLine( - "Message.AuthenticationProviderType: {0}", - orderMessage->AuthenticationProviderType); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's Body property. - queue->MessageReadPropertyFilter->Body = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's Body property. - Console::WriteLine("Message.Body: {0}", - orderMessage->Body); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's ConnectorType property. - queue->MessageReadPropertyFilter->ConnectorType = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // ConnectorType property. - Console::WriteLine("Message.ConnectorType: {0}", - orderMessage->ConnectorType); - - // - // - // Set the filter's DefaultBodySize - // property to 2048 bytes. - queue->MessageReadPropertyFilter-> - DefaultBodySize = 2048; - - // Display the new value of the filter's - // DefaultBodySize property. - Console::WriteLine( - "MessageReadPropertyFilter.DefaultBodySize: {0}", - queue->MessageReadPropertyFilter->DefaultBodySize); - - // - // - // Set the filter's DefaultExtensionSize - // property to 1024 bytes. - queue->MessageReadPropertyFilter-> - DefaultExtensionSize = 1024; - - // Display the new value of the filter's - // DefaultExtensionSize property. - Console::WriteLine( - "MessageReadPropertyFilter." - "DefaultExtensionSize: {0}", - queue->MessageReadPropertyFilter-> - DefaultExtensionSize); - - // - // - // Set the filter's DefaultLabelSize - // property to 1024 bytes. - queue->MessageReadPropertyFilter-> - DefaultLabelSize = 1024; - - // Display the new value of the filter's - // DefaultLabelSize property. - Console::WriteLine( - "MessageReadPropertyFilter.DefaultLabelSize: {0}", - queue->MessageReadPropertyFilter->DefaultLabelSize); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's DestinationQueue property. - queue->MessageReadPropertyFilter-> - DestinationQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // Destinationqueue->QueueName property. - Console::WriteLine( - "Message.Destinationqueue->QueueName: {0}", - orderMessage->DestinationQueue->QueueName); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's - // DestinationSymmetricKey property. - queue->MessageReadPropertyFilter-> - DestinationSymmetricKey = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // DestinationSymmetricKey property. - Console::WriteLine( - "Message.DestinationSymmetricKey: {0}", - orderMessage->DestinationSymmetricKey); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's DigitalSignature property. - queue->MessageReadPropertyFilter-> - DigitalSignature = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // DigitalSignature property. - Console::WriteLine("Message.DigitalSignature: {0}", - orderMessage->DigitalSignature); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's EncryptionAlgorithm property. - queue->MessageReadPropertyFilter-> - EncryptionAlgorithm = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // EncryptionAlgorithm property. - Console::WriteLine("Message.EncryptionAlgorithm: {0}", - orderMessage->EncryptionAlgorithm); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's Extension property. - queue->MessageReadPropertyFilter->Extension = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's Extension property. - Console::WriteLine("Message.Extension: {0}", - orderMessage->Extension); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's HashAlgorithm property. - queue->MessageReadPropertyFilter->HashAlgorithm = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // HashAlgorithm property. - Console::WriteLine("Message.HashAlgorithm: {0}", - orderMessage->HashAlgorithm); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's Id property. - queue->MessageReadPropertyFilter->Id = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's Id property. - Console::WriteLine("Message.Id: {0}", orderMessage->Id); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's Label property. - queue->MessageReadPropertyFilter->Label = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's Label property. - Console::WriteLine("Message.Label: {0}", - orderMessage->Label); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's MessageType property. - queue->MessageReadPropertyFilter->MessageType = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // MessageType property. - Console::WriteLine("Message.MessageType: {0}", - orderMessage->MessageType); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's Recoverable property. - queue->MessageReadPropertyFilter->Recoverable = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // Recoverable property. - Console::WriteLine("Message.Recoverable: {0}", - orderMessage->Recoverable); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's ResponseQueue property. - queue->MessageReadPropertyFilter->ResponseQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // Responsequeue->QueueName property. - if (orderMessage->ResponseQueue != nullptr) - { - Console::WriteLine( - "Message.Responsequeue->QueueName: {0}", - orderMessage->ResponseQueue->QueueName); - } - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's SenderCertificate property. - queue->MessageReadPropertyFilter-> - SenderCertificate = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // SenderCertificate property. - Console::WriteLine("Message.SenderCertificate: {0}", - orderMessage->SenderCertificate); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's SenderId property. - queue->MessageReadPropertyFilter->SenderId = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's SenderId property. - Console::WriteLine("Message.SenderId: {0}", - orderMessage->SenderId); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's SenderVersion property. - queue->MessageReadPropertyFilter->SenderVersion = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // SenderVersion property. - Console::WriteLine("Message.SenderVersion: {0}", - orderMessage->SenderVersion); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's SentTime property. - queue->MessageReadPropertyFilter->SentTime = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's SentTime property. - Console::WriteLine("Message.SentTime: {0}", - orderMessage->SentTime); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's SourceMachine property. - queue->MessageReadPropertyFilter->SourceMachine = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // SourceMachine property. - Console::WriteLine("Message.SourceMachine: {0}", - orderMessage->SourceMachine); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's TimeToBeReceived property. - queue->MessageReadPropertyFilter-> - TimeToBeReceived = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // TimeToBeReceived property. - Console::WriteLine("Message.TimeToBeReceived: {0}", - orderMessage->TimeToBeReceived); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's TimeToReachQueue property. - queue->MessageReadPropertyFilter-> - TimeToReachQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // TimeToReachQueue property. - Console::WriteLine("Message.TimeToReachQueue: {0}", - orderMessage->TimeToReachQueue); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's UseAuthentication property. - queue->MessageReadPropertyFilter-> - UseAuthentication = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // UseAuthentication property. - Console::WriteLine("Message.UseAuthentication: {0}", - orderMessage->UseAuthentication); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's UseDeadLetterQueue property. - queue->MessageReadPropertyFilter-> - UseDeadLetterQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // UseDeadLetterQueue property. - Console::WriteLine("Message.UseDeadLetterQueue: {0}", - orderMessage->UseDeadLetterQueue); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's UseEncryption property. - queue->MessageReadPropertyFilter->UseEncryption = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // UseEncryption property. - Console::WriteLine("Message.UseEncryption: {0}", - orderMessage->UseEncryption); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's UseJournalQueue property. - queue->MessageReadPropertyFilter-> - UseJournalQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // UseJournalQueue property. - Console::WriteLine("Message.UseJournalQueue: {0}", - orderMessage->UseJournalQueue); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's UseTracing property. - queue->MessageReadPropertyFilter->UseTracing = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // UseTracing property. - Console::WriteLine("Message.UseTracing: {0}", - orderMessage->UseTracing); - - // - // - // Set all of the queue's MessageReadPropertyFilter - // Boolean properties to false. - queue->MessageReadPropertyFilter->ClearAll(); - - // - // - // Set all of the queue's MessageReadPropertyFilter - // properties to their defaults. - queue->MessageReadPropertyFilter->SetDefaults(); - - // - // - // Set all of the queue's MessageReadPropertyFilter - // Boolean properties to true. - queue->MessageReadPropertyFilter->SetAll(); - - // - // - // Assign the queue a new MessageReadPropertyFilter. - queue->MessageReadPropertyFilter = - gcnew MessagePropertyFilter; - - // - // Receive the message. This will remove the message - // from the queue-> - orderMessage = - queue->Receive(TimeSpan::FromSeconds(10.0)); - } - - // Sends an order to a transactional queue-> - void SendMessageToTransQueue() - { - // Create a new order and set values. - Order^ sentOrder = gcnew Order; - sentOrder->OrderId = 3; - sentOrder->OrderTime = DateTime::Now; - - // Connect to a queue on the local computer. - MessageQueue^ queue = - gcnew MessageQueue(".\\orderTransQueue"); - - // Create the new order. - Message^ orderMessage = gcnew Message(sentOrder); - - // Create a message queuing transaction-> - MessageQueueTransaction^ transaction = - gcnew MessageQueueTransaction; - - try - { - // Begin a transaction-> - transaction->Begin(); - - // Send the order to the queue-> - queue->Send(orderMessage, transaction); - - // Commit the transaction-> - transaction->Commit(); - } - catch (MessageQueueException^ ex) - { - // Abort the transaction-> - transaction->Abort(); - - // Propagate the exception. - throw; - } - finally - { - // Delete the transaction object. - delete transaction; - } - } - - // Receives a message containing an order. - void ReceiveMessageFromTransQueue() - { - // Connect to the a queue on the local computer. - MessageQueue^ queue = - gcnew MessageQueue(".\\orderTransQueue"); - - // Set the formatter to indicate the - // message body contains an order. - array ^targetTypes = gcnew array(1); - targetTypes[0] = Order::typeid; - queue->Formatter = - gcnew XmlMessageFormatter(targetTypes); - - // Declare the message. - Message^ orderMessage; - - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's IsFirstInTransaction property. - queue->MessageReadPropertyFilter-> - IsFirstInTransaction = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // IsFirstInTransaction property. - Console::WriteLine("Message.IsFirstInTransaction: {0}", - orderMessage->IsFirstInTransaction); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's IsLastInTransaction property. - queue->MessageReadPropertyFilter-> - IsLastInTransaction = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // IsLastInTransaction property. - Console::WriteLine("Message.IsLastInTransaction: {0}", - orderMessage->IsLastInTransaction); - - // - // - // Set the queue's MessageReadPropertyFilter property - // to enable the message's TransactionId property. - queue->MessageReadPropertyFilter->TransactionId = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // TransactionId property. - Console::WriteLine("Message.TransactionId: {0}", - orderMessage->TransactionId); - - // - // - // Set the queue's MessageReadPropertyFilter property to - // enable the message's TransactionStatusQueue property. - queue->MessageReadPropertyFilter-> - TransactionStatusQueue = true; - - // Peek at the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); - - // Display the value of the message's - // TransactionStatusqueue->QueueName property. - Console::WriteLine( - "Message.TransactionStatusqueue->QueueName: {0}", - orderMessage->TransactionStatusQueue->QueueName); - - // - // Create a message queuing transaction-> - MessageQueueTransaction^ transaction = - gcnew MessageQueueTransaction; - - try - { - // Begin a transaction-> - transaction->Begin(); - - // Receive the message. Time out after ten seconds - // in case the message was not delivered. - orderMessage = queue->Receive( - TimeSpan::FromSeconds(10.0), transaction); - - // Commit the transaction-> - transaction->Commit(); - } - catch (MessageQueueException^ ex) - { - // Abort the transaction-> - transaction->Abort(); - - // Propagate the exception. - throw; - } - finally - { - // Delete the transaction object. - delete transaction; - } - } - }; -} - -int main() -{ - // Create a new instance of the class. - MessagePropertyFilterExample::OrderProcessor^ processor = - gcnew MessagePropertyFilterExample::OrderProcessor; - - try - { - // Create a non-transactional queue on the local computer. - // Note that the queue might not be immediately accessible, - //and therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send - // a message to the newly created queue-> - MessagePropertyFilterExample:: - OrderProcessor::CreateQueue(".\\orderQueue", false); - - // Send a message to a queue-> - processor->SendMessage(); - - // Receive a message from a queue-> - processor->ReceiveMessage(); - - // Create a transactional queue on the local computer. - MessagePropertyFilterExample:: - OrderProcessor::CreateQueue(".\\orderTransQueue", true); - - // Send a message to a transactional queue-> - processor->SendMessageToTransQueue(); - - // Receive a message from a transactional queue-> - processor->ReceiveMessageFromTransQueue(); - } - catch (MessageQueueException^ ex) - { - // Write the exception information to the console. - Console::WriteLine(ex); - } -} - -// - -//output: -// -//.\orderQueue already exists. -//Message.AcknowledgeType: None -//Message.AdministrationQueue: -//Message.AppSpecific: 0 -//Message.ArrivedTime: 13.11.2004 14:42:30 -//Message.AttachSenderId: True -//Message.Authenticated: False -//Message.AuthenticationProviderName: -//Message.AuthenticationProviderType: None -//Message.Body: Order -//Message.ConnectorType: 00000000-0000-0000-0000-000000000000 -//MessageReadPropertyFilter.DefaultBodySize: 2048 -//MessageReadPropertyFilter.DefaultExtensionSize: 1024 -//MessageReadPropertyFilter.DefaultLabelSize: 1024 -//Message.Destinationqueue->QueueName: orderqueue -//Message.DestinationSymmetricKey: System.Byte[] -//Message.DigitalSignature: System.Byte[] -//Message.EncryptionAlgorithm: None -//Message.Extension: System.Byte[] -//Message.HashAlgorithm: None -//Message.Id: f2c7b57e-da35-4596-8b30-3b2ce0dd3756\2058 -//Message.Label: Order Message -//Message.MessageType: Normal -//Message.Recoverable: False -//Message.SenderCertificate: System.Byte[] -//Message.SenderId: System.Byte[] -//Message.SenderVersion: 16 -//Message.SentTime: 13.11.2004 14:42:30 -//Message.SourceMachine: ulkdev1 -//Message.TimeToBeReceived: 49710.06:28:15 -//Message.TimeToReachQueue: 4.00:00:00 -//Message.UseAuthentication: False -//Message.UseDeadLetterQueue: False -//Message.UseEncryption: False -//Message.UseJournalQueue: False -//Message.UseTracing: False -//.\orderTransQueue already exists. -//Message.IsFirstInTransaction: True -//Message.IsLastInTransaction: True -//Message.TransactionId: f2c7b57e-da35-4596-8b30-3b2ce0dd3756\2059 -//Message.TransactionStatusqueue->QueueName: private$\order_queue$ \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp deleted file mode 100644 index f0d29098618..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // Represents a state object associated with each message. - static int messageNumber = 0; - - // Provides an event handler for the PeekCompleted - // event. - // - static void MyPeekCompleted( Object^ source, PeekCompletedEventArgs^ asyncResult ) - { - try - { - // Connect to the queue. - MessageQueue^ mq = dynamic_cast(source); - - // End the asynchronous peek operation. - Message^ m = mq->EndPeek( asyncResult->AsyncResult ); - - // Display message information on the screen, - // including the message number (state object). - Console::WriteLine( "Message: {0} {1}", asyncResult->AsyncResult->AsyncState, static_cast(m->Body) ); - - // Restart the asynchronous peek operation, with the - // same time-out. - mq->BeginPeek( TimeSpan(0,1,0), messageNumber++ ); - } - catch ( MessageQueueException^ e ) - { - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) - { - Console::WriteLine( e ); - } - - // Handle other sources of MessageQueueException. - } - - // Handle other exceptions. - return; - } -}; - - -// Provides an entry point into the application. -// -// This example performs asynchronous peek operation -// processing. -int main() -{ - // Create an instance of MessageQueue. Set its formatter. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Add an event handler for the PeekCompleted event. - myQueue->PeekCompleted += gcnew PeekCompletedEventHandler( MyNewQueue::MyPeekCompleted ); - - // Begin the asynchronous peek operation with a timeout - // of one minute. - myQueue->BeginPeek( TimeSpan(0,1,0), MyNewQueue::messageNumber++ ); - - // Do other work on the current thread. - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp deleted file mode 100644 index 7ba1236a1c6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// This example performs asynchronous peek operation -// processing. -//************************************************* -ref class MyNewQueue -{ -public: - - // Provides an event handler for the PeekCompleted - // event. - static void MyPeekCompleted( Object^ source, PeekCompletedEventArgs^ asyncResult ) - { - // Connect to the queue. - MessageQueue^ mq = dynamic_cast(source); - - // End the asynchronous peek operation. - Message^ m = mq->EndPeek( asyncResult->AsyncResult ); - - // Display message information on the screen. - Console::WriteLine( "Message: {0}", static_cast(m->Body) ); - - // Restart the asynchronous peek operation. - mq->BeginPeek(); - return; - } -}; - -// Provides an entry point into the application. -// -int main() -{ - // Create an instance of MessageQueue. Set its formatter. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Add an event handler for the PeekCompleted event. - myQueue->PeekCompleted += gcnew PeekCompletedEventHandler( MyNewQueue::MyPeekCompleted ); - - // Begin the asynchronous peek operation. - myQueue->BeginPeek(); - - // Do other work on the current thread. - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp deleted file mode 100644 index 7b1891001d4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - static void MyPeekCompleted( Object^ source, PeekCompletedEventArgs^ asyncResult ) - { try - { - // Connect to the queue. - MessageQueue^ mq = dynamic_cast(source); - - // End the asynchronous peek operation. - Message^ m = mq->EndPeek( asyncResult->AsyncResult ); - - // Display message information on the screen. - Console::WriteLine( "Message: {0}", static_cast(m->Body) ); - - // Restart the asynchronous peek operation, with the - // same time-out. - mq->BeginPeek( TimeSpan(0,1,0) ); - } - catch ( MessageQueueException^ e ) - { - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) - { - Console::WriteLine( e ); - } - - // Handle other sources of MessageQueueException. - } - - // Handle other exceptions. - return; - } -}; - -int main() -{ - // Create an instance of MessageQueue. Set its formatter. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Add an event handler for the PeekCompleted event. - myQueue->PeekCompleted += gcnew PeekCompletedEventHandler( MyNewQueue::MyPeekCompleted ); - - // Begin the asynchronous peek operation with a timeout - // of one minute. - myQueue->BeginPeek( TimeSpan(0,1,0) ); - - // Do other work on the current thread. - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp deleted file mode 100644 index d7d9f348653..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; -using namespace System::Threading; - -ref class MyNewQueue -{ -public: - - // Define static class members. - static ManualResetEvent^ signal = gcnew ManualResetEvent( false ); - static int count = 0; - - // Provides an event handler for the ReceiveCompleted - // event. - static void MyReceiveCompleted( Object^ source, ReceiveCompletedEventArgs^ asyncResult ) - { - try - { - // Connect to the queue. - MessageQueue^ mq = dynamic_cast(source); - - // End the asynchronous receive operation. - mq->EndReceive( asyncResult->AsyncResult ); - count += 1; - if ( count == 10 ) - { - signal->Set(); - } - - // Restart the asynchronous receive operation. - mq->BeginReceive(); - } - catch ( MessageQueueException^ ) - { - // Handle sources of MessageQueueException. - } - - // Handle other exceptions. - return; - } -}; - -// Provides an entry point into the application. -// -// This example performs asynchronous receive -// operation processing. -int main() -{ - // Create an instance of MessageQueue. Set its formatter. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Add an event handler for the ReceiveCompleted event. - myQueue->ReceiveCompleted += gcnew ReceiveCompletedEventHandler( MyNewQueue::MyReceiveCompleted ); - - // Begin the asynchronous receive operation. - myQueue->BeginReceive(); - MyNewQueue::signal->WaitOne(); - - // Do other work on the current thread. - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp deleted file mode 100644 index 9a88b22ee3c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; -using namespace System::Threading; - -ref class MyNewQueue -{ -public: - - // Provides an event handler for the ReceiveCompleted - // event. - static void MyReceiveCompleted( Object^ source, ReceiveCompletedEventArgs^ asyncResult ) - { - try - { - // Connect to the queue. - MessageQueue^ mq = dynamic_cast(source); - - // End the asynchronous receive operation. - mq->EndReceive( asyncResult->AsyncResult ); - - // Process the message here. - Console::WriteLine( "Message received." ); - } - catch ( MessageQueueException^ ) - { - // Handle sources of MessageQueueException. - } - // Handle other exceptions. - return; - } -}; - -// Provides an entry point into the application. -// -// This example performs asynchronous receive -// operation processing. -int main() -{ - // Create an instance of MessageQueue. Set its formatter. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Add an event handler for the ReceiveCompleted event. - myQueue->ReceiveCompleted += gcnew ReceiveCompletedEventHandler( MyNewQueue::MyReceiveCompleted ); - - // Define wait handles for multiple operations. - array^waitHandleArray = gcnew array(10); - for ( int i = 0; i < 10; i++ ) - { - // Begin asynchronous operations. - waitHandleArray[ i ] = myQueue->BeginReceive()->AsyncWaitHandle; - } - - // Specify to wait for all operations to return. - WaitHandle::WaitAll( waitHandleArray ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp deleted file mode 100644 index 5bddf73fead..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // Sends a message to a queue. - void SendMessage() - { - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Send a message to the queue. - myQueue->Send( "My message data1." ); - - // Explicitly release resources. - myQueue->Close(); - - // Attempt to reaquire resources. - myQueue->Send( "My message data2." ); - return; - } - - // Receives a message from a queue. - void ReceiveMessage() - { - // Connect to the a on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Set the formatter to indicate body contains an Order. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - try - { - // Receive and format the message. - Message^ myMessage1 = myQueue->Receive(); - Message^ myMessage2 = myQueue->Receive(); - } - catch ( MessageQueueException^ ) - { - // Handle sources of any MessageQueueException. - } - finally - { - // Free resources. - myQueue->Close(); - } - - return; - } -}; - - -// Provides an entry point into the application. -// This example closes a queue and frees its -// resources. -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send a message to a queue. - myNewQueue->SendMessage(); - - // Receive a message from a queue. - myNewQueue->ReceiveMessage(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp deleted file mode 100644 index 6d9baa8ba17..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp +++ /dev/null @@ -1,106 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // Creates public transactional queues and sends a - // message. - void CreatePublicTransactionalQueues() - { - - // Create and connect to a public message Queuing queue. - if ( !MessageQueue::Exists( ".\\newPublicTransQueue1" ) ) - { - - // Create the queue if it does not exist. - MessageQueue::Create( ".\\newPublicTransQueue1", true ); - } - - - // Connect to the queue. - MessageQueue^ myNewPublicQueue = gcnew MessageQueue( ".\\newPublicTransQueue1" ); - - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - - // Begin the transaction. - myTransaction->Begin(); - - // Send the message. - myNewPublicQueue->Send( "My Message Data.", myTransaction ); - - // Commit the transaction. - myTransaction->Commit(); - if ( !MessageQueue::Exists( ".\\newPublicTransQueue2" ) ) - { - - // Create (but do not connect to) second public queue - MessageQueue::Create( ".\\newPublicTransQueue2", true ); - } - - return; - } - - - // Creates private queues and sends a message. - void CreatePrivateTransactionalQueues() - { - - // Create and connect to a private Message Queuing queue. - if ( !MessageQueue::Exists( ".\\Private$\\newPrivTransQ1" ) ) - { - - // Create the queue if it does not exist. - MessageQueue^ myNewPrivateQueue = MessageQueue::Create( ".\\Private$\\newPrivTransQ1", true ); - } - - - // Connect to the queue. - MessageQueue^ myNewPrivateQueue = gcnew MessageQueue( ".\\Private$\\newPrivTransQ1" ); - - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - - // Begin the transaction. - myTransaction->Begin(); - - // Send the message. - myNewPrivateQueue->Send( "My Message Data.", myTransaction ); - - // Commit the transaction. - myTransaction->Commit(); - - // Create (but do not connect to) a second private queue. - if ( !MessageQueue::Exists( ".\\Private$\\newPrivTransQ2" ) ) - { - MessageQueue::Create( ".\\Private$\\newPrivTransQ2", true ); - } - - return; - } - -}; - - -// Provides an entry point into the application. -// This example creates new transactional queues. -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Create transactional queues. - myNewQueue->CreatePublicTransactionalQueues(); - myNewQueue->CreatePrivateTransactionalQueues(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp deleted file mode 100644 index f90ef5700fc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp +++ /dev/null @@ -1,80 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// This example creates new public and private queues. -ref class MyNewQueue -{ -public: - void CreatePublicQueues() - { - - // Create and connect to a public Message Queuing queue. - if ( !MessageQueue::Exists( ".\\newPublicQueue" ) ) - { - - // Create the queue if it does not exist. - MessageQueue^ myNewPublicQueue = MessageQueue::Create( ".\\newPublicQueue" ); - - // Send a message to the queue. - myNewPublicQueue->Send( "My message data." ); - } - - - // Create (but do not connect to) a second public queue. - if ( !MessageQueue::Exists( ".\\newPublicResponseQueue" ) ) - { - MessageQueue::Create( ".\\newPublicResponseQueue" ); - } - - return; - } - - - // Creates private queues and sends a message. - void CreatePrivateQueues() - { - - // Create and connect to a private Message Queuing queue. - if ( !MessageQueue::Exists( ".\\Private$\\newPrivQueue" ) ) - { - - // Create the queue if it does not exist. - MessageQueue^ myNewPrivateQueue = MessageQueue::Create( ".\\Private$\\newPrivQueue" ); - - // Send a message to the queue. - myNewPrivateQueue->Send( "My message data." ); - } - - - // Create (but do not connect to) a second private queue. - if ( !MessageQueue::Exists( ".\\Private$\\newResponseQueue" ) ) - { - MessageQueue::Create( ".\\Private$\\newResponseQueue" ); - } - - return; - } - -}; - - -// Provides an entry point into the application. -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Create public and private queues. - myNewQueue->CreatePublicQueues(); - myNewQueue->CreatePrivateQueues(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp deleted file mode 100644 index 6195578a276..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // Associates selected message property values - // with high priority messages. - void SendHighPriorityMessages() - { - - // Connect to a message queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Associate selected default property values with high - // priority messages. - myQueue->DefaultPropertiesToSend->Priority = MessagePriority::High; - myQueue->DefaultPropertiesToSend->Label = "High Priority Message"; - myQueue->DefaultPropertiesToSend->Recoverable = true; - myQueue->DefaultPropertiesToSend->TimeToReachQueue = TimeSpan(0,0,30); - - // Send messages using these defaults. - myQueue->Send( "High priority message data 1." ); - myQueue->Send( "High priority message data 2." ); - myQueue->Send( "High priority message data 3." ); - return; - } - - - // Associates selected message property values - // with normal priority messages. - void SendNormalPriorityMessages() - { - - // Connect to a message queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Associate selected default property values with normal - // priority messages. - myQueue->DefaultPropertiesToSend->Priority = MessagePriority::Normal; - myQueue->DefaultPropertiesToSend->Label = "Normal Priority Message"; - myQueue->DefaultPropertiesToSend->Recoverable = false; - myQueue->DefaultPropertiesToSend->TimeToReachQueue = TimeSpan(0,2,0); - - // Send messages using these defaults. - myQueue->Send( "Normal priority message data 1." ); - myQueue->Send( "Normal priority message data 2." ); - myQueue->Send( "Normal priority message data 3." ); - return; - } - -}; - - -// Provides an entry point into the application. -// This example specifies different types of default -// properties for messages. -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send normal and high priority messages. - myNewQueue->SendNormalPriorityMessages(); - myNewQueue->SendHighPriorityMessages(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp deleted file mode 100644 index 5f7ef619417..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -int main() -{ - - // Determine whether the queue exists. - if ( MessageQueue::Exists( ".\\myQueue" ) ) - { - try - { - - // Delete the queue. - MessageQueue::Delete( ".\\myQueue" ); - } - catch ( MessageQueueException^ e ) - { - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::AccessDenied ) - { - Console::WriteLine( "Access is denied. Queue might be a system queue." ); - } - - // Handle other sources of MessageQueueException. - } - - } - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp deleted file mode 100644 index 2f0f3252ea6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - void CountLowestPriority() - { - - // Holds the count of Lowest priority messages. - UInt32 numberItems = 0; - - // Connect to a queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Get a cursor into the messages in the queue. - MessageEnumerator^ myEnumerator = myQueue->GetMessageEnumerator(); - - // Specify that the messages's priority should be read. - myQueue->MessageReadPropertyFilter->Priority = true; - - // Move to the next message and examine its priority. - while ( myEnumerator->MoveNext() ) - { - - // Increase the count if priority is Lowest. - if ( myEnumerator->Current->Priority == MessagePriority::Lowest ) - numberItems++; - } - - - // Display final count. - Console::WriteLine( "Lowest priority messages: {0}", numberItems ); - return; - } - -}; - -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Output the count of Lowest priority messages. - myNewQueue->CountLowestPriority(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp deleted file mode 100644 index fad785df5ce..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // Iterates through message queues and displays the - // path of each queue that was created in the last - // day and that exists on the computer "MyComputer". - void ListPublicQueuesByCriteria() - { - UInt32 numberQueues = 0; - - // Specify the criteria to filter by. - MessageQueueCriteria^ myCriteria = gcnew MessageQueueCriteria; - myCriteria->MachineName = "MyComputer"; - myCriteria->CreatedAfter = DateTime::Now.Subtract( TimeSpan(1,0,0,0) ); - - // Get a cursor into the queues on the network. - MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator( myCriteria ); - - // Move to the next queue and read its path. - while ( myQueueEnumerator->MoveNext() ) - { - - // Increase the count if priority is Lowest. - Console::WriteLine( myQueueEnumerator->Current->Path ); - numberQueues++; - } - - - // Handle no queues matching the criteria. - if ( numberQueues == 0 ) - { - Console::WriteLine( "No public queues match criteria." ); - } - - return; - } - -}; - -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Output the count of Lowest priority messages. - myNewQueue->ListPublicQueuesByCriteria(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp deleted file mode 100644 index 2b942b46c1f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -//************************************************** -// Iterates through message queues and examines the -// path for each queue. Also displays the number of -// public queues on the network. -//************************************************** -void ListPublicQueues() -{ - - // Holds the count of private queues. - int numberQueues = 0; - - // Get a cursor into the queues on the network. - MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator(); - - // Move to the next queue and read its path. - while ( myQueueEnumerator->MoveNext() ) - { - - // Increase the count if priority is Lowest. - Console::WriteLine( myQueueEnumerator->Current->Path ); - numberQueues++; - } - - - // Display final count. - Console::WriteLine( "Number of public queues: {0}", numberQueues ); - return; -} - - -//************************************************** -// Provides an entry point into the application. -// -// This example uses a cursor to step through the -// message queues and list the public queues on the -// network. -//************************************************** -int main() -{ - - // Output the count of Lowest priority messages. - ListPublicQueues(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp deleted file mode 100644 index 8092de2b7ee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp +++ /dev/null @@ -1,155 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -using namespace System::Collections; -ref class MyNewQueue -{ -public: - - // Gets a list of queues with a specified category. - // Sends a broadcast message to all queues in that - // category. - void GetQueuesByCategory() - { - - // Get a list of queues with the specified category. - array^QueueList = MessageQueue::GetPublicQueuesByCategory( Guid(" {00000000-0000-0000-0000-000000000001}") ); - - // Send a broadcast message to each queue in the array. - IEnumerator^ myEnum = QueueList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MessageQueue^ queueItem = safe_cast(myEnum->Current); - queueItem->Send( "Broadcast message." ); - } - - return; - } - - - // Gets a list of queues with a specified label. - // Sends a broadcast message to all queues with that - // label. - void GetQueuesByLabel() - { - - // Get a list of queues with the specified label. - array^QueueList = MessageQueue::GetPublicQueuesByLabel( "My Label" ); - - // Send a broadcast message to each queue in the array. - IEnumerator^ myEnum = QueueList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MessageQueue^ queueItem = safe_cast(myEnum->Current); - queueItem->Send( "Broadcast message." ); - } - - return; - } - - - // Gets a list of queues on a specified computer. - // Displays the list on screen. - void GetQueuesByComputer() - { - - // Get a list of queues on the specified computer. - array^QueueList = MessageQueue::GetPublicQueuesByMachine( "MyComputer" ); - - // Display the paths of the queues in the list. - IEnumerator^ myEnum = QueueList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MessageQueue^ queueItem = safe_cast(myEnum->Current); - Console::WriteLine( queueItem->Path ); - } - - return; - } - - - // Gets a list of all public queues. - void GetAllPublicQueues() - { - - // Get a list of public queues. - array^QueueList = MessageQueue::GetPublicQueues(); - return; - } - - - // Gets a list of all public queues that match - // specified criteria. Displays the list on - // screen. - void GetPublicQueuesByCriteria() - { - - // Define criteria to filter the queues. - MessageQueueCriteria^ myCriteria = gcnew MessageQueueCriteria; - myCriteria->CreatedAfter = DateTime::Now.Subtract( TimeSpan(1,0,0,0) ); - myCriteria->ModifiedBefore = DateTime::Now; - myCriteria->MachineName = "."; - myCriteria->Label = "My Queue"; - - // Get a list of queues with that criteria. - array^QueueList = MessageQueue::GetPublicQueues( myCriteria ); - - // Display the paths of the queues in the list. - IEnumerator^ myEnum = QueueList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MessageQueue^ queueItem = safe_cast(myEnum->Current); - Console::WriteLine( queueItem->Path ); - } - - return; - } - - - // Gets a list of private queues on the local - // computer. Displays the list on screen. - void GetPrivateQueues() - { - - // Get a list of queues with the specified category. - array^QueueList = MessageQueue::GetPrivateQueuesByMachine( "." ); - - // Display the paths of the queues in the list. - IEnumerator^ myEnum = QueueList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MessageQueue^ queueItem = safe_cast(myEnum->Current); - Console::WriteLine( queueItem->Path ); - } - - return; - } - -}; - - -// Provides an entry point into the application. -// This example gets lists of queues by a variety -// of criteria. -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send normal and high priority messages. - myNewQueue->GetQueuesByCategory(); - myNewQueue->GetQueuesByLabel(); - myNewQueue->GetQueuesByComputer(); - myNewQueue->GetAllPublicQueues(); - myNewQueue->GetPublicQueuesByCriteria(); - myNewQueue->GetPrivateQueues(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp deleted file mode 100644 index 4cd306bad02..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp +++ /dev/null @@ -1,117 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - //************************************************* - // Retrieves the default properties for a Message. - //************************************************* - void RetrieveDefaultProperties() - { - // Connect to a message queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Specify to retrieve the default properties only. - myQueue->MessageReadPropertyFilter->SetDefaults(); - - // Set the formatter for the Message. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Receive the first message in the queue. - Message^ myMessage = myQueue->Receive(); - - // Display selected properties. - Console::WriteLine( "Label: {0}", myMessage->Label ); - Console::WriteLine( "Body: {0}", static_cast(myMessage->Body) ); - return; - } - - - //************************************************* - // Retrieves all properties for a Message. - //************************************************* - void RetrieveAllProperties() - { - // Connect to a message queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Specify to retrieve all properties. - myQueue->MessageReadPropertyFilter->SetAll(); - - // Set the formatter for the Message. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Receive the first message in the queue. - Message^ myMessage = myQueue->Receive(); - - // Display selected properties. - Console::WriteLine( "Encryption algorithm: {0}", myMessage->EncryptionAlgorithm.ToString() ); - Console::WriteLine( "Body: {0}", myMessage->Body ); - return; - } - - //************************************************* - // Retrieves application-specific properties for a - // Message. - //************************************************* - void RetrieveSelectedProperties() - { - // Connect to a message queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Specify to retrieve selected properties. - MessagePropertyFilter^ myFilter = gcnew MessagePropertyFilter; - myFilter->ClearAll(); - - // The following list is a random subset of available properties. - myFilter->Body = true; - myFilter->Label = true; - myFilter->MessageType = true; - myFilter->Priority = true; - myQueue->MessageReadPropertyFilter = myFilter; - - // Set the formatter for the Message. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Receive the first message in the queue. - Message^ myMessage = myQueue->Receive(); - - // Display selected properties. - Console::WriteLine( "Message type: {0}", myMessage->MessageType.ToString() ); - Console::WriteLine( "Priority: {0}", myMessage->Priority.ToString() ); - return; - } -}; - - -//************************************************* -// Provides an entry point into the application. -// -// This example retrieves specific groups of Message -// properties. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Retrieve specific sets of Message properties. - myNewQueue->RetrieveDefaultProperties(); - myNewQueue->RetrieveAllProperties(); - myNewQueue->RetrieveSelectedProperties(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp deleted file mode 100644 index 34ef71be8b2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp +++ /dev/null @@ -1,125 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // References public queues. - void SendPublic() - { - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - myQueue->Send( "Public queue by path name." ); - return; - } - - - // References private queues. - void SendPrivate() - { - MessageQueue^ myQueue = gcnew MessageQueue( ".\\Private$\\myQueue" ); - myQueue->Send( "Private queue by path name." ); - return; - } - - - // References queues by label. - void SendByLabel() - { - MessageQueue^ myQueue = gcnew MessageQueue( "Label:TheLabel" ); - myQueue->Send( "Queue by label." ); - return; - } - - - // References queues by format name. - void SendByFormatName() - { - MessageQueue^ myQueue = gcnew MessageQueue( "FormatName:Public=5A5F7535-AE9A-41d4 -935C-845C2AFF7112" ); - myQueue->Send( "Queue by format name." ); - return; - } - - - // References computer journal queues. - void MonitorComputerJournal() - { - MessageQueue^ computerJournal = gcnew MessageQueue( ".\\Journal$" ); - while ( true ) - { - Message^ journalMessage = computerJournal->Receive(); - - // Process the journal message. - } - } - - - // References queue journal queues. - void MonitorQueueJournal() - { - MessageQueue^ queueJournal = gcnew MessageQueue( ".\\myQueue\\Journal$" ); - while ( true ) - { - Message^ journalMessage = queueJournal->Receive(); - - // Process the journal message. - } - } - - - // References dead-letter queues. - void MonitorDeadLetter() - { - MessageQueue^ deadLetter = gcnew MessageQueue( ".\\DeadLetter$" ); - while ( true ) - { - Message^ deadMessage = deadLetter->Receive(); - - // Process the dead-letter message. - } - } - - - // References transactional dead-letter queues. - void MonitorTransactionalDeadLetter() - { - MessageQueue^ TxDeadLetter = gcnew MessageQueue( ".\\XactDeadLetter$" ); - while ( true ) - { - Message^ txDeadLetter = TxDeadLetter->Receive(); - - // Process the transactional dead-letter message. - } - } - -}; - - -//************************************************* -// Provides an entry point into the application. -// -// This example demonstrates several ways to set -// a queue's path. -//************************************************* -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - myNewQueue->SendPublic(); - myNewQueue->SendPrivate(); - myNewQueue->SendByLabel(); - myNewQueue->SendByFormatName(); - myNewQueue->MonitorComputerJournal(); - myNewQueue->MonitorQueueJournal(); - myNewQueue->MonitorDeadLetter(); - myNewQueue->MonitorTransactionalDeadLetter(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp deleted file mode 100644 index 15915890bde..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp +++ /dev/null @@ -1,127 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// This class represents an object the following example -// sends to a queue and receives from a queue. -ref class Order -{ -public: - int orderId; - DateTime orderTime; -}; - - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ -public: - - //************************************************* - // Posts a notification when a message arrives in - // the queue S"monitoredQueue". Does not retrieve any - // message information when peeking the message. - //************************************************* - void NotifyArrived() - { - // Connect to a queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\monitoredQueue" ); - - // Specify to retrieve no message information. - myQueue->MessageReadPropertyFilter->ClearAll(); - - // Wait for a message to arrive. - Message^ emptyMessage = myQueue->Peek(); - - // Post a notification when a message arrives. - Console::WriteLine( "A message has arrived in the queue." ); - return; - } - - - //************************************************* - // Sends an Order to a queue. - //************************************************* - void SendMessage() - { - // Create a new order and set values. - Order^ sentOrder = gcnew Order; - sentOrder->orderId = 3; - sentOrder->orderTime = DateTime::Now; - - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Send the Order to the queue. - myQueue->Send( sentOrder ); - return; - } - - //************************************************* - // Peeks a message containing an Order. - //************************************************* - void PeekFirstMessage() - { - // Connect to a queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Set the formatter to indicate the body contains an Order. - array^p = gcnew array(1); - p[ 0 ] = Order::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - try - { - // Peek and format the message. - Message^ myMessage = myQueue->Peek(); - Order^ myOrder = static_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( "Order ID: {0}", myOrder->orderId ); - Console::WriteLine( "Sent: {0}", myOrder->orderTime ); - } - catch ( MessageQueueException^ ) - { - // Handle Message Queuing exceptions. - } - // Handle invalid serialization format. - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( e->Message ); - } - - // Catch other exceptions as necessary. - return; - } -}; - -//************************************************* -// Provides an entry point into the application. -// -// This example posts a notification that a message -// has arrived in a queue. It sends a message -// containing an other to a separate queue, and then -// peeks the first message in the queue. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Wait for a message to arrive in the queue. - myNewQueue->NotifyArrived(); - - // Send a message to a queue. - myNewQueue->SendMessage(); - - // Peek the first message in the queue. - myNewQueue->PeekFirstMessage(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp deleted file mode 100644 index 25b765ab949..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - //************************************************* - // Determines whether a queue is empty. The Peek() - // method throws an exception if there is no message - // in the queue. This method handles that exception - // by returning true to the calling method. - //************************************************* - bool IsQueueEmpty() - { - bool isQueueEmpty = false; - - // Connect to a queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - try - { - - // Set Peek to return immediately. - myQueue->Peek( TimeSpan(0) ); - - // If an IOTime->Item[Out] was* not thrown, there is a message - // in the queue. - isQueueEmpty = false; - } - catch ( MessageQueueException^ e ) - { - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) - { - - // No message was in the queue. - isQueueEmpty = true; - } - - - // Handle other sources of MessageQueueException. - } - - - // Handle other exceptions as necessary. - // Return true if there are no messages in the queue. - return isQueueEmpty; - } - -}; - - -//************************************************* -// Provides an entry point into the application. -// -// This example determines whether a queue is empty. -//************************************************* -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Determine whether a queue is empty. - bool isQueueEmpty = myNewQueue->IsQueueEmpty(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp deleted file mode 100644 index 693998fa995..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp +++ /dev/null @@ -1,58 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - //************************************************* - // Provides an event handler for the ReceiveCompleted - // event. - //************************************************* - static void MyReceiveCompleted( Object^ source, ReceiveCompletedEventArgs^ asyncResult ) - { - // Connect to the queue. - MessageQueue^ mq = dynamic_cast(source); - - // End the asynchronous Receive operation. - Message^ m = mq->EndReceive( asyncResult->AsyncResult ); - - // Display message information on the screen. - Console::WriteLine( "Message: {0}", m->Body ); - - // Restart the asynchronous Receive operation. - mq->BeginReceive(); - return; - } -}; - - -//************************************************* -// Provides an entry point into the application. -// -// This example performs asynchronous receive operation -// processing. -//************************************************* -int main() -{ - // Create an instance of MessageQueue. Set its formatter. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Add an event handler for the ReceiveCompleted event. - myQueue->ReceiveCompleted += gcnew ReceiveCompletedEventHandler( MyNewQueue::MyReceiveCompleted ); - - // Begin the asynchronous receive operation. - myQueue->BeginReceive(); - - // Do other work on the current thread. - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp deleted file mode 100644 index 9ef51936eb2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp +++ /dev/null @@ -1,121 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ -public: - - //************************************************* - // Sends a message to a transactional queue. - //************************************************* - void SendMessageTransactional() - { - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); - - // Send a message to the queue. - if ( myQueue->Transactional) - { - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - - // Begin the transaction. - myTransaction->Begin(); - - // Send the message. - myQueue->Send( "My Message Data.", myTransaction ); - - // Commit the transaction. - myTransaction->Commit(); - } - - return; - } - - //************************************************* - // Receives a message from the transactional queue. - //************************************************* - void ReceiveMessageTransactional() - { - // Connect to a transactional queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); - - // Set the formatter. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - try - { - // Begin the transaction. - myTransaction->Begin(); - - // Receive the message. - // Wait five seconds for a message to arrive. - Message^ myMessage = myQueue->Receive( TimeSpan(0,0,5), myTransaction ); - String^ myOrder = static_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( myOrder ); - - // Commit the transaction. - myTransaction->Commit(); - } - catch ( MessageQueueException^ e ) - { - // Handle nontransactional queues. - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::TransactionUsage ) - { - Console::WriteLine( "Queue is not transactional." ); - } - // Handle no message arriving in the queue. - else - - // Handle no message arriving in the queue. - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) - { - Console::WriteLine( "No message in queue." ); - } - - // Else catch other sources of MessageQueueException. - // Roll back the transaction. - myTransaction->Abort(); - } - - // Catch other exceptions as necessary, such as - // InvalidOperationException, thrown when the formatter - // cannot deserialize the message. - return; - } -}; - -//************************************************* -// Provides an entry point into the application. -// -// This example sends and receives a message from -// a transactional queue. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send a message to a queue. - myNewQueue->SendMessageTransactional(); - - // Receive a message from a queue. - myNewQueue->ReceiveMessageTransactional(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp deleted file mode 100644 index ab3720fe0ac..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// This class represents an object the following example -// sends to a queue and receives from a queue. -ref class Order -{ -public: - int orderId; - DateTime orderTime; -}; - - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ -public: - - //************************************************* - // Sends an Order to a queue. - //************************************************* - void SendMessage() - { - // Create a new order and set values. - Order^ sentOrder = gcnew Order; - sentOrder->orderId = 3; - sentOrder->orderTime = DateTime::Now; - - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Send the Order to the queue. - myQueue->Send( sentOrder ); - return; - } - - //************************************************* - // Receives a message containing an Order. - //************************************************* - void ReceiveMessage() - { - // Connect to the a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Set the formatter to indicate body contains an Order. - array^p = gcnew array(1); - p[ 0 ] = Order::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - try - { - // Receive and format the message. - Message^ myMessage = myQueue->Receive(); - Order^ myOrder = static_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( "Order ID: {0}", myOrder->orderId ); - Console::WriteLine( "Sent: {0}", myOrder->orderTime ); - } - catch ( MessageQueueException^ ) - { - // Handle Message Queuing exceptions. - } - // Handle invalid serialization format. - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( e->Message ); - } - - // Catch other exceptions as necessary. - return; - } -}; - -//************************************************* -// Provides an entry point into the application. -// -// This example sends and receives a message from -// a queue. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send a message to a queue. - myNewQueue->SendMessage(); - - // Receive a message from a queue. - myNewQueue->ReceiveMessage(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp deleted file mode 100644 index eedcb107410..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp +++ /dev/null @@ -1,85 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// This class represents an object the following example -// receives from a queue. -ref class Order -{ -public: - int orderId; - DateTime orderTime; -}; - - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ -public: - - //************************************************* - // Receives a message containing an Order. - //************************************************* - void ReceiveMessage() - { - // Connect to the a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Set the formatter to indicate body contains an Order. - array^p = gcnew array(1); - p[ 0 ] = Order::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - try - { - // Receive and format the message. - // Wait 5 seconds for a message to arrive. - Message^ myMessage = myQueue->Receive( TimeSpan(0,0,5) ); - Order^ myOrder = static_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( "Order ID: {0}", myOrder->orderId ); - Console::WriteLine( "Sent: {0}", myOrder->orderTime ); - } - catch ( MessageQueueException^ e ) - { - // Handle no message arriving in the queue. - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) - { - Console::WriteLine( "No message arrived in queue." ); - } - - // Handle other sources of a MessageQueueException. - } - // Handle invalid serialization format. - catch ( InvalidOperationException^ e ) - { - Console::WriteLine( e->Message ); - } - - // Catch other exceptions as necessary. - return; - } -}; - -//************************************************* -// Provides an entry point into the application. -// -// This example receives a message from a queue. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Receive a message from a queue. - myNewQueue->ReceiveMessage(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp deleted file mode 100644 index 1e1f1b67acc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp +++ /dev/null @@ -1,113 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ -public: - - //************************************************* - // Sends a message to a queue. - //************************************************* - void SendMessageTransactional() - { - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); - - // Send a message to the queue. - if ( myQueue->Transactional ) - { - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - - // Begin the transaction. - myTransaction->Begin(); - - // Send the message. - myQueue->Send( "My Message Data.", myTransaction ); - - // Commit the transaction. - myTransaction->Commit(); - } - - return; - } - - - //************************************************* - // Receives a message containing an Order. - //************************************************* - void ReceiveMessageTransactional() - { - // Connect to a transactional queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); - - // Set the formatter. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - try - { - // Begin the transaction. - myTransaction->Begin(); - - // Receive the message. - Message^ myMessage = myQueue->Receive( myTransaction ); - String^ myOrder = static_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( myOrder ); - - // Commit the transaction. - myTransaction->Commit(); - } - catch ( MessageQueueException^ e ) - { - // Handle nontransactional queues. - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::TransactionUsage ) - { - Console::WriteLine( "Queue is not transactional." ); - } - - // Else catch other sources of a MessageQueueException. - // Roll back the transaction. - myTransaction->Abort(); - } - - // Catch other exceptions as necessary, such as - // InvalidOperationException, thrown when the formatter - // cannot deserialize the message. - return; - } -}; - -//************************************************* -// Provides an entry point into the application. -// -// This example sends and receives a message from -// a transactional queue. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send a message to a queue. - myNewQueue->SendMessageTransactional(); - - // Receive a message from a queue. - myNewQueue->ReceiveMessageTransactional(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp deleted file mode 100644 index ec84a775eb9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp +++ /dev/null @@ -1,113 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -/// -/// Provides a container class for the example. -/// -ref class MyNewQueue -{ -public: - - //************************************************* - // Sends a message to a queue. - //************************************************* - void SendMessageTransactional() - { - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); - - // Send a message to the queue. - if ( myQueue->Transactional ) - { - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - - // Begin the transaction. - myTransaction->Begin(); - - // Send the message. - myQueue->Send( "My Message Data.", myTransaction ); - - // Commit the transaction. - myTransaction->Commit(); - } - - return; - } - - - //************************************************* - // Receives a message containing an Order. - //************************************************* - void ReceiveMessageTransactional() - { - // Connect to a transactional queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); - - // Set the formatter. - array^p = gcnew array(1); - p[ 0 ] = String::typeid; - myQueue->Formatter = gcnew XmlMessageFormatter( p ); - - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - try - { - // Begin the transaction. - myTransaction->Begin(); - - // Receive the message. - Message^ myMessage = myQueue->Receive( myTransaction ); - String^ myOrder = static_cast(myMessage->Body); - - // Display message information. - Console::WriteLine( myOrder ); - - // Commit the transaction. - myTransaction->Commit(); - } - catch ( MessageQueueException^ e ) - { - // Handle nontransactional queues. - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::TransactionUsage ) - { - Console::WriteLine( "Queue is not transactional." ); - } - - // Else catch other sources of MessageQueueException. - // Roll back the transaction. - myTransaction->Abort(); - } - - // Catch other exceptions as necessary, such as - // InvalidOperationException, thrown when the formatter - // cannot deserialize the message. - return; - } -}; - -//************************************************* -// Provides an entry point into the application. -// -// This example sends and receives a message from -// a transactional queue. -//************************************************* -int main() -{ - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send a message to a queue. - myNewQueue->SendMessageTransactional(); - - // Receive a message from a queue. - myNewQueue->ReceiveMessageTransactional(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp deleted file mode 100644 index 2398aece90c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - void SendMessage() - { - - // Connect to a queue on the local computer. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); - - // Send a message to the queue. - if ( myQueue->Transactional ) - { - - // Create a transaction. - MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; - - // Begin the transaction. - myTransaction->Begin(); - - // Send the message. - myQueue->Send( "My Message Data.", myTransaction ); - - // Commit the transaction. - myTransaction->Commit(); - } - else - { - myQueue->Send( "My Message Data." ); - } - - return; - } - -}; - -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Send a message to a queue. - myNewQueue->SendMessage(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp deleted file mode 100644 index c09921d9b5b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Messaging; -ref class MyNewQueue -{ -public: - - // Requests exlusive read access to the queue. If - // access is granted, receives a message from the - // queue. - void GetExclusiveAccess() - { - try - { - - // Request exclusive read access to the queue. - MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue",true ); - - // Receive a message. This is where SharingViolation - // exceptions would be thrown. - Message^ myMessage = myQueue->Receive(); - } - catch ( MessageQueueException^ e ) - { - - // Handle request for denial of exclusive read access. - if ( e->MessageQueueErrorCode == MessageQueueErrorCode::SharingViolation ) - { - Console::WriteLine( "Denied exclusive read access" ); - } - - - // Handle other sources of a MessageQueueException. - } - - - // Handle other exceptions as necessary. - return; - } - -}; - - -// Provides an entry point into the application. -// This example connects to a message queue, and -// requests exclusive read access to the queue. -int main() -{ - - // Create a new instance of the class. - MyNewQueue^ myNewQueue = gcnew MyNewQueue; - - // Output the count of Lowest priority messages. - myNewQueue->GetExclusiveAccess(); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp deleted file mode 100644 index 5293d6d567a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp +++ /dev/null @@ -1,1101 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -static void CreateQueue(String^ queuePath, bool transactional) -{ - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -void SendObjectString() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label"); - - queue->Close(); - - // -} - -void SendObjectTransactionType() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, MessageQueueTransactionType::Single); - - queue->Close(); - - // -} - -void SendObjectStringTransactionType() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label", - MessageQueueTransactionType::Single); - - queue->Close(); - - // -} - -void SendObjectStringTransaction() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Create a message queuing transaction. - MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); - - try - { - // Begin a transaction. - transaction->Begin(); - - // Send the message to the queue. - queue->Send(msg, "Example Message Label", transaction); - - // Commit the transaction. - transaction->Commit(); - } - catch (Exception^ ex) - { - // Cancel the transaction. - transaction->Abort(); - - // Propagate the exception. - throw ex; - } - finally - { - // Dispose of the transaction object. - delete transaction; - queue->Close(); - } - - // -} - -void PeekByCorrelationIdStringTimespan() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Designate a queue to receive the acknowledgement message for this - // message. - msg->AdministrationQueue = - gcnew MessageQueue(".\\exampleAdminQueue"); - - // Set the message to generate an acknowledgement message upon its - // arrival. - msg->AcknowledgeType = AcknowledgeTypes::PositiveArrival; - - // Send the message. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - // Connect to the admin queue. - MessageQueue^ adminQueue = - gcnew MessageQueue(".\\exampleAdminQueue"); - - // Set the admin queue's MessageReadPropertyFilter property to ensure - // that the acknowledgement message includes the desired properties. - adminQueue->MessageReadPropertyFilter->Acknowledgment = true; - adminQueue->MessageReadPropertyFilter->CorrelationId = true; - - // Peek at the acknowledgement message. - Message^ ackMsg = adminQueue->PeekByCorrelationId(id, - TimeSpan::FromSeconds(10.0)); - - // Display the acknowledgement message's property values. - Console::WriteLine("Message.Label: {0}", ackMsg->Label); - Console::WriteLine("Message.Acknowledgment: {0}", - ackMsg->Acknowledgment); - Console::WriteLine("Message.CorrelationId: {0}", ackMsg->CorrelationId); - - adminQueue->Close(); - queue->Close(); - - // -} - -void PeekByIdString() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Peek at the message. - msg = queue->PeekById(id); - - queue->Close(); - - // -} - -void PeekByIdStringTimespan() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Peek at the message. - msg = queue->PeekById(id, TimeSpan::FromSeconds(10.0)); - - queue->Close(); - - // -} - -void ReceiveTimespanTransactionType() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, MessageQueueTransactionType::Single); - - // Set the formatter to indicate the message body contains a String. - queue->Formatter = gcnew XmlMessageFormatter( - gcnew array{String::typeid}); - - // Receive the message from the queue. Because the Id of the message - // is not specified, it might not be the message just sent. - msg = queue->Receive(TimeSpan::FromSeconds(10.0), - MessageQueueTransactionType::Single); - - queue->Close(); - - // -} - -void ReceiveTransactionType() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, MessageQueueTransactionType::Single); - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Set the formatter to indicate the message body contains a String. - queue->Formatter = gcnew XmlMessageFormatter( - gcnew array{String::typeid}); - - // Receive the message from the queue. Because the Id of the message - // , it might not be the message just sent. - msg = queue->Receive(MessageQueueTransactionType::Single); - - queue->Close(); - - // -} - -void ReceiveByCorrelationIdStringTimespan() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Designate a queue to receive the acknowledgement message for this - // message. - msg->AdministrationQueue = - gcnew MessageQueue(".\\exampleAdminQueue"); - - // Set the message to generate an acknowledgement message upon its - // arrival. - msg->AcknowledgeType = AcknowledgeTypes::PositiveArrival; - - // Send the message. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - // Connect to the admin queue. - MessageQueue^ adminQueue = - gcnew MessageQueue(".\\exampleAdminQueue"); - - // Set the admin queue's MessageReadPropertyFilter property to ensure - // that the acknowledgement message includes the desired properties. - adminQueue->MessageReadPropertyFilter->Acknowledgment = true; - adminQueue->MessageReadPropertyFilter->CorrelationId = true; - - // Receive the acknowledgement message from the admin queue. - Message^ ackMsg = adminQueue->ReceiveByCorrelationId(id, - TimeSpan::FromSeconds(10.0)); - - // Display the acknowledgement message's property values. - Console::WriteLine("Message.Label: {0}", ackMsg->Label); - Console::WriteLine("Message.Acknowledgment: {0}", - ackMsg->Acknowledgment); - Console::WriteLine("Message.CorrelationId: {0}", ackMsg->CorrelationId); - - adminQueue->Close(); - queue->Close(); - - // -} - -void ReceiveByCorrelationIdStringTransactionType() -{ - // - - // Connect to a nontransactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message to the nontransactional queue. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the nontransactional queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = - gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message in response to the original message. - Message^ responseMsg = gcnew Message("Example Response Message Body"); - - // Set the response message's CorrelationId property value to the Id - // property value of the original message. - responseMsg->CorrelationId = id; - - // Send the response message to the transactional queue. - transQueue->Send(responseMsg, "Example Response Message Label", - MessageQueueTransactionType::Single); - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Set the transactional queue's MessageReadPropertyFilter property to - // ensure that the response message includes the desired properties. - transQueue->MessageReadPropertyFilter->CorrelationId = true; - - // Receive the response message from the transactional queue. - responseMsg = transQueue->ReceiveByCorrelationId(id, - MessageQueueTransactionType::Single); - - // Display the response message's property values. - Console::WriteLine("Message.Label: {0}", responseMsg->Label); - Console::WriteLine("Message.CorrelationId: {0}", - responseMsg->CorrelationId); - - transQueue->Close(); - queue->Close(); - - // -} - -void ReceiveByCorrelationIdStringTimespanTransactionType() -{ - // - - // Connect to a nontransactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message to the nontransactional queue. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the nontransactional queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = - gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message in response to the original message. - Message^ responseMsg = gcnew Message("Example Response Message Body"); - - // Set the response message's CorrelationId property value to the Id - // property value of the original message. - responseMsg->CorrelationId = id; - - // Send the response message to the transactional queue. - transQueue->Send(responseMsg, "Example Response Message Label", - MessageQueueTransactionType::Single); - - // Set the transactional queue's MessageReadPropertyFilter property to - // ensure that the response message includes the desired properties. - transQueue->MessageReadPropertyFilter->CorrelationId = true; - - // Receive the response message from the transactional queue. - responseMsg = transQueue->ReceiveByCorrelationId(id, - TimeSpan::FromSeconds(10.0), MessageQueueTransactionType::Single); - - // Display the response message's property values. - Console::WriteLine("Message.Label: {0}", responseMsg->Label); - Console::WriteLine("Message.CorrelationId: {0}", - responseMsg->CorrelationId); - - transQueue->Close(); - queue->Close(); - - // -} - -void ReceiveByCorrelationIdStringTimespanTransaction() -{ - // - - // Connect to a nontransactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message to the nontransactional queue. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the nontransactional queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = - gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message in response to the original message. - Message^ responseMsg = gcnew Message("Example Response Message Body"); - - // Set the response message's CorrelationId property value to the Id - // property value of the original message. - responseMsg->CorrelationId = id; - - // Send the response message to the transactional queue. - transQueue->Send(responseMsg, "Example Response Message Label", - MessageQueueTransactionType::Single); - - // Set the transactional queue's MessageReadPropertyFilter property to - // ensure that the response message includes the desired properties. - transQueue->MessageReadPropertyFilter->CorrelationId = true; - - // Create a message queuing transaction. - MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); - - try - { - // Begin a transaction. - transaction->Begin(); - - // Receive the response message from the transactional queue. - responseMsg = transQueue->ReceiveByCorrelationId(id, - TimeSpan::FromSeconds(10.0), transaction); - - // Commit the transaction. - transaction->Commit(); - } - catch (Exception^ ex) - { - // Cancel the transaction. - transaction->Abort(); - - // Propagate the exception. - throw ex; - } - finally - { - // Dispose of the transaction object. - delete transaction; - transQueue->Close(); - queue->Close(); - } - - // Display the response message's property values. - Console::WriteLine("Message.Label: {0}", responseMsg->Label); - Console::WriteLine("Message.CorrelationId: {0}", - responseMsg->CorrelationId); - - // -} - -void ReceiveByCorrelationIdStringTransaction() -{ - // - - // Connect to a nontransactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message to the nontransactional queue. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the nontransactional queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - // Connect to a transactional queue on the local computer. - MessageQueue^ transQueue = - gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message in response to the original message. - Message^ responseMsg = gcnew Message("Example Response Message Body"); - - // Set the response message's CorrelationId property value to the Id - // property value of the original message. - responseMsg->CorrelationId = id; - - // Send the response message to the transactional queue. - transQueue->Send(responseMsg, "Example Response Message Label", - MessageQueueTransactionType::Single); - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Set the transactional queue's MessageReadPropertyFilter property to - // ensure that the response message includes the desired properties. - transQueue->MessageReadPropertyFilter->CorrelationId = true; - - // Create a message queuing transaction. - MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); - - try - { - // Begin a transaction. - transaction->Begin(); - - // Receive the response message from the transactional queue. - responseMsg = transQueue->ReceiveByCorrelationId(id, transaction); - - // Commit the transaction. - transaction->Commit(); - } - catch (Exception^ ex) - { - // Cancel the transaction. - transaction->Abort(); - - // Propagate the exception. - throw ex; - } - finally - { - // Dispose of the transaction object. - delete transaction; - transQueue->Close(); - queue->Close(); - } - - // Display the response message's property values. - Console::WriteLine("Message.Label: {0}", responseMsg->Label); - Console::WriteLine("Message.CorrelationId: {0}", - responseMsg->CorrelationId); - - // -} - -void ReceiveByIdStringTransactionType() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label", - MessageQueueTransactionType::Single); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Receive the message from the queue. - msg = queue->ReceiveById(id, MessageQueueTransactionType::Single); - - queue->Close(); - - // -} - -void ReceiveByIdString() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Receive the message from the queue. - msg = queue->ReceiveById(id); - - queue->Close(); - - // -} - -void ReceiveByIdStringTransaction() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label", - MessageQueueTransactionType::Single); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Simulate doing other work so the message has time to arrive. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - // Create a message queuing transaction. - MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); - - try - { - // Begin a transaction. - transaction->Begin(); - - // Receive the message from the queue. - msg = queue->ReceiveById(id, transaction); - - // Commit the transaction. - transaction->Commit(); - } - catch (Exception^ ex) - { - // Cancel the transaction. - transaction->Abort(); - - // Propagate the exception. - throw ex; - } - finally - { - // Dispose of the transaction object. - delete transaction; - queue->Close(); - } - - // -} - -void ReceiveByIdStringTimespanTransaction() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label", - MessageQueueTransactionType::Single); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Create a message queuing transaction. - MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); - - try - { - // Begin a transaction. - transaction->Begin(); - - // Receive the message from the queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0), - transaction); - - // Commit the transaction. - transaction->Commit(); - } - catch (Exception^ ex) - { - // Cancel the transaction. - transaction->Abort(); - - // Propagate the exception. - throw ex; - } - finally - { - // Dispose of the transaction object. - delete transaction; - queue->Close(); - } - - // -} - -void ReceiveByIdStringTimespanTransactionType() -{ - // - - // Connect to a transactional queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label", - MessageQueueTransactionType::Single); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0), - MessageQueueTransactionType::Single); - - queue->Close(); - - // -} - -void ReceiveByIdStringTimespan() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new message. - Message^ msg = gcnew Message("Example Message Body"); - - // Send the message. - queue->Send(msg, "Example Message Label"); - - // Get the message's Id property value. - String^ id = msg->Id; - - // Receive the message from the queue. - msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); - - queue->Close(); - - // -} - -void GetAllMessages() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Populate an array with copies of all the messages in the queue. - array^ msgs = queue->GetAllMessages(); - - // Loop through the messages. - for each(Message^ msg in msgs) - { - // Display the label of each message. - Console::WriteLine(msg->Label); - } - - queue->Close(); - - // -} - -void GetEnumerator() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Get an IEnumerator object. - System::Collections::IEnumerator^ enumerator = - queue->GetMessageEnumerator2(); - - // Use the IEnumerator object to loop through the messages. - while(enumerator->MoveNext()) - { - // Get a message from the enumerator. - Message^ msg = (Message^)enumerator->Current; - - // Display the label of the message. - Console::WriteLine(msg->Label); - } - - queue->Close(); - - // -} - -void SetPermissionsStringAccessRights() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Grant all users in the "Everyone" user group the right to receive - // messages from the queue. - queue->SetPermissions("Everyone", - MessageQueueAccessRights::ReceiveMessage); - - queue->Close(); - - // -} - -void SetPermissionsAccessControlEntry() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new trustee to represent the "Everyone" user group. - Trustee^ tr = gcnew Trustee("Everyone"); - - // Create a MessageQueueAccessControlEntry, granting the trustee the - // right to receive messages from the queue. - MessageQueueAccessControlEntry^ entry = gcnew - MessageQueueAccessControlEntry( - tr, MessageQueueAccessRights::ReceiveMessage, - AccessControlEntryType::Allow); - - // Apply the MessageQueueAccessControlEntry to the queue. - queue->SetPermissions(entry); - - queue->Close(); - - // -} - -void SetPermissionsStringAccessRightsAccessControlEntryType() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Grant all users in the "Everyone" user group the right to receive - // messages from the queue. - queue->SetPermissions("Everyone", - MessageQueueAccessRights::ReceiveMessage, - AccessControlEntryType::Allow); - - queue->Close(); - - // -} - -void SetPermissionsAccessControlList() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create an AccessControlList. - AccessControlList^ list = gcnew AccessControlList(); - - // Create a new trustee to represent the "Everyone" user group. - Trustee^ tr = gcnew Trustee("Everyone"); - - // Create an AccessControlEntry, granting the trustee read access to - // the queue. - AccessControlEntry^ entry = gcnew AccessControlEntry( - tr, GenericAccessRights::Read, - StandardAccessRights::Read, - AccessControlEntryType::Allow); - - // Add the AccessControlEntry to the AccessControlList. - list->Add(entry); - - // Apply the AccessControlList to the queue. - queue->SetPermissions(list); - - queue->Close(); - - // -} - -void ResetPermissions() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Reset the queue's permission list to its default values. - queue->ResetPermissions(); - - queue->Close(); - - // -} - -void Refresh() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Refresh the queue's property values to obtain its current state. - queue->Refresh(); - - queue->Close(); - - // -} - -void Purge() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Delete all messages from the queue. - queue->Purge(); - - queue->Close(); - - // -} - -void main() -{ - try - { - // Create a nontransactional queue on the local computer. - // Note that the queue might not be immediately accessible, and - // therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send a - // message to the newly created queue. - CreateQueue(".\\exampleQueue", false); - - // Create a nontransactional queue on the local computer. This - // queue will be used to receive acknowledgement messages. - CreateQueue(".\\exampleAdminQueue", false); - - // Create a transactional queue on the local computer. - CreateQueue(".\\exampleTransQueue", true); - - // Send a message to a queue. - SendObjectString(); - - // Send a message to a transactional queue. - SendObjectTransactionType(); - - // Send a message to a transactional queue. - SendObjectStringTransactionType(); - - // Send a message to a transactional queue. - SendObjectStringTransaction(); - - // Demonstrate PeekById. - PeekByIdString(); - - // Demonstrate PeekById. - PeekByIdStringTimespan(); - - // Demonstrate PeekByCorrelationId. - PeekByCorrelationIdStringTimespan(); - - // Receive a message from a transactional queue. - ReceiveTimespanTransactionType(); - - // Receive a message from a transactional queue. - ReceiveTransactionType(); - - // Demonstrate ReceiveByCorrelationId. - ReceiveByCorrelationIdStringTimespan(); - - // Demonstrate ReceiveByCorrelationId. - ReceiveByCorrelationIdStringTransactionType(); - - // Demonstrate ReceiveByCorrelationId. - ReceiveByCorrelationIdStringTimespanTransactionType(); - - // Demonstrate ReceiveByCorrelationId. - ReceiveByCorrelationIdStringTimespanTransaction(); - - // Demonstrate ReceiveByCorrelationId. - ReceiveByCorrelationIdStringTransaction(); - - // Demonstrate ReceiveById. - ReceiveByIdStringTransactionType(); - - // Demonstrate ReceiveById. - ReceiveByIdString(); - - // Demonstrate ReceiveById. - ReceiveByIdStringTransaction(); - - // Demonstrate ReceiveById. - ReceiveByIdStringTimespanTransaction(); - - // Demonstrate ReceiveById. - ReceiveByIdStringTimespanTransactionType(); - - // Demonstrate ReceiveById. - ReceiveByIdStringTimespan(); - - // Demonstrate GetAllMessages. - GetAllMessages(); - - // Demonstrate GetEnumerator. - GetEnumerator(); - - // Demonstrate SetPermissions. - SetPermissionsStringAccessRights(); - - // Demonstrate SetPermissions. - SetPermissionsAccessControlEntry(); - - // Demonstrate SetPermissions. - SetPermissionsStringAccessRightsAccessControlEntryType(); - - // Demonstrate SetPermissions. - SetPermissionsAccessControlList(); - - // Demonstrate ResetPermissions. - ResetPermissions(); - - // Demonstrate Refresh. - Refresh(); - - // Demonstrate Purge. - Purge(); - } - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - catch (MessageQueueException^ ex) - { - // Write the exception information to the console. - Console::WriteLine(ex->Message); - } -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp deleted file mode 100644 index 27cc2fcd0f3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// - -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Create a new queue. -static void CreateQueue(String^ queuePath, bool transactional) -{ - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -static void UseQueue() -{ - // - // Connect to a queue on the local computer, grant exclusive read - // access to the first application that accesses the queue, and - // enable connection caching. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue", true, true); - - queue->Close(); - // -} - -int main() -{ - // Create a nontransactional queue on the local computer. - CreateQueue(".\\exampleQueue", false); - - UseQueue(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp deleted file mode 100644 index bd142a855da..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if(!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -// Provides an event handler for the PeekCompleted event. -void MyPeekCompleted(IAsyncResult^ asyncResult) -{ - // Connect to the queue. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // End the asynchronous peek operation. - Message^ msg = queue->EndPeek(asyncResult); - - // Display the message information on the screen. - Console::WriteLine("Message number: {0}", asyncResult->AsyncState); - Console::WriteLine("Message body: {0}", msg->Body); - - // Receive the message. This will remove the message from the queue. - msg = queue->Receive(TimeSpan::FromSeconds(10.0)); - - queue->Close(); -} - -int main() -{ - // Represents a state object associated with each message. - int messageNumber = 0; - - // Create a non-transactional queue on the local computer. - // Note that the queue might not be immediately accessible, and - // therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send a - // message to the newly created queue. - CreateQueue(".\\exampleQueue", false); - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Send a message to the queue. - queue->Send("Example Message"); - - // Begin the asynchronous peek operation. - queue->BeginPeek(TimeSpan::FromSeconds(10.0), messageNumber++, - gcnew AsyncCallback(MyPeekCompleted)); - - // Simulate doing other work on the current thread. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - - queue->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp deleted file mode 100644 index f55dd96f51c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if(!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -// Provides an event handler for the ReceiveCompleted event. -void HandleReceiveCompleted(Object^ source, ReceiveCompletedEventArgs^ e) -{ - // Connect to the queue. - MessageQueue^ queue = (MessageQueue^)source; - - // End the asynchronous receive operation. - Message^ msg = queue->EndReceive(e->AsyncResult); - - // Display the message information on the screen. - Console::WriteLine("Message body: {0}", msg->Body); - - queue->Close(); -} - -int main() -{ - // Create a non-transactional queue on the local computer. - // Note that the queue might not be immediately accessible, and - // therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send a - // message to the newly created queue. - MessageQueue^ queue = nullptr; - try - { - CreateQueue(".\\exampleQueue", false); - - // Connect to a queue on the local computer. - queue = gcnew MessageQueue(".\\exampleQueue"); - - // Add an event handler for the ReceiveCompleted event. - queue->ReceiveCompleted += gcnew - ReceiveCompletedEventHandler(HandleReceiveCompleted); - - // Send a message to the queue. - queue->Send("Example Message"); - - // Begin the asynchronous receive operation. - queue->BeginReceive(TimeSpan::FromSeconds(10.0)); - - // Simulate doing other work on the current thread. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - } - - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - - catch (MessageQueueException^ ex) - { - Console::WriteLine(ex->Message); - } - - finally - { - queue->Close(); - } - -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp deleted file mode 100644 index b75428d1df7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp +++ /dev/null @@ -1,86 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if(!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -// Provides an event handler for the ReceiveCompleted event. -void HandleReceiveCompleted(Object^ source, ReceiveCompletedEventArgs^ e) -{ - // Connect to the queue. - MessageQueue^ queue = (MessageQueue^)source; - - // End the asynchronous receive operation. - Message^ msg = queue->EndReceive(e->AsyncResult); - - // Display the message information on the screen. - Console::WriteLine("Message number: {0}", e->AsyncResult->AsyncState); - Console::WriteLine("Message body: {0}", msg->Body); - - queue->Close(); -} - -int main() -{ - // Create a non-transactional queue on the local computer. - // Note that the queue might not be immediately accessible, and - // therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send a - // message to the newly created queue. - MessageQueue^ queue = nullptr; - - // Represents a state object associated with each message. - int messageNumber = 0; - - try - { - CreateQueue(".\\exampleQueue", false); - - // Connect to a queue on the local computer. - queue = gcnew MessageQueue(".\\exampleQueue"); - - // Add an event handler for the ReceiveCompleted event. - queue->ReceiveCompleted += gcnew - ReceiveCompletedEventHandler(HandleReceiveCompleted); - - // Send a message to the queue. - queue->Send("Example Message"); - - // Begin the asynchronous receive operation. - queue->BeginReceive(TimeSpan::FromSeconds(10.0), messageNumber++); - - // Simulate doing other work on the current thread. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - } - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - - catch (MessageQueueException^ ex) - { - Console::WriteLine(ex->Message); - } - - finally - { - queue->Close(); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp deleted file mode 100644 index a60adfa80c7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -// Provides an event handler for the ReceiveCompleted event. -void HandleReceiveCompleted(IAsyncResult^ asyncResult) -{ - // Connect to the queue. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // End the asynchronous receive operation. - Message^ msg = queue->EndReceive(asyncResult); - - // Display the message information on the screen. - Console::WriteLine("Message number: {0}", asyncResult->AsyncState); - Console::WriteLine("Message body: {0}", msg->Body); - - queue->Close(); -} - -int main() -{ - // Represents a state object associated with each message. - int messageNumber = 0; - - // Create a non-transactional queue on the local computer. - // Note that the queue might not be immediately accessible, and - // therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send a - // message to the newly created queue. - MessageQueue^ queue = nullptr; - try - { - CreateQueue(".\\exampleQueue", false); - - // Connect to a queue on the local computer. - queue = gcnew MessageQueue(".\\exampleQueue"); - - // Send a message to the queue. - queue->Send("Example Message"); - - // Begin the asynchronous receive operation. - queue->BeginReceive(TimeSpan::FromSeconds(10.0), messageNumber++, - gcnew AsyncCallback(HandleReceiveCompleted)); - - // Simulate doing other work on the current thread. - System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); - } - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - - catch (MessageQueueException^ ex) - { - Console::WriteLine(ex->Message); - } - - finally - { - queue->Close(); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp deleted file mode 100644 index e77794103ca..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// - -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.",queuePath); - } -} - -// Demonstrates the use of MessageQueuePermissionAccess -void CreatePermission() -{ - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission( - MessageQueuePermissionAccess::Receive, queue->MachineName, - queue->Label, queue->Category.ToString()); - - queue->Close(); - // -} - -int main() -{ - try - { - - // Create a non-transactional queue on the local computer. - CreateQueue(".\\exampleQueue", false); - - // Demonstrate use of MessageQueuePermissionAccess. - CreatePermission(); - } - - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - - catch (MessageQueueException^ ex) - { - Console::WriteLine(ex->Message); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp deleted file mode 100644 index c5679d136b8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// - -#using -#using - -using namespace System; -using namespace System::Messaging; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -// Demonstrates the following MessageQueuePermissionAttribute constructor: -// public #ctor (SecurityAction action) -void CreateAttribute() -{ - // - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // -} - - -void CategoryExample() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // Set the attribute's Category property value, based on the queue's - // Category property value. - attribute->Category = queue->Category.ToString(); - - // Display the new value of the attribute's Category property. - Console::WriteLine("attribute->Category: {0}", - attribute->Category); - - queue->Close(); - // -} - -void LabelExample() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // Set the attribute's Label property value, based on the queue's Label - // property value. - attribute->Label = queue->Label; - - // Display the new value of the attribute's Label property. - Console::WriteLine("attribute->Label: {0}", attribute->Label); - - queue->Close(); - // -} - - -void MachineNameExample() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // Set the attribute's MachineName property value, based on the queue's - // MachineName property value. - attribute->MachineName = queue->MachineName; - - // Display the new value of the attribute's MachineName property. - Console::WriteLine("attribute->MachineName: {0}", - attribute->MachineName); - - queue->Close(); - // -} - -void PathExample() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // Set the attribute's Path property value, based on the queue's Path - // property value. - attribute->Path = queue->Path; - - // Display the new value of the attribute's Path property. - Console::WriteLine("attribute->Path: {0}", attribute->Path); - - queue->Close(); - // -} - -void PermissionAccessExample() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // Set the attribute's PermissionAccess property value. - attribute->PermissionAccess = MessageQueuePermissionAccess::Receive; - - // Display the new value of the attribute's PermissionAccess property. - Console::WriteLine("attribute->PermissionAccess: {0}", - attribute->PermissionAccess); - - queue->Close(); - // -} - -void CreatePermissionExample() -{ - // - - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionAttribute. - MessageQueuePermissionAttribute^ attribute = - gcnew MessageQueuePermissionAttribute( - System::Security::Permissions::SecurityAction::Assert); - - // Set the attribute's Path property value, based on the queue's Path - // property value. - attribute->Path = queue->Path; - - // Get an IPermission interface by calling the attribute's - // CreatePermission() method. - System::Security::IPermission^ permission = attribute->CreatePermission(); - - queue->Close(); - // -} - -int main() -{ - try - { - - // Create a non-transactional queue on the local computer. - CreateQueue(".\\exampleQueue", false); - - // Demonstrate the members of MessageQueuePermissionAttribute. - // Note that the Path, FormatName, MachineName, Label, and Category - // property values cannot all be set on the same instance of - // MessageQueuePermissionAttribute. Trying to do so will throw an - // exception of type System.InvalidOperationException. - - CreateAttribute(); - CategoryExample(); - LabelExample(); - MachineNameExample(); - PathExample(); - PermissionAccessExample(); - CreatePermissionExample(); - } - - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - - catch (MessageQueueException^ ex) - { - Console::WriteLine(ex->Message); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp deleted file mode 100644 index 50c49a55ddc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp +++ /dev/null @@ -1,208 +0,0 @@ -// - -#using -#using - -using namespace System; -using namespace System::Messaging; - -public ref class MessageQueuePermissionEntryExample -{ - // Creates a new queue. -public: - static void CreateQueue(String^ queuePath, bool transactional) - { - if(!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } - } - - // Demonstrates the following MessageQueuePermission constructor: - // public #ctor (MessageQueuePermissionAccess permissionAccess, - // String path) -public: - void CreateEntryShortCtor() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->Path); - - queue->Close(); - // - } - - // Demonstrates the following MessageQueuePermission constructor: - // public #ctor (MessageQueuePermissionAccess permissionAccess, - // String machineName, String label, String category) -public: - void CreateEntryLongCtor() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - queue->Close(); - // - } - -public: - void CategoryExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Display the value of the entry's Category property. - Console::WriteLine("Category: {0}", entry->Category->ToString()); - - queue->Close(); - // - } - -public: - void LabelExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Display the value of the entry's Label property. - Console::WriteLine("Label: {0}", entry->Label); - - queue->Close(); - // - } - -public: - void MachineNameExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Display the value of the entry's MachineName property. - Console::WriteLine("MachineName: {0}", entry->MachineName); - - queue->Close(); - // - } - -public: - void PathExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->Path); - - // Display the value of the entry's Path property. - Console::WriteLine("Path: {0}", entry->Path); - - queue->Close(); - // - } - -public: - void PermissionAccessExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Display the value of the entry's PermissionAccess property. - Console::WriteLine("PermissionAccess: {0}", entry->PermissionAccess); - - queue->Close(); - // - } -}; - -int main() -{ - // Create a new instance of the class. - MessageQueuePermissionEntryExample^ example = - gcnew MessageQueuePermissionEntryExample(); - - try - { - // Create a non-transactional queue on the local computer. - // Note that the queue might not be immediately accessible, and - // therefore this example might throw an exception of type - // System.Messaging.MessageQueueException when trying to send a - // message to the newly created queue. - example->CreateQueue(".\\exampleQueue", false); - - // Demonstrate MessageQueuePermissionEntry's constructors. - example->CreateEntryShortCtor(); - example->CreateEntryLongCtor(); - - // Demonstrate MessageQueuePermissionEntry's properties. - example->CategoryExample(); - example->LabelExample(); - example->MachineNameExample(); - example->PathExample(); - example->PermissionAccessExample(); - } - - catch (InvalidOperationException^) - { - Console::WriteLine("Please install Message Queuing."); - } - - catch (MessageQueueException^ ex) - { - // Write the exception information to the console. - Console::WriteLine(ex->Message); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp deleted file mode 100644 index 01ab6fd2ada..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp +++ /dev/null @@ -1,408 +0,0 @@ -// - -#using -#using -using namespace System; -using namespace System::Messaging; - -public ref class MessageQueuePermissionEntryCollectionExample -{ - // Demonstrates: - // public Int32 Add (MessageQueuePermissionEntry value) -public: - void AddExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - queue->Close(); - // - } - - // Demonstrates: - // public Void AddRange (MessageQueuePermissionEntry[] value) -public: - void AddRangeExample1() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create an array of type MessageQueuePermissionEntry. - array^ entries = - gcnew array(1); - - // Create a new instance of MessageQueuePermissionEntry and place the - // instance in the array. - entries[0] = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the array to the collection. - collection->AddRange(entries); - - queue->Close(); - // - } - - // Demonstrates: - // public Void AddRange (MessageQueuePermissionEntryCollection value) -public: - void AddRangeExample2() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, queue->Category.ToString()); - - // Add the entry to the permission's collection. - permission->PermissionEntries->Add(entry); - - // Create another new instance of MessageQueuePermission. - MessageQueuePermission^ newPermission = gcnew MessageQueuePermission(); - - // Use AddRange() to append the original permission's collection to the - // new permission's collection. - newPermission->PermissionEntries->AddRange( - permission->PermissionEntries); - - // To show that AddRange() copies collections by value and not by - // reference, we'll clear the original permission's collection, then - // display a count of how many entries are in the original permission's - // collection and how many entries are in the new permission's - // collection. - - // Clear the original permission's collection. - permission->PermissionEntries->Clear(); - - // The original permission now contains 0 entries, but the new - // permission still contains 1 entry. - Console::WriteLine("Original permission contains {0} entries.", - permission->PermissionEntries->Count); - Console::WriteLine("New permission contains {0} entries.", - newPermission->PermissionEntries->Count); - - queue->Close(); - // - } - - // Demonstrates: - // public Boolean Contains (MessageQueuePermissionEntry value) -public: - void ContainsExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - // Show that the collection contains the entry. - Console::WriteLine("Collection contains first entry (true/false): {0}", - collection->Contains(entry)); - - // Create another new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ newEntry = - gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Send, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Show that the collection does not contain the new entry. - Console::WriteLine( - "Collection contains second entry (true/false): {0}", - collection->Contains(newEntry)); - - queue->Close(); - // - } - - // Demonstrates: - // public Void CopyTo (MessageQueuePermissionEntry[] array, Int32 index) -public: - void CopyToExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - // Create an array of type MessageQueuePermissionEntry. - array^ entries = - gcnew array(1); - - // Copy the collection to index 0 of the array. - collection->CopyTo(entries, 0); - - // Show that the array now contains the entry. - Console::WriteLine("entries[0].PermissionAccess: {0}", - entries[0]->PermissionAccess); - Console::WriteLine("entries[0].MachineName: {0}", - entries[0]->MachineName); - Console::WriteLine("entries[0].Label: {0}", entries[0]->Label); - Console::WriteLine("entries[0].Category: {0}", - entries[0]->Category); - - queue->Close(); - // - } - - // Demonstrates: - // public Int32 IndexOf (MessageQueuePermissionEntry value) -public: - void IndexOfExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - // Display the index of the entry in the collection. - Console::WriteLine("Collection contains entry at index: {0}", - collection->IndexOf(entry)); - - queue->Close(); - // - } - - // Demonstrates: - // public Void Insert (Int32 index, MessageQueuePermissionEntry value) -public: - void InsertExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - // Create another new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ newEntry = - gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Send, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Insert the new entry into the collection before the original entry. - collection->Insert(0, newEntry); - - queue->Close(); - // - } - - // Demonstrates: - // public MessageQueuePermissionEntry Item [Int32 index] { get; set; } -public: - void ItemExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - // Display the entry's properties, using the collection's Item - // accessor. - Console::WriteLine("collection[0].PermissionAccess: {0}", - collection[0]->PermissionAccess); - Console::WriteLine("collection[0].MachineName: {0}", - collection[0]->MachineName); - Console::WriteLine("collection[0].Label: {0}", collection[0]->Label); - Console::WriteLine("collection[0].Category: {0}", - collection[0]->Category); - - queue->Close(); - // - } - - // Demonstrates: - // public Void Remove (MessageQueuePermissionEntry value) -public: - void RemoveExample() - { - // - // Connect to a queue on the local computer. - MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); - - // Create a new instance of MessageQueuePermission. - MessageQueuePermission^ permission = gcnew MessageQueuePermission(); - - // Get an instance of MessageQueuePermissionEntryCollection from the - // permission's PermissionEntries property. - MessageQueuePermissionEntryCollection^ collection = - permission->PermissionEntries; - - // Create a new instance of MessageQueuePermissionEntry. - MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( - MessageQueuePermissionAccess::Receive, - queue->MachineName, - queue->Label, - queue->Category.ToString()); - - // Add the entry to the collection. - collection->Add(entry); - - // Remove the entry from the collection. - collection->Remove(entry); - - queue->Close(); - // - } -}; - -// Creates a new queue. -void CreateQueue(String^ queuePath, bool transactional) -{ - if (!MessageQueue::Exists(queuePath)) - { - MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); - queue->Close(); - } - else - { - Console::WriteLine("{0} already exists.", queuePath); - } -} - -int main() -{ - // Create a new instance of the class. - MessageQueuePermissionEntryCollectionExample^ example = - gcnew MessageQueuePermissionEntryCollectionExample(); - - // Create a non-transactional queue on the local computer. - CreateQueue(".\\exampleQueue", false); - - // Demonstrate MessageQueuePermissionEntryCollection's members. - example->AddExample(); - example->AddRangeExample1(); - example->AddRangeExample2(); - example->ContainsExample(); - example->CopyToExample(); - example->IndexOfExample(); - example->InsertExample(); - example->ItemExample(); - example->RemoveExample(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp b/snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp deleted file mode 100644 index ec5c5a7a240..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Web::Services::Description.Message::FindPartsByName -// System::Web::Services::Description.Message::ServiceDescription -// System::Web::Services::Description.Message::FindPartByName - -/* The following program demonstrates the property ' ServiceDescription' and -methods 'FindPartsByName', 'FindPartByName' of class 'Message'. The program -reads a wsdl document S"MathService::wsdl" and instantiates a -ServiceDescription instance from WSDL document. -The program invokes 'FindPartsByName' to obtain an array of MessageParts and also invokes -'FindPartByName' to retrieve a specific 'MessagePart'. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - try - { - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_cpp.wsdl" ); - - // - // Get message from ServiceDescription. - Message^ myMessage1 = myServiceDescription->Messages[ "AddHttpPostIn" ]; - Console::WriteLine( "ServiceDescription : {0}", myMessage1->ServiceDescription ); - - // - array^myParts = gcnew array(2); - myParts[ 0 ] = "a"; - myParts[ 1 ] = "b"; - array^myMessageParts = myMessage1->FindPartsByName( myParts ); - Console::WriteLine( "Results of FindPartsByName operation:" ); - for ( int i = 0; i < myMessageParts->Length; ++i ) - { - Console::WriteLine( "Part Name: {0}", myMessageParts[ i ]->Name ); - Console::WriteLine( "Part Type: {0}", myMessageParts[ i ]->Type ); - } - // - // - // Get another message from ServiceDescription. - Message^ myMessage2 = myServiceDescription->Messages[ "DivideHttpGetOut" ]; - MessagePart^ myMessagePart = myMessage2->FindPartByName( "Body" ); - Console::WriteLine( "Results of FindPartByName operation:" ); - Console::WriteLine( "Part Name: {0}", myMessagePart->Name ); - Console::WriteLine( "Part Element: {0}", myMessagePart->Element ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp deleted file mode 100644 index a60f0e1720b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp +++ /dev/null @@ -1,15 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting::MetadataServices; -int main() -{ - MetaData::ConvertCodeSourceFileToAssemblyFile( "CsSource.cs", "testAssm.dll", "" ); - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp deleted file mode 100644 index c8665cf1b3c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting::Metadata; -using namespace System::Runtime::Remoting::MetadataServices; - -ref class TestClass -{ -private: - int integer; - -public: - static const double dFloatingPoint = 5.1999; - - property int Int - { - int get() - { - return integer; - } - void set( int value ) - { - integer = value; - } - } - void Print() - { - Console::WriteLine( "The double is equal to {0}.", dFloatingPoint ); - } -}; - -int main() -{ - array^types = gcnew array(4); - String^ s = "a"; - int i = -5; - double d = 3.1415; - TestClass^ tc = gcnew TestClass; - types[ 0 ] = s->GetType(); - types[ 1 ] = i.GetType(); - types[ 2 ] = d.GetType(); - types[ 3 ] = tc->GetType(); - MetaData::ConvertTypesToSchemaToFile( types, SdlType::Wsdl, "test.xml" ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp deleted file mode 100644 index 6fd71eb46d7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting::Metadata; -using namespace System::Runtime::Remoting::MetadataServices; -using namespace System::IO; - -ref class TestClass -{ -private: - int integer; - -public: - static const double dFloatingPoint = 5.1999; - - property int Int - { - int get() - { - return integer; - } - void set( int value ) - { - integer = value; - } - } - void Print() - { - Console::WriteLine( "The double is equal to {0}.", dFloatingPoint ); - } -}; - -int main() -{ - array^types = gcnew array(4); - String^ s = "a"; - int i = -5; - double d = 3.1415; - TestClass^ tc = gcnew TestClass; - types[ 0 ] = s->GetType(); - types[ 1 ] = i.GetType(); - types[ 2 ] = i.GetType(); - types[ 3 ] = tc->GetType(); - FileStream^ fs = gcnew FileStream( "test.xml",FileMode::OpenOrCreate ); - MetaData::ConvertTypesToSchemaToStream( types, SdlType::Wsdl, fs ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp deleted file mode 100644 index 0623e5a713a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Web::Services::Description.MimeContentBinding::Type -// System::Web::Services::Description.MimeContentBinding::Part -// System::Web::Services::Description.MimeContentBinding::NameSpace -// System::Web::Services::Description.MimeContentBinding - -/* The following program demonstrates the 'Type' and 'Part' properties -and the 'NameSpace' field of the 'MimeContentBinding' class. It reads the 'MimeContentSample_cs::wsdl' file -and instantiates a ServiceDescription Object*. 'MimeContentBinding' objects are retrieved from Extension -points of OutputBinding for one of the Binding Object* and its 'Type' and 'Part' properties are displayed. It also -displays 'NameSpace' of the 'MimeContentBinding' Object*. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; - -int main() -{ - // - // - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeContentSample_cpp.wsdl" ); - - // Get the Binding. - Binding^ myBinding = myServiceDescription->Bindings[ "b1" ]; - - // Get the first OperationBinding. - OperationBinding^ myOperationBinding = myBinding->Operations[ 0 ]; - OutputBinding^ myOutputBinding = myOperationBinding->Output; - ServiceDescriptionFormatExtensionCollection ^ myServiceDescriptionFormatExtensionCollection = myOutputBinding->Extensions; - - // Find all MimeContentBinding objects in extensions. - array^myMimeContentBindings = (array^)myServiceDescriptionFormatExtensionCollection->FindAll( MimeContentBinding::typeid ); - - // Enumerate the array and display MimeContentBinding properties. - IEnumerator^ myEnum = myMimeContentBindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MimeContentBinding^ myMimeContentBinding = safe_cast(myEnum->Current); - Console::WriteLine( "Type: {0}", myMimeContentBinding->Type ); - Console::WriteLine( "Part: {0}", myMimeContentBinding->Part ); - } - // - // - Console::WriteLine( "Namespace: {0}", MimeContentBinding::Namespace ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp deleted file mode 100644 index f7387c482ad..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// System::Web::Services::Description.MimeMultipartRelatedBinding -// System::Web::Services::Description.MimeMultipartRelatedBinding::Parts; - -/* The following program demonstrates the property 'Parts' of class 'MimeMultipartRelatedBinding'. -It reads 'MimeMultiPartRelatedSample_cpp.wsdl'file and instantiates a ServiceDescription Object*. -'MimeMultipartRelatedBinding' Object* is retrieved from Extension -points of OutputBinding for one of the Binding Object* and its property'Parts' has been demonstrated. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; - -int main() -{ - // - ServiceDescription^ myServicDescription = ServiceDescription::Read( "MimeMultiPartRelatedSample_cpp.wsdl" ); - - // Get the binding collection. - BindingCollection^ myBindingCollection = myServicDescription->Bindings; - int index = 0; - for ( int i = 0; i < myBindingCollection->Count; i++ ) - // Get the collection for MimeServiceHttpPost. - if ( String::Compare( myBindingCollection[ i ]->Name, "MimeServiceHttpPost" ) == 0 ) - { - OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ i ]->Operations; - OutputBinding^ myOutputBinding = myOperationBindingCollection[ 0 ]->Output; - ServiceDescriptionFormatExtensionCollection ^ myServiceDescriptionFormatExtensionCollection = myOutputBinding->Extensions; - MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = dynamic_cast(myServiceDescriptionFormatExtensionCollection->Find( MimeMultipartRelatedBinding::typeid )); - MimePartCollection^ myMimePartCollection = myMimeMultipartRelatedBinding->Parts; - IEnumerator^ myEnum = myMimePartCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MimePart^ myMimePart = dynamic_cast(myEnum->Current); - Console::WriteLine( "Extension Types added to MimePart: {0}", index++ ); - Console::WriteLine( "----------------------------" ); - IEnumerator^ myEnum2 = myMimePart->Extensions->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - Console::WriteLine( myEnum2->Current->GetType() ); - } - - Console::WriteLine( "" ); - } - - break; - } - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp b/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp deleted file mode 100644 index 5648074bf2a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// System::Web::Services::Description.MimePartCollection - -/* The following program demostrates 'MimePartCollection' class. It -takes 'MimePartCollection_1_Input_cpp.wsdl' as input which -contains one 'MimePart' Object* that supports 'HttpPost'. -A mimepartcollection Object* is created and mimepart is added to the -mimepartcollection at the specified location, finally writes -into the file'MimePartCollection_1_Output_cpp.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePartCollection_1_Input_cpp.wsdl" ); - ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection; - myServiceDescriptionCol->Add( myServiceDescription ); - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" ); - - // Create a 'Binding' object. - Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName ); - OperationBinding^ myOperationBinding = nullptr; - for ( int i = 0; i < myBinding->Operations->Count; i++ ) - if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) ) - myOperationBinding = myBinding->Operations[ i ]; - - OutputBinding^ myOutputBinding = myOperationBinding->Output; - MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = nullptr; - IEnumerator^ myIEnumerator = myOutputBinding->Extensions->GetEnumerator(); - while ( myIEnumerator->MoveNext() ) - myMimeMultipartRelatedBinding = dynamic_cast(myIEnumerator->Current); - - // Create an instances of 'MimePartCollection'. - MimePartCollection^ myMimePartCollection = gcnew MimePartCollection; - myMimePartCollection = myMimeMultipartRelatedBinding->Parts; - Console::WriteLine( "Total number of mimepart elements initially is: {0}", myMimePartCollection->Count ); - - // Create an instance of 'MimePart'. - MimePart^ myMimePart = gcnew MimePart; - - // Create an instance of 'MimeXmlBinding'. - MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding; - myMimeXmlBinding->Part = "body"; - myMimePart->Extensions->Add( myMimeXmlBinding ); - - // Insert a mimepart at first position. - myMimePartCollection->Insert( 0, myMimePart ); - Console::WriteLine( "Inserting a mimepart object..." ); - if ( myMimePartCollection->Contains( myMimePart ) ) - { - Console::WriteLine( "'MimePart' is succesffully added at position: {0}", myMimePartCollection->IndexOf( myMimePart ) ); - Console::WriteLine( "Total number of mimepart elements after inserting is: {0}", myMimePartCollection->Count ); - } - - myServiceDescription->Write( "MimePartCollection_1_Output_cpp.wsdl" ); - Console::WriteLine( "MimePartCollection_1_Output_cpp.wsdl has been generated successfully." ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp b/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp deleted file mode 100644 index dcd7449eeb1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// System::Web::Services::Description.MimePartCollection::MimePartCollection() -// System::Web::Services::Description.MimePartCollection::Item->Item[System::Int32 index] -// System::Web::Services::Description.MimePartCollection::Insert -// System::Web::Services::Description.MimePartCollection::IndexOf -// System::Web::Services::Description.MimePartCollection->Add -// System::Web::Services::Description.MimePartCollection::Contains -// System::Web::Services::Description.MimePartCollection::CopyTo -// System::Web::Services::Description.MimePartCollection::Remove - -/* This program demonstrates the constructor, the 'Item' property , the 'Insert', 'IndexOf', 'Add', -'Contains', 'CopyTo', and 'Remove' methods of the 'MimePartCollection' class. -It takes 'MimePartCollection_8_Input_cpp.wsdl' as an input file which contains -one 'MimePart' object that supports 'HttpPost'. A MimePartCollection object is -created and new MimePart objects are added to MimePartCollection using the 'Insert' -and 'Add' methods. A MimePart object is removed from the MimePartCollection using the -'Remove' method. The ServiceDescription is finally written into an output wsdl file -'MimePartCollection_8_out_CS::wsdl'. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePartCollection_8_Input_cpp.wsdl" ); - ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection; - myServiceDescriptionCol->Add( myServiceDescription ); - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" ); - - // Create a binding object. - Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName ); - OperationBinding^ myOperationBinding = nullptr; - for ( int i = 0; i < myBinding->Operations->Count; i++ ) - if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) ) - myOperationBinding = myBinding->Operations[ i ]; - - OutputBinding^ myOutputBinding = myOperationBinding->Output; - - // - // - // - // - MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = nullptr; - IEnumerator^ myIEnumerator = myOutputBinding->Extensions->GetEnumerator(); - while ( myIEnumerator->MoveNext() ) - myMimeMultipartRelatedBinding = (MimeMultipartRelatedBinding^)myIEnumerator->Current; - - // Create an instance of 'MimePartCollection'. - MimePartCollection^ myMimePartCollection = gcnew MimePartCollection; - myMimePartCollection = myMimeMultipartRelatedBinding->Parts; - Console::WriteLine( "Total number of mimepart elements in the collection initially is: {0}", myMimePartCollection->Count ); - - // Get the type of first 'Item' in collection. - Console::WriteLine( "The first object in collection is of type: {0}", myMimePartCollection[ 0 ] ); - MimePart^ myMimePart1 = gcnew MimePart; - - // Create an instance of 'MimeXmlBinding'. - MimeXmlBinding^ myMimeXmlBinding1 = gcnew MimeXmlBinding; - myMimeXmlBinding1->Part = "body"; - myMimePart1->Extensions->Add( myMimeXmlBinding1 ); - - // a mimepart at first position. - myMimePartCollection->Insert( 0, myMimePart1 ); - Console::WriteLine( "Inserting a mimepart object..." ); - - // Check whether 'Insert' was successful or not. - if ( myMimePartCollection->Contains( myMimePart1 ) ) - { - // Display the index of inserted 'MimePart'. - Console::WriteLine( "'MimePart' is successfully inserted at position: {0}", myMimePartCollection->IndexOf( myMimePart1 ) ); - } - // - // - // - // - - Console::WriteLine( "Total number of mimepart elements after inserting is: {0}", myMimePartCollection->Count ); - - // - // - MimePart^ myMimePart2 = gcnew MimePart; - MimeXmlBinding^ myMimeXmlBinding2 = gcnew MimeXmlBinding; - myMimeXmlBinding2->Part = "body"; - myMimePart2->Extensions->Add( myMimeXmlBinding2 ); - - // Add a mimepart to the mimepartcollection. - myMimePartCollection->Add( myMimePart2 ); - Console::WriteLine( "Adding a mimepart object..." ); - - // Check if collection contains added mimepart object. - if ( myMimePartCollection->Contains( myMimePart2 ) ) - Console::WriteLine( "'MimePart' is successfully added at position: {0}", myMimePartCollection->IndexOf( myMimePart2 ) ); - // - // - - Console::WriteLine( "Total number of mimepart elements after adding is: {0}", myMimePartCollection->Count ); - - // - array^myArray = gcnew array(myMimePartCollection->Count); - - // Copy the mimepartcollection to an array. - myMimePartCollection->CopyTo( myArray, 0 ); - Console::WriteLine( "Displaying the array copied from mimepartcollection" ); - for ( int j = 0; j < myMimePartCollection->Count; j++ ) - { - Console::WriteLine( "Mimepart object at position : {0}", j ); - for ( int i = 0; i < myArray[ j ]->Extensions->Count; i++ ) - { - MimeXmlBinding^ myMimeXmlBinding3 = (MimeXmlBinding^)(myArray[ j ]->Extensions[ i ]); - Console::WriteLine( "Part: {0}", (myMimeXmlBinding3->Part) ); - } - } - // - // - Console::WriteLine( "Removing a mimepart object..." ); - - // Remove the mimepart from the mimepartcollection. - myMimePartCollection->Remove( myMimePart1 ); - - // Check whether the mimepart is removed or not. - if ( !myMimePartCollection->Contains( myMimePart1 ) ) - Console::WriteLine( "Mimepart is successfully removed from mimepartcollection" ); - // - - Console::WriteLine( "Total number of elements in collection after removing is: {0}", myMimePartCollection->Count ); - array^myArray1 = gcnew array(myMimePartCollection->Count); - myMimePartCollection->CopyTo( myArray1, 0 ); - Console::WriteLine( "Dispalying the 'MimePartCollection' after removing" ); - for ( int j = 0; j < myMimePartCollection->Count; j++ ) - { - Console::WriteLine( "Mimepart object at position : {0}", j ); - for ( int i = 0; i < myArray1[ j ]->Extensions->Count; i++ ) - { - MimeXmlBinding^ myMimeXmlBinding3 = (MimeXmlBinding^)(myArray1[ j ]->Extensions[ i ]); - Console::WriteLine( "part: {0}", (myMimeXmlBinding3->Part) ); - } - } - myServiceDescription->Write( "MimePartCollection_8_output.wsdl" ); - Console::WriteLine( "MimePartCollection_8_output.wsdl has been generated successfully." ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp b/snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp deleted file mode 100644 index 78518047dc2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// System.Web.Services.Description.MimePart -// System.Web.Services.Description.MimePart.ctor() -// System.Web.Services.Description.MimePart.Extensions -/* The following program demonstrates the 'MimePart' class, constructor -and 'Extensions' property of 'MimePart' class. It reads -'MimePart_3_Input_cpp.wsdl' file which does not have 'MimePart' object -supporting 'OutPut' of 'HttpPost'. It adds the 'MimePart' and finally -writes into 'MimePart_3_OutPut_cpp.wsdl' file. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePart_3_Input_cpp.wsdl" ); - ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection; - myServiceDescriptionCol->Add( myServiceDescription ); - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" ); - - // Create the Binding. - Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName ); - OperationBinding^ myOperationBinding = nullptr; - for ( int i = 0; i < myBinding->Operations->Count; i++ ) - { - if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) ) - { - myOperationBinding = myBinding->Operations[ i ]; - } - } - - // - // - // Create the OutputBinding. - OutputBinding^ myOutputBinding = myOperationBinding->Output; - MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding; - myMimeXmlBinding->Part = "body"; - - // Create the MimePart. - MimePart^ myMimePart = gcnew MimePart; - myMimePart->Extensions->Add( myMimeXmlBinding ); - MimeMultipartRelatedBinding^ myMimePartRelatedBinding = gcnew MimeMultipartRelatedBinding; - - // Add the MimePart to the MimePartRelatedBinding. - myMimePartRelatedBinding->Parts->Add( myMimePart ); - myOutputBinding->Extensions->Add( myMimePartRelatedBinding ); - // - // - - myServiceDescription->Write( "MimePart_3_Output_CPP.wsdl" ); - Console::WriteLine( "MimePart_3_Output_CPP.wsdl has been generated successfully." ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp deleted file mode 100644 index a1904f5cf88..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp +++ /dev/null @@ -1,138 +0,0 @@ - - -// System.Web.Services.Description.MimeTextMatch -// System.Web.Services.Description.MimeTextMatch.Capture -// System.Web.Services.Description.MimeTextMatch.Group -// System.Web.Services.Description.MimeTextMatch.Repeats -// System.Web.Services.Description.MimeTextMatch.RepeatsString -/* The following program demostrates constructor, 'Capture', 'Group', - 'Repeats' and 'RepeatsString' properties of 'MimeTextMatch'class. - It takes 'MimeTextMatch_5_Input_CPP.wsdl' as input which does not - contain 'Binding' object supporting 'HttpPost'. A text pattern - ''TITLE>(.*?)<' with text name as 'Title' and type - name set which is to be searched in a HTTP transmission is added to the ServiceDescription. - The modified ServiceDescription is written into 'MimeTextMatch_5_Output_CPP.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - int myInt = 0; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeTextMatch_5_Input_CPP.wsdl" ); - - // Create the 'Binding' object. - Binding^ myBinding = gcnew Binding; - - // Initialize 'Name' property of 'Binding' class. - myBinding->Name = "MimeTextMatchServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeTextMatchServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - - // Create the 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - - // Create the 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; - myHttpOperationBinding->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' object to 'OperationBinding'. - myOperationBinding->Extensions->Add( myHttpOperationBinding ); - - // - // - // - // - // Create an InputBinding. - InputBinding^ myInputBinding = gcnew InputBinding; - MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding; - MimeTextMatchCollection^ myMimeTextMatchCollection1 = gcnew MimeTextMatchCollection; - array^myMimeTextMatch = gcnew array(3); - myMimeTextMatchCollection1 = myMimeTextBinding->Matches; - - // Intialize the MimeTextMatch. - for ( myInt = 0; myInt < 3; myInt++ ) - { - // Get a new MimeTextMatch. - myMimeTextMatch[ myInt ] = gcnew MimeTextMatch; - - // Assign values to properties of the MimeTextMatch. - myMimeTextMatch[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) ); - myMimeTextMatch[ myInt ]->Type = "*/*"; - myMimeTextMatch[ myInt ]->Pattern = "TITLE>(.*?)<"; - myMimeTextMatch[ myInt ]->IgnoreCase = true; - myMimeTextMatch[ myInt ]->Capture = 2; - myMimeTextMatch[ myInt ]->Group = 2; - if ( myInt != 0 ) - { - - // Assign the Repeats property if the index is not 0. - myMimeTextMatch[ myInt ]->Repeats = 2; - } - else - { - - // Assign the RepeatsString property if the index is 0. - myMimeTextMatch[ myInt ]->RepeatsString = "4"; - } - myMimeTextMatchCollection1->Add( myMimeTextMatch[ myInt ] ); - - } - // - // - // - // - - myInputBinding->Extensions->Add( myMimeTextBinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - - // Create the 'OutputBinding' instance. - OutputBinding^ myOutput = gcnew OutputBinding; - MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; - - // Initialize 'Part' property of 'MimeXmlBinding' class. - postMimeXmlbinding->Part = "Body"; - - // Add 'MimeXmlBinding' instance to 'OutputBinding' instance. - myOutput->Extensions->Add( postMimeXmlbinding ); - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myServiceDescription->Bindings->Add( myBinding ); - - // Write the 'ServiceDescription' as a WSDL file. - myServiceDescription->Write( "MimeTextMatch_5_Output_CPP.wsdl" ); - Console::WriteLine( "WSDL file with name 'MimeTextMatch_5_Output_CPP.wsdl' is" - " created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp deleted file mode 100644 index 495d3ca8b82..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - -// System.Web.Services.Description.MimeTextBinding -// System.Web.Services.Description.MimeTextBinding() -// System.Web.Services.Description.MimeTextMatch() -// System.Web.Services.Description.MimeTextMatch.Name -// System.Web.Services.Description.MimeTextMatch.Type -// System.Web.Services.Description.MimeTextMatch.Pattern -// System.Web.Services.Description.MimeTextMatch.IgnoreCase -// System.Web.Services.Description.MimeTextBinding.Matches -/* This program demostrates constructor and 'Matches' property -of 'MimeTextBinding' class and 'Name', 'Type', 'Pattern', -'IgnoreCase' properties of 'MimeTextMatch' class. -It takes 'MimeText_Binding_Match_8_Input_CPP.wsdl' as an -input file which does not contain 'Binding' object that supports -'HttpPost'. A text pattern ''TITLE>(.*?)<' with text name -as 'Title' and with type name set, is added to the wsdl file. Finally the -' modified ServiceDescription is written to 'MimeText_Binding_Match_8_Output_CPP.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeText_Binding_Match_8_Input_CPP.wsdl" ); - - // Create a Binding. - Binding^ myBinding = gcnew Binding; - - // Initialize the Name property of the Binding. - myBinding->Name = "MimeText_Binding_MatchServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeText_Binding_MatchServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - - // Create an HttpBinding. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the HttpBinding to the Binding. - myBinding->Extensions->Add( myHttpBinding ); - - // Create an OperationBinding. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; - myHttpOperationBinding->Location = "/AddNumbers"; - - // Add the HttpOperationBinding to the OperationBinding. - myOperationBinding->Extensions->Add( myHttpOperationBinding ); - - // Create an InputBinding. - InputBinding^ myInputBinding = gcnew InputBinding; - MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; - postMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInputBinding->Extensions->Add( postMimeContentbinding ); - - // Add the InputBinding to the OperationBinding. - myOperationBinding->Input = myInputBinding; - - // - // - // - // - // - // - // - // Create an OutputBinding. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - - // Create a MimeTextBinding. - MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding; - - // Create a MimeTextMatch. - MimeTextMatch^ myMimeTextMatch = gcnew MimeTextMatch; - MimeTextMatchCollection^ myMimeTextMatchCollection; - - // Initialize properties of the MimeTextMatch. - myMimeTextMatch->Name = "Title"; - myMimeTextMatch->Type = "*/*"; - myMimeTextMatch->Pattern = "'TITLE>(.*?)<"; - myMimeTextMatch->IgnoreCase = true; - - // Initialize a MimeTextMatchCollection. - myMimeTextMatchCollection = myMimeTextBinding->Matches; - - // Add the MimeTextMatch to the MimeTextMatchCollection. - myMimeTextMatchCollection->Add( myMimeTextMatch ); - myOutputBinding->Extensions->Add( myMimeTextBinding ); - - // Add the OutputBinding to the OperationBinding. - myOperationBinding->Output = myOutputBinding; - // - // - // - // - // - // - // - - // Add the OutputBinding to the OperationBinding. - myOperationBinding->Output = myOutputBinding; - - // Add the OperationBinding to the Binding. - myBinding->Operations->Add( myOperationBinding ); - - // Add the Binding to the BindingCollection of the ServiceDescription. - myServiceDescription->Bindings->Add( myBinding ); - - // Write the ServiceDescription as a WSDL file. - myServiceDescription->Write( "MimeText_Binding_Match_8_Output_CPP.wsdl" ); - Console::WriteLine( "WSDL file named 'MimeText_Binding_Match_8_Output_CPP.wsdl' was" - " created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp deleted file mode 100644 index c488a6fea49..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// System.Web.Services.Description.MimeTextMatchCollection -// System.Web.Services.Description.MimeTextMatchCollection() -// System.Web.Services.Description.MimeTextMatchCollection.Contains -// System.Web.Services.Description.MimeTextMatchCollection.Add -// System.Web.Services.Description.MimeTextMatchCollection.CopyTo -// System.Web.Services.Description.MimeTextMatchCollection.Remove -// System.Web.Services.Description.MimeTextMatchCollection.Item -// System.Web.Services.Description.MimeTextMatchCollection.IndexOf -// System.Web.Services.Description.MimeTextMatchCollection.Insert - -/* This program demostrates constructor, Contains, Add, Item, - IndexOf, Insert and Remove property of 'MimeTextMatchCollection'. - This program takes 'MimeText_Match_MatchColl_9_Input_CPP.wsdl' as an - input file which does not contain 'Binding' object that supports - 'HttpPost'. A name, type, Group and Capture properties are set - which are to be searched in a HTTP transmission and - 'MimeTextMatchCollection' collection object is created - for input and output of 'HttpPost' and finally writes into - 'MimeText_Match_MatchColl_9_Output_CPP.wsdl'. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - int myInt = 0; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeText_Match_MatchColl_9_Input_CPP.wsdl" ); - - // Create the 'Binding' object. - Binding^ myBinding = gcnew Binding; - - // Initialize 'Name' property of 'Binding' class. - myBinding->Name = "MimeText_Match_MatchCollServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeText_Match_MatchCollServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - - // Create the 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - - // Create the 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; - myHttpOperationBinding->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myHttpOperationBinding ); - - // - // Create the 'InputBinding' object. - InputBinding^ myInputBinding = gcnew InputBinding; - MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding; - MimeTextMatchCollection^ myMimeTextMatchCollection; - - // - // - // - // Get an array instance of 'MimeTextMatch' class. - array^myMimeTextMatch = gcnew array(4); - myMimeTextMatchCollection = myMimeTextBinding->Matches; - - // Initialize properties of 'MimeTextMatch' class. - for ( myInt = 0; myInt < 4; myInt++ ) - { - // Create the 'MimeTextMatch' instance. - myMimeTextMatch[ myInt ] = gcnew MimeTextMatch; - myMimeTextMatch[ myInt ]->Name = "Title"; - myMimeTextMatch[ myInt ]->Type = "*/*"; - myMimeTextMatch[ myInt ]->IgnoreCase = true; - if ( true == myMimeTextMatchCollection->Contains( myMimeTextMatch[ 0 ] ) ) - { - myMimeTextMatch[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) ); - myMimeTextMatch[ myInt ]->Capture = 2; - myMimeTextMatch[ myInt ]->Group = 2; - myMimeTextMatchCollection->Add( myMimeTextMatch[ myInt ] ); - } - else - { - myMimeTextMatchCollection->Add( myMimeTextMatch[ myInt ] ); - myMimeTextMatchCollection[ myInt ]->RepeatsString = "2"; - } - } - myMimeTextMatchCollection = myMimeTextBinding->Matches; - - // Copy collection to 'MimeTextMatch' array instance. - myMimeTextMatchCollection->CopyTo( myMimeTextMatch, 0 ); - // - // - // - - myInputBinding->Extensions->Add( myMimeTextBinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - - // Create the 'OutputBinding' instance. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - - // Create the 'MimeTextBinding' instance. - MimeTextBinding^ myMimeTextBinding1 = gcnew MimeTextBinding; - - // - // - // - // - // - // Get an instance of 'MimeTextMatchCollection'. - MimeTextMatchCollection^ myMimeTextMatchCollection1 = gcnew MimeTextMatchCollection; - array^myMimeTextMatch1 = gcnew array(5); - myMimeTextMatchCollection1 = myMimeTextBinding1->Matches; - for ( myInt = 0; myInt < 4; myInt++ ) - { - myMimeTextMatch1[ myInt ] = gcnew MimeTextMatch; - myMimeTextMatch1[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) ); - if ( myInt != 0 ) - { - myMimeTextMatch1[ myInt ]->RepeatsString = "7"; - } - myMimeTextMatchCollection1->Add( myMimeTextMatch1[ myInt ] ); - } - myMimeTextMatch1[ 4 ] = gcnew MimeTextMatch; - - // Remove 'MimeTextMatch' instance from collection. - myMimeTextMatchCollection1->Remove( myMimeTextMatch1[ 1 ] ); - - // Using MimeTextMatchCollection.Item indexer to comapre. - if ( myMimeTextMatch1[ 2 ] == myMimeTextMatchCollection1[ 1 ] ) - { - // Check whether 'MimeTextMatch' instance exists. - myInt = myMimeTextMatchCollection1->IndexOf( myMimeTextMatch1[ 2 ] ); - - // Insert 'MimeTextMatch' instance at a desired position. - myMimeTextMatchCollection1->Insert( 1, myMimeTextMatch1[ myInt ] ); - myMimeTextMatchCollection1[ 1 ]->RepeatsString = "5"; - myMimeTextMatchCollection1->Insert( 4, myMimeTextMatch1[ myInt ] ); - } - // - // - // - // - // - // - - myOutputBinding->Extensions->Add( myMimeTextBinding1 ); - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutputBinding; - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutputBinding; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myServiceDescription->Bindings->Add( myBinding ); - - // Write the 'ServiceDescription' as a WSDL file. - myServiceDescription->Write( "MimeText_Match_MatchColl_9_Output_CPP.wsdl" ); - Console::WriteLine( "WSDL file with name 'MimeText_Match_MatchColl_9_Output_CPP.wsdl' is" - " created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp deleted file mode 100644 index 0cb0a7cb654..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp +++ /dev/null @@ -1,93 +0,0 @@ - - -// System.Web.Services.Description.MimeXmlBinding -// System.Web.Services.Description.MimeXmlBinding.MimeXmlBinding() -// System.Web.Services.Description.MimeXmlBinding.Part -/* The following program demonstrates constructor and 'Part'property -of 'MimeXmlBinding' class. This program takes 'MimeXmlBinding_Part_3_Input_CPP.wsdl' -as input, which does not contain 'Binding' object that supports 'HttpPost'. -It sets message part property to 'Body' on which 'MimeXmlBinding' is -applied and finally writes into 'MimeXmlBinding_Part_3_Output_CPP.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "MimeXmlBinding_Part_3_Input_CPP.wsdl" ); - - // Create the 'Binding' object. - Binding^ myBinding = gcnew Binding; - - // Initialize 'Name' property of 'Binding' class. - myBinding->Name = "MimeXmlBinding_Part_3_ServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeXmlBinding_Part_3_ServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - - // Create the 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - - // Create the 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; - myHttpOperationBinding->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myHttpOperationBinding ); - - // Create the 'InputBinding' object. - InputBinding^ myInputBinding = gcnew InputBinding; - MimeContentBinding^ myMimeContentBinding = gcnew MimeContentBinding; - myMimeContentBinding->Type = "application/x-www-form-urlencoded"; - myInputBinding->Extensions->Add( myMimeContentBinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - - // - // - // Create an OutputBinding. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding; - - // Initialize the Part property of the MimeXmlBinding. - myMimeXmlBinding->Part = "Body"; - - // Add the MimeXmlBinding to the OutputBinding. - myOutputBinding->Extensions->Add( myMimeXmlBinding ); - // - // - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutputBinding; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "MimeXmlBinding_Part_3_Output_CPP.wsdl" ); - Console::WriteLine( "WSDL file with name 'MimeXmlBinding_Part_3_Output_CPP.wsdl' is" - " created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp deleted file mode 100644 index 6fdfe8f6904..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp +++ /dev/null @@ -1,235 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; - -// -// The following method displays the properties of the -// specified WebProxy instance. -void DisplayProxyProperties( WebProxy^ proxy ) -{ - Console::WriteLine( "Address: {0}", proxy->Address ); - Console::WriteLine( "Bypass on local: {0}", proxy->BypassProxyOnLocal ); - - int count = proxy->BypassList->Length; - if ( count == 0 ) - { - Console::WriteLine( "The bypass list is empty." ); - return; - } - - array^bypass = proxy->BypassList; - Console::WriteLine( "The bypass list contents:" ); - for ( int i = 0; i < count; i++ ) - { - Console::WriteLine( bypass[ i ] ); - - } -} -// - -// -// The following method creates a Web proxy that uses -// Web proxy auto-discovery and supplies -// credentials to be used to download the wpad.dat script. -void CheckAutoProxyForRequest( Uri^ resource ) -{ - WebProxy^ proxy = gcnew WebProxy; - - // See what proxy is used for the resource. - Uri^ resourceProxy = proxy->GetProxy( resource ); - - // Test to see if a proxy was selected. - if ( resourceProxy == resource ) - { - Console::WriteLine( "No proxy for {0}", resource ); - } - else - { - Console::WriteLine( "Proxy for {0} is {1}", - resource, resourceProxy ); - } -} -// - -// -// The following method creates a WebProxy object that uses Internet Explorer's -// detected script if it is found in the registry; otherwise, it -// tries to use Web proxy auto-discovery to set the proxy used for -// the request. -void CheckAutoGlobalProxyForRequest( Uri^ resource ) -{ - WebProxy^ proxy = gcnew WebProxy; - - // Display the proxy's properties. - DisplayProxyProperties( proxy ); - - // See what proxy is used for the resource. - Uri^ resourceProxy = proxy->GetProxy( resource ); - - // Test to see whether a proxy was selected. - if ( resourceProxy == resource ) - { - Console::WriteLine( "No proxy for {0}", resource ); - } - else - { - Console::WriteLine( "Proxy for {0} is {1}", resource, resourceProxy ); - } -} -// - -// The following method creates a Web proxy that -// has its initial values set by the Internet Explorer's -// explicit proxy address and bypass list. -// The proxy uses Internet Explorer's automatically detected -// script if it found in the registry; otherwise, it tries to use -// Web proxy auto-discovery to set the proxy used for -// the request. -void CheckAutoDefaultProxyForRequest( Uri^ resource ) -{ - WebProxy^ proxy = dynamic_cast(WebRequest::DefaultWebProxy); - - // Display the proxy properties. - DisplayProxyProperties( proxy ); - - // See what proxy is used for resource. - Uri^ resourceProxy = proxy->GetProxy( resource ); - - // Test to see if a proxy was selected. - if ( resourceProxy == resource ) - { - Console::WriteLine( "No proxy for {0}", resource ); - } - else - { - Console::WriteLine( "Proxy for {0} is {1}", resource, resourceProxy ); - } -} - -// -// This method specifies a script that should -// be used in the event that auto-discovery fails. -void CheckAutoProxyAndScriptForRequest( Uri^ resource, Uri^ script ) -{ - WebProxy^ proxy = gcnew WebProxy; - DisplayProxyProperties( proxy ); - - // See what proxy is used for resource. - Uri^ resourceProxy = dynamic_cast(proxy->GetProxy(resource)); - - // Test to see whether a proxy was selected. - if ( resourceProxy == resource ) - { - Console::WriteLine( "No proxy for {0}", resource ); - } - else - { - Console::WriteLine( "Proxy for {0} is {1}", resource, resourceProxy ); - } -} -// - -// if construct with glocabl select -// if use system = true then if proxy = Glocalproxy.Select - the returned instance -// will have its values set -// by IE settings. If you do webProxy get default roxy reads manual setting (proxy address and -// bypass - doesn't matter what the config file has. -// -// The following method explicitly identifies -// the script to be downloaded and used to select the proxy. -void CheckScriptedProxyForRequest( Uri^ resource, Uri^ script ) -{ - WebProxy^ proxy = gcnew WebProxy; - - // See what proxy is used for resource. - Uri^ resourceProxy = dynamic_cast(proxy->GetProxy(resource)); - - // Test to see whether a proxy was selected. - if ( resourceProxy == nullptr ) - { - Console::WriteLine( "No proxy selected for {0}.", resource ); - return; - } - else - { - Console::WriteLine( "proxy returned for {0}.", resource ); - { - - // DIRECT in script is returned as a null Uri object. - if ( resourceProxy == nullptr ) - Console::WriteLine( "DIRECT" ); - else - Console::WriteLine( "{0}", resourceProxy ); - - } - } -} -// - -// -WebResponse^ CheckLatestScriptRequest( Uri^ resource, WebProxy^ proxy ) -{ - WebRequest^ request = WebRequest::Create( resource ); - request->Proxy = proxy; - WebResponse^ response = request->GetResponse(); - return response; -} -// - -void CheckScriptedProxyForRequest2( Uri^ resource, Uri^ script ) -{ - WebProxy^ proxy = gcnew WebProxy; - - // if use ssystem = true then if proxy = Glocalproxy.Select - the returned instance - // will have its values set - // by IE settings. If you do webProxy get defaultProxy reads manual setting (proxy address and - // bypass - doesn't matter what the config file has. - - // if construct with global select - - // See what proxy is used for resource. - Uri^ resourceProxy = proxy->GetProxy( resource ); - Console::WriteLine( "GetProxy returned for {0} is {1}.", resource, resourceProxy ); - - -} - -void Underline() -{ - Console::WriteLine( "=======================================" ); -} - -int main() -{ - Uri^ resource = gcnew Uri( "http://www.example.com" ); - - // Console.WriteLine("nothing - default ctor"); Underline(); - // DisplayProxyProperties(new WebProxy()); - // Console.WriteLine ("\n\nAuto-only - default ctor"); Underline(); - // CheckAutoProxyForRequest(resource); - Console::WriteLine( "\n\nAuto-only - GlobalProxySelection.Select" ); - Underline(); - CheckAutoGlobalProxyForRequest( resource ); - - /* - Console.WriteLine ("\n\nAuto-only - DefaultProxy"); Underline(); - CheckAutoDefaultProxyForRequest(resource); - */ - // Console.WriteLine("\n\n IE auto + Valid Script-only"); - // CheckScriptedProxyForRequest(resource, new Uri("http://sharriso1/wpad.dat")); - // Console.WriteLine("\n\n IE auto Invalid Script-only"); - // CheckScriptedProxyForRequest(resource, new Uri("http://sharriso1/wpadx.dat")); - /* Console.WriteLine("Auto and Valid script"); - CheckAutoProxyAndScriptForRequest(resource, new Uri("http://sharriso1/wpad.dat")); - - Console.WriteLine("Auto and Invalid script"); - CheckAutoProxyAndScriptForRequest(resource, new Uri("http://sharriso1/wpadx.dat")); - */ - // check snippet 5 - // CheckLatestScriptRequest(resource, WebProxy.GetDefaultProxy()); - // check snippet 6 - //CheckAutoProxyForRequest( resource); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp deleted file mode 100644 index 18275c877c2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp +++ /dev/null @@ -1,77 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Net; - -// This example is run at the command line. -// Specify one argument: the name of the host to -// send the request to. -// If the request is sucessful, the example displays the contents of the cookies -// returned by the host. -// -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args == nullptr || args->Length != 2 ) - { - Console::WriteLine( "Specify the URL to receive the request." ); - Environment::Exit( 1 ); - } - - - // - HttpWebRequest^ request = dynamic_cast(WebRequest::Create( args[ 1 ] )); - request->CookieContainer = gcnew CookieContainer; - HttpWebResponse^ response = dynamic_cast(request->GetResponse()); - response->Cookies = request->CookieContainer->GetCookies( request->RequestUri ); - - // Print the properties of each cookie. - System::Collections::IEnumerator^ myEnum = response->Cookies->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Cookie^ cook = safe_cast(myEnum->Current); - Console::WriteLine( "Cookie:" ); - Console::WriteLine( "{0} = {1}", cook->Name, cook->Value ); - Console::WriteLine( "Domain: {0}", cook->Domain ); - Console::WriteLine( "Path: {0}", cook->Path ); - Console::WriteLine( "Port: {0}", cook->Port ); - Console::WriteLine( "Secure: {0}", cook->Secure ); - Console::WriteLine( "When issued: {0}", cook->TimeStamp ); - Console::WriteLine( "Expires: {0} (expired? {1})", cook->Expires, cook->Expired ); - Console::WriteLine( "Don't save: {0}", cook->Discard ); - Console::WriteLine( "Comment: {0}", cook->Comment ); - Console::WriteLine( "Uri for comments: {0}", cook->CommentUri ); - Console::WriteLine( "Version: RFC {0}", cook->Version == 1 ? (String^)"2109" : "2965" ); - - // - // Show the string representation of the cookie. - Console::WriteLine( "String: {0}", cook ); - - // - } - // - -} - -// -// Output from this example will be vary depending on the host name specified, -// but will be similar to the following. -/* -Cookie: -CustomerID = 13xyz -Domain: .contoso.com -Path: / -Port: -Secure: False -When issued: 1/14/2003 3:20:57 PM -Expires: 1/17/2013 11:14:07 AM (expired? False) -Don't save: False -Comment: -Uri for comments: -Version: RFC 2965 -String: CustomerID = 13xyz -*/ -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp deleted file mode 100644 index 848433c877c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp +++ /dev/null @@ -1,249 +0,0 @@ - -// NCLCredPolicy -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::IO; -using namespace System::Text; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace Microsoft::Win32; - -// -public ref class SelectedHostsCredentialPolicy: public ICredentialPolicy -{ -public: - SelectedHostsCredentialPolicy(){} - - virtual bool ShouldSendCredential( Uri^ challengeUri, WebRequest^ request, NetworkCredential^ /*credential*/, IAuthenticationModule^ /*authModule*/ ) - { - Console::WriteLine( L"Checking custom credential policy." ); - if ( request->RequestUri->Host->Equals( L"www.contoso.com" ) || challengeUri->IsLoopback ) - return true; - - return false; - } -}; -// - -// -// The following class allows credentials to be sent if they are for requests for resources -// in the same domain, or if the request uses the HTTPSscheme and basic authentication is -// required. -public ref class HttpsBasicCredentialPolicy: public IntranetZoneCredentialPolicy -{ -public: - HttpsBasicCredentialPolicy(){} - - virtual bool ShouldSendCredential( Uri^ challengeUri, WebRequest^ request, NetworkCredential^ credential, IAuthenticationModule^ authModule ) override - { - Console::WriteLine( L"Checking custom credential policy for HTTPS and basic." ); - bool answer = IntranetZoneCredentialPolicy::ShouldSendCredential( challengeUri, request, credential, authModule ); - if ( answer ) - { - Console::WriteLine( L"Sending credential for intranet resource." ); - return answer; - } - - // Determine whether the base implementation returned false for basic and HTTPS. - if ( request->RequestUri->Scheme == Uri::UriSchemeHttps && authModule->AuthenticationType->Equals( L"Basic" ) ) - { - Console::WriteLine( L"Sending credential for HTTPS and basic." ); - return true; - } - - return false; - } -}; -// - -public ref class CredentialPolicyExamples -{ -public: - static void UseHttpsBasicCredentialPolicy() - { - HttpsBasicCredentialPolicy^ encryptedBasic = gcnew HttpsBasicCredentialPolicy; - AuthenticationManager::CredentialPolicy = encryptedBasic; - } - - static void UseCustomCredentialPolicy() - { - SelectedHostsCredentialPolicy^ hosts = gcnew SelectedHostsCredentialPolicy; - AuthenticationManager::CredentialPolicy = hosts; - } - - // - static void UseIntranetCredentialPolicy() - { - IntranetZoneCredentialPolicy^ policy = gcnew IntranetZoneCredentialPolicy; - AuthenticationManager::CredentialPolicy = policy; - } - // - - // - // The following example uses the System, System.Net, - // and System.IO namespaces. - static void RequestMutualAuth( Uri^ resource ) - { - // Create a new HttpWebRequest object for the specified resource. - WebRequest^ request = dynamic_cast(WebRequest::Create( resource )); - - // Request mutual authentication. - request->AuthenticationLevel = AuthenticationLevel::MutualAuthRequested; - - // Supply client credentials. - request->Credentials = CredentialCache::DefaultCredentials; - HttpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // Determine whether mutual authentication was used. - Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated ); - - // Read and display the response. - Stream^ streamResponse = response->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - String^ responseString = streamRead->ReadToEnd(); - Console::WriteLine( responseString ); - - // Close the stream objects. - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse. - response->Close(); - } - // - - -private: - - static String^ GetUserName() - { - return L"sharriso1\\Jane"; - } - - static String^ GetUserPassword() - { - return L"LXMP9804!"; - } - -public: - ref class HttpsBasicCredentialOnlyPolicy: public ICredentialPolicy - { - public: - HttpsBasicCredentialOnlyPolicy(){} - - virtual bool ShouldSendCredential( Uri^ /*challengeUri*/, WebRequest^ request, NetworkCredential^ /*credential*/, IAuthenticationModule^ authModule ) - { - Console::WriteLine( L"Checking custom credential policy for HTTPS and basic." ); - - // Determine whether the base implementation returned false for basic and https. - if ( request->RequestUri->Scheme == Uri::UriSchemeHttps && authModule->AuthenticationType->Equals( L"Basic" ) ) - { - Console::WriteLine( L"Sending credential for HTTPS and basic." ); - return true; - } - - return false; - } - - }; - - static void RequestHttpBasicResource( Uri^ resource ) - { - // Set policy to send credentials when using HTTPS and basic authentication; - HttpsBasicCredentialOnlyPolicy^ encryptedBasic = gcnew HttpsBasicCredentialOnlyPolicy; - AuthenticationManager::CredentialPolicy = encryptedBasic; - - // Create a new HttpWebRequest object for the specified resource. - WebRequest^ request = dynamic_cast(WebRequest::Create( resource )); - - // Supply client credentials for basic authentication. - request->Credentials = gcnew NetworkCredential( GetUserName(),GetUserPassword() ); - HttpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // Determine whether mutual authentication was used. - Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated ); - - // Read and display the response. - System::IO::Stream^ streamResponse = response->GetResponseStream(); - System::IO::StreamReader^ streamRead = gcnew System::IO::StreamReader( streamResponse ); - String^ responseString = streamRead->ReadToEnd(); - Console::WriteLine( responseString ); - - // Close the stream objects. - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse. - response->Close(); - } - - // - static void RequestResource( Uri^ resource ) - { - // Set policy to send credentials when using HTTPS and basic authentication. - // Create a new HttpWebRequest object for the specified resource. - WebRequest^ request = dynamic_cast(WebRequest::Create( resource )); - - // Supply client credentials for basic authentication. - request->UseDefaultCredentials = true; - request->AuthenticationLevel = AuthenticationLevel::MutualAuthRequired; - HttpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // Determine mutual authentication was used. - Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated ); - System::Collections::Specialized::StringDictionary^ spnDictionary = AuthenticationManager::CustomTargetNameDictionary; - System::Collections::IEnumerator^ myEnum = spnDictionary->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ e = safe_cast(myEnum->Current); - Console::WriteLine( "Key: {0} - {1}", dynamic_cast(e->Key), dynamic_cast(e->Value) ); - } - - // Read and display the response. - System::IO::Stream^ streamResponse = response->GetResponseStream(); - System::IO::StreamReader^ streamRead = gcnew System::IO::StreamReader( streamResponse ); - String^ responseString = streamRead->ReadToEnd(); - Console::WriteLine( responseString ); - - // Close the stream objects. - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse. - response->Close(); - } - - /* - - The output from this example will differ based on the requested resource - and whether mutual authentication was successful. For the purpose of illustration, - a sample of the output is shown here: - - Is mutually authenticated? True - Key: http://server1.someDomain.contoso.com - HTTP/server1.someDomain.contoso.com - - - ... - - - */ - // - int TestCredentialPolicy() - { - // UseCustomCredentialPolicy(); - //RequestMutualAuth(new Uri("http://wasabi/noribeta/NamespaceExceptionReport.aspx?Namespace=System.Net")); - //RequestMutualAuth(new Uri("http://sharriso1/test/postaccepter.aspx")); - // RequestResource(new Uri("http://sharriso1.redmond.corp.microsoft.com/test/postaccepter.aspx")); - RequestResource( gcnew Uri( L"http://www.google.com" ) ); - return 1; - } -}; - -void main() -{ - CredentialPolicyExamples^ cpe = gcnew CredentialPolicyExamples; - cpe->TestCredentialPolicy(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp deleted file mode 100644 index 57313e17fac..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp +++ /dev/null @@ -1,188 +0,0 @@ - - -//NCLCustomWebClient -#using - -using namespace System; -using namespace System::Net; - -public ref class CustomWebClient: public WebClient -{ -protected: - - // - virtual WebRequest^ GetWebRequest ( Uri^ address ) override - { - WebRequest^ request = dynamic_cast(WebClient::GetWebRequest( address )); - - // Perform any customizations on the request. - // This version of WebClient always preauthenticates. - request->PreAuthenticate = true; - return request; - } - // - - // - virtual WebResponse^ GetWebResponse( WebRequest^ request ) override - { - WebResponse^ response = WebClient::GetWebResponse( request ); - - // Perform any custom actions with the response ... - return response; - } - // - - // - virtual WebResponse^ GetWebResponse( WebRequest^ request, IAsyncResult^ result ) override - { - WebResponse^ response = WebClient::GetWebResponse( request, result ); - - // Perform any custom actions with the response ... - return response; - } - // - - // - virtual void OnDownloadDataCompleted( DownloadDataCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnDownloadDataCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnDownloadFileCompleted( System::ComponentModel::AsyncCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnDownloadFileCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnDownloadStringCompleted( DownloadStringCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnDownloadStringCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnOpenReadCompleted( OpenReadCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnOpenReadCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnOpenWriteCompleted( OpenWriteCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnOpenWriteCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnUploadDataCompleted( UploadDataCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnUploadDataCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnUploadFileCompleted( UploadFileCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnUploadFileCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnUploadStringCompleted( UploadStringCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnUploadStringCompleted( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnDownloadProgressChanged( DownloadProgressChangedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnDownloadProgressChanged( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnUploadProgressChanged( UploadProgressChangedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnUploadProgressChanged( e ); - - // Here you can perform any post event actions... - } - // - - // - virtual void OnUploadValuesCompleted( UploadValuesCompletedEventArgs ^ e ) override - { - // Here you can perform any custom actions before the event is raised - // and event handlers are called... - WebClient::OnUploadValuesCompleted( e ); - - // Here you can perform any post event actions... - } - // -}; - -int main() -{ - CustomWebClient^ newClient = gcnew CustomWebClient; -} - -// Output from this example will be vary depending on the host name specified, -// but will be similar to the following. -/* -Cookie: -CustomerID = 13xyz -Domain: .contoso.com -Path: / -Port: -Secure: False -When issued: 1/14/2003 3:20:57 PM -Expires: 1/17/2013 11:14:07 AM (expired? False) -Don't save: False -Comment: -Uri for comments: -Version: RFC 2965 -String: CustomerID = 13xyz -*/ diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp deleted file mode 100644 index 6a13836357f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -int main() -{ - - // Create a request for the Web page at www.contoso.com. - WebRequest^ request = WebRequest::Create( L"http://www.contoso.com" ); - - // This application doesn't want they proxy to be used so it sets - // the global proxy to an empy proxy. - IWebProxy^ myProxy = GlobalProxySelection::GetEmptyWebProxy(); - - // Get the response. - WebResponse^ response = request->GetResponse(); - - // Display the response to the console. - Stream^ stream = response->GetResponseStream(); - StreamReader^ reader = gcnew StreamReader( stream ); - Console::WriteLine( reader->ReadToEnd() ); - - // Clean up. - reader->Close(); - stream->Close(); - response->Close(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp deleted file mode 100644 index e507d6263b9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp +++ /dev/null @@ -1,227 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Threading; -using namespace System::IO; - -// -public ref class FtpState -{ -private: - ManualResetEvent^ wait; - FtpWebRequest^ request; - String^ fileName; - Exception^ operationException; - String^ status; - -public: - FtpState() - { - wait = gcnew ManualResetEvent( false ); - } - - property ManualResetEvent^ OperationComplete - { - ManualResetEvent^ get() - { - return wait; - } - - } - - property FtpWebRequest^ Request - { - FtpWebRequest^ get() - { - return request; - } - - void set( FtpWebRequest^ value ) - { - request = value; - } - - } - - property String^ FileName - { - String^ get() - { - return fileName; - } - - void set( String^ value ) - { - fileName = value; - } - - } - - property Exception^ OperationException - { - Exception^ get() - { - return operationException; - } - - void set( Exception^ value ) - { - operationException = value; - } - - } - - property String^ StatusDescription - { - String^ get() - { - return status; - } - - void set( String^ value ) - { - status = value; - } - - } -}; -// - -// -public ref class AsynchronousFtpUpLoader -{ -public: - - // - // Command line arguments are two strings: - // 1. The url that is the name of the file being uploaded to the server. - // 2. The name of the file on the local machine. - // - static void Main() - { - array^args = Environment::GetCommandLineArgs(); - - // Create a Uri instance with the specified URI string. - // If the URI is not correctly formed, the Uri constructor - // will throw an exception. - ManualResetEvent^ waitObject; - Uri^ target = gcnew Uri( args[ 1 ] ); - String^ fileName = args[ 2 ]; - FtpState^ state = gcnew FtpState; - FtpWebRequest ^ request = dynamic_cast(WebRequest::Create( target )); - request->Method = WebRequestMethods::Ftp::UploadFile; - - // This example uses anonymous logon. - // The request is anonymous by default; the credential does not have to be specified. - // The example specifies the credential only to - // control how actions are logged on the server. - request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); - - // Store the request in the object that we pass into the - // asynchronous operations. - state->Request = request; - state->FileName = fileName; - - // Get the event to wait on. - waitObject = state->OperationComplete; - - // Asynchronously get the stream for the file contents. - request->BeginGetRequestStream( gcnew AsyncCallback( EndGetStreamCallback ), state ); - - // Block the current thread until all operations are complete. - waitObject->WaitOne(); - - // The operations either completed or threw an exception. - if ( state->OperationException != nullptr ) - { - throw state->OperationException; - } - else - { - Console::WriteLine( "The operation completed - {0}", state->StatusDescription ); - } - } - // - - // -private: - static void EndGetStreamCallback( IAsyncResult^ ar ) - { - FtpState^ state = dynamic_cast(ar->AsyncState); - Stream^ requestStream = nullptr; - - // End the asynchronous call to get the request stream. - try - { - requestStream = state->Request->EndGetRequestStream( ar ); - - // Copy the file contents to the request stream. - const int bufferLength = 2048; - array^buffer = gcnew array(bufferLength); - int count = 0; - int readBytes = 0; - FileStream^ stream = File::OpenRead( state->FileName ); - do - { - readBytes = stream->Read( buffer, 0, bufferLength ); - requestStream->Write( buffer, 0, bufferLength ); - count += readBytes; - } - while ( readBytes != 0 ); - Console::WriteLine( "Writing {0} bytes to the stream.", count ); - - // IMPORTANT: Close the request stream before sending the request. - requestStream->Close(); - - // Asynchronously get the response to the upload request. - state->Request->BeginGetResponse( gcnew AsyncCallback( EndGetResponseCallback ), state ); - } - // Return exceptions to the main application thread. - catch ( Exception^ e ) - { - Console::WriteLine( "Could not get the request stream." ); - state->OperationException = e; - state->OperationComplete->Set(); - return; - } - } - // - - // - // The EndGetResponseCallback method - // completes a call to BeginGetResponse. - static void EndGetResponseCallback( IAsyncResult^ ar ) - { - FtpState^ state = dynamic_cast(ar->AsyncState); - FtpWebResponse ^ response = nullptr; - try - { - response = dynamic_cast(state->Request->EndGetResponse( ar )); - response->Close(); - state->StatusDescription = response->StatusDescription; - - // Signal the main application thread that - // the operation is complete. - state->OperationComplete->Set(); - } - // Return exceptions to the main application thread. - catch ( Exception^ e ) - { - Console::WriteLine( "Error getting response." ); - state->OperationException = e; - state->OperationComplete->Set(); - } - } - // -}; -// - -int main() -{ - AsynchronousFtpUpLoader::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp deleted file mode 100644 index 1e751d2630a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp +++ /dev/null @@ -1,842 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -using namespace System::IO; -using namespace System::Threading; -using namespace System::Security::Cryptography::X509Certificates; - -public ref class FtpRequestTest -{ -private: - - // FxCop rule requires a private constructor. - FtpRequestTest(){} - - -public: - - // - static bool ListFilesOnServer( Uri^ serverUri ) - { - // The serverUri should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::ListDirectory; - - // Get the ServicePoint object used for this request, and limit it to one connection. - // In a real-world application you might use the default number of connections (2), - // or select a value that works best for your application. - ServicePoint^ sp = request->ServicePoint; - Console::WriteLine( "ServicePoint connections = {0}.", sp->ConnectionLimit ); - sp->ConnectionLimit = 1; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // The following streams are used to read the data returned from the server. - Stream^ responseStream = nullptr; - StreamReader^ readStream = nullptr; - try - { - responseStream = response->GetResponseStream(); - readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); - if ( readStream != nullptr ) - { - // Display the data received from the server. - Console::WriteLine( readStream->ReadToEnd() ); - } - - Console::WriteLine( "List status: {0}", response->StatusDescription ); - } - finally - { - if ( readStream != nullptr ) - { - readStream->Close(); - } - - if ( response != nullptr ) - { - response->Close(); - } - } - - return true; - } - // - - // new content - // - static bool NameListFilesOnServer( Uri^ serverUri ) - { - // The serverUri should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::ListDirectoryDetails; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // The following streams are used to read the data returned from the server. - Stream^ responseStream = nullptr; - StreamReader^ readStream = nullptr; - try - { - responseStream = response->GetResponseStream(); - readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); - if ( readStream != nullptr ) - { - // Display the data received from the server. - Console::WriteLine( readStream->ReadToEnd() ); - } - - Console::WriteLine( "Status: {0}", response->StatusDescription ); - } - finally - { - if ( readStream != nullptr ) - { - readStream->Close(); - } - - if ( response != nullptr ) - { - response->Close(); - } - } - - return true; - } - // - - // - static bool GetDateTimestampOnServer( Uri^ serverUri ) - { - // The serverUri should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::GetDateTimestamp; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "{0} {1}", serverUri, response->LastModified ); - - // The output from this method will vary depening on the - // file specified and your regional settings. It is similar to: - // ftp://contoso.com/Data.txt 4/15/2003 10:46:02 AM - return true; - } - // - - // - static bool MakeDirectoryOnServer( Uri^ serverUri ) - { - // The serverUri should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::MakeDirectory; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "Status: {0}", response->StatusDescription ); - return true; - } - // - - // - static bool UploadUniqueFileOnServer( Uri^ serverUri, String^ fileName ) - { - // The URI described by serverUri should use the ftp:// scheme. - // It contains the name of the directory on the server. - // Example: ftp://contoso.com. - // - // The fileName parameter identifies the file containing the data to be uploaded. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::UploadFileWithUniqueName; - - // Don't set a time limit for the operation to complete. - request->Timeout = System::Threading::Timeout::Infinite; - - // Copy the file contents to the request stream. - const int bufferLength = 2048; - array^buffer = gcnew array(bufferLength); - int count = 0; - int readBytes = 0; - FileStream^ stream = File::OpenRead( fileName ); - Stream^ requestStream = request->GetRequestStream(); - do - { - readBytes = stream->Read( buffer, 0, bufferLength ); - requestStream->Write( buffer, 0, bufferLength ); - count += readBytes; - } - while ( readBytes != 0 ); - - Console::WriteLine( "Writing {0} bytes to the stream.", count ); - - // IMPORTANT: Close the request stream before sending the request. - requestStream->Close(); - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "Upload status: {0}, {1}", response->StatusCode, response->StatusDescription ); - Console::WriteLine( "File name: {0}", response->ResponseUri ); - response->Close(); - return true; - } - // - - // - static bool RemoveDirectoryOnServer( Uri^ serverUri ) - { - // The serverUri should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::RemoveDirectory; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "Status: {0}", response->StatusDescription ); - return true; - } - // - - // - static bool UploadFileToServer( String^ fileName, Uri^ serverUri ) - { - // The URI described by serverUri should use the ftp:// scheme. - // It contains the name of the file on the server. - // Example: ftp://contoso.com/someFile.txt. - // - // The fileName parameter identifies the file containing the data to be uploaded. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::UploadFile; - - // Don't set a time limit for the operation to complete. - request->Timeout = System::Threading::Timeout::Infinite; - - // Copy the file contents to the request stream. - const int bufferLength = 2048; - array^buffer = gcnew array(bufferLength); - int count = 0; - int readBytes = 0; - FileStream^ stream = File::OpenRead( fileName ); - Stream^ requestStream = request->GetRequestStream(); - do - { - readBytes = stream->Read( buffer, 0, bufferLength ); - requestStream->Write( buffer, 0, bufferLength ); - count += readBytes; - } - while ( readBytes != 0 ); - - Console::WriteLine( "Writing {0} bytes to the stream.", count ); - - // IMPORTANT: Close the request stream before sending the request. - requestStream->Close(); - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "Upload status: {0}, {1}", response->StatusCode, response->StatusDescription ); - response->Close(); - return true; - } - // - - // - static bool AppendFileOnServer( String^ fileName, Uri^ serverUri ) - { - // The URI described by serverUri should use the ftp:// scheme. - // It contains the name of the file on the server. - // Example: ftp://contoso.com/someFile.txt. - // The fileName parameter identifies the file containing - // the data to be appended to the file on the server. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::AppendFile; - StreamReader^ sourceStream = gcnew StreamReader( fileName ); - array^fileContents = Encoding::UTF8->GetBytes( sourceStream->ReadToEnd() ); - sourceStream->Close(); - request->ContentLength = fileContents->Length; - - // This example assumes the FTP site uses anonymous logon. - request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); - Stream^ requestStream = request->GetRequestStream(); - requestStream->Write( fileContents, 0, fileContents->Length ); - requestStream->Close(); - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "Append status: {0}", response->StatusDescription ); - response->Close(); - return true; - } - // - - // - static bool DeleteFileOnServer( Uri^ serverUri ) - { - // The serverUri parameter should use the ftp:// scheme. - // It contains the name of the server file that is to be deleted. - // Example: ftp://contoso.com/someFile.txt. - // - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::DeleteFile; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "Delete status: {0}", response->StatusDescription ); - response->Close(); - return true; - } - // - - // - static bool DisplayFileFromServer( Uri^ serverUri ) - { - // The serverUri parameter should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - WebClient^ request = gcnew WebClient; - - // This example assumes the FTP site uses anonymous logon. - request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); - try - { - array^newFileData = request->DownloadData( serverUri->ToString() ); - String^ fileString = System::Text::Encoding::UTF8->GetString( newFileData ); - Console::WriteLine( fileString ); - } - catch ( WebException^ e ) - { - Console::WriteLine( e ); - } - - return true; - } - // - - - // -private: - // DisplayRequestProperties prints a request's properties. - // This method should be called after the request is sent to the server. - static void DisplayRequestProperties( FtpWebRequest^ request ) - { - // - Console::WriteLine( "User {0} {1}", request->Credentials->GetCredential( request->RequestUri, "basic" )->UserName, request->RequestUri ); - - // - Console::WriteLine( "Request: {0} {1}", request->Method, request->RequestUri ); - - // - Console::WriteLine( "Passive: {0} Keep alive: {1} Binary: {2} Timeout: {3}.", request->UsePassive, request->KeepAlive, request->UseBinary, request->Timeout == -1 ? "none" : request->Timeout.ToString() ); - - // - // - IWebProxy^ proxy = request->Proxy; - if ( proxy ) - { - Console::WriteLine( "Proxy: {0}", proxy->GetProxy( request->RequestUri ) ); - } - else - { - Console::WriteLine( "Proxy: (none)" ); - } - - Console::WriteLine( "ConnectionGroup: {0}", request->ConnectionGroupName == nullptr ? "none" : request->ConnectionGroupName ); - // - - Console::WriteLine( "Encrypted connection: {0}", request->EnableSsl ); - - Console::WriteLine("Method: {0}", request->Method); - } - // - - // -public: - // NOT Working - throws a protocolError - 350 Restarting at 8. for args shown in Main. - static bool RestartDownloadFromServer( String^ fileName, Uri^ serverUri, long offset ) - { - // The serverUri parameter should use the ftp:// scheme. - // It identifies the server file that is to be appended. - // Example: ftp://contoso.com/someFile.txt. - // - // The fileName parameter identifies the local file - // - // The offset parameter specifies where in the server file to start reading data. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::DownloadFile; - request->ContentOffset = offset; - FtpWebResponse^ response = nullptr; - try - { - response = dynamic_cast(request->GetResponse()); - } - catch ( WebException^ e ) - { - Console::WriteLine( e->Status ); - Console::WriteLine( e->Message ); - return false; - } - - Stream^ newFile = response->GetResponseStream(); - StreamReader^ reader = gcnew StreamReader( newFile ); - - // Display downloaded data. - String^ newFileData = reader->ReadToEnd(); - - // Append the response data to the local file - // using a StreamWriter. - StreamWriter^ writer = File::AppendText(fileName); - writer->Write(newFileData); - - // Display the status description. - - // Cleanup. - writer->Close(); - reader->Close(); - response->Close(); - // string fileString = System.Text.Encoding.UTF8.GetString(newFileData); - // Console::WriteLine( sr ); - Console::WriteLine("Download restart - status: {0}",response->StatusDescription); - return true; - } - // - - // not enabled in M2 - // Sample call: SendCommandToServer("ftp://contoso.com/", "pwd"); - // The output can only return status information. - static bool SendCommandToServer( String^ serverUri, String^ command ) - { - // The serverUri parameter should start with the ftp:// scheme. - // It contains the name of the file on the server that will be appended. - // Example: ftp://contoso.com/someFile.txt. - // - // The command parameter identifies the command to send to the server. - if ( !serverUri->ToLower()->StartsWith( Uri::UriSchemeFtp ) ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = command; - - // This example assumes the FTP site uses anonymous logon. - request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "{0} status: {1}", command, response->StatusDescription ); - response->Close(); - return true; - } - - // - static bool DownloadFileFromServer( Uri^ serverUri, String^ localFileName ) - { - // The serverUri parameter should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - // Note that the cast to FtpWebRequest is done only - // for the purposes of illustration. If your application - // does not set any properties other than those defined in the - // System.Net.WebRequest class, you can use the following line instead: - // WebRequest request = WebRequest.Create(serverUri); - // - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::DownloadFile; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Stream^ responseStream = nullptr; - StreamReader^ readStream = nullptr; - StreamWriter^ writeStream = nullptr; - try - { - responseStream = response->GetResponseStream(); - readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); - - // Display information about the data received from the server. - Console::WriteLine( "Bytes received: {0}", response->ContentLength ); - Console::WriteLine( "Message from server: {0}", response->StatusDescription ); - Console::WriteLine( "Resource: {0}", response->ResponseUri ); - - // Write the bytes received from the server to the local file. - if ( readStream != nullptr ) - { - writeStream = gcnew StreamWriter( localFileName,false ); - writeStream->Write( readStream->ReadToEnd() ); - } - } - finally - { - if ( readStream != nullptr ) - { - readStream->Close(); - } - - if ( response != nullptr ) - { - response->Close(); - } - - if ( writeStream != nullptr ) - { - writeStream->Close(); - } - } - - return true; - } - // - - // Make a request to show the request properties - static void GetRequestProperties( Uri^ serverUri ) - { - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - - // This example assumes the FTP site uses anonymous logon. - request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); - request->Proxy = gcnew WebProxy; - request->Method = WebRequestMethods::Ftp::DownloadFile; - request->Abort(); - DisplayRequestProperties( request ); - } - - // async snippets - // - static bool GetFileSizeFromServer( Uri^ serverUri ) - { - // The serverUri parameter should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::GetFileSize; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // Display information about the server response. - Console::WriteLine( "size of file: {0}", response->ContentLength ); - response->Close(); - return true; - } - // - - // - static bool ListFilesOnServerSsl( Uri^ serverUri ) - { - // The serverUri should start with the ftp:// scheme. - if ( serverUri->Scheme != Uri::UriSchemeFtp ) - { - return false; - } - - // Get the object used to communicate with the server. - FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::ListDirectory; - request->EnableSsl = true; - - // Get the ServicePoint object used for this request, and limit it to one connection. - // In a real-world application you might use the default number of connections (2), - // or select a value that works best for your application. - ServicePoint^ sp = request->ServicePoint; - Console::WriteLine( "ServicePoint connections = {0}.", sp->ConnectionLimit ); - sp->ConnectionLimit = 1; - FtpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine( "The content length is {0}", response->ContentLength ); - - // The following streams are used to read the data returned from the server. - Stream^ responseStream = nullptr; - StreamReader^ readStream = nullptr; - responseStream = response->GetResponseStream(); - readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); - - // Display the data received from the server. - Console::WriteLine( readStream->ReadToEnd() ); - Console::WriteLine( "List status: {0}", response->StatusDescription ); - readStream->Close(); - response->Close(); - - // - Console::WriteLine( "Banner message: {0}", response->BannerMessage ); - // - - // - Console::WriteLine( "Welcome message: {0}", response->WelcomeMessage ); - // - - // - Console::WriteLine( "Exit message: {0}", response->ExitMessage ); - // - - return true; - } - - // -internal: - static FtpStatusCode WaitForFinalStatus( FtpWebResponse^ response ) - { - int status = (int)response->StatusCode; - - // < 200 is undefined or informational messages. - // 300 and 400 are intermediate and temporary errors respectively. - // 200- 299 and 500- 599 are final statuses indicating - // sucess or failure respectively. - while ( status < 200 || (status >= 300 && status < 500) ) - { - Console::Write( "{0}. ", status ); - System::Threading::Thread::Sleep( 100 ); - status = (int)response->StatusCode; - } - - return response->StatusCode; - } - - -public: - static void Main() - { - // tests for snippets: - // ListFilesOnServer(new Uri(S"ftp://sharriso1")); - // works m3.1 - // NameListFilesOnServer (new Uri (S"ftp://sharriso1")); - // throws - // GetDateTimestampOnServer (new Uri ("ftp://sharriso1")); - // GetDateTimestampOnServer (new Uri (S"ftp://sharriso1/localfile.txt")); - // RemoveDirectoryOnServer (new Uri (S"ftp://sharriso1/DirtyDir")); - // MakeDirectoryOnServer (new Uri (S"ftp://sharriso1/DirtyDir")); - // UploadUniqueFileOnServer (new Uri (S"ftp://sharriso1/SherdieDir/"), "sharriso2.log"); - // ListFilesOnServer (new Uri (S"ftp://sharriso1")); - ListFilesOnServerSsl( gcnew Uri( "ftp://sharriso1" ) ); - - // snippet 8 - not working - // snippet 1 - // ListFilesOnServer(new Uri("ftp://sharriso1/")); - // snippet 8 - not working - //SendCommandToServer("ftp://sharriso1/", "rename localfile.txt loc2.txt"); - // new snippet 7 - // upload is just helper - //UploadFileToServer("NCLFtpClient.xml", new Uri("ftp://sharriso1/NCLFtpClient.xml")); - // RestartDownloadFromServer("piecexml.txt", new Uri("ftp://sharriso1/NCLFtpClient.xml"), 8); - // DownloadFileFromServer(new Uri("ftp://sharriso1/onesandtwos.txt"), "downloadedFile0320_1.txt"); - // snippet 11 - GetFileSizeFromServer( gcnew Uri( "ftp://sharriso1/localfile.txt" ) ); - - // snippet 5 - // DisplayFileFromServer Not working! - // DisplayFileFromServer(new Uri("ftp://sharriso1/ss1.txt")); - // snippet 2 - // UploadFileToServer("local.txt", new Uri("ftp://sharriso1/localfile.txt")); - //DeleteFileOnServer(new Uri("ftp://sharriso1/localfile.txt")); - // DownloadFileFromServer(new Uri("ftp://sharriso1/localFileagain.txt"), "dlagain.txt"); - // AppendFileOnServer("dlagain.txt", new Uri("ftp://sharriso1/localfile.txt")); - // Snippet 14, 15, and 16 - // GetRequestProperties(new Uri("ftp://sharriso1/localfile.txt")); - // Snippet 9 - // DownloadFileFromServer(new Uri("ftp://sharriso1/localFileagain.txt"), "dlagain.txt"); - //AsynchronousUploadFileToServer( "system.pdb","ftp://sharriso1/localFile.pdb"); - // ListFilesOnServer(new Uri("ftp://sharriso1")); - //DownloadFileFromServer(new Uri("ftp://sharriso1/localFileagain.txt"), "dlagain.txt"); - //UploadPartialFileOnServer("allOnes.txt", "ftp://sharriso1/babyones.txt", 20 ); - // TestCloning(); - // test the async methods - // ManualResetEvent wait = new ManualResetEvent(false); - // AsynchronousFtpUpLoader uploader = new AsynchronousFtpUpLoader(wait); - // uploader.AsynchronousUploadFileToServer("ftptests.cs", "ftp://sharriso1/ftptests.txt"); - // wait.WaitOne(); - // Snippet 10 - // ManualResetEvent wait = new ManualResetEvent(false); - // AsynchronousFtpUpLoader uploader = new AsynchronousFtpUpLoader(wait); - // uploader.AbortUpload("mscorlib.xml", "ftp://sharriso1/ftptests.txt"); - // wait.WaitOne(); - } -}; - - -// The RequestState class is the state object used to store the request information -// during asynchronous operations. -private ref class RequestState -{ -internal: - FtpWebRequest^ request; - Object^ requestData; - RequestState( FtpWebRequest ^theRequest, Object^ data ) - { - request = theRequest; - requestData = data; - } -}; - -public ref class AsynchronousFtpUpLoader -{ -private: - ManualResetEvent^ wait; - FtpWebRequest^ request; - array^fileContents; - Exception^ asyncException; - -public: - AsynchronousFtpUpLoader( ManualResetEvent^ wait ) - { - this->wait = wait; - } - - // In the AsynchronousUploadFileToServer method, - // serverUri contains the name of the file on the FTP server, and - // fileName contains the name of the file on the local computer. - void AsynchronousUploadFileToServer( String^ fileName, String^ serverUri ) - { - request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::UploadFile; - - // This example assumes the FTP site uses anonymous logon. - request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); - - // Get the file to be uploaded and convert it to bytes. - StreamReader^ sourceStream = gcnew StreamReader( fileName ); - fileContents = Encoding::UTF8->GetBytes( sourceStream->ReadToEnd() ); - sourceStream->Close(); - - // Set the content length to the number of bytes in the file. - request->ContentLength = fileContents->Length; - - // Asynchronously get the stream for the file contents. - IAsyncResult^ ar = request->BeginGetRequestStream( gcnew AsyncCallback( this, &AsynchronousFtpUpLoader::EndGetStreamCallback ), nullptr ); - Console::WriteLine( "Getting the request stream asynchronously..." ); - } - -private: - void EndGetStreamCallback( IAsyncResult^ ar ) - { - // Thread.Sleep(5000); - // Console.WriteLine("I'm awake now"); - Stream^ requestStream = nullptr; - - // End the asynchronous call to get the request stream. - try - { - requestStream = request->EndGetRequestStream( ar ); - } - // Return exceptions to the main application thread. - catch ( Exception^ e ) - { - Console::WriteLine( "Could not get the request stream." ); - asyncException = e; - wait->Set(); - return; - } - - // Write the file contents to the request stream. - requestStream->Write( fileContents, 0, fileContents->Length ); - Console::WriteLine( "Writing {0} bytes to the stream.", fileContents->Length ); - - // IMPORTANT: Close the request stream before sending the request. - requestStream->Close(); - IAsyncResult^ responseAR = request->BeginGetResponse( gcnew AsyncCallback( this, &AsynchronousFtpUpLoader::EndGetResponseCallback ), nullptr ); - } - - // The EndGetResponseCallback method - // completes a call to BeginGetResponse. - void EndGetResponseCallback( IAsyncResult^ ar ) - { - FtpWebResponse^ response = nullptr; - try - { - response = dynamic_cast(request->EndGetResponse( ar )); - } - // Return exceptions to the main application thread. - catch ( Exception^ e ) - { - Console::WriteLine( "Error getting response." ); - asyncException = e; - } - - Console::WriteLine( "Upload status: {0}", response->StatusDescription ); - - // Signal the application thread that this is complete. - wait->Set(); - } - - // -public: - void AbortUpload( String^ fileName, String^ serverUri ) - { - request = dynamic_cast(WebRequest::Create( serverUri )); - request->Method = WebRequestMethods::Ftp::UploadFile; - - // Get the file to be uploaded and convert it to bytes. - StreamReader^ sourceStream = gcnew StreamReader( fileName ); - fileContents = Encoding::UTF8->GetBytes( sourceStream->ReadToEnd() ); - sourceStream->Close(); - - // Set the content length to the number of bytes in the file. - request->ContentLength = fileContents->Length; - - // Asynchronously get the stream for the file contents. - IAsyncResult^ ar = request->BeginGetRequestStream( gcnew AsyncCallback( this, &AsynchronousFtpUpLoader::EndGetStreamCallback ), nullptr ); - Console::WriteLine( "Getting the request stream asynchronously..." ); - Console::WriteLine( "Press 'a' to abort the upload or any other key to continue" ); - String^ input = Console::ReadLine(); - if ( input->Equals( "a" ) ) - { - request->Abort(); - Console::WriteLine( "Request aborted" ); - return; - } - } - // -}; - -int main() -{ - FtpRequestTest::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp deleted file mode 100644 index 81d174edffb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp +++ /dev/null @@ -1,1082 +0,0 @@ - -// NclMailSync -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Mail; -using namespace System::Net::Mime; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::IO; -using namespace System::Text; - -public ref class CtorExamples -{ -public: - - // - static void CreateTestMessage1( String^ server, int port ) - { - String^ to = L"jane@contoso.com"; - String^ from = L"ben@contoso.com"; - String^ subject = L"Using the new SMTP client."; - String^ body = L"Using this new feature, you can send an email message from an application very easily."; - MailMessage^ message = gcnew MailMessage( from,to,subject,body ); - SmtpClient^ client = gcnew SmtpClient( server,port ); - - // Credentials are necessary if the server requires the client - // to authenticate before it will send email on the client's behalf. - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - client->~SmtpClient(); - } - - - // - // - static void CreateTestMessage2( String^ server ) - { - String^ to = L"jane@contoso.com"; - String^ from = L"ben@contoso.com"; - MailMessage^ message = gcnew MailMessage( from,to ); - message->Subject = L"Using the new SMTP client."; - message->Body = L"Using this new feature, you can send an email message from an application very easily."; - SmtpClient^ client = gcnew SmtpClient( server ); - - // Credentials are necessary if the server requires the client - // to authenticate before it will send email on the client's behalf. - client->UseDefaultCredentials = true; - client->Send( message ); - client->~SmtpClient(); - } - - - // - // - static void CreateTimeoutTestMessage( String^ server ) - { - String^ to = L"jane@contoso.com"; - String^ from = L"ben@contoso.com"; - String^ subject = L"Using the new SMTP client."; - String^ body = L"Using this new feature, you can send an email message from an application very easily."; - MailMessage^ message = gcnew MailMessage( from,to,subject,body ); - SmtpClient^ client = gcnew SmtpClient( server ); - Console::WriteLine( L"Changing time out from {0} to 100.", client->Timeout ); - client->Timeout = 100; - - // Credentials are necessary if the server requires the client - // to authenticate before it will send email on the client's behalf. - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - } - - - // - // - static void CreateTestMessage3() - { - MailAddress^ to = gcnew MailAddress( L"jane@contoso.com" ); - MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" ); - MailMessage^ message = gcnew MailMessage( from,to ); - message->Subject = L"Using the new SMTP client."; - message->Body = L"Using this new feature, you can send an email message from an application very easily."; - - // Use the application or machine configuration to get the - // host, port, and credentials. - SmtpClient^ client = gcnew SmtpClient; - Console::WriteLine( L"Sending an email message to {0} at {1} by using the SMTP host {2}.", to->User, to->Host, client->Host ); - client->Send( message ); - } - - - // - // - static void CreateMessageWithMultipleViews( String^ server, String^ recipients ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",recipients,L"This email message has multiple views.",L"This is some plain text." ); - - // Construct the alternate body as HTML. - String^ body = L""; - body = String::Concat( body, L"" ); - body = String::Concat( body, L"
this is some HTML text" ); - body = String::Concat( body, L"
" ); - - // Add the alternate body to the message. - AlternateView^ alternate = AlternateView::CreateAlternateViewFromString(body); - message->AlternateViews->Add(alternate); - - // Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - - // Display the values in the ContentType for the attachment. - ContentType^ c = alternate->ContentType; - Console::WriteLine( L"Content type" ); - Console::WriteLine( c ); - Console::WriteLine( L"Boundary {0}", c->Boundary ); - Console::WriteLine( L"CharSet {0}", c->CharSet ); - Console::WriteLine( L"MediaType {0}", c->MediaType ); - Console::WriteLine( L"Name {0}", c->Name ); - Console::WriteLine( L"Parameters: {0}", c->Parameters->Count ); - IEnumerator^ myEnum = c->Parameters->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ d = safe_cast(myEnum->Current); - Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); - } - - Console::WriteLine(); - alternate->~AlternateView(); - } - - - //
- // - static void CreateMessageWithAttachment( String^ server ) - { - - // Specify the file to be attached and sent. - // This example assumes that a file named Data.xls exists in the - // current working directory. - String^ file = L"data.xls"; - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"Quarterly data report.",L"See the attached spreadsheet." ); - - // Create the file attachment for this email message. - Attachment^ data = gcnew Attachment(file, MediaTypeNames::Application::Octet); - - // Add time stamp information for the file. - ContentDisposition^ disposition = data->ContentDisposition; - disposition->CreationDate = System::IO::File::GetCreationTime( file ); - disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); - disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); - - // Add the file attachment to this email message. - message->Attachments->Add( data ); - - //Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - - // Add credentials if the SMTP server requires them. - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - - // Display the values in the ContentDisposition for the attachment. - ContentDisposition^ cd = data->ContentDisposition; - Console::WriteLine( L"Content disposition" ); - Console::WriteLine( cd ); - Console::WriteLine( L"File {0}", cd->FileName ); - Console::WriteLine( L"Size {0}", cd->Size ); - Console::WriteLine( L"Creation {0}", cd->CreationDate ); - Console::WriteLine( L"Modification {0}", cd->ModificationDate ); - Console::WriteLine( L"Read {0}", cd->ReadDate ); - Console::WriteLine( L"Inline {0}", cd->Inline ); - Console::WriteLine( L"Parameters: {0}", cd->Parameters->Count ); - IEnumerator^ myEnum1 = cd->Parameters->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - DictionaryEntry^ d = safe_cast(myEnum1->Current); - Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); - } - - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void CreateTestMessage4( String^ server ) - { - MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" ); - MailAddress^ to = gcnew MailAddress( L"Jane@contoso.com" ); - MailMessage^ message = gcnew MailMessage( from,to ); - message->Subject = L"Using the SmtpClient class."; - message->Body = L"Using this feature, you can send an email message from an application very easily."; - SmtpClient^ client = gcnew SmtpClient( server ); - Console::WriteLine( L"Sending an email message to {0} by using SMTP host {1} port {2}.", to, client->Host, client->Port ); - client->Send( message ); - client->~SmtpClient(); - } - - - // - // - static void CreateTestMessage5( String^ server ) - { - String^ to = L"jane@contoso.com"; - String^ from = L"ben@contoso.com"; - String^ subject = L"Using the new SMTP client."; - String^ body = L"Using this new feature, you can send an email message from an application very easily."; - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( from, to, subject, body ); - client->~SmtpClient(); - } - - - // - // - static void CreateBccTestMessage( String^ server ) - { - MailAddress^ from = gcnew MailAddress( L"ben@contoso.com",L"Ben Miller" ); - MailAddress^ to = gcnew MailAddress( L"jane@contoso.com",L"Jane Clayton" ); - MailMessage^ message = gcnew MailMessage( from,to ); - message->Subject = L"Using the SmtpClient class."; - message->Body = L"Using this feature, you can send an email message from an application very easily."; - MailAddress^ bcc = gcnew MailAddress( L"manager1@contoso.com" ); - message->Bcc->Add( bcc ); - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - Console::WriteLine( L"Sending an email message to {0} and {1}.", to->DisplayName, message->Bcc ); - try - { - client->Send( message ); - } - catch ( Exception^ ex ) - { - Console::WriteLine(L"Exception caught in CreateBccTestMessage(): {0}", - ex->ToString() ); - } - client->~SmtpClient(); - } - - - // - // - static void CreateCopyMessage( String^ server ) - { - MailAddress^ from = gcnew MailAddress( L"ben@contoso.com",L"Ben Miller" ); - MailAddress^ to = gcnew MailAddress( L"jane@contoso.com",L"Jane Clayton" ); - MailMessage^ message = gcnew MailMessage( from,to ); - - // message.Subject = "Using the SmtpClient class."; - message->Subject = L"Using the SmtpClient class."; - message->Body = L"Using this feature, you can send an email message from an application very easily."; - - // Add a carbon copy recipient. - MailAddress^ copy = gcnew MailAddress( L"Notification_List@contoso.com" ); - message->CC->Add( copy ); - SmtpClient^ client = gcnew SmtpClient( server ); - - // Include credentials if the server requires them. - client->Credentials = CredentialCache::DefaultNetworkCredentials; - Console::WriteLine( L"Sending an email message to {0} by using the SMTP host {1}.", to->Address, client->Host ); - client->Send( message ); - client->~SmtpClient(); - } - - - // - // - static void CreateMessageAttachment1( String^ server, String^ textMessage ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"A text message for you.",L"Message: " ); - - // Attach the message string to this email message. - Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain ); - ContentDisposition^ disposition = data->ContentDisposition; - - // Suggest a file name for the attachment. - disposition->FileName = String::Format( L"message{0}", DateTime::Now ); - message->Attachments->Add( data ); - - //Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - - // Display the values in the ContentDisposition for the attachment. - Console::WriteLine( L"Content disposition" ); - Console::WriteLine( disposition ); - Console::WriteLine( L"File {0}", disposition->FileName ); - Console::WriteLine( L"Size {0}", disposition->Size ); - Console::WriteLine( L"Creation {0}", disposition->CreationDate ); - Console::WriteLine( L"Modification {0}", disposition->ModificationDate ); - Console::WriteLine( L"Read {0}", disposition->ReadDate ); - Console::WriteLine( L"Inline {0}", disposition->Inline ); - Console::WriteLine( L"Parameters: {0}", disposition->Parameters->Count ); - IEnumerator^ myEnum2 = disposition->Parameters->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - DictionaryEntry^ d = safe_cast(myEnum2->Current); - Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); - } - - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void CreateMessageInlineAttachment( String^ server, String^ textMessage ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"An inline text message for you.",L"Message: " ); - - // Attach the message string to this email message. - Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain ); - - // Send textMessage as part of the email body. - message->Attachments->Add( data ); - ContentDisposition^ disposition = data->ContentDisposition; - disposition->Inline = true; - - //Send the message. - // Include credentials if the server requires them. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void CreateMessageInlineAttachment2( String^ server, String^ textMessage ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"A text message for you.",L"Message: " ); - - // Attach the message string to this email message. - Attachment^ data = gcnew Attachment( textMessage ); - - // Send textMessage as part of the email body. - message->Attachments->Add( data ); - ContentType^ content = data->ContentType; - content->MediaType = MediaTypeNames::Text::Plain; - - //Send the message. - // Include credentials if the server requires them. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - // The following example sends a summary of a log file as the message - // and the log as an email attachment. - static void SendErrorLog( String^ server, String^ recipientList ) - { - - // Create a message from logMailer@contoso.com to recipientList. - MailMessage^ message = gcnew MailMessage( L"logMailer@contoso.com",recipientList ); - message->Subject = L"Error Log report"; - String^ fileName = L"log.txt"; - - // Get the file stream for the error log. - // Requires the System.IO namespace. - FileStream^ fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - StreamReader^ s = gcnew StreamReader( fs ); - int errors = 0; - while ( s->ReadLine() != nullptr ) - { - - // Process each line from the log file here. - errors++; - } - - message->Body = String::Format( L"{0} errors in log as of {1}", errors, DateTime::Now ); - - // Close the stream reader. This also closes the file. - s->Close(); - - // Re-open the file at the beginning to make the attachment. - fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - - // Make a contentType indicating that the log data - // that is attached is plain text. - ContentType^ ct = gcnew ContentType( MediaTypeNames::Text::Plain ); - - // Attach the log file stream to the email message. - Attachment^ data = gcnew Attachment( fs,ct ); - ContentDisposition^ disposition = data->ContentDisposition; - - // Suggest a file name for the attachment. - disposition->FileName = String::Format( L"log{0}.txt", DateTime::Now ); - - // Add the attachment to the message. - message->Attachments->Add( data ); - - // Send the message. - // Include credentials if the server requires them. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - - // Close the log file. - fs->Close(); - } - - - // - // - // The following example sends a summary of a log file as the message - // and the log as an email attachment. - static void SendNamedErrorLog( String^ server, String^ recipientList ) - { - - // Create a message from logMailer@contoso.com to recipientList. - MailMessage^ message = gcnew MailMessage( L"logMailer@contoso.com",recipientList ); - message->Subject = L"Error Log report"; - String^ fileName = L"log.txt"; - - // Get the file stream for the error log. - // Requires the System.IO namespace. - FileStream^ fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - StreamReader^ s = gcnew StreamReader( fs ); - int errors = 0; - while ( s->ReadLine() != nullptr ) - { - - // Process each line from the log file here. - errors++; - } - - message->Body = String::Format( L"{0} errors in log as of {1}", errors, DateTime::Now ); - - // Close the stream reader. This also closes the file. - s->Close(); - - // Re-open the file at the beginning to make the attachment. - fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - - // Make a ContentType indicating that the log data - // that is attached is plain text and is named. - ContentType^ ct = gcnew ContentType; - ct->MediaType = MediaTypeNames::Text::Plain; - ct->Name = String::Format( L"log{0}.txt", DateTime::Now ); - - // Create the attachment. - Attachment^ data = gcnew Attachment( fs,ct ); - - // Add the attachment to the message. - message->Attachments->Add( data ); - - // Send the message. - // Include credentials if the server requires them. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - - // Close the log file. - fs->Close(); - return; - } - - - // - // - // The following example sends a summary of a log file as the message - // and the log as an email attachment. - static void SendNamedAndTypedErrorLog( String^ server, String^ recipientList ) - { - - // Create a message from logMailer@contoso.com to recipientList. - MailMessage^ message = gcnew MailMessage( L"logMailer@contoso.com",recipientList ); - message->Subject = L"Error Log report"; - String^ fileName = L"log.txt"; - - // Get the file stream for the error log. - // Requires the System.IO namespace. - FileStream^ fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - StreamReader^ s = gcnew StreamReader( fs ); - int errors = 0; - while ( s->ReadLine() != nullptr ) - { - - // Process each line from the log file here. - errors++; - } - - message->Body = String::Format( L"{0} errors in log as of {1}", errors, DateTime::Now ); - - // Close the stream reader. This also closes the file. - s->Close(); - - // Re-open the file at the beginning to make the attachment. - fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); - - // Create a name for the log data file. - String^ name = String::Format( L"log{0}.txt", DateTime::Now ); - - // Create the attachment, name it, and specify the MIME type. - Attachment^ data = gcnew Attachment( fs,name,MediaTypeNames::Text::Plain ); - - // Add the attachment to the message. - message->Attachments->Add( data ); - - // Send the message. - // Include credentials if the server requires them. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - - // Close the log file. - fs->Close(); - } - - - // - // - static Attachment^ SendAttachedMessage( String^ server ) - { - - // Set up the sender information. - String^ from = String::Concat( Environment::UserDomainName, L".", Environment::UserName, L"@contoso.com" ); - Console::WriteLine( L"From: {0}", from ); - - // Have the user enter the message recipient. - Console::Write( L"To: " ); - String^ recipient = Console::ReadLine(); - - // Check for recipient data. - // A real application would add error checking here for a valid email - // address format. This example accepts any input. - if ( recipient->Length == 0 ) - return nullptr; - - - // Get the subject. - Console::Write( L"Subject: " ); - String^ subject = Console::ReadLine(); - - // Get the message content. - Console::WriteLine( L"Enter the message. Press return on a blank line to finish:" ); - StringBuilder^ sb = gcnew StringBuilder; - String^ line; - while ( true ) - { - line = Console::ReadLine(); - if ( line->Length > 0 ) - { - - // Store the message and the end-of-line characters. - sb->AppendFormat( L"{0},{1}", line, Environment::NewLine ); - } - else - break; - } - - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( from,recipient ); - message->Subject = subject; - - // Attach the message string to this email message. - // Set the encoding to the computer's current encoding. - Attachment^ data = gcnew Attachment( sb->ToString(),MediaTypeNames::Text::Plain); - - // Add the attachment to the message. - message->Attachments->Add( data ); - - //Send the message. Supply credentials if necessary. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = CredentialCache::DefaultNetworkCredentials; - Console::WriteLine( L"Ready to send. Press enter to send. Type any character to quit:" ); - String^ answer = Console::ReadLine(); - if ( answer->Length == 0 ) - { - client->Send( message ); - Console::WriteLine( L"Message sent." ); - } - else - { - Console::WriteLine( L"Send canceled." ); - } - - client->~SmtpClient(); - return data; - } - - - // - // - static void CreateMessageWithFile( String^ server, String^ to ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to ); - message->Subject = L"Monthly Expense report"; - message->Body = L"Please review the attached report."; - - // Attach a file to this email message. - Attachment^ data = gcnew Attachment("data.xls", MediaTypeNames::Application::Octet); - AttachmentCollection^ attachments = message->Attachments; - attachments->Add( data ); - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - client->Send( message ); - client->~SmtpClient(); - } - - - // - // - static void DisplayFileAttachment( Attachment^ a ) - { - Console::WriteLine( L"Content Disposition {0}", a->ContentDisposition ); - Console::WriteLine( L"Content Type {0}", a->ContentType ); - Console::WriteLine( L"Name {0}", a->Name ); - } - - - // - // - static void DisplayStringAttachment( Attachment^ a ) - { - Console::WriteLine( L"Content: {0}", a->ContentType ); - Console::WriteLine( L"Encoding {0}", a->TransferEncoding ); - Console::WriteLine( L"Content Disposition {0}", a->ContentDisposition->ToString() ); - Console::WriteLine( L"Content Type {0}", a->ContentType->ToString() ); - } - - - // - // - static void DisplayStreamAttachment( Attachment^ a ) - { - Stream^ s = a->ContentStream; - StreamReader^ reader = gcnew StreamReader( s ); - Console::WriteLine( L"Content: {0}", reader->ReadToEnd() ); - Console::WriteLine( L"Content Type {0}", a->ContentType ); - Console::WriteLine( L"Transfer Encoding {0}", a->TransferEncoding ); - - // Note that you cannot close the reader before the email is sent. - // Closing the reader before sending the email will close the - // ContentStream and cause an SmtpException. - reader = nullptr; - } - - - // - // - static void CreateMessageWithAttachment2( String^ server, String^ to ) - { - - // Specify the file to be attached and sent. - // This example assumes that a file named Data.xls exists in the - // current working directory. - String^ file = L"data.xls"; - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to,L"Quarterly data report",L"See the attached spreadsheet." ); - - // Create the file attachment for this email message. - Attachment^ data = gcnew Attachment(file); - - // Add time stamp information for the file. - ContentDisposition^ disposition = data->ContentDisposition; - disposition->CreationDate = System::IO::File::GetCreationTime( file ); - disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); - disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); - - // Add the file attachment to this email message. - message->Attachments->Add( data ); - - //Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - - // Add credentials if the SMTP server requires them. - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void CreateMessageWithAttachment3( String^ server, String^ to ) - { - - // Specify the file to be attached and sent. - // This example assumes that a file named data.xls exists in the - // current working directory. - String^ file = L"data.xls"; - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to,L"Quarterly data report",L"See the attached spreadsheet." ); - - // Create the file attachment for this email message. - Attachment^ data = gcnew Attachment("Qtr3.xls"); - - - // Add time stamp information for the file. - ContentDisposition^ disposition = data->ContentDisposition; - disposition->CreationDate = System::IO::File::GetCreationTime( file ); - disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); - disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); - - // Add the file attachment to this email message. - message->Attachments->Add( data ); - - //Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - - // Add credentials if the SMTP server requires them. - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - - // Notify user if an error occurs. - try - { - client->Send( message ); - } - catch ( SmtpException^ e ) - { - Console::WriteLine( L"Error: {0}", e->StatusCode ); - } - finally - { - data->~Attachment(); - client->~SmtpClient(); - } - - } - - - // - // - static void CreateMessageWithAttachment4( String^ server, String^ to ) - { - - // Specify the file to be attached and sent. - // This example uses a file on a UNC share. - String^ file = L"\\\\share3\\c$\\reports\\data.xls"; - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to,L"Quarterly data report",L"See the attached spreadsheet." ); - - // Create the file attachment for this email message. - Attachment^ data = gcnew Attachment("qtr3.xls", MediaTypeNames::Application::Octet); - - // Add time stamp information for the file. - ContentDisposition^ disposition = data->ContentDisposition; - disposition->CreationDate = System::IO::File::GetCreationTime( file ); - disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); - disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); - disposition->DispositionType = DispositionTypeNames::Attachment; - - // Add the file attachment to this email message. - message->Attachments->Add( data ); - - //Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - - // Add credentials if the SMTP server requires them. - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - client->Send( message ); - - // Display the message headers. - array^keys = message->Headers->AllKeys; - Console::WriteLine( L"Headers" ); - IEnumerator^ myEnum3 = keys->GetEnumerator(); - while ( myEnum3->MoveNext() ) - { - String^ s = safe_cast(myEnum3->Current); - Console::WriteLine( L"{0}:", s ); - Console::WriteLine( L" {0}", message->Headers[ s ] ); - } - - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void CreateMessageAttachment5( String^ server, String^ textMessage ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"A text message for you.",L"Message: " ); - - // Attach the message string to this email message. - Attachment^ data = gcnew Attachment(textMessage, - MediaTypeNames::Text::Plain); - ContentDisposition^ disposition = data->ContentDisposition; - - // Suggest a file name for the attachment. - disposition->FileName = String::Format( L"message{0}", DateTime::Now ); - message->Attachments->Add( data ); - - //Send the message. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void CreateMessageInlineAttachment3( String^ server, String^ textMessage ) - { - - // Create a message and set up the recipients. - MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"An inline text message for you.",L"Message: " ); - - // Attach the message string to this email message. - Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain ); - - // Send textMessage as part of the email body. - message->Attachments->Add( data ); - ContentDisposition^ disposition = data->ContentDisposition; - disposition->DispositionType = DispositionTypeNames::Inline; - - //Send the message. - // Include credentials if the server requires them. - SmtpClient^ client = gcnew SmtpClient( server ); - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - client->Send( message ); - data->~Attachment(); - client->~SmtpClient(); - } - - - // - // - static void RetryIfBusy( String^ server ) - { - MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" ); - MailAddress^ to = gcnew MailAddress( L"jane@contoso.com" ); - MailMessage^ message = gcnew MailMessage( from,to ); - - // message.Subject = "Using the SmtpClient class."; - message->Subject = L"Using the SmtpClient class."; - message->Body = L"Using this feature, you can send an email message from an application very easily."; - - // Add a carbon copy recipient. - MailAddress^ copy = gcnew MailAddress( L"Notifications@contoso.com" ); - message->CC->Add( copy ); - SmtpClient^ client = gcnew SmtpClient( server ); - - // Include credentials if the server requires them. - client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); - Console::WriteLine( L"Sending an email message to {0} using the SMTP host {1}.", to->Address, client->Host ); - try - { - client->Send( message ); - } - catch ( SmtpFailedRecipientsException^ ex ) - { - for ( int i = 0; i < ex->InnerExceptions->Length; i++ ) - { - SmtpStatusCode status = ex->InnerExceptions[ i ]->StatusCode; - if ( status == SmtpStatusCode::MailboxBusy || status == SmtpStatusCode::MailboxUnavailable ) - { - Console::WriteLine( L"Delivery failed - retrying in 5 seconds." ); - System::Threading::Thread::Sleep( 5000 ); - client->Send( message ); - } - else - { - Console::WriteLine( L"Failed to deliver message to {0}", ex->InnerExceptions[ i ] ); - } - - } - } - catch ( Exception^ ex ) - { - Console::WriteLine(L"Exception caught in RetryIfBusy(): {0}", - ex->ToString() ); - } - finally - { - client->~SmtpClient(); - } - } - - - // - // silly snippets to get code coverage in exceptions! - // - static SmtpException^ GenerateDefaultSmtpException() - { - return gcnew SmtpException; - } - - - // - // - static SmtpException^ GenerateSmtpException( String^ message ) - { - return gcnew SmtpException( message ); - } - - - // - // - static SmtpException^ GenerateSmtpException( SmtpStatusCode status ) - { - return gcnew SmtpException( status ); - } - - - // - // - static SmtpException^ GenerateSmtpException( SmtpStatusCode status, String^ message ) - { - return gcnew SmtpException( status,message ); - } - - - // - // - static SmtpException^ GenerateSmtpException( String^ message, Exception^ innerException ) - { - return gcnew SmtpException( message,innerException ); - } - - - // - static void CreateSampleDispositions() - { - - // - ContentDisposition^ c1 = gcnew ContentDisposition; - Console::WriteLine( c1 ); - - // - // - ContentDisposition^ c2 = gcnew ContentDisposition( L"attachment" ); - Console::WriteLine( c2 ); - - // - ContentDisposition^ c3 = gcnew ContentDisposition( L"Attachment; filename = myFile;" ); - Console::WriteLine( c3 ); - } - - static void DumpMailAddress( MailAddress^ a ) - { - Console::WriteLine( L"Display: {0} Host: {1} User: {2} Address: {3}", a->DisplayName, a->Host, a->User, a->Address ); - } - - static void CreateSampleAddresses() - { - MailAddress^ a1 = gcnew MailAddress( L"Ben Miller " ); - Console::WriteLine( a1 ); - DumpMailAddress( a1 ); - - // WRONG but legal: Should not include angle brackets. - MailAddress^ a2 = gcnew MailAddress( L"" ); - Console::WriteLine( a2 ); - DumpMailAddress( a2 ); - MailAddress^ a3 = gcnew MailAddress( L"ben.address1@contoso.com" ); - Console::WriteLine( a3 ); - DumpMailAddress( a3 ); - - // Use a constructor that takes an address and the display name separately. - // Throwing a format exception - // MailAddress a4 = new MailAddress("tom@contoso.com", "Tom Smith"); - // Console.WriteLine(a4.ToString()); - // DumpMailAddress(a4); - // WRONG: Should not include angle brackets. - // MailAddress a5 = new MailAddress(" ", "Tom Smith"); - // Console.WriteLine(a5.ToString()); - // DumpMailAddress(a5); - // WRONG but legal: Should not include display name as part of address. - MailAddress^ a6 = gcnew MailAddress( L"Tom Smith",L"Bill Jones" ); - Console::WriteLine( a6 ); - DumpMailAddress( a6 ); - MailAddress^ a7 = gcnew MailAddress( L"tom@contoso.com",L" Tom Smith " ); - Console::WriteLine( a7 ); - DumpMailAddress( a7 ); - } - - static void DisplayContentType( ContentType^ c ) - { - Console::WriteLine( L"Boundary {0}", c->Boundary ); - Console::WriteLine( L"Charset {0}", c->CharSet ); - Console::WriteLine( L"MediaType {0}", c->MediaType ); - Console::WriteLine( L"Name {0}", c->Name ); - Console::WriteLine( L"Parameters: {0}", c->Parameters->Count ); - IEnumerator^ myEnum4 = c->Parameters->GetEnumerator(); - while ( myEnum4->MoveNext() ) - { - DictionaryEntry^ d = safe_cast(myEnum4->Current); - Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); - } - } - - static void CreateContentTypes() - { - ContentType^ c1 = gcnew ContentType; - Console::WriteLine( L"---c1 {0}", c1 ); - DisplayContentType( c1 ); - ContentType^ c2 = gcnew ContentType( L"text/html" ); - Console::WriteLine( L"---c2 {0}", c2 ); - DisplayContentType( c2 ); - ContentType^ c3 = gcnew ContentType( L"application/x-myPrivateSubtype; name=data.xyz; charset=us-ascii" ); - Console::WriteLine( L"---c3 {0}", c3 ); - DisplayContentType( c3 ); - } - - - // The first argument is the recipient. - // The second argument is the sender. - void NCLMailSyncRun() - { - - // CreateTestMessage2(args[0]); - //CreateMessageInlineAttachment3("smarthost", "string textMessage"); - //CreateTestMessage3(); - //CreateTestMessage4(args[0]); - // CreateTestMessageX(args[0]); - //CreateMessageWithMultipleViews("smarthost","sharriso@microsoft.com"); - CreateBccTestMessage( L"sharriso1" ); - - //CreateCopyMessage("sharriso1"); - // CreateMessageWithMultipleRecipients("sharriso1"); - //CreateTestMessageY("sharriso1"); - //CreateMessageWithAttachment("smarthost"); - //CreateContentTypes(); - // CreateMessageWithMultipleRecipients("smarthost"); - //CreateSampleAddresses(); - // CreateMessageAttachment1("smarthost", "This is an attached message."); - //CreateMessageInlineAttachment("sharriso1", "How cool is this?"); - //CreateMessageInlineAttachment2("smarthost", "This is an attached message."); - //SendErrorLog("smarthost", "sharriso@microsoft.com"); - //Attachment log = SendNamedErrorLog("smarthost", "sharriso@microsoft.com"); - //SendNamedAndTypedErrorLog("smarthost", "sharriso@microsoft.com"); - //Attachment a = SendAttachedMessage("smarthost"); - //DisplayStringAttachment(a); - // CreateMessageWithFile("smarthost", "sharriso@microsoft.com"); - // CreateMessageWithAttachment2("smarthost", "sharriso@microsoft.com"); - // CreateMessageWithAttachment3("xx","sharriso@microsoft.com"); - // CreateMessageWithAttachment4("smarthost", "sharriso@microsoft.com"); - // CreateMessageAttachment5("sharriso1", "string textMessage"); - //CreateSampleDispositions(); - RetryIfBusy("sharriso1"); - } - -}; - -void main() -{ - CtorExamples^ ce = gcnew CtorExamples; - ce->NCLMailSyncRun(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp deleted file mode 100644 index 210b727cdc0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp +++ /dev/null @@ -1,1010 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::NetworkInformation; -using namespace System::Net::Sockets; - -// -void GetTcpConnections() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - array^connections = properties->GetActiveTcpConnections(); - System::Collections::IEnumerator^ myEnum = connections->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TcpConnectionInformation ^ t = safe_cast(myEnum->Current); - Console::Write( "Local endpoint: {0} ", t->LocalEndPoint->Address ); - Console::Write( "Remote endpoint: {0} ", t->RemoteEndPoint->Address ); - Console::WriteLine( "{0}", t->State ); - } -} -// - -// -void CountTcpConnections() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - array^connections = properties->GetActiveTcpConnections(); - int establishedConnections = 0; - System::Collections::IEnumerator^ myEnum1 = connections->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - TcpConnectionInformation ^ t = safe_cast(myEnum1->Current); - if ( t->State == TcpState::Established ) - { - establishedConnections++; - } - - Console::Write( "Local endpoint: {0} ", t->LocalEndPoint->Address ); - Console::WriteLine( "Remote endpoint: {0} ", t->RemoteEndPoint->Address ); - } - - Console::WriteLine( "There are {0} established TCP connections.", establishedConnections ); -} -// - -// -void DisplayActiveUdpListeners() -{ - Console::WriteLine( "Active UDP Listeners" ); - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - array^endPoints = properties->GetActiveUdpListeners(); - System::Collections::IEnumerator^ myEnum2 = endPoints->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - IPEndPoint^ e = safe_cast(myEnum2->Current); - Console::WriteLine( e ); - } -} -// - -// -void ShowNetworkInterfaces() -{ - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - if ( !nics || nics->Length < 1 ) - { - Console::WriteLine( " No network interfaces found." ); - return; - } - - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - Console::WriteLine( "Interface information for {0}.{1}", properties->HostName, properties->DomainName ); - Console::WriteLine( " Number of interfaces .................... : {0}", nics->Length ); - System::Collections::IEnumerator^ myEnum3 = nics->GetEnumerator(); - while ( myEnum3->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum3->Current); - Console::WriteLine(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - Console::WriteLine( " Interface type .......................... : {0}", - adapter->NetworkInterfaceType ); - } -} -// - -// -void ShowTcpTimeouts() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - TcpStatistics ^ tcpstat = properties->GetTcpIPv4Statistics(); - Console::WriteLine( " Minimum Transmission Timeout............. : {0}", - tcpstat->MinimumTransmissionTimeout ); - Console::WriteLine( " Maximum Transmission Timeout............. : {0}", - tcpstat->MaximumTransmissionTimeout ); - Console::WriteLine( " Maximum connections ............. : {0}", - tcpstat->MaximumConnections ); -} -// - -// -void ShowTcpConnectionStatistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - TcpStatistics ^ tcpstat = properties->GetTcpIPv4Statistics(); - Console::WriteLine( " Connection Data:" ); - Console::WriteLine( " Current ............................ : {0}", - tcpstat->CurrentConnections ); - Console::WriteLine( " Cumulative .......................... : {0}", - tcpstat->CumulativeConnections ); - Console::WriteLine( " Initiated ........................... : {0}", - tcpstat->ConnectionsInitiated ); - Console::WriteLine( " Accepted ............................ : {0}", - tcpstat->ConnectionsAccepted ); - Console::WriteLine( " Failed Attempts ..................... : {0}", - tcpstat->FailedConnectionAttempts ); - Console::WriteLine( " Reset ............................... : {0}", - tcpstat->ResetConnections ); - Console::WriteLine( " Errors .............................. : {0}", - tcpstat->ErrorsReceived ); -} -// - -// -void ShowTcpSegmentData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - TcpStatistics ^ tcpstat = properties->GetTcpIPv4Statistics(); - Console::WriteLine( " Segment Data:" ); - Console::WriteLine( " Received ........................... : {0}", - tcpstat->SegmentsReceived ); - Console::WriteLine( " Sent ................................ : {0}", - tcpstat->SegmentsSent ); - Console::WriteLine( " Retransmitted ....................... : {0}", - tcpstat->SegmentsResent ); - Console::WriteLine( " Resent with reset ................... : {0}", - tcpstat->ResetsSent ); -} -// - -// -void ShowInterfaceByteCounts() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum4 = adapters->GetEnumerator(); - while ( myEnum4->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum4->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " Bytes sent ............................: {0}", - stats->BytesSent ); - Console::WriteLine( " Bytes received ........................: {0}", - stats->BytesReceived ); - } -} -// - -// -void ShowUnicastCounts() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum5 = adapters->GetEnumerator(); - while ( myEnum5->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum5->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " Unicast Packets Sent ..................: {0}", - stats->UnicastPacketsSent ); - Console::WriteLine( " Unicast Packets Received ..............: {0}", - stats->UnicastPacketsReceived ); - } -} -// - -// -void ShowNonUnicastCounts() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum6 = adapters->GetEnumerator(); - while ( myEnum6->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum6->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " Non Unicast Packets Sent ..............: {0}", - stats->NonUnicastPacketsSent ); - Console::WriteLine( " Non Unicast Packets Received ..........: {0}", - stats->NonUnicastPacketsReceived ); - } -} -// - -// -void ShowPacketDiscards() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum7 = adapters->GetEnumerator(); - while ( myEnum7->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum7->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " Incoming Packets Discarded ............: {0}", - stats->IncomingPacketsDiscarded ); - Console::WriteLine( " Outgoing Packets Discarded ............: {0}", - stats->OutgoingPacketsDiscarded ); - } -} -// - -// -void ShowPacketErrors() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum8 = adapters->GetEnumerator(); - while ( myEnum8->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum8->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " Incoming Packets Errors ...............: {0}", - stats->IncomingPacketsWithErrors ); - Console::WriteLine( " Outgoing packets Errors ...............: {0}", - stats->OutgoingPacketsWithErrors ); - Console::WriteLine( " Incoming Unknown Protocol Errors ......: {0}", - stats->IncomingUnknownProtocolPackets ); - } -} -// - -// -void ShowInterfaceSpeedAndQueue() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum9 = adapters->GetEnumerator(); - while ( myEnum9->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum9->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " Speed .................................: {0}", - adapter->Speed ); - Console::WriteLine( " Output queue length....................: {0}", - stats->OutputQueueLength ); - } -} -// - -// -void ShowIPStatistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( " Forwarding enabled ...................... : {0}", - ipstat->ForwardingEnabled ); - Console::WriteLine( " Interfaces .............................. : {0}", - ipstat->NumberOfInterfaces ); - Console::WriteLine( " IP addresses ............................ : {0}", - ipstat->NumberOfIPAddresses ); - Console::WriteLine( " Routes .................................. : {0}", - ipstat->NumberOfRoutes ); - Console::WriteLine( " Default TTL ............................. : {0}", - ipstat->DefaultTtl ); -} -// - -// -void ShowInboundIPStatistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( " Inbound Packet Data:" ); - Console::WriteLine( " Received ............................ : {0}", - ipstat->ReceivedPackets ); - Console::WriteLine( " Forwarded ........................... : {0}", - ipstat->ReceivedPacketsForwarded ); - Console::WriteLine( " Delivered ........................... : {0}", - ipstat->ReceivedPacketsDelivered ); - Console::WriteLine( " Discarded ........................... : {0}", - ipstat->ReceivedPacketsDiscarded ); -} -// - -// -void ShowInboundIPErrors() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( " Inbound Packet Errors:" ); - Console::WriteLine( " Header Errors ....................... : {0}", - ipstat->ReceivedPacketsWithHeadersErrors ); - Console::WriteLine( " Address Errors ...................... : {0}", - ipstat->ReceivedPacketsWithAddressErrors ); - Console::WriteLine( " Unknown Protocol Errors ............. : {0}", - ipstat->ReceivedPacketsWithUnknownProtocol ); -} -// - -// -void ShowOutboundIPStatistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( " Outbound Packet Data:" ); - Console::WriteLine( " Requested ........................... : {0}", - ipstat->OutputPacketRequests ); - Console::WriteLine( " Discarded ........................... : {0}", - ipstat->OutputPacketsDiscarded ); - Console::WriteLine( " No Routing Discards ................. : {0}", - ipstat->OutputPacketsWithNoRoute ); - Console::WriteLine( " Routing Entry Discards .............. : {0}", - ipstat->OutputPacketRoutingDiscards ); -} -// - -// -void ShowFragmentationStatistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( " Reassembly Data:" ); - Console::WriteLine( " Reassembly Timeout .................. : {0}", - ipstat->PacketReassemblyTimeout ); - Console::WriteLine( " Reassemblies Required ............... : {0}", - ipstat->PacketReassembliesRequired ); - Console::WriteLine( " Packets Reassembled ................. : {0}", - ipstat->PacketsReassembled ); - Console::WriteLine( " Packets Fragmented .................. : {0}", - ipstat->PacketsFragmented ); - Console::WriteLine( " Fragment Failures ................... : {0}", - ipstat->PacketFragmentFailures ); -} -// - -// -void ShowIcmpV4MessageData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", - statistics->MessagesSent, statistics->MessagesReceived ); -} -// - -// -void ShowIcmpV4EchoData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", - statistics->EchoRequestsSent, - statistics->EchoRequestsReceived ); - Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", - statistics->EchoRepliesSent, - statistics->EchoRepliesReceived ); -} -// - -// -void ShowIcmpV4ErrorData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", - statistics->ErrorsSent, - statistics->ErrorsReceived ); -} -// - -// -void ShowIcmpV4UnreachableData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", - statistics->DestinationUnreachableMessagesSent, - statistics->DestinationUnreachableMessagesReceived ); -} -// - -// -void ShowSourceQuenchData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Source Quenches ..................... Sent: {0,-10} Received: {1,-10}", - statistics->SourceQuenchesSent, - statistics->SourceQuenchesReceived ); -} -// - -// -void ShowRedirectsData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", - statistics->RedirectsSent, - statistics->RedirectsReceived ); -} -// - -// -void ShowTimeExceededData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}", - statistics->TimeExceededMessagesSent, - statistics->TimeExceededMessagesReceived ); -} -// - -// -void ShowParameterData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", - statistics->ParameterProblemsSent, - statistics->ParameterProblemsReceived ); -} -// - -// -void ShowTimestampData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Timestamp Requests .................. Sent: {0,-10} Received: {1,-10}", - statistics->TimestampRequestsSent, - statistics->TimestampRequestsReceived ); - Console::WriteLine( " Timestamp Replies ................... Sent: {0,-10} Received: {1,-10}", - statistics->TimestampRepliesSent, - statistics->TimestampRepliesReceived ); -} -// - -// -void ShowAddressMaskData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); - Console::WriteLine( " Address Mask Requests ............... Sent: {0,-10} Received: {1,-10}", - statistics->AddressMaskRequestsSent, - statistics->AddressMaskRequestsReceived ); - Console::WriteLine( " Address Mask Replies ................ Sent: {0,-10} Received: {1,-10}", - statistics->AddressMaskRepliesSent, - statistics->AddressMaskRepliesReceived ); -} -// - -// -void ShowIcmpV6EchoData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", - statistics->EchoRequestsSent, statistics->EchoRequestsReceived ); - Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", - statistics->EchoRepliesSent, statistics->EchoRepliesReceived ); -} -// - -// -void ShowIcmpV6ErrorData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", - statistics->ErrorsSent, statistics->ErrorsReceived ); -} -// - -// -void ShowIcmpV6UnreachableData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", - statistics->DestinationUnreachableMessagesSent, - statistics->DestinationUnreachableMessagesReceived ); -} -// - -// -void ShowIcmpV6MessageData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", - statistics->MessagesSent, statistics->MessagesReceived ); -} -// - -// -void ShowIcmpV6MembershipData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Queries .............................. Sent: {0,-10} Received: {1,-10}", - statistics->MembershipQueriesSent, statistics->MembershipQueriesReceived ); - Console::WriteLine( " Reductions ........................... Sent: {0,-10} Received: {1,-10}", - statistics->MembershipReductionsSent, statistics->MembershipReductionsReceived ); - Console::WriteLine( " Reports .............................. Sent: {0,-10} Received: {1,-10}", - statistics->MembershipReportsSent, statistics->MembershipReportsReceived ); -} -// - -// -void ShowIcmpV6NeighborData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Advertisements ...................... Sent: {0,-10} Received: {1,-10}", - statistics->NeighborAdvertisementsSent, statistics->NeighborAdvertisementsReceived ); - Console::WriteLine( " Solicits ............................ Sent: {0,-10} Received: {1,-10}", - statistics->NeighborSolicitsSent, statistics->NeighborSolicitsReceived ); -} -// - -// -void ShowIcmpV6BigPacketData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Too Big Packet ........................ Sent: {0,-10} Received: {1,-10}", - statistics->PacketTooBigMessagesSent, - statistics->PacketTooBigMessagesReceived ); -} -// - -// -void ShowIcmpV6RedirectsData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", - statistics->RedirectsSent, - statistics->RedirectsReceived ); -} -// - -// -void ShowIcmpV6TimeExceededData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}", - statistics->TimeExceededMessagesSent, - statistics->TimeExceededMessagesReceived ); -} -// - -// -void ShowIcmpV6ParameterData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", - statistics->ParameterProblemsSent, - statistics->ParameterProblemsReceived ); -} -// - -// -void ShowIcmpV6RouterData() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); - Console::WriteLine( " Advertisements ....................... Sent: {0,-10} Received: {1,-10}", - statistics->RouterAdvertisementsSent, - statistics->RouterAdvertisementsReceived ); - Console::WriteLine( " Solicits ............................. Sent: {0,-10} Received: {1,-10}", - statistics->RouterSolicitsSent, - statistics->RouterSolicitsReceived ); -} -// - -// New content 10/29/03 -// -void DisplayDnsConfiguration() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum10 = adapters->GetEnumerator(); - while ( myEnum10->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum10->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( " DNS suffix................................. :{0}", - properties->DnsSuffix ); - Console::WriteLine( " DNS enabled ............................. : {0}", - properties->IsDnsEnabled ); - Console::WriteLine( " Dynamically configured DNS .............. : {0}", - properties->IsDynamicDnsEnabled ); - } -} -// - -// -void DisplayDnsAddresses() -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum11 = adapters->GetEnumerator(); - while ( myEnum11->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum11->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - IPAddressCollection ^ dnsServers = adapterProperties->DnsAddresses; - if ( dnsServers->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - System::Collections::IEnumerator^ myEnum12 = dnsServers->GetEnumerator(); - while ( myEnum12->MoveNext() ) - { - IPAddress ^ dns = safe_cast(myEnum12->Current); - Console::WriteLine( " DNS Servers ............................. : {0}", - dns->ToString()); - } - } - } -} -// - -// -void DisplayAnycastAddresses() -{ - int count = 0; - - Console::WriteLine( "Anycast Addresses" ); - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum13 = adapters->GetEnumerator(); - while ( myEnum13->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum13->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - IPAddressInformationCollection ^ anyCast = adapterProperties->AnycastAddresses; - if ( anyCast->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - System::Collections::IEnumerator^ myEnum14 = anyCast->GetEnumerator(); - while ( myEnum14->MoveNext() ) - { - IPAddressInformation ^ any = safe_cast(myEnum14->Current); - Console::WriteLine( " Anycast Address .......................... : {0} {1} {2}", - any->Address, any->IsTransient ? "Transient" : "", - any->IsDnsEligible ? "DNS Eligible" : "" ); - count++; - } - Console::WriteLine(); - } - } - if (count == 0) - { - Console::WriteLine(" No anycast addresses were found."); - Console::WriteLine(); - } -} -// - -// -void DisplayMulticastAddresses() -{ - int count = 0; - - Console::WriteLine( "Multicast Addresses" ); - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum15 = adapters->GetEnumerator(); - while ( myEnum15->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum15->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - MulticastIPAddressInformationCollection ^ multiCast = adapterProperties->MulticastAddresses; - if ( multiCast->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - System::Collections::IEnumerator^ myEnum16 = multiCast->GetEnumerator(); - while ( myEnum16->MoveNext() ) - { - MulticastIPAddressInformation ^ multi = safe_cast(myEnum16->Current); - Console::WriteLine( " Multicast Address ....................... : {0} {1} {2}", - multi->Address, multi->IsTransient ? "Transient" : "", - multi->IsDnsEligible ? "DNS Eligible" : "" ); - count++; - } - Console::WriteLine(); - } - } - if (count == 0) - { - Console::WriteLine(" No multicast addresses were found."); - Console::WriteLine(); - } -} -// - -// -void DisplayUnicastAddresses() -{ - Console::WriteLine( "Unicast Addresses" ); - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum17 = adapters->GetEnumerator(); - while ( myEnum17->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum17->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - UnicastIPAddressInformationCollection ^ uniCast = adapterProperties->UnicastAddresses; - if ( uniCast->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - String^ lifeTimeFormat = "dddd, MMMM dd, yyyy hh:mm:ss tt"; - System::Collections::IEnumerator^ myEnum18 = uniCast->GetEnumerator(); - while ( myEnum18->MoveNext() ) - { - UnicastIPAddressInformation ^ uni = safe_cast(myEnum18->Current); - DateTime when; - Console::WriteLine( " Unicast Address ......................... : {0}", - uni->Address ); - Console::WriteLine( " Prefix Origin ........................ : {0}", - uni->PrefixOrigin ); - Console::WriteLine( " Suffix Origin ........................ : {0}", - uni->SuffixOrigin ); - Console::WriteLine( " Duplicate Address Detection .......... : {0}", - uni->DuplicateAddressDetectionState ); - - // Format the lifetimes as Sunday, February 16, 2003 11:33:44 PM - // if en-us is the current culture. - // Calculate the date and time at the end of the lifetimes. - when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressValidLifetime ); - when = when.ToLocalTime(); - Console::WriteLine( " Valid Life Time ...................... : {0}", - when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); - when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressPreferredLifetime ); - when = when.ToLocalTime(); - Console::WriteLine( " Preferred life time .................. : {0}", - when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); - when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->DhcpLeaseLifetime ); - when = when.ToLocalTime(); - Console::WriteLine( " DHCP Leased Life Time ................ : {0}", - when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); - } - Console::WriteLine(); - } - } -} -// - -// -void DisplayDhcpServerAddresses() -{ - Console::WriteLine( "DHCP Servers" ); - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum19 = adapters->GetEnumerator(); - while ( myEnum19->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum19->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - IPAddressCollection ^ addresses = adapterProperties->DhcpServerAddresses; - if ( addresses->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - System::Collections::IEnumerator^ myEnum20 = addresses->GetEnumerator(); - while ( myEnum20->MoveNext() ) - { - IPAddress^ address = safe_cast(myEnum20->Current); - Console::WriteLine( " Dhcp Address ............................ : {0}", - address ); - } - Console::WriteLine(); - } - } -} -// - -// -void DisplayGatewayAddresses() -{ - Console::WriteLine( "Gateways" ); - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum21 = adapters->GetEnumerator(); - while ( myEnum21->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum21->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - GatewayIPAddressInformationCollection ^ addresses = adapterProperties->GatewayAddresses; - if ( addresses->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - System::Collections::IEnumerator^ myEnum22 = addresses->GetEnumerator(); - while ( myEnum22->MoveNext() ) - { - GatewayIPAddressInformation^ address = safe_cast(myEnum22->Current); - Console::WriteLine( " Gateway Address ......................... : {0}", - address->Address->ToString() ); - } - Console::WriteLine(); - } - } -} -// - -// -void DisplayIPv4NetworkInterfaces() -{ - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - Console::WriteLine( "IPv4 interface information for {0}.{1}", properties->HostName, properties->DomainName ); - System::Collections::IEnumerator^ myEnum23 = nics->GetEnumerator(); - while ( myEnum23->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum23->Current); - - // Only display informatin for interfaces that support IPv4. - if ( !adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) - { - continue; - } - Console::WriteLine(); - Console::WriteLine( adapter->Description ); - - // Underline the description. - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - - // Try to get the IPv4 interface properties. - IPv4InterfaceProperties ^ p = adapterProperties->GetIPv4Properties(); - - // Display the IPv4 specific data. - Console::WriteLine( " Index ............................. : {0}", - p->Index ); - Console::WriteLine( " MTU ............................... : {0}", - p->Mtu ); - Console::WriteLine( " APIPA active....................... : {0}", - p->IsAutomaticPrivateAddressingActive ); - Console::WriteLine( " APIPA enabled...................... : {0}", - p->IsAutomaticPrivateAddressingEnabled ); - Console::WriteLine( " Forwarding enabled................. : {0}", - p->IsForwardingEnabled ); - Console::WriteLine( " Uses WINS ......................... : {0}", - p->UsesWins ); - } -} -// - -// -void DisplayIPv6NetworkInterfaces() -{ - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - Console::WriteLine( "IPv6 interface information for {0}.{1}", - properties->HostName, properties->DomainName ); - - int count = 0; - - System::Collections::IEnumerator^ myEnum24 = nics->GetEnumerator(); - while ( myEnum24->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum24->Current); - - // Only display informatin for interfaces that support IPv6. - if ( !adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) - { - continue; - } - - count++; - - Console::WriteLine(); - Console::WriteLine( adapter->Description ); - - // Underline the description. - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - - // Try to get the IPv6 interface properties. - IPv6InterfaceProperties ^ p = adapterProperties->GetIPv6Properties(); - if ( !p ) - { - Console::WriteLine( "No IPv6 information is available for this interface." ); - continue; - } - - // Display the IPv6 specific data. - Console::WriteLine( " Index ............................. : {0}", - p->Index ); - Console::WriteLine( " MTU ............................... : {0}", - p->Mtu ); - } - if (count == 0) - { - Console::WriteLine(" No IPv6 interfaces were found."); - Console::WriteLine(); - } -} -// - -// -void DisplayWinsServerAddresses() -{ - Console::WriteLine( "WINS Servers" ); - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum25 = adapters->GetEnumerator(); - while ( myEnum25->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum25->Current); - IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); - IPAddressCollection ^ addresses = adapterProperties->WinsServersAddresses; - if ( addresses->Count > 0 ) - { - Console::WriteLine( adapter->Description ); - System::Collections::IEnumerator^ myEnum26 = addresses->GetEnumerator(); - while ( myEnum26->MoveNext() ) - { - IPAddress^ address = safe_cast(myEnum26->Current); - Console::WriteLine( " WINS Server ............................ : {0}", - address ); - } - Console::WriteLine(); - } - } -} -// - -// -void DisplayTypeAndAddress() -{ - IPGlobalProperties ^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - Console::WriteLine( "Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName ); - System::Collections::IEnumerator^ myEnum27 = nics->GetEnumerator(); - while ( myEnum27->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum27->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - Console::WriteLine( " Interface type .......................... : {0}", - adapter->NetworkInterfaceType ); - Console::WriteLine( " Physical Address ........................ : {0}", - adapter->GetPhysicalAddress() ); - Console::WriteLine( " Is receive only.......................... : {0}", - adapter->IsReceiveOnly ); - Console::WriteLine( " Multicast................................ : {0}", - adapter->SupportsMulticast ); - } -} -// - -int main() -{ - DisplayDnsAddresses(); - DisplayDnsConfiguration(); - DisplayAnycastAddresses(); - DisplayMulticastAddresses(); - DisplayUnicastAddresses(); - - DisplayDhcpServerAddresses(); - DisplayGatewayAddresses(); - - DisplayIPv4NetworkInterfaces(); - DisplayIPv6NetworkInterfaces(); - DisplayWinsServerAddresses(); - - DisplayTypeAndAddress(); - - GetTcpConnections(); - CountTcpConnections(); - DisplayActiveUdpListeners(); - ShowTcpSegmentData(); - ShowTcpConnectionStatistics(); - ShowTcpTimeouts(); - ShowInterfaceSpeedAndQueue(); - ShowPacketErrors(); - ShowPacketDiscards(); - ShowNonUnicastCounts(); - ShowUnicastCounts(); - ShowInterfaceByteCounts(); - ShowFragmentationStatistics(); - ShowOutboundIPStatistics(); - // - ShowInboundIPErrors(); - ShowInboundIPStatistics(); - ShowIPStatistics(); - if (Socket::OSSupportsIPv6) - { - ShowIcmpV6MessageData(); - ShowIcmpV6EchoData(); - ShowIcmpV6ErrorData(); - ShowIcmpV6UnreachableData (); - ShowIcmpV6RouterData (); - } - ShowRedirectsData(); - ShowTimeExceededData(); - if (Socket::OSSupportsIPv6) - { - ShowIcmpV6ParameterData (); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp deleted file mode 100644 index 850060ff81c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp +++ /dev/null @@ -1,603 +0,0 @@ - - -// Sample NCLNetInfoReport -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Net::NetworkInformation; -using namespace System::Text; - -// -void ShowIPStatistics( NetworkInterfaceComponent version ) -{ - // - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IPGlobalStatistics ^ ipstat = nullptr; - switch ( version ) - { - case NetworkInterfaceComponent::IPv4: - ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( "{0}IPv4 Statistics ", Environment::NewLine ); - break; - - case NetworkInterfaceComponent::IPv6: - ipstat = properties->GetIPv4GlobalStatistics(); - Console::WriteLine( "{0}IPv6 Statistics ", Environment::NewLine ); - break; - - default: - throw gcnew ArgumentException( "version" ); - break; - } - // - - Console::WriteLine( " Forwarding enabled ...................... : {0}", - ipstat->ForwardingEnabled ); - Console::WriteLine( " Interfaces .............................. : {0}", - ipstat->NumberOfInterfaces ); - Console::WriteLine( " IP addresses ............................ : {0}", - ipstat->NumberOfIPAddresses ); - Console::WriteLine( " Routes .................................. : {0}", - ipstat->NumberOfRoutes ); - Console::WriteLine( " Default TTL ............................. : {0}", - ipstat->DefaultTtl ); - Console::WriteLine( "" ); - Console::WriteLine( " Inbound Packet Data:" ); - Console::WriteLine( " Received ............................ : {0}", - ipstat->ReceivedPackets ); - Console::WriteLine( " Forwarded ........................... : {0}", - ipstat->ReceivedPacketsForwarded ); - Console::WriteLine( " Delivered ........................... : {0}", - ipstat->ReceivedPacketsDelivered ); - Console::WriteLine( " Discarded ........................... : {0}", - ipstat->ReceivedPacketsDiscarded ); - Console::WriteLine( " Header Errors ....................... : {0}", - ipstat->ReceivedPacketsWithHeadersErrors ); - Console::WriteLine( " Address Errors ...................... : {0}", - ipstat->ReceivedPacketsWithAddressErrors ); - Console::WriteLine( " Unknown Protocol Errors ............. : {0}", - ipstat->ReceivedPacketsWithUnknownProtocol ); - Console::WriteLine( "" ); - Console::WriteLine( " Outbound Packet Data:" ); - Console::WriteLine( " Requested ........................... : {0}", - ipstat->OutputPacketRequests ); - Console::WriteLine( " Discarded ........................... : {0}", - ipstat->OutputPacketsDiscarded ); - Console::WriteLine( " No Routing Discards ................. : {0}", - ipstat->OutputPacketsWithNoRoute ); - Console::WriteLine( " Routing Entry Discards .............. : {0}", - ipstat->OutputPacketRoutingDiscards ); - Console::WriteLine( "" ); - Console::WriteLine( " Reassembly Data:" ); - Console::WriteLine( " Reassembly Timeout .................. : {0}", - ipstat->PacketReassemblyTimeout ); - Console::WriteLine( " Reassemblies Required ............... : {0}", - ipstat->PacketReassembliesRequired ); - Console::WriteLine( " Packets Reassembled ................. : {0}", - ipstat->PacketsReassembled ); - Console::WriteLine( " Packets Fragmented .................. : {0}", - ipstat->PacketsFragmented ); - Console::WriteLine( " Fragment Failures ................... : {0}", - ipstat->PacketFragmentFailures ); - Console::WriteLine( "" ); -} -// - -// -void ShowTcpStatistics( NetworkInterfaceComponent version ) -{ - // - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - TcpStatistics ^ tcpstat = nullptr; - Console::WriteLine( "" ); - switch ( version ) - { - case NetworkInterfaceComponent::IPv4: - tcpstat = properties->GetTcpIPv4Statistics(); - Console::WriteLine( "TCP/IPv4 Statistics:" ); - break; - - case NetworkInterfaceComponent::IPv6: - tcpstat = properties->GetTcpIPv6Statistics(); - Console::WriteLine( "TCP/IPv6 Statistics:" ); - break; - - default: - throw gcnew ArgumentException( "version" ); - break; - } - // - Console::WriteLine( " Minimum Transmission Timeout............. : {0}", - tcpstat->MinimumTransmissionTimeout ); - Console::WriteLine( " Maximum Transmission Timeout............. : {0}", - tcpstat->MaximumTransmissionTimeout ); - Console::WriteLine( " Connection Data:" ); - Console::WriteLine( " Current ............................ : {0}", - tcpstat->CurrentConnections ); - Console::WriteLine( " Cumulative .......................... : {0}", - tcpstat->CumulativeConnections ); - Console::WriteLine( " Initiated ........................... : {0}", - tcpstat->ConnectionsInitiated ); - Console::WriteLine( " Accepted ............................ : {0}", - tcpstat->ConnectionsAccepted ); - Console::WriteLine( " Failed Attempts ..................... : {0}", - tcpstat->FailedConnectionAttempts ); - Console::WriteLine( " Reset ............................... : {0}", - tcpstat->ResetConnections ); - Console::WriteLine( "" ); - Console::WriteLine( " Segment Data:" ); - Console::WriteLine( " Received ........................... : {0}", - tcpstat->SegmentsReceived ); - Console::WriteLine( " Sent ................................ : {0}", - tcpstat->SegmentsSent ); - Console::WriteLine( " Retransmitted ....................... : {0}", - tcpstat->SegmentsResent ); - Console::WriteLine( "" ); -} -// - -// -void ShowUdpStatistics( NetworkInterfaceComponent version ) -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - UdpStatistics ^ udpStat = nullptr; - switch ( version ) - { - case NetworkInterfaceComponent::IPv4: - udpStat = properties->GetUdpIPv4Statistics(); - Console::WriteLine( "UDP IPv4 Statistics" ); - break; - - case NetworkInterfaceComponent::IPv6: - udpStat = properties->GetUdpIPv6Statistics(); - Console::WriteLine( "UDP IPv6 Statistics" ); - break; - - default: - throw gcnew ArgumentException( "version" ); - break; - } - Console::WriteLine( " Datagrams Received ...................... : {0}", udpStat->DatagramsReceived ); - Console::WriteLine( " Datagrams Sent .......................... : {0}", udpStat->DatagramsSent ); - Console::WriteLine( " Incoming Datagrams Discarded ............ : {0}", udpStat->IncomingDatagramsDiscarded ); - Console::WriteLine( " Incoming Datagrams With Errors .......... : {0}", udpStat->IncomingDatagramsWithErrors ); - Console::WriteLine( " UDP Listeners ........................... : {0}", udpStat->UdpListeners ); - Console::WriteLine( "" ); -} -// - -// -void ShowEchoIcmpv4( IcmpV4Statistics ^ stat4 ) -{ - if ( stat4 != nullptr ) - { - Console::WriteLine( "ICMP v4 Echo Requests ................. Sent: {0,-10} Received: {1,-10}", stat4->EchoRequestsSent, stat4->EchoRequestsReceived ); - Console::WriteLine( "ICMP v4 Echo Replies .................. Sent: {0,-10} Received: {1,-10}", stat4->EchoRepliesSent, stat4->EchoRepliesReceived ); - } -} - -void ShowEchoIcmpv6( IcmpV6Statistics ^ stat6 ) -{ - if ( stat6 != nullptr ) - { - Console::WriteLine( "ICMP v6 Echo Requests.................. Sent: {0,-10} Received: {1,-10}", stat6->EchoRequestsSent, stat6->EchoRequestsReceived ); - Console::WriteLine( "ICMP v6 Echo Replies .................. Sent: {0,-10} Received: {1,-10}", stat6->EchoRepliesSent, stat6->EchoRepliesReceived ); - } -} - -// - -// -void ShowIcmpv4MessagesAndErrors( IcmpV4Statistics ^ stat4 ) -{ - if ( stat4 != nullptr ) - { - Console::WriteLine( "ICMP v4 Messages ...................... Sent: {0,-10} Received: {1,-10}", stat4->MessagesSent, stat4->MessagesReceived ); - Console::WriteLine( "ICMP v6 Errors ........................ Sent: {0,-10} Received: {1,-10}", stat4->ErrorsSent, stat4->ErrorsReceived ); - } - -} - -void ShowIcmpv6MessagesAndErrors( IcmpV6Statistics ^ stat6 ) -{ - if ( stat6 != nullptr ) - { - Console::WriteLine( "ICMP v6 Messages ...................... Sent: {0,-10} Received: {1,-10}", stat6->MessagesSent, stat6->MessagesReceived ); - Console::WriteLine( "ICMP v6 Errors ........................ Sent: {0,-10} Received: {1,-10}", stat6->ErrorsSent, stat6->ErrorsReceived ); - } -} -// - -// -void ShowIcmpV4Statistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV4Statistics ^ stat = properties->GetIcmpV4Statistics(); - Console::WriteLine( "ICMP V4 Statistics:" ); - Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", stat->MessagesSent, stat->MessagesReceived ); - Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", stat->ErrorsSent, stat->ErrorsReceived ); - Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", stat->EchoRequestsSent, stat->EchoRequestsReceived ); - Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", stat->EchoRepliesSent, stat->EchoRepliesReceived ); - Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", stat->DestinationUnreachableMessagesSent, stat->DestinationUnreachableMessagesReceived ); - Console::WriteLine( " Source Quenches ..................... Sent: {0,-10} Received: {1,-10}", stat->SourceQuenchesSent, stat->SourceQuenchesReceived ); - Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", stat->RedirectsSent, stat->RedirectsReceived ); - Console::WriteLine( " TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}", stat->TimeExceededMessagesSent, stat->TimeExceededMessagesReceived ); - Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", stat->ParameterProblemsSent, stat->ParameterProblemsReceived ); - Console::WriteLine( " Timestamp Requests .................. Sent: {0,-10} Received: {1,-10}", stat->TimestampRequestsSent, stat->TimestampRequestsReceived ); - Console::WriteLine( " Timestamp Replies ................... Sent: {0,-10} Received: {1,-10}", stat->TimestampRepliesSent, stat->TimestampRepliesReceived ); - Console::WriteLine( " Address Mask Requests ............... Sent: {0,-10} Received: {1,-10}", stat->AddressMaskRequestsSent, stat->AddressMaskRequestsReceived ); - Console::WriteLine( " Address Mask Replies ................ Sent: {0,-10} Received: {1,-10}", stat->AddressMaskRepliesSent, stat->AddressMaskRepliesReceived ); - Console::WriteLine( "" ); -} -// - -// -void ShowIcmpV6Statistics() -{ - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - IcmpV6Statistics ^ stat = properties->GetIcmpV6Statistics(); - Console::WriteLine( "ICMP V6 Statistics:" ); - Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", stat->MessagesSent, stat->MessagesReceived ); - Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", stat->ErrorsSent, stat->ErrorsReceived ); - Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", stat->EchoRequestsSent, stat->EchoRequestsReceived ); - Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", stat->EchoRepliesSent, stat->EchoRepliesReceived ); - Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", stat->DestinationUnreachableMessagesSent, stat->DestinationUnreachableMessagesReceived ); - Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", stat->ParameterProblemsSent, stat->ParameterProblemsReceived ); - Console::WriteLine( " Packets Too Big ..................... Sent: {0,-10} Received: {1,-10}", stat->PacketTooBigMessagesSent, stat->PacketTooBigMessagesReceived ); - Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", stat->RedirectsSent, stat->RedirectsReceived ); - Console::WriteLine( " Router Advertisements ............... Sent: {0,-10} Received: {1,-10}", stat->RouterAdvertisementsSent, stat->RouterAdvertisementsReceived ); - Console::WriteLine( " Router Solicitations ................ Sent: {0,-10} Received: {1,-10}", stat->RouterSolicitsSent, stat->RouterSolicitsReceived ); - Console::WriteLine( " Time Exceeded ....................... Sent: {0,-10} Received: {1,-10}", stat->TimeExceededMessagesSent, stat->TimeExceededMessagesReceived ); - Console::WriteLine( " Neighbor Advertisements ............. Sent: {0,-10} Received: {1,-10}", stat->NeighborAdvertisementsSent, stat->NeighborAdvertisementsReceived ); - Console::WriteLine( " Neighbor Solicitations .............. Sent: {0,-10} Received: {1,-10}", stat->NeighborSolicitsSent, stat->NeighborSolicitsReceived ); - Console::WriteLine( " Membership Queries .................. Sent: {0,-10} Received: {1,-10}", stat->MembershipQueriesSent, stat->MembershipQueriesReceived ); - Console::WriteLine( " Membership Reports .................. Sent: {0,-10} Received: {1,-10}", stat->MembershipReportsSent, stat->MembershipReportsReceived ); - Console::WriteLine( " Membership Reductions ............... Sent: {0,-10} Received: {1,-10}", stat->MembershipReductionsSent, stat->MembershipReductionsReceived ); - Console::WriteLine( "" ); -} -// - -// -void ShowIPAddresses( String^ label, IPAddressCollection^ addresses ) -{ - if ( addresses->Count == 0 ) - return; - -// Console::WriteLine( "{0} {1} ", label, addresses->Item[ 0 ] ); - if ( addresses->Count > 1 ) - { - for ( int i = 1; i < addresses->Count; i++ ) - { - String^ address = addresses->ToString(); - String^ line = address->PadLeft( label->Length + address->Length + 1 ); - Console::WriteLine( "{0}", line ); - - } - } -} -// - -// -void ShowIPAddresses( IPInterfaceProperties ^ adapterProperties ) -{ - // - IPAddressCollection ^ dnsServers = adapterProperties->DnsAddresses; - if ( dnsServers != nullptr ) - { - System::Collections::IEnumerator^ myEnum = dnsServers->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - IPAddressInformation ^ dns = safe_cast(myEnum->Current); - Console::WriteLine( " DNS Servers ............................. : {0} ({1} {2})", - dns->Address, dns->IsTransient ? (String^)"Transient" : "", dns->IsDnsEligible ? (String^)"DNS Eligible" : "" ); - } - } - // - - IPAddressInformationCollection ^ anyCast = adapterProperties->AnycastAddresses; - if ( anyCast != nullptr ) - { - System::Collections::IEnumerator^ myEnum1 = anyCast->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - IPAddressInformation ^ any = safe_cast(myEnum1->Current); - Console::WriteLine( " Anycast Address .......................... : {0} {1} {2}", any->Address, any->IsTransient ? (String^)"Transient" : "", any->IsDnsEligible ? (String^)"DNS Eligible" : "" ); - } - - Console::WriteLine(); - } - - MulticastIPAddressInformationCollection ^ multiCast = adapterProperties->MulticastAddresses; - if ( multiCast != nullptr ) - { - System::Collections::IEnumerator^ myEnum2 = multiCast->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - IPAddressInformation ^ multi = safe_cast(myEnum2->Current); - Console::WriteLine( " Multicast Address ....................... : {0} {1} {2}", multi->Address, multi->IsTransient ? (String^)"Transient" : "", multi->IsDnsEligible ? (String^)"DNS Eligible" : "" ); - } - - Console::WriteLine(); - } - - // - UnicastIPAddressInformationCollection ^ uniCast = adapterProperties->UnicastAddresses; - if ( uniCast != nullptr ) - { - String^ lifeTimeFormat = "dddd, MMMM dd, yyyy hh:mm:ss tt"; - System::Collections::IEnumerator^ myEnum3 = uniCast->GetEnumerator(); - while ( myEnum3->MoveNext() ) - { - UnicastIPAddressInformation ^ uni = safe_cast(myEnum3->Current); - DateTime when; - Console::WriteLine( " Unicast Address ......................... : {0}", uni->Address ); - Console::WriteLine( " Prefix Origin ........................ : {0}", uni->PrefixOrigin ); - Console::WriteLine( " Suffix Origin ........................ : {0}", uni->SuffixOrigin ); - Console::WriteLine( " Duplicate Address Detection .......... : {0}", uni->DuplicateAddressDetectionState ); - - // Format the lifetimes as Sunday, February 16, 2003 11:33:44 PM - // if en-us is the current culture. - // Calculate the date and time at the end of the lifetimes. - when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressValidLifetime ); - when = when.ToLocalTime(); - Console::WriteLine( " Valid Life Time ...................... : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); - when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressPreferredLifetime ); - when = when.ToLocalTime(); - Console::WriteLine( " Preferred life time .................. : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); - when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->DhcpLeaseLifetime ); - when = when.ToLocalTime(); - Console::WriteLine( " DHCP Leased Life Time ................ : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); - } - - Console::WriteLine(); - } - // -} -// - -// -void ShowInterfaceStatistics( NetworkInterface ^ adapter ) -{ - IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); - Console::WriteLine( "{0} Interface Statistics:", Environment::NewLine ); - Console::WriteLine( " Bytes sent ........................... : {0}", - stats->BytesSent ); - Console::WriteLine( " Bytes received ....................... : {0}", - stats->BytesReceived ); - Console::WriteLine( " Unicast Packets Sent ................. : {0}", - stats->UnicastPacketsSent ); - Console::WriteLine( " Unicast Packets Received ............. : {0}", - stats->UnicastPacketsReceived ); - Console::WriteLine( " Non Unicast Packets Sent ............. : {0}", - stats->NonUnicastPacketsSent ); - Console::WriteLine( " Non Unicast Packets Received ......... : {0}", - stats->NonUnicastPacketsReceived ); - Console::WriteLine( " Incoming Packets Discarded ........... : {0}", - stats->IncomingPacketsDiscarded ); - Console::WriteLine( " Outgoing Packets Discarded ........... : {0}", - stats->OutgoingPacketsDiscarded ); - Console::WriteLine( " Incoming Packets Errors .............. : {0}", - stats->IncomingPacketsWithErrors ); - Console::WriteLine( " Outgoing packets Errors .............. : {0}", - stats->OutgoingPacketsWithErrors ); - Console::WriteLine( " Incoming Unknown Protocol Errors ..... : {0}", - stats->IncomingUnknownProtocolPackets ); - Console::WriteLine( " Speed ................................ : {0}", - adapter->Speed ); - Console::WriteLine( " Output queue length................... : {0}", - stats->OutputQueueLength ); - Console::WriteLine(); -} -// - -// -void ShowNetworkInterfaces() -{ - IPGlobalProperties ^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - Console::WriteLine( "Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName ); - if ( nics == nullptr || nics->Length < 1 ) - { - Console::WriteLine( " No network interfaces found." ); - return; - } - - Console::WriteLine( " Number of interfaces .................... : {0}", nics->Length ); - System::Collections::IEnumerator^ myEnum4 = nics->GetEnumerator(); - while ( myEnum4->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum4->Current); - IPInterfaceProperties ^ properties = adapter->GetIPProperties(); - Console::WriteLine(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - Console::WriteLine( " Interface type .......................... : {0}", - adapter->NetworkInterfaceType ); - Console::WriteLine( " Physical Address ........................ : {0}", - adapter->GetPhysicalAddress() ); - Console::WriteLine( " Operational status ...................... : {0}", - adapter->OperationalStatus ); - String^ versions = ""; - - // Create a display string for the supported IP versions. - if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) - { - versions = "IPv4"; - } - if ( adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) - { - if ( versions->Length > 0 ) - { - versions = String::Concat( versions, " " ); - } - versions = String::Concat( versions, "IPv6" ); - } - Console::WriteLine( " IP version .............................. : {0}", - versions ); - ShowIPAddresses( properties ); - - // The following information is not useful for loopback adapters. - if ( adapter->NetworkInterfaceType == NetworkInterfaceType::Loopback ) - { - continue; - } - Console::WriteLine( " DNS suffix .............................. : {0}", - properties->DnsSuffix ); - String^ label; - - // - if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) - { - IPv4InterfaceProperties ^ ipv4 = properties->GetIPv4Properties(); - Console::WriteLine( " MTU...................................... : {0}", - ipv4->Mtu ); - if ( ipv4->UsesWins ) - { - IPAddressCollection ^ winsServers = properties->WinsServersAddresses; - if ( winsServers->Count > 0 ) - { - label = " WINS Servers ............................ :"; - ShowIPAddresses( label, winsServers ); - } - } - } - // - Console::WriteLine( " DNS enabled ............................. : {0}", - properties->IsDnsEnabled ); - Console::WriteLine( " Dynamically configured DNS .............. : {0}", - properties->IsDynamicDnsEnabled ); - Console::WriteLine( " Receive Only ............................ : {0}", - adapter->IsReceiveOnly ); - Console::WriteLine( " Multicast ............................... : {0}", - adapter->SupportsMulticast ); - ShowInterfaceStatistics( adapter ); - Console::WriteLine(); - } -} -// - - -// -void ShowInterfaceSummary() -{ - array^interfaces = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum5 = interfaces->GetEnumerator(); - while ( myEnum5->MoveNext() ) - { - NetworkInterface ^ adapter = safe_cast(myEnum5->Current); - Console::WriteLine( "Name: {0}", adapter->Name ); - Console::WriteLine( adapter->Description ); - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - Console::WriteLine( " Interface type .......................... : {0}", - adapter->NetworkInterfaceType ); - Console::WriteLine( " Operational status ...................... : {0}", adapter->OperationalStatus ); - String^ versions = ""; - - // Create a display string for the supported IP versions. - if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) - { - versions = "IPv4"; - } - - if ( adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) - { - if ( versions->Length > 0 ) - { - versions = String::Concat( versions, " " ); - } - - versions = String::Concat( versions, "IPv6" ); - } - - Console::WriteLine( " IP version .............................. : {0}", versions ); - Console::WriteLine(); - } - - Console::WriteLine(); -} -// - -// -void ShowActiveTcpConnections() -{ - Console::WriteLine( "Active TCP Connections" ); - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - array^connections = properties->GetActiveTcpConnections(); - System::Collections::IEnumerator^ myEnum6 = connections->GetEnumerator(); - while ( myEnum6->MoveNext() ) - { - TcpConnectionInformation ^ c = safe_cast(myEnum6->Current); - Console::WriteLine( "{0} <==> {1}", c->LocalEndPoint, c->RemoteEndPoint ); - } -} -// - -// -void ShowActiveTcpListeners() -{ - Console::WriteLine( "Active TCP Listeners" ); - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - array^endPoints = properties->GetActiveTcpListeners(); - System::Collections::IEnumerator^ myEnum7 = endPoints->GetEnumerator(); - while ( myEnum7->MoveNext() ) - { - IPEndPoint^ e = safe_cast(myEnum7->Current); - Console::WriteLine( e ); - } -} -// - -// -void ShowActiveUdpListeners() -{ - Console::WriteLine( "Active UDP Listeners" ); - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - array^endPoints = properties->GetActiveUdpListeners(); - System::Collections::IEnumerator^ myEnum8 = endPoints->GetEnumerator(); - while ( myEnum8->MoveNext() ) - { - IPEndPoint^ e = safe_cast(myEnum8->Current); - Console::WriteLine( e ); - } -} -// - -int main() -{ - // - IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); - Console::WriteLine( "Computer name: {0}", properties->HostName ); - Console::WriteLine( "Domain name: {0}", properties->DomainName ); - Console::WriteLine( "Node type: {0:f}", properties->NodeType ); - Console::WriteLine( "DHCP scope: {0}", properties->DhcpScopeName ); - Console::WriteLine( "WINS proxy? {0}", properties->IsWinsProxy ); - // - - ShowActiveTcpConnections(); - ShowActiveTcpListeners(); - ShowActiveUdpListeners(); - if (Socket::SupportsIPv4) - { - ShowIcmpV4Statistics(); - } - if (Socket::OSSupportsIPv6) - { - ShowIcmpV6Statistics(); - } - ShowIPStatistics( NetworkInterfaceComponent::IPv4 ); - ShowTcpStatistics( NetworkInterfaceComponent::IPv4 ); - ShowUdpStatistics( NetworkInterfaceComponent::IPv4 ); - ShowEchoIcmpv4(properties->GetIcmpV4Statistics()); - ShowIcmpv4MessagesAndErrors(properties->GetIcmpV4Statistics()); - - if (Socket::OSSupportsIPv6) - { - ShowEchoIcmpv6(properties->GetIcmpV6Statistics()); - ShowIcmpv6MessagesAndErrors(properties->GetIcmpV6Statistics()); - } - - ShowNetworkInterfaces(); - ShowInterfaceSummary(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp deleted file mode 100644 index c3837c32960..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp +++ /dev/null @@ -1,140 +0,0 @@ - -#using - -using namespace System; -using namespace System::Net::NetworkInformation; -using namespace System::Collections; - -// -void DisplayAddressNone() -{ - PhysicalAddress^ none = PhysicalAddress::None; - Console::WriteLine( L"None: {0}", none ); - array^bytes = none->GetAddressBytes(); - System::Collections::IEnumerator^ myEnum = bytes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Byte b = safe_cast(myEnum->Current); - Console::Write( L"{0} ", b.ToString() ); - } - - Console::WriteLine(); -} - - -// -// -void ShowNetworkInterfaces() -{ - IPGlobalProperties^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - Console::WriteLine( L"Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName ); - if ( nics == nullptr || nics->Length < 1 ) - { - Console::WriteLine( L" No network interfaces found." ); - return; - } - - Console::WriteLine( L" Number of interfaces .................... : {0}", (nics->Length).ToString() ); - IEnumerator^ myEnum1 = nics->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - NetworkInterface^ adapter = safe_cast(myEnum1->Current); - IPInterfaceProperties^ properties = adapter->GetIPProperties(); - Console::WriteLine(); - Console::WriteLine( adapter->Description ); - Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); - Console::WriteLine( L" Interface type .......................... : {0}", adapter->NetworkInterfaceType ); - Console::Write( L" Physical address ........................ : " ); - PhysicalAddress^ address = adapter->GetPhysicalAddress(); - array^bytes = address->GetAddressBytes(); - for ( int i = 0; i < bytes->Length; i++ ) - { - - // Display the physical address in hexadecimal. - Console::Write( L"{0}", bytes[ i ].ToString( L"X2" ) ); - - // Insert a hyphen after each byte, unless we are at the end of the - // address. - if ( i != bytes->Length - 1 ) - { - Console::Write( L"-" ); - } - - } - Console::WriteLine(); - } -} - - -// -// -void ParseTest() -{ - PhysicalAddress^ address = PhysicalAddress::Parse( L"AC1EBA22" ); - Console::WriteLine( L"Address parsed as {0}", address->ToString() ); - PhysicalAddress^ address2 = PhysicalAddress::Parse( L"ac1eba22" ); - Console::WriteLine( L"Address2 parsed as {0}", address2->ToString() ); - bool test = address->Equals( address2 ); - Console::WriteLine( L"Equal? {0}", test ); -} - - -// -// -array^ StoreNetworkInterfaceAddresses() -{ - IPGlobalProperties^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); - array^nics = NetworkInterface::GetAllNetworkInterfaces(); - if ( nics == nullptr || nics->Length < 1 ) - { - Console::WriteLine( L" No network interfaces found." ); - return nullptr; - } - - array^ addresses = gcnew array(nics->Length); - int i = 0; - IEnumerator^ myEnum2 = nics->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - NetworkInterface^ adapter = safe_cast(myEnum2->Current); - IPInterfaceProperties^ properties = adapter->GetIPProperties(); - PhysicalAddress^ address = adapter->GetPhysicalAddress(); - array^bytes = address->GetAddressBytes(); - PhysicalAddress^ newAddress = gcnew PhysicalAddress( bytes ); - addresses[ i++ ] = newAddress; - } - - return addresses; -} - - -// -// -PhysicalAddress^ StrictParseAddress( String^ address ) -{ - PhysicalAddress^ newAddress = PhysicalAddress::Parse( address ); - if ( PhysicalAddress::None->Equals( newAddress ) ) - return nullptr; - - return newAddress; -} - - -// -int main() -{ - - DisplayAddressNone(); - ShowNetworkInterfaces(); - ParseTest(); - /* PhysicalAddress[] addresses = StoreNetworkInterfaceAddresses(); - foreach (PhysicalAddress address in addresses) - { - Console.WriteLine(address.ToString()); - } - */ - PhysicalAddress^ a = StrictParseAddress( nullptr ); - Console::WriteLine( a == nullptr ? L"null" : a->ToString() ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp deleted file mode 100644 index 845a8d231bd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp +++ /dev/null @@ -1,249 +0,0 @@ - - -//NCLPingSampler -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::NetworkInformation; -using namespace System::Text; -using namespace System::Threading; - -// -void SimplePing(); -void ComplexPing(); -void LocalPing(); -void ComplexLocalPing(); -void LocalPingTimeout(); -void AsyncComplexLocalPing(); -void PingCompletedCallback( Object^ sender, PingCompletedEventArgs^ e ); - -int main() -{ - -// SimplePing(); - LocalPing(); Console::WriteLine(); -// ComplexPing(); Console::WriteLine(); - ComplexLocalPing(); Console::WriteLine(); - AsyncComplexLocalPing(); -} - - -// -void SimplePing() -{ - Ping ^ pingSender = gcnew Ping; - PingReply ^ reply = pingSender->Send( "www.contoso.com" ); - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } - else - { - Console::WriteLine( reply->Status ); - } -} - - -// -// -void ComplexPing() -{ - Ping ^ pingSender = gcnew Ping; - - // Create a buffer of 32 bytes of data to be transmitted. - String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - array^buffer = Encoding::ASCII->GetBytes( data ); - - // Wait 10 seconds for a reply. - int timeout = 10000; - - // Set options for transmission: - // The data can go through 64 gateways or routers - // before it is destroyed, and the data packet - // cannot be fragmented. - PingOptions ^ options = gcnew PingOptions( 64,true ); - - // Send the request. - PingReply ^ reply = pingSender->Send( "www.contoso.com", timeout, buffer, options ); - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } - else - { - Console::WriteLine( reply->Status ); - } -} - - -// -// -void LocalPing() -{ - - // Ping's the local machine. - Ping ^ pingSender = gcnew Ping; - IPAddress^ address = IPAddress::Loopback; - PingReply ^ reply = pingSender->Send( address ); - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } - else - { - Console::WriteLine( reply->Status ); - } -} - - -// -// -void ComplexLocalPing() -{ - - // Ping's the local machine. - Ping ^ pingSender = gcnew Ping; - IPAddress^ address = IPAddress::Loopback; - - // Create a buffer of 32 bytes of data to be transmitted. - String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - array^buffer = Encoding::ASCII->GetBytes( data ); - - // Wait 10 seconds for a reply. - int timeout = 10000; - - // Set options for transmission: - // The data can go through 64 gateways or routers - // before it is destroyed, and the data packet - // cannot be fragmented. - PingOptions ^ options = gcnew PingOptions( 64,true ); - PingReply ^ reply = pingSender->Send( address, timeout, buffer, options ); - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } - else - { - Console::WriteLine( reply->Status ); - } -} - - -// -// -void LocalPingTimeout() -{ - - // Ping's the local machine. - Ping ^ pingSender = gcnew Ping; - IPAddress^ address = IPAddress::Loopback; - - // Create a buffer of 32 bytes of data to be transmitted. - String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - array^buffer = Encoding::ASCII->GetBytes( data ); - - // Wait 10 seconds for a reply. - int timeout = 10000; - PingReply ^ reply = pingSender->Send( address, timeout, buffer); - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } - else - { - Console::WriteLine( reply->Status ); - } -} - - -// -// -void AsyncComplexLocalPing() -{ - - // Get an object that will block the main thread. - AutoResetEvent^ waiter = gcnew AutoResetEvent( false ); - - // Ping's the local machine. - Ping ^ pingSender = gcnew Ping; - - // When the PingCompleted event is raised, - // the PingCompletedCallback method is called. - pingSender->PingCompleted += gcnew PingCompletedEventHandler( PingCompletedCallback ); - IPAddress^ address = IPAddress::Loopback; - - // Create a buffer of 32 bytes of data to be transmitted. - String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - array^buffer = Encoding::ASCII->GetBytes( data ); - - // Wait 10 seconds for a reply. - int timeout = 10000; - - // Set options for transmission: - // The data can go through 64 gateways or routers - // before it is destroyed, and the data packet - // cannot be fragmented. - PingOptions ^ options = gcnew PingOptions( 64,true ); - - // Send the ping asynchronously. - // Use the waiter as the user token. - // When the callback completes, it can wake up this thread. - pingSender->SendAsync( address, timeout, buffer, options, waiter ); - - // Prevent this example application from ending. - // A real application should do something useful - // when possible. - waiter->WaitOne(); - Console::WriteLine( "Ping example completed." ); -} - - -// -// -void PingCompletedCallback( Object^ /*sender*/, PingCompletedEventArgs^ e ) -{ - - // If the operation was canceled, display a message to the user. - if ( e->Cancelled ) - { - Console::WriteLine( "Ping canceled." ); - } - - - // If an error occurred, display the exception to the user. - if ( e->Error != nullptr ) - { - Console::WriteLine( "Ping failed:" ); - Console::WriteLine( e->Error->ToString() ); - } - - PingReply ^ reply = e->Reply; - Console::WriteLine( reply->Status ); - - // Let the main thread resume. - (dynamic_cast(e->UserState))->Set(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp deleted file mode 100644 index d4bf6281427..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -// SampleID="NCLResponse1" -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -using namespace System::IO; - -// Specify the URL to receive the request. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - HttpWebRequest^ request = dynamic_cast(WebRequest::Create(args[1])); - - // Set some reasonable limits on resources used by this request - request->MaximumAutomaticRedirections = 4; - request->MaximumResponseHeadersLength = 4; - - // Set credentials to use for this request. - request->Credentials = CredentialCache::DefaultCredentials; - HttpWebResponse^ response = dynamic_cast(request->GetResponse()); - Console::WriteLine("Content length is {0}", response->ContentLength); - Console::WriteLine("Content type is {0}", response->ContentType); - - // Get the stream associated with the response. - Stream^ receiveStream = response->GetResponseStream(); - - // Pipes the stream to a higher level stream reader with the required encoding format. - StreamReader^ readStream = gcnew StreamReader(receiveStream, Encoding::UTF8); - Console::WriteLine("Response stream received."); - Console::WriteLine(readStream->ReadToEnd()); - response->Close(); - readStream->Close(); -} - -/* -The output from this example will vary depending on the value passed into Main -but will be similar to the following: - -Content length is 1542 -Content type is text/html; charset=utf-8 -Response stream received. - -... - - -*/ -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp deleted file mode 100644 index d9632b38b2c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp +++ /dev/null @@ -1,88 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::IO; -using namespace System::Threading; - -namespace SystemNetExamples -{ - public ref class ServicePointExample - { - public: - - // Pass in the name of the Web page to retrieve. - static void PrintResponse(String^ page) - { - - // Create the request. - HttpWebRequest^ request; - Uri^ uri; - - - - try - { - uri = gcnew Uri(page); - } - catch (UriFormatException^ ex) - { - Console::WriteLine(ex->Message); - } - - request = (HttpWebRequest^) WebRequest::Create(uri); - - // Get the service point that handles the request's - // socket connection. - ServicePoint^ point = request->ServicePoint; - - // Set the receive buffer size on the underlying socket. - point->ReceiveBufferSize = 2048; - - // Set the connection lease timeout to infinite. - point->ConnectionLeaseTimeout = Timeout::Infinite; - - // Send the request. - HttpWebResponse^ response = - (HttpWebResponse^) request->GetResponse(); - Stream^ responseStream = response->GetResponseStream(); - StreamReader^ streamReader = - gcnew StreamReader(responseStream); - try - { - // Display the response. - Console::WriteLine(streamReader->ReadToEnd()); - responseStream->Close(); - response->Close(); - } - finally - { - streamReader->Close(); - } - } - }; -} - -// - -using namespace SystemNetExamples; - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - String^ page; - - if ((args == nullptr)||(args->Length < 2)||(args[1]->Length == 0)) - { - page = "http://www.contoso.com/default.html"; - } - else - { - page = args[1]; - } - ServicePointExample::PrintResponse(page); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp deleted file mode 100644 index 0c201db6c1c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp +++ /dev/null @@ -1,274 +0,0 @@ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Cache; -using namespace System::IO; -using namespace System::Text; -using namespace System::Collections::Specialized; -using namespace System::Collections; - -public ref class CacheExample -{ -public: - - // - static WebResponse^ GetResponseUsingDefaultCache( Uri^ uri ) - { - // Set a cache policy level for the "http:" scheme. - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::Default ); - - // Create the request. - WebRequest^ request = WebRequest::Create( uri ); - request->CachePolicy = policy; - WebResponse^ response = request->GetResponse(); - Console::WriteLine( L"Policy {0}.", policy ); - Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); - return response; - } - // - - // - // The following method demonstrates overriding the - // caching policy for a request. - static WebResponse^ GetResponseNoCache( Uri^ uri ) - { - // Set a default policy level for the "http:" and "https" schemes. - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::Default ); - HttpWebRequest::DefaultCachePolicy = policy; - - // Create the request. - WebRequest^ request = WebRequest::Create( uri ); - - // Define a cache policy for this request only. - HttpRequestCachePolicy^ noCachePolicy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::NoCacheNoStore ); - request->CachePolicy = noCachePolicy; - WebResponse^ response = request->GetResponse(); - Console::WriteLine( L"IsFromCache? {0}", response->IsFromCache ); - - return response; - } - // - - // - static HttpRequestCachePolicy^ CreateLastSyncPolicy( DateTime when ) - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( when ); - Console::WriteLine( L"When: {0}", when ); - Console::WriteLine( policy->CacheSyncDate ); - return policy; - } - // - - // - static void DisplayPolicyDetails( HttpRequestCachePolicy^ policy ) - { - Console::WriteLine( L"Synchronize date: {0}", policy->CacheSyncDate ); - Console::WriteLine( L"Max age: {0}", policy->MaxAge ); - Console::WriteLine( L"Max stale: {0}", policy->MaxStale ); - Console::WriteLine( L"Min fresh: {0}", policy->MinFresh ); - } - // - - // - static HttpRequestCachePolicy^ CreateMinFreshPolicy( TimeSpan span ) - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MinFresh,span ); - Console::WriteLine( L"Minimum freshness {0}", policy->MinFresh ); - return policy; - } - // - - // - static HttpRequestCachePolicy^ CreateMaxStalePolicy( TimeSpan span ) - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxStale,span ); - Console::WriteLine( L"Max stale is {0}", policy->MaxStale ); - return policy; - } - // - - // - static HttpRequestCachePolicy^ CreateMaxAgePolicy( TimeSpan span ) - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAge,span ); - Console::WriteLine( L"Max age is {0}", policy->MaxAge ); - return policy; - } - // - - // - static HttpRequestCachePolicy^ CreateDefaultPolicy() - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy; - Console::WriteLine( policy ); - return policy; - } - // - - // - static HttpRequestCachePolicy^ CreateFreshAndAgePolicy( TimeSpan freshMinimum, TimeSpan ageMaximum ) - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAgeAndMinFresh, - ageMaximum, freshMinimum ); - Console::WriteLine( policy ); - return policy; - } - // - - // - static HttpRequestCachePolicy^ CreateFreshAndAgePolicy2( TimeSpan freshMinimum, TimeSpan ageMaximum, DateTime when ) - { - HttpRequestCachePolicy^ policy = - gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAgeAndMinFresh, - ageMaximum, freshMinimum, when ); - Console::WriteLine( policy ); - return policy; - - // For the following invocation: CreateFreshAndAgePolicy(new TimeSpan(5,0,0), new TimeSpan(10,0,0), ); - // the output is: - // Level:Automatic AgeControl:MinFreshAndMaxAge MinFresh:18000 MaxAge:36000 - } - // - - // - static WebResponse^ GetResponseUsingCacheDefault( Uri^ uri ) - { - // Set the default cache policy level for the "http:" scheme. - RequestCachePolicy^ policy = gcnew RequestCachePolicy; - - // Create the request. - WebRequest^ request = WebRequest::Create( uri ); - request->CachePolicy = policy; - WebResponse^ response = request->GetResponse(); - Console::WriteLine( L"Policy level is {0}.", policy->Level ); - Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); - return response; - } - // - - // - static HttpRequestCachePolicy^ CreateCacheIfAvailablePolicy() - { - HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::CacheIfAvailable ); - Console::WriteLine( policy ); - return policy; - } - // - - // - static WebResponse^ GetResponseFromCache( Uri^ uri ) - { - RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::CacheOnly ); - WebRequest^ request = WebRequest::Create( uri ); - request->CachePolicy = policy; - WebResponse^ response = request->GetResponse(); - Console::WriteLine( L"Policy level is {0}.", policy->Level ); - Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); - return response; - } - // - - // - static WebResponse^ GetResponseFromServer( Uri^ uri ) - { - RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::NoCacheNoStore ); - WebRequest^ request = WebRequest::Create( uri ); - request->CachePolicy = policy; - WebResponse^ response = request->GetResponse(); - Console::WriteLine( L"Policy is {0}.", policy ); - Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); - return response; - } - // - - // - static WebResponse^ GetResponseFromServer2( Uri^ uri ) - { - RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::NoCacheNoStore ); - WebRequest^ request = WebRequest::Create( uri ); - WebRequest::DefaultCachePolicy = policy; - WebResponse^ response = request->GetResponse(); - Console::WriteLine( L"Policy is {0}.", policy ); - Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); - return response; - } - // - - void TestSimpleCache() - { - /* WebResponse response = GetResponseUsingDefaultCache (new Uri("http://www.example.com")); - DisplayResponseStream (response); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - response = GetResponseNoCache (new Uri("http://www.example.com")); - DisplayResponseStream (response); - - DisplayPolicyDetails(CreateLastSyncPolicy(DateTime.Now)); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - DisplayPolicyDetails(CreateMinFreshPolicy(new TimeSpan(10,0,0))); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - DisplayPolicyDetails(CreateMaxStalePolicy(new TimeSpan(1,10,0))); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - DisplayPolicyDetails(CreateMaxAgePolicy(new TimeSpan(10,0,0))); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - DisplayPolicyDetails(CreateDefaultPolicy()); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - DisplayPolicyDetails(CreateFreshAndAgePolicy(new TimeSpan(5,0,0), new TimeSpan(10,0,0))); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - DisplayPolicyDetails(CreateFreshAndAgePolicy2(new TimeSpan(5,0,0), new TimeSpan(10,0,0), DateTime.Now)); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - response = GetResponseUsingCacheDefault (new Uri("http://www.example.com")); - DisplayResponseStream (response); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - - DisplayPolicyDetails(CreateCacheIfAvailablePolicy()); - - response = GetResponseFromCache (new Uri("http://www.example.com")); - DisplayResponseStream (response); - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - response = GetResponseFromServer (new Uri("http://www.example.com")); - DisplayResponseStream (response); - - Console.WriteLine("hit enter for next test..."); Console.ReadLine(); - */ - WebResponse^ response = GetResponseFromServer2( gcnew Uri( L"http://www.example.com" ) ); - DisplayResponseStream( response ); - Console::WriteLine( L"done." ); - } - - static void DisplayResponseStream( WebResponse^ response ) - { - Stream^ stream = response->GetResponseStream(); - while ( true ) - { - array^buffer = gcnew array(1024); - int read = stream->Read( buffer, 0, buffer->Length ); - if ( read == 0 ) - { - stream->Close(); - break; - } - else - { - Console::Write( Encoding::UTF8->GetString( buffer ) ); - } - } - - stream->Close(); - } - -}; - -void main() -{ - CacheExample^ ce = gcnew CacheExample; - ce->TestSimpleCache(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp deleted file mode 100644 index cc3ba9554a1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp +++ /dev/null @@ -1,713 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -/***************************** -commented out contents of snippets 1,2,8 becuase this is not legal cpp. -the use of jagged arrays is not supprted and these throw a compiler error. - -*******************************/ -// State object for reading client data asynchronously -private ref class StateObject -{ -public private: - - // Client socket. - Socket^ workSocket; - - // Size of receive buffer. - literal int BufferSize = 1024; - - // Receive buffer. - array^buffer; - - // Received data string. - StringBuilder^ sb; - -public: - StateObject() - { - workSocket = nullptr; - buffer = gcnew array(BufferSize); - sb = gcnew StringBuilder; - } - -}; - -public ref class Test -{ -public: - - // Incoming data from client. - static String^ data = nullptr; - -private: - - // ManualResetEvent instances signal completion. - static ManualResetEvent^ connectDone = gcnew ManualResetEvent( false ); - static ManualResetEvent^ sendDone = gcnew ManualResetEvent( false ); - static ManualResetEvent^ receiveDone = gcnew ManualResetEvent( false ); - static ManualResetEvent^ disconnectDone = gcnew ManualResetEvent( false ); - - // The response from the remote device. - static String^ response = String::Empty; - -public: - - // Thread signal. - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - static void Main() - { - array^args = Environment::GetCommandLineArgs(); - Console::WriteLine( "{0}", args ); - if ( args[ 1 ]->Equals( "as" ) ) - { - - // Start the asynchronous server. - Console::WriteLine( "the asychronous server" ); - AsynchronousServer(); - } - else - if ( args[ 1 ]->Equals( "ac" ) ) - { - - // Start the asynchronous client. - Console::WriteLine( "the asynchronous client" ); - AsynchronousClient(); - } - else - if ( args[ 1 ]->Equals( "ss" ) ) - { - - // Start the synchronous server. - Console::WriteLine( "the sychronous server" ); - SynchronousServer(); - } - else - if ( args[ 1 ]->Equals( "sc" ) ) - { - - // Start the synchronous client. - Console::WriteLine( "the synchronous client" ); - SynchronousClient(); - } - else - { - Console::WriteLine( "default" ); - } - } - - static void AsynchronousServer() - { - - // This server waits for a connection and then uses asychronous operations to - // accept the connection, get data from the connected client, - // echo that data back to the connected client. - // It then disconnects from the client and waits for another client. - Listen(); - - // ListenWithSocket(); - } - - static void Listen() - { - // This server waits for a connection and then uses asynchronous operations to - // accept the connection with initial data sent from the client. - // Establish the local endpoint for the socket. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - IPEndPoint^ localEndPoint = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - Socket^ listener = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Bind the socket to the local endpoint, and listen for incoming connections. - listener->Bind( localEndPoint ); - listener->Listen( 100 ); - for ( ; ; ) - { - - // Set the event to nonsignaled state. - allDone->Reset(); - - // Start an asynchronous socket to listen for connections and receive data from the client. - Console::WriteLine( "Waiting for a connection..." ); - - // Accept the connection and receive the first 10 bytes of data. - int receivedDataSize = 10; - listener->BeginAccept( receivedDataSize, gcnew AsyncCallback( AcceptReceiveCallback ), listener ); - - // Wait until a connection is made and processed before continuing. - allDone->WaitOne(); - - } - } - - static void AcceptReceiveCallback( IAsyncResult^ ar ) - { - // Get the socket that handles the client request. - Socket^ listener = dynamic_cast(ar->AsyncState); - - // End the operation and display the received data on the console. - array^Buffer; - int bytesTransferred; - Socket^ handler = listener->EndAccept( Buffer, bytesTransferred, ar ); - String^ stringTransferred = Encoding::ASCII->GetString( Buffer, 0, bytesTransferred ); - Console::WriteLine( stringTransferred ); - Console::WriteLine( "Size of data transferred is {0}", bytesTransferred ); - - // Create the state object for the asynchronous receive. - StateObject^ state = gcnew StateObject; - state->workSocket = handler; - handler->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReadCallback ), state ); - } - static void ListenWithSocket() - { - // This server waits for a connection and then uses asynchronous operations to - // accept the connection with initial data sent from the client. - // Establish the local endpoint for the socket. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - IPEndPoint^ localEndPoint = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - Socket^ listener = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Bind the socket to the local endpoint, and listen for incoming connections. - listener->Bind( localEndPoint ); - listener->Listen( 100 ); - for ( ; ; ) - { - // Set the event to nonsignaled state. - allDone->Reset(); - - // Start an asynchronous socket to listen for connections and receive data from the client. - Console::WriteLine( "Waiting for a connection..." ); - - // Accept the connection and receive the first 10 bytes of data. - // BeginAccept() creates the accepted socket. - int receivedDataSize = 10; - listener->BeginAccept( nullptr, receivedDataSize, gcnew AsyncCallback( AcceptReceiveDataCallback ), listener ); - - // Wait until a connection is made and processed before continuing. - allDone->WaitOne(); - } - } - - static void AcceptReceiveDataCallback( IAsyncResult^ ar ) - { - // Get the socket that handles the client request. - Socket^ listener = dynamic_cast(ar->AsyncState); - - // End the operation and display the received data on the console. - array^Buffer; - int bytesTransferred; - Socket^ handler = listener->EndAccept( Buffer, bytesTransferred, ar ); - String^ stringTransferred = Encoding::ASCII->GetString( Buffer, 0, bytesTransferred ); - Console::WriteLine( stringTransferred ); - Console::WriteLine( "Size of data transferred is {0}", bytesTransferred ); - - // Create the state object for the asynchronous receive. - StateObject^ state = gcnew StateObject; - state->workSocket = handler; - handler->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReadCallback ), state ); - } - - static void ReadCallback( IAsyncResult^ ar ) - { - String^ content = String::Empty; - - // Retrieve the state object and the handler socket - // from the asynchronous state object. - StateObject^ state = dynamic_cast(ar->AsyncState); - Socket^ handler = state->workSocket; - - // Read data from the client socket. - int bytesRead = handler->EndReceive( ar ); - if ( bytesRead > 0 ) - { - // There might be more data, so store the data received so far. - state->sb->Append( Encoding::ASCII->GetString( state->buffer, 0, bytesRead ) ); - - // Check for end-of-file tag. If it is not there, read - // more data. - content = state->sb->ToString(); - if ( content->IndexOf( "" ) > -1 ) - { - // All the data has been read from the - // client. Display it on the console. - Console::WriteLine( "Read {0} bytes from socket. Data : {1}", content->Length, content ); - - // Echo the data back to the client. - Send( handler, content ); - } - else - { - // Not all data received. Get more. - handler->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReadCallback ), state ); - } - } - } - - -private: - static void Send( Socket^ handler, String^ data ) - { - // Convert the string data to byte data using ASCII encoding. - array^byteData = Encoding::ASCII->GetBytes( data ); - - // Begin sending the data to the remote device. - handler->BeginSend( byteData, 0, byteData->Length, static_cast(0), gcnew AsyncCallback( SendCallback ), handler ); - } - - static void SendCallback( IAsyncResult^ ar ) - { - // Retrieve the socket from the state object. - Socket^ handler = dynamic_cast(ar->AsyncState); - - // Complete sending the data to the remote device. - int bytesSent = handler->EndSend( ar ); - Console::WriteLine( "Sent {0} bytes to client.", bytesSent ); - handler->Shutdown( SocketShutdown::Both ); - handler->Close(); - - // Signal the main thread to continue. - allDone->Set(); - } - -public: - static void AsynchronousClient() - { - // The following methods set up a socket and demonstrate the use of a new Sockets method. - // Send multiple buffers to remote device. - // AsynchronousSendBuffers(); - // Send a file to the remote host. - // AsynchronousFileSend(); - // Send a file with pre and post buffers. - // AsynchronousFileSendWithBuffers(); - // Show use of Begin/EndDisconnect - ClientDisconnect(); - } - - -private: - static void ClientSendCallback( IAsyncResult^ ar ) - { - // Retrieve the socket from the state object. - Socket^ client = dynamic_cast(ar->AsyncState); - - // Complete sending the data to the remote device. - int bytesSent = client->EndSend( ar ); - - // Write to the console the number of bytes sent. - Console::WriteLine( "Sent {0} bytes to server.", bytesSent ); - - // Signal that all bytes have been sent. - sendDone->Set(); - } - - -public: - - static void AsynchronousFileSend() - { - // Send a file to a remote device. - // Establish the remote endpoint for the socket. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect to the remote endpoint. - client->BeginConnect( remoteEP, gcnew AsyncCallback( ConnectCallback ), client ); - - // Wait for connect. - connectDone->WaitOne(); - - // There is a text file test.txt in the root directory. - String^ fileName = "C:\\test.txt"; - - // Send file fileName to the remote device. - Console::WriteLine( fileName ); - client->BeginSendFile( fileName, gcnew AsyncCallback( FileSendCallback ), client ); - - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->Close(); - } - -private: - static void FileSendCallback( IAsyncResult^ ar ) - { - // Retrieve the socket from the state object. - Socket^ client = dynamic_cast(ar->AsyncState); - - // Complete sending the data to the remote device. - client->EndSendFile( ar ); - sendDone->Set(); - } - -public: - static void AsynchronousFileSendWithBuffers() - { - // Send a file asynchronously to the remote device. Send a buffer before the file and a buffer afterwards. - // Establish the remote endpoint for the socket. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect to the remote endpoint. - client->BeginConnect( remoteEP, gcnew AsyncCallback( ConnectCallback ), client ); - - // Wait for connect. - connectDone->WaitOne(); - - // Send a file fileName to the remote device with preBuffer and postBuffer data. - // Create the preBuffer data. - String^ string1 = String::Format( "This is text data that precedes the file.{0}", Environment::NewLine ); - array^preBuf = Encoding::ASCII->GetBytes( string1 ); - - // Create the postBuffer data. - String^ string2 = String::Format( "This is text data that will follow the file.{0}", Environment::NewLine ); - array^postBuf = Encoding::ASCII->GetBytes( string2 ); - - // There is a file test.txt in the root directory. - String^ fileName = "C:\\test.txt"; - - //Send file fileName with buffers and default flags to the remote device. - Console::WriteLine( fileName ); - client->BeginSendFile( fileName, preBuf, postBuf, static_cast(0), gcnew AsyncCallback( AsynchronousFileSendCallback ), client ); - - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->Close(); - } - - -private: - static void AsynchronousFileSendCallback( IAsyncResult^ ar ) - { - // Retrieve the socket from the state object. - Socket^ client = dynamic_cast(ar->AsyncState); - - // Complete sending the data to the remote device. - client->EndSendFile( ar ); - sendDone->Set(); - } - - static void ConnectCallback( IAsyncResult^ ar ) - { - // Retrieve the socket from the state object. - Socket^ client = dynamic_cast(ar->AsyncState); - - // Complete the connection. - client->EndConnect( ar ); - Console::WriteLine( "Socket connected to {0}", client->RemoteEndPoint ); - - // Signal that the connection has been made. - connectDone->Set(); - } - - static void Receive( Socket^ client ) - { - // Create the state object. - StateObject^ state = gcnew StateObject; - state->workSocket = client; - - // Begin receiving the data from the remote device. - client->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReceiveCallback ), state ); - } - - static void ReceiveCallback( IAsyncResult^ ar ) - { - // Retrieve the state object and the client socket - // from the asynchronous state object. - StateObject^ state = dynamic_cast(ar->AsyncState); - Socket^ client = state->workSocket; - - // Read data from the remote device. - int bytesRead = client->EndReceive( ar ); - if ( bytesRead > 0 ) - { - // There might be more data, so store the data received so far. - state->sb->Append( Encoding::ASCII->GetString( state->buffer, 0, bytesRead ) ); - - // Get the rest of the data. - client->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReceiveCallback ), state ); - } - else - { - // All the data has arrived; put it in response. - if ( state->sb->Length > 1 ) - { - response = state->sb->ToString(); - } - - // Signal that all bytes have been received. - receiveDone->Set(); - } - } - - -public: - static void ClientDisconnect() - { - // Establish the remote endpoint for the socket. - // For this example use local computer. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect to the remote endpoint. - client->BeginConnect( remoteEP, gcnew AsyncCallback( ConnectCallback ), client ); - - // Wait for connect. - connectDone->WaitOne(); - - // Send some data to the remote device. - String^ data = "This is a string of data "; - array^buffer = Encoding::ASCII->GetBytes( data ); - client->BeginSend( buffer, 0, buffer->Length, static_cast(0), gcnew AsyncCallback( ClientSendCallback ), client ); - - // Wait for send done. - sendDone->WaitOne(); - - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->BeginDisconnect( true, gcnew AsyncCallback( DisconnectCallback ), client ); - - // Wait for the disconnect to complete. - disconnectDone->WaitOne(); - if ( client->Connected ) - Console::WriteLine( "We're still connected" ); - else - Console::WriteLine( "We're disconnected" ); - } - -private: - static void DisconnectCallback( IAsyncResult^ ar ) - { - // Complete the disconnect request. - Socket^ client = dynamic_cast(ar->AsyncState); - client->EndDisconnect( ar ); - - // Signal that the disconnect is complete. - disconnectDone->Set(); - } - -public: - - static void SynchronousServer() - { - // Establish the local endpoint for the socket. - IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); - - // For the purposes of this example, we will send and - // receive on the same machine. - // - Socket^ listener = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Bind to the local endpoint and listen to the incoming sockets. - listener->Bind( ipEndPoint ); - listener->Listen( 10 ); - for ( ; ; ) - { - Console::WriteLine( "Waiting for a connection..." ); - Socket^ handler = listener->Accept(); - String^ data = nullptr; - - // A client is connecting. - for ( ; ; ) - { - array^bytes = gcnew array(1024); - int bytesReceived = handler->Receive( bytes ); - data = String::Concat( data, Encoding::ASCII->GetString( bytes, 0, bytesReceived ) ); - if ( data->IndexOf( "" ) > -1 ) - { - break; - } - } - - // All the data has been read from the client. - // Display it on the console. - Console::WriteLine( "Read {0} bytes from socket. Data : {1}", data->Length, data ); - - // Echo the data back to the client. - //Send(handler, content); - handler->Send( Encoding::ASCII->GetBytes( data ) ); - handler->Shutdown( SocketShutdown::Both ); - handler->Close(); - } - } - - static void SynchronousClient() - { - // The following methods set up a socket and demonstrate the use of a new Sockets method. - // Set the socket options - // SetSocketOptions(); - // Send multiple buffers to remote device. - // SendMultiBuffers(); - // Send multiple buffers with socket flags - // SendMultiBuffersWithFlags(); - // Send a file to the remote host. - // FileSend(); - // Send a file with pre and post buffers - // FileSendWithBuffers(); - // Show synchronous disconnect - SynchronousDisconnect(); - } - -private: - static void SetSocketOptions() - { - // - // Establish the local endpoint for the socket. - IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); - - // Create a TCP socket. - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect the socket to the remote endpoint. - client->Connect( ipEndPoint ); - - // Set option that allows socket to close gracefully without lingering. - client->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::DontLinger, true ); - - // Set option that allows socket to receive out-of-band information in the data stream. - client->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::OutOfBandInline, true ); - - // - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->Close(); - } - - static void FileSend() - { - // - // Establish the local endpoint for the socket. - IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); - - // Create a TCP socket. - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect the socket to the remote endpoint. - client->Connect( ipEndPoint ); - - // There is a text file test.txt located in the root directory. - String^ fileName = "C:\\test.txt"; - - // Send file fileName to remote device - Console::WriteLine( "Sending {0} to the host.", fileName ); - client->SendFile( fileName ); - - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->Close(); - // - } - - static void FileSendWithBuffers() - { - // - // Establish the local endpoint for the socket. - IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); - - // Create a TCP socket. - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect the socket to the remote endpoint. - client->Connect( ipEndPoint ); - - // Send file fileName to the remote host with preBuffer and postBuffer data. - // There is a text file test.txt located in the root directory. - String^ fileName = "C:\\test.txt"; - - // Create the preBuffer data. - String^ string1 = String::Format( "This is text data that precedes the file.{0}", Environment::NewLine ); - array^preBuf = Encoding::ASCII->GetBytes( string1 ); - - // Create the postBuffer data. - String^ string2 = String::Format( "This is text data that will follow the file.{0}", Environment::NewLine ); - array^postBuf = Encoding::ASCII->GetBytes( string2 ); - - //Send file fileName with buffers and default flags to the remote device. - Console::WriteLine( "Sending {0} with buffers to the host.{1}", fileName, Environment::NewLine ); - client->SendFile( fileName, preBuf, postBuf, TransmitFileOptions::UseDefaultWorkerThread ); - - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->Close(); - // - } - -public: - static void SynchronousDisconnect() - { - // - IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; - IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); - Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // Connect the socket to the remote end point. - client->Connect( ipEndPoint ); - - // Send some data to the remote device. - String^ data = "This is a string of data "; - array^buffer = Encoding::ASCII->GetBytes( data ); - int bytesTransferred = client->Send( buffer ); - - // Write to the console the number of bytes transferred. - Console::WriteLine( "{0} bytes were sent.\n", bytesTransferred ); - - // Release the socket. - client->Shutdown( SocketShutdown::Both ); - client->Disconnect( true ); - if ( client->Connected ) - Console::WriteLine( "We're still connnected" ); - else - Console::WriteLine( "We're disconnected" ); - // - } -}; - -int main() -{ - Test::Main(); -} - -/* -The output from this example will vary depending on the value passed into Main -but will be similar to the following: - -Content length is 1542 -Content type is text/html; charset=utf-8 -Response stream received. - -... - - -*/ diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp deleted file mode 100644 index 41bffbe3ab7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -// -// FIONREAD is also available as the "Available" property. -const int FIONREAD = 0x4004667F; - -void DisplayPendingByteCount( Socket^ s ) -{ - array^ outValue = BitConverter::GetBytes( 0 ); - - // Check how many bytes have been received. - s->IOControl( FIONREAD, nullptr, outValue ); - - UInt32 bytesAvailable = BitConverter::ToUInt32( outValue, 0 ); - Console::WriteLine( "server has {0} bytes pending. Available property says {1}.", - bytesAvailable, s->Available ); - - return; -} -// - -int main() -{ - IPHostEntry^ localHost = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( localHost->AddressList[ 0 ], 11000 ); - - // For the purposes of this example, we will send and - // receive on the same machine. - // - Socket^ s = gcnew Socket( AddressFamily::InterNetwork, - SocketType::Stream, - ProtocolType::Tcp ); - s->Bind( endPoint ); - - s->Listen( 1 ); - Console::WriteLine( "Waiting to receive messages from client..." ); - Socket^ client = s->Accept(); - - // Creates a byte buffer to receive the message. - array^ buffer = gcnew array(256); - String^ message; - - for ( ; ; ) - { - Thread::Sleep( 10000 ); - DisplayPendingByteCount( client ); - client->Receive( buffer ); - message = Encoding::UTF8->GetString( buffer ); - - // Displays the information received to the screen - Console::WriteLine( " Server received the following message : {0}", - message ); - - // Look for "" to end session. - if ( message->IndexOf( "" ) != -1 ) - { - break; - } - } - client->Close(); - s->Close(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp deleted file mode 100644 index b3fabcf3081..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -// -void DisplayPendingByteCount( Socket^ s ) -{ - array^ outValue = BitConverter::GetBytes( 0 ); - - // Check how many bytes have been received. - s->IOControl( IOControlCode::DataToRead, nullptr, outValue ); - - UInt32 bytesAvailable = BitConverter::ToUInt32( outValue, 0 ); - Console::Write( "server has {0} bytes pending,", - bytesAvailable ); - Console::WriteLine( "Available property says {1}.", - s->Available ); - return; -} -// - -int main() -{ - IPHostEntry^ localHost = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( - localHost->AddressList[ 0 ],11000 ); - - // For the purposes of this example, we will send and - // receive on the same machine. - // - Socket^ s = gcnew Socket( AddressFamily::InterNetwork, - SocketType::Stream, - ProtocolType::Tcp ); - - s->Bind( endPoint ); - - s->Listen( 1 ); - Console::WriteLine( - "Waiting to receive messages from client.." ); - Socket^ client = s->Accept(); - - // Creates a byte buffer to receive the message. - array^ buffer = gcnew array(256); - String^ message; - - for ( ; ; ) - { - Thread::Sleep( 10000 ); - DisplayPendingByteCount( client ); - client->Receive( buffer ); - message = Encoding::UTF8->GetString( buffer ); - - // Displays the information received to the screen - Console::WriteLine( - " Server received the following message: {0}", - message ); - - // Look for "" to end session. - if ( message->IndexOf( "" ) != -1 ) - { - break; - } - } - client->Close(); - s->Close(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp deleted file mode 100644 index 3a204ecc032..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; -int main() -{ - - // Create a client that will connect to a - // server listening on the contoso1 computer - // at port 11000. - TcpClient^ tcpClient = gcnew TcpClient; - tcpClient->Connect( "contosoServer", 11000 ); - - // Get the stream used to read the message sent by the server. - NetworkStream^ networkStream = tcpClient->GetStream(); - - // Set a 10 millisecond timeout for reading. - networkStream->ReadTimeout = 10; - - // Read the server message into a byte buffer. - array^bytes = gcnew array(1024); - networkStream->Read( bytes, 0, 1024 ); - - //Convert the server's message into a string and display it. - String^ data = Encoding::UTF8->GetString( bytes ); - Console::WriteLine( "Server sent message: {0}", data ); - networkStream->Close(); - tcpClient->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp deleted file mode 100644 index 7dc16c6e6be..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp +++ /dev/null @@ -1,150 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -using namespace System::Threading; - -// TryCreate -void SampleTryCreate() -{ - // - // String to parse. - String^ addressString = "catalog/shownew.htm?date=today"; - - // Parse the string and create a new Uri instance, if possible. - Uri^ result; - if ( Uri::TryCreate( addressString, UriKind::RelativeOrAbsolute, result ) ) - { - // The call was successful. Write the URI address to the console. - Console::Write( result ); - - // Check whether new Uri instance is absolute or relative. - if ( result->IsAbsoluteUri ) - Console::WriteLine( " is an absolute Uri." ); - else - Console::WriteLine( " is a relative Uri." ); - } - else - { - // Let the user know that the call failed. - Console::WriteLine( "addressString could not be parsed as a URI address." ); - } - // -} - -// Constructor -void SampleConstructor() -{ - // - // Create an absolute Uri from a string. - String^ addressString1 = "http://www.contoso.com/"; - String^ addressString2 = "catalog/shownew.htm?date=today"; - Uri^ absoluteUri = gcnew Uri(addressString1); - - // Create a relative Uri from a string. allowRelative = true to allow for - // creating a relative Uri. - Uri^ relativeUri = gcnew Uri(addressString2); - - // Check whether the new Uri is absolute or relative. - if ( !relativeUri->IsAbsoluteUri ) - Console::WriteLine( "{0} is a relative Uri.", relativeUri ); - - // Create a new Uri from an absolute Uri and a relative Uri. - Uri^ combinedUri = gcnew Uri( absoluteUri,relativeUri ); - Console::WriteLine( combinedUri->AbsoluteUri ); - // -} - -// OriginalString -void SampleOriginalString() -{ - // - // Create a new Uri from a string address. - Uri^ uriAddress = gcnew Uri( "HTTP://www.ConToso.com:80//thick%20and%20thin.htm" ); - - // Write the new Uri to the console and note the difference in the two values. - // ToString() gives the canonical version. OriginalString gives the original - // string that was passed to the constructor. - // The following outputs "http://www.contoso.com//thick and thin.htm". - Console::WriteLine( uriAddress ); - - // The following outputs "HTTP://www.ConToso.com:80//thick%20and%20thin.htm". - Console::WriteLine( uriAddress->OriginalString ); - // -} - - -// DNSSafeHost -void SampleDNSSafeHost() -{ - // - // Create new Uri using a string address. - Uri^ address = gcnew Uri( "http://[fe80::200:39ff:fe36:1a2d%254]/temp/example.htm" ); - - // Make the address DNS safe. - // The following outputs "[fe80::200:39ff:fe36:1a2d]". - Console::WriteLine( address->Host ); - - // The following outputs "fe80::200:39ff:fe36:1a2d%254". - Console::WriteLine( address->DnsSafeHost ); - // -} - -// operator == and !== -void SampleOperatorEqual() -{ - // - // Create some Uris. - Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); - Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" ); - Uri^ address3 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); - - // The first two are equal because the fragment is ignored. - if ( address1 == address2 ) - Console::WriteLine( "{0} is equal to {1}", address1, address2 ); - - // The second two are not equal. - if ( address2 != address3 ) - Console::WriteLine( "{0} is not equal to {1}", address2, address3 ); - // -} - -// IsBaseOf -void SampleIsBaseOf() -{ - // - // Create a base Uri. - Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); - - // Create a new Uri from a string. - Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); - - // Determine whether BaseUri is a base of UriAddress. - if ( baseUri->IsBaseOf( uriAddress ) ) - Console::WriteLine( "{0} is the base of {1}", baseUri, uriAddress ); - // -} - -int main() -{ - // TryParse - SampleTryCreate(); - - // Constructor - SampleConstructor(); - - // OriginalString - SampleOriginalString(); - - // DNSSafeHost - SampleDNSSafeHost(); - - // operator == and !== - SampleOperatorEqual(); - - // IsBaseOf - SampleIsBaseOf(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp deleted file mode 100644 index f7f450b51de..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp +++ /dev/null @@ -1,271 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -using namespace System::Threading; -using namespace System::Runtime::Serialization; - -namespace Example -{ - public ref class Test - { - public: - static void Main() - { - // Snippets 1 and 2 - HexConversions(); - - // snippet 7 - SampleToString(); - - // snippet 8 - SampleEquals(); - - // snippets 4, 5, and 6 - GetParts(); - - // snippet 3 - SampleMakeRelative(); - - // snippets 9 - 17 - SampleCheckSchemeName(); - - // snippets 18 - SampleUserInfo(); - } - - private: - static void SampleToString() - { - // - // Create a new Uri from a string address. - Uri^ uriAddress = gcnew Uri( "HTTP://www.Contoso.com:80/thick%20and%20thin.htm" ); - - // Write the new Uri to the console and note the difference in the two values. - // ToString() gives the canonical version. OriginalString gives the orginal - // string that was passed to the constructor. - // The following outputs "http://www.contoso.com/thick and thin.htm". - Console::WriteLine( uriAddress ); - - // The following outputs "HTTP://www.Contoso.com:80/thick%20and%20thin.htm". - Console::WriteLine( uriAddress->OriginalString ); - // - } - - static void SampleEquals() - { - // - // Create some Uris. - Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); - Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" ); - if ( address1->Equals( address2 ) ) - { - Console::WriteLine( "The two addresses are equal" ); - } - else - { - Console::WriteLine( "The two addresses are not equal" ); - } - // Will output "The two addresses are equal" - // - } - - static void GetParts() - { - // - // Create Uri - Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm#search" ); - Console::WriteLine( uriAddress->Fragment ); - Console::WriteLine( "Uri {0} the default port ", uriAddress->IsDefaultPort ? (String^)"uses" : "does not use" ); - - Console::WriteLine( "The path of this Uri is {0}", uriAddress->GetLeftPart( UriPartial::Path ) ); - Console::WriteLine( "Hash code {0}", uriAddress->GetHashCode() ); - // The example displays output similar to the following: - // #search - // Uri uses the default port - // The path of this Uri is http://www.contoso.com/index.htm - // Hash code -988419291 - // - - // - Uri^ uriAddress1 = gcnew Uri( "http://www.contoso.com/title/index.htm" ); - Console::WriteLine( "The parts are {0}, {1}, {2}", uriAddress1->Segments[ 0 ], uriAddress1->Segments[ 1 ], uriAddress1->Segments[ 2 ] ); - // - - // - Uri^ uriAddress2 = gcnew Uri( "file://server/filename.ext" ); - Console::WriteLine( uriAddress2->LocalPath ); - Console::WriteLine( "Uri {0} a UNC path", uriAddress2->IsUnc ? (String^)"is" : "is not" ); - Console::WriteLine( "Uri {0} a local host", uriAddress2->IsLoopback ? (String^)"is" : "is not" ); - Console::WriteLine( "Uri {0} a file", uriAddress2->IsFile ? (String^)"is" : "is not" ); - // The example displays the following output: - // \\server\filename.ext - // Uri is a UNC path - // Uri is not a local host - // Uri is a file - // - } - - static void HexConversions() - { - - // - char testChar = 'e'; - if ( Uri::IsHexDigit( testChar ) ) - { - Console::WriteLine( "'{0}' is the hexadecimal representation of {1}", - testChar, Uri::FromHex( testChar ) ); - } - else - { - Console::WriteLine( "'{0}' is not a hex character", testChar ); - } - - String^ returnString = Uri::HexEscape( testChar ); - Console::WriteLine( "The hexadecimal value of '{0}' is {1}", testChar, returnString ); - // - - // - String^ testString = "%75"; - int index = 0; - if ( Uri::IsHexEncoding( testString, index ) ) - { - Console::WriteLine( "The character is {0}", - Uri::HexUnescape( testString, index ) ); - } - else - { - Console::WriteLine( "The character is not hex encoded" ); - } - // - } - - // MakeRelative - static void SampleMakeRelative() - { - // - // Create a base Uri. - Uri^ address1 = gcnew Uri( "http://www.contoso.com/" ); - - // Create a new Uri from a string. - Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); - - // Determine the relative Uri. - Console::WriteLine( "The difference is {0}", address1->MakeRelativeUri( address2 ) ); - // - } - - //CheckSchemeName - static void SampleCheckSchemeName() - { - // - Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); - Console::WriteLine( "address 1 {0} a valid scheme name", - Uri::CheckSchemeName( address1->Scheme ) ? (String^)" has" : " does not have" ); - if ( address1->Scheme == Uri::UriSchemeHttp ) - { - Console::WriteLine( "Uri is HTTP type" ); - } - - Console::WriteLine( address1->HostNameType ); - // - - // - Uri^ address2 = gcnew Uri( "file://server/filename.ext" ); - if ( address2->Scheme == Uri::UriSchemeFile ) - { - Console::WriteLine( "Uri is a file" ); - } - // - - Console::WriteLine( address2->HostNameType ); - - // - Uri^ address3 = gcnew Uri( "mailto:user@contoso.com?subject=uri" ); - if ( address3->Scheme == Uri::UriSchemeMailto ) - { - Console::WriteLine( "Uri is an email address" ); - } - // - - // - Uri^ address4 = gcnew Uri( "news:123456@contoso.com" ); - if ( address4->Scheme == Uri::UriSchemeNews ) - { - Console::WriteLine( "Uri is an Internet news group" ); - } - // - - // - Uri^ address5 = gcnew Uri( "nntp://news.contoso.com/123456@contoso.com" ); - if ( address5->Scheme == Uri::UriSchemeNntp ) - { - Console::WriteLine( "Uri is nntp protocol" ); - } - // - - // - Uri^ address6 = gcnew Uri( "gopher://example.contoso.com/" ); - if ( address6->Scheme == Uri::UriSchemeGopher ) - { - Console::WriteLine( "Uri is Gopher protocol" ); - } - // - - // - Uri^ address7 = gcnew Uri( "ftp://contoso/files/testfile.txt" ); - if ( address7->Scheme == Uri::UriSchemeFtp ) - { - Console::WriteLine( "Uri is Ftp protocol" ); - } - // - - // - Uri^ address8 = gcnew Uri( "https://example.contoso.com" ); - if ( address8->Scheme == Uri::UriSchemeHttps ) - { - Console::WriteLine( "Uri is Https protocol." ); - } - // - - // - String^ address = "www.contoso.com"; - String^ uriString = String::Format( "{0}{1}{2}", - Uri::UriSchemeHttp, Uri::SchemeDelimiter, address ); - -#if OLDMETHOD - Uri^ result; - if ( Uri::TryParse( uriString, false, false, result ) ) - { - Console::WriteLine( "{0} is a valid Uri", result ); - } - else - { - Console::WriteLine( "Uri not created" ); - } -#endif - Uri ^result = gcnew Uri(uriString); - if (result->IsWellFormedOriginalString()) - Console::WriteLine("{0} is a well formed Uri", uriString); - else - Console::WriteLine("{0} is not a well formed Uri", uriString); - // - } - - static void SampleUserInfo() - { - // - Uri^ uriAddress = gcnew Uri( "http://user:password@www.contoso.com/index.htm " ); - Console::WriteLine( uriAddress->UserInfo ); - Console::WriteLine( "Fully Escaped {0}", - uriAddress->UserEscaped ? (String^)"yes" : "no" ); - // - } - }; -} - -int main() -{ - Example::Test::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp deleted file mode 100644 index 430056166b7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp +++ /dev/null @@ -1,843 +0,0 @@ -// NCLWebClientAsync -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::ComponentModel; - -// -void UploadString( String^ address ) -{ - String^ data = "Time = 12:00am temperature = 50"; - WebClient^ client = gcnew WebClient; - - // Optionally specify an encoding for uploading and downloading strings. - client->Encoding = System::Text::Encoding::UTF8; - - // Upload the data. - String^ reply = client->UploadString( address, data ); - - // Disply the server's response. - Console::WriteLine( reply ); -} -// - -// -void PostString( String^ address ) -{ - String^ data = "Time = 12:00am temperature = 50"; - String^ method = "POST"; - WebClient^ client = gcnew WebClient; - String^ reply = client->UploadString( address, method, data ); - Console::WriteLine( reply ); -} -// - -void UploadFileCallback2( Object^ sender, UploadFileCompletedEventArgs^ e ); - -// -// Sample call: UploadFileInBackground3("http://www.contoso.com/fileUpload.aspx", "data.txt") -void UploadFileInBackground3( String^ address, String^ fileName ) -{ - - // - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - client->UseDefaultCredentials = true; - - // - client->UploadFileCompleted += gcnew UploadFileCompletedEventHandler( UploadFileCallback2 ); - client->UploadFileAsync( uri, fileName ); - Console::WriteLine( "File upload started." ); -} - -// - -// -// Sample call: UploadFileInBackground2("http://www.contoso.com/fileUpload.aspx", "data.txt") -void UploadFileInBackground2( String^ address, String^ fileName ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - client->UploadFileCompleted += - gcnew UploadFileCompletedEventHandler (UploadFileCallback2); - - // Specify a progress notification handler. - client->UploadProgressChanged += - gcnew UploadProgressChangedEventHandler( UploadProgressCallback ); - client->UploadFileAsync( uri, "POST", fileName ); - Console::WriteLine( "File upload started." ); -} -// - -// -void UploadFileCallback2( Object^ /*sender*/, UploadFileCompletedEventArgs^ e ) -{ - String^ reply = System::Text::Encoding::UTF8->GetString( e->Result ); - Console::WriteLine( reply ); -} -// - -void UploadFileCallback( Object^ sender, UploadFileCompletedEventArgs^ e ); - -// -// Sample call: UploadFileInBackground("http://www.contoso.com/fileUpload.aspx", "data.txt") -void UploadFileInBackground( String^ address, String^ fileName ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ method = "POST"; - - // Specify that that UploadFileCallback method gets called - // when the file upload completes. - client->UploadFileCompleted += gcnew UploadFileCompletedEventHandler( UploadFileCallback ); - client->UploadFileAsync( uri, method, fileName, waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the upload to complete. - waiter->WaitOne(); - Console::WriteLine( "File upload is complete." ); -} -// - -// -void UploadFileCallback( Object^ /*sender*/, UploadFileCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - ; - try - { - String^ reply = System::Text::Encoding::UTF8->GetString( e->Result ); - Console::WriteLine( reply ); - } - finally - { - - // If this thread throws an exception, make sure that - // you let the main application thread resume. - waiter->Set(); - } - -} -// - -void UploadStringCallback( Object^ sender, UploadStringCompletedEventArgs^ e ); - -// -void UploadStringInBackground( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ data = "Time = 12:00am temperature = 50"; - String^ method = "POST"; - - client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback ); - client->UploadStringAsync( uri, method, data, waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the upload to complete. - waiter->WaitOne(); - Console::WriteLine( "String upload is complete." ); -} -// - -// -void UploadStringCallback( Object^ /*sender*/, UploadStringCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - try - { - String^ reply = dynamic_cast(e->Result); - Console::WriteLine( reply ); - } - finally - { - - // If this thread throws an exception, make sure that - // you let the main application thread resume. - waiter->Set(); - } - -} -// - -void OpenReadCallback( Object^ sender, OpenReadCompletedEventArgs^ e ); - -// -void OpenResourceForReading( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - client->OpenReadCompleted += gcnew OpenReadCompletedEventHandler( OpenReadCallback ); - client->OpenReadAsync( uri, waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the upload to complete. - waiter->WaitOne(); -} -// - -// -void OpenReadCallback( Object^ /*sender*/, OpenReadCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - Stream^ reply = nullptr; - StreamReader^ s = nullptr; - try - { - reply = dynamic_cast(e->Result); - s = gcnew StreamReader( reply ); - Console::WriteLine( s->ReadToEnd() ); - } - finally - { - if ( s != nullptr ) - { - s->Close(); - } - if ( reply != nullptr ) - { - reply->Close(); - } - - // If this thread throws an exception, make sure that - // you let the main application thread resume. - waiter->Set(); - } - -} -// - -void OpenWriteCallback( Object^ sender, OpenWriteCompletedEventArgs^ e ); - -// -void OpenResourceForWriting( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the OpenWriteCallback method gets called - // when the writeable stream is available. - client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback ); - client->OpenWriteAsync( uri, "POST", waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the upload to complete. - waiter->WaitOne(); -} -// - -// -void OpenWriteCallback( Object^ /*sender*/, OpenWriteCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - Stream^ body = nullptr; - StreamWriter^ s = nullptr; - try - { - body = dynamic_cast(e->Result); - s = gcnew StreamWriter( body ); - s->AutoFlush = true; - s->Write( "This is content data to be sent to the server." ); - } - finally - { - if ( s != nullptr ) - { - s->Close(); - } - if ( body != nullptr ) - { - body->Close(); - } - - // If this thread throws an exception, make sure that - // you let the main application thread resume. - waiter->Set(); - } - -} -// - -void OpenWriteCallback2( Object^ sender, OpenWriteCompletedEventArgs^ e ); - -// -void OpenResourceForWriting2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the OpenWriteCallback method gets called - // when the writeable stream is available. - client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback2 ); - client->OpenWriteAsync( uri, "POST" ); - - // Applications can perform other tasks - // while waiting for the upload to complete. -} -// - -// -void OpenWriteCallback2( Object^ /*sender*/, OpenWriteCompletedEventArgs^ e ) -{ - Stream^ body = nullptr; - StreamWriter^ s = nullptr; - try - { - body = dynamic_cast(e->Result); - s = gcnew StreamWriter( body ); - s->AutoFlush = true; - s->Write( "This is content data to be sent to the server." ); - } - finally - { - if ( s != nullptr ) - { - s->Close(); - } - if ( body != nullptr ) - { - body->Close(); - } - } - -} -// - -// -void OpenResourceForPosting( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the OpenWriteCallback method gets called - // when the writeable stream is available. - client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback2 ); - client->OpenWriteAsync( uri ); - - // Applications can perform other tasks - // while waiting for the upload to complete. -} -// - -void DownloadFileCallback( Object^ sender, System::ComponentModel::AsyncCompletedEventArgs^ e ); - -// -// Sample call : DownLoadFileInBackground ("http://www.contoso.com/logs/January.txt"); -void DownLoadFileInBackground( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the DownloadFileCallback method gets called - // when the download completes. - client->DownloadFileCompleted += gcnew AsyncCompletedEventHandler( DownloadFileCallback ); - client->DownloadFileAsync( uri, "serverdata.txt", waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the download to complete. - waiter->WaitOne(); -} -// - -// -void DownloadFileCallback( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ e ) -{ - if ( e->Cancelled ) - { - Console::WriteLine( "File download cancelled." ); - } - - if ( e->Error != nullptr ) - { - Console::WriteLine( e->Error->ToString() ); - } - - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - - // Let the main application thread resume. - waiter->Set(); -} -// - -void DownloadFileCallback2( Object^ sender, System::ComponentModel::AsyncCompletedEventArgs^ e ); - -// -// Sample call : DownLoadFileInBackground2 ("http://www.contoso.com/logs/January.txt"); -void DownLoadFileInBackground2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Call DownloadFileCallback2 when the download completes. - client->DownloadFileCompleted += gcnew AsyncCompletedEventHandler( DownloadFileCallback2 ); - - // Specify a progress notification handler here... - - client->DownloadFileAsync( uri, "serverdata.txt" ); -} - -void DownloadFileCallback2( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ e ) -{ - if ( e->Cancelled ) - { - Console::WriteLine( "File download cancelled." ); - } - - if ( e->Error != nullptr ) - { - Console::WriteLine( e->Error->ToString() ); - } -} -// - -void DownloadDataCallback( Object^ sender, DownloadDataCompletedEventArgs^ e ); - -// -// Sample call : DownLoadDataInBackground ("http://www.contoso.com/GameScores.html"); -void DownloadDataInBackground( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the DownloadDataCallback method gets called - // when the download completes. - client->DownloadDataCompleted += gcnew DownloadDataCompletedEventHandler( DownloadDataCallback ); - client->DownloadDataAsync( uri, waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the download to complete. - waiter->WaitOne(); -} -// - -// -void DownloadDataCallback( Object^ /*sender*/, DownloadDataCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - try - { - - // If the request was not canceled and did not throw - // an exception, display the resource. - if ( !e->Cancelled && e->Error == nullptr ) - { - array^data = dynamic_cast^>(e->Result); - String^ textData = System::Text::Encoding::UTF8->GetString( data ); - Console::WriteLine( textData ); - } - } - finally - { - - // Let the main application thread resume. - waiter->Set(); - } - -} -// - -void DownloadDataCallback2( Object^ sender, DownloadDataCompletedEventArgs^ e ); - -// -// Sample call : DownloadDataInBackground2 ("http://www.contoso.com/GameScores.html"); -void DownloadDataInBackground2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the DownloadDataCallback2 method gets called - // when the download completes. - client->DownloadDataCompleted += gcnew DownloadDataCompletedEventHandler( DownloadDataCallback2 ); - client->DownloadDataAsync( uri ); -} -// - -// -void DownloadDataCallback2( Object^ /*sender*/, DownloadDataCompletedEventArgs^ e ) -{ - - // If the request was not canceled and did not throw - // an exception, display the resource. - if ( !e->Cancelled && e->Error == nullptr ) - { - array^data = dynamic_cast^>(e->Result); - String^ textData = System::Text::Encoding::UTF8->GetString( data ); - Console::WriteLine( textData ); - } -} -// - -// -void DownloadString( String^ address ) -{ - WebClient^ client = gcnew WebClient; - String^ reply = client->DownloadString( address ); - Console::WriteLine( reply ); -} - - -// -void DownloadStringCallback( Object^ sender, DownloadStringCompletedEventArgs^ e ); - -// -// Sample call : DownLoadStringInBackground ("http://www.contoso.com/GameScores.html"); -void DownloadStringInBackground( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the DownloadStringCallback method gets called - // when the download completes. - client->DownloadStringCompleted += gcnew DownloadStringCompletedEventHandler( DownloadStringCallback ); - client->DownloadStringAsync( uri, waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the download to complete. - waiter->WaitOne(); -} -// - -// -void DownloadStringCallback( Object^ /*sender*/, DownloadStringCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - try - { - - // If the request was not canceled and did not throw - // an exception, display the resource. - if ( !e->Cancelled && e->Error == nullptr ) - { - String^ textString = dynamic_cast(e->Result); - Console::WriteLine( textString ); - } - } - finally - { - - // Let the main application thread resume. - waiter->Set(); - } - -} -// - -void DownloadStringCallback2( Object^ sender, DownloadStringCompletedEventArgs^ e ); - -// -// Sample call : DownloadStringInBackground2 ("http://www.contoso.com/GameScores.html"); -void DownloadStringInBackground2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the DownloadStringCallback2 method gets called - // when the download completes. - client->DownloadStringCompleted += gcnew DownloadStringCompletedEventHandler( DownloadStringCallback2 ); - client->DownloadStringAsync( uri ); -} -// - -// -void DownloadStringCallback2( Object^ /*sender*/, DownloadStringCompletedEventArgs^ e ) -{ - - // If the request was not canceled and did not throw - // an exception, display the resource. - if ( !e->Cancelled && e->Error == nullptr ) - { - String^ textString = dynamic_cast(e->Result); - Console::WriteLine( textString ); - } -} -// - -void OpenReadCallback2( Object^ sender, OpenReadCompletedEventArgs^ e ); - -// -void OpenResourceForReading2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - client->OpenReadCompleted += gcnew OpenReadCompletedEventHandler( OpenReadCallback2 ); - client->OpenReadAsync( uri ); -} -// - -// -void OpenReadCallback2( Object^ /*sender*/, OpenReadCompletedEventArgs^ e ) -{ - Stream^ reply = nullptr; - StreamReader^ s = nullptr; - try - { - reply = dynamic_cast(e->Result); - s = gcnew StreamReader( reply ); - Console::WriteLine( s->ReadToEnd() ); - } - finally - { - if ( s != nullptr ) - { - s->Close(); - } - if ( reply != nullptr ) - { - reply->Close(); - } - } - -} -// - -void UploadDataCallback( Object^ sender, UploadDataCompletedEventArgs^ e ); - -// -void UploadDataInBackground( String^ address ) -{ - System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ text = "Time = 12:00am temperature = 50"; - array^data = System::Text::Encoding::UTF8->GetBytes( text ); - String^ method = "POST"; - - client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback ); - client->UploadDataAsync( uri, method, data, waiter ); - - // Block the main application thread. Real applications - // can perform other tasks while waiting for the upload to complete. - waiter->WaitOne(); - Console::WriteLine( "Data upload is complete." ); -} -// - -// -void UploadDataCallback( Object^ /*sender*/, UploadDataCompletedEventArgs^ e ) -{ - System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); - try - { - array^data = dynamic_cast^>(e->Result); - String^ reply = System::Text::Encoding::UTF8->GetString( data ); - Console::WriteLine( reply ); - } - finally - { - - // If this thread throws an exception, make sure that - // you let the main application thread resume. - waiter->Set(); - } - -} -// - -void UploadDataCallback2( Object^ sender, UploadDataCompletedEventArgs^ e ); - -// -void UploadDataInBackground2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ text = "Time = 12:00am temperature = 50"; - array^data = System::Text::Encoding::UTF8->GetBytes( text ); - String^ method = "POST"; - - client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback2 ); - client->UploadDataAsync( uri, method, data ); -} -// - -// -void UploadDataCallback2( Object^ /*sender*/, UploadDataCompletedEventArgs^ e ) -{ - array^data = dynamic_cast^>(e->Result); - String^ reply = System::Text::Encoding::UTF8->GetString( data ); - Console::WriteLine( reply ); -} -// - -void UploadDataCallback3( Object^ sender, UploadDataCompletedEventArgs^ e ); - -// -void UploadDataInBackground3( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ text = "Time = 12:00am temperature = 50"; - array^data = System::Text::Encoding::UTF8->GetBytes( text ); - - client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback3 ); - client->UploadDataAsync( uri, data ); -} -// - -// -void UploadDataCallback3( Object^ /*sender*/, UploadDataCompletedEventArgs^ e ) -{ - array^data = dynamic_cast^>(e->Result); - String^ reply = System::Text::Encoding::UTF8->GetString( data ); - Console::WriteLine( reply ); -} -// - -void UploadStringCallback2( Object^ sender, UploadStringCompletedEventArgs^ e ); - -// -void UploadStringInBackground2( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ data = "Time = 12:00am temperature = 50"; - - client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback2 ); - client->UploadStringAsync( uri, data ); -} -// - -// -void UploadStringCallback2( Object^ /*sender*/, UploadStringCompletedEventArgs^ e ) -{ - String^ reply = dynamic_cast(e->Result); - Console::WriteLine( reply ); -} -// - -// -void UploadStringInBackground3( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - String^ data = "Time = 12:00am temperature = 50"; - String^ method = "POST"; - - client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback2 ); - client->UploadStringAsync( uri, method, data ); -} -// - -// -// Sample call : DownLoadFileWithProgressNotify ("http://www.contoso.com/logs/January.txt"); -void DownLoadFileWithProgressNotify( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify that the DownloadFileCallback method gets called - // when the download completes. - client->DownloadFileCompleted += gcnew AsyncCompletedEventHandler( DownloadFileCallback2 ); - - // Specify a progress notification handler. - client->DownloadProgressChanged += gcnew DownloadProgressChangedEventHandler( DownloadProgressCallback ); - - // The user token, shown here as ID 1234, is used to uniquely - // identify notification events raised for this data transfer operation. - client->DownloadFileAsync( uri, "serverdata.txt", "ID 1234" ); -} -// - -// - static void UploadProgressCallback(Object^ sender, - UploadProgressChangedEventArgs^ e) - { - // Displays the operation identifier, and the transfer progress. - Console::WriteLine("{0} uploaded {1} of {2} bytes. {3} % complete...", - (String ^)e->UserState, - e->BytesSent, - e->TotalBytesToSend, - e->ProgressPercentage); - } - static void DownloadProgressCallback(Object^ sender, - DownloadProgressChangedEventArgs^ e) - { - // Displays the operation identifier, and the transfer progress. - Console::WriteLine("{0} downloaded {1} of {2} bytes. {3} % complete...", - (String ^)e->UserState, - e->BytesReceived, - e->TotalBytesToReceive, - e->ProgressPercentage); - } -// - -// -// Sample call : DownLoadFileInBackground4 ("http://www.contoso.com/logs/January.txt"); -void DownLoadFileInBackground4( String^ address ) -{ - WebClient^ client = gcnew WebClient; - Uri ^uri = gcnew Uri(address); - - // Specify a DownloadFileCompleted handler here... - - // Specify a progress notification handler. - client->DownloadProgressChanged += gcnew DownloadProgressChangedEventHandler( DownloadProgressCallback4 ); - - client->DownloadFileAsync( uri, "serverdata.txt" ); -} - -static void DownloadProgressCallback4(Object^ sender, DownloadProgressChangedEventArgs^ e) -{ - // Displays the operation identifier, and the transfer progress. - Console::WriteLine("{0} downloaded {1} of {2} bytes. {3} % complete...", - (String ^)e->UserState, - e->BytesReceived, - e->TotalBytesToReceive, - e->ProgressPercentage); -} -// - -// nothing below this line appears in the docs. -//[System.Security.Permissions.FileIOPermissionAttribute(System.Security.Permissions.SecurityAction.Deny, Write=@"c:\whidbeycode\ncl.xml")] -int main() -{ - - // OpenResourceForReading ("http://google.com"); - //OpenResourceForReading2("http://google.com"); - // System.Threading.Thread.Sleep (10000); - UploadDataInBackground2( "http://sharriso1/test/postaccepter.aspx" ); - - // DownloadString ("http://google.com"); - /* - UploadDataInBackground ("http://sharriso1/test/postaccepter.aspx"); - - System.Threading.Thread.Sleep (1000); - UploadDataInBackground3 ("http://sharriso1/test/postaccepter.aspx"); - System.Threading.Thread.Sleep (1000); - - UploadStringInBackground ("http://sharriso1/test/postaccepter.aspx"); - UploadStringInBackground2 ("http://sharriso1/test/postaccepter.aspx"); - System.Threading.Thread.Sleep (1000); - UploadStringInBackground3 ("http://sharriso1/test/postaccepter.aspx"); - System.Threading.Thread.Sleep (1000); - */ - // OpenResourceForWriting2("http://sharriso1/test/postaccepter.aspx"); - // DownloadDataInBackground ("http://google.com"); - //System.Threading.Thread.Sleep (10000); - // DownloadString ("http://google.com"); - // DownloadStringInBackground ("http://google.com"); - // DownloadStringInBackground2 ("http://google.com"); - // System.Threading.Thread.Sleep (1000); - // DownLoadFileInBackground2 ("http://sharriso1/test/uploadedFiles/onesandtwos.txt"); - DownLoadFileWithProgressNotify( "http://sharriso1/test/uploadedFiles/onesandtwos.txt" ); - - //System.Threading.Thread.Sleep (10000); - // UploadString (); - // UploadStringInBackground ("http://sharriso1/test/fileUploadercs.aspx"); - // UploadFileInBackground2 ("http://sharriso1/test/fileUploadercs.aspx", "onesandtwos.txt"); - // UploadFileInBackground3 ("http://sharriso1/test/fileUploadercs.aspx", "onesandtwos.txt"); - System::Threading::Thread::Sleep( 1000 ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp deleted file mode 100644 index e3efdf4be05..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args == nullptr || args->Length == 1 ) - { - throw gcnew ApplicationException( "Specify the URI of the resource to retrieve." ); - } - - WebClient^ client = gcnew WebClient; - - // Add a user agent header in case the - // requested URI contains a query. - client->Headers->Add( "user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" ); - Stream^ data = client->OpenRead( args[ 1 ] ); - StreamReader^ reader = gcnew StreamReader( data ); - String^ s = reader->ReadToEnd(); - Console::WriteLine( s ); - data->Close(); - reader->Close(); - delete client; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp deleted file mode 100644 index bbfd7a0afd9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp +++ /dev/null @@ -1,186 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; - -// -WebProxy^ CreateProxy() -{ - return gcnew WebProxy; -} -// - -// -WebProxy^ CreateProxyWithExampleAddress() -{ - return gcnew WebProxy( gcnew Uri( "http://contoso" ) ); -} -// - -// -WebProxy^ CreateProxyWithExampleAddress( bool bypassLocal ) -{ - return gcnew WebProxy( gcnew Uri( "http://contoso" ), bypassLocal ); -} -// - -// -WebProxy^ CreateProxyWithBypassList( bool bypassLocal ) -{ - // Do not use the proxy server for Contoso.com URIs. - array^ bypassList = {";*.Contoso.com"}; - return gcnew WebProxy( gcnew Uri( "http://contoso" ), - bypassLocal, - bypassList ); -} -// - -// -WebProxy^ CreateProxyWithHost() -{ - return gcnew WebProxy( "http://contoso" ); -} -// - -// -WebProxy^ CreateProxyWithHostAndPort() -{ - return gcnew WebProxy( "contoso",80 ); -} -// - -// -WebProxy^ CreateProxyWithHostAddress( bool bypassLocal ) -{ - WebProxy^ proxy = gcnew WebProxy( "http://contoso",bypassLocal ); - Console::WriteLine( "Bypass proxy for local URIs?: {0}", - proxy->BypassProxyOnLocal ); - return proxy; -} -// - -// -WebProxy^ CreateProxyWithHostAndBypassList( bool bypassLocal ) -{ - // Do not use the proxy server for Contoso.com URIs. - array^ bypassList = {";*.Contoso.com"}; - return gcnew WebProxy( "http://contoso", - bypassLocal, - bypassList ); -} -// - -// -WebProxy^ CreateProxyWithCredentials( bool bypassLocal ) -{ - // Do not use the proxy server for Contoso.com URIs. - array^ bypassList = {";*.Contoso.com"}; - return gcnew WebProxy( "http://contoso", - bypassLocal, - bypassList, - CredentialCache::DefaultCredentials ); -} -// - -// -void DisplayDefaultProxy() -{ - WebProxy^ proxy = WebProxy::GetDefaultProxy(); - - Console::WriteLine( "Address: {0}", proxy->Address ); - - Console::WriteLine( "Bypass on local: {0}", - proxy->BypassProxyOnLocal ); - int count = proxy->BypassList->Length; - if ( count == 0 ) - { - Console::WriteLine( "The bypass list is empty." ); - return; - } - array^ bypass = proxy->BypassList; - Console::WriteLine( "The bypass list contents:" ); - - for ( int i = 0; i < count; i++ ) - { - Console::WriteLine( bypass[ i ] ); - } -} -// - -// -void CheckDefaultProxyForRequest( Uri^ resource ) -{ - WebProxy^ proxy = (WebProxy^)( WebProxy::GetDefaultProxy() ); - - // See what proxy is used for resource. - Uri^ resourceProxy = proxy->GetProxy( resource ); - - // Test to see whether a proxy was selected. - if ( resourceProxy == resource ) - { - Console::WriteLine( "No proxy for {0}", resource ); - } - else - { - Console::WriteLine( "Proxy for {0} is {1}", resource, - resourceProxy ); - } -} -// - -// -WebProxy^ CreateProxyAndCheckBypass( bool bypassLocal ) -{ - // Do not use the proxy server for Contoso.com URIs. - array^ bypassList = {";*.Contoso.com"}; - WebProxy^ proxy = gcnew WebProxy( "http://contoso", - bypassLocal, - bypassList ); - - // Test the bypass list. - if ( !proxy->IsBypassed( gcnew Uri( "http://www.Contoso.com" ) ) ) - { - Console::WriteLine( "Bypass not working!" ); - return nullptr; - } - else - { - Console::WriteLine( "Bypass is working." ); - return proxy; - } -} -// - -// -WebProxy^ CreateProxyWithCredentials2( bool bypassLocal ) -{ - - // Do not use the proxy server for Contoso.com URIs. - array^ bypassList = {";*.Contoso.com"}; - return gcnew WebProxy( gcnew Uri( "http://contoso" ), - bypassLocal, - bypassList, - CredentialCache::DefaultCredentials ); -} -// - -int main() -{ - Uri^ resource = gcnew Uri( "http://www.example.com" ); - - /* - CreateProxy(); - CreateProxyWithExampleAddress(); - CreateProxyWithExampleAddress(true); - CreateProxyWithBypassList(true); - CreateProxyWithHost(); - CreateProxyWithHostAndPort(); - CreateProxyWithHostAddress(true); - CreateProxyWithHostAndBypassList(true); - CreateProxyWithCredentials(true); - - DisplayDefaultProxy(); - */ - // CreateProxyAndCheckBypass(false); - CreateProxyWithCredentials2( false ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp deleted file mode 100644 index 51c732b4005..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; -int main() -{ - - // - // Create a request for the URL. - WebRequest^ request = WebRequest::Create( "http://www.contoso.com/default.html" ); - - // If required by the server, set the credentials. - request->Credentials = CredentialCache::DefaultCredentials; - - // Get the response. - HttpWebResponse^ response = dynamic_cast(request->GetResponse()); - - // - // Display the status. - Console::WriteLine( response->StatusDescription ); - - // Get the stream containing content returned by the server. - Stream^ dataStream = response->GetResponseStream(); - - // Open the stream using a StreamReader for easy access. - StreamReader^ reader = gcnew StreamReader( dataStream ); - - // Read the content. - String^ responseFromServer = reader->ReadToEnd(); - - // Display the content. - Console::WriteLine( responseFromServer ); - - // Cleanup the streams and the response. - reader->Close(); - dataStream->Close(); - response->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp deleted file mode 100644 index bdb99bf4675..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ -//The following sample initializes a CredentialCache with multiple security credentials -//and later uses NTLM credentials with SmtpClient - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Mail; - -void main() -{ -// - SmtpClient^ client = gcnew SmtpClient("ContosoMail", 45); - MailAddress^ from = gcnew MailAddress("sender@SenderMailServerName.com", "Sender Name"); - MailAddress^ to = gcnew MailAddress("recepient@RecepientMailServerName.com", "Recepient Name"); - MailMessage^ message = gcnew MailMessage(from, to); - - message->Body = "This is a test email message sent by an application. "; - message->Subject = "Test Email using Credentials"; - - NetworkCredential^ myCreds = gcnew NetworkCredential("username", "password", "domain"); - CredentialCache^ myCredentialCache = gcnew CredentialCache(); - try - { - myCredentialCache->Add("ContoscoMail", 35, "Basic", myCreds); - myCredentialCache->Add("ContoscoMail", 45, "NTLM", myCreds); - - client->Credentials = myCredentialCache->GetCredential("ContosoMail", 45, "NTLM"); - client->Send(message); - Console::WriteLine("Goodbye."); - } - catch(Exception^ e) - { - Console::WriteLine("Exception is raised. "); - Console::WriteLine("Message: {0} ",e->Message); - } -// - -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp b/snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp deleted file mode 100644 index 4f475ac7f01..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#using - -using namespace System; -using namespace System::Security::Policy; - -static void DisplayConnectionAccessRules(NetCodeGroup^ group); -// - - -static CodeConnectAccess^ CreateFtpAndDefaultPortAccess() -{ - return gcnew CodeConnectAccess(Uri::UriSchemeFtp, - CodeConnectAccess::DefaultPort); -} -// -// - - -static CodeConnectAccess^ CreateHttpAndOriginPortAccess() -{ - return gcnew CodeConnectAccess(Uri::UriSchemeHttp, - CodeConnectAccess::OriginPort); -} -// -// - -static CodeConnectAccess^ CreateAnySchemeOriginPortAccess() -{ - return CodeConnectAccess::CreateAnySchemeAccess - (CodeConnectAccess::OriginPort); -} -// -// - -static void SetNetCodeGroupAccess() -{ - String^ userPolicyLevel = "User"; - // Locate the User policy level. - PolicyLevel^ level = nullptr; - System::Collections::IEnumerator^ ph = - System::Security::SecurityManager::PolicyHierarchy(); - while(ph->MoveNext()) - { - level = (PolicyLevel^)ph->Current; - if (level->Label == userPolicyLevel) - { - break; - } - } - if (level->Label != userPolicyLevel) - throw gcnew ApplicationException("Could not find User policy level."); - // - - IMembershipCondition^ membership = - gcnew UrlMembershipCondition("http://www.contoso.com/*"); - NetCodeGroup^ codeGroup = gcnew NetCodeGroup(membership); - // Delete default settings. - codeGroup->ResetConnectAccess(); - // Create an object that represents access to the FTP scheme and - // default port. - CodeConnectAccess^ CodeAccessFtp = - gcnew CodeConnectAccess(Uri::UriSchemeFtp, - CodeConnectAccess::DefaultPort); - // Create an object that represents access to the HTTPS scheme - // and default port. - CodeConnectAccess^ CodeAccessHttps = - gcnew CodeConnectAccess(Uri::UriSchemeHttps, - CodeConnectAccess::DefaultPort); - // Create an object that represents access to the origin - // scheme and port. - CodeConnectAccess^ CodeAccessOrigin = - CodeConnectAccess::CreateOriginSchemeAccess - (CodeConnectAccess::OriginPort); - // Add connection access objects to the NetCodeGroup object. - codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessFtp); - codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessHttps); - codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessOrigin); - // - // Provide name and description information for caspol.exe tool. - codeGroup->Name = "ContosoHttpCodeGroup"; - codeGroup->Description = "Code originating from contoso.com can" + - " connect back using the FTP or HTTPS."; - // Add the code group to the User policy's root node. - level->RootCodeGroup->AddChild(codeGroup); - // Save the changes to the policy level. - System::Security::SecurityManager::SavePolicy(); -} -// -// - -static void DisplayProperties (CodeConnectAccess^ access) -{ - Console::WriteLine("Scheme:{0} Port: {1}", - access->Scheme, access->Port); -} -// -// - -static void DisplayFields () -{ - Console::WriteLine("Origin scheme value:{0} AnyScheme value: {1}", - CodeConnectAccess::OriginScheme, CodeConnectAccess::AnyScheme); -} -// - - -static void CreateNetCodeGroup() -{ - IMembershipCondition^ membership = - gcnew UrlMembershipCondition("http://www.contoso.com/*"); - NetCodeGroup^ codeGroup = gcnew NetCodeGroup(membership); - - // Display default settings. - DisplayConnectionAccessRules(codeGroup); - // Delete default settings. - codeGroup->ResetConnectAccess(); - // Create an object that represents access to the ftp scheme and - // default port. - CodeConnectAccess^ CodeAccessFtp = - gcnew CodeConnectAccess(Uri::UriSchemeFtp, - CodeConnectAccess::DefaultPort); - // Create an object that represents access to the HTTPS scheme - // and default port. - CodeConnectAccess^ CodeAccessHttps = - gcnew CodeConnectAccess(Uri::UriSchemeHttps, - CodeConnectAccess::DefaultPort); - // Create an object that represents access to the origin scheme - // and port. - CodeConnectAccess^ CodeAccessOrigin = - CodeConnectAccess::CreateOriginSchemeAccess - (CodeConnectAccess::OriginPort); - - codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessFtp); - codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessHttps); - codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessOrigin); - Console::WriteLine("New NetCodeGroup settings:"); - DisplayConnectionAccessRules(codeGroup); -} -// - -static void DisplayConnectionAccessRules(NetCodeGroup^ group) -{ - array^ rules = - group->GetConnectAccessRules(); - for each (System::Collections::DictionaryEntry^ o in rules) - { - String^ key = (String^)(o->Key); - array^ values = (array^)(o->Value); - Console::WriteLine("Origin scheme: {0}", key); - for each (CodeConnectAccess^ c in values) - { - Console::WriteLine("Scheme {0} Port: {1}", c->Scheme, c->Port); - } - Console::WriteLine("__________________________"); - } -} -// - -int main() -{ - DisplayProperties(CreateFtpAndDefaultPortAccess()); - DisplayFields(); - DisplayProperties(CreateHttpAndOriginPortAccess()); - DisplayProperties(CreateAnySchemeOriginPortAccess()); - SetNetCodeGroupAccess(); - CreateNetCodeGroup(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp deleted file mode 100644 index af770e04406..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp +++ /dev/null @@ -1,94 +0,0 @@ -//NclMailASync - -// -#using -using namespace System; -using namespace System::Net; -using namespace System::Net::Mail; -using namespace System::Net::Mime; -using namespace System::Threading; -using namespace System::ComponentModel; - -static bool mailSent; - -static void SendCompletedCallback(Object^ sender, AsyncCompletedEventArgs^ e) -{ - // Get the unique identifier for this asynchronous - // operation. - String^ token = (String^) e->UserState; - - if (e->Cancelled) - { - Console::WriteLine("[{0}] Send canceled.", token); - } - if (e->Error != nullptr) - { - Console::WriteLine("[{0}] {1}", token, - e->Error->ToString()); - } else - { - Console::WriteLine("Message sent."); - } - mailSent = true; -} - -int main(array^ args) -{ - if (args->Length > 1) - { - // Command-line argument must be the SMTP host. - SmtpClient^ client = gcnew SmtpClient(args[1]); - // Specify the email sender. - // - // Create a mailing address that includes a UTF8 - // character in the display name. - MailAddress^ from = gcnew MailAddress("jane@contoso.com", - "Jane " + (wchar_t)0xD8 + " Clayton", - System::Text::Encoding::UTF8); - // - // Set destinations for the email message. - MailAddress^ to = gcnew MailAddress("ben@contoso.com"); - // Specify the message content. - // - MailMessage^ message = gcnew MailMessage(from, to); - message->Body = "This is a test email message sent" + - " by an application. "; - // Include some non-ASCII characters in body and - // subject. - String^ someArrows = gcnew String(gcnew array{L'\u2190', - L'\u2191', L'\u2192', L'\u2193'}); - message->Body += Environment::NewLine + someArrows; - message->BodyEncoding = System::Text::Encoding::UTF8; - message->Subject = "test message 1" + someArrows; - message->SubjectEncoding = System::Text::Encoding::UTF8; - // - // Set the method that is called back when the send - // operation ends. - client->SendCompleted += gcnew - SendCompletedEventHandler(SendCompletedCallback); - // The userState can be any object that allows your - // callback method to identify this send operation. - // For this example, the userToken is a string constant. - String^ userState = "test message1"; - client->SendAsync(message, userState); - Console::WriteLine("Sending message... press c to" + - " cancel mail. Press any other key to exit."); - String^ answer = Console::ReadLine(); - // If the user canceled the send, and mail hasn't been - // sent yet,then cancel the pending operation. - if (answer->ToLower()->StartsWith("c") && !mailSent) - { - client->SendAsyncCancel(); - } - // Clean up. - delete message; - delete client; - client = nullptr; - Console::WriteLine("Goodbye."); - } - else - { - Console::WriteLine("Please give SMTP server name!"); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp b/snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp deleted file mode 100644 index 9e6468dcd8f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp +++ /dev/null @@ -1,98 +0,0 @@ - -// NCLMailPerms -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Mail; -using namespace System::Net::Mime; -using namespace System::Security::Permissions; - -namespace SmtpPermissionsExamples -{ - public ref class TestSmtpPermissions - { - public: - // - static SmtpPermission^ CreateConnectPermission() - { - SmtpPermission^ connectAccess = - gcnew SmtpPermission(SmtpAccess::Connect); - Console::WriteLine("Access? {0}", connectAccess->Access); - return connectAccess; - } - // - - // - static SmtpPermission^ CreateUnrestrictedPermission() - { - SmtpPermission^ allAccess = - gcnew SmtpPermission(PermissionState::Unrestricted); - Console::WriteLine("Is unrestricted? {0}", - allAccess->IsUnrestricted()); - return allAccess; - } - // - - // - static SmtpPermission^ CreatePermissionCopy(SmtpPermission^ p) - { - SmtpPermission^ copy = (SmtpPermission^) p->Copy(); - return copy; - } - // - - // - static SmtpPermission^ CreateUnrestrictedPermission2() - { - SmtpPermission^ allAccess = gcnew SmtpPermission(true); - Console::WriteLine("Is unrestricted? {0}", - allAccess->IsUnrestricted()); - return allAccess; - } - // - - // - static SmtpPermission^ GiveFullAccess( - SmtpPermission^ permission) - { - permission->AddPermission(SmtpAccess::Connect); - return permission; - } - // - - // - static SmtpPermission^ IntersectionWithFull( - SmtpPermission^ permission) - { - SmtpPermission^ allAccess = - gcnew SmtpPermission(PermissionState::Unrestricted); - return (SmtpPermission^) permission->Intersect(allAccess); - } - // - - // - static bool CheckSubSet( - SmtpPermission^ permission) - { - SmtpPermission^ allAccess = - gcnew SmtpPermission(PermissionState::Unrestricted); - return permission->IsSubsetOf(allAccess); - } - // - - // - static SmtpPermission^ UnionWithFull( - SmtpPermission^ permission) - { - SmtpPermission^ allAccess = - gcnew SmtpPermission(PermissionState::Unrestricted); - return (SmtpPermission^) permission->Union(allAccess); - } - // - }; -}; - -int main() -{ -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp deleted file mode 100644 index 6f24d42284f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp +++ /dev/null @@ -1,239 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Authentication; -using namespace System::Security::Principal; -using namespace System::Text; -using namespace System::IO; -using namespace System::Threading; - -// ClientState is the AsyncState object. -private ref class ClientState -{ -private: - AuthenticatedStream^ authStream; - TcpClient^ client; - array^buffer; - StringBuilder^ message; - ManualResetEvent^ waiter; - -internal: - ClientState( AuthenticatedStream^ a, TcpClient^ theClient ) - { - authStream = a; - client = theClient; - message = nullptr; - buffer = gcnew array(2048); - waiter = gcnew ManualResetEvent( false ); - } - -internal: - property TcpClient^ Client - { - TcpClient^ get() - { - return client; - } - } - - property AuthenticatedStream^ AuthStream - { - AuthenticatedStream^ get() - { - return authStream; - } - } - - property array^ Buffer - { - array^ get() - { - return buffer; - } - - } - - property StringBuilder^ Message - { - StringBuilder^ get() - { - if ( message == nullptr ) - message = gcnew StringBuilder; - - return message; - } - - } - - property ManualResetEvent^ Waiter - { - ManualResetEvent^ get() - { - return waiter; - } - - } - -}; - -public ref class AsynchronousAuthenticatingTcpListener -{ -public: - int Main() - { - - // Create an IPv4 TCP/IP socket. - TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 ); - - // Listen for incoming connections. - listener->Start(); - while ( true ) - { - TcpClient^ clientRequest = nullptr; - - // Application blocks while waiting for an incoming connection. - // Type CNTL-C to terminate the server. - clientRequest = listener->AcceptTcpClient(); - Console::WriteLine( L"Client connected." ); - - // A client has connected. - try - { - AuthenticateClient( clientRequest ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - continue; - } - - } - } - - - // - static void AuthenticateClient( TcpClient^ clientRequest ) - { - NetworkStream^ stream = clientRequest->GetStream(); - - // Create the NegotiateStream. - NegotiateStream^ authStream = gcnew NegotiateStream( stream,false ); - - // Save the current client and NegotiateStream instance - // in a ClientState object. - ClientState^ cState = gcnew ClientState( authStream,clientRequest ); - - // Listen for the client authentication request. - authStream->BeginAuthenticateAsServer( gcnew AsyncCallback( EndAuthenticateCallback ), cState ); - - // Wait until the authentication completes. - cState->Waiter->WaitOne(); - cState->Waiter->Reset(); - authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState ); - cState->Waiter->WaitOne(); - - // Finished with the current client. - authStream->Close(); - clientRequest->Close(); - } - - - // - // The following method is invoked by the - // BeginServerAuthenticate callback delegate. - // - static void EndAuthenticateCallback( IAsyncResult^ ar ) - { - - // Get the saved data. - ClientState^ cState = dynamic_cast(ar->AsyncState); - TcpClient^ clientRequest = cState->Client; - NegotiateStream^ authStream = dynamic_cast(cState->AuthStream); - Console::WriteLine( L"Ending authentication." ); - - // Any exceptions that occurred during authentication are - // thrown by the EndServerAuthenticate method. - try - { - - // This call blocks until the authentication is complete. - authStream->EndAuthenticateAsServer( ar ); - } - catch ( AuthenticationException^ e ) - { - Console::WriteLine( e ); - Console::WriteLine( L"Authentication failed - closing connection." ); - cState->Waiter->Set(); - return; - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - Console::WriteLine( L"Closing connection." ); - cState->Waiter->Set(); - return; - } - - - // Display properties of the authenticated client. - IIdentity^ id = authStream->RemoteIdentity; - Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType ); - cState->Waiter->Set(); - } - - - // - // - static void EndReadCallback( IAsyncResult^ ar ) - { - - // Get the saved data. - ClientState^ cState = dynamic_cast(ar->AsyncState); - TcpClient^ clientRequest = cState->Client; - NegotiateStream^ authStream = dynamic_cast(cState->AuthStream); - - // Get the buffer that stores the message sent by the client. - int bytes = -1; - - // Read the client message. - try - { - bytes = authStream->EndRead( ar ); - cState->Message->Append( Encoding::UTF8->GetChars( cState->Buffer, 0, bytes ) ); - if ( bytes != 0 ) - { - authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState ); - return; - } - } - catch ( Exception^ e ) - { - - // A real application should do something - // useful here, such as logging the failure. - Console::WriteLine( L"Client message exception:" ); - Console::WriteLine( e ); - cState->Waiter->Set(); - return; - } - - IIdentity^ id = authStream->RemoteIdentity; - Console::WriteLine( L"{0} says {1}", id->Name, cState->Message ); - cState->Waiter->Set(); - } - - // -}; - -void main() -{ - AsynchronousAuthenticatingTcpListener^ aatl = gcnew AsynchronousAuthenticatingTcpListener; - aatl->Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp deleted file mode 100644 index 1a0a913e1d9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Principal; - -// -static void DisplayStreamProperties( NegotiateStream^ stream ) -{ - Console::WriteLine( L"Can read: {0}", stream->CanRead ); - Console::WriteLine( L"Can write: {0}", stream->CanWrite ); - Console::WriteLine( L"Can seek: {0}", stream->CanSeek ); - try - { - - // If the underlying stream supports it, display the length. - Console::WriteLine( L"Length: {0}", stream->Length ); - } - catch ( NotSupportedException^ ) - { - Console::WriteLine( L"Cannot get the length of the underlying stream." ); - } - - if ( stream->CanTimeout ) - { - Console::WriteLine( L"Read time-out: {0}", stream->ReadTimeout ); - Console::WriteLine( L"Write time-out: {0}", stream->WriteTimeout ); - } -} - - -// -// -static void DisplayAuthenticationProperties( NegotiateStream^ stream ) -{ - Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated ); - Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated ); - Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted ); - Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); - Console::WriteLine( L"ImpersonationLevel: {0}", stream->ImpersonationLevel ); - Console::WriteLine( L"IsServer: {0}", stream->IsServer ); -} - - -// -// -int main() -{ - - // - // Establish the remote endpoint for the socket. - // For this example, use the local machine. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - - // Client and server use port 11000. - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - TcpClient^ client = gcnew TcpClient; - - // Connect the socket to the remote endpoint. - client->Connect( remoteEP ); - Console::WriteLine( L"Client connected to {0}.", remoteEP ); - - // Ensure the client does not close when there is - // still data to be sent to the server. - client->LingerState = (gcnew LingerOption( true,0 )); - - // Request authentication. - NetworkStream^ clientStream = client->GetStream(); - NegotiateStream^ authStream = gcnew NegotiateStream( clientStream ); - - // Request authentication for the client only (no mutual authentication). - // Authenicate using the client's default credetials. - // Permit the server to impersonate the client to access resources on the server only. - // Request that data be transmitted using encryption and data signing. - authStream->AuthenticateAsClient( dynamic_cast(CredentialCache::DefaultCredentials), - L"", - ProtectionLevel::EncryptAndSign, - TokenImpersonationLevel::Impersonation ); - - // - DisplayAuthenticationProperties( authStream ); - DisplayStreamProperties( authStream ); - if ( authStream->CanWrite ) - { - - // Encode the test data into a byte array. - array^message = System::Text::Encoding::UTF8->GetBytes( L"Hello from the client." ); - authStream->Write( message, 0, message->Length ); - authStream->Flush(); - Console::WriteLine( L"Sent {0} bytes.", message->Length ); - } - - - // Close the client connection. - authStream->Close(); - Console::WriteLine( L"Client closed." ); -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp deleted file mode 100644 index b02ceda8bc7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Principal; -using namespace System::Text; -using namespace System::IO; -using namespace System::Threading; - -// -static void AuthenticateClient( TcpClient^ clientRequest ) -{ - NetworkStream^ stream = clientRequest->GetStream(); - - // Create the NegotiateStream. - NegotiateStream^ authStream = gcnew NegotiateStream( stream,false ); - - // Perform the server side of the authentication. - authStream->AuthenticateAsServer(); - - // Display properties of the authenticated client. - IIdentity^ id = authStream->RemoteIdentity; - Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType ); - - // Read a message from the client. - array^buffer = gcnew array(2048); - int charLength = authStream->Read( buffer, 0, buffer->Length ); - String^ messageData = gcnew String( Encoding::UTF8->GetChars( buffer, 0, buffer->Length ) ); - Console::WriteLine( L"READ {0}", messageData ); - - // Finished with the current client. - authStream->Close(); - - // Close the client connection. - clientRequest->Close(); -} - - -// -int main() -{ - - // Create an IPv4 TCP/IP socket. - TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 ); - - // Listen for incoming connections. - listener->Start(); - while ( true ) - { - TcpClient^ clientRequest = nullptr; - - // Application blocks while waiting for an incoming connection. - // Type CNTL-C to terminate the server. - clientRequest = listener->AcceptTcpClient(); - - // A client has connected. - try - { - AuthenticateClient( clientRequest ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - continue; - } - - Console::WriteLine( L"Client connected." ); - } -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp deleted file mode 100644 index 8a961ac9aff..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Text; - -// -// The following class displays the properties of an authenticatedStream. -public ref class AuthenticatedStreamReporter -{ -public: - static void DisplayProperties( AuthenticatedStream^ stream ) - { - Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated ); - Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated ); - Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted ); - Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); - Console::WriteLine( L"IsServer: {0}", stream->IsServer ); - } - -}; - - -// -public ref class ASynchronousAuthenticatingTcpClient -{ -private: - static TcpClient^ client = nullptr; - -public: - void Main() - { - - // - // - // Establish the remote endpoint for the socket. - // For this example, use the local machine. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - - // Client and server use port 11000. - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - client = gcnew TcpClient; - - // Connect the socket to the remote endpoint. - client->Connect( remoteEP ); - Console::WriteLine( L"Client connected to {0}.", remoteEP ); - - // Ensure the client does not close when there is - // still data to be sent to the server. - client->LingerState = (gcnew LingerOption( true,0 )); - - // - // Request authentication. - NetworkStream^ clientStream = client->GetStream(); - NegotiateStream^ authStream = gcnew NegotiateStream( clientStream,false ); - - // - // Pass the NegotiateStream as the AsyncState object - // so that it is available to the callback delegate. - IAsyncResult^ ar = authStream->BeginAuthenticateAsClient( gcnew AsyncCallback( EndAuthenticateCallback ), authStream ); - - // - Console::WriteLine( L"Client waiting for authentication..." ); - - // Wait until the result is available. - ar->AsyncWaitHandle->WaitOne(); - - // Display the properties of the authenticated stream. - AuthenticatedStreamReporter::DisplayProperties( authStream ); - - // Send a message to the server. - // Encode the test data into a byte array. - array^message = Encoding::UTF8->GetBytes( L"Hello from the client." ); - ar = authStream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( EndWriteCallback ), authStream ); - - // - ar->AsyncWaitHandle->WaitOne(); - Console::WriteLine( L"Sent {0} bytes.", message->Length ); - - // Close the client connection. - authStream->Close(); - Console::WriteLine( L"Client closed." ); - } - - - // - // The following method is called when the authentication completes. - static void EndAuthenticateCallback( IAsyncResult^ ar ) - { - Console::WriteLine( L"Client ending authentication..." ); - NegotiateStream^ authStream = dynamic_cast(ar->AsyncState); - - // End the asynchronous operation. - authStream->EndAuthenticateAsClient( ar ); - - // Console.WriteLine("AllowedImpersonation: {0}", authStream.AllowedImpersonation); - } - - - // - // - // The following method is called when the write operation completes. - static void EndWriteCallback( IAsyncResult^ ar ) - { - Console::WriteLine( L"Client ending write operation..." ); - NegotiateStream^ authStream = dynamic_cast(ar->AsyncState); - - // End the asynchronous operation. - authStream->EndWrite( ar ); - } - - // -}; - -void main() -{ - ASynchronousAuthenticatingTcpClient^ aatc = gcnew ASynchronousAuthenticatingTcpClient; - aatc->Main(); -} -// - diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp deleted file mode 100644 index ee93819179c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::NetworkInformation; -void AddressChangedCallback( Object^ /*sender*/, EventArgs^ /*e*/ ) -{ - array^adapters = NetworkInterface::GetAllNetworkInterfaces(); - System::Collections::IEnumerator^ myEnum = adapters->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - NetworkInterface^ n = safe_cast(myEnum->Current); - Console::WriteLine( " {0} is {1}", n->Name, n->OperationalStatus ); - } -} - -int main() -{ - NetworkChange::NetworkAddressChanged += gcnew NetworkAddressChangedEventHandler( AddressChangedCallback ); - Console::WriteLine( "Listening for address changes. Press any key to exit." ); - Console::ReadLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp deleted file mode 100644 index c38764723e0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// NclNetworkInfoPerms -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::NetworkInformation; -static void CreatePermission() -{ - - // - // - // - // - System::Net::NetworkInformation::NetworkInformationPermission^ unrestricted = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::Unrestricted ); - - // - Console::WriteLine( L"Is unrestricted? {0}", unrestricted->IsUnrestricted() ); - - // - // - // - System::Net::NetworkInformation::NetworkInformationPermission^ read = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read ); - - // - System::Net::NetworkInformation::NetworkInformationPermission^ copyPermission = dynamic_cast(read->Copy()); - - // - System::Net::NetworkInformation::NetworkInformationPermission^ unionPermission = dynamic_cast(read->Union( unrestricted )); - Console::WriteLine( L"Is subset?{0}", read->IsSubsetOf( unionPermission ) ); - - // - System::Net::NetworkInformation::NetworkInformationPermission^ intersectPermission = dynamic_cast(read->Intersect( unrestricted )); - - // - // - System::Net::NetworkInformation::NetworkInformationPermission^ permission = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::None ); - permission->AddPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read ); - Console::WriteLine( L"Access is {0}", permission->Access ); - - // -} - -int main() -{ - CreatePermission(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp b/snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp deleted file mode 100644 index 813df811c21..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -//NCLPingAsync -// -#using - -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::NetworkInformation; -using namespace System::ComponentModel; -using namespace System::Threading; -void PingCompletedCallback( Object^ sender, PingCompletedEventArgs^ e ); -void DisplayReply( PingReply^ reply ); -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length == 1 ) - throw gcnew ArgumentException( "Ping needs a host or IP Address." ); - - String^ who = args[ 1 ]; - AutoResetEvent^ waiter = gcnew AutoResetEvent( false ); - - // - Ping ^ pingSender = gcnew Ping; - - // When the PingCompleted event is raised, - // the PingCompletedCallback method is called. - pingSender->PingCompleted += gcnew PingCompletedEventHandler( PingCompletedCallback ); - - // - // Create a buffer of 32 bytes of data to be transmitted. - String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - array^buffer = Encoding::ASCII->GetBytes( data ); - - // Wait 12 seconds for a reply. - int timeout = 12000; - - // - // Set options for transmission: - // The data can go through 64 gateways or routers - // before it is destroyed, and the data packet - // cannot be fragmented. - PingOptions ^ options = gcnew PingOptions( 64,true ); - Console::WriteLine( "Time to live: {0}", options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", options->DontFragment ); - - // - // Send the ping asynchronously. - // Use the waiter as the user token. - // When the callback completes, it can wake up this thread. - pingSender->SendAsync( who, timeout, buffer, options, waiter ); - - // Prevent this example application from ending. - // A real application should do something useful - // when possible. - waiter->WaitOne(); - Console::WriteLine( "Ping example completed." ); -} - - -// -void PingCompletedCallback( Object^ /*sender*/, PingCompletedEventArgs^ e ) -{ - - // If the operation was canceled, display a message to the user. - if ( e->Cancelled ) - { - Console::WriteLine( "Ping canceled." ); - - // Let the main thread resume. - // UserToken is the AutoResetEvent object that the main thread - // is waiting for. - (dynamic_cast(e->UserState))->Set(); - } - - - // If an error occurred, display the exception to the user. - if ( e->Error != nullptr ) - { - Console::WriteLine( "Ping failed:" ); - Console::WriteLine( e->Error->ToString() ); - - // Let the main thread resume. - (dynamic_cast(e->UserState))->Set(); - } - - PingReply ^ reply = e->Reply; - DisplayReply( reply ); - - // Let the main thread resume. - (dynamic_cast(e->UserState))->Set(); -} - - -// -// -void DisplayReply( PingReply ^ reply ) -{ - if ( reply == nullptr ) - return; - - Console::WriteLine( "ping status: {0}", reply->Status ); - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp b/snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp deleted file mode 100644 index 49704c6adde..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -//NCLPingSync -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::NetworkInformation; -using namespace System::Text; - -// args[1] can be an IPaddress or host name. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // - // - Ping ^ pingSender = gcnew Ping; - PingOptions ^ options = gcnew PingOptions; - - // Use the default Ttl value which is 128, - // but change the fragmentation behavior. - options->DontFragment = true; - - // - // Create a buffer of 32 bytes of data to be transmitted. - String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - array^buffer = Encoding::ASCII->GetBytes( data ); - int timeout = 120; - PingReply ^ reply = pingSender->Send( args[ 1 ], timeout, buffer, options ); - - // - // - if ( reply->Status == IPStatus::Success ) - { - Console::WriteLine( "Address: {0}", reply->Address->ToString() ); - Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); - Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); - Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); - Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); - } - - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp deleted file mode 100644 index a1c1e3ff508..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp +++ /dev/null @@ -1,337 +0,0 @@ - -// NclSslClientAsync -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Authentication; -using namespace System::Text; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; - -// The following example demonstrates the client side of a -// client-server application that communicates using the -// SslStream and TcpClient classes. -// After connecting to the server and authenticating, -// the client sends the server a message, receives a message from the server, -// and then terminates. Messages sent to and from the server are terminated -// with ''. -public ref class SslTcpClient -{ -private: - - // certificateErrors holds the mapping of Win32 results to descriptive strings. - // It is used by the CertificateErrorDescription method. - static Hashtable^ certificateErrors = gcnew Hashtable; - - // complete is used to terminate the application when all - // asynchronous calls have completed or any call has thrown an exception. - // complete might be used by any of the callback methods. - static bool complete = false; - - // e stores any exception thrown by an asynchronous method so that - // the mail application thread can display the exception and terminate gracefully. - // e might be used by any of the callback methods. - static Exception^ e = nullptr; - - // - // readData and buffer holds the data read from the server. - // They is used by the ReadCallback method. - static StringBuilder^ readData = gcnew StringBuilder; - static array^buffer = gcnew array(2048); - - // - // - // Load a table of errors that might cause the certificate authentication to fail. - static void InitializeCertificateErrors() - { - certificateErrors->Add( 0x800B0101, L"The certification has expired." ); - certificateErrors->Add( 0x800B0104, L"A path length constraint in the certification chain has been violated." ); - certificateErrors->Add( 0x800B0105, L"A certificate contains an unknown extension that is marked critical." ); - certificateErrors->Add( 0x800B0107, L"A parent of a given certificate in fact did not issue that child certificate." ); - certificateErrors->Add( 0x800B0108, L"A certificate is missing or has an empty value for a necessary field." ); - certificateErrors->Add( 0x800B0109, L"The certificate root is not trusted." ); - certificateErrors->Add( 0x800B010C, L"The certificate has been revoked." ); - certificateErrors->Add( 0x800B010F, L"The name in the certificate does not not match the host name requested by the client." ); - certificateErrors->Add( 0x800B0111, L"The certificate was explicitly marked as untrusted by the user." ); - certificateErrors->Add( 0x800B0112, L"A certification chain processed correctly, but one of the CA certificates is not trusted." ); - certificateErrors->Add( 0x800B0113, L"The certificate has an invalid policy." ); - certificateErrors->Add( 0x800B0114, L"The certificate name is either not in the permitted list or is explicitly excluded." ); - certificateErrors->Add( 0x80092012, L"The revocation function was unable to check revocation for the certificate." ); - certificateErrors->Add( 0x80090327, L"An unknown error occurred while processing the certificate." ); - certificateErrors->Add( 0x80096001, L"A system-level error occurred while verifying trust." ); - certificateErrors->Add( 0x80096002, L"The certificate for the signer of the message is invalid or not found." ); - certificateErrors->Add( 0x80096003, L"One of the counter signatures was invalid." ); - certificateErrors->Add( 0x80096004, L"The signature of the certificate cannot be verified." ); - certificateErrors->Add( 0x80096005, L"The time stamp signature or certificate could not be verified or is malformed." ); - certificateErrors->Add( 0x80096010, L"The digital signature of the object was not verified." ); - certificateErrors->Add( 0x80096019, L"The basic constraint extension of a certificate has not been observed." ); - } - - static String^ CertificateErrorDescription( int problem ) - { - - // Initialize the error message dictionary if it is not yet available. - if ( certificateErrors->Count == 0 ) - { - InitializeCertificateErrors(); - } - - String^ description = dynamic_cast(certificateErrors[ problem ]); - if ( description == nullptr ) - { - description = String::Format( L"Unknown certificate error - 0x{0:x8}", problem ); - } - - return description; - } - - -public: - - // The following method is invoked by the CertificateValidationDelegate. - static bool ValidateServerCertificate( - Object^ sender, - X509Certificate^ certificate, - X509Chain^ chain, - SslPolicyErrors sslPolicyErrors) - { - - Console::WriteLine("Validating the server certificate."); - if (sslPolicyErrors == SslPolicyErrors::None) - return true; - - Console::WriteLine("Certificate error: {0}", sslPolicyErrors); - - // Do not allow this client to communicate with unauthenticated servers. - return false; - } - - // - // - static X509Certificate^ SelectLocalCertificate( - Object^ sender, - String^ targetHost, - X509CertificateCollection^ localCertificates, - X509Certificate^ remoteCertificate, - array^ acceptableIssuers - ) - { - Console::WriteLine("Client is selecting a local certificate."); - if (acceptableIssuers != nullptr && - acceptableIssuers->Length > 0 && - localCertificates != nullptr && - localCertificates->Count > 0) - { - // Use the first certificate that is from an acceptable issuer. - IEnumerator^ myEnum1 = localCertificates->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - X509Certificate^ certificate = safe_cast(myEnum1->Current); - String^ issuer = certificate->Issuer; - if ( Array::IndexOf( acceptableIssuers, issuer ) != -1 ) - return certificate; - } - } - if (localCertificates != nullptr && - localCertificates->Count > 0) - return localCertificates[0]; - - return nullptr; - } - - // - // - static void AuthenticateCallback( IAsyncResult^ ar ) - { - SslStream^ stream = dynamic_cast(ar->AsyncState); - try - { - stream->EndAuthenticateAsClient( ar ); - Console::WriteLine( L"Authentication succeeded." ); - Console::WriteLine( L"Cipher: {0} strength {1}", stream->CipherAlgorithm, stream->CipherStrength ); - Console::WriteLine( L"Hash: {0} strength {1}", stream->HashAlgorithm, stream->HashStrength ); - Console::WriteLine( L"Key exchange: {0} strength {1}", stream->KeyExchangeAlgorithm, stream->KeyExchangeStrength ); - Console::WriteLine( L"Protocol: {0}", stream->SslProtocol ); - - // Encode a test message into a byte array. - // Signal the end of the message using the "". - array^message = Encoding::UTF8->GetBytes( L"Hello from the client." ); - - // Asynchronously send a message to the server. - stream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( WriteCallback ), stream ); - } - catch ( Exception^ authenticationException ) - { - e = authenticationException; - complete = true; - return; - } - - } - - - // - // - static void WriteCallback( IAsyncResult^ ar ) - { - SslStream^ stream = dynamic_cast(ar->AsyncState); - try - { - Console::WriteLine( L"Writing data to the server." ); - stream->EndWrite( ar ); - - // Asynchronously read a message from the server. - stream->BeginRead( buffer, 0, buffer->Length, gcnew AsyncCallback( ReadCallback ), stream ); - } - catch ( Exception^ writeException ) - { - e = writeException; - complete = true; - return; - } - - } - - - // - // - static void ReadCallback( IAsyncResult^ ar ) - { - - // Read the message sent by the server. - // The end of the message is signaled using the - // "" marker. - SslStream^ stream = dynamic_cast(ar->AsyncState); - int byteCount = -1; - try - { - Console::WriteLine( L"Reading data from the server." ); - byteCount = stream->EndRead( ar ); - - // Use Decoder class to convert from bytes to UTF8 - // in case a character spans two buffers. - Decoder^ decoder = Encoding::UTF8->GetDecoder(); - array^chars = gcnew array(decoder->GetCharCount( buffer, 0, byteCount )); - decoder->GetChars( buffer, 0, byteCount, chars, 0 ); - readData->Append( chars ); - - // Check for EOF or an empty message. - if ( readData->ToString()->IndexOf( L"" ) == -1 && byteCount != 0 ) - { - - // We are not finished reading. - // Asynchronously read more message data from the server. - stream->BeginRead( buffer, 0, buffer->Length, gcnew AsyncCallback( ReadCallback ), stream ); - } - else - { - Console::WriteLine( L"Message from the server: {0}", readData ); - } - } - catch ( Exception^ readException ) - { - e = readException; - complete = true; - return; - } - - complete = true; - } - - - // - // - int TestNclSslClient() - { - array^args = Environment::GetCommandLineArgs(); - String^ serverName = nullptr; - if ( args == nullptr || args->Length < 3 ) - { - Console::WriteLine( L"To start the client specify the host name and" - L" one or more client certificate file names." ); - return 1; - } - - - // - // Server name must match the host name and the name on the host's certificate. - serverName = args[ 1 ]; - - // Create a TCP/IP client socket. - TcpClient^ client = gcnew TcpClient( serverName,5000 ); - Console::WriteLine( L"Client connected." ); - - // Create an SSL stream that will close the client's stream. - SslStream^ sslStream = gcnew SslStream( - client->GetStream(), - false, - gcnew RemoteCertificateValidationCallback( ValidateServerCertificate ), - gcnew LocalCertificateSelectionCallback( SelectLocalCertificate ) ); - - // - // Create the certificate collection to hold the client's certificate. - X509CertificateCollection^ clientCertificates = gcnew X509CertificateCollection; - for ( int i = 2; i < args->Length; i++ ) - { - X509Certificate^ certificate = X509Certificate::CreateFromCertFile( args[ i ] ); - clientCertificates->Add( certificate ); - - } - - // The server name must match the name on the server certificate. - sslStream->BeginAuthenticateAsClient( - serverName, - clientCertificates, - SslProtocols::Ssl3, - true, - gcnew AsyncCallback( AuthenticateCallback ), - sslStream ); - - // User can press a key to exit application, or let the - // asynchronous calls continue until they complete. - Console::WriteLine( L"To quit, press the enter key." ); - do - { - - // Real world applications would do work here - // while waiting for the asynchronous calls to complete. - System::Threading::Thread::Sleep( 100 ); - } - while ( !complete && !Console::KeyAvailable ); - - if ( Console::KeyAvailable ) - { - Console::ReadLine(); - Console::WriteLine( L"Quitting." ); - client->Close(); - sslStream->Close(); - return 1; - } - - if ( e != nullptr ) - { - Console::WriteLine( L"An exception was thrown: {0}", e ); - } - - sslStream->Close(); - client->Close(); - Console::WriteLine( L"Good bye." ); - return 0; - } - - // -}; - - -// -int main() -{ - SslTcpClient^ stc = gcnew SslTcpClient; - stc->TestNclSslClient(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp deleted file mode 100644 index 3287346e00c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp +++ /dev/null @@ -1,260 +0,0 @@ -// NclSslClientSync -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Globalization; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Authentication; -using namespace System::Text; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; - -namespace NlsClientSync -{ - public ref class SslTcpClient - { - private: - static Hashtable^ certificateErrors = gcnew Hashtable; - // - // Load a table of errors that might cause - // the certificate authentication to fail. - static void InitializeCertificateErrors() - { - certificateErrors->Add(0x800B0101, - "The certification has expired."); - certificateErrors->Add(0x800B0104, - "A path length constraint " - "in the certification chain has been violated."); - certificateErrors->Add(0x800B0105, - "A certificate contains an unknown extension " - "that is marked critical."); - certificateErrors->Add(0x800B0107, - "A parent of a given certificate in fact " - "did not issue that child certificate."); - certificateErrors->Add(0x800B0108, - "A certificate is missing or has an empty value " - "for a necessary field."); - certificateErrors->Add(0x800B0109, - "The certificate root is not trusted."); - certificateErrors->Add(0x800B010C, - "The certificate has been revoked."); - certificateErrors->Add(0x800B010F, - "The name in the certificate does not not match " - "the host name requested by the client."); - certificateErrors->Add(0x800B0111, - "The certificate was explicitly marked " - "as untrusted by the user."); - certificateErrors->Add(0x800B0112, - "A certification chain processed correctly, " - "but one of the CA certificates is not trusted."); - certificateErrors->Add(0x800B0113, - "The certificate has an invalid policy."); - certificateErrors->Add(0x800B0114, - "The certificate name is either not " - "in the permitted list or is explicitly excluded."); - certificateErrors->Add(0x80092012, - "The revocation function was unable to check " - "revocation for the certificate."); - certificateErrors->Add(0x80090327, - "An unknown error occurred while " - "processing the certificate."); - certificateErrors->Add(0x80096001, - "A system-level error occurred " - "while verifying trust."); - certificateErrors->Add(0x80096002, - "The certificate for the signer of the message " - "is invalid or not found."); - certificateErrors->Add(0x80096003, - "One of the counter signatures was invalid."); - certificateErrors->Add(0x80096004, - "The signature of the certificate " - "cannot be verified."); - certificateErrors->Add(0x80096005, - "The time stamp signature or certificate " - "could not be verified or is malformed."); - certificateErrors->Add(0x80096010, - "The digital signature of the object " - "was not verified."); - certificateErrors->Add(0x80096019, - "The basic constraint extension of a certificate " - "has not been observed."); - } - - static String^ CertificateErrorDescription(UInt32 problem) - { - // Initialize the error message dictionary - // if it is not yet available. - if (certificateErrors->Count == 0) - { - InitializeCertificateErrors(); - } - - String^ description = safe_cast( - certificateErrors[problem]); - if (description == nullptr) - { - description = String::Format( - CultureInfo::CurrentCulture, - "Unknown certificate error - 0x{0:x8}", - problem); - } - - return description; - } - - public: - // The following method is invoked - // by the CertificateValidationDelegate. - static bool ValidateServerCertificate( - Object^ sender, - X509Certificate^ certificate, - X509Chain^ chain, - SslPolicyErrors sslPolicyErrors) - { - - Console::WriteLine("Validating the server certificate."); - if (sslPolicyErrors == SslPolicyErrors::None) - return true; - - Console::WriteLine("Certificate error: {0}", sslPolicyErrors); - - // Do not allow this client to communicate with unauthenticated servers. - return false; - } - // - - // - static void RunClient(String^ machineName, String^ serverName) - { - - // - // - // Create a TCP/IP client socket. - // machineName is the host running the server application. - TcpClient^ client = gcnew TcpClient(machineName, 5000); - Console::WriteLine("Client connected."); - - // Create an SSL stream that will close - // the client's stream. - SslStream^ sslStream = gcnew SslStream( - client->GetStream(), false, - gcnew RemoteCertificateValidationCallback(ValidateServerCertificate), - nullptr); - - // The server name must match the name - // on the server certificate. - try - { - sslStream->AuthenticateAsClient(serverName); - } - catch (AuthenticationException^ ex) - { - Console::WriteLine("Exception: {0}", ex->Message); - if (ex->InnerException != nullptr) - { - Console::WriteLine("Inner exception: {0}", - ex->InnerException->Message); - } - - Console::WriteLine("Authentication failed - " - "closing the connection."); - sslStream->Close(); - client->Close(); - return; - } - // - // Encode a test message into a byte array. - // Signal the end of the message using the "". - array^ messsage = Encoding::UTF8->GetBytes( - "Hello from the client."); - - // Send hello message to the server. - sslStream->Write(messsage); - sslStream->Flush(); - // - // Read message from the server. - String^ serverMessage = ReadMessage(sslStream); - Console::WriteLine("Server says: {0}", serverMessage); - - // Close the client connection. - sslStream->Close(); - client->Close(); - Console::WriteLine("Client closed."); - } - // - // - private: - static String^ ReadMessage(SslStream^ sslStream) - { - - // Read the message sent by the server. - // The end of the message is signaled using the - // "" marker. - array^ buffer = gcnew array(2048); - StringBuilder^ messageData = gcnew StringBuilder; - // Use Decoder class to convert from bytes to UTF8 - // in case a character spans two buffers. - Encoding^ u8 = Encoding::UTF8; - Decoder^ decoder = u8->GetDecoder(); - - int bytes = -1; - do - { - bytes = sslStream->Read(buffer, 0, buffer->Length); - - array<__wchar_t>^ chars = gcnew array<__wchar_t>( - decoder->GetCharCount(buffer, 0, bytes)); - decoder->GetChars(buffer, 0, bytes, chars, 0); - messageData->Append(chars); - - // Check for EOF. - if (messageData->ToString()->IndexOf("") != -1) - { - break; - } - } - while (bytes != 0); - - return messageData->ToString(); - } - // - }; -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - String^ serverCertificateName = nullptr; - String^ machineName = nullptr; - if (args == nullptr || args->Length < 2) - { - Console::WriteLine("To start the client specify:"); - Console::WriteLine("clientSync machineName [serverName]"); - return 1; - } - - // User can specify the machine name and server name. - // Server name must match the name on - // the server's certificate. - machineName = args[1]; - if (args->Length < 3) - { - serverCertificateName = machineName; - } - else - { - serverCertificateName = args[2]; - }; - - NlsClientSync::SslTcpClient::RunClient(machineName, - serverCertificateName); - - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp deleted file mode 100644 index b49960ce769..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp +++ /dev/null @@ -1,265 +0,0 @@ - -// NclSslServerAsync -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Net::Security; -using namespace System::Security::Authentication; -using namespace System::Text; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; - -// The following example demonstrates the server side of a -// client-server application that communicates using the -// SslStream, TcpListener, and TcpClient classes. -// After connecting to the server and authenticating, -// the server reads a message from the client, -// sends a message to the client, -// and then terminates. Messages sent to and from the client are terminated -// with ''. -// The ClientState class holds information shared -// by asynchronous calls. -// -public ref class ClientState -{ -internal: - SslStream^ stream; - TcpClient^ client; - StringBuilder^ readData; - array^buffer; - ClientState( SslStream^ stream, TcpClient^ client ) - { - this->stream = stream; - this->client = client; - readData = gcnew StringBuilder; - buffer = gcnew array(2048); - } - - void Close() - { - - // Close the SslStream. This will also close the - // NetworkStream allocated to the TcpClient. - stream->Close(); - - // Close the TcpClient. - client->Close(); - readData = nullptr; - buffer = nullptr; - Console::WriteLine( L"Client closed." ); - } - -}; - - -// -public ref class SslTcpListener -{ -public: - - // - // The following method is invoked by the CertificateValidationDelegate. - static bool ValidateCertificate( - Object^ sender, - X509Certificate^ certificate, - X509Chain^ chain, - SslPolicyErrors sslPolicyErrors) - { - if ( certificate == nullptr ) - { - - // Null certificate and no errors means that the client was not - // required to provide a certificate. - if ( sslPolicyErrors == SslPolicyErrors::None) - { - return true; - } - else - { - Console::WriteLine(L"Certificate error: {0}", sslPolicyErrors); - } - return false; - } - - Console::WriteLine( L"Server is validating certificate." ); - Console::WriteLine( L"Certificate was issued to {0} and is valid from {1} until {2}.", - certificate->Subject, - certificate->GetEffectiveDateString(), - certificate->GetExpirationDateString() ); - return true; - } - - - // - // - void AuthenticateCallback( IAsyncResult^ ar ) - { - ClientState^ state = dynamic_cast(ar->AsyncState); - SslStream^ stream = state->stream; - try - { - stream->EndAuthenticateAsServer( ar ); - Console::WriteLine( L"Authentication succeeded." ); - Console::WriteLine( L"Cipher: {0} strength {1}", stream->CipherAlgorithm, stream->CipherStrength ); - Console::WriteLine( L"Hash: {0} strength {1}", stream->HashAlgorithm, stream->HashStrength ); - Console::WriteLine( L"Key exchange: {0} strength {1}", stream->KeyExchangeAlgorithm, stream->KeyExchangeStrength ); - Console::WriteLine( L"Protocol: {0}", stream->SslProtocol ); - - // Asynchronously read a message from the client. - stream->BeginRead( state->buffer, 0, state->buffer->Length, gcnew AsyncCallback( this, &SslTcpListener::ReadCallback ), state ); - } - catch ( Exception^ authenticationException ) - { - Console::WriteLine( L"Authentication error: {0}", authenticationException->Message ); - if ( authenticationException->InnerException != nullptr ) - { - Console::WriteLine( L" Inner exception: {0}", authenticationException->InnerException->Message ); - } - state->Close(); - return; - } - - } - - - // - // - void WriteCallback( IAsyncResult^ ar ) - { - ClientState^ state = dynamic_cast(ar->AsyncState); - SslStream^ stream = state->stream; - try - { - Console::WriteLine( L"Writing data to the client." ); - stream->EndWrite( ar ); - } - catch ( Exception^ writeException ) - { - Console::WriteLine( L"Write error: {0}", writeException->Message ); - state->Close(); - return; - } - - Console::WriteLine( L"Finished with client." ); - state->Close(); - } - - - // - // - void ReadCallback( IAsyncResult^ ar ) - { - ClientState^ state = dynamic_cast(ar->AsyncState); - SslStream^ stream = state->stream; - - // Read the message sent by the client. - // The end of the message is signaled using the - // "" marker. - int byteCount = -1; - try - { - Console::WriteLine( L"Reading data from the client." ); - byteCount = stream->EndRead( ar ); - - // Use Decoder class to convert from bytes to UTF8 - // in case a character spans two buffers. - Decoder^ decoder = Encoding::UTF8->GetDecoder(); - array^chars = gcnew array(decoder->GetCharCount( state->buffer, 0, byteCount )); - decoder->GetChars( state->buffer, 0, byteCount, chars, 0 ); - state->readData->Append( chars ); - - // Check for EOF or an empty message. - if ( state->readData->ToString()->IndexOf( L"" ) == -1 && byteCount != 0 ) - { - - // We are not finished reading. - // Asynchronously read more message data from the client. - stream->BeginRead( state->buffer, 0, state->buffer->Length, gcnew AsyncCallback( this, &SslTcpListener::ReadCallback ), state ); - } - else - { - Console::WriteLine( L"Message from the client: {0}", state->readData ); - } - - // Encode a test message into a byte array. - // Signal the end of the message using "". - array^message = Encoding::UTF8->GetBytes( L"Hello from the server." ); - - // Asynchronously send the message to the client. - stream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( this, &SslTcpListener::WriteCallback ), state ); - } - catch ( Exception^ readException ) - { - Console::WriteLine( L"Read error: {0}", readException->Message ); - state->Close(); - return; - } - - } - - - // - // - void ProcessClient( ClientState^ state, X509Certificate^ serverCertificate ) - { - try - { - state->stream->BeginAuthenticateAsServer( - serverCertificate, true, SslProtocols::Tls, true, - gcnew AsyncCallback( this, &SslTcpListener::AuthenticateCallback ), state ); - } - catch ( Exception^ authenticationException ) - { - Console::WriteLine( L"Authentication error: {0}", authenticationException->Message ); - state->Close(); - return; - } - - } - - - // - // - int ServerSideTest() - { - array^args = Environment::GetCommandLineArgs(); - if ( args == nullptr || args->Length == 0 ) - { - Console::WriteLine( L"You must specify the server certificate file." ); - return 0; - } - - X509Certificate^ serverCertificate = X509Certificate::CreateFromCertFile( args[ 1 ] ); - - // Create a TCP/IP (IPv4) socket and listen for incoming connections. - TcpListener^ listener = gcnew TcpListener( IPAddress::Any,5000 ); - listener->Start(); - while ( true ) - { - - // Application blocks while waiting for an incoming connection. - // Type CNTL-C to terminate the server. - TcpClient^ client = listener->AcceptTcpClient(); - Console::WriteLine( L"Client connected." ); - SslStream^ stream = gcnew SslStream( client->GetStream(),false, - gcnew RemoteCertificateValidationCallback( ValidateCertificate ) ); - ClientState^ state = gcnew ClientState( stream,client ); - SslTcpListener^ listenerWorker = gcnew SslTcpListener; - listenerWorker->ProcessClient( state, serverCertificate ); - } - } - - // -}; - -int main() -{ - SslTcpListener^ stl = gcnew SslTcpListener; - stl->ServerSideTest(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp deleted file mode 100644 index 1a659c12fe2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp +++ /dev/null @@ -1,235 +0,0 @@ - -// NclSslServerSync -// -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Net::Security; -using namespace System::Security::Authentication; -using namespace System::Text; -using namespace System::Security::Cryptography::X509Certificates; -using namespace System::IO; -public ref class SslTcpServer sealed -{ -private: - static X509Certificate^ serverCertificate = nullptr; - -public: - - // The certificate parameter specifies the name of the file - // containing the machine certificate. - static void RunServer( String^ certificate ) - { - serverCertificate = X509Certificate::CreateFromCertFile( certificate ); - - // Create a TCP/IP (IPv4) socket and listen for incoming connections. - TcpListener^ listener = gcnew TcpListener( IPAddress::Any,5000 ); - listener->Start(); - - while (true) - { - Console::WriteLine( L"Waiting for a client to connect..." ); - - // Application blocks while waiting for an incoming connection. - // Type CNTL-C to terminate the server. - TcpClient^ client = listener->AcceptTcpClient(); - ProcessClient( client ); - - } - } - - - // - static void ProcessClient( TcpClient^ client ) - { - - // A client has connected. Create the - // SslStream using the client's network stream. - SslStream^ sslStream = gcnew SslStream( client->GetStream(),false ); - - // Authenticate the server but don't require the client to authenticate. - try - { - sslStream->AuthenticateAsServer( serverCertificate, false, true ); - // false == no client cert required; true == check cert revocation. - - // Display the properties and settings for the authenticated stream. - DisplaySecurityLevel( sslStream ); - DisplaySecurityServices( sslStream ); - DisplayCertificateInformation( sslStream ); - DisplayStreamProperties( sslStream ); - - // Set timeouts for the read and write to 5 seconds. - sslStream->ReadTimeout = 5000; - sslStream->WriteTimeout = 5000; - - // Read a message from the client. - Console::WriteLine( L"Waiting for client message..." ); - String^ messageData = ReadMessage( sslStream ); - Console::WriteLine( L"Received: {0}", messageData ); - - // Write a message to the client. - array^message = Encoding::UTF8->GetBytes( L"Hello from the server." ); - Console::WriteLine( L"Sending hello message." ); - sslStream->Write( message ); - } - catch ( AuthenticationException^ e ) - { - Console::WriteLine( L"Exception: {0}", e->Message ); - if ( e->InnerException != nullptr ) - { - Console::WriteLine( L"Inner exception: {0}", e->InnerException->Message ); - } - Console::WriteLine( L"Authentication failed - closing the connection." ); - sslStream->Close(); - client->Close(); - return; - } - finally - { - - // The client stream will be closed with the sslStream - // because we specified this behavior when creating - // the sslStream. - sslStream->Close(); - client->Close(); - } - - } - - - // - // - static String^ ReadMessage( SslStream^ sslStream ) - { - - // Read the message sent by the client. - // The client signals the end of the message using the - // "" marker. - array^buffer = gcnew array(2048); - StringBuilder^ messageData = gcnew StringBuilder; - int bytes = -1; - do - { - - // Read the client's test message. - bytes = sslStream->Read( buffer, 0, buffer->Length ); - - // Use Decoder class to convert from bytes to UTF8 - // in case a character spans two buffers. - Decoder^ decoder = Encoding::UTF8->GetDecoder(); - array^chars = gcnew array(decoder->GetCharCount( buffer, 0, bytes )); - decoder->GetChars( buffer, 0, bytes, chars, 0 ); - messageData->Append( chars ); - - // Check for EOF or an empty message. - if ( messageData->ToString()->IndexOf( L"" ) != -1 ) - { - break; - } - } - while ( bytes != 0 ); - - return messageData->ToString(); - } - - - // - // - static void DisplaySecurityLevel( SslStream^ stream ) - { - Console::WriteLine( L"Cipher: {0} strength {1}", stream->CipherAlgorithm, stream->CipherStrength ); - Console::WriteLine( L"Hash: {0} strength {1}", stream->HashAlgorithm, stream->HashStrength ); - Console::WriteLine( L"Key exchange: {0} strength {1}", stream->KeyExchangeAlgorithm, stream->KeyExchangeStrength ); - Console::WriteLine( L"Protocol: {0}", stream->SslProtocol ); - } - - - // - // - static void DisplaySecurityServices( SslStream^ stream ) - { - Console::WriteLine( L"Is authenticated: {0} as server? {1}", stream->IsAuthenticated, stream->IsServer ); - Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); - Console::WriteLine( L"Is Encrypted: {0}", stream->IsEncrypted ); - Console::WriteLine( L"Is mutually authenticated: {0}", stream->IsMutuallyAuthenticated ); - } - - - // - // - static void DisplayStreamProperties( SslStream^ stream ) - { - Console::WriteLine( L"Can read: {0}, write {1}", stream->CanRead, stream->CanWrite ); - Console::WriteLine( L"Can timeout: {0}", stream->CanTimeout ); - } - - - // - // - static void DisplayCertificateInformation( SslStream^ stream ) - { - Console::WriteLine( L"Certificate revocation list checked: {0}", stream->CheckCertRevocationStatus ); - X509Certificate^ localCertificate = stream->LocalCertificate; - if ( stream->LocalCertificate != nullptr ) - { - Console::WriteLine( L"Local cert was issued to {0} and is valid from {1} until {2}.", - localCertificate->Subject, - localCertificate->GetEffectiveDateString(), - localCertificate->GetExpirationDateString() ); - } - else - { - Console::WriteLine( L"Local certificate is null." ); - } - - X509Certificate^ remoteCertificate = stream->RemoteCertificate; - if ( stream->RemoteCertificate != nullptr ) - { - Console::WriteLine( L"Remote cert was issued to {0} and is valid from {1} until {2}.", - remoteCertificate->Subject, - remoteCertificate->GetEffectiveDateString(), - remoteCertificate->GetExpirationDateString() ); - } - else - { - Console::WriteLine( L"Remote certificate is null." ); - } - } - - -private: - - // - static void DisplayUsage() - { - Console::WriteLine( L"To start the server specify:" ); - Console::WriteLine( L"serverSync certificateFile.cer" ); - Environment::Exit( 1 ); - } - -public: - int RunServerASync() - { - array^args = Environment::GetCommandLineArgs(); - String^ certificate = nullptr; - if ( args == nullptr || args->Length < 2 ) - { - DisplayUsage(); - } - - certificate = args[ 1 ]; - SslTcpServer::RunServer( certificate ); - return 0; - } - -}; - -int main(){ - SslTcpServer^ sts = gcnew SslTcpServer(); - sts->RunServerASync(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp b/snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp deleted file mode 100644 index 1cf6a399da6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -#using -using namespace System; -using namespace System::Text; -using namespace System::Net; -using namespace System::Net::Sockets; - -int main() -{ - // Create the server side connection and - // start listening for clients. - TcpListener^ tcpListener = gcnew TcpListener(IPAddress::Any, 11000); - tcpListener->Start(); - Console::WriteLine("Waiting for a connection...."); - - // Accept the pending client connection. - TcpClient^ tcpClient = tcpListener->AcceptTcpClient(); - Console::WriteLine("Connection accepted."); - // Get the stream to write the message - // that will be sent to the client. - NetworkStream^ networkStream = tcpClient->GetStream(); - String^ responseString = "Hello."; - // Set the write timeout to 10 millseconds. - networkStream->WriteTimeout = 10; - // Convert the message to a byte array and sent it to the client. - array^ sendBytes = Encoding::UTF8->GetBytes(responseString); - networkStream->Write(sendBytes, 0, sendBytes->Length); - Console::WriteLine("Message Sent."); - // Close the connection to the client. - tcpClient->Close(); - // Stop listening for incoming connections - // and close the server. - tcpListener->Stop(); - - // Dispose allocated resources. - delete networkStream; - delete tcpClient; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp b/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp deleted file mode 100644 index 1418ec5d414..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp +++ /dev/null @@ -1,43 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::IO; - -public ref class Forest -{ - // Set the NestingLevel for each array. The first - // attribute (NestingLevel = 0) is optional. -public: - [XmlArrayItem(ElementName = "tree", NestingLevel = 0)] - [XmlArrayItem(ElementName = "branch", NestingLevel = 1)] - [XmlArrayItem(ElementName = "leaf",NestingLevel = 2)] - array^>^>^ TreeArray; -}; - -int main() -{ - XmlSerializer^ serializer = gcnew XmlSerializer(Forest::typeid); - - Forest^ constructedForest = gcnew Forest(); - array^>^>^ tree = - gcnew array^>^>(2); - - array^>^ firstBranch = gcnew array^>(1); - firstBranch[0] = gcnew array{"One"}; - tree[0] = firstBranch; - - array^>^ secondBranch = gcnew array^>(2); - secondBranch[0] = gcnew array{"One","Two"}; - secondBranch[1] = gcnew array{"One","Two","Three"}; - tree[1] = secondBranch; - - constructedForest->TreeArray = tree; - - serializer->Serialize(Console::Out, constructedForest); -} - -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp deleted file mode 100644 index 91eb1c27dd6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System::Net::NetworkCredential::NetworkCredential(String*, String*) - -/*This program demontrates the 'NetworkCredential(String*, String*)' constructor of 'NetworkCredential' class. -It takes an URL, username, password and domainname from console and forms a 'NetworkCredential' Object* with -these arguments.Then a 'WebRequest' Object* is created and the 'NetworkCredential' Object* is associated with -it.A message is displayed onto the console on successful reception of response otherwise an exception is thrown. -*/ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url, String^ username, String^ passwd, String^ domain ) -{ - try - { -// - // Call the onstructor to create an instance of NetworkCredential with the - // specified user name and password. - NetworkCredential^ myCredentials = gcnew NetworkCredential( username,passwd ); - - // Create a WebRequest with the specified URL. - WebRequest^ myWebRequest = WebRequest::Create( url ); - myCredentials->Domain = domain; - myWebRequest->Credentials = myCredentials; - Console::WriteLine( "\n\nCredentials Domain : {0} , UserName : {1} , Password : {2}", - myCredentials->Domain, myCredentials->UserName, myCredentials->Password ); - Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response..." ); - - // Send the request and wait for a response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Process the response. - Console::WriteLine( "\nResponse received successfully." ); - - // Release the resources of the response object. - myWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException is raised. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 5 ) - { - Console::WriteLine( "\nPlease enter a protected resource Url and other details as command line parameter as below:" ); - Console::WriteLine( "\nUsage: NetworkCredential_Constructor2 URLname username password domainname" ); - Console::WriteLine( "\nExample: NetworkCredential_Constructor2 http://www.microsoft.com/net/ george george123 microsoft" ); - } - else - { - GetPage( args[ 1 ], args[ 2 ], args[ 3 ], args[ 4 ] ); - } - - Console::WriteLine( "\n\nPress 'Enter key' to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp deleted file mode 100644 index 4f1b295b678..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp +++ /dev/null @@ -1,68 +0,0 @@ - - -// System::Net::NetworkCredential::GetCredential -/*This program demontrates the 'GetCredential' of 'NetworkCredential' class. -It accepts an URL, username and password from console. Creates a 'NetworkCredential' Object* -using these parameters. A 'WebRequest' Object* is created to access the Uri S"http://www.microsoft.com" -and the 'NetworkCredential' Object* is assigned as it's Credentials. -A message is displayed onto the console on successful reception of response -otherwise an exception is thrown. -*/ - -#using - -using namespace System; -using namespace System::Net; - -void GetPage( String^ url, String^ userName, String^ password ) -{ - try - { -// - // Create an empty instance of the NetworkCredential class. - NetworkCredential^ myCredentials = gcnew NetworkCredential( userName,password ); - - // Create a webrequest with the specified URL. - WebRequest^ myWebRequest = WebRequest::Create( url ); - myWebRequest->Credentials = myCredentials->GetCredential( gcnew Uri( url ), "" ); - Console::WriteLine( "\n\nUser Credentials:- UserName : {0} , Password : {1}", - myCredentials->UserName, myCredentials->Password ); - - // Send the request and wait for a response. - Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response...Please wait ..." ); - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Process the response. - Console::WriteLine( "\nResponse received successfully" ); - - // Release the resources of the response object. - myWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException is raised. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 4 ) - { - Console::WriteLine( "\nPlease enter a protected resource Url and other details as* command line parameter as below:" ); - Console::WriteLine( "\nUsage: NetworkCredential_GetCredential URLname username password" ); - Console::WriteLine( "\nExample: NetworkCredential_GetCredential http://www.microsoft.com/net/ george george123" ); - } - else - { - GetPage( args[ 1 ], args[ 2 ], args[ 3 ] ); - } - - Console::WriteLine( "\n\nPress 'Enter' to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp deleted file mode 100644 index 73e255c77fa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -// System::Net::NetworkCredential::Username;System::Net::NetworkCredential::Domain;System::Net::NetworkCredential::Password -/*This program demontrates the 'UserName', 'Domain', and 'Password' properties of the 'NetworkCredential' class. -It takes an URL, username, password, and domain name from console. An empty 'NetworkCredential' Object* -is created. The 'UserName', 'Password', and 'Domain' porperties of the 'NetworkCredential' class are initialized -with the respective values taken from console. Then a 'WebRequest' Object* is created and the 'NetworkCredential' -Object* is associated with it. A message is displayed onto the console on successful reception of response -otherwise an exception is thrown. -*/ - -#using - -using namespace System; -using namespace System::Net; -void GetPage( String^ url, String^ username, String^ passwd, String^ domain ) -{ - try - { -// -// -// - // Create an empty instance of the NetworkCredential class. - NetworkCredential^ myCredentials = gcnew NetworkCredential( "","","" ); - myCredentials->Domain = domain; - myCredentials->UserName = username; - myCredentials->Password = passwd; - - // Create a WebRequest with the specified URL. - WebRequest^ myWebRequest = WebRequest::Create( url ); - myWebRequest->Credentials = myCredentials; - Console::WriteLine( "\n\nUser Credentials:- Domain : {0} , UserName : {1} , Password : {2}", - myCredentials->Domain, myCredentials->UserName, myCredentials->Password ); - - // Send the request and wait for a response. - Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response...Please wait ..." ); - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Process the response. - Console::WriteLine( "\nResponse received successfully" ); - - // Release the resources of the response object. - myWebResponse->Close(); -// -// -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException is raised. The Reason for failure is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 5 ) - { - Console::WriteLine( "\nPlease enter a protected resource Url and other details as command line parameter as below:" ); - Console::WriteLine( "\nUsage: NetworkCredential_UserName_Password_Domain URLname username password domainname" ); - Console::WriteLine( "\nExample: NetworkCredential_UserName_Password_Domain http://www.microsoft.com/net/ george george123 microsoft" ); - } - else - { - GetPage( args[ 1 ], args[ 2 ], args[ 3 ], args[ 4 ] ); - } - - Console::WriteLine( "\n\nPress 'Enter key' to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp deleted file mode 100644 index 17f565e5d3c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -ref class MyNetworkStream_Sub_Class: public NetworkStream -{ -public: - MyNetworkStream_Sub_Class( System::Net::Sockets::Socket^ socket, bool ownsSocket ) - : NetworkStream( socket, ownsSocket ) - { - } - - property bool IsConnected - { - // You can use the Socket method to examine the underlying Socket. - bool get() - { - return this->Socket->Connected; - } - } - - property bool CanCommunicate - { - bool get() - { - if ( !this->Readable | !this->Writeable ) - { - return false; - } - else - { - return true; - } - } - } -// - - static void DoSomethingSignificant() - { - // Do something significant in here - } - -}; - -int main() -{ - MyNetworkStream_Sub_Class::DoSomethingSignificant(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp deleted file mode 100644 index 24eb36c07d2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp +++ /dev/null @@ -1,108 +0,0 @@ -// The following sample is intended to demonstrate how to use a -//NetworkStream for synchronous communcation with a remote host -//This class uses several NetworkStream members that would be useful -// in a synchronous communciation senario - -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; - -void MySample( bool networkStreamOwnsSocket ) -{ - // Create a socket and connect with a remote host. - IPHostEntry^ myIpHostEntry = Dns::GetHostEntry( "www.contoso.com" ); - IPEndPoint^ myIpEndPoint = gcnew IPEndPoint( myIpHostEntry->AddressList[ 0 ],1001 ); - - Socket^ mySocket = gcnew Socket( myIpEndPoint->Address->AddressFamily, - SocketType::Stream, - ProtocolType::Tcp ); - try - { - mySocket->Connect( myIpEndPoint ); - - NetworkStream^ myNetworkStream; - if ( networkStreamOwnsSocket ) - { - myNetworkStream = gcnew NetworkStream( mySocket,true ); - } - else - { - myNetworkStream = gcnew NetworkStream( mySocket ); - } - - // - // Examples for CanWrite, and CanWrite - // Check to see if this NetworkStream is writable. - if ( myNetworkStream->CanWrite ) - { - array^ myWriteBuffer = Encoding::ASCII->GetBytes( - "Are you receiving this message?" ); - myNetworkStream->Write( myWriteBuffer, 0, myWriteBuffer->Length ); - } - else - { - Console::WriteLine( "Sorry. You cannot write to this NetworkStream." ); - } - // - - // Examples for CanRead, Read, and DataAvailable. - // Check to see if this NetworkStream is readable. - if ( myNetworkStream->CanRead ) - { - array^ myReadBuffer = gcnew array(1024); - String^ myCompleteMessage = ""; - int numberOfBytesRead = 0; - - // Incoming message may be larger than the buffer size. - do - { - numberOfBytesRead = myNetworkStream->Read( myReadBuffer, 0, - myReadBuffer->Length ); - myCompleteMessage = String::Concat( myCompleteMessage, - Encoding::ASCII->GetString( myReadBuffer, 0, numberOfBytesRead ) ); - } - while ( myNetworkStream->DataAvailable ); - - // Print out the received message to the console. - Console::WriteLine( "You received the following message : {0}", - myCompleteMessage ); - } - else - { - Console::WriteLine( "Sorry. You cannot read from this NetworkStream." ); - } - - // - // Example for closing the NetworkStream. - // Close the NetworkStream - myNetworkStream->Close(); - // - - } - catch ( Exception^ exception ) - { - Console::WriteLine( "Exception Thrown: {0}", exception->ToString() ); - } -} - -int main( int argc, char *argv[] ) -{ - if ( "yes" == gcnew String(argv[1]) ) - { - MySample( true ); - } - else - if ( "no" == gcnew String(argv[1]) ) - { - MySample( false ); - } - else - { - Console::WriteLine( "Must use 'yes' to allow the NetworkStream to own the Socket or {0}", "\n 'no' to prohibit NetworkStream from owning the Socket." ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp b/snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp deleted file mode 100644 index 6afe3a48d86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::Remoting; -public ref class MyType: public MarshalByRefObject -{ -public: - MyType() - { - Console::Write( "Created an instance of MyType in an AppDomain with the " ); - Console::WriteLine( "hash code {0}", AppDomain::CurrentDomain->GetHashCode() ); - Console::WriteLine( "" ); - } - - int GetAppDomainHashCode() - { - return AppDomain::CurrentDomain->GetHashCode(); - } - -}; - -int main() -{ - Console::WriteLine( "The hash code of the default AppDomain is {0}.", AppDomain::CurrentDomain->GetHashCode() ); - Console::WriteLine( "" ); - - // Creates another AppDomain. - AppDomain^ domain = AppDomain::CreateDomain( "AnotherDomain", nullptr, (AppDomainSetup^)nullptr ); - - // - // Creates an instance of MyType defined in the assembly called ObjectHandleAssembly. - ObjectHandle^ obj = domain->CreateInstance( "ObjectHandleAssembly", "MyType" ); - - // Unwraps the proxy to the MyType object created in the other AppDomain. - MyType^ testObj = dynamic_cast(obj->Unwrap()); - if ( RemotingServices::IsTransparentProxy( testObj ) ) - Console::WriteLine( "The unwrapped object is a proxy." ); - else - Console::WriteLine( "The unwrapped object is not a proxy!" ); - - Console::WriteLine( "" ); - Console::Write( "Calling a method on the object located in an AppDomain with the hash code " ); - Console::WriteLine( testObj->GetAppDomainHashCode() ); - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp deleted file mode 100644 index 73662f4cd66..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// System.Web.Services.Description.OperationBindingCollection -// System.Web.Services.Description.OperationBindingCollection.Contains -// System.Web.Services.Description.OperationBindingCollection.Add -// System.Web.Services.Description.OperationBindingCollection.Item -// System.Web.Services.Description.OperationBindingCollection.Remove -// System.Web.Services.Description.OperationBindingCollection.Insert -// System.Web.Services.Description.OperationBindingCollection.IndexOf -// System.Web.Services.Description.OperationBindingCollection.CopyTo - -/* -The following example demonstrates the usage of the -'OperationBindingCollection' class, the 'Item' property and various methods of the -class. The input to the program is a WSDL file 'MathService_input_cpp.wsdl' without -the add operation binding of SOAP protocol. In this example the WSDL file -is modified to insert a new 'OperationBinding' for SOAP. The -'OperationBindingCollection' is populated based on WSDL document -structure defined in WSDL specification. The updated instance is then -written to 'MathService_new_cpp.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -int main() -{ - try - { - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cpp.wsdl" ); - - // Add the OperationBinding for the Add operation. - OperationBinding^ addOperationBinding = gcnew OperationBinding; - String^ addOperation = "Add"; - String^ myTargetNamespace = myServiceDescription->TargetNamespace; - addOperationBinding->Name = addOperation; - - // Add the InputBinding for the operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - addOperationBinding->Input = myInputBinding; - - // Add the OutputBinding for the operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - addOperationBinding->Output = myOutputBinding; - - // Add the extensibility element for the SoapOperationBinding. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation ); - addOperationBinding->Extensions->Add( mySoapOperationBinding ); - - // Get the BindingCollection from the ServiceDescription. - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - - // Get the OperationBindingCollection of SOAP binding from - // the BindingCollection. - OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations; - - // - // Check for the Add OperationBinding in the collection. - bool contains = myOperationBindingCollection->Contains( addOperationBinding ); - Console::WriteLine( "\nWhether the collection contains the Add OperationBinding : {0}", contains ); - // - - // - // Add the Add OperationBinding to the collection. - myOperationBindingCollection->Add( addOperationBinding ); - Console::WriteLine( "\nAdded the OperationBinding of the Add" - " operation to the collection." ); - // - - // - // - // Get the OperationBinding of the Add operation from the collection. - OperationBinding^ myOperationBinding = myOperationBindingCollection[ 3 ]; - - // Remove the OperationBinding of the Add operation from - // the collection. - myOperationBindingCollection->Remove( myOperationBinding ); - Console::WriteLine( "\nRemoved the OperationBinding of the " - "Add operation from the collection." ); - // - // - - // - // - // Insert the OperationBinding of the Add operation at index 0. - myOperationBindingCollection->Insert( 0, addOperationBinding ); - Console::WriteLine( "\nInserted the OperationBinding of the " - "Add operation in the collection." ); - - // Get the index of the OperationBinding of the Add - // operation from the collection. - int index = myOperationBindingCollection->IndexOf( addOperationBinding ); - Console::WriteLine( "\nThe index of the OperationBinding of the Add operation : {0}", index ); - // - // - - Console::WriteLine( "" ); - - // - array^operationBindingArray = - gcnew array(myOperationBindingCollection->Count); - - // Copy this collection to the OperationBinding array. - myOperationBindingCollection->CopyTo( operationBindingArray, 0 ); - Console::WriteLine( "The operations supported by this service " - "are :" ); - - for each(OperationBinding^ myOperationBinding1 in operationBindingArray) - { - Binding^ myBinding = myOperationBinding1->Binding; - Console::WriteLine(" Binding : "+ myBinding->Name + " Name of " + - "operation : " + myOperationBinding1->Name); - } - // - - // Save the ServiceDescription to an external file. - myServiceDescription->Write( "MathService_new_cpp.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp deleted file mode 100644 index 275e1d9fc9a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// System.Web.Services.Description.OperationBinding -// System.Web.Services.Description.OperationBinding.OperationBinding -// System.Web.Services.Description.OperationBinding.Name -// System.Web.Services.Description.OperationBinding.Input -// System.Web.Services.Description.OperationBinding.Output -// System.Web.Services.Description.OperationBinding.Extensions -// System.Web.Services.Description.OperationBinding.Faults -// System.Web.Services.Description.OperationBinding.Binding - -/* -The following example demonstrates the usage of the 'OperationBinding' -class, the 'OperationBinding()' constructor, and various properties of the class. The -input to the program is a WSDL file 'MathService_input_cs.wsdl' without the -add operation binding for SOAP protocol. In the example, the WSDL file is modified to insert -a new 'OperationBinding' instance for SOAP. The 'OperationBinding' instance -is populated based on the WSDL document structure defined in the WSDL specification. The updated -instance is then written to 'MathService_new_cs.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" ); - String^ myTargetNamespace = myServiceDescription->TargetNamespace; - - // - // - // Create an OperationBinding for the Add operation. - OperationBinding^ addOperationBinding = gcnew OperationBinding; - String^ addOperation = "Add"; - addOperationBinding->Name = addOperation; - // - - // - // Create an InputBinding for the Add operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add the InputBinding to the OperationBinding. - addOperationBinding->Input = myInputBinding; - // - - // - // Create an OutputBinding for the Add operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add the OutputBinding to the OperationBinding. - addOperationBinding->Output = myOutputBinding; - // - - // - // Create an extensibility element for a SoapOperationBinding. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation ); - - // Add the extensibility element SoapOperationBinding to - // the OperationBinding. - addOperationBinding->Extensions->Add( mySoapOperationBinding ); - // - // - - // - ServiceDescriptionFormatExtensionCollection^ myExtensions; - - // Get the FaultBindingCollection from the OperationBinding. - FaultBindingCollection^ myFaultBindingCollection = addOperationBinding->Faults; - FaultBinding^ myFaultBinding = gcnew FaultBinding; - myFaultBinding->Name = "ErrorFloat"; - - // Associate SOAP fault binding to the fault binding of the operation. - myExtensions = myFaultBinding->Extensions; - SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; - mySoapFaultBinding->Use = SoapBindingUse::Literal; - mySoapFaultBinding->Namespace = myTargetNamespace; - myExtensions->Add( mySoapFaultBinding ); - myFaultBindingCollection->Add( myFaultBinding ); - // - - // Get the BindingCollection from the ServiceDescription. - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - - // Get the OperationBindingCollection of SOAP binding - // from the BindingCollection. - OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations; - myOperationBindingCollection->Add( addOperationBinding ); - Console::WriteLine( "The operations supported by this service are:" ); - System::Collections::IEnumerator^ myEnum = myOperationBindingCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - OperationBinding^ myOperationBinding = safe_cast(myEnum->Current); - - // - Binding^ myBinding = myOperationBinding->Binding; - Console::WriteLine( " Binding : {0} :: Name of operation : {1}", myBinding->Name, myOperationBinding->Name ); - // - - FaultBindingCollection^ myFaultBindingCollection1 = myOperationBinding->Faults; - System::Collections::IEnumerator^ myEnum1 = myFaultBindingCollection1->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - FaultBinding^ myFaultBinding1 = safe_cast(myEnum1->Current); - Console::WriteLine( " Fault : {0}", myFaultBinding1->Name ); - } - } - myServiceDescription->Write( "MathService_new_cs.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp deleted file mode 100644 index 6dc493cb959..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// System.Web.Sevices.Description.OperationCollection -// System.Web.Sevices.Description.OperationCollection.Add -// System.Web.Sevices.Description.OperationCollection.Contains -// System.Web.Sevices.Description.OperationCollection.IndexOf -// System.Web.Sevices.Description.OperationCollection.Remove -// System.Web.Sevices.Description.OperationCollection.Insert -// System.Web.Sevices.Description.OperationCollection.Item -// System.Web.Sevices.Description.OperationCollection.CopyTo - -/* -The following example demonstrates the usage of the -'OperationCollection' class , its property 'Item' and its methods -'Add', 'Contains', 'CopyTo', 'IndexOf', 'Insert' and 'Remove'. -The input to the program is a WSDL file 'MathService_input_cs.wsdl'with -information related to the 'Add' operation for the SOAP protocol, -removed from it. It creates a new file 'MathService_new_cs.wsdl' with -the added information about the 'Add' method. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Xml; -using namespace System::Web::Services::Description; -int main() -{ - try - { - // Read the 'MathService_Input_cs.wsdl' file. - ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_Input_cs.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; - - // Get the 'OperationCollection' for 'SOAP' protocol. - - // - OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; - Operation^ myOperation = gcnew Operation; - myOperation->Name = "Add"; - OperationMessage^ myOperationMessageInput = (OperationMessage^)(gcnew OperationInput); - myOperationMessageInput->Message = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); - OperationMessage^ myOperationMessageOutput = (OperationMessage^)(gcnew OperationOutput); - myOperationMessageOutput->Message = gcnew XmlQualifiedName( "AddSoapOut",myDescription->TargetNamespace ); - myOperation->Messages->Add( myOperationMessageInput ); - myOperation->Messages->Add( myOperationMessageOutput ); - myOperationCollection->Add( myOperation ); - // - - // - // - if ( myOperationCollection->Contains( myOperation )) - { - Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) ); - } - // - // - - // - // - // - myOperationCollection->Remove( myOperation ); - - // Insert the 'myOpearation' operation at the index '0'. - myOperationCollection->Insert( 0, myOperation ); - Console::WriteLine( "The operation at index '0' is : {0}", myOperationCollection[ 0 ]->Name ); - // - // - // - - // - array^myOperationArray = gcnew array(myOperationCollection->Count); - myOperationCollection->CopyTo( myOperationArray, 0 ); - Console::WriteLine( "The operation(s) in the collection are :" ); - for ( int i = 0; i < myOperationCollection->Count; i++ ) - { - Console::WriteLine( " {0}", myOperationArray[ i ]->Name ); - } - // - - myDescription->Write( "MathService_New_cs.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp deleted file mode 100644 index ad166a97219..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp +++ /dev/null @@ -1,114 +0,0 @@ -// System::Web::Services::Description.OperationFaultCollection -// System::Web::Services::Description.OperationFaultCollection::Contains -// System::Web::Services::Description.OperationFaultCollection::CopyTo -// System::Web::Services::Description.OperationFaultCollection::IndexOf -// System::Web::Services::Description.OperationFaultCollection::Insert -// System::Web::Services::Description.OperationFaultCollection::Item -// System::Web::Services::Description.OperationFaultCollection::Remove - -/* -The following example demonstrates the usage of the -'OperationFaultCollection' class, the 'Contains', 'CopyTo', 'IndexOf', -'Insert', 'Remove', methods and the 'Item' property of the class. -The program reverses the fault bindings that appear in the WSDL file. -It also reverses the operation faults and writes the resultant WSDL -file. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -int main() -{ - try - { - // Read the StockQuote.wsdl file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); - - // - // - // - // - // - // - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = myOperationCollection[ 0 ]; - OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; - - // Reverse the operation fault order. - if ( myOperationFaultCollection->Count > 1 ) - { - OperationFault^ myOperationFault = myOperationFaultCollection[ 0 ]; - array^myOperationFaultArray = gcnew array(myOperationFaultCollection->Count); - - // Copy the operation fault to a temporary array. - myOperationFaultCollection->CopyTo( myOperationFaultArray, 0 ); - - // Remove all the operation faults from the collection. - for ( int i = 0; i < myOperationFaultArray->Length; i++ ) - myOperationFaultCollection->Remove( myOperationFaultArray[ i ] ); - - // Insert the operation faults in the reverse order. - for ( int i = 0,j = (myOperationFaultArray->Length - 1); i < myOperationFaultArray->Length; i++,j-- ) - myOperationFaultCollection->Insert( i, myOperationFaultArray[ j ] ); - if ( myOperationFaultCollection->Contains( myOperationFault ) && (myOperationFaultCollection->IndexOf( myOperationFault ) == myOperationFaultCollection->Count - 1) ) - Console::WriteLine( "Succeeded in reversing the operation faults." ); - else - Console::WriteLine( "Error while reversing the faults." ); - } - // - // - // - // - // - // - - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - Binding^ myBinding = myBindingCollection[ 0 ]; - OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; - OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; - FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; - - // Reverse the fault binding order. - if ( myFaultBindingCollection->Count > 1 ) - { - FaultBinding^ myFaultBinding = myFaultBindingCollection[ 0 ]; - array^myFaultBindingArray = gcnew array(myFaultBindingCollection->Count); - - // Copy the fault bindings to a temporary array. - myFaultBindingCollection->CopyTo( myFaultBindingArray, 0 ); - - // Remove all the fault bindings. - for ( int i = 0; i < myFaultBindingArray->Length; i++ ) - myFaultBindingCollection->Remove( myFaultBindingArray[ i ] ); - - // Insert the fault bindings in the reverse order. - for ( int i = 0,j = (myFaultBindingArray->Length - 1); i < myFaultBindingArray->Length; i++,j-- ) - myFaultBindingCollection->Insert( i, myFaultBindingArray[ j ] ); - - // Check whether the first element before the reversal - // is now the last element. - if ( myFaultBindingCollection->Contains( myFaultBinding ) && myFaultBindingCollection->IndexOf( myFaultBinding ) == (myFaultBindingCollection->Count - 1) ) - { - // Write the WSDL generated to a file. - myServiceDescription->Write( "StockQuoteOut_cpp.wsdl" ); - Console::WriteLine( "The file StockQuoteOut_cpp.wsdl was successfully written" ); - } - else - Console::WriteLine( "An error occurred while reversing the input WSDL file." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp deleted file mode 100644 index 82de5e660ad..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// System::Web::Services::Description.OperationFaultCollection->Add - -/* -The following example demonstrates the 'Add' method of the -'OperationFaultCollection' class. Based on 'StockQuote_cs::wsdl', the program generates a WSDL file -'StockQuoteNew_cs::wsdl' which contains 'Fault' information written out. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; - -int main() -{ - try - { - // Read the 'StockQuote::wsdl' file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = myOperationCollection[ 0 ]; - - // - OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; - OperationFault^ myOperationFault = gcnew OperationFault; - myOperationFault->Name = "ErrorString"; - myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" ); - myOperationFaultCollection->Add( myOperationFault ); - // - - Console::WriteLine( "Added OperationFault with Name: {0}", myOperationFault->Name ); - myOperationFault = gcnew OperationFault; - myOperationFault->Name = "ErrorInt"; - myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" ); - myOperationFaultCollection->Add( myOperationFault ); - myOperationCollection->Add( myOperation ); - Console::WriteLine( "Added Second OperationFault with Name: {0}", myOperationFault->Name ); - myServiceDescription->Write( "StockQuoteNew_cpp.wsdl" ); - Console::WriteLine( "\nThe file 'StockQuoteNew_cpp.wsdl' is created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp deleted file mode 100644 index 845e68c6164..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Web::Services::Description.OperationFaultCollection::Item->Item[String*] - -/* -The following example demonstrates the 'Item' property of the -'OperationFaultCollection' class. The program removes a fault binding -with the name 'ErrorString' from the WSDL file. It also removes an -operation fault with the name 'ErrorString' and generates a WSDL file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -int main() -{ - try - { - // Read the 'StockQuote::wsdl' file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); - - // Remove the operation fault with the name 'ErrorString'. - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = myOperationCollection[ 0 ]; - - // - OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; - OperationFault^ myOperationFault = myOperationFaultCollection[ "ErrorString" ]; - if ( myOperationFault != nullptr ) - myOperationFaultCollection->Remove( myOperationFault ); - // - - // Remove the fault binding with the name 'ErrorString'. - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - Binding^ myBinding = myBindingCollection[ 0 ]; - OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; - OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; - FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; - if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) ) - myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] ); - myServiceDescription->Write( "OperationFaultCollection_out.wsdl" ); - Console::WriteLine( "WSDL file with name 'OperationFaultCollection_out.wsdl' created Successfully" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp deleted file mode 100644 index b5f3b55eaa1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// System::Web::Services::Description.OperationFault -// System::Web::Services::Description.OperationFault::OperationFault - -/* The following example demonstrates the usage of the 'OperationFault' -class and its constructor. The program generates a WSDL file -'StockQuoteNew_cs::wsdl' which contains 'Fault' information written -out. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; -int main() -{ - try - { - // Read the 'StockQuote_cpp.wsdl' file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - Operation^ myOperation = myOperationCollection[ 0 ]; - - // - OperationFault^ myOperationFault = gcnew OperationFault; - myOperationFault->Name = "ErrorString"; - myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" ); - myOperation->Faults->Add( myOperationFault ); - Console::WriteLine( "Added OperationFault with Name: {0}", myOperationFault->Name ); - myOperationFault = gcnew OperationFault; - myOperationFault->Name = "ErrorInt"; - myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" ); - myOperation->Faults->Add( myOperationFault ); - // - - myOperationCollection->Add( myOperation ); - Console::WriteLine( "Added Second OperationFault with Name: {0}", myOperationFault->Name ); - myServiceDescription->Write( "StockQuoteNew_cpp.wsdl" ); - Console::WriteLine( "\nThe file 'StockQuoteNew_cpp.wsdl' is created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp deleted file mode 100644 index 200d1635e94..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// System.Web.Sevices.Description.OperationFlow -// System.Web.Sevices.Description.OperationFlow.None -// System.Web.Sevices.Description.OperationFlow.OneWay -// System.Web.Sevices.Description.OperationFlow.Notification -// System.Web.Sevices.Description.OperationFlow.SolicitResponse -// System.Web.Sevices.Description.OperationFlow.RequestResponse - -/* -The following example demonstrates the usage of the 'OperationFlow' -Enumeration, its members 'None', 'OneWay', 'Notification', -'SolicitResponse', 'RequestResponse'. The input to the program is a -WSDL file 'MathService_input_cs.wsdl' It creates a new file -'MathService_new_cs.wsdl' by adding the operation messages -'OperationInput' and 'OperationOutput' are added to the -'OperationInput' and 'OperationOutput' in such way that all members of -the 'OperationFlow' enumeration are generated. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; - -// -// -// -// -// -void DisplayOperationFlowDescription( OperationFlow myOperationFlow ) -{ - switch ( myOperationFlow ) - { - case OperationFlow::None: - Console::WriteLine( "Indicates that the endpoint or service " - "receives no transmissions (None)." ); - break; - - case OperationFlow::OneWay: - Console::WriteLine( "Indicates that the endpoint or service " - "receives a message (OneWay)." ); - break; - - case OperationFlow::Notification: - Console::WriteLine( "Indicates that the endpoint or service " - "sends a message (Notification)." ); - break; - - case OperationFlow::SolicitResponse: - Console::WriteLine( "Indicates that the endpoint or service " - "sends a message, then receives a " - "correlated message (SolicitResponse)." ); - break; - - case OperationFlow::RequestResponse: - Console::WriteLine( "Indicates that the endpoint or service " - "receives a message, then sends a " - "correlated message (RequestResponse)." ); - break; - } -} -// -// -// -// -// - -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_Input_cs.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; - - // Get the OperationCollection for SOAP protocol. - OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; - - // Get the OperationMessageCollection for the Add operation. - OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages; - - // Indicate that the endpoint or service receives no - // transmissions (None). - Console::WriteLine( "myOperationMessageCollection does not " - "contain any operation messages." ); - DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); - Console::WriteLine(); - - // Indicate that the endpoint or service receives a message (OneWay). - OperationMessage^ myInputOperationMessage = dynamic_cast(gcnew OperationInput); - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); - myInputOperationMessage->Message = myXmlQualifiedName; - myOperationMessageCollection->Add( myInputOperationMessage ); - Console::WriteLine( "myOperationMessageCollection contains " - "only input operation messages." ); - DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); - Console::WriteLine(); - myOperationMessageCollection->Remove( myInputOperationMessage ); - - // Indicate that an endpoint or service sends a message (Notification). - OperationMessage^ myOutputOperationMessage = dynamic_cast(gcnew OperationOutput); - XmlQualifiedName^ myXmlQualifiedName1 = gcnew XmlQualifiedName( "AddSoapOut",myDescription->TargetNamespace ); - myOutputOperationMessage->Message = myXmlQualifiedName1; - myOperationMessageCollection->Add( myOutputOperationMessage ); - Console::WriteLine( "myOperationMessageCollection contains " - "only output operation messages." ); - DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); - Console::WriteLine(); - - // Indicate that an endpoint or service sends a message, then - // receives a correlated message (SolicitResponse). - myOperationMessageCollection->Add( myInputOperationMessage ); - Console::WriteLine( "'myOperationMessageCollection' contains " - "an output operation message first, then " - "an input operation message." ); - DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); - Console::WriteLine(); - - // Indicate that an endpoint or service receives a message, - // then sends a correlated message (RequestResponse). - myOperationMessageCollection->Remove( myInputOperationMessage ); - myOperationMessageCollection->Insert( 0, myInputOperationMessage ); - Console::WriteLine( "myOperationMessageCollection contains " - "an input operation message first, then " - "an output operation message." ); - DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); - Console::WriteLine(); - myDescription->Write( "MathService_new_cs.wsdl" ); - Console::WriteLine( "The file MathService_new_cs.wsdl was successfully written." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp deleted file mode 100644 index fdc4a94dd1d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// System.Web.Services.Description.OperationInput -// System.Web.Services.Description.OperationInput.OperationInput - -/* -The following example demonstrates the usage of the 'OperationInput' -class and its constructor 'OperationInput'. It instantiates the -'ServiceDescription' object by reading a file 'AddNumbersIn_cs.wsdl' -and then creates 'AddNumbersOut_cs.wsdl' file which corresponds to -added attributes in the 'ServiceDescription' instance. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersIn_cs.wsdl" ); - - // Add the ServiceHttpPost binding. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "ServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - myBinding->Extensions->Add( myHttpBinding ); - - // Add the operation name AddNumbers. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; - myOperation->Location = "/AddNumbers"; - myOperationBinding->Extensions->Add( myOperation ); - - // Add the input binding. - InputBinding^ myInput = gcnew InputBinding; - MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; - postMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInput->Extensions->Add( postMimeContentbinding ); - - // Add the InputBinding to the OperationBinding. - myOperationBinding->Input = myInput; - - // Add the ouput binding. - OutputBinding^ myOutput = gcnew OutputBinding; - MimeXmlBinding^ postMimeXmlBinding = gcnew MimeXmlBinding; - postMimeXmlBinding->Part = "Body"; - myOutput->Extensions->Add( postMimeXmlBinding ); - - // Add the OutputBinding to the OperationBinding. - myOperationBinding->Output = myOutput; - myBinding->Operations->Add( myOperationBinding ); - myDescription->Bindings->Add( myBinding ); - - // Add the port definition. - Port^ postPort = gcnew Port; - postPort->Name = "ServiceHttpPost"; - postPort->Binding = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); - HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; - postAddressBinding->Location = "http://localhost/Service.cs.asmx"; - postPort->Extensions->Add( postAddressBinding ); - myDescription->Services[ 0 ]->Ports->Add( postPort ); - - // Add the post port type definition. - PortType^ postPortType = gcnew PortType; - postPortType->Name = "ServiceHttpPost"; - Operation^ postOperation = gcnew Operation; - postOperation->Name = "AddNumbers"; - OperationMessage^ postOutput = dynamic_cast(gcnew OperationOutput); - postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); - - // - OperationInput^ postInput = gcnew OperationInput; - postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); - postOperation->Messages->Add( postInput ); - postOperation->Messages->Add( postOutput ); - postPortType->Operations->Add( postOperation ); - // - - myDescription->PortTypes->Add( postPortType ); - - // Add the first message information. - Message^ postMessage1 = gcnew Message; - postMessage1->Name = "AddNumbersHttpPostIn"; - MessagePart^ postMessagePart1 = gcnew MessagePart; - postMessagePart1->Name = "firstnumber"; - postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); - - // Add the second message information. - MessagePart^ postMessagePart2 = gcnew MessagePart; - postMessagePart2->Name = "secondnumber"; - postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); - postMessage1->Parts->Add( postMessagePart1 ); - postMessage1->Parts->Add( postMessagePart2 ); - Message^ postMessage2 = gcnew Message; - postMessage2->Name = "AddNumbersHttpPostOut"; - - // Add the third message information. - MessagePart^ postMessagePart3 = gcnew MessagePart; - postMessagePart3->Name = "Body"; - postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); - postMessage2->Parts->Add( postMessagePart3 ); - myDescription->Messages->Add( postMessage1 ); - myDescription->Messages->Add( postMessage2 ); - - // Write the ServiceDescription as a WSDL file. - myDescription->Write( "AddNumbersOut_cs.wsdl" ); - Console::WriteLine( "WSDL file named AddNumberOut_cs.Wsdl" - " created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp deleted file mode 100644 index 051aa44c1c0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp +++ /dev/null @@ -1,129 +0,0 @@ - - -// System.Web.Services.Description.OperationMessageCollection -// System.Web.Services.Description.OperationMessageCollection.Item -// System.Web.Services.Description.OperationMessageCollection.CopyTo -// System.Web.Services.Description.OperationMessageCollection.Add -// System.Web.Services.Description.OperationMessageCollection.Contains -// System.Web.Services.Description.OperationMessageCollection.IndexOf -// System.Web.Services.Description.OperationMessageCollection.Remove -// System.Web.Services.Description.OperationMessageCollection.Insert -// System.Web.Services.Description.OperationMessageCollection.Flow -// System.Web.Services.Description.OperationMessageCollection.Input -// System.Web.Services.Description.OperationMessageCollection.Output - -/* -The following example demonstrates the usage of the -'OperationMessageCollection' class and various methods and properties of it. -The input to the program is a WSDL file 'MathService_input_vb.wsdl' without -the input message of 'Add' operation for the SOAP -protocol. In a way, it tries to simulate a scenario -wherein the operation flow was 'Notification', however later operation -flow changed to 'Request-Response'. The WSDL file is -modified by inserting a new input message for the 'Add' operation. The -input message in the ServiceDescription instance is loaded with values for -'Input Message'. The instance is then written to 'MathService_new_vb.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; - -// -// -// -// Displays the properties of the OperationMessageCollection. -void DisplayFlowInputOutput( OperationMessageCollection^ myOperationMessageCollection, String^ myOperation ) -{ - Console::WriteLine( "After {0}:", myOperation ); - Console::WriteLine( "Flow : {0}", myOperationMessageCollection->Flow ); - Console::WriteLine( "The first occurrence of operation Input in the collection {0}", myOperationMessageCollection->Input ); - Console::WriteLine( "The first occurrence of operation Output in the collection {0}", myOperationMessageCollection->Output ); - Console::WriteLine(); -} -// -// -// - -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; - - // Get the OperationCollection for the SOAP protocol. - OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; - - // Get the OperationMessageCollection for the Add operation. - OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages; - - // Display the Flow, Input, and Output properties. - DisplayFlowInputOutput( myOperationMessageCollection, "Start" ); - - // - // - // Get the operation message for the Add operation. - OperationMessage^ myOperationMessage = myOperationMessageCollection[ 0 ]; - OperationMessage^ myInputOperationMessage = dynamic_cast(gcnew OperationInput); - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); - myInputOperationMessage->Message = myXmlQualifiedName; - - // - array^myCollection = gcnew array(myOperationMessageCollection->Count); - myOperationMessageCollection->CopyTo( myCollection, 0 ); - Console::WriteLine( "Operation name(s) :" ); - for ( int i = 0; i < myCollection->Length; i++ ) - { - Console::WriteLine( " {0}", myCollection[ i ]->Operation->Name ); - } - // - - // Add the OperationMessage to the collection. - myOperationMessageCollection->Add( myInputOperationMessage ); - - // - DisplayFlowInputOutput( myOperationMessageCollection, "Add" ); - - // - // - if ( myOperationMessageCollection->Contains( myOperationMessage )) - { - int myIndex = myOperationMessageCollection->IndexOf( myOperationMessage ); - Console::WriteLine( " The index of the Add operation message in the collection is : {0}", myIndex ); - } - // - // - // - - // - // - myOperationMessageCollection->Remove( myInputOperationMessage ); - - // Display Flow, Input, and Output after removing. - DisplayFlowInputOutput( myOperationMessageCollection, "Remove" ); - - // Insert the message at index 0 in the collection. - myOperationMessageCollection->Insert( 0, myInputOperationMessage ); - - // Display Flow, Input, and Output after inserting. - DisplayFlowInputOutput( myOperationMessageCollection, "Insert" ); - // - // - - myDescription->Write( "MathService_new_cs.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp deleted file mode 100644 index c7cd7a8b49c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// System.Web.Services.Description.OperationMessage -// System.Web.Services.Description.OperationMessage.OperationMessage -// System.Web.Services.Description.OperationMessage.Message -// System.Web.Services.Description.OperationMessage.Operation - -/* -The following example demonstrates the usage of the 'OperationMessage' -class, its constructor and the properties 'Message' and 'Operation'. -The input to the program is a WSDL file 'MathService_input_cs.wsdl' without -the input message of 'Add' operation for the SOAP -protocol. In this example a new input message for the 'Add' operation is created. -The input message in the ServiceDescription instance is loaded with values for -'InputMessage'. The instance is then written to 'MathService_new_cs.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; - - // Get the OperationCollection for the SOAP protocol. - OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; - - // Get the OperationMessageCollection for the Add operation. - OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages; - - // - // - // - OperationMessage^ myInputOperationMessage = (OperationMessage^)(gcnew OperationInput); - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); - myInputOperationMessage->Message = myXmlQualifiedName; - // - - myOperationMessageCollection->Insert( 0, myInputOperationMessage ); - - // Display the operation name of the InputMessage. - Console::WriteLine( "The operation name is {0}", myInputOperationMessage->Operation->Name ); - // - // - - // Add the OperationMessage to the collection. - myDescription->Write( "MathService_new_cs.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp deleted file mode 100644 index 9500f4f962e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp +++ /dev/null @@ -1,127 +0,0 @@ -// System.Web.Services.Description.OperationOutput -// System.Web.Services.Description.OperationOutput.OperationOutput - -/* -The following example demonstrates the usage of the 'OperationOutput' -class and its constructor 'OperationOutput'. It creates a -'ServiceDescription' object by reading the file 'AddNumbersIn_cs.wsdl' and -then creates 'AddNumbersOut_cs.wsdl' file which corresponds to added -attributes in the 'ServiceDescription' instance. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersIn_cs.wsdl" ); - - // Add the ServiceHttpPost binding. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "ServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - myBinding->Extensions->Add( myHttpBinding ); - - // Add the operation name AddNumbers. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; - myOperation->Location = "/AddNumbers"; - myOperationBinding->Extensions->Add( myOperation ); - - // Add the input binding. - InputBinding^ myInput = gcnew InputBinding; - MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; - postMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInput->Extensions->Add( postMimeContentbinding ); - - // Add the InputBinding to the OperationBinding. - myOperationBinding->Input = myInput; - - // Add the ouput binding. - OutputBinding^ myOutput = gcnew OutputBinding; - MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; - postMimeXmlbinding->Part = "Body"; - myOutput->Extensions->Add( postMimeXmlbinding ); - - // Add the OutPutBinding to the OperationBinding. - myOperationBinding->Output = myOutput; - myBinding->Operations->Add( myOperationBinding ); - myDescription->Bindings->Add( myBinding ); - - // Add the port definition. - Port^ postPort = gcnew Port; - postPort->Name = "ServiceHttpPost"; - postPort->Binding = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); - HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; - postAddressBinding->Location = "http://localhost/Service_cs.asmx"; - postPort->Extensions->Add( postAddressBinding ); - myDescription->Services[ 0 ]->Ports->Add( postPort ); - - // Add the post port type definition. - PortType^ postPortType = gcnew PortType; - postPortType->Name = "ServiceHttpPost"; - Operation^ postOperation = gcnew Operation; - postOperation->Name = "AddNumbers"; - OperationMessage^ postInput = dynamic_cast(gcnew OperationInput); - postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); - - // - OperationOutput^ postOutput = gcnew OperationOutput; - postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); - postOperation->Messages->Add( postInput ); - postOperation->Messages->Add( postOutput ); - postPortType->Operations->Add( postOperation ); - // - - myDescription->PortTypes->Add( postPortType ); - - // Add the first message information. - Message^ postMessage1 = gcnew Message; - postMessage1->Name = "AddNumbersHttpPostIn"; - MessagePart^ postMessagePart1 = gcnew MessagePart; - postMessagePart1->Name = "firstnumber"; - postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); - - // Add the second message information. - MessagePart^ postMessagePart2 = gcnew MessagePart; - postMessagePart2->Name = "secondnumber"; - postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); - postMessage1->Parts->Add( postMessagePart1 ); - postMessage1->Parts->Add( postMessagePart2 ); - Message^ postMessage2 = gcnew Message; - postMessage2->Name = "AddNumbersHttpPostOut"; - - // Add the third message information. - MessagePart^ postMessagePart3 = gcnew MessagePart; - postMessagePart3->Name = "Body"; - postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); - postMessage2->Parts->Add( postMessagePart3 ); - myDescription->Messages->Add( postMessage1 ); - myDescription->Messages->Add( postMessage2 ); - - // Write the ServiceDescription as a WSDL file. - myDescription->Write( "AddNumbersOut_cs.wsdl" ); - Console::WriteLine( "WSDL file named AddNumbersOut_cs.Wsdl" - " created successfully." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp deleted file mode 100644 index 6af07a14872..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// System.Web.Services.Description Operation.ParameterOrderString -// System.Web.Services.Description Operation.ParameterOrder - -/* The following program demonstrates the 'ParameterOrderString' and - 'ParameterOrder' properties of 'Operation' class. It collects the - message part names from the input WSDL file and sets to the - 'ParameterOrderString'. It then displays the same using 'ParameterOrder' - property. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "Operation_2_Input_CS.wsdl" ); - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Operation_2_ServiceHttpPost"; - XmlQualifiedName^ myQualifiedName = gcnew XmlQualifiedName( "s0:Operation_2_ServiceHttpPost" ); - myBinding->Type = myQualifiedName; - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; - myHttpOperationBinding->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myHttpOperationBinding ); - InputBinding^ myInputBinding = gcnew InputBinding; - MimeContentBinding^ myPostMimeContentbinding = gcnew MimeContentBinding; - myPostMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInputBinding->Extensions->Add( myPostMimeContentbinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - OutputBinding^ myOutputBinding = gcnew OutputBinding; - MimeXmlBinding^ myPostMimeXmlbinding = gcnew MimeXmlBinding; - myPostMimeXmlbinding->Part = "Body"; - myOutputBinding->Extensions->Add( myPostMimeXmlbinding ); - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutputBinding; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - Port^ myPostPort = gcnew Port; - myPostPort->Name = "Operation_2_ServiceHttpPost"; - myPostPort->Binding = gcnew XmlQualifiedName( "s0:Operation_2_ServiceHttpPost" ); - HttpAddressBinding^ myPostAddressBinding = gcnew HttpAddressBinding; - myPostAddressBinding->Location = "http://localhost/Operation_2/Operation_2_Service.cs.asmx"; - - // Add the 'HttpAddressBinding' to the 'Port'. - myPostPort->Extensions->Add( myPostAddressBinding ); - - // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. - myDescription->Services[ 0 ]->Ports->Add( myPostPort ); - PortType^ myPostPortType = gcnew PortType; - myPostPortType->Name = "Operation_2_ServiceHttpPost"; - Operation^ myPostOperation = gcnew Operation; - myPostOperation->Name = "AddNumbers"; - OperationMessage^ myPostOperationInput = dynamic_cast(gcnew OperationInput); - myPostOperationInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); - OperationMessage^ myPostOperationOutput = dynamic_cast(gcnew OperationOutput); - myPostOperationOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostout" ); - myPostOperation->Messages->Add( myPostOperationInput ); - myPostOperation->Messages->Add( myPostOperationOutput ); - - // Add the 'Operation' to 'PortType'. - myPostPortType->Operations->Add( myPostOperation ); - - // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. - myDescription->PortTypes->Add( myPostPortType ); - Message^ myPostMessage1 = gcnew Message; - myPostMessage1->Name = "AddNumbersHttpPostIn"; - MessagePart^ myPostMessagePart1 = gcnew MessagePart; - myPostMessagePart1->Name = "firstnumber"; - myPostMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); - MessagePart^ myPostMessagePart2 = gcnew MessagePart; - myPostMessagePart2->Name = "secondnumber"; - myPostMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); - - // Add the 'MessagePart' objects to 'Messages'. - myPostMessage1->Parts->Add( myPostMessagePart1 ); - myPostMessage1->Parts->Add( myPostMessagePart2 ); - Message^ myPostMessage2 = gcnew Message; - myPostMessage2->Name = "AddNumbersHttpPostout"; - MessagePart^ myPostMessagePart3 = gcnew MessagePart; - myPostMessagePart3->Name = "Body"; - myPostMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); - - // Add the 'MessagePart' to 'Message'. - myPostMessage2->Parts->Add( myPostMessagePart3 ); - - // Add the 'Message' objects to 'ServiceDescription'. - myDescription->Messages->Add( myPostMessage1 ); - myDescription->Messages->Add( myPostMessage2 ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "Operation_2_Output_CS.wsdl" ); - Console::WriteLine( " 'Operation_2_Output_CS.wsdl' file created Successfully" ); - - // - // - String^ myString = nullptr; - Operation^ myOperation = gcnew Operation; - myDescription = ServiceDescription::Read( "Operation_2_Input_CS.wsdl" ); - array^myMessage = gcnew array(myDescription->Messages->Count); - - // Copy the messages from the service description. - myDescription->Messages->CopyTo( myMessage, 0 ); - for ( int i = 0; i < myDescription->Messages->Count; i++ ) - { - array^myMessagePart = gcnew array(myMessage[ i ]->Parts->Count); - - // Copy the message parts into a MessagePart. - myMessage[ i ]->Parts->CopyTo( myMessagePart, 0 ); - for ( int j = 0; j < myMessage[ i ]->Parts->Count; j++ ) - { - myString = String::Concat( myString, myMessagePart[ j ]->Name, " " ); - } - } - - // message part names. - myOperation->ParameterOrderString = myString; - array^myString1 = myOperation->ParameterOrder; - int k = 0; - Console::WriteLine( "The list of message part names is as follows:" ); - while ( k < 5 ) - { - Console::WriteLine( myString1[ k ] ); - k++; - } - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following Exception is raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp deleted file mode 100644 index 13001d530c7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// System.Web.Services.Description.Operation -// System.Web.Services.Description.Operation.Operation -// System.Web.Services.Description.Operation.Messages -// System.Web.Services.Description.Operation.Name -// System.Web.Services.Description.Operation.PortType -/* The following program demonstrates 'Operation' class, its contructor -and 'Messages','Name' and 'PortType' properties. It reads the file -'Operation_5_Input_CS.wsdl' which does not have 'PortType' object that -supports 'HttpPost'. It adds a 'PortType' object that supports 'HttpPost' -protocol and writes into 'Operation_5_Output_CS.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -Operation^ CreateOperation( String^ myOperationName, String^ myInputMesg, String^ myOutputMesg ) -{ - - // - // - // - // Create an Operation. - Operation^ myOperation = gcnew Operation; - myOperation->Name = myOperationName; - OperationMessage^ myInput = dynamic_cast(gcnew OperationInput); - myInput->Message = gcnew XmlQualifiedName( myInputMesg ); - OperationMessage^ myOutput = dynamic_cast(gcnew OperationOutput); - myOutput->Message = gcnew XmlQualifiedName( myOutputMesg ); - - // Add messages to the OperationMessageCollection. - myOperation->Messages->Add( myInput ); - myOperation->Messages->Add( myOutput ); - Console::WriteLine( "Operation name is: {0}", myOperation->Name ); - - // - // - // - return myOperation; -} - -int main() -{ - ServiceDescription^ myDescription = ServiceDescription::Read( "Operation_5_Input_CS.wsdl" ); - - // Create a 'PortType' object. - PortType^ myPortType = gcnew PortType; - myPortType->Name = "OperationServiceHttpPost"; - Operation^ myOperation = CreateOperation( "AddNumbers", "s0:AddNumbersHttpPostIn", "s0:AddNumbersHttpPostOut" ); - myPortType->Operations->Add( myOperation ); - - // - // Get the PortType of the Operation. - PortType^ myPort = myOperation->PortType; - Console::WriteLine( "The port type of the operation is: {0}", myPort->Name ); - - // - // Add the 'PortType's to 'PortTypeCollection' of 'ServiceDescription'. - myDescription->PortTypes->Add( myPortType ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "Operation_5_Output_CS.wsdl" ); - Console::WriteLine( "WSDL file with name 'Operation_5_Output_CS.wsdl' file created Successfully" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp deleted file mode 100644 index 69a3b7c85e8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// System::Web::Services::Description.Operation::Faults - -/* The following program demonstrates the 'Faults' property of 'Operation' -class. It reads from a 'Operation_Faults_Input_CS::wsdl' file removes fault -binding and operation fault with the name 'ErrorString'. The modified -ServiceDescriptor is written to 'Operation_Faults_Output_Cpp.wsdl' file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - // - // Read the 'Operation_Faults_Input_cpp.wsdl' file as input. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Operation_Faults_Input_cpp.wsdl" ); - - // Get the operation fault collection. - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - PortType^ myPortType = myPortTypeCollection[ 0 ]; - OperationCollection^ myOperationCollection = myPortType->Operations; - - // Remove the operation fault with the name 'ErrorString'. - Operation^ myOperation = myOperationCollection[ 0 ]; - OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; - if ( myOperationFaultCollection->Contains( myOperationFaultCollection[ "ErrorString" ] ) ) - myOperationFaultCollection->Remove( myOperationFaultCollection[ "ErrorString" ] ); - // - - // Get the fault binding collection. - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - Binding^ myBinding = myBindingCollection[ 0 ]; - OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; - - // Remove the fault binding with the name 'ErrorString'. - OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; - FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; - if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) ) - myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] ); - - myServiceDescription->Write( "Operation_Faults_Output_cpp.wsdl" ); - Console::WriteLine( "WSDL file with name 'Operation_Faults_Output_cpp.wsdl' file created Successfully" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp deleted file mode 100644 index fab0c5d907a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// System.Web.Services.Description.Operation.IsBoundBy -/* The following program demonstrates the 'IsBoundBy' method of - 'Operation' class. It takes "Operation_IsBoundBy_Input_CS.wsdl" - as input which does not contain 'PortType' and 'Binding' objects - supporting 'HttpPost'. It then adds those objects and writes into - 'Operation_IsBoundBy_Output_CS.wsdl'. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Operation_IsBoundBy_Input_CS.wsdl" ); - - // Create the 'Binding' object. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "MyOperationIsBoundByServiceHttpPost"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:OperationServiceHttpPost" ); - myBinding->Type = myXmlQualifiedName; - - // Create the 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - - // Create the 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; - myHttpOperationBinding->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myHttpOperationBinding ); - - // Create the 'InputBinding' object. - InputBinding^ myInputBinding = gcnew InputBinding; - MimeContentBinding^ myPostMimeContentBinding = gcnew MimeContentBinding; - myPostMimeContentBinding->Type = "application/x-www-form-urlencoded"; - myInputBinding->Extensions->Add( myPostMimeContentBinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - - // Create the 'OutputBinding' object. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - MimeXmlBinding^ myPostMimeXmlBinding = gcnew MimeXmlBinding; - myPostMimeXmlBinding->Part = "Body"; - myOutputBinding->Extensions->Add( myPostMimeXmlBinding ); - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutputBinding; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myServiceDescription->Bindings->Add( myBinding ); - - // Create a 'PortType' object. - PortType^ myPostPortType = gcnew PortType; - myPostPortType->Name = "OperationServiceHttpPost"; - -// - Operation^ myPostOperation = gcnew Operation; - myPostOperation->Name = myOperationBinding->Name; - Console::WriteLine( "'Operation' instance uses 'OperationBinding': {0}", - myPostOperation->IsBoundBy( myOperationBinding ) ); -// - - OperationMessage^ myOperationMessage = dynamic_cast(gcnew OperationInput); - myOperationMessage->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); - OperationMessage^ myOperationMessage1 = dynamic_cast(gcnew OperationOutput); - myOperationMessage1->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); - myPostOperation->Messages->Add( myOperationMessage ); - myPostOperation->Messages->Add( myOperationMessage1 ); - - // Add the 'Operation' to 'PortType'. - myPostPortType->Operations->Add( myPostOperation ); - - // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. - myServiceDescription->PortTypes->Add( myPostPortType ); - - // Write the 'ServiceDescription' as a WSDL file. - myServiceDescription->Write( "Operation_IsBoundBy_Output_CS.wsdl" ); - Console::WriteLine( "WSDL file with name 'Operation_IsBoundBy_Output_CS.wsdl' created Successfully" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp b/snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp deleted file mode 100644 index 458ca2e8f8e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp +++ /dev/null @@ -1,166 +0,0 @@ - - -// System.Web.Services.Description.Port.ctor(). -// System.Web.Services.Description.Port.Binding(). -// System.Web.Services.Description.Portt.Extensions. -// System.Web.Services.Description.Port.Name. -// System.Web.Services.Description.Port.Service. -/* The following example demonstrates the constructor and the properties 'Binding', - 'Extensions','Name', and 'Service' of the 'Port' class. - The input to the program is a WSDL file 'AddNumbers_cs.wsdl'. - It creates a 'ServiceDescription' instance by using the static read method - of 'ServiceDescription' by passing the 'AddNumbers.wsdl' name as an argument. - It creates a 'Binding' object and adds that binding object to - 'ServiceDescription'. It adds the 'PortType',Messages to the 'ServiceDescription' - object. Finally it writes the 'ServiceDescrption' as a WSDL file with - name 'AddNumbersOne.wsdl. - */ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Web; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - try - { - ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbers_cs.wsdl" ); - - // Create the 'Binding' object. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "PortServiceHttpPost"; - XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" ); - myBinding->Type = qualifiedName; - - // Create the 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - - // Create the 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; - myOperation->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myOperation ); - - // Create the 'InputBinding' object. - InputBinding^ myInput = gcnew InputBinding; - MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; - postMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInput->Extensions->Add( postMimeContentbinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInput; - - // Create the 'OutputBinding' object. - OutputBinding^ myOutput = gcnew OutputBinding; - MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; - postMimeXmlbinding->Part = "Body"; - myOutput->Extensions->Add( postMimeXmlbinding ); - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - - // - // - // - // - // - // Create a Port. - Port^ postPort = gcnew Port; - postPort->Name = "PortServiceHttpPost"; - postPort->Binding = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" ); - // - // - - // Create an HttpAddressBinding. - HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; - postAddressBinding->Location = "http://localhost/PortClass/PortService_cs.asmx"; - - // Add the HttpAddressBinding to the Port. - postPort->Extensions->Add( postAddressBinding ); - // - - // Get the Service of the postPort. - Service^ myService = postPort->Service; - - // Print the service name for the port. - Console::WriteLine( "This is the service name of the postPort:*{0}*", myDescription->Services[ 0 ]->Ports[ 0 ]->Service->Name ); - - // Add the Port to the PortCollection of the ServiceDescription. - myDescription->Services[ 0 ]->Ports->Add( postPort ); - // - // - - // Create a 'PortType' object. - PortType^ postPortType = gcnew PortType; - postPortType->Name = "PortServiceHttpPost"; - Operation^ postOperation = gcnew Operation; - postOperation->Name = "AddNumbers"; - OperationMessage^ postInput = dynamic_cast(gcnew OperationInput); - postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); - OperationMessage^ postOutput = dynamic_cast(gcnew OperationOutput); - postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); - postOperation->Messages->Add( postInput ); - postOperation->Messages->Add( postOutput ); - - // Add the 'Operation' to 'PortType'. - postPortType->Operations->Add( postOperation ); - - // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. - myDescription->PortTypes->Add( postPortType ); - - // Create the 'Message' object. - Message^ postMessage1 = gcnew Message; - postMessage1->Name = "AddNumbersHttpPostIn"; - - // Create the 'MessageParts'. - MessagePart^ postMessagePart1 = gcnew MessagePart; - postMessagePart1->Name = "firstnumber"; - postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); - MessagePart^ postMessagePart2 = gcnew MessagePart; - postMessagePart2->Name = "secondnumber"; - postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); - - // Add the 'MessagePart' objects to 'Messages'. - postMessage1->Parts->Add( postMessagePart1 ); - postMessage1->Parts->Add( postMessagePart2 ); - - // Create another 'Message' object. - Message^ postMessage2 = gcnew Message; - postMessage2->Name = "AddNumbersHttpPostOut"; - MessagePart^ postMessagePart3 = gcnew MessagePart; - postMessagePart3->Name = "Body"; - postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); - - // Add the 'MessagePart' to 'Message' - postMessage2->Parts->Add( postMessagePart3 ); - - // Add the 'Message' objects to 'ServiceDescription'. - myDescription->Messages->Add( postMessage1 ); - myDescription->Messages->Add( postMessage2 ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "AddNumbersOne.wsdl" ); - Console::WriteLine( "WSDL file with name 'AddNumbersOne.Wsdl' file created Successfully" ); - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Exception {0} occurred", ex->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp deleted file mode 100644 index aea7134fd0b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -// System.Web.Services.Description.PortCollection.Contains -// System.Web.Services.Description.PortCollection.Add -/* - The following sample reads the contents of a file 'MathServiceAdd_cs.wsdl' - into a 'ServiceDescription' instance. It gets the collection of Service - instances from 'ServiceDescription'. It then adds a new port and checks - whether a port exists. The programs writes a new web service description - file. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -int main() -{ - try - { - Service^ myService; - PortCollection^ myPortCollection; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceAdd_cs.wsdl" ); - Console::WriteLine( "\nTotal Number of Services :{0}", myServiceDescription->Services->Count ); - for ( int i = 0; i < myServiceDescription->Services->Count; ++i ) - { - myService = myServiceDescription->Services[ i ]; - Console::WriteLine( "Name : {0}", myService->Name ); - - // - // - myPortCollection = myService->Ports; - Port^ myNewPort = myPortCollection[ 0 ]; - myPortCollection->Remove( myNewPort ); - - // Display the number of ports. - Console::WriteLine( "\nTotal number of ports before adding a new port : {0}", myService->Ports->Count ); - - // Add a new port. - myPortCollection->Add( myNewPort ); - - // Display the number of ports after adding a port. - Console::WriteLine( "Total number of ports after adding a new port : {0}", myService->Ports->Count ); - // - - bool bContain = myPortCollection->Contains( myNewPort ); - Console::WriteLine( "\nPort '{0}' exists : {1}", myNewPort->Name, bContain ); - - // Remove a port from the collection. - myPortCollection->Remove( myPortCollection[ myNewPort->Name ] ); - bContain = myPortCollection->Contains( myNewPort ); - Console::WriteLine( "Port '{0}' exists : {1}", myNewPort->Name, bContain ); - - // Create the description file. - myPortCollection->Insert( 0, myNewPort ); - myServiceDescription->Write( "MathServiceAddNew_cs.wsdl" ); - // - - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Exception:{0}", ex->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp deleted file mode 100644 index 3f20f18b74a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// System.Web.Services.Description.PortCollection.Insert -// System.Web.Services.Description.PortCollection.IndexOf -// System.Web.Services.Description.PortCollection.CopyTo -/* - The following sample reads the contents of a file 'MathService.wsdl' - into a 'ServiceDescription' instance. It gets the collection of Service - instances from 'ServiceDescription'. It instantiates 'PortCollection' for - each service in the collection. 'CopyTo' is called to copy - the contents into an array. Calls 'IndexOf' for a given port. - 'Insert' method is called to insert a new port in the collection. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -int main() -{ - try - { - Service^ myService; - PortCollection^ myPortCollection; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceCopyTo_cs.wsdl" ); - Console::WriteLine( "Total Number of Services :{0}", myServiceDescription->Services->Count ); - for ( int i = 0; i < myServiceDescription->Services->Count; ++i ) - { - myService = myServiceDescription->Services[ i ]; - Console::WriteLine( "Name : {0}", myService->Name ); - - // - // - // - myPortCollection = myService->Ports; - - // Create an array of Port objects. - Console::WriteLine( "\nPort collection :" ); - array^myPortArray = gcnew array(myService->Ports->Count); - myPortCollection->CopyTo( myPortArray, 0 ); - for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 ) - { - Console::WriteLine( "Port[{0}] : {1}", i1, myPortArray[ i1 ]->Name ); - - } - // - Port^ myIndexPort = myPortCollection[ 0 ]; - Console::WriteLine( "\n\nThe index of port '{0}' is : {1}", myIndexPort->Name, myPortCollection->IndexOf( myIndexPort ) ); - // - - Port^ myPortTestInsert = myPortCollection[ 0 ]; - myPortCollection->Remove( myPortTestInsert ); - myPortCollection->Insert( 0, myPortTestInsert ); - Console::WriteLine( "\n\nTotal Number of Ports after inserting a new port '{0}' is : {1}", myPortTestInsert->Name, myService->Ports->Count ); - for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 ) - { - Console::WriteLine( "Port[{0}] : {1}", i1, myPortArray[ i1 ]->Name ); - - } - myServiceDescription->Write( "MathServiceCopyToNew_cs.wsdl" ); - // - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Exception:{0}", ex->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp deleted file mode 100644 index 2f9033c0d1c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// System.Web.Services.Description.PortCollection -// System.Web.Services.Description.PortCollection.Remove -// System.Web.Services.Description.PortCollection.Item(String) -// System.Web.Services.Description.PortCollection.Item(Int32) -/* - The following sample reads the contents of a file 'MathService_cs.wsdl' - into a 'ServiceDescription' instance. It gets the collection of Service - instances from 'ServiceDescription'. It instantiates 'PortCollection' for - each service in the collection. It access the ports from the collection and - displays them. It accesses a port by its name from the collection and - displays its index. It adds a new port and calls 'Remove' - to remove the newly added port. The programs writes a new web service - description file. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - // - // - // - // - Service^ myService; - PortCollection^ myPortCollection; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceItem_cs.wsdl" ); - Console::WriteLine( "Total number of services : {0}", myServiceDescription->Services->Count ); - for ( int i = 0; i < myServiceDescription->Services->Count; ++i ) - { - myService = myServiceDescription->Services[ i ]; - Console::WriteLine( "Name : {0}", myService->Name ); - myPortCollection = myService->Ports; - - // Create an array of ports. - Console::WriteLine( "\nPort collection :" ); - for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 ) - { - Console::WriteLine( "Port[{0}] : {1}", i1, myPortCollection[ i1 ]->Name ); - } - // - - String^ strPort = myPortCollection[ 0 ]->Name; - Port^ myPort = myPortCollection[ strPort ]; - Console::WriteLine( "\nIndex of Port[{0}] : {1}", strPort, myPortCollection->IndexOf( myPort ) ); - // - - Port^ myPortTestRemove = myPortCollection[ 0 ]; - Console::WriteLine( "\nTotal number of ports before removing a port '{0}' is : {1}", myPortTestRemove->Name, myService->Ports->Count ); - myPortCollection->Remove( myPortTestRemove ); - Console::WriteLine( "Total number of ports after removing a port '{0}' is : {1}", myPortTestRemove->Name, myService->Ports->Count ); - - // Create the WSDL file. - myPortCollection->Insert( 0, myPortTestRemove ); - myServiceDescription->Write( "MathServiceItemNew_cs.wsdl" ); - // - // - } - } - catch ( Exception^ ex ) - { - Console::WriteLine( "Exception: {0}", ex->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp b/snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp deleted file mode 100644 index e6400fcfd3f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -// System.Web.Services.Description.PortType.Operations -// System.Web.Services.Description.PortType.PortType() -// System.Web.Services.Description.PortType.Name -/*The following sample demonstrates the properties 'Operations','Name' and constructor -'PortType()' of class 'PortType'. This sample reads the contents of a file 'MathService_cs.wsdl' -into a 'ServiceDescription' instance. It gets the collection of 'PortType' -instances from 'ServiceDescription'. It removes a 'PortType' from the collection, creates a -new 'PortType' and adds it into collection. The programs writes a new web service description -file 'MathService_New.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) -{ - Operation^ myOperation = gcnew Operation; - myOperation->Name = operationName; - OperationMessage^ input = dynamic_cast(gcnew OperationInput); - input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); - OperationMessage^ output = dynamic_cast(gcnew OperationOutput); - output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); - myOperation->Messages->Add( input ); - myOperation->Messages->Add( output ); - return myOperation; -} - -int main() -{ - try - { - // - // - PortTypeCollection^ myPortTypeCollection; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - myPortTypeCollection = myServiceDescription->PortTypes; - int noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes : {0}", noOfPortTypes ); - PortType^ myPortType = myPortTypeCollection[ "MathServiceSoap" ]; - myPortTypeCollection->Remove( myPortType ); - - // Create a new PortType. - PortType^ myNewPortType = gcnew PortType; - myNewPortType->Name = "MathServiceSoap"; - OperationCollection^ myOperationCollection = myServiceDescription->PortTypes[ 0 ]->Operations; - String^ inputMsg; - String^ outputMsg; - for ( int i = 0; i < myOperationCollection->Count; i++ ) - { - inputMsg = String::Concat( myOperationCollection[ i ]->Name, "SoapIn" ); - outputMsg = String::Concat( myOperationCollection[ i ]->Name, "SoapOut" ); - Console::WriteLine( " Operation = {0}", myOperationCollection[ i ]->Name ); - myNewPortType->Operations->Add( CreateOperation( myOperationCollection[ i ]->Name, inputMsg, outputMsg, myServiceDescription->TargetNamespace ) ); - - } - myPortTypeCollection->Add( myNewPortType ); - noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes : {0}", noOfPortTypes ); - myServiceDescription->Write( "MathService_New.wsdl" ); - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception:{0}", e->Message ); - } - -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp deleted file mode 100644 index bfaa4c38ac4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// System.Web.Services.Description.PortTypeCollection.Item[int] -// System.Web.Services.Description.PortTypeCollection.Remove() -// System.Web.Services.Description.PortTypeCollection.Add() -/*The following sample demonstrates the indexer 'Item[int]', methods -'Remove()' and 'Add()' of class 'PortTypeCollection'. It reads the -contents of a file 'MathService.wsdl'into a 'ServiceDescription' instance. -It gets the collection of 'PortType' from 'ServiceDescription' and adds -a new PortType and writes a new web service description file into -'MathService_New.wsdl'. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -int main() -{ - try - { - // - // - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - int noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count ); - - // Get the first PortType in the collection. - PortType^ myNewPortType = myPortTypeCollection[ 0 ]; - Console::WriteLine( "The PortType at index 0 is: {0}", myNewPortType->Name ); - Console::WriteLine( "Removing the PortType {0}", myNewPortType->Name ); - - // Remove the PortType from the collection. - myPortTypeCollection->Remove( myNewPortType ); - - // Display the number of PortTypes. - Console::WriteLine( "\nTotal number of PortTypes after removing: {0}", myServiceDescription->PortTypes->Count ); - Console::WriteLine( "Adding a PortType {0}", myNewPortType->Name ); - - // Add a new PortType from the collection. - myPortTypeCollection->Add( myNewPortType ); - - // Display the number of PortTypes after adding a port. - Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count ); - myServiceDescription->Write( "MathService_New.wsdl" ); - // - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp deleted file mode 100644 index 3a73b6fac7f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp +++ /dev/null @@ -1,68 +0,0 @@ - - -// System.Web.Services.Description.PortTypeCollection.Contains() -// System.Web.Services.Description.PortTypeCollection.Insert() -// System.Web.Services.Description.PortTypeCollection.IndexOf() -// System.Web.Services.Description.PortTypeCollection.Item[string] -/* -The following sample demonstrates the methods 'IndexOf()','Insert()','Contains()' and -indexer 'Item[string]' of class 'PortTypeCollection'. This sample reads the contents -of 'MathService.wsdl' into a 'ServiceDescription' instance. It gets the collection of -'PortType' instances from 'ServiceDescription'. It removes a 'PortType' with the name -'MathServiceSoap' and adds the same later. Then it checks whether the collection contains -the added 'PortType'. The sample writes a new web service description file 'MathService_New.wsdl'. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -int main() -{ - try - { - // - // - // - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - int noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes ); - PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ]; - // - - // Get the index in the collection. - int index = myPortTypeCollection->IndexOf( myNewPortType ); - // - - Console::WriteLine( "Removing the PortType named {0}", myNewPortType->Name ); - - // Remove the PortType from the collection. - myPortTypeCollection->Remove( myNewPortType ); - noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes ); - - // Check whether the PortType exists in the collection. - bool bContains = myPortTypeCollection->Contains( myNewPortType ); - Console::WriteLine( "Port Type'{0}' exists: {1}", myNewPortType->Name, bContains ); - Console::WriteLine( "Adding the PortType" ); - - // Insert a new portType at the index location. - myPortTypeCollection->Insert( index, myNewPortType ); - // - - // Display the number of portTypes after adding a port. - Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count ); - bContains = myPortTypeCollection->Contains( myNewPortType ); - Console::WriteLine( "Port Type'{0}' exists: {1}", myNewPortType->Name, bContains ); - myServiceDescription->Write( "MathService_New.wsdl" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp deleted file mode 100644 index a0c7a4790fc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - -// System.Web.Services.Description.PortTypeCollection -/* The following sample demonstrates the class 'PortTypeCollection'. It reads the -contents of WSDL document 'MathService.wsdl'into a 'ServiceDescription' instance. -It gets the collection of 'PortType'from 'ServiceDescription'. It copies the -collection into an array of 'PortType' and displays their names. Then it removes a -'PortType', checks whether the collection contains the removed 'PortType'. -It adds the same 'PortType' and writes a new web service description file into -'MathService_New.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -using namespace System::Collections; -int main() -{ - try - { - // Read the existing Web service description file. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - int noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count ); - - // Get the first PortType in the collection. - PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ]; - int index = myPortTypeCollection->IndexOf( myNewPortType ); - Console::WriteLine( "The PortType with the name {0} is at index: {1}", myNewPortType->Name, (index + 1) ); - Console::WriteLine( "Removing the PortType: {0}", myNewPortType->Name ); - - // Remove the PortType from the collection. - myPortTypeCollection->Remove( myNewPortType ); - bool bContains = myPortTypeCollection->Contains( myNewPortType ); - Console::WriteLine( "The PortType with the name {0} exists: {1}", myNewPortType->Name, bContains ); - Console::WriteLine( "Total number of PortTypes after removing: {0}", myServiceDescription->PortTypes->Count ); - Console::WriteLine( "Adding a PortType: {0}", myNewPortType->Name ); - - // Add a new portType from the collection. - myPortTypeCollection->Add( myNewPortType ); - - // Display the number of portTypes after adding a port. - Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count ); - - // List the PortTypes available in the WSDL document. - IEnumerator^ myEnum = myPortTypeCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - PortType^ myPortType = safe_cast(myEnum->Current); - Console::WriteLine( "The PortType name is: {0}", myPortType->Name ); - } - myServiceDescription->Write( "MathService_New.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp deleted file mode 100644 index f5b3a9694c0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// System.Web.Services.Description.PortTypeCollection.CopyTo() - -/* -The following sample demonstrates the 'CopyTo()' method of the class -'PortTypeCollection'. This sample reads the contents of a file 'MathService.wsdl' -into a 'ServiceDescription' instance. It gets the collection of 'PortType' -from 'ServiceDescription'. It copies the collection into an array of 'PortType' -and displays their names. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -int main() -{ - try - { -// - PortTypeCollection^ myPortTypeCollection; - - ServiceDescription^ myServiceDescription = - ServiceDescription::Read( "MathService_CS.wsdl" ); - - myPortTypeCollection = myServiceDescription->PortTypes; - int noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes: {0}", - myServiceDescription->PortTypes->Count ); - - // Copy the collection into an array. - array^ myPortTypeArray = gcnew array(noOfPortTypes); - myPortTypeCollection->CopyTo( myPortTypeArray, 0 ); - - // Display names of all PortTypes. - for ( int i = 0; i < noOfPortTypes; i++ ) - { - Console::WriteLine( "PortType name: {0}", myPortTypeArray[ i ]->Name ); - } - myServiceDescription->Write( "MathService_New.wsdl" ); -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp b/snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp deleted file mode 100644 index a8935574cb1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// System.Web.Services.Description.PortType -/* -The following sample demonstrates the class 'PortType'. This sample reads -the contents of a file 'MathService_cs.wsdl' into a 'ServiceDescription' instance. -It gets the collection of 'PortType' instances from 'ServiceDescription'. -It removes a 'PortType' from the collection, creates a new 'PortType' and adds -it into collection. The programs writes a new web service description -file 'MathService_New.wsdl'. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; -Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) -{ - Operation^ myOperation = gcnew Operation; - myOperation->Name = operationName; - OperationMessage^ input = dynamic_cast(gcnew OperationInput); - input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); - OperationMessage^ output = dynamic_cast(gcnew OperationOutput); - output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); - myOperation->Messages->Add( input ); - myOperation->Messages->Add( output ); - return myOperation; -} - -int main() -{ - try - { - PortTypeCollection^ myPortTypeCollection; - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - myPortTypeCollection = myServiceDescription->PortTypes; - int noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal number of PortTypes : {0}", noOfPortTypes ); - PortType^ myPortType = myPortTypeCollection[ "MathServiceSoap" ]; - myPortTypeCollection->Remove( myPortType ); - - // Create a new PortType. - PortType^ myNewPortType = gcnew PortType; - myNewPortType->Name = "MathServiceSoap"; - OperationCollection^ myOperationCollection = myServiceDescription->PortTypes[ 0 ]->Operations; - for ( int i = 0; i < myOperationCollection->Count; i++ ) - { - String^ inputmsg = String::Concat( myOperationCollection[ i ]->Name, "SoapIn" ); - String^ outputmsg = String::Concat( myOperationCollection[ i ]->Name, "SoapOut" ); - Console::WriteLine( "Operation = {0}", myOperationCollection[ i ]->Name ); - myNewPortType->Operations->Add( CreateOperation( myOperationCollection[ i ]->Name, inputmsg, outputmsg, myServiceDescription->TargetNamespace ) ); - - } - - // Add the PortType to the collection. - myPortTypeCollection->Add( myNewPortType ); - noOfPortTypes = myServiceDescription->PortTypes->Count; - Console::WriteLine( "\nTotal Number of PortTypes : {0}", noOfPortTypes ); - myServiceDescription->Write( "MathService_New.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp deleted file mode 100644 index 1df6d73f925..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp +++ /dev/null @@ -1,131 +0,0 @@ - - -// System.Runtime.Remoting.Proxies.RealProxy.SupportsInterface(Guid); -// System.Runtime.Remoting.Proxies.RealProxy.GetCOMIUnknown(bool); -// System.Runtime.Remoting.Proxies.RealProxy.SetCOMIUnknown(IntPtr); -/* The following example demonstrates implementation of methods -'GetCOMIUnknown','SupportsInterface' and 'SetCOMIUnknown' of -System.Runtime.Remoting.Proxies.RealProxy. - -The following program has a 'CustomProxy' referring to unmanaged COM component. -A COM Runtime Wrapper takes care of method call to unmanaged world. SupportsInterface -method is overridden to return address of COM Runtime Wrapper. -*/ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Activation; -using namespace System::Runtime::Remoting::Proxies; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Permissions; -using namespace ActiveDs; -// using namespace InterOpADS; -public ref class MyProxy: public RealProxy -{ -private: - String^ m_URI; - MarshalByRefObject^ myMarshalByRefObject; - -public: - [SecurityPermission(SecurityAction::LinkDemand)] - MyProxy() - : RealProxy() - { - Console::WriteLine( "MyProxy Constructor Called..." ); - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance(WinNTSystemInfo::typeid )); - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - m_URI = myObjRef->URI; - } - - [SecurityPermission(SecurityAction::LinkDemand)] - MyProxy( Type^ myType ) - : RealProxy( myType ) - { - Console::WriteLine( "MyProxy Constructor Called..." ); - myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( myType )); - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - m_URI = myObjRef->URI; - } - - [SecurityPermission(SecurityAction::LinkDemand)] - MyProxy( Type^ myType, MarshalByRefObject^ targetObject ) - : RealProxy( myType ) - { - Console::WriteLine( "MyProxy Constructor Called..." ); - myMarshalByRefObject = targetObject; - ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); - m_URI = myObjRef->URI; - } - - [SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)] - virtual IMessage^ Invoke( IMessage^ msg ) override - { - if ( dynamic_cast(msg) ) - { - - // Initialize a new instance of remote object - IConstructionReturnMessage^ myIConstructionReturnMessage = this->InitializeServerObject( dynamic_cast(msg) ); - ConstructionResponse^ constructionResponse = gcnew ConstructionResponse( nullptr,dynamic_cast(msg) ); - return constructionResponse; - } - - IDictionary^ myIDictionary = msg->Properties; - IMessage^ retMsg; - myIDictionary->default[ "__Uri" ] = m_URI; - - // Synchronously dispatch messages to server. - retMsg = ChannelServices::SyncDispatchMessage( msg ); - - // Pushing return value and OUT parameters back onto stack - IMethodReturnMessage^ mrm = dynamic_cast(retMsg); - return retMsg; - } - - // - // - // - [SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)] - IntPtr SupportsInterface( Guid * /*myGuid*/ ) - { - Console::WriteLine( "SupportsInterface method called" ); - - // Object reference is requested for communication with unmanaged objects - // in the current process through COM. - IntPtr myIntPtr = this->GetCOMIUnknown( false ); - - // Stores an unmanaged proxy of the object. - this->SetCOMIUnknown( myIntPtr ); - - // return COM Runtime Wrapper pointer. - return myIntPtr; - } - // - // - // -}; - - -// Acts as a custom proxy user. -[SecurityPermission(SecurityAction::LinkDemand)] -int main() -{ - Console::WriteLine( "" ); - Console::WriteLine( "CustomProxy Sample" ); - Console::WriteLine( "==================" ); - MyProxy^ mProxy = gcnew MyProxy( WinNTSystemInfo::typeid); - WinNTSystemInfo^ myHelloServer = dynamic_cast(mProxy->GetTransparentProxy()); - Console::WriteLine( "Machine Name = {0}", myHelloServer->ComputerName ); - Console::WriteLine( "Domain Name = {0}", myHelloServer->DomainName ); - Console::WriteLine( "User Name = {0}", myHelloServer->UserName ); - - // Construct Guid object from unmanaged Interface 'IADsWinNTSystemInfo' guid. - Guid myGuid = Guid("{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}"); - IntPtr myIntrPtr = mProxy->SupportsInterface( &myGuid ); - Console::WriteLine( "Requested Interface Pointer= {0}", myIntrPtr.ToInt32() ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp deleted file mode 100644 index 11d4599ec99..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -#using -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Net::Sockets; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Lifetime; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Runtime::Serialization; -using namespace System::Collections; -using namespace SampleNamespace; - -int main() -{ - ChannelServices::RegisterChannel( gcnew HttpChannel( 0 ) ); - RemotingConfiguration::RegisterActivatedClientType( SampleService::typeid, "http://localhost:9000/MySampleService" ); - SampleService ^ myRemoteObject = gcnew SampleService; - bool result = myRemoteObject->SampleMethod(); - - // System::Runtime::Remoting::ObjRef - // - ObjRef^ objRefSample = RemotingServices::GetObjRefForProxy( myRemoteObject ); - Console::WriteLine( "***ObjRef Details***" ); - Console::WriteLine( "URI:\t {0}", objRefSample->URI ); - array^channelData = objRefSample->ChannelInfo->ChannelData; - Console::WriteLine( "Channel Info:" ); - for each(Object^ o in channelData) - Console::WriteLine("\t{0}", o->ToString()); - IEnvoyInfo^ envoyInfo = objRefSample->EnvoyInfo; - if ( envoyInfo == nullptr ) - { - Console::WriteLine( "This ObjRef does not have envoy information." ); - } - else - { - IMessageSink^ envoySinks = envoyInfo->EnvoySinks; - Console::WriteLine( "Envoy Sink Class: {0}", envoySinks ); - } - IRemotingTypeInfo^ typeInfo = objRefSample->TypeInfo; - Console::WriteLine( "Remote type name: {0}", typeInfo->TypeName ); - Console::WriteLine( "Can my Object cast to a Bitmap? {0}", typeInfo->CanCastTo( System::Drawing::Bitmap::typeid, objRefSample ) ); - Console::WriteLine( "Is this Object from this AppDomain? {0}", objRefSample->IsFromThisAppDomain() ); - Console::WriteLine( "Is this Object from this process? {0}", objRefSample->IsFromThisProcess() ); - // - - return 0; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp deleted file mode 100644 index ef46529987d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel ); - RemotingConfiguration::RegisterActivatedClientType( HelloServiceClass::typeid, "tcp://localhost:8082" ); - try - { - HelloServiceClass ^ service = gcnew HelloServiceClass; - - // Calls the remote method. - Console::WriteLine(); - Console::WriteLine( "Calling remote Object" ); - Console::WriteLine( service->HelloMethod( "Caveman" ) ); - Console::WriteLine( service->HelloMethod( "Spaceman" ) ); - Console::WriteLine( service->HelloMethod( "Client Man" ) ); - Console::WriteLine( "Finished remote Object call" ); - } - catch (Exception ex) - { - Console::WriteLine("An exception occurred: " + ex.Message); - } - Console::WriteLine(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp deleted file mode 100644 index f11b436af12..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); - RemotingConfiguration::RegisterActivatedServiceType( HelloServiceClass::typeid ); - Console::WriteLine( "Press enter to stop this process." ); - Console::ReadLine(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp deleted file mode 100644 index 75ffaf57d8f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using - -using namespace System; - -public ref class HelloServiceClass: public MarshalByRefObject -{ -private: - static int n_instance; - -public: - HelloServiceClass() - { - n_instance++; - Console::WriteLine( "{0} has been created. Instance # = {1}", this->GetType()->Name, n_instance ); - } - - ~HelloServiceClass() - { - Console::WriteLine( "Destroyed instance {0} of HelloServiceClass.", n_instance ); - n_instance--; - } - - String^ HelloMethod( String^ name ) - { - // Reports that the method was called. - Console::WriteLine(); - Console::WriteLine( "Called HelloMethod on instance {0} with the '{1}' parameter.", n_instance, name ); - - // Calculates and returns the result to the client. - return String::Format( "Hi there {0}", name ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp deleted file mode 100644 index a7646f3ab1c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -public ref class HelloServer: public MarshalByRefObject -{ -private: - static int n_called = 0; - -public: - static void Main() - { -// -// - // Registers the server and waits until the user hits enter. - TcpChannel^ chan = gcnew TcpChannel( 8084 ); - ChannelServices::RegisterChannel( chan ); - - RemotingConfiguration::RegisterWellKnownServiceType( - Type::GetType( "HelloServer,server" ), - "SayHello", - WellKnownObjectMode::SingleCall ); - System::Console::WriteLine( L"Hit to exit..." ); - System::Console::ReadLine(); -// -// - } - - HelloServer() - { - Console::WriteLine( "HelloServer activated" ); - } - - ~HelloServer() - { - Console::WriteLine( "Object Destroyed" ); - } - - String^ HelloMethod( String^ name ) - { - // Reports that the method was called. - Console::WriteLine(); - Console::WriteLine( "Hello.HelloMethod : {0}", name ); - n_called++; - Console::WriteLine( "The method was called {0} times.", n_called ); - - // Calculates and returns the result to the client. - return String::Format( "Hi there {0}", name ); - } -}; -// - -int main() -{ - HelloServer::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp deleted file mode 100644 index 4a3d08ad8ad..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -// -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Channels; -int main() -{ - // - // - ChannelServices::RegisterChannel( gcnew TcpChannel ); - RemotingConfiguration::RegisterWellKnownClientType( HelloService::typeid, - "tcp://localhost:8082/HelloServiceApplication/MyUri" ); - HelloService ^ service = gcnew HelloService; - // - // - if ( service == nullptr ) - { - Console::WriteLine( "Could not locate server." ); - return -1; - } - - // Calls the remote method. - Console::WriteLine(); - Console::WriteLine( "Calling remote Object*" ); - Console::WriteLine( service->HelloMethod( "Caveman" ) ); - Console::WriteLine( service->HelloMethod( "Spaceman" ) ); - Console::WriteLine( service->HelloMethod( "Client Man" ) ); - Console::WriteLine( "Finished remote Object* call" ); - Console::WriteLine(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp deleted file mode 100644 index 35c1d834e80..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -int main() -{ - // - // - ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); - RemotingConfiguration::ApplicationName = "HelloServiceApplication"; - RemotingConfiguration::RegisterWellKnownServiceType( HelloService::typeid, - "MyUri", - WellKnownObjectMode::SingleCall ); - // - // - Console::WriteLine( "Press enter to stop this process." ); - Console::ReadLine(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp deleted file mode 100644 index f8d912e49bf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -// -#using - -using namespace System; -public ref class HelloService: public MarshalByRefObject -{ -private: - static int n_instances; - -public: - HelloService() - { - n_instances++; - Console::WriteLine( "" ); - Console::WriteLine( "HelloService activated - instance # {0}.", n_instances ); - } - - ~HelloService() - { - Console::WriteLine( "HelloService instance {0} destroyed.", n_instances ); - n_instances--; - } - - String^ HelloMethod( String^ name ) - { - Console::WriteLine( "HelloMethod called on HelloService instance {0}.", n_instances ); - return String::Format( "Hi there {0}.", name ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp deleted file mode 100644 index 122bcd549e0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.Configure -// System.Runtime.Remoting.RemotingConfiguration.GetRegisteredWellKnownServiceTypes -/* - The following example demonstrates the 'Configure' and - 'GetRegisteredWellKnownServiceTypes' methods of 'RemotingConfiguration' class. - It configures the remoting infrastructure using the 'Configure' method.Then gets - the registered well-known objects at the service end and displays it's properties - on the console. -*/ -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Channels::Http; - -int main() -{ - // - // Configure the remoting structure. - RemotingConfiguration::Configure( "server.config" ); - // - - // - // Retrive the array of objects registered as well known types at - // the service end. - array^myEntries = RemotingConfiguration::GetRegisteredWellKnownServiceTypes(); - Console::WriteLine( "The number of WellKnownServiceTypeEntries are:{0}", myEntries->Length ); - Console::WriteLine( "The Object Type is:{0}", myEntries[ 0 ]->ObjectType ); - Console::WriteLine( "The Object Uri is:{0}", myEntries[ 0 ]->ObjectUri ); - Console::WriteLine( "The Mode is:{0}", myEntries[ 0 ]->Mode ); - // - - Console::WriteLine( "Press to exit..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp deleted file mode 100644 index 8853fd1bced..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.IsActivationAllowed -// System.Runtime.Remoting.RemotingConfiguration.GetRegisteredActivatedServiceTypes -/* -The following example demonstrates the 'IsActivationAllowed' and -'GetRegisteredActivatedServiceTypes' methods of 'RemotingConfiguration' class. -It registers a 'TcpChannel' object with the channel services. Then registers the 'MyServerImpl' -object at the service end that can be activated on request from a client.By using the -'GetRegisteredActivatedClientTypes' method it gets the registered activated service types -and displays it's properties to the console. - -*/ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel( 8085 ) ); - RemotingConfiguration::RegisterActivatedServiceType( MyServerImpl::typeid ); - - // - // - // Check whether the 'MyServerImpl' object is allowed for - // activation or not. - if ( RemotingConfiguration::IsActivationAllowed( MyServerImpl::typeid ) ) - { - // Get the registered activated service types . - array^myActivatedServiceEntries = RemotingConfiguration::GetRegisteredActivatedServiceTypes(); - Console::WriteLine( "The Length of the registered activated service type array is {0}", myActivatedServiceEntries->Length ); - Console::WriteLine( "The Object type is:{0}", myActivatedServiceEntries[ 0 ]->ObjectType ); - } - // - // - - Console::WriteLine( "Press enter to stop this process." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp deleted file mode 100644 index e149f6b0fb6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.GetRegisteredWellKnownClientTypes -/* -The following example demonstrates the 'GetRegisteredWellKnownClientTypes' method -of 'RemotingConfiguration' class. -It registers a 'TcpChannel' object with the channel services. Then registers the -'MyServerImpl' object as well-known type at the client end. By using the -'GetRegisteredWellKnownClientTypes' method it gets well-known types registered -at the client side and displays it's properties to the console. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -int main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel ); - - // Register the specified object as well-known type at client end. - RemotingConfiguration::RegisterWellKnownClientType( MyServerImpl::typeid, "tcp://localhost:8085/SayHello" ); - MyServerImpl ^ myObject = gcnew MyServerImpl; - Console::WriteLine( myObject->MyMethod( "ClientString" ) ); - - // - // Get the well-known types registered at the client. - array^myEntries = RemotingConfiguration::GetRegisteredWellKnownClientTypes(); - Console::WriteLine( "The number of WellKnownClientTypeEntries are:{0}", myEntries->Length ); - Console::WriteLine( "The Object type is:{0}", myEntries[ 0 ]->ObjectType ); - Console::WriteLine( "The Object Url is:{0}", myEntries[ 0 ]->ObjectUrl ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp deleted file mode 100644 index 39c71256e28..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.IsRemotelyActivatedClientType(Type) -/* -The following example demonstrates the 'IsRemotelyActivatedClientType(Type)' method -of 'RemotingConfiguration' class. -It registers a 'TcpChannel' object with the channel services. Then registers the 'MyServerImpl' -object as activated client type which can be activated at the server. By using the above -method it gets the activated client type registered at the client side and displays it's -properties to the console. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -int main() -{ - try - { - ChannelServices::RegisterChannel( gcnew TcpChannel, false ); - RemotingConfiguration::RegisterActivatedClientType( MyServerImpl::typeid, "tcp://localhost:8085" ); - MyServerImpl ^ myObject = gcnew MyServerImpl; - for ( int i = 0; i <= 4; i++ ) - Console::WriteLine( myObject->MyMethod( String::Format( "invoke the server method {0} time.", (i + 1) ) ) ); - - // - // Check whether the 'MyServerImpl' type is registered as - // a remotely activated client type. - ActivatedClientTypeEntry^ myActivatedClientEntry = RemotingConfiguration::IsRemotelyActivatedClientType( MyServerImpl::typeid); - Console::WriteLine( "The Object type is {0}", myActivatedClientEntry->ObjectType ); - Console::WriteLine( "The Application Url is {0}", myActivatedClientEntry->ApplicationUrl ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp deleted file mode 100644 index ee5aae8ca7c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.IsRemotelyActivatedClientType(String,String) -/* -The following example demonstrates the 'IsRemotelyActivatedClientType(String,String)' method -of 'RemotingConfiguration' class. -It registers a 'TcpChannel' object with the channel services. Then registers the 'MyServerImpl' -object as activated client type which can be activated at the server and displays it's -properties to the console. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - try - { - ChannelServices::RegisterChannel( gcnew TcpChannel, false ); - RemotingConfiguration::RegisterActivatedClientType( MyServerImpl::typeid, "tcp://localhost:8085" ); - MyServerImpl ^ myObject = gcnew MyServerImpl; - for ( int i = 0; i <= 4; i++ ) - Console::WriteLine( myObject->MyMethod( "invoke the server method " ) ); - - // Get the assembly for the 'MyServerImpl' object. - // - Assembly^ myAssembly = Assembly::GetAssembly( MyServerImpl::typeid ); - AssemblyName^ myName = myAssembly->GetName(); - - // Check whether the 'MyServerImpl' type is registered as - // a remotely activated client type. - ActivatedClientTypeEntry^ myActivatedClientEntry = - RemotingConfiguration::IsRemotelyActivatedClientType( MyServerImpl::typeid->FullName, myName->Name ); - Console::WriteLine( "The Object type : {0}", myActivatedClientEntry->ObjectType ); - Console::WriteLine( "The Application Url : {0}", myActivatedClientEntry->ApplicationUrl ); - if (myActivatedClientEntry) - Console::WriteLine( "The object is client activated"); - else - Console::WriteLine("The object is not client activated"); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp deleted file mode 100644 index 00ffa473c27..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.IsWellKnownClientType(Type) -/* -The following example demonstrates the 'IsWellKnownClientType(Type)' method -of 'RemotingConfiguration' class. It registers a 'TcpChannel' object with the channel -services. Then registers the 'MyServerImpl' object as well-known type. By using the above -method it gets the well-known type registered at the client side and displays it's -properties to the console. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel, false ); - - // Register the 'MyServerImpl' object as well known type - // at client end. - RemotingConfiguration::RegisterWellKnownClientType( MyServerImpl::typeid, "tcp://localhost:8085/SayHello" ); - MyServerImpl ^ myObject = gcnew MyServerImpl; - Console::WriteLine( myObject->MyMethod( "ClientString" ) ); - - // - // Check whether the specified object type is registered as - // well known client type or not. - WellKnownClientTypeEntry^ myWellKnownClientType = RemotingConfiguration::IsWellKnownClientType( MyServerImpl::typeid ); - Console::WriteLine( "The Object type is {0}", myWellKnownClientType->ObjectType ); - Console::WriteLine( "The Object Url is {0}", myWellKnownClientType->ObjectUrl ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp deleted file mode 100644 index ba0e93af1f0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -// System.Runtime.Remoting.RemotingConfiguration.IsWellKnownClientType(String,String) -/* -The following example demonstrates the 'IsWellKnownClientType(String,String)' method -of 'RemotingConfiguration' class. It registers a 'TcpChannel' object with the channel -services. Then registers the 'MyServerImpl' object as well-known type at the client end. -and displays it's properties to the console. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Reflection; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel, false ); - - // Register the 'MyServerImpl' object as well known type - // at client end. - RemotingConfiguration::RegisterWellKnownClientType( MyServerImpl::typeid, "tcp://localhost:8085/SayHello" ); - - // - MyServerImpl ^ myObject = gcnew MyServerImpl; - - // Get the assembly for the 'MyServerImpl' object. - Assembly^ myAssembly = Assembly::GetAssembly( MyServerImpl::typeid ); - AssemblyName^ myName = myAssembly->GetName(); - - // Check whether the specified object type is registered as - // well-known client type. - WellKnownClientTypeEntry^ myWellKnownClientType = RemotingConfiguration::IsWellKnownClientType( MyServerImpl::typeid->FullName, myName->Name ); - Console::WriteLine( "The Object type :{0}", myWellKnownClientType->ObjectType ); - Console::WriteLine( "The Object Uri :{0}", myWellKnownClientType->ObjectUrl ); - // - Console::WriteLine( myObject->MyMethod( "Remote method is called." ) ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp deleted file mode 100644 index d1b75b89c64..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Runtime::Remoting; - -namespace TempConverter -{ - public ref class Converter: public MarshalByRefObject{}; - -} - -ref class Client -{ -public: - void RunSnippet() - { - // - // Create a remote version of TempConverter::Converter. - TempConverter::Converter^ converter1 = - dynamic_cast(Activator::GetObject( - TempConverter::Converter::typeid, - "http://localhost:8085/TempConverter" )); - - // Create a local version of TempConverter::Converter. - TempConverter::Converter^ converter2 = gcnew TempConverter::Converter; - - // Returns true, converter1 is remote and in a different appdomain. - System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter1 ); - - // Returns false, converter2 is local and running in this appdomain. - System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter2 ); - - // Returns true, converter1 is remote and in a different context. - System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter1 ); - - // Returns false, converter2 is local and running in this context. - System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter2 ); - // - - // Print those function calls. - System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfAppDomain( converter1 ) ); - System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfAppDomain( converter2 ) ); - System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfContext( converter1 ) ); - System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfContext( converter2 ) ); - } -}; - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - Client^ client = gcnew Client; - client->RunSnippet(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp deleted file mode 100644 index 0bfe3822e74..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace SampleNamespace; -using namespace System::Security::Permissions; - -public ref class SampleClient -{ -private: - static const String^ SERVER_URL = "http://localhost:9000/MySampleService/SampleWellKnown.soap"; - -public: - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::RemotingConfiguration)] - static void Snippet1() - { - // - Console::WriteLine( "Connecting to SampleNamespace::SampleWellKnown." ); - SampleWellKnown ^ proxy = dynamic_cast(RemotingServices::Connect( SampleWellKnown::typeid, const_cast(SERVER_URL) )); - Console::WriteLine( "Connected to SampleWellKnown" ); - - // Verifies that the Object* reference is to a transparent proxy. - if ( RemotingServices::IsTransparentProxy( proxy ) ) - Console::WriteLine( "proxy is a reference to a transparent proxy." ); - else - Console::WriteLine( "proxy is not a transparent proxy. This is unexpected." ); - - // Calls a method on the server Object*. - Console::WriteLine( "proxy->Add returned {0}.", proxy->Add( 2, 3 ) ); - // - } - -}; - -int main() -{ - SampleClient::Snippet1(); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp deleted file mode 100644 index d526055447a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace SampleNamespace; - -// Note: this snippet is based on v-ralphs' Dynamic Remoting sample. -int main() -{ - // - TcpChannel^ channel = gcnew TcpChannel( 9000 ); - ChannelServices::RegisterChannel( channel ); - SampleWellKnown ^ objectWellKnown = gcnew SampleWellKnown; - - // After the channel is registered, the Object* needs to be registered - // with the remoting infrastructure. So, Marshal is called. - ObjRef^ objrefWellKnown = RemotingServices::Marshal( objectWellKnown, "objectWellKnownUri" ); - Console::WriteLine( "An instance of SampleWellKnown type is published at {0}.", objrefWellKnown->URI ); - Console::WriteLine( "Press enter to unregister SampleWellKnown, so that it is no longer available on this channel." ); - Console::ReadLine(); - RemotingServices::Disconnect( objectWellKnown ); - Console::WriteLine( "Press enter to end the server process." ); - Console::ReadLine(); - // - - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp deleted file mode 100644 index 79aaac386f2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp +++ /dev/null @@ -1,153 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Diagnostics; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Contexts; -using namespace System::Runtime::Remoting::Channels; - -public ref class SampleService: public ContextBoundObject -{ -public: - bool UpdateServer( int i, double d, String^ s ) - { - Console::WriteLine( "SampleService::UpdateServer called: {0}, {1}, {2}", i, d, s ); - return true; - } - -}; - -public ref class ReplicationSink: public IDynamicMessageSink -{ -private: - static const String^ replicatedServiceUri = "/SampleServiceUri"; - static const String^ replicationServerUrl = "tcp://localhost:9001"; - -public: - - // System::Runtime::Remoting::RemotingServices.ExecuteMessage - // System::Runtime::Remoting::RemotingServices.GetSessionIdForMethodMessage - // - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual void ProcessMessageStart( IMessage^ requestMessage, bool /*bClientSide*/, bool /*bAsyncCall*/ ) - { - Console::WriteLine( "\nProcessMessageStart" ); - Console::WriteLine( "requestMessage = {0}", requestMessage ); - try - { - Console::WriteLine( "SessionId = {0}.", RemotingServices::GetSessionIdForMethodMessage( dynamic_cast(requestMessage) ) ); - } - catch ( InvalidCastException^ ) - { - Console::WriteLine( "The requestMessage is not an IMethodMessage*." ); - } - - IMethodCallMessage^ requestMethodCallMessage; - try - { - requestMethodCallMessage = dynamic_cast(requestMessage); - - // Prints the details of the IMethodCallMessage* to the console. - Console::WriteLine( "\nMethodCall details" ); - Console::WriteLine( "Uri = {0}", requestMethodCallMessage->Uri ); - Console::WriteLine( "TypeName = {0}", requestMethodCallMessage->TypeName ); - Console::WriteLine( "MethodName = {0}", requestMethodCallMessage->MethodName ); - Console::WriteLine( "ArgCount = {0}", requestMethodCallMessage->ArgCount ); - Console::WriteLine( "MethodCall::Args" ); - IEnumerator^ myEnum = requestMethodCallMessage->Args->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "\t {0}", o ); - - // Sends this method call message to another server to replicate - // the call at the second server. - if ( requestMethodCallMessage->Uri == replicatedServiceUri ) - { - String^ repSvr = String::Format( "{0}{1}", const_cast(replicationServerUrl), const_cast(replicatedServiceUri) ); - SampleService^ replicationService = dynamic_cast(Activator::GetObject( SampleService::typeid, repSvr )); - IMethodReturnMessage^ returnMessage = RemotingServices::ExecuteMessage( replicationService, requestMethodCallMessage ); - - // Prints the results of the method call stored in the IMethodReturnMessage*. - Console::WriteLine( "\nMessage returned by ExecuteMessage." ); - Console::WriteLine( "\tException = {0}", returnMessage->Exception ); - Console::WriteLine( "\tReturnValue = {0}", returnMessage->ReturnValue ); - Console::WriteLine( "\tOutArgCount = {0}", returnMessage->OutArgCount ); - Console::WriteLine( "Return message OutArgs" ); - IEnumerator^ myEnum = requestMethodCallMessage->Args->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "\t {0}", o ); - } - } - } - } - catch ( InvalidCastException^ ) - { - Console::WriteLine( "The requestMessage is not a MethodCall" ); - } - } - // - - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual void ProcessMessageFinish( IMessage^ requestMessage, bool /*bClientSide*/, bool /*bAsyncCall*/ ) - { - Console::WriteLine( "\nProcessMessageFinish" ); - Console::WriteLine( "requestMessage = {0}", requestMessage ); - ReturnMessage^ requestMethodReturn; - try - { - requestMethodReturn = static_cast(requestMessage); - - // Print the details of the ReturnMessage to the console - Console::WriteLine( "\nReturnMessage details" ); - Console::WriteLine( "\tException = {0}", requestMethodReturn->Exception ); - Console::WriteLine( "\tReturnValue = {0}", requestMethodReturn->ReturnValue ); - Console::WriteLine( "\tOutArgCount = {0}", requestMethodReturn->OutArgCount ); - Console::WriteLine( "Return message OutArgs" ); - IEnumerator^ myEnum = requestMethodReturn->Args->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "\t {0}", o ); - } - } - catch ( InvalidCastException^ ) - { - Console::WriteLine( "The requestMessage is not a ReturnMessage." ); - } - } -}; - -public ref class ReplicationSinkProp: public IDynamicProperty, public IContributeDynamicSink -{ -public: - - property String^ Name - { - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual String^ get() - { - return "ReplicationSinkProp"; - } - } - [System::Security::Permissions::SecurityPermissionAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, - Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] - virtual IDynamicMessageSink^ GetDynamicSink() - { - return gcnew ReplicationSink; - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp deleted file mode 100644 index b8502b5c48b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -#using -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Net::Sockets; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Lifetime; -using namespace System::Collections; -using namespace SampleNamespace; - -int main() -{ - ChannelServices::RegisterChannel( gcnew HttpChannel( 0 ), false ); - RemotingConfiguration::RegisterActivatedClientType( SampleService::typeid, "http://localhost:9000/MySampleService" ); - SampleService ^ myRemoteObject = gcnew SampleService; - bool result = myRemoteObject->SampleMethod(); - - // System::Runtime::Remoting::RemotingServices.GetObjRefForProxy - // - ObjRef^ objRefSample = RemotingServices::GetObjRefForProxy( myRemoteObject ); - Console::WriteLine( "***ObjRef Details***" ); - Console::WriteLine( "URI:\t {0}", objRefSample->URI ); - array^channelData = objRefSample->ChannelInfo->ChannelData; - Console::WriteLine( "Channel Info:" ); - IEnumerator^ myEnum = channelData->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ o = safe_cast(myEnum->Current); - Console::WriteLine( "\t {0}", o ); - } - - IEnvoyInfo^ envoyInfo = objRefSample->EnvoyInfo; - if ( envoyInfo == nullptr ) - { - Console::WriteLine( "This ObjRef does not have envoy information." ); - } - else - { - IMessageSink^ envoySinks = envoyInfo->EnvoySinks; - Console::WriteLine( "Envoy Sink Class: {0}", envoySinks ); - } - - IRemotingTypeInfo^ typeInfo = objRefSample->TypeInfo; - Console::WriteLine( "Remote type name: {0}", typeInfo->TypeName ); - Console::WriteLine( "Can my Object* cast to a Bitmap? {0}", typeInfo->CanCastTo( System::Drawing::Bitmap::typeid, objRefSample ) ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp deleted file mode 100644 index 590b94dffc7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// System::Runtime::Remoting::RemotingServices.GetLifetimeService -// This sample is of a remote client for a group coffee timer. -// Since the client must stay connected to a stateful server object -// for minutes without calling it, it needs to register as a sponsor -// of the lease to prevent the server from being collected. -// Multiple clients can connect to the same timer object, and receive -// notification when the timer expires. -// System::Runtime::Remoting::RemotingServices.GetLifetimeService -// -#using -#using -#using "timerservice.dll" - -using namespace System; -using namespace System::Net::Sockets; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Lifetime; -using namespace TimerSample; -using namespace System::Security::Permissions; - -namespace GroupCoffeeTimer -{ - public ref class TimerClient: public MarshalByRefObject, public ISponsor - { - public: - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - TimerClient() - { - // Registers the HTTP Channel so that this client can receive - // events from the remote service. - ChannelServices::RegisterChannel( gcnew HttpChannel( 0 ), false ); - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( TimerService::typeid,"http://localhost:9000/MyService/TimerService.soap" ); - RemotingConfiguration::RegisterWellKnownClientType( remoteType ); - TimerService^ groupTimer = gcnew TimerService; - groupTimer->MinutesToTime = 4.0; - - // Registers this client as a lease sponsor so that it can - // prevent the expiration of the TimerService. - ILease^ leaseObject = dynamic_cast(RemotingServices::GetLifetimeService( groupTimer )); - leaseObject->Register( this ); - - // Subscribes to the event so that the client can receive notifications from the server. - groupTimer->TimerExpired += gcnew TimerExpiredEventHandler( this, &TimerClient::OnTimerExpired ); - Console::WriteLine( "Connected to TimerExpired event" ); - groupTimer->Start(); - Console::WriteLine( "Timer started for {0} minutes.", groupTimer->MinutesToTime ); - Console::WriteLine( "Press enter to end the client process." ); - Console::ReadLine(); - } - - private: - void OnTimerExpired( Object^, TimerServiceEventArgs^ e ) - { - Console::WriteLine( "TimerHelper::OnTimerExpired: {0}", e->Message ); - } - public: - [System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] - virtual TimeSpan Renewal( ILease^ ) - { - Console::WriteLine( "TimerClient: Renewal called." ); - return TimeSpan::FromMinutes( 0.5 ); - } - }; -} - -int main() -{ - using namespace GroupCoffeeTimer; - gcnew TimerClient; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp deleted file mode 100644 index d7f3d4b569d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// System::Runtime::Remoting::RemotingServices.GetLifetimeService -// This sample is of a remote client for a group coffee timer. -// Since the client must stay connected to a stateful server Object* -// for minutes with->Item[Out] calling* it, it needs to register as a sponsor -// of the lease to prevent the server from being collected. -// Multiple clients can connect to the same timer Object*, and receive -// notification when the timer expires. - -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Net::Sockets; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Lifetime; -using namespace SampleNamespace; - -int main() -{ - // System::Runtime::Remoting::RemotingServices.Unmarshal - // - ChannelServices::RegisterChannel( gcnew HttpChannel ); - - SampleService ^ objectSample = (SampleService^)( Activator::GetObject( SampleService::typeid, - "http://localhost:9000/MySampleService/SampleService.soap" ) ); - - // The GetManuallyMarshaledObject() method uses RemotingServices::Marshal() - // to create an ObjRef object for a SampleTwo object. - ObjRef^ objRefSampleTwo = objectSample->GetManuallyMarshaledObject(); - - SampleTwo ^ objectSampleTwo = (SampleTwo^)( RemotingServices::Unmarshal( objRefSampleTwo ) ); - - objectSampleTwo->PrintMessage( "ObjRef successfuly unmarshaled." ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp deleted file mode 100644 index a25a8b273ca..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp +++ /dev/null @@ -1,33 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -public ref class Client -{ -public: - void ClientTest() - { - // - IpcClientChannel^ clientChannel = gcnew IpcClientChannel; - ChannelServices::RegisterChannel( clientChannel ); - // - - RemotingConfiguration::RegisterWellKnownClientType( Counter::typeid, L"ipc://remote/counter" ); - Counter^ counter = gcnew Counter; - Console::WriteLine( L"This is call number {0}.", counter->Count ); - } -}; - -int main() -{ - Client^ c = gcnew Client; - c->ClientTest(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp deleted file mode 100644 index 57f389d01b4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp +++ /dev/null @@ -1,24 +0,0 @@ - -// Counter.cs -// -using namespace System; -public ref class Counter: public MarshalByRefObject -{ -private: - int count; - -public: - Counter() - { - count = 0; - } - - property int Count - { - int get() - { - return (count)++; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp deleted file mode 100644 index 3e9a5712ad1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp +++ /dev/null @@ -1,40 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -public ref class IpcServer -{ -public: - void IpcServerTest() - { - // - // Create and register an IPC channel - IpcServerChannel^ serverChannel = gcnew IpcServerChannel( L"remote" ); - ChannelServices::RegisterChannel( serverChannel ); - // - - // Expose an object - RemotingConfiguration::RegisterWellKnownServiceType( Counter::typeid, L"counter", WellKnownObjectMode::Singleton ); - - // Wait for calls - // - Console::WriteLine( L"Listening on {0}", serverChannel->GetChannelUri() ); - // - - Console::ReadLine(); - } -}; - -int main() -{ - IpcServer^ is = gcnew IpcServer; - is->IpcServerTest(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp deleted file mode 100644 index 849a76f616e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp +++ /dev/null @@ -1,142 +0,0 @@ - -// -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; - -[System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] -public ref class ClientSink: public BaseChannelSinkWithProperties, public IClientChannelSink -{ -private: - - // This class inherits from BaseChannelSinkWithPropertes - // to get an implementation of IChannelSinkBase. - // - // The next sink in the chain. - IClientChannelSink^ nextSink; - // - - - // -public: - property IClientChannelSink^ NextChannelSink - { - virtual IClientChannelSink^ get() - { - return (nextSink); - } - } - // - - // - virtual Stream^ GetRequestStream( IMessage^ message, ITransportHeaders^ requestHeaders ) - { - // Get the request stream from the next sink in the chain. - return (nextSink->GetRequestStream( message, requestHeaders )); - } - // - - // - virtual void ProcessMessage( IMessage^ message, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) - { - // Print the request message properties. - Console::WriteLine( "---- Message from the client ----" ); - IDictionary^ dictionary = message->Properties; - IEnumerator^ myEnum = dictionary->Keys->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ key = safe_cast(myEnum->Current); - Console::WriteLine( "{0} = {1}", key, dictionary[ key ] ); - } - - Console::WriteLine( "---------------------------------" ); - - // Hand off to the next sink in the chain. - nextSink->ProcessMessage( message, requestHeaders, requestStream, responseHeaders, responseStream ); - } - // - - // - // For synchronous remoting, it is not necessary to implement this method. - virtual void AsyncProcessRequest( IClientChannelSinkStack^ /*sinkStack*/, IMessage^ /*message*/, ITransportHeaders^ /*requestHeaders*/, Stream^ /*requestStream*/ ) - { - throw gcnew NotImplementedException; - } - // - - // - virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, ITransportHeaders^ /*responseHeaders*/, Stream^ /*responseStream*/ ) - { - throw gcnew NotImplementedException; - } - - // - property System::Collections::IDictionary^ Properties - { - virtual System::Collections::IDictionary^ get() override - { - return (dynamic_cast(this))->Properties; - } - } - - // Constructor - ClientSink( IClientChannelSink^ sink ) - { - if ( sink == nullptr ) - throw gcnew ArgumentNullException( "sink" ); - - nextSink = sink; - } -}; -// - -// -[System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] -public ref class ClientSinkProvider: public IClientChannelSinkProvider -{ -private: - - // - // The next provider in the chain. - IClientChannelSinkProvider^ nextProvider; - // - - // -public: - property IClientChannelSinkProvider^ Next - { - virtual IClientChannelSinkProvider^ get() - { - return (nextProvider); - } - - virtual void set( IClientChannelSinkProvider^ value ) - { - nextProvider = value; - } - } - // - - // - virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ url, Object^ remoteChannelData ) - { - Console::WriteLine( "Creating ClientSink for {0}", url ); - - // Create the next sink in the chain. - IClientChannelSink^ nextSink = nextProvider->CreateSink( channel, url, remoteChannelData ); - - // Hook our sink up to it. - return (gcnew ClientSink( nextSink )); - } - // - - // This constructor is required in order to use the provider in file-based configuration. - // It need not do anything unless you want to use the information in the parameters. - ClientSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp deleted file mode 100644 index 93da1a676ea..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp +++ /dev/null @@ -1,137 +0,0 @@ - -// -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; - -[System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] -public ref class ServerSink: public BaseChannelSinkWithProperties, public IServerChannelSink -{ -private: - - // This class inherits from BaseChannelSinkWithPropertes - // to get an implementation of IChannelSinkBase. - // - // The next sink in the chain. - IServerChannelSink^ nextSink; - // - - // -public: - property IServerChannelSink^ NextChannelSink - { - virtual IServerChannelSink^ get() - { - return (nextSink); - } - } - // - - // - virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*message*/, ITransportHeaders^ /*responseHeaders*/ ) - { - return nullptr; - } - // - - // - virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMessage, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% responseMessage, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) - { - // Hand off to the next sink for processing. - sinkStack->Push( this, nullptr ); - ServerProcessing status = nextSink->ProcessMessage( sinkStack, requestMessage, requestHeaders, requestStream, responseMessage, responseHeaders, responseStream ); - - // Print the response message properties. - Console::WriteLine( "---- Message from the server ----" ); - IDictionary^ dictionary = ( *responseMessage).Properties; - IEnumerator^ myEnum = dictionary->Keys->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ key = safe_cast(myEnum->Current); - Console::WriteLine( "{0} = {1}", key, dictionary[ key ] ); - } - - Console::WriteLine( "---------------------------------" ); - return (status); - } - // - - // - virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*message*/, ITransportHeaders^ /*responseHeaders*/, Stream^ /*responseStream*/ ) - { - throw gcnew NotImplementedException; - } - // - - property System::Collections::IDictionary^ Properties - { - virtual System::Collections::IDictionary^ get() override - { - return (dynamic_cast(this))->Properties; - } - } - - // Constructor - ServerSink( IServerChannelSink^ sink ) - { - if ( sink == nullptr ) - throw gcnew ArgumentNullException( "sink" ); - - nextSink = sink; - } -}; -// - -// -[System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] -public ref class ServerSinkProvider: public IServerChannelSinkProvider -{ - // - // The next provider in the chain. -private: - IServerChannelSinkProvider^ nextProvider; - // - - // -public: - property IServerChannelSinkProvider^ Next - { - virtual IServerChannelSinkProvider^ get() - { - return (nextProvider); - } - - virtual void set( IServerChannelSinkProvider^ value ) - { - nextProvider = value; - } - } - // - - // - virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel ) - { - Console::WriteLine( "Creating ServerSink" ); - - // Create the next sink in the chain. - IServerChannelSink^ nextSink = nextProvider->CreateSink( channel ); - - // Hook our sink up to it. - return (gcnew ServerSink( nextSink )); - } - // - - // - virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){} - // - - // This constructor is required in order to use the provider in file-based configuration. - // It need not do anything unless you want to use the information in the parameters. - ServerSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp deleted file mode 100644 index 5b2824ec1ef..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - // - // Specify client channel properties. - IDictionary^ dict = gcnew Hashtable; - dict[ "port" ] = 9090; - dict[ "impersonationLevel" ] = "Identify"; - dict[ "authenticationPolicy" ] = "AuthPolicy, Policy"; - - // Set up a client channel. - TcpClientChannel^ clientChannel = gcnew TcpClientChannel( dict, nullptr ); - ChannelServices::RegisterChannel( clientChannel, false ); - // - - // Obtain a proxy for a remote object. - RemotingConfiguration::RegisterWellKnownClientType( Remotable::typeid, "tcp://localhost:9090/Remotable.rem" ); - - // Call a method on the object. - Remotable ^ remoteObject = gcnew Remotable; - Console::WriteLine( remoteObject->GetMessage() ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp deleted file mode 100644 index fc2018f899f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - // - // Specify server channel properties. - IDictionary^ dict = gcnew Hashtable; - dict[ "port" ] = 9090; - dict[ "authenticationMode" ] = "IdentifyCallers"; - - // Set up a server channel. - TcpServerChannel^ serverChannel = gcnew TcpServerChannel( dict, nullptr ); - ChannelServices::RegisterChannel( serverChannel, false ); - - // - // Set up a remote object. - RemotingConfiguration::RegisterWellKnownServiceType( Remotable::typeid, "Remotable.rem", WellKnownObjectMode::Singleton ); - - // Wait for method calls. - Console::WriteLine( "Listening..." ); - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp deleted file mode 100644 index ced0c327846..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -int main() -{ - - // - // Set up a client channel. - TcpClientChannel^ clientChannel = gcnew TcpClientChannel; - ChannelServices::RegisterChannel( clientChannel ); - - // - // - // Show the name and priority of the channel. - Console::WriteLine( "Channel Name: {0}", clientChannel->ChannelName ); - Console::WriteLine( "Channel Priority: {0}", clientChannel->ChannelPriority ); - - // - // Obtain a proxy for a remote object. - RemotingConfiguration::RegisterWellKnownClientType( Remotable::typeid, "tcp://localhost:9090/Remotable.rem" ); - - // Call a method on the object. - Remotable ^ remoteObject = gcnew Remotable; - Console::WriteLine( remoteObject->GetCount() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp deleted file mode 100644 index 81b3b1ffd8f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp +++ /dev/null @@ -1,22 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::Remoting; - -public ref class Remotable: public MarshalByRefObject -{ -private: - int callCount; - -public: - Remotable() - : callCount( 0 ) - {} - - int GetCount() - { - callCount++; - return (callCount); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp deleted file mode 100644 index 7688f7f257e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - // - // Set up a server channel. - TcpServerChannel^ serverChannel = gcnew TcpServerChannel( 9090 ); - ChannelServices::RegisterChannel( serverChannel ); - // - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( Remotable::typeid, "Remotable.rem", WellKnownObjectMode::Singleton ); - - // - // Show the name and priority of the channel. - Console::WriteLine( "Channel Name: {0}", serverChannel->ChannelName ); - Console::WriteLine( "Channel Priority: {0}", serverChannel->ChannelPriority ); - // - - // - // Show the URIs associated with the channel. - ChannelDataStore^ data = dynamic_cast(serverChannel->ChannelData); - System::Collections::IEnumerator^ myEnum = data->ChannelUris->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ uri = safe_cast(myEnum->Current); - Console::WriteLine( uri ); - } - // - - // Wait for method calls. - Console::WriteLine( "Listening..." ); - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp b/snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp deleted file mode 100644 index 56b4a19308e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -// System::Web::Services::Discovery.SchemaReference::SchemaReference() -// System::Web::Services::Discovery.SchemaReference::SchemaReference(String*) -// System::Web::Services::Discovery.SchemaReference::SchemaReference.DefaultFileName -// System::Web::Services::Discovery.SchemaReference::SchemaReference.Namespace -// System::Web::Services::Discovery.SchemaReference::SchemaReference.ReadDocument(stream) -// System::Web::Services::Discovery.SchemaReference::SchemaReference.Schema -// System::Web::Services::Discovery.SchemaReference::SchemaReference.Ref -// System::Web::Services::Discovery.SchemaReference::SchemaReference.TargetNamespace -// System::Web::Services::Discovery.SchemaReference::SchemaReference.Url -// System::Web::Services::Discovery.SchemaReference::SchemaReference.WriteDocument(Object*, stream) -// System::Web::Services::Discovery.SchemaReference::SchemaReference -/* This example demonstrates 'SchemaReference' class, its constructors, 'ReadDocument', -* 'WriteDocument', 'Namespace, 'DefaultFileName', 'Schema', 'Ref', 'TargetNamespace', -* and 'Url' members. A variable of type 'SchemaReference' is taken. An xml schema -* document is passed as parameter to overloaded constructor. All the membes are shown -* using 'SchemaReference' variable. -Note : The dataservice.xsd file should be copied to Inetpub\wwwroot -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Web::Services::Discovery; -int main() -{ - try - { - - // - // Reference the schema document. - String^ myStringUrl = "c:\\Inetpub\\wwwroot\\dataservice.xsd"; - XmlSchema^ myXmlSchema; - - // Create the client protocol. - DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; - myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; - - // Create a schema reference. - SchemaReference^ mySchemaReferenceNoParam = gcnew SchemaReference; - SchemaReference^ mySchemaReference = gcnew SchemaReference( myStringUrl ); - - // Set the client protocol. - mySchemaReference->ClientProtocol = myDiscoveryClientProtocol; - - // Access the default file name associated with the schema reference. - Console::WriteLine( "Default filename is : {0}", mySchemaReference->DefaultFilename ); - - // Access the namespace associated with schema reference class. - Console::WriteLine( "Namespace is : {0}", SchemaReference::Namespace ); - FileStream^ myStream = gcnew FileStream( myStringUrl,FileMode::OpenOrCreate ); - - // Read the document in a stream. - mySchemaReference->ReadDocument( myStream ); - - // Get the schema of referenced document. - myXmlSchema = mySchemaReference->Schema; - Console::WriteLine( "Reference is : {0}", mySchemaReference->Ref ); - Console::WriteLine( "Target namespace (default empty) is : {0}", mySchemaReference->TargetNamespace ); - Console::WriteLine( "URL is : {0}", mySchemaReference->Url ); - - // Write the document in the stream. - mySchemaReference->WriteDocument( myXmlSchema, myStream ); - myStream->Close(); - mySchemaReference = nullptr; - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp deleted file mode 100644 index 13bca5b2a43..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; - -int main() -{ - - //Set up variables and String to write to the server. - Encoding^ ASCII = Encoding::ASCII; - String^ Get = "GET / HTTP/1.1\r\nHost: www.contoso.com" + - "\r\nConnection: Close\r\n\r\n"; - array^ ByteGet = ASCII->GetBytes( Get ); - array^ RecvBytes = gcnew array(256); - String^ strRetPage = nullptr; - - // IPAddress and IPEndPoint represent the endpoint that will - // receive the request. - // Get first IPAddress in list return by DNS. - IPAddress^ hostadd = Dns::GetHostEntry( "www.contoso.com" )->AddressList[ 0 ]; - IPEndPoint^ EPhost = gcnew IPEndPoint( hostadd,80 ); - - // - //Creates the Socket for sending data over TCP. - Socket^ s = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, - ProtocolType::Tcp ); - - // Connects to host using IPEndPoint. - s->Connect( EPhost ); - if ( !s->Connected ) - { - strRetPage = "Unable to connect to host"; - } - // Use the SelectWrite enumeration to obtain Socket status. - if ( s->Poll( -1, SelectMode::SelectWrite ) ) - { - Console::WriteLine( "This Socket is writable." ); - } - else if ( s->Poll( -1, SelectMode::SelectRead ) ) - { - Console::WriteLine( "This Socket is readable." ); - } - else if ( s->Poll( -1, SelectMode::SelectError ) ) - { - Console::WriteLine( "This Socket has an error." ); - } - // - - // Sent the GET text to the host. - s->Send( ByteGet, ByteGet->Length, SocketFlags::None ); - - // Receives the page, loops until all bytes are received. - Int32 bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); - strRetPage = "Default HTML page on www.contoso.com:\r\n"; - strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); - - while ( bytes > 0 ) - { - bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); - strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp b/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp deleted file mode 100644 index c2507006a55..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp +++ /dev/null @@ -1,77 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Runtime::Serialization::Formatters::Soap; - -// A test object that needs to be serialized. - -[Serializable] -ref class TestSimpleObject -{ -private: - int member1; - String^ member2; - String^ member3; - double member4; - -public: - - // A field that is not serialized. - - [NonSerialized] - String^ member5; - TestSimpleObject() - { - member1 = 11; - member2 = "hello"; - member3 = "hello"; - member4 = 3.14159265; - member5 = "hello world!"; - } - - void Print() - { - Console::WriteLine( "member1 = ' {0}'", member1 ); - Console::WriteLine( "member2 = ' {0}'", member2 ); - Console::WriteLine( "member3 = ' {0}'", member3 ); - Console::WriteLine( "member4 = ' {0}'", member4 ); - Console::WriteLine( "member5 = ' {0}'", member5 ); - } - -}; - -int main() -{ - // Creates a new TestSimpleObject object. - TestSimpleObject^ obj = gcnew TestSimpleObject; - Console::WriteLine( "Before serialization the Object* contains: " ); - obj->Print(); - - // Opens a file and serializes the object into it in binary format. - Stream^ stream = File::Open( "data.xml", FileMode::Create ); - SoapFormatter^ formatter = gcnew SoapFormatter; - - formatter->Serialize( stream, obj ); - stream->Close(); - - // Empties obj. - obj = nullptr; - - // Opens file S"data.xml" and deserializes the object from it. - stream = File::Open( "data.xml", FileMode::Open ); - formatter = gcnew SoapFormatter; - - obj = dynamic_cast(formatter->Deserialize( stream )); - stream->Close(); - Console::WriteLine( "" ); - Console::WriteLine( "After deserialization the object contains: " ); - obj->Print(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp deleted file mode 100644 index 5dc403fbd36..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// System.Web.Services.Description.Service - -/* The following sample demonstrates the class 'Service'. This sample reads the -contents of a file 'MathService_cs.wsdl' into a 'ServiceDescription' instance. -It gets the collection of Service instances from 'ServiceDescription'. It -then removes a 'Service' from the collection and creates a new 'Service' and -adds it into collection. It writes a new web service description file 'MathService_New.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -Port^ CreatePort( String^ PortName, String^ BindingName, String^ targetNamespace ) -{ - Port^ myPort = gcnew Port; - myPort->Name = PortName; - myPort->Binding = gcnew XmlQualifiedName( BindingName,targetNamespace ); - - // Create a SoapAddress extensibility element to add to the port. - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/ServiceClass/MathService_CS.asmx"; - myPort->Extensions->Add( mySoapAddressBinding ); - return myPort; -} - -int main() -{ - try - { - // Read a WSDL document. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - ServiceCollection^ myServiceCollection = myServiceDescription->Services; - int noOfServices = myServiceCollection->Count; - Console::WriteLine( "\nTotal number of services: {0}", noOfServices ); - - // Gets a reference to the service. - Service^ myOldService = myServiceCollection[ 0 ]; - Console::WriteLine( "No. of ports in the service: {0}", myServiceCollection[ 0 ]->Ports->Count ); - Console::WriteLine( "These are the ports in the service:" ); - for ( int i = 0; i < myOldService->Ports->Count; i++ ) - Console::WriteLine( "Port name: {0}", myOldService->Ports[ i ]->Name ); - Console::WriteLine( "Service name: {0}", myOldService->Name ); - Service^ myService = gcnew Service; - myService->Name = "MathService"; - - // Add the Ports to the newly created Service. - for ( int i = 0; i < myOldService->Ports->Count; i++ ) - { - String^ PortName = myServiceCollection[ 0 ]->Ports[ i ]->Name; - String^ BindingName = myServiceCollection[ 0 ]->Ports[ i ]->Binding->Name; - myService->Ports->Add( CreatePort( PortName, BindingName, myServiceDescription->TargetNamespace ) ); - } - Console::WriteLine( "Newly created ports -" ); - for ( int i = 0; i < myService->Ports->Count; i++ ) - Console::WriteLine( "Port name: {0}", myOldService->Ports[ i ]->Name ); - - // Add the extensions to the newly created Service. - int noOfExtensions = myOldService->Extensions->Count; - Console::WriteLine( "No. of extensions: {0}", noOfExtensions ); - if ( noOfExtensions > 0 ) - { - for ( int i = 0; i < myOldService->Ports->Count; i++ ) - myService->Extensions->Add( myServiceCollection[ 0 ]->Extensions[ i ] ); - } - - // Remove the service from the collection. - myServiceCollection->Remove( myOldService ); - - // Add the newly created service. - myServiceCollection->Add( myService ); - myServiceDescription->Write( "MathService_New.wsdl" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp deleted file mode 100644 index 8935936e70f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// System.Web.Services.Description.ServiceCollection.Contains(Service) -// System.Web.Services.Description.ServiceCollection.IndexOf(service) -// System.Web.Services.Description.ServiceCollection.CopyTo(System[],int) - -/* -The following program demonstrates the methods of -ServiceDescription and ServiceCollection class. An existing WSDL document -is read. An exiting service named "MathService" is removed from the -collection. A new Service object is constructed and added at index 1 of the -Collection .A new WSDL file is created as output. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - try - { - // Read the Existing Wsdl. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "AddSubtractService_CS.wsdl" ); - - // Remove the service named "MathService". - ServiceCollection^ myServiceDescriptionCollection = myServiceDescription->Services; - myServiceDescriptionCollection->Remove( myServiceDescription->Services[ "MathService" ] ); - - // Build a new Service. - Service^ myService = gcnew Service; - myService->Name = "MathService"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); - - // Build a new Port for Soap. - Port^ mySoapPort = gcnew Port; - mySoapPort->Name = "MathServiceSoap"; - mySoapPort->Binding = myXmlQualifiedName; - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/ServiceCollection_CopyTo/AddSubtractService_CS.asmx"; - mySoapPort->Extensions->Add( mySoapAddressBinding ); - - // Build a new Port for HttpGet. - XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); - Port^ myHttpGetPort = gcnew Port; - myHttpGetPort->Name = "MathServiceHttpGet"; - myHttpGetPort->Binding = myXmlQualifiedName2; - HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; - myHttpAddressBinding->Location = "http://localhost/ServiceCollection_CopyTo/AddSubtractService_CS.asmx"; - myHttpGetPort->Extensions->Add( myHttpAddressBinding ); - - // Build a new Port for HttpPost. - XmlQualifiedName^ myXmlQualifiedName3 = gcnew XmlQualifiedName( "s0:MathServiceHttpPost" ); - - // Build a new Port for Soap. - Port^ myHttpPostPort = gcnew Port; - myHttpPostPort->Name = "MathServiceHttpPost"; - myHttpPostPort->Binding = myXmlQualifiedName3; - HttpAddressBinding^ myHttpAddressBinding1 = gcnew HttpAddressBinding; - myHttpAddressBinding1->Location = "http://localhost/ServiceCollection_CopyTo/AddSubtractService_CS.asmx"; - myHttpPostPort->Extensions->Add( myHttpAddressBinding1 ); - - // Add the ports to the service. - myService->Ports->Add( mySoapPort ); - myService->Ports->Add( myHttpGetPort ); - myService->Ports->Add( myHttpPostPort ); - - // Add the Service to the ServiceCollection. - myServiceDescription->Services->Insert( 1, myService ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( "output.wsdl" ); - - // Output the Wsdl. - myServiceDescription->Write( myStreamWriter ); - myStreamWriter->Close(); - - // - // - if ( myServiceDescription->Services->Contains( myService ) ) - { - Console::WriteLine( "The mentioned service exists at index {0} in the WSDL.", myServiceDescription->Services->IndexOf( myService ) ); - - // - array^myServiceArray = gcnew array(myServiceDescription->Services->Count); - - // Copy the services into an array. - myServiceDescription->Services->CopyTo( myServiceArray, 0 ); - IEnumerator^ myEnumerator = myServiceArray->GetEnumerator(); - Console::WriteLine( "The names of services in the array are" ); - while ( myEnumerator->MoveNext() ) - { - Service^ myService1 = dynamic_cast(myEnumerator->Current); - Console::WriteLine( myService1->Name ); - } - // - } - else - { - Console::WriteLine( "Service does not exist in the WSDL." ); - } - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught! {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp deleted file mode 100644 index d0089a0774c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// System.Web.Services.Description.ServiceDescription.Write(FileName) -// System.Web.Services.Description.ServiceCollection.Remove -// System.Web.Services.Description.ServiceCollection.Item(int) -// System.Web.Services.Description.ServiceDescription.Services -// System.Web.Services.Description.ServiceDescription.TargetNamespace -// System.Web.Services.Description.ServiceCollection.Add - -/* -The following example demonstrates methods and properties of the -ServiceDescription and ServiceCollection classes. -A new WSDL is read and the existing service "MathService" in the -ServiceCollection is removed. The service by default is defined for -SOAP, HttpGet, HttpPost. A new Service defined for SOAP and HttpGet is -constructed and added to the ServiceCollection. -The programs writes a new web service description file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - // - // - // - // - // - // Read a ServiceDescription from existing WSDL. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Input_CS.wsdl" ); - myServiceDescription->TargetNamespace = "http://tempuri.org/"; - // - - // Get the ServiceCollection of the ServiceDescription. - ServiceCollection^ myServiceCollection = myServiceDescription->Services; - - // Remove the Service at index 0 of the collection. - myServiceCollection->Remove( myServiceDescription->Services[ 0 ] ); - // - // - // - // - // Build a new Service. - Service^ myService = gcnew Service; - myService->Name = "MathService"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); - - // Build a new Port for SOAP. - Port^ mySoapPort = gcnew Port; - mySoapPort->Name = "MathServiceSoap"; - mySoapPort->Binding = myXmlQualifiedName; - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/ServiceCollection_Item/AddSub_CS.asmx"; - mySoapPort->Extensions->Add( mySoapAddressBinding ); - - // Build a new Port for HTTP-GET. - XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); - Port^ myHttpGetPort = gcnew Port; - myHttpGetPort->Name = "MathServiceHttpGet"; - myHttpGetPort->Binding = myXmlQualifiedName2; - HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; - myHttpAddressBinding->Location = "http://localhost/ServiceCollection_Item/AddSub_CS.asmx"; - myHttpGetPort->Extensions->Add( myHttpAddressBinding ); - - // Add the ports to the service. - myService->Ports->Add( myHttpGetPort ); - myService->Ports->Add( mySoapPort ); - - // Add the service to the ServiceCollection. - myServiceCollection->Add( myService ); - - // - // Write to a new WSDL file. - myServiceDescription->Write( "output.wsdl" ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp deleted file mode 100644 index fa70e899296..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp +++ /dev/null @@ -1,84 +0,0 @@ -// System.Web.Services.Description.ServiceDescription - -/* -The following example demonstrates the 'ServiceDescription' class. -The input to the program is a WSDL file 'MyWsdl.wsdl'. -This program removes one 'Binding' from the existing WSDL. -A new Binding is defined and added to the ServiceDescription object. -The program generates a new Web Service Description document. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -// Used to create OperationBinding instances within 'Binding'. -OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) -{ - // Create OperationBinding instance for operation. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = operation; - - // Create InputBinding for operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - - // Create extensibility element for 'SoapOperationBinding'. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = targetNamespace + operation; - - // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - return myOperationBinding; -} - -int main() -{ - try - { - // - // Obtain the ServiceDescription of existing Wsdl. - ServiceDescription^ myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" ); - - // Remove the Binding from the Binding Collection of ServiceDescription. - BindingCollection^ myBindingCollection = myDescription->Bindings; - myBindingCollection->Remove( myBindingCollection[ 0 ] ); - - // Form a new Binding. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Service1Soap"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); - myBinding->Type = myXmlQualifiedName; - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myDescription->TargetNamespace ); - myBinding->Operations->Add( addOperationBinding ); - myBinding->Extensions->Add( mySoapBinding ); - - // Add the Binding to the ServiceDescription. - myDescription->Bindings->Add( myBinding ); - myDescription->Write( "MyOutWsdl.wsdl" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception :{0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp deleted file mode 100644 index a8845c0e0db..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp +++ /dev/null @@ -1,192 +0,0 @@ - - -// System.Web.Services.Description.ServiceDescriptionBaseCollection. -/* -The following example demonstrates 'ServiceDescriptionBaseCollection' class. -A 'ServiceDescription' instance is obtained from the existing Wsdl. -'MyMethod' takes an instance of 'ServiceDescriptionBaseCollection' as a parameter. -Instance of different types of collections that were actually derived from -'ServiceDescriptionBaseCollection' are passed to my method and modifications of -corresponding instances in done. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -ref class ServiceDescription_Sample -{ -public: - static ServiceDescription^ myServiceDescription; - static void Main() - { - // Read a ServiceDescription of existing WSDL. - myServiceDescription = ServiceDescription::Read( "Input_CS.wsdl" ); - - // Get the ServiceCollection of the ServiceDescription. - ServiceCollection^ myServiceCollection = myServiceDescription->Services; - MyMethod( myServiceCollection ); - BindingCollection^ myBindingCollection = myServiceDescription->Bindings; - MyMethod( myBindingCollection ); - PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; - MyMethod( myPortTypeCollection ); - myServiceDescription->Write( "Output.Wsdl" ); - } - - // - static void MyMethod( ServiceDescriptionBaseCollection^ myServiceCollection ) - { - Type^ myType = myServiceCollection->GetType(); - if ( myType->Equals( System::Web::Services::Description::ServiceCollection::typeid ) ) - { - // Remove the services at index 0 of the collection. - (dynamic_cast(myServiceCollection))->Remove( myServiceDescription->Services[ 0 ] ); - - // Build a new Service. - Service^ myService = gcnew Service; - myService->Name = "MathService"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); - - // Build a new Port for SOAP. - Port^ mySoapPort = gcnew Port; - mySoapPort->Name = "MathServiceSoap"; - mySoapPort->Binding = myXmlQualifiedName; - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/" - "ServiceDescriptionBaseCollection/AddSubtractService.CS.asmx"; - mySoapPort->Extensions->Add( mySoapAddressBinding ); - - // Build a new Port for HTTP-GET. - XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); - Port^ myHttpGetPort = gcnew Port; - myHttpGetPort->Name = "MathServiceHttpGet"; - myHttpGetPort->Binding = myXmlQualifiedName2; - HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; - myHttpAddressBinding->Location = "http://localhost/" - "ServiceDescriptionBaseCollection/AddSubtractService.CS.asmx"; - myHttpGetPort->Extensions->Add( myHttpAddressBinding ); - - // Add the ports to the Service. - myService->Ports->Add( myHttpGetPort ); - myService->Ports->Add( mySoapPort ); - - // Add the Service to the ServiceCollection. - myServiceDescription->Services->Add( myService ); - } - else - if ( myType->Equals( System::Web::Services::Description::BindingCollection::typeid ) ) - { - // Remove the Binding in the BindingCollection at index 0. - (dynamic_cast(myServiceCollection))->Remove( myServiceDescription->Bindings[ 0 ] ); - - // Build a new Binding. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "MathServiceSoap"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); - myBinding->Type = myXmlQualifiedName; - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - - // Create the operations for the binding. - OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); - OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); - - // Add the operations to the Binding. - myBinding->Operations->Add( subtractOperationBinding ); - myBinding->Operations->Add( addOperationBinding ); - myBinding->Extensions->Add( mySoapBinding ); - - // Add the Binding to the Bindings collection. - myServiceDescription->Bindings->Add( myBinding ); - } - else - if ( myType->Equals( System::Web::Services::Description::PortTypeCollection::typeid ) ) - { - // Remove the PortType at index 0. - (dynamic_cast(myServiceCollection))->Remove( myServiceDescription->PortTypes[ 0 ] ); - - // Build a new PortType. - PortType^ myPortType = gcnew PortType; - myPortType->Name = "MathServiceSoap"; - - // Build an Add Operation for the PortType. - Operation^ myAddOperation = gcnew Operation; - myAddOperation->Name = "Add"; - - // Build the Input and Output messages for the Operations. - OperationInput^ myOperationInputMessage1 = gcnew OperationInput; - XmlQualifiedName^ myXmlQualifiedName1 = gcnew XmlQualifiedName( "s0:AddSoapIn" ); - myOperationInputMessage1->Message = myXmlQualifiedName1; - OperationOutput^ myOperationOutputMessage1 = gcnew OperationOutput; - XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:AddSoapOut" ); - myOperationOutputMessage1->Message = myXmlQualifiedName2; - - // Add the messages to the operations. - myAddOperation->Messages->Add( myOperationInputMessage1 ); - myAddOperation->Messages->Add( myOperationOutputMessage1 ); - - // Build an Add Operation for the PortType. - Operation^ mySubtractOperation = gcnew Operation; - mySubtractOperation->Name = "Subtract"; - - // Build the Input and Output messages for the operations. - OperationInput^ myOperationInputMessage2 = gcnew OperationInput; - XmlQualifiedName^ myXmlQualifiedName3 = gcnew XmlQualifiedName( "s0:SubtractSoapIn" ); - myOperationInputMessage2->Message = myXmlQualifiedName3; - OperationOutput^ myOperationOutputMessage2 = gcnew OperationOutput; - XmlQualifiedName^ myXmlQualifiedName4 = gcnew XmlQualifiedName( "s0:SubtractSoapOut" ); - myOperationOutputMessage2->Message = myXmlQualifiedName4; - - // Add the messages to the operations. - mySubtractOperation->Messages->Add( myOperationInputMessage2 ); - mySubtractOperation->Messages->Add( myOperationOutputMessage2 ); - - // Add the operations to the PortType. - myPortType->Operations->Add( myAddOperation ); - myPortType->Operations->Add( mySubtractOperation ); - - // Add the PortType to the collection. - myServiceDescription->PortTypes->Add( myPortType ); - } - } - // - - static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) - { - // Create OperationBinding instance for operation. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = operation; - - // Create InputBinding for operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - - // Create extensibility element for 'SoapOperationBinding'. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation ); - - // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - return myOperationBinding; - } -}; - -int main() -{ - ServiceDescription_Sample::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp deleted file mode 100644 index 3a27bf22ab5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// System::Web::Services::Description.ServiceDescriptionCollection -/*The following program demonstrates the 'ServiceDescriptionCollection' class. -It creates two 'ServiceDescription' objects and add them to -'ServiceDescriptionCollection' Object*. It displays the name of 'ServiceDescription' -objects using 'Item' property. 'GetBinding' method is used to display binding instance of the -'ServiceDescription' Object*. - -Note: This program requires 'DataTypes_CS.wsdl' and 'MathService_cpp.wsdl' files to -be placed in same directory as that of .exe for running. -*/ -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - // Get ServiceDescription objects. - ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); - ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); - - // Set the names of the ServiceDescriptions. - myServiceDescription1->Name = "DataTypes"; - myServiceDescription2->Name = "MathService"; - - // Create a ServiceDescriptionCollection. - ServiceDescriptionCollection^ myServiceDescriptionCollection = gcnew ServiceDescriptionCollection; - - // Add the ServiceDescriptions to the collection. - myServiceDescriptionCollection->Add( myServiceDescription1 ); - myServiceDescriptionCollection->Add( myServiceDescription2 ); - - // Display the elements of the collection using the Item property. - Console::WriteLine( "Elements in the collection: " ); - for ( int i = 0; i < myServiceDescriptionCollection->Count; i++ ) - Console::WriteLine( myServiceDescriptionCollection[ i ]->Name ); - - // Construct an XML qualified name. - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); - - // Get the Binding from the collection. - Binding^ myBinding = myServiceDescriptionCollection->GetBinding( myXmlQualifiedName ); - Console::WriteLine( "Binding found in collection with name: {0}", myBinding->ServiceDescription->Name ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp deleted file mode 100644 index 1f4b047229c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -// System::Web::Services::Description.ServiceDescriptionCollection::ServiceDescriptionCollection() -// System::Web::Services::Description.ServiceDescriptionCollection->Add() -// System::Web::Services::Description.ServiceDescriptionCollection::Item(Int32) -/* The following program demonstrates 'Constructor', 'Add' method and -'Item' property of 'ServiceDescriptionCollection' class. It creates an -instance of 'ServiceDescriptionCollection' and adds -'ServiceDescription' objects to the collection. The Item property is used to -display the TargetNamespace of elements in the collection. - -Note: This program requires 'DataTypes_CS::wsdl' and 'MathService_CS::wsdl' -files to be placed in same directory as that of .exe for running. -*/ -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); - ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); - - // - // - // Create a ServiceDescriptionCollection. - ServiceDescriptionCollection^ myCollection = gcnew ServiceDescriptionCollection; - - // Add ServiceDescriptions to the collection. - myCollection->Add( myServiceDescription1 ); - myCollection->Add( myServiceDescription2 ); - // - // - - // - // Display element properties in the collection using - // the Item property. - for ( int i = 0; i < myCollection->Count; i++ ) - Console::WriteLine( myCollection[ i ]->TargetNamespace ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp deleted file mode 100644 index 79ca7ba38d2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// System::Web::Services::Description.ServiceDescriptionCollection::GetBinding() -/* The following program demonstrates the 'GetBinding' method -of 'ServiceDescriptionCollection' class. It searches for a -'Binding' in the collection and returns the Binding instance. -On success, a message is displayed on the console. - -Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' -files to be placed in same directory as that of .exe for running. -*/ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription1 = - ServiceDescription::Read( "DataTypes_cpp.wsdl" ); - ServiceDescription^ myServiceDescription2 = - ServiceDescription::Read( "MathService_cpp.wsdl" ); - - // Create the Object* of 'ServiceDescriptionCollection' class. - ServiceDescriptionCollection^ myCollection = - gcnew ServiceDescriptionCollection; - - // Add ServiceDescription objects. - myCollection->Add( myServiceDescription1 ); - myCollection->Add( myServiceDescription2 ); - -// - // Construct an XML qualified name. - XmlQualifiedName^ myXmlQualifiedName = - gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); - - // Get the Binding from the collection. - myCollection->GetBinding( myXmlQualifiedName ); -// - Console::WriteLine( "Specified Binding is a member of ServiceDescription " - + "instances within the collection" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp deleted file mode 100644 index e84c9b01134..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// System::Web::Services::Description.ServiceDescriptionCollection::GetMessage() - -/* The following program demonstrates the 'GetMessage' method -of 'ServiceDescriptionCollection' class. It searches for a -'Message' in the collection and returns the Message instance. On success, -a message is displayed on the console. - -Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' -files to be placed in same directory as that of .exe for running. -*/ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription1 = - ServiceDescription::Read( "DataTypes_cpp.wsdl" ); - ServiceDescription^ myServiceDescription2 = - ServiceDescription::Read( "MathService_cpp.wsdl" ); - - // Create the Object* of 'ServiceDescriptionCollection' class. - ServiceDescriptionCollection^ myCollection = - gcnew ServiceDescriptionCollection; - - // Add 'ServiceDescription' objects. - myCollection->Add( myServiceDescription1 ); - myCollection->Add( myServiceDescription2 ); - -// - // Construct an XML qualified name. - XmlQualifiedName^ myXmlQualifiedName = - gcnew XmlQualifiedName( "AddSoapIn","http://tempuri2.org/" ); - - // Get the Message from the collection. - myCollection->GetMessage( myXmlQualifiedName ); -// - - Console::WriteLine( "Specified Message is a member of ServiceDescription " - + "instances within the collection." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp deleted file mode 100644 index 8374664ea9d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Web::Services::Description.ServiceDescriptionCollection::GetPortType() - -/* The following program demonstrates the 'GetPortType' method -of 'ServiceDescriptionCollection' class. It searches for a -'PortType' with XmlQualifiedName in the collection and returns a -PortType instance. On success, a message is displayed on the -console. - -Note: This program requires 'DataTypes_cpp..wsdl' and 'MathService_cpp..wsdl' -files to be placed in same directory as that of .exe for running. -*/ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription1 = - ServiceDescription::Read( "DataTypes_cpp..wsdl" ); - ServiceDescription^ myServiceDescription2 = - ServiceDescription::Read( "MathService_cpp..wsdl" ); - - // Create the Object* of 'ServiceDescriptionCollection' class. - ServiceDescriptionCollection^ myCollection = - gcnew ServiceDescriptionCollection; - - // Add 'ServiceDescription' objects. - myCollection->Add( myServiceDescription1 ); - myCollection->Add( myServiceDescription2 ); - -// - // Construct an XML qualified name. - XmlQualifiedName^ myXmlQualifiedName = - gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); - - // Get the PortType from the collection. - myCollection->GetPortType( myXmlQualifiedName ); -// - - Console::WriteLine( "Specified PortType is a member of ServiceDescription " - + "instances within the collection." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp deleted file mode 100644 index 393a442e65a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// System::Web::Services::Description.ServiceDescriptionCollection::GetService() - -/* The following program demonstrates the 'GetService' method -of 'ServiceDescriptionCollection' class. It searches for a -'Service' with XmlQualifiedName in the collection and returns -the Service instance. On success, a message is displayed on the -console. - -Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' -files to be placed in same directory as that of .exe for running. -*/ - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription1 = - ServiceDescription::Read( "DataTypes_cpp.wsdl" ); - ServiceDescription^ myServiceDescription2 = - ServiceDescription::Read( "MathService_cpp.wsdl" ); - - // Create the Object* of 'ServiceDescriptionCollection' class. - ServiceDescriptionCollection^ myCollection = - gcnew ServiceDescriptionCollection; - - // Add 'ServiceDescription' objects. - myCollection->Add( myServiceDescription1 ); - myCollection->Add( myServiceDescription2 ); - -// - // Construct an XML qualified name. - XmlQualifiedName^ myXmlQualifiedName = - gcnew XmlQualifiedName( "MathService","http://tempuri2.org/" ); - - // Get the Service from the collection. - myCollection->GetService( myXmlQualifiedName ); -// - - Console::WriteLine( "Specified Service is a member of ServiceDescription " - + "instances within the collection" ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp deleted file mode 100644 index 65f79d261a7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -// System::Web::Services::Description.ServiceDescriptionCollection::Insert() -// System::Web::Services::Description.ServiceDescriptionCollection::Item(String) -// System::Web::Services::Description.ServiceDescriptionCollection::CopyTo() -/* The following program demonstrates 'Item' property, 'Insert' and 'CopyTo' -methods of the 'ServiceDescriptionCollection' class. It creates an instance of -'ServiceDescriptionCollection' and adds 'ServiceDescription' objects to the -collection. The elements of the collection are copied to a 'ServiceDescription' -array. - -Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' -files to be placed in the same directory as that of .exe for running. -*/ -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); - myServiceDescription1->Name = "DataTypes"; - ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); - myServiceDescription2->Name = "MathService"; - - // Create the object of 'ServiceDescriptionCollection' class. - ServiceDescriptionCollection^ myCollection = gcnew ServiceDescriptionCollection; - - // Add 'ServiceDescription' objects. - myCollection->Add( myServiceDescription1 ); - - // - // Insert a ServiceDescription into the collection. - myCollection->Insert( 1, myServiceDescription2 ); - // - - // - // Get a ServiceDescription in the collection using - // the Item property. - ServiceDescription^ myServiceDescription = myCollection[ "http://tempuri1.org/" ]; - // - - Console::WriteLine( "Name of the object retrieved using 'Item' property: {0}", myServiceDescription->Name ); - - // - array^myArray = gcnew array(myCollection->Count); - - // Copy the collection to a ServiceDescription array. - myCollection->CopyTo( myArray, 0 ); - for ( int i = 0; i < myArray->Length; i++ ) - Console::WriteLine( "Name of element in array: {0}", myArray[ i ]->Name ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp deleted file mode 100644 index bd4ca480209..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp +++ /dev/null @@ -1,142 +0,0 @@ - - -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::ctor -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection->Add() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Item -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Find(System::Type type) -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::FindAll(System::Type type) -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::IsHandled() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::IsRequired() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::CopyTo() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Contains() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::IndexOf() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Remove() -// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Insert() -/* The following program demonstrates the class, properties and methods of -'ServiceDescriptionFormatExtensionCollection' -class. It creates a ServiceDescription object, uses it to create -'ServiceDescriptionFormatExtensionCollection' object. Collection -object is used for demonstration of class properties and methods. - -Note: This program requires 'Sample_cpp.wsdl' file to be placed in -the same directory as that of .exe for running. -*/ -// -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; - -ref class MyFormatExtension: public ServiceDescriptionFormatExtension -{ -public: - MyFormatExtension() - { - // Set the properties. - this->Handled = true; - this->Required = true; - } -}; - -int main() -{ - try - { - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Sample_cpp.wsdl" ); - ServiceDescriptionFormatExtensionCollection^ myCollection = gcnew ServiceDescriptionFormatExtensionCollection( myServiceDescription ); - // - - // - SoapBinding^ mySoapBinding1 = gcnew SoapBinding; - SoapBinding^ mySoapBinding2 = gcnew SoapBinding; - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - MyFormatExtension^ myFormatExtensionObject = gcnew MyFormatExtension; - - // Add elements to collection. - myCollection->Add( mySoapBinding1 ); - myCollection->Add( mySoapAddressBinding ); - myCollection->Add( mySoapBinding2 ); - myCollection->Add( myFormatExtensionObject ); - // - - // - Console::WriteLine( "Collection contains following types of elements: " ); - - // Display the 'Type' of the elements in collection. - for ( int i = 0; i < myCollection->Count; i++ ) - Console::WriteLine( myCollection[ i ]->GetType() ); - // - - // - // Check element of type 'SoapAddressBinding' in collection. - Object^ myObj = myCollection->Find( mySoapAddressBinding->GetType() ); - if ( myObj == nullptr ) - Console::WriteLine( "Element of type ' {0}' not found in collection.", mySoapAddressBinding->GetType() ); - else - Console::WriteLine( "Element of type ' {0}' found in collection.", mySoapAddressBinding->GetType() ); - // - - // - // Check all elements of type 'SoapBinding' in collection. - array^myObjectArray1 = gcnew array(myCollection->Count); - myObjectArray1 = myCollection->FindAll( mySoapBinding1->GetType() ); - int myNumberOfElements = 0; - IEnumerator^ myIEnumerator = myObjectArray1->GetEnumerator(); - - // Calculate number of elements of type 'SoapBinding'. - while ( myIEnumerator->MoveNext() ) - if ( mySoapBinding1->GetType() == myIEnumerator->Current->GetType() ) - myNumberOfElements++; - Console::WriteLine( "Collection contains {0} objects of type ' {1}'.", myNumberOfElements, mySoapBinding1->GetType() ); - // - - // - // Check 'IsHandled' status for 'myFormatExtensionObject' object in collection. - Console::WriteLine( "'IsHandled' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsHandled( myFormatExtensionObject ) ); - // - - // - // Check 'IsRequired' status for 'myFormatExtensionObject' object in collection. - Console::WriteLine( "'IsRequired' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsRequired( myFormatExtensionObject ) ); - // - - // - // Copy elements of collection to an Object array. - array^myObjectArray2 = gcnew array(myCollection->Count); - myCollection->CopyTo( myObjectArray2, 0 ); - Console::WriteLine( "Collection elements are copied to an object array." ); - // - - // - // Check for 'myFormatExtension' object in collection. - if ( myCollection->Contains( myFormatExtensionObject ) ) - { - // - // Get index of a 'myFormatExtension' object in collection. - Console::WriteLine( "Index of 'myFormatExtensionObject' is {0} in collection.", myCollection->IndexOf( myFormatExtensionObject ) ); - // - - // - // Remove 'myFormatExtensionObject' element from collection. - myCollection->Remove( myFormatExtensionObject ); - Console::WriteLine( "'myFormatExtensionObject' is removed from collection." ); - // - } - // - - // - // Insert 'MyFormatExtension' object. - myCollection->Insert( 0, myFormatExtensionObject ); - Console::WriteLine( "'myFormatExtensionObject' is inserted to collection." ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp deleted file mode 100644 index bed420f5e01..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -// System::Web::Services::Description.ServiceDescriptionImportStyle -// System::Web::Services::Description.ServiceDescriptionImportStyle::Client -/* The following program demonstrates the 'ServiceDescriptionImportStyle' -enumeration and 'Client' member of 'ServiceDescriptionImportStyle' in -'System::Web::Services::Description' namespace. It creates a -ServiceDescriptionImporter Object* from a .wsdl file and demonstrates -the usage of Client. */ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -int main() -{ - try - { - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Sample_cpp.wsdl" ); - ServiceDescriptionImporter^ myImporter = gcnew ServiceDescriptionImporter; - myImporter->ProtocolName = "Soap"; - myImporter->AddServiceDescription( myServiceDescription, "", "" ); - - // - ServiceDescriptionImportStyle myStyle = myImporter->Style; - Console::WriteLine( "Import style: {0}", myStyle ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Following exception was thrown: {0}", e ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp deleted file mode 100644 index 475d65bae5a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp +++ /dev/null @@ -1,82 +0,0 @@ -// System::Web::Services::Description.ServiceDescriptionImportWarnings::NoCodeGenerated -// System::Web::Services::Description.ServiceDescriptionImportWarnings::NoMethodsGenerated -// System::Web::Services::Description.ServiceDescriptionImportWarnings::UnsupportedOperationsIgnored -// System::Web::Services::Description.ServiceDescriptionImportWarnings::OptionalExtensionsIgnored -// System::Web::Services::Description.ServiceDescriptionImportWarnings::RequiredExtensionsIgnored -// System::Web::Services::Description.ServiceDescriptionImportWarnings::UnsupportedBindingsIgnored - -/* -The following program demonstrates the enum values of 'ServiceDescriptionImportWarnings'. -'Import' method of 'ServiceDescriptionImporter' will give the enumaration. The user selected -option will help in taking the related wsdl file and returns the corresponding warning which -is displayed on the console. -*/ - -using namespace System; - -#using -#using -#using - -using namespace System::Web::Services::Description; -using namespace System::CodeDom; - -void DisplayWarning( String^ myWSDLFileName ) -{ -// - String^ myDisplay; - // Read wsdl file. - ServiceDescription^ myServiceDescription = ServiceDescription::Read - ( myWSDLFileName ); - - ServiceDescriptionImporter^ myServiceDescriptionImporter = - gcnew ServiceDescriptionImporter; - - // Add 'myServiceDescription' to 'myServiceDescriptionImporter'. - myServiceDescriptionImporter->AddServiceDescription - ( myServiceDescription, "", "" ); - - myServiceDescriptionImporter->ProtocolName = "HttpGet"; - CodeNamespace^ myCodeNamespace = gcnew CodeNamespace; - CodeCompileUnit^ myCodeCompileUnit = gcnew CodeCompileUnit; - - // Invoke 'Import' method. - ServiceDescriptionImportWarnings myWarning = - myServiceDescriptionImporter->Import(myCodeNamespace, - myCodeCompileUnit); - - switch ( myWarning ) - { - case ServiceDescriptionImportWarnings::NoCodeGenerated: - myDisplay = "NoCodeGenerated"; - break; - case ServiceDescriptionImportWarnings::NoMethodsGenerated: - myDisplay = "NoMethodsGenerated"; - break; - case ServiceDescriptionImportWarnings::UnsupportedOperationsIgnored: - myDisplay = "UnsupportedOperationsIgnored"; - break; - case ServiceDescriptionImportWarnings::OptionalExtensionsIgnored: - myDisplay = "OptionalExtensionsIgnored"; - break; - case ServiceDescriptionImportWarnings::RequiredExtensionsIgnored: - myDisplay = "RequiredExtensionsIgnored"; - break; - case ServiceDescriptionImportWarnings::UnsupportedBindingsIgnored: - myDisplay = "UnsupportedBindingsIgnored"; - break; - default: - myDisplay = "General Warning"; - break; - } - Console::WriteLine( "Warning : " + myDisplay ); -// -} - -int main() -{ - DisplayWarning( "ServiceDescriptionImportWarnings_NoCodeGenerated.wsdl" ); - DisplayWarning( "ServiceDescriptionImportWarnings_NoMethodsGenerated::wsdl" ); - DisplayWarning( "ServiceDescriptionImportWarnings_UnsupportedOperationsIgnored::wsdl" ); - DisplayWarning( "ServiceDescriptionImportWarnings_OptionalExtensionsIgnored::wsdl" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp deleted file mode 100644 index 7b2a6a89d1b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp +++ /dev/null @@ -1,85 +0,0 @@ -// System.Web.Services.Description.ServiceDescription.Bindings - -/* -The following example demonstrates the property 'Bindings' of -'ServiceDescription' class. The input to the program is a WSDL file -'MyWsdl_CS.wsdl'. This program removes one 'Binding' from the existing WSDL. -A new Binding is defined and added to the ServiceDescription object. -The program generates a new Web Service Description document. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -// Used to create OperationBinding instances within 'Binding'. -OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) -{ - // Create OperationBinding instance for operation. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = operation; - - // Create InputBinding for operation. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - - // Create extensibility element for 'SoapOperationBinding'. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - mySoapOperationBinding->SoapAction = targetNamespace + operation; - - // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - return myOperationBinding; -} - -int main() -{ - try - { - // - // Obtain the ServiceDescription from existing WSDL. - ServiceDescription^ myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" ); - - // Remove the Binding from the BindingCollection of - // the ServiceDescription. - BindingCollection^ myBindingCollection = myDescription->Bindings; - myBindingCollection->Remove( myBindingCollection[ 0 ] ); - - // Form a new Binding. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Service1Soap"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); - myBinding->Type = myXmlQualifiedName; - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myDescription->TargetNamespace ); - myBinding->Operations->Add( addOperationBinding ); - myBinding->Extensions->Add( mySoapBinding ); - - // Add the Binding to the ServiceDescription. - myDescription->Bindings->Add( myBinding ); - myDescription->Write( "MyOutWsdl.wsdl" ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp deleted file mode 100644 index 4d5942332c2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// System.Web.Services.Description.ServiceDescription.ServiceDescription() -// System.Web.Services.Description.ServiceDescription.Read(string) -// System.Web.Services.Description.ServiceDescription.Messages -// System.Web.Services.Description.ServiceDescription.Name - -/* -The following example demonstrates the 'ServiceDescription()' constructor, -the 'Messages' and 'Name' properties and the 'Read' method of the 'ServiceDescription' -class. The input to the program is a WSDL file 'MyWsdl.wsdl'. -This program removes one message from the existing WSDL. -A new Message is defined and added to the ServiceDescription. -A new wsdl with modified ServiceDescription is written in 'MyOutWsdl.wsdl'. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -int main() -{ - // - // - // - // - ServiceDescription^ myDescription = gcnew ServiceDescription; - myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" ); - myDescription->Name = "MyServiceDescription"; - Console::WriteLine( "Name: {0}", myDescription->Name ); - MessageCollection^ myMessageCollection = myDescription->Messages; - - // Remove the message at index 0 from the message collection. - myMessageCollection->Remove( myDescription->Messages[ 0 ] ); - - // Build a new message. - Message^ myMessage = gcnew Message; - myMessage->Name = "AddSoapIn"; - - // Build a new MessagePart. - MessagePart^ myMessagePart = gcnew MessagePart; - myMessagePart->Name = "parameters"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Add" ); - myMessagePart->Element = myXmlQualifiedName; - - // Add MessageParts to the message. - myMessage->Parts->Add( myMessagePart ); - - // Add the message to the ServiceDescription. - myDescription->Messages->Add( myMessage ); - myDescription->Write( "MyOutWsdl.wsdl" ); - // - // - // - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp deleted file mode 100644 index 5aa1c26e6f6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// System.Web.Services.Description.ServiceDescription.Extensions -// System.Web.Services.Description.ServiceDescription.RetrievalUrl -/* The following program demonstrates properties 'Extensions', 'RetrievalUrl' of -'ServiceDescription' class. The input to the program is a WSDL file -'ServiceDescription_Extensions_Input_cs.wsdl'. This program adds one object -to the extensions collection and displays the count and set the 'RetrievalURL' and displays. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; - -int main() -{ - // - // - ServiceDescription^ myServiceDescription = gcnew ServiceDescription; - myServiceDescription = ServiceDescription::Read( "ServiceDescription_Extensions_Input_cs.wsdl" ); - Console::WriteLine( myServiceDescription->Bindings[ 1 ]->Extensions[ 0 ] ); - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Required = true; - SoapBinding^ mySoapBinding1 = gcnew SoapBinding; - mySoapBinding1->Required = false; - myServiceDescription->Extensions->Add( mySoapBinding ); - myServiceDescription->Extensions->Add( mySoapBinding1 ); - System::Collections::IEnumerator^ myEnum = myServiceDescription->Extensions->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ServiceDescriptionFormatExtension^ myServiceDescriptionFormatExtension = (ServiceDescriptionFormatExtension^)(myEnum->Current); - Console::WriteLine( "Required: {0}", myServiceDescriptionFormatExtension->Required ); - } - - myServiceDescription->Write( "ServiceDescription_Extensions_Output_cs.wsdl" ); - myServiceDescription->RetrievalUrl = "http://www.contoso.com/"; - Console::WriteLine( "Retrieval URL is: {0}", myServiceDescription->RetrievalUrl ); - // - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp deleted file mode 100644 index 7f3cffea1be..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp +++ /dev/null @@ -1,42 +0,0 @@ -// System.Web.Services.Description.ServiceDescription.Imports - -/* The following program demonstrates the property 'Imports' of 'ServiceDescription' class. -The input to the program is a WSDL file 'ServiceDescription_Imports_Input_CS.wsdl' which -is not having the import element. A new 'Import' is defined and added to the new modified -'ServiceDescription_Imports_Output_CS.wsdl' file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -int main() -{ - // - ServiceDescription^ myServiceDescription = gcnew ServiceDescription; - myServiceDescription = ServiceDescription::Read( "ServiceDescription_Imports_Input_CS.wsdl" ); - ImportCollection^ myImportCollection = myServiceDescription->Imports; - - // Create an Import. - Import^ myImport = gcnew Import; - myImport->Namespace = myServiceDescription->TargetNamespace; - - // Set the location for the Import. - myImport->Location = "http://www.contoso.com/"; - myImportCollection->Add( myImport ); - myServiceDescription->Write( "ServiceDescription_Imports_Output_CS.wsdl" ); - myImportCollection->Clear(); - myServiceDescription = ServiceDescription::Read( "ServiceDescription_Imports_Output_CS.wsdl" ); - myImportCollection = myServiceDescription->Imports; - Console::WriteLine( "The Import elements added to the ImportCollection are: " ); - for ( int i = 0; i < myImportCollection->Count; i++ ) - { - Console::WriteLine( "{0}. {1}", (i + 1), myImportCollection[ i ]->Location ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp deleted file mode 100644 index e200b9e1fd6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// System::Web::Services::Description.ServiceDescription::Namespace - -/* -The following example demonstrates the 'Namespace' property of 'ServiceDescription' class. The input to the program is a -WSDL file 'MyWsdl::wsdl'.This program displays the Namespace of 'ServiceDescription' class. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; - -int main() -{ - try - { -// - ServiceDescription^ myDescription = - ServiceDescription::Read( "MyWsdl_CS.wsdl" ); - Console::WriteLine( "Namespace : " + ServiceDescription::Namespace ); -// - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: " + e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp deleted file mode 100644 index fb6a682faf5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// System.Web.Services.Description.ServiceDescription.PortTypes -// System.Web.Services.Description.ServiceDescription.CanRead - -/* -The following example demonstrates the 'PortTypes' property -and 'CanRead' method of 'ServiceDescription' class. -The input to the program is a WSDL file 'MyWsdl_CS.wsdl'. -This program checks the validity of WSDL file.One of the existing -port types is removed.A new PortType is defined and added to the -port types collection of the service description. A modified WSDL -is the output of the program. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -// -// -// Creates an Operation for a PortType. -Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) -{ - Operation^ myOperation = gcnew Operation; - myOperation->Name = operationName; - OperationMessage^ input = dynamic_cast(gcnew OperationInput); - input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); - OperationMessage^ output = dynamic_cast(gcnew OperationOutput); - output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); - myOperation->Messages->Add( input ); - myOperation->Messages->Add( output ); - return myOperation; -} - -int main() -{ - String^ myWsdlFileName = "MyWsdl_CS.wsdl"; - XmlTextReader^ myReader = gcnew XmlTextReader( myWsdlFileName ); - if ( ServiceDescription::CanRead( myReader ) ) - { - ServiceDescription^ myDescription = ServiceDescription::Read( myWsdlFileName ); - - // Remove the PortType at index 0 of the collection. - PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; - myPortTypeCollection->Remove( myDescription->PortTypes[ 0 ] ); - - // Build a new PortType. - PortType^ myPortType = gcnew PortType; - myPortType->Name = "Service1Soap"; - Operation^ myOperation = CreateOperation( "Add", "s0:AddSoapIn", "s0:AddSoapOut", "" ); - myPortType->Operations->Add( myOperation ); - - // Add a new PortType to the PortType collection of - // the ServiceDescription. - myDescription->PortTypes->Add( myPortType ); - myDescription->Write( "MyOutWsdl.wsdl" ); - Console::WriteLine( "New WSDL file generated successfully." ); - } - else - { - Console::WriteLine( "This file is not a WSDL file." ); - } -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp deleted file mode 100644 index 9f61643a1f4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp +++ /dev/null @@ -1,85 +0,0 @@ - - -// System.Web.Description.ServiceDescription.Read(XmlReader) -// System.Web.Description.ServiceCollection.Item(string) -// System.Web.Description.ServiceCollection.Insert(int,Service) -// System.Web.Description.ServiceDescription.Write(XmlWriter) -/* -The following program demonstrates the properties of ServiceDescription and -ServiceCollection class.An XmlTextReader with the required url is created. -An existing WSDL document is read. -An existing service named "MathService" is removed from the collection and -A new Service object is constructed and added at index 1 of the Collection of Services. -A new WSDL file is created as output. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - try - { - // - // - // Create a new XmlTextWriter with specified URL. - XmlTextReader^ myXmlReader = gcnew XmlTextReader( "All_CS.wsdl" ); - ServiceDescription^ myServiceDescription = ServiceDescription::Read( myXmlReader ); - myServiceDescription->TargetNamespace = "http://tempuri.org/"; - - // Remove the service named MathService. - ServiceCollection^ myServiceDescriptionCollection = myServiceDescription->Services; - myServiceDescriptionCollection->Remove( myServiceDescription->Services[ "MathService" ] ); - // - // - - // - Service^ myService = gcnew Service; - myService->Name = "MathService"; - XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); - - // Build a new Port for SOAP. - Port^ mySoapPort = gcnew Port; - mySoapPort->Name = "MathServiceSoap"; - mySoapPort->Binding = myXmlQualifiedName; - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/ServiceDescription_Read/AddService_CS.asmx"; - mySoapPort->Extensions->Add( mySoapAddressBinding ); - - // Build a new Port for HTTP-GET. - XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); - Port^ myHttpGetPort = gcnew Port; - myHttpGetPort->Name = "MathServiceHttpGet"; - myHttpGetPort->Binding = myXmlQualifiedName2; - HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; - myHttpAddressBinding->Location = "http://localhost/ServiceDescription_Read/AddService_CS.asmx"; - myHttpGetPort->Extensions->Add( myHttpAddressBinding ); - - // Add the ports to the service. - myService->Ports->Add( myHttpGetPort ); - myService->Ports->Add( mySoapPort ); - - // Add the service to the ServiceCollection. - myServiceDescription->Services->Insert( 1, myService ); - // - - // - // Create a new XmlTextWriter object. - XmlTextWriter^ myWriter = gcnew XmlTextWriter( "output.wsdl",Encoding::UTF8 ); - myWriter->Formatting = Formatting::Indented; - - // Write the WSDL. - myServiceDescription->Write( myWriter ); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp deleted file mode 100644 index ce0c8097760..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// System::Web::Services::Description.Read(TextReader) -/* -The following example demonstrates the 'Read(TextReader)' method of -'ServiceDescription' class.A ServiceDescription instance is -obtained from existing Wsdl::Name property of Bindings in the -ServiceDescription is displayed to console. -*/ -#using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; -using namespace System::IO; - -int main() -{ - try - { - // - ServiceDescription^ myDescription = gcnew ServiceDescription; - - // Create a StreamReader to read a WSDL file. - TextReader^ myTextReader = gcnew StreamReader( "MyWsdl.wsdl" ); - myDescription = ServiceDescription::Read( myTextReader ); - Console::WriteLine( "Bindings are: " ); - - // Display the Bindings present in the WSDL file. - System::Collections::IEnumerator^ myEnum = myDescription->Bindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Binding^ myBinding = safe_cast(myEnum->Current); - Console::WriteLine( myBinding->Name ); - } - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp deleted file mode 100644 index 11b98b37d9b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -// System::Web::Services::Description.Read(StreamReader) -/* -The following example demonstrates the 'Read(StreamReader)' method of -'ServiceDescription' class.A ServiceDescription instance is -obtained from existing Wsdl. Name property of Bindings in the -ServiceDescription is displayed to console. -*/ -#using - -// #using -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Description; -using namespace System::Xml; -using namespace System::IO; - -int main() -{ - try - { - // - // Create a StreamReader to read a WSDL file. - StreamReader^ myStreamReader = gcnew StreamReader( "MyWsdl.wsdl" ); - ServiceDescription^ myDescription = ServiceDescription::Read( myStreamReader ); - Console::WriteLine( "Bindings are: " ); - - // Display the Bindings present in the WSDL file. - System::Collections::IEnumerator^ myEnum = myDescription->Bindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Binding^ myBinding = safe_cast(myEnum->Current); - Console::WriteLine( myBinding->Name ); - } - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp deleted file mode 100644 index 306781ed271..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp +++ /dev/null @@ -1,101 +0,0 @@ - - -// System.Web.Services.Description.ServiceDescription.Types -// System.Web.Services.Description.ServiceDescription.Write(Stream) -/* -The following program demonstrates the 'Write' method and 'Types' property -of ServiceDescription class.An existing WSDL document is read. -Types of the SericeDescription are removed.New Types are constructed. -Types are then added to ServiceDescription .A new WSDL file is created as output. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -// This function creates a XmlComplex Element. -XmlSchemaElement^ CreateComplexTypeXmlElement( String^ minoccurs, String^ maxoccurs, String^ name, XmlQualifiedName^ schemaTypeName ) -{ - XmlSchemaElement^ myXmlSchemaElement = gcnew XmlSchemaElement; - myXmlSchemaElement->MinOccursString = minoccurs; - myXmlSchemaElement->MaxOccursString = maxoccurs; - myXmlSchemaElement->Name = name; - myXmlSchemaElement->SchemaTypeName = schemaTypeName; - return myXmlSchemaElement; -} - -int main() -{ - try - { - // Read the existing WSDL. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Input_CS.wsdl" ); - - // - myServiceDescription->Types->Schemas->Remove( myServiceDescription->Types->Schemas[ 0 ] ); - XmlSchema^ myXmlSchema = gcnew XmlSchema; - myXmlSchema->AttributeFormDefault = XmlSchemaForm::Qualified; - myXmlSchema->ElementFormDefault = XmlSchemaForm::Qualified; - myXmlSchema->TargetNamespace = myServiceDescription->TargetNamespace; - XmlSchemaElement^ myXmlElement1 = gcnew XmlSchemaElement; - myXmlElement1->Name = "Add"; - XmlSchemaComplexType^ myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - XmlSchemaSequence^ myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "a", gcnew XmlQualifiedName( "s:float" ) ) ); - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "b", gcnew XmlQualifiedName( "s:float" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlElement1->SchemaType = myXmlSchemaComplexType; - myXmlSchema->Items->Add( myXmlElement1 ); - XmlSchemaElement^ myXmlElement2 = gcnew XmlSchemaElement; - myXmlElement2->Name = "AddResponse"; - myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "AddResult", gcnew XmlQualifiedName( "s:float" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlElement2->SchemaType = myXmlSchemaComplexType; - myXmlSchema->Items->Add( myXmlElement2 ); - XmlSchemaElement^ myXmlElement3 = gcnew XmlSchemaElement; - myXmlElement3->Name = "Subtract"; - myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "a", gcnew XmlQualifiedName( "s:float" ) ) ); - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "b", gcnew XmlQualifiedName( "s:float" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlElement3->SchemaType = myXmlSchemaComplexType; - myXmlSchema->Items->Add( myXmlElement3 ); - XmlSchemaElement^ myXmlElement4 = gcnew XmlSchemaElement; - myXmlElement4->Name = "SubtractResponse"; - myXmlSchemaComplexType = gcnew XmlSchemaComplexType; - myXmlSchemaSequence = gcnew XmlSchemaSequence; - myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "SubtractResult", gcnew XmlQualifiedName( "s:int" ) ) ); - myXmlSchemaComplexType->Particle = myXmlSchemaSequence; - myXmlElement4->SchemaType = myXmlSchemaComplexType; - myXmlSchema->Items->Add( myXmlElement4 ); - - // Add the schemas to the Types property of the ServiceDescription. - myServiceDescription->Types->Schemas->Add( myXmlSchema ); - // - - // - FileStream^ myFileStream = gcnew FileStream( "output.wsdl",FileMode::OpenOrCreate,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - - // Write the WSDL. - Console::WriteLine( "Writing a new WSDL file." ); - myServiceDescription->Write( myStreamWriter ); - myStreamWriter->Close(); - myFileStream->Close(); - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception Caught! {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp b/snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp deleted file mode 100644 index c6ed8c5b45d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// System.Web.Services.Description.Service.Ports -// System.Web.Services.Description.Service.Extensions -// System.Web.Services.Description.Service.Service() -// System.Web.Services.Description.Service.Name - -/*The following sample demonstrates the properties 'Ports','Extensions','Name' and -constructor 'Service()'. This sample reads the contents of a file 'MathService_cs.wsdl' -into a 'ServiceDescription' instance. It gets the collection of Service -instances from 'ServiceDescription'. It then removes a 'Service' from the collection and -creates a new 'Service' and adds it into collection. It writes a new web service description -file 'MathService_New.wsdl'. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -Port^ CreatePort( String^ PortName, String^ BindingName, String^ targetNamespace ) -{ - Port^ myPort = gcnew Port; - myPort->Name = PortName; - myPort->Binding = gcnew XmlQualifiedName( BindingName,targetNamespace ); - - // Create a SoapAddress extensibility element to add to the port. - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/Service_Class/MathService_CS.asmx"; - myPort->Extensions->Add( mySoapAddressBinding ); - return myPort; -} - -int main() -{ - try - { - // - // - // - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); - ServiceCollection^ myServiceCollection = myServiceDescription->Services; - int noOfServices = myServiceCollection->Count; - Console::WriteLine( "\nTotal number of services: {0}", noOfServices ); - - // Get a reference to the service. - Service^ myOldService = myServiceCollection[ 0 ]; - Console::WriteLine( "No. of Ports in the Service{0}", myServiceCollection[ 0 ]->Ports->Count ); - Console::WriteLine( "These are the ports in the service:" ); - for ( int i = 0; i < myOldService->Ports->Count; i++ ) - Console::WriteLine( "Port name: {0}", myOldService->Ports[ i ]->Name ); - Console::WriteLine( "Service name: {0}", myOldService->Name ); - Service^ myService = gcnew Service; - myService->Name = "MathService"; - - // Add the ports to the newly created service. - for ( int i = 0; i < myOldService->Ports->Count; i++ ) - { - String^ PortName = myServiceCollection[ 0 ]->Ports[ i ]->Name; - String^ BindingName = myServiceCollection[ 0 ]->Ports[ i ]->Binding->Name; - myService->Ports->Add( CreatePort( PortName, BindingName, myServiceDescription->TargetNamespace ) ); - - } - Console::WriteLine( "Newly created ports -" ); - for ( int i = 0; i < myService->Ports->Count; i++ ) - Console::WriteLine( "Port Name: {0}", myOldService->Ports[ i ]->Name ); - - // Add the extensions to the newly created service. - int noOfExtensions = myOldService->Extensions->Count; - Console::WriteLine( "No. of extensions: {0}", noOfExtensions ); - if ( noOfExtensions > 0 ) - { - for ( int i = 0; i < myOldService->Ports->Count; i++ ) - myService->Extensions->Add( myServiceCollection[ 0 ]->Extensions[ i ] ); - } - - // Remove the service from the collection. - myServiceCollection->Remove( myOldService ); - - // Add the newly created service. - myServiceCollection->Add( myService ); - myServiceDescription->Write( "MathService_New.wsdl" ); - // - // - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } - -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp deleted file mode 100644 index 4386b6e2533..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Security::Permissions; - -[SecurityPermission(SecurityAction::Demand)] -int main() -{ - // - IDictionary^ prop = gcnew Hashtable; - prop[ "port" ] = 9000; - IClientChannelSinkProvider^ clientChain = gcnew BinaryClientFormatterSinkProvider; - IServerChannelSinkProvider^ serverChain = gcnew SoapServerFormatterSinkProvider; - serverChain->Next = gcnew BinaryServerFormatterSinkProvider; - ChannelServices::RegisterChannel( gcnew HttpChannel( prop,clientChain,serverChain ) ); - // - - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp deleted file mode 100644 index 076a9f19088..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp +++ /dev/null @@ -1,126 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Schema; -using namespace System::ComponentModel; -public ref class Group -{ -public: - - // The default is set to .NET. - - [DefaultValue(".NET")] - String^ GroupName; -}; - -public ref class Run -{ -public: - void SerializeOriginal( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Setting the GroupName to '.NET' is like not setting it at all - // because it is the default value. So no value will be - // serialized, and on deserialization it will appear as a blank. - myGroup->GroupName = ".NET"; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); - } - - void SerializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class - // that overrides the serialization. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // The specifies that the default value is now - // 'Team1'. So setting the GroupName to '.NET' means - // the value will be serialized. - myGroup->GroupName = ".NET"; - - // Serialize the class, and close the TextWriter. - overRideSerializer->Serialize( writer, myGroup ); - writer->Close(); - } - - void DeserializeOriginal( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); - - // Reading the file requires a TextReader. - TextReader^ reader = gcnew StreamReader( filename ); - - // Deserialize and cast the Object*. - Group^ myGroup; - myGroup = safe_cast(mySerializer->Deserialize( reader )); - Console::WriteLine( myGroup->GroupName ); - Console::WriteLine(); - } - - void DeserializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - - // Reading the file requires a TextReader. - TextReader^ reader = gcnew StreamReader( filename ); - - // Deserialize and cast the Object*. - Group^ myGroup; - myGroup = safe_cast(overRideSerializer->Deserialize( reader )); - Console::WriteLine( myGroup->GroupName ); - } - -private: - XmlSerializer^ CreateOverrideSerializer() - { - SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; - SoapAttributes^ soapAtts = gcnew SoapAttributes; - - // Create a new DefaultValueAttribute Object* for the GroupName - // property. - DefaultValueAttribute^ newDefault = gcnew DefaultValueAttribute( "Team1" ); - soapAtts->SoapDefaultValue = newDefault; - mySoapAttributeOverrides->Add( Group::typeid, "GroupName", soapAtts ); - - // Create an XmlTypeMapping that is used to create an instance - // of the XmlSerializer. Then return the XmlSerializer Object*. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); - return ser; - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeOriginal( "SoapOriginal.xml" ); - test->SerializeOverride( "mySoapAttributeOverridesideAttributes.xml" ); - test->DeserializeOriginal( "SoapOriginal.xml" ); - test->DeserializeOverride( "mySoapAttributeOverridesideAttributes.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp deleted file mode 100644 index 6c2fca3bb4d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Schema; - -//using namespace System::Runtime::Remoting::Metadata; -public ref class Vehicle -{ -public: - String^ licenseNumber; -}; - - -[SoapInclude(Vehicle::typeid)] -public ref class Group -{ -public: - - [SoapAttributeAttribute(Namespace="http://www.cpandl.com")] - String^ GroupName; - - [SoapAttributeAttribute(DataType="base64Binary")] - array^GroupNumber; - - [SoapAttributeAttribute(DataType="date",AttributeName="CreationDate")] - DateTime Today; - - [SoapElement(DataType="nonNegativeInteger",ElementName="PosInt")] - String^ PostitiveInt; - Vehicle^ GroupVehicle; -}; - -public ref class Run -{ -public: - void SerializeObject( String^ filename ) - { - // Create an instance of the XmlSerializer class that - // can generate encoded SOAP messages. - XmlSerializer^ mySerializer = ReturnSOAPSerializer(); - Group^ myGroup = MakeGroup(); - - // Writing the file requires a TextWriter. - XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); - writer->Formatting = Formatting::Indented; - writer->WriteStartElement( "wrapper" ); - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->WriteEndElement(); - writer->Close(); - } - - -private: - Group^ MakeGroup() - { - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the Object* properties. - myGroup->GroupName = ".NET"; - array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )}; - myGroup->GroupNumber = hexByte; - DateTime myDate = DateTime(2002,5,2); - myGroup->Today = myDate; - myGroup->PostitiveInt = "10000"; - myGroup->GroupVehicle = gcnew Vehicle; - myGroup->GroupVehicle->licenseNumber = "1234"; - return myGroup; - } - -public: - void DeserializeObject( String^ filename ) - { - // Create an instance of the XmlSerializer class that - // can generate encoded SOAP messages. - XmlSerializer^ mySerializer = ReturnSOAPSerializer(); - - // Reading the file requires an XmlTextReader. - XmlTextReader^ reader = gcnew XmlTextReader( filename ); - reader->ReadStartElement( "wrapper" ); - - // Deserialize and cast the Object*. - Group^ myGroup; - myGroup = safe_cast(mySerializer->Deserialize( reader )); - reader->ReadEndElement(); - reader->Close(); - } - -private: - XmlSerializer^ ReturnSOAPSerializer() - { - - // Create an instance of the XmlSerializer class. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); - return gcnew XmlSerializer( myMapping ); - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeObject( "SoapAtts.xml" ); - test->DeserializeObject( "SoapAtts.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp deleted file mode 100644 index ca2b9a2176d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp +++ /dev/null @@ -1,76 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Group -{ -public: - - // This attribute will be overridden. - - [SoapAttributeAttribute(Namespace="http://www.cpandl.com")] - String^ GroupName; -}; - -public ref class Run -{ -public: - void SerializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class - // that overrides the serialization. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the Object* properties. - myGroup->GroupName = ".NET"; - - // Serialize the class, and close the TextWriter. - overRideSerializer->Serialize( writer, myGroup ); - writer->Close(); - } - -private: - XmlSerializer^ CreateOverrideSerializer() - { - SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; - SoapAttributes^ mySoapAttributes = gcnew SoapAttributes; - - // Create a new SoapAttributeAttribute to the - // one applied to the Group class. The resulting XML - // stream will use the new namespace and attribute name. - SoapAttributeAttribute^ mySoapAttribute = gcnew SoapAttributeAttribute; - mySoapAttribute->AttributeName = "TeamName"; - - // Change the Namespace. - mySoapAttribute->Namespace = "http://www.cohowinery.com"; - mySoapAttributes->SoapAttribute = mySoapAttribute; - mySoapAttributeOverrides->Add( Group::typeid, "GroupName", mySoapAttributes ); - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); - return ser; - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeOverride( "SoapOveride.xml" ); -} - -// -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp deleted file mode 100644 index 723d53337e0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -public ref class Group -{ -public: - // Override the serialization of this member. - String^ GroupName; -}; - -public ref class Run -{ -public: - void SerializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class - // that overrides the serialization. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - myGroup->GroupName = ".NET"; - - // Serialize the class, and close the TextWriter. - overRideSerializer->Serialize( writer, myGroup ); - writer->Close(); - } - -private: - XmlSerializer^ CreateOverrideSerializer() - { - SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; - SoapAttributes^ mySoapAttributes = gcnew SoapAttributes; - SoapElementAttribute^ mySoapElement = gcnew SoapElementAttribute; - mySoapElement->ElementName = "TeamName"; - mySoapAttributes->SoapElement = mySoapElement; - - // Add the SoapAttributes to the - // mySoapAttributeOverridesrides object. - mySoapAttributeOverrides->Add( Group::typeid, "GroupName", mySoapAttributes ); - - // Get the SoapAttributes with the Item property. - SoapAttributes^ thisSoapAtts = mySoapAttributeOverrides[Group::typeid, "GroupName"]; - Console::WriteLine( "New serialized element name: {0}", thisSoapAtts->SoapElement->ElementName ); - - // Create an XmlTypeMapping that is used to create an instance - // of the XmlSerializer. Then return the XmlSerializer object. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))-> - ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); - - return ser; - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeOverride( "GetSoapAttributes.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp deleted file mode 100644 index e35e9d519f2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// The name of this type will be overridden using -// the SoapTypeAttribute. -public ref class Group -{ -public: - String^ GroupName; -}; - -public ref class Run -{ -public: - void SerializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class - // that overrides the serialization. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - myGroup->GroupName = ".NET"; - - // Serialize the class, and close the TextWriter. - overRideSerializer->Serialize( writer, myGroup ); - writer->Close(); - } - -private: - XmlSerializer^ CreateOverrideSerializer() - { - SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; - SoapAttributes^ mySoapAttributes = gcnew SoapAttributes; - SoapTypeAttribute^ mySoapType = gcnew SoapTypeAttribute; - mySoapType->TypeName = "Team"; - mySoapAttributes->SoapType = mySoapType; - - // Add the SoapAttributes to the - // mySoapAttributeOverridesrides object. - mySoapAttributeOverrides->Add( Group::typeid, mySoapAttributes ); - - // Get the SoapAttributes with the Item property. - SoapAttributes^ thisSoapAtts = mySoapAttributeOverrides[ Group::typeid ]; - Console::WriteLine( "New serialized type name: {0}", thisSoapAtts->SoapType->TypeName ); - - // Create an XmlTypeMapping that is used to create an instance - // of the XmlSerializer. Then return the XmlSerializer object. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))-> - ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); - return ser; - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeOverride( "GetSoapAttributes2.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp deleted file mode 100644 index 97fc8013fb4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Soap; -using namespace System::Runtime::Remoting::Metadata; - -// A test Object* that needs to be serialized -// -[Serializable] -[SoapTypeAttribute(XmlNamespace="MyXmlNamespace")] -public ref class TestSimpleObject -{ -public: - int member1; - - [SoapFieldAttribute(XmlElementName="MyXmlElement")] String^ member2; - - String^ member3; - double member4; - - // A field that is not serialized. - - [NonSerialized] String^ member5; - - TestSimpleObject() - { - member1 = 11; - member2 = "hello"; - member3 = "hello"; - member4 = 3.14159265; - member5 = "hello world!"; - } -}; -// - -int main() -{ - // Creates a new TestSimpleObject Object^. - TestSimpleObject^ obj = gcnew TestSimpleObject; - - // Opens a file and serializes the Object^ into it in binary format. - Stream^ stream = File::Open( "data.xml", FileMode::Create ); - SoapFormatter^ formatter = gcnew SoapFormatter; - formatter->Serialize( stream, obj ); - stream->Close(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp deleted file mode 100644 index cd4ad348629..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp +++ /dev/null @@ -1,246 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Schema; -ref class Car; - -// SoapInclude allows Vehicle to accept Car type. - -[SoapInclude(Car::typeid)] -public ref class Vehicle abstract -{ -public: - String^ licenseNumber; - DateTime makeDate; -}; - -public ref class Car: public Vehicle{}; - -public enum class GroupType -{ - // These enums can be overridden. - [SoapEnum("Small")] - A, - [SoapEnum("Large")] - B -}; - -public ref class Group -{ -public: - - [SoapAttributeAttribute(Namespace="http://www.cpandl.com")] - String^ GroupName; - - [SoapAttributeAttribute(DataType="base64Binary")] - array^GroupNumber; - - [SoapAttributeAttribute(DataType="date",AttributeName="CreationDate")] - DateTime Today; - - [SoapElement(DataType="nonNegativeInteger",ElementName="PosInt")] - String^ PostitiveInt; - - // This is ignored when serialized unless it's overridden. - - [SoapIgnore] - bool IgnoreThis; - GroupType Grouptype; - Vehicle^ MyVehicle; - - // The SoapInclude allows the method to return a Car. - - [SoapInclude(Car::typeid)] - Vehicle^ myCar( String^ licNumber ) - { - Vehicle^ v; - if ( licNumber->Equals( "" ) ) - { - v = gcnew Car; - v->licenseNumber = "!!!!!!"; - } - else - { - v = gcnew Car; - v->licenseNumber = licNumber; - } - - return v; - } -}; - -public ref class Run -{ -public: - static void main() - { - Run^ test = gcnew Run; - test->SerializeOriginal( "SoapOriginal.xml" ); - test->SerializeOverride( "SoapOverrides.xml" ); - test->DeserializeOriginal( "SoapOriginal.xml" ); - test->DeserializeOverride( "SoapOverrides.xml" ); - } - - void SerializeOriginal( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); - XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping ); - Group^ myGroup = MakeGroup(); - - // Writing the file requires a TextWriter. - XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); - writer->Formatting = Formatting::Indented; - writer->WriteStartElement( "wrapper" ); - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->WriteEndElement(); - writer->Close(); - } - - void SerializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class - // that overrides the serialization. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - Group^ myGroup = MakeGroup(); - - // Writing the file requires a TextWriter. - XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); - writer->Formatting = Formatting::Indented; - writer->WriteStartElement( "wrapper" ); - - // Serialize the class, and close the TextWriter. - overRideSerializer->Serialize( writer, myGroup ); - writer->WriteEndElement(); - writer->Close(); - } - -private: - Group^ MakeGroup() - { - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the object properties. - myGroup->GroupName = ".NET"; - array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )}; - myGroup->GroupNumber = hexByte; - DateTime myDate = DateTime(2002,5,2); - myGroup->Today = myDate; - myGroup->PostitiveInt = "10000"; - myGroup->IgnoreThis = true; - myGroup->Grouptype = GroupType::B; - Car^ thisCar = dynamic_cast(myGroup->myCar( "1234566" )); - myGroup->MyVehicle = thisCar; - return myGroup; - } - -public: - void DeserializeOriginal( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); - XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping ); - - // Reading the file requires an XmlTextReader. - XmlTextReader^ reader = gcnew XmlTextReader( filename ); - reader->ReadStartElement( "wrapper" ); - - // Deserialize and cast the object. - Group^ myGroup; - myGroup = dynamic_cast(mySerializer->Deserialize( reader )); - reader->ReadEndElement(); - reader->Close(); - } - - void DeserializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); - - // Reading the file requires an XmlTextReader. - XmlTextReader^ reader = gcnew XmlTextReader( filename ); - reader->ReadStartElement( "wrapper" ); - - // Deserialize and cast the object. - Group^ myGroup; - myGroup = dynamic_cast(overRideSerializer->Deserialize( reader )); - reader->ReadEndElement(); - reader->Close(); - ReadGroup( myGroup ); - } - -private: - void ReadGroup( Group^ myGroup ) - { - Console::WriteLine( myGroup->GroupName ); - Console::WriteLine( myGroup->GroupNumber[ 0 ] ); - Console::WriteLine( myGroup->GroupNumber[ 1 ] ); - Console::WriteLine( myGroup->Today ); - Console::WriteLine( myGroup->PostitiveInt ); - Console::WriteLine( myGroup->IgnoreThis ); - Console::WriteLine(); - } - - XmlSerializer^ CreateOverrideSerializer() - { - SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; - SoapAttributes^ soapAtts = gcnew SoapAttributes; - SoapElementAttribute^ mySoapElement = gcnew SoapElementAttribute; - mySoapElement->ElementName = "xxxx"; - soapAtts->SoapElement = mySoapElement; - mySoapAttributeOverrides->Add( Group::typeid, "PostitiveInt", soapAtts ); - - // Override the IgnoreThis property. - SoapIgnoreAttribute^ myIgnore = gcnew SoapIgnoreAttribute; - soapAtts = gcnew SoapAttributes; - soapAtts->SoapIgnore = false; - mySoapAttributeOverrides->Add( Group::typeid, "IgnoreThis", soapAtts ); - - // Override the GroupType enumeration. - soapAtts = gcnew SoapAttributes; - SoapEnumAttribute^ xSoapEnum = gcnew SoapEnumAttribute; - xSoapEnum->Name = "Over1000"; - soapAtts->GroupType::SoapEnum = xSoapEnum; - - // Add the SoapAttributes to the - // mySoapAttributeOverridesrides object. - mySoapAttributeOverrides->Add( GroupType::typeid, "A", soapAtts ); - - // Create second enumeration and add it. - soapAtts = gcnew SoapAttributes; - xSoapEnum = gcnew SoapEnumAttribute; - xSoapEnum->Name = "ZeroTo1000"; - soapAtts->GroupType::SoapEnum = xSoapEnum; - mySoapAttributeOverrides->Add( GroupType::typeid, "B", soapAtts ); - - // Override the Group type. - soapAtts = gcnew SoapAttributes; - SoapTypeAttribute^ soapType = gcnew SoapTypeAttribute; - soapType->TypeName = "Team"; - soapAtts->SoapType = soapType; - mySoapAttributeOverrides->Add( Group::typeid, soapAtts ); - - // Create an XmlTypeMapping that is used to create an instance - // of the XmlSerializer. Then return the XmlSerializer object. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); - return ser; - } -}; - -int main() -{ - Run::main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp deleted file mode 100644 index 477f2e9539d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// System::Web::Services::Description.SoapBindingStyle::Rpc -// System::Web::Services::Description.SoapBindingUse::Encoded -// System::Web::Services::Description.SoapBodyBinding::Encoding -// System::Web::Services::Description.SoapBodyBinding::Namespace -// System::Web::Services::Description.SoapHeaderBinding::Encoding -// System::Web::Services::Description.SoapHeaderBinding::Namespace - -/* -The following example demonstrates the 'Rpc' member of 'SoapBindingStyle' -enumeration , 'Encoded' member of 'SoapBindingUse' enumeration , 'Encoding' -and 'Namespace' properties of 'SoapBodyBinding' class and 'Encoding' -and 'Namespace' properties of 'SoapHeaderBinding' class. -It takes as input a wsdl file which does not contain a binding for SOAP. -By using the 'Read' method of 'ServiceDescription' class it gets a 'ServiceDescription' Object*. -It uses the SOAP protocol related classes and creates 'Binding' element -of 'SOAP' protocol which are then added to the 'ServiceDescription' Object*. -An output wsdl file is generated from 'ServiceDescription' Object* which -could be used for generating a proxy. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myServiceDescription = - ServiceDescription::Read( "SoapBindingStyleInput_cpp.wsdl" ); - Binding^ myBinding = gcnew Binding; - myBinding->Name = "SOAPSvrMgr_SOAPBinding"; - myBinding->Type = gcnew XmlQualifiedName( "tns:SOAPSvrMgr_portType" ); - -// - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - // Message to be transmitted contains parameters to call a procedure. - mySoapBinding->Style = SoapBindingStyle::Rpc; - myBinding->Extensions->Add( mySoapBinding ); -// - - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "GetServerStats"; - - SoapOperationBinding^ mySoapOperationBinding = - gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = - "http://tempuri.org/soapsvcmgr/GetServerStats"; - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - - // Create InputBinding for operation for the 'SOAP' protocol. - InputBinding^ myInputBinding = gcnew InputBinding; - -// -// -// - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - // Encode SOAP body using rules specified by the 'Encoding' property. - mySoapBodyBinding->Use = SoapBindingUse::Encoded; - // Set URI representing the encoding style for encoding the body. - mySoapBodyBinding->Encoding = "http://schemas.xmlsoap.org/soap/encoding/"; - // Set the Uri representing the location of the specification - // for encoding of content not defined by 'Encoding' property'. - mySoapBodyBinding->Namespace = "http://tempuri.org/soapsvcmgr/"; - myInputBinding->Extensions->Add( mySoapBodyBinding ); -// -// -// - -// -// - SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding; - mySoapHeaderBinding->Message = - gcnew XmlQualifiedName( "tns:Soapsvcmgr_Headers_Request" ); - mySoapHeaderBinding->Part = "AuthCS"; - // Encode SOAP header using rules specified by the 'Encoding' property. - mySoapHeaderBinding->Use = SoapBindingUse::Encoded; - // Set URI representing the encoding style for encoding the header. - mySoapHeaderBinding->Encoding = "http://schemas.xmlsoap.org/soap/encoding/"; - // Set the Uri representing the location of the specification - // for encoding of content not defined by 'Encoding' property'. - mySoapHeaderBinding->Namespace = "http://tempuri.org/SOAPSvr/soapsvcmgr/headers.xsd"; - // Add mySoapHeaderBinding to the 'myInputBinding' Object*. - myInputBinding->Extensions->Add( mySoapHeaderBinding ); -// -// - - // Create OutputBinding for operation. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - mySoapHeaderBinding->Part = "AuthSC"; - mySoapHeaderBinding->Message = - gcnew XmlQualifiedName( "tns:Soapsvcmgr_Headers_Response" ); - myOutputBinding->Extensions->Add( mySoapHeaderBinding ); - - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - myBinding->Operations->Add( myOperationBinding ); - - myServiceDescription->Bindings->Add( myBinding ); - myServiceDescription->Write( "SoapBindingStyleOutput_cpp.wsdl" ); - Console::WriteLine( "'SoapBindingStyleOutput_cpp.wsdl' file is generated." ); - Console::WriteLine( "Proxy could be created using command" + - " 'wsdl SoapBindingStyleOutput_cpp.wsdl'" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp deleted file mode 100644 index 80ca9900bb5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// System.Web.Services.Description.SoapBinding.ctor -// System.Web.Services.Description.SoapBinding.Transport -// System.Web.Services.Description.SoapBinding.Style -// System.Web.Services.Description.SoapBindingStyle.Document -// System.Web.Services.Description.SoapOperationBinding.ctor -// System.Web.Services.Description.SoapOperationBinding.SoapAction -// System.Web.Services.Description.SoapOperationBinding.Style -// System.Web.Services.Description.SoapBodyBinding.ctor -// System.Web.Services.Description.SoapBodyBinding.Use -// System.Web.Services.Description.SoapBindingUse.Literal -// System.Web.Services.Description.SoapAddressBinding.ctor -// System.Web.Services.Description.SoapAddressBinding.Location - -/* -The following example demonstrates the 'SoapBinding' constructor,'Transport','Style' -properties of 'SoapBinding' class,'Document' member of 'SoapBindingStyle' enum, -'SoapOperationBinding' constructor,'SoapAction','Style' properties of 'SoapOperationBinding' -class, 'SoapBodyBinding' contructor,'Use' property of 'SoapBodyBinding' class, -'Literal' member of 'SoapBindingUse' enum and 'SoapAddressBinding' constructor, 'Location' -property of class 'SoapAddressBinding'. - -It takes as input a wsdl file which supports two protocols 'HttpGet' and 'HttpPost' . -By using the 'Read' method of 'ServiceDescription' class it gets a 'ServiceDescription' -object. It uses the SOAP protocol related classes and creates 'Binding','Port', -'PortType' and 'Message' elements of 'SOAP' protocol. It adds all these elements to -the 'ServiceDescription' object. The 'ServiceDescription' object creates another -wsdl file which supports 'SOAP' also. This wsdl file is used to generate a proxy -which is used by the .aspx file. -Note: To run the example run the makefile provided and open the '.aspx' file in browser. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); - - // Create a 'Binding' object for the 'SOAP' protocol. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Service1Soap"; - XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); - myBinding->Type = qualifiedName; - - // - // - // - // - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - - // Add the 'SoapBinding' object to the 'Binding' object. - myBinding->Extensions->Add( mySoapBinding ); - // - // - // - // - - // Create the 'OperationBinding' object for the 'SOAP' protocol. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - - // - // - // - // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - - // Add the 'SoapOperationBinding' object to 'OperationBinding' object. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - // - // - // - - // - // - // - // Create the 'InputBinding' object for the 'SOAP' protocol. - InputBinding^ myInput = gcnew InputBinding; - SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; - mySoapBinding1->Use = SoapBindingUse::Literal; - myInput->Extensions->Add( mySoapBinding1 ); - - // Add the 'InputBinding' object to 'OperationBinding' object. - myOperationBinding->Input = myInput; - - // Create the 'OutputBinding' object'. - OutputBinding^ myOutput = gcnew OutputBinding; - myOutput->Extensions->Add( mySoapBinding1 ); - - // Add the 'OutputBinding' object to 'OperationBinding' object. - myOperationBinding->Output = myOutput; - - // Add the 'OperationBinding' object to 'Binding' object. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' object to the ServiceDescription instance. - myDescription->Bindings->Add( myBinding ); - // - // - // - - // - // - Port^ soapPort = gcnew Port; - soapPort->Name = "Service1Soap"; - soapPort->Binding = gcnew XmlQualifiedName( "s0:Service1Soap" ); - - // Create a 'SoapAddressBinding' object for the 'SOAP' protocol. - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/Service1_cs.asmx"; - - // Add the 'SoapAddressBinding' object to the 'Port'. - soapPort->Extensions->Add( mySoapAddressBinding ); - - // Add the 'Port' object to the ServiceDescription instance. - myDescription->Services[ 0 ]->Ports->Add( soapPort ); - // - // - - // Create a 'PortType' object. for SOAP protocol. - PortType^ soapPortType = gcnew PortType; - soapPortType->Name = "Service1Soap"; - Operation^ soapOperation = gcnew Operation; - soapOperation->Name = "AddNumbers"; - OperationMessage^ soapInput = (OperationMessage^)(gcnew OperationInput); - soapInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersSoapIn" ); - OperationMessage^ soapOutput = (OperationMessage^)(gcnew OperationOutput); - soapOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersSoapOut" ); - soapOperation->Messages->Add( soapInput ); - soapOperation->Messages->Add( soapOutput ); - - // Add the 'Operation' object to 'PortType' object. - soapPortType->Operations->Add( soapOperation ); - - // Add the 'PortType' object first to 'PortTypeCollection' object - // and then to 'ServiceDescription' object. - myDescription->PortTypes->Add( soapPortType ); - - // Create the 'Message' object. - Message^ soapMessage1 = gcnew Message; - soapMessage1->Name = "AddNumbersSoapIn"; - - // Create the 'MessageParts' object. - MessagePart^ soapMessagePart1 = gcnew MessagePart; - soapMessagePart1->Name = "parameters"; - soapMessagePart1->Element = gcnew XmlQualifiedName( "s0:AddNumbers" ); - - // Add the 'MessagePart' object to 'Messages' object. - soapMessage1->Parts->Add( soapMessagePart1 ); - - // Create another 'Message' object. - Message^ soapMessage2 = gcnew Message; - soapMessage2->Name = "AddNumbersSoapOut"; - MessagePart^ soapMessagePart2 = gcnew MessagePart; - soapMessagePart2->Name = "parameters"; - soapMessagePart2->Element = gcnew XmlQualifiedName( "s0:AddNumbersResponse" ); - - // Add the 'MessagePart' object to second 'Message' object. - soapMessage2->Parts->Add( soapMessagePart2 ); - - // Add the 'Message' objects to 'ServiceDescription'. - myDescription->Messages->Add( soapMessage1 ); - myDescription->Messages->Add( soapMessage2 ); - - // Write the 'ServiceDescription' object as a WSDL file. - myDescription->Write( "AddNumbersOut_cs.wsdl" ); - Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp deleted file mode 100644 index 72d797fd574..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// System.Web.Services.Description.SoapBinding.Namespace -// System.Web.Services.Description.SoapBodyBinding.Parts - -/* -The following example demonstrates the 'Namespace' field of 'SoapBinding' class -and 'parts' property of 'SoapBodyBinding' class. -It takes a wsdl file which supports two protocols 'HttpGet' and 'HttpPost' as input. By -using the 'Read' method of 'ServiceDescription' class it gets the 'ServiceDescription' -object. It uses the SOAP protocol related classes to create 'Binding' elements of -'SOAP' protocol. It adds all the elements to the 'ServiceDescription' object. The -'ServiceDescription' object creates another wsdl file which supports 'SOAP' protocol -also. This wsdl file is used to generate a proxy which is used by the .aspx file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myDescription = - ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); - // Create a 'Binding' object for the 'SOAP' protocol. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Service1Soap"; - XmlQualifiedName^ qualifiedName = - gcnew XmlQualifiedName( "s0:Service1Soap" ); - - myBinding->Type = qualifiedName; - -// - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - // Get the URI for XML namespace of the SoapBinding class. - String^ myNameSpace = SoapBinding::Namespace; - Console::WriteLine( "The URI of the XML Namespace is :{0}", myNameSpace ); -// - - // Add the 'SoapBinding' object to the 'Binding' object. - myBinding->Extensions->Add( mySoapBinding ); - - // Create the 'OperationBinding' object for the 'SOAP' protocol. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - - // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. - SoapOperationBinding^ mySoapOperationBinding = - gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - // Add the 'SoapOperationBinding' object to 'OperationBinding' object. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - -// - // Create the 'InputBinding' object for the 'SOAP' protocol. - InputBinding^ myInput = gcnew InputBinding; - SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; - mySoapBinding1->Use = SoapBindingUse::Literal; - - array^ myParts = gcnew array(1); - myParts[ 0 ] = "parameters"; - // Set the names of the message parts to appear in the SOAP body. - mySoapBinding1->Parts = myParts; - myInput->Extensions->Add( mySoapBinding1 ); - // Add the 'InputBinding' object to 'OperationBinding' object. - myOperationBinding->Input = myInput; - // Create the 'OutputBinding' object'. - OutputBinding^ myOutput = gcnew OutputBinding; - myOutput->Extensions->Add( mySoapBinding1 ); - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; -// - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "AddNumbersOut_cs.wsdl" ); - Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp deleted file mode 100644 index 406e0c2a195..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp +++ /dev/null @@ -1,173 +0,0 @@ - -// System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider.CreateSink -// System.Runtime.Remoting.Channels.BaseChannelSinkWithProperties -/* -The following example demonstrates the 'BaseChannelSinkWithProperties' -class and 'CreateSink' method of 'SoapClientFormatterSinkProvider' class. -Custom client formatter provider is defined by implementing -the 'IClientChannelSinkProvider' interface and custom channel sink is -defined by inheriting 'BaseChannelSinkWithProperties' abstract class. -The sink provider chain has the custom sink provider and -'SoapClientFormatterSinkProvider'. The 'CreateSink' method is used to -return a sink to the caller and form the sink chain which is used to process -the message being passed through it. -*/ -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Security::Permissions; - -public ref class MyKey{}; - -// -[SecurityPermission(SecurityAction::Demand, Flags = SecurityPermissionFlag::Infrastructure)] -private ref class MyClientFormatterChannelSink: public BaseChannelSinkWithProperties, public IClientChannelSink, public IMessageSink -{ -private: - IClientChannelSink^ nextClientSink; - IMessageSink^ nextMessageSink; - -public: - MyClientFormatterChannelSink() - : nextClientSink( nullptr ), nextMessageSink( nullptr ) - {} - - MyClientFormatterChannelSink( IClientChannelSink^ nextSink, IMessageSink^ nextMsgSink ) - : BaseChannelSinkWithProperties() - { - nextClientSink = nextSink; - nextMessageSink = nextMsgSink; - } - - virtual void ProcessMessage( IMessage^ message, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) - { - nextClientSink->ProcessMessage( message, requestHeaders, requestStream, responseHeaders, responseStream ); - } - - - - virtual void AsyncProcessRequest( IClientChannelSinkStack^ sinkStack, IMessage^ msg, ITransportHeaders^ headers, Stream^ myStream ) - { - sinkStack->Push( this, nullptr ); - nextClientSink->AsyncProcessRequest( sinkStack, msg, headers, myStream ); - } - - virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ sinkStack, Object^ /*state*/, ITransportHeaders^ headers, Stream^ myStream ) - { - sinkStack->AsyncProcessResponse( headers, myStream ); - } - - virtual Stream^ GetRequestStream( IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) - { - return nullptr; - } - - - property IClientChannelSink^ NextChannelSink - { - virtual IClientChannelSink^ get() - { - return nextClientSink; - } - - } - - property IMessageSink^ NextSink - { - virtual IMessageSink^ get() - { - return nextMessageSink; - } - - } - - virtual IMessageCtrl^ AsyncProcessMessage( IMessage^ /*msg*/, IMessageSink^ /*replySink*/ ) - { - return nullptr; - } - - virtual IMessage^ SyncProcessMessage( IMessage^ msg ) - { - return nextMessageSink->SyncProcessMessage( msg ); - } - - - property Object^ Item [Object^] - { - virtual Object^ get( Object^ key ) override - { - if ( key == MyKey::typeid ) - return this; - - return nullptr; - } - - virtual void set( Object^ /*value*/, Object^ /*key*/ ) override - { - throw gcnew NotSupportedException; - } - - } - - property ICollection^ Keys - { - virtual ICollection^ get() override - { - ArrayList^ myKeys = gcnew ArrayList( 1 ); - myKeys->Add( MyKey::typeid ); - return myKeys; - } - - } - -}; - - - -// -[SecurityPermission(SecurityAction::Demand, Flags = SecurityPermissionFlag::Infrastructure)] -public ref class MyClientFormatterProvider: public IClientChannelSinkProvider -{ -private: - IClientChannelSinkProvider^ nextProvider; - -public: - MyClientFormatterProvider() : nextProvider( nullptr ) {} - - virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ myUrl, Object^ remoteChannelData ) - { - // - IClientChannelSink^ nextSink = nullptr; - IMessageSink^ nextMsgSink = nullptr; - if ( nextProvider != nullptr ) - { - Console::WriteLine( "Next client sink provider is: {0}", nextProvider ); - - // Create a sink chain calling the next sink provider's - // 'CreateSink' method. - nextSink = nextProvider->CreateSink( channel, myUrl, remoteChannelData ); - nextMsgSink = dynamic_cast(nextSink); - } - // - return gcnew MyClientFormatterChannelSink( nextSink,nextMsgSink ); - } - - property IClientChannelSinkProvider^ Next - { - virtual IClientChannelSinkProvider^ get() - { - return nextProvider; - } - - virtual void set( IClientChannelSinkProvider^ value ) - { - nextProvider = value; - } - } -}; - - - diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp deleted file mode 100644 index 269324a7eaf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp +++ /dev/null @@ -1,270 +0,0 @@ - -// System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider.CreateSink -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Messaging; - -public ref class MyKey{}; - -private ref class MyClientChannelSink: public BaseChannelObjectWithProperties, public IClientChannelSink -{ -private: - IClientChannelSink^ nextClientSink; - -public: - MyClientChannelSink() - : nextClientSink( nullptr ) - {} - - MyClientChannelSink( IClientChannelSink^ nextSink ) - : BaseChannelObjectWithProperties() - { - nextClientSink = nextSink; - } - - MyClientChannelSink( IChannelSender^ /*channel*/, String^ /*url*/, Object^ /*remoteChannelData*/, IClientChannelSink^ nextSink ) - : BaseChannelObjectWithProperties() - { - nextClientSink = nextSink; - } - - virtual void ProcessMessage( IMessage^ msg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) - { - nextClientSink->ProcessMessage( msg, requestHeaders, requestStream, responseHeaders, responseStream ); - } - - virtual void AsyncProcessRequest( IClientChannelSinkStack^ sinkStack, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ) - { - sinkStack->Push( this, nullptr ); - nextClientSink->AsyncProcessRequest( sinkStack, msg, headers, stream ); - } - - virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ sinkStack, Object^ /*state*/, ITransportHeaders^ headers, Stream^ stream ) - { - sinkStack->AsyncProcessResponse( headers, stream ); - } - - virtual Stream^ GetRequestStream( IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) - { - return nullptr; - } - - - property IClientChannelSink^ NextChannelSink - { - virtual IClientChannelSink^ get() - { - return nextClientSink; - } - - } - - property Object^ Item [Object^] - { - virtual Object^ get( Object^ key ) override - { - if ( key == MyKey::typeid ) - return this; - - return nullptr; - } - - virtual void set( Object^ /*value*/, Object^ /*key*/ ) override - { - throw gcnew NotSupportedException; - } - - } - - property ICollection^ Keys - { - virtual ICollection^ get() override - { - ArrayList^ myKeys = gcnew ArrayList( 1 ); - myKeys->Add( MyKey::typeid ); - return myKeys; - } - } -}; - -[System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] -public ref class MyClientProvider: public IClientChannelSinkProvider -{ -private: - IClientChannelSinkProvider^ nextProvider; - -public: - MyClientProvider() - : nextProvider( nullptr ) - {} - - MyClientProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} - - virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ myUrl, Object^ remoteChannelData ) - { - IClientChannelSink^ nextSink = nullptr; - if ( nextProvider != nullptr ) - { - nextSink = nextProvider->CreateSink( channel, myUrl, remoteChannelData ); - if ( nextSink == nullptr ) - return nullptr; - } - - return gcnew MyClientChannelSink( nextSink ); - } - - property IClientChannelSinkProvider^ Next - { - virtual IClientChannelSinkProvider^ get() - { - return nextProvider; - } - - virtual void set( IClientChannelSinkProvider^ value ) - { - nextProvider = value; - } - } -}; - -private ref class MyServerChannelSink: public BaseChannelObjectWithProperties, public IServerChannelSink -{ -private: - IServerChannelSink^ nextServerSink; - -public: - MyServerChannelSink() - : nextServerSink( nullptr ) - {} - - MyServerChannelSink( IServerChannelSink^ nextSink ) - : BaseChannelObjectWithProperties() - { - nextServerSink = nextSink; - } - - MyServerChannelSink( IChannelReceiver^ /*channel*/, IServerChannelSink^ nextSink ) - : BaseChannelObjectWithProperties() - { - nextServerSink = nextSink; - } - - virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% msg, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) - { - sinkStack->Push( this, nullptr ); - ServerProcessing processing = nextServerSink->ProcessMessage( sinkStack, requestMsg, requestHeaders, requestStream, msg, responseHeaders, responseStream ); - switch ( processing ) - { - case ServerProcessing::Complete: - sinkStack->Pop( this ); - break; - - case ServerProcessing::OneWay: - sinkStack->Pop( this ); - break; - - case ServerProcessing::Async: - sinkStack->Store( this, nullptr ); - break; - } - return processing; - } - - virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ /*state*/, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ) - { - sinkStack->AsyncProcessResponse( msg, headers, stream ); - } - - virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) - { - return nullptr; - } - - property IServerChannelSink^ NextChannelSink - { - virtual IServerChannelSink^ get() - { - return nextServerSink; - } - - } - - property Object^ Item [Object^] - { - virtual Object^ get( Object^ key ) override - { - if ( key == MyKey::typeid ) - return this; - - return nullptr; - } - - virtual void set( Object^ /*value*/, Object^ /*key*/ ) override - { - throw gcnew NotSupportedException; - } - - } - - property ICollection^ Keys - { - virtual ICollection^ get() override - { - ArrayList^ myKeys = gcnew ArrayList( 1 ); - myKeys->Add( MyKey::typeid ); - return myKeys; - } - } -}; - -[System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] -public ref class MyServerProvider: public IServerChannelSinkProvider -{ -private: - IServerChannelSinkProvider^ nextProvider; - -public: - MyServerProvider() - : nextProvider( nullptr ) - {} - - MyServerProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} - - virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){} - - virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel ) - { - // - IServerChannelSink^ nextSink = nullptr; - if ( nextProvider != nullptr ) - { - Console::WriteLine( "The next server provider is:{0}", nextProvider ); - - // Create a sink chain calling the 'SaopServerFormatterProvider' - // 'CreateSink' method. - nextSink = nextProvider->CreateSink( channel ); - } - - return gcnew MyServerChannelSink( nextSink ); - // - } - - - property IServerChannelSinkProvider^ Next - { - virtual IServerChannelSinkProvider^ get() - { - return nextProvider; - } - - virtual void set( IServerChannelSinkProvider^ value ) - { - nextProvider = value; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp deleted file mode 100644 index 6a3351cd473..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp +++ /dev/null @@ -1,269 +0,0 @@ -// System.Web.Services.Protocols.SoapClientMessage -// System.Web.Services.Protocols.SoapClientMessage.Action -// System.Web.Services.Protocols.SoapClientMessage.Client -// System.Web.Services.Protocols.SoapClientMessage.MethodInfo -// System.Web.Services.Protocols.SoapClientMessage.OneWay -// System.Web.Services.Protocols.SoapClientMessage.Url - -/* -The following example demonstrates the 'Action', 'Client', 'MethodInfo', -'OneWay' and 'Url' properties of the 'SoapClientMessage' class. -It extends the 'SoapExtension' class to create a class that is used to -log the SOAP messages transferred for a web service method invocation. -To associate this 'SoapExtension' class with the web service method on -the client proxy, a class that extends from 'SoapExtensionAttribute' is -used. This 'SoapExtensionAttribute' is applied to a client proxy method -which is associated with a web service method. Whenever this method is -invoked on the client side all the SOAP message that get transfered both -from the client and the server(which is hosting the web service) are -written into a log file. -*/ - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -ref class MySoapExtension; -ref class MathSvc; - -// A SoapExtensionAttribute that can be associated with an -// XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class MySoapExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - - // Set the name of the log file where SOAP messages will be stored. - MySoapExtensionAttribute() - : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of MySoapExtension. - Type^ get() - { - return typeid; - } - } - - property int Priority - { - // User can set priority of the SoapExtension. - int get() - { - return myPriority; - } - void set( int value ) - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - void set( String^ value ) - { - myFilename = value; - } - } -}; - -public ref class MySoapExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // Return the filename that is to log the SOAP messages. - Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) - { - return (dynamic_cast(attribute))->Filename; - } - - // Return the filename that is to log the SOAP messages. - Object^ GetInitializer( Type^ filename ) - { - return dynamic_cast(filename); - } - - // Save the name of the log file that will save the SOAP messages. - void Initialize( Object^ initializer ) - { - filename = dynamic_cast(initializer); - } - -// - // Process the SOAP message received and write to a log file. - void ProcessMessage( SoapMessage^ message ) - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( dynamic_cast(message) ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( dynamic_cast(message) ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutput( SoapClientMessage^ message ) - { -// -// -// -// -// - newStream->Position = 0; - FileStream^ myFileStream = gcnew FileStream( filename, FileMode::Append, - FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( - "================================== Request at {0}", DateTime::Now ); - - // Print to the log file the request header field for SoapAction header. - myStreamWriter->WriteLine( "The SoapAction Http request header field is: " ); - myStreamWriter->WriteLine( "\t{0}", message->Action ); - - // Print to the log file the type of the client that invoked - // the XML Web service method. - myStreamWriter->WriteLine( "The type of the client is: " ); - if ( (message->Client->GetType())->Equals( typeid ) ) - { - myStreamWriter->WriteLine( "\tMathSvc" ); - } - - // Print to the log file the method invoked by the client. - myStreamWriter->WriteLine( - "The method that has been invoked by the client is:" ); - myStreamWriter->WriteLine( "\t{0}", message->MethodInfo->Name ); - - // Print to the log file if the method invoked is OneWay. - if ( message->OneWay ) - { - myStreamWriter->WriteLine( - "The client doesn't wait for the server to finish processing" ); - } - else - { - myStreamWriter->WriteLine( - "The client waits for the server to finish processing" ); - } - - // Print to the log file the URL of the site that provides - // implementation of the method. - myStreamWriter->WriteLine( - "The URL of the XML Web service method that has been requested is: " ); - myStreamWriter->WriteLine( "\t{0}", message->Url ); - myStreamWriter->WriteLine( "The contents of the SOAP envelope are: " ); - myStreamWriter->Flush(); - - // Copy the contents of one stream to another. - Copy( newStream, myFileStream ); - myFileStream->Close(); - newStream->Position = 0; - - // Copy the contents of one stream to another. - Copy( newStream, oldStream ); -// -// -// -// -// - } -// - - // Write the contents of the incoming SOAP message to the log file. - void WriteInput( SoapClientMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ myFileStream = gcnew FileStream( filename, FileMode::Append, - FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( - "---------------------------------- Response at {0}", DateTime::Now ); - myStreamWriter->Flush(); - newStream->Position = 0; - Copy( newStream, myFileStream ); - myFileStream->Close(); - newStream->Position = 0; - } - - // Return a new MemoryStream for SOAP processing. - Stream^ ChainStream( Stream^ stream ) - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - // Utility method to copy the contents of one stream to another. - void Copy( Stream^ fromStream, Stream^ toStream ) - { - TextReader^ myTextReader = gcnew StreamReader( fromStream ); - TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); - myTextWriter->WriteLine( myTextReader->ReadToEnd() ); - myTextWriter->Flush(); - } -}; - -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", - Namespace="http://tempuri.org/")] -public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ -public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathSvc() - { - this->Url = "http://localhost/MathSvc_SoapClientMessage.asmx"; - } - - [System::Web::Services::Protocols::SoapDocumentMethodAttribute( - "http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [MySoapExtensionAttribute] - Single Add( Single xValue, Single yValue ) - { - array^temp2 = {xValue,yValue}; - array^results = this->Invoke( "Add", temp2 ); - return safe_cast(results[ 0 ]); - } - - System::IAsyncResult^ BeginAdd( Single xValue, Single yValue, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^ temp3 = { xValue, yValue }; - return this->BeginInvoke( "Add", temp3, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return ( (Single)( results[ 0 ] ) ); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp deleted file mode 100644 index bbc969c59c5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp +++ /dev/null @@ -1,106 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Collections; -using namespace System::Xml; -using namespace System::Text; -public ref class Thing -{ -public: - - [SoapElement(IsNullable=true)] - String^ ThingName; -}; - -public ref class Transportation -{ -public: - - // The SoapElementAttribute specifies that the - // generated XML element name will be S"Wheels" - // instead of S"Vehicle". - - [SoapElement("Wheels")] - String^ Vehicle; - - [SoapElement(DataType="dateTime")] - DateTime CreationDate; - - [SoapElement(IsNullable=true)] - Thing^ thing; -}; - -public ref class Test -{ -public: - - // Return an XmlSerializer used for overriding. - XmlSerializer^ CreateSoapOverrider() - { - // Create the SoapAttributes and SoapAttributeOverrides objects. - SoapAttributes^ soapAttrs = gcnew SoapAttributes; - SoapAttributeOverrides^ soapOverrides = gcnew SoapAttributeOverrides; - - // Create an SoapElementAttribute to the Vehicles property. - SoapElementAttribute^ soapElement1 = gcnew SoapElementAttribute( "Truck" ); - - // Set the SoapElement to the Object*. - soapAttrs->SoapElement = soapElement1; - - // Add the SoapAttributes to the SoapAttributeOverrides,specifying the member to. - soapOverrides->Add( Transportation::typeid, "Vehicle", soapAttrs ); - - // Create the XmlSerializer, and return it. - XmlTypeMapping^ myTypeMapping = (gcnew SoapReflectionImporter( soapOverrides ))->ImportTypeMapping( Transportation::typeid ); - return gcnew XmlSerializer( myTypeMapping ); - } - - void SerializeOverride( String^ filename ) - { - // Create an XmlSerializer instance. - XmlSerializer^ ser = CreateSoapOverrider(); - - // Create the Object* and serialize it. - Transportation^ myTransportation = gcnew Transportation; - myTransportation->Vehicle = "MyCar"; - myTransportation->CreationDate = DateTime::Now; - myTransportation->thing = gcnew Thing; - XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); - writer->Formatting = Formatting::Indented; - writer->WriteStartElement( "wrapper" ); - ser->Serialize( writer, myTransportation ); - writer->WriteEndElement(); - writer->Close(); - } - - void SerializeObject( String^ filename ) - { - // Create an XmlSerializer instance. - XmlSerializer^ ser = gcnew XmlSerializer( Transportation::typeid ); - Transportation^ myTransportation = gcnew Transportation; - myTransportation->Vehicle = "MyCar"; - myTransportation->CreationDate = DateTime::Now; - myTransportation->thing = gcnew Thing; - XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); - writer->Formatting = Formatting::Indented; - writer->WriteStartElement( "wrapper" ); - ser->Serialize( writer, myTransportation ); - writer->WriteEndElement(); - writer->Close(); - } -}; - -int main() -{ - Test^ t = gcnew Test; - t->SerializeObject( "SoapElementOriginal.xml" ); - t->SerializeOverride( "SoapElementOverride.xml" ); - Console::WriteLine( "Finished writing two XML files." ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp deleted file mode 100644 index a91c48a0ab8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp +++ /dev/null @@ -1,94 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public enum class GroupType -{ - // Use the SoapEnumAttribute to instruct the XmlSerializer - // to generate Small and Large instead of A and B. - [SoapEnum("Small")] - A, - [SoapEnum("Large")] - B -}; - -public ref class Group -{ -public: - String^ GroupName; - GroupType Grouptype; -}; - -public ref class Run -{ -public: - void SerializeObject( String^ filename ) - { - // Create an instance of the XmlSerializer Class. - XmlTypeMapping^ mapp = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); - XmlSerializer^ mySerializer = gcnew XmlSerializer( mapp ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an instance of the Class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the Object* properties. - myGroup->GroupName = ".NET"; - myGroup->Grouptype = GroupType::A; - - // Serialize the Class, and close the TextWriter. - mySerializer->Serialize( writer, myGroup ); - writer->Close(); - } - - void SerializeOverride( String^ fileName ) - { - SoapAttributeOverrides^ soapOver = gcnew SoapAttributeOverrides; - SoapAttributes^ SoapAtts = gcnew SoapAttributes; - - // Add a SoapEnumAttribute for the GroupType::A enumerator. - // Instead of 'A' it will be S"West". - SoapEnumAttribute^ soapEnum = gcnew SoapEnumAttribute( "West" ); - - // Override the S"A" enumerator. - SoapAtts->GroupType::SoapEnum = soapEnum; - soapOver->Add( GroupType::typeid, "A", SoapAtts ); - - // Add another SoapEnumAttribute for the GroupType::B enumerator. - // Instead of //B// it will be S"East". - SoapAtts = gcnew SoapAttributes; - soapEnum = gcnew SoapEnumAttribute; - soapEnum->Name = "East"; - SoapAtts->GroupType::SoapEnum = soapEnum; - soapOver->Add( GroupType::typeid, "B", SoapAtts ); - - // Create an XmlSerializer used for overriding. - XmlTypeMapping^ map = (gcnew SoapReflectionImporter( soapOver ))->ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( map ); - Group^ myGroup = gcnew Group; - myGroup->GroupName = ".NET"; - myGroup->Grouptype = GroupType::B; - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( fileName ); - ser->Serialize( writer, myGroup ); - writer->Close(); - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeObject( "SoapEnum.xml" ); - test->SerializeOverride( "SoapOverride.xml" ); - Console::WriteLine( "Fininished writing two files" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp deleted file mode 100644 index f4f244fd8fe..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#using - -using namespace System; -using namespace System::Web::Services; -using namespace System::Web::Services::Protocols; -using namespace System::IO; - -ref class TraceExtension; - -// Create a SoapExtensionAttribute for our SOAP Extension that can be -// applied to an XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ filename; // = "c:\\log.txt"; - int priority; - -public: - property Type^ ExtensionType - { - virtual Type^ get() override - { - return TraceExtension::typeid; - } - } - - property int Priority - { - virtual int get() override - { - return priority; - } - virtual void set( int value ) override - { - priority = value; - } - } - - property String^ Filename - { - String^ get() - { - return filename; - } - void set( String^ value ) - { - filename = value; - } - } -}; - -// Define a SOAP Extension that traces the SOAP request and SOAP response -// for the XML Web service method, the SOAP extension is applied to. -public ref class TraceExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // When the SOAP extension is accessed for the first time the XML Web service method it is applied - // is accessed store the file name passed in using the corresponding SoapExtensionAttribute. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override - { - return ( (TraceExtensionAttribute^)( attribute ) )->Filename; - } - -// - // The extension was configured to run using a configuration file instead of an attribute applied to a - // specific XML Web service method. Return a file name based on the class implementing the XML Web service's type. -public: - virtual Object^ GetInitializer( Type^ WebServiceType ) override - { - // Return a file name to log the trace information to based on the passed in type. - return String::Format( "C:\\{0}.log", WebServiceType->FullName ); - } -// - - // Receive the filename stored by GetInitializer and store it in a member variable - // for this specific instance. - virtual void Initialize( Object^ initializer ) override - { - filename = (String^)( initializer ); - } - - // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP - // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - - case SoapMessageStage::AfterDeserialize: - break; - - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Save the Stream representing the SOAP request or SOAP response into a local memory buffer - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - void WriteOutput( SoapMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); - w->Flush(); - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - void WriteInput( SoapMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - w->WriteLine( "================================== Request at {0}", DateTime::Now ); - w->Flush(); - newStream->Position = 0; - Copy( newStream, fs ); - fs->Close(); - newStream->Position = 0; - } - - void Copy( Stream^ from, Stream^ to ) - { - TextReader^ reader = gcnew StreamReader( from ); - TextWriter^ writer = gcnew StreamWriter( to ); - writer->WriteLine( reader->ReadToEnd() ); - writer->Flush(); - } -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp deleted file mode 100644 index 8084a230596..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp +++ /dev/null @@ -1,230 +0,0 @@ -// System.Web.Services.Protocols.SoapExtensionAttribute -// System.Web.Services.Protocols.SoapExtensionAttribute.ExtensionType -// System.Web.Services.Protocols.SoapExtensionAttribute.Priority - -/* -The following example demonstrates the 'ExtensionType' -and 'Priority' attribute of the 'SoapExtensionAttribute' class. -The program extends the 'SoapExtension' class to create a class -that is used to log the SOAP messages transferred for a web service -method invocation. To associate this 'SoapExtension' class with the -web service method on the client proxy, a class that extends from -'SoapExtensionAttribute' is used. This 'SoapExtensionAttribute' -is applied to a client proxy method which is associated with a -web service method. Whenever this method is invoked on the client -side all the SOAP message that get transffered both from the client -and the server(which is hosting the web service) are written into -a log file. -*/ - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -ref class TraceExtension; - -// -// A SoapExtensionAttribute that can be associated with an -// XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class TraceExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - // Set the name of the log file where SOAP messages will be stored. - TraceExtensionAttribute() : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - // - // Return the type of TraceExtension. - property Type^ ExtensionType - { - Type^ get() - { - return typeid; - } - } - // - - // - // User can set priority of the SoapExtension. - property int Priority - { - int get() - { - return myPriority; - } - void set( int value ) - { - myPriority = value; - } - - } - // - - property String^ Filename - { - String^ get() - { - return myFilename; - } - void set( String^ value ) - { - myFilename = value; - } - } -}; -// - -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",Namespace="http://tempuri.org/")] -public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ -public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathSvc() - { - this->Url = "http://localhost/MathSvc_SoapExtensionAttribute.asmx"; - } - - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [TraceExtension] - Single Add( Single xValue, Single yValue ) - { - array^ temp0 = { xValue, yValue }; - array^ results = this->Invoke( "Add", temp0 ); - return ( (Single)( results[ 0 ] ) ); - } - - System::IAsyncResult^ BeginAdd( Single xValue, - Single yValue, - System::AsyncCallback^ callback, - Object^ asyncState ) - { - array^ temp1 = { xValue, yValue }; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult ) - { - array^ results = this->EndInvoke( asyncResult ); - return ( (Single)( results[ 0 ] ) ); - } -}; - -// Define a SOAP Extension that traces the SOAP request and SOAP -// response for the XML Web service method the SOAP extension is -// applied to. -public ref class TraceExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // Save the Stream representing the SOAP request or SOAP response into - // a local memory buffer. - Stream^ ChainStream( Stream^ stream ) - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - // When the SOAP extension is accessed for the first time, the XML Web - // service method it is applied to is accessed to store the file - // name passed in, using the corresponding SoapExtensionAttribute. - Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) - { - return ( (TraceExtensionAttribute^)( attribute ) )->Filename; - } - - // The SOAP extension was configured to run using a configuration file - // instead of an attribute applied to a specific XML Web service - // method. - Object^ GetInitializer( Type^ WebServiceType ) - { - // Return a file name to log the trace information to, based on the - // type. - return String::Format( "C:\\{0}.log", WebServiceType->FullName ); - } - - // Receive the file name stored by GetInitializer and store it in a - // member variable for this specific instance. - void Initialize( Object^ initializer ) - { - filename = (String^)( initializer ); - } - - // If the SoapMessageStage is such that the SoapRequest or - // SoapResponse is still in the SOAP format to be sent or received, - // save it out to a file. - void ProcessMessage( SoapMessage^ message ) - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - void WriteOutput( SoapMessage^ message ) - { - newStream->Position = 0; - FileStream^ fs = gcnew FileStream( filename, FileMode::Append, - FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - - String^ soapString = ( (SoapServerMessage^)( message ) ) ? (String^)"SoapResponse" : "SoapRequest"; - w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); - w->Flush(); - Copy( newStream, fs ); - w->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - void WriteInput( SoapMessage^ message ) - { - Copy( oldStream, newStream ); - FileStream^ fs = gcnew FileStream( filename, FileMode::Append, - FileAccess::Write ); - StreamWriter^ w = gcnew StreamWriter( fs ); - String^ soapString = ( (SoapServerMessage^)( message ) ) ? - (String^)"SoapRequest" : "SoapResponse"; - w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); - w->Flush(); - newStream->Position = 0; - Copy( newStream, fs ); - w->Close(); - newStream->Position = 0; - } - - void Copy( Stream^ from, Stream^ to ) - { - TextReader^ reader = gcnew StreamReader( from ); - TextWriter^ writer = gcnew StreamWriter( to ); - writer->WriteLine( reader->ReadToEnd() ); - writer->Flush(); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp deleted file mode 100644 index cd2422d09e2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// System::Web::Services::Description.SoapFaultBinding - -/* -The following example demonstrates 'SoapFaultBinding' class. -It creates an instance of 'ServiceDescription' class by reading an existing -wsdl file. Then it creates an instance of 'SoapFaultBinding' and adds it to -the collection object of 'Binding' class. It generates a new wsdl file where -the properties of 'SoapFaultBinding' objects are reflected and which could be -used for generating a proxy. -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - try - { - // Input wsdl file. - String^ myInputWsdlFile = "SoapFaultBindingInput_cpp.wsdl"; - - // Output wsdl file. - String^ myOutputWsdlFile = "SoapFaultBindingOutput_cpp.wsdl"; - - // Initialize an instance of a 'ServiceDescription' object. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( myInputWsdlFile ); - - // Get a SOAP binding object with binding name S"MyService1Soap". - Binding^ myBinding = myServiceDescription->Bindings[ "MyService1Soap" ]; - - // Create a new instance of 'SoapFaultBinding' class. - SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; - - // Encode fault message using rules specified by 'Encoding' property. - mySoapFaultBinding->Use = SoapBindingUse::Encoded; - - // Set the URI representing the encoding style. - mySoapFaultBinding->Encoding = "http://tempuri.org/stockquote"; - - // Set the URI representing the location of the specification - // for encoding of content not defined by 'Encoding' property'. - mySoapFaultBinding->Namespace = "http://tempuri.org/stockquote"; - - // Create a new instance of 'FaultBinding'. - FaultBinding^ myFaultBinding = gcnew FaultBinding; - myFaultBinding->Name = "AddFaultbinding"; - myFaultBinding->Extensions->Add( mySoapFaultBinding ); - - // Get existing 'OperationBinding' object. - OperationBinding^ myOperationBinding = myBinding->Operations[ 0 ]; - myOperationBinding->Faults->Add( myFaultBinding ); - - // Create a new wsdl file. - myServiceDescription->Write( myOutputWsdlFile ); - Console::WriteLine( "The new wsdl file created is : {0}", myOutputWsdlFile ); - Console::WriteLine( "Proxy could be created using command : wsdl {0}", myOutputWsdlFile ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error occurred : {0}", e->Message ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp deleted file mode 100644 index 0c69f5c1ea8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp +++ /dev/null @@ -1,110 +0,0 @@ -// System::Web::Services::Description.SoapBodyBinding::PartsString -// System::Web::Services::Description.SoapFaultBinding::ctor -// System::Web::Services::Description.SoapFaultBinding::Use -// System::Web::Services::Description.SoapFaultBinding::Encoding -// System::Web::Services::Description.SoapFaultBinding::NameSpace - -/* -The following example demonstrates the 'PartsString' property of 'SoapBodyBinding' class -and constructor, 'Encoding', 'NameSpace' and 'Use'properties of 'SoapFaultBinding' class. - -It creates an instance of 'ServiceDescription' class by reading an existing -wsdl file. Then it creates an instance of 'SoapFaultBinding' and adds it to -the collection object of 'Binding' class. It generates a new wsdl file where -the properties of 'SoapFaultBinding' objects are reflected and which could be -used for generating a proxy. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -int main() -{ - try - { - // Input wsdl file. - String^ myInputWsdlFile = "SoapFaultInput_cpp.wsdl"; - - // Output wsdl file. - String^ myOutputWsdlFile = "SoapFaultOutput_cpp.wsdl"; - - // Initialize an instance of a 'ServiceDescription' object. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( myInputWsdlFile ); - - // Get a SOAP binding object with binding name S"MyService1Soap". - Binding^ myBinding = myServiceDescription->Bindings[ "MyService1Soap" ]; - - // Create the 'OperationBinding' object for the 'SOAP' protocol. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "Add"; - - // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = "http://tempuri.org/Add"; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - - // Add the 'SoapOperationBinding' object to 'OperationBinding' object. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - - // - // Create the 'InputBinding' object for the 'SOAP' protocol. - InputBinding^ myInput = gcnew InputBinding; - SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; - mySoapBinding1->PartsString = "parameters"; - mySoapBinding1->Use = SoapBindingUse::Literal; - myInput->Extensions->Add( mySoapBinding1 ); - - // Assign the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInput; - - // Create the 'OutputBinding' object' for the 'SOAP' protocol.. - OutputBinding^ myOutput = gcnew OutputBinding; - myOutput->Extensions->Add( mySoapBinding1 ); - - // Assign the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - // - - // - // - // - // - // Create a new instance of 'SoapFaultBinding' class. - SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; - - // Encode fault message using rules specified by 'Encoding' property. - mySoapFaultBinding->Use = SoapBindingUse::Encoded; - - // Set the URI representing the encoding style. - mySoapFaultBinding->Encoding = "http://tempuri.org/stockquote"; - - // Set the URI representing the location of the specification - // for encoding of content not defined by 'Encoding' property'. - mySoapFaultBinding->Namespace = "http://tempuri.org/stockquote"; - - // Create a new instance of 'FaultBinding'. - FaultBinding^ myFaultBinding = gcnew FaultBinding; - myFaultBinding->Name = "AddFaultbinding"; - myFaultBinding->Extensions->Add( mySoapFaultBinding ); - - // Get existing 'OperationBinding' object. - myOperationBinding->Faults->Add( myFaultBinding ); - myBinding->Operations->Add( myOperationBinding ); - - // - // - // - // - // Create a new wsdl file. - myServiceDescription->Write( myOutputWsdlFile ); - Console::WriteLine( "The new wsdl file created is : {0}", myOutputWsdlFile ); - Console::WriteLine( "Proxy could be created using command : wsdl {0}", myOutputWsdlFile ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Error occurred : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp deleted file mode 100644 index 8a4e741d33b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Collections; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Soap; -void Serialize() -{ - - // Create a hashtable of values that will eventually be serialized. - Hashtable^ addresses = gcnew Hashtable; - addresses->Add( "Jeff", "123 Main Street, Redmond, WA 98052" ); - addresses->Add( "Fred", "987 Pine Road, Phila., PA 19116" ); - addresses->Add( "Mary", "PO Box 112233, Palo Alto, CA 94301" ); - - // To serialize the hashtable (and its keys/values), - // you must first open a stream for writing. - // We will use a file stream here. - FileStream^ fs = gcnew FileStream( "DataFile.soap",FileMode::Create ); - - // Construct a SoapFormatter and use it - // to serialize the data to the stream. - SoapFormatter^ formatter = gcnew SoapFormatter; - try - { - formatter->Serialize( fs, addresses ); - } - catch ( SerializationException^ e ) - { - Console::WriteLine( "Failed to serialize. Reason: {0}", e->Message ); - throw; - } - finally - { - fs->Close(); - } - -} - -void Deserialize() -{ - - // Declare the hashtable reference. - Hashtable^ addresses = nullptr; - - // Open the file containing the data that we want to deserialize. - FileStream^ fs = gcnew FileStream( "DataFile.soap",FileMode::Open ); - try - { - SoapFormatter^ formatter = gcnew SoapFormatter; - - // Deserialize the hashtable from the file and - // assign the reference to our local variable. - addresses = dynamic_cast(formatter->Deserialize( fs )); - } - catch ( SerializationException^ e ) - { - Console::WriteLine( "Failed to deserialize. Reason: {0}", e->Message ); - throw; - } - finally - { - fs->Close(); - } - - - // To prove that the table deserialized correctly, - // display the keys/values to the console. - IEnumerator^ myEnum = addresses->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DictionaryEntry^ de = safe_cast(myEnum->Current); - Console::WriteLine( " {0} lives at {1}.", de->Key, de->Value ); - } -} - - -[STAThread] -int main() -{ - Serialize(); - Deserialize(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp deleted file mode 100644 index ff5d56ef650..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System::Web::Services::Description.SoapHeaderBinding - -/* -The following example demonstrates the class 'SoapHeaderBinding'. -It takes as input a wsdl file. By using the 'Read' method -of 'ServiceDescription' class it gets a 'ServiceDescription' object. -It uses the SOAP protocol related classes and creates 'Binding' element -of 'SOAP' protocol which are then added to the 'ServiceDescription' object. -An output wsdl file is generated from 'ServiceDescription' object which -could be used for generating a proxy. - -*/ - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" ); - Binding^ myBinding = gcnew Binding; - myBinding->Name = "MyWebServiceSoap"; - myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" ); - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - myBinding->Extensions->Add( mySoapBinding ); - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "Hello"; - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello"; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - - // Create InputBinding for operation for the 'SOAP' protocol. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding; - mySoapHeaderBinding->Message = gcnew XmlQualifiedName( "s0:HelloMyHeader" ); - mySoapHeaderBinding->Part = "MyHeader"; - mySoapHeaderBinding->Use = SoapBindingUse::Literal; - - // Add mySoapHeaderBinding to 'myInputBinding' object. - myInputBinding->Extensions->Add( mySoapHeaderBinding ); - - // Create OutputBinding for operation for the 'SOAP' protocol. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - myBinding->Operations->Add( myOperationBinding ); - myServiceDescription->Bindings->Add( myBinding ); - myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" ); - Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." ); - Console::WriteLine( "Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'." ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp deleted file mode 100644 index 094bfdc3008..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// System::Web::Services::Description.SoapHeaderBinding::MapToProperty - -/* -The following example demonstrates the 'MapToProperty' property of class 'SoapHeaderBinding'. -It reads an existing wsdl file and gets 'SoapHeaderBinding' instance from it. -'MapToProperty' property of this instance is checked to see whether this instance -is mapped to a specific property in proxy class or not. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; - -int main() -{ - // - // Read from an existing wsdl file. - ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MapToProperty_cpp.wsdl" ); - - // Get the existing binding - Binding^ myBinding = myServiceDescription->Bindings[ "MyWebServiceSoap" ]; - OperationBinding^ myOperationBinding = (OperationBinding^)(myBinding->Operations[ 0 ]); - InputBinding^ myInputBinding = myOperationBinding->Input; - - // Get the 'SoapHeaderBinding' instance from 'myInputBinding'. - SoapHeaderBinding^ mySoapHeaderBinding = (SoapHeaderBinding^)(myInputBinding->Extensions[ 1 ]); - if ( mySoapHeaderBinding->MapToProperty ) - Console::WriteLine( "'SoapHeaderBinding' instance is mapped to a specific property in proxy generated class" ); - else - Console::WriteLine( "'SoapHeaderBinding' instance is not mapped to a specific property in proxy generated class" ); - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp deleted file mode 100644 index 0223ff8c500..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// System::Web::Services::Description.SoapHeaderBinding::ctor -// System::Web::Services::Description.SoapHeaderBinding::Message -// System::Web::Services::Description.SoapHeaderBinding::Part -// System::Web::Services::Description.SoapHeaderBinding::Use - -/* -The following example demonstrates the constructor, 'Message' , 'Part' -and 'Use' properties of the class 'SoapHeaderBinding'. -It takes as input a wsdl file. The binding element corresponding to -SOAP protocol is removed from the input file. By using the 'Read' method -of 'ServiceDescription' class it gets a 'ServiceDescription' Object*. -It uses the SOAP protocol related classes and creates 'Binding' element -of 'SOAP' protocol which are then added to the 'ServiceDescription' Object*. -An output wsdl file is generated from 'ServiceDescription' Object* which -could be used for generating a proxy. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Web::Services::Description; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myServiceDescription = - ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" ); - Binding^ myBinding = gcnew Binding; - myBinding->Name = "MyWebServiceSoap"; - myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" ); - - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; - mySoapBinding->Style = SoapBindingStyle::Document; - myBinding->Extensions->Add( mySoapBinding ); - - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "Hello"; - - SoapOperationBinding^ mySoapOperationBinding = - gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello"; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - - // Create InputBinding for operation for the 'SOAP' protocol. - InputBinding^ myInputBinding = gcnew InputBinding; - SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; - mySoapBodyBinding->Use = SoapBindingUse::Literal; - myInputBinding->Extensions->Add( mySoapBodyBinding ); - -// -// -// -// - SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding; - // Set the Message within the XML Web service to which the - // 'SoapHeaderBinding' applies. - mySoapHeaderBinding->Message = - gcnew XmlQualifiedName( "s0:HelloMyHeader" ); - mySoapHeaderBinding->Part = "MyHeader"; - mySoapHeaderBinding->Use = SoapBindingUse::Literal; - // Add mySoapHeaderBinding to the 'myInputBinding' object. - myInputBinding->Extensions->Add( mySoapHeaderBinding ); -// -// -// -// - - // Create OutputBinding for operation for the 'SOAP' protocol. - OutputBinding^ myOutputBinding = gcnew OutputBinding; - myOutputBinding->Extensions->Add( mySoapBodyBinding ); - - // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInputBinding; - myOperationBinding->Output = myOutputBinding; - myBinding->Operations->Add( myOperationBinding ); - - myServiceDescription->Bindings->Add( myBinding ); - myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" ); - Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." ); - Console::WriteLine( "Proxy could be created using " + - "'wsdl SoapHeaderBindingOut_cpp.wsdl'." ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp deleted file mode 100644 index c751b8d2631..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp +++ /dev/null @@ -1,257 +0,0 @@ -// System.Web.Services.Protocols.SoapHeaderCollection -// System.Web.Services.Protocols.SoapHeaderCollection.SoapHeaderCollection() -// System.Web.Services.Protocols.SoapHeaderCollection.Add(SoapHeader) -// System.Web.Services.Protocols.SoapHeaderCollection.Insert(int, SoapHeader) -// System.Web.Services.Protocols.SoapHeaderCollection.CopyTo(SoapHeader[], int) -// System.Web.Services.Protocols.SoapHeaderDirection.In - -/* - The following example demonstrates various members of the - SoapHeaderCollection class and the In member of the SoapHeaderDirection - enumeration. The program extends the SoapExtension class to create a - class that is used to log the SOAP messages transferred for an XML Web - service method invocation. Whenever this method is invoked on the client - side, all the SOAP message that are transfered both from the client and - the server are written to a log file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -ref class MySoapExtension; - -// A SoapExtensionAttribute that can be associated with an -// XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class MySoapExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - - // Set the name of the log file where SOAP messages will be stored. - MySoapExtensionAttribute() - : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of MySoapExtension. - virtual Type^ get() override - { - return MySoapExtension::typeid; - } - } - - property int Priority - { - // User can set priority of the SoapExtension. - virtual int get() override - { - return myPriority; - } - - virtual void set( int value ) override - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - - void set( String^ value ) - { - myFilename = value; - } - } -}; - -public ref class MySoapHeader: public SoapHeader -{ -public: - String^ text; -}; - -// -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", - Namespace="http://tempuri.org/")] -public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ - // -public: - array^ mySoapHeaders; - - [SoapHeaderAttribute("mySoapHeaders", - Direction=SoapHeaderDirection::In)] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute( - "http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [MySoapExtensionAttribute] - Single Add( Single xValue, Single yValue ) - { - // - SoapHeaderCollection^ mySoapHeaderCollection = gcnew SoapHeaderCollection; - MySoapHeader^ mySoapHeader; - mySoapHeader = gcnew MySoapHeader; - mySoapHeader->text = "This is the first SOAP header"; - mySoapHeaderCollection->Add( mySoapHeader ); - // - - // - mySoapHeader = gcnew MySoapHeader; - mySoapHeader->text = "This is the second SOAP header"; - mySoapHeaderCollection->Add( mySoapHeader ); - // - - // - mySoapHeader = gcnew MySoapHeader; - mySoapHeader->text = "This header is inserted before the first header"; - mySoapHeaderCollection->Insert( 0, mySoapHeader ); - // - - // - mySoapHeaders = gcnew array(mySoapHeaderCollection->Count); - mySoapHeaderCollection->CopyTo( mySoapHeaders, 0 ); - // - - array^ temp0 = {xValue,yValue}; - array^ results = this->Invoke( "Add", temp0 ); - return ( (Single)( results[ 0 ] ) ); - } - // - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathSvc() - { - this->Url = "http://localhost/MathSvc_SoapHeaderCollection.cs.asmx"; - } - - System::IAsyncResult^ BeginAdd( Single xValue, - Single yValue, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^ temp1 = {xValue,yValue}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult ) - { - array^ results = this->EndInvoke( asyncResult ); - return ( (Single)( results[ 0 ] ) ); - } -}; -// - -public ref class MySoapExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // Return the file name that is to log the SOAP messages. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, - SoapExtensionAttribute^ attribute ) override - { - return ( (MySoapExtensionAttribute^)( attribute ) )->Filename; - } - - // Return the file name that is to log the SOAP messages. - virtual Object^ GetInitializer( Type^ filename ) override - { - return (Type^)( filename ); - } - - // Save the name of the log file that will save the SOAP messages. - virtual void Initialize( Object^ initializer ) override - { - filename = (String^)( initializer ); - } - - // Process the SOAP message received and write it to the log file. - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( (SoapClientMessage^)( message ) ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( (SoapClientMessage^)( message ) ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutput( SoapClientMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "================================== Request at {0}", - DateTime::Now ); - myStreamWriter->Flush(); - Copy( newStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - // Write the contents of the incoming SOAP message to the log file. - void WriteInput( SoapClientMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "---------------------------------- Response at {0}", - DateTime::Now ); - myStreamWriter->Flush(); - newStream->Position = 0; - Copy( newStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - newStream->Position = 0; - } - - // Return a new MemoryStream for SOAP processing. - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - // Utility method to copy the contents of one stream to another. - void Copy( Stream^ fromStream, Stream^ toStream ) - { - TextReader^ myTextReader = gcnew StreamReader( fromStream ); - TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); - myTextWriter->WriteLine( myTextReader->ReadToEnd() ); - myTextWriter->Flush(); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp deleted file mode 100644 index fd58130e9f3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// System.Web.Services.Protocols.SoapHeaderCollection.Contains(SoapHeader); System.Web.Services.Protocols.SoapHeaderCollection.IndexOf(); System.Web.Services.Protocols.SoapHeaderCollection.Item; System.Web.Services.Protocols.SoapHeaderCollection.Remove(SoapHeader) - -/* -The following example demonstrates the methods 'Contains','IndexOf' and -'Remove' and the property 'Item' of the 'SoapHeaderCollection' class. The -program extends the 'SoapExtension' class to create a class that is -used to log the SOAP messages transferred for a web service method -invocation. Whenever this method is invoked on the client side -all the SOAP message that get transfered both from the client -and the server are written into a log file. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; -using namespace System::Xml; - -ref class MySoapExtension; - -// A 'SoapExtensionAttribute' that can be associated with web service method. - -[AttributeUsage(AttributeTargets::Method)] -public ref class MySoapExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - - // Set the name of the log file were SOAP messages will be stored. - MySoapExtensionAttribute() - : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of 'MySoapExtension' class. - virtual Type^ get() override - { - return MySoapExtension::typeid; - } - } - - property int Priority - { - // User can set priority of the 'SoapExtension'. - virtual int get() override - { - return myPriority; - } - - virtual void set( int value ) override - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - - void set( String^ value ) - { - myFilename = value; - } - - } - -}; - -public ref class MySoapHeader: public SoapHeader -{ -public: - String^ Text; -}; - -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",Namespace="http://tempuri.org/")] -public ref class MathService: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ -public: - array^mySoapHeaders; - - [SoapHeaderAttribute("mySoapHeaders",Direction=SoapHeaderDirection::In,Required=false)] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [MySoapExtensionAttribute] - Single Add( Single xValue, Single yValue ) - { - SoapHeaderCollection^ mySoapHeaderCollection = gcnew SoapHeaderCollection; - MySoapHeader^ myFirstSoapHeader; - myFirstSoapHeader = gcnew MySoapHeader; - myFirstSoapHeader->Text = "This is the first soap header"; - mySoapHeaderCollection->Add( myFirstSoapHeader ); - MySoapHeader^ mySecondSoapHeader = gcnew MySoapHeader; - mySecondSoapHeader->Text = "This is the second soap header"; - mySoapHeaderCollection->Add( mySecondSoapHeader ); - - // - // Check to see whether the collection contains mySecondSoapHeader. - if ( mySoapHeaderCollection->Contains( mySecondSoapHeader ) ) - { - // Get the index of mySecondSoapHeader from the collection. - Console::WriteLine( "Index of mySecondSoapHeader: {0}", mySoapHeaderCollection->IndexOf( mySecondSoapHeader ) ); - - // Get the SoapHeader from the collection. - MySoapHeader^ mySoapHeader1 = dynamic_cast(mySoapHeaderCollection[ mySoapHeaderCollection->IndexOf( mySecondSoapHeader ) ]); - Console::WriteLine( "SoapHeader retrieved from the collection: {0}", mySoapHeader1 ); - - // Remove a SoapHeader from the collection. - mySoapHeaderCollection->Remove( mySoapHeader1 ); - Console::WriteLine( "Number of items after removal: {0}", mySoapHeaderCollection->Count ); - } - else - Console::WriteLine( "mySoapHeaderCollection does not contain mySecondSoapHeader." ); - // - - mySoapHeaders = gcnew array(mySoapHeaderCollection->Count); - mySoapHeaderCollection->CopyTo( mySoapHeaders, 0 ); - array^temp0 = {xValue,yValue}; - array^results = this->Invoke( "Add", temp0 ); - return safe_cast(results[ 0 ]); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathService() - { - this->Url = "http://localhost/MathService_SoapHeaderCollection.cs.asmx"; - } - - System::IAsyncResult^ BeginAdd( Single xValue, Single yValue, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {xValue,yValue}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return safe_cast(results[ 0 ]); - } - -}; - -public ref class MySoapExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ myFilename; - -public: - - // Return the filename that is to log the SOAP messages. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ myAttribute ) override - { - return (dynamic_cast(myAttribute))->Filename; - } - - // Return the filename that is to log the SOAP messages. - virtual Object^ GetInitializer( Type^ myFilename ) override - { - return dynamic_cast(myFilename); - } - - // Save the name of the log file that shall save the SOAP messages. - virtual void Initialize( Object^ initializer ) override - { - myFilename = dynamic_cast(initializer); - } - - // Process the SOAP message received and write to log file. - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - - case SoapMessageStage::AfterSerialize: - WriteOutput( dynamic_cast(message) ); - break; - - case SoapMessageStage::BeforeDeserialize: - WriteInput( dynamic_cast(message) ); - break; - - case SoapMessageStage::AfterDeserialize: - break; - - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutput( SoapClientMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ myFileStream = gcnew FileStream( myFilename,FileMode::Append,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "================================== Request at {0}", DateTime::Now ); - myStreamWriter->Flush(); - Copy( newStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - // Write the contents of the incoming SOAP message to the log file. - void WriteInput( SoapClientMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ myFileStream = gcnew FileStream( myFilename,FileMode::Append,FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); - myStreamWriter->Flush(); - newStream->Position = 0; - Copy( newStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - newStream->Position = 0; - } - - // Return a new 'MemoryStream' instance for SOAP processing. - virtual Stream^ ChainStream( Stream^ myStream ) override - { - oldStream = myStream; - newStream = gcnew MemoryStream; - return newStream; - } - - // Utility method to copy the contents of one stream to another. - void Copy( Stream^ fromStream, Stream^ toStream ) - { - TextReader^ myTextReader = gcnew StreamReader( fromStream ); - TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); - myTextWriter->WriteLine( myTextReader->ReadToEnd() ); - myTextWriter->Flush(); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp deleted file mode 100644 index fa98d114ffe..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// System.Web.Services.Protocols.SoapHeader.EncodedMustUnderstand -/* -This program demonstrates the 'EncodedMustUnderstand' property of -the 'SoapHeader' class. This example calls two webservice methods, -namely 'WebMethod1' for which the property 'DidUnderstand' is set -to true and 'WebMethod2' for which the property 'DidUnderstand' -is set to false. The property 'EncodedMustUnderstand' is set to '1' -for the client soapheader. The client calls the method 'WebMethod2' -whose 'DidUnderstand' property is set to false and hence a 'SoapHeaderException' -is thrown. -*/ -#using -#using -#using -#using - -using namespace System; - -int main() -{ - try - { - // - // MyHeader class is derived from the SoapHeader class. - MyHeader ^ customHeader = gcnew MyHeader; - customHeader->MyValue = "Header value for MyValue"; - - // Set the EncodedMustUnderstand property to true. - customHeader->EncodedMustUnderstand = "1"; - WebService_SoapHeader_EncodedMustUnderstand ^ myWebService = gcnew WebService_SoapHeader_EncodedMustUnderstand; - myWebService->myHeader1 = customHeader; - String^ results = myWebService->MyWebMethod1(); - Console::WriteLine( results ); - try - { - results = myWebService->MyWebMethod2(); - } - catch ( Exception^ myException ) - { - Console::WriteLine( "Exception raised in MyWebMethod2." ); - Console::WriteLine( "Message: {0}", myException->Message ); - } - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!" ); - Console::WriteLine( "Source: {0}", e->Source ); - Console::WriteLine( "Message: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp deleted file mode 100644 index 6553b346e86..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -// -#using -#using -#using - -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -namespace MyMath -{ - - [System::Web::Services::WebServiceBindingAttribute(Name="MathSoap",Namespace="http://tempuri.org/")] - public ref class Math: public System::Web::Services::Protocols::SoapHttpClientProtocol - { - public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - Math() - { - this->Url = "http://www.contoso.com/math.asmx"; - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - int Add( int num1, int num2 ) - { - array^temp0 = {num1,num2}; - array^results = this->Invoke( "Add", temp0 ); - return *dynamic_cast(results[ 0 ]); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) - { - array^temp1 = {num1,num2}; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - - [System::Diagnostics::DebuggerStepThroughAttribute] - int EndAdd( System::IAsyncResult^ asyncResult ) - { - array^results = this->EndInvoke( asyncResult ); - return *dynamic_cast(results[ 0 ]); - } - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp deleted file mode 100644 index c2b34429787..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp +++ /dev/null @@ -1,322 +0,0 @@ -// System.Web.Services.Protocols.SoapMessage -// System.Web.Services.Protocols.SoapMessage.Action -// System.Web.Services.Protocols.SoapMessage.ContentType -// System.Web.Services.Protocols.SoapMessage.OneWay -// System.Web.Services.Protocols.SoapMessage.Url -// System.Web.Services.Protocols.SoapMessage.GetInParameterValue(int) -// System.Web.Services.Protocols.SoapMessage.MethodInfo -// System.Web.Services.Protocols.SoapMessage.GetOutParameterValue(int) -// System.Web.Services.Protocols.SoapMessage.GetReturnValue() - -/* -The following example demonstrates various members of the SoapMessage -class. The program extends the SoapExtension class to create a class -that is used to log the SOAP messages transferred for an XML Web service -method invocation. Whenever this method is invoked on the client side, -all the SOAP messages that get transfered both from the client and the -server are written into a log file. -*/ - -#using -#using - -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -ref class MySoapExtension; - -// A SoapExtensionAttribute that can be associated with an XML -// Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class MySoapExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - // Set the name of the log file where SOAP messages will be stored. - MySoapExtensionAttribute() : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of MySoapExtension. - virtual Type^ get() override - { - return MySoapExtension::typeid; - } - } - - property int Priority - { - // User can set priority of the SoapExtension. - virtual int get() override - { - return myPriority; - } - virtual void set( int value ) override - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - void set( String^ value ) - { - myFilename = value; - } - } -}; - -public ref class MySoapHeader: public SoapHeader -{ -public: - String^ text; -}; - -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", - Namespace="http://tempuri.org/")] -public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ -public: - MySoapHeader^ mySoapHeader; - - [SoapHeaderAttribute("mySoapHeader",Direction=SoapHeaderDirection::In)] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute( - "http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [MySoapExtensionAttribute] - Single Add( Single xValue, Single yValue, - [System::Runtime::InteropServices::Out]interior_ptr returnValue ) - { - mySoapHeader = gcnew MySoapHeader; - mySoapHeader->text = "This is the first SOAP header"; - array^ temp0 = { xValue, yValue }; - array^ results = this->Invoke( "Add", temp0 ); - *returnValue = (Single)( results[ 1 ] ); - return (Single)( results[ 0 ] ); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathSvc() - { - this->Url = "http://localhost/MathSvc_SoapMessage.cs.asmx"; - } - - System::IAsyncResult^ BeginAdd( Single xValue, - Single yValue, System::AsyncCallback^ callback, - Object^ asyncState ) - { - array^ temp1 = { xValue, yValue }; - return this->BeginInvoke( "Add", - temp1, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult, - [System::Runtime::InteropServices::Out]interior_ptr returnValue ) - { - array^ results = this->EndInvoke( asyncResult ); - *returnValue = (Single)( results[ 1 ] ); - return (Single)( results[ 0 ] ); - } -}; - -public ref class MySoapExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - - // Return the file name that is to log the SOAP messages. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, - SoapExtensionAttribute^ attribute ) override - { - return ( (MySoapExtensionAttribute^)( attribute ))->Filename; - } - - // Return the file name that is to log the SOAP messages. - virtual Object^ GetInitializer( Type^ filename ) override - { - return (Type^)( filename ); - } - - // Save the name of the log file that will save the SOAP messages. - virtual void Initialize( Object^ initializer ) override - { - filename = (String^)( initializer ); - } - -// - // Process the SOAP message received and write to log file. - virtual void ProcessMessage( SoapMessage^ message ) override - { - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - WriteOutputBeforeSerialize( message ); - break; - case SoapMessageStage::AfterSerialize: - WriteOutputAfterSerialize( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInputBeforeDeserialize( message ); - break; - case SoapMessageStage::AfterDeserialize: - WriteInputAfterDeserialize( message ); - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutputBeforeSerialize( SoapMessage^ message ) - { - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "================================== Request at {0}", - DateTime::Now ); - - // - myStreamWriter->WriteLine( - "The method that has been invoked is: " ); - myStreamWriter->WriteLine( "\t{0}", message->MethodInfo ); - // - - // - myStreamWriter->WriteLine( "The contents of the SOAPAction HTTP header is:" ); - myStreamWriter->WriteLine( "\t{0}", message->Action ); - // - - // - myStreamWriter->WriteLine( "The contents of HTTP Content-type header is:" ); - myStreamWriter->WriteLine( "\t{0}", message->ContentType ); - // - - // - if ( message->OneWay ) - { - myStreamWriter->WriteLine( - "The method invoked on the client shall not wait" - + " till the server finishes" ); - } - else - { - myStreamWriter->WriteLine( - "The method invoked on the client shall wait" - + " till the server finishes" ); - } - // - - // - myStreamWriter->WriteLine( - "The site where the XML Web service is available is:" ); - myStreamWriter->WriteLine( "\t{0}", message->Url ); - // - - // - myStreamWriter->WriteLine( "The values of the in parameters are:" ); - myStreamWriter->WriteLine( - "Value of first in parameter: {0}", message->GetInParameterValue( 0 ) ); - myStreamWriter->WriteLine( - "Value of second in parameter: {0}", message->GetInParameterValue( 1 ) ); - // - - myStreamWriter->WriteLine(); - myStreamWriter->Flush(); - myStreamWriter->Close(); - myFileStream->Close(); - } - - // Write the contents of the incoming SOAP message to the log file. - void WriteInputAfterDeserialize( SoapMessage^ message ) - { - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine(); - - // - myStreamWriter->WriteLine( "The values of the out parameter are:" ); - myStreamWriter->WriteLine( - "The value of the out parameter is: {0}", message->GetOutParameterValue( 0 ) ); - // - - // - myStreamWriter->WriteLine( "The values of the return parameter are:" ); - myStreamWriter->WriteLine( - "The value of the return parameter is: {0}", message->GetReturnValue() ); - // - - myStreamWriter->Flush(); - myStreamWriter->Close(); - myFileStream->Close(); - } - // - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutputAfterSerialize( SoapMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->Flush(); - Copy( newStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - - // Write the contents of the incoming SOAP message to the log file. - void WriteInputBeforeDeserialize( SoapMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "---------------------------------- Response at {0}", - DateTime::Now ); - myStreamWriter->Flush(); - newStream->Position = 0; - Copy( newStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - newStream->Position = 0; - } - - // Return a new MemoryStream for SOAP processing. - virtual Stream^ ChainStream( Stream^ stream ) override - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - // Utility method to copy the contents of one stream to another. - void Copy( Stream^ fromStream, Stream^ toStream ) - { - TextReader^ myTextReader = gcnew StreamReader( fromStream ); - TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); - myTextWriter->WriteLine( myTextReader->ReadToEnd() ); - myTextWriter->Flush(); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp deleted file mode 100644 index f5ed2196e55..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// System.Web.Services.Protocols.SoapMessageState -// System.Web.Services.Protocols.SoapMessageState.AfterDeserialize -// System.Web.Services.Protocols.SoapMessageState.AfterSerialize -// System.Web.Services.Protocols.SoapMessageState.BeforeDeserialize -// System.Web.Services.Protocols.SoapMessageState.BeforeSerialize - -/* - The following example demonstrates the 'AfterDeserialize', - 'AfterSerialize', 'BeforeDeserialize' and 'BeforeSerialize' enum - members of the 'SoapMessageState' class. The program extends the - 'SoapExtension' class to create a class that is used to log the - SOAP messages transferred for a web service method invocation. - To associate this 'SoapExtension' class with the web service - method on the client proxy a class that extends from - 'SoapExtensionAttribute' is used. This 'SoapExtensionAttribute' is - applied to a client proxy method which is associated with a web - service method. Whenever this method is invoked on the client - side all the SOAP message that get transfered both from the client - and the server(which is hosting the web service) are written into - a log file. -*/ - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -ref class MySoapExtension; - -// A 'SoapExtensionAttribute' that can be associated with web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class MySoapExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - // Set the name of the log file where SOAP messages will be stored. - MySoapExtensionAttribute() : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of 'MySoapExtension' class. - Type^ get() - { - return typeid; - } - } - - property int Priority - { - // User can set priority of the 'SoapExtension'. - int get() - { - return myPriority; - } - void set( int value ) - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - void set( String^ value ) - { - myFilename = value; - } - } -}; - -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",Namespace="http://tempuri.org/")] -public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ -public: - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathSvc() - { - this->Url = "http://localhost/MathSvc_SoapMessageState.asmx"; - } - - [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add",Use=System::Web::Services::Description::SoapBindingUse::Literal,ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [MySoapExtensionAttribute] - Single Add( Single xValue, Single yValue ) - { - array^ temp0 = {xValue,yValue}; - array^ results = this->Invoke( "Add", temp0 ); - return (Single)( results[ 0 ] ); - } - - System::IAsyncResult^ BeginAdd( Single xValue, - Single yValue, - System::AsyncCallback^ callback, - Object^ asyncState ) - { - array^ temp1 = { xValue, yValue }; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult ) - { - array^ results = this->EndInvoke( asyncResult ); - return (Single)( results[ 0 ] ); - } - -}; - -public ref class MySoapExtension: public SoapExtension -{ -private: - Stream^ oldStream; - Stream^ newStream; - String^ filename; - -public: - // Return the filename that is to log the SOAP messages. - Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) - { - return ( (MySoapExtensionAttribute^)( attribute ))->Filename; - } - - // Return the filename that is to log the SOAP messages. - Object^ GetInitializer( Type^ filename ) - { - return (Type^)( filename ); - } - - // Save the name of the log file that shall save the SOAP messages. - void Initialize( Object^ initializer ) - { - filename = (String^)( initializer ); - } - -// - // Process the SOAP message received and write to log file. - void ProcessMessage( SoapMessage^ message ) - { -// -// -// -// - switch ( message->Stage ) - { - case SoapMessageStage::BeforeSerialize: - break; - case SoapMessageStage::AfterSerialize: - WriteOutput( message ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInput( message ); - break; - case SoapMessageStage::AfterDeserialize: - break; - default: - throw gcnew Exception( "invalid stage" ); - } -// -// -// -// - } -// - - // Return a new 'MemoryStream' instance for SOAP processing. - Stream^ ChainStream( Stream^ stream ) - { - oldStream = stream; - newStream = gcnew MemoryStream; - return newStream; - } - - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutput( SoapMessage^ /*message*/ ) - { - newStream->Position = 0; - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "================================== Request at {0}", - DateTime::Now ); - myStreamWriter->Flush(); - Copy( newStream, myFileStream ); - myFileStream->Close(); - newStream->Position = 0; - Copy( newStream, oldStream ); - } - - // Write the contents of the incoming SOAP message to the log file. - void WriteInput( SoapMessage^ /*message*/ ) - { - Copy( oldStream, newStream ); - FileStream^ myFileStream = - gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( "---------------------------------- Response at {0}", - DateTime::Now ); - myStreamWriter->Flush(); - newStream->Position = 0; - Copy( newStream, myFileStream ); - myFileStream->Close(); - newStream->Position = 0; - } - - // Utility method to copy the contents of one stream to another. - void Copy( Stream^ fromStream, Stream^ toStream ) - { - TextReader^ myTextReader = gcnew StreamReader( fromStream ); - TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); - myTextWriter->WriteLine( myTextReader->ReadToEnd() ); - myTextWriter->Flush(); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp deleted file mode 100644 index 17482834562..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp +++ /dev/null @@ -1,281 +0,0 @@ -// System.Web.Services.Protocols.SoapMessage.Headers -// System.Web.Services.Protocols.SoapMessage.Stream - -/* - The following example demonstrates the 'Headers' and 'Stream' properties - of the 'SoapMessage' class. The program extends the - 'SoapExtension' class to create a class that is used to log the - SOAP messages transferred for a web service method invocation. - Whenever this method is invoked on the client side all the SOAP - message that get transfered both from the client and the server - are written into a log file. -*/ - -#using -#using -#using - -using namespace System::Runtime::InteropServices; -using namespace System; -using namespace System::IO; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -ref class MySoapExtension; - -// A SoapExtensionAttribute that can be associated with an -// XML Web service method. -[AttributeUsage(AttributeTargets::Method)] -public ref class MySoapExtensionAttribute: public SoapExtensionAttribute -{ -private: - String^ myFilename; - int myPriority; - -public: - // Set the name of the log file where SOAP messages will be stored. - MySoapExtensionAttribute() : SoapExtensionAttribute() - { - myFilename = "C:\\logClient.txt"; - } - - property Type^ ExtensionType - { - // Return the type of MySoapExtension. - virtual Type^ get() override - { - return MySoapExtension::typeid; - } - } - - property int Priority - { - // User can set priority of the SoapExtension. - virtual int get() override - { - return myPriority; - } - virtual void set( int value ) override - { - myPriority = value; - } - } - - property String^ Filename - { - String^ get() - { - return myFilename; - } - void set( String^ value ) - { - myFilename = value; - } - } -}; - -public ref class MySoapHeader: public SoapHeader -{ -public: - String^ myText; -}; - -[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", - Namespace="http://tempuri.org/")] -public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol -{ -public: - MySoapHeader^ mySoapHeader; - - [SoapHeaderAttribute("mySoapHeader",Direction=SoapHeaderDirection::In)] - [System::Web::Services::Protocols::SoapDocumentMethodAttribute( - "http://tempuri.org/Add", - Use=System::Web::Services::Description::SoapBindingUse::Literal, - ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] - [MySoapExtensionAttribute] - Single Add( Single xValue, - Single yValue, - [System::Runtime::InteropServices::Out]interior_ptr returnValue ) - { - mySoapHeader = gcnew MySoapHeader; - mySoapHeader->myText = "This is the first SOAP header"; - array^ temp0 = {xValue,yValue}; - array^ results = this->Invoke( "Add", temp0 ); - *returnValue = (Single)( results[ 1 ] ); - return (Single)( results[ 0 ] ); - } - - [System::Diagnostics::DebuggerStepThroughAttribute] - MathSvc() - { - this->Url = "http://localhost/SoapMessage_Headers.cs.asmx"; - } - - System::IAsyncResult^ BeginAdd( Single xValue, Single yValue, - System::AsyncCallback^ callback, Object^ asyncState ) - { - array^ temp1 = { xValue, yValue }; - return this->BeginInvoke( "Add", temp1, callback, asyncState ); - } - - Single EndAdd( System::IAsyncResult^ asyncResult, - [System::Runtime::InteropServices::Out]interior_ptr returnValue ) - { - array^ results = this->EndInvoke( asyncResult ); - *returnValue = (Single)( results[ 1 ] ); - return (Single)( results[ 0 ] ); - } -}; - -public ref class MySoapExtension: public SoapExtension -{ -private: - Stream^ myOldStream; - Stream^ myNewStream; - String^ myFileName; - -public: - // Return the filename that is to log the SOAP messages. - virtual Object^ GetInitializer( LogicalMethodInfo^ /*myMethodInfo*/, - SoapExtensionAttribute^ mySoapExtensionAttributeObject ) override - { - return ( (MySoapExtensionAttribute^)( mySoapExtensionAttributeObject ) )->Filename; - } - - // Return the filename that is to log the SOAP messages. - virtual Object^ GetInitializer( Type^ myFileName ) override - { - return (Type^)( myFileName ); - } - - // Save the name of the log file that shall save the SOAP messages. - virtual void Initialize( Object^ myInitializer ) override - { - myFileName = (String^)( myInitializer ); - } - - // Process the SOAP message received and write to log file. - virtual void ProcessMessage( SoapMessage^ myMessage ) override - { - switch ( myMessage->Stage ) - { - case SoapMessageStage::BeforeSerialize: - WriteOutputBeforeSerialize( myMessage ); - break; - case SoapMessageStage::AfterSerialize: - WriteOutputAfterSerialize( myMessage ); - break; - case SoapMessageStage::BeforeDeserialize: - WriteInputBeforeDeserialize( myMessage ); - break; - case SoapMessageStage::AfterDeserialize: - WriteInputAfterDeserialize( myMessage ); - break; - default: - throw gcnew Exception( "invalid stage" ); - } - } - - // - // Write the contents of the outgoing SOAP message to the log file. -public: - void WriteOutputBeforeSerialize( SoapMessage^ myMessage ) - { - FileStream^ myFileStream = gcnew FileStream( - myFileName, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( - "================================== Request at {0}", DateTime::Now ); - - myStreamWriter->WriteLine( "The values of the in parameters are:" ); - myStreamWriter->WriteLine( "Value of first in parameter: {0}", - myMessage->GetInParameterValue( 0 ) ); - myStreamWriter->WriteLine( "Value of second in parameter: {0}", - myMessage->GetInParameterValue( 1 ) ); - - myStreamWriter->Write( "Number of headers for the current request: " ); - myStreamWriter->WriteLine( myMessage->Headers->Count ); - - myStreamWriter->WriteLine(); - myStreamWriter->Flush(); - myStreamWriter->Close(); - myFileStream->Close(); - } - // - - // Write the contents of the incoming SOAP message to the log file. - void WriteInputAfterDeserialize( SoapMessage^ myMessage ) - { - FileStream^ myFileStream = gcnew FileStream( - myFileName, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine(); - - myStreamWriter->WriteLine( "The values of the out parameter are:" ); - myStreamWriter->WriteLine( "The value of the out parameter is: {0}", - myMessage->GetOutParameterValue( 0 ) ); - - myStreamWriter->WriteLine( "The values of the return parameter are:" ); - myStreamWriter->WriteLine( "The value of the return parameter is: {0}", - myMessage->GetReturnValue() ); - - myStreamWriter->Flush(); - myStreamWriter->Close(); - myFileStream->Close(); - } - - // Write the contents of the outgoing SOAP message to the log file. - void WriteOutputAfterSerialize( SoapMessage^ /*myMessage*/ ) - { - myNewStream->Position = 0; - FileStream^ myFileStream = gcnew FileStream( - myFileName, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->Flush(); - Copy( myNewStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - myNewStream->Position = 0; - Copy( myNewStream, myOldStream ); - } - - // - // Write the contents of the incoming SOAP message to the log file. -public: - void WriteInputBeforeDeserialize( SoapMessage^ myMessage ) - { - Copy( myOldStream, myNewStream ); - FileStream^ myFileStream = - gcnew FileStream( myFileName, FileMode::Append, FileAccess::Write ); - StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); - myStreamWriter->WriteLine( - "---------------------------------- Response at {0}", DateTime::Now ); - Stream^ myStream = myMessage->Stream; - myStreamWriter->Write( "Length of data in the current response: " ); - myStreamWriter->WriteLine( myStream->Length ); - myStreamWriter->Flush(); - myNewStream->Position = 0; - Copy( myNewStream, myFileStream ); - myStreamWriter->Close(); - myFileStream->Close(); - myNewStream->Position = 0; - } - // - - // Return a new MemoryStream for SOAP processing. - virtual Stream^ ChainStream( Stream^ myStream ) override - { - myOldStream = myStream; - myNewStream = gcnew MemoryStream; - return myNewStream; - } - - // Utility method to copy the contents of one stream to another. - void Copy( Stream^ fromStream, Stream^ toStream ) - { - TextReader^ myTextReader = gcnew StreamReader( fromStream ); - TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); - myTextWriter->WriteLine( myTextReader->ReadToEnd() ); - myTextWriter->Flush(); - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp deleted file mode 100644 index c0254af595f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp +++ /dev/null @@ -1,104 +0,0 @@ - - -// System.Web.Services.Description.SoapBinding -// System.Web.Services.Description.SoapOperationBinding -// System.Web.Services.Description.SoapBodyBinding -// System.Web.Services.Description.SoapAddressBinding -// System.Web.Services.Description.SoapBinding.HttpTransport; -/* -The following example demonstrates the 'SoapBinding', 'SoapOperationBinding' , -'SoapBodyBinding' , SoapAddressBinding' classes and 'HttpTransport' field of 'SoapBinding' class. - -It takes a wsdl file which supports two protocols 'HttpGet' and 'HttpPost' as input. By using the -'Read' method of 'ServiceDescription' class it gets the 'ServiceDescription' object. It uses -the SOAP protocol related classes and creates 'Binding','Port' and 'PortType' elements of -'SOAP' protocol. It adds all the elements to the 'ServiceDescription' object. The 'ServiceDescription' -object creates another wsdl file which supports 'SOAP' also. This wsdl file is used to generate a proxy -which is used by the .aspx file. -*/ -// -// -// -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; -int main() -{ - ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); - - // Create a 'Binding' object for the 'SOAP' protocol. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Service1Soap"; - XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); - myBinding->Type = qualifiedName; - - // - SoapBinding^ mySoapBinding = gcnew SoapBinding; - mySoapBinding->Transport = SoapBinding::HttpTransport; - mySoapBinding->Style = SoapBindingStyle::Document; - // - - // Add the 'SoapBinding' object to the 'Binding' object. - myBinding->Extensions->Add( mySoapBinding ); - - // Create the 'OperationBinding' object for the 'SOAP' protocol. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - - // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. - SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; - mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; - mySoapOperationBinding->Style = SoapBindingStyle::Document; - - // Add the 'SoapOperationBinding' object to 'OperationBinding' object. - myOperationBinding->Extensions->Add( mySoapOperationBinding ); - - // Create the 'InputBinding' object for the 'SOAP' protocol. - InputBinding^ myInput = gcnew InputBinding; - SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; - mySoapBinding1->Use = SoapBindingUse::Literal; - myInput->Extensions->Add( mySoapBinding1 ); - - // Assign the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInput; - - // Create the 'OutputBinding' object' for the 'SOAP' protocol.. - OutputBinding^ myOutput = gcnew OutputBinding; - myOutput->Extensions->Add( mySoapBinding1 ); - - // Assign the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - Port^ soapPort = gcnew Port; - soapPort->Name = "Service1Soap"; - soapPort->Binding = gcnew XmlQualifiedName( "s0:Service1Soap" ); - - // Create a 'SoapAddressBinding' object for the 'SOAP' protocol. - SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; - mySoapAddressBinding->Location = "http://localhost/AddNumbers.cs.asmx"; - - // Add the 'SoapAddressBinding' to the 'Port'. - soapPort->Extensions->Add( mySoapAddressBinding ); - - // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. - myDescription->Services[ 0 ]->Ports->Add( soapPort ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "AddNumbersOut_cs.wsdl" ); - Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); -} -// -// -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp deleted file mode 100644 index 1c316326d9c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp +++ /dev/null @@ -1,171 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -[SoapType("EmployeeType")] -public ref class Employee -{ -public: - String^ Name; -}; - - -// The SoapType is overridden when the -// SerializeOverride method is called. - -[SoapType("SoapGroupType","http://www.cohowinery.com")] -public ref class Group -{ -public: - String^ GroupName; - array^Employees; -}; - -public ref class Run -{ -public: - void SerializeOriginal( String^ filename ) - { - // Create an instance of the XmlSerializer class that - // can be used for serializing as a SOAP message. - XmlTypeMapping^ mapp = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); - XmlSerializer^ mySerializer = gcnew XmlSerializer( mapp ); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an XML text writer. - XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( writer ); - xmlWriter->Formatting = Formatting::Indented; - xmlWriter->Indentation = 2; - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the Object* properties. - myGroup->GroupName = ".NET"; - Employee^ e1 = gcnew Employee; - e1->Name = "Pat"; - myGroup->Employees = gcnew array(1); - myGroup->Employees[ 0 ] = e1; - - // Write the root element. - xmlWriter->WriteStartElement( "root" ); - - // Serialize the class. - mySerializer->Serialize( xmlWriter, myGroup ); - - // Close the root tag. - xmlWriter->WriteEndElement(); - - // Close the XmlWriter. - xmlWriter->Close(); - - // Close the TextWriter. - writer->Close(); - } - - void SerializeOverride( String^ filename ) - { - // Create an instance of the XmlSerializer class that - // uses a SoapAttributeOverrides Object*. - XmlSerializer^ mySerializer = CreateOverrideSerializer(); - - // Writing the file requires a TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create an XML text writer. - XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( writer ); - xmlWriter->Formatting = Formatting::Indented; - xmlWriter->Indentation = 2; - - // Create an instance of the class that will be serialized. - Group^ myGroup = gcnew Group; - - // Set the Object* properties. - myGroup->GroupName = ".NET"; - Employee^ e1 = gcnew Employee; - e1->Name = "Pat"; - myGroup->Employees = gcnew array(1); - myGroup->Employees[ 0 ] = e1; - - // Write the root element. - xmlWriter->WriteStartElement( "root" ); - - // Serialize the class. - mySerializer->Serialize( xmlWriter, myGroup ); - - // Close the root tag. - xmlWriter->WriteEndElement(); - - // Close the XmlWriter. - xmlWriter->Close(); - - // Close the TextWriter. - writer->Close(); - } - - void DeserializeObject( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlSerializer^ mySerializer = CreateOverrideSerializer(); - - // Reading the file requires a TextReader. - TextReader^ reader = gcnew StreamReader( filename ); - - // Create an XML text reader. - XmlTextReader^ xmlReader = gcnew XmlTextReader( reader ); - xmlReader->ReadStartElement(); - - // Deserialize and cast the object. - Group^ myGroup; - myGroup = dynamic_cast(mySerializer->Deserialize( xmlReader )); - xmlReader->ReadEndElement(); - Console::WriteLine( "The GroupName is {0}", myGroup->GroupName ); - Console::WriteLine( "Look at the SoapType.xml and SoapType2.xml " - "files for the generated XML." ); - - // Close the readers. - xmlReader->Close(); - reader->Close(); - } - -private: - XmlSerializer^ CreateOverrideSerializer() - { - // Create and return an XmlSerializer instance used to - // and create SOAP messages. - SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; - SoapAttributes^ soapAtts = gcnew SoapAttributes; - - // Override the SoapTypeAttribute. - SoapTypeAttribute^ soapType = gcnew SoapTypeAttribute; - soapType->TypeName = "Team"; - soapType->IncludeInSchema = false; - soapType->Namespace = "http://www.microsoft.com"; - soapAtts->SoapType = soapType; - mySoapAttributeOverrides->Add( Group::typeid, soapAtts ); - - // Create an XmlTypeMapping that is used to create an instance - // of the XmlSerializer. Then return the XmlSerializer Object*. - XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); - XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); - return ser; - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->SerializeOriginal( "SoapType.xml" ); - test->SerializeOverride( "SoapType2.xml" ); - test->DeserializeObject( "SoapType2.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp deleted file mode 100644 index 252b3995880..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; -using namespace System::Security::Permissions; -using namespace System::Collections; - -void MySocketPermission() -{ -// -// - // Creates a SocketPermission restricting access to and from all URIs. - SocketPermission^ mySocketPermission1 = gcnew SocketPermission( PermissionState::None ); - - // The socket to which this permission will apply will allow connections from www.contoso.com. - mySocketPermission1->AddPermission( NetworkAccess::Accept, TransportType::Tcp, "www.contoso.com", 11000 ); - - // Creates a SocketPermission which will allow the target Socket to connect with www.southridgevideo.com. - SocketPermission^ mySocketPermission2 = gcnew SocketPermission( NetworkAccess::Connect,TransportType::Tcp, "www.southridgevideo.com",11002 ); - - // Creates a SocketPermission from the union of two SocketPermissions. - SocketPermission^ mySocketPermissionUnion = - (SocketPermission^)( mySocketPermission1->Union( mySocketPermission2 ) ); - - // Checks to see if the union was successfully created by using the IsSubsetOf method. - if ( mySocketPermission1->IsSubsetOf( mySocketPermissionUnion ) && - mySocketPermission2->IsSubsetOf( mySocketPermissionUnion ) ) - { - Console::WriteLine( "This union contains permissions from both mySocketPermission1 and mySocketPermission2" ); - - // Prints the allowable accept URIs to the console. - Console::WriteLine( "This union accepts connections on :" ); - - IEnumerator^ myEnumerator = mySocketPermissionUnion->AcceptList; - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( safe_cast( myEnumerator->Current )->ToString() ); - } - - // Prints the allowable connect URIs to the console. - Console::WriteLine( "This union permits connections to :" ); - - myEnumerator = mySocketPermissionUnion->ConnectList; - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( safe_cast( myEnumerator->Current )->ToString() ); - } - } -// - -// - // Creates a SocketPermission from the intersect of two SocketPermissions. - SocketPermission^ mySocketPermissionIntersect = - (SocketPermission^)( mySocketPermission1->Intersect( mySocketPermissionUnion ) ); - - // mySocketPermissionIntersect should now contain the permissions of mySocketPermission1. - if ( mySocketPermission1->IsSubsetOf( mySocketPermissionIntersect ) ) - { - Console::WriteLine( "This is expected" ); - } - - // mySocketPermissionIntersect should not contain the permissios of mySocketPermission2. - if ( mySocketPermission2->IsSubsetOf( mySocketPermissionIntersect ) ) - { - Console::WriteLine( "This should not print" ); - } -// - -// - // Creates a copy of the intersect SocketPermission. - SocketPermission^ mySocketPermissionIntersectCopy = - (SocketPermission^)( mySocketPermissionIntersect->Copy() ); - if ( mySocketPermissionIntersectCopy->Equals( mySocketPermissionIntersect ) ) - { - Console::WriteLine( "Copy successfull" ); - } -// - - // Converts a SocketPermission to XML format and then immediately converts it back to a SocketPermission. - mySocketPermission1->FromXml( mySocketPermission1->ToXml() ); - - // Checks to see if permission for this socket resource is unrestricted. If it is, then there is no need to - // demand that permissions be enforced. - if ( mySocketPermissionUnion->IsUnrestricted() ) - { - //Do nothing. There are no restrictions. - } - else - { - // Enforces the permissions found in mySocketPermissionUnion on any Socket Resources used below this statement. - mySocketPermissionUnion->Demand(); - } - - IPHostEntry^ myIpHostEntry = Dns::Resolve( "www.contoso.com" ); - IPEndPoint^ myLocalEndPoint = gcnew IPEndPoint( myIpHostEntry->AddressList[ 0 ], 11000 ); - - Socket^ s = gcnew Socket( myLocalEndPoint->Address->AddressFamily, - SocketType::Stream, - ProtocolType::Tcp ); - try - { - s->Connect( myLocalEndPoint ); - } - catch ( Exception^ e ) - { - Console::Write( "Exception Thrown: " ); - Console::WriteLine( e->ToString() ); - } - - // Perform all socket operations in here. - s->Close(); -// -} - -int main() -{ - MySocketPermission(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp deleted file mode 100644 index 9cc9a851cc9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -namespace SocketOptionExamples -{ - ref class SocketPropertyTester - { - // - static void ConfigureTcpSocket(Socket^ tcpSocket) - { - - // Don't allow another socket to bind to this port. - tcpSocket->ExclusiveAddressUse = true; - - // The socket will linger for 10 seconds after - // Socket.Close is called. - tcpSocket->LingerState = gcnew LingerOption(true, 10); - - // Disable the Nagle Algorithm for this tcp socket. - tcpSocket->NoDelay = true; - - // Set the receive buffer size to 8k - tcpSocket->ReceiveBufferSize = 8192; - - // Set the timeout for synchronous receive methods to - // 1 second (1000 milliseconds.) - tcpSocket->ReceiveTimeout = 1000; - - // Set the send buffer size to 8k. - tcpSocket->SendBufferSize = 8192; - - // Set the timeout for synchronous send methods - // to 1 second (1000 milliseconds.) - tcpSocket->SendTimeout = 1000; - - // Set the Time To Live (TTL) to 42 router hops. - tcpSocket->Ttl = 42; - Console::WriteLine("Tcp Socket configured:"); - Console::WriteLine(" ExclusiveAddressUse {0}", - tcpSocket->ExclusiveAddressUse); - Console::WriteLine(" LingerState {0}, {1}", - tcpSocket->LingerState->Enabled, - tcpSocket->LingerState->LingerTime); - Console::WriteLine(" NoDelay {0}", - tcpSocket->NoDelay); - Console::WriteLine(" ReceiveBufferSize {0}", - tcpSocket->ReceiveBufferSize); - Console::WriteLine(" ReceiveTimeout {0}", - tcpSocket->ReceiveTimeout); - Console::WriteLine(" SendBufferSize {0}", - tcpSocket->SendBufferSize); - Console::WriteLine(" SendTimeout {0}", - tcpSocket->SendTimeout); - Console::WriteLine(" Ttl {0}", - tcpSocket->Ttl); - Console::WriteLine(" IsBound {0}", - tcpSocket->IsBound); - Console::WriteLine(""); - } - // - // - static void ConfigureUdpSocket(Socket^ udpSocket) - { - - // Set the Don't Fragment flag. - udpSocket->DontFragment = true; - - // Enable broadcast. - udpSocket->EnableBroadcast = true; - - // Disable multicast loopback. - udpSocket->MulticastLoopback = false; - Console::WriteLine("Udp Socket configured:"); - Console::WriteLine(" DontFragment {0}", - udpSocket->DontFragment); - Console::WriteLine(" EnableBroadcast {0}", - udpSocket->EnableBroadcast); - Console::WriteLine(" MulticastLoopback {0}", - udpSocket->MulticastLoopback); - } - // - public: - static void Work() - { - Socket^ tcpSocket = gcnew Socket( - AddressFamily::InterNetwork, - SocketType::Stream, ProtocolType::IP); - Socket^ udpSocket = gcnew Socket( - AddressFamily::InterNetwork, - SocketType::Dgram, ProtocolType::IP); - ConfigureTcpSocket(tcpSocket); - ConfigureUdpSocket(udpSocket); - } - }; -} - -int main() -{ - SocketOptionExamples::SocketPropertyTester::Work(); - return 0; -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp deleted file mode 100644 index d7441a3cbf9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -#using -#define NULL 0 - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; -using namespace System::Collections; -public ref class Sync_Send_Receive -{ -public: - - //Displays sending and receiving with a connected socket -- buffer only - static void SendReceive1() - { - - // - IPHostEntry^ lipa = Dns::Resolve( Dns::GetHostName() ); - - //Gets three separate local endpoints. - IPEndPoint^ lep1 = gcnew IPEndPoint( lipa->AddressList[ 0 ],11000 ); - IPEndPoint^ lep2 = gcnew IPEndPoint( lipa->AddressList[ 0 ],11001 ); - IPEndPoint^ lep3 = gcnew IPEndPoint( lipa->AddressList[ 0 ],11002 ); - - //creates an array of endpoints. - array^ipendpoints = gcnew array(3); - ipendpoints[ 0 ] = lep1; - ipendpoints[ 1 ] = lep2; - ipendpoints[ 2 ] = lep3; - - //Creates three separate sockets. - Socket^ s1 = gcnew Socket( lep1->Address->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); - Socket^ s2 = gcnew Socket( lep2->Address->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); - Socket^ s3 = gcnew Socket( lep3->Address->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); - array^socketList = gcnew array(3); - socketList[ 0 ] = s1; - socketList[ 1 ] = s2; - socketList[ 2 ] = s3; - - //Binds and Listens on all sockets in the array of sockets. - for ( int i = 0; i < 3; i++ ) - { - socketList[ i ]->Bind( ipendpoints[ i ] ); - socketList[ i ]->Listen( 1000 ); - - } - - //Calls Select to determine which sockets are ready for reading. - Socket::Select( safe_cast(socketList), nullptr, nullptr, 1000 ); - - //Reads on the sockets returned by Select. - array^buffer = gcnew array(1024); - String^ outString; - for ( Int32 j = 0; j < (socketList->Length - 1); j++ ) - { - socketList[ j ]->Receive( buffer ); - outString = "Socket "; - outString->Concat( j.ToString(), " has the message", Encoding::ASCII->GetString( buffer ) ); - Console::WriteLine( outString ); - - } - } - -}; - -int main() -{ - return 0; -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp deleted file mode 100644 index e799e953dee..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -String^ DoSocketGet( String^ server ) -{ - - //Set up variables and String to write to the server. - Encoding^ ASCII = Encoding::ASCII; - String^ Get = "GET / HTTP/1.1\r\nHost: "; - Get->Concat( server, "\r\nConnection: Close\r\n\r\n" ); - array^ByteGet = ASCII->GetBytes( Get ); - array^RecvBytes = gcnew array(256); - String^ strRetPage = nullptr; - - // IPAddress and IPEndPoint represent the endpoint that will - // receive the request. - // Get first IPAddress in list return by DNS. - try - { - - // Define those variables to be evaluated in the next for loop and - // then used to connect to the server. These variables are defined - // outside the for loop to make them accessible there after. - Socket^ s = nullptr; - IPEndPoint^ hostEndPoint; - IPAddress^ hostAddress = nullptr; - int conPort = 80; - - // Get DNS host information. - IPHostEntry^ hostInfo = Dns::Resolve( server ); - - // Get the DNS IP addresses associated with the host. - array^IPaddresses = hostInfo->AddressList; - - // Evaluate the socket and receiving host IPAddress and IPEndPoint. - for ( int index = 0; index < IPaddresses->Length; index++ ) - { - hostAddress = IPaddresses[ index ]; - hostEndPoint = gcnew IPEndPoint( hostAddress,conPort ); - - // - // Creates the Socket to send data over a TCP connection. - s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - // - // Connect to the host using its IPEndPoint. - s->Connect( hostEndPoint ); - if ( !s->Connected ) - { - - // Connection failed, try next IPaddress. - strRetPage = "Unable to connect to host"; - s = nullptr; - continue; - } - - - // - // Sent the GET request to the host. - s->Send( ByteGet, ByteGet->Length, SocketFlags::None ); - - // - - } - - // - // Receive the host home page content and loop until all the data is received. - Int32 bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); - strRetPage = "Default HTML page on "; - strRetPage->Concat( server, ":\r\n", ASCII->GetString( RecvBytes, 0, bytes ) ); - while ( bytes > 0 ) - { - bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); - strRetPage->Concat( ASCII->GetString( RecvBytes, 0, bytes ) ); - } - - - // - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException caught!!!" ); - Console::Write( "Source : " ); - Console::WriteLine( e->Source ); - Console::Write( "Message : " ); - Console::WriteLine( e->Message ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNULLException caught!!!" ); - Console::Write( "Source : " ); - Console::WriteLine( e->Source ); - Console::Write( "Message : " ); - Console::WriteLine( e->Message ); - } - catch ( NullReferenceException^ e ) - { - Console::WriteLine( "NULLReferenceException caught!!!" ); - Console::Write( "Source : " ); - Console::WriteLine( e->Source ); - Console::Write( "Message : " ); - Console::WriteLine( e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::Write( "Source : " ); - Console::WriteLine( e->Source ); - Console::Write( "Message : " ); - Console::WriteLine( e->Message ); - } - - return strRetPage; -} - -int main() -{ - Console::WriteLine( DoSocketGet( "localhost" ) ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp deleted file mode 100644 index 11687431bce..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; - -public ref class Sync_Send_Receive -{ -public: - static void SetSocketOptions() - { - IPHostEntry^ lipa = Dns::Resolve("host.contoso.com"); - IPEndPoint^ lep = gcnew IPEndPoint(lipa->AddressList[0], 11000); - Socket^ s = gcnew Socket(lep->Address->AddressFamily, SocketType::Stream, ProtocolType::Tcp); - - // - // Specifies that send operations will time-out - // if confirmation is not received within 1000 milliseconds. - s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 1000); - // - - // - // Specifies that the Socket will linger for 10 seconds after Close is called. - LingerOption^ lingerOption = gcnew LingerOption(true, 10); - s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::Linger, lingerOption); - // - - s->Connect(lep); - - array^ msg = Encoding::ASCII->GetBytes("This is a test"); - - // - Console::Write("This application will timeout if Send does not return within "); - Console::WriteLine(Encoding::ASCII->GetString(s->GetSocketOption(SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 4))); - - // Blocks until send returns. - int i = s->Send(msg); - - // Blocks until read returns. - array^ bytes = gcnew array(1024); - - s->Receive(bytes); - - // Displays to the screen. - Console::WriteLine(Encoding::ASCII->GetString(bytes)); - s->Shutdown(SocketShutdown::Both); - Console::Write("If data remains to be sent, this application will stay open for "); - Console::WriteLine(safe_cast(s->GetSocketOption(SocketOptionLevel::Socket, SocketOptionName::Linger))->LingerTime.ToString()); - s->Close(); - // - } - - static void CheckProperties() - { - IPHostEntry^ lipa = Dns::Resolve("host.contoso.com"); - IPEndPoint^ lep = gcnew IPEndPoint(lipa->AddressList[0], 11000); - - // - Socket^ s = gcnew Socket(lep->Address->AddressFamily, SocketType::Stream, ProtocolType::Tcp); - - // Uses the AddressFamily, SocketType, and ProtocolType properties. - Console::Write("I just set the following properties of socket: \n"); - Console::Write("Address Family = {0}", s->AddressFamily.ToString()); - Console::Write("\nSocketType = {0}", s->SocketType.ToString()); - Console::WriteLine("\nProtocolType = {0}", s->ProtocolType.ToString()); - // - - // - s->Connect(lep); - - // Uses the RemoteEndPoint property. - Console::WriteLine("I am connected to {0} on port number {1}", - IPAddress::Parse((((IPEndPoint^)(s->RemoteEndPoint))->Address)->ToString()), - ((IPEndPoint^)(s->RemoteEndPoint))->Port.ToString()); - - // Uses the LocalEndPoint property. - Console::Write("My local IpAddress is : {0}\nI am connected on port number {1}", - IPAddress::Parse((((IPEndPoint^)(s->LocalEndPoint))->Address)->ToString()), - ((IPEndPoint^)(s->LocalEndPoint))->Port.ToString()); - // - - // - // Uses low level method IOControl to set this socket to blocking mode. - int code = 0x8004667E; - array^ inBuf = gcnew array(4); - - inBuf[0] = 0; - - array^ outBuf = gcnew array(4); - - s->IOControl(code, inBuf, outBuf); - - // Checks to see that this worked. - if (s->Blocking) - { - Console::WriteLine("Socket was set to Blocking mode successfully"); - } - // - } -}; - -int main() {} diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp deleted file mode 100644 index 847ace50a90..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp +++ /dev/null @@ -1,449 +0,0 @@ -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; - -// -// Displays sending with a connected socket -// using the overload that takes a buffer. -int SendReceiveTest1( Socket^ server ) -{ - array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); - array^ bytes = gcnew array(256); - try - { - // Blocks until send returns. - int byteCount = server->Send( msg ); - Console::WriteLine( "Sent {0} bytes.", byteCount.ToString() ); - - // Get reply from the server. - byteCount = server->Receive( bytes ); - if ( byteCount > 0 ) - { - Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); - return ( e->ErrorCode ); - } - return 0; -} -// - -// Displays receiving from a connected tcp socket -// using the overload that takes a buffer. -int ReceiveTest1( Socket^ client ) -{ - array^ bytes = gcnew array(256); - try - { - // It is usually preferable to use the overload - // that allows you to specify the maximum bytes returned. - if ( client->Available > 256 ) - { - throw gcnew ApplicationException( "This test socket only takes messages < 256 bytes." ); - } - // Blocks until read returns. - int byteCount = client->Receive( bytes ); - if ( byteCount > 0 ) - { - Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); - } - // Send reply to the client. - client->Send( Encoding::UTF8->GetBytes( "Bye." ) ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); - return ( e->ErrorCode ); - } - return 0; -} - -// -// Displays sending with a connected socket -// using the overload that takes a buffer and socket flags. -int SendReceiveTest2( Socket^ server ) -{ - array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); - array^ bytes = gcnew array(256); - try - { - // Blocks until send returns. - int byteCount = server->Send( msg, SocketFlags::None ); - Console::WriteLine( "Sent {0} bytes.", byteCount.ToString() ); - - // Get reply from the server. - byteCount = server->Receive( bytes, SocketFlags::None ); - if ( byteCount > 0 ) - { - Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); - return (e->ErrorCode); - } - return 0; -} -// - -// -// Displays sending with a connected socket -// using the overload that takes a buffer, message size, and socket flags. -int SendReceiveTest3( Socket^ server ) -{ - array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); - array^ bytes = gcnew array(256); - try - { - // Blocks until send returns. - int i = server->Send( msg, msg->Length, SocketFlags::None ); - Console::WriteLine( "Sent {0} bytes.", i.ToString() ); - - // Get reply from the server. - int byteCount = server->Receive( bytes, server->Available, - SocketFlags::None ); - if ( byteCount > 0 ) - { - Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); - return (e->ErrorCode); - } - return 0; -} -// - -// -// Displays sending with a connected socket -// using the overload that takes a buffer, offset, message size, and socket flags. -int SendReceiveTest4( Socket^ server ) -{ - array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); - array^ bytes = gcnew array(256); - try - { - - // Blocks until send returns. - int byteCount = server->Send( msg, 0, msg->Length, SocketFlags::None ); - Console::WriteLine( "Sent {0} bytes.", byteCount.ToString() ); - - // Get reply from the server. - byteCount = server->Receive( bytes, 0, server->Available, - SocketFlags::None ); - if ( byteCount > 0 ) - { - Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); - return (e->ErrorCode); - } - return 0; -} -// - -public ref class NeedForDelegates -{ -public: - - // - static void SendTo1() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); - Console::WriteLine( "Sending data." ); - // This call blocks. - s->SendTo( msg, endPoint ); - s->Close(); - } - // - - // - static void SendTo2() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); - Console::WriteLine( "Sending data." ); - // This call blocks. - s->SendTo( msg, SocketFlags::None, endPoint ); - s->Close(); - } - // - - // - static void SendTo3() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); - Console::WriteLine( "Sending data." ); - // This call blocks. - s->SendTo( msg, msg->Length, SocketFlags::None, endPoint ); - s->Close(); - } - // - - // - static void SendTo4() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); - Console::WriteLine( "Sending data." ); - // This call blocks. - s->SendTo( msg, 0, msg->Length, SocketFlags::None, endPoint ); - s->Close(); - } - // - - // The ReceiveFroms - // - static void ReceiveFrom1() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - // Creates an IPEndPoint to capture the identity of the sending host. - IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); - EndPoint^ senderRemote = safe_cast(sender); - - // Binding is required with ReceiveFrom calls. - s->Bind( endPoint ); - - array^ msg = gcnew array(256); - Console::WriteLine( "Waiting to receive datagrams from client..." ); - - // This call blocks. - s->ReceiveFrom( msg, senderRemote ); - s->Close(); - } - // - - // - static void ReceiveFrom2() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - // Creates an IpEndPoint to capture the identity of the sending host. - IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); - EndPoint^ senderRemote = safe_cast(sender); - - // Binding is required with ReceiveFrom calls. - s->Bind( endPoint ); - - array^ msg = gcnew array(256); - Console::WriteLine( "Waiting to receive datagrams from client..." ); - // This call blocks. - s->ReceiveFrom( msg, SocketFlags::None, senderRemote ); - s->Close(); - } - // - - // - static void ReceiveFrom3() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - // Creates an IPEndPoint to capture the identity of the sending host. - IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); - EndPoint^ senderRemote = safe_cast(sender); - - // Binding is required with ReceiveFrom calls. - s->Bind( endPoint ); - - array^ msg = gcnew array(256); - Console::WriteLine( "SWaiting to receive datagrams from client..." ); - // This call blocks. - s->ReceiveFrom( msg, msg->Length, SocketFlags::None, senderRemote ); - s->Close(); - } - // - - // - static void ReceiveFrom4() - { - IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Dgram, - ProtocolType::Udp ); - - // Creates an IpEndPoint to capture the identity of the sending host. - IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); - EndPoint^ senderRemote = safe_cast(sender); - - // Binding is required with ReceiveFrom calls. - s->Bind( endPoint ); - - array^ msg = gcnew array(256); - Console::WriteLine( "SWaiting to receive datagrams from client..." ); - // This call blocks. - s->ReceiveFrom( msg, 0, msg->Length, SocketFlags::None, senderRemote ); - s->Close(); - } - // - // end NeedForDelegates -}; - -void RunUdpTests() -{ - // Test the upd versions. - - //NeedForDelegates^ n = new NeedForDelegates(); - ThreadStart^ myThreadDelegate = gcnew ThreadStart( &NeedForDelegates::ReceiveFrom1 ); - Thread^ myThread1 = gcnew Thread( myThreadDelegate ); - myThread1->Start(); - - while ( myThread1->IsAlive ) - { - NeedForDelegates::SendTo1(); - } - myThread1->Join(); - - Console::WriteLine( "UDP test2" ); - Thread^ myThread2 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom2 ) ); - myThread2->Start(); - while ( myThread2->IsAlive ) - { - NeedForDelegates::SendTo2(); - } - myThread2->Join(); - - Console::WriteLine( "UDP test3" ); - Thread^ myThread3 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom3 ) ); - myThread3->Start(); - while ( myThread3->IsAlive ) - { - NeedForDelegates::SendTo3(); - } - myThread3->Join(); - - Console::WriteLine( "UDP test4" ); - Thread^ myThread4 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom4 ) ); - myThread4->Start(); - while ( myThread4->IsAlive ) - { - NeedForDelegates::SendTo4(); - } - myThread4->Join(); -} - -//Main tests the snippets. -// To test tcp - run 2 instances source /s runs server, source /c runs client. -// To test Upd run source /u. -int main( int /*argc*/, char *args[] ) -{ - String^ host; - bool isServer; - - if ( args[ 1 ][ 1 ] == 'c' ) - { - isServer = false; - host = "127.0.0.1"; - } - else - if ( args[ 1 ][ 1 ] == 'u' ) - { - Console::WriteLine( "running udptests" ); - RunUdpTests(); - return 0; - } - else - { - host = "localhost"; - isServer = true; - } - - // Set up the endpoint and create the socket. - IPHostEntry^ hostEntry = Dns::Resolve( host ); - IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); - - // Test the TCPIP snippets (Socket.Send and Socket.Receive) - - Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, - SocketType::Stream, - ProtocolType::Tcp ); - - // Send or receive the test messages. - if ( isServer ) - { - Socket^ sender = nullptr; - s->Bind( endPoint ); - s->Listen( 1 ); - for ( ; ; ) - { - sender = s->Accept(); - // exchange messages with all clients tests - for ( int i = 0; i < 4; i++ ) - { - ReceiveTest1( sender ); - } - sender->Close(); - s->Close(); - Environment::Exit( 0 ); - } - } - // Its the client tcp tests. - else - { - s->Connect( endPoint ); - SendReceiveTest1( s ); - SendReceiveTest2( s ); - SendReceiveTest3( s ); - SendReceiveTest4( s ); - s->Close(); - } - - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp b/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp deleted file mode 100644 index e40bac9464b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#using - -using namespace System; -using namespace System::EnterpriseServices; -using namespace System::Runtime::InteropServices; -using namespace System::Reflection; - -[assembly:AssemblyKeyFile("key.snk")]; -[assembly:ApplicationName("Queued Component")]; -[assembly:ApplicationID("AC6F4BE6-66E5-4a94-8162-A7F850150F9F")]; -[assembly:ApplicationActivation(ActivationOption::Server)]; -// Ensure that the example shows how to call the queued component. -// See QueuedComponentClient for example - -// -// Mark the COM+ application as queued at compile time by using the -// ApplicationQueuing attribute. Enable the COM+ listener by -// setting the QueueListenerEnabled to true -[assembly:ApplicationQueuing(Enabled=true,QueueListenerEnabled=true)]; -// - -[Guid("9A6233C4-7459-4c1a-808A-905FC648B5A8")] -// -public interface class IQueuedComponent -{ - void QueuedTask(); -}; - - -// Mark IQueuedComponent interface as queued -// Create the queued component class by inheriting the -// System.EnterpriseServices.ServicedComponent class and an -// interface that is marked as queued with the InterfaceQueuing attribute - -[InterfaceQueuing(true,Interface="IQueuedComponent")] -public ref class QueuedComponent sealed: public ServicedComponent, public IQueuedComponent -{ -public: - virtual void QueuedTask() - { - // Perform queued task here - } - -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp b/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp deleted file mode 100644 index 3a9ce016420..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using - -using namespace System; - -[STAThread] -int main() -{ - for ( int counter = 0; counter < 10; counter++ ) - { - - // - // Use BindToMoniker to run the queued moniker, to get an instance of the recorder - IQueuedComponent ^ qc = dynamic_cast(System::Runtime::InteropServices::Marshal::BindToMoniker( "queue:/new:QueuedComponent" )); - - // Call the method that will be recorded - qc->QueuedTask(); - - // Force the release of the recorder object, to send the message to the queue - System::Runtime::InteropServices::Marshal::ReleaseComObject( qc ); - // - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp deleted file mode 100644 index 83b7a7e0a9d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp +++ /dev/null @@ -1,355 +0,0 @@ - - -// -// This program contains snippets applicable to the following: -// System::Net::AuthenticationManger (Snippet1); -// System::Net::AuthenticationManger::Register (Snippet2); -// System::Net::AuthenticationUnregister (Snippet2); -// System::Net::AuthenticationManger::RegisteredModules (Snippet8); -// System::Net::Authorization::Authorization (Snippet3); -// System::Net::Authorization::Message (Snippet5); -// System::Net::Authorization::Complete (Snippet5); -// System::Net::Authorization::GroupId (Snippet5); -// System::Net::IAuthenticationModule* (Snippet6); -// System::Net::IAuthenticationModule*.AuthenticationType (Snippet7); -// System::Net::IAuthenticationModule*.CanPreAuthenticate (Snippet7); -// System::Net::IAuthenticationModule*.Authenticate (Snippet3); -// System::Net::IAuthenticationModule*.PreAuthenticate (Snippet4); -// -// -// This program shows how to create a custom Basic authentication module, -// how to register it via the AuthenticationManager class and how to authorize -// users to access a Web site. -// Note: In order to run this program you must create a test Web site that performs -// Basic authentication. Also you must add to your server machine a user whose -// credentials are the same you use in this program. -// Attention: Basic authenticastion sends the user's credentials over HTTP. -// Passwords and user names are encoded using Base64 encoding. Although the -// user information is encoded, it is considered insecure due to the fact that it -// could be deciphered relatively easily. -// If you must use basic authentication you are strongly adviced to use strong -// security mechanisms, such as SSL, when transfering sensitive information on -// the wire. -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Collections; - -// The TestAuthentication class performs the following main tasks: -// 1) It obtains the user's credentials. -// 2) Unregisters the standard Basic authentication. -// 3) Registers the customized Basic authentication. -// 4) Reads the selected page and displays it on the console. -ref class TestAuthentication -{ -public: - static String^ username; - static String^ password; - static String^ domain; - static String^ uri; - - // Show how to use this program. - static void showusage() - { - Console::WriteLine( "Attempts to authenticate to a URL" ); - Console::WriteLine( "\r\nUse one of the following:" ); - Console::WriteLine( "\tcustomBasicAuthentication URL username password domain" ); - Console::WriteLine( "\tcustomBasicAuthentication URL username password" ); - Console::WriteLine( "\r\nExample:" ); - Console::WriteLine( "\tcustomBasicAuthentication http://ndpue/ncl/ basicuser basic.101 ndpue" ); - } - - - // - // Display registered authentication modules. - static void displayRegisteredModules() - { - - // The AuthenticationManager calls all authentication modules sequentially - // until one of them responds with an authorization instance. Show - // the current registered modules, for testing purposes. - IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; - Console::WriteLine( "\r\nThe following authentication modules are now registered with the system" ); - while ( registeredModules->MoveNext() ) - { - Console::WriteLine( "\r \n Module : {0}", registeredModules->Current ); - IAuthenticationModule^ currentAuthenticationModule = dynamic_cast(registeredModules->Current); - Console::WriteLine( "\t CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate ); - } - } - - - // - // The getPage method accesses the selected page an displays its content - // on the console. - static void getPage( String^ url ) - { - try - { - - // Create the Web request object. - HttpWebRequest^ req = dynamic_cast(WebRequest::Create( url )); - - // Define the request access method. - req->Method = "GET"; - - // Define the request credentials according to the user's input. - if ( String::Compare( domain, String::Empty ) == 0 ) - req->Credentials = gcnew NetworkCredential( username,password ); // If the user's specifies the Internet resource domain, this usually - else - req->Credentials = gcnew NetworkCredential( username,password,domain ); - - // is by default the name of the sever hosting the resource. - // Issue the request. - // req->GetResponse(); - HttpWebResponse^ result = dynamic_cast(req->GetResponse()); - Console::WriteLine( "\nAuthentication Succeeded:" ); - - // Store the response. - Stream^ sData = result->GetResponseStream(); - - // Display the response. - displayPageContent( sData ); - } - catch ( WebException^ e ) - { - - // Display the error, if any. In particular display protocol - // related error. - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - HttpWebResponse^ hresp = dynamic_cast(e->Response); - Console::WriteLine( "\nAuthentication Failed, {0}", hresp->StatusCode ); - Console::WriteLine( "Status Code: {0}", (int)hresp->StatusCode ); - Console::WriteLine( "Status Description: {0}", hresp->StatusDescription ); - return; - } - Console::WriteLine( "Caught Exception: {0}", e->Message ); - Console::WriteLine( "Stack: {0}", e->StackTrace ); - } - - } - - - // The displayPageContent method display the content of the - // selected page. - static void displayPageContent( Stream^ ReceiveStream ) - { - - // Create an ASCII encoding object. - Encoding^ ASCII = Encoding::ASCII; - - // Define the Byte array to temporary hold the current read bytes. - array^read = gcnew array(512); - Console::WriteLine( "\r\nPage Content...\r\n" ); - - // Read the page content and display it on the console. - // Read the first 512 bytes. - int bytes = ReceiveStream->Read( read, 0, 512 ); - while ( bytes > 0 ) - { - Console::Write( ASCII->GetString( read, 0, bytes ) ); - bytes = ReceiveStream->Read( read, 0, 512 ); - } - - Console::WriteLine( "" ); - } - -}; - - -// -// The CustomBasic class creates a custom Basic authentication by implementing the -// IAuthenticationModule interface. In particular it performs the following -// tasks: -// 1) Defines and initializes the required properties. -// 2) Impements the Authenticate method. -public ref class CustomBasic: public IAuthenticationModule -{ -private: - - // - String^ m_authenticationType; - bool m_canPreAuthenticate; - -public: - - // The CustomBasic constructor initializes the properties of the customized - // authentication. - CustomBasic() - { - m_authenticationType = "Basic"; - m_canPreAuthenticate = false; - } - - - property String^ AuthenticationType - { - - // Define the authentication type. This type is then used to identify this - // custom authentication module. The default is set to Basic. - virtual String^ get() - { - return m_authenticationType; - } - - } - - property bool CanPreAuthenticate - { - - // Define the pre-authentication capabilities for the module. The default is set - // to false. - virtual bool get() - { - return m_canPreAuthenticate; - } - - } - - // - // The checkChallenge method checks if the challenge sent by the HttpWebRequest - // contains the correct type (Basic) and the correct domain name. - // Note: the challenge is in the form BASIC REALM=S"DOMAINNAME" - // and you must assure that the Internet Web site resides on a server whose - // domain name is equal to DOMAINAME. - bool checkChallenge( String^ Challenge, String^ domain ) - { - bool challengePasses = false; - String^ tempChallenge = Challenge->ToUpper(); - - // Verify that this is a Basic authorization request and the requested domain - // is correct. - // Note: When the domain is an empty string the following code only checks - // whether the authorization type is Basic. - if ( tempChallenge->IndexOf( "BASIC" ) != -1 ) - if ( String::Compare( domain, String::Empty ) != 0 ) - if ( tempChallenge->IndexOf( domain->ToUpper() ) != -1 ) - challengePasses = true; // The domain is not allowed and the authorization type is Basic. - else - challengePasses = false; - - else - challengePasses = true; - - - return challengePasses; - } - - - // - // The PreAuthenticate method specifies if the authentication implemented - // by this class allows pre-authentication. - // Even if you do not use it, this method must be implemented to obey to the rules - // of interface implemebtation. - // In this case it always returns null. - virtual Authorization^ PreAuthenticate( WebRequest^ request, ICredentials^ credentials ) - { - return nullptr; - } - - - // - // - // Authenticate is the core method for this custom authentication. - // When an internet resource requests authentication, the WebRequest::GetResponse - // method calls the AuthenticationManager::Authenticate method. This method, in - // turn, calls the Authenticate method on each of the registered authentication - // modules, in the order they were registered. When the authentication is - // complete an Authorization object is returned to the WebRequest, as - // shown by this routine's retun type. - virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) - { - Encoding^ ASCII = Encoding::ASCII; - - // Get the username and password from the credentials - NetworkCredential^ MyCreds = credentials->GetCredential( request->RequestUri, "Basic" ); - if ( PreAuthenticate( request, credentials ) == nullptr ) - Console::WriteLine( "\n Pre-authentication is not allowed." ); - else - Console::WriteLine( "\n Pre-authentication is allowed." ); - - - // Verify that the challenge satisfies the authorization requirements. - bool challengeOk = checkChallenge( challenge, MyCreds->Domain ); - if ( !challengeOk ) - return nullptr; - - - // - // Create the encrypted string according to the Basic authentication format as - // follows: - // a)Concatenate username and password separated by colon; - // b)Apply ASCII encoding to obtain a stream of bytes; - // c)Apply Base64 Encoding to this array of bytes to obtain the encoded - // authorization. - String^ BasicEncrypt = String::Concat( MyCreds->UserName, ":", MyCreds->Password ); - String^ BasicToken = String::Concat( "Basic ", Convert::ToBase64String( ASCII->GetBytes( BasicEncrypt ) ) ); - - // Create an Authorization object using the above encoded authorization. - Authorization^ resourceAuthorization = gcnew Authorization( BasicToken ); - - // Get the Message property which contains the authorization string that the - // client returns to the server when accessing protected resources - Console::WriteLine( "\n Authorization Message: {0}", resourceAuthorization->Message ); - - // Get the Complete property which is set to true when the authentication process - // between the client and the server is finished. - Console::WriteLine( "\n Authorization Complete: {0}", resourceAuthorization->Complete ); - - // - Console::WriteLine( "\n Authorization ConnectionGroupId: {0}", resourceAuthorization->ConnectionGroupId ); - return resourceAuthorization; - } - - // -}; - - -// -// This is the program entry point. It allows the user to enter -// her credentials and the Internet resource (Web page) to access. -// It also unregisters the standard and registers the customized basic -// authentication. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 4 ) - TestAuthentication::showusage(); - else - { - - // Read the user's credentials. - TestAuthentication::uri = args[ 1 ]; - TestAuthentication::username = args[ 2 ]; - TestAuthentication::password = args[ 3 ]; - if ( args->Length == 4 ) - TestAuthentication::domain = String::Empty; // If the domain exists, store it. Usually the domain name - else - TestAuthentication::domain = args[ 4 ]; - - // is by default the name of the server hosting the Internet - // resource. - // Instantiate the custom Basic authentication module. - CustomBasic^ customBasicModule = gcnew CustomBasic; - - // Unregister the standard Basic authentication module. - AuthenticationManager::Unregister( "Basic" ); - - // Register the custom Basic authentication module. - AuthenticationManager::Register( customBasicModule ); - - // Display registered Authorization modules. - TestAuthentication::displayRegisteredModules(); - - // Read the specified page and display it on the console. - TestAuthentication::getPage( TestAuthentication::uri ); - } -} - -// -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp deleted file mode 100644 index 6c79604640f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; -using namespace System::Collections; - -ref class DNSChanges -{ - -// -public: - static void DoGetHostEntry(String^ hostname) - { - IPHostEntry^ host = Dns::GetHostEntry(hostname); - - Console::WriteLine("GetHostEntry({0}) returns:", host->HostName); - - for (int i = 0; i < host->AddressList->Length; i++) - { - Console::WriteLine(" {0}", host->AddressList[i]->ToString()); - } - } -// - -// -public: - static void DoGetHostEntry(IPAddress^ address) - { - IPHostEntry^ host = Dns::GetHostEntry(address); - - Console::WriteLine("GetHostEntry({0}) returns HostName: {1}", address->ToString(), host->HostName); - } -// - -// - // Determine the Internet Protocol(IP) addresses for a host. -public: - static void DoGetHostAddress(String^ hostname) - { - array^ addresses; - addresses = Dns::GetHostAddresses(hostname); - - Console::WriteLine("GetHostAddresses({0}) returns:", hostname); - for each (IPAddress^ address in addresses) - { - Console::Write("{0} ", address); - } - Console::WriteLine(""); - } -// - -// - // Signals when the resolve has finished. -public: - static ManualResetEvent^ GetHostEntryFinished = - gcnew ManualResetEvent(false); - - // define the state object for the callback. - // use hostName to correlate calls with the proper result. - ref class ResolveState - { - public: - String^ hostName; - IPHostEntry^ resolvedIPs; - - ResolveState(String^ host) - { - hostName = host; - } - - property IPHostEntry^ IPs - { - IPHostEntry^ get() - { - return resolvedIPs; - } - - void set(IPHostEntry^ IPs) - { - resolvedIPs = IPs; - } - } - - property String^ host - { - String^ get() - { - return hostName; - } - - void set(String^ host) - { - hostName = host; - } - } - }; - - // Record the IPs in the state object for later use. - static void GetHostEntryCallback(IAsyncResult^ ar) - { - ResolveState^ ioContext = (ResolveState^)(ar->AsyncState); - - ioContext->IPs = Dns::EndGetHostEntry(ar); - GetHostEntryFinished->Set(); - } - - - // Determine the Internet Protocol(IP) addresses for this - // host asynchronously. -public: - static void DoGetHostEntryAsync(String^ hostName) - { - GetHostEntryFinished->Reset(); - ResolveState^ ioContext = gcnew ResolveState(hostName); - - Dns::BeginGetHostEntry(ioContext->host, - gcnew AsyncCallback(GetHostEntryCallback), ioContext); - // Wait here until the resolve completes - // (the callback calls .Set()) - GetHostEntryFinished->WaitOne(); - - Console::WriteLine("EndGetHostEntry({0}) returns:", ioContext->host); - - for (int i = 0; i < ioContext->IPs->AddressList->Length; i++) - { - Console::WriteLine(" {0}", ioContext->IPs->AddressList[i]->ToString()); - } - -// for each (IPAddress^ address in ioContext->IPs) -// { -// Console::WriteLine("{0} ", address); -// } - } -// -}; - -int main() -{ - DNSChanges::DoGetHostEntry("www.contoso.com"); - DNSChanges::DoGetHostEntry(IPAddress::Parse("127.0.0.1")); - DNSChanges::DoGetHostAddress("www.contoso.com"); - DNSChanges::DoGetHostEntryAsync(""); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp deleted file mode 100644 index 5896e74c960..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp +++ /dev/null @@ -1,120 +0,0 @@ - - -// -// This program contains examples for the following types and methods: -// System::Net::FileWebRequest::GetResponse; -// -// -// -// This program shows how to use the FileWebRequest::GetResponse method -// to read and display the content of a file passed by the user. -// Note. In order for this program to work, the folder containing the test file -// must be shared with its permissions set to allow read access. -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -ref class TestGetResponse -{ -private: - static FileWebResponse^ myFileWebResponse; - static void showUsage() - { - Console::WriteLine( "\nPlease enter file name:" ); - Console::WriteLine( "Usage: cs_getresponse //" ); - Console::WriteLine( "Example: cs_getresponse ndpue/temp/hello.txt" ); - } - - static bool makeFileRequest( String^ fileName ) - { - bool requestOk = false; - try - { - Uri^ myUrl = gcnew Uri( String::Format( "file://{0}", fileName ) ); - - // Create a Filewebrequest object using the passed Uri. - FileWebRequest^ myFileWebRequest = dynamic_cast(WebRequest::Create( myUrl )); - - // Get the FileWebResponse object. - myFileWebResponse = dynamic_cast(myFileWebRequest->GetResponse()); - requestOk = true; - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException: {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "UriFormatWebException: {0}", e->Message ); - } - - return requestOk; - } - - static void readFile() - { - try - { - - // Create the file stream. - Stream^ receiveStream = myFileWebResponse->GetResponseStream(); - - // Create a reader object to read the file content. - StreamReader^ readStream = gcnew StreamReader( receiveStream ); - - // Create a local buffer for a temporary storage of the - // read data. - array^readBuffer = gcnew array(256); - - // Read the first up to 256 bytes. - int count = readStream->Read( readBuffer, 0, 256 ); - Console::WriteLine( "The file content is:" ); - Console::WriteLine( "" ); - - // Loop to read the remaining bytes in 256 blocks - // and display the data on the console. - while ( count > 0 ) - { - String^ str = gcnew String( readBuffer,0,count ); - Console::WriteLine( "{0}\n", str ); - count = readStream->Read( readBuffer, 0, 256 ); - } - readStream->Close(); - - // Release the response object resources. - myFileWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "The WebException: {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "The UriFormatException: {0}", e->Message ); - } - - } - - -public: - static void Main() - { - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - showUsage(); - else - { - if ( makeFileRequest( args[ 1 ] ) ) - readFile(); - } - } - -}; - -int main() -{ - TestGetResponse::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp deleted file mode 100644 index 0dc5fc9d3fe..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp +++ /dev/null @@ -1,134 +0,0 @@ - - -// -// This program contains examples for the following types and methods: -// System::Net::FileWebRequest (Snippet1); System::Net::FileWebRequest::Method (Snippet2); -// System::Net::FileWebRequest::Timeout (Snippet3); -// System::Net::FileWebRequest::ContentLength (Snippet4). -// System::Net::FileWebRequest::GetRequestStream (Snippet5); -// -// -// This program creates or open a text file in which it stores a string. -// Both file and string are passed by the user. -// Note. In order for this program to work, the folder containing the test file -// must be shared with its permissions set to allow write access. -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Net; -ref class TestGetRequestStream -{ -private: - static FileWebRequest^ myFileWebRequest; - static void showUsage() - { - Console::WriteLine( "\nPlease enter file name and timeout :" ); - Console::WriteLine( "Usage: cs_getrequeststream // timeout" ); - Console::WriteLine( "Example: cs_getrequeststream ndpue/temp/hello.txt 1000" ); - Console::WriteLine( "Small timeout values (for instance 3 or less) cause a timeout exception." ); - } - - static void makeFileRequest( String^ fileName, int timeout ) - { - try - { - - // - // - // Create a Uri object. - Uri^ myUrl = gcnew Uri( String::Format( "file://{0}", fileName ) ); - - // Create a FileWebRequest object. - myFileWebRequest = dynamic_cast(WebRequest::CreateDefault( myUrl )); - - // Set the timeout to the value selected by the user. - myFileWebRequest->Timeout = timeout; - - // - // Set the Method property to POST - myFileWebRequest->Method = "POST"; - - // - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException: {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "UriFormatWebException: {0}", e->Message ); - } - - } - - static void writeToFile() - { - try - { - - // - // Enter the string to write into the file. - Console::WriteLine( "Enter the string you want to write:" ); - String^ userInput = Console::ReadLine(); - - // Convert the string to Byte array. - ASCIIEncoding^ encoder = gcnew ASCIIEncoding; - array^byteArray = encoder->GetBytes( userInput ); - - // - // Set the ContentLength property. - myFileWebRequest->ContentLength = byteArray->Length; - String^ contentLength = myFileWebRequest->ContentLength.ToString(); - Console::WriteLine( "\nThe content length is {0}.", contentLength ); - - // - // Get the file stream handler to write into the file. - Stream^ readStream = myFileWebRequest->GetRequestStream(); - - // Write to the file stream. - // Note. In order for this to work the file must be accessible - // on the network. This can be accomplished by setting the property - // sharing of the folder containg the file. The permissions - // can be set so everyone can modify the file. - // FileWebRequest::Credentials property cannot be used for this purpose. - readStream->Write( byteArray, 0, userInput->Length ); - Console::WriteLine( "\nThe String you entered was successfully written into the file." ); - - // - readStream->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "The WebException: {0}", e->Message ); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "The UriFormatWebException: {0}", e->Message ); - } - - } - - -public: - static void Main() - { - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 3 ) - showUsage(); - else - { - makeFileRequest( args[ 1 ], Int32::Parse( args[ 2 ] ) ); - writeToFile(); - } - } - -}; - -int main() -{ - TestGetRequestStream::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp deleted file mode 100644 index 826067e44c3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/** -* File name: ipaddress_none_any_loopback.cs -* Exercise the IPAddress IPv6None, IPv6Any, and IPv6Loopback properties. -* Usage: cs_nal.exe. -**/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -// -// This method displays the value of the current host loopback address in -// standard compressed format. -void displayIPv6LoopBackAddress() -{ - try - { - // Get the loopback address. - IPAddress^ loopBack = IPAddress::IPv6Loopback; - - // Transform the loop-back address to a string using the overladed - // ToString() method. Note that the resulting string is in the compact - // form: "::1". - String^ ipv6LoopBack = loopBack->ToString(); - Console::WriteLine( "The IPv6 Loopback address is: {0}", ipv6LoopBack ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "->Item[displayIPv6LoopBackAddress] Exception: {0}", e ); - } -} -// - -// -// This method displays the value of the current host's Any address in -// standard compressed format. The Any address is used by the host to enable -// listening to client activities on all the interfaces for a given port. -void displayIPv6AnyAddress() -{ - try - { - // Get the Any address. - IPAddress^ any = IPAddress::IPv6Any; - - // Transform the Any address to a string using the overloaded - // ToString() method. Note that the resulting string is in the compact - // form: "::". - String^ ipv6Any = any->ToString(); - - // Display the Any address. - Console::WriteLine( "The IPv6 Any address is: {0}", ipv6Any ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "->Item[displayIPv6AnyAddress] Exception: {0}", e ); - } -} -// - -// -// This method displays the value of the current host's None address in -// standard compressed format. The None address is used by the host to disable -// listening to client activities on all the interfaces. -void displayIPv6NoneAddress() -{ - try - { - // Get the None address. - IPAddress^ none = IPAddress::IPv6None; - - // Transform the None address to a string using the overloaded - // ToString() method. Note that the resulting string is in the compact - // form: "::". - String^ ipv6None = none->ToString(); - - Console::WriteLine( "The IPv6 None address is: {0}", ipv6None ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "->Item[displayIPv6NoneAddress] Exception: {0}", e ); - } -} -// - -// -// This function checks whether the passed string represents a loop-back address. -void checkIPv6LoopBackAddress( String^ ipAddress ) -{ - try - { - // Parse the passed String* to obtain the internal address - // representation. - IPAddress^ loopBack = IPAddress::Parse( ipAddress ); - - // Verify that the address is a loopback address. - bool isLoopBack = IPAddress::IsLoopback( loopBack ); - - // Build the message. - String^ msg; - if ( isLoopBack ) - { - msg = " is a loop back address."; - } - else - { - msg = " is not a loop back address."; - } - - // Display the results. - Console::WriteLine( String::Concat( ipAddress, msg ) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "->Item[displayIPv6LoopBackAddress] Exception: {0}", e ); - } -} -// - -int main() -{ - // Verify that the current host supports IPv6 and also call WSAStartup. - // If you do not use any IPv6 methods that call WSAStartup, you will get a - // SocketException when using IPv6Loopback, IPv6Any or IPv6None. - - bool ipv6Supported = Socket::SupportsIPv6; - - // Display current host Loopback address. - displayIPv6LoopBackAddress(); - - // Display the current host's Any address. - displayIPv6AnyAddress(); - - // Display the current host's None address. - displayIPv6NoneAddress(); - - // Check that this is a loopback address. - checkIPv6LoopBackAddress( "0::1" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp deleted file mode 100644 index 8c206f281c1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -/* -This program checks whether the specified address is a loopback address. -It invokes the IPAddress Parse method to translate the address -input String* into the correct internal format. -The IP address String* must be in dotted-quad notation for IPv4 or in -colon-hexadecimal notation for IPv6. -*/ -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; - -// This method calls the IPAddress::Parse method to check if the -// passed ipAddress parameter is in the correct format. -// Then it checks whether it represents a loopback address. -// Finally, it displays the results. -void parse( String^ ipAddress ) -{ - String^ loopBack = " is not a loopback address."; - try - { - - // Perform syntax check by parsing the address string entered by the user. - IPAddress^ address = IPAddress::Parse( ipAddress ); - - // Perform semantic check by verifying that the address is a valid IPv4 - // or IPv6 loopback address. - if ( IPAddress::IsLoopback( address ) && address->AddressFamily == AddressFamily::InterNetworkV6 ) - loopBack = String::Concat( " is an IPv6 loopback address whose internal format is: ", address, "." ); - else - if ( IPAddress::IsLoopback( address ) && address->AddressFamily == AddressFamily::InterNetwork ) - loopBack = String::Concat( " is an IPv4 loopback address whose internal format is: ", address, "." ); - - // Display the results. - Console::WriteLine( "Your input address: \" {0} \" {1}", ipAddress, loopBack ); - } - catch ( FormatException^ e ) - { - Console::WriteLine( "FormatException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length == 1 ) - { - - // No parameters entered. Display program usage. - Console::WriteLine( "Please enter an IP address." ); - Console::WriteLine( "Usage: >ipaddress_isloopback any IPv4 or IPv6 address." ); - Console::WriteLine( "Example: >ipaddress_isloopback 127.0.0.1" ); - Console::WriteLine( "Example: >ipaddress_isloopback 0:0:0:0:0:0:0:1" ); - } - else - parse( args[ 1 ] ); - - - // Parse the address string entered by the user. -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp deleted file mode 100644 index e6b401756d0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -/* -This program converts a String* containing an IP address, in dotted-quad notation for -IPv4 or in colon-hexadecimal for IPv6, into an instance of the IPAddress class. -Then it uses the overloaded IPAddress ToString method to display the address in -its standard notation. -*/ -// -#using - -using namespace System; -using namespace System::Net; - -// This method calls the IPAddress::Parse method to check the ipAddress -// input string. If the ipAddress argument represents a syntatically correct IPv4 or -// IPv6 address, the method displays the Parse output into quad-notation or -// colon-hexadecimal notation, respectively. Otherwise, it displays an -// error message. -void parse( String^ ipAddress ) -{ - try - { - - // Create an instance of IPAddress for the specified address string (in - // dotted-quad, or colon-hexadecimal notation). - IPAddress^ address = IPAddress::Parse( ipAddress ); - - // Display the address in standard notation. - Console::WriteLine( "Parsing your input string: \"{0}\" produces this address (shown in its standard notation): {1}", ipAddress, address ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( FormatException^ e ) - { - Console::WriteLine( "FormatException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - String^ IPaddress; - if ( args->Length == 1 ) - { - Console::WriteLine( "Please enter an IP address." ); - Console::WriteLine( "Usage: >cs_parse any IPv4 or IPv6 address." ); - Console::WriteLine( "Example: >cs_parse 127.0.0.1" ); - Console::WriteLine( "Example: >cs_parse 0:0:0:0:0:0:0:1" ); - return 0; - } - else - IPaddress = args[ 1 ]; - - - // Get the list of the IPv6 addresses associated with the requested host. - parse( IPaddress ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp deleted file mode 100644 index 8aa6b94aeb4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp +++ /dev/null @@ -1,142 +0,0 @@ - - -// -// File name: ipaddress.cpp -// The snippets contained here apply to: -// 1) System.Net.IPAddress.AddressFamily, snippet3. -// 2) System.Net.IPAddess.ScopeId, snippet3. -// more -// -// -// This program shows how to use the IPAddress class to obtain a server -// IP addressess and related information. -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text::RegularExpressions; - -/** -* The IPAddresses method obtains the selected server IP address information. -* It then displays the type of address family supported by the server and its -* IP address in standard and byte format. -**/ -void IPAddresses( String^ server ) -{ - try - { - System::Text::ASCIIEncoding^ ASCII = gcnew System::Text::ASCIIEncoding; - - // Get server related information. - IPHostEntry^ heserver = Dns::GetHostEntry( server ); - - // Loop on the AddressList - System::Collections::IEnumerator^ myEnum = heserver->AddressList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - IPAddress^ curAdd = safe_cast(myEnum->Current); - - // - // Display the type of address family supported by the server. If the - // server is IPv6-enabled this value is: InterNetworkV6. If the server - // is also IPv4-enabled there will be an additional value of InterNetwork. - Console::WriteLine( "AddressFamily: {0}", curAdd->AddressFamily ); - - // Display the ScopeId property in case of IPV6 addresses. - if ( curAdd->AddressFamily.ToString() == ProtocolFamily::InterNetworkV6.ToString() ) - Console::WriteLine( "Scope Id: {0}", curAdd->ScopeId ); - // - - // Display the server IP address in the standard format. In - // IPv4 the format will be dotted-quad notation, in IPv6 it will be - // in in colon-hexadecimal notation. - Console::WriteLine( "Address: {0}", curAdd ); - - // Display the server IP address in byte format. - Console::Write( "AddressBytes: " ); - - // - array^bytes = curAdd->GetAddressBytes(); - for ( int i = 0; i < bytes->Length; i++ ) - { - Console::Write( bytes[ i ] ); - - } - // - - Console::WriteLine( "\r\n" ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "[DoResolve] Exception: {0}", e ); - } - -} - - -// This IPAddressAdditionalInfo displays additional server address information. -void IPAddressAdditionalInfo() -{ - try - { - // Display the flags that show if the server supports IPv4 or IPv6 - // address schemas. - Console::WriteLine( "\r\nSupportsIPv4: {0}", Socket::SupportsIPv4 ); - Console::WriteLine( "SupportsIPv6: {0}", Socket::SupportsIPv6 ); - if ( Socket::SupportsIPv6 ) - { - // Display the server Any address. This IP address indicates that the server - // should listen for client activity on all network interfaces. - Console::WriteLine( "\r\nIPv6Any: {0}", IPAddress::IPv6Any ); - - // Display the server loopback address. - Console::WriteLine( "IPv6Loopback: {0}", IPAddress::IPv6Loopback ); - - // Used during autoconfiguration first phase. - Console::WriteLine( "IPv6None: {0}", IPAddress::IPv6None ); - Console::WriteLine( "IsLoopback(IPv6Loopback): {0}", IPAddress::IsLoopback( IPAddress::IPv6Loopback ) ); - } - Console::WriteLine( "IsLoopback(Loopback): {0}", IPAddress::IsLoopback( IPAddress::Loopback ) ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "[IPAddresses] Exception: {0}", e ); - } - -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - String^ server = nullptr; - - // Define a regular expression to parse user's input. - // This is a security check. It allows only - // alphanumeric input string between 2 to 40 character long. - Regex^ rex = gcnew Regex( "^[a-zA-Z]\\w{1,39}$" ); - if ( args->Length < 2 ) - { - // If no server name is passed as an argument to this program, use the current - // server name as default. - server = Dns::GetHostName(); - Console::WriteLine( "Using current host: {0}", server ); - } - else - { - server = args[ 1 ]; - if ( !(rex->Match(server))->Success ) - { - Console::WriteLine( "Input string format not allowed." ); - return -1; - } - } - - // Get the list of the addresses associated with the requested server. - IPAddresses( server ); - - // Get additional address information. - IPAddressAdditionalInfo(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp deleted file mode 100644 index ddd7bf4588d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp +++ /dev/null @@ -1,230 +0,0 @@ - - -// File name:ipendpoint.cs. -// -// This program contains snippets applicable to the following: -// System.Net.IPEndPoint (Snippet1); -// System.Net.IPEndPoint.IPEndPoint(IPAddress, int) (Snippet2); -// System.Net.IPEndPoint.Address (Snippet3); -// System.Net.IPEndPoint.AddressFamily (Snippet3); -// System.Net.IPEndPoint.Port (Snippet3); -// System.Net.IPEndPoint.Serialize (Snippet4); -// System.Net.IPEndPoint.Create (Snippet5); -// -// -// This example uses the IPEndPoint class and its members to display the home page -// of the server selected by the user. -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text::RegularExpressions; - -// The getPage function gets the server's home page content by -// recreating the server's endpoint from the original serialized endpoint. -// Then it creates a new socket and connects it to the endpoint. -String^ getPage( String^ server, SocketAddress^ socketAddress ) -{ - //Set up variables and string to write to the server. - Encoding^ ASCII = Encoding::ASCII; - String^ Get = String::Format( "GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", server ); - array^ByteGet = ASCII->GetBytes( Get ); - array^RecvBytes = gcnew array(256); - String^ strRetPage = nullptr; - Socket^ socket = nullptr; - - // - // Recreate the connection endpoint from the serialized information. - IPEndPoint^ endpoint = gcnew IPEndPoint( (__int64)0,0 ); - IPEndPoint^ clonedIPEndPoint = dynamic_cast(endpoint->Create( socketAddress )); - Console::WriteLine( "clonedIPEndPoint: {0}", clonedIPEndPoint ); - // - - Console::WriteLine( "Press any key to continue." ); - Console::ReadLine(); - try - { - // Create a socket object to establish a connection with the server. - socket = gcnew Socket( endpoint->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); - - // Connect to the cloned end point. - socket->Connect( clonedIPEndPoint ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - - if ( socket == nullptr ) - return ("Connection to cloned endpoint failed"); - - // Send request to the server. - socket->Send( ByteGet, ByteGet->Length, static_cast(0) ); - - // Receive the server home page content. - Int32 bytes = socket->Receive( RecvBytes, RecvBytes->Length, static_cast(0) ); - - // Read the first 256 bytes. - strRetPage = String::Format( "Default HTML page on {0}:\r\n", server ); - strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); - while ( bytes > 0 ) - { - bytes = socket->Receive( RecvBytes, RecvBytes->Length, static_cast(0) ); - strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); - } - - socket->Close(); - return strRetPage; -} - -// -// The serializeEndpoint function serializes the endpoint and returns the -// SocketAddress containing the serialized endpoint data. -SocketAddress^ serializeEndpoint( IPEndPoint^ endpoint ) -{ - // Serialize IPEndPoint details to a SocketAddress instance. - SocketAddress^ socketAddress = endpoint->Serialize(); - - // Display the serialized endpoint information. - Console::WriteLine( "Endpoint.Serialize() : {0}", socketAddress ); - Console::WriteLine( "Socket->Family : {0}", socketAddress->Family ); - Console::WriteLine( "Socket->Size : {0}", socketAddress->Size ); - Console::WriteLine( "Press any key to continue." ); - Console::ReadLine(); - return socketAddress; -} -// - -// -void displayEndpointInfo( IPEndPoint^ endpoint ) -{ - Console::WriteLine( "Endpoint->Address : {0}", endpoint->Address ); - Console::WriteLine( "Endpoint->AddressFamily : {0}", endpoint->AddressFamily ); - Console::WriteLine( "Endpoint->Port : {0}", endpoint->Port ); - Console::WriteLine( "Endpoint.ToString() : {0}", endpoint ); - Console::WriteLine( "Press any key to continue." ); - Console::ReadLine(); -} -// - -// The serializeEndpoint function determines the server endpoint and then -// serializes it to obtain the related SocketAddress object. -// Note that in the for loop a temporary socket is created to ensure that -// the current IP address format matches the AddressFamily type. -// In fact, in the case of servers supporting both IPv4 and IPv6, an exception -// may arise if an IP address format does not match the address family type. -SocketAddress^ getSocketAddress( String^ server, int port ) -{ - Socket^ tempSocket = nullptr; - IPHostEntry^ host = nullptr; - SocketAddress^ serializedSocketAddress = nullptr; - try - { - // Get the object containing Internet host information. - host = Dns::Resolve( server ); - - // - // Obtain the IP address from the list of IP addresses associated with the server. - System::Collections::IEnumerator^ myEnum = host->AddressList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - IPAddress^ address = safe_cast(myEnum->Current); - IPEndPoint^ endpoint = gcnew IPEndPoint( address,port ); - tempSocket = gcnew Socket( endpoint->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); - tempSocket->Connect( endpoint ); - if ( tempSocket->Connected ) - { - // Display the endpoint information. - displayEndpointInfo( endpoint ); - - // Serialize the endpoint to obtain a SocketAddress object. - serializedSocketAddress = serializeEndpoint( endpoint ); - break; - } - else - continue; - } - // - - // Close the temporary socket. - tempSocket->Close(); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - - return serializedSocketAddress; -} - - -// The requestServerHomePage function obtains the server's home page and returns -// its content. -String^ requestServerHomePage( String^ server, int port ) -{ - String^ strRetPage = nullptr; - - // Get a socket address using the specified server and port. - SocketAddress^ socketAddress = getSocketAddress( server, port ); - if ( socketAddress == nullptr ) - strRetPage = "Connection failed"; // Obtain the server's home page content. - else - strRetPage = getPage( server, socketAddress ); - - return strRetPage; -} - - -// Show to the user how to use this program when wrong input parameters are entered. -void showUsage() -{ - Console::WriteLine( "Enter the server name as follows:" ); - Console::WriteLine( "\tcs_ipendpoint servername" ); -} - - -// This is the program entry point. It allows the user to enter -// a server name that is used to locate its current homepage. -int main() -{ - array^args = Environment::GetCommandLineArgs(); - String^ host = nullptr; - int port = 80; - - // Define a regular expression to parse user's input. - // This is a security check. It allows only - // alphanumeric input string between 2 to 40 character long. - Regex^ rex = gcnew Regex( "^[a-zA-Z]\\w{1,39}$" ); - if ( args->Length < 2 ) - showUsage(); - else - { - String^ message = args[ 1 ]; - if ( (rex->Match(message))->Success ) - { - host = args[ 1 ]; - - // Get the specified server home_page and display its content. - String^ result = requestServerHomePage( host, port ); - Console::WriteLine( result ); - } - else - Console::WriteLine( "Input string format not allowed." ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp deleted file mode 100644 index 1adf2104e7e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp +++ /dev/null @@ -1,203 +0,0 @@ - - -// -// This example shows how to use the ServicePoint and ServicePointManager classes. -// The ServicePointManager class uses the ServicePoint class to manage connections -// to a remote host. The networking classes reuse service points for all -// requests to a given URI. In fact, the same ServicePoint object -// is used to issue requests to Internet resources identified by the same -// scheme identifier (for example, HTTP) and host fragment (for example, www.contoso.com). -// This should improve your application performance. -// Reusing service points in this way can help improve application performance. -#using - -using namespace System; -using namespace System::Net; -using namespace System::Threading; -using namespace System::Text::RegularExpressions; -void ShowProperties( ServicePoint^ sp ) -{ - Console::WriteLine( "Done calling FindServicePoint()..." ); - - // - // Display the ServicePoint Internet resource address. - Console::WriteLine( "Address = {0}", sp->Address ); - - // - // - // Display the date and time that the ServicePoint was last - // connected to a host. - Console::WriteLine( "IdleSince = {0}", sp->IdleSince ); - - // Display the maximum length of time that the ServicePoint instance - // is allowed to maintain an idle connection to an Internet - // resource before it is recycled for use in another connection. - Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime ); - - // - // - Console::WriteLine( "ConnectionName = {0}", sp->ConnectionName ); - - // Display the maximum number of connections allowed on this - // ServicePoint instance. - Console::WriteLine( "ConnectionLimit = {0}", sp->ConnectionLimit ); - - // Display the number of connections associated with this - // ServicePoint instance. - Console::WriteLine( "CurrentConnections = {0}", sp->CurrentConnections ); - - // - // - if ( sp->Certificate == nullptr ) - Console::WriteLine( "Certificate = (null)" ); - else - Console::WriteLine( "Certificate = {0}", sp->Certificate ); - - if ( sp->ClientCertificate == nullptr ) - Console::WriteLine( "Client Certificate = (null)" ); - else - Console::WriteLine( "Client Certificate = {0}", sp->ClientCertificate ); - - Console::WriteLine( "ProtocolVersion = {0}", sp->ProtocolVersion->ToString() ); - Console::WriteLine( "SupportsPipelining = {0}", sp->SupportsPipelining ); - - // - // - Console::WriteLine( "UseNagleAlgorithm = {0} ", sp->UseNagleAlgorithm.ToString() ); - Console::WriteLine( "Expect 100-continue = {0}", sp->Expect100Continue.ToString() ); - - // -} - - -// -void makeWebRequest( int hashCode, String^ Uri ) -{ - HttpWebResponse^ res = nullptr; - - // Make sure that the idle time has elapsed, so that a new - // ServicePoint instance is created. - Console::WriteLine( "Sleeping for 2 sec." ); - Thread::Sleep( 2000 ); - try - { - - // Create a request to the passed URI. - HttpWebRequest^ req = dynamic_cast(WebRequest::Create( Uri )); - Console::WriteLine( "\nConnecting to {0} ............", Uri ); - - // Get the response object. - res = dynamic_cast(req->GetResponse()); - Console::WriteLine( "Connected.\n" ); - ServicePoint^ currentServicePoint = req->ServicePoint; - - // Display new service point properties. - int currentHashCode = currentServicePoint->GetHashCode(); - Console::WriteLine( "New service point hashcode: {0}", currentHashCode ); - Console::WriteLine( "New service point max idle time: {0}", currentServicePoint->MaxIdleTime ); - Console::WriteLine( "New service point is idle since {0}", currentServicePoint->IdleSince ); - - // Check that a new ServicePoint instance has been created. - if ( hashCode == currentHashCode ) - Console::WriteLine( "Service point reused." ); - else - Console::WriteLine( "A new service point created." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - finally - { - if ( res != nullptr ) - res->Close(); - } - -} - - -// -// Show the user how to use this program when wrong inputs are entered. -void showUsage() -{ - Console::WriteLine( "Enter the proxy name as follows:" ); - Console::WriteLine( "\tcs_servicepoint proxyName" ); -} - - -// -int main() -{ - array^args = Environment::GetCommandLineArgs(); - int port = 80; - - // Define a regular expression to parse the user's input. - // This is a security check. It allows only - // alphanumeric input strings between 2 to 40 characters long. - Regex^ rex = gcnew Regex( "^[a-zA-Z]\\w{1,39}$" ); - if ( args->Length < 2 ) - { - showUsage(); - return -1; - } - - String^ proxy = args[ 1 ]; - if ( (!rex->Match(proxy))->Success) - { - Console::WriteLine( "Input string format not allowed." ); - return -1; - } - - String^ proxyAdd = String::Format( "http://{0}:{1}", proxy, port ); - - // Create a proxy object. - WebProxy^ DefaultProxy = gcnew WebProxy( proxyAdd,true ); - - // Set the proxy that all HttpWebRequest instances use. - WebRequest::DefaultWebProxy = DefaultProxy; - - // Get the base interface for proxy access for the - // WebRequest-based classes. - IWebProxy^ Iproxy = WebRequest::DefaultWebProxy; - - - // - // Set the maximum number of ServicePoint instances to - // maintain. If a ServicePoint instance for that host already - // exists when your application requests a connection to - // an Internet resource, the ServicePointManager object - // returns this existing ServicePoint instance. If none exists - // for that host, it creates a new ServicePoint instance. - ServicePointManager::MaxServicePoints = 4; - - // Set the maximum idle time of a ServicePoint instance to 10 seconds. - // After the idle time expires, the ServicePoint object is eligible for - // garbage collection and cannot be used by the ServicePointManager. - ServicePointManager::MaxServicePointIdleTime = 10000; - - // - // - ServicePointManager::UseNagleAlgorithm = true; - ServicePointManager::Expect100Continue = true; - ServicePointManager::CheckCertificateRevocationList = true; - ServicePointManager::DefaultConnectionLimit = ServicePointManager::DefaultPersistentConnectionLimit; - - // - // Create the Uri object for the resource you want to access. - Uri^ MS = gcnew Uri( "http://msdn.microsoft.com/" ); - - // Use the FindServicePoint method to find an existing - // ServicePoint object or to create a new one. - ServicePoint^ servicePoint = ServicePointManager::FindServicePoint( MS, Iproxy ); - ShowProperties( servicePoint ); - int hashCode = servicePoint->GetHashCode(); - Console::WriteLine( "Service point hashcode: {0}", hashCode ); - - // Make a request with the same scheme identifier and host fragment - // used to create the previous ServicePoint object. - makeWebRequest( hashCode, "http://msdn.microsoft.com/library/" ); -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp deleted file mode 100644 index 71b43149394..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// This example shows how to use the ServicePoint and ServicePointManager classes. -// The ServicePointManager class uses the ServicePoint class to manage connections -// to a remote host. The networking classes reuse service points for all -// requests to a given URI. In fact, the same ServicePoint object -// is used to issue requests to Internet resources identified by the same -// scheme identifier (for example, HTTP) and host fragment (for example, www.contoso.com). -// This should improve your application performance. -// Reusing service points in this way can help improve application performance. -#using - -using namespace System; -using namespace System::Security; -using namespace System::Net; -using namespace System::Threading; -using namespace System::Text::RegularExpressions; - -void ShowProperties(ServicePoint^ service) -{ - Console::WriteLine("Done calling FindServicePoint()..."); - - // Display the ServicePoint Internet resource address. - Console::WriteLine("Address = {0} ", service->Address); - - // Display the date and time that the ServicePoint was last - // connected to a host. - Console::WriteLine("IdleSince = {0}", service->IdleSince); - - // Display the maximum length of time that the ServicePoint - // instance is allowed to maintain an idle connection to an - // Internet resource before it is recycled for use in another - // connection. - Console::WriteLine("MaxIdleTime = {0}", service->MaxIdleTime); - - Console::WriteLine("ConnectionName = {0}", - service->ConnectionName); - - // Display the maximum number of connections allowed on this - // ServicePoint instance. - Console::WriteLine("ConnectionLimit = {0}", - service->ConnectionLimit); - - // Display the number of connections associated with this - // ServicePoint instance. - Console::WriteLine("CurrentConnections = {0}", - service->CurrentConnections); - - if (service->Certificate == nullptr) - { - Console::WriteLine("Certificate = (null)"); - } - else - { - Console::WriteLine("Certificate = {0}", service->Certificate); - } - - if (service->ClientCertificate == nullptr) - { - Console::WriteLine("ClientCertificate = (null)"); - } - else - { - Console:: WriteLine("ClientCertificate = {0}", - service->ClientCertificate); - } - - Console::WriteLine("ProtocolVersion = {0}", - service->ProtocolVersion); - Console::WriteLine("SupportsPipelining = {0}", - service->SupportsPipelining); - - Console::WriteLine("UseNagleAlgorithm = {0}", - service->UseNagleAlgorithm.ToString()); - Console::WriteLine("Expect 100-continue = {0}", - service->Expect100Continue.ToString()); -} - -void MakeWebRequest(int hashCode, String^ requestedUri) -{ - HttpWebResponse^ response = nullptr; - - // Make sure that the idle time has elapsed, so that a new - // ServicePoint instance is created. - Console::WriteLine("Sleeping for 2 sec."); - Thread::Sleep(2000); - try - { - // Create a request to the passed URI. - HttpWebRequest^ request = - (HttpWebRequest^)WebRequest::Create(requestedUri); - - Console::WriteLine("\nConnecting to {0} ............", - requestedUri); - - // Get the response object. - response = (HttpWebResponse^) request->GetResponse(); - Console::WriteLine("Connected.\n"); - - ServicePoint^ currentServicePoint = request->ServicePoint; - - // Display new service point properties. - int currentHashCode = currentServicePoint->GetHashCode(); - - Console::WriteLine("New service point hashcode: {0}", - currentHashCode); - Console::WriteLine("New service point max idle time: {0}", - currentServicePoint->MaxIdleTime); - Console::WriteLine("New service point is idle since {0}", - currentServicePoint->IdleSince ); - - // Check that a new ServicePoint instance has been created. - if (hashCode == currentHashCode) - { - Console::WriteLine("Service point reused."); - } - else - { - Console::WriteLine("A new service point created.") ; - } - - } - catch (NotSupportedException^ ex) - { - Console::WriteLine( - "The request scheme specified in {0} has not been registered.", - requestedUri); - Console::WriteLine("Source : {0}", ex->Source); - Console::WriteLine("Message : {0}", ex->Message); - } - catch (SecurityException^ ex) - { - Console::WriteLine( - "You do not have permission to connect to {0}.", - requestedUri); - Console::WriteLine("Source : {0}", ex->Source); - Console::WriteLine("Message : {0}", ex->Message); - } - catch (UriFormatException^ ex) - { - Console::WriteLine( - "The URI specified in {0} is not a valid URI.", - requestedUri); - Console::WriteLine("Source : {0}", ex->Source); - Console::WriteLine("Message : {0}", ex->Message); - } - catch (WebException^ ex) - { - Console::WriteLine("The proxy name could not be resolved."); - Console::WriteLine("Source : {0}", ex->Source); - Console::WriteLine("Message : {0}", ex->Message); - } - finally - { - if (response != nullptr) - { - response->Close(); - } - } -} - -// Show the user how to use this program when wrong inputs are entered. -void ShowUsage() -{ - Console::WriteLine("Enter the proxy name as follows:"); - Console::WriteLine("\tcs_servicepoint proxyName"); -} - - -int main(array^ args) -{ - int port = 80; - - // Define a regular expression to parse the user's input. - // This is a security check. It allows only - // alphanumeric input strings between 2 to 40 characters long. - Regex^ expression = gcnew Regex("^[a-zA-Z]\\w{1,39}$"); - - if (args->Length <= 1) - { - ShowUsage(); - return 0; - } - String^ proxy = args[1]; - - if (!(expression->Match(proxy))->Success) - { - Console::WriteLine("Input string format not allowed."); - return 0; - } - String^ proxyAddress = "http://" + proxy + ":" + port; - - // Create a proxy object. - WebProxy^ defaultProxy = gcnew WebProxy(proxyAddress, true); - - // Set the proxy that all HttpWebRequest instances use. - GlobalProxySelection::Select = (IWebProxy^)defaultProxy; - - // Get the base interface for proxy access for the - // WebRequest-based classes. - IWebProxy^ proxyInterface = GlobalProxySelection::Select; - - // Set the maximum number of ServicePoint instances to - // maintain. If a ServicePoint instance for that host already - // exists when your application requests a connection to - // an Internet resource, the ServicePointManager object - // returns this existing ServicePoint instance. If none exists - // for that host, it creates a new ServicePoint instance. - ServicePointManager::MaxServicePoints = 4; - - // Set the maximum idle time of a ServicePoint instance to 10 seconds. - // After the idle time expires, the ServicePoint object is eligible for - // garbage collection and cannot be used by the ServicePointManager object. - ServicePointManager::MaxServicePointIdleTime = 10000; - - // - ServicePointManager::UseNagleAlgorithm = true; - ServicePointManager::Expect100Continue = true; - ServicePointManager::CheckCertificateRevocationList = true; - ServicePointManager::DefaultConnectionLimit = - ServicePointManager::DefaultPersistentConnectionLimit; - ServicePointManager::EnableDnsRoundRobin = true; - ServicePointManager::DnsRefreshTimeout = 4*60*1000; // 4 minutes - // - // Create the Uri object for the resource you want to access. - Uri^ msdn = gcnew Uri("http://msdn.microsoft.com/"); - - // Use the FindServicePoint method to find an existing - // ServicePoint object or to create a new one. - ServicePoint^ servicePoint = ServicePointManager::FindServicePoint( - msdn, proxyInterface); - - ShowProperties(servicePoint); - - int hashCode = servicePoint->GetHashCode(); - - Console::WriteLine("Service point hashcode: {0}", hashCode); - - // Make a request with the same scheme identifier and host fragment - // used to create the previous ServicePoint object. - MakeWebRequest(hashCode, "http://msdn.microsoft.com/library/"); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp deleted file mode 100644 index b9d8ca6d7bb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp +++ /dev/null @@ -1,344 +0,0 @@ - - -// This program shows how to create your own Basic authentication module, -// register it via the AuthenticationManager class and authorize allowed -// users to access a page on a Web site. -// Note: In order to run this program you must create a test Web site that performs -// Basic authentication. Also you must add to your server machine a user whose -// credentials are the same you plan to use for this example. -// CAVEAT: Basic authenticastion sends the user's credentials over HTTP. Passwords and -// user names are encoded using Base64 encoding. Although the password is encoded, it -// is considered insecure due its ability to be deciphered relatively easily. -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Collections; - -// -// The CustomBasic class creates a custom Basic authentication by implementing the -// IAuthenticationModule interface. In particular it performs the following -// tasks: -// 1) Defines and intializes the required properties. -// 2) Impements the Authenticate and PreAuthenticate methods. -public ref class CustomBasic: public IAuthenticationModule -{ -private: - - // - String^ m_authenticationType; - bool m_canPreAuthenticate; - -public: - - // The CustomBasic constructor initializes the properties of the customized - // authentication. - CustomBasic() - { - m_authenticationType = "Basic"; - m_canPreAuthenticate = false; - } - - - property String^ AuthenticationType - { - - // Define the authentication type. This type is then used to identify this - // custom authentication module. The default is set to Basic. - virtual String^ get() - { - return m_authenticationType; - } - - } - - property bool CanPreAuthenticate - { - - // Define the pre-authentication capabilities for the module. The default is set - // to false. - virtual bool get() - { - return m_canPreAuthenticate; - } - - } - - // - // The checkChallenge method checks if the challenge sent by the HttpWebRequest - // contains the correct type (Basic) and the correct domain name. - // Note: the challenge is in the form BASIC REALM="DOMAINNAME" - // and you must assure that the Internet Web site resides on a server whose - // domain name is equal to DOMAINAME. - bool checkChallenge( String^ Challenge, String^ domain ) - { - bool challengePasses = false; - String^ tempChallenge = Challenge->ToUpper(); - - // Verify that this is a Basic authorization request and the requested domain - // is correct. - // Note: When the domain is an empty string the following code only checks - // whether the authorization type is Basic. - if ( tempChallenge->IndexOf( "BASIC" ) != -1 ) - if ( domain != String::Empty ) - if ( tempChallenge->IndexOf( domain->ToUpper() ) != -1 ) - challengePasses = true; // The domain is not allowed and the authorization type is Basic. - else - challengePasses = false; - - else - challengePasses = true; - - - return challengePasses; - } - - - // - // The PreAuthenticate method specifies if the authentication implemented - // by this class allows pre-authentication. - // Even if you do not use it, this method must be implemented to obey to the rules - // of interface implemebtation. - // In this case it always returns false. - virtual Authorization^ PreAuthenticate( WebRequest^ /*request*/, ICredentials^ /*credentials*/ ) - { - return nullptr; - } - - - // - // - // Authenticate is the core method for this custom authentication. - // When an internet resource requests authentication, the WebRequest.GetResponse - // method calls the AuthenticationManager.Authenticate method. This method, in - // turn, calls the Authenticate method on each of the registered authentication - // modules, in the order they were registered. When the authentication is - // complete an Authorization object is returned to the WebRequest, as the - // retunr type of the following routine shows. - virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) - { - Encoding^ ASCII = Encoding::ASCII; - - // Get the username and password from the credentials - NetworkCredential^ MyCreds = credentials->GetCredential( request->RequestUri, "Basic" ); - if ( PreAuthenticate( request, credentials ) == nullptr ) - Console::WriteLine( "\n Pre-authentication is not allowed." ); - else - Console::WriteLine( "\n Pre-authentication is allowed." ); - - - // Verify that the challenge satisfies the authorization requirements. - bool challengeOk = checkChallenge( challenge, MyCreds->Domain ); - if ( !challengeOk ) - return nullptr; - - - // - // Create the encrypted string according to the Basic authentication format as - // follows: - // a)Concatenate username and password seperated by colon; - // b)Apply ASCII encoding to obtain a stream of bytes; - // c)Apply Base64 Encoding to this array of bytes to obtain the encoded - // authorization. - String^ BasicEncrypt = String::Concat( MyCreds->UserName, ":", MyCreds->Password ); - String^ BasicToken = String::Format( "Basic {0}", Convert::ToBase64String( ASCII->GetBytes( BasicEncrypt ) ) ); - - // Create an Authorization object using the above encoded authorization. - Authorization^ resourceAuthorization = gcnew Authorization( BasicToken ); - - // Get the Message property which contains the authorization string that the - // client returns to the server when accessing protected resources. - Console::WriteLine( "\n Authorization Message:{0}", resourceAuthorization->Message ); - - // Get the Complete property which is set to true when the authentication process - // between the client and the server is finished. - Console::WriteLine( "\n Authorization Complete:{0}", resourceAuthorization->Complete ); - Console::WriteLine( "\n Authorization ConnectionGroupId:{0}", resourceAuthorization->ConnectionGroupId ); - - // - return resourceAuthorization; - } - - // -}; - - -// -// The ClientAuthentication performs the following main tasks: -// 1) It obtains the user's credentials. -// 2) Unregisters the standard Basic authentication. -// 3) Registers the customized Basic authentication. -// 4) Read the selected page and displays it on the console. -ref class ClientAuthentication -{ -private: - static String^ username; - static String^ password; - static String^ domain; - static String^ uri; - - // Show how to use this program. - static void showusage() - { - Console::WriteLine( "Attempts to authenticate to a URL" ); - Console::WriteLine( "\r\nUse one of the following:" ); - Console::WriteLine( "\tcustomBasicAuthentication URL username password domain" ); - Console::WriteLine( "\tcustomBasicAuthentication URL username password" ); - Console::WriteLine( "\r\nExample:" ); - Console::WriteLine( "\tcustomBasicAuthentication http://ndpue/ncl/ basicuser basic.101 ndpue" ); - } - - - // - // Display registered authentication modules. - static void displayRegisteredModules() - { - - // The AuthenticationManager calls all authentication modules sequentially - // until one of them responds with an authorization instance. Show - // the current registered modules, for testing purposes. - IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; - Console::WriteLine( "\r\nThe following authentication modules are now registered with the system" ); - while ( registeredModules->MoveNext() ) - { - Console::WriteLine( "\r \n Module : {0}", registeredModules->Current ); - IAuthenticationModule^ currentAuthenticationModule = dynamic_cast(registeredModules->Current); - Console::WriteLine( "\t CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate ); - } - } - - - // - // The getPage method accesses the selected page an displays its content - // on the console. - static void getPage( String^ url ) - { - try - { - - // Create the Web request object. - WebRequest^ req = dynamic_cast(WebRequest::Create( url )); - - // Define the request access method. - req->Method = "GET"; - - // Define the request credentials according to the user's input. - if ( domain == String::Empty ) - req->Credentials = gcnew NetworkCredential( username,password ); // If the user's specifies the Internet resource domain, this usually - else - req->Credentials = gcnew NetworkCredential( username,password,domain ); - - // is by default the name of the sever hosting the resource. - // Issue the request. - WebResponse^ result = req->GetResponse(); - Console::WriteLine( "\nAuthentication Succeeded:" ); - - // Store the response. - Stream^ sData = result->GetResponseStream(); - - // Display the response. - displayPageContent( sData ); - } - catch ( WebException^ e ) - { - - // Display the error, if any. In particular display protocol - // related error. - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - HttpWebResponse^ hresp = dynamic_cast(e->Response); - Console::WriteLine( "\nAuthentication Failed, {0}", hresp->StatusCode ); - Console::WriteLine( "Status Code: {0}", (int)hresp->StatusCode ); - Console::WriteLine( "Status Description: {0}", hresp->StatusDescription ); - return; - } - Console::WriteLine( "Caught Exception: {0}", e->Message ); - Console::WriteLine( "Stack: {0}", e->StackTrace ); - } - - } - - - // The displayPageContent method display the content of the - // selected page. - static void displayPageContent( Stream^ ReceiveStream ) - { - - // Create an ASCII encoding object. - Encoding^ ASCII = Encoding::ASCII; - - // Define the byte array to temporary hold the current read bytes. - array^read = gcnew array(512); - Console::WriteLine( "\r\nPage Content...\r\n" ); - - // Read the page content and display it on the console. - // Read the first 512 bytes. - int bytes = ReceiveStream->Read( read, 0, 512 ); - while ( bytes > 0 ) - { - Console::Write( ASCII->GetString( read, 0, bytes ) ); - bytes = ReceiveStream->Read( read, 0, 512 ); - } - - Console::WriteLine( "" ); - } - - -public: - - // - // This is the program entry point. It allows the user to enter - // her credentials and the Internet resource (Web page) to access. - // It also unregisters the standard and registers the customized basic - // authentication. - static void Main() - { - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 4 ) - showusage(); - else - { - - // Read the user's credentials. - uri = args[ 1 ]; - username = args[ 2 ]; - password = args[ 3 ]; - if ( args->Length == 4 ) - domain = String::Empty; // If the domain exists, store it. Usually the domain name - else - domain = args[ 4 ]; - - - // is by default the name of the server hosting the Internet - // resource. - // Unregister the standard Basic authentication module. - AuthenticationManager::Unregister( "Basic" ); - - // Instantiate the custom Basic authentication module. - CustomBasic^ customBasicModule = gcnew CustomBasic; - - // Register the custom Basic authentication module. - AuthenticationManager::Register( customBasicModule ); - - // Display registered Authorization modules. - displayRegisteredModules(); - - // Read the specified page and display it on the console. - getPage( uri ); - } - - return; - } - - // -}; - -int main() -{ - ClientAuthentication::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp deleted file mode 100644 index 344dc6ed2a9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp +++ /dev/null @@ -1,130 +0,0 @@ - - -// -// This program contains snippets for the following members: -// 1) System::Net::Sockets::MulticastOption; -// 2) System::Net::Sockets::MulticastOption.MulticastOption(IPAddress, IPAddress); -// 3) System::Net::Sockets::MulticastOption.Group; -// 4) System::Net::Sockets::MulticastOption.LocalAddress; -// -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; - -// This program shows how to use the MultiCastOption type. In particular, -// it shows how to use the MultiCastOption(IPAddress, IPAddress) constructor, -// You need to use this constructor, in the case of multihomed host (i.e., -// a host with more than one network card). With the first parameter you -// specify the multicast group address, with the second you specify the -// local address of one of the network cards you want to use for the data -// exchange. -// You must run this program in conjunction with the sender program as -// follows: -// Open a console window and run the listener from the command line. -// In another console window run the sender. In both cases you must specify -// the local IPAddress to use. To obtain this address run the ipconfig from -// the command line. -// -public ref class TestMulticastOption -{ -private: - static IPAddress^ mcastAddress; - static int mcastPort; - static Socket^ mcastSocket; - static MulticastOption^ mcastOption; - - // - static void MulticastOptionProperties() - { - Console::WriteLine( "Current multicast group is: {0}", mcastOption->Group ); - Console::WriteLine( "Current multicast local address is: {0}", mcastOption->LocalAddress ); - } - - - // - static void StartMulticast() - { - try - { - mcastSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Dgram,ProtocolType::Udp ); - Console::Write( "Enter the local IP Address: " ); - IPAddress^ localIPAddr = IPAddress::Parse( Console::ReadLine() ); - - //IPAddress localIP = IPAddress::Any; - EndPoint^ localEP = dynamic_cast(gcnew IPEndPoint( localIPAddr,mcastPort )); - mcastSocket->Bind( localEP ); - - // - // Define a MuticastOption object specifying the multicast group - // address and the local IPAddress. - // The multicast group address is the same one used by the server. - mcastOption = gcnew MulticastOption( mcastAddress,localIPAddr ); - mcastSocket->SetSocketOption( SocketOptionLevel::IP, SocketOptionName::AddMembership, mcastOption ); - - // - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - - } - - static void ReceiveBrodcastMessages() - { - bool done = false; - array^bytes = gcnew array(100); - IPEndPoint^ groupEP = gcnew IPEndPoint( mcastAddress,mcastPort ); - EndPoint^ remoteEP = dynamic_cast(gcnew IPEndPoint( IPAddress::Any,0 )); - try - { - while ( !done ) - { - Console::WriteLine( "Waiting for Multicast packets......." ); - Console::WriteLine( "Enter ^C to terminate." ); - mcastSocket->ReceiveFrom( bytes, remoteEP ); - Console::WriteLine( "Received broadcast from {0} :\n {1}\n", groupEP, Encoding::ASCII->GetString( bytes, 0, bytes->Length ) ); - } - mcastSocket->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } - - } - - -public: - static void Main() - { - - // Initialize multicast address group and multicast port. - // Both address and port are selected from the allowed sets as - // defined in the related RFC documents. These are the same values - // used by the sender. - mcastAddress = IPAddress::Parse( "224.168.100.2" ); - mcastPort = 11000; - - // Start a multicast group. - StartMulticast(); - - // Display multicast option properties. - MulticastOptionProperties(); - - // Receive brodcast messages. - ReceiveBrodcastMessages(); - } - -}; - -int main() -{ - TestMulticastOption::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp deleted file mode 100644 index 9b92d3984aa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp +++ /dev/null @@ -1,107 +0,0 @@ - - -// -// This program contains snippets for the following members: -// 1) System::Net::Sockets::MulticastOption; -// -// -#using - -using namespace System; -using namespace System::Net::Sockets; -using namespace System::Net; -using namespace System::Text; - -// This is an auxiliary program to be used in conjunction with a listener -// program. -// You must run this program as follows: -// Open a console window and run the listener from the command line. -// In another console window run the sender. In both cases you must specify -// the local IPAddress to use. To obtain this address run the ipconfig -// from the command line. -// -ref class TestMulticastOption -{ -private: - static IPAddress^ mcastAddress; - static int mcastPort; - static Socket^ mcastSocket; - static void JoinMulticast() - { - try - { - - // Create multicast socket. - mcastSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Dgram,ProtocolType::Udp ); - - // Get the local IP address used by the listener and the sender to - // exchange data in a multicast fashion. - Console::Write( "\nEnter local IPAddress for sending multicast packets: " ); - IPAddress^ localIPAddr = IPAddress::Parse( Console::ReadLine() ); - - // Create an IPEndPoint Object*. - IPEndPoint^ IPlocal = gcnew IPEndPoint( localIPAddr,0 ); - - // Bind this end point to the multicast socket. - mcastSocket->Bind( IPlocal ); - - // Define a MuticastOption Object* specifying the multicast group - // address and the local IPAddress. - // The multicast group address is the same one used by the listener. - MulticastOption^ mcastOption; - mcastOption = gcnew MulticastOption( mcastAddress,localIPAddr ); - mcastSocket->SetSocketOption( SocketOptionLevel::IP, SocketOptionName::AddMembership, mcastOption ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\n {0}", e ); - } - - } - - static void BrodcastMessage( String^ message ) - { - IPEndPoint^ endPoint; - try - { - - //Send multicast packets to the listener. - endPoint = gcnew IPEndPoint( mcastAddress,mcastPort ); - mcastSocket->SendTo( ASCIIEncoding::ASCII->GetBytes( message ), endPoint ); - Console::WriteLine( "Multicast data sent....." ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\n {0}", e ); - } - - mcastSocket->Close(); - } - - -public: - static void main() - { - - // Initialize multicast address group and multicast port. - // Both address and port are selected from the allowed sets as - // defined in the related RFC documents. These are the same values - // used by the sender. - mcastAddress = IPAddress::Parse( "224.168.100.2" ); - mcastPort = 11000; - - // Join the listener multicast group. - JoinMulticast(); - - // Broadcast message to the listener. - BrodcastMessage( "Hello multicast listener." ); - } - -}; - -int main() -{ - TestMulticastOption::main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp deleted file mode 100644 index 4b21fa80e2a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; -ref class ConnectTester -{ -public: - - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - - // handles the completion of the prior asynchronous - // connect call. the socket is passed via the objectState - // paramater of BeginConnect(). - static void ConnectCallback1( IAsyncResult^ ar ) - { - allDone->Set(); - Socket^ s = dynamic_cast(ar->AsyncState); - s->EndConnect( ar ); - } - - // Asynchronous connect using the host name, resolved via - // IPAddress - static void BeginConnect1( String^ host, int port ) - { - array^IPs = Dns::GetHostAddresses( host ); - Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - allDone->Reset(); - Console::WriteLine( "Establishing Connection to {0}", host ); - s->BeginConnect( IPs[ 0 ], port, gcnew AsyncCallback( ConnectCallback1 ), s ); - - // wait here until the connect finishes. - // The callback sets allDone. - allDone->WaitOne(); - Console::WriteLine( "Connection established" ); - } - - // Asynchronous connect, using DNS.ResolveToAddresses - static void BeginConnect2( String^ host, int port ) - { - array^IPs = Dns::GetHostAddresses( host ); - Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - allDone->Reset(); - Console::WriteLine( "Establishing Connection to {0}", host ); - s->BeginConnect( IPs, port, gcnew AsyncCallback( ConnectCallback1 ), s ); - - // wait here until the connect finishes. The callback - // sets allDone. - allDone->WaitOne(); - Console::WriteLine( "Connection established" ); - } - - // Asynchronous connect using host name (resolved by the - // BeginConnect call.) - static void BeginConnect3( String^ host, int port ) - { - Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - allDone->Reset(); - Console::WriteLine( "Establishing Connection to {0}", host ); - s->BeginConnect( host, port, gcnew AsyncCallback( ConnectCallback1 ), s ); - - // wait here until the connect finishes. The callback - // sets allDone. - allDone->WaitOne(); - Console::WriteLine( "Connection established" ); - } - - // - // Synchronous connect using IPAddress to resolve the - // host name. - static void Connect1( String^ host, int port ) - { - array^IPs = Dns::GetHostAddresses( host ); - Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - Console::WriteLine( "Establishing Connection to {0}", host ); - s->Connect( IPs[ 0 ], port ); - Console::WriteLine( "Connection established" ); - } - - - // - // - // Synchronous connect using Dns.ResolveToAddresses to - // resolve the host name. - static void Connect2( String^ host, int port ) - { - array^IPs = Dns::GetHostAddresses( host ); - Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - Console::WriteLine( "Establishing Connection to {0}", host ); - s->Connect( IPs, port ); - Console::WriteLine( "Connection established" ); - } - - - // - // - // Synchronous connect using host name (resolved by the - // Connect call.) - static void Connect3( String^ host, int port ) - { - Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - Console::WriteLine( "Establishing Connection to {0}", host ); - s->Connect( host, port ); - Console::WriteLine( "Connection established" ); - } - - // -}; - - -[STAThread] -int main() -{ - ConnectTester::BeginConnect1( "127.0.0.1", 80 ); - ConnectTester::BeginConnect2( "localhost", 80 ); - ConnectTester::BeginConnect3( "localhost", 80 ); - ConnectTester::Connect1( "127.0.0.1", 80 ); - ConnectTester::Connect2( "127.0.0.1", 80 ); - ConnectTester::Connect3( "localhost", 80 ); - Console::WriteLine( "hit any key" ); - Console::Read(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp deleted file mode 100644 index b06fa3e3760..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -namespace SocketExample -{ - ref class TestClass - { - public: - - static void SyncSendAndReceive(String^ host, int port) - { - // - Encoding^ asciiEncoding = Encoding::ASCII; - - // Create the TCP Socket. - IPHostEntry^ hostEntry = Dns::Resolve(host); - IPEndPoint^ endPoint = gcnew IPEndPoint( - hostEntry->AddressList[0], port); - - Socket^ tcpSocket = gcnew Socket( - AddressFamily::InterNetwork, SocketType::Stream, - ProtocolType::Tcp); - - tcpSocket->Connect(endPoint); - - // Build the buffers to be sent. - List >^ buffers = - gcnew List >(2); - - buffers->Add(ArraySegment( - asciiEncoding->GetBytes(""))); - - buffers->Add(ArraySegment( - asciiEncoding->GetBytes(""))); - - // Send the data. - tcpSocket->Send(buffers); - // - - // - - // Build the buffers for the receive. - List >^ receiveBuffers = - gcnew List >(2); - - array^ bigBuffer = gcnew array(1024); - - // Specify the first buffer segment (2 bytes, starting - // at the 4th element of bigBuffer) - receiveBuffers->Add(ArraySegment(bigBuffer, 4, 2)); - - // Specify the second buffer segment (500 bytes, starting - // at the 20th element of bigBuffer) - receiveBuffers->Add( - ArraySegment(bigBuffer, 20, 500)); - - tcpSocket->Receive(receiveBuffers); - - Console::WriteLine("{0}", - asciiEncoding->GetString(bigBuffer)); - // - } - - static void AsyncSendAndReceive(String^ host, int port) - { - // - Encoding^ asciiEncoding = Encoding::ASCII; - - // Create the TCP Socket. - IPHostEntry^ hostEntry = Dns::Resolve(host); - IPEndPoint^ endPoint = gcnew IPEndPoint( - hostEntry->AddressList[0], port); - - Socket^ tcpSocket = gcnew Socket( - AddressFamily::InterNetwork, SocketType::Stream, - ProtocolType::Tcp); - - tcpSocket->Connect(endPoint); - - // Build the buffers to be sent. - List >^ buffers = - gcnew List >(2); - - buffers->Add(ArraySegment( - asciiEncoding->GetBytes(""))); - - buffers->Add(ArraySegment( - asciiEncoding->GetBytes(""))); - - // Create delegate instance for the callback function - AsyncCallback^ sendCallback = - gcnew AsyncCallback(SendCallback); - - // Send the data. - allDone->Reset(); - tcpSocket->BeginSend(buffers, SocketFlags::None, - sendCallback, (Object^)tcpSocket); - allDone->WaitOne(); - - // done - Console::WriteLine("Data sent"); - // - - // - - // Build the buffers for the receive. - List >^ receiveBuffers = - gcnew List >(2); - - array^ bigBuffer = gcnew array(1024); - - // Specify the first buffer segment (2 bytes, starting - // at the 6th element of bigBuffer) - receiveBuffers->Add(ArraySegment(bigBuffer, 6, 2)); - - // Specify the second buffer segment (500 bytes, starting - // at the 10th element of bigBuffer) - receiveBuffers->Add( - ArraySegment(bigBuffer, 10, 500)); - - // Create delegate instance for the callback function - AsyncCallback^ receiveCallback = - gcnew AsyncCallback(ReceiveCallback); - - // Receive the data. - allDone->Reset(); - tcpSocket->BeginReceive( - receiveBuffers, SocketFlags::None, - receiveCallback, (Object^)tcpSocket); - - allDone->WaitOne(); - - Console::WriteLine("Data received:"); - Console::WriteLine("{0}", - asciiEncoding->GetString(bigBuffer)); - // - } - - private: - - static ManualResetEvent^ allDone = - gcnew ManualResetEvent(false); - - static void SendCallback(IAsyncResult^ result) - { - allDone->Set(); - Socket^ sendSocket = (Socket^)result->AsyncState; - sendSocket->EndSend(result); - } - - static void ReceiveCallback(IAsyncResult^ result) - { - allDone->Set(); - Socket^ receiveSocket = (Socket^)result->AsyncState; - receiveSocket->EndReceive(result); - } - }; -} - -int main() -{ - Console::WriteLine("starting synchronous test"); - SocketExample::TestClass::SyncSendAndReceive("localhost", 80); - Console::WriteLine("starting asynchronous test"); - SocketExample::TestClass::AsyncSendAndReceive("localhost", 80); - Console::WriteLine("ending tests"); - - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp deleted file mode 100644 index 93746826f75..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp +++ /dev/null @@ -1,118 +0,0 @@ -// System.Net.Sockets.TcpClient main functionality. - -/** -* This program shows how to use the TcpClient -* It creates a TcpClient that connects to a TcpServer listening on the specified port -* (13000). When connecting to the server it forwards a message, as specified in -* the input parameter. -* To run this program at the command line you enter: -* cs_tcpclient serverName S"My message" -* Where the serverName is the name on which the server is running. -* For this program to work you need to have the TcpServer running in another -* console window. -* To avoid permission settings you can run this console application and the related -* TcpServer from your hard disk and not from a shared location on the network. -**/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Security::Permissions; - -/** -* The following function creates a TcpClient that connects to a -* TcpServer listening on the specified port (13000). -* When connecting to the server it forwards a message, as specified in -* the input parameter. -**/ -// -void Connect( String^ server, String^ message ) -{ - TcpClient^ client = nullptr; - try - { - // Create a TcpClient. - // Note, for this client to work you need to have a TcpServer - // connected to the same address as specified by the server, port - // combination. - Int32 port = 13000; - client = gcnew TcpClient(server, port); - - // Translate the passed message into ASCII and store it as a Byte array. - array^data = Text::Encoding::ASCII->GetBytes( message ); - - // Get a client stream for reading and writing. - NetworkStream^ stream = client->GetStream(); - - // Send the message to the connected TcpServer. - stream->Write( data, 0, data->Length ); - - Console::WriteLine( "Sent: {0}", message ); - - // Receive the server response. - - // Buffer to store the response bytes. - data = gcnew array(256); - - // String to store the response ASCII representation. - String^ responseData = String::Empty; - - // Read the first batch of the TcpServer response bytes. - Int32 bytes = stream->Read( data, 0, data->Length ); - responseData = Text::Encoding::ASCII->GetString( data, 0, bytes ); - Console::WriteLine( "Received: {0}", responseData ); - - // Explicit close is not necessary since TcpClient::Dispose() will be - // called automatically in finally block. - // stream->Close(); - // client->Close(); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( "ArgumentNullException: {0}", e ); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException: {0}", e ); - } - finally - { - if (client != nullptr) - delete client; - } - - Console::WriteLine( "\n Press Enter to continue..." ); - Console::Read(); -} -// - -void main( int argc, char *argv[] ) -{ - // Parse arguments - String^ server; - String^ message; - if ( argc < 3 ) - { - message = "This is a test!"; - if ( argc == 1 ) - { - server = "localhost"; - } - else - { - server = gcnew String(argv[ 1 ]); - } - } - else - { - message = gcnew String(argv[ 2 ]); - server = gcnew String(argv[ 1 ]); - } - - // Connect to server - Connect( server, message ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp deleted file mode 100644 index 86c17e2e7fd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp +++ /dev/null @@ -1,125 +0,0 @@ - - -// This is the main project file for VC++ application project -// generated using an Application Wizard. -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; - -ref class TcpClientExamples -{ -public: - - // - static void GetAvailable( TcpClient^ t ) - { - // Find out how many bytes are ready to be read. - Console::WriteLine( "Available value is {0}", t->Available.ToString() ); - ; - } - // - - // - static void GetConnected( TcpClient^ t ) - { - // Find out whether the socket is connected to the remote - // host. - Console::WriteLine( "Connected value is {0}", t->Connected.ToString() ); - ; - } - // - - // - static void GetSetExclusiveAddressUse( TcpClient^ t ) - { - // Don't allow another process to bind to this port. - t->ExclusiveAddressUse = true; - Console::WriteLine( "ExclusiveAddressUse value is {0}", t->ExclusiveAddressUse.ToString() ); - ; - } - // - - // - static void DoConnect( String^ host, int port ) - { - // Connect to the specified host. - TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); - array^IPAddresses = Dns::GetHostAddresses( host ); - Console::WriteLine( "Establishing Connection to {0}", host ); - t->Connect( IPAddresses, port ); - Console::WriteLine( "Connection established" ); - } - // - - // - static ManualResetEvent^ connectDone = gcnew ManualResetEvent( false ); - static void ConnectCallback( IAsyncResult^ ar ) - { - connectDone->Set(); - TcpClient^ t = safe_cast(ar->AsyncState); - t->EndConnect( ar ); - } - // - - static void DoBeginConnect1( String^ host, int port ) - { - // Connect asynchronously to the specifed host. - TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); -// IPAddress^ remoteHost = gcnew IPAddress( host ); - array^ remoteHost = Dns::GetHostAddresses( host ); - connectDone->Reset(); - Console::WriteLine( "Establishing Connection to {0}", host ); - t->BeginConnect( remoteHost, port, gcnew AsyncCallback( &ConnectCallback ), t ); - - // Wait here until the callback processes the connection. - connectDone->WaitOne(); - Console::WriteLine( "Connection established" ); - } - - // Connect asynchronously to the specifed host. - static void DoBeginConnect2( String^ host, int port ) - { - TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); - array^remoteHost = Dns::GetHostAddresses( host ); - connectDone->Reset(); - Console::WriteLine( "Establishing Connection to {0}", host ); - t->BeginConnect( remoteHost, port, gcnew AsyncCallback( &ConnectCallback ), t ); - - // Wait here until the callback processes the connection. - connectDone->WaitOne(); - Console::WriteLine( "Connection established" ); - } - - // Connect asynchronously to the specifed host. - static void DoBeginConnect3( String^ host, int port ) - { - TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); - connectDone->Reset(); - Console::WriteLine( "Establishing Connection to {0}", host ); - t->BeginConnect( host, port, gcnew AsyncCallback( &ConnectCallback ), t ); - - // Wait here until the callback processes the connection. - connectDone->WaitOne(); - Console::WriteLine( "Connection established" ); - } -}; - -int main() -{ - TcpClient^ t; - - // The TCP socket. - t = gcnew TcpClient( "localhost",80 ); - TcpClientExamples::GetConnected( t ); - TcpClientExamples::GetAvailable( t ); - TcpClientExamples::GetSetExclusiveAddressUse( t ); - TcpClientExamples::DoConnect( "127.0.0.1", 80 ); - TcpClientExamples::DoBeginConnect1( "127.0.0.1", 80 ); - TcpClientExamples::DoBeginConnect2( "127.0.0.1", 80 ); - TcpClientExamples::DoBeginConnect3( "127.0.0.1", 80 ); - Console::WriteLine( "enter to exit" ); - Console::Read(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp deleted file mode 100644 index 9687b62e453..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp +++ /dev/null @@ -1,226 +0,0 @@ - - -// System.Net.Sockets.TcpListener -/** -* This program shows how to use the TcpListener class. -* It creates a TcpListener that listen on the specified port (13000). -* To run this program at the command line you enter: -* cs_tcpserver -* Any TcpClient that wants to use this server -* has to explicitly connect to an address obtained by the combination of -* the sever on which this TcpServer is runnig and the port 13000. -* This TcpServer simply echoes back the message sent by the TcpClient, after -* translating it into uppercase. -* To avoid permission settings you can run this console application and the related -* TcpClient from your hard disk and not from a shared location on the network. -**/ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; -void main() -{ - try - { - - // Set the TcpListener on port 13000. - Int32 port = 13000; - IPAddress^ localAddr = IPAddress::Parse( "127.0.0.1" ); - - // TcpListener* server = new TcpListener(port); - TcpListener^ server = gcnew TcpListener( localAddr,port ); - - // Start listening for client requests. - server->Start(); - - // Buffer for reading data - array^bytes = gcnew array(256); - String^ data = nullptr; - - // Enter the listening loop. - while ( true ) - { - Console::Write( "Waiting for a connection... " ); - - // Perform a blocking call to accept requests. - // You could also use server.AcceptSocket() here. - TcpClient^ client = server->AcceptTcpClient(); - Console::WriteLine( "Connected!" ); - data = nullptr; - - // Get a stream Object* for reading and writing - NetworkStream^ stream = client->GetStream(); - Int32 i; - - // Loop to receive all the data sent by the client. - while ( i = stream->Read( bytes, 0, bytes->Length ) ) - { - - // Translate data bytes to a ASCII String*. - data = Text::Encoding::ASCII->GetString( bytes, 0, i ); - Console::WriteLine( "Received: {0}", data ); - - // Process the data sent by the client. - data = data->ToUpper(); - array^msg = Text::Encoding::ASCII->GetBytes( data ); - - // Send back a response. - stream->Write( msg, 0, msg->Length ); - Console::WriteLine( "Sent: {0}", data ); - } - - // Shutdown and end connection - client->Close(); - } - } - catch ( SocketException^ e ) - { - Console::WriteLine( "SocketException: {0}", e ); - } - - Console::WriteLine( "\nHit enter to continue..." ); - Console::Read(); -} - - -// -ref class tcplistener -{ -public: - - // - static void GetSetExclusiveAddressUse( TcpListener^ t ) - { - - // Set Exclusive Address Use for the underlying socket. - t->ExclusiveAddressUse = true; - Console::WriteLine( "ExclusiveAddressUse value is {0}", t->ExclusiveAddressUse ); - } - - - // - // - static void DoStart( TcpListener^ t, int backlog ) - { - - // Start listening for client connections with the specified - // backlog. - t->Start( backlog ); - Console::WriteLine( "started listening" ); - } - - - // - // - // Thread signal. - static ManualResetEvent^ clientConnected = gcnew ManualResetEvent( false ); - - // Accept one client connection asynchronously. - static void DoBeginAcceptSocket( TcpListener^ listener ) - { - - // Set the event to nonsignaled state. - clientConnected->Reset(); - - // Start to listen for connections from a client. - Console::WriteLine( "Waiting for a connection..." ); - - // Accept the connection. - // BeginAcceptSocket() creates the accepted socket. - listener->BeginAcceptSocket( gcnew AsyncCallback( &tcplistener::DoAcceptSocketCallback ), listener ); - - // Wait until a connection is made and processed before - // continuing. - clientConnected->WaitOne(); - } - - - // Process the client connection. - static void DoAcceptSocketCallback( IAsyncResult^ ar ) - { - - // Get the listener that handles the client request. - TcpListener^ listener = dynamic_cast(ar->AsyncState); - - // Get the client socket. - Socket^ clientSocket = listener->EndAcceptSocket( ar ); - - // Process the connection here. (Add the client to a server - // table, read data, etc.) - Console::WriteLine( "Client connected completed" ); - - // Signal the calling thread to continue. - clientConnected->Set(); - } - - - // - // - // Thread signal. - static ManualResetEvent^ tcpClientConnected = gcnew ManualResetEvent( false ); - - // Accept one client connection asynchronously. - static void DoBeginAcceptTcpClient( TcpListener^ listener ) - { - - // Set the event to nonsignaled state. - tcpClientConnected->Reset(); - - // Start to listen for connections from a client. - Console::WriteLine( "Waiting for a connection..." ); - - // Accept the connection. - // BeginAcceptSocket() creates the accepted socket. - listener->BeginAcceptTcpClient( gcnew AsyncCallback( &tcplistener::DoAcceptTcpClientCallback ), listener ); - - // Wait until a connection is made and processed before - // continuing. - tcpClientConnected->WaitOne(); - } - - - // Process the client connection. - static void DoAcceptTcpClientCallback( IAsyncResult^ ar ) - { - - // Get the listener that handles the client request. - TcpListener^ listener = dynamic_cast(ar->AsyncState); - - // Get the new TcpClient. - TcpClient^ client = listener->EndAcceptTcpClient( ar ); - - // Process the connection here. (Add the client to a server - // table, read data, etc.) - Console::WriteLine( "Client connected completed" ); - - // Signal the calling thread to continue. - tcpClientConnected->Set(); - } - - // -}; - -/*int main() -{ - TcpListener* listener = new TcpListener( - Dns::GetLocalHostAddresses()[0], - 4242); - - tcplistener::GetSetExclusiveAddressUse(listener); - - // Start listening for client connections. - tcplistener::DoStart(listener, 20); - - // Accept client connections asynchronously - tcplistener::DoBeginAcceptSocket(listener); - tcplistener::DoBeginAcceptTcpClient(listener); - - Console::WriteLine("hit any key"); - Console::Read(); - return 0; -}*/ diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp deleted file mode 100644 index 0a8159bb679..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Threading; - -namespace TcpListenerExample -{ - public ref class TcpServer - { - // - public: - static void GetSetExclusiveAddressUse(TcpListener^ listener) - { - // Set Exclusive Address Use for the underlying socket. - listener->ExclusiveAddressUse = true; - Console::WriteLine("ExclusiveAddressUse value is {0}", - listener->ExclusiveAddressUse); - } - // - - // - public: - static void DoStart(TcpListener^ listener, int backlog) - { - // Start listening for client connections with the - // specified backlog. - listener->Start(backlog); - Console::WriteLine("Started listening"); - } - // - - // Thread signal. - public: - static ManualResetEvent^ ClientConnected; - - // Accept one client connection asynchronously. - public: - static void DoBeginAcceptSocket(TcpListener^ listener) - { - // Set the event to nonsignaled state. - ClientConnected->Reset(); - - // Start to listen for connections from a client. - Console::WriteLine("Waiting for a connection..."); - - // Accept the connection. - // BeginAcceptSocket() creates the accepted socket. - listener->BeginAcceptSocket( - gcnew AsyncCallback(DoAcceptSocketCallback), listener); - // Wait until a connection is made and processed before - // continuing. - ClientConnected->WaitOne(); - } - - // Process the client connection. - public: - static void DoAcceptSocketCallback(IAsyncResult^ result) - { - // Get the listener that handles the client request. - TcpListener^ listener = (TcpListener^) result->AsyncState; - - // End the operation and display the received data on the - //console. - Socket^ clientSocket = listener->EndAcceptSocket(result); - - // Process the connection here. (Add the client to a - // server table, read data, etc.) - Console::WriteLine("Client connected completed"); - - // Signal the calling thread to continue. - ClientConnected->Set(); - } - - // Thread signal. - public: - static ManualResetEvent^ TcpClientConnected; - - // Accept one client connection asynchronously. - public: - static void DoBeginAcceptTcpClient(TcpListener^ listener) - { - // Set the event to nonsignaled state. - TcpClientConnected->Reset(); - - // Start to listen for connections from a client. - Console::WriteLine("Waiting for a connection..."); - - // Accept the connection. - // BeginAcceptSocket() creates the accepted socket. - listener->BeginAcceptTcpClient( - gcnew AsyncCallback(DoAcceptTcpClientCallback), - listener); - - // Wait until a connection is made and processed before - // continuing. - TcpClientConnected->WaitOne(); - } - - // Process the client connection. - public: - static void DoAcceptTcpClientCallback(IAsyncResult^ result) - { - // Get the listener that handles the client request. - TcpListener^ listener = (TcpListener^) result->AsyncState; - - // End the operation and display the received data on - // the console. - TcpClient^ client = listener->EndAcceptTcpClient(result); - - // Process the connection here. (Add the client to a - // server table, read data, etc.) - Console::WriteLine("Client connected completed"); - - // Signal the calling thread to continue. - TcpClientConnected->Set(); - - } - - public: - static void Main() - { - ClientConnected = gcnew ManualResetEvent(false); - - TcpClientConnected = gcnew ManualResetEvent(false); - - TcpListener^ listener = gcnew TcpListener( - Dns::GetHostAddresses(Dns::GetHostName())[0], 4242); - - GetSetExclusiveAddressUse(listener); - - // Start listening for client connections. - DoStart(listener, 20); - - // Accept one client connection asynchronously - DoBeginAcceptSocket(listener); - DoBeginAcceptTcpClient(listener); - - Console::WriteLine("Hit any key"); - Console::Read(); - } - }; -} - -[STAThread] -int main() -{ - TcpListenerExample::TcpServer::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp deleted file mode 100644 index dd999947811..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp +++ /dev/null @@ -1,326 +0,0 @@ - - -// File name:multicastOperations.cs -// This example shows how to join a multicast group and perform a muticast -// data exchange. The OriginatorClient Object* starts the conversation while -// the TargetClient responds. The two helper objects Receive and Send -// perform the actual data exchange. -// Note. This program cannot be build with the current VS build version. -// Build it via command line. Rubuild it in VS when a suitable version is -// available. -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::IO; -using namespace System::Threading; - -// The following Receive class is used by both the ClientOriginator and -// the ClientTarget class to receive data from one another.. -public ref class Receive -{ -public: - - // The following static method performs the actual data - // exchange. In particular, it performs the following tasks: - // 1)Establishes a communication endpoint. - // 2)Receive data through this end point on behalf of the - // caller. - // 3) Returns the received data in ASCII format. - static String^ ReceiveUntilStop( UdpClient^ c ) - { - String^ strData = ""; - String^ Ret = ""; - ASCIIEncoding^ ASCII = gcnew ASCIIEncoding; - - // Establish the communication endpoint. - IPEndPoint^ endpoint = gcnew IPEndPoint( IPAddress::IPv6Any,50 ); - while ( !strData->Equals( "Over" ) ) - { - array^data = c->Receive( endpoint ); - strData = ASCII->GetString( data ); - Ret = String::Concat( Ret, strData, "\n" ); - } - - return Ret; - } - -}; - - -// The following Send class is used by both the ClientOriginator and -// ClientTarget classes to send data to one another. -public ref class Send -{ -private: - static array^greetings = {'H','e','l','l','o',' ','T','a','r','g','e','t','->'}; - static array^nice = {'H','a','v','e',' ','a',' ','n','i','c','e',' ','d','a','y','->'}; - static array^eom = {'O','v','e','r'}; - static array^tGreetings = {'H','e','l','l','o',' ','O','r','i','g','i','n','a','t','o','r','!'}; - static array^tNice = {'Y','o','u',' ','t','o','o','->'}; - -public: - - // The following static method sends data to the ClientTarget on - // behalf of the ClientOriginator. - static void OriginatorSendData( UdpClient^ c, IPEndPoint^ ep ) - { - Console::WriteLine( gcnew String( greetings ) ); - c->Send( GetByteArray( greetings ), greetings->Length, ep ); - Thread::Sleep( 1000 ); - Console::WriteLine( gcnew String( nice ) ); - c->Send( GetByteArray( nice ), nice->Length, ep ); - Thread::Sleep( 1000 ); - Console::WriteLine( gcnew String( eom ) ); - c->Send( GetByteArray( eom ), eom->Length, ep ); - } - - - // The following static method sends data to the ClientOriginator on - // behalf of the ClientTarget. - static void TargetSendData( UdpClient^ c, IPEndPoint^ ep ) - { - Console::WriteLine( gcnew String( tGreetings ) ); - c->Send( GetByteArray( tGreetings ), tGreetings->Length, ep ); - Thread::Sleep( 1000 ); - Console::WriteLine( gcnew String( tNice ) ); - c->Send( GetByteArray( tNice ), tNice->Length, ep ); - Thread::Sleep( 1000 ); - Console::WriteLine( gcnew String( eom ) ); - c->Send( GetByteArray( eom ), eom->Length, ep ); - } - - -private: - - // Internal utility - static array^ GetByteArray( array^ChArray ) - { - array^Ret = gcnew array(ChArray->Length); - for ( int i = 0; i < ChArray->Length; i++ ) - Ret[ i ] = (Byte)ChArray[ i ]; - return Ret; - } - -}; - - -// The ClientTarget class is the receiver of the ClientOriginator -// messages. The StartMulticastConversation method contains the -// logic for exchanging data between the ClientTarget and its -// counterpart ClientOriginator in a multicast operation. -public ref class ClientTarget -{ -private: - static UdpClient^ m_ClientTarget; - static IPAddress^ m_GrpAddr; - -public: - - // The following StartMulticastConversation method connects the UDP - // ClientTarget with the ClientOriginator. - // It performs the following main tasks: - // 1)Creates a UDP client to receive data on a specific port and using - // IPv6 addresses. The port is the same one used by the ClientOriginator - // to define its communication endpoint. - // 2)Joins or creates a multicast group at the specified address. - // 3)Defines the endpoint port to send data to the ClientOriginator. - // 4)Receives data from the ClientOriginator until the end of the - // communication. - // 5)Sends data to the ClientOriginator. - // Note this method is the counterpart of the - // ClientOriginator::ConnectOriginatorAndTarget(). - static void StartMulticastConversation() - { - String^ Ret; - - // Bind and listen on port 1000. Specify the IPv6 address family type. - m_ClientTarget = gcnew UdpClient( 1000,AddressFamily::InterNetworkV6 ); - - // Join or create a multicast group - m_GrpAddr = IPAddress::Parse( "FF01::1" ); - - // Use the overloaded JoinMulticastGroup method. - // Refer to the ClientOriginator method to see how to use the other - // methods. - m_ClientTarget->JoinMulticastGroup( m_GrpAddr ); - - // Define the endpoint data port. Note that this port number - // must match the ClientOriginator UDP port number which is the - // port on which the ClientOriginator is receiving data. - IPEndPoint^ ClientOriginatordest = gcnew IPEndPoint( m_GrpAddr,2000 ); - - // Receive data from the ClientOriginator. - Ret = Receive::ReceiveUntilStop( m_ClientTarget ); - Console::WriteLine( "\nThe ClientTarget received: \n\n {0}\n", Ret ); - - // Done receiving, now respond to the ClientOriginator. - // Wait to make sure the ClientOriginator is ready to receive. - Thread::Sleep( 2000 ); - Console::WriteLine( "\nThe ClientTarget sent:\n" ); - Send::TargetSendData( m_ClientTarget, ClientOriginatordest ); - - // Exit the multicast conversation. - m_ClientTarget->DropMulticastGroup( m_GrpAddr ); - } - -}; - - -// The following ClientOriginator class starts the multicast conversation -// with the ClientTarget class.. -// It performs the following main tasks: -// 1)Creates a socket and binds it to the port on which to communicate. -// 2)Specifies that the connection must use an IPv6 address. -// 3)Joins or create a multicast group. -// Note that the multicast address ranges to use are specified -// in the RFC#2375. -// 4)Defines the endpoint to send the data to and starts the -// client target (ClientTarget) thread. -public ref class ClientOriginator -{ -private: - static UdpClient^ clientOriginator; - static IPAddress^ m_GrpAddr; - static IPEndPoint^ m_ClientTargetdest; - static Thread^ m_t; - -public: - - // The ConnectOriginatorAndTarget method connects the - // ClientOriginator with the ClientTarget. - // It performs the following main tasks: - // 1)Creates a UDP client to receive data on a specific port - // using IPv6 addresses. - // 2)Joins or create a multicast group at the specified address. - // 3)Defines the endpoint port to send data to on the ClientTarget. - // 4)Starts the ClientTarget thread that also creates the ClientTarget Object*. - // Note this method is the counterpart of the - // ClientTarget::StartMulticastConversation(). - static bool ConnectOriginatorAndTarget() - { - try - { - - // - // Bind and listen on port 2000. This constructor creates a socket - // and binds it to the port on which to receive data. The family - // parameter specifies that this connection uses an IPv6 address. - clientOriginator = gcnew UdpClient( 2000,AddressFamily::InterNetworkV6 ); - - // Join or create a multicast group. The multicast address ranges - // to use are specified in RFC#2375. You are free to use - // different addresses. - // Transform the String* address into the internal format. - m_GrpAddr = IPAddress::Parse( "FF01::1" ); - - // Display the multicast address used. - Console::WriteLine( "Multicast Address: [ {0}]", m_GrpAddr ); - - // - // Exercise the use of the IPv6MulticastOption. - Console::WriteLine( "Instantiate IPv6MulticastOption(IPAddress)" ); - - // Instantiate IPv6MulticastOption using one of the - // overloaded constructors. - IPv6MulticastOption^ ipv6MulticastOption = gcnew IPv6MulticastOption( m_GrpAddr ); - - // Store the IPAdress multicast options. - IPAddress^ group = ipv6MulticastOption->Group; - __int64 interfaceIndex = ipv6MulticastOption->InterfaceIndex; - - // Display IPv6MulticastOption properties. - Console::WriteLine( "IPv6MulticastOption::Group: [ {0}]", group ); - Console::WriteLine( "IPv6MulticastOption::InterfaceIndex: [ {0}]", interfaceIndex ); - - // - // - // Instantiate IPv6MulticastOption using another - // overloaded constructor. - IPv6MulticastOption^ ipv6MulticastOption2 = gcnew IPv6MulticastOption( group,interfaceIndex ); - - // Store the IPAdress multicast options. - group = ipv6MulticastOption2->Group; - interfaceIndex = ipv6MulticastOption2->InterfaceIndex; - - // Display the IPv6MulticastOption2 properties. - Console::WriteLine( "IPv6MulticastOption::Group: [ {0} ]", group ); - Console::WriteLine( "IPv6MulticastOption::InterfaceIndex: [ {0} ]", interfaceIndex ); - - // Join the specified multicast group using one of the - // JoinMulticastGroup overloaded methods. - clientOriginator->JoinMulticastGroup( (int)interfaceIndex, group ); - - // - // Define the endpoint data port. Note that this port number - // must match the ClientTarget UDP port number which is the - // port on which the ClientTarget is receiving data. - m_ClientTargetdest = gcnew IPEndPoint( m_GrpAddr,1000 ); - - // - // Start the ClientTarget thread so it is ready to receive. - m_t = gcnew Thread( gcnew ThreadStart( ClientTarget::StartMulticastConversation ) ); - m_t->Start(); - - // Make sure that the thread has started. - Thread::Sleep( 2000 ); - return true; - } - catch ( Exception^ e ) - { - Console::WriteLine( "[ClientOriginator::ConnectClients] Exception: {0}", e ); - return false; - } - - } - - - // The SendAndReceive performs the data exchange - // between the ClientOriginator and the ClientTarget classes. - static String^ SendAndReceive() - { - String^ Ret = ""; - - // - // Send data to ClientTarget. - Console::WriteLine( "\nThe ClientOriginator sent:\n" ); - Send::OriginatorSendData( clientOriginator, m_ClientTargetdest ); - - // Receive data from ClientTarget - Ret = Receive::ReceiveUntilStop( clientOriginator ); - - // Stop the ClientTarget thread - m_t->Abort(); - - // Abandon the multicast group. - clientOriginator->DropMulticastGroup( m_GrpAddr ); - - // - return Ret; - } - -}; - - -//This is the console application entry point. -int main() -{ - - // Join the multicast group. - if ( ClientOriginator::ConnectOriginatorAndTarget() ) - { - - // Perform a multicast conversation with the ClientTarget. - String^ Ret = ClientOriginator::SendAndReceive(); - Console::WriteLine( "\nThe ClientOriginator received: \n\n {0}", Ret ); - } - else - { - Console::WriteLine( "Unable to Join the multicast group" ); - } -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp deleted file mode 100644 index 30d3d0da5b0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -ref class UdpClientExamples -{ -public: - - // - static void GetAvailable( UdpClient^ u ) - { - // Get the number of bytes available for reading. - Console::WriteLine( "Available value is {0}", u->Available ); - } - // - - // - static void GetSetDontFragment( UdpClient^ u ) - { - // Set the don't fragment flag for packets emanating from - // this client. - u->DontFragment = true; - Console::WriteLine( "DontFragment value is {0}", u->DontFragment ); - } - // - - // - static void GetSetEnableBroadcast( UdpClient^ u ) - { - // Set the Broadcast flag for this client. - u->EnableBroadcast = true; - Console::WriteLine( "EnableBroadcast value is {0}", u->EnableBroadcast ); - } - // - - // - static void GetSetExclusiveAddressUse( UdpClient^ u ) - { - // Don't allow another client to bind to this port. - u->ExclusiveAddressUse = true; - Console::WriteLine( "ExclusiveAddressUse value is {0}", u->ExclusiveAddressUse ); - } - // - - // - static void GetSetTtl( UdpClient^ u ) - { - // Set the Time To Live (TTL) for this client. - u->Ttl = 42; - Console::WriteLine( "Ttl value is {0}", u->Ttl ); - } - // - - // - // Subscribe to a multicast group. - static void DoJoinMulticastGroup( UdpClient^ u, String^ mcast, String^ local ) - { - array^ multicastAddress = Dns::GetHostAddresses( mcast ); - - u->JoinMulticastGroup( multicastAddress[0] ); - Console::WriteLine( "Joined multicast Address {0}", multicastAddress ); - } - // - - // - static void GetSetMulticastLoopback( UdpClient^ u ) - { - // Deliver multicast packets back to the sending client. - u->MulticastLoopback = true; - Console::WriteLine( "MulticastLoopback value is {0}", u->MulticastLoopback ); - } - // -}; - -int main() -{ - UdpClient^ u = gcnew UdpClient( 4242 ); - UdpClientExamples::GetAvailable( u ); - UdpClientExamples::GetSetDontFragment( u ); - UdpClientExamples::GetSetEnableBroadcast( u ); - UdpClientExamples::GetSetExclusiveAddressUse( u ); - UdpClientExamples::GetSetTtl( u ); - UdpClientExamples::DoJoinMulticastGroup( u, "224.1.1.1", "172.30.186.134" ); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp deleted file mode 100644 index e6554acb196..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp +++ /dev/null @@ -1,261 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -public ref class UdpClientExample -{ - // -private: - static int listenPort = 13000; - -public: - value struct UdpState - { - public: - UdpClient^ udpClient; - IPEndPoint^ ipEndPoint; - }; - - static bool isMessageReceived; - - static void ReceiveCallback(IAsyncResult^ asyncResult) - { - UdpClient^ udpClient = - ((UdpState)(asyncResult->AsyncState)).udpClient; - IPEndPoint^ ipEndPoint = - ((UdpState)(asyncResult->AsyncState)).ipEndPoint; - - array^ receiveBytes = - udpClient->EndReceive(asyncResult, ipEndPoint); - String^ receiveString = - Encoding::ASCII->GetString(receiveBytes); - - Console::WriteLine("Received: {0}", receiveString); - isMessageReceived = true; - } - - static void ReceiveMessages() - { - // Receive a message and write it to the console. - IPEndPoint^ ipEndPoint = gcnew IPEndPoint(IPAddress::Any, listenPort); - UdpClient^ udpClient = gcnew UdpClient(ipEndPoint); - - UdpState^ udpState = gcnew UdpState(); - udpState->ipEndPoint = ipEndPoint; - udpState->udpClient = udpClient; - - Console::WriteLine("listening for messages"); - udpClient->BeginReceive(gcnew AsyncCallback(ReceiveCallback), - udpState); - - // Do some work while we wait for a message. For this example, - // we'll just sleep - while (!isMessageReceived) - { - Thread::Sleep(100); - } - } - // - - // -public: - static bool isMessageSent; - - static void SendCallback(IAsyncResult^ asyncResult) - { - UdpClient^ udpClient = (UdpClient^)asyncResult->AsyncState; - - Console::WriteLine("number of bytes sent: {0}", - udpClient->EndSend(asyncResult)); - isMessageSent = true; - } - // - - // -public: - static void SendMessage1(String^ server, String^ message) - { - // create the udp socket - UdpClient^ udpClient = gcnew UdpClient(); - - udpClient->Connect(server, listenPort); - array^ sendBytes = Encoding::ASCII->GetBytes(message); - - // send the message - // the destination is defined by the call to .Connect() - udpClient->BeginSend(sendBytes, sendBytes->Length, - gcnew AsyncCallback(SendCallback), udpClient); - - // Do some work while we wait for the send to complete. For - // this example, we'll just sleep - while (!isMessageSent) - { - Thread::Sleep(100); - } - } - // - - // -public: - static void SendMessage2(String^ server, String^ message) - { - // create the udp socket - UdpClient^ udpClient = gcnew UdpClient(); - array^ sendBytes = Encoding::ASCII->GetBytes(message); - - // resolve the server name - IPHostEntry^ resolvedServer = Dns::GetHostEntry(server); - - IPEndPoint^ ipEndPoint = - gcnew IPEndPoint(resolvedServer->AddressList[0], listenPort); - - // send the message - // the destination is defined by the IPEndPoint - udpClient->BeginSend(sendBytes, sendBytes->Length, ipEndPoint, - gcnew AsyncCallback(SendCallback), udpClient); - - // Do some work while we wait for the send to complete. For - // this example, we'll just sleep - while (!isMessageSent) - { - Thread::Sleep(100); - } - } - // - - // -public: - static void SendMessage3(String^ server, String^ message) - { - // create the udp socket - UdpClient^ udpClient = gcnew UdpClient(); - - array^ sendBytes = Encoding::ASCII->GetBytes(message); - - // send the message - // the destination is defined by the server name and port - udpClient->BeginSend(sendBytes, sendBytes->Length, server, listenPort, - gcnew AsyncCallback(SendCallback), udpClient); - - // Do some work while we wait for the send to complete. For - // this example, we'll just sleep - while (!isMessageSent) - { - Thread::Sleep(100); - } - } - // - -}; - -int main(array^ args) -{ - // Parse arguments - String^ server = ""; - String^ message = "This is a test!"; - bool isServer; - int sendMethod = 1; // n called SendMessagen - - if (args->Length == 0) - { - server = "localhost"; - isServer = false; - } - else if (args->Length == 1) - { - if (args[0] == "s") - { - isServer = true; - } - else - { - isServer = false; - } - } - else if (args->Length == 2) - { - if (args[0] == "s") - { - isServer = true; - } - else - { - isServer = false; - } - server = args[1]; - } - else if (args->Length == 3) - { - if (args[0] == "s") - { - isServer = true; - } - else - { - isServer = false; - } - server = args[1]; - message = args[2]; - } - else if (args->Length == 4) - { - if (args[0] == "s") - { - isServer = true; - } - else - { - isServer = false; - } - server = args[1]; - message = args[2]; - - try - { - sendMethod = Convert::ToInt32(args[3]); - } - catch (System::ArgumentNullException^ ex) - { - Console::WriteLine(ex->Message); - } - catch (System::FormatException^ ex) - { - Console::WriteLine(ex->Message); - } - catch (System::OverflowException^ ex) - { - Console::WriteLine(ex->Message); - } - } - else - { - Console::WriteLine( - "Usage: asyncudp [s|c] [host name] [message] [send method]"); - return 0; - } - - if (isServer) - { - UdpClientExample::ReceiveMessages(); - } - else - { - switch (sendMethod) - { - case 1: - UdpClientExample::SendMessage1(server, message); - break; - case 2: - UdpClientExample::SendMessage2(server, message); - break; - case 3: - UdpClientExample::SendMessage3(server, message); - break; - } - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp deleted file mode 100644 index 69d3a8ab9a8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -static void main() -{ - // Register TCP Channel. - ChannelServices::RegisterChannel( gcnew TcpChannel ); - - // - // Create activated client type entry. - ActivatedClientTypeEntry^ activatedClientTypeEntry = gcnew ActivatedClientTypeEntry( HelloServer::typeid, "tcp://localhost:8082" ); - - // - // Register type on client to activate it on the server. - RemotingConfiguration::RegisterActivatedClientType( activatedClientTypeEntry ); - - // Activate a client activated object type. - HelloServer^ helloServer = gcnew HelloServer( "ParameterString" ); - - // - // Print the object type. - Console::WriteLine( "Object type of client activated object: {0}", activatedClientTypeEntry->ObjectType->ToString() ); - - // - // - // Print the application URL. - Console::WriteLine( "Application url where the type is activated: {0}", activatedClientTypeEntry->ApplicationUrl->ToString() ); - - // - // - // Print the string representation of the type entry. - Console::WriteLine( "Type and assembly name and application URL of the remote object: {0}", activatedClientTypeEntry->ToString() ); - - // - // Print a blank line. - Console::WriteLine(); - - // Check that server was located. - if ( !helloServer ) - { - Console::WriteLine( "Could not locate server" ); - } - else - { - Console::WriteLine( "Calling remote object" ); - Console::WriteLine( helloServer->HelloMethod( "Bill" ) ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp deleted file mode 100644 index a394900be3c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp +++ /dev/null @@ -1,19 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -void main() -{ - ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); - RemotingConfiguration::RegisterActivatedServiceType( HelloServer::typeid ); - Console::WriteLine( "Press enter to stop this process" ); - Console::ReadLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp deleted file mode 100644 index ba2e8f35ea8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; -public ref class HelloServer: public MarshalByRefObject -{ -public: - HelloServer( String^ myString ) - { - Console::WriteLine( "HelloServer activated" ); - Console::WriteLine( "Paramater passed to the constructor is {0}", myString ); - } - - String^ HelloMethod( String^ myName ) - { - Console::WriteLine( "HelloMethod : {0}", myName ); - return String::Format( "Hi there {0}", myName ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp deleted file mode 100644 index b590a6fac71..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -// -#using -#using -#using "RemoteObject.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Activation; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -[STAThread] -int main() -{ - - // Report initial status. - Console::WriteLine( "Client starting." ); - - // Register TCP channel. - ChannelServices::RegisterChannel( gcnew TcpChannel ); - - // - // Create UrlAttribute. - UrlAttribute^ attribute = gcnew UrlAttribute( "tcp://localhost:1234/RemoteApp" ); - Console::WriteLine( "UrlAttribute value: {0}", attribute->UrlValue ); - - // - array^activationAttributes = {attribute}; - - // Use UrlAttribute to register for client activated remote object. - RemotingConfiguration::RegisterActivatedClientType( RemoteObject::typeid, "tcp://localhost:1234/RemoteApp" ); - - // Activate remote object. - Console::WriteLine( "Activating remote object." ); - RemoteObject ^ obj = dynamic_cast(Activator::CreateInstance( RemoteObject::typeid, nullptr, activationAttributes )); - - // Invoke a method on it. - Console::WriteLine( "Invoking Hello() on remote object." ); - obj->Hello(); - - // Inform user of termination. - Console::WriteLine( "Terminating client." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp deleted file mode 100644 index 9ce57af4de1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp +++ /dev/null @@ -1,27 +0,0 @@ - -// -using namespace System; -using namespace System::Security; -using namespace System::Security::Permissions; - -[assembly:AllowPartiallyTrustedCallersAttribute]; -public ref class RemoteObject: public MarshalByRefObject -{ -public: - RemoteObject() - { - - // Report object construction to server's console. - Console::WriteLine( "You have called the constructor." ); - } - - void Hello() - { - - // Report method invocation to server's console. - Console::WriteLine( "You have called Hello()." ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp deleted file mode 100644 index d6e404eb60d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using -#using -#using "RemoteObject.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -[STAThread] -int main() -{ - - // Report status to user. - Console::WriteLine( "Server starting." ); - - // Register the TCP channel. - ChannelServices::RegisterChannel( gcnew TcpChannel( 1234 ) ); - - // Set application name. - RemotingConfiguration::ApplicationName = "RemoteApp"; - - // Register object for client activated remoting. - RemotingConfiguration::RegisterActivatedServiceType( RemoteObject::typeid ); - - // Wait until termination. - Console::WriteLine( "Press enter to end." ); - Console::ReadLine(); - Console::WriteLine( "Terminating server." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp deleted file mode 100644 index 7fd2481de46..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp +++ /dev/null @@ -1,68 +0,0 @@ - -/// Class: System.Runtime.Remoting.Channels.Http.HttpClientChannel -/// 10 class - client -/// 40 class - server -/// 30 class - remotable object -/// 21 #ctor(IDictionary,IClientChannelSinkProvider) -/// 22 #ctor(string,sinkProvider) -/// 11 CreateMessageSink -/// 12 Item -/// 12 Keys -/// 13 Parse -// -#using -#using -#using "common.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -void main() -{ - // Create the channel. - HttpClientChannel^ clientChannel = gcnew HttpClientChannel; - - // Register the channel. - ChannelServices::RegisterChannel( clientChannel ); - - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( RemoteObject::typeid,L"http://localhost:9090/RemoteObject.rem" ); - RemotingConfiguration::RegisterWellKnownClientType( remoteType ); - - // - // Create a message sink. - String^ objectUri; - System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( L"http://localhost:9090/RemoteObject.rem", nullptr, objectUri ); - Console::WriteLine( L"The URI of the message sink is {0}.", objectUri ); - if ( messageSink != nullptr ) - { - Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() ); - } - // - - // - // Display the channel's properties using Keys and Item. - for each(String^ key in clientChannel->Keys) - { - Console::WriteLine("clientChannel[{0}] = <{1}>", key, clientChannel[key]); - } - // - - // - // Parse the channel's URI. - String^ objectUrl = L"http://localhost:9090/RemoteObject.rem"; - String^ channelUri = clientChannel->Parse( objectUrl, objectUri ); - Console::WriteLine( L"The object URL is {0}.", objectUrl ); - Console::WriteLine( L"The object URI is {0}.", objectUri ); - Console::WriteLine( L"The channel URI is {0}.", channelUri ); - // - - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - Console::WriteLine( L"The client is invoking the remote object." ); - Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp deleted file mode 100644 index 82c72ff9ce5..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp +++ /dev/null @@ -1,93 +0,0 @@ - -/// x broken -/// + done -/// 9 number of snippet -/// Need snippets: -/// 21 #ctor(IDictionary,IClientChannelSinkProvider) -/// 22 #ctor(string,sinkProvider) -/// 11 CreateMessageSink -/// 12 Item -/// 12 Keys -/// 13 Parse -#using -#using -#using "common.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -static HttpClientChannel^ Ctor1() -{ - - // - // Create a client channel. - System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable; - properties->default[ L"port" ] = 9090; - IClientChannelSinkProvider^ sinkProvider = nullptr; - HttpClientChannel^ clientChannel = gcnew HttpClientChannel( properties,sinkProvider ); - - // - return clientChannel; -} - -static HttpClientChannel^ Ctor2() -{ - - // - // Create a client channel. - String^ name = L"RemotingClient"; - IClientChannelSinkProvider^ sinkProvider = nullptr; - HttpClientChannel^ clientChannel = gcnew HttpClientChannel( name,sinkProvider ); - - // - return clientChannel; -} - -static void Register( HttpClientChannel^ channel ) -{ - - // Register the channel. - ChannelServices::RegisterChannel( channel ); - - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( - RemoteObject::typeid, L"http://localhost:9090/RemoteObject.rem" ); - RemotingConfiguration::RegisterWellKnownClientType( remoteType ); -} - -static void InvokeRemoteObject( RemoteObject^ service ) -{ - - // Invoke a method on the remote object. - Console::WriteLine( L"The client is invoking the remote object." ); - Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); -} - -void main() -{ - array^args = Environment::GetCommandLineArgs(); - - // Create the channel. - HttpClientChannel^ clientChannel = nullptr; - String^ overload = args[ 1 ]; - if ( overload->Equals( L"1" ) ) - clientChannel = Ctor1(); - else - if ( overload->Equals( L"2" ) ) - clientChannel = Ctor2(); - else - throw gcnew Exception( String::Format( L"Argument {0} was invalid.", args[ 1 ] ) ); - - - - // Register the channel and the client. - Register( clientChannel ); - - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - InvokeRemoteObject( service ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp deleted file mode 100644 index 48993e10a85..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -#using -using namespace System; -using namespace System::Runtime::Remoting; - -// Remote object. -public ref class RemoteObject: public MarshalByRefObject -{ -private: - static int callCount = 0; - -public: - int GetCount() - { - Console::WriteLine( L"GetCount was called." ); - callCount++; - return (callCount); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp deleted file mode 100644 index 644ca673c78..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -void main() -{ - // Create the server channel. - HttpServerChannel^ serverChannel = gcnew HttpServerChannel( 9090 ); - - // Register the server channel. - ChannelServices::RegisterChannel( serverChannel ); - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( RemoteObject::typeid, L"RemoteObject.rem", WellKnownObjectMode::Singleton ); - - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp deleted file mode 100644 index 0bc567804aa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp +++ /dev/null @@ -1,31 +0,0 @@ -// -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -void main() -{ - // Create the channel. - HttpClientChannel^ channel = gcnew HttpClientChannel; - - // Register the channel. - ChannelServices::RegisterChannel( channel ); - - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( - RemoteObject::typeid,L"http://localhost:9090/RemoteObject.rem" ); - RemotingConfiguration::RegisterWellKnownClientType( remoteType ); - - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - Console::WriteLine( L"The client is invoking the remote object." ); - Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp deleted file mode 100644 index db03ebf8070..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp +++ /dev/null @@ -1,19 +0,0 @@ -// -using namespace System; -using namespace System::Runtime::Remoting; - -// Remote object. -public ref class RemoteObject: public MarshalByRefObject -{ -private: - static int callCount = 0; - -public: - int GetCount() - { - callCount++; - return (callCount); - } - -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp deleted file mode 100644 index 52710e3ce2a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp +++ /dev/null @@ -1,91 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Http.HttpServerChannel -/// 20 class - server -/// 30 class - client -/// 40 class - remotable object -/// 12 ctor(IDictionary,IServerChannelSinkProvider) -/// 13 ctor(string,int) -/// 14 ctor(string,int,IServerChannelSinkProvider) -/// 21 ChannelScheme -/// 23 ChannelSinkChain -/// 22 GetChannelUri() -/// 25 Parse() -/// 24 WantsToListen -/// ! Ctor() -/// ! AddHookChannelUri -/// ! Item -/// ! Keys -/// ! StartListening -/// ! StopListening -/// Bug Notes [01-26-04][Mon] -/// AddHookChannelUri does not pick up port. -/// Ctor() would be usable if AddHookChannelUri could be -/// used to set the port later. Since it can't Ctor() is -/// also unusable. Items and Keys are unimplemented. While -/// StopListening works, StartListening does not restart -/// listening -- client fails. These two are likely to be -/// used as a pair and are therefore unusable. -// -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -int main() -{ - // Create the server channel. - HttpServerChannel^ serverChannel = gcnew HttpServerChannel( 9090 ); - - // Register the server channel. - ChannelServices::RegisterChannel( serverChannel ); - - // - // Display the channel's scheme. - Console::WriteLine( L"The channel scheme is {0}.", serverChannel->ChannelScheme ); - - // - // - // Display the channel's URI. - Console::WriteLine( L"The channel URI is {0}.", serverChannel->GetChannelUri() ); - - // - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid, L"RemoteObject.rem", WellKnownObjectMode::Singleton ); - - // - // Get the channel's sink chain. - IServerChannelSink^ sinkChain = serverChannel->ChannelSinkChain; - Console::WriteLine( L"The type of the server channel's sink chain is {0}.", sinkChain->GetType() ); - - // - // - // See if the channel wants to listen. - bool wantsToListen = serverChannel->WantsToListen; - Console::WriteLine( L"The value of WantsToListen is {0}.", wantsToListen ); - - // - // - // Parse the channel's URI. - array^ urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" ); - if ( urls->Length > 0 ) - { - String^ objectUrl = urls[ 0 ]; - String^ objectUri; - String^ channelUri = serverChannel->Parse( objectUrl, objectUri ); - Console::WriteLine( L"The object URI is {0}.", objectUri ); - Console::WriteLine( L"The channel URI is {0}.", channelUri ); - Console::WriteLine( L"The object URL is {0}.", objectUrl ); - } - - - // - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp deleted file mode 100644 index 845f7224e29..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/// Legend: -/// - Bugs -/// x Done -/// Work in progress -/// Snippets needed: -/// - Ctor() -/// x Ctor(IDictionary,IServerChannelSinkProvider) -/// x Ctor(string,int) -/// x Ctor(string,int,IServerChannelSinkProvider) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -static HttpServerChannel^ Ctor2() -{ - // - System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable; - properties->default[ L"port" ] = 9090; - IServerChannelSinkProvider^ sinkProvider = nullptr; - HttpServerChannel^ serverChannel = gcnew HttpServerChannel( properties,sinkProvider ); - - // - return serverChannel; -} - -// Broken. -static HttpServerChannel^ Ctor1() -{ - // - HttpServerChannel^ serverChannel = gcnew HttpServerChannel; - serverChannel->AddHookChannelUri( L"http://localhost:9090" ); - - // - // return serverChannel; - // Return good channel until fix. - return Ctor2(); -} - -static HttpServerChannel^ Ctor3() -{ - // - String^ name = L"RemotingServer"; - int port = 9090; - HttpServerChannel^ serverChannel = gcnew HttpServerChannel( name,port ); - - // - return serverChannel; -} - -static HttpServerChannel^ Ctor4() -{ - - // - String^ name = L"RemotingServer"; - int port = 9090; - IServerChannelSinkProvider^ sinkProvider = nullptr; - HttpServerChannel^ serverChannel = gcnew HttpServerChannel( - name,port,sinkProvider ); - - // - return serverChannel; -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - HttpServerChannel^ serverChannel = nullptr; - String^ overload = args[ 1 ]; - if ( overload->Equals( L"1" ) ) serverChannel = Ctor1(); - else if ( overload->Equals( L"2" ) ) serverChannel = Ctor2(); - else if ( overload->Equals( L"3" ) ) serverChannel = Ctor3(); - else if ( overload->Equals( L"4" ) ) serverChannel = Ctor4(); - else throw gcnew Exception( String::Format( - L"Argument {0} was invalid.", args[ 1 ] ) ); - - // Register the server channel. - ChannelServices::RegisterChannel( serverChannel ); - - // Display the channel's URI. - Console::WriteLine( L"The URI of the channel is {0}.", - serverChannel->GetChannelUri() ); - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid, L"RemoteObject.rem", - WellKnownObjectMode::Singleton ); - - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp deleted file mode 100644 index 4c49318b1c7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting::Channels::Ipc; - -void main() -{ - - // - // Create the channel. - IpcChannel^ channel = gcnew IpcChannel; - - // - // Register the channel. - System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel(channel); - - // Register as client for remote object. - System::Runtime::Remoting::WellKnownClientTypeEntry^ remoteType = gcnew - System::Runtime::Remoting::WellKnownClientTypeEntry( - RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem" ); - System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownClientType(remoteType); - - // - // Create a message sink. - String^ objectUri; - System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = channel->CreateMessageSink( - L"ipc://localhost:9090/RemoteObject.rem", nullptr, objectUri ); - Console::WriteLine( L"The URI of the message sink is {0}.", objectUri ); - if ( messageSink != nullptr ) - { - Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() ); - } - - - // - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - Console::WriteLine( L"The client is invoking the remote object." ); - Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp deleted file mode 100644 index 8143f1ac9c1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -// -using namespace System; - -// Remote object. -public ref class RemoteObject: public MarshalByRefObject -{ -private: - static int callCount = 0; - -public: - int GetCount() - { - Console::WriteLine( L"GetCount has been called." ); - callCount++; - return (callCount); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp deleted file mode 100644 index fb005b99e64..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp +++ /dev/null @@ -1,76 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Ipc.IpcChannel -/// 10 class - Server.cs -/// 20 class - Client.cs -/// 30 class - Common.cs -/// 21 #ctor() -/// 11 #ctor(string) -/// 41 #ctor(IDictionary,IClientChannelSinkProvider,IServerChannelSinkProvider) -/// 15 ChannelData -/// 12 ChannelName -/// 13 ChannelPriority -/// 22 CreateMessageSink() -/// 19 GetUrlsForUri() -/// 19 Parse() -/// ! StartListening() -/// ! StopListening() -// -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting::Channels::Ipc; - -void main() -{ - // - // Create the server channel. - IpcChannel^ serverChannel = gcnew IpcChannel( L"localhost:9090" ); - // - - // Register the server channel. - System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel( serverChannel ); - - // - // Show the name of the channel. - Console::WriteLine( L"The name of the channel is {0}.", serverChannel->ChannelName ); - // - - // - // Show the priority of the channel. - Console::WriteLine( L"The priority of the channel is {0}.", serverChannel->ChannelPriority ); - // - - // - // Show the URIs associated with the channel. - System::Runtime::Remoting::Channels::ChannelDataStore^ channelData = (System::Runtime::Remoting::Channels::ChannelDataStore^)serverChannel->ChannelData; - for each (String^ uri in channelData->ChannelUris) - { - Console::WriteLine("The channel URI is {0}.", uri); - } - // - - // Expose an object for remote calls. - System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid,L"RemoteObject.rem", - System::Runtime::Remoting::WellKnownObjectMode::Singleton); - - // - // Parse the channel's URI. - array^ urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" ); - if ( urls->Length > 0 ) - { - String^ objectUrl = urls[ 0 ]; - String^ objectUri; - String^ channelUri = serverChannel->Parse( objectUrl, objectUri ); - Console::WriteLine( L"The object URI is {0}.", objectUri ); - Console::WriteLine( L"The channel URI is {0}.", channelUri ); - Console::WriteLine( L"The object URL is {0}.", objectUrl ); - } - // - - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp deleted file mode 100644 index 3bd26211f01..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp +++ /dev/null @@ -1,43 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Ipc.IpcChannel -/// 41 #ctor(IDictionary,IClientChannelSinkProvider,IServerChannelSinkProvider) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -void main() -{ - - // - // Create the server channel. - System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable; - properties->default[ L"name" ] = L"ipc"; - properties->default[ L"priority" ] = L"20"; - properties->default[ L"portName" ] = L"localhost:9090"; - IpcChannel^ serverChannel = gcnew IpcChannel( properties,nullptr,nullptr ); - - // - // Register the server channel. - ChannelServices::RegisterChannel( serverChannel ); - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid, L"RemoteObject.rem", WellKnownObjectMode::Singleton ); - - // Show the URIs associated with the channel. - ChannelDataStore^ channelData = dynamic_cast(serverChannel->ChannelData); - System::Collections::IEnumerator^ myEnum = channelData->ChannelUris->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ uri = safe_cast(myEnum->Current); - Console::WriteLine( L"The channel URI is {0}.", uri ); - } - - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp deleted file mode 100644 index 83717776b8b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp +++ /dev/null @@ -1,70 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Ipc.IpcClientChannel -/// 41 #ctor(IDictionary,IClientChannelSinkProvider) -/// 42 #ctor(String,IClientChannelSinkProvider) -/// 21 ChannelName -/// 23 ChannelPriority -/// 22 CreateMessageSink(String,Object,String@) -/// 24 Parse(String,String@) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -void main() -{ - - // Create the channel. - IpcClientChannel^ clientChannel = gcnew IpcClientChannel; - - // Register the channel. - System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel(clientChannel); - - // - // Show the name of the channel. - Console::WriteLine( L"The name of the channel is {0}.", clientChannel->ChannelName ); - - // - // - // Show the priority of the channel. - Console::WriteLine( L"The priority of the channel is {0}.", clientChannel->ChannelPriority ); - - // - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( - RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem" ); - System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownClientType(remoteType); - - // - // Create a message sink. - String^ messageSinkUri; - Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( - L"ipc://localhost:9090/RemoteObject.rem", nullptr, messageSinkUri ); - Console::WriteLine( L"The URI of the message sink is {0}.", messageSinkUri ); - if ( messageSink != nullptr ) - { - Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() ); - } - - - // - // - // Parse the object URL. - String^ objectUrl = L"ipc://localhost:9090/RemoteObject.rem"; - String^ objectUri; - String^ channelUri = clientChannel->Parse( objectUrl, objectUri ); - Console::WriteLine( L"The object URL is {0}.", objectUrl ); - Console::WriteLine( L"The object URI is {0}.", objectUri ); - Console::WriteLine( L"The channel URI is {0}.", channelUri ); - - // - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - Console::WriteLine( L"The client is invoking the remote object." ); - Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp deleted file mode 100644 index 8b87bbee8c2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Ipc.IpcClientChannel -/// 41 #ctor(IDictionary,IClientChannelSinkProvider) -/// 42 #ctor(String,IClientChannelSinkProvider) -/// 21 ChannelName -/// 23 ChannelPriority -/// 22 CreateMessageSink(String,Object,String@) -/// 24 Parse(String,String@) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -static IpcClientChannel^ Ctor1() -{ - // - // Create the client channel. - System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable; - properties->default[ L"name" ] = L"ipc client"; - properties->default[ L"priority" ] = L"1"; - IClientChannelSinkProvider^ sinkProvider = nullptr; - IpcClientChannel^ clientChannel = gcnew IpcClientChannel( properties,sinkProvider ); - // - - return clientChannel; -} - -static IpcClientChannel^ Ctor2() -{ - // - // Create the client channel. - String^ name = L"ipc client"; - IClientChannelSinkProvider^ sinkProvider = nullptr; - IpcClientChannel^ clientChannel = gcnew IpcClientChannel( name,sinkProvider ); - // - - return clientChannel; -} - -void main() -{ - array^args = Environment::GetCommandLineArgs(); - - // Create the client channel. - IpcClientChannel^ clientChannel = nullptr; -// if ( false ) {} -// else - if ( args[ 1 ]->Equals( L"1" ) ) - clientChannel = Ctor1(); - else - if ( args[ 1 ]->Equals( L"2" ) ) - clientChannel = Ctor2(); - else - throw gcnew ApplicationException( L"Invalid argument." ); - - // Register the channel. - ChannelServices::RegisterChannel( clientChannel ); - - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( - RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem" ); - RemotingConfiguration::RegisterWellKnownClientType( remoteType ); - - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - Console::WriteLine( L"The client is invoking the remote object." ); - Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp deleted file mode 100644 index 81cd95206cb..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Ipc.IpcServerChannel -/// 41 #ctor(IDictionary,IServerChannelSinkProvider) -/// 42 #ctor(String,String) -/// 43 #ctor(String,String,IServerChannelSinkProvider) -/// 15 ChannelData -/// 12 ChannelName -/// 13 ChannelPriority -/// 19 GetUrlsForUri -/// 19 Parse(String,String@) -/// ! StartListening(Object) -/// ! StopListening(Object) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -void main() -{ - // Create the server channel. - IpcServerChannel^ serverChannel = gcnew IpcServerChannel( L"localhost:9090" ); - - // Register the server channel. - System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel( serverChannel ); - - // - // Show the name of the channel. - Console::WriteLine( L"The name of the channel is {0}.",serverChannel->ChannelName ); - // - - // - // Show the priority of the channel. - Console::WriteLine( L"The priority of the channel is {0}.",serverChannel->ChannelPriority ); - // - - // - // Show the URIs associated with the channel. - System::Runtime::Remoting::Channels::ChannelDataStore^ channelData = - static_cast - (serverChannel->ChannelData); - System::Collections::IEnumerator^ myEnum = channelData->ChannelUris->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ uri = safe_cast( myEnum->Current ); - Console::WriteLine( L"The channel URI is {0}.",uri ); - } - // - - // Expose an object for remote calls. - System::Runtime::Remoting::RemotingConfiguration:: - RegisterWellKnownServiceType( - RemoteObject::typeid,L"RemoteObject.rem", - System::Runtime::Remoting::WellKnownObjectMode::Singleton ); - - // - // Parse the channel's URI. - array^urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" ); - if ( urls->Length > 0 ) - { - String^ objectUrl = urls[ 0 ]; - String^ objectUri; - String^ channelUri = serverChannel->Parse( objectUrl,objectUri ); - Console::WriteLine( L"The object URI is {0}.",objectUri ); - Console::WriteLine( L"The channel URI is {0}.",channelUri ); - Console::WriteLine( L"The object URL is {0}.",objectUrl ); - } - // - - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp deleted file mode 100644 index 41624295c75..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp +++ /dev/null @@ -1,86 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Ipc.IpcServerChannel -/// 41 #ctor(IDictionary,IServerChannelSinkProvider) -/// 42 #ctor(String,String) -/// 43 #ctor(String,String,IServerChannelSinkProvider) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Ipc; - -static IpcServerChannel^ Ctor1() -{ - // - // Create the server channel. - System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable; - properties->default[ L"name" ] = L"ipc"; - properties->default[ L"priority" ] = L"20"; - properties->default[ L"portName" ] = L"localhost:9090"; - IpcServerChannel^ serverChannel = gcnew IpcServerChannel( properties, nullptr ); - - // - return serverChannel; -} - -static IpcServerChannel^ Ctor2() -{ - // - // Create the server channel. - String^ name = L"ipc"; - String^ portName = L"localhost:9090"; - IpcServerChannel^ serverChannel = gcnew IpcServerChannel( name,portName ); - - // - return serverChannel; -} - -static IpcServerChannel^ Ctor3() -{ - // - // Create the server channel. - String^ name = L"ipc"; - String^ portName = L"localhost:9090"; - IServerChannelSinkProvider^ sinkProvider = nullptr; - IpcServerChannel^ serverChannel = gcnew IpcServerChannel( name,portName,sinkProvider ); - - // - return serverChannel; -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - - // Create the server channel. - IpcServerChannel^ serverChannel = nullptr; - if ( false ) {} - else if ( args[ 1 ]->Equals( L"1" ) ) serverChannel = Ctor1(); - else if ( args[ 1 ]->Equals( L"2" ) ) serverChannel = Ctor2(); - else if ( args[ 1 ]->Equals( L"3" ) ) serverChannel = Ctor3(); - else throw gcnew ApplicationException( L"Invalid argument." ); - - // Register the server channel. - ChannelServices::RegisterChannel( serverChannel ); - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid, L"RemoteObject.rem", - WellKnownObjectMode::Singleton ); - - // Show the URIs associated with the channel. - ChannelDataStore^ channelData = static_cast(serverChannel->ChannelData); - System::Collections::IEnumerator^ myEnum = channelData->ChannelUris->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ uri = static_cast(myEnum->Current); - Console::WriteLine( L"The channel URI is {0}.", uri ); - } - - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp deleted file mode 100644 index 5318cdac4b1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Security::Permissions; - -int main(array^ args) -{ - // - // Create the channel. - TcpChannel^ clientChannel = gcnew TcpChannel(); - // - - // Register the channel. - ChannelServices::RegisterChannel(clientChannel, false); - - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( - RemoteObject::typeid,"tcp://localhost:9090/RemoteObject.rem"); - RemotingConfiguration::RegisterWellKnownClientType(remoteType); - - // - // Create a message sink. - String^ objectUri; - System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = - clientChannel->CreateMessageSink( - "tcp://localhost:9090/RemoteObject.rem", nullptr, - objectUri); - Console::WriteLine("The URI of the message sink is {0}.", - objectUri); - if (messageSink != nullptr) - { - Console::WriteLine("The type of the message sink is {0}.", - messageSink->GetType()->ToString()); - } - // - - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject(); - - // Invoke a method on the remote object. - Console::WriteLine("The client is invoking the remote object."); - Console::WriteLine("The remote object has been called {0} times.", - service->GetCount()); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp deleted file mode 100644 index a84a5d0ff07..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp +++ /dev/null @@ -1,25 +0,0 @@ - -// -using namespace System; -using namespace System::Runtime::Remoting; - -// Remote object. -public ref class RemoteObject: public MarshalByRefObject -{ -private: - int callCount; - -public: - RemoteObject() - : callCount( 0 ) - {} - - int GetCount() - { - callCount++; - return (callCount); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp deleted file mode 100644 index 5fbb4596bd1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp +++ /dev/null @@ -1,68 +0,0 @@ -/// class: System.Runtime.Remoting.Channels.Tcp.TcpChannel -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Security::Permissions; - -[SecurityPermission(SecurityAction::Demand)] -int main(array^ args) -{ - // - // Create the server channel. - TcpChannel^ serverChannel = gcnew TcpChannel(9090); - // - - // Register the server channel. - ChannelServices::RegisterChannel(serverChannel); - - // - // Show the name of the channel. - Console::WriteLine("The name of the channel is {0}.", - serverChannel->ChannelName); - // - - // - // Show the priority of the channel. - Console::WriteLine("The priority of the channel is {0}.", - serverChannel->ChannelPriority); - // - - // - // Show the URIs associated with the channel. - ChannelDataStore^ data = (ChannelDataStore^) serverChannel->ChannelData; - for each (String^ uri in data->ChannelUris) - { - Console::WriteLine("The channel URI is {0}.", uri); - } - // - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid, "RemoteObject.rem", - WellKnownObjectMode::Singleton); - - // - // Parse the channel's URI. - array^ urls = serverChannel->GetUrlsForUri("RemoteObject.rem"); - if (urls->Length > 0) - { - String^ objectUrl = urls[0]; - String^ objectUri; - String^ channelUri = serverChannel->Parse(objectUrl, objectUri); - Console::WriteLine("The object URL is {0}.", objectUrl); - Console::WriteLine("The object URI is {0}.", objectUri); - Console::WriteLine("The channel URI is {0}.", channelUri); - } - // - - // Wait for the user prompt. - Console::WriteLine("Press ENTER to exit the server."); - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp deleted file mode 100644 index f4d15c4f152..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -#using -#using -#using "common.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -int main() -{ - // - // Specify the properties for the server channel. - System::Collections::IDictionary^ dict = gcnew System::Collections::Hashtable; - dict[ "port" ] = 9090; - dict[ "authenticationMode" ] = "IdentifyCallers"; - - // Set up the server channel. - TcpChannel^ serverChannel = gcnew TcpChannel( dict,nullptr,nullptr ); - ChannelServices::RegisterChannel( serverChannel ); - // - - // Show the name and priority of the channel. - Console::WriteLine( "The name of the channel is {0}.", serverChannel->ChannelName ); - Console::WriteLine( "The priority of the channel is {0}.", serverChannel->ChannelPriority ); - - // Show the URIs associated with the channel. - ChannelDataStore^ data = dynamic_cast(serverChannel->ChannelData); - for each (String^ uri in data->ChannelUris) - { - Console::WriteLine("The channel URI is {0}.", uri); - } - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( RemoteObject::typeid, "RemoteObject.rem", WellKnownObjectMode::Singleton ); - - // Parse the channel's URI. - array^urls = serverChannel->GetUrlsForUri( "RemoteObject.rem" ); - if ( urls->Length > 0 ) - { - String^ objectUrl = urls[ 0 ]; - String^ objectUri; - String^ channelUri = serverChannel->Parse( objectUrl, objectUri ); - Console::WriteLine( "The object URL is {0}.", objectUrl ); - Console::WriteLine( "The object URI is {0}.", objectUri ); - Console::WriteLine( "The channel URI is {0}.", channelUri ); - } - - // Wait for the user prompt. - Console::WriteLine( "Press enter to terminate the server." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp deleted file mode 100644 index 83994f5bc7f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// class: System.Runtime.Remoting.Channels.Tcp.TcpClientChannel -// client.cs: -// Ctor(string, IClientChannelSinkProvider) -// CreateMessageSink -// Parse -// -#using -#using -#using "common.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -int main() -{ - - // - // Create the channel. - TcpClientChannel^ clientChannel = gcnew TcpClientChannel( "Client",nullptr ); - - // - // Register the channel. - ChannelServices::RegisterChannel( clientChannel ); - - // Register as client for remote object. - WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( RemoteObject::typeid,"tcp://localhost:9090/RemoteObject.rem" ); - RemotingConfiguration::RegisterWellKnownClientType( remoteType ); - - // - // Create a message sink. - String^ objectUri; - System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( "tcp://localhost:9090/RemoteObject.rem", nullptr, objectUri ); - Console::WriteLine( "The URI of the message sink is {0}.", objectUri ); - Console::WriteLine( "The type of the message sink is {0}.", messageSink->GetType() ); - - // - // - // Parse the channel's URI. - String^ objectUrl = "tcp://localhost:9090/RemoteObject.rem"; - String^ channelUri = clientChannel->Parse( objectUrl, objectUri ); - Console::WriteLine( "The object URL is {0}.", objectUrl ); - Console::WriteLine( "The object URI is {0}.", objectUri ); - Console::WriteLine( "The channel URI is {0}.", channelUri ); - - // - // Create an instance of the remote object. - RemoteObject^ service = gcnew RemoteObject; - - // Invoke a method on the remote object. - Console::WriteLine( "The client is invoking the remote object." ); - Console::WriteLine( "The remote object has been called {0} times.", service->GetCount() ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp deleted file mode 100644 index 3f6748f6f96..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -/// Snippets needed: -/// 21 Ctor(string, int) -#using -#using -#using "common.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; -int main() -{ - // - // Create the server channel. - TcpServerChannel^ channel = gcnew TcpServerChannel( "Server Channel",9090 ); - - // - // Register the server channel. - ChannelServices::RegisterChannel( channel ); - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( Remotable::typeid, "Remotable.rem", WellKnownObjectMode::Singleton ); - - // Display the channel's URI. - Console::WriteLine( "The channel URI is {0}.", channel->GetChannelUri() ); - - // Parse the channel's URI. - array^urls = channel->GetUrlsForUri( "Remotable.rem" ); - if ( urls->Length > 0 ) - { - String^ objectUrl = urls[ 0 ]; - String^ objectUri; - String^ channelUri = channel->Parse( objectUrl, objectUri ); - Console::WriteLine( "The object URI is {0}.", objectUri ); - Console::WriteLine( "The channel URI is {0}.", channelUri ); - Console::WriteLine( "The object URL is {0}.", objectUrl ); - } - - // Wait for the user prompt. - Console::WriteLine( "Press enter to terminate the server." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp deleted file mode 100644 index f7e0ccdcfef..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/// Class: System.Runtime.Remoting.Channels.Tcp.TcpServerChannel -/// 21 Ctor(string, int, IServerChannelSinkProvider) -/// 22 GetChannelUri(); -/// 23 Parse(); -/// ! Ctor(string, int) -#using -#using -#using "common.dll" -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Tcp; - -void main() -{ - // - // Create the server channel. - TcpServerChannel^ channel = gcnew TcpServerChannel( - L"Server Channel",9090,nullptr ); - // - - // Register the server channel. - ChannelServices::RegisterChannel( channel ); - - // Expose an object for remote calls. - RemotingConfiguration::RegisterWellKnownServiceType( - RemoteObject::typeid, L"RemoteObject.rem", - WellKnownObjectMode::Singleton ); - - // - // Display the channel's URI. - Console::WriteLine( L"The channel URI is {0}.", - channel->GetChannelUri() ); - // - - // - // Parse the channel's URI. - array^urls = channel->GetUrlsForUri( L"RemoteObject.rem" ); - if ( urls->Length > 0 ) - { - String^ objectUrl = urls[ 0 ]; - String^ objectUri; - String^ channelUri = channel->Parse( objectUrl, objectUri ); - Console::WriteLine( L"The object URI is {0}.", objectUri ); - Console::WriteLine( L"The channel URI is {0}.", channelUri ); - Console::WriteLine( L"The object URL is {0}.", objectUrl ); - } - // - - // Wait for the user prompt. - Console::WriteLine( L"Press ENTER to exit the server." ); - Console::ReadLine(); - Console::WriteLine( L"The server is exiting." ); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp deleted file mode 100644 index 4c0cf07dc06..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Runtime::Remoting::Lifetime; - -int main() -{ - LifetimeServices::LeaseTime = TimeSpan::FromSeconds( 5 ); - LifetimeServices::LeaseManagerPollTime = TimeSpan::FromSeconds( 3 ); - LifetimeServices::RenewOnCallTime = TimeSpan::FromSeconds( 2 ); - LifetimeServices::SponsorshipTimeout = TimeSpan::FromSeconds( 1 ); - ChannelServices::RegisterChannel( gcnew HttpChannel( 8080 ) ); - RemotingConfiguration::RegisterActivatedServiceType( ClientActivatedType::typeid ); - Console::WriteLine( "The server is listening. Press Enter to exit...." ); - Console::ReadLine(); - Console::WriteLine( "GC'ing." ); - GC::Collect(); - GC::WaitForPendingFinalizers(); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp deleted file mode 100644 index f1a1fd691e9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.SoapMethodAttribute -/// 100 class -/// 110 ResponseXmlElementName -/// 110 ResponseXmlNamespace -/// 110 ReturnXmlElementName -/// 110 SoapAction -/// 110 XmlNamespace -/// ! #ctor cannot be snippeted because attribute is not constructed -/// using new, but rather implicitly constructed through an attribute -/// tag. -/// -/// ! UseAttribute cannot be snippeted because exception is thrown. -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata; - -namespace ExampleNamespace -{ - public ref class ExampleClass - { - public: - // - [SoapMethod( - ResponseXmlElementName="ExampleResponseElement", - ResponseXmlNamespace= - "http://example.org/MethodResponseXmlNamespace", - ReturnXmlElementName="HelloMessage", - SoapAction="http://example.org/ExampleSoapAction#GetHello", - XmlNamespace="http://example.org/MethodCallXmlNamespace")] - String^ GetHello( String^ name ) - { - return String::Format( L"Hello, {0}", name ); - } - // - }; - -} - -int main() -{ - - // Get the method info object for the GetHello method. - System::Reflection::MethodBase^ getHelloMethod = - ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); - - // Print the XML namespace for the invocation of this method. - String^ methodCallXmlNamespace = - System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall( - getHelloMethod ); - Console::WriteLine( L"The XML namespace for the response of the method " - L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace ); - - // Print the XML namespace for the response of this method. - String^ methodResponseXmlNamespace = - System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall( - getHelloMethod ); - Console::WriteLine( L"The XML namespace for the invocation of the method " - L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace ); - - // Print the SOAP action for this method. - String^ getHelloSoapAction = - System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall( - getHelloMethod ); - Console::WriteLine( L"The SOAP action for the method " - L"GetHello in ExampleClass is {0}.", getHelloSoapAction ); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp deleted file mode 100644 index 58dea746266..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri -/// 10 class -/// 21 #ctor() -/// 22 #ctor(string) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// -/// Bugs in SoapAnyUri: None found. -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapAnyUri object. - String^ xsdAnyUri = L"http://localhost:8080/WebService"; - SoapAnyUri^ anyUri = SoapAnyUri::Parse( xsdAnyUri ); - // - - // - // Print the value of the SoapAnyUri object in XSD format. - Console::WriteLine( L"The SoapAnyUri object in XSD format is {0}.", anyUri ); - // - - // - // Print the XSD type string of the SoapAnyUri object. - Console::WriteLine( L"The XSD type of the SoapAnyUri " - L"object is {0}.", anyUri->GetXsdType() ); - // - - // - // Print the value of the SoapAnyUri object. - Console::WriteLine( L"The value of the SoapAnyUri object is {0}.", anyUri->Value ); - - // - // - // Print the XSD type string of the SoapAnyUri class. - Console::WriteLine( L"The XSD type of the SoapAnyUri class " - L"is {0}.", SoapAnyUri::XsdType ); - // - - return 1; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp deleted file mode 100644 index c8ca68e2b1e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp +++ /dev/null @@ -1,34 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(string) -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapAnyUri object. - SoapAnyUri^ anyUri = gcnew SoapAnyUri; - anyUri->Value = L"http://localhost:8080/WebService"; - Console::WriteLine( L"The value of the SoapAnyUri object is {0}.", anyUri ); - // -} - -static void Ctor2() -{ - // - // Create a SoapAnyUri object. - String^ anyUriValue = L"http://localhost:8080/WebService"; - SoapAnyUri^ anyUri = gcnew SoapAnyUri( anyUriValue ); - Console::WriteLine( L"The value of the SoapAnyUri object is {0}.", anyUri ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp deleted file mode 100644 index e73224d01e0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary -/// 10 class -/// 21 #ctor() -/// 22 #ctor(byte[]) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapBase64Binary: -/// No bugs were detected. -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapBase64Binary object. - // The string "AgMFBws=" is byte[]{ 2, 3, 5, 7, 11 } expressed in - // Base 64 format. - String^ xsdBase64Binary = L"AgMFBws="; - SoapBase64Binary^ base64Binary = SoapBase64Binary::Parse( xsdBase64Binary ); - // - - // - // Print the value of the SoapBase64Binary object in XSD format. - Console::WriteLine( L"The SoapBase64Binary object in XSD format is {0}.", - base64Binary ); - // - - // - // Print the XSD type string of the SoapBase64Binary object. - Console::WriteLine( L"The XSD type of the SoapBase64Binary " - L"object is {0}.", base64Binary->GetXsdType() ); - // - - // - // Print the value of the SoapBase64Binary object. - Console::Write( L"base64Binary.Value contains:" ); - for ( int i = 0; i < base64Binary->Value->Length; ++i ) - { - Console::Write( L" {0}", base64Binary->Value[ i ] ); - - } - Console::WriteLine(); - // - - // - // Print the XSD type string of the SoapBase64Binary class. - Console::WriteLine( L"The XSD type of the class SoapBase64Binary " - L"is {0}.", SoapBase64Binary::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp deleted file mode 100644 index 296902a8a0e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapBase64Binary object. - SoapBase64Binary^ base64Binary = gcnew SoapBase64Binary; - base64Binary->Value = gcnew array(7){ - 2,3,5,7,11,0,5 - }; - Console::WriteLine( L"The SoapBase64Binary object is {0}.", - base64Binary ); - // -} - -static void Ctor2() -{ - // - // Create a SoapBase64Binary object. - array^bytes = gcnew array(5){ - 2,3,5,7,11 - }; - SoapBase64Binary^ base64Binary = gcnew SoapBase64Binary( bytes ); - Console::WriteLine( L"The SoapBase64Binary object is {0}.", - base64Binary ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp deleted file mode 100644 index 7f234a9eb5a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/// Need snippets: -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 23 #ctor(DateTime,int) -/// 13 GetXsdType -/// 11 Parse -/// 15 Sign -/// 12 ToString -/// 14 Value -/// 16 XsdType - -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD date to create a SoapDate object. - String^ xsdDate = "2003-02-04"; - SoapDate^ date = SoapDate::Parse( xsdDate ); - // - - // - // Serialize a DateTime object as an XSD date string. - Console::WriteLine( "The date in XSD format is {0}.", - date ); - // - - // - // Print out the XSD type string of this particular SoapDate object. - Console::WriteLine( "The XSD type of the SoapDate instance is {0}.", - date->GetXsdType() ); - // - - // - // Print out the value of the SoapDate object. - Console::WriteLine( "The value of the SoapDate instance is {0}.", - date->Value ); - // - - // - // Print out the sign of the SoapDate object. - Console::WriteLine( "The sign of the SoapDate instance is {0}.", - date->Sign ); - // - - // - // Print out the XSD type string of the SoapDate class. - Console::WriteLine( "The XSD type of SoapDate is {0}.", - SoapDate::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp deleted file mode 100644 index 668a507b945..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp +++ /dev/null @@ -1,42 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 23 #ctor(DateTime,int) - -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -void Ctor1() -{ - // - // Create a SoapDate object. - SoapDate^ date = gcnew SoapDate; - date->Value = DateTime::Now; - Console::WriteLine( "The date is {0}.", date ); - // -} - -void Ctor2() -{ - // - // Create a SoapDate object. - SoapDate^ date = gcnew SoapDate( DateTime::Now ); - Console::WriteLine( "The date is {0}.", date ); - // -} - -void Ctor3() -{ - // - // Create a SoapDate object with a positive sign. - SoapDate^ date = gcnew SoapDate( DateTime::Now,1 ); - Console::WriteLine( "The date is {0}.", date ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); - Ctor3(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp deleted file mode 100644 index 413b5d7bcba..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp +++ /dev/null @@ -1,34 +0,0 @@ - -/// Need snippets: -/// ! #ctor -/// x Parse -/// x ToString -/// x XsdType -/// -/// Bug report: -/// Constructor unusable since all methods are static. -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; -int main() -{ - - // - // Parse an XSD dateTime to create a DateTime object. - String^ xsdDateTime = "2003-02-04T13:58:59.9999999+03:00"; - DateTime dateTime = SoapDateTime::Parse( xsdDateTime ); - - // - // - // Serialize a DateTime object as an XSD dateTime string. - Console::WriteLine( "The date in XSD format is {0}.", SoapDateTime::ToString( dateTime ) ); - - // - // - // Print out the XSD type string of the SoapDateTime class. - Console::WriteLine( "The XSD type of SoapDateTime is {0}.", SoapDateTime::XsdType ); - - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp deleted file mode 100644 index 176bd8d588a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp +++ /dev/null @@ -1,61 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay -/// Need snippets: -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// -/// Bugs: -/// -/// 1. Documentation bug: according to the XML spec and the code -/// SoapDay.Parse(string) should accept the format "---ddzzz" and -/// "---dd"; the documentation states that SoapDay.Parse(string) -/// accepts "ddzzz" (which it does not). For gDay examples, see -/// http://books.xmlschemata.org/relaxng/ch17-77066.html. -/// 2. Documentation bug: zzz cannot be in this format "08:00". It -/// must equal "Z" or it must be in one of these formats: "+08:00" -/// or "-08:00". Without the leading "+" or "-" sign Parse(string) -/// fails. - -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD gDay to create a SoapDay object. - // The time zone of this object is +08:00. - String^ xsdDay = "---30+08:00"; - SoapDay^ day = SoapDay::Parse( xsdDay ); - // - - // - // Display the day in XSD format. - Console::WriteLine( "The day in XSD format is {0}.", - day ); - // - - // - // Display the XSD type string of this particular SoapDay object. - Console::WriteLine( "The XSD type of the SoapDay instance is {0}.", - day->GetXsdType() ); - // - - // - // Display the value of the SoapDay object. - Console::WriteLine( "The value of the SoapDay instance is {0}.", - day->Value ); - // - - // - // Display the XSD type string of the SoapDay class. - Console::WriteLine( "The XSD type of the class SoapDay is {0}.", - SoapDay::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp deleted file mode 100644 index e070d48be10..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) - -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -void Ctor1() -{ - // - // Create a SoapDay object. - SoapDay^ day = gcnew SoapDay; - day->Value = DateTime::Now; - Console::WriteLine( "The day is {0}.", day ); - // -} - -void Ctor2() -{ - // - // Create a SoapDay object. - SoapDay^ day = gcnew SoapDay( DateTime::Now ); - Console::WriteLine( "The day is {0}.", day ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp deleted file mode 100644 index cb673df07d3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration -/// 10 class -/// ! #ctor -/// 11 Parse() -/// 12 ToString() -/// 13 XsdType -/// -/// Bug report: -/// The constructor is unusable since all methods are static. -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD duration to create a TimeSpan object. - // This is a duration of 2 years, 3 months, 9 days, 12 hours, - // 35 minutes, 20 seconds, and 10 milliseconds. - String^ xsdDuration = L"P2Y3M9DT12H35M20.0100000S"; - TimeSpan timeSpan = SoapDuration::Parse( xsdDuration ); - Console::WriteLine( L"The time span contains {0} days.", - timeSpan.Days ); - Console::WriteLine( L"The time span contains {0} hours.", - timeSpan.Hours ); - Console::WriteLine( L"The time span contains {0} minutes.", - timeSpan.Minutes ); - Console::WriteLine( L"The time span contains {0} seconds.", - timeSpan.Seconds ); - // - - // - // Serialize a TimeSpan object as an XSD duration string. - // This object represents a time span of 399 days, 12 hours, - // 35 minutes, 20 seconds, and 10 milliseconds. - TimeSpan duration = TimeSpan(399,12,35,20,10); - Console::WriteLine( L"The duration in XSD format is {0}.", - SoapDuration::ToString( duration ) ); - // - - // - // Print the XSD type string of the SoapDuration class. - Console::WriteLine( L"The XSD type of SoapDuration is {0}.", - SoapDuration::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp deleted file mode 100644 index f07c6ddafe8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary -/// 10 class -/// 21 #ctor() -/// 22 #ctor(byte[]) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapHexBinary: -/// No bugs were detected. -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapHexBinary object. - String^ xsdHexBinary = L"3f789ABC"; - SoapHexBinary^ hexBinary = SoapHexBinary::Parse( xsdHexBinary ); - // - - // - // Print the value of the SoapHexBinary object in XSD format. - Console::WriteLine( L"The SoapHexBinary object in XSD format is {0}.", - hexBinary ); - // - - // - // Print the XSD type string of this particular SoapHexBinary object. - Console::WriteLine( L"The XSD type of the SoapHexBinary object is {0}.", - hexBinary->GetXsdType() ); - // - - // - // Print the value of the SoapHexBinary object. - Console::Write( L"hexBinary.Value contains:" ); - for ( int i = 0; i < hexBinary->Value->Length; ++i ) - { - Console::Write( L" {0}", hexBinary->Value[ i ] ); - - } - Console::WriteLine(); - // - - // - // Print the XSD type string of the SoapHexBinary class. - Console::WriteLine( L"The XSD type of the class SoapHexBinary is {0}.", - SoapHexBinary::XsdType ); - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp deleted file mode 100644 index dc7d28b8f1a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp +++ /dev/null @@ -1,38 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapHexBinary object. - SoapHexBinary^ hexBinary = gcnew SoapHexBinary; - hexBinary->Value = gcnew array(5){ - 2,3,5,7,11 - }; - Console::WriteLine( L"The SoapHexBinary object is {0}.", hexBinary ); - // -} - -static void Ctor2() -{ - // - // Create a SoapHexBinary object. - array^ bytes = gcnew array(5){ - 2,3,5,7,11 - }; - SoapHexBinary^ hexBinary = gcnew SoapHexBinary( bytes ); - Console::WriteLine( L"The SoapHexBinary object is {0}.", hexBinary ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp deleted file mode 100644 index fb6f8987512..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger -/// 10 class -/// 21 #ctor() -/// 22 #ctor(decimal) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapInteger: -/// No bugs were detected. -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapInteger object. - String^ xsdIntegerString = L"-13"; - SoapInteger^ xsdInteger = SoapInteger::Parse( xsdIntegerString ); - // - - // - // Print the value of the SoapInteger object in XSD format. - Console::WriteLine( L"The SoapInteger object in XSD format is {0}.", - xsdInteger ); - // - - // - // Print the XSD type string of the SoapInteger object. - Console::WriteLine( L"The XSD type of the SoapInteger " - L"object is {0}.", xsdInteger->GetXsdType() ); - // - - // - // Print the value of the SoapInteger object. - Console::WriteLine( L"The value of the SoapInteger object is {0}.", - xsdInteger->Value ); - // - - // - // Print the XSD type string of the SoapInteger class. - Console::WriteLine( L"The XSD type of the SoapInteger class is {0}.", - SoapInteger::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp deleted file mode 100644 index 1ce5d78cc1e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapInteger object. - SoapInteger^ xsdInteger = gcnew SoapInteger; - xsdInteger->Value = -14; - Console::WriteLine( L"The value of the SoapInteger object is {0}.", - xsdInteger ); - // -} - -static void Ctor2() -{ - // - // Create a SoapInteger object. - Decimal decimalValue = -14; - SoapInteger^ xsdInteger = gcnew SoapInteger( decimalValue ); - Console::WriteLine( L"The value of the SoapInteger object is {0}.", - xsdInteger ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp deleted file mode 100644 index 93620f32b0b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// -/// Bugs in SoapMonth: -/// -/// 1. SoapMonth.Parse interprets timezone inconsistently: The -/// following both reduce the month by 1. Either they should not -/// alter the month. Or the first one should reduce but the second -/// one should not: -/// SoapMonth.Parse("--02--+08:00").ToString() // Prints "--01--". -/// SoapMonth.Parse("--02---07:00").ToString() // Prints "--01--". -/// -/// 2. SoapMonth.Parse throws exception when the timezone is "Z": -/// SoapMonth.Parse throws the following exception, -/// System.FormatException: String was not recognized as a valid DateTime. -/// when invoked as follows, -/// SoapMonth.Parse("--02--Z"); // Throws exception. -/// It fails to correctly interpret Z as the current timezone. -/// -/// 3. SoapMonth.Parse documentation incorrect: The documentation -/// states that Parse can accept months formatted as "05", "01". -/// This is incorrect. The acceptable formats (according to the code -/// and according to the XML spec) are: "--MM--" and "--MM--zzz". - -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD gMonth to create a SoapMonth object. - // The timezone of this object is +08:00. - String^ xsdMonth = "--02--+08:00"; - SoapMonth^ month = SoapMonth::Parse( xsdMonth ); - // - - // - // Print the month in XSD format. - Console::WriteLine( "The month in XSD format is {0}.", - month ); - // - - // - // Print the XSD type string of this particular SoapMonth object. - Console::WriteLine( "The XSD type of the SoapMonth instance is {0}.", - month->GetXsdType() ); - // - - // - // Print the value of the SoapMonth object. - Console::WriteLine( "The value of the SoapMonth instance is {0}.", - month->Value ); - // - - // - // Print the XSD type string of the SoapMonth class. - Console::WriteLine( "The XSD type of the class SoapMonth is {0}.", - SoapMonth::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp deleted file mode 100644 index b8fcf45cfc3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) - -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -void Ctor1() -{ - // - // Create a SoapMonth object. - SoapMonth^ month = gcnew SoapMonth; - month->Value = DateTime::Now; - Console::WriteLine( "The month is {0}.", month ); - // -} - -void Ctor2() -{ - // - // Create a SoapMonth object. - SoapMonth^ month = gcnew SoapMonth( DateTime::Now ); - Console::WriteLine( "The month is {0}.", month ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp deleted file mode 100644 index cef26ec71c2..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapMonthDay: -/// 1. SoapMonthDay.Parse throws exception when the time zone is "Z": -/// SoapMonthDay.Parse throws the following exception, -/// System.FormatException: String was not recognized -/// as a valid DateTime. -/// when invoked as follows, -/// SoapMonthDay.Parse("--02--Z"); // Throws exception. -/// It fails to correctly interpret "Z" as the current time zone. -/// -/// 2. SoapMonthDay.Parse documentation incorrect: The documentation -/// does not state how to compose a SoapMonthDay for Parse. It also -/// incorrectly states that "08:00" is a valid time zone (this should -/// be "+08:00"). -// -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD gMonthDay to create a SoapMonthDay object. - // Parse the representation for February 21, in the UTC+8 time zone. - String^ xsdMonthDay = L"--02-21+08:00"; - SoapMonthDay^ monthDay = SoapMonthDay::Parse( xsdMonthDay ); - // - - // - // Print the monthDay in XSD format. - Console::WriteLine( L"The SoapMonthDay object in XSD format is {0}.", - monthDay ); - // - - // - // Print the XSD type string of this particular SoapMonthDay object. - Console::WriteLine( L"The XSD type of the SoapMonthDay object is {0}.", - monthDay->GetXsdType() ); - // - - // - // Print the value of the SoapMonthDay object. - Console::WriteLine( L"The value of the SoapMonthDay object is {0}.", - monthDay->Value ); - // - - // - // Print the XSD type string of the SoapMonthDay class. - Console::WriteLine( L"The XSD type of the class SoapMonthDay is {0}.", - SoapMonthDay::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp deleted file mode 100644 index f0109194443..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapMonthDay object. - SoapMonthDay^ monthDay = gcnew SoapMonthDay; - monthDay->Value = DateTime::Now; - Console::WriteLine( L"The SoapMonthDay object is {0}.", monthDay ); - // -} - -static void Ctor2() -{ - // - // Create a SoapMonthDay object. - SoapMonthDay^ monthDay = gcnew SoapMonthDay( DateTime::Now ); - Console::WriteLine( L"The SoapMonthDay object is {0}.", monthDay ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp deleted file mode 100644 index 3dd233fe9fd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger -/// 10 class -/// 21 #ctor() -/// 22 #ctor(Decimal) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapNegativeInteger: -/// No bugs were detected. -// -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapNegativeInteger - // object. - String^ xsdIntegerString = L"-13"; - SoapNegativeInteger^ xsdInteger = SoapNegativeInteger::Parse( - xsdIntegerString ); - // - - // - // Print the value of the SoapNegativeInteger object in XSD format. - Console::WriteLine( L"The SoapNegativeInteger object in XSD format is {0}.", - xsdInteger ); - // - - // - // Print the XSD type string of the SoapNegativeInteger object. - Console::WriteLine( L"The XSD type of the SoapNegativeInteger " - L"object is {0}.", xsdInteger->GetXsdType() ); - // - - // - // Print the value of the SoapNegativeInteger object. - Console::WriteLine( L"The value of the SoapNegativeInteger " - L"object is {0}.", xsdInteger->Value ); - // - - // - // Print the XSD type string of the SoapNegativeInteger class. - Console::WriteLine( L"The XSD type of the SoapNegativeInteger class " - L"is {0}.", SoapNegativeInteger::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp deleted file mode 100644 index bc37451f56c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; -static void Ctor1() -{ - // - // Create a SoapNegativeInteger object. - SoapNegativeInteger^ xsdInteger = gcnew SoapNegativeInteger; - xsdInteger->Value = -14; - Console::WriteLine( L"The value of the SoapNegativeInteger object is {0}.", - xsdInteger ); - // -} - -static void Ctor2() -{ - // - // Create a SoapNegativeInteger object. - Decimal decimalValue = -14; - SoapNegativeInteger^ xsdInteger = gcnew SoapNegativeInteger( - decimalValue ); - Console::WriteLine( L"The value of the SoapNegativeInteger object is {0}.", - xsdInteger ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp deleted file mode 100644 index bfe4587163d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger -/// 10 class -/// 21 #ctor() -/// 22 #ctor(Decimal) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapNonNegativeInteger: -/// No bugs were detected. -// -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapNonNegativeInteger - // object. - String^ xsdIntegerString = L"+13"; - SoapNonNegativeInteger^ xsdInteger = SoapNonNegativeInteger::Parse( - xsdIntegerString ); - // - - // - // Print the value of the SoapNonNegativeInteger object - // in XSD format. - Console::WriteLine( - L"The SoapNonNegativeInteger object in XSD format is {0}.", - xsdInteger ); - // - - // - // Print the XSD type string of the SoapNonNegativeInteger object. - Console::WriteLine( L"The XSD type of the SoapNonNegativeInteger " - L"object is {0}.", xsdInteger->GetXsdType() ); - // - - // - // Print the value of the SoapNonNegativeInteger object. - Console::WriteLine( L"The value of the SoapNonNegativeInteger " - L"object is {0}.", xsdInteger->Value ); - // - - // - // Print the XSD type string of the SoapNonNegativeInteger class. - Console::WriteLine( L"The XSD type of the SoapNonNegativeInteger class " - L"is {0}.", SoapNonNegativeInteger::XsdType ); - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp deleted file mode 100644 index 073b01560aa..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp +++ /dev/null @@ -1,33 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapNonNegativeInteger object. - SoapNonNegativeInteger^ xsdInteger = gcnew SoapNonNegativeInteger; - xsdInteger->Value = +14; - Console::WriteLine( L"The value of the SoapNonNegativeInteger object is {0}.", xsdInteger ); - // -} - -static void Ctor2() -{ - // - // Create a SoapNonNegativeInteger object. - Decimal decimalValue = +14; - SoapNonNegativeInteger^ xsdInteger = gcnew SoapNonNegativeInteger( decimalValue ); - Console::WriteLine( L"The value of the SoapNonNegativeInteger object is {0}.", xsdInteger ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp deleted file mode 100644 index 2c51262dcca..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger -/// 10 class -/// 21 #ctor() -/// 22 #ctor(Decimal) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapNonPositiveInteger: -/// No bugs were detected. -// -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapNonPositiveInteger - // object. - String^ xsdIntegerString = L"-13"; - SoapNonPositiveInteger^ xsdInteger = - SoapNonPositiveInteger::Parse( xsdIntegerString ); - // - - // - // Print the value of the SoapNonPositiveInteger object - // in XSD format. - Console::WriteLine( L"The SoapNonPositiveInteger object in XSD format is {0}.", - xsdInteger ); - // - - // - // Print the XSD type string of the SoapNonPositiveInteger object. - Console::WriteLine( L"The XSD type of the SoapNonPositiveInteger object is {0}.", - xsdInteger->GetXsdType() ); - // - - // - // Print the value of the SoapNonPositiveInteger object. - Console::WriteLine( L"The value of the SoapNonPositiveInteger object is {0}.", - xsdInteger->Value ); - // - - // - // Print the XSD type string of the SoapNonPositiveInteger class. - Console::WriteLine( L"The XSD type of the SoapNonPositiveInteger class is {0}.", - SoapNonPositiveInteger::XsdType ); - // -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp deleted file mode 100644 index 1ab5dc805a1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapNonPositiveInteger object. - SoapNonPositiveInteger^ xsdInteger = gcnew SoapNonPositiveInteger; - xsdInteger->Value = -14; - Console::WriteLine( L"The value of the SoapNonPositiveInteger object is {0}.", - xsdInteger ); - // -} - -static void Ctor2() -{ - // - // Create a SoapNonPositiveInteger object. - Decimal decimalValue = -14; - SoapNonPositiveInteger^ xsdInteger = gcnew SoapNonPositiveInteger( - decimalValue ); - Console::WriteLine( L"The value of the SoapNonPositiveInteger object is {0}.", - xsdInteger ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp deleted file mode 100644 index 8b481e05ce0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString -/// 10 class -/// 21 #ctor() -/// 22 #ctor(string) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -// -/// Bugs in SoapNormalizedString: None found. -/// -// -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void TestParse( String^ testString ) -{ - try - { - // - // Parse the test string. - SoapNormalizedString^ normalized = SoapNormalizedString::Parse( - testString ); - // - - // Report that the parse succeeded if no exception was thrown. - Console::WriteLine( L"Parse succeeded on the string \"{0}\".", - testString ); - - // - // Print the string representation of the object. - Console::WriteLine( L"The normalized value of this string is \"{0}\".", - normalized ); - // - - // - // Print the XSD type of the object. - Console::WriteLine( L"The XSD type of the SoapNormalizedString object is {0}.", - normalized->GetXsdType() ); - // - - // - // Print the value of the SoapNormalizedString object. - Console::WriteLine( L"The value of the SoapNormalizedString object is \"{0}\".", - normalized->Value ); - // - } - catch ( System::Runtime::Remoting::RemotingException^ e ) - { - // Report the details of the exception that was thrown. - Console::WriteLine( L"Parse failed on the string \"{0}\".", - testString ); - Console::WriteLine( e->Message ); - } -} - -int main() -{ - // Create strings to test the Parse method. - String^ stringWithSpaces = L"one two"; - String^ stringWithSpacesAndTabs = L"one two\t"; - String^ stringWithSpacesAndLineFeed = L"one two\n"; - String^ stringWithSpacesAndCarriageReturn = L"one two\r"; - - // Test the Parse method with each string. - TestParse( stringWithSpaces ); - TestParse( stringWithSpacesAndTabs ); - TestParse( stringWithSpacesAndLineFeed ); - TestParse( stringWithSpacesAndCarriageReturn ); - - // - // Print the XSD type string of the SoapNormalizedString class. - Console::WriteLine( L"The XSD type of the SoapNormalizedString class is {0}.", - SoapNormalizedString::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp deleted file mode 100644 index 1641c8861fe..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(string) -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapNormalizedString object. - SoapNormalizedString^ normalized = gcnew SoapNormalizedString; - normalized->Value = L"one two"; - Console::WriteLine( L"The value of the SoapNormalizedString object is {0}.", - normalized ); - // -} - -static void Ctor2() -{ - // - // Create a SoapNormalizedString object. - String^ testString = L"one two"; - SoapNormalizedString^ normalized = gcnew SoapNormalizedString( - testString ); - Console::WriteLine( L"The value of the SoapNormalizedString object is {0}.", - normalized ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp deleted file mode 100644 index 38f2440c827..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp +++ /dev/null @@ -1,51 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger -/// 10 class -/// 21 #ctor() -/// 22 #ctor(Decimal) -/// 13 GetXsdType() -/// 11 Parse() -/// 12 ToString() -/// 14 Value -/// 16 XsdType -/// Bugs in SoapPositiveInteger: -/// No bugs were detected. -// -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapPositiveInteger - // object. - String^ xsdIntegerString = L"+13"; - SoapPositiveInteger^ xsdInteger = - SoapPositiveInteger::Parse( xsdIntegerString ); - // - - // - // Print the value of the SoapPositiveInteger object in XSD format. - Console::WriteLine( L"The SoapPositiveInteger object in XSD format is {0}.", - xsdInteger ); - // - - // - // Print the XSD type string of the SoapPositiveInteger object. - Console::WriteLine( L"The XSD type of the SoapPositiveInteger " - L"object is {0}.", xsdInteger->GetXsdType() ); - // - - // - // Print the value of the SoapPositiveInteger object. - Console::WriteLine( L"The value of the SoapPositiveInteger object is {0}.", - xsdInteger->Value ); - // - - // - // Print the XSD type string of the SoapPositiveInteger class. - Console::WriteLine( L"The XSD type of the SoapPositiveInteger class " - L"is {0}.", SoapPositiveInteger::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp deleted file mode 100644 index 1992569528a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapPositiveInteger object. - SoapPositiveInteger^ xsdInteger = gcnew SoapPositiveInteger; - xsdInteger->Value = 14; - Console::WriteLine( L"The value of the SoapPositiveInteger object is {0}.", - xsdInteger ); - // -} - -static void Ctor2() -{ - // - // Create a SoapPositiveInteger object. - Decimal decimalValue = 14; - SoapPositiveInteger^ xsdInteger = gcnew SoapPositiveInteger( decimalValue ); - Console::WriteLine( L"The value of the SoapPositiveInteger object is {0}.", - xsdInteger ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp deleted file mode 100644 index 4e39d11bf3f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName -/// 10 class -/// 21 #ctor() -/// 22 #ctor(string) -/// 23 #ctor(string,string) -/// 24 #ctor(string,string,string) -/// 13 GetXsdType() -/// 17 Key -/// 18 Name -/// 19 Namespace -/// 11 Parse() -/// 12 ToString() -/// 16 XsdType -/// -/// Bugs in SoapQName: -/// 1. SoapQName.Namespace is not used anywhere. The field exists but has -/// no clear purpose. It cannot be parsed. -/// 2. SoapQName.Name cannot contain a ':', however, this is not validated -/// in the code anywhere. SoapQName.Parse("a:b:c").Name results in "b:c", -/// which is an invalid name. -// -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD formatted string to create a SoapQName object. - String^ xsdQName = L"tns:SomeName"; - SoapQName^ qName = SoapQName::Parse( xsdQName ); - // - - // - // Print the value of the SoapQName object in XSD format. - Console::WriteLine( L"The SoapQName object in XSD format is {0}.", qName ); - // - - // - // Print the XSD type string of the SoapQName object. - Console::WriteLine( L"The XSD type of the SoapQName " - L"object is {0}.", qName->GetXsdType() ); - // - - // - // Print the XSD type string of the SoapQName class. - Console::WriteLine( L"The XSD type of the SoapQName class " - L"is {0}.", SoapQName::XsdType ); - // - - // Create a QName object. - SoapQName^ soapQNameInstance = gcnew SoapQName( - L"tns",L"SomeName",L"http://example.org" ); - - // - // Print the key the SoapQName object. - Console::WriteLine( L"The key of the SoapQName object is {0}.", - soapQNameInstance->Key ); - // - - // - // Print the name of the SoapQName object. - Console::WriteLine( L"The name of the SoapQName " - L"object is {0}.", soapQNameInstance->Name ); - // - - // - // Print the namespace of the SoapQName class. - Console::WriteLine( L"The namespace for this instance of SoapQName is {0}.", - soapQNameInstance->Namespace ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp deleted file mode 100644 index 7c2359708b8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(string) -/// 23 #ctor(string,string) -/// 24 #ctor(string,string,string) -#using -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -static void Ctor1() -{ - // - // Create a SoapQName object. - SoapQName^ qName = gcnew SoapQName; - Console::WriteLine( - L"The value of the SoapQName object is \"{0}\".", qName ); - // -} - -static void Ctor2() -{ - // - // Create a SoapQName object. - String^ name = L"SomeName"; - SoapQName^ qName = gcnew SoapQName( name ); - Console::WriteLine( - L"The value of the SoapQName object is \"{0}\".", qName ); - // -} - -static void Ctor3() -{ - // - // Create a SoapQName object. - String^ key = L"tns"; - String^ name = L"SomeName"; - SoapQName^ qName = gcnew SoapQName( key,name ); - Console::WriteLine( - L"The value of the SoapQName object is \"{0}\".", qName ); - // -} - -static void Ctor4() -{ - // - // Create a SoapQName object. - String^ key = L"tns"; - String^ name = L"SomeName"; - String^ namespaceValue = L"http://example.org"; - SoapQName^ qName = gcnew SoapQName( - key,name,namespaceValue ); - Console::WriteLine( - L"The value of the SoapQName object is \"{0}\".", qName ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); - Ctor3(); - Ctor4(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp deleted file mode 100644 index 1192e22eec0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime -/// Need snippets: -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 13 GetXsdType -/// 11 Parse -/// 12 ToString -/// 14 Value -/// 16 XsdType -/// -/// Bugs: -/// -/// Parse should take upto 9 digits in fractional seconds, but only -/// accepts up to 7. Also it only parses the first three, and ignores -/// the others (fractional second digits). - -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD gTime to create a SoapTime object. - // The timezone of this object is the current timezone. - String^ xsdTime = "12:13:14.123Z"; - SoapTime^ time = SoapTime::Parse( xsdTime ); - // - - // - // Display the time in XSD format. - Console::WriteLine( "The time in XSD format is {0}.", - time ); - // - - // - // Display the XSD type string of this particular SoapTime object. - Console::WriteLine( "The XSD type of the SoapTime instance is {0}.", - time->GetXsdType() ); - // - - // - // Display the value of the SoapTime object. - Console::WriteLine( "The value of the SoapTime instance is {0}.", - time->Value ); - // - - // - // Display the XSD type string of the SoapTime class. - Console::WriteLine( "The XSD type of the class SoapTime is {0}.", - SoapTime::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp deleted file mode 100644 index 315eb68d565..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) - -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -void Ctor1() -{ - // - // Create a SoapTime object. - SoapTime^ time = gcnew SoapTime; - time->Value = DateTime::Now; - Console::WriteLine( "The time is {0}.", time ); - // -} - -void Ctor2() -{ - // - // Create a SoapTime object. - SoapTime^ time = gcnew SoapTime( DateTime::Now ); - Console::WriteLine( "The time is {0}.", time ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp deleted file mode 100644 index 0c90607a486..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/// Need snippets: -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 23 #ctor(DateTime,int) -/// 13 GetXsdType -/// 11 Parse -/// 15 Sign -/// 12 ToString -/// 14 Value -/// 16 XsdType - -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD date to create a SoapYear object. - String^ xsdDate = "2003"; - SoapYear^ date = SoapYear::Parse( xsdDate ); - // - - // - // Serialize a DateTime object as an XSD date string. - Console::WriteLine( "The date in XSD format is {0}.", - date ); - // - - // - // Print out the XSD type string of this particular SoapYear object. - Console::WriteLine( "The XSD type of the SoapYear instance is {0}.", - date->GetXsdType() ); - // - - // - // Print out the value of the SoapYear object. - Console::WriteLine( "The value of the SoapYear instance is {0}.", - date->Value ); - // - - // - // Print out the sign of the SoapYear object. - Console::WriteLine( "The sign of the SoapYear instance is {0}.", - date->Sign ); - // - - // - // Print out the XSD type string of the SoapYear class. - Console::WriteLine( "The XSD type of SoapYear is {0}.", - SoapYear::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp deleted file mode 100644 index aa3c6d2fbc1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 23 #ctor(DateTime,int) - -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; -void Ctor1() -{ - // - // Create a SoapYear object. - SoapYear^ date = gcnew SoapYear; - date->Value = DateTime::Now; - Console::WriteLine( "The date is {0}.", date ); - // -} - -void Ctor2() -{ - // - // Create a SoapYear object. - SoapYear^ date = gcnew SoapYear( DateTime::Now ); - Console::WriteLine( "The date is {0}.", date ); - // -} - -void Ctor3() -{ - // - // Create a SoapYear object with a positive sign. - SoapYear^ date = gcnew SoapYear( DateTime::Now,1 ); - Console::WriteLine( "The date is {0}.", date ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); - Ctor3(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp deleted file mode 100644 index 0479bd8049d..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp +++ /dev/null @@ -1,57 +0,0 @@ -/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth -/// Need snippets: -/// 10 class -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 23 #ctor(DateTime,int) -/// 13 GetXsdType -/// 11 Parse -/// 15 Sign -/// 12 ToString -/// 14 Value -/// 16 XsdType - -// -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; - -int main() -{ - // - // Parse an XSD gYearMonth to create a SoapYearMonth object. - // The timezone of this object is -08:00. - String^ xsdYearMonth = "2003-11-08:00"; - SoapYearMonth^ yearMonth = SoapYearMonth::Parse( xsdYearMonth ); - // - - // - // Display the yearMonth in XSD format. - Console::WriteLine( "The yearMonth in XSD format is {0}.", - yearMonth ); - // - - // - // Display the XSD type string of this particular SoapYearMonth object. - Console::WriteLine( "The XSD type of the SoapYearMonth instance is {0}.", - yearMonth->GetXsdType() ); - // - - // - // Display the value of the SoapYearMonth object. - Console::WriteLine( "The value of the SoapYearMonth instance is {0}.", - yearMonth->Value ); - // - - // - // Display the sign of the SoapYearMonth object. - Console::WriteLine( "The sign of the SoapYearMonth instance is {0}.", - yearMonth->Sign ); - // - - // - // Display the XSD type string of the SoapYearMonth class. - Console::WriteLine( "The XSD type of the class SoapYearMonth is {0}.", - SoapYearMonth::XsdType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp deleted file mode 100644 index 208e3500ca9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp +++ /dev/null @@ -1,41 +0,0 @@ -/// Need snippets: -/// 21 #ctor() -/// 22 #ctor(DateTime) -/// 23 #ctor(DateTime,int) - -using namespace System; -using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; -void Ctor1() -{ - // - // Create a SoapYearMonth object. - SoapYearMonth^ year = gcnew SoapYearMonth; - year->Value = DateTime::Now; - Console::WriteLine( "The year is {0}.", year ); - // -} - -void Ctor2() -{ - // - // Create a SoapYearMonth object. - SoapYearMonth^ year = gcnew SoapYearMonth( DateTime::Now ); - Console::WriteLine( "The year is {0}.", year ); - // -} - -void Ctor3() -{ - // - // Create a SoapYearMonth object with a positive sign. - SoapYearMonth^ year = gcnew SoapYearMonth( DateTime::Now,1 ); - Console::WriteLine( "The year is {0}.", year ); - // -} - -int main() -{ - Ctor1(); - Ctor2(); - Ctor3(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp deleted file mode 100644 index 8df0b7dcb47..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp +++ /dev/null @@ -1,232 +0,0 @@ - - -// C:\Program Files\Microsoft::NET\FrameworkSDK\Samples\technologies\remoting\advanced\customproxies -// -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Messaging; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Reflection; -// - -// -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Runtime::Remoting::Lifetime; -using namespace System::Runtime::Remoting::Proxies; -// - -// -using namespace System::Runtime::Remoting::Channels::Http; -using namespace System::Net; -using namespace System::IO; -using namespace System::Security::Permissions; -// - -// -public ref class HelloServer: public MarshalByRefObject -{ -public: - HelloServer() - { - Console::WriteLine( "HelloServer activated." ); - } - - [OneWay] - void SayHelloToServer( String^ name ) - { - Console::WriteLine( "Client invoked SayHelloToServer(\" {0}\").", name ); - } - - // - // IsOneWay: Note the lack of the OneWayAttribute adornment on this method. - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - String^ SayHelloToServerAndWait( String^ name ) - { - Console::WriteLine( "Client invoked SayHelloToServerAndWait(\" {0}\").", name ); - Console::WriteLine( "Client waiting for return? {0}", RemotingServices::IsOneWay( MethodBase::GetCurrentMethod() ) ? (String^)"No" : "Yes" ); - return String::Format( "Hi there, {0}.", name ); - } - // -}; -// - -// -// An instance of ClientApp will call an instance of this class remotely. -public ref class TcpServerApp -{ -public: - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - TcpServerApp() - { - // Register a class over TCP at tcp://localhost:8085/HttpHelloServer. - const String^ myObjectUri = "TcpHelloServer"; - const int myPort = 8085; - TcpChannel^ myTcpChannel = gcnew TcpChannel( myPort ); - ChannelServices::RegisterChannel( myTcpChannel ); - RemotingConfiguration::RegisterWellKnownServiceType( HelloServer::typeid, const_cast(myObjectUri), WellKnownObjectMode::Singleton ); - // - - // - Console::WriteLine( "Server type: {0}", RemotingServices::GetServerTypeForUri( const_cast(myObjectUri) ) ); - // - - // - Console::WriteLine( "Press Enter to stop the demo." ); - Console::ReadLine(); - } - -}; -// - -// -public ref class HttpServerApp -{ -public: - [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] - HttpServerApp() - { - // Marshal an Object* over HTTP at http://localhost:8090/HttpHelloServer. - const String^ myObjectUri = "HttpHelloServer"; - const int myPort = 8090; - HttpChannel^ myHttpChannel = gcnew HttpChannel( myPort ); - ChannelServices::RegisterChannel( myHttpChannel ); - MarshalByRefObject^ myMbro = dynamic_cast(Activator::CreateInstance( HelloServer::typeid )); - RemotingServices::SetObjectUriForMarshal( myMbro, const_cast(myObjectUri) ); - ObjRef^ myObjRef = RemotingServices::Marshal( myMbro ); - Console::WriteLine( "Press Enter to stop the demo." ); - Console::ReadLine(); - HelloServer^ umObj = dynamic_cast(RemotingServices::Unmarshal( myObjRef )); - RemotingServices::Disconnect( myMbro ); - } -}; -// - -// -// An instance of this class will call an instance of ServerApp remotely. -[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] -public ref class TcpClientApp -{ -public: - TcpClientApp() - { - const String^ myHelloServerUrl = "tcp://localhost:8085/TcpHelloServer"; - HelloServer^ obj = static_cast(RemotingServices::Connect( HelloServer::typeid, const_cast(myHelloServerUrl) )); - // - - // - //GetRealProxy, GetObjectUri, GetEnvoyChainForProxy - RealProxy^ proxy = RemotingServices::GetRealProxy( obj ); - Console::WriteLine( "Real proxy type: {0}", proxy->GetProxiedType() ); - Console::WriteLine( "Object URI: {0}", RemotingServices::GetObjectUri( obj ) ); - IMessageSink^ msgSink = RemotingServices::GetEnvoyChainForProxy( obj )->NextSink; - // - - // - //IsTransparentProxy, IsObjectOutOfAppDomain, IsObjectOutOfContext - Console::WriteLine( "Proxy transparent? {0}", RemotingServices::IsTransparentProxy( obj ) ? (String^)"Yes" : "No" ); - Console::WriteLine( "Object outside app domain? {0}", RemotingServices::IsObjectOutOfAppDomain( obj ) ? (String^)"Yes" : "No" ); - Console::WriteLine( "Object [Out] of* context? {0}", RemotingServices::IsObjectOutOfContext( obj ) ? (String^)"Yes" : "No" ); - // - - // - //GetLifetimeService - ILease^ lease = dynamic_cast(RemotingServices::GetLifetimeService( obj )); - Console::WriteLine( "Object lease time remaining: {0}.", lease->CurrentLeaseTime ); - // - - // - String^ twoWayMethodArg = "John"; - Console::WriteLine( "Invoking SayHelloToServerAndWait(\" {0}\").", twoWayMethodArg ); - Console::WriteLine( "Server returned: {0}", obj->SayHelloToServerAndWait( twoWayMethodArg ) ); - // - - // - String^ oneWayMethodArg = "Mary"; - Console::WriteLine( "Invoking SayHelloToServer(\" {0}\").", oneWayMethodArg ); - obj->SayHelloToServer( oneWayMethodArg ); - // - - // - } - // - - // -}; -// - -// -public ref class HttpClientApp -{ -public: - HttpClientApp() - { - const String^ myHelloServerUrl = "http://localhost:8090/HttpHelloServer"; - - // Output the WSDL for the marshalled Object*. - WebClient^ myWebClient = gcnew WebClient; - Stream^ myStream = myWebClient->OpenRead( String::Format( "{0}?wsdl", const_cast(myHelloServerUrl) ) ); - int b = myStream->ReadByte(); - while ( b != -1 ) - { - char p[2] = {(char)b}; - Console::Write( p ); - b = myStream->ReadByte(); - } - } - -}; -// - -// -int main() -{ - array^args = Environment::GetCommandLineArgs(); - // - - bool isServer = false; - if ( args->Length > 1 ) - if ( args[ 1 ]->ToLower()->Equals( "s" ) ) - isServer = true; - - if ( !isServer ) - { - Console::WriteLine( "Run this program in another window, \npassing the letter 's' as an argument.\nPress Enter here when the server has been activated." ); - Console::ReadLine(); - Console::WriteLine( "Running TCP client." ); - } - - // - if ( isServer ) - { - gcnew TcpServerApp; - } - else - { - gcnew TcpClientApp; - } - // - - if ( !isServer ) - { - Console::WriteLine( "\nPress Enter in the other window to continue to the next demo.\nThen press Enter here." ); - Console::ReadLine(); - } - - // - if ( isServer ) - { - gcnew HttpServerApp; - } - else - { - gcnew HttpClientApp; - } - // - - // - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp deleted file mode 100644 index dcfbf9f217f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp +++ /dev/null @@ -1,371 +0,0 @@ -/// Class: System.Runtime.Remoting.SoapServices -/// 100 class -/// 101 CodeXmlNamespaceForClrTypeNamespace() -/// 102 DecodeXmlNamespaceForClrTypeNamespace() -/// 150 GetInteropFieldTypeAndNameFromXmlAttribute() -/// 150 GetInteropFieldTypeAndNameFromXmlElement() -/// 160 GetInteropTypeFromXmlElement() -/// 160 GetInteropTypeFromXmlType() -/// 140 GetSoapActionFromMethodBase() -/// 140 GetTypeAndMethodNameFromSoapAction() -/// 103 GetXmlElementForInteropType() -/// 105 GetXmlNamespaceForMethodCall() -/// 105 GetXmlNamespaceForMethodResponse() -/// 104 GetXmlTypeForInteropType() -/// 106 IsClrTypeNamespace() -/// 140 IsSoapActionValidForMethodBase() -/// 120 PreLoad(Assembly) -/// 121 PreLoad(Type) -/// 180 RegisterInteropXmlElement() -/// 190 RegisterInteropXmlType() -/// 170 RegisterSoapActionForMethodBase(MethodBase) -/// 170 RegisterSoapActionForMethodBase(MethodBase,String) -/// 130 XmlNsForClrType -/// 131 XmlNsForClrTypeWithAssembly -/// 132 XmlNsForClrTypeWithNs -/// 133 XmlNsForClrTypeWithNsAndAssembly -// -#using -using namespace System; -using namespace System::Runtime::Remoting; - -namespace ExampleNamespace -{ - [System::Runtime::Remoting::Metadata::SoapTypeAttribute( - XmlElementName="ExampleClassElementName", - XmlNamespace="http://example.org/ExampleXmlNamespace", - XmlTypeName="ExampleXmlTypeName", - XmlTypeNamespace="http://example.org/ExampleXmlTypeNamespace")] - public ref class ExampleClass - { - public: - - // A field that will be serialized as an XML element. - [System::Runtime::Remoting::Metadata::SoapField( - XmlElementName="ExampleFieldElementName", - XmlNamespace="http://example.org/ExampleFieldNamespace")] - String^ ExampleFieldUsingElement; - - // A field that will be serialized as an XML attribute. - [System::Runtime::Remoting::Metadata::SoapField( - XmlElementName="ExampleFieldAttributeName", - XmlNamespace="http://example.org/ExampleAttributeNamespace", - UseAttribute=true)] - String^ ExampleFieldUsingAttribute; - - [System::Runtime::Remoting::Metadata::SoapMethod( - SoapAction="http://example.org/ExampleSoapAction#GetHello")] - String^ GetHello( String^ name ) - { - return String::Format( L"Hello, {0}", name ); - } - - }; - -} - -[System::Security::Permissions::SecurityPermissionAttribute( -System::Security::Permissions::SecurityAction::LinkDemand, -Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] -int main() -{ - // - // Convert a CLR namespace and assembly name into an XML namespace. - String^ xmlNamespace = SoapServices::CodeXmlNamespaceForClrTypeNamespace( - L"ExampleNamespace", L"AssemblyName" ); - Console::WriteLine( L"The name of the XML namespace is {0}.", xmlNamespace ); - // - - // - // Extract a CLR namespace and assembly name from an XML namespace. - String^ typeNamespace; - String^ assemblyName; - SoapServices::DecodeXmlNamespaceForClrTypeNamespace( - xmlNamespace,typeNamespace,assemblyName ); - Console::WriteLine( L"The name of the CLR namespace is {0}.", typeNamespace ); - Console::WriteLine( L"The name of the CLR assembly is {0}.", assemblyName ); - // - - // - // Get the XML element name and the XML namespace for - // an Interop type. - String^ xmlElement; - bool isSoapTypeAttribute = SoapServices::GetXmlElementForInteropType( - ExampleNamespace::ExampleClass::typeid,xmlElement,xmlNamespace ); - - // Print whether the requested value was flagged - // with a SoapTypeAttribute. - if ( isSoapTypeAttribute ) - { - Console::WriteLine( L"The requested value was flagged " - L"with the SoapTypeAttribute." ); - } - else - { - Console::WriteLine( L"The requested value was not flagged " - L"with the SoapTypeAttribute." ); - } - - // Print the XML element and the XML namespace. - Console::WriteLine( L"The XML element for the type " - L"ExampleNamespace.ExampleClass is {0}.", xmlElement ); - Console::WriteLine( L"The XML namespace for the type " - L"ExampleNamespace.ExampleClass is {0}.", xmlNamespace ); - // - - // - // Get the XML type name and the XML type namespace for - // an Interop type. - String^ xmlTypeName; - String^ xmlTypeNamespace; - isSoapTypeAttribute = SoapServices::GetXmlTypeForInteropType( ExampleNamespace::ExampleClass::typeid,xmlTypeName,xmlTypeNamespace ); - - // Print whether the requested value was flagged - // with a SoapTypeAttribute. - if ( isSoapTypeAttribute ) - { - Console::WriteLine( L"The requested value was flagged " - L"with the SoapTypeAttribute." ); - } - else - { - Console::WriteLine( L"The requested value was not flagged " - L"with the SoapTypeAttribute." ); - } - - // Print the XML type name and the XML type namespace. - Console::WriteLine( L"The XML type for the type " - L"ExampleNamespace.ExampleClass is {0}.", xmlTypeName ); - Console::WriteLine( L"The XML type namespace for the type " - L"ExampleNamespace.ExampleClass is {0}.", xmlTypeNamespace ); - // - - // - // Print the XML namespace for a method invocation and its - // response. - System::Reflection::MethodBase^ getHelloMethod = - ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); - String^ methodCallXmlNamespace = - SoapServices::GetXmlNamespaceForMethodCall( getHelloMethod ); - String^ methodResponseXmlNamespace = - SoapServices::GetXmlNamespaceForMethodResponse( getHelloMethod ); - Console::WriteLine( L"The XML namespace for the invocation of the method " - L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace ); - Console::WriteLine( L"The XML namespace for the response of the method " - L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace ); - // - - // - // Determine whether an XML namespace represents a CLR namespace. - String^ clrNamespace = SoapServices::XmlNsForClrType; - if ( SoapServices::IsClrTypeNamespace( clrNamespace ) ) - { - Console::WriteLine( L"The namespace {0} is a CLR namespace.", - clrNamespace ); - } - else - { - Console::WriteLine( L"The namespace {0} is not a CLR namespace.", - clrNamespace ); - } - // - - // - // Print the XML namespace for the CLR types. - Console::WriteLine( L"The XML namespace for the CLR types " - L"is {0}.", SoapServices::XmlNsForClrType ); - // - - // - // Print the XML namespace for the CLR types - // that have an assembly but no common language runtime namespace. - Console::WriteLine( L"The XML namespace for the CLR types " - L"that have an assembly but no namespace, is {0}.", - SoapServices::XmlNsForClrTypeWithAssembly ); - // - - // - // Print the XML namespace for the CLR types - // that are a part of the Mscorlib.dll. - Console::WriteLine( L"The XML namespace for the CLR types " - L"that are part of the Mscorlib.dll, is {0}.", - SoapServices::XmlNsForClrTypeWithNs ); - // - - // - // Print the XML namespace for the CLR types - // that have both an assembly and a common language runtime - // namespace. - Console::WriteLine( L"The XML namespace for the CLR types " - L"that have both an assembly and a namespace, is {0}.", - SoapServices::XmlNsForClrTypeWithNsAndAssembly ); - // - - // - // Get the SOAP action for the method. - System::Reflection::MethodBase^ getHelloMethodBase = - ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); - String^ getHelloSoapAction = - SoapServices::GetSoapActionFromMethodBase( getHelloMethodBase ); - Console::WriteLine( L"The SOAP action for the method " - L"ExampleClass.GetHello is {0}.", getHelloSoapAction ); - bool isSoapActionValid = - SoapServices::IsSoapActionValidForMethodBase( - getHelloSoapAction, getHelloMethodBase ); - if ( isSoapActionValid ) - { - Console::WriteLine( L"The SOAP action, {0}, " - L"is valid for ExampleClass.GetHello", getHelloSoapAction ); - } - else - { - Console::WriteLine( L"The SOAP action, {0}, " - L"is not valid for ExampleClass.GetHello", getHelloSoapAction ); - } - - // Register the SOAP action for the GetHello method. - SoapServices::RegisterSoapActionForMethodBase( getHelloMethodBase ); - - // Get the type and the method names encoded into the SOAP action. - String^ encodedTypeName; - String^ encodedMethodName; - SoapServices::GetTypeAndMethodNameFromSoapAction( - getHelloSoapAction,encodedTypeName,encodedMethodName ); - Console::WriteLine( L"The type name encoded in this SOAP action is {0}.", - encodedTypeName ); - Console::WriteLine( L"The method name encoded in this SOAP action is {0}.", - encodedMethodName ); - // - - // - // Get the name and the type of the field using its XML - // element name and its XML namespace. For this query to work, - // the containing type must be preloaded, and the XML element - // name and the XML namespace must be explicitly declared on - // the field using a SoapFieldAttribute. - // Preload the containing type. - SoapServices::PreLoad( ExampleNamespace::ExampleClass::typeid ); - - // Get the name and the type of a field that will be - // serialized as an XML element. - Type^ containingType = ExampleNamespace::ExampleClass::typeid; - String^ xmlElementNamespace = L"http://example.org/ExampleFieldNamespace"; - String^ xmlElementName = L"ExampleFieldElementName"; - Type^ fieldType; - String^ fieldName; - SoapServices::GetInteropFieldTypeAndNameFromXmlElement( - containingType,xmlElementName,xmlElementNamespace,fieldType,fieldName ); - Console::WriteLine( L"The type of the field is {0}.", fieldType ); - Console::WriteLine( L"The name of the field is {0}.", fieldName ); - - // Get the name and the type of a field that will be - // serialized as an XML attribute. - String^ xmlAttributeNamespace = - L"http://example.org/ExampleAttributeNamespace"; - String^ xmlAttributeName = L"ExampleFieldAttributeName"; - SoapServices::GetInteropFieldTypeAndNameFromXmlAttribute( - containingType,xmlAttributeName,xmlAttributeNamespace,fieldType,fieldName ); - Console::WriteLine( L"The type of the field is {0}.", fieldType ); - Console::WriteLine( L"The name of the field is {0}.", fieldName ); - // - - // - String^ interopTypeXmlElementName = L"ExampleClassElementName"; - String^ interopTypeXmlNamespace = L"http://example.org/ExampleXmlNamespace"; - Type^ interopType = SoapServices::GetInteropTypeFromXmlElement( - interopTypeXmlElementName, interopTypeXmlNamespace ); - Console::WriteLine( L"The interop type is {0}.", interopType ); - String^ interopTypeXmlTypeName = L"ExampleXmlTypeName"; - String^ interopTypeXmlTypeNamespace = - L"http://example.org/ExampleXmlTypeNamespace"; - interopType = SoapServices::GetInteropTypeFromXmlType( - interopTypeXmlTypeName,interopTypeXmlTypeNamespace ); - Console::WriteLine( L"The interop type is {0}.", interopType ); - // - - // - // Get the method base object for the GetHello method. - System::Reflection::MethodBase^ methodBase = - ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); - - // Print its current SOAP action. - Console::WriteLine( L"The SOAP action for the method " - L"ExampleClass.GetHello is {0}.", - SoapServices::GetSoapActionFromMethodBase( methodBase ) ); - - // Set the SOAP action of the GetHello method to a new value. - String^ newSoapAction = L"http://example.org/ExampleSoapAction#NewSoapAction"; - SoapServices::RegisterSoapActionForMethodBase( methodBase, newSoapAction ); - Console::WriteLine( L"The SOAP action for the method " - L"ExampleClass.GetHello is {0}.", - SoapServices::GetSoapActionFromMethodBase( methodBase ) ); - - // Reset the SOAP action of the GetHello method to its default - // value, which is determined using its SoapMethod attribute. - SoapServices::RegisterSoapActionForMethodBase( methodBase ); - Console::WriteLine( L"The SOAP action for the method " - L"ExampleClass.GetHello is {0}.", - SoapServices::GetSoapActionFromMethodBase( methodBase ) ); - // - - // - // Register all types in the assembly with the SoapType attribute. - System::Reflection::Assembly^ executingAssembly = - System::Reflection::Assembly::GetExecutingAssembly(); - SoapServices::PreLoad( executingAssembly ); - // - - // - // Register a specific type with the SoapType attribute. - Type^ exampleType = ExampleNamespace::ExampleClass::typeid; - SoapServices::PreLoad( exampleType ); - // - - // - // Get the currently registered type for the given XML element - // and namespace. - String^ registeredXmlElementName = L"ExampleClassElementName"; - String^ registeredXmlNamespace = - L"http://example.org/ExampleXmlNamespace"; - Type^ registeredType = - SoapServices::GetInteropTypeFromXmlElement( - registeredXmlElementName, registeredXmlNamespace ); - Console::WriteLine( L"The registered interop type is {0}.", - registeredType ); - - // Register a new type for the XML element and namespace. - SoapServices::RegisterInteropXmlElement( - registeredXmlElementName,registeredXmlNamespace,String::typeid ); - - // Get the currently registered type for the given XML element - // and namespace. - registeredType = SoapServices::GetInteropTypeFromXmlElement( - registeredXmlElementName,registeredXmlNamespace ); - Console::WriteLine( L"The registered interop type is {0}.", - registeredType ); - // - - // - // Get the currently registered type for the given XML element - // and namespace. - String^ registeredXmlTypeName = L"ExampleXmlTypeName"; - String^ registeredXmlTypeNamespace = - L"http://example.org/ExampleXmlTypeNamespace"; - registeredType = SoapServices::GetInteropTypeFromXmlType( - registeredXmlTypeName, registeredXmlTypeNamespace ); - Console::WriteLine( L"The registered interop type is {0}.", - registeredType ); - - // Register a new type for the XML element and namespace. - SoapServices::RegisterInteropXmlType( registeredXmlTypeName, - registeredXmlTypeNamespace,String::typeid ); - - // Get the currently registered type for the given XML element - // and namespace. - registeredType = SoapServices::GetInteropTypeFromXmlType( - registeredXmlTypeName,registeredXmlTypeNamespace ); - Console::WriteLine( L"The registered interop type is {0}.", - registeredType ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp deleted file mode 100644 index a850a00339e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Diagnostics; -using namespace System::Xml::Serialization; -using namespace System::Web::Services::Protocols; -using namespace System::Web::Services; - -int main(){} - -// This class derives from System::Web::Services::Protocols.WebClientProtocol -// as if the user is implemented his own protocol. -// It demonstrates the use of WebClientProtocol's constructor. - -// -[System::Web::Services::WebServiceBindingAttribute(Name="Service1Soap", - Namespace="http://tempuri.org/")] -ref class TempConvertService: public System::Web::Services::Protocols::WebClientProtocol -{ -public: - TempConvertService() : WebClientProtocol() - { - // Rest of class initialization. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp deleted file mode 100644 index 864f5255756..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -#using -#using -#using "Service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Collections; - -int main() -{ - // Create a remotable object. - TcpChannel^ tcpChannel = gcnew TcpChannel( 8085 ); - WellKnownServiceTypeEntry^ WKSTE = - gcnew WellKnownServiceTypeEntry( HelloService::typeid, - "Service", - WellKnownObjectMode::Singleton ); - RemotingConfiguration::RegisterWellKnownServiceType( WKSTE ); - - RemotingConfiguration::ApplicationName = "HelloServer"; - - // Print out the urls for the HelloServer. - array^ urls = tcpChannel->GetUrlsForUri( "HelloServer" ); - - for each ( String^ url in urls ) - { - System::Console::WriteLine( "{0}", url ); - } - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp deleted file mode 100644 index a2417ed5c55..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::Threading; - -void main() -{ - const int portNumber = 13; - - // - try - { - // Use the Pending method to poll the underlying socket instance for client connection requests. - TcpListener^ tcpListener = gcnew TcpListener( portNumber ); - tcpListener->Start(); - - if ( !tcpListener->Pending() ) - { - Console::WriteLine( "Sorry, no connection requests have arrived" ); - } - else - { - //Accept the pending client connection and return a TcpClient object^ initialized for communication. - TcpClient^ tcpClient = tcpListener->AcceptTcpClient(); - - // Using the RemoteEndPoint property. - Console::WriteLine( "I am listening for connections on {0} on port number {1}", - IPAddress::Parse( ( (IPEndPoint^)(tcpListener->LocalEndpoint) )->Address->ToString() ), - ( (IPEndPoint^)(tcpListener->LocalEndpoint) )->Port ); - // - - //Close the tcpListener and tcpClient instances - tcpClient->Close(); - } - tcpListener->Stop(); - } - catch ( Exception^ e ) - { - Console::WriteLine( e->ToString() ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp deleted file mode 100644 index 5d26295d745..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -#using -#using -#using "service.dll" - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels::Tcp; -using namespace System::Collections; - -int main() -{ - // Create a remotable object. - TcpServerChannel^ tcpChannel = gcnew TcpServerChannel( 8085 ); - - WellKnownServiceTypeEntry^ WKSTE = - gcnew WellKnownServiceTypeEntry( HelloService::typeid, - "Service", - WellKnownObjectMode::Singleton ); - RemotingConfiguration::RegisterWellKnownServiceType( WKSTE ); - - RemotingConfiguration::ApplicationName = "HelloServer"; - - // Print out the urls for the HelloServer. - array^ urls = tcpChannel->GetUrlsForUri( "HelloServer" ); - - for each ( String^ url in urls ) - { - System::Console::WriteLine( "{0}", url ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp b/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp deleted file mode 100644 index 0f5bd7c7799..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::Xml::Schema; - -ref class Vehicle; - -[SoapInclude(Vehicle::typeid)] -public ref class Vehicle -{ -public: - String^ licenseNumber; -}; - - -// You must use the SoapIncludeAttribute to inform the XmlSerializer -// that the Vehicle type should be recognized when deserializing. - -[SoapInclude(Vehicle::typeid)] -public ref class Group -{ -public: - String^ GroupName; - Vehicle^ GroupVehicle; -}; - -public ref class Run -{ -public: - void DeserializeObject( String^ filename ) - { - // Create an instance of the XmlSerializer class. - XmlTypeMapping^ myMapping = ((gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid )); - XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping ); - mySerializer->UnreferencedObject += gcnew UnreferencedObjectEventHandler( this, &Run::Serializer_UnreferencedObject ); - - // Reading the file requires an XmlTextReader. - XmlTextReader^ reader = gcnew XmlTextReader( filename ); - reader->ReadStartElement(); - - // Deserialize and cast the object. - Group^ myGroup; - myGroup = dynamic_cast(mySerializer->Deserialize( reader )); - reader->ReadEndElement(); - reader->Close(); - } - -private: - void Serializer_UnreferencedObject( Object^ /*sender*/, UnreferencedObjectEventArgs^ e ) - { - Console::WriteLine( "UnreferencedObject:" ); - Console::WriteLine( "ID: {0}", e->UnreferencedId ); - Console::WriteLine( "UnreferencedObject: {0}", e->UnreferencedObject ); - Vehicle^ myVehicle = dynamic_cast(e->UnreferencedObject); - Console::WriteLine( "License: {0}", myVehicle->licenseNumber ); - } -}; - -int main() -{ - Run^ test = gcnew Run; - test->DeserializeObject( "UnrefObj.xml" ); -} - -// The file named S"UnrefObj.xml" should contain this XML: -// -// -// -// -// ABCD -// -// -// 1234 -// -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp b/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp deleted file mode 100644 index dbc94df5f39..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#pragma region^ Using directives - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Text; - -#pragma endregion - -int main() -{ - // - UriBuilder^ baseUri = gcnew UriBuilder - ("http://www.contoso.com/default.aspx?Param1=7890"); - String^ queryToAppend = "param2=1234"; - if (baseUri->Query != nullptr && baseUri->Query->Length > 1) - { - // Note: In .NET Core and .NET 5+, you can simplify by removing - // the call to Substring(), which removes the leading "?" character. - baseUri->Query = baseUri->Query->Substring(1)+ "&" + queryToAppend; - } - else - { - baseUri->Query = queryToAppend; - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp deleted file mode 100644 index 13f395578e4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; -using namespace System::Collections::Specialized; - -int main() -{ - // - try - { - // Download the data to a buffer. - WebClient^ client = gcnew WebClient; - - array^ pageData = client->DownloadData( "http://www.contoso.com" ); - String^ pageHtml = Encoding::ASCII->GetString( pageData ); - Console::WriteLine( pageHtml ); - - // Download the data to a file. - client->DownloadFile( "http://www.contoso.com", "page.htm" ); - - // Upload some form post values. - NameValueCollection^ form = gcnew NameValueCollection; - form->Add( "MyName", "MyValue" ); - array^ responseData = client->UploadValues( "http://www.contoso.com/form.aspx", form ); - } - catch ( WebException^ webEx ) - { - Console::WriteLine( webEx->ToString() ); - if ( webEx->Status == WebExceptionStatus::ConnectFailure ) - { - Console::WriteLine( "Are you behind a firewall? If so, go through the proxy server." ); - } - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp deleted file mode 100644 index 36fa4c47873..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -// -int main() -{ - try - { - WebClient^ client = gcnew WebClient; - client->Credentials = CredentialCache::DefaultCredentials; - array^pageData = client->DownloadData( "http://www.contoso.com" ); - String^ pageHtml = Encoding::ASCII->GetString( pageData ); - Console::WriteLine( pageHtml ); - } - catch ( WebException^ webEx ) - { - Console::Write( webEx ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp deleted file mode 100644 index f9928d15693..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System::Net::WebClient::BaseAddress; System::Net::WebClient::ResponseHeaders - -/*This program demonstrates the 'BaseAddress' and 'ResponseHeaders' properties of the 'WebClient' class. -It accepts the base Uri from the user and assigns it to the 'BaseAddress' property of the -'WebClient' class. It then invokes 'DownloadFile' for the specific web page requested by the -user. WebClient internally combines the 'BaseAddress' and specific page name to retrieve the page. - -The 'ResponseHeaders' property is a 'WebHeaderCollection' that contains the -header information of the response received from the server. This is displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { - Console::Write( "\nPlease enter a Url {e.g. : http://www.microsoft.com}" ); - String^ hostUri = Console::ReadLine(); - Console::Write( "\nPlease enter the specific web page you require {e.g. : windows/default.asp} : " ); - String^ uriSuffix = Console::ReadLine(); - -// - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - - // Set the BaseAddress of the Web Resource in the WebClient. - myWebClient->BaseAddress = hostUri; - Console::WriteLine( "Downloading from {0}/ {1}", hostUri, uriSuffix ); - Console::WriteLine( "\nPress Enter key to continue" ); - Console::ReadLine(); - - // Download the target Web Resource into a Byte array. - array^ myDatabuffer = myWebClient->DownloadData( uriSuffix ); - - // Display the downloaded data. - String^ download = Encoding::ASCII->GetString( myDatabuffer ); - Console::WriteLine( download ); - Console::WriteLine( "Download of {0}{1} was successful.", myWebClient->BaseAddress, uriSuffix ); -// - -// - // Obtain the WebHeaderCollection instance containing the header name/value pair from the response. - WebHeaderCollection^ myWebHeaderCollection = myWebClient->ResponseHeaders; - Console::WriteLine( "\nDisplaying the response headers\n" ); - - // Loop through the ResponseHeaders and display the header name/value pairs. - for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) - { - Console::WriteLine( "\t{0} = {1}", myWebHeaderCollection->GetKey( i ), - myWebHeaderCollection->Get( i ) ); - } -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following WebException was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following Exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp deleted file mode 100644 index d306a8cb394..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp +++ /dev/null @@ -1,48 +0,0 @@ -// System::Net::WebClient::DownloadData; System::Net::WebClient::WebClient - -/* -This program demonstrates the 'DownloadData' method and 'WebClient()' constructor of 'WebClient' class. -It creates a URI to access a web resource. The Uri can point -to any text or binary web resource, like images etc. The 'DownloadData' method then downloads -the required text/html homepage into a Byte array. The downloaded data is displayed on the Console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// -// - Console::Write( "\nPlease enter a URI (e.g. http://www.contoso.com): " ); - String^ remoteUri = Console::ReadLine(); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - // Download home page data. - Console::WriteLine( "Downloading {0}", remoteUri ); - // Download the Web resource and save it into a data buffer. - array^ myDataBuffer = myWebClient->DownloadData( remoteUri ); - - // Display the downloaded data. - String^ download = Encoding::ASCII->GetString( myDataBuffer ); - Console::WriteLine( download ); - - Console::WriteLine( "Download successful." ); -// -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "Download failed!!! WebException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following general exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp deleted file mode 100644 index f7dd44ee87f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// System::Net::WebClient::DownloadFile - -/* -This program demonstrates the 'DownloadFile' method of 'WebClient' class. -It creates a URI to access a web resource at 'http://www.microsoft.com'. The Uri can point -to any text or binary web resource, like images etc. The 'DownloadFile' method then downloads -the target web resource which is a combination of the Uri and the actual web resource required, -into the current filesystem folder with a specified name. -Information regarding the sucess or failure of this operation is displayed on the console. -*/ - -#using -#using - -using namespace System; -using namespace System::Net; -using namespace System::Windows::Forms; - -int main() -{ - try - { -// - String^ remoteUri = "http://www.contoso.com/library/homepage/images/"; - String^ fileName = "ms-banner.gif", ^myStringWebResource = nullptr; - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - // Concatenate the domain with the Web resource filename. - myStringWebResource = String::Concat( remoteUri, fileName ); - Console::WriteLine( "Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource ); - // Download the Web resource and save it into the current filesystem folder. - myWebClient->DownloadFile( myStringWebResource, fileName ); - Console::WriteLine( "Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource ); - Console::WriteLine( "\nDownloaded file saved in the following file system folder:\n\t {0}", Application::StartupPath ); -// - } - catch ( WebException^ e ) - { - // Display the exception. - Console::WriteLine( "Download failed!!! WebException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - // Display the exception. - Console::WriteLine( "The following general exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp deleted file mode 100644 index d2ddda3c6cd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// System::Net::WebClient::OpenRead - -/* -This program demonstrates the 'OpenRead' method of 'WebClient' class. -It creates a URI to access a web resource. It then invokes 'OpenRead' tp obtain a 'Stream' -instance which is used to retrieve the web page data. The data read from the stream is then -displayed on the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; - -int main() -{ - try - { - Console::Write( "\nPlease enter a URI (e.g. http://www.contoso.com): " ); - String^ uriString = Console::ReadLine(); - -// - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - // Download home page data. - Console::WriteLine( "Accessing {0} ...", uriString ); - // Open a stream to point to the data stream coming from the Web resource. - Stream^ myStream = myWebClient->OpenRead( uriString ); - - Console::WriteLine( "\nDisplaying Data :\n" ); - StreamReader^ sr = gcnew StreamReader( myStream ); - Console::WriteLine( sr->ReadToEnd() ); - - // Close the stream. - myStream->Close(); -// - } - catch ( WebException^ e ) - { - // Display the exception. - Console::WriteLine( "Webresource access failed!!! WebException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - // Display the exception. - Console::WriteLine( "The following general exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp deleted file mode 100644 index a8b2e4ba9a9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// System::Net::WebClientOpenWrite(String, String) - -/* -This program demonstrates the 'OpenWrite(String, String)' method of S"WebClient" class. -It accepts an Uri and some String* content to be posted to the Uri. The -program makes a call to 'OpenWrite(String, String)' method and obtains a S"Stream" instance -This stream is used to post data to the site. - -Note : Behavior of this program may not be the same with all other sites. Also certain -sites would not accept S"Post" method thereby leading to an error. It is advisable -to construct a site using files accompanying this and provide -url name of this site to the program. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - try - { -// - String^ uriString; - Console::Write( "\nPlease enter the URI to post data to: " ); - uriString = Console::ReadLine(); - Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); - String^ postData = Console::ReadLine(); - // Apply ASCII encoding to obtain an array of bytes . - array^ postArray = Encoding::ASCII->GetBytes( postData ); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - - Console::WriteLine( "Uploading to {0} ...", uriString ); - Stream^ postStream = myWebClient->OpenWrite( uriString, "POST" ); - postStream->Write( postArray, 0, postArray->Length ); - - // Close the stream and release resources. - postStream->Close(); - Console::WriteLine( "\nSuccessfully posted the data." ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp deleted file mode 100644 index 49e839f707e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Net::WebClient::OpenWrite(String) - -/* -This program demonstrates the 'OpenWrite(String)' method of S"WebClient" class. -It accepts an Uri and some String* content to be posted to the Uri. The -program makes a call to 'OpenWrite(String)' method and obtains a S"Stream" instance -This stream is used to post data to the site. - -Note : Behavior of this program may not be the same with all other sites. Also certain -sites would not accept S"Post" method thereby leading to an error. It is advisable -to construct a site using files accompanying this and provide -url name of this site to the program. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - try - { -// - String^ uriString; - Console::Write( "\nPlease enter the URI to post data to: " ); - uriString = Console::ReadLine(); - Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); - String^ postData = Console::ReadLine(); - // Apply Ascii Encoding to obtain an array of bytes. - array^ postArray = Encoding::ASCII->GetBytes( postData ); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - - // postStream implicitly sets HTTP POST as the request method. - Console::WriteLine( "Uploading to {0} ...", uriString ); - Stream^ postStream = myWebClient->OpenWrite( uriString ); - - postStream->Write( postArray, 0, postArray->Length ); - - // Close the stream and release resources. - postStream->Close(); - - Console::WriteLine( "\nSuccessfully posted the data." ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp deleted file mode 100644 index 9d13d718d71..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp +++ /dev/null @@ -1,65 +0,0 @@ -// System::Net::WebClient::QueryString - -/*This program demonstrates the 'QueryString' property of 'WebClient' class. -It accepts a search phrase as user input and invokes the search of www.google.com for -the user-entered search-phrase, using the 'QueryString' property of WebClient. The result is -then saved into the current -filesystem folder as 'searchresult.htm'. -*/ - -#using - -using namespace System; -using namespace System::Collections::Specialized; -using namespace System::Net; - -int main() -{ - try - { -// - String^ uriString = "http://www.contoso.com/search"; - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - // Create a new NameValueCollection instance to hold the QueryString parameters and values. - NameValueCollection^ myQueryStringCollection = gcnew NameValueCollection; - Console::Write( "Enter the word(s), separated by space character to search for in {0}: ", uriString ); - // Read user input phrase to search for at uriString. - String^ searchPhrase = Console::ReadLine(); - if ( searchPhrase->Length > 1 ) - { - // Assign the user-defined search phrase. - myQueryStringCollection->Add( "q", searchPhrase ); - } - else - { - // If error, default to search for 'Microsoft'. - myQueryStringCollection->Add( "q", "Microsoft" ); - } - // Assign auxilliary parameters required for the search. - Console::WriteLine( "Searching {0} .......", uriString ); - // Attach QueryString to the WebClient. - myWebClient->QueryString = myQueryStringCollection; - // Download the search results Web page into 'searchresult.htm' for inspection. - myWebClient->DownloadFile( uriString, "searchresult.htm" ); - Console::WriteLine( "\nDownload of {0} was successful. Please see 'searchresult.htm' for results.", uriString ); -// - // Get the collection of Headers sent back in response to the WebClient request. - WebHeaderCollection^ myWebHeaderCollection = myWebClient->ResponseHeaders; - Console::WriteLine( "\nDisplaying Response Headers\n" ); - // Loop through the ResponseHeader collection and display the Headers as name/value pairs. - for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) - { - // Display the Headers as 'Name = Value' pairs. - Console::WriteLine( "\t {0} = {1}", myWebHeaderCollection->GetKey( i ), myWebHeaderCollection->Get( i ) ); - } - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following WebException was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following Exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp deleted file mode 100644 index b457c8c5fcd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// System::Net::WebClient::UploadData(String, Byte->Item[]) - -/* -This program demonstrates the 'UploadData(String, Byte->Item[])' method of S"WebClient" class. -It accepts an Uri and some String* content to be posted to the Uri. This String* is posted to the Uri -provided as input using the 'UploadData(String, Byte->Item[])' method. The custom made site responds back -with whatever was posted to it. The contents of the response are displayed to the console. - -Note : The results described were obtained using a custom made site. This behavior may not be the -same with all other sites. Also certain sites would not accept "Post" method thereby leading to -an error. It is advisable to construct a site using files accompanying this and provide -url name of this site to the program. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - Console::Write( "\nPlease enter the URI to post data to: " ); - String^ uriString = Console::ReadLine(); - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); - String^ postData = Console::ReadLine(); - // Apply ASCII Encoding to obtain the String* as a Byte array. - array^ postArray = Encoding::ASCII->GetBytes( postData ); - Console::WriteLine( "Uploading to {0} ...", uriString ); - myWebClient->Headers->Add( "Content-Type", "application/x-www-form-urlencoded" ); - - //UploadData implicitly sets HTTP POST as the request method. - array^responseArray = myWebClient->UploadData( uriString, postArray ); - - // Decode and display the response. - Console::WriteLine( "\nResponse received was: {0}", Encoding::ASCII->GetString( responseArray ) ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp deleted file mode 100644 index 67b84643e61..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// System::Net::WebClient::UploadData(String, String, Byte->Item[]); System::Net::WebClient::Headers - -/* -This program demonstrates the 'UploadData(String, String, Byte->Item[])' method and 'Headers' property of -'WebClient' class. It accepts an Uri and some String* content to be posted to the Uri. This String* -is posted to the Uri provided as input using the 'UploadData(String, String, Byte->Item[])' method. -The 'Headers' property is used to set the S"Content-Type" header to S"application/x-www-form-urlencoded". -The custom made site responds back with whatever was posted to it. -The contents of the response are displayed to the console. - -Note : The results described were obtained using a custom made site. This behavior may not be the -same with all other sites. Also certain sites would not support the S"Post" method thereby leading to -an error. It is advisable to construct a site using files accompanying this and provide -url name of this site to the program. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// -// - String^ uriString; - Console::Write( "\nPlease enter the URI to post data to {for example, http://www.contoso.com}: " ); - uriString = Console::ReadLine(); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); - String^ postData = Console::ReadLine(); - myWebClient->Headers->Add( "Content-Type", "application/x-www-form-urlencoded" ); - - // Displays the headers in the request - Console::Write( "Resulting Request Headers: "); - Console::WriteLine(myWebClient->Headers); - - // Apply ASCII Encoding to obtain the String^ as a Byte array. - array^ byteArray = Encoding::ASCII->GetBytes( postData ); - Console::WriteLine( "Uploading to {0} ...", uriString ); - // Upload the input String* using the HTTP 1.0 POST method. - array^responseArray = myWebClient->UploadData( uriString, "POST", byteArray ); - // Decode and display the response. - Console::WriteLine( "\nResponse received was {0}", - Encoding::ASCII->GetString( responseArray ) ); -// -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp deleted file mode 100644 index 601e1b7166c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -// System::Net::WebClient::UploadFile(String, String) -/* -This program demonstrates the 'UploadFile(String, String)' method of S"WebClient" class. -It accepts an Uri and the path of a file to be uploaded to the Uri. This file is uploaded to the Uri -provided as input using the 'UploadFile(String, String)' method. The custom made site responds back -with whatever was posted to it. Thus the contents of the file are displayed to the console. - -Note : The results described were obtained using a custom made site. This behavior may not be the -same with all other sites. Also certain sites would not accept S"Post" method thereby leading to -an error. It is advisable to construct a site using files accompanying this and provide -url name of this site to the program. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -public class WebClient_UploadFile -{ -public: - int main() - { - try - { - // - Console::Write( "\nPlease enter the URI to post data to : " ); - String^ uriString = Console::ReadLine(); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - Console::WriteLine( "\nPlease enter the fully qualified path of the file to be uploaded to the URI" ); - String^ fileName = Console::ReadLine(); - Console::WriteLine( "Uploading {0} to {1} ...", fileName, uriString ); - - // Upload the file to the URI. - // The 'UploadFile(uriString, fileName)' method implicitly uses HTTP POST method. - array^responseArray = myWebClient->UploadFile( uriString, fileName ); - - // Decode and display the response. - Console::WriteLine( "\nResponse Received::The contents of the file uploaded are: \n {0}", - System::Text::Encoding::ASCII->GetString( responseArray ) ); - // - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp deleted file mode 100644 index 8c7b4cf0202..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// System::Net::WebClient::UploadFile(String, String, String) -/* -This program demonstrates the 'UploadFile(String, String, String)' method of S"WebClient" class. -It accepts an Uri and the path of a file to be uploaded to the Uri. This file is uploaded to the Uri -provided as input using the 'UploadFile(String, String, String)' method. The custom made site responds back -with whatever was posted to it. Thus the contents of the file are displayed to the console. - -Note : The results described were obtained using a custom made site. This behavior may not be the -same with all other sites. Also certain sites would not accept S"Post" method thereby leading to -an error. It is advisable to construct a site using files accompanying this and provide -url name of this site to the program. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Text; - -public class WebClient_UploadFile { - public: - int main() - { - try - { - // - Console::Write( "\nPlease enter the URL to post data to : " ); - String^ uriString = Console::ReadLine(); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - Console::WriteLine - ("\nPlease enter the fully qualified path of the file to be uploaded to the URL" ); - String^ fileName = Console::ReadLine(); - Console::WriteLine( "Uploading {0} to {1} ...", fileName, uriString ); - - // Upload the file to the URL using the HTTP 1.0 POST. - array^responseArray = myWebClient->UploadFile( uriString, "POST", fileName ); - - // Decode and display the response. - Console::WriteLine( "\nResponse Received::The contents of the file uploaded are: \n {0}", - System::Text::Encoding::ASCII->GetString( responseArray )); - // - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp deleted file mode 100644 index 608d8f55e16..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// System::Net::WebClient::UploadValues(String, NameValueCollection) - -/* -This program demonstrates the 'UploadValues(String, NameValueCollection)' method of S"WebClient" class. -It accepts an Uri::Forms a 'NameValueCollection' instance using -a set of pre-defined name-value pairs. These are posted to the Uri provided as input using the -'UploadValues(String, NameValueCollection)'method. The custom made site responds back -with whatever was posted to it. This is displayed to the console. - -Note : The results described were obtained using a custom made site. This behavior may not be the -same with all other sites. Also certain sites would not accept S"Post" method thereby leading to -an error. It is advisable to construct a site using files accompanying this and provide -url name of this site to the program. -*/ - -#using - -using namespace System; -using namespace System::Collections::Specialized; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - Console::Write( "\nPlease enter the URI to post data to: " ); - String^ uriString = Console::ReadLine(); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - - // Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL. - NameValueCollection^ myNameValueCollection = gcnew NameValueCollection; - - Console::WriteLine( "Please enter the following parameters to be posted to the URL" ); - Console::Write( "Name: " ); - String^ name = Console::ReadLine(); - - Console::Write( "Age: " ); - String^ age = Console::ReadLine(); - - Console::Write( "Address: " ); - String^ address = Console::ReadLine(); - - // Add necessary parameter/value pairs to the name/value container. - myNameValueCollection->Add( "Name", name ); - myNameValueCollection->Add( "Address", address ); - myNameValueCollection->Add( "Age", age ); - - Console::WriteLine( "\nUploading to {0} ...", uriString ); - // 'The Upload(String, NameValueCollection)' implicitly method sets HTTP POST as the request method. - array^ responseArray = myWebClient->UploadValues( uriString, myNameValueCollection ); - - // Decode and display the response. - Console::WriteLine( "\nResponse received was :\n {0}", Encoding::ASCII->GetString( responseArray ) ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp deleted file mode 100644 index 6435886d8a7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp +++ /dev/null @@ -1,68 +0,0 @@ -// System::Net::WebClient::UploadValues(String, String, NameValueCollection) - -/* -This program demonstrates the 'UploadValues(String, String, NameValueCollection)' method of S"WebClient" class. -It accepts an Uri::Forms a 'NameValueCollection' instance using -a set of pre-defined name-value pairs. These are posted to the Uri provided as input using the -'UploadValues(String, String, NameValueCollection)'method. The custom made site responds back -with whatever was posted to it. This is displayed to the console. - -Note : The results described were obtained using a custom made site. This behavior may not be the -same with all other sites. Also certain sites would not accept S"Post" method thereby leading to -an error. It is advisable to construct a site using files accompanying this and provide -url name of this site to the program. -*/ - -#using - -using namespace System; -using namespace System::Collections::Specialized; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - Console::Write( "\nPlease enter the URL to post data to: " ); - String^ uriString = Console::ReadLine(); - - // Create a new WebClient instance. - WebClient^ myWebClient = gcnew WebClient; - - // Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL. - NameValueCollection^ myNameValueCollection = gcnew NameValueCollection; - - Console::WriteLine( "Please enter the following parameters to be posted to the URI" ); - Console::Write( "Name: " ); - String^ name = Console::ReadLine(); - - Console::Write( "Age: " ); - String^ age = Console::ReadLine(); - - Console::Write( "Address: " ); - String^ address = Console::ReadLine(); - - // Add necessary parameter/value pairs to the name/value container. - myNameValueCollection->Add( "Name", name ); - myNameValueCollection->Add( "Address", address ); - myNameValueCollection->Add( "Age", age ); - Console::WriteLine( "\nUploading to {0} ...", uriString ); - - // Upload the NameValueCollection. - array^ responseArray = myWebClient->UploadValues( uriString, "POST", myNameValueCollection ); - - // Decode and display the response. - Console::WriteLine( "\nResponse received was :\n {0}", Encoding::ASCII->GetString( responseArray ) ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "The following exception was raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp deleted file mode 100644 index fc78349bd84..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// System::Net::WebException::WebException(); - -/* -This program demonstrates the 'WebException()' constructor of 'WebException' class. -It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with an invalid 'URL'. -When the method tries to establish a socket connection to that address an exception is thrown.In -the 'catch' block a new 'WebException' Object* is created and thrown to the caller. That exception -is caught in the calling method and the error message is displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; - -public ref class HttpConnect -{ -public: - void ConnectHttpServer( String^ connectUri ) - { -// - try - { - // A 'Socket' object has been created. - Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); - - - // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. - - IPHostEntry^ hostEntry = Dns::Resolve( "http://www.contoso.com" ); - - IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; - IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); - httpSocket->Connect( endPoint ); - Console::WriteLine( "Connection created successfully" ); - httpSocket->Close(); - } - catch ( SocketException^ e ) - { - String^ exp = e->Message; - // Throw the WebException with no parameters. - throw gcnew WebException; - } -// - } -}; - -int main() -{ - try - { - HttpConnect^ myHttpConnect = gcnew HttpConnect; - // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. - myHttpConnect->ConnectHttpServer( "www.contoso.com" ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "The Exception is: {0}", e->Message ); - Console::WriteLine( "The Exception is: Unable to Contact the server" ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp deleted file mode 100644 index bd7987a1db7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// System::Net::WebException::WebException(String); - -/* -This program demonstrates the 'WebException(String)' constructor of 'WebException' class. -It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with invalid 'URL'. -When the method tries to establish a socket connection to that address an exception is thrown.In -the 'catch' block a new 'WebException' Object* is created with a message(specific to the present -situation) and thrown to the caller. That exception is caught in the calling method and the -error message is displayed on the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; - -public ref class HttpConnect -{ -public: - void ConnectHttpServer( String^ connectUri ) - { -// - try - { - // A 'Socket' object has been created. - Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); - - // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. - IPHostEntry^ hostEntry = Dns::Resolve( connectUri ); - - IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; - IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); - httpSocket->Connect( endPoint ); - Console::WriteLine( "Connection created successfully" ); - httpSocket->Close(); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "\nException thrown.\nThe Original Message is: {0}", e->Message ); - - // Throw the 'WebException' object with a message string specific to the situation. - throw gcnew WebException( "Unable to locate the Server with 'www.contoso.com' Uri." ); - } -// - } -}; - -int main() -{ - try - { - HttpConnect^ myHttpConnect = gcnew HttpConnect; - // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. - myHttpConnect->ConnectHttpServer( "www.contoso.com" ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nThe New Message is: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp deleted file mode 100644 index 8a6a84a5294..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// System::Net::WebException::WebException(String, WebExceptionStatus); - -/* -This program demonstrates the 'WebException(String, WebExceptionStatus)' constructor of 'WebException' class. -It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with invalid 'URL'. -When the method tries to establish a socket connection to that address an exception is thrown and -in the 'catch' block a new 'WebException' Object* is created and thrown. That exception is caught -in the calling method and the error message is displayed on the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; - -public ref class HttpConnect -{ -public: - void ConnectHttpServer( String^ connectUri ) - { -// - try - { - // A 'Socket' object has been created. - Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); - - // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. - - IPHostEntry^ hostEntry = Dns::Resolve( "http://www.contoso.com" ); - - IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; - IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); - httpSocket->Connect( endPoint ); - Console::WriteLine( "Connection created successfully" ); - httpSocket->Close(); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "\nException thrown.\nThe Original Message is: {0}", e->Message ); - // Throw the 'WebException' object with a message string and message status specific to the situation. - throw gcnew WebException( "Unable to locate the Server with 'www.contoso.com' Uri.", WebExceptionStatus::NameResolutionFailure ); - } -// - } -}; - -int main() -{ - try - { - HttpConnect^ myHttpConnect = gcnew HttpConnect; - // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. - myHttpConnect->ConnectHttpServer( "www.contoso.com" ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nThe New Message is: {0}", e->Message ); - Console::WriteLine( "\nThe Status is : {0}", e->Status ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp deleted file mode 100644 index eb951370648..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// System::Net::WebException::WebException(String, InnerException); - -/* -This program demonstrates the 'WebException(String, InnerException)' constructor of 'WebException' class. -It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with invalid 'URL'. -When the method tries to establish a socket connection to that address an exception is thrown and -in the 'catch' block a new 'WebException' Object* is created and thrown. That exception is caught -in the calling method and the error message is displayed on the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; - -public ref class HttpConnect -{ -public: - void ConnectHttpServer( String^ connectUri ) - { -// - try - { - // A 'Socket' object has been created. - Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); - - // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. - - IPHostEntry^ hostEntry = Dns::Resolve( connectUri ); - - IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; - IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); - httpSocket->Connect( endPoint ); - Console::WriteLine( "Connection created successfully" ); - httpSocket->Close(); - } - catch ( SocketException^ e ) - { - Console::WriteLine( "\nException thrown.\nThe Original Message is: {0}", e->Message ); - // Throw the 'WebException' object with a message string specific to the situation; - // and the 'InnerException' that actually led to this exception. - throw gcnew WebException( "Unable to locate the Server with 'www.contoso.com' Uri.", e ); - } -// - } -}; - -int main() -{ - try - { - HttpConnect^ myHttpConnect = gcnew HttpConnect; - - // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. - myHttpConnect->ConnectHttpServer( "www.contoso.com" ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nThe New Message is: {0}", e->Message ); - Console::WriteLine( "\nThe Inner Exception is : {0}", e->InnerException ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp deleted file mode 100644 index a128262f175..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// System::Net::WebException::WebException(String, InnerException, Status, WebResponse); - -/* -This program demonstrates the 'WebException(String, InnerException, Status, WebResponse)' constructor of -'WebException' class. -A 'HttpConnect' class is defined which extends the 'WebResponse' class. Then a 'HttpConnect' Object* is -created by taking an uri(intranet) from the user as input and 'ConnectHttpServer' method is called to connect -the InternetServer at the specified 'URL'. It asks for a file named 'nhjj.htm' , gets the response from the -InternetServer and checks the status of the response. If status is '404 File not Found' a 'WebResponse' Object* -is created and then a new 'WebException' Object* is created and thrown. That exception is caught in the calling -method and the error message along with the response obtained from the InternetServer is displayed to the -console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Sockets; -using namespace System::Text; -using namespace System::IO; - -public ref class HttpConnect: public WebResponse -{ -public: - Stream^ getStream; - - // Default constructor. - HttpConnect() - { - getStream = nullptr; - } - - // Constructor accepting stream as a parameter. - HttpConnect( Stream^ getStream ) - { - this->getStream = getStream; - } - - // Override 'GetResponseStream' method of the 'WebResponse' class. - virtual Stream^ GetResponseStream() override - { - return getStream; - } - - void ConnectHttpServer( String^ connectUri ) - { -// - // Send the data. - Encoding^ ASCII = Encoding::ASCII; - String^ requestPage = String::Concat( "GET /nhjj.htm HTTP/1.1\r\nHost: ", connectUri, "\r\nConnection: Close\r\n\r\n" ); - array^ byteGet = ASCII->GetBytes( requestPage ); - array^ recvBytes = gcnew array(256); - - // Create an 'IPEndPoint' object. - - IPHostEntry^ hostEntry = Dns::Resolve( connectUri ); - IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; - IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress,80 ); - - // Create a 'Socket' object for sending data. - Socket^ connectSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); - - // Connect to host using 'IPEndPoint' object. - - connectSocket->Connect( endPoint ); - - // Sent the 'requestPage' text to the host. - connectSocket->Send( byteGet, byteGet->Length, (SocketFlags)(0) ); - - // Receive the information sent by the server. - Int32 bytesReceived = connectSocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)(0) ); - String^ headerString = ASCII->GetString( recvBytes, 0, bytesReceived ); - - // Check whether 'status 404' is there or not in the information sent by server. - if ( headerString->IndexOf( "404" ) != -1 ) - { - bytesReceived = connectSocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)(0) ); - MemoryStream^ memoryStream = gcnew MemoryStream( recvBytes ); - getStream = (System::IO::Stream^)(memoryStream); - - // Create a 'WebResponse' object - WebResponse^ myWebResponse = (WebResponse^)(gcnew HttpConnect( getStream )); - Exception^ myException = gcnew Exception( "File Not found" ); - - // Throw the 'WebException' object with a message string, message status, InnerException and WebResponse - throw gcnew WebException( "The Requested page is not found.",myException,WebExceptionStatus::ProtocolError,myWebResponse ); - } - - connectSocket->Close(); -// - } -}; - -int main() -{ - try - { - Console::WriteLine( "Please give any Intranet Site Address (eg:manjeera.wipro.com)" ); - String^ uriConnect = Console::ReadLine(); - HttpConnect^ myHttpConnect = gcnew HttpConnect; - myHttpConnect->ConnectHttpServer( uriConnect ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nThe WebException is : {0}", e->Message ); - Console::WriteLine( "\nThe status of the WebException is : {0}", e->Status ); - Console::WriteLine( "\nThe Inner Exception is :' {0}'", e->InnerException ); - Console::WriteLine( "\nThe Web Response is:\n" ); - StreamReader^ readStream = gcnew StreamReader( e->Response->GetResponseStream() ); - Console::WriteLine( readStream->ReadToEnd() ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp deleted file mode 100644 index a74ca8330a1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp +++ /dev/null @@ -1,40 +0,0 @@ -/* This program demonstrates the S"Status" and the S"Response" property of S"WebException" class. -It tries to access an invalid site and displays the status code and status description of the -resultant exception that is raised. -*/ - -#using - -using namespace System; -using namespace System::Net; - -int main() -{ -// -// - try - { - // Create a web request for an unknown server (this raises the WebException). - HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)(WebRequest::Create( "http://unknown.unknown.com" )); - - // Get the associated response for the above request. - HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)(myHttpWebRequest->GetResponse()); - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "This program is expected to throw WebException on successful run." + - "\n\nException Message : " + e->Message ); - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - Console::WriteLine( "Status Code: {0}", ( (HttpWebResponse^)(e->Response) )->StatusCode ); - Console::WriteLine( "Status Description: {0}", ( (HttpWebResponse^)(e->Response) )->StatusDescription ); - } -// - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } -// -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp deleted file mode 100644 index 69020651232..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -/* This program demonstrates the S"Add" method of S"WebHeaderCollection" class. -It uses the S"Add" method of S"WebHeaderCollection" class to add the 'Accept-Language' header in the request. -The 'Accept-Language' header is used in a request to specify the language preferences of the user. The server -can use the language preferences specified to generate output for that particular language. -*/ -#using - -using namespace System; -using namespace System::Net; -void printHeaders( WebHeaderCollection^ headers ) -{ - Console::WriteLine( "Printing Headers : " ); - if ( headers->Count == 0 ) - Console::WriteLine( "\tNo Headers to Display" ); - - for ( int i = 0; i < headers->Count; i++ ) - Console::WriteLine( "\t {0} : {1}", headers->AllKeys[ i ], headers[ i ] ); -} - -int main() -{ - // - try - { - //Create a web request for S"www.msn.com". - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); - - //Get the headers associated with the request. - WebHeaderCollection^ myWebHeaderCollection = myHttpWebRequest->Headers; - Console::WriteLine( "Configuring Webrequest to accept Danish and English language using 'Add' method" ); - - //Add the Accept-Language header (for Danish) in the request. - myWebHeaderCollection->Add( "Accept-Language:da" ); - - //Include English in the Accept-Langauge header. - myWebHeaderCollection->Add( "Accept-Language:en;q=0.8" ); - - //Get the associated response for the above request. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - //Print the headers for the request. - printHeaders( myWebHeaderCollection ); - myHttpWebResponse->Close(); - } - //Catch exception if trying to add a restricted header. - catch ( ArgumentException^ e ) - { - Console::WriteLine( e->Message ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException is thrown. \nMessage is : {0}", e->Message ); - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); - Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); - Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp deleted file mode 100644 index 096efbded87..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp +++ /dev/null @@ -1,58 +0,0 @@ - - -/* -This program demonstrate's the 'GetValues(String*)' method of 'WebHeaderCollection' class. - -The program creates a 'HttpWebRequest' Object* from the specified URL and gets the response from it. The -headers of the response is assigned to a 'WeHeaderCollection' Object* and all the values associated with -the corresponding headers in the response are displayed to the console. -*/ -#using - -using namespace System; -using namespace System::Net; -int main() -{ - try - { - // - // Create a web request for S"www.msn.com". - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); - myHttpWebRequest->Timeout = 1000; - - // Get the associated response for the above request. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Get the headers associated with the response. - WebHeaderCollection^ myWebHeaderCollection = myHttpWebResponse->Headers; - for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) - { - String^ header = myWebHeaderCollection->GetKey( i ); - array^values = myWebHeaderCollection->GetValues( header ); - if ( values->Length > 0 ) - { - Console::WriteLine( "The values of {0} header are : ", header ); - for ( int j = 0; j < values->Length; j++ ) - Console::WriteLine( "\t {0}", values[ j ] ); - } - else - Console::WriteLine( "There is no value associated with the header" ); - } - myHttpWebResponse->Close(); - // - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException raised : {0}", e->Message ); - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); - Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); - Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "\n Exception raised : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp deleted file mode 100644 index 842da2d6a21..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -/*This program demonstrates the S"IsRestricted" method of S"WebHeaderCollection". -It checks if the first header returned in the response is a restricted header or not. -*/ -#using - -using namespace System; -using namespace System::Net; -int main() -{ - // - try - { - // Create a web request for S"www.msn.com". - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); - - // Get the associated response for the above request. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Get the headers associated with the response. - WebHeaderCollection^ myWebHeaderCollection = myHttpWebResponse->Headers; - for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) - { - // Check if the first response header is restriced. - if ( WebHeaderCollection::IsRestricted( dynamic_cast(myWebHeaderCollection->AllKeys[ i ]) ) ) - Console::WriteLine( "' {0}' is a restricted header", myWebHeaderCollection->AllKeys[ i ] ); - else - Console::WriteLine( "' {0}' is not a restricted header", myWebHeaderCollection->AllKeys[ i ] ); - } - myHttpWebResponse->Close(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException is thrown.\nMessage is: {0}", e->Message ); - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); - Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); - Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); - } -// -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp deleted file mode 100644 index c8286d49cd4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp +++ /dev/null @@ -1,79 +0,0 @@ - - -/* -This program demonstrates the S"Remove" method of S"WebHeaderCollection" class. -It uses the S"Remove" method of S"WebHeaderCollection" to remove the 'Cache-Control' header from the request. -The 'Cache-Control' header is used to specify the directive that must be followed by all caching mechanisms -in the Request-Response chain. The 'no-cache' directive indicates that the caching mechanism must not resend -the cached response for a previous request with->Item[Out] validating* from the origin server (HTTP version 1.1, RFC2616, -Sec 14.9) -*/ -#using - -using namespace System; -using namespace System::Net; -void printHeaders( WebHeaderCollection^ headers ) -{ - if ( headers->Count == 0 ) - Console::WriteLine( "\tNo Headers to Display" ); - - for ( int i = 0; i < headers->Count; i++ ) - Console::WriteLine( "\t {0} : {1}", headers->AllKeys[ i ], headers[ i ] ); -} - -int main() -{ - // - try - { - // Create a web request for S"www.msn.com". - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); - - // Get the headers associated with the request. - WebHeaderCollection^ myWebHeaderCollection = myHttpWebRequest->Headers; - - // Set the Cache-Control header. - myWebHeaderCollection->Set( "Cache-Control", "no-cache" ); - - // Get the associated response for the above request. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Print the headers of the request to console. - Console::WriteLine( "Print request headers after adding Cache-Control for first request:" ); - printHeaders( myHttpWebRequest->Headers ); - - // Remove the Cache-Control header for the new request. - myWebHeaderCollection->Remove( "Cache-Control" ); - - // Get the response for the new request. - myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - - // Print the headers of the new request with->Item[Out] the* Cache-Control header. - Console::WriteLine( "Print request headers after removing Cache-Control for the new request:" ); - printHeaders( myHttpWebRequest->Headers ); - myHttpWebResponse->Close(); - } - // Catch exception if trying to remove a restricted header. - catch ( ArgumentException^ e ) - { - Console::WriteLine( "Error : Trying to remove a restricted header" ); - Console::WriteLine( "ArgumentException is thrown. Message is : {0}", e->Message ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException is thrown. Message is : {0}", e->Message ); - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); - Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); - Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); - } - - - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp deleted file mode 100644 index 08a56e07a73..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -/* This program demonstrates the S"Set" method of S"WebHeaderCollection" class. -It sets the value of the 'Cache-Control' header in the request to S"no-cache". The 'Cache-Control' header -is used to specify the directive that must be followed by all caching mechanisms in the Request-Response chain. -The 'no-cache' directive indicates that the caching mechanism must not resend the cached response for a -previous request with->Item[Out] validating* from the origin server (HTTP version 1.1, RFC2616, Sec 14.9). -*/ -#using - -using namespace System; -using namespace System::Net; -void PrintHeaders( WebHeaderCollection^ headers ) -{ - Console::WriteLine( "Printing Headers : " ); - if ( headers->Count == 0 ) - Console::WriteLine( "\tNo Headers to Display" ); - - for ( int i = 0; i < headers->Count; i++ ) - Console::WriteLine( "\t {0} : {1}", headers->AllKeys[ i ], headers[ i ] ); -} - -int main() -{ - // - try - { - // Create a web request for S"www.msn.com". - HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); - - // Get the headers associated with the request. - WebHeaderCollection^ myWebHeaderCollection = myHttpWebRequest->Headers; - - // Set the Cache-Control header in the request. - myWebHeaderCollection->Set( "Cache-Control", "no-cache" ); - - // Get the associated response for the above request. - HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); - Console::WriteLine( "Headers after 'Set' method is used on Cache-Control :" ); - - // Print the headers for the request. - PrintHeaders( myWebHeaderCollection ); - myHttpWebResponse->Close(); - } - // Catch exception if trying to set a restricted header. - catch ( ArgumentException^ e ) - { - Console::WriteLine( "ArgumentException is thrown. Message is : {0}", e->Message ); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException is thrown. Message is : {0}", e->Message ); - if ( e->Status == WebExceptionStatus::ProtocolError ) - { - Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); - Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); - Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp deleted file mode 100644 index f4e56ffd6bf..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; - -/* -* Demonstrate how to use the WebPermissionAttribute to specify the Accept property. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; - -public ref class WebPermissionAttribute_AcceptConnect -{ -// -public: - // Deny access to a specific resource by setting the Accept property. - [method:WebPermission(SecurityAction::Deny,Accept="http://www.contoso.com/Private.htm")] - - static void CheckAcceptPermission( String^ uriToCheck ) - { - WebPermission^ permissionToCheck = gcnew WebPermission; - permissionToCheck->AddPermission( NetworkAccess::Accept, uriToCheck ); - permissionToCheck->Demand(); - } - - static void demoDenySite() - { - // Pass the security check when accessing allowed resources. - CheckAcceptPermission( "http://www.contoso.com/" ); - Console::WriteLine( "Public page has passed Accept permission check" ); - - try - { - // Throw a SecurityException when trying to access not allowed resources. - CheckAcceptPermission( "http://www.contoso.com/Private.htm" ); - Console::WriteLine( "This line will not be printed" ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Exception trying to access private resource: {0}", e->Message ); - } - } -// -}; - -int main() -{ - WebPermissionAttribute_AcceptConnect::demoDenySite(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp deleted file mode 100644 index 05d097162a9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; - -// Demonstrate how to use the WebPermissionAttribute to specify an allowable ConnectPattern. - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; - -public ref class WebPermissionAttribute_AcceptConnect -{ -// -// -public: - // Deny access to a specific resource by setting the ConnectPattern property. - [method:WebPermission(SecurityAction::Deny,ConnectPattern="http://www.contoso.com/")] - - void Connect() - { - // Create a Connection. - HttpWebRequest^ myWebRequest = (HttpWebRequest^)(WebRequest::Create( "http://www.contoso.com" )); - Console::WriteLine( "This line should never be printed" ); - } -// -// -}; - -int main() -{ - try - { - WebPermissionAttribute_AcceptConnect^ myWebAttrib = gcnew WebPermissionAttribute_AcceptConnect; - myWebAttrib->Connect(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Security Exception raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp deleted file mode 100644 index fd594b719b1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; - -/* -This program demonstrates the 'Connect' and 'Accept' properties of the class 'WebPermissionAttribute'. -The program uses declarative security for calling the code in 'Connect' method. -By using the 'Accept' and 'Connect' properties of 'WebPermissionAttribute' accept and connect access -has been given to the uri www.contoso.com. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; -using namespace System::Text::RegularExpressions; - -public ref class WebPermissionAttribute_AcceptConnect -{ -// -public: - [method:WebPermission(SecurityAction::Deny,AcceptPattern="http://www\\.contoso\\.com/Private/.*")] - static void CheckAcceptPermission( String^ uriToCheck ) - { - WebPermission^ permissionToCheck = gcnew WebPermission; - permissionToCheck->AddPermission( NetworkAccess::Accept, uriToCheck ); - permissionToCheck->Demand(); - } - - static void demoDenySite() - { - // Passes a security check. - CheckAcceptPermission( "http://www.contoso.com/Public/page.htm" ); - Console::WriteLine( "Public page has passed Accept permission check" ); - - try - { - // Throws a SecurityException. - CheckAcceptPermission( "http://www.contoso.com/Private/page.htm" ); - Console::WriteLine( "This line will not be printed" ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Expected exception: {0}", e->Message ); - } - } -// -}; - -int main() -{ - WebPermissionAttribute_AcceptConnect::demoDenySite(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp deleted file mode 100644 index d369bcc8ee1..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp +++ /dev/null @@ -1,50 +0,0 @@ -// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::connect; - -// Demonstrate how to use the WebPermissionAttribute Connect property. - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; - -public ref class WebPermissionAttribute_Connect -{ -// -public: - // Set the WebPermissionAttribute Connect property. - [method:WebPermission(SecurityAction::Deny,Connect="http://www.contoso.com/Private.htm")] - - static void demoDenySite() - { - //Pass the security check. - CheckConnectPermission( "http://www.contoso.com/Public.htm" ); - Console::WriteLine( "Public page has passed connect permission check" ); - - try - { - //Throw a SecurityException. - CheckConnectPermission( "http://www.contoso.com/Private.htm" ); - Console::WriteLine( "This line will not be printed" ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Expected exception {0}", e->Message ); - } - } - - static void CheckConnectPermission( String^ uriToCheck ) - { - WebPermission^ permissionToCheck = gcnew WebPermission; - permissionToCheck->AddPermission( NetworkAccess::Connect, uriToCheck ); - permissionToCheck->Demand(); - } -// -}; - -int main() -{ - WebPermissionAttribute_Connect::demoDenySite(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp deleted file mode 100644 index 648da93ee85..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Connect; - -// Demonstrate how to use the WebPermissionAttribute ConnectPattern property. - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; -using namespace System::Text::RegularExpressions; - -public ref class WebPermissionAttribute_Connect -{ -// -public: - // Set the WebPermissionAttribute ConnectPattern property. - [WebPermission(SecurityAction::Deny,ConnectPattern="http://www\\.contoso\\.com/Private/.*")] - - static void CheckConnectPermission( String^ uriToCheck ) - { - WebPermission^ permissionToCheck = gcnew WebPermission; - permissionToCheck->AddPermission( NetworkAccess::Connect, uriToCheck ); - permissionToCheck->Demand(); - } - - static void demoDenySite() - { - //Pass the security check. - CheckConnectPermission( "http://www.contoso.com/Public/page.htm" ); - Console::WriteLine( "Public page has passed Connect permission check" ); - - try - { - //Throw a SecurityException. - CheckConnectPermission( "http://www.contoso.com/Private/page.htm" ); - Console::WriteLine( "This line will not be printed" ); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Expected exception {0}", e->Message ); - } - } -}; -// - -int main() -{ - WebPermissionAttribute_Connect::demoDenySite(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp deleted file mode 100644 index 8606c8f6c78..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::IO; - -public ref class WebPermissionAttribute_AcceptConnect -{ -// -public: - // Set the declarative security for the URI. - [WebPermission(SecurityAction::Deny,Connect="http://www.contoso.com/")] - void Connect() - { - // Throw an exception. - try - { - HttpWebRequest^ myWebRequest = dynamic_cast(WebRequest::Create( "http://www.contoso.com/" )); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e ); - } -// - } -}; - -int main() -{ - try - { - WebPermissionAttribute_AcceptConnect^ myWebAttrib = gcnew WebPermissionAttribute_AcceptConnect; - myWebAttrib->Connect(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "Security Exception raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp deleted file mode 100644 index df794666883..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp +++ /dev/null @@ -1,99 +0,0 @@ - - -// System::Net::WebPermission::ConnectList;System::Net::WebPermission::AcceptList; -/** -* This program demonstrates the use of the ConnectList and AcceptList WebPermission -* class prerties. -* It first creates a WebPermission object with Permissionstate set to None and then -* sets the Connect and Accept access right to some predefined URLs. -* The using the AcceptList and ConnectList properties it displays the URLs that have -* the Accept and Connect permission set, respectively. -*/ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -class WebPermission_AcceptConnectList -{ -public: - void DisplayAcceptConnect() - { - // Create a 'WebPermission' object with permission state set to 'None'. - WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None ); - - // Allow 'Connect' access right to first set of URL's. - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.contoso.com" ); - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.adventure-works.com" ); - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.alpineskihouse.com" ); - - // Allow 'Accept' access right to second set of URL's. - myWebPermission1->AddPermission( NetworkAccess::Accept, "http://www.contoso.com" ); - myWebPermission1->AddPermission( NetworkAccess::Accept, "http://www.adventure-works.com" ); - myWebPermission1->AddPermission( NetworkAccess::Accept, "http://www.alpineskihouse.com" ); - - // Check whether all callers higher in the call stack have been granted the permission or not. - myWebPermission1->Demand(); - Console::WriteLine( "The Attributes, Values and Children of the 'WebPermission' object are :\n" ); - - // Display the Attributes, Values and Children of the XML encoded instance. - PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission1->ToXml()->Children ); - - // - // Gets all URIs with Connect permission. - IEnumerator^ myEnum = myWebPermission1->ConnectList; - Console::WriteLine( "\nThe URIs with Connect permission are :\n" ); - while ( myEnum->MoveNext() ) - { - Console::WriteLine( "\tThe URI is : {0}", myEnum->Current ); - } - // - - // - // Get all URI's with Accept permission. - IEnumerator^ myEnum1 = myWebPermission1->AcceptList; - Console::WriteLine( "\n\nThe URIs with Accept permission are :\n" ); - while ( myEnum1->MoveNext() ) - { - Console::WriteLine( "\tThe URI is : {0}", myEnum1->Current ); - } - // - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) - { - // Get the enumerator that can iterate through Hashtabel. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-Attribute-\t-Value-" ); - while ( myEnumerator->MoveNext() ) - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - - Console::WriteLine(); - IEnumerator^ myEnumerator1 = myList->GetEnumerator(); - Console::WriteLine( "The Children are : \n" ); - while ( myEnumerator1->MoveNext() ) - Console::Write( myEnumerator1->Current ); - } - -}; - -int main() -{ - try - { - WebPermission_AcceptConnectList * myWebPermission_AcceptConnectList = new WebPermission_AcceptConnectList; - myWebPermission_AcceptConnectList->DisplayAcceptConnect(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp deleted file mode 100644 index 7ecf4f0e7a0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// System::Net::WebPermission::WebPermission(NetworkAccess, Regex); - -/* -This program demonstrates the 'WebPermission(NetworkAccess, Regex)' constructor of 'WebPermission' class. -First a 'Regex' Object* is created that will accept all the urls which is having the hostfragment of -'www.contoso.com'.Then a 'WebPermission' Object* created by passing the 'NetworkAccess' permission and -'Regex' Object* as parameters. It checks the 'WebPermission' for all the url's having the host fragment -as 'www.contoso.com'. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Text::RegularExpressions; -using namespace System::Collections; - -class WebPermission_regexConstructor -{ -public: - void CreateRegexConstructor() - { -// - // Create an instance of 'Regex' that accepts all URL's containing the host - // fragment 'www.contoso.com'. - Regex^ myRegex = gcnew Regex( "http://www.contoso.com/.*" ); - - // Create a WebPermission that gives the permissions to all the hosts containing - // the same fragment. - WebPermission^ myWebPermission = gcnew WebPermission( NetworkAccess::Connect,myRegex ); - - // Checks all callers higher in the call stack have been granted the permission. - myWebPermission->Demand(); -// - - Console::WriteLine( "Attribute and Values of WebPermission are : \n" ); - // Display the Attributes, Values and Children of the XML encoded copied instance. - PrintKeysAndValues( myWebPermission->ToXml()->Attributes, myWebPermission->ToXml()->Children ); - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) - { - // Get the enumerator that can iterate through Hashtable. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-ATTRIBUTES-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - - Console::WriteLine(); - - IEnumerator^ myEnumerator1 = myList->GetEnumerator(); - Console::WriteLine( "\nThe Children are : " ); - while ( myEnumerator1->MoveNext() ) - { - Console::Write( "\t {0}", myEnumerator1->Current ); - } - } -}; - -int main() -{ - try - { - WebPermission_regexConstructor * myWebPermissionRegex = new WebPermission_regexConstructor; - myWebPermissionRegex->CreateRegexConstructor(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException raised: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp deleted file mode 100644 index 8b3e407874a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp +++ /dev/null @@ -1,91 +0,0 @@ -// System::Net::WebPermission::WebPermission(PermissionState);System::Net::WebPermission::Copy; - -/** -* This program demonstrates the WebPermission(PermissionState) constructor and -* Copy method of the WebPermission class . -* It creates a WebPermission instance with Permissionstate set to None and -* sets the access right to one pair of URLs. -* Then it uses the Copy method to create another instance of WebPermission class -* Finally, the attributes , values and childrens of both the XML encoded instances -* are displayed. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class CopyWebPermission -{ -public: - void CreateCopy() - { -// - // Create a WebPermission instance. - WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None ); - - // Allow access to the first set of URL's. - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.microsoft.com/default.htm" ); - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.msn.com" ); - - // Check whether all callers higher in the call stack have been granted the permissionor not. - myWebPermission1->Demand(); -// - -// - // Create another WebPermission instance that is the copy of the above WebPermission instance. - WebPermission^ myWebPermission2 = (WebPermission^)(myWebPermission1->Copy()); - - // Check whether all callers higher in the call stack have been granted the permissionor not. - myWebPermission2->Demand(); -// - - Console::WriteLine( "The Attributes and Values are :\n" ); - // Display the Attributes, Values and Children of the XML encoded instance. - PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission1->ToXml()->Children ); - Console::WriteLine( "\nCopied Instance Attributes and Values are:\n" ); - - // Display the Attributes, Values and Children of the XML encoded copied instance. - PrintKeysAndValues( myWebPermission2->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) - { - // Gets the enumerator that can iterate through Hashtable. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - - IEnumerator^ myEnumerator1 = myList->GetEnumerator(); - Console::WriteLine( "The Children are: " ); - while ( myEnumerator1->MoveNext() ) - { - Console::Write( "\t {0}", myEnumerator1->Current ); - } - } -}; - -int main() -{ - try - { - CopyWebPermission^ myCopyWebPermission = gcnew CopyWebPermission; - myCopyWebPermission->CreateCopy(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp deleted file mode 100644 index ea42dec4dbc..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// System::Net::WebPermission::ToXml;System::Net::WebPermission::FromXml; - -/** -* This program shows the use of the ToXml and FromXml methods of the WebPermission class. -* It creates a WebPermission instance with the Permissionstate set to None and -* displays the attributes and the values of the XML encoded instance . -* Then a SecurityElement instance is created and it's attributes are -* set. -* Finally, using the FromXml method the WebPermission instance is reconstructed from -* the above SecurityElement instance and the attributes are displayed. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; -public ref class WebPermission_FromToXml -{ -public: - void CallXml() - { -// - // Create a WebPermission without permission on the protected resource - WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None ); - - // Create a SecurityElement by calling the ToXml method on the WebPermission - // instance and display its attributes (which hold the XML encoding of - // the WebPermission). - Console::WriteLine( "Attributes and Values of the WebPermission are:" ); - myWebPermission1->ToXml(); - - // Create another WebPermission with no permission on the protected resource - WebPermission^ myWebPermission2 = gcnew WebPermission( PermissionState::None ); - - //Converts the new WebPermission from XML using myWebPermission1. - myWebPermission2->FromXml( myWebPermission1->ToXml() ); -// - - Console::WriteLine( "The Attributes and Values of 'WebPermission' instance after reconstruction are: \n" ); - // Display the Attributes and values of the XML encoded instances. - PrintKeysAndValues( myWebPermission2->ToXml()->Attributes ); - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable ) - { - // Get the enumerator to iterate through Hashtable. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } -}; - -int main() -{ - try - { - WebPermission_FromToXml^ myWebPermission_FromToXml = gcnew WebPermission_FromToXml; - myWebPermission_FromToXml->CallXml(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp deleted file mode 100644 index 692f71b9fea..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// System::Net::WebPermission::WebPermission(); -// System::Net::WebPermission->AddPermission(NetworkAccess, stringuri); -// System::Net::WebPermission::Intersect; - -/** -* This program shows the use of the WebPermission() constructor, the AddPermission, -* and Intersect' methods of the WebPermission' class. -* It first creates two WebPermission objects with no arguments, with each of them -* setting the access rights to one pair of URLs. -* Then it displays the attributes , values and childrens of the XML encoded instances. -* Finally, it creates a third WebPermission Object* using the logical intersection of the -* first two objects. It does so by using the Intersect method. -* It then displays the attributes , values and childrens of the related XML encoded -* instances. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -class WebPermissionIntersect -{ -public: - void CreateIntersect() - { -// - // Create two WebPermission instances. - WebPermission^ myWebPermission1 = gcnew WebPermission; - WebPermission^ myWebPermission2 = gcnew WebPermission; - -// - // Allow access to the first set of resources. - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.contoso.com/default.htm" ); - myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.adventure-works.com/default.htm" ); - - // Check whether if the callers higher in the call stack have been granted - // access permissions. - myWebPermission1->Demand(); -// - - // Allow access right to the second set of resources. - myWebPermission2->AddPermission( NetworkAccess::Connect, "http://www.alpineskihouse.com/default.htm" ); - myWebPermission2->AddPermission( NetworkAccess::Connect, "http://www.baldwinmuseumofscience.com/default.htm" ); - myWebPermission2->Demand(); - -// - // Display the attributes , values and childrens of the XML encoded instances. - Console::WriteLine( "Attributes and values of first 'WebPermission' instance are :" ); - PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); - - Console::WriteLine( "\nAttributes and values of second 'WebPermission' instance are : " ); - PrintKeysAndValues( myWebPermission2->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); - -// - // Create a third WebPermission instance via the logical intersection of the previous - // two WebPermission instances. - WebPermission^ myWebPermission3 = (WebPermission^)(myWebPermission1->Intersect( myWebPermission2 )); - - Console::WriteLine( "\nAttributes and Values of the WebPermission instance after the Intersect are:\n" ); - Console::WriteLine( myWebPermission3->ToXml() ); -// - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) - { - // Get the enumerator that can iterate through Hashtable. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - - IEnumerator^ myEnumerator1 = myList->GetEnumerator(); - Console::WriteLine( "The Children are : " ); - while ( myEnumerator1->MoveNext() ) - { - Console::Write( "\t {0}", myEnumerator1->Current ); - } - } -}; - -int main() -{ - try - { - WebPermissionIntersect * myWebPermissionIntersect = new WebPermissionIntersect; - myWebPermissionIntersect->CreateIntersect(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp deleted file mode 100644 index aa616240be8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// System::Net::WebPermission->AddPermission(NetworkAccess, regex); -// System::Net::WebPermission::IsSubsetOf; - -/** -* This program shows how to use the AddPermission(NetworkAccess, regex) and -* IsSubset methods of WebPermission class. -* It creates two WebPermission instances with the Connect access rights for the -* specified URIs. -* For he first WebPermission instance, a Connect access right is given to the -* URLs with the host fragment www.microsoft.com. This is done by using -* the AddPermission(NetworkAccess, regex) method. -* Then, a third WebPermission instance is created with the Connect access right to -* the URLs of the first and second WebPermission instances. -* Finally, the attributes, values and children of that instance are displayed. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; -using namespace System::Text::RegularExpressions; - -class WebPermissionIsSubset -{ -public: - void CheckSubset() - { -// - // Create a WebPermission. - WebPermission^ myWebPermission1 = gcnew WebPermission; - - // Allow Connect access to the specified URLs. - myWebPermission1->AddPermission( NetworkAccess::Connect, gcnew Regex( "http://www\\.contoso\\.com/.*", - (RegexOptions)(RegexOptions::Compiled | RegexOptions::IgnoreCase | RegexOptions::Singleline) ) ); - - myWebPermission1->Demand(); -// - - // Create another WebPermission with the specified URL. - WebPermission^ myWebPermission2 = gcnew WebPermission( NetworkAccess::Connect,"http://www.contoso.com" ); - // Check whether all callers higher in the call stack have been granted the permission. - myWebPermission2->Demand(); - -// - WebPermission^ myWebPermission3 = nullptr; - - // Check which permissions have the Connect access to more number of URLs. - if ( myWebPermission2->IsSubsetOf( myWebPermission1 ) ) - { - Console::WriteLine( "\n WebPermission2 is the Subset of WebPermission1\n" ); - myWebPermission3 = myWebPermission1; - } - else if ( myWebPermission1->IsSubsetOf( myWebPermission2 ) ) - { - Console::WriteLine( "\n WebPermission1 is the Subset of WebPermission2" ); - myWebPermission3 = myWebPermission2; - } - else - { - // Create the third permission. - myWebPermission3 = (WebPermission^)(myWebPermission1->Union( myWebPermission2 )); - } -// - - // Prints the attributes, values and children of XML encoded instances. - Console::WriteLine( "\nAttributes and Values of third WebPermission instance are : " ); - PrintKeysAndValues( myWebPermission3->ToXml()->Attributes, myWebPermission3->ToXml()->Children ); - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) - { - // Get the enumerator that can iterate through Hashtable. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - - IEnumerator^ myEnumerator1 = myList->GetEnumerator(); - Console::WriteLine( "The Children are : " ); - while ( myEnumerator1->MoveNext() ) - { - Console::Write( "\t {0}", myEnumerator1->Current ); - } - } -}; - -int main() -{ - try - { - WebPermissionIsSubset * myWebPermissionIsSubset = new WebPermissionIsSubset; - myWebPermissionIsSubset->CheckSubset(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp deleted file mode 100644 index 5f132c99a7c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// System::Net::WebPermission->AddPermission(NetworkAccess, regex);System::Net::WebPermission::IsSubsetOf; - -/** -* This program shows the use of the AddPermission(NetworkAccess, regex) and -* IsSubset methods of the WebPermission class. -* It creates two WebPermission instances with the Connect access rights for the specified -* URIs. The second URI being a subset of the first one. -* Then the IsSubsetOf method is called to verify that the second URI is indeed a subset -* of the firts one. The result of the call to the IsSubsetOf is then displayed. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; -using namespace System::Text::RegularExpressions; - -static void myIsSubsetExample() -{ -// - // Create the target permission. - WebPermission^ targetPermission = gcnew WebPermission; - targetPermission->AddPermission( NetworkAccess::Connect, gcnew Regex( "www\\.contoso\\.com/Public/.*" ) ); - - // Create the permission for a URI matching target. - WebPermission^ connectPermission = gcnew WebPermission; - connectPermission->AddPermission( NetworkAccess::Connect, "www.contoso.com/Public/default.htm" ); - - //The following statement prints true. - Console::WriteLine( "Is the second URI a subset of the first one?: {0}", connectPermission->IsSubsetOf( targetPermission ) ); -// -} - -int main() -{ - // Verify that the second URI is a subset of the first one. - myIsSubsetExample(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp deleted file mode 100644 index ccc6b055614..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Text::RegularExpressions; -using namespace System::Collections; - -void MySample() -{ -// - // Create a Regex that accepts all URLs containing the host fragment www.contoso.com. - Regex^ myRegex = gcnew Regex( "http://www\\.contoso\\.com/.*" ); - - // Create a WebPermission that gives permissions to all the hosts containing the same host fragment. - WebPermission^ myWebPermission = gcnew WebPermission( NetworkAccess::Connect,myRegex ); - - //Add connect privileges for a www.adventure-works.com. - myWebPermission->AddPermission( NetworkAccess::Connect, "http://www.adventure-works.com" ); - - //Add accept privileges for www.alpineskihouse.com. - myWebPermission->AddPermission( NetworkAccess::Accept, "http://www.alpineskihouse.com/" ); - - // Check whether all callers higher in the call stack have been granted the permission. - myWebPermission->Demand(); - - // Get all the URIs with Connect permission. - IEnumerator^ myConnectEnum = myWebPermission->ConnectList; - Console::WriteLine( "\nThe 'URIs' with 'Connect' permission are :\n" ); - while ( myConnectEnum->MoveNext() ) - { - Console::WriteLine( "\t{0}", myConnectEnum->Current ); - } - - // Get all the URIs with Accept permission. - IEnumerator^ myAcceptEnum = myWebPermission->AcceptList; - Console::WriteLine( "\n\nThe 'URIs' with 'Accept' permission is :\n" ); - - while ( myAcceptEnum->MoveNext() ) - { - Console::WriteLine( "\t{0}", myAcceptEnum->Current ); - } -// -} - -int main() -{ - MySample(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp deleted file mode 100644 index 9610688f608..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// System::Net::WebPermission::WebPermission(NetworkAccess, uriString);System::Net::WebPermission::Union; - -/** -* This program shows the use of the WebPermission(NetworkAccess access, String* uriString) -* constructor and Union method of the WebPermission' class. -* It creates two instance of the WebPermission class with the specified access -* rights to the predefined URIs. -* It displays the attributes , values and childrens of those XML encoded -* instances. -* Then, using the Union method, it creates a third WebPermission instance -* via a logical union of the first two. -* Finally, it displays the attributes , values and childrens of those XML encoded -* instances. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class WebPermissionUnion -{ -public: - void CreateUnion() - { -// - // Create a WebPermission::instance. - WebPermission^ myWebPermission1 = gcnew WebPermission( NetworkAccess::Connect,"http://www.contoso.com/default.htm" ); - myWebPermission1->Demand(); -// - - // Create another WebPermission instance. - WebPermission^ myWebPermission2 = gcnew WebPermission( NetworkAccess::Connect,"http://www.adventure-works.com" ); - myWebPermission2->Demand(); - - // Print the attributes, values and childrens of the XML encoded instances. - Console::WriteLine( "Attributes and values of the first WebPermission are : " ); - PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission1->ToXml()->Children ); - - Console::WriteLine( "\nAttributes and values of the second WebPermission are : " ); - PrintKeysAndValues( myWebPermission2->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); - -// - // Create another WebPermission that is the Union of previous two WebPermission - // instances. - WebPermission^ myWebPermission3 = (WebPermission^)(myWebPermission1->Union( myWebPermission2 )); - Console::WriteLine( "\nAttributes and values of the WebPermission after the Union are : " ); - // Display the attributes, values and children. - Console::WriteLine( myWebPermission3->ToXml() ); -// - } - -private: - void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) - { - // Get the enumerator that can iterate through Hashtable. - IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - - Console::WriteLine(); - IEnumerator^ myEnumerator1 = myList->GetEnumerator(); - Console::WriteLine( "The Children are : " ); - while ( myEnumerator1->MoveNext() ) - { - Console::Write( "\t {0}", myEnumerator1->Current ); - } - } -}; - -int main() -{ - try - { - WebPermissionUnion^ myWebPermissionUnion = gcnew WebPermissionUnion; - myWebPermissionUnion->CreateUnion(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException: {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp deleted file mode 100644 index c6e380e0a44..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp +++ /dev/null @@ -1,92 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; -using namespace System::Threading; -public ref class RequestState -{ -public: - - // This class stores the request state of the request. - WebRequest^ request; - RequestState() - { - request = nullptr; - } - -}; - -ref class WebRequest_BeginGetRequeststream -{ -public: - static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); - static void ReadCallback( IAsyncResult^ asynchronousResult ) - { - RequestState^ myRequestState = dynamic_cast(asynchronousResult->AsyncState); - WebRequest^ myWebRequest = myRequestState->request; - - // End of the Asynchronus request. - Stream^ streamResponse = myWebRequest->EndGetRequestStream( asynchronousResult ); - - // Create a string that is to be posted to the uri. - Console::WriteLine( "Please enter a string to be posted:" ); - String^ postData = Console::ReadLine(); - - // Convert the string into a Byte array. - array^byteArray = Encoding::UTF8->GetBytes( postData ); - - // Write data to the stream. - streamResponse->Write( byteArray, 0, postData->Length ); - streamResponse->Close(); - allDone->Set(); - } - -}; - -int main() -{ - - // - // Create a new request to the mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - - // Create an instance of the RequestState and assign 'myWebRequest' to its request field. - RequestState^ myRequestState = gcnew RequestState; - myRequestState->request = myWebRequest; - myWebRequest->ContentType = "application/x-www-form-urlencoded"; - - // Set the 'Method' prperty to 'POST' to post data to a Uri. - myRequestState->request->Method = "POST"; - - // - // Start the Asynchronous 'BeginGetRequestStream' method call. - IAsyncResult^ r = dynamic_cast(myWebRequest->BeginGetRequestStream( gcnew AsyncCallback( WebRequest_BeginGetRequeststream::ReadCallback ), myRequestState )); - WebRequest_BeginGetRequeststream::allDone->WaitOne(); - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - Console::WriteLine( "The String* entered has been posted." ); - Console::WriteLine( "Please wait for the response..." ); - Stream^ streamResponse = myWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "The contents of the HTML page are " ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse Resource. - myWebResponse->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp deleted file mode 100644 index ecac7b2e7b4..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/* System::Net::WebRequest::ContentType System::Net::WebRequest::ContentLength System::Net::WebRequest::GetRequestStream -This program demonstrates the 'GetRequestStream' method and the 'ContentLength' and 'ContentType' properties of - the 'WebRequest' class. -A new 'WebRequest' Object* is created and the method used for sending data is set to 'POST' method by setting -The 'Method' property to 'POST'. The 'ContentType' property is set to 'application/x-www-form-urlencoded'. -The 'ContentLength' property is set to the length of the Byte stream to be posted. A new 'Stream' Object* is -obtained from the 'GetRequestStream' method of the 'WebRequest' class. Data to be posted is requested from -the user and is posted using the stream Object*. The HTML contents of the page are then displayed to the -console after the Posted data is accepted by the URL. - -Note: This program POSTs data to the Uri: http://www20.Brinkster::com/codesnippets/next.asp -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// -// -// - // Create a new request to the mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com " ); - - // Set the 'Method' property of the myWebrequest to POST. - myWebRequest->Method = "POST"; - - // Create a new string object to POST data to the above url. - Console::WriteLine( "\nThe value of 'ContentLength' property before sending the data is {0}", myWebRequest->ContentLength ); - Console::WriteLine( "\nPlease enter the data to be posted to (http://www.contoso.com/codesnippets/next.asp) Uri" ); - String^ inputData = Console::ReadLine(); - String^ postData = String::Concat( "firstone= ", inputData ); - ASCIIEncoding^ encoding = gcnew ASCIIEncoding; - array^ byteArray = encoding->GetBytes( postData ); - -// - // Set the 'ContentType' property of the WebRequest. - myWebRequest->ContentType = "application/x-www-form-urlencoded"; - - // Set the 'ContentLength' property of the WebRequest. - myWebRequest->ContentLength = byteArray->Length; - Stream^ newStream = myWebRequest->GetRequestStream(); - newStream->Write( byteArray, 0, byteArray->Length ); - - // Close the Stream object. - newStream->Close(); - - // Assign the response object of 'WebRequest' to a 'WebResponse' variable. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); -// -// -// -// - - Console::WriteLine( "\nThe value of ContentLength property after sending the data is {0}", myWebRequest->ContentLength ); - Console::WriteLine( "\nThe String* entered has been successfully posted to the Uri." ); - Console::WriteLine( "\nPlease wait for the response......." ); - Stream^ streamResponse = myWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the Html page are : \n" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::WriteLine( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamRead->Close(); - streamResponse->Close(); - - // Release the resources of response Object*. - myWebResponse->Close(); - Console::WriteLine( "\nPress 'Enter' Key to Continue........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "WebException raised!" ); - Console::WriteLine( "\n {0}", e->Message ); - Console::WriteLine( "\n {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp deleted file mode 100644 index ff1aa9ebfe6..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp +++ /dev/null @@ -1,60 +0,0 @@ -/*System::Net::WebRequest::Create(Uri) - -This program demonstrates the 'Create(Uri)' method of the 'WebRequest' class. -A new 'Uri' object is created to the specified Uri. -A new 'WebRequest' object is created to the 'specified' Uri by passing the 'Uri' object as parameter. -The response is obtained . -The HTML contents of the page of the requested Uri are displayed to the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new 'Uri' object with the specified string. - Uri^ myUri = gcnew Uri( "http://www.contoso.com" ); - // Create a new request to the above mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( myUri ); - // Assign the response object of 'WebRequest' to a 'WebResponse' variable. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); -// - - Stream^ streamResponse = myWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of HTML Page are : \n" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the WebResponse Resource. - myWebResponse->Close(); - Console::WriteLine( "\nPress 'Enter' key to continue................." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Caught!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException Caught!" ); - Console::WriteLine( "Source : {0} ", e->Source ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp deleted file mode 100644 index b4c440162f7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/*System::Net::WebRequest::Headers -* This program demonstrates the 'Headers' property of 'WebRequest' Class. -A new 'WebRequest' Object* is created. The (name, value) collection of the HTTP Headers are displayed to the -console. The contents of the HTML page of the requested URI are displayed to the console. */ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new request to the mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - - // Assign the response object of 'WebRequest' to a 'WebResponse' variable. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Release the resources of response object. - myWebResponse->Close(); - Console::WriteLine( "\nThe HttpHeaders are \n {0}", myWebRequest->Headers ); -// - - Console::WriteLine( "\nPress Enter Key to Continue........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "\n {0}", e->Message ); - Console::WriteLine( "\n {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception raised!" ); - Console::WriteLine( "Source : {0} ", e->Source ); - Console::WriteLine( "Message : {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp deleted file mode 100644 index 6781c2fe114..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/*System::Net::WebRequest::Proxy -This program demonstrates the 'Proxy' property of the 'WebRequest' class. -A WebRequest Object* is created and a new Proxy Object is created. -The Proxy Object is assigned the 'Proxy' Property of the WebRequest Object and then printed to the console, this is the default Proxy setting. -New Proxy address and the credentials are requested from the User. -A new Proxy Object* is then constructed from the inputs. -Then the 'Proxy' property of the request is associated with the new Proxy Object* constructed*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new request to the mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - - WebProxy^ myProxy = gcnew WebProxy; - // Obtain the Proxy Prperty of the Default browser. - myProxy = (WebProxy^)(myWebRequest->Proxy); - - // Print myProxy address to the console. - Console::WriteLine( "\nThe actual default Proxy settings are {0}", myProxy->Address ); - try - { - Console::WriteLine( "\nPlease enter the new Proxy Address to be set " ); - Console::WriteLine( "The format of the address should be http://proxyUriAddress:portaddress" ); - Console::WriteLine( "Example:http://proxyadress.com:8080" ); - String^ proxyAddress; - proxyAddress = Console::ReadLine(); - - if ( proxyAddress->Length == 0 ) - { - myWebRequest->Proxy = myProxy; - } - else - { - Console::WriteLine( "\nPlease enter the Credentials" ); - Console::WriteLine( "Username:" ); - String^ username; - username = Console::ReadLine(); - Console::WriteLine( "\nPassword:" ); - String^ password; - password = Console::ReadLine(); - - // Create a new Uri object. - Uri^ newUri = gcnew Uri( proxyAddress ); - - // Associate the new Uri object to the myProxy object. - myProxy->Address = newUri; - - // Create a NetworkCredential object and is assign to the Credentials - // property of the Proxy object. - myProxy->Credentials = gcnew NetworkCredential( username,password ); - myWebRequest->Proxy = myProxy; - } - Console::WriteLine( "\nThe Address of the new Proxy settings are {0}", myProxy->Address ); - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Print the HTML contents of the page to the console. - Stream^ streamResponse = myWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the Html pages are :" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - - // Close the Stream object. - streamResponse->Close(); - streamRead->Close(); - - // Release the HttpWebResponse Resource. - myWebResponse->Close(); - Console::WriteLine( "\nPress any key to continue........." ); - Console::Read(); - } - catch ( UriFormatException^ e ) - { - Console::WriteLine( "\nUriFormatException is thrown->Message is {0}", e->Message ); - Console::WriteLine( "\nThe format of the myProxy address you entered is invalid" ); - Console::WriteLine( "\nPress any key to continue........." ); - Console::Read(); - } -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException is raised. " ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - Console::WriteLine( "\nStatus: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException is raised. " ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp deleted file mode 100644 index f763b367eb0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/*System::Net::WebRequest::RequestUri -* This program demonstrates the 'RequestUri' property of the 'WebRequest' Class -Here the 'RequestUri' property displays the request Uri name to the console. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new WebRequest object to the mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - Console::WriteLine( "\nThe Uri requested is {0}", myWebRequest->RequestUri); - // Assign the response object of 'WebRequest' to a 'WebResponse' variable. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - // Get the stream containing content returned by the server. - Stream^ streamResponse = myWebResponse->GetResponseStream(); - Console::WriteLine("\nThe Uri that responded to the request is '{0}'",myWebResponse->ResponseUri); - StreamReader^ reader = gcnew StreamReader(streamResponse); - // Read the content. - String^ responseFromServer = reader->ReadToEnd(); - // Display the content. - Console::WriteLine("\nThe HTML Contents received:"); - Console::WriteLine (responseFromServer); - // Cleanup the streams and the response. - reader->Close(); - streamResponse->Close(); - myWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine("\nWebException is raised. "); - Console::WriteLine("\nThe Error Message is {0} ", e->Message); - Console::WriteLine("\nStatus: {0}", e->Status); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException is raised " ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp deleted file mode 100644 index 2c097ce1e40..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/*System::Net::WebRequest::Time->Item[Out] ** This program demonstrates the 'Timeout' property of the WebRequest Class. -A new 'WebRequest' Object* is created. The default value of the 'Timeout' property is printed to the console. -It is then set to a value and displayed to the console. If the 'Timeout' property is set to a value less than -the time required to get the response an Exception is raised. The 'Timeout' property measures the time in -milliseconds. -*/ - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Net; -using namespace System::Text; - -int main() -{ - try - { -// - // Create a new WebRequest Object to the mentioned URL. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - Console::WriteLine( "\nThe Timeout time of the request before setting is : {0} milliseconds", myWebRequest->Timeout ); - - // Set the 'Timeout' property in Milliseconds. - myWebRequest->Timeout = 10000; - - // This request will throw a WebException if it reaches the timeout limit - // before it is able to fetch the resource. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); -// - - // Print the Timeout time to the console. - Console::WriteLine( "\nThe Time->Item[Out] time* of the request after setting the time is : {0} milliseconds", myWebRequest->Timeout ); - Console::WriteLine( "\nPress any Key to Continue..........." ); - Console::Read(); - // Print the HTML contents of the page to the console. - Stream^ streamResponse = myWebResponse->GetResponseStream(); - StreamReader^ streamRead = gcnew StreamReader( streamResponse ); - array^ readBuff = gcnew array(256); - int count = streamRead->Read( readBuff, 0, 256 ); - Console::WriteLine( "\nThe contents of the Html page of the requested Url are :" ); - while ( count > 0 ) - { - String^ outputData = gcnew String( readBuff,0,count ); - Console::Write( outputData ); - count = streamRead->Read( readBuff, 0, 256 ); - } - streamResponse->Close(); - streamRead->Close(); - // Release the HttpWebResponse Resource. - myWebResponse->Close(); - Console::WriteLine( "\nPress any Key to Continue..........." ); - Console::Read(); - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException is raised " ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - Console::WriteLine( "\nStatus: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nException is raised " ); - Console::WriteLine( "\nMessage: {0} ", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp deleted file mode 100644 index 5c7f5fadec3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// System::Net::WebResponse::Close -/*This program demonstrates the 'Close' method of 'WebResponse' Class. -It takes an URL from console and creates a 'WebRequest' Object* for the Url::It then gets back -the response Object* from the Url. The response Object* can be processed as desired. -The program then closes the response Object* and releases resources associated with it. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ - try - { -// - // Create a 'WebRequest' object with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - // Send the 'WebRequest' and wait for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Process the response here. - Console::WriteLine( "\nResponse Received::Trying to Close the response stream.." ); - // Release resources of response Object*. - myWebResponse->Close(); - Console::WriteLine( "\nResponse Stream successfully closed" ); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\r\nWebException Raised::Status is: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease type the Url as command line parameter" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "WebResponse_Close http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp deleted file mode 100644 index 3a0d57ce817..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp +++ /dev/null @@ -1,59 +0,0 @@ -// System::Net::WebResponse::ContentLength;System::Net::WebResponse::ContentType - -/* This program demonstrates the 'ContentLength' and 'ContentType' property of 'WebResponse' class -It creates a web request and queries for a response. It then prints the content length and content type -of the entity body in the response onto the console */ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ - try - { -// -// - // Create a 'WebRequest' with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - - // Send the 'WebRequest' and wait for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Display the content length and content type received as headers in the response object. - Console::WriteLine( "\nContent length : {0}, Content Type : {1}", myWebResponse->ContentLength, myWebResponse->ContentType ); - - // Release resources of response object. - myWebResponse->Close(); -// -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException raised. Status is: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the Url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "WebResponse_ContentLength_Type http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp deleted file mode 100644 index 5c96bd1c1dd..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// System::Net::WebResponse::GetResponseStream - -/* This program demonstrates the 'GetResponseStream' method of the 'WebResponse' class. -It creates a web request and queries for a response. It then gets the response stream. This response stream -is piped to a higher level stream reader. The reader reads 256 characters at a time, writes them into a String* and then displays the String* in the console. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void getPage( String^ url ) -{ - try - { -// - // Create a 'WebRequest' object with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - - // Send the 'WebRequest' and wait for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Obtain a 'Stream' object associated with the response object. - Stream^ ReceiveStream = myWebResponse->GetResponseStream(); - - Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); - - // Pipe the stream to a higher level stream reader with the required encoding format. - StreamReader^ readStream = gcnew StreamReader( ReceiveStream,encode ); - Console::WriteLine( "\nResponse stream received" ); - array^ read = gcnew array(256); - - // Read 256 charcters at a time. - int count = readStream->Read( read, 0, 256 ); - Console::WriteLine( "HTML...\r\n" ); - - while ( count > 0 ) - { - // Dump the 256 characters on a string and display the string onto the console. - String^ str = gcnew String( read,0,count ); - Console::Write( str ); - count = readStream->Read( read, 0, 256 ); - } - - Console::WriteLine( "" ); - // Release the resources of stream object. - readStream->Close(); - - // Release the resources of response object. - myWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Raised::Status is: {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease enter the Url as command line parameter:" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "WebResponse_GetResponseStream http://www.microsoft.com/net/" ); - } - else - { - getPage( args[ 1 ] ); - } - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp deleted file mode 100644 index 5ae94b10d17..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp +++ /dev/null @@ -1,64 +0,0 @@ - - -// System::Net::WebResponse::Headers -/* This program demonstrates the 'Headers' property of the 'WebResponse' class. -It creates a web request and queries for a response. It then prints out all the response -headers (name -value pairs) onto the console */ -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ - try - { - // - // Create a 'WebRequest' object with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); - - // Send the 'WebRequest' and wait for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Display all the Headers present in the response received from the URl. - Console::WriteLine( "\nThe following headers were received in the response" ); - - // Display each header and its key , associated with the response object. - for ( int i = 0; i < myWebResponse->Headers->Count; ++i ) - Console::WriteLine( "\nHeader Name: {0}, Header value : {1}", myWebResponse->Headers->Keys[ i ], myWebResponse->Headers[ i ] ); - - // Release resources of response object. - myWebResponse->Close(); - - // - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException Raised::Status is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised.Message is : {0}", e->Message ); - } - -} - -int main() -{ - array^args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease type the Url as command line parameter" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "WebResponse_Headers http://www.microsoft.com/net/" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp deleted file mode 100644 index e54b2a6b212..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// System::Net::WebResponse::ResponseUri - -/* This program demonstrates the 'ResponseUri' property of the 'WebResponse' class -It creates a web request and queries for a response. It then compares the ResponseUri value to the actual Url -value to see if the original request was redirected*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::IO; -using namespace System::Text; - -void GetPage( String^ url ) -{ - try - { -// - Uri^ ourUri = gcnew Uri( url ); - - // Create a 'WebRequest' object with the specified url. - WebRequest^ myWebRequest = WebRequest::Create( url ); - - // Send the 'WebRequest' and wait for response. - WebResponse^ myWebResponse = myWebRequest->GetResponse(); - - // Use "ResponseUri" property to get the actual Uri from where the response was attained. - if ( ourUri->Equals( myWebResponse->ResponseUri ) ) - { - Console::WriteLine( "\nRequest Url : {0} was not redirected", url ); - } - else - { - Console::WriteLine( "\nRequest Url : {0} was redirected to {1}", url, myWebResponse->ResponseUri ); - } - - // Release resources of response object. - myWebResponse->Close(); -// - } - catch ( WebException^ e ) - { - Console::WriteLine( "\nWebException is raised->Status is : {0}", e->Status ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); - } -} - -int main() -{ - array^ args = Environment::GetCommandLineArgs(); - if ( args->Length < 2 ) - { - Console::WriteLine( "\nPlease type the Url as command line parameter" ); - Console::WriteLine( "Example:" ); - Console::WriteLine( "WebResponse_ResponseUri http://www.microsoft.com" ); - } - else - { - GetPage( args[ 1 ] ); - } - - Console::WriteLine( "Press any key to continue..." ); - Console::ReadLine(); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp b/snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp deleted file mode 100644 index 624ea9b6f2e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp +++ /dev/null @@ -1,63 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::CodeDom; -using namespace System::CodeDom::Compiler; - -int main() -{ - // Get a WSDL file describing a service. - ServiceDescription^ description = ServiceDescription::Read( "service.wsdl" ); - - // - // Initialize a service description importer. - ServiceDescriptionImporter^ importer = gcnew ServiceDescriptionImporter; - importer->ProtocolName = "Soap12"; // Use SOAP 1.2. - importer->AddServiceDescription( description, nullptr, nullptr ); - // - - // - // Report on the service descriptions. - Console::WriteLine( "Importing {0} service descriptions with {1} associated schemas.", importer->ServiceDescriptions->Count, importer->Schemas->Count ); - // - - // - // Generate a proxy client. - importer->Style = ServiceDescriptionImportStyle::Client; - // - - // - // Generate properties to represent primitive values. - importer->CodeGenerationOptions = System::Xml::Serialization::CodeGenerationOptions::GenerateProperties; - // - - // Initialize a Code-DOM tree into which we will import the service. - CodeNamespace^ nmspace = gcnew CodeNamespace; - CodeCompileUnit^ unit = gcnew CodeCompileUnit; - unit->Namespaces->Add( nmspace ); - - // - // Import the service into the Code-DOM tree. This creates proxy code - // that uses the service. - ServiceDescriptionImportWarnings warning = importer->Import(nmspace,unit); - if ( warning == (ServiceDescriptionImportWarnings)0 ) - { - // Generate and print the proxy code in C#. - CodeDomProvider^ provider = CodeDomProvider::CreateProvider( "CSharp" ); - ICodeGenerator^ generator = provider->CreateGenerator(); - generator->GenerateCodeFromCompileUnit( unit, Console::Out, gcnew CodeGeneratorOptions ); - } - else - { - // Print an error message. - Console::WriteLine( warning ); - } - // -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp deleted file mode 100644 index 311e3586e48..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp +++ /dev/null @@ -1,151 +0,0 @@ - - -//System.Web.Services.HttpBinding;System.Web.Services.HttpBinding.Verb; -//System.Web.Services.HttpAddressBinding; -//System.Web.Services.HttpAddressBinding.Location; -/* - The following example demonstrates the 'HttpBinding()' constructor - and 'Verb' property of class 'HttpBinding' and 'HttpAddressBinding() - 'constructor and 'Location' property of class 'HttpAddressBinding'. - It creates a 'ServiceDescription' instance by using the - static read method of 'ServiceDescription' by passing the - 'AddNumbers1.wsdl' name as an argument. It creates a 'Binding' - object and adds that binding object to 'ServiceDescription'. - It adds the 'PortType',Messages to the 'ServiceDescription' object. - Finally it writes the 'ServiceDescrption' as a WSDL file with name - 'AddNumbers.wsdl. - */ -#using -#using -#using - -using namespace System; -using namespace System::Web::Services::Description; -using namespace System::Collections; -using namespace System::Xml; - -int main() -{ - ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbers1.wsdl" ); - - // Create the 'Binding' object. - Binding^ myBinding = gcnew Binding; - myBinding->Name = "Service1HttpPost"; - XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1HttpPost" ); - myBinding->Type = qualifiedName; - - // - // - // Create the 'HttpBinding' object. - HttpBinding^ myHttpBinding = gcnew HttpBinding; - myHttpBinding->Verb = "POST"; - - // Add the 'HttpBinding' to the 'Binding'. - myBinding->Extensions->Add( myHttpBinding ); - // - // - - // Create the 'OperationBinding' object. - OperationBinding^ myOperationBinding = gcnew OperationBinding; - myOperationBinding->Name = "AddNumbers"; - HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; - myOperation->Location = "/AddNumbers"; - - // Add the 'HttpOperationBinding' to 'OperationBinding'. - myOperationBinding->Extensions->Add( myOperation ); - - // Create the 'InputBinding' object. - InputBinding^ myInput = gcnew InputBinding; - MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; - postMimeContentbinding->Type = "application/x-www-form-urlencoded"; - myInput->Extensions->Add( postMimeContentbinding ); - - // Add the 'InputBinding' to 'OperationBinding'. - myOperationBinding->Input = myInput; - - // Create the 'OutputBinding' object. - OutputBinding^ myOutput = gcnew OutputBinding; - MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; - postMimeXmlbinding->Part = "Body"; - myOutput->Extensions->Add( postMimeXmlbinding ); - - // Add the 'OutPutBinding' to 'OperationBinding'. - myOperationBinding->Output = myOutput; - - // Add the 'OperationBinding' to 'Binding'. - myBinding->Operations->Add( myOperationBinding ); - - // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. - myDescription->Bindings->Add( myBinding ); - - // Create a 'Port' object. - Port^ postPort = gcnew Port; - postPort->Name = "Service1HttpPost"; - postPort->Binding = gcnew XmlQualifiedName( "s0:Service1HttpPost" ); - - // - // - // Create the 'HttpAddressBinding' object. - HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; - postAddressBinding->Location = "http://localhost/Service1.asmx"; - - // Add the 'HttpAddressBinding' to the 'Port'. - postPort->Extensions->Add( postAddressBinding ); - // - // - - // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. - myDescription->Services[ 0 ]->Ports->Add( postPort ); - - // Create a 'PortType' object. - PortType^ postPortType = gcnew PortType; - postPortType->Name = "Service1HttpPost"; - Operation^ postOperation = gcnew Operation; - postOperation->Name = "AddNumbers"; - OperationMessage^ postInput = dynamic_cast(gcnew OperationInput); - postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); - OperationMessage^ postOutput = dynamic_cast(gcnew OperationOutput); - postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); - postOperation->Messages->Add( postInput ); - postOperation->Messages->Add( postOutput ); - - // Add the 'Operation' to 'PortType'. - postPortType->Operations->Add( postOperation ); - - // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. - myDescription->PortTypes->Add( postPortType ); - - // Create the 'Message' object. - Message^ postMessage1 = gcnew Message; - postMessage1->Name = "AddNumbersHttpPostIn"; - - // Create the 'MessageParts'. - MessagePart^ postMessagePart1 = gcnew MessagePart; - postMessagePart1->Name = "firstnumber"; - postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); - MessagePart^ postMessagePart2 = gcnew MessagePart; - postMessagePart2->Name = "secondnumber"; - postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); - - // Add the 'MessagePart' objects to 'Messages'. - postMessage1->Parts->Add( postMessagePart1 ); - postMessage1->Parts->Add( postMessagePart2 ); - - // Create another 'Message' object. - Message^ postMessage2 = gcnew Message; - postMessage2->Name = "AddNumbersHttpPostOut"; - MessagePart^ postMessagePart3 = gcnew MessagePart; - postMessagePart3->Name = "Body"; - postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); - - // Add the 'MessagePart' to 'Message' - postMessage2->Parts->Add( postMessagePart3 ); - - // Add the 'Message' objects to 'ServiceDescription'. - myDescription->Messages->Add( postMessage1 ); - myDescription->Messages->Add( postMessage2 ); - - // Write the 'ServiceDescription' as a WSDL file. - myDescription->Write( "AddNumbers.wsdl" ); - Console::WriteLine( "WSDL file with name 'AddNumber.Wsdl' file created Successfully" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp b/snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp deleted file mode 100644 index e970f196609..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -// System.Runtime.Remoting.WellKnownClientTypeEntry -/* -The following example demonstrates the 'WellKnownClientTypeEntry' class. -It registers a 'HttpChannel' object with the channel services. Then registers the 'HelloServer' -type as well known type with the Remoting Infrastructure at the client end and activates the -remote object. It displays the properties of the 'WellKnownClientTypeEntry' object holding the -values for the above well-known type and makes few method calls on the remote object. -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -int main() -{ - // Create a 'HttpChannel' object and register with channel services. - ChannelServices::RegisterChannel( gcnew HttpChannel ); - Console::WriteLine( " Start calling from Client One......." ); - WellKnownClientTypeEntry^ myWellKnownClientTypeEntry = gcnew WellKnownClientTypeEntry( HelloServer::typeid,"http://localhost:8086/SayHello" ); - myWellKnownClientTypeEntry->ApplicationUrl = "http://localhost:8086/SayHello"; - RemotingConfiguration::RegisterWellKnownClientType( myWellKnownClientTypeEntry ); - - // Get the proxy object for the remote object. - HelloServer^ myHelloServerObject = gcnew HelloServer; - - // Retrieve an array of object types registered on the - // client end as well-known types. - array^myWellKnownClientTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownClientTypes(); - Console::WriteLine( "The Application Url to activate the Remote Object :{0}", myWellKnownClientTypeEntryCollection[ 0 ]->ApplicationUrl ); - Console::WriteLine( "The 'WellKnownClientTypeEntry' object :{0}", myWellKnownClientTypeEntryCollection[ 0 ] ); - - // Make remote method calls. - for ( int i = 0; i < 5; i++ ) - Console::WriteLine( myHelloServerObject->HelloMethod( " Client One" ) ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp b/snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp deleted file mode 100644 index ec8dbcb8b2f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -// System.Runtime.Remoting.WellKnownServiceTypeEntry -/* -The following example demonstrates the 'WellKnownServiceTypeEntry' class. -It registers a 'HttpChannel' object with the channel services. Then registers the 'HelloServer' -type as well known type with the Remoting Infrastructure at the service end. It displays the -properties of the 'WellKnownServiceTypeEntry' object holding the values for the above well-known -type . -*/ -// -#using -#using -#using - -using namespace System; -using namespace System::Runtime::Remoting; -using namespace System::Runtime::Remoting::Channels; -using namespace System::Runtime::Remoting::Channels::Http; - -int main() -{ - // Create a 'HttpChannel' object and register it with the - // channel services. - ChannelServices::RegisterChannel( gcnew HttpChannel( 8086 ) ); - - // Record the 'HelloServer' type as 'Singleton' well-known type. - WellKnownServiceTypeEntry^ myWellKnownServiceTypeEntry = gcnew WellKnownServiceTypeEntry( HelloServer::typeid,"SayHello",WellKnownObjectMode::Singleton ); - - // Register the remote object as well-known type. - RemotingConfiguration::RegisterWellKnownServiceType( myWellKnownServiceTypeEntry ); - - // Retrieve object types registered on the service end - // as well-known types. - array^myWellKnownServiceTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownServiceTypes(); - Console::WriteLine( "The 'WellKnownObjectMode' of the remote object : {0}", myWellKnownServiceTypeEntryCollection[ 0 ]->Mode ); - Console::WriteLine( "The 'WellKnownServiceTypeEntry' object: {0}", myWellKnownServiceTypeEntryCollection[ 0 ] ); - Console::WriteLine( "Started the Server, Hit to exit..." ); - Console::ReadLine(); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp deleted file mode 100644 index 165da0b159e..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - -// System.Xml.Serialization.XmlAttributeAttribute.XmlAttributeAttribute() -// System.Xml.Serialization.XmlAttributeAttribute.XmlAttributeAttribute(String) -/* The following example demonstrates the XmlAttributeAttribute constructor. -* This sample serializes a class named 'Student'. The StudentName property is -* serialized as an XML attribute. It also serializes a class named 'Book'. -*/ -// -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -// This is the class that will be serialized. -public ref class Student -{ -public: - String^ StudentName; - int StudentNumber; -}; - -public ref class Book -{ -public: - String^ BookName; - int BookNumber; -}; - -void SerializeObject( String^ studentFilename, String^ bookFilename ) -{ - XmlSerializer^ mySerializer; - TextWriter^ writer; - - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ myXmlAttributeOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ myXmlAttributes = gcnew XmlAttributes; - - /* Create an XmlAttributeAttribute set it to - the XmlAttribute property of the XmlAttributes object.*/ - XmlAttributeAttribute^ myXmlAttributeAttribute = gcnew XmlAttributeAttribute; - myXmlAttributeAttribute->AttributeName = "Name"; - myXmlAttributes->XmlAttribute = myXmlAttributeAttribute; - - // Add to the XmlAttributeOverrides. Specify the member name. - myXmlAttributeOverrides->Add( Student::typeid, "StudentName", myXmlAttributes ); - - // Create the XmlSerializer. - mySerializer = gcnew XmlSerializer( Student::typeid,myXmlAttributeOverrides ); - writer = gcnew StreamWriter( studentFilename ); - - // Create an instance of the class that will be serialized. - Student^ myStudent = gcnew Student; - - // Set the Name property, which will be generated as an XML attribute. - myStudent->StudentName = "James"; - myStudent->StudentNumber = 1; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myStudent ); - writer->Close(); - - // Create the XmlAttributeOverrides and XmlAttributes objects. - XmlAttributeOverrides^ myXmlBookAttributeOverrides = gcnew XmlAttributeOverrides; - XmlAttributes^ myXmlBookAttributes = gcnew XmlAttributes; - - /* Create an XmlAttributeAttribute set it to - the XmlAttribute property of the XmlAttributes object.*/ - XmlAttributeAttribute^ myXmlBookAttributeAttribute = gcnew XmlAttributeAttribute( "Name" ); - myXmlBookAttributes->XmlAttribute = myXmlBookAttributeAttribute; - - // Add to the XmlAttributeOverrides. Specify the member name. - myXmlBookAttributeOverrides->Add( Book::typeid, "BookName", myXmlBookAttributes ); - - // Create the XmlSerializer. - mySerializer = gcnew XmlSerializer( Book::typeid,myXmlBookAttributeOverrides ); - writer = gcnew StreamWriter( bookFilename ); - - // Create an instance of the class that will be serialized. - Book^ myBook = gcnew Book; - - // Set the Name property, which will be generated as an XML attribute. - myBook->BookName = ".NET"; - myBook->BookNumber = 10; - - // Serialize the class, and close the TextWriter. - mySerializer->Serialize( writer, myBook ); - writer->Close(); -} - -int main() -{ - SerializeObject( "Student.xml", "Book.xml" ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp deleted file mode 100644 index a12e4ff3e02..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// System::Xml::Serialization::XmlRootAttribute.XmlRootAttribute(String*) - -/* The following example demonstrates the constructor -'XmlRootAttribute(String*)' of class 'XmlRootAttribute'. -This program demonstrates 'Student' class to -which the 'XmlRootAttribute(String*)' constructor has been applied. -*/ - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that is the default root element. -public ref class Student -{ -public: - String^ Name; -}; - -public ref class XMLRootAttributeClass -{ -// -public: - void SerializeOrder( String^ filename ) - { - // Create an XmlSerializer instance using the method below. - XmlSerializer^ myXmlSerializer = CreateOverrider(); - - // Create the object, and set its Name property. - Student^ myStudent = gcnew Student; - myStudent->Name = "Student class1"; - - // Serialize the class, and close the TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - myXmlSerializer->Serialize( writer, myStudent ); - writer->Close(); - } - - // Return an XmlSerializer to the root serialization. - XmlSerializer^ CreateOverrider() - { - // Create an XmlAttributes to the default root element. - XmlAttributes^ myXmlAttributes = gcnew XmlAttributes; - - // Create an XmlRootAttribute overloaded constructer - // and set its namespace. - XmlRootAttribute^ myXmlRootAttribute = - gcnew XmlRootAttribute( "OverriddenRootElementName" ); - myXmlRootAttribute->Namespace = "http://www.microsoft.com"; - - // Set the XmlRoot property to the XmlRoot object. - myXmlAttributes->XmlRoot = myXmlRootAttribute; - XmlAttributeOverrides^ myXmlAttributeOverrides = - gcnew XmlAttributeOverrides; - - // Add the XmlAttributes object to the XmlAttributeOverrides object - myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes ); - - // Create the Serializer, and return it. - XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( - Student::typeid, myXmlAttributeOverrides ); - return myXmlSerializer; - } -// -}; - -int main() -{ - XMLRootAttributeClass^ myXMLRootAttributeClass = - gcnew XMLRootAttributeClass; - myXMLRootAttributeClass->SerializeOrder( - "XMLRootAttributeConstructor.xml" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp deleted file mode 100644 index c87e784d7f0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// System::Xml::Serialization::XmlRootAttribute.ElementName - -// The following example demonstrates the property -// 'ElementName' of class 'XmlRootAttribute'. -// This program demonstrates 'Student' class to -// which the 'ElementName' property has been applied. - -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -// This is the class that is the default root element. -public ref class Student -{ -public: - String^ Name; -}; - -public ref class XMLRootAttributeClass -{ -// -public: - void SerializeOrder( String^ filename ) - { - // Create an XmlSerializer instance using the method below. - XmlSerializer^ myXmlSerializer = CreateOverrider(); - - // Create the object, and set its Name property. - Student^ myStudent = gcnew Student; - myStudent->Name = "Student class1"; - - // Serialize the class, and close the TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - myXmlSerializer->Serialize( writer, myStudent ); - writer->Close(); - } - - // Return an XmlSerializer to the root serialization. - XmlSerializer^ CreateOverrider() - { - // Create an XmlAttributes to the default root element. - XmlAttributes^ myXmlAttributes = gcnew XmlAttributes; - - // Create an XmlRootAttribute and set its element name and namespace. - XmlRootAttribute^ myXmlRootAttribute = gcnew XmlRootAttribute; - myXmlRootAttribute->ElementName = "OverriddenRootElementName"; - myXmlRootAttribute->Namespace = "http://www.microsoft.com"; - - // Set the XmlRoot property to the XmlRoot object. - myXmlAttributes->XmlRoot = myXmlRootAttribute; - XmlAttributeOverrides^ myXmlAttributeOverrides = - gcnew XmlAttributeOverrides; - - // Add the XmlAttributes object to the XmlAttributeOverrides object. - myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes ); - - // Create the Serializer, and return it. - XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( - Student::typeid, myXmlAttributeOverrides ); - return myXmlSerializer; - } -// -}; - -int main() -{ - XMLRootAttributeClass^ myXMLRootAttributeClass = - gcnew XMLRootAttributeClass; - myXMLRootAttributeClass->SerializeOrder( - "XMLRootAttributeConstuctor.xml" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp deleted file mode 100644 index d2b959c3203..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp +++ /dev/null @@ -1,77 +0,0 @@ - - -// System::Xml::Serialization::XmlTypeAttribute.XmlTypeAttribute() -// System::Xml::Serialization::XmlTypeAttribute.XmlTypeAttribute(String*) -// The following example demonstrates the contructors 'XmlTypeAttribute()' -// and 'XmlTypeAttribute(String*)' of class 'XmlTypeAttribute'. -// This program demonstrates 'Person' and 'Address' classes to -// which the 'XmlTypeAttribute' has been applied. This sample then -// serializes an Object* of class 'Person' into an XML document. -// -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -public ref class Address -{ -public: - String^ state; - String^ zip; -}; - -public ref class Person -{ -public: - String^ personName; - Address^ address; -}; - -public ref class PersonTypeAttribute -{ -public: - XmlSerializer^ CreateOverrider() - { - XmlAttributeOverrides^ personOverride = gcnew XmlAttributeOverrides; - XmlAttributes^ personAttributes = gcnew XmlAttributes; - XmlTypeAttribute^ personType = gcnew XmlTypeAttribute; - personType->TypeName = "Employee"; - personType->Namespace = "http://www.microsoft.com"; - personAttributes->XmlType = personType; - XmlAttributes^ addressAttributes = gcnew XmlAttributes; - - // Create 'XmlTypeAttribute' with 'TypeName' as an argument. - XmlTypeAttribute^ addressType = gcnew XmlTypeAttribute( "Address" ); - addressType->Namespace = "http://www.microsoft.com"; - addressAttributes->XmlType = addressType; - personOverride->Add( Person::typeid, personAttributes ); - personOverride->Add( Address::typeid, addressAttributes ); - XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( Person::typeid,personOverride ); - return myXmlSerializer; - } - - void SerializeObject( String^ filename ) - { - XmlSerializer^ myXmlSerializer = CreateOverrider(); - Address^ myAddress = gcnew Address; - myAddress->state = "AAA"; - myAddress->zip = "11111"; - Person^ myPerson = gcnew Person; - myPerson->personName = "Smith"; - myPerson->address = myAddress; - - // Serialize to a file. - TextWriter^ writer = gcnew StreamWriter( filename ); - myXmlSerializer->Serialize( writer, myPerson ); - } -}; - -int main() -{ - PersonTypeAttribute^ myPersonTypeAttribute = gcnew PersonTypeAttribute; - myPersonTypeAttribute->SerializeObject( "XmlType.xml" ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp deleted file mode 100644 index 5c3508dc8e8..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; - -public ref class Group -{ -public: - String^ GroupName; - - // The UnknownAttributes array will be used to collect all unknown - // attributes found when deserializing. - - [XmlAnyAttributeAttribute] - array^XAttributes; -}; - -void SerializeObject( String^ filename, Object^ g ) -{ - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - TextWriter^ writer = gcnew StreamWriter( filename ); - ser->Serialize( writer, g ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ g = safe_cast(ser->Deserialize( fs )); - fs->Close(); - - // Write out the data, including unknown attributes. - Console::WriteLine( g->GroupName ); - Console::WriteLine( "Number of unknown attributes: {0}", g->XAttributes->Length ); - for ( IEnumerator ^ e = g->XAttributes->GetEnumerator(); e->MoveNext(); ) - { - XmlAttribute^ xAtt = safe_cast(e->Current); - Console::WriteLine( "{0}: {1}", xAtt->Name, xAtt->InnerXml ); - } - SerializeObject( "AttributesAdded.xml", g ); -} - -int main() -{ - // Deserialize the file containing unknown attributes. - DeserializeObject( "UnknownAttributes.xml" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp deleted file mode 100644 index 31e83e62519..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp +++ /dev/null @@ -1,58 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; -public ref class Group -{ -public: - String^ GroupName; - - // The Things array will be used to collect all unknown - // attributes found when deserializing. - array^Things; -}; - -XmlSerializer^ CreateOverrideSerializer(); -void DeserializeObject( String^ filename ) -{ - // Use the CreateOverrideSerializer to return an instance - // of the XmlSerializer customized for overrides. - XmlSerializer^ ser = CreateOverrideSerializer(); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ g = safe_cast(ser->Deserialize( fs )); - fs->Close(); - Console::WriteLine( g->GroupName ); - Console::WriteLine( g->Things->Length ); - for ( IEnumerator ^ e = g->Things->GetEnumerator(); e->MoveNext(); ) - { - XmlAttribute^ xAtt = safe_cast(e->Current); - Console::WriteLine( "{0}: {1}", xAtt->Name, xAtt->InnerXml ); - } -} - -XmlSerializer^ CreateOverrideSerializer() -{ - // Override the Things field to capture all - // unknown XML attributes. - XmlAnyAttributeAttribute^ myAnyAttribute = gcnew XmlAnyAttributeAttribute; - XmlAttributeOverrides^ xOverride = gcnew XmlAttributeOverrides; - XmlAttributes^ xAtts = gcnew XmlAttributes; - xAtts->XmlAnyAttribute = myAnyAttribute; - xOverride->Add( Group::typeid, "Things", xAtts ); - return gcnew XmlSerializer( Group::typeid,xOverride ); -} - -int main() -{ - DeserializeObject( "UnknownAttributes.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp deleted file mode 100644 index 9915009fc75..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp +++ /dev/null @@ -1,117 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; -using namespace System::Xml::Schema; - -[XmlRoot(Namespace="http://www.cohowinery.com")] -public ref class Group -{ -public: - String^ GroupName; - - // This is for serializing Employee elements. - - [XmlAnyElement(Name="Employee")] - array^UnknownEmployees; - - // This is for serializing City elements. - - [XmlAnyElement - (Name="City", - Namespace="http://www.cpandl.com")] - array^UnknownCity; - - // This one is for all other unknown elements. - - [XmlAnyElement] - array^UnknownElements; -}; - -void SerializeObject( String^ filename ) -{ - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - - // Create an XmlNamespaces to use. - XmlSerializerNamespaces^ namespaces = gcnew XmlSerializerNamespaces; - namespaces->Add( "c", "http://www.cohowinery.com" ); - namespaces->Add( "i", "http://www.cpandl.com" ); - Group^ myGroup = gcnew Group; - - // Create arrays of arbitrary XmlElement objects. - // First create an XmlDocument, used to create the - // XmlElement objects. - XmlDocument^ xDoc = gcnew XmlDocument; - - // Create an array of Employee XmlElement objects. - XmlElement^ El1 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" ); - El1->InnerText = "John"; - XmlElement^ El2 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" ); - El2->InnerText = "Joan"; - XmlElement^ El3 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" ); - El3->InnerText = "Jim"; - array^employees = {El1,El2,El3}; - myGroup->UnknownEmployees = employees; - - // Create an array of City XmlElement objects. - XmlElement^ inf1 = xDoc->CreateElement( "City", "http://www.cpandl.com" ); - inf1->InnerText = "Tokyo"; - XmlElement^ inf2 = xDoc->CreateElement( "City", "http://www.cpandl.com" ); - inf2->InnerText = "New York"; - XmlElement^ inf3 = xDoc->CreateElement( "City", "http://www.cpandl.com" ); - inf3->InnerText = "Rome"; - array^cities = {inf1,inf2,inf3}; - myGroup->UnknownCity = cities; - XmlElement^ xEl1 = xDoc->CreateElement( "bld" ); - xEl1->InnerText = "42"; - XmlElement^ xEl2 = xDoc->CreateElement( "Region" ); - xEl2->InnerText = "West"; - XmlElement^ xEl3 = xDoc->CreateElement( "type" ); - xEl3->InnerText = "Technical"; - array^elements = {xEl1,xEl2,xEl3}; - myGroup->UnknownElements = elements; - - // Serialize the class, and close the TextWriter. - TextWriter^ writer = gcnew StreamWriter( filename ); - ser->Serialize( writer, myGroup, namespaces ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ myGroup; - myGroup = safe_cast(ser->Deserialize( fs )); - fs->Close(); - for ( int i = 0; i < myGroup->UnknownEmployees->Length; ++i ) - { - XmlElement^ xEmp = myGroup->UnknownEmployees[ i ]; - Console::WriteLine( "{0}: {1}", xEmp->LocalName, xEmp->InnerText ); - } - for ( int i = 0; i < myGroup->UnknownCity->Length; ++i ) - { - XmlElement^ xCity = myGroup->UnknownCity[ i ]; - Console::WriteLine( "{0}: {1}", xCity->LocalName, xCity->InnerText ); - } - for ( int i = 0; i < myGroup->UnknownElements->Length; ++i ) - { - XmlElement^ xEmp = myGroup->UnknownElements[ i ]; - Console::WriteLine( "{0}: {1}", xEmp->LocalName, xEmp->InnerText ); - } -} - -int main() -{ - SerializeObject( "AnyElementArray.xml" ); - DeserializeObject( "AnyElementArray.xml" ); - Console::WriteLine( "Done" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp deleted file mode 100644 index 9787259757c..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp +++ /dev/null @@ -1,107 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::IO; -using namespace System::Xml::Schema; -public ref class Item -{ -public: - String^ ItemID; - Item(){} - - Item( String^ id ) - { - ItemID = id; - } -}; - -public ref class NewItem: public Item -{ -public: - String^ Category; - NewItem(){} - - NewItem( String^ id, String^ cat ) - { - ItemID = id; - Category = cat; - } -}; - -public ref class PurchaseOrder -{ -public: - - [XmlArrayItem(DataType="gMonth", - ElementName="MyMonths", - Namespace="http://www.cohowinery.com")] - array^Months; - - [XmlArrayItem(Item::typeid),XmlArrayItem(NewItem::typeid)] - array^Items; - - [XmlArray(IsNullable=true)] - [XmlArrayItem(String::typeid), - XmlArrayItem(Double::typeid), - XmlArrayItem(NewItem::typeid)] - array^Things; -}; - -void SerializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class; - // specify the type of object to serialize. - XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); - TextWriter^ writer = gcnew StreamWriter( filename ); - - // Create a PurchaseOrder and set its properties. - PurchaseOrder^ po = gcnew PurchaseOrder; - array^months = {"March","May","August"}; - po->Months = months; - array^items = {gcnew Item( "a1" ),gcnew NewItem( "b1","book" )}; - po->Items = items; - array^things = {"String",2003.31,gcnew NewItem( "Item100","book" )}; - po->Things = things; - - // Serialize the purchase order, and close the TextWriter. - serializer->Serialize( writer, po ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - // Create an instance of the XmlSerializer class; - // specify the type of object to be deserialized. - XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - - // Declare an object variable of the type to be deserialized. - PurchaseOrder^ po; - - /* Use the Deserialize method to restore the object's state with - data from the XML document. */ - po = safe_cast(serializer->Deserialize( fs )); - for ( int i = 0; i < po->Months->Length; ++i ) - Console::WriteLine( po->Months[ i ] ); - for ( int i = 0; i < po->Items->Length; ++i ) - Console::WriteLine( po->Items[ i ]->ItemID ); - for ( int i = 0; i < po->Things->Length; ++i ) - Console::WriteLine( po->Things[ i ] ); -} - -int main() -{ - // Read and write purchase orders. - SerializeObject( "ArrayItemEx.xml" ); - DeserializeObject( "ArrayItemEx.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp deleted file mode 100644 index 37278b0a8b3..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; -public ref class Group -{ -public: - String^ GroupName; - - [XmlAnyElement] - array^Things; -}; - -void SerializeObject( String^ filename ); -void DeserializeObject( String^ filename ); -XmlSerializer^ CreateOverrideSerializer(); -int main() -{ - // 1 Run this and create the XML document. - // 2 Add new elements to the XML document. - // 3 Comment out the next line, and uncomment - // the DeserializeObject line to deserialize the - // XML document and see unknown elements. - SerializeObject( "UnknownElements.xml" ); - - // DeserializeObject(S"UnknownElements.xml"); -} - -void SerializeObject( String^ filename ) -{ - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - TextWriter^ writer = gcnew StreamWriter( filename ); - Group^ g = gcnew Group; - g->GroupName = "MyGroup"; - ser->Serialize( writer, g ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ ser = CreateOverrideSerializer(); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ g = safe_cast(ser->Deserialize( fs )); - fs->Close(); - Console::WriteLine( g->GroupName ); - Console::WriteLine( g->Things->Length ); - for ( int i = 0; i < g->Things->Length; ++i ) - { - XmlElement^ xelement = safe_cast(g->Things[ i ]); - Console::WriteLine( "{0}: {1}", xelement->Name, xelement->InnerXml ); - } -} - -XmlSerializer^ CreateOverrideSerializer() -{ - XmlAnyElementAttribute^ myAnyElement = gcnew XmlAnyElementAttribute; - XmlAttributeOverrides^ xOverride = gcnew XmlAttributeOverrides; - XmlAttributes^ xAtts = gcnew XmlAttributes; - xAtts->XmlAnyElements->Add( myAnyElement ); - xOverride->Add( Group::typeid, "Things", xAtts ); - return gcnew XmlSerializer( Group::typeid,xOverride ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp deleted file mode 100644 index a86b3632f06..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp +++ /dev/null @@ -1,86 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Serialization; -public ref class Student -{ -public: - - [XmlAttributeAttribute] - String^ Name; - - [XmlNamespaceDeclarationsAttribute] - XmlSerializerNamespaces^ myNamespaces; -}; - -void SerializeStudent( String^ filename ); -void DeserializeStudent( String^ filename ); -int main() -{ - SerializeStudent( "Student.xml" ); - DeserializeStudent( "Student.xml" ); -} - -void SerializeStudent( String^ filename ) -{ - XmlAttributes^ atts = gcnew XmlAttributes; - - // Set to true to preserve namespaces, - // or false to ignore them. - atts->Xmlns = true; - XmlAttributeOverrides^ xover = gcnew XmlAttributeOverrides; - - // Add the XmlAttributes and specify the name of the element - // containing namespaces. - xover->Add( Student::typeid, "myNamespaces", atts ); - - // Create the XmlSerializer using the - // XmlAttributeOverrides object. - XmlSerializer^ xser = gcnew XmlSerializer( Student::typeid,xover ); - Student^ myStudent = gcnew Student; - XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; - ns->Add( "myns1", "http://www.cpandl.com" ); - ns->Add( "myns2", "http://www.cohowinery.com" ); - myStudent->myNamespaces = ns; - myStudent->Name = "Student1"; - FileStream^ fs = gcnew FileStream( filename,FileMode::Create ); - xser->Serialize( fs, myStudent ); - fs->Close(); -} - -void DeserializeStudent( String^ filename ) -{ - XmlAttributes^ atts = gcnew XmlAttributes; - - // Set to true to preserve namespaces, or false to ignore them. - atts->Xmlns = true; - XmlAttributeOverrides^ xover = gcnew XmlAttributeOverrides; - - // Add the XmlAttributes and specify the name of the - // element containing namespaces. - xover->Add( Student::typeid, "myNamespaces", atts ); - - // Create the XmlSerializer using the - // XmlAttributeOverrides object. - XmlSerializer^ xser = gcnew XmlSerializer( Student::typeid,xover ); - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Student^ myStudent; - myStudent = safe_cast(xser->Deserialize( fs )); - fs->Close(); - - // Use the ToArray method to get an array of - // XmlQualifiedName objects. - array^qNames = myStudent->myNamespaces->ToArray(); - for ( int i = 0; i < qNames->Length; i++ ) - { - Console::WriteLine( "{0}:{1}", qNames[ i ]->Name, qNames[ i ]->Namespace ); - - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp deleted file mode 100644 index 51329745b7a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp +++ /dev/null @@ -1,131 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::IO; - -[XmlType(IncludeInSchema=false)] - -public enum class ItemChoiceType -{ - None, Word, Number, DecimalNumber -}; - -public enum class MoreChoices -{ - None, Item, Amount, Temp -}; - -public ref class Choices -{ -public: - - // The MyChoice field can be set to any one of - // the types below. - - [XmlChoiceIdentifier("EnumType")] - [XmlElement("Word",String::typeid)] - [XmlElement("Number",Int32::typeid)] - [XmlElement("DecimalNumber",Double::typeid)] - Object^ MyChoice; - - // Don't serialize this field. The EnumType field - // contains the enumeration value that corresponds - // to the MyChoice field value. - - [XmlIgnore] - ItemChoiceType EnumType; - - // The ManyChoices field can contain an array - // of choices. Each choice must be matched to - // an array item in the ChoiceArray field. - - [XmlChoiceIdentifier("ChoiceArray")] - [XmlElement("Item",String::typeid)] - [XmlElement("Amount",Int32::typeid)] - [XmlElement("Temp",Double::typeid)] - array^ManyChoices; - - // TheChoiceArray field contains the enumeration - // values, one for each item in the ManyChoices array. - - [XmlIgnore] - array^ChoiceArray; -}; - -void SerializeObject( String^ filename ); -void DeserializeObject( String^ filename ); -int main() -{ - SerializeObject( "Choices.xml" ); - DeserializeObject( "Choices.xml" ); -} - -void SerializeObject( String^ filename ) -{ - XmlSerializer^ mySerializer = gcnew XmlSerializer( Choices::typeid ); - TextWriter^ writer = gcnew StreamWriter( filename ); - Choices^ myChoices = gcnew Choices; - - // Set the MyChoice field to a string. Set the - // EnumType to Word. - myChoices->MyChoice = "Book"; - myChoices->EnumType = ItemChoiceType::Word; - - // Populate an object array with three items, one - // of each enumeration type. Set the array to the - // ManyChoices field. - array^strChoices = {"Food",5,98.6}; - myChoices->ManyChoices = strChoices; - - // For each item in the ManyChoices array, add an - // enumeration value. - array^ itmChoices = {MoreChoices::Item,MoreChoices::Amount,MoreChoices::Temp}; - myChoices->ChoiceArray = itmChoices; - mySerializer->Serialize( writer, myChoices ); - writer->Close(); -} - -void DeserializeObject( String^ filename ) -{ - XmlSerializer^ ser = gcnew XmlSerializer( Choices::typeid ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Choices^ myChoices = safe_cast(ser->Deserialize( fs )); - fs->Close(); - - // Disambiguate the MyChoice value using the enumeration. - if ( myChoices->EnumType == ItemChoiceType::Word ) - { - Console::WriteLine( "Word: {0}", myChoices->MyChoice->ToString() ); - } - else - if ( myChoices->EnumType == ItemChoiceType::Number ) - { - Console::WriteLine( "Number: {0}", myChoices->MyChoice->ToString() ); - } - else - if ( myChoices->EnumType == ItemChoiceType::DecimalNumber ) - { - Console::WriteLine( "DecimalNumber: {0}", myChoices->MyChoice->ToString() ); - } - - // Disambiguate the ManyChoices values using the enumerations. - for ( int i = 0; i < myChoices->ManyChoices->Length; i++ ) - { - if ( myChoices->ChoiceArray[ i ] == MoreChoices::Item ) - Console::WriteLine( "Item: {0}", myChoices->ManyChoices[ i ] ); - else - if ( myChoices->ChoiceArray[ i ] == MoreChoices::Amount ) - Console::WriteLine( "Amount: ", myChoices->ManyChoices[ i ]->ToString() ); - if ( myChoices->ChoiceArray[ i ] == MoreChoices::Temp ) - Console::WriteLine( "Temp: {0}", myChoices->ManyChoices[ i ]->ToString() ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp deleted file mode 100644 index 61dea2ac426..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp +++ /dev/null @@ -1,58 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; -using namespace System::Xml::Serialization; -public ref class Person: public IXmlSerializable -{ -private: - - // Private state - String^ personName; - -public: - - // Constructors - Person( String^ name ) - { - personName = name; - } - - Person() - { - personName = nullptr; - } - - // Xml Serialization Infrastructure - // - virtual void WriteXml( XmlWriter^ writer ) - { - writer->WriteString( personName ); - } - // - - // - virtual void ReadXml( XmlReader^ reader ) - { - personName = reader->ReadString(); - } - // - - // - virtual XmlSchema^ GetSchema() - { - return nullptr; - } - // - - // Print - virtual String^ ToString() override - { - return (personName); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp deleted file mode 100644 index f5ab5ef1cb0..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp +++ /dev/null @@ -1,19 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; - -int main() -{ - XmlSerializer^ serializer = gcnew XmlSerializer( Person::typeid ); - FileStream^ file = gcnew FileStream( "test.xml",FileMode::Open ); - Person^ aPerson = dynamic_cast(serializer->Deserialize( file )); - Console::WriteLine( aPerson ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp deleted file mode 100644 index 35d2a29a532..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp +++ /dev/null @@ -1,22 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Serialization; - -int main() -{ - // Create a person object. - Person ^ fred = gcnew Person( "Fred Flintstone" ); - - // Serialize the object to a file. - XmlTextWriter^ writer = gcnew XmlTextWriter( "test.xml", nullptr ); - XmlSerializer^ serializer = gcnew XmlSerializer( Person::typeid ); - serializer->Serialize( writer, fred ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp deleted file mode 100644 index 22cef24ad7a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class Group -{ -public: - String^ GroupName; -}; - -public ref class Test -{ -private: - void Serializer_UnknownElement( Object^ sender, XmlElementEventArgs^ e ) - { - Console::WriteLine( "Unknown Element" ); - Console::Write( "\t {0}", e->Element->Name ); - Console::WriteLine( " {0}", e->Element->InnerXml ); - Console::WriteLine( "\t LineNumber: {0}", e->LineNumber ); - Console::WriteLine( "\t LinePosition: {0}", e->LinePosition ); - Group^ x = dynamic_cast(e->ObjectBeingDeserialized); - Console::WriteLine( x->GroupName ); - Console::WriteLine( sender ); - } - -public: - void DeserializeObject( String^ filename ) - { - XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); - - // Add a delegate to handle unknown element events. - ser->UnknownElement += gcnew XmlElementEventHandler( this, &Test::Serializer_UnknownElement ); - - // A FileStream is needed to read the XML document. - FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); - Group^ g = dynamic_cast(ser->Deserialize( fs )); - fs->Close(); - } -}; - -int main() -{ - Test^ t = gcnew Test; - - // Deserialize the file containing unknown elements. - t->DeserializeObject( "UnknownElements.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp deleted file mode 100644 index e453759982a..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp +++ /dev/null @@ -1,79 +0,0 @@ -// System::Xml::Serialization::XmlSerializerNamespaces.constructor - -// The following example demonstrates the constructor of class -// XmlSerializerNamespaces. This sample serializes an Object* of 'MyPriceClass' -// into an XML document. - -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Serialization; -using namespace System::IO; - -public ref class MyPriceClass -{ -public: - [XmlAttributeAttribute] - String^ Units; - Decimal Price; -}; - -public ref class MyBook -{ -public: - String^ BookName; - String^ Author; - MyPriceClass^ BookPrice; - String^ Description; -}; - -public ref class MyMainClass -{ -// -public: - void CreateBook( String^ filename ) - { - try - { - // Create instance of XmlSerializerNamespaces and add the namespaces. - XmlSerializerNamespaces^ myNameSpaces = gcnew XmlSerializerNamespaces; - myNameSpaces->Add( "BookName", "http://www.cpandl.com" ); - - // Create instance of XmlSerializer and specify the type of object - // to be serialized. - XmlSerializer^ mySerializerObject = - gcnew XmlSerializer( MyBook::typeid ); - - TextWriter^ myWriter = gcnew StreamWriter( filename ); - // Create object to be serialized. - MyBook^ myXMLBook = gcnew MyBook; - - myXMLBook->Author = "XMLAuthor"; - myXMLBook->BookName = "DIG THE XML"; - myXMLBook->Description = "This is a XML Book"; - - MyPriceClass^ myBookPrice = gcnew MyPriceClass; - myBookPrice->Price = (Decimal)45.89; - myBookPrice->Units = "$"; - myXMLBook->BookPrice = myBookPrice; - - // Serialize the object. - mySerializerObject->Serialize( myWriter, myXMLBook, myNameSpaces ); - myWriter->Close(); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception: {0} occurred", e->Message ); - } - } -// -}; - -int main() -{ - MyMainClass^ myMain = gcnew MyMainClass; - // Create the XML document. - myMain->CreateBook( "myBook.xml" ); -} diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp deleted file mode 100644 index 8f321e5bf24..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml::Serialization; -using namespace System::Collections; -using namespace System::Xml; -using namespace System::Text; - -public ref class Thing -{ -public: - String^ ThingName; -}; - -[SoapType("TheGroup","http://www.cohowinery.com")] -public ref class Group -{ -public: - String^ GroupName; - array^Things; - - [SoapElement(DataType="language")] - static String^ Lang = "en"; - - [SoapElement(DataType="integer")] - String^ MyNumber; - - [SoapElement(DataType="duration")] - static String^ ReDate = "8/31/01"; -}; - -void GetMap( String^ filename ) -{ - // Create an XmlSerializer instance. - SoapReflectionImporter^ sri = gcnew SoapReflectionImporter; - XmlTypeMapping^ map = sri->ImportTypeMapping( Group::typeid ); - Console::WriteLine( "ElementName: {0}", map->ElementName ); - Console::WriteLine( "Namespace: {0}", map->Namespace ); - Console::WriteLine( "TypeFullName: {0}", map->TypeFullName ); - Console::WriteLine( "TypeName: {0}", map->TypeName ); - XmlSerializer^ ser = gcnew XmlSerializer( map ); - Group^ xGroup = gcnew Group; - xGroup->GroupName = "MyCar"; - xGroup->MyNumber = "5454"; - xGroup->Things = gcnew array(2); // {new Thing(), new Thing()}; - xGroup->Things[ 0 ] = gcnew Thing; - xGroup->Things[ 1 ] = gcnew Thing; - - // To write the outer wrapper, use an XmlTextWriter. - XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); - writer->Formatting = Formatting::Indented; - writer->WriteStartElement( "wrapper" ); - ser->Serialize( writer, xGroup ); - writer->WriteEndElement(); - writer->Close(); -} - -int main() -{ - GetMap( "MyMap.xml" ); -} -// diff --git a/snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp b/snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp deleted file mode 100644 index a1d62acbb7b..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* -This program demonstrates the 'Intersect' and 'Union' methods of 'DnsPermission' class. -It creates a 'DnsPermission' instance that is the Union/Intersection of current permission -instance and specified permission instance. -*/ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Security; -using namespace System::Security::Permissions; -using namespace System::Collections; - -public ref class DnsPermissionExample -{ -private: - DnsPermission^ dnsPermission1; - DnsPermission^ dnsPermission2; - - // -private: - void MyUnion() - { - // Create a DnsPermission instance that is the union of the current DnsPermission - // instance and the specified DnsPermission instance. - DnsPermission^ permission = dynamic_cast(dnsPermission1->Union( dnsPermission2 )); - // Print the attributes and the values of the union instance of DnsPermission. - PrintKeysAndValues( permission->ToXml()->Attributes ); - } - - // -public: - void useDns() - { - // Create a DnsPermission instance. - dnsPermission1 = gcnew DnsPermission( PermissionState::Unrestricted ); - dnsPermission2 = gcnew DnsPermission( PermissionState::None ); - // Check for permission. - dnsPermission1->Demand(); - dnsPermission2->Demand(); - Console::WriteLine( "Attributes and Values of first DnsPermission instance :" ); - PrintKeysAndValues( dnsPermission1->ToXml()->Attributes ); - Console::WriteLine( "Attributes and Values of second DnsPermission instance :" ); - PrintKeysAndValues( dnsPermission2->ToXml()->Attributes ); - Console::WriteLine( "Union of both instances : " ); - MyUnion(); - Console::WriteLine( "Intersection of both instances : " ); - MyIntersection(); - } - -private: - void PrintKeysAndValues( Hashtable^ myList ) - { - // Get the enumerator that can iterate through the hash tabble. - IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); - Console::WriteLine( "\t-KEY-\t-VALUE-" ); - while ( myEnumerator->MoveNext() ) - { - Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); - } - Console::WriteLine(); - } - // - - // Create a DnsPermission instance that is the intersection of current - // DnsPermission instance and the specified DnsPermission instance. - void MyIntersection() - { - DnsPermission^ permission = dynamic_cast(dnsPermission1->Intersect( dnsPermission2 )); - // Print the attributes and the values of the intersection instance of - // DnsPermission. - PrintKeysAndValues( permission->ToXml()->Attributes ); - } - // -}; - -int main() -{ - try - { - DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; - dnsPermissionExampleObj->useDns(); - } - catch ( SecurityException^ e ) - { - Console::WriteLine( "SecurityException caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } - catch ( Exception^ e ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", e->Source ); - Console::WriteLine( "Message : {0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp b/snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp deleted file mode 100644 index 91aba7f9245..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Web::UI; -using namespace System::Web::UI::Design; -using namespace System::Web::UI::WebControls; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -// -// Example designer provides a designer verb menu command to launch the -// BuildColor method of the ColorBuilder. -public ref class ColorBuilderDesigner: public System::Web::UI::Design::UserControlDesigner -{ -public: - ColorBuilderDesigner(){} - - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - - // Provides a designer verb menu command for invoking the BuildColor - // method of the ColorBuilder. - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override - { - DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; - dvc->Add( gcnew DesignerVerb( "Launch Color Builder UI",gcnew EventHandler( this, &ColorBuilderDesigner::launchColorBuilder ) ) ); - return dvc; - } - - } - -private: - - // This method handles the S"Launch Color Builder UI" menu command. - // Invokes the BuildColor method of the System::Web::UI::Design.ColorBuilder. - void launchColorBuilder( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // - // Create a parent control. - System::Windows::Forms::Control^ c = gcnew System::Windows::Forms::Control; - c->CreateControl(); - - // Launch the Color Builder using the specified control - // parent and an initial HTML format (S"RRGGBB") color String*. - System::Web::UI::Design::ColorBuilder::BuildColor( this->Component, c, "405599" ); - // - - } - -}; - - -// Example Web control displays the value of its text property. -// This control is associated with the ColorBuilderDesigner. - -[DesignerAttribute(ColorBuilderDesigner::typeid,IDesigner::typeid)] -public ref class ColorBuilderControl: public System::Web::UI::WebControls::WebControl -{ -private: - String^ text; - -public: - - property String^ Text - { - - [Bindable(true), - Category("Appearance"), - DefaultValue("")] - String^ get() - { - return text; - } - - void set( String^ value ) - { - text = value; - } - - } - -protected: - virtual void Render( HtmlTextWriter^ output ) override - { - output->Write( Text ); - } - -}; -// - diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp deleted file mode 100644 index 88b3a12191a..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp +++ /dev/null @@ -1,29 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::Adapters; -using namespace System::Web::UI::WebControls; - -public ref class CustomControl: public Control{}; - -public ref class CustomControlAdapter: public ControlAdapter -{ -public: - - property System::Web::UI::Control^ Control - { - // Return a strongly-typed reference to your custom control. - System::Web::UI::Control^ get() - { - return (CustomControl^)ControlAdapter::Control; - } - } - // Override other ControlAdapter members, as necessary. -}; -// - -void main(){} diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp deleted file mode 100644 index a0aaca9f13a..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp +++ /dev/null @@ -1,30 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::Adapters; - -public ref class CustomControlAdapter: public ControlAdapter -{ -protected: - virtual void Render( HtmlTextWriter^ writer ) override - { - // Access Browser details through the Browser property. - Version^ jScriptVersion = Browser->JScriptVersion; - - // Test if the browser supports Javascript. - if ( jScriptVersion != nullptr ) - { - // Render JavaScript-aware markup. - } - else - { - // Render scriptless markup. - } - } -}; -// - -void main(){} diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp deleted file mode 100644 index 04765206bfb..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp +++ /dev/null @@ -1,25 +0,0 @@ -// -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::Adapters; - -public ref class CustomControlAdapter: public ControlAdapter -{ - // Override the ControlAdapter default OnInit implementation. -protected: - virtual void OnInit( EventArgs^ e ) override - { - // Make the control invisible. - Control->Visible = false; - - // Call the base method, which calls OnInit of the control, - // which raises the control Init event. - ControlAdapter::OnInit( e ); - } -}; -// - -void main(){} diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp deleted file mode 100644 index 026280b53e5..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp +++ /dev/null @@ -1,282 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::IO; -using namespace System::Web::UI; -using namespace System::Web::UI::Design; -using namespace System::Web::UI::WebControls; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// Provides a form with a multiline text box display. -private ref class StringDisplayForm: public Form -{ -public: - StringDisplayForm( String^ displayText ) - { - this->Size = System::Drawing::Size( 400, 400 ); - this->Text = "Control Persistence String"; - this->SuspendLayout(); - System::Windows::Forms::TextBox^ tbox = gcnew System::Windows::Forms::TextBox; - tbox->Multiline = true; - tbox->Size = System::Drawing::Size( this->Width - 40, this->Height - 90 ); - tbox->Text = displayText; - this->Controls->Add( tbox ); - System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; - okButton->Text = "OK"; - okButton->Size = System::Drawing::Size( 80, 24 ); - okButton->Location = Point(this->Width - 100,this->Height - 60); - okButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); - okButton->DialogResult = ::DialogResult::OK; - this->Controls->Add( okButton ); - this->ResumeLayout(); - } - -}; - -// Provides a form with a list for selection. -private ref class ControlSelectionForm: public Form -{ -private: - array^controlArray; - -public: - System::Windows::Forms::ListBox^ controlList; - ControlSelectionForm( array^controlArray ) - { - this->controlArray = controlArray; - this->Size = System::Drawing::Size( 400, 500 ); - this->Text = "Control Persister Selection Form"; - this->SuspendLayout(); - System::Windows::Forms::Label ^ label1 = gcnew System::Windows::Forms::Label; - label1->Text = "Select the control to persist:"; - label1->Size = System::Drawing::Size( 240, 20 ); - label1->Location = Point(10,10); - this->Controls->Add( label1 ); - controlList = gcnew System::Windows::Forms::ListBox; - controlList->Size = System::Drawing::Size( 370, 400 ); - controlList->Location = Point(10,30); - controlList->Anchor = AnchorStyles(AnchorStyles::Left | AnchorStyles::Top | AnchorStyles::Bottom | AnchorStyles::Right); - this->Controls->Add( controlList ); - System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; - okButton->Text = "OK"; - okButton->Size = System::Drawing::Size( 80, 24 ); - okButton->Location = Point(this->Width - 100,this->Height - 60); - okButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); - okButton->DialogResult = ::DialogResult::OK; - this->Controls->Add( okButton ); - System::Windows::Forms::Button^ cancelButton = gcnew System::Windows::Forms::Button; - cancelButton->Text = "Cancel"; - cancelButton->Size = System::Drawing::Size( 80, 24 ); - cancelButton->Location = Point(this->Width - 200,this->Height - 60); - cancelButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); - cancelButton->DialogResult = ::DialogResult::Cancel; - this->Controls->Add( cancelButton ); - for ( int i = 0; i < controlArray->Length; i++ ) - controlList->Items->Add( controlArray[ i ]->UniqueID ); - this->ResumeLayout(); - } -}; - -// Provides a form with a multiline text box for input. -private ref class StringInputForm: public Form -{ -public: - System::Windows::Forms::TextBox^ tbox; - StringInputForm() - { - this->Size = System::Drawing::Size( 400, 400 ); - this->Text = "Input Control Persistence String"; - this->SuspendLayout(); - tbox = gcnew System::Windows::Forms::TextBox; - tbox->Multiline = true; - tbox->Size = System::Drawing::Size( this->Width - 40, this->Height - 90 ); - tbox->Text = ""; - this->Controls->Add( tbox ); - System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; - okButton->Text = "OK"; - okButton->Size = System::Drawing::Size( 80, 24 ); - okButton->Location = Point(this->Width - 100,this->Height - 60); - okButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); - okButton->DialogResult = ::DialogResult::OK; - this->Controls->Add( okButton ); - System::Windows::Forms::Button^ cancelButton = gcnew System::Windows::Forms::Button; - cancelButton->Text = "Cancel"; - cancelButton->Size = System::Drawing::Size( 80, 24 ); - cancelButton->Location = Point(this->Width - 200,this->Height - 60); - cancelButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); - cancelButton->DialogResult = ::DialogResult::Cancel; - this->Controls->Add( cancelButton ); - this->ResumeLayout(); - } -}; - - -// Web control designer provides an interface -// to use the ControlPersister and ControlParser. -public ref class ControlParserPersisterDesigner: public System::Web::UI::Design::ControlDesigner -{ -public: - ControlParserPersisterDesigner() - : ControlDesigner() - {} - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - // Provides designer verb menu commands to - // persist a control and to load a persisted control. - [System::Security::Permissions::PermissionSetAttribute(System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override - { - DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; - dvc->Add( gcnew DesignerVerb( "Load Persisted Control...",gcnew EventHandler( this, &ControlParserPersisterDesigner::loadPersistedControl ) ) ); - dvc->Add( gcnew DesignerVerb( "Parse and Save Control...",gcnew EventHandler( this, &ControlParserPersisterDesigner::saveControl ) ) ); - return dvc; - } - - } - -private: - - // Displays a textbox form to receive an HTML - // String* that represents a control, and creates - // a toolbox item for the control, if not already - // present in the selected toolbox category. - void loadPersistedControl( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Display a StringInputForm to obtain a persisted control String*. - StringInputForm^ inputForm = gcnew StringInputForm; - if ( inputForm->ShowDialog() != DialogResult::OK ) - return; - - if ( inputForm->tbox->Text->Length < 2 ) - return; - - // Obtain an IDesignerHost* for the design-mode document. - IDesignerHost^ host = dynamic_cast(this->Component->Site->GetService( IDesignerHost::typeid )); - - // - // Create a Web control from the persisted control String*. - System::Web::UI::Control^ ctrl = ControlParser::ParseControl( host, inputForm->tbox->Text->Trim() ); - // - - // Create a Web control toolbox item for the type of the control - WebControlToolboxItem^ item = gcnew WebControlToolboxItem( ctrl->GetType() ); - - // Add the Web control toolbox item to the toolbox - IToolboxService^ toolService = dynamic_cast(this->Component->Site->GetService( IToolboxService::typeid )); - if ( toolService != nullptr ) - toolService->AddToolboxItem( item ); - else - throw gcnew Exception( "IToolboxService* was not found." ); - } - - // Displays a list of controls in the project, if any, - // and displays the HTML representing the persisted, selected control. - void saveControl( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Get the collection of components in the current - // design mode document. - ComponentCollection^ documentComponents = this->Component->Site->Container->Components; - - // Filter the components to those that derive from the - // System::Web::UI::Control class. - // Create an IComponent* array of the maximum possible length needed. - array^filterArray = gcnew array(documentComponents->Count); - - // Count the total qualifying components. - int total = 0; - for ( int i = 0; i < documentComponents->Count; i++ ) - { - // If the component derives from System::Web::UI::Control, - // copy a reference to the control to the filterArray - // array and increment the control count. - if ( System::Web::UI::Control::typeid->IsAssignableFrom( documentComponents[i]->GetType() ) ) - { - if ( (dynamic_cast(documentComponents[i]))->UniqueID != nullptr ) - { - filterArray[total] = documentComponents[i]; - total++; - } - } - - } - if ( total == 0 ) - throw gcnew Exception( "Document contains no System::Web::UI::Control components." ); - - // Move the components that derive from System::Web::UI::Control to a - // new array of the correct size. - array^controlArray = gcnew array(total); - for ( int i = 0; i < total; i++ ) - controlArray[i] = dynamic_cast(filterArray[i]); - - // Create a ControlSelectionForm to provide a persistence - // configuration interface. - ControlSelectionForm^ selectionForm = gcnew ControlSelectionForm( controlArray ); - - // Display the form. - if ( selectionForm->ShowDialog() != DialogResult::OK ) - return; - - // Validate the selection. - if ( selectionForm->controlList->SelectedIndex == -1 ) - throw gcnew Exception( "You must select a control to persist." ); - - // - // Parse the selected control. - String^ persistedData = ControlPersister::PersistControl( controlArray[ selectionForm->controlList->SelectedIndex ] ); - // - - // Display the control persistence String* in a text box. - StringDisplayForm^ displayForm = gcnew StringDisplayForm( persistedData ); - displayForm->ShowDialog(); - } -}; - -// Simple text display control hosts the ControlParserPersisterDesigner. - -[DesignerAttribute(ControlParserPersisterDesigner::typeid,IDesigner::typeid)] -public ref class ControlParserPersisterDesignerControl: public WebControl -{ -private: - String^ text; - -public: - - property String^ Text - { - [Bindable(true), - Category("Appearance"), - DefaultValue("")] - String^ get() - { - return text; - } - - void set( String^ value ) - { - text = value; - } - } - ControlParserPersisterDesignerControl() - : WebControl() - { - text = "Right-click here to access control persistence methods in design mode"; - } - -protected: - virtual void Render( HtmlTextWriter^ output ) override - { - output->Write( Text ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp b/snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp deleted file mode 100644 index 185667b5413..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::Design; -using namespace System::Web::UI::WebControls; -using namespace System::ComponentModel; - -public ref class DataSourceTypeConverterExampleControl: public System::Web::UI::WebControls::WebControl -{ - // - // Associates the DataBindingCollectionConverter - // with a DataBindingCollection property. -public: - [TypeConverterAttribute(DataBindingCollectionConverter::typeid)] - property DataBindingCollection^ dataBindings - { - DataBindingCollection^ get() - { - return bindings; - } - void set( DataBindingCollection^ value ) - { - bindings = value; - } - } -private: - DataBindingCollection^ bindings; - // - - // - // Associates the DataMemberConverter with a string property. -public: - [TypeConverterAttribute(DataMemberConverter::typeid)] - property String^ dataMember - { - String^ get() - { - return member; - } - void set( String^ value ) - { - member = value; - } - } -private: - String^ member; - // - - // - // Associates the DataFieldConverter with a string property. -public: - [TypeConverterAttribute(DataMemberConverter::typeid)] - property String^ dataField - { - String^ get() - { - return field; - } - void set( String^ value ) - { - field = value; - } - } -private: - String^ field; - // - - // - // Associates the DataSourceConverter with an object property. -public: - [TypeConverterAttribute(DataSourceConverter::typeid)] - property Object^ dataSource - { - Object^ get() - { - return source; - } - void set( Object^ value ) - { - source = value; - } - } -private: - Object^ source; - // - -public: - [Bindable(true), - Category("Appearance"), - DefaultValue("")] - property String^ Text - { - String^ get() - { - return text; - } - void set( String^ value ) - { - text = value; - } - } -private: - String^ text; - -protected: - virtual void Render( HtmlTextWriter^ output ) override - { - output->Write( Text ); - } -}; diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp deleted file mode 100644 index 61b9fb1dc9b..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/* -* The following example demonstrates the 'AddStyleAttribute(string, string)' method -* of 'HtmlTextWriter' class. -* -* In this program a custom web control called 'FirstControl' is shown. It has -* one property called the 'Message'. The 'Render' method has been overriden to -* write the html contents with reference to this control. This contents are -* written to the final .aspx page in which this control is inserted. The 'Render' -* method displays the contents of the 'Message' property followed by the current -* time on the server were the corresponding .aspx page resides. -* -* Note : Follow the instructions in HtmlTextWriterReadme.txt for details on installing -* a site that uses custom controls. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::WebControls; - -namespace CustomControls -{ - public ref class FirstControl: public WebControl - { - // The message property. - private: - String^ message; - - // Accessors for the message property. - public: - property String^ Message - { - virtual String^ get() - { - return message; - } - virtual void set( String^ value ) - { - message = value; - } - } - - protected: - virtual void Render( HtmlTextWriter^ writer ) override - { - // - // Add style attribute for 'p'(paragraph) element. - writer->AddStyleAttribute( "font-size", "12pt" ); - writer->AddStyleAttribute( "color", "fuchsia" ); - // Output the 'p' (paragraph) element with the style attributes. - writer->RenderBeginTag( "p" ); - // Output the 'Message' property contents and the time on the server. - writer->Write( String::Concat( Message, "
", - "The time on the server: ", - System::DateTime::Now.ToLongTimeString() ) ); - - // Close the element. - writer->RenderEndTag(); - //
- } - }; -} diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp deleted file mode 100644 index 67de2ee8b44..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web; -using namespace System::Web::UI; - -// Create a custom HtmlTextWriter class. -public ref class HTW1: public HtmlTextWriter -{ -public: - HTW1( TextWriter^ writer ) - : HtmlTextWriter( writer ) - {} - - HTW1( TextWriter^ writer, String^ tabString ) - : HtmlTextWriter( writer, tabString ) - {} - - // - // Override the RenderBeginTag method to check whether - // the tagKey parameter is set to a - -protected: - // - // Override the FilterAttributes method to check whether - // - - // - // Override the OutputTabs method to set the tab to - // the number of spaces defined by the Indent variable. - virtual void OutputTabs() override - { - - // Output the DefaultTabString for the number - // of times specified in the Indent property. - for ( int i = 0; i < Indent; i++ ) - Write( DefaultTabString ); - __super::OutputTabs(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp deleted file mode 100644 index a84dd30f1e5..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// Create a custom HtmlTextWriter class that overrides -// the RenderBeforeContent and RenderAfterContent methods. -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::UI; -using namespace System::Security::Permissions; -using namespace System::Web; - -public ref class cstmHtmlTW: public HtmlTextWriter -{ -public: - cstmHtmlTW( TextWriter^ writer ) - : HtmlTextWriter( writer ) - {} - - cstmHtmlTW( TextWriter^ writer, String^ tabString ) - : HtmlTextWriter( writer, tabString ) - {} - - -protected: - - // - // Override the RenderBeforeContent method to write - // a font element that applies red to the text in a Label element. - - virtual String^ RenderBeforeContent() override - { - - // Check to determine whether the element being rendered - // is a label element. If so, render the opening tag - // of the font element; otherwise, call the base method. - if ( TagKey == HtmlTextWriterTag::Label ) - { - return ""; - } - else - { - return __super::RenderBeforeContent(); - } - } - - - // - // - // Override the RenderAfterContent method to render - // the closing tag of a font element if the - // rendered tag is a label element. - - virtual String^ RenderAfterContent() override - { - - // Check to determine whether the element being rendered - // is a label element. If so, render the closing tag - // of the font element; otherwise, call the base method. - if ( TagKey == HtmlTextWriterTag::Label ) - { - return ""; - } - else - { - return __super::RenderAfterContent(); - } - } - - // -}; - -// diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp deleted file mode 100644 index e9cca79b0ef..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::UI; -using namespace System::Web::UI::WebControls; - -// Create a custom markup writer that overrides two versions -// of the RenderBeginTag method and one version of the -// RenderEndTag method. -public ref class HtmlStyledLabelWriter: public HtmlTextWriter -{ -private: - TextWriter^ writer; - -public: - HtmlStyledLabelWriter( TextWriter^ writer ) - : HtmlTextWriter( writer ) - { - this->writer = writer; - } - - HtmlStyledLabelWriter( TextWriter^ writer, String^ tabString ) - : HtmlTextWriter( writer, tabString ) - { - this->writer = writer; - } - - // - virtual void RenderBeginTag( HtmlTextWriterTag tagKey ) override - { - // - // - // If the markup element being rendered is a Label, - // render the opening tag of a element before it. - if ( tagKey == HtmlTextWriterTag::Label ) - { - - // Check whether a Color style attribute is - // included on the Label. If not, use the - // AddStyleAttribute and GetStyleName methods to add one - // and set its value to red. - if ( !IsStyleAttributeDefined( HtmlTextWriterStyle::Color ) ) - { - AddStyleAttribute( GetStyleName( HtmlTextWriterStyle::Color ), "red" ); - } - - // - Write( TagLeftChar ); - - // - // Use the GetTagName method to associate - // the Font element with its HtmlTextWriteTag - // enumeration value in a Write method call. - Write( GetTagName( HtmlTextWriterTag::Font ) ); - - // - Write( SpaceChar ); - - // - // Use the GetAttributeName method to associate - // the Size attribute with its HtmlTextWriteAttribute - // enumeration value in a Write method call. - Write( GetAttributeName( HtmlTextWriterAttribute::Size ) ); - // - Write( EqualsChar ); - Write( DoubleQuoteChar ); - Write( "30pt" ); - Write( DoubleQuoteChar ); - Write( TagRightChar ); - // - // Close the Font element. - WriteEndTag( GetTagName( HtmlTextWriterTag::Font ) ); - // - } - - - // - // Call the base class's RenderBeginTag method. - __super::RenderBeginTag( tagKey ); - } - - - // - // - virtual void RenderBeginTag( String^ tagName ) override - { - - // Call the overloaded RenderBeginTag(HtmlTextWriterTag) method. - RenderBeginTag( GetTagKey( tagName ) ); - } - // - - // - virtual void RenderEndTag() override - { - - // Call the RenderEndTag method of the base class. - __super::RenderEndTag(); - - // If the element being rendered is a Label, - // call the PopEndTag method to write its closing tag. - if ( TagKey == HtmlTextWriterTag::Label ) - { - Write( PopEndTag() ); - } - } - // -}; -// - -// -// A custom class that overrides its CreateHtmlTextWriter method. -// This page uses the StyledLabelHtmlWriter class to render its content. -public ref class MyPage: public Page -{ -protected: - virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override - { - return gcnew HtmlStyledLabelWriter( writer ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp deleted file mode 100644 index 04f022b0ab7..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::UI; -using namespace System::Web::UI::WebControls; - -public ref class htwFour: public HtmlTextWriter -{ -public: - htwFour( TextWriter^ writer ) - : HtmlTextWriter( writer ) - {} - - htwFour( TextWriter^ writer, String^ tabString ) - : HtmlTextWriter( writer, tabString ) - {} - -protected: - - // - // Override the RenderBeforeTag method to add the - // opening tag of a Font element before the - // opening tag of any Label elements rendered by this - // custom markup writer. - virtual String^ RenderBeforeTag() override - { - // Compare the TagName property value to the - // String* label to determine whether the element to - // be rendered is a Label. If it is a Label, - // the opening tag of the Font element, with a Color - // style attribute set to red, is added before - // the Label. - if ( String::Compare( TagName, "label" ) == 0 ) - { - return ""; - } - // If a Label is not being rendered, use - // the base RenderBeforeTag method. - else - { - return __super::RenderBeforeTag(); - } - } - // - - // - // Override the RenderAfterTag method to add the - // closing tag of the Font element after the - // closing tag of a Label element has been rendered. - virtual String^ RenderAfterTag() override - { - // Compare the TagName property value to the - // String* label to determine whether the element to - // be rendered is a Label. If it is a Label, - // the closing tag of a Font element is rendered - // after the closing tag of the Label element. - if ( String::Compare( TagName, "label" ) == 0 ) - { - return ""; - } - // If a Label is not being rendered, use - // the base RenderAfterTag method. - else - { - return __super::RenderAfterTag(); - } - } - // -}; - -public ref class ctlMessage: public WebControl -{ -private: - - // The message property. - String^ myMessage; - -public: - ctlMessage() - { - myMessage = "Hello"; - } - - property String^ Message - { - // Accessors for the message property. - virtual String^ get() - { - return myMessage; - } - - virtual void set( String^ value ) - { - myMessage = value; - } - } - -protected: - virtual void Render( HtmlTextWriter^ writer ) override - { - // Write the contents of the control. - writer->RenderBeginTag( HtmlTextWriterTag::Label ); - writer->Write( Message ); - writer->RenderEndTag(); - writer->Write( "
The time on the server: {0}", System::DateTime::Now.ToLongTimeString() ); - } -}; - -public ref class MyPage: public Page -{ -protected: - virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override - { - return gcnew htwFour( writer ); - } -}; diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp deleted file mode 100644 index a45b6c0abeb..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Web::UI; -using namespace System::Web::UI::WebControls; -public ref class FirstControl: public WebControl -{ -private: - - // The message property. - String^ myMessage; - -public: - FirstControl() - { - myMessage = "Hello"; - } - - - property String^ Message - { - - // Accessors for the message property. - virtual String^ get() - { - return myMessage; - } - - virtual void set( String^ value ) - { - myMessage = value; - } - - } - -protected: - - // - // Override a control's Render method to determine what it - // displays when included in a Web Forms page. - virtual void Render( HtmlTextWriter^ writer ) override - { - - // - // Get the value of the current markup writer's - // Encoding property, convert it to a string, and - // write it to the markup stream. - writer->Write( String::Concat( "Encoding : ", writer->Encoding, "
" ) ); - - //
- // - // Write the opening tag of a Font element. - writer->WriteBeginTag( "font" ); - - // Write a Color style attribute to the opening tag - // of the Font element and set its value to red. - writer->WriteAttribute( "color", "red" ); - - // Write the closing character for the opening tag of - // the Font element. - writer->Write( '>' ); - - // Use the InnerWriter property to create a TextWriter - // object that will write the content found between - // the opening and closing tags of the Font element. - // Message is a string property of the control that - // overrides the Render method. - TextWriter^ innerTextWriter = writer->InnerWriter; - innerTextWriter->Write( String::Concat( Message, "
The time on the server : ", System::DateTime::Now.ToLongTimeString() ) ); - - // Write the closing tag of the Font element. - writer->WriteEndTag( "font" ); - } - - //
-}; - -//
diff --git a/snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp b/snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp deleted file mode 100644 index eb40dc1759d..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::WebControls; - -public ref class MyControl: public Control -{ -protected: - virtual void Render( HtmlTextWriter^ writer ) override - { - // - writer->AddAttribute( HtmlTextWriterAttribute::Onclick, "alert('Hello');" ); - // - writer->AddAttribute( "myattribute", "MyAttributeValue" ); - // - writer->AddStyleAttribute( HtmlTextWriterStyle::Color, "Red" ); - // - writer->AddStyleAttribute( "mystyleattr", "StyleValue" ); - writer->RenderBeginTag( HtmlTextWriterTag::Span ); - writer->WriteLine(); - writer->Indent++; - - writer->Write( "Hello" ); - writer->WriteLine(); - - // - // Control the encoding of attributes. - // Simple known values do not need encoding. - writer->AddAttribute( HtmlTextWriterAttribute::Alt, "Encoding, \"Required\"", true ); - writer->AddAttribute( "myattribute", "No "encoding " required", false ); - writer->RenderBeginTag( HtmlTextWriterTag::Img ); - writer->RenderEndTag(); - writer->WriteLine(); - // - - // - // Create a non-standard tag. - writer->RenderBeginTag( "MyTag" ); - writer->Write( "Contents of MyTag" ); - writer->RenderEndTag(); - writer->WriteLine(); - // - - // - // Create a manually rendered tag. - writer->WriteBeginTag( "img" ); - writer->WriteAttribute( "alt", "AtlValue" ); - writer->WriteAttribute( "myattribute", "No "encoding " required", false ); - writer->Write( HtmlTextWriter::TagRightChar ); - writer->WriteEndTag( "img" ); - // - writer->WriteLine(); - - writer->Indent--; - writer->RenderEndTag(); - } -}; diff --git a/snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp b/snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp deleted file mode 100644 index 9a6f6824ce3..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp +++ /dev/null @@ -1,103 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Web::UI; -using namespace System::Web::UI::Design; -using namespace System::Web::UI::WebControls; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -// -// Example designer provides a designer verb menu command to launch the -// BuildUrl method of the UrlBuilder. -public ref class UrlBuilderDesigner: public UserControlDesigner -{ -public: - UrlBuilderDesigner(){} - - - property DesignerVerbCollection^ Verbs - { - - // Provides a designer verb menu command for invoking the BuildUrl - // method of the UrlBuilder. - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - virtual DesignerVerbCollection^ get() override - { - DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; - dvc->Add( gcnew DesignerVerb( "Launch URL Builder UI",gcnew EventHandler( this, &UrlBuilderDesigner::launchUrlBuilder ) ) ); - return dvc; - } - - } - -private: - - // This method handles the "Launch Url Builder UI" menu command. - // Invokes the BuildUrl method of the System::Web::UI::Design.UrlBuilder. - void launchUrlBuilder( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // - // Create a parent control. - System::Windows::Forms::Control^ c = gcnew System::Windows::Forms::Control; - c->CreateControl(); - - // Launch the Url Builder using the specified control - // parent, initial URL, empty relative base URL path, - // window caption, filter String* and URLBuilderOptions value. - UrlBuilder::BuildUrl( this->Component, c, "http://www.example.com", "Select a URL", "", UrlBuilderOptions::None ); - - // - } - -}; - - -// Example Web control displays the value of its text property. -// This control is associated with the UrlBuilderDesigner. - -[DesignerAttribute(UrlBuilderDesigner::typeid,IDesigner::typeid)] -public ref class UrlBuilderControl: public WebControl -{ -private: - String^ text; - -public: - - property String^ Text - { - - [Bindable(true), - Category("Appearance"), - DefaultValue("")] - String^ get() - { - return text; - } - - void set( String^ value ) - { - text = value; - } - - } - -protected: - virtual void Render( HtmlTextWriter^ output ) override - { - output->Write( Text ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp b/snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp deleted file mode 100644 index 7ce2f1e7822..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp +++ /dev/null @@ -1,219 +0,0 @@ -// -#using -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Collections::Specialized; -using namespace System::Configuration; -using namespace System::Data; -using namespace System::Data::OleDb; -using namespace System::Security::Permissions; -using namespace System::Web; - -/// An extremely simple AccessSiteMapProvider that only supports a -/// site map node hierarchy 1 level deep. - -[AspNetHostingPermission(SecurityAction::Demand,Level=AspNetHostingPermissionLevel::Minimal)] -public ref class AccessSiteMapProvider: public StaticSiteMapProvider -{ -private: - SiteMapNode ^ rootNode; - OleDbConnection^ accessConnection; - - // This string is case sensitive. - String^ AccessConnectionStringName; - -public: - // Implement a default constructor. - AccessSiteMapProvider() - { - initialized = false; - AccessConnectionStringName = "accessSiteMapConnectionString"; - } - - -private: - - // Some basic state to help track the initialization state of the provider. - bool initialized; - -public: - - property bool IsInitialized - { - virtual bool get() - { - return initialized; - } - - } - - property SiteMapNode ^ RootNode - { - - // - // Return the root node of the current site map. - virtual SiteMapNode ^ get() override - { - SiteMapNode ^ temp = nullptr; - temp = BuildSiteMap(); - return temp; - } - - } - -protected: - - // - // - virtual SiteMapNode ^ GetRootNodeCore() override - { - return RootNode; - } - - -public: - - // - // - // Initialize is used to initialize the properties and any state that the - // AccessProvider holds, but is not used to build the site map. - // The site map is built when the BuildSiteMap method is called. - virtual void Initialize( String^ name, NameValueCollection^ attributes ) override - { - if ( IsInitialized ) - return; - - StaticSiteMapProvider::Initialize( name, attributes ); - - // Create and test the connection to the Microsoft Access database. - // Retrieve the Value of the Access connection string from the - // attributes NameValueCollection. - String^ connectionString = attributes[ AccessConnectionStringName ]; - if ( nullptr == connectionString || connectionString->Length == 0 ) - throw gcnew Exception( "The connection string was not found." ); - else - accessConnection = gcnew OleDbConnection( connectionString ); - - initialized = true; - } - - -protected: - - // - /// - /// SiteMapProvider and StaticSiteMapProvider methods that this derived class must override. - /// - // - // Clean up any collections or other state that an instance of this may hold. - virtual void Clear() override - { - System::Threading::Monitor::Enter( this ); - try - { - rootNode = nullptr; - StaticSiteMapProvider::Clear(); - } - finally - { - System::Threading::Monitor::Exit( this ); - } - - } - - -public: - - // - // - // Build an in-memory representation from persistent - // storage, and return the root node of the site map. - virtual SiteMapNode ^ BuildSiteMap() override - { - // Since the SiteMap class is static, make sure that it is - // not modified while the site map is built. - System::Threading::Monitor::Enter( this ); - try - { - - // If there is no initialization, this method is being - // called out of order. - if ( !IsInitialized ) - { - throw gcnew Exception( "BuildSiteMap called incorrectly." ); - } - - // If there is no root node, then there is no site map. - if ( nullptr == rootNode ) - { - - // Start with a clean slate - Clear(); - - // Select the root node of the site map from Microsoft Access. - int rootNodeId = -1; - if ( accessConnection->State == ConnectionState::Closed ) - accessConnection->Open(); - - // - OleDbCommand^ rootNodeCommand = gcnew OleDbCommand - ("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid IS NULL", accessConnection); - OleDbDataReader^ rootNodeReader = rootNodeCommand->ExecuteReader(); - if ( rootNodeReader->HasRows ) - { - rootNodeReader->Read(); - rootNodeId = rootNodeReader->GetInt32( 0 ); - - // Create a SiteMapNode that references the current StaticSiteMapProvider. - rootNode = gcnew SiteMapNode(this, rootNodeId.ToString(), - rootNodeReader->GetString( 1 ),rootNodeReader->GetString( 2 )); - } - else - return nullptr; - rootNodeReader->Close(); - - // - // Select the child nodes of the root node. - OleDbCommand^ childNodesCommand = gcnew OleDbCommand - ("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid = ?", accessConnection); - OleDbParameter^ rootParam = gcnew OleDbParameter( "parentid", OleDbType::Integer); - rootParam->Value = rootNodeId; - childNodesCommand->Parameters->Add( rootParam ); - OleDbDataReader^ childNodesReader = childNodesCommand->ExecuteReader(); - if ( childNodesReader->HasRows ) - { - SiteMapNode ^ childNode = nullptr; - while ( childNodesReader->Read() ) - { - childNode = gcnew SiteMapNode( this, - System::Convert::ToString(childNodesReader->GetInt32( 0 )), - childNodesReader->GetString( 1 ), - childNodesReader->GetString( 2 ) - ); - // Use the SiteMapNode AddNode method to add - // the SiteMapNode to the ChildNodes collection. - AddNode( childNode, rootNode ); - } - } - childNodesReader->Close(); - accessConnection->Close(); - } - return rootNode; - } - finally - { - System::Threading::Monitor::Exit( this ); - } - - } - - // -}; - -// diff --git a/snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp b/snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp deleted file mode 100644 index edabd5de573..00000000000 --- a/snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp +++ /dev/null @@ -1,175 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Web::UI; -using namespace System::Web::UI::Design; -using namespace System::Web::UI::WebControls; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; - -[DefaultProperty("Text"), -ToolboxData("< {0}:WebCustomControl1 runat=server>")] -public ref class WebCustomControl1: public WebControl -{ -private: - String^ text; - - // -public: - property String^ URL - { - - [EditorAttribute(UrlEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return http_url; - } - - [EditorAttribute(UrlEditor::typeid,UITypeEditor::typeid)] - void set( String^ value ) - { - http_url = value; - } - } - -private: - String^ http_url; - // - - // -private: - property String^ XmlFile - { - [EditorAttribute(XmlFileEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return xml_; - } - - [EditorAttribute(XmlFileEditor::typeid,UITypeEditor::typeid)] - void set( String^ value ) - { - xml_ = value; - } - } - String^ xml_; - // - - // -public: - property String^ XmlFileURL - { - [EditorAttribute(XmlUrlEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return xmlURL; - } - - - [EditorAttribute(XmlUrlEditor::typeid,UITypeEditor::typeid)] - void set( String^ value ) - { - xmlURL = value; - } - - } - -private: - String^ xmlURL; - // - - // -public: - property String^ XslFileURL - { - [EditorAttribute(XslUrlEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return xslURL; - } - - [EditorAttribute(XslUrlEditor::typeid,UITypeEditor::typeid)] - void set( String^ value ) - { - xslURL = value; - } - } - -private: - String^ xslURL; - // - - // -public: - property String^ imageURL - { - [EditorAttribute(ImageUrlEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return imgURL; - } - - - [EditorAttribute(ImageUrlEditor::typeid,UITypeEditor::typeid)] - void set( String^ value ) - { - imgURL = value; - } - - } - -private: - String^ imgURL; - // - - // -public: - property DataBindingCollection^ TestDataBindings - { - [EditorAttribute(DataBindingCollectionEditor::typeid, - UITypeEditor::typeid)] - DataBindingCollection^ get() - { - return testBindings; - } - - [EditorAttribute(DataBindingCollectionEditor::typeid, - UITypeEditor::typeid)] - void set( DataBindingCollection^ value ) - { - testBindings = value; - } - } - -private: - DataBindingCollection^ testBindings; - // - -public: - property String^ Text - { - [Bindable(true),Category("Appearance"),DefaultValue("")] - String^ get() - { - return text; - } - - [Bindable(true),Category("Appearance"),DefaultValue("")] - void set( String^ value ) - { - text = value; - } - } - -protected: - virtual void Render( HtmlTextWriter^ output ) override - { - output->Write( Text ); - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp deleted file mode 100644 index a2a0d0c5792..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -// -ActiveDesignerEventArgs^ CreateActiveDesignerEventArgs( IDesignerHost^ losingFocus, IDesignerHost^ gainingFocus ) -{ - ActiveDesignerEventArgs^ e = gcnew ActiveDesignerEventArgs( losingFocus, gainingFocus ); - return e; -} -// - -void main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp deleted file mode 100644 index 0d74c1bfa4a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ActiveDesignerEventHandlerExample - { - private: - ActiveDesignerEventHandlerExample() - { - } - - // - public: - void LinkActiveDesignerEvent( IDesignerEventService^ eventService ) - { - // Registers an event handler for the ActiveDesignerChanged event. - eventService->ActiveDesignerChanged += gcnew ActiveDesignerEventHandler( this, &MiscCompModSamples::ActiveDesignerEventHandlerExample::OnActiveDesignerEvent ); - } - - private: - void OnActiveDesignerEvent( Object^ /*sender*/, ActiveDesignerEventArgs^ e ) - { - // Displays changed designer information on the console. - if ( e->NewDesigner->RootComponent->Site != nullptr ) - { - Console::WriteLine( "Name of the component of the new active designer: {0}", e->NewDesigner->RootComponent->Site->Name ); - } - Console::WriteLine( "Type of the component of the new active designer: {0}", e->NewDesigner->RootComponentClassName ); - if ( e->OldDesigner->RootComponent->Site != nullptr ) - { - Console::WriteLine( "Name of the component of the previously active designer: {0}", e->OldDesigner->RootComponent->Site->Name ); - } - Console::WriteLine( "Type of the component of the previously active designer: {0}", e->OldDesigner->RootComponentClassName ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp b/snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp deleted file mode 100644 index 2753f97d6e8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp +++ /dev/null @@ -1,335 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -namespace AngleEditor -{ - // Provides a user interface for adjusting an angle value. - ref class AngleControl: public System::Windows::Forms::UserControl - { - public: - - // Stores the angle. - double angle; - - private: - - // Stores the rotation offset. - int rotation; - - // Control state tracking variables. - int dbx; - int dby; - int overButton; - - public: - AngleControl( double initial_angle ) - { - this->angle = initial_angle; - this->SetStyle( static_cast(ControlStyles::AllPaintingInWmPaint), true ); - rotation = 0; - dbx = -10; - dby = -10; - overButton = -1; - } - - protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - // Set angle origin point at center of control. - int originX = (this->Width / 2); - int originY = (this->Height / 2); - - // Fill background and ellipse and center point. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkBlue ), 0, 0, this->Width, this->Height ); - e->Graphics->FillEllipse( gcnew SolidBrush( Color::White ), 1, 1, this->Width - 3, this->Height - 3 ); - e->Graphics->FillEllipse( gcnew SolidBrush( Color::SlateGray ), originX - 1, originY - 1, 3, 3 ); - - // Draw angle markers. - int startangle = (270 - rotation) % 360; - e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8.0 ), gcnew SolidBrush( Color::DarkGray ), (float)(this->Width / 2) - 10, (float)10 ); - startangle = (startangle + 90) % 360; - e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::DarkGray ), (float)this->Width - 18, (float)(this->Height / 2) - 6 ); - startangle = (startangle + 90) % 360; - e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::DarkGray ), ((float)this->Width / 2) - 6, (float)this->Height - 18 ); - startangle = (startangle + 90) % 360; - e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::DarkGray ), (float)10, (float)(this->Height / 2) - 6 ); - - // Draw line along the current angle. - double radians = ((((int)(angle + rotation) + 360) % 360) * Math::PI) / (double)180; - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Red ),1 ), originX, originY, originX + (int)((double)originX * (double)Math::Cos( radians )), originY + (int)((double)originY * (double)Math::Sin( radians )) ); - - // Output angle information. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Gray ), this->Width - 84, 3, 82, 13 ); - e->Graphics->DrawString( String::Format( "Angle: {0}", angle.ToString( "F4" ) ), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Yellow ), (float)this->Width - 84, (float)2 ); - - // Draw square at mouse position of last angle adjustment. - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), dbx - 2, dby - 2, 4, 4 ); - - // Draw rotation adjustment buttons. - if ( overButton == 1 ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 28, this->Height - 14, 12, 12 ); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Gray ), 2, this->Height - 13, 110, 12 ); - e->Graphics->DrawString( "Rotate 90 degrees left", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::White ), (float)2, (float)this->Height - 14 ); - } - else - e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 28, this->Height - 14, 12, 12 ); - - if ( overButton == 2 ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 14, this->Height - 14, 12, 12 ); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Gray ), 2, this->Height - 13, 116, 12 ); - e->Graphics->DrawString( "Rotate 90 degrees right", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::White ), (float)2, (float)this->Height - 14 ); - } - else - e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 14, this->Height - 14, 12, 12 ); - - e->Graphics->DrawEllipse( gcnew Pen( gcnew SolidBrush( Color::White ),1 ), this->Width - 11, this->Height - 11, 6, 6 ); - e->Graphics->DrawEllipse( gcnew Pen( gcnew SolidBrush( Color::White ),1 ), this->Width - 25, this->Height - 11, 6, 6 ); - if ( overButton == 1 ) - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 25, this->Height - 6, 4, 4 ); - else - e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 25, this->Height - 6, 4, 4 ); - - if ( overButton == 2 ) - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 8, this->Height - 6, 4, 4 ); - else - e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 8, this->Height - 6, 4, 4 ); - - array^ temp0 = {Point(this->Width - 7,this->Height - 8),Point(this->Width - 3,this->Height - 8),Point(this->Width - 5,this->Height - 4)}; - e->Graphics->FillPolygon( gcnew SolidBrush( Color::White ), temp0 ); - array^ temp1 = {Point(this->Width - 26,this->Height - 8),Point(this->Width - 21,this->Height - 8),Point(this->Width - 25,this->Height - 4)}; - e->Graphics->FillPolygon( gcnew SolidBrush( Color::White ), temp1 ); - } - - virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) override - { - // Handle rotation adjustment button clicks. - if ( e->X >= this->Width - 28 && e->X <= this->Width - 2 && e->Y >= this->Height - 14 && e->Y <= this->Height - 2 ) - { - if ( e->X <= this->Width - 16 ) - rotation -= 90; - else - if ( e->X >= this->Width - 14 ) - rotation += 90; - - if ( rotation < 0 ) - rotation += 360; - - rotation = rotation % 360; - dbx = -10; - dby = -10; - } - else - UpdateAngle( e->X, e->Y ); - - this->Refresh(); - } - - virtual void OnMouseMove( System::Windows::Forms::MouseEventArgs^ e ) override - { - if ( e->Button == ::MouseButtons::Left ) - { - UpdateAngle( e->X, e->Y ); - overButton = -1; - } - else - if ( e->X >= this->Width - 28 && e->X <= this->Width - 16 && e->Y >= this->Height - 14 && e->Y <= this->Height - 2 ) - overButton = 1; - else - if ( e->X >= this->Width - 14 && e->X <= this->Width - 2 && e->Y >= this->Height - 14 && e->Y <= this->Height - 2 ) - overButton = 2; - else - overButton = -1; - - this->Refresh(); - } - - private: - void UpdateAngle( int mx, int my ) - { - // Store mouse coordinates. - dbx = mx; - dby = my; - - // Translate y coordinate input to GetAngle function to correct for ellipsoid distortion. - double widthToHeightRatio = (double)this->Width / (double)this->Height; - int tmy; - if ( my == 0 ) - tmy = my; - else - if ( my < this->Height / 2 ) - tmy = (this->Height / 2) - (int)(((this->Height / 2) - my) * widthToHeightRatio); - else - tmy = (this->Height / 2) + (int)((double)(my - (this->Height / 2)) * widthToHeightRatio); - - // Retrieve updated angle based on rise over run. - angle = (int)(GetAngle( this->Width / 2, this->Height / 2, mx, tmy ) - rotation) % 360; - } - - double GetAngle( int x1, int y1, int x2, int y2 ) - { - double degrees; - - // Avoid divide by zero run values. - if ( x2 - x1 == 0 ) - { - if ( y2 > y1 ) - degrees = 90; - else - degrees = 270; - } - else - { - // Calculate angle from offset. - double riseoverrun = (double)(y2 - y1) / (double)(x2 - x1); - double radians = Math::Atan( riseoverrun ); - degrees = radians * ((double)180 / Math::PI); - - // Handle quadrant specific transformations. - if ( (x2 - x1) < 0 || (y2 - y1) < 0 ) - degrees += 180; - - if ( (x2 - x1) > 0 && (y2 - y1) < 0 ) - degrees -= 180; - - if ( degrees < 0 ) - degrees += 360; - } - - return degrees; - } - }; - - // This UITypeEditor can be associated with Int32, Double and Single - // properties to provide a design-mode angle selection interface. - [System::Security::Permissions::PermissionSetAttribute - (System::Security::Permissions::SecurityAction::InheritanceDemand, Name="FullTrust")] - [System::Security::Permissions::PermissionSetAttribute - (System::Security::Permissions::SecurityAction::LinkDemand, Name="FullTrust")] - public ref class AngleEditor: public System::Drawing::Design::UITypeEditor - { - public: - AngleEditor(){} - - // Indicates whether the UITypeEditor provides a form-based (modal) dialog, - // drop down dialog, or no UI outside of the properties window. - virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle( System::ComponentModel::ITypeDescriptorContext^ context ) override - { - return UITypeEditorEditStyle::DropDown; - } - - // Displays the UI for value selection. - virtual Object^ EditValue( System::ComponentModel::ITypeDescriptorContext^ context, System::IServiceProvider^ provider, Object^ value ) override - { - // Return the value if the value is not of type Int32, Double and Single. - if ( value->GetType() != double::typeid && value->GetType() != float::typeid && value->GetType() != int::typeid ) - return value; - - // Uses the IWindowsFormsEditorService* to display a - // drop-down UI in the Properties window. - IWindowsFormsEditorService^ edSvc = dynamic_cast(provider->GetService( IWindowsFormsEditorService::typeid )); - if ( edSvc != nullptr ) - { - // Display an angle selection control and retrieve the value. - AngleControl^ angleControl = gcnew AngleControl( *dynamic_cast(value) ); - edSvc->DropDownControl( angleControl ); - - // Return the value in the appropraite data format. - if ( value->GetType() == double::typeid ) - return angleControl->angle; - else - if ( value->GetType() == float::typeid ) - return (float)angleControl->angle; - else - if ( value->GetType() == int::typeid ) - return (int)angleControl->angle; - } - - return value; - } - - // Draws a representation of the property's value. - private: - void PaintValue( System::Drawing::Design::PaintValueEventArgs^ e ) new - { - int normalX = (e->Bounds.Width / 2); - int normalY = (e->Bounds.Height / 2); - - // Fill background and ellipse and center point. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkBlue ), e->Bounds.X, e->Bounds.Y, e->Bounds.Width, e->Bounds.Height ); - e->Graphics->FillEllipse( gcnew SolidBrush( Color::White ), e->Bounds.X + 1, e->Bounds.Y + 1, e->Bounds.Width - 3, e->Bounds.Height - 3 ); - e->Graphics->FillEllipse( gcnew SolidBrush( Color::SlateGray ), normalX + e->Bounds.X - 1, normalY + e->Bounds.Y - 1, 3, 3 ); - - // Draw line along the current angle. - double radians = ( *dynamic_cast(e->Value) * Math::PI) / (double)180; - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Red ),1 ), normalX + e->Bounds.X, normalY + e->Bounds.Y, e->Bounds.X + (normalX + (int)((double)normalX * Math::Cos( radians ))), e->Bounds.Y + (normalY + (int)((double)normalY * Math::Sin( radians ))) ); - } - - // Indicates whether the UITypeEditor supports painting a - // representation of a property's value. - bool GetPaintValueSupported( System::ComponentModel::ITypeDescriptorContext^ context ) new - { - return true; - } - }; - - public ref class AngleEditorTestControl: public System::Windows::Forms::UserControl - { - private: - double int_angle; - - public: - - property double Angle - { - [BrowsableAttribute(true)] - [EditorAttribute(AngleEditor::typeid,System::Drawing::Design::UITypeEditor::typeid)] - double get() - { - return int_angle; - } - - void set( double value ) - { - int_angle = value; - } - - } - AngleEditorTestControl() - { - int_angle = 90; - this->Size = System::Drawing::Size( 190, 42 ); - this->BackColor = Color::Beige; - } - - protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - if ( this->DesignMode ) - { - e->Graphics->DrawString( "Use the Properties Window to access", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 2 ); - e->Graphics->DrawString( "the AngleEditor UITypeEditor by", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 14 ); - e->Graphics->DrawString( "configuring the \"Angle\" property.", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 26 ); - } - else - e->Graphics->DrawString( "This example requires design mode.", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 2 ); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp b/snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp deleted file mode 100644 index 0cc04b2c92e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp +++ /dev/null @@ -1,321 +0,0 @@ -//AppSettingsSample C# sample, flattened to one file for Parsnip. - - // - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Configuration; -using namespace System::Windows::Forms; - -namespace AppSettingsSample -{ - // - //Application settings wrapper class - ref class FormSettings sealed: public ApplicationSettingsBase - { - public: - [UserScopedSettingAttribute()] - property String^ FormText - { - String^ get() - { - return (String^)this["FormText"]; - } - void set( String^ value ) - { - this["FormText"] = value; - } - } - - // - public: - [UserScopedSettingAttribute()] - [DefaultSettingValueAttribute("0, 0")] - property Point FormLocation - { - Point get() - { - return (Point)(this["FormLocation"]); - } - void set( Point value ) - { - this["FormLocation"] = value; - } - } - // - - public: - [UserScopedSettingAttribute()] - [DefaultSettingValueAttribute("225, 200")] - property Size FormSize - { - Size get() - { - return (Size)this["FormSize"]; - } - void set( Size value ) - { - this["FormSize"] = value; - } - } - - public: - [UserScopedSettingAttribute()] - [DefaultSettingValueAttribute("LightGray")] - property Color FormBackColor - { - Color get() - { - return (Color)this["FormBackColor"]; - } - void set(Color value) - { - this["FormBackColor"] = value; - } - } - - }; - // - - ref class AppSettingsForm : Form - { - /// - /// Required designer variable. - /// - private: - System::ComponentModel::IContainer^ components; - - /// - /// Clean up any resources being used. The Dispose(true) - /// pattern for embedded objects is implemented with this - /// code that just contains a destructor - /// - public: - ~AppSettingsForm() - { - if (components != nullptr) - { - delete components; - } - } - -#pragma region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private: - void InitializeComponent() - { - this->components = nullptr; - this->colorDialog = gcnew System::Windows::Forms::ColorDialog(); - this->backColorButton = gcnew System::Windows::Forms::Button(); - this->resetButton = gcnew System::Windows::Forms::Button(); - this->statusDisplay = gcnew System::Windows::Forms::TextBox(); - this->reloadButton = gcnew System::Windows::Forms::Button(); - this->SuspendLayout(); - // - // backColorButton - // - this->backColorButton->Location = System::Drawing::Point(26, 24); - this->backColorButton->Name = "backColorButton"; - this->backColorButton->Size = System::Drawing::Size(159, 23); - this->backColorButton->TabIndex = 0; - this->backColorButton->Text = "Change Background Color"; - this->backColorButton->Click += gcnew System::EventHandler - (this,&AppSettingsForm::BackColorButton_Click); - // - // resetButton - // - this->resetButton->Location = System::Drawing::Point(26, 90); - this->resetButton->Name = "resetButton"; - this->resetButton->Size = System::Drawing::Size(159, 23); - this->resetButton->TabIndex = 1; - this->resetButton->Text = "Reset to Defaults"; - this->resetButton->Click += gcnew System::EventHandler - (this,&AppSettingsForm::ResetButton_Click); - // - // statusDisplay - // - this->statusDisplay->Location = System::Drawing::Point(26, 123); - this->statusDisplay->Name = "statusDisplay"; - this->statusDisplay->Size = System::Drawing::Size(159, 20); - this->statusDisplay->TabIndex = 2; - // - // reloadButton - // - this->reloadButton->Location = System::Drawing::Point(26, 57); - this->reloadButton->Name = "reloadButton"; - this->reloadButton->Size = System::Drawing::Size(159, 23); - this->reloadButton->TabIndex = 3; - this->reloadButton->Text = "Reload from Storage"; - this->reloadButton->Click += gcnew System::EventHandler - (this,&AppSettingsForm::ReloadButton_Click); - // - // AppSettingsForm - // - this->ClientSize = System::Drawing::Size(217, 166); - this->Controls->Add(this->reloadButton); - this->Controls->Add(this->statusDisplay); - this->Controls->Add(this->resetButton); - this->Controls->Add(this->backColorButton); - this->Name = "AppSettingsForm"; - this->Text = "App Settings"; - this->FormClosing += gcnew - System::Windows::Forms::FormClosingEventHandler - (this,&AppSettingsForm::AppSettingsForm_FormClosing); - this->Load += gcnew System::EventHandler(this, - &AppSettingsForm::AppSettingsForm_Load); - this->ResumeLayout(false); - this->PerformLayout(); - - } - -#pragma endregion - - // - private: - System::Windows::Forms::ColorDialog^ colorDialog; - - System::Windows::Forms::Button^ backColorButton; - - System::Windows::Forms::Button^ resetButton; - - System::Windows::Forms::TextBox^ statusDisplay; - - System::Windows::Forms::Button^ reloadButton; - // - - - - FormSettings ^ formSettings; - - public: - AppSettingsForm() - { - formSettings = gcnew FormSettings; - InitializeComponent(); - } - - // - private: - void AppSettingsForm_Load(Object^ sender, EventArgs^ e) - { - // - //Associate settings property event handlers. - formSettings->SettingChanging += gcnew SettingChangingEventHandler( - this, &AppSettingsForm::FormSettings_SettingChanging); - formSettings->SettingsSaving += gcnew SettingsSavingEventHandler( - this,&AppSettingsForm::FormSettings_SettingsSaving); - // - - // - //Data bind settings properties with straightforward associations. - Binding^ backColorBinding = gcnew Binding("BackColor", - formSettings, "FormBackColor", true, - DataSourceUpdateMode::OnPropertyChanged); - this->DataBindings->Add(backColorBinding); - Binding^ sizeBinding = gcnew Binding("Size", formSettings, - "FormSize", true, DataSourceUpdateMode::OnPropertyChanged); - this->DataBindings->Add(sizeBinding); - Binding^ locationBinding = gcnew Binding("Location", formSettings, - "FormLocation", true, DataSourceUpdateMode::OnPropertyChanged); - this->DataBindings->Add(locationBinding); - - //For more complex associations, manually assign associations. - String^ savedText = formSettings->FormText; - //Since there is no default value for FormText. - if (savedText != nullptr) - { - this->Text = savedText; - } - // - } - // - - // - private: - void AppSettingsForm_FormClosing(Object^ sender, - FormClosingEventArgs^ e) - { - //Synchronize manual associations first. - formSettings->FormText = this->Text + '.'; - formSettings->Save(); - } - // - - // - private: - void BackColorButton_Click(Object^ sender, EventArgs^ e) - { - if (::DialogResult::OK == colorDialog->ShowDialog()) - { - Color color = colorDialog->Color; - this->BackColor = color; - } - } - // - - // - private: - void ResetButton_Click(Object^ sender, EventArgs^ e) - { - formSettings->Reset(); - this->BackColor = SystemColors::Control; - } - // - - // - private: - void ReloadButton_Click(Object^ sender, EventArgs^ e) - { - formSettings->Reload(); - } - // - - // - private: - void FormSettings_SettingChanging(Object^ sender, - SettingChangingEventArgs^ e) - { - statusDisplay->Text = e->SettingName + ": " + e->NewValue; - } - // - - // - private: - void FormSettings_SettingsSaving(Object^ sender, - CancelEventArgs^ e) - { - //Should check for settings changes first. - ::DialogResult^ dialogResult = MessageBox::Show( - "Save current values for application settings?", - "Save Settings", MessageBoxButtons::YesNo); - if (::DialogResult::No == dialogResult) - { - e->Cancel = true; - } - } - // - }; - // -} - -/// -/// The main entry point for the application. -/// -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew AppSettingsSample::AppSettingsForm()); - -}; - - diff --git a/snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp deleted file mode 100644 index 0ee1a0e51ec..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using - -// -using namespace System; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -public: - Form1() - { - array^tabText = {"tabPage1","tabPage2"}; - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage( tabText[ 0 ] ); - TabPage^ tabPage2 = gcnew TabPage( tabText[ 1 ] ); - - // Sets the tabs to appear as buttons. - tabControl1->Appearance = TabAppearance::Buttons; - array^tabPageArray = {tabPage1,tabPage2}; - tabControl1->Controls->AddRange( tabPageArray ); - Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp deleted file mode 100644 index 8e199bdfb3a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp +++ /dev/null @@ -1,249 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -using namespace System::Text; -using namespace System::IO; - -// A simple form that represents a window in our application -public ref class AppForm2: public System::Windows::Forms::Form -{ -public: - AppForm2() - { - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "AppForm2"; - } - -}; - -// A simple form that represents a window in our application -public ref class AppForm1: public System::Windows::Forms::Form -{ -public: - AppForm1() - { - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "AppForm1"; - } - -}; - -// -// The class that handles the creation of the application windows -ref class MyApplicationContext: public ApplicationContext -{ -private: - int _formCount; - AppForm1^ _form1; - AppForm2^ _form2; - System::Drawing::Rectangle _form1Position; - System::Drawing::Rectangle _form2Position; - FileStream^ _userData; - -public: - - // - MyApplicationContext() - { - _formCount = 0; - - // Handle the ApplicationExit event to know when the application is exiting. - Application::ApplicationExit += gcnew EventHandler( this, &MyApplicationContext::OnApplicationExit ); - try - { - - // Create a file that the application will store user specific data in. - _userData = gcnew FileStream( String::Concat( Application::UserAppDataPath, "\\appdata.txt" ),FileMode::OpenOrCreate ); - } - catch ( IOException^ e ) - { - - // Inform the user that an error occurred. - MessageBox::Show( "An error occurred while attempting to show the application. The error is: {0}", dynamic_cast(e) ); - - // Exit the current thread instead of showing the windows. - ExitThread(); - } - - - // Create both application forms and handle the Closed event - // to know when both forms are closed. - _form1 = gcnew AppForm1; - _form1->Closed += gcnew EventHandler( this, &MyApplicationContext::OnFormClosed ); - _form1->Closing += gcnew CancelEventHandler( this, &MyApplicationContext::OnFormClosing ); - _formCount++; - _form2 = gcnew AppForm2; - _form2->Closed += gcnew EventHandler( this, &MyApplicationContext::OnFormClosed ); - _form2->Closing += gcnew CancelEventHandler( this, &MyApplicationContext::OnFormClosing ); - _formCount++; - - // Get the form positions based upon the user specific data. - if ( ReadFormDataFromFile() ) - { - - // If the data was read from the file, set the form - // positions manually. - _form1->StartPosition = FormStartPosition::Manual; - _form2->StartPosition = FormStartPosition::Manual; - _form1->Bounds = _form1Position; - _form2->Bounds = _form2Position; - } - - - // Show both forms. - _form1->Show(); - _form2->Show(); - } - - void OnApplicationExit( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // When the application is exiting, write the application data to the - // user file and close it. - WriteFormDataToFile(); - try - { - - // Ignore any errors that might occur while closing the file handle. - _userData->Close(); - } - catch ( Exception^ ) - { - } - - } - -private: - - // - void OnFormClosing( Object^ sender, CancelEventArgs^ /*e*/ ) - { - - // When a form is closing, remember the form position so it - // can be saved in the user data file. - if ( dynamic_cast(sender) != nullptr ) - _form1Position = (dynamic_cast(sender))->Bounds; - else - if ( dynamic_cast(sender) != nullptr ) - _form2Position = (dynamic_cast(sender))->Bounds; - } - - // - void OnFormClosed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // When a form is closed, decrement the count of open forms. - // When the count gets to 0, exit the app by calling - // ExitThread(). - _formCount--; - if ( _formCount == 0 ) - { - ExitThread(); - } - } - - // - bool WriteFormDataToFile() - { - - // Write the form positions to the file. - UTF8Encoding^ encoding = gcnew UTF8Encoding; - RectangleConverter^ rectConv = gcnew RectangleConverter; - String^ form1pos = rectConv->ConvertToString( _form1Position ); - String^ form2pos = rectConv->ConvertToString( _form2Position ); - array^dataToWrite = encoding->GetBytes( String::Concat( "~", form1pos, "~", form2pos ) ); - try - { - - // Set the write position to the start of the file and write - _userData->Seek( 0, SeekOrigin::Begin ); - _userData->Write( dataToWrite, 0, dataToWrite->Length ); - _userData->Flush(); - _userData->SetLength( dataToWrite->Length ); - return true; - } - catch ( Exception^ ) - { - - // An error occurred while attempting to write, return false. - return false; - } - - } - - bool ReadFormDataFromFile() - { - - // Read the form positions from the file. - UTF8Encoding^ encoding = gcnew UTF8Encoding; - String^ data; - if ( _userData->Length != 0 ) - { - array^dataToRead = gcnew array(_userData->Length); - try - { - - // Set the read position to the start of the file and read. - _userData->Seek( 0, SeekOrigin::Begin ); - _userData->Read( dataToRead, 0, dataToRead->Length ); - } - catch ( IOException^ e ) - { - String^ errorInfo = dynamic_cast(e); - - // An error occurred while attempt to read, return false. - return false; - } - - // Parse out the data to get the window rectangles - data = encoding->GetString( dataToRead ); - try - { - - // Convert the String* data to rectangles - RectangleConverter^ rectConv = gcnew RectangleConverter; - String^ form1pos = data->Substring( 1, data->IndexOf( "~", 1 ) - 1 ); - _form1Position = *safe_cast(rectConv->ConvertFromString( form1pos )); - String^ form2pos = data->Substring( data->IndexOf( "~", 1 ) + 1 ); - _form2Position = *safe_cast(rectConv->ConvertFromString( form2pos )); - return true; - } - catch ( Exception^ ) - { - - // Error occurred while attempting to convert the rectangle data. - // Return false to use default values. - return false; - } - } - else - { - - // No data in the file, return false to use default values. - return false; - } - } -}; -// - -// -[STAThread] -int main() -{ - - // Create the MyApplicationContext, that derives from ApplicationContext, - // that manages when the application should exit. - MyApplicationContext^ context = gcnew MyApplicationContext; - - // Run the application with the specific context. It will exit when - // all forms are closed. - Application::Run( context ); -} -// -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp deleted file mode 100644 index 33fb65ec266..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing::Design; - -namespace ArrayEditorExample -{ - public ref class ArrayEditorTestComponent: public Component - { - // - public: - property array^ componentArray - { - [EditorAttribute(System::ComponentModel::Design::ArrayEditor::typeid, - System::Drawing::Design::UITypeEditor::typeid)] - array^ get() - { - return compArray; - } - void set( array^ value ) - { - compArray = value; - } - } - private: - array^compArray; - // - - public: - ArrayEditorTestComponent() - { - array^ temp0 = {gcnew Component, gcnew Component, this}; - compArray = temp0; - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp b/snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp deleted file mode 100644 index 61ef4537216..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp +++ /dev/null @@ -1,179 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::SplitContainer^ splitContainer1; - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::SplitContainer^ splitContainer2; - System::Windows::Forms::ListView^ listView2; - System::Windows::Forms::ListView^ listView1; - -public: - Form1() - { - InitializeComponent(); - } - - -private: - void InitializeComponent() - { - splitContainer1 = gcnew System::Windows::Forms::SplitContainer; - treeView1 = gcnew System::Windows::Forms::TreeView; - splitContainer2 = gcnew System::Windows::Forms::SplitContainer; - listView1 = gcnew System::Windows::Forms::ListView; - listView2 = gcnew System::Windows::Forms::ListView; - splitContainer1->SuspendLayout(); - splitContainer2->SuspendLayout(); - SuspendLayout(); - - // - // Basic SplitContainer properties. - // This is a vertical splitter that moves in 10-pixel increments. - // This splitter needs no explicit Orientation property because Vertical is the default. - splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill; - splitContainer1->ForeColor = System::Drawing::SystemColors::Control; - splitContainer1->Location = System::Drawing::Point( 0, 0 ); - splitContainer1->Name = "splitContainer1"; - - // You can drag the splitter no nearer than 30 pixels from the left edge of the container. - splitContainer1->Panel1MinSize = 30; - - // You can drag the splitter no nearer than 20 pixels from the right edge of the container. - splitContainer1->Panel2MinSize = 20; - splitContainer1->Size = System::Drawing::Size( 292, 273 ); - splitContainer1->SplitterDistance = 79; - - // This splitter moves in 10-pixel increments. - splitContainer1->SplitterIncrement = 10; - splitContainer1->SplitterWidth = 6; - - // splitContainer1 is the first control in the tab order. - splitContainer1->TabIndex = 0; - splitContainer1->Text = "splitContainer1"; - - // When the splitter moves, the cursor changes shape. - splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved ); - splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving ); - - // Add a TreeView control to the left panel. - splitContainer1->Panel1->BackColor = System::Drawing::SystemColors::Control; - - // Add a TreeView control to Panel1. - splitContainer1->Panel1->Controls->Add( treeView1 ); - splitContainer1->Panel1->Name = "splitterPanel1"; - - // Controls placed on Panel1 support right-to-left fonts. - splitContainer1->Panel1->RightToLeft = System::Windows::Forms::RightToLeft::Yes; - - // - // Add a SplitContainer to the right panel. - splitContainer1->Panel2->Controls->Add( splitContainer2 ); - splitContainer1->Panel2->Name = "splitterPanel2"; - - // This TreeView control is in Panel1 of splitContainer1. - treeView1->Dock = System::Windows::Forms::DockStyle::Fill; - treeView1->ForeColor = System::Drawing::SystemColors::InfoText; - treeView1->ImageIndex = -1; - treeView1->Location = System::Drawing::Point( 0, 0 ); - treeView1->Name = "treeView1"; - treeView1->SelectedImageIndex = -1; - treeView1->Size = System::Drawing::Size( 79, 273 ); - - // treeView1 is the second control in the tab order. - treeView1->TabIndex = 1; - - // - // Basic SplitContainer properties. - // This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed. - splitContainer2->Dock = System::Windows::Forms::DockStyle::Fill; - - // The top panel remains the same size when the form is resized. - splitContainer2->FixedPanel = System::Windows::Forms::FixedPanel::Panel1; - splitContainer2->Location = System::Drawing::Point( 0, 0 ); - splitContainer2->Name = "splitContainer2"; - - // Create the horizontal splitter. - splitContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal; - splitContainer2->Size = System::Drawing::Size( 207, 273 ); - splitContainer2->SplitterDistance = 125; - splitContainer2->SplitterWidth = 6; - - // splitContainer2 is the third control in the tab order. - splitContainer2->TabIndex = 2; - splitContainer2->Text = "splitContainer2"; - - // - // This splitter panel contains the top ListView control. - splitContainer2->Panel1->Controls->Add( listView1 ); - splitContainer2->Panel1->Name = "splitterPanel3"; - - // This splitter panel contains the bottom ListView control. - splitContainer2->Panel2->Controls->Add( listView2 ); - splitContainer2->Panel2->Name = "splitterPanel4"; - - // This ListView control is in the top panel of splitContainer2. - listView1->Dock = System::Windows::Forms::DockStyle::Fill; - listView1->Location = System::Drawing::Point( 0, 0 ); - listView1->Name = "listView1"; - listView1->Size = System::Drawing::Size( 207, 125 ); - - // listView1 is the fourth control in the tab order. - listView1->TabIndex = 3; - - // This ListView control is in the bottom panel of splitContainer2. - listView2->Dock = System::Windows::Forms::DockStyle::Fill; - listView2->Location = System::Drawing::Point( 0, 0 ); - listView2->Name = "listView2"; - listView2->Size = System::Drawing::Size( 207, 142 ); - - // listView2 is the fifth control in the tab order. - listView2->TabIndex = 4; - - // These are basic properties of the form. - ClientSize = System::Drawing::Size( 292, 273 ); - Controls->Add( splitContainer1 ); - Name = "Form1"; - Text = "Form1"; - splitContainer1->ResumeLayout( false ); - splitContainer2->ResumeLayout( false ); - ResumeLayout( false ); - } - - void splitContainer1_SplitterMoving( System::Object^ /*sender*/, System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ ) - { - - // As the splitter moves, change the cursor type. - ::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert; - } - - void splitContainer1_SplitterMoved( System::Object^ /*sender*/, System::Windows::Forms::SplitterEventArgs^ /*e*/ ) - { - - // When the splitter stops moving, change the cursor back to the default. - ::Cursor::Current = System::Windows::Forms::Cursors::Default; - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp deleted file mode 100644 index aff3e542a5b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp +++ /dev/null @@ -1,161 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace CancelEdit -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::TextBox^ textBox1; - DataView^ myDataView; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 24, 16 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 216, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^formControls = {this->textBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - SetBinding(); - CancelEdit(); - EndEdit(); - } - - // - private: - void CancelEdit() - { - // Gets the CurrencyManager which is returned when the - // data source is a DataView. - BindingManagerBase^ myMgr = dynamic_cast(BindingContext[ myDataView ]); - - // Gets the current row and changes a value. Then cancels the - // edit and thereby discards the changes. - DataRowView^ tempRowView = dynamic_cast(myMgr->Current); - Console::WriteLine( "Original: {0}", tempRowView[ "myCol" ] ); - tempRowView[ "myCol" ] = "These changes will be discarded"; - Console::WriteLine( "Edit: {0}", tempRowView[ "myCol" ] ); - myMgr->CancelCurrentEdit(); - Console::WriteLine( "After CanceCurrentlEdit: {0}", tempRowView[ "myCol" ] ); - } - - void EndEdit() - { - // Gets the CurrencyManager which is returned when the - // data source is a DataView. - BindingManagerBase^ myMgr = dynamic_cast(BindingContext[ myDataView ]); - - // Gets the current row and changes a value. Then ends the - // edit and thereby keeps the changes. - DataRowView^ tempRowView = dynamic_cast(myMgr->Current); - Console::WriteLine( "Original: {0}", tempRowView[ "myCol" ] ); - tempRowView[ "myCol" ] = "These changes will be kept"; - Console::WriteLine( "Edit: {0}", tempRowView[ "myCol" ] ); - myMgr->EndCurrentEdit(); - Console::WriteLine( "After EndCurrentEdit: {0}", tempRowView[ "myCol" ] ); - } - // - - void SetBinding() - { - // Creates a DataView to be used as a data source. Sets the - // myDataView variable, defined in the form, to the DataView. - // Then binds the TextBox control to the DataView. - DataTable^ myTable = gcnew DataTable( "myTable" ); - DataColumn^ myCol = gcnew DataColumn( "myCol" ); - myTable->Columns->Add( myCol ); - DataRow^ tempRow; - tempRow = myTable->NewRow(); - tempRow[ "myCol" ] = "Original Data"; - myTable->Rows->Add( tempRow ); - myDataView = myTable->DefaultView; - textBox1->DataBindings->Add( gcnew Binding( "Text",myDataView,"myCol" ) ); - } - }; -} - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew CancelEdit::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp deleted file mode 100644 index 4186f01de49..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp +++ /dev/null @@ -1,126 +0,0 @@ - - -// System::BindingManagerBase::RemoveAt -/* This program demonstrates the 'RemoveAt' method of 'BindingManagerBase' class. -* It creates a 'DataGrid' control and a 'button' control. If Remove button is pressed it deletes -* the selected row from the 'DataGrid' control. -*/ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace WindowsApplication1 -{ - public ref class Form1: public Form - { - private: - Button^ button1; - DataGrid^ dataGrid1; - DataTable^ myDataTable; - - public: - Form1() - { - InitializeComponent(); - MakeDataTableAndDisplay(); - } - - private: - void InitializeComponent() - { - dataGrid1 = gcnew DataGrid; - button1 = gcnew Button; - (dynamic_cast(dataGrid1))->BeginInit(); - SuspendLayout(); - - // Create the 'DataGrid'. - dataGrid1->DataMember = ""; - dataGrid1->Location = Point(32,32); - dataGrid1->Name = "dataGrid1"; - dataGrid1->Size = System::Drawing::Size( 208, 80 ); - dataGrid1->TabIndex = 3; - button1->Location = Point(280,40); - button1->Name = "button1"; - button1->Size = System::Drawing::Size( 96, 23 ); - button1->TabIndex = 1; - button1->Text = "Remove Row"; - button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - ClientSize = System::Drawing::Size( 400, 273 ); - array^temp0 = {dataGrid1,button1}; - Controls->AddRange( temp0 ); - Name = "Form1"; - Text = "Form1"; - (dynamic_cast(dataGrid1))->EndInit(); - ResumeLayout( false ); - } - - // - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - try - { - // Get the 'BindingManagerBase' Object*. - BindingManagerBase^ myBindingManagerBase = BindingContext[ myDataTable ]; - - // Remove the selected row from the grid. - myBindingManagerBase->RemoveAt( myBindingManagerBase->Position ); - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Source ); - MessageBox::Show( ex->Message ); - } - } - // - - void MakeDataTableAndDisplay() - { - // Create new DataTable. - myDataTable = gcnew DataTable( "MyDataTable" ); - DataColumn^ myDataColumn; - DataRow^ myDataRow; - - // Create new 'DataColumn'. - myDataColumn = gcnew DataColumn; - - // Set the 'DataType'. - myDataColumn->DataType = System::Type::GetType( "System::Int32" ); - - // Set the 'ColumnName'. - myDataColumn->ColumnName = "id"; - - // Add the column to the 'DataTable'. - myDataTable->Columns->Add( myDataColumn ); - - // Create second column. - myDataColumn = gcnew DataColumn; - myDataColumn->DataType = Type::GetType( "System::String" ); - myDataColumn->ColumnName = "item"; - myDataTable->Columns->Add( myDataColumn ); - - // Create new DataRow objects and add to DataTable. - for ( int i = 0; i < 10; i++ ) - { - myDataRow = myDataTable->NewRow(); - myDataRow[ "id" ] = i; - myDataRow[ "item" ] = "item {0}",i; - myDataTable->Rows->Add( myDataRow ); - } - dataGrid1->DataSource = myDataTable; - } - }; -} - -int main() -{ - Application::Run( gcnew WindowsApplication1::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp deleted file mode 100644 index 60365a230eb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp +++ /dev/null @@ -1,209 +0,0 @@ - - -// System::BindingManagerBase::SuspendBinding -// System::BindingManagerBase::ResumeBinding -/* This program demonstrates 'SuspendBinding' and 'ResumeBinding' method of 'BindingManagerBase'class. -It creates a 'DataTable'and two 'TextBox' controls. The 'Text' property of the two 'TextBox' is -binded with the two columns of the 'DataTable'. If 'SuspendBinding' button is pressed it -suspend the Data Binding between TextBoxes and a 'DataTable' and if ResumeButton is pressed it -resumes Data Binding. -*/ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Globalization; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - Button^ button1; - Button^ button2; - TextBox^ textBox1; - TextBox^ textBox2; - BindingManagerBase^ myBindingManager; - Button^ button3; - Button^ button4; - Label^ label1; - Label^ label2; - DataSet^ myDataSet; - -public: - Form1() - { - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -private: - void InitializeComponent() - { - button1 = gcnew Button; - button2 = gcnew Button; - button3 = gcnew Button; - textBox2 = gcnew TextBox; - textBox1 = gcnew TextBox; - button4 = gcnew Button; - label1 = gcnew Label; - label2 = gcnew Label; - SuspendLayout(); - button1->Location = Point(120,8); - button1->Name = "button1"; - button1->Size = System::Drawing::Size( 64, 24 ); - button1->TabIndex = 0; - button1->Text = "<"; - button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - button2->Location = Point(184,8); - button2->Name = "button2"; - button2->Size = System::Drawing::Size( 64, 24 ); - button2->TabIndex = 1; - button2->Text = ">"; - button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - button3->Location = Point(96,112); - button3->Name = "button3"; - button3->TabIndex = 4; - button3->Text = "Suspend"; - button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - textBox2->Location = Point(200,72); - textBox2->Name = "textBox2"; - textBox2->Size = System::Drawing::Size( 150, 20 ); - textBox2->TabIndex = 3; - textBox2->Text = ""; - textBox1->Location = Point(40,72); - textBox1->Name = "textBox1"; - textBox1->Size = System::Drawing::Size( 150, 20 ); - textBox1->TabIndex = 2; - textBox1->Text = ""; - button4->Location = Point(192,112); - button4->Name = "button4"; - button4->TabIndex = 5; - button4->Text = "Resume"; - button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); - label1->Location = Point(48,48); - label1->Name = "label1"; - label1->TabIndex = 6; - label1->Text = "Customer Name"; - label2->Location = Point(216,48); - label2->Name = "label2"; - label2->TabIndex = 7; - label2->Text = "CustomerID"; - ClientSize = System::Drawing::Size( 450, 200 ); - array^temp0 = {label2,label1,button4,button3,button1,button2,textBox1,textBox2}; - Controls->AddRange( temp0 ); - Name = "Form1"; - Text = "Binding Sample"; - ResumeLayout( false ); - } - - void SetUp() - { - MakeDataSet(); - BindControls(); - } - -protected: - void BindControls() - { - textBox1->DataBindings->Add( gcnew Binding( "Text",myDataSet,"customers.custName" ) ); - textBox2->DataBindings->Add( gcnew Binding( "Text",myDataSet,"customers.custID" ) ); - myBindingManager = BindingContext[ myDataSet, "Customers" ]; - } - -private: - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Go to the previous item in the Customer list. - myBindingManager->Position = myBindingManager->Position - 1; - } - -private: - void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Go to the next item in the Customer list. - myBindingManager->Position = myBindingManager->Position + 1; - } - -private: - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ myCustomerColumnID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); - myCustomerTable->Columns->Add( myCustomerColumnID ); - myCustomerTable->Columns->Add( myCustomerName ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( myCustomerTable ); - DataRow^ newRow1; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = myCustomerTable->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - myCustomerTable->Rows->Add( newRow1 ); - } - myCustomerTable->Rows[ 0 ][ "custName" ] = "Alpha"; - myCustomerTable->Rows[ 1 ][ "custName" ] = "Beta"; - myCustomerTable->Rows[ 2 ][ "custName" ] = "Omega"; - UniqueConstraint^ idKeyRestraint = gcnew UniqueConstraint( myCustomerColumnID ); - myCustomerTable->Constraints->Add( idKeyRestraint ); - myDataSet->EnforceConstraints = true; - } - - // - void button3_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - BindingManagerBase^ myBindingManager1 = BindingContext[ myDataSet, "Customers" ]; - myBindingManager1->SuspendBinding(); - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Source ); - MessageBox::Show( ex->Message ); - } - } - // - - // - void button4_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - BindingManagerBase^ myBindingManager2 = BindingContext[ myDataSet, "Customers" ]; - myBindingManager2->ResumeBinding(); - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Source ); - MessageBox::Show( ex->Message ); - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp b/snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp deleted file mode 100644 index 67fa8b50cfd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp +++ /dev/null @@ -1,412 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::Collections; -using namespace System::ComponentModel; - -namespace IBindingList_Doc -{ - - ref class Customer; - - // sample for IBindingList - // - public ref class CustomersList: public CollectionBase, public IBindingList - { - private: - ListChangedEventArgs^ resetEvent; - ListChangedEventHandler^ onListChanged; - virtual event ListChangedEventHandler^ ListChanged; - - public: - property bool AllowEdit - { - // Implements IBindingList. - virtual bool get() sealed - { - return true; - } - } - - virtual property bool AllowNew - { - bool get() - { - return true; - } - } - - property bool AllowRemove - { - virtual bool get() - { - return true; - } - - } - - property bool SupportsChangeNotification - { - virtual bool get() - { - return true; - } - - } - - property bool SupportsSearching - { - virtual bool get() - { - return true; - } - - } - - property bool SupportsSorting - { - virtual bool get() - { - return true; - } - - } - - // Methods. - virtual Object^ AddNew() - { - Customer^ c = gcnew Customer( this->Count->ToString() ); - List->Add( c ); - return c; - } - - - property bool IsSorted - { - - // Unsupported properties. - virtual bool get() - { - throw gcnew NotSupportedException; - return false; - } - - } - - property ListSortDirection SortDirection - { - virtual ListSortDirection get() - { - throw gcnew NotSupportedException; - return ListSortDirection::Ascending; - } - - } - - property PropertyDescriptor^ SortProperty - { - virtual PropertyDescriptor^ get() - { - throw gcnew NotSupportedException; - return nullptr; - } - - } - - // Unsupported Methods. - virtual void AddIndex( PropertyDescriptor^ property ) - { - throw gcnew NotSupportedException; - } - - virtual void ApplySort( PropertyDescriptor^ property, ListSortDirection direction ) - { - throw gcnew NotSupportedException; - } - - virtual int Find( PropertyDescriptor^ property, Object^ key ) - { - throw gcnew NotSupportedException; - return 0; - } - - virtual void RemoveIndex( PropertyDescriptor^ property ) - { - throw gcnew NotSupportedException; - } - - virtual void RemoveSort() - { - throw gcnew NotSupportedException; - } - - - // Worker functions to populate the list with data. - static Customer^ ReadCustomer1() - { - Customer^ cust = gcnew Customer( "536-45-1245" ); - cust->FirstName = "Jo"; - cust->LastName = "Brown"; - return cust; - } - - static Customer^ ReadCustomer2() - { - Customer^ cust = gcnew Customer( "246-12-5645" ); - cust->FirstName = "Robert"; - cust->LastName = "Brown"; - return cust; - } - - protected: - virtual void OnListChanged( ListChangedEventArgs^ ev ) - { - if ( onListChanged != nullptr ) - { - onListChanged( this, ev ); - } - } - - virtual void OnClear() override - { - List->Clear(); - } - - virtual void OnClearComplete() override - { - OnListChanged( resetEvent ); - } - - virtual void OnInsertComplete( int index, Object^ value ) override - { - Customer^ c = safe_cast(value); - c->Parent = this; - OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemAdded,index ) ); - } - - virtual void OnRemoveComplete( int index, Object^ value ) override - { - Customer^ c = safe_cast(value); - c->Parent = this; - OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemDeleted,index ) ); - } - - virtual void OnSetComplete( int index, Object^ oldValue, Object^ newValue ) override - { - if ( oldValue != newValue ) - { - Customer^ oldcust = safe_cast(oldValue); - Customer^ newcust = safe_cast(newValue); - oldcust->Parent = 0; - newcust->Parent = this; - OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemAdded,index ) ); - } - } - - public: - - // Constructor - CustomersList() - { - resetEvent = gcnew ListChangedEventArgs( ListChangedType::Reset,-1 ); - } - - void LoadCustomers() - { - IList^ l = static_cast(this); - l->Add( ReadCustomer1() ); - l->Add( ReadCustomer2() ); - OnListChanged( resetEvent ); - } - - property Object^ Item [int] - { - Object^ get( int index ) - { - return static_cast(List->Item[ index ]); - } - - void set( int index, Object^ value ) - { - List->Item[ index ] = value; - } - - } - int Add( Customer^ value ) - { - return List->Add( value ); - } - - Customer^ AddNew() - { - return safe_cast(static_cast(this)->AddNew()); - } - - void Remove( Customer^ value ) - { - List->Remove( value ); - } - - internal: - - // Called by Customer when it changes. - void CustomerChanged( Customer^ cust ) - { - int index = List->IndexOf( cust ); - OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemChanged,index ) ); - } - - }; - // - - // sample for IEditableObject - // - public ref class Customer: public IEditableObject - { - private: - ref struct CustomerData - { - internal: - String^ id; - String^ firstName; - String^ lastName; - }; - - internal: - CustomersList^ parent; - CustomerData^ custData; - CustomerData^ backupData; - bool inTxn; - - // Implements IEditableObject - public: - virtual void BeginEdit() - { - Console::WriteLine( "Start BeginEdit" ); - if ( !inTxn ) - { - this->backupData = custData; - inTxn = true; - Console::WriteLine( "BeginEdit - {0}", this->backupData->lastName ); - } - - Console::WriteLine( "End BeginEdit" ); - } - - virtual void CancelEdit() - { - Console::WriteLine( "Start CancelEdit" ); - if ( inTxn ) - { - this->custData = backupData; - inTxn = false; - Console::WriteLine( "CancelEdit - {0}", this->custData->lastName ); - } - - Console::WriteLine( "End CancelEdit" ); - } - - virtual void EndEdit() - { - Console::WriteLine( "Start EndEdit{0}{1}", this->custData->id, this->custData->lastName ); - if ( inTxn ) - { - backupData = gcnew CustomerData; - inTxn = false; - Console::WriteLine( "Done EndEdit - {0}{1}", this->custData->id, this->custData->lastName ); - } - - Console::WriteLine( "End EndEdit" ); - } - - - public: - - Customer( String^ ID ) - { - this->custData = gcnew CustomerData; - this->custData->id = ID; - this->custData->firstName = ""; - this->custData->lastName = ""; - inTxn = false; - } - - property String^ ID - { - String^ get() - { - return this->custData->id; - } - - } - - property String^ FirstName - { - String^ get() - { - return this->custData->firstName; - } - - void set( String^ value ) - { - this->custData->firstName = value; - this->OnCustomerChanged(); - } - - } - - property String^ LastName - { - String^ get() - { - return this->custData->lastName; - } - - void set( String^ value ) - { - this->custData->lastName = value; - this->OnCustomerChanged(); - } - - } - - internal: - - property CustomersList^ Parent - { - CustomersList^ get() - { - return parent; - } - - void set( CustomersList^ value ) - { - parent = value; - } - - } - - void OnCustomerChanged() - { - if (!inTxn && Parent != nullptr) - { - Parent->CustomerChanged(this); - } - } - - public: - virtual String^ ToString() override - { - StringWriter^ sb = gcnew StringWriter; - sb->Write( this->FirstName ); - sb->Write( " " ); - sb->Write( this->LastName ); - return sb->ToString(); - } - }; - // - // end of Customer class - sample for IEditableObject -} diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp deleted file mode 100644 index 22a3876b77e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Test -{ -private: - TextBox^ textBox1; - Test() - { - textBox1 = gcnew TextBox; - } - - // - void PrintValue() - { - ControlBindingsCollection^ myControlBindings; - myControlBindings = textBox1->DataBindings; - - // Get the Binding for the Text property. - Binding^ myBinding = myControlBindings[ "Text" ]; - - // Assuming the data source is a DataTable. - DataRowView^ drv; - drv = dynamic_cast(myBinding->BindingManagerBase->Current); - - // Assuming a column named S"custName" exists, print the value. - Console::WriteLine( drv[ "custName" ] ); - } - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp b/snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp deleted file mode 100644 index ea2d15cac0a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Data; -using namespace System::Windows::Forms; - -namespace BitmapEditorExample -{ - public ref class UserControl1: public System::Windows::Forms::UserControl - { - private: - System::ComponentModel::Container^ components; - - public: - - property Bitmap^ testBitmap - { - - // - [EditorAttribute(System::Drawing::Design::BitmapEditor::typeid,System::Drawing::Design::UITypeEditor::typeid)] - Bitmap^ get() - { - return testBmp; - } - - void set( Bitmap^ value ) - { - testBmp = value; - } - } - - private: - Bitmap^ testBmp; - // - - public: - - UserControl1() - { - InitializeComponent(); - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - components = gcnew System::ComponentModel::Container; - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp b/snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp deleted file mode 100644 index 04cc454c6d9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp +++ /dev/null @@ -1,176 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace BufferingExample -{ - public ref class BufferingExample: public Form - { - private: - BufferedGraphicsContext^ context; - BufferedGraphics^ grafx; - Byte bufferingMode; - array^bufferingModeStrings; - System::Windows::Forms::Timer^ timer1; - Byte count; - - public: - BufferingExample() - : Form() - { - array^tempStrings = {"Draw to Form without OptimizedDoubleBufferring control style","Draw to Form using OptimizedDoubleBuffering control style","Draw to HDC for form"}; - bufferingModeStrings = tempStrings; - - // Configure the Form for this example. - this->Text = "User double buffering"; - this->MouseDown += gcnew MouseEventHandler( this, &BufferingExample::MouseDownHandler ); - this->Resize += gcnew EventHandler( this, &BufferingExample::OnResize ); - this->SetStyle( static_cast(ControlStyles::AllPaintingInWmPaint | ControlStyles::UserPaint), true ); - - // Configure a timer to draw graphics updates. - timer1 = gcnew System::Windows::Forms::Timer; - timer1->Interval = 200; - timer1->Tick += gcnew EventHandler( this, &BufferingExample::OnTimer ); - bufferingMode = 2; - count = 0; - - // Retrieves the BufferedGraphicsContext for the - // current application domain. - context = BufferedGraphicsManager::Current; - - // Sets the maximum size for the primary graphics buffer - // of the buffered graphics context for the application - // domain. Any allocation requests for a buffer larger - // than this will create a temporary buffered graphics - // context to host the graphics buffer. - context->MaximumBuffer = System::Drawing::Size( this->Width + 1, this->Height + 1 ); - - // Allocates a graphics buffer the size of this form - // using the pixel format of the Graphics created by - // the Form.CreateGraphics() method, which returns a - // Graphics object that matches the pixel format of the form. - grafx = context->Allocate( this->CreateGraphics(), Rectangle(0,0,this->Width,this->Height) ); - - // Draw the first frame to the buffer. - DrawToBuffer( grafx->Graphics ); - } - - private: - void MouseDownHandler( Object^ /*sender*/, MouseEventArgs^ e ) - { - if ( e->Button == ::MouseButtons::Right ) - { - // Cycle the buffering mode. - if ( ++bufferingMode > 2 ) - bufferingMode = 0; - - // If the previous buffering mode used - // the OptimizedDoubleBuffering ControlStyle, - // disable the control style. - if ( bufferingMode == 1 ) - this->SetStyle( ControlStyles::OptimizedDoubleBuffer, true ); - - // If the current buffering mode uses - // the OptimizedDoubleBuffering ControlStyle, - // enabke the control style. - if ( bufferingMode == 2 ) - this->SetStyle( ControlStyles::OptimizedDoubleBuffer, false ); - - // Cause the background to be cleared and redraw. - count = 6; - DrawToBuffer( grafx->Graphics ); - this->Refresh(); - } - else - { - - // Toggle whether the redraw timer is active. - if ( timer1->Enabled ) - timer1->Stop(); - else - timer1->Start(); - } - } - - private: - void OnTimer( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Draw randomly positioned ellipses to the buffer. - DrawToBuffer( grafx->Graphics ); - - // If in bufferingMode 2, draw to the form's HDC. - if ( bufferingMode == 2 ) - - // Render the graphics buffer to the form's HDC. - grafx->Render( Graphics::FromHwnd( this->Handle ) ); - // If in bufferingMode 0 or 1, draw in the paint method. - else - - // If in bufferingMode 0 or 1, draw in the paint method. - this->Refresh(); - } - - void OnResize( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Re-create the graphics buffer for a new window size. - context->MaximumBuffer = System::Drawing::Size( this->Width + 1, this->Height + 1 ); - if ( grafx != nullptr ) - { - delete grafx; - grafx = nullptr; - } - - grafx = context->Allocate( this->CreateGraphics(), Rectangle(0,0,this->Width,this->Height) ); - - // Cause the background to be cleared and redraw. - count = 6; - DrawToBuffer( grafx->Graphics ); - this->Refresh(); - } - - void DrawToBuffer( Graphics^ g ) - { - // Clear the graphics buffer every five updates. - if ( ++count > 5 ) - { - count = 0; - grafx->Graphics->FillRectangle( Brushes::Black, 0, 0, this->Width, this->Height ); - } - - // Draw randomly positioned and colored ellipses. - Random^ rnd = gcnew Random; - for ( int i = 0; i < 20; i++ ) - { - int px = rnd->Next( 20, this->Width - 40 ); - int py = rnd->Next( 20, this->Height - 40 ); - g->DrawEllipse( gcnew Pen( Color::FromArgb( rnd->Next( 0, 255 ), rnd->Next( 0, 255 ), rnd->Next( 0, 255 ) ), 1.0f ), px, py, px + rnd->Next( 0, this->Width - px - 20 ), py + rnd->Next( 0, this->Height - py - 20 ) ); - } - - // Draw information strings. - g->DrawString( String::Format( "Buffering Mode: {0}", bufferingModeStrings[ bufferingMode ] ), gcnew System::Drawing::Font( "Arial",8 ), Brushes::White, 10, 10 ); - g->DrawString( "Right-click to cycle buffering mode", gcnew System::Drawing::Font( "Arial",8 ), Brushes::White, 10, 22 ); - g->DrawString( "Left-click to toggle timed display refresh", gcnew System::Drawing::Font( "Arial",8 ), Brushes::White, 10, 34 ); - } - - protected: - virtual void OnPaint( PaintEventArgs^ e ) override - { - grafx->Render( e->Graphics ); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew BufferingExample::BufferingExample ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp b/snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp deleted file mode 100644 index 93222199cac..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp +++ /dev/null @@ -1,76 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -public ref class BufferingExamples: public Form -{ -private: - BufferedGraphicsContext^ appDomainBufferedGraphicsContext; - BufferedGraphics^ grafx; - -public: - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - BufferingExamples() : Form() - { - // - // Retrieves the BufferedGraphicsContext for the - // current application domain. - BufferedGraphicsContext^ appDomainGraphicsContext = - BufferedGraphicsManager::Current; - // - - appDomainGraphicsContext->MaximumBuffer = System::Drawing::Size( 400, 400 ); - appDomainBufferedGraphicsContext = BufferedGraphicsManager::Current; - - // - // Sets the maximum size for the graphics buffer - // of the buffered graphics context. Any allocation - // requests for a buffer larger than this will create - // a temporary buffered graphics context to host - // the graphics buffer. - appDomainBufferedGraphicsContext->MaximumBuffer = System::Drawing::Size( 400, 400 ); - // - - // - // Allocates a graphics buffer using the pixel format - // of the specified Graphics object. - grafx = appDomainBufferedGraphicsContext->Allocate( this->CreateGraphics(), - Rectangle( 0, 0, 400, 400 ) ); - // - - // - // Allocates a graphics buffer using the pixel format - // of the specified handle to a device context. - grafx = appDomainBufferedGraphicsContext->Allocate( this->Handle, - Rectangle( 0, 0, 400, 400 ) ); - // - } - - // -private: - void RenderToGraphics( Graphics^ g ) - { - grafx->Render( g ); - } - // - - // -private: - void RenderToDeviceContextHandle( IntPtr hDC ) - { - grafx->Render( hDC ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew BufferingExamples ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp b/snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp deleted file mode 100644 index 27ec84835c7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - Button^ button1; - Button^ button2; - -public: - Form1() - { - button1 = gcnew Button; - button2 = gcnew Button; - this->button2->Location = Point(0,button1->Height + 10); - this->Click += gcnew EventHandler( this, &Form1::button2_Click ); - this->Controls->Add( this->button1 ); - this->Controls->Add( this->button2 ); - } - - -private: - - // - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Draws a flat button on button1. - ControlPaint::DrawButton( System::Drawing::Graphics::FromHwnd( button1->Handle ), 0, 0, button1->Width, button1->Height, ButtonState::Flat ); - } - - // -}; - - -[STAThread] -void main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp deleted file mode 100644 index 830ffade03e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp +++ /dev/null @@ -1,149 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -public ref class ByteViewerForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::ComponentModel::Design::ByteViewer^ byteviewer; - -public: - ByteViewerForm() - { - // Initialize the controls other than the ByteViewer. - InitializeForm(); - - // Initialize the ByteViewer. - byteviewer = gcnew ByteViewer; - byteviewer->Location = Point(8,46); - byteviewer->Size = System::Drawing::Size( 600, 338 ); - byteviewer->Anchor = static_cast(AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Top); - byteviewer->SetBytes( (array^)Array::CreateInstance( Byte::typeid, 0 ) ); - this->Controls->Add( byteviewer ); - } - -private: - - // Show a file selection dialog and cues the byte viewer to - // load the data in a selected file. - void loadBytesFromFile( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - OpenFileDialog^ ofd = gcnew OpenFileDialog; - if ( ofd->ShowDialog() != ::DialogResult::OK ) - return; - - byteviewer->SetFile( ofd->FileName ); - } - - // Clear the bytes in the byte viewer. - void clearBytes( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - byteviewer->SetBytes( (array^)Array::CreateInstance( Byte::typeid, 0 ) ); - } - - // Changes the display mode of the byte viewer according to the - // Text property of the RadioButton sender control. - void changeByteMode( Object^ sender, EventArgs^ /*e*/ ) - { - System::Windows::Forms::RadioButton^ rbutton = dynamic_cast(sender); - DisplayMode mode; - if ( rbutton->Text->Equals( "ANSI" ) ) - { - mode = DisplayMode::Ansi; - } - else - if ( rbutton->Text->Equals( "Hex" ) ) - { - mode = DisplayMode::Hexdump; - } - else - if ( rbutton->Text->Equals( "Unicode" ) ) - { - mode = DisplayMode::Unicode; - } - else - { - mode = DisplayMode::Auto; - } - - // Sets the display mode. - byteviewer->SetDisplayMode( mode ); - } - - void InitializeForm() - { - this->SuspendLayout(); - this->ClientSize = System::Drawing::Size( 680, 440 ); - this->MinimumSize = System::Drawing::Size( 660, 400 ); - this->Size = System::Drawing::Size( 680, 440 ); - this->Name = "Byte Viewer Form"; - this->Text = "Byte Viewer Form"; - this->button1 = gcnew System::Windows::Forms::Button; - this->button1->Location = System::Drawing::Point( 8, 8 ); - this->button1->Size = System::Drawing::Size( 190, 23 ); - this->button1->Name = "button1"; - this->button1->Text = "Set Bytes From File..."; - this->button1->TabIndex = 0; - this->button1->Click += gcnew EventHandler( this, &ByteViewerForm::loadBytesFromFile ); - this->Controls->Add( this->button1 ); - this->button2 = gcnew System::Windows::Forms::Button; - this->button2->Location = System::Drawing::Point( 198, 8 ); - this->button2->Size = System::Drawing::Size( 190, 23 ); - this->button2->Name = "button2"; - this->button2->Text = "Clear Bytes"; - this->button2->Click += gcnew EventHandler( this, &ByteViewerForm::clearBytes ); - this->button2->TabIndex = 1; - this->Controls->Add( this->button2 ); - System::Windows::Forms::GroupBox^ group = gcnew System::Windows::Forms::GroupBox; - group->Location = Point(418,3); - group->Size = System::Drawing::Size( 220, 36 ); - group->Text = "Display Mode"; - this->Controls->Add( group ); - System::Windows::Forms::RadioButton^ rbutton1 = gcnew System::Windows::Forms::RadioButton; - rbutton1->Location = Point(6,15); - rbutton1->Size = System::Drawing::Size( 46, 16 ); - rbutton1->Text = "Auto"; - rbutton1->Checked = true; - rbutton1->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); - group->Controls->Add( rbutton1 ); - System::Windows::Forms::RadioButton^ rbutton2 = gcnew System::Windows::Forms::RadioButton; - rbutton2->Location = Point(54,15); - rbutton2->Size = System::Drawing::Size( 50, 16 ); - rbutton2->Text = "ANSI"; - rbutton2->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); - group->Controls->Add( rbutton2 ); - System::Windows::Forms::RadioButton^ rbutton3 = gcnew System::Windows::Forms::RadioButton; - rbutton3->Location = Point(106,15); - rbutton3->Size = System::Drawing::Size( 46, 16 ); - rbutton3->Text = "Hex"; - rbutton3->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); - group->Controls->Add( rbutton3 ); - System::Windows::Forms::RadioButton^ rbutton4 = gcnew System::Windows::Forms::RadioButton; - rbutton4->Location = Point(152,15); - rbutton4->Size = System::Drawing::Size( 64, 16 ); - rbutton4->Text = "Unicode"; - rbutton4->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); - group->Controls->Add( rbutton4 ); - this->ResumeLayout( false ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew ByteViewerForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp deleted file mode 100644 index 176a868248a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp +++ /dev/null @@ -1,81 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Data; -using namespace System::Windows::Forms; - -namespace ToolboxCategoryNamesControl -{ - public ref class ToolboxCategoryNamesControl: public System::Windows::Forms::UserControl - { - private: - System::Drawing::Design::IToolboxService^ toolboxService; - System::Drawing::Design::CategoryNameCollection^ categoryNames; - - public: - ToolboxCategoryNamesControl() - { - this->BackColor = System::Drawing::Color::Beige; - this->Name = "Category Names Display Control"; - this->Size = System::Drawing::Size( 264, 200 ); - } - - property System::ComponentModel::ISite^ Site - { - // Obtain or reset IToolboxService^ reference on each siting of control. - virtual System::ComponentModel::ISite^ get() override - { - return __super::Site; - } - - virtual void set( System::ComponentModel::ISite^ value ) override - { - __super::Site = value; - - // If the component was sited, attempt to obtain - // an IToolboxService^ instance. - if ( __super::Site != nullptr ) - { - toolboxService = dynamic_cast(this->GetService( IToolboxService::typeid )); - - // If an IToolboxService* was located, update the category list. - if ( toolboxService != nullptr ) - categoryNames = toolboxService->CategoryNames; - } - else - toolboxService = nullptr; - } - } - - protected: - [System::Security::Permissions::PermissionSetAttribute(System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - if ( categoryNames != nullptr ) - { - e->Graphics->DrawString( "IToolboxService category names list:", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 10, 10 ); - - // - // categoryNames is a CategoryNameCollection obtained from - // the IToolboxService*. CategoryNameCollection is a read-only - // String* collection. - // Output each category name in the CategoryNameCollection. - for ( int i = 0; i < categoryNames->Count; i++ ) - e->Graphics->DrawString( categoryNames[ i ], gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, (float)10, (float)24 + (10 * i) ); - // - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp deleted file mode 100644 index 6aa493f9139..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp +++ /dev/null @@ -1,163 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::CheckedListBox^ checkedListBox1; - System::Windows::Forms::Button^ WhatIsChecked; - System::Windows::Forms::Button^ CheckEveryOther; - bool insideCheckEveryOther; - -public: - Form1() - { - - // Required for Windows Form Designer support - InitializeComponent(); - } - - -private: - - /// Required method for Designer support. - void InitializeComponent() - { - this->checkedListBox1 = gcnew System::Windows::Forms::CheckedListBox; - this->WhatIsChecked = gcnew System::Windows::Forms::Button; - this->CheckEveryOther = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // checkedListBox1 - array^objectArray = {"one","two","three","four","five","six","seven","eight","nine","ten"}; - this->checkedListBox1->Items->AddRange( objectArray ); - this->checkedListBox1->Location = System::Drawing::Point( 10, 25 ); - this->checkedListBox1->Name = "checkedListBox1"; - this->checkedListBox1->Size = System::Drawing::Size( 158, 139 ); - this->checkedListBox1->TabIndex = 0; - this->checkedListBox1->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler( this, &Form1::checkedListBox1_ItemCheck ); - - // WhatIsChecked* this->WhatIsChecked::Location = new System::Drawing::Point(178, 27); - this->WhatIsChecked->Name = "WhatIsChecked"; - this->WhatIsChecked->Size = System::Drawing::Size( 106, 23 ); - this->WhatIsChecked->TabIndex = 1; - this->WhatIsChecked->Text = "What is checked?"; - this->WhatIsChecked->Click += gcnew System::EventHandler( this, &Form1::WhatIsChecked_Click ); - - // CheckEveryOther* this->CheckEveryOther::Location = new System::Drawing::Point(178, 59); - this->CheckEveryOther->Name = "CheckEveryOther"; - this->CheckEveryOther->Size = System::Drawing::Size( 106, 23 ); - this->CheckEveryOther->TabIndex = 2; - this->CheckEveryOther->Text = "Check every other"; - this->CheckEveryOther->Click += gcnew System::EventHandler( this, &Form1::CheckEveryOther_Click ); - - this->ClientSize = System::Drawing::Size( 303, 182 ); - array^controlArray = {this->CheckEveryOther,this->WhatIsChecked,this->checkedListBox1}; - this->Controls->AddRange( controlArray ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // - void WhatIsChecked_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Display in a message box all the items that are checked. - // First show the index and check state of all selected items. - IEnumerator^ myEnum1 = checkedListBox1->CheckedIndices->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Int32 indexChecked = *safe_cast(myEnum1->Current); - - // The indexChecked variable contains the index of the item. - MessageBox::Show( String::Concat( "Index#: ", indexChecked, ", is checked. Checked state is: ", checkedListBox1->GetItemCheckState( indexChecked ), "." ) ); - } - - - // Next show the Object* title and check state for each item selected. - IEnumerator^ myEnum2 = checkedListBox1->CheckedItems->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - Object^ itemChecked = safe_cast(myEnum2->Current); - - // Use the IndexOf method to get the index of an item. - MessageBox::Show( String::Concat( "Item with title: \"", itemChecked, "\", is checked. Checked state is: ", checkedListBox1->GetItemCheckState( checkedListBox1->Items->IndexOf( itemChecked ) ), "." ) ); - } - } - - - // - // - // - void CheckEveryOther_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Cycle through every item and check every other. - // Set flag to true to know when this code is being executed. Used in the ItemCheck - // event handler. - insideCheckEveryOther = true; - for ( int i = 0; i < checkedListBox1->Items->Count; i++ ) - { - - // For every other item in the list, set as checked. - if ( (i % 2) == 0 ) - { - - // But for each other item that is to be checked, set as being in an - // indeterminate checked state. - if ( (i % 4) == 0 ) - checkedListBox1->SetItemCheckState( i, CheckState::Indeterminate ); - else - checkedListBox1->SetItemChecked( i, true ); - } - - } - insideCheckEveryOther = false; - } - - - // - void checkedListBox1_ItemCheck( Object^ /*sender*/, ItemCheckEventArgs^ e ) - { - - // An item in the CheckedListBox is being checked or unchecked. - // Set the NewValue based upon the CurrentValue to allow for a tri-state checking. - // If the ItemCheck event is due to the code in CheckEveryOther, - // then exit the function. - if ( insideCheckEveryOther ) - return; - - if ( e->CurrentValue == CheckState::Unchecked ) - e->NewValue = CheckState::Indeterminate; - else - if ( e->CurrentValue == CheckState::Indeterminate ) - e->NewValue = CheckState::Checked; - else - if ( e->CurrentValue == CheckState::Checked ) - e->NewValue = CheckState::Unchecked; - } - - // -}; - - -// The main entry point for the application. - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp b/snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp deleted file mode 100644 index aa0feeca2ba..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp +++ /dev/null @@ -1,19 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class CheckoutExceptionExample - { - public: - CheckoutExceptionExample() - { - // - // Throws a checkout exception with a message and error code. - throw gcnew CheckoutException( "This is an example exception", 0 ); - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp deleted file mode 100644 index 8fc137e80ff..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Collections; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Drawing; - -/// -/// Summary for Form1 -/// -/// WARNING: If you change the name of this class, you will need to change the -/// 'Resource File Name' property for the managed resource compiler tool -/// associated with all .resx files this class depends on. Otherwise, -/// the designers will not be able to interact properly with localized -/// resources associated with this form. -/// -// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - Button^ button1; - ListBox^ listBox1; - -public: - Form1() - { - button1 = gcnew Button; - button1->Left = 200; - button1->Text = "Exit"; - button1->Click += gcnew EventHandler( this, &Form1::button1_Click ); - listBox1 = gcnew ListBox; - this->Controls->Add( button1 ); - this->Controls->Add( listBox1 ); - } - -private: - void Form1::button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - int count = 1; - - // Check to see whether the user wants to exit - // the application. If not, add a number to the list box. - while ( MessageBox::Show( "Exit application?", "", MessageBoxButtons::YesNo ) == ::DialogResult::No ) - { - listBox1->Items->Add( count ); - count += 1; - } - - - // The user wants to exit the application. - // Close everything down. - Application::Exit(); - } - -}; - -int main() -{ - - // Starts the application. - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp deleted file mode 100644 index 4c09461c9bf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - - // -private: - void PrintCompanyName() - { - textBox1->Text = String::Format( "The company name is: {0}", - Application::CompanyName ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp deleted file mode 100644 index ce852ab0635..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - - // -private: - void PrintCurrentCulture() - { - textBox1->Text = "The current culture is: {0}", - Application::CurrentCulture->EnglishName; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp deleted file mode 100644 index a7ed064052e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - - // -private: - void PrintCurrentInputLanguage() - { - textBox1->Text = "The current input language is: {0}", - Application::CurrentInputLanguage->Culture->EnglishName; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp deleted file mode 100644 index f5f69d94257..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp +++ /dev/null @@ -1,50 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ listBox1; - - // -public: - static void main() - { - // Starts the application. - Application::Run( gcnew Form1 ); - } - -private: - void button1_Click( Object^ sender, System::EventArgs^ e ) - { - // Populates a list box with three numbers. - int i = 3; - for ( int j = 1; j <= i; j++ ) - { - listBox1->Items->Add( j ); - } - - /* Determines whether the user wants to exit the application. - * If not, adds another number to the list box. */ - while ( MessageBox::Show( "Exit application?", "", - MessageBoxButtons::YesNo ) == ::DialogResult::No ) - { - // Increments the counter ands add the number to the list box. - i++; - listBox1->Items->Add( i ); - } - - // The user wants to exit the application. Close everything down. - Application::Exit(); - } - // -}; - -int main() -{ - Form1::main(); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp deleted file mode 100644 index d297e3b6161..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - - // -private: - void PrintProductName() - { - textBox1->Text = "The product name is: {0}", - Application::ProductName; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp deleted file mode 100644 index de18bd7712c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - - // -private: - void PrintProductVersion() - { - textBox1->Text = "The product version is: {0}", - Application::ProductVersion; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp deleted file mode 100644 index eb9a64cc33d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - -public: - - // - // Creates a message filter. - ref class TestMessageFilter: public IMessageFilter - { - public: - [SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::UnmanagedCode)] - virtual bool PreFilterMessage( Message % m ) - { - - // Blocks all the messages relating to the left mouse button. - if ( m.Msg >= 513 && m.Msg <= 515 ) - { - Console::WriteLine( "Processing the messages : {0}", m.Msg ); - return true; - } - - return false; - } - - }; - - // -}; - - diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp deleted file mode 100644 index c1980fb9e52..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ textBox1; - - // -private: - void PrintStartupPath() - { - textBox1->Text = String::Concat( "The path for the executable file", - " that started the application is: ", Application::StartupPath ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp deleted file mode 100644 index b3bad278043..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Threading; - -public ref class Form1: public System::Windows::Forms::Form -{ -protected: - ListBox^ textBox1; - - // - // Creates a class to throw the error. -public: - ref class ErrorHandler: public System::Windows::Forms::Form - { - // Inserts the code to create a form with a button. - - // Programs the button to throw an exception when clicked. - private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - throw gcnew ArgumentException( "The parameter was invalid" ); - } - - public: - static void Main() - { - // Creates an instance of the methods that will handle the exception. - CustomExceptionHandler ^ eh = gcnew CustomExceptionHandler; - - // Adds the event handler to the event. - Application::ThreadException += gcnew ThreadExceptionEventHandler( eh, &Form1::CustomExceptionHandler::OnThreadException ); - - // Runs the application. - Application::Run( gcnew ErrorHandler ); - } - }; - - // Creates a class to handle the exception event. -internal: - ref class CustomExceptionHandler - { - // Handles the exception event. - public: - void OnThreadException( Object^ /*sender*/, ThreadExceptionEventArgs^ t ) - { - System::Windows::Forms::DialogResult result = ::DialogResult::Cancel; - try - { - result = this->ShowThreadExceptionDialog( t->Exception ); - } - catch ( Exception^ ) - { - try - { - MessageBox::Show( "Fatal Error", "Fatal Error", MessageBoxButtons::AbortRetryIgnore, MessageBoxIcon::Stop ); - } - finally - { - Application::Exit(); - } - } - - // Exits the program when the user clicks Abort. - if ( result == ::DialogResult::Abort ) - { - Application::Exit(); - } - } - - // Creates the error message and displays it. - private: - System::Windows::Forms::DialogResult ShowThreadExceptionDialog( Exception^ e ) - { - String^ errorMsg = "An error occurred please contact the adminstrator with the following information:\n\n"; - errorMsg = String::Concat( errorMsg, e->Message, "\n\nStack Trace:\n", e->StackTrace ); - return MessageBox::Show( errorMsg, "Application Error", MessageBoxButtons::AbortRetryIgnore, MessageBoxIcon::Stop ); - } - }; - // -}; - -int main() -{ - Form1::ErrorHandler::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp deleted file mode 100644 index 50b87ecc9c4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void ContainsAttribute() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Sets an Attribute to the specific attribute. - BrowsableAttribute^ myAttribute = BrowsableAttribute::Yes; - - if ( attributes->Contains( myAttribute ) ) - { - textBox1->Text = "button1 has a browsable attribute."; - } - else - { - textBox1->Text = "button1 does not have a browsable attribute."; - } - } - // - - // -private: - void GetAttributeValue() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Gets the designer attribute from the collection. - DesignerAttribute^ myDesigner; - myDesigner = (DesignerAttribute^)(attributes[DesignerAttribute::typeid]); - - // Prints the value of the attribute in a text box. - textBox1->Text = myDesigner->DesignerTypeName; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp deleted file mode 100644 index 55d7cd6ddb9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - void Method1() - { - // - AttributeCollection^ collection1; - collection1 = TypeDescriptor::GetAttributes( button1 ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp deleted file mode 100644 index f631fa1bdba..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -protected: - void ContainsAttribute() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Sets an Attribute to the specific attribute. - BrowsableAttribute^ myAttribute = BrowsableAttribute::Yes; - - if ( attributes->Contains( myAttribute ) ) - { - textBox1->Text = "button1 has a browsable attribute."; - } - else - { - textBox1->Text = "button1 does not have a browsable attribute."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp deleted file mode 100644 index 89ae7f0dcd6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void ContainsAttributes() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ myCollection; - myCollection = TypeDescriptor::GetAttributes( button1 ); - - // Checks to see whether the attributes in myCollection are the attributes for textBox1. - array^ myAttrArray = gcnew array(100); - TypeDescriptor::GetAttributes( textBox1 )->CopyTo( myAttrArray, 0 ); - if ( myCollection->Contains( myAttrArray ) ) - { - textBox1->Text = "Both the button and text box have the same attributes."; - } - else - { - textBox1->Text = "The button and the text box do not have the same attributes."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp deleted file mode 100644 index 2abf26e850d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void GetCount() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Prints the number of items in the collection. - textBox1->Text = attributes->Count.ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp deleted file mode 100644 index 4af06166f99..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void MyEnumerator() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Creates an enumerator for the collection. - System::Collections::IEnumerator^ ie = attributes->GetEnumerator(); - - // Prints the type of each attribute in the collection. - Object^ myAttribute; - System::Text::StringBuilder^ text = gcnew System::Text::StringBuilder; - while ( ie->MoveNext() ) - { - myAttribute = ie->Current; - text->Append( myAttribute ); - text->Append( '\n' ); - } - textBox1->Text = text->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp deleted file mode 100644 index 311557f362f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void MatchesAttribute() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Checks to see if the browsable attribute is true. - if ( attributes->Matches( BrowsableAttribute::Yes ) ) - { - textBox1->Text = "button1 is browsable."; - } - else - { - textBox1->Text = "button1 is not browsable."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp deleted file mode 100644 index 65654f3a33e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void MatchesAttributes() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ myCollection; - myCollection = TypeDescriptor::GetAttributes( button1 ); - - // Checks to see whether the attributes in myCollection match the attributes for textBox1. - array^ myAttrArray = gcnew array(100); - TypeDescriptor::GetAttributes( textBox1 )->CopyTo( myAttrArray, 0 ); - if ( myCollection->Matches( myAttrArray ) ) - { - textBox1->Text = "The attributes in the button and text box match."; - } - else - { - textBox1->Text = "The attributes in the button and text box do not match."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp deleted file mode 100644 index a7716186c43..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void PrintIndexItem() - { - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Prints the second attribute's name. - textBox1->Text = attributes[ 1 ]->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp deleted file mode 100644 index b3398011bd6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - -private: - - // - void PrintIndexItem2() - { - - // Creates a new collection and assigns it the attributes for button1. - AttributeCollection^ attributes; - attributes = TypeDescriptor::GetAttributes( button1 ); - - // Gets the designer attribute from the collection. - DesignerAttribute^ myDesigner; - - // You must supply a valid fully qualified assembly name here. - myDesigner = dynamic_cast(attributes[ Type::GetType( "Assembly text name, Version, Culture, PublicKeyToken" ) ]); - textBox1->Text = myDesigner->DesignerTypeName; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp deleted file mode 100644 index 82077eab139..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -#using -ref class C -{ -public: - - // - property int MyProperty - { - [System::ComponentModel::Bindable(true)] - int get() - { - // Insert code here. - return 0; - } - - [System::ComponentModel::Bindable(true)] - void set( int ) - { - // Insert code here. - } - } - // - - property int MyProperty2 - { - int get() - { - // - using namespace System::ComponentModel; - - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the value of the BindableAttribute is Yes. - if ( attributes[ BindableAttribute::typeid ]->Equals( BindableAttribute::Yes ) ) - { - // Insert code here. - } - - // This is another way to see whether the property is bindable. - BindableAttribute^ myAttribute = static_cast(attributes[ BindableAttribute::typeid ]); - if ( myAttribute->Bindable ) - { - // Insert code here. - } - - // Yet another way to see whether the property is bindable. - if ( attributes->Contains( BindableAttribute::Yes ) ) - { - // Insert code here. - } - // - return 0; - } - } - - property int MyProperty3 - { - int get() - { - // - using namespace System::ComponentModel; - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); - if ( attributes[ BindableAttribute::typeid ]->Equals( BindableAttribute::Yes ) ) - { - // Insert code here. - } - // - return 0; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp deleted file mode 100644 index 9bbe34fdcca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - void Method() - { - - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the property is bindable. - BindableAttribute^ myAttribute = dynamic_cast(attributes[ BindableAttribute::typeid ]); - if ( myAttribute->Bindable ) - { - // Insert code here. - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp deleted file mode 100644 index a93e6f51231..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - [property:Bindable(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int theValue ) - { - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp deleted file mode 100644 index bf23113eeef..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - - property int MyProperty - { - - // - - [Bindable(BindableSupport::Yes)] - int get() - { - - // Insert code here. - return 0; - } - - void set( int theValue ) - { - - // Insert code here. - } - - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp deleted file mode 100644 index 3606e68310c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp +++ /dev/null @@ -1,281 +0,0 @@ - - -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -#define null 0L -public ref class Form1: public Form -{ -private: - System::ComponentModel::Container^ components; - Button^ button1; - Button^ button2; - Button^ button3; - Button^ button4; - TextBox^ text1; - TextBox^ text2; - TextBox^ text3; - BindingManagerBase^ bmCustomers; - BindingManagerBase^ bmOrders; - DataSet^ ds; - DateTimePicker^ DateTimePicker1; - -public: - Form1() - { - // Required for Windows Form Designer support. - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->components = gcnew System::ComponentModel::Container; - this->button1 = gcnew Button; - this->button2 = gcnew Button; - this->button3 = gcnew Button; - this->button4 = gcnew Button; - this->text1 = gcnew TextBox; - this->text2 = gcnew TextBox; - this->text3 = gcnew TextBox; - this->DateTimePicker1 = gcnew DateTimePicker; - this->Text = "Binding Sample"; - this->ClientSize = System::Drawing::Size( 450, 200 ); - button1->Location = System::Drawing::Point( 24, 16 ); - button1->Size = System::Drawing::Size( 64, 24 ); - button1->Text = "<"; - button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - button2->Location = System::Drawing::Point( 90, 16 ); - button2->Size = System::Drawing::Size( 64, 24 ); - button2->Text = ">"; - button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - button3->Location = System::Drawing::Point( 90, 100 ); - button3->Size = System::Drawing::Size( 64, 24 ); - button3->Text = "<"; - button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - button4->Location = System::Drawing::Point( 150, 100 ); - button4->Size = System::Drawing::Size( 64, 24 ); - button4->Text = ">"; - button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); - text1->Location = System::Drawing::Point( 24, 50 ); - text1->Size = System::Drawing::Size( 150, 24 ); - text2->Location = System::Drawing::Point( 190, 50 ); - text2->Size = System::Drawing::Size( 150, 24 ); - text3->Location = System::Drawing::Point( 290, 150 ); - text3->Size = System::Drawing::Size( 150, 24 ); - DateTimePicker1->Location = System::Drawing::Point( 90, 150 ); - DateTimePicker1->Size = System::Drawing::Size( 200, 800 ); - this->Controls->Add( button1 ); - this->Controls->Add( button2 ); - this->Controls->Add( button3 ); - this->Controls->Add( button4 ); - this->Controls->Add( text1 ); - this->Controls->Add( text2 ); - this->Controls->Add( text3 ); - this->Controls->Add( DateTimePicker1 ); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - BindControls(); - } - -protected: - void BindControls() - { - /* Create two Binding objects for the first two TextBox - controls. The data-bound property for both controls - is the Text property. The data source is a DataSet - (ds). The data member is the - "TableName.ColumnName" string. */ - text1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) ); - text2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) ); - - /* Bind the DateTimePicker control by adding a new Binding. - The data member of the DateTimePicker is a - TableName.RelationName.ColumnName string. */ - DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) ); - - /* Add event delegates for the Parse and Format events to a - new Binding object, and add the object to the third - TextBox control's BindingsCollection. The delegates - must be added before adding the Binding to the - collection; otherwise, no formatting occurs until - the Current object of the BindingManagerBase for - the data source changes. */ - Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" ); - b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); - b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); - text3->DataBindings->Add( b ); - - // Get the BindingManagerBase for the Customers table. - bmCustomers = this->BindingContext[ ds, "Customers" ]; - - /* Get the BindingManagerBase for the Orders table using the - RelationName. */ - bmOrders = this->BindingContext[ ds, "customers.CustToOrders" ]; - } - -private: - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - /* This method is the Format event handler. Whenever the - control displays a new value, the value is converted from - its native Decimal type to a string. The ToString method - then formats the value as a Currency, by using the - formatting character "c". */ - // The application can only convert to string type. - if ( cevent->DesiredType != String::typeid ) - return; - - cevent->Value = (dynamic_cast(cevent->Value))->ToString( "c" ); - } - - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - /* This method is the Parse event handler. The Parse event - occurs whenever the displayed value changes. The static - ToDecimal method of the Convert class converts the - value back to its native Decimal type. */ - // Can only convert to Decimal type. - if ( cevent->DesiredType != Decimal::typeid ) - return; - - cevent->Value = Decimal::Parse( cevent->Value->ToString(), NumberStyles::Currency, nullptr ); - - /* To see that no precision is lost, print the unformatted - value. For example, changing a value to "10.0001" - causes the control to display "10.00", but the - unformatted value remains "10.0001". */ - Console::WriteLine( cevent->Value ); - } - -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Go to the previous item in the Customer list. - bmCustomers->Position -= 1; - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Go to the next item in the Customer list. - bmCustomers->Position += 1; - } - - void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Go to the previous item in the Orders list. - bmOrders->Position = bmOrders->Position - 1; - } - - void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Go to the next item in the Orders list. - bmOrders->Position = bmOrders->Position + 1; - } - -private: - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - ds = gcnew DataSet( "myDataSet" ); - - // Create two DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",Int32::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",Int32::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - ds->Tables->Add( tCust ); - ds->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - ds->Relations->Add( dr ); - - /* Populate the tables. For each customer and order, - create two DataRow variables. */ - DataRow^ newRow1; // = new DataRow(); - - DataRow^ newRow2; // = new DataRow(); - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Omega"; - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = System::DateTime( 2001, i, j * 2 ); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp deleted file mode 100644 index 2a8cc30a915..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataSet^ myDataSet; - - // -private: - void CreateDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - /* Populates the DataSet with tables, relations, and - constraints. */ - } - - void BindTextBoxToDataSet() - { - /* Binds a TextBox control to a DataColumn named - CompanyName in the DataTable named Suppliers. */ - textBox1->DataBindings->Add( - "Text", myDataSet, "Suppliers.CompanyName" ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp deleted file mode 100644 index 4391fb2e22e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void PrintPositions() - { - for each ( Control^ c in this->Controls ) - { - for each ( Binding^ xBinding in c->DataBindings ) - { - Console::WriteLine( - "{0}\t Position: {1}", - c, xBinding->BindingManagerBase->Position ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp deleted file mode 100644 index 650cd81d566..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void PrintBindingMemberInfo() - { - for each ( Control^ thisControl in this->Controls) - { - for each ( Binding^ thisBinding in thisControl->DataBindings) - { - // Print the control's name and Binding information. - Console::WriteLine( "\n {0}", thisControl ); - BindingMemberInfo bInfo = thisBinding->BindingMemberInfo; - Console::WriteLine( "Binding Path \t {0}", bInfo.BindingPath ); - Console::WriteLine( "Binding Field \t {0}", bInfo.BindingField ); - Console::WriteLine( "Binding Member \t {0}", bInfo.BindingMember ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp deleted file mode 100644 index 9b7cfda4299..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - -private: - - // - void PrintBoundControls1() - { - - // Get the BindingManagerBase for the Customers table. - BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"Customers" ]; - - /* Print the information of each control managed by - the BindingManagerBase. */ - System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Binding^ b = safe_cast(myEnum->Current); - Console::WriteLine( b->Control ); - } - } - - void PrintBoundControls2() - { - - /* Get the BindingManagerBase for a child table of - the Customers table. The RelationName of a DataRelation - is appended to the parent table's name. */ - BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"Customers::CustToOrders" ]; - - /* Print the information of each control managed by - the BindingManagerBase. */ - System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Binding^ b = safe_cast(myEnum->Current); - Console::WriteLine( b->Control ); - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp deleted file mode 100644 index 686f4a22180..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - - // -private: - void GetDataSource() - { - DataSet^ ds = dynamic_cast(text1->DataBindings[nullptr]->DataSource); - Console::WriteLine( ds->Tables[ 0 ]->TableName ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp deleted file mode 100644 index 3115a82bdce..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - - // -private: - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts only to string type. Test this using the DesiredType. - if ( cevent->DesiredType != String::typeid ) - { - return; - } - - // Use the ToString method to format the value as currency ("c"). - cevent->Value = ( (Decimal)(cevent->Value) ).ToString( "c" ); - } - - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts back to decimal type only. - if ( cevent->DesiredType != Decimal::typeid ) - { - return; - } - - // Converts the string back to decimal using the static Parse method. - cevent->Value = Decimal::Parse( cevent->Value->ToString(), - NumberStyles::Currency, nullptr ); - } - - void BindControl() - { - // Creates the binding first. The OrderAmount is a Decimal type. - Binding^ b = gcnew Binding( - "Text",ds,"customers.custToOrders.OrderAmount" ); - - // Add the delegates to the event. - b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); - b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); - text1->DataBindings->Add( b ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp deleted file mode 100644 index 2f487d4f82d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void PrintBindingIsBinding() - { - for each ( Control^ c in this->Controls ) - { - for each ( Binding^ b in c->DataBindings ) - { - Console::WriteLine( "\n {0}", c ); - Console::WriteLine( "{0} IsBinding: {1}", - b->PropertyName, b->IsBinding ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp deleted file mode 100644 index 29443aaa6ac..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - - // -private: - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts only to string type. Test this using the DesiredType. - if ( cevent->DesiredType != String::typeid ) - { - return; - } - - // Use the ToString method to format the value as currency ("c"). - cevent->Value = ( (Decimal)(cevent->Value) ).ToString( "c" ); - } - - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts back to decimal type only. - if ( cevent->DesiredType != Decimal::typeid ) - { - return; - } - - // Converts the string back to decimal using the static Parse method. - cevent->Value = Decimal::Parse( cevent->Value->ToString(), - NumberStyles::Currency, nullptr ); - } - - void BindControl() - { - // Creates the binding first. The OrderAmount is typed as Decimal. - Binding^ b = gcnew Binding( - "Text", ds, "customers.custToOrders.OrderAmount" ); - // Add the delegates to the event. - b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); - b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); - text1->DataBindings->Add( b ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp deleted file mode 100644 index f2c822bfe52..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void PrintPropertyNameAndIsBinding() - { - for each ( Control^ thisControl in this->Controls) - { - for each ( Binding^ thisBinding in thisControl->DataBindings ) - { - Console::WriteLine( "\n {0}", thisControl ); - // Print the PropertyName value for each binding. - Console::WriteLine( thisBinding->PropertyName ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp deleted file mode 100644 index 6de17a23e3c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - TextBox^ text2; - TextBox^ text3; - TextBox^ text4; - DateTimePicker^ DateTimePicker1; - DataSet^ ds; - BindingManagerBase^ bmCustomers; - BindingManagerBase^ bmOrders; - - // - void BindControls() - { - /* Create two Binding objects for the first two TextBox - controls. The data-bound property for both controls - is the Text property. The data source is a DataSet - (ds). The data member is a navigation path in the form: - "TableName.ColumnName". */ - text1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) ); - text2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) ); - - /* Bind the DateTimePicker control by adding a new Binding. - The data member of the DateTimePicker is a navigation path: - TableName.RelationName.ColumnName string. */ - DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) ); - - /* Add event delegates for the Parse and Format events to a - new Binding object, and add the object to the third - TextBox control's BindingsCollection. The delegates - must be added before adding the Binding to the - collection; otherwise, no formatting occurs until - the Current object of the BindingManagerBase for - the data source changes. */ - Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" ); - b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); - b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); - text3->DataBindings->Add( b ); - - // Get the BindingManagerBase for the Customers table. - bmCustomers = this->BindingContext[ ds,"Customers" ]; - - /* Get the BindingManagerBase for the Orders table using the - RelationName. */ - bmOrders = this->BindingContext[ds, "customers.CustToOrders"]; - - /* Bind the fourth TextBox control's Text property to the - third control's Text property. */ - text4->DataBindings->Add( "Text", text3, "Text" ); - } - // - -private: - void CurrencyStringToDecimal( Object^ sender, ConvertEventArgs^ cevent ) - { - - // does nothing - } - - void DecimalToCurrencyString( Object^ sender, ConvertEventArgs^ cevent ) - { - - // does nothing - } - -}; - -int main() -{ - //Application::Run(new Form1()); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp deleted file mode 100644 index b2c0ad4f581..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - GroupBox^ groupBox1; - GroupBox^ groupBox2; - TextBox^ textBox1; - TextBox^ textBox2; - DataSet^ ds; - -private: - - // - void BindControls() - { - System::Windows::Forms::BindingContext^ bcG1 = gcnew System::Windows::Forms::BindingContext; - System::Windows::Forms::BindingContext^ bcG2 = gcnew System::Windows::Forms::BindingContext; - groupBox1->BindingContext = bcG1; - groupBox2->BindingContext = bcG2; - textBox1->DataBindings->Add( "Text", ds, "Customers.CustName" ); - textBox2->DataBindings->Add( "Text", ds, "Customers.CustName" ); - } - - void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - groupBox1->BindingContext[ds, "Customers"]->Position = groupBox1->BindingContext[ds, "Customers"]->Position + 1; - } - - void Button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - groupBox2->BindingContext[ds, "Customers"]->Position = groupBox2->BindingContext[ds, "Customers"]->Position + 1; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp deleted file mode 100644 index 1de98eef4c9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void TryContains( DataSet^ myDataSet ) - { - // Test each DataTable in a DataSet to see if it is bound to a BindingManagerBase. - for each ( DataTable^ thisTable in myDataSet->Tables ) - { - Console::WriteLine( "{0}: {1}", thisTable->TableName, this->BindingContext->Contains( thisTable ) ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp deleted file mode 100644 index a449d71035f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void TryContainsDataMember( DataSet^ myDataSet ) - { - bool trueorfalse; - trueorfalse = this->BindingContext->Contains( myDataSet, "Suppliers" ); - Console::WriteLine( trueorfalse ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp deleted file mode 100644 index 2bf72ad92de..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void CopyToArray() - { - // Declare the array. - array^ myArray = gcnew array(100); - ( (ICollection^)(this->BindingContext) )->CopyTo( myArray, 0 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp deleted file mode 100644 index 150886ecc54..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void PrintCount() - { - Console::WriteLine( "BindingContext->Count {0}", - ( (ICollection^)(this->BindingContext) )->Count ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index 7c887568f99..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetManagerEnumerator() - { - IEnumerator^ myEnumerator; - myEnumerator = ( (IEnumerable^)(this->BindingContext) )->GetEnumerator(); - ForEachEnumerator(); - } - - void ForEachEnumerator() - { - for each ( IEnumerator^ myEnumerator in ( (IEnumerable^)(this->BindingContext) ) ) - { - Console::WriteLine( myEnumerator ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp deleted file mode 100644 index f92a4dabcf4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Collections; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataView^ myDataView; - ArrayList^ myArrayList; - -private: - - // - void ReturnBindingManagerBase() - { - - // Get the BindingManagerBase for a DataView. - BindingManagerBase^ bmCustomers = this->BindingContext[ myDataView ]; - - /* Get the BindingManagerBase for an ArrayList. */ - BindingManagerBase^ bmOrders = this->BindingContext[ myArrayList ]; - - // Get the BindingManagerBase for a TextBox control. - BindingManagerBase^ baseArray = this->BindingContext[ textBox1->DataBindings[ nullptr ]->DataSource ]; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp deleted file mode 100644 index 12bbb580b25..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp +++ /dev/null @@ -1,81 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataSet^ DataSet1; - BindingManagerBase^ myBindingManagerBase; - -private: - - // - void GetBindingManagerBase() - { - - /* CustomersToOrders is the RelationName of a DataRelation. - Therefore, the list maintained by the BindingManagerBase is the - list of orders that belong to a specific customer in the - DataTable named Customers, found in DataSet1. */ - myBindingManagerBase = this->BindingContext[DataSet1, "Customers.CustomersToOrders"]; - - // Adds delegates to the CurrentChanged and PositionChanged events. - myBindingManagerBase->PositionChanged += gcnew EventHandler( this, &Form1::BindingManagerBase_PositionChanged ); - myBindingManagerBase->CurrentChanged += gcnew EventHandler( this, &Form1::BindingManagerBase_CurrentChanged ); - } - - void BindingManagerBase_PositionChanged( Object^ sender, EventArgs^ /*e*/ ) - { - - // Prints the new Position of the BindingManagerBase. - Console::Write( "Position Changed: " ); - Console::WriteLine( (dynamic_cast(sender))->Position ); - } - - void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ ) - { - - // Prints the new value of the current object. - Console::Write( "Current Changed: " ); - Console::WriteLine( (dynamic_cast(sender))->Current ); - } - - void MoveNext() - { - - // Increments the Position property value by one. - myBindingManagerBase->Position = myBindingManagerBase->Position + 1; - } - - void MovePrevious() - { - - // Decrements the Position property value by one. - myBindingManagerBase->Position = myBindingManagerBase->Position - 1; - } - - void MoveFirst() - { - - // Goes to the first row in the list. - myBindingManagerBase->Position = 0; - } - - void MoveLast() - { - - // Goes to the last row in the list. - myBindingManagerBase->Position = myBindingManagerBase->Count - 1; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp deleted file mode 100644 index 1402397723e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - -private: - - // - void PrintBoundControls() - { - BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"customers" ]; - System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Binding^ b = safe_cast(myEnum->Current); - Console::WriteLine( b->Control ); - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp deleted file mode 100644 index 4d562d5ab71..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - BindingManagerBase^ myBindingManagerBase; - - // -private: - void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ ) - { - // Print the new value of the current object. - Console::Write( "Current Changed: " ); - Console::WriteLine( ( (BindingManagerBase^)(sender) )->Current ); - } - - void MoveNext() - { - // Increment the Position property value by one. - myBindingManagerBase->Position = myBindingManagerBase->Position + 1; - } - - void MovePrevious() - { - // Decrement the Position property value by one. - myBindingManagerBase->Position = myBindingManagerBase->Position - 1; - } - - void MoveFirst() - { - // Go to the first item in the list. - myBindingManagerBase->Position = 0; - } - - void MoveLast() - { - // Go to the last row in the list. - myBindingManagerBase->Position = myBindingManagerBase->Count - 1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp deleted file mode 100644 index a4d4f230f20..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - - // - void Current_Changed( Object^ sender, EventArgs^ /*e*/ ) - { - BindingManagerBase^ bm = dynamic_cast(sender); - - /* Check the type of the Current object. If it is not a - DataRowView, exit the method. */ - if ( bm->Current->GetType() != DataRowView::typeid ) - return; - - // Otherwise, print the value of the column named "CustName". - DataRowView^ drv = dynamic_cast(bm->Current); - Console::Write( "CurrentChanged): " ); - Console::Write( drv[ "CustName" ] ); - Console::WriteLine(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp deleted file mode 100644 index 7eb4803cebe..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void ShowGetItemProperties() - { - - // Create a new DataTable and add two columns. - DataTable^ dt = gcnew DataTable; - dt->Columns->Add( "Name", Type::GetType( "System.String" ) ); - dt->Columns->Add( "ID", Type::GetType( "System.String" ) ); - - // Add a row to the table. - DataRow^ dr = dt->NewRow(); - dr[ "Name" ] = "Ann"; - dr[ "ID" ] = "AAA"; - dt->Rows->Add( dr ); - PropertyDescriptorCollection^ myPropertyDescriptors = this->BindingContext[ dt ]->GetItemProperties(); - PropertyDescriptor^ myPropertyDescriptor = myPropertyDescriptors[ "Name" ]; - Console::WriteLine( myPropertyDescriptor->Name ); - Console::WriteLine( myPropertyDescriptor->GetValue( dt->DefaultView[ 0 ] ) ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp deleted file mode 100644 index 03be34c5dc2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void PrintPropertyDescriptions( BindingManagerBase^ b ) - { - Console::WriteLine( "Printing Property Descriptions" ); - PropertyDescriptorCollection^ ps = b->GetItemProperties(); - for ( int i = 0; i < ps->Count; i++ ) - { - Console::WriteLine( "\t{0}\t{1}", ps[ i ]->Name, ps[ i ]->PropertyType ); - - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp deleted file mode 100644 index 606e0e5fcb5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - - // - void BindControl() - { - - /* Create a Binding object for the TextBox control. - The data-bound property for the control is the Text - property. */ - Binding^ myBinding = gcnew Binding( "Text",ds,"customers.custName" ); - text1->DataBindings->Add( myBinding ); - - // Get the BindingManagerBase for the Customers table. - BindingManagerBase^ bmCustomers = this->BindingContext[ ds,"Customers" ]; - - // Add the delegate for the PositionChanged event. - bmCustomers->PositionChanged += gcnew EventHandler( this, &Form1::Position_Changed ); - } - - -private: - void Position_Changed( Object^ sender, EventArgs^ /*e*/ ) - { - - // Print the Position property value when it changes. - Console::WriteLine( (dynamic_cast(sender))->Position ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp deleted file mode 100644 index 455be8b1188..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void PrintBindingMemberInfo() - { - for each ( Control^ c in this->Controls ) - { - for each ( Binding^ b in c->DataBindings ) - { - Console::WriteLine( "\n {0}", c ); - BindingMemberInfo bInfo = b->BindingMemberInfo; - Console::WriteLine( "Binding Path \t {0}", bInfo.BindingPath ); - Console::WriteLine( "Binding Field \t {0}", bInfo.BindingField ); - Console::WriteLine( "Binding Member \t {0}", bInfo.BindingMember ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp deleted file mode 100644 index a233f0c82ca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - void PrintBindingMemberInfo() - { - Console::WriteLine( "\n BindingMemberInfo" ); - for each ( Control^ thisControl in this->Controls ) - { - for each ( Binding^ thisBinding in thisControl->DataBindings ) - { - BindingMemberInfo bInfo = thisBinding->BindingMemberInfo; - Console::WriteLine( "\t BindingPath: {0}", bInfo.BindingPath ); - Console::WriteLine( "\t BindingField: {0}", bInfo.BindingField ); - Console::WriteLine( "\t BindingMember: {0}", bInfo.BindingMember ); - Console::WriteLine(); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp deleted file mode 100644 index 5def83b5196..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Globalization; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - - // -private: - void BindTextBoxControl() - { - DataSet^ myDataSet = gcnew DataSet; - /* Insert code to populate the DataSet with tables, - columns, and data. */ - - // Creates a new Binding object. - Binding^ myBinding = gcnew Binding( - "Text",myDataSet,"customers.custToOrders.OrderAmount" ); - - // Adds event delegates for the Parse and Format events. - myBinding->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyToDecimal ); - myBinding->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrency ); - - // Adds the new Binding to the BindingsCollection. - text1->DataBindings->Add( myBinding ); - } - - void DecimalToCurrency( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - /* This method is the Format event handler. Whenever the - control displays a new value, the value is converted from - its native Decimal type to a string. The ToString method - then formats the value as a Currency, by using the - formatting character "c". */ - cevent->Value = safe_cast(cevent->Value)->ToString( "c" ); - } - - void CurrencyToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - /* This method is the Parse event handler. The Parse event - occurs whenever the displayed value changes. The static - Parse method of the Decimal structure converts the - string back to its native Decimal type. */ - cevent->Value = Decimal::Parse( cevent->Value->ToString(), - NumberStyles::Currency, nullptr ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp deleted file mode 100644 index 715ad30757d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - -private: - - // - void PrintBindingInfo() - { - BindingsCollection^ bc = text1->DataBindings; - for ( int i = 0; i < bc->Count; i++ ) - Console::WriteLine( bc[ i ]->BindingMemberInfo.BindingMember ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp deleted file mode 100644 index 98b137766ad..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ - // -public: - [Browsable(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int value ) - { - // Insert code here. - } - } - // - - property int MyProperty2 - { - - int get() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the value of the BrowsableAttribute is Yes. - if ( attributes[ BrowsableAttribute::typeid ]->Equals( BrowsableAttribute::Yes ) ) - { - - // Insert code here. - } - - // This is another way to see whether the property is browsable. - BrowsableAttribute^ myAttribute = dynamic_cast(attributes[ BrowsableAttribute::typeid ]); - if ( myAttribute->Browsable ) - { - // Insert code here. - } - // - return 0; - } - } - - property int MyProperty3 - { - int get() - { - // - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); - if ( attributes[ BrowsableAttribute::typeid ]->Equals( BrowsableAttribute::Yes ) ) - { - // Insert code here. - } - // - return 0; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp deleted file mode 100644 index ace5523f8ef..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the property is browsable. - BrowsableAttribute^ myAttribute = dynamic_cast(attributes[ BrowsableAttribute::typeid ]); - if ( myAttribute->Browsable ) - { - // Insert code here. - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp deleted file mode 100644 index fead6b5da22..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - property int MyProperty - { - // - [Browsable(true)] - int get() - { - // Insert code here. - return 0; - } - void set( int value ) - { - - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp deleted file mode 100644 index 34bc77d638e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - void InitializeMyButton() - { - // Create and initialize a Button. - Button^ button1 = gcnew Button; - - // Set the button to return a value of OK when clicked. - button1->DialogResult = ::DialogResult::OK; - - // Add the button to the form. - Controls->Add( button1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp deleted file mode 100644 index 5540ff5fd46..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button2; - int myVar; - - // -private: - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // If myVar is an even number, click Button2. - if ( myVar % 2 == 0 ) - { - button2->PerformClick(); - // Display the status of Button2's Click event. - MessageBox::Show( "button2 was clicked " ); - } - else - { - // Display the status of Button2's Click event. - MessageBox::Show( "button2 was NOT clicked" ); - } - // Increment myVar. - myVar++; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp deleted file mode 100644 index 36c674813d3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - Button^ button1; - - // -private: - void SetMyButtonProperties() - { - // Assign an image to the button. - button1->Image = Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" ); - // Align the image and text on the button. - button1->ImageAlign = ContentAlignment::MiddleRight; - button1->TextAlign = ContentAlignment::MiddleLeft; - // Give the button a flat appearance. - button1->FlatStyle = FlatStyle::Flat; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp deleted file mode 100644 index 9eee76a0ff2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - Button^ button1; - ImageList^ imageList1; - - // -private: - void AddMyImage() - { - // Assign an image to the imageList. - imageList1->Images->Add( Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" ) ); - // Assign the imageList to the button control. - button1->ImageList = imageList1; - // Select the image from the ImageList (using the ImageIndex property). - button1->ImageIndex = 0; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp deleted file mode 100644 index ebb3d856ac7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - bool myDataIsSaved; - - // -private: - // Call this method from the InitializeComponent() method of your form - void OtherInitialize() - { - this->Closing += gcnew CancelEventHandler( this, &Form1::Form1_Cancel ); - this->myDataIsSaved = true; - } - - void Form1_Cancel( Object^ /*sender*/, CancelEventArgs^ e ) - { - if ( !myDataIsSaved ) - { - e->Cancel = true; - MessageBox::Show( "You must save first." ); - } - else - { - e->Cancel = false; - MessageBox::Show( "Goodbye." ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp deleted file mode 100644 index 408c380eb86..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::ComponentModel; -ref class C -{ -public: - System::Drawing::Image^ m_Image1; - - property System::Drawing::Image^ MyImage - { - - // - [Description("The image associated with the control"),Category("Appearance")] - System::Drawing::Image^ get() - { - // Insert code here. - return m_Image1; - } - - void set( System::Drawing::Image^ ) - { - // Insert code here. - } - } - // - - void MyMethod() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyImage" ]->Attributes; - - // Prints the description by retrieving the CategoryAttribute. - // from the AttributeCollection. - CategoryAttribute^ myAttribute = static_cast(attributes[ CategoryAttribute::typeid ]); - Console::WriteLine( myAttribute->Category ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp deleted file mode 100644 index ef6927cc6a8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - CheckBox^ checkBox1; - Label^ label1; - - // -private: - void AdjustMyCheckBoxProperties() - { - // Concatenate the property values together on three lines. - label1->Text = String::Format( "ThreeState: {0}\nChecked: {1}\nCheckState: {2}", - checkBox1->ThreeState, checkBox1->Checked, checkBox1->CheckState ); - - // Change the ThreeState and CheckAlign properties on every other click. - if ( !checkBox1->ThreeState ) - { - checkBox1->ThreeState = true; - checkBox1->CheckAlign = ContentAlignment::MiddleRight; - } - else - { - checkBox1->ThreeState = false; - checkBox1->CheckAlign = ContentAlignment::MiddleLeft; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp deleted file mode 100644 index 1508b6f4e44..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void InstantiateMyCheckBox() - { - // Create and initialize a CheckBox. - CheckBox^ checkBox1 = gcnew CheckBox; - - // Make the check box control appear as a toggle button. - checkBox1->Appearance = Appearance::Button; - - // Turn off the update of the display on the click of the control. - checkBox1->AutoCheck = false; - - // Add the check box control to the form. - this->Controls->Add( checkBox1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp deleted file mode 100644 index ccce5e98d91..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp +++ /dev/null @@ -1,172 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::CheckedListBox^ checkedListBox1; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button3; - System::ComponentModel::Container^ components; - -public: - Form1() - { - InitializeComponent(); - - // Sets up the initial objects in the CheckedListBox. - array^myFruit = {"Apples","Oranges","Tomato"}; - checkedListBox1->Items->AddRange( myFruit ); - - // Changes the selection mode from double-click to single click. - checkedListBox1->CheckOnClick = true; - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->checkedListBox1 = gcnew System::Windows::Forms::CheckedListBox; - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->button3 = gcnew System::Windows::Forms::Button; - this->textBox1->Location = System::Drawing::Point( 144, 64 ); - this->textBox1->Size = System::Drawing::Size( 128, 20 ); - this->textBox1->TabIndex = 1; - this->textBox1->TextChanged += gcnew System::EventHandler( this, &Form1::textBox1_TextChanged ); - this->checkedListBox1->Location = System::Drawing::Point( 16, 64 ); - this->checkedListBox1->Size = System::Drawing::Size( 120, 184 ); - this->checkedListBox1->TabIndex = 0; - this->checkedListBox1->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler( this, &Form1::checkedListBox1_ItemCheck ); - this->listBox1->Location = System::Drawing::Point( 408, 64 ); - this->listBox1->Size = System::Drawing::Size( 128, 186 ); - this->listBox1->TabIndex = 3; - this->button1->Enabled = false; - this->button1->Location = System::Drawing::Point( 144, 104 ); - this->button1->Size = System::Drawing::Size( 104, 32 ); - this->button1->TabIndex = 2; - this->button1->Text = "Add Fruit"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - this->button2->Enabled = false; - this->button2->Location = System::Drawing::Point( 288, 64 ); - this->button2->Size = System::Drawing::Size( 104, 32 ); - this->button2->TabIndex = 2; - this->button2->Text = "Show Order"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - this->button3->Enabled = false; - this->button3->Location = System::Drawing::Point( 288, 104 ); - this->button3->Size = System::Drawing::Size( 104, 32 ); - this->button3->TabIndex = 2; - this->button3->Text = "Save Order"; - this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - this->ClientSize = System::Drawing::Size( 563, 273 ); - array^temp0 = {this->listBox1,this->button3,this->button2,this->button1,this->textBox1,this->checkedListBox1}; - this->Controls->AddRange( temp0 ); - this->Text = "Fruit Order"; - } - - // Adds the string if the text box has data in it. - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( !textBox1->Text->Equals( "" ) ) - { - if ( !checkedListBox1->CheckedItems->Contains( textBox1->Text ) ) - checkedListBox1->Items->Add( textBox1->Text, CheckState::Checked ); - textBox1->Text = ""; - } - } - - // Activates or deactivates the Add button. - void textBox1_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( textBox1->Text->Equals( "" ) ) - { - button1->Enabled = false; - } - else - { - button1->Enabled = true; - } - } - - // Moves the checked items from the CheckedListBox to the listBox. - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - listBox1->Items->Clear(); - button3->Enabled = false; - for ( int i = 0; i < checkedListBox1->CheckedItems->Count; i++ ) - { - listBox1->Items->Add( checkedListBox1->CheckedItems[ i ] ); - - } - if ( listBox1->Items->Count > 0 ) - button3->Enabled = true; - } - - // Activates the move button if there are checked items. - void checkedListBox1_ItemCheck( Object^ /*sender*/, ItemCheckEventArgs^ e ) - { - if ( e->NewValue == CheckState::Unchecked ) - { - if ( checkedListBox1->CheckedItems->Count == 1 ) - { - button2->Enabled = false; - } - } - else - { - button2->Enabled = true; - } - } - - // Saves the items to a file. - void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Insert code to save a file. - listBox1->Items->Clear(); - IEnumerator^ myEnumerator; - myEnumerator = checkedListBox1->CheckedIndices->GetEnumerator(); - int y; - while ( myEnumerator->MoveNext() ) - { - y = safe_cast(myEnumerator->Current); - checkedListBox1->SetItemChecked( y, false ); - } - - button3->Enabled = false; - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp deleted file mode 100644 index 4499a79da98..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - TextBox^ textBox2; - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Takes the selected text from a text box and puts it on the clipboard. - if ( !textBox1->SelectedText->Equals( "" ) ) - { - Clipboard::SetDataObject( textBox1->SelectedText ); - } - else - { - textBox2->Text = "No text selected in textBox1"; - } - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Declares an IDataObject to hold the data returned from the clipboard. - // Retrieves the data from the clipboard. - IDataObject^ iData = Clipboard::GetDataObject(); - - // Determines whether the data is in a format you can use. - if ( iData->GetDataPresent( DataFormats::Text ) ) - { - // Yes it is, so display it in a text box. - textBox2->Text = (String^)(iData->GetData( DataFormats::Text )); - } - else - { - // No it is not. - textBox2->Text = "Could not retrieve data off the clipboard."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp deleted file mode 100644 index 0c6fc8f64fb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - TextBox^ textBox2; - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Takes the selected text from a text box and puts it on the clipboard. - if ( !textBox1->SelectedText->Equals( "" ) ) - { - Clipboard::SetDataObject( textBox1->SelectedText, true ); - } - else - { - textBox2->Text = "No text selected in textBox1"; - } - } - // - - // -private: - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Declares an IDataObject to hold the data returned from the clipboard. - // Retrieves the data from the clipboard. - IDataObject^ iData = Clipboard::GetDataObject(); - - // Determines whether the data is in a format you can use. - if ( iData->GetDataPresent( DataFormats::Text ) ) - { - - // Yes it is, so display it in a text box. - textBox2->Text = (String^)(iData->GetData( DataFormats::Text )); - } - else - { - - // No it is not. - textBox2->Text = "Could not retrieve data off the clipboard."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp deleted file mode 100644 index c773dda4e2a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ColorDialog^ MyDialog = gcnew ColorDialog; - // Keeps the user from selecting a custom color. - MyDialog->AllowFullOpen = false; - // Allows the user to get help. (The default is false.) - MyDialog->ShowHelp = true; - // Sets the initial color select to the current text color. - MyDialog->Color = textBox1->ForeColor; - - // Update the text box color if the user clicks OK - if ( MyDialog->ShowDialog() == ::System::Windows::Forms::DialogResult::OK ) - { - textBox1->ForeColor = MyDialog->Color; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp deleted file mode 100644 index 5b5b300a1e2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - TextBox^ pictureBox1; - System::Windows::Forms::ContextMenu^ contextMenu1; - - // -private: - void MyPopupEventHandler( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Define the MenuItem objects to display for the TextBox. - MenuItem^ menuItem1 = gcnew MenuItem( "&Copy" ); - MenuItem^ menuItem2 = gcnew MenuItem( "&Find and Replace" ); - // Define the MenuItem object to display for the PictureBox. - MenuItem^ menuItem3 = gcnew MenuItem( "C&hange Picture" ); - - // Clear all previously added MenuItems. - contextMenu1->MenuItems->Clear(); - - if ( contextMenu1->SourceControl == textBox1 ) - { - - // Add MenuItems to display for the TextBox. - contextMenu1->MenuItems->Add( menuItem1 ); - contextMenu1->MenuItems->Add( menuItem2 ); - } - else if ( contextMenu1->SourceControl == pictureBox1 ) - { - // Add the MenuItem to display for the PictureBox. - contextMenu1->MenuItems->Add( menuItem3 ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp deleted file mode 100644 index cee6b37d291..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void AddEventHandler() - { - textBox1->BindingContextChanged += gcnew EventHandler( - this, &Form1::BindingContext_Changed ); - } - - void BindingContext_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Console::WriteLine( "BindingContext changed" ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp deleted file mode 100644 index 93dd4777cb9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - TextBox^ textBox2; - TextBox^ textBox3; - TextBox^ textBox4; - DateTimePicker^ DateTimePicker1; - BindingManagerBase^ bmCustomers; - BindingManagerBase^ bmOrders; - DataSet^ ds; - - // - void BindControls() - { - - /* Create two Binding objects for the first two TextBox - controls. The data-bound property for both controls - is the Text property. The data source is a DataSet - (ds). The data member is specified by a navigation - path in the form : TableName.ColumnName. */ - textBox1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) ); - textBox2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) ); - - /* Bind the DateTimePicker control by adding a new Binding. - The data member of the DateTimePicker is specified by a - navigation path in the form: TableName.RelationName.ColumnName. */ - DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) ); - - /* Create a new Binding using the DataSet and a - navigation path(TableName.RelationName.ColumnName). - Add event delegates for the Parse and Format events to - the Binding object, and add the object to the third - TextBox control's BindingsCollection. The delegates - must be added before adding the Binding to the - collection; otherwise, no formatting occurs until - the Current object of the BindingManagerBase for - the data source changes. */ - Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" ); - b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); - b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); - textBox3->DataBindings->Add( b ); - - /*Bind the fourth TextBox to the Value of the - DateTimePicker control. This demonstrates how one control - can be bound to another.*/ - textBox4->DataBindings->Add( "Text", DateTimePicker1, "Value" ); - BindingManagerBase^ bmText = this->BindingContext[ DateTimePicker1 ]; - - /* Print the Type of the BindingManagerBase, which is - a PropertyManager because the data source - returns only a single property value. */ - Console::WriteLine( bmText->GetType() ); - - // Print the count of managed objects, which is 1. - Console::WriteLine( bmText->Count ); - - // Get the BindingManagerBase for the Customers table. - bmCustomers = this->BindingContext[ds, "Customers"]; - - /* Print the Type and count of the BindingManagerBase. - Because the data source inherits from IBindingList, - it is a RelatedCurrencyManager (derived from CurrencyManager). */ - Console::WriteLine( bmCustomers->GetType() ); - Console::WriteLine( bmCustomers->Count ); - - /* Get the BindingManagerBase for the Orders of the current - customer using a navigation path: TableName.RelationName. */ - bmOrders = this->BindingContext[ds, "customers.CustToOrders"]; - } - // - -private: - - // method added so sample will compile - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} - - // method added so sample will compile - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} - -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp deleted file mode 100644 index ac3591af8bf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - PictureBox^ pictureBox1; - ScrollBar^ hScrollBar1; - ScrollBar^ vScrollBar1; - - // -public: - void DisplayScrollBars() - { - // Display or hide the scroll bars based upon - // whether the image is larger than the PictureBox. - if ( pictureBox1->Width > pictureBox1->Image->Width ) - { - hScrollBar1->Visible = false; - } - else - { - hScrollBar1->Visible = true; - } - - if ( pictureBox1->Height > pictureBox1->Image->Height ) - { - vScrollBar1->Visible = false; - } - else - { - vScrollBar1->Visible = true; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp deleted file mode 100644 index 42d43c93bdb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - TextBox^ textBox2; - TextBox^ textBox3; - TextBox^ textBox4; - DateTimePicker^ DateTimePicker1; - BindingManagerBase^ bmCustomers; - BindingManagerBase^ bmOrders; - DataSet^ ds; - - // -protected: - void BindControls() - { - /* Create two Binding objects for the first two TextBox - controls. The data-bound property for both controls - is the Text property. The data source is a DataSet - (ds). The data member is the navigation path: - TableName.ColumnName. */ - textBox1->DataBindings->Add( gcnew Binding( - "Text",ds,"customers.custName" ) ); - textBox2->DataBindings->Add( gcnew Binding( - "Text",ds,"customers.custID" ) ); - - /* Bind the DateTimePicker control by adding a new Binding. - The data member of the DateTimePicker is a navigation path: - TableName.RelationName.ColumnName. */ - DateTimePicker1->DataBindings->Add( gcnew Binding( - "Value",ds,"customers.CustToOrders.OrderDate" ) ); - - /* Create a new Binding using the DataSet and a - navigation path(TableName.RelationName.ColumnName). - Add event delegates for the Parse and Format events to - the Binding object, and add the object to the third - TextBox control's BindingsCollection. The delegates - must be added before adding the Binding to the - collection; otherwise, no formatting occurs until - the Current object of the BindingManagerBase for - the data source changes. */ - Binding^ b = gcnew Binding( - "Text",ds,"customers.custToOrders.OrderAmount" ); - b->Parse += gcnew ConvertEventHandler( - this, &Form1::CurrencyStringToDecimal ); - b->Format += gcnew ConvertEventHandler( - this, &Form1::DecimalToCurrencyString ); - textBox3->DataBindings->Add( b ); - - /*Bind the fourth TextBox to the Value of the - DateTimePicker control. This demonstates how one control - can be data-bound to another.*/ - textBox4->DataBindings->Add( "Text", DateTimePicker1, "Value" ); - - // Get the BindingManagerBase for the textBox4 Binding. - BindingManagerBase^ bmText = this->BindingContext[ - DateTimePicker1 ]; - - /* Print the Type of the BindingManagerBase, which is - a PropertyManager because the data source - returns only a single property value. */ - Console::WriteLine( bmText->GetType() ); - - // Print the count of managed objects, which is one. - Console::WriteLine( bmText->Count ); - - // Get the BindingManagerBase for the Customers table. - bmCustomers = this->BindingContext[ds, "Customers"]; - - /* Print the Type and count of the BindingManagerBase. - Because the data source inherits from IBindingList, - it is a RelatedCurrencyManager (a derived class of - CurrencyManager). */ - Console::WriteLine( bmCustomers->GetType() ); - Console::WriteLine( bmCustomers->Count ); - - /* Get the BindingManagerBase for the Orders of the current - customer using a navigation path: TableName.RelationName. */ - bmOrders = this->BindingContext[ds, "customers.CustToOrders"]; - } - // - -private: - // method added so sample will compile - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} - - // method added so sample will compile - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp deleted file mode 100644 index abacb741b88..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataSet^ ds; - - // -protected: - void BindControls() - { - /* Create a new Binding using the DataSet and a - navigation path(TableName.RelationName.ColumnName). - Add event delegates for the Parse and Format events to - the Binding object, and add the object to the third - TextBox control's BindingsCollection. The delegates - must be added before adding the Binding to the - collection; otherwise, no formatting occurs until - the Current object of the BindingManagerBase for - the data source changes. */ - Binding^ b = gcnew Binding( - "Text",ds,"customers.custToOrders.OrderAmount" ); - b->Parse += gcnew ConvertEventHandler( - this, &Form1::CurrencyStringToDecimal ); - b->Format += gcnew ConvertEventHandler( - this, &Form1::DecimalToCurrencyString ); - textBox1->DataBindings->Add( b ); - } - // - -private: - // method added so sample will compile - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} - - // method added so sample will compile - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp deleted file mode 100644 index 7c95df795ee..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void BindTextBoxProperties() - { - // Clear the collection before adding new Binding objects. - textBox1->DataBindings->Clear(); - - // Create a DataTable containing Color objects. - DataTable^ t = MakeTable(); - - /* Bind the Text, BackColor, and ForeColor properties - to columns in the DataTable. */ - textBox1->DataBindings->Add( "Text", t, "Text" ); - textBox1->DataBindings->Add( "BackColor", t, "BackColor" ); - textBox1->DataBindings->Add( "ForeColor", t, "ForeColor" ); - } - - DataTable^ MakeTable() - { - /* Create a DataTable with three columns. - Two of the columns contain Color objects. */ - DataTable^ t = gcnew DataTable( "Control" ); - t->Columns->Add( "BackColor", Color::typeid ); - t->Columns->Add( "ForeColor", Color::typeid ); - t->Columns->Add( "Text" ); - - // Add three rows to the table. - DataRow^ r; - r = t->NewRow(); - r[ "BackColor" ] = Color::Blue; - r[ "ForeColor" ] = Color::Yellow; - r[ "Text" ] = "Yellow on Blue"; - t->Rows->Add( r ); - r = t->NewRow(); - r[ "BackColor" ] = Color::White; - r[ "ForeColor" ] = Color::Green; - r[ "Text" ] = "Green on white"; - t->Rows->Add( r ); - r = t->NewRow(); - r[ "BackColor" ] = Color::Orange; - r[ "ForeColor" ] = Color::Black; - r[ "Text" ] = "Black on Orange"; - t->Rows->Add( r ); - return t; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp deleted file mode 100644 index 37e946cd6a8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - GroupBox^ groupBox1; - - // -private: - void ClearAllBindings() - { - for each ( Control^ c in groupBox1->Controls ) - { - c->DataBindings->Clear(); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp deleted file mode 100644 index 04735dfd054..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - void GetControl( ControlBindingsCollection^ myBindings ) - { - Control^ c = myBindings->Control; - Console::WriteLine( c ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp deleted file mode 100644 index 3f63c9652f8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void RemoveBackColorBinding() - { - Binding^ colorBinding = textBox1->DataBindings[ "BackColor" ]; - textBox1->DataBindings->Remove( colorBinding ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp deleted file mode 100644 index 7217503d900..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void RemoveThirdBinding() - { - if ( textBox1->DataBindings->Count < 3 ) - { - return; - } - textBox1->DataBindings->RemoveAt( 2 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp deleted file mode 100644 index 72e6eeac1be..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - - // -private: - void BindControl() - { - // Create the binding first. The OrderAmount is typed as Decimal. - Binding^ b = gcnew Binding( - "Text",ds,"customers.custToOrders.OrderAmount" ); - // Add the delegates to the events. - b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); - b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); - text1->DataBindings->Add( b ); - } - - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // Check for the appropriate DesiredType. - if ( cevent->DesiredType != String::typeid ) - { - return; - } - - // Use the ToString method to format the value as currency ("c"). - cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); - } - - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // Check for the appropriate DesiredType. - if ( cevent->DesiredType != Decimal::typeid ) - { - return; - } - - // Convert the string back to decimal using the static Parse method. - cevent->Value = Decimal::Parse( cevent->Value->ToString(), - NumberStyles::Currency, nullptr ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp deleted file mode 100644 index 43f84af9a4b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - - // -private: - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts only to string type. Test this using the DesiredType. - if ( cevent->DesiredType != String::typeid ) - { - return; - } - - // Use the ToString method to format the value as currency ("c"). - cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); - } - - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts back to decimal type only. - if ( cevent->DesiredType != Decimal::typeid ) - { - return; - } - - // Converts the string back to decimal using the static Parse method. - cevent->Value = Decimal::Parse( cevent->Value->ToString(), - NumberStyles::Currency, nullptr ); - } - - void BindControl() - { - // Creates the binding first. The OrderAmount is typed as Decimal. - Binding^ b = gcnew Binding( - "Text",ds,"customers.custToOrders.OrderAmount" ); - - // Adds the delegates to the events. - b->Format += gcnew ConvertEventHandler( - this, &Form1::DecimalToCurrencyString ); - b->Parse += gcnew ConvertEventHandler( - this, &Form1::CurrencyStringToDecimal ); - text1->DataBindings->Add( b ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp deleted file mode 100644 index deba5ab77bd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts only to string type. - if ( cevent->DesiredType != String::typeid ) - { - return; - } - - cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); - } - - void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts only to decimal type. - if ( cevent->DesiredType != Decimal::typeid ) - { - return; - } - - cevent->Value = Decimal::Parse( cevent->Value->ToString(), - NumberStyles::Currency, nullptr ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp deleted file mode 100644 index 5a1c7352585..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - DataSet^ ds; - - // -private: - void DecimalToCurrency( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // The method converts only to string type. Test this using the DesiredType. - if ( cevent->DesiredType != String::typeid ) - { - return; - } - - // Use the ToString method to format the value as currency ("c"). - cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); - } - - void CurrencyToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) - { - // ' The method converts only to decimal type. - if ( cevent->DesiredType != Decimal::typeid ) - { - return; - } - - // Converts the string back to decimal using the static ToDecimal method. - cevent->Value = Convert::ToDecimal( cevent->Value->ToString() ); - } - - void BindControl() - { - // Creates the binding first. The OrderAmount is typed as Decimal. - Binding^ b = gcnew Binding( - "Text",ds,"customers.custToOrders.OrderAmount" ); - - // Add the delegates to the events. - b->Format += gcnew ConvertEventHandler( - this, &Form1::DecimalToCurrency ); - b->Parse += gcnew ConvertEventHandler( - this, &Form1::CurrencyToDecimal ); - text1->DataBindings->Add( b ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp deleted file mode 100644 index 08d9400eddf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - CurrencyManager^ myCurrencyManager; - void BindControl( DataTable^ myTable ) - { - - // Bind a TextBox control to a DataTable column in a DataSet. - textBox1->DataBindings->Add( "Text", myTable, "CompanyName" ); - - // Specify the CurrencyManager for the DataTable. - this->myCurrencyManager = dynamic_cast(this->BindingContext[ myTable ]); - - // Set the initial Position of the control. - this->myCurrencyManager->Position = 0; - } - - void MoveNext( CurrencyManager^ myCurrencyManager ) - { - if ( myCurrencyManager->Position == myCurrencyManager->Count - 1 ) - { - MessageBox::Show( "You're at end of the records" ); - } - else - { - myCurrencyManager->Position += 1; - } - } - - void MoveFirst( CurrencyManager^ myCurrencyManager ) - { - myCurrencyManager->Position = 0; - } - - void MovePrevious( CurrencyManager^ myCurrencyManager ) - { - if ( myCurrencyManager->Position == 0 ) - { - MessageBox::Show( "You're at the beginning of the records." ); - } - else - { - myCurrencyManager->Position -= 1; - } - } - - void MoveLast( CurrencyManager^ myCurrencyManager ) - { - myCurrencyManager->Position = myCurrencyManager->Count - 1; - } - - // -}; - -int main() -{ - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp deleted file mode 100644 index fbaa7f24a3d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataTable^ DataTable1; - -private: - - // - void AddListItem() - { - - // Get the CurrencyManager for a DataTable. - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ DataTable1 ]); - myCurrencyManager->AddNew(); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp deleted file mode 100644 index 3ed60b809ce..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) - { - if ( e->KeyCode == System::Windows::Forms::Keys::Escape ) - { - - // Escape key pressed. - CurrencyManager^ gridCurrencyManager = dynamic_cast(this->BindingContext[dataGrid1->DataSource, dataGrid1->DataMember]); - gridCurrencyManager->CancelCurrentEdit(); - MessageBox::Show( "Escape!" ); - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp deleted file mode 100644 index d29b28dcaaf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void PrintListItems() - { - - // Get the CurrencyManager of a TextBox control. - CurrencyManager^ myCurrencyManager = dynamic_cast(textBox1->BindingContext[nullptr]); - - // Presuming the list is a DataView, create a DataRowView variable. - DataRowView^ drv; - for ( int i = 0; i < myCurrencyManager->Count; i++ ) - { - myCurrencyManager->Position = i; - drv = dynamic_cast(myCurrencyManager->Current); - - // Presuming a column named CompanyName exists. - Console::WriteLine( drv[ "CompanyName" ] ); - - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp deleted file mode 100644 index 0bf6ef37159..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void GetCurrentItem() - { - CurrencyManager^ myCurrencyManager; - - // Get the CurrencyManager of a TextBox control. - myCurrencyManager = dynamic_cast(textBox1->BindingContext[nullptr]); - - // Get the current item cast as a DataRowView. - DataRowView^ myDataRowView; - myDataRowView = dynamic_cast(myCurrencyManager->Current); - - // Print the column named ContactName. - Console::WriteLine( myDataRowView[ "ContactName" ] ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp deleted file mode 100644 index add815a292e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) - { - if ( e->KeyCode == Keys::Enter ) - { - - // Enter key pressed. - CurrencyManager^ gridCurrencyManager = dynamic_cast(this->BindingContext[dataGrid1->DataSource, dataGrid1->DataMember]); - gridCurrencyManager->EndCurrentEdit(); - MessageBox::Show( "End Edit" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp deleted file mode 100644 index 42f7c46e213..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void PrintPropertyDescriptions( BindingManagerBase^ b ) - { - Console::WriteLine( "Printing Property Descriptions" ); - PropertyDescriptorCollection^ ps = b->GetItemProperties(); - for ( int i = 0; i < ps->Count; i++ ) - { - Console::WriteLine( "\t{0}\t{1}", ps[ i ]->Name, ps[ i ]->PropertyType ); - - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp deleted file mode 100644 index 4f1d0765d56..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - CurrencyManager^ myCurrencyManager; - -private: - - // - void BindControl( DataTable^ myTable ) - { - - // Bind A TextBox control to a DataTable column in a DataSet. - textBox1->DataBindings->Add( "Text", myTable, "CompanyName" ); - - // Specify the CurrencyManager for the DataTable. - myCurrencyManager = dynamic_cast(this->BindingContext[myTable, ""]); - - // Add event handlers. - myCurrencyManager->ItemChanged += gcnew ItemChangedEventHandler( this, &Form1::CurrencyManager_ItemChanged ); - myCurrencyManager->PositionChanged += gcnew EventHandler( this, &Form1::CurrencyManager_PositionChanged ); - - // Set the initial Position of the control. - myCurrencyManager->Position = 0; - } - - void CurrencyManager_PositionChanged( Object^ sender, System::EventArgs^ /*e*/ ) - { - CurrencyManager^ myCurrencyManager = dynamic_cast(sender); - Console::WriteLine( "Position Changed {0}", myCurrencyManager->Position ); - } - - void CurrencyManager_ItemChanged( Object^ sender, System::Windows::Forms::ItemChangedEventArgs^ /*e*/ ) - { - CurrencyManager^ myCurrencyManager = dynamic_cast(sender); - Console::WriteLine( "Item Changed {0}", myCurrencyManager->Position ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp deleted file mode 100644 index 05e8ef3d0fa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void MoveNext( CurrencyManager^ myCurrencyManager ) - { - if ( myCurrencyManager->Count == 0 ) - { - Console::WriteLine( "No records to move to." ); - return; - } - - if ( myCurrencyManager->Position == myCurrencyManager->Count - 1 ) - { - Console::WriteLine( "You're at end of the records" ); - } - else - { - myCurrencyManager->Position += 1; - } - } - - void MoveFirst( CurrencyManager^ myCurrencyManager ) - { - if ( myCurrencyManager->Count == 0 ) - { - Console::WriteLine( "No records to move to." ); - return; - } - - myCurrencyManager->Position = 0; - } - - void MovePrevious( CurrencyManager^ myCurrencyManager ) - { - if ( myCurrencyManager->Count == 0 ) - { - Console::WriteLine( "No records to move to." ); - return; - } - - if ( myCurrencyManager->Position == 0 ) - { - Console::WriteLine( "You're at the beginning of the records." ); - } - else - { - myCurrencyManager->Position -= 1; - } - } - - void MoveLast( CurrencyManager^ myCurrencyManager ) - { - if ( myCurrencyManager->Count == 0 ) - { - Console::WriteLine( "No records to move to." ); - return; - } - myCurrencyManager->Position = myCurrencyManager->Count - 1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp deleted file mode 100644 index e789e74fb58..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void DemonstrateRefresh() - { - - // Create an array with ten elements and bind to a TextBox. - array^myArray = gcnew array(10); - for ( int i = 0; i < 10; i++ ) - { - myArray[ i ] = String::Format( "item {0}", i ); - - } - textBox1->DataBindings->Add( "Text", myArray, "" ); - - // Change one value. - myArray[ 0 ] = "New value"; - - // Uncomment the next line to refresh the CurrencyManager. - // RefreshGrid(myArray); - } - - void RefreshGrid( Object^ dataSource ) - { - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ dataSource ]); - myCurrencyManager->Refresh(); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp deleted file mode 100644 index 082ddfe5ade..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void RemoveFromList() - { - - // Get the CurrencyManager of a TextBox control. - CurrencyManager^ myCurrencyManager = dynamic_cast(textBox1->BindingContext[nullptr]); - - // If the count is 0, exit the function. - if ( myCurrencyManager->Count > 1 ) - myCurrencyManager->RemoveAt( 0 ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp deleted file mode 100644 index 4e332e61533..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp +++ /dev/null @@ -1,79 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -// Creates a new type. - -[Serializable] -public ref class MyNewObject: public Object -{ -private: - String^ myValue; - -public: - - // Creates a default constructor for the class. - MyNewObject() - { - myValue = "This is the value of the class"; - } - - - property String^ MyObjectValue - { - - // Creates a property to retrieve or set the value. - String^ get() - { - return myValue; - } - - void set( String^ value ) - { - myValue = value; - } - - } - -}; - -public ref class MyClass: public Form -{ -protected: - TextBox^ textBox1; - -public: - void MyClipboardMethod() - { - - // Creates a new data format. - DataFormats::Format^ myFormat = DataFormats::GetFormat( "myFormat" ); - - /* Creates a new object and stores it in a DataObject using myFormat - * as the type of format. */ - MyNewObject^ myObject = gcnew MyNewObject; - DataObject^ myDataObject = gcnew DataObject( myFormat->Name,myObject ); - - // Copies myObject into the clipboard. - Clipboard::SetDataObject( myDataObject ); - - // Performs some processing steps. - // Retrieves the data from the clipboard. - IDataObject^ myRetrievedObject = Clipboard::GetDataObject(); - - // Converts the IDataObject type to MyNewObject type. - MyNewObject^ myDereferencedObject = dynamic_cast(myRetrievedObject->GetData( myFormat->Name )); - - // Prints the value of the Object in a textBox. - textBox1->Text = myDereferencedObject->MyObjectValue; - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp deleted file mode 100644 index 1cd0194b85b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void CreateMyFormat2() - { - DataFormats::Format^ myFormat = gcnew DataFormats::Format( - "AnotherNewFormat", 20916 ); - - // Displays the contents of myFormat. - textBox1->Text = String::Format( "ID value: {0}\nFormat name: {1}", - myFormat->Id, myFormat->Name ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp deleted file mode 100644 index 87ad987d9fb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetMyFormatInfomation() - { - // Creates a DataFormats.Format for the Unicode data format. - DataFormats::Format^ myFormat = DataFormats::GetFormat( - DataFormats::UnicodeText ); - - // Displays the contents of myFormat. - textBox1->Text = String::Format( "ID value: {0}\nFormat name: {1}", - myFormat->Id, myFormat->Name ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp deleted file mode 100644 index 56961cae479..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp +++ /dev/null @@ -1,252 +0,0 @@ - - -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -#define null 0 -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - Button^ button1; - Button^ button2; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - bool TablesAlreadyAdded; - -public: - Form1() - { - // Required for Windows Form Designer support. - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->components = gcnew System::ComponentModel::Container; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->myDataGrid = gcnew DataGrid; - this->Text = "DataGrid Control Sample"; - this->ClientSize = System::Drawing::Size( 450, 330 ); - button1->Location = System::Drawing::Point( 24, 16 ); - button1->Size = System::Drawing::Size( 120, 24 ); - button1->Text = "Change Appearance"; - button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - button2->Location = System::Drawing::Point( 150, 16 ); - button2->Size = System::Drawing::Size( 120, 24 ); - button2->Text = "Get Binding Manager"; - button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - myDataGrid->Location = System::Drawing::Point( 24, 50 ); - myDataGrid->Size = System::Drawing::Size( 300, 200 ); - myDataGrid->CaptionText = "Microsoft DataGrid Control"; - myDataGrid->MouseUp += gcnew MouseEventHandler( this, &Form1::Grid_MouseUp ); - this->Controls->Add( button1 ); - this->Controls->Add( button2 ); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - /* Bind the DataGrid to the DataSet. The dataMember - specifies that the Customers table should be displayed.*/ - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - -private: - void button1_Click( Object^ sender, System::EventArgs^ e ) - { - if ( TablesAlreadyAdded ) - return; - - AddCustomDataTableStyle(); - } - -private: - void AddCustomDataTableStyle() - { - DataGridTableStyle^ ts1 = gcnew DataGridTableStyle; - ts1->MappingName = "Customers"; - - // Set other properties. - ts1->AlternatingBackColor = Color::LightGray; - - /* Add a GridColumnStyle and set its MappingName - to the name of a DataColumn in the DataTable. - Set the HeaderText and Width properties. */ - DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn; - boolCol->MappingName = "Current"; - boolCol->HeaderText = "IsCurrent Customer"; - boolCol->Width = 150; - ts1->GridColumnStyles->Add( boolCol ); - - // Add a second column style. - DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; - TextCol->MappingName = "custName"; - TextCol->HeaderText = "Customer Name"; - TextCol->Width = 250; - ts1->GridColumnStyles->Add( TextCol ); - - // Create the second table style with columns. - DataGridTableStyle^ ts2 = gcnew DataGridTableStyle; - ts2->MappingName = "Orders"; - - // Set other properties. - ts2->AlternatingBackColor = Color::LightBlue; - - // Create new ColumnStyle objects - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - ts2->GridColumnStyles->Add( cOrderDate ); - - /* Use a PropertyDescriptor to create a formatted - column. First get the PropertyDescriptorCollection - for the data source and data member. */ - PropertyDescriptorCollection^ pcol = this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties(); - - /* Create a formatted column using a PropertyDescriptor. - The formatting character "c" specifies a currency format. */ - DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - ts2->GridColumnStyles->Add( csOrderAmount ); - - /* Add the DataGridTableStyle instances to - the GridTableStylesCollection. */ - myDataGrid->TableStyles->Add( ts1 ); - myDataGrid->TableStyles->Add( ts2 ); - - // Sets the TablesAlreadyAdded to true so this doesn't happen again. - TablesAlreadyAdded = true; - } - -private: - void button2_Click( Object^ sender, System::EventArgs^ e ) - { - BindingManagerBase^ bmGrid; - bmGrid = BindingContext[myDataSet, "Customers"]; - MessageBox::Show( String::Concat( "Current BindingManager Position: ", bmGrid->Position )->ToString() ); - } - -private: - void Grid_MouseUp( Object^ sender, MouseEventArgs^ e ) - { - // Create a HitTestInfo object using the HitTest method. - // Get the DataGrid by casting sender. - DataGrid^ myGrid = dynamic_cast(sender); - DataGrid::HitTestInfo ^ myHitInfo = myGrid->HitTest( e->X, e->Y ); - Console::WriteLine( myHitInfo ); - Console::WriteLine( myHitInfo->Type ); - Console::WriteLine( myHitInfo->Row ); - Console::WriteLine( myHitInfo->Column ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create two DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",__int32::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",__int32::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - /* Populate the tables. For each customer and order, - create need two DataRow variables. */ - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Customer1"; - tCust->Rows[ 1 ][ "custName" ] = "Customer2"; - tCust->Rows[ 2 ][ "custName" ] = "Customer3"; - - // Give the Current column a value. - tCust->Rows[ 0 ][ "Current" ] = true; - tCust->Rows[ 1 ][ "Current" ] = true; - tCust->Rows[ 2 ][ "Current" ] = false; - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp deleted file mode 100644 index 1d9ac91c67a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void ToggleAllowSorting() - { - // Toggle the AllowSorting property. - dataGrid1->AllowSorting = !dataGrid1->AllowSorting; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp deleted file mode 100644 index a679c936e12..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetBackColorAndBackgroundColor() - { - // Set the BackColor and BackgroundColor properties. - dataGrid1->BackColor = System::Drawing::Color::Blue; - dataGrid1->BackgroundColor = System::Drawing::Color::Red; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp deleted file mode 100644 index 05bca3eebf0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetGridColors() - { - dataGrid1->BackColor = System::Drawing::Color::Red; - dataGrid1->AlternatingBackColor = System::Drawing::Color::AliceBlue; - dataGrid1->BackgroundColor = System::Drawing::Color::Yellow; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp deleted file mode 100644 index 28c49a03ee0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void EditGrid( DataGrid^ dataGrid1 ) - { - // Get the selected row and column through the CurrentCell. - int colNum; - int rowNum; - colNum = dataGrid1->CurrentCell.ColumnNumber; - rowNum = dataGrid1->CurrentCell.RowNumber; - // Get the selected DataGridColumnStyle. - DataGridColumnStyle^ dgCol; - dgCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ colNum ]; - // Invoke the BeginEdit method to see if editing can begin. - if ( dataGrid1->BeginEdit( dgCol, rowNum ) ) - { - // Edit row value. Get the DataTable and selected row. - DataTable^ myTable; - DataRow^ myRow; - // Assuming the DataGrid is bound to a DataTable. - myTable = (DataTable^)(dataGrid1->DataSource); - myRow = myTable->Rows[ rowNum ]; - // Invoke the Row object's BeginEdit method. - myRow->BeginEdit(); - myRow[ colNum ] = "New Value"; - // You must accept changes on both DataRow and DataTable. - myRow->AcceptChanges(); - myTable->AcceptChanges(); - dataGrid1->EndEdit( dgCol, rowNum, false ); - } - else - { - Console::WriteLine( "BeginEdit failed" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp deleted file mode 100644 index 5762f055469..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - void Method() - { - - // - if ( dataGrid1->CaptionText == "" ) - { - dataGrid1->CaptionText = "Microsoft DataGrid"; - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp deleted file mode 100644 index d4a804be5e5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetCellWithFocus( DataGrid^ myGrid ) - { - // Set the current cell to cell1, row 1. - myGrid->CurrentCell = DataGridCell( 1, 1 ); - } - - void dataGrid1_GotFocus( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Console::WriteLine( "{0} {1}", dataGrid1->CurrentCell.ColumnNumber, - dataGrid1->CurrentCell.RowNumber ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp deleted file mode 100644 index d8b718d9504..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void GetSelectedIndex( DataGrid^ myGrid ) - { - Console::WriteLine( myGrid->CurrentRowIndex ); - } - - void SetSelectedIndex( DataGrid^ myGrid, int selIndex ) - { - myGrid->CurrentRowIndex = selIndex; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp deleted file mode 100644 index 539f6556019..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -protected: - Object^ source; - -private: - void SetSourceAndMember() - { - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ tableCustomers = gcnew DataTable( "Customers" ); - myDataSet->Tables->Add( tableCustomers ); - // Insert code to populate the DataSet. - - // Set DataSource and DataMember with SetDataBinding method. - String^ member; - - // The name of a DataTable is Customers. - member = "Customers"; - dataGrid1->SetDataBinding( myDataSet, member ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp deleted file mode 100644 index 15f5b0b3e23..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void BindToDataView( DataGrid^ myGrid ) - { - // Create a DataView using the DataTable. - DataTable^ myTable = gcnew DataTable( "Suppliers" ); - // Insert code to create and populate columns. - DataView^ myDataView = gcnew DataView( myTable ); - myGrid->DataSource = myDataView; - } - - void BindToDataSet( DataGrid^ myGrid ) - { - // Create a DataSet. - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - // Insert code to populate DataSet with several tables. - myGrid->DataSource = myDataSet; - // Use the DataMember property to specify the DataTable. - myGrid->DataMember = "Suppliers"; - } - - DataView^ GetDataViewFromDataSource() - { - // Create a DataTable variable, and set it to the DataSource. - DataView^ myDataView; - myDataView = (DataView^)(dataGrid1->DataSource); - return myDataView; - } - - DataSet^ GetDataSetFromDataSource() - { - // Create a DataSet variable, and set it to the DataSource. - DataSet^ myDataSet; - myDataSet = (DataSet^)(dataGrid1->DataSource); - return myDataSet; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp deleted file mode 100644 index d7dd51bc50c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - System::Windows::Forms::DataGrid^ dataGrid1; - - void CreateDataGrid() - { - dataGrid1 = gcnew DataGrid; - // Add the handler for the DataSourceChanged event. - dataGrid1->DataSourceChanged += gcnew EventHandler( - this, &Form1::DataGrid1_DataSourceChanged ); - } - - void DataGrid1_DataSourceChanged( Object^ sender, EventArgs^ /*e*/ ) - { - DataGrid^ thisGrid = dynamic_cast(sender); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp deleted file mode 100644 index 6daee01f18f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ ds; - -private: - - // - void EditValue() - { - int rowtoedit = 1; - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ ds->Tables[ "Suppliers" ] ]); - myCurrencyManager->Position = rowtoedit; - DataGridColumnStyle^ dgc = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]; - dataGrid1->BeginEdit( dgc, rowtoedit ); - - // Insert code to edit the value. - dataGrid1->EndEdit( dgc, rowtoedit, false ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp deleted file mode 100644 index 42e054da89d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ myDataSet; - - // -private: - void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e ) - { - - // Use the HitTest method to get a HitTestInfo object. - System::Windows::Forms::DataGrid::HitTestInfo^ hi; - DataGrid^ grid = dynamic_cast(sender); - hi = grid->HitTest( e->X, e->Y ); - - // Test if the clicked area was a cell. - if ( hi->Type == DataGrid::HitTestType::Cell ) - { - - // If it's a cell, get the GridTable and CurrencyManager of the - // clicked table. - DataGridTableStyle^ dgt = dataGrid1->TableStyles[ 0 ]; - CurrencyManager^ myCurrencyManager = dynamic_cast(BindingContext[ myDataSet->Tables[ dataGrid1->DataMember ] ]); - - // Get the Rectangle of the clicked cell. - Rectangle cellRect; - cellRect = grid->GetCellBounds( hi->Row, hi->Column ); - - // Get the clicked DataGridTextBoxColumn. - DataGridTextBoxColumn^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); - - // Insert code to edit the value. - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp deleted file mode 100644 index d31d2875768..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -protected: - DataGridCell dgc; - - void GetRect() - { - Rectangle rect; - dgc.ColumnNumber = 0; - dgc.RowNumber = 0; - rect = dataGrid1->GetCellBounds( dgc ); - Console::WriteLine( rect ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp deleted file mode 100644 index 9d09cdb2c2f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_CurrentCellChange( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Rectangle rect; - rect = dataGrid1->GetCurrentCellBounds(); - Console::WriteLine( rect ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp deleted file mode 100644 index 056b856882d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetGridLineColor( - DataGrid^ myGrid, System::Drawing::Color newcolor ) - { - myGrid->GridLineColor = newcolor; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp deleted file mode 100644 index 3ef01fa7245..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - Console::WriteLine(); - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - // Use the DataGrid control's HitTest method with the x and y properties. - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( myHitTest ); - Console::WriteLine( "Column {0}", myHitTest->Column ); - Console::WriteLine( "Row {0}", myHitTest->Row ); - Console::WriteLine( "Type {0}", myHitTest->Type ); - Console::WriteLine( "ToString {0}", myHitTest ); - Console::WriteLine( "Hit {0}", myHitTest->Type ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp deleted file mode 100644 index cefe8f80b66..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - String^ newLine = "\n"; - Console::WriteLine( newLine ); - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - /* Use the DataGrid control's HitTest method with - the x and y properties. */ - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( "Column {0}", myHitTest->Column ); - Console::WriteLine( "Row {0}", myHitTest->Row ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp deleted file mode 100644 index d9c5c8b4cb6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - String^ newLine = "\n"; - Console::WriteLine( newLine ); - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - // Use the DataGrid control's HitTest method with the x and y properties. - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( "Hashcode {0}", myHitTest->GetHashCode() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp deleted file mode 100644 index b2049b049a2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - if ( dataGrid1->HitTest( e->X, e->Y )->Equals( - DataGrid::HitTestInfo::Nowhere ) ) - { - Console::WriteLine( "Nowhere" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp deleted file mode 100644 index a682f39c48c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - String^ newLine = "\n"; - Console::WriteLine( newLine ); - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - // Use the DataGrid control's HitTest method with the x and y properties. - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( "Column {0}", myHitTest->Column ); - Console::WriteLine( "Row {0}", myHitTest->Row ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp deleted file mode 100644 index 02b3dbb18dd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - // Use the DataGrid control's HitTest method with the x and y properties. - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( "ToString {0}", myHitTest->ToString() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp deleted file mode 100644 index 10c0ed877b5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - String^ newLine = "\n"; - Console::WriteLine( newLine ); - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - // Use the DataGrid control's HitTest method with the x and y properties. - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( "Hit {0}", ReturnHitTest( myHitTest->Type ) ); - } - - String^ ReturnHitTest( - System::Windows::Forms::DataGrid::HitTestType hit ) - { - // Use this function to return the part of the grid clicked. - switch ( hit ) - { - case(System::Windows::Forms::DataGrid::HitTestType::Cell): - return "Cell"; - - case(System::Windows::Forms::DataGrid::HitTestType::Caption): - return "Caption"; - - case(System::Windows::Forms::DataGrid::HitTestType::ColumnHeader): - return "ColumnHeader"; - - case(System::Windows::Forms::DataGrid::HitTestType::ColumnResize): - return "Resize"; - - case(System::Windows::Forms::DataGrid::HitTestType::ParentRows): - return "ParentRows"; - - case(System::Windows::Forms::DataGrid::HitTestType::RowHeader): - return "RowHeader"; - - case(System::Windows::Forms::DataGrid::HitTestType::RowResize): - return "RowResize"; - - case(System::Windows::Forms::DataGrid::HitTestType::None): - return "None"; - - default: - return "Unknown"; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp deleted file mode 100644 index 1bba95278ae..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void dataGrid1_MouseDown( Object^ /*sender*/, - System::Windows::Forms::MouseEventArgs^ e ) - { - String^ newLine = "\n"; - Console::WriteLine( newLine ); - System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; - // Use the DataGrid control's HitTest method with the x and y properties. - myHitTest = dataGrid1->HitTest( e->X, e->Y ); - Console::WriteLine( myHitTest ); - Console::WriteLine( "Column {0}", myHitTest->Column ); - Console::WriteLine( "Row {0}", myHitTest->Row ); - Console::WriteLine( "Type {0}", myHitTest->Type ); - Console::WriteLine( "ToString {0}", myHitTest ); - Console::WriteLine( "Hit {0}", ReturnHitTest( myHitTest->Type ) ); - } - - String^ ReturnHitTest( - System::Windows::Forms::DataGrid::HitTestType hit ) - { - // Use this function to return the part of the grid clicked. - switch ( hit ) - { - case(System::Windows::Forms::DataGrid::HitTestType::Cell): - return "Cell"; - - case(System::Windows::Forms::DataGrid::HitTestType::Caption): - return "Caption"; - - case(System::Windows::Forms::DataGrid::HitTestType::ColumnHeader): - return "ColumnHeader"; - - case(System::Windows::Forms::DataGrid::HitTestType::ColumnResize): - return "Resize"; - - case(System::Windows::Forms::DataGrid::HitTestType::ParentRows): - return "ParentRows"; - - case(System::Windows::Forms::DataGrid::HitTestType::RowHeader): - return "RowHeader"; - - case(System::Windows::Forms::DataGrid::HitTestType::RowResize): - return "RowResize"; - - case(System::Windows::Forms::DataGrid::HitTestType::None): - return "None"; - - default: - return "Unknown"; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp deleted file mode 100644 index fa43be4593e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -protected: - void TextExpanded( DataGrid^ myGrid ) - { - // Get the DataTable of the grid - DataTable^ myTable; - // Assuming the grid is bound to a DataTable - myTable = (DataTable^)(myGrid->DataSource); - for ( int i = 0; i < myTable->Rows->Count; i++ ) - { - if ( myGrid->IsExpanded( i ) ) - { - Console::WriteLine( "Row {0} was expanded", i ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp deleted file mode 100644 index af08b0a2a40..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void ChangeFontHeight( DataGrid^ myGrid ) - { - myGrid->Font = gcnew System::Drawing::Font( - "Microsoft Sans Serif", - 15, System::Drawing::FontStyle::Regular ); - myGrid->PreferredRowHeight = myGrid->Font->Height; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp deleted file mode 100644 index f4dd87f8055..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void BindControls() - { - // Creates a DataSet named SuppliersProducts. - DataSet^ SuppliersProducts = gcnew DataSet( "SuppliersProducts" ); - // Adds two DataTable objects, Suppliers and Products. - SuppliersProducts->Tables->Add( gcnew DataTable( "Suppliers" ) ); - SuppliersProducts->Tables->Add( gcnew DataTable( "Products" ) ); - // Insert code to add DataColumn objects. - // Insert code to fill tables with columns and data. - // Binds the DataGrid to the DataSet, displaying the Suppliers table. - dataGrid1->SetDataBinding( SuppliersProducts, "Suppliers" ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp deleted file mode 100644 index 243437170c2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - void AddTables( DataGrid^ myDataGrid, DataSet^ myDataSet ) - { - for each ( DataTable^ t in myDataSet->Tables ) - { - DataGridTableStyle^ myGridTableStyle = - gcnew DataGridTableStyle; - myGridTableStyle->MappingName = t->TableName; - myDataGrid->TableStyles->Add( myGridTableStyle ); - - /* Note that DataGridColumnStyle objects will - be created automatically for the first DataGridTableStyle - when you add it to the GridTableStylesCollection.*/ - } - } - - void PrintGridStyleInfo( DataGrid^ myDataGrid ) - { - /* Print the MappingName of each DataGridTableStyle, - and the MappingName of each DataGridColumnStyle. */ - for each ( DataGridTableStyle^ myGridStyle in - myDataGrid->TableStyles ) - { - Console::WriteLine( myGridStyle->MappingName ); - for each ( DataGridColumnStyle^ myColumnStyle in - myGridStyle->GridColumnStyles ) - { - Console::WriteLine( myColumnStyle->MappingName ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp deleted file mode 100644 index d401aebe8a3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - - // - void PrintCellValues( DataGrid^ myGrid ) - { - int iRow; - int iCol; - DataTable^ myTable; - - // Assumes the DataGrid is bound to a DataTable. - myTable = dynamic_cast(dataGrid1->DataSource); - for ( iRow = 0; iRow < myTable->Rows->Count; iRow++ ) - { - for ( iCol = 0; iCol < myTable->Columns->Count; iCol++ ) - { - Console::WriteLine( myGrid[iRow, iCol] ); - - } - - } - } - - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp deleted file mode 100644 index ad7d1c20863..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - - // - void SetCellValue( DataGrid^ myGrid ) - { - DataGridCell myCell; - - // Use an arbitrary cell. - myCell.RowNumber = 1; - myCell.ColumnNumber = 1; - - // Change the cell's value using the CurrentCell. - myGrid[ myCell ] = "New Value"; - } - - void GetCellValue( DataGrid^ myGrid ) - { - DataGridCell myCell; - - // Use and arbitrary cell. - myCell.RowNumber = 1; - myCell.ColumnNumber = 1; - Console::WriteLine( myGrid[ myCell ] ); - } - - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp deleted file mode 100644 index 30151e96eba..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - - // - void AddDataGridBoolColumnStyle() - { - DataGridBoolColumn^ myColumn = gcnew DataGridBoolColumn; - myColumn->MappingName = "Current"; - myColumn->Width = 200; - dataGrid1->TableStyles[ "Customers" ]->GridColumnStyles->Add( myColumn ); - } - - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp deleted file mode 100644 index b8a8def70c6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - - // - void SetAllowNull() - { - DataGridBoolColumn^ myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]); - myGridColumn->AllowNull = false; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp deleted file mode 100644 index ea84cf607db..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ ds; - -private: - - // - void CreateNewDataGridColumn() - { - System::Windows::Forms::GridColumnStylesCollection^ myGridColumnCol; - myGridColumnCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles; - - // Get the CurrencyManager for the table. - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ ds->Tables[ "Products" ] ]); - - /* Get the PropertyDescriptor for the DataColumn of the new column. - The column should contain a Boolean value. */ - PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "Discontinued" ]; - DataGridColumnStyle^ myColumn = gcnew System::Windows::Forms::DataGridBoolColumn( pd ); - myColumn->MappingName = "Discontinued"; - myGridColumnCol->Add( myColumn ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp deleted file mode 100644 index 94a26939b1e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Class1 -{ -protected: - DataGrid^ dataGrid1; - - // -private: - - void EnterNull() - { - - // Creates an instance of a class derived from DataGridBoolColumn. - MyDataGridBoolColumn^ colBool; - colBool = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 2 ]); - colBool->CallEnterNullValue(); - } - - -internal: - - // Class derived from DataGridBoolColumn. - ref class MyDataGridBoolColumn: public DataGridBoolColumn - { - public: - void CallEnterNullValue() - { - this->EnterNullValue(); - } - - }; - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp deleted file mode 100644 index a589a3f2638..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ DataSet1; - - // -private: - - void SetBoolColumnValues() - { - DataGridBoolColumn^ myGridColumn; - - // Get the DataGridBoolColumn you are setting. - myGridColumn = dynamic_cast(myDataGrid->TableStyles[ "Customers" ]->GridColumnStyles[ "Current" ]); - - // Set TrueValue, FalseValue, and NullValue. - myGridColumn->TrueValue = true; - myGridColumn->FalseValue = false; - myGridColumn->NullValue = Convert::DBNull; - } - - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp deleted file mode 100644 index fc869cd8f19..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ DataGrid1; - -private: - - // - void PrintCellRowAndCol() - { - DataGridCell^ myCell; - myCell = DataGrid1->CurrentCell; - Console::WriteLine( myCell->RowNumber ); - Console::WriteLine( myCell->ColumnNumber ); - - // Prints the value of the cell through the DataTable. - DataTable^ myTable; - - // Assumes the DataGrid is bound to a DataTable. - myTable = dynamic_cast(DataGrid1->DataSource); - Console::WriteLine( myTable->Rows[ myCell->RowNumber ][ myCell->ColumnNumber ] ); - } - - // -}; - -int main() -{ - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp deleted file mode 100644 index e4a98fe74a4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ DataGrid1; - -private: - - // - void PrintCell( Object^ sender, MouseEventArgs^ /*e*/ ) - { - DataGrid^ thisGrid = dynamic_cast(sender); - DataGridCell myDataGridCell = thisGrid->CurrentCell; - BindingManagerBase^ bm = BindingContext[ thisGrid->DataSource,thisGrid->DataMember ]; - DataRowView^ drv = dynamic_cast(bm->Current); - Console::WriteLine( drv[ myDataGridCell.ColumnNumber ] ); - Console::WriteLine( myDataGridCell.RowNumber ); - } - - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp deleted file mode 100644 index d5ad9ec5dc8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetCell() - { - // Set the focus to the cell specified by the DataGridCell. - DataGridCell dc; - dc.RowNumber = 1; - dc.ColumnNumber = 1; - dataGrid1->CurrentCell = dc; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp deleted file mode 100644 index f8239e9fece..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - Hashtable^ myHashTable; - -public: - Form1() - { - myHashTable = gcnew Hashtable; - } - -private: - void Grid_MouseUp( Object^ sender, System::Windows::Forms::MouseEventArgs^ /*e*/ ) - { - DataGrid^ dg = dynamic_cast(sender); - DataGridCell myCell = dg->CurrentCell; - String^ tempkey = myCell.ToString(); - Console::WriteLine( "Temp {0}", tempkey ); - if ( myHashTable->Contains( tempkey ) ) - { - return; - } - myHashTable->Add( tempkey, myCell.GetHashCode() ); - Console::WriteLine( "Hashcode: {0}", myCell.GetHashCode() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp deleted file mode 100644 index a0029f0a09b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void Grid_MouseUp( - Object^ sender, System::Windows::Forms::MouseEventArgs^ /*e*/ ) - { - DataGrid^ dg = (DataGrid^)(sender); - DataGridCell myCell = dg->CurrentCell; - Console::WriteLine( myCell.ToString() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp deleted file mode 100644 index ecee2ffd7fb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace MyNameSpace -{ - ref class MyDataGridColumnStyle: public DataGridColumnStyle - { - // - private: - void CheckCurrencyManager( CurrencyManager^ myCurrencyManager ) - { - // This code is from a class named MyDataGridColumnStyle derived - // from DataGridColumnStyle. - MyDataGridColumnStyle^ myGridColumn = this; - try - { - myGridColumn->CheckValidDataSource( myCurrencyManager ); - } - catch ( ArgumentNullException^ e ) - { - Console::WriteLine( e->Message ); - } - catch ( ApplicationException^ e ) - { - Console::WriteLine( e->Message ); - } - } - // - - protected: - virtual void Edit( System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, System::Drawing::Rectangle /*bounds*/, bool /*readOnly1*/, String^ /*displayText*/, bool /*cellIsVisiblen*/ ) override {} - - virtual bool Commit( System::Windows::Forms::CurrencyManager^ /*dataSource*/, int /*rowNum*/ ) override - { - return true; - } - - virtual System::Drawing::Size GetPreferredSize( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override - { - return Size( Point( 1, 2 ) ); - } - - virtual int GetPreferredHeight( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override - { - return 1; - } - - virtual int GetMinimumHeight() override - { - return 1; - } - - virtual void Abort( int /*rowNum*/ ) override {} - - virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, bool /*b*/ ) override {} - - virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/ ) override {} - - }; - -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp deleted file mode 100644 index f9604b0ce32..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace MyNameSpace -{ - ref class MyDataGridColumnStyle: public DataGridTextBoxColumn - { - // - protected: - virtual void ConcedeFocus() override - { - // Hide the TextBox when conceding focus. - DataGridTextBoxColumn::TextBox->Visible = false; - } - // - - virtual void Edit( System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, System::Drawing::Rectangle /*bounds*/, bool /*readOnly1*/, String^ /*displayText*/, bool /*cellIsVisiblen*/ ) override {} - - virtual bool Commit( System::Windows::Forms::CurrencyManager^ /*dataSource*/, int /*rowNum*/ ) override - { - return true; - } - - virtual System::Drawing::Size GetPreferredSize( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override - { - return Size(Point(1,2)); - } - - virtual int GetPreferredHeight( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override - { - return 1; - } - - virtual int GetMinimumHeight() override - { - return 1; - } - - virtual void Abort( int /*rowNum*/ ) override {} - - virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, bool /*b*/ ) override {} - - virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/ ) override {} - - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp deleted file mode 100644 index 98eda1d9f79..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void GetDataGrid( DataGridTableStyle^ thisColumn ) - { - DataGrid^ myDataGrid; - - // Get the DataGrid of the column. - myDataGrid = thisColumn->DataGrid; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp deleted file mode 100644 index 054734d1d25..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - - // - void CreateNewDataGridColumnStyle() - { - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - - // Insert code to populate the DataSet. - // Get the CurrencyManager for the table you want to add a column to. - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[myDataSet, "Suppliers"]); - - // Get the PropertyDescriptor for the DataColumn. - PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "City" ]; - - // Construct the DataGridColumnStyle with the PropertyDescriptor. - DataGridColumnStyle^ myColumn = gcnew DataGridTextBoxColumn( pd ); - myColumn->MappingName = "City"; - dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumn ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp deleted file mode 100644 index cd36dd551b2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class Form1: public Form -{ -private: - DataSet^ myDataSet; - void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e ) - { - // Use the HitTest method to get a HitTestInfo object. - System::Windows::Forms::DataGrid::HitTestInfo^ hi; - DataGrid^ grid = dynamic_cast(sender); - hi = grid->HitTest( e->X, e->Y ); - - // Test if the clicked area was a cell. - if ( hi->Type == DataGrid::HitTestType::Cell ) - { - // If it's a cell, get the GridTable and CurrencyManager of the - // clicked table. - DataGridTableStyle^ dgt = grid->TableStyles[ 0 ]; - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]); - - // Get the Rectangle of the clicked cell. - Rectangle cellRect; - cellRect = grid->GetCellBounds( hi->Row, hi->Column ); - - // Get the clicked DataGridTextBoxColumn. - MyColumnStyle ^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); - - // Edit the value. - gridCol->EditVal( myCurrencyManager, hi->Row, cellRect, false, "New Text" ); - } - } - - -public: - ref class MyColumnStyle: public DataGridTextBoxColumn - { - public: - void EditVal( CurrencyManager^ cm, int row, Rectangle rec, bool readOnly, String^ text ) - { - this->Edit( cm, row, rec, readOnly, text ); - } - }; -}; -// - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp deleted file mode 100644 index 4969f0f0f69..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridBoolColumn -{ -public: - int GetMinHeight() - { - return this->GetMinimumHeight(); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - void GetHeight() - { - MyGridColumn^ myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 1 ]->GridColumnStyles[ 0 ]); - Console::WriteLine( myGridColumn->GetMinHeight() ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp deleted file mode 100644 index dfad6354bbd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridTextBoxColumn -{ -public: - int GetPrefHeight( Graphics^ g, String^ thisString ) - { - return this->GetPreferredHeight( g, thisString ); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - void GetHeight() - { - MyGridColumn^ myGridColumn; - - // Get a DataGridColumnStyle of a DataGrid control. - myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); - - // Create a Graphics object. - Graphics^ g = this->CreateGraphics(); - Console::WriteLine( myGridColumn->GetPrefHeight( g, "A string" ) ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp deleted file mode 100644 index 813c28a73ff..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridTextBoxColumn -{ -public: - Size GetPrefSize( Graphics^ g, String^ thisString ) - { - return this->GetPreferredSize( g, thisString ); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - void GetHeight() - { - MyGridColumn^ myGridColumn; - - // Get a DataGridColumnStyle of a DataGrid control. - myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); - - // Create a Graphics object. - Graphics^ g = this->CreateGraphics(); - System::Drawing::Size s = myGridColumn->GetPrefSize( g, "A string" ); - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp deleted file mode 100644 index 7ed7b2b5311..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ dataSet1; - -private: - - // - void SetHeaderText() - { - DataGridColumnStyle^ dgCol; - DataColumn^ dataCol1; - DataTable^ dataTable1; - dgCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]; - dataTable1 = dataSet1->Tables[ dataGrid1->DataMember ]; - dataCol1 = dataTable1->Columns[ dgCol->MappingName ]; - dgCol->HeaderText = dataCol1->Caption; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp deleted file mode 100644 index 21746b4e3d5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetNullText() - { - DataGridColumnStyle^ myGridColumn; - myGridColumn = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]; - myGridColumn->NullText = "Null Text"; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp deleted file mode 100644 index 8ffe9c807d6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ ds; - - // -private: - void GetPropertyDescriptor() - { - PropertyDescriptor^ pd; - pd = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]->PropertyDescriptor; - Console::WriteLine( pd ); - } - - void CreateNewDataGridColumnStyle() - { - GridColumnStylesCollection^ myGridColumnCol; - myGridColumnCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles; - - // Get the CurrencyManager for the table you want to add a column to. - CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ ds->Tables[ "Suppliers" ] ]); - - // Get the PropertyDescriptor for the DataColumn of the new column. - PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "City" ]; - DataGridColumnStyle^ myColumn = gcnew DataGridTextBoxColumn( pd ); - myGridColumnCol->Add( myColumn ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp deleted file mode 100644 index 3755678bed0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ dataSet1; - -private: - - // - void SetReadOnly() - { - DataColumnCollection^ myDataColumns; - - // Get the columns for a table bound to a DataGrid. - myDataColumns = dataSet1->Tables[ "Suppliers" ]->Columns; - System::Collections::IEnumerator^ myEnum = myDataColumns->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataColumn^ dataColumn = safe_cast(myEnum->Current); - dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ dataColumn->ColumnName ]->ReadOnly = dataColumn->ReadOnly; - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp deleted file mode 100644 index dd5183d63da..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace MyNameSpace -{ - ref class MyDataGridColumnStyle: public DataGridTextBoxColumn - { - private: - CurrencyManager^ myCurrencyManager; - DataGrid^ dataGrid1; - - // - void UpdateGridUI() - { - - // Get the MyDataGridColumnStyle to update. - // MyDataGridColumnStyle is a class derived from DataGridColumnStyle. - MyDataGridColumnStyle^ myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); - - // Call UpdateUI. - myGridColumn->UpdateUI( myCurrencyManager, 10, "my new value" ); - } - // - - - protected: - - void SetDataGrid( DataGrid^ dataGrid2, CurrencyManager^ curMan2 ) - { - myCurrencyManager = curMan2; - dataGrid1 = dataGrid2; - } - - virtual void Edit( System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, System::Drawing::Rectangle /*bounds*/, bool /*readOnly1*/, String^ /*displayText*/, bool /*cellIsVisiblen*/ ) override {} - - virtual bool Commit( System::Windows::Forms::CurrencyManager^ /*dataSource*/, int /*rowNum*/ ) override - { - return true; - } - - virtual System::Drawing::Size GetPreferredSize( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override - { - return Size(Point(1,2)); - } - - virtual int GetPreferredHeight( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override - { - return 1; - } - - virtual int GetMinimumHeight() override - { - return 1; - } - - virtual void Abort( int /*rowNum*/ ) override {} - - virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, bool /*b*/ ) override {} - - virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/ ) override{} - - }; - -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp deleted file mode 100644 index 3e4c3ad472a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void SetGridLineAttributes() - { - dataGrid1->GridLineStyle = DataGridLineStyle::None; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp deleted file mode 100644 index f9950f13cde..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp +++ /dev/null @@ -1,75 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - -private: - - // - void AddCustomDataTableStyle() - { - - /* Create a new DataGridTableStyle and set - its MappingName to the TableName of a DataTable. */ - DataGridTableStyle^ ts1 = gcnew DataGridTableStyle; - ts1->MappingName = "Customers"; - - /* Add a GridColumnStyle and set its MappingName - to the name of a DataColumn in the DataTable. - Set the HeaderText and Width properties. */ - DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn; - boolCol->MappingName = "Current"; - boolCol->HeaderText = "IsCurrent Customer"; - boolCol->Width = 150; - ts1->GridColumnStyles->Add( boolCol ); - - // Add a second column style. - DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; - TextCol->MappingName = "custName"; - TextCol->HeaderText = "Customer Name"; - TextCol->Width = 250; - ts1->GridColumnStyles->Add( TextCol ); - - // Create the second table style with columns. - DataGridTableStyle^ ts2 = gcnew DataGridTableStyle; - ts2->MappingName = "Orders"; - - // Change the colors. - ts2->ForeColor = Color::Yellow; - ts2->AlternatingBackColor = Color::Blue; - ts2->BackColor = Color::Blue; - - // Create new DataGridColumnStyle objects. - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - ts2->GridColumnStyles->Add( cOrderDate ); - PropertyDescriptorCollection^ pcol = this->BindingContext[ myDataSet,"Customers.custToOrders" ]->GetItemProperties(); - DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - ts2->GridColumnStyles->Add( csOrderAmount ); - - // Add the DataGridTableStyle objects to the collection. - myDataGrid->TableStyles->Add( ts1 ); - myDataGrid->TableStyles->Add( ts2 ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp deleted file mode 100644 index c09b0d08744..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - - // -private: - void EditTable() - { - DataGridTableStyle^ dgt = myDataGrid->TableStyles[ 0 ]; - DataGridColumnStyle^ myCol = dgt->GridColumnStyles[ 0 ]; - dgt->BeginEdit( myCol, 1 ); - dgt->EndEdit( myCol, 1, true ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp deleted file mode 100644 index 0a998cd743a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - - // -private: - void GetSelectedIndex( DataGridTableStyle^ myGridTable ) - { - /* Get the name of the DataGrid of the DataGridTable - passed as an argument. */ - Console::WriteLine( myGridTable->DataGrid->CurrentCell.ToString() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp deleted file mode 100644 index ba8e4036349..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ myDataSet; - - // -private: - void AddGridTable() - { - DataGridTableStyle^ myGridTableStyle; - myGridTableStyle = gcnew DataGridTableStyle; - myGridTableStyle->MappingName = "Customers"; - dataGrid1->TableStyles->Add( myGridTableStyle ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp deleted file mode 100644 index 1a7c5f41e73..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - - // -private: - void CreateDataGridGridTableStyle() - { - CurrencyManager^ myCurrencyManager; - DataGridTableStyle^ myGridTableStyle; - - /* Get the CurrencyManager for a DataTable named "Customers" - found in a DataSet named "myDataSet". */ - myCurrencyManager = dynamic_cast(BindingContext[myDataSet, "Customers"]); - myGridTableStyle = gcnew DataGridTableStyle( myCurrencyManager ); - - // Add the table style to the collection of a DataGrid. - myDataGrid->TableStyles->Add( myGridTableStyle ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp deleted file mode 100644 index fa44d54187b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - - // -private: - void EditTable() - { - DataGridTableStyle^ dgt = myDataGrid->TableStyles[ 0 ]; - DataGridColumnStyle^ myCol = dgt->GridColumnStyles[ 0 ]; - dgt->BeginEdit( myCol, 1 ); - dgt->EndEdit( myCol, 1, true ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp deleted file mode 100644 index 999171be739..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - - // -private: - void WriteMappingNames() - { - for each ( DataGridTableStyle^ dgt in myDataGrid->TableStyles ) - { - Console::WriteLine( dgt->MappingName ); - for each ( DataGridColumnStyle^ dgc in dgt->GridColumnStyles ) - { - Console::WriteLine( dgc->MappingName ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp deleted file mode 100644 index 88cb8930293..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ myDataSet; - - // -private: - void PrintReadOnlyValues() - { - for each ( DataGridTableStyle^ tableStyle in dataGrid1->TableStyles ) - { - Console::WriteLine( tableStyle->ReadOnly ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp deleted file mode 100644 index 5df9ccfa149..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void GetDataGridTextBox() - { - - // Get the DataGridTextBoxColumn from the DataGrid control. - DataGridTextBoxColumn^ myTextBoxColumn; - - // Assuming the CompanyName column is a DataGridTextBoxColumn. - myTextBoxColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); - - // Get the DataGridTextBox for the column. - DataGridTextBox^ myGridTextBox; - myGridTextBox = dynamic_cast(myTextBoxColumn->TextBox); - } - - // -}; - -int main() -{ - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp deleted file mode 100644 index 8e622562c64..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void AddColumn() - { - DataTable^ myTable = gcnew DataTable; - - // Add a new DataColumn to the DataTable. - DataColumn^ myColumn = gcnew DataColumn( "myTextBoxColumn" ); - myColumn->DataType = System::Type::GetType( "System::String" ); - myColumn->DefaultValue = "default string"; - myTable->Columns->Add( myColumn ); - - // Get the CurrencyManager for the DataTable. - CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myTable ]); - - // Use the CurrencyManager to get the PropertyDescriptor for the new column. - System::ComponentModel::PropertyDescriptor^ pd = cm->GetItemProperties()[ "myTextBoxColumn" ]; - DataGridTextBoxColumn^ myColumnTextColumn; - - // Create the DataGridTextBoxColumn with the PropertyDescriptor. - myColumnTextColumn = gcnew DataGridTextBoxColumn( pd ); - - // Add the new DataGridColumn to the GridColumnsCollection. - dataGrid1->DataSource = myTable; - dataGrid1->TableStyles->Add( gcnew DataGridTableStyle ); - dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumnTextColumn ); - } - - // -}; - -int main() -{ - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp deleted file mode 100644 index 97bdabe4ddb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; -using namespace System::Globalization; - -ref class Form1: public Form -{ -private: - DataGrid^ dataGrid1; // = new DataGrid(); - - // -private: - void AddColumn( DataTable^ myTable ) - { - // Add a new DataColumn to the DataTable. - DataColumn^ myColumn = gcnew DataColumn( "myTextBoxColumn" ); - myColumn->DataType = String::typeid; - myColumn->DefaultValue = "default string"; - myTable->Columns->Add( myColumn ); - - // Get the ListManager for the DataTable. - CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myTable ]); - - // Use the ListManager to get the PropertyDescriptor for the new column. - PropertyDescriptor^ pd = cm->GetItemProperties()[ "myTextBoxColumn" ]; - - // Create a new DataTimeFormat object. - DateTimeFormatInfo^ fmt = gcnew DateTimeFormatInfo; - - // Insert code to set format. - DataGridTextBoxColumn^ myColumnTextColumn; - - // Create the DataGridTextBoxColumn with the PropertyDescriptor and Format. - myColumnTextColumn = gcnew DataGridTextBoxColumn( pd,fmt->SortableDateTimePattern ); - - // Add the new DataGridColumnStyle to the GridColumnsCollection. - dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumnTextColumn ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp deleted file mode 100644 index d3b00c6ad29..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridTextBoxColumn -{ -public: - void EditCol( CurrencyManager^ cm, int rowNum, Rectangle cellRect, bool readOnly, String^ myString, bool isVisible ) - { - this->Edit( cm, rowNum, cellRect, readOnly, myString, isVisible ); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ myDataSet; -private: - void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e ) - { - - // Use the HitTest method to get a HitTestInfo object. - DataGrid::HitTestInfo ^ hi; - DataGrid^ grid = dynamic_cast(sender); - hi = grid->HitTest( e->X, e->Y ); - - // Test if the clicked area was a cell. - if ( hi->Type == DataGrid::HitTestType::Cell ) - { - - // If it's a cell, get the GridTable and CurrencyManager of the - // clicked table. - DataGridTableStyle^ dgt = dataGrid1->TableStyles[ 0 ]; - CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]); - - // Get the Rectangle of the clicked cell. - Rectangle cellRect = grid->GetCellBounds( hi->Row, hi->Column ); - - // Get the clicked DataGridTextBoxColumn. - MyGridColumn^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); - - // Edit the value. - gridCol->EditCol( cm, hi->Row, cellRect, false, "New Text", true ); - } - } - -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp deleted file mode 100644 index e8db37f48a2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridTextBoxColumn -{ -public: - int GetPrefHeight( Graphics^ g, String^ val ) - { - return this->GetPreferredHeight( g, val ); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - void GetPreferredHeight() - { - Graphics^ g; - g = this->CreateGraphics(); - int gridPreferredHeight; - MyGridColumn^ myTextColumn; - - // Assuming column 1 of a DataGrid control is a - // DataGridTextBoxColumn. - myTextColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 1 ]); - String^ myVal; - myVal = "A long string value"; - gridPreferredHeight = myTextColumn->GetPrefHeight( g, myVal ); - Console::WriteLine( gridPreferredHeight ); - } - -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp deleted file mode 100644 index c4fdc4ccf5c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridTextBoxColumn -{ -public: - Size GetPrefSize( Graphics^ g, String^ val ) - { - return this->GetPreferredSize( g, val ); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - void GetPreferredSize() - { - Graphics^ g; - g = this->CreateGraphics(); - System::Drawing::Size gridPreferredSize; - MyGridColumn^ myTextColumn; - - // Assuming column 1 of a DataGrid control is a - // DataGridTextBoxColumn. - myTextColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 1 ]); - String^ myVal; - myVal = "A long string value"; - gridPreferredSize = myTextColumn->GetPrefSize( g, myVal ); - Console::WriteLine( gridPreferredSize ); - } - -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp deleted file mode 100644 index 9e0de639d5c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -public ref class MyGridColumn: public DataGridTextBoxColumn -{ -public: - void PaintCol( Graphics^ g, Rectangle cellRect, CurrencyManager^ cm, int rowNum, Brush^ bBrush, Brush^ fBrush, bool isVisible ) - { - this->Paint( g, cellRect, cm, rowNum, bBrush, fBrush, isVisible ); - } - -}; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ myDataSet; - -private: - void PaintCell( Object^ sender, MouseEventArgs^ e ) - { - - // Use the HitTest method to get a HitTestInfo object. - DataGrid::HitTestInfo ^ hi; - DataGrid^ grid = dynamic_cast(sender); - hi = grid->HitTest( e->X, e->Y ); - - // Test if the clicked area was a cell. - if ( hi->Type == DataGrid::HitTestType::Cell ) - { - - // If it's a cell, get the GridTable and ListManager of the - // clicked table. - DataGridTableStyle^ dgt = dataGrid1->TableStyles[ 0 ]; - CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]); - - // Get the Rectangle of the clicked cell. - Rectangle cellRect; - cellRect = grid->GetCellBounds( hi->Row, hi->Column ); - - // Get the clicked DataGridTextBoxColumn. - MyGridColumn^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); - - // Get the Graphics object for the form. - Graphics^ g = dataGrid1->CreateGraphics(); - - // Create two new Brush objects, a fore brush, and back brush. - Brush^ fBrush = gcnew System::Drawing::SolidBrush( Color::Blue ); - Brush^ bBrush = gcnew System::Drawing::SolidBrush( Color::Yellow ); - - // Invoke the Paint method to paint the cell with the brushes. - gridCol->PaintCol( g, cellRect, cm, hi->Row, bBrush, fBrush, false ); - } - } - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp deleted file mode 100644 index 7a05ab7eed7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void AddMyData3() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Creates a new data object. - DataObject^ myDataObject = gcnew DataObject; - - // Adds the component to the DataObject. - myDataObject->SetData( myComponent ); - - // Prints whether data of the specified type is in the DataObject. - Type^ myType = myComponent->GetType(); - if ( myDataObject->GetDataPresent( myType ) ) - { - textBox1->Text = String::Concat( "Data of type ", myType, - " is present in the DataObject" ); - } - else - { - textBox1->Text = String::Concat( "Data of type ", myType, - " is not present in the DataObject" ); - } - } - // - - // - void GetMyData2() - { - // Creates a new data object using a string and the text format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Text to Store" ); - - // Prints the string in a text box. - textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp deleted file mode 100644 index 44e7ebed0a1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void CreateDefaultDataObject() - { - // Creates a data object. - DataObject^ myDataObject; - - // Assigns the string to the data object. - String^ myString = "My text string"; - myDataObject = gcnew DataObject( myString ); - - // Prints the string in a text box. - textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp deleted file mode 100644 index 9626e98f5a0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void CreateTextDataObject() - { - // Creates a new data object using a string. - String^ myString = "My text string"; - DataObject^ myDataObject = gcnew DataObject( myString ); - - // Prints the string in a text box. - textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp deleted file mode 100644 index 429ed00b4b0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void CreateTextDataObject2() - { - // Creates a new data object using a string. - String^ myString = "My next text string"; - DataObject^ myDataObject = gcnew DataObject( "System.String",myString ); - - // Prints the string in a text box. - textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp deleted file mode 100644 index c1ee4529913..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetMyData3() - { - // Creates a new data object using a string and the text format. - String^ myString = "My new text string"; - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); - - // Prints the string in a text box with autoconvert = false. - if ( myDataObject->GetData( "System.String", false ) != 0 ) - { - // Prints the string in a text box. - textBox1->Text = String::Concat( - myDataObject->GetData( "System.String", false )->ToString(), "\n" ); - } - else - { - textBox1->Text = "Could not find data of the specified format\n"; - } - - // Prints the string in a text box with autoconvert = true. - textBox1->Text = String::Concat( - textBox1->Text, myDataObject->GetData( "System.String", true )->ToString() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp deleted file mode 100644 index 6d4f246a31b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetMyData() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Creates a new data object and assigns it the component. - DataObject^ myDataObject = gcnew DataObject( myComponent ); - - // Creates a type to store the type of data. - Type^ myType = myComponent->GetType(); - - // Retrieves the data using myType to represent its type. - Object^ myObject = myDataObject->GetData( myType ); - if ( myObject != nullptr ) - { - textBox1->Text = String::Format( "The data type stored in the DataObject is: {0}", - myObject->GetType()->Name ); - } - else - { - textBox1->Text = "Data of the specified type was not stored in the DataObject."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp deleted file mode 100644 index f80c08805a9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetIfPresent2() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Creates a new data object and assigns it the component. - DataObject^ myDataObject = gcnew DataObject( myComponent ); - - // Creates a type to store the type of data. - Type^ myType = myComponent->GetType(); - - // Determines if the DataObject has data of the Type format. - textBox1->Text = String::Concat( "Is the specified data type available ", - "in the DataObject? ", myDataObject->GetDataPresent( myType ), "\n" ); - - // Retrieves the data using its type format, and displays the type. - Object^ myObject = myDataObject->GetData( myType ); - textBox1->Text = String::Concat( textBox1->Text, "The data type stored ", - "in the DataObject is: ", myObject->GetType()->Name ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp deleted file mode 100644 index 25f1e96be04..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetIfPresent3() - { - // Creates a new data object using a string and the text format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text, "Another string" ); - - // Prints the string in a text box with autoconvert = false. - if ( myDataObject->GetDataPresent( "System.String", false ) ) - { - // Prints the string in a text box. - textBox1->Text = String::Concat( - myDataObject->GetData( "System.String", false )->ToString(), "\n" ); - } - else - { - textBox1->Text = "Could not convert data to specified format\n"; - } - - // Prints the string in a text box with autoconvert = true. - textBox1->Text = String::Concat( textBox1->Text, - "With autoconvert = true, you can convert text to string format. String is: ", - myDataObject->GetData( "System.String", true )->ToString() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp deleted file mode 100644 index b0260219fe0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetAllFormats2() - { - // Creates a new data object using a string and the text format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" ); - - // Gets the original data formats in the DataObject. - array^ arrayOfFormats = myDataObject->GetFormats( false ); - - // Prints the results. - textBox1->Text = "The format(s) associated with the data are: \n"; - for ( int i = 0; i < arrayOfFormats->Length; i++ ) - { - textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); - } - - // Gets the all data formats and data conversion formats for the DataObject. - arrayOfFormats = myDataObject->GetFormats( true ); - - // Prints the results. - textBox1->Text = String::Concat( textBox1->Text , "The data formats and conversion ", - "format(s) associated with the data are: \n" ); - for ( int i = 0; i < arrayOfFormats->Length; i++ ) - { - textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp deleted file mode 100644 index e7dfdcc44f0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void GetAllFormats() - { - // Creates a new data object using a string and the text format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" ); - - // Gets all the data formats and data conversion formats in the DataObject. - array^ arrayOfFormats = myDataObject->GetFormats(); - - // Prints the results. - textBox1->Text = "The format(s) associated with the data are: \n"; - for ( int i = 0; i < arrayOfFormats->Length; i++ ) - { - textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp deleted file mode 100644 index 8dda7860d2a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void AddMyData4() - { - // Creates a new data object, and assigns it the component. - DataObject^ myDataObject = gcnew DataObject; - - // Adds data to the DataObject, and specifies no format conversion. - myDataObject->SetData( DataFormats::UnicodeText, false, "My Unicode data" ); - - // Gets the data formats in the DataObject. - array^ arrayOfFormats = myDataObject->GetFormats(); - - // Prints the results. - textBox1->Text = "The format(s) associated with the data are: \n"; - for ( int i = 0; i < arrayOfFormats->Length; i++ ) - { - textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp deleted file mode 100644 index 44e43960bca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void AddMyData() - { - // Creates a new data object using a string and the text format. - DataObject^ myDataObject = gcnew DataObject; - - // Stores a string, specifying the Unicode format. - myDataObject->SetData( DataFormats::UnicodeText, "Text string" ); - - // Retrieves the data by specifying Text. - textBox1->Text = myDataObject->GetData( DataFormats::Text )->GetType()->Name; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp deleted file mode 100644 index 64f651341b1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void AddMyData2() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Gets the type of the component. - Type^ myType = myComponent->GetType(); - - // Creates a new data object. - DataObject^ myDataObject = gcnew DataObject; - - // Adds the component to the DataObject. - myDataObject->SetData( myType, myComponent ); - - // Prints whether data of the specified type is in the DataObject. - if ( myDataObject->GetDataPresent( myType ) ) - { - textBox1->Text = String::Concat( "Data of type ", myType->Name, - " is present in the DataObject" ); - } - else - { - textBox1->Text = String::Concat( "Data of type ", myType->Name, - " is not present in the DataObject" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp deleted file mode 100644 index b44ff39df75..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void AddMyData3() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Creates a new data object. - DataObject^ myDataObject = gcnew DataObject; - - // Adds the component to the DataObject. - myDataObject->SetData( myComponent ); - - // Prints whether data of the specified type is in the DataObject. - Type^ myType = myComponent->GetType(); - if ( myDataObject->GetDataPresent( myType ) ) - { - textBox1->Text = String::Concat( "Data of type ", myType->Name, - " is present in the DataObject" ); - } - else - { - textBox1->Text = String::Concat( "Data of type ", myType->Name, - " is not present in the DataObject" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp deleted file mode 100644 index 78e899c745d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyDateTimePicker() - { - // Create a new DateTimePicker control and initialize it. - DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; - - // Set the MinDate and MaxDate. - dateTimePicker1->MinDate = DateTime(1985,6,20); - dateTimePicker1->MaxDate = DateTime::Today; - - // Set the CustomFormat string. - dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd"; - dateTimePicker1->Format = DateTimePickerFormat::Custom; - - // Show the CheckBox and display the control as an up-down control. - dateTimePicker1->ShowCheckBox = true; - dateTimePicker1->ShowUpDown = true; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp deleted file mode 100644 index 097b8ce3ee9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DateTimePicker^ dateTimePicker1; - - // -public: - void SetMyCustomFormat() - { - // Set the Format type and the CustomFormat string. - dateTimePicker1->Format = DateTimePickerFormat::Custom; - dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd"; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp deleted file mode 100644 index aaa0112e550..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace DefaultEventAttributeExample -{ - // - [DefaultEvent("CollectionChanged")] - public ref class TestCollection: public BaseCollection - { - private: - CollectionChangeEventHandler^ onCollectionChanged; - - public: - event CollectionChangeEventHandler^ CollectionChanged - { - public: - void add(CollectionChangeEventHandler^ eventHandler) - { - onCollectionChanged += eventHandler; - } - - protected: - void remove(CollectionChangeEventHandler^ eventHandler) - { - onCollectionChanged -= eventHandler; - } - } - // Insert additional code. - }; - // -} - -// -int main() -{ - // Creates a new collection. - DefaultEventAttributeExample::TestCollection^ newCollection = - gcnew DefaultEventAttributeExample::TestCollection; - - // Gets the attributes for the collection. - AttributeCollection^ attributes = - TypeDescriptor::GetAttributes(newCollection); - - // Prints the name of the default event by retrieving the - // DefaultEventAttribute from the AttributeCollection. - DefaultEventAttribute^ attribute = (DefaultEventAttribute^) - attributes[DefaultEventAttribute::typeid]; - Console::WriteLine("The default event is: {0}", attribute->Name); -} -// - diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp deleted file mode 100644 index b5ea859e190..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - - // - [DefaultProperty("MyProperty")] - ref class MyControl: public Control - { - public: - - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - - void set( int value ) - { - // Insert code here. - } - } - // Insert any additional code. - }; - // -}; - - -// -int main() -{ - // Creates a new control. - Form1::MyControl^ myNewControl = gcnew Form1::MyControl; - - // Gets the attributes for the collection. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewControl ); - - /* Prints the name of the default property by retrieving the - * DefaultPropertyAttribute from the AttributeCollection. */ - DefaultPropertyAttribute^ myAttribute = dynamic_cast(attributes[ DefaultPropertyAttribute::typeid ]); - Console::WriteLine( "The default property is: {0}", myAttribute->Name ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp deleted file mode 100644 index f2568cb4ac9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - bool _myVal; - -public: - [DefaultValue(false)] - property bool MyProperty - { - bool get() - { - return _myVal; - } - - void set( bool value ) - { - _myVal = value; - } - } - // - -protected: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - /* Prints the default value by retrieving the DefaultValueAttribute - * from the AttributeCollection. */ - DefaultValueAttribute^ myAttribute = dynamic_cast(attributes[ DefaultValueAttribute::typeid ]); - Console::WriteLine( "The default value is: {0}", myAttribute->Value ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp deleted file mode 100644 index 154c9fae14c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -protected: - Image^ image1; - - // -public: - property Image^ MyImage - { - [Description("The image associated with the control"),Category("Appearance")] - Image^ get() - { - // Insert code here. - return image1; - } - - void set( Image^ value ) - { - // Insert code here. - } - } - // - -protected: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyImage" ]->Attributes; - - /* Prints the description by retrieving the DescriptionAttribute - * from the AttributeCollection. */ - DescriptionAttribute^ myAttribute = dynamic_cast(attributes[ DescriptionAttribute::typeid ]); - Console::WriteLine( myAttribute->Description ); - // - } - -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp deleted file mode 100644 index af47a3a2241..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Globalization; -public ref class Class1 -{ -protected: - CultureInfo^ myCultureInfo; - - // -public: - [DesignOnly(true)] - property CultureInfo^ GetLanguage - { - CultureInfo^ get() - { - // Insert code here. - return myCultureInfo; - } - void set( CultureInfo^ value ) - { - // Insert code here. - } - } - // - -private: - property int Property1 - { - int get() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "GetLanguage" ]->Attributes; - - /* Prints whether the property is marked as DesignOnly - by retrieving the DesignOnlyAttribute from the AttributeCollection. */ - DesignOnlyAttribute^ myAttribute = dynamic_cast(attributes[ DesignOnlyAttribute::typeid ]); - Console::WriteLine( "This property is design only :{0}", myAttribute->IsDesignOnly ); - // - - return 1; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp deleted file mode 100644 index 59fc15140fe..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -// -[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design.DLL", -IRootDesigner::typeid), -DesignerCategory("Form")] -ref class MyForm: public ContainerControl{ - // Insert code here. -}; -// - -// -int main() -{ - // Creates a new form. - MyForm^ myNewForm = gcnew MyForm; - - // Gets the attributes for the collection. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewForm ); - - /* Prints the name of the designer by retrieving the DesignerAttribute - * from the AttributeCollection. */ - DesignerAttribute^ myAttribute = dynamic_cast(attributes[ DesignerAttribute::typeid ]); - Console::WriteLine( "The designer for this class is: {0}", myAttribute->DesignerTypeName ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp deleted file mode 100644 index 259fee58622..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -// -[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design", -IRootDesigner::typeid), -DesignerCategory("Form")] -ref class MyForm: public ContainerControl{ - // Insert code here. -}; -// - -// -int main() -{ - // Creates a new form. - MyForm^ myNewForm = gcnew MyForm; - - // Gets the attributes for the collection. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewForm ); - - /* Prints the name of the designer by retrieving the - * DesignerCategoryAttribute from the AttributeCollection. */ - DesignerCategoryAttribute^ myAttribute = dynamic_cast(attributes[ DesignerCategoryAttribute::typeid ]); - Console::WriteLine( "The category of the designer for this class is: {0}", myAttribute->Category ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp deleted file mode 100644 index 932958a9e5a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// This attribute indicates that the public properties of this object should be listed in the property grid. - -[TypeConverterAttribute(System::ComponentModel::ExpandableObjectConverter::typeid)] -public ref class DimensionData -{ -private: - Control^ owner; - -internal: - - // This class reads and writes the Location and Size properties from the Control which it is initialized to. - DimensionData( Control^ owner ) - { - this->owner = owner; - } - -public: - - property Point Location - { - Point get() - { - return owner->Location; - } - - void set( Point value ) - { - owner->Location = value; - } - - } - - property Size FormSize - { - Size get() - { - return owner->Size; - } - - void set( Size value ) - { - owner->Size = value; - } - } -}; - -// The code for this user control declares a public property of type DimensionData with a DesignerSerializationVisibility -// attribute set to DesignerSerializationVisibility.Content, indicating that the properties of the object should be serialized. -// The public, not hidden properties of the object that are set at design time will be persisted in the initialization code -// for the class object. Content persistence will not work for structs without a custom TypeConverter. -public ref class ContentSerializationExampleControl: public System::Windows::Forms::UserControl -{ -private: - System::ComponentModel::Container^ components; - -public: - - property DimensionData^ Dimensions - { - [DesignerSerializationVisibility(DesignerSerializationVisibility::Content)] - DimensionData^ get() - { - return gcnew DimensionData( this ); - } - } - ContentSerializationExampleControl() - { - InitializeComponent(); - } - -public: - ~ContentSerializationExampleControl() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - components = gcnew System::ComponentModel::Container; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp deleted file mode 100644 index bac7629b68b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - [DesignerSerializationVisibility(DesignerSerializationVisibility::Content)] - property int MyProperty - { - int get() - { - // Insert code here. - return (0); - } - void set( int value ) - { - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp deleted file mode 100644 index 1efa6cb6b66..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the value of the DesignerSerializationVisibilityAttribute is set to Content. - if ( attributes[ DesignerSerializationVisibilityAttribute::typeid ]->Equals( DesignerSerializationVisibilityAttribute::Content ) ) - { - // Insert code here. - } - - - // This is another way to see whether the property is marked as serializing content. - DesignerSerializationVisibilityAttribute^ myAttribute = dynamic_cast(attributes[ DesignerSerializationVisibilityAttribute::typeid ]); - if ( myAttribute->Visibility == DesignerSerializationVisibility::Content ) - { - // Insert code here. - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp deleted file mode 100644 index 849b818b8ac..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - int myCounter; - - // -protected: - DomainUpDown^ domainUpDown1; - -private: - void MySub() - { - // Create and initialize the DomainUpDown control. - domainUpDown1 = gcnew System::Windows::Forms::DomainUpDown; - - // Add the DomainUpDown control to the form. - Controls->Add( domainUpDown1 ); - } - - void button1_Click( System::Object^ sender, - System::EventArgs^ e ) - { - // Add the text box contents and initial location in the collection - // to the DomainUpDown control. - domainUpDown1->Items->Add( String::Concat( - (textBox1->Text->Trim()), " - ", myCounter.ToString() ) ); - - // Increment the counter variable. - myCounter = myCounter + 1; - - // Clear the TextBox. - textBox1->Text = ""; - } - - void checkBox1_Click( Object^ sender, EventArgs^ e ) - { - // If Sorted is set to true, set it to false; - // otherwise set it to true. - if ( domainUpDown1->Sorted ) - { - domainUpDown1->Sorted = false; - } - else - { - domainUpDown1->Sorted = true; - } - } - - void domainUpDown1_SelectedItemChanged( Object^ sender, EventArgs^ e ) - { - // Display the SelectedIndex and SelectedItem property values in a MessageBox. - MessageBox::Show( String::Concat( "SelectedIndex: ", - domainUpDown1->SelectedIndex.ToString(), "\n", "SelectedItem: ", - domainUpDown1->SelectedItem->ToString() ) ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp deleted file mode 100644 index 0d4bcb51c53..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - int myCounter; - - // -protected: - DomainUpDown^ domainUpDown1; - -private: - void InitializeMyDomainUpDown() - { - // Create and initialize the DomainUpDown control. - domainUpDown1 = gcnew DomainUpDown; - - // Add the DomainUpDown control to the form. - Controls->Add( domainUpDown1 ); - } - - void button1_Click( Object^ sender, - EventArgs^ e ) - { - // Add the text box contents and initial location in the collection - // to the DomainUpDown control. - domainUpDown1->Items->Add( String::Concat( - (textBox1->Text->Trim()), " - ", myCounter ) ); - - // Increment the counter variable. - myCounter = myCounter + 1; - - // Clear the TextBox. - textBox1->Text = ""; - } - - void checkBox1_Click( Object^ sender, - EventArgs^ e ) - { - - // If Sorted is set to true, set it to false; - // otherwise set it to true. - domainUpDown1->Sorted = !domainUpDown1->Sorted; - } - - void domainUpDown1_SelectedItemChanged( Object^ sender, - EventArgs^ e ) - { - - // Display the SelectedIndex and - // SelectedItem property values in a MessageBox. - MessageBox::Show( String::Concat( "SelectedIndex: ", domainUpDown1->SelectedIndex, - "\nSelectedItem: ", domainUpDown1->SelectedItem ) ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp deleted file mode 100644 index 6b775b2abb3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// -[Editor("System.Windows.Forms.ImageEditorIndex, System.Design", -UITypeEditor::typeid)] -public ref class MyImage{ - // Insert code here. -}; -// - -// -int main() -{ - // Creates a new component. - MyImage^ myNewImage = gcnew MyImage; - - // Gets the attributes for the component. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewImage ); - - /* Prints the name of the editor by retrieving the EditorAttribute - * from the AttributeCollection. */ - EditorAttribute^ myAttribute = dynamic_cast(attributes[ EditorAttribute::typeid ]); - Console::WriteLine( "The editor for this class is: {0}", myAttribute->EditorTypeName ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp deleted file mode 100644 index f70b1132f28..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - ErrorProvider^ errorProvider1; - DataSet^ dataSet1; - DataTable^ dataTable1; - - // -private: - void InitializeComponent() - { - - // Standard control setup. - //.... - // You set the DataSource to a data set, and the DataMember to a table. - errorProvider1->DataSource = dataSet1; - errorProvider1->DataMember = dataTable1->TableName; - errorProvider1->ContainerControl = this; - errorProvider1->BlinkRate = 200; - - //... - // Since the ErrorProvider control does not have a visible component, - // it does not need to be added to the form. - } - - -private: - void buttonSave_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Checks for a bad post code. - DataTable^ CustomersTable; - CustomersTable = dataSet1->Tables[ "Customers" ]; - System::Collections::IEnumerator^ myEnum = (CustomersTable->Rows)->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataRow^ row = safe_cast(myEnum->Current); - if ( Convert::ToBoolean( row[ "PostalCodeIsNull" ] ) ) - { - row->RowError = "The Customer details contain errors"; - row->SetColumnError( "PostalCode", "Postal Code required" ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp deleted file mode 100644 index 6890216f914..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - - // -private: - void MyEventCollection() - { - // Creates a new collection and assigns it the events for button1. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Displays each event in the collection in a text box. - for each ( EventDescriptor^ myEvent in events ) - { - textBox1->Text = String::Concat( textBox1->Text, myEvent->Name, "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp deleted file mode 100644 index 217c8f3acc6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - - // -private: - void GetCount() - { - // Creates a new collection and assigns it the events for button1. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Prints the number of events on button1 in a text box. - textBox1->Text = events->Count.ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp deleted file mode 100644 index bc57ab44117..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - void Method() - { - // - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp deleted file mode 100644 index afcc29eb0ab..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - - // -private: - void FindEvent() - { - // Creates a new collection and assigns it the events for button1. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Sets an EventDescriptor to the specific event. - EventDescriptor^ myEvent = events->Find( "Resize", false ); - - // Prints the event name and event description. - textBox1->Text = String::Concat( myEvent->Name, ": ", myEvent->Description ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index 73599048694..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - - // -private: - void MyEnumerator() - { - // Creates a new collection, and assigns to it the events for button1. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Creates an enumerator. - IEnumerator^ ie = events->GetEnumerator(); - - // Prints the name of each event in the collection. - Object^ myEvent; - while ( ie->MoveNext() ) - { - myEvent = ie->Current; - textBox1->Text = String::Concat( textBox1->Text, myEvent, "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp deleted file mode 100644 index 0dd76e1c42c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Coll1 abstract: public EventDescriptorCollection -{ -public: - Coll1() - : EventDescriptorCollection( nullptr ) - {} - -protected: - void Method() - { - // - array^ temp0 = {"D","B"}; - this->InternalSort( temp0 ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp deleted file mode 100644 index a345e12061c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Coll1 abstract: public EventDescriptorCollection -{ -protected: - Object^ myNewColl; - -public: - Coll1() : EventDescriptorCollection( nullptr ) - { - } - -protected: - void Method() - { - // - array^ temp0 = {"D","B"}; - myNewColl = this->Sort( temp0 ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp deleted file mode 100644 index 8463c7d4cdd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - - // -private: - void PrintIndexItem() - { - - // Creates a new collection and assigns it the events for button1. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Prints the second event's name. - textBox1->Text = events[ 1 ]->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp deleted file mode 100644 index cd52c396684..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Button^ button1; - - // -private: - void PrintIndexItem2() - { - - // Creates a new collection and assigns it the events for button1. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Sets an EventDescriptor to the specific event. - EventDescriptor^ myEvent = events[ "KeyDown" ]; - - // Prints the name of the event. - textBox1->Text = myEvent->Name; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp deleted file mode 100644 index e41526c7f28..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - FontDialog^ fontDialog1; - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - fontDialog1->ShowColor = true; - - fontDialog1->Font = textBox1->Font; - fontDialog1->Color = textBox1->ForeColor; - - if ( fontDialog1->ShowDialog() != ::DialogResult::Cancel ) - { - textBox1->Font = fontDialog1->Font; - textBox1->ForeColor = fontDialog1->Color; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp deleted file mode 100644 index 65f35c1dcd8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyForm() - { - // Create a new instance of the form. - Form^ form1 = gcnew Form; - // Create two buttons to use as the accept and cancel buttons. - Button^ button1 = gcnew Button; - Button^ button2 = gcnew Button; - - // Set the text of button1 to "OK". - button1->Text = "OK"; - // Set the position of the button on the form. - button1->Location = Point(10,10); - // Set the text of button2 to "Cancel". - button2->Text = "Cancel"; - // Set the position of the button based on the location of button1. - button2->Location = - Point( button1->Left, button1->Height + button1->Top + 10 ); - // Set the caption bar text of the form. - form1->Text = "My Dialog Box"; - // Display a help button on the form. - form1->HelpButton = true; - - // Define the border style of the form to a dialog box. - form1->FormBorderStyle = ::FormBorderStyle::FixedDialog; - // Set the MaximizeBox to false to remove the maximize box. - form1->MaximizeBox = false; - // Set the MinimizeBox to false to remove the minimize box. - form1->MinimizeBox = false; - // Set the accept button of the form to button1. - form1->AcceptButton = button1; - // Set the cancel button of the form to button2. - form1->CancelButton = button2; - // Set the start position of the form to the center of the screen. - form1->StartPosition = FormStartPosition::CenterScreen; - - // Add button1 to the form. - form1->Controls->Add( button1 ); - // Add button2 to the form. - form1->Controls->Add( button2 ); - // Display the form as a modal dialog box. - form1->ShowDialog(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp deleted file mode 100644 index dae7cb32dfa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - - // - void DisableActiveFormControls() - { - - // Create an instance of a form and assign it the currently active form. - Form^ currentForm = Form::ActiveForm; - - // Loop through all the controls on the active form. - for ( int i = 0; i < currentForm->Controls->Count; i++ ) - { - - // Disable each control in the active form's control collection. - currentForm->Controls[ i ]->Enabled = false; - - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp deleted file mode 100644 index 890be7cbd12..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void ClearAllChildFormText() - { - - // Obtain a reference to the currently active MDI child form. - Form^ tempChild = this->ActiveMdiChild; - - // Loop through all controls on the child form. - for ( int i = 0; i < tempChild->Controls->Count; i++ ) - { - - // Determine if the current control on the child form is a TextBox. - if ( dynamic_cast(tempChild->Controls[ i ]) ) - { - - // Clear the contents of the control since it is a TextBox. - tempChild->Controls[ i ]->Text = ""; - } - - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp deleted file mode 100644 index 3e26b76fc6b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - - // -private: - void MyForm_Resize( Object^ sender, EventHandler^ e ) - { - // Set the size of button1 to the size of the client area of the form. - button1->Size = this->ClientSize; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp deleted file mode 100644 index 42195595c6a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyBorderlessWindow() - { - this->FormBorderStyle = ::FormBorderStyle::None; - this->MaximizeBox = false; - this->MinimizeBox = false; - this->StartPosition = FormStartPosition::CenterScreen; - // Remove the control box so the form will only display client area. - this->ControlBox = false; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp deleted file mode 100644 index edded62021c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void AddMyControls() - { - TextBox^ textBox1 = gcnew TextBox; - Label^ label1 = gcnew Label; - - // Initialize the controls and their bounds. - label1->Text = "First Name"; - label1->Location = Point( 48, 48 ); - label1->Size = System::Drawing::Size( 104, 16 ); - textBox1->Text = ""; - textBox1->Location = Point(48,64); - textBox1->Size = System::Drawing::Size( 104, 16 ); - - // Add the TextBox control to the form's control collection. - Controls->Add( textBox1 ); - // Add the Label control to the form's control collection. - Controls->Add( label1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp deleted file mode 100644 index eb89c1935ec..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void MoveMyForm() - { - // Create a Rectangle object that will be used as the bound of the form. - Rectangle tempRect = Rectangle( 50, 50, 100, 100 ); - // Set the bounds of the form using the Rectangle object. - this->DesktopBounds = tempRect; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp deleted file mode 100644 index 1aa2a3c0cad..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void MoveMyForm() - { - // Create a Point object that will be used as the location of the form. - Point tempPoint = Point( 100, 100 ); - // Set the location of the form using the Point object. - this->DesktopLocation = tempPoint; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp deleted file mode 100644 index 34c63a74eab..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - Form1^ form1; - -public: - - // - void CreateMyForm() - { - - // Create a new instance of the form. - Form^ form1 = gcnew Form; - - // Create two buttons to use as the accept and cancel buttons. - Button^ button1 = gcnew Button; - Button^ button2 = gcnew Button; - - // Set the text of button1 to "OK". - button1->Text = "OK"; - - // Set the position of the button on the form. - button1->Location = Point(10,10); - - // Set the text of button2 to "Cancel". - button2->Text = "Cancel"; - - // Set the position of the button based on the location of button1. - button2->Location = Point(button1->Left,button1->Height + button1->Top + 10); - - // Make button1's dialog result OK. - button1->DialogResult = ::DialogResult::OK; - - // Make button2's dialog result Cancel. - button2->DialogResult = ::DialogResult::Cancel; - - // Set the caption bar text of the form. - form1->Text = "My Dialog Box"; - - // Define the border style of the form to a dialog box. - form1->FormBorderStyle = ::FormBorderStyle::FixedDialog; - - // Set the accept button of the form to button1. - form1->AcceptButton = button1; - - // Set the cancel button of the form to button2. - form1->CancelButton = button2; - - // Set the start position of the form to the center of the screen. - form1->StartPosition = FormStartPosition::CenterScreen; - - // Add button1 to the form. - form1->Controls->Add( button1 ); - - // Add button2 to the form. - form1->Controls->Add( button2 ); - - // Display the form as a modal dialog box. - form1->ShowDialog(); - - // Determine if the OK button was clicked on the dialog box. - if ( form1->DialogResult == ::DialogResult::OK ) - { - - // Display a message box indicating that the OK button was clicked. - MessageBox::Show( "The OK button on the form was clicked." ); - - // Optional: Call the Dispose method when you are finished with the dialog box. - delete form1; - } - else - { - - // Display a message box indicating that the Cancel button was clicked. - MessageBox::Show( "The Cancel button on the form was clicked." ); - - // Optional: Call the Dispose method when you are finished with the dialog box. - delete form1; - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp deleted file mode 100644 index 037d40867cd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void HorizontallyTileMyWindows( Object^ sender, System::EventArgs^ e ) - { - // Tile all child forms horizontally. - this->LayoutMdi( MdiLayout::TileHorizontal ); - } - - void VerticallyTileMyWindows( Object^ sender, System::EventArgs^ e ) - { - // Tile all child forms vertically. - this->LayoutMdi( MdiLayout::TileVertical ); - } - - void CascadeMyWindows( Object^ sender, System::EventArgs^ e ) - { - // Cascade all MDI child windows. - this->LayoutMdi( MdiLayout::Cascade ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp deleted file mode 100644 index eb35be13029..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp +++ /dev/null @@ -1,99 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form2: public Form -{ -protected: - Button^ okay; - Button^ cancel; - -public: - TextBox^ TextBox1; - Form2() - { - this->okay = gcnew Button; - this->okay->Location = Point(50,50); - this->okay->Width = 50; - this->okay->DialogResult = ::DialogResult::OK; - this->okay->Text = "OK"; - this->cancel = gcnew Button; - this->cancel->Location = Point(okay->Left + okay->Width + 10,50); - this->cancel->Width = 50; - this->cancel->DialogResult = ::DialogResult::Cancel; - this->cancel->Text = "Cancel"; - this->TextBox1 = gcnew TextBox; - this->TextBox1->Location = Point(50,100); - this->TextBox1->Width = 110; - this->TextBox1->Text = "Enter Text"; - array^temp0 = {okay,cancel,TextBox1}; - this->Controls->AddRange( temp0 ); - } - -}; - -public ref class Form1: public Form -{ -protected: - TextBox^ txtResult; - Button^ showButton; - -public: - Form1() - { - this->txtResult = gcnew TextBox; - this->showButton = gcnew Button; - this->showButton->Width = 100; - this->showButton->Text = "Show Dialog"; - this->showButton->Location = Point(0,txtResult->Height + 10); - this->showButton->Click += gcnew EventHandler( this, &Form1::showButton_Click ); - array^temp1 = {txtResult,showButton}; - this->Controls->AddRange( temp1 ); - } - - - // - void ShowMyDialogBox() - { - Form2^ testDialog = gcnew Form2; - - // Show testDialog as a modal dialog and determine if DialogResult = OK. - if ( testDialog->ShowDialog( this ) == ::DialogResult::OK ) - { - - // Read the contents of testDialog's TextBox. - this->txtResult->Text = testDialog->TextBox1->Text; - } - else - { - this->txtResult->Text = "Cancelled"; - } - - delete testDialog; - } - // - - -private: - - void showButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowMyDialogBox(); - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp deleted file mode 100644 index 2cbd27e85e1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Form1^ form1; - - // -public: - void CreateMyForm() - { - // Create a new instance of the form. - Form^ form1 = gcnew Form; - // Create two buttons to use as the accept and cancel buttons. - Button^ button1 = gcnew Button; - Button^ button2 = gcnew Button; - - // Set the text of button1 to "OK". - button1->Text = "OK"; - // Set the position of the button on the form. - button1->Location = Point(10,10); - // Set the text of button2 to "Cancel". - button2->Text = "Cancel"; - // Set the position of the button based on the location of button1. - button2->Location - = Point( button1->Left, button1->Height + button1->Top + 10 ); - // Set the caption bar text of the form. - form1->Text = "My Dialog Box"; - // Display a help button on the form. - form1->HelpButton = true; - - // Define the border style of the form to a dialog box. - form1->FormBorderStyle = ::FormBorderStyle::FixedDialog; - // Set the accept button of the form to button1. - form1->AcceptButton = button1; - // Set the cancel button of the form to button2. - form1->CancelButton = button2; - // Set the start position of the form to the center of the screen. - form1->StartPosition = FormStartPosition::CenterScreen; - - // Add button1 to the form. - form1->Controls->Add( button1 ); - // Add button2 to the form. - form1->Controls->Add( button2 ); - - // Display the form as a modal dialog box. - form1->ShowDialog(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp deleted file mode 100644 index ff9eff09682..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp +++ /dev/null @@ -1,22 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void InitializeMyForm() - { - this->BackColor = Color::Red; - // Make the background color of form display transparently. - this->TransparencyKey = BackColor; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp deleted file mode 100644 index c5d945975c2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp +++ /dev/null @@ -1,60 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -#define NULL 0L -public ref class Form1: public Form -{ -private: - DataGrid^ DataGrid1; - DataSet^ DataSet1; - void Setup() - { - DataGrid1 = gcnew DataGrid; - DataSet1 = gcnew DataSet( "myDataSet" ); - } - - - // - void PrintColumnInformation( DataGrid^ grid ) - { - Console::WriteLine( "Count: {0}", grid->TableStyles->Count ); - GridColumnStylesCollection^ myColumns; - DataGridTableStyle^ myTableStyle; - for ( __int32 i = 0; i < grid->TableStyles->Count; i++ ) - { - myTableStyle = grid->TableStyles[ i ]; - myColumns = myTableStyle->GridColumnStyles; - - /* Iterate through the collection and print each - object's type and width. */ - DataGridColumnStyle^ dgCol; - for ( __int32 j = 0; j < myColumns->Count; j++ ) - { - dgCol = myColumns[ j ]; - Console::WriteLine( dgCol->MappingName ); - Console::WriteLine( dgCol->GetType()->ToString() ); - Console::WriteLine( dgCol->Width ); - - } - - } - } - - // -}; - -int main() -{ - Form1^ f = gcnew Form1; - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp deleted file mode 100644 index 973aec177db..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - -private: - - // - void AddStyleRange() - { - - // Create two DataGridColumnStyle objects. - DataGridColumnStyle^ col1 = gcnew DataGridTextBoxColumn; - col1->MappingName = "FirstName"; - DataGridColumnStyle^ col2 = gcnew DataGridBoolColumn; - col2->MappingName = "Current"; - - // Create an array and use AddRange to add to collection. - array^cols = {col1,col2}; - dataGrid1->TableStyles[ 0 ]->GridColumnStyles->AddRange( cols ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp deleted file mode 100644 index 66f63a9ce57..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ dataSet1; - - // -private: - void AddHandler() - { - GridColumnStylesCollection^ myGridColumns; - myGridColumns = dataGrid1->TableStyles[ 0 ]->GridColumnStyles; - - // Add the handler. - myGridColumns->CollectionChanged += gcnew CollectionChangeEventHandler( this, &Form1::GridCollection_Changed ); - } - - void GridCollection_Changed( Object^ sender, CollectionChangeEventArgs^ /*e*/ ) - { - GridColumnStylesCollection^ myGridColumns; - myGridColumns = dynamic_cast(sender); - Console::WriteLine( myGridColumns->Count ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp deleted file mode 100644 index cbe3771d0e9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void ClearAndAdd() - { - GridTableStylesCollection^ gts = dataGrid1->TableStyles; - gts->Clear(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp deleted file mode 100644 index 8725cab059a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - - // -private: - void AddHandler() - { - dataGrid1->TableStyles->CollectionChanged += - gcnew CollectionChangeEventHandler( this, &Form1::Collection_Changed ); - } - - void Collection_Changed( Object^ sender, CollectionChangeEventArgs^ e ) - { - GridTableStylesCollection^ gts = (GridTableStylesCollection^)(sender); - Console::WriteLine( gts->Count ); - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp deleted file mode 100644 index 85d25568234..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -private: - void InitializeMyScrollBar() - { - // Create and initialize an HScrollBar. - HScrollBar^ hScrollBar1 = gcnew HScrollBar; - - // Dock the scroll bar to the bottom of the form. - hScrollBar1->Dock = DockStyle::Bottom; - - // Add the scroll bar to the form. - Controls->Add( hScrollBar1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp deleted file mode 100644 index 6b0ac1b5e2c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -public ref class Form1: public Form -{ -private: - - // - // The specified IDesigner implements IUIService. - System::Drawing::Font^ GetFont( IDesigner^ designer ) - { - System::Drawing::Font^ hostfont; - - // Gets the dialog box font from the host environment. - hostfont = dynamic_cast(dynamic_cast(designer)->Styles[ "DialogFont" ]); - return hostfont; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp deleted file mode 100644 index 94f50b69849..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Label^ label1; - - // -public: - Form1() - { - InitializeComponent(); - this->label1->Text = this->Handle.ToString(); - } - // - -protected: - void InitializeComponent(){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp deleted file mode 100644 index fdd6cb481c6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp +++ /dev/null @@ -1,224 +0,0 @@ -#using -#using -#using - - using namespace System; - using namespace System::Drawing; - using namespace System::ComponentModel; - using namespace System::Windows::Forms; - -// -namespace myImageRotator -#using -#using -#using -{ - using namespace System; - using namespace System::Drawing; - using namespace System::ComponentModel; - using namespace System::Windows::Forms; - - public ref class Form1 : public System::Windows::Forms::Form - { - private: - System::ComponentModel::IContainer^ components; - private: - System::Windows::Forms::ListBox^ listBox1; - private: - System::Windows::Forms::Label^ label3; - private: - System::Windows::Forms::Button^ button1; - private: - System::Windows::Forms::Button^ button2; - private: - System::Windows::Forms::Button^ button3; - private: - System::Windows::Forms::Button^ button4; - private: - System::Windows::Forms::PictureBox^ pictureBox1; - private: - System::Windows::Forms::ImageList^ imageList1; - private: - System::Windows::Forms::OpenFileDialog^ openFileDialog1; - protected: - Graphics^ myGraphics; - private: - System::Windows::Forms::Panel^ panel1; - private: - System::Windows::Forms::Label^ label5; - private: - int currentImage; - - public: - Form1() - { - InitializeComponent(); - imageList1 = gcnew ImageList () ; - currentImage = 0; - - // The default image size is 16 x 16, which sets up a larger - // image size. - imageList1->ImageSize = System::Drawing::Size(255,255); - imageList1->TransparentColor = Color::White; - - // Assigns the graphics object to use in the draw options. - myGraphics = Graphics::FromHwnd(panel1->Handle); - } - - private: - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container(); - this->listBox1 = gcnew System::Windows::Forms::ListBox(); - this->label3 = gcnew System::Windows::Forms::Label(); - this->button1 = gcnew System::Windows::Forms::Button(); - this->button2 = gcnew System::Windows::Forms::Button(); - this->button3 = gcnew System::Windows::Forms::Button(); - this->button4 = gcnew System::Windows::Forms::Button(); - this->pictureBox1 = gcnew System::Windows::Forms::PictureBox(); - this->imageList1 = gcnew System::Windows::Forms::ImageList(this->components); - this->openFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog(); - this->panel1 = gcnew System::Windows::Forms::Panel(); - this->label5 = gcnew System::Windows::Forms::Label(); - this->SuspendLayout(); - - this->listBox1->Location = System::Drawing::Point(16, 16); - this->listBox1->Size = System::Drawing::Size(400, 95); - this->listBox1->TabIndex = 0; - - this->label3->Location = System::Drawing::Point(24, 168); - this->label3->Text = "label3"; - - this->button1->Location = System::Drawing::Point(96, 128); - this->button1->Size = System::Drawing::Size(104, 23); - this->button1->Text = "Show Next Image"; - this->button1->Click += gcnew System::EventHandler(this,&Form1::button1_Click); - - this->button2->Location = System::Drawing::Point(208, 128); - this->button2->Size = System::Drawing::Size(104, 23); - this->button2->Text = "Remove Image"; - this->button2->Click += gcnew System::EventHandler(this,&Form1::button2_Click); - - this->button3->Location = System::Drawing::Point(320, 128); - this->button3->Text = "Clear List"; - this->button3->Click += gcnew System::EventHandler(this,&Form1::button3_Click); - - this->button4->Location = System::Drawing::Point(16, 128); - this->button4->Text = "Open Image"; - this->button4->Click += gcnew System::EventHandler(this,&Form1::button4_Click); - - this->pictureBox1->Location = System::Drawing::Point(328, 232); - this->pictureBox1->Size = System::Drawing::Size(336, 192); - - this->imageList1->ImageSize = System::Drawing::Size(16, 16); - this->imageList1->TransparentColor = System::Drawing::Color::Transparent; - - this->panel1->Location = System::Drawing::Point(8, 240); - this->panel1->Size = System::Drawing::Size(296, 184); - - this->label5->Location = System::Drawing::Point(168, 168); - this->label5->Size = System::Drawing::Size(312, 40); - this->label5->Text = "label5"; - - this->ClientSize = System::Drawing::Size(672, 461); - this->Controls->Add(this->label5); - this->Controls->Add(this->panel1); - this->Controls->Add(this->pictureBox1); - this->Controls->Add(this->button4); - this->Controls->Add(this->button3); - this->Controls->Add(this->button2); - this->Controls->Add(this->button1); - this->Controls->Add(this->label3); - this->Controls->Add(this->listBox1); - this->ResumeLayout(false); - } - - // Display the image. - private: - void button1_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) - { - if(!imageList1->Images->Empty) - { - if(imageList1->Images->Count-1 > currentImage) - { - currentImage++; - } - else - { - currentImage=0; - } - panel1->Refresh(); - - // Draw the image in the panel. - imageList1->Draw(myGraphics,10,10,currentImage); - - // Show the image in the PictureBox. - pictureBox1->Image = imageList1->Images[currentImage]; - label3->Text = "Current image is " + currentImage ; - listBox1->SelectedIndex = currentImage; - // label5->Text = "Image is " + listBox1->Text ; - label5->Text = String::Concat("Image is ",listBox1->Text); - } - } - - // Remove the image. - private: - void button2_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) - { - imageList1->Images->RemoveAt(listBox1->SelectedIndex); - listBox1->Items->Remove(listBox1->SelectedItem); - } - - // Clear all images. - private: - void button3_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) - { - imageList1->Images->Clear(); - listBox1->Items->Clear(); - } - - // Find an image. - private: - void button4_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) - { - openFileDialog1->Multiselect = true ; - if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK) - { - if (openFileDialog1->FileNames != nullptr) - { - for(int i =0 ; i < openFileDialog1->FileNames->Length ; i++ ) - { - addImage(openFileDialog1->FileNames[i]); - } - } - else - addImage(openFileDialog1->FileName); - } - - } - - private: - void addImage(String^ imageToLoad) - { - if (imageToLoad != "") - { - imageList1->Images->Add(Image::FromFile(imageToLoad)); - listBox1->BeginUpdate(); - listBox1->Items->Add(imageToLoad); - listBox1->EndUpdate(); - } - } - - public: - static void Main(array^ /*args*/) - { - Application::Run(gcnew Form1()); - } - }; - -} -[STAThreadAttribute] -int main(){ - myImageRotator::Form1::Main(nullptr); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp deleted file mode 100644 index a8c4af56b35..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void GetLanguages() - { - // Gets the list of installed languages. - for each ( InputLanguage^ lang in InputLanguage::InstalledInputLanguages ) - { - textBox1->Text = String::Concat( textBox1->Text, lang->Culture->EnglishName, "\n" ); - } - } - // - - // -public: - void SetNewCurrentLanguage() - { - - // Gets the default, and current languages. - InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; - InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; - textBox1->Text = String::Format( "Current input language is: {0}\nDefault input language is: {1}\n", - myCurrentLanguage->Culture->EnglishName, myDefaultLanguage->Culture->EnglishName ); - - // Changes the current input language to the default, and prints the new current language. - InputLanguage::CurrentInputLanguage = myDefaultLanguage; - textBox1->Text = String::Format( "{0}Current input language is now: {1}", - textBox1->Text, myDefaultLanguage->Culture->EnglishName ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp deleted file mode 100644 index f188405c0fb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void MyCulture() - { - // Gets the current input language. - InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; - - // Gets the culture for the language and prints it. - CultureInfo^ myCultureInfo = myCurrentLanguage->Culture; - textBox1->Text = myCultureInfo->EnglishName; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp deleted file mode 100644 index 95851dd02a5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void MyCurrentInputLanguage() - { - // Gets the current input language and prints it in a text box. - InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; - textBox1->Text = String::Format( "Current input language is: {0}", - myCurrentLanguage->Culture->EnglishName ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp deleted file mode 100644 index 229ddd98615..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void MyDefaultInputLanguage() - { - // Gets the default input language and prints it in a text box. - InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; - textBox1->Text = String::Format( "Default input language is: {0}", - myDefaultLanguage->Culture->EnglishName ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp deleted file mode 100644 index 57143dea445..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void SetNewCurrentLanguage() - { - // Gets the default, and current languages. - InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; - InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; - textBox1->Text = String::Format( "{0}Current input language is: {1}\n", - myCurrentLanguage->Culture->EnglishName, myDefaultLanguage->Culture->EnglishName ); - - //Print the new current input language. - InputLanguage^ myCurrentLanguage2 = InputLanguage::CurrentInputLanguage; - textBox1->Text = String::Format( "{0}New current input language is: {1}", - textBox1->Text, myCurrentLanguage2->Culture->EnglishName ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp deleted file mode 100644 index 1f9f2ca8dfa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void MyHandle() - { - // Gets the current input language. - InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; - - // Gets a handle for the language and prints the number. - IntPtr myHandle = myCurrentLanguage->Handle; - textBox1->Text = String::Format( "The handle number is: {0}", myHandle ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp deleted file mode 100644 index 109b82b0061..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void GetLanguages() - { - // Gets the list of installed languages. - for each ( InputLanguage^ lang in InputLanguage::InstalledInputLanguages ) - { - textBox1->Text = String::Concat( textBox1->Text, lang->Culture->EnglishName, "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp deleted file mode 100644 index 77d24b10b47..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void MyLayoutName() - { - // Gets the current input language. - InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; - - if ( myCurrentLanguage != nullptr ) - { - textBox1->Text = String::Format( "Layout: {0}", myCurrentLanguage->LayoutName ); - } - else - { - textBox1->Text = "There is no current language"; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp deleted file mode 100644 index 066abcf0e38..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// -public ref class myKeyPressClass -{ -private: - static long keyPressCount = 0; - static long backspacePressed = 0; - static long returnPressed = 0; - static long escPressed = 0; - TextBox^ textBox1; - void myKeyCounter( Object^ sender, KeyPressEventArgs^ ex ) - { - switch ( ex->KeyChar ) - { - // Counts the backspaces. - case '\b': - backspacePressed = backspacePressed + 1; - break; - - // Counts the ENTER keys. - case '\r': - returnPressed = returnPressed + 1; - break; - - // Counts the ESC keys. - case (char)27: - escPressed = escPressed + 1; - break; - - // Counts all other keys. - default: - keyPressCount = keyPressCount + 1; - break; - } - textBox1->Text = String::Concat( - backspacePressed, " backspaces pressed\r\n", - escPressed, " escapes pressed\r\n", - returnPressed, " returns pressed\r\n", - keyPressCount, " other keys pressed\r\n" ); - ex->Handled = true; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp deleted file mode 100644 index 85ab9f807e5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - ref class myKeyPressClass - { - internal: - void myKeyCounter( Object^ sender, KeyPressEventArgs^ ex ){} - }; - - TextBox^ textBox1; - - // -public: - myKeyPressClass^ myKeyPressHandler; - - Form1() - { - myKeyPressHandler = gcnew myKeyPressClass; - - InitializeComponent(); - - textBox1->KeyPress += gcnew KeyPressEventHandler( - myKeyPressHandler, &myKeyPressClass::myKeyCounter ); - } - // - -private: - void InitializeComponent(){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp deleted file mode 100644 index 6caa4a34867..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ImageList^ imageList1; - - // -public: - void CreateMyLabel() - { - // Create an instance of a Label. - Label^ label1 = gcnew Label; - - // Set the border to a three-dimensional border. - label1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - // Set the ImageList to use for displaying an image. - label1->ImageList = imageList1; - // Use the second image in imageList1. - label1->ImageIndex = 1; - // Align the image to the top left corner. - label1->ImageAlign = ContentAlignment::TopLeft; - - // Specify that the text can display mnemonic characters. - label1->UseMnemonic = true; - // Set the text of the control and specify a mnemonic character. - label1->Text = "First &Name:"; - - /* Set the size of the control based on the PreferredHeight and PreferredWidth values. */ - label1->Size = System::Drawing::Size( label1->PreferredWidth, label1->PreferredHeight ); - - //...Code to add the control to the form... - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp deleted file mode 100644 index 4b31e6628bc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// -// Adds the LicenseProviderAttribute to the control. - -[LicenseProvider(LicFileLicenseProvider::typeid)] -public ref class MyControl: public Control -{ - // Creates a new, null license. -private: - License^ license; - -public: - MyControl() - { - - // Adds Validate to the control's constructor. - license = LicenseManager::Validate( MyControl::typeid, this ); - - // Insert code to perform other instance creation tasks here. - } - -public: - ~MyControl() - { - if ( license != nullptr ) - { - delete license; - license = nullptr; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp deleted file mode 100644 index b3f6a89eee9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// -[LicenseProvider(LicFileLicenseProvider::typeid)] -ref class MyControl: public Control -{ -protected: - - // Insert code here. - ~MyControl() - { - /* All components must dispose of the licenses they grant. - * Insert code here to dispose of the license. */ - } -}; -// - -// -int main() -{ - // Creates a new component. - MyControl^ myNewControl = gcnew MyControl; - - // Gets the attributes for the component. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewControl ); - - /* Prints the name of the license provider by retrieving the LicenseProviderAttribute - * from the AttributeCollection. */ - LicenseProviderAttribute^ myAttribute = dynamic_cast(attributes[ LicenseProviderAttribute::typeid ]); - Console::WriteLine( "The license provider for this class is: {0}", myAttribute->LicenseProvider ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp deleted file mode 100644 index b45711df95d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -private: - - // - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Create an instance of the ListBox. - ListBox^ listBox1 = gcnew ListBox; - - // Set the size and location of the ListBox. - listBox1->Size = System::Drawing::Size( 200, 100 ); - listBox1->Location = System::Drawing::Point( 10, 10 ); - - // Add the ListBox to the form. - this->Controls->Add( listBox1 ); - - // Set the ListBox to display items in multiple columns. - listBox1->MultiColumn = true; - - // Set the selection mode to multiple and extended. - listBox1->SelectionMode = SelectionMode::MultiExtended; - - // Shutdown the painting of the ListBox as items are added. - listBox1->BeginUpdate(); - - // Loop through and add 50 items to the ListBox. - for ( int x = 1; x <= 50; x++ ) - { - listBox1->Items->Add( String::Format( "Item {0}", x ) ); - - } - listBox1->EndUpdate(); - - // Select three items from the ListBox. - listBox1->SetSelected( 1, true ); - listBox1->SetSelected( 3, true ); - listBox1->SetSelected( 5, true ); - - #if defined(DEBUG) - // Display the second selected item in the ListBox to the console. - System::Diagnostics::Debug::WriteLine( listBox1->SelectedItems[ 1 ] ); - - // Display the index of the first selected item in the ListBox. - System::Diagnostics::Debug::WriteLine( listBox1->SelectedIndices[ 0 ] ); - #endif - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp deleted file mode 100644 index 91d6bedb44d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ListBox^ listBox1; - -public: - - // - void AddToMyListBox() - { - // Stop the ListBox from drawing while items are added. - listBox1->BeginUpdate(); - - // Loop through and add five thousand new items. - for ( int x = 1; x < 5000; x++ ) - { - listBox1->Items->Add( String::Format( "Item {0}", x ) ); - } - listBox1->EndUpdate(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp deleted file mode 100644 index ccc1027a41c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -#using - -using namespace System; -using namespace System::ComponentModel; -public ref class Class1 -{ - // -public: - property int MyProperty - { - [Localizable(true)] - int get() - { - // Insert code here. - return 0; - } - - void set( int value ) - { - // Insert code here. - } - } - // - - void Method1() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the property needs to be localized. - LocalizableAttribute^ myAttribute = dynamic_cast(attributes[ LocalizableAttribute::typeid ]); - if ( myAttribute->IsLocalizable ) - { - // Insert code here. - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp deleted file mode 100644 index f60ad20e72c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the property needs to be localized. - LocalizableAttribute^ myAttribute = dynamic_cast(attributes[ LocalizableAttribute::typeid ]); - if ( myAttribute->IsLocalizable ) - { - // Insert code here. - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp deleted file mode 100644 index 9a5586529ce..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -public: - - property int MyProperty - { - // - [Localizable(true)] - int get() - { - // Insert code here. - return 0; - } - - void set( int value ) - { - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp deleted file mode 100644 index 3e73d7ec1ca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MainMenu^ mainMenu1; - -public: - - // - void CloneMyMenu() - { - // Determine if mainMenu1 is currently hosted on the form. - if ( mainMenu1->GetForm() != nullptr ) - { - // Create a copy of the MainMenu that is hosted on the form. - MainMenu^ mainMenu2 = mainMenu1->CloneMenu(); - - // Set the RightToLeft property for mainMenu2. - mainMenu2->RightToLeft = ::RightToLeft::Yes; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp deleted file mode 100644 index b6afcc67e31..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - - // - void CreateMyMainMenu() - { - // Create an empty MainMenu. - MainMenu^ mainMenu1 = gcnew MainMenu; - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - menuItem1->Text = "File"; - menuItem2->Text = "Edit"; - - // Add two MenuItem objects to the MainMenu. - mainMenu1->MenuItems->Add( menuItem1 ); - mainMenu1->MenuItems->Add( menuItem2 ); - - // Bind the MainMenu to Form1. - Menu = mainMenu1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp deleted file mode 100644 index a85380ec9cf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - - // - void CreateMyMainMenu() - { - // Create two MenuItem objects and assign to array. - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - menuItem1->Text = "&File"; - menuItem2->Text = "&Edit"; - - // Create a MainMenu and assign MenuItem objects. - array^temp2 = {menuItem1,menuItem2}; - MainMenu^ mainMenu1 = gcnew MainMenu( temp2 ); - - // Bind the MainMenu to Form1. - Menu = mainMenu1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp deleted file mode 100644 index 3e73d7ec1ca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MainMenu^ mainMenu1; - -public: - - // - void CloneMyMenu() - { - // Determine if mainMenu1 is currently hosted on the form. - if ( mainMenu1->GetForm() != nullptr ) - { - // Create a copy of the MainMenu that is hosted on the form. - MainMenu^ mainMenu2 = mainMenu1->CloneMenu(); - - // Set the RightToLeft property for mainMenu2. - mainMenu2->RightToLeft = ::RightToLeft::Yes; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp deleted file mode 100644 index 665a50ccccf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; -public ref class Sample: public Form -{ -protected: - StreamReader^ streamToPrint; - String^ filePath; - String^ printer; - System::Drawing::Font^ printFont; - -public: - - // - void Printing() - { - try - { - - /* This assumes that a variable of type string, named filePath, - has been set to the path of the file to print. */ - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew System::Drawing::Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - - /* This assumes that a method, named pd_PrintPage, has been - defined. pd_PrintPage handles the PrintPage event. */ - pd->PrintPage += gcnew PrintPageEventHandler( this, &Sample::pd_PrintPage ); - - /* This assumes that a variable of type string, named - printer, has been set to the printer's name. */ - pd->PrinterSettings->PrinterName = printer; - - // Create a new instance of Margins with one inch margins. - Margins^ margins = gcnew Margins( 100,100,100,100 ); - pd->DefaultPageSettings->Margins = margins; - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - - } - catch ( Exception^ ex ) - { - MessageBox::Show( String::Concat( "An error occurred printing the file - ", ex->Message ) ); - } - - } - - - // -private: - void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ /*e*/ ){} - -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp deleted file mode 100644 index ad5c8dd3c9c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class Sample: public Form -{ -protected: - StreamReader^ streamToPrint; - String^ filePath; - String^ printer; - System::Drawing::Font^ printFont; - -public: - - // - void Printing() - { - try - { - - /* This assumes that a variable of type string, named filePath, - has been set to the path of the file to print. */ - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew System::Drawing::Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - - /* This assumes that a method, named pd_PrintPage, has been - defined. pd_PrintPage handles the PrintPage event. */ - pd->PrintPage += gcnew PrintPageEventHandler( this, &Sample::pd_PrintPage ); - - /* This assumes that a variable of type string, named - printer, has been set to the printer's name. */ - pd->PrinterSettings->PrinterName = printer; - - // Set the left and right margins to 1 inch. - pd->DefaultPageSettings->Margins->Left = 100; - pd->DefaultPageSettings->Margins->Right = 100; - - // Set the top and bottom margins to 1.5 inches. - pd->DefaultPageSettings->Margins->Top = 150; - pd->DefaultPageSettings->Margins->Bottom = 150; - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - - } - catch ( Exception^ ex ) - { - MessageBox::Show( String::Concat( "An error occurred printing the file - ", ex->Message ) ); - } - - } - // - -private: - void pd_PrintPage( Object^, PrintPageEventArgs^ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp deleted file mode 100644 index c36307e6974..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MainMenu^ mainMenu1; - MenuItem^ menuItem1; - MenuItem^ menuItem2; - MenuItem^ menuItem3; - MenuItem^ menuItem4; - - // -public: - void CreateMyMenu() - { - // Set the caption for the top-level menu item. - menuItem1->Text = "Edit"; - // Set the caption for the first submenu. - menuItem2->Text = "Font Size"; - // Set the caption for menuItem2's first submenu. - menuItem3->Text = "Small"; - // Set the checked property to true since this is the default value. - menuItem3->Checked = true; - // Define a shortcut key combination for the menu item. - menuItem3->Shortcut = Shortcut::CtrlS; - // Set the caption of the second sub menu item of menuItem2. - menuItem4->Text = "Large"; - // Define a shortcut key combination for the menu item. - menuItem4->Shortcut = Shortcut::CtrlL; - // Set the index of the menu item so it is placed below the first submenu item. - menuItem4->Index = 1; - // Add menuItem3 and menuItem4 to menuItem2's list of menu items. - menuItem2->MenuItems->Add( menuItem3 ); - menuItem2->MenuItems->Add( menuItem4 ); - // Add menuItem2 to menuItem1's list of menu items. - menuItem1->MenuItems->Add( menuItem2 ); - // Add menuItem1 to the MainMenu for displaying. - mainMenu1->MenuItems->Add( menuItem1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp deleted file mode 100644 index f1b7ca62e9e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void InitializeMyMainMenu() - { - // Create the MainMenu. - MainMenu^ mainMenu1 = gcnew MainMenu; - - /* Use the MenuItems property to call the Add method - to add two new MenuItem objects to the MainMenu. */ - mainMenu1->MenuItems->Add( "&File" ); - mainMenu1->MenuItems->Add( "&Edit" ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp deleted file mode 100644 index f44b6225932..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void InitializeMyMainMenu() - { - // Create the MainMenu. - MainMenu^ mainMenu1 = gcnew MainMenu; - - /* Use the MenuItems property to call the Add method - to add two new MenuItem objects to the MainMenu. */ - mainMenu1->MenuItems->Add( "&File" ); - mainMenu1->MenuItems->Add( "&Edit", gcnew EventHandler( - this, &Form1::menuItem2_Click ) ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - -private: - void menuItem2_Click( System::Object^ sender, System::EventArgs^ e ) - { - // Insert code to handle Click event. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp deleted file mode 100644 index 7e5ac4a71c5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void InitializeMyMainMenu() - { - // Create the MainMenu and the MenuItem to add. - MainMenu^ mainMenu1 = gcnew MainMenu; - MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); - - /* Use the MenuItems property to call the Add method - to add the MenuItem to mainMenu1 at specific index. */ - mainMenu1->MenuItems->Add( 0, menuItem1 ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp deleted file mode 100644 index e08ebf1f4eb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - MenuItem^ menuItem2; - System::Windows::Forms::ContextMenu^ contextMenu1; - - // -private: - void CopyMyMenus() - { - // Create empty array to store MenuItem objects. - array^ myItems = gcnew array( - menuItem1->MenuItems->Count + menuItem2->MenuItems->Count ); - - // Copy elements of the first MenuItem collection to array. - menuItem1->MenuItems->CopyTo( myItems, 0 ); - // Copy elements of the second MenuItem collection, after the first set. - menuItem2->MenuItems->CopyTo( myItems, myItems->Length ); - - // Add the array to the menu item collection of the ContextMenu. - contextMenu1->MenuItems->AddRange( myItems ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp deleted file mode 100644 index 24d551c4132..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void InitializeMyMainMenu() - { - // Create the MainMenu and the MenuItem to add. - MainMenu^ mainMenu1 = gcnew MainMenu; - MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); - - /* Use the MenuItems property to call the Add method - to add the MenuItem to the MainMenu menu item collection. */ - mainMenu1->MenuItems->Add( menuItem1 ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp deleted file mode 100644 index b6a6d5f0fd7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMenus() - { - // Create three top-level menu items. - MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); - MenuItem^ menuItem2 = gcnew MenuItem( "&New" ); - MenuItem^ menuItem3 = gcnew MenuItem( "&Open" ); - // Set the BarBreak property to display horizontally. - menuItem2->BarBreak = true; - menuItem3->BarBreak = true; - // Add menuItem2 and menuItem3 to the menuItem1's list of menu items. - menuItem1->MenuItems->Add( menuItem2 ); - menuItem1->MenuItems->Add( menuItem3 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp deleted file mode 100644 index 1bcfed6dad4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMenus() - { - // Create three top-level menu items. - MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); - MenuItem^ menuItem2 = gcnew MenuItem( "&Options" ); - MenuItem^ menuItem3 = gcnew MenuItem( "&Edit" ); - // Place the "Edit" menu on a new line in the menu bar. - menuItem3->Break = true; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp deleted file mode 100644 index 19b8accd843..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - MenuItem^ menuItemBlue; - MenuItem^ menuItemRed; - MenuItem^ menuItemGreen; - - // -private: - // The following event handler would be connected to three menu items. - void MyMenuClick( Object^ sender, EventArgs^ e ) - { - // Determine if clicked menu item is the Blue menu item. - if ( sender == menuItemBlue ) - { - // Set the checkmark for the menuItemBlue menu item. - menuItemBlue->Checked = true; - // Uncheck the menuItemRed and menuItemGreen menu items. - menuItemRed->Checked = false; - menuItemGreen->Checked = false; - // Set the color of the text in the TextBox control to Blue. - textBox1->ForeColor = Color::Blue; - } - else if ( sender == menuItemRed ) - { - - // Set the checkmark for the menuItemRed menu item. - menuItemRed->Checked = true; - // Uncheck the menuItemBlue and menuItemGreen menu items. - menuItemBlue->Checked = false; - menuItemGreen->Checked = false; - // Set the color of the text in the TextBox control to Red. - textBox1->ForeColor = Color::Red; - } - else - { - // Set the checkmark for the menuItemGreen. - menuItemGreen->Checked = true; - // Uncheck the menuItemRed and menuItemBlue menu items. - menuItemBlue->Checked = false; - menuItemRed->Checked = false; - // Set the color of the text in the TextBox control to Blue. - textBox1->ForeColor = Color::Green; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp deleted file mode 100644 index d66c37b17d8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - System::Windows::Forms::ContextMenu^ contextMenu1; - - // -public: - void CloneMyMenu() - { - // Clone the menu item and add it to the collection for the shortcut menu. - contextMenu1->MenuItems->Add( menuItem1->CloneMenu() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp deleted file mode 100644 index 4aee89c55e9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - System::Windows::Forms::ContextMenu^ contextMenu1; - - // -public: - void CloneMyMenu() - { - // Clone the existing MenuItem into the new MenuItem. - MenuItem^ tempMenuItem = menuItem1->CloneMenu(); - - // Assign the cloned MenuItem to the ContextMenu. - contextMenu1->MenuItems->Add( tempMenuItem ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp deleted file mode 100644 index 82efaf99607..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyMenus() - { - MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); - MenuItem^ menuItem2 = gcnew MenuItem( "&New" ); - MenuItem^ menuItem3 = gcnew MenuItem( "&Open" ); - // Make menuItem2 the default menu item. - menuItem2->DefaultItem = true; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp deleted file mode 100644 index 9ae4fd0aa8a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - MenuItem^ menuItem2; - - // -public: - void SwitchMyMenuItems() - { - // Move menuItem1 down one position in the menu order. - menuItem1->Index = menuItem1->Index + 1; - // Move menuItem2 up one position in the menu order. - menuItem2->Index = menuItem2->Index - 1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp deleted file mode 100644 index b8f96a7d3a5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem2; - -public: - - // - void DisableMyChildMenus() - { - - // Determine if menuItem2 is a parent menu. - if ( menuItem2->IsParent) - { - - // Loop through all the submenus. - for ( int i = 0; i < menuItem2->MenuItems->Count; i++ ) - { - - // Disable all of the submenus of menuItem2. - menuItem2->MenuItems[ i ]->Enabled = false; - - } - } - } - - // -}; \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp deleted file mode 100644 index 011cfaf99e8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void SetMDIList() - { - // Create the MenuItem to be used to display an MDI list. - MenuItem^ menuItem1 = gcnew MenuItem; - // Set this menu item to be used as an MDI list. - menuItem1->MdiList = true; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp deleted file mode 100644 index 947494c9c18..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMenu() - { - // Create an empty menu item object. - MenuItem^ menuItem1 = gcnew MenuItem; - // Intialize the menu item using the parameterless version of the constructor. - // Set the caption of the menu item. - menuItem1->Text = "&File"; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp deleted file mode 100644 index c49a0b15784..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - - // -public: - void CreateMyMenus() - { - // Create an instance of a MenuItem with a specified caption. - menuItem1 = gcnew MenuItem( "&File" ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp deleted file mode 100644 index e1ce22509f0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMenuItem() - { - // Create an instance of MenuItem with caption and an event handler - MenuItem^ menuItem1 = gcnew MenuItem( "&New",gcnew System::EventHandler( - this, &Form1::MenuItem1_Click ) ); - } - -private: - // This method is an event handler for menuItem1 to use when connecting its event handler. - void MenuItem1_Click( Object^ sender, System::EventArgs^ e ) - { - // Code goes here that handles the Click event. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp deleted file mode 100644 index 7c8928f415a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyMenuItem() - { - // Create a MenuItem with caption, shortcut key, and an event handler - // specified. - MenuItem^ MenuItem1 = gcnew MenuItem( "&New", - gcnew System::EventHandler( this, &Form1::MenuItem1_Click ), Shortcut::CtrlL ); - } - -private: - // The following method is an event handler for menuItem1 to use when - // connecting the event handler. - void MenuItem1_Click( Object^ sender, EventArgs^ e ) - { - // Code goes here that handles the Click event. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp deleted file mode 100644 index a676ece6eed..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMenuItem() - { - // submenu item array. - array^ subMenus = gcnew array(3); - // Create three menu items to add to the submenu item array. - MenuItem^ subMenuItem1 = gcnew MenuItem( "Red" ); - MenuItem^ subMenuItem2 = gcnew MenuItem( "Blue" ); - MenuItem^ subMenuItem3 = gcnew MenuItem( "Green" ); - // Add the submenu items to the array. - subMenus[ 0 ] = subMenuItem1; - subMenus[ 1 ] = subMenuItem2; - subMenus[ 2 ] = subMenuItem3; - // Create an instance of a MenuItem with caption and an array of submenu - // items specified. - MenuItem^ MenuItem1 = gcnew MenuItem( "&Colors",subMenus ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp deleted file mode 100644 index 9b1ea1c0080..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyMenuItem() - { - // Submenu item array. - array^ subMenus = gcnew array(3); - // Create three menu items to add to the submenu item array. - MenuItem^ subMenuItem1 = gcnew MenuItem( "Red" ); - MenuItem^ subMenuItem2 = gcnew MenuItem( "Blue" ); - MenuItem^ subMenuItem3 = gcnew MenuItem( "Green" ); - - // Add the submenu items to the array. - subMenus[ 0 ] = subMenuItem1; - subMenus[ 1 ] = subMenuItem2; - subMenus[ 2 ] = subMenuItem3; - /* Create a MenuItem with caption, shortcut key, - a Click, Popup, and Select event handler, merge type and order, and an - array of submenu items specified. - */ - MenuItem^ menuItem1 = gcnew MenuItem( MenuMerge::Add, 0, - Shortcut::CtrlShiftC, "&Colors", - gcnew EventHandler( this, &Form1::MenuItem1_Click ), - gcnew EventHandler( this, &Form1::MenuItem1_Popup ), - gcnew EventHandler( this, &Form1::MenuItem1_Select ), subMenus ); - } - -private: - // The following method is an event handler for menuItem1 to use when connecting the Click event. - void MenuItem1_Click( Object^ sender, EventArgs^ e ) - { - // Code goes here that handles the Click event. - } - - // The following method is an event handler for menuItem1 to use when connecting the Popup event. - void MenuItem1_Popup( Object^ sender, EventArgs^ e ) - { - // Code goes here that handles the Click event. - } - - // The following method is an event handler for menuItem1 to use when connecting the Select event - void MenuItem1_Select( Object^ sender, EventArgs^ e ) - { - // Code goes here that handles the Click event. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp deleted file mode 100644 index 814177db384..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - MenuItem^ menuItem2; - System::Windows::Forms::ContextMenu^ contextMenu1; - - // -private: - void MergeMyMenus() - { - // Set the merge type to merge the items from both top menu items. - menuItem1->MergeType = MenuMerge::MergeItems; - menuItem2->MergeType = MenuMerge::MergeItems; - // Create a copy of my menu item. - MenuItem^ tempMenuItem = gcnew MenuItem; - // Create a copy of menuItem1 before doing the merge. - tempMenuItem = menuItem1->CloneMenu(); - // Merge menuItem1's copy with a clone of menuItem2 - tempMenuItem->MergeMenu( menuItem2->CloneMenu() ); - - // Add the merged menu to the ContextMenu control. - contextMenu1->MenuItems->Add( tempMenuItem ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp deleted file mode 100644 index 9f38276d662..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - - // -public: - void InitMyFileMenu() - { - // Set the MergeType to Add so that the menu item is added to the merged menu. - menuItem1->MergeType = MenuMerge::Add; - // Set the MergeOrder to 1 so that this menu item is placed lower in the merged menu order. - menuItem1->MergeOrder = 1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp deleted file mode 100644 index 434f33cd25f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - MenuItem^ menuItemRed; - MenuItem^ menuItemBlue; - MenuItem^ menuItemGreen; - - // -public: - // This method is called from the constructor of the form to set up the menu items. - void ConfigureMyMenus() - { - /* Set all of these menu items to Radio-Button check marks so the user can see - that only one color can be selected at a time. */ - menuItemRed->RadioCheck = true; - menuItemBlue->RadioCheck = true; - menuItemGreen->RadioCheck = true; - } - -private: - // The following event handler would be connected to three menu items. - void MyMenuClick( Object^ sender, EventArgs^ e ) - { - if ( sender == menuItemBlue ) - { - // Set the checkmark for the menuItemBlue menu item. - menuItemBlue->Checked = true; - // Uncheck the menuItemRed and menuItemGreen menu items. - menuItemRed->Checked = false; - menuItemGreen->Checked = false; - // Set the color of the text in the TextBox control to Blue. - textBox1->ForeColor = Color::Blue; - } - else if ( sender == menuItemRed ) - { - // Set the checkmark for the menuItemRed menu item. - menuItemRed->Checked = true; - // Uncheck the menuItemBlue and menuItemGreen menu items. - menuItemBlue->Checked = false; - menuItemGreen->Checked = false; - // Set the color of the text in the TextBox control to Red. - textBox1->ForeColor = Color::Red; - } - else - { - // Set the checkmark for the menuItemGreen menu item. - menuItemGreen->Checked = true; - // Uncheck the menuItemRed and menuItemGreen menu items. - menuItemBlue->Checked = false; - menuItemRed->Checked = false; - // Set the color of the text in the TextBox control to Blue. - textBox1->ForeColor = Color::Green; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp deleted file mode 100644 index e4919f227e1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MenuItem^ menuItem1; - - // -public: - void SetupMyMenuItem() - { - // Set the caption for the menu item. - menuItem1->Text = "&New"; - // Assign a shortcut key. - menuItem1->Shortcut = Shortcut::CtrlN; - // Make the menu item visible. - menuItem1->Visible = true; - // Display the shortcut key combination. - menuItem1->ShowShortcut = true; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp deleted file mode 100644 index c524e75c988..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ - // -public: - [MergableProperty(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int value ) - { - // Insert code here. - } - } - // - - property int MyProperty2 - { - int get() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the value of the MergablePropertyAttribute is Yes. - if ( attributes[ MergablePropertyAttribute::typeid ]->Equals( MergablePropertyAttribute::Yes ) ) - { - // Insert code here. - } - - // This is another way to see if the property is bindable. - MergablePropertyAttribute^ myAttribute = dynamic_cast(attributes[ MergablePropertyAttribute::typeid ]); - if ( myAttribute->AllowMerge ) - { - // Insert code here. - } - // - return 0; - } - } - - property int MyProperty3 - { - int get() - { - // - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); - if ( attributes[ MergablePropertyAttribute::typeid ]->Equals( MergablePropertyAttribute::Yes ) ) - { - // Insert code here. - } - // - return 0; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp deleted file mode 100644 index 77fd539522a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyPropertyProperty" ]->Attributes; - - // Checks to see if the property is bindable. - MergablePropertyAttribute^ myAttribute = dynamic_cast(attributes[ MergablePropertyAttribute::typeid ]); - if ( myAttribute->AllowMerge ) - { - // Insert code here. - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp deleted file mode 100644 index 04ef313681d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - [MergableProperty(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int value ) - { - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp deleted file mode 100644 index c95d4887380..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void Form1_FormClosing(Object^ sender, FormClosingEventArgs^ e) - { - // If the no button was pressed ... - if ((MessageBox::Show( - "Are you sure that you would like to close the form?", - "Form Closing", MessageBoxButtons::YesNo, - MessageBoxIcon::Question) == DialogResult::No)) - { - // cancel the closure of the form. - e->Cancel = true; - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp deleted file mode 100644 index 99632a33f84..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - NumericUpDown^ numericUpDown1; - - // -public: - void InstantiateMyNumericUpDown() - { - // Create and initialize a NumericUpDown control. - numericUpDown1 = gcnew NumericUpDown; - - // Dock the control to the top of the form. - numericUpDown1->Dock = System::Windows::Forms::DockStyle::Top; - - // Set the Minimum, Maximum, and initial Value. - numericUpDown1->Value = 5; - numericUpDown1->Maximum = 2500; - numericUpDown1->Minimum = -100; - - // Add the NumericUpDown to the Form. - Controls->Add( numericUpDown1 ); - } - -private: - // Check box to toggle decimal places to be displayed. - void checkBox1_Click( Object^ sender, EventArgs^ e ) - { - /* If DecimalPlaces is greater than 0, set them to 0 and round the - current Value; otherwise, set DecimalPlaces to 2 and change the - Increment to 0.25. */ - if ( numericUpDown1->DecimalPlaces > 0 ) - { - numericUpDown1->DecimalPlaces = 0; - numericUpDown1->Value = Decimal::Round( numericUpDown1->Value, 0 ); - } - else - { - numericUpDown1->DecimalPlaces = 2; - numericUpDown1->Increment = Decimal(0.25); - } - } - - // Check box to toggle thousands separators to be displayed. - void checkBox2_Click( Object^ sender, EventArgs^ e ) - { - /* If ThousandsSeparator is true, set it to false; - otherwise, set it to true. */ - if ( numericUpDown1->ThousandsSeparator ) - { - numericUpDown1->ThousandsSeparator = false; - } - else - { - numericUpDown1->ThousandsSeparator = true; - } - } - - // Check box to toggle hexadecimal to be displayed. - void checkBox3_Click( Object^ sender, EventArgs^ e ) - { - /* If Hexadecimal is true, set it to false; - otherwise, set it to true. */ - if ( numericUpDown1->Hexadecimal ) - { - numericUpDown1->Hexadecimal = false; - } - else - { - numericUpDown1->Hexadecimal = true; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp deleted file mode 100644 index e761175bd12..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void LayeredWindows() - { - // Gets the version of the layered windows feature. - Version^ myVersion = OSFeature::Feature->GetVersionPresent( - OSFeature::LayeredWindows ); - - // Prints whether the feature is available. - if ( myVersion != nullptr ) - { - textBox1->Text = "Layered windows feature is installed.\n"; - } - else - { - textBox1->Text = "Layered windows feature is not installed.\n"; - } - - - // This is an alternate way to check whether a feature is present. - if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) ) - { - textBox1->Text = String::Concat( textBox1->Text, - "Again, layered windows feature is installed." ); - } - else - { - textBox1->Text = String::Concat( textBox1->Text, - "Again, layered windows feature is not installed." ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp deleted file mode 100644 index 537c092e9ad..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void LayeredWindows() - { - // Gets the version of the layered windows feature. - Version^ myVersion = OSFeature::Feature->GetVersionPresent( - OSFeature::LayeredWindows ); - - // Prints whether the feature is available. - if ( myVersion != nullptr ) - { - textBox1->Text = "Layered windows feature is installed.\n"; - } - else - { - textBox1->Text = "Layered windows feature is not installed.\n"; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp deleted file mode 100644 index c12ac6cb7bb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void LayeredWindows() - { - // Gets the version of the layered windows feature. - Version^ myVersion = OSFeature::Feature->GetVersionPresent( - OSFeature::LayeredWindows ); - - // Prints whether the feature is available. - if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) ) - { - textBox1->Text = "Layered windows feature is installed."; - } - else - { - textBox1->Text = "Layered windows feature is not installed."; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp deleted file mode 100644 index 967a5941b06..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Stream^ myStream; - OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog; - - openFileDialog1->InitialDirectory = "c:\\"; - openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; - openFileDialog1->FilterIndex = 2; - openFileDialog1->RestoreDirectory = true; - - if ( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK ) - { - if ( (myStream = openFileDialog1->OpenFile()) != nullptr ) - { - // Insert code to read the stream here. - myStream->Close(); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp deleted file mode 100644 index f40c24f472e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Sample -{ -protected: - StreamReader^ streamToPrint; - Font^ printFont; - String^ filePath; - String^ printer; - - // -public: - void Printing() - { - try - { - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( - this, &Sample::pd_PrintPage ); - pd->PrinterSettings->PrinterName = printer; - // Set the page orientation to landscape. - pd->DefaultPageSettings->Landscape = true; - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - -private: - // Method added so sample will compile - void pd_PrintPage( Object^, PrintPageEventArgs^ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp deleted file mode 100644 index a30098eb238..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Sample -{ -protected: - StreamReader^ streamToPrint; - Font^ printFont; - String^ filePath; - String^ printer; - - // -public: - void Printing() - { - try - { - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( - this, &Sample::pd_PrintPage ); - pd->PrinterSettings->PrinterName = printer; - // Create a new instance of Margins with 1-inch margins. - Margins^ margins = gcnew Margins( 100,100,100,100 ); - pd->DefaultPageSettings->Margins = margins; - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - -private: - // Method added so sample will compile - void pd_PrintPage( Object^, PrintPageEventArgs^ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp deleted file mode 100644 index afe25cc74df..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyPanel() - { - Panel^ panel1 = gcnew Panel; - TextBox^ textBox1 = gcnew TextBox; - Label^ label1 = gcnew Label; - - // Initialize the Panel control. - panel1->Location = System::Drawing::Point( 56, 72 ); - panel1->Size = System::Drawing::Size( 264, 152 ); - // Set the Borderstyle for the Panel to three-dimensional. - panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - - // Initialize the Label and TextBox controls. - label1->Location = System::Drawing::Point( 16, 16 ); - label1->Text = "label1"; - label1->Size = System::Drawing::Size( 104, 16 ); - textBox1->Location = System::Drawing::Point( 16, 32 ); - textBox1->Text = ""; - textBox1->Size = System::Drawing::Size( 152, 20 ); - - // Add the Panel control to the form. - this->Controls->Add( panel1 ); - // Add the Label and TextBox controls to the Panel. - panel1->Controls->Add( label1 ); - panel1->Controls->Add( textBox1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp deleted file mode 100644 index c9191c3fd20..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyPanel() - { - Panel^ panel1 = gcnew Panel; - - // Initialize the Panel control. - panel1->Location = Point(56,72); - panel1->Size = System::Drawing::Size( 264, 152 ); - // Set the Borderstyle for the Panel to three-dimensional. - panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp deleted file mode 100644 index a1e2d110670..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - PictureBox^ pictureBox1; - -private: - - // - Bitmap^ MyImage; - -public: - void ShowMyImage( String^ fileToDisplay, int xSize, int ySize ) - { - - // Sets up an image object to be displayed. - if ( MyImage != nullptr ) - { - delete MyImage; - } - - - // Stretches the image to fit the pictureBox. - pictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; - MyImage = gcnew Bitmap( fileToDisplay ); - pictureBox1->ClientSize = System::Drawing::Size( xSize, ySize ); - pictureBox1->Image = dynamic_cast(MyImage); - } - - // -}; - -/* -This code produces the following output: - -Reflection.Parameterinfo - -Mymethodbase = Void mymethod(Int32, System.String ByRef, System.String ByRef) -For parameter # 0, the ParameterType is - System.Int32 -For parameter # 1, the ParameterType is - System.String& -For parameter # 2, the ParameterType is - System.String& -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp deleted file mode 100644 index 5ec287eade6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Data; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class myControllerImplementation: public PrintController{}; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - bool useMyPrintController; - bool wantsStatusDialog; - PrintDocument^ myDocumentPrinter; - - // - void myPrint() - { - if ( useMyPrintController ) - { - myDocumentPrinter->PrintController = gcnew myControllerImplementation; - if ( wantsStatusDialog ) - { - myDocumentPrinter->PrintController = - gcnew PrintControllerWithStatusDialog( myDocumentPrinter->PrintController ); - } - } - myDocumentPrinter->Print(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp deleted file mode 100644 index 944b9fad1ef..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// - -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class PrintingExample: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - System::Windows::Forms::Button^ printButton; - System::Drawing::Font^ printFont; - StreamReader^ streamToPrint; - -public: - PrintingExample() - : Form() - { - - // The Windows Forms Designer requires the following call. - InitializeComponent(); - } - - -private: - - // The Click event is raised when the user clicks the Print button. - void printButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - streamToPrint = gcnew StreamReader( "C:\\My Documents\\MyFile.txt" ); - try - { - printFont = gcnew System::Drawing::Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( this, &PrintingExample::pd_PrintPage ); - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - - } - - - // The PrintPage event is raised for each page to be printed. - void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev ) - { - float linesPerPage = 0; - float yPos = 0; - int count = 0; - float leftMargin = (float)ev->MarginBounds.Left; - float topMargin = (float)ev->MarginBounds.Top; - String^ line = nullptr; - - // Calculate the number of lines per page. - linesPerPage = ev->MarginBounds.Height / printFont->GetHeight( ev->Graphics ); - - // Print each line of the file. - while ( count < linesPerPage && ((line = streamToPrint->ReadLine()) != nullptr) ) - { - yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); - ev->Graphics->DrawString( line, printFont, Brushes::Black, leftMargin, yPos, gcnew StringFormat ); - count++; - } - - - // If more lines exist, print another page. - if ( line != nullptr ) - ev->HasMorePages = true; - else - ev->HasMorePages = false; - } - - - // The Windows Forms Designer requires the following procedure. - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->printButton = gcnew System::Windows::Forms::Button; - this->ClientSize = System::Drawing::Size( 504, 381 ); - this->Text = "Print Example"; - printButton->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft; - printButton->Location = System::Drawing::Point( 32, 110 ); - printButton->FlatStyle = System::Windows::Forms::FlatStyle::Flat; - printButton->TabIndex = 0; - printButton->Text = "Print the file."; - printButton->Size = System::Drawing::Size( 136, 40 ); - printButton->Click += gcnew System::EventHandler( this, &PrintingExample::printButton_Click ); - this->Controls->Add( printButton ); - } - -}; - - -// This is the main entry point for the application. -int main() -{ - Application::Run( gcnew PrintingExample ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp deleted file mode 100644 index 3e53b5db8c4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing::Printing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class myControllerImplementation: public PrintController{}; - -public ref class Form1: public Form -{ -protected: - bool useMyPrintController; - bool wantsStatusDialog; - PrintDocument^ myPrintDocument; - - // -public: - void myPrint() - { - if ( useMyPrintController) - { - myPrintDocument->PrintController = - gcnew myControllerImplementation; - if ( wantsStatusDialog) - { - myPrintDocument->PrintController = - gcnew PrintControllerWithStatusDialog( - myPrintDocument->PrintController ); - } - } - myPrintDocument->Print(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp deleted file mode 100644 index ee6527d470b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - String^ printer; - String^ filePath; - -private: - System::Drawing::Font^ printFont; - StreamReader^ streamToPrint; - - // -public: - void Printing() - { - try - { - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew System::Drawing::Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( - this, &Form1::pd_PrintPage ); - pd->PrinterSettings->PrinterName = printer; - // Set the page orientation to landscape. - pd->DefaultPageSettings->Landscape = true; - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - -private: - // The PrintPage event is raised for each page to be printed. - void pd_PrintPage( Object^ sender, PrintPageEventArgs^ ev ) - { - float linesPerPage = 0; - float yPos = 0; - int count = 0; - float leftMargin = (float)(ev->MarginBounds.Left); - float topMargin = (float)(ev->MarginBounds.Top); - String^ line = nullptr; - - // Calculate the number of lines per page. - linesPerPage = ev->MarginBounds.Height / - printFont->GetHeight( ev->Graphics ); - - // Iterate over the file, printing each line. - while ( count < linesPerPage && - ( (line = streamToPrint->ReadLine()) != nullptr) ) - { - yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); - ev->Graphics->DrawString( line, printFont, Brushes::Black, - leftMargin, yPos, gcnew StringFormat ); - count++; - } - - - // If more lines exist, print another page. - if ( line != nullptr ) - { - ev->HasMorePages = true; - } - else - { - ev->HasMorePages = false; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp deleted file mode 100644 index fed5c1e96de..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp +++ /dev/null @@ -1,111 +0,0 @@ -// - -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - - -public ref class PrintingExample -{ -private: - Font^ printFont; - StreamReader^ streamToPrint; - static String^ filePath; - -public: - PrintingExample() - { - Printing(); - } - - -private: - - // The PrintPage event is raised for each page to be printed. - void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev ) - { - float linesPerPage = 0; - float yPos = 0; - int count = 0; - float leftMargin = (float)ev->MarginBounds.Left; - float topMargin = (float)ev->MarginBounds.Top; - String^ line = nullptr; - - // Calculate the number of lines per page. - linesPerPage = ev->MarginBounds.Height / printFont->GetHeight( ev->Graphics ); - - // Iterate over the file, printing each line. - while ( count < linesPerPage && ((line = streamToPrint->ReadLine()) != nullptr) ) - { - yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); - ev->Graphics->DrawString( line, printFont, Brushes::Black, leftMargin, yPos, gcnew StringFormat ); - count++; - } - - - // If more lines exist, print another page. - if ( line != nullptr ) - ev->HasMorePages = true; - else - ev->HasMorePages = false; - } - - -public: - - // Print the file. - void Printing() - { - try - { - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( this, &PrintingExample::pd_PrintPage ); - - // Print the document. - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - - } - - static void Main() - { - array^args = Environment::GetCommandLineArgs(); - String^ sampleName = args[ 0 ]; - if ( args->Length != 2 ) - { - Console::WriteLine( "Usage: {0} ", sampleName ); - return; - } - - filePath = args[ 1 ]; - gcnew PrintingExample; - } - -}; - -int main() -{ - PrintingExample::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp deleted file mode 100644 index d896b6f82bf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - String^ printer; - static String^ filePath; - -private: - System::Drawing::Font^ printFont; - StreamReader^ streamToPrint; - - // -public: - void Printing() - { - try - { - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew System::Drawing::Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( - this, &Form1::pd_PrintPage ); - // Specify the printer to use. - pd->PrinterSettings->PrinterName = printer; - pd->Print(); - } - finally - { - streamToPrint->Close(); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - -private: - // The PrintPage event is raised for each page to be printed. - void pd_PrintPage( Object^ sender, PrintPageEventArgs^ ev ) - { - float linesPerPage = 0; - float yPos = 0; - int count = 0; - float leftMargin = (float)(ev->MarginBounds.Left); - float topMargin = (float)(ev->MarginBounds.Top); - String^ line = nullptr; - - // Calculate the number of lines per page. - linesPerPage = ev->MarginBounds.Height / - printFont->GetHeight( ev->Graphics ); - - // Iterate over the file, printing each line. - while ( count < linesPerPage && - ((line = streamToPrint->ReadLine()) != nullptr)) - { - yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); - ev->Graphics->DrawString( line, printFont, Brushes::Black, - leftMargin, yPos, gcnew StringFormat ); - count++; - } - - // If more lines exist, print another page. - if ( line != nullptr ) - { - ev->HasMorePages = true; - } - else - { - ev->HasMorePages = false; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp deleted file mode 100644 index 104b40ab8f2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - // Specifies what happens when the user clicks the Button. - void printButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - pd->Print(); - } - catch ( Exception^ ex ) - { - MessageBox::Show( "An error occurred while printing", ex->ToString() ); - } - } - - // Specifies what happens when the PrintPage event is raised. - void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev ) - { - // Draw a picture. - ev->Graphics->DrawImage( Image::FromFile( "C:\\My Folder\\MyFile.bmp" ), - ev->Graphics->VisibleClipBounds ); - - // Indicate that this is the last page to print. - ev->HasMorePages = false; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp deleted file mode 100644 index cd727cafbdc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - System::Drawing::Font^ printFont; - StreamReader^ streamToPrint; - -protected: - static String^ filePath; - - // -public: - void Printing( String^ printer ) - { - try - { - streamToPrint = gcnew StreamReader( filePath ); - try - { - printFont = gcnew System::Drawing::Font( "Arial",10 ); - PrintDocument^ pd = gcnew PrintDocument; - pd->PrintPage += gcnew PrintPageEventHandler( - this, &Form1::pd_PrintPage ); - // Specify the printer to use. - pd->PrinterSettings->PrinterName = printer; - if ( pd->PrinterSettings->IsValid ) - { - pd->Print(); - } - else - { - MessageBox::Show( "Printer is invalid." ); - } - } - finally - { - streamToPrint->Close(); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - -private: - // The PrintPage event is raised for each page to be printed. - void pd_PrintPage( Object^ sender, PrintPageEventArgs^ ev ) - { - float linesPerPage = 0; - float yPos = 0; - int count = 0; - float leftMargin = (float)(ev->MarginBounds.Left); - float topMargin = (float)(ev->MarginBounds.Top); - String^ line = nullptr; - - // Calculate the number of lines per page. - linesPerPage = ev->MarginBounds.Height / - printFont->GetHeight( ev->Graphics ); - - // Iterate over the file, printing each line. - while ( count < linesPerPage && - ((line = streamToPrint->ReadLine()) != nullptr)) - { - yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); - ev->Graphics->DrawString( line, printFont, Brushes::Black, - leftMargin, yPos, gcnew StringFormat ); - count++; - } - - // If more lines exist, print another page. - if ( line != nullptr ) - { - ev->HasMorePages = true; - } - else - { - ev->HasMorePages = false; - } - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp deleted file mode 100644 index 695fa37e18d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - -private: - void Method1() - { - // - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - // - } - - // -private: - void MyPropertyCollection() - { - // Creates a new collection and assign it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Displays each property in the collection in a text box. - for each ( PropertyDescriptor^ myProperty in properties ) - { - textBox1->Text = String::Concat( textBox1->Text, myProperty->Name, "\n" ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp deleted file mode 100644 index c562d60b18f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void GetCount() - { - // Creates a new collection and assign it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Prints the number of properties on button1 in a textbox. - textBox1->Text = properties->Count.ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp deleted file mode 100644 index 24c9c39e0a0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void FindProperty() - { - // Creates a new collection and assign it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Sets a PropertyDescriptor to the specific property. - PropertyDescriptor^ myProperty = properties->Find( "Opacity", false ); - - // Prints the property and the property description. - textBox1->Text = myProperty->DisplayName + "\n" + myProperty->Description; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp deleted file mode 100644 index 10a99bf32bb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - - // -private: - void MyEnumerator() - { - // Creates a new collection and assigns it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Creates an enumerator. - IEnumerator^ ie = properties->GetEnumerator(); - - // Prints the name of each property in the collection. - Object^ myProperty; - while ( ie->MoveNext() ) - { - myProperty = ie->Current; - textBox1->Text = textBox1->Text + myProperty + "\n"; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp deleted file mode 100644 index 43b458167f6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - -private: - - // - void PrintIndexItem() - { - - // Creates a new collection and assigns it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Prints the second property's name. - textBox1->Text = properties[ 1 ]->ToString(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp deleted file mode 100644 index 5a3214eca1f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - Button^ button1; - TextBox^ textBox1; - -private: - - // - void PrintIndexItem2() - { - - // Creates a new collection and assigns it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Sets a PropertyDescriptor to the specific property. - PropertyDescriptor^ myProperty = properties[ "Opacity" ]; - - // Prints the display name for the property. - textBox1->Text = myProperty->DisplayName; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp deleted file mode 100644 index ad679e3207f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - Form1() - { - // The initial constructor code goes here. - - PropertyGrid^ propertyGrid1 = gcnew PropertyGrid; - propertyGrid1->CommandsVisibleIfAvailable = true; - propertyGrid1->Location = Point( 10, 20 ); - propertyGrid1->Size = System::Drawing::Size( 400, 300 ); - propertyGrid1->TabIndex = 1; - propertyGrid1->Text = "Property Grid"; - - this->Controls->Add( propertyGrid1 ); - - propertyGrid1->SelectedObject = textBox1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp deleted file mode 100644 index 87e88922b8d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Globalization; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// -[ProvideProperty("MyProperty",Control::typeid)] -public ref class MyClass: public IExtenderProvider -{ -protected: - CultureInfo^ ciMine; - -public: - // Provides the Get portion of MyProperty. - CultureInfo^ GetMyProperty( Control^ myControl ) - { - // Insert code here. - return ciMine; - } - - // Provides the Set portion of MyProperty. - void SetMyProperty( Control^ myControl, String^ value ) - { - // Insert code here. - } - - /* When you inherit from IExtenderProvider, you must implement the - * CanExtend method. */ - virtual bool CanExtend( Object^ target ) - { - return dynamic_cast(target) != nullptr; - } - // Insert additional code here. -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp deleted file mode 100644 index 6e6ffb573b5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Sample -{ -private: - RadioButton^ radioButton1; - - // -private: - Void radioButton1_CheckedChanged( System::Object^ sender, - System::EventArgs^ e ) - { - // Change the check box position to be opposite its current position. - if ( radioButton1->CheckAlign == ContentAlignment::MiddleLeft ) - { - radioButton1->CheckAlign = ContentAlignment::MiddleRight; - } - else - { - radioButton1->CheckAlign = ContentAlignment::MiddleLeft; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp deleted file mode 100644 index 00614590c77..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - ListBox^ listBox1; - RadioButton^ radioButton1; - RadioButton^ radioButton2; - - // -private: - void ClickMyRadioButton() - { - // If Item1 is selected and radioButton2 - // is checked, click radioButton1. - if ( listBox1->Text == "Item1" && radioButton2->Checked ) - { - radioButton1->PerformClick(); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp deleted file mode 100644 index 24713598553..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Sample -{ -private: - RadioButton^ radioButton1; - - // -private: - Void radioButton1_CheckedChanged( System::Object^ sender, System::EventArgs^ e ) - { - // Change the check box position to be opposite its current position. - if ( radioButton1->CheckAlign == ContentAlignment::MiddleLeft ) - { - radioButton1->CheckAlign = ContentAlignment::MiddleRight; - } - else - { - radioButton1->CheckAlign = ContentAlignment::MiddleLeft; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp deleted file mode 100644 index e723fbeffa5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - - property int MyProperty - { - // - [ReadOnly(true)] - int get() - { - // Insert code here. - return 0; - } - } - // - - void Method1() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see whether the value of the ReadOnlyAttribute is Yes. - if ( attributes[ ReadOnlyAttribute::typeid ]->Equals( ReadOnlyAttribute::Yes ) ) - { - // Insert code here. - } - - // This is another way to see whether the property is read-only. - ReadOnlyAttribute^ myAttribute = dynamic_cast(attributes[ ReadOnlyAttribute::typeid ]); - if ( myAttribute->IsReadOnly ) - { - // Insert code here. - } - // - } - - void Method2() - { - // - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); - if ( attributes[ ReadOnlyAttribute::typeid ]->Equals( ReadOnlyAttribute::Yes ) ) - { - // Insert code here. - } - // - } -}; - -/* -This code produces the following output. - -myQ is not synchronized. -mySyncdQ is synchronized. -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp deleted file mode 100644 index 7a0827623ae..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see whether the property is read-only. - ReadOnlyAttribute^ myAttribute = dynamic_cast(attributes[ ReadOnlyAttribute::typeid ]); - if ( myAttribute->IsReadOnly ) - { - // Insert code here. - } - // - } -}; - -/* -This code produces the following output. - -myQ is not synchronized. -mySyncdQ is synchronized. -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp deleted file mode 100644 index c35222caf0b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - [ReadOnly(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int value ) - { - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp deleted file mode 100644 index 261eb1e694e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - [RecommendedAsConfigurable(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int /*value*/ ) - { - // Insert code here. - } - } - // - void Method1() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the value of the RecommendedAsConfigurableAttribute is Yes. - if ( attributes[ RecommendedAsConfigurableAttribute::typeid ]->Equals( RecommendedAsConfigurableAttribute::Yes ) ) - { - // Insert code here. - } - - // This is another way to see if the property is recommended as configurable. - RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast(attributes[ RecommendedAsConfigurableAttribute::typeid ]); - if ( myAttribute->RecommendedAsConfigurable ) - { - // Insert code here. - } - // - } - - void Method2() - { - // - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); - if ( attributes[ RecommendedAsConfigurableAttribute::typeid ]->Equals( RecommendedAsConfigurableAttribute::Yes ) ) - { - // Insert code here. - } - // - } -}; - -/* -This code produces the following output. - -myQ is not synchronized. -mySyncdQ is synchronized. -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp deleted file mode 100644 index daaf00fa8cb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - -public: - void Method() - { - // - // Gets the attributes for the property. - AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; - - // Checks to see if the property is recommended as configurable. - RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast(attributes[ RecommendedAsConfigurableAttribute::typeid ]); - if ( myAttribute->RecommendedAsConfigurable ) - { - // Insert code here. - } - // - } -}; - -/* -This code produces the following output. - -myQ is not synchronized. -mySyncdQ is synchronized. -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp deleted file mode 100644 index 7b9aaf400ee..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - - // -public: - [RecommendedAsConfigurable(true)] - property int MyProperty - { - int get() - { - // Insert code here. - return 0; - } - void set( int value ) - { - - // Insert code here. - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp deleted file mode 100644 index 0ecb7a6993a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyRichTextBox() - { - RichTextBox^ richTextBox1 = gcnew RichTextBox; - richTextBox1->Dock = DockStyle::Fill; - - richTextBox1->LoadFile( "C:\\MyDocument.rtf" ); - richTextBox1->Find( "Text", RichTextBoxFinds::MatchCase ); - - richTextBox1->SelectionFont = gcnew System::Drawing::Font( - "Verdana", 12, FontStyle::Bold ); - richTextBox1->SelectionColor = Color::Red; - - richTextBox1->SaveFile( "C:\\MyDocument.rtf", - RichTextBoxStreamType::RichText ); - - this->Controls->Add( richTextBox1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp deleted file mode 100644 index db89f1df3a6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - bool FindMyText( String^ text ) - { - // Initialize the return value to false by default. - bool returnValue = false; - - // Ensure a search string has been specified. - if ( text->Length > 0 ) - { - // Obtain the location of the search string in richTextBox1. - int indexToText = richTextBox1->Find( text ); - // Determine whether the text was found in richTextBox1. - if ( indexToText >= 0 ) - { - returnValue = true; - } - } - - return returnValue; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp deleted file mode 100644 index 35408c38fe7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - bool FindMyText( String^ text ) - { - // Initialize the return value to false by default. - bool returnValue = false; - - // Ensure a search string has been specified. - if ( text->Length > 0 ) - { - // Obtain the location of the search string in richTextBox1. - int indexToText = richTextBox1->Find( text, RichTextBoxFinds::MatchCase ); - // Determine if the text was found in richTextBox1. - if ( indexToText >= 0 ) - { - returnValue = true; - } - } - - return returnValue; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp deleted file mode 100644 index 9ab75655e76..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - int FindMyText( String^ text, int start ) - { - // Initialize the return value to false by default. - int returnValue = -1; - - // Ensure that a search string has been specified and a valid start point. - if ( text->Length > 0 && start >= 0 ) - { - // Obtain the location of the search string in richTextBox1. - int indexToText = richTextBox1->Find( text, start, RichTextBoxFinds::MatchCase ); - // Determine whether the text was found in richTextBox1. - if ( indexToText >= 0 ) - { - returnValue = indexToText; - } - } - - return returnValue; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp deleted file mode 100644 index e06e82525b4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - RichTextBox^ richTextBox1; - -public: - Form1() - { - richTextBox1 = gcnew RichTextBox; - - richTextBox1->LinkClicked += gcnew LinkClickedEventHandler( - this, &Form1::Link_Clicked ); - richTextBox1->SelectedText = "To see Microsoft go to www.microsoft.com"; - richTextBox1->Location = System::Drawing::Point( 10, 10 ); - richTextBox1->Size = System::Drawing::Size( 100, 100 ); - - this->Controls->Add( richTextBox1 ); - } - - // -private: - void Link_Clicked( Object^ sender, System::Windows::Forms::LinkClickedEventArgs^ e ) - { - System::Diagnostics::Process::Start( e->LinkText ); - } - // -}; - -/// -/// The main entry point for the application. -/// -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp deleted file mode 100644 index 5fbe771c3ef..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - void LoadMyFile() - { - // Create an OpenFileDialog to request a file to open. - OpenFileDialog^ openFile1 = gcnew OpenFileDialog; - - // Initialize the OpenFileDialog to look for RTF files. - openFile1->DefaultExt = "*.rtf"; - openFile1->Filter = "RTF Files|*.rtf"; - - // Determine whether the user selected a file from the OpenFileDialog. - if ( openFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && - openFile1->FileName->Length > 0 ) - { - // Load the contents of the file into the RichTextBox. - richTextBox1->LoadFile( openFile1->FileName ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp deleted file mode 100644 index d064101f838..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - void LoadMyFile() - { - // Create an OpenFileDialog to request a file to open. - OpenFileDialog^ openFile1 = gcnew OpenFileDialog; - - // Initialize the OpenFileDialog to look for RTF files. - openFile1->DefaultExt = "*.rtf"; - openFile1->Filter = "RTF Files|*.rtf"; - - // Determine whether the user selected a file from the OpenFileDialog. - if ( openFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && - openFile1->FileName->Length > 0 ) - { - // Load the contents of the file into the RichTextBox. - richTextBox1->LoadFile( openFile1->FileName, RichTextBoxStreamType::PlainText ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp deleted file mode 100644 index 7fd70215b32..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - void SaveMyFile() - { - // Create a SaveFileDialog to request a path and file name to save to. - SaveFileDialog^ saveFile1 = gcnew SaveFileDialog; - - // Initialize the SaveFileDialog to specify the RTF extention for the file. - saveFile1->DefaultExt = "*.rtf"; - saveFile1->Filter = "RTF Files|*.rtf"; - - // Determine whether the user selected a file name from the saveFileDialog. - if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && - saveFile1->FileName->Length > 0 ) - { - // Save the contents of the RichTextBox into the file. - richTextBox1->SaveFile( saveFile1->FileName ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp deleted file mode 100644 index 7eb6ab700c0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - void SaveMyFile() - { - // Create a SaveFileDialog to request a path and file name to save to. - SaveFileDialog^ saveFile1 = gcnew SaveFileDialog; - - // Initialize the SaveFileDialog to specify the RTF extension for the file. - saveFile1->DefaultExt = "*.rtf"; - saveFile1->Filter = "RTF Files|*.rtf"; - - // Determine if the user selected a file name from the saveFileDialog. - if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && - saveFile1->FileName->Length > 0 ) - { - // Save the contents of the RichTextBox into the file. - richTextBox1->SaveFile( saveFile1->FileName, RichTextBoxStreamType::PlainText ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp deleted file mode 100644 index 529b0e5ccdf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - RichTextBox^ richTextBox1; - - // -public: - void ChangeMySelectionColor() - { - ColorDialog^ colorDialog1 = gcnew ColorDialog; - - // Set the initial color of the dialog to the current text color. - colorDialog1->Color = richTextBox1->SelectionColor; - - // Determine if the user clicked OK in the dialog and that the color has changed. - if ( colorDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK && - colorDialog1->Color != richTextBox1->SelectionColor ) - { - // Change the selection color to the user specified color. - richTextBox1->SelectionColor = colorDialog1->Color; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp deleted file mode 100644 index c57eacb6a04..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp +++ /dev/null @@ -1,146 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace CSExample -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - - // - // Required for Windows Form Designer support - // - components = nullptr; - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - // #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 256, 24 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "Make me BOLD"; - this->richTextBox1->Enter += gcnew System::EventHandler( this, &Form1::richTextBox1_Enter ); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 8, 40 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 72, 32 ); - this->button1->TabIndex = 1; - this->button1->Text = "Bold"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 117 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - // #endregion - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->ToggleBold(); - } - - // - void ToggleBold() - { - if ( richTextBox1->SelectionFont != nullptr ) - { - System::Drawing::Font^ currentFont = richTextBox1->SelectionFont; - System::Drawing::FontStyle newFontStyle; - if (richTextBox1->SelectionFont->Bold) - { - newFontStyle = FontStyle::Regular; - } - else - { - newFontStyle = FontStyle::Bold; - } - richTextBox1->SelectionFont = gcnew System::Drawing::Font( currentFont->FontFamily,currentFont->Size,newFontStyle ); - } - } - // - void richTextBox1_Enter( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - richTextBox1->SelectionStart = 8; - richTextBox1->SelectionLength = 4; - } - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew CSExample::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp deleted file mode 100644 index 23e4e7d566f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Configuration::Install; - -// -[RunInstallerAttribute(true)] -ref class MyProjectInstaller: public Installer{ - // Insert code here. -}; -// - -// -int main() -{ - // Creates a new installer. - MyProjectInstaller^ myNewProjectInstaller = gcnew MyProjectInstaller; - - // Gets the attributes for the collection. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewProjectInstaller ); - - /* Prints whether to run the installer by retrieving the - * RunInstallerAttribute from the AttributeCollection. */ - RunInstallerAttribute^ myAttribute = dynamic_cast(attributes[ RunInstallerAttribute::typeid ]); - Console::WriteLine( "Run the installer? {0}", myAttribute->RunInstaller ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp deleted file mode 100644 index 4f6d586ae93..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ dataGrid1; - DataSet^ dataSet1; - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Stream^ myStream; - SaveFileDialog^ saveFileDialog1 = gcnew SaveFileDialog; - saveFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; - saveFileDialog1->FilterIndex = 2; - saveFileDialog1->RestoreDirectory = true; - if ( saveFileDialog1->ShowDialog() == ::DialogResult::OK ) - { - if ( (myStream = saveFileDialog1->OpenFile()) != nullptr ) - { - - // Code to write the stream goes here. - myStream->Close(); - } - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp deleted file mode 100644 index ff4564c10e7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Label^ label1; - ScrollBar^ vScrollBar1; - ScrollBar^ hScrollBar1; - -private: - - // - void AddMyScrollEventHandlers() - { - // Create and initialize a VScrollBar. - VScrollBar^ vScrollBar1 = gcnew VScrollBar; - - // Add event handlers for the OnScroll and OnValueChanged events. - vScrollBar1->Scroll += gcnew ScrollEventHandler( this, &Form1::vScrollBar1_Scroll ); - vScrollBar1->ValueChanged += gcnew EventHandler( this, &Form1::vScrollBar1_ValueChanged ); - } - - // Create the ValueChanged event handler. - void vScrollBar1_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Display the new value in the label. - label1->Text = String::Format( "vScrollBar Value:(OnValueChanged Event) {0}", vScrollBar1->Value ); - } - - // Create the Scroll event handler. - void vScrollBar1_Scroll( Object^ /*sender*/, ScrollEventArgs^ e ) - { - // Display the new value in the label. - label1->Text = String::Format( "VScrollBar Value:(OnScroll Event) {0}", e->NewValue ); - } - - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Add 40 to the Value property if it will not exceed the Maximum value. - if ( vScrollBar1->Value + 40 < vScrollBar1->Maximum ) - { - vScrollBar1->Value = vScrollBar1->Value + 40; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp deleted file mode 100644 index e50167abca9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - Panel^ panel1; - -private: - - // - void SetAutoScrollMargins() - { - /* If the text box is outside the panel's bounds, - turn on auto-scrolling and set the margin. */ - if ( text1->Location.X > panel1->Location.X || text1->Location.Y > panel1->Location.Y ) - { - panel1->AutoScroll = true; - - /* If the AutoScrollMargin is set to less - than (5,5), set it to 5,5. */ - if ( panel1->AutoScrollMargin.Width < 5 || panel1->AutoScrollMargin.Height < 5 ) - { - panel1->SetAutoScrollMargin( 5, 5 ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp deleted file mode 100644 index 060ac25877f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - Panel^ panel1; - int myCounter; - -private: - - // - void SetDockPadding() - { - // Dock the button in the panel. - button1->Dock = System::Windows::Forms::DockStyle::Fill; - - // Reset the counter if it is greater than 5. - if ( myCounter > 5 ) - { - myCounter = 0; - } - - // Set the appropriate DockPadding and display - // which one was set on the button face. - switch ( myCounter ) - { - case 0: - panel1->DockPadding->All = 0; - button1->Text = "Start"; - break; - - case 1: - panel1->DockPadding->Top = 10; - button1->Text = "Top"; - break; - - case 2: - panel1->DockPadding->Bottom = 10; - button1->Text = "Bottom"; - break; - - case 3: - panel1->DockPadding->Left = 10; - button1->Text = "Left"; - break; - - case 4: - panel1->DockPadding->Right = 10; - button1->Text = "Right"; - break; - - case 5: - panel1->DockPadding->All = 20; - button1->Text = "All"; - break; - } - myCounter++; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp deleted file mode 100644 index 23502c0025a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - Button^ button1; - Panel^ panel1; - int myCounter; - -private: - - // - void SetDockPadding() - { - // Dock the button in the panel. - button1->Dock = System::Windows::Forms::DockStyle::Fill; - - // Reset the counter if it is greater than 5. - if ( myCounter > 5 ) - { - myCounter = 0; - } - - - /* Set the appropriate DockPadding and display - which one was set on the button face. */ - switch ( myCounter ) - { - case 0: - panel1->DockPadding->All = 0; - button1->Text = "Start"; - break; - - case 1: - panel1->DockPadding->Top = 10; - button1->Text = "Top"; - break; - - case 2: - panel1->DockPadding->Bottom = 10; - button1->Text = "Bottom"; - break; - - case 3: - panel1->DockPadding->Left = 10; - button1->Text = "Left"; - break; - - case 4: - panel1->DockPadding->Right = 10; - button1->Text = "Right"; - break; - - case 5: - panel1->DockPadding->All = 20; - button1->Text = "All"; - break; - } - myCounter++; - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp deleted file mode 100644 index 0a96f55a9e3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp +++ /dev/null @@ -1,39 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ text1; - Panel^ panel1; - -private: - - // - void MySub() - { - /* If the text box is outside the panel's bounds, - turn on auto-scrolling and set the margin. */ - if ( text1->Location.X > panel1->Location.X || text1->Location.Y > panel1->Location.Y ) - { - panel1->AutoScroll = true; - - /* If the AutoScrollMargin is set to - less than (5,5), set it to 5,5. */ - if ( panel1->AutoScrollMargin.Width < 5 || panel1->AutoScrollMargin.Height < 5 ) - { - panel1->SetAutoScrollMargin( 5, 5 ); - } - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp deleted file mode 100644 index b9e62986f13..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - MonthCalendar^ monthCalendar1; - TextBox^ textBox1; - TextBox^ textBox2; - - // -private: - void button1_Click( Object^ sender, EventArgs^ e ) - { - // Set the SelectionRange with start and end dates from text boxes. - try - { - monthCalendar1->SelectionRange = gcnew SelectionRange( - DateTime::Parse( textBox1->Text ), - DateTime::Parse( textBox2->Text ) ); - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp deleted file mode 100644 index 626875ee4f0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -// Class added so sample will compile -public ref class myService{}; - -public ref class Sample -{ -public: - void SampleMethod() - { - ServiceContainer^ serviceContainer = gcnew ServiceContainer; - - // - // The following code shows how to publish a service using a callback function. - // Creates a service creator callback. - ServiceCreatorCallback^ callback1 = - gcnew ServiceCreatorCallback( this, &Sample::myCallBackMethod ); - - // Adds the service using its type and the service creator callback. - serviceContainer->AddService( myService::typeid, callback1 ); - // - } - - // Method added so class will compile - Object^ myCallBackMethod( IServiceContainer^ container, Type^ serviceType ) - { - return gcnew Object; - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp deleted file mode 100644 index 818cf5ebaf4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp +++ /dev/null @@ -1,139 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - // Required designer variable. - System::ComponentModel::Container^ components; - - // Declare variables. - System::Windows::Forms::RadioButton^ tab3RadioButton2; - System::Windows::Forms::RadioButton^ tab3RadioButton1; - System::Windows::Forms::CheckBox^ tab2CheckBox3; - System::Windows::Forms::CheckBox^ tab2CheckBox2; - System::Windows::Forms::CheckBox^ tab2CheckBox1; - System::Windows::Forms::Label ^ tab1Label1; - System::Windows::Forms::Button^ tab1Button1; - System::Windows::Forms::TabPage^ tabPage3; - System::Windows::Forms::TabPage^ tabPage2; - System::Windows::Forms::TabPage^ tabPage1; - System::Windows::Forms::TabControl^ tabControl1; - -public: - Form1() - { - - // This call is required for Windows Form Designer support. - InitializeComponent(); - } - - -private: - - // This method is required for Designer support. - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->tabPage1 = gcnew System::Windows::Forms::TabPage; - this->tab2CheckBox3 = gcnew System::Windows::Forms::CheckBox; - this->tab3RadioButton2 = gcnew System::Windows::Forms::RadioButton; - this->tabControl1 = gcnew System::Windows::Forms::TabControl; - this->tab2CheckBox2 = gcnew System::Windows::Forms::CheckBox; - this->tab2CheckBox1 = gcnew System::Windows::Forms::CheckBox; - this->tab3RadioButton1 = gcnew System::Windows::Forms::RadioButton; - this->tab1Label1 = gcnew System::Windows::Forms::Label; - this->tabPage3 = gcnew System::Windows::Forms::TabPage; - this->tabPage2 = gcnew System::Windows::Forms::TabPage; - this->tab1Button1 = gcnew System::Windows::Forms::Button; - tabPage1->Text = "tabPage1"; - tabPage1->Size = System::Drawing::Size( 256, 214 ); - tabPage1->TabIndex = 0; - tab2CheckBox3->Location = System::Drawing::Point( 32, 136 ); - tab2CheckBox3->Text = "checkBox3"; - tab2CheckBox3->Size = System::Drawing::Size( 176, 32 ); - tab2CheckBox3->TabIndex = 2; - tab2CheckBox3->Visible = true; - tab3RadioButton2->Location = System::Drawing::Point( 40, 72 ); - tab3RadioButton2->Text = "radioButton2"; - tab3RadioButton2->Size = System::Drawing::Size( 152, 24 ); - tab3RadioButton2->TabIndex = 1; - tab3RadioButton2->Visible = true; - tabControl1->Location = System::Drawing::Point( 16, 16 ); - tabControl1->Size = System::Drawing::Size( 264, 240 ); - tabControl1->SelectedIndex = 0; - tabControl1->TabIndex = 0; - tab2CheckBox2->Location = System::Drawing::Point( 32, 80 ); - tab2CheckBox2->Text = "checkBox2"; - tab2CheckBox2->Size = System::Drawing::Size( 176, 32 ); - tab2CheckBox2->TabIndex = 1; - tab2CheckBox2->Visible = true; - tab2CheckBox1->Location = System::Drawing::Point( 32, 24 ); - tab2CheckBox1->Text = "checkBox1"; - tab2CheckBox1->Size = System::Drawing::Size( 176, 32 ); - tab2CheckBox1->TabIndex = 0; - tab3RadioButton1->Location = System::Drawing::Point( 40, 32 ); - tab3RadioButton1->Text = "radioButton1"; - tab3RadioButton1->Size = System::Drawing::Size( 152, 24 ); - tab3RadioButton1->TabIndex = 0; - tab1Label1->Location = System::Drawing::Point( 16, 24 ); - tab1Label1->Text = "label1"; - tab1Label1->Size = System::Drawing::Size( 224, 96 ); - tab1Label1->TabIndex = 1; - tabPage3->Text = "tabPage3"; - tabPage3->Size = System::Drawing::Size( 256, 214 ); - tabPage3->TabIndex = 2; - tabPage2->Text = "tabPage2"; - tabPage2->Size = System::Drawing::Size( 256, 214 ); - tabPage2->TabIndex = 1; - tab1Button1->Location = System::Drawing::Point( 88, 144 ); - tab1Button1->Size = System::Drawing::Size( 80, 40 ); - tab1Button1->TabIndex = 0; - tab1Button1->Text = "button1"; - tab1Button1->Click += gcnew System::EventHandler( this, &Form1::tab1Button1_Click ); - this->Text = "Form1"; - - // Adds controls to the second tab page. - tabPage2->Controls->Add( this->tab2CheckBox3 ); - tabPage2->Controls->Add( this->tab2CheckBox2 ); - tabPage2->Controls->Add( this->tab2CheckBox1 ); - - // Adds controls to the third tab page. - tabPage3->Controls->Add( this->tab3RadioButton2 ); - tabPage3->Controls->Add( this->tab3RadioButton1 ); - - // Adds controls to the first tab page. - tabPage1->Controls->Add( this->tab1Label1 ); - tabPage1->Controls->Add( this->tab1Button1 ); - - // Adds the TabControl to the form. - this->Controls->Add( this->tabControl1 ); - - // Adds the tab pages to the TabControl. - tabControl1->Controls->Add( this->tabPage1 ); - tabControl1->Controls->Add( this->tabPage2 ); - tabControl1->Controls->Add( this->tabPage3 ); - } - - void tab1Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Inserts the code that should run when the button is clicked. - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp deleted file mode 100644 index c991ba96036..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMultilineTextBox() - { - // Create an instance of a TextBox control. - TextBox^ textBox1 = gcnew TextBox; - - // Set the Multiline property to true. - textBox1->Multiline = true; - // Add vertical scroll bars to the TextBox control. - textBox1->ScrollBars = ScrollBars::Vertical; - // Allow the RETURN key to be entered in the TextBox control. - textBox1->AcceptsReturn = true; - // Allow the TAB key to be entered in the TextBox control. - textBox1->AcceptsTab = true; - // Set WordWrap to true to allow text to wrap to the next line. - textBox1->WordWrap = true; - // Set the default text of the control. - textBox1->Text = "Welcome!"; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp deleted file mode 100644 index 49cc31df5be..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyPasswordTextBox() - { - // Create an instance of the TextBox control. - TextBox^ textBox1 = gcnew TextBox; - // Set the maximum length of text in the control to eight. - textBox1->MaxLength = 8; - // Assign the asterisk to be the password character. - textBox1->PasswordChar = '*'; - // Change all text entered to be lowercase. - textBox1->CharacterCasing = CharacterCasing::Lower; - // Align the text in the center of the TextBox control. - textBox1->TextAlign = HorizontalAlignment::Center; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp deleted file mode 100644 index e80cd3834af..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMultilineTextBox() - { - // Create an instance of a TextBox control. - TextBox^ textBox1 = gcnew TextBox; - - // Set the Multiline property to true. - textBox1->Multiline = true; - // Add vertical scroll bars to the TextBox control. - textBox1->ScrollBars = ScrollBars::Vertical; - // Allow the TAB key to be entered in the TextBox control. - textBox1->AcceptsReturn = true; - // Allow the TAB key to be entered in the TextBox control. - textBox1->AcceptsTab = true; - // Set WordWrap to true to allow text to wrap to the next line. - textBox1->WordWrap = true; - // Set the default text of the control. - textBox1->Text = "Welcome!"; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp deleted file mode 100644 index e34e1003f03..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyTextBoxControl() - { - // Create a new TextBox control using this constructor. - TextBox^ textBox1 = gcnew TextBox; - // Assign a string of text to the new TextBox control. - textBox1->Text = "Hello World!"; - // Code goes here to add the control to the form's control collection. - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp deleted file mode 100644 index 3f8d0e73329..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateMyMultilineTextBox() - { - // Create an instance of a TextBox control. - TextBox^ textBox1 = gcnew TextBox; - - // Set the Multiline property to true. - textBox1->Multiline = true; - // Add vertical scroll bars to the TextBox control. - textBox1->ScrollBars = ScrollBars::Vertical; - // Allow the RETURN key in the TextBox control. - textBox1->AcceptsReturn = true; - // Allow the TAB key to be entered in the TextBox control. - textBox1->AcceptsTab = true; - // Set WordWrap to true to allow text to wrap to the next line. - textBox1->WordWrap = true; - // Set the default text of the control. - textBox1->Text = "Welcome!" + Environment::NewLine + "Second Line"; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1() ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp deleted file mode 100644 index fab81c39672..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CreateTextBox() - { - // Create an instance of the TextBox control. - TextBox^ textBox1 = gcnew TextBox; - - // Set the TextBox Font property to Arial 20. - textBox1->Font = gcnew System::Drawing::Font( "Arial", 20 ); - // Set the BorderStyle property to FixedSingle. - textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - // Make the height of the control equal to the preferred height. - textBox1->Height = textBox1->PreferredHeight; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp deleted file mode 100644 index b5ccb472733..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void Menu_Copy( System::Object^ sender, System::EventArgs^ e ) - { - // Ensure that text is selected in the text box. - if ( textBox1->SelectionLength > 0 ) - { - // Copy the selected text to the Clipboard. - textBox1->Copy(); - } - } - - void Menu_Cut( System::Object^ sender, System::EventArgs^ e ) - { - // Ensure that text is currently selected in the text box. - if ( !textBox1->SelectedText->Equals( "" ) ) - { - // Cut the selected text in the control and paste it into the Clipboard. - textBox1->Cut(); - } - } - - void Menu_Paste( System::Object^ sender, System::EventArgs^ e ) - { - // Determine if there is any text in the Clipboard to paste into the text box. - if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) - { - // Determine if any text is selected in the text box. - if ( textBox1->SelectionLength > 0 ) - { - // Ask user if they want to paste over currently selected text. - if ( MessageBox::Show( "Do you want to paste over current selection?", - "Cut Example", MessageBoxButtons::YesNo ) == ::DialogResult::No ) - { - // Move selection to the point after the current selection and paste. - textBox1->SelectionStart = textBox1->SelectionStart + - textBox1->SelectionLength; - } - } - // Paste current text in Clipboard into text box. - textBox1->Paste(); - } - } - - void Menu_Undo( System::Object^ sender, System::EventArgs^ e ) - { - // Determine if last operation can be undone in text box. - if ( textBox1->CanUndo) - { - // Undo the last operation. - textBox1->Undo(); - // Clear the undo buffer to prevent last action from being redone. - textBox1->ClearUndo(); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp deleted file mode 100644 index 6316bd30260..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - bool flag; - -private: - void MyTextChangedHandler( System::Object^ sender, System::EventArgs^ e ) - { - Int64 val; - // Check the flag to prevent code re-entry. - if ( !flag ) - { - // Set the flag to True to prevent re-entry of the code below. - flag = true; - // Determine if the text of the control is a number. - try - { - // Attempt to convert to long - val = System::Convert::ToInt64( textBox1->Text ); - } - catch ( Exception^ ) - { - // Display a message box and clear the contents if not a number. - MessageBox::Show( "The text is not a valid number. Please re-enter" ); - // Clear the contents of the text box to allow re-entry. - textBox1->Clear(); - } - // Reset the flag so other TextChanged events are processed correctly. - flag = false; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp deleted file mode 100644 index 7fdf7511075..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void ViewMyTextBoxContents() - { - #if defined(DEBUG) - // Create a string array and store the contents of the Lines property. - array^ tempArray = gcnew array( textBox1->Lines->Length ); - tempArray = textBox1->Lines; - - // Loop through the array and send the contents of the array to debug window. - for ( int counter = 0; counter < tempArray->Length; counter++ ) - { - System::Diagnostics::Debug::WriteLine( tempArray[ counter ] ); - } - #endif - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp deleted file mode 100644 index f7e412ae348..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void CreateMyPasswordTextBox() - { - // Create an instance of the TextBox control. - TextBox^ textBox1 = gcnew TextBox; - // Set the maximum length of text in the control to eight. - textBox1->MaxLength = 8; - // Assign the asterisk to be the password character. - textBox1->PasswordChar = '*'; - // Change all text entered to be uppercase. - textBox1->CharacterCasing = CharacterCasing::Upper; - // Align the text in the center of the TextBox control. - textBox1->TextAlign = HorizontalAlignment::Center; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp deleted file mode 100644 index 53fc29349e2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - String^ originalText; - - // -private: - void TextBox1_TextChanged( Object^ sender, EventArgs^ e ) - { - /* Check to see if the change made does not return the - control to its original state. */ - if ( originalText != textBox1->Text ) - { - // Set the Modified property to true to reflect the change. - textBox1->Modified = true; - } - else - { - // Contents of textBox1 have not changed, reset the Modified property. - textBox1->Modified = false; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp deleted file mode 100644 index 7372767c14a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void SelectMyString() - { - // Create a string to search for the word "fox". - String^ searchString = "fox"; - // Determine the starting location of the word "fox". - int index = textBox1->Text->IndexOf( searchString, 16, 3 ); - // Determine if the word has been found and select it if it was. - if ( index != -1 ) - { - // Select the string using the index and the length of the string. - textBox1->Select( index,searchString->Length ); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp deleted file mode 100644 index 4e83d756261..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -public: - void CopyAllMyText() - { - // Determine if any text is selected in the TextBox control. - if ( textBox1->SelectionLength == 0 ) - { - // Select all text in the text box. - textBox1->SelectAll(); - } - - // Copy the contents of the control to the Clipboard. - textBox1->Copy(); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp deleted file mode 100644 index 98dfc092c04..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void Menu_Copy( System::Object^ sender, System::EventArgs^ e ) - { - // Ensure that text is selected in the text box. - if ( textBox1->SelectionLength > 0 ) - // Copy the selected text to the Clipboard. - textBox1->Copy(); - } - - void Menu_Cut( System::Object^ sender, System::EventArgs^ e ) - { - // Ensure that text is currently selected in the text box. - if ( !textBox1->SelectedText->Equals( "" ) ) - { - // Cut the selected text in the control and paste it into the Clipboard. - textBox1->Cut(); - } - } - - void Menu_Paste( System::Object^ sender, System::EventArgs^ e ) - { - // Determine if there is any text in the Clipboard to paste into the text box. - if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) - { - // Determine if any text is selected in the text box. - if ( textBox1->SelectionLength > 0 ) - { - // Ask user if they want to paste over currently selected text. - if ( MessageBox::Show( "Do you want to paste over current selection?", - "Cut Example", MessageBoxButtons::YesNo ) == ::DialogResult::No ) - { - // Move selection to the point after the current selection and paste. - textBox1->SelectionStart = textBox1->SelectionStart + textBox1->SelectionLength; - } - } - // Paste current text in Clipboard into text box. - textBox1->Paste(); - } - } - - void Menu_Undo( System::Object^ sender, System::EventArgs^ e ) - { - // Determine if last operation can be undone in text box. - if ( textBox1->CanUndo) - { - // Undo the last operation. - textBox1->Undo(); - // Clear the undo buffer to prevent last action from being redone. - textBox1->ClearUndo(); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp deleted file mode 100644 index b8c76b655e0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp +++ /dev/null @@ -1,71 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void Menu_Copy( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Ensure that text is selected in the text box. - if ( textBox1->SelectionLength > 0 ) - { - // Copy the selected text to the Clipboard. - textBox1->Copy(); - } - } - - void Menu_Cut( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Ensure that text is currently selected in the text box. - if ( !textBox1->SelectedText->Equals( "" ) ) - { - // Cut the selected text in the control and paste it into the Clipboard. - textBox1->Cut(); - } - } - - void Menu_Paste( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Determine if there is any text in the Clipboard to paste into the text box. - if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) - { - // Determine if any text is selected in the text box. - if ( textBox1->SelectionLength > 0 ) - { - // Ask user if they want to paste over currently selected text. - if ( MessageBox::Show( "Do you want to paste over current selection?", - "Cut Example", MessageBoxButtons::YesNo ) == ::DialogResult::No ) - { - // Move selection to the point after the current selection and paste. - textBox1->SelectionStart = textBox1->SelectionStart + textBox1->SelectionLength; - } - } - // Paste current text in Clipboard into text box. - textBox1->Paste(); - } - } - - void Menu_Undo( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Determine if last operation can be undone in text box. - if ( textBox1->CanUndo) - { - // Undo the last operation. - textBox1->Undo(); - // Clear the undo buffer to prevent last action from being redone. - textBox1->ClearUndo(); - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp deleted file mode 100644 index 0f1f797d060..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp +++ /dev/null @@ -1,67 +0,0 @@ - - -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -// -public ref class Class1 -{ -private: - static System::Windows::Forms::Timer^ myTimer = gcnew System::Windows::Forms::Timer; - static int alarmCounter = 1; - static bool exitFlag = false; - - // This is the method to run when the timer is raised. - static void TimerEventProcessor( Object^ /*myObject*/, EventArgs^ /*myEventArgs*/ ) - { - myTimer->Stop(); - - // Displays a message box asking whether to continue running the timer. - if ( MessageBox::Show( "Continue running?", String::Format( "Count is: {0}", alarmCounter ), MessageBoxButtons::YesNo ) == DialogResult::Yes ) - { - - // Restarts the timer and increments the counter. - alarmCounter += 1; - myTimer->Enabled = true; - } - else - { - - // Stops the timer. - exitFlag = true; - } - } - - -public: - static void Main() - { - - /* Adds the event and the event handler for the method that will - process the timer event to the timer. */ - myTimer->Tick += gcnew EventHandler( TimerEventProcessor ); - - // Sets the timer interval to 5 seconds. - myTimer->Interval = 5000; - myTimer->Start(); - - // Runs the timer, and raises the event. - while ( !exitFlag ) - { - - // Processes all the events in the queue. - Application::DoEvents(); - } - } - -}; - -int main() -{ - Class1::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp deleted file mode 100644 index 1f960a11e0a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ - // -public: - void InitializeMyToolBar() - { - // Create and initialize the ToolBarButton controls and ToolBar. - ToolBar^ toolBar1 = gcnew ToolBar; - ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; - - // Set the Text properties of the ToolBarButton controls. - toolBarButton1->Text = "Open"; - toolBarButton2->Text = "Save"; - toolBarButton3->Text = "Print"; - - // Add the ToolBarButton controls to the ToolBar. - toolBar1->Buttons->Add( toolBarButton1 ); - toolBar1->Buttons->Add( toolBarButton2 ); - toolBar1->Buttons->Add( toolBarButton3 ); - - // Add the ToolBar to the Form. - Controls->Add( toolBar1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp deleted file mode 100644 index 8fccbc33370..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ToolBar^ toolBar1; - PrintDialog^ printDialog1; - OpenFileDialog^ openFileDialog1; - SaveFileDialog^ saveFileDialog1; - - // -public: - void InitializeMyToolBar() - { - // Create and initialize the ToolBar and ToolBarButton controls. - toolBar1 = gcnew ToolBar; - ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; - - // Set the Text properties of the ToolBarButton controls. - toolBarButton1->Text = "Open"; - toolBarButton2->Text = "Save"; - toolBarButton3->Text = "Print"; - - // Add the ToolBarButton controls to the ToolBar. - toolBar1->Buttons->Add( toolBarButton1 ); - toolBar1->Buttons->Add( toolBarButton2 ); - toolBar1->Buttons->Add( toolBarButton3 ); - - // Add the event-handler delegate. - toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( - this, &Form1::toolBar1_ButtonClick ); - - // Add the ToolBar to the Form. - Controls->Add( toolBar1 ); - } - -private: - void toolBar1_ButtonClick( - Object^ sender, - ToolBarButtonClickEventArgs^ e ) - { - // Evaluate the Button property to determine which button was clicked. - switch ( toolBar1->Buttons->IndexOf( e->Button ) ) - { - case 0: - openFileDialog1->ShowDialog(); - // Insert code to open the file. - break; - case 1: - saveFileDialog1->ShowDialog(); - // Insert code to save the file. - break; - case 2: - printDialog1->ShowDialog(); - // Insert code to print the file. - break; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp deleted file mode 100644 index 854f1c295b2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ToolBar^ toolBar1; - - // -public: - void AddMyButton() - { - ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; - toolBarButton1->Text = "Print"; - - // Add the new toolbar button to the toolbar. - toolBar1->Buttons->Add( toolBarButton1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp deleted file mode 100644 index 437e7d3cbc5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ToolBar^ toolBar1; - - // -public: - void ClearMyToolBar() - { - int btns; - // Get the count before the Clear method is called. - btns = toolBar1->Buttons->Count; - toolBar1->Buttons->Clear(); - MessageBox::Show( "Count Before Clear: " + btns.ToString() + - "\nCount After Clear: " + toolBar1->Buttons->Count.ToString() ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp deleted file mode 100644 index 5b6185f02a9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ToolBar^ toolBar1; - PrintDialog^ printDialog1; - OpenFileDialog^ openFileDialog1; - SaveFileDialog^ saveFileDialog1; - - // -public: - void InitializeMyToolBar() - { - // Create and initialize the ToolBar and ToolBarButton controls. - toolBar1 = gcnew ToolBar; - ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; - - // Set the Text properties of the ToolBarButton controls. - toolBarButton1->Text = "Open"; - toolBarButton2->Text = "Save"; - toolBarButton3->Text = "Print"; - - // Add the ToolBarButton controls to the ToolBar. - toolBar1->Buttons->Add( toolBarButton1 ); - toolBar1->Buttons->Add( toolBarButton2 ); - toolBar1->Buttons->Add( toolBarButton3 ); - - // Add the event-handler delegate. - toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( - this, &Form1::toolBar1_ButtonClick ); - - // Add the ToolBar to the Form. - Controls->Add( toolBar1 ); - } - -private: - void toolBar1_ButtonClick( - Object^ sender, - ToolBarButtonClickEventArgs^ e ) - { - // Evaluate the Button property to determine which button was clicked. - switch ( toolBar1->Buttons->IndexOf( e->Button ) ) - { - case 0: - openFileDialog1->ShowDialog(); - // Insert additional code here to open the file. - break; - case 1: - saveFileDialog1->ShowDialog(); - // Insert additional code here to save the file. - break; - case 2: - printDialog1->ShowDialog(); - // Insert additional code here to print the file. - break; - } - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp deleted file mode 100644 index 4469a0000fa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ToolBar^ toolBar1; - - // -public: - void RemoveMyButton() - { - int btns; - btns = toolBar1->Buttons->Count; - - // Remove the last toolbar button. - toolBar1->Buttons->RemoveAt( btns - 1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp deleted file mode 100644 index 9102dc54226..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp +++ /dev/null @@ -1,31 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -protected: - ToolBar^ toolBar1; - -public: - - // - void ReplaceMyToolBarButton() - { - int btns; - btns = toolBar1->Buttons->Count; - ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; - toolBarButton1->Text = "myButton"; - - // Replace the last ToolBarButton in the collection. - toolBar1->Buttons[ btns - 1 ] = toolBarButton1; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp deleted file mode 100644 index 9120c95e878..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - ImageList^ imageList1; - System::Windows::Forms::ContextMenu^ contextMenu1; - MenuItem^ menuItem1; - - // -public: - void InitializeMyToolBar() - { - // Create the ToolBar, ToolBarButton controls, and menus. - ToolBarButton^ toolBarButton1 = gcnew ToolBarButton( "Open" ); - ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; - ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; - ToolBar^ toolBar1 = gcnew ToolBar; - MenuItem^ menuItem1 = gcnew MenuItem( "Print" ); - array^ temp1 = {menuItem1}; - System::Windows::Forms::ContextMenu^ contextMenu1 = - gcnew System::Windows::Forms::ContextMenu( temp1 ); - - // Add the ToolBarButton controls to the ToolBar. - toolBar1->Buttons->Add( toolBarButton1 ); - toolBar1->Buttons->Add( toolBarButton2 ); - toolBar1->Buttons->Add( toolBarButton3 ); - - // Assign an ImageList to the ToolBar and show ToolTips. - toolBar1->ImageList = imageList1; - toolBar1->ShowToolTips = true; - - /* Assign ImageIndex, ContextMenu, Text, ToolTip, and - Style properties of the ToolBarButton controls. */ - toolBarButton2->Style = ToolBarButtonStyle::Separator; - toolBarButton3->Text = "Print"; - toolBarButton3->Style = ToolBarButtonStyle::DropDownButton; - toolBarButton3->ToolTipText = "Print"; - toolBarButton3->ImageIndex = 0; - toolBarButton3->DropDownMenu = contextMenu1; - - // Add the ToolBar to a form. - Controls->Add( toolBar1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp deleted file mode 100644 index e14a25a6457..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; - -public ref class Sample -{ -public: - enum class MyPropertyEnum - { - option1, option2, option3 - }; - - ref class MyClassConverter - { - }; - - // -public: - [TypeConverter(Sample::MyClassConverter::typeid)] - ref class MyClass - { - // Insert code here. - }; - // - - // -public: - property MyPropertyEnum MyProperty - { - void set( MyPropertyEnum value ) - { - // Checks to see if the value passed is valid. - if ( !TypeDescriptor::GetConverter( MyPropertyEnum::typeid )->IsValid( value ) ) - { - throw gcnew ArgumentException; - } - // The value is valid. Insert code to set the property. - } - } - // - - void Method1() - { - // - Color c = Color::Red; - Console::WriteLine( TypeDescriptor::GetConverter( c )->ConvertToString( c ) ); - // - } - - void Method2() - { - // - Color c = (Color)(TypeDescriptor::GetConverter( Color::typeid )->ConvertFromString( "Red" )); - // - } - - void Method3() - { - // - for each ( Color c in TypeDescriptor::GetConverter( Color::typeid )->GetStandardValues() ) - { - Console::WriteLine( TypeDescriptor::GetConverter( c )->ConvertToString( c ) ); - } - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp deleted file mode 100644 index 025487381ce..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,37 +0,0 @@ - - -#using - -using namespace System; -using namespace System::IO; -using namespace System::ComponentModel; - -public ref class Class1 -{ -public: - ref class MyClassConverter: public TypeConverter{}; - - // - [TypeConverter(Class1::MyClassConverter::typeid)] - ref class MyClass{ - // Insert code here. - }; - // -}; - -// -int main() -{ - // Creates a new instance of MyClass. - Class1::MyClass^ myNewClass = gcnew Class1::MyClass; - - // Gets the attributes for the instance. - AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewClass ); - - /* Prints the name of the type converter by retrieving the - * TypeConverterAttribute from the AttributeCollection. */ - TypeConverterAttribute^ myAttribute = dynamic_cast(attributes[ TypeConverterAttribute::typeid ]); - Console::WriteLine( "The type converter for this class is: {0}", myAttribute->ConverterTypeName ); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp deleted file mode 100644 index 3bf08bad06d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp +++ /dev/null @@ -1,106 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - ComboBox^ comboBox1; - ComboBox^ comboBox2; - NumericUpDown^ numericUpDown1; - -private: - - // - void comboBox1_SelectedIndexChanged( Object^ sender, EventArgs^ e ) - { - // Set the BorderStyle property. - if ( !String::Compare( comboBox1->Text, "Fixed3D" ) ) - { - numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - } - else - if ( !String::Compare( comboBox1->Text, "None" ) ) - { - numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::None; - } - else - if ( !String::Compare( comboBox1->Text, "FixedSingle" ) ) - { - numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - } - } - - void comboBox2_SelectedIndexChanged( Object^ sender, EventArgs^ e ) - { - // Set the TextAlign property. - if ( !String::Compare( comboBox2->Text, "Right" ) ) - { - numericUpDown1->TextAlign = HorizontalAlignment::Right; - } - else - if ( !String::Compare( comboBox1->Text, "Left" ) ) - { - numericUpDown1->TextAlign = HorizontalAlignment::Left; - } - else - if ( !String::Compare( comboBox1->Text, "Center" ) ) - { - numericUpDown1->TextAlign = HorizontalAlignment::Center; - } - } - - void checkBox1_Click( Object^ sender, EventArgs^ e ) - { - // Evaluate and toggle the ReadOnly property. - if ( numericUpDown1->ReadOnly ) - { - numericUpDown1->ReadOnly = false; - } - else - { - numericUpDown1->ReadOnly = true; - } - } - - void checkBox2_Click( Object^ sender, EventArgs^ e ) - { - // Evaluate and toggle the InterceptArrowKeys property. - if ( numericUpDown1->InterceptArrowKeys ) - { - numericUpDown1->InterceptArrowKeys = false; - } - else - { - numericUpDown1->InterceptArrowKeys = true; - } - } - - void checkBox3_Click( Object^ sender, EventArgs^ e ) - { - // Evaluate and toggle the UpDownAlign property. - if ( numericUpDown1->UpDownAlign == LeftRightAlignment::Left ) - { - numericUpDown1->UpDownAlign = LeftRightAlignment::Right; - } - else - { - numericUpDown1->UpDownAlign = LeftRightAlignment::Left; - } - } - // -}; - -__int32 main() -{ - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp deleted file mode 100644 index 26af55578bd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - ComboBox^ comboBox1; - ComboBox^ comboBox2; - NumericUpDown^ numericUpDown1; - -private: - - // - void comboBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Set the BorderStyle property. - if ( comboBox1->Text->Equals( "Fixed3D" ) ) - numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - else - if ( comboBox1->Text->Equals( "None" ) ) - numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::None; - else - if ( comboBox1->Text->Equals( "FixedSingle" ) ) - numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - } - - void comboBox2_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Set the TextAlign property. - if ( comboBox2->Text->Equals( "Right" ) ) - numericUpDown1->TextAlign = HorizontalAlignment::Right; - - if ( comboBox2->Text->Equals( "Left" ) ) - numericUpDown1->TextAlign = HorizontalAlignment::Left; - - if ( comboBox2->Text->Equals( "Center" ) ) - numericUpDown1->TextAlign = HorizontalAlignment::Center; - } - - void checkBox1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Evaluate and toggle the ReadOnly property. - if ( numericUpDown1->ReadOnly ) - { - numericUpDown1->ReadOnly = false; - } - else - { - numericUpDown1->ReadOnly = true; - } - } - - void checkBox2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Evaluate and toggle the InterceptArrowKeys property. - if ( numericUpDown1->InterceptArrowKeys ) - { - numericUpDown1->InterceptArrowKeys = false; - } - else - { - numericUpDown1->InterceptArrowKeys = true; - } - } - - void checkBox3_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Evaluate and toggle the UpDownAlign property. - if ( numericUpDown1->UpDownAlign == LeftRightAlignment::Left ) - { - numericUpDown1->UpDownAlign = LeftRightAlignment::Right; - } - else - { - numericUpDown1->UpDownAlign = LeftRightAlignment::Left; - } - } - - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp deleted file mode 100644 index f6bae37132f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - NumericUpDown^ numericUpDown1; - -private: - - // - void numericUpDown1_Leave( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - /* If the entered value is greater than Minimum or Maximum, - select the text and open a message box. */ - if ( (System::Convert::ToInt32( numericUpDown1->Text ) > numericUpDown1->Maximum) || (System::Convert::ToInt32( numericUpDown1->Text ) < numericUpDown1->Minimum) ) - { - MessageBox::Show( "The value entered was not between the Minimum andMaximum allowable values.\nPlease re-enter." ); - numericUpDown1->Focus(); - numericUpDown1->Select(0,numericUpDown1->Text->Length); - } - } - - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - int varPrefHeight1; - - /* Capture the PreferredHeight before and after the Font - is changed, and display the results in a message box. */ - varPrefHeight1 = numericUpDown1->PreferredHeight; - numericUpDown1->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",12.0,System::Drawing::FontStyle::Bold ); - MessageBox::Show( String::Format( "Before Font Change: {0}\nAfter Font Change: {1}", varPrefHeight1, numericUpDown1->PreferredHeight ) ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp deleted file mode 100644 index f8c9570d3b3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp +++ /dev/null @@ -1,163 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::ComponentModel; - -namespace UserControls -{ - public ref class MyCustomerInfoUserControl: public System::Windows::Forms::UserControl - { - private: - - // Create the controls. - System::Windows::Forms::ErrorProvider^ errorProvider1; - System::Windows::Forms::TextBox^ textName; - System::Windows::Forms::TextBox^ textAddress; - System::Windows::Forms::TextBox^ textCity; - System::Windows::Forms::TextBox^ textStateProvince; - System::Windows::Forms::TextBox^ textPostal; - System::Windows::Forms::TextBox^ textCountryRegion; - System::Windows::Forms::TextBox^ textEmail; - System::Windows::Forms::Label ^ labelName; - System::Windows::Forms::Label ^ labelAddress; - System::Windows::Forms::Label ^ labelCityStateProvincePostal; - System::Windows::Forms::Label ^ labelCountryRegion; - System::Windows::Forms::Label ^ labelEmail; - System::ComponentModel::IContainer^ components; - - public: - - // Define the constructor. - MyCustomerInfoUserControl() - { - InitializeComponent(); - } - - // Initialize the control elements. - void InitializeComponent() - { - // Initialize the controls. - components = gcnew System::ComponentModel::Container; - errorProvider1 = gcnew System::Windows::Forms::ErrorProvider; - textName = gcnew System::Windows::Forms::TextBox; - textAddress = gcnew System::Windows::Forms::TextBox; - textCity = gcnew System::Windows::Forms::TextBox; - textStateProvince = gcnew System::Windows::Forms::TextBox; - textPostal = gcnew System::Windows::Forms::TextBox; - textCountryRegion = gcnew System::Windows::Forms::TextBox; - textEmail = gcnew System::Windows::Forms::TextBox; - labelName = gcnew System::Windows::Forms::Label; - labelAddress = gcnew System::Windows::Forms::Label; - labelCityStateProvincePostal = gcnew System::Windows::Forms::Label; - labelCountryRegion = gcnew System::Windows::Forms::Label; - labelEmail = gcnew System::Windows::Forms::Label; - - // Set the tab order, text alignment, size, and location of the controls. - textName->Location = System::Drawing::Point( 120, 8 ); - textName->Size = System::Drawing::Size( 232, 20 ); - textName->TabIndex = 0; - textAddress->Location = System::Drawing::Point( 120, 32 ); - textAddress->Size = System::Drawing::Size( 232, 20 ); - textAddress->TabIndex = 1; - textCity->Location = System::Drawing::Point( 120, 56 ); - textCity->Size = System::Drawing::Size( 96, 20 ); - textCity->TabIndex = 2; - textStateProvince->Location = System::Drawing::Point( 216, 56 ); - textStateProvince->Size = System::Drawing::Size( 56, 20 ); - textStateProvince->TabIndex = 3; - textPostal->Location = System::Drawing::Point( 272, 56 ); - textPostal->Size = System::Drawing::Size( 80, 20 ); - textPostal->TabIndex = 4; - textCountryRegion->Location = System::Drawing::Point( 120, 80 ); - textCountryRegion->Size = System::Drawing::Size( 232, 20 ); - textCountryRegion->TabIndex = 5; - textEmail->Location = System::Drawing::Point( 120, 104 ); - textEmail->Size = System::Drawing::Size( 232, 20 ); - textEmail->TabIndex = 6; - labelName->Location = System::Drawing::Point( 8, 8 ); - labelName->Size = System::Drawing::Size( 112, 23 ); - labelName->Text = "Name:"; - labelName->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelAddress->Location = System::Drawing::Point( 8, 32 ); - labelAddress->Size = System::Drawing::Size( 112, 23 ); - labelAddress->Text = "Address:"; - labelAddress->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelCityStateProvincePostal->Location = System::Drawing::Point( 8, 56 ); - labelCityStateProvincePostal->Size = System::Drawing::Size( 112, 23 ); - labelCityStateProvincePostal->Text = "City, St/Prov. Postal:"; - labelCityStateProvincePostal->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelCountryRegion->Location = System::Drawing::Point( 8, 80 ); - labelCountryRegion->Size = System::Drawing::Size( 112, 23 ); - labelCountryRegion->Text = "Country/Region:"; - labelCountryRegion->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelEmail->Location = System::Drawing::Point( 8, 104 ); - labelEmail->Size = System::Drawing::Size( 112, 23 ); - labelEmail->Text = "email:"; - labelEmail->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - - // Add the Validating and Validated handlers for textEmail. - textEmail->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &MyCustomerInfoUserControl::textEmail_Validating ); - textEmail->Validated += gcnew System::EventHandler( this, &MyCustomerInfoUserControl::textEmail_Validated ); - - // Add the controls to the user control. - array^temp0 = {labelName,labelAddress,labelCityStateProvincePostal,labelCountryRegion,labelEmail,textName,textAddress,textCity,textStateProvince,textPostal,textCountryRegion,textEmail}; - Controls->AddRange( temp0 ); - - // Size the user control. - Size = System::Drawing::Size( 375, 150 ); - } - - private: - void MyValidatingCode() - { - // Confirm there is text in the control. - if ( textEmail->Text->Length == 0 ) - { - throw gcnew Exception( "Email address is a required field." ); - } - // Confirm that there is a "." and an "@" in the email address. - else - - // Confirm that there is a "." and an "@" in the email address. - if ( textEmail->Text->IndexOf( "." ) == -1 || textEmail->Text->IndexOf( "@" ) == -1 ) - { - throw gcnew Exception( "Email address must be valid email address format.\nFor example: 'someone@example.com'" ); - } - } - - // Validate the data input by the user into textEmail. - void textEmail_Validating( Object^ /*sender*/, System::ComponentModel::CancelEventArgs^ e ) - { - try - { - MyValidatingCode(); - } - catch ( Exception^ ex ) - { - // Cancel the event and select the text to be corrected by the user. - e->Cancel = true; - textEmail->Select(0,textEmail->Text->Length); - - // Set the ErrorProvider error with the text to display. - this->errorProvider1->SetError( textEmail, ex->Message ); - } - } - - void textEmail_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - //If all conditions have been met, clear the error provider of errors. - errorProvider1->SetError( textEmail, "" ); - } - }; -} - -// End Class -// End Namespace -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp deleted file mode 100644 index aeb8812aaae..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp +++ /dev/null @@ -1,219 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -namespace UserControls -{ - public ref class MyCustomerInfoUserControl: public System::Windows::Forms::UserControl - { - private: - - // Create the controls. - System::Windows::Forms::ErrorProvider^ errorProvider1; - System::Windows::Forms::TextBox^ textName; - System::Windows::Forms::TextBox^ textAddress; - System::Windows::Forms::TextBox^ textCity; - System::Windows::Forms::TextBox^ textStateProvince; - System::Windows::Forms::TextBox^ textPostal; - System::Windows::Forms::TextBox^ textCountryRegion; - System::Windows::Forms::TextBox^ textEmail; - System::Windows::Forms::Label ^ labelName; - System::Windows::Forms::Label ^ labelAddress; - System::Windows::Forms::Label ^ labelCityStateProvincePostal; - System::Windows::Forms::Label ^ labelCountryRegion; - System::Windows::Forms::Label ^ labelEmail; - System::ComponentModel::IContainer^ components; - - public: - - // Define the constructor. - MyCustomerInfoUserControl() - { - InitializeComponent(); - } - - // Initialize the control elements. - void InitializeComponent() - { - // Initialize the controls. - components = gcnew System::ComponentModel::Container; - errorProvider1 = gcnew System::Windows::Forms::ErrorProvider; - textName = gcnew System::Windows::Forms::TextBox; - textAddress = gcnew System::Windows::Forms::TextBox; - textCity = gcnew System::Windows::Forms::TextBox; - textStateProvince = gcnew System::Windows::Forms::TextBox; - textPostal = gcnew System::Windows::Forms::TextBox; - textCountryRegion = gcnew System::Windows::Forms::TextBox; - textEmail = gcnew System::Windows::Forms::TextBox; - labelName = gcnew System::Windows::Forms::Label; - labelAddress = gcnew System::Windows::Forms::Label; - labelCityStateProvincePostal = gcnew System::Windows::Forms::Label; - labelCountryRegion = gcnew System::Windows::Forms::Label; - labelEmail = gcnew System::Windows::Forms::Label; - - // Set the tab order, text alignment, size, and location of the controls. - textName->Location = System::Drawing::Point( 120, 8 ); - textName->Size = System::Drawing::Size( 232, 20 ); - textName->TabIndex = 0; - textAddress->Location = System::Drawing::Point( 120, 32 ); - textAddress->Size = System::Drawing::Size( 232, 20 ); - textAddress->TabIndex = 1; - textCity->Location = System::Drawing::Point( 120, 56 ); - textCity->Size = System::Drawing::Size( 96, 20 ); - textCity->TabIndex = 2; - textStateProvince->Location = System::Drawing::Point( 216, 56 ); - textStateProvince->Size = System::Drawing::Size( 56, 20 ); - textStateProvince->TabIndex = 3; - textPostal->Location = System::Drawing::Point( 272, 56 ); - textPostal->Size = System::Drawing::Size( 80, 20 ); - textPostal->TabIndex = 4; - textCountryRegion->Location = System::Drawing::Point( 120, 80 ); - textCountryRegion->Size = System::Drawing::Size( 232, 20 ); - textCountryRegion->TabIndex = 5; - textEmail->Location = System::Drawing::Point( 120, 104 ); - textEmail->Size = System::Drawing::Size( 232, 20 ); - textEmail->TabIndex = 6; - labelName->Location = System::Drawing::Point( 8, 8 ); - labelName->Size = System::Drawing::Size( 112, 23 ); - labelName->Text = "Name:"; - labelName->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelAddress->Location = System::Drawing::Point( 8, 32 ); - labelAddress->Size = System::Drawing::Size( 112, 23 ); - labelAddress->Text = "Address:"; - labelAddress->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelCityStateProvincePostal->Location = System::Drawing::Point( 8, 56 ); - labelCityStateProvincePostal->Size = System::Drawing::Size( 112, 23 ); - labelCityStateProvincePostal->Text = "City, St/Prov. Postal:"; - labelCityStateProvincePostal->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelCountryRegion->Location = System::Drawing::Point( 8, 80 ); - labelCountryRegion->Size = System::Drawing::Size( 112, 23 ); - labelCountryRegion->Text = "Country/Region:"; - labelCountryRegion->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - labelEmail->Location = System::Drawing::Point( 8, 104 ); - labelEmail->Size = System::Drawing::Size( 112, 23 ); - labelEmail->Text = "email:"; - labelEmail->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - - // Add the Validating and Validated handlers for textEmail. - textEmail->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &MyCustomerInfoUserControl::textEmail_Validating ); - textEmail->Validated += gcnew System::EventHandler( this, &MyCustomerInfoUserControl::textEmail_Validated ); - - // Add the controls to the user control. - array^temp0 = {labelName,labelAddress,labelCityStateProvincePostal,labelCountryRegion,labelEmail,textName,textAddress,textCity,textStateProvince,textPostal,textCountryRegion,textEmail}; - Controls->AddRange( temp0 ); - - // Size the user control. - Size = System::Drawing::Size( 375, 150 ); - } - - private: - void MyValidatingCode() - { - // Confirm there is text in the control. - if ( textEmail->Text->Length == 0 ) - { - throw gcnew Exception( "Email address is a required field." ); - } - // Confirm that there is a "." and an "@" in the email address. - else - - // Confirm that there is a "." and an "@" in the email address. - if ( textEmail->Text->IndexOf( "." ) == -1 || textEmail->Text->IndexOf( "@" ) == -1 ) - { - throw gcnew Exception( "Email address must be valid email address format.\nFor example: 'someone@example.com'" ); - } - } - - // Validate the data input by the user into textEmail. - void textEmail_Validating( Object^ /*sender*/, System::ComponentModel::CancelEventArgs^ e ) - { - try - { - MyValidatingCode(); - } - catch ( Exception^ ex ) - { - // Cancel the event and select the text to be corrected by the user. - e->Cancel = true; - textEmail->Select(0,textEmail->Text->Length); - - // Set the ErrorProvider error with the text to display. - this->errorProvider1->SetError( textEmail, ex->Message ); - } - - } - - void textEmail_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - //If all conditions have been met, clear the error provider of errors. - errorProvider1->SetError( textEmail, "" ); - } - }; -} - -// End Class -// End Namespace -////////////////////////////////////////////////////////////////////////////////////// -// -public ref class MyUserControlHost: public System::Windows::Forms::Form -{ -private: - - // Create the controls. - System::ComponentModel::IContainer^ components; - System::Windows::Forms::Panel^ panel1; - UserControls::MyCustomerInfoUserControl^ myUserControl; - -public: - - // Define the constructor. - MyUserControlHost() - { - this->InitializeComponent(); - } - - -private: - - // Add a Panel control to a Form and host the UserControl in the Panel. - void InitializeComponent() - { - components = gcnew System::ComponentModel::Container; - panel1 = gcnew System::Windows::Forms::Panel; - myUserControl = gcnew UserControls::MyCustomerInfoUserControl; - - // Set the DockStyle of the UserControl to Fill. - myUserControl->Dock = System::Windows::Forms::DockStyle::Fill; - - // Make the Panel the same size as the UserControl and give it a border. - panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - panel1->Size = myUserControl->Size; - panel1->Location = System::Drawing::Point( 5, 5 ); - - // Add the user control to the Panel. - panel1->Controls->Add( myUserControl ); - - // Size the Form to accommodate the Panel. - this->ClientSize = System::Drawing::Size( panel1->Size.Width + 10, panel1->Size.Height + 10 ); - this->Text = "Please enter the information below..."; - - // Add the Panel to the Form. - this->Controls->Add( panel1 ); - } -}; -// End Class - -[System::STAThreadAttribute] -int main() -{ - System::Windows::Forms::Application::Run( gcnew MyUserControlHost ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp deleted file mode 100644 index 170507cec4f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp +++ /dev/null @@ -1,30 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - TextBox^ textBox1; - - // -private: - void InitializeMyScrollBar() - { - // Create and initialize a VScrollBar. - VScrollBar^ vScrollBar1 = gcnew VScrollBar; - - // Dock the scroll bar to the right side of the form. - vScrollBar1->Dock = DockStyle::Right; - - // Add the scroll bar to the form. - Controls->Add( vScrollBar1 ); - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp b/snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp deleted file mode 100644 index e7b0a3a4016..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - InitializeMyMenu(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - -public: - - /// - /// The main entry point for the application. - /// - // - void InitializeMyMenu() - { - // Create the MainMenu Object*. - MainMenu^ myMainMenu = gcnew MainMenu; - - // Create the MenuItem objects. - MenuItem^ fileMenu = gcnew MenuItem( "&File" ); - MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); - MenuItem^ newFile = gcnew MenuItem( "&New" ); - MenuItem^ openFile = gcnew MenuItem( "&Open" ); - MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); - - // Add the MenuItem objects to myMainMenu. - myMainMenu->MenuItems->Add( fileMenu ); - myMainMenu->MenuItems->Add( editMenu ); - - // Add three submenus to the File menu. - fileMenu->MenuItems->Add( newFile ); - fileMenu->MenuItems->Add( openFile ); - fileMenu->MenuItems->Add( exitProgram ); - - // Assign myMainMenu to the form. - this->Menu = myMainMenu; - - // Clear the File menu items. - fileMenu->MenuItems->Clear(); - } - // - -private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp deleted file mode 100644 index 4c0476cfc6c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - CloneMyMainMenu(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - /// - /// The main entry point for the application. - /// - - [STAThread] - // - void CloneMyMainMenu() - { - // Create the main menu. - MainMenu^ mainMenu1 = gcnew MainMenu; - - // Create the menu items to add. - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - MenuItem^ menuItem3 = gcnew MenuItem; - - // Set the caption for the menu items. - menuItem1->Text = "File"; - menuItem2->Text = "Edit"; - menuItem3->Text = "View"; - - // Add the menu item to mainMenu1. - mainMenu1->MenuItems->Add( menuItem1 ); - mainMenu1->MenuItems->Add( menuItem2 ); - mainMenu1->MenuItems->Add( menuItem3 ); - - // Clone the mainMenu1 and name it mainMenu2. - MainMenu^ mainMenu2 = mainMenu1->CloneMenu(); - - // Assign mainMenu2 to the form. - Menu = mainMenu2; - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp deleted file mode 100644 index 8369c604261..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::ComponentModel::Design::Serialization; - -namespace CodeDomSerializerExceptionExample -{ - ref class CodeDomSerializerExceptionExample - { - private: - [STAThread] - static void Main() - { - // - throw gcnew CodeDomSerializerException( "This exception was raised as an example.", gcnew CodeLinePragma( "Example.txt", 20 ) ); - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp b/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp deleted file mode 100644 index faf2936a81c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -public ref class Win32Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ addButton; - System::Windows::Forms::TextBox^ textBox2; - System::Windows::Forms::Button^ addGrandButton; - System::Windows::Forms::ComboBox^ comboBox1; - System::Windows::Forms::Button^ showSelectedButton; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ findButton; - System::Windows::Forms::Label ^ label1; - -public: - Win32Form1() - { - this->InitializeComponent(); - } - -private: - void InitializeComponent() - { - this->addButton = gcnew System::Windows::Forms::Button; - this->textBox2 = gcnew System::Windows::Forms::TextBox; - this->addGrandButton = gcnew System::Windows::Forms::Button; - this->comboBox1 = gcnew System::Windows::Forms::ComboBox; - this->showSelectedButton = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->findButton = gcnew System::Windows::Forms::Button; - this->label1 = gcnew System::Windows::Forms::Label; - this->addButton->Location = System::Drawing::Point( 248, 32 ); - this->addButton->Size = System::Drawing::Size( 40, 24 ); - this->addButton->TabIndex = 1; - this->addButton->Text = "Add"; - this->addButton->Click += gcnew System::EventHandler( - this, &Win32Form1::addButton_Click ); - this->textBox2->Location = System::Drawing::Point( 8, 64 ); - this->textBox2->Size = System::Drawing::Size( 232, 20 ); - this->textBox2->TabIndex = 6; - this->textBox2->Text = ""; - this->addGrandButton->Location = System::Drawing::Point( 8, 96 ); - this->addGrandButton->Size = System::Drawing::Size( 280, 23 ); - this->addGrandButton->TabIndex = 2; - this->addGrandButton->Text = "Add 1, 000 Items"; - this->addGrandButton->Click += gcnew System::EventHandler( - this, &Win32Form1::addGrandButton_Click ); - this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)( - (System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left) | - System::Windows::Forms::AnchorStyles::Right); - this->comboBox1->DropDownWidth = 280; - array^ objectArray = {"Item 1", - "Item 2", - "Item 3", - "Item 4", - "Item 5"}; - this->comboBox1->Items->AddRange( objectArray ); - this->comboBox1->Location = System::Drawing::Point( 8, 248 ); - this->comboBox1->Size = System::Drawing::Size( 280, 21 ); - this->comboBox1->TabIndex = 7; - this->showSelectedButton->Location = System::Drawing::Point( 8, 128 ); - this->showSelectedButton->Size = System::Drawing::Size( 280, 24 ); - this->showSelectedButton->TabIndex = 4; - this->showSelectedButton->Text = "What Item is Selected?"; - this->showSelectedButton->Click += gcnew System::EventHandler( this, &Win32Form1::showSelectedButton_Click ); - this->textBox1->Location = System::Drawing::Point( 8, 32 ); - this->textBox1->Size = System::Drawing::Size( 232, 20 ); - this->textBox1->TabIndex = 5; - this->textBox1->Text = ""; - this->findButton->Location = System::Drawing::Point( 248, 64 ); - this->findButton->Size = System::Drawing::Size( 40, 24 ); - this->findButton->TabIndex = 3; - this->findButton->Text = "Find"; - this->findButton->Click += gcnew System::EventHandler( this, &Win32Form1::findButton_Click ); - this->label1->Location = System::Drawing::Point( 8, 224 ); - this->label1->Size = System::Drawing::Size( 144, 23 ); - this->label1->TabIndex = 0; - this->label1->Text = "Test ComboBox"; - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^ controlArray = {this->comboBox1, - this->textBox2, - this->textBox1, - this->showSelectedButton, - this->findButton, - this->addGrandButton, - this->addButton, - this->label1}; - this->Controls->AddRange( controlArray ); - this->Text = "ComboBox Sample"; - } - - // - void addButton_Click( Object^ sender, System::EventArgs^ e ) - { - comboBox1->Items->Add( textBox1->Text ); - } - // - - // - void addGrandButton_Click( Object^ sender, System::EventArgs^ e ) - { - comboBox1->BeginUpdate(); - for ( int i = 0; i < 1000; i++ ) - { - comboBox1->Items->Add( "New Item " + i.ToString() ); - } - comboBox1->EndUpdate(); - } - // - - // - void findButton_Click( Object^ sender, System::EventArgs^ e ) - { - int index = comboBox1->FindString( textBox2->Text ); - comboBox1->SelectedIndex = index; - } - // - - // - void showSelectedButton_Click( Object^ sender, System::EventArgs^ e ) - { - int selectedIndex = comboBox1->SelectedIndex; - Object^ selectedItem = comboBox1->SelectedItem; - MessageBox::Show( "Selected Item Text: " + selectedItem->ToString() + "\n" + - "Index: " + selectedIndex.ToString() ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - System::Windows::Forms::Application::Run( gcnew Win32Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp b/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp deleted file mode 100644 index af6e1f48f45..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -namespace Win32Form1Namespace -{ - public ref class Win32Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ addButton; - System::Windows::Forms::TextBox^ textBox2; - System::Windows::Forms::Button^ addGrandButton; - System::Windows::Forms::ComboBox^ comboBox1; - System::Windows::Forms::Button^ showSelectedButton; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ findButton; - System::Windows::Forms::Label ^ label1; - - public: - Win32Form1() - { - this->InitializeComponent(); - } - - private: - void InitializeComponent() - { - this->addButton = gcnew System::Windows::Forms::Button; - this->textBox2 = gcnew System::Windows::Forms::TextBox; - this->addGrandButton = gcnew System::Windows::Forms::Button; - this->comboBox1 = gcnew System::Windows::Forms::ComboBox; - this->showSelectedButton = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->findButton = gcnew System::Windows::Forms::Button; - this->label1 = gcnew System::Windows::Forms::Label; - this->addButton->Location = System::Drawing::Point( 248, 32 ); - this->addButton->Size = System::Drawing::Size( 40, 24 ); - this->addButton->TabIndex = 1; - this->addButton->Text = "Add"; - this->addButton->Click += gcnew System::EventHandler( - this, &Win32Form1::addButton_Click ); - this->textBox2->Location = System::Drawing::Point( 8, 64 ); - this->textBox2->Size = System::Drawing::Size( 232, 20 ); - this->textBox2->TabIndex = 6; - this->textBox2->Text = ""; - this->addGrandButton->Location = System::Drawing::Point( 8, 96 ); - this->addGrandButton->Size = System::Drawing::Size( 280, 23 ); - this->addGrandButton->TabIndex = 2; - this->addGrandButton->Text = "Add 1, 000 Items"; - this->addGrandButton->Click += gcnew System::EventHandler( - this, &Win32Form1::addGrandButton_Click ); - this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)( - (System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left) | - System::Windows::Forms::AnchorStyles::Right); - this->comboBox1->DropDownWidth = 280; - array^ objectArray = {"Item 1", - "Item 2", - "Item 3", - "Item 4", - "Item 5"}; - this->comboBox1->Items->AddRange( objectArray ); - this->comboBox1->Location = System::Drawing::Point( 8, 248 ); - this->comboBox1->Size = System::Drawing::Size( 280, 21 ); - this->comboBox1->TabIndex = 7; - this->showSelectedButton->Location = System::Drawing::Point( 8, 128 ); - this->showSelectedButton->Size = System::Drawing::Size( 280, 24 ); - this->showSelectedButton->TabIndex = 4; - this->showSelectedButton->Text = "What Item is Selected?"; - this->showSelectedButton->Click += gcnew System::EventHandler( - this, &Win32Form1::showSelectedButton_Click ); - this->textBox1->Location = System::Drawing::Point( 8, 32 ); - this->textBox1->Size = System::Drawing::Size( 232, 20 ); - this->textBox1->TabIndex = 5; - this->textBox1->Text = ""; - this->findButton->Location = System::Drawing::Point( 248, 64 ); - this->findButton->Size = System::Drawing::Size( 40, 24 ); - this->findButton->TabIndex = 3; - this->findButton->Text = "Find"; - this->findButton->Click += gcnew System::EventHandler( - this, &Win32Form1::findButton_Click ); - this->label1->Location = System::Drawing::Point( 8, 224 ); - this->label1->Size = System::Drawing::Size( 144, 23 ); - this->label1->TabIndex = 0; - this->label1->Text = "Test ComboBox"; - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^ controlsArray = {this->comboBox1, - this->textBox2, - this->textBox1, - this->showSelectedButton, - this->findButton, - this->addGrandButton, - this->addButton, - this->label1}; - this->Controls->AddRange( controlsArray ); - this->Text = "ComboBox Sample"; - } - - void addButton_Click( Object^ sender, System::EventArgs^ e ) - { - comboBox1->Items->Add( textBox1->Text ); - } - - void addGrandButton_Click( Object^ sender, System::EventArgs^ e ) - { - comboBox1->BeginUpdate(); - for ( int i = 0; i < 1000; i++ ) - { - comboBox1->Items->Add( "Item 1 " + i.ToString() ); - - } - comboBox1->EndUpdate(); - } - - void findButton_Click( Object^ sender, System::EventArgs^ e ) - { - int index = comboBox1->FindString( textBox2->Text ); - comboBox1->SelectedIndex = index; - } - - void showSelectedButton_Click( Object^ sender, System::EventArgs^ e ) - { - int selectedIndex = comboBox1->SelectedIndex; - Object^ selectedItem = comboBox1->SelectedItem; - MessageBox::Show( "Selected Item Text: " + selectedItem->ToString() + "\n" + - "Index: " + selectedIndex.ToString() ); - } - }; -} - - -[System::STAThreadAttribute] -int main() -{ - System::Windows::Forms::Application::Run( gcnew Win32Form1Namespace::Win32Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp deleted file mode 100644 index f42022f6fad..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -public ref class ComponentChangedEventArgsExample -{ -public: - ComponentChangedEventArgsExample(){} - - // -public: - // This example method creates a ComponentChangedEventArgs using the specified arguments. - // Typically, this type of event args is created by a design mode subsystem. - ComponentChangedEventArgs^ CreateComponentChangedEventArgs( Object^ component, MemberDescriptor^ member, Object^ oldValue, Object^ newValue ) - { - // Creates a component changed event args with the specified arguments. - ComponentChangedEventArgs^ args = gcnew ComponentChangedEventArgs( component, member, oldValue, newValue ); - - // The component that has changed: args->Component - // The member of the component that changed: args->Member - // The old value of the member: args->oldValue - // The new value of the member: args->newValue - return args; - } - // -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp deleted file mode 100644 index 72414f9b04d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentChangedEventHandlerExample - { - private: - ComponentChangedEventHandlerExample(){} - - // - public: - void LinkComponentChangedEvent( IComponentChangeService^ changeService ) - { - // Registers an event handler for the ComponentChanged event. - changeService->ComponentChanged += gcnew ComponentChangedEventHandler( - this, &ComponentChangedEventHandlerExample::OnComponentChanged ); - } - - private: - void OnComponentChanged( Object^ sender, ComponentChangedEventArgs^ e ) - { - // Displays changed component information on the console. - Console::WriteLine( "Type of the component that has changed: " + - e->Component->GetType()->FullName ); - Console::WriteLine( "Name of the member of the component that has changed: " + - e->Member->Name ); - Console::WriteLine( "Old value of the member: " + e->OldValue ); - Console::WriteLine( "New value of the member: " + e->NewValue ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp deleted file mode 100644 index f44c0bc7fff..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentChangingEventArgsExample - { - public: - ComponentChangingEventArgsExample(){} - - // - public: - // This example method creates a ComponentChangingEventArgs using the specified arguments. - // Typically, this type of event args is created by a design mode subsystem. - ComponentChangingEventArgs^ CreateComponentChangingEventArgs( Object^ component, MemberDescriptor^ member ) - { - // The component that is about to change: args.Component - // The member that is about to change: args.Member - return gcnew ComponentChangingEventArgs( component,member ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp deleted file mode 100644 index ce86fc2a207..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentChangingEventHandlerExample - { - private: - ComponentChangingEventHandlerExample(){} - - // - public: - void LinkComponentChangingEvent( IComponentChangeService^ changeService ) - { - // Registers an event handler for the ComponentChanging event. - changeService->ComponentChanging += gcnew ComponentChangingEventHandler( - this, &ComponentChangingEventHandlerExample::OnComponentChanging ); - } - - private: - void OnComponentChanging( Object^ sender, ComponentChangingEventArgs^ e ) - { - // Displays changing component information on the console. - Console::WriteLine( "Type of the component that is about to change: " + - e->Component->GetType()->FullName ); - Console::WriteLine( "Name of the member of the component that is about to change: " + - e->Member->Name ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp deleted file mode 100644 index 187a922cec8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// Provides an example component designer. -ref class ExampleComponentDesigner: public ComponentDesigner -{ -public: - ExampleComponentDesigner() - { - } - - // This method provides an opportunity to perform processing when a designer is initialized. - // The component parameter is the component that the designer is associated with. - virtual void Initialize( IComponent^ component ) override - { - // Always call the base Initialize method in an of this method. - ComponentDesigner::Initialize( component ); - } - - // This method is invoked when the associated component is double-clicked. - virtual void DoDefaultAction() override - { - MessageBox::Show( "The event handler for the default action was invoked." ); - } - - // This method provides designer verbs. - property DesignerVerbCollection^ Verbs - { - virtual DesignerVerbCollection^ get() override - { - array^ newDesignerVerbs = {gcnew DesignerVerb( "Example Designer Verb Command", gcnew EventHandler( this, &ExampleComponentDesigner::onVerb ) )}; - return gcnew DesignerVerbCollection( newDesignerVerbs ); - } - } - -private: - // Event handling method for the example designer verb - void onVerb( Object^ sender, EventArgs^ e ) - { - MessageBox::Show( "The event handler for the Example Designer Verb Command was invoked." ); - } -}; - -// Provides an example component associated with the example component designer. - -[DesignerAttribute(ExampleComponentDesigner::typeid, IDesigner::typeid)] -ref class ExampleComponent: public Component -{ -public: - ExampleComponent(){} -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp deleted file mode 100644 index 65d322c5f1b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentEventArgsExample - { - public: - ComponentEventArgsExample() - { - } - - // - public: - // This example method creates a ComponentEventArgs using the specified argument. - // Typically, this type of event args is created by a design mode subsystem. - ComponentEventArgs^ CreateComponentEventArgs( IComponent^ component ) - { - // The component that is related to the event: args.Component - return gcnew ComponentEventArgs( component ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp deleted file mode 100644 index ec45cb83d8d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentEventHandlerExample - { - private: - ComponentEventHandlerExample() - { - } - - // - public: - void LinkComponentEvent( IComponentChangeService^ changeService ) - { - // Registers an event handler for the ComponentAdded, - // ComponentAdding, ComponentRemoved, and ComponentRemoving events. - changeService->ComponentAdded += gcnew ComponentEventHandler( - this, &ComponentEventHandlerExample::OnComponentEvent ); - changeService->ComponentAdding += gcnew ComponentEventHandler( - this, &ComponentEventHandlerExample::OnComponentEvent ); - changeService->ComponentRemoved += gcnew ComponentEventHandler( - this, &ComponentEventHandlerExample::OnComponentEvent ); - changeService->ComponentRemoving += gcnew ComponentEventHandler( - this, &ComponentEventHandlerExample::OnComponentEvent ); - } - - private: - void OnComponentEvent( Object^ sender, ComponentEventArgs^ e ) - { - // Displays changed component information on the console. - if ( e->Component->Site != nullptr ) - { - Console::WriteLine( "Name of the component related to the event: " + - e->Component->Site->Name ); - } - Console::WriteLine( "Type of the component related to the event: " + - e->Component->GetType()->FullName ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp deleted file mode 100644 index ff6f565a63c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentRenameEventArgsExample - { - public: - ComponentRenameEventArgsExample() - { - } - - // - public: - // This example method creates a ComponentRenameEventArgs using the specified arguments. - // Typically, this type of event args is created by a design mode subsystem. - ComponentRenameEventArgs^ CreateComponentRenameEventArgs( Object^ component, String^ oldName, String^ newName ) - { - // The component that was renamed: args.Component - // The previous name of the component: args.OldName - // The new name of the component: args.NewName - return gcnew ComponentRenameEventArgs( component, oldName, newName ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp deleted file mode 100644 index 4384f7cc2b1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class ComponentRenameEventHandlerExample - { - private: - ComponentRenameEventHandlerExample() - { - } - - // - public: - void LinkComponentRenameEvent( IComponentChangeService^ changeService ) - { - // Registers an event handler for the ComponentRename event. - changeService->ComponentRename += gcnew ComponentRenameEventHandler( - this, &ComponentRenameEventHandlerExample::OnComponentRename ); - } - - private: - void OnComponentRename( Object^ /*sender*/, ComponentRenameEventArgs^ e ) - { - // Displayss component renamed information on the console. - Console::WriteLine( "Type of the component that has been renamed: " + - e->Component->GetType()->FullName ); - Console::WriteLine( "New name of the component that has been renamed: " + - e->NewName ); - Console::WriteLine( "Old name of the component that has been renamed: " + - e->OldName ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp b/snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp deleted file mode 100644 index 6e358e05f13..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -ref class TestForm: public Form -{ -public: - TestForm() - { - InitializeMenu(); - } - - // -public: - void InitializeMenu() - { - // Create the MainMenu object. - MainMenu^ myMainMenu = gcnew MainMenu; - - // Create the MenuItem objects. - MenuItem^ fileMenu = gcnew MenuItem( "&File" ); - MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); - MenuItem^ newFile = gcnew MenuItem( "&New" ); - MenuItem^ openFile = gcnew MenuItem( "&Open" ); - MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); - - // Add the MenuItem objects to myMainMenu. - myMainMenu->MenuItems->Add( fileMenu ); - myMainMenu->MenuItems->Add( editMenu ); - - // Add three submenus to the File menu. - fileMenu->MenuItems->Add( newFile ); - fileMenu->MenuItems->Add( openFile ); - fileMenu->MenuItems->Add( exitProgram ); - - // Assign myMainMenu to the form. - Menu = myMainMenu; - - // Check that the File menu contains the Open menu item. - if ( fileMenu->MenuItems->Contains( openFile ) ) - { - MessageBox::Show( "The File menu contains 'Open' " + fileMenu->Text ); - } - } - // -}; - -int main() -{ - Application::Run( gcnew TestForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp deleted file mode 100644 index ae81c345345..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp +++ /dev/null @@ -1,36 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Windows::Forms; - -int main() -{ - // - // Create a ContextStack. - ContextStack^ stack = gcnew ContextStack; - - // - // - // Push ten items on to the stack and output the value of each. - for ( int number = 0; number < 10; number++ ) - { - Console::WriteLine( "Value pushed to stack: {0}", number ); - stack->Push( number ); - } - // - - // - // Pop each item off the stack. - Object^ item = nullptr; - while ( (item = stack->Pop()) != 0 ) - Console::WriteLine( "Value popped from stack: {0}", item ); - // -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp deleted file mode 100644 index 20fbec64d4e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 288, 32 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::addControl_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 288, 72 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 1; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::removeControl_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 376, 334 ); - array^temp0 = {this->button2,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // - // This example demonstrates the use of the ControlAdded and - // ControlRemoved events. This example assumes that two Button controls - // are added to the form and connected to the addControl_Click and - // removeControl_Click event-handler methods. -private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Connect the ControlRemoved and ControlAdded event handlers - // to the event-handler methods. - // ControlRemoved and ControlAdded are not available at design time. - this->ControlRemoved += gcnew System::Windows::Forms::ControlEventHandler( this, &Form1::Control_Removed ); - this->ControlAdded += gcnew System::Windows::Forms::ControlEventHandler( this, &Form1::Control_Added ); - } - - void Control_Added( Object^ /*sender*/, System::Windows::Forms::ControlEventArgs^ e ) - { - MessageBox::Show( String::Format( "The control named {0} has been added to the form.", e->Control->Name ) ); - } - - void Control_Removed( Object^ /*sender*/, System::Windows::Forms::ControlEventArgs^ e ) - { - MessageBox::Show( String::Format( "The control named {0} has been removed from the form.", e->Control->Name ) ); - } - - // Click event handler for a Button control. Adds a TextBox to the form. - void addControl_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create a new TextBox control and add it to the form. - TextBox^ textBox1 = gcnew TextBox; - textBox1->Size = System::Drawing::Size( 100, 10 ); - textBox1->Location = Point(10,10); - - // Name the control in order to remove it later. The name must be specified - // if a control is added at run time. - textBox1->Name = "textBox1"; - - // Add the control to the form's control collection. - this->Controls->Add( textBox1 ); - } - - // Click event handler for a Button control. - // Removes the previously added TextBox from the form. - void removeControl_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Loop through all controls in the form's control collection. - IEnumerator^ myEnum = this->Controls->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Control^ tempCtrl = safe_cast(myEnum->Current); - - // Determine whether the control is textBox1, - // and if it is, remove it. - if ( tempCtrl->Name->Equals( "textBox1" ) ) - { - this->Controls->Remove( tempCtrl ); - } - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp deleted file mode 100644 index efd42bf6d41..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp0 = {"C:\\Windows\\Windows Update.log"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 32, 24 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 200, 108 ); - this->listBox1->TabIndex = 0; - this->listBox1->DoubleClick += gcnew System::EventHandler( this, &Form1::listBox1_DoubleClick ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 32, 144 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->textBox1->Size = System::Drawing::Size( 448, 240 ); - this->textBox1->TabIndex = 1; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 520, 446 ); - array^temp1 = {this->textBox1,this->listBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // This example uses the DoubleClick event of a ListBox to load text files - // listed in the ListBox into a TextBox control. This example - // assumes that the ListBox, named listBox1, contains a list of valid file - // names with path and that this event handler method - // is connected to the DoublClick event of a ListBox control named listBox1. - // This example requires code access permission to access files. -private: - void listBox1_DoubleClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Get the name of the file to open from the ListBox. - String^ file = listBox1->SelectedItem->ToString(); - try - { - // Determine if the file exists before loading. - if ( System::IO::File::Exists( file ) ) - { - - // Open the file and use a TextReader to read the contents into the TextBox. - System::IO::FileInfo^ myFile = gcnew System::IO::FileInfo( listBox1->SelectedItem->ToString() ); - System::IO::TextReader^ myData = myFile->OpenText(); - ; - textBox1->Text = myData->ReadToEnd(); - myData->Close(); - } - } - // Exception is thrown by the OpenText method of the FileInfo class. - catch ( System::IO::FileNotFoundException^ ) - { - MessageBox::Show( "The file you specified does not exist." ); - } - // Exception is thrown by the ReadToEnd method of the TextReader class. - catch ( System::IO::IOException^ ) - { - MessageBox::Show( "There was a problem loading the file into the TextBox. Ensure that the file is a valid text file." ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp deleted file mode 100644 index 8390564e1f0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp +++ /dev/null @@ -1,128 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 176, 32 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 80, 32 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Enter += gcnew System::EventHandler( this, &Form1::button1_Enter ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 48, 104 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 176, 20 ); - this->textBox1->TabIndex = 1; - this->textBox1->Text = "textBox1"; - this->textBox1->Leave += gcnew System::EventHandler( this, &Form1::textBox1_Leave ); - this->textBox1->Enter += gcnew System::EventHandler( this, &Form1::textBox1_Enter ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->textBox1,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Enter( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - - // -private: - void textBox1_Enter( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // If the TextBox contains text, change its foreground and background colors. - if ( textBox1->Text != String::Empty ) - { - textBox1->ForeColor = Color::Red; - textBox1->BackColor = Color::Black; - - // Move the selection pointer to the end of the text of the control. - textBox1->Select(textBox1->Text->Length,0); - } - } - - void textBox1_Leave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Reset the colors and selection of the TextBox after focus is lost. - textBox1->ForeColor = Color::Black; - textBox1->BackColor = Color::White; - textBox1->Select(0,0); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp deleted file mode 100644 index 5f45db2051d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::GroupBox^ groupBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->groupBox1 = gcnew System::Windows::Forms::GroupBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->groupBox1->SuspendLayout(); - this->SuspendLayout(); - - // - // groupBox1 - // - array^temp0 = {this->button1}; - this->groupBox1->Controls->AddRange( temp0 ); - this->groupBox1->Location = System::Drawing::Point( 32, 24 ); - this->groupBox1->Name = "groupBox1"; - this->groupBox1->Size = System::Drawing::Size( 240, 184 ); - this->groupBox1->TabIndex = 0; - this->groupBox1->TabStop = false; - this->groupBox1->Text = "groupBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 144, 48 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp1 = {this->groupBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->groupBox1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - // - // This example uses the Parent property and the Find method of Control to set - // properties on the parent control of a Button and its Form. The example assumes - // that a Button control named button1 is located within a GroupBox control. The - // example also assumes that the Click event of the Button control is connected to - // the event handler method defined in the example. -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Get the control the Button control is located in. In this case a GroupBox. - Control^ control = button1->Parent; - - // Set the text and backcolor of the parent control. - control->Text = "My Groupbox"; - control->BackColor = Color::Blue; - - // Get the form that the Button control is contained within. - Form^ myForm = button1->FindForm(); - - // Set the text and color of the form containing the Button. - myForm->Text = "The Form of My Control"; - myForm->BackColor = Color::Red; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp deleted file mode 100644 index c0d2df832d8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 64, 48 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 200, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - this->textBox1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::textBox1_KeyDown ); - this->textBox1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler( this, &Form1::textBox1_KeyPress ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 376, 342 ); - array^temp0 = {this->textBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Boolean flag used to determine when a character other than a number is entered. -private: - bool nonNumberEntered; - - // Handle the KeyDown event to determine the type of character entered into the control. - void textBox1_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) - { - // Initialize the flag to false. - nonNumberEntered = false; - - // Determine whether the keystroke is a number from the top of the keyboard. - if ( e->KeyCode < Keys::D0 || e->KeyCode > Keys::D9 ) - { - // Determine whether the keystroke is a number from the keypad. - if ( e->KeyCode < Keys::NumPad0 || e->KeyCode > Keys::NumPad9 ) - { - // Determine whether the keystroke is a backspace. - if ( e->KeyCode != Keys::Back ) - { - // A non-numerical keystroke was pressed. - // Set the flag to true and evaluate in KeyPress event. - nonNumberEntered = true; - } - } - } - //If shift key was pressed, it's not a number. - if (Control::ModifierKeys == Keys::Shift) { - nonNumberEntered = true; - } - } - - // This event occurs after the KeyDown event and can be used to prevent - // characters from entering the control. - void textBox1_KeyPress( Object^ /*sender*/, System::Windows::Forms::KeyPressEventArgs^ e ) - { - // Check for the flag being set in the KeyDown event. - if ( nonNumberEntered) - { // Stop the character from being entered into the control since it is non-numerical. - e->Handled = true; - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp deleted file mode 100644 index 1d20678dbec..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 120, 80 ); - this->textBox1->Name = "textBox1"; - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - this->textBox1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::textBox1_MouseUp ); - this->textBox1->KeyUp += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::textBox1_KeyUp ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 464, 326 ); - array^temp0 = {this->textBox1}; - this->Controls->AddRange( temp0 ); - this->KeyPreview = true; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void textBox1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ){} - - // - // This example demonstrates how to use the KeyUp event with the Help class to display - // pop-up style help to the user of the application. When the user presses F1, the Help - // class displays a pop-up window, similar to a ToolTip, near the control. This example assumes - // that a TextBox control, named textBox1, has been added to the form and its KeyUp - // event has been connected to this event handler method. -private: - void textBox1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) - { - - // Determine whether the key entered is the F1 key. Display help if it is. - if ( e->KeyCode == Keys::F1 ) - { - - // Display a pop-up help topic to assist the user. - Help::ShowPopup( textBox1, "Enter your first name", Point(textBox1->Right,this->textBox1->Bottom) ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp deleted file mode 100644 index 36ce52a4484..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::ComponentModel::Container^ components; - -public: - MyForm() - { - InitializeComponent(); - } - -public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 48, 56 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^controlArray = {this->button1}; - this->Controls->AddRange( controlArray ); - this->Name = "MyForm"; - this->Text = "MyForm"; - this->Layout += gcnew System::Windows::Forms::LayoutEventHandler( this, &MyForm::MyForm_Layout ); - this->ResumeLayout( false ); - } - - // -private: - void MyForm_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ /*e*/ ) - { - // Center the Form on the user's screen everytime it requires a Layout. - this->SetBounds( (Screen::GetBounds( this ).Width / 2) - (this->Width / 2), (Screen::GetBounds( this ).Height / 2) - (this->Height / 2), this->Width, this->Height, BoundsSpecified::Location ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp deleted file mode 100644 index 87b5b860fe0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp +++ /dev/null @@ -1,86 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 344, 270 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Resize += gcnew System::EventHandler( this, &Form1::Form1_Resize ); - this->Move += gcnew System::EventHandler( this, &Form1::Form1_Move ); - } - - void Form1_Resize( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - - // - // The following example displays the location of the form in screen coordinates - // on the caption bar of the form. -private: - void Form1_Move( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->Text = String::Format( "Form screen position = {0}", this->Location ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp deleted file mode 100644 index ef0f2894be4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 376, 334 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // - // This example creates a PictureBox control on the form and draws to it. - // This example assumes that the Form_Load event handler method is - // connected to the Load event of the form. -private: - PictureBox^ pictureBox1; - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - pictureBox1 = gcnew PictureBox; - - // Dock the PictureBox to the form and set its background to white. - pictureBox1->Dock = DockStyle::Fill; - pictureBox1->BackColor = Color::White; - - // Connect the Paint event of the PictureBox to the event handler method. - pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::pictureBox1_Paint ); - - // Add the PictureBox control to the Form. - this->Controls->Add( pictureBox1 ); - } - - void pictureBox1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) - { - // Create a local version of the graphics object for the PictureBox. - Graphics^ g = e->Graphics; - - // Draw a string on the PictureBox. - g->DrawString( "This is a diagonal line drawn on the control", - gcnew System::Drawing::Font( "Arial",10 ), System::Drawing::Brushes::Blue, Point(30,30) ); - - // Draw a line in the PictureBox. - g->DrawLine( System::Drawing::Pens::Red, pictureBox1->Left, pictureBox1->Top, - pictureBox1->Right, pictureBox1->Bottom ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp deleted file mode 100644 index aa3e4d93824..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Runtime::InteropServices; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::ErrorProvider^ errorProvider1; - - - -private: - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->errorProvider1 = gcnew System::Windows::Forms::ErrorProvider; - this->textBox1->Location = System::Drawing::Point( 16, 16 ); - this->textBox1->Size = System::Drawing::Size( 216, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - this->textBox1->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &Form1::textBox1_Validating ); - this->textBox1->Validated += gcnew System::EventHandler( this, &Form1::textBox1_Validated ); - this->button1->Location = System::Drawing::Point( 208, 240 ); - this->button1->TabIndex = 2; - this->button1->Text = "button1"; - this->button2->Location = System::Drawing::Point( 108, 240 ); - this->button2->TabIndex = 1; - this->button2->Text = "Non-Validating"; - this->errorProvider1->DataMember = nullptr; - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^ controlArray = {this->textBox1,this->button1, this->button2}; - this->Controls->AddRange( controlArray ); - this->Text = "Form1"; - } - -// -public: - Form1() - { - InitializeComponent(); - //Set button2 to be non-validating. - this->button2->CausesValidation = false; - } - - // -private: - void textBox1_Validating( Object^ sender, System::ComponentModel::CancelEventArgs^ e ) - { - String^ errorMsg; - if ( !ValidEmailAddress( textBox1->Text, &errorMsg ) ) - { - // Cancel the event and select the text to be corrected by the user. - e->Cancel = true; - textBox1->Select( 0, textBox1->Text->Length ); - - // Set the ErrorProvider error with the text to display. - this->errorProvider1->SetError( textBox1, errorMsg ); - } - } - - void textBox1_Validated( Object^ sender, System::EventArgs^ e ) - { - // If all conditions have been met, clear the ErrorProvider of errors. - errorProvider1->SetError( textBox1, "" ); - } - -public: - bool ValidEmailAddress( String^ emailAddress, [Out]interior_ptr errorMessage ) - { - // Confirm that the email address String* is not empty. - if ( emailAddress->Length == 0 ) - { - *errorMessage = "email address is required."; - return false; - } - - // Confirm that there is an "@" and a "." in the email address, and in the correct order. - if ( emailAddress->IndexOf( "@" ) > -1 ) - { - if ( emailAddress->IndexOf( ".", emailAddress->IndexOf( "@" ) ) > emailAddress->IndexOf( "@" ) ) - { - *errorMessage = ""; - return true; - } - } - - *errorMessage = "email address must be valid email address format.\n" + - "For example 'someone@example.com' "; - return false; - } - // - // -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp b/snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp deleted file mode 100644 index 66bff7907f1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp +++ /dev/null @@ -1,223 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace Controls -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ addButton; - System::Windows::Forms::Button^ removeButton; - System::Windows::Forms::Button^ clearButton; - System::Windows::Forms::Button^ addRangeButton; - System::Windows::Forms::Panel^ panel1; - System::Windows::Forms::Button^ removeAtButton; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->panel1 = gcnew System::Windows::Forms::Panel; - this->addRangeButton = gcnew System::Windows::Forms::Button; - this->removeAtButton = gcnew System::Windows::Forms::Button; - this->addButton = gcnew System::Windows::Forms::Button; - this->removeButton = gcnew System::Windows::Forms::Button; - this->clearButton = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // panel1 - // - this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - this->panel1->Location = System::Drawing::Point( 8, 8 ); - this->panel1->Name = "panel1"; - this->panel1->Size = System::Drawing::Size( 168, 112 ); - this->panel1->TabIndex = 5; - - // - // addRangeButton - // - this->addRangeButton->Location = System::Drawing::Point( 8, 168 ); - this->addRangeButton->Name = "addRangeButton"; - this->addRangeButton->TabIndex = 4; - this->addRangeButton->Text = "AddRange"; - this->addRangeButton->Click += gcnew System::EventHandler( this, &Form1::addRangeButton_Click ); - - // - // removeAtButton - // - this->removeAtButton->Location = System::Drawing::Point( 96, 168 ); - this->removeAtButton->Name = "removeAtButton"; - this->removeAtButton->TabIndex = 6; - this->removeAtButton->Text = "RemoveAt"; - this->removeAtButton->Click += gcnew System::EventHandler( this, &Form1::removeAtButton_Click ); - - // - // addButton - // - this->addButton->Location = System::Drawing::Point( 8, 136 ); - this->addButton->Name = "addButton"; - this->addButton->TabIndex = 0; - this->addButton->Text = "Add"; - this->addButton->Click += gcnew System::EventHandler( this, &Form1::addButton_Click ); - - // - // removeButton - // - this->removeButton->Location = System::Drawing::Point( 96, 136 ); - this->removeButton->Name = "removeButton"; - this->removeButton->TabIndex = 2; - this->removeButton->Text = "Remove"; - this->removeButton->Click += gcnew System::EventHandler( this, &Form1::removeButton_Click ); - - // - // clearButton - // - this->clearButton->Location = System::Drawing::Point( 96, 200 ); - this->clearButton->Name = "clearButton"; - this->clearButton->TabIndex = 3; - this->clearButton->Text = "Clear"; - this->clearButton->Click += gcnew System::EventHandler( this, &Form1::clearButton_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 184, 229 ); - array^formControlsArray = {this->removeAtButton,this->panel1,this->addRangeButton,this->clearButton,this->removeButton,this->addButton}; - this->Controls->AddRange( formControlsArray ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Create two RadioButtons to add to the Panel. - private: - RadioButton^ radioAddButton; - RadioButton^ radioRemoveButton; - - // Add controls to the Panel using the AddRange method. - void addRangeButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - radioAddButton = gcnew RadioButton; - radioRemoveButton = gcnew RadioButton; - - // Set the Text the RadioButtons will display. - radioAddButton->Text = "radioAddButton"; - radioRemoveButton->Text = "radioRemoveButton"; - - // Set the appropriate location of radioRemoveButton. - radioRemoveButton->Location = System::Drawing::Point( radioAddButton->Location.X, radioAddButton->Location.Y + radioAddButton->Height ); - - //Add the controls to the Panel. - array^controlArray = {radioAddButton,radioRemoveButton}; - panel1->Controls->AddRange( controlArray ); - } - // - - // - // Create a TextBox to add to the Panel. - private: - TextBox^ textBox1; - - // Add controls to the Panel using the Add method. - void addButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - textBox1 = gcnew TextBox; - panel1->Controls->Add( textBox1 ); - } - // - - // - // Clear all the controls in the Panel. - private: - void clearButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - panel1->Controls->Clear(); - } - // - - // - // Remove the first control in the collection. - private: - void removeAtButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( panel1->Controls->Count > 0 ) - { - panel1->Controls->RemoveAt( 0 ); - } - } - // - - // - // Remove the RadioButton control if it exists. - private: - void removeButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( panel1->Controls->Contains( removeButton ) ) - { - panel1->Controls->Remove( removeButton ); - } - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -void main() -{ - Application::Run( gcnew Controls::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp deleted file mode 100644 index c712582c326..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp +++ /dev/null @@ -1,97 +0,0 @@ - - -#using -#using -#using -#using - -// -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Collections; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - - public ref class TestControlDesigner: public System::Windows::Forms::Design::ControlDesigner - { - private: - bool mouseover; - Color lineColor; - - public: - - property Color OutlineColor - { - Color get() - { - return lineColor; - } - - void set( Color value ) - { - lineColor = value; - } - - } - TestControlDesigner() - { - mouseover = false; - lineColor = Color::White; - } - - protected: - virtual void OnMouseEnter() override - { - this->mouseover = true; - this->Control->Refresh(); - } - - virtual void OnMouseLeave() override - { - this->mouseover = false; - this->Control->Refresh(); - } - - virtual void OnPaintAdornments( System::Windows::Forms::PaintEventArgs^ pe ) override - { - if ( this->mouseover ) - pe->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( this->lineColor ),6 ), 0, 0, this->Control->Size.Width, this->Control->Size.Height ); - } - - // - protected: - [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)] - virtual void PreFilterProperties( System::Collections::IDictionary^ properties ) override - { - properties->Add( "OutlineColor", TypeDescriptor::CreateProperty( TestControlDesigner::typeid, "OutlineColor", System::Drawing::Color::typeid, nullptr ) ); - } - // - }; - - [DesignerAttribute(TestControlDesigner::typeid)] - public ref class TestControl: public System::Windows::Forms::UserControl - { - private: - System::ComponentModel::Container^ components; - - public: - TestControl() - { - components = gcnew System::ComponentModel::Container; - } - - protected: - ~TestControl() - { - if ( components != nullptr ) - { - delete components; - } - } - }; -// - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp b/snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp deleted file mode 100644 index 76705929c7b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp +++ /dev/null @@ -1,21 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -int main() -{ - if (Control::IsKeyLocked( Keys::CapsLock )) { - MessageBox::Show( "The Caps Lock key is ON." ); - } - else { - MessageBox::Show( "The Caps Lock key is OFF." ); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp deleted file mode 100644 index de713031fd7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// System::Windows::Forms::Control::BeginInvoke(Delegate*, Object[]) -// System::Windows::Forms::Control::BeginInvoke(Delegate*) - -/* -The following program demonstrates the 'BeginInvoke(Delegate*)' and BeginInvoke(Delegate*, Object[]) -methods of 'Control' class. -A 'TextBox' and two 'Button' controls are added to the form. When the first 'Button' -is clicked a delegate is called asynchronously using 'BeginInvoke' method of 'Control' -class and an array of objects is passed as an arguments to the delegator which adds -'Label' control to the form. When the second 'Button' control is -clicked a delegate is called asynchronously using 'BeginInvoke' which will display -a message in the 'TextBox'. -*/ - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ components; - TextBox^ myTextBox; - Button^ myButton; - Button^ invokeButton; - -public: - MyForm() - { - components = nullptr; - - // Required for Windows Form Designer support. - InitializeComponent(); - } - -protected: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Set 'myTextBox' properties. - this->myTextBox = gcnew TextBox; - myTextBox->Location = Point(90,16); - myTextBox->Size = System::Drawing::Size( 160, 25 ); - - // Set 'myButton' properties. - this->myButton = gcnew Button; - myButton->Text = "Add Label"; - myButton->Location = Point(45,50); - myButton->Size = System::Drawing::Size( 70, 25 ); - myButton->Click += gcnew EventHandler( this, &MyForm::Button_Click ); - invokeButton = gcnew Button; - invokeButton->Text = "Invoke Delegate"; - invokeButton->Location = Point(120,50); - invokeButton->Size = System::Drawing::Size( 100, 25 ); - invokeButton->Click += gcnew EventHandler( this, &MyForm::Invoke_Click ); - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "MyForm"; - this->Text = "Invoke example"; - this->Controls->Add( myTextBox ); - this->Controls->Add( myButton ); - this->Controls->Add( invokeButton ); - } - - // -private: - delegate void MyDelegate( - Label^ myControl, String^ myArg2 ); - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - array^myArray = gcnew array(2); - myArray[ 0 ] = gcnew Label; - myArray[ 1 ] = "Enter a Value"; - myTextBox->BeginInvoke( gcnew MyDelegate( this, &MyForm::DelegateMethod ), myArray ); - } - - void DelegateMethod( Label^ myControl, String^ myCaption ) - { - myControl->Location = Point(16,16); - myControl->Size = System::Drawing::Size( 80, 25 ); - myControl->Text = myCaption; - this->Controls->Add( myControl ); - } - - delegate void InvokeDelegate(); - // - - // -private: - void Invoke_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myTextBox->BeginInvoke( gcnew InvokeDelegate( this, &MyForm::InvokeMethod ) ); - } - - void InvokeMethod() - { - myTextBox->Text = "Executed the given delegate"; - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp deleted file mode 100644 index 09ce810976d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp +++ /dev/null @@ -1,157 +0,0 @@ - -// System.Windows.Forms.Control.ContextMenu -// System.Windows.Forms.Control.ContextMenuChanged -// System.Windows.Forms.Control.CreateGraphics -/* - The following program demonstrates the 'ContextMenu' property, 'ContextMenuChanged' - event handler and 'CreateGraphics' method of 'Control' class. - It displays the 'TextBox' and 'Button' controls on the form. When mouse is clicked inside - the 'TextBox' control, an instance of 'ContextMenu' is created and assigned to 'TextBox' - control by using 'ContextMenu' property. The shortcut menu pops-up when right button of - mouse is clicked inside the 'TextBox' control. When the 'Button' is clicked, an - instance of 'Graphics' class is obtained by calling 'CreateGraphics' method and draws an - ellipse inside the 'TextBox' control. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace MyApplication -{ - public ref class MyForm: public Form - { - private: - System::Windows::Forms::TextBox^ myTextBox; - System::ComponentModel::Container^ components; - System::Windows::Forms::Label^ myLabel; - System::Windows::Forms::Button^ myButton; - - public: - MyForm() - { - components = nullptr; - InitializeComponent(); - AddClickHandler(); - AddContextMenuChangedHandler(); - } - - public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->myButton = gcnew System::Windows::Forms::Button; - this->myLabel = gcnew System::Windows::Forms::Label; - this->myTextBox = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // myButton - // - this->myButton->Location = System::Drawing::Point( 48, 232 ); - this->myButton->Name = L"myButton"; - this->myButton->Size = System::Drawing::Size( 96, 23 ); - this->myButton->TabIndex = 2; - this->myButton->Text = L"CreateGraphics"; - this->myButton->Click += gcnew System::EventHandler( this, &MyForm::CreateGraphicsButton_Click ); - - // - // myLabel - // - this->myLabel->Location = System::Drawing::Point( 24, 16 ); - this->myLabel->Name = L"myLabel"; - this->myLabel->Size = System::Drawing::Size( 256, 40 ); - this->myLabel->TabIndex = 1; - this->myLabel->Text = L"Click inside the TextBox to set the ContextMenu and then" - L" click the right mouse button inside the TextBox to popup the ContextMenu."; - - // - // myTextBox - // - this->myTextBox->Location = System::Drawing::Point( 16, 80 ); - this->myTextBox->Multiline = true; - this->myTextBox->Name = L"myTextBox"; - this->myTextBox->Size = System::Drawing::Size( 240, 112 ); - this->myTextBox->TabIndex = 0; - this->myTextBox->Text = L"Welcome to .NET"; - - // - // MyForm - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^myFormControls = {this->myButton,this->myLabel,this->myTextBox}; - this->Controls->AddRange( myFormControls ); - this->Name = L"MyForm"; - this->Text = L"ContextMenu Example"; - this->ResumeLayout( false ); - } - - // - private: - void AddClickHandler() - { - this->myTextBox->Click += gcnew EventHandler( this, &MyForm::TextBox_Click ); - } - - void TextBox_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - array^myMenuItems = gcnew array(2); - myMenuItems[ 0 ] = gcnew MenuItem( L"New",gcnew EventHandler( this, &MyForm::MenuItem_New ) ); - myMenuItems[ 1 ] = gcnew MenuItem( L"Open",gcnew EventHandler( this, &MyForm::MenuItem_Open ) ); - this->myTextBox->ContextMenu = gcnew System::Windows::Forms::ContextMenu( myMenuItems ); - } - - void MenuItem_New( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( L"New MenuItem is selected from TextBox's shortcut menu." ); - } - - void MenuItem_Open( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( L"Open MenuItem is selected from TextBox's shortcut menu." ); - } - // - - // - private: - void AddContextMenuChangedHandler() - { - this->myTextBox->ContextMenuChanged += gcnew EventHandler( this, &MyForm::TextBox_ContextMenuChanged ); - } - - void TextBox_ContextMenuChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( L"Shortcut menu of TextBox is changed." ); - } - // - - void CreateGraphicsButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - Graphics^ myGraphics = myTextBox->CreateGraphics(); - myGraphics->DrawEllipse( gcnew Pen( Color::Black,3 ), 0.0F, 0.0F, 230.0F, 105.0F ); - myGraphics->FillEllipse( Brushes::Goldenrod, 0.0F, 0.0F, 230.0F, 105.0F ); - // - } - - [STAThread] - int main() - { - Application::Run( gcnew MyForm ); - return 1; - } - }; -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp deleted file mode 100644 index 468b1db11e7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp +++ /dev/null @@ -1,92 +0,0 @@ -// System::Windows::Forms::Control::Font -// System::Windows::Forms::Control::FontChanged -// System::Windows::Forms::Control::Focused -// System::Windows::Forms::Control::Focus - -/* -The following example demonstrates 'Font' & 'Focused' properties, 'Focus' -method and 'FontChanged' event of 'Control' class. -A 'DateTimePicker' control and a 'Button' control are added to a form. The font -property of 'DateTimePicker' control is changed to the font selected by user -from 'FontDialog' control. An event handler function is attached -with 'FontChanged' event of 'DateTimePicker' control which sets the focus -on 'DateTimePicker' control. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyFormControl: public Form -{ -private: - FontDialog^ myFontDialog; - DateTimePicker^ myDateTimePicker; - Button^ myButton; - -public: - MyFormControl() - { - myDateTimePicker = gcnew DateTimePicker; - myFontDialog = gcnew FontDialog; - myButton = gcnew Button; - myDateTimePicker->Location = Point( 48, 24 ); - myDateTimePicker->Name = "myDateTimePicker"; - myButton->Location = Point( 50, 150 ); - myButton->Name = "myButton"; - myButton->Size = System::Drawing::Size( 200, 40 ); - myButton->Text = "Change Font of Date Time Picker"; - myButton->Click += gcnew EventHandler( this, &MyFormControl::myButton_Click ); - ClientSize = System::Drawing::Size( 292, 273 ); - array^ formControls = {myDateTimePicker,myButton}; - Controls->AddRange( formControls ); - Text = "Control Example"; - AddEventHandler(); - } - - // -private: - void myButton_Click( Object^ sender, EventArgs^ e ) - { - FontDialog^ myFontDialog = gcnew FontDialog; - if ( myFontDialog->ShowDialog() == ::DialogResult::OK ) - { - // Set the control's font. - myDateTimePicker->Font = myFontDialog->Font; - } - } - // - - // -private: - void AddEventHandler() - { - // Add the event handler for 'FontChanged' event. - myDateTimePicker->FontChanged += gcnew EventHandler( - this, &MyFormControl::DateTimePicker_FontChanged ); - } - - void DateTimePicker_FontChanged( Object^ sender, EventArgs^ e ) - { - // - // - if ( !myDateTimePicker->Focused ) - { - // Set focus on 'DateTimePicker' control. - myDateTimePicker->Focus(); - } - // - // - } - // -}; - -int main() -{ - MyFormControl^ myForm = gcnew MyFormControl; - myForm->ShowDialog(); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp deleted file mode 100644 index 9c103d16ba6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -// System::Windows::Forms::Control::Invoke(Delegate*, Object[]); -/* -The following example demonstrates the 'Invoke(Delegate*, Object[])' -method of 'Control' class. -A 'ListBox' and a 'Button' control are added to a form, containing a delegate -which encapsulates a method that adds items to the listbox. This function is executed -on the thread that owns the underlying handle of the form .When user clicks on button -the above delegate is executed using 'Invoke' method. -*/ -#using -#using -#using - -// -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Threading; -ref class MyFormControl: public Form -{ -public: - delegate void AddListItem( String^ myString ); - AddListItem^ myDelegate; - -private: - Button^ myButton; - Thread^ myThread; - ListBox^ myListBox; - -public: - MyFormControl(); - void AddListItemMethod( String^ myString ); - -private: - void Button_Click( Object^ sender, EventArgs^ e ); - void ThreadFunction(); -}; - -ref class MyThreadClass -{ -private: - MyFormControl^ myFormControl1; - -public: - MyThreadClass( MyFormControl^ myForm ) - { - myFormControl1 = myForm; - } - - String^ myString; - void Run() - { - for ( int i = 1; i <= 5; i++ ) - { - myString = String::Concat( "Step number ", i, " executed" ); - Thread::Sleep( 400 ); - - // Execute the specified delegate on the thread that owns - // 'myFormControl1' control's underlying window handle with - // the specified list of arguments. - array^myStringArray = {myString}; - myFormControl1->Invoke( myFormControl1->myDelegate, myStringArray ); - - } - } - -}; - -MyFormControl::MyFormControl() -{ - myButton = gcnew Button; - myListBox = gcnew ListBox; - myButton->Location = Point(72,160); - myButton->Size = System::Drawing::Size( 152, 32 ); - myButton->TabIndex = 1; - myButton->Text = "Add items in list box"; - myButton->Click += gcnew EventHandler( this, &MyFormControl::Button_Click ); - myListBox->Location = Point(48,32); - myListBox->Name = "myListBox"; - myListBox->Size = System::Drawing::Size( 200, 95 ); - myListBox->TabIndex = 2; - ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {myListBox,myButton}; - Controls->AddRange( formControls ); - Text = " 'Control_Invoke' example "; - myDelegate = gcnew AddListItem( this, &MyFormControl::AddListItemMethod ); -} - -void MyFormControl::AddListItemMethod( String^ myString ) -{ - myListBox->Items->Add( myString ); -} - -void MyFormControl::Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) -{ - myThread = gcnew Thread( gcnew ThreadStart( this, &MyFormControl::ThreadFunction ) ); - myThread->Start(); -} - -void MyFormControl::ThreadFunction() -{ - MyThreadClass^ myThreadClassObject = gcnew MyThreadClass( this ); - myThreadClassObject->Run(); -} - -int main() -{ - MyFormControl^ myForm = gcnew MyFormControl; - myForm->ShowDialog(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp deleted file mode 100644 index d72e7ee5cc6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp +++ /dev/null @@ -1,109 +0,0 @@ -// System::Windows::Forms::Control::Invoke(Delegate*); -// -/* -The following example demonstrates the 'Invoke(Delegate*)' method of 'Control class. -A 'ListBox' and a 'Button' control are added to a form, containing a delegate -which encapsulates a method that adds items to the listbox. This function is executed -on the thread that owns the underlying handle of the form. When user clicks on button -the above delegate is executed using 'Invoke' method. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Threading; - -public ref class MyFormControl: public Form -{ -public: - delegate void AddListItem(); - AddListItem^ myDelegate; - -private: - Button^ myButton; - Thread^ myThread; - ListBox^ myListBox; - -public: - MyFormControl(); - void AddListItemMethod() - { - String^ myItem; - for ( int i = 1; i < 6; i++ ) - { - myItem = "MyListItem {0}",i; - myListBox->Items->Add( myItem ); - myListBox->Update(); - Thread::Sleep( 300 ); - } - } - -private: - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myThread = gcnew Thread( gcnew ThreadStart( this, &MyFormControl::ThreadFunction ) ); - myThread->Start(); - } - - void ThreadFunction(); -}; - - -// The following code assumes a 'ListBox' and a 'Button' control are added to a form, -// containing a delegate which encapsulates a method that adds items to the listbox. -public ref class MyThreadClass -{ -private: - MyFormControl^ myFormControl1; - -public: - MyThreadClass( MyFormControl^ myForm ) - { - myFormControl1 = myForm; - } - - void Run() - { - // Execute the specified delegate on the thread that owns - // 'myFormControl1' control's underlying window handle. - myFormControl1->Invoke( myFormControl1->myDelegate ); - } -}; - - -MyFormControl::MyFormControl() -{ - myButton = gcnew Button; - myListBox = gcnew ListBox; - myButton->Location = Point( 72, 160 ); - myButton->Size = System::Drawing::Size( 152, 32 ); - myButton->TabIndex = 1; - myButton->Text = "Add items in list box"; - myButton->Click += gcnew EventHandler( this, &MyFormControl::Button_Click ); - myListBox->Location = Point( 48, 32 ); - myListBox->Name = "myListBox"; - myListBox->Size = System::Drawing::Size( 200, 95 ); - myListBox->TabIndex = 2; - ClientSize = System::Drawing::Size( 292, 273 ); - array^ temp0 = {myListBox,myButton}; - Controls->AddRange( temp0 ); - Text = " 'Control_Invoke' example"; - myDelegate = gcnew AddListItem( this, &MyFormControl::AddListItemMethod ); -} - -void MyFormControl::ThreadFunction() -{ - MyThreadClass^ myThreadClassObject = gcnew MyThreadClass( this ); - myThreadClassObject->Run(); -} - -int main() -{ - MyFormControl^ myForm = gcnew MyFormControl; - myForm->ShowDialog(); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp deleted file mode 100644 index dcc7ebbdf6a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// System::Windows::Forms::Control::Scale(float) -// System::Windows::Forms::Control::SizeChanged - -/* -The following example demonstrates the 'Scale(float)' method -and 'SizeChanged' event of the 'Control' class. An instance of -a 'Button' control has been provided that can be scaled both -horizontally and vertically. A 'NumericUpDown' instance has been -provided that is used to provide for the horizontal and vertical -scale value. The 'Button' instance named 'OK' is used to set the -scale values for the 'Button' control instance. Whenever the size -of the control changes the event handler associated with the -'SizeChanged' event of the control is called. This event handler -displays a message box indicating that the size of the control has -changed. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - Label^ myLabel1; - NumericUpDown^ myNumericUpDown1; - Button^ myButton1; - Button^ myButton2; - System::ComponentModel::Container^ components; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - } - -public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->myLabel1 = gcnew System::Windows::Forms::Label; - this->myButton1 = gcnew System::Windows::Forms::Button; - this->myButton2 = gcnew System::Windows::Forms::Button; - this->myNumericUpDown1 = gcnew System::Windows::Forms::NumericUpDown; - (static_cast(this->myNumericUpDown1))->BeginInit(); - this->SuspendLayout(); - - // Set the properties for 'myLabel1'. - this->myLabel1->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->myLabel1->Location = System::Drawing::Point( 16, 168 ); - this->myLabel1->Name = "myLabel1"; - this->myLabel1->Size = System::Drawing::Size( 152, 24 ); - this->myLabel1->TabIndex = 1; - this->myLabel1->Text = "Scale (Horizontal & Vertical):"; - this->myLabel1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; - - // Set the properties for 'myButton1'. - this->myButton1->Location = System::Drawing::Point( 56, 32 ); - this->myButton1->Name = "myButton1"; - this->myButton1->Size = System::Drawing::Size( 184, 80 ); - this->myButton1->TabIndex = 0; - this->myButton1->Text = "Scaleable Control"; - RegisterEventHandler(); - - // Set the properties for 'myButton2'. - this->myButton2->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->myButton2->Location = System::Drawing::Point( 48, 216 ); - this->myButton2->Name = "myButton2"; - this->myButton2->Size = System::Drawing::Size( 200, 32 ); - this->myButton2->TabIndex = 7; - this->myButton2->Text = "OK"; - this->myButton2->Click += gcnew System::EventHandler( this, &MyForm::MyButton2_Click ); - - // Set the properties for 'myNumericUpDown1'. - this->myNumericUpDown1->DecimalPlaces = 1; - this->myNumericUpDown1->Increment = System::Decimal( 0.1 ); - this->myNumericUpDown1->Location = System::Drawing::Point( 192, 168 ); - this->myNumericUpDown1->Maximum = System::Decimal( 10 ); - this->myNumericUpDown1->Minimum = System::Decimal( 0 ); - this->myNumericUpDown1->Name = "myNumericUpDown1"; - this->myNumericUpDown1->Size = System::Drawing::Size( 88, 20 ); - this->myNumericUpDown1->TabIndex = 5; - - // Set the properties for 'MyForm'. - this->ClientSize = System::Drawing::Size( 292, 261 ); - array^myFormControls = {this->myButton2,this->myNumericUpDown1,this->myLabel1,this->myButton1}; - this->Controls->AddRange( myFormControls ); - this->Name = "MyForm"; - this->Text = "MyForm"; - (static_cast(this->myNumericUpDown1))->EndInit(); - this->ResumeLayout( false ); - } - - // -private: - void RegisterEventHandler() - { - myButton1->SizeChanged += gcnew EventHandler( this, &MyForm::MyButton1_SizeChanged ); - } - - void MyButton2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Set the scale for the control to the value provided. - float scale = (float)myNumericUpDown1->Value; - myButton1->Scale( scale ); - // - } - - void MyButton1_SizeChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "The size of the 'Button' control has changed" ); - } - // -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp deleted file mode 100644 index 4964763ceb7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp +++ /dev/null @@ -1,98 +0,0 @@ -// System::Windows::Forms::Control::StyleChanged - -/* -The following example demonstrates the 'StyleChanged' event -of 'Control' class. This example has the style of the form -set when the form is loaded. This setting of the style -raises the 'StyleChanged' event. The event handler associated -with the 'StyleChanged' event pops a message box indicating -the same. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - System::Windows::Forms::Button^ myButton1; - System::ComponentModel::Container^ components; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - } - -public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->myButton1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // Set the properties of the 'myButton1'. - this->myButton1->Location = System::Drawing::Point( 24, 8 ); - this->myButton1->Name = "myButton1"; - this->myButton1->Size = System::Drawing::Size( 192, 48 ); - this->myButton1->TabIndex = 0; - this->myButton1->Text = "button1"; - this->myButton1->Click += gcnew System::EventHandler( this, &MyForm::MyButton1_Click ); - - // Set the properties of the 'MyForm'. - this->ClientSize = System::Drawing::Size( 248, 61 ); - array^myFormControls = {this->myButton1}; - this->Controls->AddRange( myFormControls ); - this->Name = "MyForm"; - this->Text = "MyForm"; - this->Load += gcnew EventHandler( this, &MyForm::MyForm_Load ); - RegisterEventHandler(); - this->ResumeLayout( false ); - } - - void MyButton1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "The 'Control' has been clicked" ); - } - - // -private: - // Set the 'FixedHeight' and 'FixedWidth' styles to false. - void MyForm_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - this->SetStyle( ControlStyles::FixedHeight, false ); - this->SetStyle( ControlStyles::FixedWidth, false ); - } - - void RegisterEventHandler() - { - this->StyleChanged += gcnew EventHandler( this, &MyForm::MyForm_StyleChanged ); - } - - // Handle the 'StyleChanged' event for the 'Form'. - void MyForm_StyleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "The style releated to the 'Form' has been changed" ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp deleted file mode 100644 index 37683520992..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp +++ /dev/null @@ -1,107 +0,0 @@ -// System::Windows::Forms::Control::VisibleChanged - -/* -The following program demonstrates 'VisibleChanged' event for the 'Control' class. -The 'VisibleChanged' event is raised when the 'Visible' property value of -'Label' control has changed. -*/ - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace MyControlExample -{ - public ref class MyForm: public Form - { - private: - Label^ myLabel; - Button^ myButton; - System::ComponentModel::Container^ components; - - public: - MyForm() - { - components = nullptr; - InitializeComponent(); - } - - protected: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->myLabel = gcnew Label; - this->myButton = gcnew Button; - this->SuspendLayout(); - - // - // myLabel - // - this->myLabel->Location = System::Drawing::Point( 24, 8 ); - this->myLabel->Name = "myLabel"; - this->myLabel->Size = System::Drawing::Size( 240, 40 ); - this->myLabel->Text = String::Concat( this->myLabel->Text, "Welcome to .NET." ); - - // - // myButton - // - this->myButton->Location = System::Drawing::Point( 54, 50 ); - this->myButton->Name = "myLabel"; - this->myButton->Size = System::Drawing::Size( 100, 40 ); - this->myButton->TabIndex = 0; - this->myButton->Text = "Hide Label"; - this->myButton->Click += gcnew EventHandler( this, &MyForm::Button_HideLabel ); - - // - // MyForm - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Controls->Add( this->myLabel ); - this->Controls->Add( this->myButton ); - this->Name = "MyForm"; - this->Text = "VisibleChanged example"; - this->ResumeLayout( false ); - AddVisibleChangedEventHandler(); - } - - // - private: - void Button_HideLabel( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myLabel->Visible = false; - } - - void AddVisibleChangedEventHandler() - { - myLabel->VisibleChanged += gcnew EventHandler( this, &MyForm::Label_VisibleChanged ); - } - - void Label_VisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "Visible change event raised!!!" ); - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew MyControlExample::MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp b/snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp deleted file mode 100644 index 1f4fb7b0aa0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp +++ /dev/null @@ -1,264 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; - -namespace TypeCon -{ - ref class TypeCon_Doc - { - public: - enum class Servers - { - Windows = 1, - Exchange = 2, - BizTalk = 3 - }; - - static void Main() - { - // ArrayConverter - // - // implemented in another file - // - - //============================================================ - // BaseNumberConverter - // - // implemented in another file - // - - //============================================================ - // BooleanConverter - // This sample converts a Boolean variable to and from a string variable. - // - bool bVal(true); - String^ strA = "false"; - Console::WriteLine( TypeDescriptor::GetConverter( bVal )->ConvertTo( bVal, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( bVal )->ConvertFrom( strA ) ); - // - - //============================================================ - // ByteConverter - work - // This sample converts an 8-bit unsigned integer to and from a string. - // - Byte myUint(5); - String^ myUStr = "2"; - Console::WriteLine( TypeDescriptor::GetConverter( myUint )->ConvertTo( myUint, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myUint )->ConvertFrom( myUStr ) ); - // - - //============================================================ - // CharConverter - // This sample converts a Char variable to and from a String. - // - char chrA('a'); - String^ strB = "b"; - Console::WriteLine( TypeDescriptor::GetConverter( chrA )->ConvertTo( chrA, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( chrA )->ConvertFrom( strB ) ); - // - - //============================================================ - // CollectionConverter - // - // implemented in another file - // - - //============================================================ - // ComponentConverter - // - // implemented in another file - // - - //============================================================ - // CultureInfoConverter - // This sample converts a CultureInfo object to and from a string. - // - // The sample first constructs a CultureInfo variable using the Greek culture - 'el'. - System::Globalization::CultureInfo^ myCulture = gcnew System::Globalization::CultureInfo( "el" ); - String^ myCString = "Russian"; - Console::WriteLine( TypeDescriptor::GetConverter( myCulture )->ConvertTo( myCulture, String::typeid ) ); - // The following line will output 'ru' based on the string being converted. - Console::WriteLine( TypeDescriptor::GetConverter( myCulture )->ConvertFrom( myCString ) ); - // - - //============================================================ - // DateTimeConverter - // This sample converts a DateTime variable to and from a String. - // - DateTime dt(1990,5,6); - Console::WriteLine( TypeDescriptor::GetConverter( dt )->ConvertTo( dt, String::typeid ) ); - String^ myStr = "1991-10-10"; - Console::WriteLine( TypeDescriptor::GetConverter( dt )->ConvertFrom( myStr ) ); - // - - //============================================================ - // DecimalConverter - // - Decimal myDec(40); - String^ myDStr = "20"; - Console::WriteLine( TypeDescriptor::GetConverter( myDec )->ConvertTo( myDec, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myDec )->ConvertFrom( myDStr ) ); - // - - //============================================================ - // DoubleConverter - // - double myDoub(100.55); - String^ myDoStr = "4000.425"; - Console::WriteLine( TypeDescriptor::GetConverter( myDoub )->ConvertTo( myDoub, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myDoub )->ConvertFrom( myDoStr ) ); - // - - //============================================================ - // EnumConverter - work - // This converter can only convert an enumeration object to and from a string. - // This is declared before main() enum Servers {Windows=1, Exchange=2, BizTalk=3}; - // - // Requires public declaration of the following type. - // __value enum Servers {Windows=1, Exchange=2, BizTalk=3}; - Servers myServer = Servers::Exchange; - String^ myServerString = "BizTalk"; - Console::WriteLine( TypeDescriptor::GetConverter( myServer )->ConvertTo( myServer, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myServer )->ConvertFrom( myServerString ) ); - // - - //============================================================ - // GUIDConverter - // This converter can only convert a globally unique identifier object to and from a string. - // - Guid myGuid("B80D56EC-5899-459d-83B4-1AE0BB8418E4"); - String^ myGuidString = "1AA7F83F-C7F5-11D0-A376-00C04FC9DA04"; - Console::WriteLine( TypeDescriptor::GetConverter( myGuid )->ConvertTo( myGuid, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myGuid )->ConvertFrom( myGuidString ) ); - // - - //============================================================ - // Int16Converter - // The Int16 value type represents signed integers with values ranging from negative 32768 through positive 32767. - // This converter can only convert a 16-bit signed integer object to and from a string. - // - short myInt16( -10000); - String^ myInt16String = "+20000"; - Console::WriteLine( TypeDescriptor::GetConverter( myInt16 )->ConvertTo( myInt16, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myInt16 )->ConvertFrom( myInt16String ) ); - // - - //============================================================ - // Int32Converter - // The Int32 value type represents signed integers with values ranging from negative 2,147,483,648 through positive 2,147,483,647. - // This converter can only convert a 32-bit signed integer object to and from a string. - // - int myInt32( -967299); - String^ myInt32String = "+1345556"; - Console::WriteLine( TypeDescriptor::GetConverter( myInt32 )->ConvertTo( myInt32, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myInt32 )->ConvertFrom( myInt32String ) ); - // - - //============================================================ - // Int64Converter - work - // The Int64 value type represents integers with values ranging from negative 9,223,372,036,854,775,808 through positive 9,223,372,036,854,775,807. - // This converter can only convert a 64-bit signed integer object to and from a string. - // - long myInt64( -123456789123); - String^ myInt64String = "+184467440737095551"; - Console::WriteLine( TypeDescriptor::GetConverter( myInt64 )->ConvertTo( myInt64, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myInt64 )->ConvertFrom( myInt64String ) ); - // - - //============================================================ - // ReferenceConverter - // - // implemented in another file - // - - //============================================================ - // SByteConverter - // The SByte value type represents integers with values ranging from negative 128 to positive 127. - // This converter can convert only an 8-bit unsigned integer object to and from a string. - // - SByte mySByte( +121); - String^ mySByteStr = "-100"; - Console::WriteLine( TypeDescriptor::GetConverter( mySByte )->ConvertTo( mySByte, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( mySByte )->ConvertFrom( mySByteStr ) ); - // - - //============================================================ - // SingleConverter - // Single - ranging in value from -3.402823E+38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E+38 for positive values - // This converter can only convert a single-precision, floating point number object to and from a string. - // - Single s(3.402823E+10F); - String^ mySStr = "3.402823E+10"; - Console::WriteLine( TypeDescriptor::GetConverter( s )->ConvertTo( s, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( s )->ConvertFrom( mySStr ) ); - // - - //============================================================ - // StringConverter - //cpconconvertingstringstonetframeworkdatatypes - // - //implemented in anothner file - // - - //============================================================ - // TimeSpanConverter - // This converter can only convert a TimeSpan object to and from a string. - // - TimeSpan ts(133333330); - String^ myTSStr = "5000000"; - Console::WriteLine( TypeDescriptor::GetConverter( ts )->ConvertTo( ts, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( ts )->ConvertFrom( myTSStr ) ); - // - - //============================================================ - // TypeListConverter - // - // implemented in another file - // - - //============================================================ - // UInt16Converter - // The UInt16 value type represents unsigned integers with values ranging from 0 to 65535 - // This converter can only convert a 16-bit unsigned integer object to and from a string. - // - unsigned short myUInt16(10000); - String^ myUInt16String = "20000"; - Console::WriteLine( TypeDescriptor::GetConverter( myUInt16 )->ConvertTo( myUInt16, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myUInt16 )->ConvertFrom( myUInt16String ) ); - // - - //============================================================ - // UInt32Converter - // The UInt32 value type represents unsigned integers with values ranging from 0 to 4,294,967,295. - // This converter can only convert a 32-bit unsigned integer object to and from a string. - // - unsigned int myUInt32(967299); - String^ myUInt32String = "1345556"; - Console::WriteLine( TypeDescriptor::GetConverter( myUInt32 )->ConvertTo( myUInt32, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myUInt32 )->ConvertFrom( myUInt32String ) ); - // - - //============================================================ - // UInt64Converter - // The UInt64 value type represents unsigned integers with values ranging from 0 to 184,467,440,737,095,551,615. - // This converter can only convert a 64-bit unsigned integer object to and from a string. - // - UInt64 myUInt64(123456789123); - String^ myUInt64String = "184467440737095551"; - Console::WriteLine( TypeDescriptor::GetConverter( myUInt64 )->ConvertTo( myUInt64, String::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( myUInt64 )->ConvertFrom( myUInt64String ) ); - // - - //============================================================ - // ExpandableObjectConverter - // - String^ strM = "1,2,3,4"; - System::Drawing::Printing::Margins^ m = gcnew System::Drawing::Printing::Margins( 1,2,3,4 ); - Console::WriteLine( TypeDescriptor::GetConverter( strM )->CanConvertTo( System::Drawing::Printing::Margins::typeid ) ); - Console::WriteLine( TypeDescriptor::GetConverter( m )->ConvertToString( m ) ); - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp b/snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp deleted file mode 100644 index cf49697d3d8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -ref class TestForm: public Form -{ - // -public: - void InitializeMyMenu() - { - // Create the MainMenu Object*. - MainMenu^ myMainMenu = gcnew MainMenu; - - // Create the MenuItem objects. - MenuItem^ fileMenu = gcnew MenuItem( "&File" ); - MenuItem^ newFile = gcnew MenuItem( "&New" ); - MenuItem^ openFile = gcnew MenuItem( "&Open" ); - MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); - - // Add the File menu item to myMainMenu. - myMainMenu->MenuItems->Add( fileMenu ); - - // Add three submenus to the File menu. - fileMenu->MenuItems->Add( newFile ); - fileMenu->MenuItems->Add( openFile ); - fileMenu->MenuItems->Add( exitProgram ); - - // Assign myMainMenu to the form. - this->Menu = myMainMenu; - - // Count the number of objects in the File menu and display the result. - String^ objectNumber = fileMenu->MenuItems->Count.ToString(); - MessageBox::Show( "Number of objects in the File menu = " + objectNumber ); - } - // -}; - -int main() -{ - Application::Run( gcnew TestForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp b/snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp deleted file mode 100644 index f5b17f27425..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp +++ /dev/null @@ -1,199 +0,0 @@ - - -// -#include - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Runtime::InteropServices; -using namespace System::Diagnostics; -using namespace System::IO; - -public ref class MyIconButton: public Button -{ -private: - Icon^ icon; - -public: - MyIconButton() - { - - // Set the button's FlatStyle property. - FlatStyle = ::FlatStyle::System; - } - - MyIconButton( Icon^ ButtonIcon ) - { - - // Set the button's FlatStyle property. - FlatStyle = ::FlatStyle::System; - - // Assign the icon to the private field. - this->icon = ButtonIcon; - - // Size the button to 4 pixels larger than the icon. - this->Height = icon->Height + 4; - this->Width = icon->Width + 4; - } - - -protected: - - property System::Windows::Forms::CreateParams^ CreateParams - { - - // - virtual System::Windows::Forms::CreateParams^ get() override - { - - // Extend the CreateParams property of the Button class. - System::Windows::Forms::CreateParams^ cp = __super::CreateParams; - - // Update the button Style. - cp->Style |= 0x00000040; // BS_ICON value - return cp; - } - // - } - -public: - property System::Drawing::Icon^ Icon - { - System::Drawing::Icon^ get() - { - return icon; - } - void set(System::Drawing::Icon^ value) - { - icon = value; - UpdateIcon(); - this->Height = icon->Height + 4; - this->Width = icon->Width + 4; - } - } - -protected: - virtual void OnHandleCreated( EventArgs^ e ) override - { - Button::OnHandleCreated( e ); - - // Update the icon on the button if there is currently an icon assigned to the icon field. - if ( icon != nullptr ) - { - UpdateIcon(); - } - } - - -private: - void UpdateIcon() - { - IntPtr iconHandle = IntPtr::Zero; - - // Get the icon's handle. - if ( icon != nullptr ) - { - iconHandle = icon->Handle; - } - - - // Send Windows the message to update the button. - SendMessage( (HWND)Handle.ToPointer(), 0x00F7, 1, (int)iconHandle ); - - /*BM_SETIMAGE value*/ - /*IMAGE_ICON value*/ - } - - public: - [DllImport("user32.dll")] - static LRESULT SendMessage(HWND hWnd, int msg, int wParam, int lParam); - -}; - - -// -// -public ref class MyApplication: public Form -{ -private: - MyIconButton^ myIconButton; - Button^ stdButton; - OpenFileDialog^ openDlg; - -public: - MyApplication() - { - try - { - - // Create the button with the default icon. - myIconButton = gcnew MyIconButton( gcnew System::Drawing::Icon( String::Concat( Application::StartupPath, "\\Default.ico" ) ) ); - } - catch ( Exception^ ex ) - { - - // If the default icon does not exist, create the button without an icon. - myIconButton = gcnew MyIconButton; - #if defined(DEBUG) - Debug::WriteLine( ex ); - #endif - } - finally - { - stdButton = gcnew Button; - - // Add the Click event handlers. - myIconButton->Click += gcnew EventHandler( this, &MyApplication::myIconButton_Click ); - stdButton->Click += gcnew EventHandler( this, &MyApplication::stdButton_Click ); - - // Set the location, text and width of the standard button. - stdButton->Location = Point(myIconButton->Location.X,myIconButton->Location.Y + myIconButton->Height + 20); - stdButton->Text = "Change Icon"; - stdButton->Width = 100; - - // Add the buttons to the Form. - this->Controls->Add( stdButton ); - this->Controls->Add( myIconButton ); - } - - } - - -private: - void myIconButton_Click( Object^ /*Sender*/, EventArgs^ /*e*/ ) - { - -#undef MessageBox - - // Make sure MyIconButton works. - MessageBox::Show( "MyIconButton was clicked!" ); - } - - void stdButton_Click( Object^ /*Sender*/, EventArgs^ /*e*/ ) - { - - // Use an OpenFileDialog to allow the user to assign a new image to the derived button. - openDlg = gcnew OpenFileDialog; - openDlg->InitialDirectory = Application::StartupPath; - openDlg->Filter = "Icon files (*.ico)|*.ico"; - openDlg->Multiselect = false; - openDlg->ShowDialog(); - if ( !openDlg->FileName->Equals( "" ) ) - { - myIconButton->Icon = gcnew System::Drawing::Icon( openDlg->FileName ); - } - } - -}; - -int main() -{ - Application::Run( gcnew MyApplication ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp b/snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp deleted file mode 100644 index fcdb5c20b89..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#using -#using -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Data::SqlClient; -using namespace System::Data; - -public ref class MyGridForm: public Form -{ -private: - DataGrid^ grid; - -public: - MyGridForm() - { - grid = gcnew DataGrid; - grid->Size = this->Size; - String^ connstr = "Data Source=localhost;Initial Catalog=NORTHWIND;Integrated Security=SSPI"; - SqlDataAdapter^ custAdapter; - SqlDataAdapter^ orderAdapter; - custAdapter = gcnew SqlDataAdapter( "select * from customers",connstr ); - orderAdapter = gcnew SqlDataAdapter( "select * from orders",connstr ); - DataSet^ ds = gcnew DataSet; - custAdapter->Fill( ds, "Customers" ); - orderAdapter->Fill( ds, "Orders" ); - ds->Relations->Add( "CustOrders", ds->Tables[ "Customers" ]->Columns[ "CustomerID" ], - ds->Tables[ "Orders" ]->Columns[ "CustomerID" ] ); - Controls->Add( grid ); - grid->SetDataBinding( ds, "Customers" ); - grid->Navigate += gcnew NavigateEventHandler( this, &MyGridForm::Grid_Navigate ); - } - - // -private: - void Grid_Navigate( Object^ /*sender*/, NavigateEventArgs^ e ) - { - if ( e->Forward ) - { - DataSet^ ds = dynamic_cast(grid->DataSource); - CurrencyManager^ cm = dynamic_cast(BindingContext[ds, "Customers::CustOrders"]); - - // Cast the IList* to a DataView to set the AllowNew property. - DataView^ dv = dynamic_cast(cm->List); - dv->AllowNew = false; - } - } - // -}; - -int main() -{ - Application::Run( gcnew MyGridForm ); -} - -/* -This code produces the following output. - -$123, 456, 789, 012, 345.00 -$12, 3456, 7890, 123, 45.00 -$1234567890, 123, 45.00 -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp b/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp deleted file mode 100644 index f846363e4cf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp +++ /dev/null @@ -1,153 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; -using namespace System::Resources; - -namespace MyCursors -{ - public ref class MyCursor: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ myButton; - System::ComponentModel::Container^ components; - - public: - MyCursor() - { - components = nullptr; - InitializeComponent(); - } - - protected: - ~MyCursor() - { - if ( components != nullptr ) - { - delete components; - } - } - - // - private: - void SetCursor() - { - // Display an OpenFileDialog so the user can select a cursor. - OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog; - openFileDialog1->Filter = "Cursor Files|*.cur"; - openFileDialog1->Title = "Select a Cursor File"; - openFileDialog1->ShowDialog(); - - // If a .cur file was selected, open it. - if ( !openFileDialog1->FileName->Equals( "" ) ) - { - // Assign the cursor in the stream to the form's Cursor property. - this->Cursor = gcnew System::Windows::Forms::Cursor( openFileDialog1->OpenFile() ); - } - } - // - - // - private: - void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - /* Call the CursorFromResource method and - display the embedded cursor resource. */ - this->Cursor = CursorFromResource( MyCursors::MyCursor::typeid, "MyWaitCursor::cur" ); - } - - System::Windows::Forms::Cursor^ CursorFromResource( Type^ type, String^ resource ) - { - // Create a cursor from the resource. - try - { - return gcnew System::Windows::Forms::Cursor( type,resource ); - } - // If the cursor cannot be created, message the user. - catch ( Exception^ ex ) - { - MessageBox::Show( ex->ToString() ); - return nullptr; - } - } - // - - // - private: - void myButton_MouseEnter( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Hide the cursor when the mouse pointer enters the button. - ::Cursor::Hide(); - } - - void myButton_MouseLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Show the cursor when the mouse pointer leaves the button. - ::Cursor::Show(); - } - // - - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->myButton = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 104, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &MyCursor::button1_Click ); - this->myButton->MouseEnter += gcnew System::EventHandler( this, &MyCursor::myButton_MouseEnter ); - this->myButton->MouseLeave += gcnew System::EventHandler( this, &MyCursor::myButton_MouseLeave ); - - // - // myButton - // - this->myButton->Location = System::Drawing::Point( 40, 32 ); - this->myButton->Name = "myButton"; - this->myButton->TabIndex = 1; - this->myButton->Text = "myButton"; - this->myButton->Click += gcnew System::EventHandler( this, &MyCursor::myButton_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->myButton,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->SetCursor(); - } - }; -} -// end class -// end namespace - -[STAThread] -int main() -{ - Application::Run( gcnew MyCursors::MyCursor ); -} - -//Output: -//System::Globalization::NumberFormatInfo -//This instance is a read-only. diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp deleted file mode 100644 index 8ad6a7d8749..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -// System.Windows.Forms.DataFormats.Dif -/* -The following example demonstrates the 'Dif' field of 'DataFormats' class. -It creates a 'FileStream' object of the Temp.dif file. -It stores the object in the form of the 'Dif' -format in the 'DataObject'. Then it checks whether the data -stored in 'Dif' format is present or not. -*/ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::IO; - -int main() -{ - try - { - // - FileStream^ myFileStream = File::Open( "Temp.dif", FileMode::Open ); - - // Store the data into Dif format. - DataObject^ myDataObject = gcnew DataObject; - myDataObject->SetData( DataFormats::Dif, myFileStream ); - - // Check whether the data is stored or not in the specified format. - bool formatPresent = myDataObject->GetDataPresent( DataFormats::Dif ); - if ( formatPresent ) - { - Console::WriteLine( "The data has been stored in the Dif format is:'{0}'", formatPresent ); - } - else - { - Console::WriteLine( "The data has not been stored in the specified format" ); - } - // - } - catch ( Exception^ e ) - { - Console::WriteLine( "The Exception is:{0}", e->Message ); - } -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp deleted file mode 100644 index 5cdb69c1b55..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// System::Windows::Forms::DataFormats::GetFormat(int) -/* -The following example demonstrates the 'GetFormat(int)' method of 'DataFormats' -class. It creates a 'DataFormats' Object* using a integer into the 'GetFormat' method. -By using the 'DatFormats' Object* it displays the format name with respective the id. -*/ -#using -#using - -// -using namespace System; -using namespace System::Windows::Forms; -int main() -{ - - // Create a DataFormats::Format for the Unicode data format. - DataFormats::Format^ myFormat = DataFormats::GetFormat( 13 ); - - // Display the contents of myFormat. - Console::WriteLine( "The Format Name corresponding to the ID {0} is :", myFormat->Id ); - Console::WriteLine( myFormat->Name ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp deleted file mode 100644 index d2f936944f9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// System::Windows::Forms::DataFormats::StringFormat - -/* -* The following example demonstrates the 'StringFormat' field of 'DataFormats' class. -* It stores a String Object^ in Clipboard using the Clipboard's 'SetDataObject' method. -* It retrieves the String Object^ stored in the Clipboard by using the GetDataObject method -* which returns the 'IDataObject^'. It checks the String^ data is available or not -* by using the 'GetDataPresent' method of 'IDataObject^'. If data is there then it -* displays the data to the console. -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Drawing::Imaging; -using namespace System::Windows::Forms; - -int main() -{ - // - try - { - String^ myString = "This is a String from the ClipBoard"; - // Sets the data to the Clipboard. - Clipboard::SetDataObject( myString ); - IDataObject^ myDataObject = Clipboard::GetDataObject(); - - // Checks whether the data is present or not in the Clipboard. - if ( myDataObject->GetDataPresent( DataFormats::StringFormat ) ) - { - String^ clipString = (String^)(myDataObject->GetData( DataFormats::StringFormat )); - Console::WriteLine( clipString ); - } - else - { - Console::WriteLine( "No String information was contained in the clipboard." ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - // -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp deleted file mode 100644 index 57deb279115..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp +++ /dev/null @@ -1,57 +0,0 @@ -// System::Windows::Forms::DataFormats.UnicodeText;System::Windows::Forms::Text; - -/* -* The following example demonstrates the 'UnicodeText' and 'Text' field of 'DataFormats' class. -* It stores a String Object^ in Clipboard using the Clipboard's 'SetDataObject' method. -* It retrieves the String Object^ stored in the Clipboard by using the GetDataObject method -* which returns the 'IDataObject^'. It checks whether the Unicodetext data is present -* or not by using the 'GetDataPresent' method of 'IDataObject^'. If data is there then it -* displays the data to the console. It also checks 'Text' format data is present or not. If -* the data is there it displays the data to the console. -* -*/ - -#using -#using -#using - -using namespace System; -using namespace System::Drawing::Imaging; -using namespace System::Windows::Forms; - -int main() -{ - // - // - try - { - String^ myString = "This is a String from the ClipBoard"; - - // Sets the data into the Clipboard. - Clipboard::SetDataObject( myString ); - IDataObject^ myDataObject = Clipboard::GetDataObject(); - // Checks whether the format of the data is 'UnicodeText' or not. - if ( myDataObject->GetDataPresent( DataFormats::UnicodeText ) ) - { - Console::WriteLine( "Data in 'UnicodeText' format: " + - myDataObject->GetData( DataFormats::UnicodeText ) ); - } - else - { - Console::WriteLine( "No String information was contained in the clipboard." ); - } - - // Checks whether the format of the data is 'Text' or not. - if ( myDataObject->GetDataPresent( DataFormats::Text ) ) - { - String^ clipString = (String^)(myDataObject->GetData( DataFormats::StringFormat )); - Console::WriteLine( "Data in 'Text' format: {0}", clipString ); - } - } - catch ( Exception^ e ) - { - Console::WriteLine( e->Message ); - } - // - // -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp deleted file mode 100644 index 8e1f3aaa5f9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::ComponentModel; - -namespace DataGridSample -{ - // - public ref class MyDataGrid: public DataGrid - { - protected: - - // Override the OnMouseDown event to select the whole row - // when the user clicks anywhere on a row. - virtual void OnMouseDown( MouseEventArgs^ e ) override - { - - // Get the HitTestInfo to return the row and pass - // that value to the IsSelected property of the DataGrid. - DataGrid::HitTestInfo ^ hit = this->HitTest( e->X, e->Y ); - if ( hit->Row < 0 ) - return; - - if ( this->IsSelected( hit->Row ) ) - UnSelect( hit->Row ); - else - Select(hit->Row); - } - }; - // - - public ref class MyDataGridForm: public Form - { - private: - DataTable^ dataTable; - DataGridSample::MyDataGrid^ grid; - Button^ button1; - Label^ label1; - - public: - MyDataGridForm() - { - grid = gcnew DataGridSample::MyDataGrid; - button1 = gcnew Button; - label1 = gcnew Label; - InitForm(); - dataTable = gcnew DataTable( "name" ); - dataTable->Columns->Add( gcnew DataColumn( "First" ) ); - DataColumn^ column = gcnew DataColumn( "name" ); - dataTable->Columns->Add( column ); - dataTable->Columns->Add( gcnew DataColumn( "Second",bool::typeid ) ); - - //dataTable.Columns->Item[S"First"].ReadOnly = true; - DataSet^ First = gcnew DataSet; - First->Tables->Add( dataTable ); - grid->DataSource = First; - grid->DataMember = "name"; - AddSomeData(); - - // grid.SetDataBinding(First, S"name"); - // grid.ReadOnly = true; - // grid.DataMember = S"First"; - button1->Click += gcnew EventHandler( this, &MyDataGridForm::OnButtonClick ); - } - - private: - void OnButtonClick( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - //combo.Sorted = true; - // grid->Item[0, 0] = S"nou"; - // grid.SetDataBinding(0, S""); - //DataGridSample::SortDataGrid.Sort(grid, S"First", true); - } - - void grid_Enter( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - grid->CurrentCell = DataGridCell(2,2); - } - - void AddSomeData() - { - DataRow^ dRow; - for ( int i = 0; i < 5; i++ ) - { - dRow = dataTable->NewRow(); - dRow[ "First" ] = String::Format( "FirstName {0}", i ); - dRow[ "name" ] = String::Format( "LastName {0}", i ); - dataTable->Rows->Add( dRow ); - } - } - - void foo( Object^ /*sender*/, KeyEventArgs^ /*e*/ ) - { - Console::WriteLine( "on key down handler called" ); - } - - void InitForm() - { - this->Size = System::Drawing::Size( 700, 500 ); - button1->Location = Point(300,300); - button1->Text = "Sort the grid programatically"; - button1->Width = 200; - grid->Size = System::Drawing::Size( 350, 250 ); - grid->TabStop = true; - grid->TabIndex = 1; - button1->TabStop = true; - button1->TabIndex = 1; - label1->Width = 300; - label1->Height = 100; - label1->Top = grid->Top; - label1->Left = grid->Right + 10; - label1->Text = "The grid on this app overrides the OnMouseDown event, so that when the user clicks anywhere on the grid, the user will select the row beneath the mouse cursor"; - this->Controls->Add( label1 ); - this->StartPosition = FormStartPosition::CenterScreen; - this->Controls->Add( grid ); - this->Controls->Add( button1 ); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew DataGridSample::MyDataGridForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp deleted file mode 100644 index 40e65d3ea56..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp +++ /dev/null @@ -1,252 +0,0 @@ -#using -#using -#using -#using -#using - -// -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::ComponentModel; - -public ref class DataGridBoolColumnInherit: public DataGridBoolColumn -{ -private: - SolidBrush^ trueBrush; - SolidBrush^ falseBrush; - DataColumn^ expressionColumn; - static int count = 0; - -public: - DataGridBoolColumnInherit() - : DataGridBoolColumn() - { - trueBrush = dynamic_cast(Brushes::Blue); - falseBrush = dynamic_cast(Brushes::Yellow); - expressionColumn = nullptr; - count++; - } - - property Color FalseColor - { - Color get() - { - return falseBrush->Color; - } - - void set( Color value ) - { - falseBrush = gcnew System::Drawing::SolidBrush( value ); - Invalidate(); - } - } - - property Color TrueColor - { - Color get() - { - return trueBrush->Color; - } - - void set( Color value ) - { - trueBrush = gcnew System::Drawing::SolidBrush( value ); - Invalidate(); - } - } - - property String^ Expression - { - // This will work only with a DataSet or DataTable. - // The code is not compatible with IBindingList* implementations. - String^ get() - { - return this->expressionColumn == nullptr ? String::Empty : this->expressionColumn->Expression; - } - - void set( String^ value ) - { - if ( expressionColumn == nullptr ) - AddExpressionColumn( value ); - else - expressionColumn->Expression = value; - - if ( expressionColumn != nullptr && expressionColumn->Expression->Equals( value ) ) - return; - - Invalidate(); - } - } - -private: - void AddExpressionColumn( String^ value ) - { - // Get the grid's data source. First check for a 0 - // table or data grid. - if ( this->DataGridTableStyle == nullptr || this->DataGridTableStyle->DataGrid == nullptr ) - return; - - DataGrid^ myGrid = this->DataGridTableStyle->DataGrid; - DataView^ myDataView = dynamic_cast((dynamic_cast(myGrid->BindingContext[ myGrid->DataSource,myGrid->DataMember ]))->List); - - // This works only with System::Data::DataTable. - if ( myDataView == nullptr ) - return; - - // If the user already added a column with the name - // then exit. Otherwise, add the column and set the - // expression to the value passed to this function. - DataColumn^ col = myDataView->Table->Columns[ "__Computed__Column__" ]; - if ( col != nullptr ) - return; - - col = gcnew DataColumn( String::Concat( "__Computed__Column__", count ) ); - myDataView->Table->Columns->Add( col ); - col->Expression = value; - expressionColumn = col; - } - - // the OnPaint method to paint the cell based on the expression. -protected: - virtual void Paint( Graphics^ g, Rectangle bounds, CurrencyManager^ source, int rowNum, Brush^ backBrush, Brush^ foreBrush, bool alignToRight ) override - { - bool trueExpression = false; - bool hasExpression = false; - DataRowView^ drv = dynamic_cast(source->List[ rowNum ]); - hasExpression = this->expressionColumn != nullptr && this->expressionColumn->Expression != nullptr && !this->expressionColumn->Expression->Equals( String::Empty ); - Console::WriteLine( String::Format( "hasExpressionValue {0}", hasExpression ) ); - - // Get the value from the expression column. - // For simplicity, we assume a True/False value for the - // expression column. - if ( hasExpression ) - { - Object^ expr = drv->Row[ expressionColumn->ColumnName ]; - trueExpression = expr->Equals( "True" ); - } - - // Let the DataGridBoolColumn do the painting. - if ( !hasExpression ) - DataGridBoolColumn::Paint( g, bounds, source, rowNum, backBrush, foreBrush, alignToRight ); - - // Paint using the expression color for true or false, as calculated. - if ( trueExpression ) - DataGridBoolColumn::Paint( g, bounds, source, rowNum, trueBrush, foreBrush, alignToRight ); - else - DataGridBoolColumn::Paint( g, bounds, source, rowNum, falseBrush, foreBrush, alignToRight ); - } -}; - -public ref class MyForm: public Form -{ -private: - DataTable^ myTable; - DataGrid^ myGrid; - -public: - MyForm() - { - myGrid = gcnew DataGrid; - try - { - InitializeComponent(); - myTable = gcnew DataTable( "NamesTable" ); - myTable->Columns->Add( gcnew DataColumn( "Name" ) ); - DataColumn^ column = gcnew DataColumn( "id",Int32::typeid ); - myTable->Columns->Add( column ); - myTable->Columns->Add( gcnew DataColumn( "calculatedField",bool::typeid ) ); - DataSet^ namesDataSet = gcnew DataSet; - namesDataSet->Tables->Add( myTable ); - myGrid->SetDataBinding( namesDataSet, "NamesTable" ); - AddTableStyle(); - AddData(); - } - catch ( System::Exception^ exc ) - { - Console::WriteLine( exc ); - } - } - -private: - void grid_Enter( Object^ sender, EventArgs^ e ) - { - myGrid->CurrentCell = DataGridCell(2,2); - } - - void AddTableStyle() - { - // Map a new TableStyle to the DataTable. Then - // add DataGridColumnStyle objects to the collection - // of column styles with appropriate mappings. - DataGridTableStyle^ dgt = gcnew DataGridTableStyle; - dgt->MappingName = "NamesTable"; - DataGridTextBoxColumn^ dgtbc = gcnew DataGridTextBoxColumn; - dgtbc->MappingName = "Name"; - dgtbc->HeaderText = "Name"; - dgt->GridColumnStyles->Add( dgtbc ); - dgtbc = gcnew DataGridTextBoxColumn; - dgtbc->MappingName = "id"; - dgtbc->HeaderText = "id"; - dgt->GridColumnStyles->Add( dgtbc ); - DataGridBoolColumnInherit^ db = gcnew DataGridBoolColumnInherit; - db->HeaderText = "less than 1000 = blue"; - db->Width = 150; - db->MappingName = "calculatedField"; - dgt->GridColumnStyles->Add( db ); - myGrid->TableStyles->Add( dgt ); - - // This expression instructs the grid to change - // the color of the inherited DataGridBoolColumn - // according to the value of the id field. If it's - // less than 1000, the row is blue. Otherwise, - // the color is yellow. - db->Expression = "id < 1000"; - } - - void AddData() - { - // Add data with varying numbers for the id field. - // If the number is over 1000, the cell will paint - // yellow. Otherwise, it will be blue. - DataRow^ dRow = myTable->NewRow(); - dRow[ "Name" ] = "name 1 "; - dRow[ "id" ] = 999; - myTable->Rows->Add( dRow ); - dRow = myTable->NewRow(); - dRow[ "Name" ] = "name 2"; - dRow[ "id" ] = 2300; - myTable->Rows->Add( dRow ); - dRow = myTable->NewRow(); - dRow[ "Name" ] = "name 3"; - dRow[ "id" ] = 120; - myTable->Rows->Add( dRow ); - dRow = myTable->NewRow(); - dRow[ "Name" ] = "name 4"; - dRow[ "id" ] = 4023; - myTable->Rows->Add( dRow ); - dRow = myTable->NewRow(); - dRow[ "Name" ] = "name 5"; - dRow[ "id" ] = 2345; - myTable->Rows->Add( dRow ); - myTable->AcceptChanges(); - } - - void InitializeComponent() - { - this->Size = System::Drawing::Size( 500, 500 ); - myGrid->Size = System::Drawing::Size( 350, 250 ); - myGrid->TabStop = true; - myGrid->TabIndex = 1; - this->StartPosition = FormStartPosition::CenterScreen; - this->Controls->Add( myGrid ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp deleted file mode 100644 index 4ed4886d47d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp +++ /dev/null @@ -1,284 +0,0 @@ -// System::Windows::Forms::DataGridBoolColumn::TrueValueChanged -// System::Windows::Forms::DataGridBoolColumn::AllowNullChanged -// System::Windows::Forms::DataGridBoolColumn::FalseValueChanged - -/* -The following example demonstrates 'TrueValueChanged', -AllowNullChanged' and 'FalseValueChanged' events for the -'DataGridBoolColumn' class. This example had a 'DataGrid' -which is associated with three columns and a datasource -created with the 'CreateSource' method. There are three -additional combo boxes each to change the 'TrueValue', -'FalseValue' and 'AllowNull' properties of the 'DataGridBoolColumn'. -The 'TrueValue' property is used to specify the Object* that -the 'DataGridBoolColumn' presumes to be a true value. The -'FalseValue' property has the same semantics. Changing -the value of these properties raises the corresponding -events. Changing 'TrueValue' raises the 'TrueValueChanged', -changing 'FalseValue' raises the 'FalseValueChanged' and -'AllowNull' changes the 'AllowNullChanged' events respectively. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle; - System::Windows::Forms::DataGridTextBoxColumn^ myDataGridTextBoxColumn1; - System::Windows::Forms::DataGridTextBoxColumn^ myDataGridTextBoxColumn2; - System::Windows::Forms::DataGridBoolColumn^ myDataGridBoolColumn; - System::Windows::Forms::Label ^ myLabel1; - System::Windows::Forms::ComboBox^ myComboBox1; - System::Windows::Forms::Label ^ myLabel2; - System::Windows::Forms::ComboBox^ myComboBox2; - System::Windows::Forms::Label ^ myLabel3; - System::Windows::Forms::ComboBox^ myComboBox3; - System::ComponentModel::Container^ components; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - } - -public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - - ICollection^ CreateSource() - { - //Create a new 'DataTable' object. - DataTable^ myDataTable = gcnew DataTable( "TestTable" ); - DataRow^ myDataRow; - - //Associate 'DataColumns' with the 'DataTable' object. - myDataTable->Columns->Add( gcnew DataColumn( "IntegerValue",Int32::typeid ) ); - myDataTable->Columns->Add( gcnew DataColumn( "StringValue",String::typeid ) ); - myDataTable->Columns->Add( gcnew DataColumn( "CurrencyValue",double::typeid ) ); - myDataTable->Columns->Add( gcnew DataColumn( "BooleanValue",Boolean::typeid ) ); - int count = 1; - bool even = false; - - //Insert new rows into the 'DataTable' object. - for ( int i = -5; i < 5; i++ ) - { - myDataRow = myDataTable->NewRow(); - myDataRow[ 0 ] = count; - myDataRow[ 1 ] = String::Concat( "Item ", count ); - myDataRow[ 2 ] = 1.23 * (count + 1); - - // If 'even' insert a 'DBNull' into the table. - if ( even ) - { - myDataRow[ 3 ] = Convert::DBNull; - even = false; - } - else - { - if ( i < 0 ) - - // If 'negative' insert a 'false' into the table. - myDataRow[ 3 ] = (bool^)false; // If 'positive' insert a 'true' into the table. - else - myDataRow[ 3 ] = true; - even = true; - } - - myDataTable->Rows->Add( myDataRow ); - count += 1; - } - - //Create a new instance of 'DataView' from the 'DataTable' instance. - DataView^ myDataView = gcnew DataView( myDataTable ); - return myDataView; - } - -private: - void InitializeComponent() - { - System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( MyForm::typeid ); - myDataGridTableStyle = gcnew System::Windows::Forms::DataGridTableStyle; - myDataGridTextBoxColumn1 = gcnew System::Windows::Forms::DataGridTextBoxColumn; - myDataGridTextBoxColumn2 = gcnew System::Windows::Forms::DataGridTextBoxColumn; - myDataGridBoolColumn = gcnew System::Windows::Forms::DataGridBoolColumn; - myLabel1 = gcnew System::Windows::Forms::Label; - myLabel2 = gcnew System::Windows::Forms::Label; - myDataGrid = gcnew System::Windows::Forms::DataGrid; - myLabel3 = gcnew System::Windows::Forms::Label; - myComboBox3 = gcnew System::Windows::Forms::ComboBox; - myComboBox2 = gcnew System::Windows::Forms::ComboBox; - myComboBox1 = gcnew System::Windows::Forms::ComboBox; - (dynamic_cast(myDataGrid))->BeginInit(); - SuspendLayout(); - - // - // myDataGridTableStyle - // - myDataGridTableStyle->DataGrid = myDataGrid; - array^columnStyles = {myDataGridTextBoxColumn1,myDataGridTextBoxColumn2,myDataGridBoolColumn}; - myDataGridTableStyle->GridColumnStyles->AddRange( columnStyles ); - myDataGridTableStyle->MappingName = "TestTable"; - - // - // myDataGridTextBoxColumn1 - // - myDataGridTextBoxColumn1->MappingName = "IntegerValue"; - - // - // myDataGridTextBoxColumn2 - // - myDataGridTextBoxColumn2->MappingName = "StringValue"; - - // - // myDataGridBoolColumn - // - myDataGridBoolColumn->MappingName = "BooleanValue"; - myDataGridBoolColumn->TrueValue = true; - myDataGridBoolColumn->FalseValue = (bool^)false; - myDataGridBoolColumn->NullValue = Convert::DBNull; - myDataGridBoolColumn->AllowNull = true; - RegisterEventHandlers( myDataGridBoolColumn ); - - // - // myLabel1 - // - myLabel1->Location = System::Drawing::Point( 16, 232 ); - myLabel1->Size = System::Drawing::Size( 136, 24 ); - myLabel1->Text = "Change the TrueValue to:"; - - // - // myLabel2 - // - myLabel2->Location = System::Drawing::Point( 16, 264 ); - myLabel2->Size = System::Drawing::Size( 136, 24 ); - myLabel2->Text = "Change the FalseValue to:"; - - // - // myDataGrid - // - myDataGrid->Location = System::Drawing::Point( 16, 0 ); - myDataGrid->Size = System::Drawing::Size( 296, 216 ); - myDataGrid->DataSource = CreateSource(); - array^tableStyles = {myDataGridTableStyle}; - myDataGrid->TableStyles->AddRange( tableStyles ); - - // - // myLabel3 - // - myLabel3->Location = System::Drawing::Point( 16, 296 ); - myLabel3->Size = System::Drawing::Size( 136, 24 ); - myLabel3->Text = "Allow 0 values to appear:"; - - // - // myComboBox3 - // - myComboBox3->Location = System::Drawing::Point( 168, 288 ); - myComboBox3->Size = System::Drawing::Size( 144, 21 ); - array^myComboBox3Items = {true,(bool^)false}; - myComboBox3->Items->AddRange( myComboBox3Items ); - myComboBox3->SelectedIndexChanged += gcnew System::EventHandler( this, &MyForm::myComboBox3_SelectedIndexChanged ); - - // - // myComboBox2 - // - myComboBox2->Location = System::Drawing::Point( 168, 256 ); - myComboBox2->Size = System::Drawing::Size( 144, 21 ); - array^myComboBox2Items = {true,(bool^)false}; - myComboBox2->Items->AddRange( myComboBox2Items ); - myComboBox2->SelectedIndexChanged += gcnew System::EventHandler( this, &MyForm::myComboBox2_SelectedIndexChanged ); - - // - // myComboBox1 - // - myComboBox1->Location = System::Drawing::Point( 168, 224 ); - myComboBox1->Size = System::Drawing::Size( 144, 21 ); - array^myComboBox1Items = {true,(bool^)false}; - myComboBox1->Items->AddRange( myComboBox1Items ); - myComboBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &MyForm::myComboBox1_SelectedIndexChanged ); - - // - // MyForm - // - ClientSize = System::Drawing::Size( 336, 341 ); - array^formControls = {myComboBox3,myLabel3,myComboBox2,myLabel2,myComboBox1,myLabel1,myDataGrid}; - Controls->AddRange( formControls ); - Name = "MyForm"; - Text = "MyForm"; - (dynamic_cast(myDataGrid))->EndInit(); - ResumeLayout( false ); - } - - // - // - // - void RegisterEventHandlers( DataGridBoolColumn^ myDataGridBoolColumn ) - { - myDataGridBoolColumn->AllowNullChanged += gcnew System::EventHandler( this, &MyForm::myDataGridBoolColumn_AllowNullChanged ); - myDataGridBoolColumn->TrueValueChanged += gcnew System::EventHandler( this, &MyForm::myDataGridBoolColumn_TrueValueChanged ); - myDataGridBoolColumn->FalseValueChanged += gcnew System::EventHandler( this, &MyForm::myDataGridBoolColumn_FalseValueChanged ); - } - - // Event handler for event when 'TrueValue' is property changed. - void myDataGridBoolColumn_TrueValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( String::Concat( "The TrueValue property of the DataGridBoolColumn has been changed to ", myDataGridBoolColumn->TrueValue ) ); - } - - // Event handler for event when 'FalseValue' is property changed. - void myDataGridBoolColumn_FalseValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( String::Concat( "The FalseValue property of the DataGridBoolColumn has been changed to ", myDataGridBoolColumn->FalseValue ) ); - } - - // Event handler for event when 'AllowNull' is property changed. - void myDataGridBoolColumn_AllowNullChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( String::Concat( "The AllowNull property of DataGridBoolColumn has been changed to ", myDataGridBoolColumn->AllowNull ) ); - } - // - // - // - - // Change the value of 'TrueValue' property to what user specifies. - void myComboBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGridBoolColumn->TrueValue = myComboBox1->Items[ myComboBox1->SelectedIndex ]; - } - - // Change the value of 'FalseValue' property to what user specifies. - void myComboBox2_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGridBoolColumn->FalseValue = myComboBox2->Items[ myComboBox2->SelectedIndex ]; - } - - // Change the value of 'AllowNull' property to what user specifies. - void myComboBox3_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGridBoolColumn->AllowNull = *dynamic_cast(myComboBox3->Items[ myComboBox3->SelectedIndex ]); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp deleted file mode 100644 index a507f074fac..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp +++ /dev/null @@ -1,292 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::Security::Permissions; - -// This example shows how to create your own column style that -// hosts a control, in this case, a DateTimePicker. - -public ref class CustomDateTimePicker : public DateTimePicker -{ -protected: - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - virtual bool ProcessKeyMessage( Message% m ) override - { - // Keep all the keys for the DateTimePicker. - return ProcessKeyEventArgs( m ); - } -}; - -public ref class DataGridTimePickerColumn : public DataGridColumnStyle -{ -private: - CustomDateTimePicker^ customDateTimePicker1; - - // The isEditing field tracks whether or not the user is - // editing data with the hosted control. - bool isEditing; - -public: - DataGridTimePickerColumn() - { - customDateTimePicker1 = gcnew CustomDateTimePicker; - customDateTimePicker1->Visible = false; - } - -protected: - virtual void Abort( int /*rowNum*/ ) override - { - isEditing = false; - customDateTimePicker1->ValueChanged -= - gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); - Invalidate(); - } - - virtual bool Commit( CurrencyManager^ dataSource, int rowNum ) override - { - customDateTimePicker1->Bounds = Rectangle::Empty; - - customDateTimePicker1->ValueChanged -= - gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); - - if ( !isEditing ) - return true; - - isEditing = false; - - try - { - DateTime value = customDateTimePicker1->Value; - SetColumnValueAtRow( dataSource, rowNum, value ); - } - catch ( Exception^ ) - { - Abort( rowNum ); - return false; - } - - Invalidate(); - return true; - } - - virtual void Edit( - CurrencyManager^ source, - int rowNum, - Rectangle bounds, - bool /*readOnly*/, - String^ /*displayText*/, - bool cellIsVisible ) override - { - DateTime value = (DateTime) - GetColumnValueAtRow( source, rowNum ); - if ( cellIsVisible ) - { - customDateTimePicker1->Bounds = Rectangle( - bounds.X + 2, bounds.Y + 2, - bounds.Width - 4, bounds.Height - 4 ); - customDateTimePicker1->Value = value; - customDateTimePicker1->Visible = true; - customDateTimePicker1->ValueChanged += - gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); - } - else - { - customDateTimePicker1->Value = value; - customDateTimePicker1->Visible = false; - } - - if ( customDateTimePicker1->Visible ) - DataGridTableStyle->DataGrid->Invalidate( bounds ); - - customDateTimePicker1->Focus(); - } - - virtual System::Drawing::Size GetPreferredSize( - Graphics^ /*g*/, - Object^ /*value*/ ) override - { - return Size( 100, customDateTimePicker1->PreferredHeight + 4); - } - - virtual int GetMinimumHeight() override - { - return customDateTimePicker1->PreferredHeight + 4; - } - - virtual int GetPreferredHeight( Graphics^ /*g*/, - Object^ /*value*/ ) override - { - return customDateTimePicker1->PreferredHeight + 4; - } - - virtual void Paint( Graphics^ g, - Rectangle bounds, - CurrencyManager^ source, - int rowNum ) override - { - Paint( g, bounds, source, rowNum, false ); - } - - virtual void Paint( - Graphics^ g, - Rectangle bounds, - CurrencyManager^ source, - int rowNum, - bool alignToRight ) override - { - Paint( - g, bounds, - source, - rowNum, - Brushes::Red, - Brushes::Blue, - alignToRight ); - } - - virtual void Paint( - Graphics^ g, - Rectangle bounds, - CurrencyManager^ source, - int rowNum, - Brush^ backBrush, - Brush^ foreBrush, - bool /*alignToRight*/ ) override - { - DateTime date = (DateTime) - GetColumnValueAtRow( source, rowNum ); - Rectangle rect = bounds; - g->FillRectangle( backBrush, rect ); - rect.Offset( 0, 2 ); - rect.Height -= 2; - g->DrawString( date.ToString( "d" ), - this->DataGridTableStyle->DataGrid->Font, - foreBrush, rect ); - } - - virtual void SetDataGridInColumn( DataGrid^ value ) override - { - DataGridColumnStyle::SetDataGridInColumn( value ); - if ( customDateTimePicker1->Parent != nullptr ) - { - customDateTimePicker1->Parent->Controls->Remove - ( customDateTimePicker1 ); - } - if ( value != nullptr ) - { - value->Controls->Add( customDateTimePicker1 ); - } - } - -private: - void TimePickerValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Remove the handler to prevent it from being called twice in a row. - customDateTimePicker1->ValueChanged -= - gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); - this->isEditing = true; - DataGridColumnStyle::ColumnStartedEditing( customDateTimePicker1 ); - } -}; - -public ref class MyForm: public Form -{ -private: - DataTable^ namesDataTable; - DataGrid^ grid; -public: - MyForm() - { - grid = gcnew DataGrid; - - InitForm(); - - namesDataTable = gcnew DataTable( "NamesTable" ); - namesDataTable->Columns->Add( gcnew DataColumn( "Name" ) ); - DataColumn^ dateColumn = gcnew DataColumn - ( "Date",DateTime::typeid ); - dateColumn->DefaultValue = DateTime::Today; - namesDataTable->Columns->Add( dateColumn ); - DataSet^ namesDataSet = gcnew DataSet; - namesDataSet->Tables->Add( namesDataTable ); - grid->DataSource = namesDataSet; - grid->DataMember = "NamesTable"; - AddGridStyle(); - AddData(); - } - -private: - void AddGridStyle() - { - DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle; - myGridStyle->MappingName = "NamesTable"; - DataGridTextBoxColumn^ nameColumnStyle = - gcnew DataGridTextBoxColumn; - nameColumnStyle->MappingName = "Name"; - nameColumnStyle->HeaderText = "Name"; - myGridStyle->GridColumnStyles->Add( nameColumnStyle ); - - DataGridTimePickerColumn^ timePickerColumnStyle = - gcnew DataGridTimePickerColumn; - timePickerColumnStyle->MappingName = "Date"; - timePickerColumnStyle->HeaderText = "Date"; - timePickerColumnStyle->Width = 100; - myGridStyle->GridColumnStyles->Add( timePickerColumnStyle ); - - grid->TableStyles->Add( myGridStyle ); - } - - void AddData() - { - DataRow^ dRow = namesDataTable->NewRow(); - dRow->default[ "Name" ] = "Name 1"; - dRow->default[ "Date" ] = DateTime(2001,12,01); - namesDataTable->Rows->Add( dRow ); - - dRow = namesDataTable->NewRow(); - dRow->default[ "Name" ] = "Name 2"; - dRow->default[ "Date" ] = DateTime(2001,12,04); - namesDataTable->Rows->Add( dRow ); - - dRow = namesDataTable->NewRow(); - dRow->default[ "Name" ] = "Name 3"; - dRow->default[ "Date" ] = DateTime(2001,12,29); - namesDataTable->Rows->Add( dRow ); - - dRow = namesDataTable->NewRow(); - dRow->default[ "Name" ] = "Name 4"; - dRow->default[ "Date" ] = DateTime(2001,12,13); - namesDataTable->Rows->Add( dRow ); - - dRow = namesDataTable->NewRow(); - dRow->default[ "Name" ] = "Name 5"; - dRow->default[ "Date" ] = DateTime(2001,12,21); - namesDataTable->Rows->Add( dRow ); - - namesDataTable->AcceptChanges(); - } - - void InitForm() - { - this->Size = System::Drawing::Size( 500, 500 ); - grid->Size = System::Drawing::Size( 350, 250 ); - grid->TabStop = true; - grid->TabIndex = 1; - this->StartPosition = FormStartPosition::CenterScreen; - this->Controls->Add( grid ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp deleted file mode 100644 index 41d33838fdd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle::AlignmentChanged - -/* -The following example demonstrates the 'AlignmentChanged' event of 'DataGridColumnStyle' class. -It adds a DataGrid and a button to a form. Then it creates a 'DataGridColumnStyle' Object* and -adds an eventhandler for the 'AlignmentChanged' event. When user clicks the 'Change Alignment' -button it changes the alignment of the 'DataGridColumnStyle' and the 'AlignmentChanged' event is -raised. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - Button^ myButton; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridColumnStyle^ myDataGridColumnStyle; - -public: - Form1() - { - myMessage = nullptr; - InitializeComponent(); - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - AddCustomDataTableStyle(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myButton = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->Text = "DataGrid Control Sample"; - this->ClientSize = System::Drawing::Size( 450, 330 ); - myButton->Location = Point(150,16); - myButton->Size = System::Drawing::Size( 120, 24 ); - myButton->Text = "Change Alignment"; - myButton->Click += gcnew EventHandler( this, &Form1::Button_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 300, 200 ); - myDataGrid->CaptionText = "DataGridColumnStyle"; - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - } - - String^ myMessage; - - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGridColumnStyle->Alignment = HorizontalAlignment::Center; - MessageBox::Show( myMessage ); - } - - // -private: - void AlignmentChanged_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myMessage = "Alignment has been Changed"; - } - - void AddCustomDataTableStyle() - { - // Create a 'DataGridTableStyle'. - DataGridTableStyle^ myDataTableStyle = gcnew DataGridTableStyle; - myDataTableStyle->MappingName = "Customers"; - - // Create a 'DataGridColumnStyle'. - myDataGridColumnStyle = gcnew DataGridTextBoxColumn; - myDataGridColumnStyle->MappingName = "CustName"; - myDataGridColumnStyle->HeaderText = "Customer Name"; - myDataGridColumnStyle->Width = 250; - myDataGridColumnStyle->AlignmentChanged += gcnew EventHandler( this, &Form1::AlignmentChanged_Click ); - - // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. - myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); - - // Add the 'DataGridTableStyle' to 'DataGrid'. - myDataGrid->TableStyles->Add( myDataTableStyle ); - } - // - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Customers" ); - DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); - myTable->Columns->Add( myColumn ); - myDataSet->Tables->Add( myTable ); - DataRow^ newRow1; - for ( int i = 0; i < 5; i++ ) - { - newRow1 = myTable->NewRow(); - newRow1[ "CustName" ] = i; - - // Add the row to the Customers table. - myTable->Rows->Add( newRow1 ); - } - myTable->Rows[ 0 ][ "CustName" ] = "Jones"; - myTable->Rows[ 1 ][ "CustName" ] = "James"; - myTable->Rows[ 2 ][ "CustName" ] = "David"; - myTable->Rows[ 3 ][ "CustName" ] = "Robert"; - myTable->Rows[ 4 ][ "CustName" ] = "John"; - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp deleted file mode 100644 index 444c6694f65..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle:HeaderTextChanged - -/* -The following example demonstrates 'HeaderTextChanged' event of 'DataGridColumnStyle' class. -It adds a DataGrid and a Button and to a form. When user clicks on the button, it changes the'HeaderText' property -to 'Amount in $'. This raises the 'HeaderTextChanged' event which calls user defined EventHandler function and -displays a message on form. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class myDataForm: public Form -{ -private: - Button^ myButton; - Label^ myLabel; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - bool * TablesAlreadyAdded; - -public: - myDataForm() - { - InitializeComponent(); - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Orders" ); - } - -private: - void InitializeComponent() - { - Text = "HeaderTextChanged Example"; - myButton = gcnew Button; - myDataGrid = gcnew DataGrid; - ClientSize = System::Drawing::Size( 450, 330 ); - myButton->Location = Point(24,16); - myButton->Size = System::Drawing::Size( 120, 24 ); - myButton->Text = "Currency Format"; - myButton->Click += gcnew EventHandler( this, &myDataForm::myButton_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 170, 200 ); - myDataGrid->CaptionText = "DataGridColumnStyle"; - myLabel = gcnew Label; - myLabel->Location = Point(24,270); - myLabel->Width = 500; - Controls->Add( myButton ); - Controls->Add( myDataGrid ); - Controls->Add( myLabel ); - } - -private: - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( TablesAlreadyAdded ) - { - return; - } - - AddCustomDataTableStyle(); - } - - // -private: - void AddCustomDataTableStyle() - { - DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; - - // Map DataGridTableStyle to a DataTable. - myTableStyle->MappingName = "Orders"; - - // Get CurrencyManager Object*. - CurrencyManager^ myCurrencyManager = dynamic_cast(BindingContext[myDataSet, "Orders"]); - - // Use the CurrencyManager to get the PropertyDescriptor for the column. - PropertyDescriptor^ myPropertyDescriptor = myCurrencyManager->GetItemProperties()[ "Amount" ]; - - // Change the HeaderText. - DataGridColumnStyle^ myColumnStyle = gcnew DataGridTextBoxColumn( myPropertyDescriptor,"c",true ); - - // Attach a event handler function with the 'HeaderTextChanged' event. - myColumnStyle->HeaderTextChanged += gcnew EventHandler( this, &myDataForm::MyHeaderText_Changed ); - myColumnStyle->Width = 130; - myColumnStyle->HeaderText = "Amount in $"; - myTableStyle->GridColumnStyles->Add( myColumnStyle ); - myDataGrid->TableStyles->Add( myTableStyle ); - TablesAlreadyAdded = (bool *)true; - } - - void MyHeaderText_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myLabel->Text = "Header Descriptor Property of DataGridColumnStyle has changed"; - } - // - - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Orders" ); - DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); - myTable->Columns->Add( myColumn ); - myDataSet->Tables->Add( myTable ); - System::Data::DataRow^ newRow; - for ( int j = 1; j < 15; j++ ) - { - newRow = myTable->NewRow(); - newRow[ "Amount" ] = j * 10 + j * .1; - myTable->Rows->Add( newRow ); - } - } -}; - -int main() -{ - Application::Run( gcnew myDataForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp deleted file mode 100644 index ddfe02b7d37..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp +++ /dev/null @@ -1,135 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle.MappingNameChanged - -/* -* The following example demonstrates the 'MappingNameChanged' event of 'DataGridColumnStyle' class. -It adds a DataGrid and a button to a Form. When the user clicks on the 'Change Mapping Name' -button, it changes mapping name and generates 'MappingNameChanged' event. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - DataGrid^ myDataGrid; - bool * flag; - Button^ myButton; - DataSet^ myDataSet; - DataGridColumnStyle^ myColumnStyle; - -public: - MyForm() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - myDataGrid = gcnew DataGrid; - myButton = gcnew Button; - myDataGrid->Location = Point(24,24); - myDataGrid->Name = "myDataGrid"; - myDataGrid->CaptionText = "DataGridColumn"; - myDataGrid->Height = 130; - myDataGrid->Width = 150; - myDataGrid->TabIndex = 0; - myButton->Location = Point(60,208); - myButton->Name = "myButton "; - myButton->TabIndex = 3; - myButton->Size = System::Drawing::Size( 140, 20 ); - myButton->Text = "Change Mapping Name"; - myButton->Click += gcnew EventHandler( this, &MyForm::button_Click ); - ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {myButton,myDataGrid}; - Controls->AddRange( temp0 ); - Name = "Form1"; - Text = "MappingNameChanged Event"; - ResumeLayout( false ); - } - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Orders" ); - } - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Orders" ); - DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); - DataColumn^ myColumn1 = gcnew DataColumn( "Orders",Decimal::typeid ); - myTable->Columns->Add( myColumn ); - myTable->Columns->Add( myColumn1 ); - myDataSet->Tables->Add( myTable ); - DataRow^ newRow; - for ( int j = 1; j < 15; j++ ) - { - newRow = myTable->NewRow(); - newRow[ "Amount" ] = j * 10; - newRow[ "Orders" ] = 10; - myTable->Rows->Add( newRow ); - } - AddCustomColumnStyle(); - } - - // -private: - void AddCustomColumnStyle() - { - DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; - myTableStyle->MappingName = "Orders"; - myColumnStyle = gcnew DataGridTextBoxColumn; - myColumnStyle->MappingName = "Orders"; - myColumnStyle->HeaderText = "Orders"; - myTableStyle->GridColumnStyles->Add( myColumnStyle ); - myDataGrid->TableStyles->Add( myTableStyle ); - myColumnStyle->MappingNameChanged += gcnew EventHandler( this, &MyForm::columnStyle_MappingNameChanged ); - flag = (bool *)true; - } - - // MappingNameChanged event handler of DataGridColumnStyle. - void columnStyle_MappingNameChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "Mapping Name changed" ); - } - // - - void button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Change the Mapping name. - if ( flag ) - { - myColumnStyle = myDataGrid->TableStyles[ 0 ]->GridColumnStyles[ "Orders" ]; - myColumnStyle->MappingName = "Amount"; - myColumnStyle->HeaderText = "Amount"; - this->Refresh(); - flag = false; - } - else - { - myColumnStyle = myDataGrid->TableStyles[ 0 ]->GridColumnStyles[ "Amount" ]; - myColumnStyle->MappingName = "Orders"; - myColumnStyle->HeaderText = "Orders"; - this->Refresh(); - flag = (bool *)true; - } - } -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp deleted file mode 100644 index 9ec399d0ad0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle::NullTextChanged - -/* -The following example demonstrates the 'NullTextChanged' event of 'DataGridColumnStyle' class. -It adds a DataGrid and a Button::to a 'Form'. When user clicks the 'Delete Column values' button, -the column becomes empty and 'NullTextChanged' event is raised which is handled by event handler -function. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - DataGrid^ myDataGrid; - Button^ myButton; - DataSet^ myDataSet; - DataGridTableStyle^ myTableStyle; - DataGridCell myCell; - DataGridColumnStyle^ myColumnStyle; - CurrencyManager^ myCurrencyManager; - -public: - int myRowcount; - MyForm() - { - InitializeComponent(); - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "CustTable" ); - myCurrencyManager = dynamic_cast(this->BindingContext[myDataSet, "CustTable"]); - } - -private: - void InitializeComponent() - { - myDataGrid = gcnew DataGrid; - myCell = DataGridCell(0,0); - myButton = gcnew Button; - myDataGrid->Location = Point(24,24); - myDataGrid->Name = "myDataGrid"; - myDataGrid->CaptionText = "DataGridColumn "; - myDataGrid->Size = System::Drawing::Size( 130, 93 ); - myButton->Location = Point(60,208); - myButton->Size = System::Drawing::Size( 130, 20 ); - myButton->Text = "Delete Column Values"; - myButton->Click += gcnew EventHandler( this, &MyForm::button_Click ); - ClientSize = System::Drawing::Size( 360, 273 ); - array^temp0 = {myButton,myDataGrid}; - Controls->AddRange( temp0 ); - Text = "NullTextChanged "; - } - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ custTable = gcnew DataTable( "CustTable" ); - DataColumn^ custName = gcnew DataColumn( "Customers" ); - custTable->Columns->Add( custName ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( custTable ); - - // Create a DataRow variable. - DataRow^ newRow1; - for ( int i = 1; i < 4; i++ ) - { - newRow1 = custTable->NewRow(); - newRow1[ "Customers" ] = i; - - // Add the row to the Customers table. - custTable->Rows->Add( newRow1 ); - - } - custTable->Rows[ 0 ][ "Customers" ] = "Alpha"; - custTable->Rows[ 1 ][ "Customers" ] = "Beta"; - custTable->Rows[ 2 ][ "Customers" ] = "Omega"; - AddCustomColumnStyle(); - } - - // -private: - void AddCustomColumnStyle() - { - myTableStyle = gcnew DataGridTableStyle; - myColumnStyle = gcnew DataGridTextBoxColumn; - myColumnStyle->NullTextChanged += gcnew EventHandler( this, &MyForm::columnStyle_NullTextChanged ); - myTableStyle->GridColumnStyles->Add( myColumnStyle ); - myDataGrid->TableStyles->Add( myTableStyle ); - } - - // NullTextChanged event handler of DataGridColumnStyle. - void columnStyle_NullTextChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - for ( int i = 0; i < myRowcount; i++ ) - { - myCell.RowNumber = i; - myDataGrid[ myCell ] = nullptr; - - } - MessageBox::Show( "NullTextChanged Event is handled" ); - } - // - - void button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myRowcount = myCurrencyManager->Count; - - // Set the column to 0 reference. - for ( int i = 0; i < myRowcount; i++ ) - { - myCell.RowNumber = i; - myDataGrid[ myCell ] = ""; - - } - myColumnStyle->NullText = nullptr; - } -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp deleted file mode 100644 index 67c7742c1d0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle::PropertyDescriptorChanged - -/* The following example demonstrates 'PropertyDescriptorChanged' Event of 'DataGridColumnStyle' class. -A DataGrid and Button are added to a form. When user clicks on the button, the 'PropertyDescriptor' Format of -'DataGridColumnStyle' is changed to 'Currency' format. This raises 'PropertyDescriptorChanged' event, -which then calls user defined EventHandler function. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class myDataForm: public Form -{ -private: - Button^ myButton; - Label^ myLabel; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - bool TablesAlreadyAdded; - -public: - myDataForm() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - Text = "PropertyDescriptor Example"; - myButton = gcnew Button; - myDataGrid = gcnew DataGrid; - ClientSize = System::Drawing::Size( 450, 330 ); - myButton->Location = Point(24,16); - myButton->Size = System::Drawing::Size( 120, 24 ); - myButton->Text = "Currency Format"; - myButton->Click += gcnew EventHandler( this, &myDataForm::myButton_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 120, 200 ); - myDataGrid->CaptionText = "DataGrid Control"; - myLabel = gcnew Label; - myLabel->Location = Point(24,270); - myLabel->Width = 500; - Controls->Add( myButton ); - Controls->Add( myDataGrid ); - Controls->Add( myLabel ); - } - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Orders" ); - } - - // -private: - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( TablesAlreadyAdded ) - { - return; - } - - AddCustomDataTableStyle(); - } - - void AddCustomDataTableStyle() - { - DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; - - // Map DataGridTableStyle to a DataTable. - myTableStyle->MappingName = "Orders"; - - // Get CurrencyManager object. - CurrencyManager^ myCurrencyManager = dynamic_cast(BindingContext[myDataSet, "Orders"]); - - // Use the CurrencyManager to get the PropertyDescriptor for column. - PropertyDescriptor^ myPropertyDescriptor = myCurrencyManager->GetItemProperties()[ "Amount" ]; - - // Construct a 'DataGridColumnStyle' object changing its format to 'Currency'. - DataGridColumnStyle^ myColumnStyle = gcnew DataGridTextBoxColumn( myPropertyDescriptor,"c",true ); - - // Add EventHandler function for PropertyDescriptorChanged Event. - myColumnStyle->PropertyDescriptorChanged += gcnew System::EventHandler( this, &myDataForm::MyPropertyDescriptor_Changed ); - myTableStyle->GridColumnStyles->Add( myColumnStyle ); - - // Add the DataGridTableStyle instance to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle ); - TablesAlreadyAdded = true; - } - - void MyPropertyDescriptor_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myLabel->Text = "Property Descriptor Property of DataGridColumnStyle has changed"; - } - // - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Orders" ); - DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); - myTable->Columns->Add( myColumn ); - myDataSet->Tables->Add( myTable ); - DataRow^ newRow; - for ( int j = 1; j < 15; j++ ) - { - newRow = myTable->NewRow(); - newRow[ "Amount" ] = j * 10; - myTable->Rows->Add( newRow ); - } - } -}; - -int main() -{ - Application::Run( gcnew myDataForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp deleted file mode 100644 index b026d75f831..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp +++ /dev/null @@ -1,126 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle::ReadOnlyChanged - -/* -The following example demonstrates the 'ReadOnlyChanged' event of the 'DataGridColumnStyle' class. -It adds DataGrid and Button to a form. When user clicks on button the 'ReadOnly' property of 'DataGridColumnStyle' -is changed. This raises the 'ReadOnlyChanged' event which then calls the user defined EventHandler function. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm1: public Form -{ -private: - DataGrid^ myDataGrid; - Button^ myButton; - DataSet^ myDataSet; - DataGridTableStyle^ myDataGridTableStyle; - DataGridColumnStyle^ myDataGridColumnStyle; - DataTable^ myDataTable; - DataColumn^ myDataColumn1; - -public: - MyForm1() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - myDataGrid = gcnew DataGrid; - myDataGrid->Location = Point(52,32); - myDataGrid->Size = System::Drawing::Size( 115, 125 ); - ClientSize = System::Drawing::Size( 215, 273 ); - myButton = gcnew Button; - myButton->Location = Point(35,210); - myButton->Size = System::Drawing::Size( 145, 24 ); - myButton->Text = "Make column read only"; - myButton->Click += gcnew EventHandler( this, &MyForm1::Button_Click ); - array^temp0 = {myDataGrid,myButton}; - Controls->AddRange( temp0 ); - Name = "MyForm1"; - Text = "DataGridColumnStyle"; - } - - // -private: - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myButton->Text->Equals( "Make column read/write" ) ) - { - myDataGridColumnStyle->ReadOnly = false; - myButton->Text = "Make column read only"; - } - else - { - myDataGridColumnStyle->ReadOnly = true; - myButton->Text = "Make column read/write"; - } - } - - void AddCustomDataTableStyle() - { - myDataGridTableStyle = gcnew DataGridTableStyle; - myDataGridTableStyle->MappingName = "Customers"; - myDataGridColumnStyle = gcnew DataGridTextBoxColumn; - myDataGridColumnStyle->MappingName = "CustName"; - - // Add EventHandler function for readonlychanged event. - myDataGridColumnStyle->ReadOnlyChanged += gcnew EventHandler( this, &MyForm1::myDataGridColumnStyle_ReadOnlyChanged ); - myDataGridColumnStyle->HeaderText = "Customer"; - myDataGridTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); - - // Add the 'DataGridTableStyle' instance to the 'DataGrid'. - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - } - - void myDataGridColumnStyle_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "'Readonly' property is changed" ); - } - // - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - AddCustomDataTableStyle(); - } - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - myDataTable = gcnew DataTable( "Customers" ); - myDataColumn1 = gcnew DataColumn( "CustName" ); - myDataTable->Columns->Add( myDataColumn1 ); - myDataSet->Tables->Add( myDataTable ); - DataRow^ newRow1; - for ( int i = 1; i < 4; i++ ) - { - newRow1 = myDataTable->NewRow(); - - // Add the row to the customers table. - myDataTable->Rows->Add( newRow1 ); - - } - myDataTable->Rows[ 0 ][ "custName" ] = "Alpha"; - myDataTable->Rows[ 1 ][ "custName" ] = "Beta"; - myDataTable->Rows[ 2 ][ "custName" ] = "Omega"; - } -}; - -int main() -{ - Application::Run( gcnew MyForm1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp deleted file mode 100644 index 97f2049af0f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle::ResetHeaderText - -/* -The following example demonstrates 'ResetHeaderText' method of 'DataGridColumnStyle' class. -A 'DataGrid' and two Buttons are added to a form. An instance of 'DataGridColumnStyle' -is mapped to column of 'DataGrid'.On clicking the set button, the Header Text is set. The -reset button resets the HeaderText to its default value. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class DataGridColumnStyle_Header: public Form -{ -private: - DataGrid^ myDataGrid; - Button^ resetButton; - Button^ setButton; - DataGridTableStyle^ myDataGridTableStyle; - DataGridColumnStyle^ myDataGridColumnStyle; - void InitializeComponent() - { - setButton = gcnew Button; - resetButton = gcnew Button; - myDataGrid = gcnew DataGrid; - setButton->Location = Point(32,208); - setButton->Size = System::Drawing::Size( 120, 23 ); - setButton->Text = "Set Header Text"; - setButton->Click += gcnew EventHandler( this, &DataGridColumnStyle_Header::SetHeaderText ); - resetButton->Location = Point(152,208); - resetButton->Size = System::Drawing::Size( 120, 23 ); - resetButton->Text = "Reset Header Text"; - resetButton->Click += gcnew EventHandler( this, &DataGridColumnStyle_Header::ResetHeaderText ); - - // Grid Initialisation. - myDataGrid->DataMember = ""; - myDataGrid->Location = Point(56,32); - myDataGrid->Name = "myDataGrid"; - myDataGrid->CaptionText = "DataGrid"; - myDataGrid->Size = System::Drawing::Size( 120, 130 ); - myDataGrid->TabIndex = 0; - ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {myDataGrid,setButton}; - Controls->AddRange( temp0 ); - Name = "DataGridColumnStyle_Width"; - Text = "Change Header Text"; - Load += gcnew System::EventHandler( this, &DataGridColumnStyle_Header::DataGridColumnStyle_Reset_Header ); - } - -public: - DataGridColumnStyle_Header() - { - myDataGridTableStyle = gcnew DataGridTableStyle; - myDataGridColumnStyle = gcnew DataGridTextBoxColumn; - InitializeComponent(); - CreateDataSet(); - } - -private: - void CreateDataSet() - { - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myEmpTable = gcnew DataTable( "Employee" ); - DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); - myEmpTable->Columns->Add( myEmpID ); - myDataSet->Tables->Add( myEmpTable ); - DataRow^ newRow1; - for ( int i = 1; i < 6; i++ ) - { - newRow1 = myEmpTable->NewRow(); - newRow1[ "EmpID" ] = i; - myEmpTable->Rows->Add( newRow1 ); - - } - myDataGrid->SetDataBinding( myDataSet, "Employee" ); - } - - void DataGridColumnStyle_Reset_Header( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGridTableStyle->MappingName = "Employee"; - myDataGridColumnStyle->MappingName = "EmpID"; - myDataGridColumnStyle->Width = 50; - myDataGridTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - } - - // -private: - void SetHeaderText( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Set the HeaderText property. - myDataGridColumnStyle->HeaderText = "Emp ID"; - myDataGrid->Invalidate(); - } - - void ResetHeaderText( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Reset the HeaderText property to its default value. - myDataGridColumnStyle->ResetHeaderText(); - myDataGrid->Invalidate(); - } - // -}; - -int main() -{ - Application::Run( gcnew DataGridColumnStyle_Header ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp deleted file mode 100644 index 907ead0a352..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp +++ /dev/null @@ -1,229 +0,0 @@ -// System::Windows::Forms::DataGridColumnStyle::WidthChanged - -/* -The following example demonstrates the 'WidthChanged' event of -the 'DataGridColumnStyle' class. In the example a message will be -displayed whenever the width of the 'Customer ID' column of the -data grid is changed. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ myButtonNone; - Button^ myButtonSolid; - Label^ myLabel; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - SetUp(); - } - -public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - try - { - // Create a Label. - myLabel = gcnew Label; - myLabel->Text = "Change width of 'Customer ID' column to see 'WidthChanged' event message."; - myLabel->Location = Point(0,0); - myLabel->Size = System::Drawing::Size( 400, 20 ); - myLabel->ForeColor = Color::Blue; - - // Create the first button. - myButtonNone = gcnew Button; - myButtonNone->Location = Point(24,21); - myButtonNone->Size = System::Drawing::Size( 150, 24 ); - myButtonNone->Text = "Apply 'None' Line Style "; - myButtonNone->Click += gcnew EventHandler( this, &MyForm::OnNoneButtonClick ); - - // Create the second button. - myButtonSolid = gcnew Button; - myButtonSolid->Location = Point(180,21); - myButtonSolid->Size = System::Drawing::Size( 150, 24 ); - myButtonSolid->Text = "Apply 'Solid' Line Style "; - myButtonSolid->Click += gcnew EventHandler( this, &MyForm::OnSolidButtonClick ); - Text = "DataGridColumnStyle Sample"; - ClientSize = System::Drawing::Size( 400, 300 ); - - // Create a data grid. - myDataGrid = gcnew DataGrid; - myDataGrid->Location = Point(24,55); - myDataGrid->Size = System::Drawing::Size( 345, 200 ); - myDataGrid->CaptionText = "Microsoft DataGrid Control"; - - // Create a data grid table style. - DataGridTableStyle^ myDataGridTableStyle = gcnew DataGridTableStyle; - myDataGridTableStyle->MappingName = "Customers"; - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - - // - // Add the 'Customer ID' column style. - DataGridColumnStyle^ myIDCol = gcnew DataGridTextBoxColumn; - myIDCol->MappingName = "custID"; - myIDCol->HeaderText = "Customer ID"; - myIDCol->Width = 100; - myIDCol->WidthChanged += gcnew EventHandler( this, &MyForm::MyIDColumnWidthChanged ); - myDataGridTableStyle->GridColumnStyles->Add( myIDCol ); - // - - // Add the 'Customer Name' column style. - DataGridColumnStyle^ myNameCol = gcnew DataGridTextBoxColumn; - myNameCol->MappingName = "custName"; - myNameCol->HeaderText = "Customer Name"; - myNameCol->Width = 150; - myDataGridTableStyle->GridColumnStyles->Add( myNameCol ); - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - - // Add the controls. - Controls->Add( myLabel ); - Controls->Add( myButtonNone ); - Controls->Add( myButtonSolid ); - Controls->Add( myDataGrid ); - } - catch ( Exception^ exc ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", exc->Source ); - Console::WriteLine( "Message : {0}", exc->Message ); - } - } - - void SetUp() - { - try - { - // Create a DataSet with one table. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - catch ( Exception^ exc ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", exc->Source ); - Console::WriteLine( "Message : {0}", exc->Message ); - } - } - - void MakeDataSet() - { - try - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ myCustTable = gcnew DataTable( "Customers" ); - - // Create two columns and add them to the table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - myCustTable->Columns->Add( cCustID ); - myCustTable->Columns->Add( cCustName ); - myDataSet->Tables->Add( myCustTable ); - DataRow^ newRow1; - for ( int i = 1; i < 4; i++ ) - { - newRow1 = myCustTable->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - myCustTable->Rows->Add( newRow1 ); - } - myCustTable->Rows[ 0 ][ "custName" ] = "Alpha"; - myCustTable->Rows[ 1 ][ "custName" ] = "Beta"; - myCustTable->Rows[ 2 ][ "custName" ] = "Omega"; - } - catch ( Exception^ exc ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", exc->Source ); - Console::WriteLine( "Message : {0}", exc->Message ); - } - } - -private: - void MyIDColumnWidthChanged( Object^ /*obj*/, EventArgs^ /*e*/ ) - { - try - { - // Get the changed width of the 'Customer ID' column and display. - DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ "Customers" ]; - int myWidth = myTableStyle->GridColumnStyles[ "custID" ]->Width; - MessageBox::Show( String::Concat( "Width of 'Customer ID' column is changed to : ", myWidth, " pixels" ) ); - } - catch ( Exception^ exc ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", exc->Source ); - Console::WriteLine( "Message : {0}", exc->Message ); - } - } - - void OnNoneButtonClick( Object^ /*obj*/, EventArgs^ /*e*/ ) - { - try - { - DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ "Customers" ]; - myTableStyle->GridLineStyle = DataGridLineStyle::None; - } - catch ( Exception^ exc ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", exc->Source ); - Console::WriteLine( "Message : {0}", exc->Message ); - } - } - - void OnSolidButtonClick( Object^ /*obj*/, EventArgs^ /*e*/ ) - { - try - { - DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ "Customers" ]; - myTableStyle->GridLineStyle = DataGridLineStyle::Solid; - } - catch ( Exception^ exc ) - { - Console::WriteLine( "Exception caught!!!" ); - Console::WriteLine( "Source : {0}", exc->Source ); - Console::WriteLine( "Message : {0}", exc->Message ); - } - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp deleted file mode 100644 index 01178401e7f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp +++ /dev/null @@ -1,284 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace BindToArrayGrid -{ - /// - /// Summary description for Form1. - /// - public ref class BindToArrayGridForm : public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ bindedDataGrid; - /// - /// Required designer variable. - /// - - System::ComponentModel::Container^ components; - - public: - BindToArrayGridForm() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - components = nullptr; - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - /// - /// Clean up any resources being used. - /// - protected: - ~BindToArrayGridForm() - { - if (components) - { - delete components; - } - } - -#pragma region^ Windows Form^ Designer generated^ code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private: - void InitializeComponent() - { - this->bindedDataGrid = gcnew System::Windows::Forms::DataGrid(); - ((System::ComponentModel::ISupportInitialize^) - (this->bindedDataGrid))->BeginInit(); - this->SuspendLayout(); - // - // bindedDataGrid - // - this->bindedDataGrid->DataMember = ""; - this->bindedDataGrid->HeaderForeColor = - System::Drawing::SystemColors::ControlText; - this->bindedDataGrid->Location = System::Drawing::Point(24, 48); - this->bindedDataGrid->Name = "bindedDataGrid"; - this->bindedDataGrid->Size = System::Drawing::Size(240, 200); - this->bindedDataGrid->TabIndex = 0; - // - // BindToArrayGridForm - // - this->ClientSize = System::Drawing::Size(292, 266); - this->Controls->Add(this->bindedDataGrid); - this->Name = "BindToArrayGridForm"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( - this,&BindToArrayGridForm::Form1_Load); - ((System::ComponentModel::ISupportInitialize^) - (this->bindedDataGrid))->EndInit(); - this->ResumeLayout(false); - } -#pragma endregion - - private: - void Form1_Load(Object^ sender, System::EventArgs^ e) - { - BindToArray(); - } - - // - - void BindToArray() - { - // Create an array of Machine objects (defined below). - array^ Machines = gcnew array(3); - Machine^ tempMachine; - - tempMachine = gcnew Machine(); - tempMachine->Model = "AAA"; - tempMachine->Id = "A100"; - tempMachine->Price = Convert::ToDecimal(3.80); - Machines[0] = tempMachine; - - // The first Machine includes an array of Part objects. - Part^ p1 = gcnew Part(); - p1->PartId = "PartX"; - Part^ p2 = gcnew Part(); - p2->PartId = "PartY"; - - // Note that the Machines.Parts property returns an ArrayList. - // Add the parts to the ArrayList using the AddRange method. - tempMachine->Parts->AddRange(gcnew array {p1, p2}); - - tempMachine = gcnew Machine(); - tempMachine->Model = "BBB"; - tempMachine->Id = "B100"; - tempMachine->Price = Convert::ToDecimal(1.52); - Machines[1] = tempMachine; - - tempMachine = gcnew Machine(); - tempMachine->Id = "CCC"; - tempMachine->Model = "B100"; - tempMachine->Price = Convert::ToDecimal(2.14); - Machines[2] = tempMachine; - - bindedDataGrid->SetDataBinding(Machines, ""); - CreateTableStyle(); - } - - void CreateTableStyle() - { - // Creates two DataGridTableStyle objects, one for the Machine - // array, and one for the Parts ArrayList. - - DataGridTableStyle^ machineTable = gcnew DataGridTableStyle(); - // Sets the MappingName to the class name plus brackets. - machineTable->MappingName = "Machine[]"; - - // Sets the AlternatingBackColor so you can see the difference. - machineTable->AlternatingBackColor = - System::Drawing::Color::LightBlue; - - // Creates three column styles. - DataGridTextBoxColumn^ modelColumn = gcnew DataGridTextBoxColumn(); - modelColumn->MappingName = "Model"; - modelColumn->HeaderText = "Model"; - - DataGridTextBoxColumn^ idColumn = gcnew DataGridTextBoxColumn(); - idColumn->MappingName = "Id"; - idColumn->HeaderText = "Id"; - - DataGridTextBoxColumn^ priceColumn = gcnew DataGridTextBoxColumn(); - priceColumn->MappingName = "Price"; - priceColumn->HeaderText = "Price"; - priceColumn->Format = "c"; - - // Adds the column styles to the grid table style. - machineTable->GridColumnStyles->Add(modelColumn); - machineTable->GridColumnStyles->Add(idColumn); - machineTable->GridColumnStyles->Add(priceColumn); - - // Add the table style to the collection, but clear the - // collection first. - bindedDataGrid->TableStyles->Clear(); - bindedDataGrid->TableStyles->Add(machineTable); - - // Create another table style, one for the related data. - DataGridTableStyle^ partsTable = gcnew DataGridTableStyle(); - // Set the MappingName to an ArrayList. Note that you need not - // include brackets. - partsTable->MappingName = "ArrayList"; - DataGridTextBoxColumn^ partIdColumn = - gcnew DataGridTextBoxColumn(); - partIdColumn->MappingName = "PartID"; - partIdColumn->HeaderText = "Part ID"; - partsTable->GridColumnStyles->Add(partIdColumn); - bindedDataGrid->TableStyles->Add(partsTable); - } - - private: - ref class Machine - { - private: - String^ machineModel; - String^ machineID; - Decimal machinePrice; - - // Use an ArrayList to create a related collection. - ArrayList^ machineParts; - - public: - Machine() - { - machineParts = gcnew ArrayList; - } - - property String^ Model - { - String^ get() - { - return machineModel; - } - void set(String^ value) - { - machineModel = value; - } - } - - property String^ Id - { - String^ get() - { - return machineID; - } - void set(String^ value) - { - machineID = value; - } - } - - property ArrayList^ Parts - { - ArrayList^ get() - { - return machineParts; - } - void set(ArrayList^ value) - { - machineParts = value; - } - } - - property Decimal Price - { - Decimal get() - { - return machinePrice; - } - void set(Decimal value) - { - machinePrice = value; - } - } - }; - - private: - ref class Part - { - private: - String^ partId; - - public: - property String^ PartId - { - String^ get() - { - return partId; - } - void set(String^ value) - { - partId = value; - } - } - }; - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run(gcnew BindToArrayGrid::BindToArrayGridForm()); -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp deleted file mode 100644 index 830fc6482ca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp +++ /dev/null @@ -1,190 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ForeColor - -/* -The following program demonstrates the property 'ForeColor' of class 'DataGridTableStyle'. -A table with 2 columns is created and attached to grid. A listbox allows selection of forecolors -for the grid. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace Datagrid -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ dataGrid1; - System::Windows::Forms::ComboBox^ myComboBox; - System::Windows::Forms::Button^ button2; - - // Declare objects of DataSet, DataGrid, DataTable. - DataSet^ myDataSet; - - public: - DataTable^ myCustomerTable; - DataGridTableStyle^ myTableStyle; - - private: - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - InitializeComponent(); - } - - protected: - - // Clean up resources. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->myComboBox = gcnew System::Windows::Forms::ComboBox; - this->dataGrid1 = gcnew System::Windows::Forms::DataGrid; - this->button2 = gcnew System::Windows::Forms::Button; - (dynamic_cast(this->dataGrid1))->BeginInit(); - this->SuspendLayout(); - - // - // myComboBox - // - this->myComboBox->DropDownWidth = 136; - array^temp0 = {"Green","Red","Violet"}; - this->myComboBox->Items->AddRange( temp0 ); - this->myComboBox->Location = System::Drawing::Point( 64, 160 ); - this->myComboBox->Name = "myComboBox"; - this->myComboBox->Size = System::Drawing::Size( 136, 21 ); - this->myComboBox->TabIndex = 3; - this->myComboBox->DropDownStyle = ComboBoxStyle::DropDownList; - - // - // dataGrid1 - // - this->dataGrid1->CaptionText = "DataGrid"; - this->dataGrid1->DataMember = ""; - this->dataGrid1->Location = System::Drawing::Point( 56, 48 ); - this->dataGrid1->Name = "dataGrid1"; - this->dataGrid1->Size = System::Drawing::Size( 272, 80 ); - this->dataGrid1->TabIndex = 0; - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 232, 160 ); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 96, 32 ); - this->button2->TabIndex = 4; - this->button2->Text = "Change ForeGround"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::OnForeColor_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 536, 301 ); - array^formControls = {this->button2,this->myComboBox,this->dataGrid1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - (dynamic_cast(this->dataGrid1))->EndInit(); - this->ResumeLayout( false ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myComboBox->SelectedIndex = 0; - Create_Table(); - } - - // - private: - void Create_Table() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create DataTable. - DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add to the table. - DataColumn^ CustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ CustName = gcnew DataColumn( "CustName" ); - myCustomerTable->Columns->Add( CustID ); - myCustomerTable->Columns->Add( CustName ); - DataRow^ newRow1; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 3; i++ ) - { - newRow1 = myCustomerTable->NewRow(); - newRow1[ "custID" ] = i; - - // Add row to the Customers table. - myCustomerTable->Rows->Add( newRow1 ); - } - myCustomerTable->Rows[ 0 ][ "custName" ] = "Alpha"; - myCustomerTable->Rows[ 1 ][ "custName" ] = "Beta"; - - // Add table to DataSet. - myDataSet->Tables->Add( myCustomerTable ); - dataGrid1->SetDataBinding( myDataSet, "Customers" ); - myTableStyle = gcnew DataGridTableStyle; - myTableStyle->MappingName = "Customers"; - myTableStyle->ForeColor = Color::DarkMagenta; - dataGrid1->TableStyles->Add( myTableStyle ); - } - - // Set table's forecolor. - void OnForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - dataGrid1->TableStyles->Clear(); - String^ str = dynamic_cast(myComboBox->SelectedItem); - if ( str->Equals( "Green" ) ) - myTableStyle->ForeColor = Color::Green; - else - if ( str->Equals( "Red" ) ) - myTableStyle->ForeColor = Color::Red; - else - if ( str->Equals( "Violet" ) ) - myTableStyle->ForeColor = Color::Violet; - - dataGrid1->TableStyles->Add( myTableStyle ); - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Datagrid::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp deleted file mode 100644 index 038f73d0035..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp +++ /dev/null @@ -1,241 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle.HeaderForeColorChanged;System::Windows::Forms::DataGridTableStyle::HeaderForeColor -// System::Windows::Forms::DataGridTableStyle.HeaderBackColorChanged;System::Windows::Forms::DataGridTableStyle::HeaderBackColor - -/* -The following program demonstrates the usage of the 'HeaderBackColor' and -'HeaderForeColor' properties and the 'HeaderBackColorChanged' and 'HeaderForeColorChanged' events. -A table is created and added to a datagrid with two coloumns. The table allows to change -Header's background and foreground colors through selection of combobox values. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace Datagrid -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ dataGrid1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::ComboBox^ comboBox1; - System::Windows::Forms::ComboBox^ comboBox2; - System::Windows::Forms::Button^ button2; - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - InitializeComponent(); - } - - public: - - // Clean up resources. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->comboBox1 = gcnew System::Windows::Forms::ComboBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->dataGrid1 = gcnew System::Windows::Forms::DataGrid; - this->comboBox2 = gcnew System::Windows::Forms::ComboBox; - this->button2 = gcnew System::Windows::Forms::Button; - (dynamic_cast(this->dataGrid1))->BeginInit(); - this->SuspendLayout(); - - // - // comboBox1 - // - this->comboBox1->DropDownWidth = 136; - array^temp0 = {"Blue","Red","Yellow"}; - this->comboBox1->Items->AddRange( temp0 ); - this->comboBox1->Location = System::Drawing::Point( 56, 144 ); - this->comboBox1->Name = "comboBox1"; - this->comboBox1->Size = System::Drawing::Size( 136, 21 ); - this->comboBox1->Sorted = true; - this->comboBox1->TabIndex = 2; - this->comboBox1->DropDownStyle = ComboBoxStyle::DropDownList; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 232, 144 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 96, 32 ); - this->button1->TabIndex = 1; - this->button1->Text = "Change Header Background"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::OnHeaderBackColor_Click ); - - // - // dataGrid1 - // - this->dataGrid1->CaptionText = "DataGrid"; - this->dataGrid1->DataMember = ""; - this->dataGrid1->Location = System::Drawing::Point( 56, 48 ); - this->dataGrid1->Name = "dataGrid1"; - this->dataGrid1->Size = System::Drawing::Size( 272, 80 ); - this->dataGrid1->TabIndex = 0; - - // - // comboBox2 - // - this->comboBox2->DropDownWidth = 136; - array^temp1 = {"Green","White","Violet"}; - this->comboBox2->Items->AddRange( temp1 ); - this->comboBox2->Location = System::Drawing::Point( 56, 192 ); - this->comboBox2->Name = "comboBox2"; - this->comboBox2->Size = System::Drawing::Size( 136, 21 ); - this->comboBox2->TabIndex = 3; - this->comboBox2->DropDownStyle = ComboBoxStyle::DropDownList; - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 232, 184 ); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 96, 32 ); - this->button2->TabIndex = 4; - this->button2->Text = "Change Header ForeGround"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::OnHeaderForeColor_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 536, 301 ); - array^formControls = {this->button2,this->comboBox2,this->comboBox1,this->button1,this->dataGrid1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - (dynamic_cast(this->dataGrid1))->EndInit(); - this->ResumeLayout( false ); - } - - // Declare objects of DataSet, DataGrid, DataTable. - DataSet^ myDataSet; - - public: - DataTable^ myCustomerTable; - DataGridTableStyle^ myTableStyle; - - private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - comboBox1->SelectedIndex = 0; - comboBox2->SelectedIndex = 0; - Create_Table(); - } - - // - // - // - // - private: - void Create_Table() - { - // Create DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create DataTable. - DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the table. - DataColumn^ CustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ CustName = gcnew DataColumn( "CustName" ); - myCustomerTable->Columns->Add( CustID ); - myCustomerTable->Columns->Add( CustName ); - - // Add table to DataSet. - myDataSet->Tables->Add( myCustomerTable ); - dataGrid1->SetDataBinding( myDataSet, "Customers" ); - myTableStyle = gcnew DataGridTableStyle; - myTableStyle->MappingName = "Customers"; - myTableStyle->HeaderBackColorChanged += gcnew System::EventHandler( this, &Form1::HeaderBackColorChangedHandler ); - myTableStyle->HeaderForeColorChanged += gcnew System::EventHandler( this, &Form1::HeaderForeColorChangedHandler ); - } - - // Change header background color. - void OnHeaderBackColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - dataGrid1->TableStyles->Clear(); - String^ str = dynamic_cast(comboBox1->SelectedItem); - if ( str->Equals( "Red" ) ) - myTableStyle->ForeColor = Color::Red; - else - if ( str->Equals( "Yellow" ) ) - myTableStyle->ForeColor = Color::Yellow; - else - if ( str->Equals( "Blue" ) ) - myTableStyle->ForeColor = Color::Blue; - - myTableStyle->AlternatingBackColor = Color::LightGray; - dataGrid1->TableStyles->Add( myTableStyle ); - } - // - - void HeaderBackColorChangedHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( String::Concat( "Changed Header Background color to : ", comboBox1->SelectedItem ), "Success", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - // - - // Change header forecolor. - void OnHeaderForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - dataGrid1->TableStyles->Clear(); - String^ str = dynamic_cast(comboBox1->SelectedItem); - if ( str->Equals( "Green" ) ) - myTableStyle->ForeColor = Color::Green; - else - if ( str->Equals( "White" ) ) - myTableStyle->ForeColor = Color::White; - else - if ( str->Equals( "Violet" ) ) - myTableStyle->ForeColor = Color::Violet; - - myTableStyle->AlternatingBackColor = Color::LightGray; - dataGrid1->TableStyles->Add( myTableStyle ); - } - // - - void HeaderForeColorChangedHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( String::Concat( "Changed Header Fore color to : ", comboBox2->SelectedItem ), "Success", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Datagrid::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp deleted file mode 100644 index d2f324d18d3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp +++ /dev/null @@ -1,220 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::PreferredColumnWidth - -/* -The following example demonstrates the property 'PreferredColumnWidth' -of 'DataGridTableStyle' class. - -It creates a 'Button' a 'TextBox' and 'DataGrid', attaches an employee table to -DataGrid and applies 'DataGridTableStyle' to it. -Event Handler has been attached to handle 'PreferredColumnWidthChanged' event. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace DataGridTableStyle_PreferredColumnWidthChanged -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ myButton; - System::Windows::Forms::TextBox^ myColWidth; - System::Windows::Forms::Label ^ myLabel; - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle; - System::ComponentModel::Container^ components; - - public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->myButton = gcnew System::Windows::Forms::Button; - this->myLabel = gcnew System::Windows::Forms::Label; - this->myColWidth = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // myButton - // - this->myButton->Location = System::Drawing::Point( 136, 304 ); - this->myButton->Name = "myButton"; - this->myButton->TabIndex = 1; - this->myButton->Text = "Apply"; - this->myButton->Click += gcnew System::EventHandler( this, &Form1::myButton_Click ); - - // - // myLabel - // - this->myLabel->Location = System::Drawing::Point( 96, 264 ); - this->myLabel->Name = "myLabel"; - this->myLabel->Size = System::Drawing::Size( 80, 16 ); - this->myLabel->TabIndex = 3; - this->myLabel->Text = "Column width: "; - - // - // myColWidth - // - this->myColWidth->Location = System::Drawing::Point( 184, 264 ); - this->myColWidth->Name = "myColWidth"; - this->myColWidth->TabIndex = 2; - this->myColWidth->Text = ""; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 400, 397 ); - array^formControls = {this->myLabel,this->myColWidth,this->myButton}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - public: - Form1() - { - components = nullptr; - myDataGrid = gcnew DataGrid; - myDataGridTableStyle = gcnew DataGridTableStyle; - InitializeComponent(); - } - - // - private: - void CreateAndBindDataSet( DataGrid^ myDataGrid ) - { - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myEmpTable = gcnew DataTable( "Employee" ); - - // Create two columns, and add them to employee table. - DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); - DataColumn^ myEmpName = gcnew DataColumn( "EmpName" ); - myEmpTable->Columns->Add( myEmpID ); - myEmpTable->Columns->Add( myEmpName ); - - // Add table to DataSet. - myDataSet->Tables->Add( myEmpTable ); - - // Populate table. - DataRow^ newRow1; - - // Create employee records in employee Table. - for ( int i = 1; i < 6; i++ ) - { - newRow1 = myEmpTable->NewRow(); - newRow1[ "EmpID" ] = i; - - // Add row to Employee table. - myEmpTable->Rows->Add( newRow1 ); - } - myEmpTable->Rows[ 0 ][ "EmpName" ] = "Alpha"; - myEmpTable->Rows[ 1 ][ "EmpName" ] = "Beta"; - myEmpTable->Rows[ 2 ][ "EmpName" ] = "Omega"; - myEmpTable->Rows[ 3 ][ "EmpName" ] = "Gamma"; - myEmpTable->Rows[ 4 ][ "EmpName" ] = "Delta"; - - // Bind DataGrid to DataSet. - myDataGrid->SetDataBinding( myDataSet, "Employee" ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Set and Display myDataGrid. - myDataGrid->DataMember = ""; - myDataGrid->Location = System::Drawing::Point( 72, 32 ); - myDataGrid->Name = "myDataGrid"; - myDataGrid->Size = System::Drawing::Size( 240, 200 ); - myDataGrid->TabIndex = 4; - - // Add it to controls. - Controls->Add( myDataGrid ); - CreateAndBindDataSet( myDataGrid ); - myDataGridTableStyle->MappingName = "Employee"; - - // Set other properties. - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - - // Add DataGridTableStyle instances to GridTableStylesCollection. - myDataGridTableStyle->PreferredColumnWidth = 100; - myColWidth->Text = ""; - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - myDataGridTableStyle->PreferredColumnWidthChanged += gcnew EventHandler( this, &Form1::MyDelegatePreferredColWidthChanged ); - } - - private: - void MyDelegatePreferredColWidthChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "Preferred Column width has changed" ); - } - - private: - void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - try - { - if ( !myColWidth->Text->Equals( "" ) ) - { - Int32 newwidth = myDataGridTableStyle->PreferredColumnWidth; - myDataGridTableStyle->PreferredColumnWidth = Int32::Parse( myColWidth->Text ); - - // Dispose datagrid and datagridtablestyle and then create. - delete myDataGrid; - delete myDataGridTableStyle; - myDataGrid = gcnew DataGrid; - myDataGridTableStyle = gcnew DataGridTableStyle; - myDataGrid->DataMember = ""; - myDataGrid->Location = System::Drawing::Point( 72, 32 ); - myDataGrid->Name = "myDataGrid"; - myDataGrid->Size = System::Drawing::Size( 240, 200 ); - myDataGrid->TabIndex = 4; - Controls->Add( myDataGrid ); - CreateAndBindDataSet( myDataGrid ); - myDataGridTableStyle->MappingName = "Employee"; - - // Set other properties. - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - - // Add DataGridTableStyle instances to GridTableStylesCollection. - myDataGridTableStyle->PreferredColumnWidth = newwidth; - myColWidth->Text = ""; - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - myDataGridTableStyle->PreferredColumnWidthChanged += gcnew EventHandler( this, &Form1::MyDelegatePreferredColWidthChanged ); - } - else - { - MessageBox::Show( "Please enter a number" ); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew DataGridTableStyle_PreferredColumnWidthChanged::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp deleted file mode 100644 index 58df3b44e42..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp +++ /dev/null @@ -1,141 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::PreferredRowHeight - -/* -The following example demonstrates 'PreferredRowHeight' property of 'DataGridTableStyle' -class. It adds a DataGrid, Button and a TextBox to a form. It changes the -'PreferredRowHeight' property by taking the value entered in the textbox. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class myDataForm: public Form -{ -private: - Button^ myButton; - TextBox^ myTextBox; - Label^ myLabel; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridTableStyle^ myTableStyle; - -public: - myDataForm() - { - // Required for Windows Form Designer support. - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - myButton = gcnew Button; - myDataGrid = gcnew DataGrid; - ClientSize = System::Drawing::Size( 450, 330 ); - myButton->Location = Point(100,16); - myButton->Size = System::Drawing::Size( 200, 24 ); - myButton->Text = "Change Row Height"; - myButton->Click += gcnew EventHandler( this, &myDataForm::myButton_Click ); - myTextBox = gcnew TextBox; - myTextBox->Location = Point(24,16); - myTextBox->Size = System::Drawing::Size( 40, 24 ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 120, 200 ); - myDataGrid->CaptionText = "DataGridTableStyle Example"; - myLabel = gcnew Label; - myLabel->Location = Point(24,270); - myLabel->Width = 500; - Controls->Add( myButton ); - Controls->Add( myTextBox ); - Controls->Add( myDataGrid ); - Controls->Add( myLabel ); - Text = "PreferredRowHeight example"; - } - - void SetUp() - { - // Create a DataSet with a table. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Orders" ); - - // Create the DataGridTableStyle. - myTableStyle = gcnew DataGridTableStyle; - - // Map DataGridTableStyle to a DataTable. - myTableStyle->MappingName = "Orders"; - } - -private: - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myTextBox->Text->Trim()->Equals( "" ) ) - { - MessageBox::Show( "Enter the height between 18 and 134" ); - return; - } - - try - { - // - int myPreferredRowHeight = Convert::ToInt32( myTextBox->Text->Trim() ); - if ( myPreferredRowHeight < 18 || myPreferredRowHeight > 134 ) - { - MessageBox::Show( "Enter the height between 18 and 134" ); - return; - } - - // Set the 'PreferredRowHeight' property of DataGridTableStyle instance. - myTableStyle->PreferredRowHeight = myPreferredRowHeight; - - // Add the DataGridTableStyle instance to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle ); - // - } - catch ( Exception^ ex ) - { - MessageBox::Show( String::Concat( ex->Message, "Enter Integer only ." ) ); - } - } - - // Create a DataSet with a table and populate it. -private: - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Orders" ); - DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); - myTable->Columns->Add( myColumn ); - - // Add the table to the DataSet. - myDataSet->Tables->Add( myTable ); - DataRow^ newRow; - for ( int j = 1; j < 15; j++ ) - { - newRow = myTable->NewRow(); - newRow[ "Amount" ] = j * 10; - - // Add the row to the Orders table. - myTable->Rows->Add( newRow ); - } - } -}; - -int main() -{ - Application::Run( gcnew myDataForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp deleted file mode 100644 index a6b6a43cd68..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp +++ /dev/null @@ -1,152 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::PreferredRowHeightChanged - -/* -The following example demonstrates 'PreferredRowHeightChanged' Event of 'DataGridTableStyle' class. -A DataGrid, Button and TextBox are added to a form. The 'PreferredRowHeight' property of 'DataGridTableStyle' -class is set to the value entered by user in the textbox. When user clicks the set button, -it raises 'PreferredRowHeightChanged' Event which calls user defined EventHandler function. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyDataForm: public Form -{ -private: - Button^ myButton; - TextBox^ myTextBox; - Label^ myLabel; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridTableStyle^ myTableStyle; - -public: - MyDataForm() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - myButton = gcnew Button; - myDataGrid = gcnew DataGrid; - ClientSize = System::Drawing::Size( 450, 330 ); - myButton->Location = Point(70,16); - myButton->Size = System::Drawing::Size( 200, 24 ); - myButton->Text = "Set Row Height(in pixels)"; - myButton->Click += gcnew EventHandler( this, &MyDataForm::myButton_Click ); - myTextBox = gcnew TextBox; - myTextBox->Location = Point(24,16); - myTextBox->Size = System::Drawing::Size( 40, 24 ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 120, 200 ); - myDataGrid->CaptionText = "DataGrid Control"; - myLabel = gcnew Label; - myLabel->Location = Point(24,270); - myLabel->Width = 500; - Controls->Add( myButton ); - Controls->Add( myTextBox ); - Controls->Add( myDataGrid ); - Controls->Add( myLabel ); - Text = "PreferredRowHeightChanged example"; - } - - // - void SetUp() - { - // Create a DataSet with a table. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Orders" ); - myTableStyle = gcnew DataGridTableStyle; - - // Map 'DataGridTableStyle' instance to the DataTable. - myTableStyle->MappingName = "Orders"; - - // Add EventHandler function for 'PreferredRowHeightChanged' Event. - myTableStyle->PreferredRowHeightChanged += gcnew EventHandler( this, &MyDataForm::RowHeight_Changed ); - } - - // Called when the PreferredRowHeight property of myTableStyle is modified - void RowHeight_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "PreferredRowHeight property is changed" ); - } - // - -private: - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - if ( myTextBox->Text->Trim()->Equals( "" ) ) - { - MessageBox::Show( "Enter the height between 18 and 134" ); - return; - } - int myPreferredRowHeight = Convert::ToInt32( myTextBox->Text->Trim() ); - if ( myPreferredRowHeight < 18 || myPreferredRowHeight > 134 ) - { - MessageBox::Show( "Enter the height between 18 and 134" ); - return; - } - - // Set the 'PrefferedRowHeight' property of DataGridTableStyle instance. - myTableStyle->PreferredRowHeight = myPreferredRowHeight; - - // Add the DataGridTableStyle instance to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle ); - } - catch ( Exception^ ex ) - { - - // Handle raised Exception. - if ( ex != nullptr ) - { - MessageBox::Show( "Please enter a numeric value between 18 and 134" ); - myTextBox->Text = " "; - bool val = myTextBox->Focus(); - } - } - } - - // Create a DataSet with a table and populate it. -private: - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Orders" ); - DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); - myTable->Columns->Add( myColumn ); - - // Add the table to the DataSet. - myDataSet->Tables->Add( myTable ); - DataRow^ newRow; - for ( int j = 1; j < 15; j++ ) - { - newRow = myTable->NewRow(); - newRow[ "Amount" ] = j * 10; - - // Add the row to the Orders table. - myTable->Rows->Add( newRow ); - } - } -}; - -int main() -{ - Application::Run( gcnew MyDataForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp deleted file mode 100644 index 365abb6d041..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ReadOnlyChanged - -/* -The following example demonstrates the 'ReadOnlyChanged' event of 'DataGridTableStyle' class. -It adds a DataGrid and checkbox to a Form. When the Check box is checked, the 'ReadOnly' property of -'DataGridTableStyle' is changed. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - DataSet^ myDataSet1; - CheckBox^ myCheckBox1; - DataGrid^ myDataGrid1; - DataGridTableStyle^ myDataGridTableStyle; - -public: - Form1() - { - InitializeComponent(); - MakeDataSet(); - AddTableStyle(); - } - -private: - void InitializeComponent() - { - myDataGrid1 = gcnew DataGrid; - myCheckBox1 = gcnew CheckBox; - SuspendLayout(); - myDataGrid1->DataMember = ""; - myDataGrid1->Location = Point(72,64); - myDataGrid1->Name = "myDataGrid1"; - myDataGrid1->Size = System::Drawing::Size( 208, 128 ); - myDataGrid1->TabIndex = 0; - myCheckBox1->Location = Point(304,112); - myCheckBox1->Name = "myCheckBox1"; - myCheckBox1->TabIndex = 1; - myCheckBox1->Text = "Read Only"; - myCheckBox1->CheckedChanged += gcnew EventHandler( this, &Form1::myCheckBox1_CheckedChanged ); - ClientSize = System::Drawing::Size( 472, 273 ); - array^temp0 = {myCheckBox1,myDataGrid1}; - Controls->AddRange( temp0 ); - Name = "Form1"; - Text = "Test \'ReadOnleChanged\' Event of \'DataGridTableStyle\' class"; - ResumeLayout( false ); - } - - // Create a DataSet with a table and populate it. - void MakeDataSet() - { - myDataSet1 = gcnew DataSet( "myDataSet" ); - DataTable^ customerTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ myColumn = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ myColumn1 = gcnew DataColumn( "CustName" ); - customerTable->Columns->Add( myColumn ); - customerTable->Columns->Add( myColumn1 ); - - // Add the tables to the DataSet. - myDataSet1->Tables->Add( customerTable ); - - // Create three customers in the Customers Table. - DataRow^ newRow1; - for ( int i = 1; i < 4; i++ ) - { - newRow1 = customerTable->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - customerTable->Rows->Add( newRow1 ); - } - customerTable->Rows[ 0 ][ "CustName" ] = "Alpha"; - customerTable->Rows[ 1 ][ "CustName" ] = "Beta"; - customerTable->Rows[ 2 ][ "CustName" ] = "Omega"; - - // Add Unique Key constraint to the CustID column. - UniqueConstraint^ idKeyRestraint = gcnew UniqueConstraint( myColumn ); - customerTable->Constraints->Add( idKeyRestraint ); - myDataSet1->EnforceConstraints = true; - } - - // -protected: - void AddTableStyle() - { - - // Create a new DataGridTableStyle. - myDataGridTableStyle = gcnew DataGridTableStyle; - myDataGridTableStyle->MappingName = myDataSet1->Tables[ 0 ]->TableName; - myDataGrid1->DataSource = myDataSet1->Tables[ 0 ]; - myDataGridTableStyle->ReadOnlyChanged += gcnew EventHandler( this, &Form1::MyReadOnlyChangedEventHandler ); - myDataGrid1->TableStyles->Add( myDataGridTableStyle ); - } - -private: - // Handle the 'ReadOnlyChanged' event. - void MyReadOnlyChangedEventHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "ReadOnly property is changed" ); - } - - // Handle the check box's CheckedChanged event - void myCheckBox1_CheckedChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGridTableStyle->ReadOnly ) - { - myDataGridTableStyle->ReadOnly = false; - } - else - { - myDataGridTableStyle->ReadOnly = true; - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp deleted file mode 100644 index c31419cf0ce..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ResetAlternatingBackColor - -/* -The following example demonstrates the 'ResetAlternatingBackColor' method of 'DataGridTableStyle' class. -It adds a 'DataGrid' and two buttons to a form. The instance of 'DataGridTableStyle' is mapped -to a table of DataGrid. One button sets the Alternating background color of 'DataGrid' and other resets -it to its default value. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class DataGridTableStyle_resetcolor: public Form -{ -private: - DataGridTableStyle^ myDataGridTableStyle; - DataGrid^ myDataGrid; - Button^ myButton1; - Button^ myButton2; - void InitializeComponent() - { - myButton1 = gcnew Button; - myButton2 = gcnew Button; - myDataGrid = gcnew DataGrid; - myButton1->Location = Point(56,184); - myButton1->Size = System::Drawing::Size( 176, 24 ); - myButton1->Text = "Alternating back color "; - myButton1->Click += gcnew EventHandler( this, &DataGridTableStyle_resetcolor::myButton1_Click ); - myButton2->Location = Point(56,224); - myButton2->Size = System::Drawing::Size( 184, 24 ); - myButton2->Text = "Reset"; - myButton2->Click += gcnew EventHandler( this, &DataGridTableStyle_resetcolor::myButton2_Click ); - myDataGrid->LinkColor = SystemColors::Desktop; - myDataGrid->Location = Point(56,32); - myDataGrid->Name = "myDataGrid"; - myDataGrid->Size = System::Drawing::Size( 168, 144 ); - myDataGrid->TabIndex = 1; - ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {myButton2,myDataGrid,myButton1}; - Controls->AddRange( temp0 ); - Text = "Test DataGridTableStyle::ResetAlternatingBackColor method"; - Load += gcnew EventHandler( this, &DataGridTableStyle_resetcolor::DataGridTableStyle_Reset_color ); - } - -public: - DataGridTableStyle_resetcolor() - { - myDataGridTableStyle = gcnew DataGridTableStyle; - InitializeComponent(); - - // Create and bind DataSet to DataGrid. - CreateDataSet(); - } - -private: - void CreateDataSet() - { - // Create a DataSet - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ myEmpTable = gcnew DataTable( "Employee" ); - DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); - myEmpTable->Columns->Add( myEmpID ); - - // Add the table to the DataSet. - myDataSet->Tables->Add( myEmpTable ); - DataRow^ newRow1; - for ( int i = 1; i < 6; i++ ) - { - newRow1 = myEmpTable->NewRow(); - newRow1[ "EmpID" ] = i; - - // Add the row to the Employee table. - myEmpTable->Rows->Add( newRow1 ); - } - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Employee" ); - } - - void DataGridTableStyle_Reset_color( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGridTableStyle->MappingName = "Employee"; - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - } - - // -private: - void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - //Set the 'AlternatingBackColor'. - myDataGridTableStyle->AlternatingBackColor = Color::Blue; - } - - void myButton2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the 'AlternatingBackColor'. - myDataGridTableStyle->ResetAlternatingBackColor(); - } - // -}; - -int main() -{ - Application::Run( gcnew DataGridTableStyle_resetcolor ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp deleted file mode 100644 index 62d9182e74e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp +++ /dev/null @@ -1,123 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ResetBackColor - -/* -The following example demonstrates the 'ResetBackColor' method of 'DataGridTableStyle' class. -A DataGrid and a button are added to 'Form'. The initial back color of the DataGridTableStyle is set to -pink. When the user clicks on 'ResetBackColor' button, then the value of DataGridBackColor is set to its -default value. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - DataGrid^ myDataGrid; - Button^ myButton1; - DataSet^ myDataSet; - DataGridTableStyle^ myTableStyle; - DataGridColumnStyle^ myColumnStyle; - -public: - MyForm() - { - InitializeComponent(); - - // Create a DataSet with a table. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "customerTable" ); - AddCustomColumnStyle(); - } - -private: - - // Initialilze form and its controls. - void InitializeComponent() - { - myDataGrid = gcnew DataGrid; - myTableStyle = gcnew DataGridTableStyle; - myColumnStyle = gcnew DataGridTextBoxColumn; - myButton1 = gcnew Button; - myDataGrid->Location = Point(24,24); - myDataGrid->Name = "myDataGrid"; - myDataGrid->CaptionText = "DataGridColumn "; - myDataGrid->Size = System::Drawing::Size( 150, 153 ); - myDataGrid->TabIndex = 0; - myButton1->Location = Point(16,184); - myButton1->Name = "myButton1"; - myButton1->Size = System::Drawing::Size( 112, 23 ); - myButton1->TabIndex = 1; - myButton1->Text = "Reset BackColor"; - myButton1->Click += gcnew EventHandler( this, &MyForm::myButton1_Click ); - ClientSize = System::Drawing::Size( 360, 273 ); - array^temp0 = {myButton1,myDataGrid}; - Controls->AddRange( temp0 ); - Name = "Form1"; - Text = "Reset BackColor"; - ResumeLayout( false ); - } - - // -private: - void AddCustomColumnStyle() - { - // Set the TableStyle Mapping name. - myTableStyle->MappingName = "customerTable"; - myTableStyle->BackColor = Color::Pink; - - // Set the ColumnStyle properties and add to TableStyle. - myColumnStyle->MappingName = "Customers"; - myColumnStyle->HeaderText = "Customer Name"; - myColumnStyle->Width = 250; - myTableStyle->GridColumnStyles->Add( myColumnStyle ); - myDataGrid->TableStyles->Add( myTableStyle ); - } - - void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the background color. - myTableStyle->ResetBackColor(); - } - // - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ customerTable = gcnew DataTable( "customerTable" ); - DataColumn^ customerName = gcnew DataColumn( "Customers" ); - customerTable->Columns->Add( customerName ); - myDataSet->Tables->Add( customerTable ); - DataRow^ newRow1; - for ( int i = 1; i < 6; i++ ) - { - newRow1 = customerTable->NewRow(); - newRow1[ "Customers" ] = i; - - // Add the row to the Customers table. - customerTable->Rows->Add( newRow1 ); - - } - customerTable->Rows[ 0 ][ "Customers" ] = "Alpha"; - customerTable->Rows[ 1 ][ "Customers" ] = "Beta"; - customerTable->Rows[ 2 ][ "Customers" ] = "Omega"; - customerTable->Rows[ 3 ][ "Customers" ] = "Cust1"; - customerTable->Rows[ 4 ][ "Customers" ] = "Cust2"; - } -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp deleted file mode 100644 index 23aa5980326..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp +++ /dev/null @@ -1,144 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ResetForeColor - -/* -The following example demonstrates 'ResetForeColor' method of 'DataGridTableStyle' class. -A DataGrid and two Buttons are added to the form. A 'DataGridTableStyle' instance is mapped to table of -'DataGrid'. When the user clicks on 'Set ForeColor' button foreground color is set to blue. When -'Reset ForeColor' button is clicked foreground color is reset to its default value. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace MyDataGridColumnStyle -{ - public ref class MyForm1: public Form - { - private: - DataGrid^ myDataGrid; - Button^ btnSetForeColor; - Button^ btnResetForeColor; - DataSet^ myDataSet; - DataGridTableStyle^ myDataGridTableStyle; - DataTable^ myDataTable; - DataColumn^ myDataColumn1; - - public: - MyForm1() - { - InitializeComponent(); - - // Call 'SetUp' method to bind the controls. - SetUp(); - } - - private: - void InitializeComponent() - { - btnResetForeColor = gcnew Button; - btnSetForeColor = gcnew Button; - myDataGrid = gcnew DataGrid; - - // Initialize Buttons. - btnSetForeColor->Location = Point(35,290); - btnSetForeColor->Name = "btnSetForeColor"; - btnSetForeColor->Size = System::Drawing::Size( 110, 30 ); - btnSetForeColor->TabIndex = 1; - btnSetForeColor->Text = "Set ForeColor"; - btnSetForeColor->Click += gcnew EventHandler( this, &MyForm1::BtnSetForeColor_Click ); - btnResetForeColor->Location = Point(155,290); - btnResetForeColor->Name = "btnResetForeColor"; - btnResetForeColor->Size = System::Drawing::Size( 110, 30 ); - btnResetForeColor->TabIndex = 2; - btnResetForeColor->Text = "Reset ForeColor"; - btnResetForeColor->Click += gcnew EventHandler( this, &MyForm1::BtnResetForeColor_Click ); - - // Initialize DataGrid. - myDataGrid->DataMember = ""; - myDataGrid->Location = Point(48,72); - myDataGrid->Name = "myDataGrid"; - myDataGrid->Size = System::Drawing::Size( 200, 200 ); - myDataGrid->TabIndex = 0; - ClientSize = System::Drawing::Size( 296, 389 ); - - // Add the Buttons and the DataGrid to the Window. - Controls->Add( myDataGrid ); - Controls->Add( btnSetForeColor ); - Controls->Add( btnResetForeColor ); - Name = "MyForm1"; - Text = "MyForm1"; - (dynamic_cast(myDataGrid))->EndInit(); - ResumeLayout( false ); - } - - - // - private: - void BtnSetForeColor_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Set the foreground color of table. - myDataGridTableStyle->ForeColor = Color::Blue; - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - } - - void BtnResetForeColor_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the foreground color of table to its default value. - myDataGridTableStyle->ResetForeColor(); - } - // - - void AddCustomDataTableStyle() - { - myDataGridTableStyle = gcnew DataGridTableStyle; - myDataGridTableStyle->MappingName = "Customers"; - } - - void SetUp() - { - MakeDataSet(); - - // Bind the datagrid to the dataset. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - AddCustomDataTableStyle(); - } - - void MakeDataSet() - { - - // Create dataset. - myDataSet = gcnew DataSet( "myDataSet" ); - myDataTable = gcnew DataTable( "Customers" ); - myDataColumn1 = gcnew DataColumn( "CustName" ); - myDataTable->Columns->Add( myDataColumn1 ); - - // Add table to dataset. - myDataSet->Tables->Add( myDataTable ); - DataRow^ newRow1; - for ( int i = 1; i < 4; i++ ) - { - newRow1 = myDataTable->NewRow(); - - // Add the row to the customers table. - myDataTable->Rows->Add( newRow1 ); - - } - myDataTable->Rows[ 0 ][ "custName" ] = "Alpha"; - myDataTable->Rows[ 1 ][ "custName" ] = "Beta"; - myDataTable->Rows[ 2 ][ "custName" ] = "Omega"; - } - }; -} - -int main() -{ - Application::Run( gcnew MyDataGridColumnStyle::MyForm1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp deleted file mode 100644 index 8edbbd58353..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ResetGridLineColor - -/* -The following example demonstrates the 'ResetGridLineColor' method of 'DataGridTableStyle' class. -It adds a 'DataGrid' and two buttons to a form. Then it creates a 'DataGridTableStyle' and adds it to the 'DataGrid'. -When the user clicks, the 'Change the GridLineColor' button it changes the GridLineColor to 'blue'. If the user clicks -the 'Reset GridLineColor' button it changes the GridLineColor to default color. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - Button^ myButton; - Button^ myButton1; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridColumnStyle^ myDataGridColumnStyle; - DataGridTableStyle^ myDataTableStyle; - -public: - Form1() - { - InitializeComponent(); - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - AddCustomDataTableStyle(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myButton = gcnew Button; - this->myButton1 = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->Text = "DataGridTableStyle Sample"; - this->ClientSize = System::Drawing::Size( 450, 330 ); - this->myButton->Location = Point(50,16); - this->myButton->Name = "button1"; - this->myButton->Size = System::Drawing::Size( 176, 23 ); - this->myButton->TabIndex = 2; - this->myButton->Text = "Change the GridLineColor"; - this->myButton->Click += gcnew EventHandler( this, &Form1::Button_Click ); - this->myButton1->Location = Point(230,16); - this->myButton1->Name = "myButton"; - this->myButton1->Size = System::Drawing::Size( 140, 24 ); - this->myButton1->TabIndex = 0; - this->myButton1->Text = "Reset GridLineColor"; - this->myButton1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 240, 150 ); - myDataGrid->CaptionText = "DataGridTableStyle"; - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - this->Controls->Add( myButton1 ); - } - - // -private: - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Change the 'GridLineColor'. - myDataTableStyle->GridLineColor = Color::Blue; - } - - void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the 'GridLineColor' to its orginal color. - myDataTableStyle->ResetGridLineColor(); - } - // - -private: - void AddCustomDataTableStyle() - { - // Create a 'DataGridTableStyle'. - myDataTableStyle = gcnew DataGridTableStyle; - myDataTableStyle->MappingName = "Customers"; - - // Create a 'DataGridColumnStyle'. - myDataGridColumnStyle = gcnew DataGridTextBoxColumn; - myDataGridColumnStyle->MappingName = "CustName"; - myDataGridColumnStyle->HeaderText = "Customer Name"; - myDataGridColumnStyle->Width = 150; - - // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. - myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); - - // Add the 'DataGridTableStyle' to 'DataGrid'. - myDataGrid->TableStyles->Add( myDataTableStyle ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Customers" ); - DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); - myTable->Columns->Add( myColumn ); - myDataSet->Tables->Add( myTable ); - DataRow^ newRow1; - for ( int i = 0; i < 5; i++ ) - { - newRow1 = myTable->NewRow(); - newRow1[ "CustName" ] = i; - myTable->Rows->Add( newRow1 ); - - } - myTable->Rows[ 0 ][ "CustName" ] = "Jones"; - myTable->Rows[ 1 ][ "CustName" ] = "James"; - myTable->Rows[ 2 ][ "CustName" ] = "David"; - myTable->Rows[ 3 ][ "CustName" ] = "Robert"; - myTable->Rows[ 4 ][ "CustName" ] = "John"; - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp deleted file mode 100644 index 52bca764b53..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle.ResetHeaderBackColor - -/* -The following example demonstrates the 'ResetHeaderBackColor' method of 'DataGridTableStyle' class. -It adds a 'DataGrid' and two buttons to a form. Then it creates a 'DataGridTableStyle' and maps it to the table of -'DataGrid'. When the user clicks on 'Change the ResetHeaderBackColor' button it changes the Header Background -color to light pink. If the user clicks the 'ResetHeaderBackColor' button it changes the Header Background -Color to default color. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - Button^ myButton; - Button^ myButton1; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridColumnStyle^ myDataGridColumnStyle; - DataGridTableStyle^ myDataTableStyle; - -public: - Form1() - { - InitializeComponent(); - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - AddCustomDataTableStyle(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - myButton = gcnew Button; - myButton1 = gcnew Button; - myDataGrid = gcnew DataGrid; - Text = "DataGridTableStyle Sample"; - ClientSize = System::Drawing::Size( 450, 330 ); - myButton->Location = Point(50,16); - myButton->Name = "button1"; - myButton->Size = System::Drawing::Size( 176, 23 ); - myButton->TabIndex = 2; - myButton->Text = "Change the HeaderBackColor"; - myButton->Click += gcnew EventHandler( this, &Form1::Button_Click ); - myButton1->Location = Point(230,16); - myButton1->Name = "myButton"; - myButton1->Size = System::Drawing::Size( 140, 24 ); - myButton1->TabIndex = 0; - myButton1->Text = "Reset HeaderBackColor"; - myButton1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 240, 150 ); - myDataGrid->CaptionText = "DataGridTableStyle"; - Controls->Add( myButton ); - Controls->Add( myDataGrid ); - Controls->Add( myButton1 ); - } - - // -private: - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Change the color of 'HeaderBack'. - myDataTableStyle->HeaderBackColor = Color::LightPink; - } - - void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the 'HeaderBack' to its origanal color. - myDataTableStyle->ResetHeaderBackColor(); - } - // - -private: - void AddCustomDataTableStyle() - { - // Create a 'DataGridTableStyle'. - myDataTableStyle = gcnew DataGridTableStyle; - myDataTableStyle->MappingName = "Customers"; - - // Create a 'DataGridColumnStyle'. - myDataGridColumnStyle = gcnew DataGridTextBoxColumn; - myDataGridColumnStyle->MappingName = "CustName"; - myDataGridColumnStyle->HeaderText = "Customer Name"; - myDataGridColumnStyle->Width = 150; - - // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. - myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); - - // Add the 'DataGridTableStyle' to 'DataGrid'. - myDataGrid->TableStyles->Add( myDataTableStyle ); - } - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Customers" ); - DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); - myTable->Columns->Add( myColumn ); - myDataSet->Tables->Add( myTable ); - DataRow^ newRow1; - for ( int i = 0; i < 5; i++ ) - { - newRow1 = myTable->NewRow(); - newRow1[ "CustName" ] = i; - - // Add the row to the Customers table. - myTable->Rows->Add( newRow1 ); - } - myTable->Rows[ 0 ][ "CustName" ] = "Jones"; - myTable->Rows[ 1 ][ "CustName" ] = "James"; - myTable->Rows[ 2 ][ "CustName" ] = "David"; - myTable->Rows[ 3 ][ "CustName" ] = "Robert"; - myTable->Rows[ 4 ][ "CustName" ] = "John"; - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp deleted file mode 100644 index 59c3deb5974..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle:ResetHeaderFont - -/* The following example demonstrates 'ResetHeaderFont' method of 'DataGridTableStyle' class. -A DataGrid and two Button's are added to a form. When user clicks 'Set Header Font' button the Header Font of -DataGrid is changed. The HeaderFont is reset to its default value when the 'Reset Header Font' button is clicked. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class myDataForm: public Form -{ -private: - Button^ mySetButton; - Button^ myResetButton; - Label^ myLabel; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridTableStyle^ myTableStyle; - -public: - myDataForm() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - mySetButton = gcnew Button; - myDataGrid = gcnew DataGrid; - ClientSize = System::Drawing::Size( 450, 330 ); - mySetButton->Location = Point(24,16); - mySetButton->Size = System::Drawing::Size( 220, 24 ); - mySetButton->Text = "Set Header Font To 'Impact'"; - mySetButton->Click += gcnew EventHandler( this, &myDataForm::MySetButton_Click ); - myResetButton = gcnew Button; - myResetButton->Location = Point(250,16); - myResetButton->Size = System::Drawing::Size( 130, 24 ); - myResetButton->Text = "Reset Header Font"; - myResetButton->Click += gcnew EventHandler( this, &myDataForm::MyResetButton_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 120, 200 ); - myDataGrid->CaptionText = "DataGrid Control"; - myLabel = gcnew Label; - myLabel->Location = Point(24,270); - myLabel->Width = 500; - Controls->Add( mySetButton ); - Controls->Add( myResetButton ); - Controls->Add( myDataGrid ); - Controls->Add( myLabel ); - Text = "ResetHeaderFont example"; - } - - void SetUp() - { - // Create a DataSet with a table. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Orders" ); - - // Create the DataGridTableStyle. - myTableStyle = gcnew DataGridTableStyle; - - // Map DataGridTableStyle to a DataTable. - myTableStyle->MappingName = "Orders"; - } - - // -private: - void MySetButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Set the 'HeaderFont' property of the DataGridTableStyle instance. - myTableStyle->HeaderFont = gcnew System::Drawing::Font( "Impact",10 ); - - // Add the DataGridTableStyle instance to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle ); - } - - void MyResetButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the Header Font to its default value. - myTableStyle->ResetHeaderFont(); - } - // - -private: - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Orders" ); - DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); - myTable->Columns->Add( myColumn ); - - // Add the table to the DataSet. - myDataSet->Tables->Add( myTable ); - DataRow^ newRow; - for ( int j = 1; j < 15; j++ ) - { - newRow = myTable->NewRow(); - newRow[ "Amount" ] = j * 10; - - // Add the row to the Orders table. - myTable->Rows->Add( newRow ); - } - } -}; - -int main() -{ - Application::Run( gcnew myDataForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp deleted file mode 100644 index 970aa099b9f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp +++ /dev/null @@ -1,137 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ResetHeaderForeColor - -/* -The following example demonstrates 'ResetHeaderForeColor' method of 'DataGridTableStyle' class. -It adds a datagrid and two buttons to a form. A 'DataGridTableStyle' instance is mapped to the table of 'DataGrid'. -When the user clicks on 'Set the HeaderForeColor' button it sets the header fore color. If the user clicks on -'Reset HeaderForeColor' button it resets the grid 'HeaderForeColor' to its default value. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class MyForm1: public Form -{ -private: - Button^ myButton1; - Button^ myButton2; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridColumnStyle^ myDataGridColumnStyle; - DataGridTableStyle^ myDataTableStyle; - -public: - MyForm1() - { - InitializeComponent(); - - // Create a dataset. - MakeDataSet(); - - // Bind datagrid to the dataset. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - AddCustomDataTableStyle(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - myButton1 = gcnew Button; - myButton2 = gcnew Button; - myDataGrid = gcnew DataGrid; - Text = "DataGridTableStyle Sample"; - ClientSize = System::Drawing::Size( 450, 330 ); - myButton1->Location = Point(50,16); - myButton1->Size = System::Drawing::Size( 176, 23 ); - myButton1->Text = "Set the HeaderForeColor"; - myButton1->Click += gcnew EventHandler( this, &MyForm1::myButton1_Click ); - myButton2->Location = Point(230,16); - myButton2->Size = System::Drawing::Size( 140, 24 ); - myButton2->Text = "Reset HeaderForeColor"; - myButton2->Click += gcnew EventHandler( this, &MyForm1::myButton2_Click ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 240, 150 ); - myDataGrid->CaptionText = "DataGridTableStyle Example"; - Controls->Add( myButton1 ); - Controls->Add( myDataGrid ); - Controls->Add( myButton2 ); - } - - // -private: - void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Set the 'HeaderForeColor' property. - myDataTableStyle->HeaderForeColor = Color::Blue; - } - - void myButton2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Reset the 'HeaderForeColor' property to its default value. - myDataTableStyle->ResetHeaderForeColor(); - } - // - -private: - void AddCustomDataTableStyle() - { - // Create a 'DataGridTableStyle'. - myDataTableStyle = gcnew DataGridTableStyle; - myDataTableStyle->MappingName = "Customers"; - - // Create a 'DataGridColumnStyle'. - myDataGridColumnStyle = gcnew DataGridTextBoxColumn; - myDataGridColumnStyle->MappingName = "CustName"; - myDataGridColumnStyle->HeaderText = "Customer Name"; - myDataGridColumnStyle->Width = 150; - - // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. - myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); - - // Add the 'DataGridTableStyle' to 'DataGrid'. - myDataGrid->TableStyles->Add( myDataTableStyle ); - } - - // Create a dataset with one table and populate it. - void MakeDataSet() - { - // Create a dataset. - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myTable = gcnew DataTable( "Customers" ); - - // Create a column, and add it to the table. - DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); - myTable->Columns->Add( myColumn ); - - // Add the table to dataset. - myDataSet->Tables->Add( myTable ); - DataRow^ newRow1; - for ( int i = 0; i < 5; i++ ) - { - newRow1 = myTable->NewRow(); - newRow1[ "CustName" ] = i; - - // Add the row to customers table. - myTable->Rows->Add( newRow1 ); - - } - myTable->Rows[ 0 ][ "CustName" ] = "Jones"; - myTable->Rows[ 1 ][ "CustName" ] = "James"; - myTable->Rows[ 2 ][ "CustName" ] = "David"; - myTable->Rows[ 3 ][ "CustName" ] = "Robert"; - myTable->Rows[ 4 ][ "CustName" ] = "John"; - } -}; - -int main() -{ - Application::Run( gcnew MyForm1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp deleted file mode 100644 index 48242c9b2ae..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp +++ /dev/null @@ -1,288 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ResetLinkColor - -/* The following program demonstrates the 'ResetLinkColor' -of 'System::Windows::Forms::DataGridTableStyle' class. -It creates a windows form, a 'DataSet' containing two 'DataTable' -objects, and a 'DataRelation' that relates the two tables. To -display the data, a 'DataGrid' control is then bound to the -'DataSet' through the 'SetDataBinding' method. -DataGridTableStyle is attached to one of 'DataTable'. -Buttons are provided on form to demonstrate setting link color -and 'ResetLinkColor' method. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace DataGridSample -{ - - /// - /// Summary description for DatGridClass. - /// - public ref class DatGridClass: public System::Windows::Forms::Form - { - private: - DataSet^ myDataSet; - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::GroupBox^ groupBox3; - System::Windows::Forms::Button^ btnResetLinkColor; - System::Windows::Forms::Button^ btnSetLinkColor; - DataGridTableStyle^ myDataGridTableStyle; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - DatGridClass() - { - components = nullptr; - myDataGridTableStyle = gcnew DataGridTableStyle; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // Setup GridControl data. - SetUp(); - } - - public: - - /// - /// Clean up any resources being used. - /// - ~DatGridClass() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->btnSetLinkColor = gcnew System::Windows::Forms::Button; - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - this->btnResetLinkColor = gcnew System::Windows::Forms::Button; - this->groupBox3 = gcnew System::Windows::Forms::GroupBox; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->groupBox3->SuspendLayout(); - this->SuspendLayout(); - - // - // btnSetLinkColor - // - this->btnSetLinkColor->Location = System::Drawing::Point( 16, 16 ); - this->btnSetLinkColor->Name = "btnSetLinkColor"; - this->btnSetLinkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnSetLinkColor->TabIndex = 4; - this->btnSetLinkColor->Text = "Set Link Color"; - this->btnSetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetLinkColor_Click ); - - // - // myDataGrid - // - this->myDataGrid->DataMember = ""; - this->myDataGrid->ForeColor = System::Drawing::Color::Blue; - this->myDataGrid->Location = System::Drawing::Point( 12, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->ReadOnly = true; - this->myDataGrid->Size = System::Drawing::Size( 272, 192 ); - this->myDataGrid->TabIndex = 6; - - // - // btnResetLinkColor - // - this->btnResetLinkColor->Location = System::Drawing::Point( 16, 48 ); - this->btnResetLinkColor->Name = "btnResetLinkColor"; - this->btnResetLinkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnResetLinkColor->TabIndex = 1; - this->btnResetLinkColor->Text = "Reset Link Color"; - this->btnResetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetLinkColor_Click ); - - // - // groupBox3 - // - array^groupBox3Controls = {this->btnSetLinkColor,this->btnResetLinkColor}; - this->groupBox3->Controls->AddRange( groupBox3Controls ); - this->groupBox3->Location = System::Drawing::Point( 80, 232 ); - this->groupBox3->Name = "groupBox3"; - this->groupBox3->Size = System::Drawing::Size( 136, 88 ); - this->groupBox3->TabIndex = 7; - this->groupBox3->TabStop = false; - - // - // DatGridClass - // - this->ClientSize = System::Drawing::Size( 312, 341 ); - array^formControls = {this->groupBox3,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->Name = "DatGridClass"; - this->Text = "Sample Program"; - (dynamic_cast(this->myDataGrid))->EndInit(); - this->groupBox3->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void SetUp() - { - // Create a 'DataSet' with two tables and one relation. - MakeDataSet(); - - // Bind the 'DataGrid' to the 'DataSet'. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // Create a 'DataSet' with two tables and populate it. - void MakeDataSet() - { - // Create a 'DataSet'. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create two 'DataTables'. - DataTable^ tCust = gcnew DataTable( "Customers" ); - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Map 'myDataGridTableStyle' to 'Customers' table. - myDataGridTableStyle->MappingName = "Customers"; - - // Add the DataGridTableStyle objects to the collection. - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - - // Create three columns and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",String::typeid ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the 'DataSet'. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a 'DataRelation' and add it to the 'DataSet'. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - // Create two 'DataRow' variables for customer and order. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the 'Customers Table'. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the 'Customers Table'. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Customer1"; - tCust->Rows[ 1 ][ "custName" ] = "Customer2"; - tCust->Rows[ 2 ][ "custName" ] = "Customer3"; - - // Give the current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the orders table. - double myNumber = 0; - String^ myString; - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - myNumber = i * 10 + j * .1; - myString = String::Concat( "$ ", myNumber.ToString() ); - newRow2[ "OrderAmount" ] = myString; - - // Add the row to the orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } - - void btnResetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Link color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGridTableStyle->LinkColor; - myString = String::Concat( myString, myCurrentColor ); - - // Reset link color to default. - myDataGridTableStyle->ResetLinkColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGridTableStyle->LinkColor ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Link line color information" ); - // - } - - void btnSetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color select to the current color. - myColorDialog->Color = myDataGridTableStyle->LinkColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set link color to selected color. - myDataGridTableStyle->LinkColor = myColorDialog->Color; - } - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew DataGridSample::DatGridClass ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp deleted file mode 100644 index 36b68f82c68..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp +++ /dev/null @@ -1,217 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::RowHeaderWidth -// System::Windows::Forms::DataGridTableStyle::RowHeaderWidthChanged - -/* The following program demonstrates the 'RowHeaderWidth' -method and 'RowHeaderWidthChanged' event of 'DataGridTableStyle' -class. It changes the row header width on button click -and resets the row header width. */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class DataGridTableStyle_RowHeaderWidth: public Form -{ -private: - System::ComponentModel::Container^ components; - Button^ button2; - DataGridColumnStyle^ IdCol; - DataGridColumnStyle^ TextCol; - DataGridTableStyle^ myDataGridTableStyle; - Button^ button1; - DataGrid^ myDataGrid; - -public: - ~DataGridTableStyle_RowHeaderWidth() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->myDataGrid = gcnew DataGrid; - this->button1 = gcnew Button; - this->button2 = gcnew Button; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // myDataGrid - // - this->myDataGrid->DataMember = ""; - this->myDataGrid->LinkColor = SystemColors::Desktop; - this->myDataGrid->Location = Point(56,40); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 224, 144 ); - this->myDataGrid->TabIndex = 0; - - // - // button1 - // - this->button1->Location = Point(168,208); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 152, 23 ); - this->button1->TabIndex = 1; - this->button1->Text = " Change RowHeader Width"; - this->button1->Click += gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::button1_Click ); - - // - // button2 - // - this->button2->Location = Point(16,208); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 152, 23 ); - this->button2->TabIndex = 1; - this->button2->Text = "Display RowHeader Width"; - this->button2->Click += gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::button2_Click ); - - // - // DataGridTableStyle_RowHeaderWidth - // - this->ClientSize = System::Drawing::Size( 344, 261 ); - array^temp0 = {this->myDataGrid,this->button2}; - this->Controls->AddRange( temp0 ); - this->Name = "DataGridTableStyle_RowHeaderWidth"; - this->Text = "Change Row Width"; - CallEventLoader(); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - -public: - DataGridTableStyle_RowHeaderWidth() - { - components = nullptr; - IdCol = gcnew DataGridTextBoxColumn; - TextCol = gcnew DataGridTextBoxColumn; - myDataGridTableStyle = gcnew DataGridTableStyle; - InitializeComponent(); - - // Create and bind DataSet to DataGrid. - CreateNBindDataSet(); - } - -private: - void CreateNBindDataSet() - { - // Create a DataSet with one table. - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ myEmpTable = gcnew DataTable( "Employee" ); - - // Create two columns, and add them to the employee table. - DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); - DataColumn^ myEmpName = gcnew DataColumn( "EmpName" ); - myEmpTable->Columns->Add( myEmpID ); - myEmpTable->Columns->Add( myEmpName ); - - // Add the table to the DataSet. - myDataSet->Tables->Add( myEmpTable ); - - // Populate the table. - DataRow^ newRow1; - - // Create employee records in the employee table. - for ( int i = 1; i < 6; i++ ) - { - newRow1 = myEmpTable->NewRow(); - newRow1[ "EmpID" ] = i; - - // Add the row to the Employee table. - myEmpTable->Rows->Add( newRow1 ); - } - - // Give each employee a distinct name. - myEmpTable->Rows[ 0 ][ "EmpName" ] = "Gary"; - myEmpTable->Rows[ 1 ][ "EmpName" ] = "Harry"; - myEmpTable->Rows[ 2 ][ "EmpName" ] = "Mary"; - myEmpTable->Rows[ 3 ][ "EmpName" ] = "Larry"; - myEmpTable->Rows[ 4 ][ "EmpName" ] = "Robert"; - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Employee" ); - } - - void DataGridTableStyle_RowHeaderWidth_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGridTableStyle->MappingName = "Employee"; - - // Set other properties. - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - - // Set MappingName to the DataColumn name in the DataTable. - IdCol->MappingName = "EmpID"; - - // Set the HeaderText and Width properties. - IdCol->HeaderText = "Emp ID"; - IdCol->Width = 50; - - // Add a GridColumnStyle. - myDataGridTableStyle->GridColumnStyles->Add( IdCol ); - myDataGridTableStyle->RowHeaderWidth = 10; - - // Add a second column style. - TextCol->MappingName = "EmpName"; - TextCol->HeaderText = "Emp Name"; - TextCol->Width = 100; - myDataGridTableStyle->GridColumnStyles->Add( TextCol ); - - // Add the DataGridTableStyle to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - myDataGridTableStyle->GridLineColor = Color::Red; - AttachRowHeaderWidthChanged(); - } - - // - // -private: - void CallEventLoader() - { - this->Load += gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::DataGridTableStyle_RowHeaderWidth_Load ); - } - -public: - void AttachRowHeaderWidthChanged() - { - myDataGridTableStyle->RowHeaderWidthChanged += - gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::MyDelegateRowHeaderChanged ); - } - -private: - void MyDelegateRowHeaderChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "Row header width is changed" ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGridTableStyle->RowHeaderWidth = 30; - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( String::Concat( "Row header width is: ", myDataGridTableStyle->RowHeaderWidth ) ); - } - // - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew DataGridTableStyle_RowHeaderWidth ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp deleted file mode 100644 index dd2460265d0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp +++ /dev/null @@ -1,186 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::RowHeadersVisibleChanged -// System::Windows::Forms::DataGridTableStyle::RowHeadersVisible - -/* The following program demonstrates the 'RowHeadersVisible' -method and 'RowHeadersVisibleChanged' event of -'System::Windows::Forms::DataGridTableStyle' class. It makes the -row headers visible or invisible on button click */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyDataGridTableStyle_RowHeadersVisibleChanged: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGridTableStyle^ myDataGridTableStyle; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ myButton; - -public: - MyDataGridTableStyle_RowHeadersVisibleChanged() - { - components = nullptr; - - // Create the form. - InitializeComponent(); - - // Bind the controls to the DataGrid. - MakeDataSet(); - } - -public: - - // Clean up any resources being used. - ~MyDataGridTableStyle_RowHeadersVisibleChanged() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myDataGridTableStyle = gcnew DataGridTableStyle; - this->myDataGrid = gcnew DataGrid; - this->myButton = gcnew Button; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGridTableStyle"; - this->MaximizeBox = false; - myButton->Location = Point(80,15); - myButton->Size = System::Drawing::Size( 130, 40 ); - myButton->Text = "Toggle Row Headers"; - myButton->Click += gcnew EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::myButton_Click ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->ReadOnly = false; - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - this->Load += gcnew System::EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::DataGridTableStyle_RowHeadersVisible_Load ); - } - - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ tPer = gcnew DataTable( "Person" ); - - // Create two columns, and add them to the Person table. - DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); - tPer->Columns->Add( cPerID ); - tPer->Columns->Add( cPerName ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tPer ); - - // For each person create a DataRow variable. - DataRow^ newRow1; - - // Create five persons in the Person Table. - for ( int i = 1; i < 6; i++ ) - { - newRow1 = tPer->NewRow(); - newRow1[ "SSN" ] = i; - - // Add the row to the Person table. - tPer->Rows->Add( newRow1 ); - } - - // Give each person a distinct name. - tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; - tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; - tPer->Rows[ 2 ][ "PersonName" ] = "John"; - tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; - tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - void DataGridTableStyle_RowHeadersVisible_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGridTableStyle->MappingName = "Person"; - - // Set other properties. - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - - // Create DataGridColumnStyle - DataGridColumnStyle^ IdCol = gcnew DataGridTextBoxColumn; - DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; - - // Set MappingName to DataColumn name in DataTable. - IdCol->MappingName = "SSN"; - - // Set the HeaderText and Width properties. - IdCol->HeaderText = "SSN"; - IdCol->Width = 50; - - // Add a second column style. - TextCol->MappingName = "PersonName"; - TextCol->HeaderText = "Person Name"; - TextCol->Width = 150; - - // Add the GridColumnStyles to DataGridTableStyle. - myDataGridTableStyle->GridColumnStyles->Add( IdCol ); - myDataGridTableStyle->GridColumnStyles->Add( TextCol ); - - // Add the DataGridTableStyle to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - myDataGridTableStyle->GridLineColor = Color::Aquamarine; - AttachRowHeaderVisibleChanged(); - } - - // - // - // Instantiate the EventHandler. -public: - void AttachRowHeaderVisibleChanged() - { - myDataGridTableStyle->RowHeadersVisibleChanged += gcnew EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::MyDelegateRowHeadersVisibleChanged ); - } - - // raise the event when RowHeadersVisible property is changed. -private: - void MyDelegateRowHeadersVisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ myString = "'RowHeadersVisibleChanged' event raised, Row Headers are"; - if ( myDataGridTableStyle->RowHeadersVisible ) - myString = String::Concat( myString, " visible" ); - else - myString = String::Concat( myString, " not visible" ); - - MessageBox::Show( myString, "RowHeader information" ); - } - - // raise the event when a button is clicked. - void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( myDataGridTableStyle->RowHeadersVisible ) - myDataGridTableStyle->RowHeadersVisible = false; - else - myDataGridTableStyle->RowHeadersVisible = true; - } - // - // -}; - -// Main entry point for the application. -int main() -{ - Application::Run( gcnew MyDataGridTableStyle_RowHeadersVisibleChanged ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp deleted file mode 100644 index 90cd8119c31..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp +++ /dev/null @@ -1,268 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::LinkColor; -// System::Windows::Forms::DataGridTableStyle::HeaderFont; -// System::Windows::Forms::DataGridTableStyle::LinkColorChanged; -// System::Windows::Forms::DataGridTableStyle::HeaderFontChanged; - -/* The following example demonstrates the properties 'LinkColor', 'HeaderFont' -and Events 'LinkColorChanged', 'HeaderFontChanged' of DataGridTableStyle. -The following program creates a Windows form, a DataSet containing two DataTable objects, -and a DataRelation that relates the two tables. A button on the form changes the appearance -of the grid by setting the linkcolor and headerfont. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace SampleDataGridTableStyle -{ - public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle2; - DataSet^ myDataSet; - System::Windows::Forms::Button^ btnApplyStyles; - System::ComponentModel::Container^ components; - - public: - DataGridTableStyle_Sample() - { - components = nullptr; - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - - public: - ~DataGridTableStyle_Sample() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->btnApplyStyles = gcnew System::Windows::Forms::Button; - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // btnApplyStyles - // - this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->btnApplyStyles->Location = System::Drawing::Point( 88, 208 ); - this->btnApplyStyles->Name = "btnApplyStyles"; - this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); - this->btnApplyStyles->TabIndex = 1; - this->btnApplyStyles->Text = "Apply Custom Styles"; - this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); - - // - // myDataGrid - // - this->myDataGrid->BackColor = System::Drawing::SystemColors::Info; - this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->LinkColor = System::Drawing::Color::Gray; - this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); - this->myDataGrid->TabIndex = 0; - - // - // DataGridTableStyle_Sample - // - this->ClientSize = System::Drawing::Size( 440, 273 ); - array^formControls = {this->btnApplyStyles,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->Name = "DataGridTableStyle_Sample"; - this->Text = "DataGridTableStyle_Sample"; - this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ){} - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // - // - // - // - private: - void AddCustomDataTableStyle() - { - myDataGridTableStyle1 = gcnew DataGridTableStyle; - myDataGridTableStyle2 = gcnew DataGridTableStyle; - MessageBox::Show( String::Concat( "LinkColor Before : ", myDataGridTableStyle1->LinkColor ) ); - MessageBox::Show( String::Concat( "HeaderFont Before : ", myDataGridTableStyle1->HeaderFont ) ); - myDataGridTableStyle1->LinkColorChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::LinkColorChanged_Handler ); - myDataGridTableStyle1->HeaderFontChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::HeaderFontChanged_Handler ); - myDataGridTableStyle1->MappingName = "Customers"; - - // Set other properties. - myDataGridTableStyle1->AlternatingBackColor = Color::LightGray; - myDataGridTableStyle1->LinkColor = Color::Red; - myDataGridTableStyle1->HeaderFont = gcnew System::Drawing::Font( "Verdana",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - - // Add a GridColumnStyle and set its MappingName. - DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; - myBoolCol->MappingName = "Current"; - myBoolCol->HeaderText = "IsCurrent Customer"; - myBoolCol->Width = 150; - myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); - - // Add a second column style. - DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; - myTextCol->MappingName = "custName"; - myTextCol->HeaderText = "Customer Name"; - myTextCol->Width = 250; - myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); - - // Create new ColumnStyle objects - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - - // PropertyDescriptor to create a formatted column. - PropertyDescriptorCollection^ myPropertyDescriptorCollection = this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties(); - DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - - // Add the DataGridTableStyle instances to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); - } - - void LinkColorChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "LinkColor changed to 'RED'", "DataGridTableStyle" ); - } - - void HeaderFontChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "HeaderFont changed to 'VERDANA'", "DataGridTableStyle" ); - } - // - // - // - // - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create Customer DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create Customer order table. - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Gamma"; - - // Give the Current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } - - void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - AddCustomDataTableStyle(); - btnApplyStyles->Enabled = false; - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp deleted file mode 100644 index 0a744e45790..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp +++ /dev/null @@ -1,247 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::AllowSorting; -// System::Windows::Forms::DataGridTableStyle::AllowSortingChanged; - -/* The following example demonstrates the property -'AllowSorting' and event 'AllowSortingChanged' of class DataGridTableStyle. -The following program creates a Windows form, a DataSet containing -two DataTable objects, and a DataRelation that relates the two tables. -A button on the form toggles sorting availability on the grid. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace SampleDataGridTableStyle -{ - public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; - DataSet^ myDataSet; - System::Windows::Forms::Button^ btnApplyStyles; - System::Windows::Forms::Label ^ mylabel; - System::ComponentModel::Container^ components; - - public: - DataGridTableStyle_Sample() - { - components = nullptr; - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - - public: - ~DataGridTableStyle_Sample() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->btnApplyStyles = gcnew System::Windows::Forms::Button; - this->mylabel = gcnew System::Windows::Forms::Label; - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // btnApplyStyles - // - this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->btnApplyStyles->Location = System::Drawing::Point( 216, 192 ); - this->btnApplyStyles->Name = "btnApplyStyles"; - this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); - this->btnApplyStyles->TabIndex = 1; - this->btnApplyStyles->Text = "Apply Sorting"; - this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); - - // - // mylabel - // - this->mylabel->Font = gcnew System::Drawing::Font( "Verdana",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->mylabel->Location = System::Drawing::Point( 48, 208 ); - this->mylabel->Name = "mylabel"; - this->mylabel->Size = System::Drawing::Size( 160, 23 ); - this->mylabel->TabIndex = 2; - this->mylabel->Text = "Sorting Status"; - - // - // myDataGrid - // - this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->LinkColor = System::Drawing::Color::Gray; - this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); - this->myDataGrid->TabIndex = 0; - - // - // DataGridTableStyle_Sample - // - this->ClientSize = System::Drawing::Size( 416, 261 ); - array^formControls = {this->mylabel,this->btnApplyStyles,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->Name = "DataGridTableStyle_Sample"; - this->Text = "DataGridTableStyle_Sample"; - this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create Customer DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create Customer order table. - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Gamma"; - - // Give the Current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } - - // - // - private: - void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGridTableStyle1 = gcnew DataGridTableStyle; - mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); - if ( myDataGridTableStyle1->AllowSorting) - { - btnApplyStyles->Text = "Remove Sorting"; - } - else - { - btnApplyStyles->Text = "Apply Sorting"; - } - - myDataGridTableStyle1->AllowSortingChanged += gcnew System::EventHandler( - this, &DataGridTableStyle_Sample::AllowSortingChanged_Handler ); - myDataGridTableStyle1->MappingName = "Customers"; - } - - void AllowSortingChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); - } - - void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGridTableStyle1->AllowSorting) - { - // Remove sorting. - myDataGridTableStyle1->AllowSorting = false; - btnApplyStyles->Text = "Allow Sorting"; - } - else - { - // Allow sorting. - myDataGridTableStyle1->AllowSorting = true; - btnApplyStyles->Text = "Remove Sorting"; - } - - mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); - - // Add the DataGridTableStyle to DataGrid. - myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); - } - // - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp deleted file mode 100644 index c677cd04ee9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp +++ /dev/null @@ -1,286 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::ColumnHeadersVisible; -// System::Windows::Forms::DataGridTableStyle::ColumnHeadersVisibleChanged; - -/* The following example demonstrates the property 'ColumnHeadersVisible' -and event 'ColumnHeadersVisibleChanged' of DataGridTableStyle. -The following program creates a Windows form, a DataSet containing two DataTable objects, -and a DataRelation that relates the two tables. A button on the form changes the appearance -of column headers on the grid. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace SampleDataGridTableStyle -{ - public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; - DataSet^ myDataSet; - System::Windows::Forms::Button^ btnheader; - System::Windows::Forms::Label ^ myHeaderLabel; - System::ComponentModel::Container^ components; - - public: - DataGridTableStyle_Sample() - { - components = nullptr; - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - - public: - ~DataGridTableStyle_Sample() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->myHeaderLabel = gcnew System::Windows::Forms::Label; - this->btnheader = gcnew System::Windows::Forms::Button; - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // myHeaderLabel - // - this->myHeaderLabel->Font = gcnew System::Drawing::Font( "Verdana",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->myHeaderLabel->Location = System::Drawing::Point( 48, 216 ); - this->myHeaderLabel->Name = "myHeaderLabel"; - this->myHeaderLabel->Size = System::Drawing::Size( 160, 23 ); - this->myHeaderLabel->TabIndex = 2; - this->myHeaderLabel->Text = "Header Status"; - - // - // btnheader - // - this->btnheader->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->btnheader->Location = System::Drawing::Point( 216, 200 ); - this->btnheader->Name = "btnheader"; - this->btnheader->Size = System::Drawing::Size( 144, 40 ); - this->btnheader->TabIndex = 1; - this->btnheader->Text = "Remove Header"; - this->btnheader->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnheader_Click ); - - // - // myDataGrid - // - this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->LinkColor = System::Drawing::Color::Gray; - this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->SelectionBackColor = System::Drawing::SystemColors::Window; - this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); - this->myDataGrid->TabIndex = 0; - - // - // DataGridTableStyle_Sample - // - this->ClientSize = System::Drawing::Size( 416, 277 ); - array^formControls = {this->btnheader,this->myHeaderLabel,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->Name = "DataGridTableStyle_Sample"; - this->Text = "DataGridTableStyle_Sample"; - this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create Customer DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create Customer order table. - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Gamma"; - - // Give the Current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } - - // - // - private: - void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGridTableStyle1 = gcnew DataGridTableStyle; - myHeaderLabel->Text = String::Concat( "Header Status : ", myDataGridTableStyle1->ColumnHeadersVisible ); - if (myDataGridTableStyle1->ColumnHeadersVisible) - { - btnheader->Text = "Remove Header"; - } - else - { - btnheader->Text = "Add Header"; - } - - AddCustomDataTableStyle(); - } - - void AddCustomDataTableStyle() - { - myDataGridTableStyle1->ColumnHeadersVisibleChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::ColumnHeadersVisibleChanged_Handler ); - - // Set ColumnheaderVisible property. - myDataGridTableStyle1->MappingName = "Customers"; - - // Add a GridColumnStyle and set its MappingName - DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; - myBoolCol->MappingName = "Current"; - myBoolCol->HeaderText = "IsCurrent Customer"; - myBoolCol->Width = 150; - myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); - - // Add a second column style. - DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; - myTextCol->MappingName = "custName"; - myTextCol->HeaderText = "Customer Name"; - myTextCol->Width = 250; - myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); - - // Create new ColumnStyle objects - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - - // PropertyDescriptor to create a formatted column. - PropertyDescriptorCollection^ myPropertyDescriptorCollection = - this->BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); - - // Create a formatted column using a PropertyDescriptor. - DataGridColumnStyle^ csOrderAmount = - gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - - // Add the DataGridTableStyle instances to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); - } - - void ColumnHeadersVisibleChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myHeaderLabel->Text = String::Concat( "Header Status : ", myDataGridTableStyle1->ColumnHeadersVisible ); - } - - void btnheader_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if (myDataGridTableStyle1->ColumnHeadersVisible) - { - myDataGridTableStyle1->ColumnHeadersVisible = false; - btnheader->Text = "Add Header"; - } - else - { - myDataGridTableStyle1->ColumnHeadersVisible = true; - btnheader->Text = "Remove Header"; - } - } - // - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp deleted file mode 100644 index 7d372741f89..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::SelectionBackColorChanged -// System::Windows::Forms::DataGridTableStyle::SelectionBackColor -// System::Windows::Forms::DataGridTableStyle::ResetSelectionBackColor - -/* The following program demonstrates the 'SelectionBackColorChanged' -event, 'SelectionBackColor' property and 'ResetSelectionBackColor' -method of the'DataGridTableStyle'class. It changes the BackColor -of the selected cells by raising the 'SelectionBackColorChanged' -event. The SelectionBackColor is reset to its default value with -the 'ResetSelectionBackColor' button. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - System::Windows::Forms::Button^ myBackColorButton; - System::Windows::Forms::Button^ myResetButton; - DataGridTableStyle^ myGridTableStyle; - DataGrid^ myDataGrid; - -public: - MyForm() - { - components = nullptr; - myDataGrid = gcnew DataGrid; - InitializeComponent(); - } - -public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->myBackColorButton = gcnew System::Windows::Forms::Button; - this->myResetButton = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // myBackColorButton - // - this->myBackColorButton->Location = System::Drawing::Point( 0, 352 ); - this->myBackColorButton->Name = "myBackColorButton"; - this->myBackColorButton->Size = System::Drawing::Size( 160, 23 ); - this->myBackColorButton->TabIndex = 0; - this->myBackColorButton->Text = "Change SelectionBackColor"; - this->myBackColorButton->Click += gcnew System::EventHandler( this, &MyForm::MyBackColorButton_Click ); - - // - // myResetButton - // - this->myResetButton->Location = System::Drawing::Point( 160, 352 ); - this->myResetButton->Name = "myResetButton"; - this->myResetButton->Size = System::Drawing::Size( 152, 23 ); - this->myResetButton->TabIndex = 1; - this->myResetButton->Text = "Reset SelectionBackColor"; - this->myResetButton->Click += gcnew System::EventHandler( this, &MyForm::MyResetButton_Click ); - - // - // MyForm - // - this->ClientSize = System::Drawing::Size( 316, 411 ); - array^formControls = {this->myResetButton,this->myBackColorButton}; - this->Controls->AddRange( formControls ); - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow; - this->Name = "MyForm"; - this->Text = "MyForm"; - this->Load += gcnew System::EventHandler( this, &MyForm::MyForm_Load ); - this->ResumeLayout( false ); - } - - void MyForm_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGrid->CaptionText = "My Data Grid"; - myDataGrid->Height = 300; - myDataGrid->Width = 300; - myDataGrid->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - myDataGrid->SetDataBinding( MakeDataSet(), "Orders" ); - Controls->Add( myDataGrid ); - myGridTableStyle = gcnew DataGridTableStyle; - myGridTableStyle->MappingName = "Orders"; - myGridTableStyle->SelectionForeColor = Color::Coral; - myDataGrid->TableStyles->Add( myGridTableStyle ); - AttachSelectionBackColorChanged(); - } - - // -public: - void AttachSelectionBackColorChanged() - { - // Handle the 'SelectionBackColorChanged' event. - myGridTableStyle->SelectionBackColorChanged += gcnew EventHandler( this, &MyForm::MyDataGrid_SelectedBackColorChanged ); - } - -private: - void MyDataGrid_SelectedBackColorChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "SelectionBackColorChanged event was raised, Color changed to " + myGridTableStyle->SelectionBackColor ); - } - // - - void MyBackColorButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Allow the user to select a Color. - ColorDialog^ myColorDialog = gcnew ColorDialog; - myColorDialog->AllowFullOpen = false; - myColorDialog->ShowHelp = true; - - // Set the initial color select to the current color. - myColorDialog->Color = myGridTableStyle->SelectionBackColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set the backcolor for the selected cells. - myGridTableStyle->SelectionBackColor = myColorDialog->Color; - // - - myDataGrid->Invalidate(); - } - - void MyResetButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Set the SelectionBackColor to the default color. - myGridTableStyle->ResetSelectionBackColor(); - // - } - - DataSet^ MakeDataSet() - { - // Create a DataSet. - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - - // Create two DataTables. - DataTable^ myDataGrid = gcnew DataTable( "Customers" ); - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - myDataGrid->Columns->Add( cCustID ); - myDataGrid->Columns->Add( cCustName ); - myDataGrid->Columns->Add( cCurrent ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( myDataGrid ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - // Create for each customer and order two DataRow variables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = myDataGrid->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - myDataGrid->Rows->Add( newRow1 ); - } - myDataGrid->Rows[ 0 ][ "custName" ] = "Customer 1"; - myDataGrid->Rows[ 1 ][ "custName" ] = "Customer 2"; - myDataGrid->Rows[ 2 ][ "custName" ] = "Customer 3"; - - // Give the Current column a value. - myDataGrid->Rows[ 0 ][ "Current" ] = true.ToString(); - myDataGrid->Rows[ 1 ][ "Current" ] = true.ToString(); - myDataGrid->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - return myDataSet; - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp deleted file mode 100644 index a8d4b39752c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp +++ /dev/null @@ -1,237 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::SelectionForeColor -// System::Windows::Forms::DataGridTableStyle::ResetSelectionForeColor - -/* The following program demonstrates the use of 'SelectionForeColor' -property and 'ResetSelectionForeColor' method of -'System::Windows::Forms::DataGridTableStyle'. -It creates a windows form, a 'DataSet' containing one 'DataTable' -Object*. A 'DataGridTableStyle' is attached to 'DataTable'. -To display the data, a 'DataGrid' control is then bound to the -'DataSet' through the 'SetDataBinding' method. -Two button are provided on form to show 'SelectionForeColor' and -'ResetSelectionForeColor'. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace MyDataGridNamespace -{ - public ref class MyForm: public System::Windows::Forms::Form - { - private: - System::ComponentModel::Container^ components; - DataGridTableStyle^ customersStyle; - System::Windows::Forms::GroupBox^ groupBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::DataGrid^ myDataGrid; - - public: - MyForm() - { - components = nullptr; - customersStyle = gcnew DataGridTableStyle; - InitializeComponent(); - } - - public: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->groupBox1 = gcnew System::Windows::Forms::GroupBox; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->groupBox1->SuspendLayout(); - this->SuspendLayout(); - - // - // myDataGrid - // - this->myDataGrid->DataMember = ""; - this->myDataGrid->Location = System::Drawing::Point( 32, 16 ); - this->myDataGrid->Name = "dataGrid1"; - this->myDataGrid->Size = System::Drawing::Size( 232, 144 ); - this->myDataGrid->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 16, 16 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 144, 24 ); - this->button1->TabIndex = 0; - this->button1->Text = "SetSelectionForeColor"; - this->button1->Click += gcnew System::EventHandler( this, &MyForm::button1_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 16, 40 ); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 144, 24 ); - this->button2->TabIndex = 1; - this->button2->Text = "ResetSelectionForeColor"; - this->button2->Click += gcnew System::EventHandler( this, &MyForm::button2_Click ); - - // - // groupBox1 - // - array^groupBox1Controls = {this->button2,this->button1}; - this->groupBox1->Controls->AddRange( groupBox1Controls ); - this->groupBox1->Location = System::Drawing::Point( 64, 168 ); - this->groupBox1->Name = "groupBox1"; - this->groupBox1->Size = System::Drawing::Size( 176, 80 ); - this->groupBox1->TabIndex = 1; - this->groupBox1->TabStop = false; - - // - // MyForm - // - this->ClientSize = System::Drawing::Size( 320, 266 ); - array^formControls = {this->groupBox1,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow; - this->Name = "MyForm"; - this->Text = "MyForm"; - this->Load += gcnew System::EventHandler( this, &MyForm::MyFormLoad ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->groupBox1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void MyFormLoad( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myDataGrid->SetDataBinding( MakeDataSet(), "Customers" ); - - // Add data grid control to form. - Controls->Add( myDataGrid ); - } - - DataSet^ MakeDataSet() - { - // Create a DataSet. - DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); - - // Create two DataTables. - DataTable^ tCustomers = gcnew DataTable( "Customers" ); - - // Map 'CustomersStyle' to 'Customers' table. - customersStyle->MappingName = "Customers"; - - // Add the DataGridTableStyle objects to the collection. - myDataGrid->TableStyles->Add( customersStyle ); - - // Create two columns and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCustomers->Columns->Add( cCustID ); - tCustomers->Columns->Add( cCustName ); - tCustomers->Columns->Add( cCurrent ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCustomers ); - - // Populate the tables. - // Create two DataRow variables for each customer and order. - DataRow^ newRow1; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCustomers->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCustomers->Rows->Add( newRow1 ); - } - tCustomers->Rows[ 0 ][ "custName" ] = "Customer 1"; - tCustomers->Rows[ 1 ][ "custName" ] = "Customer 2"; - tCustomers->Rows[ 2 ][ "custName" ] = "Customer 3"; - - // Give the Current column a value. - tCustomers->Rows[ 0 ][ "Current" ] = true.ToString(); - tCustomers->Rows[ 1 ][ "Current" ] = true.ToString(); - tCustomers->Rows[ 2 ][ "Current" ] = false.ToString(); - return myDataSet; - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color select to the current color. - myColorDialog->Color = customersStyle->SelectionForeColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set selection fore color to selected color. - customersStyle->SelectionForeColor = myColorDialog->Color; - // - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Fore color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = customersStyle->SelectionForeColor; - myString = String::Concat( myString, myCurrentColor ); - - // Reset selection fore color to default. - customersStyle->ResetSelectionForeColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, customersStyle->SelectionForeColor ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Selection fore color information" ); - // - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew MyDataGridNamespace::MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp deleted file mode 100644 index b15eaf7bad2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp +++ /dev/null @@ -1,256 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::MappingNameChanged; -// System::Windows::Forms::DataGridTableStyle::GridLineStyleChanged; - -/* The following example demonstrates the events -'MappingNameChanged', 'GridLineStyleChanged' of class 'DataGridTableStyle'. -The following program creates a Windows form, a DataSet containing two DataTable objects, -and a DataRelation that relates the two tables. A button on the form changes data and -appearance of the grid by setting the MappingName and GridLineStyle. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace SampleDataGridTableStyle -{ - public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; - DataSet^ myDataSet; - System::Windows::Forms::Button^ btnApplyStyles; - System::ComponentModel::Container^ components; - - public: - DataGridTableStyle_Sample() - { - components = nullptr; - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - - public: - ~DataGridTableStyle_Sample() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->btnApplyStyles = gcnew System::Windows::Forms::Button; - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // btnApplyStyles - // - this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->btnApplyStyles->Location = System::Drawing::Point( 88, 208 ); - this->btnApplyStyles->Name = "btnApplyStyles"; - this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); - this->btnApplyStyles->TabIndex = 1; - this->btnApplyStyles->Text = "Apply Custom Styles"; - this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); - - // - // myDataGrid - // - this->myDataGrid->BackColor = System::Drawing::SystemColors::Info; - this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->LinkColor = System::Drawing::Color::Gray; - this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); - this->myDataGrid->TabIndex = 0; - - // - // DataGridTableStyle_Sample - // - this->ClientSize = System::Drawing::Size( 384, 301 ); - array^formControls = {this->btnApplyStyles,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->Name = "DataGridTableStyle_Sample"; - this->Text = "DataGridTableStyle_Sample"; - this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ){} - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // - // - private: - void AddCustomDataTableStyle() - { - myDataGridTableStyle1 = gcnew DataGridTableStyle; - myDataGridTableStyle1->MappingNameChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::MappingNameChanged_Handler ); - myDataGridTableStyle1->GridLineStyleChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::GridLineStyleChanged_Handler ); - myDataGridTableStyle1->MappingName = "Customers"; - - // Set other properties. - myDataGridTableStyle1->AlternatingBackColor = Color::LightGray; - myDataGridTableStyle1->GridLineStyle = System::Windows::Forms::DataGridLineStyle::None; - - // Add a GridColumnStyle and set its MappingName. - DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; - myBoolCol->MappingName = "Current"; - myBoolCol->HeaderText = "IsCurrent Customer"; - myBoolCol->Width = 150; - myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); - - // Add a second column style. - DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; - myTextCol->MappingName = "custName"; - myTextCol->HeaderText = "Customer Name"; - myTextCol->Width = 250; - myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); - - // Create new ColumnStyle objects. - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - - // Use PropertyDescriptor to create a formatted column. - PropertyDescriptorCollection^ myPropertyDescriptorCollection = this->BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); - DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - - // Add the DataGridTableStyle Object* to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); - } - - void MappingNameChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "MappingName Changed", "DataGridTableStyle" ); - } - - void GridLineStyleChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "GridLineStyle Changed", "DataGridTableStyle" ); - } - // - // - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create Customer DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create Customer order table. - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Gamma"; - // Give the Current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } - - void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - AddCustomDataTableStyle(); - btnApplyStyles->Enabled = false; - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp deleted file mode 100644 index ac30098513a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp +++ /dev/null @@ -1,257 +0,0 @@ -// System::Windows::Forms::DataGridTableStyle::AlternatingBackColor; -// System::Windows::Forms::DataGridTableStyle::GridLineColor; -// System::Windows::Forms::DataGridTableStyle::GridLineColorChanged; - -/* The following example demonstrates properties 'GridLineColor', 'AlternatingBackColor' -and event 'GridLineColorChanged' of 'DataGridTableStyle' class. -It creates a Windows form, a DataSet containing two DataTable -objects, and a DataRelation that relates the two tables. A button on -the form changes the appearance of the grid by setting the GridLineColor -and AlternatingBackColor. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; - DataSet^ myDataSet; - System::Windows::Forms::Button^ btnApplyStyles; - System::ComponentModel::Container^ components; - -public: - DataGridTableStyle_Sample() - { - components = nullptr; - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -public: - ~DataGridTableStyle_Sample() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->btnApplyStyles = gcnew System::Windows::Forms::Button; - this->myDataGrid = gcnew System::Windows::Forms::DataGrid; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // btnApplyStyles - // - this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->btnApplyStyles->Location = System::Drawing::Point( 88, 208 ); - this->btnApplyStyles->Name = "btnApplyStyles"; - this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); - this->btnApplyStyles->TabIndex = 1; - this->btnApplyStyles->Text = "Apply Custom Styles"; - this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); - - // - // myDataGrid - // - this->myDataGrid->AlternatingBackColor = System::Drawing::SystemColors::Info; - this->myDataGrid->BackColor = System::Drawing::Color::Silver; - this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->LinkColor = System::Drawing::Color::Gray; - this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); - this->myDataGrid->TabIndex = 0; - - // - // DataGridTableStyle_Sample - // - this->ClientSize = System::Drawing::Size( 384, 301 ); - array^formControls = {this->btnApplyStyles,this->myDataGrid}; - this->Controls->AddRange( formControls ); - this->Name = "DataGridTableStyle_Sample"; - this->Text = "DataGridTableStyle_Sample"; - this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ){} - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - // The dataMember specifies that the Customers table should be displayed. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // - // - // -private: - void AddCustomDataTableStyle() - { - myDataGridTableStyle1 = gcnew DataGridTableStyle; - - // EventHandlers - myDataGridTableStyle1->GridLineColorChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::GridLineColorChanged_Handler ); - myDataGridTableStyle1->MappingName = "Customers"; - - // Set other properties. - myDataGridTableStyle1->AlternatingBackColor = System::Drawing::Color::Gold; - myDataGridTableStyle1->BackColor = System::Drawing::Color::White; - myDataGridTableStyle1->GridLineStyle = System::Windows::Forms::DataGridLineStyle::Solid; - myDataGridTableStyle1->GridLineColor = Color::Red; - - // Set the HeaderText and Width properties. - DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; - myBoolCol->MappingName = "Current"; - myBoolCol->HeaderText = "IsCurrent Customer"; - myBoolCol->Width = 150; - myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); - - // Add a second column style. - DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; - myTextCol->MappingName = "custName"; - myTextCol->HeaderText = "Customer Name"; - myTextCol->Width = 250; - myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); - - // Create new ColumnStyle objects - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - - // Use a PropertyDescriptor to create a formatted column. - PropertyDescriptorCollection^ myPropertyDescriptorCollection = - BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); - - // Create a formatted column using a PropertyDescriptor. - DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - - // Add the DataGridTableStyle instances to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); - } - - void GridLineColorChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "GridLineColor Changed", "DataGridTableStyle" ); - } - // - // - // - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create Customer DataTables. - DataTable^ tCust = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create Customer order table. - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create three columns, and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the Customers table. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Gamma"; - - // Give the Current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - newRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - tOrders->Rows->Add( newRow2 ); - - } - } - } - - void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - AddCustomDataTableStyle(); - btnApplyStyles->Enabled = false; - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew DataGridTableStyle_Sample ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp deleted file mode 100644 index 60f1a720638..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Globalization; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataGrid^ myDataGrid; - - // -private: - void ChangeColumnCultureInfo() - { - /* Create a new CultureInfo Object* using the - the locale ID for Italy. */ - System::Globalization::CultureInfo^ ItalyCultureInfo = gcnew CultureInfo( 0x0410 ); - - /* Cast a column that holds numeric values to the - DataGridTextBoxColumn type, and set the FormatInfo - property to the new CultureInfo Object*. */ - DataGridTextBoxColumn^ myGridTextBoxColumn = - dynamic_cast(myDataGrid->TableStyles[ "Orders" ]-> - GridColumnStyles[ "OrderAmount" ]); - myGridTextBoxColumn->FormatInfo = ItalyCultureInfo; - myGridTextBoxColumn->Format = "c"; - } - // -}; - -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp deleted file mode 100644 index 5d0a522b8e2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp +++ /dev/null @@ -1,147 +0,0 @@ -// System::Windows::Forms::DataGridTextBoxColumn.DataGridTextBoxColumn(PropertyDescriptor*) -// System::Windows::Forms::DataGridTextBoxColumn.DataGridTextBoxColumn(PropertyDescriptor*, String*) - -/* -The following program demonstrates various constructors of -'DataGridTextBoxColumn' class. An instance of 'DataGrid' class is constructed and -it is associated with data source. When the button S"Change Appearance" is clicked, -the format of the Date column in the grid is modified to a specific format. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ myComponents; - Button^ myButton; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - -public: - MyForm() - { - // Required for Windows Form Designer support. - InitializeComponent(); - - // Call MyDataSource to bind the controls. - MyDataSource(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myComponents = gcnew System::ComponentModel::Container; - this->Text = "DataGrid Control Sample"; - this->myButton = gcnew Button; - myButton->Location = Point(24,16); - myButton->Size = System::Drawing::Size( 124, 30 ); - myButton->Text = "Change Appearance"; - myButton->Click += gcnew System::EventHandler( this, &MyForm::Button_Click ); - this->myDataGrid = gcnew DataGrid; - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 300, 200 ); - myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - } - - void MyDataSource() - { - // Create a DataSet with one table - CreateDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - -private: - void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MyAddCustomDataTableStyle(); - myButton->Enabled = false; - } - - // - // -private: - void MyAddCustomDataTableStyle() - { - // Get the currency manager for 'myDataSet'. - CurrencyManager^ myCurrencyManger = dynamic_cast(this->BindingContext[ myDataSet ]); - DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; - myTableStyle->MappingName = "Customers"; - PropertyDescriptor^ proprtyDescriptorName = myCurrencyManger->GetItemProperties()[ "CustName" ]; - DataGridColumnStyle^ myCustomerNameStyle = gcnew DataGridTextBoxColumn( proprtyDescriptorName ); - myCustomerNameStyle->MappingName = "custName"; - myCustomerNameStyle->HeaderText = "Customer Name"; - myTableStyle->GridColumnStyles->Add( myCustomerNameStyle ); - - // Add style for 'Date' column. - PropertyDescriptor^ myDateDescriptor = myCurrencyManger->GetItemProperties()[ "Date" ]; - - // 'G' is for MM/dd/yyyy HH:mm:ss date format. - DataGridColumnStyle^ myDateStyle = gcnew DataGridTextBoxColumn( myDateDescriptor,"G" ); - myDateStyle->MappingName = "Date"; - myDateStyle->HeaderText = "Date"; - myDateStyle->Width = 150; - myTableStyle->GridColumnStyles->Add( myDateStyle ); - - // Add DataGridTableStyle instances to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle ); - } - // - // - - void CreateDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create an instance of 'DataTable'. - DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the table. - DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); - DataColumn^ myDate = gcnew DataColumn( "Date",System::DateTime::typeid ); - myCustomerTable->Columns->Add( myCustomerName ); - myCustomerTable->Columns->Add( myDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( myCustomerTable ); - - // Create two customers in the Customers Table. - DataRow^ myNewRow; - for ( int i = 1; i < 3; i++ ) - { - myNewRow = myCustomerTable->NewRow(); - - // Add the row to the Customers table. - myCustomerTable->Rows->Add( myNewRow ); - } - - // Populate customer name column. - myCustomerTable->Rows[ 0 ][ "custName" ] = "Customer1"; - myCustomerTable->Rows[ 1 ][ "custName" ] = "Customer2"; - - // Populate date column. - myCustomerTable->Rows[ 0 ][ "Date" ] = System::DateTime::Now; - myCustomerTable->Rows[ 1 ][ "Date" ] = System::DateTime::Today; - } -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp deleted file mode 100644 index cdb53ba5f48..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// System::Windows::Forms::DataGridTextBox::IsInEditOrNavigateMode - -/* The following program demonstrates the 'IsInEditOrNavigateMode' -property of the 'System::Windows::Forms::DataGridTextBox' class. -It creates a form with 'DataGrid' that has a 'DataTable'. -A DataGridTextBox is shown which is bound to the DataSet that -contains the 'DataTable'. A button is used to display the state of -'IsInEditOrNavigateMode' property. Editing of the -'DataGridTextBox' changes the value of 'IsInEditOrNavigateMode' -from true to false. */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class MyDataGridTextBox: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGridTableStyle^ myDataGridTableStyle; - DataGridTextBoxColumn^ myTextBoxColumn; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ myButton; - DataGridTextBox^ myDataGridTextBox; - -public: - MyDataGridTextBox() - { - components = nullptr; - - // Create the form. - InitializeComponent(); - - // Bind the controls. - MakeDataSet(); - } - -public: - - // Clean up any resources being used. - ~MyDataGridTextBox() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myDataGridTableStyle = gcnew DataGridTableStyle; - this->myDataGridTextBox = gcnew DataGridTextBox; - this->myTextBoxColumn = gcnew DataGridTextBoxColumn; - this->myDataGrid = gcnew DataGrid; - this->myButton = gcnew Button; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGridTextBox"; - this->MaximizeBox = false; - myDataGridTextBox->Location = Point(20,5); - myDataGridTextBox->Size = System::Drawing::Size( 100, 65 ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myButton->Location = Point(71,250); - myButton->Size = System::Drawing::Size( 150, 40 ); - myButton->Text = " IsInEditOrNavigateMode"; - myButton->Click += gcnew EventHandler( this, &MyDataGridTextBox::Button_ClickEvent ); - this->Controls->Add( myDataGrid ); - this->Controls->Add( myDataGridTextBox ); - this->Controls->Add( myButton ); - - // Create 'DataTableStyle' for the DataGrid. - AddCustomDataTableStyle(); - - // Set the properties of DataGridTextBox. - myDataGridTextBox->ScrollBars = ScrollBars::Vertical; - myDataGridTextBox->ForeColor = Color::Red; - myDataGridTextBox->Multiline = true; - myDataGridTextBox->WordWrap = true; - } - - void AddCustomDataTableStyle() - { - // Map the DataGridTableStyle to the Table name. - myDataGridTableStyle->MappingName = "Person"; - - // Set other properties. - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; - - // Map the DataGridColumnStyle to the Column name of the Table. - TextCol->MappingName = "PersonName"; - TextCol->HeaderText = "Person Name"; - TextCol->Width = 100; - myDataGridTableStyle->GridColumnStyles->Add( TextCol ); - myDataGridTableStyle->GridLineColor = Color::Aquamarine; - - // Add the DataGridTableStyle to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - } - - // Create a DataSet with a table and populate it. - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ tPer = gcnew DataTable( "Person" ); - DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); - tPer->Columns->Add( cPerName ); - myDataSet->Tables->Add( tPer ); - DataRow^ newRow1; - for ( int i = 1; i < 6; i++ ) - { - newRow1 = tPer->NewRow(); - tPer->Rows->Add( newRow1 ); - } - tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; - tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; - tPer->Rows[ 2 ][ "PersonName" ] = "John"; - tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; - tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; - - // Bind the 'DataSet' to the 'DataGrid'. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - myDataGridTextBox->DataBindings->Add( "Text", myDataSet, "Person::PersonName" ); - - // Set the DataGrid to the DataGridTextBox. - myDataGridTextBox->SetDataGrid( myDataGrid ); - } - - // - // Handle event to show the state of 'IsInEditOrNavigateMode'. -private: - void Button_ClickEvent( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGridTextBox->IsInEditOrNavigateMode ) - { - // DataGridTextBox has not been edited. - MessageBox::Show( "Editing of DataGridTextBox not begun, IsInEditOrNavigateMode = True" ); - } - else - { - // DataGridTextBox has been edited. - MessageBox::Show( "Editing of DataGridTextBox begun, IsInEditOrNavigateMode = False" ); - } - } - // -}; - -// Main entry point for the application. -int main() -{ - Application::Run( gcnew MyDataGridTextBox ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp deleted file mode 100644 index b315be37428..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp +++ /dev/null @@ -1,149 +0,0 @@ -// System::Windows::Forms::DataGridTextBox::DataGridTextBox -// System::Windows::Forms::DataGridTextBox::SetDataGrid - -/* The following example demonstrates the constructor for -'DataGridTextBox' and 'SetDataGrid' method of the -'System::Windows::Forms::DataGridTextBox' class. It creates -a form with 'DataGrid' which has a 'DataTable' in it. A -DataGridTextBox is shown which is bound to the DataSet -that contains the 'DataTable'. The 'DataGridTextBox' shows -the contents of the cell which is currently having the focus. -Any changes in either the cell or the 'DataGridTextBox' are -accepted. */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class MyDataGridTextBox: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGridTableStyle^ myDataGridTableStyle; - DataGridTextBoxColumn^ myTextBoxColumn; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - DataGridTextBox^ myDataGridTextBox; - -public: - MyDataGridTextBox() - { - components = nullptr; - - // - // Constructor for DataGridTextBox. - myDataGridTextBox = gcnew DataGridTextBox; - // - - // Create the form. - InitializeComponent(); - - // Bind the controls. - MakeDataSet(); - } - - // Clean up any resources being used. -public: - ~MyDataGridTextBox() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myDataGridTableStyle = gcnew DataGridTableStyle; - this->myDataGridTextBox = gcnew DataGridTextBox; - this->myTextBoxColumn = gcnew DataGridTextBoxColumn; - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGridTextBox"; - this->MaximizeBox = false; - myDataGridTextBox->Location = Point(20,5); - myDataGridTextBox->Size = System::Drawing::Size( 100, 65 ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - this->Controls->Add( myDataGrid ); - this->Controls->Add( myDataGridTextBox ); - - // Create 'DataTableStyle' for the DataGrid. - AddCustomDataTableStyle(); - - // Set the properties of DataGridTextBox. - myDataGridTextBox->ScrollBars = ScrollBars::Vertical; - myDataGridTextBox->ForeColor = Color::Red; - myDataGridTextBox->Multiline = true; - myDataGridTextBox->WordWrap = true; - } - - void AddCustomDataTableStyle() - { - // Map the DataGridTableStyle to the Table name. - myDataGridTableStyle->MappingName = "Person"; - - // Set other properties. - myDataGridTableStyle->AlternatingBackColor = Color::LightGray; - DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; - - // Map the DataGridColumnStyle to the column name of the Table. - TextCol->MappingName = "PersonName"; - TextCol->HeaderText = "Person Name"; - TextCol->Width = 100; - myDataGridTableStyle->GridColumnStyles->Add( TextCol ); - myDataGridTableStyle->GridLineColor = Color::Aquamarine; - - // Add the DataGridTableStyle to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myDataGridTableStyle ); - } - - // - // Create a DataSet with a table and populate it. -private: - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ tPer = gcnew DataTable( "Person" ); - DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); - tPer->Columns->Add( cPerName ); - myDataSet->Tables->Add( tPer ); - DataRow^ newRow1; - for ( int i = 1; i < 6; i++ ) - { - newRow1 = tPer->NewRow(); - tPer->Rows->Add( newRow1 ); - } - tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; - tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; - tPer->Rows[ 2 ][ "PersonName" ] = "John"; - tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; - tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; - - // Bind the 'DataSet' to the 'DataGrid'. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - myDataGridTextBox->DataBindings->Add( "Text", myDataSet, "Person::PersonName" ); - - // Set the DataGrid to the DataGridTextBox. - myDataGridTextBox->SetDataGrid( myDataGrid ); - } - // -}; - -// Main entry point for the application. -int main() -{ - Application::Run( gcnew MyDataGridTextBox ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp deleted file mode 100644 index 5726cddc1ae..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// System::Windows::Forms::DataGrid::AllowNavigationChanged -// System::Windows::Forms::DataGrid::Navigate - -/* The following program demonstrates the 'AllowNavigationChanged' -and 'Navigate' events of 'System::Windows::Forms::DataGrid' class. -It creates a DataGrid onto a form. This Datagrid is linked -to two tables, Person (parent) table and Detail (child) table -which are related together by a 'DataRelation'. User can look -for the details of a person by navigating along. -The S"Toggle Navigation" button is used to set the -'AllowNavigation' property by toggling. When a property is set, -an event associated with it occurs and is confirmed by the -message shown by the alert message box. */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyDataGrid: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ myButton; - -public: - MyDataGrid() - { - components = nullptr; - - // Create form. - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -public: - - // Clean up any resources being used. - ~MyDataGrid() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myButton = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGrid Events"; - this->MaximizeBox = false; - myButton->Location = Point(85,15); - myButton->Size = System::Drawing::Size( 130, 40 ); - myButton->Text = "Toggle Navigation"; - myButton->Click += gcnew EventHandler( this, &MyDataGrid::myButton_Click ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 180 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->ReadOnly = true; - - // Call the methods that instantiate the Event Handlers. - CallAllowNavigationChanged(); - CallNavigate(); - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ tPer = gcnew DataTable( "Person" ); - DataTable^ tDet = gcnew DataTable( "Detail" ); - - // Create two columns, and add them to the Person table. - DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); - tPer->Columns->Add( cPerID ); - tPer->Columns->Add( cPerName ); - - // Create three columns, and add them to the Detail table. - DataColumn^ cDetID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cDetPh = gcnew DataColumn( "Phone" ); - tDet->Columns->Add( cDetID ); - tDet->Columns->Add( cDetPh ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tPer ); - myDataSet->Tables->Add( tDet ); - - // For each person create a DataRow variable. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "PersonDetail",cPerID,cDetID ); - myDataSet->Relations->Add( dr ); - - // Create five persons in the Person Table. - for ( int i = 1; i < 6; i++ ) - { - newRow1 = tPer->NewRow(); - newRow1[ "SSN" ] = i; - - // Add the row to the Person table. - tPer->Rows->Add( newRow1 ); - } - - // Give each person a distinct name. - tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; - tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; - tPer->Rows[ 2 ][ "PersonName" ] = "John"; - tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; - tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; - - // For each person, create a detail row in Detail table. - for ( int i = 0; i < 5; i++ ) - { - newRow2 = tDet->NewRow(); - newRow2[ "SSN" ] = tPer->Rows[ i ][ "SSN" ]; - newRow2[ "Phone" ] = 1000 + i; - - // Add the row to the 'Detail' table. - tDet->Rows->Add( newRow2 ); - } - } - - // -private: - // Create an instance of the 'AllowNavigationChanged' EventHandler. - void CallAllowNavigationChanged() - { - myDataGrid->AllowNavigationChanged += gcnew EventHandler( this, &MyDataGrid::Grid_AllowNavChange ); - } - - // Set the 'AllowNavigation' property on click of a button. -private: - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGrid->AllowNavigation ) - myDataGrid->AllowNavigation = false; - else - myDataGrid->AllowNavigation = true; - } - - // Raise the event when 'AllowNavigation' property is changed. -private: - void Grid_AllowNavChange( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ myString = "AllowNavigationChanged event raised, Navigation "; - bool myBool = myDataGrid->AllowNavigation; - - // Create appropriate alert message. - myString = String::Concat( myString, myBool ? (String^)" is " : " is not ", "allowed" ); - - // Show information about navigation. - MessageBox::Show( myString, "Navigation information" ); - } - // - - // - // Instantiate the 'Navigate' NavigateEventHandler. -private: - void CallNavigate() - { - myDataGrid->Navigate += gcnew NavigateEventHandler( this, &MyDataGrid::Grid_Navigate ); - } - - // Raise the event when navigating to another table. -private: - void Grid_Navigate( Object^ /*sender*/, NavigateEventArgs^ /*e*/ ) - { - // String variable used to show message. - String^ myString = "Navigate event raised, moved to another table"; - - // Show the message when navigating to another table. - MessageBox::Show( myString, "Table navigation information" ); - } - // -}; - -// Main entry point for the application. -int main() -{ - Application::Run( gcnew MyDataGrid ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp deleted file mode 100644 index b442982bfed..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// System.Windows.Forms.DataGrid.BackButtonClick -// System.Windows.Forms.DataGrid.BackgroundColorChanged - -/* The following program demonstrates the 'BackButtonClick' -and 'BackgroundColorChanged' events of -'System.Windows.Forms.DataGrid' class. It creates a DataGrid -onto a form. This Datagrid is linked to two tables, -Person (parent) table and Detail (child) table which are related -together by a 'DataRelation'. User can look for the details of a -person by navigating along. The "Toggle Background Color" button -is used to set the 'BackgroundColor' property by toggling -the color. The BackButton can be clicked when user is in the -child table. When a property is set, an event associated with it -is raised which is confirmed by the message shown by the -alert message box. */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyDataGrid: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ myButton; - -public: - MyDataGrid() - { - // Create the form. - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -public: - - // Clean up any resources being used. - ~MyDataGrid() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myButton = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGrid Events"; - this->MaximizeBox = false; - myButton->Location = Point(85,15); - myButton->Size = System::Drawing::Size( 130, 40 ); - myButton->Text = "Toggle Background Color"; - myButton->Click += gcnew EventHandler( this, &MyDataGrid::myButton_Click ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->BackgroundColor = Color::Yellow; - myDataGrid->ReadOnly = true; - - // Call the methods that instantiate the Event Handlers. - CallBackButtonClick(); - CallBackgroundColorChanged(); - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ tPer = gcnew DataTable( "Person" ); - DataTable^ tDet = gcnew DataTable( "Detail" ); - - // Create two columns, and add them to the Person table. - DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); - tPer->Columns->Add( cPerID ); - tPer->Columns->Add( cPerName ); - - // Create three columns, and add them to the Detail table. - DataColumn^ cDetID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cDetPh = gcnew DataColumn( "Phone" ); - tDet->Columns->Add( cDetID ); - tDet->Columns->Add( cDetPh ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tPer ); - myDataSet->Tables->Add( tDet ); - - // For each person create a DataRow variable. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "PersonDetail",cPerID,cDetID ); - myDataSet->Relations->Add( dr ); - - // Create five persons in the Person Table. - for ( int i = 1; i < 6; i++ ) - { - newRow1 = tPer->NewRow(); - newRow1[ "SSN" ] = i; - - // Add the row to the Person table. - tPer->Rows->Add( newRow1 ); - } - - // Give each person a distinct name. - tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; - tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; - tPer->Rows[ 2 ][ "PersonName" ] = "John"; - tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; - tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; - - // For each person, create a detail row in Detail table. - for ( int i = 0; i < 5; i++ ) - { - newRow2 = tDet->NewRow(); - newRow2[ "SSN" ] = tPer->Rows[ i ][ "SSN" ]; - newRow2[ "Phone" ] = 1000 + i; - - // Add the row to the 'Detail' table. - tDet->Rows->Add( newRow2 ); - } - } - - // - // Create an instance of the 'BackButtonClick' EventHandler. -private: - void CallBackButtonClick() - { - myDataGrid->BackButtonClick += gcnew EventHandler( this, &MyDataGrid::Grid_BackClick ); - } - - // Raise the event when 'BackButton' on child table is clicked. - void Grid_BackClick( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // String variable used to show message. - String^ myString = "BackButtonClick event raised, showing parent table"; - - // Show information about Back button. - MessageBox::Show( myString, "Back button information" ); - } - // - - // - // Create an instance of the 'BackgroundColorChanged' EventHandler. -private: - void CallBackgroundColorChanged() - { - myDataGrid->BackgroundColorChanged += gcnew EventHandler( this, &MyDataGrid::Grid_ColChange ); - } - - // Set the 'BackgroundColor' property on click of button. - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGrid->BackgroundColor == Color::Yellow ) - { - myDataGrid->BackgroundColor = Color::Red; - } - else - { - myDataGrid->BackgroundColor = Color::Yellow; - } - } - - // Raise the event when 'Background' color of DataGrid changes. - void Grid_ColChange( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // String variable used to show message. - String^ myString = "BackgroundColorChanged event raised, changed to "; - - // Get the background color of DataGrid. - Color myColor = myDataGrid->BackgroundColor; - myString = String::Concat( myString, myColor ); - - // Show information about background color setting. - MessageBox::Show( myString, "Background color information" ); - } - // -}; - -// Main entry point for the application. -int main() -{ - Application::Run( gcnew MyDataGrid ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp deleted file mode 100644 index 6c49a0581e4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp +++ /dev/null @@ -1,244 +0,0 @@ -// System::Windows::Forms::DataGrid::CaptionVisibleChanged -// System::Windows::Forms::DataGrid::CurrentCellChanged -// System::Windows::Forms::DataGrid::Scroll - -/* The following program demonstrates the 'CaptionVisibleChanged', -'CurrentCellChanged' and 'Scroll' events of -'System::Windows::Forms::DataGrid' class. It creates a DataGrid -onto a form. This Datagrid is linked to two tables, -Person (parent) table and Detail (child) table which are related -together by a 'DataRelation'. User can look for the details of a -person by navigating along. The "Toggle Caption" button is used -to set the 'CaptionVisible' property by toggling. When a property -is set, an event associated with it is raised which is confirmed -by the message shown by the alert message box. */ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyDataGrid: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ myButton; - -public: - MyDataGrid() - { - components = nullptr; - - // Create form. - InitializeComponent(); - - // Call SetUp to bind the controls. - SetUp(); - } - -public: - - // Clean up any resources being used. - ~MyDataGrid() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myButton = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGrid Events"; - this->MaximizeBox = false; - myButton->Location = Point(85,15); - myButton->Size = System::Drawing::Size( 130, 40 ); - myButton->Text = "Toggle Caption"; - myButton->Click += gcnew EventHandler( this, &MyDataGrid::myButton_Click ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->ReadOnly = true; - - // Call the methods that instantiate the Event Handlers. - CallCaptionVisibleChanged(); - CallCurrentCellChanged(); - CallScroll(); - this->Controls->Add( myButton ); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ tPer = gcnew DataTable( "Person" ); - DataTable^ tDet = gcnew DataTable( "Detail" ); - - // Create two columns, and add them to the Person table. - DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); - tPer->Columns->Add( cPerID ); - tPer->Columns->Add( cPerName ); - - // Create three columns, and add them to the Detail table. - DataColumn^ cDetID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ cDetPh = gcnew DataColumn( "Phone" ); - tDet->Columns->Add( cDetID ); - tDet->Columns->Add( cDetPh ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( tPer ); - myDataSet->Tables->Add( tDet ); - - // For each person create a DataRow variable. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ dr = gcnew DataRelation( "PersonDetail",cPerID,cDetID ); - myDataSet->Relations->Add( dr ); - - // Create nine persons in the 'Person' Table. - for ( int i = 1; i < 10; i++ ) - { - newRow1 = tPer->NewRow(); - newRow1[ "SSN" ] = i; - - // Add the row to the 'Person' table. - tPer->Rows->Add( newRow1 ); - } - - // Give each person a distinct name. - tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; - tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; - tPer->Rows[ 2 ][ "PersonName" ] = "John"; - tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; - tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; - tPer->Rows[ 5 ][ "PersonName" ] = "Wilson"; - tPer->Rows[ 6 ][ "PersonName" ] = "Donald"; - tPer->Rows[ 7 ][ "PersonName" ] = "Bill"; - tPer->Rows[ 8 ][ "PersonName" ] = "James"; - - // For each person, create a detail row in 'Detail' table. - for ( int i = 0; i < 9; i++ ) - { - newRow2 = tDet->NewRow(); - newRow2[ "SSN" ] = tPer->Rows[ i ][ "SSN" ]; - newRow2[ "Phone" ] = 1000 + i; - - // Add the row to the 'Detail' table. - tDet->Rows->Add( newRow2 ); - } - } - - // - // Create an instance of the 'CaptionVisibleChanged' EventHandler. -private: - void CallCaptionVisibleChanged() - { - myDataGrid->CaptionVisibleChanged += gcnew EventHandler( this, &MyDataGrid::Grid_CaptionVisibleChanged ); - } - - // Set the 'CaptionVisible' property on click of a button. - void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if (myDataGrid->CaptionVisible) - myDataGrid->CaptionVisible = false; - else - myDataGrid->CaptionVisible = true; - } - - // Raise the event when 'CaptionVisible' property is changed. - void Grid_CaptionVisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // String variable used to show message. - String^ myString = "CaptionVisibleChanged event raised, caption is"; - - // Get the state of 'CaptionVisible' property. - bool myBool = myDataGrid->CaptionVisible; - - // Create appropriate alert message. - myString = String::Concat( myString, myBool ? (String^)" " : " not ", "visible" ); - - // Show information about caption of DataGrid. - MessageBox::Show( myString, "Caption information" ); - } - // - - // - // Create an instance of the 'CurrentCellChanged' EventHandler. -private: - void CallCurrentCellChanged() - { - myDataGrid->CurrentCellChanged += gcnew EventHandler( this, &MyDataGrid::Grid_CurCellChange ); - } - - // Raise the event when focus on DataGrid cell changes. - void Grid_CurCellChange( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // String variable used to show message. - String^ myString = "CurrentCellChanged event raised, cell focus is at "; - - // Get the co-ordinates of the focussed cell. - String^ myPoint = String::Concat( myDataGrid->CurrentCell.ColumnNumber, ", ", myDataGrid->CurrentCell.RowNumber ); - - // Create the alert message. - myString = String::Concat( myString, "(", myPoint, ")" ); - - // Show Co-ordinates when CurrentCellChanged event is raised. - MessageBox::Show( myString, "Current cell co-ordinates" ); - } - // - - // - // Create an instance of the 'Scroll' EventHandler. -private: - void CallScroll() - { - myDataGrid->Scroll += gcnew EventHandler( this, &MyDataGrid::Grid_Scroll ); - } - - // Raise the event when DataGrid is scrolled. - void Grid_Scroll( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // String variable used to show message. - String^ myString = "Scroll event raised, DataGrid is scrolled"; - - // Show the message when scrolling is done. - MessageBox::Show( myString, "Scroll information" ); - } - // -}; - -// Main entry point for the application. -int main() -{ - Application::Run( gcnew MyDataGrid ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp deleted file mode 100644 index 2349ba3288f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp +++ /dev/null @@ -1,731 +0,0 @@ -// System::Windows::Forms::DataGrid.SelectionBackColor -// System::Windows::Forms::DataGrid.SelectionForeColor -// System::Windows::Forms::DataGrid.ResetSelectionBackColor -// System::Windows::Forms::DataGrid.ResetSelectionForeColor -// System::Windows::Forms::DataGrid.ResetBackColor -// System::Windows::Forms::DataGrid.ResetForeColor -// System::Windows::Forms::DataGrid.ForeColor -// System::Windows::Forms::DataGrid.ResetAlternatingBackColor -// System::Windows::Forms::DataGrid.ResetLinkColor -// System::Windows::Forms::DataGrid.ResetGridLineColor - -/* The following program demonstrates various members of -'System::Windows::Forms::DataGrid class' relating to Color. -It creates a windows form, a 'DataSet' containing two 'DataTable' -objects, and a 'DataRelation' that relates the two tables. To -display the data, a 'DataGrid' control is then bound to the -'DataSet' through the 'SetDataBinding' method. -Ten buttons are provided on form to demonstrate each property. -Effet of each property can be seen on 'DataGrid'. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace DataGridSample -{ - /// - /// Summary description for DatGridClass. - /// - public ref class DatGridClass: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::GroupBox^ groupBox1; - System::Windows::Forms::GroupBox^ groupBox2; - DataSet^ myDataSet; - System::Windows::Forms::DataGrid^ myDataGrid; - System::Windows::Forms::Button^ btnResetSelectionBkColor; - System::Windows::Forms::Button^ btnSeSelectiontBkColor; - System::Windows::Forms::Button^ btnSetSelectionForeColor; - System::Windows::Forms::Button^ btnResetSelectionForeColor; - System::Windows::Forms::Button^ btnSetForeColor; - System::Windows::Forms::Button^ btnResetForeColor; - System::Windows::Forms::Button^ btnSetBkColor; - System::Windows::Forms::Button^ btnResetBkColor; - System::Windows::Forms::GroupBox^ groupBox3; - System::Windows::Forms::Button^ btnResetLinkColor; - System::Windows::Forms::Button^ btnResetAlternatingBackColor; - System::Windows::Forms::Button^ btnSetLinkColor; - System::Windows::Forms::Button^ btnSetAlternatingBkColor; - System::Windows::Forms::GroupBox^ groupBox4; - System::Windows::Forms::Button^ btnResetGridLineColor; - System::Windows::Forms::Button^ btnSetGridLineColor; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - DatGridClass() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // Setup GridControl data. - SetUp(); - } - - public: - - /// - /// Clean up any resources being used. - /// - ~DatGridClass() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->btnResetBkColor = gcnew Button; - this->btnSetBkColor = gcnew Button; - this->btnResetForeColor = gcnew Button; - this->groupBox1 = gcnew GroupBox; - this->btnSeSelectiontBkColor = gcnew Button; - this->btnResetSelectionBkColor = gcnew Button; - this->btnSetSelectionForeColor = gcnew Button; - this->btnResetSelectionForeColor = gcnew Button; - this->groupBox2 = gcnew GroupBox; - this->btnSetForeColor = gcnew Button; - this->groupBox3 = gcnew GroupBox; - this->btnSetAlternatingBkColor = gcnew Button; - this->btnSetLinkColor = gcnew Button; - this->btnResetAlternatingBackColor = gcnew Button; - this->btnResetLinkColor = gcnew Button; - this->groupBox4 = gcnew GroupBox; - this->btnSetGridLineColor = gcnew Button; - this->btnResetGridLineColor = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->groupBox1->SuspendLayout(); - this->groupBox2->SuspendLayout(); - this->groupBox3->SuspendLayout(); - this->groupBox4->SuspendLayout(); - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // btnResetBkColor - // - this->btnResetBkColor->Location = System::Drawing::Point( 120, 56 ); - this->btnResetBkColor->Name = "btnResetBkColor"; - this->btnResetBkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnResetBkColor->TabIndex = 3; - this->btnResetBkColor->Text = "Reset background color"; - this->btnResetBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetBkColor_Click ); - - // - // btnSetBkColor - // - this->btnSetBkColor->Location = System::Drawing::Point( 120, 24 ); - this->btnSetBkColor->Name = "btnSetBkColor"; - this->btnSetBkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnSetBkColor->TabIndex = 2; - this->btnSetBkColor->Text = "Set background color"; - this->btnSetBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetBkColor_Click ); - - // - // btnResetForeColor - // - this->btnResetForeColor->Location = System::Drawing::Point( 16, 56 ); - this->btnResetForeColor->Name = "btnResetForeColor"; - this->btnResetForeColor->Size = System::Drawing::Size( 104, 32 ); - this->btnResetForeColor->TabIndex = 1; - this->btnResetForeColor->Text = "Reset foreground color"; - this->btnResetForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetForeColor_Click ); - - // - // groupBox1 - // - array^groupBox1Controls = {this->btnSeSelectiontBkColor,this->btnResetSelectionBkColor,this->btnSetSelectionForeColor,this->btnResetSelectionForeColor}; - this->groupBox1->Controls->AddRange( groupBox1Controls ); - this->groupBox1->Location = System::Drawing::Point( 296, 24 ); - this->groupBox1->Name = "groupBox1"; - this->groupBox1->Size = System::Drawing::Size( 248, 96 ); - this->groupBox1->TabIndex = 4; - this->groupBox1->TabStop = false; - - // - // btnSeSelectiontBkColor - // - this->btnSeSelectiontBkColor->Location = System::Drawing::Point( 125, 24 ); - this->btnSeSelectiontBkColor->Name = "btnSeSelectiontBkColor"; - this->btnSeSelectiontBkColor->Size = System::Drawing::Size( 112, 32 ); - this->btnSeSelectiontBkColor->TabIndex = 0; - this->btnSeSelectiontBkColor->Text = "Set selection background color"; - this->btnSeSelectiontBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetSelectionBkColor_Click ); - - // - // btnResetSelectionBkColor - // - this->btnResetSelectionBkColor->Location = System::Drawing::Point( 125, 56 ); - this->btnResetSelectionBkColor->Name = "btnResetSelectionBkColor"; - this->btnResetSelectionBkColor->Size = System::Drawing::Size( 112, 32 ); - this->btnResetSelectionBkColor->TabIndex = 1; - this->btnResetSelectionBkColor->Text = "Reset selection background color"; - this->btnResetSelectionBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetSelectionBkColor_Click ); - - // - // btnSetSelectionForeColor - // - this->btnSetSelectionForeColor->Location = System::Drawing::Point( 13, 24 ); - this->btnSetSelectionForeColor->Name = "btnSetSelectionForeColor"; - this->btnSetSelectionForeColor->Size = System::Drawing::Size( 112, 32 ); - this->btnSetSelectionForeColor->TabIndex = 2; - this->btnSetSelectionForeColor->Text = "Set selection foreground color"; - this->btnSetSelectionForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetSelectionForeColor_Click ); - - // - // btnResetSelectionForeColor - // - this->btnResetSelectionForeColor->Location = System::Drawing::Point( 13, 56 ); - this->btnResetSelectionForeColor->Name = "btnResetSelectionForeColor"; - this->btnResetSelectionForeColor->Size = System::Drawing::Size( 112, 32 ); - this->btnResetSelectionForeColor->TabIndex = 3; - this->btnResetSelectionForeColor->Text = "Reset selection foreground color"; - this->btnResetSelectionForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetSelectionForeColor_Click ); - - // - // groupBox2 - // - array^groupBox2Controls = {this->btnResetBkColor,this->btnSetBkColor,this->btnResetForeColor,this->btnSetForeColor}; - this->groupBox2->Controls->AddRange( groupBox2Controls ); - this->groupBox2->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - this->groupBox2->Location = System::Drawing::Point( 296, 128 ); - this->groupBox2->Name = "groupBox2"; - this->groupBox2->Size = System::Drawing::Size( 248, 96 ); - this->groupBox2->TabIndex = 5; - this->groupBox2->TabStop = false; - - // - // btnSetForeColor - // - this->btnSetForeColor->Location = System::Drawing::Point( 16, 24 ); - this->btnSetForeColor->Name = "btnSetForeColor"; - this->btnSetForeColor->Size = System::Drawing::Size( 104, 32 ); - this->btnSetForeColor->TabIndex = 0; - this->btnSetForeColor->Text = "Set foreground color"; - this->btnSetForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetForeColor_Click ); - - // - // groupBox3 - // - array^groupBox3Controls = {this->btnSetAlternatingBkColor,this->btnSetLinkColor,this->btnResetAlternatingBackColor,this->btnResetLinkColor}; - this->groupBox3->Controls->AddRange( groupBox3Controls ); - this->groupBox3->Location = System::Drawing::Point( 296, 224 ); - this->groupBox3->Name = "groupBox3"; - this->groupBox3->Size = System::Drawing::Size( 248, 96 ); - this->groupBox3->TabIndex = 7; - this->groupBox3->TabStop = false; - - // - // btnSetAlternatingBkColor - // - this->btnSetAlternatingBkColor->Location = System::Drawing::Point( 121, 24 ); - this->btnSetAlternatingBkColor->Name = "btnSetAlternatingBkColor"; - this->btnSetAlternatingBkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnSetAlternatingBkColor->TabIndex = 5; - this->btnSetAlternatingBkColor->Text = "Set alternating back color"; - this->btnSetAlternatingBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetAlternatingBkColor_Click ); - - // - // btnSetLinkColor - // - this->btnSetLinkColor->Location = System::Drawing::Point( 17, 24 ); - this->btnSetLinkColor->Name = "btnSetLinkColor"; - this->btnSetLinkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnSetLinkColor->TabIndex = 4; - this->btnSetLinkColor->Text = "Set link color"; - this->btnSetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetLinkColor_Click ); - - // - // btnResetAlternatingBackColor - // - this->btnResetAlternatingBackColor->Location = System::Drawing::Point( 121, 56 ); - this->btnResetAlternatingBackColor->Name = "btnResetAlternatingBackColor"; - this->btnResetAlternatingBackColor->Size = System::Drawing::Size( 104, 32 ); - this->btnResetAlternatingBackColor->TabIndex = 3; - this->btnResetAlternatingBackColor->Text = "Reset alternating back color"; - this->btnResetAlternatingBackColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetAlternatingBackColor_Click ); - - // - // btnResetLinkColor - // - this->btnResetLinkColor->Location = System::Drawing::Point( 17, 56 ); - this->btnResetLinkColor->Name = "btnResetLinkColor"; - this->btnResetLinkColor->Size = System::Drawing::Size( 104, 32 ); - this->btnResetLinkColor->TabIndex = 1; - this->btnResetLinkColor->Text = "Reset link color"; - this->btnResetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetLinkColor_Click ); - - // - // groupBox4 - // - array^groupBox4Controls = {this->btnSetGridLineColor,this->btnResetGridLineColor}; - this->groupBox4->Controls->AddRange( groupBox4Controls ); - this->groupBox4->Location = System::Drawing::Point( 164, 226 ); - this->groupBox4->Name = "groupBox4"; - this->groupBox4->Size = System::Drawing::Size( 124, 93 ); - this->groupBox4->TabIndex = 8; - this->groupBox4->TabStop = false; - - // - // btnSetGridLineColor - // - this->btnSetGridLineColor->Location = System::Drawing::Point( 8, 16 ); - this->btnSetGridLineColor->Name = "btnSetGridLineColor"; - this->btnSetGridLineColor->Size = System::Drawing::Size( 104, 32 ); - this->btnSetGridLineColor->TabIndex = 3; - this->btnSetGridLineColor->Text = "Set grid line color"; - this->btnSetGridLineColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetGridLineColor_Click ); - - // - // btnResetGridLineColor - // - this->btnResetGridLineColor->Location = System::Drawing::Point( 8, 48 ); - this->btnResetGridLineColor->Name = "btnResetGridLineColor"; - this->btnResetGridLineColor->Size = System::Drawing::Size( 104, 32 ); - this->btnResetGridLineColor->TabIndex = 0; - this->btnResetGridLineColor->Text = "Reset grid line color"; - this->btnResetGridLineColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetGridLineColor_Click ); - - // - // myDataGrid - // - this->myDataGrid->DataMember = ""; - this->myDataGrid->ForeColor = System::Drawing::Color::Blue; - this->myDataGrid->Location = System::Drawing::Point( 12, 32 ); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 272, 192 ); - this->myDataGrid->TabIndex = 6; - this->myDataGrid->ReadOnly = true; - - // - // DatGridClass - // - this->ClientSize = System::Drawing::Size( 560, 333 ); - array^dataGridClassControls = {this->groupBox4,this->groupBox3,this->myDataGrid,this->groupBox2,this->groupBox1}; - this->Controls->AddRange( dataGridClassControls ); - this->Name = "DatGridClass"; - this->Text = "Sample Program"; - this->groupBox1->ResumeLayout( false ); - this->groupBox2->ResumeLayout( false ); - this->groupBox3->ResumeLayout( false ); - this->groupBox4->ResumeLayout( false ); - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void SetUp() - { - // Create a 'DataSet' with two tables and one relation. - MakeDataSet(); - - // Bind the 'DataGrid' to the 'DataSet'. The data member - // specifies that the 'Customers Table' should be displayed. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // Create a 'DataSet' with two tables and populate it. - void MakeDataSet() - { - // Create a 'DataSet'. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create two 'DataTables'. - DataTable^ tCust = gcnew DataTable( "Customers" ); - DataTable^ tOrders = gcnew DataTable( "Orders" ); - - // Create two columns, and add them to the first table. - DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cCustName = gcnew DataColumn( "CustName" ); - DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); - tCust->Columns->Add( cCustID ); - tCust->Columns->Add( cCustName ); - tCust->Columns->Add( cCurrent ); - - // Create three columns and add them to the second table. - DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ cOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); - DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",String::typeid ); - tOrders->Columns->Add( cID ); - tOrders->Columns->Add( cOrderAmount ); - tOrders->Columns->Add( cOrderDate ); - - // Add the tables to the 'DataSet'. - myDataSet->Tables->Add( tCust ); - myDataSet->Tables->Add( tOrders ); - - // Create a 'DataRelation' and add it to the 'DataSet'. - DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); - myDataSet->Relations->Add( dr ); - - // Populate the tables. For each customer and order, - // create need two 'DataRow' variables. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the 'Customers Table'. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = tCust->NewRow(); - newRow1[ "custID" ] = i; - - // Add the row to the 'Customers Table'. - tCust->Rows->Add( newRow1 ); - } - tCust->Rows[ 0 ][ "custName" ] = "Alpha"; - tCust->Rows[ 1 ][ "custName" ] = "Beta"; - tCust->Rows[ 2 ][ "custName" ] = "Omega"; - - // Give the current column a value. - tCust->Rows[ 0 ][ "Current" ] = true.ToString(); - tCust->Rows[ 1 ][ "Current" ] = true.ToString(); - tCust->Rows[ 2 ][ "Current" ] = false.ToString(); - - // For each customer, create five rows in the orders table. - double myNumber = 0; - String^ myString; - for ( int i = 1; i < 4; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = tOrders->NewRow(); - newRow2[ "CustID" ] = i; - newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); - myNumber = i * 10 + j * .1; - myString = "$ "; - myString = String::Concat( myString, myNumber ); - newRow2[ "OrderAmount" ] = myString; - - // Add the row to the orders table. - tOrders->Rows->Add( newRow2 ); - } - } - } - - void btnSetSelectionBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Keep the user from selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color select to the current color. - myColorDialog->Color = myDataGrid->SelectionBackColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set selection background color to selected color. - myDataGrid->SelectionBackColor = myColorDialog->Color; - // - } - - void btnResetSelectionBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Selection backgound color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->SelectionBackColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset selection background color to default. - myDataGrid->ResetSelectionBackColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->SelectionBackColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Selection background color information" ); - // - } - - void btnSetSelectionForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Enable the help button. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->SelectionForeColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set selection foreground color to selected color. - myDataGrid->SelectionForeColor = myColorDialog->Color; - // - } - - void btnResetSelectionForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Selection foreground color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->SelectionForeColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset selection foreground color to default. - myDataGrid->ResetSelectionForeColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->SelectionForeColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Selection foreground color information" ); - // - } - - void btnSetForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Enable the help button. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->ForeColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set foreground color to selected color. - myDataGrid->ForeColor = myColorDialog->Color; - // - } - - void btnResetForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Foreground color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->ForeColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset foreground color to default. - myDataGrid->ResetForeColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->ForeColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Foreground color information" ); - // - } - - void btnSetBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->BackColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set background color to selected color. - myDataGrid->BackColor = myColorDialog->Color; - } - - void btnResetBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Backgound color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->BackColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset background color to default. - myDataGrid->ResetBackColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->BackColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Background color information" ); - // - } - - void btnResetGridLineColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Grid line color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->GridLineColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset grid line color to default. - myDataGrid->ResetGridLineColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->GridLineColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Grid line color information" ); - // - } - - void btnResetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Link color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->LinkColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset link color to default. - myDataGrid->ResetLinkColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->LinkColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Link line color information" ); - // - } - - void btnResetAlternatingBackColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // String variable used to show message. - String^ myString = "Alternating back color changed from: "; - - // Store current foreground color of selected cells. - Color myCurrentColor = myDataGrid->AlternatingBackColor; - myString = String::Concat( myString, myCurrentColor.ToString() ); - - // Reset alternating back color to default. - myDataGrid->ResetAlternatingBackColor(); - myString = String::Concat( myString, " to " ); - myString = String::Concat( myString, myDataGrid->AlternatingBackColor.ToString() ); - - // Show information about changes in color setting. - MessageBox::Show( myString, "Alternating back color information" ); - // - } - - void btnSetGridLineColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->GridLineColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set grid line color to selected color. - myDataGrid->GridLineColor = myColorDialog->Color; - } - - void btnSetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->LinkColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set link color to selected color. - myDataGrid->LinkColor = myColorDialog->Color; - } - - void btnSetAlternatingBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Creates a common color dialog box. - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Allow the user to get help. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->AlternatingBackColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set alternating background color to selected color. - myDataGrid->AlternatingBackColor = myColorDialog->Color; - } - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -void main() -{ - Application::Run( gcnew DataGridSample::DatGridClass ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp deleted file mode 100644 index d9bfd97285c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp +++ /dev/null @@ -1,197 +0,0 @@ -/* -System::Windows::Forms::DataGrid::ParentRowsLabelStyleChanged -System::Windows::Forms::DataGrid::ParentRowsVisibleChanged - -The following program demonstrates the 'ParentRowsLabelStyleChanged', and -'ParentRowsVisibleChanged' events. It creates a DataGrid and -two DataTables, Person(parent) and Detail(child) which are related -together by a DataRelation, are linked to it. The S"Toggle LabelStyle" button -sets the 'ParentRowsLabelStyle' property and the S"Toggle Visible" button sets the -'ParentRowsVisible' property. When the events is raised a message will be displayed. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ toggleStyleButton; - Button^ toggleVisibleButton; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - SetUp(); - } - -public: - - // Clean up any resources being used. - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->toggleStyleButton = gcnew Button; - this->toggleVisibleButton = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGrid Events"; - this->MaximizeBox = false; - toggleStyleButton->Location = Point(70,15); - toggleStyleButton->Size = System::Drawing::Size( 130, 40 ); - toggleStyleButton->Text = "Toggle LabelStyle"; - toggleStyleButton->Click += gcnew EventHandler( this, &MyForm::ToggleStyle_Clicked ); - toggleVisibleButton->Location = Point(70,250); - toggleVisibleButton->Size = System::Drawing::Size( 130, 40 ); - toggleVisibleButton->Text = "Toggle Visible"; - toggleVisibleButton->Click += gcnew EventHandler( this, &MyForm::ToggleVisible_Clicked ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->ReadOnly = true; - - // Call the methods that instantiate the Event Handlers. - CallParentRowsLabelStyleChanged(); - CallParentRowsVisibleChanged(); - this->Controls->Add( toggleStyleButton ); - this->Controls->Add( toggleVisibleButton ); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ personTable = gcnew DataTable( "Person" ); - DataTable^ detailTable = gcnew DataTable( "Detail" ); - DataColumn^ personID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ personName = gcnew DataColumn( "PersonName" ); - personTable->Columns->Add( personID ); - personTable->Columns->Add( personName ); - DataColumn^ detailID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ detailPhone = gcnew DataColumn( "Phone" ); - detailTable->Columns->Add( detailID ); - detailTable->Columns->Add( detailPhone ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( personTable ); - myDataSet->Tables->Add( detailTable ); - DataRow^ newRow1; - DataRow^ newRow2; - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ myDataRelation = gcnew DataRelation( "PersonDetail",personID,detailID ); - myDataSet->Relations->Add( myDataRelation ); - for ( int i = 1; i < 4; i++ ) - { - newRow1 = personTable->NewRow(); - newRow1[ "SSN" ] = i; - personTable->Rows->Add( newRow1 ); - } - // Give each person a distinct name. - personTable->Rows[ 0 ][ "PersonName" ] = "Robert"; - personTable->Rows[ 1 ][ "PersonName" ] = "Michael"; - personTable->Rows[ 2 ][ "PersonName" ] = "John"; - - // For each person, create a detail row in 'Detail' table. - for ( int i = 0; i < 3; i++ ) - { - newRow2 = detailTable->NewRow(); - newRow2[ "SSN" ] = personTable->Rows[ i ][ "SSN" ]; - newRow2[ "Phone" ] = 1000 + i; - - // Add the row to the 'Detail' table. - detailTable->Rows->Add( newRow2 ); - } - } - - // -private: - void CallParentRowsLabelStyleChanged() - { - myDataGrid->ParentRowsLabelStyleChanged += gcnew EventHandler( this, &MyForm::DataGridParentRowsLabelStyleChanged_Clicked ); - } - - // Set the 'ParentRowsLabelStyle' property on click of a button. - void ToggleStyle_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGrid->ParentRowsLabelStyle.ToString()->Equals( "Both" ) ) - myDataGrid->ParentRowsLabelStyle = DataGridParentRowsLabelStyle::TableName; - else - myDataGrid->ParentRowsLabelStyle = DataGridParentRowsLabelStyle::Both; - } - - // raise the event when 'ParentRowsLabelStyle' property is changed. - void DataGridParentRowsLabelStyleChanged_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ myMessage = "ParentRowsLabelStyleChanged event raised, LabelStyle is : "; - - // Get the state of 'ParentRowsLabelStyle' property. - String^ myLabelStyle = myDataGrid->ParentRowsLabelStyle.ToString(); - myMessage = String::Concat( myMessage, myLabelStyle ); - MessageBox::Show( myMessage, "ParentRowsLabelStyle information" ); - } - // - - // -private: - void CallParentRowsVisibleChanged() - { - myDataGrid->ParentRowsVisibleChanged += gcnew EventHandler( this, &MyForm::DataGridParentRowsVisibleChanged_Clicked ); - } - - // Set the 'ParentRowsVisible' property on click of a button. - void ToggleVisible_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if (myDataGrid->ParentRowsVisible) - myDataGrid->ParentRowsVisible = false; - else - myDataGrid->ParentRowsVisible = true; - } - - // raise the event when 'ParentRowsVisible' property is changed. - void DataGridParentRowsVisibleChanged_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ myMessage = "ParentRowsVisibleChanged event raised, Parent row is : "; - bool visible = myDataGrid->ParentRowsVisible; - myMessage = String::Concat( myMessage, visible ? (String^)" " : " NOT ", "visible" ); - MessageBox::Show( myMessage, "ParentRowsVisible information" ); - } - // -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp deleted file mode 100644 index d959567cefc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* -System::Windows::Forms::DataGrid::ShowParentDetailsButtonClick - -The following program demonstrates the 'ShowParentDetailsButtonClick' -event of 'DataGrid' class. On the click of S"ParentDetailsButton" button in the -Datagrid, a message is displayed. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - SetUp(); - } - -public: - - // Clean up any resources being used. - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGrid Events"; - this->MaximizeBox = false; - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->ReadOnly = false; - - // Call the method that instantiate the Event Handlers. - CallShowParentDetailsButtonClick(); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create a DataSet with two tables and one relation. - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ personTable = gcnew DataTable( "Person" ); - DataTable^ detailTable = gcnew DataTable( "Detail" ); - - // Create two columns, and add them to the Person table. - DataColumn^ personID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ personName = gcnew DataColumn( "PersonName" ); - personTable->Columns->Add( personID ); - personTable->Columns->Add( personName ); - - // Create three columns, and add them to the Detail table. - DataColumn^ detailID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ detailPhone = gcnew DataColumn( "Phone" ); - detailTable->Columns->Add( detailID ); - detailTable->Columns->Add( detailPhone ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( personTable ); - myDataSet->Tables->Add( detailTable ); - - // For each person create a DataRow variable. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ myDataRelation = gcnew DataRelation( "PersonDetail",personID,detailID ); - myDataSet->Relations->Add( myDataRelation ); - - // Create persons in the 'Person' Table. - for ( int i = 1; i < 5; i++ ) - { - newRow1 = personTable->NewRow(); - newRow1[ "SSN" ] = i; - - // Add the row to the 'Person' table. - personTable->Rows->Add( newRow1 ); - - } - - // Give each person a distinct name. - personTable->Rows[ 0 ][ "PersonName" ] = "Robert"; - personTable->Rows[ 1 ][ "PersonName" ] = "Michael"; - personTable->Rows[ 2 ][ "PersonName" ] = "John"; - personTable->Rows[ 3 ][ "PersonName" ] = "Walter"; - - // For each person, create a detail row in 'Detail' table. - for ( int i = 0; i < 4; i++ ) - { - newRow2 = detailTable->NewRow(); - newRow2[ "SSN" ] = personTable->Rows[ i ][ "SSN" ]; - newRow2[ "Phone" ] = 1000 + i; - - // Add the row to the 'Detail' table. - detailTable->Rows->Add( newRow2 ); - - } - } - - // -private: - void CallShowParentDetailsButtonClick() - { - myDataGrid->ShowParentDetailsButtonClick += gcnew EventHandler( this, &MyForm::DataGridShowParentDetailsButtonClick_Clicked ); - } - - // raise the event when ParentDetailsButton is clicked. - void DataGridShowParentDetailsButtonClick_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ myMessage = "ShowParentDetailsButtonClick event raised"; - - // Show the message when event is raised. - MessageBox::Show( myMessage, "ShowParentDetailsButtonClick information" ); - } - // -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp deleted file mode 100644 index 534d7352340..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp +++ /dev/null @@ -1,145 +0,0 @@ -/* -System::Windows::Forms::DataGrid::UnSelect - -The following program demonstrates the 'UnSelect' method of 'DataGrid' class. -On clicking the S"Unselect Row" button, the selected row of -the Datagrid is unselected. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ unselectButton; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - SetUp(); - } - -public: - - // Clean up any resources being used. - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->unselectButton = gcnew Button; - this->myDataGrid = gcnew DataGrid; - this->ClientSize = System::Drawing::Size( 292, 300 ); - this->Name = "DataGridForm"; - this->Text = "Testing DataGrid Events"; - this->MaximizeBox = false; - unselectButton->Location = Point(70,15); - unselectButton->Size = System::Drawing::Size( 130, 40 ); - unselectButton->Text = "Unselect Row"; - unselectButton->Click += gcnew EventHandler( this, &MyForm::UnselectRow_Clicked ); - myDataGrid->Location = Point(20,70); - myDataGrid->Size = System::Drawing::Size( 250, 170 ); - myDataGrid->CaptionText = "MS DataGrid Control"; - myDataGrid->ReadOnly = true; - this->Controls->Add( unselectButton ); - this->Controls->Add( myDataGrid ); - } - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Person" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ personTable = gcnew DataTable( "Person" ); - DataTable^ detailTable = gcnew DataTable( "Detail" ); - - // Create two columns, and add them to the Person table. - DataColumn^ personID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ personName = gcnew DataColumn( "PersonName" ); - personTable->Columns->Add( personID ); - personTable->Columns->Add( personName ); - - // Create three columns, and add them to the Detail table. - DataColumn^ detailID = gcnew DataColumn( "SSN",int::typeid ); - DataColumn^ detailPhone = gcnew DataColumn( "Phone" ); - detailTable->Columns->Add( detailID ); - detailTable->Columns->Add( detailPhone ); - myDataSet->Tables->Add( personTable ); - myDataSet->Tables->Add( detailTable ); - - // For each person create a DataRow variable. - DataRow^ newRow1; - DataRow^ newRow2; - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ myDataRelation = gcnew DataRelation( "PersonDetail",personID,detailID ); - myDataSet->Relations->Add( myDataRelation ); - - // Create persons in the 'Person' Table. - for ( int i = 1; i < 4; i++ ) - { - newRow1 = personTable->NewRow(); - newRow1[ "SSN" ] = i; - - // Add the row to the 'Person' table. - personTable->Rows->Add( newRow1 ); - } - - // Give each person a distinct name. - personTable->Rows[ 0 ][ "PersonName" ] = "Robert"; - personTable->Rows[ 1 ][ "PersonName" ] = "Michael"; - personTable->Rows[ 2 ][ "PersonName" ] = "John"; - - // For each person, create a detail row in 'Detail' table. - for ( int i = 0; i < 3; i++ ) - { - newRow2 = detailTable->NewRow(); - newRow2[ "SSN" ] = personTable->Rows[ i ][ "SSN" ]; - newRow2[ "Phone" ] = 1000 + i; - - // Add the row to the 'Detail' table. - detailTable->Rows->Add( newRow2 ); - } - } - - // - // On Click of Button "Unselect Row" this event is raised. -private: - void UnselectRow_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Unselect the current row from the Datagrid - myDataGrid->UnSelect( myDataGrid->CurrentRowIndex ); - } - // -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp deleted file mode 100644 index 3300ea117e3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyClass: public Form -{ - // -public: - MyClass() - { - // Create a new DateTimePicker. - DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; - array^ myClassControls = {dateTimePicker1}; - Controls->AddRange( myClassControls ); - dateTimePicker1->CalendarFont = gcnew System::Drawing::Font( - "Courier New", 8.25F, FontStyle::Italic, GraphicsUnit::Point, ((Byte)(0)) ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyClass ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp deleted file mode 100644 index 77d21eed796..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyClass: public Form -{ - // -public: - MyClass() - { - DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; - array^ myClassControls = {dateTimePicker1}; - Controls->AddRange( myClassControls ); - dateTimePicker1->CalendarForeColor = Color::Aqua; - } - // -}; - -[STAThread] -void main() -{ - Application::Run( gcnew MyClass ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp deleted file mode 100644 index 218df451d69..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyClass: public Form -{ - // -public: - MyClass() - { - DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; - array^ myClassControls = {dateTimePicker1}; - Controls->AddRange( myClassControls ); - dateTimePicker1->CalendarMonthBackground = Color::Aqua; - } - // -}; - -[STAThread] -void main() -{ - Application::Run( gcnew MyClass ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp deleted file mode 100644 index 6dc36d77da5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyClass: public Form -{ - // -public: - MyClass() - { - // Create a new DateTimePicker - DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; - array^ myClassControls = {dateTimePicker1}; - Controls->AddRange( myClassControls ); - MessageBox::Show( dateTimePicker1->Value.ToString() ); - - dateTimePicker1->Value = DateTime::Now.AddDays( 1 ); - MessageBox::Show( dateTimePicker1->Value.ToString() ); - } - // -}; - -[STAThread] -void main() -{ - Application::Run( gcnew MyClass ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp deleted file mode 100644 index 19388a445c3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - RcDraw = Rectangle(0,0,0,0); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::Form1_MouseDown ); - this->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::Form1_MouseUp ); - this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); - } - - // -private: - Rectangle RcDraw; - void Form1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Determine the initial rectangle coordinates... - RcDraw.X = e->X; - RcDraw.Y = e->Y; - } - - void Form1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Determine the width and height of the rectangle... - if ( e->X < RcDraw.X ) - { - RcDraw.Width = RcDraw.X - e->X; - RcDraw.X = e->X; - } - else - { - RcDraw.Width = e->X - RcDraw.X; - } - - if ( e->Y < RcDraw.Y ) - { - RcDraw.Height = RcDraw.Y - e->Y; - RcDraw.Y = e->Y; - } - else - { - RcDraw.Height = e->Y - RcDraw.Y; - } - - // Force a repaint of the region occupied by the rectangle... - this->Invalidate( RcDraw ); - } - - void Form1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) - { - // Draw the rectangle... - float PenWidth = 5; - e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,PenWidth ), RcDraw ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp deleted file mode 100644 index c5aded8ae95..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Security::Permissions; - -public ref class ExampleComponent: public Component -{ -public: - ExampleComponent() - { - IDesignerHost^ designerhost1 = nullptr; - IDesignerHost^ designerhost2 = nullptr; - - // - // Create a DesignerCollection using a constructor - // that accepts an array of IDesignerHost objects with - // which to initialize the array. - array^temp0 = {designerhost1,designerhost2}; - DesignerCollection^ collection = gcnew DesignerCollection( temp0 ); - // - } - - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - void OutputDesignerCollectionInfo( DesignerCollection^ collection ) - { - - // - // Get the number of elements in the collection. - int count = collection->Count; - // - - // - // Access each IDesignerHost in the DesignerCollection using - // the collection's indexer property, and output the class name - // of the root component associated with each IDesignerHost. - for ( int i = 0; i < collection->Count; i++ ) - Console::WriteLine( collection[ i ]->RootComponentClassName ); - // - } -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp deleted file mode 100644 index 32c192263a6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class DesignerEventArgsExample - { - public: - DesignerEventArgsExample() - { - } - - // - // This example method creates a DesignerEventArgs using the specified designer host. - // Typically, this type of event args is created by the IDesignerEventService. - DesignerEventArgs^ CreateComponentEventArgs( IDesignerHost^ host ) - { - DesignerEventArgs^ args = gcnew DesignerEventArgs( host ); - - // The designer host of the created or disposed document: args.Component - - return args; - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp deleted file mode 100644 index 8923e3bd492..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class DesignerEventHandlerExample - { - private: - DesignerEventHandlerExample() - { - } - - // - public: - void LinkDesignerEvent( IDesignerEventService^ eventService ) - { - // Registers an event handler for the DesignerCreated and DesignerDisposed events. - eventService->DesignerCreated += gcnew DesignerEventHandler( - this, &DesignerEventHandlerExample::OnDesignerEvent ); - eventService->DesignerDisposed += gcnew DesignerEventHandler( - this, &DesignerEventHandlerExample::OnDesignerEvent ); - } - - private: - void OnDesignerEvent( Object^ sender, DesignerEventArgs^ e ) - { - // Displays designer event information on the console. - Console::WriteLine( "Name of the root component of the created or disposed designer: " + - e->Designer->RootComponentClassName ); - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp deleted file mode 100644 index e1c13af4455..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -namespace DesignerHostTest -{ - public ref class DesignerHostDesigner: public ComponentDesigner - { - public: - DesignerHostDesigner(){} - - virtual void DoDefaultAction() override - { - // - // Requests an IDesignerHost service from the design time environment using Component.Site.GetService() - IDesignerHost^ dh = static_cast(this->Component->Site->GetService( IDesignerHost::typeid )); - // - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp deleted file mode 100644 index 52f9b5a691a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Windows::Forms; - -namespace ExampleControl -{ - public ref class ExampleSerializer: public CodeDomSerializer - { - public: - ExampleSerializer(){} - - virtual Object^ Deserialize( IDesignerSerializationManager^ /*manager*/, Object^ /*codeObject*/ ) override - { - return nullptr; - } - - virtual Object^ Serialize( IDesignerSerializationManager^ /*manager*/, Object^ /*value*/ ) override - { - return nullptr; - } - }; - - // - [DesignerSerializerAttribute(ExampleSerializer::typeid,CodeDomSerializer::typeid)] - public ref class ExampleControl: public UserControl - { - public: - ExampleControl() - { - - } - }; - // -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp deleted file mode 100644 index 5a435721cde..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp +++ /dev/null @@ -1,196 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -/* -This sample demonstrates how to perform a series of actions in a designer -transaction, how to change values of properties of a component from a -designer, and how to complete transactions without being interrupted -by other activities. - -To run this sample, add this code to a class library project and compile. -Create a new Windows Forms project or load a form in the designer. Add a -reference to the class library that was compiled in the first step. -Right-click the Toolbox in design mode and click Customize Toolbox. -Browse to the class library that was compiled in the first step and -select OK until the DTComponent item appears in the Toolbox. Add an -instance of this component to the form. - -When the component is created and added to the component tray for your -design project, the Initialize method of the designer is called. -This method displays a message box informing you that designer transaction -event handlers will be registered unless you click Cancel. When you set -properties in the properties window, each change will be encapsulated in -a designer transaction, allowing the change to be undone later. - -When you right-click the component, the shortcut menu for the component -is displayed. The designer constructs this menu according to whether -designer transaction notifications are enabled, and offers the option -of enabling or disabling the notifications, depending on the current -mode. The shortcut menu also presents a Perform Example Transaction -item, which will set the values of the component's StringProperty and -CountProperty properties. You can undo the last designer transaction using -the Undo command provided by the Visual Studio development environment. -*/ - -private ref class DTDesigner: public ComponentDesigner -{ -private: - bool notification_mode; - int count; - void LinkDTNotifications( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( !notification_mode ) - { - IDesignerHost^ host = dynamic_cast(GetService( IDesignerHost::typeid )); - if ( host != nullptr ) - { - notification_mode = true; - host->TransactionOpened += gcnew EventHandler( this, &DTDesigner::OnDesignerTransactionOpened ); - host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler( this, &DTDesigner::OnDesignerTransactionClosed ); - } - } - } - - void UnlinkDTNotifications( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( notification_mode ) - { - IDesignerHost^ host = dynamic_cast(GetService( IDesignerHost::typeid )); - if ( host != nullptr ) - { - notification_mode = false; - host->TransactionOpened -= gcnew EventHandler( this, &DTDesigner::OnDesignerTransactionOpened ); - host->TransactionClosed -= gcnew DesignerTransactionCloseEventHandler( this, &DTDesigner::OnDesignerTransactionClosed ); - } - } - } - - void OnDesignerTransactionOpened( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - MessageBox::Show( "A Designer Transaction was started. (TransactionOpened)" ); - } - - void OnDesignerTransactionClosed( Object^ /*sender*/, DesignerTransactionCloseEventArgs^ /*e*/ ) - { - MessageBox::Show( "A Designer Transaction was completed. (TransactionClosed)" ); - } - - void DoTransaction( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IDesignerHost^ host = static_cast(GetService( IDesignerHost::typeid )); - DesignerTransaction^ t = host->CreateTransaction( "Change Text and Size" ); - - /* The code within the using statement is considered to be a single transaction. - When the user selects Undo, the system will undo everything executed in this code block. - */ - if ( notification_mode ) - MessageBox::Show( "Entering a Designer-Initiated Designer Transaction" ); - - // The .NET Framework automatically associates the TypeDescriptor with the correct component - PropertyDescriptor^ someText = TypeDescriptor::GetProperties( Component )[ "StringProperty" ]; - someText->SetValue( Component, "This text was set by the designer for this component." ); - PropertyDescriptor^ anInteger = TypeDescriptor::GetProperties( Component )[ "CountProperty" ]; - anInteger->SetValue( Component, count ); - count++; - - // Complete the designer transaction. - t->Commit(); - if ( notification_mode ) - MessageBox::Show( "Designer-Initiated Designer Transaction Completed" ); - } - -public: - property DesignerVerbCollection^ Verbs - { - // The Verbs property is overridden from ComponentDesigner - virtual DesignerVerbCollection^ get() override - { - DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; - dvc->Add( gcnew DesignerVerb( "Perform Example Transaction",gcnew EventHandler( this, &DTDesigner::DoTransaction ) ) ); - if ( notification_mode ) - dvc->Add( gcnew DesignerVerb( "End Designer Transaction Notifications", - gcnew EventHandler( this, &DTDesigner::UnlinkDTNotifications ) ) ); - else - dvc->Add( gcnew DesignerVerb( "Show Designer Transaction Notifications", - gcnew EventHandler( this, &DTDesigner::LinkDTNotifications ) ) ); - - return dvc; - } - } - virtual void Initialize( IComponent^ component ) override - { - ComponentDesigner::Initialize( component ); - notification_mode = false; - count = 10; - IDesignerHost^ host = dynamic_cast(GetService( IDesignerHost::typeid )); - if ( host == nullptr ) - { - MessageBox::Show( "The IDesignerHost service interface could not be obtained." ); - return; - } - - if ( MessageBox::Show( "Press the Yes button to display notification message boxes for the designer transaction opened and closed notifications.", "Link DesignerTransaction Notifications?", MessageBoxButtons::YesNo, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign ) == DialogResult::Yes ) - { - host->TransactionOpened += gcnew EventHandler( this, &DTDesigner::OnDesignerTransactionOpened ); - host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler( this, &DTDesigner::OnDesignerTransactionClosed ); - notification_mode = true; - } - } - -public: - ~DTDesigner() - { - UnlinkDTNotifications( this, gcnew EventArgs ); - } -}; - -// Associate the DTDesigner with this component - -[DesignerAttribute(DTDesigner::typeid)] -public ref class DTComponent: public System::ComponentModel::Component -{ -private: - String^ m_String; - int m_Count; - void InitializeComponent() - { - m_String = "Initial Value"; - m_Count = 0; - } - -public: - property String^ StringProperty - { - String^ get() - { - return m_String; - } - - void set( String^ value ) - { - m_String = value; - } - } - - property int CountProperty - { - int get() - { - return m_Count; - } - - void set( int value ) - { - m_Count = value; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp deleted file mode 100644 index 5044a5b8b2f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class DesignerTransactionCloseEventArgsExample - { - public: - DesignerTransactionCloseEventArgsExample() - { - } - - // - public: - // This example method creates a DesignerTransactionCloseEventArgs using the specified argument. - // Typically, this type of event args is created by a design mode subsystem. - DesignerTransactionCloseEventArgs^ CreateDesignerTransactionCloseEventArgs( bool commit ) - { - // Creates a component changed event args with the specified arguments. - DesignerTransactionCloseEventArgs^ args = gcnew DesignerTransactionCloseEventArgs( commit ); - - // Whether the transaction has been committed: args.TransactionCommitted - - return args; - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp deleted file mode 100644 index 7ce84caf594..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp +++ /dev/null @@ -1,42 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; - -namespace MiscCompModSamples -{ - public ref class DesignerTransactionCloseEventHandlerExample - { - private: - DesignerTransactionCloseEventHandlerExample() - { - } - - // - public: - void LinkDesignerTransactionCloseEvent( IDesignerHost^ host ) - { - // Registers an event handler for the designer TransactionClosing and TransactionClosed events. - host->TransactionClosing += gcnew DesignerTransactionCloseEventHandler( - this, &DesignerTransactionCloseEventHandlerExample::OnTransactionClose ); - host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler( - this, &DesignerTransactionCloseEventHandlerExample::OnTransactionClose ); - } - - private: - void OnTransactionClose( Object^ sender, DesignerTransactionCloseEventArgs^ e ) - { - // Displays transaction close information on the console. - if ( e->TransactionCommitted ) - { - Console::WriteLine( "Transaction has been committed." ); - } - else - { - Console::WriteLine( "Transaction has not yet been committed." ); - } - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp deleted file mode 100644 index 8ede6b8cfa2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -/* This sample demonstrates a designer that adds menu commands -to the design-time shortcut menu for a component. - -To test this sample, build the code for the component as a class library, -add the resulting component to the toolbox, open a form in design mode, -and drag the component from the toolbox onto the form. - -The component should appear in the component tray beneath the form. -Right-click the component. The verbs should appear in the shortcut menu. -*/ -// This is a designer class which provides designer verb menu commands for -// the associated component. This code is called by the design environment at design-time. -private ref class MyDesigner: public ComponentDesigner -{ -public: - - property DesignerVerbCollection^ Verbs - { - // DesignerVerbCollection is overridden from ComponentDesigner - virtual DesignerVerbCollection^ get() override - { - if ( m_Verbs == nullptr ) - { - // Create and initialize the collection of verbs - m_Verbs = gcnew DesignerVerbCollection; - m_Verbs->Add( gcnew DesignerVerb( "First Designer Verb",gcnew EventHandler( this, &MyDesigner::OnFirstItemSelected ) ) ); - m_Verbs->Add( gcnew DesignerVerb( "Second Designer Verb",gcnew EventHandler( this, &MyDesigner::OnSecondItemSelected ) ) ); - } - - return m_Verbs; - } - } - MyDesigner(){} - -private: - DesignerVerbCollection^ m_Verbs; - void OnFirstItemSelected( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - // Display a message - MessageBox::Show( "The first designer verb was invoked." ); - } - - void OnSecondItemSelected( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - // Display a message - MessageBox::Show( "The second designer verb was invoked." ); - } -}; - -// Associate MyDesigner with this component type using a DesignerAttribute -[Designer(MyDesigner::typeid)] -public ref class Component1: public System::ComponentModel::Component{}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp deleted file mode 100644 index b5680923ecf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel::Design; -using namespace System::Security::Permissions; - -namespace DesignerVerbCollectionExample -{ - public ref class Class1 - { - private: - void ExampleEvent( Object^ sender, EventArgs^ e ) - { - } - - public: - // DesignerVerbCollection - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - void DesignerVerbCollectionExample() - { - // - // - // Creates an empty DesignerVerbCollection. - DesignerVerbCollection^ collection = gcnew DesignerVerbCollection; - // - - // - // Adds a DesignerVerb to the collection. - collection->Add( gcnew DesignerVerb( "Example designer verb",gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); - // - - // - // Adds an array of DesignerVerb objects to the collection. - array^ verbs = { - gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ), - gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) )}; - collection->AddRange( verbs ); - - // Adds a collection of DesignerVerb objects to the collection. - DesignerVerbCollection^ verbsCollection = gcnew DesignerVerbCollection; - verbsCollection->Add( gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); - verbsCollection->Add( gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); - collection->AddRange( verbsCollection ); - // - - // - // Tests for the presence of a DesignerVerb in the collection, - // and retrieves its index if it is found. - DesignerVerb^ testVerb = gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ); - int itemIndex = -1; - if ( collection->Contains( testVerb ) ) - itemIndex = collection->IndexOf( testVerb ); - // - - // - // Copies the contents of the collection, beginning at index 0, - // to the specified DesignerVerb array. - // 'verbs' is a DesignerVerb array. - collection->CopyTo( verbs, 0 ); - // - - // - // Retrieves the count of the items in the collection. - int collectionCount = collection->Count; - // - - // - // Inserts a DesignerVerb at index 0 of the collection. - collection->Insert( 0, gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); - // - - // - // Removes the specified DesignerVerb from the collection. - DesignerVerb^ verb = gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ); - collection->Remove( verb ); - // - - // - // Removes the DesignerVerb at index 0. - collection->RemoveAt( 0 ); - // - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp deleted file mode 100644 index 64f86526df9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - Rectangle myTabRect; - -public: - Form1() - { - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; - tabControl1->Appearance = TabAppearance::Buttons; - tabControl1->Location = Point(25,25); - tabControl1->Controls->Add( tabPage1 ); - Controls->Add( tabControl1 ); - - // Gets a Rectangle that represents the tab page display area of tabControl1. - myTabRect = tabControl1->DisplayRectangle; - myTabRect.Inflate( 1, 1 ); - tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::DrawOnTabPage ); - } - - -private: - void DrawOnTabPage( Object^ /*sender*/, DrawItemEventArgs^ e ) - { - Graphics^ g = e->Graphics; - Pen^ p = gcnew Pen( Color::Blue ); - g->DrawRectangle( p, myTabRect ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp deleted file mode 100644 index c14974a24ed..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; - -namespace DlgOpenFileReadOnly_CS -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - protected: - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - OpenFile(); - } - - // - private: - FileStream^ OpenFile() - { - // Displays an OpenFileDialog and shows the read/only files. - OpenFileDialog^ dlgOpenFile = gcnew OpenFileDialog; - dlgOpenFile->ShowReadOnly = true; - if ( dlgOpenFile->ShowDialog() == ::DialogResult::OK ) - { - // If ReadOnlyChecked is true, uses the OpenFile method to - // open the file with read/only access. - if ( dlgOpenFile->ReadOnlyChecked ) - { - return dynamic_cast(dlgOpenFile->OpenFile()); - } - // Otherwise, opens the file with read/write access. - else - { - String^ path = dlgOpenFile->FileName; - return gcnew FileStream( path,System::IO::FileMode::Open,System::IO::FileAccess::ReadWrite ); - } - } - - return nullptr; - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew DlgOpenFileReadOnly_CS::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp b/snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp deleted file mode 100644 index 515da262025..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - Rectangle tabArea; - RectangleF tabTextArea; - -public: - Form1() - { - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - - // Allows access to the DrawItem event. - tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; - tabControl1->SizeMode = TabSizeMode::Fixed; - tabControl1->Controls->Add( tabPage1 ); - tabControl1->ItemSize = System::Drawing::Size( 80, 30 ); - tabControl1->Location = Point(25,25); - tabControl1->Size = System::Drawing::Size( 250, 250 ); - tabPage1->TabIndex = 0; - ClientSize = System::Drawing::Size( 300, 300 ); - Controls->Add( tabControl1 ); - tabArea = tabControl1->GetTabRect( 0 ); - tabTextArea = tabControl1->GetTabRect( 0 ); - - // Binds the event handler DrawOnTab to the DrawItem event - // through the DrawItemEventHandler delegate. - tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::DrawOnTab ); - } - - -private: - - // Declares the event handler DrawOnTab which is a method that - // draws a String* and Rectangle on the tabPage1 tab. - void DrawOnTab( Object^ /*sender*/, DrawItemEventArgs^ e ) - { - Graphics^ g = e->Graphics; - Pen^ p = gcnew Pen( Color::Blue ); - System::Drawing::Font^ font = gcnew System::Drawing::Font( "Arial",10.0f ); - SolidBrush^ brush = gcnew SolidBrush( Color::Red ); - g->DrawRectangle( p, tabArea ); - g->DrawString( "tabPage1", font, brush, tabTextArea ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp b/snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp deleted file mode 100644 index cf8e82d4e77..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - Rectangle myTabRect; - -public: - Form1() - { - tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - - // Sets the tabs to be drawn by the parent window Form1. - // OwnerDrawFixed allows access to DrawItem. - tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; - tabControl1->Controls->Add( tabPage1 ); - tabControl1->Location = Point(25,25); - tabControl1->Size = System::Drawing::Size( 250, 250 ); - tabPage1->TabIndex = 0; - myTabRect = tabControl1->GetTabRect( 0 ); - ClientSize = System::Drawing::Size( 300, 300 ); - Controls->Add( tabControl1 ); - tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::OnDrawItem ); - } - - -private: - void OnDrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) - { - Graphics^ g = e->Graphics; - Pen^ p = gcnew Pen( Color::Blue ); - g->DrawRectangle( p, myTabRect ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp deleted file mode 100644 index 304c370b671..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Web::UI::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -namespace EditorAttributeExamples -{ - public ref class Class1: public System::ComponentModel::Component - { - // System::ComponentModel::Design::CollectionEditor EditorAttribute example - // - public: - [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, - System::Drawing::Design::UITypeEditor::typeid)] - property ICollection^ testCollection - { - ICollection^ get() - { - return Icollection; - } - void set( ICollection^ value ) - { - Icollection = value; - } - } - private: - ICollection^ Icollection; - // - - // System::Drawing::Design::FontEditor EditorAttribute example - // - public: - [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, - System::Drawing::Design::UITypeEditor::typeid)] - property System::Drawing::Font^ testFont - { - System::Drawing::Font^ get() - { - return font; - } - void set( System::Drawing::Font^ value ) - { - font = value; - } - } - private: - Font^ font; - // - - // System::Drawing::Design::ImageEditor EditorAttribute example - // - public: - [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, - System::Drawing::Design::UITypeEditor::typeid)] - property Image^ testImage - { - Image^ get() - { - return testImg; - } - void set( Image^ value ) - { - testImg = value; - } - } - private: - Image^ testImg; - // - - // System::Windows::Forms::Design::AnchorEditor EditorAttribute example - // - public: - [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, - System::Drawing::Design::UITypeEditor::typeid)] - property System::Windows::Forms::AnchorStyles testAnchor - { - System::Windows::Forms::AnchorStyles get() - { - return anchor; - } - void set( System::Windows::Forms::AnchorStyles value ) - { - anchor = value; - } - } - private: - AnchorStyles anchor; - // - - // System::Windows::Forms::Design::FileNameEditor EditorAttribute example - // - public: - [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, - System::Drawing::Design::UITypeEditor::typeid)] - property String^ testFilename - { - String^ get() - { - return filename; - } - void set( String^ value ) - { - filename = value; - } - } - private: - String^ filename; - // - - public: - Class1() - { - // Initialize collections for design-mode editor testing. - array^ temp1 = { 0, 2, 4, 6, 8, 12, 14 }; - Icollection = (ICollection^)(temp1); - font = gcnew Font( "Arial", 8 ); - testAnchor = AnchorStyles::None; - filename = String::Empty; - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp b/snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp deleted file mode 100644 index 870ca730162..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -#using - -using namespace System; -using namespace System::ComponentModel; - -namespace EditorBrowsableDemo -{ - public ref class Class1 - { - public: - Class1() - { - // - // TODO: Add constructor logic here - // - } - - private: - int ageval; - - public: - [EditorBrowsable(EditorBrowsableState::Never)] - property int Age - { - int get() - { - return ageval; - } - - void set( int value ) - { - if ( ageval != value ) - { - ageval = value; - } - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp deleted file mode 100644 index 6ecf7397ac5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 8, 96 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 608, 160 ); - this->textBox1->TabIndex = 1; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 632, 273 ); - array^temp0 = {this->textBox1,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); - - // Displays each event's information in the collection in a text box. - for each (EventDescriptor^ myEvent in events) { - textBox1->Text += myEvent->Category + '\n'; - textBox1->Text += myEvent->Description + '\n'; - textBox1->Text += myEvent->DisplayName + '\n'; - } - // - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp deleted file mode 100644 index c12d415bf94..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp +++ /dev/null @@ -1,106 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Collections; -using namespace System::Drawing; -using namespace System::IO; -using namespace System::Reflection; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Binary; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -ref class TypeEventsTab; - -// This component adds a TypeEventsTab to the Properties Window. - -[PropertyTabAttribute(TypeEventsTab::typeid,PropertyTabScope::Document)] -public ref class TypeEventsTabComponent: public Component -{ -public: - TypeEventsTabComponent(){} - -}; - - -// This example events tab lists events by their delegate type. -[System::Security::Permissions::PermissionSetAttribute - (System::Security::Permissions::SecurityAction::InheritanceDemand, Name="FullTrust")] -[System::Security::Permissions::PermissionSetAttribute - (System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] -public ref class TypeEventsTab: public System::Windows::Forms::Design::EventsTab -{ -private: - - // This string contains a Base-64 encoded and serialized example - // property tab image. - - [BrowsableAttribute(true)] - String^ img; - IServiceProvider^ sp; - -public: - TypeEventsTab( IServiceProvider^ sp ) - : EventsTab( sp ) - { - this->sp = sp; - String^ s = "AAEAAAD/////AQAAAAAAAAAMAgAAA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" - "tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tn/Cw=="; - img = s; - } - - // Returns the properties of the specified component extended with a - // CategoryAttribute reflecting the name of the type of the property. - virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( ITypeDescriptorContext^ /*context*/, Object^ component, array^attributes ) override - { - // Obtain an instance of the IEventBindingService. - IEventBindingService^ eventPropertySvc = dynamic_cast(sp->GetService( IEventBindingService::typeid )); - - // Return if an IEventBindingService could not be obtained. - if ( eventPropertySvc == nullptr ) - return gcnew PropertyDescriptorCollection( nullptr ); - - // Obtain the events on the component. - EventDescriptorCollection^ events = TypeDescriptor::GetEvents( component, attributes ); - - // Create an array of the events, where each event is assigned - // a category matching its type. - array^newEvents = gcnew array(events->Count); - for ( int i = 0; i < events->Count; i++ ) - { - array^temp = {gcnew CategoryAttribute( events[ i ]->EventType->FullName )}; - newEvents[ i ] = TypeDescriptor::CreateEvent( events[ i ]->ComponentType, events[ i ], temp ); - } - events = gcnew EventDescriptorCollection( newEvents ); - - // Return event properties for the event descriptors. - return eventPropertySvc->GetEventProperties( events ); - } - - property String^ TabName - { - // Provides the name for the event property tab. - virtual String^ get() override - { - return "Events by Type"; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp deleted file mode 100644 index 38fae3fa420..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp +++ /dev/null @@ -1,72 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -namespace ExtenderListServiceExample -{ - // This control lists any active extender providers. - public ref class ExtenderListServiceControl: public UserControl - { - private: - IExtenderListService^ extenderListService; - array^extenderNames; - - public: - ExtenderListServiceControl() - { - this->Width = 600; - } - - property ISite^ Site - { - // Queries the IExtenderListService when the control is sited - // in design mode. - virtual ISite^ get() override - { - return __super::Site; - } - - virtual void set( ISite^ value ) override - { - __super::Site = value; - if ( this->DesignMode ) - { - extenderListService = dynamic_cast(this->GetService( IExtenderListService::typeid )); - if ( extenderListService != nullptr ) - { - array^extenders = extenderListService->GetExtenderProviders(); - extenderNames = gcnew array(extenders->Length); - for ( int i = 0; i < extenders->Length; i++ ) - extenderNames[ i ] = String::Concat( "ExtenderProvider #", i.ToString(), ": ", extenders[ i ]->GetType()->FullName ); - } - } - else - { - extenderListService = nullptr; - } - } - } - - protected: - - // Draws a list of any active extender providers - virtual void OnPaint( PaintEventArgs^ e ) override - { - if ( extenderNames->Length == 0 ) - e->Graphics->DrawString( "No active extender providers", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 10, 10 ); - else - e->Graphics->DrawString( "List of types of active extender providers", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 10, 10 ); - - for ( int i = 0; i < extenderNames->Length; i++ ) - e->Graphics->DrawString( extenderNames[ i ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 10, 25 + (i * 10) ); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp b/snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp deleted file mode 100644 index c9209e00143..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp +++ /dev/null @@ -1,101 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// IExtenderProviderImplementation that adds an integer property -// named "ExtenderIndex" to any design-mode document object. - -[ProvidePropertyAttribute("ExtenderIndex",IComponent::typeid)] -public ref class ComponentExtender: public IExtenderProvider -{ -public: - - // Stores the value of the property to extend a component with. - int index; - ComponentExtender() - { - index = 0; - } - - virtual bool CanExtend( Object^ /*extendee*/ ) - { - // Extends any type of object. - return true; - } - - int GetExtenderIndex( IComponent^ /*component*/ ) - { - return index; - } - - void SetExtenderIndex( IComponent^ /*component*/, int index ) - { - this->index = index; - } -}; - - -// This designer adds a ComponentExtender extender provider, -// and removes it when the designer is destroyed. -public ref class ExtenderServiceDesigner: public ControlDesigner -{ -private: - - // A local reference to an obtained IExtenderProviderService. - IExtenderProviderService^ localExtenderServiceReference; - - // An IExtenderProvider that this designer supplies. - ComponentExtender^ extender; - -public: - ExtenderServiceDesigner(){} - - virtual void Initialize( IComponent^ component ) override - { - ControlDesigner::Initialize( component ); - - // Attempts to obtain an IExtenderProviderService. - IExtenderProviderService^ extenderService = dynamic_cast(component->Site->GetService( IExtenderProviderService::typeid )); - if ( extenderService != nullptr ) - { - // If the service was obtained, adds a ComponentExtender - // that adds an "ExtenderIndex" integer property to the - // designer's component. - extender = gcnew ComponentExtender; - extenderService->AddExtenderProvider( extender ); - localExtenderServiceReference = extenderService; - } - else - MessageBox::Show( "Could not obtain an IExtenderProviderService." ); - } - - ~ExtenderServiceDesigner() - { - // Removes any previously added extender provider. - if ( localExtenderServiceReference != nullptr ) - { - localExtenderServiceReference->RemoveExtenderProvider( extender ); - localExtenderServiceReference = nullptr; - } - } -}; - -// Example UserControl associated with the ExtenderServiceDesigner. - -[DesignerAttribute(ExtenderServiceDesigner::typeid)] -public ref class ExtenderServiceTestControl: public UserControl -{ -public: - ExtenderServiceTestControl(){} -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp deleted file mode 100644 index 89d6e6e6bfd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace FontDialog_cs -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::FontDialog^ fontDialog1; - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->fontDialog1 = gcnew System::Windows::Forms::FontDialog; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 32, 8 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // fontDialog1 - // - this->fontDialog1->Apply += gcnew System::EventHandler( this, &Form1::fontDialog1_Apply ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 56, 72 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->TabIndex = 1; - this->richTextBox1->Text = "richTextBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {this->richTextBox1,this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Sets the ShowApply property, then displays the dialog. - fontDialog1->ShowApply = true; - fontDialog1->ShowDialog(); - } - - void fontDialog1_Apply( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Applies the selected font to the selected text. - richTextBox1->Font = fontDialog1->Font; - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew FontDialog_cs::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp deleted file mode 100644 index 9846c8076fb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 184, 64 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 176, 144 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 1; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button2,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowMyOwnedForm(); - } - - // -private: - void ShowMyOwnedForm() - { - // Create an instance of the form to be owned. - Form^ ownedForm = gcnew Form; - - // Set the text of the form to identify it is an owned form. - ownedForm->Text = "Owned Form"; - - // Add ownedForm to array of owned forms. - this->AddOwnedForm( ownedForm ); - - // Show the owned form. - ownedForm->Show(); - } - // - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Form^ frm = gcnew Form; - frm->Show(); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp deleted file mode 100644 index 4fb5a61f7a1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 56 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 336, 294 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DisplayMyScrollableForm(); - } - - // -private: - void DisplayMyScrollableForm() - { - // Create a new form. - Form^ form2 = gcnew Form; - - // Create a button to add to the new form. - Button^ button1 = gcnew Button; - - // Set text for the button. - button1->Text = "Scrolled Button"; - - // Set the size of the button. - button1->Size = System::Drawing::Size( 100, 30 ); - - // Set the location of the button to be outside the form's client area. - button1->Location = Point(form2->Size.Width + 200,form2->Size.Height + 200); - - // Add the button control to the new form. - form2->Controls->Add( button1 ); - - // Set the AutoScroll property to true to provide scrollbars. - form2->AutoScroll = true; - - // Display the new form as a dialog box. - form2->ShowDialog(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp deleted file mode 100644 index 5d2138139bf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - static String^ strMyOriginalText = ""; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 64 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 48, 64 ); - this->textBox1->Name = "textBox1"; - this->textBox1->TabIndex = 1; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->textBox1,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Closing += gcnew System::ComponentModel::CancelEventHandler( this, &Form1::Form1_Closing ); - this->ResumeLayout( false ); - } - - // -private: - void Form1_Closing( Object^ /*sender*/, System::ComponentModel::CancelEventArgs^ e ) - { - // Determine if text has changed in the textbox by comparing to original text. - if ( textBox1->Text != strMyOriginalText ) - { - // Display a MsgBox asking the user to save changes or abort. - if ( MessageBox::Show( "Do you want to save changes to your text?", "My Application", MessageBoxButtons::YesNo ) == ::DialogResult::Yes ) - { - // Cancel the Closing event from closing the form. - e->Cancel = true; - - // Call method to save file... - } - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp deleted file mode 100644 index 282e8467d17..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - components = nullptr; - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - -#pragma region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 208, 48 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 72, 32 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 344, 144 ); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 96, 40 ); - this->button2->TabIndex = 2; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 512, 494 ); - array^temp1 = {this->button2,this->button1}; - this->Controls->AddRange( temp1 ); - this->IsMdiContainer = true; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } -#pragma endregion - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Form^ frm2 = gcnew Form; - frm2->MdiParent = this; - frm2->Show(); - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - AddButtonsToMyChildren(); - } - - // -private: - void AddButtonsToMyChildren() - { - // If there are child forms in the parent form, add Button controls to them. - for ( int x = 0; x < this->MdiChildren->Length; x++ ) - { - // Create a temporary Button control to add to the child form. - Button^ tempButton = gcnew Button; - - // Set the location and text of the Button control. - tempButton->Location = Point(10,10); - tempButton->Text = "OK"; - - // Create a temporary instance of a child form (Form 2 in this case). - Form^ tempChild = dynamic_cast(this->MdiChildren[ x ]); - - // Add the Button control to the control collection of the form. - tempChild->Controls->Add( tempButton ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp deleted file mode 100644 index 632a09d4a07..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - childCount = 0; - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 16 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->IsMdiContainer = true; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - int childCount; - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CreateMyChildForm(); - } - - // -private: - void CreateMyChildForm() - { - // Create a new form to represent the child form. - Form^ child = gcnew Form; - - // Increment the private child count. - childCount++; - - // Set the text of the child form using the count of child forms. - String^ formText = String::Format( "Child {0}", childCount ); - child->Text = formText; - - // Make the new form a child form. - child->MdiParent = this; - - // Display the child form. - child->Show(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp deleted file mode 100644 index ed746f91afa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp +++ /dev/null @@ -1,123 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace FormModalEx -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 184, 56 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 88, 24 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^formControls = {this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowMyNonModalForm(); - } - - // - private: - void ShowMyNonModalForm() - { - Form^ myForm = gcnew Form; - myForm->Text = "My Form"; - myForm->SetBounds( 10, 10, 200, 200 ); - myForm->Show(); - - // Determine if the form is modal. - if ( !myForm->Modal ) - { - // Change borderstyle and make it not a top level window. - myForm->FormBorderStyle = ::FormBorderStyle::FixedToolWindow; - myForm->TopLevel = false; - } - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew FormModalEx::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp deleted file mode 100644 index 019e179dd11..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 176, 56 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CreateMyOpaqueForm(); - } - - // -private: - void CreateMyOpaqueForm() - { - // Create a new form. - Form^ form2 = gcnew Form; - - // Set the text displayed in the caption. - form2->Text = "My Form"; - - // Set the opacity to 75%. - form2->Opacity = .75; - - // Size the form to be 300 pixels in height and width. - form2->Size = System::Drawing::Size( 300, 300 ); - - // Display the form in the center of the screen. - form2->StartPosition = FormStartPosition::CenterScreen; - - // Display the form as a modal dialog box. - form2->ShowDialog(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp deleted file mode 100644 index 61d1bf80520..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 184, 32 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 200, 104 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 1; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button2,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - AddMyOwnedForm(); - } - - // -private: - void AddMyOwnedForm() - { - // Create form to be owned. - Form^ ownedForm = gcnew Form; - - // Set the text of the owned form. - ownedForm->Text = String::Format( "Owned Form {0}", this->OwnedForms->Length ); - - // Add the form to the array of owned forms. - this->AddOwnedForm( ownedForm ); - - // Show the owned form. - ownedForm->Show(); - } - - void ChangeOwnedFormText() - { - // Loop through all owned forms and change their text. - for ( int x = 0; x < this->OwnedForms->Length; x++ ) - { - this->OwnedForms[ x ]->Text = String::Format( "My Owned Form {0}", x ); - } - } - // - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ChangeOwnedFormText(); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp deleted file mode 100644 index 89c5c4cd872..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 160, 48 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowInTaskBarEx(); - } - - // -private: - void ShowInTaskBarEx() - { - Form^ myForm = gcnew Form; - myForm->Text = "My Form"; - myForm->SetBounds( 10, 10, 200, 200 ); - myForm->FormBorderStyle = ::FormBorderStyle::FixedDialog; - myForm->MinimizeBox = false; - myForm->MaximizeBox = false; - - // Do not allow form to be displayed in taskbar. - myForm->ShowInTaskbar = false; - myForm->ShowDialog(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp deleted file mode 100644 index 621e291e84e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 152, 56 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 96, 32 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ShowMyDialogBox(); - } - - // -private: - void ShowMyDialogBox() - { - Form^ myForm = gcnew Form; - myForm->Text = "My Form"; - myForm->SetBounds( 20, 20, 300, 300 ); - myForm->FormBorderStyle = ::FormBorderStyle::FixedDialog; - - // Display the form with no grip since form is not resizable. - myForm->SizeGripStyle = ::SizeGripStyle::Hide; - myForm->MinimizeBox = false; - myForm->MaximizeBox = false; - myForm->ShowDialog(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp deleted file mode 100644 index f2d772e6305..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 208, 56 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CreateMyTopMostForm(); - } - - // -private: - void CreateMyTopMostForm() - { - // Create lower form to display. - Form^ bottomForm = gcnew Form; - - // Display the lower form Maximized to demonstrate effect of TopMost property. - bottomForm->WindowState = FormWindowState::Maximized; - - // Display the bottom form. - bottomForm->Show(); - - // Create the top most form. - Form^ topMostForm = gcnew Form; - - // Set the size of the form larger than the default size. - topMostForm->Size = System::Drawing::Size( 300, 300 ); - - // Set the position of the top most form to center of screen. - topMostForm->StartPosition = FormStartPosition::CenterScreen; - - // Display the form as top most form. - topMostForm->TopMost = true; - topMostForm->Show(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp deleted file mode 100644 index 39e452280b0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -ref class TestForm: public Form -{ -public: - TestForm() - { - InitMyForm(); - } - - // -public: - void InitMyForm() - { - // Adds a label to the form. - Label^ label1 = gcnew Label; - label1->Location = System::Drawing::Point( 80, 80 ); - label1->Name = "label1"; - label1->Size = System::Drawing::Size( 132, 80 ); - label1->Text = "Start Position Information"; - this->Controls->Add( label1 ); - - // Changes the border to Fixed3D. - FormBorderStyle = ::FormBorderStyle::Fixed3D; - - // Displays the border information. - label1->Text = String::Format( "The border is {0}", FormBorderStyle ); - } - // -}; - -int main() -{ - Application::Run( gcnew TestForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp b/snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp deleted file mode 100644 index a4d5f91e933..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -public: - Form1() - { - InitMyForm(); - } - - // -public: - void InitMyForm() - { - // Adds a label to the form. - Label^ label1 = gcnew Label; - label1->Location = System::Drawing::Point( 54, 128 ); - label1->Name = "label1"; - label1->Size = System::Drawing::Size( 220, 80 ); - label1->Text = "Start position information"; - this->Controls->Add( label1 ); - - // Moves the start position to the center of the screen. - StartPosition = FormStartPosition::CenterScreen; - - // Displays the position information. - label1->Text = String::Format( "The start position is {0}", StartPosition ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp b/snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp deleted file mode 100644 index cf8940f90f8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp +++ /dev/null @@ -1,41 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -ref class TestForm: public Form -{ -public: - TestForm() - { - InitMyForm(); - } - - // -public: - void InitMyForm() - { - // Adds a label to the form. - Label^ label1 = gcnew Label; - label1->Location = System::Drawing::Point( 54, 128 ); - label1->Name = "label1"; - label1->Size = System::Drawing::Size( 220, 80 ); - label1->Text = "Start position information"; - this->Controls->Add( label1 ); - - // Changes the window state to Maximized. - WindowState = FormWindowState::Maximized; - - // Displays the state information. - label1->Text = String::Format( "The form window is {0}", WindowState ); - } - // -}; - -int main() -{ - Application::Run( gcnew TestForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp deleted file mode 100644 index ffc408f59af..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - AddContextmenu(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - /// - /// The main entry point for the application. - /// - - // -public: - [STAThread] - void AddContextmenu() - { - // Create a shortcut menu. - System::Windows::Forms::ContextMenu^ m = gcnew System::Windows::Forms::ContextMenu; - this->ContextMenu = m; - - // Create MenuItem objects. - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - - // Set the Text property. - menuItem1->Text = "New"; - menuItem2->Text = "Open"; - - // Add menu items to the MenuItems collection. - m->MenuItems->Add( menuItem1 ); - m->MenuItems->Add( menuItem2 ); - - // Display the starting message. - MessageBox::Show( "Right-click the form to display the shortcut menu items" ); - - // Add functionality to the menu items. - menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); - menuItem2->Click += gcnew System::EventHandler( this, &Form1::menuItem2_Click ); - } - -private: - void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - String^ textReport = "You clicked the New menu item. \n" - "It is contained in the following shortcut menu: \n\n"; - - // Get information on the shortcut menu in which menuitem1 is contained. - textReport = String::Concat( textReport, this->ContextMenu->GetContextMenu()->ToString() ); - - // Display the shortcut menu information in a message box. - MessageBox::Show( textReport, "The ContextMenu Information" ); - } - - void menuItem2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - String^ textReport = "You clicked the Open menu item. \n" - "It is contained in the following shortcut menu: \n\n"; - - // Get information on the shortcut menu in which menuitem1 is contained. - textReport = String::Concat( textReport, this->ContextMenu->GetContextMenu()->ToString() ); - - // Display the shortcut menu information in a message box. - MessageBox::Show( textReport, "The ContextMenu Information" ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp deleted file mode 100644 index 8ec31eba837..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp +++ /dev/null @@ -1,119 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - GetData1(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 8, 24 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 264, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - array^formControls = {this->textBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void GetData1() - { - // Creates a new data object using a string and the text format. - String^ myString = "My text string"; - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); - - // Displays the string in a text box. - textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp b/snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp deleted file mode 100644 index c08bd55976a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - GetData2(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -private: - void GetData2() - { - // Creates a component. - Component^ myComponent = gcnew Component; - - // Creates a data object, and assigns it the component. - DataObject^ myDataObject = gcnew DataObject( myComponent ); - - // Creates a type, myType, to store the type of data. - Type^ myType = myComponent->GetType(); - - // Retrieves the data using myType to represent its type. - Object^ myObject = myDataObject->GetData( myType ); - if ( myObject != nullptr ) - MessageBox::Show( "The data type stored in the data object is " + - myObject->GetType()->Name + "." ); - else - MessageBox::Show( "Data of the specified type was not stored in the data object." ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp b/snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp deleted file mode 100644 index ca555c9731f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - GetData3(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -private: - void GetData3() - { - // Creates a new data object using a text string. - String^ myString = "Hello World!"; - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); - - // Displays the string with autoConvert equal to false. - if ( myDataObject->GetData( "System::String", false ) != nullptr ) - { - // Displays the string in a message box. - MessageBox::Show( myDataObject->GetData( "System::String", false ) + ".", "Message #1" ); - } - else - MessageBox::Show( "Could not find data of the specified format.", "Message #1" ); - - // Displays a not found message in a message box. - // Displays the string in a text box with autoConvert equal to true. - String^ myData = "The data is " + myDataObject->GetData( "System::String", true ) + "."; - MessageBox::Show( myData, "Message #2" ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp deleted file mode 100644 index 4dcd7fb9abf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - InitializeComponent(); - TestDataObject(); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -private: - void TestDataObject() - { - // Creates a new data object using a string and the Text format. - String^ myString = "Hello World!"; - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); - - // Checks whether the data is present in the Text format and displays the result. - if ( myDataObject->GetDataPresent( DataFormats::Text ) ) - MessageBox::Show( "The stored data is in the Text format.", "Test Result" ); - else - MessageBox::Show( "The stored data is not in the Text format.", "Test Result" ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp deleted file mode 100644 index 01da2cc4153..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - GetDataPresent2(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 288, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - array^formControls = {this->textBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void GetDataPresent2() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Creates a new data object and assigns it the component. - DataObject^ myDataObject = gcnew DataObject( myComponent ); - - // Creates a type to store the type of data. - Type^ myType = myComponent->GetType(); - - // Checks whether the specified data type exists in the object. - if ( myDataObject->GetDataPresent( myType ) ) - { - MessageBox::Show( "The specified data is stored in the data object." ); - - // Displays the type of data. - textBox1->Text = "The data type is " + myDataObject->GetData( myType )->GetType()->Name + "."; - } - else - MessageBox::Show( "The specified data is not stored in the data object." ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp deleted file mode 100644 index b8360cc623e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - GetDataPresent3(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -private: - void GetDataPresent3() - { - // Creates a new data object using a string and the Text format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"My String" ); - - // Checks whether the string can be displayed with autoConvert equal to false. - if ( myDataObject->GetDataPresent( "System::String", false ) ) - MessageBox::Show( myDataObject->GetData( "System::String", false )->ToString(), "Message #1" ); - else - MessageBox::Show( "Cannot convert data to the specified format with autoConvert set to false.", "Message #1" ); - - // Displays the string with autoConvert equal to true. - MessageBox::Show( "Now that autoConvert is true, you can convert " + myDataObject->GetData( "System::String", true ) + " to string format.", "Message #2" ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - - void label1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* - * Output: - * Parameter args for method ParamArrayAndDesc has a description attribute. - * The description is: "This argument is a ParamArray" - * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. - */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp deleted file mode 100644 index 21182fa6eb6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ - // -private: - void GetFormats1() - { - // Creates a data object using a string and the Text format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"My text string" ); - - // Gets all the data formats and data conversion formats in the data object. - array^allFormats = myDataObject->GetFormats(); - - // Creates the string that contains the formats. - String^ theResult = "The format(s) associated with the data are: \n"; - for ( int i = 0; i < allFormats->Length; i++ ) - theResult = theResult + allFormats[ i ] + "\n"; - - // Displays the result in a message box. - MessageBox::Show( theResult ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp b/snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp deleted file mode 100644 index 64305743720..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ - // -private: - void GetFormats2() - { - // Creates a new data object using a string and the UnicodeText format. - DataObject^ myDataObject = gcnew DataObject( DataFormats::UnicodeText,"My text string" ); - - // Gets the original data formats in the data object by setting the automatic - // conversion parameter to false. - array^myFormatsArray = myDataObject->GetFormats( false ); - - // Stores the results in a string. - String^ theResult = "The original format associated with the data is:\n"; - for ( int i = 0; i < myFormatsArray->Length; i++ ) - theResult = theResult + myFormatsArray[ i ] + "\n"; - - // Gets all data formats and data conversion formats for the data object. - myFormatsArray = myDataObject->GetFormats( true ); - - // Stores the results in the string. - theResult = theResult + "\nThe data format(s) and conversion format(s) associated with the data are:\n"; - for ( int i = 0; i < myFormatsArray->Length; i++ ) - theResult = theResult + myFormatsArray[ i ] + "\n"; - - // Displays the results. - MessageBox::Show( theResult ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp deleted file mode 100644 index 308a31b3228..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Label ^ label1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - InitializeMyMainMenu(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 24, 128 ); - this->label1->Name = "label1"; - this->label1->Size = System::Drawing::Size( 240, 88 ); - this->label1->TabIndex = 0; - this->label1->Text = "label1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - array^formControls = {this->label1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "My Form"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void InitializeMyMainMenu() - { - // Create the MainMenu and the menu items to add. - MainMenu^ mainMenu1 = gcnew MainMenu; - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - MenuItem^ menuItem3 = gcnew MenuItem; - MenuItem^ menuItem4 = gcnew MenuItem; - - // Set the caption for the menu items. - menuItem1->Text = "File"; - menuItem2->Text = "Edit"; - menuItem3->Text = "View"; - - // Add 3 menu items to the MainMenu for displaying. - mainMenu1->MenuItems->Add( menuItem1 ); - mainMenu1->MenuItems->Add( menuItem2 ); - mainMenu1->MenuItems->Add( menuItem3 ); - - // Assign mainMenu1 to the form. - Menu = mainMenu1; - - // Determine whether menuItem3 is currently being used. - if ( menuItem3->GetMainMenu() != nullptr ) - - // Display the name of the form in which it is located. - label1->Text = menuItem3->GetMainMenu()->GetForm()->ToString(); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp deleted file mode 100644 index d5691135580..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp +++ /dev/null @@ -1,62 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - Button^ button1; - Button^ button2; - void InitializeMyTabs() - { - tabControl1 = gcnew System::Windows::Forms::TabControl; - tabPage1 = gcnew System::Windows::Forms::TabPage; - tabPage2 = gcnew System::Windows::Forms::TabPage; - button1 = gcnew System::Windows::Forms::Button; - button2 = gcnew System::Windows::Forms::Button; - array^tabControls = {tabPage1,tabPage2}; - tabControl1->Controls->AddRange( tabControls ); - tabControl1->Location = System::Drawing::Point( 40, 24 ); - tabControl1->Size = System::Drawing::Size( 216, 216 ); - tabControl1->TabIndex = 0; - array^tabPage1Controls = {button1}; - tabPage1->Controls->AddRange( tabPage1Controls ); - tabPage1->TabIndex = 0; - array^tabPage2Controls = {button2}; - tabPage2->Controls->AddRange( tabPage2Controls ); - tabPage2->TabIndex = 1; - button1->Location = System::Drawing::Point( 64, 72 ); - button2->Location = System::Drawing::Point( 64, 72 ); - button2->Text = "button2"; - ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {tabControl1}; - Controls->AddRange( formControls ); - - // Gets the index of the TabPage containing button2. - // Selects the index of the TabPage containing button2. - tabControl1->SelectedIndex = (TabPage::GetTabPageOfComponent( button2 ))->TabIndex; - } - - -public: - Form1() - { - InitializeMyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp b/snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp deleted file mode 100644 index 4a9e8bc47d0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - Rectangle myTabRect; - -public: - Form1() - { - tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - tabControl1->Controls->Add( tabPage1 ); - tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; - tabControl1->Location = Point(25,25); - tabControl1->Size = System::Drawing::Size( 250, 250 ); - tabPage1->TabIndex = 0; - - // Gets the tabPage1 tab area defined by its TabIndex. - // Returns a Rectangle to myTabRect. - myTabRect = tabControl1->GetTabRect( 0 ); - ClientSize = System::Drawing::Size( 300, 300 ); - Controls->Add( tabControl1 ); - tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::OnDrawItem ); - } - - -private: - void OnDrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) - { - Graphics^ g = e->Graphics; - Pen^ p = gcnew Pen( Color::Blue ); - g->DrawRectangle( p, myTabRect ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp deleted file mode 100644 index 64f5f889272..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp +++ /dev/null @@ -1,307 +0,0 @@ -// System::Windows::Forms::GridColumnStylesCollection::Clear -// System::Windows::Forms::GridColumnStylesCollection::get_Item(int) -// System::Windows::Forms::GridColumnStylesCollection::get_Item(String*) - -/* -The following program demonstrates the Clear method , the get_Item(int) and get_Item(String*) -indexers for the 'GridColumnStylesCollection' class. -In this program the user can add custom styles and clear them. The information on the styles -is displayed depending on the option chosen by user. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Collections; - -public ref class MyForm: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Label^ myLabel; - Button^ clearButton; - Button^ addStylesButton; - Button^ selectChoiceButton; - System::Windows::Forms::RadioButton^ columnNameRadioButton; - System::Windows::Forms::RadioButton^ indexRadioButton; - System::Windows::Forms::Label ^ myLabel2; - bool TablesAlreadyAdded; - -public: - MyForm() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - components = gcnew System::ComponentModel::Container; - clearButton = gcnew System::Windows::Forms::Button; - addStylesButton = gcnew System::Windows::Forms::Button; - myDataGrid = gcnew System::Windows::Forms::DataGrid; - myLabel = gcnew System::Windows::Forms::Label; - selectChoiceButton = gcnew System::Windows::Forms::Button; - columnNameRadioButton = gcnew System::Windows::Forms::RadioButton; - indexRadioButton = gcnew System::Windows::Forms::RadioButton; - myLabel2 = gcnew System::Windows::Forms::Label; - clearButton->Location = System::Drawing::Point( 24, 16 ); - clearButton->Name = "clearButton"; - clearButton->Size = System::Drawing::Size( 120, 24 ); - clearButton->Text = "Clear Table Styles"; - clearButton->Click += gcnew System::EventHandler( this, &MyForm::Clear_Clicked ); - addStylesButton->Location = System::Drawing::Point( 150, 16 ); - addStylesButton->Name = "addStylesButton"; - addStylesButton->Size = System::Drawing::Size( 120, 24 ); - addStylesButton->Text = "Add Custom Styles"; - addStylesButton->Click += gcnew System::EventHandler( this, &MyForm::AddStyles_Clicked ); - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 300, 200 ); - myDataGrid->CaptionText = "Microsoft DataGrid Control"; - myLabel->Location = System::Drawing::Point( 48, 328 ); - myLabel->Name = "myLabel"; - myLabel->Size = System::Drawing::Size( 464, 90 ); - myLabel->TabIndex = 7; - myLabel->Text = "Message."; - myLabel2->Location = System::Drawing::Point( 412, 24 ); - myLabel2->Size = System::Drawing::Size( 100, 20 ); - myLabel2->Text = "Print info using:"; - selectChoiceButton->Location = System::Drawing::Point( 276, 16 ); - selectChoiceButton->Name = "selectChoiceButton"; - selectChoiceButton->Size = System::Drawing::Size( 120, 24 ); - selectChoiceButton->Text = "Print Info"; - selectChoiceButton->Click += gcnew System::EventHandler( this, &MyForm::SelectChoice_Clicked ); - columnNameRadioButton->Location = System::Drawing::Point( 432, 56 ); - columnNameRadioButton->Name = "columnNameRadioButton"; - columnNameRadioButton->Text = "ColumnName"; - indexRadioButton->Location = System::Drawing::Point( 432, 88 ); - indexRadioButton->Name = "indexRadioButton"; - indexRadioButton->Text = "Index"; - ClientSize = System::Drawing::Size( 600, 500 ); - Name = "MyForm"; - Text = "DataGrid Control Sample"; - Controls->Add( clearButton ); - Controls->Add( addStylesButton ); - Controls->Add( selectChoiceButton ); - Controls->Add( myDataGrid ); - Controls->Add( columnNameRadioButton ); - Controls->Add( indexRadioButton ); - Controls->Add( myLabel ); - Controls->Add( myLabel2 ); - } - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ customerTable = gcnew DataTable( "Customers" ); - DataTable^ ordersTable = gcnew DataTable( "Orders" ); - - // Create two columns, add them to the first table. - DataColumn^ customerID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ customerName = gcnew DataColumn( "CustName" ); - DataColumn^ current = gcnew DataColumn( "Current",bool::typeid ); - customerTable->Columns->Add( customerID ); - customerTable->Columns->Add( customerName ); - customerTable->Columns->Add( current ); - - // Create three columns, add them to the second table. - DataColumn^ customerID2 = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ orderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); - DataColumn^ orderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - ordersTable->Columns->Add( orderAmount ); - ordersTable->Columns->Add( customerID2 ); - ordersTable->Columns->Add( orderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( customerTable ); - myDataSet->Tables->Add( ordersTable ); - - // Create a DataRelation, add it to the DataSet. - DataRelation^ myDataRelation = gcnew DataRelation( "custToOrders",customerID,customerID2 ); - myDataSet->Relations->Add( myDataRelation ); - DataRow^ newRow1; - DataRow^ newRow2; - - // Create three customers in the Customers Table. - for ( int index = 1; index < 5; index++ ) - { - newRow1 = customerTable->NewRow(); - newRow1[ "CustID" ] = index; - newRow1[ "CustName" ] = "Item " + index; - newRow1[ "Current" ] = true.ToString(); - - // Add the row to the Customers table. - customerTable->Rows->Add( newRow1 ); - } - - // For each customer, create five rows in the Orders table. - for ( int index = 1; index < 5; index++ ) - { - for ( int j = 1; j < 6; j++ ) - { - newRow2 = ordersTable->NewRow(); - newRow2[ "CustID" ] = index; - newRow2[ "OrderDate" ] = DateTime(2001,index,j * 2); - newRow2[ "OrderAmount" ] = index * 10 + j * .1; - - // Add the row to the Orders table. - ordersTable->Rows->Add( newRow2 ); - } - } - } - - void AddStyles_Clicked( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - myLabel->Text = "Styles added to the grid."; - if ( TablesAlreadyAdded ) - return; - - AddCustomDataTableStyle(); - } - - void AddCustomDataTableStyle() - { - DataGridTableStyle^ tableStyle1 = gcnew DataGridTableStyle; - tableStyle1->MappingName = "Customers"; - - // Set other properties. - tableStyle1->AlternatingBackColor = Color::LightGray; - - // Add a second column style. - DataGridColumnStyle^ textBoxColumnStyle = gcnew DataGridTextBoxColumn; - textBoxColumnStyle->MappingName = "CustName"; - textBoxColumnStyle->HeaderText = "Customer Name"; - textBoxColumnStyle->Width = 100; - tableStyle1->GridColumnStyles->Add( textBoxColumnStyle ); - - // Add a GridColumnStyle and set its MappingName to the name of a DataColumn in the DataTable. - DataGridColumnStyle^ gridColumnStyle = gcnew DataGridBoolColumn; - gridColumnStyle->MappingName = "Current"; - - // Set the HeaderText and Width properties. - gridColumnStyle->HeaderText = "IsCurrent Customer"; - gridColumnStyle->Width = 125; - tableStyle1->GridColumnStyles->Add( gridColumnStyle ); - - // Create the second table style with columns. - DataGridTableStyle^ tableStyle2 = gcnew DataGridTableStyle; - tableStyle2->MappingName = "Orders"; - - // Set other properties. - tableStyle2->AlternatingBackColor = Color::LightBlue; - - // Create new ColumnStyle Object*. - DataGridColumnStyle^ orderDate = gcnew DataGridTextBoxColumn; - orderDate->MappingName = "OrderDate"; - orderDate->HeaderText = "Order Date"; - orderDate->Width = 100; - tableStyle2->GridColumnStyles->Add( orderDate ); - - // Create a formatted column using a PropertyDescriptor. - PropertyDescriptorCollection^ pcol = - this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties(); - DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - tableStyle2->GridColumnStyles->Add( csOrderAmount ); - - // Add the DataGridTableStyle objects to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( tableStyle1 ); - myDataGrid->TableStyles->Add( tableStyle2 ); - - // Set the TablesAlreadyAdded to true so we don't try to do this again. - TablesAlreadyAdded = true; - } - - void SelectChoice_Clicked( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( columnNameRadioButton->Checked ) - PrintColumnInformationUsingColumnName(); - else - if ( indexRadioButton->Checked ) - PrintColumnInformationUsingIndex(); - } - - // -private: - void Clear_Clicked( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // TablesAlreadyAdded set to false so that table styles can be added again. - TablesAlreadyAdded = false; - myLabel->Text = "All Table Styles Cleared."; - - // Clear all the column styles and also table style for the grid. - IEnumerator^ myEnum = myDataGrid->TableStyles->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridTableStyle^ myTableStyle = safe_cast(myEnum->Current); - GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; - myColumns->Clear(); - } - - myDataGrid->TableStyles->Clear(); - } - // - - // -private: - void PrintColumnInformationUsingColumnName() - { - myLabel->Text = "Table Styles info: No of Styles " + myDataGrid->TableStyles->Count; - IEnumerator^ myEnum = myDataGrid->TableStyles->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridTableStyle^ myTableStyle = safe_cast(myEnum->Current); - myLabel->Text = myLabel->Text + "\nTable Name : " + myTableStyle->MappingName; - GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; - - // 'myTableStyle->GridColumnStyles[index]->MappingName' specifies the column came for the table. - for ( int index = 0; index < myColumns->Count; index++ ) - myLabel->Text = myLabel->Text + "\nMapping Name: " + - myColumns[ myTableStyle->GridColumnStyles[ index ]->MappingName ]->MappingName; - } - } - // - - // -private: - void PrintColumnInformationUsingIndex() - { - myLabel->Text = "Table Styles info: No of Styles " + myDataGrid->TableStyles->Count; - IEnumerator^ myEnum = myDataGrid->TableStyles->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridTableStyle^ myTableStyle = safe_cast(myEnum->Current); - myLabel->Text = myLabel->Text + "\nTable Name : " + myTableStyle->MappingName; - GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; - for ( int index = 0; index < myColumns->Count; index++ ) - myLabel->Text = myLabel->Text + "\nMapping Name: " + myColumns[ index ]->MappingName; - } - } - // -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp deleted file mode 100644 index 5a580bc35c0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp +++ /dev/null @@ -1,216 +0,0 @@ -// System::Windows::Forms::GridColumnStylesCollection::RemoveAt - -/* -The following program demonstrates the 'RemoveAt(int)' method of -'GridColumnStylesCollection' class. An instance of DataGrid is created -by associating the DataGrid with a data source and column style -collections are added to it. A Remove button is provided to delete the -CustomerName column style collection. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Collections; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ components; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - Button^ removeStyle; - GridColumnStylesCollection^ myColumns; - -public: - MyForm() - { - InitializeComponent(); - SetUp(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - components = gcnew System::ComponentModel::Container; - myDataGrid = gcnew DataGrid; - removeStyle = gcnew Button; - - // Set the myDataGrid properties. - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 300, 200 ); - myDataGrid->CaptionText = "Microsoft DataGrid Control"; - - // Set the removeStyle properties. - removeStyle->Location = Point(276,16); - removeStyle->Name = "removeStyle"; - removeStyle->Size = System::Drawing::Size( 120, 24 ); - removeStyle->Text = "Remove"; - removeStyle->Click += gcnew System::EventHandler( this, &MyForm::RemoveColumnStyle_Clicked ); - ClientSize = System::Drawing::Size( 600, 500 ); - Name = "GridColumnStylesCollection_RemoveAt"; - Text = "DataGrid Control Sample"; - - // Add the controls to the form. - Controls->Add( removeStyle ); - Controls->Add( myDataGrid ); - } - - void SetUp() - { - // Create the data source. - MakeDataSet(); - - // Associate the data set. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // Create a DataSet with two tables and populate it. - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create two DataTables. - DataTable^ myCustomer = gcnew DataTable( "Customers" ); - DataTable^ myOrders = gcnew DataTable( "Orders" ); - - // Create two columns, and add them to the first table. - DataColumn^ myCustomerID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); - DataColumn^ myCurrent = gcnew DataColumn( "Current",bool::typeid ); - myCustomer->Columns->Add( myCustomerID ); - myCustomer->Columns->Add( myCustomerName ); - myCustomer->Columns->Add( myCurrent ); - - // Create three columns, and add them to the second table. - DataColumn^ myID = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ myOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); - DataColumn^ myOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); - myOrders->Columns->Add( myOrderAmount ); - myOrders->Columns->Add( myID ); - myOrders->Columns->Add( myOrderDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( myCustomer ); - myDataSet->Tables->Add( myOrders ); - - // Create a DataRelation, and add it to the DataSet. - DataRelation^ myDataRelation = gcnew DataRelation( "custToOrders",myCustomerID,myID ); - myDataSet->Relations->Add( myDataRelation ); - DataRow^ myNewRow1; - DataRow^ myNewRow2; - - // Create three customers in the Customers Table. - for ( int i = 1; i < 5; i++ ) - { - myNewRow1 = myCustomer->NewRow(); - myNewRow1[ "CustID" ] = i; - myNewRow1[ "CustName" ] = "Item {0}",i; - myNewRow1[ "Current" ] = true.ToString(); - - // Add the row to the Customers table. - myCustomer->Rows->Add( myNewRow1 ); - } - - // For each customer, create five rows in the Orders table. - for ( int i = 1; i < 5; i++ ) - { - for ( int j = 1; j < 6; j++ ) - { - myNewRow2 = myOrders->NewRow(); - myNewRow2[ "CustID" ] = i; - myNewRow2[ "OrderDate" ] = DateTime(2001,i,j * 2); - myNewRow2[ "OrderAmount" ] = i * 10 + j * .1; - - // Add the row to the Orders table. - myOrders->Rows->Add( myNewRow2 ); - } - } - AddCustomDataTableStyle(); - } - - void AddCustomDataTableStyle() - { - // Create a 'DataGridTableStyle'. - DataGridTableStyle^ myTableStyle1 = gcnew DataGridTableStyle; - - // Map the table style. - myTableStyle1->MappingName = "Customers"; - myTableStyle1->AlternatingBackColor = Color::LightGray; - - // Add a Name column style. - DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; - myTextCol->MappingName = "CustName"; - myTextCol->HeaderText = "Customer Name"; - myTextCol->Width = 100; - myTableStyle1->GridColumnStyles->Add( myTextCol ); - - // Add a Current column style. - DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; - myBoolCol->MappingName = "Current"; - myBoolCol->HeaderText = "IsCurrent Customer"; - myBoolCol->Width = 125; - myTableStyle1->GridColumnStyles->Add( myBoolCol ); - - // Create the second table style with columns. - DataGridTableStyle^ myTableStyle2 = gcnew DataGridTableStyle; - myTableStyle2->MappingName = "Orders"; - myTableStyle2->AlternatingBackColor = Color::LightBlue; - - // Create Order Date Column Style. - DataGridColumnStyle^ myOrderDate = gcnew DataGridTextBoxColumn; - myOrderDate->MappingName = "OrderDate"; - myOrderDate->HeaderText = "Order Date"; - myOrderDate->Width = 100; - myTableStyle2->GridColumnStyles->Add( myOrderDate ); - - // Get the PropertyDescriptor of data set. - PropertyDescriptorCollection^ myPCol = this->BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); - - // Create the Order Amount Column style. - DataGridColumnStyle^ myOrderAmount = gcnew DataGridTextBoxColumn( myPCol[ "OrderAmount" ],"c",true ); - myOrderAmount->MappingName = "OrderAmount"; - myOrderAmount->HeaderText = "Total"; - myOrderAmount->Width = 100; - myTableStyle2->GridColumnStyles->Add( myOrderAmount ); - - // Add the DataGridTableStyle objects to the GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle1 ); - myDataGrid->TableStyles->Add( myTableStyle2 ); - } - - // -private: - void RemoveColumnStyle_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ 0 ]; - - // Get the GridColumnStylesCollection of Data Grid. - myColumns = myTableStyle->GridColumnStyles; - int i; - - // Remove the CustName ColumnStyle from the data grid. - if ( myColumns->Contains( "CustName" ) ) - { - DataGridColumnStyle^ myDataColumnStyle = myColumns[ "CustName" ]; - i = myColumns->IndexOf( myDataColumnStyle ); - myColumns->RemoveAt( i ); - } - } - // -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp deleted file mode 100644 index 47d1bd10a52..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp +++ /dev/null @@ -1,148 +0,0 @@ -// System::Windows::Forms::GridColumnStylesCollection::ResetPropertyDescriptors() - -/* -The following program demonstrates the 'ResetPropertyDecriptors()' -method of 'GridColumnStylesCollection' class. An instance of DataGrid is -created and associate the data source to DataGrid. Then -column styles are added to the data grid. A Reset button is -provided to reset the property descriptors of the DataGrid -columns. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class MyForm: public Form -{ -private: - System::ComponentModel::Container^ myComponents; - Button^ resetButton; - DataGrid^ myDataGrid; - DataSet^ myDataSet; - -public: - MyForm() - { - // Required for Windows Form Designer support. - InitializeComponent(); - - // Call MyDataSource to bind the controls. - MyDataSource(); - } - -private: - void InitializeComponent() - { - // Create the form and its controls. - this->myComponents = gcnew System::ComponentModel::Container; - this->Text = "DataGrid Control Sample"; - this->resetButton = gcnew Button; - resetButton->Location = Point(24,16); - resetButton->Size = System::Drawing::Size( 124, 30 ); - resetButton->Text = "Reset Property Descriptor"; - resetButton->Click += gcnew System::EventHandler( this, &MyForm::ResetButton_Click ); - this->myDataGrid = gcnew DataGrid; - myDataGrid->Location = Point(24,50); - myDataGrid->Size = System::Drawing::Size( 300, 200 ); - myDataGrid->CaptionText = "Microsoft DataGrid Control"; - this->Controls->Add( resetButton ); - this->Controls->Add( myDataGrid ); - } - - void MyDataSource() - { - // Create a DataSet with one table - MakeDataSet(); - - // Bind the DataGrid to the DataSet. - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - // -private: - void ResetButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ 0 ]; - GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; - - // Reset the property descriptor of column styles collection. - myColumns->ResetPropertyDescriptors(); - } - // - -private: - void AddCustomDataTableStyle() - { - // Get the currency manager for 'myDataSet' data source. - CurrencyManager^ myCurrencyManger = dynamic_cast(this->BindingContext[ myDataSet ]); - - // Associate the 'DataGridTableStyle' to the 'myDataSet' data source. - DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; - myTableStyle->MappingName = "Customers"; - - // Add style for 'Name' column. - PropertyDescriptor^ pdName = myCurrencyManger->GetItemProperties()[ "CustName" ]; - - // Create an instance of 'DataGridColumnStyle'. - DataGridColumnStyle^ myCustomerNameStyle = gcnew DataGridTextBoxColumn( pdName ); - myCustomerNameStyle->MappingName = "custName"; - myCustomerNameStyle->HeaderText = "Customer Name"; - myTableStyle->GridColumnStyles->Add( myCustomerNameStyle ); - - // Add style for 'Date' column. - PropertyDescriptor^ myDateDescriptor = myCurrencyManger->GetItemProperties()[ "Date" ]; - DataGridColumnStyle^ myDateStyle = gcnew DataGridTextBoxColumn( myDateDescriptor,"G" ); - myDateStyle->MappingName = "Date"; - myDateStyle->HeaderText = "Date"; - myDateStyle->Width = 150; - myTableStyle->GridColumnStyles->Add( myDateStyle ); - - // Add DataGridTableStyle instances to GridTableStylesCollection. - myDataGrid->TableStyles->Add( myTableStyle ); - } - - void MakeDataSet() - { - myDataSet = gcnew DataSet( "myDataSet" ); - DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the table. - DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); - DataColumn^ myDate = gcnew DataColumn( "Date",System::DateTime::typeid ); - myCustomerTable->Columns->Add( myCustomerName ); - myCustomerTable->Columns->Add( myDate ); - - // Add the tables to the DataSet. - myDataSet->Tables->Add( myCustomerTable ); - DataRow^ myNewRow; - for ( int i = 1; i < 3; i++ ) - { - myNewRow = myCustomerTable->NewRow(); - - // Add the row to the Customers table. - myCustomerTable->Rows->Add( myNewRow ); - } - - myCustomerTable->Rows[ 0 ][ "custName" ] = "Customer1"; - myCustomerTable->Rows[ 1 ][ "custName" ] = "Customer2"; - myCustomerTable->Rows[ 0 ][ "Date" ] = System::DateTime::Now; - myCustomerTable->Rows[ 1 ][ "Date" ] = System::DateTime::Today; - - // Add column style collections. - AddCustomDataTableStyle(); - } -}; - -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp b/snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp deleted file mode 100644 index fd8eaf24dde..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::IO; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class DataGridTableStuff: public Form -{ -private: - DataGrid^ myDataGrid; - DataSet^ myDataSet; - void SetUp() - { - myDataSet = gcnew DataSet( "myDataSet" ); - myDataGrid = gcnew DataGrid; - } - - // - void AddCustomDataTableStyle() - { - DataGridTableStyle^ ts1 = gcnew DataGridTableStyle; - ts1->MappingName = "Customers"; - - // Set other properties. - ts1->AlternatingBackColor = Color::LightGray; - - /* Add a GridColumnStyle and set its MappingName - to the name of a DataColumn in the DataTable. - Set the HeaderText and Width properties. */ - DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn; - boolCol->MappingName = "Current"; - boolCol->HeaderText = "IsCurrent Customer"; - boolCol->Width = 150; - ts1->GridColumnStyles->Add( boolCol ); - - // Add a second column style. - DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; - TextCol->MappingName = "custName"; - TextCol->HeaderText = "Customer Name"; - TextCol->Width = 250; - ts1->GridColumnStyles->Add( TextCol ); - - // Create the second table style with columns. - DataGridTableStyle^ ts2 = gcnew DataGridTableStyle; - ts2->MappingName = "Orders"; - - // Set other properties. - ts2->AlternatingBackColor = Color::LightBlue; - - // Create new ColumnStyle objects. - DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; - cOrderDate->MappingName = "OrderDate"; - cOrderDate->HeaderText = "Order Date"; - cOrderDate->Width = 100; - ts2->GridColumnStyles->Add( cOrderDate ); - - /*Use a PropertyDescriptor to create a formatted - column. First get the PropertyDescriptorCollection - for the data source and data member. */ - System::ComponentModel::PropertyDescriptorCollection^ pcol = this-> - BindingContext[myDataSet, "Customers::custToOrders"]-> - GetItemProperties(); - - /* Create a formatted column using a PropertyDescriptor. - The formatting character S"c" specifies a currency format. */ - DataGridColumnStyle^ csOrderAmount = - gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); - csOrderAmount->MappingName = "OrderAmount"; - csOrderAmount->HeaderText = "Total"; - csOrderAmount->Width = 100; - ts2->GridColumnStyles->Add( csOrderAmount ); - - /* Add the DataGridTableStyle instances to - the GridTableStylesCollection. */ - myDataGrid->TableStyles->Add( ts1 ); - myDataGrid->TableStyles->Add( ts2 ); - } - // - - // - void GetGridTableByIndex() - { - DataGridTableStyle^ myGridStyle = myDataGrid->TableStyles[ 0 ]; - Console::WriteLine( myGridStyle->MappingName ); - } - // - - // - void GetGridTableByName() - { - DataGridTableStyle^ myGridStyle = myDataGrid->TableStyles[ "customers" ]; - Console::WriteLine( myGridStyle->MappingName ); - } - // - - // - void AddDataGridTableStyle() - { - // Create a new DataGridTableStyle and set MappingName. - DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle; - myGridStyle->MappingName = "Customers"; - - // Create two DataGridColumnStyle objects. - DataGridColumnStyle^ colStyle1 = gcnew DataGridTextBoxColumn; - colStyle1->MappingName = "firstName"; - DataGridColumnStyle^ colStyle2 = gcnew DataGridBoolColumn; - colStyle2->MappingName = "Current"; - - // Add column styles to table style. - myGridStyle->GridColumnStyles->Add( colStyle1 ); - myGridStyle->GridColumnStyles->Add( colStyle2 ); - - // Add the grid style to the GridStylesCollection. - myDataGrid->TableStyles->Add( myGridStyle ); - } - // - - // - void AddArray() - { - /* Get three CurrencyManager objects used to construct - DataGridTableSTyle objects. */ - CurrencyManager^ customersManager = - dynamic_cast(this->BindingContext[myDataSet, "Customers"]); - CurrencyManager^ regionsManager = - dynamic_cast(this->BindingContext[myDataSet, "Customers"]); - CurrencyManager^ productsManager = - dynamic_cast(this->BindingContext[myDataSet, "Customers"]); - DataGridTableStyle^ gridCustomers = gcnew DataGridTableStyle( customersManager ); - DataGridTableStyle^ gridRegions = gcnew DataGridTableStyle( regionsManager ); - DataGridTableStyle^ gridProducts = gcnew DataGridTableStyle( productsManager ); - - // Create a DataGridTableStyle array. - array^myGrids = {gridCustomers,gridRegions,gridProducts}; - - // Use AddRange to add to the collection. - myDataGrid->TableStyles->AddRange( myGrids ); - } - // - - // - void TestContains() - { - bool isContained; - isContained = myDataGrid->TableStyles->Contains( "Customers" ); - Console::WriteLine( isContained ); - } - // -}; - -int main() -{ - DataGridTableStuff^ dg = gcnew DataGridTableStuff; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp b/snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp deleted file mode 100644 index a522b891ba5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp +++ /dev/null @@ -1,66 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -namespace FontDialogOverride_cs -{ - /// - /// Summary description for FontDialogOverride. - /// - public ref class FontDialogOverride: public FontDialog - { - // - private: - // Defines the constants for Windows messages. - literal int WM_SETFOCUS = 0x0007; - literal int WM_INITDIALOG = 0x0110; - literal int WM_LBUTTONDOWN = 0x0201; - literal int WM_RBUTTONDOWN = 0x0204; - literal int WM_MOVE = 0x0003; - - protected: - // Overrides the base class hook procedure... - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - virtual IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam ) override - { - // Evaluates the message parameter to determine the user action. - #if defined(TRACE) - switch ( msg ) - { - case WM_INITDIALOG: - System::Diagnostics::Trace::Write( "The WM_INITDIALOG message was received." ); - break; - case WM_SETFOCUS: - System::Diagnostics::Trace::Write( "The WM_SETFOCUS message was received." ); - break; - case WM_LBUTTONDOWN: - System::Diagnostics::Trace::Write( "The WM_LBUTTONDOWN message was received." ); - break; - case WM_RBUTTONDOWN: - System::Diagnostics::Trace::Write( "The WM_RBUTTONDOWN message was received." ); - break; - case WM_MOVE: - System::Diagnostics::Trace::Write( "The WM_MOVE message was received." ); - break; - } - #endif - - // Always call the base class hook procedure. - return FontDialog::HookProc( hWnd, msg, wParam, lParam ); - } - // - - public: - FontDialogOverride() - { - // - // TODO: Add constructor logic here - // - } - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp deleted file mode 100644 index 99a6f5e0027..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Name = "textBox1"; - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - array^formControls = {this->textBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Add a text String* to the TextBox. - textBox1->Text = "Hello World!"; - - // Set the size of the TextBox. - textBox1->AutoSize = false; - textBox1->Size = System::Drawing::Size( Width, Height / 3 ); - - // Align the text in the center of the control element. - textBox1->TextAlign = HorizontalAlignment::Center; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp deleted file mode 100644 index c97b54810d6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - array^tabControls = {this->tabPage1,this->tabPage2}; - this->tabControl1->Controls->AddRange( tabControls ); - this->tabControl1->Padding = Point(15,10); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - - // Highlights TabPage::Text when the mouse passes over tabs. - this->tabControl1->HotTrack = true; - this->tabPage1->Text = "myTabPage1"; - this->tabPage2->Text = "myTabPage2"; - this->Size = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp deleted file mode 100644 index a50c5a0e743..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Security::Permissions; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::WebBrowser^ WebBrowser1; - - /// - /// Required designer variable. - /// - System::ComponentModel::IContainer^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - void InitializeComponent() - { - this->WebBrowser1 = gcnew System::Windows::Forms::WebBrowser; - this->SuspendLayout(); - - // - // WebBrowser1 - // - this->WebBrowser1->Dock = System::Windows::Forms::DockStyle::Fill; - this->WebBrowser1->Location = System::Drawing::Point( 0, 0 ); - this->WebBrowser1->Name = "WebBrowser1"; - this->WebBrowser1->Size = System::Drawing::Size( 824, 440 ); - this->WebBrowser1->TabIndex = 0; - this->WebBrowser1->DocumentCompleted += gcnew System::Windows::Forms::WebBrowserDocumentCompletedEventHandler( this, &Form1::webBrowser1_DocumentCompleted ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 824, 440 ); - this->Controls->Add( this->WebBrowser1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void webBrowser1_DocumentCompleted( Object^ /*sender*/, System::Windows::Forms::WebBrowserDocumentCompletedEventArgs^ /*e*/ ) - { - WebBrowser1->Document->MouseDown += gcnew HtmlElementEventHandler( this, &Form1::Document_MouseDown ); - WebBrowser1->Document->MouseMove += gcnew HtmlElementEventHandler( this, &Form1::Document_MouseMove ); - WebBrowser1->Document->MouseUp += gcnew HtmlElementEventHandler( this, &Form1::Document_MouseUp ); - } - - void Document_MouseDown( Object^ /*sender*/, HtmlElementEventArgs^ /*e*/ ) - { - // Insert your code here. - } - - void Document_MouseMove( Object^ /*sender*/, HtmlElementEventArgs^ /*e*/ ) - { - // Insert your code here. - } - - void Document_MouseUp( Object^ /*sender*/, HtmlElementEventArgs^ /*e*/ ) - { - // Insert your code here. - } - // -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp b/snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp deleted file mode 100644 index 2a22650d0e7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class MyButton: public ButtonBase, public IButtonControl -{ -private: - System::Windows::Forms::DialogResult myDialogResult; - -public: - MyButton() - { - // Make the button White and a Popup style - // so it can be distinguished on the form. - this->FlatStyle = ::FlatStyle::Popup; - this->BackColor = Color::White; - } - - property System::Windows::Forms::DialogResult DialogResult - { - // Add implementation to the IButtonControl.DialogResult property. - virtual System::Windows::Forms::DialogResult get() - { - return this->myDialogResult; - } - - virtual void set( System::Windows::Forms::DialogResult value ) - { - if ( Enum::IsDefined( System::Windows::Forms::DialogResult::typeid, value ) ) - { - this->myDialogResult = value; - } - } - } - - // Add implementation to the IButtonControl.NotifyDefault method. - virtual void NotifyDefault( bool value ) - { - if ( this->IsDefault != value ) - { - this->IsDefault = value; - } - } - - // Add implementation to the IButtonControl.PerformClick method. - virtual void PerformClick() - { - if ( this->CanSelect ) - { - this->OnClick( EventArgs::Empty ); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp deleted file mode 100644 index 72fa8a99347..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -/* This sample illustrates how to use the IComponentChangeService interface - to handle component change events. The ComponentClass control attaches - event handlers when it is sited in a document, and displays a message - when notification that a component has been added, removed, or changed - is received from the IComponentChangeService. - - To run this sample, add the ComponentClass control to a Form and - add, remove, or change components to see the behavior of the - component change event handlers. */ - -public ref class ComponentClass: public UserControl -{ -private: - System::ComponentModel::Container^ components; - ListBox^ listBox1; - IComponentChangeService^ m_changeService; - void InitializeComponent() - { - this->listBox1 = gcnew ListBox; - this->SuspendLayout(); - - // listBox1. - this->listBox1->Location = System::Drawing::Point( 24, 16 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 576, 277 ); - this->listBox1->TabIndex = 0; - - // ComponentClass. - array^myArray = {listBox1}; - this->Controls->AddRange( myArray ); - this->Name = "ComponentClass"; - this->Size = System::Drawing::Size( 624, 320 ); - this->ResumeLayout( false ); - } - - void ClearChangeNotifications() - { - // The m_changeService value is 0 when not in design mode, - // as the IComponentChangeService is only available at design time. - m_changeService = dynamic_cast(GetService( IComponentChangeService::typeid )); - - // Clear our the component change events to prepare for re-siting. - if ( m_changeService != nullptr ) - { - m_changeService->ComponentChanged -= gcnew ComponentChangedEventHandler( this, &ComponentClass::OnComponentChanged ); - m_changeService->ComponentChanging -= gcnew ComponentChangingEventHandler( this, &ComponentClass::OnComponentChanging ); - m_changeService->ComponentAdded -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdded ); - m_changeService->ComponentAdding -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdding ); - m_changeService->ComponentRemoved -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoved ); - m_changeService->ComponentRemoving -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoving ); - m_changeService->ComponentRename -= gcnew ComponentRenameEventHandler( this, &ComponentClass::OnComponentRename ); - } - } - - void RegisterChangeNotifications() - { - // Register the event handlers for the IComponentChangeService events - if ( m_changeService != nullptr ) - { - m_changeService->ComponentChanged += gcnew ComponentChangedEventHandler( this, &ComponentClass::OnComponentChanged ); - m_changeService->ComponentChanging += gcnew ComponentChangingEventHandler( this, &ComponentClass::OnComponentChanging ); - m_changeService->ComponentAdded += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdded ); - m_changeService->ComponentAdding += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdding ); - m_changeService->ComponentRemoved += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoved ); - m_changeService->ComponentRemoving += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoving ); - m_changeService->ComponentRename += gcnew ComponentRenameEventHandler( this, &ComponentClass::OnComponentRename ); - } - } - - /* This method handles the OnComponentChanged event to display a notification. */ - void OnComponentChanged( Object^ /*sender*/, ComponentChangedEventArgs^ ce ) - { - if ( ce->Component != nullptr && static_cast(ce->Component)->Site != nullptr && ce->Member != nullptr ) - OnUserChange( "The " + ce->Member->Name + " member of the " + static_cast(ce->Component)->Site->Name + " component has been changed." ); - } - - - /* This method handles the OnComponentChanging event to display a notification. */ - void OnComponentChanging( Object^ /*sender*/, ComponentChangingEventArgs^ ce ) - { - if ( ce->Component != nullptr && static_cast(ce->Component)->Site != nullptr && ce->Member != nullptr ) - OnUserChange( "The " + ce->Member->Name + " member of the " + static_cast(ce->Component)->Site->Name + " component is being changed." ); - } - - /* This method handles the OnComponentAdded event to display a notification. */ - void OnComponentAdded( Object^ /*sender*/, ComponentEventArgs^ ce ) - { - OnUserChange( "A component, " + ce->Component->Site->Name + ", has been added." ); - } - - /* This method handles the OnComponentAdding event to display a notification. */ - void OnComponentAdding( Object^ /*sender*/, ComponentEventArgs^ ce ) - { - OnUserChange( "A component of type " + ce->Component->GetType()->FullName + " is being added." ); - } - - /* This method handles the OnComponentRemoved event to display a notification. */ - void OnComponentRemoved( Object^ /*sender*/, ComponentEventArgs^ ce ) - { - OnUserChange( "A component, " + ce->Component->Site->Name + ", has been removed." ); - } - - /* This method handles the OnComponentRemoving event to display a notification. */ - void OnComponentRemoving( Object^ /*sender*/, ComponentEventArgs^ ce ) - { - OnUserChange( "A component, " + ce->Component->Site->Name + ", is being removed." ); - } - - /* This method handles the OnComponentRename event to display a notification. */ - void OnComponentRename( Object^ /*sender*/, ComponentRenameEventArgs^ ce ) - { - OnUserChange( "A component, " + ce->OldName + ", was renamed to " + ce->NewName + "." ); - } - - // This method adds a specified notification message to the control's listbox. - void OnUserChange( String^ text ) - { - listBox1->Items->Add( text ); - } - -public: - ComponentClass() - { - InitializeComponent(); - } - - property ISite^ Site - { - // This override allows the control to register event handlers for IComponentChangeService events - // at the time the control is sited, which happens only in design mode. - virtual ISite^ get() override - { - return Site; - } - - virtual void set( ISite^ value ) override - { - // Clear any component change event handlers. - ClearChangeNotifications(); - - // Set the new Site value. - Site = value; - m_changeService = static_cast(GetService( IComponentChangeService::typeid )); - - // Register event handlers for component change events. - RegisterChangeNotifications(); - } - } - - // Clean up any resources being used. -public: - ~ComponentClass() - { - ClearChangeNotifications(); - if ( components != nullptr ) - { - delete components; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp deleted file mode 100644 index 13ee5b9d931..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp +++ /dev/null @@ -1,61 +0,0 @@ - - -#using -#using -#using - -// -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class MyContainer: public ScrollableControl, public IContainerControl -{ -private: - Control^ activeControl; - -public: - MyContainer() - { - // Make the container control Blue so it can be distinguished on the form. - this->BackColor = Color::Blue; - - // Make the container scrollable. - this->AutoScroll = true; - } - - property Control^ ActiveControl - { - // Add implementation to the IContainerControl.ActiveControl property. - virtual Control^ get() - { - return activeControl; - } - - virtual void set( Control^ value ) - { - - // Make sure the control is a member of the ControlCollection. - if ( this->Controls->Contains( value ) ) - { - activeControl = value; - } - } - } - - // Add implementations to the IContainerControl.ActivateControl(Control) method. - virtual bool ActivateControl( Control^ active ) - { - if ( this->Controls->Contains( active ) ) - { - // Select the control and scroll the control into view if needed. - active->Select( ); - this->ScrollControlIntoView( active ); - this->activeControl = active; - return true; - } - - return false; - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp deleted file mode 100644 index 326e941da97..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp +++ /dev/null @@ -1,143 +0,0 @@ -// -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Collections; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -namespace DesignerEventServiceExample -{ - ref class DesignerMonitorDesigner; - - // DesignerMonitor provides a display for designer event notifications. - - [Designer(DesignerEventServiceExample::DesignerMonitorDesigner::typeid)] - public ref class DesignerMonitor: public UserControl - { - public: - - // List to contain strings that describe designer events. - ArrayList^ updates; - bool monitoring_events; - DesignerMonitor() - { - monitoring_events = false; - updates = gcnew ArrayList; - this->BackColor = Color::White; - this->Size = System::Drawing::Size( 450, 300 ); - } - - protected: - - // Display the message for the current mode, and any event messages if event monitoring is active. - virtual void OnPaint( PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "IDesignerEventService DesignerMonitor Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Blue ), 5, 4 ); - int yoffset = 10; - if ( !monitoring_events ) - { - yoffset += 10; - e->Graphics->DrawString( "Currently not monitoring designer events.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 10.f ); - e->Graphics->DrawString( "Use the shortcut menu commands", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 30.f ); - e->Graphics->DrawString( "provided by an associated DesignerMonitorDesigner", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 40.f ); - e->Graphics->DrawString( "to start or stop monitoring.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 50.f ); - } - else - { - e->Graphics->DrawString( "Currently monitoring designer events.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::DarkBlue ), 5.f, yoffset + 10.f ); - e->Graphics->DrawString( "Designer created, changed and disposed events:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Brown ), 5.f, yoffset + 35.f ); - for ( int i = 0; i < updates->Count; i++ ) - { - e->Graphics->DrawString( static_cast(updates[ i ]), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 55.f + (10 * i) ); - yoffset += 10; - } - } - } - }; - - // DesignerMonitorDesigner uses the IDesignerEventService to send event information - // to an associated DesignerMonitor control's updates collection. - public ref class DesignerMonitorDesigner: public ControlDesigner - { - private: - DesignerMonitor^ dm; - DesignerVerbCollection^ dvc; - int eventcount; - void StopMonitoring( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IDesignerEventService^ des = dynamic_cast(this->Control->Site->GetService( IDesignerEventService::typeid )); - if ( des != nullptr ) - { - // Remove event handlers for event notification methods. - des->DesignerCreated -= gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerCreated ); - des->DesignerDisposed -= gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerDisposed ); - des->ActiveDesignerChanged -= gcnew ActiveDesignerEventHandler( this, &DesignerMonitorDesigner::DesignerChanged ); - des->SelectionChanged -= gcnew EventHandler( this, &DesignerMonitorDesigner::SelectionChanged ); - dm->monitoring_events = false; - - // Rebuild menu with "Start monitoring" command. - array^myArray = {gcnew DesignerVerb( "Start monitoring",gcnew EventHandler( this, &DesignerMonitorDesigner::StartMonitoring ) )}; - dvc = gcnew DesignerVerbCollection( myArray ); - dm->Refresh(); - } - } - - void StartMonitoring( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IDesignerEventService^ des = dynamic_cast(this->Control->Site->GetService( IDesignerEventService::typeid )); - if ( des != nullptr ) - { - // Add event handlers for event notification methods. - des->DesignerCreated += gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerCreated ); - des->DesignerDisposed += gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerDisposed ); - des->ActiveDesignerChanged += gcnew ActiveDesignerEventHandler( this, &DesignerMonitorDesigner::DesignerChanged ); - des->SelectionChanged += gcnew EventHandler( this, &DesignerMonitorDesigner::SelectionChanged ); - dm->monitoring_events = false; - - // Rebuild menu with "Stop monitoring" command. - array^myArray = {gcnew DesignerVerb( "Stop monitoring",gcnew EventHandler( this, &DesignerMonitorDesigner::StopMonitoring ) )}; - dvc = gcnew DesignerVerbCollection( myArray ); - dm->Refresh(); - } - } - - void DesignerCreated( Object^ /*sender*/, DesignerEventArgs^ e ) - { - UpdateStatus( "Designer for " + e->Designer->RootComponent->Site->Name + " was created." ); - } - - void DesignerDisposed( Object^ /*sender*/, DesignerEventArgs^ e ) - { - UpdateStatus( "Designer for " + e->Designer->RootComponent->Site->Name + " was disposed." ); - } - - void DesignerChanged( Object^ /*sender*/, ActiveDesignerEventArgs^ e ) - { - UpdateStatus( "Active designer moved from " + e->OldDesigner->RootComponent->Site->Name + " to " + e->NewDesigner->RootComponent->Site->Name + "." ); - } - - void SelectionChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - UpdateStatus("A component selection was changed."); - } - - // Update message buffer on DesignerMonitor control. - void UpdateStatus( String^ newmsg ) - { - if ( dm->updates->Count > 10 ) - dm->updates->RemoveAt( 10 ); - - dm->updates->Insert( 0, "Event #" + eventcount.ToString() + ": " + newmsg ); - eventcount++; - dm->Refresh(); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp deleted file mode 100644 index 82ace3a89a0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp +++ /dev/null @@ -1,93 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -public ref class ExampleIDesigner: public System::ComponentModel::Design::IDesigner -{ -private: - - // Local reference to the designer's component. - IComponent^ component; - -public: - - property System::ComponentModel::IComponent^ Component - { - // Public accessor to the designer's component. - virtual System::ComponentModel::IComponent^ get() - { - return component; - } - } - ExampleIDesigner(){} - - virtual void Initialize( System::ComponentModel::IComponent^ component ) - { - // This method is called after a designer for a component is created, - // and stores a reference to the designer's component. - this->component = component; - } - - // This method peforms the 'default' action for the designer. The default action - // for a basic IDesigner implementation is invoked when the designer's component - // is double-clicked. By default, a component associated with a basic IDesigner - // implementation is displayed in the design-mode component tray. - virtual void DoDefaultAction() - { - // Shows a message box indicating that the default action for the designer was invoked. - MessageBox::Show( "The DoDefaultAction method of an IDesigner implementation was invoked.", "Information" ); - } - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - // Returns a collection of designer verb menu items to show in the - // shortcut menu for the designer's component. - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() - { - DesignerVerbCollection^ verbs = gcnew DesignerVerbCollection; - DesignerVerb^ dv1 = gcnew DesignerVerb( "Display Component Name",gcnew EventHandler( this, &ExampleIDesigner::ShowComponentName ) ); - verbs->Add( dv1 ); - return verbs; - } - } - -private: - - // Event handler for displaying a message box showing the designer's component's name. - void ShowComponentName( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->Component != nullptr ) - MessageBox::Show( this->Component->Site->Name, "Designer Component's Name" ); - } - -public: - - // Provides an opportunity to release resources before object destruction. - ~ExampleIDesigner(){} - -}; - -// A DesignerAttribute associates the example IDesigner with an example control. - -[DesignerAttribute(ExampleIDesigner::typeid)] -public ref class TestControl: public System::Windows::Forms::UserControl -{ -public: - TestControl(){} - -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp deleted file mode 100644 index 0af1a128362..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp +++ /dev/null @@ -1,151 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -// Provides a form containing a listbox that can display -// a list of project components. -public ref class DesignerHostListForm: public System::Windows::Forms::Form -{ -public: - System::Windows::Forms::ListBox^ listBox1; - -private: - System::Windows::Forms::Button^ ok_button; - -public: - DesignerHostListForm() - { - this->Name = "DesignerHostListForm"; - this->Text = "List of design-time project components"; - this->SuspendLayout(); - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->listBox1->Location = System::Drawing::Point( 8, 8 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 385, 238 ); - this->listBox1->TabIndex = 0; - this->listBox1->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); - this->ok_button = gcnew System::Windows::Forms::Button; - this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; - this->ok_button->Location = System::Drawing::Point( 232, 256 ); - this->ok_button->Name = "ok_button"; - this->ok_button->TabIndex = 1; - this->ok_button->Text = "OK"; - this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->ClientSize = System::Drawing::Size( 400, 285 ); - array^temp2 = {this->ok_button,this->listBox1}; - this->Controls->AddRange( temp2 ); - this->ResumeLayout( false ); - } - -public: - ~DesignerHostListForm() - { - } -}; - - -// You can double-click the component of an IDesignerHostExampleDesigner -// to show a form containing a listbox that lists the name and type -// of each component or control in the current design-time project. -public ref class IDesignerHostExampleDesigner: public IDesigner -{ -private: - System::ComponentModel::IComponent^ component; - -public: - IDesignerHostExampleDesigner(){} - - virtual void DoDefaultAction() - { - ListComponents(); - } - - virtual void Initialize( System::ComponentModel::IComponent^ component ) - { - this->component = component; - MessageBox::Show( "Double-click the IDesignerHostExample component to view a list of project components." ); - } - - -private: - - // Displays a list of components in the current design - // document when the default action of the designer is invoked. - void ListComponents() - { - DesignerHostListForm^ listform = gcnew DesignerHostListForm; - - // Obtain an IDesignerHost service from the design environment. - IDesignerHost^ host = dynamic_cast(this->component->Site->GetService( IDesignerHost::typeid )); - - // Get the project components container (control containment depends on Controls collections) - IContainer^ container = host->Container; - - // Add each component's type name and name to the list box. - System::Collections::IEnumerator^ myEnum = container->Components->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - IComponent^ component = safe_cast(myEnum->Current); - listform->listBox1->Items->Add( String::Concat( component->GetType()->Name, " : ", component->Site->Name ) ); - } - - listform->ShowDialog(); - } - -public: - - property System::ComponentModel::IComponent^ Component - { - virtual System::ComponentModel::IComponent^ get() - { - return this->component; - } - } - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() - { - DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; - dvc->Add( gcnew DesignerVerb( "List Components",gcnew EventHandler( this, &IDesignerHostExampleDesigner::ListHandler ) ) ); - return dvc; - } - } - -private: - void ListHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - ListComponents(); - } - -public: - ~IDesignerHostExampleDesigner(){} -}; - - -// IDesignerHostExampleComponent is a component associated -// with the IDesignerHostExampleDesigner that demonstrates -// acquisition and use of the IDesignerHost service -// to list project components. - -[DesignerAttribute(IDesignerHostExampleDesigner::typeid)] -public ref class IDesignerHostExampleComponent: public System::ComponentModel::Component -{ -public: - IDesignerHostExampleComponent(){} - -public: - ~IDesignerHostExampleComponent(){} -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp deleted file mode 100644 index 6f15f0f4abb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -namespace IDesignerOptionServiceExample -{ - // This control demonstrates retrieving the standard - // designer option service values in design mode. - public ref class IDesignerOptionServiceControl: public System::Windows::Forms::UserControl - { - private: - IDesignerOptionService^ designerOptionService; - - public: - IDesignerOptionServiceControl() - { - this->BackColor = Color::Beige; - this->Size = System::Drawing::Size( 404, 135 ); - } - - property System::ComponentModel::ISite^ Site - { - virtual System::ComponentModel::ISite^ get() override - { - return __super::Site; - } - - virtual void set( System::ComponentModel::ISite^ value ) override - { - __super::Site = value; - - // If siting component, attempt to obtain an IDesignerOptionService. - if ( __super::Site != nullptr ) - designerOptionService = dynamic_cast(this->GetService( IDesignerOptionService::typeid )); - } - } - - protected: - - // Displays control information and current IDesignerOptionService - // values, if available. - - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "IDesignerOptionServiceControl", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Blue ), 4, 4 ); - if ( this->DesignMode ) - e->Graphics->DrawString( "Currently in design mode", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 18 ); - else - e->Graphics->DrawString( "Not in design mode. Cannot access IDesignerOptionService.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Red ), 4, 18 ); - - if ( __super::Site != nullptr && designerOptionService != nullptr ) - { - e->Graphics->DrawString( "IDesignerOptionService provides access to the table of option values listed when", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 38 ); - e->Graphics->DrawString( "the Windows Forms Designer\\General tab of the Tools\\Options menu is selected.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 50 ); - e->Graphics->DrawString( "Table of standard value names and current values", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Red ), 4, 76 ); - - // Displays a table of the standard value names and current values. - int ypos = 90; - - // - // Obtains and shows the size of the standard design-mode grid square. - System::Drawing::Size size = *dynamic_cast(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "GridSize" )); - // - e->Graphics->DrawString( "GridSize", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, (float)ypos ); - e->Graphics->DrawString( size.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 100, (float)ypos ); - ypos += 12; - - // Obtains and shows whether the design mode surface grid is enabled. - bool showGrid = *dynamic_cast(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "ShowGrid" )); - e->Graphics->DrawString( "ShowGrid", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, (float)ypos ); - e->Graphics->DrawString( showGrid.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 100, (float)ypos ); - ypos += 12; - - // Obtains and shows whether components should be aligned with the surface grid. - bool snapToGrid = *dynamic_cast(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "SnapToGrid" )); - e->Graphics->DrawString( "SnapToGrid", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, (float)ypos ); - e->Graphics->DrawString( snapToGrid.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 100, (float)ypos ); - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp deleted file mode 100644 index 2b4f9c47f9b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp +++ /dev/null @@ -1,88 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::CodeDom; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace CodeDomSerializerSample -{ - ref class MyComponent; - private ref class MyCodeDomSerializer: public CodeDomSerializer - { - public: - Object^ Deserialize( IDesignerSerializationManager^ manager, Object^ codeObject ) new - { - // This is how we associate the component with the serializer. - CodeDomSerializer^ baseClassSerializer = (CodeDomSerializer^)( - manager->GetSerializer( - MyComponent::typeid->BaseType, CodeDomSerializer::typeid )); - - /* This is the simplest case, in which the class just calls the base class - to do the work. */ - return baseClassSerializer->Deserialize( manager, codeObject ); - } - - Object^ Serialize( IDesignerSerializationManager^ manager, Object^ value ) new - { - /* Associate the component with the serializer in the same manner as with - Deserialize */ - CodeDomSerializer^ baseClassSerializer = (CodeDomSerializer^)( - manager->GetSerializer( - MyComponent::typeid->BaseType, CodeDomSerializer::typeid )); - - Object^ codeObject = baseClassSerializer->Serialize( manager, value ); - - /* Anything could be in the codeObject. This sample operates on a - CodeStatementCollection. */ - if ( (CodeStatementCollection^)(codeObject) ) - { - CodeStatementCollection^ statements = (CodeStatementCollection^)(codeObject); - - // The code statement collection is valid, so add a comment. - String^ commentText = "This comment was added to this object by a custom serializer."; - CodeCommentStatement^ comment = gcnew CodeCommentStatement( commentText ); - statements->Insert( 0, comment ); - } - return codeObject; - } - }; - - // - [DesignerSerializer(CodeDomSerializerSample::MyCodeDomSerializer::typeid, - CodeDomSerializer::typeid)] - public ref class MyComponent: public Component - { - private: - String^ localProperty; - - public: - MyComponent() - { - localProperty = "Component Property Value"; - } - - property String^ LocalProperty - { - String^ get() - { - return localProperty; - } - void set( String^ value ) - { - localProperty = value; - } - } - }; -} -// -// - -[STAThread] -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp deleted file mode 100644 index 312ba502167..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp +++ /dev/null @@ -1,143 +0,0 @@ - - -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -namespace IDictionaryServiceControl -{ - ref class IDictionaryServiceDesigner; - - // This example control works with the IDictionaryServiceDesigner to demonstrate - // using the IDictionaryService for storing data provided by a designer, and - // accessing it from a control. The IDictionaryService provides a Site-specific - // key-based dictionary. An IDictionaryServiceDesigner sets an ArrayList of strings - // to the dictionary with a "DesignerData" key, and its contents are accessed and - // displayed once the Update box is clicked at design time. - - [DesignerAttribute(IDictionaryServiceDesigner::typeid,IDesigner::typeid)] - public ref class IDictionaryServiceControl: public System::Windows::Forms::UserControl - { - public: - ArrayList^ al; - IDictionaryServiceControl() - { - // Initializes the example control. - al = gcnew ArrayList; - this->Size = System::Drawing::Size( 344, 88 ); - this->BackColor = Color::White; - } - - protected: - - // Draws the instructions and user interface, and any strings contained - // in a local ArrayList. - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - if ( this->DesignMode ) - { - e->Graphics->DrawString( "IDictionaryServiceDesigner Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Blue ), 5, 4 ); - e->Graphics->DrawString( "Click the Update box to update display strings", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 5, 17 ); - e->Graphics->DrawString( "from the IDictionaryService.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 5, 29 ); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Beige ), 270, 7, 60, 10 ); - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 270, 7, 60, 10 ); - e->Graphics->DrawString( "Update", gcnew System::Drawing::Font( FontFamily::GenericMonospace,7 ), gcnew SolidBrush( Color::Black ), 282, 7 ); - for ( int i = 0; i < al->Count; i++ ) - e->Graphics->DrawString( dynamic_cast(al[ i ]), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5.0f, 44.0f + (i * 12) ); - } - } - - // On mouse down, this method attempts to access the IDictionaryService and - // obtain an ArrayList with a key of "DesignerData" in the dictionary. - // If successful, this ArrayList is set to the local ArrayList. - virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ /*e*/ ) override - { - // - // Attempts to obtain the IDictionaryService using the Control.GetService method. - IDictionaryService^ ds = dynamic_cast(GetService( IDictionaryService::typeid )); - - // If the service was obtained... - if ( ds != nullptr ) - { - // Attempts to retrieve a list with a key of "DesignerData". - ArrayList^ list = dynamic_cast(ds->GetValue( "DesignerData" )); - - // - // If the list exists, sets the list obtained by the - // IDictionaryService to the local list. - if ( list != nullptr ) - this->al = list; - this->Refresh(); - } - } - - }; - - // This designer uses the IDictionaryService to store an ArrayList of - // information strings that the associated control can access and - // display. The IDictionaryService creates a new dictionary for each Site. - public ref class IDictionaryServiceDesigner: public System::Windows::Forms::Design::ControlDesigner - { - public: - IDictionaryServiceDesigner(){} - - // On designer initialization, this method attempts to obtain - // the IDictionaryService, and populates an ArrayList - // associated with a "DesignerData" key in the dictionary with - // designer- and control-related information strings. - virtual void Initialize( System::ComponentModel::IComponent^ component ) override - { - ControlDesigner::Initialize( component ); - IDictionaryService^ ds = dynamic_cast(component->Site->GetService( IDictionaryService::typeid )); - if ( ds != nullptr ) - { - // If the dictionary service does not contain a - // DesignerData key, adds an ArrayList for that key. - if ( ds->GetValue( "DesignerData" ) == nullptr ) - { - ds->SetValue( "DesignerData", gcnew ArrayList ); - ds->SetValue( "DesignerData", gcnew ArrayList ); - } - - // Obtains the ArrayList with the "DesignerData" key - // from the dictionary service. - ArrayList^ al = dynamic_cast(ds->GetValue( "DesignerData" )); - if ( al != nullptr ) - { - al->Clear(); - - // Populates the array list with designer and - // control information strings. - al->Add( String::Format( "Designer type: {0}", this->GetType()->Name ) ); - al->Add( String::Format( "Control type: {0}", this->Control->GetType()->Name ) ); - al->Add( String::Format( "Control name: {0}", this->Control->Name ) ); - } - } - } - - protected: - virtual bool GetHitTest( System::Drawing::Point point ) override - { - // Translates the point to client coordinates and passes the - // messages to the control while over the click box. - Point translated = this->Control->PointToClient( point ); - if ( translated.X > 269 && translated.X < 331 && translated.Y > 7 && translated.Y < 18 ) - return true; - else - return ControlDesigner::GetHitTest( point ); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp deleted file mode 100644 index be6ede4f398..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp +++ /dev/null @@ -1,117 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Data; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -// This designer provides a "Connect testEvent" designer verb shortcut -// menu command. When invoked, the command attaches a new event-handler -// method named "testEventHandler" to the "testEvent" event of an -// associated control. -// If a "testEvent" event of the associated control does not exist, -// the IEventBindingService declares it. -public ref class EventDesigner: public System::Windows::Forms::Design::ControlDesigner -{ -public: - EventDesigner(){} - - // When the "Connect testEvent" designer verb shortcut menu - // command is invoked, this method uses the - // IEventBindingService to attach an event handler to a - // "textEvent" event of the associated control. -private: - void ConnectEvent( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IEventBindingService^ eventservice = dynamic_cast(this->Component->Site->GetService( System::ComponentModel::Design::IEventBindingService::typeid )); - if ( eventservice != nullptr ) - { - // Attempt to obtain a PropertyDescriptor for a - // component event named "testEvent". - EventDescriptorCollection^ edc = TypeDescriptor::GetEvents( this->Component ); - if ( edc == nullptr || edc->Count == 0 ) - return; - EventDescriptor^ ed = nullptr; - - // Search for an event named "testEvent". - IEnumerator^ myEnum = edc->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - EventDescriptor^ edi = safe_cast(myEnum->Current); - if ( edi->Name->Equals( "testEvent" ) ) - { - ed = edi; - break; - } - } - if ( ed == nullptr ) - return; - - // Use the IEventBindingService to get a - // PropertyDescriptor for the event. - PropertyDescriptor^ pd = eventservice->GetEventProperty( ed ); - if ( pd == nullptr ) - return; - - // Set the value of the event to "testEventHandler". - pd->SetValue( this->Component, "testEventHandler" ); - } - } - -public: - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - // Provides a designer verb command for the designer's - // shortcut menu. - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override - { - DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; - dvc->Add( gcnew DesignerVerb( "Connect testEvent",gcnew EventHandler( this, &EventDesigner::ConnectEvent ) ) ); - return dvc; - } - } -}; - -// EventControl is associated with the EventDesigner and displays -// instructions for demonstrating the service. - -[Designer(EventDesigner::typeid)] -public ref class EventControl: public System::Windows::Forms::UserControl -{ -public: - event System::EventHandler^ testEvent; - EventControl() - { - this->BackColor = Color::White; - this->Size = System::Drawing::Size( 320, 96 ); - } - -public: - ~EventControl() - { - } - -protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "IEventBindingService Example Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Blue ), 5, 5 ); - e->Graphics->DrawString( "Use the \"Connect testEvent\" command of the", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 22 ); - e->Graphics->DrawString( "right-click shortcut menu provided by this", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 32 ); - e->Graphics->DrawString( "control's associated EventDesigner to create", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 42 ); - e->Graphics->DrawString( "a new event handler linked with the testEvent", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 52 ); - e->Graphics->DrawString( "of this control in the initialization code", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 62 ); - e->Graphics->DrawString( "for this control.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 72 ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp deleted file mode 100644 index 5df15661f4c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp +++ /dev/null @@ -1,68 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::IO; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -public ref class HelpDesigner: public System::Windows::Forms::Design::ControlDesigner -{ -public: - HelpDesigner(){} - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override - { - array^temp0 = {gcnew DesignerVerb( "Add IHelpService Help Keyword",gcnew EventHandler( this, &HelpDesigner::addKeyword ) ),gcnew DesignerVerb( "Remove IHelpService Help Keyword",gcnew EventHandler( this, &HelpDesigner::removeKeyword ) )}; - return gcnew DesignerVerbCollection( temp0 ); - } - } - -private: - void addKeyword( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IHelpService^ hs = dynamic_cast(this->Control->Site->GetService( IHelpService::typeid )); - hs->AddContextAttribute( "keyword", "IHelpService", HelpKeywordType::F1Keyword ); - } - - void removeKeyword( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IHelpService^ hs = dynamic_cast(this->Control->Site->GetService( IHelpService::typeid )); - hs->RemoveContextAttribute( "keyword", "IHelpService" ); - } -}; - - -[Designer(HelpDesigner::typeid)] -public ref class HelpTestControl: public System::Windows::Forms::UserControl -{ -public: - HelpTestControl() - { - this->Size = System::Drawing::Size( 320, 100 ); - this->BackColor = Color::White; - } - -protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - Brush^ brush = gcnew SolidBrush( Color::Blue ); - e->Graphics->DrawString( "IHelpService Example Designer Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), brush, 5, 5 ); - e->Graphics->DrawString( "Right-click this component for", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 25 ); - e->Graphics->DrawString( "add/remove Help context keyword commands.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 35 ); - e->Graphics->DrawString( "Press F1 while this component is", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 55 ); - e->Graphics->DrawString( "selected to raise Help topics for", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 65 ); - e->Graphics->DrawString( "the current keyword or keywords", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 75 ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp deleted file mode 100644 index d89175f2476..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp +++ /dev/null @@ -1,102 +0,0 @@ -// -#using - -using namespace System; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Globalization; - -namespace NameCreationServiceExample -{ - public ref class NameCreationService: public System::ComponentModel::Design::Serialization::INameCreationService - { - public: - NameCreationService(){} - - // - // Creates an identifier for a particular data type that does not conflict - // with the identifiers of any components in the specified collection. - virtual String^ CreateName( System::ComponentModel::IContainer^ container, System::Type^ dataType ) - { - // Create a basic type name string. - String^ baseName = dataType->Name; - int uniqueID = 1; - bool unique = false; - - // Continue to increment uniqueID numeral until a - // unique ID is located. - while ( !unique ) - { - unique = true; - - // Check each component in the container for a matching - // base type name and unique ID. - for ( int i = 0; i < container->Components->Count; i++ ) - { - // Check component name for match with unique ID string. - if ( container->Components[ i ]->Site->Name->StartsWith( String::Concat( baseName, uniqueID ) ) ) - { - // If a match is encountered, set flag to recycle - // collection, increment ID numeral, and restart. - unique = false; - uniqueID++; - break; - } - } - } - - return String::Concat( baseName, uniqueID ); - } - // - - // - // Returns whether the specified name contains - // all valid character types. - virtual bool IsValidName( String^ name ) - { - for ( int i = 0; i < name->Length; i++ ) - { - Char ch = name[ i ]; - UnicodeCategory uc = Char::GetUnicodeCategory( ch ); - switch ( uc ) - { - case UnicodeCategory::UppercaseLetter: - case UnicodeCategory::LowercaseLetter: - case UnicodeCategory::TitlecaseLetter: - case UnicodeCategory::DecimalDigitNumber: - break; - - default: - return false; - } - } - return true; - } - // - - // - // Throws an exception if the specified name does not contain - // all valid character types. - virtual void ValidateName( String^ name ) - { - for ( int i = 0; i < name->Length; i++ ) - { - Char ch = name[ i ]; - UnicodeCategory uc = Char::GetUnicodeCategory( ch ); - switch ( uc ) - { - case UnicodeCategory::UppercaseLetter: - case UnicodeCategory::LowercaseLetter: - case UnicodeCategory::TitlecaseLetter: - case UnicodeCategory::DecimalDigitNumber: - break; - - default: - throw gcnew Exception( String::Format( "The name '{0}' is not a valid identifier.", name ) ); - } - } - } - // - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp deleted file mode 100644 index 3a73f1d0ba1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp +++ /dev/null @@ -1,176 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Data; -using namespace System::Windows::Forms; - -// This control displays the name and type of the primary selection -// component in design mode, if there is one, -// and uses the IReferenceService interface to display the names of -// any components of the type of the primary selected component. -// This control uses the IComponentChangeService to monitor for -// selection changed events. -public ref class IReferenceServiceControl: public System::Windows::Forms::UserControl -{ -private: - - // Indicates the name of the type of the selected component, or "None selected.". - String^ selected_typename; - - // Indicates the name of the base type of the selected component, or "None selected." - String^ selected_basetypename; - - // Indicates the name of the selected component. - String^ selected_componentname; - - // Contains the names of components of the type of the selected - // component in design mode. - array^typeComponents; - - // Contains the names of components of the base type of the selected component in design mode. - array^basetypeComponents; - - // Reference to the IComponentChangeService for the current component. - ISelectionService^ selectionService; - -public: - IReferenceServiceControl() - { - // Initializes the control properties. - this->BackColor = Color::White; - this->SetStyle( ControlStyles::ResizeRedraw, true ); - this->Name = "IReferenceServiceControl"; - this->Size = System::Drawing::Size( 500, 250 ); - - // Initializes the data properties. - typeComponents = gcnew array(0); - basetypeComponents = gcnew array(0); - selected_typename = "None selected."; - selected_basetypename = "None selected."; - selected_componentname = "None selected."; - selectionService = nullptr; - } - - - property System::ComponentModel::ISite^ Site - { - // Registers and unregisters design-mode services when - // the component is sited and unsited. - virtual System::ComponentModel::ISite^ get() override - { - // Returns the site for the control. - return __super::Site; - } - - virtual void set( System::ComponentModel::ISite^ value ) override - { - // The site is set to null when a component is cut or - // removed from a design-mode site. - // If an event handler has already been linked with - // an ISelectionService, remove the handler. - if ( selectionService != nullptr ) - selectionService->SelectionChanged -= gcnew EventHandler( this, &IReferenceServiceControl::OnSelectionChanged ); - - // Sites the control. - __super::Site = value; - - // Obtains an ISelectionService interface to register - // the selection changed event handler with. - selectionService = dynamic_cast(this->GetService( ISelectionService::typeid )); - if ( selectionService != nullptr ) - { - selectionService->SelectionChanged += gcnew EventHandler( this, &IReferenceServiceControl::OnSelectionChanged ); - - // Updates the display for the current selection, if any. - DisplayComponentsOfSelectedComponentType(); - } - } - } - -private: - - // Updates the display according to the primary selected component, - // if any, and the names of design-mode components that the - // IReferenceService returns references for when queried for - // references to components of the primary selected component's - // type and base type. - void DisplayComponentsOfSelectedComponentType() - { - // If a component is selected... - if ( selectionService->PrimarySelection != nullptr ) - { - // Sets the selected type name and selected component name to the type and name of the primary selected component. - selected_typename = selectionService->PrimarySelection->GetType()->FullName; - selected_basetypename = selectionService->PrimarySelection->GetType()->BaseType->FullName; - selected_componentname = (dynamic_cast(selectionService->PrimarySelection))->Site->Name; - - // Obtain an IReferenceService and obtain references to - // each component in the design-mode project - // of the selected component's type and base type. - IReferenceService^ rs = dynamic_cast(this->GetService( IReferenceService::typeid )); - if ( rs != nullptr ) - { - // Get references to design-mode components of the - // primary selected component's type. - array^comps = (array^)rs->GetReferences( selectionService->PrimarySelection->GetType() ); - typeComponents = gcnew array(comps->Length); - for ( int i = 0; i < comps->Length; i++ ) - typeComponents[ i ] = (dynamic_cast(comps[ i ]))->Site->Name; - - // Get references to design-mode components with a base type - // of the primary selected component's base type. - comps = (array^)rs->GetReferences( selectionService->PrimarySelection->GetType()->BaseType ); - basetypeComponents = gcnew array(comps->Length); - for ( int i = 0; i < comps->Length; i++ ) - basetypeComponents[ i ] = (dynamic_cast(comps[ i ]))->Site->Name; - } - } - else - { - selected_typename = "None selected."; - selected_basetypename = "None selected."; - selected_componentname = "None selected."; - typeComponents = gcnew array(0); - basetypeComponents = gcnew array(0); - } - - this->Refresh(); - } - - void OnSelectionChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - DisplayComponentsOfSelectedComponentType(); - } - - -protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "IReferenceService Example Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Blue ), 5, 5 ); - e->Graphics->DrawString( "Primary Selected Component from IComponentChangeService:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 5, 20 ); - e->Graphics->DrawString( String::Format( "Name: {0}", selected_componentname ), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 10, 32 ); - e->Graphics->DrawString( String::Format( "Type: {0}", selected_typename ), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 10, 44 ); - e->Graphics->DrawString( String::Format( "Base Type: {0}", selected_basetypename ), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 10, 56 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 5, 77, this->Width - 5, 77 ); - e->Graphics->DrawString( "Components of Type from IReferenceService:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 5, 85 ); - if ( !selected_typename->Equals( "None selected." ) ) - for ( int i = 0; i < typeComponents->Length; i++ ) - e->Graphics->DrawString( typeComponents[ i ], gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 20.f, 97.f + (i * 12) ); - - e->Graphics->DrawString( "Components of Base Type from IReferenceService:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 5.f, 109.f + (typeComponents->Length * 12) ); - if ( !selected_typename->Equals( "None selected." ) ) - for ( int i = 0; i < basetypeComponents->Length; i++ ) - e->Graphics->DrawString( basetypeComponents[ i ], gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 20.f, 121.f + (typeComponents->Length * 12) + (i * 12) ); - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp deleted file mode 100644 index 868a64bebfc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp +++ /dev/null @@ -1,138 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Globalization; -using namespace System::Resources; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -ref class ResourceTestControlDesigner; - -// Associates the ResourceTestControlDesigner with the -// ResourceTestControl class. - -[Designer(ResourceTestControlDesigner::typeid)] -public ref class ResourceTestControl: public System::Windows::Forms::UserControl -{ -public: - - // Initializes a string array used to store strings that - // this control displays. - array^resource_strings; - ResourceTestControl() - { - array^temp = {"Initial Default String #1","Initial Default String #2"}; - resource_strings = temp; - this->BackColor = Color::White; - this->Size = System::Drawing::Size( 408, 160 ); - } - -protected: - - // Draws the strings contained in the string array. - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "IResourceService Example Designer Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Blue ), 2, 2 ); - e->Graphics->DrawString( "String list: (use shortcut menu in design mode)", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 2, 20 ); - for ( int i = 0; i < resource_strings->Length; i++ ) - { - e->Graphics->DrawString( resource_strings[ i ], gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::SeaGreen ), 2.f, 38.f + (i * 18) ); - - } - } - -}; - -// This designer offers several menu commands for the -// shortcut menu for the associated control. -// These commands can be used to reset the control's string -// list, to generate a default resources file, or to load the string -// list for the control from the default resources file. -public ref class ResourceTestControlDesigner: public System::Windows::Forms::Design::ControlDesigner -{ -public: - ResourceTestControlDesigner(){} - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override - { - // Creates a collection of designer verb menu commands - // that link to event handlers in this designer. - array^temp0 = {gcnew DesignerVerb( "Load Strings from Default Resources File",gcnew EventHandler( this, &ResourceTestControlDesigner::LoadResources ) ),gcnew DesignerVerb( "Create Default Resources File",gcnew EventHandler( this, &ResourceTestControlDesigner::CreateResources ) ),gcnew DesignerVerb( "Clear ResourceTestControl String List",gcnew EventHandler( this, &ResourceTestControlDesigner::ClearStrings ) )}; - return gcnew DesignerVerbCollection( temp0 ); - } - } - -private: - - // Sets the string list for the control to the strings - // loaded from a resource file. - void LoadResources( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IResourceService^ rs = dynamic_cast(this->Component->Site->GetService( IResourceService::typeid )); - if ( rs == nullptr ) - throw gcnew System::Exception( "Could not obtain IResourceService." ); - - IResourceReader^ rr = rs->GetResourceReader( CultureInfo::CurrentUICulture ); - if ( rr == nullptr ) - throw gcnew System::Exception( "Resource file could not be obtained. You may need to create one first." ); - - IDictionaryEnumerator^ de = rr->GetEnumerator(); - if ( this->Control->GetType() == ResourceTestControl::typeid ) - { - ResourceTestControl^ rtc = dynamic_cast(this->Control); - String^ s1; - String^ s2; - String^ s3; - de->MoveNext(); - s1 = dynamic_cast(( *dynamic_cast(de->Current)).Value); - de->MoveNext(); - s2 = dynamic_cast(( *dynamic_cast(de->Current)).Value); - de->MoveNext(); - s3 = dynamic_cast(( *dynamic_cast(de->Current)).Value); - de->MoveNext(); - array^temp = {s1,s2,s3}; - rtc->resource_strings = temp; - this->Control->Refresh(); - } - } - - // Creates a default resource file for the current - // CultureInfo and adds 3 strings to it. - void CreateResources( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - IResourceService^ rs = dynamic_cast(this->Component->Site->GetService( IResourceService::typeid )); - if ( rs == nullptr ) - throw gcnew System::Exception( "Could not obtain IResourceService." ); - - IResourceWriter^ rw = rs->GetResourceWriter( CultureInfo::CurrentUICulture ); - rw->AddResource( "string1", "Persisted resource string #1" ); - rw->AddResource( "string2", "Persisted resource string #2" ); - rw->AddResource( "string3", "Persisted resource string #3" ); - rw->Generate(); - rw->Close(); - } - - // Clears the string list of the associated ResourceTestControl. - void ClearStrings( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->Control->GetType() == ResourceTestControl::typeid ) - { - ResourceTestControl^ rtc = dynamic_cast(this->Control); - array^temp = {"Test String #1","Test String #2"}; - rtc->resource_strings = temp; - this->Control->Refresh(); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp deleted file mode 100644 index 974d765ffcb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp +++ /dev/null @@ -1,124 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Diagnostics; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -namespace SampleRootDesigner -{ - ref class SampleRootDesigner; - - // This sample demonstrates how to provide the root designer view, or - // design mode background view, by overriding IRootDesigner.GetView(). - // The following attribute associates the SampleRootDesigner designer - // with the SampleComponent component. - - [Designer(SampleRootDesigner::typeid,IRootDesigner::typeid)] - public ref class RootDesignedComponent: public Component - { - public: - RootDesignedComponent(){} - - }; - - public ref class SampleRootDesigner: public ComponentDesigner, public IRootDesigner - { - private: - ref class RootDesignerView; - - // Member field of custom type RootDesignerView, a control that - // will be shown in the Forms designer view. This member is - // cached to reduce processing needed to recreate the - // view control on each call to GetView(). - RootDesignerView^ m_view; - - // This method returns an instance of the view for this root - // designer. The "view" is the user interface that is presented - // in a document window for the user to manipulate. - virtual Object^ GetView( ViewTechnology technology ) sealed = IRootDesigner::GetView - { - if ( technology != ViewTechnology::WindowsForms ) - { - throw gcnew ArgumentException( "Not a supported view technology","technology" ); - } - - if ( m_view == nullptr ) - { - - // Some type of displayable Form or control is required - // for a root designer that overrides GetView(). In this - // example, a Control of type RootDesignerView is used. - // Any class that inherits from Control will work. - m_view = gcnew RootDesignerView( this ); - } - - return m_view; - } - - - // IRootDesigner.SupportedTechnologies is a required override for an - // IRootDesigner. WindowsForms is the view technology used by this designer. -public: - property array^ SupportedTechnologies - { - virtual array^ get() - { - return gcnew array {ViewTechnology::Default}; - - } - } - - // RootDesignerView is a simple control that will be displayed - // in the designer window. - ref class RootDesignerView: public Control - { - private: - SampleRootDesigner^ m_designer; - - public: - RootDesignerView( SampleRootDesigner^ designer ) - { - m_designer = designer; - BackColor = Color::Blue; - Font = gcnew System::Drawing::Font( Font->FontFamily->Name,24.0f ); - } - - - protected: - virtual void OnPaint( PaintEventArgs^ pe ) override - { - Control::OnPaint( pe ); - - // Draws the name of the component in large letters. - pe->Graphics->DrawString( m_designer->Component->Site->Name, Font, Brushes::Yellow, ClientRectangle ); - } - - }; - - - }; - - - // This sample component inherits from RootDesignedComponent which - // uses the SampleRootDesigner. - public ref class RootViewSampleComponent: public RootDesignedComponent - { - public: - RootViewSampleComponent(){} - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp deleted file mode 100644 index a3fd1a3beb4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -/* This sample illustrates how to use the ISelectionService - interface to handle selection change events. The ComponentClass - control attaches event handlers when it is sited in a document - that displays a message when a component is selected or deselected. - - To run this sample, add the ComponentClass control to a Form and - then select and deselect the component to see the behavior of the - component change event handlers. */ - -public ref class ComponentClass: public UserControl -{ -private: - System::ComponentModel::Container^ components; - ListBox^ listBox1; - ISelectionService^ m_selectionService; - void InitializeComponent() - { - listBox1 = gcnew ListBox; - SuspendLayout(); - - // listBox1 - listBox1->Location = Point(24,16); - listBox1->Name = "listBox1"; - listBox1->Size = System::Drawing::Size( 560, 251 ); - listBox1->TabIndex = 0; - listBox1->SelectedIndexChanged += gcnew EventHandler( this, &ComponentClass::listBox1_SelectedIndexChanged ); - - // ComponentClass - array^myArray = {listBox1}; - Controls->AddRange( myArray ); - Name = "ComponentClass"; - Size = System::Drawing::Size( 608, 296 ); - Load += gcnew EventHandler( this, &ComponentClass::ComponentClass_Load ); - ResumeLayout( false ); - } - - // - /* This is the OnSelectionChanged handler method. This method calls - OnUserChange to display a message that indicates the name of the - handler that made the call and the type of the event argument. */ - void OnSelectionChanged( Object^ /*sender*/, EventArgs^ args ) - { - OnUserChange( "OnSelectionChanged", args->ToString() ); - } - // - - // - /* This is the OnSelectionChanging handler method. This method calls - OnUserChange to display a message that indicates the name of the - handler that made the call and the type of the event argument. */ - void OnSelectionChanging( Object^ /*sender*/, EventArgs^ args ) - { - OnUserChange( "OnSelectionChanging", args->ToString() ); - } - // - - // In this sample, all event handlers call this method - void OnUserChange( String^ text1, String^ text2 ) - { - listBox1->Items->Add( String::Concat( "Called ", text1, " using ", text2, "." ) ); - } - - void ComponentClass_Load( Object^, EventArgs^ ){} - - void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ){} - -public: - ComponentClass() - { - InitializeComponent(); - } - - property ISite^ Site - { - virtual ISite^ ComponentClass::get() override - { - return __super::Site; - } - - virtual void ComponentClass::set( ISite^ value ) override - { - // This value will always be null when not in design mode - m_selectionService = static_cast(GetService( ISelectionService::typeid )); - - /* The Selection Service works in design mode only, and only after the component is sited. - So add our services at this time */ - if ( m_selectionService != nullptr ) - { - // We are about to be re-sited. Clear our old selection change events. - m_selectionService->SelectionChanged -= gcnew EventHandler( this, &ComponentClass::OnSelectionChanged ); - m_selectionService->SelectionChanging -= gcnew EventHandler( this, &ComponentClass::OnSelectionChanging ); - } - - __super::Site = value; - - // This value will always be null when not in design mode - m_selectionService = static_cast(GetService( ISelectionService::typeid )); - - /* The Selection Service works in design mode only, and only after the component is sited. - So add our services at this time */ - if ( m_selectionService != nullptr ) - { - // - // Add SelectionChanged event handler to event - m_selectionService->SelectionChanged += gcnew EventHandler( this, &ComponentClass::OnSelectionChanged ); - // - - // - // Add SelectionChanging event handler to event - m_selectionService->SelectionChanging += gcnew EventHandler( this, &ComponentClass::OnSelectionChanging ); - // - } - } - } - -public: - - // Clean up any resources being used. - ~ComponentClass() - { - if ( components != nullptr ) - { - delete components; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp deleted file mode 100644 index 264af491f39..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp +++ /dev/null @@ -1,141 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -/* This sample demonstrates using the ISelectionService -interface to receive notification of selection change events. -The SelectionComponent control attempts to retrieve an instance -of the ISelectionService when it is sited. If it can, it attaches -event handlers for events provided by the service that display -a message when a component is selected or deselected. - -To run this sample, add the SelectionComponent control to a Form and -then select or deselect components in design mode to see the behavior -of the component change event handlers. */ -namespace ISelectionServiceExample -{ - public ref class SelectionComponent: public System::Windows::Forms::UserControl - { - private: - System::Windows::Forms::TextBox^ tbox1; - ISelectionService^ selectionService; - - public: - SelectionComponent() - { - // Initialize control - this->SuspendLayout(); - this->Name = "SelectionComponent"; - this->Size = System::Drawing::Size( 608, 296 ); - this->tbox1 = gcnew System::Windows::Forms::TextBox; - this->tbox1->Location = System::Drawing::Point( 24, 16 ); - this->tbox1->Name = "listBox1"; - this->tbox1->Multiline = true; - this->tbox1->Size = System::Drawing::Size( 560, 251 ); - this->tbox1->TabIndex = 0; - this->Controls->Add( this->tbox1 ); - this->ResumeLayout(); - } - - property ISite^ Site - { - virtual ISite^ get() override - { - return __super::Site; - } - - virtual void set( ISite^ value ) override - { - // The ISelectionService is available in design mode - // only, and only after the component is sited. - if ( selectionService != nullptr ) - { - // Because the selection service has been - // previously obtained, the component may be in - // the process of being resited. - // Detatch the previous selection change event - // handlers in case the new selection - // service is a new service instance belonging to - // another design mode service host. - selectionService->SelectionChanged -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanged ); - selectionService->SelectionChanging -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanging ); - } - - // Establish the new site for the component. - __super::Site = value; - if ( __super::Site == nullptr ) - return; - - // The selection service is not available outside of - // design mode. A call requesting the service - // using GetService while not in design mode will - // return null. - selectionService = dynamic_cast(this->Site->GetService( ISelectionService::typeid )); - - // If an instance of the ISelectionService was obtained, - // attach event handlers for the selection - // changing and selection changed events. - if ( selectionService != nullptr ) - { - // Add an event handler for the SelectionChanging - // and SelectionChanged events. - selectionService->SelectionChanging += gcnew EventHandler( this, &SelectionComponent::OnSelectionChanging ); - selectionService->SelectionChanged += gcnew EventHandler( this, &SelectionComponent::OnSelectionChanged ); - } - } - } - - private: - void OnSelectionChanged( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - tbox1->AppendText( String::Format( "The selected component was changed. Selected components:\r\n {0}\r\n", GetSelectedComponents() ) ); - } - - void OnSelectionChanging( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - tbox1->AppendText( String::Format( "The selected component is changing. Selected components:\r\n {0}\r\n", GetSelectedComponents() ) ); - } - - String^ GetSelectedComponents() - { - String^ selectedString = String::Empty; - array^components = gcnew array((dynamic_cast(selectionService->GetSelectedComponents()))->Count); - (dynamic_cast(selectionService->GetSelectedComponents()))->CopyTo( components, 0 ); - for ( int i = 0; i < components->Length; i++ ) - { - if ( i != 0 ) - selectedString = selectedString + "&& "; - - if ( (dynamic_cast(selectionService->PrimarySelection)) == (dynamic_cast(components[ i ])) ) - selectedString = selectedString + "PrimarySelection:"; - - selectedString = selectedString + (dynamic_cast(components[ i ]))->Site->Name + " "; - - } - return selectedString; - } - - // Clean up any resources being used. - public: - ~SelectionComponent() - { - // Detach the event handlers for the selection service. - if ( selectionService != nullptr ) - { - selectionService->SelectionChanging -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanging ); - selectionService->SelectionChanged -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanged ); - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp b/snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp deleted file mode 100644 index abd659a43bc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp +++ /dev/null @@ -1,580 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// This sample contains a Form class that is configured to demonstrate -// the behavior of a network of linked service containers. -// Notes regarding this IServiceContainer and IServiceProvider -// implementation: -// -// When implementing the IServiceContainer interface, you may want to -// implement support for a linked service container system -// which enables access to and sharing of services throughout a -// container tree or network. -// -// To effectively share a service, a GetService, AddService or -// RemoveService method must be able to locate a service -// that has been added to a shared service container tree or network. -// -// One simple approach to sharing services, suitable for container networks -// where each container has one parent and the tree has -// one parentless container, is to store services only at the top node -// (the root or grandparent) of a tree. -// -// To store services in the root node of a tree, two types of -// consistencies must be maintained in the implementation: -// -// > The GetService, AddService and RemoveService implementations -// must access the root through some mechanism. -// The ServiceContainerControl's implementations of these -// standard IServiceContainer methods call -// the same method of a parent container, if the container -// has been parented, to route methods to the root. -// -// > The services must be maintained at the root of the tree; -// therefore, any new child's services should be copied to the root. -ref class ServiceForm; - -// forward declaration -public enum class TextServiceState -{ - ServiceNotObtained, ServiceObtained, ServiceProvided, ServiceNotFound -}; - -// Example service type contains a text string, sufficient to -// demonstrate service sharing. -public ref class TextService -{ -public: - String^ text; - TextService() - { - this->text = String::Empty; - } - - TextService( String^ text ) - { - this->text = text; - } -}; - -// ServiceContainerControl provides an example user control implmentation -// of the IServiceContainer interface. This implementation of -// IServiceContainer supports a root-node linked service distribution, -// access. and removal architecture. -public ref class ServiceContainerControl: public System::Windows::Forms::UserControl, public IServiceContainer -{ -private: - - // List of service instances sorted by key of service type's full name. - SortedList^ localServices; - - // List that contains the Type for each service sorted by each - // service type's full name. - SortedList^ localServiceTypes; - - // The parent IServiceContainer, or null. - IServiceContainer^ parentServiceContainer; - -public: - - property IServiceContainer^ serviceParent - { - IServiceContainer^ get() - { - return parentServiceContainer; - } - - void set( IServiceContainer^ value ) - { - parentServiceContainer = value; - - // Move any services to parent. - for ( int i = 0; i < localServices->Count; i++ ) - parentServiceContainer->AddService( dynamic_cast(localServiceTypes->GetByIndex( i )), localServices->GetByIndex( i ) ); - localServices->Clear(); - localServiceTypes->Clear(); - } - } - -private: - - // The current state of the control reflecting whether it has - // obtained or provided a text service. - TextServiceState state_; - -public: - - property TextServiceState state - { - TextServiceState get() - { - return state_; - } - - void set( TextServiceState value ) - { - if ( (TextServiceState)value == TextServiceState::ServiceProvided ) - this->BackColor = Color::LightGreen; - else - if ( (TextServiceState)value == TextServiceState::ServiceNotObtained ) - this->BackColor = Color::White; - else - if ( (TextServiceState)value == TextServiceState::ServiceObtained ) - this->BackColor = Color::LightBlue; - else - if ( (TextServiceState)value == TextServiceState::ServiceNotFound ) - this->BackColor = Color::SeaShell; - - state_ = value; - } - } - -private: - - // Parent form reference for main program function access. - ServiceForm^ parent; - -public: - - // String for label displayed on the control to indicate - // the control's current service-related configuration state. - String^ label; - ServiceContainerControl( IServiceContainer^ ParentServiceContainer, System::Drawing::Size size, Point location, ServiceForm^ parent ) - { - this->state_ = TextServiceState::ServiceNotObtained; - localServices = gcnew SortedList; - localServiceTypes = gcnew SortedList; - this->BackColor = Color::Beige; - this->label = String::Empty; - this->Size = size; - this->Location = location; - this->parent = parent; - this->serviceParent = ParentServiceContainer; - - // If a parent is specified, set the parent property of this - // linkable IServiceContainer implementation. - if ( ParentServiceContainer != nullptr ) - serviceParent = ParentServiceContainer; - } - - // IServiceProvider.GetService implementation for a linked - // service container architecture. - virtual Object^ GetService( System::Type^ serviceType ) override - { - if ( parentServiceContainer != nullptr ) - return parentServiceContainer->GetService( serviceType ); - - Object^ serviceInstance = localServices[ serviceType->FullName ]; - if ( serviceInstance == nullptr ) - return nullptr; - else - if ( serviceInstance->GetType() == ServiceCreatorCallback::typeid ) - { - // If service instance is a ServiceCreatorCallback, invoke - // it to create the service. - return (dynamic_cast(serviceInstance)); - (this,serviceType); - } - - return serviceInstance; - } - - // IServiceContainer.AddService implementation for a linked - // service container architecture. - virtual void AddService( System::Type^ serviceType, System::ComponentModel::Design::ServiceCreatorCallback^ callback, bool promote ) - { - if ( promote && parentServiceContainer != nullptr ) - parentServiceContainer->AddService( serviceType, callback, true ); - else - { - localServiceTypes[ serviceType->FullName ] = serviceType; - localServices[ serviceType->FullName ] = callback; - } - } - - // IServiceContainer.AddService implementation for a linked - // service container architecture. - virtual void AddService( System::Type^ serviceType, System::ComponentModel::Design::ServiceCreatorCallback^ callback ) - { - AddService( serviceType, callback, true ); - } - - // IServiceContainer.AddService implementation for a linked - // service container architecture. - virtual void AddService( System::Type^ serviceType, Object^ serviceInstance, bool promote ) - { - if ( promote && parentServiceContainer != nullptr ) - parentServiceContainer->AddService( serviceType, serviceInstance, true ); - else - { - localServiceTypes[ serviceType->FullName ] = serviceType; - localServices[ serviceType->FullName ] = serviceInstance; - } - } - - // IServiceContainer.AddService (defaults to promote service addition). - virtual void AddService( System::Type^ serviceType, Object^ serviceInstance ) - { - AddService( serviceType, serviceInstance, true ); - } - - // IServiceContainer.RemoveService implementation for a linked - // service container architecture. - virtual void RemoveService( System::Type^ serviceType, bool promote ) - { - if ( localServices[ serviceType->FullName ] != nullptr ) - { - localServices->Remove( serviceType->FullName ); - localServiceTypes->Remove( serviceType->FullName ); - } - - if ( promote ) - { - if ( parentServiceContainer != nullptr ) - parentServiceContainer->RemoveService( serviceType ); - } - } - - // IServiceContainer.RemoveService (defaults to promote - // service removal) - virtual void RemoveService( System::Type^ serviceType ) - { - RemoveService( serviceType, true ); - } - -protected: - - // Paint method override draws the label string on the control. - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( label, gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); - } - - // Process mouse-down behavior for click. - virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) override; - -public: - - // Method accesses the TextService to test the visibility of the - // service from the control, and sets the UI state accordingly. - void ReflectServiceVisibility() - { - if ( state_ == TextServiceState::ServiceObtained ) - { - if ( GetService( TextService::typeid ) == nullptr ) - this->BackColor = Color::CadetBlue; - } - else - if ( state_ != TextServiceState::ServiceProvided ) - { - if ( GetService( TextService::typeid ) == nullptr ) - { - this->BackColor = Color::White; - return; - } - - // Service available. - if ( state_ == TextServiceState::ServiceNotFound ) - this->BackColor = Color::Khaki; - else - if ( state_ == TextServiceState::ServiceNotObtained && !label->Equals( "Service Removed" ) ) - this->BackColor = Color::Khaki; - } - } - -private: - - // ServiceCreatorCallback method creates a text service. - Object^ CreateTextService( IServiceContainer^ /*container*/, System::Type^ /*serviceType*/ ) - { - return gcnew TextService( "Test Callback" ); - } -}; - -// Example form provides UI for demonstrating service sharing behavior -// of a network of IServiceContainer/IServiceProvider controls. -public ref class ServiceForm: public System::Windows::Forms::Form -{ -private: - - // Root service container control for tree. - ServiceContainerControl^ root; - - // Button for clearing any provided services and resetting tree states. - System::Windows::Forms::Button^ reset_button; - - // Color list used to color code controls. - array^colorkeys; - - // Strings used to reflect text service. - array^keystrings; - -public: - ServiceForm() - { - InitializeComponent(); - colorkeys = gcnew array(6); - colorkeys[ 0 ] = Color::Beige; - colorkeys[ 1 ] = Color::SeaShell; - colorkeys[ 2 ] = Color::LightGreen; - colorkeys[ 3 ] = Color::LightBlue; - colorkeys[ 4 ] = Color::Khaki; - colorkeys[ 5 ] = Color::CadetBlue; - array^temp3 = {"No service use","Service not accessible","Service provided","Service obtained","Service accessible","No further access"}; - keystrings = temp3; - CreateServiceControlTree(); - } - -private: - void CreateServiceControlTree() - { - // Create root service control - ServiceContainerControl^ control1 = gcnew ServiceContainerControl( nullptr,System::Drawing::Size( 300, 40 ),Point(10,80),this ); - root = control1; - - // Create first tier - pass parent with service object control 1. - ServiceContainerControl^ control2 = gcnew ServiceContainerControl( control1,System::Drawing::Size( 200, 30 ),Point(50,160),this ); - ServiceContainerControl^ control3 = gcnew ServiceContainerControl( control1,System::Drawing::Size( 200, 30 ),Point(50,240),this ); - - // Create second tier A - pass parent with service object control 2. - ServiceContainerControl^ control4 = gcnew ServiceContainerControl( control2,System::Drawing::Size( 180, 20 ),Point(300,145),this ); - ServiceContainerControl^ control5 = gcnew ServiceContainerControl( control2,System::Drawing::Size( 180, 20 ),Point(300,185),this ); - - // Create second tier B - pass parent with service object control 3. - ServiceContainerControl^ control6 = gcnew ServiceContainerControl( control3,System::Drawing::Size( 180, 20 ),Point(300,225),this ); - ServiceContainerControl^ control7 = gcnew ServiceContainerControl( control3,System::Drawing::Size( 180, 20 ),Point(300,265),this ); - - // Add controls - array^temp0 = {control1,control2,control3,control4,control5,control6,control7}; - this->Controls->AddRange( temp0 ); - } - -internal: - void ResetServiceTree( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Remove the service from the service tree. - if ( root->GetService( TextService::typeid ) != nullptr ) - root->RemoveService( TextService::typeid, true ); - - // Set all controls to "not obtained" and clear their labels. - for ( int i = 0; i < Controls->Count; i++ ) - if ( !Controls[ i ]->Equals( reset_button ) ) - { - (dynamic_cast(Controls[ i ]))->state = TextServiceState::ServiceNotObtained; - (dynamic_cast(Controls[ i ]))->label = String::Empty; - (dynamic_cast(Controls[ i ]))->BackColor = Color::Beige; - } - } - -public: - void UpdateServiceCoverage() - { - // Have each control set state to reflect service availability. - for ( int i = 0; i < Controls->Count; i++ ) - if ( !Controls[ i ]->Equals( reset_button ) ) - (dynamic_cast(Controls[ i ]))->ReflectServiceVisibility(); - } - -private: - void InitializeComponent() - { - this->reset_button = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // reset_button - // - this->reset_button->Location = System::Drawing::Point( 392, 88 ); - this->reset_button->Name = "reset_button"; - this->reset_button->TabIndex = 0; - this->reset_button->TabStop = false; - this->reset_button->Text = "Reset"; - this->reset_button->Click += gcnew System::EventHandler( this, &ServiceForm::ResetServiceTree ); - - // - // ServiceForm - // - this->ClientSize = System::Drawing::Size( 512, 373 ); - array^temp1 = {this->reset_button}; - this->Controls->AddRange( temp1 ); - this->MinimumSize = System::Drawing::Size( 520, 400 ); - this->Name = "ServiceForm"; - this->Text = "Service Container Architecture Example"; - this->ResumeLayout( false ); - } - -protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "The following tree diagram represents a " - "hierarchy of linked service containers in controls.", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 4, 4 ); - e->Graphics->DrawString( "This example demonstrates the propagation " - "behavior of services through a linked service object tree.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 26 ); - e->Graphics->DrawString( "Right-click a component to add or replace a " - "text service, or to remove it if the component provided it.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 38 ); - e->Graphics->DrawString( "Left-click a component to update text from " - "the text service if available.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 50 ); - - // Draw lines to represent tree branches. - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 125, 20, 258 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 175, 45, 175 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 258, 45, 258 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 175, 285, 175 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 258, 285, 258 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 285, 195 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 285, 278 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 290, 155 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 195, 290, 195 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 290, 238 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 278, 290, 278 ); - - // Draw color key. - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 305, 410, 60 ); - int y = 0; - for ( int i = 0; i < 3; i++ ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 310, 20, 20 ); - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 310, 20, 20 ); - e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 50.0f + (i * 140), 315.0f ); - y++; - e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 340, 20, 20 ); - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 340, 20, 20 ); - e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 50.0f + (i * 140), 345.0f ); - y++; - - } - } -}; - -// Example Form for entering a string. -private ref class StringInputDialog: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ ok_button; - System::Windows::Forms::Button^ cancel_button; - -public: - System::Windows::Forms::TextBox^ inputTextBox; - StringInputDialog( String^ text ) - { - InitializeComponent(); - inputTextBox->Text = text; - } - -private: - void InitializeComponent() - { - this->ok_button = gcnew System::Windows::Forms::Button; - this->cancel_button = gcnew System::Windows::Forms::Button; - this->inputTextBox = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->ok_button->Location = System::Drawing::Point( 180, 43 ); - this->ok_button->Name = "ok_button"; - this->ok_button->TabIndex = 1; - this->ok_button->Text = "OK"; - this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; - this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->cancel_button->Location = System::Drawing::Point( 260, 43 ); - this->cancel_button->Name = "cancel_button"; - this->cancel_button->TabIndex = 2; - this->cancel_button->Text = "Cancel"; - this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; - this->inputTextBox->Location = System::Drawing::Point( 6, 9 ); - this->inputTextBox->Name = "inputTextBox"; - this->inputTextBox->Size = System::Drawing::Size( 327, 20 ); - this->inputTextBox->TabIndex = 0; - this->inputTextBox->Text = ""; - this->inputTextBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->ClientSize = System::Drawing::Size( 342, 73 ); - array^temp4 = {this->inputTextBox,this->cancel_button,this->ok_button}; - this->Controls->AddRange( temp4 ); - this->MinimumSize = System::Drawing::Size( 350, 100 ); - this->Name = "StringInputDialog"; - this->Text = "Text Service Provide String Dialog"; - this->ResumeLayout( false ); - } -}; - -void ServiceContainerControl::OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) -{ - // This example control responds to mouse clicks as follows: - // - // Left click - control attempts to obtain a text service - // and sets its label text to the text provided by the service - // Right click - if the control has already provided a text - // service, this control does nothing. Otherwise, the control - // shows a dialog box to specify text to provide as a new text - // service, after clearing the tree's services. - if ( e->Button == ::MouseButtons::Left ) - { - if ( state_ != TextServiceState::ServiceProvided ) - { - // Attempt to update text from service, and set - // color state accordingly. - TextService^ ts = dynamic_cast(GetService( TextService::typeid )); - if ( ts != nullptr ) - { - this->label = ts->text; - state = TextServiceState::ServiceObtained; - } - else - { - this->label = "Service Not Found"; - state = TextServiceState::ServiceNotFound; - } - } - } - - if ( e->Button == ::MouseButtons::Right ) - { - if ( state_ == TextServiceState::ServiceProvided ) - { - // Remove the service if the container provided it. - if ( GetService( TextService::typeid ) != nullptr ) - { - RemoveService( TextService::typeid, true ); - state = TextServiceState::ServiceNotObtained; - this->label = "Service Removed"; - } - } - else - { - // Obtain string and provide text service. - StringInputDialog^ form = gcnew StringInputDialog( "Test String" ); - form->StartPosition = FormStartPosition::CenterParent; - if ( form->ShowDialog() == DialogResult::OK ) - { - if ( GetService( TextService::typeid ) != nullptr ) - RemoveService( TextService::typeid, true ); - parent->ResetServiceTree( this, gcnew EventArgs ); - AddService( TextService::typeid, gcnew TextService( form->inputTextBox->Text ), true ); - - // The following commented method uses a service creator callback. - // AddService(typeof(TextService), - // new ServiceCreatorCallback(this.CreateTextService)); - state = TextServiceState::ServiceProvided; - this->label = String::Format( "Provided Text: {0}", form->inputTextBox->Text ); - } - } - } - - parent->UpdateServiceCoverage(); -} - -[STAThread] -int main() -{ - Application::Run( gcnew ServiceForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp deleted file mode 100644 index fd65944a108..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp +++ /dev/null @@ -1,239 +0,0 @@ - - -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Data; -using namespace System::Diagnostics; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -namespace IToolboxServiceExample -{ - - // This designer passes window messages to the controls at design time. - public ref class WindowMessageDesigner: public System::Windows::Forms::Design::ControlDesigner - { - public: - WindowMessageDesigner(){} - - protected: - - // Window procedure passes events to control. - - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - virtual void WndProc( System::Windows::Forms::Message% m ) override - { - if ( m.HWnd == this->Control->Handle ) - ControlDesigner::WndProc( m ); - else - ControlDesigner::DefWndProc( m ); - } - }; - - // Provides an example control that functions in design mode to - // demonstrate use of the IToolboxService to list and select toolbox - // categories and items, and to add components or controls - // to the parent form using code. - - [DesignerAttribute(IToolboxServiceExample::WindowMessageDesigner::typeid,IDesigner::typeid)] - public ref class IToolboxServiceControl: public System::Windows::Forms::UserControl - { - private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::ListBox^ listBox2; - IToolboxService^ toolboxService; - ToolboxItemCollection^ tools; - int controlSpacingMultiplier; - - public: - IToolboxServiceControl() - { - InitializeComponent(); - listBox2->DoubleClick += gcnew EventHandler( this, &IToolboxServiceControl::CreateComponent ); - controlSpacingMultiplier = 0; - } - - property System::ComponentModel::ISite^ Site - { - // Obtain or reset IToolboxService reference on each siting of control. - virtual System::ComponentModel::ISite^ get() override - { - return __super::Site; - } - - virtual void set( System::ComponentModel::ISite^ value ) override - { - __super::Site = value; - - // If the component was sited, attempt to obtain - // an IToolboxService instance. - if ( __super::Site != nullptr ) - { - toolboxService = dynamic_cast(this->GetService( IToolboxService::typeid )); - - // If an IToolboxService was located, update the - // category list. - if ( toolboxService != nullptr ) - UpdateLists(); - } - else - toolboxService = nullptr; - } - } - - private: - - // Updates the list of categories and the list of items in the - // selected category. - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - void UpdateLists() - { - if ( toolboxService != nullptr ) - { - this->listBox1->SelectedIndexChanged -= gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedCategory ); - this->listBox2->SelectedIndexChanged -= gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedItem ); - listBox1->Items->Clear(); - for ( int i = 0; i < toolboxService->CategoryNames->Count; i++ ) - { - listBox1->Items->Add( toolboxService->CategoryNames[ i ] ); - if ( toolboxService->CategoryNames[ i ] == toolboxService->SelectedCategory ) - { - listBox1->SelectedIndex = i; - tools = toolboxService->GetToolboxItems( toolboxService->SelectedCategory ); - listBox2->Items->Clear(); - for ( int j = 0; j < tools->Count; j++ ) - listBox2->Items->Add( tools[ j ]->DisplayName ); - } - } - this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedCategory ); - this->listBox2->SelectedIndexChanged += gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedItem ); - } - } - - - // Sets the selected category when a category is clicked in the - // category list. - void UpdateSelectedCategory( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( toolboxService != nullptr ) - { - toolboxService->SelectedCategory = dynamic_cast(listBox1->SelectedItem); - UpdateLists(); - } - } - - // Sets the selected item when an item is clicked in the item list. - void UpdateSelectedItem( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( toolboxService != nullptr ) - { - if ( listBox1->SelectedIndex != -1 ) - { - if ( dynamic_cast(listBox1->SelectedItem) == toolboxService->SelectedCategory ) - toolboxService->SetSelectedToolboxItem( tools[ listBox2->SelectedIndex ] ); - else - UpdateLists(); - } - } - } - - // Creates a control from a double-clicked toolbox item and adds - // it to the parent form. - void CreateComponent( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Obtains an IDesignerHost service from design environment. - IDesignerHost^ host = dynamic_cast(this->GetService( IDesignerHost::typeid )); - - // Get the project components container (Windows Forms control - // containment depends on controls collections). - IContainer^ container = host->Container; - - // Identifies the parent Form. - System::Windows::Forms::Form^ parentForm = this->FindForm(); - - // Retrieves the parent Form's designer host. - IDesignerHost^ parentHost = dynamic_cast(parentForm->Site->GetService( IDesignerHost::typeid )); - - // Create the components. - array^comps = nullptr; - try - { - comps = toolboxService->GetSelectedToolboxItem()->CreateComponents( parentHost ); - } - catch ( Exception^ ex ) - { - // Catch and show any exceptions to prevent disabling - // the control's UI. - MessageBox::Show( ex->ToString(), "Exception message" ); - } - - if ( comps == nullptr ) - return; - - // Add any created controls to the parent form's controls - // collection. Note: components are added from the - // ToolboxItem::CreateComponents(IDesignerHost*) method. - for ( int i = 0; i < comps->Length; i++ ) - { - if ( parentForm != nullptr && comps[ i ]->GetType()->IsSubclassOf( System::Windows::Forms::Control::typeid ) ) - { - (dynamic_cast(comps[ i ]))->Location = Point(20 * controlSpacingMultiplier,20 * controlSpacingMultiplier); - if ( controlSpacingMultiplier > 10 ) - controlSpacingMultiplier = 0; - else - controlSpacingMultiplier++; - parentForm->Controls->Add( dynamic_cast(comps[ i ]) ); - } - } - } - - protected: - - // Displays labels. - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "IToolboxService Control", gcnew System::Drawing::Font( "Arial",14 ), gcnew SolidBrush( Color::Black ), 6, 4 ); - e->Graphics->DrawString( "Category List", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 8, 26 ); - e->Graphics->DrawString( "Items in Category", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 208, 26 ); - e->Graphics->DrawString( "(Double-click item to add to parent form)", gcnew System::Drawing::Font( "Arial",7 ), gcnew SolidBrush( Color::Black ), 232, 12 ); - } - - private: - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->listBox2 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - this->listBox1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left); - this->listBox1->Location = System::Drawing::Point( 8, 41 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 192, 368 ); - this->listBox1->TabIndex = 0; - this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedCategory ); - this->listBox2->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->listBox2->Location = System::Drawing::Point( 208, 41 ); - this->listBox2->Name = "listBox2"; - this->listBox2->Size = System::Drawing::Size( 228, 368 ); - this->listBox2->TabIndex = 3; - this->BackColor = System::Drawing::Color::Beige; - array^temp0 = {this->listBox2,this->listBox1}; - this->Controls->AddRange( temp0 ); - this->Location = System::Drawing::Point( 500, 400 ); - this->Name = "IToolboxServiceControl*"; - this->Size = System::Drawing::Size( 442, 422 ); - this->ResumeLayout( false ); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp deleted file mode 100644 index eb3015a6390..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp +++ /dev/null @@ -1,178 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Diagnostics; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// This example contains an IRootDesigner that implements the IToolboxUser interface. -// This example demonstrates how to enable the GetToolSupported method of an IToolboxUser -// designer in order to disable specific toolbox items, and how to respond to the -// invocation of a ToolboxItem in the ToolPicked method of an IToolboxUser implementation. -public ref class SampleRootDesigner; - -// The following attribute associates the SampleRootDesigner with this example component. - -[DesignerAttribute(__typeof(SampleRootDesigner),__typeof(IRootDesigner))] -public ref class RootDesignedComponent: public Control{}; - - -// This example component class demonstrates the associated IRootDesigner which -// implements the IToolboxUser interface. When designer view is invoked, Visual -// Studio .NET attempts to display a design mode view for the class at the top -// of a code file. This can sometimes fail when the class is one of multiple types -// in a code file, and has a DesignerAttribute associating it with an IRootDesigner. -// Placing a derived class at the top of the code file solves this problem. A -// derived class is not typically needed for this reason, except that placing the -// RootDesignedComponent class in another file is not a simple solution for a code -// example that is packaged in one segment of code. -public ref class RootViewSampleComponent: public RootDesignedComponent{}; - - -// This example IRootDesigner implements the IToolboxUser interface and provides a -// Windows Forms view technology view for its associated component using an internal -// Control type. -// The following ToolboxItemFilterAttribute enables the GetToolSupported method of this -// IToolboxUser designer to be queried to check for whether to enable or disable all -// ToolboxItems which create any components whose type name begins with "System.Windows.Forms". - -[ToolboxItemFilterAttribute(S"System.Windows.Forms",ToolboxItemFilterType::Custom)] -public ref class SampleRootDesigner: public ParentControlDesigner, public IRootDesigner, public IToolboxUser -{ -public private: - ref class RootDesignerView; - -private: - - // This field is a custom Control type named RootDesignerView. This field references - // a control that is shown in the design mode document window. - RootDesignerView^ view; - - // This string array contains type names of components that should not be added to - // the component managed by this designer from the Toolbox. Any ToolboxItems whose - // type name matches a type name in this array will be marked disabled according to - // the signal returned by the IToolboxUser.GetToolSupported method of this designer. - array^blockedTypeNames; - -public: - SampleRootDesigner() - { - array^tempTypeNames = {"System.Windows.Forms.ListBox","System.Windows.Forms.GroupBox"}; - blockedTypeNames = tempTypeNames; - } - - -private: - - property array^ SupportedTechnologies - { - - // IRootDesigner.SupportedTechnologies is a required override for an IRootDesigner. - // This designer provides a display using the Windows Forms view technology. - array^ IRootDesigner::get() - { - ViewTechnology temp0[] = {ViewTechnology::WindowsForms}; - return temp0; - } - - } - - // This method returns an object that provides the view for this root designer. - Object^ IRootDesigner::GetView( ViewTechnology technology ) - { - - // If the design environment requests a view technology other than Windows - // Forms, this method throws an Argument Exception. - if ( technology != ViewTechnology::WindowsForms ) - throw gcnew ArgumentException( "An unsupported view technology was requested","Unsupported view technology." ); - - - // Creates the view object if it has not yet been initialized. - if ( view == nullptr ) - view = gcnew RootDesignerView( this ); - - return view; - } - - - // - // This method can signal whether to enable or disable the specified - // ToolboxItem when the component associated with this designer is selected. - bool IToolboxUser::GetToolSupported( ToolboxItem^ tool ) - { - - // Search the blocked type names array for the type name of the tool - // for which support for is being tested. Return false to indicate the - // tool should be disabled when the associated component is selected. - for ( int i = 0; i < blockedTypeNames->Length; i++ ) - if ( tool->TypeName == blockedTypeNames[ i ] ) - return false; - - - // Return true to indicate support for the tool, if the type name of the - // tool is not located in the blockedTypeNames string array. - return true; - } - - - // - // - // This method can perform behavior when the specified tool has been invoked. - // Invocation of a ToolboxItem typically creates a component or components, - // and adds any created components to the associated component. - void IToolboxUser::ToolPicked( ToolboxItem^ /*tool*/ ){} - - -public private: - - // - // This control provides a Windows Forms view technology view object that - // provides a display for the SampleRootDesigner. - - [DesignerAttribute(__typeof(ParentControlDesigner),__typeof(IDesigner))] - ref class RootDesignerView: public Control - { - private: - - // This field stores a reference to a designer. - IDesigner^ m_designer; - - public: - RootDesignerView( IDesigner^ designer ) - { - - // Perform basic control initialization. - m_designer = designer; - BackColor = Color::Blue; - Font = gcnew System::Drawing::Font( Font->FontFamily->Name,24.0f ); - } - - - protected: - - // This method is called to draw the view for the SampleRootDesigner. - void OnPaint( PaintEventArgs^ pe ) - { - Control::OnPaint( pe ); - - // Draw the name of the component in large letters. - pe->Graphics->DrawString( m_designer->Component->Site->Name, Font, Brushes::Yellow, ClientRectangle ); - } - - }; - - -}; - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp deleted file mode 100644 index 30b9890afe7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp +++ /dev/null @@ -1,372 +0,0 @@ -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Drawing; -using namespace System::Reflection; -using namespace System::Timers; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// Designer for a Button control which cycles the background color. -public ref class ColorCycleButtonDesigner: public System::Windows::Forms::Design::ControlDesigner -{ -private: - System::Windows::Forms::Timer^ timer1; - Color initial_bcolor; - Color initial_fcolor; - int r; - int g; - int b; - bool ru; - bool gu; - bool bu; - bool continue_; - -public: - ColorCycleButtonDesigner() - { - timer1 = gcnew System::Windows::Forms::Timer; - timer1->Interval = 50; - timer1->Tick += gcnew EventHandler( this, &ColorCycleButtonDesigner::Elapsed ); - ru = true; - gu = false; - bu = true; - continue_ = false; - timer1->Start(); - } - -private: - void Elapsed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - this->Control->BackColor = Color::FromArgb( r % 255, g % 255, b % 255 ); - this->Control->Refresh(); - - // Updates color. - if ( ru ) - r += 10; - else - if ( r > 10 ) - r -= 10; - - if ( gu ) - g += 10; - else - if ( g > 10 ) - g -= 10; - - if ( bu ) - b += 10; - else - if ( b > 10 ) - b -= 10; - - // Randomly switches direction of color component values. - Random^ rand = gcnew Random; - for ( int i = 0; i < 4; i++ ) - switch ( rand->Next( 0, 2 ) ) - { - case 0: - if ( ru ) - ru = false; - else - ru = true; - - break; - - case 1: - if ( gu ) - gu = false; - else - gu = true; - - break; - - case 2: - if ( bu ) - bu = false; - else - bu = true; - - break; - } - this->Control->ForeColor = Color::FromArgb( (this->Control->BackColor.R + 128) % 255, (this->Control->BackColor.G + 128) % 255, (this->Control->BackColor.B + 128) % 255 ); - } - -protected: - virtual void OnMouseEnter() override - { - if ( !timer1->Enabled ) - { - initial_bcolor = this->Control->BackColor; - initial_fcolor = this->Control->ForeColor; - r = initial_bcolor.R; - g = initial_bcolor.G; - b = initial_bcolor.B; - timer1->Start(); - } - } - - virtual void OnMouseLeave() override - { - if ( !continue_ ) - { - continue_ = true; - timer1->Stop(); - } - else - continue_ = false; - - this->Control->BackColor = initial_bcolor; - this->Control->ForeColor = initial_fcolor; - } - -public: - ~ColorCycleButtonDesigner() - { - timer1->Stop(); - this->Control->BackColor = initial_bcolor; - this->Control->ForeColor = initial_fcolor; - } -}; - -// Provides a TypeDescriptorFilterService to add the -// ColorCycleButtonDesigner using a DesignerAttribute. -public ref class ButtonDesignerFilterService: public System::ComponentModel::Design::ITypeDescriptorFilterService -{ -public: - ITypeDescriptorFilterService^ oldService; - ButtonDesignerFilterService(){} - - ButtonDesignerFilterService( ITypeDescriptorFilterService^ oldService_ ) - { - // Stores any previous ITypeDescriptorFilterService to implement service chaining. - this->oldService = oldService_; - } - - virtual bool FilterAttributes( System::ComponentModel::IComponent^ component, System::Collections::IDictionary^ attributes ) - { - if ( oldService != nullptr ) - oldService->FilterAttributes( component, attributes ); - - // Creates a designer attribute to compare its TypeID with the TypeID of existing attributes of the component. - DesignerAttribute^ da = gcnew DesignerAttribute( ColorCycleButtonDesigner::typeid ); - // Adds the designer attribute if the attribute collection does not contain a DesignerAttribute of the same TypeID. - if ( dynamic_cast(component) && attributes->Contains( da->TypeId ) ) - attributes[ da->TypeId ] = da; - - return true; - } - - virtual bool FilterEvents( System::ComponentModel::IComponent^ component, System::Collections::IDictionary^ events ) - { - if ( oldService != nullptr ) - oldService->FilterEvents( component, events ); - - return true; - } - - virtual bool FilterProperties( System::ComponentModel::IComponent^ component, System::Collections::IDictionary^ properties ) - { - if ( oldService != nullptr ) - oldService->FilterProperties( component, properties ); - - return true; - } -}; - - -// System.Windows.Forms.Button associated with the ColorCycleButtonDesigner. - -[Designer(ColorCycleButtonDesigner::typeid)] -public ref class ColorCycleButton: public System::Windows::Forms::Button -{ -public: - ColorCycleButton(){} - -}; - - -// Provides a designer that can add a ColorCycleButtonDesigner to each -// button in a design time project using the ButtonDesignerFilterService -// ITypeDescriptorFilterService. -public ref class ButtonDesignerFilterComponentDesigner: public System::ComponentModel::Design::ComponentDesigner -{ -private: - - // Indicates whether the service has been loaded. - bool serviceloaded; - - // Stores any old ITypeDescriptorFilterService to restore later. - ITypeDescriptorFilterService^ oldservice; - -public: - ButtonDesignerFilterComponentDesigner() - { - serviceloaded = false; - } - - // Loads the new ITypeDescriptorFilterService and reloads the - // designers for each button. - virtual void Initialize( System::ComponentModel::IComponent^ component ) override - { - ComponentDesigner::Initialize( component ); - - // Loads the custom service if it has not been loaded already - LoadService(); - - // Build list of buttons from Container.Components. - ArrayList^ buttons = gcnew ArrayList; - IEnumerator^ myEnum = this->Component->Site->Container->Components->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - IComponent^ c = safe_cast(myEnum->Current); - if ( c->GetType() == System::Windows::Forms::Button::typeid ) - buttons->Add( dynamic_cast(c) ); - } - - if ( buttons->Count > 0 ) - { - // Tests each Button for an existing - // ColorCycleButtonDesigner; - // if it has no designer of type - // ColorCycleButtonDesigner, adds a designer. - IEnumerator^ myEnum1 = buttons->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Button^ b = safe_cast(myEnum1->Current); - bool loaddesigner = true; - - // Gets the attributes for each button. - AttributeCollection^ ac = TypeDescriptor::GetAttributes( b ); - for ( int i = 0; i < ac->Count; i++ ) - { - // If designer attribute is not for a - // ColorCycleButtonDesigner, adds a new - // ColorCycleButtonDesigner. - if ( dynamic_cast(ac[ i ]) ) - { - DesignerAttribute^ da = dynamic_cast(ac[ i ]); - if ( da->DesignerTypeName->Substring( da->DesignerTypeName->LastIndexOf( "." ) + 1 )->Equals( "ColorCycleButtonDesigner" ) ) - loaddesigner = false; - } - } - if ( loaddesigner ) - { - // Saves the button location so that it - // can be repositioned. - Point p = b->Location; - - // Gets an IMenuCommandService to cut and - // paste control in order to register with - // selection and movement interface after - // designer is changed without reloading. - IMenuCommandService^ imcs = dynamic_cast(this->GetService( IMenuCommandService::typeid )); - if ( imcs == nullptr ) - throw gcnew Exception( "Could not obtain IMenuCommandService interface." ); - - // Gets an ISelectionService to select the - // button so that it can be cut and pasted. - ISelectionService^ iss = dynamic_cast(this->GetService( ISelectionService::typeid )); - if ( iss == nullptr ) - throw gcnew Exception( "Could not obtain ISelectionService interface." ); - array^temp0 = {b}; - iss->SetSelectedComponents( dynamic_cast(temp0), SelectionTypes::Normal ); - - // Invoke Cut and Paste. - imcs->GlobalInvoke( StandardCommands::Cut ); - imcs->GlobalInvoke( StandardCommands::Paste ); - - // Regains reference to button from - // selection service. - System::Windows::Forms::Button^ b2 = dynamic_cast(iss->PrimarySelection); - iss->SetSelectedComponents( nullptr ); - - // Refreshes TypeDescriptor properties of - // button to load new attributes from - // ButtonDesignerFilterService. - TypeDescriptor::Refresh( b2 ); - b2->Location = p; - b2->Focus(); - } - } - } - } - - -private: - - // Loads a ButtonDesignerFilterService ITypeDescriptorFilterService - // to add ColorCycleButtonDesigner designers to each button. - void LoadService() - { - // If no custom ITypeDescriptorFilterService is loaded, - // loads it now. - if ( !serviceloaded ) - { - // Stores the current ITypeDescriptorFilterService - // to restore later. - ITypeDescriptorFilterService^ tdfs = dynamic_cast(this->Component->Site->GetService( ITypeDescriptorFilterService::typeid )); - if ( tdfs != nullptr ) - oldservice = tdfs; - - // Retrieves an IDesignerHost interface to use to - // remove and add services. - IDesignerHost^ dh = dynamic_cast(this->Component->Site->GetService( IDesignerHost::typeid )); - if ( dh == nullptr ) - throw gcnew Exception( "Could not obtain IDesignerHost interface." ); - - // Removes standard ITypeDescriptorFilterService. - dh->RemoveService( ITypeDescriptorFilterService::typeid ); - - // Adds new custom ITypeDescriptorFilterService. - dh->AddService( ITypeDescriptorFilterService::typeid, gcnew ButtonDesignerFilterService ); - serviceloaded = true; - } - } - - // Removes the custom service and reloads any stored, - // preexisting service. - void RemoveService() - { - IDesignerHost^ dh = dynamic_cast(this->GetService( IDesignerHost::typeid )); - if ( dh == nullptr ) - throw gcnew Exception( "Could not obtain IDesignerHost interface." ); - - dh->RemoveService( ITypeDescriptorFilterService::typeid ); - if ( oldservice != nullptr ) - dh->AddService( ITypeDescriptorFilterService::typeid, oldservice ); - - serviceloaded = false; - } - -public: - ~ButtonDesignerFilterComponentDesigner() - { - if ( serviceloaded ) - RemoveService(); - } -}; - -// Component to host the ButtonDesignerFilterComponentDesigner that loads the -// ButtonDesignerFilterService ITypeDescriptorFilterService. - -[Designer(ButtonDesignerFilterComponentDesigner::typeid)] -public ref class ButtonDesignerFilterComponent: public System::ComponentModel::Component -{ -public: - ButtonDesignerFilterComponent( System::ComponentModel::IContainer^ container ) - { - container->Add( this ); - } - - ButtonDesignerFilterComponent(){} -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp deleted file mode 100644 index 9725e54d302..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp +++ /dev/null @@ -1,373 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Reflection; -using namespace System::Text; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -namespace ITypeResolutionServiceExample -{ - // Since this example provides a control-based user interface - // in design mode, this designer passes window messages to the - // controls at design time. - public ref class WindowMessageDesigner: public System::Windows::Forms::Design::ControlDesigner - { - public: - WindowMessageDesigner(){} - - protected: - - // Window procedure override passes events to the control. - - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - virtual void WndProc( System::Windows::Forms::Message% m ) override - { - if ( m.HWnd == this->Control->Handle ) - ControlDesigner::WndProc( m ); - else - this->DefWndProc( m ); - } - - public: - virtual void DoDefaultAction() override {} - - }; - - // This control provides an example design-time user interface to - // the ITypeResolutionService. - - [DesignerAttribute(WindowMessageDesigner::typeid,IDesigner::typeid)] - public ref class ITypeResolutionServiceControl: public System::Windows::Forms::UserControl - { - private: - - // Reference to a type resolution service interface, or null - // if not obtained. - ITypeResolutionService^ rs; - - // Textbox for input of assembly and type names. - System::Windows::Forms::TextBox^ entryBox; - - // Textbox for output of assembly, type, and status information. - System::Windows::Forms::TextBox^ infoBox; - - // Panel to contain the radio buttons used to select the - // method to InvokeMethod. - System::Windows::Forms::Panel^ panel1; - System::Windows::Forms::RadioButton^ radioButton1; - System::Windows::Forms::RadioButton^ radioButton2; - System::Windows::Forms::RadioButton^ radioButton3; - System::Windows::Forms::RadioButton^ radioButton4; - - // Label to display textbox entry information. - System::Windows::Forms::Label ^ label1; - - // Button to InvokeMethod command. - System::Windows::Forms::Button^ button1; - - public: - ITypeResolutionServiceControl() - { - InitializeComponent(); - rs = nullptr; - - // Attaches event handlers for control clicked events. - radioButton1->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::GetAssembly ); - radioButton2->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::GetPathToAssembly ); - radioButton3->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::GetInstanceOfType ); - radioButton4->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::ReferenceAssembly ); - button1->Click += gcnew EventHandler( this, &ITypeResolutionServiceControl::InvokeMethod ); - entryBox->KeyUp += gcnew KeyEventHandler( this, &ITypeResolutionServiceControl::InvokeOnEnterKeyHandler ); - } - - protected: - - // Displays example control name and status information. - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( "ITypeResolutionService Interface Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Blue ), 5, 5 ); - if ( this->DesignMode ) - e->Graphics->DrawString( "Currently in Design Mode", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 350, 2 ); - else - e->Graphics->DrawString( "Requires Design Mode", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 350, 2 ); - - if ( rs != nullptr ) - e->Graphics->DrawString( "Type Resolution Service Obtained", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 350, 12 ); - else - e->Graphics->DrawString( "Type Resolution Service Not Obtained", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 350, 12 ); - } - - private: - - // InvokeMethods the currently selected method, if any, when - // the InvokeMethod button is pressed. - void InvokeMethod( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // If the GetAssembly or GetPathofAssembly radio button - // is selected. - if ( this->radioButton1->Checked || this->radioButton2->Checked || this->radioButton4->Checked ) - { - if ( this->entryBox->Text->Length == 0 ) - { - // If there is no assembly name specified, display status message. - this->infoBox->Text = "You must enter the name of the assembly to retrieve."; - } - else - if ( rs != nullptr ) - { - // Create a System.Reflection.AssemblyName - // for the entered text. - AssemblyName^ name = gcnew AssemblyName; - name->Name = this->entryBox->Text->Trim(); - - // If the GetAssembly radio button is checked... - if ( this->radioButton1->Checked ) - { - // Use the ITypeResolutionService to attempt to - // resolve an assembly reference. - Assembly^ a = rs->GetAssembly( name, false ); - - // If an assembly matching the specified name was not - // located in the GAC or local project references, - // display a message. - if ( a == nullptr ) - this->infoBox->Text = String::Format( "The {0} assembly could not be located.", this->entryBox->Text ); - else - { - // An assembly matching the specified name was located. - // Builds a list of types. - array^types = a->GetTypes(); - StringBuilder^ sb = gcnew StringBuilder; - for ( int i = 0; i < types->Length; i++ ) - sb->Append( String::Concat( types[ i ]->FullName, "\r\n" ) ); - String^ path = rs->GetPathOfAssembly( name ); - - // Displays assembly information and a list of types contained in the assembly. - this->infoBox->Text = String::Format( "Assembly located:\r\n\r\n{0}\r\n at: {1}\r\n\r\nAssembly types:\r\n\r\n{2}", a->FullName, path, sb ); - } - } - else - if ( this->radioButton2->Checked ) - { - String^ path = rs->GetPathOfAssembly( name ); - if ( path != nullptr ) - this->infoBox->Text = String::Format( "Assembly located at:\r\n{0}", path ); - else - this->infoBox->Text = "Assembly was not located."; - } - else - if ( this->radioButton4->Checked ) - { - Assembly^ a = nullptr; - try - { - // Add a reference to the assembly to the - // current project. - rs->ReferenceAssembly( name ); - - // Use the ITypeResolutionService to attempt - // to resolve an assembly reference. - a = rs->GetAssembly( name, false ); - } - catch ( Exception^ ) - { - // Catch this exception so that the exception - // does not interrupt control behavior. - } - - // If an assembly matching the specified name was not - // located in the GAC or local project references, - // display a message. - if ( a == nullptr ) - this->infoBox->Text = String::Format( "The {0} assembly could not be located.", this->entryBox->Text ); - else - this->infoBox->Text = String::Format( "A reference to the {0} assembly has been added to the project's referenced assemblies.", a->FullName ); - } - } - } - else - if ( this->radioButton3->Checked ) - { - if ( this->entryBox->Text->Length == 0 ) - { - // If there is no type name specified, display a - // status message. - this->infoBox->Text = "You must enter the name of the type to retrieve."; - } - else - if ( rs != nullptr ) - { - Type^ type = nullptr; - try - { - type = rs->GetType( this->entryBox->Text, false, true ); - } - catch ( Exception^ ) - { - // Consume exceptions raised during GetType call - } - - if ( type != nullptr ) - { - // Display type information. - this->infoBox->Text = String::Format( "Type: {0} located.\r\n Namespace: {1}\r\n{2}", type->FullName, type->Namespace, type->AssemblyQualifiedName ); - } - else - this->infoBox->Text = "Type not located."; - } - } - } - - void GetAssembly( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->radioButton1->Checked ) - this->label1->Text = "Enter the assembly name:"; - } - - void GetPathToAssembly( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->radioButton2->Checked ) - this->label1->Text = "Enter the assembly name:"; - } - - void GetInstanceOfType( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->radioButton3->Checked ) - this->label1->Text = "Enter the type name:"; - } - - void ReferenceAssembly( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->radioButton4->Checked ) - this->label1->Text = "Enter the assembly name:"; - } - - void InvokeOnEnterKeyHandler( Object^ sender, KeyEventArgs^ e ) - { - if ( e->KeyCode == Keys::Enter ) - this->InvokeMethod( sender, gcnew EventArgs ); - } - - public: - - property System::ComponentModel::ISite^ Site - { - virtual System::ComponentModel::ISite^ get() override - { - return __super::Site; - } - - virtual void set( System::ComponentModel::ISite^ value ) override - { - __super::Site = value; - - // Attempts to obtain ITypeResolutionService interface. - rs = dynamic_cast(this->GetService( ITypeResolutionService::typeid )); - } - - } - - private: - void InitializeComponent() - { - this->entryBox = gcnew System::Windows::Forms::TextBox; - this->infoBox = gcnew System::Windows::Forms::TextBox; - this->panel1 = gcnew System::Windows::Forms::Panel; - this->radioButton1 = gcnew System::Windows::Forms::RadioButton; - this->radioButton2 = gcnew System::Windows::Forms::RadioButton; - this->radioButton3 = gcnew System::Windows::Forms::RadioButton; - this->radioButton4 = gcnew System::Windows::Forms::RadioButton; - this->label1 = gcnew System::Windows::Forms::Label; - this->button1 = gcnew System::Windows::Forms::Button; - this->panel1->SuspendLayout(); - this->SuspendLayout(); - - // entryBox - this->entryBox->Location = System::Drawing::Point( 176, 80 ); - this->entryBox->Name = "entryBox"; - this->entryBox->Size = System::Drawing::Size( 320, 20 ); - this->entryBox->TabIndex = 0; - this->entryBox->Text = ""; - - // infoBox - this->infoBox->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); - this->infoBox->Location = System::Drawing::Point( 16, 111 ); - this->infoBox->Multiline = true; - this->infoBox->Name = "infoBox"; - this->infoBox->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->infoBox->Size = System::Drawing::Size( 592, 305 ); - this->infoBox->TabIndex = 1; - this->infoBox->Text = ""; - - // panel1 - array^temp0 = {this->radioButton4,this->radioButton3,this->radioButton2,this->radioButton1}; - this->panel1->Controls->AddRange( temp0 ); - this->panel1->Location = System::Drawing::Point( 16, 32 ); - this->panel1->Name = "panel1"; - this->panel1->Size = System::Drawing::Size( 480, 40 ); - this->panel1->TabIndex = 2; - - // radioButton1 - this->radioButton1->Location = System::Drawing::Point( 8, 8 ); - this->radioButton1->Name = "radioButton1"; - this->radioButton1->Size = System::Drawing::Size( 96, 24 ); - this->radioButton1->TabIndex = 0; - this->radioButton1->Text = "GetAssembly"; - - // radioButton2 - this->radioButton2->Location = System::Drawing::Point( 112, 8 ); - this->radioButton2->Name = "radioButton2"; - this->radioButton2->Size = System::Drawing::Size( 128, 24 ); - this->radioButton2->TabIndex = 1; - this->radioButton2->Text = "GetPathToAssembly"; - - // radioButton3 - this->radioButton3->Location = System::Drawing::Point( 248, 8 ); - this->radioButton3->Name = "radioButton3"; - this->radioButton3->Size = System::Drawing::Size( 80, 24 ); - this->radioButton3->TabIndex = 2; - this->radioButton3->Text = "GetType"; - - // radioButton4 - this->radioButton4->Location = System::Drawing::Point( 344, 8 ); - this->radioButton4->Name = "radioButton4"; - this->radioButton4->Size = System::Drawing::Size( 128, 24 ); - this->radioButton4->TabIndex = 3; - this->radioButton4->Text = "ReferenceAssembly"; - - // label1 - this->label1->Location = System::Drawing::Point( 18, 83 ); - this->label1->Name = "label1"; - this->label1->Size = System::Drawing::Size( 150, 16 ); - this->label1->TabIndex = 3; - - // button1 - this->button1->Location = System::Drawing::Point( 519, 41 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 4; - this->button1->Text = "Invoke"; - - // ITypeResolutionServiceControl - this->BackColor = System::Drawing::Color::White; - array^temp1 = {this->button1,this->label1,this->panel1,this->infoBox,this->entryBox}; - this->Controls->AddRange( temp1 ); - this->Name = "ITypeResolutionServiceControl"; - this->Size = System::Drawing::Size( 624, 432 ); - this->panel1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp deleted file mode 100644 index a6a5d8fd47e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp +++ /dev/null @@ -1,124 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// Provides an example Form class used by the -// IUIServiceTestDesigner::showDialog method. -ref class ExampleForm: public System::Windows::Forms::Form -{ -public: - ExampleForm() - { - this->Text = "Example Form"; - System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; - okButton->Location = Point(this->Width - 70,this->Height - 70); - okButton->Size = System::Drawing::Size( 50, 20 ); - okButton->Anchor = static_cast(AnchorStyles::Right | AnchorStyles::Bottom); - okButton->DialogResult = ::DialogResult::OK; - okButton->Text = "OK"; - this->Controls->Add( okButton ); - } -}; - -// This designer provides a set of designer verb shortcut menu commands -// that call methods of the IUIService. -public ref class IUIServiceTestDesigner: public System::Windows::Forms::Design::ControlDesigner -{ -public: - IUIServiceTestDesigner(){} - - property System::ComponentModel::Design::DesignerVerbCollection^ Verbs - { - // Provides a set of designer verb menu commands that call IUIService methods. - virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override - { - array^temp0 = {gcnew DesignerVerb( "Show a test message box using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showTestMessage ) ),gcnew DesignerVerb( "Show a test error message using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showErrorMessage ) ),gcnew DesignerVerb( "Show an example Form using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showDialog ) ),gcnew DesignerVerb( "Show the Task List tool window using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showToolWindow ) )}; - return gcnew DesignerVerbCollection( temp0 ); - } - } - -private: - - // Displays a message box with message text, caption text - // and buttons of a particular MessageBoxButtons style. - void showTestMessage( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // - IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); - if ( UIservice != nullptr ) - UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore ); - // - } - - - // Displays an error message box that displays the message - // contained within a specified exception. - void showErrorMessage( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // - IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); - if ( UIservice != nullptr ) - UIservice->ShowError( gcnew Exception( "This is a message in a test exception, displayed by the IUIService",gcnew ArgumentException( "Test inner exception" ) ) ); - // - } - - // Displays an example Windows Form using the - // IUIService::ShowDialog method. - void showDialog( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // - IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); - if ( UIservice != nullptr ) - UIservice->ShowDialog( gcnew ExampleForm ); - // - } - - // Displays a standard tool window window using the - // IUIService::ShowToolWindow method. - void showToolWindow( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // - IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); - if ( UIservice != nullptr ) - UIservice->ShowToolWindow( StandardToolWindows::TaskList ); - // - } -}; - -// This control is associated with the IUIServiceTestDesigner, -// and can be sited in design mode to use the sample. - -[DesignerAttribute(IUIServiceTestDesigner::typeid,IDesigner::typeid)] -ref class IUIServiceExampleControl: public UserControl -{ -public: - IUIServiceExampleControl() - { - this->BackColor = Color::Beige; - this->Width = 255; - this->Height = 60; - } - -protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - if ( this->DesignMode ) - { - e->Graphics->DrawString( "Right-click this control to display a list of the", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 5, 6 ); - e->Graphics->DrawString( "designer verb menu commands provided", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 5, 20 ); - e->Graphics->DrawString( "by the IUIServiceTestDesigner.", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 5, 34 ); - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp b/snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp deleted file mode 100644 index 36bddada314..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -ref class TestForm: public Form -{ -public: - TestForm() - { - InitializeMyMenu(); - } - - // -public: - void InitializeMyMenu() - { - // Create the MainMenu Object^. - MainMenu^ myMainMenu = gcnew MainMenu; - - // Create the MenuItem objects. - MenuItem^ fileMenu = gcnew MenuItem( "&File" ); - MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); - MenuItem^ newFile = gcnew MenuItem( "&New" ); - MenuItem^ openFile = gcnew MenuItem( "&Open" ); - MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); - - // Add the MenuItem objects to myMainMenu. - myMainMenu->MenuItems->Add( fileMenu ); - myMainMenu->MenuItems->Add( editMenu ); - - // Add three submenus to the File menu. - fileMenu->MenuItems->Add( newFile ); - fileMenu->MenuItems->Add( openFile ); - fileMenu->MenuItems->Add( exitProgram ); - - // Assign myMainMenu to the form. - Menu = myMainMenu; - - // Retrieve the index of the Exit menu item. - String^ indexValue = fileMenu->MenuItems->IndexOf( exitProgram ).ToString(); - - // Display the result in a message box. - MessageBox::Show( "The index of the Exit menu item = " - + indexValue, "MenuItem Information" ); - } - // -}; - -int main() -{ - Application::Run( gcnew TestForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp deleted file mode 100644 index 6fcd7a9ad62..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - RichTextBox^ rtb; - -public: - Form1() - { - rtb = gcnew RichTextBox; - this->Controls->Add( rtb ); - rtb->Dock = DockStyle::Fill; - this->InputLanguageChanged += gcnew InputLanguageChangedEventHandler( this, &Form1::languageChange ); - } - - -private: - void languageChange( Object^ /*sender*/, InputLanguageChangedEventArgs^ e ) - { - - // If the input language is Japanese. - // set the initial IMEMode to Katakana. - if ( e->InputLanguage->Culture->TwoLetterISOLanguageName->Equals( "ja" ) ) - { - rtb->ImeMode = System::Windows::Forms::ImeMode::Katakana; - } - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp deleted file mode 100644 index af165ac8484..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp +++ /dev/null @@ -1,154 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Drawing; -using namespace System::Globalization; -using namespace System::Collections; -using namespace System::Reflection; - -/* This sample shows how to support code generation for a custom type of object - using a type converter and InstanceDescriptor objects. - - To use this code, copy it to a file and add the file to a project. Then add - a component to the project and declare a Triangle field and a public property - with accessors for the Triangle field on the component. - - The Triangle property will be persisted using code generation. - */ -ref class TriangleConverter; - -[TypeConverter(TriangleConverter::typeid)] -public ref class Triangle -{ -private: - - // Triangle members - Point P1; - Point P2; - Point P3; - -public: - - property Point Point1 - { - Point get() - { - return P1; - } - - void set( Point value ) - { - P1 = value; - } - } - - property Point Point2 - { - Point get() - { - return P2; - } - - void set( Point value ) - { - P2 = value; - } - } - - property Point Point3 - { - Point get() - { - return P3; - } - - void set( Point value ) - { - P3 = value; - } - - } - Triangle( Point point1, Point point2, Point point3 ) - { - P1 = point1; - P2 = point2; - P3 = point3; - } - - - /* A TypeConverter for the Triangle object. Note that you can make it internal, - private, or any scope you want and the designers will still be able to use - it through the TypeDescriptor object. This type converter provides the - capability to convert to an InstanceDescriptor. This object can be used by - the .NET Framework to generate source code that creates an instance of a - Triangle object. */ - [System::Security::Permissions::PermissionSet(System::Security:: - Permissions::SecurityAction::Demand, Name = "FullTrust")] - ref class TriangleConverter: public TypeConverter - { - public: - - /* This method overrides CanConvertTo from TypeConverter. This is called when someone - wants to convert an instance of Triangle to another type. Here, - only conversion to an InstanceDescriptor is supported. */ - virtual bool CanConvertTo( ITypeDescriptorContext^ context, Type^ destinationType ) override - { - if ( destinationType == InstanceDescriptor::typeid ) - { - return true; - } - - - // Always call the base to see if it can perform the conversion. - return TypeConverter::CanConvertTo( context, destinationType ); - } - - /* This code performs the actual conversion from a Triangle to an InstanceDescriptor. */ - virtual Object^ ConvertTo( ITypeDescriptorContext^ context, CultureInfo^ culture, Object^ value, Type^ destinationType ) override - { - if ( destinationType == InstanceDescriptor::typeid ) - { - array^type1 = {Point::typeid,Point::typeid,Point::typeid}; - ConstructorInfo^ ci = Triangle::typeid->GetConstructor( type1 ); - Triangle^ t = safe_cast(value); - array^obj1 = {t->Point1,t->Point2,t->Point3}; - return gcnew InstanceDescriptor( ci,safe_cast(obj1) ); - } - - // Always call base, even if you can't convert. - return TypeConverter::ConvertTo( context, culture, value, destinationType ); - } - }; -}; - -public ref class TestComponent: public System::ComponentModel::Component -{ -private: - Triangle^ myTriangle; - -public: - TestComponent() - { - myTriangle = gcnew Triangle( Point(5,5),Point(10,10),Point(1,8) ); - } - - property Triangle^ MyTriangle - { - Triangle^ get() - { - return myTriangle; - } - - void set( Triangle^ value ) - { - myTriangle = value; - } - } -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp deleted file mode 100644 index c1896c30445..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace menuIsParent -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - CreateMyMainMenu(); - - // - } - - protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // - public: - void CreateMyMainMenu() - { - // Create two MenuItem objects and assign to array. - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - menuItem1->Text = "&File"; - menuItem2->Text = "&Edit"; - - // Create a MainMenu and assign MenuItem objects. - array^menuMenu1Items = {menuItem1,menuItem2}; - MainMenu^ mainMenu1 = gcnew MainMenu( menuMenu1Items ); - - // Determine whether mainMenu1 contains menu items. - if ( mainMenu1->IsParent ) - { - // Set the RightToLeft property for mainMenu1. - mainMenu1->RightToLeft = ::RightToLeft::Yes; - - // Bind the MainMenu to Form1. - Menu = mainMenu1; - } - } - // - - private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew menuIsParent::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp deleted file mode 100644 index 2679aeb2da5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - - // Sizes the tabs of tabControl1. - this->tabControl1->ItemSize = System::Drawing::Size( 90, 50 ); - - // Makes the tab width definable. - this->tabControl1->SizeMode = TabSizeMode::Fixed; - array^tabControl1Controls = {tabPage1,tabPage2}; - this->tabControl1->Controls->AddRange( tabControl1Controls ); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - this->Size = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp deleted file mode 100644 index 9f84b390986..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 48, 48 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 176, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - this->textBox1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::textBox1_KeyDown ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->textBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // This example demonstrates how to use the KeyDown event with the Help class to display - // pop-up style help to the user of the application. The example filters for all variations - // of pressing the F1 key with a modifier key by using the KeyEventArgs properties passed - // to the event handling method. - // When the user presses any variation of F1 that includes any keyboard modifier, the Help - // class displays a pop-up window, similar to a ToolTip, near the control. If the user presses - // ALT + F2, a different Help pop-up is displayed with additional information. This example assumes - // that a tTextBox control, named textBox1, has been added to the form and its KeyDown - // event has been contected to this event handling method. -private: - void textBox1_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) - { - // Determine whether the key entered is the F1 key. If it is, display Help. - if ( e->KeyCode == Keys::F1 && (e->Alt || e->Control || e->Shift) ) - { - - // Display a pop-up Help topic to assist the user. - Help::ShowPopup( textBox1, "Enter your name.", Point(textBox1->Bottom,textBox1->Right) ); - } - else - if ( e->KeyCode == Keys::F2 && e->Modifiers == Keys::Alt ) - { - // Display a pop-up Help topic to provide additional assistance to the user. - Help::ShowPopup( textBox1, "Enter your first name followed by your last name. Middle name is optional.", - Point(textBox1->Top,this->textBox1->Left) ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp deleted file mode 100644 index bc1b7790715..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp +++ /dev/null @@ -1,36 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public: - Form1() - { - // Create a TextBox control. - TextBox^ tb = gcnew TextBox; - this->Controls->Add( tb ); - tb->KeyPress += gcnew KeyPressEventHandler( this, &Form1::keypressed ); - } - -private: - void keypressed( Object^ /*o*/, KeyPressEventArgs^ e ) - { - // The keypressed method uses the KeyChar property to check - // whether the ENTER key is pressed. - // If the ENTER key is pressed, the Handled property is set to true, - // to indicate the event is handled. - if ( e->KeyChar == (char)13 ) - e->Handled = true; - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp deleted file mode 100644 index 39283147fc1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - // -public: - void CreateMyLabel() - { - // Create a new label and create a bitmap. - Label^ label1 = gcnew Label; - Image^ image1 = Image::FromFile( "c:\\MyImage.bmp" ); - - // Set the size of the label to accommodate the bitmap size. - label1->Size = System::Drawing::Size( image1->Width, image1->Height ); - - // Initialize the label control's Image property. - label1->Image = image1; - - // ...Code to add the control to the form... - } - // - -protected: - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CreateMyLabel(); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp deleted file mode 100644 index 52d2d85434b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp +++ /dev/null @@ -1,149 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Button^ layoutButton; - System::ComponentModel::Container^ components; - -public: - Form1() - { - InitializeComponent(); - } - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->layoutButton = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - // layoutButton - // - this->layoutButton->Anchor = System::Windows::Forms::AnchorStyles::Bottom; - this->layoutButton->Location = System::Drawing::Point( 72, 88 ); - this->layoutButton->Name = "layoutButton"; - this->layoutButton->Size = System::Drawing::Size( 150, 23 ); - this->layoutButton->TabIndex = 0; - this->layoutButton->Text = "Hello"; - - // - // textBox1 - // - this->textBox1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->textBox1->Location = System::Drawing::Point( 24, 40 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 248, 20 ); - this->textBox1->TabIndex = 1; - this->textBox1->Text = "Hello"; - this->textBox1->TextChanged += gcnew System::EventHandler( this, &Form1::textBox1_TextChanged ); - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 24, 16 ); - this->label1->Name = "label1"; - this->label1->TabIndex = 2; - this->label1->Text = "Button's Text:"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 129 ); - array^temp0 = {this->label1,this->textBox1,this->layoutButton}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Layout Sample"; - this->Layout += gcnew System::Windows::Forms::LayoutEventHandler( this, &Form1::Form1_Layout ); - this->ResumeLayout( false ); - } - - // This method ensures that the form's width is the preferred size of 300 pixels - // or the size of the button plus 50 pixels, whichever amount is less. - void Form1_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ e ) - { - // This event is raised once at startup with the AffectedControl - // and AffectedProperty properties on the LayoutEventArgs as null. - // The event provides size preferences for that case. - if ( (e->AffectedControl != nullptr) && (e->AffectedProperty != nullptr) ) - { - // Ensure that the affected property is the Bounds property - // of the form. - if ( e->AffectedProperty->ToString()->Equals( "Bounds" ) ) - { - // If layoutButton's width plus a padding of 50 pixels is greater than the preferred - // size of 300 pixels, increase the form's width. - if ( (this->layoutButton->Width + 50) > 300 ) - { - this->Width = this->layoutButton->Width + 50; - } - // If not, keep the form's width at 300 pixels. - else - { - this->Width = 300; - } - - // Center layoutButton on the form. - this->layoutButton->Left = (this->ClientSize.Width - this->layoutButton->Width) / 2; - } - } - } - - // This method sets the Text property of layoutButton to the Text property - // of textBox1. If the new text plus a padding of 20 pixels is larger than - // the preferred size of 150 pixels, increase layoutButton's Width property. - void textBox1_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Set the Text property of layoutButton. - this->layoutButton->Text = this->textBox1->Text; - - // Get the width of the text using the proper font. - int textWidth = (int)this->CreateGraphics()->MeasureString( layoutButton->Text, layoutButton->Font ).Width; - - // If the width of the text plus a padding of 20 pixels is greater than the preferred size of - // 150 pixels, increase layoutButton's width. - if ( (textWidth + 20) > 150 ) - { - // Setting the size property on any control raises - // the Layout event for its container. - this->layoutButton->Width = textWidth + 20; - } - // If not, keep layoutButton's width at 150 pixels. - else - { - this->layoutButton->Width = 150; - } - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp b/snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp deleted file mode 100644 index 8108dbce60d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp +++ /dev/null @@ -1,99 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// - -[LicenseProvider(LicFileLicenseProvider::typeid)] -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - try - { - License^ licTest = nullptr; - licTest = LicenseManager::Validate( Form1::typeid, this ); - } - catch ( LicenseException^ licE ) - { - Console::WriteLine( licE->Message ); - Console::WriteLine( licE->LicensedType ); - Console::WriteLine( licE->StackTrace ); - Console::WriteLine( licE->Source ); - } - // - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp b/snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp deleted file mode 100644 index ceca99e1d12..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - // - // Create a new LinkLabel control. -private: - LinkLabel^ linkLabel1; - -public: - void InitializeMyLinkLabel() - { - // Set the control to autosize based on the text content. - linkLabel1->AutoSize = true; - - // Position and size the control on the form. - linkLabel1->Location = System::Drawing::Point( 8, 16 ); - linkLabel1->Size = System::Drawing::Size( 135, 13 ); - - // Set the text to display in the label. - linkLabel1->Text = "Click here to get more info."; - - // Create a new link using the Add method of the LinkCollection class. - linkLabel1->Links->Add( 6, 4, "www.microsoft.com" ); - - // Create an event handler for the LinkClicked event. - linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler( this, &Form1::linkLabel1_LinkClicked ); - - // Add the control to the form. - this->Controls->Add( linkLabel1 ); - } - -private: - void linkLabel1_LinkClicked( Object^ /*sender*/, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e ) - { - // Determine which link was clicked within the LinkLabel. - linkLabel1->Links[ linkLabel1->Links->IndexOf( e->Link ) ]->Visited = true; - - // Display the appropriate link based on the value of the LinkData property of the Link object. - System::Diagnostics::Process::Start( e->Link->LinkData->ToString() ); - } - // - -public: - Form1() - { - linkLabel1 = gcnew LinkLabel; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - InitializeMyLinkLabel(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp deleted file mode 100644 index 89e23da1c9e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp +++ /dev/null @@ -1,162 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - components = nullptr; - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - // #region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 208, 216 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 152, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - - // - // listBox1 - // - array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Alpha2","Alpha3","Bravo2","Charlie2","Delta3","Echo2","Delta2","Foxtrot2"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 192, 32 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 208, 147 ); - this->listBox1->TabIndex = 1; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 368, 216 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 2; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 496, 350 ); - array^temp1 = {this->button1,this->listBox1,this->textBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // #endregion - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - FindAllOfMyString( textBox1->Text ); - } - - // -private: - void FindAllOfMyString( String^ searchString ) - { - // Set the SelectionMode property of the ListBox to select multiple items. - listBox1->SelectionMode = SelectionMode::MultiExtended; - - // Set our intial index variable to -1. - int x = -1; - - // If the search string is empty exit. - if ( searchString->Length != 0 ) - { - // Loop through and find each item that matches the search string. - do - { - // Retrieve the item based on the previous index found. Starts with -1 which searches start. - x = listBox1->FindString( searchString, x ); - - // If no item is found that matches exit. - if ( x != -1 ) - { - // Since the FindString loops infinitely, determine if we found first item again and exit. - if ( listBox1->SelectedIndices->Count > 0 ) - { - if ( x == listBox1->SelectedIndices[ 0 ] ) - return; - } - - // Select the item in the ListBox once it is found. - listBox1->SetSelected( x, true ); - } - } - while ( x != -1 ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp deleted file mode 100644 index b950ad0543d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - components = nullptr; - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 24, 32 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 224, 108 ); - this->listBox1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 264, 32 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 104, 24 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 504, 422 ); - array^temp1 = {this->button1,this->listBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - FindMyString( "Charlie" ); - } - - // -private: - void FindMyString( String^ searchString ) - { - // Ensure we have a proper string to search for. - if ( searchString != String::Empty ) - { - // Find the item in the list and store the index to the item. - int index = listBox1->FindString( searchString ); - - // Determine if a valid index is returned. Select the item if it is valid. - if ( index != -1 ) - listBox1->SetSelected( index, true ); - else - MessageBox::Show( "The search string did not match any items in the ListBox" ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp deleted file mode 100644 index 106c014ad88..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 24, 32 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 224, 108 ); - this->listBox1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 264, 32 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 104, 24 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 504, 422 ); - array^temp1 = {this->button1,this->listBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - FindMySpecificString( "Charlie" ); - } - - // -private: - void FindMySpecificString( String^ searchString ) - { - // Ensure we have a proper string to search for. - if ( searchString != String::Empty ) - { - // Find the item in the list and store the index to the item. - int index = listBox1->FindStringExact( searchString ); - - // Determine if a valid index is returned. Select the item if it is valid. - if ( index != ListBox::NoMatches ) - listBox1->SetSelected( index, true ); - else - MessageBox::Show( "The search string did not find any items in the ListBox that exactly match the specified search string" ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp deleted file mode 100644 index d239ed6bc8b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 208, 216 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 152, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = ""; - - // - // listBox1 - // - array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Alpha2","Alpha3","Bravo2","Charlie2","Delta3","Echo2","Delta2","Foxtrot2"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 192, 32 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 208, 147 ); - this->listBox1->TabIndex = 1; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 368, 216 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 2; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 496, 350 ); - array^temp1 = {this->button1,this->listBox1,this->textBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - FindAllOfMyExactStrings( textBox1->Text ); - } - - // -private: - void FindAllOfMyExactStrings( String^ searchString ) - { - // Set the SelectionMode property of the ListBox to select multiple items. - listBox1->SelectionMode = SelectionMode::MultiExtended; - - // Set our intial index variable to -1. - int x = -1; - - // If the search string is empty exit. - if ( searchString->Length != 0 ) - { - // Loop through and find each item that matches the search string. - do - { - // Retrieve the item based on the previous index found. Starts with -1 which searches start. - x = listBox1->FindStringExact( searchString, x ); - - // If no item is found that matches exit. - if ( x != -1 ) - { - // Since the FindStringExact loops infinitely, determine if we found first item again and exit. - if ( listBox1->SelectedIndices->Count > 0 ) - { - if ( x == listBox1->SelectedIndices[ 0 ] ) - return; - } - - // Select the item in the ListBox once it is found. - listBox1->SetSelected( x, true ); - } - } - while ( x != -1 ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp deleted file mode 100644 index 72b7c6f587b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp +++ /dev/null @@ -1,158 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtro","Golf","Hotel","Igloo","Java","Koala","Lima","Mama"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 56, 40 ); - this->listBox1->Name = "listBox1"; - this->listBox1->SelectionMode = System::Windows::Forms::SelectionMode::None; - this->listBox1->Size = System::Drawing::Size( 200, 82 ); - this->listBox1->TabIndex = 0; - this->listBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::listBox1_MouseDown ); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 264, 72 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 376, 254 ); - array^temp1 = {this->button1,this->listBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void InitializeMyListBox() - { - // Add items to the ListBox. - listBox1->Items->Add( "A" ); - listBox1->Items->Add( "C" ); - listBox1->Items->Add( "E" ); - listBox1->Items->Add( "F" ); - listBox1->Items->Add( "G" ); - listBox1->Items->Add( "D" ); - listBox1->Items->Add( "B" ); - - // Sort all items added previously. - listBox1->Sorted = true; - - // Set the SelectionMode to select multiple items. - listBox1->SelectionMode = SelectionMode::MultiExtended; - - // Select three initial items from the list. - listBox1->SetSelected( 0, true ); - listBox1->SetSelected( 2, true ); - listBox1->SetSelected( 4, true ); - - // Force the ListBox to scroll back to the top of the list. - listBox1->TopIndex = 0; - } - - void InvertMySelection() - { - // Loop through all items the ListBox. - for ( int x = 0; x < listBox1->Items->Count; x++ ) - { - // Select all items that are not selected, - // deselect all items that are selected. - listBox1->SetSelected( x, !listBox1->GetSelected( x ) ); - } - listBox1->TopIndex = 0; - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - InvertMySelection(); - } - - void listBox1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ){} - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - listBox1->Items->Clear(); - this->InitializeMyListBox(); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp deleted file mode 100644 index 23dbf4f7544..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // listBox1 - // - this->listBox1->Location = System::Drawing::Point( 40, 48 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 152, 56 ); - this->listBox1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 48 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1,this->listBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - SizeMyListBox(); - } - - // -private: - void SizeMyListBox() - { - // Add items to the ListBox. - for ( int x = 0; x < 20; x++ ) - { - listBox1->Items->Add( String::Format( "Item {0}", x ) ); - } - listBox1->Height = listBox1->PreferredHeight; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp deleted file mode 100644 index 7bfec5bd78b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 64, 48 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 216, 69 ); - this->listBox1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 64 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 88, 24 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 448, 414 ); - array^temp1 = {this->button1,this->listBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - RemoveTopItems(); - } - - // -private: - void RemoveTopItems() - { - // Determine if the currently selected item in the ListBox - // is the item displayed at the top in the ListBox. - if ( listBox1->TopIndex != listBox1->SelectedIndex ) - - // Make the currently selected item the top item in the ListBox. - listBox1->TopIndex = listBox1->SelectedIndex; - - // Remove all items before the top item in the ListBox. - for ( int x = (listBox1->SelectedIndex - 1); x >= 0; x-- ) - { - listBox1->Items->RemoveAt( x ); - } - - // Clear all selections in the ListBox. - listBox1->ClearSelected(); - } - // -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp deleted file mode 100644 index 767fc4127c2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp +++ /dev/null @@ -1,125 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::ListBox^ listBox2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->listBox2 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp0 = {"A","B","C","D","E","F","G","H","I","J","K"}; - this->listBox1->Items->AddRange( temp0 ); - this->listBox1->Location = System::Drawing::Point( 40, 32 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 136, 95 ); - this->listBox1->TabIndex = 0; - this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::listBox1_SelectedIndexChanged ); - - // - // listBox2 - // - array^temp1 = {"D","A","B","E","C","F","H","G","K","I","J"}; - this->listBox2->Items->AddRange( temp1 ); - this->listBox2->Location = System::Drawing::Point( 200, 32 ); - this->listBox2->Name = "listBox2"; - this->listBox2->Size = System::Drawing::Size( 136, 95 ); - this->listBox2->TabIndex = 2; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 424, 266 ); - array^temp2 = {this->listBox2,this->listBox1}; - this->Controls->AddRange( temp2 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void listBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Get the currently selected item in the ListBox. - String^ curItem = listBox1->SelectedItem->ToString(); - - // Find the string in ListBox2. - int index = listBox2->FindString( curItem ); - - // If the item was not found in ListBox 2 display a message box, - // otherwise select it in ListBox2. - if ( index == -1 ) - MessageBox::Show( "Item is not available in ListBox2" ); - else - listBox2->SetSelected( index, true ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp deleted file mode 100644 index 457ba273b96..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 184, 48 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 88, 24 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^formControls = {this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CreateTabStopList(); - } - - // -private: - void CreateTabStopList() - { - ListBox^ listBox1 = gcnew ListBox; - listBox1->SetBounds( 20, 20, 100, 100 ); - for ( int x = 1; x < 20; x++ ) - { - listBox1->Items->Add( String::Concat( "Item\t", x ) ); - } - listBox1->UseTabStops = true; - this->Controls->Add( listBox1 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp deleted file mode 100644 index f1323d89e77..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp +++ /dev/null @@ -1,104 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::Collections; -public ref class USState -{ -private: - String^ myShortName; - String^ myLongName; - -public: - USState( String^ strLongName, String^ strShortName ) - { - this->myShortName = strShortName; - this->myLongName = strLongName; - } - - property String^ ShortName - { - String^ get() - { - return myShortName; - } - } - - property String^ LongName - { - String^ get() - { - return myLongName; - } - - } -}; - -public ref class ListBoxSample3: public Form -{ -private: - ListBox^ ListBox1; - Label^ label1; - TextBox^ textBox1; - -public: - ListBoxSample3() - { - ListBox1 = gcnew ListBox; - label1 = gcnew Label; - textBox1 = gcnew TextBox; - this->ClientSize = System::Drawing::Size(307, 206 ); - this->Text = "ListBox Sample3"; - ListBox1->Location = Point(54,16); - ListBox1->Name = "ListBox1"; - ListBox1->Size = System::Drawing::Size( 240, 130 ); - label1->Location = Point(14,150); - label1->Name = "label1"; - label1->Size = System::Drawing::Size(40, 24); - label1->Text = "Value"; - textBox1->Location = Point(54,150); - textBox1->Name = "textBox1"; - textBox1->Size = System::Drawing::Size( 240, 24 ); - array^temp2 = {ListBox1,label1, textBox1}; - this->Controls->AddRange( temp2 ); - - // - // Populate the list box using an array as DataSource. - // DisplayMember is used to display just the long name of each state. - ArrayList^ USStates = gcnew ArrayList; - USStates->Add( gcnew USState( "Alabama","AL" ) ); - USStates->Add( gcnew USState( "Washington","WA" ) ); - USStates->Add( gcnew USState( "West Virginia","WV" ) ); - USStates->Add( gcnew USState( "Wisconsin","WI" ) ); - USStates->Add( gcnew USState( "Wyoming","WY" ) ); - ListBox1->DataSource = USStates; - ListBox1->DisplayMember = "LongName"; - ListBox1->ValueMember = "ShortName"; - // - ListBox1->SelectedValueChanged += gcnew EventHandler( this, &ListBoxSample3::ListBox1_SelectedValueChanged ); - ListBox1->SetSelected(0, false); - } - - void InitializeComponent(){} - -private: - // - void ListBox1_SelectedValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - textBox1->Text=""; - if ( ListBox1->SelectedIndex != -1 ) - textBox1->Text = ListBox1->SelectedValue->ToString(); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew ListBoxSample3 ); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp deleted file mode 100644 index 234cfd0c71f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Text; - -namespace ListViewAfterLabelEditEx -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::ListView^ listView1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - array^temp1 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item A",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; - System::Windows::Forms::ListViewItem^ listViewItem1 = gcnew System::Windows::Forms::ListViewItem( temp1,-1 ); - array^temp2 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item B",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; - System::Windows::Forms::ListViewItem^ listViewItem2 = gcnew System::Windows::Forms::ListViewItem( temp2,-1 ); - array^temp3 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item C",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; - System::Windows::Forms::ListViewItem^ listViewItem3 = gcnew System::Windows::Forms::ListViewItem( temp3,-1 ); - array^temp4 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item D",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; - System::Windows::Forms::ListViewItem^ listViewItem4 = gcnew System::Windows::Forms::ListViewItem( temp4,-1 ); - this->listView1 = gcnew System::Windows::Forms::ListView; - this->SuspendLayout(); - - // - // listView1 - // - array^temp0 = {listViewItem1,listViewItem2,listViewItem3,listViewItem4}; - this->listView1->Items->AddRange( temp0 ); - this->listView1->LabelEdit = true; - this->listView1->Location = System::Drawing::Point( 16, 24 ); - this->listView1->Name = "listView1"; - this->listView1->Size = System::Drawing::Size( 424, 328 ); - this->listView1->TabIndex = 0; - this->listView1->AfterLabelEdit += gcnew System::Windows::Forms::LabelEditEventHandler( this, &Form1::MyListView_AfterLabelEdit ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 464, 422 ); - array^temp5 = {this->listView1}; - this->Controls->AddRange(temp5); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - private: - void MyListView_AfterLabelEdit( Object^ /*sender*/, System::Windows::Forms::LabelEditEventArgs^ e ) - { - // Determine if label is changed by checking for 0. - if ( e->Label == nullptr ) - return; - - // ASCIIEncoding is used to determine if a number character has been entered. - ASCIIEncoding^ AE = gcnew ASCIIEncoding; - - // Convert the new label to a character array. - array^temp = e->Label->ToCharArray(); - - // Check each character in the new label to determine if it is a number. - for ( int x = 0; x < temp->Length; x++ ) - { - // Encode the character from the character array to its ASCII code. - array^bc = AE->GetBytes( temp[ x ].ToString() ); - - // Determine if the ASCII code is within the valid range of numerical values. - if ( bc[ 0 ] > 47 && bc[ 0 ] < 58 ) - { - // Cancel the event and return the lable to its original state. - e->CancelEdit = true; - - // Display a MessageBox alerting the user that numbers are not allowed. - MessageBox::Show( "The text for the item cannot contain numerical values." ); - - // Break out of the loop and exit. - return; - } - } - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew ListViewAfterLabelEditEx::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp deleted file mode 100644 index 504325c8fe5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp +++ /dev/null @@ -1,121 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::Collections; - -// Implements the manual sorting of items by columns. -ref class ListViewItemComparer: public IComparer -{ -private: - int col; - -public: - ListViewItemComparer() - { - col = 0; - } - - ListViewItemComparer( int column ) - { - col = column; - } - - virtual int Compare( Object^ x, Object^ y ) - { - return String::Compare( (dynamic_cast(x))->SubItems[ col ]->Text, - (dynamic_cast(y))->SubItems[ col ]->Text ); - } -}; - -public ref class ListViewSortForm: public Form -{ -private: - ListView^ listView1; - -public: - ListViewSortForm() - { - // Create ListView items to add to the control. - array^temp0 = {"Banana","a","b","c"}; - ListViewItem^ listViewItem1 = gcnew ListViewItem( temp0,-1,Color::Empty,Color::Yellow,nullptr ); - array^temp1 = {"Cherry","v","g","t"}; - ListViewItem^ listViewItem2 = gcnew ListViewItem( temp1,-1,Color::Empty,Color::Red, - gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,FontStyle::Regular,GraphicsUnit::Point,0 ) ); - array^temp2 = {"Apple","h","j","n"}; - ListViewItem^ listViewItem3 = gcnew ListViewItem( temp2,-1,Color::Empty,Color::Lime,nullptr ); - array^temp3 = {"Pear","y","u","i"}; - ListViewItem^ listViewItem4 = gcnew ListViewItem( temp3,-1,Color::Empty,Color::FromArgb( 192, 128, 156 ),nullptr ); - - //Initialize the ListView control and add columns to it. - this->listView1 = gcnew ListView; - - // Set the initial sorting type for the ListView. - this->listView1->Sorting = SortOrder::None; - - // Disable automatic sorting to enable manual sorting. - this->listView1->View = View::Details; - - // Add columns and set their text. - this->listView1->Columns->Add( gcnew ColumnHeader ); - this->listView1->Columns[ 0 ]->Text = "Column 1"; - this->listView1->Columns[ 0 ]->Width = 100; - listView1->Columns->Add( gcnew ColumnHeader ); - listView1->Columns[ 1 ]->Text = "Column 2"; - listView1->Columns->Add( gcnew ColumnHeader ); - listView1->Columns[ 2 ]->Text = "Column 3"; - listView1->Columns->Add( gcnew ColumnHeader ); - listView1->Columns[ 3 ]->Text = "Column 4"; - - // Suspend control logic until form is done configuring form. - this->SuspendLayout(); - - // Add Items to the ListView control. - array^temp4 = {listViewItem1,listViewItem2,listViewItem3,listViewItem4}; - this->listView1->Items->AddRange( temp4 ); - - // Set the location and size of the ListView control. - this->listView1->Location = Point(10,10); - this->listView1->Name = "listView1"; - this->listView1->Size = System::Drawing::Size( 300, 100 ); - this->listView1->TabIndex = 0; - - // Enable editing of the items in the ListView. - this->listView1->LabelEdit = true; - - // Connect the ListView::ColumnClick event to the ColumnClick event handler. - this->listView1->ColumnClick += gcnew ColumnClickEventHandler( this, &ListViewSortForm::ColumnClick ); - - // Initialize the form. - this->ClientSize = System::Drawing::Size( 400, 400 ); - array^temp5 = {this->listView1}; - this->Controls->AddRange( temp5 ); - this->Name = "ListViewSortForm"; - this->Text = "Sorted ListView Control"; - - // Resume lay[Out] of* the form. - this->ResumeLayout( false ); - } - -private: - - // ColumnClick event handler. - void ColumnClick( Object^ /*o*/, ColumnClickEventArgs^ e ) - { - // Set the ListViewItemSorter property to a new ListViewItemComparer - // object. Setting this property immediately sorts the - // ListView using the ListViewItemComparer object. - this->listView1->ListViewItemSorter = gcnew ListViewItemComparer( e->Column ); - } -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew ListViewSortForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp deleted file mode 100644 index 0c7cdcba505..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ListBoxHorizExtentEx -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // listBox1 - // - this->listBox1->Location = System::Drawing::Point( 56, 48 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 160, 69 ); - this->listBox1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 272, 56 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 464, 334 ); - array^temp0 = {this->button1,this->listBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ sender, System::EventArgs^ e ) - { - DisplayHScroll(); - } - - // - private: - void DisplayHScroll() - { - // Make sure no items are displayed partially. - listBox1->IntegralHeight = true; - - // Add items that are wide to the ListBox. - for ( int x = 0; x < 10; x++ ) - { - listBox1->Items->Add( String::Format( "Item {0} is a very large value that requires scroll bars", x ) ); - - } - - // Display a horizontal scroll bar. - listBox1->HorizontalScrollbar = true; - - // Create a Graphics object to use when determining the size of the largest item in the ListBox. - Graphics^ g = listBox1->CreateGraphics(); - - // Determine the size for HorizontalExtent using the MeasureString method using the last item in the list. - int hzSize = (int)g->MeasureString( dynamic_cast(listBox1->Items[ listBox1->Items->Count - 1 ]), listBox1->Font ).Width; - - // Set the HorizontalExtent property. - listBox1->HorizontalExtent = hzSize; - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew ListBoxHorizExtentEx::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp deleted file mode 100644 index eb534f52c60..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 344, 360 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 104, 24 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 464, 397 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void CreateMyListView() - { - // Create a new ListView control. - ListView^ listView1 = gcnew ListView; - listView1->Bounds = Rectangle(Point(10,10),System::Drawing::Size( 300, 200 )); - - // Set the view to show details. - listView1->View = View::Details; - - // Allow the user to edit item text. - listView1->LabelEdit = true; - - // Allow the user to rearrange columns. - listView1->AllowColumnReorder = true; - - // Display check boxes. - listView1->CheckBoxes = true; - - // Select the item and subitems when selection is made. - listView1->FullRowSelect = true; - - // Display grid lines. - listView1->GridLines = true; - - // Sort the items in the list in ascending order. - listView1->Sorting = SortOrder::Ascending; - - // Create three items and three sets of subitems for each item. - ListViewItem^ item1 = gcnew ListViewItem( "item1",0 ); - - // Place a check mark next to the item. - item1->Checked = true; - item1->SubItems->Add( "1" ); - item1->SubItems->Add( "2" ); - item1->SubItems->Add( "3" ); - ListViewItem^ item2 = gcnew ListViewItem( "item2",1 ); - item2->SubItems->Add( "4" ); - item2->SubItems->Add( "5" ); - item2->SubItems->Add( "6" ); - ListViewItem^ item3 = gcnew ListViewItem( "item3",0 ); - - // Place a check mark next to the item. - item3->Checked = true; - item3->SubItems->Add( "7" ); - item3->SubItems->Add( "8" ); - item3->SubItems->Add( "9" ); - - // Create columns for the items and subitems. - // Width of -2 indicates auto-size. - listView1->Columns->Add( "Item Column", -2, HorizontalAlignment::Left ); - listView1->Columns->Add( "Column 2", -2, HorizontalAlignment::Left ); - listView1->Columns->Add( "Column 3", -2, HorizontalAlignment::Left ); - listView1->Columns->Add( "Column 4", -2, HorizontalAlignment::Center ); - - //Add the items to the ListView. - array^temp1 = {item1,item2,item3}; - listView1->Items->AddRange( temp1 ); - - // Create two ImageList objects. - ImageList^ imageListSmall = gcnew ImageList; - ImageList^ imageListLarge = gcnew ImageList; - - // Initialize the ImageList objects with bitmaps. - imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage1.bmp" ) ); - imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage2.bmp" ) ); - imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage1.bmp" ) ); - imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage2.bmp" ) ); - - //Assign the ImageList objects to the ListView. - listView1->LargeImageList = imageListLarge; - listView1->SmallImageList = imageListSmall; - - // Add the ListView to the control collection. - this->Controls->Add( listView1 ); - } - // - - void button1_Click( Object^ sender, System::EventArgs^ e ) - { - CreateMyListView(); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp deleted file mode 100644 index 2739c8e4a4d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp +++ /dev/null @@ -1,205 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Diagnostics; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -// This example demonstrates adding localization support to a component hierarchy from a -// custom IRootDesigner using the LocalizationExtenderProvider class. -namespace LocalizationExtenderProviderExample -{ - - // Example IRootDesigner implementation demonstrates LocalizationExtenderProvider support. - private ref class SampleRootDesigner: public IRootDesigner - { - private: - - // RootDesignerView is a simple control that will be displayed in the designer window. - ref class RootDesignerView: public Control - { - private: - SampleRootDesigner^ m_designer; - IComponent^ comp; - - public: - RootDesignerView( SampleRootDesigner^ designer, IComponent^ component ) - { - m_designer = designer; - this->comp = component; - BackColor = Color::Blue; - Font = gcnew System::Drawing::Font( FontFamily::GenericMonospace,12 ); - } - - - protected: - - // Displays the name of the component and the name of the assembly of the component - // that this root designer is providing support for. - virtual void OnPaint( PaintEventArgs^ pe ) override - { - Control::OnPaint( pe ); - if ( m_designer != 0 && comp != 0 ) - { - - // Draws the name of the component in large letters. - pe->Graphics->DrawString( "Root Designer View", Font, Brushes::Yellow, 8, 4 ); - pe->Graphics->DrawString( String::Concat( "Design Name : ", comp->Site->Name ), gcnew System::Drawing::Font( "Arial",10 ), Brushes::Yellow, 8, 28 ); - pe->Graphics->DrawString( String::Concat( "Assembly : ", comp->GetType()->AssemblyQualifiedName ), gcnew System::Drawing::Font( "Arial",10 ), Brushes::Yellow, System::Drawing::RectangleF( System::Drawing::Point( 8, 44 ), System::Drawing::Size( ClientRectangle.Width - 8, ClientRectangle.Height - 44 ) ) ); - - // Uses the site of the component to acquire an ISelectionService and sets the property grid focus to the component. - ISelectionService^ selectionService = dynamic_cast(comp->Site->GetService( typeid )); - if ( selectionService != nullptr ) - { - array^myArray = {m_designer->component}; - selectionService->SetSelectedComponents( static_cast(myArray) ); - } - } - } - - }; - - - protected: - - // RootDesignerView Control provides a full region designer view for this root designer's associated component. - RootDesignerView^ m_view; - - // Stores reference to the LocalizationExtenderProvider this designer adds, in order to remove it on Dispose. - LocalizationExtenderProvider^ extender; - - // Internally stores the IDesigner's component reference - IComponent^ component; - - // Provides a RootDesignerView object that supports ViewTechnology.WindowsForms. - Object^ GetView( ViewTechnology technology ) - { - if ( technology != ViewTechnology::WindowsForms ) - { - throw gcnew ArgumentException( "Not a supported view technology", "technology" ); - } - - if ( m_view == nullptr ) - { - - // Create the view control. In this example, a Control of type RootDesignerView is used. - // A WindowsForms ViewTechnology view provider requires a class that inherits from Control. - m_view = gcnew RootDesignerView( this,this->Component ); - } - - return m_view; - } - - - property array^ SupportedTechnologies - { - - // This designer supports the WindowsForms view technology. - array^ IRootDesigner::get() - { - ViewTechnology myArray[] = {ViewTechnology::WindowsForms}; - return myArray; - } - - } - - public: - - // Adds a LocalizationExtenderProvider for the component this designer is initialized to support. - void Initialize( IComponent^ component ) - { - this->component = component; - - // If no extender from this designer is active... - if ( extender == nullptr ) - { - - // - // Adds a LocalizationExtenderProvider that provides localization support properties to the specified component. - extender = gcnew LocalizationExtenderProvider( this->component->Site,this->component ); - - // - } - } - - - property DesignerVerbCollection^ Verbs - { - - // Empty IDesigner interface property and method implementations - DesignerVerbCollection^ get() - { - return nullptr; - } - - } - - property IComponent^ Component - { - IComponent^ get() - { - return this->component; - } - - } - void DoDefaultAction(){} - - void Dispose(){} - - - protected: - - // If a LocalizationExtenderProvider has been added, removes the extender provider. - void Dispose( bool disposing ) - { - - // If an extender has been added, remove it - if ( extender != nullptr ) - { - - // Disposes of the extender provider. The extender - // provider removes itself from the extender provider - // service when it is disposed. - extender->Dispose(); - extender = nullptr; - } - } - - }; - - - // The following attribute associates the RootDesignedComponent with the RootDesignedComponent component. - - [Designer(__typeof(SampleRootDesigner),__typeof(IRootDesigner))] - public ref class RootDesignedComponent: public Component - { - public: - RootDesignedComponent(){} - - }; - - - // RootViewDesignerComponent is a component associated with the SampleRootDesigner - // IRootDesigner that provides LocalizationExtenderProvider localization support. - // This derived class is included at the top of this example to enable - // easy launching of designer view without having to put the class in its own file. - public ref class RootViewDesignerComponent: public RootDesignedComponent - { - public: - RootViewDesignerComponent(){} - - }; - -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp deleted file mode 100644 index 95f6244a515..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::ComponentModel::Container^ components; - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - // listBox1 - // - this->listBox1->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawVariable; - this->listBox1->Location = System::Drawing::Point( 16, 48 ); - this->listBox1->Name = "listBox1"; - this->listBox1->SelectionMode = System::Windows::Forms::SelectionMode::MultiExtended; - this->listBox1->Size = System::Drawing::Size( 256, 134 ); - this->listBox1->TabIndex = 0; - this->listBox1->MeasureItem += gcnew System::Windows::Forms::MeasureItemEventHandler( this, &Form1::listBox1_MeasureItem ); - this->listBox1->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::listBox1_DrawItem ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->listBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void listBox1_MeasureItem( Object^ /*sender*/, MeasureItemEventArgs^ e ) - { - System::Drawing::Font^ font = (dynamic_cast(listBox1->Items[ e->Index ]))->Font; - SizeF stringSize = e->Graphics->MeasureString( font->Name, font ); - - // Set the height and width of the item - e->ItemHeight = (int)stringSize.Height; - e->ItemWidth = (int)stringSize.Width; - } - - // For efficiency, cache the brush to use for drawing. - SolidBrush^ foreColorBrush; - void listBox1_DrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) - { - Brush^ brush; - - // Create the brush using the ForeColor specified by the DrawItemEventArgs - if ( foreColorBrush == nullptr ) - foreColorBrush = gcnew SolidBrush( e->ForeColor ); - else - if ( foreColorBrush->Color != e->ForeColor ) - { - // The control's ForeColor has changed, so dispose of the cached brush and - // create a new one. - delete foreColorBrush; - foreColorBrush = gcnew SolidBrush( e->ForeColor ); - } - - // Select the appropriate brush depending on if the item is selected. - // Since State can be a combinateion (bit-flag) of enum values, you can't use - // "==" to compare them. - if ( (e->State & DrawItemState::Selected) == DrawItemState::Selected ) - brush = SystemBrushes::HighlightText; - else - brush = foreColorBrush; - - // Perform the painting. - System::Drawing::Font^ font = (dynamic_cast(listBox1->Items[ e->Index ]))->Font; - e->DrawBackground(); - e->Graphics->DrawString( font->Name, font, brush, e->Bounds ); - e->DrawFocusRectangle(); - } - -public: - - /// - /// A wrapper class for use with storing Fonts in a ListBox. Since ListBox uses the - /// ToString() of its items for the text it displays, this class is needed to return - /// the name of the font, rather than its ToString() value. - /// - ref class ListBoxFontItem - { - public: - System::Drawing::Font^ Font; - ListBoxFontItem( System::Drawing::Font^ f ) - { - Font = f; - } - - virtual String^ ToString() override - { - return Font->Name; - } - }; -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp deleted file mode 100644 index 5598f1c56d6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp +++ /dev/null @@ -1,38 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Security::Permissions; - -namespace CppMenuCommand -{ - // - public ref class CDesigner: public ComponentDesigner - { - public: - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - virtual void Initialize( IComponent^ comp ) override - { - ComponentDesigner::Initialize( comp ); - IMenuCommandService^ mcs = static_cast(comp->Site->GetService( IMenuCommandService::typeid )); - MenuCommand^ mc = gcnew MenuCommand( gcnew EventHandler( this, &CDesigner::OnF1Help ),StandardCommands::F1Help ); - mc->Enabled = true; - mc->Visible = true; - mc->Supported = true; - mcs->AddCommand( mc ); - System::Windows::Forms::MessageBox::Show( "Initialize() has been invoked." ); - } - - private: - void OnF1Help( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - System::Windows::Forms::MessageBox::Show( "F1Help has been invoked." ); - } - }; -} -// -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp deleted file mode 100644 index b7d3456a1d0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp +++ /dev/null @@ -1,177 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::MainMenu^ mainMenu1; - System::Windows::Forms::MenuItem^ menuEdit; - System::Windows::Forms::MenuItem^ menuCut; - System::Windows::Forms::MenuItem^ menuCopy; - System::Windows::Forms::MenuItem^ menuPaste; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::MenuItem^ menuDelete; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->menuEdit = gcnew System::Windows::Forms::MenuItem; - this->menuCut = gcnew System::Windows::Forms::MenuItem; - this->menuCopy = gcnew System::Windows::Forms::MenuItem; - this->menuPaste = gcnew System::Windows::Forms::MenuItem; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->menuDelete = gcnew System::Windows::Forms::MenuItem; - this->SuspendLayout(); - - // - // mainMenu1 - // - array^temp0 = {this->menuEdit}; - this->mainMenu1->MenuItems->AddRange( temp0 ); - - // - // menuEdit - // - this->menuEdit->Index = 0; - array^temp1 = {this->menuCut,this->menuCopy,this->menuPaste,this->menuDelete}; - this->menuEdit->MenuItems->AddRange( temp1 ); - this->menuEdit->Text = "&Edit"; - this->menuEdit->Popup += gcnew System::EventHandler( this, &Form1::PopupMyMenu ); - - // - // menuCut - // - this->menuCut->Index = 0; - this->menuCut->Text = "Cu&t"; - - // - // menuCopy - // - this->menuCopy->Index = 1; - this->menuCopy->Text = "&Copy"; - - // - // menuPaste - // - this->menuPaste->Index = 2; - this->menuPaste->Text = "&Paste"; - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 120, 153 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 168, 20 ); - this->textBox1->TabIndex = 1; - this->textBox1->Text = "textBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 304, 152 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - - // - // menuDelete - // - this->menuDelete->Index = 3; - this->menuDelete->Text = "&Delete"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 408, 326 ); - array^temp2 = {this->button1,this->textBox1}; - this->Controls->AddRange( temp2 ); - this->Menu = this->mainMenu1; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void PopupMyMenu( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( !textBox1->Enabled || !textBox1->Focused || textBox1->SelectedText->Length == 0 ) - { - menuCut->Enabled = false; - menuCopy->Enabled = false; - menuDelete->Enabled = false; - } - else - { - menuCut->Enabled = true; - menuCopy->Enabled = true; - menuDelete->Enabled = true; - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// End Class CDesigner -// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp deleted file mode 100644 index ced6500ad8f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::StatusBar^ statusBar1; - System::Windows::Forms::StatusBarPanel^ statusBarPanel1; - System::Windows::Forms::MainMenu^ mainMenu1; - System::Windows::Forms::MenuItem^ menuItem1; - System::Windows::Forms::MenuItem^ menuItem4; - System::Windows::Forms::MenuItem^ menuOpen; - System::Windows::Forms::MenuItem^ menuSave; - System::Windows::Forms::MenuItem^ menuExit; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->statusBar1 = gcnew System::Windows::Forms::StatusBar; - this->statusBarPanel1 = gcnew System::Windows::Forms::StatusBarPanel; - this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->menuItem1 = gcnew System::Windows::Forms::MenuItem; - this->menuOpen = gcnew System::Windows::Forms::MenuItem; - this->menuSave = gcnew System::Windows::Forms::MenuItem; - this->menuItem4 = gcnew System::Windows::Forms::MenuItem; - this->menuExit = gcnew System::Windows::Forms::MenuItem; - (dynamic_cast(this->statusBarPanel1))->BeginInit(); - this->SuspendLayout(); - - // - // statusBar1 - // - this->statusBar1->Location = System::Drawing::Point( 0, 496 ); - this->statusBar1->Name = "statusBar1"; - array^temp0 = {this->statusBarPanel1}; - this->statusBar1->Panels->AddRange( temp0 ); - this->statusBar1->ShowPanels = true; - this->statusBar1->Size = System::Drawing::Size( 536, 22 ); - this->statusBar1->TabIndex = 0; - this->statusBar1->Text = "statusBar1"; - - // - // statusBarPanel1 - // - this->statusBarPanel1->AutoSize = System::Windows::Forms::StatusBarPanelAutoSize::Spring; - this->statusBarPanel1->Text = "statusBarPanel1"; - this->statusBarPanel1->Width = 520; - - // - // mainMenu1 - // - array^temp1 = {this->menuItem1}; - this->mainMenu1->MenuItems->AddRange( temp1 ); - - // - // menuItem1 - // - this->menuItem1->Index = 0; - array^temp2 = {this->menuOpen,this->menuSave,this->menuItem4,this->menuExit}; - this->menuItem1->MenuItems->AddRange( temp2 ); - this->menuItem1->Text = "&File"; - - // - // menuOpen - // - this->menuOpen->Index = 0; - this->menuOpen->Text = "&Open"; - this->menuOpen->Select += gcnew System::EventHandler( this, &Form1::MenuSelected ); - - // - // menuSave - // - this->menuSave->Index = 1; - this->menuSave->Text = "&Save"; - this->menuSave->Select += gcnew System::EventHandler( this, &Form1::MenuSelected ); - - // - // menuItem4 - // - this->menuItem4->Index = 2; - this->menuItem4->Text = "-"; - - // - // menuExit - // - this->menuExit->Index = 3; - this->menuExit->Text = "E&xit"; - this->menuExit->Select += gcnew System::EventHandler( this, &Form1::MenuSelected ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 536, 518 ); - array^temp3 = {this->statusBar1}; - this->Controls->AddRange( temp3 ); - this->Menu = this->mainMenu1; - this->Name = "Form1"; - this->Text = "Form1"; - (dynamic_cast(this->statusBarPanel1))->EndInit(); - this->ResumeLayout( false ); - } - - // -private: - void MenuSelected( Object^ sender, System::EventArgs^ /*e*/ ) - { - if ( sender == menuOpen ) - statusBar1->Panels[ 0 ]->Text = "Opens a file to edit"; - else - if ( sender == menuSave ) - statusBar1->Panels[ 0 ]->Text = "Saves the current file"; - else - if ( sender == menuExit ) - statusBar1->Panels[ 0 ]->Text = "Exits the application"; - else - statusBar1->Panels[ 0 ]->Text = "Ready"; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// End Class CDesigner -// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp deleted file mode 100644 index 8d8c236d033..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - CreateMyMenu(); - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -public: - void CreateMyMenu() - { - // Create a main menu object. - MainMenu^ mainMenu1 = gcnew MainMenu; - - // Create empty menu item objects. - MenuItem^ topMenuItem = gcnew MenuItem; - MenuItem^ menuItem1 = gcnew MenuItem; - - // Set the caption of the menu items. - topMenuItem->Text = "&File"; - menuItem1->Text = "&Open"; - - // Add the menu items to the main menu. - topMenuItem->MenuItems->Add( menuItem1 ); - mainMenu1->MenuItems->Add( topMenuItem ); - - // Add functionality to the menu items using the Click event. - menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - -private: - void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create a new OpenFileDialog and display it. - OpenFileDialog^ fd = gcnew OpenFileDialog; - fd->DefaultExt = "*."; - fd->ShowDialog(); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// End Class CDesigner -// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp deleted file mode 100644 index d91733cf31e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - InitializeMyMainMenu(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -private: - void InitializeMyMainMenu() - { - // Create the 2 menus and the menu items to add. - MainMenu^ mainMenu1 = gcnew MainMenu; - MainMenu^ mainMenu2 = gcnew MainMenu; - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - - // Set the caption for the menu items. - menuItem1->Text = "File"; - menuItem2->Text = "Edit"; - - // Add a menu item to each menu for displaying. - mainMenu1->MenuItems->Add( menuItem1 ); - mainMenu2->MenuItems->Add( menuItem2 ); - - // Merge mainMenu2 with mainMenu1 - mainMenu1->MergeMenu( mainMenu2 ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// End Class CDesigner -// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp deleted file mode 100644 index f9eb80c569a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ serverName; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->serverName = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // serverName - // - this->serverName->Location = System::Drawing::Point( 32, 40 ); - this->serverName->Name = "serverName"; - this->serverName->TabIndex = 0; - this->serverName->Text = "textBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 40, 96 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {this->button1,this->serverName}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - validateUserEntry(); - validateUserEntry2(); - validateUserEntry3(); - validateUserEntry4(); - validateUserEntry5(); - } - - // -private: - void validateUserEntry() - { - // Checks the value of the text. - if ( serverName->Text->Length == 0 ) - { - // Initializes the variables to pass to the MessageBox::Show method. - String^ message = "You did not enter a server name. Cancel this operation?"; - String^ caption = "No Server Name Specified"; - MessageBoxButtons buttons = MessageBoxButtons::YesNo; - System::Windows::Forms::DialogResult result; - - // Displays the MessageBox. - result = MessageBox::Show( this, message, caption, buttons ); - if ( result == ::DialogResult::Yes ) - { - // Closes the parent form. - this->Close(); - } - } - } - // - - // -private: - void validateUserEntry2() - { - // Checks the value of the text. - if ( serverName->Text->Length == 0 ) - { - // Initializes the variables to pass to the MessageBox::Show method. - String^ message = "You did not enter a server name. Cancel this operation?"; - String^ caption = "No Server Name Specified"; - MessageBoxButtons buttons = MessageBoxButtons::YesNo; - System::Windows::Forms::DialogResult result; - - // Displays the MessageBox. - result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign ); - if ( result == ::DialogResult::Yes ) - { - // Closes the parent form. - this->Close(); - } - } - } - // - - // -private: - void validateUserEntry3() - { - // Checks the value of the text. - if ( serverName->Text->Length == 0 ) - { - // Initializes the variables to pass to the MessageBox::Show method. - String^ message = "You did not enter a server name. Cancel this operation?"; - String^ caption = "No Server Name Specified"; - MessageBoxButtons buttons = MessageBoxButtons::YesNo; - System::Windows::Forms::DialogResult result; - - // Displays the MessageBox. - result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1 ); - if ( result == ::DialogResult::Yes ) - { - // Closes the parent form. - this->Close(); - } - } - } - // - - // -private: - void validateUserEntry4() - { - // Checks the value of the text. - if ( serverName->Text->Length == 0 ) - { - // Initializes the variables to pass to the MessageBox::Show method. - String^ message = "You did not enter a server name. Cancel this operation?"; - String^ caption = "No Server Name Specified"; - MessageBoxButtons buttons = MessageBoxButtons::YesNo; - System::Windows::Forms::DialogResult result; - - // Displays the MessageBox. - result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question ); - if ( result == ::DialogResult::Yes ) - { - // Closes the parent form. - this->Close(); - } - } - } - // - - // -private: - void validateUserEntry5() - { - // Checks the value of the text. - if ( serverName->Text->Length == 0 ) - { - // Initializes the variables to pass to the MessageBox::Show method. - String^ message = "You did not enter a server name. Cancel this operation?"; - String^ caption = "No Server Name Specified"; - MessageBoxButtons buttons = MessageBoxButtons::YesNo; - System::Windows::Forms::DialogResult result; - - // Displays the MessageBox. - result = MessageBox::Show( this, message, caption, buttons ); - if ( result == ::DialogResult::Yes ) - { - // Closes the parent form. - this->Close(); - } - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp b/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp deleted file mode 100644 index 40ce708e483..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp +++ /dev/null @@ -1,487 +0,0 @@ -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::MonthCalendar^ monthCalendar1; - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::ComboBox^ comboBox1; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::TextBox^ textBox2; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::Label ^ label4; - System::Windows::Forms::DateTimePicker^ dateTimePicker1; - System::Windows::Forms::DateTimePicker^ dateTimePicker2; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::Button^ button3; - System::Windows::Forms::CheckBox^ checkBox1; - System::Windows::Forms::CheckBox^ checkBox2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - this->Closing += gcnew CancelEventHandler( this, &Form1::this_Closing ); - textBox1->LostFocus += gcnew EventHandler( this, &Form1::textBox1_LostFocus ); - setCalendarLook(); - dateTimePicker1->Value = monthCalendar1->MinDate; - dateTimePicker2->Value = monthCalendar1->MaxDate; - textBox1->Text = monthCalendar1->MaxSelectionCount.ToString(); - for ( Day day = Day::Monday; day <= Day::Default; day++ ) - { - comboBox1->Items->Add( day.ToString() ); - - } - comboBox1->SelectedItem = comboBox1->Items[ comboBox1->Items->IndexOf( monthCalendar1->FirstDayOfWeek.ToString() ) ]; - loadDates(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->label4 = gcnew System::Windows::Forms::Label; - this->label1 = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->label3 = gcnew System::Windows::Forms::Label; - this->dateTimePicker2 = gcnew System::Windows::Forms::DateTimePicker; - this->dateTimePicker1 = gcnew System::Windows::Forms::DateTimePicker; - this->textBox2 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button3 = gcnew System::Windows::Forms::Button; - this->checkBox1 = gcnew System::Windows::Forms::CheckBox; - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->checkBox2 = gcnew System::Windows::Forms::CheckBox; - this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; - this->button2 = gcnew System::Windows::Forms::Button; - this->comboBox1 = gcnew System::Windows::Forms::ComboBox; - this->SuspendLayout(); - - // - // label4 - // - this->label4->Location = System::Drawing::Point( 216, 176 ); - this->label4->Name = "label4"; - this->label4->Size = System::Drawing::Size( 248, 16 ); - this->label4->TabIndex = 8; - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 8, 24 ); - this->label1->Name = "label1"; - this->label1->Size = System::Drawing::Size( 128, 16 ); - this->label1->TabIndex = 2; - this->label1->Text = "Max Selection Count"; - - // - // label2 - // - this->label2->Location = System::Drawing::Point( 8, 56 ); - this->label2->Name = "label2"; - this->label2->TabIndex = 4; - this->label2->Text = "Min Date"; - - // - // label3 - // - this->label3->Location = System::Drawing::Point( 8, 104 ); - this->label3->Name = "label3"; - this->label3->TabIndex = 6; - this->label3->Text = "Max Date"; - - // - // dateTimePicker2 - // - this->dateTimePicker2->Location = System::Drawing::Point( 8, 128 ); - this->dateTimePicker2->Name = "dateTimePicker2"; - this->dateTimePicker2->TabIndex = 7; - this->dateTimePicker2->ValueChanged += gcnew System::EventHandler( this, &Form1::dateTimePicker2_ValueChanged ); - - // - // dateTimePicker1 - // - this->dateTimePicker1->Location = System::Drawing::Point( 8, 80 ); - this->dateTimePicker1->Name = "dateTimePicker1"; - this->dateTimePicker1->TabIndex = 5; - this->dateTimePicker1->ValueChanged += gcnew System::EventHandler( this, &Form1::dateTimePicker1_ValueChanged ); - - // - // textBox2 - // - this->textBox2->Enabled = false; - this->textBox2->Location = System::Drawing::Point( 216, 192 ); - this->textBox2->Name = "textBox2"; - this->textBox2->Size = System::Drawing::Size( 144, 20 ); - this->textBox2->TabIndex = 9; - this->textBox2->Text = ""; - this->textBox2->TextChanged += gcnew System::EventHandler( this, &Form1::textBox2_TextChanged ); - - // - // button1 - // - this->button1->Enabled = false; - this->button1->Location = System::Drawing::Point( 216, 216 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 112, 24 ); - this->button1->TabIndex = 10; - this->button1->Text = "Add Description"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 136, 24 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 24, 20 ); - this->textBox1->TabIndex = 3; - this->textBox1->Text = ""; - this->textBox1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler( this, &Form1::textBox1_keypress ); - this->textBox1->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &Form1::textBox1_Validate ); - - // - // button3 - // - this->button3->Enabled = false; - this->button3->Location = System::Drawing::Point( 488, 224 ); - this->button3->Name = "button3"; - this->button3->Size = System::Drawing::Size( 104, 24 ); - this->button3->TabIndex = 12; - this->button3->Text = "Clear All"; - this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - - // - // checkBox1 - // - this->checkBox1->Location = System::Drawing::Point( 8, 160 ); - this->checkBox1->Name = "checkBox1"; - this->checkBox1->Size = System::Drawing::Size( 144, 24 ); - this->checkBox1->TabIndex = 13; - this->checkBox1->Text = "Show Todays Date"; - this->checkBox1->CheckedChanged += gcnew System::EventHandler( this, &Form1::checkBox1_CheckedChanged ); - - // - // listBox1 - // - this->listBox1->Location = System::Drawing::Point( 488, 16 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 176, 160 ); - this->listBox1->TabIndex = 1; - this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::listBox1_SelectedIndexChanged ); - - // - // checkBox2 - // - this->checkBox2->Location = System::Drawing::Point( 8, 192 ); - this->checkBox2->Name = "checkBox2"; - this->checkBox2->Size = System::Drawing::Size( 120, 24 ); - this->checkBox2->TabIndex = 14; - this->checkBox2->Text = "Show Today Circle"; - this->checkBox2->CheckedChanged += gcnew System::EventHandler( this, &Form1::checkBox2_CheckedChanged ); - - // - // monthCalendar1 - // - this->monthCalendar1->Location = System::Drawing::Point( 216, 8 ); - this->monthCalendar1->Name = "monthCalendar1"; - this->monthCalendar1->TabIndex = 0; - this->monthCalendar1->DateSelected += - gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateSelected ); - - // - // button2 - // - this->button2->Enabled = false; - this->button2->Location = System::Drawing::Point( 488, 184 ); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 104, 24 ); - this->button2->TabIndex = 11; - this->button2->Text = "Delete Selected"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // comboBox1 - // - this->comboBox1->DropDownWidth = 121; - this->comboBox1->Location = System::Drawing::Point( 8, 232 ); - this->comboBox1->Name = "comboBox1"; - this->comboBox1->Size = System::Drawing::Size( 121, 21 ); - this->comboBox1->TabIndex = 15; - this->comboBox1->Text = "comboBox1"; - this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::comboBox1_SelectedIndexChanged ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 672, 273 ); - array^temp3 = {this->comboBox1,this->checkBox2,this->checkBox1,this->button3, - this->button2,this->button1,this->textBox2,this->label4,this->dateTimePicker2,this->label3, - this->dateTimePicker1,this->label2,this->textBox1,this->label1,this->listBox1,this->monthCalendar1}; - this->Controls->AddRange( temp3 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void checkBox1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( checkBox1->Checked) - monthCalendar1->ShowToday = true; - else - monthCalendar1->ShowToday = false; - } - // - - // -private: - void checkBox2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( checkBox2->Checked) - monthCalendar1->ShowTodayCircle = true; - else - monthCalendar1->ShowTodayCircle = false; - } - // - - void dateTimePicker1_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( dateTimePicker1->Value != monthCalendar1->MinDate ) - { - if ( dateTimePicker1->Value > monthCalendar1->MaxDate ) - dateTimePicker2->Value = dateTimePicker1->Value.AddDays( monthCalendar1->MaxSelectionCount ); - monthCalendar1->MinDate = dateTimePicker1->Value; - } - } - - void dateTimePicker2_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( dateTimePicker2->Value != monthCalendar1->MaxDate ) - { - if ( dateTimePicker2->Value < monthCalendar1->MinDate ) - dateTimePicker1->Value = dateTimePicker2->Value.AddDays( -monthCalendar1->MaxSelectionCount ); - monthCalendar1->MaxDate = dateTimePicker2->Value; - } - } - - void textBox1_keypress( Object^ /*sender*/, KeyPressEventArgs^ k ) - { - k->Handled = true; - if ( (k->KeyChar >= '0' && k->KeyChar <= '9') || k->KeyChar == '\t' || k->KeyChar == '\b' || k->KeyChar == '\r' ) - { - k->Handled = false; - } - - if ( k->KeyChar == '\r' ) - { - monthCalendar1->Focus(); - } - } - - void textBox1_Validate( Object^ /*sender*/, CancelEventArgs^ c ) - { - if ( Int32::Parse( textBox1->Text ) < 1 || Int32::Parse( textBox1->Text ) > 365 ) - { - MessageBox::Show( "Max Selection Count must be greater than zero and less than 366." ); - c->Cancel = true; - } - } - - // -private: - void textBox1_LostFocus( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - monthCalendar1->MaxSelectionCount = Int32::Parse( textBox1->Text ); - } - // - - // -private: - void comboBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - monthCalendar1->FirstDayOfWeek = (Day)comboBox1->SelectedIndex; - } - // - - void monthCalendar1_DateSelected( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ /*e*/ ) - { - label4->Text = String::Format( "Enter description for {0}", monthCalendar1->SelectionStart.ToShortDateString() ); - if ( monthCalendar1->SelectionEnd != monthCalendar1->SelectionStart ) - label4->Text = String::Format( "{0} to {1}", label4->Text, monthCalendar1->SelectionEnd.ToShortDateString() ); - - textBox2->Enabled = true; - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - for ( int i = 0; monthCalendar1->SelectionEnd >= monthCalendar1->SelectionStart.AddDays( i ); i++ ) - { - listBox1->Items->Add( String::Concat( monthCalendar1->SelectionStart.AddDays( i ).ToShortDateString(), " ", - textBox2->Text ) ); - } - label4->Text = ""; - textBox2->Enabled = false; - button1->Enabled = false; - button3->Enabled = true; - } - - void textBox2_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( textBox2->Text->Trim()->Equals( "" ) ) - { - textBox2->Text = textBox2->Text->Trim(); - button1->Enabled = false; - } - else - button1->Enabled = true; - } - - void this_Closing( Object^ /*Sender*/, CancelEventArgs^ /*c*/ ) - { - StreamWriter^ myOutputStream = File::CreateText( "myDates.txt" ); - IEnumerator^ myDates = listBox1->Items->GetEnumerator(); - while ( myDates->MoveNext() ) - { - myOutputStream->WriteLine( myDates->Current ); - } - - myOutputStream->Flush(); - myOutputStream->Close(); - } - - void listBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( listBox1->SelectedIndex != -1 ) - button2->Enabled = true; - else - button2->Enabled = false; - } - - - // -private: - // The following method uses Add to add dates that are - // bolded, followed by an UpdateBoldedDates to make the - // added dates visible. - void loadDates() - { - String^ myInput; - try - { - StreamReader^ myInputStream = File::OpenText( "myDates.txt" ); - while ( (myInput = myInputStream->ReadLine()) != nullptr ) - { - monthCalendar1->AddBoldedDate( DateTime::Parse( myInput->Substring( 0, myInput->IndexOf( " " ) ) ) ); - listBox1->Items->Add( myInput ); - } - monthCalendar1->UpdateBoldedDates(); - myInputStream->Close(); - File::Delete( "myDates.txt" ); - } - catch ( FileNotFoundException^ fnfe ) - { - - // Code to handle a file that could not be found should go here. - Console::WriteLine( "An error occurred: '{0}'", fnfe ); - } - - } - // - - // -private: - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - monthCalendar1->RemoveBoldedDate( DateTime::Parse( listBox1->SelectedItem->ToString()-> - Substring( 0, listBox1->SelectedItem->ToString()->IndexOf( " " ) ) ) ); - monthCalendar1->UpdateBoldedDates(); - listBox1->Items->RemoveAt( listBox1->SelectedIndex ); - if ( listBox1->Items->Count == 0 ) - button3->Enabled = false; - } - // - - // -private: - void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - monthCalendar1->RemoveAllBoldedDates(); - monthCalendar1->UpdateBoldedDates(); - listBox1->Items->Clear(); - button3->Enabled = false; - } - // - - // -private: - void setCalendarLook() - { - monthCalendar1->MinDate = DateTime::Parse( "1/1/1900" ); - monthCalendar1->MaxDate = DateTime::Parse( "12/31/2099" ); - checkBox1->Checked = true; - checkBox2->Checked = true; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp deleted file mode 100644 index 5d23523538a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Drawing; -using namespace System::Drawing::Design; - -namespace MoreEventArgsExamples -{ - public ref class EventArgsCreators - { - // - public: - ResolveNameEventArgs^ CreateResolveNameEventArgs( Object^ value, String^ name ) - { - ResolveNameEventArgs^ e = gcnew ResolveNameEventArgs( name ); - // The name to resolve e.Name - // Stores an Object matching the name e.Value - return e; - } - // - - // - PaintValueEventArgs^ CreatePaintValueEventArgs( System::ComponentModel::ITypeDescriptorContext^ context, Object^ value, Graphics^ graphics, Rectangle bounds ) - { - PaintValueEventArgs^ e = gcnew PaintValueEventArgs( context, value, graphics, bounds ); - // The context of the paint value event e.Context - // The Object representing the value to paint e.Value - // The graphics to use to paint e.Graphics - // The rectangle in which to paint e.Bounds - return e; - } - // - - // - ToolboxComponentsCreatedEventArgs^ CreateToolboxComponentsCreatedEventArgs( array^components ) - { - ToolboxComponentsCreatedEventArgs^ e = gcnew ToolboxComponentsCreatedEventArgs( components ); - // The components that were just created e.Components - return e; - } - // - - // - ToolboxComponentsCreatingEventArgs^ CreateToolboxComponentsCreatingEventArgs( System::ComponentModel::Design::IDesignerHost^ host ) - { - ToolboxComponentsCreatingEventArgs^ e = gcnew ToolboxComponentsCreatingEventArgs( host ); - // The designer host of the document receiving the components e.DesignerHost - return e; - } - // - }; -} - -[STAThread] -int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp deleted file mode 100644 index e7dfd73ef17..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::ComponentModel::Design::Serialization; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Security::Permissions; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - -public: - Form1() - { - InitializeComponent(); - } - - // -public: - void LinkResolveNameEvent( IDesignerSerializationManager^ serializationManager ) - { - // Registers an event handler for the ResolveName event. - serializationManager->ResolveName += - gcnew ResolveNameEventHandler( this, &Form1::OnResolveName ); - } - -private: - void OnResolveName( Object^ sender, ResolveNameEventArgs^ e ) - { - // Displays ResolveName event information on the console. - Console::WriteLine( "Name of the name to resolve: " + e->Name ); - Console::WriteLine( "ToString output of the Object that no name was resolved for: " + - e->Value ); - } - // - - // -public: - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - void LinkToolboxComponentsCreatedEvent( ToolboxItem^ item ) - { - item->ComponentsCreated += - gcnew ToolboxComponentsCreatedEventHandler( this, &Form1::OnComponentsCreated ); - } - -private: - void OnComponentsCreated( Object^ sender, ToolboxComponentsCreatedEventArgs^ e ) - { - // Lists created components on the Console. - for ( int i = 0; i < e->Components->Length; i++ ) - { - Console::WriteLine( "Component #" + i + ": " + - e->Components[ i ]->Site->Name ); - } - } - // - - // -public: - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - void LinkToolboxComponentsCreatingEvent( ToolboxItem^ item ) - { - item->ComponentsCreating += - gcnew ToolboxComponentsCreatingEventHandler( this, &Form1::OnComponentsCreating ); - } - -private: - void OnComponentsCreating( Object^ sender, ToolboxComponentsCreatingEventArgs^ e ) - { - // Displays ComponentsCreating event information on the Console. - Console::WriteLine( "Name of the class of the root component of " + - "the designer host receiving new components: " + - e->DesignerHost->RootComponentClassName ); - } - // - - #pragma region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - #pragma endregion -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp deleted file mode 100644 index e7a40e7d3ef..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp +++ /dev/null @@ -1,56 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - TabPage^ tabPage4; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - this->tabPage3 = gcnew TabPage; - this->tabPage4 = gcnew TabPage; - - // Allows more than one row of tabs. - this->tabControl1->Multiline = true; - this->tabControl1->Padding = Point(22,5); - array^tabControls = {this->tabPage1,this->tabPage2,this->tabPage3,this->tabPage4}; - this->tabControl1->Controls->AddRange( tabControls ); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - this->tabPage1->Text = "myTabPage1"; - this->tabPage2->Text = "myTabPage2"; - this->tabPage3->Text = "myTabPage3"; - this->tabPage4->Text = "myTabPage4"; - this->Size = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp deleted file mode 100644 index 2eb8b3629e8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// System::Windows::Forms::DataGrid::ReadOnlyChanged -// System::Windows::Forms::DataGrid::FlatModeChanged - -/* The following program demonstrates the methods 'ReadOnlyChanged' and -'FlatModeChanged' of the 'DataGrid' class. It creates a -'GridControl' and checks the properties 'ReadOnly' and 'FlatMode' -of data grid, depending on the selection of buttons. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyDataGridClass_FlatMode_ReadOnly: public Form -{ -private: - DataGrid^ myDataGrid; - Button^ button1; - Button^ button2; - DataSet^ myDataSet; - System::ComponentModel::Container^ components; - -public: - MyDataGridClass_FlatMode_ReadOnly() - { - components = nullptr; - InitializeComponent(); - SetUp(); - } - -public: - ~MyDataGridClass_FlatMode_ReadOnly() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->FormBorderStyle = ::FormBorderStyle::FixedDialog; - this->myDataGrid = gcnew DataGrid; - this->button1 = gcnew Button; - this->button2 = gcnew Button; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // myDataGrid - // - this->myDataGrid->CaptionText = "My Grid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->Location = Point(16,16); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->Size = System::Drawing::Size( 168, 112 ); - this->myDataGrid->TabIndex = 0; - AttachFlatModeChanged(); - AttachReadOnlyChanged(); - - // - // button1 - // - this->button1->Location = Point(24,160); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 72, 40 ); - this->button1->TabIndex = 1; - this->button1->Text = "Toggle Flat Mode"; - this->button1->Click += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::button1_Click ); - - // - // button2 - // - this->button2->Location = Point(96,160); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 72, 40 ); - this->button2->TabIndex = 1; - this->button2->Text = "Toggle Read Only"; - this->button2->Click += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::button2_Click ); - - // - // MyDataGridClass_FlatMode_ReadOnly - // - this->ClientSize = System::Drawing::Size( 208, 205 ); - array^temp0 = {this->button1,this->myDataGrid,this->button2}; - this->Controls->AddRange( temp0 ); - this->MaximizeBox = false; - this->Name = "MyDataGridClass_FlatMode_ReadOnly"; - this->Text = "Grid Control"; - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - } - - void MakeDataSet() - { - // Create a DataSet. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a DataTable. - DataTable^ myTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the table. - DataColumn^ myColumn1 = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ myColumn2 = gcnew DataColumn( "CustName" ); - myTable->Columns->Add( myColumn1 ); - myTable->Columns->Add( myColumn2 ); - - // Add the table to the DataSet. - myDataSet->Tables->Add( myTable ); - - // For the customer, create a 'DataRow' variable. - DataRow^ newRow; - - // Create one customer in the customers table. - for ( int i = 1; i < 2; i++ ) - { - newRow = myTable->NewRow(); - newRow[ "custID" ] = i; - - // Add the row to the 'Customers' table. - myTable->Rows->Add( newRow ); - } - myTable->Rows[ 0 ][ "custName" ] = "Customer"; - } - - // - // Attach to event handler. -private: - void AttachFlatModeChanged() - { - this->myDataGrid->FlatModeChanged += - gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_FlatModeChanged ); - } - - // Check if the 'FlatMode' property is changed. - void myDataGrid_FlatModeChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ strMessage = "false"; - if ( myDataGrid->FlatMode) - strMessage = "true"; - - MessageBox::Show( "Flat mode changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - - // Toggle the 'FlatMode'. - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGrid->FlatMode) - myDataGrid->FlatMode = false; - else - myDataGrid->FlatMode = true; - } - // - - // - // Attach to event handler. -private: - void AttachReadOnlyChanged() - { - this->myDataGrid->ReadOnlyChanged += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_ReadOnlyChanged ); - } - - // Check if the 'ReadOnly' property is changed. - void myDataGrid_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ strMessage = "false"; - if ( myDataGrid->ReadOnly) - strMessage = "true"; - - MessageBox::Show( "Read only changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - - // Toggle the 'ReadOnly' property. - void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGrid->ReadOnly) - myDataGrid->ReadOnly = false; - else - myDataGrid->ReadOnly = true; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew MyDataGridClass_FlatMode_ReadOnly ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp deleted file mode 100644 index 33010c1f4bb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp +++ /dev/null @@ -1,385 +0,0 @@ -// System::Windows::Forms::DataGrid::ResetHeaderBackColor -// System::Windows::Forms::DataGrid::ResetHeaderForeColor -// System::Windows::Forms::DataGrid::ResetHeaderFont -// System::Windows::Forms::DataGrid::Select -// System::Windows::Forms::DataGrid::IsSelected -// System::Windows::Forms::DataGrid::RowHeaderWidth - -/* The following program demonstrates various methods and properties of -the 'DataGrid' class. It creates a 'GridControl', changes the -header background color, header foreground color, header font -and resets them. It also selects a row, checks weather the row is selected -and checks the 'ReadOnly' and 'FlatMode' properties of the data grid. -Displays the 'RowHeaderWidth', depending on the selection of -buttons. -*/ - -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for MyDataGridClass_ResetHeaderBackColor. -/// -public ref class MyDataGridClass_ResetHeaderBackColor: public Form -{ -private: - DataGrid^ myDataGrid; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - Button^ button1; - Button^ button2; - Button^ button3; - Button^ button4; - Button^ button5; - Button^ button6; - Button^ button7; - Button^ button8; - DataSet^ myDataSet; - Button^ button9; - Button^ button11; - -public: - MyDataGridClass_ResetHeaderBackColor() - { - components = nullptr; - InitializeComponent(); - SetUp(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~MyDataGridClass_ResetHeaderBackColor() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->FormBorderStyle = ::FormBorderStyle::FixedDialog; - this->button8 = gcnew Button; - this->button9 = gcnew Button; - this->button11 = gcnew Button; - this->button4 = gcnew Button; - this->button5 = gcnew Button; - this->button6 = gcnew Button; - this->button7 = gcnew Button; - this->button1 = gcnew Button; - this->button2 = gcnew Button; - this->button3 = gcnew Button; - this->myDataGrid = gcnew DataGrid; - (dynamic_cast(this->myDataGrid))->BeginInit(); - this->SuspendLayout(); - - // - // button8 - // - this->button8->Location = Point(352,176); - this->button8->Name = "button8"; - this->button8->Size = System::Drawing::Size( 96, 40 ); - this->button8->TabIndex = 8; - this->button8->Text = "Display Status"; - this->button8->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button8_Click ); - - // - // button9 - // - this->button9->Location = Point(24,216); - this->button9->Name = "button9"; - this->button9->Size = System::Drawing::Size( 96, 40 ); - this->button9->TabIndex = 9; - this->button9->Text = "Get Row Header Width"; - this->button9->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button9_Click ); - - // - // button11 - // - this->button11->Location = Point(256,216); - this->button11->Name = "button11"; - this->button11->Size = System::Drawing::Size( 96, 40 ); - this->button11->TabIndex = 7; - this->button11->Text = "UnSelect Row"; - this->button11->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button11_Click ); - - // - // button4 - // - this->button4->Location = Point(352,72); - this->button4->Name = "button4"; - this->button4->Size = System::Drawing::Size( 96, 40 ); - this->button4->TabIndex = 4; - this->button4->Text = "Reset Header Fore Color"; - this->button4->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button4_Click ); - - // - // button5 - // - this->button5->Location = Point(352,128); - this->button5->Name = "button5"; - this->button5->Size = System::Drawing::Size( 96, 40 ); - this->button5->TabIndex = 5; - this->button5->Text = "Reset Header Font"; - this->button5->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button5_Click ); - - // - // button6 - // - this->button6->Location = Point(256,128); - this->button6->Name = "button6"; - this->button6->Size = System::Drawing::Size( 96, 40 ); - this->button6->TabIndex = 6; - this->button6->Text = "Change Header Font"; - this->button6->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button6_Click ); - - // - // button7 - // - this->button7->Location = Point(256,176); - this->button7->Name = "button7"; - this->button7->Size = System::Drawing::Size( 96, 40 ); - this->button7->TabIndex = 7; - this->button7->Text = "Select Row"; - this->button7->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button7_Click ); - - // - // button1 - // - this->button1->Location = Point(256,24); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 96, 40 ); - this->button1->TabIndex = 1; - this->button1->Text = "Change Header Back Color"; - this->button1->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button1_Click ); - - // - // button2 - // - this->button2->Location = Point(352,24); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 96, 40 ); - this->button2->TabIndex = 2; - this->button2->Text = "Reset Header Back Color"; - this->button2->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button2_Click ); - - // - // button3 - // - this->button3->Location = Point(256,72); - this->button3->Name = "button3"; - this->button3->Size = System::Drawing::Size( 96, 40 ); - this->button3->TabIndex = 3; - this->button3->Text = "Change Header Fore Color"; - this->button3->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button3_Click ); - - // - // myDataGrid - // - this->myDataGrid->CaptionText = "My Grid Control"; - this->myDataGrid->DataMember = ""; - this->myDataGrid->Location = Point(8,32); - this->myDataGrid->Name = "myDataGrid"; - this->myDataGrid->RowHeaderWidth = 50; - this->myDataGrid->Size = System::Drawing::Size( 216, 152 ); - this->myDataGrid->TabIndex = 0; - - // - // MyDataGridClass_ResetHeaderBackColor - // - this->AutoScale = false; - this->ClientSize = System::Drawing::Size( 528, 273 ); - array^temp0 = {this->button9,this->button8,this->button7,this->button6,this->button5,this->button4,this->button3,this->button2,this->button1,this->myDataGrid,this->button11}; - this->Controls->AddRange( temp0 ); - this->MaximizeBox = false; - this->Name = "MyDataGridClass_ResetHeaderBackColor"; - this->Text = "Grid Control"; - (dynamic_cast(this->myDataGrid))->EndInit(); - this->ResumeLayout( false ); - } - - void SetUp() - { - MakeDataSet(); - myDataGrid->SetDataBinding( myDataSet, "Customers" ); - myDataGrid->ReadOnly = true; - } - - void MakeDataSet() - { - // Create a 'DataSet'. - myDataSet = gcnew DataSet( "myDataSet" ); - - // Create a 'DataTable'. - DataTable^ myTable = gcnew DataTable( "Customers" ); - - // Create two columns, and add them to the table. - DataColumn^ myColumn1 = gcnew DataColumn( "CustID",int::typeid ); - DataColumn^ myColumn2 = gcnew DataColumn( "CustName" ); - myTable->Columns->Add( myColumn1 ); - myTable->Columns->Add( myColumn2 ); - - // Add the table to the 'DataSet'. - myDataSet->Tables->Add( myTable ); - - // For the customer, create a 'DataRow' variable. - DataRow^ newRow; - - // Create one customer in the customers table. - for ( int i = 1; i < 2; i++ ) - { - newRow = myTable->NewRow(); - newRow[ "custID" ] = i; - - // Add the row to the 'Customers' table. - myTable->Rows->Add( newRow ); - } - myTable->Rows[ 0 ][ "custName" ] = "Customer"; - } - - // -private: - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Enable the help button. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->HeaderBackColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set the header background color. - myDataGrid->HeaderBackColor = myColorDialog->Color; - } - - // Reset the header background color. - void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGrid->ResetHeaderBackColor(); - } - // - - // -private: - void button3_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - ColorDialog^ myColorDialog = gcnew ColorDialog; - - // Disable selecting a custom color. - myColorDialog->AllowFullOpen = false; - - // Enable the help button. - myColorDialog->ShowHelp = true; - - // Set the initial color to the current color. - myColorDialog->Color = myDataGrid->HeaderForeColor; - - // Show color dialog box. - myColorDialog->ShowDialog(); - - // Set the header foreground color. - myDataGrid->HeaderForeColor = myColorDialog->Color; - } - - // Reset the header foregroundcolor. - void button4_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGrid->ResetHeaderForeColor(); - } - // - - // -private: - // Set the header font to Arial with size 20. - void button6_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGrid->HeaderFont = gcnew System::Drawing::Font( "Arial",20 ); - } - - // Reset the header font. - void button5_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGrid->ResetHeaderFont(); - } - // - - // - // Select the first row. -private: - void button7_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGrid->Select(0); - } - - // - // Check if the first row is selected. -private: - void button8_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( myDataGrid->IsSelected( 0 ) ) - { - MessageBox::Show( "Row selected", "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - else - { - MessageBox::Show( "Row not selected", "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - } - - // Deselect the first row. - void button11_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myDataGrid->UnSelect( 0 ); - } - // - // - - // - // Get the width of row header. -private: - void button9_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Int32 myRowHeaderWidth = myDataGrid->RowHeaderWidth; - MessageBox::Show( String::Concat( "Width of row headers is: ", myRowHeaderWidth ), "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew MyDataGridClass_ResetHeaderBackColor ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp deleted file mode 100644 index f6ee8d638e2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp +++ /dev/null @@ -1,165 +0,0 @@ - - -#using -#using -#using - -// -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Runtime::InteropServices; -ref class MyNativeWindowListener; -ref class MyNativeWindow; - -// Summary description for Form1. -ref class Form1: public System::Windows::Forms::Form -{ -private: - MyNativeWindowListener^ nwl; - MyNativeWindow^ nw; - -internal: - void ApplicationActived( bool ApplicationActivated ) - { - // The application has been activated or deactivated - #if defined(DEBUG) - System::Diagnostics::Debug::WriteLine( "Application Active = {0}", ApplicationActivated.ToString() ); - #endif - } - - -public: - Form1(); -}; - -// -// NativeWindow class to listen to operating system messages. -ref class MyNativeWindowListener: public NativeWindow -{ -private: - - // Constant value was found in the S"windows.h" header file. - literal int WM_ACTIVATEAPP = 0x001C; - Form1^ parent; - -public: - MyNativeWindowListener( Form1^ parent ) - { - parent->HandleCreated += gcnew EventHandler( this, &MyNativeWindowListener::OnHandleCreated ); - parent->HandleDestroyed += gcnew EventHandler( this, &MyNativeWindowListener::OnHandleDestroyed ); - this->parent = parent; - } - -internal: - - // Listen for the control's window creation and then hook into it. - void OnHandleCreated( Object^ sender, EventArgs^ /*e*/ ) - { - // Window is now created, assign handle to NativeWindow. - AssignHandle( (dynamic_cast(sender))->Handle ); - } - - void OnHandleDestroyed( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Window was destroyed, release hook. - ReleaseHandle(); - } - -protected: - - virtual void WndProc( Message %m ) override - { - // Listen for operating system messages - switch ( m.Msg ) - { - case WM_ACTIVATEAPP: - - // Notify the form that this message was received. - // Application is activated or deactivated, - // based upon the WParam parameter. - parent->ApplicationActived( ((int)m.WParam != 0) ); - break; - } - NativeWindow::WndProc( m ); - } - -}; -// - -// -// MyNativeWindow class to create a window given a class name. -ref class MyNativeWindow: public NativeWindow -{ -private: - - // Constant values were found in the S"windows.h" header file. - literal int WS_CHILD = 0x40000000,WS_VISIBLE = 0x10000000,WM_ACTIVATEAPP = 0x001C; - int windowHandle; - -public: - MyNativeWindow( Form^ parent ) - { - CreateParams^ cp = gcnew CreateParams; - - // Fill in the CreateParams details. - cp->Caption = "Click here"; - cp->ClassName = "Button"; - - // Set the position on the form - cp->X = 100; - cp->Y = 100; - cp->Height = 100; - cp->Width = 100; - - // Specify the form as the parent. - cp->Parent = parent->Handle; - - // Create as a child of the specified parent - cp->Style = WS_CHILD | WS_VISIBLE; - - // Create the actual window - this->CreateHandle( cp ); - } - -protected: - - // Listen to when the handle changes to keep the variable in sync - - virtual void OnHandleChange() override - { - windowHandle = (int)this->Handle; - } - - virtual void WndProc( Message % m ) override - { - // Listen for messages that are sent to the button window. Some messages are sent - // to the parent window instead of the button's window. - switch ( m.Msg ) - { - case WM_ACTIVATEAPP: - - // Do something here in response to messages - break; - } - NativeWindow::WndProc( m ); - } -}; -// - -Form1::Form1() -{ - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - nwl = gcnew MyNativeWindowListener( this ); - nw = gcnew MyNativeWindow( this ); -} - -// The main entry point for the application. - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp deleted file mode 100644 index 4e87c4fa2c1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp +++ /dev/null @@ -1,163 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::MainMenu^ mainMenu1; - System::Windows::Forms::MenuItem^ menuItem1; - System::Windows::Forms::MenuItem^ menuItem2; - System::Windows::Forms::MenuItem^ menuItem3; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // Create the menu. - CreateMyMenu(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - void CreateMyMenu() - { - this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->menuItem1 = gcnew System::Windows::Forms::MenuItem; - this->menuItem2 = gcnew System::Windows::Forms::MenuItem; - this->menuItem3 = gcnew System::Windows::Forms::MenuItem; - - // - // - // mainMenu1 - // - array^temp0 = {this->menuItem1}; - this->mainMenu1->MenuItems->AddRange( temp0 ); - array^temp1 = {this->menuItem2}; - this->mainMenu1->MenuItems->AddRange( temp1 ); - array^temp2 = {this->menuItem3}; - this->mainMenu1->MenuItems->AddRange( temp2 ); - - // - // menuItem1 - // - this->menuItem1->Index = 0; - this->menuItem1->OwnerDraw = true; - this->menuItem1->Text = ""; - this->menuItem1->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::menuItem1_DrawItem ); - - // - // menuItem2 - // - this->menuItem2->Index = 1; - this->menuItem2->OwnerDraw = true; - this->menuItem2->Text = ""; - this->menuItem2->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::menuItem2_DrawItem ); - - // - // menuItem3 - // - this->menuItem3->Index = 2; - this->menuItem3->OwnerDraw = true; - this->menuItem3->Text = ""; - this->menuItem3->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::menuItem3_DrawItem ); - this->Menu = this->mainMenu1; - } - - // - // The DrawItem event handler. -private: - void menuItem1_DrawItem( Object^ /*sender*/, System::Windows::Forms::DrawItemEventArgs^ e ) - { - String^ myCaption = "Owner Draw Item1"; - - // Create a Brush and a Font with which to draw the item. - Brush^ myBrush = System::Drawing::Brushes::AliceBlue; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSerif,14,FontStyle::Underline,GraphicsUnit::Pixel ); - SizeF mySizeF = e->Graphics->MeasureString( myCaption, myFont ); - - // Draw the item, and then draw a Rectangle around it. - e->Graphics->DrawString( myCaption, myFont, myBrush, (float)e->Bounds.X, (float)e->Bounds.Y ); - e->Graphics->DrawRectangle( Pens::Black, Rectangle(e->Bounds.X,e->Bounds.Y,Convert::ToInt32( mySizeF.Width ),Convert::ToInt32( mySizeF.Height )) ); - } - // - - void menuItem2_DrawItem( Object^ /*sender*/, System::Windows::Forms::DrawItemEventArgs^ e ) - { - String^ myCaption = "Owner Draw Item2"; - Brush^ myBrush = System::Drawing::Brushes::AliceBlue; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSerif,14,FontStyle::Underline,GraphicsUnit::Pixel ); - SizeF mySizeF = e->Graphics->MeasureString( myCaption, myFont ); - e->Graphics->DrawString( myCaption, myFont, myBrush, (float)e->Bounds.X, (float)e->Bounds.Y + 20 ); - e->Graphics->DrawRectangle( Pens::Black, Rectangle(e->Bounds.X,e->Bounds.Y + 20,Convert::ToInt32( mySizeF.Width ),Convert::ToInt32( mySizeF.Height )) ); - } - - void menuItem3_DrawItem( Object^ /*sender*/, System::Windows::Forms::DrawItemEventArgs^ e ) - { - String^ myCaption = "Owner Draw Item3"; - Brush^ myBrush = System::Drawing::Brushes::AliceBlue; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSerif,14,FontStyle::Underline,GraphicsUnit::Pixel ); - SizeF mySizeF = e->Graphics->MeasureString( myCaption, myFont ); - e->Graphics->DrawString( myCaption, myFont, myBrush, (float)e->Bounds.X, (float)e->Bounds.Y + 40 ); - e->Graphics->DrawRectangle( Pens::Black, Rectangle(e->Bounds.X,e->Bounds.Y + 40,Convert::ToInt32( mySizeF.Width ),Convert::ToInt32( mySizeF.Height )) ); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp deleted file mode 100644 index 108cf013b06..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - this->tabControl1->Multiline = true; - array^temp0 = {this->tabPage1,this->tabPage2}; - this->tabControl1->Controls->AddRange( temp0 ); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - - // Creates a cushion of 22 pixels around TabPage.Text strings. - this->tabControl1->Padding = System::Drawing::Point( 22, 22 ); - this->tabPage1->Text = "myTabPage1"; - this->tabPage2->Text = "myTabPage2"; - this->Size = System::Drawing::Size( 300, 300 ); - array^temp1 = {this->tabControl1}; - this->Controls->AddRange( temp1 ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp deleted file mode 100644 index 503e9276d13..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp +++ /dev/null @@ -1,338 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Drawing::Printing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace WindowsApplication3 -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - - // my vars - PrintDocument^ printDoc; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::Button^ MyButtonPrint; - System::Windows::Forms::ComboBox^ comboPaperSize; - System::Windows::Forms::ComboBox^ comboPaperSource; - System::Windows::Forms::ComboBox^ comboPrintResolution; - System::Windows::Forms::ComboBox^ comboInstalledPrinters; - System::Windows::Forms::Label ^ label4; - System::ComponentModel::Container^ components; - - public: - Form1() - { - // - // Required for Windows Form Designer support - // - printDoc = gcnew PrintDocument; - components = nullptr; - currentPageNumber = 1; - InitializeComponent(); - - // Setup the event handlers - printDoc->QueryPageSettings += gcnew QueryPageSettingsEventHandler( this, &Form1::MyPrintQueryPageSettingsEvent ); - printDoc->PrintPage += gcnew PrintPageEventHandler( this, &Form1::MyPrintPageEvent ); - - /* // Other way to specify custom paper size is to set the paper kind and related properties. - PaperSize* pkCustomSize2 = new PaperSize(); - pkCustomSize2.Kind = PaperSourceKind::Custom; - pkCustomSize2.PaperName = S"Other custom size"; - pkCustomSize2.Width = 100; - pkCustomSize2.Height = 200; - - comboPaperSize.Items->Add(pkCustomSize2); - - */ - - // - // Add list of supported paper sizes found on the printer. - // The DisplayMember property is used to identify the property that will provide the display String*. - comboPaperSize->DisplayMember = "PaperName"; - PaperSize^ pkSize; - for ( int i = 0; i < printDoc->PrinterSettings->PaperSizes->Count; i++ ) - { - pkSize = printDoc->PrinterSettings->PaperSizes[ i ]; - comboPaperSize->Items->Add( pkSize ); - } - - // Create a PaperSize and specify the custom paper size through the constructor and add to combobox. - PaperSize^ pkCustomSize1 = gcnew PaperSize( "First custom size",100,200 ); - comboPaperSize->Items->Add( pkCustomSize1 ); - // - - // - // Add list of paper sources found on the printer to the combo box. - // The DisplayMember property is used to identify the property that will provide the display String*. - comboPaperSource->DisplayMember = "SourceName"; - PaperSource^ pkSource; - for ( int i = 0; i < printDoc->PrinterSettings->PaperSources->Count; i++ ) - { - pkSource = printDoc->PrinterSettings->PaperSources[ i ]; - comboPaperSource->Items->Add( pkSource ); - } - // - - // - // Add list of printer resolutions found on the printer to the combobox. - // The PrinterResolution's ToString() method will be used to provide the display String. - PrinterResolution^ pkResolution; - for ( int i = 0; i < printDoc->PrinterSettings->PrinterResolutions->Count; i++ ) - { - pkResolution = printDoc->PrinterSettings->PrinterResolutions[ i ]; - comboPrintResolution->Items->Add( pkResolution ); - } - // - - PopulateInstalledPrintersCombo(); - } - - // - private: - void PopulateInstalledPrintersCombo() - { - // Add list of installed printers found to the combo box. - // The pkInstalledPrinters String will be used to provide the display String. - String^ pkInstalledPrinters; - for ( int i = 0; i < PrinterSettings::InstalledPrinters->Count; i++ ) - { - pkInstalledPrinters = PrinterSettings::InstalledPrinters[ i ]; - comboInstalledPrinters->Items->Add( pkInstalledPrinters ); - } - } - - void comboInstalledPrinters_SelectionChanged( Object^ sender, System::EventArgs^ e ) - { - // Set the printer to a printer in the combo box when the selection changes. - if ( comboInstalledPrinters->SelectedIndex != -1 ) - { - // The combo box's Text property returns the selected item's text, which is the printer name. - printDoc->PrinterSettings->PrinterName = comboInstalledPrinters->Text; - } - } - // - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->comboPrintResolution = gcnew System::Windows::Forms::ComboBox; - this->label4 = gcnew System::Windows::Forms::Label; - this->comboInstalledPrinters = gcnew System::Windows::Forms::ComboBox; - this->label1 = gcnew System::Windows::Forms::Label; - this->label3 = gcnew System::Windows::Forms::Label; - this->comboPaperSize = gcnew System::Windows::Forms::ComboBox; - this->comboPaperSource = gcnew System::Windows::Forms::ComboBox; - this->label2 = gcnew System::Windows::Forms::Label; - this->MyButtonPrint = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // comboPrintResolution - // - this->comboPrintResolution->DropDownWidth = 121; - this->comboPrintResolution->Location = System::Drawing::Point( 104, 72 ); - this->comboPrintResolution->Name = "comboPrintResolution"; - this->comboPrintResolution->Size = System::Drawing::Size( 121, 21 ); - this->comboPrintResolution->TabIndex = 3; - - // - // label4 - // - this->label4->Location = System::Drawing::Point( 8, 104 ); - this->label4->Name = "label4"; - this->label4->TabIndex = 4; - this->label4->Text = "Installed Printers"; - - // - // comboInstalledPrinters - // - this->comboInstalledPrinters->DropDownWidth = 120; - this->comboInstalledPrinters->Location = System::Drawing::Point( 104, 104 ); - this->comboInstalledPrinters->Name = "comboInstalledPrinters"; - this->comboInstalledPrinters->Size = System::Drawing::Size( 120, 21 ); - this->comboInstalledPrinters->TabIndex = 5; - this->comboInstalledPrinters->SelectedIndexChanged += - gcnew System::EventHandler( this, &Form1::comboInstalledPrinters_SelectionChanged ); - - // - // label1 - // - this->label1->FlatStyle = System::Windows::Forms::FlatStyle::System; - this->label1->Location = System::Drawing::Point( 8, 13 ); - this->label1->Name = "label1"; - this->label1->Size = System::Drawing::Size( 56, 16 ); - this->label1->TabIndex = 1; - this->label1->Text = "Paper Sizes"; - - // - // label3 - // - this->label3->Location = System::Drawing::Point( 8, 72 ); - this->label3->Name = "label3"; - this->label3->TabIndex = 4; - this->label3->Text = "Printer Resolution"; - - // - // comboPaperSize - // - this->comboPaperSize->DropDownWidth = 121; - this->comboPaperSize->Location = System::Drawing::Point( 80, 8 ); - this->comboPaperSize->Name = "comboPaperSize"; - this->comboPaperSize->Size = System::Drawing::Size( 121, 21 ); - this->comboPaperSize->TabIndex = 0; - - // - // comboPaperSource - // - this->comboPaperSource->DropDownWidth = 121; - this->comboPaperSource->Location = System::Drawing::Point( 80, 40 ); - this->comboPaperSource->Name = "comboPaperSource"; - this->comboPaperSource->Size = System::Drawing::Size( 121, 21 ); - this->comboPaperSource->TabIndex = 0; - - // - // label2 - // - this->label2->FlatStyle = System::Windows::Forms::FlatStyle::System; - this->label2->Location = System::Drawing::Point( 8, 45 ); - this->label2->Name = "label2"; - this->label2->Size = System::Drawing::Size( 72, 16 ); - this->label2->TabIndex = 1; - this->label2->Text = "Paper Source"; - - // - // MyButtonPrint - // - this->MyButtonPrint->Location = System::Drawing::Point( 208, 8 ); - this->MyButtonPrint->Name = "MyButtonPrint"; - this->MyButtonPrint->TabIndex = 2; - this->MyButtonPrint->Text = "Print"; - this->MyButtonPrint->Click += gcnew System::EventHandler( this, &Form1::MyButtonPrint_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 133 ); - array^temp0 = {this->comboInstalledPrinters,this->comboPrintResolution,this->label3,this->comboPaperSource,this->MyButtonPrint,this->label1,this->comboPaperSize,this->label2,this->label4}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - private: - void MyButtonPrint_Click( Object^ sender, System::EventArgs^ e ) - { - // Set the paper size based upon the selection in the combo box. - if ( comboPaperSize->SelectedIndex != -1 ) - { - printDoc->DefaultPageSettings->PaperSize = printDoc->PrinterSettings->PaperSizes[ comboPaperSize->SelectedIndex ]; - } - - // Set the paper source based upon the selection in the combo box. - if ( comboPaperSource->SelectedIndex != -1 ) - { - printDoc->DefaultPageSettings->PaperSource = printDoc->PrinterSettings->PaperSources[ comboPaperSource->SelectedIndex ]; - } - - // Set the printer resolution based upon the selection in the combo box. - if ( comboPrintResolution->SelectedIndex != -1 ) - { - printDoc->DefaultPageSettings->PrinterResolution = printDoc->PrinterSettings->PrinterResolutions[ comboPrintResolution->SelectedIndex ]; - } - - // Print the document with the specified paper size, source, and print resolution. - printDoc->Print(); - } - // - - protected: - int currentPageNumber; - - // - private: - void MyButtonPrint_OnClick( Object^ sender, System::EventArgs^ e ) - { - // Set the printer name and ensure it is valid. If not, provide a message to the user. - printDoc->PrinterSettings->PrinterName = "\\mynetworkprinter"; - if ( printDoc->PrinterSettings->IsValid ) - { - // If the printer supports printing in color, then override the printer's default behavior. - if ( printDoc->PrinterSettings->SupportsColor ) - { - // Set the page default's to not print in color. - printDoc->DefaultPageSettings->Color = false; - } - - // Provide a friendly name, set the page number, and print the document. - printDoc->DocumentName = "My Presentation"; - currentPageNumber = 1; - printDoc->Print(); - } - else - { - MessageBox::Show( "Printer is not valid" ); - } - } - - void MyPrintQueryPageSettingsEvent( Object^ sender, QueryPageSettingsEventArgs^ e ) - { - // Determines if the printer supports printing in color. - if ( printDoc->PrinterSettings->SupportsColor ) - { - // If the printer supports color printing, use color. - if ( currentPageNumber == 1 ) - { - e->PageSettings->Color = true; - } - } - } - // - - void MyPrintPageEvent( Object^ sender, PrintPageEventArgs^ e ){} - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew WindowsApplication3::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp deleted file mode 100644 index b78a17d842f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::MdiClient^ mdiClient1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->mdiClient1 = gcnew System::Windows::Forms::MdiClient; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // mdiClient1 - // - this->mdiClient1->Dock = System::Windows::Forms::DockStyle::Fill; - this->mdiClient1->Name = "mdiClient1"; - this->mdiClient1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 16, 16 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 80, 24 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 568, 368 ); - array^formControls = {this->button1,this->mdiClient1}; - this->Controls->AddRange( formControls ); - this->IsMdiContainer = true; - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // - // The event handler on Form1. -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create an instance of Form2. - Form1^ f2 = gcnew Form2; - - // Make this form the parent of f2. - f2->MdiParent = this; - - // Display the form. - f2->Show(); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp b/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp deleted file mode 100644 index d7a5266cb26..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -/// -/// Summary description for Form2. -/// -public ref class Form2: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form2() - { - components = nullptr; - InitializeComponent(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form2() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 160, 176 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 80, 24 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form2::button1_Click ); - - // - // Form2 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - array^formControls = {this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "Form2"; - this->Text = "Form2"; - this->Load += gcnew System::EventHandler( this, &Form2::Form2_Load ); - this->ResumeLayout( false ); - } - - // - // The event handler on Form2. -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Get the Name property of the Parent. - String^ s = ParentForm->Name; - - // Display the name in a message box. - MessageBox::Show( String::Concat( "My Parent is ", s, "." ) ); - } - // - - void Form2_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp deleted file mode 100644 index 1c513c1da57..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - InitializeComponent(); - CreateMyMenuItems(); - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -public: - void CreateMyMenuItems() - { - // Craete a main menu object. - MainMenu^ mainMenu1 = gcnew MainMenu; - - // Create three top-level menu items. - MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); - MenuItem^ menuItem2 = gcnew MenuItem( "&New" ); - MenuItem^ menuItem3 = gcnew MenuItem( "&Open" ); - - // Add menuItem1 to the main menu. - mainMenu1->MenuItems->Add( menuItem1 ); - - // Add menuItem2 and menuItem3 to menuItem1. - menuItem1->MenuItems->Add( menuItem2 ); - menuItem1->MenuItems->Add( menuItem3 ); - - // Check to see if menuItem3 has a parent menu. - if ( menuItem3->Parent != nullptr ) - MessageBox::Show( String::Concat( menuItem3->Parent, "." ), "Parent Menu Information of menuItem3" ); - else - MessageBox::Show( "No parent menu." ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - } - // - -private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp deleted file mode 100644 index 75f43115eb2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - InitializeComponent(); - CreateMyMenu(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - /// - // -public: - void CreateMyMenu() - { - // Create a main menu object. - MainMenu^ mainMenu1 = gcnew MainMenu; - - // Create empty menu item objects. - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - - // Set the caption of the menu items. - menuItem1->Text = "&File"; - menuItem2->Text = "&Edit"; - - // Add the menu items to the main menu. - mainMenu1->MenuItems->Add( menuItem1 ); - mainMenu1->MenuItems->Add( menuItem2 ); - - // Add functionality to the menu items. - menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); - menuItem2->Click += gcnew System::EventHandler( this, &Form1::menuItem2_Click ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - - // Perform a click on the File menu item. - menuItem1->PerformClick(); - } - -private: - void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "You clicked the File menu.", "The Event Information" ); - } - - void menuItem2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "You clicked the Edit menu.", "The Event Information" ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp deleted file mode 100644 index bb8f4cf2a57..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - InitializeComponent(); - CreateMyMenu(); - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -public: - void CreateMyMenu() - { - // Create a main menu objects. - MainMenu^ mainMenu1 = gcnew MainMenu; - - // Create empty menu item objects. - MenuItem^ menuItem1 = gcnew MenuItem; - MenuItem^ menuItem2 = gcnew MenuItem; - - // Set the caption of the menu items. - menuItem1->Text = "&File"; - menuItem2->Text = "&Edit"; - - // Add the menu items to the main menu. - mainMenu1->MenuItems->Add( menuItem1 ); - mainMenu1->MenuItems->Add( menuItem2 ); - - // Add functionality to the menu items. - menuItem1->Select += gcnew System::EventHandler( this, &Form1::menuItem1_Select ); - menuItem2->Select += gcnew System::EventHandler( this, &Form1::menuItem2_Select ); - - // Assign mainMenu1 to the form. - this->Menu = mainMenu1; - - // Select the File menu item. - menuItem1->PerformSelect(); - } - -private: - void menuItem1_Select( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "You selected the File menu.", "The Event Information" ); - } - - void menuItem2_Select( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "You selected the Edit menu.", "The Event Information" ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp b/snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp deleted file mode 100644 index 293ecd3b156..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp +++ /dev/null @@ -1,92 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Reflection; -using namespace System::Windows::Forms; - -public ref class PowerStatusBrowserForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::TextBox^ textBox1; - -public: - PowerStatusBrowserForm() - { - this->SuspendLayout(); - InitForm(); - - //Add each property of the PowerStatus class to the list box. - Type^ t = System::Windows::Forms::PowerStatus::typeid; - array^pi = t->GetProperties(); - for ( int i = 0; i < pi->Length; i++ ) - listBox1->Items->Add( pi[ i ]->Name ); - textBox1->Text = String::Format( "The PowerStatus class has {0} properties.\r\n", pi->Length ); - - // Configure the list item selected handler for the list box to invoke a - // method that displays the value of each property. - listBox1->SelectedIndexChanged += gcnew EventHandler( this, &PowerStatusBrowserForm::listBox1_SelectedIndexChanged ); - this->ResumeLayout( false ); - } - -private: - void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Return if no item is selected. - if ( listBox1->SelectedIndex == -1 ) - return; - - // Get the property name from the list item - String^ propname = listBox1->Text; - - // Display the value of the selected property of the PowerStatus type. - Type^ t = System::Windows::Forms::PowerStatus::typeid; - array^pi = t->GetProperties(); - PropertyInfo^ prop = nullptr; - for ( int i = 0; i < pi->Length; i++ ) - if ( pi[ i ]->Name == propname ) - { - prop = pi[ i ]; - break; - } - - Object^ propval = prop->GetValue( SystemInformation::PowerStatus, nullptr ); - textBox1->Text = String::Format( "{0}\r\nThe value of the {1} property is: {2}", textBox1->Text, propname, propval ); - } - - void InitForm() - { - // Initialize the form settings - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->listBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->listBox1->Location = System::Drawing::Point( 8, 16 ); - this->listBox1->Size = System::Drawing::Size( 172, 496 ); - this->listBox1->TabIndex = 0; - this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->textBox1->Location = System::Drawing::Point( 188, 16 ); - this->textBox1->Multiline = true; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->textBox1->Size = System::Drawing::Size( 420, 496 ); - this->textBox1->TabIndex = 1; - this->ClientSize = System::Drawing::Size( 616, 525 ); - this->Controls->Add( this->textBox1 ); - this->Controls->Add( this->listBox1 ); - this->Text = "Select a PowerStatus property to get the value of"; - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew PowerStatusBrowserForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp deleted file mode 100644 index d5e993a21b0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp +++ /dev/null @@ -1,168 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ProgressBar^ progressBar1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::StatusBar^ statusBar1; - System::Windows::Forms::StatusBarPanel^ statusBarPanel1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - time = gcnew Timer; - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->progressBar1 = gcnew System::Windows::Forms::ProgressBar; - this->button1 = gcnew System::Windows::Forms::Button; - this->statusBar1 = gcnew System::Windows::Forms::StatusBar; - this->statusBarPanel1 = gcnew System::Windows::Forms::StatusBarPanel; - (dynamic_cast(this->statusBarPanel1))->BeginInit(); - this->SuspendLayout(); - - // - // progressBar1 - // - this->progressBar1->Location = System::Drawing::Point( 24, 24 ); - this->progressBar1->Name = "progressBar1"; - this->progressBar1->Size = System::Drawing::Size( 192, 24 ); - this->progressBar1->Step = 1; - this->progressBar1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 224, 24 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // statusBar1 - // - this->statusBar1->Location = System::Drawing::Point( 0, 272 ); - this->statusBar1->Name = "statusBar1"; - array^temp0 = {this->statusBarPanel1}; - this->statusBar1->Panels->AddRange( temp0 ); - this->statusBar1->ShowPanels = true; - this->statusBar1->Size = System::Drawing::Size( 368, 22 ); - this->statusBar1->TabIndex = 2; - this->statusBar1->Text = "statusBar1"; - - // - // statusBarPanel1 - // - this->statusBarPanel1->AutoSize = System::Windows::Forms::StatusBarPanelAutoSize::Spring; - this->statusBarPanel1->Text = "Ready"; - this->statusBarPanel1->Width = 352; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 368, 294 ); - array^temp1 = {this->statusBar1,this->button1,this->progressBar1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - (dynamic_cast(this->statusBarPanel1))->EndInit(); - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - InitializeMyTimer(); - } - - // -private: - Timer^ time; - - // Call this method from the constructor of the form. - void InitializeMyTimer() - { - // Set the interval for the timer. - time->Interval = 250; - - // Connect the Tick event of the timer to its event handler. - time->Tick += gcnew EventHandler( this, &Form1::IncreaseProgressBar ); - - // Start the timer. - time->Start(); - } - - void IncreaseProgressBar( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Increment the value of the ProgressBar a value of one each time. - progressBar1->Increment( 1 ); - - // Display the textual value of the ProgressBar in the StatusBar control's first panel. - statusBarPanel1->Text = String::Concat( progressBar1->Value, "% Completed" ); - - // Determine if we have completed by comparing the value of the Value property to the Maximum value. - if ( progressBar1->Value == progressBar1->Maximum ) - - // Stop the timer. - time->Stop(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp deleted file mode 100644 index b7cf840a387..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp +++ /dev/null @@ -1,151 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - System::Windows::Forms::Button^ button1; - ProgressBar^ pBar1; - -public: - Form1() - { - components = nullptr; - pBar1 = gcnew ProgressBar; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - pBar1->Bounds = Rectangle(10,50,200,20); - this->Controls->Add( pBar1 ); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -private: - bool CopyFile( String^ filename ) - { - #if defined(DEBUG) - System::Diagnostics::Debug::WriteLine( "File Being Copied = {0}", filename ); - #endif - return true; - } - - // -private: - void CopyWithProgress( array^filenames ) - { - // Display the ProgressBar control. - pBar1->Visible = true; - - // Set Minimum to 1 to represent the first file being copied. - pBar1->Minimum = 1; - - // Set Maximum to the total number of files to copy. - pBar1->Maximum = filenames->Length; - - // Set the initial value of the ProgressBar. - pBar1->Value = 1; - - // Set the Step property to a value of 1 to represent each file being copied. - pBar1->Step = 1; - - // Loop through all files to copy. - for ( int x = 1; x <= filenames->Length; x++ ) - { - // Copy the file and increment the ProgressBar if successful. - if ( CopyFile( filenames[ x - 1 ] )) - { - // Perform the increment on the ProgressBar. - pBar1->PerformStep(); - } - } - } - // - -protected: - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 288, 72 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 120, 16 ); - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 472, 398 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - array^tempFiles = gcnew array(5); - tempFiles[ 0 ] = "file1.txt"; - tempFiles[ 1 ] = "file2.txt"; - tempFiles[ 2 ] = "file3.txt"; - tempFiles[ 3 ] = "file4.txt"; - tempFiles[ 4 ] = "file5.txt"; - CopyWithProgress( tempFiles ); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp deleted file mode 100644 index 69d2b3c9ade..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp +++ /dev/null @@ -1,121 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 120, 16 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->textBox1->Size = System::Drawing::Size( 288, 272 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 40, 112 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 448, 333 ); - array^temp0 = {this->button1,this->textBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - // Creates a new collection and assign it the properties for button1. - PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); - - // Sets an PropertyDescriptor to the specific property. - System::ComponentModel::PropertyDescriptor^ myProperty = properties->Find( "Text", false ); - - // Prints the property and the property description. - textBox1->Text = String::Concat( myProperty->DisplayName, "\n" ); - textBox1->Text = String::Concat( textBox1->Text, myProperty->Description, "\n" ); - textBox1->Text = String::Concat( textBox1->Text, myProperty->Category, "\n" ); - // - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp deleted file mode 100644 index 391f53b95d3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp +++ /dev/null @@ -1,90 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::IO; -using namespace System::Reflection; -using namespace System::Runtime::Serialization; -using namespace System::Runtime::Serialization::Formatters::Binary; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -namespace TypeCategoryTabExample -{ - ref class TypeCategoryTab; - - // forward declaration. - // This component adds a TypeCategoryTab to the propery browser - // that is available for any components in the current design mode document. - - [PropertyTabAttribute(TypeCategoryTabExample::TypeCategoryTab::typeid,PropertyTabScope::Document)] - public ref class TypeCategoryTabComponent: public System::ComponentModel::Component - { - public: - TypeCategoryTabComponent(){} - }; - - // A TypeCategoryTab property tab lists properties by the - // category of the type of each property. - public ref class TypeCategoryTab: public PropertyTab - { - private: - - // This String^ contains a Base-64 encoded and serialized example property tab image. - - [BrowsableAttribute(true)] - String^ img; - - public: - TypeCategoryTab() - { - img = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////9ZgABZgADzPz/zPz/zPz9AgP//////////gAD/gAD/AAD/AAD/AACKyub///////+AAACAAAAAAP8AAP8AAP9AgP////////9ZgABZgABz13hz13hz13hAgP//////////gAD/gACA/wCA/wCA/wAA//////////+AAACAAAAAAP8AAP8AAP9AgP////////////////////////////////////8L"; - } - - // - // Returns the properties of the specified component extended with - // a CategoryAttribute reflecting the name of the type of the property. - [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)] - virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component, array^attributes ) override - { - PropertyDescriptorCollection^ props; - if ( attributes == nullptr ) - props = TypeDescriptor::GetProperties( component ); - else - props = TypeDescriptor::GetProperties( component, attributes ); - - array^propArray = gcnew array(props->Count); - for ( int i = 0; i < props->Count; i++ ) - { - // Create a new PropertyDescriptor from the old one, with - // a CategoryAttribute matching the name of the type. - array^temp0 = {gcnew CategoryAttribute( props[ i ]->PropertyType->Name )}; - propArray[ i ] = TypeDescriptor::CreateProperty( props[ i ]->ComponentType, props[ i ], temp0 ); - - } - return gcnew PropertyDescriptorCollection( propArray ); - } - - virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component ) override - { - return this->GetProperties( component, nullptr ); - } - // - - property String^ TabName - { - // Provides the name for the property tab. - virtual String^ get() override - { - return "Properties by Type"; - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp b/snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp deleted file mode 100644 index 37c11fe73bf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp +++ /dev/null @@ -1,137 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 488, 301 ); - array^temp1 = {this->textBox1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - textBox1->Text = "changed"; - System::ComponentModel::TypeDescriptor::Refreshed += gcnew System::ComponentModel::RefreshEventHandler( OnRefresh ); - System::ComponentModel::TypeDescriptor::GetProperties( textBox1 ); - System::ComponentModel::TypeDescriptor::Refresh( textBox1 ); - } - -protected: - static void OnRefresh( System::ComponentModel::RefreshEventArgs^ e ) - { - Console::WriteLine( e->ComponentChanged ); - } - // -}; - -ref class Control: public Component -{ -private: - int position; - -public: - - property int Position - { - int get() - { - return position; - } - - void set( int value ) - { - if ( !position.Equals( value ) ) - { - position = value; - - //RaisePropertyChangedEvent(position); - } - } - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp b/snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp deleted file mode 100644 index ac1127ff51c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -ref class TestForm: public Form -{ -public: - - // - void InitializeMyMenu() - { - // Create the MainMenu object. - MainMenu^ myMainMenu = gcnew MainMenu; - - // Create the MenuItem objects. - MenuItem^ fileMenu = gcnew MenuItem( "&File" ); - MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); - MenuItem^ newFile = gcnew MenuItem( "&New" ); - MenuItem^ openFile = gcnew MenuItem( "&Open" ); - MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); - - // Add the MenuItem objects to myMainMenu. - myMainMenu->MenuItems->Add( fileMenu ); - myMainMenu->MenuItems->Add( editMenu ); - - // Add three submenus to the File menu. - fileMenu->MenuItems->Add( newFile ); - fileMenu->MenuItems->Add( openFile ); - fileMenu->MenuItems->Add( exitProgram ); - - // Assign myMainMenu to the form. - Menu = myMainMenu; - - // Remove the item S"Exit" from the File menu. - fileMenu->MenuItems->RemoveAt( 2 ); - } - // -}; - -int main() -{ - Application::Run( gcnew TestForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp b/snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp deleted file mode 100644 index 03b40d2ed26..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - InitializeMyMenu(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // -public: - void InitializeMyMenu() - { - // Create the MainMenu object. - MainMenu^ myMainMenu = gcnew MainMenu; - - // Create the MenuItem objects. - MenuItem^ fileMenu = gcnew MenuItem( "&File" ); - MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); - MenuItem^ newFile = gcnew MenuItem( "&New" ); - MenuItem^ openFile = gcnew MenuItem( "&Open" ); - MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); - - // Add the MenuItem objects to myMainMenu. - myMainMenu->MenuItems->Add( fileMenu ); - myMainMenu->MenuItems->Add( editMenu ); - - // Add three submenus to the File menu. - fileMenu->MenuItems->Add( newFile ); - fileMenu->MenuItems->Add( openFile ); - fileMenu->MenuItems->Add( exitProgram ); - - // Assign myMainMenu to the form. - Menu = myMainMenu; - - // Remove the item S"Open" from the File menu. - fileMenu->MenuItems->Remove( openFile ); - } - // - -private: - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp deleted file mode 100644 index 170567ba143..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - // - // Required for Windows Form Designer supports - // - - // -public: - Form1() - { - InitializeComponent(); - - // Sets the control to allow drops, and then adds the necessary event handlers. - this->richTextBox1->AllowDrop = true; - } - -private: - void listBox1_MouseDown( Object^ sender, System::Windows::Forms::MouseEventArgs^ e ) - { - // Determines which item was selected. - ListBox^ lb = (dynamic_cast(sender)); - Point pt = Point(e->X,e->Y); - - //Retrieve the item at the specified location within the ListBox. - int index = lb->IndexFromPoint( pt ); - - // Starts a drag-and-drop operation. - if ( index >= 0 ) - { - // Retrieve the selected item text to drag into the RichTextBox. - lb->DoDragDrop( lb->Items[ index ]->ToString(), DragDropEffects::Copy ); - } - } - - void richTextBox1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) - { - // If the data is text, copy the data to the RichTextBox control. - if ( e->Data->GetDataPresent( "Text" ) ) - e->Effect = DragDropEffects::Copy; - } - - void richTextBox1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) - { - // Paste the text into the RichTextBox where at selection location. - richTextBox1->SelectedText = e->Data->GetData( "System.String", true )->ToString(); - } - // - -public: - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // listBox1 - // - array^temp1 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot"}; - this->listBox1->Items->AddRange( temp1 ); - this->listBox1->Location = System::Drawing::Point( 16, 16 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 208, 238 ); - this->listBox1->TabIndex = 0; - this->listBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::listBox1_MouseDown ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 240, 16 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 208, 240 ); - this->richTextBox1->TabIndex = 1; - this->richTextBox1->Text = ""; - this->richTextBox1->DragDrop += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::richTextBox1_DragDrop ); - this->richTextBox1->DragEnter += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::richTextBox1_DragEnter ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 464, 273 ); - array^temp2 = {this->richTextBox1,this->listBox1}; - this->Controls->AddRange( temp2 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp deleted file mode 100644 index 479003920cd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp +++ /dev/null @@ -1,157 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteTextToRichTextBox(); - } - - // -private: - void WriteTextToRichTextBox() - { - // Clear all text from the RichTextBox; - richTextBox1->Clear(); - - // Indent bulleted text 30 pixels away from the bullet. - richTextBox1->BulletIndent = 30; - - // Set the font for the opening text to a larger Arial font; - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Assign the introduction text to the RichTextBox control. - richTextBox1->SelectedText = "The following is a list of bulleted items:\n"; - - // Set the Font for the first item to a smaller size Arial font. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); - - // Specify that the following items are to be added to a bulleted list. - richTextBox1->SelectionBullet = true; - - // Set the color of the item text. - richTextBox1->SelectionColor = Color::Red; - - // Assign the text to the bulleted item. - richTextBox1->SelectedText = "Apples" - "\n"; - - // Apply same font since font settings do not carry to next line. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); - richTextBox1->SelectionColor = Color::Orange; - richTextBox1->SelectedText = "Oranges" - "\n"; - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); - richTextBox1->SelectionColor = Color::Purple; - richTextBox1->SelectedText = "Grapes" - "\n"; - - // End the bulleted list. - richTextBox1->SelectionBullet = false; - - // Specify the font size and string for text displayed below bulleted list. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Verdana",10 ); - richTextBox1->SelectedText = "The bulleted text is indented 30 pixels from the bullet symbol using the BulletIndent property.\n"; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp deleted file mode 100644 index 870110370b2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp +++ /dev/null @@ -1,136 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 224 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 248, 192 ); - this->richTextBox1->TabIndex = 1; - this->richTextBox1->Text = "Alpha Bravo Charlie Delta Echo"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->richTextBox1,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - array^temp1 = {'D','e','l','t','a'}; - MessageBox::Show( FindMyText( temp1 ).ToString() ); - } - -public: - int FindMyText( array^text ) - { - // Initialize the return value to false by default. - int returnValue = -1; - - // Ensure that a search string has been specified and a valid start point. - if ( text->Length > 0 ) - { - // Obtain the location of the first character found in the control - // that matches any of the characters in the char array. - int indexToText = richTextBox1->Find( text ); - - // Determine whether the text was found in richTextBox1. - if ( indexToText >= 0 ) - { - // Return the location of the character. - returnValue = indexToText; - } - } - - return returnValue; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp deleted file mode 100644 index c1f2194d9f0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 224 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 248, 192 ); - this->richTextBox1->TabIndex = 1; - this->richTextBox1->Text = "Alpha Bravo Charlie Delta Echo"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^formControls = {this->richTextBox1,this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - array^temp0 = {'B','r','a','v','o'}; - MessageBox::Show( FindMyText( temp0, 5 ).ToString() ); - } - -public: - int FindMyText( array^text, int start ) - { - // Initialize the return value to false by default. - int returnValue = -1; - - // Ensure that a valid char array has been specified and a valid start point. - if ( text->Length > 0 && start >= 0 ) - { - // Obtain the location of the first character found in the control - // that matches any of the characters in the char array. - int indexToText = richTextBox1->Find( text, start ); - - // Determine whether any of the chars are found in richTextBox1. - if ( indexToText >= 0 ) - { - // Return the location of the character. - returnValue = indexToText; - } - } - - return returnValue; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp deleted file mode 100644 index b3d7b066e99..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp +++ /dev/null @@ -1,139 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 256, 160 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "Alpha Bravo Charlie Delta Echo Foxtrot Golf"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 184 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 280, 214 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( FindMyText( "Golf", 44, -1 ).ToString() ); - } - - // -public: - int FindMyText( String^ searchText, int searchStart, int searchEnd ) - { - // Initialize the return value to false by default. - int returnValue = -1; - - // Ensure that a search string and a valid starting point are specified. - if ( searchText->Length > 0 && searchStart >= 0 ) - { - // Ensure that a valid ending value is provided. - if ( searchEnd > searchStart || searchEnd == -1 ) - { - // Obtain the location of the search string in richTextBox1. - int indexToText = richTextBox1->Find( searchText, searchStart, searchEnd, RichTextBoxFinds::MatchCase ); - - // Determine whether the text was found in richTextBox1. - if ( indexToText >= 0 ) - { - // Return the index to the specified search text. - returnValue = indexToText; - } - } - } - - return returnValue; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp deleted file mode 100644 index b700aad43a0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 24, 24 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 320, 264 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "There once was a man from Nantucket."; - this->richTextBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::richTextBox1_MouseDown ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 368, 310 ); - array^temp0 = {this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void richTextBox1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Determine which mouse button is clicked. - if ( e->Button == ::MouseButtons::Left ) - { - // Obtain the character at which the mouse cursor was clicked at. - Char tempChar = richTextBox1->GetCharFromPosition( Point(e->X,e->Y) ); - - // Determine whether the character is an empty space. - if ( !tempChar.ToString()->Equals( " " ) ) - - // Display the character in a message box. - MessageBox::Show( String::Format( "The character at the specified position is {0}.", tempChar ) ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp deleted file mode 100644 index 1ab600d1d79..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp +++ /dev/null @@ -1,118 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 408, 232 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "There once was a brown man from Nantucket..."; - this->richTextBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::richTextBox1_MouseDown ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 440, 270 ); - array^temp0 = {this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void richTextBox1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Declare the string to search for in the control. - String^ searchString = "brown"; - - // Determine whether the user clicks the left mouse button and whether it is a double click. - if ( e->Clicks == 1 && e->Button == ::MouseButtons::Left ) - { - // Obtain the character index where the user clicks on the control. - int positionToSearch = richTextBox1->GetCharIndexFromPosition( Point(e->X,e->Y) ); - - // Search for the search string text within the control from the point the user clicked. - int textLocation = richTextBox1->Find( searchString, positionToSearch, RichTextBoxFinds::None ); - - // If the search string is found (value greater than -1), display the index the string was found at. - if ( textLocation >= 0 ) - MessageBox::Show( String::Format( "The search string was found at character index {0}.", textLocation ) ); // Display a message box alerting the user that the text was not found. - else - MessageBox::Show( "The search string was not found within the text of the control." ); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp deleted file mode 100644 index b2f07642097..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 56, 48 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 208, 176 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 288, 56 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 408, 254 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - richTextBox1->Clear(); - richTextBox1->MaxLength = 2; - AddMyText( "Foo" ); - } - - - // -private: - void AddMyText( String^ textToAdd ) - { - // Determine if the text to add is larger than the max length property. - if ( textToAdd->Length > richTextBox1->MaxLength ) - // Alert user text is too large. - MessageBox::Show( "The text is too large to add to the RichTextBox" ); // Add the text to be added to the control. - else - richTextBox1->SelectedText = textToAdd; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp deleted file mode 100644 index 52a2cac1209..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 32, 40 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 240, 208 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 328, 64 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 432, 350 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Selects all text in the control. - richTextBox1->SelectAll(); - richTextBox1->Cut(); - richTextBox1->Undo(); - RedoAllButDeletes(); - } - - // -private: - void RedoAllButDeletes() - { - // Determines if a Redo operation can be performed. - if ( richTextBox1->CanRedo ) - { - // Determines if the redo operation deletes text. - if ( !richTextBox1->RedoActionName->Equals( "Delete" ) ) - // Perform the redo. - richTextBox1->Redo(); - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp deleted file mode 100644 index 0c418ba73e1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteCenteredTextToRichTextBox(); - } - - // -private: - void WriteCenteredTextToRichTextBox() - { - // Clear all text from the RichTextBox; - richTextBox1->Clear(); - - // Set the foreground color of the text. - richTextBox1->ForeColor = Color::Red; - - // Set the alignment of the text that follows. - richTextBox1->SelectionAlignment = HorizontalAlignment::Center; - - // Set the font for the text. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Lucinda Console",12 ); - - // Set the text within the control. - richTextBox1->SelectedText = "This text is centered using the SelectionAlignment property.\n"; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp deleted file mode 100644 index 473896b4797..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp +++ /dev/null @@ -1,152 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^formControls = {this->button1,this->richTextBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteTextToRichTextBox(); - } - - // -private: - void WriteTextToRichTextBox() - { - // Clear all text from the RichTextBox; - richTextBox1->Clear(); - - // Set the font for the opening text to a larger Arial font; - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Assign the introduction text to the RichTextBox control. - richTextBox1->SelectedText = "The following is a list of bulleted items: \n"; - - // Set the Font for the first item to a smaller size Arial font. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); - - // Specify that the following items are to be added to a bulleted list. - richTextBox1->SelectionBullet = true; - - // Set the color of the item text. - richTextBox1->SelectionColor = Color::Red; - - // Assign the text to the bulleted item. - richTextBox1->SelectedText = "Apples \n"; - - // Apply same font since font settings do not carry to next line. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); - richTextBox1->SelectionColor = Color::Orange; - richTextBox1->SelectedText = "Oranges \n"; - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); - richTextBox1->SelectionColor = Color::Purple; - richTextBox1->SelectedText = "Grapes \n"; - - // End the bulleted list. - richTextBox1->SelectionBullet = false; - - // Specify the font size and string for text displayed below bulleted list. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 ); - richTextBox1->SelectedText = "Bulleted Text Complete!"; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp deleted file mode 100644 index c951a48851b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp +++ /dev/null @@ -1,151 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteOffsetTextToRichTextBox(); - } - - // -private: - void WriteOffsetTextToRichTextBox() - { - // Clear all text from the RichTextBox. - richTextBox1->Clear(); - - // Set the font for the text. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Lucinda Console",12 ); - - // Set the foreground color of the text. - richTextBox1->SelectionColor = Color::Purple; - - // Set the baseline text. - richTextBox1->SelectedText = "10"; - - // Set the CharOffset to display superscript text. - richTextBox1->SelectionCharOffset = 10; - - // Set the superscripted text. - richTextBox1->SelectedText = "2"; - - // Reset the CharOffset to display text at the baseline. - richTextBox1->SelectionCharOffset = 0; - richTextBox1->AppendText( "\n\n" ); - - // Change the forecolor of the next text selection. - richTextBox1->SelectionColor = Color::Blue; - - // Set the baseline text. - richTextBox1->SelectedText = "77"; - - // Set the CharOffset to display subscript text. - richTextBox1->SelectionCharOffset = -10; - - // Set the subscripted text. - richTextBox1->SelectedText = "3"; - - // Reset the CharOffset to display text at the baseline. - richTextBox1->SelectionCharOffset = 0; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp deleted file mode 100644 index 4c9d88e3eff..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteIndentedTextToRichTextBox(); - } - - // -private: - void WriteIndentedTextToRichTextBox() - { - // Clear all text from the RichTextBox; - richTextBox1->Clear(); - - // Specify a 20 pixel hanging indent in all paragraphs. - richTextBox1->SelectionHangingIndent = 20; - - // Set the font for the text. - richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 ); - - // Set the text within the control. - richTextBox1->SelectedText = "This text contains a hanging indent. The first sentence of the paragraph is spaced normally."; - richTextBox1->SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent."; - richTextBox1->SelectedText = "After this paragraph the indent is returned to normal spacing.\n"; - richTextBox1->SelectedText = "Since this is a new paragraph the indent is also applied to this paragraph."; - richTextBox1->SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent."; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp deleted file mode 100644 index 9124f8d3b78..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteIndentedTextToRichTextBox(); - } - - // -private: - void WriteIndentedTextToRichTextBox() - { - // Clear all text from the RichTextBox; - richTextBox1->Clear(); - - // Specify a 20 pixel indent in all paragraphs. - richTextBox1->SelectionIndent = 20; - - // Set the font for the text. - richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 ); - - // Set the text within the control. - richTextBox1->SelectedText = "All text is indented 20 pixels from the left edge of the RichTextBox."; - richTextBox1->SelectedText = "You can use this property to provide proper indentation such as when writing a letter."; - richTextBox1->SelectedText = "After this paragraph the indent is returned to normal spacing.\n\n"; - richTextBox1->SelectionIndent = 0; - richTextBox1->SelectedText = "No indenation is applied to this paragraph. All text in the paragraph flows from each control edge."; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp deleted file mode 100644 index 35a7ac94136..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp +++ /dev/null @@ -1,131 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -internal: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::RichTextBox^ richTextBox1; - -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - richTextBox1->Clear(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 336, 72 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 3; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 24, 24 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 296, 168 ); - this->richTextBox1->TabIndex = 2; - this->richTextBox1->Text = "richTextBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 440, 222 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "C#"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ModifySelectedText(); - } - - // -private: - void ModifySelectedText() - { - // Determine if text is selected in the control. - if ( richTextBox1->SelectionLength > 0 ) - { - // Set the color of the selected text in the control. - richTextBox1->SelectionColor = Color::Red; - - // Set the font of the selected text to bold and underlined. - richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",10,static_cast(FontStyle::Bold | FontStyle::Underline) ); - - // Protect the selected text from modification. - richTextBox1->SelectionProtected = true; - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp deleted file mode 100644 index 2944614e92f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -internal: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::RichTextBox^ richTextBox1; - -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 336, 96 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 5; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 16, 48 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 296, 168 ); - this->richTextBox1->TabIndex = 4; - this->richTextBox1->Text = "richTextBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 424, 254 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - richTextBox1->Clear(); - richTextBox1->AppendText( "This text is being added to the RichTextBox control to protect" ); - ProtectMySelectedText(); - } - - // -private: - void ProtectMySelectedText() - { - // Determine if the selected text in the control contains the word "RichTextBox". - if ( !richTextBox1->SelectedText->Equals( "RichTextBox" ) ) - { - // Search for the word RichTextBox in the control. - if ( richTextBox1->Find( "RichTextBox", RichTextBoxFinds::WholeWord ) == -1 ) - { - //Alert the user that the word was not foun and return. - MessageBox::Show( "The text \"RichTextBox\" was not found!" ); - return; - } - } - - // Protect the selected text in the control from being altered. - richTextBox1->SelectionProtected = true; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp deleted file mode 100644 index 415ba9d8dee..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp +++ /dev/null @@ -1,134 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::RichTextBox^ richTextBox1; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 312, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 416, 382 ); - array^temp0 = {this->button1,this->richTextBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - WriteIndentedTextToRichTextBox(); - } - - - // -private: - void WriteIndentedTextToRichTextBox() - { - // Clear all text from the RichTextBox; - richTextBox1->Clear(); - - // Specify a 20 pixel right indent in all paragraphs. - richTextBox1->SelectionRightIndent = 20; - - // Set the font for the text. - richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 ); - - // Set the text within the control. - richTextBox1->SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox."; - richTextBox1->SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins."; - richTextBox1->SelectedText = "After this paragraph the indentation will end.\n\n"; - - // Remove all right indentation. - richTextBox1->SelectionRightIndent = 0; - richTextBox1->SelectedText = "This paragraph has no right indentation. All text should flow as normal."; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp deleted file mode 100644 index 3462a60ebc4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 256, 224 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 48, 32 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->Size = System::Drawing::Size( 192, 208 ); - this->richTextBox1->TabIndex = 1; - this->richTextBox1->Text = "richTextBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 360, 310 ); - array^temp0 = {this->richTextBox1,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ZoomMyRichTextBox(); - } - - // -private: - void ZoomMyRichTextBox() - { - // Enable users to select entire word when double clicked. - richTextBox1->AutoWordSelection = true; - - // Clear contents of control. - richTextBox1->Clear(); - - // Set the right margin to restrict horizontal text. - richTextBox1->RightMargin = 2; - - // Set the text for the control. - richTextBox1->SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot"; - - // Zoom by 2 points. - richTextBox1->ZoomFactor = 2.0f; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp deleted file mode 100644 index 9ad477c1c18..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer supports - // - InitializeComponent(); - - // Sets the control to allow drops, and then adds the necessary event handlers. - this->richTextBox1->AllowDrop = true; - this->richTextBox1->DragEnter += gcnew DragEventHandler( this, &Form1::richTextBox1_DragEnter ); - this->richTextBox1->DragDrop += gcnew DragEventHandler( this, &Form1::richTextBox1_DragDrop ); - this->listBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::listBox1_MouseDown ); - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - - // Add code here to populate the ListBox1 with paths to text files. - } - - // -private: - void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Sets the AllowDrop property so that data can be dragged onto the control. - richTextBox1->AllowDrop = true; - - // Add code here to populate the ListBox1 with paths to text files. - } - - void listBox1_MouseDown( Object^ sender, System::Windows::Forms::MouseEventArgs^ e ) - { - // Determines which item was selected. - ListBox^ lb = (dynamic_cast(sender)); - Point pt = Point(e->X,e->Y); - int index = lb->IndexFromPoint( pt ); - - // Starts a drag-and-drop operation with that item. - if ( index >= 0 ) - { - lb->DoDragDrop( lb->Items[ index ], DragDropEffects::Link ); - } - } - - void richTextBox1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) - { - // If the data is text, copy the data to the RichTextBox control. - if ( e->Data->GetDataPresent( "Text" ) ) - e->Effect = DragDropEffects::Copy; - } - - void richTextBox1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) - { - // Loads the file into the control. - richTextBox1->LoadFile( dynamic_cast(e->Data->GetData( "Text" )), System::Windows::Forms::RichTextBoxStreamType::RichText ); - } - // - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // listBox1 - // - this->listBox1->Location = System::Drawing::Point( 256, 48 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 120, 95 ); - this->listBox1->TabIndex = 0; - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 64, 40 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->TabIndex = 1; - this->richTextBox1->Text = "richTextBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 464, 273 ); - array^formControls = {this->richTextBox1,this->listBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp deleted file mode 100644 index 1c3eddf3402..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace RichText_CanPaste_CS -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::RichTextBox^ richTextBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - pasteMyBitmap( "c:\\NoImage::bmp" ); - } - - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - // - private: - bool pasteMyBitmap( String^ fileName ) - { - // Open an bitmap from file and copy it to the clipboard. - Bitmap^ myBitmap = gcnew Bitmap( fileName ); - - // Copy the bitmap to the clipboard. - Clipboard::SetDataObject( myBitmap ); - - // Get the format for the object type. - DataFormats::Format^ myFormat = DataFormats::GetFormat( DataFormats::Bitmap ); - - // After verifying that the data can be pasted, paste it. - if ( richTextBox1->CanPaste( myFormat ) ) - { - richTextBox1->Paste( myFormat ); - return true; - } - else - { - MessageBox::Show( "The data format that you attempted to paste is not supported by this control." ); - return false; - } - } - // - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - // richTextBox1 - // - this->richTextBox1->Location = System::Drawing::Point( 40, 136 ); - this->richTextBox1->Name = "richTextBox1"; - this->richTextBox1->TabIndex = 0; - this->richTextBox1->Text = "richTextBox1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {this->richTextBox1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew RichText_CanPaste_CS::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp deleted file mode 100644 index 754f6b50091..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -public: - Form1() - { - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - TabPage^ tabPage2 = gcnew TabPage; - TabPage^ tabPage3 = gcnew TabPage; - TabPage^ tabPage4 = gcnew TabPage; - TabPage^ tabPage5 = gcnew TabPage; - Label^ label1 = gcnew Label; - - // Allows multiple rows of tabs in the tabControl1 tab strip. - tabControl1->Multiline = true; - tabControl1->SizeMode = TabSizeMode::FillToRight; - tabControl1->Padding = Point(15,5); - array^temp0 = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; - tabControl1->Controls->AddRange( temp0 ); - tabControl1->Location = Point(35,65); - tabControl1->Size = System::Drawing::Size( 220, 180 ); - - // Gets the number of rows currently in the tabControl1 tab strip. - // Assigns int value to the rows variable. - int rows = tabControl1->RowCount; - label1->Text = System::String::Concat( "There are ", rows, " rows of tabs in the tabControl1 tab strip." ); - label1->Location = Point(35,25); - label1->Size = System::Drawing::Size( 220, 30 ); - Size = System::Drawing::Size( 300, 300 ); - array^temp1 = {label1,tabControl1}; - Controls->AddRange( temp1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp deleted file mode 100644 index 2be33dd0b15..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace Screen_Example_cs -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::ListBox^ listBox1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 56, 16 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 168, 23 ); - this->button1->TabIndex = 0; - this->button1->Text = "Get Screen Info"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // listBox1 - // - this->listBox1->Location = System::Drawing::Point( 8, 48 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 280, 186 ); - this->listBox1->TabIndex = 1; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {this->listBox1,this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // For each screen, add the screen properties to a list box. - for each (Screen^ screen in Screen::AllScreens) { - listBox1->Items->Add( - String::Concat("Device Name: ", screen->DeviceName)); - listBox1->Items->Add( - String::Concat("Bounds: ", screen->Bounds)); - listBox1->Items->Add( - String::Concat("Type: ", screen->GetType())); - listBox1->Items->Add( - String::Concat("Working Area: ", screen->WorkingArea)); - listBox1->Items->Add( - String::Concat("Primary Screen: ", screen->Primary)); - } - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Screen_Example_cs::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp deleted file mode 100644 index e767545725f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace WindowsApplication2 -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::Form1_MouseDown ); - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - - // - private: - void Form1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - Point p = Point(e->X,e->Y); - Screen^ s = Screen::FromPoint( p ); - if ( s->Primary ) - { - MessageBox::Show( "You clicked the primary screen" ); - } - else - { - MessageBox::Show( "This isn't the primary screen" ); - } - // - } - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew WindowsApplication2::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp deleted file mode 100644 index 8f3add31e10..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - array^tabControls = {this->tabPage1,this->tabPage2}; - this->tabControl1->Controls->AddRange( tabControls ); - this->tabControl1->Padding = Point(15,10); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - - // Selects tabPage2 using SelectedIndex. - this->tabControl1->SelectedIndex = 1; - this->tabPage1->Text = "myTabPage1"; - this->tabPage1->TabIndex = 0; - this->tabPage2->Text = "myTabPage2"; - this->tabPage2->TabIndex = 1; - this->Size = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp deleted file mode 100644 index bffe075a14f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp +++ /dev/null @@ -1,50 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - array^temp0 = {this->tabPage1,this->tabPage2}; - this->tabControl1->Controls->AddRange( temp0 ); - this->tabControl1->Padding = Point(15,10); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - - // Selects tabPage2 using SelectedTab. - this->tabControl1->SelectedTab = tabPage2; - this->tabPage1->Text = "tabPage1"; - this->tabPage2->Text = "tabPage2"; - this->Size = System::Drawing::Size( 300, 300 ); - array^temp1 = {this->tabControl1}; - this->Controls->AddRange( temp1 ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp b/snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp deleted file mode 100644 index e8110ab8514..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp +++ /dev/null @@ -1,421 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; - -ref class ServiceObjectControl; - -// Example form provides UI for demonstrating service sharing behavior -// of a network of IServiceContainer/IServiceProvider controls. -public ref class ServiceForm: public System::Windows::Forms::Form -{ -private: - - // Root service container control for tree. - ServiceObjectControl^ root; - - // Button for clearing any provided services and resetting tree states. - System::Windows::Forms::Button^ reset_button; - - // Color list used to color code controls. - array^colorkeys; - - // Strings used to reflect text service. - array^keystrings; - -public: - ServiceForm() - { - InitializeComponent(); - CreateServiceControlTree(); - colorkeys = gcnew array(6); - colorkeys[ 0 ] = Color::Beige; - colorkeys[ 1 ] = Color::SeaShell; - colorkeys[ 2 ] = Color::LightGreen; - colorkeys[ 3 ] = Color::LightBlue; - colorkeys[ 4 ] = Color::Khaki; - colorkeys[ 5 ] = Color::CadetBlue; - array^stringstemp = {"No service use","Service not accessible","Service provided", - "Service obtained","Service accessible","No further access"}; - keystrings = stringstemp; - } - -private: - void CreateServiceControlTree(); - void InitializeComponent(); - -internal: - void ResetServiceTree( Object^ sender, EventArgs^ e ); -public: - void UpdateServiceCoverage(); - -protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override; -}; - -// Example service type contains a text string, sufficient -// to demonstrate service sharing. -public ref class TextService -{ -public: - String^ text; - TextService() - : text( String::Empty ) - {} - - TextService( String^ text ) - { - this->text = text; - } -}; - -public enum class TextServiceState -{ - ServiceNotObtained, ServiceObtained, ServiceProvided, ServiceNotFound -}; - -// Example Form for entering a string. -private ref class StringInputDialog: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ ok_button; - System::Windows::Forms::Button^ cancel_button; - -public: - System::Windows::Forms::TextBox^ inputTextBox; - StringInputDialog( String^ text ) - { - InitializeComponent(); - inputTextBox->Text = text; - } - -private: - void InitializeComponent() - { - this->ok_button = gcnew System::Windows::Forms::Button; - this->cancel_button = gcnew System::Windows::Forms::Button; - this->inputTextBox = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | - System::Windows::Forms::AnchorStyles::Right); - this->ok_button->Location = System::Drawing::Point( 180, 43 ); - this->ok_button->Name = "ok_button"; - this->ok_button->TabIndex = 1; - this->ok_button->Text = "OK"; - this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; - this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | - System::Windows::Forms::AnchorStyles::Right); - this->cancel_button->Location = System::Drawing::Point( 260, 43 ); - this->cancel_button->Name = "cancel_button"; - this->cancel_button->TabIndex = 2; - this->cancel_button->Text = "Cancel"; - this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; - this->inputTextBox->Location = System::Drawing::Point( 6, 9 ); - this->inputTextBox->Name = "inputTextBox"; - this->inputTextBox->Size = System::Drawing::Size( 327, 20 ); - this->inputTextBox->TabIndex = 0; - this->inputTextBox->Text = ""; - this->inputTextBox->Anchor = static_cast((System::Windows::Forms::AnchorStyles::Top | - System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); - this->ClientSize = System::Drawing::Size( 342, 73 ); - array^temp0 = {this->inputTextBox,this->cancel_button,this->ok_button}; - this->Controls->AddRange( temp0 ); - this->MinimumSize = System::Drawing::Size( 350, 100 ); - this->Name = "StringInputDialog"; - this->Text = "Text Service Provide String Dialog"; - this->ResumeLayout( false ); - } -}; - - -// An example user control that uses ServiceContainer to add, remove, -// and access services through a linkable service container network. -public ref class ServiceObjectControl: public System::Windows::Forms::UserControl -{ -public: - - // This example user control implementation provides a wrapper for - // ServiceContainer, supporting a linked service container network. - ServiceContainer^ serviceContainer; - -private: - - // Parent form reference for main program function access. - ServiceForm^ parent; - -public: - - // String for label displayed on the control to indicate the - // control's current service-related configuration state. - String^ label; - -private: - - // The current state of the control reflecting whether it has - // obtained or provided a text service. - TextServiceState state_; - -public: - - property TextServiceState state - { - TextServiceState get() - { - return state_; - } - - void set( TextServiceState value ) - { - if ( (TextServiceState)value == TextServiceState::ServiceProvided ) - this->BackColor = Color::LightGreen; - else - if ( (TextServiceState)value == TextServiceState::ServiceNotObtained ) - this->BackColor = Color::White; - else - if ( (TextServiceState)value == TextServiceState::ServiceObtained ) - this->BackColor = Color::LightBlue; - else - if ( (TextServiceState)value == TextServiceState::ServiceNotFound ) - this->BackColor = Color::SeaShell; - - state_ = value; - } - } - ServiceObjectControl( ServiceObjectControl^ serviceContainerParent, System::Drawing::Size size, - Point location, ServiceForm^ parent ) - { - this->state_ = TextServiceState::ServiceNotObtained; - this->BackColor = Color::Beige; - this->label = String::Empty; - this->Size = size; - this->Location = location; - this->parent = parent; - if ( serviceContainerParent == nullptr ) - serviceContainer = gcnew ServiceContainer; - else - serviceContainer = gcnew ServiceContainer( serviceContainerParent->serviceContainer ); - } - -protected: - - // Paint method override draws the label string on the control. - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - e->Graphics->DrawString( label, gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); - } - - // Process mouse-down behavior for click. - virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) override - { - if ( e->Button == ::MouseButtons::Left ) - { - if ( state_ != TextServiceState::ServiceProvided ) - { - // Attempt to update text from service, and set color - // state accordingly. - TextService^ ts = dynamic_cast(serviceContainer->GetService( TextService::typeid )); - if ( ts != nullptr ) - { - this->label = ts->text; - state = TextServiceState::ServiceObtained; - } - else - { - this->label = "Service Not Found"; - state = TextServiceState::ServiceNotFound; - } - } - } - - if ( e->Button == ::MouseButtons::Right ) - { - if ( state_ == TextServiceState::ServiceProvided ) - { - // Remove service if the container provided it. - if ( serviceContainer->GetService( TextService::typeid ) != nullptr ) - { - serviceContainer->RemoveService( TextService::typeid, true ); - state = TextServiceState::ServiceNotObtained; - this->label = "Service Removed"; - } - } - else - { - // Obtain string and provide text service. - StringInputDialog^ form = gcnew StringInputDialog( "Test String" ); - form->StartPosition = FormStartPosition::CenterParent; - if ( form->ShowDialog() == DialogResult::OK ) - { - if ( serviceContainer->GetService( TextService::typeid ) != nullptr ) - serviceContainer->RemoveService( TextService::typeid, true ); - parent->ResetServiceTree( this, gcnew EventArgs ); - serviceContainer->AddService( TextService::typeid, gcnew TextService( form->inputTextBox->Text ), true ); - state = TextServiceState::ServiceProvided; - this->label = String::Format( "Provided Text: {0}", form->inputTextBox->Text ); - } - } - } - - parent->UpdateServiceCoverage(); - } - -public: - - // Method accesses the TextService to test the visibility of the service - // from the control, and sets the UI state accordingly. - void ReflectServiceVisibility() - { - if ( state_ == TextServiceState::ServiceObtained ) - { - if ( serviceContainer->GetService( TextService::typeid ) == nullptr ) - this->BackColor = Color::CadetBlue; - } - else - if ( state_ != TextServiceState::ServiceProvided ) - { - if ( serviceContainer->GetService( TextService::typeid ) == nullptr ) - { - this->BackColor = Color::White; - return; - } - - // Service available. - if ( state_ == TextServiceState::ServiceNotFound ) - this->BackColor = Color::Khaki; - else - if ( state_ == TextServiceState::ServiceNotObtained && !label->Equals( "Service Removed" ) ) - this->BackColor = Color::Khaki; - } - } -}; - -void ServiceForm::CreateServiceControlTree() -{ - // Create root service control. - ServiceObjectControl^ control1 = gcnew ServiceObjectControl( nullptr,System::Drawing::Size( 300, 40 ),Point(10,80),this ); - root = control1; - - // Create first tier - pass parent with service object control 1 - ServiceObjectControl^ control2 = gcnew ServiceObjectControl( control1,System::Drawing::Size( 200, 30 ),Point(50,160),this ); - ServiceObjectControl^ control3 = gcnew ServiceObjectControl( control1,System::Drawing::Size( 200, 30 ),Point(50,240),this ); - - // Create second tier A - pass parent with service object control 2 - ServiceObjectControl^ control4 = gcnew ServiceObjectControl( control2,System::Drawing::Size( 180, 20 ),Point(300,145),this ); - ServiceObjectControl^ control5 = gcnew ServiceObjectControl( control2,System::Drawing::Size( 180, 20 ),Point(300,185),this ); - - // Create second tier B - pass parent with service object control 3 - ServiceObjectControl^ control6 = gcnew ServiceObjectControl( control3,System::Drawing::Size( 180, 20 ),Point(300,225),this ); - ServiceObjectControl^ control7 = gcnew ServiceObjectControl( control3,System::Drawing::Size( 180, 20 ),Point(300,265),this ); - - // Add controls. - array^temp1 = {control1,control2,control3,control4,control5,control6,control7}; - this->Controls->AddRange( temp1 ); -} - -void ServiceForm::ResetServiceTree( Object^ /*sender*/, EventArgs^ /*e*/ ) -{ - // Remove the service from the service tree. - if ( root->serviceContainer->GetService( TextService::typeid ) != nullptr ) - root->serviceContainer->RemoveService( TextService::typeid, true ); - - // Set all controls to "not obtained" and clear their labels. - for ( int i = 0; i < Controls->Count; i++ ) - if ( !Controls[ i ]->Equals( reset_button ) ) - { - (dynamic_cast(Controls[ i ]))->state = TextServiceState::ServiceNotObtained; - (dynamic_cast(Controls[ i ]))->label = String::Empty; - (dynamic_cast(Controls[ i ]))->BackColor = Color::Beige; - } -} - -void ServiceForm::UpdateServiceCoverage() -{ - // Have each control set state to reflect service availability. - for ( int i = 0; i < Controls->Count; i++ ) - if ( !Controls[ i ]->Equals( reset_button ) ) - (dynamic_cast(Controls[ i ]))->ReflectServiceVisibility(); -} - -void ServiceForm::InitializeComponent() -{ - this->reset_button = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // reset_button - // - this->reset_button->Location = System::Drawing::Point( 392, 88 ); - this->reset_button->Name = "reset_button"; - this->reset_button->TabIndex = 0; - this->reset_button->TabStop = false; - this->reset_button->Text = "Reset"; - this->reset_button->Click += gcnew System::EventHandler( this, &ServiceForm::ResetServiceTree ); - - // - // ServiceForm - // - this->ClientSize = System::Drawing::Size( 512, 373 ); - array^temp2 = {this->reset_button}; - this->Controls->AddRange( temp2 ); - this->MinimumSize = System::Drawing::Size( 520, 400 ); - this->Name = "ServiceForm"; - this->Text = "Service Container Architecture Example"; - this->ResumeLayout( false ); -} - -void ServiceForm::OnPaint( System::Windows::Forms::PaintEventArgs^ e ) -{ - e->Graphics->DrawString( "The following tree diagram represents a hierarchy of linked service containers in controls.", - gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 4, 4 ); - e->Graphics->DrawString( "This example demonstrates the propagation behavior of services through a linked service object tree.", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 26 ); - e->Graphics->DrawString( "Right-click a component to add or replace a text service, or to remove it if the component provided it.", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 38 ); - e->Graphics->DrawString( "Left-click a component to update text from the text service if available.", - gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 50 ); - - // Draw lines to represent tree branches. - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 125, 20, 258 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 175, 45, 175 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 258, 45, 258 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 175, 285, 175 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 258, 285, 258 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 285, 195 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 285, 278 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 290, 155 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 195, 290, 195 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 290, 238 ); - e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 278, 290, 278 ); - - // Draw color key. - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 305, 410, 60 ); - int y = 0; - for ( int i = 0; i < 3; i++ ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 310, 20, 20 ); - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 310, 20, 20 ); - e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), - (float)50 + (i * 140), 315 ); - y++; - e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 340, 20, 20 ); - e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 340, 20, 20 ); - e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), - (float)50 + (i * 140), 345 ); - y++; - } -} - -[STAThread] -int main() -{ - Application::Run( gcnew ServiceForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp deleted file mode 100644 index 185ec5d0cc7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp +++ /dev/null @@ -1,232 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Windows::Forms; - -/* This sample uses the ServiceContainer class, which implements - the IServiceContainer interface. It creates a service container - and stores services of type Control in it. - - When the application is run, it adds control services at two - times: when button2 is clicked and when a radio button is - clicked. It adds the controls to the container by calling each - of two overloaded versions of IServiceContainer.AddService(). - - Pressing button1 invokes the button1 handler, which is - button1_Click(). In turn, this invokes a method based on - whether or not button2 or a radio button has been selected. - If one of these two button types has been selected, then its - service has been added to the service container. In this case, - button1_Click() gets the current service, which invokes the - method that was associated with this service when the service - was added to the container. If a radio button is current, the - system updates the text of that radio button with the given text. - If button2 is current, the system calls CreateNewControl(), which - creates a new control with the given text. - - Pressing button2 invokes the button2 handler, which adds a service - to the container by passing in a service creator callback. This - enables this action to invoke the event handler that the developer - specifies. In this case, the sample invokes CreateNewControl(), - which creates and maintains label controls, and displays them in - the same group box that the buttons are in. - - Clicking a radio button has the effect of adding that radio button - to the service container. -*/ - -public ref class Form1: public Form -{ -private: - Button^ button1; - GroupBox^ groupBox1; - RadioButton^ radioButton1; - RadioButton^ radioButton2; - RadioButton^ radioButton3; - RadioButton^ radioButton4; - System::ComponentModel::Container^ components; - Button^ button2; - ServiceContainer^ m_MyServiceContainer; - int m_nLabelCount; - void InitializeComponent() - { - button1 = gcnew Button; - groupBox1 = gcnew GroupBox; - button2 = gcnew Button; - radioButton4 = gcnew RadioButton; - radioButton3 = gcnew RadioButton; - radioButton2 = gcnew RadioButton; - radioButton1 = gcnew RadioButton; - groupBox1->SuspendLayout(); - SuspendLayout(); - - // - // button1 - // - button1->Location = System::Drawing::Point( 24, 16 ); - button1->Name = "button1"; - button1->Size = System::Drawing::Size( 112, 32 ); - button1->TabIndex = 0; - button1->Text = "button1"; - button1->Click += gcnew EventHandler( this, &Form1::button1_Click ); - - // - // groupBox1 - // - array^myArray = {button2,radioButton4,radioButton3,radioButton2,radioButton1}; - groupBox1->Controls->AddRange( myArray ); - groupBox1->Location = System::Drawing::Point( 8, 56 ); - groupBox1->Name = "groupBox1"; - groupBox1->Size = System::Drawing::Size( 272, 200 ); - groupBox1->TabIndex = 1; - groupBox1->TabStop = false; - groupBox1->Text = "groupBox1"; - - // - // button2 - // - button2->Location = System::Drawing::Point( 40, 152 ); - button2->Name = "button2"; - button2->Size = System::Drawing::Size( 90, 26 ); - button2->TabIndex = 4; - button2->Text = "button2"; - button2->Click += gcnew EventHandler( this, &Form1::button2_Click ); - - // - // radioButton4 - // - radioButton4->Location = System::Drawing::Point( 32, 112 ); - radioButton4->Name = "radioButton4"; - radioButton4->TabIndex = 3; - radioButton4->Text = "radioButton4"; - radioButton4->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // radioButton3 - // - radioButton3->Location = System::Drawing::Point( 32, 80 ); - radioButton3->Name = "radioButton3"; - radioButton3->TabIndex = 2; - radioButton3->Text = "radioButton3"; - radioButton3->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // radioButton2 - // - radioButton2->Location = System::Drawing::Point( 32, 48 ); - radioButton2->Name = "radioButton2"; - radioButton2->TabIndex = 1; - radioButton2->Text = "radioButton2"; - radioButton2->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // radioButton1 - // - radioButton1->Location = System::Drawing::Point( 32, 16 ); - radioButton1->Name = "radioButton1"; - radioButton1->TabIndex = 0; - radioButton1->Text = "radioButton1"; - radioButton1->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); - - // - // Form1 - // - ClientSize = System::Drawing::Size( 292, 272 ); - myArray = gcnew array(2); - myArray[ 0 ] = groupBox1; - myArray[ 1 ] = button1; - Controls->AddRange( myArray ); - Name = "Form1"; - Text = "Form1"; - groupBox1->ResumeLayout( false ); - ResumeLayout( false ); - } - - void radioButton1_CheckedChanged( Object^ sender, EventArgs^ /*e*/ ) - { - /* The application never displays this control so a generic - type of Control is fine */ - m_MyServiceContainer->RemoveService( Control::typeid ); - - // - m_MyServiceContainer->AddService( Control::typeid, sender ); - // - } - - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - /* Get the current control, if one is current. Here it's either a - push button or a radio control */ - Control^ c = dynamic_cast(m_MyServiceContainer->GetService( Control::typeid )); - if ( c != nullptr ) - { - - // Update the text of whichever control is currently selected. - c->Text = "Button1 clicked"; - } - } - - void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - /* ServiceContainer will throw an excpetion if a duplicate service - is added so remove it before we add */ - // - m_MyServiceContainer->RemoveService( Control::typeid ); - // - /* Whenever button2 is pressed, attach the callback method to the service - and add the service to the container. This causes any update to - invoke CreateNewControl() when button1 is pressed */ - // - m_MyServiceContainer->AddService( Control::typeid, gcnew ServiceCreatorCallback( this, &Form1::CreateNewControl ) ); - // - } - - /* If the application arrives at this method, it means that in button1_Click(), - GetService() was passed the service that corresponds to button2. This has - the effect of invoking the service creator callback for button2, which is - the method CreateNewControl(), and which was mapped in button2_Click(). */ - Object^ CreateNewControl( IServiceContainer^ /*container*/, Type^ /*serviceType*/ ) - { - Control^ c = gcnew Label; - c->Size = radioButton1->Size; - Point loc = button2->Location; - loc.X = 160; - loc.Y = 20 + 25 * m_nLabelCount; - c->Location = loc; - groupBox1->Controls->Add( c ); - ++m_nLabelCount; - return c; - } - -public: - Form1() - { - m_MyServiceContainer = gcnew ServiceContainer; - InitializeComponent(); - } - -public: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } -}; - -// The main entry point for the application. - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp deleted file mode 100644 index b746487cfb3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -public: - Form1() - { - SetData1(); - } - - // -private: - void SetData1() - { - // Creates a component to store in the data object. - Component^ myComponent = gcnew Component; - - // Creates a data object. - DataObject^ myDataObject = gcnew DataObject; - - // Adds the component to the data object. - myDataObject->SetData( myComponent ); - - // Checks whether data of the specified type is in the data object. - Type^ myType = myComponent->GetType(); - String^ myMessageText; - if ( myDataObject->GetDataPresent( myType ) ) - { - myMessageText = "Data of type " + myType->Name + - " is present in the data object"; - } - else - { - myMessageText = "Data of type " + myType->Name + - " is not present in the data object"; - } - - // Displays the result in a message box. - MessageBox::Show( myMessageText, "The Test Result" ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp deleted file mode 100644 index c32123fb881..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -public: - Form1() - { - SetData2(); - } - - // -private: - void SetData2() - { - // Creates a data object. - DataObject^ myDataObject = gcnew DataObject; - - // Stores a string, specifying the UnicodeText format. - myDataObject->SetData( DataFormats::UnicodeText, "Hello World!" ); - - // Retrieves the data by specifying the Text format. - String^ myMessageText = "The data type is " + - myDataObject->GetData( DataFormats::Text )->GetType()->Name; - - // Displays the result. - MessageBox::Show( myMessageText, "The Test Result" ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp deleted file mode 100644 index 59455602428..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public Form -{ -public: - Form1() - { - SetData3(); - } - - // -private: - void SetData3() - { - // Creates a component. - Component^ myComponent = gcnew Component; - - // Gets the type of the component. - Type^ myType = myComponent->GetType(); - - // Creates a data object. - DataObject^ myDataObject = gcnew DataObject; - - // Stores the component in the data object. - myDataObject->SetData( myType, myComponent ); - - // Checks whether data of the specified type is in the data object. - String^ myMessageText; - if ( myDataObject->GetDataPresent( myType ) ) - { - myMessageText = "Data of type " + myType->Name + - " is stored in the data object"; - } - else - { - myMessageText = "No data of type " + myType->Name + - " is stored in the data object"; - } - - // Displays the result. - MessageBox::Show( myMessageText, "The Test Result" ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp deleted file mode 100644 index 6a6f91303ed..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace SetData4 -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - SetData4(); - - // - // TODO: Adds any constructor code after InitializeComponent call - // - } - - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 276 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - // - private: - void SetData4() - { - // Creates a new data object. - DataObject^ myDataObject = gcnew DataObject; - - // Adds UnicodeText string to the object, and set the autoConvert - // parameter to false. - myDataObject->SetData( DataFormats::UnicodeText, false, "My text String*" ); - - // Gets the data format(s) in the data object. - array^arrayOfFormats = myDataObject->GetFormats(); - - // Stores the results in a string. - String^ theResult = "The format(s) associated with the data are: \n"; - for ( int i = 0; i < arrayOfFormats->Length; i++ ) - theResult = theResult + arrayOfFormats[ i ], " \n"; - - // Show the results in a message box. - MessageBox::Show( theResult ); - } - // - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew SetData4::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp deleted file mode 100644 index 2202cacf28f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - TabPage^ tabPage2 = gcnew TabPage; - TabPage^ tabPage3 = gcnew TabPage; - TabPage^ tabPage4 = gcnew TabPage; - TabPage^ tabPage5 = gcnew TabPage; - array^tabPages = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; - - // Sizes the tabs so that each row fills the entire width of tabControl1. - this->tabControl1->SizeMode = TabSizeMode::FillToRight; - this->tabControl1->Multiline = true; - this->tabControl1->Padding = Point(15,5); - array^temp0 = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; - this->tabControl1->Controls->AddRange( temp0 ); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - this->Size = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp b/snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp deleted file mode 100644 index 18892c71e41..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::SplitContainer^ splitContainer1; - -public: - - // Create an empty Windows form. - Form1() - { - InitializeComponent(); - } - - -private: - void InitializeComponent() - { - splitContainer1 = gcnew System::Windows::Forms::SplitContainer; - splitContainer1->SuspendLayout(); - SuspendLayout(); - - // Place a basic SplitContainer control onto Form1. - splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill; - splitContainer1->Location = System::Drawing::Point( 0, 0 ); - splitContainer1->Name = "splitContainer1"; - splitContainer1->Size = System::Drawing::Size( 292, 273 ); - splitContainer1->SplitterDistance = 52; - splitContainer1->SplitterWidth = 6; - splitContainer1->TabIndex = 0; - splitContainer1->Text = "splitContainer1"; - - // Add the event handler for the SplitterMoved event. - splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved ); - - // Add the event handler for the SplitterMoving event. - splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving ); - - // This is the left panel of the vertical SplitContainer control. - splitContainer1->Panel1->Name = "splitterPanel1"; - - // This is the right panel of the vertical SplitContainer control. - splitContainer1->Panel2->Name = "splitterPanel2"; - - // Lay out the basic properties of the form. - ClientSize = System::Drawing::Size( 292, 273 ); - Controls->Add( splitContainer1 ); - Name = "Form1"; - Text = "Form1"; - splitContainer1->ResumeLayout( false ); - ResumeLayout( false ); - } - - void splitContainer1_SplitterMoved( System::Object^ /*sender*/, System::Windows::Forms::SplitterEventArgs^ /*e*/ ) - { - - // Define what happens when the splitter is no longer moving. - ::Cursor::Current = System::Windows::Forms::Cursors::Default; - } - - void splitContainer1_SplitterMoving( System::Object^ /*sender*/, System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ ) - { - - // Define what happens while the splitter is moving. - ::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert; - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp deleted file mode 100644 index b36e73c8558..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - CreateMySplitControls(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - // -private: - void CreateMySplitControls() - { - // Create TreeView, ListView, and Splitter controls. - TreeView^ treeView1 = gcnew TreeView; - ListView^ listView1 = gcnew ListView; - Splitter^ splitter1 = gcnew Splitter; - - // Set the TreeView control to dock to the left side of the form. - treeView1->Dock = DockStyle::Left; - - // Set the Splitter to dock to the left side of the TreeView control. - splitter1->Dock = DockStyle::Left; - - // Set the minimum size the ListView control can be sized to. - splitter1->MinExtra = 100; - - // Set the minimum size the TreeView control can be sized to. - splitter1->MinSize = 75; - - // Set the ListView control to fill the remaining space on the form. - listView1->Dock = DockStyle::Fill; - - // Add a TreeView and a ListView item to identify the controls on the form. - treeView1->Nodes->Add( "TreeView Node" ); - listView1->Items->Add( "ListView Item" ); - - // Add the controls in reverse order to the form to ensure proper location. - array^temp0 = {listView1,splitter1,treeView1}; - this->Controls->AddRange( temp0 ); - } - // - -public: - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 384, 365 ); - this->Name = "Form1"; - this->Text = "Form1"; - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp deleted file mode 100644 index e4aa78ab726..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 152, 96 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 376, 293 ); - array^temp1 = {this->button1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void CreateMyStatusBar() - { - // Create a StatusBar control. - StatusBar^ statusBar1 = gcnew StatusBar; - - // Create two StatusBarPanel objects to display in the StatusBar. - StatusBarPanel^ panel1 = gcnew StatusBarPanel; - StatusBarPanel^ panel2 = gcnew StatusBarPanel; - - // Display the first panel with a sunken border style. - panel1->BorderStyle = StatusBarPanelBorderStyle::Sunken; - - // Initialize the text of the panel. - panel1->Text = "Ready..."; - - // Set the AutoSize property to use all remaining space on the StatusBar. - panel1->AutoSize = StatusBarPanelAutoSize::Spring; - - // Display the second panel with a raised border style. - panel2->BorderStyle = StatusBarPanelBorderStyle::Raised; - - // Create ToolTip text that displays the time the application - // was started. - panel2->ToolTipText = System::DateTime::Now.ToShortTimeString(); - - // Set the text of the panel to the current date. - panel2->Text = "Started: " + System::DateTime::Today.ToLongDateString(); - - // Set the AutoSize property to size the panel to the size of the contents. - panel2->AutoSize = StatusBarPanelAutoSize::Contents; - - // Display panels in the StatusBar control. - statusBar1->ShowPanels = true; - - // Add both panels to the StatusBarPanelCollection of the StatusBar. - statusBar1->Panels->Add( panel1 ); - statusBar1->Panels->Add( panel2 ); - - // Add the StatusBar to the form. - this->Controls->Add( statusBar1 ); - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - CreateMyStatusBar(); - } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp deleted file mode 100644 index ba6e38de238..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp +++ /dev/null @@ -1,148 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace OwnerDrawnStatusBarPanel -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::StatusBar^ statusBar1; - System::Windows::Forms::StatusBarPanel^ statusBarPanel1; - System::Windows::Forms::StatusBarPanel^ statusBarPanel2; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - StatusBarPanel^ sbp = gcnew StatusBarPanel; - sbp->Width = 100; - sbp->Style = StatusBarPanelStyle::OwnerDraw; - statusBar1->Panels->Add( sbp ); - } - - protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->statusBar1 = gcnew System::Windows::Forms::StatusBar; - this->statusBarPanel1 = gcnew System::Windows::Forms::StatusBarPanel; - this->statusBarPanel2 = gcnew System::Windows::Forms::StatusBarPanel; - this->button1 = gcnew System::Windows::Forms::Button; - ((System::ComponentModel::ISupportInitialize^)(this->statusBarPanel1))->BeginInit(); - ((System::ComponentModel::ISupportInitialize^)(this->statusBarPanel2))->BeginInit(); - this->SuspendLayout(); - - // - // statusBar1 - // - this->statusBar1->Location = System::Drawing::Point( 0, 384 ); - this->statusBar1->Name = "statusBar1"; - array^statusBar1panels = {this->statusBarPanel1,this->statusBarPanel2}; - this->statusBar1->Panels->AddRange( statusBar1panels ); - this->statusBar1->ShowPanels = true; - this->statusBar1->Size = System::Drawing::Size( 536, 22 ); - this->statusBar1->TabIndex = 0; - this->statusBar1->Text = "statusBar1"; - this->statusBar1->DrawItem += gcnew System::Windows::Forms::StatusBarDrawItemEventHandler( this, &Form1::DrawMyPanel ); - - // - // statusBarPanel1 - // - this->statusBarPanel1->Text = "statusBarPanel1"; - - // - // statusBarPanel2 - // - this->statusBarPanel2->Text = "statusBarPanel2"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 336, 112 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 104, 32 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 536, 406 ); - array^formControls = {this->button1,this->statusBar1}; - this->Controls->AddRange( formControls ); - this->Name = "Form1"; - this->Text = "Form1"; - (dynamic_cast(this->statusBarPanel1))->EndInit(); - (dynamic_cast(this->statusBarPanel2))->EndInit(); - this->ResumeLayout( false ); - } - - // - private: - void DrawMyPanel( Object^ /*sender*/, System::Windows::Forms::StatusBarDrawItemEventArgs^ sbdevent ) - { - // Create a StringFormat object to align text in the panel. - StringFormat^ sf = gcnew StringFormat; - - // Format the String of the StatusBarPanel to be centered. - sf->Alignment = StringAlignment::Center; - sf->LineAlignment = StringAlignment::Center; - - // Draw a back blackground in owner-drawn panel. - sbdevent->Graphics->FillRectangle( Brushes::Black, sbdevent->Bounds ); - - // Draw the current date (short date format) with white text in the control's font. - sbdevent->Graphics->DrawString( DateTime::Today.ToShortDateString(), statusBar1->Font, Brushes::White, sbdevent->Bounds, sf ); - } - // - }; -} - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew OwnerDrawnStatusBarPanel::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp b/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp deleted file mode 100644 index abfc2d3bd7a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp +++ /dev/null @@ -1,310 +0,0 @@ - - -// -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Threading; -using namespace System::Windows::Forms; - -// -public ref class FibonacciForm: public System::Windows::Forms::Form -{ -private: - - // - int numberToCompute; - int highestPercentageReached; - // - - System::Windows::Forms::NumericUpDown^ numericUpDown1; - System::Windows::Forms::Button^ startAsyncButton; - System::Windows::Forms::Button^ cancelAsyncButton; - System::Windows::Forms::ProgressBar^ progressBar1; - System::Windows::Forms::Label ^ resultLabel; - System::ComponentModel::BackgroundWorker^ backgroundWorker1; - -public: - FibonacciForm() - { - InitializeComponent(); - numberToCompute = highestPercentageReached = 0; - InitializeBackgoundWorker(); - } - - -private: - - // Set up the BackgroundWorker object by - // attaching event handlers. - void InitializeBackgoundWorker() - { - backgroundWorker1->DoWork += gcnew DoWorkEventHandler( this, &FibonacciForm::backgroundWorker1_DoWork ); - backgroundWorker1->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler( this, &FibonacciForm::backgroundWorker1_RunWorkerCompleted ); - backgroundWorker1->ProgressChanged += gcnew ProgressChangedEventHandler( this, &FibonacciForm::backgroundWorker1_ProgressChanged ); - } - - // - void startAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Reset the text in the result label. - resultLabel->Text = String::Empty; - - // Disable the UpDown control until - // the asynchronous operation is done. - this->numericUpDown1->Enabled = false; - - // Disable the Start button until - // the asynchronous operation is done. - this->startAsyncButton->Enabled = false; - - // Enable the Cancel button while - // the asynchronous operation runs. - this->cancelAsyncButton->Enabled = true; - - // Get the value from the UpDown control. - numberToCompute = (int)numericUpDown1->Value; - - // Reset the variable for percentage tracking. - highestPercentageReached = 0; - - // - // Start the asynchronous operation. - backgroundWorker1->RunWorkerAsync( numberToCompute ); - // - } - // - - // - void cancelAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Cancel the asynchronous operation. - this->backgroundWorker1->CancelAsync(); - - // Disable the Cancel button. - cancelAsyncButton->Enabled = false; - } - // - - // - // This event handler is where the actual, - // potentially time-consuming work is done. - void backgroundWorker1_DoWork( Object^ sender, DoWorkEventArgs^ e ) - { - // Get the BackgroundWorker that raised this event. - BackgroundWorker^ worker = dynamic_cast(sender); - - // Assign the result of the computation - // to the Result property of the DoWorkEventArgs - // object. This is will be available to the - // RunWorkerCompleted eventhandler. - e->Result = ComputeFibonacci( safe_cast(e->Argument), worker, e ); - } - // - - // - // This event handler deals with the results of the - // background operation. - void backgroundWorker1_RunWorkerCompleted( Object^ /*sender*/, RunWorkerCompletedEventArgs^ e ) - { - // First, handle the case where an exception was thrown. - if ( e->Error != nullptr ) - { - MessageBox::Show( e->Error->Message ); - } - else - if ( e->Cancelled ) - { - // Next, handle the case where the user cancelled - // the operation. - // Note that due to a race condition in - // the DoWork event handler, the Cancelled - // flag may not have been set, even though - // CancelAsync was called. - resultLabel->Text = "Cancelled"; - } - else - { - // Finally, handle the case where the operation - // succeeded. - resultLabel->Text = e->Result->ToString(); - } - - // Enable the UpDown control. - this->numericUpDown1->Enabled = true; - - // Enable the Start button. - startAsyncButton->Enabled = true; - - // Disable the Cancel button. - cancelAsyncButton->Enabled = false; - } - // - - // - // This event handler updates the progress bar. - void backgroundWorker1_ProgressChanged( Object^ /*sender*/, ProgressChangedEventArgs^ e ) - { - this->progressBar1->Value = e->ProgressPercentage; - } - // - - // - // This is the method that does the actual work. For this - // example, it computes a Fibonacci number and - // reports progress as it does its work. - long ComputeFibonacci( int n, BackgroundWorker^ worker, DoWorkEventArgs ^ e ) - { - // The parameter n must be >= 0 and <= 91. - // Fib(n), with n > 91, overflows a long. - if ( (n < 0) || (n > 91) ) - { - throw gcnew ArgumentException( "value must be >= 0 and <= 91","n" ); - } - - long result = 0; - - // - // Abort the operation if the user has cancelled. - // Note that a call to CancelAsync may have set - // CancellationPending to true just after the - // last invocation of this method exits, so this - // code will not have the opportunity to set the - // DoWorkEventArgs.Cancel flag to true. This means - // that RunWorkerCompletedEventArgs.Cancelled will - // not be set to true in your RunWorkerCompleted - // event handler. This is a race condition. - // - if ( worker->CancellationPending ) - { - e->Cancel = true; - } - // - else - { - if ( n < 2 ) - { - result = 1; - } - else - { - result = ComputeFibonacci( n - 1, worker, e ) + ComputeFibonacci( n - 2, worker, e ); - } - - // - // Report progress as a percentage of the total task. - int percentComplete = (int)((float)n / (float)numberToCompute * 100); - if ( percentComplete > highestPercentageReached ) - { - highestPercentageReached = percentComplete; - worker->ReportProgress( percentComplete ); - } - // - } - // - - return result; - } - // - - void InitializeComponent() - { - this->numericUpDown1 = gcnew System::Windows::Forms::NumericUpDown; - this->startAsyncButton = gcnew System::Windows::Forms::Button; - this->cancelAsyncButton = gcnew System::Windows::Forms::Button; - this->resultLabel = gcnew System::Windows::Forms::Label; - this->progressBar1 = gcnew System::Windows::Forms::ProgressBar; - this->backgroundWorker1 = gcnew System::ComponentModel::BackgroundWorker; - (dynamic_cast(this->numericUpDown1))->BeginInit(); - this->SuspendLayout(); - - // - // numericUpDown1 - // - this->numericUpDown1->Location = System::Drawing::Point( 16, 16 ); - array^temp0 = {91,0,0,0}; - this->numericUpDown1->Maximum = System::Decimal( temp0 ); - array^temp1 = {1,0,0,0}; - this->numericUpDown1->Minimum = System::Decimal( temp1 ); - this->numericUpDown1->Name = "numericUpDown1"; - this->numericUpDown1->Size = System::Drawing::Size( 80, 20 ); - this->numericUpDown1->TabIndex = 0; - array^temp2 = {1,0,0,0}; - this->numericUpDown1->Value = System::Decimal( temp2 ); - - // - // startAsyncButton - // - this->startAsyncButton->Location = System::Drawing::Point( 16, 72 ); - this->startAsyncButton->Name = "startAsyncButton"; - this->startAsyncButton->Size = System::Drawing::Size( 120, 23 ); - this->startAsyncButton->TabIndex = 1; - this->startAsyncButton->Text = "Start Async"; - this->startAsyncButton->Click += gcnew System::EventHandler( this, &FibonacciForm::startAsyncButton_Click ); - - // - // cancelAsyncButton - // - this->cancelAsyncButton->Enabled = false; - this->cancelAsyncButton->Location = System::Drawing::Point( 153, 72 ); - this->cancelAsyncButton->Name = "cancelAsyncButton"; - this->cancelAsyncButton->Size = System::Drawing::Size( 119, 23 ); - this->cancelAsyncButton->TabIndex = 2; - this->cancelAsyncButton->Text = "Cancel Async"; - this->cancelAsyncButton->Click += gcnew System::EventHandler( this, &FibonacciForm::cancelAsyncButton_Click ); - - // - // resultLabel - // - this->resultLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - this->resultLabel->Location = System::Drawing::Point( 112, 16 ); - this->resultLabel->Name = "resultLabel"; - this->resultLabel->Size = System::Drawing::Size( 160, 23 ); - this->resultLabel->TabIndex = 3; - this->resultLabel->Text = "(no result)"; - this->resultLabel->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; - - // - // progressBar1 - // - this->progressBar1->Location = System::Drawing::Point( 18, 48 ); - this->progressBar1->Name = "progressBar1"; - this->progressBar1->Size = System::Drawing::Size( 256, 8 ); - this->progressBar1->Step = 2; - this->progressBar1->TabIndex = 4; - - // - // backgroundWorker1 - // - this->backgroundWorker1->WorkerReportsProgress = true; - this->backgroundWorker1->WorkerSupportsCancellation = true; - - // - // FibonacciForm - // - this->ClientSize = System::Drawing::Size( 292, 118 ); - this->Controls->Add( this->progressBar1 ); - this->Controls->Add( this->resultLabel ); - this->Controls->Add( this->cancelAsyncButton ); - this->Controls->Add( this->startAsyncButton ); - this->Controls->Add( this->numericUpDown1 ); - this->Name = "FibonacciForm"; - this->Text = "Fibonacci Calculator"; - (dynamic_cast(this->numericUpDown1))->EndInit(); - this->ResumeLayout( false ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew FibonacciForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp deleted file mode 100644 index 93c9b89a965..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp +++ /dev/null @@ -1,263 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - this->Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); - InitializeBitmap(); - InitializeStreamBitmap(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::PictureBox^ PictureBox1; - System::Windows::Forms::Button^ Button2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; - this->Button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // Button1 - // - this->Button1->Location = System::Drawing::Point( 24, 192 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 96, 23 ); - this->Button1->TabIndex = 2; - this->Button1->Text = "Rotate and Flip"; - - // - // PictureBox1 - // - this->PictureBox1->Location = System::Drawing::Point( 48, 40 ); - this->PictureBox1->Name = "PictureBox1"; - this->PictureBox1->Size = System::Drawing::Size( 168, 72 ); - this->PictureBox1->TabIndex = 3; - this->PictureBox1->TabStop = false; - - // - // Button2 - // - this->Button2->Location = System::Drawing::Point( 152, 192 ); - this->Button2->Name = "Button2"; - this->Button2->TabIndex = 4; - this->Button2->Text = "Button2"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->PictureBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // The following code example demonstrates constructing how to construct - // a new Bitmap from a file. - // This example is designed to be used with a Windows Forms that contains - // a PictureBox named PictureBox1. - // - // Paste the code into a form and call InitializeBitmap from the form's - // constructor or Load method. - // - - // - // The following code example demonstrates how to set the RotateFlip - // property of a Bitmap. - // This example is designed to be used with a Windows form that contains - // a PictureBox named PictureBox1 and a button named Button1. - // Paste the code to a form, call InitializeBitmap from the form's - // constructor or Load method and associate Button1_Click with the button's - // click event. Ensure the filepath to the bitmap is valid on - // your system. - // - // - // - Bitmap^ bitmap1; - void InitializeBitmap() - { - try - { - bitmap1 = dynamic_cast(Bitmap::FromFile( "C:\\Documents and Settings\\" - "All Users\\Documents\\My Music\\music.bmp" )); - PictureBox1->SizeMode = PictureBoxSizeMode::AutoSize; - PictureBox1->Image = bitmap1; - } - catch ( System::IO::FileNotFoundException^ ) - { - MessageBox::Show( "There was an error." - "Check the path to the bitmap." ); - } - - } - // - - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( bitmap1 != nullptr ) - { - bitmap1->RotateFlip( RotateFlipType::Rotate180FlipY ); - PictureBox1->Image = bitmap1; - } - } - // - - // The following code example demonstrates how to load a bitmap - // from an Icon handle, using the GraphicsUnit enumeration, and the - // the use of the RectangleF.Round method to draw the rectangle - // bounds of an icon. - // This example is designed to be used with Windows Forms. Create - // a form that contains a button named Button2. Paste the code into the - // form and associate this method with the button's Click event. - // - void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Bitmap^ bitmap1 = Bitmap::FromHicon( SystemIcons::Hand->Handle ); - Graphics^ formGraphics = this->CreateGraphics(); - GraphicsUnit units = GraphicsUnit::Point; - RectangleF bmpRectangleF = bitmap1->GetBounds( units ); - Rectangle bmpRectangle = Rectangle::Round( bmpRectangleF ); - formGraphics->DrawRectangle( Pens::Blue, bmpRectangle ); - delete formGraphics; - } - // - - // The following code example demonstrates how to load a bitmap - // from a stream. - // This example is designed to be used with Windows Forms. Create - // a form that contains a PictureBox named PictureBox1. Paste the code - // into the form and call InitializeStreamBitmap from the form's - // constructor or Load method. - // - void InitializeStreamBitmap() - { - try - { - System::Net::WebRequest^ request = System::Net::WebRequest::Create( "http://www.microsoft.com//h/en-us/r/ms_masthead_ltr.gif" ); - System::Net::WebResponse^ response = request->GetResponse(); - System::IO::Stream^ responseStream = response->GetResponseStream(); - Bitmap^ bitmap2 = gcnew Bitmap( responseStream ); - PictureBox1->Image = bitmap2; - } - catch ( System::Net::WebException^ ) - { - MessageBox::Show( "There was an error opening the image file." - "Check the URL" ); - } - - } - // - - // The following code example demonstrates how to use the Image.PixelFormat, - // Image.Height, Image.Width, and BitmapData.Scan0 properties; the Bitmap.LockBits - // and Bitmap.UnlockBits methods; and the ImageLockMode enumeration. - // This example is designed to be used with Windows - // Forms. To run this example, paste it into a form and handle the form's Paint event by - // calling the LockUnlockBitsExample method, passing e as PaintEventArgs. - // This example assumes the existence of an 24bpp image file named fakePhoto.jpg at c:\. - // - void LockUnlockBitsExample( PaintEventArgs^ e ) - { - // Create a new bitmap. - Bitmap^ bmp = gcnew Bitmap( "c:\\fakePhoto.jpg" ); - - // Lock the bitmap's bits. - Rectangle rect = Rectangle(0,0,bmp->Width,bmp->Height); - System::Drawing::Imaging::BitmapData^ bmpData = bmp->LockBits( rect, System::Drawing::Imaging::ImageLockMode::ReadWrite, bmp->PixelFormat ); - - // Get the address of the first line. - IntPtr ptr = bmpData->Scan0; - - // Declare an array to hold the bytes of the bitmap. - // This code is specific to a bitmap with 24 bits per pixels. - int bytes = Math::Abs(bmpData->Stride) * bmp->Height; - array^rgbValues = gcnew array(bytes); - - // Copy the RGB values into the array. - System::Runtime::InteropServices::Marshal::Copy( ptr, rgbValues, 0, bytes ); - - // Set every third value to 255. - for ( int counter = 2; counter < rgbValues->Length; counter += 3 ) - rgbValues[ counter ] = 255; - - // Copy the RGB values back to the bitmap - System::Runtime::InteropServices::Marshal::Copy( rgbValues, 0, ptr, bytes ); - - // Unlock the bits. - bmp->UnlockBits( bmpData ); - - // Draw the modified image. - e->Graphics->DrawImage( bmp, 0, 150 ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp deleted file mode 100644 index 6b09806af55..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp +++ /dev/null @@ -1,112 +0,0 @@ -#using -#using -#using -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::IO; - -public ref class Form1: public Form -{ -#pragma region " Windows Form Designer generated code " - -public: - Form1() : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - - //Form overrides dispose to clean up the component list. -protected: - ~Form1() - { - if (components != nullptr) - { - delete components; - } - } - - //Required by the Windows Form Designer -private: - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. -private: - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(292, 266); - this->Name = "Form1"; - this->Text = "Form1"; - this->Paint += - gcnew System::Windows::Forms::PaintEventHandler - (this,&Form1::Form1_Paint); - } - -#pragma endregion - - // -private: - void ConstructFromResourceSaveAsGif(PaintEventArgs^ e) - { - // Construct a bitmap from the button image resource. - Bitmap^ bmp1 = gcnew Bitmap(Button::typeid, "Button.bmp"); - String^ savePath = - Environment::GetEnvironmentVariable("TEMP") + "\\Button.bmp"; - - try - { - // Save the image as a GIF. - bmp1->Save(savePath, System::Drawing::Imaging::ImageFormat::Gif); - } - catch (IOException^) - { - // Carry on regardless - } - - // Construct a new image from the GIF file. - Bitmap^ bmp2 = nullptr; - if (File::Exists(savePath)) - { - bmp2 = gcnew Bitmap(savePath); - } - - // Draw the two images. - e->Graphics->DrawImage(bmp1, Point(10, 10)); - - // If bmp1 did not save to disk, bmp2 may be null - if (bmp2 != nullptr) - { - e->Graphics->DrawImage(bmp2, Point(10, 40)); - } - - // Dispose of the image files. - delete bmp1; - if (bmp2 != nullptr) - { - delete bmp2; - } - } - // - -private: - void Form1_Paint(Object^ sender, PaintEventArgs^ e) - { - ConstructFromResourceSaveAsGif(e); - } -}; - -[STAThread] -int main() -{ - Application::Run(gcnew Form1()); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp deleted file mode 100644 index d545aaff2d2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp +++ /dev/null @@ -1,197 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - this->Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Button^ Button2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 40, 208 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Button1"; - - // - //Button2 - // - this->Button2->Location = System::Drawing::Point( 152, 208 ); - this->Button2->Name = "Button2"; - this->Button2->TabIndex = 1; - this->Button2->Text = "Button2"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // The following code example demonstrates how to create a CharacterRange - // and use it to highlight part of a string. This sample is designed to be - // used with Windows Forms. Paste the example into a form and - // call the HighlightACharacterRange method when handling the - // form's Paint event, passing e as PaintEventArgs. - // - // - void HighlightACharacterRange( PaintEventArgs^ e ) - { - // Declare the string to draw. - String^ message = "This is the string to highlight a word in."; - - // Declare the word to highlight. - String^ searchWord = "string"; - - // Create a CharacterRange array with the searchWord - // location and length. - array^ temp = {CharacterRange( message->IndexOf( searchWord ), searchWord->Length )}; - array^ranges = temp; - - // Construct a StringFormat object. - StringFormat^ stringFormat1 = gcnew StringFormat; - - // Set the ranges on the StringFormat object. - stringFormat1->SetMeasurableCharacterRanges( ranges ); - - // Declare the font to write the message in. - System::Drawing::Font^ largeFont = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,16.0F,GraphicsUnit::Pixel ); - - // Construct a new Rectangle. - Rectangle displayRectangle = Rectangle(20,20,200,100); - - // Convert the Rectangle to a RectangleF. - RectangleF displayRectangleF = displayRectangle; - - // Get the Region to highlight by calling the - // MeasureCharacterRanges method. - array^charRegion = e->Graphics->MeasureCharacterRanges( message, largeFont, displayRectangleF, stringFormat1 ); - - // Draw the message string on the form. - e->Graphics->DrawString( message, largeFont, Brushes::Blue, displayRectangleF ); - - // Fill in the region using a semi-transparent color. - e->Graphics->FillRegion( gcnew SolidBrush( Color::FromArgb( 50, Color::Fuchsia ) ), charRegion[ 0 ] ); - delete largeFont; - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - HighlightACharacterRange( e ); - } - - // The following code example demonstrates the Color.op_Equality operator. - // This example is designed to be used with a Windows Form that - // contains a button named Button1. Paste the following code into - // your form and associate the Button1_Click method with the button's - // Click event. - // - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( this->BackColor == SystemColors::ControlDark ) - { - this->BackColor = SystemColors::Control; - } - } - // - - // The following code example demonstrates the Color.op_Inequality - // operator. This example is designed to be used with a Windows Form - // that contains a button named Button2. Paste the following code - // into your form and associate the Button2_Click method with the - // button's Click event. - // - void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( this->BackColor != SystemColors::ControlDark ) - { - this->BackColor = SystemColors::ControlDark; - } - - if ( !(this->Font->Bold) ) - { - this->Font = gcnew System::Drawing::Font( this->Font,FontStyle::Bold ); - } - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp deleted file mode 100644 index 500f519a918..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp +++ /dev/null @@ -1,297 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Runtime::InteropServices; -using namespace System::Security::Permissions; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); - } - - - // -private: - void Clone_Example1( PaintEventArgs^ e ) - { - // Create a Bitmap object from a file. - Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); - - // Clone a portion of the Bitmap object. - Rectangle cloneRect = Rectangle(0,0,100,100); - System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat; - Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format ); - - // Draw the cloned portion of the Bitmap object. - e->Graphics->DrawImage( cloneBitmap, 0, 0 ); - } - // - - // -private: - void Clone_Example2( PaintEventArgs^ e ) - { - // Create a Bitmap object from a file. - Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); - - // Clone a portion of the Bitmap object. - RectangleF cloneRect = RectangleF(0,0,100,100); - System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat; - Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format ); - - // Draw the cloned portion of the Bitmap object. - e->Graphics->DrawImage( cloneBitmap, 0, 0 ); - } - // - - // -private: - [System::Runtime::InteropServices::DllImportAttribute("user32.dll", CharSet = CharSet::Unicode)] - static IntPtr LoadImage( int Hinstance, String^ name, int type, int width, int height, int load ); - -private: - void Hicon_Example( PaintEventArgs^ e ) - { - - // Get a handle to an icon. - IntPtr Hicon = LoadImage( 0, "smile.ico", 1, 0, 0, 16 ); - - // Create a Bitmap object from the icon handle. - Bitmap^ iconBitmap = Bitmap::FromHicon( Hicon ); - - // Draw the Bitmap object to the screen. - e->Graphics->DrawImage( iconBitmap, 0, 0 ); - } - // - - // - // - [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] - static bool DeleteObject( IntPtr hObject ); - // - -private: - void DemonstrateGetHbitmap() - { - Bitmap^ bm = gcnew Bitmap( "Picture.jpg" ); - IntPtr hBitmap = bm->GetHbitmap(); - - // Do something with hBitmap. - DeleteObject( hBitmap ); - } - // - - // - void DemonstrateGetHbitmapWithColor() - { - Bitmap^ bm = gcnew Bitmap( "Picture.jpg" ); - IntPtr hBitmap = bm->GetHbitmap( Color::Blue ); - - // Do something with hBitmap. - DeleteObject( hBitmap ); - } - // - - // -private: - [System::Runtime::InteropServices::DllImportAttribute("user32.dll",CharSet=CharSet::Auto)] - static bool DestroyIcon( IntPtr handle ); - -private: - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - void GetHicon_Example( PaintEventArgs^ e ) - { - - // Create a Bitmap object from an image file. - Bitmap^ myBitmap = gcnew Bitmap( "c:\\FakePhoto.jpg" ); - - // Draw myBitmap to the screen. - e->Graphics->DrawImage( myBitmap, 0, 0 ); - - // Get an Hicon for myBitmap. - IntPtr Hicon = myBitmap->GetHicon(); - - // Create a new icon from the handle. - System::Drawing::Icon^ newIcon = ::Icon::FromHandle( Hicon ); - - // Set the form Icon attribute to the new icon. - this->Icon = newIcon; - - // You can now destroy the Icon, since the form creates - // its own copy of the icon accesible through the Form.Icon property. - DestroyIcon( newIcon->Handle ); - } - // - - // -private: - void GetPixel_Example( PaintEventArgs^ e ) - { - // Create a Bitmap object from an image file. - Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); - - // Get the color of a pixel within myBitmap. - Color pixelColor = myBitmap->GetPixel( 50, 50 ); - - // Fill a rectangle with pixelColor. - SolidBrush^ pixelBrush = gcnew SolidBrush( pixelColor ); - e->Graphics->FillRectangle( pixelBrush, 0, 0, 100, 100 ); - } - // - - // -private: - void MakeTransparent_Example1( PaintEventArgs^ e ) - { - // Create a Bitmap object from an image file. - Bitmap^ myBitmap = gcnew Bitmap( "Grapes.gif" ); - - // Draw myBitmap to the screen. - e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); - - // Make the default transparent color transparent for myBitmap. - myBitmap->MakeTransparent(); - - // Draw the transparent bitmap to the screen. - e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); - } - // - - // -private: - void MakeTransparent_Example2( PaintEventArgs^ e ) - { - // Create a Bitmap object from an image file. - Bitmap^ myBitmap = gcnew Bitmap( "Grapes.gif" ); - - // Draw myBitmap to the screen. - e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); - - // Get the color of a background pixel. - Color backColor = myBitmap->GetPixel( 1, 1 ); - - // Make backColor transparent for myBitmap. - myBitmap->MakeTransparent( backColor ); - - // Draw the transparent bitmap to the screen. - e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); - } - // - - // -private: - void SetPixel_Example( PaintEventArgs^ e ) - { - // Create a Bitmap object from a file. - Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); - - // Draw myBitmap to the screen. - e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); - - // Set each pixel in myBitmap to black. - for ( int Xcount = 0; Xcount < myBitmap->Width; Xcount++ ) - { - for ( int Ycount = 0; Ycount < myBitmap->Height; Ycount++ ) - { - myBitmap->SetPixel( Xcount, Ycount, Color::Black ); - } - } - - // Draw myBitmap to the screen again. - e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); - } - // - -private: - void Form1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ /*e*/ ){} -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp deleted file mode 100644 index 1b2db978dc5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp +++ /dev/null @@ -1,568 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - -public: - - // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32) - // - void FromArgb4( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Transparent red, green, and blue brushes. - SolidBrush^ trnsRedBrush = gcnew SolidBrush( Color::FromArgb( 0x78FF0000 ) ); - SolidBrush^ trnsGreenBrush = gcnew SolidBrush( Color::FromArgb( 0x7800FF00 ) ); - SolidBrush^ trnsBlueBrush = gcnew SolidBrush( Color::FromArgb( 0x780000FF ) ); - - // Base and height of the triangle that is used to position the - // circles. Each vertex of the triangle is at the center of one of the - // 3 circles. The base is equal to the diameter of the circles. - float triBase = 100; - float triHeight = (float)Math::Sqrt( 3 * (triBase * triBase) / 4 ); - - // coordinates of first circle's bounding rectangle. - float x1 = 40; - float y1 = 40; - - // Fill 3 over-lapping circles. Each circle is a different color. - g->FillEllipse( trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight ); - g->FillEllipse( trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, 2 * triHeight, 2 * triHeight ); - g->FillEllipse( trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, 2 * triHeight ); - } - // - - // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32,System.Drawing.Color) - // - void FromArgb3( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Opaque colors (alpha value defaults to 255 -- max value). - Color red = Color::FromArgb( 255, 0, 0 ); - Color green = Color::FromArgb( 0, 255, 0 ); - Color blue = Color::FromArgb( 0, 0, 255 ); - - // Solid brush initialized to red. - SolidBrush^ myBrush = gcnew SolidBrush( red ); - int alpha; - - // x coordinate of first red rectangle - int x = 50; - - // y coordinate of first red rectangle - int y = 50; - - // Fill rectangles with red, varying the alpha value from 25 to 250. - for ( alpha = 25; alpha <= 250; alpha += 25 ) - { - myBrush->Color = Color::FromArgb( alpha, red ); - g->FillRectangle( myBrush, x, y, 50, 100 ); - g->FillRectangle( myBrush, x, y + 250, 50, 50 ); - x += 50; - } - x = 50; - - // y coordinate of first green rectangle - y += 50; - - // Fill rectangles with green, varying the alpha value from 25 to 250. - for ( alpha = 25; alpha <= 250; alpha += 25 ) - { - myBrush->Color = Color::FromArgb( alpha, green ); - g->FillRectangle( myBrush, x, y, 50, 150 ); - x += 50; - } - x = 50; - - // y coordinate of first blue rectangle - y += 100; - - // Fill rectangles with blue, varying the alpha value from 25 to 250. - for ( alpha = 25; alpha <= 250; alpha += 25 ) - { - myBrush->Color = Color::FromArgb( alpha, blue ); - g->FillRectangle( myBrush, x, y, 50, 150 ); - x += 50; - } - } - // - - // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32,System.Int32,System.Int32) - // - void FromArgb2( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Opaque colors (alpha value defaults to 255 -- max value). - Color red = Color::FromArgb( 255, 0, 0 ); - Color green = Color::FromArgb( 0, 255, 0 ); - Color blue = Color::FromArgb( 0, 0, 255 ); - - // Solid brush initialized to red. - SolidBrush^ myBrush = gcnew SolidBrush( red ); - int alpha; - - // x coordinate of first red rectangle - int x = 50; - - // y coordinate of first red rectangle - int y = 50; - - // Fill rectangles with red, varying the alpha value from 25 to 250. - for ( alpha = 25; alpha <= 250; alpha += 25 ) - { - myBrush->Color = Color::FromArgb( alpha, red ); - g->FillRectangle( myBrush, x, y, 50, 100 ); - g->FillRectangle( myBrush, x, y + 250, 50, 50 ); - x += 50; - } - x = 50; - - // y coordinate of first green rectangle. - y += 50; - - // Fill rectangles with green, varying the alpha value from 25 to 250. - for ( alpha = 25; alpha <= 250; alpha += 25 ) - { - myBrush->Color = Color::FromArgb( alpha, green ); - g->FillRectangle( myBrush, x, y, 50, 150 ); - x += 50; - } - x = 50; - - // y coordinate of first blue rectangle. - y += 100; - - // Fill rectangles with blue, varying the alpha value from 25 to 250. - for ( alpha = 25; alpha <= 250; alpha += 25 ) - { - myBrush->Color = Color::FromArgb( alpha, blue ); - g->FillRectangle( myBrush, x, y, 50, 150 ); - x += 50; - } - } - // - - // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32,System.Int32,System.Int32,System.Int32) - // - void FromArgb1( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Transparent red, green, and blue brushes. - SolidBrush^ trnsRedBrush = gcnew SolidBrush( Color::FromArgb( 120, 255, 0, 0 ) ); - SolidBrush^ trnsGreenBrush = gcnew SolidBrush( Color::FromArgb( 120, 0, 255, 0 ) ); - SolidBrush^ trnsBlueBrush = gcnew SolidBrush( Color::FromArgb( 120, 0, 0, 255 ) ); - - // Base and height of the triangle that is used to position the - // circles. Each vertex of the triangle is at the center of one of the - // 3 circles. The base is equal to the diameter of the circles. - float triBase = 100; - float triHeight = (float)Math::Sqrt( 3 * (triBase * triBase) / 4 ); - - // Coordinates of first circle's bounding rectangle. - float x1 = 40; - float y1 = 40; - - // Fill 3 over-lapping circles. Each circle is a different color. - g->FillEllipse( trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight ); - g->FillEllipse( trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, 2 * triHeight, 2 * triHeight ); - g->FillEllipse( trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, 2 * triHeight ); - } - // - - // Snippet for: M:System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor) - // - void KnownColorBrightnessExample1( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Color structures. One is a variable used for temporary storage. The other - // is a constant used for comparisons. - Color someColor = Color::FromArgb( 0 ); - Color redShade = Color::FromArgb( 255, 200, 0, 100 ); - - // Array to store KnownColor values that match the brightness of the - // redShade color. - array^colorMatches = gcnew array(15); - - // Number of matches found. - int count = 0; - - // Iterate through the KnownColor enums until 15 matches are found. - for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) - { - someColor = Color::FromKnownColor( enumValue ); - if ( someColor.GetBrightness() == redShade.GetBrightness() ) - colorMatches[ count++ ] = enumValue; - } - - // Display the redShade color and its argb value. - SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); - int x = 20; - int y = 20; - someColor = redShade; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - - // Iterate through the matches that were found and display each color that - // Corresponds with the enum value in the array. also display the name of - // The KnownColor. - for ( int i = 0; i < count; i++ ) - { - y += 40; - someColor = Color::FromKnownColor( colorMatches[ i ] ); - myBrush1->Color = someColor; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - } - } - // - - // Snippet for: M:System.Drawing.Color.GetBrightness - // - void KnownColorBrightnessExample2( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Color structures. One is a variable used for temporary storage. The other - // is a constant used for comparisons. - Color someColor = Color::FromArgb( 0 ); - Color redShade = Color::FromArgb( 255, 200, 0, 100 ); - - // Array to store KnownColor values that match the brightness of the - // redShade color. - array^colorMatches = gcnew array(15); - - // Number of matches found. - int count = 0; - - // Iterate through the KnownColor enums until 15 matches are found. - for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) - { - someColor = Color::FromKnownColor( enumValue ); - if ( someColor.GetBrightness() == redShade.GetBrightness() ) - colorMatches[ count++ ] = enumValue; - } - - // display the redShade color and its argb value. - SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); - int x = 20; - int y = 20; - someColor = redShade; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - - // Iterate through the matches that were found and display each color that - // corresponds with the enum value in the array. also display the name of - // The KnownColor. - for ( int i = 0; i < count; i++ ) - { - y += 40; - someColor = Color::FromKnownColor( colorMatches[ i ] ); - myBrush1->Color = someColor; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - } - } - // - - // Snippet for: M:System.Drawing.Color.GetHue - // - void GetHueExample( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Color structures. One is a variable used for temporary storage. The other - // is a constant used for comparisons. - Color someColor = Color::FromArgb( 0 ); - Color redShade = Color::FromArgb( 255, 200, 0, 100 ); - - // Array to store KnownColor values that match the hue of the redShade - // color. - array^colorMatches = gcnew array(15); - - // Number of matches found. - int count = 0; - - // Iterate through the KnownColor enums until 15 matches are found. - for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) - { - someColor = Color::FromKnownColor( enumValue ); - if ( someColor.GetHue() == redShade.GetHue() ) - colorMatches[ count++ ] = enumValue; - } - - // Display the redShade color and its argb value. - SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); - int x = 20; - int y = 20; - someColor = redShade; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - - // Iterate through the matches that were found and display each color that - // corresponds with the enum value in the array. also display the name of - // the KnownColor. - for ( int i = 0; i < count; i++ ) - { - y += 40; - someColor = Color::FromKnownColor( colorMatches[ i ] ); - myBrush1->Color = someColor; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - } - } - // - - // Snippet for: M:System.Drawing.Color.GetSaturation - // - void GetSatExample( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Color structures. One is a variable used for temporary storage. The other - // is a constant used for comparisons. - Color someColor = Color::FromArgb( 0 ); - Color redShade = Color::FromArgb( 255, 200, 0, 100 ); - - // Array to store KnownColor values that match the saturation of the - // redShade color. - array^colorMatches = gcnew array(15); - - // Number of matches found. - int count = 0; - - // Iterate through the KnownColor enums until 15 matches are found. - for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) - { - someColor = Color::FromKnownColor( enumValue ); - if ( someColor.GetSaturation() == redShade.GetSaturation() ) - colorMatches[ count++ ] = enumValue; - } - - // Display the redShade color and its argb value. - SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); - int x = 20; - int y = 20; - someColor = redShade; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - - // Iterate through the matches that were found and display each color that - // corresponds with the enum value in the array. also display the name of - // the KnownColor. - for ( int i = 0; i < count; i++ ) - { - y += 40; - someColor = Color::FromKnownColor( colorMatches[ i ] ); - myBrush1->Color = someColor; - g->FillRectangle( myBrush1, x, y, 100, 30 ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); - } - } - // - - // Snippet for: M:System.Drawing.Color.ToArgb - // - void ToArgbToStringExample1( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Color structure used for temporary storage. - Color someColor = Color::FromArgb( 0 ); - - // Array to store KnownColor values that match the criteria. - array^colorMatches = gcnew array(167); - - // Number of matches found. - int count = 0; - - // Iterate through the KnownColor enums to find all corresponding colors - // that have a nonzero green component and zero-value red component and - // that are not system colors. - for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen; enumValue = enumValue + (KnownColor)1 ) - { - someColor = Color::FromKnownColor( enumValue ); - if ( someColor.G != 0 && someColor.R == 0 && !someColor.IsSystemColor ) - colorMatches[ count++ ] = enumValue; - } - SolidBrush^ myBrush1 = gcnew SolidBrush( someColor ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",9 ); - int x = 40; - int y = 40; - - // Iterate through the matches that were found and display each color that - // corresponds with the enum value in the array. also display the name of - // the KnownColor and the ARGB components. - for ( int i = 0; i < count; i++ ) - { - // Display the color. - someColor = Color::FromKnownColor( colorMatches[ i ] ); - myBrush1->Color = someColor; - g->FillRectangle( myBrush1, x, y, 50, 30 ); - - // Display KnownColor name and the four component values. To display the - // component values: Use the ToArgb method to get the 32-bit ARGB value - // of someColor, which was created from a KnownColor. Then create a - // Color structure from the 32-bit ARGB value and set someColor equal to - // this new Color structure. Then use the ToString method to convert it to - // a string. - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y ); - someColor = Color::FromArgb( someColor.ToArgb() ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y + 15 ); - y += 40; - } - } - // - - // Snippet for: M:System.Drawing.Color.ToString - // - void ToArgbToStringExample2( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Color structure used for temporary storage. - Color someColor = Color::FromArgb( 0 ); - - // Array to store KnownColor values that match the criteria. - array^colorMatches = gcnew array(167); - - // Number of matches found. - int count = 0; - - // Iterate through the KnownColor enums to find all corresponding colors - // that have a nonzero green component and zero-value red component and - // that are not system colors. - for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen; enumValue = enumValue + (KnownColor)1 ) - { - someColor = Color::FromKnownColor( enumValue ); - if ( someColor.G != 0 && someColor.R == 0 && !someColor.IsSystemColor ) - colorMatches[ count++ ] = enumValue; - } - SolidBrush^ myBrush1 = gcnew SolidBrush( someColor ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",9 ); - int x = 40; - int y = 40; - - // Iterate through the matches that were found and display each color that - // corresponds with the enum value in the array. also display the name of - // the KnownColor and the ARGB components. - for ( int i = 0; i < count; i++ ) - { - // Display the color. - someColor = Color::FromKnownColor( colorMatches[ i ] ); - myBrush1->Color = someColor; - g->FillRectangle( myBrush1, x, y, 50, 30 ); - - // Display KnownColor name and the four component values. To display the - // component values: Use the ToArgb method to get the 32-bit ARGB value - // of someColor, which was created from a KnownColor. Then create a - // Color structure from the 32-bit ARGB value and set someColor equal to - // this new Color structure. Then use the ToString method to convert it to - // a string. - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y ); - someColor = Color::FromArgb( someColor.ToArgb() ); - g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y + 15 ); - y += 40; - } - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp deleted file mode 100644 index 704918f8b6f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp +++ /dev/null @@ -1,192 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.ColorTranslator.FromHtml(System.String) - // -public: - void FromHtml_Example( PaintEventArgs^ e ) - { - // Create a string representation of an HTML color. - String^ htmlColor = "Blue"; - - // Translate htmlColor to a GDI+ Color structure. - Color myColor = ColorTranslator::FromHtml( htmlColor ); - - // Fill a rectangle with myColor. - e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.ColorTranslator.FromOle(System.Int32) - // -public: - void FromOle_Example( PaintEventArgs^ e ) - { - // Create an integer representation of an OLE color. - int oleColor = 0xFF00; - - // Translate oleColor to a GDI+ Color structure. - Color myColor = ColorTranslator::FromOle( oleColor ); - - // Fill a rectangle with myColor. - e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.ColorTranslator.FromWin32(System.Int32) - // -public: - void FromWin32_Example( PaintEventArgs^ e ) - { - // Create an integer representation of a Windows color. - int winColor = 0xA000; - - // Translate winColor to a GDI+ Color structure. - Color myColor = ColorTranslator::FromWin32( winColor ); - - // Fill a rectangle with myColor. - e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color) - // -public: - void ToHtml_Example( PaintEventArgs^ /*e*/ ) - { - // Create an instance of a Color structure. - Color myColor = Color::Red; - - // Translate myColor to an HTML color. - String^ htmlColor = ColorTranslator::ToHtml( myColor ); - - // Show a message box with the value of htmlColor. - MessageBox::Show( htmlColor ); - } - // - - // Snippet for: M:System.Drawing.ColorTranslator.ToOle(System.Drawing.Color) - // -public: - void ToOle_Example( PaintEventArgs^ /*e*/ ) - { - // Create an instance of a Color structure. - Color myColor = Color::Red; - - // Translate myColor to an OLE color. - int oleColor = ColorTranslator::ToOle( myColor ); - - // Show a message box with the value of oleColor. - MessageBox::Show( oleColor.ToString() ); - } - // - - // Snippet for: M:System.Drawing.ColorTranslator.ToWin32(System.Drawing.Color) - // -public: - void ToWin32_Example( PaintEventArgs^ /*e*/ ) - { - // Create an instance of a Color structure. - Color myColor = Color::Red; - - // Translate myColor to an OLE color. - int winColor = ColorTranslator::ToWin32( myColor ); - - // Show a message box with the value of winColor. - MessageBox::Show( winColor.ToString() ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp deleted file mode 100644 index 652478b4d00..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.FontFamily.Equals(System.Object) - // -public: - void Equals_Example( PaintEventArgs^ /*e*/ ) - { - // Create two FontFamily objects. - FontFamily^ firstFontFamily = gcnew FontFamily( "Arial" ); - FontFamily^ secondFontFamily = gcnew FontFamily( "Times New Roman" ); - - // Check to see if the two font families are equivalent. - bool equalFonts = firstFontFamily->Equals( secondFontFamily ); - - // Display the result of the test in a message box. - MessageBox::Show( equalFonts.ToString() ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetCellAscent(System.Drawing.FontStyle) - // -public: - void GetCellAscent_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ ascentFontFamily = gcnew FontFamily( "arial" ); - - // Get the cell ascent of the font family in design units. - int cellAscent = ascentFontFamily->GetCellAscent( FontStyle::Regular ); - - // Draw the result as a string to the screen. - e->Graphics->DrawString( String::Format( "ascentFontFamily.GetCellAscent() returns {0}.", cellAscent ), - gcnew System::Drawing::Font( ascentFontFamily,16 ), Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetCellDescent(System.Drawing.FontStyle) - // -public: - void GetCellDescent_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ descentFontFamily = gcnew FontFamily( "arial" ); - - // Get the cell descent of the font family in design units. - int cellDescent = descentFontFamily->GetCellDescent( FontStyle::Regular ); - - // Draw the result as a string to the screen. - e->Graphics->DrawString( String::Format( "descentFontFamily.GetCellDescent() returns {0}.", cellDescent ), - gcnew System::Drawing::Font( descentFontFamily,16 ), Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetEmHeight(System.Drawing.FontStyle) - // -public: - void GetEmHeight_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ emFontFamily = gcnew FontFamily( "arial" ); - - // Get the em height of the font family in design units. - int emHeight = emFontFamily->GetEmHeight( FontStyle::Regular ); - - // Draw the result as a string to the screen. - e->Graphics->DrawString( String::Format( "emFontFamily.GetEmHeight() returns {0}.", emHeight ), - gcnew System::Drawing::Font( emFontFamily,16 ), Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetFamilies(System.Drawing.Graphics) - // -public: - void GetFamilies_Example( PaintEventArgs^ e ) - { - // Get an array of the available font families. - array^families = FontFamily::GetFamilies( e->Graphics ); - - // Draw text using each of the font families. - System::Drawing::Font^ familiesFont; - String^ familyString; - float spacing = 0; - IEnumerator^ myEnum = families->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FontFamily^ family = safe_cast(myEnum->Current); - if ( family->IsStyleAvailable( FontStyle::Regular ) ) - { - familiesFont = gcnew System::Drawing::Font( family,16 ); - familyString = String::Format( "This is the {0} family.", family->Name ); - e->Graphics->DrawString( familyString, familiesFont, Brushes::Black, PointF(0,spacing) ); - spacing += familiesFont->Height; - } - } - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetHashCode - // -public: - void GetHashCode_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); - - // Get the hash code for myFontFamily. - int hashCode = myFontFamily->GetHashCode(); - - // Draw the value of hashCode to the screen as a string. - e->Graphics->DrawString( String::Format( "hashCode = {0}", hashCode ), - gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetLineSpacing(System.Drawing.FontStyle) - // -public: - void GetLineSpacing_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); - - // Get the line spacing for myFontFamily. - int lineSpacing = myFontFamily->GetLineSpacing( FontStyle::Regular ); - - // Draw the value of lineSpacing to the screen as a string. - e->Graphics->DrawString( String::Format( "lineSpacing = {0}", lineSpacing ), - gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.GetName(System.Int32) - // -public: - void GetName_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); - - // Get the name of myFontFamily. - String^ familyName = myFontFamily->GetName( 0 ); - - // Draw the name of the myFontFamily to the screen as a string. - e->Graphics->DrawString( String::Format( "The family name is {0}", familyName ), - gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.FontFamily.IsStyleAvailable(System.Drawing.FontStyle) - // -public: - void IsStyleAvailable_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); - - // Test whether myFontFamily is available in Italic. - if ( myFontFamily->IsStyleAvailable( FontStyle::Italic ) ) - { - // Create a Font object using myFontFamily. - System::Drawing::Font^ familyFont = gcnew System::Drawing::Font( myFontFamily,16,FontStyle::Italic ); - - // Use familyFont to draw text to the screen. - e->Graphics->DrawString( myFontFamily->Name + " is available in Italic", - familyFont, Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.FontFamily.ToString - // -public: - void ToString_Example( PaintEventArgs^ e ) - { - // Create a FontFamily object. - FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); - - // Draw a string representation of myFontFamily to the screen. - e->Graphics->DrawString( myFontFamily->ToString(), gcnew System::Drawing::Font( myFontFamily,16 ), - Brushes::Black, PointF(0,0) ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp deleted file mode 100644 index f5605530837..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp +++ /dev/null @@ -1,224 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Font.Clone - // -public: - void Clone_Example( PaintEventArgs^ e ) - { - // Create a Font object. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Create a copy of myFont. - System::Drawing::Font^ cloneFont = dynamic_cast(myFont->Clone()); - - // Use cloneFont to draw text to the screen. - e->Graphics->DrawString( "This is a cloned font", cloneFont, Brushes::Black, 0, 0 ); - } - // - - // Snippet for: M:System.Drawing.Font.Equals(System.Object) - // -public: - void Equals_Example( PaintEventArgs^ /*e*/ ) - { - // Create a Font object. - System::Drawing::Font^ firstFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Create a second Font object. - System::Drawing::Font^ secondFont = gcnew System::Drawing::Font( gcnew FontFamily( "Arial" ),16 ); - - // Test to see if firstFont is identical to secondFont. - bool fontTest = firstFont->Equals( secondFont ); - - // Display a message box with the result of the test. - MessageBox::Show( fontTest.ToString() ); - } - // - - // Snippet for: M:System.Drawing.Font.FromHfont(System.IntPtr) - // -private: - [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] - static IntPtr GetStockObject( int fnObject ); - -public: - void FromHfont_Example( PaintEventArgs^ e ) - { - // Get a handle for a GDI font. - IntPtr hFont = GetStockObject( 17 ); - - // Create a Font object from hFont. - System::Drawing::Font^ hfontFont = System::Drawing::Font::FromHfont( hFont ); - - // Use hfontFont to draw text to the screen. - e->Graphics->DrawString( "This font is from a GDI HFONT", hfontFont, Brushes::Black, 0, 0 ); - } - // - - // Snippet for: M:System.Drawing.Font.GetHashCode - // -public: - void GetHashCode_Example( PaintEventArgs^ /*e*/ ) - { - // Create a Font object. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Get the hash code for myFont. - int hashCode = myFont->GetHashCode(); - - // Display the hash code in a message box. - MessageBox::Show( hashCode.ToString() ); - } - // - - // Snippet for: M:System.Drawing.Font.GetHeight(System.Drawing.Graphics) - // -public: - void GetHeight_Example( PaintEventArgs^ e ) - { - // Create a Font object. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); - - //Draw text to the screen with myFont. - e->Graphics->DrawString( "This is the first line", myFont, Brushes::Black, PointF(0,0) ); - - //Get the height of myFont. - float height = myFont->GetHeight( e->Graphics ); - - //Draw text immediately below the first line of text. - e->Graphics->DrawString( "This is the second line", myFont, Brushes::Black, PointF(0,height) ); - } - // - - // Snippet for: M:System.Drawing.Font.ToHfont - // - //Reference the GDI DeleteObject method. -public: - [System::Runtime::InteropServices::DllImport("GDI32.dll")] - static bool DeleteObject( IntPtr objectHandle ); - void ToHfont_Example( PaintEventArgs^ /*e*/ ) - { - // Create a Font object. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Get a handle to the Font object. - IntPtr hFont = myFont->ToHfont(); - - // Display a message box with the value of hFont. - MessageBox::Show( hFont.ToString() ); - - //Dispose of the hFont. - DeleteObject( hFont ); - } - // - - // Snippet for: M:System.Drawing.Font.ToString - // -public: - void ToString_Example( PaintEventArgs^ /*e*/ ) - { - // Create a Font object. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Get a string that represents myFont. - String^ fontString = myFont->ToString(); - - // Display a message box with fontString. - MessageBox::Show( fontString ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp deleted file mode 100644 index 3d2e17e8fb1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp +++ /dev/null @@ -1,1666 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Drawing::Imaging; -using namespace System::Drawing::Drawing2D; -using namespace System::Drawing::Text; -using namespace System::Security::Permissions; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Graphics.AddMetafileComment(System.Byte[]) - // -private: - [SecurityPermission(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)] - void AddMetafileCommentBytes( PaintEventArgs^ e ) - { - // Create temporary Graphics object for metafile - // creation and get handle to its device context. - Graphics^ newGraphics = this->CreateGraphics(); - IntPtr hdc = newGraphics->GetHdc(); - - // Create metafile object to record. - Metafile^ metaFile1 = gcnew Metafile( "SampMeta.emf",hdc ); - - // Create graphics object to record metaFile. - Graphics^ metaGraphics = Graphics::FromImage( metaFile1 ); - - // Draw rectangle in metaFile. - metaGraphics->DrawRectangle( gcnew Pen( Color::Black,5.0f ), 0, 0, 100, 100 ); - - // Create comment and add to metaFile. - array^metaComment = {(Byte)'T',(Byte)'e',(Byte)'s',(Byte)'t'}; - metaGraphics->AddMetafileComment( metaComment ); - - // Dispose of graphics object. - delete metaGraphics; - - // Dispose of metafile. - delete metaFile1; - - // Release handle to temporary device context. - newGraphics->ReleaseHdc( hdc ); - - // Dispose of scratch graphics object. - delete newGraphics; - - // Create existing metafile object to draw. - Metafile^ metaFile2 = gcnew Metafile( "SampMeta.emf" ); - - // Draw metaFile to screen. - e->Graphics->DrawImage( metaFile2, Point(0,0) ); - - // Dispose of metafile. - delete metaFile2; - } - // - - // Snippet for: M:System.Drawing.Graphics.BeginContainer - // -private: - void BeginContainerVoid( PaintEventArgs^ e ) - { - // Begin graphics container. - GraphicsContainer^ containerState = e->Graphics->BeginContainer(); - - // Translate world transformation. - e->Graphics->TranslateTransform( 100.0F, 100.0F ); - - // Fill translated rectangle in container with red. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 ); - - // End graphics container. - e->Graphics->EndContainer( containerState ); - - // Fill untransformed rectangle with green. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.BeginContainer(System.Drawing.Rectangle,System.Drawing.Rectangle,System.Drawing.GraphicsUnit) - // -private: - void BeginContainerRectangle( PaintEventArgs^ e ) - { - // Define transformation for container. - Rectangle srcRect = Rectangle(0,0,200,200); - Rectangle destRect = Rectangle(100,100,150,150); - - // Begin graphics container. - GraphicsContainer^ containerState = e->Graphics->BeginContainer( destRect, srcRect, GraphicsUnit::Pixel ); - - // Fill red rectangle in container. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 ); - - // End graphics container. - e->Graphics->EndContainer( containerState ); - - // Fill untransformed rectangle with green. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.BeginContainer(System.Drawing.RectangleF,System.Drawing.RectangleF,System.Drawing.GraphicsUnit) - // -private: - void BeginContainerRectangleF( PaintEventArgs^ e ) - { - // Define transformation for container. - RectangleF srcRect = RectangleF(0.0F,0.0F,200.0F,200.0F); - RectangleF destRect = RectangleF(100.0F,100.0F,150.0F,150.0F); - - // Begin graphics container. - GraphicsContainer^ containerState = e->Graphics->BeginContainer( destRect, srcRect, GraphicsUnit::Pixel ); - - // Fill red rectangle in container. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0.0F, 0.0F, 200.0F, 200.0F ); - - // End graphics container. - e->Graphics->EndContainer( containerState ); - - // Fill untransformed rectangle with green. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0.0F, 0.0F, 200.0F, 200.0F ); - } - // - - // Snippet for: M:System.Drawing.Graphics.Clear(System.Drawing.Color) - // -private: - void ClearColor( PaintEventArgs^ e ) - { - // Clear screen with teal background. - e->Graphics->Clear( Color::Teal ); - } - // - - // Snippet for: M:System.Drawing.Graphics.Dispose - // -private: - void FromImageImage1( PaintEventArgs^ e ) - { - // Create image. - Image^ imageFile = Image::FromFile( "SampImag.jpg" ); - - // Create graphics object for alteration. - Graphics^ newGraphics = Graphics::FromImage( imageFile ); - - // Alter image. - newGraphics->FillRectangle( gcnew SolidBrush( Color::Black ), 100, 50, 100, 100 ); - - // Draw image to screen. - e->Graphics->DrawImage( imageFile, PointF(0.0F,0.0F) ); - - // Release graphics object. - delete newGraphics; - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Drawing.Rectangle,System.Single,System.Single) - // -private: - void DrawArcRectangle( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle to bound ellipse. - Rectangle rect = Rectangle(0,0,100,200); - - // Create start and sweep angles on ellipse. - float startAngle = 45.0F; - float sweepAngle = 270.0F; - - // Draw arc to screen. - e->Graphics->DrawArc( blackPen, rect, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Drawing.RectangleF,System.Single,System.Single) - // -private: - void DrawArcRectangleF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle to bound ellipse. - RectangleF rect = RectangleF(0.0F,0.0F,100.0F,200.0F); - - // Create start and sweep angles on ellipse. - float startAngle = 45.0F; - float sweepAngle = 270.0F; - - // Draw arc to screen. - e->Graphics->DrawArc( blackPen, rect, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) - // -private: - void DrawArcInt( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - // Create coordinates of rectangle to bound ellipse. - int x = 0; - int y = 0; - int width = 100; - int height = 200; - - // Create start and sweep angles on ellipse. - int startAngle = 45; - int sweepAngle = 270; - - // Draw arc to screen. - e->Graphics->DrawArc( blackPen, x, y, width, height, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) - // -private: - void DrawArcFloat( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create coordinates of rectangle to bound ellipse. - float x = 0.0F; - float y = 0.0F; - float width = 100.0F; - float height = 200.0F; - - // Create start and sweep angles on ellipse. - float startAngle = 45.0F; - float sweepAngle = 270.0F; - - // Draw arc to screen. - e->Graphics->DrawArc( blackPen, x, y, width, height, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawBezier(System.Drawing.Pen,System.Drawing.Point,System.Drawing.Point,System.Drawing.Point,System.Drawing.Point) - // -private: - void DrawBezierPoint( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points for curve. - Point start = Point(100,100); - Point control1 = Point(200,10); - Point control2 = Point(350,50); - Point end = Point(500,100); - - // Draw arc to screen. - e->Graphics->DrawBezier( blackPen, start, control1, control2, end ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawBezier(System.Drawing.Pen,System.Drawing.PointF,System.Drawing.PointF,System.Drawing.PointF,System.Drawing.PointF) - // -private: - void DrawBezierPointF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points for curve. - PointF start = PointF(100.0F,100.0F); - PointF control1 = PointF(200.0F,10.0F); - PointF control2 = PointF(350.0F,50.0F); - PointF end = PointF(500.0F,100.0F); - - // Draw arc to screen. - e->Graphics->DrawBezier( blackPen, start, control1, control2, end ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawBezier(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) - // -private: - void DrawBezierFloat( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create coordinates of points for curve. - float startX = 100.0F; - float startY = 100.0F; - float controlX1 = 200.0F; - float controlY1 = 10.0F; - float controlX2 = 350.0F; - float controlY2 = 50.0F; - float endX = 500.0F; - float endY = 100.0F; - - // Draw arc to screen. - e->Graphics->DrawBezier( blackPen, startX, startY, controlX1, controlY1, controlX2, controlY2, endX, endY ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawBeziers(System.Drawing.Pen,System.Drawing.Point[]) - // -private: - void DrawBeziersPoint( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points for curve. - Point start = Point(100,100); - Point control1 = Point(200,10); - Point control2 = Point(350,50); - Point end1 = Point(500,100); - Point control3 = Point(600,150); - Point control4 = Point(650,250); - Point end2 = Point(500,300); - array^ bezierPoints = {start,control1,control2,end1,control3,control4,end2}; - - // Draw arc to screen. - e->Graphics->DrawBeziers( blackPen, bezierPoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawBeziers(System.Drawing.Pen,System.Drawing.PointF[]) - // -private: - void DrawBeziersPointF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points for curve. - PointF start = PointF(100.0F,100.0F); - PointF control1 = PointF(200.0F,10.0F); - PointF control2 = PointF(350.0F,50.0F); - PointF end1 = PointF(500.0F,100.0F); - PointF control3 = PointF(600.0F,150.0F); - PointF control4 = PointF(650.0F,250.0F); - PointF end2 = PointF(500.0F,300.0F); - array^ bezierPoints = {start,control1,control2,end1,control3,control4,end2}; - - // Draw arc to screen. - e->Graphics->DrawBeziers( blackPen, bezierPoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.Point[]) - // -private: - void DrawClosedCurvePoint( PaintEventArgs^ e ) - { - - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Draw closed curve to screen. - e->Graphics->DrawClosedCurve( greenPen, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.Point[],System.Single,System.Drawing.Drawing2D.FillMode) - // -private: - void DrawClosedCurvePointTension( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create tension and fill mode. - float tension = 1.0F; - FillMode aFillMode = FillMode::Alternate; - - // Draw closed curve to screen. - e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.PointF[]) - // -private: - void DrawClosedCurvePointF( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Draw closed curve to screen. - e->Graphics->DrawClosedCurve( greenPen, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Single,System.Drawing.Drawing2D.FillMode) - // -private: - void DrawClosedCurvePointFTension( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create tension and fill mode. - float tension = 1.0F; - FillMode aFillMode = FillMode::Alternate; - - // Draw closed curve to screen. - e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.Point[]) - // -private: - void DrawCurvePoint( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.Point[],System.Int32,System.Int32,System.Single) - // -private: - void DrawCurvePointSegmentTension( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create offset, number of segments, and tension. - int offset = 2; - int numSegments = 4; - float tension = 1.0F; - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.Point[],System.Single) - // -private: - void DrawCurvePointTension( PaintEventArgs^ e ) - { - - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create tension. - float tension = 1.0F; - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints, tension ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[]) - // -private: - void DrawCurvePointF( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Int32,System.Int32) - // -private: - void DrawCurvePointFSegments( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create offset and number of segments. - int offset = 2; - int numSegments = 4; - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Int32,System.Int32,System.Single) - // -private: - void DrawCurvePointFSegmentTension( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create offset, number of segments, and tension. - int offset = 2; - int numSegments = 4; - float tension = 1.0F; - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Single) - // -private: - void DrawCurvePointFTension( PaintEventArgs^ e ) - { - // Create pens. - Pen^ redPen = gcnew Pen( Color::Red,3.0f ); - Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); - - // Create points that define curve. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw lines between original points to screen. - e->Graphics->DrawLines( redPen, curvePoints ); - - // Create tension. - float tension = 1.0F; - - // Draw curve to screen. - e->Graphics->DrawCurve( greenPen, curvePoints, tension ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Drawing.Rectangle) - // -private: - void DrawEllipseRectangle( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle for ellipse. - Rectangle rect = Rectangle(0,0,200,100); - - // Draw ellipse to screen. - e->Graphics->DrawEllipse( blackPen, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Drawing.RectangleF) - // -private: - void DrawEllipseRectangleF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle for ellipse. - RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F); - - // Draw ellipse to screen. - e->Graphics->DrawEllipse( blackPen, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32) - // -private: - void DrawEllipseInt( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create location and size of ellipse. - int x = 0; - int y = 0; - int width = 200; - int height = 100; - - // Draw ellipse to screen. - e->Graphics->DrawEllipse( blackPen, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single) - // -private: - void DrawEllipseFloat( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create location and size of ellipse. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 100.0F; - - // Draw ellipse to screen. - e->Graphics->DrawEllipse( blackPen, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawIcon(System.Drawing.Icon,System.Drawing.Rectangle) - // -private: - void DrawIconRectangle( PaintEventArgs^ e ) - { - // Create icon. - System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon( "SampIcon.ico" ); - - // Create rectangle for icon. - Rectangle rect = Rectangle(100,100,200,200); - - // Draw icon to screen. - e->Graphics->DrawIcon( newIcon, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawIcon(System.Drawing.Icon,System.Int32,System.Int32) - // -private: - void DrawIconInt( PaintEventArgs^ e ) - { - - // Create icon. - System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon( "SampIcon.ico" ); - - // Create coordinates for upper-left corner of icon. - int x = 100; - int y = 100; - - // Draw icon to screen. - e->Graphics->DrawIcon( newIcon, x, y ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawIconUnstretched(System.Drawing.Icon,System.Drawing.Rectangle) - // -private: - void DrawIconUnstretchedRectangle( PaintEventArgs^ e ) - { - - // Create icon. - System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon( "SampIcon.ico" ); - - // Create rectangle for icon. - Rectangle rect = Rectangle(100,100,200,200); - - // Draw icon to screen. - e->Graphics->DrawIconUnstretched( newIcon, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point) - // -private: - void DrawImagePoint( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create Point for upper-left corner of image. - Point ulCorner = Point(100,100); - - // Draw image to screen. - e->Graphics->DrawImage( newImage, ulCorner ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[]) - // -private: - void DrawImagePara( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing image. - Point ulCorner = Point(100,100); - Point urCorner = Point(550,100); - Point llCorner = Point(150,250); - array^ destPara = {ulCorner,urCorner,llCorner}; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destPara ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit) - // -private: - void DrawImageParaRect( PaintEventArgs^ e ) - { - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing image. - Point ulCorner = Point(100,100); - Point urCorner = Point(325,100); - Point llCorner = Point(150,250); - array^ destPara = {ulCorner,urCorner,llCorner}; - - // Create rectangle for source image. - Rectangle srcRect = Rectangle(50,50,150,150); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destPara, srcRect, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) - // -private: - void DrawImageParaRectAttrib( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing image. - Point ulCorner1 = Point(100,100); - Point urCorner1 = Point(325,100); - Point llCorner1 = Point(150,250); - array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; - - // Create rectangle for source image. - Rectangle srcRect = Rectangle(50,50,150,150); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); - - // Create parallelogram for drawing adjusted image. - Point ulCorner2 = Point(325,100); - Point urCorner2 = Point(550,100); - Point llCorner2 = Point(375,250); - array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback1( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageParaRectAttribAbort( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback1 ); - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing original image. - Point ulCorner = Point(100,100); - Point urCorner = Point(550,100); - Point llCorner = Point(150,250); - array^ destPara1 = {ulCorner,urCorner,llCorner}; - - // Create rectangle for source image. - Rectangle srcRect = Rectangle(50,50,150,150); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); - - // Create parallelogram for drawing adjusted image. - Point ulCorner2 = Point(325,100); - Point urCorner2 = Point(550,100); - Point llCorner2 = Point(375,250); - array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw image to screen. - e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.Int32) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback2( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageParaRectAttribAbortData( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback2 ); - int imageCallbackData = 1; - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing original image. - Point ulCorner = Point(100,100); - Point urCorner = Point(550,100); - Point llCorner = Point(150,250); - array^ destPara1 = {ulCorner,urCorner,llCorner}; - - // Create rectangle for source image. - Rectangle srcRect = Rectangle(50,50,150,150); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); - - // Create parallelogram for drawing adjusted image. - Point ulCorner2 = Point(325,100); - Point urCorner2 = Point(550,100); - Point llCorner2 = Point(375,250); - array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw image to screen. - e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback, imageCallbackData ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF) - // -private: - void DrawImagePointF( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create point for upper-left corner of image. - PointF ulCorner = PointF(100.0F,100.0F); - - // Draw image to screen. - e->Graphics->DrawImage( newImage, ulCorner ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[]) - // -private: - void DrawImageParaF( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing image. - PointF ulCorner = PointF(100.0F,100.0F); - PointF urCorner = PointF(550.0F,100.0F); - PointF llCorner = PointF(150.0F,250.0F); - array^ destPara = {ulCorner,urCorner,llCorner}; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destPara ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit) - // -private: - void DrawImageParaFRectF( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing image. - PointF ulCorner = PointF(100.0F,100.0F); - PointF urCorner = PointF(550.0F,100.0F); - PointF llCorner = PointF(150.0F,250.0F); - array^ destPara = {ulCorner,urCorner,llCorner}; - - // Create rectangle for source image. - RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destPara, srcRect, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) - // - void DrawImageParaFRectFAttrib( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing original image. - PointF ulCorner1 = PointF(100.0F,100.0F); - PointF urCorner1 = PointF(325.0F,100.0F); - PointF llCorner1 = PointF(150.0F,250.0F); - array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; - - // Create rectangle for source image. - RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Create parallelogram for drawing adjusted image. - PointF ulCorner2 = PointF(325.0F,100.0F); - PointF urCorner2 = PointF(550.0F,100.0F); - PointF llCorner2 = PointF(375.0F,250.0F); - array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback3( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageParaFRectAttribAbort( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback3 ); - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing original image. - PointF ulCorner1 = PointF(100.0F,100.0F); - PointF urCorner1 = PointF(325.0F,100.0F); - PointF llCorner1 = PointF(150.0F,250.0F); - array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; - - // Create rectangle for source image. - RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Create parallelogram for drawing adjusted image. - PointF ulCorner2 = PointF(325.0F,100.0F); - PointF urCorner2 = PointF(550.0F,100.0F); - PointF llCorner2 = PointF(375.0F,250.0F); - array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.Int32) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback4( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageParaFRectAttribAbortData( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback4 ); - int imageCallbackData = 1; - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create parallelogram for drawing original image. - PointF ulCorner1 = PointF(100.0F,100.0F); - PointF urCorner1 = PointF(325.0F,100.0F); - PointF llCorner1 = PointF(150.0F,250.0F); - array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; - - // Create rectangle for source image. - RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Create parallelogram for drawing adjusted image. - PointF ulCorner2 = PointF(325.0F,100.0F); - PointF urCorner2 = PointF(550.0F,100.0F); - PointF llCorner2 = PointF(375.0F,250.0F); - array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback, imageCallbackData ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle) - // -private: - void DrawImageRect( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying image. - Rectangle destRect = Rectangle(100,100,450,150); - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destRect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Drawing.Rectangle,System.Drawing.GraphicsUnit) - // -private: - void DrawImageRectRect( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying image. - Rectangle destRect = Rectangle(100,100,450,150); - - // Create rectangle for source image. - Rectangle srcRect = Rectangle(50,50,150,150); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destRect, srcRect, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit) - // - void DrawImageRect4Int( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying image. - Rectangle destRect = Rectangle(100,100,450,150); - - // Create coordinates of rectangle for source image. - int x = 50; - int y = 50; - int width = 150; - int height = 150; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destRect, x, y, width, height, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) - // - void DrawImageRect4IntAtrrib( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying original image. - Rectangle destRect1 = Rectangle(100,25,450,150); - - // Create coordinates of rectangle for source image. - int x = 50; - int y = 50; - int width = 150; - int height = 150; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); - - // Create rectangle for adjusted image. - Rectangle destRect2 = Rectangle(100,175,450,150); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback5( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageRect4IntAtrribAbort( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback5 ); - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying original image. - Rectangle destRect1 = Rectangle(100,25,450,150); - - // Create coordinates of rectangle for source image. - int x = 50; - int y = 50; - int width = 150; - int height = 150; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); - - // Create rectangle for adjusted image. - Rectangle destRect2 = Rectangle(100,175,450,150); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.IntPtr) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback6( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageRect4IntAtrribAbortData( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback6 ); - IntPtr imageCallbackData = IntPtr(1); - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying original image. - Rectangle destRect1 = Rectangle(100,25,450,150); - - // Create coordinates of rectangle for source image. - int x = 50; - int y = 50; - int width = 150; - int height = 150; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); - - // Create rectangle for adjusted image. - Rectangle destRect2 = Rectangle(100,175,450,150); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback, imageCallbackData ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit) - // -private: - void DrawImageRect4Float( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying image. - Rectangle destRect = Rectangle(100,100,450,150); - - // Create coordinates of rectangle for source image. - float x = 50.0F; - float y = 50.0F; - float width = 150.0F; - float height = 150.0F; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destRect, x, y, width, height, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) - // -private: - void DrawImageRect4FloatAttrib( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying original image. - Rectangle destRect1 = Rectangle(100,25,450,150); - - // Create coordinates of rectangle for source image. - float x = 50.0F; - float y = 50.0F; - float width = 150.0F; - float height = 150.0F; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); - - // Create rectangle for adjusted image. - Rectangle destRect2 = Rectangle(100,175,450,150); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback7( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - // If callBackData passed, continue DrawImage method. - return false; - } - } - -private: - void DrawImageRect4FloatAttribAbort( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback7 ); - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying original image. - Rectangle destRect1 = Rectangle(100,25,450,150); - - // Create coordinates of rectangle for source image. - float x = 50.0F; - float y = 50.0F; - float width = 150.0F; - float height = 150.0F; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); - - // Create rectangle for adjusted image. - Rectangle destRect2 = Rectangle(100,175,450,150); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - try - { - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: T:System.Drawing.Image - // -private: - void ImageExampleForm_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create Point for upper-left corner of image. - Point ulCorner = Point(100,100); - - // Draw image to screen. - e->Graphics->DrawImage( newImage, ulCorner ); - } - // - - -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp deleted file mode 100644 index 7fc1989d761..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp +++ /dev/null @@ -1,1292 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.IntPtr) - // - // Define DrawImageAbort callback method. -private: - bool DrawImageCallback8( IntPtr callBackData ) - { - // Test for call that passes callBackData parameter. - if ( callBackData == IntPtr::Zero ) - { - - // If no callBackData passed, abort DrawImage method. - return true; - } - else - { - - // If callBackData passed, continue DrawImage method. - return false; - } - } - -public: - void DrawImageRect4FloatAttribAbortData( PaintEventArgs^ e ) - { - // Create callback method. - Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback8 ); - IntPtr imageCallbackData = IntPtr(1); - - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying original image. - Rectangle destRect1 = Rectangle(100,25,450,150); - - // Create coordinates of rectangle for source image. - float x = 50.0F; - float y = 50.0F; - float width = 150.0F; - float height = 150.0F; - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw original image to screen. - e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); - - // Create rectangle for adjusted image. - Rectangle destRect2 = Rectangle(100,175,450,150); - - // Create image attributes and set large gamma. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 4.0F ); - - // Draw adjusted image to screen. - try - { - // Draw adjusted image to screen. - e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback, imageCallbackData ); - } - catch ( Exception^ ex ) - { - e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.RectangleF) - // -public: - void DrawImageRectF( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying image. - RectangleF rect = RectangleF(100.0F,100.0F,450.0F,150.0F); - - // Draw image to screen. - e->Graphics->DrawImage( newImage, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.RectangleF,System.Drawing.RectangleF,System.Drawing.GraphicsUnit) - // -public: - void DrawImageRectFRectF( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create rectangle for displaying image. - RectangleF destRect = RectangleF(100.0F,100.0F,450.0F,150.0F); - - // Create rectangle for source image. - RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, destRect, srcRect, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Int32,System.Int32) - // -public: - void DrawImage2Int( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner of image. - int x = 100; - int y = 100; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, x, y ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Int32,System.Int32,System.Drawing.Rectangle,System.Drawing.GraphicsUnit) - // -public: - void DrawImage2IntRect( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner of image. - int x = 100; - int y = 100; - - // Create rectangle for source image. - Rectangle srcRect = Rectangle(50,50,150,150); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, x, y, srcRect, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void DrawImage4Int( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner. - // of image and for size of image. - int x = 100; - int y = 100; - int width = 450; - int height = 150; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Single,System.Single) - // -public: - void DrawImage2Float( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner of image. - float x = 100.0F; - float y = 100.0F; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, x, y ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Single,System.Single,System.Drawing.RectangleF,System.Drawing.GraphicsUnit) - // -public: - void DrawImage2FloatRectF( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner of image. - float x = 100.0F; - float y = 100.0F; - - // Create rectangle for source image. - RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); - GraphicsUnit units = GraphicsUnit::Pixel; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, x, y, srcRect, units ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Single,System.Single,System.Single,System.Single) - // -public: - void DrawImage4Float( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner. - // of image and for size of image. - float x = 100.0F; - float y = 100.0F; - float width = 450.0F; - float height = 150.0F; - - // Draw image to screen. - e->Graphics->DrawImage( newImage, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImageUnscaled(System.Drawing.Image,System.Drawing.Point) - // -public: - void DrawImageUnscaledPoint( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create point for upper-left corner of image. - Point ulCorner = Point(100,100); - - // Draw image to screen. - e->Graphics->DrawImageUnscaled( newImage, ulCorner ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawImageUnscaled(System.Drawing.Image,System.Int32,System.Int32) - // -public: - void DrawImageUnscaledInt( PaintEventArgs^ e ) - { - // Create image. - Image^ newImage = Image::FromFile( "SampImag.jpg" ); - - // Create coordinates for upper-left corner of image. - int x = 100; - int y = 100; - - // Draw image to screen. - e->Graphics->DrawImageUnscaled( newImage, x, y ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Drawing.Point,System.Drawing.Point) - // -public: - void DrawLinePoint( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points that define line. - Point point1 = Point(100,100); - Point point2 = Point(500,100); - - // Draw line to screen. - e->Graphics->DrawLine( blackPen, point1, point2 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Drawing.PointF,System.Drawing.PointF) - // -public: - void DrawLinePointF( PaintEventArgs^ e ) - { - - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points that define line. - PointF point1 = PointF(100.0F,100.0F); - PointF point2 = PointF(500.0F,100.0F); - - // Draw line to screen. - e->Graphics->DrawLine( blackPen, point1, point2 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void DrawLineInt( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create coordinates of points that define line. - int x1 = 100; - int y1 = 100; - int x2 = 500; - int y2 = 100; - - // Draw line to screen. - e->Graphics->DrawLine( blackPen, x1, y1, x2, y2 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single) - // -public: - void DrawLineFloat( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create coordinates of points that define line. - float x1 = 100.0F; - float y1 = 100.0F; - float x2 = 500.0F; - float y2 = 100.0F; - - // Draw line to screen. - e->Graphics->DrawLine( blackPen, x1, y1, x2, y2 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawLines(System.Drawing.Pen,System.Drawing.Point[]) - // -public: - void DrawLinesPoint( PaintEventArgs^ e ) - { - // Create pen. - Pen^ pen = gcnew Pen( Color::Black,3.0f ); - - // Create array of points that define lines to draw. - array^ points = {Point(10,10),Point(10,100),Point(200,50),Point(250,300)}; - - //Draw lines to screen. - e->Graphics->DrawLines( pen, points ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawLines(System.Drawing.Pen,System.Drawing.PointF[]) - // -public: - void DrawLinesPointF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ pen = gcnew Pen( Color::Black,3.0f ); - - // Create array of points that define lines to draw. - array^ points = {PointF(10.0F,10.0F),PointF(10.0F,100.0F),PointF(200.0F,50.0F),PointF(250.0F,300.0F)}; - - //Draw lines to screen. - e->Graphics->DrawLines( pen, points ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPath(System.Drawing.Pen,System.Drawing.Drawing2D.GraphicsPath) - // -public: - void DrawPathEllipse( PaintEventArgs^ e ) - { - // Create graphics path object and add ellipse. - GraphicsPath^ graphPath = gcnew GraphicsPath; - graphPath->AddEllipse( 0, 0, 200, 100 ); - - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Draw graphics path to screen. - e->Graphics->DrawPath( blackPen, graphPath ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Drawing.Rectangle,System.Single,System.Single) - // -public: - void DrawPieRectangle( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle for ellipse. - Rectangle rect = Rectangle(0,0,200,100); - - // Create start and sweep angles. - float startAngle = 0.0F; - float sweepAngle = 45.0F; - - // Draw pie to screen. - e->Graphics->DrawPie( blackPen, rect, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Drawing.RectangleF,System.Single,System.Single) - // -public: - void DrawPieRectangleF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle for ellipse. - RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F); - - // Create start and sweep angles. - float startAngle = 0.0F; - float sweepAngle = 45.0F; - - // Draw pie to screen. - e->Graphics->DrawPie( blackPen, rect, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void DrawPieInt( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create location and size of ellipse. - int x = 0; - int y = 0; - int width = 200; - int height = 100; - - // Create start and sweep angles. - int startAngle = 0; - int sweepAngle = 45; - - // Draw pie to screen. - e->Graphics->DrawPie( blackPen, x, y, width, height, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) - // -public: - void DrawPieFloat( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create location and size of ellipse. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 100.0F; - - // Create start and sweep angles. - float startAngle = 0.0F; - float sweepAngle = 45.0F; - - // Draw pie to screen. - e->Graphics->DrawPie( blackPen, x, y, width, height, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPolygon(System.Drawing.Pen,System.Drawing.Point[]) - // -public: - void DrawPolygonPointF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points that define polygon. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw polygon curve to screen. - e->Graphics->DrawPolygon( blackPen, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawPolygon(System.Drawing.Pen,System.Drawing.PointF[]) - // -public: - void DrawPolygonPoint( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create points that define polygon. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw polygon to screen. - e->Graphics->DrawPolygon( blackPen, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen,System.Drawing.Rectangle) - // -public: - void DrawRectangleRectangle( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create rectangle. - Rectangle rect = Rectangle(0,0,200,200); - - // Draw rectangle to screen. - e->Graphics->DrawRectangle( blackPen, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void DrawRectangleInt( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create location and size of rectangle. - int x = 0; - int y = 0; - int width = 200; - int height = 200; - - // Draw rectangle to screen. - e->Graphics->DrawRectangle( blackPen, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single) - // -public: - void DrawRectangleFloat( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create location and size of rectangle. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 200.0F; - - // Draw rectangle to screen. - e->Graphics->DrawRectangle( blackPen, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawRectangles(System.Drawing.Pen,System.Drawing.Rectangle[]) - // -public: - void DrawRectanglesRectangle( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create array of rectangles. - array^ rects = {Rectangle(0,0,100,200),Rectangle(100,200,250,50),Rectangle(300,0,50,100)}; - - // Draw rectangles to screen. - e->Graphics->DrawRectangles( blackPen, rects ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawRectangles(System.Drawing.Pen,System.Drawing.RectangleF[]) - // -public: - void DrawRectanglesRectangleF( PaintEventArgs^ e ) - { - // Create pen. - Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); - - // Create array of rectangles. - array^ rects = {RectangleF(0.0F,0.0F,100.0F,200.0F),RectangleF(100.0F,200.0F,250.0F,50.0F),RectangleF(300.0F,0.0F,50.0F,100.0F)}; - - // Draw rectangles to screen. - e->Graphics->DrawRectangles( blackPen, rects ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF) - // -public: - void DrawStringPointF( PaintEventArgs^ e ) - { - // Create string to draw. - String^ drawString = "Sample Text"; - - // Create font and brush. - System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); - SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); - - // Create point for upper-left corner of drawing. - PointF drawPoint = PointF(150.0F,150.0F); - - // Draw string to screen. - e->Graphics->DrawString( drawString, drawFont, drawBrush, drawPoint ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF,System.Drawing.StringFormat) - // -public: - void DrawStringPointFFormat( PaintEventArgs^ e ) - { - // Create string to draw. - String^ drawString = "Sample Text"; - - // Create font and brush. - System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); - SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); - - // Create point for upper-left corner of drawing. - PointF drawPoint = PointF(150.0F,50.0F); - - // Set format of string. - StringFormat^ drawFormat = gcnew StringFormat; - drawFormat->FormatFlags = StringFormatFlags::DirectionVertical; - - // Draw string to screen. - e->Graphics->DrawString( drawString, drawFont, drawBrush, drawPoint, drawFormat ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.RectangleF) - // -public: - void DrawStringRectangleF( PaintEventArgs^ e ) - { - // Create string to draw. - String^ drawString = "Sample Text"; - - // Create font and brush. - System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); - SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); - - // Create rectangle for drawing. - float x = 150.0F; - float y = 150.0F; - float width = 200.0F; - float height = 50.0F; - RectangleF drawRect = RectangleF(x,y,width,height); - - // Draw rectangle to screen. - Pen^ blackPen = gcnew Pen( Color::Black ); - e->Graphics->DrawRectangle( blackPen, x, y, width, height ); - - // Draw string to screen. - e->Graphics->DrawString( drawString, drawFont, drawBrush, drawRect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.RectangleF,System.Drawing.StringFormat) - // -public: - void DrawStringRectangleFFormat( PaintEventArgs^ e ) - { - // Create string to draw. - String^ drawString = "Sample Text"; - - // Create font and brush. - System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); - SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); - - // Create rectangle for drawing. - float x = 150.0F; - float y = 150.0F; - float width = 200.0F; - float height = 50.0F; - RectangleF drawRect = RectangleF(x,y,width,height); - - // Draw rectangle to screen. - Pen^ blackPen = gcnew Pen( Color::Black ); - e->Graphics->DrawRectangle( blackPen, x, y, width, height ); - - // Set format of string. - StringFormat^ drawFormat = gcnew StringFormat; - drawFormat->Alignment = StringAlignment::Center; - - // Draw string to screen. - e->Graphics->DrawString( drawString, drawFont, drawBrush, drawRect, drawFormat ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single) - // -public: - void DrawStringFloat( PaintEventArgs^ e ) - { - // Create string to draw. - String^ drawString = "Sample Text"; - - // Create font and brush. - System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); - SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); - - // Create point for upper-left corner of drawing. - float x = 150.0F; - float y = 150.0F; - - // Draw string to screen. - e->Graphics->DrawString( drawString, drawFont, drawBrush, x, y ); - } - // - - // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single,System.Drawing.StringFormat) - // -public: - void DrawStringFloatFormat( PaintEventArgs^ e ) - { - // Create string to draw. - String^ drawString = "Sample Text"; - - // Create font and brush. - System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); - SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); - - // Create point for upper-left corner of drawing. - float x = 150.0F; - float y = 50.0F; - - // Set format of string. - StringFormat^ drawFormat = gcnew StringFormat; - drawFormat->FormatFlags = StringFormatFlags::DirectionVertical; - - // Draw string to screen. - e->Graphics->DrawString( drawString, drawFont, drawBrush, x, y, drawFormat ); - } - // - - // Snippet for: M:System.Drawing.Graphics.EndContainer(System.Drawing.Drawing2D.GraphicsContainer) - // -public: - void EndContainerState( PaintEventArgs^ e ) - { - // Begin graphics container. - GraphicsContainer^ containerState = e->Graphics->BeginContainer(); - - // Translate world transformation. - e->Graphics->TranslateTransform( 100.0F, 100.0F ); - - // Fill translated rectangle in container with red. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 ); - - // End graphics container. - e->Graphics->EndContainer( containerState ); - - // Fill untransformed rectangle with green. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.ExcludeClip(System.Drawing.Region) - // -public: - void ExcludeClipRegion( PaintEventArgs^ e ) - { - // Create rectangle for region. - Rectangle excludeRect = Rectangle(100,100,200,200); - - // Create region for exclusion. - System::Drawing::Region^ excludeRegion = gcnew System::Drawing::Region( excludeRect ); - - // Set clipping region to exclude region. - e->Graphics->ExcludeClip( excludeRegion ); - - // Fill large rectangle to show clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.ExcludeClip(System.Drawing.Rectangle) - // -public: - void ExcludeClipRectangle( PaintEventArgs^ e ) - { - // Create rectangle for exclusion. - Rectangle excludeRect = Rectangle(100,100,200,200); - - // Set clipping region to exclude rectangle. - e->Graphics->ExcludeClip( excludeRect ); - - // Fill large rectangle to show clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[]) - // -public: - void FillClosedCurvePoint( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - //Create array of points for curve. - Point point1 = Point(100,100); - Point point2 = Point(200,50); - Point point3 = Point(250,200); - Point point4 = Point(50,150); - array^ points = {point1,point2,point3,point4}; - - // Fill curve on screen. - e->Graphics->FillClosedCurve( redBrush, points ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode) - // -public: - void FillClosedCurvePointFillMode( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - //Create array of points for curve. - Point point1 = Point(100,100); - Point point2 = Point(200,50); - Point point3 = Point(250,200); - Point point4 = Point(50,150); - array^ points = {point1,point2,point3,point4}; - - // Set fill mode. - FillMode newFillMode = FillMode::Winding; - - // Fill curve on screen. - e->Graphics->FillClosedCurve( redBrush, points, newFillMode ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode,System.Single) - // -public: - void FillClosedCurvePointFillModeTension( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create array of points for curve. - Point point1 = Point(100,100); - Point point2 = Point(200,50); - Point point3 = Point(250,200); - Point point4 = Point(50,150); - array^ points = {point1,point2,point3,point4}; - - // Set fill mode. - FillMode newFillMode = FillMode::Winding; - - // Set tension. - float tension = 1.0F; - - // Fill curve on screen. - e->Graphics->FillClosedCurve( redBrush, points, newFillMode, tension ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.PointF[]) - // -public: - void FillClosedCurvePointF( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - //Create array of points for curve. - PointF point1 = PointF(100.0F,100.0F); - PointF point2 = PointF(200.0F,50.0F); - PointF point3 = PointF(250.0F,200.0F); - PointF point4 = PointF(50.0F,150.0F); - array^ points = {point1,point2,point3,point4}; - - // Fill curve on screen. - e->Graphics->FillClosedCurve( redBrush, points ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.PointF[],System.Drawing.Drawing2D.FillMode) - // -public: - void FillClosedCurvePointFFillMode( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create array of points for curve. - PointF point1 = PointF(100.0F,100.0F); - PointF point2 = PointF(200.0F,50.0F); - PointF point3 = PointF(250.0F,200.0F); - PointF point4 = PointF(50.0F,150.0F); - array^ points = {point1,point2,point3,point4}; - - // Set fill mode. - FillMode newFillMode = FillMode::Winding; - - // Fill curve on screen. - e->Graphics->FillClosedCurve( redBrush, points, newFillMode ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.PointF[],System.Drawing.Drawing2D.FillMode,System.Single) - // -public: - void FillClosedCurvePointFFillModeTension( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create array of points for curve. - PointF point1 = PointF(100.0F,100.0F); - PointF point2 = PointF(200.0F,50.0F); - PointF point3 = PointF(250.0F,200.0F); - PointF point4 = PointF(50.0F,150.0F); - array^ points = {point1,point2,point3,point4}; - - // Set fill mode. - FillMode newFillMode = FillMode::Winding; - - // Set tension. - float tension = 1.0F; - - // Fill curve on screen. - e->Graphics->FillClosedCurve( redBrush, points, newFillMode, tension ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Drawing.Rectangle) - // -public: - void FillEllipseRectangle( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create rectangle for ellipse. - int x = 0; - int y = 0; - int width = 200; - int height = 100; - Rectangle rect = Rectangle(x,y,width,height); - - // Fill ellipse on screen. - e->Graphics->FillEllipse( redBrush, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Drawing.RectangleF) - // -public: - void FillEllipseRectangleF( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create rectangle for ellipse. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 100.0F; - RectangleF rect = RectangleF(x,y,width,height); - - // Fill ellipse on screen. - e->Graphics->FillEllipse( redBrush, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void FillEllipseInt( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create location and size of ellipse. - int x = 0; - int y = 0; - int width = 200; - int height = 100; - - // Fill ellipse on screen. - e->Graphics->FillEllipse( redBrush, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Single,System.Single,System.Single,System.Single) - // -public: - void FillEllipseFloat( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create location and size of ellipse. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 100.0F; - - // Fill ellipse on screen. - e->Graphics->FillEllipse( redBrush, x, y, width, height ); - } - // - // Snippet for: M:System.Drawing.Graphics.FillPath(System.Drawing.Brush,System.Drawing.Drawing2D.GraphicsPath) - - // -public: - void FillPathEllipse( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create graphics path object and add ellipse. - GraphicsPath^ graphPath = gcnew GraphicsPath; - graphPath->AddEllipse( 0, 0, 200, 100 ); - - // Fill graphics path to screen. - e->Graphics->FillPath( redBrush, graphPath ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillPie(System.Drawing.Brush,System.Drawing.Rectangle,System.Single,System.Single) - // -public: - void FillPieRectangle( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create rectangle for ellipse. - Rectangle rect = Rectangle(0,0,200,100); - - // Create start and sweep angles. - float startAngle = 0.0F; - float sweepAngle = 45.0F; - - // Fill pie to screen. - e->Graphics->FillPie( redBrush, rect, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillPie(System.Drawing.Brush,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void FillPieInt( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create location and size of ellipse. - int x = 0; - int y = 0; - int width = 200; - int height = 100; - - // Create start and sweep angles. - int startAngle = 0; - int sweepAngle = 45; - - // Fill pie to screen. - e->Graphics->FillPie( redBrush, x, y, width, height, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillPie(System.Drawing.Brush,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) - // -public: - void FillPieFloat( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); - - // Create location and size of ellipse. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 100.0F; - - // Create start and sweep angles. - float startAngle = 0.0F; - float sweepAngle = 45.0F; - - // Fill pie to screen. - e->Graphics->FillPie( redBrush, x, y, width, height, startAngle, sweepAngle ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.Point[]) - // -public: - void FillPolygonPoint( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create points that define polygon. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Draw polygon to screen. - e->Graphics->FillPolygon( blueBrush, curvePoints ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode) - // -public: - void FillPolygonPointFillMode( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create points that define polygon. - Point point1 = Point(50,50); - Point point2 = Point(100,25); - Point point3 = Point(200,5); - Point point4 = Point(250,50); - Point point5 = Point(300,100); - Point point6 = Point(350,200); - Point point7 = Point(250,250); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Define fill mode. - FillMode newFillMode = FillMode::Winding; - - // Draw polygon to screen. - e->Graphics->FillPolygon( blueBrush, curvePoints, newFillMode ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.PointF[]) - // -public: - void FillPolygonPointF( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create points that define polygon. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Fill polygon to screen. - e->Graphics->FillPolygon( blueBrush, curvePoints ); - } - // - // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.PointF[],System.Drawing.Drawing2D.FillMode) - - // -public: - void FillPolygonPointFFillMode( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create points that define polygon. - PointF point1 = PointF(50.0F,50.0F); - PointF point2 = PointF(100.0F,25.0F); - PointF point3 = PointF(200.0F,5.0F); - PointF point4 = PointF(250.0F,50.0F); - PointF point5 = PointF(300.0F,100.0F); - PointF point6 = PointF(350.0F,200.0F); - PointF point7 = PointF(250.0F,250.0F); - array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; - - // Define fill mode. - FillMode newFillMode = FillMode::Winding; - - // Fill polygon to screen. - e->Graphics->FillPolygon( blueBrush, curvePoints, newFillMode ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp deleted file mode 100644 index 1412e743da7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp +++ /dev/null @@ -1,1410 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Drawing::Drawing2D; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Drawing.Rectangle) - // -public: - void FillRectangleRectangle( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create rectangle. - Rectangle rect = Rectangle(0,0,200,200); - - // Fill rectangle to screen. - e->Graphics->FillRectangle( blueBrush, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Drawing.RectangleF) - // -public: - void FillRectangleRectangleF( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create rectangle. - RectangleF rect = RectangleF(0.0F,0.0F,200.0F,200.0F); - - // Fill rectangle to screen. - e->Graphics->FillRectangle( blueBrush, rect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void FillRectangleInt( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create location and size of rectangle. - int x = 0; - int y = 0; - int width = 200; - int height = 200; - - // Fill rectangle to screen. - e->Graphics->FillRectangle( blueBrush, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Single,System.Single,System.Single,System.Single) - // -public: - void FillRectangleFloat( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create location and size of rectangle. - float x = 0.0F; - float y = 0.0F; - float width = 200.0F; - float height = 200.0F; - - // Fill rectangle to screen. - e->Graphics->FillRectangle( blueBrush, x, y, width, height ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillRectangles(System.Drawing.Brush,System.Drawing.Rectangle[]) - // -public: - void FillRectanglesRectangle( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create array of rectangles. - array^ rects = {Rectangle(0,0,100,200),Rectangle(100,200,250,50),Rectangle(300,0,50,100)}; - - // Fill rectangles to screen. - e->Graphics->FillRectangles( blueBrush, rects ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillRectangles(System.Drawing.Brush,System.Drawing.RectangleF[]) - // -public: - void FillRectanglesRectangleF( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create array of rectangles. - array^ rects = {RectangleF(0.0F,0.0F,100.0F,200.0F),RectangleF(100.0F,200.0F,250.0F,50.0F),RectangleF(300.0F,0.0F,50.0F,100.0F)}; - - // Fill rectangles to screen. - e->Graphics->FillRectangles( blueBrush, rects ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FillRegion(System.Drawing.Brush,System.Drawing.Region) - // -public: - void FillRegionRectangle( PaintEventArgs^ e ) - { - // Create solid brush. - SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); - - // Create rectangle for region. - Rectangle fillRect = Rectangle(100,100,200,200); - - // Create region for fill. - System::Drawing::Region^ fillRegion = gcnew System::Drawing::Region( fillRect ); - - // Fill region to screen. - e->Graphics->FillRegion( blueBrush, fillRegion ); - } - // - - // Snippet for: M:System.Drawing.Graphics.FromHdc(System.IntPtr) - // -public: - void FromHdcHdc( PaintEventArgs^ e ) - { - // Get handle to device context. - IntPtr hdc = e->Graphics->GetHdc(); - - // Create new graphics object using handle to device context. - Graphics^ newGraphics = Graphics::FromHdc( hdc ); - - // Draw rectangle to screen. - newGraphics->DrawRectangle( gcnew Pen( Color::Red,3.0f ), 0, 0, 200, 100 ); - - // Release handle to device context and dispose of the // Graphics object - e->Graphics->ReleaseHdc( hdc ); - delete newGraphics; - } - // - - // Snippet for: M:System.Drawing.Graphics.FromHwnd(System.IntPtr) - // -public: - void FromHwndHwnd( PaintEventArgs^ /*e*/ ) - { - // Get handle to form. - IntPtr hwnd = this->Handle; - - // Create new graphics object using handle to window. - Graphics^ newGraphics = Graphics::FromHwnd( hwnd ); - - // Draw rectangle to screen. - newGraphics->DrawRectangle( gcnew Pen( Color::Red,3.0f ), 0, 0, 200, 100 ); - - // Dispose of new graphics. - delete newGraphics; - } - // - - // Snippet for: M:System.Drawing.Graphics.FromImage(System.Drawing.Image) - // -public: - void FromImageImage( PaintEventArgs^ e ) - { - // Create image. - Image^ imageFile = Image::FromFile( "SampImag.jpg" ); - - // Create graphics object for alteration. - Graphics^ newGraphics = Graphics::FromImage( imageFile ); - - // Alter image. - newGraphics->FillRectangle( gcnew SolidBrush( Color::Black ), 100, 50, 100, 100 ); - - // Draw image to screen. - e->Graphics->DrawImage( imageFile, PointF(0.0F,0.0F) ); - - // Dispose of graphics object. - delete newGraphics; - } - // - - // Snippet for: M:System.Drawing.Graphics.GetHalftonePalette - // -private: - [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] - static IntPtr SelectPalette( IntPtr hdc, IntPtr htPalette, bool bForceBackground ); - - [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] - static int RealizePalette( IntPtr hdc ); - -public: - void GetHalftonePaletteVoid( PaintEventArgs^ e ) - { - // Create and draw image. - Image^ imageFile = Image::FromFile( "SampImag.jpg" ); - e->Graphics->DrawImage( imageFile, Point(0,0) ); - - // Get handle to device context. - IntPtr hdc = e->Graphics->GetHdc(); - - // Get handle to halftone palette. - IntPtr htPalette = Graphics::GetHalftonePalette(); - - // Select and realize new palette. - SelectPalette( hdc, htPalette, true ); - RealizePalette( hdc ); - - // Create new graphics object. - Graphics^ newGraphics = Graphics::FromHdc( hdc ); - - // Draw image with new palette. - newGraphics->DrawImage( imageFile, 300, 0 ); - - // Release handle to device context. - e->Graphics->ReleaseHdc( hdc ); - } - // - - // Snippet for: M:System.Drawing.Graphics.GetHdc - // -private: - [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] - static bool Rectangle( IntPtr hdc, int ulCornerX, int ulCornerY, int lrCornerX, int lrCornerY ); - -public: - void GetHdcForGDI1( PaintEventArgs^ e ) - { - // Create pen. - Pen^ redPen = gcnew Pen( Color::Red,1.0f ); - - // Draw rectangle with GDI+. - e->Graphics->DrawRectangle( redPen, 10, 10, 100, 50 ); - - // Get handle to device context. - IntPtr hdc = e->Graphics->GetHdc(); - - // Draw rectangle with GDI using default pen. - Rectangle( hdc, 10, 70, 110, 120 ); - - // Release handle to device context. - e->Graphics->ReleaseHdc( hdc ); - } - // - - // Snippet for: M:System.Drawing.Graphics.GetNearestColor(System.Drawing.Color) - // -public: - void GetNearestColorColor( PaintEventArgs^ e ) - { - // Create solid brush with arbitrary color. - Color arbColor = Color::FromArgb( 255, 165, 63, 136 ); - SolidBrush^ arbBrush = gcnew SolidBrush( arbColor ); - - // Fill ellipse on screen. - e->Graphics->FillEllipse( arbBrush, 0, 0, 200, 100 ); - - // Get nearest color. - Color realColor = e->Graphics->GetNearestColor( arbColor ); - SolidBrush^ realBrush = gcnew SolidBrush( realColor ); - - // Fill ellipse on screen. - e->Graphics->FillEllipse( realBrush, 0, 100, 200, 100 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.IntersectClip(System.Drawing.Rectangle) - // -public: - void IntersectClipRectangle( PaintEventArgs^ e ) - { - // Set clipping region. - Rectangle clipRect = Rectangle(0,0,200,200); - e->Graphics->SetClip( clipRect ); - - // Update clipping region to intersection of - // existing region with specified rectangle. - Rectangle intersectRect = Rectangle(100,100,200,200); - e->Graphics->IntersectClip( intersectRect ); - - // Fill rectangle to demonstrate effective clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); - - // Reset clipping region to infinite. - e->Graphics->ResetClip(); - - // Draw clipRect and intersectRect to screen. - e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.IntersectClip(System.Drawing.RectangleF) - // -public: - void IntersectClipRectangleF1( PaintEventArgs^ e ) - { - // Set clipping region. - Rectangle clipRect = Rectangle(0,0,200,200); - e->Graphics->SetClip( clipRect ); - - // Update clipping region to intersection of - // existing region with specified rectangle. - RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F); - e->Graphics->IntersectClip( intersectRectF ); - - // Fill rectangle to demonstrate effective clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); - - // Reset clipping region to infinite. - e->Graphics->ResetClip(); - - // Draw clipRect and intersectRect to screen. - e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.IntersectClip(System.Drawing.Region) - // -public: - void IntersectClipRegion( PaintEventArgs^ e ) - { - // Set clipping region. - Rectangle clipRect = Rectangle(0,0,200,200); - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( clipRect ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Update clipping region to intersection of - // existing region with specified rectangle. - Rectangle intersectRect = Rectangle(100,100,200,200); - System::Drawing::Region^ intersectRegion = gcnew System::Drawing::Region( intersectRect ); - e->Graphics->IntersectClip( intersectRegion ); - - // Fill rectangle to demonstrate effective clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); - - // Reset clipping region to infinite. - e->Graphics->ResetClip(); - - // Draw clipRect and intersectRect to screen. - e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect ); - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.Point) - // -public: - void IsVisiblePoint( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of points. - int x1 = 100; - int y1 = 100; - int x2 = 200; - int y2 = 200; - Point point1 = Point(x1,y1); - Point point2 = Point(x2,y2); - - // If point is visible, fill ellipse that represents it. - if ( e->Graphics->IsVisible( point1 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10, 10 ); - } - - if ( e->Graphics->IsVisible( point2 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10, 10 ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.PointF) - // -public: - void IsVisiblePointF( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of points. - float x1 = 100.0F; - float y1 = 100.0F; - float x2 = 200.0F; - float y2 = 200.0F; - PointF point1 = PointF(x1,y1); - PointF point2 = PointF(x2,y2); - - // If point is visible, fill ellipse that represents it. - if ( e->Graphics->IsVisible( point1 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10.0F, 10.0F ); - } - - if ( e->Graphics->IsVisible( point2 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10.0F, 10.0F ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.Rectangle) - // -public: - void IsVisibleRectangle( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of rectangles. - Rectangle rect1 = Rectangle(100,100,20,20); - Rectangle rect2 = Rectangle(200,200,20,20); - - // If rectangle is visible, fill it. - if ( e->Graphics->IsVisible( rect1 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), rect1 ); - } - - if ( e->Graphics->IsVisible( rect2 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), rect2 ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.RectangleF) - // -public: - void IsVisibleRectangleF( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of rectangles. - RectangleF rect1 = RectangleF(100.0F,100.0F,20.0F,20.0F); - RectangleF rect2 = RectangleF(200.0F,200.0F,20.0F,20.0F); - - // If rectangle is visible, fill it. - if ( e->Graphics->IsVisible( rect1 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), rect1 ); - } - - if ( e->Graphics->IsVisible( rect2 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), rect2 ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Int32,System.Int32) - // -public: - void IsVisibleInt( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of points. - int x1 = 100; - int y1 = 100; - int x2 = 200; - int y2 = 200; - - // If point is visible, fill ellipse that represents it. - if ( e->Graphics->IsVisible( x1, y1 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10, 10 ); - } - - if ( e->Graphics->IsVisible( x2, y2 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10, 10 ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Int32,System.Int32,System.Int32,System.Int32) - // -public: - void IsVisible4Int( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of rectangles. - int x1 = 100; - int y1 = 100; - int width1 = 20; - int height1 = 20; - int x2 = 200; - int y2 = 200; - int width2 = 20; - int height2 = 20; - - // If rectangle is visible, fill it. - if ( e->Graphics->IsVisible( x1, y1, width1, height1 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), x1, y1, width1, height1 ); - } - - if ( e->Graphics->IsVisible( x2, y2, width2, height2 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), x2, y2, width2, height2 ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Single,System.Single) - // -public: - void IsVisibleFloat( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of points. - float x1 = 100.0F; - float y1 = 100.0F; - float x2 = 200.0F; - float y2 = 200.0F; - - // If point is visible, fill ellipse that represents it. - if ( e->Graphics->IsVisible( x1, y1 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10.0F, 10.0F ); - } - - if ( e->Graphics->IsVisible( x2, y2 ) ) - { - e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10.0F, 10.0F ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Single,System.Single,System.Single,System.Single) - // -public: - void IsVisible4Float( PaintEventArgs^ e ) - { - // Set clip region. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Set up coordinates of rectangles. - float x1 = 100.0F; - float y1 = 100.0F; - float width1 = 20.0F; - float height1 = 20.0F; - float x2 = 200.0F; - float y2 = 200.0F; - float width2 = 20.0F; - float height2 = 20.0F; - - // If rectangle is visible, fill it. - if ( e->Graphics->IsVisible( x1, y1, width1, height1 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), x1, y1, width1, height1 ); - } - - if ( e->Graphics->IsVisible( x2, y2, width2, height2 ) ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), x2, y2, width2, height2 ); - } - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureCharacterRanges(System.String,System.Drawing.Font,System.Drawing.RectangleF,System.Drawing.StringFormat) - // -public: - void MeasureCharacterRangesRegions( PaintEventArgs^ e ) - { - // Set up string. - String^ measureString = "First and Second ranges"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Times New Roman",16.0F ); - - // Set character ranges to "First" and "Second". - array^ characterRanges = {CharacterRange(0,5),CharacterRange(10,6)}; - - // Create rectangle for layout. - float x = 50.0F; - float y = 50.0F; - float width = 35.0F; - float height = 200.0F; - RectangleF layoutRect = RectangleF(x,y,width,height); - - // Set string format. - StringFormat^ stringFormat = gcnew StringFormat; - stringFormat->FormatFlags = StringFormatFlags::DirectionVertical; - stringFormat->SetMeasurableCharacterRanges( characterRanges ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, x, y, stringFormat ); - - // Measure two ranges in string. - array^stringRegions = e->Graphics->MeasureCharacterRanges( measureString, - stringFont, layoutRect, stringFormat ); - - // Draw rectangle for first measured range. - RectangleF measureRect1 = stringRegions[ 0 ]->GetBounds( e->Graphics ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), Rectangle::Round( measureRect1 ) ); - - // Draw rectangle for second measured range. - RectangleF measureRect2 = stringRegions[ 1 ]->GetBounds( e->Graphics ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,1.0f ), Rectangle::Round( measureRect2 ) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font) - // -public: - void MeasureStringMin( PaintEventArgs^ e ) - { - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Measure string. - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.PointF,System.Drawing.StringFormat) - // -public: - void MeasureStringPointFFormat( PaintEventArgs^ e ) - { - - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Set point for upper-left corner of string. - float x = 50.0F; - float y = 50.0F; - PointF ulCorner = PointF(x,y); - - // Set string format. - StringFormat^ newStringFormat = gcnew StringFormat; - newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; - - // Measure string. - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, ulCorner, newStringFormat ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), x, y, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, ulCorner, newStringFormat ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.SizeF) - // -public: - void MeasureStringSizeF( PaintEventArgs^ e ) - { - - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Set maximum layout size. - SizeF layoutSize = SizeF(200.0F,50.0F); - - // Measure string. - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, layoutSize ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.SizeF,System.Drawing.StringFormat) - // -public: - void MeasureStringSizeFFormat( PaintEventArgs^ e ) - { - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Set maximum layout size. - SizeF layoutSize = SizeF(100.0F,200.0F); - - // Set string format. - StringFormat^ newStringFormat = gcnew StringFormat; - newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; - - // Measure string. - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, layoutSize, newStringFormat ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0), newStringFormat ); - } - // - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.SizeF,System.Drawing.StringFormat,System.Int32@,System.Int32@) - - // -public: - void MeasureStringSizeFFormatInts( PaintEventArgs^ e ) - { - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Set maximum layout size. - SizeF layoutSize = SizeF(100.0F,200.0F); - - // Set string format. - StringFormat^ newStringFormat = gcnew StringFormat; - newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; - - // Measure string. - int charactersFitted; - int linesFilled; - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, layoutSize, newStringFormat, charactersFitted, linesFilled ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0), newStringFormat ); - - // Draw output parameters to screen. - String^ outString = String::Format( "chars {0}, lines {1}", charactersFitted, linesFilled ); - e->Graphics->DrawString( outString, stringFont, Brushes::Black, PointF(100,0) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Int32) - // -public: - void MeasureStringWidth( PaintEventArgs^ e ) - { - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Set maximum width of string. - int stringWidth = 200; - - // Measure string. - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, stringWidth ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Int32,System.Drawing.StringFormat) - // -public: - void MeasureStringWidthFormat( PaintEventArgs^ e ) - { - // Set up string. - String^ measureString = "Measure String"; - System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); - - // Set maximum width of string. - int stringWidth = 100; - - // Set string format. - StringFormat^ newStringFormat = gcnew StringFormat; - newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; - - // Measure string. - SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, stringWidth, newStringFormat ); - - // Draw rectangle representing size of string. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); - - // Draw string to screen. - e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0), newStringFormat ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MultiplyTransform(System.Drawing.Drawing2D.Matrix) - // -public: - void MultiplyTransformMatrix( PaintEventArgs^ e ) - { - // Create transform matrix. - Matrix^ transformMatrix = gcnew Matrix; - - // Translate matrix, prepending translation vector. - transformMatrix->Translate( 200.0F, 100.0F ); - - // Rotate transformation matrix of graphics object, - // prepending rotation matrix. - e->Graphics->RotateTransform( 30.0F ); - - // Multiply (prepend to) transformation matrix of - // graphics object to translate graphics transformation. - e->Graphics->MultiplyTransform( transformMatrix ); - - // Draw rotated, translated ellipse. - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void MultiplyTransformMatrixOrder( PaintEventArgs^ e ) - { - // Create transform matrix. - Matrix^ transformMatrix = gcnew Matrix; - - // Translate matrix, prepending translation vector. - transformMatrix->Translate( 200.0F, 100.0F ); - - // Rotate transformation matrix of graphics object, - // prepending rotation matrix. - e->Graphics->RotateTransform( 30.0F ); - - // Multiply (append to) transformation matrix of - // graphics object to translate graphics transformation. - e->Graphics->MultiplyTransform( transformMatrix, MatrixOrder::Append ); - - // Draw rotated, translated ellipse. - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.ReleaseHdc(System.IntPtr) - // -private: - [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] - static bool Rectangle2( IntPtr hdc, int ulCornerX, int ulCornerY, int lrCornerX, int lrCornerY ); - -public: - void GetHdcForGDI2( PaintEventArgs^ e ) - { - // Create pen. - Pen^ redPen = gcnew Pen( Color::Red,1.0f ); - - // Draw rectangle with GDI+. - e->Graphics->DrawRectangle( redPen, 10, 10, 100, 50 ); - - // Get handle to device context. - IntPtr hdc = e->Graphics->GetHdc(); - - // Draw rectangle with GDI using default pen. - Rectangle2( hdc, 10, 70, 110, 120 ); - - // Release handle to device context. - e->Graphics->ReleaseHdc( hdc ); - } - // - // Snippet for: M:System.Drawing.Graphics.ResetClip - - // -public: - void IntersectClipRectangleF2( PaintEventArgs^ e ) - { - // Set clipping region. - Rectangle clipRect = Rectangle(0,0,200,200); - e->Graphics->SetClip( clipRect ); - - // Update clipping region to intersection of - // existing region with specified rectangle. - RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F); - e->Graphics->IntersectClip( intersectRectF ); - - // Fill rectangle to demonstrate effective clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); - - // Reset clipping region to infinite. - e->Graphics->ResetClip(); - - // Draw clipRect and intersectRect to screen. - e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) ); - } - // - - // Snippet for: M:System.Drawing.Graphics.ResetTransform - // -public: - void SaveRestore1( PaintEventArgs^ e ) - { - // Translate transformation matrix. - e->Graphics->TranslateTransform( 100, 0 ); - - // Save translated graphics state. - GraphicsState^ transState = e->Graphics->Save(); - - // Reset transformation matrix to identity and fill rectangle. - e->Graphics->ResetTransform(); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 ); - - // Restore graphics state to translated state and fill second - // rectangle. - e->Graphics->Restore( transState ); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.Restore(System.Drawing.Drawing2D.GraphicsState) - // -public: - void SaveRestore2( PaintEventArgs^ e ) - { - // Translate transformation matrix. - e->Graphics->TranslateTransform( 100, 0 ); - - // Save translated graphics state. - GraphicsState^ transState = e->Graphics->Save(); - - // Reset transformation matrix to identity and fill rectangle. - e->Graphics->ResetTransform(); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 ); - - // Restore graphics state to translated state and fill second - // rectangle. - e->Graphics->Restore( transState ); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.RotateTransform(System.Single) - // -public: - void RotateTransformAngle( PaintEventArgs^ e ) - { - // Set world transform of graphics object to translate. - e->Graphics->TranslateTransform( 100.0F, 0.0F ); - - // Then to rotate, prepending rotation matrix. - e->Graphics->RotateTransform( 30.0F ); - - // Draw rotated, translated ellipse to screen. - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void RotateTransformAngleMatrixOrder( PaintEventArgs^ e ) - { - // Set world transform of graphics object to translate. - e->Graphics->TranslateTransform( 100.0F, 0.0F ); - - // Then to rotate, appending rotation matrix. - e->Graphics->RotateTransform( 30.0F, MatrixOrder::Append ); - - // Draw translated, rotated ellipse to screen. - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.Save - // -public: - void SaveRestore3( PaintEventArgs^ e ) - { - // Translate transformation matrix. - e->Graphics->TranslateTransform( 100, 0 ); - - // Save translated graphics state. - GraphicsState^ transState = e->Graphics->Save(); - - // Reset transformation matrix to identity and fill rectangle. - e->Graphics->ResetTransform(); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 ); - - // Restore graphics state to translated state and fill second - // rectangle. - e->Graphics->Restore( transState ); - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.ScaleTransform(System.Single,System.Single) - // -public: - void ScaleTransformFloat( PaintEventArgs^ e ) - { - // Set world transform of graphics object to rotate. - e->Graphics->RotateTransform( 30.0F ); - - // Then to scale, prepending to world transform. - e->Graphics->ScaleTransform( 3.0F, 1.0F ); - - // Draw scaled, rotated rectangle to screen. - e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,3.0f ), 50, 0, 100, 40 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void ScaleTransformFloatMatrixOrder( PaintEventArgs^ e ) - { - // Set world transform of graphics object to rotate. - e->Graphics->RotateTransform( 30.0F ); - - // Then to scale, appending to world transform. - e->Graphics->ScaleTransform( 3.0F, 1.0F, MatrixOrder::Append ); - - // Draw rotated, scaled rectangle to screen. - e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,3.0f ), 50, 0, 100, 40 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Drawing2D.GraphicsPath) - // -public: - void SetClipPath( PaintEventArgs^ e ) - { - // Create graphics path. - GraphicsPath^ clipPath = gcnew GraphicsPath; - clipPath->AddEllipse( 0, 0, 200, 100 ); - - // Set clipping region to path. - e->Graphics->SetClip( clipPath ); - - // Fill rectangle to demonstrate clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Drawing2D.GraphicsPath,System.Drawing.Drawing2D.CombineMode) - // -public: - void SetClipPathCombine( PaintEventArgs^ e ) - { - // Create graphics path. - GraphicsPath^ clipPath = gcnew GraphicsPath; - clipPath->AddEllipse( 0, 0, 200, 100 ); - - // Set clipping region to path. - e->Graphics->SetClip( clipPath, CombineMode::Replace ); - - // Fill rectangle to demonstrate clipping region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Graphics) - // -public: - void SetClipGraphics( PaintEventArgs^ e ) - { - // Create temporary graphics object and set its clipping region. - Graphics^ newGraphics = this->CreateGraphics(); - newGraphics->SetClip( Rectangle(0,0,100,100) ); - - // Update clipping region of graphics to clipping region of new - // graphics. - e->Graphics->SetClip( newGraphics ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - - // Release new graphics. - delete newGraphics; - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Graphics,System.Drawing.Drawing2D.CombineMode) - // -public: - void SetClipGraphicsCombine( PaintEventArgs^ e ) - { - // Create temporary graphics object and set its clipping region. - Graphics^ newGraphics = this->CreateGraphics(); - newGraphics->SetClip( Rectangle(0,0,100,100) ); - - // Update clipping region of graphics to clipping region of new - // graphics. - e->Graphics->SetClip( newGraphics, CombineMode::Replace ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - - // Release new graphics. - delete newGraphics; - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Rectangle) - // -public: - void SetClipRectangle( PaintEventArgs^ e ) - { - // Create rectangle for clipping region. - Rectangle clipRect = Rectangle(0,0,100,100); - - // Set clipping region of graphics to rectangle. - e->Graphics->SetClip( clipRect ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Rectangle,System.Drawing.Drawing2D.CombineMode) - // -public: - void SetClipRectangleCombine( PaintEventArgs^ e ) - { - // Create rectangle for clipping region. - Rectangle clipRect = Rectangle(0,0,100,100); - - // Set clipping region of graphics to rectangle. - e->Graphics->SetClip( clipRect, CombineMode::Replace ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.RectangleF) - // -public: - void SetClipRectangleF( PaintEventArgs^ e ) - { - // Create rectangle for clipping region. - RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F); - - // Set clipping region of graphics to rectangle. - e->Graphics->SetClip( clipRect ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.RectangleF,System.Drawing.Drawing2D.CombineMode) - // -public: - void SetClipRectangleFCombine( PaintEventArgs^ e ) - { - // Create rectangle for clipping region. - RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F); - - // Set clipping region of graphics to rectangle. - e->Graphics->SetClip( clipRect, CombineMode::Replace ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Region,System.Drawing.Drawing2D.CombineMode) - // -public: - void SetClipRegionCombine( PaintEventArgs^ e ) - { - // Create region for clipping. - System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(0,0,100,100) ); - - // Set clipping region of graphics to region. - e->Graphics->SetClip( clipRegion, CombineMode::Replace ); - - // Fill rectangle to demonstrate clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.Point[]) - // -public: - void TransformPointsPoint( PaintEventArgs^ e ) - { - // Create array of two points. - array^ points = {Point(0,0),Point(100,50)}; - - // Draw line connecting two untransformed points. - e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] ); - - // Set world transformation of Graphics object to translate. - e->Graphics->TranslateTransform( 40, 30 ); - - // Transform points in array from world to page coordinates. - e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points ); - - // Reset world transformation. - e->Graphics->ResetTransform(); - - // Draw line that connects transformed points. - e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] ); - } - // - - // Snippet for: M:System.Drawing.Graphics.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.PointF[]) - // -public: - void TransformPointsPointF( PaintEventArgs^ e ) - { - // Create array of two points. - array^ points = {PointF(0.0F,0.0F),PointF(100.0F,50.0F)}; - - // Draw line connecting two untransformed points. - e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] ); - - // Set world transformation of Graphics object to translate. - e->Graphics->TranslateTransform( 40.0F, 30.0F ); - - // Transform points in array from world to page coordinates. - e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points ); - - // Reset world transformation. - e->Graphics->ResetTransform(); - - // Draw line that connects transformed points. - e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] ); - } - // - // Snippet for: M:System.Drawing.Graphics.TranslateClip(System.Int32,System.Int32) - - // -public: - void TranslateClipInt( PaintEventArgs^ e ) - { - // Create rectangle for clipping region. - Rectangle clipRect = Rectangle(0,0,100,100); - - // Set clipping region of graphics to rectangle. - e->Graphics->SetClip( clipRect ); - - // Translate clipping region. - int dx = 50; - int dy = 50; - e->Graphics->TranslateClip( dx, dy ); - - // Fill rectangle to demonstrate translated clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - // Snippet for: M:System.Drawing.Graphics.TranslateClip(System.Single,System.Single) - - // -public: - void TranslateClipFloat( PaintEventArgs^ e ) - { - // Create rectangle for clipping region. - RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F); - - // Set clipping region of graphics to rectangle. - e->Graphics->SetClip( clipRect ); - - // Translate clipping region. - float dx = 50.0F; - float dy = 50.0F; - e->Graphics->TranslateClip( dx, dy ); - - // Fill rectangle to demonstrate translated clip region. - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); - } - // - // Snippet for: M:System.Drawing.Graphics.TranslateTransform(System.Single,System.Single) - - // -public: - void TranslateTransformAngle( PaintEventArgs^ e ) - { - // Set world transform of graphics object to rotate. - e->Graphics->RotateTransform( 30.0F ); - - // Then to translate, prepending to world transform. - e->Graphics->TranslateTransform( 100.0F, 0.0F ); - - // Draw translated, rotated ellipse to screen. - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); - } - // - - // Snippet for: M:System.Drawing.Graphics.TranslateTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void TranslateTransformAngleMatrixOrder( PaintEventArgs^ e ) - { - // Set world transform of graphics object to rotate. - e->Graphics->RotateTransform( 30.0F ); - - // Then to translate, appending to world transform. - e->Graphics->TranslateTransform( 100.0F, 0.0F, MatrixOrder::Append ); - - // Draw rotated, translated ellipse to screen. - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp deleted file mode 100644 index d1b0d2404de..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -// Snippet for: M:System.Drawing.ImageAnimator. -// Animate(System.Drawing.Image,System.EventHandler) -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class AnimateImageForm : public Form -{ - - // Create a Bitmap Object. -private: - Bitmap^ animatedImage; -private: - bool currentlyAnimating; - -public: - AnimateImageForm() - { - try - { - animatedImage = gcnew Bitmap("SampleAnimation.gif"); - } - catch (ArgumentException^) - { - MessageBox::Show("Could not read the image file " + - "\"SampleAnimation.gif\",\n" + - "or it is not a valid image file."); - } - } - - // This method begins the animation. -public: - void AnimateImage() - { - // Begin the animation only once. - // Make sure to animate only if animatedImage was - // successfully initialised. - if (!currentlyAnimating && animatedImage != nullptr) - { - ImageAnimator::Animate(animatedImage, - gcnew EventHandler(this, &AnimateImageForm::OnFrameChanged)); - currentlyAnimating = true; - } - } - -private: - void OnFrameChanged(Object^ , EventArgs^ ) - { - // Force a call to the Paint event handler. - this->Invalidate(); - } - -protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - // Begin the animation. - AnimateImage(); - - // Get the next frame ready for rendering. - ImageAnimator::UpdateFrames(); - - if (animatedImage != nullptr) - { - // Draw the next frame in the animation. - e->Graphics->DrawImage(this->animatedImage, - Point(0, 0)); - } - } -}; - -[STAThread] -int main() -{ - Application::Run(gcnew AnimateImageForm()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp deleted file mode 100644 index 78442ccba68..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp +++ /dev/null @@ -1,300 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -public: - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetBrushRemapTable(System.Drawing.Imaging.ColorMap[]) - // - void SetBrushRemapTableExample( PaintEventArgs^ /*e*/ ) - { - // Create a color map. - array^myColorMap = gcnew array(1); - myColorMap[ 0 ] = gcnew ColorMap; - myColorMap[ 0 ]->OldColor = Color::Red; - myColorMap[ 0 ]->NewColor = Color::Green; - - // Create an ImageAttributes object, passing it to the myColorMap - // array. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetBrushRemapTable( myColorMap ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetColorKey(System.Drawing.Color,System.Drawing.Color,System.Drawing.Imaging.ColorAdjustType) - // -private: - void SetColorKeyExample( PaintEventArgs^ e ) - { - // Open an Image file and draw it to the screen. - Image^ myImage = Image::FromFile( "Circle.bmp" ); - e->Graphics->DrawImage( myImage, 20, 20 ); - - // Create an ImageAttributes object and set the color key. - Color lowerColor = Color::FromArgb( 245, 0, 0 ); - Color upperColor = Color::FromArgb( 255, 0, 0 ); - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetColorKey( lowerColor, upperColor, ColorAdjustType::Default ); - - // Draw the image with the color key set. - Rectangle rect = Rectangle(150,20,100,100); - e->Graphics->DrawImage( myImage, rect, 0, 0, 100, 100, GraphicsUnit::Pixel, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetColorMatrix(System.Drawing.Imaging.ColorMatrix) - // -private: - void SetColorMatrixExample( PaintEventArgs^ e ) - { - // Create a rectangle image with all colors set to 128 (medium - // gray). - Bitmap^ myBitmap = gcnew Bitmap( 50,50,PixelFormat::Format32bppArgb ); - Graphics^ g = Graphics::FromImage( myBitmap ); - g->FillRectangle( gcnew SolidBrush( Color::FromArgb( 255, 128, 128, 128 ) ), Rectangle(0,0,50,50) ); - myBitmap->Save( "Rectangle1.jpg" ); - - // Open an Image file and draw it to the screen. - Image^ myImage = Image::FromFile( "Rectangle1.jpg" ); - e->Graphics->DrawImage( myImage, 20, 20 ); - - // Initialize the color matrix. - ColorMatrix^ myColorMatrix = gcnew ColorMatrix; - - // Red - myColorMatrix->Matrix00 = 1.75f; - - // Green - myColorMatrix->Matrix11 = 1.00f; - - // Blue - myColorMatrix->Matrix22 = 1.00f; - - // alpha - myColorMatrix->Matrix33 = 1.00f; - - // w - myColorMatrix->Matrix44 = 1.00f; - - // Create an ImageAttributes object and set the color matrix. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetColorMatrix( myColorMatrix ); - - // Draw the image using the color matrix. - Rectangle rect = Rectangle(100,20,200,200); - e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetGamma(System.Single) - // -private: - void SetGammaExample( PaintEventArgs^ e ) - { - // Create an Image object from the file Camera.jpg, and draw it to - // the screen. - Image^ myImage = Image::FromFile( "Camera.jpg" ); - e->Graphics->DrawImage( myImage, 20, 20 ); - - // Create an ImageAttributes object and set the gamma to 2.2. - System::Drawing::Imaging::ImageAttributes^ imageAttr = - gcnew System::Drawing::Imaging::ImageAttributes; - imageAttr->SetGamma( 2.2f ); - - // Draw the image with gamma set to 2.2. - Rectangle rect = Rectangle(250,20,200,200); - e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetNoOp - // -private: - void SetNoOpExample( PaintEventArgs^ e ) - { - // Create an Image object from the file Camera.jpg. - Image^ myImage = Image::FromFile( "Camera.jpg" ); - - // Create an ImageAttributes object, and set the gamma to 0.25. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetGamma( 0.25f ); - - // Draw the image with gamma set to 0.25. - Rectangle rect1 = Rectangle(20,20,200,200); - e->Graphics->DrawImage( myImage, rect1, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); - - // Call the ImageAttributes NoOp method. - imageAttr->SetNoOp(); - - // Draw the image after NoOp is set, so the default gamma value - // of 1.0 will be used. - Rectangle rect2 = Rectangle(250,20,200,200); - e->Graphics->DrawImage( myImage, rect2, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetRemapTable(System.Drawing.Imaging.ColorMap[]) - // -private: - void SetRemapTableExample( PaintEventArgs^ e ) - { - // Create a filled, red image, and save it to Circle2.jpg. - Bitmap^ myBitmap = gcnew Bitmap( 50,50 ); - Graphics^ g = Graphics::FromImage( myBitmap ); - g->Clear( Color::White ); - g->FillEllipse( gcnew SolidBrush( Color::Red ), Rectangle(0,0,50,50) ); - myBitmap->Save( "Circle2.jpg" ); - - // Create an Image object from the Circle2.jpg file, and draw it to - // the screen. - Image^ myImage = Image::FromFile( "Circle2.jpg" ); - e->Graphics->DrawImage( myImage, 20, 20 ); - - // Create a color map. - array^myColorMap = gcnew array(1); - myColorMap[ 0 ] = gcnew ColorMap; - myColorMap[ 0 ]->OldColor = Color::Red; - myColorMap[ 0 ]->NewColor = Color::Green; - - // Create an ImageAttributes object, and then pass the - // myColorMap object to the SetRemapTable method. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetRemapTable( myColorMap ); - - // Draw the image with the remap table set. - Rectangle rect = Rectangle(150,20,50,50); - e->Graphics->DrawImage( myImage, rect, 0, 0, 50, 50, GraphicsUnit::Pixel, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetThreshold(System.Single) - // - void SetThresholdExample( PaintEventArgs^ e ) - { - // Open an Image file, and draw it to the screen. - Image^ myImage = Image::FromFile( "Camera.jpg" ); - e->Graphics->DrawImage( myImage, 20, 20 ); - - // Create an ImageAttributes object, and set its color threshold. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetThreshold( 0.7f ); - - // Draw the image with the colors bifurcated. - Rectangle rect = Rectangle(300,20,200,200); - e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); - } - // - - // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetWrapMode(System.Drawing.Drawing2D.WrapMode) - // - void SetWrapModeExample( PaintEventArgs^ e ) - { - // Create a filled, red circle, and save it to Circle3.jpg. - Bitmap^ myBitmap = gcnew Bitmap( 50,50 ); - Graphics^ g = Graphics::FromImage( myBitmap ); - g->Clear( Color::White ); - g->FillEllipse( gcnew SolidBrush( Color::Red ), Rectangle(0,0,25,25) ); - myBitmap->Save( "Circle3.jpg" ); - - // Create an Image object from the Circle3.jpg file, and draw it - // to the screen. - Image^ myImage = Image::FromFile( "Circle3.jpg" ); - e->Graphics->DrawImage( myImage, 20, 20 ); - - // Set the wrap mode. - ImageAttributes^ imageAttr = gcnew ImageAttributes; - imageAttr->SetWrapMode( WrapMode::Tile ); - - // Create a TextureBrush. - Rectangle brushRect = Rectangle(0,0,25,25); - TextureBrush^ myTBrush = gcnew TextureBrush( myImage,brushRect,imageAttr ); - - // Draw to the screen a rectangle filled with red circles. - e->Graphics->FillRectangle( myTBrush, 100, 20, 200, 200 ); - } - // - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -/* -This example of the - Decimal::ToInt64( Decimal ) and - Decimal::ToUInt64( Decimal ) -methods generates the following output. It -displays several converted Decimal values. - - Decimal argument __int64/exception unsigned __int64 - ---------------- ----------------- ---------------- - 123 123 123 - 123.000 123 123 - 123.999 123 123 - 18446744073709551615.999 OverflowException 18446744073709551615 - 18446744073709551616 OverflowException OverflowException - 9223372036854775807.999 9223372036854775807 9223372036854775807 - 9223372036854775808 OverflowException 9223372036854775808 - -0.999 0 0 - -1 -1 OverflowException - -9223372036854775808.999 -9223372036854775808 OverflowException - -9223372036854775809 OverflowException OverflowException -*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp deleted file mode 100644 index 75d653f425a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// Snippet for: F:System.Drawing.Imaging.Encoder.Compression -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); -int main() -{ - Bitmap^ myBitmap; - ImageCodecInfo^ myImageCodecInfo; - Encoder^ myEncoder; - EncoderParameter^ myEncoderParameter; - EncoderParameters^ myEncoderParameters; - - // Create a Bitmap object based on a BMP file. - myBitmap = gcnew Bitmap( "Shapes.bmp" ); - - // Get an ImageCodecInfo object that represents the TIFF codec. - myImageCodecInfo = GetEncoderInfo( "image/tiff" ); - - // Create an Encoder object based on the GUID - // for the Compression parameter category. - myEncoder = Encoder::Compression; - - // Create an EncoderParameters object. - // An EncoderParameters object has an array of EncoderParameter - // objects. In this case, there is only one - // EncoderParameter object in the array. - myEncoderParameters = gcnew EncoderParameters( 1 ); - - // Save the bitmap as a TIFF file with LZW compression. - myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::CompressionLZW ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - myBitmap->Save( "ShapesLZW.tif", myImageCodecInfo, myEncoderParameters ); -} - -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) -{ - int j; - array^encoders; - encoders = ImageCodecInfo::GetImageEncoders(); - for ( j = 0; j < encoders->Length; ++j ) - { - if ( encoders[ j ]->MimeType == mimeType ) - return encoders[ j ]; - - } - return nullptr; -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp deleted file mode 100644 index f78cf4ac684..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp +++ /dev/null @@ -1,55 +0,0 @@ - - -// Snippet for: F:System.Drawing.Imaging.Encoder.Transformation -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); -int main() -{ - Bitmap^ myBitmap; - ImageCodecInfo^ myImageCodecInfo; - Encoder^ myEncoder; - EncoderParameter^ myEncoderParameter; - EncoderParameters^ myEncoderParameters; - - // Create a Bitmap object based on a JPEG file. - myBitmap = gcnew Bitmap( "Shapes.jpg" ); - - // Get an ImageCodecInfo object that represents the JPEG codec. - myImageCodecInfo = GetEncoderInfo( "image/jpeg" ); - - // Create an Encoder object based on the GUID - // for the Transformation parameter category. - myEncoder = Encoder::Transformation; - - // Create an EncoderParameters object. - // An EncoderParameters object has an array of EncoderParameter - // objects. In this case, there is only one - // EncoderParameter object in the array. - myEncoderParameters = gcnew EncoderParameters( 1 ); - - // Rotate the image 90 degrees, and save it as a separate JPEG file. - myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::TransformRotate90 ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - myBitmap->Save( "ShapesR90.jpg", myImageCodecInfo, myEncoderParameters ); -} - -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) -{ - int j; - array^encoders; - encoders = ImageCodecInfo::GetImageEncoders(); - for ( j = 0; j < encoders->Length; ++j ) - { - if ( encoders[ j ]->MimeType == mimeType ) - return encoders[ j ]; - - } - return nullptr; -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp deleted file mode 100644 index 80c43b62d91..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp +++ /dev/null @@ -1,65 +0,0 @@ - - -// Snippet for: F:System.Drawing.Imaging.Encoder.Quality -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -static ImageCodecInfo^ GetEncoderInfo( ImageFormat^ format ); -int main() -{ - Bitmap^ myBitmap; - ImageCodecInfo^ myImageCodecInfo; - Encoder^ myEncoder; - EncoderParameter^ myEncoderParameter; - EncoderParameters^ myEncoderParameters; - - // Create a Bitmap object based on a BMP file. - myBitmap = gcnew Bitmap( "Shapes.bmp" ); - - // Get an ImageCodecInfo object that represents the JPEG codec. - myImageCodecInfo = GetEncoderInfo( ImageFormat->Jpeg ); - - // Create an Encoder object based on the GUID - // for the Quality parameter category. - myEncoder = Encoder::Quality; - - // Create an EncoderParameters object. - // An EncoderParameters object has an array of EncoderParameter - // objects. In this case, there is only one - // EncoderParameter object in the array. - myEncoderParameters = gcnew EncoderParameters( 1 ); - - // Save the bitmap as a JPEG file with quality level 25. - myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(25) ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - myBitmap->Save( "Shapes025.jpg", myImageCodecInfo, myEncoderParameters ); - - // Save the bitmap as a JPEG file with quality level 50. - myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(50) ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - myBitmap->Save( "Shapes050.jpg", myImageCodecInfo, myEncoderParameters ); - - // Save the bitmap as a JPEG file with quality level 75. - myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(75) ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - myBitmap->Save( "Shapes075.jpg", myImageCodecInfo, myEncoderParameters ); -} - -static ImageCodecInfo^ GetEncoderInfo( ImageFormat^ format ) -{ - int j; - array^encoders; - encoders = ImageCodecInfo::GetImageEncoders(); - for ( j = 0; j < encoders->Length; ++j ) - { - if ( encoders[ j ]->FormatID == format->Guid) - return encoders[ j ]; - - } - return nullptr; -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp deleted file mode 100644 index 53345a5cd61..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp +++ /dev/null @@ -1,273 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); - } - - // Snippet for: M:System.Drawing.Pen.Clone - // -public: - void Clone_Example( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ myPen = gcnew Pen( Color::Black,5.0f ); - - // Clone myPen. - Pen^ clonePen = dynamic_cast(myPen->Clone()); - - // Draw a line with clonePen. - e->Graphics->DrawLine( clonePen, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.MultiplyTransform(System.Drawing.Drawing2D.Matrix) - // -public: - void MultiplyTransform_Example1( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ myPen = gcnew Pen( Color::Black,5.0f ); - - // Create a translation matrix. - Matrix^ penMatrix = gcnew Matrix; - penMatrix->Scale( 3, 1 ); - - // Multiply the transformation matrix of myPen by transMatrix. - myPen->MultiplyTransform( penMatrix ); - - // Draw a line to the screen. - e->Graphics->DrawLine( myPen, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void MultiplyTransform_Example2( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ myPen = gcnew Pen( Color::Black,5.0f ); - - // Create a translation matrix. - Matrix^ penMatrix = gcnew Matrix; - penMatrix->Scale( 3, 1 ); - - // Multiply the transformation matrix of myPen by transMatrix. - myPen->MultiplyTransform( penMatrix, MatrixOrder::Prepend ); - - // Draw a line to the screen. - e->Graphics->DrawLine( myPen, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.ResetTransform - // -public: - void ResetTransform_Example( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ myPen = gcnew Pen( Color::Black,3.0f ); - - // Scale the transformation matrix of myPen. - myPen->ScaleTransform( 2, 1 ); - - // Draw a line with myPen. - e->Graphics->DrawLine( myPen, 10, 0, 10, 200 ); - - // Reset the transformation matrix of myPen to identity. - myPen->ResetTransform(); - - // Draw a second line with myPen. - e->Graphics->DrawLine( myPen, 100, 0, 100, 200 ); - } - // - - // Snippet for: M:System.Drawing.Pen.RotateTransform(System.Single) - // -public: - void RotateTransform_Example1( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ rotatePen = gcnew Pen( Color::Black,5.0f ); - - // Draw a rectangle with rotatePen. - e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 ); - - // Scale rotatePen by 2X in the x-direction. - rotatePen->ScaleTransform( 2, 1 ); - - // Rotate rotatePen 90 degrees clockwise. - rotatePen->RotateTransform( 90 ); - - // Draw a second rectangle with rotatePen. - e->Graphics->DrawRectangle( rotatePen, 140, 10, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void RotateTransform_Example2( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ rotatePen = gcnew Pen( Color::Black,5.0f ); - - // Scale rotatePen by 2X in the x-direction. - rotatePen->ScaleTransform( 2, 1 ); - - // Draw a rectangle with rotatePen. - e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 ); - - // Rotate rotatePen 90 degrees clockwise. - rotatePen->RotateTransform( 90, MatrixOrder::Append ); - - // Draw a second rectangle with rotatePen. - e->Graphics->DrawRectangle( rotatePen, 120, 10, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.ScaleTransform(System.Single,System.Single) - // -public: - void ScaleTransform_Example1( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ scalePen = gcnew Pen( Color::Black,5.0f ); - - // Draw a rectangle with scalePen. - e->Graphics->DrawRectangle( scalePen, 10, 10, 100, 100 ); - - // Scale scalePen by 2X in the x-direction. - scalePen->ScaleTransform( 2, 1 ); - - // Draw a second rectangle with rotatePen. - e->Graphics->DrawRectangle( scalePen, 120, 10, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void ScaleTransform_Example2( PaintEventArgs^ e ) - { - - // Create a Pen object. - Pen^ scalePen = gcnew Pen( Color::Black,5.0f ); - - // Draw a rectangle with scalePen. - e->Graphics->DrawRectangle( scalePen, 10, 10, 100, 100 ); - - // Scale scalePen by 2X in the x-direction. - scalePen->ScaleTransform( 2, 1, MatrixOrder::Prepend ); - - // Draw a second rectangle with rotatePen. - e->Graphics->DrawRectangle( scalePen, 120, 10, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Pen.SetLineCap(System.Drawing.Drawing2D.LineCap,System.Drawing.Drawing2D.LineCap,System.Drawing.Drawing2D.DashCap) - // -public: - void SetLineCap_Example( PaintEventArgs^ e ) - { - - // Create a Pen object with a dash pattern. - Pen^ capPen = gcnew Pen( Color::Black,5.0f ); - capPen->DashStyle = DashStyle::Dash; - - // Set the start and end caps for capPen. - capPen->SetLineCap( LineCap::ArrowAnchor, LineCap::Flat, DashCap::Flat ); - - // Draw a line with capPen. - e->Graphics->DrawLine( capPen, 10, 10, 200, 10 ); - } - // - -private: - void Form1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) - { - SetLineCap_Example( e ); - } -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp deleted file mode 100644 index d481bf21e14..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp +++ /dev/null @@ -1,133 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Rectangle.Inflate(System.Drawing.Rectangle,System.Int32,System.Int32) - // -public: - void RectangleInflateTest( PaintEventArgs^ e ) - { - // Create a rectangle. - Rectangle rect = Rectangle(100,100,50,50); - - // Draw the uninflated rectangle to screen. - e->Graphics->DrawRectangle( Pens::Black, rect ); - - // Call Inflate. - Rectangle rect2 = Rectangle::Inflate( rect, 50, 50 ); - - // Draw the inflated rectangle to screen. - e->Graphics->DrawRectangle( Pens::Red, rect2 ); - } - // - - // Snippet for: M:System.Drawing.Rectangle.Inflate(System.Drawing.Size) - // -public: - void RectangleInflateTest2( PaintEventArgs^ e ) - { - // Create a rectangle. - Rectangle rect = Rectangle(100,100,50,50); - - // Draw the uninflated rectangle to screen. - e->Graphics->DrawRectangle( Pens::Black, rect ); - - // Set up the inflate size. - System::Drawing::Size inflateSize = System::Drawing::Size( 50, 50 ); - - // Call Inflate. - rect.Inflate( inflateSize ); - - // Draw the inflated rectangle to screen. - e->Graphics->DrawRectangle( Pens::Red, rect ); - } - // - - // Snippet for: M:System.Drawing.Rectangle.Inflate(System.Int32,System.Int32) - // -public: - void RectangleInflateTest3( PaintEventArgs^ e ) - { - // Create a rectangle. - Rectangle rect = Rectangle(100,100,50,50); - - // Draw the uninflated rectangle to screen. - e->Graphics->DrawRectangle( Pens::Black, rect ); - - // Call Inflate. - rect.Inflate( 50, 50 ); - - // Draw the inflated rectangle to screen. - e->Graphics->DrawRectangle( Pens::Red, rect ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp deleted file mode 100644 index bf6dc06947a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp +++ /dev/null @@ -1,147 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.RectangleF.Inflate(System.Drawing.SizeF) - // -public: - void RectangleFInflateExample( PaintEventArgs^ e ) - { - // Create a RectangleF structure. - RectangleF myRectF = RectangleF(100,20,100,100); - - // Draw myRect to the screen. - Rectangle myRect = Rectangle::Truncate( myRectF ); - e->Graphics->DrawRectangle( Pens::Black, myRect ); - - // Create a Size structure. - SizeF inflateSize = SizeF(100,0); - - // Inflate myRect. - myRectF.Inflate( inflateSize ); - - // Draw the inflated rectangle to the screen. - myRect = Rectangle::Truncate( myRectF ); - e->Graphics->DrawRectangle( Pens::Red, myRect ); - } - // - - // Snippet for: M:System.Drawing.RectangleF.Intersect(System.Drawing.RectangleF,System.Drawing.RectangleF) - // -public: - void RectangleFIntersectExample( PaintEventArgs^ e ) - { - // Create two rectangles. - RectangleF firstRectangleF = RectangleF(0,0,75,50); - RectangleF secondRectangleF = RectangleF(50,20,50,50); - - // Convert the RectangleF structures to Rectangle structures and draw them to the - // screen. - Rectangle firstRect = Rectangle::Truncate( firstRectangleF ); - Rectangle secondRect = Rectangle::Truncate( secondRectangleF ); - e->Graphics->DrawRectangle( Pens::Black, firstRect ); - e->Graphics->DrawRectangle( Pens::Red, secondRect ); - - // Get the intersection. - RectangleF intersectRectangleF = RectangleF::Intersect( firstRectangleF, secondRectangleF ); - - // Draw the intersectRectangleF to the screen. - Rectangle intersectRect = Rectangle::Truncate( intersectRectangleF ); - e->Graphics->DrawRectangle( Pens::Blue, intersectRect ); - } - // - - // Snippet for: M:System.Drawing.RectangleF.Union(System.Drawing.RectangleF,System.Drawing.RectangleF) - // -public: - void RectangleFUnionExample( PaintEventArgs^ e ) - { - // Create two rectangles and draw them to the screen. - RectangleF firstRectangleF = RectangleF(0,0,75,50); - RectangleF secondRectangleF = RectangleF(100,100,20,20); - - // Convert the RectangleF structures to Rectangle structures and draw them to the - // screen. - Rectangle firstRect = Rectangle::Truncate( firstRectangleF ); - Rectangle secondRect = Rectangle::Truncate( secondRectangleF ); - e->Graphics->DrawRectangle( Pens::Black, firstRect ); - e->Graphics->DrawRectangle( Pens::Red, secondRect ); - - // Get the union rectangle. - RectangleF unionRectangleF = RectangleF::Union( firstRectangleF, secondRectangleF ); - - // Draw the unionRectangleF to the screen. - Rectangle unionRect = Rectangle::Truncate( unionRectangleF ); - e->Graphics->DrawRectangle( Pens::Blue, unionRect ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp deleted file mode 100644 index d356d1122f2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp +++ /dev/null @@ -1,401 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Drawing::Drawing2D; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - - // Snippet for: M:System.Drawing.Region.Complement(System.Drawing.Drawing2D.GraphicsPath) - // -public: - void Complement_Path_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // Create the second rectangle and draw it to the screen in red. - Rectangle complementRect = Rectangle(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, complementRect ); - - // Create a graphics path and add the second rectangle to it. - GraphicsPath^ complementPath = gcnew GraphicsPath; - complementPath->AddRectangle( complementRect ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the complement of myRegion when combined with - // complementPath. - myRegion->Complement( complementPath ); - - // Fill the complement area with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.Complement(System.Drawing.RectangleF) - // -public: - void Complement_RectF_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // Create the second rectangle and draw it to the screen in red. - RectangleF complementRect = RectangleF(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the complement of the region combined with the second - // rectangle. - myRegion->Complement( complementRect ); - - // Fill the complement area with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.Complement(System.Drawing.Region) - // -public: - void Complement_Region_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // Create the second rectangle and draw it to the screen in red. - Rectangle complementRect = Rectangle(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, complementRect ); - - // Create a region from the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Create a complement region. - System::Drawing::Region^ complementRegion = gcnew System::Drawing::Region( complementRect ); - - // Get the complement of myRegion when combined with - // complementRegion. - myRegion->Complement( complementRegion ); - - // Fill the complement area with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.Exclude(System.Drawing.RectangleF) - // -public: - void Exclude_RectF_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // Create the second rectangle and draw it to the screen in red. - RectangleF complementRect = RectangleF(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the nonexcluded area of myRegion when combined with - // complementRect. - myRegion->Exclude( complementRect ); - - // Fill the nonexcluded area of myRegion with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.GetBounds(System.Drawing.Graphics) - // -public: - void GetBoundsExample( PaintEventArgs^ e ) - { - // Create a GraphicsPath and add an ellipse to it. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle ellipseRect = Rectangle(20,20,100,100); - myPath->AddEllipse( ellipseRect ); - - // Fill the path with blue and draw it to the screen. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillPath( myBrush, myPath ); - - // Create a region using the GraphicsPath. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( myPath ); - - // Get the bounding rectangle for myRegion and draw it to the - // screen in Red. - RectangleF boundsRect = myRegion->GetBounds( e->Graphics ); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( boundsRect ) ); - } - // - - // Snippet for: M:System.Drawing.Region.GetRegionData - // -public: - void GetRegionDataExample( PaintEventArgs^ e ) - { - // Create a rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the RegionData for this region. - RegionData^ myRegionData = myRegion->GetRegionData(); - int myRegionDataLength = myRegionData->Data->Length; - DisplayRegionData( e, myRegionDataLength, myRegionData ); - } - - // THIS IS A HELPER FUNCTION FOR GetRegionData. - void DisplayRegionData( PaintEventArgs^ e, int len, RegionData^ dat ) - { - // Display the result. - int i; - float x = 20,y = 140; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - e->Graphics->DrawString( "myRegionData = ", myFont, myBrush, PointF(x,y) ); - y = 160; - for ( i = 0; i < len; i++ ) - { - if ( x > 300 ) - { - y += 20; - x = 20; - } - e->Graphics->DrawString( dat->Data[ i ].ToString(), myFont, myBrush, PointF(x,y) ); - x += 30; - } - } - // - - // Snippet for: M:System.Drawing.Region.Intersect(System.Drawing.RectangleF) - // -public: - void Intersect_RectF_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // create the second rectangle and draw it to the screen in red. - RectangleF complementRect = RectangleF(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the area of intersection for myRegion when combined with - // complementRect. - myRegion->Intersect( complementRect ); - - // Fill the intersection area of myRegion with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.IsVisible(System.Drawing.RectangleF) - // -public: - void IsVisible_RectF_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in blue. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Blue, regionRect ); - - // Create the second rectangle and draw it to the screen in red. - RectangleF myRect = RectangleF(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( myRect ) ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Determine if myRect is contained in the region. - bool contained = myRegion->IsVisible( myRect ); - - // Display the result. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - e->Graphics->DrawString( String::Format( "contained = {0}", contained ), myFont, myBrush, PointF(20,140) ); - } - // - - // Snippet for: M:System.Drawing.Region.Transform(System.Drawing.Drawing2D.Matrix) - // -public: - void TransformExample( PaintEventArgs^ e ) - { - - // Create the first rectangle and draw it to the screen in blue. - Rectangle regionRect = Rectangle(100,50,100,100); - e->Graphics->DrawRectangle( Pens::Blue, regionRect ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Create a transform matrix and set it to have a 45 degree - // rotation. - Matrix^ transformMatrix = gcnew Matrix; - transformMatrix->RotateAt( 45, Point(100,50) ); - - // Apply the transform to the region. - myRegion->Transform(transformMatrix); - - // Fill the transformed region with red and draw it to the screen - // in red. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Red ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.Translate(System.Int32,System.Int32) - // - void TranslateExample( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in blue. - Rectangle regionRect = Rectangle(100,50,100,100); - e->Graphics->DrawRectangle( Pens::Blue, regionRect ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Apply the translation to the region. - myRegion->Translate( 150, 100 ); - - // Fill the transformed region with red and draw it to the screen in red. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Red ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.Union(System.Drawing.RectangleF) - // - void Union_RectF_Example( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // create the second rectangle and draw it to the screen in red. - RectangleF unionRect = RectangleF(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( unionRect ) ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the area of union for myRegion when combined with - // complementRect. - myRegion->Union( unionRect ); - - // Fill the union area of myRegion with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // - - // Snippet for: M:System.Drawing.Region.Xor(System.Drawing.RectangleF) - // - void XorExample( PaintEventArgs^ e ) - { - // Create the first rectangle and draw it to the screen in black. - Rectangle regionRect = Rectangle(20,20,100,100); - e->Graphics->DrawRectangle( Pens::Black, regionRect ); - - // create the second rectangle and draw it to the screen in red. - RectangleF xorRect = RectangleF(90,30,100,100); - e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( xorRect ) ); - - // Create a region using the first rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); - - // Get the area of overlap for myRegion when combined with - // complementRect. - myRegion->Xor( xorRect ); - - // Fill the Xor area of myRegion with blue. - SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); - e->Graphics->FillRegion( myBrush, myRegion ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp deleted file mode 100644 index c60e2ace631..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp +++ /dev/null @@ -1,273 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.StringFormat.GetTabStops(System.Single@) - // -public: - void GetSetTabStopsExample1( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Tools used for drawing, painting. - Pen^ redPen = gcnew Pen( Color::FromArgb( 255, 255, 0, 0 ) ); - SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); - - // Layout and format for text. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New Roman",12 ); - StringFormat^ myStringFormat = gcnew StringFormat; - Rectangle enclosingRectangle = Rectangle(20,20,500,100); - array^tabStops = {150.0f,100.0f,100.0f}; - - // Text with tabbed columns. - String^ myString = "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo\tThree"; - - // Set the tab stops, paint the text specified by myString, and draw the - // rectangle that encloses the text. - myStringFormat->SetTabStops( 0.0f, tabStops ); - g->DrawString( myString, myFont, blueBrush, enclosingRectangle, myStringFormat ); - g->DrawRectangle( redPen, enclosingRectangle ); - - // Get the tab stops. - float firstTabOffset; - array^tabStopsObtained = myStringFormat->GetTabStops( firstTabOffset ); - for ( int j = 0; j < tabStopsObtained->Length; j++ ) - { - // Inspect or use the value in tabStopsObtained[j]. - Console::WriteLine( "\n Tab stop {0} = {1}", j, tabStopsObtained[ j ] ); - } - } - // - - // Snippet for: M:System.Drawing.StringFormat.SetDigitSubstitution(System.Int32,System.Drawing.StringDigitSubstitute) - // -public: - void SetDigitSubExample( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Courier New",12 ); - StringFormat^ myStringFormat = gcnew StringFormat; - String^ myString = "0 1 2 3 4 5 6 7 8 9"; - - // Arabic (0x0C01) digits. - // Use National substitution method. - myStringFormat->SetDigitSubstitution( 0x0C01, StringDigitSubstitute::National ); - g->DrawString( String::Format( "Arabic:\nMethod of substitution = National: {0}", myString ), myFont, blueBrush, PointF(10.0f,20.0f), myStringFormat ); - - // Use Traditional substitution method. - myStringFormat->SetDigitSubstitution( 0x0C01, StringDigitSubstitute::Traditional ); - g->DrawString( String::Format( "Method of substitution = Traditional: {0}", myString ), myFont, blueBrush, PointF(10.0f,55.0f), myStringFormat ); - - // Thai (0x041E) digits. - // Use National substitution method. - myStringFormat->SetDigitSubstitution( 0x041E, StringDigitSubstitute::National ); - g->DrawString( String::Format( "Thai:\nMethod of substitution = National: {0}", myString ), myFont, blueBrush, PointF(10.0f,85.0f), myStringFormat ); - - // Use Traditional substitution method. - myStringFormat->SetDigitSubstitution( 0x041E, StringDigitSubstitute::Traditional ); - g->DrawString( String::Format( "Method of substitution = Traditional: {0}", myString ), myFont, blueBrush, PointF(10.0f,120.0f), myStringFormat ); - } - // - - // Snippet for: M:System.Drawing.StringFormat.SetMeasurableCharacterRanges(System.Drawing.CharacterRange[]) - // - void SetMeasCharRangesExample( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - SolidBrush^ redBrush = gcnew SolidBrush( Color::FromArgb( 50, 255, 0, 0 ) ); - - // Layout rectangles, font, and string format used for displaying string. - Rectangle layoutRectA = Rectangle(20,20,165,80); - Rectangle layoutRectB = Rectangle(20,110,165,80); - Rectangle layoutRectC = Rectangle(20,200,240,80); - System::Drawing::Font^ tnrFont = gcnew System::Drawing::Font( "Times New Roman",16 ); - StringFormat^ strFormat = gcnew StringFormat; - - // Ranges of character positions within a string. - array^ charRanges = {CharacterRange(3,5),CharacterRange(15,2),CharacterRange(30,15)}; - - // Each region specifies the area occupied by the characters within a - // range of positions. the values are obtained by using a method that - // measures the character ranges. - array^charRegions = gcnew array(charRanges->Length); - - // String to be displayed. - String^ str = "The quick, brown fox easily jumps over the lazy dog."; - - // Set the char ranges for the string format. - strFormat->SetMeasurableCharacterRanges( charRanges ); - - // loop counter (unsigned 8-bit integer) - Byte i; - - // Measure the char ranges for a given string and layout rectangle. Each - // area occupied by the characters in a range is stored as a region. Then - // draw the string and layout rectangle, and paint the regions. - charRegions = g->MeasureCharacterRanges( str, tnrFont, layoutRectA, strFormat ); - g->DrawString( str, tnrFont, Brushes::Blue, layoutRectA, strFormat ); - g->DrawRectangle( Pens::Black, layoutRectA ); - - // Paint the regions. - for ( i = 0; i < charRegions->Length; i++ ) - g->FillRegion( redBrush, charRegions[ i ] ); - - // Repeat the above steps, but include trailing spaces in the char - // range measurement by setting the appropriate string format flag. - strFormat->FormatFlags = StringFormatFlags::MeasureTrailingSpaces; - charRegions = g->MeasureCharacterRanges( str, tnrFont, layoutRectB, strFormat ); - g->DrawString( str, tnrFont, Brushes::Blue, layoutRectB, strFormat ); - g->DrawRectangle( Pens::Black, layoutRectB ); - for ( i = 0; i < charRegions->Length; i++ ) - g->FillRegion( redBrush, charRegions[ i ] ); - - // Clear all the format flags. - strFormat->FormatFlags = StringFormatFlags(0); - - // Repeat the steps, but use a different layout rectangle. the dimensions - // of the layout rectangle and the size of the font both affect the - // character range measurement. - charRegions = g->MeasureCharacterRanges( str, tnrFont, layoutRectC, strFormat ); - g->DrawString( str, tnrFont, Brushes::Blue, layoutRectC, strFormat ); - g->DrawRectangle( Pens::Black, layoutRectC ); - - // Paint the regions. - for ( i = 0; i < charRegions->Length; i++ ) - g->FillRegion( redBrush, charRegions[ i ] ); - } - // - - // Snippet for: M:System.Drawing.StringFormat.SetTabStops(System.Single,System.Single[]) - // - void GetSetTabStopsExample2( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - - // Tools used for drawing, painting. - Pen^ redPen = gcnew Pen( Color::FromArgb( 255, 255, 0, 0 ) ); - SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); - - // Layout and format for text. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New Roman",12 ); - StringFormat^ myStringFormat = gcnew StringFormat; - Rectangle enclosingRectangle = Rectangle(20,20,500,100); - array^tabStops = {150.0f,100.0f,100.0f}; - - // Text with tabbed columns. - String^ myString = "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo\tThree"; - - // Set the tab stops, paint the text specified by myString, draw the - // rectangle that encloses the text. - myStringFormat->SetTabStops( 0.0f, tabStops ); - g->DrawString( myString, myFont, blueBrush, enclosingRectangle, myStringFormat ); - g->DrawRectangle( redPen, enclosingRectangle ); - - // Get the tab stops. - float firstTabOffset; - array^tabStopsObtained = myStringFormat->GetTabStops( firstTabOffset ); - for ( int j = 0; j < tabStopsObtained->Length; j++ ) - { - // Inspect or use the value in tabStopsObtained[j]. - Console::WriteLine( "\n Tab stop {0} = {1}", j, tabStopsObtained[ j ] ); - } - } - // - - // Snippet for: M:System.Drawing.StringFormat.ToString - // - void ToStringExample( PaintEventArgs^ e ) - { - Graphics^ g = e->Graphics; - SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New Roman",14 ); - StringFormat^ myStringFormat = gcnew StringFormat; - - // String variable to hold the values of the StringFormat object. - String^ strFmtString; - - // Convert the string format object to a string (only certain information - // in the object is converted) and display the string. - strFmtString = myStringFormat->ToString(); - g->DrawString( String::Format( "Before changing properties: {0}", myStringFormat ), myFont, blueBrush, 20, 40 ); - - // Change some properties of the string format - myStringFormat->Trimming = StringTrimming::None; - myStringFormat->FormatFlags = (StringFormatFlags)(StringFormatFlags::NoWrap | StringFormatFlags::NoClip); - - // Convert the string format object to a string and display the string. - // The string will be different because the properties of the string - // format have changed. - strFmtString = myStringFormat->ToString(); - g->DrawString( String::Format( "After changing properties: {0}", myStringFormat ), myFont, blueBrush, 20, 70 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp deleted file mode 100644 index 357b3878973..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp +++ /dev/null @@ -1,240 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.TextureBrush.Clone - // -public: - void Clone_Example( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Create an exact copy of tBrush. - TextureBrush^ cloneBrush = dynamic_cast(tBrush->Clone()); - - // Fill a rectangle with cloneBrush. - e->Graphics->FillRectangle( cloneBrush, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix) - // -public: - void MultiplyTransform_Example1( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Create a transformation matrix. - Matrix^ translateMatrix = gcnew Matrix; - translateMatrix->Translate( 50, 0 ); - - // Multiply the transformation matrix of tBrush by translateMatrix. - tBrush->MultiplyTransform( translateMatrix, MatrixOrder::Prepend ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) - // - void MultiplyTransform_Example2( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Create a transformation matrix. - Matrix^ translateMatrix = gcnew Matrix; - translateMatrix->Translate( 50, 0 ); - - // Multiply the transformation matrix of tBrush by translateMatrix. - tBrush->MultiplyTransform( translateMatrix ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.ResetTransform - // - void ResetTransform_Example( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Rotate the texture image by 90 degrees. - tBrush->RotateTransform( 90 ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - - // Reset transformation matrix to identity. - tBrush->ResetTransform(); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.RotateTransform(System.Single) - // - void RotateTransform_Example1( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Rotate the texture image by 90 degrees. - tBrush->RotateTransform( 90 ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) - // - void RotateTransform_Example2( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Rotate the texture image by 90 degrees. - tBrush->RotateTransform( 90, MatrixOrder::Prepend ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.ScaleTransform(System.Single,System.Single) - // - void ScaleTransform_Example1( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Scale the texture image 2X in the x-direction. - tBrush->ScaleTransform( 2, 1 ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // - void ScaleTransform_Example2( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Scale the texture image 2X in the x-direction. - tBrush->ScaleTransform( 2, 1, MatrixOrder::Prepend ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.TranslateTransform(System.Single,System.Single) - // - void TranslateTransform_Example1( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Move the texture image 2X in the x-direction. - tBrush->TranslateTransform( 50, 0, MatrixOrder::Prepend ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.TextureBrush.TranslateTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // - void TranslateTransform_Example2( PaintEventArgs^ e ) - { - // Create a TextureBrush object. - TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); - - // Move the texture image 2X in the x-direction. - tBrush->TranslateTransform( 50, 0 ); - - // Fill a rectangle with tBrush. - e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp deleted file mode 100644 index 4a1a9b3be97..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp +++ /dev/null @@ -1,74 +0,0 @@ - - -// Snippet for: F:System.Drawing.Imaging.Encoder.SaveFlag -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); -int main() -{ - Bitmap^ multi; - Bitmap^ page2; - Bitmap^ page3; - ImageCodecInfo^ myImageCodecInfo; - Encoder^ myEncoder; - EncoderParameter^ myEncoderParameter; - EncoderParameters^ myEncoderParameters; - - // Create three Bitmap objects. - multi = gcnew Bitmap( "Shapes.bmp" ); - page2 = gcnew Bitmap( "Iron.jpg" ); - page3 = gcnew Bitmap( "House.png" ); - - // Get an ImageCodecInfo object that represents the TIFF codec. - myImageCodecInfo = GetEncoderInfo( "image/tiff" ); - - // Create an Encoder object based on the GUID - // for the SaveFlag parameter category. - myEncoder = Encoder::SaveFlag; - - // Create an EncoderParameters object. - // An EncoderParameters object has an array of EncoderParameter - // objects. In this case, there is only one - // EncoderParameter object in the array. - myEncoderParameters = gcnew EncoderParameters( 1 ); - - // Save the first page (frame). - myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::MultiFrame ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - multi->Save( "Multiframe.tiff", myImageCodecInfo, myEncoderParameters ); - - // Save the second page (frame). - myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::FrameDimensionPage ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - multi->SaveAdd( page2, myEncoderParameters ); - - // Save the third page (frame). - myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::FrameDimensionPage ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - multi->SaveAdd( page3, myEncoderParameters ); - - // Close the multiple-frame file. - myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::Flush ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - multi->SaveAdd( myEncoderParameters ); -} - -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) -{ - int j; - array^encoders; - encoders = ImageCodecInfo::GetImageEncoders(); - for ( j = 0; j < encoders->Length; ++j ) - { - if ( encoders[ j ]->MimeType == mimeType ) - return encoders[ j ]; - - } - return nullptr; -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp deleted file mode 100644 index b47481a2b92..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp +++ /dev/null @@ -1,122 +0,0 @@ -#using -#using -#using - -using namespace System::Drawing; -using namespace System; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - //Form overrides dispose to clean up the component list. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); - } - - // The following code example demonstrates how to use the - // PointConverter.ConvertFromString and the Point.op_Subtraction - // methods. This example is designed to be used with Windows - // Forms. Paste this code into a form and call the - // ShowPointConverter method when handling the form's Paint - // event, passing e as PaintEventArgs. - // - void ShowPointConverter( PaintEventArgs^ e ) - { - // Create the PointConverter. - System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( Point::typeid ); - Point point1 = *dynamic_cast(converter->ConvertFromString( "200, 200" )); - - // Use the subtraction operator to get a second point. - Point point2 = point1 - System::Drawing::Size( 190, 190 ); - - // Draw a line between the two points. - e->Graphics->DrawLine( Pens::Black, point1, point2 ); - } - // - - // The following code example demonstrates how to use the - // ColorConverter.ConvertToString method. This example - // is designed to be used with Windows Forms. Paste this code - // into a form and call the ShowColorConverter method when - // handling the form's Paint event, passing e as PaintEventArgs. - // - void ShowColorConverter( PaintEventArgs^ e ) - { - Color myColor = Color::PaleVioletRed; - - // Create the ColorConverter. - System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( myColor ); - String^ colorAsString = converter->ConvertToString( Color::PaleVioletRed ); - e->Graphics->DrawString( colorAsString, this->Font, Brushes::PaleVioletRed, 50.0F, 50.0F ); - } - // - - // The following code example demonstrates how to use the - // ConvertToInvariantString and ConvertToString methods. - // This example is designed to be used with Windows Forms. - // Paste this code into a form and call the ShowFontStringConversion - // method when handling the form's Paint event, passing e - // as PaintEventArgs. - // - void ShowFontStringConversion( PaintEventArgs^ e ) - { - // Create the FontConverter. - System::ComponentModel::TypeConverter^ converter = - System::ComponentModel::TypeDescriptor::GetConverter( System::Drawing::Font::typeid ); - System::Drawing::Font^ font1 = dynamic_cast(converter->ConvertFromString( "Arial, 12pt" )); - String^ fontName1 = converter->ConvertToInvariantString( font1 ); - String^ fontName2 = converter->ConvertToString( font1 ); - e->Graphics->DrawString( fontName1, font1, Brushes::Red, 10, 10 ); - e->Graphics->DrawString( fontName2, font1, Brushes::Blue, 10, 30 ); - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - ShowFontStringConversion( e ); - ShowPointConverter( e ); - ShowColorConverter( e ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp deleted file mode 100644 index 022de159c08..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp +++ /dev/null @@ -1,753 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddArc(System.Drawing.Rectangle,System.Single,System.Single) - // -private: - void AddArcExample( PaintEventArgs^ e ) - { - // Create a GraphicsPath object. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // Set up and call AddArc, and close the figure. - Rectangle rect = Rectangle(20,20,50,100); - myPath->StartFigure(); - myPath->AddArc( rect, 0, 180 ); - myPath->CloseFigure(); - - // Draw the path to screen. - e->Graphics->DrawPath( gcnew Pen( Color::Red,3.0f ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddBezier(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) - // -private: - void AddBezierExample( PaintEventArgs^ e ) - { - // Create a new Path. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // Call AddBezier. - myPath->StartFigure(); - myPath->AddBezier( 50, 50, 70, 0, 100, 120, 150, 50 ); - - // Close the curve. - myPath->CloseFigure(); - - // Draw the path to screen. - e->Graphics->DrawPath( gcnew Pen( Color::Red,2.0f ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddBeziers(System.Drawing.Point[]) - // -private: - void AddBeziersExample( PaintEventArgs^ e ) - { - // Adds two Bezier curves. - array^ myArray = {Point(20,100),Point(40,75),Point(60,125),Point(80,100),Point(100,50),Point(120,150),Point(140,100)}; - - // Create the path and add the curves. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddBeziers( myArray ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddClosedCurve(System.Drawing.Point[],System.Single) - // -private: - void AddClosedCurveExample( PaintEventArgs^ e ) - { - // Creates a symetrical, closed curve. - array^ myArray = {Point(20,100),Point(40,150),Point(60,125),Point(40,100),Point(60,75),Point(40,50)}; - - // Create a new path and add curve. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddClosedCurve( myArray, .5f ); - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - - // Draw the path to screen. - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddCurve(System.Drawing.Point[],System.Int32,System.Int32,System.Single) - // -private: - void AddCurveExample( PaintEventArgs^ e ) - { - // Create some points. - Point point1 = Point(20,20); - Point point2 = Point(40,0); - Point point3 = Point(60,40); - Point point4 = Point(80,20); - - // Create an array of the points. - array^ curvePoints = {point1,point2,point3,point4}; - - // Create a GraphicsPath object and add a curve. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddCurve( curvePoints, 0, 3, 0.8f ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddEllipse(System.Drawing.Rectangle) - // -private: - void AddEllipseExample( PaintEventArgs^ e ) - { - // Create a path and add an ellipse. - Rectangle myEllipse = Rectangle(20,20,100,50); - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddEllipse( myEllipse ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddLine(System.Int32,System.Int32,System.Int32,System.Int32) - // -private: - void AddLineExample( PaintEventArgs^ e ) - { - //Create a path and add a symetrical triangle using AddLine. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLine( 30, 30, 60, 60 ); - myPath->AddLine( 60, 60, 0, 60 ); - myPath->AddLine( 0, 60, 30, 30 ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddLines(System.Drawing.Point[]) - // -private: - void AddLinesExample( PaintEventArgs^ e ) - { - // Create a symetrical triangle using an array of points. - array^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)}; - - //Create a path and add lines. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLines( myArray ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddPath(System.Drawing.Drawing2D.GraphicsPath,System.Boolean) - // -private: - void AddPathExample( PaintEventArgs^ e ) - { - // Create the first pathright side up triangle. - array^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)}; - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLines( myArray ); - - // Create the second pathinverted triangle. - array^ myArray2 = {Point(30,30),Point(0,0),Point(60,0),Point(30,30)}; - GraphicsPath^ myPath2 = gcnew GraphicsPath; - myPath2->AddLines( myArray2 ); - - // Add the second path to the first path. - myPath->AddPath( myPath2, true ); - - // Draw the combined path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddPie(System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Single) - // -private: - void AddPieExample( PaintEventArgs^ e ) - { - // Create a pie slice of a circle using the AddPie method. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddPie( 20, 20, 70, 70, -45, 90 ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddPolygon(System.Drawing.Point[]) - // -private: - void AddPolygonExample( PaintEventArgs^ e ) - { - // Create an array of points. - array^ myArray = {Point(23,20),Point(40,10),Point(57,20),Point(50,40),Point(30,40)}; - - // Create a GraphicsPath object and add a polygon. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddPolygon( myArray ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddRectangle(System.Drawing.Rectangle) - // -private: - void AddRectangleExample( PaintEventArgs^ e ) - { - // Create a GraphicsPath object and add a rectangle to it. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle pathRect = Rectangle(20,20,100,200); - myPath->AddRectangle( pathRect ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddRectangles(System.Drawing.Rectangle[]) - // -private: - void AddRectanglesExample( PaintEventArgs^ e ) - { - // Adds a pattern of rectangles to a GraphicsPath object. - GraphicsPath^ myPath = gcnew GraphicsPath; - array^ pathRects = {Rectangle(20,20,100,200),Rectangle(40,40,120,220),Rectangle(60,60,240,140)}; - myPath->AddRectangles( pathRects ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddString(System.String,System.Drawing.FontFamily,System.Int32,System.Single,System.Drawing.Point,System.Drawing.StringFormat) - // -private: - void AddStringExample( PaintEventArgs^ e ) - { - // Create a GraphicsPath object. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // Set up all the string parameters. - String^ stringText = "Sample Text"; - FontFamily^ family = gcnew FontFamily( "Arial" ); - int fontStyle = (int)FontStyle::Italic; - int emSize = 26; - Point origin = Point(20,20); - StringFormat^ format = StringFormat::GenericDefault; - - // Add the string to the path. - myPath->AddString( stringText, family, fontStyle, (float)emSize, origin, format ); - - //Draw the path to the screen. - e->Graphics->FillPath( Brushes::Black, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.ClearMarkers - // -private: - void ClearMarkersExample( PaintEventArgs^ e ) - { - // Set several markers in a path. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddEllipse( 0, 0, 100, 200 ); - myPath->SetMarkers(); - myPath->AddLine( Point(100,100), Point(200,100) ); - Rectangle rect = Rectangle(200,0,100,200); - myPath->AddRectangle( rect ); - myPath->SetMarkers(); - myPath->AddLine( Point(250,200), Point(250,300) ); - myPath->SetMarkers(); - - // Clear the markers. - myPath->ClearMarkers(); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Clone - // -private: - void CloneExample( PaintEventArgs^ e ) - { - // Set several markers in a path. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddEllipse( 0, 0, 100, 200 ); - myPath->AddLine( Point(100,100), Point(200,100) ); - Rectangle rect = Rectangle(200,0,100,200); - myPath->AddRectangle( rect ); - myPath->AddLine( Point(250,200), Point(250,300) ); - - // Draw the path to the screen. - Pen^ myPen = gcnew Pen( Color::Black,2.0f ); - e->Graphics->DrawPath( myPen, myPath ); - - // Clone a copy of myPath. - GraphicsPath^ myPath2 = dynamic_cast(myPath->Clone()); - - // Draw the path to the screen. - Pen^ myPen2 = gcnew Pen( Color::Red,4.0f ); - e->Graphics->DrawPath( myPen2, myPath2 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.CloseAllFigures - // -private: - void CloseAllFiguresExample( PaintEventArgs^ e ) - { - // Create a path containing several open-ended figures. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->StartFigure(); - myPath->AddLine( Point(10,10), Point(150,10) ); - myPath->AddLine( Point(150,10), Point(10,150) ); - myPath->StartFigure(); - myPath->AddArc( 200, 200, 100, 100, 0, 90 ); - myPath->StartFigure(); - Point point1 = Point(300,300); - Point point2 = Point(400,325); - Point point3 = Point(400,375); - Point point4 = Point(300,400); - array^ points = {point1,point2,point3,point4}; - myPath->AddCurve( points ); - - // Close all the figures. - myPath->CloseAllFigures(); - - // Draw the path to the screen. - e->Graphics->DrawPath( gcnew Pen( Color::Black,3.0f ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.CloseFigure - // -private: - void CloseFigureExample( PaintEventArgs^ e ) - { - // Create a path consisting of two, open-ended lines and close - // the lines using CloseFigure. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->StartFigure(); - myPath->AddLine( Point(10,10), Point(200,10) ); - myPath->AddLine( Point(200,10), Point(200,200) ); - myPath->CloseFigure(); - - // Draw the path to the screen. - e->Graphics->DrawPath( Pens::Black, myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Flatten(System.Drawing.Drawing2D.Matrix,System.Single) - // -private: - void FlattenExample( PaintEventArgs^ e ) - { - GraphicsPath^ myPath = gcnew GraphicsPath; - Matrix^ translateMatrix = gcnew Matrix; - translateMatrix->Translate( 0, 10 ); - Point point1 = Point(20,100); - Point point2 = Point(70,10); - Point point3 = Point(130,200); - Point point4 = Point(180,100); - array^ points = {point1,point2,point3,point4}; - myPath->AddCurve( points ); - e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath ); - myPath->Flatten( translateMatrix, 10.0f ); - e->Graphics->DrawPath( gcnew Pen( Color::Red,1.0f ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.GetBounds - // -public: - void GetBoundsExample( PaintEventArgs^ e ) - { - // Create path number 1 and a Pen for drawing. - GraphicsPath^ myPath = gcnew GraphicsPath; - Pen^ pathPen = gcnew Pen( Color::Black,1.0f ); - - // Add an Ellipse to the path and Draw it (circle in start - // position). - myPath->AddEllipse( 20, 20, 100, 100 ); - e->Graphics->DrawPath( pathPen, myPath ); - - // Get the path bounds for Path number 1 and draw them. - RectangleF boundRect = myPath->GetBounds(); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), boundRect.X, boundRect.Y, boundRect.Height, boundRect.Width ); - - // Create a second graphics path and a wider Pen. - GraphicsPath^ myPath2 = gcnew GraphicsPath; - Pen^ pathPen2 = gcnew Pen( Color::Black,10.0f ); - - // Create a new ellipse with a width of 10. - myPath2->AddEllipse( 150, 20, 100, 100 ); - myPath2->Widen( pathPen2 ); - e->Graphics->FillPath( Brushes::Black, myPath2 ); - - // Get the second path bounds. - RectangleF boundRect2 = myPath2->GetBounds(); - - // Draw the bounding rectangle. - e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), boundRect2.X, boundRect2.Y, boundRect2.Height, boundRect2.Width ); - - // Display the rectangle size. - MessageBox::Show( boundRect2.ToString() ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.GetLastPoint - // -private: - void GetLastPointExample( PaintEventArgs^ /*e*/ ) - { - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLine( 20, 20, 100, 20 ); - PointF lastPoint = myPath->GetLastPoint(); - if ( !lastPoint.IsEmpty ) - { - String^ lastPointXString = lastPoint.X.ToString(); - String^ lastPointYString = lastPoint.Y.ToString(); - MessageBox::Show( String::Concat( lastPointXString, ", ", lastPointYString ) ); - } - else - MessageBox::Show( "lastPoint is empty" ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.IsOutlineVisible(System.Int32,System.Int32,System.Drawing.Pen,System.Drawing.Graphics) - // -public: - void IsOutlineVisibleExample( PaintEventArgs^ e ) - { - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle rect = Rectangle(20,20,100,100); - myPath->AddRectangle( rect ); - Pen^ testPen = gcnew Pen( Color::Black,20.0f ); - myPath->Widen( testPen ); - e->Graphics->FillPath( Brushes::Black, myPath ); - bool visible = myPath->IsOutlineVisible( 100, 50, testPen, e->Graphics ); - MessageBox::Show( String::Format( "visible = {0}", visible ) ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.IsVisible(System.Int32,System.Int32,System.Drawing.Graphics) - // -private: - void IsVisibleExample( PaintEventArgs^ e ) - { - - // Create a path and add an ellipse. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddEllipse( 0, 0, 100, 100 ); - - // Test the visibility of point (50, 50). - bool visible = myPath->IsVisible( 50, 50, e->Graphics ); - - // Show the result. - MessageBox::Show( visible.ToString() ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Reset - // -public: - void GraphicsPathResetExample( PaintEventArgs^ e ) - { - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - - // Create a path and add a line, an ellipse, and an arc. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLine( Point(0,0), Point(100,100) ); - myPath->AddEllipse( 100, 100, 200, 250 ); - myPath->AddArc( 300, 250, 100, 100, 0, 90 ); - - // Draw the pre-reset points array to the screen. - DrawPoints1( e, myPath->PathPoints, 20 ); - - // Reset the path. - myPath->Reset(); - - // See if any points remain. - if ( myPath->PointCount > 0 ) - { - - // Draw the post-reset points array to the screen. - DrawPoints1( e, myPath->PathPoints, 150 ); - } - else - e->Graphics->DrawString( "No Points", myFont, Brushes::Black, 150, 20 ); - // If there are no points, say so. - } - - - //End GraphicsPathResetExample - // A helper function GraphicsPathResetExample uses to draw the points. - // to the screen. - void DrawPoints1( PaintEventArgs^ e, array^ pathPoints, int xOffset ) - { - int y = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - for ( int i = 0; i < pathPoints->Length; i++ ) - { - e->Graphics->DrawString( String::Concat( pathPoints[ i ].X, ", ", pathPoints[ i ].Y ), myFont, Brushes::Black, (float)xOffset, (float)y ); - y += 20; - - } - } - // End DrawPoints - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Reverse - // - void GraphicsPathReverseExample( PaintEventArgs^ e ) - { - // Create a path and add a line, ellipse, and arc. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLine( Point(0,0), Point(100,100) ); - myPath->AddEllipse( 100, 100, 200, 250 ); - myPath->AddArc( 300, 250, 100, 100, 0, 90 ); - - // Draw the first set of points to the screen. - DrawPoints2( e, myPath->PathPoints, 20 ); - - // Call GraphicsPath.Reverse. - myPath->Reverse(); - - // Draw the reversed set of points to the screen. - DrawPoints2( e, myPath->PathPoints, 150 ); - } - - //End GraphicsPathReverseExample. - // A helper function GraphicsPathReverseExample is used to draw the - // points to the screen. - void DrawPoints2( PaintEventArgs^ e, array^ pathPoints, int xOffset ) - { - int y = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - for ( int i = 0; i < pathPoints->Length; i++ ) - { - e->Graphics->DrawString( String::Concat( pathPoints[ i ].X, ", ", pathPoints[ i ].Y ), myFont, Brushes::Black, (float)xOffset, (float)y ); - y += 20; - - } - } - // End DrawPoints - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.SetMarkers - // -private: - void SetMarkersExample( PaintEventArgs^ e ) - { - // Create a path and set two markers. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddLine( Point(0,0), Point(50,50) ); - myPath->SetMarkers(); - Rectangle rect = Rectangle(50,50,50,50); - myPath->AddRectangle( rect ); - myPath->SetMarkers(); - myPath->AddEllipse( 100, 100, 100, 50 ); - - // Draw the path to screen. - e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.StartFigure - // -public: - void StartFigureExample( PaintEventArgs^ e ) - { - // Create a GraphicsPath object. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // First set of figures. - myPath->StartFigure(); - myPath->AddArc( 10, 10, 50, 50, 0, 270 ); - myPath->AddLine( Point(50,0), Point(100,50) ); - myPath->AddArc( 50, 100, 75, 75, 0, 270 ); - myPath->CloseFigure(); - myPath->StartFigure(); - myPath->AddArc( 100, 10, 50, 50, 0, 270 ); - - // Second set of figures. - myPath->StartFigure(); - myPath->AddArc( 10, 200, 50, 50, 0, 270 ); - myPath->CloseFigure(); - myPath->StartFigure(); - myPath->AddLine( Point(60,200), Point(110,250) ); - myPath->AddArc( 50, 300, 75, 75, 0, 270 ); - myPath->CloseFigure(); - myPath->StartFigure(); - myPath->AddArc( 100, 200, 50, 50, 0, 270 ); - - // Draw the path to the screen. - e->Graphics->DrawPath( gcnew Pen( Color::Black ), myPath ); - } - // End StartFigureExample - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Transform(System.Drawing.Drawing2D.Matrix) - // -private: - void TransformExample( PaintEventArgs^ e ) - { - // Create a path and add and ellipse. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddEllipse( 0, 0, 100, 200 ); - - // Draw the starting position to screen. - e->Graphics->DrawPath( Pens::Black, myPath ); - - // Move the ellipse 100 points to the right. - Matrix^ translateMatrix = gcnew Matrix; - translateMatrix->Translate( 100, 0 ); - myPath->Transform(translateMatrix); - - // Draw the transformed ellipse to the screen. - e->Graphics->DrawPath( gcnew Pen( Color::Red,2.0f ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Warp(System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.WarpMode,System.Single) - // -private: - void WarpExample( PaintEventArgs^ e ) - { - // Create a path and add a rectangle. - GraphicsPath^ myPath = gcnew GraphicsPath; - RectangleF srcRect = RectangleF(0,0,100,200); - myPath->AddRectangle( srcRect ); - - // Draw the source path (rectangle)to the screen. - e->Graphics->DrawPath( Pens::Black, myPath ); - - // Create a destination for the warped rectangle. - PointF point1 = PointF(200,200); - PointF point2 = PointF(400,250); - PointF point3 = PointF(220,400); - array^ destPoints = {point1,point2,point3}; - - // Create a translation matrix. - Matrix^ translateMatrix = gcnew Matrix; - translateMatrix->Translate( 100, 0 ); - - // Warp the source path (rectangle). - myPath->Warp( destPoints, srcRect, translateMatrix, WarpMode::Perspective, 0.5f ); - - // Draw the warped path (rectangle) to the screen. - e->Graphics->DrawPath( gcnew Pen( Color::Red ), myPath ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Widen(System.Drawing.Pen,System.Drawing.Drawing2D.Matrix,System.Single) - // -private: - void WidenExample( PaintEventArgs^ e ) - { - // Create a path and add two ellipses. - GraphicsPath^ myPath = gcnew GraphicsPath; - myPath->AddEllipse( 0, 0, 100, 100 ); - myPath->AddEllipse( 100, 0, 100, 100 ); - - // Draw the original ellipses to the screen in black. - e->Graphics->DrawPath( Pens::Black, myPath ); - - // Widen the path. - Pen^ widenPen = gcnew Pen( Color::Black,10.0f ); - Matrix^ widenMatrix = gcnew Matrix; - widenMatrix->Translate( 50, 50 ); - myPath->Widen( widenPen, widenMatrix, 1.0f ); - - // Draw the widened path to the screen in red. - e->Graphics->FillPath( gcnew SolidBrush( Color::Red ), myPath ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp deleted file mode 100644 index 204f7182726..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp +++ /dev/null @@ -1,569 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - /// - /// The main entry point for the application. - /// - /// - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.CopyData(System.Drawing.PointF[]@,System.Byte[]@,System.Int32,System.Int32) - // -public: - void CopyDataExample( PaintEventArgs^ e ) - { - // Create a graphics path. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // Set up a points array. - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - - // Create a rectangle. - Rectangle myRect = Rectangle(120,120,100,100); - - // Add the points, rectangle, and an ellipse to the path. - myPath->AddLines( myPoints ); - myPath->SetMarkers(); - myPath->AddRectangle( myRect ); - myPath->SetMarkers(); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Get the total number of points for the path, and arrays of - // the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for listing the array of points on the left - // side of the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // List the set of points and types and types to the left side - // of the screen. - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); - j += 20; - } - - // Create a GraphicsPathIterator for myPath and rewind it. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - myPathIterator->Rewind(); - - // Set up the arrays to receive the copied data. - array^points = gcnew array(myPathIterator->Count); - array^types = gcnew array(myPathIterator->Count); - int myStartIndex; - int myEndIndex; - - // Increment the starting index to the second marker in the - // path. - myPathIterator->NextMarker( myStartIndex, myEndIndex ); - myPathIterator->NextMarker( myStartIndex, myEndIndex ); - - // Copy all the points and types from the starting index to the - // ending index to the points array and the types array - // respectively. - int numPointsCopied = myPathIterator->CopyData( points, types, myStartIndex, myEndIndex ); - - // List the copied points to the right side of the screen. - j = 20; - int copiedStartIndex = 0; - for ( i = 0; i < numPointsCopied; i++ ) - { - copiedStartIndex = myStartIndex + i; - e->Graphics->DrawString( String::Format( "Point: {0}, Value: {1}, Type: {2}", copiedStartIndex, points[ i ], types[ i ] ), myFont, myBrush, 200, j ); - j += 20; - - } - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.Enumerate(System.Drawing.PointF[]@,System.Byte[]@) - // -public: - void EnumerateExample( PaintEventArgs^ e ) - { - GraphicsPath^ myPath = gcnew GraphicsPath; - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - myPath->AddLines( myPoints ); - myPath->AddRectangle( myRect ); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Get the total number of points for the path, and arrays of - // the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for listing the array of points on the left - // side of the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // List the set of points and types and types to the left side - // of the screen. - e->Graphics->DrawString( "Original Data", myFont, myBrush, 20, j ); - j += 20; - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); - j += 20; - } - - // Create a GraphicsPathIterator for myPath. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - myPathIterator->Rewind(); - array^points = gcnew array(myPathIterator->Count); - array^types = gcnew array(myPathIterator->Count); - - // int numPoints = myPathIterator->Enumerate(&points, &types); - // Draw the set of copied points and types to the screen. - j = 20; - e->Graphics->DrawString( "Copied Data", myFont, myBrush, 200, j ); - j += 20; - for ( i = 0; i < points->Length; i++ ) - { - e->Graphics->DrawString( String::Format( "Point: {0}, Value: {1}, Type: {2}", i, points[ i ], types[ i ] ), myFont, myBrush, 200, j ); - j += 20; - } - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.HasCurve - // -private: - void HasCurveExample( PaintEventArgs^ /*e*/ ) - { - // Create a path and add three lines, - // a rectangle and an ellipse. - GraphicsPath^ myPath = gcnew GraphicsPath; - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - myPath->AddLines( myPoints ); - myPath->AddRectangle( myRect ); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Create a GraphicsPathIterator for myPath. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - - // Test for a curve. - bool myHasCurve = myPathIterator->HasCurve(); - - // Show the test result. - MessageBox::Show( myHasCurve.ToString() ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextMarker(System.Drawing.Drawing2D.GraphicsPath) - // -public: - void NextMarkerExample2( PaintEventArgs^ e ) - { - // Create a graphics path. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // Set up primitives to add to myPath. - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - - // Add 3 lines, a rectangle, an ellipse, and 2 markers. - myPath->AddLines( myPoints ); - myPath->SetMarkers(); - myPath->AddRectangle( myRect ); - myPath->SetMarkers(); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Get the total number of points for the path, - // and the arrays of the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for listing all the values of the path's - // points to the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // List the values for all of path points and types to - // the left side of the screen. - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); - j += 20; - } - - // Create a GraphicsPathIterator. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - - // Rewind the iterator. - myPathIterator->Rewind(); - - // Create a GraphicsPath to receive a section of myPath. - GraphicsPath^ myPathSection = gcnew GraphicsPath; - - // Retrieve and list the number of points contained in - // the first marker to the right side of the screen. - int markerPoints; - markerPoints = myPathIterator->NextMarker( myPathSection ); - e->Graphics->DrawString( String::Format( "Marker: 1 Num Points: {0}", markerPoints ), myFont, myBrush, 200, 20 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextMarker(System.Int32@,System.Int32@) - // -private: - void NextMarkerExample( PaintEventArgs^ e ) - { - // Create the GraphicsPath. - GraphicsPath^ myPath = gcnew GraphicsPath; - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - - // Add 3 lines, a rectangle, an ellipse, and 2 markers. - myPath->AddLines( myPoints ); - myPath->SetMarkers(); - myPath->AddRectangle( myRect ); - myPath->SetMarkers(); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Get the total number of points for the path, - // and the arrays of the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for drawing the array - // of points to the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // Draw the set of path points and types to the screen. - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); - j += 20; - } - - // Create a GraphicsPathIterator. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - int myStartIndex; - int myEndIndex; - - // Rewind the Iterator. - myPathIterator->Rewind(); - - // Draw the Markers and their start and end points - // to the screen. - j = 20; - for ( i = 0; i < 3; i++ ) - { - myPathIterator->NextMarker( myStartIndex, myEndIndex ); - e->Graphics->DrawString( String::Format( "Marker {0}: Start: {1} End: {2}", i, myStartIndex, myEndIndex ), - myFont, myBrush, 200, j ); - j += 20; - } - - // Draw the total number of points to the screen. - j += 20; - int myPathTotalPoints = myPathIterator->Count; - e->Graphics->DrawString( String::Format( "Total Points = {0}", myPathTotalPoints ), myFont, myBrush, 200, j ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextPathType(System.Byte@,System.Int32@,System.Int32@) - // -public: - void NextPathTypeExample( PaintEventArgs^ e ) - { - // Create the GraphicsPath. - GraphicsPath^ myPath = gcnew GraphicsPath; - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - - // Add 3 lines, a rectangle, and an ellipse. - myPath->AddLines( myPoints ); - myPath->AddRectangle( myRect ); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // List all of the path points to the screen. - ListPathPoints( e, myPath, nullptr, 20, 1 ); - - // Create a GraphicsPathIterator. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - - // Rewind the Iterator. - myPathIterator->Rewind(); - - // Iterate the subpaths and types, and list the results to - // the screen. - int i; - int j = 20; - int mySubPaths; - int subPathStartIndex; - int subPathEndIndex; - Boolean IsClosed; - Byte subPathPointType; - int pointTypeStartIndex; - int pointTypeEndIndex; - int numPointsFound; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - j = 20; - for ( i = 0; i < 3; i++ ) - { - mySubPaths = myPathIterator->NextSubpath( subPathStartIndex, subPathEndIndex, IsClosed ); - numPointsFound = myPathIterator->NextPathType( subPathPointType, pointTypeStartIndex, pointTypeEndIndex ); - e->Graphics->DrawString( String::Format( "SubPath: {0} Points Found: {1} Type of Points: {2}", i, - numPointsFound, subPathPointType ), myFont, myBrush, 200.0f, (float)j ); - j += 20; - } - - // List the total number of path points to the screen. - ListPathPoints( e, myPath, myPathIterator, 200, 2 ); - } - - //------------------------------------------------------- - //This function is a helper function used by - // NextPathTypeExample. - //------------------------------------------------------- - void ListPathPoints( PaintEventArgs^ e, GraphicsPath^ myPath, GraphicsPathIterator^ myPathIterator, int xOffset, int listType ) - { - // Get the total number of points for the path, - // and the arrays of the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for drawing the points to the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - if ( listType == 1 ) - { - // Draw the set of path points and types to the screen. - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], - myFont, myBrush, (float)xOffset, (float)j ); - j += 20; - } - } - else - if ( listType == 2 ) - { - // Draw the total number of points to the screen. - int myPathTotalPoints = myPathIterator->Count; - e->Graphics->DrawString( String::Format( "Total Points = {0}", myPathTotalPoints ), myFont, myBrush, (float)xOffset, 100.0f ); - } - else - { - e->Graphics->DrawString( "Wrong or no list type argument.", myFont, myBrush, (float)xOffset, 200.0f ); - } - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath(System.Drawing.Drawing2D.GraphicsPath,System.Boolean@) - // - void NextSubpathExample2( PaintEventArgs^ e ) - { - // Create a graphics path. - GraphicsPath^ myPath = gcnew GraphicsPath; - - // Set up primitives to add to myPath. - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - - // Add 3 lines, a rectangle, an ellipse, and 2 markers. - myPath->AddLines( myPoints ); - myPath->SetMarkers(); - myPath->AddRectangle( myRect ); - myPath->SetMarkers(); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Get the total number of points for the path, - // and the arrays of the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for listing all of the path's - // points to the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // List the values of all the path points and types to the screen. - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); - j += 20; - } - - // Create a GraphicsPathIterator for myPath. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - - // Rewind the iterator. - myPathIterator->Rewind(); - - // Create the GraphicsPath section. - GraphicsPath^ myPathSection = gcnew GraphicsPath; - - // Iterate to the 3rd subpath and list the number of points therein - // to the screen. - int subpathPoints; - bool IsClosed2; - - // Iterate to the third subpath. - subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 ); - subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 ); - subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 ); - - // Write the number of subpath points to the screen. - e->Graphics->DrawString( String::Format( "Subpath: 3 Num Points: {0}", subpathPoints ), myFont, myBrush, 200, 20 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath(System.Int32@,System.Int32@,System.Boolean@) - // -private: - void NextSubpathExample( PaintEventArgs^ e ) - { - // Create the GraphicsPath. - GraphicsPath^ myPath = gcnew GraphicsPath; - array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; - Rectangle myRect = Rectangle(120,120,100,100); - - // Add 3 lines, a rectangle, an ellipse, and 2 markers. - myPath->AddLines( myPoints ); - myPath->AddRectangle( myRect ); - myPath->AddEllipse( 220, 220, 100, 100 ); - - // Get the total number of points for the path, - // and the arrays of the points and types. - int myPathPointCount = myPath->PointCount; - array^myPathPoints = myPath->PathPoints; - array^myPathTypes = myPath->PathTypes; - - // Set up variables for drawing the array of - // points to the screen. - int i; - float j = 20; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // Draw the set of path points and types to the screen. - for ( i = 0; i < myPathPointCount; i++ ) - { - e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); - j += 20; - } - - // Create a GraphicsPathIterator. - GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); - int myStartIndex; - int myEndIndex; - bool myIsClosed; - - // get the number of Subpaths. - int numSubpaths = myPathIterator->NextSubpath( myPath, myIsClosed ); - numSubpaths -= 1; - - // Rewind the Iterator. - myPathIterator->Rewind(); - - // List the Subpaths to the screen. - j = 20; - for ( i = 0; i < numSubpaths; i++ ) - { - myPathIterator->NextSubpath( myStartIndex, myEndIndex, myIsClosed ); - String^ s = String::Format( "Subpath {0}: Start: {1}", i, myStartIndex ); - s = s + String::Format( " End: {0} IsClosed: {1}", myEndIndex, myIsClosed ); - e->Graphics->DrawString( s, myFont, myBrush, 200, j ); - j += 20; - } - - // Draw the total number of Subpaths to the screen. - j += 20; - e->Graphics->DrawString( String::Format( "Number Subpaths = {0}", numSubpaths ), myFont, myBrush, 200, j ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp deleted file mode 100644 index cb009d52a56..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp +++ /dev/null @@ -1,276 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.Clone - // -private: - void CloneExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - int x = 20,y = 20,h = 100,w = 200; - Rectangle myRect = Rectangle(x,y,w,h); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Aquamarine,45.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, x, y, w, h ); - - // Clone the LinearGradientBrush. - LinearGradientBrush^ clonedLGBrush = dynamic_cast(myLGBrush->Clone()); - - // Justify the left edge of the gradient with the - // left edge of the ellipse. - clonedLGBrush->TranslateTransform( -100.0f, 0.0f ); - - // Draw a second ellipse to the screen using the cloned HBrush. - y = 150; - e->Graphics->FillEllipse( clonedLGBrush, x, y, w, h ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) - // -private: - void MultiplyTransformExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, myRect ); - - // Transform the LinearGradientBrush. - array^ transformArray = {Point(20,150),Point(400,150),Point(20,200)}; - Matrix^ myMatrix = gcnew Matrix( myRect,transformArray ); - myLGBrush->MultiplyTransform( myMatrix, MatrixOrder::Prepend ); - - // Draw a second ellipse to the screen using - // the transformed brush. - e->Graphics->FillEllipse( myLGBrush, 20, 150, 380, 50 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.ResetTransform - // -private: - void ResetTransformExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, myRect ); - - // Transform the LinearGradientBrush. - array^ transformArray = {Point(20,150),Point(400,150),Point(20,200)}; - Matrix^ myMatrix = gcnew Matrix( myRect,transformArray ); - myLGBrush->MultiplyTransform( myMatrix, MatrixOrder::Prepend ); - - // Draw a second ellipse to the screen - // using the transformed brush. - e->Graphics->FillEllipse( myLGBrush, 20, 150, 380, 50 ); - - // Reset the brush transform. - myLGBrush->ResetTransform(); - - // Draw a third ellipse to the screen using the reset brush. - e->Graphics->FillEllipse( myLGBrush, 20, 250, 200, 100 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -private: - void RotateTransformExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, myRect ); - - // Rotate the LinearGradientBrush. - myLGBrush->RotateTransform( 45.0f, MatrixOrder::Prepend ); - - // Rejustify the brush to start at the left edge of the ellipse. - myLGBrush->TranslateTransform( -100.0f, 0.0f ); - - // Draw a second ellipse to the screen using - // the transformed brush. - e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -private: - void ScaleTransformExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, myRect ); - - // Scale the LinearGradientBrush. - myLGBrush->ScaleTransform( 2.0f, 1.0f, MatrixOrder::Prepend ); - - // Rejustify the brush to start at the left edge of the ellipse. - myLGBrush->TranslateTransform( -20.0f, 0.0f ); - - // Draw a second ellipse to the screen using - // the transformed brush. - e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.SetBlendTriangularShape(System.Single,System.Single) - // -private: - void SetBlendTriangularShapeExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, myRect ); - - // Create a triangular shaped brush with the peak at the center - // of the drawing area. - myLGBrush->SetBlendTriangularShape( .5f, 1.0f ); - - // Use the triangular brush to draw a second ellipse. - myRect.Y = 150; - e->Graphics->FillEllipse( myLGBrush, myRect ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.SetSigmaBellShape(System.Single,System.Single) - // -private: - void SetSigmaBellShapeExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw an ellipse to the screen using the LinearGradientBrush. - e->Graphics->FillEllipse( myLGBrush, myRect ); - - // Create a bell-shaped brush with the peak at the - // center of the drawing area. - myLGBrush->SetSigmaBellShape( .5f, 1.0f ); - - // Use the bell- shaped brush to draw a second - // ellipse. - myRect.Y = 150; - e->Graphics->FillEllipse( myLGBrush, myRect ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.TranslateTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -private: - void TranslateTransformExample( PaintEventArgs^ e ) - { - // Create a LinearGradientBrush. - Rectangle myRect = Rectangle(20,20,200,100); - LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); - - // Draw a rectangle to the screen using the LinearGradientBrush. - e->Graphics->FillRectangle( myLGBrush, myRect ); - - // Rotate the LinearGradientBrush. - myLGBrush->RotateTransform( 90.0f ); - - // Scale the gradient for the height of the rectangle. - myLGBrush->ScaleTransform( 0.5f, 1.0f ); - - // Draw to the screen, the rotated and scaled gradient. - e->Graphics->FillRectangle( myLGBrush, 20, 150, 200, 100 ); - - // Rejustify the brush to start at the top edge of the - // rectangle. - myLGBrush->TranslateTransform( -20.0f, 0.0f ); - - // Draw a third rectangle to the screen using the translated - // brush. - e->Graphics->FillRectangle( myLGBrush, 20, 300, 200, 100 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp deleted file mode 100644 index e83b192d715..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp +++ /dev/null @@ -1,393 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.Multiply(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void MultiplyExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Set up the matrices. - Matrix^ myMatrix1 = gcnew Matrix( 2.0f,0.0f,0.0f,1.0f,0.0f,0.0f ); - Matrix^ myMatrix2 = gcnew Matrix( 0.0f,1.0f,-1.0f,0.0f,0.0f,0.0f ); - Matrix^ myMatrix3 = gcnew Matrix( 1.0f,0.0f,0.0f,1.0f,250.0f,50.0f ); - - // Display the elements of the starting matrix. - ListMatrixElements( e, myMatrix1, "Beginning Matrix", 6, 40 ); - - // Multiply Matrix1 by Matrix 2. - myMatrix1->Multiply( myMatrix2, MatrixOrder::Append ); - - // Display the result of the multiplication of Matrix1 and - // Matrix2. - ListMatrixElements( e, myMatrix1, "Matrix After 1st Multiplication", 6, 60 ); - - // Multiply the result from the previous multiplication by - // Matrix3. - myMatrix1->Multiply( myMatrix3, MatrixOrder::Append ); - - // Display the result of the previous multiplication - // multiplied by Matrix3. - ListMatrixElements1( e, myMatrix1, "Matrix After 2nd Multiplication", 6, 80 ); - - // Draw the rectangle prior to transformation. - e->Graphics->DrawRectangle( myPen, 0, 0, 100, 100 ); - - // Make the transformation. - e->Graphics->Transform = myMatrix1; - - // Draw the rectangle after transformation. - e->Graphics->DrawRectangle( myPen2, 0, 0, 100, 100 ); - } - - //------------------------------------------------------- - // The following function is a helper function to - // list the contents of a matrix. - //------------------------------------------------------- - void ListMatrixElements1( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) - { - // Set up variables for drawing the array - // of points to the screen. - int i; - float x = 20,X = 200; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // Draw the matrix name to the screen. - e->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ); - - // Draw the set of path points and types to the screen. - for ( i = 0; i < numElements; i++ ) - { - e->Graphics->DrawString( String::Concat( matrix->Elements[ i ], ", " ), myFont, myBrush, (float)X, (float)y ); - X += 30; - } - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.Reset - // -public: - void ResetExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Create a matrix that scales by 5 in the x direction and - // by 3 in the y direction. - Matrix^ myMatrix = gcnew Matrix( 5.0f,0.0f,0.0f,3.0f,0.0f,0.0f ); - - // List the matrix elements to the screen. - ListMatrixElements( e, myMatrix, "Beginning Matrix", 6, 20 ); - - // Reset the matrix to identity. - myMatrix->Reset(); - - // Again list the matrix elements to the screen. - ListMatrixElements2( e, myMatrix, "Matrix After Reset", 6, 40 ); - - // Translate the matrix by 50 points in the x-axis and 40 points - // in the y-axis. - myMatrix->Translate( 50.0f, 40.0f ); - - // List the matrix elements to the screen. - ListMatrixElements1( e, myMatrix, "Matrix After Translation", 6, 60 ); - - // Draw a rectangle to the screen. - e->Graphics->DrawRectangle( myPen, 0, 0, 100, 100 ); - - // Apply the matrix transform to the Graphics. - e->Graphics->Transform = myMatrix; - - // Draw another rectangle to the screen that has the transform - // applied. - e->Graphics->DrawRectangle( myPen2, 0, 0, 100, 100 ); - } - - //------------------------------------------------------- - // This function is a helper function to - // list the contents of a matrix. - //------------------------------------------------------- - void ListMatrixElements2( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) - { - // Set up variables for drawing the array - // of points to the screen. - int i; - float x = 20,X = 200; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // Draw the matrix name to the screen. - e->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ); - - // Draw the set of path points and types to the screen. - for ( i = 0; i < numElements; i++ ) - { - e->Graphics->DrawString( String::Concat( matrix->Elements[ i ], ", " ), myFont, myBrush, (float)X, (float)y ); - X += 30; - } - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.Rotate(System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void RotateExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Draw the rectangle to the screen before applying the transform. - e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 ); - - // Create a matrix and rotate it 45 degrees. - Matrix^ myMatrix = gcnew Matrix; - myMatrix->Rotate( 45, MatrixOrder::Append ); - - // Draw the rectangle to the screen again after applying the - // transform. - e->Graphics->Transform = myMatrix; - e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.RotateAt(System.Single,System.Drawing.PointF,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void RotateAtExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - PointF rotatePoint = PointF(150.0f,50.0f); - - // Draw the rectangle to the screen before applying the - // transform. - e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 ); - - // Create a matrix and rotate it 45 degrees. - Matrix^ myMatrix = gcnew Matrix; - myMatrix->RotateAt( 45, rotatePoint, MatrixOrder::Append ); - - // Draw the rectangle to the screen again after applying the - // transform. - e->Graphics->Transform = myMatrix; - e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.Scale(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void ScaleExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Draw the rectangle to the screen before applying the - // transform. - e->Graphics->DrawRectangle( myPen, 50, 50, 100, 100 ); - - // Create a matrix and scale it. - Matrix^ myMatrix = gcnew Matrix; - myMatrix->Scale( 3, 2, MatrixOrder::Append ); - - // Draw the rectangle to the screen again after applying the - // transform. - e->Graphics->Transform = myMatrix; - e->Graphics->DrawRectangle( myPen2, 50, 50, 100, 100 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.Shear(System.Single,System.Single) - // -public: - void MatrixShearExample( PaintEventArgs^ e ) - { - Matrix^ myMatrix = gcnew Matrix; - myMatrix->Shear( 2, 0 ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Green ), 0, 0, 100, 50 ); - e->Graphics->MultiplyTransform( myMatrix ); - e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), 0, 0, 100, 50 ); - e->Graphics->DrawEllipse( gcnew Pen( Color::Blue ), 0, 0, 100, 50 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.TransformPoints(System.Drawing.Point[]) - // -public: - void TransformPointsExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Create an array of points. - array^ myArray = {Point(20,20),Point(120,20),Point(120,120),Point(20,120),Point(20,20)}; - - // Draw the Points to the screen before applying the - // transform. - e->Graphics->DrawLines( myPen, myArray ); - - // Create a matrix and scale it. - Matrix^ myMatrix = gcnew Matrix; - myMatrix->Scale( 3, 2, MatrixOrder::Append ); - myMatrix->TransformPoints( myArray ); - - // Draw the Points to the screen again after applying the - // transform. - e->Graphics->DrawLines( myPen2, myArray ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.TransformVectors(System.Drawing.Point[]) - // -public: - void TransformVectorsExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Create an array of points. - array^ myArray = {Point(20,20),Point(120,20),Point(120,120),Point(20,120),Point(20,20)}; - - // Draw the Points to the screen before applying the - // transform. - e->Graphics->DrawLines( myPen, myArray ); - - // Create a matrix, scale it, and translate it. - Matrix^ myMatrix = gcnew Matrix; - myMatrix->Scale( 3, 2, MatrixOrder::Append ); - myMatrix->Translate( 100, 100, MatrixOrder::Append ); - - // List the matrix elements to the screen. - ListMatrixElements( e, myMatrix, "Scaled and Translated Matrix", 6, 20 ); - - // Apply the transform to the array. - myMatrix->TransformVectors( myArray ); - - // Draw the Points to the screen again after applying the - // transform. - e->Graphics->DrawLines( myPen2, myArray ); - } - - //------------------------------------------------------- - // This function is a helper function to - // list the contents of a matrix. - //------------------------------------------------------- - void ListMatrixElements( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) - { - // Set up variables for drawing the array - // of points to the screen. - int i; - float x = 20,X = 200; - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); - SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); - - // Draw the matrix name to the screen. - e->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ); - - // Draw the set of path points and types to the screen. - for ( i = 0; i < numElements; i++ ) - { - e->Graphics->DrawString( String::Concat( matrix->Elements[ i ], ", " ), myFont, myBrush, (float)X, (float)y ); - X += 30; - } - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Matrix.Translate(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void TranslateExample( PaintEventArgs^ e ) - { - Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); - Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); - - // Draw a rectangle to the screen before applying the - // transform. - e->Graphics->DrawRectangle( myPen, 20, 20, 100, 50 ); - - // Create a matrix and translate it. - Matrix^ myMatrix = gcnew Matrix; - myMatrix->Translate( 100, 100, MatrixOrder::Append ); - - // Draw the Points to the screen again after applying the - // transform. - e->Graphics->Transform = myMatrix; - e->Graphics->DrawRectangle( myPen2, 20, 20, 100, 50 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp deleted file mode 100644 index 52770910d88..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Drawing2D.AdjustableArrowCap.#ctor(System.Single,System.Single) - // -public: - void ConstructAdjArrowCap1( PaintEventArgs^ e ) - { - AdjustableArrowCap^ myArrow = gcnew AdjustableArrowCap( 6,6 ); - Pen^ capPen = gcnew Pen( Color::Black ); - capPen->CustomStartCap = myArrow; - capPen->CustomEndCap = myArrow; - e->Graphics->DrawLine( capPen, 50, 50, 200, 50 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.AdjustableArrowCap.#ctor(System.Single,System.Single,System.Boolean) - // -public: - void ConstructAdjArrowCap2( PaintEventArgs^ e ) - { - AdjustableArrowCap^ myArrow = gcnew AdjustableArrowCap( 6,6,false ); - Pen^ capPen = gcnew Pen( Color::Black ); - capPen->CustomStartCap = myArrow; - capPen->CustomEndCap = myArrow; - e->Graphics->DrawLine( capPen, 50, 50, 200, 50 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.Blend.#ctor - // -public: - void BlendConstExample( PaintEventArgs^ e ) - { - //Draw ellipse using Blend. - Point startPoint2 = Point(20,110); - Point endPoint2 = Point(140,110); - array^myFactors = {.2f,.4f,.8f,.8f,.4f,.2f}; - array^myPositions = {0.0f,.2f,.4f,.6f,.8f,1.0f}; - Blend^ myBlend = gcnew Blend; - myBlend->Factors = myFactors; - myBlend->Positions = myPositions; - LinearGradientBrush^ lgBrush2 = - gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Blue,Color::Red ); - lgBrush2->Blend = myBlend; - Rectangle ellipseRect2 = Rectangle(20,110,120,80); - e->Graphics->FillEllipse( lgBrush2, ellipseRect2 ); - - // End example. - } - // - - // Snippet for: M:System.Drawing.Drawing2D.ColorBlend.#ctor - // -protected: - virtual void OnPaint( PaintEventArgs^ e ) override - { - //Draw ellipse using ColorBlend. - Point startPoint2 = Point(20,110); - Point endPoint2 = Point(140,110); - array^ myColors = - {Color::Green,Color::Yellow,Color::Yellow,Color::Blue,Color::Red,Color::Red}; - array^myPositions = {0.0f,.20f,.40f,.60f,.80f,1.0f}; - ColorBlend^ myBlend = gcnew ColorBlend; - myBlend->Colors = myColors; - myBlend->Positions = myPositions; - LinearGradientBrush^ lgBrush2 = - gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Green,Color::Red ); - lgBrush2->InterpolationColors = myBlend; - Rectangle ellipseRect2 = Rectangle(20,110,120,80); - e->Graphics->FillEllipse( lgBrush2, ellipseRect2 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp deleted file mode 100644 index 58437a3d7a7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - - // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void MultiplyTransformExample( PaintEventArgs^ e ) - { - // Create a graphics path and add an rectangle. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle rect = Rectangle(20,20,100,50); - myPath->AddRectangle( rect ); - - // Get the path's array of points. - array^myPathPointArray = myPath->PathPoints; - - // Create a path gradient brush. - PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); - - // Set the color span. - myPGBrush->CenterColor = Color::Red; - array^ mySurroundColor = {Color::Blue}; - myPGBrush->SurroundColors = mySurroundColor; - - // Draw the brush to the screen prior to transformation. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); - - // Create a new matrix that rotates by 90 degrees, and - // translates by 100 in each direction. - Matrix^ myMatrix = gcnew Matrix( 0,1,-1,0,100,100 ); - - // Apply the transform to the brush. - myPGBrush->MultiplyTransform( myMatrix, MatrixOrder::Append ); - - // Draw the brush to the screen again after applying the - // transform. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void RotateTransformExample( PaintEventArgs^ e ) - { - // Create a graphics path and add an ellipse. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle rect = Rectangle(100,20,100,50); - myPath->AddRectangle( rect ); - - // Get the path's array of points. - array^myPathPointArray = myPath->PathPoints; - - // Create a path gradient brush. - PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); - - // Set the color span. - myPGBrush->CenterColor = Color::Red; - array^ mySurroundColor = {Color::Blue}; - myPGBrush->SurroundColors = mySurroundColor; - - // Draw the brush to the screen prior to transformation. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); - - // Apply the rotate transform to the brush. - myPGBrush->RotateTransform( 45, MatrixOrder::Append ); - - // Draw the brush to the screen again after applying the - // transform. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) - // -public: - void ScaleTransformExample( PaintEventArgs^ e ) - { - // Create a graphics path and add a rectangle. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle rect = Rectangle(100,20,100,50); - myPath->AddRectangle( rect ); - - // Get the path's array of points. - array^myPathPointArray = myPath->PathPoints; - - // Create a path gradient brush. - PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); - - // Set the color span. - myPGBrush->CenterColor = Color::Red; - array^ mySurroundColor = {Color::Blue}; - myPGBrush->SurroundColors = mySurroundColor; - - // Draw the brush to the screen prior to transformation. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); - - // Scale by a factor of 2 in the x-axis by applying the scale - // transform to the brush. - myPGBrush->ScaleTransform( 2, 1, MatrixOrder::Append ); - - // Move the brush down by 100 by Applying the translate - // transform to the brush. - myPGBrush->TranslateTransform( -100, 100, MatrixOrder::Append ); - - // Draw the brush to the screen again after applying the - // transforms. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.SetBlendTriangularShape(System.Single,System.Single) - // -public: - void SetBlendTriangularShapeExample( PaintEventArgs^ e ) - { - // Create a graphics path and add a rectangle. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle rect = Rectangle(100,20,100,50); - myPath->AddRectangle( rect ); - - // Get the path's array of points. - array^myPathPointArray = myPath->PathPoints; - - // Create a path gradient brush. - PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); - - // Set the color span. - myPGBrush->CenterColor = Color::Red; - array^ mySurroundColor = {Color::Blue}; - myPGBrush->SurroundColors = mySurroundColor; - - // Draw the brush to the screen prior to the blend. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); - - // Set the Blend factors. - myPGBrush->SetBlendTriangularShape( 0.5f, 1.0f ); - - // Move the brush down by 100 by Applying the translate - // transform to the brush. - myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append ); - - // Draw the brush to the screen again after applying the - // transforms. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 ); - } - // - - // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.SetSigmaBellShape(System.Single,System.Single) - // -public: - void SetSigmaBellShapeExample( PaintEventArgs^ e ) - { - // Create a graphics path and add a rectangle. - GraphicsPath^ myPath = gcnew GraphicsPath; - Rectangle rect = Rectangle(100,20,100,50); - myPath->AddRectangle( rect ); - - // Get the path's array of points. - array^myPathPointArray = myPath->PathPoints; - - // Create a path gradient brush. - PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); - - // Set the color span. - myPGBrush->CenterColor = Color::Red; - array^ mySurroundColor = {Color::Blue}; - myPGBrush->SurroundColors = mySurroundColor; - - // Draw the brush to the screen prior to blend. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); - - // Set the Blend factors and transform the brush. - myPGBrush->SetSigmaBellShape( 0.5f, 1.0f ); - - // Move the brush down by 100 by applying the translate - // transform to the brush. - myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append ); - - // Draw the brush to the screen again after setting the - // blend and applying the transform. - e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp deleted file mode 100644 index 467fba860a9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp +++ /dev/null @@ -1,203 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: - public System::Windows::Forms::Form - -{ - #pragma region " Windows Form Designer generated code " - - public: - Form1() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->ComboBox1->SelectedIndexChanged += gcnew EventHandler(this, - &Form1::ComboBox1_SelectedIndexChanged); - - //Add any initialization after the InitializeComponent() call - - } - - //Form overrides dispose to clean up the component list. - protected: - ~Form1() - { - if (components != nullptr) - { - delete components; - } - } - - //Required by the Windows Form Designer - private: - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - private: - System::Windows::Forms::ComboBox^ ComboBox1; - private: - System::Windows::Forms::Label^ Label1; - private: - System::Windows::Forms::Button^ Button1; - private: - System::Windows::Forms::Button^ Button2; - private: - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->ComboBox1 = gcnew System::Windows::Forms::ComboBox(); - this->Label1 = gcnew System::Windows::Forms::Label(); - this->Button1 = gcnew System::Windows::Forms::Button(); - this->Button2 = gcnew System::Windows::Forms::Button(); - this->SuspendLayout(); - // - //ComboBox1 - // - this->ComboBox1->Items->AddRange - (gcnew array{"Smaller", "Bigger"}); - this->ComboBox1->Location = System::Drawing::Point(64, 32); - this->ComboBox1->Name = "ComboBox1"; - this->ComboBox1->Size = System::Drawing::Size(121, 21); - this->ComboBox1->TabIndex = 0; - // - //Label1 - // - this->Label1->Location = System::Drawing::Point(48, 136); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size(184, 88); - this->Label1->TabIndex = 1; - this->Label1->Text = "Some text to change."; - // - // Button1 - // - this->Button1->Location = System::Drawing::Point(192, 56); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 2; - this->Button1->Text = "Button1"; - this->Button1->Click += - gcnew System::EventHandler(this,&Form1::Button1_Click); - // - // Button2 - // - this->Button2->Location = System::Drawing::Point(200, 8); - this->Button2->Name = "Button2"; - this->Button2->TabIndex = 3; - this->Button2->Text = "Button2"; - this->Button2->Click += - gcnew System::EventHandler(this,&Form1::Button2_Click); - // - //Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(292, 266); - this->Controls->Add(this->Label1); - this->Controls->Add(this->ComboBox1); - this->Controls->Add(this->Button2); - this->Controls->Add(this->Button1); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout(false); - - } - -#pragma endregion - - // The following code example demonstrates how to use the Size, - // SizeInPoints, and Unit properties. This example is designed to - // be used with a Windows Form that contains a ComboBox named - // ComboBox1. Paste the following code into the form and - // associate the ComboBox1_SelectedIndexChange method with the - // SelectedIndexChanged event of the ComboBox control. - - // - private: - void ComboBox1_SelectedIndexChanged(System::Object^ sender, - System::EventArgs^ e) - { - - // Cast the sender object back to a ComboBox. - ComboBox^ ComboBox1 = (ComboBox^) sender; - - // Retrieve the selected item. - String^ selectedString = (String^) ComboBox1->SelectedItem; - - // Convert it to lowercase. - selectedString = selectedString->ToLower(); - - // Declare the current size. - float currentSize; - - // If Bigger is selected, get the current size from the - // Size property and increase it. Reset the font to the - // new size, using the current unit. - if (selectedString == "bigger") - { - currentSize = Label1->Font->Size; - currentSize += 2.0F; - Label1->Font =gcnew System::Drawing::Font(Label1->Font->Name, - currentSize, Label1->Font->Style, Label1->Font->Unit); - - } - // If Smaller is selected, get the current size, in - // points, and decrease it by 2. Reset the font with - // the new size in points. - if (selectedString == "smaller") - { - currentSize = Label1->Font->Size; - currentSize -= 2.0F; - Label1->Font = gcnew System::Drawing::Font(Label1->Font->Name, - currentSize, Label1->Font->Style); - - } - } - // - - // The following code example demonstrates how to use the - // Font.#ctor(Font, FontStyle) constructor. To run this example, - // paste this code into a Windows Form that contains a button - // named Button1, and associate the Button1_Click method with the - // Click event of the button. - // - private: - void Button1_Click(System::Object^ sender, - System::EventArgs^ e) - { - Button1->Font = gcnew System::Drawing::Font - (this->Font, FontStyle::Italic); - } - // - - // The following code example demonstrates how to use - // the Font.#ctor(FontFamily, Single, FontStyle, GraphicsUnit) - // constructor. - // This example is designed to be used with Windows Forms. - // To run this example paste this code into a form that contains - // a button named Button2, and associate the Button2_Click method - // with the Click event of the button. - // - - private: - void Button2_Click(System::Object^ sender, - System::EventArgs^ e) - { - Button2->Font = gcnew System::Drawing::Font - (FontFamily::GenericMonospace, 12.0F, - FontStyle::Italic, GraphicsUnit::Pixel); - } - // -}; - -[STAThread] -int main() -{ - Application::Run(gcnew Form1()); -}; diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp deleted file mode 100644 index f01c00a1d3e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp +++ /dev/null @@ -1,237 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Drawing::Drawing2D; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - - // The following code example demonstrates how to construct and - // use a region. - // This example is designed to be used with Windows Forms. - // Paste the code to a form and call the FillRegionExcludingPath - // method when handling the form's Paint event, passing e as - // PaintEventArgs. - // -private: - void FillRegionExcludingPath( PaintEventArgs^ e ) - { - // Create the region using a rectangle. - System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( Rectangle(20,20,100,100) ); - - // Create the GraphicsPath. - System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath; - - // Add a circle to the graphics path. - path->AddEllipse( 50, 50, 25, 25 ); - - // Exclude the circle from the region. - myRegion->Exclude( path ); - - // Retrieve a Graphics object from the form. - Graphics^ formGraphics = e->Graphics; - - // Fill the region in blue. - formGraphics->FillRegion( Brushes::Blue, myRegion ); - - // Dispose of the path and region objects. - delete path; - delete myRegion; - } - // - - // The following code example demonstrates how to use the - // PageScale and TranslateTransform members to change the - // scale and origin when you draw a rectangle. - // This example is designed to be used with Windows Forms. - // Paste the code intto a form and call the - // ChangePageScaleAndTranslateTransform method when - // handling the form's Paint event, passing e as PaintEventArgs. - // -private: - void ChangePageScaleAndTranslateTransform( PaintEventArgs^ e ) - { - // Create a rectangle. - Rectangle rectangle1 = Rectangle(20,20,50,100); - - // Draw its outline. - e->Graphics->DrawRectangle( Pens::SlateBlue, rectangle1 ); - - // Change the page scale. - e->Graphics->PageScale = 2.0F; - - // Call TranslateTransform to change the origin of the - // Graphics object. - e->Graphics->TranslateTransform( 10.0F, 10.0F ); - - // Draw the rectangle again. - e->Graphics->DrawRectangle( Pens::Tomato, rectangle1 ); - - // Set the page scale and origin back to their original values. - e->Graphics->PageScale = 1.0F; - e->Graphics->ResetTransform(); - SolidBrush^ transparentBrush = gcnew SolidBrush( Color::FromArgb( 50, Color::Yellow ) ); - - // Create a new rectangle with the coordinates you expect - // after setting PageScale and calling TranslateTransform: - // x = (10 + 20) * 2 - // y = (10 + 20) * 2 - // Width = 50 * 2 - // Length = 100 * 2 - Rectangle newRectangle = Rectangle(60,60,100,200); - - // Fill in the rectangle with a semi-transparent color. - e->Graphics->FillRectangle( transparentBrush, newRectangle ); - } - // - - // The following code example demonstrates the effect of changing - // the PageUnit property. - // This example is designed to be used with Windows Forms. - // Paste the code into a form and call the ChangePageUnit - // method when handling the form's Paint event, passing e - // as PaintEventArgs. - // -private: - void ChangePageUnit( PaintEventArgs^ e ) - { - // Create a rectangle. - Rectangle rectangle1 = Rectangle(20,20,50,100); - - // Draw its outline. - e->Graphics->DrawRectangle( Pens::SlateBlue, rectangle1 ); - - // Change the page scale. - e->Graphics->PageUnit = GraphicsUnit::Point; - - // Draw the rectangle again. - e->Graphics->DrawRectangle( Pens::Tomato, rectangle1 ); - } - // - - // The following method demonstrates the use of the Clip - // property. - // This example is designed to be used with Windows Forms. - // Paste the code int a form and call the SetAndFillClip method - // when handling the form's Paint event, passing e as PaintEventArgs. - // -private: - void SetAndFillClip( PaintEventArgs^ e ) - { - // Set the Clip property to a new region. - e->Graphics->Clip = gcnew System::Drawing::Region( Rectangle(10,10,100,200) ); - - // Fill the region. - e->Graphics->FillRegion( Brushes::LightSalmon, e->Graphics->Clip ); - - // Demonstrate the clip region by drawing a string - // at the outer edge of the region. - e->Graphics->DrawString( "Outside of Clip", gcnew System::Drawing::Font( "Arial",12.0F,FontStyle::Regular ), Brushes::Black, 0.0F, 0.0F ); - } - // - - // The following code example demonstrates the use of the - // TextRenderingHint and TextContrast properties. - // This example is designed to be used with Windows Forms. - // Paste the code into a form and call the - // ChangeTextRenderingHintAndTextContrast method when - // handling the form's Paint event, passing e as PaintEventArgs. - // -private: - void ChangeTextRenderingHintAndTextContrast( PaintEventArgs^ e ) - { - // Retrieve the graphics object. - Graphics^ formGraphics = e->Graphics; - - // Declare a new font. - System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,20,FontStyle::Regular ); - - // Set the TextRenderingHint property. - formGraphics->TextRenderingHint = System::Drawing::Text::TextRenderingHint::SingleBitPerPixel; - - // Draw the string. - formGraphics->DrawString( "Hello World", myFont, Brushes::Firebrick, 20.0F, 20.0F ); - - // Change the TextRenderingHint property. - formGraphics->TextRenderingHint = System::Drawing::Text::TextRenderingHint::AntiAliasGridFit; - - // Draw the string again. - formGraphics->DrawString( "Hello World", myFont, Brushes::Firebrick, 20.0F, 60.0F ); - - // Set the text contrast to a high-contrast setting. - formGraphics->TextContrast = 0; - - // Draw the string. - formGraphics->DrawString( "Hello World", myFont, Brushes::DodgerBlue, 20.0F, 100.0F ); - - // Set the text contrast to a low-contrast setting. - formGraphics->TextContrast = 12; - - // Draw the string again. - formGraphics->DrawString( "Hello World", myFont, Brushes::DodgerBlue, 20.0F, 140.0F ); - - // Dispose of the font object. - delete myFont; - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - ChangeTextRenderingHintAndTextContrast( e ); - - //ChangePageScaleAndTranslateTransform(e); - //ChangePageUnit(e); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp deleted file mode 100644 index 8a00128e2a4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp +++ /dev/null @@ -1,381 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Drawing::Imaging; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - this->Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); - this->Button3->Click += gcnew EventHandler( this, &Form1::Button3_Click ); - this->Button4->Click += gcnew EventHandler( this, &Form1::Button4_Click ); - this->Button5->Click += gcnew EventHandler( this, &Form1::Button5_Click ); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::PictureBox^ PictureBox1; - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Button^ Button2; - System::Windows::Forms::Button^ Button3; - System::Windows::Forms::Button^ Button4; - System::Windows::Forms::Label ^ Label1; - System::Windows::Forms::Button^ Button5; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button2 = gcnew System::Windows::Forms::Button; - this->Button3 = gcnew System::Windows::Forms::Button; - this->Button4 = gcnew System::Windows::Forms::Button; - this->Label1 = gcnew System::Windows::Forms::Label; - this->Button5 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //PictureBox1 - // - this->PictureBox1->Location = System::Drawing::Point( 24, 8 ); - this->PictureBox1->Name = "PictureBox1"; - this->PictureBox1->Size = System::Drawing::Size( 100, 88 ); - this->PictureBox1->TabIndex = 0; - this->PictureBox1->TabStop = false; - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 192, 8 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 2; - this->Button1->Text = "Button1"; - - // - //Button2 - // - this->Button2->Location = System::Drawing::Point( 192, 40 ); - this->Button2->Name = "Button2"; - this->Button2->TabIndex = 3; - this->Button2->Text = "Button2"; - - // - //Button3 - // - this->Button3->Location = System::Drawing::Point( 192, 72 ); - this->Button3->Name = "Button3"; - this->Button3->TabIndex = 4; - this->Button3->Text = "Button3"; - - // - //Button4 - // - this->Button4->Location = System::Drawing::Point( 192, 104 ); - this->Button4->Name = "Button4"; - this->Button4->TabIndex = 5; - this->Button4->Text = "Button4"; - - // - //Label1 - // - this->Label1->Location = System::Drawing::Point( 24, 72 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 152, 32 ); - this->Label1->TabIndex = 6; - this->Label1->Text = "Label1"; - - // - //Button5 - // - this->Button5->Location = System::Drawing::Point( 200, 136 ); - this->Button5->Name = "Button5"; - this->Button5->TabIndex = 7; - this->Button5->Text = "Button5"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button5 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->Button4 ); - this->Controls->Add( this->Button3 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->PictureBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // The following code example demonstrates how to construct a new Bitmap - // from a file, using the GetPixel and SetPixel methods to - // recolor the image. It also uses the PixelFormat property. - // This example is designed to be used with a Windows Forms that contains - // a Label, PictureBox and Button named Label1, PictureBox1 and Button1, - // respectively. Paste the code into the form and associate the - // Button1_Click method with the button's Click event. - - // -private: - Bitmap^ image1; - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - try - { - - // Retrieve the image. - image1 = gcnew Bitmap( "C:\\Documents and Settings\\All Users\\" - "Documents\\My Music\\music.bmp",true ); - int x; - int y; - - // Loop through the images pixels to reset color. - for ( x = 0; x < image1->Width; x++ ) - { - for ( y = 0; y < image1->Height; y++ ) - { - Color pixelColor = image1->GetPixel( x, y ); - Color newColor = Color::FromArgb( pixelColor.R, 0, 0 ); - image1->SetPixel( x, y, newColor ); - - } - - } - - // Set the PictureBox to display the image. - PictureBox1->Image = image1; - - // Display the pixel format in Label1. - Label1->Text = String::Format( "Pixel format: {0}", image1->PixelFormat ); - } - catch ( ArgumentException^ ) - { - MessageBox::Show( "There was an error." - "Check the path to the image file." ); - } - - } - // - - // The following code example demonstrates how to obtain a new bitmap - // using the FromFile method. It also demonstrates a TextureBrush. - // This example is designed to be used with Windows Forms. Create - // a form containing a button named Button2. Paste the code into the form - // and associate the Button2_Click method with the button's Click event. - - // -private: - void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - try - { - Bitmap^ image1 = dynamic_cast(Image::FromFile( "C:\\Documents and Settings\\" - "All Users\\Documents\\My Music\\music.bmp", true )); - TextureBrush^ texture = gcnew TextureBrush( image1 ); - texture->WrapMode = System::Drawing::Drawing2D::WrapMode::Tile; - Graphics^ formGraphics = this->CreateGraphics(); - formGraphics->FillEllipse( texture, RectangleF(90.0F,110.0F,100,100) ); - delete formGraphics; - } - catch ( System::IO::FileNotFoundException^ ) - { - MessageBox::Show( "There was an error opening the bitmap." - "Please check the path." ); - } - } - // - - // The following code example demonstrates how to create a pen - // and set its DashStyle property. - // This example is designed to be used with Windows Forms. Create - // a form that contains a Button named Button3. Paste the code into the - // form and associate the Button3_Click method with the button's - // Click event. - - // -private: - void Button3_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Graphics^ buttonGraphics = Button3->CreateGraphics(); - Pen^ myPen = gcnew Pen( Color::ForestGreen,4.0F ); - myPen->DashStyle = System::Drawing::Drawing2D::DashStyle::DashDotDot; - Rectangle theRectangle = Button3->ClientRectangle; - theRectangle.Inflate( -2, -2 ); - buttonGraphics->DrawRectangle( myPen, theRectangle ); - delete buttonGraphics; - delete myPen; - } - // - - // The following code example demonstrates the Clear method. - // This example is designed to be used with Windows Forms. - // Create a form that contains a Button named Button4. - // Paste the code into the form and associate - // the Button4_Click method with the button's Click event. - - // -private: - void Button4_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Graphics^ buttonGraphics = Button4->CreateGraphics(); - buttonGraphics->Clear( Button4->BackColor ); - delete buttonGraphics; - } - // - - // The following code example demonstrates calling the Save method. - // This example is designed to be used with Windows Forms. - // Create a form that contains a button named Button5. - // Paste the code to the form and associate - // the Button5_Click method with button's Click event. - - // -private: - void Button5_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - try - { - if ( image1 != nullptr ) - { - image1->Save( "c:\\myBitmap.bmp" ); - Button5->Text = "Saved file."; - } - } - catch ( Exception^ ) - { - MessageBox::Show( "There was a problem saving the file." - "Check the file permissions." ); - } - } - // - - // this example was extracted from the "Reading Metadata" - // conceptual topic - // The following method demonstrates how to read and display - // the metadata in an image file using the PropertyItem class and - // PropertyItems property. - // This example is designed to be used a Windows Form that imports - // the System.Drawing.Imaging namespace. - // Paste the code into the form and change the path to fakePhoto.jpg - // to point to an image file on your system. Call the ExtractMetaData - // method when handling the form's Paint event, passing e as PaintEventArgs. - - // -private: - void ExtractMetaData( PaintEventArgs^ e ) - { - try - { - - // Create an Image object. - Image^ theImage = gcnew Bitmap( "c:\\fakePhoto.jpg" ); - - // Get the PropertyItems property from image. - array^propItems = theImage->PropertyItems; - - // Set up the display. - System::Drawing::Font^ font1 = gcnew System::Drawing::Font( "Arial",10 ); - SolidBrush^ blackBrush = gcnew SolidBrush( Color::Black ); - int X = 0; - int Y = 0; - - // For each PropertyItem in the array, display the id, - // type, and length. - int count = 0; - System::Collections::IEnumerator^ myEnum = propItems->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - PropertyItem^ propItem = safe_cast(myEnum->Current); - e->Graphics->DrawString( String::Format( "Property Item {0}", count ), font1, blackBrush, (float)X, (float)Y ); - Y += font1->Height; - e->Graphics->DrawString( String::Format( " ID: 0x{0}", propItem->Id.ToString( "x" ) ), font1, blackBrush, (float)X, (float)Y ); - Y += font1->Height; - e->Graphics->DrawString( String::Format( " type: {0}", propItem->Type ), font1, blackBrush, (float)X, (float)Y ); - Y += font1->Height; - e->Graphics->DrawString( String::Format( " length: {0} bytes", propItem->Len ), font1, blackBrush, (float)X, (float)Y ); - Y += font1->Height; - count += 1; - } - delete font1; - } - catch ( Exception^ ) - { - MessageBox::Show( "There was an error." - "Make sure the path to the image file is valid." ); - } - - } - // - - // - // The following code example demonstrates how to use the GetPropertyItem - // and SetPropertyItem methods. This example is designed to be used with Windows - // Forms. To run this example paste it into a form, and handle the form's Paint event - // by calling the DemonstratePropertyItem method, passing e as PaintEventArgs. - - // -private: - void DemonstratePropertyItem( PaintEventArgs^ e ) - { - // Create two images. - Image^ image1 = Image::FromFile( "c:\\FakePhoto1.jpg" ); - Image^ image2 = Image::FromFile( "c:\\FakePhoto2.jpg" ); - - // Get a PropertyItem from image1. - PropertyItem^ propItem = image1->GetPropertyItem( 20624 ); - - // Change the ID of the PropertyItem. - propItem->Id = 20625; - - // Set the PropertyItem for image2. - image2->SetPropertyItem( propItem ); - - // Draw the image. - e->Graphics->DrawImage( image2, 20.0F, 20.0F ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp deleted file mode 100644 index 0f706351c31..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp +++ /dev/null @@ -1,57 +0,0 @@ - - -// Snippet for: F:System.Drawing.Imaging.Encoder.ColorDepth -// Snippet for: F:System.Drawing.Imaging.Encoder.Compression -// Snippet for: F:System.Drawing.Imaging.Encoder.Quality -// -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); -int main() -{ - Bitmap^ myBitmap; - ImageCodecInfo^ myImageCodecInfo; - Encoder^ myEncoder; - EncoderParameter^ myEncoderParameter; - EncoderParameters^ myEncoderParameters; - - // Create a Bitmap object based on a BMP file. - myBitmap = gcnew Bitmap( "C:\\Documents and Settings\\All Users\\Documents\\My Music\\music.bmp" ); - - // Get an ImageCodecInfo object that represents the TIFF codec. - myImageCodecInfo = GetEncoderInfo( "image/tiff" ); - - // Create an Encoder object based on the GUID - // for the ColorDepth parameter category. - myEncoder = Encoder::ColorDepth; - - // Create an EncoderParameters object. - // An EncoderParameters object has an array of EncoderParameter - // objects. In this case, there is only one - // EncoderParameter object in the array. - myEncoderParameters = gcnew EncoderParameters( 1 ); - - // Save the image with a color depth of 24 bits per pixel. - myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(24) ); - myEncoderParameters->Param[ 0 ] = myEncoderParameter; - myBitmap->Save( "Shapes24bpp.tiff", myImageCodecInfo, myEncoderParameters ); -} - -static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) -{ - int j; - array^encoders; - encoders = ImageCodecInfo::GetImageEncoders(); - for ( j = 0; j < encoders->Length; ++j ) - { - if ( encoders[ j ]->MimeType == mimeType ) - return encoders[ j ]; - - } - return nullptr; -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp deleted file mode 100644 index 927ffac875b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Drawing::Imaging; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ClassicImageCodecExample -{ - /// - /// Summary description for Form1. - /// - public ref class ClassicImageCodecForm : public System::Windows::Forms::Form - { - /// - /// Required designer variable. - /// - private: - System::ComponentModel::Container^ components; - - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - GetImageEncodersExample(e); - } - - public: - ClassicImageCodecForm() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - /// - /// Clean up any resources being used. - /// - protected: - ~ClassicImageCodecForm() - { - if (components) - { - delete components; - } - } - -#pragma region^ Windows Form^ Designer generated^ code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private: - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container(); - this->Size = System::Drawing::Size(300, 300); - this->Text = "Form1"; - } -#pragma endregion - - - // Snippet for: - //M:System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders - // - private: - void GetImageEncodersExample(PaintEventArgs^ e) - { - // Get an array of available codecs. - array^ codecInfo; - codecInfo = ImageCodecInfo::GetImageEncoders(); - int numCodecs = codecInfo->GetLength(0); - - //numCodecs = 1; - - // Set up display variables. - Color^ foreColor = Color::Black; - Drawing::Font^ font = gcnew Drawing::Font("Arial", 8); - - // Check to determine whether any codecs were found. - if (numCodecs > 0) - { - // Set up an array to hold codec information. There are 9 - // information elements plus 1 space for each codec, so 10 - // times the number of codecs found is allocated. - array^ codecInfoStrings = - gcnew array(numCodecs * 10); - - // Write all the codec information to the array. - for (int i = 0; i < numCodecs; i++) - { - codecInfoStrings[i * 10] = "Codec Name = " + - codecInfo[i]->CodecName; - codecInfoStrings[(i * 10) + 1] = "Class ID = " + - codecInfo[i]->Clsid.ToString(); - codecInfoStrings[(i * 10) + 2] = "DLL Name = " + - codecInfo[i]->DllName; - codecInfoStrings[(i * 10) + 3] = "Filename Ext. = " + - codecInfo[i]->FilenameExtension; - codecInfoStrings[(i * 10) + 4] = "Flags = " + - codecInfo[i]->Flags.ToString(); - codecInfoStrings[(i * 10) + 5] = "Format Descrip. = " + - codecInfo[i]->FormatDescription; - codecInfoStrings[(i * 10) + 6] = "Format ID = " + - codecInfo[i]->FormatID.ToString(); - codecInfoStrings[(i * 10) + 7] = "MimeType = " + - codecInfo[i]->MimeType; - codecInfoStrings[(i * 10) + 8] = "Version = " + - codecInfo[i]->Version.ToString(); - codecInfoStrings[(i * 10) + 9] = " "; - } - int numCodecInfo = codecInfoStrings->GetLength(0); - - // Render all of the information to the screen. - int j = 20; - for (int i = 0; i < numCodecInfo; i++) - { - e->Graphics->DrawString(codecInfoStrings[i], - font, gcnew SolidBrush(*foreColor), 20, (float)j); - j += 12; - } - } - else - e->Graphics->DrawString("No Codecs Found", - font, gcnew SolidBrush(*foreColor), 20, 20); - } - // - - }; -} - -[STAThread] -int main() -{ - Application::Run(gcnew ClassicImageCodecExample::ClassicImageCodecForm()); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp deleted file mode 100644 index 4ac91a4c581..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp +++ /dev/null @@ -1,295 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); - - //UseTransparentProperty() - //Add any initialization after the InitializeComponent() call - } - -protected: - - //Form overrides dispose to clean up the component list. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::PictureBox^ PictureBox1; - System::Windows::Forms::Button^ Button2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; - this->Button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 184, 40 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Button1"; - - // - //PictureBox1 - // - this->PictureBox1->Location = System::Drawing::Point( 112, 160 ); - this->PictureBox1->Name = "PictureBox1"; - this->PictureBox1->Size = System::Drawing::Size( 128, 88 ); - this->PictureBox1->TabIndex = 3; - this->PictureBox1->TabStop = false; - - // - //Button2 - // - this->Button2->Location = System::Drawing::Point( 184, 88 ); - this->Button2->Name = "Button2"; - this->Button2->TabIndex = 2; - this->Button2->Text = "Button2"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->PictureBox1 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // The following code example demonstrates the following members: - // Rectangle.#ctor(PointF, SizeF) - // StringFormat#ctor(StringFormatFlags) - // StringFormat.#ctor(StringFormat) - // StringFormat.Alignment - // StringAlignment - // StringFormatFlags - // This example is designed to be used with - // Windows Forms. Paste the code into a form and call the - // ShowLineAndAlignment method when handling the form's Paint event, - // passing e as PaintEventArgs. - - // -private: - void ShowLineAndAlignment( PaintEventArgs^ e ) - { - // Construct a new Rectangle . - Rectangle displayRectangle = Rectangle(Point(40,40),System::Drawing::Size( 80, 80 )); - - // Construct 2 new StringFormat objects - StringFormat^ format1 = gcnew StringFormat( StringFormatFlags::NoClip ); - StringFormat^ format2 = gcnew StringFormat( format1 ); - - // Set the LineAlignment and Alignment properties for - // both StringFormat objects to different values. - format1->LineAlignment = StringAlignment::Near; - format1->Alignment = StringAlignment::Center; - format2->LineAlignment = StringAlignment::Center; - format2->Alignment = StringAlignment::Far; - - // Draw the bounding rectangle and a string for each - // StringFormat object. - e->Graphics->DrawRectangle( Pens::Black, displayRectangle ); - e->Graphics->DrawString( "Showing Format1", this->Font, Brushes::Red, displayRectangle, format1 ); - e->Graphics->DrawString( "Showing Format2", this->Font, Brushes::Red, displayRectangle, format2 ); - } - // - - // The following example shows how to set the Trimming property - // and how to use the StringTrimming enumeration. This example - // is designed to be used with a Windows Form. Paste this code - // into a form and call the ShowStringTrimming method when - // handling the form's Paint event, passing e as PaintEventArgs. - - // -private: - void ShowStringTrimming( PaintEventArgs^ e ) - { - StringFormat^ format1 = gcnew StringFormat; - String^ quote = "Not everything that can be counted counts," - " and not everything that counts can be counted."; - format1->Trimming = StringTrimming::EllipsisWord; - e->Graphics->DrawString( quote, this->Font, Brushes::Black, RectangleF(10.0F,10.0F,90.0F,50.0F), format1 ); - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ /*e*/ ) - { - //ShowLineAndAlignment(e) - //DemonstrateBlend(e) - //ShowStringTrimming(e) - } - - // The following code example demonstrates how to use the - // Transparent property. - // This example is designed to be used with Windows Forms. - // Paste the code into a form that contains two buttons named Button1 - // and Button2. Call the UseTransparentProperty method in the - // form's constructor. - - // -private: - void UseTransparentProperty() - { - // Set up the PictureBox to display the entire image, and - // to cover the entire client area. - PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; - PictureBox1->Dock = DockStyle::Fill; - try - { - // Set the Image property of the PictureBox to an image retrieved - // from the file system. - PictureBox1->Image = Image::FromFile( "C:\\Documents and Settings\\All Users\\" - "Documents\\My Pictures\\Sample Pictures\\sunset.jpg" ); - - // Set the Parent property of Button1 and Button2 to the - // PictureBox. - Button1->Parent = PictureBox1; - Button2->Parent = PictureBox1; - - // Set the Color property of both buttons to transparent. - // With this setting the buttons assume the color of their - // parent. - Button1->BackColor = Color::Transparent; - Button2->BackColor = Color::Transparent; - } - catch ( System::IO::FileNotFoundException^ ) - { - MessageBox::Show( "There was an error." - "Make sure the image file path is valid." ); - } - } - // - - // The following code example demonstrates how to use the equality - // operator and construct a Point from a Size. It also - // demonstrates the use of the X and Y properties. - // This example is designed to be used with Windows Forms. - // Paste the code into a form that contains a button named Button1 - // and associate the Button1_Click method with the button's Click event. - - // -private: - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Construct a new Point with integers. - Point Point1 = Point(100,100); - - // Create a Graphics object. - Graphics^ formGraphics = this->CreateGraphics(); - - // Construct another Point, this time using a Size. - Point Point2 = Point(System::Drawing::Size( 100, 100 )); - - // Call the equality operator to see if the points are equal, - // and if so print out their x and y values. - if ( Point1 == Point2 ) - { - array^temp0 = {Point1.X,Point2.X,Point1.Y,Point2.Y}; - formGraphics->DrawString( String::Format( "Point1.X: " - "{0},Point2.X: {1}, Point1.Y: {2}, Point2.Y {3}", temp0 ), this->Font, Brushes::Black, PointF(10,70) ); - } - } - // - - // The following code example demonstrates how to use the Name - // property of a Color. - // This example is designed to be used with Windows Forms. - // Paste the code into a form that contains a button named Button2 - // and associate the Button2_Click method with the button's - // Click event. - - // -private: - void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Button2->Width = 100; - Button2->Text = String::Format( "Color: {0}", Button2->BackColor.Name ); - } - // - - // The following code example demonstrates how to use the Blend - // class by setting the Factors and Positions properties. - // This example is designed to be used with Windows Forms. - // Paste the code into a form that imports the - // System.Drawing.Drawing2D namespace. Handle the form's Paint - // event and call the DemonstrateBlend method, passing e as - // PaintEventArgs. - - // -private: - void DemonstrateBlend( PaintEventArgs^ e ) - { - Blend^ blend1 = gcnew Blend( 9 ); - - // Set the values in the Factors array to be all green, - // go to all blue, and then go back to green. - array^temp0 = {0.0F,0.2F,0.5F,0.7F,1.0F,0.7F,0.5F,0.2F,0.0F}; - blend1->Factors = temp0; - - // Set the positions. - array^temp1 = {0.0F,0.1F,0.3F,0.4F,0.5F,0.6F,0.7F,0.8F,1.0F}; - blend1->Positions = temp1; - - // Declare a rectangle to draw the Blend in. - Rectangle rectangle1 = Rectangle(10,10,120,100); - - // Create a new LinearGradientBrush using the rectangle, - // green and blue. and 90-degree angle. - LinearGradientBrush^ brush1 = gcnew LinearGradientBrush( rectangle1,Color::LightGreen,Color::Blue,90,true ); - - // Set the Blend property on the brush to the custom blend. - brush1->Blend = blend1; - - // Fill in an ellipse with the brush. - e->Graphics->FillEllipse( brush1, rectangle1 ); - - // Dispose of the custom brush. - delete brush1; - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp deleted file mode 100644 index dae28d99350..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp +++ /dev/null @@ -1,489 +0,0 @@ - - -#using -#using -#using - -using namespace System::Drawing; -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing::Drawing2D; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - PopulateListBoxWithFonts(); - PopulateListBoxWithGraphicsResolution(); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //listBox1 - // - this->listBox1->Location = System::Drawing::Point( 88, 112 ); - this->listBox1->Name = "listBox1"; - this->listBox1->Size = System::Drawing::Size( 120, 95 ); - this->listBox1->TabIndex = 0; - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 120, 24 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 1; - this->Button1->Text = "Button1"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->listBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // The following code example shows all the font families in the - // Families property of the FontFamily class. This example is - // designed to be used with a Windows Form. To run this example, - // add a ListBox named listBox1 to a form and call the - // PopulateListBoxWithFonts method from the form's constructor. - - // -private: - void PopulateListBoxWithFonts() - { - listBox1->Width = 200; - listBox1->Location = Point(40,120); - System::Collections::IEnumerator^ myEnum = FontFamily::Families->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - FontFamily^ oneFontFamily = safe_cast(myEnum->Current); - listBox1->Items->Add( oneFontFamily->Name ); - } - } - // - - // The following method shows the use of the DpiX and DpiY - // properties. This example is designed for use with a Windows Form. - // To run this example, paste it into a form that contains a ListBox named - // listBox1 and call this method from the form's constructor or Load event. - - // -private: - void PopulateListBoxWithGraphicsResolution() - { - Graphics^ boxGraphics = listBox1->CreateGraphics(); - - // Graphics* formGraphics = this->CreateGraphics(); - listBox1->Items->Add( String::Format( "ListBox horizontal resolution: {0}", boxGraphics->DpiX ) ); - listBox1->Items->Add( String::Format( "ListBox vertical resolution: {0}", boxGraphics->DpiY ) ); - delete boxGraphics; - } - // - - // The following code example shows how to set a keyboard shortcut - // when drawing a string with the Graphics object. It also - // demonstrates how to use the SystemBrush.FromSystemColor method. To - // run this example, paste the code into a form, handle the form's - // Paint event, and call the following method, passing e as - // PaintEventArgs. - - // -private: - void ShowHotKey( PaintEventArgs^ e ) - { - // Declare the string with a keyboard shortcut. - String^ text = "&Click Here"; - - // Declare a new StringFormat. - StringFormat^ format = gcnew StringFormat; - - // Set the HotkeyPrefix property. - format->HotkeyPrefix = System::Drawing::Text::HotkeyPrefix::Show; - - // Draw the string. - Brush^ theBrush = SystemBrushes::FromSystemColor( SystemColors::Highlight ); - e->Graphics->DrawString( text, this->Font, theBrush, 30, 40, format ); - } - // - - // The following code example adds a shadow to a ListBox using the - // following members: - // Size.opImplicit - // SizeF.opAddition - // Point.opImplicit - // PointF.opAddition - // SolidBrush - // This example is designed to be used with a Windows Form. - // To run this example, paste this code into a form and call the - // AddShadow method when handling the form's Paint event. Make - // sure the form contains a ListBox named listBox1. - - // -private: - void AddShadow( PaintEventArgs^ e ) - { - // Create two SizeF objects. - SizeF shadowSize = listBox1->Size; - SizeF addSize = SizeF(10.5F,20.8F); - - // Add them together and save the result in shadowSize. - shadowSize = shadowSize + addSize; - - // Get the location of the ListBox and convert it to a PointF. - PointF shadowLocation = listBox1->Location; - - // Add two points to get a new location. - shadowLocation = shadowLocation + System::Drawing::Size( 5, 5 ); - - // Create a rectangleF. - RectangleF rectFToFill = RectangleF(shadowLocation,shadowSize); - - // Create a custom brush using a semi-transparent color, and - // then fill in the rectangle. - Color customColor = Color::FromArgb( 50, Color::Gray ); - SolidBrush^ shadowBrush = gcnew SolidBrush( customColor ); - array^ temp0 = {rectFToFill}; - e->Graphics->FillRectangles( shadowBrush, temp0 ); - - // Dispose of the brush. - delete shadowBrush; - } - // - -public: - - // The following code example demonstrates using a Matrix - // and the GraphicsPath.Transform method to rotate a string. - // This example is designed to be used with Windows Forms. - // Create a form and paste the following code into it. Call the - // DrawVerticalStringFromBottomUp method in the form's Paint - // event-handling method, passing e as PaintEventArgs. - - // -private: - void DrawVerticalStringFromBottomUp( PaintEventArgs^ e ) - { - // Create the string to draw on the form. - String^ text = "Can you read this?"; - - // Create a GraphicsPath. - System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath; - - // Add the string to the path; declare the font, font style, size, and - // vertical format for the string. - path->AddString( text, this->Font->FontFamily, 1, 15, PointF(0.0F,0.0F), gcnew StringFormat( StringFormatFlags::DirectionVertical ) ); - - // Declare a matrix that will be used to rotate the text. - System::Drawing::Drawing2D::Matrix^ rotateMatrix = gcnew System::Drawing::Drawing2D::Matrix; - - // Set the rotation angle and starting point for the text. - rotateMatrix->RotateAt( 180.0F, PointF(10.0F,100.0F) ); - - // Transform the text with the matrix. - path->Transform(rotateMatrix); - - // Set the SmoothingMode to high quality for best readability. - e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::HighQuality; - - // Fill in the path to draw the string. - e->Graphics->FillPath( Brushes::Red, path ); - - // Dispose of the path. - delete path; - } - // - - // The following code example demonstrates how to use the KnownColor enum - // to print out the name and colors of all its values. This example is - // designed to be used with Windows Forms. Create a form and paste - // the following code into it. Call the DisplayKnownColors method in the - // form's Paint event-handling method, passing e as PaintEventArgs. - - // -private: - void DisplayKnownColors( PaintEventArgs^ e ) - { - this->Size = System::Drawing::Size( 650, 550 ); - - // Get all the values from the KnownColor enumeration. - System::Array^ colorsArray = Enum::GetValues( KnownColor::typeid ); - array^allColors = gcnew array(colorsArray->Length); - Array::Copy( colorsArray, allColors, colorsArray->Length ); - - // Loop through printing out the values' names in the colors - // they represent. - float y = 0; - float x = 10.0F; - for ( int i = 0; i < allColors->Length; i++ ) - { - // If x is a multiple of 30, start a new column. - if ( i > 0 && i % 30 == 0 ) - { - x += 105.0F; - y = 15.0F; - } - else - { - // Otherwise, increment y by 15. - y += 15.0F; - } - - // Create a custom brush from the color and use it to draw - // the brush's name. - SolidBrush^ aBrush = gcnew SolidBrush( Color::FromName( allColors[ i ].ToString() ) ); - e->Graphics->DrawString( allColors[ i ].ToString(), this->Font, aBrush, x, y ); - - // Dispose of the custom brush. - delete aBrush; - } - } - // - - // The following code example demonstrates how to use the MakeEmpty - // method. This example is designed to be used with Windows Forms. - // Create a form and paste the following code into it. Call the - // FillEmptyRegion method in the form's Paint event-handling method, - // passing e as PaintEventArgs. - - // -private: - void FillEmptyRegion( PaintEventArgs^ e ) - { - // Create a region from a rectangle. - Rectangle originalRectangle = Rectangle(40,40,40,50); - System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle ); - - // Call MakeEmpty. - smallRegion->MakeEmpty(); - - // Fill the region in red and draw the original rectangle - // in black. Note there is nothing filled in. - e->Graphics->FillRegion( Brushes::Red, smallRegion ); - e->Graphics->DrawRectangle( Pens::Black, originalRectangle ); - } - // - - // The following code example demonstrates how to use the MakeInfinite - // method. This example is designed to be used with Windows Forms. - // Create a form and paste the following code into it. Call the - // FillInfiniteRegion method in the form's Paint event-handling method, - // passing e as PaintEventArgs. - - // -private: - void FillInfiniteRegion( PaintEventArgs^ e ) - { - // Create a region from a rectangle. - Rectangle originalRectangle = Rectangle(40,40,40,50); - System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle ); - - // Call MakeInfinite. - smallRegion->MakeInfinite(); - - // Fill the region in red and draw the original rectangle - // in black. Note that the entire form is filled in. - e->Graphics->FillRegion( Brushes::Red, smallRegion ); - e->Graphics->DrawRectangle( Pens::Black, originalRectangle ); - } - // - - // The following code example demonstrates how to use the ToBitmap - // method. This example is designed to be used with Windows Forms. - // Create a form and paste the following code into it. Call the - // IconToBitmap method in the form's Paint event-handling method, - // passing e as PaintEventArgs. - - // -private: - void IconToBitmap( PaintEventArgs^ e ) - { - // Construct an Icon. - System::Drawing::Icon^ icon1 = gcnew System::Drawing::Icon( SystemIcons::Exclamation,40,40 ); - - // Call ToBitmap to convert it. - Bitmap^ bmp = icon1->ToBitmap(); - - // Draw the bitmap. - e->Graphics->DrawImage( bmp, Point(30,30) ); - } - // - - // The following code example demonstrates how to use the - // TranslateTransform method. This example is designed to be used - // with Windows Forms. Create a form and paste the following code - // into it. Call the TranslateAndTransform method in the form's - // Paint event-handling method, passing e as PaintEventArgs. - - // -private: - void TranslateAndTransform( PaintEventArgs^ e ) - { - // Create a GraphicsPath. - System::Drawing::Drawing2D::GraphicsPath^ myPath = gcnew System::Drawing::Drawing2D::GraphicsPath; - - // Create a rectangle. - RectangleF layoutRectangle = RectangleF(20.0F,20.0F,40.0F,50.0F); - - // Add the rectangle to the path. - myPath->AddRectangle( layoutRectangle ); - - // Add a string to the path. - myPath->AddString( "Path", this->Font->FontFamily, 2, 10.0F, layoutRectangle, gcnew StringFormat( StringFormatFlags::NoWrap ) ); - - // Draw the path. - e->Graphics->DrawPath( Pens::Black, myPath ); - - // Call TranslateTransform and draw the path again. - e->Graphics->TranslateTransform( 10.0F, 10.0F ); - e->Graphics->DrawPath( Pens::Red, myPath ); - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - //FillEmptyRegion(e) - //SetAndFillClip(e) - //FillInfiniteRegion(e) - //ShowHotKey(e) - //AddShadow(e) - //IconToBitmap(e) - //DisplayKnownColors(e) - //DrawVerticalStringFromBottomUp(e) - TranslateAndTransform( e ); - } - - // The following code example demonstrates how to set the Font property of - // a button to a new, bold-style Font. This example is designed to be - // used with Windows Forms. Create a form containing a button named - // Button1 and paste the following code into it. Associate the - // Button1_Click method with the button's Click event. - - // -private: - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Button1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,12.0F,FontStyle::Bold ); - } - // - - // The following code example demonstrates how to construct a Region - // using the RegionData class. This example is designed to be used with Windows - // Forms. To run this example paste it into a form and handle the form's Paint event - // by calling the DemonstrateRegionData method, passing e as PaintEventArgs. - - // -private: - void DemonstrateRegionData( PaintEventArgs^ e ) - { - //Create a simple region. - System::Drawing::Region^ region1 = gcnew System::Drawing::Region( Rectangle(10,10,100,100) ); - - // Extract the region data. - System::Drawing::Drawing2D::RegionData^ region1Data = region1->GetRegionData(); - - // Create a new region using the region data. - System::Drawing::Region^ region2 = gcnew System::Drawing::Region( region1Data ); - - // Dispose of the first region. - delete region1; - - // Call ExcludeClip passing in the second region. - e->Graphics->ExcludeClip( region2 ); - - // Fill in the client rectangle. - e->Graphics->FillRectangle( Brushes::Red, this->ClientRectangle ); - delete region2; - } - // - - // The following code example demonstrates how use the Data from - // one region to set the Data for another region. This example is designed - // to be used with Windows Forms. To run this example paste - // it into a form and handle the form's Paint event - // by calling the DemonstrateRegionData2 method, passing e as PaintEventArgs. - - // -private: - void DemonstrateRegionData2( PaintEventArgs^ e ) - { - //Create a simple region. - System::Drawing::Region^ region1 = gcnew System::Drawing::Region( Rectangle(10,10,100,100) ); - - // Extract the region data. - System::Drawing::Drawing2D::RegionData^ region1Data = region1->GetRegionData(); - array^data1; - data1 = region1Data->Data; - - // Create a second region. - System::Drawing::Region^ region2 = gcnew System::Drawing::Region; - - // Get the region data for the second region. - System::Drawing::Drawing2D::RegionData^ region2Data = region2->GetRegionData(); - - // Set the Data property for the second region to the Data from the first region. - region2Data->Data = data1; - - // Construct a third region using the modified RegionData of the second region. - System::Drawing::Region^ region3 = gcnew System::Drawing::Region( region2Data ); - - // Dispose of the first and second regions. - delete region1; - delete region2; - - // Call ExcludeClip passing in the third region. - e->Graphics->ExcludeClip( region3 ); - - // Fill in the client rectangle. - e->Graphics->FillRectangle( Brushes::Red, this->ClientRectangle ); - delete region3; - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp deleted file mode 100644 index 11e540192ad..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp +++ /dev/null @@ -1,169 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - components = gcnew System::ComponentModel::Container; - this->Text = "Form1"; - } - - // The following method demonstrates the effects of setting - // the LineJoin property on a Pen object. - // This example is designed to be used with Windows Forms. - // Paste the code into a form and call the ShowLineJoin method when - // handling the form's Paint event, passing e as PaintEventArgs. - // -private: - void ShowLineJoin( PaintEventArgs^ e ) - { - // Create a new pen. - Pen^ skyBluePen = gcnew Pen( Brushes::DeepSkyBlue ); - - // Set the pen's width. - skyBluePen->Width = 8.0F; - - // Set the LineJoin property. - skyBluePen->LineJoin = System::Drawing::Drawing2D::LineJoin::Bevel; - - // Draw a rectangle. - e->Graphics->DrawRectangle( skyBluePen, Rectangle(40,40,150,200) ); - - //Dispose of the pen. - delete skyBluePen; - } - // - - // The following method demonstrates the effects of setting - // the StartCap and EndCap properties on a Pen object. - // This example is designed to be used with Windows Forms. - // Paste the code into a form and call the ShowStartAndEndCaps - // method when handling the form's Paint event, passing e - // as PaintEventArgs. - // -private: - void ShowStartAndEndCaps( PaintEventArgs^ e ) - { - // Create a new custom pen. - Pen^ redPen = gcnew Pen( Brushes::Red,6.0F ); - - // Set the StartCap property. - redPen->StartCap = System::Drawing::Drawing2D::LineCap::RoundAnchor; - - // Set the EndCap property. - redPen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor; - - // Draw a line. - e->Graphics->DrawLine( redPen, 40.0F, 40.0F, 145.0F, 185.0F ); - - // Dispose of the custom pen. - delete redPen; - } - // - - // The following method demonstrates the effects of setting - // the DashCap, DashPattern and SmoothingMode properties - // of a Pen object. - // This example is designed to be used with Windows Forms. - // Paste the code into a form and call the ShowPensAndSmoothingMode - // method when handling the form's Paint event, passing e as - // PaintEventArgs. - // -private: - void ShowPensAndSmoothingMode( PaintEventArgs^ e ) - { - // Set the SmoothingMode property to smooth the line. - e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::AntiAlias; - - // Create a new Pen object. - Pen^ greenPen = gcnew Pen( Color::Green ); - - // Set the width to 6. - greenPen->Width = 6.0F; - - // Set the DashCap to round. - greenPen->DashCap = System::Drawing::Drawing2D::DashCap::Round; - - // Create a custom dash pattern. - array^temp0 = {4.0F,2.0F,1.0F,3.0F}; - greenPen->DashPattern = temp0; - - // Draw a line. - e->Graphics->DrawLine( greenPen, 20.0F, 20.0F, 100.0F, 240.0F ); - - // Change the SmoothingMode to none. - e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None; - - // Draw another line. - e->Graphics->DrawLine( greenPen, 100.0F, 240.0F, 160.0F, 20.0F ); - - // Dispose of the custom pen. - delete greenPen; - } - // - - // The following method demonstrates how to use the Pens class. - // This example is designed to be used with Windows Forms. - // Paste the code into a form and call the UsePensClass method - // when handling the form's Paint event, passing e as PaintEventArgs. - // -private: - void UsePensClass( PaintEventArgs^ e ) - { - e->Graphics->DrawEllipse( Pens::SlateBlue, Rectangle(40,40,140,140) ); - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - UsePensClass( e ); - ShowPensAndSmoothingMode( e ); - ShowStartAndEndCaps( e ); - ShowLineJoin( e ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp deleted file mode 100644 index a236d196d68..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp +++ /dev/null @@ -1,268 +0,0 @@ - - -#using -#using -#using - -using namespace System::Drawing; -using namespace System; -using namespace System::Windows::Forms; - -// The following code example demonstrates how to override the -// OnClosed method on a class derived from Form. -// -public ref class myForm: public Form -{ -protected: - virtual void OnClosed( EventArgs^ e ) override - { - MessageBox::Show( "The form is now closing.", "Close Warning", MessageBoxButtons::OK, MessageBoxIcon::Warning ); - Form::OnClosed( e ); - } - -public: - myForm() - : Form() - {} - -}; -// - -public ref class Form1: public myForm -{ -public: - Form1() - : myForm() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - addButton->Click += gcnew EventHandler( this, &Form1::addButton_Click ); - subtractButton->Click += gcnew EventHandler( this, &Form1::subtractButton_Click ); - TruncateAndRoundSizes(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ subtractButton; - System::Windows::Forms::Button^ addButton; - System::Windows::Forms::Label ^ Label1; - System::Windows::Forms::Label ^ Label2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->subtractButton = gcnew System::Windows::Forms::Button; - this->addButton = gcnew System::Windows::Forms::Button; - this->Label1 = gcnew System::Windows::Forms::Label; - this->Label2 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - //subtractButton - // - this->subtractButton->Location = System::Drawing::Point( 192, 40 ); - this->subtractButton->Name = "subtractButton"; - this->subtractButton->TabIndex = 0; - this->subtractButton->Text = "subtractButton"; - - // - //addButton - // - this->addButton->Location = System::Drawing::Point( 192, 80 ); - this->addButton->Name = "addButton"; - this->addButton->TabIndex = 1; - this->addButton->Text = "addButton"; - - // - //Label1 - // - this->Label1->Location = System::Drawing::Point( 24, 192 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 240, 23 ); - this->Label1->TabIndex = 2; - this->Label1->Text = "Label1"; - - // - //Label2 - // - this->Label2->Location = System::Drawing::Point( 24, 224 ); - this->Label2->Name = "Label2"; - this->Label2->Size = System::Drawing::Size( 240, 23 ); - this->Label2->TabIndex = 3; - this->Label2->Text = "Label2"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label2 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->addButton ); - this->Controls->Add( this->subtractButton ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // The following code example creates points and sizes using several - // of the overloaded operators defined for these types. It also - // demonstrates how to use a SystemPen. - // This example is designed to be used with Windows Forms. Create - // a form that contains a Button named subtractButton. Paste the - // code into the form and call the CreatePointsAndSizes method - // from the form's Paint event-handling method, passing e as - // PaintEventArgs. - // - void CreatePointsAndSizes( PaintEventArgs^ e ) - { - // Create the starting point. - Point startPoint = Point(subtractButton->Size); - - // Use the addition operator to get the end point. - Point endPoint = startPoint + System::Drawing::Size( 140, 150 ); - - // Draw a line between the points. - e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint ); - - // Convert the starting point to a size and compare it to the - // subtractButton size. - System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint; - if ( buttonSize == subtractButton->Size ) - { - e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F ); - } - } - // - - // The following code example demonstrates the G,B,R, and A - // properties of a Color and the Size.op_Implicit member. - // This example is designed to be used with a Windows Form. - // Paste the code into the form and call the - // ShowPropertiesOfSlateBlue method from the form's Paint - // event-handling method, passing e as PaintEventArgs. - // - void ShowPropertiesOfSlateBlue( PaintEventArgs^ e ) - { - Color slateBlue = Color::FromName( "SlateBlue" ); - Byte g = slateBlue.G; - Byte b = slateBlue.B; - Byte r = slateBlue.R; - Byte a = slateBlue.A; - array^temp0 = {a,r,g,b}; - String^ text = String::Format( "Slate Blue has these ARGB values: Alpha:{0}, " - "red:{1}, green: {2}, blue {3}", temp0 ); - e->Graphics->DrawString( text, gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), gcnew SolidBrush( slateBlue ), RectangleF(PointF(0.0F,0.0F),this->Size) ); - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - - //CreatePointsAndSizes(e) - ShowPropertiesOfSlateBlue( e ); - } - - // The following code example demonstrates the Subtraction operator. - // The example is designed to be used with Windows Forms. - // To run the example, paste it into a form that contains a button - // named subtractionButton and associate this method with the - // button's Click event. - // - void subtractButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - subtractButton->Size = subtractButton->Size - System::Drawing::Size( 10, 10 ); - } - // - - // The following code example demonstrates the Addition operator. - // The example is designed to be used with Windows Forms. To run - // this example, paste it into a form that contains a button named - // addButton and associate this method with the button's Click event. - // - void addButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - addButton->Size = addButton->Size + System::Drawing::Size( 10, 10 ); - } - // - - // The following code example demonstrates how to use static Round - // and Truncate methods to convert a SizeF to a Size. This example is - // designed to be used with Windows Forms. To run this example paste - // it into a form that contains two Label objects named Label1 - // and Label2 and then call this method from the form's constructor. - // - void TruncateAndRoundSizes() - { - // Create a SizeF. - SizeF theSize = SizeF(75.9F,75.9F); - - // Round the Size. - System::Drawing::Size roundedSize = ::Size::Round( theSize ); - - // Truncate the Size. - System::Drawing::Size truncatedSize = ::Size::Truncate( theSize ); - - //Print out the values on two labels. - Label1->Text = String::Format( "Rounded size = {0}", roundedSize ); - Label2->Text = String::Format( "Truncated size = {0}", truncatedSize ); - } - // - - // The following code example demonstrates how to use the - // Point#ctor(int) and Size#ctor(int, int) constructors and the - // ContentAlignment enumeration. To run this example paste this code into - // a Windows Form that contains a label named Label1 and call the - // IntializeLabel1 method in the form's constructor. - // - void InitializeLabel1() - { - // Set a border. - Label1->BorderStyle = BorderStyle::FixedSingle; - - // Set the size, constructing a size from two integers. - Label1->Size = System::Drawing::Size( 100, 50 ); - - // Set the location, constructing a point from a 32-bit integer - // (using hexadecimal). - Label1->Location = Point(0x280028); - - // Set and align the text on the lower-right side of the label. - Label1->TextAlign = ContentAlignment::BottomRight; - Label1->Text = "Bottom Right Alignment"; - } - // - - void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - TruncateAndRoundSizes(); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp deleted file mode 100644 index a51a30d47b7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp +++ /dev/null @@ -1,275 +0,0 @@ - - -#using -#using -#using - -using namespace System::Drawing::Drawing2D; -using namespace System::Drawing; -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); - DrawFirstRectangle(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 208, 16 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Button1"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // The following code example demonstrates creating a rectangle - // using the FromLTRB method. This example is designed to - // be used with a Windows Form. Paste this code into a form - // and call the CreateARectangleFromLTRB method when handling - // the form's Paint event, passing e as PaintEventArgs. - // -private: - void CreateARectangleFromLTRB( PaintEventArgs^ e ) - { - Rectangle myRectangle = Rectangle::FromLTRB( 40, 40, 140, 240 ); - e->Graphics->DrawRectangle( SystemPens::ControlText, myRectangle ); - } - // - - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ /*e*/ ) - { - //ConvertRectangleToRectangleF(e) - //RoundingAndTruncatingRectangles(e); - } - - // The following code example demonstrates the static (Shared in - // Visual Basic) Intersects method. This example should be used - // with a Windows form. Paste this code into a form - // and call this method when handling the form's Paint event, - // passing e as PaintEventArgs. - // -private: - void StaticRectangleIntersection( PaintEventArgs^ e ) - { - Rectangle rectangle1 = Rectangle(50,50,200,100); - Rectangle rectangle2 = Rectangle(70,20,100,200); - e->Graphics->DrawRectangle( Pens::Black, rectangle1 ); - e->Graphics->DrawRectangle( Pens::Red, rectangle2 ); - if ( rectangle1.IntersectsWith( rectangle2 ) ) - { - Rectangle rectangle3 = Rectangle::Intersect( rectangle1, rectangle2 ); - if ( !rectangle3.IsEmpty ) - { - e->Graphics->FillRectangle( Brushes::Green, rectangle3 ); - } - } - } - // - - // The following code example demonstrates the instance - // version of the Intersects method. This example should be used - // with a Windows form. Paste this code into a form - // and call this method when handling the form's Paint event, - // passing e as PaintEventArgs. - // -private: - void InstanceRectangleIntersection( PaintEventArgs^ e ) - { - Rectangle rectangle1 = Rectangle(50,50,200,100); - Rectangle rectangle2 = Rectangle(70,20,100,200); - e->Graphics->DrawRectangle( Pens::Black, rectangle1 ); - e->Graphics->DrawRectangle( Pens::Red, rectangle2 ); - if ( rectangle1.IntersectsWith( rectangle2 ) ) - { - rectangle1.Intersect( rectangle2 ); - if ( !rectangle1.IsEmpty ) - { - e->Graphics->FillRectangle( Brushes::Green, rectangle1 ); - } - } - } - // - - // The following code example demonstrates the Contains method - // and the SystemPens class. - // This example is designed for use with a Windows Form. Paste - // this code into a form that contains a Button named Button1, - // call DrawFirstRectangle from the form's constructor - // or Load method and associate the Button1_Click method with - // the button's Click event. - // -private: - [UIPermission(SecurityAction::Demand, Window=UIPermissionWindow::AllWindows)] - void DrawFirstRectangle() - { - Rectangle rectangle1 = Rectangle(70,70,100,150); - ControlPaint::DrawReversibleFrame( rectangle1, SystemColors::Highlight, FrameStyle::Thick ); - } - - void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Rectangle rectangle1 = Rectangle(70,70,100,150); - - // Get the bounds of the screen. - Rectangle screenRectangle = Screen::PrimaryScreen->Bounds; - - // Check to see if the rectangle is within the bounds of the screen. - if ( screenRectangle.Contains( rectangle1 ) ) - { - ControlPaint::DrawReversibleFrame( rectangle1, SystemColors::Highlight, FrameStyle::Thick ); - - // Call the Offset method to move the rectangle. - rectangle1.Offset( 20, 20 ); - - // Draw the new, offset rectangle. - ControlPaint::DrawReversibleFrame( rectangle1, SystemColors::Highlight, FrameStyle::Thick ); - } - } - // - - // The following code example demonstrates the Union method. This - // example is designed for use with a Windows Form. Paste this code - // into a form and call this method when handling the form's - // Paint event, passing e as PaintEventArgs. - // -private: - void ShowRectangleUnion( PaintEventArgs^ e ) - { - // Declare two rectangles and draw them. - Rectangle rectangle1 = Rectangle(30,40,50,100); - Rectangle rectangle2 = Rectangle(50,60,100,60); - e->Graphics->DrawRectangle( Pens::Sienna, rectangle1 ); - e->Graphics->DrawRectangle( Pens::BlueViolet, rectangle2 ); - - // Declare a third rectangle as a union of the first two. - Rectangle rectangle3 = Rectangle::Union( rectangle1, rectangle2 ); - - // Fill in the third rectangle in a semi-transparent color. - Color transparentColor = Color::FromArgb( 40, 135, 135, 255 ); - e->Graphics->FillRectangle( gcnew SolidBrush( transparentColor ), rectangle3 ); - } - // - - // The following code example demonstrates how to use the Round - // and Truncate methods. - // This example is designed for use with a Windows Form. Paste this code - // into a form and call the RoundingAndTruncatingRectangles method - // when handling the form's Paint event, passing e as PaintEventArgs. - // -private: - void RoundingAndTruncatingRectangles( PaintEventArgs^ e ) - { - // Construct a new RectangleF. - RectangleF myRectangleF = RectangleF(30.6F,30.7F,40.8F,100.9F); - - // Call the Round method. - Rectangle roundedRectangle = Rectangle::Round( myRectangleF ); - - // Draw the rounded rectangle in red. - Pen^ redPen = gcnew Pen( Color::Red,4.0f ); - e->Graphics->DrawRectangle( redPen, roundedRectangle ); - - // Call the Truncate method. - Rectangle truncatedRectangle = Rectangle::Truncate( myRectangleF ); - - // Draw the truncated rectangle in white. - Pen^ whitePen = gcnew Pen( Color::White,4.0f ); - e->Graphics->DrawRectangle( whitePen, truncatedRectangle ); - - // Dispose of the custom pens. - delete redPen; - delete whitePen; - } - // - - // The following code example demonstrates how to convert - // a Rectangle object to a RectangleF using the Implicit operator. - // This example is designed for use with a Windows Form. Paste - // this code into a form and call the ConvertRectangleToRectangleF - // method when handling the form's Paint event, passing e as - // PaintEventArgs. - // -private: - void ConvertRectangleToRectangleF( PaintEventArgs^ e ) - { - // Create a rectangle. - Rectangle rectangle1 = Rectangle(30,40,50,100); - - // Convert it to a RectangleF. - RectangleF convertedRectangle = rectangle1; - - // Create a new RectangleF. - RectangleF rectangle2 = RectangleF(PointF(30.0F,40.0F),SizeF(50.0F,100.0F)); - - // Create a custom, partially transparent brush. - SolidBrush^ redBrush = gcnew SolidBrush( Color::FromArgb( 40, Color::Red ) ); - - // Compare the converted rectangle with the new one. If they - // are equal draw and fill the rectangles on the form. - if ( convertedRectangle == rectangle2 ) - { - e->Graphics->FillRectangle( redBrush, rectangle2 ); - } - - // Dispose of the custom brush. - delete redBrush; - } -}; -// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp deleted file mode 100644 index 08655fa9a42..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp +++ /dev/null @@ -1,270 +0,0 @@ -#using -#using -#using -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::ComponentModel; - -public ref class Form1 : public Form -{ -private: - Button^ button1; -public: - Form1() - { - button1 = gcnew Button(); - this->Controls->Add(button1); - } - - // -private: - static Image^ GetImageOfCustomControl(Control^ userControl) - { - Image^ controlImage = nullptr; - AttributeCollection^ attrCol = - TypeDescriptor::GetAttributes(userControl); - ToolboxBitmapAttribute^ imageAttr = (ToolboxBitmapAttribute^) - attrCol[ToolboxBitmapAttribute::typeid]; - if (imageAttr != nullptr) - { - controlImage = imageAttr->GetImage(userControl); - } - - return controlImage; - } - // -}; - -// The following code example demonstrates how to use the -// ToolBoxBitmapAttribute#ctor(string) costructor to set stop.bmp -// as the toolbox icon for the StopSignControl. This example assumes -// the existence of a 16-by-16-pixel bitmap named stop.bmp at c:\. -// -[ToolboxBitmap("c:\\stop.bmp")] -public ref class StopSignControl: - public System::Windows::Forms::UserControl -{ -private: - Label^ label1; -private: - Button^ button1; - -public: - StopSignControl() : UserControl() - { - this->label1 = gcnew System::Windows::Forms::Label(); - this->button1 = gcnew System::Windows::Forms::Button(); - - this->label1->Font = gcnew System::Drawing::Font( - "Microsoft Sans Serif", 12.0F, - System::Drawing::FontStyle::Regular, - System::Drawing::GraphicsUnit::Point, ((Byte) 0)); - - this->label1->ForeColor = System::Drawing::Color::Red; - this->label1->Location = System::Drawing::Point(24, 56); - this->label1->Name = "Label1"; - this->label1->TabIndex = 0; - this->label1->Text = "Stop!"; - this->label1->TextAlign = - System::Drawing::ContentAlignment::MiddleCenter; - - this->button1->Enabled = false; - this->button1->Location = System::Drawing::Point(56, 88); - this->button1->Name = "Button1"; - this->button1->Size = System::Drawing::Size(40, 32); - this->button1->TabIndex = 1; - this->button1->Text = "stop"; - - this->Controls->Add(this->button1); - this->Controls->Add(this->label1); - this->Name = "StopSignControl"; - - this->MouseEnter += - gcnew EventHandler(this, - &StopSignControl::StopSignControl_MouseEnter); - this->MouseLeave += - gcnew EventHandler(this, - &StopSignControl::StopSignControl_MouseLeave); - - } - -private: - void StopSignControl_MouseEnter(Object^ sender, - EventArgs^ e) - { - - label1->Text = label1->Text->ToUpper(); - label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, - 14.0F, FontStyle::Bold); - button1->Enabled = true; - } - -private: - void StopSignControl_MouseLeave(Object^ sender, - EventArgs^ e) - { - - label1->Text = label1->Text->ToLower(); - label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, - 12.0F, FontStyle::Regular); - button1->Enabled = false; - } - -}; -// - -// The following code example demonstrates how to use the -// ToolBoxBitmapAttribute#ctor(type, string) constructor to set -// StopSignControl2.bmp as a toolbox icon for the StopSignControl. -// This example assumes the existence of a 16-by-16-pixel bitmap -// named StopSignControl2.bmp with its BuildAction property set to -// EmbeddedResource. -// -[ToolboxBitmap(StopSignControl2::typeid, "StopSignControl2.bmp")] -public ref class StopSignControl2: - public System::Windows::Forms::UserControl -{ -private: - Label^ label1; -private: - Button^ button1; - -public: - StopSignControl2() : UserControl() - { - this->label1 = gcnew System::Windows::Forms::Label(); - this->button1 = gcnew System::Windows::Forms::Button(); - - this->label1->Font = gcnew System::Drawing::Font( - "Microsoft Sans Serif", 12.0F, - System::Drawing::FontStyle::Regular, - System::Drawing::GraphicsUnit::Point, ((Byte) 0)); - this->label1->ForeColor = System::Drawing::Color::Red; - this->label1->Location = System::Drawing::Point(24, 56); - this->label1->Name = "Label1"; - this->label1->TabIndex = 0; - this->label1->Text = "Stop!"; - this->label1->TextAlign = - System::Drawing::ContentAlignment::MiddleCenter; - this->button1->Enabled = false; - this->button1->Location = System::Drawing::Point(56, 88); - this->button1->Name = "Button1"; - this->button1->Size = System::Drawing::Size(40, 32); - this->button1->TabIndex = 1; - this->button1->Text = "stop"; - this->Controls->Add(this->button1); - this->Controls->Add(this->label1); - this->Name = "StopSignControl"; - - this->MouseEnter += gcnew EventHandler(this, - &StopSignControl2::StopSignControl_MouseEnter); - this->MouseLeave += gcnew EventHandler(this, - &StopSignControl2::StopSignControl_MouseLeave); - - } - -private: - void StopSignControl_MouseEnter(Object^ sender, EventArgs^ e) - { - label1->Text = label1->Text->ToUpper(); - label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, - 14.0F, FontStyle::Bold); - button1->Enabled = true; - } - -private: - void StopSignControl_MouseLeave(Object^ sender, EventArgs^ e) - { - - label1->Text = label1->Text->ToLower(); - label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, - 12.0F, FontStyle::Regular); - button1->Enabled = false; - } - -}; -// - -// The following code example demonstrates how to use the -// ToolBoxBitmapAttribute#ctor(type) constructor to set the icon of -// the button control to the toolbox icon for a UserControl named -// StopSignControl3. -// -[ToolboxBitmap(Button::typeid)] -public ref class StopSignControl3: - public System::Windows::Forms::UserControl -{ -private: - Label^ label1; -private: - Button^ button1; - -public: - StopSignControl3() : UserControl() - { - this->label1 = gcnew System::Windows::Forms::Label(); - this->button1 = gcnew System::Windows::Forms::Button(); - - this->label1->Font = gcnew System::Drawing::Font( - "Microsoft Sans Serif", 12.0F, - System::Drawing::FontStyle::Regular, - System::Drawing::GraphicsUnit::Point, - ((Byte) 0)); - this->label1->ForeColor = System::Drawing::Color::Red; - this->label1->Location = System::Drawing::Point(24, 56); - this->label1->Name = "Label1"; - this->label1->TabIndex = 0; - this->label1->Text = "Stop!"; - this->label1->TextAlign = - System::Drawing::ContentAlignment::MiddleCenter; - - this->button1->Enabled = false; - this->button1->Location = System::Drawing::Point(56, 88); - this->button1->Name = "Button1"; - this->button1->Size = System::Drawing::Size(40, 32); - this->button1->TabIndex = 1; - this->button1->Text = "stop"; - this->Controls->Add(this->button1); - this->Controls->Add(this->label1); - this->Name = "StopSignControl"; - - this->MouseEnter += gcnew EventHandler(this, - &StopSignControl3::StopSignControl_MouseEnter); - this->MouseLeave += gcnew EventHandler(this, - &StopSignControl3::StopSignControl_MouseLeave); - } - -private: - void StopSignControl_MouseEnter(Object^ sender, EventArgs^ e) - { - label1->Text = label1->Text->ToUpper(); - label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, - 14.0F, FontStyle::Bold); - button1->Enabled = true; - } - -private: - void StopSignControl_MouseLeave(Object^ sender, EventArgs^ e) - { - label1->Text = label1->Text->ToLower(); - label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, - 12.0F, FontStyle::Regular); - button1->Enabled = false; - } -}; -// - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew Form1()); -} - - - - - - - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp deleted file mode 100644 index 051cef1f579..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp +++ /dev/null @@ -1,599 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// Declare a chart control that demonstrates accessibility in Windows Forms. -public ref class ChartControl: public System::Windows::Forms::UserControl -{ -public: - ref class ChartControlAccessibleObject; - - // forward declaration - // Inner Class that represents a legend for a curve in the chart. - ref class CurveLegend - { - - // - // Inner class CurveLegendAccessibleObject represents accessible information - // associated with the CurveLegend object. - public: - ref class CurveLegendAccessibleObject: public AccessibleObject - { - private: - CurveLegend^ curveLegend; - - public: - CurveLegendAccessibleObject( CurveLegend^ curveLegend ) - : AccessibleObject() - { - this->curveLegend = curveLegend; - } - - - private: - - property ChartControlAccessibleObject^ ChartControl - { - - // Private property that helps get the reference to the parent ChartControl. - ChartControlAccessibleObject^ get() - { - return dynamic_cast(Parent); - } - - } - - internal: - - property int ID - { - - // Internal helper function that returns the ID for this CurveLegend. - int get() - { - for ( int i = 0; i < ChartControl->GetChildCount(); i++ ) - { - if ( ChartControl->GetChild( i ) == this ) - { - return i; - } - - } - return -1; - } - - } - - public: - - property Rectangle Bounds - { - - // Gets the Bounds for the CurveLegend. This is used by accessibility programs. - virtual Rectangle get() override - { - - // The bounds is in screen coordinates. - Point loc = curveLegend->Location; - return Rectangle(curveLegend->chart->PointToScreen( loc ),curveLegend->Size); - } - - } - - property String^ Name - { - - // Gets or sets the Name for the CurveLegend. This is used by accessibility programs. - virtual String^ get() override - { - return curveLegend->Name; - } - - virtual void set( String^ value ) override - { - curveLegend->Name = value; - } - - } - - property AccessibleObject^ Parent - { - - // Gets the Curve Legend Parent's Accessible object. - // This is used by accessibility programs. - virtual AccessibleObject^ get() override - { - return curveLegend->chart->AccessibilityObject; - } - - } - - property System::Windows::Forms::AccessibleRole Role - { - - // Gets the role for the CurveLegend. This is used by accessibility programs. - virtual System::Windows::Forms::AccessibleRole get() override - { - return ::AccessibleRole::StaticText; - } - - } - - property AccessibleStates State - { - - // Gets the state based on the selection for the CurveLegend. - // This is used by accessibility programs. - virtual AccessibleStates get() override - { - AccessibleStates state = AccessibleStates::Selectable; - if ( curveLegend->Selected ) - { - state = static_cast(state | AccessibleStates::Selected); - } - - return state; - } - - } - - // Navigates through siblings of this CurveLegend. This is used by accessibility programs. - virtual AccessibleObject^ Navigate( AccessibleNavigation navdir ) override - { - - // Uses the internal NavigateFromChild helper function that exists - // on ChartControlAccessibleObject. - return ChartControl->NavigateFromChild( this, navdir ); - } - - - // Selects or unselects this CurveLegend. This is used by accessibility programs. - virtual void Select( AccessibleSelection selection ) override - { - - // Uses the internal SelectChild helper function that exists - // on ChartControlAccessibleObject. - ChartControl->SelectChild( this, selection ); - } - - }; - // - - - private: - - // class CurveLgendAccessibleObject - String^ name; - ChartControl^ chart; - CurveLegendAccessibleObject^ accObj; - bool selected; - Point location; - - public: - CurveLegend( ChartControl^ chart, String^ name ) - { - this->chart = chart; - this->name = name; - selected = true; - } - - - property AccessibleObject^ AccessibilityObject - { - - // Gets the accessibility object for the curve legend. - AccessibleObject^ get() - { - if ( accObj == nullptr ) - { - accObj = gcnew CurveLegendAccessibleObject( this ); - } - - return accObj; - } - - } - - property Rectangle Bounds - { - - // Gets the bounds for the curve legend. - Rectangle get() - { - return Rectangle(Location,Size); - } - - } - - property Point Location - { - - // - // Gets or sets the location for the curve legend. - Point get() - { - return location; - } - - void set( Point value ) - { - location = value; - chart->Invalidate(); - - // Notifies the chart of the location change. This is used for - // the accessibility information. AccessibleEvents::LocationChange - // tells the chart the reason for the notification. - chart->AccessibilityNotifyClients( AccessibleEvents::LocationChange, (dynamic_cast(AccessibilityObject))->ID ); - } - - } - - property String^ Name - { - - // Gets or sets the Name for the curve legend. - String^ get() - { - return name; - } - - void set( String^ value ) - { - if ( name != value ) - { - name = value; - chart->Invalidate(); - - // Notifies the chart of the name change. This is used for - // the accessibility information. AccessibleEvents::NameChange - // tells the chart the reason for the notification. - chart->AccessibilityNotifyClients( AccessibleEvents::NameChange, (dynamic_cast(AccessibilityObject))->ID ); - } - } - - } - - property bool Selected - { - - // Gets or sets the Selected state for the curve legend. - bool get() - { - return selected; - } - - void set( bool value ) - { - if ( selected != value ) - { - selected = value; - chart->Invalidate(); - - // Notifies the chart of the selection value change. This is used for - // the accessibility information. The AccessibleEvents value depends upon - // if the selection is true (AccessibleEvents::SelectionAdd) or - // false (AccessibleEvents::SelectionRemove). - chart->AccessibilityNotifyClients( selected ? AccessibleEvents::SelectionAdd : AccessibleEvents::SelectionRemove, (dynamic_cast(AccessibilityObject))->ID ); - } - } - // - - } - - property System::Drawing::Size Size - { - - // Gets the Size for the curve legend. - System::Drawing::Size get() - { - int legendHeight = chart->Font->Height + 4; - Graphics^ g = chart->CreateGraphics(); - int legendWidth = (int)g->MeasureString( Name, chart->Font ).Width + 4; - return System::Drawing::Size( legendWidth, legendHeight ); - } - - } - - }; - - -private: - - // class CurveLegend - CurveLegend^ legend1; - CurveLegend^ legend2; - -public: - ChartControl() - { - - // The ChartControl draws the chart in the OnPaint . - SetStyle( ControlStyles::ResizeRedraw, true ); - SetStyle( ControlStyles::DoubleBuffer, true ); - SetStyle( ControlStyles::AllPaintingInWmPaint, true ); - this->BackColor = System::Drawing::Color::White; - this->Name = "ChartControl"; - this->Click += gcnew System::EventHandler( this, &ChartControl::ChartControl_Click ); - this->QueryAccessibilityHelp += gcnew System::Windows::Forms::QueryAccessibilityHelpEventHandler( this, &ChartControl::ChartControl_QueryAccessibilityHelp ); - - // The CurveLengend is not Control-based, it just - // represents the parts of the legend. - legend1 = gcnew CurveLegend( this,"A" ); - legend1->Location = Point(20,30); - legend2 = gcnew CurveLegend( this,"B" ); - legend2->Location = Point(20,50); - } - - - - // -protected: - // Overridden to return the custom AccessibleObject - // for the entire chart. - virtual AccessibleObject^ CreateAccessibilityInstance() override - { - return gcnew ChartControlAccessibleObject( this ); - } - // - - virtual void OnPaint( PaintEventArgs^ e ) override - { - - // The ChartControl draws the chart in the OnPaint . - System::Windows::Forms::UserControl::OnPaint( e ); - Rectangle bounds = this->ClientRectangle; - int border = 5; - - // Draws the legends first. - StringFormat^ format = gcnew StringFormat; - format->Alignment = StringAlignment::Center; - format->LineAlignment = StringAlignment::Center; - if ( legend1 != nullptr ) - { - if ( legend1->Selected ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), legend1->Bounds ); - } - else - { - e->Graphics->DrawRectangle( Pens::Blue, legend1->Bounds ); - } - - e->Graphics->DrawString( legend1->Name, this->Font, Brushes::Black, legend1->Bounds, format ); - } - - if ( legend2 != nullptr ) - { - if ( legend2->Selected ) - { - e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), legend2->Bounds ); - } - else - { - e->Graphics->DrawRectangle( Pens::Red, legend2->Bounds ); - } - - e->Graphics->DrawString( legend2->Name, this->Font, Brushes::Black, legend2->Bounds, format ); - } - - - // Charts out the actual curves that represent data in the Chart. - bounds.Inflate( -border, -border ); - array^ temp1 = {Point(bounds.Left,bounds.Bottom),Point(bounds.Left + bounds.Width / 3,bounds.Top + bounds.Height / 5),Point(bounds.Right - bounds.Width / 3,(bounds.Top + bounds.Bottom) / 2),Point(bounds.Right,bounds.Top)}; - array^curve1 = temp1; - array^ temp2 = {Point(bounds.Left,bounds.Bottom - bounds.Height / 3),Point(bounds.Left + bounds.Width / 3,bounds.Top + bounds.Height / 5),Point(bounds.Right - bounds.Width / 3,(bounds.Top + bounds.Bottom) / 2),Point(bounds.Right,bounds.Top + bounds.Height / 2)}; - array^curve2 = temp2; - - // Draws the actual curve only if it is selected. - if ( legend1->Selected ) - e->Graphics->DrawCurve( Pens::Blue, curve1 ); - - if ( legend2->Selected ) - e->Graphics->DrawCurve( Pens::Red, curve2 ); - - e->Graphics->DrawRectangle( Pens::Blue, bounds ); - } - - // - // Handles the QueryAccessibilityHelp event. - void ChartControl_QueryAccessibilityHelp( Object^ /*sender*/, System::Windows::Forms::QueryAccessibilityHelpEventArgs^ e ) - { - e->HelpString = "Displays chart data"; - } - // - - // Handles the Click event for the chart. - // Toggles the selection of whatever legend was clicked on - void ChartControl_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Point pt = this->PointToClient( Control::MousePosition ); - if ( legend1->Bounds.Contains( pt ) ) - { - legend1->Selected = !legend1->Selected; - } - else - if ( legend2->Bounds.Contains( pt ) ) - { - legend2->Selected = !legend2->Selected; - } - } - - -public: - - property array^ Legends - { - - // Gets an array of CurveLengends used in the Chart. - array^ get() - { - array^temp3 = {legend1,legend2}; - return temp3; - } - - } - - // - // Inner class ChartControlAccessibleObject represents accessible information associated with the ChartControl. - // The ChartControlAccessibleObject is returned in the ChartControl::CreateAccessibilityInstance . - ref class ChartControlAccessibleObject: public ControlAccessibleObject - { - private: - ChartControl^ chartControl; - - public: - ChartControlAccessibleObject( ChartControl^ ctrl ) - : ControlAccessibleObject( ctrl ) - { - chartControl = ctrl; - } - - - property System::Windows::Forms::AccessibleRole Role - { - - // Gets the role for the Chart. This is used by accessibility programs. - virtual System::Windows::Forms::AccessibleRole get() override - { - return ::AccessibleRole::Chart; - } - - } - - property AccessibleStates State - { - - // Gets the state for the Chart. This is used by accessibility programs. - virtual AccessibleStates get() override - { - return AccessibleStates::ReadOnly; - } - - } - - // The CurveLegend objects are "child" controls in terms of accessibility so - // return the number of ChartLengend objects. - virtual int GetChildCount() override - { - return chartControl->Legends->Length; - } - - - // Gets the Accessibility object of the child CurveLegend idetified by index. - virtual AccessibleObject^ GetChild( int index ) override - { - if ( index >= 0 && index < chartControl->Legends->Length ) - { - return chartControl->Legends[ index ]->AccessibilityObject; - } - - return nullptr; - } - - - internal: - - // Helper function that is used by the CurveLegend's accessibility object - // to navigate between sibiling controls. Specifically, this function is used in - // the CurveLegend::CurveLegendAccessibleObject.Navigate function. - AccessibleObject^ NavigateFromChild( CurveLegend::CurveLegendAccessibleObject^ child, AccessibleNavigation navdir ) - { - switch ( navdir ) - { - case AccessibleNavigation::Down: - case AccessibleNavigation::Next: - return GetChild( child->ID + 1 ); - - case AccessibleNavigation::Up: - case AccessibleNavigation::Previous: - return GetChild( child->ID - 1 ); - } - return nullptr; - } - - - // Helper function that is used by the CurveLegend's accessibility object - // to select a specific CurveLegend control. Specifically, this function is used - // in the CurveLegend::CurveLegendAccessibleObject.Select function. - void SelectChild( CurveLegend::CurveLegendAccessibleObject^ child, AccessibleSelection selection ) - { - int childID = child->ID; - - // Determine which selection action should occur, based on the - // AccessibleSelection value. - if ( (selection & AccessibleSelection::TakeSelection) != (AccessibleSelection)0 ) - { - for ( int i = 0; i < chartControl->Legends->Length; i++ ) - { - if ( i == childID ) - { - chartControl->Legends[ i ]->Selected = true; - } - else - { - chartControl->Legends[ i ]->Selected = false; - } - - } - - // AccessibleSelection->AddSelection means that the CurveLegend will be selected. - if ( (selection & AccessibleSelection::AddSelection) != (AccessibleSelection)0 ) - { - chartControl->Legends[ childID ]->Selected = true; - } - - // AccessibleSelection->AddSelection means that the CurveLegend will be unselected. - if ( (selection & AccessibleSelection::RemoveSelection) != (AccessibleSelection)0 ) - { - chartControl->Legends[ childID ]->Selected = false; - } - } - } - - }; - - // class ChartControlAccessibleObject - // -}; - - -// class ChartControl -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - // Test out the Chart Control. - ChartControl^ chart1; - -public: - Form1() - { - - // Create a chart control and add it to the form. - this->chart1 = gcnew ChartControl; - this->ClientSize = System::Drawing::Size( 920, 566 ); - this->chart1->Location = System::Drawing::Point( 47, 16 ); - this->chart1->Size = System::Drawing::Size( 600, 400 ); - this->Controls->Add( this->chart1 ); - } - -}; - - -// class Form1 - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp deleted file mode 100644 index a274b44ccbb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace VStyles -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - - public: - Form1() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button1->Location = System::Drawing::Point( 24, 16 ); - this->button1->Size = System::Drawing::Size( 120, 100 ); - this->button1->FlatStyle = FlatStyle::System; - this->button1->Text = "I am themed."; - - // Sets up how the form should be displayed and adds the controls to the form. - this->ClientSize = System::Drawing::Size( 300, 286 ); - this->Controls->Add( this->button1 ); - this->Text = "Application::EnableVisualStyles Example"; - } - - }; - -} - - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew VStyles::Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp deleted file mode 100644 index 29d8e5d2e0e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp +++ /dev/null @@ -1,201 +0,0 @@ -// This entire sample can go in the ButtonRenderer overview. -// - Snippet2 can be excerpted in ButtonRenderer.DrawBackground overload -// and specific ButtonRenderer.DrawBackground that it uses. -// - Snippet4 can be linked to in ButtonRenderer.DrawParentBackground -// - Snippet2 could be excerpted in the VisualStyles.PushButtonState enum, -// if necessary. - -// The sample defines a simple custom Control that uses ButtonRenderer to -// simulate a real Button control. When clicked, it draws a smaller button -// and uses DrawParentBackground to erase the remainder of the unpressed -// button. - -// Issue: to show using DrawParentBackground, I'm currently setting the -// BackColor of the custom control to something other than the parent form. -// There might be a better way of demonstrating this that makes more sense -// from a usability standpoint... - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace ButtonRendererSample -{ - public ref class CustomButton : public Control - { - private: - Rectangle clickRectangleValue; - - private: - PushButtonState state; - - public: - CustomButton() - { - __super::Control(); - this->Size = System::Drawing::Size(100, 40); - this->Location = Point(50, 50); - this->Font = SystemFonts::IconTitleFont; - this->Text = "Click here"; - clickRectangleValue = Rectangle(); - state = PushButtonState::Normal; - } - - // Define the bounds of the smaller pressed button. - public: - property Rectangle ClickRectangle - { - Rectangle get() - { - clickRectangleValue.X = ClientRectangle.X + - (int)(.2 * ClientRectangle.Width); - clickRectangleValue.Y = ClientRectangle.Y + - (int)(.2 * ClientRectangle.Height); - clickRectangleValue.Width = ClientRectangle.Width - - (int)(.4 * ClientRectangle.Width); - clickRectangleValue.Height = ClientRectangle.Height - - (int)(.4 * ClientRectangle.Height); - - return clickRectangleValue; - } - } - - // - // - // Draw the large or small button, depending on the current state. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - // Draw the smaller pressed button image - if (state == PushButtonState::Pressed) - { - // Set the background color to the parent if visual styles - // are disabled, because DrawParentBackground will only paint - // over the control background if visual styles are enabled. - if (Application::RenderWithVisualStyles) - { - this->BackColor = Color::Azure; - } - else - { - this->BackColor = this->Parent->BackColor; - } - - - // If you comment out the call to DrawParentBackground, - // the background of the control will still be visible - // outside the pressed button, if visual styles are enabled. - ButtonRenderer::DrawParentBackground(e->Graphics, - ClientRectangle, this); - ButtonRenderer::DrawButton(e->Graphics, ClickRectangle, - this->Text, this->Font, true, state); - } - - // Draw the bigger unpressed button image. - else - { - ButtonRenderer::DrawButton(e->Graphics, ClientRectangle, - this->Text, this->Font, false, state); - } - } - // - - // Draw the smaller pressed button image. - protected: - virtual void OnMouseDown(MouseEventArgs^ e) override - { - __super::OnMouseDown(e); - this->Text = "Clicked!"; - state = PushButtonState::Pressed; - Invalidate(); - } - - // Draw the button in the hot state. - protected: - virtual void OnMouseEnter(EventArgs^ e) override - { - __super::OnMouseEnter(e); - this->Text = "Click here"; - state = PushButtonState::Hot; - Invalidate(); - } - - // Draw the button in the unpressed state. - protected: - virtual void OnMouseLeave(EventArgs^ e) override - { - __super::OnMouseLeave(e); - this->Text = "Click here"; - state = PushButtonState::Normal; - Invalidate(); - } - // - - // Draw the button hot if the mouse is released on the button. - protected: - virtual void OnMouseUp(MouseEventArgs^ e) override - { - __super::OnMouseUp(e); - OnMouseEnter(e); - } - - // Detect when the cursor leaves the button area while - // it is pressed. - protected: - virtual void OnMouseMove(MouseEventArgs^ e) override - { - __super::OnMouseMove(e); - - // Detect when the left mouse button is down and - // the cursor has left the pressed button area. - if ((e->Button & ::MouseButtons::Left) == ::MouseButtons::Left && - !ClientRectangle.Contains(e->Location) && - state == PushButtonState::Pressed) - { - OnMouseLeave(e); - } - } - }; - - ref class Form1 : public Form - { - public: - Form1() - { - __super::Form(); - CustomButton^ Button1 = gcnew CustomButton(); - Controls->Add(Button1); - - if (Application::RenderWithVisualStyles) - { - this->Text = "Visual Styles Enabled"; - } - else - { - this->Text = "Visual Styles Disabled"; - } - } - }; -} - -using namespace ButtonRendererSample; - -[STAThread] -int main() -{ - // If you do not call EnableVisualStyles below, then - // ButtonRenderer automatically detects this and draws - // the button without visual styles. - Application::EnableVisualStyles(); - Application::Run(gcnew Form1()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp deleted file mode 100644 index 3875bc3cd1b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp +++ /dev/null @@ -1,155 +0,0 @@ -// This sample can go in CheckBoxRenderer class overview. -// - Snippet2 can go in GetGlyphSize -// - Snippet4 can go in DrawCheckBox -// - Snippet4 can also go in the VisualStyles.CheckBoxState enum, if necessary. - -// The sample defines a simple custom Control that uses CheckBoxRenderer to -// simulate a CheckBox control. - -// Might want to think of a better, more realistic/solution-oriented example. - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace CheckBoxRendererSample -{ - ref class CustomCheckBox : Control - { - private: - Rectangle textRectangleValue; - Point clickedLocationValue; - bool clicked; - CheckBoxState state; - - public : - CustomCheckBox() : Control() - { - this->textRectangleValue = Rectangle(); - this->clickedLocationValue = Point(); - this->clicked = false; - this->state = CheckBoxState::UncheckedNormal; - this->Location = Point(50, 50); - this->Size = System::Drawing::Size(100, 20); - this->Text = "Click here"; - this->Font = SystemFonts::IconTitleFont; - } - - // - // Calculate the text bounds, exluding the check box. - Rectangle getTextRectangle() - { - Graphics ^g = this->CreateGraphics(); - textRectangleValue.X = ClientRectangle.X + - CheckBoxRenderer::GetGlyphSize(g, - CheckBoxState::UncheckedNormal).Width; - textRectangleValue.Y = ClientRectangle.Y; - textRectangleValue.Width = ClientRectangle.Width - - CheckBoxRenderer::GetGlyphSize(g, - CheckBoxState::UncheckedNormal).Width; - textRectangleValue.Height = ClientRectangle.Height; - - delete g; - return textRectangleValue; - } - // - -protected: - // - // Draw the check box in the current state. - virtual void OnPaint(PaintEventArgs ^e) override - { - Control::OnPaint(e); - - CheckBoxRenderer::DrawCheckBox(e->Graphics, - ClientRectangle.Location, this->getTextRectangle(), this->Text, - this->Font, TextFormatFlags::HorizontalCenter, - clicked, state); - } - - - // Draw the check box in the checked or unchecked state, alternately. - virtual void OnMouseDown(MouseEventArgs ^e) override - { - Control::OnMouseDown(e); - - if (!clicked) - { - clicked = true; - this->Text = "Clicked!"; - state = CheckBoxState::CheckedPressed; - Invalidate(); - } - else - { - clicked = false; - this->Text = "Click here"; - state = CheckBoxState::UncheckedNormal; - Invalidate(); - } - } - // - - // Draw the check box in the hot state. - virtual void OnMouseHover(EventArgs ^e) override - { - Control::OnMouseHover(e); - state = clicked ? CheckBoxState::CheckedHot : - CheckBoxState::UncheckedHot; - Invalidate(); - } - - // Draw the check box in the hot state. - virtual void OnMouseUp(MouseEventArgs ^e) override - { - Control::OnMouseUp(e); - this->OnMouseHover(e); - } - - // Draw the check box in the unpressed state. - virtual void OnMouseLeave(EventArgs ^e) override - { - Control::OnMouseLeave(e); - state = clicked ? CheckBoxState::CheckedNormal : - CheckBoxState::UncheckedNormal; - Invalidate(); - } - }; - - ref class Form1: public Form - { - public: - Form1() : Form() - { - CustomCheckBox ^CheckBox1 = gcnew CustomCheckBox(); - Controls->Add(CheckBox1); - - if (Application::RenderWithVisualStyles) - { - this->Text = "Visual Styles Enabled"; - } - else - { - this->Text = "Visual Styles Disabled"; - } - } - }; -} - - -[STAThread] -int main() -{ - // If you do not call EnableVisualStyles below, then - // CheckBoxRenderer.DrawCheckBox automatically detects - // this and draws the check box without visual styles. - Application::EnableVisualStyles(); - Application::Run(gcnew CheckBoxRendererSample::Form1()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp deleted file mode 100644 index 2944fb65ced..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp +++ /dev/null @@ -1,166 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace WindowsApplication1 -{ - - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 144, 72 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - protected: - - /// - /// The main entry point for the application. - /// - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // - System::Windows::Forms::ColorDialog^ MyDialog = gcnew ColorDialog; - - // Allows the user to select or edit a custom color. - MyDialog->AllowFullOpen = true; - - // Assigns an array of custom colors to the CustomColors property - array^temp0 = {6916092,15195440,16107657,1836924,3758726,12566463,7526079,7405793,6945974,241502,2296476,5130294,3102017,7324121,14993507,11730944}; - MyDialog->CustomColors = temp0; - - // Allows the user to get help. (The default is false.) - MyDialog->ShowHelp = true; - - // Sets the initial color select to the current text color, - // so that if the user cancels out, the original color is restored. - MyDialog->Color = this->BackColor; - MyDialog->ShowDialog(); - this->BackColor = MyDialog->Color; - // - - // Print the custom colors if the user has changed them. - PrintCustomColors( MyDialog->CustomColors ); - } - - private: - void PrintCustomColors( array^clrs ) - { - TextWriter^ writer = gcnew StreamWriter( "colors.txt" ); - { - IEnumerator^ myEnum = clrs->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - int i = safe_cast(myEnum->Current); - writer->WriteLine( i ); - } - } - writer->Close(); - } - - // private: - // int AddCustomColors() __gc[] - // { - // return new int[] {6916092, - // 15195440, - // 16107657, - // 1836924, - // 3758726, - // 12566463, - // 7526079, - // 7405793, - // 6945974, - // 241502, - // 2296476, - // 5130294, - // 3102017, - // 7324121, - // 14993507, - // 11730944, - // }; - // } - }; -} - - -[STAThread] -int main() -{ - Application::Run( gcnew WindowsApplication1::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp deleted file mode 100644 index 3ef7675d846..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp +++ /dev/null @@ -1,100 +0,0 @@ -// This example demonstrates handling the use of a ColorDialog object. -// The ColorDialog object does not allow the user to set a custom color -// but it allows the full set of basic colors to be displayed. By setting the -// SolidColorOnly property to false, it allows the display of colors that -// are combinations of other colors on systems with 256 or less colors. -// The dialog also shows the handling of a HelpRequest event. - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializeComponent(); - InitializeColorDialog(); - } - -internal: - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::ColorDialog^ ColorDialog1; - -private: - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - this->Button1->Location = System::Drawing::Point( 24, 16 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 88, 56 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click to change the color of the textbox"; - this->TextBox1->Location = System::Drawing::Point( 24, 88 ); - this->TextBox1->Multiline = true; - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 96, 96 ); - this->TextBox1->TabIndex = 1; - this->TextBox1->Text = "Here is some text"; - this->ClientSize = System::Drawing::Size( 152, 266 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // This method initializes ColorDialog1 to allow any colors, - // and combination colors on systems with 256 colors or less, - // but will not allow the user to set custom colors. The - // dialog will contain the help button. - void InitializeColorDialog() - { - this->ColorDialog1 = gcnew System::Windows::Forms::ColorDialog; - this->ColorDialog1->AllowFullOpen = false; - this->ColorDialog1->AnyColor = true; - this->ColorDialog1->SolidColorOnly = false; - this->ColorDialog1->ShowHelp = true; - - // Associate the event-handling method with - // the HelpRequest event. - this->ColorDialog1->HelpRequest += - gcnew System::EventHandler( this, &Form1::ColorDialog1_HelpRequest ); - } - - // This method opens the dialog and checks the DialogResult value. - // If the result is OK, the text box's background color will be changed - // to the user-selected color. - void Button1_Click( System::Object^ sender, System::EventArgs^ e ) - { - ::DialogResult result = ColorDialog1->ShowDialog(); - if ( result == ::DialogResult::OK ) - { - TextBox1->BackColor = ColorDialog1->Color; - } - } - - // This method is called when the HelpRequest event is raised, - //which occurs when the user clicks the Help button on the ColorDialog object. - void ColorDialog1_HelpRequest( Object^ sender, System::EventArgs^ e ) - { - MessageBox::Show( "Please select a color by clicking it. " + - "This will change the BackColor property of the TextBox." ); - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp deleted file mode 100644 index d23484f62a4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// This example demonstrates the ComboBox.ObjectCollection.AddRange, -// ComboBox.DropDown, and ComboBox.Text properties and the -// MessageBox.Show(string, string, MessageBoxButton, MessageBoxIcon) -// method. - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializeComponent(); - InitializeComboBox(); - } - -internal: - System::Windows::Forms::Label ^ Label2; - System::Windows::Forms::Label ^ Label1; - -private: - void InitializeComponent() - { - this->Label2 = gcnew System::Windows::Forms::Label; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - this->Label1->Location = System::Drawing::Point( 24, 48 ); - this->Label1->Name = "Label1"; - this->Label1->TabIndex = 3; - this->Label1->Text = "Installation Type:"; - this->Label1->TextAlign = - System::Drawing::ContentAlignment::MiddleRight; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->Label2 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // -internal: - // Declare ComboBox1 - System::Windows::Forms::ComboBox^ ComboBox1; - -private: - // Initialize ComboBox1. - void InitializeComboBox() - { - this->ComboBox1 = gcnew ComboBox; - this->ComboBox1->Location = System::Drawing::Point( 128, 48 ); - this->ComboBox1->Name = "ComboBox1"; - this->ComboBox1->Size = System::Drawing::Size( 100, 21 ); - this->ComboBox1->TabIndex = 0; - this->ComboBox1->Text = "Typical"; - array^ installs = {"Typical","Compact","Custom"}; - ComboBox1->Items->AddRange( installs ); - this->Controls->Add( this->ComboBox1 ); - - // Hook up the event handler. - this->ComboBox1->DropDown += gcnew System::EventHandler( - this, &Form1::ComboBox1_DropDown ); - } - // - - // Handles the ComboBox1 DropDown event. If the user expands the - // drop-down box, a message box will appear, recommending the - // typical installation. - void ComboBox1_DropDown( Object^ sender, System::EventArgs^ e ) - { - MessageBox::Show( "Typical installation is strongly recommended.", - "Install information", MessageBoxButtons::OK, - MessageBoxIcon::Information ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp deleted file mode 100644 index 4d9b53cc2d3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// This example demonstrates using the following members: -// ComboBox.FindStringExact(string) -// ComboBox.FindStringExact(string, integer), -// ComboBox.ObjectCollection.AddRange(), -// ComboBox.ObjectCollection.RemoveAt(), and ComboBox.MaxDropDownItems, -// and TextBox.ReadOnly. -// CAUTION This code exposes a known bug: If the index passed to the -// FindStringExact(searchString, index) method is the last index of -// the array,the code throws an exception. -// -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializeComboBox(); - InitializeTextBox(); - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - this->Label1->Location = System::Drawing::Point( 8, 24 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 120, 32 ); - this->Label1->TabIndex = 1; - this->Label1->Text = "Use drop-down to choose a name:"; - this->Label1->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - -internal: - System::Windows::Forms::Label ^ Label1; - - // - // Declare and initialize the text box. -internal: - // This text box text will be update programmatically. The user is not - // allowed to update it, so the ReadOnly property is set to true. - System::Windows::Forms::TextBox^ TextBox1; - -private: - void InitializeTextBox() - { - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->TextBox1->ScrollBars = ScrollBars::Vertical; - this->TextBox1->Location = System::Drawing::Point( 64, 128 ); - this->TextBox1->Multiline = true; - this->TextBox1->Name = "TextBox1"; - this->TextBox1->ReadOnly = true; - this->TextBox1->Size = System::Drawing::Size( 184, 120 ); - this->TextBox1->TabIndex = 4; - this->TextBox1->Text = "Employee and Number of Awards:"; - this->Controls->Add( this->TextBox1 ); - } - // - - // - // Declare comboBox1 as a ComboBox. -internal: - System::Windows::Forms::ComboBox^ ComboBox1; - -private: - // This method initializes the combo box, adding a large string array - // but limiting the drop-down size to six rows so the combo box doesn't - // cover other controls when it expands. - void InitializeComboBox() - { - this->ComboBox1 = gcnew System::Windows::Forms::ComboBox; - array^ employees = {"Hamilton, David","Hensien, Kari", - "Hammond, Maria","Harris, Keith","Henshaw, Jeff D.", - "Hanson, Mark","Harnpadoungsataya, Sariya", - "Harrington, Mark","Harris, Keith","Hartwig, Doris", - "Harui, Roger","Hassall, Mark","Hasselberg, Jonas", - "Harnpadoungsataya, Sariya","Henshaw, Jeff D.", - "Henshaw, Jeff D.","Hensien, Kari","Harris, Keith", - "Henshaw, Jeff D.","Hensien, Kari","Hasselberg, Jonas", - "Harrington, Mark","Hedlund, Magnus","Hay, Jeff", - "Heidepriem, Brandon D."}; - ComboBox1->Items->AddRange( employees ); - this->ComboBox1->Location = System::Drawing::Point( 136, 32 ); - this->ComboBox1->IntegralHeight = false; - this->ComboBox1->MaxDropDownItems = 5; - this->ComboBox1->DropDownStyle = ComboBoxStyle::DropDownList; - this->ComboBox1->Name = "ComboBox1"; - this->ComboBox1->Size = System::Drawing::Size( 136, 81 ); - this->ComboBox1->TabIndex = 0; - this->Controls->Add( this->ComboBox1 ); - - // Associate the event-handling method with the - // SelectedIndexChanged event. - this->ComboBox1->SelectedIndexChanged += - gcnew System::EventHandler( this, &Form1::ComboBox1_SelectedIndexChanged ); - } - // - - // -private: - // This method is called when the user changes his or her selection. - // It searches for all occurrences of the selected employee's - // name in the Items array and adds the employee's name and - // the number of occurrences to TextBox1.Text. - - // CAUTION This code exposes a known bug: If the index passed to the - // FindStringExact(searchString, index) method is the last index - // of the array, the code throws an exception. - void ComboBox1_SelectedIndexChanged( Object^ sender, - System::EventArgs^ e ) - { - ComboBox^ comboBox = (ComboBox^)(sender); - - // Save the selected employee's name, because we will remove - // the employee's name from the list. - String^ selectedEmployee = (String^)(ComboBox1->SelectedItem); - - int count = 0; - int resultIndex = -1; - - // Call the FindStringExact method to find the first - // occurrence in the list. - resultIndex = ComboBox1->FindStringExact( selectedEmployee ); - - // Remove the name as it is found, and increment the found count. - // Then call the FindStringExact method again, passing in the - // index of the current found item so the search starts there - // instead of at the beginning of the list. - while ( resultIndex != -1 ) - { - ComboBox1->Items->RemoveAt( resultIndex ); - count += 1; - resultIndex = ComboBox1->FindStringExact( selectedEmployee, - resultIndex ); - } - - TextBox1->Text = TextBox1->Text + "\r\n" + selectedEmployee + ": " + - count; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp deleted file mode 100644 index 699f1393f3e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// This example demonstrates creating an owner-drawn ComboBox control. -// The DrawMode property is set to OwnerDrawnVariable. It also demonstrates -// using the ComboBox.DropDownWidth and ComboBox.DropDownStyle properties -// and handling the ComboBox.MeasureItem and ComboBox.DrawItem events for -// an owner-drawn ComboBox with variable item size. - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializeComponent(); - InitializeComboBox(); - } - -private: - void InitializeComponent() - { - this->SuspendLayout(); - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -internal: - System::Windows::Forms::ComboBox^ ComboBox1; - -private: - array^ animals; - - // This method initializes the owner-drawn combo box. - // The drop-down width is set much wider than the size of the combo box - // to accomodate the large items in the list. The drop-down style is set to - // ComboBox.DropDown, which requires the user to click on the arrow to - // see the list. - void InitializeComboBox() - { - this->ComboBox1 = gcnew ComboBox; - this->ComboBox1->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawVariable; - this->ComboBox1->Location = System::Drawing::Point( 10, 20 ); - this->ComboBox1->Name = "ComboBox1"; - this->ComboBox1->Size = System::Drawing::Size( 100, 120 ); - this->ComboBox1->DropDownWidth = 250; - this->ComboBox1->TabIndex = 0; - this->ComboBox1->DropDownStyle = ComboBoxStyle::DropDown; - animals = gcnew array{"Elephant","c r o c o d i l e","lion"}; - ComboBox1->DataSource = animals; - this->Controls->Add( this->ComboBox1 ); - - // Hook up the MeasureItem and DrawItem events - this->ComboBox1->DrawItem += - gcnew DrawItemEventHandler( this, &Form1::ComboBox1_DrawItem ); - this->ComboBox1->MeasureItem += - gcnew MeasureItemEventHandler( this, &Form1::ComboBox1_MeasureItem ); - } - - // If you set the Draw property to DrawMode.OwnerDrawVariable, - // you must handle the MeasureItem event. This event handler - // will set the height and width of each item before it is drawn. -private: - void ComboBox1_MeasureItem( Object^ sender, - System::Windows::Forms::MeasureItemEventArgs^ e ) - { - switch ( e->Index ) - { - case 0: - e->ItemHeight = 45; - break; - case 1: - e->ItemHeight = 20; - break; - case 2: - e->ItemHeight = 35; - break; - } - e->ItemWidth = 260; - } - -private: - // You must handle the DrawItem event for owner-drawn combo boxes. - // This event handler changes the color, size and font of an - // item based on its position in the array. - void ComboBox1_DrawItem( Object^ sender, - System::Windows::Forms::DrawItemEventArgs^ e ) - { - float size = 0; - System::Drawing::Font^ myFont; - FontFamily^ family = nullptr; - - System::Drawing::Color animalColor; - switch ( e->Index ) - { - case 0: - size = 30; - animalColor = System::Drawing::Color::Gray; - family = FontFamily::GenericSansSerif; - break; - case 1: - size = 10; - animalColor = System::Drawing::Color::LawnGreen; - family = FontFamily::GenericMonospace; - break; - case 2: - size = 15; - animalColor = System::Drawing::Color::Tan; - family = FontFamily::GenericSansSerif; - break; - } - - // Draw the background of the item. - e->DrawBackground(); - - // Create a square filled with the animals color. Vary the size - // of the rectangle based on the length of the animals name. - Rectangle rectangle = Rectangle( 2, e->Bounds.Top + 2, - e->Bounds.Height, e->Bounds.Height - 4 ); - e->Graphics->FillRectangle( gcnew SolidBrush( animalColor ), rectangle ); - - // Draw each string in the array, using a different size, color, - // and font for each item. - myFont = gcnew System::Drawing::Font( family, size, FontStyle::Bold ); - e->Graphics->DrawString( animals[ e->Index ], myFont, - System::Drawing::Brushes::Black, RectangleF( - e->Bounds.X + rectangle.Width, e->Bounds.Y, - e->Bounds.Width, e->Bounds.Height) ); - - // Draw the focus rectangle if the mouse hovers over an item. - e->DrawFocusRectangle(); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp deleted file mode 100644 index 97d56573185..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp +++ /dev/null @@ -1,172 +0,0 @@ -// This sample can go in ComboBoxRenderer class overview. -// - Snippet2 can go in IsSupported -// - Snippet4 can go in DrawTextBox and DrawDropDownButton - -// It renders the pieces of a combo box with visual styles, provided -// that visual styles are enabled in the Display Panel. -// For simplicity, this sample does not handle run-time visual style switching. - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace ComboBoxRendererSample -{ - ref class CustomComboBox: public Control - { - private: - System::Drawing::Size arrowSize; - Rectangle arrowRectangle; - Rectangle topTextBoxRectangle; - Rectangle bottomTextBoxRectangle; - ComboBoxState textBoxState; - ComboBoxState arrowState; - String^ bottomText; - bool isActivated; - int minHeight; - int minWidth; - - public: - CustomComboBox() : Control() - - { - minHeight = 38; - minWidth = 40; - this->Location = Point(10, 10); - this->Size = System::Drawing::Size(140, 38); - this->Font = SystemFonts::IconTitleFont; - this->Text = "Click the button"; - textBoxState = ComboBoxState::Normal; - bottomText = "Using ComboBoxRenderer"; - arrowState = ComboBoxState::Normal; - - // Initialize the rectangles to look like the standard combo - // box control. - arrowSize = System::Drawing::Size(18, 20); - arrowRectangle = Rectangle(ClientRectangle.X + - ClientRectangle.Width - arrowSize.Width - 1, - ClientRectangle.Y + 1, - arrowSize.Width, - arrowSize.Height); - topTextBoxRectangle = Rectangle(ClientRectangle.X, - ClientRectangle.Y, - ClientRectangle.Width, - arrowSize.Height + 2); - bottomTextBoxRectangle = Rectangle(ClientRectangle.X, - ClientRectangle.Y + topTextBoxRectangle.Height, - ClientRectangle.Width, - topTextBoxRectangle.Height - 6); - } - - // - // - // Draw the combo box in the current state. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - Control::OnPaint(e); - - if (!ComboBoxRenderer::IsSupported) - { - this->Parent->Text = "Visual Styles Disabled"; - return; - } - - this->Parent->Text = "CustomComboBox Enabled"; - - // Always draw the main text box and drop down arrow in their - // current states - ComboBoxRenderer::DrawTextBox(e->Graphics, topTextBoxRectangle, - this->Text, this->Font, textBoxState); - ComboBoxRenderer::DrawDropDownButton(e->Graphics, arrowRectangle, - arrowState); - - // Only draw the bottom text box if the arrow has been clicked - if (isActivated) - { - ComboBoxRenderer::DrawTextBox(e->Graphics, - bottomTextBoxRectangle, bottomText, this->Font, - textBoxState); - } - } - // - - protected: - virtual void OnMouseDown(MouseEventArgs^ e) override - { - Control::OnMouseDown(e); - - // Check whether the user clicked the arrow. - if (arrowRectangle.Contains(e->Location) && - ComboBoxRenderer::IsSupported) - { - // Draw the arrow in the pressed state. - arrowState = ComboBoxState::Pressed; - - // The user has activated the combo box. - if (!isActivated) - { - this->Text = "Clicked!"; - textBoxState = ComboBoxState::Pressed; - isActivated = true; - } - - // The user has deactivated the combo box. - else - { - this->Text = "Click here"; - textBoxState = ComboBoxState::Normal; - isActivated = false; - } - - // Redraw the control. - Invalidate(); - } - } - // - - protected: - virtual void OnMouseUp(MouseEventArgs^ e) override - { - Control::OnMouseUp(e); - - if (arrowRectangle.Contains(e->Location) && - ComboBoxRenderer::IsSupported) - { - arrowState = ComboBoxState::Normal; - Invalidate(); - } - } - }; - - ref class Form1 : public Form - { - public: - Form1() : Form() - { - this->Size = System::Drawing::Size(300, 300); - CustomComboBox^ ComboBox1 = gcnew CustomComboBox(); - Controls->Add(ComboBox1); - } - - }; - -} - -[STAThread] -int main() -{ - // The call to EnableVisualStyles below does not affect - // whether ComboBoxRenderer.IsSupported is true; as long as visual - // styles are enabled by the operating system, IsSupported is true. - Application::EnableVisualStyles(); - Application::Run(gcnew ComboBoxRendererSample::Form1()); - -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp deleted file mode 100644 index 84d52d77f59..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp +++ /dev/null @@ -1,127 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeComboBoxAndTextBoxes(); - this->comboBox1->SelectionChangeCommitted += gcnew EventHandler( this, &Form1::comboBox1_SelectionChangeCommitted ); - - //Add any initialization after the InitializeComponent() call - } - - -public: - - //Destructor cleans up the component list. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->SuspendLayout(); - - // - //ComboBox1 - // - // - //TextBox1 - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - -internal: - System::Windows::Forms::ComboBox^ comboBox1; - System::Windows::Forms::TextBox^ textbox1; - -private: - void InitializeComboBoxAndTextBoxes() - { - this->comboBox1 = gcnew System::Windows::Forms::ComboBox; - this->comboBox1->Location = Point(25,150); - this->comboBox1->Width = 160; - this->textbox1 = gcnew System::Windows::Forms::TextBox; - textbox1->Location = Point(25,50); - textbox1->Name = "selectedTextBox"; - textbox1->Size = System::Drawing::Size( 25, 15 ); - array^namespaces = {"System.Windows.Forms","System.Net","System.Reflection","System.Drawing"}; - System::Collections::IEnumerator^ myEnum = namespaces->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ aNamespace = safe_cast(myEnum->Current); - comboBox1->Items->Add( String::Concat( aNamespace, ", ", (aNamespace->Length + 4) ) ); - } - - this->Controls->Add( this->textbox1 ); - this->Controls->Add( this->comboBox1 ); - } - - - // The following code example demonstrates the handling of the - // SelectionChangeCommitted event. This example uses the - // SelectionLength property to set the width of a text box that - // displays the SelectedText. Since the SelectionLength and - // SelectedText properties reflect the currently selected - // (not newly selected) text, they will lag behind what is currently - // displayed in the text portion of the ComboBox control. To run - // this example,paste the following code into a form that contains - // a ComboBox named comboBox1 and is populated with strings. - // The form should also contain a TextBox named textbox1. - // Ensure the SelectionChangedEvent is associated with the - // event-handling method in this example. - // - void comboBox1_SelectionChangeCommitted( Object^ sender, EventArgs^ /*e*/ ) - { - ComboBox^ senderComboBox = dynamic_cast(sender); - - // Change the length of the text box depending on what the user has - // selected and committed using the SelectionLength property. - if ( senderComboBox->SelectionLength > 0 ) - { - textbox1->Width = - senderComboBox->SelectedItem->ToString()->Length * - ((int)this->textbox1->Font->SizeInPoints); - textbox1->Text = senderComboBox->SelectedItem->ToString(); - } - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp deleted file mode 100644 index f7c2c136e31..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp +++ /dev/null @@ -1,319 +0,0 @@ - - -#using -#using -#using - -// -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace Snip_DragNDrop -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::ListBox^ ListDragSource; - System::Windows::Forms::ListBox^ ListDragTarget; - System::Windows::Forms::CheckBox^ UseCustomCursorsCheck; - System::Windows::Forms::Label ^ DropLocationLabel; - Int32 indexOfItemUnderMouseToDrag; - Int32 indexOfItemUnderMouseToDrop; - Rectangle dragBoxFromMouseDown; - Point screenOffset; - System::Windows::Forms::Cursor^ MyNoDropCursor; - System::Windows::Forms::Cursor^ MyNormalCursor; - - public: - Form1() - { - this->ListDragSource = gcnew System::Windows::Forms::ListBox; - this->ListDragTarget = gcnew System::Windows::Forms::ListBox; - this->UseCustomCursorsCheck = gcnew System::Windows::Forms::CheckBox; - this->DropLocationLabel = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // ListDragSource - array^temp0 = {"five","six","seven","eight","nine","ten"}; - this->ListDragSource->Items->AddRange( temp0 ); - this->ListDragSource->Location = System::Drawing::Point( 10, 17 ); - this->ListDragSource->Size = System::Drawing::Size( 120, 225 ); - this->ListDragSource->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::ListDragSource_MouseDown ); - this->ListDragSource->QueryContinueDrag += gcnew System::Windows::Forms::QueryContinueDragEventHandler( this, &Form1::ListDragSource_QueryContinueDrag ); - this->ListDragSource->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::ListDragSource_MouseUp ); - this->ListDragSource->MouseMove += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::ListDragSource_MouseMove ); - this->ListDragSource->GiveFeedback += gcnew System::Windows::Forms::GiveFeedbackEventHandler( this, &Form1::ListDragSource_GiveFeedback ); - - // ListDragTarget - this->ListDragTarget->AllowDrop = true; - this->ListDragTarget->Location = System::Drawing::Point( 154, 17 ); - this->ListDragTarget->Size = System::Drawing::Size( 120, 225 ); - this->ListDragTarget->DragOver += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::ListDragTarget_DragOver ); - this->ListDragTarget->DragDrop += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::ListDragTarget_DragDrop ); - this->ListDragTarget->DragEnter += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::ListDragTarget_DragEnter ); - this->ListDragTarget->DragLeave += gcnew System::EventHandler( this, &Form1::ListDragTarget_DragLeave ); - - // UseCustomCursorsCheck - this->UseCustomCursorsCheck->Location = System::Drawing::Point( 10, 243 ); - this->UseCustomCursorsCheck->Size = System::Drawing::Size( 137, 24 ); - this->UseCustomCursorsCheck->Text = "Use Custom Cursors"; - - // DropLocationLabel - this->DropLocationLabel->Location = System::Drawing::Point( 154, 245 ); - this->DropLocationLabel->Size = System::Drawing::Size( 137, 24 ); - this->DropLocationLabel->Text = "None"; - - // Form1 - this->ClientSize = System::Drawing::Size( 292, 270 ); - array^formControls = {this->ListDragSource,this->ListDragTarget,this->UseCustomCursorsCheck,this->DropLocationLabel}; - this->Controls->AddRange( formControls ); - this->Text = "drag-and-drop Example"; - this->ResumeLayout( false ); - } - - - private: - void ListDragSource_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - - // Get the index of the item the mouse is below. - indexOfItemUnderMouseToDrag = this->ListDragSource->IndexFromPoint( e->X, e->Y ); - if ( indexOfItemUnderMouseToDrag != ListBox::NoMatches ) - { - - // Remember the point where the mouse down occurred. The DragSize indicates - // the size that the mouse can move before a drag event should be started. - System::Drawing::Size dragSize = SystemInformation::DragSize; - - // Create a rectangle using the DragSize, with the mouse position being - // at the center of the rectangle. - dragBoxFromMouseDown = Rectangle(Point(e->X - (dragSize.Width / 2),e->Y - (dragSize.Height / 2)),dragSize); - } - else - dragBoxFromMouseDown = Rectangle::Empty; - - - // Reset the rectangle if the mouse is not over an item in the ListBox. - } - - void ListDragSource_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ) - { - - // Reset the drag rectangle when the mouse button is raised. - dragBoxFromMouseDown = Rectangle::Empty; - } - - - // - void ListDragSource_MouseMove( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - if ( (e->Button & ::MouseButtons::Left) == ::MouseButtons::Left ) - { - - // If the mouse moves outside the rectangle, start the drag. - if ( dragBoxFromMouseDown != Rectangle::Empty && !dragBoxFromMouseDown.Contains( e->X, e->Y ) ) - { - - // Create custom cursors for the drag-and-drop operation. - try - { - MyNormalCursor = gcnew System::Windows::Forms::Cursor( "3dwarro.cur" ); - MyNoDropCursor = gcnew System::Windows::Forms::Cursor( "3dwno.cur" ); - } - catch ( Exception^ ) - { - // An error occurred while attempting to load the cursors, so use - // the standard cursors. - this->UseCustomCursorsCheck->Checked = false; - } - __finally - { - // The screenOffset is used to account for any desktop bands - // that may be at the top or left side of the screen when - // determining when to cancel the drag drop operation. - screenOffset = SystemInformation::WorkingArea.Location; - - // Proceed with the drag-and-drop, passing in the list item. - DragDropEffects dropEffect = this->ListDragSource->DoDragDrop( ListDragSource->Items[ indexOfItemUnderMouseToDrag ], static_cast(DragDropEffects::All | DragDropEffects::Link) ); - - // If the drag operation was a move then remove the item. - if ( dropEffect == DragDropEffects::Move ) - { - ListDragSource->Items->RemoveAt( indexOfItemUnderMouseToDrag ); - - // Selects the previous item in the list as long as the list has an item. - if ( indexOfItemUnderMouseToDrag > 0 ) - ListDragSource->SelectedIndex = indexOfItemUnderMouseToDrag - 1; - else - if ( ListDragSource->Items->Count > 0 ) - - // Selects the first item. - ListDragSource->SelectedIndex = 0; - } - - // Dispose of the cursors since they are no longer needed. - if ( MyNormalCursor != nullptr ) - delete MyNormalCursor; - if ( MyNoDropCursor != nullptr ) - delete MyNoDropCursor; - } - } - } - } - // - - // - // - void ListDragSource_GiveFeedback( Object^ /*sender*/, System::Windows::Forms::GiveFeedbackEventArgs^ e ) - { - // Use custom cursors if the check box is checked. - if ( UseCustomCursorsCheck->Checked ) - { - // Sets the custom cursor based upon the effect. - e->UseDefaultCursors = false; - if ( (e->Effect & DragDropEffects::Move) == DragDropEffects::Move ) - ::Cursor::Current = MyNormalCursor; - else - ::Cursor::Current = MyNoDropCursor; - } - } - // - - // - void ListDragTarget_DragOver( Object^ /*sender*/, System::Windows::Forms::DragEventArgs^ e ) - { - // Determine whether string data exists in the drop data. If not, then - // the drop effect reflects that the drop cannot occur. - if ( !e->Data->GetDataPresent( System::String::typeid ) ) - { - e->Effect = DragDropEffects::None; - DropLocationLabel->Text = "None - no string data."; - return; - } - - // Set the effect based upon the KeyState. - if ( (e->KeyState & (8 + 32)) == (8 + 32) && ((e->AllowedEffect & DragDropEffects::Link) == DragDropEffects::Link) ) - { - // KeyState 8 + 32 = CTRL + ALT - // Link drag-and-drop effect. - e->Effect = DragDropEffects::Link; - } - else - if ( (e->KeyState & 32) == 32 && ((e->AllowedEffect & DragDropEffects::Link) == DragDropEffects::Link) ) - { - // ALT KeyState for link. - e->Effect = DragDropEffects::Link; - } - else - if ( (e->KeyState & 4) == 4 && ((e->AllowedEffect & DragDropEffects::Move) == DragDropEffects::Move) ) - { - // SHIFT KeyState for move. - e->Effect = DragDropEffects::Move; - } - else - if ( (e->KeyState & 8) == 8 && ((e->AllowedEffect & DragDropEffects::Copy) == DragDropEffects::Copy) ) - { - // CTRL KeyState for copy. - e->Effect = DragDropEffects::Copy; - } - else - if ( (e->AllowedEffect & DragDropEffects::Move) == DragDropEffects::Move ) - { - // By default, the drop action should be move, if allowed. - e->Effect = DragDropEffects::Move; - } - else - e->Effect = DragDropEffects::None; - - - - - - - // Get the index of the item the mouse is below. - // The mouse locations are relative to the screen, so they must be - // converted to client coordinates. - indexOfItemUnderMouseToDrop = ListDragTarget->IndexFromPoint( ListDragTarget->PointToClient( Point(e->X,e->Y) ) ); - - // Updates the label text. - if ( indexOfItemUnderMouseToDrop != ListBox::NoMatches ) - { - DropLocationLabel->Text = String::Concat( "Drops before item # ", (indexOfItemUnderMouseToDrop + 1) ); - } - else - DropLocationLabel->Text = "Drops at the end."; - } - // - - // - void ListDragTarget_DragDrop( Object^ /*sender*/, System::Windows::Forms::DragEventArgs^ e ) - { - // Ensure that the list item index is contained in the data. - if ( e->Data->GetDataPresent( System::String::typeid ) ) - { - Object^ item = dynamic_cast(e->Data->GetData( System::String::typeid )); - - // Perform drag-and-drop, depending upon the effect. - if ( e->Effect == DragDropEffects::Copy || e->Effect == DragDropEffects::Move ) - { - // Insert the item. - if ( indexOfItemUnderMouseToDrop != ListBox::NoMatches ) - ListDragTarget->Items->Insert( indexOfItemUnderMouseToDrop, item ); - else - ListDragTarget->Items->Add( item ); - } - } - - // Reset the label text. - DropLocationLabel->Text = "None"; - } - // - - // - void ListDragSource_QueryContinueDrag( Object^ sender, System::Windows::Forms::QueryContinueDragEventArgs^ e ) - { - // Cancel the drag if the mouse moves off the form. - ListBox^ lb = dynamic_cast(sender); - if ( lb != nullptr ) - { - Form^ f = lb->FindForm(); - - // Cancel the drag if the mouse moves off the form. The screenOffset - // takes into account any desktop bands that may be at the top or left - // side of the screen. - if ( ((Control::MousePosition.X - screenOffset.X) < f->DesktopBounds.Left) || ((Control::MousePosition.X - screenOffset.X) > f->DesktopBounds.Right) || ((Control::MousePosition.Y - screenOffset.Y) < f->DesktopBounds.Top) || ((Control::MousePosition.Y - screenOffset.Y) > f->DesktopBounds.Bottom) ) - { - e->Action = DragAction::Cancel; - } - } - } - // - - // - void ListDragTarget_DragEnter( Object^ /*sender*/, System::Windows::Forms::DragEventArgs^ /*e*/ ) - { - // Reset the label text. - DropLocationLabel->Text = "None"; - } - // - - // - void ListDragTarget_DragLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Reset the label text. - DropLocationLabel->Text = "None"; - } - // - // - }; -} - -/// The main entry point for the application. - -[STAThread] -int main() -{ - Application::Run( gcnew Snip_DragNDrop::Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp deleted file mode 100644 index 481451b6327..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp +++ /dev/null @@ -1,168 +0,0 @@ - - -#using -#using -#using - -// This example demonstrates using the Control.PerformLayout method. -// It contains a custom LayoutControl object and three buttons. -// The Click event handler for Button1 explicitly calls PerformLayout. -// The Click event handler for Button2 implicitly calls PerformLayout. -// PerformLayout is also called when the form is loaded. Button3 returns -// the control to the state it was in when loaded. -// -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -// This custom control has the Layout event implented so that when -// PerformLayout(AffectedControl, AffectedProperty) is called -// on the control, where AffectedProperty equals "Bounds" the -// textbox is centered on the control. -public ref class LayoutControl: public System::Windows::Forms::UserControl -{ -public private: - System::Windows::Forms::TextBox^ TextBox1; - -public: - LayoutControl() - : UserControl() - { - InitializeComponent(); - } - - -private: - void InitializeComponent() - { - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - this->TextBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - this->TextBox1->Name = "TextBox1"; - this->TextBox1->TabIndex = 0; - this->BackColor = System::Drawing::SystemColors::ControlDark; - this->Controls->Add( this->TextBox1 ); - this->Name = "LayoutControl"; - this->ResumeLayout( false ); - this->Layout += gcnew LayoutEventHandler( this, &LayoutControl::LayoutControl_Layout ); - } - - - // This method is called when the Layout event is fired. - // This happens by during the initial load, by calling PerformLayout - // or by resizing, adding or removing controls or other actions that - // affect how the control is laid out. This method checks the - // value of e.AffectedProperty and changes the look of the - // control accordingly. - void LayoutControl_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ e ) - { - if ( e->AffectedProperty != nullptr ) - { - if ( e->AffectedProperty->Equals( "Bounds" ) ) - { - TextBox1->Left = (this->Width - TextBox1->Width) / 2; - TextBox1->Top = (this->Height - TextBox1->Height) / 2; - } - } - else - { - this->Size = System::Drawing::Size( 150, 160 ); - TextBox1->Location = System::Drawing::Point( 16, 24 ); - } - - TextBox1->Text = String::Format( "Left = {0} Top = {1}", TextBox1->Left, TextBox1->Top ); - } - -}; - -public ref class LayoutForm: public System::Windows::Forms::Form -{ -public: - LayoutForm() - : Form() - { - InitializeComponent(); - } - - -public private: - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Button^ Button2; - LayoutControl^ LayoutControl1; - System::Windows::Forms::Button^ Button3; - -private: - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button2 = gcnew System::Windows::Forms::Button; - this->Button3 = gcnew System::Windows::Forms::Button; - this->LayoutControl1 = gcnew LayoutControl; - this->SuspendLayout(); - this->Button1->Location = System::Drawing::Point( 16, 16 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 120, 32 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Center textbox on control"; - this->Button2->Location = System::Drawing::Point( 152, 16 ); - this->Button2->Name = "Button2"; - this->Button2->Size = System::Drawing::Size( 104, 32 ); - this->Button2->TabIndex = 3; - this->Button2->Text = "Shrink user control"; - this->Button3->Location = System::Drawing::Point( 96, 232 ); - this->Button3->Name = "Button3"; - this->Button3->TabIndex = 5; - this->Button3->Text = "Reset"; - this->LayoutControl1->BackColor = System::Drawing::SystemColors::ControlDark; - this->LayoutControl1->Location = System::Drawing::Point( 72, 64 ); - this->LayoutControl1->Name = "LayoutControl1"; - this->LayoutControl1->Size = System::Drawing::Size( 150, 160 ); - this->LayoutControl1->TabIndex = 6; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button3 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->LayoutControl1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - this->Button1->Click += gcnew System::EventHandler( this,&LayoutForm::Button1_Click ); - this->Button2->Click += gcnew System::EventHandler( this,&LayoutForm::Button2_Click ); - this->Button3->Click += gcnew System::EventHandler( this,&LayoutForm::Button3_Click ); - } - - - // This method explicitly calls raises the layout event on - // LayoutControl1, changing the Bounds property. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - LayoutControl1->PerformLayout( LayoutControl1, "Bounds" ); - } - - - // This resize of LayoutControl1 implicitly triggers the layout event. - // Changing the size of the control affects its Bounds property. - void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - LayoutControl1->Size = System::Drawing::Size( 100, 100 ); - } - - - // This method explicitly calls PerformLayout with no parameters, - // which raises the Layout event with the LayoutEventArgs properties - // equal to Nothing. - void Button3_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - LayoutControl1->PerformLayout(); - } - -}; - - -[System::STAThread] -int main() -{ - Application::Run( gcnew LayoutForm ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp deleted file mode 100644 index 951636882be..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// This example demonstrates using the Control.Region property by -// creating a round button. - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing::Drawing2D; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializeComponent(); - } - -internal: - System::Windows::Forms::Button^ roundButton; - -private: - void InitializeComponent() - { - this->roundButton = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - this->roundButton->BackColor = System::Drawing::Color::PowderBlue; - this->roundButton->Location = System::Drawing::Point( 88, 72 ); - this->roundButton->Name = "RoundButton"; - this->roundButton->Size = System::Drawing::Size( 112, 112 ); - this->roundButton->TabIndex = 0; - this->roundButton->Text = "I'm round"; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->roundButton ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - this->roundButton->Paint += gcnew PaintEventHandler( - this, &Form1::roundButton_Paint ); - } - - // -private: - // This method will change the square button to a circular button by - // creating a new circle-shaped GraphicsPath object and setting it - // to the RoundButton objects region. - void roundButton_Paint( Object^ sender, - System::Windows::Forms::PaintEventArgs^ e ) - { - System::Drawing::Drawing2D::GraphicsPath^ buttonPath = - gcnew System::Drawing::Drawing2D::GraphicsPath; - - // Set a new rectangle to the same size as the button's - // ClientRectangle property. - System::Drawing::Rectangle newRectangle = roundButton->ClientRectangle; - - // Decrease the size of the rectangle. - newRectangle.Inflate( -10, -10 ); - - // Draw the button's border. - e->Graphics->DrawEllipse( System::Drawing::Pens::Black, newRectangle ); - - // Increase the size of the rectangle to include the border. - newRectangle.Inflate( 1, 1 ); - - // Create a circle within the new rectangle. - buttonPath->AddEllipse( newRectangle ); - - // Set the button's Region property to the newly created - // circle region. - roundButton->Region = gcnew System::Drawing::Region( buttonPath ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp deleted file mode 100644 index 77c708c925d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp +++ /dev/null @@ -1,80 +0,0 @@ -#using -#using -#using - -// -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -namespace csTempWindowsApplication1 -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - - // Constant value was found in the "windows.h" header file. - static const Int32 WM_ACTIVATEAPP = 0x001C; - Boolean appActive; - - public: - Form1() - { - appActive = true; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - this->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",18.0F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); - } - - - protected: - virtual void OnPaint( PaintEventArgs^ e ) override - { - - // Paint a string in different styles depending on whether the - // application is active. - if ( appActive ) - { - e->Graphics->FillRectangle( SystemBrushes::ActiveCaption, 20, 20, 260, 50 ); - e->Graphics->DrawString( "Application is active", this->Font, SystemBrushes::ActiveCaptionText, 20, 20 ); - } - else - { - e->Graphics->FillRectangle( SystemBrushes::InactiveCaption, 20, 20, 260, 50 ); - e->Graphics->DrawString( "Application is Inactive", this->Font, SystemBrushes::ActiveCaptionText, 20, 20 ); - } - } - - - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - virtual void WndProc( Message% m ) override - { - - // Listen for operating system messages. - switch ( m.Msg ) - { - case WM_ACTIVATEAPP: - - // The WParam value identifies what is occurring. - appActive = (int)m.WParam != 0; - - // Invalidate to get new text painted. - this->Invalidate(); - break; - } - Form::WndProc( m ); - } - - }; - -} - - -[STAThread] -int main() -{ - Application::Run( gcnew csTempWindowsApplication1::Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp deleted file mode 100644 index 0ef6650f337..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp +++ /dev/null @@ -1,103 +0,0 @@ -// -//This code examples shows a use of the Control.Capture property. -// - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class CaptureForm: public System::Windows::Forms::Form -{ -public: - CaptureForm() : Form() - { - InitializeComponent(); - this->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); - this->listbox1->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); - this->listbox2->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); - this->label1->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); - } - -internal: - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::ListBox^ listbox1; - System::Windows::Forms::ListBox^ listbox2; - -private: - void InitializeComponent() - { - this->label1 = gcnew System::Windows::Forms::Label; - this->listbox1 = gcnew System::Windows::Forms::ListBox; - this->listbox2 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - //Label1 - // - this->label1->Location = System::Drawing::Point( 168, 72 ); - this->label1->Name = "Label1"; - this->label1->Size = System::Drawing::Size( 104, 72 ); - this->label1->TabIndex = 4; - this->label1->Text = - "Click around the form to see what control has captured the mouse."; - - // - //LunchBox - // - this->listbox2->AllowDrop = true; - array^ temp0 = { "Sandwich", "Chips", "Soda", "Soup", "Salad" }; - this->listbox2->Items->AddRange( temp0 ); - this->listbox2->Location = System::Drawing::Point( 296, 64 ); - this->listbox2->Name = "LunchBox"; - this->listbox2->Size = System::Drawing::Size( 120, 95 ); - this->listbox2->TabIndex = 5; - - // - //BreakfastBox - // - this->listbox1->AllowDrop = true; - array^ temp1 = - { "Bagels", "Pancakes", "Donuts", "Eggs", "Hashbrowns", "Orange Juice" }; - this->listbox1->Items->AddRange( temp1 ); - this->listbox1->Location = System::Drawing::Point( 24, 64 ); - this->listbox1->Name = "BreakfastBox"; - this->listbox1->Size = System::Drawing::Size( 120, 95 ); - this->listbox1->TabIndex = 6; - - // - //CaptureForm - // - this->ClientSize = System::Drawing::Size( 440, 266 ); - this->Controls->Add( this->listbox1 ); - this->Controls->Add( this->listbox2 ); - this->Controls->Add( this->label1 ); - this->Name = "CaptureForm"; - this->Text = "CaptureForm"; - this->ResumeLayout( false ); - } - - - // - // This method handles the mouse down event for all the controls on the form. - // When a control has captured the mouse - // the control's name will be output on label1. - void Control_MouseDown( System::Object^ sender, - System::Windows::Forms::MouseEventArgs^ /*e*/ ) - { - Control^ control = (Control^)(sender); - if ( control->Capture ) - { - label1->Text = control->Name + " has captured the mouse"; - } - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew CaptureForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp deleted file mode 100644 index ee6e623e6a1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp +++ /dev/null @@ -1,146 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; - -// -// To use this example create a new form and paste this class -// forming the same file, after the form class in the same file. -// Add a button of type FunButton to the form. -public ref class FunButton: public Button -{ -protected: - virtual void OnMouseHover( System::EventArgs^ e ) override - { - - // Get the font size in Points, add one to the - // size, and reset the button's font to the larger - // size. - float fontSize = Font->SizeInPoints; - fontSize += 1; - System::Drawing::Size buttonSize = Size; - this->Font = gcnew System::Drawing::Font( Font->FontFamily,fontSize,Font->Style ); - - // Increase the size width and height of the button - // by 5 points each. - Size = System::Drawing::Size( Size.Width + 5, Size.Height + 5 ); - - // Call myBase.OnMouseHover to activate the delegate. - Button::OnMouseHover( e ); - } - - virtual void OnMouseMove( MouseEventArgs^ e ) override - { - - // Make the cursor the Hand cursor when the mouse moves - // over the button. - Cursor = Cursors::Hand; - - // Call MyBase.OnMouseMove to activate the delegate. - Button::OnMouseMove( e ); - } - // -}; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - Populate_ListBox(); - - //Add any initialization after the InitializeComponent() call - } - - -public: - - //Form calls destructor to clean up the component list. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - FunButton^ Button1; - System::Windows::Forms::ListBox^ ListBox1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - Button1 = gcnew FunButton; - Button1->Text = "CLICK"; - this->ListBox1 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - //ListBox1 - this->Button1->Location = System::Drawing::Point( 40, 40 ); - - // - this->ListBox1->Location = System::Drawing::Point( 88, 112 ); - this->ListBox1->Name = "ListBox1"; - this->ListBox1->Size = System::Drawing::Size( 120, 95 ); - this->ListBox1->TabIndex = 1; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->ListBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // - // Add this method to a form containing a ListBox control named ListBox1. - // Call the method in the constructor or Load method of the form. - // - // The following method displays the default font, - // background color and foreground color values for the ListBox - // control. The values are displayed in the ListBox, itself. - void Populate_ListBox() - { - ListBox1->Dock = DockStyle::Bottom; - - // Display the values in the read-only properties - // DefaultBackColor, DefaultFont, DefaultForecolor. - ListBox1->Items->Add( String::Format( "Default BackColor: {0}", ListBox::DefaultBackColor ) ); - ListBox1->Items->Add( String::Format( "Default Font: {0}", ListBox::DefaultFont ) ); - ListBox1->Items->Add( String::Format( "Default ForeColor:{0}", ListBox::DefaultForeColor ) ); - } - // -}; - - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp deleted file mode 100644 index 543331c5521..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// This example demonstrates overriding the OnClick method of a -// custom TextBox control. - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// -// This is a custom TextBox control that overrides the OnClick method -// to allow one-click selection of the text in the text box. -public ref class SingleClickTextBox: public TextBox -{ -protected: - virtual void OnClick( EventArgs^ e ) override - { - this->SelectAll(); - TextBox::OnClick( e ); - } -}; -// - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - InitializeComponent(); - } - -internal: - TextBox^ TextBox1; - SingleClickTextBox^ TextBox2; - -private: - void InitializeComponent() - { - this->TextBox1 = gcnew TextBox; - this->TextBox2 = gcnew SingleClickTextBox; - this->SuspendLayout(); - this->TextBox1->Location = System::Drawing::Point( 40, 60 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->TabIndex = 1; - this->TextBox1->Size = System::Drawing::Size( 150, 80 ); - this->TextBox1->Text = "This textbox requires a drag motion for selection."; - this->TextBox1->Multiline = true; - this->TextBox1->Select( 0, 0 ); - this->SuspendLayout(); - this->TextBox2->Location = System::Drawing::Point( 40, 150 ); - this->TextBox2->Name = "TextBox2"; - this->TextBox2->TabIndex = 2; - this->TextBox2->Size = System::Drawing::Size( 150, 80 ); - this->TextBox2->Text = "One click causes all text to be selected."; - this->TextBox2->Multiline = true; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->TextBox2 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp deleted file mode 100644 index 5e1e27f8ada..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp +++ /dev/null @@ -1,152 +0,0 @@ - - -#using -#using -#using - -//This code example demonstrates ControlPaint.DrawReversibleLine, -//ControlPaint.DrawFocusRectangle and ControlPaint.FillReversibleRectangle. -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Button^ Button2; - System::Windows::Forms::Button^ Button3; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button2 = gcnew System::Windows::Forms::Button; - this->Button3 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 48, 40 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 88, 80 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click for focus rectangle on Button2"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Button2 - // - this->Button2->Location = System::Drawing::Point( 176, 48 ); - this->Button2->Name = "Button2"; - this->Button2->Size = System::Drawing::Size( 72, 64 ); - this->Button2->TabIndex = 1; - this->Button2->Text = "Hover over me for filled rectangle"; - this->Button2->MouseHover += gcnew System::EventHandler( this, &Form1::Button2_MouseHover ); - this->Button2->MouseLeave += gcnew System::EventHandler( this, &Form1::Button2_MouseLeave ); - - // - //Button3 - // - this->Button3->Location = System::Drawing::Point( 104, 160 ); - this->Button3->Name = "Button3"; - this->Button3->Size = System::Drawing::Size( 96, 72 ); - this->Button3->TabIndex = 2; - this->Button3->Text = "Hover over for me for reversible lines"; - this->Button3->MouseHover += gcnew System::EventHandler( this, &Form1::Button3_MouseHover ); - this->Button3->MouseLeave += gcnew System::EventHandler( this, &Form1::Button3_MouseLeave ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button3 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // This method draws a focus rectangle on Button2 using the - // handle and client rectangle of Button2. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ControlPaint::DrawFocusRectangle( Graphics::FromHwnd( Button2->Handle ), Button2->ClientRectangle ); - } - // - - // - //When the mouse hovers over Button2, its ClientRectangle is filled. - void Button2_MouseHover( Object^ sender, System::EventArgs^ /*e*/ ) - { - Control^ senderControl = dynamic_cast(sender); - Rectangle screenRectangle = senderControl->RectangleToScreen( senderControl->ClientRectangle ); - ControlPaint::FillReversibleRectangle( screenRectangle, senderControl->BackColor ); - } - - // When the mouse leaves Button2, its ClientRectangle is cleared by - // calling the FillReversibleRectangle method again. - void Button2_MouseLeave( Object^ sender, System::EventArgs^ /*e*/ ) - { - Control^ senderControl = dynamic_cast(sender); - Rectangle screenRectangle = senderControl->RectangleToScreen( senderControl->ClientRectangle ); - ControlPaint::FillReversibleRectangle( screenRectangle, senderControl->BackColor ); - } - // - - // - // When the mouse hovers over Button3, two reversible lines are - // drawn using the corner coordinates of Button3, which are first - // converted to screen coordinates. - void Button3_MouseHover( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(0,0) ), Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); - ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Top) ), Button3->PointToScreen( Point(Button1->ClientRectangle.Left,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); - } - - // When the mouse moves from Button3, the reversible lines are erased by - // using the same coordinates as are used in the Button3_MouseHover method. - void Button3_MouseLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(0,0) ), Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); - ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Top) ), Button3->PointToScreen( Point(Button3->ClientRectangle.Left,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp deleted file mode 100644 index 43320162e54..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp +++ /dev/null @@ -1,98 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 24, 32 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Button1"; - this->Button1->Paint += gcnew PaintEventHandler( this, &Form1::Button1_Paint ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Handle the Button1 object's Paint Event to create a CaptionButton. - void Button1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - - // Draw a CaptionButton control using the ClientRectangle - // property of Button1. Make the button a Help button - // with a normal state. - ControlPaint::DrawCaptionButton( e->Graphics, Button1->ClientRectangle, CaptionButton::Help, ButtonState::Normal ); - } - // - - // - // Handle the Form's Paint event to draw a 3D three-dimensional - // raised border just inside the border of the frame. - void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) - { - Rectangle borderRectangle = this->ClientRectangle; - borderRectangle.Inflate( -10, -10 ); - ControlPaint::DrawBorder3D( e->Graphics, borderRectangle, Border3DStyle::Raised ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp deleted file mode 100644 index 68d1dc93221..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp +++ /dev/null @@ -1,135 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace CursorStuff -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - } - - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Cursor = System::Windows::Forms::Cursors::Default; - this->button1->Location = System::Drawing::Point( 40, 184 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 2; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->Cursor = System::Windows::Forms::Cursors::Default; - this->button2->Location = System::Drawing::Point( 56, 232 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 3; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->button2,this->button1}; - this->Controls->AddRange( temp0 ); - this->Cursor = System::Windows::Forms::Cursors::Hand; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->MoveCursor(); - } - - // - void MoveCursor() - { - // Set the Current cursor, move the cursor's Position, - // and set its clipping rectangle to the form. - - this->Cursor = gcnew System::Windows::Forms::Cursor( ::Cursor::Current->Handle ); - ::Cursor::Position = Point(::Cursor::Position.X - 50,::Cursor::Position.Y - 50); - ::Cursor::Clip = Rectangle(this->Location,this->Size); - - } - // - - // - void DrawCursorsOnForm( System::Windows::Forms::Cursor^ cursor ) - { - - // If the form's cursor is not the Hand cursor and the - // Current cursor is the Default, Draw the specified - // cursor on the form in normal size and twice normal size. - if ( this->Cursor != Cursors::Hand && System::Windows::Forms::Cursor::Current == Cursors::Default ) - { - - // Draw the cursor stretched. - Graphics^ graphics = this->CreateGraphics(); - Rectangle rectangle = Rectangle(Point(10,10),System::Drawing::Size( cursor->Size.Width * 2, cursor->Size.Height * 2 )); - cursor->DrawStretched( graphics, rectangle ); - - // Draw the cursor in normal size. - rectangle.Location = Point(rectangle.Width + rectangle.Location.X,rectangle.Height + rectangle.Location.Y); - rectangle.Size = cursor->Size; - cursor->Draw( graphics, rectangle ); - - // Dispose of the cursor. - delete cursor; - } - } - // - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->DrawCursorsOnForm( gcnew System::Windows::Forms::Cursor( "c:\\MyCursor.cur" ) ); - } - - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew CursorStuff::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp deleted file mode 100644 index 35a0ebd497f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp +++ /dev/null @@ -1,120 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace MCursor -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::ComboBox^ cursorSelectionComboBox; - System::Windows::Forms::Panel^ testPanel; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::ListView^ cursorEventViewer; - System::Windows::Forms::Label ^ label3; - - public: - Form1() - { - this->cursorSelectionComboBox = gcnew System::Windows::Forms::ComboBox; - this->testPanel = gcnew System::Windows::Forms::Panel; - this->label1 = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->cursorEventViewer = gcnew System::Windows::Forms::ListView; - this->label3 = gcnew System::Windows::Forms::Label; - - // Select Cursor Label - this->label2->Location = System::Drawing::Point( 24, 16 ); - this->label2->Size = System::Drawing::Size( 80, 16 ); - this->label2->Text = "Select cursor:"; - - // Cursor Testing Panel Label - this->label1->Location = System::Drawing::Point( 24, 80 ); - this->label1->Size = System::Drawing::Size( 144, 23 ); - this->label1->Text = "Cursor testing panel:"; - - // Cursor Changed Events Label - this->label3->Location = System::Drawing::Point( 184, 16 ); - this->label3->Size = System::Drawing::Size( 128, 16 ); - this->label3->Text = "Cursor changed events:"; - - // Cursor Selection ComboBox - this->cursorSelectionComboBox->Location = System::Drawing::Point( 24, 40 ); - this->cursorSelectionComboBox->Size = System::Drawing::Size( 152, 21 ); - this->cursorSelectionComboBox->TabIndex = 0; - this->cursorSelectionComboBox->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::cursorSelectionComboBox_SelectedIndexChanged ); - - // Cursor Test Panel - this->testPanel->BackColor = System::Drawing::SystemColors::ControlDark; - this->testPanel->Location = System::Drawing::Point( 24, 104 ); - this->testPanel->Size = System::Drawing::Size( 152, 160 ); - this->testPanel->CursorChanged += gcnew System::EventHandler( this, &Form1::testPanel_CursorChanged ); - - // Cursor Event ListView - this->cursorEventViewer->Location = System::Drawing::Point( 184, 40 ); - this->cursorEventViewer->Size = System::Drawing::Size( 256, 224 ); - this->cursorEventViewer->TabIndex = 4; - this->cursorEventViewer->View = System::Windows::Forms::View::List; - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 456, 286 ); - array^temp0 = {this->label3,this->cursorEventViewer,this->label2,this->label1,this->testPanel,this->cursorSelectionComboBox}; - this->Controls->AddRange( temp0 ); - this->Text = "Cursors Example"; - - // Add all the cursor types to the combobox. - System::Collections::IEnumerator^ myEnum = CursorList()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - System::Windows::Forms::Cursor^ cursor = safe_cast(myEnum->Current); - cursorSelectionComboBox->Items->Add( cursor ); - } - } - - - private: - array^ CursorList() - { - - // Make an array of all the types of cursors in Windows Forms. - array^temp1 = {Cursors::AppStarting,Cursors::Arrow,Cursors::Cross,Cursors::Default,Cursors::Hand,Cursors::Help,Cursors::HSplit,Cursors::IBeam,Cursors::No,Cursors::NoMove2D,Cursors::NoMoveHoriz,Cursors::NoMoveVert,Cursors::PanEast,Cursors::PanNE,Cursors::PanNorth,Cursors::PanNW,Cursors::PanSE,Cursors::PanSouth,Cursors::PanSW,Cursors::PanWest,Cursors::SizeAll,Cursors::SizeNESW,Cursors::SizeNS,Cursors::SizeNWSE,Cursors::SizeWE,Cursors::UpArrow,Cursors::VSplit,Cursors::WaitCursor}; - return temp1; - } - - void cursorSelectionComboBox_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Set the cursor in the test panel to be the selected cursor style. - testPanel->Cursor = dynamic_cast(cursorSelectionComboBox->SelectedItem); - } - - void testPanel_CursorChanged( Object^ sender, System::EventArgs^ /*e*/ ) - { - - // Build up a String* containing the type of Object* sending the event, and the event. - String^ cursorEvent = String::Format( "[{0}]: {1}", sender->GetType(), "Cursor changed" ); - - // Record this event in the list view. - this->cursorEventViewer->Items->Add( cursorEvent ); - } - - }; - -} - - -[STAThread] -int main() -{ - Application::Run( gcnew MCursor::Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp deleted file mode 100644 index 02ccd8a884c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp +++ /dev/null @@ -1,181 +0,0 @@ -// -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Globalization; -using namespace System::Windows::Forms; -// - -namespace DataConnectorAddingNewExample -{ - // - // This class implements a simple customer type. - public ref class DemoCustomer - { - private: - // These fields hold the values for the public properties. - Guid idValue; - String^ customerName; - String^ companyNameValue; - String^ phoneNumberValue; - - // The constructor is private to enforce the factory pattern. - DemoCustomer() - { - idValue = Guid::NewGuid(); - customerName = String::Empty; - companyNameValue = String::Empty; - phoneNumberValue = String::Empty; - customerName = "no data"; - companyNameValue = "no data"; - phoneNumberValue = "no data"; - } - - public: - // This is the public factory method. - static DemoCustomer^ CreateNewCustomer() - { - return gcnew DemoCustomer; - } - - property Guid ID - { - // This property represents an ID, suitable - // for use as a primary key in a database. - Guid get() - { - return this->idValue; - } - } - - property String^ CompanyName - { - String^ get() - { - return this->companyNameValue; - } - - void set(String^ value) - { - this->companyNameValue = value; - } - } - - property String^ PhoneNumber - { - String^ get() - { - return this->phoneNumberValue; - } - - void set(String^ value) - { - this->phoneNumberValue = value; - } - } - }; - // - - // - // This form demonstrates using a BindingSource to provide - // data from a collection of custom types - // to a DataGridView control. - public ref class MainForm: public System::Windows::Forms::Form - { - // - private: - - // This is the BindingSource that will provide data for - // the DataGridView control. - BindingSource^ customersBindingSource; - - // This is the DataGridView control - // that will display our data. - DataGridView^ customersDataGridView; - - // Set up the StatusBar for displaying ListChanged events. - StatusBar^ status; - // - - // - public: - - MainForm() - { - customersBindingSource = gcnew BindingSource; - customersDataGridView = gcnew DataGridView; - status = gcnew StatusBar; - - // Set up the form. - this->Size = System::Drawing::Size(600, 400); - this->Text = "BindingSource.AddingNew sample"; - this->Load += - gcnew EventHandler(this, &MainForm::OnMainFormLoad); - this->Controls->Add(status); - - // Set up the DataGridView control. - this->customersDataGridView->Dock = DockStyle::Fill; - this->Controls->Add(this->customersDataGridView); - - // Attach an event handler for the AddingNew event. - this->customersBindingSource->AddingNew += - gcnew AddingNewEventHandler(this, - &MainForm::OnCustomersBindingSourceAddingNew); - - // Attach an event handler for the ListChanged event. - this->customersBindingSource->ListChanged += - gcnew ListChangedEventHandler(this, - &MainForm::OnCustomersBindingSourceListChanged); - } - // - - // - private: - - void OnMainFormLoad(Object^ sender, EventArgs^ e) - { - // Add a DemoCustomer to cause a row to be displayed. - this->customersBindingSource->AddNew(); - - // Bind the BindingSource to the DataGridView - // control's DataSource. - this->customersDataGridView->DataSource = - this->customersBindingSource; - } - // - - // - // This event handler provides custom item-creation behavior. - void OnCustomersBindingSourceAddingNew(Object^ sender, - AddingNewEventArgs^ e) - { - e->NewObject = DemoCustomer::CreateNewCustomer(); - } - // - - // - // This event handler detects changes in the BindingSource - // list or changes to items within the list. - void OnCustomersBindingSourceListChanged(Object^ sender, - ListChangedEventArgs^ e) - { - status->Text = Convert::ToString(e->ListChangedType, - CultureInfo::CurrentCulture); - } - // - }; - // -} - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew DataConnectorAddingNewExample::MainForm); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp deleted file mode 100644 index b314e5e6fff..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp +++ /dev/null @@ -1,253 +0,0 @@ -// -// -#using -#using -#using -#using -using namespace System; -using namespace System::Collections::Generic; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Data::SqlClient; -using namespace System::Drawing; -using namespace System::Windows::Forms; -// - -// -// This class implements a simple customer type. -public ref class DemoCustomer -{ -private: - // These fields hold the values for the public properties. - static Guid idValue = Guid::NewGuid(); - static String^ customerName = String::Empty; - static String^ companyNameValue = String::Empty; - static String^ phoneNumberValue = String::Empty; - - // The constructor is private to enforce the factory pattern. - DemoCustomer() - { - customerName = L"no data"; - companyNameValue = L"no data"; - phoneNumberValue = L"no data"; - } - -public: - // This is the public factory method. - static DemoCustomer^ CreateNewCustomer() - { - return gcnew DemoCustomer; - } - - property Guid ID - { - // This property represents an ID, suitable - // for use as a primary key in a database. - Guid get() - { - return this->idValue; - } - } - - property String^ CompanyName - { - String^ get() - { - return this->companyNameValue; - } - - void set( String^ value ) - { - this->companyNameValue = value; - } - } - - property String^ PhoneNumber - { - String^ get() - { - return this->phoneNumberValue; - } - - void set( String^ value ) - { - this->phoneNumberValue = value; - } - } -}; -// - -// -// This form demonstrates using the ItemChangedEventMode property -// of the BindingSource component to control which ListChanged -// events are raised when BindingSource component's underlying -// list is changed. -public ref class Form1: public System::Windows::Forms::Form -{ -private: - // - // This is the BindingSource that will provide data for - // the DataGridView control. - static BindingSource^ customersBindingSource = gcnew BindingSource; - - // This is the DataGridView control that will display our data. - static DataGridView^ customersDataGridView = gcnew DataGridView; - - // This panel holds the RadioButton controls. - static Panel^ buttonPanel = gcnew Panel; - - // These RadioButton controls manage the ItemChangedEventMode - // state of the BindingSource. - static RadioButton^ allRadioBtn = gcnew RadioButton; - static RadioButton^ currentRadioBtn = gcnew RadioButton; - static RadioButton^ noneRadioBtn = gcnew RadioButton; - - // this StatusBar control will display the ListChanged events. - static StatusBar^ status = gcnew StatusBar; - // - -public: - // - Form1() - { - // Set up the form. - this->Size = System::Drawing::Size( 800, 800 ); - this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); - - // Set up the RadioButton controls. - this->allRadioBtn->Text = L"All"; - this->allRadioBtn->Checked = true; - this->allRadioBtn->CheckedChanged += gcnew EventHandler( - this, &Form1::allRadioBtn_CheckedChanged ); - this->allRadioBtn->Dock = DockStyle::Top; - this->currentRadioBtn->Text = L"Current"; - this->currentRadioBtn->CheckedChanged += gcnew EventHandler( - this, &Form1::currentRadioBtn_CheckedChanged ); - this->currentRadioBtn->Dock = DockStyle::Top; - this->noneRadioBtn->Text = L"None"; - this->noneRadioBtn->CheckedChanged += gcnew EventHandler( - this, &Form1::noneRadioBtn_CheckedChanged ); - this->noneRadioBtn->Dock = DockStyle::Top; - this->buttonPanel->Controls->Add( this->allRadioBtn ); - this->buttonPanel->Controls->Add( this->currentRadioBtn ); - this->buttonPanel->Controls->Add( this->noneRadioBtn ); - this->buttonPanel->Dock = DockStyle::Bottom; - this->Controls->Add( this->buttonPanel ); - - // Set up the DataGridView control. - this->customersDataGridView->AllowUserToAddRows = true; - this->customersDataGridView->Dock = DockStyle::Fill; - this->Controls->Add( customersDataGridView ); - - // Add the StatusBar control to the form. - this->Controls->Add( status ); - - // Allow the user to add new items. - this->customersBindingSource->AllowNew = true; - - // Attach an event handler for the AddingNew event. - this->customersBindingSource->AddingNew += - gcnew AddingNewEventHandler( - this, &Form1::customersBindingSource_AddingNew ); - - // Attach an eventhandler for the ListChanged event. - this->customersBindingSource->ListChanged += - gcnew ListChangedEventHandler( - this, &Form1::customersBindingSource_ListChanged ); - - // Set the initial value of the ItemChangedEventMode property - // to report all ListChanged events. - this->customersBindingSource->ItemChangedEventMode = - ItemChangedEventMode::All; - - // Attach the BindingSource to the DataGridView. - this->customersDataGridView->DataSource = - this->customersBindingSource; - } - // - -private: - // - void Form1_Load( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create and populate the list of DemoCustomer objects - // which will supply data to the DataGridView. - List< DemoCustomer^ >^ customerList = gcnew List< DemoCustomer^ >; - customerList->Add( DemoCustomer::CreateNewCustomer() ); - customerList->Add( DemoCustomer::CreateNewCustomer() ); - customerList->Add( DemoCustomer::CreateNewCustomer() ); - - // Bind the list to the BindingSource. - this->customersBindingSource->DataSource = customerList; - } - // - - // - // This event handler provides custom item-creation behavior. - void customersBindingSource_AddingNew( - Object^ /*sender*/, - AddingNewEventArgs^ e ) - { - e->NewObject = DemoCustomer::CreateNewCustomer(); - } - // - - // - // This event handler detects changes in the BindingSource - // list or changes to items within the list. - void customersBindingSource_ListChanged( - Object^ /*sender*/, - ListChangedEventArgs^ e ) - { - status->Text = e->ListChangedType.ToString(); - } - // - - // - // These event handlers change the state of the BindingSource - // component's ItemChangedEventMode property. - void allRadioBtn_CheckedChanged( - Object^ /*sender*/, - EventArgs^ /*e*/ ) - { - if ( this->allRadioBtn->Checked ) - { - this->customersBindingSource->ItemChangedEventMode = - ItemChangedEventMode::All; - } - } - - void currentRadioBtn_CheckedChanged( - Object^ /*sender*/, - EventArgs^ /*e*/ ) - { - if ( this->currentRadioBtn->Checked ) - { - this->customersBindingSource->ItemChangedEventMode = - ItemChangedEventMode::Current; - } - } - - void noneRadioBtn_CheckedChanged( - Object^ /*sender*/, - EventArgs^ /*e*/ ) - { - if ( this->noneRadioBtn->Checked ) - { - this->customersBindingSource->ItemChangedEventMode = - ItemChangedEventMode::None; - } - } - // - -public: - [STAThread] - static void main() - { - Application::EnableVisualStyles(); - Application::EnableRTLMirroring(); - Application::Run( gcnew Form1 ); - } -}; -// -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp deleted file mode 100644 index a53ef06ab0f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp +++ /dev/null @@ -1,169 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Text; -using namespace System::Xml; -using namespace System::Windows::Forms; -using namespace System::IO; - -namespace System_Windows_Forms_UpdateBinding -{ - public ref class Form1: public Form - { - public: - Form1() - { - InitializeComponent(); - } - - [STAThread] - static void Main() - { - Application::EnableVisualStyles(); - Application::Run( gcnew Form1 ); - } - - // - private: - void Form1_Load( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // The xml to bind to. - String^ xml = "" + - "WashingtonOlympia" + - "OregonSalem" + - "CaliforniaSacramento" + - "NevadaCarson City" + - ""; - - // Convert the xml string to bytes and load into a memory stream. - array^ xmlBytes = Encoding::UTF8->GetBytes( xml ); - MemoryStream^ stream = gcnew MemoryStream( xmlBytes,false ); - - // Create a DataSet and load the xml into it. - dataSet1->ReadXml( stream ); - - // Set the DataSource to the DataSet, and the DataMember - // to state. - bindingSource1->DataSource = dataSet1; - bindingSource1->DataMember = "state"; - - dataGridView1->DataSource = bindingSource1; - } - // - - // - private: - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ xml = "" - + "WashingtonOlympia " - + "Coast Rhododendron" - + "OregonSalem" - + "Oregon Grape" - + "CaliforniaSacramento" - + "California Poppy" - + "NevadaCarson City" - + "Sagebrush" - + ""; - - // Convert the xml string to bytes and load into a memory stream. - array^ xmlBytes = Encoding::UTF8->GetBytes( xml ); - MemoryStream^ stream = gcnew MemoryStream( xmlBytes,false ); - - // Create a DataSet and load the xml into it. - dataSet2->ReadXml( stream ); - - // Set the data source. - bindingSource1->DataSource = dataSet2; - bindingSource1->ResetBindings( true ); - } - // - - System::Windows::Forms::Button^ button1; - System::Windows::Forms::DataGridView^ dataGridView1; - System::Windows::Forms::BindingSource^ bindingSource1; - System::Data::DataSet^ dataSet1; - DataSet^ dataSet2; - - #pragma region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->dataGridView1 = gcnew System::Windows::Forms::DataGridView; - this->bindingSource1 = gcnew System::Windows::Forms::BindingSource; - this->dataSet1 = gcnew System::Data::DataSet; - this->dataSet2 = gcnew System::Data::DataSet; - ( (System::ComponentModel::ISupportInitialize^)(this->dataGridView1) )->BeginInit(); - ( (System::ComponentModel::ISupportInitialize^)(this->bindingSource1) )->BeginInit(); - ( (System::ComponentModel::ISupportInitialize^)(this->dataSet1) )->BeginInit(); - ( (System::ComponentModel::ISupportInitialize^)(this->dataSet2) )->BeginInit(); - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 98, 222 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // dataGridView1 - // - this->dataGridView1->Dock = System::Windows::Forms::DockStyle::Top; - this->dataGridView1->Location = System::Drawing::Point( 0, 0 ); - this->dataGridView1->Name = "dataGridView1"; - this->dataGridView1->Size = System::Drawing::Size( 292, 150 ); - this->dataGridView1->TabIndex = 1; - - // - // dataSet1 - // - this->dataSet1->DataSetName = "NewDataSet"; - this->dataSet1->Locale = gcnew System::Globalization::CultureInfo( "en-US" ); - - // - // dataSet2 - // - this->dataSet2->DataSetName = "NewDataSet"; - this->dataSet2->Locale = gcnew System::Globalization::CultureInfo( "en-US" ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Controls->Add( this->dataGridView1 ); - this->Controls->Add( this->button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); - ( (System::ComponentModel::ISupportInitialize^)(this->dataGridView1) )->EndInit(); - ( (System::ComponentModel::ISupportInitialize^)(this->bindingSource1) )->EndInit(); - ( (System::ComponentModel::ISupportInitialize^)(this->dataSet1) )->EndInit(); - ( (System::ComponentModel::ISupportInitialize^)(this->dataSet2) )->EndInit(); - this->ResumeLayout( false ); - } - #pragma endregion - }; -} - -int main() -{ - System_Windows_Forms_UpdateBinding::Form1::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp deleted file mode 100644 index ef99ada33f7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp +++ /dev/null @@ -1,178 +0,0 @@ -// -// -#using -#using -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Data::Common; -using namespace System::Data::SqlClient; -using namespace System::Diagnostics; -using namespace System::Drawing; -using namespace System::Windows::Forms; -// - -// -// This class implements a simple customer type. -public ref class DemoCustomer -{ -private: - // These fields hold the values for the public properties. - Guid idValue; - String^ customerName; - String^ companyNameValue; - String^ phoneNumberValue; - - // The constructor is private to enforce the factory pattern. - DemoCustomer() - { - idValue = Guid::NewGuid(); - customerName = L"no data"; - companyNameValue = L"no data"; - phoneNumberValue = L"no data"; - } - -public: - // This is the public factory method. - static DemoCustomer^ CreateNewCustomer() - { - return gcnew DemoCustomer; - } - - property Guid ID - { - // This property represents an ID, suitable - // for use as a primary key in a database. - Guid get() - { - return this->idValue; - } - } - - property String^ CompanyName - { - String^ get() - { - return this->companyNameValue; - } - - void set( String^ value ) - { - this->companyNameValue = value; - } - } - - property String^ PhoneNumber - { - String^ get() - { - return this->phoneNumberValue; - } - - void set( String^ value ) - { - this->phoneNumberValue = value; - } - } -}; -// - -// -// This form demonstrates using a BindingSource to bind -// a list to a DataGridView control. The list does not -// raise change notifications, so the ResetItem method -// on the BindingSource is used. -public ref class Form1: public System::Windows::Forms::Form -{ -private: - // - // This button causes the value of a list element to be changed. - Button^ changeItemBtn; - - // This is the DataGridView control that displays the contents - // of the list. - DataGridView^ customersDataGridView; - - // This is the BindingSource used to bind the list to the - // DataGridView control. - BindingSource^ customersBindingSource; - // - -public: - // - Form1() - { - changeItemBtn = gcnew Button; - customersDataGridView = gcnew DataGridView; - customersBindingSource = gcnew BindingSource; - - // Set up the "Change Item" button. - this->changeItemBtn->Text = L"Change Item"; - this->changeItemBtn->Dock = DockStyle::Bottom; - this->changeItemBtn->Click += gcnew EventHandler( - this, &Form1::changeItemBtn_Click ); - this->Controls->Add( this->changeItemBtn ); - - // Set up the DataGridView. - customersDataGridView->Dock = DockStyle::Top; - this->Controls->Add( customersDataGridView ); - this->Size = System::Drawing::Size( 800, 200 ); - this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); - } - // - -private: - // - void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Create and populate the list of DemoCustomer objects - // which will supply data to the DataGridView. - List< DemoCustomer^ >^ customerList = gcnew List< DemoCustomer^ >; - customerList->Add( DemoCustomer::CreateNewCustomer() ); - customerList->Add( DemoCustomer::CreateNewCustomer() ); - customerList->Add( DemoCustomer::CreateNewCustomer() ); - - // Bind the list to the BindingSource. - this->customersBindingSource->DataSource = customerList; - - // Attach the BindingSource to the DataGridView. - this->customersDataGridView->DataSource = - this->customersBindingSource; - } - // - - // - // This event handler changes the value of the CompanyName - // property for the first item in the list. - void changeItemBtn_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Get a reference to the list from the BindingSource. - List< DemoCustomer^ >^ customerList = - static_cast^>( - this->customersBindingSource->DataSource); - - // Change the value of the CompanyName property for the - // first item in the list. - customerList->default[ 0 ]->CompanyName = L"Tailspin Toys"; - - // Call ResetItem to alert the BindingSource that the - // list has changed. - this->customersBindingSource->ResetItem( 0 ); - } - // -}; - -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew Form1 ); -} -// -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp deleted file mode 100644 index 70a8c181d3d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp +++ /dev/null @@ -1,215 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Globalization; - -namespace DataConnectorBindingCompleteExample -{ - // - // - // Represents a business object that throws exceptions when - // invalid values are entered for some of its properties. - public ref class Part - { - private: - String^ name; - int number; - double price; - - public: - Part(String^ name, int number, double price) - { - PartName = name; - PartNumber = number; - PartPrice = price; - } - - property String^ PartName - { - String^ get() - { - return name; - } - - void set(String^ value) - { - if (value->Length <= 0) - { - throw gcnew Exception( - "Each part must have a name."); - } - else - { - name = value; - } - } - } - - property double PartPrice - { - double get() - { - return price; - } - - void set(double value) - { - price = value; - } - } - - property int PartNumber - { - int get() - { - return number; - } - - void set(int value) - { - if (value < 100) - { - throw gcnew Exception( - "Invalid part number." \ - "Part numbers must be " \ - "greater than 100."); - } - else - { - number = value; - } - } - } - - }; - - ref class MainForm: public Form - { - private: - BindingSource^ bindingSource; - TextBox^ partNameTextBox; - TextBox^ partNumberTextBox; - TextBox^ partPriceTextBox; - - public: - MainForm() - { - bindingSource = gcnew BindingSource; - partNameTextBox = gcnew TextBox; - partNumberTextBox = gcnew TextBox; - partPriceTextBox = gcnew TextBox; - - //Set up the textbox controls. - this->partNameTextBox->Location = Point(82, 13); - this->partNameTextBox->TabIndex = 1; - this->partNumberTextBox->Location = Point(81, 47); - this->partNumberTextBox->TabIndex = 2; - this->partPriceTextBox->Location = Point(81, 83); - this->partPriceTextBox->TabIndex = 3; - - // Add the textbox controls to the form - this->Controls->Add(this->partNumberTextBox); - this->Controls->Add(this->partNameTextBox); - this->Controls->Add(this->partPriceTextBox); - - // Handle the form's Load event. - this->Load += gcnew EventHandler(this, - &MainForm::OnMainFormLoad); - } - - private: - - // - void OnMainFormLoad(Object^ sender, EventArgs^ e) - { - // Set the DataSource of bindingSource to the Part type. - bindingSource->DataSource = Part::typeid; - - // Bind the textboxes to the properties of the Part type, - // enabling formatting. - partNameTextBox->DataBindings->Add( - "Text", bindingSource, "PartName", true); - partNumberTextBox->DataBindings->Add( - "Text", bindingSource, "PartNumber", true); - - //Bind the textbox to the PartPrice value - // with currency formatting. - partPriceTextBox->DataBindings->Add("Text", bindingSource, "PartPrice", true, - DataSourceUpdateMode::OnPropertyChanged, nullptr, "C"); - - // Handle the BindingComplete event for bindingSource and - // the partNameBinding. - bindingSource->BindingComplete += - gcnew BindingCompleteEventHandler(this, - &MainForm::OnBindingSourceBindingComplete); - bindingSource->BindingComplete += - gcnew BindingCompleteEventHandler(this, - &MainForm::OnPartNameBindingBindingComplete); - - // Add a new part to bindingSource. - bindingSource->Add(gcnew Part("Widget", 1234, 12.45)); - } - - // Handle the BindingComplete event to catch errors and - // exceptions in binding process. - void OnBindingSourceBindingComplete(Object^ sender, - BindingCompleteEventArgs^ e) - { - if (e->BindingCompleteState == - BindingCompleteState::Exception) - { - MessageBox::Show(String::Format( - CultureInfo::CurrentCulture, - "bindingSource: {0}", e->Exception->Message)); - } - - if (e->BindingCompleteState == - BindingCompleteState::DataError) - { - MessageBox::Show(String::Format( - CultureInfo::CurrentCulture, - "bindingSource: {0}", e->Exception->Message)); - } - } - - // Handle the BindingComplete event to catch errors and - // exceptions in binding process. - void OnPartNameBindingBindingComplete(Object^ sender, - BindingCompleteEventArgs^ e) - { - if (e->BindingCompleteState == - BindingCompleteState::Exception) - { - MessageBox::Show(String::Format( - CultureInfo::CurrentCulture, - "PartNameBinding: {0}", e->Exception->Message)); - } - - if (e->BindingCompleteState == - BindingCompleteState::DataError) - { - MessageBox::Show(String::Format( - CultureInfo::CurrentCulture, - "PartNameBinding: {0}", e->Exception->Message)); - } - } - // - }; - -// -// -} - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew - DataConnectorBindingCompleteExample::MainForm()); -} - - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp deleted file mode 100644 index e8117739846..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp +++ /dev/null @@ -1,120 +0,0 @@ -#pragma region Using directives - -#using -#using -#using -#using -using namespace System; -using namespace System::Collections::Generic; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Windows::Forms; - -#pragma endregion - -namespace DataConnectors -{ - ref class Form1 : public Form - { - private: - BindingSource^ bindingSource1; - Button^ moveNextButton; - - public: - Form1() - { - this->Load += gcnew EventHandler(this, &Form1::Form1_Load); - this->Paint += gcnew PaintEventHandler(this, &Form1::Form1_Paint); - this->bindingSource1 = gcnew BindingSource(); - this->moveNextButton = gcnew Button(); - moveNextButton->Text = "Move Next"; - this->moveNextButton->Location = System::Drawing::Point(147, 129); - this->moveNextButton->Click += gcnew System::EventHandler( - this,&Form1::moveNextButton_Click); - - this->ClientSize = System::Drawing::Size(292, 266); - this->Controls->Add(this->moveNextButton); - - } - // The following snippet demonstrates the BindingSource.MoveNext, - // BindingSource.Current,BindingSource.CurrentItem, - // BindingSource.Position and the BindingSourceItem.Value members. - - // To run this example paste the code into a form that contains a - // BindingSource named bindingSource1; and a button named moveNextButton. - // Associate the Form1_Load and the Form1_Paint method with the - // load and paint events for the form, and the moveNextButton_click - // method with the click event for moveNextButton. - - // - void Form1_Load(Object^ sender, EventArgs^ e) - { - // Set the data source to the Brush type and populate - // bindingSource1; with some brushes. - bindingSource1->DataSource = System::Drawing::Brush::typeid; - bindingSource1->Add( - gcnew TextureBrush(gcnew Bitmap(Button::typeid, "Button.bmp"))); - bindingSource1->Add(gcnew HatchBrush(HatchStyle::Cross, Color::Red)); - bindingSource1->Add(gcnew SolidBrush(Color::Blue)); - } - - - private: - void moveNextButton_Click(Object^ sender, EventArgs^ e) - { - // If you are not at the end of the list, move to the next item - // in the BindingSource. - if (bindingSource1->Position + 1 < bindingSource1->Count) - { - bindingSource1->MoveNext(); - } - // Otherwise, move back to the first item. - else - { - bindingSource1->MoveFirst(); - } - // Force the form to repaint. - this->Invalidate(); - } - - void Form1_Paint(Object^ sender, PaintEventArgs^ e) - { - // Get the current item in the BindingSource. - Brush^ item = (Brush^) bindingSource1->Current; - - // If the current type is a TextureBrush, fill an ellipse. - if (item->GetType() == TextureBrush::typeid) - { - e->Graphics->FillEllipse(item,e->ClipRectangle); - } - // If the current type is a HatchBrush, fill a triangle. - else if (item->GetType() == HatchBrush::typeid) - { - - e->Graphics->FillPolygon(item, - gcnew array {*gcnew Point(0, 0), - *gcnew Point(0, 200), - *gcnew Point(200, 0)}); - } - // Otherwise, fill a rectangle. - else - { - e->Graphics->FillRectangle( - (Brush^)bindingSource1->Current, e->ClipRectangle); - } - } - - // - }; -} - - -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew DataConnectors::Form1()); -} - - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp deleted file mode 100644 index 22dec589892..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp +++ /dev/null @@ -1,303 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class AutoSizing: public System::Windows::Forms::Form -{ -private: - FlowLayoutPanel^ flowLayoutPanel1; - Button^ button1; - Button^ button2; - Button^ button3; - Button^ button4; - Button^ button5; - Button^ button6; - Button^ button7; - Button^ button8; - Button^ button9; - Button^ button10; - Button^ button11; - -public: - AutoSizing() - { - button1 = gcnew Button; - button2 = gcnew Button; - button3 = gcnew Button; - button4 = gcnew Button; - button5 = gcnew Button; - button6 = gcnew Button; - button7 = gcnew Button; - button8 = gcnew Button; - button9 = gcnew Button; - button10 = gcnew Button; - button11 = gcnew Button; - thirdColumnHeader = "Main Ingredients"; - boringMeatloaf = "ground beef"; - boringMeatloafRanking = "*"; - otherRestaurant = "Gomes's Saharan Sushi"; - currentLayoutName = "DataGridView.AutoSizeRowsMode is currently: "; - InitializeComponent(); - this->Load += gcnew EventHandler( this, &AutoSizing::InitializeDataGridView ); - AddDirections(); - AddButton( button1, "Reset", gcnew EventHandler( this, &AutoSizing::ResetToDisorder ) ); - AddButton( button2, "Change Column 3 Header", gcnew EventHandler( this, &AutoSizing::ChangeColumn3Header ) ); - AddButton( button3, "Change Meatloaf Recipe", gcnew EventHandler( this, &AutoSizing::ChangeMeatloafRecipe ) ); - AddButton( button4, "Change Restaurant 2", gcnew EventHandler( this, &AutoSizing::ChangeRestaurant ) ); - AddButtonsForAutomaticResizing(); - } - - -private: - void AddDirections() - { - Label^ directions = gcnew Label; - directions->AutoSize = true; - String^ newLine = Environment::NewLine; - directions->Text = String::Format( "Press the buttons that start {0}with 'Change' to see how different sizing {1}modes deal with content changes.", newLine, newLine ); - flowLayoutPanel1->Controls->Add( directions ); - } - - void InitializeComponent() - { - flowLayoutPanel1 = gcnew FlowLayoutPanel; - flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - flowLayoutPanel1->Location = System::Drawing::Point( 492, 0 ); - flowLayoutPanel1->AutoSize = true; - flowLayoutPanel1->TabIndex = 1; - ClientSize = System::Drawing::Size( 674, 419 ); - Controls->Add( flowLayoutPanel1 ); - Text = this->GetType()->Name; - AutoSize = true; - } - - System::Drawing::Size startingSize; - String^ thirdColumnHeader; - String^ boringMeatloaf; - String^ boringMeatloafRanking; - bool boringRecipe; - bool shortMode; - DataGridView^ dataGridView1; - String^ otherRestaurant; - void InitializeDataGridView( Object^ /*ignored*/, EventArgs^ /*ignoredToo*/ ) - { - dataGridView1 = gcnew System::Windows::Forms::DataGridView; - Controls->Add( dataGridView1 ); - startingSize = System::Drawing::Size( 450, 400 ); - dataGridView1->Size = startingSize; - dataGridView1->AutoSizeRowsModeChanged += gcnew DataGridViewAutoSizeModeEventHandler( this, &AutoSizing::WatchRowsModeChanges ); - AddLabels(); - SetUpColumns(); - PopulateRows(); - shortMode = false; - boringRecipe = true; - } - - void SetUpColumns() - { - dataGridView1->ColumnCount = 4; - dataGridView1->ColumnHeadersVisible = true; - DataGridViewCellStyle ^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( "Verdana",10,FontStyle::Bold ); - dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - dataGridView1->Columns[ 0 ]->Name = "Recipe"; - dataGridView1->Columns[ 1 ]->Name = "Category"; - dataGridView1->Columns[ 2 ]->Name = thirdColumnHeader; - dataGridView1->Columns[ 3 ]->Name = "Rating"; - } - - void PopulateRows() - { - array^row1 = {"Meatloaf","Main Dish",boringMeatloaf,boringMeatloafRanking}; - array^row2 = {"Key Lime Pie","Dessert","lime juice, evaporated milk","****"}; - array^row3 = {"Orange-Salsa Pork Chops","Main Dish","pork chops, salsa, orange juice","****"}; - array^row4 = {"Black Bean and Rice Salad","Salad","black beans, brown rice","****"}; - array^row5 = {"Chocolate Cheesecake","Dessert","cream cheese","***"}; - array^row6 = {"Black Bean Dip","Appetizer","black beans, sour cream","***"}; - array^rows = {row1,row2,row3,row4,row5,row6}; - IEnumerator^ myEnum = rows->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - array^row = safe_cast^>(myEnum->Current); - dataGridView1->Rows->Add( row ); - } - - IEnumerator^ myEnum1 = safe_cast(dataGridView1->Rows)->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - DataGridViewRow ^ row = safe_cast(myEnum1->Current); - if ( row->IsNewRow ) - break; - row->HeaderCell->Value = String::Format( "Restaurant {0}", row->Index ); - } - } - - void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) - { - button->Click += handler; - button->Text = buttonLabel; - button->AutoSize = true; - button->TabIndex = flowLayoutPanel1->Controls->Count; - flowLayoutPanel1->Controls->Add( button ); - } - - void ResetToDisorder( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Controls->Remove( dataGridView1 ); - dataGridView1->DataGridView::~DataGridView(); - InitializeDataGridView( nullptr, nullptr ); - } - - void ChangeColumn3Header( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Toggle( &shortMode ); - if ( shortMode ) - dataGridView1->Columns[ 2 ]->HeaderText = "S"; - else - dataGridView1->Columns[ 2 ]->HeaderText = thirdColumnHeader; - } - - Boolean Toggle( interior_ptr toggleThis ) - { - *toggleThis = ! *toggleThis; - return *toggleThis; - } - - void ChangeMeatloafRecipe( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Toggle( &boringRecipe ); - if ( boringRecipe ) - SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); - else - { - String^ greatMeatloafRecipe = "1 lb. lean ground beef, " - "1/2 cup bread crumbs, 1/4 cup ketchup," - "1/3 tsp onion powder, " - "1 clove of garlic, 1/2 pack onion soup mix," - " dash of your favorite BBQ Sauce"; - SetMeatloaf( greatMeatloafRecipe, "***" ); - } - } - - void ChangeRestaurant( Object^ /*sender*/, EventArgs^ /*ignored*/ ) - { - if ( dataGridView1->Rows[ 2 ]->HeaderCell->Value->ToString()->Equals( otherRestaurant ) ) - dataGridView1->Rows[ 2 ]->HeaderCell->Value = "Restaurant 2"; - else - dataGridView1->Rows[ 2 ]->HeaderCell->Value = otherRestaurant; - } - - void SetMeatloaf( String^ recipe, String^ rating ) - { - dataGridView1->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; - dataGridView1->Rows[ 0 ]->Cells[ 3 ]->Value = rating; - } - - String^ currentLayoutName; - void AddLabels() - { - Label^ current = dynamic_cast(flowLayoutPanel1->Controls[ currentLayoutName ]); - if ( current == nullptr ) - { - current = gcnew Label; - current->AutoSize = true; - current->Name = currentLayoutName; - current->Text = String::Concat( currentLayoutName, dataGridView1->AutoSizeRowsMode ); - flowLayoutPanel1->Controls->Add( current ); - } - } - - void AddButtonsForAutomaticResizing() - { - AddButton( button5, "Keep Column Headers Sized", gcnew EventHandler( this, &AutoSizing::ColumnHeadersHeightSizeMode ) ); - AddButton( button6, "Keep Row Headers Sized", gcnew EventHandler( this, &AutoSizing::RowHeadersWidthSizeMode ) ); - AddButton( button7, "Keep Rows Sized", gcnew EventHandler( this, &AutoSizing::AutoSizeRowsMode ) ); - AddButton( button8, "Keep Row Headers Sized with RowsMode", gcnew EventHandler( this, &AutoSizing::AutoSizeRowHeadersUsingAllHeadersMode ) ); - AddButton( button9, "Disable AutoSizeRowsMode", gcnew EventHandler( this, &AutoSizing::DisableAutoSizeRowsMode ) ); - AddButton( button10, "AutoSize third column by rows", gcnew EventHandler( this, &AutoSizing::AutoSizeOneColumn ) ); - AddButton( button11, "AutoSize third column by rows and headers", gcnew EventHandler( this, &AutoSizing::AutoSizeOneColumnIncludingHeaders ) ); - } - - - // - void ColumnHeadersHeightSizeMode( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; - } - // - // - void RowHeadersWidthSizeMode( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders; - } - - // - // - void AutoSizeRowsMode( Object^ /*sender*/, EventArgs^ /*es*/ ) - { - dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::AllCells; - } - // - void AutoSizeRowHeadersUsingAllHeadersMode( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::AllHeaders; - } - - - // - void WatchRowsModeChanges( Object^ /*sender*/, DataGridViewAutoSizeModeEventArgs^ modeEvent ) - { - Label^ label = dynamic_cast(flowLayoutPanel1->Controls[ currentLayoutName ]); - if ( modeEvent->PreviousModeAutoSized ) - { - label->Text = String::Format( "changed to a different {0}{1}", label->Name, dataGridView1->AutoSizeRowsMode ); - } - else - { - label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode ); - } - } - - - // - void DisableAutoSizeRowsMode( Object^ /*sender*/, EventArgs^ /*modeEvent*/ ) - { - dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::None; - } - - - // - void AutoSizeOneColumn( Object^ /*sender*/, EventArgs^ /*theEvent*/ ) - { - DataGridViewColumn^ column = dataGridView1->Columns[ 2 ]; - column->AutoSizeMode = DataGridViewAutoSizeColumnMode::DisplayedCellsExceptHeader; - } - - - // - void AutoSizeOneColumnIncludingHeaders( Object^ /*sender*/, EventArgs^ /*theEvent*/ ) - { - DataGridViewColumn^ column = dataGridView1->Columns[ 2 ]; - column->AutoSizeMode = DataGridViewAutoSizeColumnMode::AllCells; - } - -}; - - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew AutoSizing ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp deleted file mode 100644 index 346456ec480..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp +++ /dev/null @@ -1,328 +0,0 @@ - -// -#using -#using -#using -#using - -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System; -using namespace System::Collections; -public ref class DataGridViewBandDemo: public Form -{ -private: - -#pragma region S " form setup " - -public: - DataGridViewBandDemo() - { - Button1 = gcnew Button; - Button2 = gcnew Button; - Button3 = gcnew Button; - Button4 = gcnew Button; - Button5 = gcnew Button; - Button6 = gcnew Button; - Button7 = gcnew Button; - Button8 = gcnew Button; - Button9 = gcnew Button; - Button10 = gcnew Button; - FlowLayoutPanel1 = gcnew FlowLayoutPanel; - InitializeComponent(); - thirdColumnHeader = L"Main Ingredients"; - boringMeatloaf = L"ground beef"; - boringMeatloafRanking = L"*"; - AddButton( Button1, L"Reset", gcnew EventHandler( this, &DataGridViewBandDemo::Button1_Click ) ); - AddButton( Button2, L"Change Column 3 Header", gcnew EventHandler( this, &DataGridViewBandDemo::Button2_Click ) ); - AddButton( Button3, L"Change Meatloaf Recipe", gcnew EventHandler( this, &DataGridViewBandDemo::Button3_Click ) ); - AddAdditionalButtons(); - InitializeDataGridView(); - } - - DataGridView^ dataGridView; - Button^ Button1; - Button^ Button2; - Button^ Button3; - Button^ Button4; - Button^ Button5; - Button^ Button6; - Button^ Button7; - Button^ Button8; - Button^ Button9; - Button^ Button10; - FlowLayoutPanel^ FlowLayoutPanel1; - -private: - void InitializeComponent() - { - FlowLayoutPanel1->Location = Point(454,0); - FlowLayoutPanel1->AutoSize = true; - FlowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - AutoSize = true; - ClientSize = System::Drawing::Size( 614, 360 ); - FlowLayoutPanel1->Name = L"flowlayoutpanel"; - Controls->Add( this->FlowLayoutPanel1 ); - Text = this->GetType()->Name; - } - - -#pragma endregion -#pragma region S " setup DataGridView " - String^ thirdColumnHeader; - String^ boringMeatloaf; - String^ boringMeatloafRanking; - bool boringRecipe; - Boolean shortMode; - void InitializeDataGridView() - { - dataGridView = gcnew System::Windows::Forms::DataGridView; - Controls->Add( dataGridView ); - dataGridView->Size = System::Drawing::Size( 300, 200 ); - - // Create an unbound DataGridView by declaring a - // column count. - dataGridView->ColumnCount = 4; - AdjustDataGridViewSizing(); - - // Set the column header style. - DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); - dataGridView->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - - // Set the column header names. - dataGridView->Columns[ 0 ]->Name = L"Recipe"; - dataGridView->Columns[ 1 ]->Name = L"Category"; - dataGridView->Columns[ 2 ]->Name = thirdColumnHeader; - dataGridView->Columns[ 3 ]->Name = L"Rating"; - - // Populate the rows. - array^row1 = gcnew array{ - L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking - }; - array^row2 = gcnew array{ - L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****" - }; - array^row3 = gcnew array{ - L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****" - }; - array^row4 = gcnew array{ - L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****" - }; - array^row5 = gcnew array{ - L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***" - }; - array^row6 = gcnew array{ - L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***" - }; - array^rows = gcnew array{ - row1,row2,row3,row4,row5,row6 - }; - System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - array^rowArray = safe_cast^>(myEnum->Current); - dataGridView->Rows->Add( rowArray ); - } - - PostRowCreation(); - shortMode = false; - boringRecipe = true; - } - - void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) - { - FlowLayoutPanel1->Controls->Add( button ); - button->TabIndex = FlowLayoutPanel1->Controls->Count; - button->Text = buttonLabel; - button->AutoSize = true; - button->Click += handler; - } - - - // Reset columns to initial disorderly arrangement. - void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Controls->Remove( dataGridView ); - dataGridView->~DataGridView(); - InitializeDataGridView(); - } - - - // Change the header in column three. - void Button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Toggle( &shortMode ); - if ( shortMode ) - { - dataGridView->Columns[ 2 ]->HeaderText = L"S"; - } - else - { - dataGridView->Columns[ 2 ]->HeaderText = thirdColumnHeader; - } - } - - void Toggle( interior_ptr toggleThis ) - { - *toggleThis = ! *toggleThis; - } - - - // Change the meatloaf recipe. - void Button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Toggle( &boringRecipe ); - if ( boringRecipe ) - { - SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); - } - else - { - String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " - L"1/2 cup bread crumbs, 1/4 cup ketchup," - L"1/3 tsp onion powder, " - L"1 clove of garlic, 1/2 pack onion soup mix " - L" dash of your favorite BBQ Sauce"; - SetMeatloaf( greatMeatloafRecipe, L"***" ); - } - } - - void SetMeatloaf( String^ recipe, String^ rating ) - { - dataGridView->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; - dataGridView->Rows[ 0 ]->Cells[ 3 ]->Value = rating; - } - - -#pragma endregion -#pragma region S " demonstration code " - void AddAdditionalButtons() - { - AddButton( Button4, L"Freeze First Row", gcnew EventHandler( this, &DataGridViewBandDemo::Button4_Click ) ); - AddButton( Button5, L"Freeze Second Column", gcnew EventHandler( this, &DataGridViewBandDemo::Button5_Click ) ); - AddButton( Button6, L"Hide Salad Row", gcnew EventHandler( this, &DataGridViewBandDemo::Button6_Click ) ); - AddButton( Button7, L"Disable First Column Resizing", gcnew EventHandler( this, &DataGridViewBandDemo::Button7_Click ) ); - AddButton( Button8, L"Make ReadOnly", gcnew EventHandler( this, &DataGridViewBandDemo::Button8_Click ) ); - AddButton( Button9, L"Style Using Tag", gcnew EventHandler( this, &DataGridViewBandDemo::Button9_Click ) ); - } - - void AdjustDataGridViewSizing() - { - dataGridView->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::AllCells; - dataGridView->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; - } - - - // - // Freeze the first row. - void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - FreezeBand( dataGridView->Rows[ 0 ] ); - } - - void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - FreezeBand( dataGridView->Columns[ 1 ] ); - } - - void FreezeBand( DataGridViewBand^ band ) - { - band->Frozen = true; - DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle; - style->BackColor = Color::WhiteSmoke; - band->DefaultCellStyle = style; - } - - - // - // - // Hide a band of cells. - void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DataGridViewBand^ band = dataGridView->Rows[ 3 ]; - band->Visible = false; - } - - - // - // - // Turn off user's ability to resize a column. - void Button7_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - DataGridViewBand^ band = dataGridView->Columns[ 0 ]; - band->Resizable = DataGridViewTriState::False; - } - - - // - // - // Make the entire DataGridView read only. - void Button8_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - System::Collections::IEnumerator^ myEnum = dataGridView->Columns->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridViewBand^ band = safe_cast(myEnum->Current); - band->ReadOnly = true; - } - } - - - // - // - void PostRowCreation() - { - SetBandColor( dataGridView->Columns[ 0 ], Color::CadetBlue ); - SetBandColor( dataGridView->Rows[ 1 ], Color::Coral ); - SetBandColor( dataGridView->Columns[ 2 ], Color::DodgerBlue ); - } - - void SetBandColor( DataGridViewBand^ band, Color color ) - { - band->Tag = color; - } - - - // Color the bands by the value stored in their tag. - void Button9_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - IEnumerator^ myEnum1 = dataGridView->Columns->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - DataGridViewBand^ band = static_cast(myEnum1->Current); - if ( band->Tag != nullptr ) - { - band->DefaultCellStyle->BackColor = *dynamic_cast(band->Tag); - } - } - - IEnumerator^ myEnum2 = safe_cast(dataGridView->Rows)->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - DataGridViewBand^ band = safe_cast(myEnum2->Current); - if ( band->Tag != nullptr ) - { - band->DefaultCellStyle->BackColor = *dynamic_cast(band->Tag); - } - } - } - - - // -#pragma endregion - -public: - static void Main() - { - Application::Run( gcnew DataGridViewBandDemo ); - } -}; - -int main() -{ - DataGridViewBandDemo::Main(); -} - -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp deleted file mode 100644 index 7266b7188d9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp +++ /dev/null @@ -1,441 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::Collections; -public ref class DataGridViewColumnDemo: public Form -{ -private: - -#pragma region S "set up form" - -public: - DataGridViewColumnDemo() - { - Button1 = gcnew Button; - Button2 = gcnew Button; - Button3 = gcnew Button; - Button4 = gcnew Button; - Button5 = gcnew Button; - Button6 = gcnew Button; - Button7 = gcnew Button; - Button8 = gcnew Button; - Button9 = gcnew Button; - Button10 = gcnew Button; - FlowLayoutPanel1 = gcnew FlowLayoutPanel; - thirdColumnHeader = L"Main Ingredients"; - boringMeatloaf = L"ground beef"; - boringMeatloafRanking = L"*"; - toolStripItem1 = gcnew ToolStripMenuItem; - InitializeComponent(); - AddButton( Button1, L"Reset", gcnew EventHandler( this, &DataGridViewColumnDemo::ResetToDisorder ) ); - AddButton( Button2, L"Change Column 3 Header", gcnew EventHandler( this, &DataGridViewColumnDemo::ChangeColumn3Header ) ); - AddButton( Button3, L"Change Meatloaf Recipe", gcnew EventHandler( this, &DataGridViewColumnDemo::ChangeMeatloafRecipe ) ); - AddAdditionalButtons(); - InitializeDataGridView(); - } - - DataGridView^ dataGridView; - Button^ Button1; - Button^ Button2; - Button^ Button3; - Button^ Button4; - Button^ Button5; - Button^ Button6; - Button^ Button7; - Button^ Button8; - Button^ Button9; - Button^ Button10; - FlowLayoutPanel^ FlowLayoutPanel1; - -private: - void InitializeComponent() - { - FlowLayoutPanel1->Location = Point(454,0); - FlowLayoutPanel1->AutoSize = true; - FlowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - AutoSize = true; - ClientSize = System::Drawing::Size( 614, 360 ); - FlowLayoutPanel1->Name = L"flowlayoutpanel"; - Controls->Add( this->FlowLayoutPanel1 ); - Text = this->GetType()->Name; - } - - -#pragma endregion -#pragma region S " set up DataGridView " - String^ thirdColumnHeader; - String^ boringMeatloaf; - String^ boringMeatloafRanking; - bool boringRecipe; - bool shortMode; - void InitializeDataGridView() - { - dataGridView = gcnew System::Windows::Forms::DataGridView; - Controls->Add( dataGridView ); - dataGridView->Size = System::Drawing::Size( 300, 200 ); - - // Create an unbound DataGridView by declaring a - // column count. - dataGridView->ColumnCount = 4; - AdjustDataGridViewSizing(); - - // Set the column header style. - DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); - dataGridView->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - - // Set the column header names. - dataGridView->Columns[ 0 ]->Name = L"Recipe"; - dataGridView->Columns[ 1 ]->Name = L"Category"; - dataGridView->Columns[ 2 ]->Name = thirdColumnHeader; - dataGridView->Columns[ 3 ]->Name = L"Rating"; - criteriaLabel = L"Column 3 sizing criteria: "; - PostColumnCreation(); - - // Populate the rows. - array^row1 = gcnew array{ - L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking - }; - array^row2 = gcnew array{ - L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****" - }; - array^row3 = gcnew array{ - L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****" - }; - array^row4 = gcnew array{ - L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****" - }; - array^row5 = gcnew array{ - L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***" - }; - array^row6 = gcnew array{ - L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***" - }; - array^rows = gcnew array{ - row1,row2,row3,row4,row5,row6 - }; - System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - array^rowArray = safe_cast^>(myEnum->Current); - dataGridView->Rows->Add( rowArray ); - } - - shortMode = false; - boringRecipe = true; - } - - void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) - { - FlowLayoutPanel1->Controls->Add( button ); - button->TabIndex = FlowLayoutPanel1->Controls->Count; - button->Text = buttonLabel; - button->AutoSize = true; - button->Click += handler; - } - - void ResetToDisorder( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Controls->Remove( dataGridView ); - dataGridView->~DataGridView(); - InitializeDataGridView(); - } - - void ChangeColumn3Header( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Toggle( &shortMode ); - if ( shortMode ) - { - dataGridView->Columns[ 2 ]->HeaderText = L"S"; - } - else - { - dataGridView->Columns[ 2 ]->HeaderText = thirdColumnHeader; - } - } - - void Toggle( interior_ptr toggleThis ) - { - *toggleThis = ! *toggleThis; - } - - void ChangeMeatloafRecipe( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Toggle( &boringRecipe ); - if ( boringRecipe ) - { - SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); - } - else - { - String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " - L"1/2 cup bread crumbs, 1/4 cup ketchup," - L"1/3 tsp onion powder, " - L"1 clove of garlic, 1/2 pack onion soup mix " - L" dash of your favorite BBQ Sauce"; - SetMeatloaf( greatMeatloafRecipe, L"***" ); - } - } - - void SetMeatloaf( String^ recipe, String^ rating ) - { - dataGridView->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; - dataGridView->Rows[ 0 ]->Cells[ 3 ]->Value = rating; - } - - -#pragma endregion - -public: - static void Main() - { - Application::Run( gcnew DataGridViewColumnDemo ); - } - - -#pragma region S " demonstration code " - -private: - void PostColumnCreation() - { - AddContextLabel(); - AddCriteriaLabel(); - CustomizeCellsInThirdColumn(); - AddContextMenu(); - SetDefaultCellInFirstColumn(); - ToolTips(); - dataGridView->CellMouseEnter += gcnew DataGridViewCellEventHandler( this, &DataGridViewColumnDemo::dataGridView_CellMouseEnter ); - dataGridView->AutoSizeColumnModeChanged += gcnew DataGridViewAutoSizeColumnModeEventHandler( this, &DataGridViewColumnDemo::dataGridView_AutoSizeColumnModeChanged ); - } - - String^ criteriaLabel; - void AddCriteriaLabel() - { - AddLabelToPanelIfNotAlreadyThere( criteriaLabel, String::Concat( criteriaLabel, dataGridView->Columns[ 2 ]->AutoSizeMode, L"." ) ); - } - - void AddContextLabel() - { - String^ labelName = L"label"; - AddLabelToPanelIfNotAlreadyThere( labelName, L"Use shortcut menu to change cell color." ); - } - - void AddLabelToPanelIfNotAlreadyThere( String^ labelName, String^ labelText ) - { - Label^ label; - if ( FlowLayoutPanel1->Controls[ labelName ] == nullptr ) - { - label = gcnew Label; - label->AutoSize = true; - label->Name = labelName; - label->BackColor = Color::Bisque; - FlowLayoutPanel1->Controls->Add( label ); - } - else - { - label = dynamic_cast(FlowLayoutPanel1->Controls[ labelName ]); - } - - label->Text = labelText; - } - - - // - void CustomizeCellsInThirdColumn() - { - int thirdColumn = 2; - DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ]; - DataGridViewCell^ cell = gcnew DataGridViewTextBoxCell; - cell->Style->BackColor = Color::Wheat; - column->CellTemplate = cell; - } - - - // - // - ToolStripMenuItem^ toolStripItem1; - void AddContextMenu() - { - toolStripItem1->Text = L"Redden"; - toolStripItem1->Click += gcnew EventHandler( this, &DataGridViewColumnDemo::toolStripItem1_Click ); - System::Windows::Forms::ContextMenuStrip^ strip = gcnew System::Windows::Forms::ContextMenuStrip; - IEnumerator^ myEnum = dataGridView->Columns->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridViewColumn^ column = safe_cast(myEnum->Current); - column->ContextMenuStrip = strip; - column->ContextMenuStrip->Items->Add( toolStripItem1 ); - } - } - - DataGridViewCellEventArgs^ mouseLocation; - - // Change the cell's color. - void toolStripItem1_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - dataGridView->Rows[ mouseLocation->RowIndex ]->Cells[ mouseLocation->ColumnIndex ]->Style->BackColor = Color::Red; - } - - - // Deal with hovering over a cell. - void dataGridView_CellMouseEnter( Object^ /*sender*/, DataGridViewCellEventArgs^ location ) - { - mouseLocation = location; - } - - - // - // - void SetDefaultCellInFirstColumn() - { - DataGridViewColumn^ firstColumn = dataGridView->Columns[ 0 ]; - DataGridViewCellStyle^ cellStyle = gcnew DataGridViewCellStyle; - cellStyle->BackColor = Color::Thistle; - firstColumn->DefaultCellStyle = cellStyle; - } - - - // - // - void ToolTips() - { - DataGridViewColumn^ firstColumn = dataGridView->Columns[ 0 ]; - DataGridViewColumn^ thirdColumn = dataGridView->Columns[ 2 ]; - firstColumn->ToolTipText = L"This column uses a default cell."; - thirdColumn->ToolTipText = L"This column uses a template cell." - L" Style changes to one cell apply to all cells."; - } - - - // - void AddAdditionalButtons() - { - AddButton( Button4, L"Set Minimum Width of Column Two", gcnew EventHandler( this, &DataGridViewColumnDemo::Button4_Click ) ); - AddButton( Button5, L"Set Width of Column One", gcnew EventHandler( this, &DataGridViewColumnDemo::Button5_Click ) ); - AddButton( Button6, L"Autosize Third Column", gcnew EventHandler( this, &DataGridViewColumnDemo::Button6_Click ) ); - AddButton( Button7, L"Add Thick Vertical Edge", gcnew EventHandler( this, &DataGridViewColumnDemo::Button7_Click ) ); - AddButton( Button8, L"Style and Number Columns", gcnew EventHandler( this, &DataGridViewColumnDemo::Button8_Click ) ); - AddButton( Button9, L"Change Column Header Text", gcnew EventHandler( this, &DataGridViewColumnDemo::Button9_Click ) ); - AddButton( Button10, L"Swap First and Last Columns", gcnew EventHandler( this, &DataGridViewColumnDemo::Button10_Click ) ); - } - - void AdjustDataGridViewSizing() - { - dataGridView->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; - } - - - // - //Set the minimum width. - void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DataGridViewColumn^ column = dataGridView->Columns[ 1 ]; - column->MinimumWidth = 40; - } - - - // - // - // Set the width. - void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DataGridViewColumn^ column = dataGridView->Columns[ 0 ]; - column->Width = 60; - } - - - // - // - // AutoSize the third column. - void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DataGridViewColumn^ column = dataGridView->Columns[ 2 ]; - column->AutoSizeMode = DataGridViewAutoSizeColumnMode::DisplayedCells; - } - - - // - // - // Set the vertical edge. - void Button7_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - int thirdColumn = 2; - - // int edgeThickness = 5; - DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ]; - column->DividerWidth = 10; - } - - - // - // - // Style and number columns. - void Button8_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle; - style->Alignment = DataGridViewContentAlignment::MiddleCenter; - style->ForeColor = Color::IndianRed; - style->BackColor = Color::Ivory; - IEnumerator^ myEnum1 = dataGridView->Columns->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - DataGridViewColumn^ column = safe_cast(myEnum1->Current); - column->HeaderCell->Value = column->Index.ToString(); - column->HeaderCell->Style = style; - } - } - - - // - // - // Change the text in the column header. - void Button9_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - IEnumerator^ myEnum2 = dataGridView->Columns->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - DataGridViewColumn^ column = safe_cast(myEnum2->Current); - column->HeaderText = String::Concat( L"Column ", column->Index.ToString() ); - } - } - - - // - // - // Swap the last column with the first. - void Button10_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) - { - DataGridViewColumnCollection^ columnCollection = dataGridView->Columns; - DataGridViewColumn^ firstDisplayedColumn = columnCollection->GetFirstColumn( DataGridViewElementStates::Visible ); - DataGridViewColumn^ lastDisplayedColumn = columnCollection->GetLastColumn( DataGridViewElementStates::Visible, DataGridViewElementStates::None ); - int firstColumn_sIndex = firstDisplayedColumn->DisplayIndex; - firstDisplayedColumn->DisplayIndex = lastDisplayedColumn->DisplayIndex; - lastDisplayedColumn->DisplayIndex = firstColumn_sIndex; - } - - - // - // - // Updated the criteria label. - void dataGridView_AutoSizeColumnModeChanged( Object^ /*sender*/, DataGridViewAutoSizeColumnModeEventArgs^ args ) - { - args->Column->DataGridView->Parent->Controls[ L"flowlayoutpanel" ]->Controls[ criteriaLabel ]->Text = String::Concat( criteriaLabel, args->Column->AutoSizeMode ); - } - // -#pragma endregion - -}; - -int main() -{ - DataGridViewColumnDemo::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp deleted file mode 100644 index fda4f9201a9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp +++ /dev/null @@ -1,304 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class DataGridViewRowDemo: public Form -{ -private: - -#pragma region S " form setup " - -public: - DataGridViewRowDemo() - { - Button1 = gcnew Button; - Button2 = gcnew Button; - Button3 = gcnew Button; - Button4 = gcnew Button; - Button5 = gcnew Button; - Button6 = gcnew Button; - Button7 = gcnew Button; - Button8 = gcnew Button; - Button9 = gcnew Button; - Button10 = gcnew Button; - FlowLayoutPanel1 = gcnew FlowLayoutPanel; - thirdColumnHeader = L"Main Ingredients"; - boringMeatloaf = L"ground beef"; - boringMeatloafRanking = L"*"; - ratingColumn = 3; - AddButton( Button1, L"Reset", gcnew EventHandler( this, &DataGridViewRowDemo::Button1_Click ) ); - AddButton( Button2, L"Change Column 3 Header", gcnew EventHandler( this, &DataGridViewRowDemo::Button2_Click ) ); - AddButton( Button3, L"Change Meatloaf Recipe", gcnew EventHandler( this, &DataGridViewRowDemo::Button3_Click ) ); - InitializeComponent(); - InitializeDataGridView(); - AddAdditionalButtons(); - } - - -private: - DataGridView^ dataGridView; - Button^ Button1; - Button^ Button2; - Button^ Button3; - Button^ Button4; - Button^ Button5; - Button^ Button6; - Button^ Button7; - Button^ Button8; - Button^ Button9; - Button^ Button10; - FlowLayoutPanel^ FlowLayoutPanel1; - void InitializeComponent() - { - FlowLayoutPanel1->Location = Point(454,0); - FlowLayoutPanel1->AutoSize = true; - FlowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - AutoSize = true; - ClientSize = System::Drawing::Size( 614, 360 ); - FlowLayoutPanel1->Name = L"flowlayoutpanel"; - Controls->Add( this->FlowLayoutPanel1 ); - Text = this->GetType()->Name; - } - - -#pragma endregion -#pragma region S " setup DataGridView " - String^ thirdColumnHeader; - String^ boringMeatloaf; - String^ boringMeatloafRanking; - bool boringRecipe; - bool shortMode; - void InitializeDataGridView() - { - dataGridView = gcnew System::Windows::Forms::DataGridView; - Controls->Add( dataGridView ); - dataGridView->Size = System::Drawing::Size( 300, 200 ); - - // Create an unbound DataGridView by declaring a - // column count. - dataGridView->ColumnCount = 4; - dataGridView->ColumnHeadersVisible = true; - AdjustDataGridViewSizing(); - - // Set the column header style. - DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); - dataGridView->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - - // Set the column header names. - dataGridView->Columns[ 0 ]->Name = L"Recipe"; - dataGridView->Columns[ 1 ]->Name = L"Category"; - dataGridView->Columns[ 2 ]->Name = thirdColumnHeader; - dataGridView->Columns[ 3 ]->Name = L"Rating"; - - // Populate the rows. - array^row1 = gcnew array{ - L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking - }; - array^row2 = gcnew array{ - L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****" - }; - array^row3 = gcnew array{ - L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****" - }; - array^row4 = gcnew array{ - L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****" - }; - array^row5 = gcnew array{ - L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***" - }; - array^row6 = gcnew array{ - L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***" - }; - array^rows = gcnew array{ - row1,row2,row3,row4,row5,row6 - }; - System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - array^rowArray = safe_cast^>(myEnum->Current); - dataGridView->Rows->Add( rowArray ); - } - - shortMode = false; - boringRecipe = true; - } - - void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) - { - FlowLayoutPanel1->Controls->Add( button ); - button->TabIndex = FlowLayoutPanel1->Controls->Count; - button->Text = buttonLabel; - button->AutoSize = true; - button->Click += handler; - } - - - // Reset columns to initial disorderly arrangement. - void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Controls->Remove( dataGridView ); - dataGridView->~DataGridView(); - InitializeDataGridView(); - } - - - // Change column 3 header. - void Button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Toggle( &shortMode ); - if ( shortMode ) - { - dataGridView->Columns[ 2 ]->HeaderText = L"S"; - } - else - { - dataGridView->Columns[ 2 ]->HeaderText = thirdColumnHeader; - } - } - - void Toggle( interior_ptr toggleThis ) - { - *toggleThis = ! *toggleThis; - } - - - // Change meatloaf recipe. - void Button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Toggle( &boringRecipe ); - if ( boringRecipe ) - { - SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); - } - else - { - String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " - L"1/2 cup bread crumbs, 1/4 cup ketchup," - L"1/3 tsp onion powder, " - L"1 clove of garlic, 1/2 pack onion soup mix " - L" dash of your favorite BBQ Sauce"; - SetMeatloaf( greatMeatloafRecipe, L"***" ); - } - } - - void SetMeatloaf( String^ recipe, String^ rating ) - { - dataGridView->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; - dataGridView->Rows[ 0 ]->Cells[ 3 ]->Value = rating; - } - - -#pragma endregion -#pragma region S " demonstration code " - void AddAdditionalButtons() - { - AddButton( Button4, L"Set Row Two Minimum Height", gcnew EventHandler( this, &DataGridViewRowDemo::Button4_Click ) ); - AddButton( Button5, L"Set Row One Height", gcnew EventHandler( this, &DataGridViewRowDemo::Button5_Click ) ); - AddButton( Button6, L"Label Rows", gcnew EventHandler( this, &DataGridViewRowDemo::Button6_Click ) ); - AddButton( Button7, L"Turn on Extra Edge", gcnew EventHandler( this, &DataGridViewRowDemo::Button7_Click ) ); - AddButton( Button8, L"Give Cheesecake an Excellent Rating", gcnew EventHandler( this, &DataGridViewRowDemo::Button8_Click ) ); - } - - void AdjustDataGridViewSizing() - { - dataGridView->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; - dataGridView->Columns[ ratingColumn ]->Width = 50; - } - - - // - // Set minimum height. - void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - int secondRow = 1; - DataGridViewRow^ row = dataGridView->Rows[ secondRow ]; - row->MinimumHeight = 40; - } - - - // - // - // Set height. - void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DataGridViewRow^ row = dataGridView->Rows[ 0 ]; - row->Height = 15; - } - - - // - // - // Set row labels. - void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - int rowNumber = 1; - System::Collections::IEnumerator^ myEnum = safe_cast(dataGridView->Rows)->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridViewRow^ row = safe_cast(myEnum->Current); - if ( row->IsNewRow ) - continue; - row->HeaderCell->Value = String::Format( L"Row {0}", rowNumber ); - - rowNumber = rowNumber + 1; - } - - dataGridView->AutoResizeRowHeadersWidth( DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders ); - } - - - // - // - // Set a thick horizontal edge. - void Button7_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - int secondRow = 1; - int edgeThickness = 3; - DataGridViewRow^ row = dataGridView->Rows[ secondRow ]; - row->DividerHeight = 10; - } - - - // - // - // Give cheescake excellent rating. - void Button8_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - UpdateStars( dataGridView->Rows[ 4 ], L"******************" ); - } - - int ratingColumn; - void UpdateStars( DataGridViewRow^ row, String^ stars ) - { - row->Cells[ ratingColumn ]->Value = stars; - - // Resize the column width to account for the new value. - row->DataGridView->AutoResizeColumn( ratingColumn, DataGridViewAutoSizeColumnMode::DisplayedCells ); - } - - - // -#pragma endregion - -public: - static void Main() - { - Application::Run( gcnew DataGridViewRowDemo ); - } - -}; - -int main() -{ - DataGridViewRowDemo::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp deleted file mode 100644 index b7f42ec7105..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp +++ /dev/null @@ -1,480 +0,0 @@ - -// This example demonstrates using images to create a -// TicTacToe game. -// -#using -#using -#using - -using namespace System::IO; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class TicTacToe: public System::Windows::Forms::Form -{ -public: - TicTacToe() - : Form() - { - oBytes = gcnew array{ - 0x42, 0x4D, 0xC6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x76, - 0x0, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0xB, 0x0, 0x0, 0x0, 0xA, - 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, - 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x80, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x80, 0x80, 0x0, - 0x80, 0x0, 0x0, 0x0, 0x80, 0x0, 0x80, 0x0, 0x80, 0x80, 0x0, - 0x0, 0xC0, 0xC0, 0xC0, 0x0, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0, - 0xFF, 0x0, 0x0, 0xFF, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0x0, 0xFF, - 0x0, 0x0, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0x0, - 0xFF, 0xFF, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0xF, 0xFF, 0xF0, - 0x0, 0x0, 0xFF, 0x0, 0xFF, 0xF0, 0xF, 0xF0, 0x0, 0x0, 0xF0, - 0xFF, 0xFF, 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xF0, 0xFF, 0xFF, - 0xFF, 0xF0, 0xF0, 0x0, 0x0, 0xF, 0xFF, 0xFF, 0xFF, 0xFF, - 0x0, 0x0, 0x0, 0xF, 0xFF, 0xFF, 0xFF, 0xFF, 0x0, 0x0, 0x0, - 0xF0, 0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F, - 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, - 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xF0, 0x0, 0x0}; - blank = gcnew Bitmap( gcnew MemoryStream( blankBytes ) ); - x = gcnew Bitmap( gcnew MemoryStream( xBytes ) ); - o = gcnew Bitmap( gcnew MemoryStream( oBytes ) ); - this->AutoSize = true; - turn = gcnew Label; - Button1 = gcnew Button; - Button2 = gcnew Button; - Button3 = gcnew Button; - Button4 = gcnew Button; - Button5 = gcnew Button; - Panel1 = gcnew FlowLayoutPanel; - SetupButtons(); - InitializeDataGridView( nullptr, nullptr ); - - xString = L"X's turn"; - oString = L"O's turn"; - gameOverString = L"Game Over"; - bitmapPadding = 6; - } - - -private: - DataGridView^ dataGridView1; - Button^ Button1; - Label^ turn; - Button^ Button2; - Button^ Button3; - Button^ Button4; - Button^ Button5; - FlowLayoutPanel^ Panel1; - -#pragma region S " bitmaps " - array^oBytes; - array^xBytes; - array^blankBytes; - -#pragma endregion - Bitmap^ blank; - Bitmap^ x; - Bitmap^ o; - String^ xString; - String^ oString; - String^ gameOverString; - int bitmapPadding; - void InitializeDataGridView( Object^ ignored, EventArgs^ e ) - { - this->Panel1->SuspendLayout(); - this->SuspendLayout(); - ConfigureForm(); - SizeGrid(); - CreateColumns(); - CreateRows(); - this->Panel1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void ConfigureForm() - { - AutoSize = true; - turn->Size = System::Drawing::Size( 75, 34 ); - turn->TextAlign = ContentAlignment::MiddleLeft; - Panel1->Location = System::Drawing::Point( 0, 8 ); - Panel1->Size = System::Drawing::Size( 120, 196 ); - Panel1->FlowDirection = FlowDirection::TopDown; - ClientSize = System::Drawing::Size( 355, 200 ); - Controls->Add( this->Panel1 ); - Text = L"TicTacToe"; - dataGridView1 = gcnew System::Windows::Forms::DataGridView; - dataGridView1->Location = Point(120,0); - dataGridView1->AllowUserToAddRows = false; - dataGridView1->CellClick += gcnew DataGridViewCellEventHandler( this, &TicTacToe::dataGridView1_CellClick ); - dataGridView1->CellMouseEnter += gcnew DataGridViewCellEventHandler( this, &TicTacToe::dataGridView1_CellMouseEnter ); - dataGridView1->CellMouseLeave += gcnew DataGridViewCellEventHandler( this, &TicTacToe::dataGridView1_CellMouseLeave ); - Controls->Add( dataGridView1 ); - turn->Text = xString; - turn->AutoSize = true; - } - - void SetupButtons() - { - Button1->AutoSize = true; - SetupButton( Button1, L"Restart", gcnew EventHandler( this, &TicTacToe::Reset ) ); - Panel1->Controls->Add( turn ); - SetupButton( Button2, L"Increase Cell Size", gcnew EventHandler( this, &TicTacToe::MakeCellsLarger ) ); - SetupButton( Button3, L"Stretch Images", gcnew EventHandler( this, &TicTacToe::Stretch ) ); - SetupButton( Button4, L"Zoom Images", gcnew EventHandler( this, &TicTacToe::ZoomToImage ) ); - SetupButton( Button5, L"Normal Images", gcnew EventHandler( this, &TicTacToe::NormalImage ) ); - } - - void SetupButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) - { - Panel1->Controls->Add( button ); - button->Text = buttonLabel; - button->AutoSize = true; - button->Click += handler; - } - - - // - void CreateColumns() - { - DataGridViewImageColumn^ imageColumn; - int columnCount = 0; - do - { - Bitmap^ unMarked = blank; - imageColumn = gcnew DataGridViewImageColumn; - - //Add twice the padding for the left and - //right sides of the cell. - imageColumn->Width = x->Width + 2 * bitmapPadding + 1; - imageColumn->Image = unMarked; - dataGridView1->Columns->Add( imageColumn ); - columnCount = columnCount + 1; - } - while ( columnCount < 3 ); - } - - - // - void CreateRows() - { - dataGridView1->Rows->Add(); - dataGridView1->Rows->Add(); - dataGridView1->Rows->Add(); - } - - - // - void SizeGrid() - { - dataGridView1->ColumnHeadersVisible = false; - dataGridView1->RowHeadersVisible = false; - dataGridView1->AllowUserToResizeColumns = false; - dataGridView1->AllowUserToResizeRows = false; - dataGridView1->BorderStyle = BorderStyle::None; - - //Add twice the padding for the top of the cell - //and the bottom. - dataGridView1->RowTemplate->Height = x->Height + 2 * bitmapPadding + 1; - dataGridView1->AutoSize = true; - } - - - // - void Reset( Object^ sender, System::EventArgs^ e ) - { - dataGridView1->~DataGridView(); - InitializeDataGridView( nullptr, nullptr ); - } - - - // - void dataGridView1_CellClick( Object^ sender, DataGridViewCellEventArgs^ e ) - { - if ( turn->Equals( gameOverString ) ) - { - return; - } - - DataGridViewImageCell^ cell = dynamic_cast(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]); - if ( cell->Value == blank ) - { - if ( IsOsTurn() ) - { - cell->Value = o; - } - else - { - cell->Value = x; - } - - ToggleTurn(); - } - - if ( IsAWin( cell ) ) - { - turn->Text = gameOverString; - } - } - - - // - // - void dataGridView1_CellMouseEnter( Object^ sender, DataGridViewCellEventArgs^ e ) - { - Bitmap^ markingUnderMouse = dynamic_cast(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]->Value); - if ( markingUnderMouse == blank ) - { - dataGridView1->Cursor = Cursors::Default; - } - else - if ( markingUnderMouse == o || markingUnderMouse == x ) - { - dataGridView1->Cursor = Cursors::No; - ToolTip(e,true); - } - } - - void ToolTip( DataGridViewCellEventArgs^ e, bool showTip ) - { - DataGridViewImageCell^ cell = dynamic_cast(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]); - DataGridViewImageColumn^ imageColumn = dynamic_cast(dataGridView1->Columns[ cell->ColumnIndex ]); - if ( showTip ) - cell->ToolTipText = imageColumn->Description; - else - { - cell->ToolTipText = String::Empty; - } - } - - void dataGridView1_CellMouseLeave( Object^ sender, DataGridViewCellEventArgs^ e ) - { - ToolTip( e, false ); - dataGridView1->Cursor = Cursors::Default; - } - - - // - // - void Stretch( Object^ sender, EventArgs^ e ) - { - System::Collections::IEnumerator^ myEnum = dataGridView1->Columns->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DataGridViewImageColumn^ column = safe_cast(myEnum->Current); - column->ImageLayout = DataGridViewImageCellLayout::Stretch; - column->Description = L"Stretched"; - } - } - - void ZoomToImage( Object^ sender, EventArgs^ e ) - { - System::Collections::IEnumerator^ myEnum1 = dataGridView1->Columns->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - DataGridViewImageColumn^ column = safe_cast(myEnum1->Current); - column->ImageLayout = DataGridViewImageCellLayout::Zoom; - column->Description = L"Zoomed"; - } - } - - void NormalImage( Object^ sender, EventArgs^ e ) - { - System::Collections::IEnumerator^ myEnum2 = dataGridView1->Columns->GetEnumerator(); - while ( myEnum2->MoveNext() ) - { - DataGridViewImageColumn^ column = safe_cast(myEnum2->Current); - column->ImageLayout = DataGridViewImageCellLayout::Normal; - column->Description = L"Normal"; - } - } - - - // - void MakeCellsLarger( Object^ sender, EventArgs^ e ) - { - System::Collections::IEnumerator^ myEnum3 = dataGridView1->Columns->GetEnumerator(); - while ( myEnum3->MoveNext() ) - { - DataGridViewImageColumn^ column = safe_cast(myEnum3->Current); - column->Width = column->Width * 2; - } - - System::Collections::IEnumerable^ temp = safe_cast(dataGridView1->Rows); - System::Collections::IEnumerator^ myEnum4 = temp->GetEnumerator(); - - //System::Collections::IEnumerator^ myEnum4 = dataGridView1->Rows->GetEnumerator(); - while ( myEnum4->MoveNext() ) - { - DataGridViewRow^ row = safe_cast(myEnum4->Current); - if ( row->IsNewRow ) - break; - row->Height = (int)(row->Height * 1.5); - } - } - - bool IsAWin( DataGridViewCell^ cell ) - { - if ( ARowIsSame() || AColumnIsSame() || ADiagonalIsSame() ) - return true; - else - return false; - } - - bool ARowIsSame() - { - Bitmap^ marking = nullptr; - System::Collections::IEnumerable^ temp = safe_cast(dataGridView1->Rows); - System::Collections::IEnumerator^ myEnum5 = temp->GetEnumerator(); - //System::Collections::IEnumerator^ myEnum5 = dataGridView1->Rows->GetEnumerator(); - while ( myEnum5->MoveNext() ) - { - DataGridViewRow^ row = safe_cast(myEnum5->Current); - if ( row->IsNewRow ) - break; - - marking = dynamic_cast(row->Cells[ 0 ]->Value); - if ( marking != blank ) - { - if ( marking == row->Cells[ 1 ]->Value && marking == row->Cells[ 2 ]->Value ) - return true; - } - } - - return false; - } - - bool AColumnIsSame() - { - int columnIndex = 0; - Bitmap^ marking; - do - { - marking = dynamic_cast(dataGridView1->Rows[ 0 ]->Cells[ columnIndex ]->Value); - if ( marking != blank ) - { - if ( marking == dynamic_cast(dataGridView1->Rows[ 1 ]->Cells[ columnIndex ]->Value) && marking == dynamic_cast(dataGridView1->Rows[ 2 ]->Cells[ columnIndex ]->Value) ) - return true; - } - - columnIndex = columnIndex + 1; - } - while ( columnIndex < dataGridView1->Columns->GetColumnCount( DataGridViewElementStates::Visible ) ); - - return false; - } - - bool ADiagonalIsSame() - { - if ( LeftToRightDiagonalIsSame() ) - { - return true; - } - - if ( RightToLeftDiagonalIsSame() ) - { - return true; - } - - return false; - } - - bool LeftToRightDiagonalIsSame() - { - return IsDiagonalSame( 0, 2 ); - } - - bool RightToLeftDiagonalIsSame() - { - return IsDiagonalSame( 2, 0 ); - } - - bool IsDiagonalSame( int startingColumn, int lastColumn ) - { - Bitmap^ marking = dynamic_cast(dataGridView1->Rows[ 0 ]->Cells[ startingColumn ]->Value); - if ( marking == blank ) - return false; - - if ( marking == dataGridView1->Rows[ 1 ]->Cells[ 1 ]->Value && marking == dataGridView1->Rows[ 2 ]->Cells[ lastColumn ]->Value ) - return true; - - return false; - } - - void ToggleTurn() - { - if ( turn->Text->Equals( xString ) ) - { - turn->Text = oString; - } - else - { - turn->Text = xString; - } - } - - bool IsOsTurn() - { - if ( turn->Text->Equals( oString ) ) - return true; - - return false; - } - - -public: - - [STAThread] - static void Main() - { - Application::Run( gcnew TicTacToe ); - } - -}; - -int main() -{ - TicTacToe::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp deleted file mode 100644 index 33acdf176ad..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp +++ /dev/null @@ -1,311 +0,0 @@ - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class MouseSizing: public Form -{ -private: - FlowLayoutPanel^ flowLayoutPanel1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::Button^ button3; - System::Windows::Forms::Button^ button4; - System::Windows::Forms::Button^ button5; - System::Windows::Forms::Button^ button6; - System::Windows::Forms::Button^ button7; - System::Windows::Forms::Button^ button8; - System::Windows::Forms::Button^ button9; - -public: - MouseSizing() - { - InitializeComponent(); - this->Load += gcnew EventHandler( this, &MouseSizing::InitializeDataGridView ); - thirdColumnHeader = L"Main Ingredients"; - boringMeatloaf = L"ground beef"; - boringMeatloafRanking = L"*"; - } - - -#pragma region form set up - -private: - void InitializeComponent() - { - this->flowLayoutPanel1 = gcnew FlowLayoutPanel; - this->button4 = gcnew System::Windows::Forms::Button; - this->button5 = gcnew System::Windows::Forms::Button; - this->button6 = gcnew System::Windows::Forms::Button; - this->button7 = gcnew System::Windows::Forms::Button; - this->button8 = gcnew System::Windows::Forms::Button; - this->button9 = gcnew System::Windows::Forms::Button; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->button3 = gcnew System::Windows::Forms::Button; - this->flowLayoutPanel1->SuspendLayout(); - this->SuspendLayout(); - this->flowLayoutPanel1->Controls->Add( this->button4 ); - this->flowLayoutPanel1->Controls->Add( this->button5 ); - this->flowLayoutPanel1->Controls->Add( this->button6 ); - this->flowLayoutPanel1->Controls->Add( this->button7 ); - this->flowLayoutPanel1->Controls->Add( this->button8 ); - this->flowLayoutPanel1->Controls->Add( this->button9 ); - this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - this->flowLayoutPanel1->Location = Point(492,103); - this->flowLayoutPanel1->Name = L"flowLayoutPanel1"; - this->flowLayoutPanel1->AutoSize = true; - this->flowLayoutPanel1->TabIndex = 1; - this->button4->Location = System::Drawing::Point( 3, 3 ); - this->button4->Name = L"button4"; - this->button4->TabIndex = 3; - this->button4->Text = L"button4"; - this->button5->Location = System::Drawing::Point( 3, 32 ); - this->button5->Name = L"button5"; - this->button5->TabIndex = 4; - this->button5->Text = L"button5"; - this->button6->Location = System::Drawing::Point( 3, 61 ); - this->button6->Name = L"button6"; - this->button6->TabIndex = 5; - this->button6->Text = L"button6"; - this->button7->Location = System::Drawing::Point( 3, 90 ); - this->button7->Name = L"button7"; - this->button7->TabIndex = 6; - this->button7->Text = L"button7"; - this->button8->Location = System::Drawing::Point( 3, 119 ); - this->button8->Name = L"button8"; - this->button8->TabIndex = 7; - this->button8->Text = L"button8"; - this->button9->Location = System::Drawing::Point( 3, 148 ); - this->button9->Name = L"button9"; - this->button9->TabIndex = 8; - this->button9->Text = L"button9"; - this->button1->Location = System::Drawing::Point( 492, 3 ); - this->button1->Name = L"button1"; - this->button1->TabIndex = 0; - this->button1->Text = L"button1"; - this->button2->Location = System::Drawing::Point( 492, 33 ); - this->button2->Name = L"button2"; - this->button2->TabIndex = 1; - this->button2->Text = L"button2"; - this->button3->Location = System::Drawing::Point( 492, 63 ); - this->button3->Name = L"button3"; - this->button3->TabIndex = 2; - this->button3->Text = L"button3"; - this->AutoSize = true; - this->Controls->Add( this->flowLayoutPanel1 ); - this->Controls->Add( this->button1 ); - this->Controls->Add( this->button2 ); - this->Controls->Add( this->button3 ); - AddButton( button1, L"Reset" ); - AddButton( button2, L"Change Column 3 Header" ); - AddButton( button3, L"Change Meatloaf Recipe" ); - button1->Click += gcnew EventHandler( this, &MouseSizing::ResetToDisorder ); - button2->Click += gcnew EventHandler( this, &MouseSizing::ChangeColumn3Header ); - button3->Click += gcnew EventHandler( this, &MouseSizing::ChangeMeatloafRecipe ); - AddButtonsForAffectingMouseResizing(); - this->Name = L"MouseSizing"; - this->Text = L"Mouse Sizing"; - this->flowLayoutPanel1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - -#pragma endregion - -public: - - [STAThread] - static void Main() - { - Application::EnableVisualStyles(); - Application::Run( gcnew MouseSizing ); - } - - -private: - System::Drawing::Size startingSize; - String^ thirdColumnHeader; - String^ boringMeatloaf; - String^ boringMeatloafRanking; - bool boringRecipe; - bool shortMode; - DataGridView^ dataGridView1; - void InitializeDataGridView( Object^ ignored, EventArgs^ ignoredToo ) - { - this->dataGridView1 = gcnew DataGridView; - this->Controls->Add( this->dataGridView1 ); - startingSize = System::Drawing::Size( 450, 400 ); - dataGridView1->Size = startingSize; - SetUpColumns(); - PopulateRows(); - shortMode = false; - boringRecipe = true; - } - - void SetUpColumns() - { - dataGridView1->ColumnCount = 4; - dataGridView1->ColumnHeadersVisible = true; - DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); - dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - dataGridView1->Columns[ 0 ]->Name = L"Recipe"; - dataGridView1->Columns[ 1 ]->Name = L"Category"; - dataGridView1->Columns[ 2 ]->Name = thirdColumnHeader; - dataGridView1->Columns[ 3 ]->Name = L"Rating"; - } - - void PopulateRows() - { - array^row1 = {L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking}; - array^row2 = {L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****"}; - array^row3 = {L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****"}; - array^row4 = {L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****"}; - array^row5 = {L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***"}; - array^row6 = {L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***"}; - array^rows = gcnew array{ - row1,row2,row3,row4,row5,row6 - }; - - for each (array^ row in rows) - dataGridView1->Rows->Add(row); - } - - void AddButton( Button^ button, String^ buttonLabel ) - { - button->Text = buttonLabel; - button->AutoSize = true; - } - - void ResetToDisorder( Object^ sender, EventArgs^ e ) - { - Controls->Remove( dataGridView1 ); - dataGridView1->~DataGridView(); - InitializeDataGridView( nullptr, nullptr ); - } - - void ChangeColumn3Header( Object^ sender, EventArgs^ e ) - { - Toggle( &shortMode ); - if ( shortMode ) - dataGridView1->Columns[ 2 ]->HeaderText = L"S"; - else - dataGridView1->Columns[ 2 ]->HeaderText = thirdColumnHeader; - } - - void Toggle( interior_ptr toggleThis ) - { - *toggleThis = ! *toggleThis; - } - - void ChangeMeatloafRecipe( Object^ sender, EventArgs^ e ) - { - Toggle( &boringRecipe ); - if ( boringRecipe ) - SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); - else - { - String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " - L"1/2 cup bread crumbs, 1/4 cup ketchup," - L"1/3 tsp onion powder, " - L"1 clove of garlic, 1/2 pack onion soup mix " - L" dash of your favorite BBQ Sauce"; - SetMeatloaf( greatMeatloafRecipe, L"***" ); - } - } - - void SetMeatloaf( String^ recipe, String^ rating ) - { - dataGridView1->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; - dataGridView1->Rows[ 0 ]->Cells[ 3 ]->Value = rating; - } - - -#pragma region " prevent mouse resizing " - void AddButtonsForAffectingMouseResizing() - { - AddButton( button4, L"Fix Column Header Height" ); - AddButton( button5, L"Fix Row Header Width" ); - AddButton( button6, L"Fix Third Column" ); - AddButton( button7, L"Allow Mouse Resizing of Third Column" ); - AddButton( button8, L"Default Sizing Behavior For Third Column" ); - AddButton( button9, L"Fix Fourth Row" ); - button4->Click += gcnew EventHandler( this, &MouseSizing::FixColumnHeaderHeight ); - button5->Click += gcnew EventHandler( this, &MouseSizing::FixRowHeadersWidth ); - button6->Click += gcnew EventHandler( this, &MouseSizing::FixThirdColumn ); - button7->Click += gcnew EventHandler( this, &MouseSizing::AllowThirdColumnToResize ); - button8->Click += gcnew EventHandler( this, &MouseSizing::FixFourthRow ); - button9->Click += gcnew EventHandler( this, &MouseSizing::SetThirdColumnToDefaultBehavior ); - } - - void FixColumnHeaderHeight( Object^ sender, EventArgs^ e ) - { - - // - dataGridView1->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::DisableResizing; - - // - } - - void FixRowHeadersWidth( Object^ sender, EventArgs^ e ) - { - - // - dataGridView1->RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode::DisableResizing; - - // - } - - void FixThirdColumn( Object^ sender, EventArgs^ e ) - { - - // - dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::False; - - // - } - - void AllowThirdColumnToResize( Object^ sender, EventArgs^ e ) - { - - // - dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::True; - - // - } - - void SetThirdColumnToDefaultBehavior( Object^ sender, EventArgs^ e ) - { - - // - dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::NotSet; - - // - } - - void FixFourthRow( Object^ sender, EventArgs^ e ) - { - - // - dataGridView1->Rows[ 3 ]->Resizable = DataGridViewTriState::False; - - // - } - - -#pragma endregion - -}; - -int main() -{ - MouseSizing::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp deleted file mode 100644 index 65caf14ff3c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp +++ /dev/null @@ -1,281 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class ProgrammaticSizing: public System::Windows::Forms::Form -{ -private: - FlowLayoutPanel^ flowLayoutPanel1; - Button^ button1; - Button^ button2; - Button^ button3; - Button^ button4; - Button^ button5; - Button^ button6; - Button^ button7; - Button^ button8; - Button^ button9; - Button^ button10; - Button^ button11; - -public: - ProgrammaticSizing() - { - button1 = gcnew Button; - button2 = gcnew Button; - button3 = gcnew Button; - button4 = gcnew Button; - button5 = gcnew Button; - button6 = gcnew Button; - button7 = gcnew Button; - button8 = gcnew Button; - button9 = gcnew Button; - button10 = gcnew Button; - button11 = gcnew Button; - thirdColumnHeader = "Main Ingredients"; - boringMeatloaf = "ground beef"; - boringMeatloafRanking = "*"; - otherResturant = "Gomes's Saharan Sushi"; - InitializeComponent(); - AddDirections(); - this->Load += gcnew EventHandler( this, &ProgrammaticSizing::InitializeDataGridView ); - AddButton( button1, "Reset", gcnew EventHandler( this, &ProgrammaticSizing::ResetToDisorder ) ); - AddButton( button2, "Change Column 3 Header", gcnew EventHandler( this, &ProgrammaticSizing::ChangeColumn3Header ) ); - AddButton( button3, "Change Meatloaf Recipe", gcnew EventHandler( this, &ProgrammaticSizing::ChangeMeatloafRecipe ) ); - AddButton( button10, "Change Resturant 2", gcnew EventHandler( this, &ProgrammaticSizing::ChangeResturant ) ); - AddButtonsForProgrammaticResizing(); - } - - -private: - void InitializeComponent() - { - this->flowLayoutPanel1 = gcnew FlowLayoutPanel; - this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - this->flowLayoutPanel1->Location = Point(492,0); - this->flowLayoutPanel1->AutoSize = true; - this->AutoSize = true; - this->Controls->Add( this->flowLayoutPanel1 ); - this->Text = this->GetType()->Name; - } - - void AddDirections() - { - Label^ directions = gcnew Label; - directions->AutoSize = true; - String^ newLine = Environment::NewLine; - directions->Text = String::Format( "Press the buttons that start {0}with 'Change' to see how different sizing {1}modes deal with content changes.", newLine, newLine ); - flowLayoutPanel1->Controls->Add( directions ); - } - - System::Drawing::Size startingSize; - String^ thirdColumnHeader; - String^ boringMeatloaf; - String^ boringMeatloafRanking; - bool boringRecipe; - bool shortMode; - DataGridView^ dataGridView1; - String^ otherResturant; - void InitializeDataGridView( Object^ /*sender*/, EventArgs^ /*ignoredToo*/ ) - { - this->dataGridView1 = gcnew DataGridView; - this->dataGridView1->Location = Point(0,0); - this->dataGridView1->Size = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->dataGridView1 ); - startingSize = System::Drawing::Size( 450, 400 ); - dataGridView1->Size = startingSize; - AddColumns(); - PopulateRows(); - shortMode = false; - boringRecipe = true; - } - - void AddColumns() - { - dataGridView1->ColumnCount = 4; - dataGridView1->ColumnHeadersVisible = true; - DataGridViewCellStyle ^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( "Verdana",10,FontStyle::Bold ); - dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - dataGridView1->Columns[ 0 ]->Name = "Recipe"; - dataGridView1->Columns[ 1 ]->Name = "Category"; - dataGridView1->Columns[ 2 ]->Name = thirdColumnHeader; - dataGridView1->Columns[ 3 ]->Name = "Rating"; - } - - void PopulateRows() - { - array^row1 = {"Meatloaf","Main Dish",boringMeatloaf,boringMeatloafRanking}; - array^row2 = {"Key Lime Pie","Dessert","lime juice, evaporated milk","****"}; - array^row3 = {"Orange-Salsa Pork Chops","Main Dish","pork chops, salsa, orange juice","****"}; - array^row4 = {"Black Bean and Rice Salad","Salad","black beans, brown rice","****"}; - array^row5 = {"Chocolate Cheesecake","Dessert","cream cheese","***"}; - array^row6 = {"Black Bean Dip","Appetizer","black beans, sour cream","***"}; - array^rows = {row1,row2,row3,row4,row5,row6}; - IEnumerator^ myEnum = rows->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - array^row = safe_cast^>(myEnum->Current); - dataGridView1->Rows->Add( row ); - } - - IEnumerator^ myEnum1 = safe_cast(dataGridView1->Rows)->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - DataGridViewRow ^ row = safe_cast(myEnum1->Current); - if ( row->IsNewRow ) - break; - row->HeaderCell->Value = String::Format( "Resturant {0}", row->Index ); - } - } - - void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) - { - button->Text = buttonLabel; - button->AutoSize = true; - flowLayoutPanel1->Controls->Add( button ); - button->Click += handler; - } - - void ResetToDisorder( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Controls->Remove( dataGridView1 ); - dataGridView1->Size = startingSize; - dataGridView1->DataGridView::~DataGridView(); - InitializeDataGridView( nullptr, nullptr ); - } - - void ChangeColumn3Header( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Toggle( &shortMode ); - if ( shortMode ) - dataGridView1->Columns[ 2 ]->HeaderText = "S"; - else - dataGridView1->Columns[ 2 ]->HeaderText = thirdColumnHeader; - } - - void Toggle( interior_ptr toggleThis ) - { - *toggleThis = ! *toggleThis; - } - - void ChangeMeatloafRecipe( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - Toggle( &boringRecipe ); - if ( boringRecipe ) - SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); - else - { - String^ greatMeatloafRecipe = "1 lb. lean ground beef, " - "1/2 cup bread crumbs, 1/4 cup ketchup," - "1/3 tsp onion powder, " - "1 clove of garlic, 1/2 pack onion soup mix " - " dash of your favorite BBQ Sauce"; - SetMeatloaf( greatMeatloafRecipe, "***" ); - } - } - - void SetMeatloaf( String^ recipe, String^ rating ) - { - dataGridView1->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; - dataGridView1->Rows[ 0 ]->Cells[ 3 ]->Value = rating; - } - - void ChangeResturant( Object^ /*sender*/, EventArgs^ /*ignored*/ ) - { - if ( dataGridView1->Rows[ 2 ]->HeaderCell->Value == otherResturant ) - dataGridView1->Rows[ 2 ]->HeaderCell->Value = "Resturant 2"; - else - dataGridView1->Rows[ 2 ]->HeaderCell->Value = otherResturant; - } - - void AddButtonsForProgrammaticResizing() - { - AddButton( button4, "Size Third Column", gcnew EventHandler( this, &ProgrammaticSizing::SizeThirdColumnHeader ) ); - AddButton( button5, "Size Column Headers", gcnew EventHandler( this, &ProgrammaticSizing::SizeColumnHeaders ) ); - AddButton( button6, "Size All Columns", gcnew EventHandler( this, &ProgrammaticSizing::SizeAllColumns ) ); - AddButton( button7, "Size Third Row", gcnew EventHandler( this, &ProgrammaticSizing::SizeThirdRow ) ); - AddButton( button8, "Size First Row Header Using All Headers", gcnew EventHandler( this, &ProgrammaticSizing::SizeFirstRowHeaderToAllHeaders ) ); - AddButton( button9, "Size All Rows and Row Headers", gcnew EventHandler( this, &ProgrammaticSizing::SizeAllRowsAndTheirHeaders ) ); - AddButton( button11, "Size All Rows ", gcnew EventHandler( this, &ProgrammaticSizing::SizeAllRows ) ); - } - - - // - void SizeThirdColumnHeader( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->AutoResizeColumn(2, DataGridViewAutoSizeColumnMode::ColumnHeader); - } - - - // - // - void SizeColumnHeaders( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - int columnNumber; - bool dontChangeColumnWidth; - bool dontChangeRowHeadersWidth; - dataGridView1->AutoResizeColumnHeadersHeight(2); - } - - - // - // - void SizeAllColumns( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->AutoResizeColumns( DataGridViewAutoSizeColumnsMode::AllCells ); - } - - - // - // - void SizeThirdRow( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->AutoResizeRow(2, DataGridViewAutoSizeRowMode::AllCellsExceptHeader); - } - - - // - // - void SizeFirstRowHeaderToAllHeaders( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->AutoResizeRowHeadersWidth(0, DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders); - } - - - // - // - void SizeAllRowsAndTheirHeaders( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->AutoResizeRows(DataGridViewAutoSizeRowsMode::AllCells); - } - - - // - // - void SizeAllRows( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->AutoResizeRows(DataGridViewAutoSizeRowsMode::AllCellsExceptHeaders); - } - - // -}; - - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew ProgrammaticSizing ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp deleted file mode 100644 index 2e3ca96ceda..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp +++ /dev/null @@ -1,48 +0,0 @@ - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -ref class Form1: public Form -{ -private: - DataGridView^ dataGridView1; - -public: - static void Main() - { - Application::Run( gcnew Form1 ); - } - - Form1() - { - this->dataGridView1->Dock = DockStyle::Fill; - this->Controls->Add( this->dataGridView1 ); - this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); - dataGridView1 = gcnew DataGridView; - } - - void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // - DataGridViewRow^ row = this->dataGridView1->RowTemplate; - row->DefaultCellStyle->BackColor = Color::Bisque; - row->Height = 35; - row->MinimumHeight = 20; - - // - this->dataGridView1->ColumnCount = 5; - this->dataGridView1->RowCount = 10; - } - -}; - -int main() -{ - Form1::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp deleted file mode 100644 index 24331430fed..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp +++ /dev/null @@ -1,355 +0,0 @@ -// -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -// -public ref class Customer -{ -private: - String^ companyNameValue; - String^ contactNameValue; - -public: - Customer() - { - - // Leave fields empty. - } - - Customer( String^ companyName, String^ contactName ) - { - companyNameValue = companyName; - contactNameValue = contactName; - } - - - property String^ CompanyName - { - String^ get() - { - return companyNameValue; - } - - void set( String^ value ) - { - companyNameValue = value; - } - - } - - property String^ ContactName - { - String^ get() - { - return contactNameValue; - } - - void set( String^ value ) - { - contactNameValue = value; - } - - } - -}; -// - -// -public ref class Form1: public Form -{ -private: - DataGridView^ dataGridView1; - - // Declare an ArrayList to serve as the data store. - System::Collections::ArrayList^ customers; - - // Declare a Customer object to store data for a row being edited. - Customer^ customerInEdit; - - // Declare a variable to store the index of a row being edited. - // A value of -1 indicates that there is no row currently in edit. - int rowInEdit; - - // Declare a variable to indicate the commit scope. - // Set this value to false to use cell-level commit scope. - bool rowScopeCommit; - -public: - static void Main() - { - Application::Run( gcnew Form1 ); - } - - Form1() - { - dataGridView1 = gcnew DataGridView; - customers = gcnew System::Collections::ArrayList; - rowInEdit = -1; - rowScopeCommit = true; - - // Initialize the form. - this->dataGridView1->Dock = DockStyle::Fill; - this->Controls->Add( this->dataGridView1 ); - this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); - } - -private: - // - // - void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Enable virtual mode. - this->dataGridView1->VirtualMode = true; - - // Connect the virtual-mode events to event handlers. - this->dataGridView1->CellValueNeeded += gcnew - DataGridViewCellValueEventHandler( this, &Form1::dataGridView1_CellValueNeeded ); - this->dataGridView1->CellValuePushed += gcnew - DataGridViewCellValueEventHandler( this, &Form1::dataGridView1_CellValuePushed ); - this->dataGridView1->NewRowNeeded += gcnew - DataGridViewRowEventHandler( this, &Form1::dataGridView1_NewRowNeeded ); - this->dataGridView1->RowValidated += gcnew - DataGridViewCellEventHandler( this, &Form1::dataGridView1_RowValidated ); - this->dataGridView1->RowDirtyStateNeeded += gcnew - QuestionEventHandler( this, &Form1::dataGridView1_RowDirtyStateNeeded ); - this->dataGridView1->CancelRowEdit += gcnew - QuestionEventHandler( this, &Form1::dataGridView1_CancelRowEdit ); - this->dataGridView1->UserDeletingRow += gcnew - DataGridViewRowCancelEventHandler( this, &Form1::dataGridView1_UserDeletingRow ); - - // Add columns to the DataGridView. - DataGridViewTextBoxColumn^ companyNameColumn = gcnew DataGridViewTextBoxColumn; - companyNameColumn->HeaderText = L"Company Name"; - companyNameColumn->Name = L"Company Name"; - DataGridViewTextBoxColumn^ contactNameColumn = gcnew DataGridViewTextBoxColumn; - contactNameColumn->HeaderText = L"Contact Name"; - contactNameColumn->Name = L"Contact Name"; - this->dataGridView1->Columns->Add( companyNameColumn ); - this->dataGridView1->Columns->Add( contactNameColumn ); - this->dataGridView1->AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode::AllCells; - - // Add some sample entries to the data store. - this->customers->Add( gcnew Customer( L"Bon app'",L"Laurence Lebihan" ) ); - this->customers->Add( gcnew Customer( L"Bottom-Dollar Markets",L"Elizabeth Lincoln" ) ); - this->customers->Add( gcnew Customer( L"B's Beverages",L"Victoria Ashworth" ) ); - - // Set the row count, including the row for new records. - this->dataGridView1->RowCount = 4; - } - // - - // - void dataGridView1_CellValueNeeded( Object^ /*sender*/, - System::Windows::Forms::DataGridViewCellValueEventArgs^ e ) - { - Customer^ customerTmp = nullptr; - - // Store a reference to the Customer object for the row being painted. - if ( e->RowIndex == rowInEdit ) - { - customerTmp = this->customerInEdit; - } - else - { - customerTmp = dynamic_cast(this->customers[ e->RowIndex ]); - } - - // Set the cell value to paint using the Customer object retrieved. - int switchcase = 0; - if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Company Name" ) ) - switchcase = 1; - else - if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Contact Name" ) ) - switchcase = 2; - - - switch ( switchcase ) - { - case 1: - e->Value = customerTmp->CompanyName; - break; - - case 2: - e->Value = customerTmp->ContactName; - break; - } - } - - - // - // - void dataGridView1_CellValuePushed( Object^ /*sender*/, - System::Windows::Forms::DataGridViewCellValueEventArgs^ e ) - { - Customer^ customerTmp = nullptr; - - // Store a reference to the Customer object for the row being edited. - if ( e->RowIndex < this->customers->Count ) - { - - // If the user is editing a new row, create a new Customer object. - if ( this->customerInEdit == nullptr ) - { - this->customerInEdit = gcnew Customer( - (dynamic_cast(this->customers[ e->RowIndex ]))->CompanyName, - (dynamic_cast(this->customers[ e->RowIndex ])->ContactName) ); - } - - customerTmp = this->customerInEdit; - this->rowInEdit = e->RowIndex; - } - else - { - customerTmp = this->customerInEdit; - } - - - // Set the appropriate Customer property to the cell value entered. - int switchcase = 0; - if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Company Name" ) ) - switchcase = 1; - else - if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Contact Name" ) ) - switchcase = 2; - - - switch ( switchcase ) - { - case 1: - customerTmp->CompanyName = dynamic_cast(e->Value); - break; - - case 2: - customerTmp->ContactName = dynamic_cast(e->Value); - break; - } - } - - - // - // - void dataGridView1_NewRowNeeded( Object^ /*sender*/, - System::Windows::Forms::DataGridViewRowEventArgs^ /*e*/ ) - { - - // Create a new Customer object when the user edits - // the row for new records. - this->customerInEdit = gcnew Customer; - this->rowInEdit = this->dataGridView1->Rows->Count - 1; - } - - - // - // - void dataGridView1_RowValidated( Object^ /*sender*/, - System::Windows::Forms::DataGridViewCellEventArgs^ e ) - { - - // Save row changes if any were made and release the edited - // Customer object if there is one. - if ( e->RowIndex >= this->customers->Count && e->RowIndex != this->dataGridView1->Rows->Count - 1 ) - { - - // Add the new Customer object to the data store. - this->customers->Add( this->customerInEdit ); - this->customerInEdit = nullptr; - this->rowInEdit = -1; - } - else - if ( this->customerInEdit != nullptr && e->RowIndex < this->customers->Count ) - { - - // Save the modified Customer object in the data store. - this->customers[ e->RowIndex ] = this->customerInEdit; - this->customerInEdit = nullptr; - this->rowInEdit = -1; - } - else - if ( this->dataGridView1->ContainsFocus ) - { - this->customerInEdit = nullptr; - this->rowInEdit = -1; - } - } - - - // - // - void dataGridView1_RowDirtyStateNeeded( Object^ /*sender*/, - System::Windows::Forms::QuestionEventArgs^ e ) - { - if ( !rowScopeCommit ) - { - - // In cell-level commit scope, indicate whether the value - // of the current cell has been modified. - e->Response = this->dataGridView1->IsCurrentCellDirty; - } - } - - - // - // - void dataGridView1_CancelRowEdit( Object^ /*sender*/, - System::Windows::Forms::QuestionEventArgs^ /*e*/ ) - { - if ( this->rowInEdit == this->dataGridView1->Rows->Count - 2 && - this->rowInEdit == this->customers->Count ) - { - - // If the user has canceled the edit of a newly created row, - // replace the corresponding Customer object with a new, empty one. - this->customerInEdit = gcnew Customer; - } - else - { - - // If the user has canceled the edit of an existing row, - // release the corresponding Customer object. - this->customerInEdit = nullptr; - this->rowInEdit = -1; - } - } - - - // - // - void dataGridView1_UserDeletingRow( Object^ /*sender*/, - System::Windows::Forms::DataGridViewRowCancelEventArgs^ e ) - { - if ( e->Row->Index < this->customers->Count ) - { - - // If the user has deleted an existing row, remove the - // corresponding Customer object from the data store. - this->customers->RemoveAt( e->Row->Index ); - } - - if ( e->Row->Index == this->rowInEdit ) - { - - // If the user has deleted a newly created row, release - // the corresponding Customer object. - this->rowInEdit = -1; - this->customerInEdit = nullptr; - } - } - // - // -}; -// - -int main() -{ - Form1::Main(); -} -// - - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp deleted file mode 100644 index d53ffac68d3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp +++ /dev/null @@ -1,174 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::Drawing; -using namespace System::Globalization; - -namespace Sample -{ - public ref class VirtualConnector : public Form - { - DataGridView^ dataGridView1; - const int initialSize; - int numberOfRows; - Dictionary^ store; - const int initialValue; - bool newRowNeeded; - - public: - VirtualConnector(); - - private: - void dataGridView1_NewRowNeeded(Object^ sender, - DataGridViewRowEventArgs^ e); - void dataGridView1_RowsAdded(Object^ sender, - DataGridViewRowsAddedEventArgs^ e); - void dataGridView1_CellValueNeeded(Object^ sender, - DataGridViewCellValueEventArgs^ e); - void dataGridView1_CellValuePushed(Object^ sender, - DataGridViewCellValueEventArgs^ e); - void dataGridView1_CellValidating(Object^ sender, - DataGridViewCellValidatingEventArgs^ e); - }; - - - VirtualConnector::VirtualConnector(): - dataGridView1(gcnew DataGridView()), - initialSize(5000000), - newRowNeeded(false), - initialValue(-1), - numberOfRows(initialSize), - store(gcnew Dictionary()), - Form() - { - this->Text = this->GetType()->Name; - - dataGridView1->NewRowNeeded += - gcnew DataGridViewRowEventHandler(this, - &VirtualConnector::dataGridView1_NewRowNeeded); - - dataGridView1->RowsAdded += - gcnew DataGridViewRowsAddedEventHandler(this, - &VirtualConnector::dataGridView1_RowsAdded); - - dataGridView1->CellValidating += - gcnew DataGridViewCellValidatingEventHandler(this, - &VirtualConnector::dataGridView1_CellValidating); - - dataGridView1->CellValueNeeded += - gcnew DataGridViewCellValueEventHandler(this, - &VirtualConnector::dataGridView1_CellValueNeeded); - - dataGridView1->CellValuePushed += - gcnew DataGridViewCellValueEventHandler(this, - &VirtualConnector::dataGridView1_CellValuePushed); - - try - { - Controls->Add(dataGridView1); - dataGridView1->VirtualMode = true; - dataGridView1->AllowUserToDeleteRows = false; - dataGridView1->Columns->Add("Numbers", - "Positive Numbers"); - dataGridView1->Rows->AddCopies(0, initialSize); - } - catch (InvalidOperationException^ ex) - { - MessageBox::Show(String::Format( - CultureInfo::CurrentCulture, - "Exception occurred: {0}", ex)); - } - } - - // - void VirtualConnector::dataGridView1_NewRowNeeded - (Object^ sender, DataGridViewRowEventArgs^ e) - { - newRowNeeded = true; - } - - // - void VirtualConnector::dataGridView1_RowsAdded - (Object^ sender, DataGridViewRowsAddedEventArgs^ e) - { - if (newRowNeeded) - { - newRowNeeded = false; - numberOfRows = numberOfRows + 1; - } - } - // - - // -#pragma region Data store maintance - - void VirtualConnector::dataGridView1_CellValueNeeded - (Object^ sender, DataGridViewCellValueEventArgs^ e) - { - if (store->ContainsKey(e->RowIndex)) - { - // Use the store if the e value has been modified - // and stored. - e->Value = gcnew Int32(store->default[e->RowIndex]); - } - else if (newRowNeeded && e->RowIndex == numberOfRows) - { - if (dataGridView1->IsCurrentCellInEditMode) - { - e->Value = initialValue; - } - else - { - // Show a blank e if the cursor is just loitering - // over(the) last row. - e->Value = String::Empty; - } - } - else - { - e->Value = e->RowIndex; - } - } - - void VirtualConnector::dataGridView1_CellValuePushed - (Object^ sender, DataGridViewCellValueEventArgs^ e) - { - String^ value = e->Value->ToString(); - store[e->RowIndex] = Int32::Parse(value, - CultureInfo::CurrentCulture); - } -#pragma endregion - // - // - - // - void VirtualConnector::dataGridView1_CellValidating - (Object^ sender, DataGridViewCellValidatingEventArgs^ e) - { - int newInteger; - - // Don't try to validate the 'new row' until finished - // editing since there - // is not any point in validating its initial value. - if (dataGridView1->Rows[e->RowIndex]->IsNewRow) - { - return; - } - if (!Int32::TryParse(e->FormattedValue->ToString(), - newInteger) || (newInteger < 0)) - { - e->Cancel = true; - } - } - // -} -int main() -{ - Application::Run(gcnew Sample::VirtualConnector()); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp deleted file mode 100644 index cd185ce9a79..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#using -#using -#using -using namespace System; -using namespace System::Windows::Forms; - -ref class Form1 : public Form -{ -private: - DataGridView^ dataGridView1; - -public: - static void Main() - { - Application::Run(gcnew Form1()); - } - -public: - Form1() - { - dataGridView1 = gcnew DataGridView(); - - this->dataGridView1->Dock = DockStyle::Fill; - // Set the column header names. - this->dataGridView1->ColumnCount = 5; - this->dataGridView1->Columns[0]->Name = "Recipe"; - this->dataGridView1->Columns[1]->Name = "Category"; - this->dataGridView1->Columns[2]->Name = "Main Ingredients"; - this->dataGridView1->Columns[3]->Name = "Last Fixed"; - this->dataGridView1->Columns[4]->Name = "Rating"; - - // Populate the rows. - array^ row1 = gcnew array{"Meatloaf", - "Main Dish", "ground beef", gcnew DateTime(2000, 3, 23), "*"}; - array^ row2 = gcnew array{"Key Lime Pie", - "Dessert", "lime juice, evaporated milk", gcnew DateTime(2002, 4, 12), "****"}; - array^ row3 = gcnew array{"Orange-Salsa Pork Chops", - "Main Dish", "pork chops, salsa, orange juice", gcnew DateTime(2000, 8, 9), "****"}; - array^ row4 = gcnew array{"Black Bean and Rice Salad", - "Salad", "black beans, brown rice", gcnew DateTime(1999, 5, 7), "****"}; - array^ row5 = gcnew array{"Chocolate Cheesecake", - "Dessert", "cream cheese", gcnew DateTime(2003, 3, 12), "***"}; - array^ row6 = gcnew array{"Black Bean Dip", "Appetizer", - "black beans, sour cream", gcnew DateTime(2003, 12, 23), "***"}; - array^ rows = gcnew array { row1, row2, row3, row4, row5, row6 }; - - for each (array^ rowArray in rows) - { - this->dataGridView1->Rows->Add(rowArray); - } - this->Controls->Add(this->dataGridView1); - this->dataGridView1->CellFormatting += gcnew DataGridViewCellFormattingEventHandler(this, &Form1::dataGridView1_CellFormatting); - } - - - // - // Sets the ToolTip text for cells in the Rating column. - void dataGridView1_CellFormatting(Object^ /*sender*/, - DataGridViewCellFormattingEventArgs^ e) - { - if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index) - && e->Value != nullptr ) - { - DataGridViewCell^ cell = - this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex]; - if (e->Value->Equals("*")) - { - cell->ToolTipText = "very bad"; - } - else if (e->Value->Equals("**")) - { - cell->ToolTipText = "bad"; - } - else if (e->Value->Equals("***")) - { - cell->ToolTipText = "good"; - } - else if (e->Value->Equals("****")) - { - cell->ToolTipText = "very good"; - } - } - } - // -}; - -int main(){ - Form1::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp deleted file mode 100644 index b0662bd4a65..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp +++ /dev/null @@ -1,479 +0,0 @@ -//Databinding between checkbox state to some table, implement updating. -// Lots of validation work could happen for adding a new row scenario: validate employee id, boss Id. - - -// -#using -#using -#using -#using - -#using -#using -#using -using namespace System; -using namespace System::Data; -using namespace System::Data::SqlClient; -using namespace System::Windows::Forms; -using namespace System::Collections::Generic; -using namespace System::Drawing; - -public ref class Employees : public Form -{ -private: - DataGridView^ DataGridView1; - -private: - DataGridView^ DataGridView2; - -public: - [STAThread] - static void Main() - { - try - { - Application::EnableVisualStyles(); - Application::Run(gcnew Employees()); - } - catch (Exception^ e) - { - MessageBox::Show(e->Message + e->StackTrace); - } - } - -private: - Dictionary^ inOffice; - -public: - Employees() - { - DataGridView1 = gcnew DataGridView(); - DataGridView2 = gcnew DataGridView(); - connectionString = - "Integrated Security=SSPI;Persist Security Info=False;" + - "Initial Catalog=Northwind;Data Source=localhost"; - inOffice = gcnew Dictionary; - - this->Load += gcnew EventHandler(this, &Employees::Form1_Load); - } - -private: - void Form1_Load(System::Object^ /*sender*/, System::EventArgs^ /*e*/) - { - try - { - SetUpForm(); - SetUpDataGridView1(); - SetUpDataGridView2(); - } - catch (SqlException^) - { - MessageBox::Show("The connection string <" - + connectionString - + "> failed to connect. Modify it " - + "to connect to a Northwind database accessible to " - + "your system.", - "ERROR", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); - Application::Exit(); - } - } - -private: - void SetUpForm() - { - Size = System::Drawing::Size(800, 600); - FlowLayoutPanel^ flowLayout = gcnew FlowLayoutPanel(); - flowLayout->FlowDirection = FlowDirection::TopDown; - flowLayout->Dock = DockStyle::Fill; - Controls->Add(flowLayout); - - flowLayout->Controls->Add(DataGridView1); - flowLayout->Controls->Add(DataGridView2); - } - - // -private: - void SetUpDataGridView2() - { - DataGridView2->Dock = DockStyle::Bottom; - DataGridView2->TopLeftHeaderCell->Value = "Sales Details"; - DataGridView2->RowHeadersWidthSizeMode = - DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders; - } - // - -private: - void SetUpDataGridView1() - { - //DataGridView1.DataError += new - // DataGridViewDataErrorEventHandler(DataGridView1_DataError); - DataGridView1->CellContentClick += gcnew - DataGridViewCellEventHandler(this, &Employees::DataGridView1_CellContentClick); - DataGridView1->CellValuePushed += gcnew - DataGridViewCellValueEventHandler(this, &Employees::DataGridView1_CellValuePushed); - DataGridView1->CellValueNeeded += gcnew - DataGridViewCellValueEventHandler(this, &Employees::DataGridView1_CellValueNeeded); - - // Virtual mode is turned on so that the - // unbound DataGridViewCheckBoxColumn will - // keep its state when the bound columns are - // sorted. - DataGridView1->VirtualMode = true; - DataGridView1->AutoSize = true; - DataGridView1->DataSource = Populate("SELECT * FROM Employees"); - DataGridView1->TopLeftHeaderCell->Value = "Employees"; - DataGridView1->RowHeadersWidthSizeMode = - DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders; - DataGridView1->ColumnHeadersHeightSizeMode = - DataGridViewColumnHeadersHeightSizeMode::AutoSize; - DataGridView1->AutoSizeColumnsMode = - DataGridViewAutoSizeColumnsMode::AllCells; - DataGridView1->AllowUserToAddRows = false; - DataGridView1->AllowUserToDeleteRows = false; - - // The below autogenerated column is removed so - // a DataGridViewComboboxColumn could be used instead. - DataGridView1->Columns->Remove(ColumnName::TitleOfCourtesy.ToString()); - DataGridView1->Columns->Remove(ColumnName::ReportsTo.ToString()); - - AddLinkColumn(); - AddComboBoxColumns(); - AddButtonColumn(); - AddOutOfOfficeColumn(); - } - -private: - void AddComboBoxColumns() - { - DataGridViewComboBoxColumn^ comboboxColumn; - comboboxColumn = CreateComboBoxColumn(); - SetAlternateChoicesUsingDataSource(comboboxColumn); - comboboxColumn->HeaderText = "TitleOfCourtesy (via DataSource property)"; - DataGridView1->Columns->Insert(0, comboboxColumn); - - comboboxColumn = CreateComboBoxColumn(); - SetAlternateChoicesUsingItems(comboboxColumn); - comboboxColumn->HeaderText = "TitleOfCourtesy (via Items property)"; - // Tack this example column onto the end. - DataGridView1->Columns->Add(comboboxColumn); - } - - // -private: - void AddLinkColumn() - { - DataGridViewLinkColumn^ links = gcnew DataGridViewLinkColumn(); - - links->UseColumnTextForLinkValue = true; - links->HeaderText = ColumnName::ReportsTo.ToString(); - links->DataPropertyName = ColumnName::ReportsTo.ToString(); - links->ActiveLinkColor = Color::White; - links->LinkBehavior = LinkBehavior::SystemDefault; - links->LinkColor = Color::Blue; - links->TrackVisitedState = true; - links->VisitedLinkColor = Color::YellowGreen; - - DataGridView1->Columns->Add(links); - } - // - - // -private: - void SetAlternateChoicesUsingItems( - DataGridViewComboBoxColumn^ comboboxColumn) - { - comboboxColumn->Items->AddRange("Mr.", "Ms.", "Mrs.", "Dr."); - } - - // -private: - DataGridViewComboBoxColumn^ CreateComboBoxColumn() - { - DataGridViewComboBoxColumn^ column = - gcnew DataGridViewComboBoxColumn(); - { - column->DataPropertyName = ColumnName::TitleOfCourtesy.ToString(); - column->HeaderText = ColumnName::TitleOfCourtesy.ToString(); - column->DropDownWidth = 160; - column->Width = 90; - column->MaxDropDownItems = 3; - column->FlatStyle = FlatStyle::Flat; - } - return column; - } - // - -private: - void SetAlternateChoicesUsingDataSource(DataGridViewComboBoxColumn^ comboboxColumn) - { - { - comboboxColumn->DataSource = RetrieveAlternativeTitles(); - comboboxColumn->ValueMember = ColumnName::TitleOfCourtesy.ToString(); - comboboxColumn->DisplayMember = comboboxColumn->ValueMember; - } - } - -private: - DataTable^ RetrieveAlternativeTitles() - { - return Populate("SELECT distinct TitleOfCourtesy FROM Employees"); - } - - String^ connectionString; - -private: - DataTable^ Populate(String^ sqlCommand) - { - SqlConnection^ northwindConnection = gcnew SqlConnection(connectionString); - northwindConnection->Open(); - - SqlCommand^ command = gcnew SqlCommand(sqlCommand, northwindConnection); - SqlDataAdapter^ adapter = gcnew SqlDataAdapter(); - adapter->SelectCommand = command; - - DataTable^ table = gcnew DataTable(); - adapter->Fill(table); - - return table; - } - - // Using an enum provides some abstraction between column index - // and column name along with compile time checking, and gives - // a handy place to store the column names. - enum class ColumnName - { - EmployeeID, - LastName, - FirstName, - Title, - TitleOfCourtesy, - BirthDate, - HireDate, - Address, - City, - Region, - PostalCode, - Country, - HomePhone, - Extension, - Photo, - Notes, - ReportsTo, - PhotoPath, - OutOfOffice - }; - // - - // -private: - void AddButtonColumn() - { - DataGridViewButtonColumn^ buttons = gcnew DataGridViewButtonColumn(); - { - buttons->HeaderText = "Sales"; - buttons->Text = "Sales"; - buttons->UseColumnTextForButtonValue = true; - buttons->AutoSizeMode = - DataGridViewAutoSizeColumnMode::AllCells; - buttons->FlatStyle = FlatStyle::Standard; - buttons->CellTemplate->Style->BackColor = Color::Honeydew; - buttons->DisplayIndex = 0; - } - - DataGridView1->Columns->Add(buttons); - - } - // - - // -private: - void AddOutOfOfficeColumn() - { - DataGridViewCheckBoxColumn^ column = gcnew DataGridViewCheckBoxColumn(); - { - column->HeaderText = ColumnName::OutOfOffice.ToString(); - column->Name = ColumnName::OutOfOffice.ToString(); - column->AutoSizeMode = - DataGridViewAutoSizeColumnMode::DisplayedCells; - column->FlatStyle = FlatStyle::Standard; - column->ThreeState = true; - column->CellTemplate = gcnew DataGridViewCheckBoxCell(); - column->CellTemplate->Style->BackColor = Color::Beige; - } - - DataGridView1->Columns->Insert(0, column); - } - // - -private: - void PopulateSales(DataGridViewCellEventArgs^ buttonClick) - { - - String^ employeeID = DataGridView1->Rows[buttonClick->RowIndex] - ->Cells[ColumnName::EmployeeID.ToString()]->Value->ToString(); - DataGridView2->DataSource = Populate("SELECT * FROM Orders WHERE EmployeeID = " + employeeID); - } - - #pragma region "SQL Error handling" - // -private: - void DataGridView1_DataError(Object^ sender, DataGridViewDataErrorEventArgs^ anError) - { - - MessageBox::Show("Error happened " + anError->Context.ToString()); - - if (anError->Context == DataGridViewDataErrorContexts::Commit) - { - MessageBox::Show("Commit error"); - } - if (anError->Context == DataGridViewDataErrorContexts::CurrentCellChange) - { - MessageBox::Show("Cell change"); - } - if (anError->Context == DataGridViewDataErrorContexts::Parsing) - { - MessageBox::Show("parsing error"); - } - if (anError->Context == DataGridViewDataErrorContexts::LeaveControl) - { - MessageBox::Show("leave control error"); - } - - if (dynamic_cast(anError->Exception) != nullptr) - { - DataGridView^ view = (DataGridView^)sender; - view->Rows[anError->RowIndex]->ErrorText = "an error"; - view->Rows[anError->RowIndex]->Cells[anError->ColumnIndex]->ErrorText = "an error"; - - anError->ThrowException = false; - } - } - // - #pragma endregion - - // -private: - void DataGridView1_CellContentClick(Object^ /*sender*/, DataGridViewCellEventArgs^ e) - { - - if (IsANonHeaderLinkCell(e)) - { - MoveToLinked(e); - } - else if (IsANonHeaderButtonCell(e)) - { - PopulateSales(e); - } - } - -private: - void MoveToLinked(DataGridViewCellEventArgs^ e) - { - String^ employeeId; - Object^ value = DataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex]->Value; - if (dynamic_cast(value) != nullptr) { return; } - - employeeId = value->ToString(); - DataGridViewCell^ boss = RetrieveSuperiorsLastNameCell(employeeId); - if (boss != nullptr) - { - DataGridView1->CurrentCell = boss; - } - } - -private: - bool IsANonHeaderLinkCell(DataGridViewCellEventArgs^ cellEvent) - { - if (dynamic_cast(DataGridView1->Columns[cellEvent->ColumnIndex]) != nullptr - && - cellEvent->RowIndex != -1) - { return true; } - else { return false; } - } - -private: - bool IsANonHeaderButtonCell(DataGridViewCellEventArgs^ cellEvent) - { - if (dynamic_cast(DataGridView1->Columns[cellEvent->ColumnIndex]) != nullptr - && - cellEvent->RowIndex != -1) - { return true; } - else { return (false); } - } - -private: - DataGridViewCell^ RetrieveSuperiorsLastNameCell(String^ employeeId) - { - - for each (DataGridViewRow^ row in DataGridView1->Rows) - { - if (row->IsNewRow) { return nullptr; } - if (row->Cells[ColumnName::EmployeeID.ToString()]->Value->ToString()->Equals(employeeId)) - { - return row->Cells[ColumnName::LastName.ToString()]; - } - } - return nullptr; - } - // - - #pragma region "checkbox state" - -private: - void DataGridView1_CellValuePushed(Object^ sender, - DataGridViewCellValueEventArgs^ e) - { - if (IsCheckBoxColumn(e->ColumnIndex)) - { - String^ employeeId = GetKey(e); - if (!inOffice->ContainsKey(employeeId)) - { - inOffice->Add(employeeId, (Boolean)e->Value); - } - else - { - inOffice[employeeId] = (Boolean)e->Value; - } - } - } - -private: - String^ GetKey(DataGridViewCellValueEventArgs^ cell) - { - return DataGridView1->Rows[cell->RowIndex]-> - Cells[ColumnName::EmployeeID.ToString()]->Value->ToString(); - } - -private: - void DataGridView1_CellValueNeeded(Object^ sender, - DataGridViewCellValueEventArgs^ e) - { - - if (IsCheckBoxColumn(e->ColumnIndex)) - { - String^ employeeId = GetKey(e); - if (!inOffice->ContainsKey(employeeId)) - { - bool defaultValue = false; - inOffice->Add(employeeId, defaultValue); - } - - e->Value = inOffice[employeeId]; - } - } - -private: - bool IsCheckBoxColumn(int columnIndex) - { - DataGridViewColumn^ outOfOfficeColumn = - DataGridView1->Columns[ColumnName::OutOfOffice.ToString()]; - return (DataGridView1->Columns[columnIndex] == outOfOfficeColumn); - } - #pragma endregion -}; - -int main() -{ - Employees::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp deleted file mode 100644 index 5d19346c731..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp +++ /dev/null @@ -1,96 +0,0 @@ -// -#using -#using -#using -using namespace System; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::Windows::Forms; - -public enum class LightStatus -{ - Unknown, - TurnedOn, - TurnedOff -}; - -public ref class TriValueVirtualCheckBox: public Form -{ -private: - DataGridView^ dataGridView1; - -private: - const int initialSize; - -private: - Dictionary^ store; - -public: - TriValueVirtualCheckBox() : Form(), initialSize(500) - { - dataGridView1 = gcnew DataGridView(); - store = gcnew Dictionary(); - Text = this->GetType()->Name; - - for(int i = 0; i < initialSize; i++) - { - store->Add(i, LightStatus::Unknown); - } - - Controls->Add(dataGridView1); - dataGridView1->VirtualMode = true; - dataGridView1->AllowUserToDeleteRows = false; - dataGridView1->CellValueNeeded += - gcnew DataGridViewCellValueEventHandler( - this, &TriValueVirtualCheckBox::dataGridView1_CellValueNeeded); - dataGridView1->CellValuePushed += - gcnew DataGridViewCellValueEventHandler( - this, &TriValueVirtualCheckBox::dataGridView1_CellValuePushed); - - dataGridView1->Columns->Add(CreateCheckBoxColumn()); - dataGridView1->Rows->AddCopies(0, initialSize); - } - - // -private: - DataGridViewCheckBoxColumn^ CreateCheckBoxColumn() - { - DataGridViewCheckBoxColumn^ dataGridViewCheckBoxColumn1 - = gcnew DataGridViewCheckBoxColumn(); - dataGridViewCheckBoxColumn1->HeaderText = "Lights On"; - dataGridViewCheckBoxColumn1->TrueValue = LightStatus::TurnedOn; - dataGridViewCheckBoxColumn1->FalseValue = - LightStatus::TurnedOff; - dataGridViewCheckBoxColumn1->IndeterminateValue - = LightStatus::Unknown; - dataGridViewCheckBoxColumn1->ThreeState = true; - dataGridViewCheckBoxColumn1->ValueType = LightStatus::typeid; - return dataGridViewCheckBoxColumn1; - } - // - -#pragma region "data store maintance" -private: - void dataGridView1_CellValueNeeded(Object^ sender, - DataGridViewCellValueEventArgs^ e) - { - e->Value = store[e->RowIndex]; - } - -private: - void dataGridView1_CellValuePushed(Object^ sender, - DataGridViewCellValueEventArgs^ e) - { - store[e->RowIndex] = (LightStatus) e->Value; - } -#pragma endregion - -}; - -[STAThread] -int main() -{ - Application::Run(gcnew TriValueVirtualCheckBox()); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp deleted file mode 100644 index d8bd7ed7939..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp +++ /dev/null @@ -1,210 +0,0 @@ - -// -#using -#using -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Data::SqlClient; -using namespace System::Drawing; -using namespace System::Windows::Forms; -ref class SharedRows: public Form -{ -private: - DataGridView^ dataGridView1; - Label^ counterLabel; - Label^ description; - FlowLayoutPanel^ leftToRight; - FlowLayoutPanel^ topToBottom; - -public: - SharedRows() - { - dataGridView1 = gcnew DataGridView; - counterLabel = gcnew Label; - description = gcnew Label; - leftToRight = gcnew FlowLayoutPanel; - topToBottom = gcnew FlowLayoutPanel; - wholeTable = gcnew ToolStripMenuItem; - lookUp = gcnew ToolStripMenuItem; - count = gcnew Label; - this->Load += gcnew EventHandler( this, &SharedRows::SharedRows_Load ); - this->AutoSize = true; - this->Controls->Add( topToBottom ); - } - - static void Main() - { - Application::Run( gcnew SharedRows ); - } - - -private: - void SharedRows_Load( Object^ /*ignored*/, EventArgs^ /*e*/ ) - { - counterLabel->Text = L"Unshared Rows: "; - counterLabel->AutoSize = true; - count->AutoSize = true; - description->MaximumSize = System::Drawing::Size( 600, 300 ); - description->AutoSize = true; - description->Text = L"Try out the contextual menu, and hovering over the cells in the 'ReportsTo' column. " - L"Notice what happens when trying to lookup a picture cell. " - L"Row unsharing is minimized through the use of events."; - leftToRight->FlowDirection = FlowDirection::LeftToRight; - leftToRight->Controls->AddRange( gcnew array{ - dataGridView1,counterLabel,count - } ); - leftToRight->AutoSize = true; - topToBottom->FlowDirection = FlowDirection::TopDown; - topToBottom->AutoSize = true; - topToBottom->Controls->AddRange( gcnew array{ - leftToRight,description - } ); - dataGridView1->MaximumSize = System::Drawing::Size( 500, 300 ); - dataGridView1->AutoSize = true; - dataGridView1->MultiSelect = false; - dataGridView1->ReadOnly = true; - dataGridView1->SelectionMode = DataGridViewSelectionMode::CellSelect; - dataGridView1->AllowUserToAddRows = false; - dataGridView1->AllowUserToDeleteRows = false; - wholeTable->Click += gcnew EventHandler( this, &SharedRows::wholeTable_Click ); - lookUp->Click += gcnew EventHandler( this, &SharedRows::lookUp_Click ); - dataGridView1->RowUnshared += gcnew DataGridViewRowEventHandler( this, &SharedRows::dataGridView1_RowUnshared ); - dataGridView1->CellMouseEnter += gcnew DataGridViewCellEventHandler( this, &SharedRows::dataGridView1_CellMouseEnter ); - dataGridView1->CellErrorTextNeeded += gcnew DataGridViewCellErrorTextNeededEventHandler( this, &SharedRows::dataGridView1_CellErrorTextNeeded ); - dataGridView1->CellContextMenuStripNeeded += gcnew DataGridViewCellContextMenuStripNeededEventHandler( this, &SharedRows::dataGridView1_CellContextMenuStripNeeded ); - dataGridView1->CellToolTipTextNeeded += gcnew DataGridViewCellToolTipTextNeededEventHandler( this, &SharedRows::dataGridView1_CellToolTipTextNeeded ); - dataGridView1->DataSource = Populate( L"Select * from employees", true ); - } - - - // - // - // - ToolStripMenuItem^ wholeTable; - ToolStripMenuItem^ lookUp; - System::Windows::Forms::ContextMenuStrip^ strip; - String^ cellErrorText; - - void dataGridView1_CellContextMenuStripNeeded( Object^ /*sender*/, - DataGridViewCellContextMenuStripNeededEventArgs^ e ) - { - cellErrorText = String::Empty; - if ( strip == nullptr ) - { - strip = gcnew System::Windows::Forms::ContextMenuStrip; - lookUp->Text = L"Look Up"; - wholeTable->Text = L"See Whole Table"; - strip->Items->Add( lookUp ); - strip->Items->Add( wholeTable ); - } - - e->ContextMenuStrip = strip; - } - - void wholeTable_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - dataGridView1->DataSource = Populate( L"Select * from employees", true ); - } - - DataGridViewCellEventArgs^ theCellImHoveringOver; - void dataGridView1_CellMouseEnter( Object^ /*sender*/, DataGridViewCellEventArgs^ e ) - { - theCellImHoveringOver = e; - } - - DataGridViewCellEventArgs^ cellErrorLocation; - void lookUp_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - dataGridView1->DataSource = Populate( String::Format( L"Select * from employees where {0} = '{1}'", dataGridView1->Columns[ theCellImHoveringOver->ColumnIndex ]->Name, dataGridView1->Rows[ theCellImHoveringOver->RowIndex ]->Cells[ theCellImHoveringOver->ColumnIndex ]->Value ), true ); - } - catch ( ... ) - { - cellErrorText = L"Can't look this cell up"; - cellErrorLocation = theCellImHoveringOver; - } - - } - - void dataGridView1_CellErrorTextNeeded( Object^ /*sender*/, DataGridViewCellErrorTextNeededEventArgs^ e ) - { - if ( cellErrorLocation != nullptr ) - { - if ( e->ColumnIndex == cellErrorLocation->ColumnIndex && e->RowIndex == cellErrorLocation->RowIndex ) - { - e->ErrorText = cellErrorText; - } - } - } - - // - DataTable^ Populate( String^ query, bool resetUnsharedCounter ) - { - if ( resetUnsharedCounter ) - { - ResetCounter(); - } - - - // Alter the data source as necessary - SqlDataAdapter^ adapter = gcnew SqlDataAdapter( query, - gcnew SqlConnection( L"Integrated Security=SSPI;Persist Security Info=False;" - L"Initial Catalog=Northwind;Data Source= localhost" ) ); - DataTable^ table = gcnew DataTable; - adapter->Fill( table ); - return table; - } - - Label^ count; - int unsharedRowCounter; - void ResetCounter() - { - unsharedRowCounter = 0; - count->Text = unsharedRowCounter.ToString(); - } - // - // - // - - void dataGridView1_CellToolTipTextNeeded( Object^ /*sender*/, - DataGridViewCellToolTipTextNeededEventArgs^ e ) - { - if ( theCellImHoveringOver->ColumnIndex == dataGridView1->Columns[ L"ReportsTo" ]->Index && theCellImHoveringOver->RowIndex > -1 ) - { - String^ reportsTo = dataGridView1->Rows[ theCellImHoveringOver->RowIndex ]->Cells[ theCellImHoveringOver->ColumnIndex ]->Value->ToString(); - if ( reportsTo->Equals( L"" ) ) - { - e->ToolTipText = L"The buck stops here!"; - } - else - { - DataTable^ table = Populate( String::Format( L"select firstname, lastname from employees where employeeid = '{0}'", - dataGridView1->Rows[ theCellImHoveringOver->RowIndex ]->Cells[ theCellImHoveringOver->ColumnIndex ]->Value ), false ); - e->ToolTipText = String::Format( L"Reports to {0} {1}", table->Rows[ 0 ]->ItemArray[ 0 ], table->Rows[ 0 ]->ItemArray[ 1 ] ); - } - } - } - - - // - void dataGridView1_RowUnshared( Object^ /*sender*/, DataGridViewRowEventArgs^ /*row*/ ) - { - unsharedRowCounter += 1; - count->Text = unsharedRowCounter.ToString(); - } - -}; - -int main() -{ - SharedRows::Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp deleted file mode 100644 index 3000d7877b4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp +++ /dev/null @@ -1,118 +0,0 @@ - - -#using -#using -#using - -// This example demonstrates using the read-only fields DateTimePicker.MaxDateTime -// and DateTimePicker.MinDateTime. -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeDateTimePicker(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::ToolTip^ ToolTip1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->ToolTip1 = gcnew System::Windows::Forms::ToolTip( this->components ); - this->SuspendLayout(); - - // - //DateTimePicker1 - // - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -internal: - // Declare the DateTimePicker. - System::Windows::Forms::DateTimePicker^ DateTimePicker1; - -private: - void InitializeDateTimePicker() - { - // Construct the DateTimePicker. - this->DateTimePicker1 = gcnew System::Windows::Forms::DateTimePicker; - - //Set size and location. - this->DateTimePicker1->Location = System::Drawing::Point( 40, 88 ); - this->DateTimePicker1->Size = System::Drawing::Size( 160, 21 ); - - // Set the alignment of the drop-down MonthCalendar to right. - this->DateTimePicker1->DropDownAlign = LeftRightAlignment::Right; - - // Set the Value property to 50 years before today. - DateTimePicker1->Value = System::DateTime::Now.AddYears( -50 ); - - //Set a custom format containing the string "of the year" - DateTimePicker1->Format = DateTimePickerFormat::Custom; - DateTimePicker1->CustomFormat = "MMM dd, 'of the year' yyyy "; - - // Add the DateTimePicker to the form. - this->Controls->Add( this->DateTimePicker1 ); - } - // - - // - // When the calendar drops down, display a MessageBox indicating - // that DateTimePicker will not accept dates before MinDateTime or - // after MaxDateTime. Use a StringBuilder object to build the string - // for efficiency. - void DateTimePicker1_DropDown( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - System::Text::StringBuilder^ messageBuilder = gcnew System::Text::StringBuilder; - messageBuilder->Append( "Choose a date after: " ); - messageBuilder->Append( DateTimePicker::MinDateTime.ToShortDateString() ); - messageBuilder->Append( " and a date before: " ); - messageBuilder->Append( DateTimePicker::MaxDateTime.ToShortDateString() ); - MessageBox::Show( messageBuilder->ToString() ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp deleted file mode 100644 index dc5fa84a787..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Windows::Forms::Design::Behavior; -using namespace System::Text; - -namespace BehaviorServiceSample -{ - - public ref class UserControl1 : public UserControl - { - private: - System::ComponentModel::IContainer^ components; - - public: - UserControl1() - { - InitializeComponent(); - } - - protected: - ~UserControl1() - { - if (components != nullptr) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->Name = "UserControl1"; - this->Size = System::Drawing::Size(170, 156); - } - }; - - public ref class Form1 : public Form - { - private: - UserControl1^ userControl; - - public: - Form1() - { - InitializeComponent(); - } - - private: - System::ComponentModel::IContainer^ components; - - protected: - ~Form1() - { - if (components != nullptr) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->userControl = gcnew UserControl1(); - this->SuspendLayout(); - - this->userControl->Location = System::Drawing::Point(12,13); - this->userControl->Name = "userControl"; - this->userControl->Size = System::Drawing::Size(143,110); - this->userControl->TabIndex = 0; - - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(184, 153); - this->Controls->Add(this->userControl); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout(false); - } - }; - - // - - // By providing our own behavior we can do something - // interesting when the user clicks or manipulates our glyph. - // - public ref class DemoBehavior : public Behavior - { - public: - bool OnMouseUp(Glyph^ g, MouseButtons^ button) - { - MessageBox::Show("Hey, you clicked the mouse here"); - - // indicating we processed this event. - return true; - } - }; - // - - public ref class DemoGlyph : public Glyph - { - Control^ control; - BehaviorService^ behavior; - - // - public: - DemoGlyph(BehaviorService^ behavior, Control^ control): - Glyph(gcnew BehaviorServiceSample::DemoBehavior) - { - this->behavior = behavior; - this->control = control; - } - // - - // - public: - virtual property Rectangle Bounds - { - Rectangle get() override - { - // Create a glyph that is 10x10 and sitting - // in the middle of the control. Glyph coordinates - // are in adorner window coordinates, so we must map - // using the behavior service. - Point edge = behavior->ControlToAdornerWindow(control); - Size size = control->Size; - Point center = Point(edge.X + (size.Width / 2), - edge.Y + (size.Height / 2)); - - Rectangle bounds = Rectangle(center.X - 5, - center.Y - 5, 10, 10); - - return bounds; - } - } - // - - // - public: - virtual Cursor^ GetHitTest(Point p) override - { - // GetHitTest is called to see if the point is - // within this glyph. This gives us a chance to decide - // what cursor to show. Returning null from here means - // the mouse pointer is not currently inside of the - // glyph. Returning a valid cursor here indicates the - // pointer is inside the glyph, and also enables our - // Behavior property as the active behavior. - if (Bounds.Contains(p)) - { - return Cursors::Hand; - } - return nullptr; - } - // - - // - public: - virtual void Paint(PaintEventArgs^ pe) override - { - // Draw our glyph. Our's is simple: a blue ellipse. - pe->Graphics->FillEllipse(Brushes::Blue, Bounds); - } - // - }; - - // - - // - public ref class DemoDesigner : public ControlDesigner - { - private: - Adorner^ demoAdorner; - - protected: - ~DemoDesigner() - { - if (demoAdorner != nullptr) - { - System::Windows::Forms::Design::Behavior::BehaviorService^ b = - this->BehaviorService; - if (b != nullptr) - { - b->Adorners->Remove(demoAdorner); - } - } - } - - public: - virtual void Initialize(IComponent^ component) override - { - __super::Initialize(component); - - // Get a hold of the behavior service and add our own set - // of glyphs. Glyphs live on adorners. - // - // - demoAdorner = gcnew Adorner(); - BehaviorService->Adorners->Add(demoAdorner); - // - demoAdorner->Glyphs->Add - (gcnew DemoGlyph(BehaviorService, Control)); - // - } - }; - // -} - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew BehaviorServiceSample::Form1()); -} - - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp deleted file mode 100644 index 0fe16853de4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp +++ /dev/null @@ -1,215 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::Label ^ label4; - System::Windows::Forms::Label ^ label5; - System::Windows::Forms::Label ^ label6; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::TextBox^ nameTextBox1; - System::Windows::Forms::NumericUpDown^ ageUpDownPicker; - System::Windows::Forms::ComboBox^ favoriteColorComboBox; - System::Windows::Forms::ErrorProvider^ ageErrorProvider; - System::Windows::Forms::ErrorProvider^ nameErrorProvider; - System::Windows::Forms::ErrorProvider^ favoriteColorErrorProvider; - -public: - Form1() - { - this->nameTextBox1 = gcnew System::Windows::Forms::TextBox; - this->label1 = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->ageUpDownPicker = gcnew System::Windows::Forms::NumericUpDown; - this->favoriteColorComboBox = gcnew System::Windows::Forms::ComboBox; - this->label3 = gcnew System::Windows::Forms::Label; - this->label4 = gcnew System::Windows::Forms::Label; - this->label5 = gcnew System::Windows::Forms::Label; - this->label6 = gcnew System::Windows::Forms::Label; - - // Name Label - this->label1->Location = System::Drawing::Point( 56, 32 ); - this->label1->Size = System::Drawing::Size( 40, 23 ); - this->label1->Text = "Name:"; - - // Age Label - this->label2->Location = System::Drawing::Point( 40, 64 ); - this->label2->Size = System::Drawing::Size( 56, 23 ); - this->label2->Text = "Age (3-5)"; - - // Favorite Color Label - this->label3->Location = System::Drawing::Point( 24, 96 ); - this->label3->Size = System::Drawing::Size( 80, 24 ); - this->label3->Text = "Favorite color"; - - // ErrorBlinkStyle::AlwaysBlink Label - this->label4->Location = System::Drawing::Point( 264, 32 ); - this->label4->Size = System::Drawing::Size( 160, 23 ); - this->label4->Text = "ErrorBlinkStyle::AlwaysBlink"; - - // ErrorBlinkStyle::BlinkIfDifferentError Label - this->label5->Location = System::Drawing::Point( 264, 64 ); - this->label5->Size = System::Drawing::Size( 200, 23 ); - this->label5->Text = "ErrorBlinkStyle::BlinkIfDifferentError"; - - // ErrorBlinkStyle::NeverBlink Label - this->label6->Location = System::Drawing::Point( 264, 96 ); - this->label6->Size = System::Drawing::Size( 200, 23 ); - this->label6->Text = "ErrorBlinkStyle::NeverBlink"; - - // Name TextBox - this->nameTextBox1->Location = System::Drawing::Point( 112, 32 ); - this->nameTextBox1->Size = System::Drawing::Size( 120, 20 ); - this->nameTextBox1->TabIndex = 0; - this->nameTextBox1->Validated += gcnew System::EventHandler( this, &Form1::nameTextBox1_Validated ); - - // Age NumericUpDown - this->ageUpDownPicker->Location = System::Drawing::Point( 112, 64 ); - array^temp0 = {150,0,0,0}; - this->ageUpDownPicker->Maximum = System::Decimal( temp0 ); - this->ageUpDownPicker->TabIndex = 4; - this->ageUpDownPicker->Validated += gcnew System::EventHandler( this, &Form1::ageUpDownPicker_Validated ); - - // Favorite Color ComboBox - array^temp1 = {"None","Red","Yellow","Green","Blue","Purple"}; - this->favoriteColorComboBox->Items->AddRange( temp1 ); - this->favoriteColorComboBox->Location = System::Drawing::Point( 112, 96 ); - this->favoriteColorComboBox->Size = System::Drawing::Size( 120, 21 ); - this->favoriteColorComboBox->TabIndex = 5; - this->favoriteColorComboBox->Validated += gcnew System::EventHandler( this, &Form1::favoriteColorComboBox_Validated ); - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 464, 150 ); - array^temp2 = {this->label6,this->label5,this->label4,this->label3,this->favoriteColorComboBox,this->ageUpDownPicker,this->label2,this->label1,this->nameTextBox1}; - this->Controls->AddRange( temp2 ); - this->Text = "Error Provider Example"; - - // - // Create and set the ErrorProvider for each data entry control. - nameErrorProvider = gcnew System::Windows::Forms::ErrorProvider; - nameErrorProvider->SetIconAlignment( this->nameTextBox1, ErrorIconAlignment::MiddleRight ); - nameErrorProvider->SetIconPadding( this->nameTextBox1, 2 ); - nameErrorProvider->BlinkRate = 1000; - nameErrorProvider->BlinkStyle = System::Windows::Forms::ErrorBlinkStyle::AlwaysBlink; - ageErrorProvider = gcnew System::Windows::Forms::ErrorProvider; - ageErrorProvider->SetIconAlignment( this->ageUpDownPicker, ErrorIconAlignment::MiddleRight ); - ageErrorProvider->SetIconPadding( this->ageUpDownPicker, 2 ); - ageErrorProvider->BlinkStyle = System::Windows::Forms::ErrorBlinkStyle::BlinkIfDifferentError; - favoriteColorErrorProvider = gcnew System::Windows::Forms::ErrorProvider; - favoriteColorErrorProvider->SetIconAlignment( this->favoriteColorComboBox, ErrorIconAlignment::MiddleRight ); - favoriteColorErrorProvider->SetIconPadding( this->favoriteColorComboBox, 2 ); - favoriteColorErrorProvider->BlinkRate = 1000; - favoriteColorErrorProvider->BlinkStyle = System::Windows::Forms::ErrorBlinkStyle::NeverBlink; - // - } - - -private: - - // - void nameTextBox1_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( IsNameValid() ) - { - - // Clear the error, if any, in the error provider. - nameErrorProvider->SetError( this->nameTextBox1, String.Empty ); - } - else - { - - // Set the error if the name is not valid. - nameErrorProvider->SetError( this->nameTextBox1, "Name is required." ); - } - } - - void ageUpDownPicker_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( IsAgeTooYoung() ) - { - - // Set the error if the age is too young. - ageErrorProvider->SetError( this->ageUpDownPicker, "Age not old enough" ); - } - else - if ( IsAgeTooOld() ) - { - - // Set the error if the age is too old. - ageErrorProvider->SetError( this->ageUpDownPicker, "Age is too old" ); - } - else - { - - // Clear the error, if any, in the error provider. - ageErrorProvider->SetError( this->ageUpDownPicker, String.Empty ); - } - } - - void favoriteColorComboBox_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( !IsColorValid() ) - { - - // Set the error if the favorite color is not valid. - favoriteColorErrorProvider->SetError( this->favoriteColorComboBox, "Must select a color." ); - } - else - { - - // Clear the error, if any, in the error provider. - favoriteColorErrorProvider->SetError( this->favoriteColorComboBox, String.Empty ); - } - } - - - // - // Functions to verify data. - bool IsNameValid() - { - - // Determine whether the text box contains a zero-length String*. - return (nameTextBox1->Text->Length > 0); - } - - bool IsAgeTooYoung() - { - - // Determine whether the age value is less than three. - return (ageUpDownPicker->Value < 3); - } - - bool IsAgeTooOld() - { - - // Determine whether the age value is greater than five. - return (ageUpDownPicker->Value > 5); - } - - bool IsColorValid() - { - - // Determine whether the favorite color has a valid value. - return ((favoriteColorComboBox->SelectedItem != 0) && ( !favoriteColorComboBox->SelectedItem->Equals( "None" ))); - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp deleted file mode 100644 index 41281581451..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp +++ /dev/null @@ -1,203 +0,0 @@ -// The following code example demonstrates using -// the following members: LostFocus, OpenFileDialog.Multiselect, -// FileNames, Title, ErrorProvider.GetError, PictureBox.Image, -// Application.DoEvents, and System.Drawing.Image.FromStream. - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializePictureBox(); - InitializeOpenFileDialog(); - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Button1 = gcnew System::Windows::Forms::Button; - this->ErrorProvider1 = gcnew System::Windows::Forms::ErrorProvider; - this->Label2 = gcnew System::Windows::Forms::Label; - this->fileButton = gcnew Button; - - this->SuspendLayout(); - this->OpenFileDialog1->Filter = "Images " + - "(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"; - this->OpenFileDialog1->Multiselect = true; - this->OpenFileDialog1->Title = "My Image Browser"; - this->TextBox1->Location = System::Drawing::Point( 16, 56 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 150, 20 ); - this->TextBox1->TabIndex = 2; - this->TextBox1->Text = ""; - this->Button1->Location = System::Drawing::Point( 184, 48 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 88, 32 ); - this->Button1->TabIndex = 1; - this->Button1->Text = "Find pictures"; - this->fileButton->Location = System::Drawing::Point( 80, 40 ); - this->fileButton->Name = "fileButton"; - this->fileButton->TabIndex = 0; - this->fileButton->Text = "Button2"; - this->ErrorProvider1->ContainerControl = this; - this->Label2->Location = System::Drawing::Point( 24, 34 ); - this->Label2->Name = "Label2"; - this->Label2->Size = System::Drawing::Size( 150, 23 ); - this->Label2->TabIndex = 5; - this->Label2->Text = "Enter image file directory:"; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->PictureBox1 ); - this->Controls->Add( this->Label2 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - - this->Button1->Click += gcnew System::EventHandler( - this, &Form1::Button1_Click ); - this->fileButton->Click += gcnew System::EventHandler( - this, &Form1::fileButton_Click ); - this->TextBox1->LostFocus += gcnew System::EventHandler( - this, &Form1::TextBox1_LostFocus ); - this->TextBox1->Validating += gcnew System::ComponentModel::CancelEventHandler( - this, &Form1::TextBox1_Validating ); - - // Associate the event-handling method with the FileOk - // event. - this->OpenFileDialog1->FileOk += - gcnew System::ComponentModel::CancelEventHandler( - this, &Form1::OpenFileDialog1_FileOk ); - } - -internal: - System::Windows::Forms::OpenFileDialog^ OpenFileDialog1; - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::ErrorProvider^ ErrorProvider1; - System::Windows::Forms::Label ^ Label2; - System::Windows::Forms::Button^ fileButton; - System::Windows::Forms::PictureBox^ PictureBox1; - - // - // -private: - void TextBox1_Validating( Object^ sender, - System::ComponentModel::CancelEventArgs^ e ) - { - // If nothing is entered, - // an ArgumentException is caught; if an invalid directory is entered, - // a DirectoryNotFoundException is caught. An appropriate error message - // is displayed in either case. - try - { - System::IO::DirectoryInfo^ directory = gcnew System::IO::DirectoryInfo( TextBox1->Text ); - directory->GetFiles(); - ErrorProvider1->SetError( TextBox1, "" ); - } - catch ( System::ArgumentException^ ) - { - ErrorProvider1->SetError( TextBox1, "Please enter a directory" ); - } - catch ( System::IO::DirectoryNotFoundException^ ) - { - ErrorProvider1->SetError( TextBox1, "The directory does not exist." - "Try again with a different directory." ); - } - } - // - - // This method handles the LostFocus event for TextBox1 by setting the - // dialog's InitialDirectory property to the text in TextBox1. - void TextBox1_LostFocus( Object^ sender, System::EventArgs^ e ) - { - OpenFileDialog1->InitialDirectory = TextBox1->Text; - } - - // This method demonstrates using the ErrorProvider.GetError method - // to check for an error before opening the dialog box. - void Button1_Click( System::Object^ sender, System::EventArgs^ e ) - { - //If there is no error, then open the dialog box. - if ( ErrorProvider1->GetError( TextBox1 )->Equals( "" ) ) - { - ::DialogResult dialogResult = OpenFileDialog1->ShowDialog(); - } - } - // - - // These methods demonstrate the handling of the FileOk event and the - // use of the Application.DoEvents method. - // A user selects graphics files from an OpenFileDialog object. - // The files are displayed in the form. The Application.DoEvents - // method forces a repaint of the form for each graphics file opened. - // - void InitializePictureBox() - { - this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; - this->PictureBox1->BorderStyle = - System::Windows::Forms::BorderStyle::FixedSingle; - this->PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; - this->PictureBox1->Location = System::Drawing::Point( 72, 112 ); - this->PictureBox1->Name = "PictureBox1"; - this->PictureBox1->Size = System::Drawing::Size( 160, 136 ); - this->PictureBox1->TabIndex = 6; - this->PictureBox1->TabStop = false; - } - - // - void InitializeOpenFileDialog() - { - this->OpenFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog; - - // Set the file dialog to filter for graphics files. - this->OpenFileDialog1->Filter = - "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|" + - "All files (*.*)|*.*"; - - // Allow the user to select multiple images. - this->OpenFileDialog1->Multiselect = true; - this->OpenFileDialog1->Title = "My Image Browser"; - } - - void fileButton_Click( System::Object^ sender, System::EventArgs^ e ) - { - OpenFileDialog1->ShowDialog(); - } - // - - // This method handles the FileOK event. It opens each file - // selected and loads the image from a stream into PictureBox1. - void OpenFileDialog1_FileOk( Object^ sender, - System::ComponentModel::CancelEventArgs^ e ) - { - this->Activate(); - array^ files = OpenFileDialog1->FileNames; - - // Open each file and display the image in PictureBox1. - // Call Application.DoEvents to force a repaint after each - // file is read. - for each ( String^ file in files ) - { - System::IO::FileInfo^ fileInfo = gcnew System::IO::FileInfo( file ); - System::IO::FileStream^ fileStream = fileInfo->OpenRead(); - PictureBox1->Image = System::Drawing::Image::FromStream( fileStream ); - Application::DoEvents(); - fileStream->Close(); - - // Call Sleep so the picture is briefly displayed, - //which will create a slide-show effect. - System::Threading::Thread::Sleep( 2000 ); - } - PictureBox1->Image = nullptr; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp deleted file mode 100644 index 21c9a54c6aa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp +++ /dev/null @@ -1,243 +0,0 @@ -// - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -// - -public ref class Form1 : public System::Windows::Forms::Form -{ - // -private: - void wrapContentsCheckBox_CheckedChanged( - System::Object^ sender, System::EventArgs^ e) - { - this->flowLayoutPanel1->WrapContents = - this->wrapContentsCheckBox->Checked; - } - // - - // -private: - void flowTopDownBtn_CheckedChanged(System::Object^ sender, - System::EventArgs^ e) - { - this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; - } - -private: - void flowBottomUpBtn_CheckedChanged(System::Object^ sender, - System::EventArgs^ e) - { - this->flowLayoutPanel1->FlowDirection = FlowDirection::BottomUp; - } - -private: - void flowLeftToRight_CheckedChanged(System::Object^ sender, - System::EventArgs^ e) - { - this->flowLayoutPanel1->FlowDirection = - FlowDirection::LeftToRight; - } - -private: - void flowRightToLeftBtn_CheckedChanged( - System::Object^ sender, System::EventArgs^ e) - { - this->flowLayoutPanel1->FlowDirection = - FlowDirection::RightToLeft; - } - // - -#pragma region " Windows Form Designer generated code " - -public: - Form1(void) - { - - // This call is required by the Windows Form Designer. - InitializeComponent(); - - // Add any initialization after the InitializeComponent() - // call - - } - - // Form overrides dispose to clean up the component list. -protected: - ~Form1() - { - if (components != nullptr) - { - delete components; - } - } - -private: - System::Windows::Forms::FlowLayoutPanel^ flowLayoutPanel1; -private: - System::Windows::Forms::CheckBox^ wrapContentsCheckBox; -private: - System::Windows::Forms::RadioButton^ flowTopDownBtn; -private: - System::Windows::Forms::RadioButton^ flowBottomUpBtn; -private: - System::Windows::Forms::RadioButton^ flowLeftToRight; -private: - System::Windows::Forms::RadioButton^ flowRightToLeftBtn; -private: - System::Windows::Forms::Button^ button1; -private: - System::Windows::Forms::Button^ button2; -private: - System::Windows::Forms::Button^ button3; -private: - System::Windows::Forms::Button^ button4; - - // Required by the Windows Form Designer -private: - System::ComponentModel::IContainer^ components; - - // NOTE: The following procedure is required by the Windows Form - // Designer - // It can be modified using the Windows Form Designer. - // Do not modify it using the code editor. -private: - [System::Diagnostics::DebuggerNonUserCode] - void InitializeComponent() - { - this->flowLayoutPanel1 = - gcnew System::Windows::Forms::FlowLayoutPanel(); - this->button1 = gcnew System::Windows::Forms::Button(); - this->button2 = gcnew System::Windows::Forms::Button(); - this->button3 = gcnew System::Windows::Forms::Button(); - this->button4 = gcnew System::Windows::Forms::Button(); - this->wrapContentsCheckBox = - gcnew System::Windows::Forms::CheckBox(); - this->flowTopDownBtn = gcnew System::Windows::Forms::RadioButton(); - this->flowBottomUpBtn = - gcnew System::Windows::Forms::RadioButton(); - this->flowLeftToRight = - gcnew System::Windows::Forms::RadioButton(); - this->flowRightToLeftBtn = - gcnew System::Windows::Forms::RadioButton(); - this->flowLayoutPanel1->SuspendLayout(); - this->SuspendLayout(); - // - // flowLayoutPanel1 - // - this->flowLayoutPanel1->Controls->Add(this->button1); - this->flowLayoutPanel1->Controls->Add(this->button2); - this->flowLayoutPanel1->Controls->Add(this->button3); - this->flowLayoutPanel1->Controls->Add(this->button4); - this->flowLayoutPanel1->Location = - System::Drawing::Point(47, 55); - this->flowLayoutPanel1->Name = "flowLayoutPanel1"; - this->flowLayoutPanel1->TabIndex = 0; - // - // button1 - // - this->button1->Location = System::Drawing::Point(3, 3); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - // - // button2 - // - this->button2->Location = System::Drawing::Point(84, 3); - this->button2->Name = "button2"; - this->button2->TabIndex = 1; - this->button2->Text = "button2"; - // - // button3 - // - this->button3->Location = System::Drawing::Point(3, 32); - this->button3->Name = "button3"; - this->button3->TabIndex = 2; - this->button3->Text = "button3"; - // - // button4 - // - this->button4->Location = System::Drawing::Point(84, 32); - this->button4->Name = "button4"; - this->button4->TabIndex = 3; - this->button4->Text = "button4"; - // - // wrapContentsCheckBox - // - this->wrapContentsCheckBox->Location = - System::Drawing::Point(46, 162); - this->wrapContentsCheckBox->Name = "wrapContentsCheckBox"; - this->wrapContentsCheckBox->TabIndex = 1; - this->wrapContentsCheckBox->Text = "Wrap Contents"; - this->wrapContentsCheckBox->CheckedChanged += - gcnew System::EventHandler( - this, &Form1::wrapContentsCheckBox_CheckedChanged); - // - // flowTopDownBtn - // - this->flowTopDownBtn->Location = - System::Drawing::Point(45, 193); - this->flowTopDownBtn->Name = "flowTopDownBtn"; - this->flowTopDownBtn->TabIndex = 2; - this->flowTopDownBtn->Text = "Flow TopDown"; - this->flowTopDownBtn->CheckedChanged += - gcnew System::EventHandler( - this, &Form1::flowTopDownBtn_CheckedChanged); - // - // flowBottomUpBtn - // - this->flowBottomUpBtn->Location = - System::Drawing::Point(44, 224); - this->flowBottomUpBtn->Name = "flowBottomUpBtn"; - this->flowBottomUpBtn->TabIndex = 3; - this->flowBottomUpBtn->Text = "Flow BottomUp"; - this->flowBottomUpBtn->CheckedChanged += - gcnew System::EventHandler( - this, &Form1::flowBottomUpBtn_CheckedChanged); - // - // flowLeftToRight - // - this->flowLeftToRight->Location = - System::Drawing::Point(156, 193); - this->flowLeftToRight->Name = "flowLeftToRight"; - this->flowLeftToRight->TabIndex = 4; - this->flowLeftToRight->Text = "Flow LeftToRight"; - this->flowLeftToRight->CheckedChanged += - gcnew System::EventHandler( - this, &Form1::flowLeftToRight_CheckedChanged); - // - // flowRightToLeftBtn - // - this->flowRightToLeftBtn->Location = - System::Drawing::Point(155, 224); - this->flowRightToLeftBtn->Name = "flowRightToLeftBtn"; - this->flowRightToLeftBtn->TabIndex = 5; - this->flowRightToLeftBtn->Text = "Flow RightToLeft"; - this->flowRightToLeftBtn->CheckedChanged += - gcnew System::EventHandler( - this, &Form1::flowRightToLeftBtn_CheckedChanged); - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(292, 266); - this->Controls->Add(this->flowRightToLeftBtn); - this->Controls->Add(this->flowLeftToRight); - this->Controls->Add(this->flowBottomUpBtn); - this->Controls->Add(this->flowTopDownBtn); - this->Controls->Add(this->wrapContentsCheckBox); - this->Controls->Add(this->flowLayoutPanel1); - this->Name = "Form1"; - this->Text = "Form1"; - this->flowLayoutPanel1->ResumeLayout(false); - this->ResumeLayout(false); - } - -#pragma endregion -}; -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp deleted file mode 100644 index 48a64a5dc48..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp +++ /dev/null @@ -1,167 +0,0 @@ - - -// -// The following example displays an application that provides the ability to -// open rich text files (rtf) into the RichTextBox. The example demonstrates -// using the FolderBrowserDialog to set the default directory for opening files. -// The OpenFileDialog is used to open the file. -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::IO; -public ref class FolderBrowserDialogExampleForm: public System::Windows::Forms::Form -{ -private: - FolderBrowserDialog^ folderBrowserDialog1; - OpenFileDialog^ openFileDialog1; - RichTextBox^ richTextBox1; - MainMenu^ mainMenu1; - MenuItem^ fileMenuItem; - MenuItem^ openMenuItem; - MenuItem^ folderMenuItem; - MenuItem^ closeMenuItem; - String^ openFileName; - String^ folderName; - bool fileOpened; - -public: - - // Constructor. - FolderBrowserDialogExampleForm() - { - fileOpened = false; - this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->fileMenuItem = gcnew System::Windows::Forms::MenuItem; - this->openMenuItem = gcnew System::Windows::Forms::MenuItem; - this->folderMenuItem = gcnew System::Windows::Forms::MenuItem; - this->closeMenuItem = gcnew System::Windows::Forms::MenuItem; - this->openFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog; - this->folderBrowserDialog1 = gcnew System::Windows::Forms::FolderBrowserDialog; - this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->mainMenu1->MenuItems->Add( this->fileMenuItem ); - array^temp0 = {this->openMenuItem,this->closeMenuItem,this->folderMenuItem}; - this->fileMenuItem->MenuItems->AddRange( temp0 ); - this->fileMenuItem->Text = "File"; - this->openMenuItem->Text = "Open..."; - this->openMenuItem->Click += gcnew System::EventHandler( this, &FolderBrowserDialogExampleForm::openMenuItem_Click ); - this->folderMenuItem->Text = "Select Directory..."; - this->folderMenuItem->Click += gcnew System::EventHandler( this, &FolderBrowserDialogExampleForm::folderMenuItem_Click ); - this->closeMenuItem->Text = "Close"; - this->closeMenuItem->Click += gcnew System::EventHandler( this, &FolderBrowserDialogExampleForm::closeMenuItem_Click ); - this->closeMenuItem->Enabled = false; - this->openFileDialog1->DefaultExt = "rtf"; - this->openFileDialog1->Filter = "rtf files (*.rtf)|*.rtf"; - - // Set the help text description for the FolderBrowserDialog. - this->folderBrowserDialog1->Description = "Select the directory that you want to use as the default."; - - // Do not allow the user to create new files via the FolderBrowserDialog. - this->folderBrowserDialog1->ShowNewFolderButton = false; - - // Default to the My Documents folder. - this->folderBrowserDialog1->RootFolder = Environment::SpecialFolder::Personal; - this->richTextBox1->AcceptsTab = true; - this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); - this->richTextBox1->Size = System::Drawing::Size( 280, 344 ); - this->richTextBox1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Right); - this->ClientSize = System::Drawing::Size( 296, 360 ); - this->Controls->Add( this->richTextBox1 ); - this->Menu = this->mainMenu1; - this->Text = "RTF Document Browser"; - } - - -private: - - // Bring up a dialog to open a file. - void openMenuItem_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // If a file is not opened then set the initial directory to the - // FolderBrowserDialog::SelectedPath value. - if ( !fileOpened ) - { - openFileDialog1->InitialDirectory = folderBrowserDialog1->SelectedPath; - openFileDialog1->FileName = nullptr; - } - - - // Display the openFile Dialog. - System::Windows::Forms::DialogResult result = openFileDialog1->ShowDialog(); - - // OK button was pressed. - if ( result == ::DialogResult::OK ) - { - openFileName = openFileDialog1->FileName; - try - { - - // Output the requested file in richTextBox1. - Stream^ s = openFileDialog1->OpenFile(); - richTextBox1->LoadFile( s, RichTextBoxStreamType::RichText ); - s->Close(); - fileOpened = true; - } - catch ( Exception^ exp ) - { - MessageBox::Show( String::Concat( "An error occurred while attempting to load the file. The error is: ", System::Environment::NewLine, exp, System::Environment::NewLine ) ); - fileOpened = false; - } - - Invalidate(); - closeMenuItem->Enabled = fileOpened; - } - // Cancel button was pressed. - else - - // Cancel button was pressed. - if ( result == ::DialogResult::Cancel ) - { - return; - } - } - - - // Close the current file. - void closeMenuItem_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - richTextBox1->Text = ""; - fileOpened = false; - closeMenuItem->Enabled = false; - } - - - // Bring up a dialog to chose a folder path in which to open/save a file. - void folderMenuItem_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Show the FolderBrowserDialog. - System::Windows::Forms::DialogResult result = folderBrowserDialog1->ShowDialog(); - if ( result == ::DialogResult::OK ) - { - folderName = folderBrowserDialog1->SelectedPath; - if ( !fileOpened ) - { - - // No file is opened, bring up openFileDialog in selected path. - openFileDialog1->InitialDirectory = folderName; - openFileDialog1->FileName = nullptr; - openMenuItem->PerformClick(); - } - } - } - -}; - - -// The main entry point for the application. -int main() -{ - Application::Run( gcnew FolderBrowserDialogExampleForm ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp deleted file mode 100644 index e8f6838a187..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp +++ /dev/null @@ -1,164 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates using the FontDialog.MinSize, -// FontDialog.MaxSize, and FontDialog.ShowEffects members, and -// handling of Apply event. -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::FontDialog^ FontDialog1; - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::TextBox^ TextBox1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->FontDialog1 = gcnew System::Windows::Forms::FontDialog; - this->Button1 = gcnew System::Windows::Forms::Button; - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - //FontDialog1 - // - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 72, 136 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 144, 88 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click for Font Dialog"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //TextBox1 - // - this->TextBox1->Location = System::Drawing::Point( 72, 48 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 152, 20 ); - this->TextBox1->TabIndex = 1; - this->TextBox1->Text = "Here is some text."; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // - void Button1_Click( System::Object^ sender, System::EventArgs^ e ) - { - // Set FontMustExist to true, which causes message box error - // if the user enters a font that does not exist. - FontDialog1->FontMustExist = true; - - // Associate the method handling the Apply event with the event. - FontDialog1->Apply += gcnew System::EventHandler( this, &Form1::FontDialog1_Apply ); - - // Set a minimum and maximum size to be - // shown in the FontDialog. - FontDialog1->MaxSize = 32; - FontDialog1->MinSize = 18; - - // Show the Apply button in the dialog. - FontDialog1->ShowApply = true; - - // Do not show effects such as Underline - // and Bold. - FontDialog1->ShowEffects = false; - - // Save the existing font. - System::Drawing::Font^ oldFont = this->Font; - - //Show the dialog, and get the result - System::Windows::Forms::DialogResult result = FontDialog1->ShowDialog(); - - // If the OK button in the Font dialog box is clicked, - // set all the controls' fonts to the chosen font by calling - // the FontDialog1_Apply method. - if ( result == ::DialogResult::OK ) - { - FontDialog1_Apply( this->Button1, gcnew System::EventArgs ); - } - // If Cancel is clicked, set the font back to - // the original font. - else - - // If Cancel is clicked, set the font back to - // the original font. - if ( result == ::DialogResult::Cancel ) - { - this->Font = oldFont; - System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Control^ containedControl = safe_cast(myEnum->Current); - containedControl->Font = oldFont; - } - } - } - - - // Handle the Apply event by setting all controls' fonts to - // the chosen font. - void FontDialog1_Apply( Object^ sender, System::EventArgs^ e ) - { - this->Font = FontDialog1->Font; - System::Collections::IEnumerator^ myEnum1 = this->Controls->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - Control^ containedControl = safe_cast(myEnum1->Current); - containedControl->Font = FontDialog1->Font; - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp deleted file mode 100644 index 88a3c2f18e0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp +++ /dev/null @@ -1,137 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates the result of setting -// the desktop bounds and desktop location. It also demonstrates -// the Form.MaximumSize property. -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ - - // -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Set the maximum size, so if user maximizes form, it - //will not cover entire desktop. - this->MaximumSize = System::Drawing::Size( 500, 500 ); - } - // - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Button^ Button2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 96, 48 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 96, 40 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click me to see the form move"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Button2 - // - this->Button2->Location = System::Drawing::Point( 96, 120 ); - this->Button2->Name = "Button2"; - this->Button2->Size = System::Drawing::Size( 96, 48 ); - this->Button2->TabIndex = 1; - this->Button2->Text = "Click me to see form shrink (and move)"; - this->Button2->Click += gcnew System::EventHandler( this, &Form1::Button2_Click ); - - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // - void Button1_Click( System::Object^ sender, System::EventArgs^ e ) - { - for ( int i = 0; i <= 25; i++ ) - { - - // With each loop through the code, the form's desktop - // location is adjusted right and down by 10 pixels. - this->SetDesktopLocation( this->Location.X + 10, this->Location.Y + 10 ); - - // Call Sleep to give the effect of the form walking - // across the screen. - System::Threading::Thread::Sleep( 250 ); - - } - - // Set the location back to the upper left-hand corner of - // the screen. - this->SetDesktopLocation( 10, 10 ); - } - // - - // - void Button2_Click( System::Object^ sender, System::EventArgs^ e ) - { - for ( int i = 0; i <= 20; i++ ) - { - - // With each loop through the code, the form's - // desktop location is adjusted right and down - // by 10 pixels and its height and width are each - // decreased by 10 pixels. - this->SetDesktopBounds( this->Location.X + 10, this->Location.Y + 10, this->Width - 10, this->Height - 10 ); - - // Call Sleep to show the form gradually shrinking. - System::Threading::Thread::Sleep( 50 ); - - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp deleted file mode 100644 index 4f94204f708..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp +++ /dev/null @@ -1,151 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates another use of the -// Form.SetDesktopLocation and Form.Activate members, -// and demonstrates handling the Form.Load and Form.Activate -// events. -using namespace System; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Label ^ Label1; - System::Windows::Forms::Label ^ Label2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Label1 = gcnew System::Windows::Forms::Label; - this->Label2 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 104, 80 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 96, 56 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click me for an new inactivated form."; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Label1 - // - this->Label1->Location = System::Drawing::Point( 104, 160 ); - this->Label1->Name = "Label1"; - this->Label1->TabIndex = 1; - this->Label1->Text = "Label1"; - - // - //Label2 - // - this->Label2->Location = System::Drawing::Point( 104, 208 ); - this->Label2->Name = "Label2"; - this->Label2->Size = System::Drawing::Size( 40, 40 ); - this->Label2->TabIndex = 2; - this->Label2->Text = "Label2"; - this->Label2->AutoSize = true; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label2 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Activated += gcnew System::EventHandler( this, &Form1::Form1_Activated ); - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->Closed += gcnew System::EventHandler( this, &Form1::Form1_Closed ); - this->ResumeLayout( false ); - } - - // - static int x = 200; - static int y = 200; - void Button1_Click( System::Object^ sender, System::EventArgs^ e ) - { - - // Create a new Form1 and set its Visible property to true. - Form1^ form2 = gcnew Form1; - form2->Visible = true; - - // Set the new form's desktop location so it - // appears below and to the right of the current form. - form2->SetDesktopLocation( x, y ); - x += 30; - y += 30; - - // Keep the current form active by calling the Activate - // method. - this->Activate(); - this->Button1->Enabled = false; - } - - - // Updates the label text to reflect the current values of x - // and y, which was were incremented in the Button1 control's - // click event. - void Form1_Activated( Object^ sender, System::EventArgs^ e ) - { - Label1->Text = String::Format( "x: {0} y: {1}", x, y ); - Label2->Text = String::Format( "Number of forms currently open: {0}", count ); - } - - static int count = 0; - void Form1_Closed( Object^ sender, System::EventArgs^ e ) - { - count -= 1; - } - - void Form1_Load( Object^ sender, System::EventArgs^ e ) - { - count += 1; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp deleted file mode 100644 index ae905ef4d10..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp +++ /dev/null @@ -1,214 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - //Form calls destructor to clean up the component list. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -internal: - System::Windows::Forms::DataGridView ^ dataGridView1; - -private: - System::Windows::Forms::Button^ Button1; - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerNonUserCode] - void InitializeComponent() - { - this->dataGridView1 = gcnew System::Windows::Forms::DataGridView; - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // dataGridView1 - // - this->dataGridView1->Location = System::Drawing::Point( 75, 67 ); - this->dataGridView1->Name = "dataGridView1"; - this->dataGridView1->Size = System::Drawing::Size( 152, 148 ); - this->dataGridView1->TabIndex = 0; - - // - // Button1 - // - this->Button1->Location = System::Drawing::Point( 101, 240 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 1; - this->Button1->Text = "Automatically Resize Cells"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->dataGridView1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - -internal: - - static property Form1^ GetInstance - { - Form1^ get() - { - if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) - { - System::Threading::Monitor::Enter( m_SyncObject ); - try - { - if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) - { - m_DefaultInstance = gcnew Form1; - } - } - finally - { - System::Threading::Monitor::Exit( m_SyncObject ); - } - } - - return m_DefaultInstance; - } - } - -private: - static Form1^ m_DefaultInstance; - static Object^ m_SyncObject = gcnew Object; - - // - // - void InitializeDataGridView() - { - this->Size = System::Drawing::Size( 600, 600 ); - dataGridView1->Size = System::Drawing::Size( 450, 400 ); - - // Create an unbound DataGridView by declaring a column count. - dataGridView1->ColumnCount = 4; - dataGridView1->ColumnHeadersVisible = true; - - // Set the column header style. - DataGridViewCellStyle ^ columnHeaderStyle = gcnew DataGridViewCellStyle; - columnHeaderStyle->BackColor = Color::Aqua; - columnHeaderStyle->Font = gcnew System::Drawing::Font( "Verdana",10,FontStyle::Bold ); - dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; - - // Set the column header names. - dataGridView1->Columns[ 0 ]->Name = "Recipe"; - dataGridView1->Columns[ 1 ]->Name = "Category"; - dataGridView1->Columns[ 2 ]->Name = "Main Ingredients"; - dataGridView1->Columns[ 3 ]->Name = "Rating"; - - // Populate the rows. - array^row1 = gcnew array{ - "Meatloaf","Main Dish","ground beef","**" - }; - array^row2 = gcnew array{ - "Key Lime Pie","Dessert","lime juice, evaporated milk","****" - }; - array^row3 = gcnew array{ - "Orange-Salsa Pork Chops","Main Dish","pork chops, salsa, orange juice","****" - }; - array^row4 = gcnew array{ - "Black Bean and Rice Salad","Salad","black beans, brown rice","****" - }; - array^row5 = gcnew array{ - "Chocolate Cheesecake","Dessert","cream cheese","***" - }; - array^row6 = gcnew array{ - "Black Bean Dip","Appetizer","black beans, sour cream","***" - }; - array^rows = {row1,row2,row3,row4,row5,row6}; - System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - array^rowArray = safe_cast^>(myEnum->Current); - dataGridView1->Rows->Add( rowArray ); - } - } - - // - void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Resize the height of the column headers. - dataGridView1->AutoResizeColumnHeadersHeight(); - - // Resize all the row heights to fit the contents of all non-header cells. - dataGridView1->AutoResizeRows( - DataGridViewAutoSizeRowsMode::AllCellsExceptHeaders); - } - // - // - - void InitializeContextMenu() - { - // Create the menu item. - MenuItem^ getRecipe = gcnew MenuItem( "Search for recipe",gcnew System::EventHandler( this, &Form1::OnMenuClick ) ); - - // Add the menu item to the shortcut menu. - System::Windows::Forms::ContextMenuStrip^ recipeMenu = gcnew System::Windows::Forms::ContextMenuStrip(); - - // Set the shortcut menu for the first column. - dataGridView1->Columns[ 0 ]->ContextMenuStrip = recipeMenu; - } - - void OnMenuClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( dataGridView1->CurrentCell != nullptr ) - { - //Retrieve the recipe name. - String^ recipeName = dynamic_cast(dataGridView1->CurrentCell->Value); - - //Search for the recipe. - System::Diagnostics::Process::Start( String::Format( "http://search.msn.com/results.aspx?q={0}", recipeName ), nullptr ); - } - } - -private: - - // - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - InitializeDataGridView(); - InitializeContextMenu(); - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp deleted file mode 100644 index f554906e42e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp +++ /dev/null @@ -1,165 +0,0 @@ -// -#using -#using -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Data; -using namespace System::Data::SqlClient; -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeDataGridView(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - System::Windows::Forms::DataGridView ^ dataGridView1; - System::Windows::Forms::BindingSource ^ bindingSource1; - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerNonUserCode] - void InitializeComponent() - { - this->dataGridView1 = gcnew System::Windows::Forms::DataGridView; - this->bindingSource1 = gcnew System::Windows::Forms::BindingSource; - this->SuspendLayout(); - - // - //DataGridView1 - // - this->dataGridView1->Location = System::Drawing::Point( 96, 71 ); - this->dataGridView1->Name = "DataGridView1"; - this->dataGridView1->Size = System::Drawing::Size( 321, 286 ); - this->dataGridView1->TabIndex = 0; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 518, 413 ); - this->Controls->Add( this->dataGridView1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - -internal: - - static property Form1^ GetInstance - { - Form1^ get() - { - if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) - { - System::Threading::Monitor::Enter( m_SyncObject ); - try - { - if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) - { - m_DefaultInstance = gcnew Form1; - } - } - finally - { - System::Threading::Monitor::Exit( m_SyncObject ); - } - } - - return m_DefaultInstance; - } - } - -private: - static Form1^ m_DefaultInstance; - static Object^ m_SyncObject = gcnew Object; - - // - void InitializeDataGridView() - { - try - { - // Set up the DataGridView. - dataGridView1->Dock = DockStyle::Fill; - - // Automatically generate the DataGridView columns. - dataGridView1->AutoGenerateColumns = true; - - // Set up the data source. - bindingSource1->DataSource = GetData( "Select * From Products" ); - dataGridView1->DataSource = bindingSource1; - - // Automatically resize the visible rows. - dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::DisplayedCellsExceptHeaders; - - // Set the DataGridView control's border. - dataGridView1->BorderStyle = BorderStyle::Fixed3D; - - // Put the cells in edit mode when user enters them. - dataGridView1->EditMode = DataGridViewEditMode::EditOnEnter; - } - catch ( SqlException^ ) - { - MessageBox::Show( "To run this sample replace connection.ConnectionString" - " with a valid connection string to a Northwind" - " database accessible to your system.", "ERROR", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); - System::Threading::Thread::CurrentThread->Abort(); - } - catch ( System::Exception^ ex ) - { - MessageBox::Show( ex->ToString() ); - } - } - - - // - // - DataTable^ GetData( String^ sqlCommand ) - { - String^ connectionString = "Integrated Security=SSPI;Persist Security Info=False;" - "Initial Catalog=Northwind;Data Source= localhost"; - SqlConnection^ northwindConnection = gcnew SqlConnection( connectionString ); - SqlCommand^ command = gcnew SqlCommand( sqlCommand,northwindConnection ); - SqlDataAdapter^ adapter = gcnew SqlDataAdapter; - adapter->SelectCommand = command; - DataTable^ table = gcnew DataTable; - adapter->Fill( table ); - return table; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp deleted file mode 100644 index 30d2bc3dd43..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp +++ /dev/null @@ -1,364 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - Panel^ buttonPanel; - DataGridView^ dataGridView1; - Button^ addNewRowButton; - Button^ deleteRowButton; - Button^ ledgerStyleButton; - bool editedLastColumn; - -public: - Form1() - { - buttonPanel = gcnew Panel; - dataGridView1 = gcnew DataGridView; - addNewRowButton = gcnew Button; - deleteRowButton = gcnew Button; - ledgerStyleButton = gcnew Button; - editedLastColumn = false; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - -private: - void Form1_Load( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - SetUpLayout(); - SetUpDataGridView(); - StyleCells(); - PopulateDataGridView(); - } - - - // Set up the button and button panel. - void SetUpLayout() - { - this->Size = System::Drawing::Size( 600, 600 ); - { - addNewRowButton->Text = "Add Row"; - addNewRowButton->Location = Point(10,10); - } - { - deleteRowButton->Text = "Delete Row"; - deleteRowButton->Location = Point(100,10); - } - { - ledgerStyleButton->Text = "Ledger Style"; - ledgerStyleButton->Size = System::Drawing::Size( 80, 30 ); - ledgerStyleButton->Location = Point(200,10); - } - { - buttonPanel->Controls->Add( addNewRowButton ); - buttonPanel->Controls->Add( deleteRowButton ); - buttonPanel->Controls->Add( ledgerStyleButton ); - buttonPanel->Height = 50; - buttonPanel->Dock = DockStyle::Bottom; - } - this->Controls->Add( this->buttonPanel ); - } - - // - void dataGridView1_CellFormatting( Object^ /*sender*/, DataGridViewCellFormattingEventArgs^ e ) - { - // If the column is the Artist column, check the - // value. - if ( this->dataGridView1->Columns[ e->ColumnIndex ]->Name->Equals( "Artist" ) ) - { - if ( e->Value != nullptr ) - { - // Check for the string "pink" in the cell. - String^ stringValue = dynamic_cast(e->Value); - stringValue = stringValue->ToLower(); - if ( (stringValue->IndexOf( "pink" ) > -1) ) - { - DataGridViewCellStyle^ pinkStyle = gcnew DataGridViewCellStyle; - - //Change the style of the cell. - pinkStyle->BackColor = Color::Pink; - pinkStyle->ForeColor = Color::Black; - pinkStyle->Font = gcnew System::Drawing::Font( "Times New Roman",8,FontStyle::Bold ); - e->CellStyle = pinkStyle; - } - - } - } - else - if ( this->dataGridView1->Columns[ e->ColumnIndex ]->Name->Equals( "Release Date" ) ) - { - ShortFormDateFormat( e ); - } - } - - - //Even though the date internaly stores the year as YYYY, using formatting, the - //UI can have the format in YY. - void ShortFormDateFormat( DataGridViewCellFormattingEventArgs^ formatting ) - { - if ( formatting->Value != nullptr ) - { - try - { - System::Text::StringBuilder^ dateString = gcnew System::Text::StringBuilder; - DateTime theDate = DateTime::Parse( formatting->Value->ToString() ); - dateString->Append( theDate.Month ); - dateString->Append( "/" ); - dateString->Append( theDate.Day ); - dateString->Append( "/" ); - dateString->Append( theDate.Year.ToString()->Substring( 2 ) ); - formatting->Value = dateString->ToString(); - formatting->FormattingApplied = true; - } - catch ( Exception^ /*notInDateFormat*/ ) - { - // Set to false in case there are other handlers interested trying to - // format this DataGridViewCellFormattingEventArgs instance. - formatting->FormattingApplied = false; - } - - } - } - // - - // - // Handling CellParsing allows one to accept user input, then map it to a different - // internal representation. - void dataGridView1_CellParsing( Object^ /*sender*/, DataGridViewCellParsingEventArgs^ e ) - { - if ( this->dataGridView1->Columns[ e->ColumnIndex ]->Name->Equals( "Release Date" ) ) - { - if ( e != nullptr ) - { - if ( e->Value != nullptr ) - { - try - { - // Map what the user typed into UTC. - e->Value = DateTime::Parse( e->Value->ToString() ).ToUniversalTime(); - - // Set the ParsingApplied property to - // Show the event is handled. - e->ParsingApplied = true; - } - catch ( FormatException^ /*ex*/ ) - { - // Set to false in case another CellParsing handler - // wants to try to parse this DataGridViewCellParsingEventArgs instance. - e->ParsingApplied = false; - } - } - } - } - } - // - - // - void addNewRowButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - this->dataGridView1->Rows->Add(); - } - // - - // - void deleteRowButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - if ( this->dataGridView1->SelectedRows->Count > 0 && this->dataGridView1->SelectedRows[ 0 ]->Index != this->dataGridView1->Rows->Count - 1 ) - { - this->dataGridView1->Rows->RemoveAt( this->dataGridView1->SelectedRows[ 0 ]->Index ); - } - } - // - - // - // - void ledgerStyleButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create a new cell style. - DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle; - { - style->BackColor = Color::Beige; - style->ForeColor = Color::Brown; - style->Font = gcnew System::Drawing::Font( "Verdana",8 ); - } - - // Apply the style as the default cell style. - dataGridView1->AlternatingRowsDefaultCellStyle = style; - ledgerStyleButton->Enabled = false; - } - // - - // - void SetUpDataGridView() - { - this->Controls->Add( dataGridView1 ); - dataGridView1->ColumnCount = 5; - DataGridViewCellStyle^ style = dataGridView1->ColumnHeadersDefaultCellStyle; - style->BackColor = Color::Navy; - style->ForeColor = Color::White; - style->Font = gcnew System::Drawing::Font( dataGridView1->Font,FontStyle::Bold ); - dataGridView1->EditMode = DataGridViewEditMode::EditOnEnter; - dataGridView1->Name = "dataGridView1"; - dataGridView1->Location = Point(8,8); - dataGridView1->Size = System::Drawing::Size( 500, 300 ); - dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::DisplayedCellsExceptHeaders; - dataGridView1->ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle::Raised; - dataGridView1->CellBorderStyle = DataGridViewCellBorderStyle::Single; - dataGridView1->GridColor = SystemColors::ActiveBorder; - dataGridView1->RowHeadersVisible = false; - dataGridView1->Columns[ 0 ]->Name = "Release Date"; - dataGridView1->Columns[ 1 ]->Name = "Track"; - dataGridView1->Columns[ 1 ]->DefaultCellStyle->Alignment = DataGridViewContentAlignment::MiddleCenter; - dataGridView1->Columns[ 2 ]->Name = "Title"; - dataGridView1->Columns[ 3 ]->Name = "Artist"; - dataGridView1->Columns[ 4 ]->Name = "Album"; - - // Make the font italic for row four. - dataGridView1->Columns[ 4 ]->DefaultCellStyle->Font = gcnew System::Drawing::Font( DataGridView::DefaultFont,FontStyle::Italic ); - dataGridView1->SelectionMode = DataGridViewSelectionMode::FullRowSelect; - dataGridView1->MultiSelect = false; - dataGridView1->BackgroundColor = Color::Honeydew; - dataGridView1->Dock = DockStyle::Fill; - dataGridView1->CellFormatting += gcnew DataGridViewCellFormattingEventHandler( this, &Form1::dataGridView1_CellFormatting ); - dataGridView1->CellParsing += gcnew DataGridViewCellParsingEventHandler( this, &Form1::dataGridView1_CellParsing ); - addNewRowButton->Click += gcnew EventHandler( this, &Form1::addNewRowButton_Click ); - deleteRowButton->Click += gcnew EventHandler( this, &Form1::deleteRowButton_Click ); - ledgerStyleButton->Click += gcnew EventHandler( this, &Form1::ledgerStyleButton_Click ); - dataGridView1->CellValidating += gcnew DataGridViewCellValidatingEventHandler( this, &Form1::dataGridView1_CellValidating ); - } - // - - // - void PopulateDataGridView() - { - // Create the string array for each row of data. - array^row0 = {"11/22/1968","29","Revolution 9","Beatles","The Beatles [White Album]"}; - array^row1 = {"4/4/1960","6","Fools Rush In","Frank Sinatra","Nice 'N' Easy"}; - array^row2 = {"11/11/1971","1","One of These Days","Pink Floyd","Meddle"}; - array^row3 = {"4/4/1988","7","Where Is My Mind?","Pixies","Surfer Rosa"}; - array^row4 = {"5/1981","9","Can't Find My Mind","Cramps","Psychedelic Jungle"}; - array^row5 = {"6/10/2003","13","Scatterbrain. (As Dead As Leaves.)","Radiohead","Hail to the Thief"}; - array^row6 = {"6/30/1992","3","Dress","P J Harvey","Dry"}; - - // Add a row for each string array. - { - DataGridViewRowCollection^ rows = this->dataGridView1->Rows; - rows->Add( row0 ); - rows->Add( row1 ); - rows->Add( row2 ); - rows->Add( row3 ); - rows->Add( row4 ); - rows->Add( row5 ); - rows->Add( row6 ); - } - - // Change the order the columns are displayed. - { - DataGridViewColumnCollection^ columns = this->dataGridView1->Columns; - columns[ 0 ]->DisplayIndex = 3; - columns[ 1 ]->DisplayIndex = 4; - columns[ 2 ]->DisplayIndex = 0; - columns[ 3 ]->DisplayIndex = 1; - columns[ 4 ]->DisplayIndex = 2; - } - } - // - // - - // - void dataGridView1_CellValidating( Object^ /*sender*/, DataGridViewCellValidatingEventArgs^ newValue ) - { - DataGridViewColumn^ column = dataGridView1->Columns[ newValue->ColumnIndex ]; - if ( column->Name->Equals( "Track" ) ) - { - CheckTrack( newValue ); - } - else - if ( column->Name->Equals( "Release Date" ) ) - { - CheckDate( newValue ); - } - } - - void CheckTrack( DataGridViewCellValidatingEventArgs^ newValue ) - { - Int32 ignored; - if ( newValue->FormattedValue->ToString() == String::Empty ) - { - NotifyUserAndForceRedo( "Please enter a track", newValue ); - } - else - if ( !Int32::TryParse( newValue->FormattedValue->ToString(), ignored ) ) - { - NotifyUserAndForceRedo( "A Track must be a number", newValue ); - } - else - if ( Int32::Parse( newValue->FormattedValue->ToString() ) < 1 ) - { - NotifyUserAndForceRedo( "Not a valid track", newValue ); - editedLastColumn = true; - } - } - - void NotifyUserAndForceRedo( String^ errorMessage, DataGridViewCellValidatingEventArgs^ newValue ) - { - MessageBox::Show( errorMessage ); - newValue->Cancel = true; - } - - void CheckDate( DataGridViewCellValidatingEventArgs^ newValue ) - { - try - { - DateTime::Parse( newValue->FormattedValue->ToString() ).ToLongDateString(); - AnnotateCell( String::Empty, newValue ); - } - catch ( FormatException^ /*ex*/ ) - { - AnnotateCell( "You did not enter a valid date.", newValue ); - } - } - - void AnnotateCell( String^ errorMessage, DataGridViewCellValidatingEventArgs^ editEvent ) - { - DataGridViewCell^ cell = dataGridView1->Rows[ editEvent->RowIndex ]->Cells[ editEvent->ColumnIndex ]; - cell->ErrorText = errorMessage; - } - // - - //Private Sub TurnOff_EditOnEnter(ByVal sender As Object, ByVal args As DataGridViewCellEventArgs) Handles dataGridView1.RowValidated - // If editedLastColumn Then - // dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically - // End If - //End Sub - // - void StyleCells() - { - dataGridView1->CellBorderStyle = DataGridViewCellBorderStyle::None; - dataGridView1->CellBorderStyle = DataGridViewCellBorderStyle::Single; - } - // -}; - -int main() -{ - try - { - Application::Run( gcnew Form1 ); - } - catch ( Exception^ e ) - { - MessageBox::Show( e->ToString() ); - } - -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp deleted file mode 100644 index f7071210b7b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp +++ /dev/null @@ -1,136 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeRadioButtonsAndGroupBox(); - this->RadioButton1->CheckedChanged += gcnew EventHandler( this,&Form1::RadioButton_CheckedChanged ); - this->RadioButton2->CheckedChanged += gcnew EventHandler( this,&Form1::RadioButton_CheckedChanged ); - this->RadioButton3->CheckedChanged += gcnew EventHandler( this,&Form1::RadioButton_CheckedChanged ); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // -internal: - System::Windows::Forms::GroupBox^ GroupBox1; - System::Windows::Forms::RadioButton^ RadioButton1; - System::Windows::Forms::RadioButton^ RadioButton2; - System::Windows::Forms::RadioButton^ RadioButton3; - -private: - void InitializeRadioButtonsAndGroupBox() - { - - // Construct the GroupBox object. - this->GroupBox1 = gcnew GroupBox; - - // Construct the radio buttons. - this->RadioButton1 = gcnew System::Windows::Forms::RadioButton; - this->RadioButton2 = gcnew System::Windows::Forms::RadioButton; - this->RadioButton3 = gcnew System::Windows::Forms::RadioButton; - - // Set the location, tab and text for each radio button - // to a cursor from the Cursors enumeration. - this->RadioButton1->Location = System::Drawing::Point( 24, 24 ); - this->RadioButton1->TabIndex = 0; - this->RadioButton1->Text = "Help"; - this->RadioButton1->Tag = Cursors::Help; - this->RadioButton1->TextAlign = ContentAlignment::MiddleCenter; - this->RadioButton2->Location = System::Drawing::Point( 24, 56 ); - this->RadioButton2->TabIndex = 1; - this->RadioButton2->Text = "Up Arrow"; - this->RadioButton2->Tag = Cursors::UpArrow; - this->RadioButton2->TextAlign = ContentAlignment::MiddleCenter; - this->RadioButton3->Location = System::Drawing::Point( 24, 80 ); - this->RadioButton3->TabIndex = 3; - this->RadioButton3->Text = "Cross"; - this->RadioButton3->Tag = Cursors::Cross; - this->RadioButton3->TextAlign = ContentAlignment::MiddleCenter; - - // Add the radio buttons to the GroupBox. - this->GroupBox1->Controls->Add( this->RadioButton1 ); - this->GroupBox1->Controls->Add( this->RadioButton2 ); - this->GroupBox1->Controls->Add( this->RadioButton3 ); - - // Set the location of the GroupBox. - this->GroupBox1->Location = System::Drawing::Point( 56, 64 ); - this->GroupBox1->Size = System::Drawing::Size( 200, 150 ); - - // Set the text that will appear on the GroupBox. - this->GroupBox1->Text = "Choose a Cursor Style"; - - // - // Add the GroupBox to the form. - this->Controls->Add( this->GroupBox1 ); - - // - } - // - - void RadioButton_CheckedChanged( Object^ sender, EventArgs^ /*e*/ ) - { - - // Cast the sender back to a RadioButton object. - RadioButton^ selectedRadioButton = dynamic_cast(sender); - - // If the radio button is in a checked state, then - // change the cursor. - if ( selectedRadioButton->Checked ) - { - this->Cursor = dynamic_cast(selectedRadioButton->Tag); - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp deleted file mode 100644 index 419d33913d6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp +++ /dev/null @@ -1,130 +0,0 @@ -// This sample can go in GroupBoxRenderer class overview. -// - Snippet2 can go in DrawGroupBox - -// This is a custom GroupBox-like control that has a double border -// and uses an internal FlowLayoutPanel to contain added controls. - -// TODO: see if you can work DrawParentBackground into here somehow. - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace GroupBoxRendererSample -{ - public ref class CustomGroupBox : public Control - { - private: - Rectangle innerRectangle; - private: - GroupBoxState state; - private: - FlowLayoutPanel^ panel; - - public: - CustomGroupBox() : Control() - { - innerRectangle = Rectangle(); - state = GroupBoxState::Normal; - panel = gcnew FlowLayoutPanel(); - - this->Size = System::Drawing::Size(200, 200); - this->Location = Point(10, 10); - this->Controls->Add(panel); - this->Text = "CustomGroupBox"; - this->Font = SystemFonts::IconTitleFont; - - innerRectangle.X = ClientRectangle.X + 5; - innerRectangle.Y = ClientRectangle.Y + 15; - innerRectangle.Width = ClientRectangle.Width - 10; - innerRectangle.Height = ClientRectangle.Height - 20; - - panel->FlowDirection = FlowDirection::TopDown; - panel->Location = Point(innerRectangle.X + 5, - innerRectangle.Y + 5); - panel->Size = System::Drawing::Size(innerRectangle.Width - 10, - innerRectangle.Height - 10); - } - - // - // Draw the group box in the current state. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - GroupBoxRenderer::DrawGroupBox(e->Graphics, ClientRectangle, - this->Text, this->Font, state); - - // Draw an additional inner border if visual styles are enabled. - if (Application::RenderWithVisualStyles) - { - GroupBoxRenderer::DrawGroupBox(e->Graphics, innerRectangle, - state); - } - } - // - - // Pass added controls to the internal FlowLayoutPanel. - protected: - virtual void OnControlAdded(ControlEventArgs^ e) override - { - __super::OnControlAdded(e); - - // Ensure that you do not add the panel itself. - if (e->Control != this->panel) - { - this->Controls->Remove(e->Control); - panel->Controls->Add(e->Control); - } - } - }; - - ref class Form1 : public Form - { - public: - Form1() : Form() - { - CustomGroupBox^ groupBox1 = gcnew CustomGroupBox(); - groupBox1->Text = "Radio Button Display"; - Controls->Add(groupBox1); - - // Add some radio buttons to test the CustomGroupBox. - int count = 8; - array^ buttonArray = - gcnew array(count); - for (int i = 0; i < count; i++) - { - buttonArray[i] = gcnew RadioButton(); - buttonArray[i]->Text = "Button " + (i + 1).ToString(); - groupBox1->Controls->Add(buttonArray[i]); - } - - if (Application::RenderWithVisualStyles) - { - this->Text = "Visual Styles Enabled"; - } - else - { - this->Text = "Visual Styles Disabled"; - } - } - }; -} - -[STAThread] -int main() -{ - // If you do not call EnableVisualStyles below, then - // GroupBoxRenderer automatically detects this and draws - // the group box without visual styles. - Application::EnableVisualStyles(); - Application::Run(gcnew GroupBoxRendererSample::Form1()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp deleted file mode 100644 index 884b61affca..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp +++ /dev/null @@ -1,158 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - String^ helpfile; - System::Windows::Forms::Button^ showIndex; - System::Windows::Forms::Button^ showHelp; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::ComboBox^ navigatorCombo; - System::Windows::Forms::Button^ showKeyword; - System::Windows::Forms::TextBox^ keyword; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::TextBox^ parameterTextBox; - -public: - Form1() - { - helpfile = "mspaint.chm"; - this->showIndex = gcnew System::Windows::Forms::Button; - this->showHelp = gcnew System::Windows::Forms::Button; - this->navigatorCombo = gcnew System::Windows::Forms::ComboBox; - this->label1 = gcnew System::Windows::Forms::Label; - this->showKeyword = gcnew System::Windows::Forms::Button; - this->keyword = gcnew System::Windows::Forms::TextBox; - this->label2 = gcnew System::Windows::Forms::Label; - this->label3 = gcnew System::Windows::Forms::Label; - this->parameterTextBox = gcnew System::Windows::Forms::TextBox; - - // Help Navigator Label - this->label1->Location = System::Drawing::Point( 112, 64 ); - this->label1->Size = System::Drawing::Size( 168, 16 ); - this->label1->Text = "Help Navigator:"; - - // Keyword Label - this->label2->Location = System::Drawing::Point( 120, 184 ); - this->label2->Size = System::Drawing::Size( 100, 16 ); - this->label2->Text = "Keyword:"; - - // Parameter Label - this->label3->Location = System::Drawing::Point( 112, 120 ); - this->label3->Size = System::Drawing::Size( 168, 16 ); - this->label3->Text = "Parameter:"; - - // Show Index Button - this->showIndex->Location = System::Drawing::Point( 16, 16 ); - this->showIndex->Size = System::Drawing::Size( 264, 32 ); - this->showIndex->TabIndex = 0; - this->showIndex->Text = "Show Help Index"; - this->showIndex->Click += gcnew System::EventHandler( this, &Form1::showIndex_Click ); - - // Show Help Button - this->showHelp->Location = System::Drawing::Point( 16, 80 ); - this->showHelp->Size = System::Drawing::Size( 80, 80 ); - this->showHelp->TabIndex = 1; - this->showHelp->Text = "Show Help"; - this->showHelp->Click += gcnew System::EventHandler( this, &Form1::showHelp_Click ); - - // Show Keyword Button - this->showKeyword->Location = System::Drawing::Point( 16, 192 ); - this->showKeyword->Size = System::Drawing::Size( 88, 32 ); - this->showKeyword->TabIndex = 4; - this->showKeyword->Text = "Show Keyword"; - this->showKeyword->Click += gcnew System::EventHandler( this, &Form1::showKeyword_Click ); - - // Help Navigator ComboBox - this->navigatorCombo->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList; - this->navigatorCombo->Location = System::Drawing::Point( 112, 80 ); - this->navigatorCombo->Size = System::Drawing::Size( 168, 21 ); - this->navigatorCombo->TabIndex = 2; - - // Keyword TextBox - this->keyword->Location = System::Drawing::Point( 120, 200 ); - this->keyword->Size = System::Drawing::Size( 160, 20 ); - this->keyword->TabIndex = 5; - this->keyword->Text = ""; - - // Parameter TextBox - this->parameterTextBox->Location = System::Drawing::Point( 112, 136 ); - this->parameterTextBox->Size = System::Drawing::Size( 168, 20 ); - this->parameterTextBox->TabIndex = 8; - this->parameterTextBox->Text = ""; - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^formControls = {this->parameterTextBox,this->label3,this->label2,this->keyword,this->showKeyword,this->label1,this->navigatorCombo,this->showHelp,this->showIndex}; - this->Controls->AddRange( formControls ); - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; - this->Text = "Help App"; - - // - // Load the various values of the HelpNavigator enumeration - // into the combo box. - TypeConverter^ converter; - converter = TypeDescriptor::GetConverter( HelpNavigator::typeid ); - System::Collections::IEnumerator^ myEnum = converter->GetStandardValues()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Object^ value = safe_cast(myEnum->Current); - navigatorCombo->Items->Add( value ); - } - // - } - - // -private: - void showIndex_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Display the index for the help file. - Help::ShowHelpIndex( this, helpfile ); - } - // - - // - void showHelp_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Display Help using the Help navigator enumeration - // that is selected in the combo box. Some enumeration - // values make use of an extra parameter, which can - // be passed in through the Parameter text box. - HelpNavigator navigator = HelpNavigator::TableOfContents; - if ( navigatorCombo->SelectedItem != nullptr ) - { - navigator = *safe_cast(navigatorCombo->SelectedItem); - } - - Help::ShowHelp( this, helpfile, navigator, parameterTextBox->Text ); - } - // - - // - void showKeyword_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Display help using the provided keyword. - Help::ShowHelp( this, helpfile, keyword->Text ); - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp deleted file mode 100644 index c5b9dd78184..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp +++ /dev/null @@ -1,117 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ addressTextBox; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::TextBox^ cityTextBox; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::TextBox^ stateTextBox; - System::Windows::Forms::TextBox^ zipTextBox; - System::Windows::Forms::Label ^ helpLabel; - -public: - Form1() - { - this->addressTextBox = gcnew System::Windows::Forms::TextBox; - this->helpLabel = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->cityTextBox = gcnew System::Windows::Forms::TextBox; - this->label3 = gcnew System::Windows::Forms::Label; - this->stateTextBox = gcnew System::Windows::Forms::TextBox; - this->zipTextBox = gcnew System::Windows::Forms::TextBox; - - // Help Label - this->helpLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - this->helpLabel->Location = System::Drawing::Point( 8, 80 ); - this->helpLabel->Size = System::Drawing::Size( 272, 72 ); - this->helpLabel->Text = "Click on any control to give it focus, and then press F1 to display help for that control. Alternately, you can click the help button at the top of the dialog and then click on a control."; - - // Address Label - this->label2->Location = System::Drawing::Point( 16, 8 ); - this->label2->Size = System::Drawing::Size( 100, 16 ); - this->label2->Text = "Address:"; - - // Comma Label - this->label3->Location = System::Drawing::Point( 136, 56 ); - this->label3->Size = System::Drawing::Size( 16, 16 ); - this->label3->Text = ", "; - - // Address TextBox - this->addressTextBox->Location = System::Drawing::Point( 16, 24 ); - this->addressTextBox->Size = System::Drawing::Size( 264, 20 ); - this->addressTextBox->TabIndex = 0; - this->addressTextBox->Tag = "Enter the street address in this text box."; - this->addressTextBox->Text = ""; - this->addressTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); - - // City TextBox - this->cityTextBox->Location = System::Drawing::Point( 16, 48 ); - this->cityTextBox->Size = System::Drawing::Size( 120, 20 ); - this->cityTextBox->TabIndex = 3; - this->cityTextBox->Tag = "Enter the city here."; - this->cityTextBox->Text = ""; - this->cityTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); - - // State TextBox - this->stateTextBox->Location = System::Drawing::Point( 152, 48 ); - this->stateTextBox->MaxLength = 2; - this->stateTextBox->Size = System::Drawing::Size( 32, 20 ); - this->stateTextBox->TabIndex = 5; - this->stateTextBox->Tag = "Enter the state in this text box."; - this->stateTextBox->Text = ""; - this->stateTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); - - // Zip TextBox - this->zipTextBox->Location = System::Drawing::Point( 192, 48 ); - this->zipTextBox->Name = "zipTextBox"; - this->zipTextBox->Size = System::Drawing::Size( 88, 20 ); - this->zipTextBox->TabIndex = 6; - this->zipTextBox->Tag = "Enter the zip code here."; - this->zipTextBox->Text = ""; - this->zipTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 292, 160 ); - array^temp0 = {this->zipTextBox,this->stateTextBox,this->label3,this->cityTextBox,this->label2,this->helpLabel,this->addressTextBox}; - this->Controls->AddRange( temp0 ); - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; - this->HelpButton = true; - this->MaximizeBox = false; - this->MinimizeBox = false; - this->Text = "Help Event Demonstration"; - } - - -private: - void textBox_HelpRequested( Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent ) - { - - // This event is raised when the F1 key is pressed or the - // Help cursor is clicked on any of the address fields. - // The Help text for the field is in the control's - // Tag property. It is retrieved and displayed in the label. - Control^ requestingControl = dynamic_cast(sender); - helpLabel->Text = dynamic_cast(requestingControl->Tag); - hlpevent->Handled = true; - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp deleted file mode 100644 index 01ebc86f007..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::Label ^ Label1; - System::Windows::Forms::Button^ Button2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Label1 = gcnew System::Windows::Forms::Label; - this->Button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 32, 160 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 80, 32 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Help"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //TextBox1 - // - this->TextBox1->Location = System::Drawing::Point( 152, 72 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->TabIndex = 1; - this->TextBox1->Text = ""; - - // - //Label1 - // - this->Label1->Location = System::Drawing::Point( 40, 72 ); - this->Label1->Name = "Label1"; - this->Label1->TabIndex = 2; - this->Label1->Text = "Name"; - - // - //Button2 - // - this->Button2->Location = System::Drawing::Point( 168, 168 ); - this->Button2->Name = "Button2"; - this->Button2->TabIndex = 3; - this->Button2->Text = "More Help"; - this->Button2->Click += gcnew System::EventHandler( this, &Form1::Button2_Click ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Register"; - this->ResumeLayout( false ); - } - - // - // Open the Help file for the Character Map topic. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Help::ShowHelp( TextBox1, "file://c:\\charmap.chm" ); - } - // - - // - // Open the Help file for the Character Map topic and - // display the Index page. - void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Help::ShowHelp( TextBox1, "file://c:\\charmap.chm", HelpNavigator::Index ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp deleted file mode 100644 index 1cdb6f9bd29..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp +++ /dev/null @@ -1,121 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ addressTextBox; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::TextBox^ cityTextBox; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::TextBox^ stateTextBox; - System::Windows::Forms::TextBox^ zipTextBox; - System::Windows::Forms::HelpProvider^ helpProvider1; - System::Windows::Forms::Label ^ helpLabel; - -public: - Form1() - { - this->addressTextBox = gcnew System::Windows::Forms::TextBox; - this->helpLabel = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->cityTextBox = gcnew System::Windows::Forms::TextBox; - this->label3 = gcnew System::Windows::Forms::Label; - this->stateTextBox = gcnew System::Windows::Forms::TextBox; - this->zipTextBox = gcnew System::Windows::Forms::TextBox; - - // Help Label - this->helpLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - this->helpLabel->Location = System::Drawing::Point( 8, 80 ); - this->helpLabel->Size = System::Drawing::Size( 272, 72 ); - this->helpLabel->Text = "Click the Help button in the title bar, then click a control to see a Help tooltip for the control. Click on a control and press F1 to invoke the Help system with a sample Help file."; - - // Address Label - this->label2->Location = System::Drawing::Point( 16, 8 ); - this->label2->Size = System::Drawing::Size( 100, 16 ); - this->label2->Text = "Address:"; - - // Comma Label - this->label3->Location = System::Drawing::Point( 136, 56 ); - this->label3->Size = System::Drawing::Size( 16, 16 ); - this->label3->Text = ", "; - - // - // Create the HelpProvider. - this->helpProvider1 = gcnew System::Windows::Forms::HelpProvider; - - // - // - // Tell the HelpProvider what controls to provide help for, and - // what the help String* is. - this->helpProvider1->SetShowHelp( this->addressTextBox, true ); - this->helpProvider1->SetHelpString( this->addressTextBox, "Enter the street address in this text box." ); - this->helpProvider1->SetShowHelp( this->cityTextBox, true ); - this->helpProvider1->SetHelpString( this->cityTextBox, "Enter the city here." ); - this->helpProvider1->SetShowHelp( this->stateTextBox, true ); - this->helpProvider1->SetHelpString( this->stateTextBox, "Enter the state in this text box." ); - this->helpProvider1->SetShowHelp( this->zipTextBox, true ); - this->helpProvider1->SetHelpString( this->zipTextBox, "Enter the zip code here." ); - - // - // - // Set what the Help file will be for the HelpProvider. - this->helpProvider1->HelpNamespace = "mspaint.chm"; - - // - // Sets properties for the different address fields. - // Address TextBox - this->addressTextBox->Location = System::Drawing::Point( 16, 24 ); - this->addressTextBox->Size = System::Drawing::Size( 264, 20 ); - this->addressTextBox->TabIndex = 0; - this->addressTextBox->Text = ""; - - // City TextBox - this->cityTextBox->Location = System::Drawing::Point( 16, 48 ); - this->cityTextBox->Size = System::Drawing::Size( 120, 20 ); - this->cityTextBox->TabIndex = 3; - this->cityTextBox->Text = ""; - - // State TextBox - this->stateTextBox->Location = System::Drawing::Point( 152, 48 ); - this->stateTextBox->MaxLength = 2; - this->stateTextBox->Size = System::Drawing::Size( 32, 20 ); - this->stateTextBox->TabIndex = 5; - this->stateTextBox->Text = ""; - - // Zip TextBox - this->zipTextBox->Location = System::Drawing::Point( 192, 48 ); - this->zipTextBox->Size = System::Drawing::Size( 88, 20 ); - this->zipTextBox->TabIndex = 6; - this->zipTextBox->Text = ""; - - // Add the controls to the form. - array^temp0 = {this->zipTextBox,this->stateTextBox,this->label3,this->cityTextBox,this->label2,this->helpLabel,this->addressTextBox}; - this->Controls->AddRange( temp0 ); - - // Set the form to look like a dialog, and show the HelpButton. - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; - this->HelpButton = true; - this->MaximizeBox = false; - this->MinimizeBox = false; - this->ClientSize = System::Drawing::Size( 292, 160 ); - this->Text = "Help Provider Demonstration"; - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp deleted file mode 100644 index 637d6b1b6f1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp +++ /dev/null @@ -1,150 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeHelpProvider(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //TextBox1 - // - this->TextBox1->Location = System::Drawing::Point( 16, 24 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->TabIndex = 0; - this->TextBox1->Text = "Press F1 for help."; - - //Button1 - // - this->Button1->Location = System::Drawing::Point( 160, 24 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 2; - this->Button1->Text = "Button1"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->TextBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - //Declare the HelpProvider. -internal: - System::Windows::Forms::HelpProvider^ HelpProvider1; - -private: - void InitializeHelpProvider() - { - // Construct the HelpProvider Object. - this->HelpProvider1 = gcnew System::Windows::Forms::HelpProvider; - - // Set the HelpNamespace property to the Help file for - // HelpProvider1. - this->HelpProvider1->HelpNamespace = "c:\\windows\\input.chm"; - - // Specify that the Help provider should open to the table - // of contents of the Help file. - this->HelpProvider1->SetHelpNavigator( TextBox1, HelpNavigator::TableOfContents ); - } - // - - // -internal: - System::Windows::Forms::ImageList^ ImageList1; - -private: - - // Create an ImageList Object, populate it, and display - // the images it contains. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Construct the ImageList. - ImageList1 = gcnew ImageList; - - // Set the ImageSize property to a larger size - // (the default is 16 x 16). - ImageList1->ImageSize = System::Drawing::Size( 112, 112 ); - - // Add two images to the list. - ImageList1->Images->Add( Image::FromFile( "c:\\windows\\FeatherTexture.bmp" ) ); - ImageList1->Images->Add( Image::FromFile( "C:\\windows\\Gone Fishing.bmp" ) ); - - // Get a Graphics object from the form's handle. - Graphics^ theGraphics = Graphics::FromHwnd( this->Handle ); - - // Loop through the images in the list, drawing each image. - for ( int count = 0; count < ImageList1->Images->Count; count++ ) - { - ImageList1->Draw( theGraphics, Point(85,85), count ); - - // Call Application.DoEvents to force a repaint of the form. - Application::DoEvents(); - - // Call the Sleep method to allow the user to see the image. - System::Threading::Thread::Sleep( 1000 ); - - } - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp deleted file mode 100644 index 39107faf9a2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp +++ /dev/null @@ -1,211 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System; -using namespace Microsoft::VisualBasic; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - InitializeComponent(); - AddHandlers(); - InitializeFormHelp(); - } - - -public private: - System::Windows::Forms::Label ^ Label1; - System::Windows::Forms::Label ^ Label2; - System::Windows::Forms::Label ^ Label3; - System::Windows::Forms::TextBox^ withdrawal; - System::Windows::Forms::TextBox^ deposit; - System::Windows::Forms::ErrorProvider^ ErrorProvider1; - System::Windows::Forms::Label ^ balance; - System::Windows::Forms::HelpProvider^ HelpProvider1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->withdrawal = gcnew System::Windows::Forms::TextBox; - this->deposit = gcnew System::Windows::Forms::TextBox; - this->Label1 = gcnew System::Windows::Forms::Label; - this->Label2 = gcnew System::Windows::Forms::Label; - this->Label3 = gcnew System::Windows::Forms::Label; - this->ErrorProvider1 = gcnew System::Windows::Forms::ErrorProvider; - this->balance = gcnew System::Windows::Forms::Label; - this->HelpProvider1 = gcnew System::Windows::Forms::HelpProvider; - this->SuspendLayout(); - this->withdrawal->Location = System::Drawing::Point( 32, 200 ); - this->withdrawal->Name = "withdrawal"; - this->withdrawal->Size = System::Drawing::Size( 88, 20 ); - this->withdrawal->TabIndex = 0; - this->withdrawal->Text = ""; - this->deposit->Location = System::Drawing::Point( 168, 200 ); - this->deposit->Name = "deposit"; - this->deposit->TabIndex = 1; - this->deposit->Text = ""; - this->Label1->Location = System::Drawing::Point( 56, 88 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 96, 24 ); - this->Label1->TabIndex = 2; - this->Label1->Text = "Account Balance:"; - this->Label2->Location = System::Drawing::Point( 168, 168 ); - this->Label2->Name = "Label2"; - this->Label2->Size = System::Drawing::Size( 96, 24 ); - this->Label2->TabIndex = 4; - this->Label2->Text = "Deposit:"; - this->Label3->Location = System::Drawing::Point( 32, 168 ); - this->Label3->Name = "Label3"; - this->Label3->Size = System::Drawing::Size( 96, 24 ); - this->Label3->TabIndex = 5; - this->Label3->Text = "Withdrawal:"; - this->ErrorProvider1->ContainerControl = this; - this->balance->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - this->balance->Location = System::Drawing::Point( 152, 88 ); - this->balance->Name = "balance"; - this->balance->TabIndex = 6; - this->balance->Text = "345.65"; - this->balance->TextAlign = System::Drawing::ContentAlignment::MiddleLeft; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->balance ); - this->Controls->Add( this->Label3 ); - this->Controls->Add( this->Label2 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->deposit ); - this->Controls->Add( this->withdrawal ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void AddHandlers() - { - - // Add the event-handler delegates to handled the KeyDown - // events. - deposit->KeyDown += gcnew KeyEventHandler( this, &Form1::ProcessEntry ); - withdrawal->KeyDown += gcnew KeyEventHandler( this, &Form1::ProcessEntry ); - - // Add the event-handler delegates to handled the KeyPress - // events. - deposit->KeyPress += gcnew KeyPressEventHandler( this, &Form1::CheckForDigits ); - withdrawal->KeyPress += gcnew KeyPressEventHandler( this, &Form1::CheckForDigits ); - } - - - // - void InitializeFormHelp() - { - - // Set the form's border to the FixedDialog style. - this->FormBorderStyle = ::FormBorderStyle::FixedDialog; - - // Remove the Maximize and Minimize buttons from the form. - this->MaximizeBox = false; - this->MinimizeBox = false; - - // Add the Help button to the form. - this->HelpButton = true; - - // Set the Help string for the deposit textBox. - HelpProvider1->SetHelpString( deposit, "Enter an amount in the format xxx.xx" - "and press Enter to deposit." ); - - // Set the Help string for the withdrawal textBox. - HelpProvider1->SetHelpString( withdrawal, "Enter an amount in the format xxx.xx" - "and press Enter to withdraw." ); - } - - - - - // - void ProcessEntry( Object^ sender, KeyEventArgs^ e ) - { - - // Cast the sender back to a TextBox. - Control^ textBoxSender = dynamic_cast(sender); - - // Set the error description to an empty string (). - ErrorProvider1->SetError( textBoxSender, "" ); - - // Declare the variable to hold the new balance. - double newBalance = 0; - - // Wrap the code in a Try/Catch block to catch - // errors that can occur when converting the string - // to a double. - try - { - if ( e->KeyCode == Keys::Enter ) - { - if ( textBoxSender->Name->Equals( "withdrawal" ) ) - { - newBalance = Double::Parse( balance->Text ) - Double::Parse( withdrawal->Text ); - withdrawal->Text = ""; - } - else - if ( textBoxSender->Name->Equals( "deposit" ) ) - { - newBalance = Double::Parse( balance->Text ) + Double::Parse( deposit->Text ); - deposit->Text = ""; - } - - // Check the value of new balance and set the - // Forecolor property accordingly. - if ( newBalance < 0 ) - { - balance->ForeColor = Color::Red; - } - else - { - balance->ForeColor = Color::Black; - } - - // Set the text of the balance text box - // to the newBalance value. - balance->Text = newBalance.ToString(); - } - } - catch ( FormatException^ ) - { - - // If a FormatException is thrown, set the - // error string to the HelpString message for - // the control. - ErrorProvider1->SetError( textBoxSender, HelpProvider1->GetHelpString( textBoxSender ) ); - } - - } - - void CheckForDigits( Object^ /*sender*/, KeyPressEventArgs^ e ) - { - - // If the character is not a digit, period, or backspace then - // ignore it by setting the KeyPressEventArgs.Handled - // property to true. - if ( !(Char::IsDigit( e->KeyChar ) || e->KeyChar == '.' || e->KeyChar == (char)(Keys::Back)) ) - { - e->Handled = true; - } - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp deleted file mode 100644 index a0538ce191f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp +++ /dev/null @@ -1,85 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates how setting the -// Label.Autosize property to True will causes the width of -// the label to adjust. -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeLabel(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->SuspendLayout(); - this->ClientSize = System::Drawing::Size( 266, 300 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Declare a label. -internal: - System::Windows::Forms::Label ^ Label1; - -private: - - // Initialize the label. - void InitializeLabel() - { - this->Label1 = gcnew Label; - this->Label1->Location = System::Drawing::Point( 10, 10 ); - this->Label1->Name = "Label1"; - this->Label1->TabIndex = 0; - - // Set the label to a small size, but set the AutoSize property - // to true. The label will adjust its length so all the text - // is visible, however if the label is wider than the form, - // the entire label will not be visible. - this->Label1->Size = System::Drawing::Size( 10, 10 ); - this->Controls->Add( this->Label1 ); - this->Label1->AutoSize = true; - this->Label1->Text = "The text in this label is longer" - " than the set size."; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp deleted file mode 100644 index 8e76df324ea..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Drawing; -using namespace System::Text; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Layout; - -// -// This class demonstrates a simple custom layout engine. -public ref class DemoFlowLayout : public LayoutEngine -{ - // -public: - virtual bool Layout(Object^ container, - LayoutEventArgs^ layoutEventArgs) override - { - Control^ parent = nullptr; - try - { - parent = (Control ^) container; - } - catch (InvalidCastException^ ex) - { - throw gcnew ArgumentException( - "The parameter 'container' must be a control", "container", ex); - } - // Use DisplayRectangle so that parent.Padding is honored. - Rectangle parentDisplayRectangle = parent->DisplayRectangle; - Point nextControlLocation = parentDisplayRectangle.Location; - - for each (Control^ currentControl in parent->Controls) - { - // Only apply layout to visible controls. - if (!currentControl->Visible) - { - continue; - } - - // Respect the margin of the control: - // shift over the left and the top. - nextControlLocation.Offset(currentControl->Margin.Left, - currentControl->Margin.Top); - - // Set the location of the control. - currentControl->Location = nextControlLocation; - - // Set the autosized controls to their - // autosized heights. - if (currentControl->AutoSize) - { - currentControl->Size = currentControl->GetPreferredSize( - parentDisplayRectangle.Size); - } - - // Move X back to the display rectangle origin. - nextControlLocation.X = parentDisplayRectangle.X; - - // Increment Y by the height of the control - // and the bottom margin. - nextControlLocation.Y += currentControl->Height + - currentControl->Margin.Bottom; - } - - // Optional: Return whether or not the container's - // parent should perform layout as a result of this - // layout. Some layout engines return the value of - // the container's AutoSize property. - - return false; - } - // -}; -// - -// -// This class demonstrates a simple custom layout panel. -// It overrides the LayoutEngine property of the Panel -// control to provide a custom layout engine. -public ref class DemoFlowPanel : public Panel -{ -private: - DemoFlowLayout^ layoutEngine; - -public: - DemoFlowPanel() - { - layoutEngine = gcnew DemoFlowLayout(); - } - -public: - virtual property System::Windows::Forms::Layout::LayoutEngine^ LayoutEngine - { - System::Windows::Forms::Layout::LayoutEngine^ get() override - { - if (layoutEngine == nullptr) - { - layoutEngine = gcnew DemoFlowLayout(); - } - - return layoutEngine; - } - } -}; -// - -// - -public ref class TestForm : public Form -{ -public: - TestForm() - { - Panel^ testPanel = gcnew DemoFlowPanel(); - for (int i = 0; i < 10; i ++) - { - Button^ b = gcnew Button(); - testPanel->Controls->Add(b); - b->Text = i.ToString( - System::Globalization::CultureInfo::CurrentCulture); - } - this->Controls->Add(testPanel); - } -}; - -[STAThread] -int main() -{ - Application::Run(gcnew TestForm()); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp deleted file mode 100644 index 7360c1f90e2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp +++ /dev/null @@ -1,100 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::LinkLabel^ linkLabel1; - -public: - Form1() - { - - // Create the LinkLabel. - this->linkLabel1 = gcnew System::Windows::Forms::LinkLabel; - - // Configure the LinkLabel's size and location. Specify that the - // size should be automatically determined by the content. - this->linkLabel1->Location = System::Drawing::Point( 34, 56 ); - this->linkLabel1->Size = System::Drawing::Size( 224, 16 ); - this->linkLabel1->AutoSize = true; - - // Configure the appearance. - this->linkLabel1->DisabledLinkColor = System::Drawing::Color::Red; - this->linkLabel1->VisitedLinkColor = System::Drawing::Color::Blue; - this->linkLabel1->LinkBehavior = System::Windows::Forms::LinkBehavior::HoverUnderline; - this->linkLabel1->LinkColor = System::Drawing::Color::Navy; - this->linkLabel1->TabIndex = 0; - this->linkLabel1->TabStop = true; - - // Add an event handler to do something when the links are clicked. - this->linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler( this, &Form1::linkLabel1_LinkClicked ); - - // Identify what the first Link is. - this->linkLabel1->LinkArea = System::Windows::Forms::LinkArea( 0, 8 ); - - // Identify that the first link is visited already. - this->linkLabel1->Links[ 0 ]->Visited = true; - - // Set the Text property to a String*. - this->linkLabel1->Text = "Register Online. Visit Microsoft. Visit MSN."; - - // Create new links using the Add method of the LinkCollection class. - // Underline the appropriate words in the LinkLabel's Text property. - // The words 'Register', 'Microsoft', and 'MSN' will - // all be underlined and behave as hyperlinks. - // First check that the Text property is long enough to accommodate - // the desired hyperlinked areas. If it's not, don't add hyperlinks. - if ( this->linkLabel1->Text->Length >= 45 ) - { - this->linkLabel1->Links[ 0 ]->LinkData = "Register"; - this->linkLabel1->Links->Add( 24, 9, "www.microsoft.com" ); - this->linkLabel1->Links->Add( 42, 3, "www.msn.com" ); - this->linkLabel1->Links[ 1 ]->Enabled = false; - } - - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->linkLabel1}; - this->Controls->AddRange( temp0 ); - this->Text = "Link Label Example"; - } - - -private: - void linkLabel1_LinkClicked( Object^ /*sender*/, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e ) - { - // Determine which link was clicked within the LinkLabel. - this->linkLabel1->Links[ linkLabel1->Links->IndexOf( e->Link ) ]->Visited = true; - - // Display the appropriate link based on the value of the - // LinkData property of the Link Object*. - String^ target = dynamic_cast(e->Link->LinkData); - - // If the value looks like a URL, navigate to it. - // Otherwise, display it in a message box. - if ( nullptr != target && target->StartsWith( "www" ) ) - { - System::Diagnostics::Process::Start( target ); - } - else - { - MessageBox::Show( "Item clicked: {0}", target ); - } - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp deleted file mode 100644 index 45baa8a47d5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp +++ /dev/null @@ -1,138 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeLinkLabel(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 272, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - // - // Declare the LinkLabel object. -internal: - System::Windows::Forms::LinkLabel^ LinkLabel1; - - // Declare keywords array to identify links - array^keywords; - -private: - void InitializeLinkLabel() - { - this->LinkLabel1 = gcnew System::Windows::Forms::LinkLabel; - this->LinkLabel1->Links->Clear(); - // Set the location, name and size. - this->LinkLabel1->Location = System::Drawing::Point( 10, 20 ); - this->LinkLabel1->Name = "CompanyLinks"; - this->LinkLabel1->Size = System::Drawing::Size( 104, 150 ); - - // Set the LinkBehavior property to show underline when mouse - // hovers over the links. - this->LinkLabel1->LinkBehavior = System::Windows::Forms::LinkBehavior::HoverUnderline; - String^ textString = "For more information see our" - " company website or the research page at Contoso Ltd. "; - - // Set the text property. - this->LinkLabel1->Text = textString; - - // Set the color of the links to black, unless the mouse - // is hovering over a link. - this->LinkLabel1->LinkColor = System::Drawing::Color::Black; - this->LinkLabel1->ActiveLinkColor = System::Drawing::Color::Blue; - - // Associate the event-handling method with the LinkClicked - // event. - this->LinkLabel1->LinkClicked += gcnew LinkLabelLinkClickedEventHandler( this, &Form1::LinkLabel1_LinkClicked ); - - // Add links to the LinkCollection using starting index and - // length of keywords. - array^temp0 = {"company","research"}; - keywords = temp0; - System::Collections::IEnumerator^ myEnum = keywords->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ keyword = safe_cast(myEnum->Current); - this->LinkLabel1->Links->Add( textString->IndexOf( keyword ), keyword->Length ); - } - - - // Add the label to the form. - this->Controls->Add( this->LinkLabel1 ); - } - - void LinkLabel1_LinkClicked( Object^ /*sender*/, LinkLabelLinkClickedEventArgs^ e ) - { - String^ url = ""; - - // Determine which link was clicked and set the appropriate url. - switch ( LinkLabel1->Links->IndexOf( e->Link ) ) - { - case 0: - url = "www.microsoft.com"; - break; - - case 1: - url = "www.contoso.com/research"; - break; - } - - // Set the visited property to True. This will change - // the color of the link. - e->Link->Visited = true; - - // Open Internet Explorer to the correct url. - System::Diagnostics::Process::Start( "IExplore.exe", url ); - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp deleted file mode 100644 index b38686bc5a6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp +++ /dev/null @@ -1,152 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeOwnerDrawnListBox(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->SuspendLayout(); - - // - //ListBox1 - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -internal: - System::Windows::Forms::ListBox^ ListBox1; - -private: - void InitializeOwnerDrawnListBox() - { - this->ListBox1 = gcnew System::Windows::Forms::ListBox; - - // Set the location and size. - ListBox1->Location = Point(20,20); - ListBox1->Size = System::Drawing::Size( 240, 240 ); - - // Populate the ListBox.ObjectCollection property - // with several strings, using the AddRange method. - array^temp0 = {"System.Windows.Forms","System.Drawing","System.Xml","System.Net","System.Runtime.Remoting","System.Web"}; - this->ListBox1->Items->AddRange( temp0 ); - - // Turn off the scrollbar. - ListBox1->ScrollAlwaysVisible = false; - - // Set the border style to a single, flat border. - ListBox1->BorderStyle = BorderStyle::FixedSingle; - - // Set the DrawMode property to the OwnerDrawVariable value. - // This means the MeasureItem and DrawItem events must be - // handled. - ListBox1->DrawMode = DrawMode::OwnerDrawVariable; - ListBox1->MeasureItem += gcnew MeasureItemEventHandler( this, &Form1::ListBox1_MeasureItem ); - ListBox1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::ListBox1_DrawItem ); - this->Controls->Add( this->ListBox1 ); - } - - // Handle the DrawItem event for an owner-drawn ListBox. - void ListBox1_DrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) - { - // If the item is the selected item, then draw the rectangle - // filled in blue. The item is selected when a bitwise And - // of the State property and the DrawItemState.Selected - // property is true. - if ( (e->State & DrawItemState::Selected) == DrawItemState::Selected ) - { - e->Graphics->FillRectangle( Brushes::CornflowerBlue, e->Bounds ); - } - else - { - - // Otherwise, draw the rectangle filled in beige. - e->Graphics->FillRectangle( Brushes::Beige, e->Bounds ); - } - - // Draw a rectangle in blue around each item. - e->Graphics->DrawRectangle( Pens::Blue, e->Bounds ); - - // Draw the text in the item. - e->Graphics->DrawString( ListBox1->Items[ e->Index ]->ToString(), this->Font, Brushes::Black, (float)e->Bounds.X, (float)e->Bounds.Y ); - - // Draw the focus rectangle around the selected item. - e->DrawFocusRectangle(); - } - - - // Handle the MeasureItem event for an owner-drawn ListBox. - void ListBox1_MeasureItem( Object^ sender, MeasureItemEventArgs^ e ) - { - - // Cast the sender object back to ListBox type. - ListBox^ theListBox = dynamic_cast(sender); - - // Get the string contained in each item. - String^ itemString = dynamic_cast(theListBox->Items[ e->Index ]); - - // Split the string at the " . " character. - array^temp1 = {'.'}; - array^resultStrings = itemString->Split( temp1 ); - - // If the string contains more than one period, increase the - // height by ten pixels; otherwise, increase the height by - // five pixels. - if ( resultStrings->Length > 2 ) - { - e->ItemHeight += 10; - } - else - { - e->ItemHeight += 5; - } - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp deleted file mode 100644 index 56d2b0ad062..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp +++ /dev/null @@ -1,105 +0,0 @@ - - -#using -#using -#using - -// -// The following code example demonstrates using the ListBox.Sort method -// by inheriting from the ListBox class and overriding the Sort method. -using namespace System::Drawing; -using namespace System::Windows::Forms; - -// This class inherits from ListBox and implements a different -// sorting method. Sort will be called by setting the class's Sorted -// property to True. -public ref class SortByLengthListBox: public ListBox -{ -public: - SortByLengthListBox() - : ListBox() - {} - -protected: - - // Overrides the parent class Sort to perform a simple - // bubble sort on the length of the string contained in each item. - virtual void Sort() override - { - if ( Items->Count > 1 ) - { - bool swapped; - do - { - int counter = Items->Count - 1; - swapped = false; - while ( counter > 0 ) - { - - // Compare the items' length. - if ( Items[ counter ]->ToString()->Length < Items[ counter - 1 ]->ToString()->Length ) - { - - // Swap the items. - Object^ temp = Items[ counter ]; - Items[ counter ] = Items[ counter - 1 ]; - Items[ counter - 1 ] = temp; - swapped = true; - } - - // Decrement the counter. - counter -= 1; - } - } - while ( swapped ); - } - } -}; - -public ref class Form1: public System::Windows::Forms::Form -{ -internal: - System::Windows::Forms::Button^ Button1; - SortByLengthListBox^ sortingBox; - -public: - Form1() - : Form() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->sortingBox = gcnew SortByLengthListBox; - this->SuspendLayout(); - this->Button1->Location = System::Drawing::Point( 64, 16 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 176, 23 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click me for list sorted by length"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - array^temp0 = {"System","System.Windows.Forms","System.Xml","System.Net","System.Drawing","System.IO"}; - this->sortingBox->Items->AddRange( temp0 ); - this->sortingBox->Location = System::Drawing::Point( 72, 48 ); - this->sortingBox->Size = System::Drawing::Size( 120, 95 ); - this->sortingBox->TabIndex = 1; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->sortingBox ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Sort Example"; - this->ResumeLayout( false ); - } - -private: - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Set the Sorted property to True to raise the overridden Sort - // method. - sortingBox->Sorted = true; - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp deleted file mode 100644 index 426680cb59a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp +++ /dev/null @@ -1,258 +0,0 @@ - - -// -#using -#using -#using -#using -using namespace System; -using namespace System::Collections; -using namespace System::Windows::Forms; - -public ref class ListViewGroupsExample : public Form -{ -private: - ListView^ myListView; - bool isRunningXPOrLater; - - // Declare a Hashtable array in which to store the groups. - array^ groupTables; - - // Declare a variable to store the current grouping column. - int groupColumn; - -public: - ListViewGroupsExample() - { - groupColumn = 0; - // Initialize myListView. - myListView = gcnew ListView(); - myListView->Dock = DockStyle::Fill; - myListView->View = View::Details; - myListView->Sorting = SortOrder::Ascending; - - // Create and initialize column headers for myListView. - ColumnHeader^ columnHeader0 = gcnew ColumnHeader(); - columnHeader0->Text = "Title"; - columnHeader0->Width = -1; - ColumnHeader^ columnHeader1 = gcnew ColumnHeader(); - columnHeader1->Text = "Author"; - columnHeader1->Width = -1; - ColumnHeader^ columnHeader2 = gcnew ColumnHeader(); - columnHeader2->Text = "Year"; - columnHeader2->Width = -1; - - // Add the column headers to myListView. - - array^ temp0 = {columnHeader0, columnHeader1, columnHeader2}; - myListView->Columns->AddRange(temp0); - - // Add a handler for the ColumnClick event. - myListView->ColumnClick += - gcnew ColumnClickEventHandler(this, &ListViewGroupsExample::myListView_ColumnClick); - - // Create items and add them to myListView. - - array^ temp1 = {"Programming Windows", "Petzold, Charles", "1998"}; - ListViewItem^ item0 = gcnew ListViewItem( temp1 ); - - array^ temp2 = {"Code: The Hidden Language of Computer Hardware and Software", - "Petzold, Charles", "2000"}; - ListViewItem^ item1 = gcnew ListViewItem( temp2 ); - - array^ temp3 = {"Programming Windows with C#", "Petzold, Charles", "2001"}; - ListViewItem^ item2 = gcnew ListViewItem( temp3 ); - - array^ temp4 = {"Coding Techniques for Microsoft Visual Basic .NET", - "Connell, John", "2001"}; - ListViewItem^ item3 = gcnew ListViewItem( temp4 ); - - array^ temp5 = {"C# for Java Developers", "Jones, Allen & Freeman, Adam", - "2002"}; - ListViewItem^ item4 = gcnew ListViewItem( temp5 ); - - array^ temp6 = {"Microsoft .NET XML Web Services Step by Step", - "Jones, Allen & Freeman, Adam", "2002"}; - ListViewItem^ item5 = gcnew ListViewItem( temp6 ); - - array^ temp7 = {item0, item1, item2, item3, item4, item5}; - myListView->Items->AddRange( temp7 ); - - // Determine whether Windows XP or a later - // operating system is present. - isRunningXPOrLater = false; - - if (System::Environment::OSVersion->Version->Major > 5 || - ( System::Environment::OSVersion->Version->Major == 5 && - System::Environment::OSVersion->Version->Minor >= 1) ) - { - isRunningXPOrLater = true; - } - - if (isRunningXPOrLater) - { - // Create the groupsTable array and populate it with one - // hash table for each column. - groupTables = gcnew array(myListView->Columns->Count); - for (int column = 0; column < myListView->Columns->Count; column++) - { - // Create a hash table containing all the groups - // needed for a single column. - groupTables[column] = CreateGroupsTable(column); - } - - // Start with the groups created for the Title column. - SetGroups(0); - } - - // Initialize the form. - this->Controls->Add(myListView); - this->Size = System::Drawing::Size(550, 330); - this->Text = "ListView Groups Example"; - } - - // Groups the items using the groups created for the clicked - // column. -private: - void myListView_ColumnClick( - Object^ /*sender*/, ColumnClickEventArgs^ e) - { - // Set the sort order to ascending when changing - // column groups; otherwise, reverse the sort order. - if ( myListView->Sorting == SortOrder::Descending || - ( isRunningXPOrLater && (e->Column != groupColumn) ) ) - { - myListView->Sorting = SortOrder::Ascending; - } - else - { - myListView->Sorting = SortOrder::Descending; - } - groupColumn = e->Column; - - // Set the groups to those created for the clicked column. - if (isRunningXPOrLater) - { - SetGroups(e->Column); - } - } - - // - // Sets myListView to the groups created for the specified column. -private: - void SetGroups(int column) - { - // Remove the current groups. - myListView->Groups->Clear(); - - // Retrieve the hash table corresponding to the column. - Hashtable^ groups = dynamic_cast(groupTables[column]); - - // Copy the groups for the column to an array. - array^ groupsArray = gcnew array(groups->Count); - groups->Values->CopyTo(groupsArray, 0); - - // Sort the groups and add them to myListView. - Array::Sort(groupsArray, gcnew ListViewGroupSorter(myListView->Sorting)); - myListView->Groups->AddRange(groupsArray); - - // Iterate through the items in myListView, assigning each - // one to the appropriate group. - IEnumerator^ myEnum = myListView->Items->GetEnumerator(); - while (myEnum->MoveNext()) - { - ListViewItem^ item = safe_cast(myEnum->Current); - // Retrieve the subitem text corresponding to the column. - String^ subItemText = item->SubItems[column]->Text; - - // For the Title column, use only the first letter. - if (column == 0) - { - subItemText = subItemText->Substring(0, 1); - } - - // Assign the item to the matching group. - item->Group = dynamic_cast(groups[subItemText]); - } - } - // - - // - // Creates a Hashtable object with one entry for each unique - // subitem value (or initial letter for the parent item) - // in the specified column. -private: - Hashtable^ CreateGroupsTable(int column) - { - // Create a Hashtable object. - Hashtable^ groups = gcnew Hashtable(); - - // Iterate through the items in myListView. - IEnumerator^ myEnum1 = myListView->Items->GetEnumerator(); - while (myEnum1->MoveNext()) - { - ListViewItem^ item = safe_cast(myEnum1->Current); - // Retrieve the text value for the column. - String^ subItemText = item->SubItems[column]->Text; - - // Use the initial letter instead if it is the first column. - if (column == 0) - { - subItemText = subItemText->Substring(0, 1); - } - - // If the groups table does not already contain a group - // for the subItemText value, add a new group using the - // subItemText value for the group header and Hashtable key. - if (!groups->Contains(subItemText)) - { - groups->Add( subItemText, gcnew ListViewGroup(subItemText, - HorizontalAlignment::Left) ); - } - } - - // Return the Hashtable object. - return groups; - } - // - - // Sorts ListViewGroup objects by header value. - ref class ListViewGroupSorter : public IComparer - { - private: - SortOrder order; - - // Stores the sort order. - public: - ListViewGroupSorter(SortOrder theOrder) - { - order = theOrder; - } - - // Compares the groups by header value, using the saved sort - // order to return the correct value. - virtual int Compare(Object^ x, Object^ y) - { - int result = String::Compare( - (dynamic_cast(x))->Header, - (dynamic_cast(y))->Header - ); - if (order == SortOrder::Ascending) - { - return result; - } - else - { - return -result; - } - } - }; -}; - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew ListViewGroupsExample()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp deleted file mode 100644 index 0e1cfe242aa..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp +++ /dev/null @@ -1,160 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class ListViewInsertionMarkExample: public Form -{ -private: - ListView^ myListView; - -public: - - // - ListViewInsertionMarkExample() - { - // Initialize myListView. - myListView = gcnew ListView; - myListView->Dock = DockStyle::Fill; - myListView->View = View::LargeIcon; - myListView->MultiSelect = false; - myListView->ListViewItemSorter = gcnew ListViewIndexComparer; - - // Initialize the insertion mark. - myListView->InsertionMark->Color = Color::Green; - - // Add items to myListView. - myListView->Items->Add( "zero" ); - myListView->Items->Add( "one" ); - myListView->Items->Add( "two" ); - myListView->Items->Add( "three" ); - myListView->Items->Add( "four" ); - myListView->Items->Add( "five" ); - - // Initialize the drag-and-drop operation when running - // under Windows XP or a later operating system. - if ( System::Environment::OSVersion->Version->Major > 5 || (System::Environment::OSVersion->Version->Major == 5 && System::Environment::OSVersion->Version->Minor >= 1) ) - { - myListView->AllowDrop = true; - myListView->ItemDrag += gcnew ItemDragEventHandler( this, &ListViewInsertionMarkExample::myListView_ItemDrag ); - myListView->DragEnter += gcnew DragEventHandler( this, &ListViewInsertionMarkExample::myListView_DragEnter ); - myListView->DragOver += gcnew DragEventHandler( this, &ListViewInsertionMarkExample::myListView_DragOver ); - myListView->DragLeave += gcnew EventHandler( this, &ListViewInsertionMarkExample::myListView_DragLeave ); - myListView->DragDrop += gcnew DragEventHandler( this, &ListViewInsertionMarkExample::myListView_DragDrop ); - } - - // Initialize the form. - this->Text = "ListView Insertion Mark Example"; - this->Controls->Add( myListView ); - } - -private: - - // - // Starts the drag-and-drop operation when an item is dragged. - void myListView_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^ e ) - { - myListView->DoDragDrop( e->Item, DragDropEffects::Move ); - } - - // Sets the target drop effect. - void myListView_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) - { - e->Effect = e->AllowedEffect; - } - - // - // Moves the insertion mark as the item is dragged. - void myListView_DragOver( Object^ /*sender*/, DragEventArgs^ e ) - { - // Retrieve the client coordinates of the mouse pointer. - Point targetPoint = myListView->PointToClient( Point(e->X,e->Y) ); - - // Retrieve the index of the item closest to the mouse pointer. - int targetIndex = myListView->InsertionMark->NearestIndex( targetPoint ); - - // Confirm that the mouse pointer is not over the dragged item. - if ( targetIndex > -1 ) - { - // Determine whether the mouse pointer is to the left or - // the right of the midpoint of the closest item and set - // the InsertionMark.AppearsAfterItem property accordingly. - Rectangle itemBounds = myListView->GetItemRect( targetIndex ); - if ( targetPoint.X > itemBounds.Left + (itemBounds.Width / 2) ) - { - myListView->InsertionMark->AppearsAfterItem = true; - } - else - { - myListView->InsertionMark->AppearsAfterItem = false; - } - } - - // Set the location of the insertion mark. If the mouse is - // over the dragged item, the targetIndex value is -1 and - // the insertion mark disappears. - myListView->InsertionMark->Index = targetIndex; - } - - // - // Removes the insertion mark when the mouse leaves the control. - void myListView_DragLeave( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myListView->InsertionMark->Index = -1; - } - - // Moves the item to the location of the insertion mark. - void myListView_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) - { - // Retrieve the index of the insertion mark; - int targetIndex = myListView->InsertionMark->Index; - - // If the insertion mark is not visible, exit the method. - if ( targetIndex == -1 ) - { - return; - } - - // If the insertion mark is to the right of the item with - // the corresponding index, increment the target index. - if ( myListView->InsertionMark->AppearsAfterItem ) - { - targetIndex++; - } - - // Retrieve the dragged item. - ListViewItem^ draggedItem = dynamic_cast(e->Data->GetData( ListViewItem::typeid )); - - // Insert a copy of the dragged item at the target index. - // A copy must be inserted before the original item is removed - // to preserve item index values. - myListView->Items->Insert( targetIndex, dynamic_cast(draggedItem->Clone()) ); - - // Remove the original copy of the dragged item. - myListView->Items->Remove( draggedItem ); - - } - - // Sorts ListViewItem objects by index. - ref class ListViewIndexComparer: public System::Collections::IComparer - { - public: - virtual int Compare( Object^ x, Object^ y ) - { - return (dynamic_cast(x))->Index - (dynamic_cast(y))->Index; - } - }; -}; - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew ListViewInsertionMarkExample ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp deleted file mode 100644 index aca66507837..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp +++ /dev/null @@ -1,88 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class ListViewTilingExample: public Form -{ -private: - ImageList^ myImageList; - -public: - ListViewTilingExample() - { - // Initialize myListView. - ListView^ myListView = gcnew ListView; - myListView->Dock = DockStyle::Fill; - myListView->View = View::Tile; - - // Initialize the tile size. - myListView->TileSize = System::Drawing::Size( 400, 45 ); - - // Initialize the item icons. - myImageList = gcnew ImageList; - System::Drawing::Icon^ myIcon = gcnew System::Drawing::Icon( "book.ico" ); - try - { - myImageList->Images->Add( myIcon ); - } - finally - { - if ( myIcon ) - delete safe_cast(myIcon); - } - - myImageList->ImageSize = System::Drawing::Size( 32, 32 ); - myListView->LargeImageList = myImageList; - - // Add column headers so the subitems will appear. - array^temp0 = {gcnew ColumnHeader,gcnew ColumnHeader,gcnew ColumnHeader}; - myListView->Columns->AddRange( temp0 ); - - // Create items and add them to myListView. - array^temp1 = {"Programming Windows","Petzold, Charles","1998"}; - ListViewItem^ item0 = gcnew ListViewItem( temp1,0 ); - array^temp2 = {"Code: The Hidden Language of Computer Hardware and Software","Petzold, Charles","2000"}; - ListViewItem^ item1 = gcnew ListViewItem( temp2,0 ); - array^temp3 = {"Programming Windows with C#","Petzold, Charles","2001"}; - ListViewItem^ item2 = gcnew ListViewItem( temp3,0 ); - array^temp4 = {"Coding Techniques for Microsoft Visual Basic .NET","Connell, John","2001"}; - ListViewItem^ item3 = gcnew ListViewItem( temp4,0 ); - array^temp5 = {"C# for Java Developers","Jones, Allen & Freeman, Adam","2002"}; - ListViewItem^ item4 = gcnew ListViewItem( temp5,0 ); - array^temp6 = {"Microsoft .NET XML Web Services Step by Step","Jones, Allen & Freeman, Adam","2002"}; - ListViewItem^ item5 = gcnew ListViewItem( temp6,0 ); - array^temp7 = {item0,item1,item2,item3,item4,item5}; - myListView->Items->AddRange( temp7 ); - - // Initialize the form. - this->Controls->Add( myListView ); - this->Size = System::Drawing::Size( 430, 330 ); - this->Text = "ListView Tiling Example"; - } - -protected: - - // Clean up any resources being used. - ~ListViewTilingExample() - { - if ( myImageList != nullptr ) - { - delete myImageList; - } - } -}; - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run( gcnew ListViewTilingExample ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp deleted file mode 100644 index c798f694428..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp +++ /dev/null @@ -1,153 +0,0 @@ - - -// The following Snippet code example demonstrates using the: -// ListView.MultiSelect, ListView.SelectedItems, -// ListView.SelectIndices, SelectedIndexCollection, -// SelectedListViewItemCollection ListView.SelectedIndexChanged event, -// and ListView.HeaderStyle members and the SelectedIndexCollection and -// SelectedListViewItemCollection classes. -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - InitializeComponent(); - InitializeListView(); - HookupEvents(); - } - -internal: - System::Windows::Forms::ListView^ ListView1; - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::Label ^ Label1; - -private: - void InitializeComponent() - { - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - this->TextBox1->Location = System::Drawing::Point( 88, 168 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 120, 20 ); - this->TextBox1->TabIndex = 1; - this->TextBox1->Text = ""; - this->Label1->Location = System::Drawing::Point( 32, 168 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 48, 23 ); - this->Label1->TabIndex = 2; - this->Label1->Text = "Total: $"; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->TextBox1 ); - this->Name = "Form1"; - this->Text = "Breakfast Menu"; - this->ResumeLayout( false ); - } - - // - // This method adds two columns to the ListView, setting the Text - // and TextAlign, and Width properties of each ColumnHeader. The - // HeaderStyle property is set to NonClickable since the ColumnClick - // event is not handled. Finally the method adds ListViewItems and - // SubItems to each column. - void InitializeListView() - { - this->ListView1 = gcnew System::Windows::Forms::ListView; - this->ListView1->BackColor = System::Drawing::SystemColors::Control; - this->ListView1->Dock = System::Windows::Forms::DockStyle::Top; - this->ListView1->Location = System::Drawing::Point( 0, 0 ); - this->ListView1->Name = "ListView1"; - this->ListView1->Size = System::Drawing::Size( 292, 130 ); - this->ListView1->TabIndex = 0; - this->ListView1->View = System::Windows::Forms::View::Details; - this->ListView1->MultiSelect = true; - this->ListView1->HideSelection = false; - this->ListView1->HeaderStyle = ColumnHeaderStyle::Nonclickable; - ColumnHeader^ columnHeader1 = gcnew ColumnHeader; - columnHeader1->Text = "Breakfast Item"; - columnHeader1->TextAlign = HorizontalAlignment::Left; - columnHeader1->Width = 146; - ColumnHeader^ columnHeader2 = gcnew ColumnHeader; - columnHeader2->Text = "Price Each"; - columnHeader2->TextAlign = HorizontalAlignment::Center; - columnHeader2->Width = 142; - this->ListView1->Columns->Add( columnHeader1 ); - this->ListView1->Columns->Add( columnHeader2 ); - array^foodList = {"Juice","Coffee","Cereal & Milk","Fruit Plate","Toast & Jelly","Bagel & Cream Cheese"}; - array^foodPrice = {"1.09","1.09","2.19","2.49","1.49","1.49"}; - for ( int count = 0; count < foodList->Length; count++ ) - { - ListViewItem^ listItem = gcnew ListViewItem( foodList[ count ] ); - listItem->SubItems->Add( foodPrice[ count ] ); - ListView1->Items->Add( listItem ); - - } - this->Controls->Add( ListView1 ); - } - // - - void HookupEvents() - { - this->ListView1->SelectedIndexChanged += gcnew EventHandler( this, &Form1::ListView1_SelectedIndexChanged_UsingItems ); - this->ListView1->SelectedIndexChanged += gcnew EventHandler( this, &Form1::ListView1_SelectedIndexChanged_UsingIndices ); - } - - // You can access the selected items directly with the SelectedItems - // property or you can access them through the items' indices, - // using the SelectedIndices property. The following methods show - // the two approaches. - // - // Uses the SelectedItems property to retrieve and tally the price - // of the selected menu items. - void ListView1_SelectedIndexChanged_UsingItems( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ListView::SelectedListViewItemCollection^ breakfast = this->ListView1->SelectedItems; - double price = 0.0; - System::Collections::IEnumerator^ myEnum = breakfast->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ListViewItem^ item = safe_cast(myEnum->Current); - price += Double::Parse( item->SubItems[ 1 ]->Text ); - } - - // Output the price to TextBox1. - TextBox1->Text = price.ToString(); - } - // - - // - // Uses the SelectedIndices property to retrieve and tally the - // price of the selected menu items. - void ListView1_SelectedIndexChanged_UsingIndices( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - ListView::SelectedIndexCollection^ indexes = this->ListView1->SelectedIndices; - double price = 0.0; - System::Collections::IEnumerator^ myEnum1 = indexes->GetEnumerator(); - while ( myEnum1->MoveNext() ) - { - int index = safe_cast(myEnum1->Current); - price += Double::Parse( this->ListView1->Items[ index ]->SubItems[ 1 ]->Text ); - } - - - // Output the price to TextBox1. - TextBox1->Text = price.ToString(); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp deleted file mode 100644 index 076b17028f6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp +++ /dev/null @@ -1,170 +0,0 @@ - - -// The following code example demonstrates using the ListView.CheckedItems, -// CheckedItem.CheckState, ListView.BeginUpdate, and ListView.EndUpdate -// members, along with instances of the ListViewCheckedItemCollection, -// and ItemCheckEventArgs classes -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - InitializeComponent(); - InitializeListView(); - - // Connect the events with the methods that handle them. - this->ListView1->ItemCheck += gcnew ItemCheckEventHandler( this, &Form1::ListView1_ItemCheck1 ); - this->ListView1->ItemCheck += gcnew ItemCheckEventHandler( this, &Form1::ListView1_ItemCheck2 ); - } - -internal: - System::Windows::Forms::ListView^ ListView1; - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::Label ^ Label1; - -private: - void InitializeComponent() - { - price = 0.0; - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - this->TextBox1->Location = System::Drawing::Point( 88, 168 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 120, 20 ); - this->TextBox1->TabIndex = 1; - this->TextBox1->Text = ""; - this->Label1->Location = System::Drawing::Point( 32, 168 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 48, 23 ); - this->Label1->TabIndex = 2; - this->Label1->Text = "Total: $"; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->TextBox1 ); - this->Name = "Form1"; - this->Text = "Breakfast Menu"; - this->ResumeLayout( false ); - } - - // - void InitializeListView() - { - this->ListView1 = gcnew System::Windows::Forms::ListView; - - // Set properties such as BackColor and DockStyle and Location. - this->ListView1->BackColor = System::Drawing::SystemColors::Control; - this->ListView1->Dock = System::Windows::Forms::DockStyle::Top; - this->ListView1->Location = System::Drawing::Point( 0, 0 ); - this->ListView1->Size = System::Drawing::Size( 292, 130 ); - this->ListView1->View = System::Windows::Forms::View::Details; - this->ListView1->HideSelection = false; - - // Allow the user to select multiple items. - this->ListView1->MultiSelect = true; - - // Show CheckBoxes in the ListView. - this->ListView1->CheckBoxes = true; - - //Set the column headers and populate the columns. - ListView1->HeaderStyle = ColumnHeaderStyle::Nonclickable; - ColumnHeader^ columnHeader1 = gcnew ColumnHeader; - columnHeader1->Text = "Breakfast Choices"; - columnHeader1->TextAlign = HorizontalAlignment::Left; - columnHeader1->Width = 146; - ColumnHeader^ columnHeader2 = gcnew ColumnHeader; - columnHeader2->Text = "Price Each"; - columnHeader2->TextAlign = HorizontalAlignment::Center; - columnHeader2->Width = 142; - this->ListView1->Columns->Add( columnHeader1 ); - this->ListView1->Columns->Add( columnHeader2 ); - array^foodList = {"Juice","Coffee","Cereal & Milk","Fruit Plate","Toast & Jelly","Bagel & Cream Cheese"}; - array^foodPrice = {"1.09","1.09","2.19","2.79","2.09","2.69"}; - int count; - - // Members are added one at a time, so call BeginUpdate to ensure - // the list is painted only once, rather than as each list item is added. - ListView1->BeginUpdate(); - for ( count = 0; count < foodList->Length; count++ ) - { - ListViewItem^ listItem = gcnew ListViewItem( foodList[ count ] ); - listItem->SubItems->Add( foodPrice[ count ] ); - ListView1->Items->Add( listItem ); - } - - //Call EndUpdate when you finish adding items to the ListView. - ListView1->EndUpdate(); - this->Controls->Add( this->ListView1 ); - } - // - - // - double price; - - // Handles the ItemCheck event. The method uses the CurrentValue - // property of the ItemCheckEventArgs to retrieve and tally the - // price of the menu items selected. - void ListView1_ItemCheck1( Object^ /*sender*/, System::Windows::Forms::ItemCheckEventArgs^ e ) - { - if ( e->CurrentValue == CheckState::Unchecked ) - { - price += Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); - } - else - if ( (e->CurrentValue == CheckState::Checked) ) - { - price -= Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); - } - - - - // Output the price to TextBox1. - TextBox1->Text = price.ToString(); - } - // - - // - // Handles the ItemChecked event. The method loops through all the - // checked items and tallies a new price each time an item is - // checked or unchecked. It outputs the price to TextBox1. - void ListView1_ItemCheck2( Object^ /*sender*/, System::Windows::Forms::ItemCheckEventArgs^ e ) - { - double price = 0.0; - ListView::CheckedListViewItemCollection^ checkedItems = ListView1->CheckedItems; - System::Collections::IEnumerator^ myEnum = checkedItems->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - ListViewItem^ item = safe_cast(myEnum->Current); - price += Double::Parse( item->SubItems[ 1 ]->Text ); - } - - if ( e->CurrentValue == CheckState::Unchecked ) - { - price += Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); - } - else - if ( (e->CurrentValue == CheckState::Checked) ) - { - price -= Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); - } - - // Output the price to TextBox1. - TextBox1->Text = price.ToString(); - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp deleted file mode 100644 index a63dbc58244..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp +++ /dev/null @@ -1,81 +0,0 @@ -// The following code example handles the ListView.BeforeLabelEdit event -// and demonstrates the EditLabelEventArgs.Item and CancelEdit properties. - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - InitializeComponent(); - } - -internal: - System::Windows::Forms::ListView^ ListView1; - System::Windows::Forms::Label ^ Label1; - -private: - void InitializeComponent() - { - ListViewItem^ ListViewItem1 = gcnew ListViewItem( "VisualBasic.Net",0 ); - ListViewItem^ ListViewItem2 = gcnew ListViewItem( "Advanced VisualBasic.Net",1 ); - ListViewItem^ ListViewItem3 = gcnew ListViewItem( "Object-Oriented Design" ); - ListViewItem^ ListViewItem4 = gcnew ListViewItem( "Design Patterns for VB" ); - ListViewItem^ ListViewItem5 = gcnew ListViewItem( "UI Design" ); - ListViewItem^ ListViewItem6 = gcnew ListViewItem( "E-Commerce" ); - ListViewItem^ ListViewItem7 = gcnew ListViewItem( "Software Testing Techniques" ); - this->ListView1 = gcnew System::Windows::Forms::ListView; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - array^ temp0 = {ListViewItem1,ListViewItem2,ListViewItem3, - ListViewItem4,ListViewItem5,ListViewItem6,ListViewItem7}; - this->ListView1->Items->AddRange( temp0 ); - this->ListView1->LabelEdit = true; - this->ListView1->Location = System::Drawing::Point( 16, 48 ); - this->ListView1->Name = "ListView1"; - this->ListView1->Size = System::Drawing::Size( 248, 120 ); - this->ListView1->TabIndex = 0; - this->ListView1->View = System::Windows::Forms::View::List; - this->ListView1->BeforeLabelEdit += gcnew LabelEditEventHandler( - this, &Form1::ListView1_BeforeLabelEdit ); - this->Label1->Location = System::Drawing::Point( 16, 8 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 240, 32 ); - this->Label1->TabIndex = 2; - this->Label1->Text = "Proposed Class Schedule" - + " (The first two classes are required):"; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->ListView1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // - void ListView1_BeforeLabelEdit( Object^ sender, - System::Windows::Forms::LabelEditEventArgs^ e ) - { - // Allow all but the first two items of the list to - // be modified by the user. - if ( e->Item < 2 ) - { - e->CancelEdit = true; - } - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp deleted file mode 100644 index aa0f444f1ff..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp +++ /dev/null @@ -1,106 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates the use of ListView.Clear() -// and ListViewItem.Selected members. -// -// This snippet example requires a form that contains a ListView -// called ListView1, on a form, with the View property set to Details. -// The form also requires a button called button1. - -using namespace System::Windows::Forms; -using namespace System; - -public ref class Form1: public System::Windows::Forms::Form -{ -internal: - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::ListView^ ListView1; - -public: - Form1() - : Form() - { - InitializeListView(); - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - this->Button1->Location = System::Drawing::Point( 80, 192 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 96, 32 ); - this->Button1->TabIndex = 1; - this->Button1->Text = "See lunch menu"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->ListView1 ); - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Meal Selection"; - this->ResumeLayout( false ); - } - - // - // -private: - void InitializeListView() - { - // Set up the inital values for the ListView and populate it. - this->ListView1 = gcnew ListView; - this->ListView1->Dock = DockStyle::Top; - this->ListView1->Location = System::Drawing::Point( 0, 0 ); - this->ListView1->Size = System::Drawing::Size( 292, 130 ); - this->ListView1->View = View::Details; - this->ListView1->FullRowSelect = true; - array^breakfast = {"Continental Breakfast","Pancakes and Sausage","Denver Omelet","Eggs & Bacon","Bagel & Cream Cheese"}; - array^breakfastPrices = {"3.09","4.09","4.19","4.79","2.09"}; - PopulateMenu( "Breakfast", breakfast, breakfastPrices ); - } - - void PopulateMenu( String^ meal, array^menuItems, array^menuPrices ) - { - ColumnHeader^ columnHeader1 = gcnew ColumnHeader; - columnHeader1->Text = String::Concat( meal, " Choices" ); - columnHeader1->TextAlign = HorizontalAlignment::Left; - columnHeader1->Width = 146; - ColumnHeader^ columnHeader2 = gcnew ColumnHeader; - columnHeader2->Text = "Price"; - columnHeader2->TextAlign = HorizontalAlignment::Center; - columnHeader2->Width = 142; - this->ListView1->Columns->Add( columnHeader1 ); - this->ListView1->Columns->Add( columnHeader2 ); - for ( int count = 0; count < menuItems->Length; count++ ) - { - ListViewItem^ listItem = gcnew ListViewItem( menuItems[ count ] ); - listItem->SubItems->Add( menuPrices[ count ] ); - ListView1->Items->Add( listItem ); - - } - - // Use the Selected property to select the first item on - // the list. - ListView1->Focus(); - ListView1->Items[ 0 ]->Selected = true; - } - // - - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create new values for the ListView, clear the list, - // and repopulate it. - array^lunch = {"Hamburger","Grilled Cheese","Soup & Salad","Club Sandwich","Hotdog"}; - array^lunchPrices = {"4.09","5.09","5.19","4.79","2.09"}; - ListView1->Clear(); - PopulateMenu( "Lunch", lunch, lunchPrices ); - Button1->Enabled = false; - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp deleted file mode 100644 index ddd553b8133..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp +++ /dev/null @@ -1,167 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - PopulateListView(); - InitializePictureBox(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::PictureBox^ PictureBox1; - System::Windows::Forms::ListView^ ListView1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->ListView1 = gcnew System::Windows::Forms::ListView; - this->SuspendLayout(); - - // - //PictureBox1 - // - // - //ListView1 - // - this->ListView1->Location = System::Drawing::Point( 40, 32 ); - this->ListView1->Name = "ListView1"; - this->ListView1->TabIndex = 1; - this->ListView1->View = System::Windows::Forms::View::Details; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->ListView1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // -private: - void PopulateListView() - { - ListView1->Width = 270; - ListView1->Location = System::Drawing::Point( 10, 10 ); - - // Declare and construct the ColumnHeader objects. - ColumnHeader^ header1; - ColumnHeader^ header2; - header1 = gcnew ColumnHeader; - header2 = gcnew ColumnHeader; - - // Set the text, alignment and width for each column header. - header1->Text = "File name"; - header1->TextAlign = HorizontalAlignment::Left; - header1->Width = 70; - header2->TextAlign = HorizontalAlignment::Left; - header2->Text = "Location"; - header2->Width = 200; - - // Add the headers to the ListView control. - ListView1->Columns->Add( header1 ); - ListView1->Columns->Add( header2 ); - - // Specify that each item appears on a separate line. - ListView1->View = View::Details; - - // Populate the ListView.Items property. - // Set the directory to the sample picture directory. - System::IO::DirectoryInfo^ dirInfo = gcnew System::IO::DirectoryInfo( "C:\\Documents and Settings\\All Users" - "\\Documents\\My Pictures\\Sample Pictures" ); - - // Get the .jpg files from the directory - array^files = dirInfo->GetFiles( "*.jpg" ); - - // Add each file name and full name including path - // to the ListView. - if ( files != nullptr ) - { - System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - System::IO::FileInfo^ file = safe_cast(myEnum->Current); - ListViewItem^ item = gcnew ListViewItem( file->Name ); - item->SubItems->Add( file->FullName ); - ListView1->Items->Add( item ); - } - } - } - // - - void InitializePictureBox() - { - PictureBox1 = gcnew PictureBox; - - // Set the location and size of the PictureBox control. - this->PictureBox1->Location = System::Drawing::Point( 70, 120 ); - this->PictureBox1->Size = System::Drawing::Size( 140, 140 ); - this->PictureBox1->TabStop = false; - - // Set the SizeMode property to the StretchImage value. This - // will shrink or enlarge the image as needed to fit into - // the PictureBox. - this->PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; - - // Set the border style to a three-dimensional border. - this->PictureBox1->BorderStyle = BorderStyle::Fixed3D; - - // Add the PictureBox to the form. - this->Controls->Add( this->PictureBox1 ); - } - - void ListView1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) - { - ListViewItem^ selection = ListView1->GetItemAt( e->X, e->Y ); - - // If the user selects an item in the ListView, display - // the image in the PictureBox. - if ( selection != nullptr ) - { - PictureBox1->Image = System::Drawing::Image::FromFile( selection->SubItems[ 1 ]->Text ); - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp deleted file mode 100644 index be4243b738c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#pragma region Using directives - -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -#pragma endregion - -namespace ListViewFindItemWithTextHowTo -{ - public ref class Form1 : public Form - { - public: - Form1() - { - - InitializeComponent(); - - //InitializeTextSearchListView(); - InitializeLocationSearchListView(); - } - - /// - /// Required designer variable. - /// - private: - System::ComponentModel::IContainer^ components; - - /// - /// Clean up any resources being used. - /// - protected: - ~Form1() - { - if (components != nullptr) - { - delete components; - } - } - -#pragma region^ Windows Form^ Designer generated^ code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private: - void InitializeComponent() - { - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(292, 266); - this->Name = "Form1"; - this->Text = "Form1"; - - } - -#pragma endregion - - // - private: - ListView^ textListView; - TextBox^ searchBox; - - private: - void InitializeTextSearchListView() - { - textListView = gcnew ListView(); - searchBox = gcnew TextBox(); - searchBox->Location = Point(150, 20); - textListView->Scrollable = true; - textListView->Width = 100; - - // Set the View to list to use the FindItemWithText method. - textListView->View = View::List; - - // Populate the ListViewWithItems - textListView->Items->AddRange(gcnew array{ - gcnew ListViewItem("Amy Alberts"), - gcnew ListViewItem("Amy Recker"), - gcnew ListViewItem("Erin Hagens"), - gcnew ListViewItem("Barry Johnson"), - gcnew ListViewItem("Jay Hamlin"), - gcnew ListViewItem("Brian Valentine"), - gcnew ListViewItem("Brian Welker"), - gcnew ListViewItem("Daniel Weisman") }); - - // Handle the TextChanged to get the text for our search. - searchBox->TextChanged += gcnew EventHandler(this, - &Form1::searchBox_TextChanged); - - // Add the controls to the form. - this->Controls->Add(textListView); - this->Controls->Add(searchBox); - } - - // - private: - void searchBox_TextChanged(Object^ sender, EventArgs^ e) - { - // Call FindItemWithText with the contents of the textbox. - ListViewItem^ foundItem = - textListView->FindItemWithText(searchBox->Text, false, 0, true); - if (foundItem != nullptr) - { - textListView->TopItem = foundItem; - } - } - // - // - - // - ListView^ iconListView; - TextBox^ previousItemBox; - - private: - void InitializeLocationSearchListView() - { - previousItemBox = gcnew TextBox(); - iconListView = gcnew ListView(); - previousItemBox->Location = Point(150, 20); - - // Create an image list for the icon ListView. - iconListView->SmallImageList = gcnew ImageList(); - - // Add an image to the ListView small icon list. - iconListView->SmallImageList->Images->Add( - gcnew Bitmap(Control::typeid, "Edit.bmp")); - - // Set the view to small icon and add some items with the image - // in the image list. - iconListView->View = View::SmallIcon; - iconListView->Items->AddRange(gcnew array{ - gcnew ListViewItem("Amy Alberts", 0), - gcnew ListViewItem("Amy Recker", 0), - gcnew ListViewItem("Erin Hagens", 0), - gcnew ListViewItem("Barry Johnson", 0), - gcnew ListViewItem("Jay Hamlin", 0), - gcnew ListViewItem("Brian Valentine", 0), - gcnew ListViewItem("Brian Welker", 0), - gcnew ListViewItem("Daniel Weisman", 0) }); - this->Controls->Add(iconListView); - this->Controls->Add(previousItemBox); - - // Handle the MouseDown event to capture user input. - iconListView->MouseDown += gcnew MouseEventHandler( - this, &Form1::iconListView_MouseDown); - } - - // - void iconListView_MouseDown(Object^ sender, MouseEventArgs^ e) - { - // Find the next item up from where the user clicked. - ListViewItem^ foundItem = iconListView->FindNearestItem( - SearchDirectionHint::Up, e->X, e->Y); - - // Display the results in a textbox.. - if (foundItem != nullptr) - { - previousItemBox->Text = foundItem->Text; - } - else - { - previousItemBox->Text = "No item found"; - } - } - // - // - }; -} - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew ListViewFindItemWithTextHowTo::Form1()); -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp deleted file mode 100644 index 051086197b5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp +++ /dev/null @@ -1,103 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeListViewItems(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::ListView^ ListView1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->ListView1 = gcnew System::Windows::Forms::ListView; - this->SuspendLayout(); - - // - //ListView1 - // - this->ListView1->Location = System::Drawing::Point( 120, 72 ); - this->ListView1->Name = "ListView1"; - this->ListView1->TabIndex = 0; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->ListView1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void InitializeListViewItems() - { - ListView1->View = View::List; - array^favoriteCursors = {Cursors::Help,Cursors::Hand,Cursors::No,Cursors::Cross}; - - // Populate the ListView control with the array of Cursors. - System::Collections::IEnumerator^ myEnum = favoriteCursors->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - System::Windows::Forms::Cursor^ aCursor = safe_cast(myEnum->Current); - - // Construct the ListViewItem object - ListViewItem^ item = gcnew ListViewItem; - - // Set the Text property to the cursor name. - item->Text = aCursor->ToString(); - - // Set the Tag property to the cursor. - item->Tag = aCursor; - - // Add the ListViewItem to the ListView. - ListView1->Items->Add( item ); - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp deleted file mode 100644 index b9dc411f391..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - InitializeComponent(); - InitializeListView(); - } - -internal: - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 120, 224 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Button1"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // -internal: - // Declare the Listview object. - System::Windows::Forms::ListView^ myListView; - -private: - - // Initialize the ListView object with subitems of a different - // style than the default styles for the ListView. - void InitializeListView() - { - // Set the Location, View and Width properties for the - // ListView object. - myListView = gcnew ListView; - myListView->Location = System::Drawing::Point( 20, 20 ); - myListView->Width = 250; - - // The View property must be set to Details for the - // subitems to be visible. - myListView->View = View::Details; - - // Each SubItem object requires a column, so add three columns. - this->myListView->Columns->Add( "Key", 50, HorizontalAlignment::Left ); - this->myListView->Columns->Add( "A", 100, HorizontalAlignment::Left ); - this->myListView->Columns->Add( "B", 100, HorizontalAlignment::Left ); - - // Add a ListItem object to the ListView. - ListViewItem^ entryListItem = myListView->Items->Add( "Items" ); - - // Set UseItemStyleForSubItems property to false to change - // look of subitems. - entryListItem->UseItemStyleForSubItems = false; - - // Add the expense subitem. - ListViewItem::ListViewSubItem ^ expenseItem = entryListItem->SubItems->Add( "Expense" ); - - // Change the expenseItem object's color and font. - expenseItem->ForeColor = System::Drawing::Color::Red; - expenseItem->Font = gcnew System::Drawing::Font( "Arial",10,System::Drawing::FontStyle::Italic ); - - // Add a subitem called revenueItem - ListViewItem::ListViewSubItem ^ revenueItem = entryListItem->SubItems->Add( "Revenue" ); - - // Change the revenueItem object's color and font. - revenueItem->ForeColor = System::Drawing::Color::Blue; - revenueItem->Font = gcnew System::Drawing::Font( "Times New Roman",10,System::Drawing::FontStyle::Bold ); - - // Add the ListView to the form. - this->Controls->Add( this->myListView ); - } - // - - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Use the ListView.TopItem property to access the SubItems - // and then reset their appearance. - myListView->TopItem->SubItems[ 1 ]->ResetStyle(); - myListView->TopItem->SubItems[ 2 ]->ResetStyle(); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp deleted file mode 100644 index 5e12e57cde1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp +++ /dev/null @@ -1,92 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates using the -// ContextMenu.Show() method. -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 104, 80 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 80, 80 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click To See Context Menu"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Displays the shortcut menu, offsetting its location - // from the upper-left corner of Button1 by 20 pixels in each direction. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - //Declare the menu items and the shortcut menu. - array^menuItems = {gcnew MenuItem( "Some Button Info" ),gcnew MenuItem( "Some Other Button Info" ),gcnew MenuItem( "Exit" )}; - System::Windows::Forms::ContextMenu^ buttonMenu = gcnew System::Windows::Forms::ContextMenu( menuItems ); - buttonMenu->Show( Button1, System::Drawing::Point( 20, 20 ) ); - } - // -}; - - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp deleted file mode 100644 index d2134dbac8e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp +++ /dev/null @@ -1,141 +0,0 @@ - - -#using -#using -#using - -// -// The following code example demonstrates using the MenuItem -// Merge-Order property to control the way a merged menu is displayed. -using namespace System::Windows::Forms; - -//Declare a MainMenu object and its items. -public ref class Form1: public System::Windows::Forms::Form -{ -public private: - System::Windows::Forms::MainMenu^ mainMenu1; - System::Windows::Forms::MenuItem^ fileItem; - System::Windows::Forms::MenuItem^ newItem; - System::Windows::Forms::MenuItem^ openItem; - System::Windows::Forms::MenuItem^ saveItem; - System::Windows::Forms::MenuItem^ optionsMenu; - System::Windows::Forms::MenuItem^ viewItem; - System::Windows::Forms::MenuItem^ toolsItem; - - // Declare a ContextMenu object and its items. - System::Windows::Forms::ContextMenu^ contextMenu1; - System::Windows::Forms::MenuItem^ cutItem; - System::Windows::Forms::MenuItem^ copyItem; - System::Windows::Forms::MenuItem^ pasteItem; - -public: - Form1() - : Form() - { - this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->fileItem = gcnew System::Windows::Forms::MenuItem; - this->newItem = gcnew System::Windows::Forms::MenuItem; - this->openItem = gcnew System::Windows::Forms::MenuItem; - this->saveItem = gcnew System::Windows::Forms::MenuItem; - this->viewItem = gcnew System::Windows::Forms::MenuItem; - this->toolsItem = gcnew System::Windows::Forms::MenuItem; - this->optionsMenu = gcnew System::Windows::Forms::MenuItem; - this->toolsItem = gcnew System::Windows::Forms::MenuItem; - this->viewItem = gcnew System::Windows::Forms::MenuItem; - this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu; - this->cutItem = gcnew System::Windows::Forms::MenuItem; - this->copyItem = gcnew System::Windows::Forms::MenuItem; - this->pasteItem = gcnew System::Windows::Forms::MenuItem; - - //Add file menu item and options menu item to the MainMenu. - array^temp0 = {this->fileItem,this->optionsMenu}; - this->mainMenu1->MenuItems->AddRange( temp0 ); - - // Initialize the file menu and its contents. - this->fileItem->Index = 0; - this->fileItem->Text = "File"; - this->newItem->Index = 0; - this->newItem->Text = "New"; - this->openItem->Index = 1; - this->openItem->Text = "Open"; - this->saveItem->Index = 2; - this->saveItem->Text = "Save"; - - // Set the merge order of fileItem to 2 so it has a lower priority - // on the merged menu. - this->fileItem->MergeOrder = 2; - - //Add the new items to the fileItem menu item collection. - array^temp1 = {this->newItem,this->openItem,this->saveItem}; - this->fileItem->MenuItems->AddRange( temp1 ); - - // Initialize the optionsMenu item and its contents. - this->optionsMenu->Index = 1; - this->optionsMenu->Text = "Options"; - this->viewItem->Index = 0; - this->viewItem->Text = "View"; - this->toolsItem->Index = 1; - this->toolsItem->Text = "Tools"; - - // Set mergeOrder property to 1, so it has a higher priority than - // the fileItem on the merged menu. - this->optionsMenu->MergeOrder = 1; - - //Add view and tool items to the optionsItem menu item. - array^temp2 = {this->viewItem,this->toolsItem}; - this->optionsMenu->MenuItems->AddRange( temp2 ); - - // Initialize the menu items for the shortcut menu. - this->cutItem->Index = 0; - this->cutItem->Text = "Cut"; - this->cutItem->MergeOrder = 0; - this->copyItem->Index = 1; - this->copyItem->Text = "Copy"; - this->copyItem->MergeOrder = 0; - this->pasteItem->Index = 2; - this->pasteItem->Text = "Paste"; - this->pasteItem->MergeOrder = 0; - - // Add menu items to the shortcut menu. - array^temp3 = {cutItem,copyItem,pasteItem}; - this->contextMenu1->MenuItems->AddRange( temp3 ); - - // Add the mainMenu1 items to the shortcut menu as well, by - // calling the MergeMenu method. - contextMenu1->MergeMenu( mainMenu1 ); - - //Initialize the form. - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Right click on form for merged menu."; - - // Associate the event-handling method with the - // MouseDown event. - this->MouseDown += gcnew MouseEventHandler( this, &Form1::Form1_MouseDown ); - - // Add mainMenu1 to the form. - this->Menu = mainMenu1; - } - - -private: - void Form1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) - { - - // Check for a right mouse click. - if ( e->Button == ::MouseButtons::Right ) - { - contextMenu1->Show( this, System::Drawing::Point( 30, 30 ) ); - } - } - -}; - - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp deleted file mode 100644 index 25485bb09e9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp +++ /dev/null @@ -1,112 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeMenu(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - // -internal: - // Declare the MainMenu control. - System::Windows::Forms::MainMenu^ MainMenu1; - - // Declare MenuItem2 as With-Events because it will be user drawn. - System::Windows::Forms::MenuItem^ MenuItem2; - -private: - void InitializeMenu() - { - - // Create MenuItem1, which will be drawn by the operating system. - MenuItem^ MenuItem1 = gcnew MenuItem( "Regular Menu Item" ); - - // Create MenuItem2. - MenuItem2 = gcnew MenuItem( "Custom Menu Item" ); - - // Set OwnerDraw property to true. This requires handling the - // DrawItem event for this menu item. - MenuItem2->OwnerDraw = true; - - //Add the event-handler delegate to handle the DrawItem event. - MenuItem2->DrawItem += gcnew DrawItemEventHandler( this, &Form1::DrawCustomMenuItem ); - - // Add the items to the menu. - array^temp0 = {MenuItem1,MenuItem2}; - MainMenu1 = gcnew MainMenu( temp0 ); - - // Add the menu to the form. - this->Menu = this->MainMenu1; - } - - // Draw the custom menu item. - void DrawCustomMenuItem( Object^ sender, DrawItemEventArgs^ e ) - { - // Cast the sender to MenuItem so you can access text property. - MenuItem^ customItem = dynamic_cast(sender); - - // Create a Brush and a Font to draw the MenuItem. - System::Drawing::Brush^ aBrush = System::Drawing::Brushes::DarkMagenta; - System::Drawing::Font^ aFont = gcnew System::Drawing::Font( "Garamond",10,FontStyle::Italic,GraphicsUnit::Point ); - - // Get the size of the text to use later to draw an ellipse - // around the item. - SizeF stringSize = e->Graphics->MeasureString( customItem->Text, aFont ); - - // Draw the item and then draw the ellipse. - e->Graphics->DrawString( customItem->Text, aFont, aBrush, (float)e->Bounds.X, (float)e->Bounds.Y ); - e->Graphics->DrawEllipse( gcnew Pen( System::Drawing::Color::Black,2 ), Rectangle(e->Bounds.X,e->Bounds.Y,(System::Int32)stringSize.Width,(System::Int32)stringSize.Height) ); - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp deleted file mode 100644 index 373da0cd56d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp +++ /dev/null @@ -1,233 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -// -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ImageList^ imageList1; - System::Windows::Forms::Button^ button1; - System::ComponentModel::IContainer^ components; - -public: - - /// - /// Required designer variable. - /// - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( Form1::typeid ); - this->imageList1 = gcnew System::Windows::Forms::ImageList( this->components ); - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // imageList1 - // - this->imageList1->ImageSize = System::Drawing::Size( 16, 16 ); - this->imageList1->ImageStream = (dynamic_cast(resources->GetObject( "imageList1.ImageStream" ))); - this->imageList1->TransparentColor = System::Drawing::Color::Transparent; - this->imageList1->Images->SetKeyName( 0, "" ); - this->imageList1->Images->SetKeyName( 1, "" ); - this->imageList1->Images->SetKeyName( 2, "" ); - this->imageList1->Images->SetKeyName( 3, "" ); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 103, 86 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // this.button1.HelpRequested += new System.Windows.Forms.HelpEventHandler (this.button1_HelpRequested); - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 365, 342 ); - this->Controls->Add( this->button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Display a message box with a Help button. Show a custom Help window - // by handling the HelpRequested event. - System::Windows::Forms::DialogResult AlertMessageWithCustomHelpWindow() - { - - // Handle the HelpRequested event for the following message. - this->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::Form1_HelpRequested ); - this->Tag = "Message with Help button."; - - // Show a message box with OK and Help buttons. - System::Windows::Forms::DialogResult r = MessageBox::Show( "Message with Help button.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, true ); - - // Remove the HelpRequested event handler to keep the event - // from being handled for other message boxes. - this->HelpRequested -= gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::Form1_HelpRequested ); - - // Return the dialog box result. - return r; - } - - void Form1_HelpRequested( System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent ) - { - - // Create a custom Help window in response to the HelpRequested event. - Form^ helpForm = gcnew Form; - - // Set up the form position, size, and title caption. - helpForm->StartPosition = FormStartPosition::Manual; - helpForm->Size = System::Drawing::Size( 200, 400 ); - helpForm->DesktopLocation = Point(this->DesktopBounds.X + this->Size.Width,this->DesktopBounds.Top); - helpForm->Text = "Help Form"; - - // Create a label to contain the Help text. - Label^ helpLabel = gcnew Label; - - // Add the label to the form and set its text. - helpForm->Controls->Add( helpLabel ); - helpLabel->Dock = DockStyle::Fill; - - // Use the sender parameter to identify the context of the Help request. - // The parameter must be cast to the Control type to get the Tag property. - Control^ senderControl = dynamic_cast(sender); - helpLabel->Text = String::Format( "Help information shown in response to user action on the '{0}' message.", dynamic_cast(senderControl->Tag) ); - - // Set the Help form to be owned by the main form. This helps - // to ensure that the Help form is disposed of. - this->AddOwnedForm( helpForm ); - - // Show the custom Help window. - helpForm->Show(); - - // Indicate that the HelpRequested event is handled. - hlpevent->Handled = true; - } - // - - void button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - DialogResult = AlertMessageWithCustomHelpWindow(); - - // - // Display a message box with a help button. - // The Help button opens the Mspaint.chm Help file. - System::Windows::Forms::DialogResult r1 = MessageBox::Show( "Message with Help file.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm" ); - // - - // - // Display a message box parented to the main form. - // The Help button opens the Mspaint.chm Help file. - System::Windows::Forms::DialogResult r2 = MessageBox::Show( this, "Message with Help file.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm" ); - // - - // - // Display a message box. The Help button opens - // the Mspaint.chm Help file and shows the Help contents - // on the Index tab. - System::Windows::Forms::DialogResult r3 = MessageBox::Show( "Message with Help file and Help navigator.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::Index ); - // - - // - // Display message box parented to the main form. - // The Help button opens the Mspaint.chm Help file - // and shows the Help contents on the Index tab. - System::Windows::Forms::DialogResult r4 = MessageBox::Show( this, "Message with Help file and Help navigator.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::Index ); - // - - // - // Display a message box. The Help button opens the Mspaint.chm Help file, - // shows index with the "ovals" keyword selected, and displays the - // associated topic. - System::Windows::Forms::DialogResult r5 = MessageBox::Show( "Message with Help file and Help navigator with additional parameter.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::KeywordIndex, "ovals" ); - // - - // - // Display message box parented to the main form. - // The Help button opens the Mspaint.chm Help file, - // shows index with the "ovals" keyword selected, and displays the - // associated topic. - System::Windows::Forms::DialogResult r6 = MessageBox::Show( this, "Message with Help file and Help navigator with additional parameter.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::KeywordIndex, "ovals" ); - // - - // - // Display a message box. The Help button opens the Mspaint.chm Help file, - // and the "mspaint.chm::/paint_brush.htm" Help keyword shows the - // associated topic. - System::Windows::Forms::DialogResult r7 = MessageBox::Show( "Message with Help file and keyword.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", "mspaint.chm::/paint_brush.htm" ); - // - - // - // Display message box parented to the main form. - // The Help button opens the Mspaint.chm Help file, - // and the "mspaint.chm::/paint_brush.htm" Help keyword shows the - // associated topic. - System::Windows::Forms::DialogResult r8 = MessageBox::Show( this, "Message with Help file and keyword.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", "mspaint.chm::/paint_brush.htm" ); - // - } - - // private void button1_HelpRequested (System.Object sender, System.Windows.Forms.HelpEventArgs hlpevent) - // { - // MessageBox.Show ("Help requested from button"); - // } -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp deleted file mode 100644 index 67166b7e0f2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp +++ /dev/null @@ -1,115 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::MonthCalendar^ monthCalendar1; - System::Windows::Forms::TextBox^ textBox1; - -public: - Form1() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - this->textBox1->Location = System::Drawing::Point( 48, 488 ); - this->textBox1->Multiline = true; - this->textBox1->ReadOnly = true; - this->textBox1->Size = System::Drawing::Size( 824, 32 ); - - // Create the calendar. - this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; - - // Set the calendar location. - this->monthCalendar1->Location = System::Drawing::Point( 47, 16 ); - - // Change the color. - this->monthCalendar1->BackColor = System::Drawing::SystemColors::Info; - this->monthCalendar1->ForeColor = System::Drawing::Color::FromArgb( ((System::Byte)(192)) ),((System::Byte)(0)),((System::Byte)(192)); - this->monthCalendar1->TitleBackColor = System::Drawing::Color::Purple; - this->monthCalendar1->TitleForeColor = System::Drawing::Color::Yellow; - this->monthCalendar1->TrailingForeColor = System::Drawing::Color::FromArgb( ((System::Byte)(192)) ),((System::Byte)(192)),((System::Byte)(0)); - - // Add dates to the AnnuallyBoldedDates array. - array^ temp1 = {System::DateTime( 2002, 4, 20, 0, 0, 0, 0 ),System::DateTime( 2002, 4, 28, 0, 0, 0, 0 ),System::DateTime( 2002, 5, 5, 0, 0, 0, 0 ),System::DateTime( 2002, 7, 4, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 18, 0, 0, 0, 0 )}; - this->monthCalendar1->AnnuallyBoldedDates = temp1; - - // Add dates to BoldedDates array. - array^ temp2 = {System::DateTime( 2002, 9, 26, 0, 0, 0, 0 )}; - this->monthCalendar1->BoldedDates = temp2; - - // Add dates to MonthlyBoldedDates array. - array^ temp5 = {System::DateTime( 2002, 1, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 1, 30, 0, 0, 0, 0 )}; - this->monthCalendar1->MonthlyBoldedDates = temp5; - - // Configure the calendar to display 3 rows by 4 columns of months. - this->monthCalendar1->CalendarDimensions = System::Drawing::Size( 4, 3 ); - - // Set week to begin on Monday. - this->monthCalendar1->FirstDayOfWeek = System::Windows::Forms::Day::Monday; - - // Set the maximum visible date on the calendar to 12/31/2010. - this->monthCalendar1->MaxDate = System::DateTime( 2010, 12, 31, 0, 0, 0, 0 ); - - // Set the minimum visible date on calendar to 12/31/2010. - this->monthCalendar1->MinDate = System::DateTime( 1999, 1, 1, 0, 0, 0, 0 ); - - // Only allow 21 days to be selected at the same time. - this->monthCalendar1->MaxSelectionCount = 21; - - // Set the calendar to move one month at a time when navigating using the arrows. - this->monthCalendar1->ScrollChange = 1; - - // Do not show the S"Today" banner. - this->monthCalendar1->ShowToday = false; - - // Do not circle today's date. - this->monthCalendar1->ShowTodayCircle = false; - - // Show the week numbers to the left of each week. - this->monthCalendar1->ShowWeekNumbers = true; - - // Add event handlers for the DateSelected and DateChanged events - this->monthCalendar1->DateSelected += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateSelected ); - this->monthCalendar1->DateChanged += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateChanged ); - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 920, 566 ); - array^temp0 = {this->textBox1,this->monthCalendar1}; - this->Controls->AddRange( temp0 ); - this->Text = "Month Calendar Example"; - } - - -private: - void monthCalendar1_DateSelected( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ e ) - { - - // Show the start and end dates in the text box. - this->textBox1->Text = String::Format( "Date Selected: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString() ); - } - - void monthCalendar1_DateChanged( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ e ) - { - - // Show the start and end dates in the text box. - this->textBox1->Text = String::Format( "Date Changed: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString() ); - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp deleted file mode 100644 index 87afed814c9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp +++ /dev/null @@ -1,53 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() : Form() - { - InitializeComponent(); - ShowAWeeksVacationOneMonthFromToday(); - } - -internal: - System::Windows::Forms::MonthCalendar^ MonthCalendar1; - -private: - void InitializeComponent() - { - this->MonthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; - this->SuspendLayout(); - this->MonthCalendar1->Location = System::Drawing::Point( 56, 32 ); - this->MonthCalendar1->Name = "MonthCalendar1"; - this->MonthCalendar1->TabIndex = 0; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->MonthCalendar1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Computes a week one month from today. - void ShowAWeeksVacationOneMonthFromToday() - { - DateTime today = this->MonthCalendar1->TodayDate; - DateTime vacationStart = today.AddMonths(1); - DateTime vacationEnd = vacationStart.AddDays(7); - - // Select the week using SelectionStart and SelectionEnd. - this->MonthCalendar1->SelectionStart = vacationStart.AddDays(-1); - this->MonthCalendar1->SelectionEnd = vacationEnd.AddDays(-1); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp deleted file mode 100644 index 377edc2e5b8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp +++ /dev/null @@ -1,268 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace MouseEvent -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Panel^ panel1; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::Label ^ label4; - System::Windows::Forms::Label ^ label5; - System::Windows::Forms::Label ^ label6; - System::Windows::Forms::Label ^ label7; - System::Windows::Forms::Label ^ label8; - System::Windows::Forms::Label ^ label9; - System::Windows::Forms::Button^ clearButton; - System::Drawing::Drawing2D::GraphicsPath^ mousePath; - System::Windows::Forms::GroupBox^ groupBox1; - int fontSize; - - public: - Form1() - { - fontSize = 20; - mousePath = gcnew System::Drawing::Drawing2D::GraphicsPath; - this->panel1 = gcnew System::Windows::Forms::Panel; - this->label1 = gcnew System::Windows::Forms::Label; - this->clearButton = gcnew System::Windows::Forms::Button; - this->label2 = gcnew System::Windows::Forms::Label; - this->label3 = gcnew System::Windows::Forms::Label; - this->label4 = gcnew System::Windows::Forms::Label; - this->label5 = gcnew System::Windows::Forms::Label; - this->label6 = gcnew System::Windows::Forms::Label; - this->label7 = gcnew System::Windows::Forms::Label; - this->label8 = gcnew System::Windows::Forms::Label; - this->label9 = gcnew System::Windows::Forms::Label; - this->groupBox1 = gcnew System::Windows::Forms::GroupBox; - - // Mouse Events Label - this->label1->Location = System::Drawing::Point( 24, 504 ); - this->label1->Size = System::Drawing::Size( 392, 23 ); - - // DoubleClickSize Label - this->label2->AutoSize = true; - this->label2->Location = System::Drawing::Point( 24, 48 ); - this->label2->Size = System::Drawing::Size( 35, 13 ); - - // DoubleClickTime Label - this->label3->AutoSize = true; - this->label3->Location = System::Drawing::Point( 24, 72 ); - this->label3->Size = System::Drawing::Size( 35, 13 ); - - // MousePresent Label - this->label4->AutoSize = true; - this->label4->Location = System::Drawing::Point( 24, 96 ); - this->label4->Size = System::Drawing::Size( 35, 13 ); - - // MouseButtons Label - this->label5->AutoSize = true; - this->label5->Location = System::Drawing::Point( 24, 120 ); - this->label5->Size = System::Drawing::Size( 35, 13 ); - - // MouseButtonsSwapped Label - this->label6->AutoSize = true; - this->label6->Location = System::Drawing::Point( 320, 48 ); - this->label6->Size = System::Drawing::Size( 35, 13 ); - - // MouseWheelPresent Label - this->label7->AutoSize = true; - this->label7->Location = System::Drawing::Point( 320, 72 ); - this->label7->Size = System::Drawing::Size( 35, 13 ); - - // MouseWheelScrollLines Label - this->label8->AutoSize = true; - this->label8->Location = System::Drawing::Point( 320, 96 ); - this->label8->Size = System::Drawing::Size( 35, 13 ); - - // NativeMouseWheelSupport Label - this->label9->AutoSize = true; - this->label9->Location = System::Drawing::Point( 320, 120 ); - this->label9->Size = System::Drawing::Size( 35, 13 ); - - // Mouse Panel - this->panel1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->panel1->BackColor = System::Drawing::SystemColors::ControlDark; - this->panel1->Location = System::Drawing::Point( 16, 160 ); - this->panel1->Size = System::Drawing::Size( 664, 320 ); - this->panel1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseUp ); - this->panel1->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::panel1_Paint ); - this->panel1->MouseEnter += gcnew System::EventHandler( this, &Form1::panel1_MouseEnter ); - this->panel1->MouseHover += gcnew System::EventHandler( this, &Form1::panel1_MouseHover ); - this->panel1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseMove ); - this->panel1->MouseLeave += gcnew System::EventHandler( this, &Form1::panel1_MouseLeave ); - this->panel1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseDown ); - this->panel1->MouseWheel += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseWheel ); - - // Clear Button - this->clearButton->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right); - this->clearButton->Location = System::Drawing::Point( 592, 504 ); - this->clearButton->TabIndex = 1; - this->clearButton->Text = "Clear"; - this->clearButton->Click += gcnew System::EventHandler( this, &Form1::clearButton_Click ); - - // GroupBox - this->groupBox1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->groupBox1->Location = System::Drawing::Point( 16, 24 ); - this->groupBox1->Size = System::Drawing::Size( 664, 128 ); - this->groupBox1->Text = "System::Windows::Forms::SystemInformation"; - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 696, 534 ); - array^temp0 = {this->label9,this->label8,this->label7,this->label6,this->label5,this->label4,this->label3,this->label2,this->clearButton,this->panel1,this->label1,this->groupBox1}; - this->Controls->AddRange( temp0 ); - this->Text = "Mouse Event Example"; - - // - // Displays information about the system mouse. - label2->Text = "SystemInformation::DoubleClickSize: {0}",SystemInformation::DoubleClickSize; - label3->Text = "SystemInformation::DoubleClickTime: {0}",SystemInformation::DoubleClickTime; - label4->Text = "SystemInformation::MousePresent: {0}",SystemInformation::MousePresent; - label5->Text = "SystemInformation::MouseButtons: {0}",SystemInformation::MouseButtons; - label6->Text = "SystemInformation::MouseButtonsSwapped: {0}",SystemInformation::MouseButtonsSwapped; - label7->Text = "SystemInformation::MouseWheelPresent: {0}",SystemInformation::MouseWheelPresent; - label8->Text = "SystemInformation::MouseWheelScrollLines: {0}",SystemInformation::MouseWheelScrollLines; - label9->Text = "SystemInformation::NativeMouseWheelSupport: {0}",SystemInformation::NativeMouseWheelSupport; - // - } - - // - private: - void panel1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Update the mouse path with the mouse information - Point mouseDownLocation = Point(e->X,e->Y); - String^ eventString = nullptr; - switch ( e->Button ) - { - case ::MouseButtons::Left: - eventString = "L"; - break; - - case ::MouseButtons::Right: - eventString = "R"; - break; - - case ::MouseButtons::Middle: - eventString = "M"; - break; - - case ::MouseButtons::XButton1: - eventString = "X1"; - break; - - case ::MouseButtons::XButton2: - eventString = "X2"; - break; - - case ::MouseButtons::None: - default: - break; - } - if ( eventString != nullptr ) - { - mousePath->AddString( eventString, FontFamily::GenericSerif, (int)FontStyle::Bold, (float)fontSize, mouseDownLocation, StringFormat::GenericDefault ); - } - else - { - mousePath->AddLine( mouseDownLocation, mouseDownLocation ); - } - - panel1->Focus(); - panel1->Invalidate(); - } - // - - // - void panel1_MouseEnter( Object^ sender, System::EventArgs^ /*e*/ ) - { - - // Update the mouse event label to indicate the MouseEnter event occurred. - label1->Text = String::Concat( sender->GetType(), ": MouseEnter" ); - } - - void panel1_MouseHover( Object^ sender, System::EventArgs^ /*e*/ ) - { - - // Update the mouse event label to indicate the MouseHover event occurred. - label1->Text = String::Concat( sender->GetType(), ": MouseHover" ); - } - - void panel1_MouseLeave( Object^ sender, System::EventArgs^ /*e*/ ) - { - - // Update the mouse event label to indicate the MouseLeave event occurred. - label1->Text = String::Concat( sender->GetType(), ": MouseLeave" ); - } - - void panel1_MouseMove( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Update the mouse path that is drawn onto the Panel. - int mouseX = e->X; - int mouseY = e->Y; - mousePath->AddLine( mouseX, mouseY, mouseX, mouseY ); - } - // - - // - void panel1_MouseWheel( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - // Update the drawing based upon the mouse wheel scrolling. - int numberOfTextLinesToMove = e->Delta * SystemInformation::MouseWheelScrollLines / 120; - int numberOfPixelsToMove = numberOfTextLinesToMove * fontSize; - if ( numberOfPixelsToMove != 0 ) - { - System::Drawing::Drawing2D::Matrix^ translateMatrix = gcnew System::Drawing::Drawing2D::Matrix; - translateMatrix->Translate( 0, (float)numberOfPixelsToMove ); - mousePath->Transform(translateMatrix); - } - - panel1->Invalidate(); - } - // - - // - void panel1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - Point mouseUpLocation = System::Drawing::Point( e->X, e->Y ); - - // Show the number of clicks in the path graphic. - int numberOfClicks = e->Clicks; - mousePath->AddString( String::Format( " {0}", numberOfClicks ), FontFamily::GenericSerif, (int)FontStyle::Bold, (float)fontSize, mouseUpLocation, StringFormat::GenericDefault ); - panel1->Invalidate(); - } - // - - void panel1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) - { - // Perform the painting of the Panel. - e->Graphics->DrawPath( System::Drawing::Pens::DarkRed, mousePath ); - } - - void clearButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Clear the Panel display. - delete mousePath; - mousePath = gcnew System::Drawing::Drawing2D::GraphicsPath; - panel1->Invalidate(); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew MouseEvent::Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp deleted file mode 100644 index dd14e075298..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::NotifyIcon^ notifyIcon1; - System::Windows::Forms::ContextMenu^ contextMenu1; - System::Windows::Forms::MenuItem^ menuItem1; - System::ComponentModel::IContainer^ components; - -public: - Form1() - { - this->components = gcnew System::ComponentModel::Container; - this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu; - this->menuItem1 = gcnew System::Windows::Forms::MenuItem; - - // Initialize contextMenu1 - array^temp0 = {this->menuItem1}; - this->contextMenu1->MenuItems->AddRange( temp0 ); - - // Initialize menuItem1 - this->menuItem1->Index = 0; - this->menuItem1->Text = "E&xit"; - this->menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); - - // Set up how the form should be displayed. - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Text = "Notify Icon Example"; - - // Create the NotifyIcon. - this->notifyIcon1 = gcnew System::Windows::Forms::NotifyIcon( this->components ); - - // The Icon property sets the icon that will appear - // in the systray for this application. - notifyIcon1->Icon = gcnew System::Drawing::Icon( "appicon.ico" ); - - // The ContextMenu property sets the menu that will - // appear when the systray icon is right clicked. - notifyIcon1->ContextMenu = this->contextMenu1; - - // The Text property sets the text that will be displayed, - // in a tooltip, when the mouse hovers over the systray icon. - notifyIcon1->Text = "Form1 (NotifyIcon example)"; - notifyIcon1->Visible = true; - - // Handle the DoubleClick event to activate the form. - notifyIcon1->DoubleClick += gcnew System::EventHandler( this, &Form1::notifyIcon1_DoubleClick ); - } - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void notifyIcon1_DoubleClick( Object^ /*Sender*/, EventArgs^ /*e*/ ) - { - - // Show the form when the user double clicks on the notify icon. - // Set the WindowState to normal if the form is minimized. - if ( this->WindowState == FormWindowState::Minimized ) - this->WindowState = FormWindowState::Normal; - - // Activate the form. - this->Activate(); - } - - void menuItem1_Click( Object^ /*Sender*/, EventArgs^ /*e*/ ) - { - - // Close the form, which closes the application. - this->Close(); - } - -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp deleted file mode 100644 index c1143749b08..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp +++ /dev/null @@ -1,98 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeContextMenu(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::NotifyIcon^ NotifyIcon1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( Form1::typeid ); - this->NotifyIcon1 = gcnew System::Windows::Forms::NotifyIcon( this->components ); - - // - //NotifyIcon1 - // - this->NotifyIcon1->Icon = System::Drawing::SystemIcons::Asterisk; - this->NotifyIcon1->Text = "NotifyIcon1"; - this->NotifyIcon1->Visible = true; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - // - // Initialize the NofifyIcon object's shortcut menu. - void InitializeContextMenu() - { - array^menuList = {gcnew MenuItem( "Sign In" ),gcnew MenuItem( "Get Help" ),gcnew MenuItem( "Open" )}; - System::Windows::Forms::ContextMenu^ clickMenu = gcnew System::Windows::Forms::ContextMenu( menuList ); - NotifyIcon1->ContextMenu = clickMenu; - - // Associate the event-handling method with - // the NotifyIcon object's click event. - NotifyIcon1->Click += gcnew System::EventHandler( this, &Form1::NotifyIcon1_Click ); - } - - // When user clicks the left mouse button display the shortcut menu. - // Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property - // to place the menu at the lower corner of the screen. - void NotifyIcon1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - System::Drawing::Size windowSize = SystemInformation::PrimaryMonitorMaximizedWindowSize; - System::Drawing::Point menuPoint = System::Drawing::Point( windowSize.Width - 180, windowSize.Height - 5 ); - menuPoint = this->PointToClient( menuPoint ); - NotifyIcon1->ContextMenu->Show( this, menuPoint ); - } - // -}; - - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp deleted file mode 100644 index dba128e902e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp +++ /dev/null @@ -1,103 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -// - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - - if ( components != nullptr ) - { - delete components; - } - - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} - - // - // Gets the caret width based upon the operating system or default value. - int GetCaretWidth() - { - // Check to see if the operating system supports the caret width metric. - if ( OSFeature::Feature->IsPresent( SystemParameter::CaretWidthMetric ) ) - { - // If the operating system supports this metric, - // return the value for the caret width metric. - return SystemInformation::CaretWidth; - } - else - 1; - - // If the operating system does not support this metric, - // return a custom default value for the caret width. - } - // -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp deleted file mode 100644 index 02c8c440486..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp +++ /dev/null @@ -1,124 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::PageSetupDialog^ PageSetupDialog1; - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::ListBox^ ListBox1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->PageSetupDialog1 = gcnew System::Windows::Forms::PageSetupDialog; - this->Button1 = gcnew System::Windows::Forms::Button; - this->ListBox1 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 104, 24 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 88, 40 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Modify page settings"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //ListBox1 - // - this->ListBox1->Dock = System::Windows::Forms::DockStyle::Bottom; - this->ListBox1->Location = System::Drawing::Point( 0, 106 ); - this->ListBox1->Name = "ListBox1"; - this->ListBox1->Size = System::Drawing::Size( 292, 160 ); - this->ListBox1->TabIndex = 1; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->ListBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - //This method displays a PageSetupDialog object. If the - // user clicks OK in the dialog, selected results of - // the dialog are displayed in ListBox1. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Initialize the dialog's PrinterSettings property to hold user - // defined printer settings. - PageSetupDialog1->PageSettings = gcnew System::Drawing::Printing::PageSettings; - - // Initialize dialog's PrinterSettings property to hold user - // set printer settings. - PageSetupDialog1->PrinterSettings = gcnew System::Drawing::Printing::PrinterSettings; - - //Do not show the network in the printer dialog. - PageSetupDialog1->ShowNetwork = false; - - //Show the dialog storing the result. - System::Windows::Forms::DialogResult result = PageSetupDialog1->ShowDialog(); - - // If the result is OK, display selected settings in - // ListBox1. These values can be used when printing the - // document. - if ( result == ::DialogResult::OK ) - { - array^results = {PageSetupDialog1->PageSettings->Margins,PageSetupDialog1->PageSettings->PaperSize,PageSetupDialog1->PageSettings->Landscape,PageSetupDialog1->PrinterSettings->PrinterName,PageSetupDialog1->PrinterSettings->PrintRange}; - ListBox1->Items->AddRange( results ); - } - - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp deleted file mode 100644 index 500deda2bdf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp +++ /dev/null @@ -1,103 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::Media; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -public: - - /// - /// Clean up any resources being used. - /// - - ~Form1() - { - - - } - - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - - Player = gcnew SoundPlayer(); - this->Player->LoadCompleted += gcnew System::ComponentModel::AsyncCompletedEventHandler( this, &Form1::Player_LoadCompleted ); - } - - - - /// - /// The main entry point for the application. - /// - // -private: - SoundPlayer^ Player; - - void loadSoundAsync() - { - // Note: You may need to change the location specified based on - // the location of the sound to be played. - this->Player->SoundLocation = "http://www.tailspintoys.com/sounds/stop.wav"; - this->Player->LoadAsync(); - } - - void Player_LoadCompleted( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ /*e*/ ) - { - if (this->Player->IsLoadCompleted) - { - this->Player->PlaySync(); - } - } - // -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp deleted file mode 100644 index 185642af0cd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp +++ /dev/null @@ -1,140 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - docToPrint = gcnew System::Drawing::Printing::PrintDocument; - docToPrint->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler( this, &Form1::document_PrintPage ); - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::PrintDialog^ PrintDialog1; - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->PrintDialog1 = gcnew System::Windows::Forms::PrintDialog; - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 104, 104 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Print"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Declare the PrintDocument object. - System::Drawing::Printing::PrintDocument^ docToPrint; - - // This method will set properties on the PrintDialog object and - // then display the dialog. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Allow the user to choose the page range he or she would - // like to print. - PrintDialog1->AllowSomePages = true; - - // Show the help button. - PrintDialog1->ShowHelp = true; - - // Set the Document property to the PrintDocument for - // which the PrintPage Event has been handled. To display the - // dialog, either this property or the PrinterSettings property - // must be set - PrintDialog1->Document = docToPrint; - if ( docToPrint == nullptr ) - System::Windows::Forms::MessageBox::Show( "null" ); - - ; - ; - if ( PrintDialog1 == nullptr ) - System::Windows::Forms::MessageBox::Show( "pnull" ); - - ; - ; - System::Windows::Forms::DialogResult result = PrintDialog1->ShowDialog(); - System::Windows::Forms::MessageBox::Show( result.ToString() ); - ; - ; - - // If the result is OK then print the document. - if ( result == ::DialogResult::OK ) - { - docToPrint->Print(); - } - - } - - // The PrintDialog will print the document - // by handling the document's PrintPage event. - void document_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^ e ) - { - // Insert code to render the page here. - // This code will be called when the control is drawn. - // The following code will render a simple - // message on the printed document. - String^ text = "In document_PrintPage method."; - System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,System::Drawing::FontStyle::Regular ); - - // Draw the content. - e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 10, 10 ); - } - // -}; - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp deleted file mode 100644 index afd183a9dd1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp +++ /dev/null @@ -1,124 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - docToPrint = gcnew System::Drawing::Printing::PrintDocument; - InitializePrintPreviewControl(); - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::PrintDialog^ PrintDialog1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->PrintDialog1 = gcnew System::Windows::Forms::PrintDialog; - this->SuspendLayout(); - - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - - // -internal: - // Declare the PrintPreviewControl object and the - // PrintDocument object. - PrintPreviewControl^ PrintPreviewControl1; - -private: - System::Drawing::Printing::PrintDocument^ docToPrint; - void InitializePrintPreviewControl() - { - // Construct the PrintPreviewControl. - this->PrintPreviewControl1 = gcnew PrintPreviewControl; - - // Set location, name, and dock style for PrintPreviewControl1. - this->PrintPreviewControl1->Location = Point(88,80); - this->PrintPreviewControl1->Name = "PrintPreviewControl1"; - this->PrintPreviewControl1->Dock = DockStyle::Fill; - - // Set the Document property to the PrintDocument - // for which the PrintPage event has been handled. - this->PrintPreviewControl1->Document = docToPrint; - - // Set the zoom to 25 percent. - this->PrintPreviewControl1->Zoom = 0.25; - - // Set the document name. This will show be displayed when - // the document is loading into the control. - this->PrintPreviewControl1->Document->DocumentName = "c:\\someFile"; - - // Set the UseAntiAlias property to true so fonts are smoothed - // by the operating system. - this->PrintPreviewControl1->UseAntiAlias = true; - - // Add the control to the form. - this->Controls->Add( this->PrintPreviewControl1 ); - - // Associate the event-handling method with the - // document's PrintPage event. - this->docToPrint->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler( this, &Form1::docToPrint_PrintPage ); - } - - // The PrintPreviewControl will display the document - // by handling the documents PrintPage event - void docToPrint_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^ e ) - { - // Insert code to render the page here. - // This code will be called when the control is drawn. - // The following code will render a simple - // message on the document in the control. - String^ text = "In docToPrint_PrintPage method."; - System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,FontStyle::Regular ); - e->Graphics->DrawString( text, printFont, Brushes::Black, 10, 10 ); - } - // -}; - - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp deleted file mode 100644 index b51b48f5c31..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp +++ /dev/null @@ -1,103 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Windows::Forms; - -// -// This button is a simple extension of the button class that overrides -// the ProcessMnemonic method. If the mnemonic is correctly entered, -// the message box will appear and the click event will be raised. -// This method makes sure the control is selectable and the -// mnemonic is correct before displaying the message box -// and triggering the click event. -public ref class MyMnemonicButton: public Button -{ -protected: - bool ProcessMnemonic( char inputChar ) - { - if ( CanSelect && IsMnemonic( inputChar, this->Text ) ) - { - MessageBox::Show( "You've raised the click event " - "using the mnemonic." ); - this->PerformClick(); - return true; - } - - return false; - } - -}; - - -// -// Declare the controls contained on the form. -public ref class Form1: public System::Windows::Forms::Form -{ -private: - MyMnemonicButton^ button1; - -public private: - System::Windows::Forms::ListBox^ ListBox1; - -public: - Form1() - : Form() - { - - // Set KeyPreview object to true to allow the form to process - // the key before the control with focus processes it. - this->KeyPreview = true; - - // Add a MyMnemonicButton. - button1 = gcnew MyMnemonicButton; - button1->Text = "&Click"; - button1->Location = System::Drawing::Point( 100, 120 ); - this->Controls->Add( button1 ); - - // Initialize a ListBox control and the form itself. - this->ListBox1 = gcnew System::Windows::Forms::ListBox; - this->SuspendLayout(); - this->ListBox1->Location = System::Drawing::Point( 8, 8 ); - this->ListBox1->Name = "ListBox1"; - this->ListBox1->Size = System::Drawing::Size( 120, 95 ); - this->ListBox1->TabIndex = 0; - this->ListBox1->Text = "Press a key"; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->ListBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - - // Associate the event-handling method with the - // KeyDown event. - this->KeyDown += gcnew KeyEventHandler( this, &Form1::Form1_KeyDown ); - } - - -private: - - // The form will handle all key events before the control with - // focus handles them. Show the keys pressed by adding the - // KeyCode object to ListBox1. Ensure the processing is passed - // to the control with focus by setting the KeyEventArg.Handled - // property to false. - void Form1_KeyDown( Object^ /*sender*/, KeyEventArgs^ e ) - { - ListBox1->Items->Add( e->KeyCode ); - e->Handled = false; - } - -}; - - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp deleted file mode 100644 index f0c6ee3b2c3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp +++ /dev/null @@ -1,227 +0,0 @@ -// This sample can go in ProgressBarRenderer class overview. -// - Snippet2 can go in DrawVerticalBar and IsSupported -// - Snippet4 can go in ChunkSpaceThickness and ChunkThickness -// - Snippet6 can go in DrawVerticalChunks - -// This sample draws a vertical progress bar, something that the regular ProgressBar control -// cannot do. Because it draws a vertical bar, if visual styles aren't enabled, I simply -// don't draw a bar at all, instead of trying to expose a system ProgressBar control. -// The SetupProgressBar method uses the thickness defined by the current visual -// style to calculate the height of each rectangle. Note that the Y coordinate of -// each rectangle is near the bottom of the client rectangle and the height of -// each rectangle is negative, so the bar progresses upward. The size adjustments -// ensure that the chunks don't paint over the frame. - -// For simplicity, this sampel does not handle run-time switching of visual styles. - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace ProgressBarRendererSample -{ - public ref class VerticalProgressBar : public Control - { - private: - int numberChunksValue; - int ticks; - Timer^ progressTimer; - array^ progressBarRectangles; - - public: - VerticalProgressBar() : Control() - { - this->Location = Point(10, 10); - this->Width = 50; - progressTimer = gcnew Timer(); - - // The progress bar will update every second. - progressTimer->Interval = 1000; - progressTimer->Tick += gcnew EventHandler(this, - &VerticalProgressBar::progressTimer_Tick); - - // This property also calls SetupProgressBar to initialize - // the progress bar rectangles if styles are enabled. - NumberChunks = 20; - - // Set the default height if visual styles are not enabled. - if (!ProgressBarRenderer::IsSupported) - { - this->Height = 100; - } - } - - // Specify the number of progress bar chunks to base the height on. - public: - property int NumberChunks - { - int get() - { - return numberChunksValue; - } - - void set(int value) - { - if (value <= 50 && value > 0) - { - numberChunksValue = value; - } - else - { - MessageBox::Show("Number of chunks must be between " + - "0 and 50; defaulting to 10"); - numberChunksValue = 10; - } - - // Recalculate the progress bar size, if visual styles - // are active. - if (ProgressBarRenderer::IsSupported) - { - SetupProgressBar(); - } - } - } - - // - // Draw the progress bar in its normal state. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - if (ProgressBarRenderer::IsSupported) - { - ProgressBarRenderer::DrawVerticalBar(e->Graphics, - ClientRectangle); - this->Parent->Text = "VerticalProgressBar Enabled"; - } - else - { - this->Parent->Text = "VerticalProgressBar Disabled"; - } - } - // - - // - // Initialize the rectangles used to paint the states of the - // progress bar. - private: - void SetupProgressBar() - { - if (!ProgressBarRenderer::IsSupported) - { - return; - } - - // Determine the size of the progress bar frame. - this->Size = System::Drawing::Size(ClientRectangle.Width, - (NumberChunks * (ProgressBarRenderer::ChunkThickness + - (2 * ProgressBarRenderer::ChunkSpaceThickness))) + 6); - - // Initialize the rectangles to draw each step of the - // progress bar. - progressBarRectangles = gcnew array(NumberChunks); - - for (int i = 0; i < NumberChunks; i++) - { - // Use the thickness defined by the current visual style - // to calculate the height of each rectangle. The size - // adjustments ensure that the chunks do not paint over - // the frame. - - int filledRectangleHeight = - ((i + 1) * (ProgressBarRenderer::ChunkThickness + - (2 * ProgressBarRenderer::ChunkSpaceThickness))); - - progressBarRectangles[i] = Rectangle( - ClientRectangle.X + 3, - ClientRectangle.Y + ClientRectangle.Height - 3 - - filledRectangleHeight, - ClientRectangle.Width - 6, - filledRectangleHeight); - } - } - // - - // - // Handle the timer tick; draw each progressively larger rectangle. - private: - void progressTimer_Tick(Object^ myObject, EventArgs^ e) - { - if (ticks < NumberChunks) - { - Graphics^ g = this->CreateGraphics(); - ProgressBarRenderer::DrawVerticalChunks(g, - progressBarRectangles[ticks]); - ticks++; - } - else - { - progressTimer->Enabled = false; - } - } - // - - // Start the progress bar. - public: - void Start() - { - if (ProgressBarRenderer::IsSupported) - { - progressTimer->Start(); - } - else - { - MessageBox::Show("VerticalScrollBar requires visual styles"); - } - } - }; - - public ref class Form1 : public Form - { - private: - VerticalProgressBar^ bar1; - Button^ button1; - - public: - Form1() : Form() - { - this->Size = System::Drawing::Size(500, 500); - bar1 = gcnew VerticalProgressBar(); - bar1->NumberChunks = 30; - button1 = gcnew Button(); - button1->Location = Point(150, 10); - button1->Size = System::Drawing::Size(150, 30); - button1->Text = "Start VerticalProgressBar"; - button1->Click += gcnew EventHandler(this, &Form1::button1_Click); - Controls->AddRange(gcnew array { button1, bar1 }); - } - - // Start the VerticalProgressBar. - private: - void button1_Click(Object^ sender, EventArgs^ e) - { - bar1->Start(); - } - }; -} - - -[STAThread] -int main() -{ - // The call to EnableVisualStyles below does not affect - // whether ProgressBarRenderer.IsSupported is true; as - // long as visual styles are enabled by the operating system, - // IsSupported is true. - Application::EnableVisualStyles(); - Application::Run(gcnew ProgressBarRendererSample::Form1()); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp deleted file mode 100644 index c90c48049cd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp +++ /dev/null @@ -1,144 +0,0 @@ - - -#using -#using -#using - -// The following example combines some controls on -// a form with using a CheckedListBox and PropertyGrid. -// This method demonstrates the using the PropertyGrid.PropertySort, -// PropertyGrid.SelectedObjects, CheckedListBox.SelectionMode, -// and CheckListBox.ThreeDCheckBoxes, and CheckedListBox.CheckOnClick members. - -// -// This form combines uses a CheckedListBox and PropertyGrid to -// combine some controls. CheckedListBox1 is populated with itself -// and the other controls on the form. The user can then click Button1 -// to see the PropertyGrid for the selected controls. - -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -public ref class Form1: public System::Windows::Forms::Form -{ -internal: - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::Label ^ Label1; - System::Windows::Forms::Button^ Button1; - -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Label1 = gcnew System::Windows::Forms::Label; - this->Button1 = gcnew System::Windows::Forms::Button; - this->TextBox1->Location = System::Drawing::Point( 40, 20 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->TabIndex = 0; - this->TextBox1->Text = "TextBox1"; - this->Label1->Location = System::Drawing::Point( 40, 60 ); - this->Label1->Name = "Label1"; - this->Label1->TabIndex = 2; - this->Label1->Text = "Label1"; - this->Button1->Location = System::Drawing::Point( 40, 200 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 4; - this->Button1->Size = System::Drawing::Size( 100, 50 ); - this->Button1->Text = "Show properties for selected control(s)"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - this->ClientSize = System::Drawing::Size( 350, 350 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - InitializeCheckedListBox(); - InitializePropertyGrid(); - } - - // - // This method initializes CheckedListBox1 with a list of all - // the controls on the form. It sets the selection mode - // to single selection and allows selection with a single click. - // It adds itself to the list before adding itself to the form. -internal: - System::Windows::Forms::CheckedListBox^ CheckedListBox1; - -private: - void InitializeCheckedListBox() - { - this->CheckedListBox1 = gcnew CheckedListBox; - this->CheckedListBox1->Location = System::Drawing::Point( 40, 90 ); - this->CheckedListBox1->CheckOnClick = true; - this->CheckedListBox1->Name = "CheckedListBox1"; - this->CheckedListBox1->Size = System::Drawing::Size( 120, 94 ); - this->CheckedListBox1->TabIndex = 1; - this->CheckedListBox1->SelectionMode = SelectionMode::One; - this->CheckedListBox1->ThreeDCheckBoxes = true; - System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Control^ aControl = safe_cast(myEnum->Current); - this->CheckedListBox1->Items->Add( aControl, false ); - } - - this->CheckedListBox1->DisplayMember = "Name"; - this->CheckedListBox1->Items->Add( CheckedListBox1 ); - this->Controls->Add( this->CheckedListBox1 ); - } - // - - // - // Declare a propertyGrid. -internal: - PropertyGrid^ propertyGrid1; - -private: - - // Initialize propertyGrid1. - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - void InitializePropertyGrid() - { - propertyGrid1 = gcnew PropertyGrid; - propertyGrid1->Name = "PropertyGrid1"; - propertyGrid1->Location = System::Drawing::Point( 185, 20 ); - propertyGrid1->Size = System::Drawing::Size( 150, 300 ); - propertyGrid1->TabIndex = 5; - - // Set the sort to alphabetical and set Toolbar visible - // to false, so the user cannot change the sort. - propertyGrid1->PropertySort = PropertySort::Alphabetical; - propertyGrid1->ToolbarVisible = false; - propertyGrid1->Text = "Property Grid"; - - // Add the PropertyGrid to the form, but set its - // visibility to False so it will not appear when the form loads. - propertyGrid1->Visible = false; - this->Controls->Add( propertyGrid1 ); - } - // - - // Sets the SelectedObjects property of PropertyGrid1's - // SelectedObjects to the controls the user has selected in - // CheckedListBox1. - void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - propertyGrid1->Visible = true; - array^selectedControls = gcnew array(CheckedListBox1->CheckedItems->Count); - for ( int counter = 0; counter < CheckedListBox1->CheckedItems->Count; counter++ ) - { - selectedControls[ counter ] = dynamic_cast(CheckedListBox1->CheckedItems[ counter ]); - - } - propertyGrid1->SelectedObjects = selectedControls; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp deleted file mode 100644 index 18761cef505..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp +++ /dev/null @@ -1,161 +0,0 @@ -// This sample can go in RadioButtonRenderer class overview -// - Snippet2 can go in GetGlyphSize -// - Snippet4 can go in DrawRadioButton. -// - Snippet4 can also go in RadioButtonState enum, if necessary. - -// This sample mimics the RadioButton control. Might want to come up with a better -// customization sample that actually does something different from the RadioButton. - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace RadioButtonRendererSample -{ - public ref class CustomRadioButton : public Control - { - private: - Rectangle textRectangleValue; - private: - bool clicked; - private: - RadioButtonState state; - - public: - CustomRadioButton() : Control() - { - textRectangleValue = Rectangle(); - state = RadioButtonState::UncheckedNormal; - this->Location = Point(50, 50); - this->Size = System::Drawing::Size(100, 20); - this->Text = "Click here"; - this->Font = SystemFonts::IconTitleFont; - } - - // - // Define the text bounds so that the text rectangle - // does not include the radio button. - public: - property Rectangle TextRectangle - { - Rectangle get() - { - Graphics^ g = this->CreateGraphics(); - - textRectangleValue.X = ClientRectangle.X + - RadioButtonRenderer::GetGlyphSize(g, - RadioButtonState::UncheckedNormal).Width; - textRectangleValue.Y = ClientRectangle.Y; - textRectangleValue.Width = ClientRectangle.Width - - RadioButtonRenderer::GetGlyphSize(g, - RadioButtonState::UncheckedNormal).Width; - textRectangleValue.Height = ClientRectangle.Height; - - delete g; - - return textRectangleValue; - } - } - // - - // - // Draw the radio button in the current state. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - RadioButtonRenderer::DrawRadioButton(e->Graphics, - ClientRectangle.Location, TextRectangle, this->Text, - this->Font, clicked, state); - } - - // Draw the radio button in the checked or unchecked state. - protected: - virtual void OnMouseDown(MouseEventArgs^ e) override - { - __super::OnMouseDown(e); - - if (!clicked) - { - clicked = true; - this->Text = "Clicked!"; - state = RadioButtonState::CheckedPressed; - Invalidate(); - } - else - { - clicked = false; - this->Text = "Click here"; - state = RadioButtonState::UncheckedNormal; - Invalidate(); - } - } - // - - // Draw the radio button in the hot state. - protected: - virtual void OnMouseHover(EventArgs^ e) override - { - __super::OnMouseHover(e); - state = clicked ? RadioButtonState::CheckedHot : - RadioButtonState::UncheckedHot; - Invalidate(); - } - - // Draw the radio button in the hot state. - protected: - virtual void OnMouseUp(MouseEventArgs^ e) override - { - __super::OnMouseUp(e); - this->OnMouseHover(e); - } - - // Draw the radio button in the normal (i.e. not hot) state - protected: - virtual void OnMouseLeave(EventArgs^ e) override - { - __super::OnMouseLeave(e); - state = clicked ? RadioButtonState::CheckedNormal : - RadioButtonState::UncheckedNormal; - Invalidate(); - } - }; - - public ref class Form1 : public Form - { - public: - Form1() : Form() - { - Controls->Add(gcnew CustomRadioButton()); - - if (Application::RenderWithVisualStyles) - { - this->Text = "Visual Styles Enabled"; - } - else - { - this->Text = "Visual Styles Disabled"; - } - } - }; -} - -[STAThread] -int main() -{ - // If you do not call EnableVisualStyles below, then - // RadioButtonRenderer.DrawRadioButton automatically detects - // this and draws the radio button without visual styles. - Application::EnableVisualStyles(); - Application::Run(gcnew RadioButtonRendererSample::Form1()); -} -// - - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp deleted file mode 100644 index d026e56633a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp +++ /dev/null @@ -1,170 +0,0 @@ - - -#using -#using -#using - -// This example demonstrates using the following members: -// Form.BackColor, Control.RectangleToScreen, Control.PointToScreen, -// ControlPaint.DrawReversibleFrame, and Rectangle.Intersects. -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - // This call is required by the Windows Form Designer. - InitializeComponent(); - isDrag = false; - theRectangle = Rectangle(Point(0,0),System::Drawing::Size( 0, 0 )); - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - } - - -internal: - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Button^ Button2; - System::Windows::Forms::Label ^ Label1; - -private: - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Button2 = gcnew System::Windows::Forms::Button; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - this->Button1->Location = System::Drawing::Point( 40, 64 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 80, 50 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Click for a bigger form."; - this->Button2->Location = System::Drawing::Point( 144, 64 ); - this->Button2->Name = "Button2"; - this->Button2->Size = System::Drawing::Size( 72, 48 ); - this->Button2->TabIndex = 1; - this->Button2->Text = "Click me and nothing happens."; - this->Label1->Location = System::Drawing::Point( 72, 168 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 152, 32 ); - this->Label1->TabIndex = 2; - this->Label1->Text = "Click and drag on screen to see a frame drawn."; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - - // Explicitly set the form's BackColor property. - this->BackColor = Color::Cornsilk; - this->ResumeLayout( false ); - - // Associate the event-handling methods with the appropriate - // event. - this->MouseDown += gcnew MouseEventHandler( this, &Form1::Form1_MouseDown ); - this->MouseMove += gcnew MouseEventHandler( this, &Form1::Form1_MouseMove ); - this->MouseUp += gcnew MouseEventHandler( this, &Form1::Form1_MouseUp ); - } - - // -private: - // This method retrieves the form's client rectangle, inflates it, - // and forces layout of the form by resetting the bounds. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - Rectangle clientRectangle = this->ClientRectangle; - clientRectangle.Inflate( 50, 50 ); - - // Convert the rectangle coordinates to screen coordinates. - this->Bounds = this->RectangleToScreen( clientRectangle ); - } - // - - // -private: - // The following three methods will draw a rectangle and allow - // the user to use the mouse to resize the rectangle. If the - // rectangle intersects a control's client rectangle, the - // control's color will change. - bool isDrag; - Rectangle theRectangle; - Point startPoint; - void Form1_MouseDown( Object^ sender, System::Windows::Forms::MouseEventArgs^ e ) - { - - // Set the isDrag variable to true and get the starting point - // by using the PointToScreen method to convert form - // coordinates to screen coordinates. - if ( e->Button == ::MouseButtons::Left ) - { - isDrag = true; - } - - Control^ control = dynamic_cast(sender); - - // Calculate the startPoint by using the PointToScreen - // method. - startPoint = control->PointToScreen( Point(e->X,e->Y) ); - } - - void Form1_MouseMove( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) - { - - // If the mouse is being dragged, - // undraw and redraw the rectangle as the mouse moves. - if ( isDrag ) - { - ControlPaint::DrawReversibleFrame( theRectangle, this->BackColor, FrameStyle::Dashed ); - - // Calculate the endpoint and dimensions for the new - // rectangle, again using the PointToScreen method. - Point endPoint = this->PointToScreen( Point(e->X,e->Y) ); - int width = endPoint.X - startPoint.X; - int height = endPoint.Y - startPoint.Y; - theRectangle = Rectangle(startPoint.X,startPoint.Y,width,height); - - // Draw the new rectangle by calling DrawReversibleFrame - // again. - ControlPaint::DrawReversibleFrame( theRectangle, this->BackColor, FrameStyle::Dashed ); - } - } - - void Form1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ) - { - - // If the MouseUp event occurs, the user is not dragging. - isDrag = false; - - // Draw the rectangle to be evaluated. Set a dashed frame style - // using the FrameStyle enumeration. - ControlPaint::DrawReversibleFrame( theRectangle, this->BackColor, FrameStyle::Dashed ); - - // Find out which controls intersect the rectangle and - // change their color. The method uses the RectangleToScreen - // method to convert the Control's client coordinates - // to screen coordinates. - Rectangle controlRectangle; - for ( int i = 0; i < Controls->Count; i++ ) - { - controlRectangle = Controls[ i ]->RectangleToScreen( Controls[ i ]->ClientRectangle ); - if ( controlRectangle.IntersectsWith( theRectangle ) ) - { - Controls[ i ]->BackColor = Color::BurlyWood; - } - - } - - // Reset the rectangle. - theRectangle = Rectangle(0,0,0,0); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp deleted file mode 100644 index 7f49035f432..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp +++ /dev/null @@ -1,160 +0,0 @@ - - -#using -#using -#using - -// The following example demonstrates using the -// RichTextBox.GetLineFromCharIndex method. -using namespace System::Windows::Forms; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::RichTextBox^ RichTextBox1; - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::TextBox^ TextBox2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->TextBox2 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 40, 32 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 80, 40 ); - this->Button1->TabIndex = 1; - this->Button1->Text = "Find line numbers."; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //RichTextBox1 - // - this->RichTextBox1->Location = System::Drawing::Point( 40, 88 ); - this->RichTextBox1->Name = "RichTextBox1"; - this->RichTextBox1->TabIndex = 2; - this->RichTextBox1->Text = "This text will contain name several times." - "Here is name again, and again: name"; - - // - //TextBox1 - // - this->TextBox1->Location = System::Drawing::Point( 168, 104 ); - this->TextBox1->Multiline = true; - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 88, 64 ); - this->TextBox1->TabIndex = 3; - this->TextBox1->Text = ""; - - // - //TextBox2 - // - this->TextBox2->Location = System::Drawing::Point( 152, 48 ); - this->TextBox2->Name = "TextBox2"; - this->TextBox2->TabIndex = 4; - this->TextBox2->Text = "name"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->TextBox2 ); - this->Controls->Add( this->TextBox1 ); - this->Controls->Add( this->RichTextBox1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // This method demonstrates retrieving line numbers that - // indicate the location of a particular word - // contained in a RichTextBox. The line numbers are zero-based. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Reset the results box. - TextBox1->Text = ""; - - // Get the word to search from from TextBox2. - String^ searchWord = TextBox2->Text; - int index = 0; - - //Declare an ArrayList to store line numbers. - System::Collections::ArrayList^ lineList = gcnew System::Collections::ArrayList; - do - { - // Find occurrences of the search word, incrementing - // the start index. - index = RichTextBox1->Find( searchWord, index + 1, RichTextBoxFinds::MatchCase ); - if ( index != -1 ) - { - lineList->Add( RichTextBox1->GetLineFromCharIndex( index ) ); - } - } - while ( (index != -1) ); - - // Iterate through the list and display the line numbers in TextBox1. - System::Collections::IEnumerator^ myEnumerator = lineList->GetEnumerator(); - if ( lineList->Count <= 0 ) - { - TextBox1->Text = searchWord + " was not found"; - } - else - { - TextBox1->SelectedText = searchWord + " was found on line(s):"; - while ( myEnumerator->MoveNext() ) - { - TextBox1->SelectedText = myEnumerator->Current + " "; - } - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp deleted file mode 100644 index 9e696539fba..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#using -#using -#using -#using - -// The following code example demonstrates using the -// RichTextBox1.SaveFile and RichTextBox.LoadFile methods with streams. -// It also demonstrates using the FileDialog.FileName, -// SaveFileDialog.CreatePrompt, SaveFileDialog.OverwritePrompt, and -// TextBox.Click members. -// -using namespace System; -using namespace System::Drawing; -using namespace System::IO; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -public private: - RichTextBox^ RichTextBox1; - Button^ Button1; - RichTextBox^ RichTextBox2; - Button^ Button2; - SaveFileDialog^ SaveFileDialog1; - -public: - Form1() - : Form() - { - userInput = gcnew MemoryStream; - this->RichTextBox1 = gcnew RichTextBox; - this->Button1 = gcnew Button; - this->RichTextBox2 = gcnew RichTextBox; - this->Button2 = gcnew Button; - this->SaveFileDialog1 = gcnew SaveFileDialog; - this->SuspendLayout(); - this->RichTextBox1->Location = Point( 24, 64 ); - this->RichTextBox1->Name = "RichTextBox1"; - this->RichTextBox1->TabIndex = 0; - this->RichTextBox1->Text = "Type something here."; - this->Button1->Location = Point( 96, 16 ); - this->Button1->Name = "Button1"; - this->Button1->Size = Size( 96, 24 ); - this->Button1->TabIndex = 1; - this->Button1->Text = "Save To Stream"; - this->Button1->Click += - gcnew EventHandler( this, &Form1::Button1_Click ); - this->RichTextBox2->Location = Point( 152, 64 ); - this->RichTextBox2->Name = "RichTextBox2"; - this->RichTextBox2->TabIndex = 3; - this->RichTextBox2->Text = "It will be added to the stream " - "and appear here."; - this->Button2->Location = Point( 104, 200 ); - this->Button2->Name = "Button2"; - this->Button2->Size = Size( 88, 32 ); - this->Button2->TabIndex = 4; - this->Button2->Text = "Save Stream To File"; - this->Button2->Click += - gcnew EventHandler( this, &Form1::Button2_Click ); - this->ClientSize = Size( 292, 266 ); - this->Controls->Add( this->Button2 ); - this->Controls->Add( this->RichTextBox2 ); - this->Controls->Add( this->Button1 ); - this->Controls->Add( this->RichTextBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // Declare a new memory stream. - MemoryStream^ userInput; - -private: - - // Save the content of RichTextBox1 to the memory stream, - // appending a LineFeed character. - void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - RichTextBox1->SaveFile( userInput, RichTextBoxStreamType::PlainText ); - userInput->WriteByte( 13 ); - - // Display the entire contents of the stream, - // by setting its position to 0, to RichTextBox2. - userInput->Position = 0; - RichTextBox2->LoadFile( userInput, RichTextBoxStreamType::PlainText ); - } - - - // Shows the use of a SaveFileDialog to save a MemoryStream to a file. - void Button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Set the properties on SaveFileDialog1 so the user is - // prompted to create the file if it doesn't exist - // or overwrite the file if it does exist. - SaveFileDialog1->CreatePrompt = true; - SaveFileDialog1->OverwritePrompt = true; - - // Set the file name to myText.txt, set the type filter - // to text files, and set the initial directory to the - // MyDocuments folder. - SaveFileDialog1->FileName = "myText"; - // DefaultExt is only used when "All files" is selected from - // the filter box and no extension is specified by the user. - SaveFileDialog1->DefaultExt = "txt"; - SaveFileDialog1->Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; - SaveFileDialog1->InitialDirectory = - Environment->GetFolderPath(Environment::SpecialFolder::MyDocuments); - - // Call ShowDialog and check for a return value of DialogResult.OK, - // which indicates that the file was saved. - DialogResult result = SaveFileDialog1->ShowDialog(); - Stream^ fileStream; - if ( result == DialogResult::OK ) - { - fileStream = SaveFileDialog1->OpenFile(); - userInput->Position = 0; - userInput->WriteTo( fileStream ); - fileStream->Close(); - } - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp deleted file mode 100644 index ffadecad709..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp +++ /dev/null @@ -1,95 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 112, 32 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "Resize form"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // This method will adjust the size of the form to utilize - // the working area of the screen. -private: - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Retrieve the working rectangle from the Screen class - // using the PrimaryScreen and the WorkingArea properties. - System::Drawing::Rectangle workingRectangle = Screen::PrimaryScreen->WorkingArea; - - // Set the size of the form slightly less than size of - // working rectangle. - this->Size = System::Drawing::Size( workingRectangle.Width - 10, workingRectangle.Height - 10 ); - - // Set the location so the entire form is visible. - this->Location = System::Drawing::Point( 5, 5 ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp deleted file mode 100644 index 39977831372..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp +++ /dev/null @@ -1,421 +0,0 @@ -// This sample can go in ScrollBarRenderer class overview. -// - Snippet2 can go in IsSupported, DrawRightHorizontalTrack, -// DrawHorizontalThumb, DrawHorizontalThumbGrip, DrawArrowButton, -// and, if necessary, ScrollBarState and ScrollBarArrowButtonState enums. - -// This sample simulates a horizontal scroll bar. -// For simplicity, this sample does not handle runtime -// switching of visual styles. - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace ScrollBarRendererSample -{ - public ref class CustomScrollBar : public Control - { - private: - Rectangle clickedBarRectangle; - private: - Rectangle thumbRectangle; - private: - Rectangle leftArrowRectangle; - private: - Rectangle rightArrowRectangle; - private: - bool leftArrowClicked; - private: - bool rightArrowClicked; - private: - bool leftBarClicked; - private: - bool rightBarClicked; - private: - bool thumbClicked; - private: - ScrollBarState thumbState; - private: - ScrollBarArrowButtonState leftButtonState; - private: - ScrollBarArrowButtonState rightButtonState; - private: - int thumbWidth; - private: - int arrowWidth; - - // The right limit of the thumb's right border. - private: - int thumbRightLimitRight; - - // The right limit of the thumb's left border. - private: - int thumbRightLimitLeft; - - // The left limit of thumb's left border. - private: - int thumbLeftLimit; - - // The distance from the left edge of the thumb to the - // cursor tip. - private: - int thumbPosition; - - // The distance from the left edge of the scroll bar track - // to the cursor tip. - private: - int trackPosition; - - // This timer draws the moving thumb while the scroll arrows or - // track are pressed. - private: - Timer^ progressTimer; - - public: - CustomScrollBar() : Control() - { - thumbState = ScrollBarState::Normal; - leftButtonState = ScrollBarArrowButtonState::LeftNormal; - rightButtonState = ScrollBarArrowButtonState::RightNormal; - - // This control does not allow these widths to be altered. - thumbWidth = 15; - arrowWidth = 17; - - progressTimer = gcnew Timer(); - this->Location = Point(10, 10); - this->Width = 200; - this->Height = 20; - this->DoubleBuffered = true; - - SetUpScrollBar(); - progressTimer->Interval = 20; - progressTimer->Tick += - gcnew EventHandler(this, &CustomScrollBar::progressTimer_Tick); - } - - // Calculate the sizes of the scroll bar elements. - private: - void SetUpScrollBar() - { - clickedBarRectangle = ClientRectangle; - thumbRectangle = Rectangle( - ClientRectangle.X + ClientRectangle.Width / 2, - ClientRectangle.Y, thumbWidth, - ClientRectangle.Height); - leftArrowRectangle = Rectangle( - ClientRectangle.X, ClientRectangle.Y, - arrowWidth, ClientRectangle.Height); - rightArrowRectangle = Rectangle( - ClientRectangle.Right - arrowWidth, - ClientRectangle.Y, arrowWidth, - ClientRectangle.Height); - - // Set the default starting thumb position. - thumbPosition = thumbWidth / 2; - - // Set the right limit of the thumb's right border. - thumbRightLimitRight = ClientRectangle.Right - arrowWidth; - - // Set the right limit of the thumb's left border. - thumbRightLimitLeft = thumbRightLimitRight - thumbWidth; - - // Set the left limit of the thumb's left border. - thumbLeftLimit = ClientRectangle.X + arrowWidth; - } - - // - // Draw the scroll bar in its normal state. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - // Visual styles are not enabled. - if (!ScrollBarRenderer::IsSupported) - { - this->Parent->Text = "CustomScrollBar Disabled"; - return; - } - - this->Parent->Text = "CustomScrollBar Enabled"; - - // Draw the scroll bar track. - ScrollBarRenderer::DrawRightHorizontalTrack(e->Graphics, - ClientRectangle, ScrollBarState::Normal); - - // Draw the thumb and thumb grip in the current state. - ScrollBarRenderer::DrawHorizontalThumb(e->Graphics, - thumbRectangle, thumbState); - ScrollBarRenderer::DrawHorizontalThumbGrip(e->Graphics, - thumbRectangle, thumbState); - - // Draw the scroll arrows in the current state. - ScrollBarRenderer::DrawArrowButton(e->Graphics, - leftArrowRectangle, leftButtonState); - ScrollBarRenderer::DrawArrowButton(e->Graphics, - rightArrowRectangle, rightButtonState); - - // Draw a highlighted rectangle in the left side of the scroll - // bar track if the user has clicked between the left arrow - // and thumb. - if (leftBarClicked) - { - clickedBarRectangle.X = thumbLeftLimit; - clickedBarRectangle.Width = thumbRectangle.X - thumbLeftLimit; - ScrollBarRenderer::DrawLeftHorizontalTrack(e->Graphics, - clickedBarRectangle, ScrollBarState::Pressed); - } - - // Draw a highlighted rectangle in the right side of the scroll - // bar track if the user has clicked between the right arrow - // and thumb. - else if (rightBarClicked) - { - clickedBarRectangle.X = - thumbRectangle.X + thumbRectangle.Width; - clickedBarRectangle.Width = - thumbRightLimitRight - clickedBarRectangle.X; - ScrollBarRenderer::DrawRightHorizontalTrack(e->Graphics, - clickedBarRectangle, ScrollBarState::Pressed); - } - } - // - - // Handle a mouse click in the scroll bar. - protected: - virtual void OnMouseDown(MouseEventArgs^ e) override - { - __super::OnMouseDown(e); - - if (!ScrollBarRenderer::IsSupported) - { - return; - } - - // When the thumb is clicked, update the distance from the left - // edge of the thumb to the cursor tip. - if (thumbRectangle.Contains(e->Location)) - { - thumbClicked = true; - thumbPosition = e->Location.X - thumbRectangle.X; - thumbState = ScrollBarState::Pressed; - } - - // When the left arrow is clicked, start the timer to scroll - // while the arrow is held down. - else if (leftArrowRectangle.Contains(e->Location)) - { - leftArrowClicked = true; - leftButtonState = ScrollBarArrowButtonState::LeftPressed; - progressTimer->Start(); - } - - // When the right arrow is clicked, start the timer to scroll - // while the arrow is held down. - else if (rightArrowRectangle.Contains(e->Location)) - { - rightArrowClicked = true; - rightButtonState = ScrollBarArrowButtonState::RightPressed; - progressTimer->Start(); - } - - // When the scroll bar is clicked, start the timer to move the - // thumb while the mouse is held down. - else - { - trackPosition = e->Location.X; - - if (e->Location.X < this->thumbRectangle.X) - { - leftBarClicked = true; - } - else - { - rightBarClicked = true; - } - progressTimer->Start(); - } - - Invalidate(); - } - - // Draw the track. - protected: - virtual void OnMouseUp(MouseEventArgs^ e) override - { - __super::OnMouseUp(e); - - if (!ScrollBarRenderer::IsSupported) - { - return; - } - - // Update the thumb position, if the new location is within - // the bounds. - if (thumbClicked) - { - thumbClicked = false; - thumbState = ScrollBarState::Normal; - - if (e->Location.X > (thumbLeftLimit + thumbPosition) && - e->Location.X < (thumbRightLimitLeft + thumbPosition)) - { - thumbRectangle.X = e->Location.X - thumbPosition; - } - } - - // If one of the four thumb movement areas was clicked, - // stop the timer. - else if (leftArrowClicked) - { - leftArrowClicked = false; - leftButtonState = ScrollBarArrowButtonState::LeftNormal; - progressTimer->Stop(); - } - - else if (rightArrowClicked) - { - rightArrowClicked = false; - rightButtonState = ScrollBarArrowButtonState::RightNormal; - progressTimer->Stop(); - } - - else if (leftBarClicked) - { - leftBarClicked = false; - progressTimer->Stop(); - } - - else if (rightBarClicked) - { - rightBarClicked = false; - progressTimer->Stop(); - } - - Invalidate(); - } - - // Track mouse movements if the user clicks on the scroll bar thumb. - protected: - virtual void OnMouseMove(MouseEventArgs^ e) override - { - __super::OnMouseMove(e); - - if (!ScrollBarRenderer::IsSupported) - { - return; - } - - // Update the thumb position, if the new location is - // within the bounds. - if (thumbClicked) - { - // The thumb is all the way to the left. - if (e->Location.X <= (thumbLeftLimit + thumbPosition)) - { - thumbRectangle.X = thumbLeftLimit; - } - - // The thumb is all the way to the right. - else if (e->Location.X >= - (thumbRightLimitLeft + thumbPosition)) - { - thumbRectangle.X = thumbRightLimitLeft; - } - - // The thumb is between the ends of the track. - else - { - thumbRectangle.X = e->Location.X - thumbPosition; - } - - Invalidate(); - } - } - - // Recalculate the sizes of the scroll bar elements. - protected: - virtual void OnSizeChanged(EventArgs^ e) override - { - __super::OnSizeChanged(e); - SetUpScrollBar(); - } - - // Handle the timer tick by updating the thumb position. - private: - void progressTimer_Tick(Object^ sender, EventArgs^ myEventArgs) - { - if (!ScrollBarRenderer::IsSupported) - { - return; - } - - // If an arrow is clicked, move the thumb in small increments. - if (rightArrowClicked && thumbRectangle.X < thumbRightLimitLeft) - { - thumbRectangle.X++; - } - else if (leftArrowClicked && thumbRectangle.X > thumbLeftLimit) - { - thumbRectangle.X--; - } - - // If the track bar to right of the thumb is clicked, move the - // thumb to the right in larger increments until the right edge - // of the thumb hits the cursor. - else if (rightBarClicked && - thumbRectangle.X < thumbRightLimitLeft && - thumbRectangle.X + thumbRectangle.Width < trackPosition) - { - thumbRectangle.X += 3; - } - - // If the track bar to left of the thumb is clicked, move the - // thumb to the left in larger increments until the left edge - // of the thumb hits the cursor. - else if (leftBarClicked && - thumbRectangle.X > thumbLeftLimit && - thumbRectangle.X > trackPosition) - { - thumbRectangle.X -= 3; - } - - Invalidate(); - } - }; - - - public ref class Form1 : public Form - { - public: - Form1() : Form() - { - this->Size = System::Drawing::Size(500, 500); - - CustomScrollBar^ sampleCustomScrollBar = gcnew CustomScrollBar(); - sampleCustomScrollBar->Location = Point(50, 100); - sampleCustomScrollBar->Size = System::Drawing::Size(200, 20); - - Controls->Add(sampleCustomScrollBar); - } - }; -} - -[STAThread] -int main() -{ - // The call to EnableVisualStyles below does not affect whether - // ScrollBarRenderer.IsSupported is true; as long as visual styles - // are enabled by the operating system, IsSupported is true. - Application::EnableVisualStyles(); - Application::Run(gcnew ScrollBarRendererSample::Form1()); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp deleted file mode 100644 index d66f118f23c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp +++ /dev/null @@ -1,127 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //Me call is required by the Windows Form Designer. - InitializeComponent(); - SetFourDifferentScrollBars(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->SuspendLayout(); - - // - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Declare four textboxes. -internal: - System::Windows::Forms::TextBox^ vertical; - System::Windows::Forms::TextBox^ horizontal; - System::Windows::Forms::TextBox^ both; - System::Windows::Forms::TextBox^ none; - -private: - void SetFourDifferentScrollBars() - { - this->vertical = gcnew System::Windows::Forms::TextBox; - this->horizontal = gcnew System::Windows::Forms::TextBox; - this->both = gcnew System::Windows::Forms::TextBox; - this->none = gcnew System::Windows::Forms::TextBox; - - // Create a string for the Text property. - String^ startString = "The scroll bar style for my textbox is: "; - - // Set the location of the four textboxes. - horizontal->Location = Point(10,10); - vertical->Location = Point(10,70); - none->Location = Point(10,170); - both->Location = Point(10,110); - - // For horizonal scroll bars, the Multiline property must - // be true and the WordWrap property must be false. - // Increase the size of the Height property to ensure the - // scroll bar is visible. - horizontal->ScrollBars = ScrollBars::Horizontal; - horizontal->Multiline = true; - horizontal->WordWrap = false; - horizontal->Height = 40; - horizontal->Text = String::Concat( startString, ScrollBars::Horizontal ); - - // For the vertical scroll bar, Multiline must be true. - vertical->ScrollBars = ScrollBars::Vertical; - vertical->Multiline = true; - vertical->Text = String::Concat( startString, ScrollBars::Vertical ); - - // For both scroll bars, the Multiline property - // must be true, and the WordWrap property must be false. - // Increase the size of the Height property to ensure the - // scroll bar is visible. - both->ScrollBars = ScrollBars::Both; - both->Multiline = true; - both->WordWrap = false; - both->Height = 40; - both->AcceptsReturn = true; - both->Text = String::Concat( startString, ScrollBars::Both ); - - // The none scroll bar does not require specific - // property settings. - none->ScrollBars = ScrollBars::None; - none->Text = String::Concat( startString, ScrollBars::None ); - - // Add the textboxes to the form. - this->Controls->Add( this->vertical ); - this->Controls->Add( this->horizontal ); - this->Controls->Add( this->both ); - this->Controls->Add( this->none ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp deleted file mode 100644 index 7253be011cf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp +++ /dev/null @@ -1,173 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::MonthCalendar^ monthCalendar1; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::TextBox^ textBox2; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label2; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support; do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->textBox2 = gcnew System::Windows::Forms::TextBox; - this->label1 = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // monthCalendar1 - // - this->monthCalendar1->Location = System::Drawing::Point( 10, 8 ); - this->monthCalendar1->Name = "monthCalendar1"; - this->monthCalendar1->TabIndex = 0; - this->monthCalendar1->DateChanged += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateChanged ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 96, 176 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 104, 20 ); - this->textBox1->TabIndex = 1; - this->textBox1->Text = ""; - - // - // textBox2 - // - this->textBox2->Location = System::Drawing::Point( 96, 208 ); - this->textBox2->Name = "textBox2"; - this->textBox2->Size = System::Drawing::Size( 104, 20 ); - this->textBox2->TabIndex = 2; - this->textBox2->Text = ""; - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 24, 176 ); - this->label1->Name = "label1"; - this->label1->Size = System::Drawing::Size( 72, 23 ); - this->label1->TabIndex = 3; - this->label1->Text = "Start"; - - // - // label2 - // - this->label2->Location = System::Drawing::Point( 24, 208 ); - this->label2->Name = "label2"; - this->label2->Size = System::Drawing::Size( 72, 23 ); - this->label2->TabIndex = 4; - this->label2->Text = "End"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 72, 248 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 5; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 216, 277 ); - array^temp0 = {this->button1,this->label2,this->label1,this->textBox2,this->textBox1,this->monthCalendar1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - // Create a SelectionRange object and set its Start and End properties. - SelectionRange^ sr = gcnew SelectionRange; - sr->Start = DateTime::Parse( this->textBox1->Text ); - sr->End = DateTime::Parse( this->textBox2->Text ); - - /* Assign the SelectionRange object to the - SelectionRange property of the MonthCalendar control. */ - this->monthCalendar1->SelectionRange = sr; - } - - void monthCalendar1_DateChanged( Object^ /*sender*/, DateRangeEventArgs^ /*e*/ ) - { - /* Display the Start and End property values of - the SelectionRange object in the text boxes. */ - this->textBox1->Text = monthCalendar1->SelectionRange->Start.Date.ToShortDateString(); - this->textBox2->Text = monthCalendar1->SelectionRange->End.Date.ToShortDateString(); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp deleted file mode 100644 index 5227d040486..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp +++ /dev/null @@ -1,110 +0,0 @@ - - -#using -#using -#using - -//The following code example shows the use of the -// SendKeys.Send method. -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::Label ^ Label1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - //Button1 - // - this->Button1->Location = System::Drawing::Point( 96, 72 ); - this->Button1->Name = "Button1"; - this->Button1->TabIndex = 0; - this->Button1->Text = "&Click"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - - // - //Label1 - // - this->Label1->Location = System::Drawing::Point( 80, 16 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 128, 32 ); - this->Label1->TabIndex = 1; - this->Label1->Text = "Double-clicking form, clicks the button"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - this->DoubleClick += gcnew System::EventHandler( this, &Form1::Form1_DoubleClick ); - } - - // -private: - // Clicking Button1 causes a message box to appear. - void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( "Click here!" ); - } - - // Use the SendKeys.Send method to raise the Button1 click event - // and display the message box. - void Form1_DoubleClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Send the enter key; since the tab stop of Button1 is 0, this - // will trigger the click event. - SendKeys::Send( "{ENTER}" ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp deleted file mode 100644 index 875f03c8009..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp +++ /dev/null @@ -1,414 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Diagnostics; -using namespace System::Drawing; -using namespace System::Media; -using namespace System::Windows::Forms; - -public ref class SoundTestForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::TextBox^ filepathTextbox; - System::Windows::Forms::Button^ playOnceSyncButton; - System::Windows::Forms::Button^ playOnceAsyncButton; - System::Windows::Forms::Button^ playLoopAsyncButton; - System::Windows::Forms::Button^ selectFileButton; - System::Windows::Forms::Button^ stopButton; - System::Windows::Forms::StatusBar^ statusBar; - System::Windows::Forms::Button^ loadSyncButton; - System::Windows::Forms::Button^ loadAsyncButton; - SoundPlayer^ player; - -public: - SoundTestForm() - { - - // Initialize Forms Designer generated code. - InitializeComponent(); - - // Disable playback controls until a valid .wav file - // is selected. - EnablePlaybackControls( false ); - - // Set up the status bar and other controls. - InitializeControls(); - - // Set up the SoundPlayer object. - InitializeSound(); - } - - -private: - - // Sets up the status bar and other controls. - void InitializeControls() - { - - // Set up the status bar. - StatusBarPanel^ panel = gcnew StatusBarPanel; - panel->BorderStyle = StatusBarPanelBorderStyle::Sunken; - panel->Text = "Ready."; - panel->AutoSize = StatusBarPanelAutoSize::Spring; - this->statusBar->ShowPanels = true; - this->statusBar->Panels->Add( panel ); - } - - - // Sets up the SoundPlayer object. - void InitializeSound() - { - - // Create an instance of the SoundPlayer class. - player = gcnew SoundPlayer; - - // Listen for the LoadCompleted event. - player->LoadCompleted += gcnew AsyncCompletedEventHandler( this, &SoundTestForm::player_LoadCompleted ); - - // Listen for the SoundLocationChanged event. - player->SoundLocationChanged += gcnew EventHandler( this, &SoundTestForm::player_LocationChanged ); - } - - void selectFileButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Create a new OpenFileDialog. - OpenFileDialog^ dlg = gcnew OpenFileDialog; - - // Make sure the dialog checks for existence of the - // selected file. - dlg->CheckFileExists = true; - - // Allow selection of .wav files only. - dlg->Filter = "WAV files (*.wav)|*.wav"; - dlg->DefaultExt = ".wav"; - - // Activate the file selection dialog. - if ( dlg->ShowDialog() == ::DialogResult::OK ) - { - - // Get the selected file's path from the dialog. - this->filepathTextbox->Text = dlg->FileName; - - // Assign the selected file's path to - // the SoundPlayer object. - player->SoundLocation = filepathTextbox->Text; - } - } - - - // Convenience method for setting message text in - // the status bar. - void ReportStatus( String^ statusMessage ) - { - - // If the caller passed in a message... - if ( (statusMessage != nullptr) && (statusMessage != String::Empty) ) - { - - // ...post the caller's message to the status bar. - this->statusBar->Panels[ 0 ]->Text = statusMessage; - } - } - - - // Enables and disables play controls. - void EnablePlaybackControls( bool enabled ) - { - this->playOnceSyncButton->Enabled = enabled; - this->playOnceAsyncButton->Enabled = enabled; - this->playLoopAsyncButton->Enabled = enabled; - this->stopButton->Enabled = enabled; - } - - void filepathTextbox_TextChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Disable playback controls until the new .wav is loaded. - EnablePlaybackControls( false ); - } - - void loadSyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Disable playback controls until the .wav is - // successfully loaded. The LoadCompleted event - // handler will enable them. - EnablePlaybackControls( false ); - - // - try - { - - // Assign the selected file's path to - // the SoundPlayer object. - player->SoundLocation = filepathTextbox->Text; - - // Load the .wav file. - player->Load(); - } - catch ( Exception^ ex ) - { - ReportStatus( ex->Message ); - } - - - // - } - - void loadAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Disable playback controls until the .wav is - // successfully loaded. The LoadCompleted event - // handler will enable them. - EnablePlaybackControls( false ); - - // - try - { - - // Assign the selected file's path to - // the SoundPlayer object. - player->SoundLocation = this->filepathTextbox->Text; - - // Load the .wav file. - player->LoadAsync(); - } - catch ( Exception^ ex ) - { - ReportStatus( ex->Message ); - } - - - // - } - - - // Synchronously plays the selected .wav file once. - // If the file is large, UI response will be visibly - // affected. - void playOnceSyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // - ReportStatus( "Playing .wav file synchronously." ); - player->PlaySync(); - ReportStatus( "Finished playing .wav file synchronously." ); - - // - } - - - // Asynchronously plays the selected .wav file once. - void playOnceAsyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // - ReportStatus( "Playing .wav file asynchronously." ); - player->Play(); - - // - } - - - // Asynchronously plays the selected .wav file until the user - // clicks the Stop button. - void playLoopAsyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // - ReportStatus( "Looping .wav file asynchronously." ); - player->PlayLooping(); - - // - } - - - // Stops the currently playing .wav file, if any. - void stopButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // - player->Stop(); - ReportStatus( "Stopped by user." ); - - // - } - - - // - // Handler for the LoadCompleted event. - void player_LoadCompleted( Object^ /*sender*/, AsyncCompletedEventArgs^ /*e*/ ) - { - String^ message = String::Format( "LoadCompleted: {0}", this->filepathTextbox->Text ); - ReportStatus( message ); - EnablePlaybackControls( true ); - } - - - // - // - // Handler for the SoundLocationChanged event. - void player_LocationChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - String^ message = String::Format( "SoundLocationChanged: {0}", player->SoundLocation ); - ReportStatus( message ); - } - - - // - void InitializeComponent() - { - this->filepathTextbox = gcnew System::Windows::Forms::TextBox; - this->selectFileButton = gcnew System::Windows::Forms::Button; - this->label1 = gcnew System::Windows::Forms::Label; - this->loadSyncButton = gcnew System::Windows::Forms::Button; - this->playOnceSyncButton = gcnew System::Windows::Forms::Button; - this->playOnceAsyncButton = gcnew System::Windows::Forms::Button; - this->stopButton = gcnew System::Windows::Forms::Button; - this->playLoopAsyncButton = gcnew System::Windows::Forms::Button; - this->statusBar = gcnew System::Windows::Forms::StatusBar; - this->loadAsyncButton = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // filepathTextbox - // - this->filepathTextbox->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->filepathTextbox->Location = System::Drawing::Point( 7, 25 ); - this->filepathTextbox->Name = "filepathTextbox"; - this->filepathTextbox->Size = System::Drawing::Size( 263, 20 ); - this->filepathTextbox->TabIndex = 1; - this->filepathTextbox->Text = ""; - this->filepathTextbox->TextChanged += gcnew System::EventHandler( this, &SoundTestForm::filepathTextbox_TextChanged ); - - // - // selectFileButton - // - this->selectFileButton->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Right); - this->selectFileButton->Location = System::Drawing::Point( 276, 25 ); - this->selectFileButton->Name = "selectFileButton"; - this->selectFileButton->Size = System::Drawing::Size( 23, 21 ); - this->selectFileButton->TabIndex = 2; - this->selectFileButton->Text = "..."; - this->selectFileButton->Click += gcnew System::EventHandler( this, &SoundTestForm::selectFileButton_Click ); - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 7, 7 ); - this->label1->Name = "label1"; - this->label1->Size = System::Drawing::Size( 145, 17 ); - this->label1->TabIndex = 3; - this->label1->Text = ".wav path or URL:"; - - // - // loadSyncButton - // - this->loadSyncButton->Location = System::Drawing::Point( 7, 53 ); - this->loadSyncButton->Name = "loadSyncButton"; - this->loadSyncButton->Size = System::Drawing::Size( 142, 23 ); - this->loadSyncButton->TabIndex = 4; - this->loadSyncButton->Text = "Load Synchronously"; - this->loadSyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::loadSyncButton_Click ); - - // - // playOnceSyncButton - // - this->playOnceSyncButton->Location = System::Drawing::Point( 7, 86 ); - this->playOnceSyncButton->Name = "playOnceSyncButton"; - this->playOnceSyncButton->Size = System::Drawing::Size( 142, 23 ); - this->playOnceSyncButton->TabIndex = 5; - this->playOnceSyncButton->Text = "Play Once Synchronously"; - this->playOnceSyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playOnceSyncButton_Click ); - - // - // playOnceAsyncButton - // - this->playOnceAsyncButton->Location = System::Drawing::Point( 149, 86 ); - this->playOnceAsyncButton->Name = "playOnceAsyncButton"; - this->playOnceAsyncButton->Size = System::Drawing::Size( 147, 23 ); - this->playOnceAsyncButton->TabIndex = 6; - this->playOnceAsyncButton->Text = "Play Once Asynchronously"; - this->playOnceAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playOnceAsyncButton_Click ); - - // - // stopButton - // - this->stopButton->Location = System::Drawing::Point( 149, 109 ); - this->stopButton->Name = "stopButton"; - this->stopButton->Size = System::Drawing::Size( 147, 23 ); - this->stopButton->TabIndex = 7; - this->stopButton->Text = "Stop"; - this->stopButton->Click += gcnew System::EventHandler( this, &SoundTestForm::stopButton_Click ); - - // - // playLoopAsyncButton - // - this->playLoopAsyncButton->Location = System::Drawing::Point( 7, 109 ); - this->playLoopAsyncButton->Name = "playLoopAsyncButton"; - this->playLoopAsyncButton->Size = System::Drawing::Size( 142, 23 ); - this->playLoopAsyncButton->TabIndex = 8; - this->playLoopAsyncButton->Text = "Loop Asynchronously"; - this->playLoopAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playLoopAsyncButton_Click ); - - // - // statusBar - // - this->statusBar->Location = System::Drawing::Point( 0, 146 ); - this->statusBar->Name = "statusBar"; - this->statusBar->Size = System::Drawing::Size( 306, 22 ); - this->statusBar->SizingGrip = false; - this->statusBar->TabIndex = 9; - this->statusBar->Text = "(no status)"; - - // - // loadAsyncButton - // - this->loadAsyncButton->Location = System::Drawing::Point( 149, 53 ); - this->loadAsyncButton->Name = "loadAsyncButton"; - this->loadAsyncButton->Size = System::Drawing::Size( 147, 23 ); - this->loadAsyncButton->TabIndex = 10; - this->loadAsyncButton->Text = "Load Asynchronously"; - this->loadAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::loadAsyncButton_Click ); - - // - // SoundTestForm - // - this->ClientSize = System::Drawing::Size( 306, 168 ); - this->Controls->Add( this->loadAsyncButton ); - this->Controls->Add( this->statusBar ); - this->Controls->Add( this->playLoopAsyncButton ); - this->Controls->Add( this->stopButton ); - this->Controls->Add( this->playOnceAsyncButton ); - this->Controls->Add( this->playOnceSyncButton ); - this->Controls->Add( this->loadSyncButton ); - this->Controls->Add( this->label1 ); - this->Controls->Add( this->selectFileButton ); - this->Controls->Add( this->filepathTextbox ); - this->MinimumSize = System::Drawing::Size( 310, 165 ); - this->Name = "SoundTestForm"; - this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Show; - this->Text = "Sound API Test Form"; - this->ResumeLayout( false ); - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew SoundTestForm ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp deleted file mode 100644 index 81d129ea527..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp +++ /dev/null @@ -1,144 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeStatusBarPanels(); - InitializeSimpleStatusBar(); - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->SuspendLayout(); - - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Initialize a single-panel status bar. This is done - // by setting the Text property and setting ShowPanels to False. -private: - void InitializeSimpleStatusBar() - { - - // Declare the StatusBar control - StatusBar^ simpleStatusBar = gcnew StatusBar; - - // Set the ShowPanels property to False. - simpleStatusBar->ShowPanels = false; - - // Set the text. - simpleStatusBar->Text = "This is a single-panel status bar"; - - // Set the width and anchor the StatusBar - simpleStatusBar->Width = 200; - simpleStatusBar->Anchor = AnchorStyles::Top; - - // Add the StatusBar to the form. - this->Controls->Add( simpleStatusBar ); - } - // - - // - StatusBar^ StatusBar1; - void InitializeStatusBarPanels() - { - StatusBar1 = gcnew StatusBar; - - // Create two StatusBarPanel objects. - StatusBarPanel^ panel1 = gcnew StatusBarPanel; - StatusBarPanel^ panel2 = gcnew StatusBarPanel; - - // Set the style of the panels. - // panel1 will be owner-drawn. - panel1->Style = StatusBarPanelStyle::OwnerDraw; - - // The panel2 object will be drawn by the operating system. - panel2->Style = StatusBarPanelStyle::Text; - - // Set the text of both panels to the same date string. - panel1->Text = System::DateTime::Today.ToShortDateString(); - panel2->Text = System::DateTime::Today.ToShortDateString(); - - // Add both panels to the StatusBar. - StatusBar1->Panels->Add( panel1 ); - StatusBar1->Panels->Add( panel2 ); - - // Make panels visible by setting the ShowPanels - // property to True. - StatusBar1->ShowPanels = true; - - // Associate the event-handling method with the DrawItem event - // for the owner-drawn panel. - StatusBar1->DrawItem += gcnew StatusBarDrawItemEventHandler( this, &Form1::DrawCustomStatusBarPanel ); - this->Controls->Add( StatusBar1 ); - } - - - // Draw the panel. - void DrawCustomStatusBarPanel( Object^ sender, StatusBarDrawItemEventArgs^ e ) - { - - // Draw a blue background in the owner-drawn panel. - e->Graphics->FillRectangle( Brushes::AliceBlue, e->Bounds ); - - // Create a StringFormat object to align text in the panel. - StringFormat^ textFormat = gcnew StringFormat; - - // Center the text in the middle of the line. - textFormat->LineAlignment = StringAlignment::Center; - - // Align the text to the left. - textFormat->Alignment = StringAlignment::Far; - - // Draw the panel's text in dark blue using the Panel - // and Bounds properties of the StatusBarEventArgs object - // and the StringFormat object. - e->Graphics->DrawString( e->Panel->Text, StatusBar1->Font, Brushes::DarkBlue, RectangleF(e->Bounds.X,e->Bounds.Y,e->Bounds.Width,e->Bounds.Height), textFormat ); - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp deleted file mode 100644 index b0f2829671d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp +++ /dev/null @@ -1,148 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeStatusBarPanels(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::RichTextBox^ RichTextBox1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - //RichTextBox1 - // - this->RichTextBox1->Dock = System::Windows::Forms::DockStyle::Fill; - this->RichTextBox1->Location = System::Drawing::Point( 0, 0 ); - this->RichTextBox1->Name = "RichTextBox1"; - this->RichTextBox1->Size = System::Drawing::Size( 292, 266 ); - this->RichTextBox1->TabIndex = 0; - this->RichTextBox1->Text = " "; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->RichTextBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -internal: - System::Windows::Forms::StatusBar^ statusBar1; - -private: - void InitializeStatusBarPanels() - { - - // Create a StatusBar control. - statusBar1 = gcnew StatusBar; - - // Dock the status bar at the top of the form. - statusBar1->Dock = DockStyle::Top; - - // Set the SizingGrip property to false so the user cannot - // resize the status bar. - statusBar1->SizingGrip = false; - - // Associate the event-handling method with the - // PanelClick event. - statusBar1->PanelClick += gcnew StatusBarPanelClickEventHandler( this, &Form1::statusBar1_PanelClick ); - - // Create two StatusBarPanel objects to display in statusBar1. - StatusBarPanel^ panel1 = gcnew StatusBarPanel; - StatusBarPanel^ panel2 = gcnew StatusBarPanel; - - // Set the width of panel2 explicitly and set - // panel1 to fill in the remaining space. - panel2->Width = 80; - panel1->AutoSize = StatusBarPanelAutoSize::Spring; - - // Set the text alignment within each panel. - panel1->Alignment = HorizontalAlignment::Left; - panel2->Alignment = HorizontalAlignment::Right; - - // Display the first panel without a border and the second - // with a raised border. - panel1->BorderStyle = StatusBarPanelBorderStyle::None; - panel2->BorderStyle = StatusBarPanelBorderStyle::Raised; - - // Set the text of the panels. The panel1 object is reserved - // for line numbers, while panel2 is set to the current time. - panel1->Text = "Reserved for important information."; - panel2->Text = System::DateTime::Now.ToShortTimeString(); - - // Set a tooltip for panel2 - panel2->ToolTipText = "Click time to display seconds"; - - // Display panels in statusBar1 and add them to the - // status bar's StatusBarPanelCollection. - statusBar1->ShowPanels = true; - statusBar1->Panels->Add( panel1 ); - statusBar1->Panels->Add( panel2 ); - - // Add the StatusBar to the form. - this->Controls->Add( statusBar1 ); - } - - // If the user clicks the status bar, check the text of the - // StatusBarPanel. If the text equals a short time string, - // change it to long time display. - void statusBar1_PanelClick( Object^ /*sender*/, StatusBarPanelClickEventArgs^ e ) - { - if ( e->StatusBarPanel->Text == System::DateTime::Now.ToShortTimeString() ) - { - e->StatusBarPanel->Text = System::DateTime::Now.ToLongTimeString(); - } - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp deleted file mode 100644 index 31df5973127..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp +++ /dev/null @@ -1,119 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - ChangeTheLookOfTheTabControl(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::TabControl^ TabControl1; - System::Windows::Forms::TabPage^ TabPage1; - System::Windows::Forms::TabPage^ TabPage2; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->TabControl1 = gcnew System::Windows::Forms::TabControl; - this->TabPage1 = gcnew System::Windows::Forms::TabPage; - this->TabPage2 = gcnew System::Windows::Forms::TabPage; - this->TabControl1->SuspendLayout(); - this->SuspendLayout(); - - // - //TabControl1 - // - this->TabControl1->Controls->Add( this->TabPage1 ); - this->TabControl1->Controls->Add( this->TabPage2 ); - this->TabControl1->Location = System::Drawing::Point( 0, 0 ); - this->TabControl1->Name = "TabControl1"; - this->TabControl1->SelectedIndex = 0; - this->TabControl1->TabIndex = 0; - - // - //TabPage1 - // - this->TabPage1->Location = System::Drawing::Point( 4, 22 ); - this->TabPage1->Name = "TabPage1"; - this->TabPage1->Size = System::Drawing::Size( 192, 74 ); - this->TabPage1->TabIndex = 0; - this->TabPage1->Text = "Errors"; - - // - //TabPage2 - // - this->TabPage2->Location = System::Drawing::Point( 4, 22 ); - this->TabPage2->Name = "TabPage2"; - this->TabPage2->Size = System::Drawing::Size( 192, 74 ); - this->TabPage2->TabIndex = 1; - this->TabPage2->Text = "Failures"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 296, 294 ); - this->Controls->Add( this->TabControl1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->TabControl1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - // -private: - void ChangeTheLookOfTheTabControl() - { - // Set the size and location of the TabControl. - this->TabControl1->Location = System::Drawing::Point( 20, 20 ); - TabControl1->Size = System::Drawing::Size( 250, 250 ); - - // Align the tabs along the bottom of the control. - TabControl1->Alignment = TabAlignment::Bottom; - - // Change the tabs to flat buttons. - TabControl1->Appearance = TabAppearance::FlatButtons; - } - // -}; - - -[System::STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp deleted file mode 100644 index 010134bc5ea..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp +++ /dev/null @@ -1,156 +0,0 @@ -// This entire sample can go in the TabRenderer overview. -// - Snippet2 can be excerpted in DrawTabPage, DrawTabItem, and IsSupported. -// - Snippet2 could also be excerpted in the VisualStyles.TabItemState enum, -// if necessary. - -// The sample defines a simple custom Control that uses TabRenderer to -// simulate a basic (and essentially useless) TabControl. Might want -// to add a bit more unique functionality, although the basic painting -// functionality of the class is demonstrated. - -// For simplicity, this sample doesn't handle runtime switching of visual styles. - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace TabRendererSample -{ - public ref class CustomTabControl : public Control - { - private: - Rectangle tabPageRectangle; - Rectangle tabItemRectangle1; - Rectangle tabItemRectangle2; - int tabHeight; - int tabWidth; - TabItemState tab1State; - TabItemState tab2State; - String^ tab1Text; - String^ tab2Text; - bool tab1Focused; - bool tab2Focused; - - public: - CustomTabControl() - { - this->tabHeight = 30; - this->tabWidth = 100; - this->tab1State = TabItemState::Selected; - this->tab2State = TabItemState::Normal; - this->tab1Text = "Tab 1"; - this->tab2Text = "Tab 2"; - this->tab1Focused = true; - this->tab2Focused = false; - this->Size = System::Drawing::Size(300, 300); - this->Location = Point(10, 10); - this->Font = SystemFonts::IconTitleFont; - this->Text = "TabRenderer"; - this->DoubleBuffered = true; - - tabPageRectangle = Rectangle(ClientRectangle.X, - ClientRectangle.Y + tabHeight, - ClientRectangle.Width, - ClientRectangle.Height - tabHeight); - - // Extend the first tab rectangle down by 2 pixels, - // because it is selected by default. - tabItemRectangle1 = Rectangle(ClientRectangle.X, - ClientRectangle.Y, tabWidth, tabHeight + 2); - - tabItemRectangle2 = Rectangle(ClientRectangle.Location.X + - tabWidth, ClientRectangle.Location.Y, tabWidth, tabHeight); - } - - // - // Draw the tab page and the tab items. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - if (!TabRenderer::IsSupported) - { - this->Parent->Text = "CustomTabControl Disabled"; - return; - } - - TabRenderer::DrawTabPage(e->Graphics, tabPageRectangle); - TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle1, - tab1Text, this->Font, tab1Focused, tab1State); - TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle2, - tab2Text, this->Font, tab2Focused, tab2State); - - this->Parent->Text = "CustomTabControl Enabled"; - } - // - - // Draw the selected tab item. - protected: - virtual void OnMouseDown(MouseEventArgs^ e) override - { - __super::OnMouseDown(e); - - if (!TabRenderer::IsSupported) - { - return; - } - - // The first tab is clicked. Note that the height of the - // selected tab rectangle is raised by 2, so that it draws - // over the border of the tab page. - if (tabItemRectangle1.Contains(e->Location)) - { - tab1State = TabItemState::Selected; - tab2State = TabItemState::Normal; - tabItemRectangle1.Height += 2; - tabItemRectangle2.Height -= 2; - tab1Focused = true; - tab2Focused = false; - } - - // The second tab is clicked. - if (tabItemRectangle2.Contains(e->Location)) - { - tab2State = TabItemState::Selected; - tab1State = TabItemState::Normal; - tabItemRectangle2.Height += 2; - tabItemRectangle1.Height -= 2; - tab2Focused = true; - tab1Focused = false; - } - - Invalidate(); - } - }; - public ref class Form1 : public Form - { - public: - Form1() - - { - CustomTabControl^ Tab1 = gcnew CustomTabControl(); - Controls->Add(Tab1); - this->Size = System::Drawing::Size(500, 500); - } - - }; -} - -[STAThread] -int main() -{ - // The call to EnableVisualStyles below does not affect whether - // TabRenderer.IsSupported is true; as long as visual styles - // are enabled by the operating system, IsSupported is true. - Application::EnableVisualStyles(); - Application::Run(gcnew TabRendererSample::Form1()); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp deleted file mode 100644 index df65b79856a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp +++ /dev/null @@ -1,137 +0,0 @@ - - -#using -#using -#using - -// The following code example demonstrates using the Keys enum, -// and the TextBoxBase.ScrollToCaret, and TextBox.HideSelection methods. -// It also demonstrates and handling the TextBox.Click event. -using namespace System; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeTextBox(); - - // Hook up the event-handling method with the - // KeyDown Event. - this->TextBox1->KeyDown += gcnew KeyEventHandler( this, &Form1::TextBox1_KeyDown ); - this->TextBox1->Click += gcnew System::EventHandler( this, &Form1::TextBox1_Click ); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows - //Form Designer. It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::RichTextBox^ RichTextBox1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - //RichTextBox1 - // - this->RichTextBox1->Location = System::Drawing::Point( 40, 80 ); - this->RichTextBox1->Name = "RichTextBox1"; - this->RichTextBox1->ReadOnly = true; - this->RichTextBox1->TabIndex = 0; - this->RichTextBox1->Text = "and the text will be added here."; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->RichTextBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - //Declare a textbox called TextBox1. -internal: - System::Windows::Forms::TextBox^ TextBox1; - -private: - - //Initialize TextBox1. - void InitializeTextBox() - { - this->TextBox1 = gcnew TextBox; - this->TextBox1->Location = System::Drawing::Point( 32, 24 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->Size = System::Drawing::Size( 136, 20 ); - this->TextBox1->TabIndex = 1; - this->TextBox1->Text = "Type and hit enter here..."; - - //Keep the selection highlighted, even after textbox loses focus. - TextBox1->HideSelection = false; - this->Controls->Add( TextBox1 ); - } - // - - // -private: - //Selects everything in TextBox1. - void TextBox1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - TextBox1->SelectAll(); - } - // - - // -private: - //Handles the Enter key being pressed while TextBox1 has focus. - void TextBox1_KeyDown( Object^ /*sender*/, KeyEventArgs^ e ) - { - TextBox1->HideSelection = false; - if ( e->KeyCode == Keys::Enter ) - { - e->Handled = true; - - // Copy the text from TextBox1 to RichTextBox1, add a CRLF after - // the copied text, and keep the caret in view. - RichTextBox1->SelectedText = String::Concat( TextBox1->Text, "\r\n" ); - RichTextBox1->ScrollToCaret(); - } - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp deleted file mode 100644 index 08bd6525d37..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp +++ /dev/null @@ -1,132 +0,0 @@ -// This sample can go in TextBoxRenderer class overview. -// - Snippet2 can go in IsSupported and DrawTextBox -// - Snippet4 could go in TextFormatFlags - -// This sample is a custom control that displays a static string and allows -// the user to select the TextFormatFlag to apply to the text. -// For simplicity, this sample does not handle run-time switching of visual styles. - -// -#using -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace TextBoxRendererSample -{ - public ref class CustomTextBox : public Control - { - private: - TextFormatFlags textFlags; - ComboBox^ textFormatFlagsComboBox; - Rectangle textBorder; - Rectangle textRectangle; - StringBuilder^ textMeasurements; - - public: - CustomTextBox():Control() - { - textFlags = TextFormatFlags::Default; - textFormatFlagsComboBox = gcnew ComboBox(); - - textMeasurements = gcnew StringBuilder(); - - this->Location = Point(10, 10); - this->Size = System::Drawing::Size(300, 200); - this->Font = SystemFonts::IconTitleFont; - this->Text = "This is a long sentence that will exceed " + - "the text box bounds"; - - textBorder.Location = Point(10, 10); - textBorder.Size = System::Drawing::Size(200, 50); - textRectangle.Location = Point(textBorder.X + 2, - textBorder.Y + 2); - textRectangle.Size = System::Drawing::Size(textBorder.Size.Width - 4, - textBorder.Height - 4); - - textFormatFlagsComboBox->Location = Point(10, 100); - textFormatFlagsComboBox->Size = System::Drawing::Size(150, 20); - textFormatFlagsComboBox->SelectedIndexChanged += - gcnew EventHandler(this, - &CustomTextBox::textFormatFlagsComboBox_SelectedIndexChanged); - - // Populate the combo box with the TextFormatFlags value names. - for each (String^ name in Enum::GetNames(TextFormatFlags::typeid)) - { - textFormatFlagsComboBox->Items->Add(name); - } - - textFormatFlagsComboBox->SelectedIndex = 0; - this->Controls->Add(textFormatFlagsComboBox); - } - - // - // - // Use DrawText with the current TextFormatFlags. - - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - if (TextBoxRenderer::IsSupported) - { - TextBoxRenderer::DrawTextBox(e->Graphics, textBorder, this->Text, - this->Font, textRectangle, textFlags, TextBoxState::Normal); - - this->Parent->Text = "CustomTextBox Enabled"; - } - else - { - this->Parent->Text = "CustomTextBox Disabled"; - } - } - // - - // Assign the combo box selection to the display text. - private: - void textFormatFlagsComboBox_SelectedIndexChanged( - Object^ sender, EventArgs^ e) - { - this->textFlags = (TextFormatFlags)Enum::Parse( - TextFormatFlags::typeid, - (String^)textFormatFlagsComboBox->Items[ - textFormatFlagsComboBox->SelectedIndex]); - - Invalidate(); - } - // - }; - - public ref class Form1 : public Form - { - public: - Form1() - { - __super::Form(); - this->Size = System::Drawing::Size(350, 200); - CustomTextBox^ textBox1 = gcnew CustomTextBox(); - Controls->Add(textBox1); - } - }; -} - -using namespace TextBoxRendererSample; - -[STAThread] -int main() -{ - // The call to EnableVisualStyles below does not affect whether - // TextBoxRenderer draws the text box; as long as visual styles - // are enabled by the operating system, TextBoxRenderer will - // draw the text box. - Application::EnableVisualStyles(); - Application::Run(gcnew Form1()); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp deleted file mode 100644 index 433d359cfe5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp +++ /dev/null @@ -1,151 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeToolBar(); - - //Add any initialization after the InitializeComponent() call - } - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::RichTextBox^ RichTextBox1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; - this->SuspendLayout(); - - // - //ToolBar1 - //RichTextBox1 - // - this->RichTextBox1->Dock = System::Windows::Forms::DockStyle::Fill; - this->RichTextBox1->Location = System::Drawing::Point( 0, 0 ); - this->RichTextBox1->Name = "RichTextBox1"; - this->RichTextBox1->Size = System::Drawing::Size( 292, 224 ); - this->RichTextBox1->TabIndex = 1; - this->RichTextBox1->Text = "System.Windows.Forms System.Xml " - " System.Reflection"; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->RichTextBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Declare ToolBar1. -internal: - System::Windows::Forms::ToolBar^ ToolBar1; - -private: - - // Initialize ToolBar1 with Bold(B), Italic(I), and - // Underline(U) buttons. - void InitializeToolBar() - { - ToolBar1 = gcnew ToolBar; - - // Set the appearance to Flat. - ToolBar1->Appearance = ToolBarAppearance::Flat; - - // Set the toolbar to dock at the bottom of the form. - ToolBar1->Dock = DockStyle::Bottom; - - // Set the toolbar font to 14 points and bold. - ToolBar1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,14,FontStyle::Bold ); - - // Declare fontstyle array with the three font styles. - array^ fonts = {FontStyle::Bold,FontStyle::Italic,FontStyle::Underline}; - int count; - - // Create a button for each value in the array, setting its - // text to the first letter of the style and its - // button's tag property. - for ( count = 0; count < fonts->Length; count++ ) - { - ToolBarButton^ fontButton = gcnew ToolBarButton( fonts[ count ].ToString()->Substring( 0, 1 ) ); - fontButton->Style = ToolBarButtonStyle::ToggleButton; - fontButton->Tag = fonts[ count ]; - ToolBar1->Buttons->Add( fontButton ); - - } - this->ToolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &Form1::ToolBar1_ButtonClick ); - this->Controls->Add( this->ToolBar1 ); - } - - // Declare FontStyle object, which defaults to the Regular - // FontStyle. - FontStyle style; - void ToolBar1_ButtonClick( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ e ) - { - // If a button is pushed, use a bitwise Or combination - // of the style variable and the button tag, to set style to - // the correct FontStyle. Set the button's PartialPush - // property to true for a Windows XP-like appearance. - if ( e->Button->Pushed ) - { - e->Button->PartialPush = true; - style = (FontStyle)(style | safe_cast(e->Button->Tag)); - } - else - { - // If the button was not pushed, use a bitwise XOR - // combination to turn off that style - // and set the PartialPush property to false. - e->Button->PartialPush = false; - style = (FontStyle)(style ^ safe_cast(e->Button->Tag)); - } - - // Set the font using the existing RichTextBox font and the new - // style. - RichTextBox1->Font = gcnew System::Drawing::Font( RichTextBox1->Font,style ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp deleted file mode 100644 index 0c35908b473..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp +++ /dev/null @@ -1,469 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ToolStripExamples -{ - // - // Extend the ToolStripRenderer class. - // - - // Override the desired methods to render items as desired. - public ref class RedTextRenderer: public - System::Windows::Forms::ToolStripRenderer - { - protected: - void OnRenderItemText(ToolStripItemTextRenderEventArgs^ e) - { - e->TextColor = Color::Red; - e->TextFont = - gcnew Font("Helvetica", 7, FontStyle::Bold); - __super::OnRenderItemText(e); - } //OnRenderItemText - }; - - - /// - /// Summary description for form. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - - /// - /// Required designer variable. - /// - System::ComponentModel::IContainer^ components; - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->statusStrip1 = - gcnew System::Windows::Forms::StatusStrip; - this->raftingContainer1 = - gcnew System::Windows::Forms::RaftingContainer; - this->movingToolStrip = - gcnew System::Windows::Forms::ToolStrip; - this->toolStrip1 = - gcnew System::Windows::Forms::ToolStrip; - this->raftingContainer2 = - gcnew System::Windows::Forms::RaftingContainer; - this->raftingContainer3 = - gcnew System::Windows::Forms::RaftingContainer; - this->raftingContainer4 = - gcnew System::Windows::Forms::RaftingContainer; - this->components = - gcnew System::ComponentModel::Container; - this->SuspendLayout(); - - // - // statusStrip1 - // - this->statusStrip1->CanOverflow = false; - this->statusStrip1->GripStyle = - System::Windows::Forms::ToolStripGripStyle::Hidden; - this->statusStrip1->Location = - System::Drawing::Point(9, 233); - this->statusStrip1->Name = "statusStrip1"; - this->statusStrip1->Size = System::Drawing::Size(274, 24); - this->statusStrip1->TabIndex = 4; - this->statusStrip1->Text = "statusStrip1"; - this->statusStrip1->Visible = true; - - // - // raftingContainer1 - // - this->raftingContainer1->AutoSize = true; - this->raftingContainer1->Dock = - System::Windows::Forms::DockStyle::Top; - this->raftingContainer1->Location = - System::Drawing::Point(9, 9); - this->raftingContainer1->Name = "raftingContainer1"; - this->raftingContainer1->Orientation = - System::Windows::Forms::Orientation::Horizontal; - this->raftingContainer1->RowMargin = - System::Windows::Forms::Padding(0); - this->raftingContainer1->Size = - System::Drawing::Size(274, 25); - this->raftingContainer1->TabIndex = 0; - this->raftingContainer1->Text = - "RaftingContainerRaftingContainerTop"; - this->raftingContainer1->Join(this->toolStrip1); - this->raftingContainer1->Join(this->movingToolStrip); - - // - // movingToolStrip - // - this->movingToolStrip->Anchor = - System::Windows::Forms::AnchorStyles::Right; - this->movingToolStrip->Dock = - System::Windows::Forms::DockStyle::None; - this->movingToolStrip->Location = - System::Drawing::Point(0, 0); - this->movingToolStrip->Name = "movingToolStrip"; - this->movingToolStrip->Raft = - System::Windows::Forms::RaftingSides::Top; - this->movingToolStrip->TabIndex = 2; - this->movingToolStrip->Text = "toolStrip2"; - this->movingToolStrip->Visible = true; - - // - // toolStrip1 - // - this->toolStrip1->Anchor = - System::Windows::Forms::AnchorStyles::Right; - this->toolStrip1->Dock = - System::Windows::Forms::DockStyle::None; - this->toolStrip1->Location = - System::Drawing::Point(0, 0); - this->toolStrip1->Name = "toolStrip1"; - this->toolStrip1->Raft = - System::Windows::Forms::RaftingSides::Top; - this->toolStrip1->Size = System::Drawing::Size(0, 25); - this->toolStrip1->TabIndex = 1; - this->toolStrip1->Text = "toolStrip1"; - this->toolStrip1->Visible = true; - - // - // raftingContainer2 - // - this->raftingContainer2->AutoSize = true; - this->raftingContainer2->Dock = - System::Windows::Forms::DockStyle::Bottom; - this->raftingContainer2->Location = - System::Drawing::Point(9, 257); - this->raftingContainer2->Name = "raftingContainer2"; - this->raftingContainer2->Orientation = - System::Windows::Forms::Orientation::Horizontal; - this->raftingContainer2->RowMargin = - System::Windows::Forms::Padding(0); - this->raftingContainer2->Size = - System::Drawing::Size(274, 0); - this->raftingContainer2->TabIndex = 1; - this->raftingContainer2->Text = - "RaftingContainerRaftingContainerBottom"; - - // - // raftingContainer3 - // - this->raftingContainer3->AutoSize = true; - this->raftingContainer3->Dock = - System::Windows::Forms::DockStyle::Left; - this->raftingContainer3->Location = - System::Drawing::Point(9, 9); - this->raftingContainer3->Name = "raftingContainer3"; - this->raftingContainer3->Orientation = - System::Windows::Forms::Orientation::Vertical; - this->raftingContainer3->RowMargin = - System::Windows::Forms::Padding(0); - this->raftingContainer3->Size = - System::Drawing::Size(0, 248); - this->raftingContainer3->TabIndex = 2; - this->raftingContainer3->Text = - "RaftingContainerRaftingContainerLeft"; - - // - // raftingContainer4 - // - this->raftingContainer4->AutoSize = true; - this->raftingContainer4->Dock = - System::Windows::Forms::DockStyle::Right; - this->raftingContainer4->Location = - System::Drawing::Point(283, 9); - this->raftingContainer4->Name = "raftingContainer4"; - this->raftingContainer4->Orientation = - System::Windows::Forms::Orientation::Vertical; - this->raftingContainer4->RowMargin = - System::Windows::Forms::Padding(0); - this->raftingContainer4->Size = System::Drawing::Size(0, 248); - this->raftingContainer4->TabIndex = 3; - this->raftingContainer4->Text = - "RaftingContainerRaftingContainerRight"; - - // - // - // Form1 - // - this->AutoSize = true; - this->ClientSize = System::Drawing::Size(292, 266); - this->Controls->Add(this->statusStrip1); - this->Controls->Add(this->raftingContainer1); - this->Controls->Add(this->raftingContainer2); - this->Controls->Add(this->raftingContainer3); - this->Controls->Add(this->raftingContainer4); - this->Name = "Form1"; - this->Padding = System::Windows::Forms::Padding(9); - this->Text = "Form1"; - this->ResumeLayout(false); - this->PerformLayout(); - } - - protected: - - /// - /// Clean up any resources being used. - /// - void Dispose(bool disposing) - { - delete components; - __super::Dispose(disposing); - } - - private: - - System::Windows::Forms::StatusStrip^ statusStrip1; - System::Windows::Forms::RaftingContainer^ raftingContainer1; - System::Windows::Forms::RaftingContainer^ raftingContainer2; - System::Windows::Forms::RaftingContainer^ raftingContainer3; - System::Windows::Forms::RaftingContainer^ raftingContainer4; - System::Windows::Forms::ToolStrip^ toolStrip1; - System::Windows::Forms::ToolStrip^ movingToolStrip; - - public: - - Form1() - { - InitializeComponent(); - InitializeMovingToolStrip(); - InitializeBoldButton(); - InitializeStatusStripPanels(); - InitializeDropDownButton(); - InitializeImageButtonWithToolTip(); - } - - private: - - // The following example demonstrates setting the - // drop-down property for a DropDownItem. - // - // Declare the drop-down button and the items it will contain. - ToolStripDropDownButton^ dropDownButton1; - ToolStripDropDown^ dropDown; - ToolStripButton^ buttonRed; - ToolStripButton^ buttonBlue; - ToolStripButton^ buttonYellow; - - void InitializeDropDownButton() - { - dropDownButton1 = gcnew ToolStripDropDownButton; - dropDown = gcnew ToolStripDropDown; - dropDownButton1->Text = "A"; - - // Set the drop-down on the DropDownButton. - dropDownButton1->DropDown = dropDown; - - // Declare three buttons, set their forecolor and text, - // and add the buttons to the drop-down. - buttonRed = gcnew ToolStripButton; - buttonRed->ForeColor = Color::Red; - buttonRed->Text = "A"; - buttonBlue = gcnew ToolStripButton; - buttonBlue->ForeColor = Color::Blue; - buttonBlue->Text = "A"; - buttonYellow = gcnew ToolStripButton; - buttonYellow->ForeColor = Color::Yellow; - buttonYellow->Text = "A"; - buttonBlue->Click += gcnew EventHandler(this, - &Form1::colorButtonsClick); - buttonRed->Click += gcnew EventHandler(this, - &Form1::colorButtonsClick); - buttonYellow->Click += gcnew EventHandler(this, - &Form1::colorButtonsClick); - array^ ToolStrips = - {buttonRed,buttonBlue,buttonYellow}; - dropDown->Items->AddRange(ToolStrips); - toolStrip1->Items->Add(dropDownButton1); - } - - - // Handle the buttons' click event by setting the forecolor - // of the form to the forecolor of the button that is clicked. - void colorButtonsClick(Object^ sender, EventArgs^ e) - { - ToolStripButton^ senderButton = (ToolStripButton^) sender; - this->ForeColor = senderButton->ForeColor; - } - - - // internal: - - // - //Sample for ToolStripButton, ToolStripButton.CheckOnClick, - //ToolStripButton.CheckedChanged, ToolStripButton.Checked - // - ToolStripButton^ boldButton; - - void InitializeBoldButton() - { - boldButton = gcnew ToolStripButton; - boldButton->Text = "B"; - boldButton->CheckOnClick = true; - boldButton->CheckedChanged += gcnew EventHandler(this, - &Form1::boldButtonCheckedChanged); - toolStrip1->Items->Add(boldButton); - } - - void boldButtonCheckedChanged(Object^ sender, EventArgs^ e) - { - if (boldButton->Checked) - { - this->Font= gcnew System::Drawing::Font(this->Font, - FontStyle::Bold); - } - else - { - this->Font = gcnew System::Drawing::Font(this->Font, - FontStyle::Regular); - } - } - - - // internal: - - // - // The following snippet demonstrates ToolStripItem.Image, - // ToolStripItem.ImageAlign, ToolStripItem.ImageScaling, - // ToolStripItem.ImageTransparentColor, ToolStripItem.ToolTipText, - // ToolStripItem.AutoToolTip, ToolStrip.ShowItemToolTips. - // - ToolStripButton^ imageButton; - - void InitializeImageButtonWithToolTip() - { - - // Construct the button and set the image-related properties. - imageButton = gcnew ToolStripButton; - imageButton->Image = - gcnew Bitmap(Timer::typeid,"Timer.bmp"); - imageButton->ImageScaling = - ToolStripItemImageScaling::SizeToFit; - - // Set the background color of the image to be transparent. - imageButton->ImageTransparentColor = - Color::FromArgb(0, 255, 0); - - // Show ToolTip text, set custom ToolTip text, and turn - // off the automatic ToolTips. - toolStrip1->ShowItemToolTips = true; - imageButton->ToolTipText = "Click for the current time"; - imageButton->AutoToolTip = false; - - // Add the button to the ToolStrip. - toolStrip1->Items->Add(imageButton); - } - - - // internal: - - // - // The following snippet demonstrates the ToolStrip.AutoSize, - // ToolStrip.RenderMode, ToolStripItem.TextDirection, - // ToolStripItem.TextAlign, ToolStrip.Raft properties - // - ToolStripButton^ changeDirectionButton; - - void InitializeMovingToolStrip() - { - changeDirectionButton = gcnew ToolStripButton; - movingToolStrip->AutoSize = true; - movingToolStrip->RenderMode = ToolStripRenderMode::System; - changeDirectionButton->TextDirection = - ToolStripTextDirection::Vertical270; - changeDirectionButton->Overflow = - ToolStripItemOverflow::Never; - changeDirectionButton->Text = "Change Alignment"; - movingToolStrip->Items->Add(changeDirectionButton); - changeDirectionButton->Click += gcnew EventHandler(this, - &Form1::changeDirectionButtonClick); - } - - void changeDirectionButtonClick(Object^ sender, EventArgs^ e) - { - ToolStripItem^ item = (ToolStripItem^) sender; - if ((item->TextDirection == ToolStripTextDirection::Vertical270) - || (item->TextDirection == ToolStripTextDirection::Vertical90)) - { - item->TextDirection = ToolStripTextDirection::Horizontal; - movingToolStrip->Raft = RaftingSides::Top; - } - else - { - item->TextDirection = - ToolStripTextDirection::Vertical270; - movingToolStrip->Raft = RaftingSides::Left; - } - } - - - // - // The following snippet can go in the StatusStripPanel and - // StatusStrip overview. - // It also demonstrates StatusStripPanel.BorderSides, - // and StatusStripPanel.BorderStyle. - // - void InitializeStatusStripPanels() - { - - // Create two StatusStripPanel objects to display in the - // StatusBar. - StatusStripPanel^ panel1 = gcnew StatusStripPanel; - StatusStripPanel^ panel2 = gcnew StatusStripPanel; - - // Display the first panel with a sunken border style on all - // sides. - panel1->BorderSides = StatusStripPanelBorderSide::All; - panel1->BorderStyle = Border3DStyle::Sunken; - - // Display the second panel with a raised border style on the - // left side only. - panel2->BorderSides = StatusStripPanelBorderSide::Left; - panel2->BorderStyle = Border3DStyle::Bump; - - // Initialize the text of the panel. - panel1->Text = "Ready..."; - - // Set the text of the panel to the current date. - panel2->Text = DateTime::Today::get().ToLongDateString(); - - - // Add both panels to the StatusBarPanelCollection of the - // StatusBar. - array^ toolStrips = {panel1, panel2}; - statusStrip1->Items->AddRange(toolStrips); - } - - // - void SetCustomRenderer() - { - // - toolStrip1->Renderer = gcnew RedTextRenderer; - // - } - - void SetCustomerRenderInManagerMode() - { - // - toolStrip1->RenderMode = - ToolStripRenderMode::ManagerRenderMode; - ToolStripManager::Renderer = gcnew RedTextRenderer; - // - } - }; -} - -int main() -{ - Application::Run(gcnew ToolStripExamples::Form1()); -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp deleted file mode 100644 index c35dc17f15b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp +++ /dev/null @@ -1,332 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Data; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -/// -/// Summary description for form. -/// - -// The following example shows how to wrap a control -// using ToolStripControlHost. -// -//Declare a class that inherits from ToolStripControlHost. -public ref class ToolStripMonthCalendar: public ToolStripControlHost -{ -public: - // - // Call the base constructor passing in a MonthCalendar instance. - ToolStripMonthCalendar() : ToolStripControlHost( gcnew MonthCalendar ) {} - // - - // - property MonthCalendar^ MonthCalendarControl - { - MonthCalendar^ get() - { - return static_cast(Control); - } - } - // - // - property Day FirstDayOfWeek - { - // Expose the MonthCalendar.FirstDayOfWeek as a property. - Day get() - { - return MonthCalendarControl->FirstDayOfWeek; - } - - void set( Day value ) - { - MonthCalendarControl->FirstDayOfWeek = value; - } - } - - // Expose the AddBoldedDate method. - void AddBoldedDate( DateTime dateToBold ) - { - MonthCalendarControl->AddBoldedDate( dateToBold ); - } - // - -protected: - // Subscribe and unsubscribe the control events you wish to expose. - // - // - void OnSubscribeControlEvents( System::Windows::Forms::Control^ c ) - { - // Call the base so the base events are connected. - __super::OnSubscribeControlEvents( c ); - - // Cast the control to a MonthCalendar control. - MonthCalendar^ monthCalendarControl = (MonthCalendar^)c; - - // Add the event. - monthCalendarControl->DateChanged += gcnew DateRangeEventHandler( this, &ToolStripMonthCalendar::HandleDateChanged ); - } - // - - // - void OnUnsubscribeControlEvents( System::Windows::Forms::Control^ c ) - { - - // Call the base method so the basic events are unsubscribed. - __super::OnUnsubscribeControlEvents( c ); - - // Cast the control to a MonthCalendar control. - MonthCalendar^ monthCalendarControl = (MonthCalendar^)c; - - // Remove the event. - monthCalendarControl->DateChanged -= gcnew DateRangeEventHandler( this, &ToolStripMonthCalendar::HandleDateChanged ); - } - // - // - -public: - event DateRangeEventHandler^ DateChanged; - -private: - // - // Declare the DateChanged event. - // Raise the DateChanged event. - void HandleDateChanged( Object^ sender, DateRangeEventArgs^ e ) - { - if ( DateChanged != nullptr ) - { - DateChanged( this, e ); - } - } - // -}; -// - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - /// - /// Required designer variable. - /// - static System::ComponentModel::IContainer^ components = nullptr; - static ToolStripTextBox^ textbox1; - -public: - Form1() - { - InitializeComponent(); - InitializeDropDownMonthCalendar(); - textbox1 = gcnew ToolStripTextBox; - textbox1->Width = 70; - toolStrip1->Items->Add( textbox1 ); - InitializeDateTimePickerHost(); - } - - static void Main() - { - Application::Run( gcnew Form1 ); - } - -private: - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->toolStrip1 = gcnew System::Windows::Forms::ToolStrip; - this->raftingContainer1 = gcnew System::Windows::Forms::RaftingContainer; - this->raftingContainer2 = gcnew System::Windows::Forms::RaftingContainer; - this->raftingContainer3 = gcnew System::Windows::Forms::RaftingContainer; - this->raftingContainer4 = gcnew System::Windows::Forms::RaftingContainer; - this->SuspendLayout(); - - // - // toolStrip1 - // - this->toolStrip1->Anchor = System::Windows::Forms::AnchorStyles::Right; - this->toolStrip1->Dock = System::Windows::Forms::DockStyle::None; - this->toolStrip1->Location = System::Drawing::Point( 0, 0 ); - this->toolStrip1->Name = L"toolStrip1"; - this->toolStrip1->Raft = System::Windows::Forms::RaftingSides::Top; - this->toolStrip1->TabIndex = 1; - this->toolStrip1->Text = L"toolStrip1"; - this->toolStrip1->Visible = true; - - // - // raftingContainer1 - // - this->raftingContainer1->AutoSize = true; - this->raftingContainer1->Dock = System::Windows::Forms::DockStyle::Top; - this->raftingContainer1->Location = System::Drawing::Point( 9, 9 ); - this->raftingContainer1->Name = L"raftingContainer1"; - this->raftingContainer1->Orientation = System::Windows::Forms::Orientation::Horizontal; - this->raftingContainer1->RowMargin = System::Windows::Forms::Padding( 0 ); - this->raftingContainer1->Size = System::Drawing::Size( 274, 25 ); - this->raftingContainer1->TabIndex = 0; - this->raftingContainer1->Text = L"RaftingContainerRaftingContainerTop"; - this->raftingContainer1->Join( this->toolStrip1 ); - - // - // raftingContainer2 - // - this->raftingContainer2->AutoSize = true; - this->raftingContainer2->Dock = System::Windows::Forms::DockStyle::Bottom; - this->raftingContainer2->Location = System::Drawing::Point( 9, 257 ); - this->raftingContainer2->Name = L"raftingContainer2"; - this->raftingContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal; - this->raftingContainer2->RowMargin = System::Windows::Forms::Padding( 0 ); - this->raftingContainer2->Size = System::Drawing::Size( 274, 0 ); - this->raftingContainer2->TabIndex = 1; - this->raftingContainer2->Text = L"RaftingContainerRaftingContainerBottom"; - - // - // raftingContainer3 - // - this->raftingContainer3->AutoSize = true; - this->raftingContainer3->Dock = System::Windows::Forms::DockStyle::Left; - this->raftingContainer3->Location = System::Drawing::Point( 9, 9 ); - this->raftingContainer3->Name = L"raftingContainer3"; - this->raftingContainer3->Orientation = System::Windows::Forms::Orientation::Vertical; - this->raftingContainer3->RowMargin = System::Windows::Forms::Padding( 0 ); - this->raftingContainer3->Size = System::Drawing::Size( 0, 248 ); - this->raftingContainer3->TabIndex = 2; - this->raftingContainer3->Text = L"RaftingContainerRaftingContainerLeft"; - - // - // raftingContainer4 - // - this->raftingContainer4->AutoSize = true; - this->raftingContainer4->Dock = System::Windows::Forms::DockStyle::Right; - this->raftingContainer4->Location = System::Drawing::Point( 283, 9 ); - this->raftingContainer4->Name = L"raftingContainer4"; - this->raftingContainer4->Orientation = System::Windows::Forms::Orientation::Vertical; - this->raftingContainer4->RowMargin = System::Windows::Forms::Padding( 0 ); - this->raftingContainer4->Size = System::Drawing::Size( 0, 248 ); - this->raftingContainer4->TabIndex = 3; - this->raftingContainer4->Text = L"RaftingContainerRaftingContainerRight"; - - // - // Form1 - // - this->AutoSize = true; - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->raftingContainer1 ); - this->Controls->Add( this->raftingContainer2 ); - this->Controls->Add( this->raftingContainer3 ); - this->Controls->Add( this->raftingContainer4 ); - this->Name = L"Form1"; - this->Padding = System::Windows::Forms::Padding( 9 ); - this->Text = L"Form1"; - this->ResumeLayout( false ); - this->PerformLayout(); - } - -protected: - /// - /// Clean up any resources being used. - /// - void Dispose( bool disposing ) - { - if ( disposing ) - { - if ( components != nullptr ) - { - delete components; - } - } - - __super::Dispose( disposing ); - } - -private: - System::Windows::Forms::ToolStrip^ toolStrip1; - System::Windows::Forms::RaftingContainer^ raftingContainer1; - System::Windows::Forms::RaftingContainer^ raftingContainer2; - System::Windows::Forms::RaftingContainer^ raftingContainer3; - System::Windows::Forms::RaftingContainer^ raftingContainer4; - - // The following snippet demonstrates the ToolStripControlHost(Control) - // consturctor, the ToolStripControlHost.Font, Width, DisplayStyle, - // Text properties. - // - ToolStripControlHost^ dateTimePickerHost; - void InitializeDateTimePickerHost() - { - // Create a new ToolStripControlHost, passing in a control. - dateTimePickerHost = gcnew ToolStripControlHost( gcnew DateTimePicker ); - - // Set the font on the ToolStripControlHost, this will affect the hosted control. - dateTimePickerHost->Font = - gcnew System::Drawing::Font( L"Arial",7.0F,FontStyle::Italic ); - - // Set the Width property, this will also affect the hosted control. - dateTimePickerHost->Width = 100; - dateTimePickerHost->DisplayStyle = ToolStripItemDisplayStyle::Text; - - // Setting the Text property requires a string that converts to a - // DateTime type since that is what the hosted control requires. - dateTimePickerHost->Text = L"12/23/2005"; - - // Cast the Control property back to the original type to set a - // type-specific property. - (dynamic_cast(dateTimePickerHost->Control))->Format = - DateTimePickerFormat::Short; - - // Add the control host to the ToolStrip. - toolStrip1->Items->Add( dateTimePickerHost ); - } - // - - // The following example shows how to set the custom - // ToolStripMonthCalendar control. - // - void InitializeDropDownMonthCalendar() - { - // Declare the drop-down button and the drop-down. - ToolStripDropDownButton^ dropDownButton2 = gcnew ToolStripDropDownButton; - - // Set the image to the MonthCalendar embedded bitmap - // image. - dropDownButton2->Image = - gcnew Bitmap( MonthCalendar::typeid,L"MonthCalendar.bmp" ); - - // Add the button to the ToolStrip. - toolStrip1->Items->Add( dropDownButton2 ); - - // Construct a new drop-down. - ToolStripDropDown^ dropDown = gcnew ToolStripDropDown; - - // Construct a new wrapped MonthCalendar control. - ToolStripMonthCalendar^ monthCalendar = gcnew ToolStripMonthCalendar; - - // Set a date in boldface. - monthCalendar->AddBoldedDate( DateTime::Today.AddDays( 7 ) ); - monthCalendar->DateChanged += gcnew DateRangeEventHandler( - this, &Form1::monthCalendar_DateChanged ); - - //Add the calendar to the drop-down. - dropDown->Items->Add( monthCalendar ); - - //Set the drop-down on the DropDownButton. - dropDownButton2->DropDown = dropDown; - } - -private: - void monthCalendar_DateChanged( Object^ /*sender*/, DateRangeEventArgs^ e ) - { - textbox1->Text = e->Start.ToShortDateString(); - } -}; - -int main() -{ - Form1::Main(); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp deleted file mode 100644 index 35759a3ced8..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp +++ /dev/null @@ -1,155 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -// Form for the ToolTip example. -public ref class ToolTipExampleForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ToolTip^ toolTip1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::Button^ button3; - -public: - ToolTipExampleForm() - { - // Create the ToolTip and set initial values. - this->toolTip1 = gcnew System::Windows::Forms::ToolTip; - this->toolTip1->AutoPopDelay = 5000; - this->toolTip1->InitialDelay = 500; - this->toolTip1->OwnerDraw = true; - this->toolTip1->ReshowDelay = 10; - this->toolTip1->Draw += gcnew DrawToolTipEventHandler( this, &ToolTipExampleForm::toolTip1_Draw ); - - // Create button1 and set initial values. - this->button1 = gcnew System::Windows::Forms::Button; - this->button1->Location = System::Drawing::Point( 8, 8 ); - this->button1->Text = "Button 1"; - this->toolTip1->SetToolTip( this->button1, "Button1 tip text" ); - - // Create button2 and set initial values. - this->button2 = gcnew System::Windows::Forms::Button; - this->button2->Location = System::Drawing::Point( 8, 32 ); - this->button2->Text = "Button 2"; - this->toolTip1->SetToolTip( this->button2, "Button2 tip text" ); - - // Create button3 and set initial values. - this->button3 = gcnew System::Windows::Forms::Button; - this->button3->Location = System::Drawing::Point( 8, 56 ); - this->button3->Text = "Button 3"; - this->toolTip1->SetToolTip( this->button3, "Button3 tip text" ); - - // Set up the Form. - array^temp0 = {this->button1,this->button2,this->button3}; - this->Controls->AddRange( temp0 ); - this->Text = "owner drawn ToolTip example"; - } - -protected: - - ~ToolTipExampleForm() - { - if ( toolTip1 != nullptr ) - { - delete toolTip1; - } - } - - // - // Handles drawing the ToolTip. -private: - void toolTip1_Draw( System::Object^ /*sender*/, System::Windows::Forms::DrawToolTipEventArgs^ e ) - { - // Draw the ToolTip differently depending on which - // control this ToolTip is for. - // - // Draw a custom 3D border if the ToolTip is for button1. - if ( e->AssociatedControl == button1 ) - { - // Draw the standard background. - e->DrawBackground(); - - // Draw the custom border to appear 3-dimensional. - array^ temp1 = {Point(0,e->Bounds.Height - 1),Point(0,0),Point(e->Bounds.Width - 1,0)}; - e->Graphics->DrawLines( SystemPens::ControlLightLight, temp1 ); - array^ temp2 = {Point(0,e->Bounds.Height - 1),Point(e->Bounds.Width - 1,e->Bounds.Height - 1),Point(e->Bounds.Width - 1,0)}; - e->Graphics->DrawLines( SystemPens::ControlDarkDark, temp2 ); - - // Specify custom text formatting flags. - TextFormatFlags sf = static_cast(TextFormatFlags::VerticalCenter | TextFormatFlags::HorizontalCenter | TextFormatFlags::NoFullWidthCharacterBreak); - - // Draw the standard text with customized formatting options. - e->DrawText( sf ); - } - // - // - // Draw a custom background and text if the ToolTip is for button2. - else - - // Draw a custom background and text if the ToolTip is for button2. - if ( e->AssociatedControl == button2 ) - { - // Draw the custom background. - e->Graphics->FillRectangle( SystemBrushes::ActiveCaption, e->Bounds ); - - // Draw the standard border. - e->DrawBorder(); - - // Draw the custom text. - // The using block will dispose the StringFormat automatically. - StringFormat^ sf = gcnew StringFormat; - try - { - sf->Alignment = StringAlignment::Center; - sf->LineAlignment = StringAlignment::Center; - sf->HotkeyPrefix = System::Drawing::Text::HotkeyPrefix::None; - sf->FormatFlags = StringFormatFlags::NoWrap; - System::Drawing::Font^ f = gcnew System::Drawing::Font( "Tahoma",9 ); - try - { - e->Graphics->DrawString( e->ToolTipText, f, SystemBrushes::ActiveCaptionText, e->Bounds, sf ); - } - finally - { - if ( f ) - delete safe_cast(f); - } - - } - finally - { - if ( sf ) - delete safe_cast(sf); - } - } - // - // - // Draw the ToolTip using default values if the ToolTip is for button3. - else if ( e->AssociatedControl == button3 ) - { - e->DrawBackground(); - e->DrawBorder(); - e->DrawText(); - } - // - } - // -}; - -// The main entry point for the application. - -[STAThread] -int main() -{ - Application::Run( gcnew ToolTipExampleForm ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp deleted file mode 100644 index 609f86cd370..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp +++ /dev/null @@ -1,73 +0,0 @@ - - -#using -#using -#using - -// -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TrackBar^ trackBar1; - System::Windows::Forms::TextBox^ textBox1; - -public: - Form1() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->trackBar1 = gcnew System::Windows::Forms::TrackBar; - - // TextBox for TrackBar::Value update. - this->textBox1->Location = System::Drawing::Point( 240, 16 ); - this->textBox1->Size = System::Drawing::Size( 48, 20 ); - - // Set up how the form should be displayed and add the controls to the form. - this->ClientSize = System::Drawing::Size( 296, 62 ); - array^formControls = {this->textBox1,this->trackBar1}; - this->Controls->AddRange( formControls ); - this->Text = "TrackBar Example"; - - // Set up the TrackBar. - this->trackBar1->Location = System::Drawing::Point( 8, 8 ); - this->trackBar1->Size = System::Drawing::Size( 224, 45 ); - this->trackBar1->Scroll += gcnew System::EventHandler( this, &Form1::trackBar1_Scroll ); - - // The Maximum property sets the value of the track bar when - // the slider is all the way to the right. - trackBar1->Maximum = 30; - - // The TickFrequency property establishes how many positions - // are between each tick-mark. - trackBar1->TickFrequency = 5; - - // The LargeChange property sets how many positions to move - // if the bar is clicked on either side of the slider. - trackBar1->LargeChange = 3; - - // The SmallChange property sets how many positions to move - // if the keyboard arrows are used to move the slider. - trackBar1->SmallChange = 2; - } - - -private: - void trackBar1_Scroll( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Display the trackbar value in the text box. - textBox1->Text = String::Concat( "", trackBar1->Value ); - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp deleted file mode 100644 index f8c59c950bd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp +++ /dev/null @@ -1,128 +0,0 @@ - - -#using -#using -#using - -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeTrackBar(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::TextBox^ TextBox1; - System::Windows::Forms::Label ^ Label1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->TextBox1 = gcnew System::Windows::Forms::TextBox; - this->Label1 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - //TextBox1 - // - this->TextBox1->Location = System::Drawing::Point( 112, 88 ); - this->TextBox1->Name = "TextBox1"; - this->TextBox1->ReadOnly = true; - this->TextBox1->Size = System::Drawing::Size( 72, 20 ); - this->TextBox1->TabIndex = 0; - this->TextBox1->Text = ""; - - // - //Label1 - // - this->Label1->Location = System::Drawing::Point( 48, 80 ); - this->Label1->Name = "Label1"; - this->Label1->Size = System::Drawing::Size( 56, 32 ); - this->Label1->TabIndex = 1; - this->Label1->Text = "Number of teams:"; - this->Label1->TextAlign = System::Drawing::ContentAlignment::MiddleRight; - - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Label1 ); - this->Controls->Add( this->TextBox1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - //Declare a new TrackBar object. -internal: - System::Windows::Forms::TrackBar^ TrackBar1; - - // Initialize the TrackBar and add it to the form. -private: - void InitializeTrackBar() - { - this->TrackBar1 = gcnew System::Windows::Forms::TrackBar; - TrackBar1->Location = System::Drawing::Point( 75, 30 ); - - // Set the TickStyle property so there are ticks on both sides - // of the TrackBar. - TrackBar1->TickStyle = TickStyle::Both; - - // Set the minimum and maximum number of ticks. - TrackBar1->Minimum = 10; - TrackBar1->Maximum = 100; - - // Set the tick frequency to one tick every ten units. - TrackBar1->TickFrequency = 10; - - // Associate the event-handling method with the - // ValueChanged event. - TrackBar1->ValueChanged += gcnew System::EventHandler( this, &Form1::TrackBar1_ValueChanged ); - this->Controls->Add( this->TrackBar1 ); - } - - // Handle the TrackBar.ValueChanged event by calculating a value for - // TextBox1 based on the TrackBar value. - void TrackBar1_ValueChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - TextBox1->Text = (System::Math::Round( TrackBar1->Value / 10.0 )).ToString(); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp deleted file mode 100644 index 48b77946c90..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp +++ /dev/null @@ -1,234 +0,0 @@ -// This sample can go in TrackBarRenderer class overview. -// - Snippet2 can go in GetTopPointingThumbSize, and possibly other Gets -// - Snippet4 can go in IsSupported, DrawHorizontalTrack, and DrawTopPointingThumb -// - Snippet6 can go in DrawVerticalTick; see below about bug in the meantime, though - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace TrackBarRendererSample -{ - ref class CustomTrackBar : public Control - { - private: - int numberTicks; - Rectangle trackRectangle; - Rectangle ticksRectangle; - Rectangle thumbRectangle; - int currentTickPosition; - float tickSpace; - bool thumbClicked; - TrackBarThumbState thumbState; - - public: - CustomTrackBar(int ticks, System::Drawing::Size trackBarSize) - { - this->Location = Point(10, 10); - this->Size = trackBarSize; - this->numberTicks = ticks; - this->BackColor = Color::DarkCyan; - this->DoubleBuffered = true; - numberTicks = 10; - thumbState = TrackBarThumbState::Normal; - - // Calculate the initial sizes of the bar, - // thumb and ticks. - SetupTrackBar(); - } - - // - // - // Calculate the sizes of the bar, thumb, and ticks rectangle. - private: - void SetupTrackBar() - { - if (!TrackBarRenderer::IsSupported) - { - return; - } - - Graphics^ g = this->CreateGraphics(); - - // Calculate the size of the track bar. - trackRectangle.X = ClientRectangle.X + 2; - trackRectangle.Y = ClientRectangle.Y + 28; - trackRectangle.Width = ClientRectangle.Width - 4; - trackRectangle.Height = 4; - - // Calculate the size of the rectangle in which to - // draw the ticks. - ticksRectangle.X = trackRectangle.X + 4; - ticksRectangle.Y = trackRectangle.Y - 8; - ticksRectangle.Width = trackRectangle.Width - 8; - ticksRectangle.Height = 4; - - tickSpace = ((float)ticksRectangle.Width - 1) / - ((float)numberTicks - 1); - - // Calculate the size of the thumb. - thumbRectangle.Size = - TrackBarRenderer::GetTopPointingThumbSize(g, - TrackBarThumbState::Normal); - - thumbRectangle.X = CurrentTickXCoordinate(); - thumbRectangle.Y = trackRectangle.Y - 8; - } - // - - private: - int CurrentTickXCoordinate() - { - if (tickSpace == 0) - { - return 0; - } - else - { - return ((int)Math::Round(tickSpace) * - currentTickPosition); - } - } - - // - // Draw the track bar. - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - if (!TrackBarRenderer::IsSupported) - { - this->Parent->Text = "CustomTrackBar Disabled"; - return; - } - - this->Parent->Text = "CustomTrackBar Enabled"; - TrackBarRenderer::DrawHorizontalTrack(e->Graphics, - trackRectangle); - TrackBarRenderer::DrawTopPointingThumb(e->Graphics, - thumbRectangle, thumbState); - TrackBarRenderer::DrawHorizontalTicks(e->Graphics, - ticksRectangle, numberTicks, EdgeStyle::Raised); - } - // - - // Determine whether the user has clicked the track bar thumb. - protected: - virtual void OnMouseDown(MouseEventArgs^ e) override - { - if (!TrackBarRenderer::IsSupported) - { - return; - } - if (this->thumbRectangle.Contains(e->Location)) - { - thumbClicked = true; - thumbState = TrackBarThumbState::Pressed; - } - - this->Invalidate(); - } - // - - // Redraw the track bar thumb if the user has moved it. - protected: - virtual void OnMouseUp(MouseEventArgs^ e) override - { - if (!TrackBarRenderer::IsSupported) - { - return; - } - if (thumbClicked) - { - if (e->Location.X > trackRectangle.X && - e->Location.X < (trackRectangle.X + - trackRectangle.Width - thumbRectangle.Width)) - { - thumbClicked = false; - thumbState = TrackBarThumbState::Hot; - this->Invalidate(); - } - - thumbClicked = false; - } - } - - // Track cursor movements. - protected: - virtual void OnMouseMove(MouseEventArgs^ e) override - { - if (!TrackBarRenderer::IsSupported) - { - return; - } - // The user is moving the thumb. - if (thumbClicked) - { - // Track movements to the next tick to the right, if - // the cursor has moved halfway to the next tick. - if (currentTickPosition < numberTicks - 1 && - e->Location.X > CurrentTickXCoordinate() + - (int)(tickSpace)) - { - currentTickPosition++; - } - - // Track movements to the next tick to the left, if - // cursor has moved halfway to the next tick. - else if (currentTickPosition > 0 && - e->Location.X < CurrentTickXCoordinate() - - (int)(tickSpace / 2)) - { - currentTickPosition--; - } - - thumbRectangle.X = CurrentTickXCoordinate(); - } - - // The cursor is passing over the track. - else - { - if (thumbRectangle.Contains(e->Location)) - { - thumbState = TrackBarThumbState::Hot; - } - else - { - thumbState = TrackBarThumbState::Normal; - } - } - - Invalidate(); - } - }; - - ref class Form1 : public Form - { - public: - Form1() - { - CustomTrackBar^ TrackBar1 = gcnew CustomTrackBar(19, - System::Drawing::Size(300, 50)); - this->Width = 500; - this->Controls->Add(TrackBar1); - } - }; -} - -[STAThread] -int main() -{ - // Note that the call to EnableVisualStyles below does - // not affect whether TrackBarRenderer.IsSupported is true; - // as long as visual styles are enabled by the operating system, - // IsSupported is true. - Application::EnableVisualStyles(); - Application::Run(gcnew TrackBarRendererSample::Form1()); - return 0; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp deleted file mode 100644 index d5a895bd94d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp +++ /dev/null @@ -1,241 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing::Printing; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - document = gcnew System::Drawing::Printing::PrintDocument; - InitializeComponent(); - InitializeTreeView(); - InitializePrintPreviewDialog(); - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - -internal: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::Button^ Button1; - System::Windows::Forms::TreeView^ TreeView1; - -private: - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - this->Button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - this->Button1->Location = System::Drawing::Point( 192, 104 ); - this->Button1->Name = "Button1"; - this->Button1->Size = System::Drawing::Size( 72, 32 ); - this->Button1->TabIndex = 0; - this->Button1->Text = "Print Preview"; - this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Controls->Add( this->Button1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // -private: - void InitializeTreeView() - { - - // Construct the TreeView object. - this->TreeView1 = gcnew System::Windows::Forms::TreeView; - - // Set dock, location, size name, and tab order - // values for the TreeView object. - TreeView1->Dock = System::Windows::Forms::DockStyle::Left; - TreeView1->Location = System::Drawing::Point( 0, 0 ); - TreeView1->Name = "TreeView1"; - TreeView1->Size = System::Drawing::Size( 152, 266 ); - TreeView1->TabIndex = 1; - - // Associate the event-handling methods with the - // BeforeLabeEdit and the AfterSelect events. - TreeView1->BeforeLabelEdit += gcnew NodeLabelEditEventHandler( this, &Form1::TreeView1_BeforeLabelEdit ); - TreeView1->AfterSelect += gcnew TreeViewEventHandler( this, &Form1::TreeView1_AfterSelect ); - - // Set the LabelEdit property to true to allow the - // user to edit the TreeNode text. - this->TreeView1->LabelEdit = true; - - // Declare and create objects needed to populate - // the TreeView. - array^files = {"bigPresentation.ppt","myFinances.xls","myResume.doc"}; - ; - String^ filePath = "c:\\myFiles"; - System::Collections::ArrayList^ nodes = gcnew System::Collections::ArrayList; - - // Create a node for each file, setting the Text property to the - // file's name and the Tag property to file's fully-qualified name. - System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ file = safe_cast(myEnum->Current); - TreeNode^ node = gcnew TreeNode( file ); - node->Tag = String::Concat( filePath, "\\", file ); - nodes->Add( node ); - } - - array^treeNodes = gcnew array(nodes->Count); - nodes->CopyTo( treeNodes ); - - // Create a new node named topNode and add the ArrayList of - // nodes to topNode. - TreeNode^ topNode = gcnew TreeNode( "myFiles",treeNodes ); - topNode->Tag = filePath; - - // Add topNode to the TreeView. - TreeView1->Nodes->Add( topNode ); - - // Add the TreeView to the form. - this->Controls->Add( TreeView1 ); - } - - void TreeView1_BeforeLabelEdit( Object^ /*sender*/, NodeLabelEditEventArgs^ e ) - { - - // Determine whether the user has selected the top node. If so, - // change the CancelEdit property to true to cancel the edit. - if ( e->Node == TreeView1->TopNode ) - { - e->CancelEdit = true; - MessageBox::Show( "You are not allowed to edit the top node" ); - } - - } - // - - // -private: - // Handle the After_Select event. - void TreeView1_AfterSelect( System::Object^ /*sender*/, System::Windows::Forms::TreeViewEventArgs^ e ) - { - - // Vary the response depending on which TreeViewAction - // triggered the event. - switch ( (e->Action) ) - { - case TreeViewAction::ByKeyboard: - MessageBox::Show( "You like the keyboard!" ); - break; - - case TreeViewAction::ByMouse: - MessageBox::Show( "You like the mouse!" ); - break; - } - } - // - - // The following code example assumes the form contains a TreeView - // object named TreeView1 that contains TreeNode objects. Each - // TreeNode objects Tag property must be set to a fully-qualified - // document name that can be accessed by the machine running the - // example. Set each Text property to a string that identifies - // the file specified by the Tag property. For example, you could set - // TreeNode1.Tag to c:\myDocuments\recipe.doc and - // TreeNode1.Text to recipe.doc. - // It also assumes the form contains a PrintPreviewDialog object - // named PrintPreviewDialog1 and a button named Button1. To run this - // example call the InitializePrintPreviewDialog method in the form's - // constructor. - - // - // Declare the dialog. -internal: - PrintPreviewDialog^ PrintPreviewDialog1; - -private: - - // Declare a PrintDocument object named document. - System::Drawing::Printing::PrintDocument^ document; - - // Initialize the dialog. - void InitializePrintPreviewDialog() - { - - // Create a new PrintPreviewDialog using constructor. - this->PrintPreviewDialog1 = gcnew PrintPreviewDialog; - - //Set the size, location, and name. - this->PrintPreviewDialog1->ClientSize = System::Drawing::Size( 400, 300 ); - this->PrintPreviewDialog1->Location = System::Drawing::Point( 29, 29 ); - this->PrintPreviewDialog1->Name = "PrintPreviewDialog1"; - - // Associate the event-handling method with the - // document's PrintPage event. - this->document->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler( this, &Form1::document_PrintPage ); - - // Set the minimum size the dialog can be resized to. - this->PrintPreviewDialog1->MinimumSize = System::Drawing::Size( 375, 250 ); - - // Set the UseAntiAlias property to true, which will allow the - // operating system to smooth fonts. - this->PrintPreviewDialog1->UseAntiAlias = true; - } - - void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( TreeView1->SelectedNode != nullptr ) - { - document->DocumentName = TreeView1->SelectedNode->Tag->ToString(); - } - - // Set the PrintPreviewDialog.Document property to - // the PrintDocument object selected by the user. - PrintPreviewDialog1->Document = document; - - // Call the ShowDialog method. This will trigger the document's - // PrintPage event. - PrintPreviewDialog1->ShowDialog(); - } - - void document_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^ e ) - { - - // Insert code to render the page here. - // This code will be called when the PrintPreviewDialog.Show - // method is called. - // The following code will render a simple - // message on the document in the dialog. - String^ text = "In document_PrintPage method."; - System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,System::Drawing::FontStyle::Regular ); - e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 0, 0 ); - } - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp deleted file mode 100644 index 14b81d94cfd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp +++ /dev/null @@ -1,133 +0,0 @@ - - -#using -#using -#using - -// This snippet shows the use of some TreeView properties. -using namespace System::Windows::Forms; -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - : Form() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - InitializeTreeView(); - - //Add any initialization after the InitializeComponent() call - } - - -protected: - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //Required by the Windows Form Designer - System::ComponentModel::IContainer^ components; - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - - [System::Diagnostics::DebuggerStepThrough] - void InitializeComponent() - { - // - //Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - // - // Declare the TreeView control. -internal: - System::Windows::Forms::TreeView^ TreeView1; - -private: - // Initialize the TreeView to blend with the form, giving it the - // same color as the form and no border. - void InitializeTreeView() - { - // Create a new TreeView control and set the location and size. - this->TreeView1 = gcnew System::Windows::Forms::TreeView; - this->TreeView1->Location = System::Drawing::Point( 72, 48 ); - this->TreeView1->Size = System::Drawing::Size( 200, 200 ); - - // Set the BorderStyle property to none, the BackColor property to - // the form's backcolor, and the Scrollable property to false. - // This allows the TreeView to blend in form. - this->TreeView1->BorderStyle = BorderStyle::None; - this->TreeView1->BackColor = this->BackColor; - this->TreeView1->Scrollable = false; - - // Set the HideSelection property to false to keep the - // selection highlighted when the user leaves the control. - // This helps it blend with form. - this->TreeView1->HideSelection = false; - - // Set the ShowRootLines and ShowLines properties to false to - // give the TreeView a list-like appearance. - this->TreeView1->ShowRootLines = false; - this->TreeView1->ShowLines = false; - - // Add the nodes. - array^temp0 = {gcnew TreeNode( "Full Color" ),gcnew TreeNode( "Project Wizards" ),gcnew TreeNode( "Visual C# and Visual Basic Support" )}; - array^temp1 = {gcnew TreeNode( "Pentium 133 MHz or faster processor " ),gcnew TreeNode( "Windows 98 or later" ),gcnew TreeNode( "100 MB Disk space" )}; - array^temp2 = {gcnew TreeNode( "Features",temp0 ),gcnew TreeNode( "System Requirements",temp1 )}; - this->TreeView1->Nodes->AddRange( temp2 ); - - // Set the tab index and add the TreeView to the form. - this->TreeView1->TabIndex = 0; - this->Controls->Add( this->TreeView1 ); - } - // - - // - System::Windows::Forms::TreeView^ TreeView2; - - // Initialize the TreeView to blend with the form, giving it the - // same color as the form and no border. - void InitializeSelectedTreeView() - { - - // Create a new TreeView control and set the location and size. - this->TreeView2 = gcnew System::Windows::Forms::TreeView; - this->TreeView2->Location = System::Drawing::Point( 72, 48 ); - this->TreeView2->Size = System::Drawing::Size( 200, 200 ); - this->TreeView2->BorderStyle = BorderStyle::Fixed3D; - - // Set the HideSelection property to false to keep the - // selection highlighted when the user leaves the control. - this->TreeView1->HideSelection = false; - - // Add the nodes. - array^temp0 = {gcnew TreeNode( "Full Color" ),gcnew TreeNode( "Project Wizards" ),gcnew TreeNode( "Visual C# and Visual Basic Support" )}; - array^temp1 = {gcnew TreeNode( "Pentium 133 MHz or faster processor " ),gcnew TreeNode( "Windows 98 or later" ),gcnew TreeNode( "100 MB Disk space" )}; - array^temp2 = {gcnew TreeNode( "Features",temp0 ),gcnew TreeNode( "System Requirements",temp1 )}; - this->TreeView1->Nodes->AddRange( temp2 ); - - // Set the tab index and add the TreeView to the form. - this->TreeView1->TabIndex = 0; - this->Controls->Add( this->TreeView1 ); - } - - // -}; - -[System::STAThreadAttribute] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp deleted file mode 100644 index 0373e435aa4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp +++ /dev/null @@ -1,267 +0,0 @@ -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; -using namespace System::Collections; - -//Create a Class that inherits from System.Windows.Forms.Form. -public ref class TreeViewWhidbeyMembersExample : - public System::Windows::Forms::Form -{ -public: - TreeViewWhidbeyMembersExample() - { - InitializeComponent(); - //InitializeStatefulTreeView(); - //InitializeTreeViewWithToolTips(); - InitializeInitialTreeView(); - initialTreeView->MouseDown += gcnew MouseEventHandler(this, - &TreeViewWhidbeyMembersExample::InitialTreeView_MouseDown); - initialTreeView->NodeMouseClick += - gcnew TreeNodeMouseClickEventHandler(this, - &TreeViewWhidbeyMembersExample::InitialTreeView_NodeMouseClick); - initialTreeView->NodeMouseDoubleClick += - gcnew TreeNodeMouseClickEventHandler(this, - &TreeViewWhidbeyMembersExample::InitialTreeView_NodeMouseDoubleClick); - initialTreeView->NodeMouseHover += - gcnew TreeNodeMouseHoverEventHandler(this, - &TreeViewWhidbeyMembersExample::InitialTreeView_NodeMouseHover); - //InitializeLineTreeView(); - } - - // - // Create a node sorter that implements the IComparer interface. -private: - ref class NodeSorter : public IComparer - { - // Compare the length of the strings, or the strings - // themselves, if they are the same length. - public: - virtual int Compare(Object^ x, Object^ y) - { - TreeNode^ tx = (TreeNode^)x; - TreeNode^ ty = (TreeNode^)y; - - // Compare the length of the strings, returning the difference. - if (tx->Text->Length != ty->Text->Length) - { - return (tx->Text->Length - ty->Text->Length); - } - - // If they are the same length, call Compare. - return String::Compare(tx->Text, ty->Text); - } - }; - - // Declare the TreeView. -private: - TreeView^ initialTreeView; -private: - TextBox^ displayNodes; -private: - Button^ setSorter; - -private: - void InitializeInitialTreeView() - { - // Create the TreeView - initialTreeView = gcnew TreeView(); - initialTreeView->Size = System::Drawing::Size(200, 200); - - // Create the button and set some basic properties. - setSorter = gcnew Button(); - setSorter->Location = Point(205, 138); - setSorter->Text = "Set Sorter"; - - // Handle the click event for the button. - setSorter->Click += gcnew EventHandler(this, - &TreeViewWhidbeyMembersExample::SetSorter_Click); - - // Create the root nodes. - TreeNode^ docNode = gcnew TreeNode("Documents"); - TreeNode^ spreadSheetNode = gcnew TreeNode("Spreadsheets"); - - // Add some additional nodes. - spreadSheetNode->Nodes->Add("payroll.xls"); - spreadSheetNode->Nodes->Add("checking.xls"); - spreadSheetNode->Nodes->Add("tracking.xls"); - docNode->Nodes->Add("phoneList.doc"); - docNode->Nodes->Add("resume.doc"); - - // Add the root nodes to the TreeView. - initialTreeView->Nodes->Add(spreadSheetNode); - initialTreeView->Nodes->Add(docNode); - - // Add the TreeView to the form. - this->Controls->Add(initialTreeView); - this->Controls->Add(setSorter); - } - - // Set the TreeViewNodeSorter property to a new instance - // of the custom sorter. -private: - void SetSorter_Click(Object^ sender, EventArgs^ e) - { - initialTreeView->TreeViewNodeSorter = gcnew NodeSorter(); - } - // - - // The following code example demonstrates setting the TreeNode line color. - // To run this example, paste the code into a Windows Form. Call - // InitializeLineTreeView from the form's constructor or Load - // event handling method. - // -private: - TreeView^ lineTreeView; - -public: - void InitializeLineTreeView() - { - lineTreeView = gcnew TreeView(); - lineTreeView->Size = System::Drawing::Size(200, 200); - - lineTreeView->LineColor = Color::Red; - - // Create the root nodes. - TreeNode^ docNode = gcnew TreeNode("Documents"); - - // Add some additional nodes. - docNode->Nodes->Add("phoneList.doc"); - docNode->Nodes->Add("resume.doc"); - - lineTreeView->Nodes->Add(docNode); - this->Controls->Add(lineTreeView); - } - // - -private: - void InitializeComponent() - { - this->displayNodes = gcnew System::Windows::Forms::TextBox(); - this->SuspendLayout(); - // - // textBox1 - // - this->displayNodes->Location = System::Drawing::Point(180, 93); - this->displayNodes->Name = "textBox1"; - this->displayNodes->TabIndex = 0; - // - // Form1 - // - this->AutoScaleBaseSize = System::Drawing::Size(5, 13); - this->ClientSize = System::Drawing::Size(292, 266); - this->Controls->Add(this->displayNodes); - this->Name = "Form1"; - this->ResumeLayout(false); - this->PerformLayout(); - } - - // The following example code demonstrates how to use the TreeNode.Level, - // TreeViewHitTestInfo.Node and TreeView.HitTest members. - // To run this example create a Windows Form that contains a TreeView - // named treeView1 and populate it with several levels of nodes. - // Paste the following code into the form and associate the MouseDown - // event of treeView1 with the treeView1_MouseDown method in this example. - // -private: - void InitialTreeView_MouseDown(Object^ sender, MouseEventArgs^ e) - { - TreeViewHitTestInfo^ info = initialTreeView->HitTest(e->X, e->Y); - TreeNode^ hitNode; - - if (info->Node != nullptr) - { - hitNode = info->Node; - MessageBox::Show(hitNode->Level.ToString()); - } - } - // - - // The following example demonstrates how to handle the NodeMouseClick - // event. - // -private: - void InitialTreeView_NodeMouseClick(Object^ sender, - TreeNodeMouseClickEventArgs^ e) - { - displayNodes->Text = e->Node->Text; - } - // - - // The following example demonstrates how to handle the - // NodeMouseDoubleClick event and how to use the TreeNodeMouse- - // ClickEventArgs.To run this example, paste the code into a Windows Form - // that contains a TreeView named treeView1. Populate the treeView1 with - // the names of files located in the c:\ directly of the system the sample - // is running on, and associate the NodeMouseDoubleClick event of treeView1 - // with the treeView1_NodeMouseDoubleClick method in this example. - // - // If a node is double-clicked, open the file indicated by the TreeNode. -private: - void InitialTreeView_NodeMouseDoubleClick(Object^ sender, - TreeNodeMouseClickEventArgs^ e) - { - try - { - // Look for a file extension. - if (e->Node->Text->Contains(".")) - { - System::Diagnostics::Process::Start("c:\\" + e->Node->Text); - } - } - // If the file is not found, handle the exception and inform the user. - catch (System::ComponentModel::Win32Exception^) - { - MessageBox::Show("File not found."); - } - } - // - - // The following example demonstrates how to handle the - // NodeMouseHover event. - // -private: - void InitialTreeView_NodeMouseHover(Object^ sender, - TreeNodeMouseHoverEventArgs^ e) - { - e->Node->Toggle(); - } - // - - // The following code example demonstrates the StateImageList - // property. To run this example, paste the code into a Windows - // Form and call InitializeCheckTreeView from the form's - // constructor or Load event-handling method. - // - TreeView^ checkTreeView; -private: - void InitializeCheckTreeView() - { - checkTreeView = gcnew TreeView(); - - // Show check boxes for the TreeView. This - // will cause the StateImageList to be used. - checkTreeView->CheckBoxes = true; - - // Create the StateImageList and add two images. - checkTreeView->StateImageList = gcnew ImageList(); - checkTreeView->StateImageList->Images->Add(SystemIcons::Question); - checkTreeView->StateImageList->Images->Add(SystemIcons::Exclamation); - - // Add some nodes to the TreeView and the TreeView to the form. - checkTreeView->Nodes->Add("Node1"); - checkTreeView->Nodes->Add("Node2"); - this->Controls->Add(checkTreeView); - } - // -}; - -[STAThreadAttribute] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew TreeViewWhidbeyMembersExample()); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp deleted file mode 100644 index fa090410e9d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp +++ /dev/null @@ -1,384 +0,0 @@ -// This sample can go in the VisualStyleElement class overview or a conceptual -// topic to give the new user a chance to view what each of the defined -// elements looks like. This sample also gives them the ability to preview each -// element at three different sizes. - -// -#using -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::Drawing; -using namespace System::Collections::Generic; -using namespace System::Reflection; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace VisualStyleElementViewer -{ - public ref class ElementViewer : public UserControl - { - private: - VisualStyleElement^ element; - VisualStyleRenderer^ renderer; - Dictionary^ elementDictionary; - Rectangle descriptionRect; - Rectangle displayRect; - Rectangle displayRectFull; - System::Drawing::Size currentTrueSize; - StringBuilder^ elementDescription; - Label^ infoLabel; - TreeView^ treeView; - DomainUpDown^ domainUpDown; - bool drawElement; - - public: - ElementViewer():UserControl() - { - elementDictionary = - gcnew Dictionary(); - currentTrueSize = System::Drawing::Size(); - elementDescription = gcnew StringBuilder(); - infoLabel = gcnew Label(); - treeView = gcnew TreeView(); - domainUpDown = gcnew DomainUpDown(); - - this->Location = Point(10, 10); - this->Size = System::Drawing::Size(650, 500); - this->Text = "VisualStyleElement Viewer"; - this->Font = SystemFonts::IconTitleFont; - this->BackColor = Color::White; - this->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - this->AutoSize = true; - this->Load += gcnew EventHandler(this, - &ElementViewer::ElementViewer_Load); - } - - private: - void ElementViewer_Load(Object^ sender, EventArgs^ e) - { - // Make sure the visual styles are enabled before - // going any further. - if (!Application::RenderWithVisualStyles) - { - return; - } - - infoLabel->Location = Point(320, 10); - infoLabel->Size = System::Drawing::Size(300, 60); - infoLabel->Text = "Expand the element class nodes " + - "in the tree view to access visual style elements. " + - "Click an element name to draw the element below. To " + - "change the size of a resizable element, use the " + - "spin control."; - - domainUpDown->Location = Point(320, 80); - domainUpDown->Size = System::Drawing::Size(70, 30); - domainUpDown->ReadOnly = true; - domainUpDown->Items->Add(elementSizes::Large); - domainUpDown->Items->Add(elementSizes::Medium); - domainUpDown->Items->Add(elementSizes::TrueSize); - domainUpDown->SelectedIndex = 2; - domainUpDown->SelectedItemChanged += - gcnew EventHandler(this, - &ElementViewer::DomainUpDown_SelectedItemChanged); - domainUpDown->DownButton(); - - descriptionRect = Rectangle(320, 120, 250, 50); - displayRect = Rectangle(320, 160, 0, 0); - displayRectFull = Rectangle(320, 160, 300, 200); - - // Initialize the element and renderer to known good values. - element = VisualStyleElement::Button::PushButton::Normal; - renderer = gcnew VisualStyleRenderer(element); - - SetupElementCollection(); - SetupTreeView(); - - this->Controls->AddRange(gcnew array{treeView, - domainUpDown, infoLabel }); - } - - // Use reflection to build a Dictionary of all - // VisualStyleElement objects exposed in the - // System.Windows.Forms.VisualStyles namespace. - private: - void SetupElementCollection() - { - StringBuilder^ elementName = gcnew StringBuilder(); - VisualStyleElement^ currentElement; - int plusSignIndex = 0; - - // Get array of first-level nested types within - // VisualStyleElement; these are the element classes. - array^ elementClasses = - VisualStyleElement::typeid->GetNestedTypes(); - - for each (Type^ elementClass in elementClasses) - { - // Get an array of second-level nested types within - // VisualStyleElement; these are the element parts. - array^ elementParts = elementClass->GetNestedTypes(); - - // Get the index of the first '+' character in - // the full element class name. - plusSignIndex = elementClass->FullName->IndexOf('+'); - - for each (Type^ elementPart in elementParts) - { - // Get an array of static property details - // for the current type. Each of these types have - // properties that return VisualStyleElement objects. - array^ elementProperties = - elementPart->GetProperties(BindingFlags::Static | - BindingFlags::Public); - - // For each property, insert the unique full element - // name and the element into the collection. - for each(PropertyInfo^ elementProperty in - elementProperties) - { - // Get the element. - currentElement = - (VisualStyleElement^)elementProperty-> - GetValue(nullptr, BindingFlags::Static, nullptr, - nullptr, nullptr); - - // Append the full element name. - elementName->Append(elementClass->FullName, - plusSignIndex + 1, - elementClass->FullName->Length - - plusSignIndex - 1); - elementName->Append("." + - elementPart->Name + "." + - elementProperty->Name); - - // Add the element and element name to - // the Dictionary. - elementDictionary->Add(elementName->ToString(), - currentElement); - - // Clear the element name for the - // next iteration. - elementName->Remove(0, elementName->Length); - } - } - } - } - - // Initialize the tree view with the element names. - private: - void SetupTreeView() - { - treeView->Location = Point(10, 10); - treeView->Size = System::Drawing::Size(300, 450); - // treeView->BorderStyle = BorderStyle.FixedSingle; - treeView->BackColor = Color::WhiteSmoke; - treeView->SelectedNode = nullptr; - treeView->AfterSelect += - gcnew TreeViewEventHandler(this, - &ElementViewer::TreeView_AfterSelect); - - treeView->BeginUpdate(); - - // An index into the top-level tree nodes. - int nodeIndex = 0; - - // An index into the first '.' character in an element name. - int firstDotIndex = 0; - - // Initialize the element class name to compare - // with the class name of the first element - // in the Dictionary, and set this name to the first - // top-level node. - StringBuilder^ compareClassName = - gcnew StringBuilder("Button"); - treeView->Nodes->Add( - gcnew TreeNode(compareClassName->ToString())); - - // The current element class name. - StringBuilder^ currentClassName = gcnew StringBuilder(); - - // The text for each second-level node. - StringBuilder^ nodeText = gcnew StringBuilder(); - - for each(KeyValuePair^ entry - in elementDictionary) - { - // Isolate the class name of the current element. - firstDotIndex = entry->Key->IndexOf('.'); - currentClassName->Append(entry->Key, 0, firstDotIndex); - - // Determine whether we need to increment to the next - // element class. - if (currentClassName->ToString() != - compareClassName->ToString()) - { - // Increment the index to the next top-level node - // in the tree view. - nodeIndex++; - - // Get the new class name to compare with. - compareClassName->Remove(0, compareClassName->Length); - compareClassName->Append(entry->Key); - compareClassName->Remove(firstDotIndex, - compareClassName->Length - firstDotIndex); - - // Add a new top-level node to the tree view. - treeView->Nodes->Add( - gcnew TreeNode(compareClassName->ToString())); - } - - // Get the text for the new second-level node. - nodeText->Append(entry->Key, firstDotIndex + 1, - entry->Key->Length - firstDotIndex - 1); - - // Create and insert the new second-level node. - TreeNode^ newNode = gcnew TreeNode(nodeText->ToString()); - newNode->Name = entry->Key; - treeView->Nodes[nodeIndex]->Nodes->Add(newNode); - - currentClassName->Remove(0, currentClassName->Length); - nodeText->Remove(0, nodeText->Length); - } - treeView->EndUpdate(); - } - - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - // Do nothing further if visual styles are disabled. - if (!Application::RenderWithVisualStyles) - { - this->Text = "Visual styles are disabled."; - TextRenderer::DrawText(e->Graphics, this->Text, this->Font, - this->Location, this->ForeColor); - return; - } - - // Draw the element description. - TextRenderer::DrawText(e->Graphics, elementDescription->ToString(), - this->Font, descriptionRect, this->ForeColor, - TextFormatFlags::WordBreak); - - // Draw the element, if an element is selected. - if (drawElement) - { - renderer->DrawBackground(e->Graphics, this->displayRect); - } - } - - // Set the element to draw. - private: - void TreeView_AfterSelect(Object^ sender, TreeViewEventArgs^ e) - { - // Clear the element description. - elementDescription->Remove(0, elementDescription->Length); - - // If the user clicked a first-level node, disable drawing. - if (e->Node->Nodes->Count > 0) - { - drawElement = false; - elementDescription->Append("No element is selected"); - domainUpDown->Enabled = false; - } - - // The user clicked an element node. - else - { - // Add the element name to the description. - elementDescription->Append(e->Node->Text); - - // Get the element that corresponds to the selected - // node's name. - String^ key = e->Node->Name; - element = elementDictionary[key]; - - // Disable resizing if the element is not defined. - if (!VisualStyleRenderer::IsElementDefined(element)) - { - drawElement = false; - elementDescription->Append(" is not defined."); - domainUpDown->Enabled = false; - } - else - { - // Set the element to the renderer. - drawElement = true; - renderer->SetParameters(element); - elementDescription->Append(" is defined."); - - // Get the system-defined size of the element. - Graphics^ g = this->CreateGraphics(); - currentTrueSize = renderer->GetPartSize(g, - ThemeSizeType::True); - delete g; - displayRect.Size = currentTrueSize; - - domainUpDown->Enabled = true; - domainUpDown->SelectedIndex = 2; - } - } - - Invalidate(); - } - - // Resize the element display area. - private: - void DomainUpDown_SelectedItemChanged(Object^ sender, - EventArgs^ e) - { - switch ((int)domainUpDown->SelectedItem) - { - case this->elementSizes::TrueSize: - displayRect.Size = currentTrueSize; - break; - case this->elementSizes::Medium: - displayRect.Size = - System::Drawing::Size(displayRectFull.Width / 2, - displayRectFull.Height / 2); - break; - case this->elementSizes::Large: - displayRect.Size = displayRectFull.Size; - break; - } - - Invalidate(); - } - - // These values represent the options in the UpDown control. - private: - enum class elementSizes - { - TrueSize, - Medium, - Large - }; - }; - public ref class ElementViewerForm : public Form - { - public: - ElementViewerForm() - { - ElementViewer^ elementViewer = gcnew ElementViewer(); - this->Controls->Add(elementViewer); - this->Text = elementViewer->Text; - this->Size = System::Drawing::Size(700, 550); - } - }; -} - -using namespace VisualStyleElementViewer; - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew ElementViewerForm()); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp deleted file mode 100644 index 07e9572f8c2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp +++ /dev/null @@ -1,73 +0,0 @@ -// -// This is a simple example for VisualStyleInformation that displays -// all of the visual style values in a ListView. - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Text; -using namespace System::Reflection; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace VisualStyleInformationSample -{ - public ref class StyleInfo : public Form - { - private: - ListView^ displayStyleInfo; - - public: - StyleInfo() - { - this->displayStyleInfo = gcnew ListView(); - this->ClientSize = System::Drawing::Size(500, 500); - this->Text = "VisualStyleInformation Property Values"; - - displayStyleInfo->Bounds = System::Drawing::Rectangle - (System::Drawing::Point(10, 10),System::Drawing::Size(400, 300)); - displayStyleInfo->View = View::Details; - displayStyleInfo->FullRowSelect = true; - displayStyleInfo->Sorting = SortOrder::Ascending; - - Type^ typeInfo = VisualStyleInformation::typeid; - Object^ propertyValue; - - // Declare an array of static/Shared property details for the - // VisualStyleInformation class. - array^ elementProperties = typeInfo->GetProperties - (BindingFlags::Static | BindingFlags::Public); - - String^ name; - // Insert each property name and value into the ListView. - for each (PropertyInfo^ property in elementProperties) - { - name = property->Name; - propertyValue = property->GetValue(nullptr, - BindingFlags::Static, nullptr, nullptr, nullptr); - ListViewItem^ newItem = gcnew ListViewItem(name, 0); - newItem->SubItems->Add(propertyValue->ToString()); - displayStyleInfo->Items->Add(newItem); - } - - // Create columns for the items and subitems. - displayStyleInfo->Columns->Add("Property", -2, - System::Windows::Forms::HorizontalAlignment::Left); - displayStyleInfo->Columns->Add("Value", -2, - System::Windows::Forms::HorizontalAlignment::Left); - - // Add the ListView to the control collection. - this->Controls->Add(displayStyleInfo); - } - }; -} - -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew VisualStyleInformationSample::StyleInfo()); -} -// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp deleted file mode 100644 index 52a2bd32b23..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp +++ /dev/null @@ -1,438 +0,0 @@ -// This sample might go in a VisualStyleRenderer conceptual topic, -// or the VisualStyleRenderer class itself. The sample defines a custom control -// that imitates a window using VisualStyleElements -// for the window parts. It handles resizing and moving the window. - -// This sample uses the following VisualStyleRenderer members: -// Snippet10: VisualStyleRenderer.GetPartSize (with ThemeSizeType.True) -// Snippet10: VisualStyleRenderer.GetPoint (with PointProperty.Offset) -// Snippet20: VisualStyleRenderer.DrawBackground -// Snippet30: VisualStyleRenderer.GetBackgroundRegion -// Snippet40: VisualStyleRenderer.IsElementDefined -// Snippet40: VisualStyleRenderer(VisualStyleElement) constructor -// Snippet40: VisualStyleRenderer.SetParameters - -// Work Items: - Try to make HitTestBackground method work in MouseDown event handler. -// - Why does the offset value obtained for the close button make it draw a bit -// too far to the right? -// - Right now I'm hard-coding the height of the status bar rect to 22, which -// visual matches the standard Windows version. Doing GetPartSize on this -// part only returns a height of 15, which is way to short; is this a bug? - - -// -#using -#using -#using - -using namespace System; -using namespace System::Text; -using namespace System::Drawing; -using namespace System::Drawing::Drawing2D; -using namespace System::Collections::Generic; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace VisualStyleRendererSample -{ - - public ref class WindowSimulation : public Control - { - private: - Dictionary^ windowElements; - Dictionary^ elementRectangles; - VisualStyleRenderer^ renderer; - Point closeButtonOffset; - System::Drawing::Size gripperSize; - System::Drawing::Size closeButtonSize; - bool isResizing; - bool isMoving; - bool isClosing; - int captionHeight; - int frameThickness; - int statusHeight; - Point originalClick; - Point resizeOffset; - - public: - WindowSimulation() : Control() - { - statusHeight = 22; - windowElements = gcnew Dictionary(); - elementRectangles = gcnew Dictionary(); - this->Location = Point(50, 50); - this->Size = System::Drawing::Size(350, 300); - this->BackColor = Color::Azure; - this->DoubleBuffered = true; - this->MinimumSize = System::Drawing::Size(300, 200); - this->Font = SystemFonts::CaptionFont; - this->Text = "Simulated Window"; - - // Insert the VisualStyleElement objects into the Dictionary. - windowElements->Add("windowCaption", - VisualStyleElement::Window::Caption::Active); - windowElements->Add("windowBottom", - VisualStyleElement::Window::FrameBottom::Active); - windowElements->Add("windowLeft", - VisualStyleElement::Window::FrameLeft::Active); - windowElements->Add("windowRight", - VisualStyleElement::Window::FrameRight::Active); - windowElements->Add("windowClose", - VisualStyleElement::Window::CloseButton::Normal); - windowElements->Add("statusBar", - VisualStyleElement::Status::Bar::Normal); - windowElements->Add("statusGripper", - VisualStyleElement::Status::Gripper::Normal); - - // Get the sizes and location offsets for the window parts - // as specified by the visual style, and then use this - // information to calcualate the rectangles for each part. - GetPartDetails(); - CalculateRectangles(); - - this->MouseDown += - gcnew MouseEventHandler(this, - &WindowSimulation::ImitationWindow_MouseDown); - this->MouseUp += - gcnew MouseEventHandler(this, - &WindowSimulation::ImitationWindow_MouseUp); - this->MouseMove += - gcnew MouseEventHandler(this, - &WindowSimulation::ImitationWindow_MouseMove); - } - - // - // Get the sizes and offsets for the window parts as specified - // by the visual style. - private: - void GetPartDetails() - { - // Do nothing further if visual styles are not enabled. - if (!Application::RenderWithVisualStyles) - { - return; - } - - Graphics^ g = this->CreateGraphics(); - - // Get the size and offset of the close button. - if (SetRenderer(windowElements["windowClose"])) - { - closeButtonSize = - renderer->GetPartSize(g, ThemeSizeType::True); - closeButtonOffset = - renderer->GetPoint(PointProperty::Offset); - } - - // Get the height of the window caption. - if (SetRenderer(windowElements["windowCaption"])) - { - captionHeight = renderer->GetPartSize(g, - ThemeSizeType::True).Height; - } - - // Get the thickness of the left, bottom, - // and right window frame. - if (SetRenderer(windowElements["windowLeft"])) - { - frameThickness = renderer->GetPartSize(g, - ThemeSizeType::True).Width; - } - - // Get the size of the resizing gripper. - if (SetRenderer(windowElements["statusGripper"])) - { - gripperSize = renderer->GetPartSize(g, - ThemeSizeType::True); - } - - } - // - - // Use the part metrics to determine the current size - // of the rectangles for all of the window parts. - private: - void CalculateRectangles() - { - int heightMinusFrame = - ClientRectangle.Height - frameThickness; - - // Calculate the window frame rectangles and add them - // to the Dictionary of rectangles. - elementRectangles["windowCaption"] = Rectangle(0, 0, - ClientRectangle.Width, captionHeight); - elementRectangles["windowBottom"] = Rectangle(0, - heightMinusFrame, ClientRectangle.Width, frameThickness); - elementRectangles["windowLeft"] = Rectangle(0, captionHeight, - frameThickness, heightMinusFrame - captionHeight); - elementRectangles["windowRight"] = Rectangle( - ClientRectangle.Width - frameThickness, captionHeight, - frameThickness, heightMinusFrame - captionHeight); - - // Calculate the window button rectangle and add it - // to the Dictionary of rectangles. - elementRectangles["windowClose"] = - Rectangle(ClientRectangle.Right + - closeButtonOffset.X - closeButtonSize.Width - frameThickness, closeButtonOffset.Y, - closeButtonSize.Width, closeButtonSize.Height); - - // Calculate the status bar rectangles and add them - // to the Dictionary of rectangles. - elementRectangles["statusBar"] = - Rectangle(frameThickness, - heightMinusFrame - statusHeight, - ClientRectangle.Width - (2 * frameThickness), - statusHeight); - elementRectangles["statusGripper"] = - Rectangle(ClientRectangle.Right - - gripperSize.Width - frameThickness, - heightMinusFrame - gripperSize.Height, - gripperSize.Width, gripperSize.Height); - } - - // - protected: - virtual void OnPaint(PaintEventArgs^ e) override - { - __super::OnPaint(e); - - // Ensure that visual styles are supported. - if (!Application::RenderWithVisualStyles) - { - this->Text = "Visual styles are not enabled."; - TextRenderer::DrawText(e->Graphics, this->Text, - this->Font, this->Location, this->ForeColor); - return; - } - - // Set the clip region to define the curved corners - // of the caption. - SetClipRegion(); - - // Draw each part of the window. - for each(KeyValuePair^ entry - in windowElements) - { - if (SetRenderer(entry->Value)) - { - renderer->DrawBackground(e->Graphics, - elementRectangles[entry->Key]); - } - } - - // Draw the caption text. - TextRenderer::DrawText(e->Graphics, this->Text, this->Font, - elementRectangles["windowCaption"], Color::White, - TextFormatFlags::VerticalCenter | - TextFormatFlags::HorizontalCenter); - } - // -private: - // Initiate dragging, resizing, or closing the imitation window. - void ImitationWindow_MouseDown(Object^ sender, MouseEventArgs^ e) - { - // The user clicked the close button. - if (elementRectangles["windowClose"].Contains(e->Location)) - { - windowElements["windowClose"] = - VisualStyleElement::Window::CloseButton::Pressed; - isClosing = true; - } - - // The user clicked the status grip. - else if (elementRectangles["statusGripper"].Contains(e->Location)) - { - isResizing = true; - this->Cursor = Cursors::SizeNWSE; - resizeOffset.X = this->Right - this->Left - e->X; - resizeOffset.Y = this->Bottom - this->Top - e->Y; - } - - // The user clicked the window caption. - else if (elementRectangles["windowCaption"].Contains(e->Location)) - { - isMoving = true; - originalClick.X = e->X; - originalClick.Y = e->Y; - } - - Invalidate(); - } - - // Stop any current resizing or moving actions. - void ImitationWindow_MouseUp(Object^ sender, MouseEventArgs^ e) - { - // Stop moving the location of the window rectangles. - if (isMoving) - { - isMoving = false; - } - - // Change the cursor back to the default if the user - // stops resizing. - else if (isResizing) - { - isResizing = false; - } - - // Close the application if the user clicks the - // close button. - else if (elementRectangles["windowClose"].Contains(e->Location) - && isClosing) - { - Application::Exit(); - } - } - - // Handle resizing or moving actions. - void ImitationWindow_MouseMove(Object^ sender, - MouseEventArgs^ e) - { - // The left mouse button is down. - if ((::MouseButtons::Left & e->Button) == ::MouseButtons::Left) - { - // Calculate the new control size if the user is - // dragging the resizing grip. - if (isResizing) - { - this->Width = e->X + resizeOffset.X; - this->Height = e->Y + resizeOffset.Y; - CalculateRectangles(); - } - - // Calculate the new location of the control if the - // user is dragging the window caption. - else if (isMoving) - { - int XChange = this->Location.X + (e->X - originalClick.X); - int YChange = this->Location.Y + (e->Y - originalClick.Y); - this->Location = Point(XChange, YChange); - } - - // Cancel the closing action if the user clicked - // and held down on the close button, and has dragged - // the pointer outside the button. - else if (!elementRectangles["windowClose"].Contains( - e->Location) && isClosing) - { - isClosing = false; - windowElements["windowClose"] = - VisualStyleElement::Window::CloseButton::Normal; - } - } - - // The left mouse button is not down. - else - { - // Paint the close button hot if the cursor is on it. - Rectangle^ closeRectangle = - elementRectangles["windowClose"]; - if (closeRectangle->Contains(e->Location)) - { - windowElements["windowClose"] = - VisualStyleElement::Window::CloseButton::Hot; - } - else - { - windowElements["windowClose"] = - VisualStyleElement::Window::CloseButton::Normal; - } - - - // Use a resizing cursor if the cursor is on the - // status grip. - Rectangle^ gripRectangle = elementRectangles["statusGripper"]; - if (gripRectangle->Contains(e->Location)) - { - this->Cursor = Cursors::SizeNWSE; - } - else - { - this->Cursor = Cursors::Default; - } - } - - Invalidate(); - } - - // - // Calculate and set the clipping region for the control - // so that the corners of the title bar are rounded. - private: - void SetClipRegion() - { - if (!Application::RenderWithVisualStyles) - { - return; - } - - Graphics^ g = this->CreateGraphics(); - // Get the current region for the window caption. - if (SetRenderer(windowElements["windowCaption"])) - { - System::Drawing::Region^ clipRegion = - renderer->GetBackgroundRegion(g, - elementRectangles["windowCaption"]); - - // Get the client rectangle, but exclude the region - // of the window caption. - int height = (int)clipRegion->GetBounds(g).Height; - System::Drawing::Rectangle nonCaptionRect = Rectangle( - ClientRectangle.X, ClientRectangle.Y + height, - ClientRectangle.Width, ClientRectangle.Height - height); - - // Add the rectangle to the caption region, and - // make this region the form's clipping region. - clipRegion->Union(nonCaptionRect); - this->Region = clipRegion; - } - - } - // - - // - // Set the VisualStyleRenderer to a new element. - private: - bool SetRenderer(VisualStyleElement^ element) - { - if (!VisualStyleRenderer::IsElementDefined(element)) - { - return false; - } - - if (renderer == nullptr) - { - renderer = gcnew VisualStyleRenderer(element); - } - else - { - renderer->SetParameters(element); - } - - return true; - } - // - }; - - public ref class Form1 : public Form - { - public: - Form1() : Form() - { - this->Size = System::Drawing::Size(800, 600); - this->Location = Point(20, 20); - this->BackColor = Color::DarkGray; - WindowSimulation^ ws = gcnew WindowSimulation(); - Controls->Add(ws); - } - - }; -} - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew VisualStyleRendererSample::Form1()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp deleted file mode 100644 index fea4b5ed5a9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp +++ /dev/null @@ -1,96 +0,0 @@ - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::VisualStyles; - -namespace VisualStyleStateSample -{ - public ref class VisualStyleStateForm : public Form - { - Button^ updateButton; - RadioButton^ applyToClient; - RadioButton^ applyToNonClient; - RadioButton^ applyToAll; - RadioButton^ disableStyles; - - public: - VisualStyleStateForm() - { - updateButton = gcnew Button(); - applyToClient = gcnew RadioButton(); - applyToNonClient = gcnew RadioButton(); - applyToAll = gcnew RadioButton(); - disableStyles = gcnew RadioButton(); - - updateButton->AutoSize = true; - updateButton->Location = Point(10, 10); - updateButton->Text = "Update VisualStyleState"; - updateButton->Click += gcnew EventHandler(this, - &VisualStyleStateForm::UpdateButton_Click); - - applyToClient->Location = Point(10, 50); - applyToClient->AutoSize = true; - applyToClient->Text = "Apply styles to client area only"; - - applyToNonClient->Location = Point(10, 70); - applyToNonClient->AutoSize = true; - applyToNonClient->Text = "Apply styles to nonclient area only"; - - applyToAll->Location = Point(10, 90); - applyToAll->AutoSize = true; - applyToAll->Text = "Apply styles to client and nonclient areas"; - - disableStyles->Location = Point(10, 110); - disableStyles->AutoSize = true; - disableStyles->Text = "Disable styles in all areas"; - - this->Text = "VisualStyleState Test"; - this->Controls->AddRange(gcnew array{updateButton, - applyToClient, applyToNonClient, applyToAll, disableStyles}); - } - - // - private: - void UpdateButton_Click(Object^ sender, EventArgs^ e) - { - if (applyToClient->Checked) - { - Application::VisualStyleState = - VisualStyleState::ClientAreaEnabled; - } - else if (applyToNonClient->Checked) - { - Application::VisualStyleState = - VisualStyleState::NonClientAreaEnabled; - } - else if (applyToAll->Checked) - { - Application::VisualStyleState = - VisualStyleState::ClientAndNonClientAreasEnabled; - } - else if (disableStyles->Checked) - { - Application::VisualStyleState = - VisualStyleState::NoneEnabled; - } - - // Repaint the form and all child controls. - this->Invalidate(true); - } - // - }; -} - -[STAThread] -int main() -{ - Application::EnableVisualStyles(); - Application::Run(gcnew VisualStyleStateSample::VisualStyleStateForm()); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp deleted file mode 100644 index c653b994925..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp +++ /dev/null @@ -1,502 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Security::Permissions; - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - { - //This call is required by the Windows Form Designer. - InitializeComponent(); - - //Add any initialization after the InitializeComponent() call - } - - -private: - - //NOTE: The following procedure is required by the Windows Form Designer - //It can be modified using the Windows Form Designer. - //Do not modify it using the code editor. - System::Windows::Forms::MainMenu^ MainMenu1; - System::Windows::Forms::MenuItem^ MenuItemFile; - System::Windows::Forms::MenuItem^ MenuItemFileSaveAs; - System::Windows::Forms::MenuItem^ MenuItemFilePageSetup; - System::Windows::Forms::MenuItem^ MenuItemFilePrint; - System::Windows::Forms::MenuItem^ MenuItemFilePrintPreview; - System::Windows::Forms::MenuItem^ MenuItemFileProperties; - System::Windows::Forms::TextBox^ TextBoxAddress; - System::Windows::Forms::Button^ ButtonGo; - System::Windows::Forms::Button^ backButton; - System::Windows::Forms::Button^ ButtonForward; - System::Windows::Forms::Button^ ButtonStop; - System::Windows::Forms::Button^ ButtonRefresh; - System::Windows::Forms::Button^ ButtonHome; - System::Windows::Forms::Button^ ButtonSearch; - System::Windows::Forms::Panel^ Panel1; - System::Windows::Forms::WebBrowser ^ WebBrowser1; - System::Windows::Forms::StatusBar^ StatusBar1; - System::Windows::Forms::MenuItem^ MenuItem1; - System::Windows::Forms::MenuItem^ MenuItem2; - System::Windows::Forms::Button^ ButtonPrint; - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] - void InitializeComponent() - { - this->MainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->MenuItemFile = gcnew System::Windows::Forms::MenuItem; - this->MenuItemFileSaveAs = gcnew System::Windows::Forms::MenuItem; - this->MenuItem1 = gcnew System::Windows::Forms::MenuItem; - this->MenuItemFilePageSetup = gcnew System::Windows::Forms::MenuItem; - this->MenuItemFilePrint = gcnew System::Windows::Forms::MenuItem; - this->MenuItemFilePrintPreview = gcnew System::Windows::Forms::MenuItem; - this->MenuItem2 = gcnew System::Windows::Forms::MenuItem; - this->MenuItemFileProperties = gcnew System::Windows::Forms::MenuItem; - this->TextBoxAddress = gcnew System::Windows::Forms::TextBox; - this->ButtonGo = gcnew System::Windows::Forms::Button; - this->backButton = gcnew System::Windows::Forms::Button; - this->ButtonForward = gcnew System::Windows::Forms::Button; - this->ButtonStop = gcnew System::Windows::Forms::Button; - this->ButtonRefresh = gcnew System::Windows::Forms::Button; - this->ButtonHome = gcnew System::Windows::Forms::Button; - this->ButtonSearch = gcnew System::Windows::Forms::Button; - this->ButtonPrint = gcnew System::Windows::Forms::Button; - this->Panel1 = gcnew System::Windows::Forms::Panel; - this->WebBrowser1 = gcnew System::Windows::Forms::WebBrowser; - this->StatusBar1 = gcnew System::Windows::Forms::StatusBar; - this->Panel1->SuspendLayout(); - this->SuspendLayout(); - - // - // MainMenu1 - // - array^temp0 = {this->MenuItemFile}; - this->MainMenu1->MenuItems->AddRange( temp0 ); - this->MainMenu1->Name = "MainMenu1"; - - // - // MenuItemFile - // - this->MenuItemFile->Index = 0; - array^temp1 = {this->MenuItemFileSaveAs,this->MenuItem1,this->MenuItemFilePageSetup,this->MenuItemFilePrint,this->MenuItemFilePrintPreview,this->MenuItem2,this->MenuItemFileProperties}; - this->MenuItemFile->MenuItems->AddRange( temp1 ); - this->MenuItemFile->Name = "MenuItemFile"; - this->MenuItemFile->Text = "&File"; - - // - // MenuItemFileSaveAs - // - this->MenuItemFileSaveAs->Index = 0; - this->MenuItemFileSaveAs->Name = "MenuItemFileSaveAs"; - this->MenuItemFileSaveAs->Text = " Save &As"; - this->MenuItemFileSaveAs->Click += gcnew System::EventHandler( this, &Form1::MenuItemFileSaveAs_Click ); - - // - // MenuItem1 - // - this->MenuItem1->Index = 1; - this->MenuItem1->Name = "MenuItem1"; - this->MenuItem1->Text = "-"; - - // - // MenuItemFilePageSetup - // - this->MenuItemFilePageSetup->Index = 2; - this->MenuItemFilePageSetup->Name = "MenuItemFilePageSetup"; - this->MenuItemFilePageSetup->Text = "Page Set&up..."; - this->MenuItemFilePageSetup->Click += gcnew System::EventHandler( this, &Form1::MenuItemFilePageSetup_Click ); - - // - // MenuItemFilePrint - // - this->MenuItemFilePrint->Index = 3; - this->MenuItemFilePrint->Name = "MenuItemFilePrint"; - this->MenuItemFilePrint->Text = "&Print..."; - this->MenuItemFilePrint->Click += gcnew System::EventHandler( this, &Form1::MenuItemFilePrint_Click ); - - // - // MenuItemFilePrintPreview - // - this->MenuItemFilePrintPreview->Index = 4; - this->MenuItemFilePrintPreview->Name = "MenuItemFilePrintPreview"; - this->MenuItemFilePrintPreview->Text = "Print Pre&view..."; - this->MenuItemFilePrintPreview->Click += gcnew System::EventHandler( this, &Form1::MenuItemFilePrintPreview_Click ); - - // - // MenuItem2 - // - this->MenuItem2->Index = 5; - this->MenuItem2->Name = "MenuItem2"; - this->MenuItem2->Text = "-"; - - // - // MenuItemFileProperties - // - this->MenuItemFileProperties->Index = 6; - this->MenuItemFileProperties->Name = "MenuItemFileProperties"; - this->MenuItemFileProperties->Text = "P&roperties"; - this->MenuItemFileProperties->Click += gcnew System::EventHandler( this, &Form1::MenuItemFileProperties_Click ); - - // - // TextBoxAddress - // - this->TextBoxAddress->Location = System::Drawing::Point( 0, 0 ); - this->TextBoxAddress->Name = "TextBoxAddress"; - this->TextBoxAddress->Size = System::Drawing::Size( 240, 20 ); - this->TextBoxAddress->TabIndex = 1; - this->TextBoxAddress->Text = ""; - this->TextBoxAddress->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::TextBoxAddress_KeyDown ); - - // - // ButtonGo - // - this->ButtonGo->Location = System::Drawing::Point( 240, 0 ); - this->ButtonGo->Name = "ButtonGo"; - this->ButtonGo->Size = System::Drawing::Size( 48, 24 ); - this->ButtonGo->TabIndex = 2; - this->ButtonGo->Text = "Go"; - this->ButtonGo->Click += gcnew System::EventHandler( this, &Form1::ButtonGo_Click ); - - // - // backButton - // - this->backButton->Location = System::Drawing::Point( 288, 0 ); - this->backButton->Name = "backButton"; - this->backButton->Size = System::Drawing::Size( 48, 24 ); - this->backButton->TabIndex = 3; - this->backButton->Text = "Back"; - this->backButton->Click += gcnew System::EventHandler( this, &Form1::backButton_Click ); - - // - // ButtonForward - // - this->ButtonForward->Location = System::Drawing::Point( 336, 0 ); - this->ButtonForward->Name = "ButtonForward"; - this->ButtonForward->Size = System::Drawing::Size( 48, 24 ); - this->ButtonForward->TabIndex = 4; - this->ButtonForward->Text = "Forward"; - this->ButtonForward->Click += gcnew System::EventHandler( this, &Form1::ButtonForward_Click ); - - // - // ButtonStop - // - this->ButtonStop->Location = System::Drawing::Point( 384, 0 ); - this->ButtonStop->Name = "ButtonStop"; - this->ButtonStop->Size = System::Drawing::Size( 48, 24 ); - this->ButtonStop->TabIndex = 5; - this->ButtonStop->Text = "Stop"; - this->ButtonStop->Click += gcnew System::EventHandler( this, &Form1::ButtonStop_Click ); - - // - // ButtonRefresh - // - this->ButtonRefresh->Location = System::Drawing::Point( 432, 0 ); - this->ButtonRefresh->Name = "ButtonRefresh"; - this->ButtonRefresh->Size = System::Drawing::Size( 48, 24 ); - this->ButtonRefresh->TabIndex = 6; - this->ButtonRefresh->Text = "Refresh"; - this->ButtonRefresh->Click += gcnew System::EventHandler( this, &Form1::ButtonRefresh_Click ); - - // - // ButtonHome - // - this->ButtonHome->Location = System::Drawing::Point( 480, 0 ); - this->ButtonHome->Name = "ButtonHome"; - this->ButtonHome->Size = System::Drawing::Size( 48, 24 ); - this->ButtonHome->TabIndex = 7; - this->ButtonHome->Text = "Home"; - this->ButtonHome->Click += gcnew System::EventHandler( this, &Form1::ButtonHome_Click ); - - // - // ButtonSearch - // - this->ButtonSearch->Location = System::Drawing::Point( 528, 0 ); - this->ButtonSearch->Name = "ButtonSearch"; - this->ButtonSearch->Size = System::Drawing::Size( 48, 24 ); - this->ButtonSearch->TabIndex = 8; - this->ButtonSearch->Text = "Search"; - this->ButtonSearch->Click += gcnew System::EventHandler( this, &Form1::ButtonSearch_Click ); - - // - // ButtonPrint - // - this->ButtonPrint->Location = System::Drawing::Point( 576, 0 ); - this->ButtonPrint->Name = "ButtonPrint"; - this->ButtonPrint->Size = System::Drawing::Size( 48, 24 ); - this->ButtonPrint->TabIndex = 9; - this->ButtonPrint->Text = "Print"; - this->ButtonPrint->Click += gcnew System::EventHandler( this, &Form1::ButtonPrint_Click ); - - // - // Panel1 - // - this->Panel1->Controls->Add( this->ButtonPrint ); - this->Panel1->Controls->Add( this->TextBoxAddress ); - this->Panel1->Controls->Add( this->ButtonGo ); - this->Panel1->Controls->Add( this->backButton ); - this->Panel1->Controls->Add( this->ButtonForward ); - this->Panel1->Controls->Add( this->ButtonStop ); - this->Panel1->Controls->Add( this->ButtonRefresh ); - this->Panel1->Controls->Add( this->ButtonHome ); - this->Panel1->Controls->Add( this->ButtonSearch ); - this->Panel1->Dock = System::Windows::Forms::DockStyle::Top; - this->Panel1->Location = System::Drawing::Point( 0, 0 ); - this->Panel1->Name = "Panel1"; - this->Panel1->Size = System::Drawing::Size( 624, 24 ); - this->Panel1->TabIndex = 11; - - // - // WebBrowser1 - // - // - this->WebBrowser1->AllowWebBrowserDrop = false; - this->WebBrowser1->ScriptErrorsSuppressed = true; - this->WebBrowser1->WebBrowserShortcutsEnabled = false; - this->WebBrowser1->Dock = System::Windows::Forms::DockStyle::Fill; - this->WebBrowser1->IsWebBrowserContextMenuEnabled = false; - - // - this->WebBrowser1->Location = System::Drawing::Point( 0, 24 ); - this->WebBrowser1->Name = "WebBrowser1"; - this->WebBrowser1->Size = System::Drawing::Size( 624, 389 ); - this->WebBrowser1->TabIndex = 10; - this->WebBrowser1->StatusTextChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_StatusTextChanged ); - this->WebBrowser1->CanGoBackChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_CanGoBackChanged ); - this->WebBrowser1->Navigated += gcnew System::Windows::Forms::WebBrowserNavigatedEventHandler( this, &Form1::WebBrowser1_Navigated ); - this->WebBrowser1->CanGoForwardChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_CanGoForwardChanged ); - this->WebBrowser1->DocumentTitleChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_DocumentTitleChanged ); - - // - // StatusBar1 - // - this->StatusBar1->Location = System::Drawing::Point( 0, 413 ); - this->StatusBar1->Name = "StatusBar1"; - this->StatusBar1->Size = System::Drawing::Size( 624, 16 ); - this->StatusBar1->TabIndex = 12; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 624, 429 ); - this->Controls->Add( this->WebBrowser1 ); - this->Controls->Add( this->Panel1 ); - this->Controls->Add( this->StatusBar1 ); - this->Menu = this->MainMenu1; - this->Name = "Form1"; - this->Text = "WebBrowser Example"; - this->Panel1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - -internal: - - static property Form1^ GetInstance - { - Form1^ get() - { - if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) - { - System::Threading::Monitor::Enter( Form1::typeid ); - try - { - if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) - { - m_DefaultInstance = gcnew Form1; - } - } - finally - { - System::Threading::Monitor::Exit( Form1::typeid ); - } - } - - return m_DefaultInstance; - } - } - -private: - static Form1^ m_DefaultInstance; - - // - // Displays the Save dialog box. - void MenuItemFileSaveAs_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->ShowSaveAsDialog(); - } - - // - // - // Displays the Page Setup dialog box. - void MenuItemFilePageSetup_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->ShowPageSetupDialog(); - } - // - - // - // Displays the Print dialog box. - void MenuItemFilePrint_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->ShowPrintDialog(); - } - // - - // - // Displays the Print Preview dialog box. - void MenuItemFilePrintPreview_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->ShowPrintPreviewDialog(); - } - // - - // - // Displays the Properties dialog box. - void MenuItemFileProperties_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->ShowPropertiesDialog(); - } - // - - // - // Navigates to the URL in the address text box when - // the ENTER key is pressed while the text box has focus. - void TextBoxAddress_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) - { - if ( e->KeyCode == System::Windows::Forms::Keys::Enter && !this->TextBoxAddress->Text->Equals( "" ) ) - { - this->WebBrowser1->Navigate( this->TextBoxAddress->Text ); - } - } - - // Navigates to the URL in the address text box when - // the Go button is clicked. - void ButtonGo_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( !this->TextBoxAddress->Text->Equals( "" ) ) - { - this->WebBrowser1->Navigate( this->TextBoxAddress->Text ); - } - } - - // Updates the URL in TextBoxAddress upon navigation. - void WebBrowser1_Navigated( Object^ /*sender*/, System::Windows::Forms::WebBrowserNavigatedEventArgs^ /*e*/ ) - { - this->TextBoxAddress->Text = this->WebBrowser1->Url->ToString(); - } - - // - - // - // Navigates WebBrowser1 to the previous page in the history. - void backButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->GoBack(); - } - - // Disables the Back button at the beginning of the navigation history. - void WebBrowser1_CanGoBackChanged( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->backButton->Enabled = this->WebBrowser1->CanGoBack; - } - // - - // - // Navigates WebBrowser1 to the next page in history. - void ButtonForward_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->GoForward(); - } - - // Disables the Forward button at the end of navigation history. - void WebBrowser1_CanGoForwardChanged( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->ButtonForward->Enabled = this->WebBrowser1->CanGoForward; - } - // - - // - // Halts the current navigation and any sounds or animations on - // the page. - void ButtonStop_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->Stop(); - } - // - - // - // Reloads the current page. - void ButtonRefresh_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Skip refresh if about:blank is loaded to avoid removing - // content specified by the DocumentText property. - if ( !this->WebBrowser1->Url->Equals( "about:blank" ) ) - { - this->WebBrowser1->Refresh(); - } - } - // - - // - // Navigates WebBrowser1 to the home page of the current user. - void ButtonHome_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->GoHome(); - } - // - - // - // Navigates WebBrowser1 to the search page of the current user. - void ButtonSearch_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->GoSearch(); - } - // - - // - // Prints the current document using the current print settings. - void ButtonPrint_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->WebBrowser1->Print(); - } - // - - // - // Updates StatusBar1 with the current browser status text. - void WebBrowser1_StatusTextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->StatusBar1->Text = WebBrowser1->StatusText; - } - // - - // - // Updates the title bar with the current document title. - void WebBrowser1_DocumentTitleChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->Text = WebBrowser1->DocumentTitle; - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - System::Windows::Forms::Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp b/snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp deleted file mode 100644 index 15a5bbaca15..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp +++ /dev/null @@ -1,57 +0,0 @@ -//Types:Microsoft.Win32.SystemEvents -// -#using - -using namespace System; -using namespace Microsoft::Win32; - -// This method is called when a user preference changes. -void SystemEvents_UserPreferenceChanging(Object^ sender, - UserPreferenceChangingEventArgs^ e) - { - Console::WriteLine("The user preference is changing. Category={0}", - e->Category); - } - -// This method is called when the palette changes. -void SystemEvents_PaletteChanged(Object^ sender, EventArgs^ e) -{ - Console::WriteLine("The palette changed."); -} - -// This method is called when the display settings change. -void SystemEvents_DisplaySettingsChanged(Object^ sender, - EventArgs^ e) -{ - Console::WriteLine("The display settings changed."); -} - -// -int main() -{ - // Set the SystemEvents class to receive event notification - // when a user preference changes, the palette changes, or - // when display settings change. - SystemEvents::UserPreferenceChanging += gcnew - UserPreferenceChangingEventHandler( - SystemEvents_UserPreferenceChanging); - SystemEvents::PaletteChanged += gcnew - EventHandler(SystemEvents_PaletteChanged); - SystemEvents::DisplaySettingsChanged += gcnew - EventHandler(SystemEvents_DisplaySettingsChanged); - - // For demonstration purposes, this application sits idle - // waiting for events. - Console::WriteLine("This application is waiting for system events."); - Console::WriteLine("Press to terminate this application."); - Console::ReadLine(); -} -// - -// This code produces the following output. -// -// This app is waiting for system events. -// Press to terminate this application. -// Display Settings changed. -// User preference is changing. Category=General -// diff --git a/snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp b/snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp deleted file mode 100644 index 80114a6ba92..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp +++ /dev/null @@ -1,114 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Reflection; -using namespace System::Windows::Forms; -public ref class SystemInfoBrowserForm: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ListBox^ listBox1; - System::Windows::Forms::TextBox^ textBox1; - -public: - SystemInfoBrowserForm() - { - this->SuspendLayout(); - InitForm(); - - // Add each property of the SystemInformation class to the list box. - Type^ t = System::Windows::Forms::SystemInformation::typeid; - array^pi = t->GetProperties(); - for ( int i = 0; i < pi->Length; i++ ) - listBox1->Items->Add( pi[ i ]->Name ); - textBox1->Text = String::Format( "The SystemInformation class has {0} properties.\r\n", pi->Length ); - - // Configure the list item selected handler for the list box to invoke a - // method that displays the value of each property. - listBox1->SelectedIndexChanged += gcnew EventHandler( this, &SystemInfoBrowserForm::listBox1_SelectedIndexChanged ); - this->ResumeLayout( false ); - } - - -private: - void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Return if no list item is selected. - if ( listBox1->SelectedIndex == -1 ) - return; - - - // Get the property name from the list item. - String^ propname = listBox1->Text; - if ( propname->Equals( "PowerStatus" ) ) - { - - // Cycle and display the values of each property of the PowerStatus property. - textBox1->Text = String::Concat( textBox1->Text, "\r\nThe value of the PowerStatus property is:" ); - Type^ t = System::Windows::Forms::PowerStatus::typeid; - array^pi = t->GetProperties(); - for ( int i = 0; i < pi->Length; i++ ) - { - Object^ propval = pi[ i ]->GetValue( SystemInformation::PowerStatus, nullptr ); - textBox1->Text = String::Format( "{0}\r\n PowerStatus.{1} is: {2}", textBox1->Text, pi[ i ]->Name, propval ); - - } - } - else - { - - // Display the value of the selected property of the SystemInformation type. - Type^ t = System::Windows::Forms::SystemInformation::typeid; - array^pi = t->GetProperties(); - PropertyInfo^ prop = nullptr; - for ( int i = 0; i < pi->Length; i++ ) - if ( pi[ i ]->Name == propname ) - { - prop = pi[ i ]; - break; - } - Object^ propval = prop->GetValue( nullptr, nullptr ); - textBox1->Text = String::Format( "{0}\r\nThe value of the {1} property is: {2}", textBox1->Text, propname, propval ); - } - } - - void InitForm() - { - - // Initialize the form settings - this->listBox1 = gcnew System::Windows::Forms::ListBox; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->listBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->listBox1->Location = System::Drawing::Point( 8, 16 ); - this->listBox1->Size = System::Drawing::Size( 172, 496 ); - this->listBox1->TabIndex = 0; - this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->textBox1->Location = System::Drawing::Point( 188, 16 ); - this->textBox1->Multiline = true; - this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; - this->textBox1->Size = System::Drawing::Size( 420, 496 ); - this->textBox1->TabIndex = 1; - this->ClientSize = System::Drawing::Size( 616, 525 ); - this->Controls->Add( this->textBox1 ); - this->Controls->Add( this->listBox1 ); - this->Text = "Select a SystemInformation property to get the value of"; - } - -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew SystemInfoBrowserForm ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp deleted file mode 100644 index fb1445d0ea6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp +++ /dev/null @@ -1,82 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Media; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::ComponentModel::Container^ components; - -public: - Form1() - { - InitializeComponent(); - } - - void PlayAsterisk() - { - // - // Plays the sound associated with the Asterisk system event. - SystemSounds::Asterisk->Play(); - // - } - - void PlayBeep() - { - // - // Plays the sound associated with the Beep system event. - SystemSounds::Beep->Play(); - // - } - - void PlayExclamation() - { - // - // Plays the sound associated with the Exclamation system event. - SystemSounds::Exclamation->Play(); - // - } - - void PlayHand() - { - // - // Plays the sound associated with the Hand system event. - SystemSounds::Hand->Play(); - // - } - - void PlayQuestion() - { - // - // Plays the sound associated with the Question system event. - SystemSounds::Question->Play(); - // - } - - #pragma region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// -private: - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->Size = System::Drawing::Size( 300, 300 ); - this->Text = "Form1"; - } - #pragma endregion -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp deleted file mode 100644 index a6a2d5b77cd..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - this->tabPage3 = gcnew TabPage; - - // Positions tabs on the left side of tabControl1. - this->tabControl1->Alignment = System::Windows::Forms::TabAlignment::Left; - array^tabControls = {this->tabPage1,this->tabPage2,this->tabPage3}; - this->tabControl1->Controls->AddRange( tabControls ); - this->tabControl1->Location = Point(16,24); - this->tabControl1->SelectedIndex = 0; - this->tabControl1->Size = System::Drawing::Size( 248, 232 ); - this->tabControl1->TabIndex = 0; - this->tabPage1->TabIndex = 0; - this->tabPage2->TabIndex = 1; - this->tabPage3->TabIndex = 2; - this->Size = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp deleted file mode 100644 index bca1364da4c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Resources; -public ref class Form1: public Form -{ -public: - Form1() - { - IContainer^ components = gcnew System::ComponentModel::Container; - ResourceManager^ resources = gcnew ResourceManager( Form1::typeid ); - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - - // Declares and instantiates the ImageList Object*. - ImageList^ myImages = gcnew ImageList( components ); - tabControl1->Controls->Add( tabPage1 ); - - // Sets the images in myImages to display on the tabs of tabControl1. - tabControl1->ImageList = myImages; - tabPage1->ImageIndex = 0; - tabPage1->Text = "tabPage1"; - - // Gets the handle that provides the data of myImages. - myImages->ImageStream = (dynamic_cast(resources->GetObject( "myImages.ImageStream" ))); - - // Sets properties of myImages. - myImages->ColorDepth = ColorDepth::Depth8Bit; - myImages->ImageSize = System::Drawing::Size( 16, 16 ); - myImages->TransparentColor = Color::Transparent; - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp deleted file mode 100644 index 8b15def2d53..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp +++ /dev/null @@ -1,42 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - -public: - void MyTabs() - { - - // Invokes the TabControl() constructor to create the tabControl1 object. - this->tabControl1 = gcnew System::Windows::Forms::TabControl; - - // Creates a new tab page and adds it to the tab control - this->tabPage1 = gcnew TabPage; - this->tabControl1->TabPages->Add( tabPage1 ); - - // Adds the tab control to the form - this->Controls->Add( tabControl1 ); - } - - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp deleted file mode 100644 index 85d5d733a03..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -public: - Form1() - { - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - TabPage^ tabPage2 = gcnew TabPage; - TabPage^ tabPage3 = gcnew TabPage; - TabPage^ tabPage4 = gcnew TabPage; - TabPage^ tabPage5 = gcnew TabPage; - Label^ label1 = gcnew Label; - tabControl1->Multiline = true; - tabControl1->SizeMode = TabSizeMode::FillToRight; - tabControl1->Padding = Point(15,5); - array^tabControls = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; - tabControl1->Controls->AddRange( tabControls ); - tabControl1->Location = Point(35,65); - tabControl1->Size = System::Drawing::Size( 220, 180 ); - - // Gets the number of tabs currently in the tabControl1 tab strip. - // Assigns int value to the tabsInTabStrip variable. - int tabsInTabStrip = tabControl1->TabCount; - label1->Text = System::String::Concat( "There are ", tabsInTabStrip, " tabs in the tabControl1 tab strip." ); - label1->Location = Point(35,25); - label1->Size = System::Drawing::Size( 220, 30 ); - Size = System::Drawing::Size( 300, 300 ); - array^formControls = {label1,tabControl1}; - Controls->AddRange( formControls ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp deleted file mode 100644 index b5080576b9d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Resources; -public ref class Form1: public Form -{ -public: - Form1() - { - IContainer^ components = gcnew System::ComponentModel::Container; - ResourceManager^ resources = gcnew ResourceManager( Form1::typeid ); - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - ImageList^ myImages = gcnew ImageList( components ); - tabControl1->Controls->Add( tabPage1 ); - - // Displays images from myImages on the tabs of tabControl1. - tabControl1->ImageList = myImages; - - // Specifies which image to display (on the tab of tabPage1) by its index. - tabPage1->ImageIndex = 0; - tabPage1->Text = "tabPage1"; - myImages->ImageStream = (dynamic_cast(resources->GetObject( "myImages.ImageStream" ))); - myImages->ColorDepth = ColorDepth::Depth8Bit; - myImages->ImageSize = System::Drawing::Size( 16, 16 ); - myImages->TransparentColor = Color::Transparent; - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp deleted file mode 100644 index 999f6192095..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabControl1->Controls->Add( tabPage1 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->tabControl1->ShowToolTips = true; - this->tabPage1->Text = "myTabPage1"; - - // Creates a string showing the Text value for tabPage1. - // Then assigns the string to ToolTipText. - this->tabPage1->ToolTipText = tabPage1->ToString(); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp deleted file mode 100644 index 1a05c97e2e4..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp +++ /dev/null @@ -1,46 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - - // Declares tabPage1 as a TabPage type. - System::Windows::Forms::TabPage^ tabPage1; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - - // Invokes the TabPage() constructor to create the tabPage1. - this->tabPage1 = gcnew System::Windows::Forms::TabPage; - array^tabControls = {this->tabPage1}; - this->tabControl1->Controls->AddRange( tabControls ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp deleted file mode 100644 index bb689f3bdd7..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - - // Gets the controls collection for tabControl1. - // Adds the tabPage1 to this collection. - this->tabControl1->TabPages->Add( tabPage1 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp deleted file mode 100644 index f1e7672f1af..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - this->tabPage3 = gcnew TabPage; - array^tabPages = {tabPage1,tabPage2,tabPage3}; - - // Gets the controls collection for tabControl1. - // Adds an array of tab pages to this collection. - this->tabControl1->Controls->AddRange( tabPages ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp deleted file mode 100644 index 19d6d688d7d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage( "tabPage1" ); - this->tabPage2 = gcnew TabPage( "tabPage2" ); - this->tabPage3 = gcnew TabPage( "tabPage3" ); - - // Populates the tabControl1 with three tab pages. - array^tabPages = {tabPage1,tabPage2,tabPage3}; - this->tabControl1->TabPages->AddRange( tabPages ); - - // Removes all the tab pages from tabControl1. - this->tabControl1->TabPages->Clear(); - - // Adds the tabPage1 back to tabControl1. - this->tabControl1->TabPages->Add( tabPage2 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp deleted file mode 100644 index 08971375d11..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - array^tabText = {"tabPage1","tabPage2","tabPage3"}; - this->tabPage1 = gcnew TabPage( tabText[ 0 ]->ToString() ); - this->tabPage2 = gcnew TabPage( tabText[ 1 ]->ToString() ); - this->tabPage3 = gcnew TabPage( tabText[ 2 ]->ToString() ); - - // Populates the tabControl1 with two tab pages. - array^tabPages = {tabPage1,tabPage2}; - this->tabControl1->TabPages->AddRange( tabPages ); - - // Checks the tabControl1 controls collection for tabPage3. - // Adds tabPage3 to tabControl1 if it is not in the collection. - if ( !tabControl1->TabPages->Contains( tabPage3 ) ) - this->tabControl1->TabPages->Add( tabPage3 ); - - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp deleted file mode 100644 index fc5497e6a60..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - Label^ label1; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - this->tabPage3 = gcnew TabPage; - this->label1 = gcnew Label; - array^tabPages = {tabPage1,tabPage2,tabPage3}; - this->tabControl1->TabPages->AddRange( tabPages ); - this->tabControl1->Location = Point(25,75); - this->tabControl1->Size = System::Drawing::Size( 250, 200 ); - - // Gets the number of TabPage objects in the tabControl1 controls collection. - int tabCount = tabControl1->TabPages->Count; - this->label1->Location = Point(25,25); - this->label1->Size = System::Drawing::Size( 250, 25 ); - this->label1->Text = System::String::Concat( "The TabControl below has ", tabCount, " TabPage objects in its controls collection." ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - array^formControls = {tabControl1,label1}; - this->Controls->AddRange( formControls ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp deleted file mode 100644 index c55a6f25629..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp +++ /dev/null @@ -1,40 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage( "myTabPage" ); - this->tabControl1->TabPages->Add( tabPage1 ); - this->tabControl1->ShowToolTips = true; - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->tabPage1->ToolTipText = System::String::Concat( "TabIndex = ", (tabControl1->TabPages->IndexOf( tabPage1 )).ToString() ); - - // Gets the tabPage1 TabIndex value from the tabControl1 controls collection. - // Converts the tabPage1 TabIndex value to a string. - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp deleted file mode 100644 index 84935312288..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp +++ /dev/null @@ -1,44 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -public: - Form1() - { - TabControl^ tabControl1 = gcnew TabControl; - TabPage^ tabPage1 = gcnew TabPage; - TabPage^ tabPage2 = gcnew TabPage; - Label^ label1 = gcnew Label; - - // Determines if the tabControl1 controls collection is read-only. - if (tabControl1->TabPages->IsReadOnly) - label1->Text = "The tabControl1 controls collection is read-only."; - else - label1->Text = "The tabControl1 controls collection is not read-only."; - - array^tabPages = {tabPage1,tabPage2}; - tabControl1->TabPages->AddRange( tabPages ); - tabControl1->Location = Point(25,75); - tabControl1->Size = System::Drawing::Size( 250, 200 ); - label1->Location = Point(25,25); - label1->Size = System::Drawing::Size( 250, 25 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - array^formControls = {tabControl1,label1}; - this->Controls->AddRange( formControls ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp deleted file mode 100644 index b7e12f0646f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp +++ /dev/null @@ -1,47 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - array^tabText = {"tabPage1","tabPage2","tabPage3"}; - this->tabPage1 = gcnew TabPage( tabText[ 0 ]->ToString() ); - this->tabPage2 = gcnew TabPage( tabText[ 1 ]->ToString() ); - this->tabPage3 = gcnew TabPage( tabText[ 2 ]->ToString() ); - - // Populates the tabControl1 with three tab pages. - array^tabPages = {tabPage1,tabPage2,tabPage3}; - this->tabControl1->TabPages->AddRange( tabPages ); - - // Gets the tabControl1 controls collection. - // Removes the tabPage2 from the collection. - this->tabControl1->TabPages->Remove( tabPage2 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp deleted file mode 100644 index c9a301cdb06..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - TabPage^ tabPage3; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - array^tabText = {"tabPage1","tabPage2","tabPage3"}; - this->tabPage1 = gcnew TabPage( tabText[ 0 ]->ToString() ); - this->tabPage2 = gcnew TabPage( tabText[ 1 ]->ToString() ); - this->tabPage3 = gcnew TabPage( tabText[ 2 ]->ToString() ); - - // Populates the tabControl1 with three tab pages. - array^tabPages = {tabPage1,tabPage2,tabPage3}; - this->tabControl1->TabPages->AddRange( tabPages ); - - // Assigns TabIndex values to tab pages. - this->tabPage1->TabIndex = 0; - this->tabPage2->TabIndex = 1; - this->tabPage3->TabIndex = 2; - - // Gets the tabControl1 controls collection. - // Removes the tabPage1 by its TabIndex. - this->tabControl1->TabPages->RemoveAt( 0 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp deleted file mode 100644 index 21a4a330da5..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - Button^ button1; - -public: - Form1() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->button1 = gcnew Button; - this->tabControl1->TabPages->Add( tabPage1 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - - // Gets the controls collection for tabPage1. - // Adds button1 to this collection. - this->tabPage1->Controls->Add( button1 ); - this->button1->Text = "button1"; - this->button1->Location = Point(25,25); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp deleted file mode 100644 index 9cc28774492..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp +++ /dev/null @@ -1,38 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - -public: - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - - // Invokes the TabPage() constructor to create the tabPage1. - this->tabPage1 = gcnew System::Windows::Forms::TabPage; - this->tabControl1->Controls->Add( tabPage1 ); - this->Controls->Add( tabControl1 ); - } - - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp deleted file mode 100644 index 07a69dfa40c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp +++ /dev/null @@ -1,43 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - System::String^ tabPageName = "myTabPage"; - - // Constructs a TabPage with a TabPage::Text value. - this->tabPage1 = gcnew TabPage( tabPageName ); - this->tabControl1->Controls->Add( tabPage1 ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - this->ClientSize = System::Drawing::Size( 300, 300 ); - this->Controls->Add( tabControl1 ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp deleted file mode 100644 index 4457ee09e07..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - array^tabControl1Controls = {this->tabPage1}; - this->tabControl1->Controls->AddRange( tabControl1Controls ); - this->tabControl1->Location = Point(25,25); - this->tabControl1->Size = System::Drawing::Size( 250, 250 ); - - // Displays a string, myTabPage, on tabPage1. - this->tabPage1->Text = "myTabPage"; - this->ClientSize = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp deleted file mode 100644 index 464ae4ea198..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp +++ /dev/null @@ -1,141 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::TextBox^ textBox2; - System::Windows::Forms::Button^ button1; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - -public: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->textBox2 = gcnew System::Windows::Forms::TextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 24, 24 ); - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 144, 20 ); - this->textBox1->TabIndex = 0; - this->textBox1->Text = "textBox1"; - - // - // textBox2 - // - this->textBox2->Location = System::Drawing::Point( 24, 56 ); - this->textBox2->Name = "textBox2"; - this->textBox2->Size = System::Drawing::Size( 144, 20 ); - this->textBox2->TabIndex = 1; - this->textBox2->Text = "textBox2"; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 208, 40 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 2; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 266 ); - array^temp0 = {this->button1,this->textBox2,this->textBox1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - AppendTextBox1Text(); - } - - // - void AppendTextBox1Text() - { - // Determine if text is selected in textBox1. - if ( textBox1->SelectionLength == 0 ) - - // No selection made, return. - return; - - // Determine if the text being appended to textBox2 exceeds the MaxLength property. - if ( (textBox1->SelectedText->Length + textBox2->TextLength) > textBox2->MaxLength ) - MessageBox::Show( "The text to paste in is larger than the maximum number of characters allowed" ); // Append the text from textBox1 into textBox2. - else - textBox2->AppendText( textBox1->SelectedText ); - } - // -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp deleted file mode 100644 index e04d617e445..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp +++ /dev/null @@ -1,226 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class MyToolBar: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::ToolBar^ toolBar1; - System::Windows::Forms::ImageList^ imageList1; - System::Windows::Forms::ToolBarButton^ toolBarButton1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::TextBox^ textBox1; - System::ComponentModel::IContainer^ components; - System::Windows::Forms::ContextMenu^ contextMenu1; - MenuItem^ menuItem1; - MenuItem^ menuItem2; - -public: - MyToolBar() - { - InitializeComponent(); - this->AddToolBar(); - } - - -public: - ~MyToolBar() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - this->imageList1 = gcnew System::Windows::Forms::ImageList( this->components ); - this->imageList1->Images->Add( Image::FromFile( "c:\\copy.bmp" ) ); - this->imageList1->Images->Add( Image::FromFile( "c:\\button.bmp" ) ); - this->imageList1->Images->Add( Image::FromFile( "c:\\camera.bmp" ) ); - - // System::Resources::ResourceManager* resources = new System::Resources::ResourceManager(__typeof(MyToolBar)); - // this->imageList1 = new System::Windows::Forms::ImageList(this->components); - this->toolBarButton1 = gcnew System::Windows::Forms::ToolBarButton; - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->menuItem1 = gcnew MenuItem( "Clear" ); - this->menuItem2 = gcnew MenuItem( "Test" ); - array^menuItems = {menuItem1,menuItem2}; - this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu( menuItems ); - this->SuspendLayout(); - - // - // imageList1 - // - this->imageList1->ColorDepth = System::Windows::Forms::ColorDepth::Depth8Bit; - this->imageList1->ImageSize = System::Drawing::Size( 16, 16 ); - - //this->imageList1.ImageStream = ((System::Windows::Forms::ImageListStreamer)(resources.GetObject(S"imageList1.ImageStream"))); - this->imageList1->TransparentColor = System::Drawing::Color::Transparent; - - // - // toolBarButton1 - // - this->toolBarButton1->ImageIndex = 0; - this->toolBarButton1->Style = System::Windows::Forms::ToolBarButtonStyle::DropDownButton; - this->toolBarButton1->DropDownMenu = this->contextMenu1; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 24, 192 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &MyToolBar::button1_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 136, 200 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 2; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &MyToolBar::button2_Click ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 96, 144 ); - this->textBox1->Name = "textBox1"; - this->textBox1->TabIndex = 3; - this->textBox1->Text = "textBox1"; - - // - // MyToolBar - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^formControls = {this->textBox1,this->button2,this->button1}; - this->Controls->AddRange( formControls ); - this->Name = "MyToolBar"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - - // - void AddToolBar() - { - - // Add a toolbar and set some of its properties. - toolBar1 = gcnew ToolBar; - toolBar1->Appearance = System::Windows::Forms::ToolBarAppearance::Flat; - toolBar1->BorderStyle = System::Windows::Forms::BorderStyle::None; - toolBar1->Buttons->Add( this->toolBarButton1 ); - toolBar1->ButtonSize = System::Drawing::Size( 24, 24 ); - toolBar1->Divider = true; - toolBar1->DropDownArrows = true; - toolBar1->ImageList = this->imageList1; - toolBar1->ShowToolTips = true; - toolBar1->Size = System::Drawing::Size( 292, 25 ); - toolBar1->TabIndex = 0; - toolBar1->TextAlign = System::Windows::Forms::ToolBarTextAlign::Right; - toolBar1->Wrappable = false; - - // Add handlers for the ButtonClick and ButtonDropDown events. - toolBar1->ButtonDropDown += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonDropDown ); - toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonClicked ); - - // Add the toolbar to the form. - this->Controls->Add( toolBar1 ); - } - // - - // - void AddToolbarButtons( ToolBar^ toolBar ) - { - if ( !toolBar->Buttons->IsReadOnly ) - { - - // If toolBarButton1 in in the collection, remove it. - if ( toolBar->Buttons->Contains( toolBarButton1 ) ) - { - toolBar->Buttons->Remove( toolBarButton1 ); - } - - // Create three toolbar buttons. - ToolBarButton^ tbb1 = gcnew ToolBarButton( "tbb1" ); - ToolBarButton^ tbb2 = gcnew ToolBarButton( "tbb2" ); - ToolBarButton^ tbb3 = gcnew ToolBarButton( "tbb3" ); - - // Add toolbar buttons to the toolbar. - array^buttons = {tbb2,tbb3}; - toolBar->Buttons->AddRange( buttons ); - toolBar->Buttons->Add( "tbb4" ); - - // Insert tbb1 into the first position in the collection. - toolBar->Buttons->Insert( 0, tbb1 ); - } - } - // - - // - String^ GetButtonList( ToolBar^ toolBar ) - { - String^ buttonList = "ToolBarButtons: "; - IEnumerator^ x = toolBar->Buttons->GetEnumerator(); - - // Enumerate through the collection of toolbar buttons. - while ( x->MoveNext() ) - { - buttonList = String::Concat( buttonList, (dynamic_cast(x->Current))->Text, " " ); - } - - return buttonList; - } - // - - // - void toolBar1_ButtonDropDown( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ /*e*/ ) - { - - // If the text box is disabled, disable the menu item. - if ( !textBox1->Enabled ) - { - contextMenu1->MenuItems[ this->contextMenu1->MenuItems->IndexOf( menuItem1 ) ]->Enabled = false; - } - } - - void toolBar1_ButtonClicked( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ /*e*/ ) - { - - // Disable the text box. - textBox1->Enabled = false; - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - AddToolbarButtons( this->toolBar1 ); - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( this->GetButtonList( toolBar1 ) ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyToolBar ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp deleted file mode 100644 index ea8585ea7a2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::CheckBox^ checkBox1; - System::Windows::Forms::Button^ button1; - -public: - /// - /// Required designer variable. - /// - Form1() - { - // - // Required for Windows Form Designer support - // - InitializeComponent(); - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -private: - /// - /// Clean up any resources being used. - /// - - #pragma region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->checkBox1 = gcnew System::Windows::Forms::CheckBox; - this->SuspendLayout(); - // - // button1 - // - this->button1->Location = System::Drawing::Point( 200, 20 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 84, 24 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - // - // checkBox1 - // - this->checkBox1->Location = System::Drawing::Point( 204, 60 ); - this->checkBox1->Name = "checkBox1"; - this->checkBox1->TabIndex = 0; - this->checkBox1->Text = "checkBox1"; - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^ temp0 = { this->button1, this->checkBox1 }; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - #pragma endregion - - // - // This example assumes that the Form_Load event handling method - // is connected to the Load event of the form. - void Form1_Load( Object^ sender, System::EventArgs^ e ) - { - // Create the ToolTip and associate with the Form container. - ToolTip^ toolTip1 = gcnew ToolTip; - - // Set up the delays for the ToolTip. - toolTip1->AutoPopDelay = 5000; - toolTip1->InitialDelay = 1000; - toolTip1->ReshowDelay = 500; - // Force the ToolTip text to be displayed whether or not the form is active. - toolTip1->ShowAlways = true; - - // Set up the ToolTip text for the Button and Checkbox. - toolTip1->SetToolTip( this->button1, "My button1" ); - toolTip1->SetToolTip( this->checkBox1, "My checkBox1" ); - } - // -}; - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp deleted file mode 100644 index 196dceb1e43..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -#using -#using -#using - -// -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TabControl^ tabControl1; - TabPage^ tabPage1; - TabPage^ tabPage2; - void MyTabs() - { - this->tabControl1 = gcnew TabControl; - this->tabPage1 = gcnew TabPage; - this->tabPage2 = gcnew TabPage; - array^tabPages = {this->tabPage1,this->tabPage2}; - this->tabControl1->Controls->AddRange( tabPages ); - this->tabControl1->Location = Point(35,25); - this->tabControl1->Size = System::Drawing::Size( 220, 220 ); - - // Shows ToolTipText when the mouse passes over tabs. - this->tabControl1->ShowToolTips = true; - - // Assigns String* values to ToolTipText. - this->tabPage1->ToolTipText = "myTabPage1"; - this->tabPage2->ToolTipText = "myTabPage2"; - this->Size = System::Drawing::Size( 300, 300 ); - array^formControls = {this->tabControl1}; - this->Controls->AddRange( formControls ); - } - - -public: - Form1() - { - MyTabs(); - } - -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp deleted file mode 100644 index 14653b4874e..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp +++ /dev/null @@ -1,168 +0,0 @@ -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Security::Permissions; - -namespace TextDataTextBoxComponent -{ - // Custom toolbox item creates a TextBox and sets its Text property - // to the constructor-specified text. - [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] - public ref class TextToolboxItem: public ToolboxItem - { - private: - String^ text; - delegate void SetTextMethodHandler( Control^ c, String^ text ); - - public: - TextToolboxItem( String^ text ) - : ToolboxItem() - { - this->text = text; - } - - protected: - - // ToolboxItem::CreateComponentsCore to create the TextBox - // and link a method to set its Text property. - - virtual array^ CreateComponentsCore( IDesignerHost^ host ) override - { - TextBox^ textbox = dynamic_cast(host->CreateComponent( TextBox::typeid )); - - // Because the designer resets the text of the textbox, use - // a SetTextMethodHandler to set the text to the value of - // the text data. - Control^ c = dynamic_cast(host->RootComponent); - array^temp0 = {textbox,text}; - c->BeginInvoke( gcnew SetTextMethodHandler( this, &TextToolboxItem::OnSetText ), temp0 ); - array^temp1 = {textbox}; - return temp1; - } - - private: - - // Method to set the text property of a TextBox after it is initialized. - void OnSetText( Control^ c, String^ text ) - { - c->Text = text; - } - - }; - - - // Component that adds a "Text" data format ToolboxItemCreatorCallback - // to the Toolbox. This component uses a custom ToolboxItem that - // creates a TextBox containing the text data. - public ref class TextDataTextBoxComponent: public Component - { - private: - bool creatorAdded; - IToolboxService^ ts; - - public: - TextDataTextBoxComponent() - { - creatorAdded = false; - } - - - property System::ComponentModel::ISite^ Site - { - // ISite to register TextBox creator - virtual System::ComponentModel::ISite^ get() override - { - return __super::Site; - } - - virtual void set( System::ComponentModel::ISite^ value ) override - { - if ( value != nullptr ) - { - __super::Site = value; - if ( !creatorAdded ) - AddTextTextBoxCreator(); - } - else - { - if ( creatorAdded ) - RemoveTextTextBoxCreator(); - __super::Site = value; - } - } - } - - private: - - // Adds a "Text" data format creator to the toolbox that creates - // a textbox from a text fragment pasted to the toolbox. - void AddTextTextBoxCreator() - { - ts = dynamic_cast(GetService( IToolboxService::typeid )); - if ( ts != nullptr ) - { - ToolboxItemCreatorCallback^ textCreator = - gcnew ToolboxItemCreatorCallback( - this, - &TextDataTextBoxComponent::CreateTextBoxForText ); - try - { - ts->AddCreator( - textCreator, - "Text", - dynamic_cast(GetService( IDesignerHost::typeid )) ); - creatorAdded = true; - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->ToString(), "Exception Information" ); - } - } - } - - - // Removes any "Text" data format creator from the toolbox. - void RemoveTextTextBoxCreator() - { - if ( ts != nullptr ) - { - ts->RemoveCreator( - "Text", - dynamic_cast(GetService( IDesignerHost::typeid )) ); - creatorAdded = false; - } - } - - - // ToolboxItemCreatorCallback delegate format method to create - // the toolbox item. - ToolboxItem^ CreateTextBoxForText( Object^ serializedObject, String^ format ) - { - IDataObject^ o = gcnew DataObject(dynamic_cast(serializedObject)); - - if( o->GetDataPresent("System::String", true) ) - { - String^ toolboxText = dynamic_cast(o->GetData( "System::String", true )); - return( gcnew TextToolboxItem( toolboxText )); - } - - return nullptr; - } - - public: - ~TextDataTextBoxComponent() - { - if ( creatorAdded ) - RemoveTextTextBoxCreator(); - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp deleted file mode 100644 index 7a4d21396ba..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp +++ /dev/null @@ -1,54 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; - -[STAThread] -int main() -{ - - // - // Create a new ToolboxItemCollection using a ToolboxItem array. - array^temp0 = {gcnew ToolboxItem( System::Windows::Forms::Label::typeid ),gcnew ToolboxItem( System::Windows::Forms::TextBox::typeid )}; - ToolboxItemCollection^ collection = gcnew ToolboxItemCollection( temp0 ); - // - - // - // Create a new ToolboxItemCollection using an existing ToolboxItemCollection. - ToolboxItemCollection^ coll = gcnew ToolboxItemCollection( collection ); - // - - // - // Get the number of items in the collection. - int collectionLength = collection->Count; - // - - // - // Get the ToolboxItem at each index. - ToolboxItem^ item = nullptr; - for ( int index = 0; index < collection->Count; index++ ) - item = collection[ index ]; - // - - // - // If the collection contains the specified ToolboxItem, - // retrieve the collection index of the specified item. - int indx = -1; - if ( collection->Contains( item ) ) - indx = collection->IndexOf( item ); - // - - // - // Copy the ToolboxItemCollection to the specified array. - array^items = gcnew array(collection->Count); - collection->CopyTo( items, 0 ); - // -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp deleted file mode 100644 index 433d0cfab0c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp +++ /dev/null @@ -1,197 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Panel^ panel1; - System::Windows::Forms::TrackBar^ trackBar1; - System::Windows::Forms::TrackBar^ trackBar2; - System::Windows::Forms::TrackBar^ trackBar3; - System::Windows::Forms::Label ^ label1; - System::Windows::Forms::Label ^ label3; - System::Windows::Forms::Label ^ label2; - -public: - - /// - /// Required designer variable. - /// - Form1() - { - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - // - trackBar2->Orientation = Orientation::Vertical; - trackBar3->Orientation = Orientation::Vertical; - trackBar1->Maximum = 255; - trackBar2->Maximum = 255; - trackBar3->Maximum = 255; - trackBar1->Width = 400; - trackBar2->Height = trackBar1->Width; - trackBar3->Height = trackBar1->Width; - trackBar1->LargeChange = 16; - trackBar2->LargeChange = 16; - trackBar3->LargeChange = 16; - - // - } - - -private: - - /// - /// Clean up any resources being used. - /// - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->trackBar1 = gcnew System::Windows::Forms::TrackBar; - this->trackBar2 = gcnew System::Windows::Forms::TrackBar; - this->trackBar3 = gcnew System::Windows::Forms::TrackBar; - this->panel1 = gcnew System::Windows::Forms::Panel; - this->label1 = gcnew System::Windows::Forms::Label; - this->label2 = gcnew System::Windows::Forms::Label; - this->label3 = gcnew System::Windows::Forms::Label; - - // - (dynamic_cast(this->trackBar1))->BeginInit(); - (dynamic_cast(this->trackBar2))->BeginInit(); - (dynamic_cast(this->trackBar3))->BeginInit(); - this->SuspendLayout(); - - // - // trackBar1 - // - this->trackBar1->Location = System::Drawing::Point( 160, 400 ); - this->trackBar1->Name = "trackBar1"; - this->trackBar1->TabIndex = 1; - this->trackBar1->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll ); - - // - // trackBar2 - // - this->trackBar2->Location = System::Drawing::Point( 608, 40 ); - this->trackBar2->Name = "trackBar2"; - this->trackBar2->TabIndex = 2; - this->trackBar2->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll ); - - // - // trackBar3 - // - this->trackBar3->Location = System::Drawing::Point( 56, 40 ); - this->trackBar3->Name = "trackBar3"; - this->trackBar3->TabIndex = 3; - this->trackBar3->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll ); - (dynamic_cast(this->trackBar1))->EndInit(); - (dynamic_cast(this->trackBar2))->EndInit(); - (dynamic_cast(this->trackBar3))->EndInit(); - - // - // - // panel1 - // - this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - this->panel1->Location = System::Drawing::Point( 128, 32 ); - this->panel1->Name = "panel1"; - this->panel1->Size = System::Drawing::Size( 464, 352 ); - this->panel1->TabIndex = 0; - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 288, 448 ); - this->label1->Name = "label1"; - this->label1->TabIndex = 4; - - // - // label2 - // - this->label2->Location = System::Drawing::Point( 600, 16 ); - this->label2->Name = "label2"; - this->label2->Size = System::Drawing::Size( 120, 16 ); - this->label2->TabIndex = 5; - - // - // label3 - // - this->label3->Location = System::Drawing::Point( 8, 16 ); - this->label3->Name = "label3"; - this->label3->Size = System::Drawing::Size( 120, 16 ); - this->label3->TabIndex = 6; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 728, 477 ); - array^temp1 = {this->label3,this->label2,this->label1,this->trackBar3,this->trackBar2,this->trackBar1,this->panel1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Color builder"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - showColorValueLabels(); - } - - - // - void showColorValueLabels() - { - label1->Text = String::Format( "Red value is : {0}", trackBar1->Value ); - label2->Text = String::Format( "Green Value is : {0}", trackBar2->Value ); - label3->Text = String::Format( "Blue Value is : {0}", trackBar3->Value ); - } - - void trackBar_Scroll( Object^ sender, System::EventArgs^ /*e*/ ) - { - System::Windows::Forms::TrackBar^ myTB; - myTB = dynamic_cast(sender); - panel1->BackColor = Color::FromArgb( trackBar1->Value, trackBar2->Value, trackBar3->Value ); - myTB->Text = String::Format( "Value is {0}", myTB->Value ); - showColorValueLabels(); - } - - // -}; - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp deleted file mode 100644 index e10643d43d3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp +++ /dev/null @@ -1,176 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ToolBarStuff -{ - /// - /// Summary description for Form1. - /// - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::TreeView^ treeView2; - System::Windows::Forms::Button^ button2; - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - - - protected: - /// - /// Clean up any resources being used. - /// - - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - /// - /// Required method for Designer support; do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->treeView1 = gcnew System::Windows::Forms::TreeView; - this->button1 = gcnew System::Windows::Forms::Button; - this->treeView2 = gcnew System::Windows::Forms::TreeView; - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // treeView1 - // - this->treeView1->ImageIndex = -1; - this->treeView1->Location = System::Drawing::Point( 8, 8 ); - this->treeView1->Name = "treeView1"; - array^temp0 = {gcnew System::Windows::Forms::TreeNode( "Node5" ),gcnew System::Windows::Forms::TreeNode( "Node6" ),gcnew System::Windows::Forms::TreeNode( "Node7" )}; - array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node8" ),gcnew System::Windows::Forms::TreeNode( "Node9" ),gcnew System::Windows::Forms::TreeNode( "Node10" )}; - array^temp2 = {gcnew System::Windows::Forms::TreeNode( "Node11" ),gcnew System::Windows::Forms::TreeNode( "Node12" ),gcnew System::Windows::Forms::TreeNode( "Node13" )}; - array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node15" )}; - array^temp4 = {gcnew System::Windows::Forms::TreeNode( "Node14",temp3 ),gcnew System::Windows::Forms::TreeNode( "Node16" ),gcnew System::Windows::Forms::TreeNode( "Node17" )}; - array^temp5 = {gcnew System::Windows::Forms::TreeNode( "Node21" )}; - array^temp6 = {gcnew System::Windows::Forms::TreeNode( "Node20",temp5 )}; - array^temp7 = {gcnew System::Windows::Forms::TreeNode( "Node19",temp6 )}; - array^temp8 = {gcnew System::Windows::Forms::TreeNode( "Node18",temp7 )}; - array^temp9 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp0 ),gcnew System::Windows::Forms::TreeNode( "Node1",temp1 ),gcnew System::Windows::Forms::TreeNode( "Node2",temp2 ),gcnew System::Windows::Forms::TreeNode( "Node3",temp4 ),gcnew System::Windows::Forms::TreeNode( "Node4",temp8 )}; - this->treeView1->Nodes->AddRange( temp9 ); - this->treeView1->SelectedImageIndex = -1; - this->treeView1->Size = System::Drawing::Size( 128, 224 ); - this->treeView1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 8, 240 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "Move ->"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // treeView2 - // - this->treeView2->ImageIndex = -1; - this->treeView2->Location = System::Drawing::Point( 144, 8 ); - this->treeView2->Name = "treeView2"; - this->treeView2->SelectedImageIndex = -1; - this->treeView2->Size = System::Drawing::Size( 144, 224 ); - this->treeView2->TabIndex = 2; - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 192, 240 ); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 96, 23 ); - this->button2->TabIndex = 3; - this->button2->Text = "Delete [0] Node"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp10 = {this->button2,this->treeView2,this->button1,this->treeView1}; - this->Controls->AddRange( temp10 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // If neither TreeNodeCollection is read-only, move the - // selected node from treeView1 to treeView2. - if ( !treeView1->Nodes->IsReadOnly && !treeView2->Nodes->IsReadOnly ) - { - if ( treeView1->SelectedNode != nullptr ) - { - TreeNode^ tn = treeView1->SelectedNode; - treeView1->Nodes->Remove( tn ); - treeView2->Nodes->Insert( treeView2->Nodes->Count, tn ); - } - } - } - // - - // - void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Delete the first TreeNode in the collection - // if the Text property is S"Node0." - if ( this->treeView1->Nodes[ 0 ]->Text->Equals( "Node0" ) ) - { - this->treeView1->Nodes->RemoveAt( 0 ); - } - } - // - }; -} - - -/// -/// The main entry point for the application. -/// - -[STAThread] -int main() -{ - Application::Run( gcnew ToolBarStuff::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp deleted file mode 100644 index d4df63dad0d..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp +++ /dev/null @@ -1,231 +0,0 @@ - - -// System::Windows::Forms::TreeNodeCollection::Clear -// System::Windows::Forms::TreeNodeCollection::AddRange -/* -The following program demonstrates the 'Clear' and 'AddRange' methods of -the 'TreeNodeCollection' class. It creates two 'TreeView' objects, the first -Object* contains the customer list and the second Object* is empty. The user -is provided with the option to add or remove a 'TreeNode'. - -*/ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class MyCustomerClass -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - MyCustomerClass( String^ name ) - { - CustomerName = name; - CustomerOrders = gcnew ArrayList; - } - -}; - -public ref class MyOrder -{ -public: - String^ OrderID; - MyOrder( String^ orderID ) - { - this->OrderID = orderID; - } - -}; - -public ref class myTreeNodeCollectionForm: public Form -{ -private: - Button^ myButtonAddAll; - Button^ myButtonAdd; - TreeView^ myTreeViewBase; - TreeView^ myTreeViewCustom; - Button^ myButtonRemoveAll; - -public: - myTreeNodeCollectionForm() - { - InitializeComponent(); - FillMyTreeView(); - myButtonAddAll->Click += gcnew EventHandler( this, &myTreeNodeCollectionForm::MyButtonAddAllClick ); - myButtonAdd->Click += gcnew EventHandler( this, &myTreeNodeCollectionForm::MyButtonAddClick ); - myButtonRemoveAll->Click += gcnew EventHandler( this, &myTreeNodeCollectionForm::MyButtonRemoveAllClick ); - } - - // - // -private: - void MyButtonAddAllClick( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Get the 'myTreeNodeCollection' from the 'myTreeViewBase' TreeView. - TreeNodeCollection^ myTreeNodeCollection = myTreeViewBase->Nodes; - - // Create an array of 'TreeNodes'. - array^myTreeNodeArray = gcnew array(myTreeViewBase->Nodes->Count); - - // Copy the tree nodes to the 'myTreeNodeArray' array. - myTreeViewBase->Nodes->CopyTo( myTreeNodeArray, 0 ); - - // Remove all the tree nodes from the 'myTreeViewBase' TreeView. - myTreeViewBase->Nodes->Clear(); - - // Add the 'myTreeNodeArray' to the 'myTreeViewCustom' TreeView. - myTreeViewCustom->Nodes->AddRange( myTreeNodeArray ); - } - // - // - - void MyButtonRemoveAllClick( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Get the 'myTreeNodeCollection' from the 'myTreeViewCustom' TreeView. - TreeNodeCollection^ myTreeNodeCollection = myTreeViewCustom->Nodes; - - // Create an array of 'TreeNodes'. - array^myTreeNodeArray = gcnew array(myTreeViewCustom->Nodes->Count); - - // Copy the tree nodes to the 'myTreeNodeArray' array. - myTreeViewCustom->Nodes->CopyTo( myTreeNodeArray, 0 ); - - // Remove all the tree nodes from the 'myTreeViewCustom' TreeView. - myTreeViewCustom->Nodes->Clear(); - - // Add the 'myTreeNodeArray' to the 'myTreeViewBase' TreeView. - myTreeViewBase->Nodes->AddRange( myTreeNodeArray ); - } - - void MyButtonAddClick( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - TreeNodeCollection^ myTreeNodeCollection = myTreeViewBase->Nodes; - IEnumerator^ myEnum = myTreeNodeCollection->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ myTreeNode = safe_cast(myEnum->Current); - if ( myTreeNode->IsSelected) - { - - // Remove the selected node from the 'myTreeViewBase' TreeView. - myTreeViewBase->Nodes->Remove( myTreeNode ); - - // Add the selected node to the 'myTreeViewCustom' TreeView. - myTreeViewCustom->Nodes->Add( myTreeNode ); - } - } - } - - void FillMyTreeView() - { - ArrayList^ customerArray = gcnew ArrayList; - - // Add customers to the ArrayList of 'MyCustomerClass' objects. - for ( int x = 1; x <= 10; x++ ) - { - customerArray->Add( gcnew MyCustomerClass( String::Concat( "Customer ", x ) ) ); - - } - - // Add orders to each 'MyCustomerClass' Object* in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MyCustomerClass^ myCustomerClass1 = safe_cast(myEnum->Current); - for ( int y = 1; y <= 5; y++ ) - { - myCustomerClass1->CustomerOrders->Add( gcnew MyOrder( String::Concat( "Order ", y ) ) ); - - } - } - - // Supress repainting until all the objects have been created. - myTreeViewBase->BeginUpdate(); - - // Clear the 'TreeView' each time the method is called. - myTreeViewBase->Nodes->Clear(); - TreeNodeCollection^ myTreeNodeCollectionCustomer = myTreeViewBase->Nodes; - - // Add a root treenode for each 'MyCustomerClass' object in the ArrayList. - while ( myEnum->MoveNext() ) - { - MyCustomerClass^ myCustomerClass2 = safe_cast(myEnum->Current); - myTreeNodeCollectionCustomer->Add( gcnew TreeNode( myCustomerClass2->CustomerName ) ); - TreeNodeCollection^ myTreeNodeCollectionOrders = myTreeNodeCollectionCustomer[ customerArray->IndexOf( myCustomerClass2 ) ]->Nodes; - - // Add a child treenode for each 'MyOrder' object. - IEnumerator^ myEnum = myCustomerClass2->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MyOrder^ myOrder1 = safe_cast(myEnum->Current); - myTreeNodeCollectionOrders->Add( gcnew TreeNode( myOrder1->OrderID ) ); - TreeNode^ myTreeNodeOrder = myTreeNodeCollectionOrders[ myCustomerClass2->CustomerOrders->IndexOf( myOrder1 ) ]; - } - } - - myTreeViewBase->SelectedImageIndex = 0; - - // Begin repainting the 'TreeView'. - myTreeViewBase->EndUpdate(); - } - - void InitializeComponent() - { - this->myTreeViewBase = gcnew TreeView; - this->myButtonAddAll = gcnew Button; - this->myButtonAdd = gcnew Button; - this->myTreeViewCustom = gcnew TreeView; - this->myButtonRemoveAll = gcnew Button; - this->SuspendLayout(); - this->myTreeViewBase->ImageIndex = -1; - this->myTreeViewBase->Location = Point(64,16); - this->myTreeViewBase->Name = "myTreeViewBase"; - this->myTreeViewBase->SelectedImageIndex = -1; - this->myTreeViewBase->Size = System::Drawing::Size( 160, 192 ); - this->myTreeViewBase->TabIndex = 0; - this->myButtonAddAll->Location = Point(248,112); - this->myButtonAddAll->Name = "myButtonAddAll"; - this->myButtonAddAll->Size = System::Drawing::Size( 96, 23 ); - this->myButtonAddAll->TabIndex = 2; - this->myButtonAddAll->Text = "Add >>"; - this->myButtonAdd->Location = Point(248,48); - this->myButtonAdd->Name = "myButtonAdd"; - this->myButtonAdd->Size = System::Drawing::Size( 96, 23 ); - this->myButtonAdd->TabIndex = 3; - this->myButtonAdd->Text = "Add >"; - this->myTreeViewCustom->ImageIndex = -1; - this->myTreeViewCustom->Location = Point(376,16); - this->myTreeViewCustom->Name = "myTreeViewCustom"; - this->myTreeViewCustom->SelectedImageIndex = -1; - this->myTreeViewCustom->Size = System::Drawing::Size( 168, 192 ); - this->myTreeViewCustom->TabIndex = 1; - this->myButtonRemoveAll->Location = Point(248,176); - this->myButtonRemoveAll->Name = "myButtonRemoveAll"; - this->myButtonRemoveAll->Size = System::Drawing::Size( 96, 23 ); - this->myButtonRemoveAll->TabIndex = 4; - this->myButtonRemoveAll->Text = "<< Remove "; - this->ClientSize = System::Drawing::Size( 616, 273 ); - this->Controls->Add( this->myButtonRemoveAll ); - this->Controls->Add( this->myButtonAdd ); - this->Controls->Add( this->myButtonAddAll ); - this->Controls->Add( this->myTreeViewCustom ); - this->Controls->Add( this->myTreeViewBase ); - this->Name = "myTreeNodeCollectionForm"; - this->Text = "TreeNodeCollection class Sample"; - this->ResumeLayout( false ); - } -}; - -int main() -{ - Application::Run( gcnew myTreeNodeCollectionForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp deleted file mode 100644 index f97eff9ef45..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp +++ /dev/null @@ -1,127 +0,0 @@ - - -// System::Windows::Forms::TreeNodeCollection::Contains() -// System::Windows::Forms::TreeNodeCollection::GetEnumerator() - -/* -The following program demonstrates 'Contains' and 'GetEnumerator' -methods of 'System::Windows::Forms::TreeNodeCollection' class. It -creates a TreeView with two TreeNodes and gets the collection of -TreeNodes. It checks for a TreeNode in the collection and also -gets an Enumerator to iterate through the collection. -*/ - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - TreeView^ myTreeView; - TreeNode^ myTreeNode1; - TreeNode^ myTreeNode2; - Label^ myLabel; - System::ComponentModel::Container^ components; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - } - -protected: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->myTreeView = gcnew TreeView; - this->myLabel = gcnew Label; - this->SuspendLayout(); - - // - // myTreeView - // - this->myTreeView->ImageIndex = -1; - this->myTreeView->Name = "treeView1"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->TabIndex = 0; - - // Create TreeNodes. - myTreeNode1 = gcnew TreeNode( "Node1" ); - myTreeNode2 = gcnew TreeNode( "Node2" ); - array^temp0 = {myTreeNode1,myTreeNode2}; - this->myTreeView->Nodes->AddRange( temp0 ); - - // - // myLabel - // - this->myLabel->Location = Point(8,136); - this->myLabel->Name = "myLabel"; - this->myLabel->Size = System::Drawing::Size( 248, 112 ); - this->myLabel->TabIndex = 1; - - // - // MyForm - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp1 = {this->myLabel,this->myTreeView}; - this->Controls->AddRange( temp1 ); - this->Name = "MyForm"; - this->Text = "MyForm"; - this->Load += gcnew EventHandler( this, &MyForm::MyForm_Load ); - this->ResumeLayout( false ); - } - - void MyForm_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - EnumerateTreeNodes(); - } - - // - // - void EnumerateTreeNodes() - { - TreeNodeCollection^ myNodeCollection = myTreeView->Nodes; - - // Check for a node in the collection. - if ( myNodeCollection->Contains( myTreeNode2 ) ) - { - myLabel->Text = myLabel->Text + "Node2 is at index: " + myNodeCollection->IndexOf( myTreeNode2 ); - } - - myLabel->Text = myLabel->Text + "\n\nElements of the TreeNodeCollection:\n"; - - // Create an enumerator for the collection. - IEnumerator^ myEnumerator = myNodeCollection->GetEnumerator(); - while ( myEnumerator->MoveNext() ) - { - myLabel->Text = myLabel->Text + (dynamic_cast(myEnumerator->Current))->Text + "\n"; - } - } - // - // -}; - - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp deleted file mode 100644 index 0dd12dbc9bc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp +++ /dev/null @@ -1,125 +0,0 @@ - - -// System::Windows::Forms::TreeNodeCollection::Count -// System::Windows::Forms::TreeNodeCollection::CopyTo() -/* -The following program demonstrates 'Count' property and 'CopyTo' -method of 'System::Windows::Forms::TreeNodeCollection' class. It -creates a TreeView with two TreeNodes and gets the collection of -TreeNodes. It copies the collection into an array -and displays the count of the collection and the elements of the -array. -*/ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class MyForm: public Form -{ -private: - TreeView^ myTreeView; - TreeNode^ myTreeNode1; - TreeNode^ myTreeNode2; - Label^ myLabel; - System::ComponentModel::Container^ components; - -public: - MyForm() - { - components = nullptr; - InitializeComponent(); - } - -protected: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->myTreeView = gcnew TreeView; - this->myLabel = gcnew Label; - this->SuspendLayout(); - - // - // myTreeView - // - this->myTreeView->ImageIndex = -1; - this->myTreeView->Name = "treeView1"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->TabIndex = 0; - - // Add TreeNodes. - myTreeNode1 = gcnew TreeNode( "Node1" ); - myTreeNode2 = gcnew TreeNode( "Node2" ); - array^temp0 = {myTreeNode1,myTreeNode2}; - this->myTreeView->Nodes->AddRange( temp0 ); - - // - // myLabel - // - this->myLabel->Location = Point(8,136); - this->myLabel->Name = "myLabel"; - this->myLabel->Size = System::Drawing::Size( 248, 112 ); - this->myLabel->TabIndex = 1; - - // - // MyForm - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp1 = {this->myLabel,this->myTreeView}; - this->Controls->AddRange( temp1 ); - this->Name = "MyForm"; - this->Text = "MyForm"; - this->Load += gcnew EventHandler( this, &MyForm::MyForm_Load ); - this->ResumeLayout( false ); - } - - void MyForm_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - CopyTreeNodes(); - } - - // - // - void CopyTreeNodes() - { - // Get the collection of TreeNodes. - TreeNodeCollection^ myNodeCollection = myTreeView->Nodes; - int myCount = myNodeCollection->Count; - myLabel->Text = String::Concat( myLabel->Text, "Number of nodes in the collection : ", myCount ); - myLabel->Text = String::Concat( myLabel->Text, "\n\nElements of the Array after Copying from the collection :\n" ); - - // Create an Object array. - array^myArray = gcnew array(myCount); - - // Copy the collection into an array. - myNodeCollection->CopyTo( myArray, 0 ); - for ( int i = 0; i < myArray->Length; i++ ) - { - myLabel->Text = myLabel->Text + (dynamic_cast(myArray[ i ]))->Text + "\n"; - - } - } - // - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp deleted file mode 100644 index f7dd99b0a0a..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp +++ /dev/null @@ -1,254 +0,0 @@ - - -// System::Windows::Forms::TreeNode::TreeNode() -// System::Windows::Forms::TreeNode::TreeNode(String*, TreeNode[]) -// System::Windows::Forms::TreeNode::Bounds -// System::Windows::Forms::TreeNode::ForeColor -// System::Windows::Forms::TreeNode::NodeFont -// System::Windows::Forms::TreeNode::Text -// System::Windows::Forms::TreeNode::Tag -// System::Windows::Forms::TreeView::ItemHeight - -/* -The following example demonstrates the constructors 'TreeNode()' -and 'TreeNode(String*, TreeNode[])' and the property 'Bounds' of the -'TreeNode' class. This example displays customer information in a -'TreeView' control. The root tree nodes display customer names, and -the child tree nodes display the order numbers assigned to each -customer. -*/ - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -public ref class Customer -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - Customer( String^ myName ) - { - CustomerName = myName; - CustomerOrders = gcnew ArrayList; - } - -}; - -public ref class Order -{ -public: - String^ OrderID; - Order( String^ myOrderID ) - { - this->OrderID = myOrderID; - } - -}; - -public ref class TreeNode_Bounds: public Form -{ -private: - TreeView^ myTreeView; - Button^ myButton; - Label^ mylabel; - ComboBox^ myComboBox; - - // ArrayList object to hold the 'Customer' objects. - ArrayList^ customerArray; - -public: - TreeNode_Bounds() - { - customerArray = gcnew ArrayList; - InitializeComponent(); - FillMyTreeView(); - } - - -private: - void FillMyTreeView() - { - - // Add customers to the ArrayList of 'Customer' objects. - for ( int xIndex = 1; xIndex <= 5; xIndex++ ) - { - customerArray->Add( gcnew Customer( String::Concat( "Customer ", xIndex ) ) ); - - } - - // Add orders to each 'Customer' Object* in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ customer1 = safe_cast(myEnum->Current); - for ( int yIndex = 1; yIndex <= 5; yIndex++ ) - { - customer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", yIndex ) ) ); - - } - } - - myTreeView->BeginUpdate(); - - // Clear the TreeView each time the method is called. - myTreeView->Nodes->Clear(); - AddRootNodes(); - - // Begin repainting the TreeView. - myTreeView->EndUpdate(); - } - - -public: - - // -ref class Customer -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - Customer( String^ myName ) - { - CustomerName = myName; - CustomerOrders = gcnew ArrayList; - } - -}; - -ref class Order -{ -public: - String^ OrderID; - Order( String^ myOrderID ) - { - this->OrderID = myOrderID; - } - -}; - - - void AddRootNodes() - { - - // Add a root node to assign the customer nodes to. - TreeNode^ rootNode = gcnew TreeNode; - rootNode->Text = "CustomerList"; - - // Add a main root treenode. - myTreeView->Nodes->Add( rootNode ); - - // Add a root treenode for each 'Customer' object in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ myCustomer = safe_cast(myEnum->Current); - - // Add a child treenode for each Order object. - int i = 0; - array^myTreeNodeArray = gcnew array(5); - IEnumerator^ myEnum = myCustomer->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Order^ myOrder = safe_cast(myEnum->Current); - myTreeNodeArray[ i ] = gcnew TreeNode( myOrder->OrderID ); - i++; - } - TreeNode^ customerNode = gcnew TreeNode( myCustomer->CustomerName,myTreeNodeArray ); - - // Display the customer names with and Orange font. - customerNode->ForeColor = Color::Orange; - - // Store the Customer Object* in the Tag property of the TreeNode. - customerNode->Tag = myCustomer; - myTreeView->Nodes[ 0 ]->Nodes->Add( customerNode ); - } - } - // - - // -private: - void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - myTreeView->ItemHeight = 5; - myTreeView->SelectedNode->NodeFont = gcnew System::Drawing::Font( "Arial",5 ); - - // Get the font size from combobox. - String^ selectedString = myComboBox->SelectedItem->ToString(); - int myNodeFontSize = Int32::Parse( selectedString ); - - // Set the font of root node. - myTreeView->SelectedNode->NodeFont = gcnew System::Drawing::Font( "Arial",(float)myNodeFontSize ); - for ( int i = 0; i < myTreeView->Nodes[ 0 ]->Nodes->Count; i++ ) - { - - // Set the font of child nodes. - myTreeView->Nodes[ 0 ]->Nodes[ i ]->NodeFont = gcnew System::Drawing::Font( "Arial",(float)myNodeFontSize ); - - } - - // Get the bounds of the tree node. - Rectangle myRectangle = myTreeView->SelectedNode->Bounds; - int myNodeHeight = myRectangle.Height; - if ( myNodeHeight < myNodeFontSize ) - { - myNodeHeight = myNodeFontSize; - } - - myTreeView->ItemHeight = myNodeHeight + 4; - } - // - - void InitializeComponent() - { - this->myTreeView = gcnew System::Windows::Forms::TreeView; - this->myButton = gcnew System::Windows::Forms::Button; - this->myComboBox = gcnew System::Windows::Forms::ComboBox; - this->mylabel = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - this->myTreeView->ImageIndex = -1; - this->myTreeView->Location = System::Drawing::Point( 8, 0 ); - this->myTreeView->Name = "myTreeView"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->Size = System::Drawing::Size( 280, 152 ); - this->myTreeView->TabIndex = 0; - this->myButton->Location = System::Drawing::Point( 104, 232 ); - this->myButton->Name = "myButton"; - this->myButton->TabIndex = 2; - this->myButton->Text = "Submit"; - this->myButton->Click += gcnew System::EventHandler( this, &TreeNode_Bounds::Button1_Click ); - this->myComboBox->DropDownWidth = 121; - array^temp0 = {"6","7","8","10","12","16","18","22"}; - this->myComboBox->Items->AddRange( temp0 ); - this->myComboBox->Location = System::Drawing::Point( 112, 184 ); - this->myComboBox->Name = "myComboBox"; - this->myComboBox->Size = System::Drawing::Size( 121, 21 ); - this->myComboBox->TabIndex = 1; - this->myComboBox->SelectedIndex = 0; - this->myComboBox->DropDownStyle = ComboBoxStyle::DropDownList; - this->mylabel->Location = System::Drawing::Point( 0, 184 ); - this->mylabel->Name = "mylabel"; - this->mylabel->TabIndex = 3; - this->mylabel->Text = "Select a Height for TreeNode"; - this->mylabel->Size = System::Drawing::Size( 100, 50 ); - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp1 = {this->mylabel,this->myButton,this->myComboBox,this->myTreeView}; - this->Controls->AddRange( temp1 ); - this->Text = "TreeNode Example"; - this->ResumeLayout( false ); - } - -}; - -int main() -{ - Application::Run( gcnew TreeNode_Bounds ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp deleted file mode 100644 index a9d7cfd1f15..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp +++ /dev/null @@ -1,189 +0,0 @@ - - -// System::Windows::Forms::TreeNode::Checked -// System::Windows::Forms::TreeNode::BackColor -/* -The following example demonstrates the properties 'Checked' and -'BackColor' of the 'TreeNode' class. This example displays customer -information in a 'TreeView' control. The root tree nodes display -customer names, and the child tree nodes display the order numbers -assigned to each customer. It also displays selected nodes in a -messagebox. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::Windows::Forms; -public ref class Customer -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - Customer( String^ myName ) - { - CustomerName = myName; - CustomerOrders = gcnew ArrayList; - } - -}; - -public ref class Order -{ -public: - String^ OrderID; - Order( String^ myOrderID ) - { - this->OrderID = myOrderID; - } - -}; - -public ref class TreeNode_Bounds: public Form -{ -private: - TreeView^ myTreeView; - Button^ myButton; - - // ArrayList Object* to hold the Customer objects. - ArrayList^ customerArray; - TreeNode^ rootNode; - -public: - TreeNode_Bounds() - { - customerArray = gcnew ArrayList; - InitializeComponent(); - FillMyTreeView(); - } - - -private: - void FillMyTreeView() - { - - // Add customers to the ArrayList of 'Customer' objects. - for ( int x = 1; x <= 5; x++ ) - { - customerArray->Add( gcnew Customer( String::Concat( "Customer ", x ) ) ); - - } - - // Add orders to each 'Customer' object in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ customer1 = safe_cast(myEnum->Current); - for ( int y = 1; y <= 5; y++ ) - { - customer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", y ) ) ); - - } - } - - myTreeView->BeginUpdate(); - - // Clear the TreeView each time the method is called. - myTreeView->Nodes->Clear(); - rootNode = gcnew TreeNode; - rootNode->Text = "CustomerList"; - - // Add a main root treenode. - myTreeView->Nodes->Add( rootNode ); - myTreeView->CheckBoxes = true; - - // Add a root treenode for each 'Customer' object in the ArrayList. - while ( myEnum->MoveNext() ) - { - Customer^ myCustomer = safe_cast(myEnum->Current); - - // Add a child treenode for each 'Order' object. - int countIndex = 0; - array^myTreeNodeArray = gcnew array(5); - IEnumerator^ myEnum = myCustomer->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Order^ myOrder = safe_cast(myEnum->Current); - myTreeNodeArray[ countIndex ] = gcnew TreeNode( myOrder->OrderID ); - countIndex++; - } - - TreeNode^ customerNode = gcnew TreeNode( myCustomer->CustomerName,myTreeNodeArray ); - myTreeView->Nodes[ 0 ]->Nodes->Add( customerNode ); - } - - - // Begin repainting the TreeView. - myTreeView->EndUpdate(); - } - - - - // -public: - void HighlightCheckedNodes() - { - int countIndex = 0; - String^ selectedNode = "Selected customer nodes are : "; - IEnumerator^ myEnum = myTreeView->Nodes[ 0 ]->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ myNode = safe_cast(myEnum->Current); - - // Check whether the tree node is checked. - if ( myNode->Checked ) - { - - // Set the node's backColor. - myNode->BackColor = Color::Yellow; - selectedNode = String::Concat( selectedNode, myNode->Text, " " ); - countIndex++; - } - else - myNode->BackColor = Color::White; - } - - if ( countIndex > 0 ) - MessageBox::Show( selectedNode ); - else - MessageBox::Show( "No nodes are selected" ); - } - // - -private: - void MyButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - HighlightCheckedNodes(); - } - - void InitializeComponent() - { - this->myTreeView = gcnew System::Windows::Forms::TreeView; - this->SuspendLayout(); - this->myTreeView->ImageIndex = -1; - this->myTreeView->Location = System::Drawing::Point( 8, 0 ); - this->myTreeView->Name = "myTreeView"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->Size = System::Drawing::Size( 280, 152 ); - this->myTreeView->TabIndex = 0; - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->myButton = gcnew Button; - array^temp0 = {this->myButton,this->myTreeView}; - this->Controls->AddRange( temp0 ); - this->myButton->Location = Point(80,200); - this->myButton->Size = System::Drawing::Size( 140, 25 ); - this->myButton->Text = "Display Selected Nodes"; - this->myButton->Click += gcnew EventHandler( this, &TreeNode_Bounds::MyButton_Click ); - this->Text = "TreeNode Example"; - this->ResumeLayout( false ); - } - -}; - -int main() -{ - Application::Run( gcnew TreeNode_Bounds ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp deleted file mode 100644 index a5dac865607..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp +++ /dev/null @@ -1,222 +0,0 @@ - - -// System::Windows::Forms::TreeNode::Expand() -// System::Windows::Forms::TreeNode::Collapse() -// System::Windows::Forms::TreeNode::EnsureVisible() -// System::Windows::Forms::TreeNode::Clone() -/* The following program demonstrates 'Expand', 'Collapse', -'EnsureVisible' and 'Clone' methods of 'System::Windows::Forms::TreeNode' -class. It creates a TreeView, adds 10 TreeNode objects to it and -expands node1, collapses node1 and makes a clone to Node 9 and add it to Node7. */ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace MyTreeNode -{ - // Define a Customer Class. - public ref class Customer - { - public: - String^ myCustomerName; - ArrayList^ MyOrders; - Customer( String^ name ) - { - MyOrders = gcnew ArrayList; - myCustomerName = name; - } - }; - - - // Define an Order Class which will be associated to a customer. - public ref class Order - { - public: - String^ myOrderName; - Order( String^ name1 ) - { - myOrderName = name1; - } - - }; - - public ref class Form1: public Form - { - private: - TreeView^ treeView1; - ArrayList^ myCustomerList; - Button^ button1; - Button^ button2; - Button^ button3; - Button^ button4; - System::ComponentModel::Container^ components; - - public: - Form1() - { - myCustomerList = gcnew ArrayList; - components = nullptr; - - // Required for Windows Form Designer support. - InitializeComponent(); - AddTreeNode(); - } - - protected: - // Clean up any resources being used. - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - // Required method for Designer support. - void InitializeComponent() - { - this->treeView1 = gcnew TreeView; - this->button1 = gcnew Button; - this->button2 = gcnew Button; - this->button3 = gcnew Button; - this->button4 = gcnew Button; - this->SuspendLayout(); - this->treeView1->ImageIndex = -1; - this->treeView1->Location = Point(32,48); - this->treeView1->Name = "treeView1"; - this->treeView1->SelectedImageIndex = -1; - this->treeView1->Size = System::Drawing::Size( 168, 96 ); - this->treeView1->TabIndex = 0; - this->button1->Location = Point(40,160); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 160, 23 ); - this->button1->TabIndex = 1; - this->button1->Text = "Expand Customer1 Node"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - this->button2->Location = Point(40,185); - this->button2->Name = "button2"; - this->button2->Size = System::Drawing::Size( 160, 23 ); - this->button2->TabIndex = 2; - this->button2->Text = "Collapse Customer1 Node"; - this->button3->Location = Point(40,210); - this->button3->Name = "button3"; - this->button3->Size = System::Drawing::Size( 160, 23 ); - this->button3->TabIndex = 3; - this->button3->Text = "EnsureVisible Order7 Node"; - this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - this->button4->Location = Point(40,235); - this->button4->Name = "button4"; - this->button4->Size = System::Drawing::Size( 160, 23 ); - this->button4->TabIndex = 4; - this->button4->Text = "Clone Customer9 Node"; - this->button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); - this->ClientSize = System::Drawing::Size( 240, 273 ); - array^temp0 = {this->button4,this->button3,this->button2,this->button1,this->treeView1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Demonstrating TreeNode members"; - this->ResumeLayout( false ); - } - - // Add TreeNode to the TreeView. - void AddTreeNode() - { - // Add customers to ArrayList of Customer objects. - for ( int i = 1; i < 11; i++ ) - { - myCustomerList->Add( gcnew Customer( String::Concat( "Customer ", i ) ) ); - - } - - // Add orders to each Customer Object* in the ArrayList. - int x = 1; - IEnumerator^ myEnum = myCustomerList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ Customer1 = safe_cast(myEnum->Current); - Customer1->MyOrders->Add( gcnew Order( String::Concat( "Order ", x ) ) ); - x++; - } - - - // Prevent repainting of TreeView until all objects have been created. - treeView1->BeginUpdate(); - - // Clear the TreeView each time the method is called. - treeView1->Nodes->Clear(); - - // Add a root TreeNode for each Customer Object* in the ArrayList. - while ( myEnum->MoveNext() ) - { - Customer^ Customer2 = safe_cast(myEnum->Current); - treeView1->Nodes->Add( gcnew TreeNode( Customer2->myCustomerName ) ); - - // Add a child TreeNode to each Customer TreeNode. - IEnumerator^ myEnum = Customer2->MyOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Order^ Order2 = safe_cast(myEnum->Current); - treeView1->Nodes[ myCustomerList->IndexOf( Customer2 ) ]->Nodes->Add( gcnew TreeNode( Order2->myOrderName ) ); - } - } - } - - // - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( treeView1->SelectedNode->IsExpanded ) - { - treeView1->SelectedNode->Collapse(); - MessageBox::Show( String::Concat( treeView1->SelectedNode->Text, " tree node collapsed." ) ); - } - else - { - treeView1->SelectedNode->Expand(); - MessageBox::Show( String::Concat( treeView1->SelectedNode->Text, " tree node expanded." ) ); - } - } - // - - // - void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - TreeNode^ lastNode = treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes[ treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes->Count - 1 ]; - if ( !lastNode->IsVisible ) - { - lastNode->EnsureVisible(); - MessageBox::Show( String::Concat( lastNode->Text, " tree node is visible." ) ); - } - } - // - - // - void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - TreeNode^ lastNode = treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes[ treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes->Count - 1 ]; - - // Clone the last child node. - TreeNode^ clonedNode = dynamic_cast(lastNode->Clone()); - - // Insert the cloned node as the first root node. - treeView1->Nodes->Insert( 0, clonedNode ); - MessageBox::Show( String::Concat( lastNode->Text, " tree node cloned and added to ", treeView1->Nodes[ 0 ]->Text ) ); - } - - // - }; -} - - -// The main entry point for the application. -int main() -{ - Application::Run( gcnew MyTreeNode::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp deleted file mode 100644 index 0cdb9542ff0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp +++ /dev/null @@ -1,291 +0,0 @@ - - -// System::Windows::Forms::TreeNode::ExpandAll() -// System::Windows::Forms::TreeNode::FirstNode -// System::Windows::Forms::TreeNode::ForeColor -// System::Windows::Forms::TreeNode::GetNodeCount(bool) -// System::Windows::Forms::TreeNode::IsEditing -// System::Windows::Forms::TreeNode::IsExpanded -// System::Windows::Forms::TreeNode::IsSelected -// System::Windows::Forms::TreeNode::FullPath -// System::Windows::Forms::TreeView::PathSeparator -/* -The following example demonstrates the properties 'FirstNode', -'ForeColor', 'IsEditing', 'IsExpanded' and 'IsSelected', the methods -'ExpandAll' and 'GetNodeCount(bool)' of the 'TreeNode' class. In the -program, a form is created and to it 'TreeView', 'GroupBox', -and two 'CheckBox' controls are added. A 'TreeView' control is -associated with the class 'ContextMenu' so as to enable the user to change -the content of a 'TreeNode'. The 'TreeView' control displays a -hierarchical collection of 'Customer' objects which in turn contain -'Order' objects. -*/ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class Customer -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - Customer( String^ myName ) - { - CustomerName = myName; - CustomerOrders = gcnew ArrayList; - } - -}; - -public ref class Order -{ -public: - String^ OrderID; - Order( String^ myOrderID ) - { - this->OrderID = myOrderID; - } - -}; - -public ref class MyTreeNode_FirstNode: public Form -{ -private: - TreeView^ myTreeView; - GroupBox^ myGroupBox; - CheckBox^ myCheckBox; - CheckBox^ myCheckBox2; - Button^ myButton; - System::Windows::Forms::ContextMenu^ myContextMenu; - MenuItem^ myMenuItem; - TreeNode^ mySelectedNode; - - // ArrayList object to hold the 'Customer' objects. - ArrayList^ myCustomerArrayList; - -public: - MyTreeNode_FirstNode() - { - myCustomerArrayList = gcnew ArrayList; - InitializeComponent(); - FillMyTreeView(); - } - - -private: - void FillMyTreeView() - { - - // Add customers to the ArrayList of 'Customer' objects. - for ( int iIndex = 1; iIndex <= 10; iIndex++ ) - { - myCustomerArrayList->Add( gcnew Customer( String::Concat( "Customer ", iIndex ) ) ); - - } - IEnumerator^ myEnum = myCustomerArrayList->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ myCustomer1 = safe_cast(myEnum->Current); - for ( int jIndex = 1; jIndex <= 5; jIndex++ ) - { - myCustomer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", jIndex ) ) ); - - } - } - - - // Suppress repainting the TreeView until it is fully created. - myTreeView->BeginUpdate(); - - // Clear the TreeView each time the method is called. - myTreeView->Nodes->Clear(); - TreeNode^ myMainNode = gcnew TreeNode( "CustomerList" ); - myTreeView->Nodes->Add( myMainNode ); - - // Add a root treenode for each 'Customer' in the ArrayList. - while ( myEnum->MoveNext() ) - { - Customer^ myCustomer2 = safe_cast(myEnum->Current); - TreeNode^ myTreeNode1 = gcnew TreeNode( myCustomer2->CustomerName ); - myTreeNode1->ForeColor = Color::Orange; - myTreeView->Nodes[ 0 ]->Nodes->Add( myTreeNode1 ); - - // Add a child for each 'Order' in the current 'Customer'. - IEnumerator^ myEnum = myCustomer2->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Order^ myOrder1 = safe_cast(myEnum->Current); - myTreeView->Nodes[ 0 ]->Nodes[ myCustomerArrayList->IndexOf( myCustomer2 ) ]->Nodes->Add( gcnew TreeNode( myOrder1->OrderID ) ); - } - } - - - // Reset the cursor back to the default for all controls. - ::Cursor::Current = Cursors::Default; - - // Begin repainting the TreeView. - myTreeView->EndUpdate(); - if ( !myTreeView->Nodes[ 0 ]->IsExpanded ) - myTreeView->Nodes[ 0 ]->Expand(); - } - - void InitializeComponent() - { - this->myMenuItem = gcnew MenuItem; - this->myCheckBox = gcnew CheckBox; - this->myButton = gcnew Button; - this->myCheckBox2 = gcnew CheckBox; - this->myTreeView = gcnew TreeView; - this->myContextMenu = gcnew System::Windows::Forms::ContextMenu; - this->myGroupBox = gcnew GroupBox; - this->myGroupBox->SuspendLayout(); - this->SuspendLayout(); - this->myMenuItem->Checked = true; - this->myMenuItem->DefaultItem = true; - this->myMenuItem->Index = 0; - this->myMenuItem->Text = "Edit"; - this->myMenuItem->Click += gcnew System::EventHandler( this, &MyTreeNode_FirstNode::MenuItem1_Click ); - this->myCheckBox->Location = System::Drawing::Point( 24, 24 ); - this->myCheckBox->Name = "myCheckBox"; - this->myCheckBox->TabIndex = 0; - this->myCheckBox->Text = "Expand All"; - this->myCheckBox->CheckedChanged += gcnew System::EventHandler( this, &MyTreeNode_FirstNode::myCheckBox_CheckedChanged ); - this->myButton->Location = System::Drawing::Point( 136, 24 ); - this->myButton->Name = "myCheckBox2"; - this->myButton->TabIndex = 1; - this->myButton->Text = "Child Nodes"; - this->myButton->Click += gcnew System::EventHandler( this, &MyTreeNode_FirstNode::myButton_Click ); - this->myTreeView->ContextMenu = this->myContextMenu; - this->myTreeView->ImageIndex = -1; - this->myTreeView->LabelEdit = true; - this->myTreeView->Location = System::Drawing::Point( 8, 0 ); - this->myTreeView->Name = "myTreeView"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->Size = System::Drawing::Size( 280, 152 ); - this->myTreeView->TabIndex = 0; - this->myTreeView->MouseDown += gcnew MouseEventHandler( this, &MyTreeNode_FirstNode::TreeView1_MouseDown ); - this->myTreeView->AfterLabelEdit += gcnew NodeLabelEditEventHandler( this, &MyTreeNode_FirstNode::TreeView1_AfterLabelEdit ); - array^temp0 = {this->myMenuItem}; - this->myContextMenu->MenuItems->AddRange( temp0 ); - array^temp1 = {this->myButton,this->myCheckBox}; - this->myGroupBox->Controls->AddRange( temp1 ); - this->myGroupBox->Location = System::Drawing::Point( 8, 168 ); - this->myGroupBox->Name = "myGroupBox"; - this->myGroupBox->Size = System::Drawing::Size( 272, 96 ); - this->myGroupBox->TabIndex = 1; - this->myGroupBox->TabStop = false; - this->myGroupBox->Text = "myGroupBox"; - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp2 = {this->myGroupBox,this->myTreeView}; - this->Controls->AddRange( temp2 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->myGroupBox->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - // - void myCheckBox_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // If the check box is checked, expand all the tree nodes. - if ( myCheckBox->Checked ) - { - myTreeView->ExpandAll(); - } - else - { - - // If the check box is not checked, collapse the first tree node. - myTreeView->Nodes[ 0 ]->FirstNode->Collapse(); - MessageBox::Show( "The first node of CustomerList root node is collapsed" ); - } - } - // - - // - void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - - // Set the tree view's PathSeparator property. - myTreeView->PathSeparator = "."; - - // Get the count of the child tree nodes contained in the SelectedNode. - int myNodeCount = myTreeView->SelectedNode->GetNodeCount( true ); - Decimal myChildPercentage = ((Decimal)myNodeCount / (Decimal)myTreeView->GetNodeCount( true )) * 100; - - // Display the tree node path and the number of child nodes it and the tree view have. - MessageBox::Show( String::Concat( "The '", myTreeView->SelectedNode->FullPath, "' node has ", myNodeCount, " child nodes.\nThat is ", String::Format( "{0:###.##}", myChildPercentage ), "% of the total tree nodes in the tree view control." ) ); - } - // - - // Save the tree node under the mouse pointer. - void TreeView1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) - { - mySelectedNode = myTreeView->GetNodeAt( e->X, e->Y ); - } - - void MenuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - if ( mySelectedNode != nullptr && mySelectedNode->Parent != nullptr ) - { - myTreeView->SelectedNode = mySelectedNode; - myTreeView->LabelEdit = true; - mySelectedNode->BeginEdit(); - if ( mySelectedNode->IsEditing ) - MessageBox::Show( String::Concat( "The name of node being edited: ", mySelectedNode->Text ) ); - mySelectedNode->BeginEdit(); - } - else - { - MessageBox::Show( "No tree node selected or selected node is a root node. Editing of root nodes is not allowed. Invalid selection" ); - } - } - - void TreeView1_AfterLabelEdit( Object^ /*sender*/, NodeLabelEditEventArgs^ e ) - { - if ( e->Label != nullptr ) - { - if ( e->Label->Length > 0 ) - { - array^temp3 = {'@','->',',','!'}; - if ( e->Label->IndexOfAny( temp3 ) == -1 ) - { - - // Stop editing without cancelling the label change. - e->Node->EndEdit( false ); - } - else - { - - // Cancel the label edit action, place it in edit mode. - e->CancelEdit = true; - MessageBox::Show( "Invalid tree node label.\n The invalid characters are: '@', '.', ', ', '!'", "Node Label Edit" ); - e->Node->BeginEdit(); - } - } - else - { - - // Cancel the label edit action, place it in edit mode. - e->CancelEdit = true; - MessageBox::Show( "Invalid tree node label. The label cannot be blank", "Node Label Edit" ); - e->Node->BeginEdit(); - } - this->myTreeView->LabelEdit = false; - } - } - -}; - -int main() -{ - Application::Run( gcnew MyTreeNode_FirstNode ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp deleted file mode 100644 index 4e6527373b0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp +++ /dev/null @@ -1,304 +0,0 @@ - - -// System::Windows::Forms::TreeNode::PrevVisibleNode -// System::Windows::Forms::TreeNode::PrevNode -// System::Windows::Forms::TreeNode::NextVisibleNode -// System::Windows::Forms::TreeNode::NextNode -// System::Windows::Forms::TreeNode::LastNode -// System::Windows::Forms::TreeNode::FirstNode -// System::Windows::Forms::TreeNode::TreeView -// System::Windows::Forms::TreeNode::IsSelected -/* -The following program demonstrates the 'NodeFont', 'Parent', 'Text' and 'PrevVisibleNode' -properties of the 'TreeNode' class. It creates a TreeView consisting of customer nodes -and 'order' as its child nodes. It also provides option for the user to change the font -and text of the node. -*/ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -public ref class MyCustomerClass -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - MyCustomerClass( String^ name ) - { - CustomerName = name; - CustomerOrders = gcnew ArrayList; - } - -}; - -public ref class MyOrder -{ -public: - String^ OrderID; - MyOrder( String^ orderID ) - { - this->OrderID = orderID; - } - -}; - -public ref class MyTreeNodeForm: public System::Windows::Forms::Form -{ -private: - TreeView^ myTreeView; - Button^ myButton; - ComboBox^ myComboBox; - Label^ myLabel1; - Label^ myLabel3; - Label^ myLabel4; - TextBox^ myTextBox; - -public: - MyTreeNodeForm() - { - InitializeComponent(); - myButton->Click += gcnew EventHandler( this, &MyTreeNodeForm::MyButtonClick ); - FillMyTreeView(); - } - - -private: - void MyButtonClick( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - TreeNode^ selectedNode = nullptr; - IEnumerator^ myEnum = this->myTreeView->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ node = safe_cast(myEnum->Current); - - // See if the root tree node is selected. - if ( node->IsSelected ) - { - selectedNode = node; - break; - } - - - // Recurse through the TreeNodeCollection. - selectedNode = GetSelectedNode( node ); - if ( selectedNode != nullptr ) - { - break; - } - } - - - // Display the previous visible node. - if ( selectedNode != nullptr ) - { - SelectNode( selectedNode ); - } - } - - - // - void SelectNode( TreeNode^ node ) - { - if ( node->IsSelected ) - { - - // Determine which TreeNode to select. - String^ str = myComboBox->Text; - if ( str->Equals( "Previous" ) ) - node->TreeView->SelectedNode = node->PrevNode; - else - if ( str->Equals( "PreviousVisible" ) ) - node->TreeView->SelectedNode = node->PrevVisibleNode; - else - if ( str->Equals( "Next" ) ) - node->TreeView->SelectedNode = node->NextNode; - else - if ( str->Equals( "NextVisible" ) ) - node->TreeView->SelectedNode = node->NextVisibleNode; - else - if ( str->Equals( "First" ) ) - node->TreeView->SelectedNode = node->FirstNode; - else - if ( str->Equals( "Last" ) ) - node->TreeView->SelectedNode = node->LastNode; - } - - node->TreeView->Focus(); - } - // - - TreeNode^ GetSelectedNode( TreeNode^ treeNode ) - { - - // Check each node recursively. - IEnumerator^ myEnum = treeNode->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ node = safe_cast(myEnum->Current); - if ( node->IsSelected ) - { - - // Return the TreeNode if it is selected. - return node; - } - } - - return nullptr; - } - - - // ArrayList object to hold the 'MyCustomerClass' objects. - void FillMyTreeView() - { - ArrayList^ customerArray = gcnew ArrayList; - - // Add customers to the ArrayList of 'MyCustomerClass' objects. - for ( int x = 1; x <= 10; x++ ) - { - customerArray->Add( gcnew MyCustomerClass( String::Concat( "Customer ", x ) ) ); - - } - - // Add orders to each 'MyCustomerClass' object in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MyCustomerClass^ myCustomerClass1 = safe_cast(myEnum->Current); - for ( int y = 1; y <= 5; y++ ) - { - myCustomerClass1->CustomerOrders->Add( gcnew MyOrder( String::Concat( "Order ", y ) ) ); - - } - } - - - // Supress repainting until all the objects have been created. - myTreeView->BeginUpdate(); - - // Clear the 'TreeView' each time the method is called. - myTreeView->Nodes->Clear(); - TreeNodeCollection^ myTreeNodeCollectionCustomer = myTreeView->Nodes; - - // Add a root treenode for each 'MyCustomerClass' object in the ArrayList. - while ( myEnum->MoveNext() ) - { - MyCustomerClass^ myCustomerClass2 = safe_cast(myEnum->Current); - myTreeNodeCollectionCustomer->Add( gcnew TreeNode( myCustomerClass2->CustomerName ) ); - TreeNodeCollection^ myTreeNodeCollectionOrders = myTreeNodeCollectionCustomer[ customerArray->IndexOf( myCustomerClass2 ) ]->Nodes; - - // Add a child treenode for each MyOrder object. - IEnumerator^ myEnum = myCustomerClass2->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MyOrder^ myOrder1 = safe_cast(myEnum->Current); - myTreeNodeCollectionOrders->Add( gcnew TreeNode( myOrder1->OrderID ) ); - TreeNode^ myTreeNodeOrder = myTreeNodeCollectionOrders[ myCustomerClass2->CustomerOrders->IndexOf( myOrder1 ) ]; - } - } - - myTreeView->SelectedImageIndex = 0; - - // Begin repainting the 'TreeView'. - myTreeView->EndUpdate(); - } - - void InitializeComponent() - { - this->myTreeView = gcnew System::Windows::Forms::TreeView; - this->myTextBox = gcnew System::Windows::Forms::TextBox; - this->myComboBox = gcnew System::Windows::Forms::ComboBox; - this->myLabel4 = gcnew System::Windows::Forms::Label; - this->myButton = gcnew System::Windows::Forms::Button; - this->myLabel1 = gcnew System::Windows::Forms::Label; - this->myLabel3 = gcnew System::Windows::Forms::Label; - this->SuspendLayout(); - - // - // myTreeView - // - this->myTreeView->ImageIndex = -1; - this->myTreeView->Location = System::Drawing::Point( 8, 16 ); - this->myTreeView->Name = "myTreeView"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->Size = System::Drawing::Size( 136, 328 ); - this->myTreeView->TabIndex = 0; - - // - // myTextBox - // - this->myTextBox->Location = System::Drawing::Point( 368, 96 ); - this->myTextBox->Name = "myTextBox"; - this->myTextBox->Size = System::Drawing::Size( 128, 20 ); - this->myTextBox->TabIndex = 9; - this->myTextBox->Text = "TestNode"; - - // - // myComboBox - // - this->myComboBox->DropDownWidth = 121; - array^temp0 = {"PreviousVisible","NextVisible","Previous","Next","First","Last"}; - this->myComboBox->Items->AddRange( temp0 ); - this->myComboBox->Location = System::Drawing::Point( 368, 24 ); - this->myComboBox->Name = "myComboBox"; - this->myComboBox->Size = System::Drawing::Size( 128, 21 ); - this->myComboBox->TabIndex = 1; - - // - // myLabel4 - // - this->myLabel4->Location = System::Drawing::Point( 152, 96 ); - this->myLabel4->Name = "myLabel4"; - this->myLabel4->Size = System::Drawing::Size( 192, 16 ); - this->myLabel4->TabIndex = 7; - this->myLabel4->Text = "Change text of selected TreeNode to"; - - // - // myButton - // - this->myButton->Location = System::Drawing::Point( 368, 152 ); - this->myButton->Name = "myButton"; - this->myButton->Size = System::Drawing::Size( 128, 23 ); - this->myButton->TabIndex = 2; - this->myButton->Text = "Apply"; - - // - // myLabel1 - // - this->myLabel1->Location = System::Drawing::Point( 152, 216 ); - this->myLabel1->Name = "myLabel1"; - this->myLabel1->Size = System::Drawing::Size( 408, 120 ); - this->myLabel1->TabIndex = 4; - - // - // myLabel3 - // - this->myLabel3->Location = System::Drawing::Point( 152, 32 ); - this->myLabel3->Name = "myLabel3"; - this->myLabel3->Size = System::Drawing::Size( 128, 16 ); - this->myLabel3->TabIndex = 6; - this->myLabel3->Text = "Select Font"; - - // - // MyTreeNodeForm - // - this->ClientSize = System::Drawing::Size( 624, 365 ); - array^temp1 = {this->myTextBox,this->myLabel4,this->myLabel3,this->myLabel1,this->myComboBox,this->myButton,this->myTreeView}; - this->Controls->AddRange( temp1 ); - this->Name = "MyTreeNodeForm"; - this->Text = "TreeNode class sample"; - this->ResumeLayout( false ); - } - -}; - -int main() -{ - Application::Run( gcnew MyTreeNodeForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp deleted file mode 100644 index 7bf27a1da89..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp +++ /dev/null @@ -1,188 +0,0 @@ - - -// System::Windows::Forms::TreeNode.ImageIndex -// System::Windows::Forms::TreeNode.SelectedImageIndex -// System::Windows::Forms::TreeView.ImageIndex -// System::Windows::Forms::TreeView::SelectedImageIndex -// System::Windows::Forms::TreeView::ImageList -// System::Windows::Forms::TreeNode::TreeNode(String*, int, int) -// System::Windows::Forms::TreeNode::TreeNode(String*, int, int, TreeNode[]) -/* -The following example demonstrates the constructors -'TreeNode(String*, int, int)' and 'TreeNode(String*, int, int, TreeNode[])' of -the 'TreeNode' class. This example displays customerinformation in a -'TreeView' control. The root tree nodes display customer names, and the -child tree nodes display the order numbers assigned to each customer. -*/ -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::Windows::Forms; - - -public ref class TreeNode_Checked: public Form -{ -private: - int rootImageIndex; - int selectedCustomerImageIndex; - int unselectedCustomerImageIndex; - int selectedOrderImageIndex; - int unselectedOrderImageIndex; - TreeView^ myTreeView; - - // ArrayList object to hold the 'Customer' objects. - ArrayList^ customerArray; - -public: - TreeNode_Checked() - { - customerArray = gcnew ArrayList; - InitializeComponent(); - FillMyTreeView(); - } - - -private: - void FillMyTreeView() - { - - // Add customers to the ArrayList of 'Customer' objects. - for ( int xIndex = 1; xIndex <= 5; xIndex++ ) - { - customerArray->Add( gcnew Customer( String::Concat( "Customer ", xIndex ) ) ); - - } - - // Add orders to each 'Customer' object in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ customer1 = safe_cast(myEnum->Current); - for ( int yIndex = 1; yIndex <= 5; yIndex++ ) - { - customer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", yIndex ) ) ); - - } - } - - myTreeView->BeginUpdate(); - - // Clear the TreeView each time the method is called. - myTreeView->Nodes->Clear(); - FillTreeView(); - - // Begin repainting the TreeView. - myTreeView->EndUpdate(); - } - - // -ref class Customer -{ -public: - ArrayList^ CustomerOrders; - String^ CustomerName; - Customer( String^ myName ) - { - CustomerName = myName; - CustomerOrders = gcnew ArrayList; - } - -}; - -ref class Order -{ -public: - String^ OrderID; - Order( String^ myOrderID ) - { - this->OrderID = myOrderID; - } - -}; - - void FillTreeView() - { - - // Load the images in an ImageList. - ImageList^ myImageList = gcnew ImageList; - myImageList->Images->Add( Image::FromFile( "Default.gif" ) ); - myImageList->Images->Add( Image::FromFile( "SelectedDefault.gif" ) ); - myImageList->Images->Add( Image::FromFile( "Root.gif" ) ); - myImageList->Images->Add( Image::FromFile( "UnselectedCustomer.gif" ) ); - myImageList->Images->Add( Image::FromFile( "SelectedCustomer.gif" ) ); - myImageList->Images->Add( Image::FromFile( "UnselectedOrder.gif" ) ); - myImageList->Images->Add( Image::FromFile( "SelectedOrder.gif" ) ); - - // Assign the ImageList to the TreeView. - myTreeView->ImageList = myImageList; - - // Set the TreeView control's default image and selected image indexes. - myTreeView->ImageIndex = 0; - myTreeView->SelectedImageIndex = 1; - - /* Set the index of image from the - ImageList for selected and unselected tree nodes.*/ - this->rootImageIndex = 2; - this->selectedCustomerImageIndex = 3; - this->unselectedCustomerImageIndex = 4; - this->selectedOrderImageIndex = 5; - this->unselectedOrderImageIndex = 6; - - // Create the root tree node. - TreeNode^ rootNode = gcnew TreeNode( "CustomerList" ); - rootNode->ImageIndex = rootImageIndex; - rootNode->SelectedImageIndex = rootImageIndex; - - // Add a main root tree node. - myTreeView->Nodes->Add( rootNode ); - - // Add a root tree node for each Customer object in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ myCustomer = safe_cast(myEnum->Current); - - // Add a child tree node for each Order object. - int countIndex = 0; - array^myTreeNodeArray = gcnew array(myCustomer->CustomerOrders->Count); - IEnumerator^ myEnum = myCustomer->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Order^ myOrder = safe_cast(myEnum->Current); - - // Add the Order tree node to the array. - myTreeNodeArray[ countIndex ] = gcnew TreeNode( myOrder->OrderID,unselectedOrderImageIndex,selectedOrderImageIndex ); - countIndex++; - } - TreeNode^ customerNode = gcnew TreeNode( myCustomer->CustomerName,unselectedCustomerImageIndex,selectedCustomerImageIndex,myTreeNodeArray ); - myTreeView->Nodes[ 0 ]->Nodes->Add( customerNode ); - } - } - // - - void InitializeComponent() - { - this->myTreeView = gcnew TreeView; - this->SuspendLayout(); - this->myTreeView->ImageIndex = -1; - this->myTreeView->Location = Point(8,0); - this->myTreeView->Name = "myTreeView"; - this->myTreeView->SelectedImageIndex = -1; - this->myTreeView->Size = System::Drawing::Size( 280, 152 ); - this->myTreeView->TabIndex = 0; - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Controls->Add( this->myTreeView ); - this->Name = "Form1"; - this->Text = "TreeNode Example"; - this->ResumeLayout( true ); - } -}; - -int main() -{ - Application::Run( gcnew TreeNode_Checked ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp deleted file mode 100644 index bb2ec655ad6..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp +++ /dev/null @@ -1,136 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace TN_Checked -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::Button^ button1; - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->treeView1 = gcnew System::Windows::Forms::TreeView; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // treeView1 - // - this->treeView1->CheckBoxes = true; - this->treeView1->ImageIndex = -1; - this->treeView1->Location = System::Drawing::Point( 8, 8 ); - this->treeView1->Name = "treeView1"; - array^temp0 = {gcnew System::Windows::Forms::TreeNode( "Node3" )}; - array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node2",temp0 ),gcnew System::Windows::Forms::TreeNode( "Node5" )}; - array^temp4 = {gcnew System::Windows::Forms::TreeNode( "Node1",temp1 )}; - array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp4 )}; - this->treeView1->Nodes->AddRange( temp3 ); - this->treeView1->SelectedImageIndex = -1; - this->treeView1->TabIndex = 0; - this->treeView1->AfterCheck += gcnew System::Windows::Forms::TreeViewEventHandler( this, &Form1::node_AfterCheck ); - this->treeView1->BeforeCheck += gcnew System::Windows::Forms::TreeViewCancelEventHandler( this, &Form1::treeView1_BeforeCheck ); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 24, 128 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 72, 24 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 200, 229 ); - array^temp5 = {this->button1,this->treeView1}; - this->Controls->AddRange( temp5 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Updates all child tree nodes recursively. - void CheckAllChildNodes( TreeNode^ treeNode, bool nodeChecked ) - { - IEnumerator^ myEnum = treeNode->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ node = safe_cast(myEnum->Current); - node->Checked = nodeChecked; - if ( node->Nodes->Count > 0 ) - { - - // If the current node has child nodes, call the CheckAllChildsNodes method recursively. - this->CheckAllChildNodes( node, nodeChecked ); - } - } - } - - // NOTE This code can be added to the BeforeCheck event handler instead of the AfterCheck event. - // After a tree node's Checked property is changed, all its child nodes are updated to the same value. - void node_AfterCheck( Object^ /*sender*/, TreeViewEventArgs^ e ) - { - // The code only executes if the user caused the checked state to change. - if ( e->Action != TreeViewAction::Unknown ) - { - if ( e->Node->Nodes->Count > 0 ) - { - /* Calls the CheckAllChildNodes method, passing in the current - Checked value of the TreeNode whose checked state changed. */ - this->CheckAllChildNodes( e->Node, e->Node->Checked ); - } - } - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->treeView1->Nodes[ 0 ]->Nodes[ 0 ]->Checked = true; - } - - void treeView1_BeforeCheck( Object^ /*sender*/, System::Windows::Forms::TreeViewCancelEventArgs^ e ) - { - MessageBox::Show( String::Concat( e->Node, "\n ", e->Action, "BeforeCheck" ) ); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew TN_Checked::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp deleted file mode 100644 index 8967c97f255..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp +++ /dev/null @@ -1,213 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace CustomerCodeExamples -{ - - public ref class TV1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::Button^ button1; - - // Create a new ArrayList to hold the Customer objects. - ArrayList^ customerArray; - - public: - TV1() - { - customerArray = gcnew ArrayList; - InitializeComponent(); - } - - - private: - void InitializeComponent() - { - this->treeView1 = gcnew System::Windows::Forms::TreeView; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // treeView1 - // - this->treeView1->ImageIndex = -1; - this->treeView1->Name = "treeView1"; - this->treeView1->SelectedImageIndex = -1; - this->treeView1->Size = System::Drawing::Size( 128, 240 ); - this->treeView1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 216, 248 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &TV1::button1_Click ); - - // - // TV1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->button1,this->treeView1}; - this->Controls->AddRange( temp0 ); - this->Name = "TV1"; - this->Text = "TV1"; - this->ResumeLayout( false ); - } - - // - // The basic Customer class. - ref class Customer: public System::Object - { - private: - String^ custName; - - protected: - ArrayList^ custOrders; - - public: - Customer( String^ customername ) - { - custName = ""; - custOrders = gcnew ArrayList; - this->custName = customername; - } - - - property String^ CustomerName - { - String^ get() - { - return this->custName; - } - - void set( String^ value ) - { - this->custName = value; - } - - } - - property ArrayList^ CustomerOrders - { - ArrayList^ get() - { - return this->custOrders; - } - - } - - }; - - - // End Customer class - // The basic customer Order class. - ref class Order: public System::Object - { - private: - String^ ordID; - - public: - Order( String^ orderid ) - { - ordID = ""; - this->ordID = orderid; - } - - - property String^ OrderID - { - String^ get() - { - return this->ordID; - } - - void set( String^ value ) - { - this->ordID = value; - } - - } - - }; - // End Order class - - - - void FillMyTreeView() - { - // Add customers to the ArrayList of Customer objects. - for ( int x = 0; x < 1000; x++ ) - { - customerArray->Add( gcnew Customer( "Customer " + x ) ); - } - - // Add orders to each Customer object in the ArrayList. - IEnumerator^ myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ customer1 = safe_cast(myEnum->Current); - for ( int y = 0; y < 15; y++ ) - { - customer1->CustomerOrders->Add( gcnew Order( "Order " + y ) ); - } - } - - // Display a wait cursor while the TreeNodes are being created. - ::Cursor::Current = gcnew System::Windows::Forms::Cursor( "MyWait.cur" ); - - // Suppress repainting the TreeView until all the objects have been created. - treeView1->BeginUpdate(); - - // Clear the TreeView each time the method is called. - treeView1->Nodes->Clear(); - - // Add a root TreeNode for each Customer object in the ArrayList. - myEnum = customerArray->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Customer^ customer2 = safe_cast(myEnum->Current); - treeView1->Nodes->Add( gcnew TreeNode( customer2->CustomerName ) ); - - // Add a child treenode for each Order object in the current Customer object. - IEnumerator^ myEnum = customer2->CustomerOrders->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Order^ order1 = safe_cast(myEnum->Current); - treeView1->Nodes[ customerArray->IndexOf( customer2 ) ]->Nodes->Add( gcnew TreeNode( customer2->CustomerName + "." + order1->OrderID ) ); - } - } - - // Reset the cursor to the default for all controls. - ::Cursor::Current = Cursors::Default; - - // Begin repainting the TreeView. - treeView1->EndUpdate(); - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->FillMyTreeView(); - } - }; -} -// End TV1 Class -// End NameSpace - -[STAThread] -int main() -{ - Application::Run( gcnew CustomerCodeExamples::TV1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp deleted file mode 100644 index f9f28aa57a0..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp +++ /dev/null @@ -1,89 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; - -// -public ref class CustomizedTreeView: public TreeView -{ -public: - CustomizedTreeView() - { - - // Customize the TreeView control by setting various properties. - BackColor = System::Drawing::Color::CadetBlue; - FullRowSelect = true; - HotTracking = true; - Indent = 34; - ShowPlusMinus = false; - - // The ShowLines property must be false for the FullRowSelect - // property to work. - ShowLines = false; - } - -protected: - virtual void OnAfterSelect( TreeViewEventArgs^ e ) override - { - // Confirm that the user initiated the selection. - // This prevents the first node from expanding when it is - // automatically selected during the initialization of - // the TreeView control. - if ( e->Action != TreeViewAction::Unknown ) - { - if ( e->Node->IsExpanded ) - { - e->Node->Collapse(); - } - else - { - e->Node->Expand(); - } - } - - - // Remove the selection. This allows the same node to be - // clicked twice in succession to toggle the expansion state. - SelectedNode = nullptr; - } -}; -// - -public ref class Form1: public System::Windows::Forms::Form -{ -public: - Form1() - { - // Initialize myTreeView. - CustomizedTreeView^ myTreeView = gcnew CustomizedTreeView; - myTreeView->Dock = DockStyle::Fill; - - // Add nodes to myTreeView. - TreeNode^ node; - for ( int x = 0; x < 3; ++x ) - { - // Add a root node. - node = myTreeView->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); - for ( int y = 1; y < 4; ++y ) - { - // Add a node as a child of the previously added node. - node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); - - } - } - - // Add myTreeView to the form. - this->Controls->Add( myTreeView ); - } -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp deleted file mode 100644 index b4eea2c87c2..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp +++ /dev/null @@ -1,156 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TreeView^ treeView1; - -public: - Form1() - { - treeView1 = gcnew TreeView; - this->SuspendLayout(); - - // Initialize treeView1. - treeView1->AllowDrop = true; - treeView1->Dock = DockStyle::Fill; - - // Add nodes to treeView1. - TreeNode^ node; - for ( int x = 0; x < 3; ++x ) - { - - // Add a root node to treeView1. - node = treeView1->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); - for ( int y = 1; y < 4; ++y ) - { - - // Add a child node to the previously added node. - node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); - - } - } - - // Add event handlers for the required drag events. - treeView1->ItemDrag += gcnew ItemDragEventHandler( this, &Form1::treeView1_ItemDrag ); - treeView1->DragEnter += gcnew DragEventHandler( this, &Form1::treeView1_DragEnter ); - treeView1->DragOver += gcnew DragEventHandler( this, &Form1::treeView1_DragOver ); - treeView1->DragDrop += gcnew DragEventHandler( this, &Form1::treeView1_DragDrop ); - - // Initialize the form. - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Controls->Add( treeView1 ); - this->ResumeLayout( false ); - } - - // -private: - void treeView1_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^ e ) - { - - // Move the dragged node when the left mouse button is used. - if ( e->Button == ::MouseButtons::Left ) - { - DoDragDrop( e->Item, DragDropEffects::Move ); - } - // Copy the dragged node when the right mouse button is used. - else - - // Copy the dragged node when the right mouse button is used. - if ( e->Button == ::MouseButtons::Right ) - { - DoDragDrop( e->Item, DragDropEffects::Copy ); - } - } - // - - // Set the target drop effect to the effect - // specified in the ItemDrag event handler. - void treeView1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) - { - e->Effect = e->AllowedEffect; - } - - // Select the node under the mouse pointer to indicate the - // expected drop location. - void treeView1_DragOver( Object^ /*sender*/, DragEventArgs^ e ) - { - // Retrieve the client coordinates of the mouse position. - Point targetPoint = treeView1->PointToClient( Point(e->X,e->Y) ); - - // Select the node at the mouse position. - treeView1->SelectedNode = treeView1->GetNodeAt( targetPoint ); - } - - void treeView1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) - { - // Retrieve the client coordinates of the drop location. - Point targetPoint = treeView1->PointToClient( Point(e->X,e->Y) ); - - // Retrieve the node at the drop location. - TreeNode^ targetNode = treeView1->GetNodeAt( targetPoint ); - - // Retrieve the node that was dragged. - TreeNode^ draggedNode = dynamic_cast(e->Data->GetData( TreeNode::typeid )); - - // Confirm that the node at the drop location is not - // the dragged node or a descendant of the dragged node. - if ( !draggedNode->Equals( targetNode ) && !ContainsNode( draggedNode, targetNode ) ) - { - - // If it is a move operation, remove the node from its current - // location and add it to the node at the drop location. - if ( e->Effect == DragDropEffects::Move ) - { - draggedNode->Remove(); - targetNode->Nodes->Add( draggedNode ); - } - // If it is a copy operation, clone the dragged node - // and add it to the node at the drop location. - else - - // If it is a copy operation, clone the dragged node - // and add it to the node at the drop location. - if ( e->Effect == DragDropEffects::Copy ) - { - targetNode->Nodes->Add( dynamic_cast(draggedNode->Clone()) ); - } - - // Expand the node at the location - // to show the dropped node. - targetNode->Expand(); - } - } - - // Determine whether one node is a parent - // or ancestor of a second node. - bool ContainsNode( TreeNode^ node1, TreeNode^ node2 ) - { - // Check the parent node of the second node. - if ( node2->Parent == nullptr ) - return false; - - if ( node2->Parent->Equals( node1 ) ) - return true; - - // If the parent node is not null or equal to the first node, - // call the ContainsNode method recursively using the parent of - // the second node. - return ContainsNode( node1, node2->Parent ); - } -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp deleted file mode 100644 index 594b9185e7b..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp +++ /dev/null @@ -1,175 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class TreeViewOwnerDraw: public Form -{ -private: - TreeView^ myTreeView; - - // Create a Font object for the node tags. - System::Drawing::Font^ tagFont; - -public: - - // - TreeViewOwnerDraw() - { - tagFont = gcnew System::Drawing::Font( "Helvetica",8,FontStyle::Bold ); - - // Create and initialize the TreeView control. - myTreeView = gcnew TreeView; - myTreeView->Dock = DockStyle::Fill; - myTreeView->BackColor = Color::Tan; - myTreeView->CheckBoxes = true; - - // Add nodes to the TreeView control. - TreeNode^ node; - for ( int x = 1; x < 4; ++x ) - { - // Add a root node to the TreeView control. - node = myTreeView->Nodes->Add( String::Format( "Task {0}", x ) ); - for ( int y = 1; y < 4; ++y ) - { - // Add a child node to the root node. - node->Nodes->Add( String::Format( "Subtask {0}", y ) ); - } - } - myTreeView->ExpandAll(); - - // Add tags containing alert messages to a few nodes - // and set the node background color to highlight them. - myTreeView->Nodes[ 1 ]->Nodes[ 0 ]->Tag = "urgent!"; - myTreeView->Nodes[ 1 ]->Nodes[ 0 ]->BackColor = Color::Yellow; - myTreeView->SelectedNode = myTreeView->Nodes[ 1 ]->Nodes[ 0 ]; - myTreeView->Nodes[ 2 ]->Nodes[ 1 ]->Tag = "urgent!"; - myTreeView->Nodes[ 2 ]->Nodes[ 1 ]->BackColor = Color::Yellow; - - // Configure the TreeView control for owner-draw and add - // a handler for the DrawNode event. - myTreeView->DrawMode = TreeViewDrawMode::OwnerDrawText; - myTreeView->DrawNode += gcnew DrawTreeNodeEventHandler( this, &TreeViewOwnerDraw::myTreeView_DrawNode ); - - // Add a handler for the MouseDown event so that a node can be - // selected by clicking the tag text as well as the node text. - myTreeView->MouseDown += gcnew MouseEventHandler( this, &TreeViewOwnerDraw::myTreeView_MouseDown ); - - // Initialize the form and add the TreeView control to it. - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Controls->Add( myTreeView ); - } - // - -protected: - // Clean up any resources being used. - ~TreeViewOwnerDraw() - { - if ( tagFont != nullptr ) - { - delete tagFont; - } - } - - // - // Draws a node. -private: - void myTreeView_DrawNode( Object^ sender, DrawTreeNodeEventArgs^ e ) - { - // Draw the background and node text for a selected node. - if ( (e->State & TreeNodeStates::Selected) != (TreeNodeStates)0 ) - { - // Draw the background of the selected node. The NodeBounds - // method makes the highlight rectangle large enough to - // include the text of a node tag, if one is present. - e->Graphics->FillRectangle( Brushes::Green, NodeBounds( e->Node ) ); - - // Retrieve the node font. If the node font has not been set, - // use the TreeView font. - System::Drawing::Font^ nodeFont = e->Node->NodeFont; - if ( nodeFont == nullptr ) - nodeFont = (dynamic_cast(sender))->Font; - - // Draw the node text. - e->Graphics->DrawString( e->Node->Text, nodeFont, Brushes::White, Rectangle::Inflate( e->Bounds, 2, 0 ) ); - } - // Use the default background and node text. - else - { - e->DrawDefault = true; - } - - // If a node tag is present, draw its string representation - // to the right of the label text. - if ( e->Node->Tag != nullptr ) - { - e->Graphics->DrawString( e->Node->Tag->ToString(), tagFont, Brushes::Yellow, (float)e->Bounds.Right + 2, (float)e->Bounds.Top ); - } - - - // If the node has focus, draw the focus rectangle large, making - // it large enough to include the text of the node tag, if present. - if ( (e->State & TreeNodeStates::Focused) != (TreeNodeStates)0 ) - { - Pen^ focusPen = gcnew Pen( Color::Black ); - try - { - focusPen->DashStyle = System::Drawing::Drawing2D::DashStyle::Dot; - Rectangle focusBounds = NodeBounds( e->Node ); - focusBounds.Size = System::Drawing::Size( focusBounds.Width - 1, focusBounds.Height - 1 ); - e->Graphics->DrawRectangle( focusPen, focusBounds ); - } - finally - { - if ( focusPen ) - delete safe_cast(focusPen); - } - - } - } - // - - // Selects a node that is clicked on its label or tag text. - void myTreeView_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) - { - TreeNode^ clickedNode = myTreeView->GetNodeAt( e->X, e->Y ); - if ( NodeBounds( clickedNode ).Contains( e->X, e->Y ) ) - { - myTreeView->SelectedNode = clickedNode; - } - } - - // Returns the bounds of the specified node, including the region - // occupied by the node label and any node tag displayed. - Rectangle NodeBounds( TreeNode^ node ) - { - // Set the return value to the normal node bounds. - Rectangle bounds = node->Bounds; - if ( node->Tag != nullptr ) - { - // Retrieve a Graphics object from the TreeView handle - // and use it to calculate the display width of the tag. - Graphics^ g = myTreeView->CreateGraphics(); - int tagWidth = (int)g->MeasureString( node->Tag->ToString(), tagFont ).Width + 6; - - // Adjust the node bounds using the calculated value. - bounds.Offset( tagWidth / 2, 0 ); - bounds = Rectangle::Inflate( bounds, tagWidth / 2, 0 ); - g->~Graphics(); - } - - return bounds; - } -}; - -[STAThreadAttribute] -int main() -{ - Application::Run( gcnew TreeViewOwnerDraw ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp deleted file mode 100644 index 56e4a1fdb32..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp +++ /dev/null @@ -1,126 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TreeView^ treeView1; - Button^ showCheckedNodesButton; - TreeViewCancelEventHandler^ checkForCheckedChildren; - -public: - Form1() - { - treeView1 = gcnew TreeView; - showCheckedNodesButton = gcnew Button; - checkForCheckedChildren = gcnew TreeViewCancelEventHandler( this, &Form1::CheckForCheckedChildrenHandler ); - this->SuspendLayout(); - - // Initialize treeView1. - treeView1->Location = Point(0,25); - treeView1->Size = System::Drawing::Size( 292, 248 ); - treeView1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Right); - treeView1->CheckBoxes = true; - - // Add nodes to treeView1. - TreeNode^ node; - for ( int x = 0; x < 3; ++x ) - { - - // Add a root node. - node = treeView1->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); - for ( int y = 1; y < 4; ++y ) - { - - // Add a node as a child of the previously added node. - node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); - - } - } - - // Set the checked state of one of the nodes to - // demonstrate the showCheckedNodesButton button behavior. - treeView1->Nodes[ 1 ]->Nodes[ 0 ]->Nodes[ 0 ]->Checked = true; - - // Initialize showCheckedNodesButton. - showCheckedNodesButton->Size = System::Drawing::Size( 144, 24 ); - showCheckedNodesButton->Text = "Show Checked Nodes"; - showCheckedNodesButton->Click += gcnew EventHandler( this, &Form1::showCheckedNodesButton_Click ); - - // Initialize the form. - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {showCheckedNodesButton,treeView1}; - this->Controls->AddRange( temp0 ); - this->ResumeLayout( false ); - } - - // -private: - void showCheckedNodesButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Disable redrawing of treeView1 to prevent flickering - // while changes are made. - treeView1->BeginUpdate(); - - // Collapse all nodes of treeView1. - treeView1->CollapseAll(); - - // Add the checkForCheckedChildren event handler to the BeforeExpand event. - treeView1->BeforeExpand += checkForCheckedChildren; - - // Expand all nodes of treeView1. Nodes without checked children are - // prevented from expanding by the checkForCheckedChildren event handler. - treeView1->ExpandAll(); - - // Remove the checkForCheckedChildren event handler from the BeforeExpand - // event so manual node expansion will work correctly. - treeView1->BeforeExpand -= checkForCheckedChildren; - - // Enable redrawing of treeView1. - treeView1->EndUpdate(); - } - - // Prevent expansion of a node that does not have any checked child nodes. - void CheckForCheckedChildrenHandler( Object^ /*sender*/, TreeViewCancelEventArgs^ e ) - { - if ( !HasCheckedChildNodes( e->Node ) ) - e->Cancel = true; - } - - - // Returns a value indicating whether the specified - // TreeNode has checked child nodes. - bool HasCheckedChildNodes( TreeNode^ node ) - { - if ( node->Nodes->Count == 0 ) - return false; - - System::Collections::IEnumerator^ myEnum = node->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ childNode = safe_cast(myEnum->Current); - if ( childNode->Checked ) - return true; - - // Recursively check the children of the current child node. - if ( HasCheckedChildNodes( childNode ) ) - return true; - } - - return false; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp deleted file mode 100644 index 42b3ee4aea9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp +++ /dev/null @@ -1,127 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Windows::Forms; -public ref class Form1: public Form -{ -private: - TreeView^ treeView1; - Button^ showCheckedNodesButton; - TreeViewCancelEventHandler^ checkForCheckedChildren; - -public: - Form1() - { - treeView1 = gcnew TreeView; - showCheckedNodesButton = gcnew Button; - checkForCheckedChildren = gcnew TreeViewCancelEventHandler( this, &Form1::CheckForCheckedChildrenHandler ); - this->SuspendLayout(); - - // Initialize treeView1. - treeView1->Location = Point(0,25); - treeView1->Size = System::Drawing::Size( 292, 248 ); - treeView1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Right); - treeView1->CheckBoxes = true; - - // Add nodes to treeView1. - TreeNode^ node; - for ( int x = 0; x < 3; ++x ) - { - - // Add a root node. - node = treeView1->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); - for ( int y = 1; y < 4; ++y ) - { - - // Add a node as a child of the previously added node. - node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); - - } - - } - - // Set the checked state of one of the nodes to - // demonstrate the showCheckedNodesButton button behavior. - treeView1->Nodes[ 1 ]->Nodes[ 0 ]->Nodes[ 0 ]->Checked = true; - - // Initialize showCheckedNodesButton. - showCheckedNodesButton->Size = System::Drawing::Size( 144, 24 ); - showCheckedNodesButton->Text = "Show Checked Nodes"; - showCheckedNodesButton->Click += gcnew EventHandler( this, &Form1::showCheckedNodesButton_Click ); - - // Initialize the form. - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp1 = {showCheckedNodesButton,treeView1}; - this->Controls->AddRange( temp1 ); - this->ResumeLayout( false ); - } - - // -private: - void showCheckedNodesButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - - // Disable redrawing of treeView1 to prevent flickering - // while changes are made. - treeView1->BeginUpdate(); - - // Collapse all nodes of treeView1. - treeView1->ExpandAll(); - - // Add the checkForCheckedChildren event handler to the BeforeExpand event. - treeView1->BeforeCollapse += checkForCheckedChildren; - - // Expand all nodes of treeView1. Nodes without checked children are - // prevented from expanding by the checkForCheckedChildren event handler. - treeView1->CollapseAll(); - - // Remove the checkForCheckedChildren event handler from the BeforeExpand - // event so manual node expansion will work correctly. - treeView1->BeforeCollapse -= checkForCheckedChildren; - - // Enable redrawing of treeView1. - treeView1->EndUpdate(); - } - - // Prevent collapse of a node that has checked child nodes. - void CheckForCheckedChildrenHandler( Object^ /*sender*/, TreeViewCancelEventArgs^ e ) - { - if ( HasCheckedChildNodes( e->Node ) ) - e->Cancel = true; - } - - // Returns a value indicating whether the specified - // TreeNode has checked child nodes. - bool HasCheckedChildNodes( TreeNode^ node ) - { - if ( node->Nodes->Count == 0 ) - return false; - - System::Collections::IEnumerator^ myEnum = node->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ childNode = safe_cast(myEnum->Current); - if ( childNode->Checked ) - return true; - - // Recursively check the children of the current child node. - if ( HasCheckedChildNodes( childNode ) ) - return true; - } - - return false; - } - // -}; - -int main() -{ - Application::Run( gcnew Form1 ); -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp b/snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp deleted file mode 100644 index 435550d8e86..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp +++ /dev/null @@ -1,25 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; - -namespace WarningEx -{ - public ref class WarningEx_Doc - { - public: - static void Main() - { - // - WarningException^ myEx = gcnew WarningException( "This is a warning" ); - Console::WriteLine( myEx->Message ); - Console::WriteLine( myEx->ToString() ); - // - } - }; -} - -int main() -{ - WarningEx::WarningEx_Doc::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp b/snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp deleted file mode 100644 index 6a9fbbd08fc..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Security::Permissions; - -//using System.Diagnostics; - -namespace Win32Exception_CPP -{ - public ref class Class1 - { - public: - [PermissionSet(SecurityAction::Demand, Name="FullTrust")] - static void Main() - { - // - try - { - System::Diagnostics::Process^ myProc = gcnew System::Diagnostics::Process; - //Attempting to start a non-existing executable - myProc->StartInfo->FileName = "c:\nonexist.exe"; - //Start the application and assign it to the process component. - myProc->Start(); - } - catch ( Win32Exception^ w ) - { - Console::WriteLine( w->Message ); - Console::WriteLine( w->ErrorCode ); - Console::WriteLine( w->NativeErrorCode ); - Console::WriteLine( w->StackTrace ); - Console::WriteLine( w->Source ); - Exception^ e = w->GetBaseException(); - Console::WriteLine( e->Message ); - } - // - } - }; -} - -int main() -{ - Win32Exception_CPP::Class1::Main(); -} - diff --git a/snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp deleted file mode 100644 index 5d5c89c213f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp +++ /dev/null @@ -1,69 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ResizeEvent -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Resize += gcnew System::EventHandler( this, &Form1::Form1_Resize ); - } - - // - private: - void Form1_Resize( Object^ sender, System::EventArgs^ /*e*/ ) - { - Control^ control = dynamic_cast(sender); - - // Ensure the Form remains square (Height = Width). - if ( control->Size.Height != control->Size.Width ) - { - control->Size = System::Drawing::Size( control->Size.Width, control->Size.Width ); - } - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ResizeEvent::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp b/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp deleted file mode 100644 index 5e8ce372a35..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp +++ /dev/null @@ -1,150 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -namespace IWindowsFormsEditorServiceExample -{ - // Example Form for entering a string. - private ref class StringInputDialog: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ ok_button; - System::Windows::Forms::Button^ cancel_button; - - public: - System::Windows::Forms::TextBox^ inputTextBox; - StringInputDialog( String^ text ) - { - InitializeComponent(); - inputTextBox->Text = text; - } - - private: - void InitializeComponent() - { - this->ok_button = gcnew System::Windows::Forms::Button; - this->cancel_button = gcnew System::Windows::Forms::Button; - this->inputTextBox = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->ok_button->Location = System::Drawing::Point( 180, 43 ); - this->ok_button->Name = "ok_button"; - this->ok_button->TabIndex = 1; - this->ok_button->Text = "OK"; - this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; - this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->cancel_button->Location = System::Drawing::Point( 260, 43 ); - this->cancel_button->Name = "cancel_button"; - this->cancel_button->TabIndex = 2; - this->cancel_button->Text = "Cancel"; - this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; - this->inputTextBox->Location = System::Drawing::Point( 6, 9 ); - this->inputTextBox->Name = "inputTextBox"; - this->inputTextBox->Size = System::Drawing::Size( 327, 20 ); - this->inputTextBox->TabIndex = 0; - this->inputTextBox->Text = ""; - this->inputTextBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->ClientSize = System::Drawing::Size( 342, 73 ); - array^temp0 = {this->inputTextBox,this->cancel_button,this->ok_button}; - this->Controls->AddRange( temp0 ); - this->MinimumSize = System::Drawing::Size( 350, 100 ); - this->Name = "StringInputDialog"; - this->Text = "String Input Dialog"; - this->ResumeLayout( false ); - } - }; - - // Example UITypeEditor that uses the IWindowsFormsEditorService - // to display a Form. - [PermissionSet(SecurityAction::Demand, Name = "FullTrust")] - public ref class TestDialogEditor: public System::Drawing::Design::UITypeEditor - { - public: - TestDialogEditor(){} - - virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle( System::ComponentModel::ITypeDescriptorContext^ context ) override - { - // Indicates that this editor can display a Form-based interface. - return UITypeEditorEditStyle::Modal; - } - - virtual Object^ EditValue( System::ComponentModel::ITypeDescriptorContext^ context, System::IServiceProvider^ provider, Object^ value ) override - { - // Attempts to obtain an IWindowsFormsEditorService. - IWindowsFormsEditorService^ edSvc = dynamic_cast(provider->GetService( IWindowsFormsEditorService::typeid )); - if ( edSvc == nullptr ) - return nullptr; - - // Displays a StringInputDialog Form to get a user-adjustable - // string value. - StringInputDialog^ form = gcnew StringInputDialog( dynamic_cast(value) ); - if ( edSvc->ShowDialog( form ) == DialogResult::OK ) - return form->inputTextBox->Text; - - // If OK was not pressed, return the original value - return value; - } - }; - - // Provides an example control that displays instructions in design mode, - // with which the example UITypeEditor is associated. - public ref class WinFormsEdServiceDialogExampleControl: public UserControl - { - public: - - property String^ TestDialogString - { - [EditorAttribute(IWindowsFormsEditorServiceExample::TestDialogEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return localDialogTestString; - } - - void set( String^ value ) - { - localDialogTestString = value; - } - } - - private: - String^ localDialogTestString; - - public: - WinFormsEdServiceDialogExampleControl() - { - localDialogTestString = "Test String"; - this->Size = System::Drawing::Size( 210, 74 ); - this->BackColor = Color::Beige; - } - - protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - if ( this->DesignMode ) - { - e->Graphics->DrawString( "Use the Properties window to show", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); - e->Graphics->DrawString( "a Form dialog box, using the", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 17 ); - e->Graphics->DrawString( "IWindowsFormsEditorService, for", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 29 ); - e->Graphics->DrawString( "configuring this control's", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 41 ); - e->Graphics->DrawString( "TestDialogString property.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 53 ); - } - else - { - e->Graphics->DrawString( "This example requires design mode.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp b/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp deleted file mode 100644 index 18b0f70e3f3..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp +++ /dev/null @@ -1,159 +0,0 @@ - - -// -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::ComponentModel::Design; -using namespace System::Drawing; -using namespace System::Drawing::Design; -using namespace System::Windows::Forms; -using namespace System::Windows::Forms::Design; -using namespace System::Security::Permissions; - -namespace IWindowsFormsEditorServiceExample -{ - // Example control for entering a string. - private ref class StringInputControl: public UserControl - { - public: - System::Windows::Forms::TextBox^ inputTextBox; - - private: - System::Windows::Forms::Button^ ok_button; - System::Windows::Forms::Button^ cancel_button; - IWindowsFormsEditorService^ edSvc; - - public: - StringInputControl( String^ text, IWindowsFormsEditorService^ edSvc ) - { - InitializeComponent(); - inputTextBox->Text = text; - - // Stores IWindowsFormsEditorService reference to use to - // close the control. - this->edSvc = edSvc; - } - - private: - void InitializeComponent() - { - this->inputTextBox = gcnew System::Windows::Forms::TextBox; - this->ok_button = gcnew System::Windows::Forms::Button; - this->cancel_button = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - this->inputTextBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); - this->inputTextBox->Location = System::Drawing::Point( 6, 7 ); - this->inputTextBox->Name = "inputTextBox"; - this->inputTextBox->Size = System::Drawing::Size( 336, 20 ); - this->inputTextBox->TabIndex = 0; - this->inputTextBox->Text = ""; - this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; - this->ok_button->Location = System::Drawing::Point( 186, 38 ); - this->ok_button->Name = "ok_button"; - this->ok_button->TabIndex = 1; - this->ok_button->Text = "OK"; - this->ok_button->Click += gcnew EventHandler( this, &StringInputControl::CloseControl ); - this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; - this->cancel_button->Location = System::Drawing::Point( 267, 38 ); - this->cancel_button->Name = "cancel_button"; - this->cancel_button->TabIndex = 2; - this->cancel_button->Text = "Cancel"; - this->cancel_button->Click += gcnew EventHandler( this, &StringInputControl::CloseControl ); - array^temp0 = {this->cancel_button,this->ok_button,this->inputTextBox}; - this->Controls->AddRange( temp0 ); - this->Name = "StringInputControl"; - this->Size = System::Drawing::Size( 350, 70 ); - this->ResumeLayout( false ); - } - - void CloseControl( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - edSvc->CloseDropDown(); - } - }; - - // Example UITypeEditor that uses the IWindowsFormsEditorService to - // display a drop-down control. - [PermissionSet(SecurityAction::Demand, Name = "FullTrust")] - public ref class TestDropDownEditor: public System::Drawing::Design::UITypeEditor - { - public: - TestDropDownEditor(){} - - virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle( System::ComponentModel::ITypeDescriptorContext^ /*context*/ ) override - { - // Indicates that this editor can display a control-based - // drop-down interface. - return UITypeEditorEditStyle::DropDown; - } - - virtual Object^ EditValue( System::ComponentModel::ITypeDescriptorContext^ /*context*/, System::IServiceProvider^ provider, Object^ value ) override - { - // Attempts to obtain an IWindowsFormsEditorService. - IWindowsFormsEditorService^ edSvc = dynamic_cast(provider->GetService( IWindowsFormsEditorService::typeid )); - if ( edSvc == nullptr ) - return value; - - // Displays a drop-down control. - StringInputControl^ inputControl = gcnew StringInputControl( dynamic_cast(value),edSvc ); - edSvc->DropDownControl( inputControl ); - return inputControl->inputTextBox->Text; - } - }; - - // Provides an example control that displays instructions in design mode, - // with which the example UITypeEditor is associated. - public ref class WinFormsEdServiceDropDownExampleControl: public UserControl - { - public: - - property String^ TestDropDownString - { - [EditorAttribute(IWindowsFormsEditorServiceExample::TestDropDownEditor::typeid,UITypeEditor::typeid)] - String^ get() - { - return localDropDownTestString; - } - - void set( String^ value ) - { - localDropDownTestString = value; - } - } - - private: - String^ localDropDownTestString; - - public: - WinFormsEdServiceDropDownExampleControl() - { - localDropDownTestString = "Test String"; - this->Size = System::Drawing::Size( 210, 74 ); - this->BackColor = Color::Beige; - } - - protected: - virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override - { - if ( this->DesignMode ) - { - e->Graphics->DrawString( "Use the Properties window to show", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); - e->Graphics->DrawString( "a drop-down control, using the", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 17 ); - e->Graphics->DrawString( "IWindowsFormsEditorService, for", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 29 ); - e->Graphics->DrawString( "configuring this control's", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 41 ); - e->Graphics->DrawString( "TestDropDownString property.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 53 ); - } - else - { - e->Graphics->DrawString( "This example requires design mode.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); - } - } - }; -} -// diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp deleted file mode 100644 index f8b6439ab50..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp +++ /dev/null @@ -1,161 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::Button^ button3; - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - InitializeComponent(); - } - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->button2 = gcnew System::Windows::Forms::Button; - this->button3 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 40, 48 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 40, 112 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 1; - this->button2->Text = "button2"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // button3 - // - this->button3->Location = System::Drawing::Point( 40, 184 ); - this->button3->Name = "button3"; - this->button3->TabIndex = 2; - this->button3->Text = "button3"; - this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - - // - // Form1 - // - this->AutoScroll = true; - this->ClientSize = System::Drawing::Size( 368, 325 ); - array^temp0 = {this->button3,this->button2,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->SizeControls(); - } - - // Control.Size/Control.ClientSize/Control.SetClientSizeCore - // -private: - void SizeControls() - { - // Resize the buttons two different ways. - button1->Size = System::Drawing::Size( 75, 25 ); - button2->ClientSize = System::Drawing::Size( 100, 50 ); - - // Resize the form. - this->SetClientSizeCore( 300, 300 ); - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->ResizeForm(); - } - - /* Control.ClientRectangle/Control.Bounds/Rectangle.Inflate/ - * Control.ScrollControlIntoView/Control.AutoScroll */ - // -private: - void ResizeForm() - { - - // Enable auto-scrolling for the form. - this->AutoScroll = true; - - // Resize the form. - Rectangle r = this->ClientRectangle; - - // Subtract 100 pixels from each side of the Rectangle. - r.Inflate( -100, -100 ); - this->Bounds = this->RectangleToScreen( r ); - - // Make sure button2 is visible. - this->ScrollControlIntoView( button2 ); - } - // - - void button2_Click( Object^ sender, System::EventArgs^ /*e*/ ) - { - this->AutoSizeControl( dynamic_cast(sender), 5 ); - } - - /* Control.CreateGraphics/Control.Text/Control.Font/ - * Control.Height/Control.Width/Control.ClientSize */ - // -private: - void AutoSizeControl( Control^ control, int textPadding ) - { - - // Create a Graphics object for the Control. - Graphics^ g = control->CreateGraphics(); - - // Get the Size needed to accommodate the formatted Text. - System::Drawing::Size preferredSize = g->MeasureString( control->Text, control->Font ).ToSize(); - - // Pad the text and resize the control. - control->ClientSize = System::Drawing::Size( preferredSize.Width + (textPadding * 2), preferredSize.Height + (textPadding * 2) ); - - // Clean up the Graphics object. - delete g; - } - // -}; - -[STAThread] -int main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp deleted file mode 100644 index b4b3ffa91e1..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp +++ /dev/null @@ -1,289 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ControlMembers3 -{ - public ref class CustomerForm: public System::Windows::Forms::Form - { - public: - String^ UserName; - }; - - public ref class Customer - { - public: - String^ Name; - int AccountNumber; - virtual String^ ToString() override - { - return String::Concat( AccountNumber, "\r\n ", Name ); - } - }; - - public ref class AboutDialog: public System::Windows::Forms::Form - { - public: - String^ FormText; - }; - - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::MainMenu^ mainMenu1; - System::Windows::Forms::MenuItem^ menuItemHelp; - System::Windows::Forms::MenuItem^ menuItemHelpAbout; - System::Windows::Forms::Button^ buttonNewCustomer; - System::Windows::Forms::MenuItem^ menuItemEditInsertCustomerInfo; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::MenuItem^ menuItemEdit; - System::Windows::Forms::MenuItem^ menuItemEditFontArial; - System::Windows::Forms::MenuItem^ menuItemEditFontTimeNewRoman; - System::Windows::Forms::MenuItem^ menuItemEditFont; - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - InitializeComponent(); - Customer^ cust = gcnew Customer; - cust->Name = "Microsoft"; - cust->AccountNumber = 123456; - this->Tag = cust; - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; - this->menuItemHelp = gcnew System::Windows::Forms::MenuItem; - this->menuItemHelpAbout = gcnew System::Windows::Forms::MenuItem; - this->buttonNewCustomer = gcnew System::Windows::Forms::Button; - this->menuItemEdit = gcnew System::Windows::Forms::MenuItem; - this->menuItemEditInsertCustomerInfo = gcnew System::Windows::Forms::MenuItem; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->menuItemEditFont = gcnew System::Windows::Forms::MenuItem; - this->menuItemEditFontArial = gcnew System::Windows::Forms::MenuItem; - this->menuItemEditFontTimeNewRoman = gcnew System::Windows::Forms::MenuItem; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 56, 168 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "New Form"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // mainMenu1 - // - array^temp0 = {this->menuItemHelp,this->menuItemEdit}; - this->mainMenu1->MenuItems->AddRange( temp0 ); - - // - // menuItemHelp - // - this->menuItemHelp->Index = 0; - array^temp1 = {this->menuItemHelpAbout}; - this->menuItemHelp->MenuItems->AddRange( temp1 ); - this->menuItemHelp->Text = "Help"; - - // - // menuItemHelpAbout - // - this->menuItemHelpAbout->Index = 0; - this->menuItemHelpAbout->Text = "About"; - this->menuItemHelpAbout->Click += gcnew System::EventHandler( this, &Form1::menuItemHelpAbout_Click ); - - // - // buttonNewCustomer - // - this->buttonNewCustomer->Location = System::Drawing::Point( 144, 168 ); - this->buttonNewCustomer->Name = "buttonNewCustomer"; - this->buttonNewCustomer->Size = System::Drawing::Size( 72, 24 ); - this->buttonNewCustomer->TabIndex = 1; - this->buttonNewCustomer->Text = "New Customer"; - this->buttonNewCustomer->Click += gcnew System::EventHandler( this, &Form1::buttonNewCustomer_Click ); - - // - // menuItemEdit - // - this->menuItemEdit->Index = 1; - array^temp2 = {this->menuItemEditInsertCustomerInfo,this->menuItemEditFont}; - this->menuItemEdit->MenuItems->AddRange( temp2 ); - this->menuItemEdit->Text = "Edit"; - this->menuItemEdit->Popup += gcnew System::EventHandler( this, &Form1::menuItemEdit_Popup ); - - // - // menuItemEditInsertCustomerInfo - // - this->menuItemEditInsertCustomerInfo->Enabled = false; - this->menuItemEditInsertCustomerInfo->Index = 0; - this->menuItemEditInsertCustomerInfo->Text = "Insert Customer Information"; - this->menuItemEditInsertCustomerInfo->Click += gcnew System::EventHandler( this, &Form1::menuItemEditInsertCustomerInfo_Click ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 56, 96 ); - this->textBox1->Multiline = true; - this->textBox1->Name = "textBox1"; - this->textBox1->Size = System::Drawing::Size( 160, 64 ); - this->textBox1->TabIndex = 2; - this->textBox1->Text = ""; - - // - // menuItemEditFont - // - this->menuItemEditFont->Index = 1; - array^temp3 = {this->menuItemEditFontArial,this->menuItemEditFontTimeNewRoman}; - this->menuItemEditFont->MenuItems->AddRange( temp3 ); - this->menuItemEditFont->Text = "Font"; - - // - // menuItemEditFontArial - // - this->menuItemEditFontArial->Index = 0; - this->menuItemEditFontArial->Text = "Arial"; - this->menuItemEditFontArial->Click += gcnew System::EventHandler( this, &Form1::menuItemEditFont_Click ); - - // - // menuItemEditFontTimeNewRoman - // - this->menuItemEditFontTimeNewRoman->Index = 1; - this->menuItemEditFontTimeNewRoman->Text = "Times New Roman"; - this->menuItemEditFontTimeNewRoman->Click += gcnew System::EventHandler( this, &Form1::menuItemEditFont_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp4 = {this->textBox1,this->buttonNewCustomer,this->button1}; - this->Controls->AddRange( temp4 ); - this->Menu = this->mainMenu1; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - AddButtons(); - } - - // - private: - void menuItemHelpAbout_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Create and display a modeless about dialog box. - AboutDialog^ about = gcnew AboutDialog; - about->Show(); - - // Draw a blue square on the form. - /* NOTE: This is not a persistent object, it will no longer be - * visible after the next call to OnPaint. To make it persistent, - * override the OnPaint method and draw the square there */ - Graphics^ g = about->CreateGraphics(); - g->FillRectangle( Brushes::Blue, 10, 10, 50, 50 ); - } - // - - // - private: - void AddButtons() - { - // Suspend the form layout and add two buttons. - this->SuspendLayout(); - Button^ buttonOK = gcnew Button; - buttonOK->Location = Point(10,10); - buttonOK->Size = System::Drawing::Size( 75, 25 ); - buttonOK->Text = "OK"; - Button^ buttonCancel = gcnew Button; - buttonCancel->Location = Point(90,10); - buttonCancel->Size = System::Drawing::Size( 75, 25 ); - buttonCancel->Text = "Cancel"; - array^temp5 = {buttonOK,buttonCancel}; - this->Controls->AddRange( temp5 ); - this->ResumeLayout(); - } - // - - // - private: - void buttonNewCustomer_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - /* Create a new customer form and assign a new - * Customer object to the Tag property. */ - CustomerForm^ customerForm = gcnew CustomerForm; - customerForm->Tag = gcnew Customer; - customerForm->Show(); - } - // - - // - private: - void menuItemEdit_Popup( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Disable the menu item if the text box does not have focus. - this->menuItemEditInsertCustomerInfo->Enabled = this->textBox1->Focused; - } - // - - void menuItemEditInsertCustomerInfo_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Insert the customer information into the text box. - this->textBox1->Text = String::Concat( this->textBox1->Text, dynamic_cast(this->Tag) ); - } - - void menuItemEditFont_Click( Object^ sender, System::EventArgs^ /*e*/ ) - { - MenuItem^ menuItem = dynamic_cast(sender); - if ( menuItem->Parent == this->menuItemEditFont ) - { - // Uncheck all the menu items. - IEnumerator^ myEnum = this->menuItemEditFont->MenuItems->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - MenuItem^ menu = safe_cast(myEnum->Current); - menu->Checked = false; - } - - // Check the menu item that was clicked. - menuItem->Checked = true; - - // Update the font used in the text box. - textBox1->Font = gcnew System::Drawing::Font( menuItem->Text,textBox1->Font->Size ); - } - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ControlMembers3::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp deleted file mode 100644 index 237ccda9782..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp +++ /dev/null @@ -1,213 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace ControlMembers4 -{ - public ref class Form2: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Panel^ panel1; - System::Windows::Forms::Button^ button1; - System::Windows::Forms::StatusBar^ statusBar1; - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::ContextMenu^ contextMenu1; - System::Windows::Forms::MenuItem^ menuItem1; - System::Windows::Forms::MenuItem^ menuItem2; - System::Windows::Forms::MenuItem^ menuItem3; - System::Windows::Forms::Label ^ label1; - System::ComponentModel::Container^ components; - - public: - Form2() - { - components = nullptr; - InitializeComponent(); - } - - protected: - ~Form2() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->panel1 = gcnew System::Windows::Forms::Panel; - this->button1 = gcnew System::Windows::Forms::Button; - this->label1 = gcnew System::Windows::Forms::Label; - this->statusBar1 = gcnew System::Windows::Forms::StatusBar; - this->treeView1 = gcnew System::Windows::Forms::TreeView; - this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu; - this->menuItem1 = gcnew System::Windows::Forms::MenuItem; - this->menuItem2 = gcnew System::Windows::Forms::MenuItem; - this->menuItem3 = gcnew System::Windows::Forms::MenuItem; - this->panel1->SuspendLayout(); - this->SuspendLayout(); - - // - // panel1 - // - this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; - array^temp0 = {this->button1,this->label1}; - this->panel1->Controls->AddRange( temp0 ); - this->panel1->Location = System::Drawing::Point( 48, 40 ); - this->panel1->Name = "panel1"; - this->panel1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 16, 16 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form2::button1_Click ); - - // - // label1 - // - this->label1->Location = System::Drawing::Point( 16, 16 ); - this->label1->Name = "label1"; - this->label1->TabIndex = 2; - this->label1->Text = "label1"; - - // - // statusBar1 - // - this->statusBar1->Location = System::Drawing::Point( 0, 295 ); - this->statusBar1->Name = "statusBar1"; - this->statusBar1->Size = System::Drawing::Size( 320, 22 ); - this->statusBar1->TabIndex = 1; - this->statusBar1->Text = "statusBar1"; - - // - // treeView1 - // - this->treeView1->ContextMenu = this->contextMenu1; - this->treeView1->ImageIndex = -1; - this->treeView1->Location = System::Drawing::Point( 64, 152 ); - this->treeView1->Name = "treeView1"; - array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node2" )}; - array^temp2 = {gcnew System::Windows::Forms::TreeNode( "Node1",temp1 )}; - array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp2 )}; - this->treeView1->Nodes->AddRange( temp3 ); - this->treeView1->SelectedImageIndex = -1; - this->treeView1->TabIndex = 2; - this->treeView1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form2::treeView1_KeyDown ); - this->treeView1->AfterLabelEdit += gcnew System::Windows::Forms::NodeLabelEditEventHandler( this, &Form2::treeView1_AfterLabelEdit ); - - // - // contextMenu1 - // - array^temp4 = {this->menuItem1,this->menuItem2,this->menuItem3}; - this->contextMenu1->MenuItems->AddRange( temp4 ); - - // - // menuItem1 - // - this->menuItem1->Index = 0; - this->menuItem1->Text = "Edit"; - - // - // menuItem2 - // - this->menuItem2->Index = 1; - this->menuItem2->Text = "Expand"; - - // - // menuItem3 - // - this->menuItem3->Index = 2; - this->menuItem3->Text = "Collapse"; - - // - // Form2 - // - this->ClientSize = System::Drawing::Size( 320, 317 ); - this->DoubleClick += gcnew System::EventHandler( this, &Form2::Form2_DoubleClick ); - array^temp5 = {this->treeView1,this->statusBar1,this->panel1}; - this->Controls->AddRange( temp5 ); - this->Name = "Form2"; - this->Text = "Form2"; - this->panel1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - void Form2_DoubleClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->MakeLabelVisible(); - } - - // - private: - void MakeLabelVisible() - { - - /* If the panel contains label1, bring it - * to the front to make sure it is visible. */ - if ( panel1->Contains( label1 ) ) - { - label1->BringToFront(); - } - } - // - - // - private: - void button1_Click( Object^ sender, System::EventArgs^ /*e*/ ) - { - /* If the CTRL key is pressed when the - * control is clicked, hide the control. */ - if ( Control::ModifierKeys == Keys::Control ) - { - (dynamic_cast(sender))->Hide(); - } - } - // - - // - private: - void treeView1_KeyDown( Object^ /*sender*/, KeyEventArgs^ e ) - { - /* If the 'Alt' and 'E' keys are pressed, - * allow the user to edit the TreeNode label. */ - if ( e->Alt && e->KeyCode == Keys::E ) - { - treeView1->LabelEdit = true; - - // If there is a TreeNode under the mouse cursor, begin editing. - TreeNode^ editNode = treeView1->GetNodeAt( treeView1->PointToClient( Control::MousePosition ) ); - if ( editNode != nullptr ) - { - editNode->BeginEdit(); - } - } - } - - void treeView1_AfterLabelEdit( Object^ /*sender*/, NodeLabelEditEventArgs^ /*e*/ ) - { - // Disable the ability to edit the TreeNode labels. - treeView1->LabelEdit = false; - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ControlMembers4::Form2 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp deleted file mode 100644 index a06e3d6cf65..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp +++ /dev/null @@ -1,170 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ControlProperties -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::ImageList^ imageList1; - System::Windows::Forms::Button^ button2; - System::ComponentModel::IContainer^ components; - - public: - Form1() - { - InitializeComponent(); - - //this->AddMyGroupBox(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->components = gcnew System::ComponentModel::Container; - System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( Form1::typeid ); - this->imageList1 = gcnew System::Windows::Forms::ImageList( this->components ); - this->button2 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // imageList1 - // - this->imageList1->ColorDepth = System::Windows::Forms::ColorDepth::Depth8Bit; - this->imageList1->ImageSize = System::Drawing::Size( 16, 16 ); - this->imageList1->ImageStream = (dynamic_cast(resources->GetObject( "imageList1.ImageStream" ))); - this->imageList1->TransparentColor = System::Drawing::Color::Transparent; - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 40, 232 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 0; - this->button2->Text = "button1"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // Form1 - // - this->BackColor = System::Drawing::Color::FromArgb( ((System::Byte)(0)) ),((System::Byte)(64)),((System::Byte)(0)); - this->ClientSize = System::Drawing::Size( 408, 405 ); - array^temp0 = {this->button2}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Add a button to a form and set some of its common properties. - private: - void AddMyButton() - { - // Create a button and add it to the form. - Button^ button1 = gcnew Button; - - // Anchor the button to the bottom right corner of the form - button1->Anchor = static_cast(AnchorStyles::Bottom | AnchorStyles::Right); - - // Assign a background image. - button1->BackgroundImage = imageList1->Images[ 0 ]; - - // Specify the layout style of the background image. Tile is the default. - button1->BackgroundImageLayout = ImageLayout::Center; - - // Make the button the same size as the image. - button1->Size = button1->BackgroundImage->Size; - - // Set the button's TabIndex and TabStop properties. - button1->TabIndex = 1; - button1->TabStop = true; - - // Add a delegate to handle the Click event. - button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // Add the button to the form. - this->Controls->Add( button1 ); - } - // - - // - // Add a GroupBox to a form and set some of its common properties. - private: - void AddMyGroupBox() - { - // Create a GroupBox and add a TextBox to it. - GroupBox^ groupBox1 = gcnew GroupBox; - TextBox^ textBox1 = gcnew TextBox; - textBox1->Location = Point(15,15); - groupBox1->Controls->Add( textBox1 ); - - // Set the Text and Dock properties of the GroupBox. - groupBox1->Text = "MyGroupBox"; - groupBox1->Dock = DockStyle::Top; - - // Disable the GroupBox (which disables all its child controls) - groupBox1->Enabled = false; - - // Add the Groupbox to the form. - this->Controls->Add( groupBox1 ); - } - // - - // - // Reset all the controls to the user's default Control color. - private: - void ResetAllControlsBackColor( Control^ control ) - { - control->BackColor = SystemColors::Control; - control->ForeColor = SystemColors::ControlText; - if ( control->HasChildren ) - { - // Recursively call this method for each child control. - IEnumerator^ myEnum = control->Controls->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Control^ childControl = safe_cast(myEnum->Current); - ResetAllControlsBackColor( childControl ); - } - } - } - // - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->ResetAllControlsBackColor( this ); - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->AddMyButton(); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ControlProperties::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp deleted file mode 100644 index 2a10c125d5c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp +++ /dev/null @@ -1,212 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; -using namespace System::IO; - -public ref class Form1: public System::Windows::Forms::Form -{ -private: - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::ComboBox^ comboBox1; - System::ComponentModel::Container^ components; - -public: - Form1() - { - InitializeComponent(); - array^temp0 = {gcnew MenuItem( "Edit" )}; - this->treeView1->ContextMenu = gcnew System::Windows::Forms::ContextMenu( temp0 ); - } - -protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - /// - /// Required method for Designer support; do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->treeView1 = gcnew System::Windows::Forms::TreeView; - this->comboBox1 = gcnew System::Windows::Forms::ComboBox; - this->SuspendLayout(); - - // - // treeView1 - // - this->treeView1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Bottom | AnchorStyles::Left | AnchorStyles::Right); - this->treeView1->ImageIndex = -1; - this->treeView1->Name = "treeView1"; - this->treeView1->SelectedImageIndex = -1; - this->treeView1->Size = System::Drawing::Size( 232, 224 ); - this->treeView1->TabIndex = 0; - this->treeView1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::treeView1_MouseUp ); - this->treeView1->BeforeExpand += gcnew System::Windows::Forms::TreeViewCancelEventHandler( this, &Form1::treeView1_BeforeExpand ); - - // - // comboBox1 - // - this->comboBox1->Dock = System::Windows::Forms::DockStyle::Bottom; - this->comboBox1->Location = System::Drawing::Point( 0, 224 ); - this->comboBox1->Name = "comboBox1"; - this->comboBox1->Size = System::Drawing::Size( 232, 21 ); - this->comboBox1->TabIndex = 1; - this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::comboBox1_SelectedIndexChanged ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 232, 245 ); - array^temp1 = {this->comboBox1,this->treeView1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - this->ResumeLayout( false ); - } - - // -private: - void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Display the hand cursor when the mouse pointer - // is over the combo box drop-down button. - comboBox1->Cursor = Cursors::Hand; - - // Fill the combo box with all the logical - // drives available to the user. - try - { - IEnumerator^ myEnum = Environment::GetLogicalDrives()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - String^ logicalDrive = safe_cast(myEnum->Current); - comboBox1->Items->Add( logicalDrive ); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - // - - // -protected: - property System::Windows::Forms::ImeMode DefaultImeMode - { - virtual System::Windows::Forms::ImeMode get() override - { - // Disable the IME mode for the control. - return ::ImeMode::Off; - } - - } - // - - // -protected: - property System::Drawing::Size DefaultSize - { - virtual System::Drawing::Size get() override - { - // Set the default size of - // the form to 500 pixels square. - return System::Drawing::Size( 500, 500 ); - } - } - // - - // -private: - void treeView1_MouseUp( Object^ /*sender*/, MouseEventArgs^ e ) - { - // If the right mouse button was clicked and released, - // display the shortcut menu assigned to the TreeView. - if ( e->Button == ::MouseButtons::Right ) - { - treeView1->ContextMenu->Show( treeView1, Point(e->X,e->Y) ); - } - } - // - - void comboBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - DirectoryInfo^ dirInfo = gcnew DirectoryInfo( dynamic_cast(comboBox1->SelectedItem) ); - this->treeView1->Nodes->Clear(); - - // Do not display or attempt to access System, Temporary, or Hidden directories. - if ( dirInfo->Exists && ((dirInfo->Attributes & (FileAttributes::Hidden | FileAttributes::System | FileAttributes::Temporary)) != (FileAttributes)0) ) - { - TreeNode^ rootNode = gcnew TreeNode( dynamic_cast(comboBox1->SelectedItem) ); - treeView1->Nodes->Add( rootNode ); - CreateChildNodes( dirInfo, rootNode ); - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - - void CreateChildNodes( DirectoryInfo^ dirInfo, TreeNode^ parentNode ) - { - try - { - IEnumerator^ myEnum = dirInfo->GetDirectories()->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - DirectoryInfo^ d = safe_cast(myEnum->Current); - - // Do not display or attempt to access System, Temporary, or System directories. - if ( (d->Attributes & (FileAttributes::Hidden | FileAttributes::System | FileAttributes::Temporary))== (FileAttributes)0 ) - { - parentNode->Nodes->Add( gcnew TreeNode( d->Name ) ); - Application::DoEvents(); - } - } - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - } - } - - void treeView1_BeforeExpand( Object^ /*sender*/, TreeViewCancelEventArgs^ e ) - { - IEnumerator^ myEnum = e->Node->Nodes->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - TreeNode^ node = safe_cast(myEnum->Current); - - // Create a DirectoryInfo Object* from the node path. - CreateChildNodes( gcnew DirectoryInfo( node->FullPath ), node ); - } - } -}; - -[STAThread] -void main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp deleted file mode 100644 index 025fe9cefb9..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp +++ /dev/null @@ -1,91 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Reflection; -using namespace System::Runtime::CompilerServices; - -[assembly:AssemblyCompany("Microsoft")]; -[assembly:AssemblyProduct("Test")]; -[assembly:AssemblyVersion("1.0.*")]; -namespace CodeExamples -{ - public ref class AboutDialog: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ buttonOK; - System::Windows::Forms::Label ^ labelVersionInfo; - System::ComponentModel::Container^ components; - - public: - AboutDialog() - { - InitializeComponent(); - } - - protected: - ~AboutDialog() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->labelVersionInfo = gcnew System::Windows::Forms::Label; - this->buttonOK = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // labelVersionInfo - // - this->labelVersionInfo->Location = System::Drawing::Point( 8, 8 ); - this->labelVersionInfo->Name = "labelVersionInfo"; - this->labelVersionInfo->Size = System::Drawing::Size( 360, 23 ); - this->labelVersionInfo->TabIndex = 0; - this->labelVersionInfo->Text = "label1"; - - // - // buttonOK - // - this->buttonOK->Location = System::Drawing::Point( 296, 64 ); - this->buttonOK->Name = "buttonOK"; - this->buttonOK->TabIndex = 3; - this->buttonOK->Text = "&OK"; - - // - // AboutDialog - // - this->ClientSize = System::Drawing::Size( 392, 109 ); - array^temp0 = {this->buttonOK,this->labelVersionInfo}; - this->Controls->AddRange( temp0 ); - this->Name = "AboutDialog"; - this->Text = "About"; - this->Load += gcnew System::EventHandler( this, &AboutDialog::AboutDialog_Load ); - this->ResumeLayout( false ); - } - - // - void AboutDialog_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - // Display the application information in the label. - this->labelVersionInfo->Text = String::Format( "{0} {1} Version: {2}", this->CompanyName, this->ProductName, this->ProductVersion ); - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew CodeExamples::AboutDialog ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp deleted file mode 100644 index eebc7729e6c..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp +++ /dev/null @@ -1,125 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace ControlMembers -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support; do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); - this->button1->Location = System::Drawing::Point( 104, 104 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - // Create three buttons and place them on a form using - // several size and location related properties. - void AddOKCancelButtons() - { - - // Set the button size and location using - // the Size and Location properties. - Button^ buttonOK = gcnew Button; - buttonOK->Location = Point(136,248); - buttonOK->Size = System::Drawing::Size( 75, 25 ); - - // Set the Text property and make the - // button the form's default button. - buttonOK->Text = "&OK"; - this->AcceptButton = buttonOK; - - // Set the button size and location using the Top, - // Left, Width, and Height properties. - Button^ buttonCancel = gcnew Button; - buttonCancel->Top = buttonOK->Top; - buttonCancel->Left = buttonOK->Right + 5; - buttonCancel->Width = buttonOK->Width; - buttonCancel->Height = buttonOK->Height; - - // Set the Text property and make the - // button the form's cancel button. - buttonCancel->Text = "&Cancel"; - this->CancelButton = buttonCancel; - - // Set the button size and location using - // the Bounds property. - Button^ buttonHelp = gcnew Button; - buttonHelp->Bounds = Rectangle(10,10,75,25); - - // Set the Text property of the button. - buttonHelp->Text = "&Help"; - - // Add the buttons to the form. - array^temp1 = {buttonOK,buttonCancel,buttonHelp}; - this->Controls->AddRange( temp1 ); - } - // - - void button_Click( Object^ sender, System::EventArgs^ /*e*/ ) - { - Control^ ctrl = dynamic_cast(sender); - array^temp2 = {ctrl->Top,ctrl->Bottom,ctrl->Left,ctrl->Right,ctrl->Width,ctrl->Height,ctrl->Size,ctrl->Location}; - MessageBox::Show( String::Format( "Top: {0}\n Bottom: {1}\n Left: {2}\n Right: {3}\n Width: {4}\n Height: {5}\n Size: {6}\n Location: {7}", temp2 ), "button1 Position", MessageBoxButtons::OKCancel ); - this->AddOKCancelButtons(); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ControlMembers::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp deleted file mode 100644 index 1e20a6f2c88..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp +++ /dev/null @@ -1,152 +0,0 @@ - - -// -#using -#using -#using -#using - -using namespace System; -using namespace System::Windows::Forms; -using namespace System::Drawing; - -namespace MyCustomControls -{ - public ref class MyCheckBox: public CheckBox - { - public: - MyCheckBox() - { - // Make the check box appear like a toggle button. - this->Appearance = ::Appearance::Button; - - // Center the text on the button. - this->TextAlign = ContentAlignment::MiddleCenter; - - // Set the AccessibleDescription text. - this->AccessibleDescription = "A toggle style button."; - } - - protected: - - // Create an instance of the AccessibleObject - // defined for the 'MyCheckBox' control - virtual AccessibleObject^ CreateAccessibilityInstance() override; - }; - - // Accessible Object* for use with the 'MyCheckBox' control. - private ref class MyCheckBoxAccessibleObject: public Control::ControlAccessibleObject - { - public: - MyCheckBoxAccessibleObject( MyCheckBox^ owner ) - : ControlAccessibleObject( owner ) - {} - - property String^ DefaultAction - { - virtual String^ get() override - { - // Return the DefaultAction based upon - // the state of the control. - if ( (dynamic_cast(Owner))->Checked ) - { - return "Toggle button up"; - } - else - { - return "Toggle button down"; - } - } - } - - property String^ Name - { - virtual String^ get() override - { - // Return the Text property of the control - // if the AccessibleName is 0. - String^ name = Owner->AccessibleName; - if ( name != nullptr ) - { - return name; - } - - return (dynamic_cast(Owner))->Text; - } - - virtual void set( String^ value ) override - { - ControlAccessibleObject::Name = value; - } - } - - property AccessibleRole Role - { - virtual AccessibleRole get() override - { - // Since the check box appears like a button, - // make the Role the same as a button. - return AccessibleRole::PushButton; - } - } - }; - - AccessibleObject^ MyCheckBox::CreateAccessibilityInstance() - { - return gcnew MyCheckBoxAccessibleObject( this ); - } -} -// - -namespace ControlAccessibility -{ - public ref class MyForm: public System::Windows::Forms::Form - { - private: - System::ComponentModel::Container^ components; - - protected: - ~MyForm() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - } - - // - public: - MyForm() - { - // Create a 'MyCheckBox' control and - // display an image on it. - MyCustomControls::MyCheckBox^ myCheckBox = gcnew MyCustomControls::MyCheckBox; - myCheckBox->Location = Point(5,5); - myCheckBox->Image = Image::FromFile( String::Concat( Application::CommonAppDataPath, "\\Preview.jpg" ) ); - - // Set the AccessibleName property - // since there is no Text displayed. - myCheckBox->AccessibleName = "Preview"; - myCheckBox->AccessibleDescription = "A toggle button used to show the document preview."; - this->Controls->Add( myCheckBox ); - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ControlAccessibility::MyForm ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp deleted file mode 100644 index e44777c2766..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp +++ /dev/null @@ -1,147 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace DragDrop -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::ComponentModel::Container^ components; - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support; do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - this->SuspendLayout(); - - // - // ImageDrag - // - this->AllowDrop = true; - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "ImageDrag"; - this->Text = "ImageDrag"; - this->ResumeLayout( false ); - } - - - // - private: - Image^ picture; - Point pictureLocation; - - public: - Form1() - { - - // Enable drag-and-drop operations and - // add handlers for DragEnter and DragDrop. - this->AllowDrop = true; - this->DragDrop += gcnew DragEventHandler( this, &Form1::Form1_DragDrop ); - this->DragEnter += gcnew DragEventHandler( this, &Form1::Form1_DragEnter ); - } - - protected: - virtual void OnPaint( PaintEventArgs^ e ) override - { - - // If there is an image and it has a location, - // paint it when the Form is repainted. - Form::OnPaint( e ); - if ( this->picture != nullptr && this->pictureLocation != Point::Empty ) - { - e->Graphics->DrawImage( this->picture, this->pictureLocation ); - } - } - - private: - void Form1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) - { - - // Handle FileDrop data. - if ( e->Data->GetDataPresent( DataFormats::FileDrop ) ) - { - // Assign the file names to a String* array, in - // case the user has selected multiple files. - array^files = (array^)e->Data->GetData( DataFormats::FileDrop ); - try - { - // Assign the first image to the picture variable. - this->picture = Image::FromFile( files[ 0 ] ); - - // Set the picture location equal to the drop point. - this->pictureLocation = this->PointToClient( Point(e->X,e->Y) ); - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - return; - } - - } - - // Handle Bitmap data. - if ( e->Data->GetDataPresent( DataFormats::Bitmap ) ) - { - try - { - // Create an Image and assign it to the picture variable. - this->picture = dynamic_cast(e->Data->GetData( DataFormats::Bitmap )); - - // Set the picture location equal to the drop point. - this->pictureLocation = this->PointToClient( Point(e->X,e->Y) ); - } - catch ( Exception^ ex ) - { - MessageBox::Show( ex->Message ); - return; - } - } - - // Force the form to be redrawn with the image. - this->Invalidate(); - } - - void Form1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) - { - // If the data is a file or a bitmap, display the copy cursor. - if ( e->Data->GetDataPresent( DataFormats::Bitmap ) || e->Data->GetDataPresent( DataFormats::FileDrop ) ) - { - e->Effect = DragDropEffects::Copy; - } - else - { - e->Effect = DragDropEffects::None; - } - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew DragDrop::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp deleted file mode 100644 index 486f43d8feb..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp +++ /dev/null @@ -1,225 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ControlMembers6 -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Button^ button1; - System::Windows::Forms::TextBox^ textBox1; - System::Windows::Forms::Button^ button2; - System::Windows::Forms::CheckBox^ checkBox1; - System::Windows::Forms::Button^ button3; - System::Windows::Forms::Button^ button4; - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - textBox1->Enabled = checkBox1->Checked; - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->button1 = gcnew System::Windows::Forms::Button; - this->textBox1 = gcnew System::Windows::Forms::TextBox; - this->button2 = gcnew System::Windows::Forms::Button; - this->checkBox1 = gcnew System::Windows::Forms::CheckBox; - this->button3 = gcnew System::Windows::Forms::Button; - this->button4 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 48, 40 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 0; - this->button1->Text = "Focus"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // textBox1 - // - this->textBox1->Location = System::Drawing::Point( 48, 88 ); - this->textBox1->Name = "textBox1"; - this->textBox1->TabIndex = 1; - this->textBox1->Text = "textBox1"; - - // - // button2 - // - this->button2->Location = System::Drawing::Point( 160, 40 ); - this->button2->Name = "button2"; - this->button2->TabIndex = 2; - this->button2->Text = "Select"; - this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); - - // - // checkBox1 - // - this->checkBox1->Location = System::Drawing::Point( 160, 88 ); - this->checkBox1->Name = "checkBox1"; - this->checkBox1->TabIndex = 3; - this->checkBox1->Text = "Enabled"; - this->checkBox1->CheckedChanged += gcnew System::EventHandler( this, &Form1::checkBox1_CheckedChanged ); - - // - // button3 - // - this->button3->Location = System::Drawing::Point( 216, 248 ); - this->button3->Name = "button3"; - this->button3->TabIndex = 4; - this->button3->Text = "button3"; - this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); - - // - // button4 - // - this->button4->Location = System::Drawing::Point( 0, 248 ); - this->button4->Name = "button4"; - this->button4->TabIndex = 5; - this->button4->Text = "button4"; - this->button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - array^temp0 = {this->button4,this->button3,this->checkBox1,this->button2,this->textBox1,this->button1}; - this->Controls->AddRange( temp0 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->ControlSetFocus( this->textBox1 ); - } - - // - public: - void ControlSetFocus( Control^ control ) - { - - // Set focus to the control, if it can receive focus. - if ( control->CanFocus ) - { - control->Focus(); - } - } - // - - // - public: - void ControlSelect( Control^ control ) - { - - // Select the control, if it can be selected. - if ( control->CanSelect ) - { - control->Select( ); - } - } - // - - private: - void checkBox1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - textBox1->Enabled = checkBox1->Checked; - } - - void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->ControlSelect( this->textBox1 ); - } - - // - public: - void EnableDoubleBuffering() - { - // Set the value of the double-buffering style bits to true. - this->SetStyle( static_cast(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint), true ); - this->UpdateStyles(); - } - // - - // - public: - bool DoubleBufferingEnabled() - { - - // Get the value of the double-buffering style bits. - return this->GetStyle( static_cast(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint) ); - } - // - - - private: - void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - this->EnableDoubleBuffering(); - } - - void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) - { - MessageBox::Show( this->DoubleBufferingEnabled().ToString() ); - this->ScaleChildControls(); - } - - // - public: - void ScaleChildControlsEqually() - { - // Resize all child controls to 1.5 - // times their current size. - for ( int i = 0; i < this->Controls->Count; i++ ) - { - this->Controls[ i ]->Scale( 1.5f ); - } - } - // - - // - void ScaleChildControls() - { - // Resize all child controls to 1.5 times their current - // height while, maintaining their current width. - for ( int i = 0; i < this->Controls->Count; i++ ) - { - this->Controls[ i ]->Scale( 1.0f, 1.5f ); - } - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ControlMembers6::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp deleted file mode 100644 index 3448e8b4a82..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp +++ /dev/null @@ -1,99 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::ComponentModel; -using namespace System::Drawing; -using namespace System::Windows::Forms; - -namespace SetBoundsCore -{ - public ref class MyUserControl: public System::Windows::Forms::UserControl - { - private: - System::ComponentModel::Container^ components; - - public: - MyUserControl() - { - InitializeComponent(); - } - - protected: - ~MyUserControl() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // MyUserControl - // - this->BackColor = System::Drawing::SystemColors::Desktop; - this->Name = "MyUserControl"; - this->Size = System::Drawing::Size( 224, 88 ); - } - - // - protected: - virtual void SetBoundsCore( int x, int y, int width, int height, BoundsSpecified specified ) override - { - // Set a fixed height and width for the control. - UserControl::SetBoundsCore( x, y, 150, 75, specified ); - } - // - - // - protected: - virtual void SetClientSizeCore( int x, int y ) override - { - // Keep the client size square. - if ( x > y ) - { - UserControl::SetClientSizeCore( x, x ); - } - else - { - UserControl::SetClientSizeCore( y, y ); - } - } - // - - // - protected: - virtual void ScaleCore( float dx, float dy ) override - { - // Scale all child controls. - this->SuspendLayout(); - System::Drawing::Size myClientSize = this->ClientSize; - myClientSize.Height = (int)(myClientSize.Height * dx); - myClientSize.Width = (int)(myClientSize.Width * dy); - - /* Scale the child controls because - * UserControl::ScaleCore was not called. */ - System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator(); - while ( myEnum->MoveNext() ) - { - Control^ childControl = safe_cast(myEnum->Current); - childControl->Scale( dx, dy ); - } - - this->ResumeLayout(); - this->ClientSize = myClientSize; - } - // - }; -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp deleted file mode 100644 index a6dac132eaf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp +++ /dev/null @@ -1,114 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace PropChanged -{ - public ref class MyTextBox: public TextBox - { - // - protected: - virtual void OnTextChanged( System::EventArgs^ e ) override - { - try - { - // Convert the text to a Double and determine - // if it is a negative number. - if ( Double::Parse( this->Text ) < 0 ) - { - // If the number is negative, display it in Red. - this->ForeColor = Color::Red; - } - else - { - // If the number is not negative, display it in Black. - this->ForeColor = Color::Black; - } - } - catch ( Exception^ ) - { - // If there is an error, display the - // text using the system colors. - this->ForeColor = SystemColors::ControlText; - } - - TextBox::OnTextChanged( e ); - } - // - }; - - public ref class Form1: public System::Windows::Forms::Form - { - private: - MyTextBox^ currencyTextBox; - System::Windows::Forms::Button^ button1; - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->currencyTextBox = gcnew PropChanged::MyTextBox; - this->button1 = gcnew System::Windows::Forms::Button; - this->SuspendLayout(); - - // - // currencyTextBox - // - this->currencyTextBox->Location = System::Drawing::Point( 8, 8 ); - this->currencyTextBox->Name = "currencyTextBox"; - this->currencyTextBox->Size = System::Drawing::Size( 104, 20 ); - this->currencyTextBox->TabIndex = 0; - this->currencyTextBox->Text = ""; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 64, 48 ); - this->button1->Name = "button1"; - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 194, 103 ); - array^temp0 = {this->button1,this->currencyTextBox}; - this->Controls->AddRange( temp0 ); - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew PropChanged::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp deleted file mode 100644 index 02b7c453c6f..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp +++ /dev/null @@ -1,99 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace PropChanged -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::TextBox^ currencyTextBox; - System::ComponentModel::Container^ components; - - public: - Form1() - { - components = nullptr; - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->currencyTextBox = gcnew System::Windows::Forms::TextBox; - this->SuspendLayout(); - - // - // currencyTextBox - // - this->currencyTextBox->Location = System::Drawing::Point( 8, 8 ); - this->currencyTextBox->Name = "currencyTextBox"; - this->currencyTextBox->Size = System::Drawing::Size( 104, 20 ); - this->currencyTextBox->TabIndex = 0; - this->currencyTextBox->Text = ""; - this->currencyTextBox->TextChanged += gcnew System::EventHandler( this, &Form1::currencyTextBox_TextChanged ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 194, 103 ); - array^temp0 = {this->currencyTextBox}; - this->Controls->AddRange( temp0 ); - this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - private: - void currencyTextBox_TextChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - try - { - // Convert the text to a Double and determine if it is a negative number. - if ( Double::Parse( currencyTextBox->Text ) < 0 ) - { - // If the number is negative, display it in Red. - currencyTextBox->ForeColor = Color::Red; - } - else - { - // If the number is not negative, display it in Black. - currencyTextBox->ForeColor = Color::Black; - } - } - catch ( Exception^ ) - { - // If there is an error, display the text using the system colors. - currencyTextBox->ForeColor = SystemColors::ControlText; - } - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew PropChanged::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp deleted file mode 100644 index 8b63df01ccf..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp +++ /dev/null @@ -1,102 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -namespace ScrollableControl -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::Panel^ panel1; - System::Windows::Forms::Button^ button1; - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->panel1 = gcnew System::Windows::Forms::Panel; - this->button1 = gcnew System::Windows::Forms::Button; - this->panel1->SuspendLayout(); - this->SuspendLayout(); - - // - // panel1 - // - this->panel1->AutoScroll = true; - this->panel1->AutoScrollMargin = System::Drawing::Size( 5, 5 ); - this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; - array^temp0 = {this->button1}; - this->panel1->Controls->AddRange( temp0 ); - this->panel1->DockPadding->All = 10; - this->panel1->Location = System::Drawing::Point( 40, 64 ); - this->panel1->Name = "panel1"; - this->panel1->Size = System::Drawing::Size( 272, 104 ); - this->panel1->TabIndex = 0; - - // - // button1 - // - this->button1->Location = System::Drawing::Point( 416, 184 ); - this->button1->Name = "button1"; - this->button1->Size = System::Drawing::Size( 104, 40 ); - this->button1->TabIndex = 1; - this->button1->Text = "button1"; - this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 336, 205 ); - array^temp1 = {this->panel1}; - this->Controls->AddRange( temp1 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->panel1->ResumeLayout( false ); - this->ResumeLayout( false ); - } - - // - private: - void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) - { - /* Add a button to top left corner of the - * scrollable area, allowing for the offset. */ - panel1->AutoScroll = true; - Button^ myButton = gcnew Button; - myButton->Location = Point(0 + panel1->AutoScrollPosition.X,0 + panel1->AutoScrollPosition.Y); - panel1->Controls->Add( myButton ); - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew ::ScrollableControl::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp deleted file mode 100644 index 7a10caa2c37..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp +++ /dev/null @@ -1,148 +0,0 @@ - - -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; - -namespace Foo -{ - public ref class Form1: public System::Windows::Forms::Form - { - private: - System::Windows::Forms::TreeView^ treeView1; - System::Windows::Forms::StatusBar^ statusBar1; - System::ComponentModel::Container^ components; - - public: - Form1() - { - InitializeComponent(); - } - - protected: - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - - private: - void InitializeComponent() - { - this->treeView1 = gcnew System::Windows::Forms::TreeView; - this->statusBar1 = gcnew System::Windows::Forms::StatusBar; - this->SuspendLayout(); - - // - // treeView1 - // - this->treeView1->ImageIndex = -1; - this->treeView1->Location = System::Drawing::Point( 8, 8 ); - this->treeView1->Name = "treeView1"; - array^temp0 = {gcnew System::Windows::Forms::TreeNode( "Node5" )}; - array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node4",temp0 )}; - array^temp2 = {gcnew System::Windows::Forms::TreeNode( "Node3",temp1 )}; - array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node8" )}; - array^temp4 = {gcnew System::Windows::Forms::TreeNode( "Node7",temp3 )}; - array^temp5 = {gcnew System::Windows::Forms::TreeNode( "Node6",temp4 )}; - array^temp6 = {gcnew System::Windows::Forms::TreeNode( "Node11" )}; - array^temp7 = {gcnew System::Windows::Forms::TreeNode( "Node10",temp6 )}; - array^temp8 = {gcnew System::Windows::Forms::TreeNode( "Node9",temp7 )}; - array^temp9 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp2 ),gcnew System::Windows::Forms::TreeNode( "Node1",temp5 ),gcnew System::Windows::Forms::TreeNode( "Node2",temp8 )}; - this->treeView1->Nodes->AddRange( temp9 ); - this->treeView1->SelectedImageIndex = -1; - this->treeView1->Size = System::Drawing::Size( 128, 144 ); - this->treeView1->TabIndex = 0; - this->treeView1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::treeView1_MouseDown ); - this->treeView1->AfterCollapse += gcnew System::Windows::Forms::TreeViewEventHandler( this, &Form1::treeView1_AfterCollapse ); - this->treeView1->AfterSelect += gcnew System::Windows::Forms::TreeViewEventHandler( this, &Form1::treeView1_AfterSelect ); - - // - // statusBar1 - // - this->statusBar1->Location = System::Drawing::Point( 0, 247 ); - this->statusBar1->Name = "statusBar1"; - this->statusBar1->Size = System::Drawing::Size( 256, 22 ); - this->statusBar1->TabIndex = 2; - this->statusBar1->Text = "statusBar1"; - - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 256, 269 ); - array^temp10 = {this->statusBar1,this->treeView1}; - this->Controls->AddRange( temp10 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->ResumeLayout( false ); - } - - // - private: - void treeView1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) - { - switch ( e->Button ) - { - // Remove the TreeNode under the mouse cursor - // if the right mouse button was clicked. - case ::MouseButtons::Right: - treeView1->GetNodeAt( e->X, e->Y )->Remove(); - break; - - // Toggle the TreeNode under the mouse cursor - // if the middle mouse button (mouse wheel) was clicked. - case ::MouseButtons::Middle: - treeView1->GetNodeAt( e->X, e->Y )->Toggle(); - break; - } - } - // - - // - private: - void treeView1_AfterSelect( Object^ /*sender*/, TreeViewEventArgs^ e ) - { - /* Display the Text and Index of the - * selected tree node's Parent. */ - if ( e->Node->Parent != nullptr && e->Node->Parent->GetType() == TreeNode::typeid ) - { - statusBar1->Text = String::Format( "Parent: {0}\n Index Position: {1}", e->Node->Parent->Text, e->Node->Parent->Index ); - } - else - { - statusBar1->Text = "No parent node."; - } - } - // - - // - private: - void treeView1_AfterCollapse( Object^ /*sender*/, TreeViewEventArgs^ e ) - { - // Create a copy of the e.Node from its Handle. - TreeNode^ tn = TreeNode::FromHandle( e->Node->TreeView, e->Node->Handle ); - tn->Text = String::Concat( tn->Text, "Copy" ); - - // Remove the e.Node so it can be replaced with tn. - e->Node->Remove(); - - // Add tn to the TreeNodeCollection. - treeView1->Nodes->Add( tn ); - } - // - }; -} - -[STAThread] -int main() -{ - Application::Run( gcnew Foo::Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp b/snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp deleted file mode 100644 index 7f57b3c80da..00000000000 --- a/snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp +++ /dev/null @@ -1,101 +0,0 @@ -#using -#using -#using -#using - -using namespace System; -using namespace System::Drawing; -using namespace System::Collections; -using namespace System::ComponentModel; -using namespace System::Windows::Forms; -using namespace System::Data; - -#define NULL 0 - -/// -/// Summary description for Form1. -/// -public ref class Form1: public System::Windows::Forms::Form -{ -private: - - /// - /// Required designer variable. - /// - System::ComponentModel::Container^ components; - -public: - Form1() - { - components = nullptr; - - // - // Required for Windows Form Designer support - // - InitializeComponent(); - - // - // TODO: Add any constructor code after InitializeComponent call - // - } - -protected: - - /// - /// Clean up any resources being used. - /// - ~Form1() - { - if ( components != nullptr ) - { - delete components; - } - } - -private: - - //#region Windows Form Designer generated code - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - void InitializeComponent() - { - // - // Form1 - // - this->ClientSize = System::Drawing::Size( 292, 273 ); - this->Name = "Form1"; - this->Text = "Form1"; - this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); - } - - //#endregion - void Form1_Load( Object^ sender, System::EventArgs^ e ) - { - // - try - { - //Attempting to pass an invalid enum value (MessageBoxButtons) to the Show method - MessageBoxButtons myButton = (MessageBoxButtons)123; // to fix use System::Windows::Forms::DialogResult::OK; - - MessageBox::Show( this, "This is a message", "This is the Caption", myButton ); - } - catch ( InvalidEnumArgumentException^ invE ) - { - Console::WriteLine( invE->Message ); - Console::WriteLine( invE->ParamName ); - Console::WriteLine( invE->StackTrace ); - Console::WriteLine( invE->Source ); - } - // - } -}; - -/// -/// The main entry point for the application. -/// -void main() -{ - Application::Run( gcnew Form1 ); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp deleted file mode 100644 index 9b45b0f17f2..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//BitmapMetadata.cpp file - -using namespace System; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; -using namespace System::Security; - - -namespace SDKSample { - - public ref class app : Application { - - private: Window^ mainWindow; - - protected: virtual void OnStartup (StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: void CreateAndShowMainWindow () - { - - // Create the application's main window - mainWindow = gcnew Window(); - mainWindow->Title = "Image Metadata"; - - // - Stream^ pngStream = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite); - PngBitmapDecoder^ pngDecoder = gcnew PngBitmapDecoder(pngStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapFrame^ pngFrame = pngDecoder->Frames[0]; - InPlaceBitmapMetadataWriter^ pngInplace = pngFrame->CreateInPlaceBitmapMetadataWriter(); - if (pngInplace->TrySave()) - { - pngInplace->SetQuery("/Text/Description", "Have a nice day."); - } - pngStream->Close(); - // - - // Draw the Image - Image^ myImage = gcnew Image(); - myImage->Source = gcnew BitmapImage(gcnew System::Uri("smiley.png", UriKind::Relative)); - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - - // - - // Add the metadata of the bitmap image to the text block. - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "The Description metadata of this image is: " + pngInplace->GetQuery("/Text/Description")->ToString(); - // - - // Define a StackPanel to host Controls - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->Height = 200; - myStackPanel->VerticalAlignment = VerticalAlignment::Top; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Center; - - // Add the Image and TextBlock to the parent Grid - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the Content of the Parent Window Object - mainWindow->Content = myStackPanel; - mainWindow->Show(); - }; - }; - - // Define a static entry class - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj deleted file mode 100644 index 74b2f3f4b02..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/smiley.png b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/smiley.png deleted file mode 100644 index 1e0b9496cad2e2133d1edb7c4d3511a059772473..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4599 zcmV002t}1^@s6I8J)%00009a7bBm000id z000id0mpBsWB>pWsYygZRCt{2oOxW7<=V%uXBpHo1RX#YK~zLgGt*F!7JEHzWu)es zrJnHEDLa|_LDS=sp^1WmqPdWWiKw83iHSQXF8GKn;g}nOAcDipGus2q@BA@hnj13= zLht+j@%u;l-1l{T@9Vywd%3Qmy+^KULSl2I(Cu}v6>+&zSbUxozVni_A}&`7*_tUW z+MFTHU!N|`k2)#MjZBs1M4Y&T{IzM){B`NlqRr=|kgb_g==L0G)h>k;7M~}r zh|7I0c7MAiTZ%h);~XuG&5`zH-auwSK7^arS7u=WvWtt5U0j5dic9$A%o+T!{{a3I zxgMh?Pea#!BjNR`AAEh+g9vly5*92VY}{y4R21Qx zZ%qFl6hs&_fY8H_;O#|d>Bys7*BHe@Aq53_kw&Q?zdF3wL)y|New8z94MfN;r3p zP+Cd=YOb;}LQW20+cv`V>4bj$2wq+U4-Zd_9Qg^>t=oXy+*}xqMrbq|>-Zy<!1#RI2;-)jKSuQVFeA3%y>4xVRnY*Ka87?d>sO0Ab4( z!j&u51@t7{xWVAZ9|<3PKxo$NCA|IiyNHR2g-WG@UayBzsk8{1RblD%dSqo~VcfXC zqeTlBy!j?!&mO|<+st!;^ypM&kd#CiGKA2)xdTRy{0L{yo`u0+fLg7tA6P1t3RRYofB+UQ zF0JtM&q+|L)ljKa)`g`~sUV6XcJ53-n>Otc5J0$eiK}<#Ez$MsgrP$T_Vx~ljg5sU zicbY*HY`&_{R&Udb{IU^)M0%)T^lKtgb5P}FTLb|`1p8KR8%|>SdC#Rl}czd8leD+qV7Lk)_dSaP{gH^z9pnzx~a0 z7`3ERy`E4|VE*NvrMi8aP*_N{K6V+6gki%7ojP?wUfw0BRH`SyQkSEmq5{j8uYg?c zfIWN6@2skduy-$u&p+qz-g_*@jA5~SIfuf+y4iAMW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tF)Bx*=K}i z&6;D$k|mEV$gCBtYG7Ke7F)N*!ok4}LxvD?a~saBXiaqG3WH(82o4S{??=?re6|>t zQmKSmt%kv1Kw@Gd+O_M1?%nBL9%{pfwtqjNM-PIhr#CijiiRXT8n(y@ZihK@7DAy=K&#c7<)>9(RsW2^-Me>j;zSzWd1ol>?M;dHr%%@} zr0i_Mgb57fa>840^~1h>$xtfqnhnZoupV6aMNvdSK>;>x+JbiNykKw7V#p8%Cr?tX z68FtfWhLSKdDF$6g98r_4-c$dxf(@9MbG?Ikmm-gTGglYtgLK&{q+KPc(}vKiN)~Y zED{q=yf6tdJT>qNx`(KQxMR* zH#}Rng^RNsJ$uM7`~$-5S%j#ygruJd$Bz**&i$bi#|g>%3DKJgGo}+pk0SK!!NEap z4-a=w^zie;q<;h<+dn({VDM75(ozme>Ar53~JH=M4lk>08vX2xr3NCpvK;? zY1SEX_nv6i={@uvJQ-7i*JA6gQ^?3w;o@Z-&gGONJ+rh -#using -#using -#using -#using -#using -#using -#using -#using */ -namespace SDKSample { - ref class app; - ref class EntryClass; -} - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; - -namespace SDKSample { - - public ref class app : Application { - - private: System::Windows::Window^ mainWindow; - - protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override ; - - private: void CreateAndShowMainWindow () ; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () ; - }; -} - diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp deleted file mode 100644 index 9c9135fadd2..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp +++ /dev/null @@ -1,134 +0,0 @@ -using namespace System; -using namespace System::Collections::Generic; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; -using namespace System::Security; - -namespace SDKSample { - - public ref class app : Application { - - private: System::Windows::Window^ mainWindow; - - protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: void CreateAndShowMainWindow () - { - // Create the application's main window - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "BMP Imaging Sample"; - ScrollViewer^ mySV = gcnew ScrollViewer(); - - // - int width = 128; - int height = width; - int stride = width / 8; - array^ pixels = gcnew array(height * stride); - - List^ colors = gcnew List(); - colors->Add(Colors::Red); - colors->Add(Colors::Blue); - colors->Add(Colors::Green); - BitmapPalette^ myPalette = gcnew BitmapPalette(colors); - - // Creates a new empty image with the pre-defined palette - - // - BitmapSource^ image = BitmapSource::Create( - width, - height, - 96, - 96, - PixelFormats::Indexed1, - myPalette, - pixels, - stride); - // - - // - FileStream^ stream = gcnew FileStream("new.bmp", FileMode::Create); - BmpBitmapEncoder^ encoder = gcnew BmpBitmapEncoder(); - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); - encoder->Frames->Add(BitmapFrame::Create(image)); - encoder->Save(stream); - // - - // - - // - - // Open a Stream and decode a BMP image - Stream^ imageStreamSource = gcnew FileStream("tulipfarm.bmp", FileMode::Open, FileAccess::Read, FileShare::Read); - BmpBitmapDecoder^ decoder = gcnew BmpBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource = decoder->Frames[0]; - - // Draw the Image - Image^ myImage = gcnew Image(); - myImage->Source = bitmapSource; - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - // - - // - - // Open a Uri and decode a BMP image - System::Uri^ myUri = gcnew System::Uri("tulipfarm.bmp", UriKind::RelativeOrAbsolute); - BmpBitmapDecoder^ decoder2 = gcnew BmpBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource2 = decoder2->Frames[0]; - - // Draw the Image - Image^ myImage2 = gcnew Image(); - myImage2->Source = bitmapSource2; - myImage2->Stretch = Stretch::None; - myImage2->Margin = System::Windows::Thickness(20); - // - - // Define a StackPanel to host the decoded BMP images - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; - - // Add the Image and TextBlock to the parent Grid - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myImage2); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the Content of the Parent Window Object - mySV->Content = myStackPanel; - mainWindow->Content = mySV; - mainWindow->Show(); - } - - - }; - - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; - -} - - -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj deleted file mode 100644 index 1f985d5f281..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {6900EB9F-8008-437C-BB1E-3C7C06662F84} - v4.0 - ManagedCProj - AnotherProject - - - - Application - true - Unicode - - - Application - true - Unicode - - - - - - - - - - - - - true - .\ - - - false - - - - Level3 - ProgramDatabase - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - true - - - true - - - - - - - - - Level3 - ProgramDatabase - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - true - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters deleted file mode 100644 index aad46846bb3..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Source Files - - - - - Header Files - - - - - Resource Files - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp deleted file mode 100644 index a3f88f4d09ad712fb5ba5a035e8ac50b66693f3a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 921654 zcmX`TXOkOQmMjRSfCfTqt+fsW0$QdP%%m)mRU}KWs!MiN^-PPIo|*UFK3lUDU-lpF zPuYX+-KAZ^GLy(mFyh|he%$?Fdsm^u#^Fx|e_i z`hDO(7Rj?w`ZRW41j_S3dTlc=eerV-el$1OK-f0X47<2r~AyB zn&#L|meXjm3Pvk`eCCeV(P~{>uG8y>P(&G`Xn=^ zxjM_ZNgOSzcwVLRs#uKkWeuMO>pDJP`uoz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!R&&Cdmf4%zP`gf%vuRoK&FwT>oaujBNrvx&EyMVMXd;Ju5!fABlhRcP)!5lfUHe-4xcuSu9!P$o#tJ z%XU6|)b(%nhv)Kt!v(iZ6>3tIgqf>+QdHeJeqB`We=` z{#F$uf5~6+*I@mdffDeJ{JjgdYHGTxDf#^Ve8&F#f&8s2&^Tl=UX9O(9sYewy|?<) z#{NfDdpiDl$AdoKGqHrlr;b=!)(YtOnbVR*9ph&`h%7&?0^VS4ynZO%K=sdJmjkI6 zYv4qjw`dT`TO}5@Wt!plt`IB z{f4Z|v(xx`yJh@zjWR1gssb4o%r_A?QA4QyS?uVzGQ05i?fv8R=bzWh^7?ptO|Mio z!?9B$W&WHbAvle%w_C=~B=N&;9IHUa1@leBP1F#oe-=ABuFQVV--Wpge3y6f*Gz$9 z=a+Zu-k@~yPyTub2K}Exfs700n~0mJAyoe?c63~so%}t;?3llkPJHxsOa9IuTI^v` z0R2B+uQ - - // Create the application's main window - mainWindow = gcnew Window(); - mainWindow->Title = "Canvas ZIndex Sample"; - - // Create the Canvas - myCanvas = gcnew Canvas(); - - // Create the child Rectangle elements - myRectangle1 = gcnew Rectangle(); - myRectangle2 = gcnew Rectangle(); - myRectangle3 = gcnew Rectangle(); - myRectangle4 = gcnew Rectangle(); - myRectangle5 = gcnew Rectangle(); - myRectangle6 = gcnew Rectangle(); - - // Set properties on the Rectangle elements - Canvas::SetTop(myRectangle1, 100); - Canvas::SetLeft(myRectangle1, 100); - Canvas::SetZIndex(myRectangle1, 3); - myRectangle1->Fill = Brushes::Blue; - myRectangle1->Width = 100; - myRectangle1->Height = 100; - - // - Canvas::SetTop(myRectangle2, 150); - Canvas::SetLeft(myRectangle2, 150); - Canvas::SetZIndex(myRectangle2, 1); - myRectangle2->Fill = Brushes::Yellow; - myRectangle2->Width = 100; - myRectangle2->Height = 100; - // - - Canvas::SetTop(myRectangle3, 200); - Canvas::SetLeft(myRectangle3, 200); - Canvas::SetZIndex(myRectangle3, 2); - myRectangle3->Fill = Brushes::Green; - myRectangle3->Width = 100; - myRectangle3->Height = 100; - - Canvas::SetTop(myRectangle4, 300); - Canvas::SetLeft(myRectangle4, 200); - Canvas::SetZIndex(myRectangle4, 1); - myRectangle4->Fill = Brushes::Green; - myRectangle4->Width = 100; - myRectangle4->Height = 100; - - Canvas::SetTop(myRectangle5, 350); - Canvas::SetLeft(myRectangle5, 150); - Canvas::SetZIndex(myRectangle5, 3); - myRectangle5->Fill = Brushes::Yellow; - myRectangle5->Width = 100; - myRectangle5->Height = 100; - - Canvas::SetTop(myRectangle6, 400); - Canvas::SetLeft(myRectangle6, 100); - Canvas::SetZIndex(myRectangle6, 2); - myRectangle6->Fill = Brushes::Blue; - myRectangle6->Width = 100; - myRectangle6->Height = 100; - - // Add the Rectangles to the Canvas' Children collection - myCanvas->Children->Add(myRectangle1); - myCanvas->Children->Add(myRectangle2); - myCanvas->Children->Add(myRectangle3); - myCanvas->Children->Add(myRectangle4); - myCanvas->Children->Add(myRectangle5); - myCanvas->Children->Add(myRectangle6); - - // Add the Canvas as the Content of the parent Window Object - mainWindow->Content = myCanvas; - mainWindow->Show(); - - // - } - ; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj b/snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj deleted file mode 100644 index f19df028c49..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj +++ /dev/null @@ -1,117 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp b/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp deleted file mode 100644 index 22572e527cd..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp +++ /dev/null @@ -1,345 +0,0 @@ -//Program.cpp file -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Text; -using namespace System::Printing; -using namespace System::IO; - -namespace DiagnoseProblematicPrintJob { - - // - private ref class TimeConverter { - - internal: - static DateTime ConvertToLocalHumanReadableTime (Int32 timeInMinutesAfterUTCMidnight) - { - // Construct a UTC midnight object. - // Must start with current date so that the local Daylight Savings system, if any, will be taken into account. - DateTime utcNow = DateTime::UtcNow; - DateTime utcMidnight = DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 0, 0, 0, DateTimeKind::Utc); - - // Add the minutes passed into the method in order to get the intended UTC time. - Double minutesAfterUTCMidnight = ((Double)timeInMinutesAfterUTCMidnight); - DateTime utcTime = utcMidnight.AddMinutes(minutesAfterUTCMidnight); - - // Convert to local time. - DateTime localTime = utcTime.ToLocalTime(); - - return localTime; - }; - }; - // - - private ref class TroubleSpotter { - - internal: - // - // Check for possible trouble states of a print job using its properties - static void SpotTroubleUsingProperties (PrintSystemJobInfo^ theJob) - { - if (theJob->IsBlocked) - { - Console::WriteLine("The job is blocked."); - } - if (theJob->IsCompleted || theJob->IsPrinted) - { - Console::WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked."); - } - if (theJob->IsDeleted || theJob->IsDeleting) - { - Console::WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted."); - } - if (theJob->IsInError) - { - Console::WriteLine("The job has errored."); - } - if (theJob->IsOffline) - { - Console::WriteLine("The printer is offline. Have user put it online with printer front panel."); - } - if (theJob->IsPaperOut) - { - Console::WriteLine("The printer is out of paper of the size required by the job. Have user add paper."); - } - - if (theJob->IsPaused || theJob->HostingPrintQueue->IsPaused) - { - HandlePausedJob(theJob); - //HandlePausedJob is defined in the complete example. - } - - if (theJob->IsPrinting) - { - Console::WriteLine("The job is printing now."); - } - if (theJob->IsSpooling) - { - Console::WriteLine("The job is spooling now."); - } - if (theJob->IsUserInterventionRequired) - { - Console::WriteLine("The printer needs human intervention."); - } - }; - // - - // - // Check for possible trouble states of a print job using the flags of the JobStatus property - static void SpotTroubleUsingJobAttributes (PrintSystemJobInfo^ theJob) - { - if ((theJob->JobStatus & PrintJobStatus::Blocked) == PrintJobStatus::Blocked) - { - Console::WriteLine("The job is blocked."); - } - if (((theJob->JobStatus & PrintJobStatus::Completed) == PrintJobStatus::Completed) - || - ((theJob->JobStatus & PrintJobStatus::Printed) == PrintJobStatus::Printed)) - { - Console::WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked."); - } - if (((theJob->JobStatus & PrintJobStatus::Deleted) == PrintJobStatus::Deleted) - || - ((theJob->JobStatus & PrintJobStatus::Deleting) == PrintJobStatus::Deleting)) - { - Console::WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted."); - } - if ((theJob->JobStatus & PrintJobStatus::Error) == PrintJobStatus::Error) - { - Console::WriteLine("The job has errored."); - } - if ((theJob->JobStatus & PrintJobStatus::Offline) == PrintJobStatus::Offline) - { - Console::WriteLine("The printer is offline. Have user put it online with printer front panel."); - } - if ((theJob->JobStatus & PrintJobStatus::PaperOut) == PrintJobStatus::PaperOut) - { - Console::WriteLine("The printer is out of paper of the size required by the job. Have user add paper."); - } - if (((theJob->JobStatus & PrintJobStatus::Paused) == PrintJobStatus::Paused) - || - ((theJob->HostingPrintQueue->QueueStatus & PrintQueueStatus::Paused) == PrintQueueStatus::Paused)) - { - HandlePausedJob(theJob); - //HandlePausedJob is defined in the complete example. - } - - if ((theJob->JobStatus & PrintJobStatus::Printing) == PrintJobStatus::Printing) - { - Console::WriteLine("The job is printing now."); - } - if ((theJob->JobStatus & PrintJobStatus::Spooling) == PrintJobStatus::Spooling) - { - Console::WriteLine("The job is spooling now."); - } - if ((theJob->JobStatus & PrintJobStatus::UserIntervention) == PrintJobStatus::UserIntervention) - { - Console::WriteLine("The printer needs human intervention."); - } - }; - // - - // - static void HandlePausedJob (PrintSystemJobInfo^ theJob) - { - // If there's no good reason for the queue to be paused, resume it and - // give user choice to resume or cancel the job. - Console::WriteLine("The user or someone with administrative rights to the queue" + "\nhas paused the job or queue." + "\nResume the queue? (Has no effect if queue is not paused.)" + "\nEnter \"Y\" to resume, otherwise press return: "); - String^ resume = Console::ReadLine(); - if (resume == "Y") - { - theJob->HostingPrintQueue->Resume(); - - // It is possible the job is also paused. Find out how the user wants to handle that. - Console::WriteLine("Does user want to resume print job or cancel it?" + "\nEnter \"Y\" to resume (any other key cancels the print job): "); - String^ userDecision = Console::ReadLine(); - if (userDecision == "Y") - { - theJob->Resume(); - } else - { - theJob->Cancel(); - } - } - }; - // - - // - static void ReportQueueAndJobAvailability (PrintSystemJobInfo^ theJob) - { - if (!(ReportAvailabilityAtThisTime(theJob->HostingPrintQueue) && ReportAvailabilityAtThisTime(theJob))) - { - if (!ReportAvailabilityAtThisTime(theJob->HostingPrintQueue)) - { - Console::WriteLine("\nThat queue is not available at this time of day." + "\nJobs in the queue will start printing again at {0}", TimeConverter::ConvertToLocalHumanReadableTime(theJob->HostingPrintQueue->StartTimeOfDay).ToShortTimeString()); - // TimeConverter class is defined in the complete sample - } - if (!ReportAvailabilityAtThisTime(theJob)) - { - Console::WriteLine("\nThat job is set to print only between {0} and {1}", TimeConverter::ConvertToLocalHumanReadableTime(theJob->StartTimeOfDay).ToShortTimeString(), TimeConverter::ConvertToLocalHumanReadableTime(theJob->UntilTimeOfDay).ToShortTimeString()); - } - Console::WriteLine("\nThe job will begin printing as soon as it reaches the top of the queue after:"); - if (theJob->StartTimeOfDay > theJob->HostingPrintQueue->StartTimeOfDay) - { - Console::WriteLine(TimeConverter::ConvertToLocalHumanReadableTime(theJob->StartTimeOfDay).ToShortTimeString()); - } else - { - Console::WriteLine(TimeConverter::ConvertToLocalHumanReadableTime(theJob->HostingPrintQueue->StartTimeOfDay).ToShortTimeString()); - } - - } - }; - // - - - // - static Boolean ReportAvailabilityAtThisTime (PrintQueue^ pq) - { - Boolean available = true; - if (pq->StartTimeOfDay != pq->UntilTimeOfDay) - { - DateTime utcNow = DateTime::UtcNow; - Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes; - - // If now is not within the range of available times . . . - if (!((pq->StartTimeOfDay < utcNowAsMinutesAfterMidnight) && (utcNowAsMinutesAfterMidnight < pq->UntilTimeOfDay))) - { - available = false; - } - } - return available; - }; - // - - - // - static Boolean ReportAvailabilityAtThisTime (PrintSystemJobInfo^ theJob) - { - Boolean available = true; - if (theJob->StartTimeOfDay != theJob->UntilTimeOfDay) - { - DateTime utcNow = DateTime::UtcNow; - Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes; - - // If "now" is not within the range of available times . . . - if (!((theJob->StartTimeOfDay < utcNowAsMinutesAfterMidnight) && (utcNowAsMinutesAfterMidnight < theJob->UntilTimeOfDay))) - { - available = false; - } - } - return available; - } - // - - }; - - - private ref class Program { - - public: - static void Main (array^ args) - { - // Obtain a list of print servers. - Console::Write("Enter path and file name of CRLF-delimited list of print servers" + "\n(press Return for default \"C:\\PrintServers.txt\"): "); - String^ pathToListOfPrintServers = Console::ReadLine(); - if (pathToListOfPrintServers == "") - { - pathToListOfPrintServers = "C:\\PrintServers.txt"; - } - StreamReader^ fileOfPrintServers = gcnew StreamReader(pathToListOfPrintServers); - - // Obtain the username of the person with the problematic print job. - Console::Write("\nEnter username of person that submitted print job" + "\n(press Return for the current user {0}: ", Environment::UserName); - String^ userName = Console::ReadLine(); - if (userName == "") - { - userName = Environment::UserName; - } - - // Prompt user to determine the method that will be used to read the queue status. - Console::Write("\nEnter \"Y\" to check the problematic job using its JobStatus attributes." + "\nOtherwise, press Return and the job will be checked using its specific properties: "); - String^ useAttributesResponse = Console::ReadLine(); - - // Create list of all jobs submitted by user. - String^ line; - Boolean atLeastOne = false; - String^ jobList = "\n\nAll print jobs submitted by the user are listed here:\n\n"; - while ((line = fileOfPrintServers->ReadLine()) != nullptr) - { - PrintServer^ myPS = gcnew PrintServer(line, PrintSystemDesiredAccess::AdministrateServer); - PrintQueueCollection^ myPrintQueues = myPS->GetPrintQueues(); - - // - for each (PrintQueue^ pq in myPrintQueues) - { - pq->Refresh(); - PrintJobInfoCollection^ jobs = pq->GetPrintJobInfoCollection(); - for each (PrintSystemJobInfo^ job in jobs) - { - // Since the user may not be able to articulate which job is problematic, - // present information about each job the user has submitted. - if (job->Submitter == userName) - { - atLeastOne = true; - jobList = jobList + "\nServer:" + line; - jobList = jobList + "\n\tQueue:" + pq->Name; - jobList = jobList + "\n\tLocation:" + pq->Location; - jobList = jobList + "\n\t\tJob: " + job->JobName + " ID: " + job->JobIdentifier; - } - } - } - // - } - - fileOfPrintServers->Close(); - - if (!atLeastOne) - { - jobList = "\n\nNo jobs submitted by " + userName + " were found.\n\n"; - Console::WriteLine(jobList); - } else - { - jobList = jobList + "\n\nIf multiple jobs are listed, use the information provided" + " above and by the user to identify the job needing diagnosis.\n\n"; - Console::WriteLine(jobList); - // - // When the problematic print job has been identified, enter information about it. - Console::Write("\nEnter the print server hosting the job (including leading slashes \\\\): " + "\n(press Return for the current computer \\\\{0}): ", Environment::MachineName); - String^ pServer = Console::ReadLine(); - if (pServer == "") - { - pServer = "\\\\" + Environment::MachineName; - } - Console::Write("\nEnter the print queue hosting the job: "); - String^ pQueue = Console::ReadLine(); - Console::Write("\nEnter the job ID: "); - Int16 jobID = Convert::ToInt16(Console::ReadLine()); - - // Create objects to represent the server, queue, and print job. - PrintServer^ hostingServer = gcnew PrintServer(pServer, PrintSystemDesiredAccess::AdministrateServer); - PrintQueue^ hostingQueue = gcnew PrintQueue(hostingServer, pQueue, PrintSystemDesiredAccess::AdministratePrinter); - PrintSystemJobInfo^ theJob = hostingQueue->GetJob(jobID); - - if (useAttributesResponse == "Y") - { - TroubleSpotter::SpotTroubleUsingJobAttributes(theJob); - // TroubleSpotter class is defined in the complete example. - } else - { - TroubleSpotter::SpotTroubleUsingProperties(theJob); - } - - TroubleSpotter::ReportQueueAndJobAvailability(theJob); - // - } - Console::WriteLine("\nPress Return to end."); - Console::ReadLine(); - }; - }; - -} - -//Entry Point: -int main (array^ args) -{ - DiagnoseProblematicPrintJob::Program::Main(args); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj b/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj deleted file mode 100644 index d3327709232..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21208.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Console - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp b/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp deleted file mode 100644 index 8979de0de51..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp +++ /dev/null @@ -1,123 +0,0 @@ -//DockPanel_Ovw_Sample.cpp file - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Shapes; -using namespace System::Threading; - -namespace SDKSample { - - public ref class app : Application { - - private: - Window^ mainWindow; - - protected: - virtual void OnStartup (StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // - - // Create the application's main window - mainWindow = gcnew Window(); - mainWindow->Title = "DockPanel Sample"; - - // Create the DockPanel - DockPanel^ myDockPanel = gcnew DockPanel(); - myDockPanel->LastChildFill = true; - - // Define the child content - Border^ myBorder1 = gcnew Border(); - myBorder1->Height = 25; - myBorder1->Background = Brushes::SkyBlue; - myBorder1->BorderBrush = Brushes::Black; - myBorder1->BorderThickness = Thickness(1); - DockPanel::SetDock(myBorder1, Dock::Top); - TextBlock^ myTextBlock1 = gcnew TextBlock(); - myTextBlock1->Foreground = Brushes::Black; - myTextBlock1->Text = "Dock = Top"; - myBorder1->Child = myTextBlock1; - - Border^ myBorder2 = gcnew Border(); - myBorder2->Height = 25; - myBorder2->Background = Brushes::SkyBlue; - myBorder2->BorderBrush = Brushes::Black; - myBorder2->BorderThickness = Thickness(1); - DockPanel::SetDock(myBorder2, Dock::Top); - TextBlock^ myTextBlock2 = gcnew TextBlock(); - myTextBlock2->Foreground = Brushes::Black; - myTextBlock2->Text = "Dock = Top"; - myBorder2->Child = myTextBlock2; - - Border^ myBorder3 = gcnew Border(); - myBorder3->Height = 25; - myBorder3->Background = Brushes::LemonChiffon; - myBorder3->BorderBrush = Brushes::Black; - myBorder3->BorderThickness = Thickness(1); - DockPanel::SetDock(myBorder3, Dock::Bottom); - TextBlock^ myTextBlock3 = gcnew TextBlock(); - myTextBlock3->Foreground = Brushes::Black; - myTextBlock3->Text = "Dock = Bottom"; - myBorder3->Child = myTextBlock3; - - Border^ myBorder4 = gcnew Border(); - myBorder4->Width = 200; - myBorder4->Background = Brushes::PaleGreen; - myBorder4->BorderBrush = Brushes::Black; - myBorder4->BorderThickness = Thickness(1); - DockPanel::SetDock(myBorder4, Dock::Left); - TextBlock^ myTextBlock4 = gcnew TextBlock(); - myTextBlock4->Foreground = Brushes::Black; - myTextBlock4->Text = "Dock = Left"; - myBorder4->Child = myTextBlock4; - - Border^ myBorder5 = gcnew Border(); - myBorder5->Background = Brushes::White; - myBorder5->BorderBrush = Brushes::Black; - myBorder5->BorderThickness = Thickness(1); - TextBlock^ myTextBlock5 = gcnew TextBlock(); - myTextBlock5->Foreground = Brushes::Black; - myTextBlock5->Text = "This content will Fill the remaining space"; - myBorder5->Child = myTextBlock5; - - // Add child elements to the DockPanel Children collection - myDockPanel->Children->Add(myBorder1); - myDockPanel->Children->Add(myBorder2); - myDockPanel->Children->Add(myBorder3); - myDockPanel->Children->Add(myBorder4); - myDockPanel->Children->Add(myBorder5); - - // Add the parent Canvas as the Content of the Window Object - mainWindow->Content = myDockPanel; - mainWindow->Show(); - - // - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj b/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj deleted file mode 100644 index 9f1e7fd1db0..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp b/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp deleted file mode 100644 index f559468cac9..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp +++ /dev/null @@ -1,44 +0,0 @@ -//Program.cpp file - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::Text; -using namespace System::Printing; -using namespace System::Collections; - -namespace EnumerateSubsetOfPrintQueues { - - private ref class Program { - - public: - static void Main (array^ args) - { - // - // Specify that the list will contain only the print queues that are installed as local and are shared - array^ enumerationFlags = {EnumeratedPrintQueueTypes::Local,EnumeratedPrintQueueTypes::Shared}; - - LocalPrintServer^ printServer = gcnew LocalPrintServer(); - - //Use the enumerationFlags to filter out unwanted print queues - PrintQueueCollection^ printQueuesOnLocalServer = printServer->GetPrintQueues(enumerationFlags); - - Console::WriteLine("These are your shared, local print queues:\n\n"); - - for each (PrintQueue^ printer in printQueuesOnLocalServer) - { - Console::WriteLine("\tThe shared printer " + printer->Name + " is located at " + printer->Location + "\n"); - } - Console::WriteLine("Press enter to continue."); - Console::ReadLine(); - // - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -int main (array^ args) -{ - EnumerateSubsetOfPrintQueues::Program::Main(args); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj b/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj deleted file mode 100644 index 4c1138eccdf..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21208.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Console - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp deleted file mode 100644 index 4c510d2b162..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp +++ /dev/null @@ -1,133 +0,0 @@ -//GifEncoderDecoder.cpp file - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; -using namespace System::Security; - - -namespace SDKSample { - - public ref class app : Application { - - private: System::Windows::Window^ mainWindow; - - protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - - private: - [SecuritySafeCritical] - void CreateAndShowMainWindow () - { - // Create the application's main window - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "GIF Imaging Sample"; - ScrollViewer^ mySV = gcnew ScrollViewer(); - - // - int width = 128; - int height = width; - int stride = width / 8; - array^ pixels = gcnew array(height * stride); - - // Define the image palette - - BitmapPalette^ myPalette = BitmapPalettes::WebPalette; - - // Creates a new empty image with the pre-defined palette - - // - BitmapSource^ image = BitmapSource::Create( - width, - height, - 96, - 96, - PixelFormats::Indexed1, - myPalette, - pixels, - stride); - // - - // - FileStream^ stream = gcnew FileStream("new.gif", FileMode::Create); - GifBitmapEncoder^ encoder = gcnew GifBitmapEncoder(); - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); - encoder->Frames->Add(BitmapFrame::Create(image)); - encoder->Save(stream); - // - - // - - // - - // Open a Stream and decode a GIF image - Stream^ imageStreamSource = gcnew FileStream("tulipfarm.gif", FileMode::Open, FileAccess::Read, FileShare::Read); - GifBitmapDecoder^ decoder = gcnew GifBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource = decoder->Frames[0]; - - // Draw the Image - Image^ myImage = gcnew Image(); - myImage->Source = bitmapSource; - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - // - - // - - // Open a Uri and decode a GIF image - System::Uri^ myUri = gcnew System::Uri("tulipfarm.gif", UriKind::RelativeOrAbsolute); - GifBitmapDecoder^ decoder2 = gcnew GifBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource2 = decoder2->Frames[0]; - - // Draw the Image - Image^ myImage2 = gcnew Image(); - myImage2->Source = bitmapSource2; - myImage2->Stretch = Stretch::None; - myImage2->Margin = System::Windows::Thickness(20); - // - - // Define a StackPanel to host the decoded GIF images - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; - - // Add the Image and TextBlock to the parent Grid - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myImage2); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the Content of the Parent Window Object - mySV->Content = myStackPanel; - mainWindow->Content = mySV; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj deleted file mode 100644 index 88bb5889077..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/tulipfarm.gif b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/tulipfarm.gif deleted file mode 100644 index def1be66323b9726d602e12fa0559cea5b548972..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 170770 zcmeFYhgTEL`#zjbXdzTXPv`;EL=ZzY2|b{Oh=4&bND(O#KoJ2kl`bFx0-^?#Dr%&O ziV%u)FenQ42uc$b6%`SAUOwM{;~VLSZl{JRF5bp{y|&B>exdnFilX#^B)?Yd98z!D6sjJPM27Ja57p z4+r3p@c#jW#A7gc3?7e1;jK}4GS(V{w8m`aKw0Cl*7!}s+8R%`CZnv$*4E@rgJw;! zCIbLu0Gx~jkda6-216#J$Yd;;f~5f96eN;@K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1E%*^(mm_PhWV}@S z2Vp&vv53dYPv%J^!^t1LE#E*#Q9ZuQF1z={mxpz%x#5D^WG6@lxL!wEuRifj=C_ej zRhn9Esx@25=Czc%u75E^A1COJ&UKL7OsnmL-0xsJpC5b5N!(yVnrqi{%`}2u$`MKJ zbL-lUqtmjB`fM^t9%1%Ex<}~`;upyXEA?5dq@#Ueq|DNfGwXhS*L#m}tUwBsS`SUc z^6}R6D6)`#c} zlNo_$dFQM+)C$Hgcb?>x{T+shMA-jZ#uYnFF8IrSFH%Mwhuha~Muof!-+{94Cc(aP v?$N=BzBS%F;?L~`3n;p*-6e(SscJ>IWU7+SbTitle = "JPEG Imaging Sample"; - System::Windows::Controls::ScrollViewer^ mySV = gcnew System::Windows::Controls::ScrollViewer(); - - // - int width = 128; - int height = width; - int stride = width / 8; - array^ pixels = gcnew array(height * stride); - - // Define the image palette - BitmapPalette^ myPalette = BitmapPalettes::Halftone256; - - // Creates a new empty image with the pre-defined palette. - // - BitmapSource^ image = BitmapSource::Create( - width, height, - 96, 96, - PixelFormats::Indexed1, - myPalette, - pixels, - stride); - // - // - - System::IO::FileStream^ stream = gcnew System::IO::FileStream("new.jpg", FileMode::Create); - JpegBitmapEncoder^ encoder = gcnew JpegBitmapEncoder(); - TextBlock^ myTextBlock = gcnew System::Windows::Controls::TextBlock(); - myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); - encoder->FlipHorizontal = true; - encoder->FlipVertical = false; - encoder->QualityLevel = 30; - encoder->Rotation = Rotation::Rotate90; - encoder->Frames->Add(BitmapFrame::Create(image)); - encoder->Save(stream); - // - // - - // - // Open a Stream and decode a JPEG image - Stream^ imageStreamSource = gcnew FileStream("tulipfarm.jpg", FileMode::Open, FileAccess::Read, FileShare::Read); - JpegBitmapDecoder^ decoder = gcnew JpegBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource = decoder->Frames[0]; - - // Draw the Image - Image^ myImage = gcnew Image(); - myImage->Source = bitmapSource; - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - // - - // - // Open a Uri and decode a JPEG image - System::Uri^ myUri = gcnew System::Uri("tulipfarm.jpg", UriKind::RelativeOrAbsolute); - JpegBitmapDecoder^ decoder2 = gcnew JpegBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource2 = decoder2->Frames[0]; - - // Draw the Image - Image^ myImage2 = gcnew Image(); - myImage2->Source = bitmapSource2; - myImage2->Stretch = Stretch::None; - myImage2->Margin = System::Windows::Thickness(20); - // - - // Define a StackPanel to host the decoded JPEG images - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; - - // Add the Image and TextBlock to the parent Grid. - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myImage2); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the content of the parent window. - mySV->Content = myStackPanel; - mainWindow->Content = mySV; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThreadAttribute()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - } - ; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -int main(array ^args) -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj deleted file mode 100644 index f5748c97859..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj +++ /dev/null @@ -1,129 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {6EFA9BEA-6237-4CCC-BFD8-87EB6499E919} - SDKSample - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/tulipfarm.jpg b/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/tulipfarm.jpg deleted file mode 100644 index 2ce60cad09155366d0c4ef18b9e01dedd61a1cb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 110238 zcma&N1z1#F_cnfJh8()PhZK=iK#)#}p;JIYN{~+J9y$e-7;nx>vWg4- zv!^uv`wF2__>hCjzt6e2!2A&(v=R>azjkt2hZ<@_dH{T=q>}g5i-&|W59&k+h=@b< zVu1GWe|rBjIH6ubF+7P+i9tq3&}QJm9P$IS4LF1z_Pz%Wy3bCuWaWQa`IpI@$itzS z$hZoCFUSV^Uk%{N#th-}pdZJy|JU^X|NOug!I!@<4c2YQY}>a_^KU<`(?TMMH(DLx z^kR?HLH7{^Og;wBm&uwFWw4=ljZ_o8yR~!td(R)VAma+{e;kJgNiLKG z`}njpfqe<1$feka|Q zUL$!{S`P?FuRu%dA&*!u2E1^hH@VLr)$# z(LwYlT#)RKN1-s__er*Yng3^&EPosIrw3b*IC!gi^S}uG>~qwAO$VYdt}yv8_Tcp4 zs#yY^J)YE1Ltkt-W+xn;(hg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UkZk7!tMSv>(44q(Y0k zf-*Oo<>DjVO6XA}2)64*a!9FV0;hn?@WwjNe)nYQ?bNACBOalFYTv zyoekQAx*qb5o~U_=~l^}UD+)*;4 zcZTNj%HGy8VQYOwqX*haConm2#~)Ix>Fpcn?PZBwwCww>tis~vZ={PNj2fhKA1@J6 VpZH=N=;(b8{{ZTitle = "LayoutTransform Sample"; - - // Create the Grid - grid1 = gcnew Grid(); - grid1->HorizontalAlignment = HorizontalAlignment::Left; - grid1->VerticalAlignment = VerticalAlignment::Top; - grid1->ShowGridLines = true; - - // Define the Columns - colDef1 = gcnew ColumnDefinition(); - colDef1->Width = GridLength::Auto; - colDef2 = gcnew ColumnDefinition(); - colDef2->Width = GridLength::Auto; - grid1->ColumnDefinitions->Add(colDef1); - grid1->ColumnDefinitions->Add(colDef2); - - // Define the Rows - rowDef1 = gcnew RowDefinition(); - rowDef1->Height = GridLength::Auto; - rowDef2 = gcnew RowDefinition(); - rowDef2->Height = GridLength::Auto; - rowDef3 = gcnew RowDefinition(); - rowDef3->Height = GridLength::Auto; - rowDef4 = gcnew RowDefinition(); - rowDef4->Height = GridLength::Auto; - rowDef5 = gcnew RowDefinition(); - rowDef5->Height = GridLength::Auto; - rowDef6 = gcnew RowDefinition(); - rowDef6->Height = GridLength::Auto; - grid1->RowDefinitions->Add(rowDef1); - grid1->RowDefinitions->Add(rowDef2); - grid1->RowDefinitions->Add(rowDef3); - grid1->RowDefinitions->Add(rowDef4); - grid1->RowDefinitions->Add(rowDef5); - grid1->RowDefinitions->Add(rowDef6); - - // RotateTransform Sample - Button^ btn1 = gcnew Button(); - btn1->Background = Brushes::LightCoral; - btn1->Content = "No Transform Applied"; - Grid::SetRow(btn1, 0); - Grid::SetColumn(btn1, 0); - grid1->Children->Add(btn1); - - // - - Button^ btn2 = gcnew Button(); - btn2->Background = Brushes::LightCoral; - btn2->Content = "RotateTransform"; - btn2->LayoutTransform = gcnew RotateTransform(45, 25, 25); - Grid::SetRow(btn2, 0); - Grid::SetColumn(btn2, 1); - grid1->Children->Add(btn2); - - // - - // SkewTransform Sample - Button^ btn3 = gcnew Button(); - btn3->Background = Brushes::LightCyan; - btn3->Content = "No Transform Applied"; - Grid::SetRow(btn3, 1); - Grid::SetColumn(btn3, 0); - grid1->Children->Add(btn3); - - Button^ btn4 = gcnew Button(); - btn4->Background = Brushes::LightCyan; - btn4->Content = "SkewTransform"; - btn4->LayoutTransform = gcnew SkewTransform(45, 0, 0, 0); - Grid::SetRow(btn4, 1); - Grid::SetColumn(btn4, 1); - grid1->Children->Add(btn4); - - // ScaleTransform Sample - Button^ btn5 = gcnew Button(); - btn5->Background = Brushes::LightSlateGray; - btn5->Content = "No Transform Applied"; - Grid::SetRow(btn5, 2); - Grid::SetColumn(btn5, 0); - grid1->Children->Add(btn5); - - Button^ btn6 = gcnew Button(); - btn6->Background = Brushes::LightSlateGray; - btn6->Content = "ScaleTransform"; - btn6->LayoutTransform = gcnew ScaleTransform(2, 2, 25, 25); - Grid::SetRow(btn6, 2); - Grid::SetColumn(btn6, 1); - grid1->Children->Add(btn6); - - // TranslateTransform : RenderTransform Sample - Button^ btn7 = gcnew Button(); - btn7->Background = Brushes::LightSeaGreen; - btn7->Content = "No Transform Applied"; - Grid::SetRow(btn7, 3); - Grid::SetColumn(btn7, 0); - grid1->Children->Add(btn7); - - Button^ btn8 = gcnew Button(); - btn8->Background = Brushes::LightSeaGreen; - btn8->Content = "TranslateTransform: RenderTransform"; - btn8->RenderTransform = gcnew TranslateTransform(100, 200); - Grid::SetRow(btn8, 3); - Grid::SetColumn(btn8, 1); - grid1->Children->Add(btn8); - - // TranslateTransform : LayoutTransform Sample - Button^ btn9 = gcnew Button(); - btn9->Background = Brushes::LightBlue; - btn9->Content = "No Transform Applied"; - Grid::SetRow(btn9, 4); - Grid::SetColumn(btn9, 0); - grid1->Children->Add(btn9); - - Button^ btn10 = gcnew Button(); - btn10->Background = Brushes::LightBlue; - btn10->Content = "TranslateTransform: LayoutTransform"; - btn10->LayoutTransform = gcnew TranslateTransform(100, 200); - Grid::SetRow(btn10, 4); - Grid::SetColumn(btn10, 1); - grid1->Children->Add(btn10); - - // MatrixTransform Sample - Button^ btn11 = gcnew Button(); - btn11->Background = Brushes::LightGoldenrodYellow; - btn11->Content = "No Transform Applied"; - Grid::SetRow(btn11, 5); - Grid::SetColumn(btn11, 0); - grid1->Children->Add(btn11); - - Button^ btn12 = gcnew Button(); - btn12->Background = Brushes::LightGoldenrodYellow; - btn12->Content = "MatrixTransform"; - btn12->LayoutTransform = gcnew MatrixTransform(1, 3, 3, 3, 3, 3); - Grid::SetRow(btn12, 5); - Grid::SetColumn(btn12, 1); - grid1->Children->Add(btn12); - - mainWindow->Content = grid1; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - LayoutTransformCode::app^ app = gcnew LayoutTransformCode::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return LayoutTransformCode::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj b/snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj deleted file mode 100644 index 7f326917b68..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp b/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp deleted file mode 100644 index 2e77a263adb..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp +++ /dev/null @@ -1,220 +0,0 @@ -//Margin_Padding_Alignment_Sample.cpp file -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Shapes; -using namespace System::Threading; - -namespace Margin_Padding_Alignment_Sample { - - public ref class app : Application { - - private: - Border^ myBorder; - Grid^ myGrid; - Window^ mainWindow; - - protected: - virtual void OnStartup (StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // - mainWindow = gcnew Window(); - - // - myBorder = gcnew Border(); - myBorder->Background = Brushes::LightBlue; - myBorder->BorderBrush = Brushes::Black; - myBorder->BorderThickness = Thickness(2); - myBorder->CornerRadius = CornerRadius(45); - myBorder->Padding = Thickness(25); - // - - // Define the Grid. - myGrid = gcnew Grid(); - myGrid->Background = Brushes::White; - myGrid->ShowGridLines = true; - - // Define the Columns. - ColumnDefinition^ myColDef1 = gcnew ColumnDefinition(); - myColDef1->Width = GridLength(1, GridUnitType::Auto); - ColumnDefinition^ myColDef2 = gcnew ColumnDefinition(); - myColDef2->Width = GridLength(1, GridUnitType::Star); - ColumnDefinition^ myColDef3 = gcnew ColumnDefinition(); - myColDef3->Width = GridLength(1, GridUnitType::Auto); - - // Add the ColumnDefinitions to the Grid. - myGrid->ColumnDefinitions->Add(myColDef1); - myGrid->ColumnDefinitions->Add(myColDef2); - myGrid->ColumnDefinitions->Add(myColDef3); - - // Add the first child StackPanel. - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->HorizontalAlignment = HorizontalAlignment::Left; - myStackPanel->VerticalAlignment = VerticalAlignment::Top; - Grid::SetColumn(myStackPanel, 0); - Grid::SetRow(myStackPanel, 0); - TextBlock^ myTextBlock1 = gcnew TextBlock(); - myTextBlock1->FontSize = 18; - myTextBlock1->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock1->Margin = Thickness(0, 0, 0, 15); - myTextBlock1->Text = "StackPanel 1"; - // - Button^ myButton1 = gcnew Button(); - myButton1->Margin = Thickness(0, 10, 0, 10); - myButton1->Content = "Button 1"; - Button^ myButton2 = gcnew Button(); - myButton2->Margin = Thickness(0, 10, 0, 10); - myButton2->Content = "Button 2"; - Button^ myButton3 = gcnew Button(); - myButton3->Margin = Thickness(0, 10, 0, 10); - // - TextBlock^ myTextBlock2 = gcnew TextBlock(); - myTextBlock2->Text = "ColumnDefinition.Width = \"Auto\""; - TextBlock^ myTextBlock3 = gcnew TextBlock(); - myTextBlock3->Text = "StackPanel.HorizontalAlignment = \"Left\""; - TextBlock^ myTextBlock4 = gcnew TextBlock(); - myTextBlock4->Text = "StackPanel.VerticalAlignment = \"Top\""; - TextBlock^ myTextBlock5 = gcnew TextBlock(); - myTextBlock5->Text = "StackPanel.Orientation = \"Vertical\""; - TextBlock^ myTextBlock6 = gcnew TextBlock(); - myTextBlock6->Text = "Button.Margin = \"1,10,0,10\""; - myStackPanel->Children->Add(myTextBlock1); - myStackPanel->Children->Add(myButton1); - myStackPanel->Children->Add(myButton2); - myStackPanel->Children->Add(myButton3); - myStackPanel->Children->Add(myTextBlock2); - myStackPanel->Children->Add(myTextBlock3); - myStackPanel->Children->Add(myTextBlock4); - myStackPanel->Children->Add(myTextBlock5); - myStackPanel->Children->Add(myTextBlock6); - - // Add the second child StackPanel. - StackPanel^ myStackPanel2 = gcnew StackPanel(); - myStackPanel2->HorizontalAlignment = HorizontalAlignment::Stretch; - myStackPanel2->VerticalAlignment = VerticalAlignment::Top; - myStackPanel2->Orientation = Orientation::Vertical; - Grid::SetColumn(myStackPanel2, 1); - Grid::SetRow(myStackPanel2, 0); - TextBlock^ myTextBlock7 = gcnew TextBlock(); - myTextBlock7->FontSize = 18; - myTextBlock7->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock7->Margin = Thickness(0, 0, 0, 15); - myTextBlock7->Text = "StackPanel 2"; - Button^ myButton4 = gcnew Button(); - myButton4->Margin = Thickness(10, 0, 10, 0); - myButton4->Content = "Button 4"; - Button^ myButton5 = gcnew Button(); - myButton5->Margin = Thickness(10, 0, 10, 0); - myButton5->Content = "Button 5"; - Button^ myButton6 = gcnew Button(); - myButton6->Margin = Thickness(10, 0, 10, 0); - myButton6->Content = "Button 6"; - TextBlock^ myTextBlock8 = gcnew TextBlock(); - myTextBlock8->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock8->Text = "ColumnDefinition.Width = \"*\""; - TextBlock^ myTextBlock9 = gcnew TextBlock(); - myTextBlock9->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock9->Text = "StackPanel.HorizontalAlignment = \"Stretch\""; - TextBlock^ myTextBlock10 = gcnew TextBlock(); - myTextBlock10->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock10->Text = "StackPanel.VerticalAlignment = \"Top\""; - TextBlock^ myTextBlock11 = gcnew TextBlock(); - myTextBlock11->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock11->Text = "StackPanel.Orientation = \"Horizontal\""; - TextBlock^ myTextBlock12 = gcnew TextBlock(); - myTextBlock12->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock12->Text = "Button.Margin = \"10,0,10,0\""; - myStackPanel2->Children->Add(myTextBlock7); - myStackPanel2->Children->Add(myButton4); - myStackPanel2->Children->Add(myButton5); - myStackPanel2->Children->Add(myButton6); - myStackPanel2->Children->Add(myTextBlock8); - myStackPanel2->Children->Add(myTextBlock9); - myStackPanel2->Children->Add(myTextBlock10); - myStackPanel2->Children->Add(myTextBlock11); - myStackPanel2->Children->Add(myTextBlock12); - - // Add the final child StackPanel. - StackPanel^ myStackPanel3 = gcnew StackPanel(); - myStackPanel3->HorizontalAlignment = HorizontalAlignment::Left; - myStackPanel3->VerticalAlignment = VerticalAlignment::Top; - Grid::SetColumn(myStackPanel3, 2); - Grid::SetRow(myStackPanel3, 0); - TextBlock^ myTextBlock13 = gcnew TextBlock(); - myTextBlock13->FontSize = 18; - myTextBlock13->HorizontalAlignment = HorizontalAlignment::Center; - myTextBlock13->Margin = Thickness(0, 0, 0, 15); - myTextBlock13->Text = "StackPanel 3"; - // - Button^ myButton7 = gcnew Button(); - myButton7->Margin = Thickness(10); - myButton7->Content = "Button 7"; - Button^ myButton8 = gcnew Button(); - myButton8->Margin = Thickness(10); - myButton8->Content = "Button 8"; - Button^ myButton9 = gcnew Button(); - myButton9->Margin = Thickness(10); - myButton9->Content = "Button 9"; - // - TextBlock^ myTextBlock14 = gcnew TextBlock(); - myTextBlock14->Text = "ColumnDefinition.Width = \"Auto\""; - TextBlock^ myTextBlock15 = gcnew TextBlock(); - myTextBlock15->Text = "StackPanel.HorizontalAlignment = \"Left\""; - TextBlock^ myTextBlock16 = gcnew TextBlock(); - myTextBlock16->Text = "StackPanel.VerticalAlignment = \"Top\""; - TextBlock^ myTextBlock17 = gcnew TextBlock(); - myTextBlock17->Text = "StackPanel.Orientation = \"Vertical\""; - TextBlock^ myTextBlock18 = gcnew TextBlock(); - myTextBlock18->Text = "Button.Margin = \"10\""; - myStackPanel3->Children->Add(myTextBlock13); - myStackPanel3->Children->Add(myButton7); - myStackPanel3->Children->Add(myButton8); - myStackPanel3->Children->Add(myButton9); - myStackPanel3->Children->Add(myTextBlock14); - myStackPanel3->Children->Add(myTextBlock15); - myStackPanel3->Children->Add(myTextBlock16); - myStackPanel3->Children->Add(myTextBlock17); - myStackPanel3->Children->Add(myTextBlock18); - - // Add child content to the parent Grid. - myGrid->Children->Add(myStackPanel); - myGrid->Children->Add(myStackPanel2); - myGrid->Children->Add(myStackPanel3); - - // Add the Grid as the lone child of the Border. - myBorder->Child = myGrid; - - // Add the Border to the Window as Content and show the Window. - mainWindow->Content = myBorder; - mainWindow->Title = "Margin, Padding, and Alignment Sample"; - mainWindow->Show(); - // - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - Margin_Padding_Alignment_Sample::app^ app = gcnew Margin_Padding_Alignment_Sample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return Margin_Padding_Alignment_Sample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj b/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj deleted file mode 100644 index c7ea1dd1168..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21230.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp b/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp deleted file mode 100644 index c9a76836322..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp +++ /dev/null @@ -1,101 +0,0 @@ -//PlotPanel.cpp file -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Shapes; -using namespace System::Windows::Media; -using namespace System::Threading; - -namespace PlotPanel { - - public ref class app : System::Windows::Application { - - // - public: - ref class PlotPanel : Panel { - - public: - PlotPanel () {}; - - protected: - // Override the default Measure method of Panel - // - virtual Size MeasureOverride(Size availableSize) override - { - Size^ panelDesiredSize = gcnew Size(); - - // In our example, we just have one child. - // Report that our panel requires just the size of its only child. - for each (UIElement^ child in InternalChildren) - { - child->Measure(availableSize); - panelDesiredSize = child->DesiredSize; - } - return *panelDesiredSize ; - } - // - - protected: - virtual System::Windows::Size ArrangeOverride (Size finalSize) override - { - for each (UIElement^ child in InternalChildren) - { - double x = 50; - double y = 50; - child->Arrange(Rect(Point(x, y), child->DesiredSize)); - } - return finalSize; - }; - }; - // - - private: - PlotPanel^ plot1; - Window^ mainWindow; - Shapes::Rectangle^ rect1; - - protected: - virtual void OnStartup (StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // Create the application's main window - - mainWindow = gcnew Window(); - plot1 = gcnew PlotPanel(); - plot1->Background = Brushes::White; - - rect1 = gcnew Shapes::Rectangle(); - rect1->Fill = Brushes::CornflowerBlue; - rect1->Width = 200; - rect1->Height = 200; - mainWindow->Content = plot1; - plot1->Children->Add(rect1); - mainWindow->Title = "Custom Panel Sample"; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - PlotPanel::app^ app = gcnew PlotPanel::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return PlotPanel::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj b/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj deleted file mode 100644 index 4c075c21996..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp deleted file mode 100644 index 31e7053f823..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp +++ /dev/null @@ -1,130 +0,0 @@ -//PngEncoderDecoder.cpp file - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; -using namespace System::Security; - - -namespace SDKSample { - - public ref class app : Application { - - private: Window^ mainWindow; - - protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: void CreateAndShowMainWindow () - { - - // Create the application's main window - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "PNG Imaging Sample"; - ScrollViewer^ mySV = gcnew ScrollViewer(); - - // - int width = 128; - int height = 128; - int stride = width; - array^ pixels = gcnew array(height * stride); - - // Define the image palette - BitmapPalette^ myPalette = BitmapPalettes::Halftone256; - - // Creates a new empty image with the pre-defined palette - - // - BitmapSource^ image = BitmapSource::Create(width, - height, - 96, - 96, - PixelFormats::Indexed8, - myPalette, - pixels, - stride); - // - - // - FileStream^ stream = gcnew FileStream("new.png", FileMode::Create); - PngBitmapEncoder^ encoder = gcnew PngBitmapEncoder(); - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); - encoder->Interlace = PngInterlaceOption::On; - encoder->Frames->Add(BitmapFrame::Create(image)); - encoder->Save(stream); - // - - // - - // - - // Open a Stream and decode a PNG image - Stream^ imageStreamSource = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::Read, FileShare::Read); - PngBitmapDecoder^ decoder = gcnew PngBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource = decoder->Frames[0]; - - // Draw the Image - Image^ myImage = gcnew Image(); - myImage->Source = bitmapSource; - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - // - - // - - // Open a Uri and decode a PNG image - System::Uri^ myUri = gcnew System::Uri("smiley.png", UriKind::RelativeOrAbsolute); - PngBitmapDecoder^ decoder2 = gcnew PngBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource2 = decoder2->Frames[0]; - - // Draw the Image - Image^ myImage2 = gcnew Image(); - myImage2->Source = bitmapSource2; - myImage2->Stretch = Stretch::None; - myImage2->Margin = System::Windows::Thickness(20); - // - - // Define a StackPanel to host the decoded PNG images - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; - - // Add the Image and TextBlock to the parent Grid - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myImage2); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the Content of the Parent Window Object - mySV->Content = myStackPanel; - mainWindow->Content = mySV; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj deleted file mode 100644 index 160ee1fcda5..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/smiley.png b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/smiley.png deleted file mode 100644 index 1e0b9496cad2e2133d1edb7c4d3511a059772473..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4599 zcmV002t}1^@s6I8J)%00009a7bBm000id z000id0mpBsWB>pWsYygZRCt{2oOxW7<=V%uXBpHo1RX#YK~zLgGt*F!7JEHzWu)es zrJnHEDLa|_LDS=sp^1WmqPdWWiKw83iHSQXF8GKn;g}nOAcDipGus2q@BA@hnj13= zLht+j@%u;l-1l{T@9Vywd%3Qmy+^KULSl2I(Cu}v6>+&zSbUxozVni_A}&`7*_tUW z+MFTHU!N|`k2)#MjZBs1M4Y&T{IzM){B`NlqRr=|kgb_g==L0G)h>k;7M~}r zh|7I0c7MAiTZ%h);~XuG&5`zH-auwSK7^arS7u=WvWtt5U0j5dic9$A%o+T!{{a3I zxgMh?Pea#!BjNR`AAEh+g9vly5*92VY}{y4R21Qx zZ%qFl6hs&_fY8H_;O#|d>Bys7*BHe@Aq53_kw&Q?zdF3wL)y|New8z94MfN;r3p zP+Cd=YOb;}LQW20+cv`V>4bj$2wq+U4-Zd_9Qg^>t=oXy+*}xqMrbq|>-Zy<!1#RI2;-)jKSuQVFeA3%y>4xVRnY*Ka87?d>sO0Ab4( z!j&u51@t7{xWVAZ9|<3PKxo$NCA|IiyNHR2g-WG@UayBzsk8{1RblD%dSqo~VcfXC zqeTlBy!j?!&mO|<+st!;^ypM&kd#CiGKA2)xdTRy{0L{yo`u0+fLg7tA6P1t3RRYofB+UQ zF0JtM&q+|L)ljKa)`g`~sUV6XcJ53-n>Otc5J0$e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kb&pj6&9ufn2wI^Mc<3xfy04_{yAe_fGNwes^B zbn8ZV`|W|aeEG6vwL40s5~3&~H#Zk;+IV5W00xDH_3xZDRa$B))b#Z9!NG%vpx5gk zDWfy1I8ziw96EFea=8;mjIjJxqM=EnF%_CSI=UhzCg!oAEUIJ`MG?DpCBW9!7Lz8K zcm3QDrPUH<%plm=HAh%j7z_qO?JHRyEYegemDsRhBkb&2VB9#WvoBL!tF)Bx*=K}i z&6;D$k|mEV$gCBtYG7Ke7F)N*!ok4}LxvD?a~saBXiaqG3WH(82o4S{??=?re6|>t zQmKSmt%kv1Kw@Gd+O_M1?%nBL9%{pfwtqjNM-PIhr#CijiiRXT8n(y@ZihK@7DAy=K&#c7<)>9(RsW2^-Me>j;zSzWd1ol>?M;dHr%%@} zr0i_Mgb57fa>840^~1h>$xtfqnhnZoupV6aMNvdSK>;>x+JbiNykKw7V#p8%Cr?tX z68FtfWhLSKdDF$6g98r_4-c$dxf(@9MbG?Ikmm-gTGglYtgLK&{q+KPc(}vKiN)~Y zED{q=yf6tdJT>qNx`(KQxMR* zH#}Rng^RNsJ$uM7`~$-5S%j#ygruJd$Bz**&i$bi#|g>%3DKJgGo}+pk0SK!!NEap z4-a=w^zie;q<;h<+dn({VDM75(ozme>Ar53~JH=M4lk>08vX2xr3NCpvK;? zY1SEX_nv6i={@uvJQ-7i*JA6gQ^?3w;o@Z-&gGONJ+rh - internal: - // Check for possible trouble states of a printer using its properties - static void SpotTroubleUsingProperties (System::String^% statusReport, System::Printing::PrintQueue^ pq) - { - if (pq->HasPaperProblem) - { - statusReport = statusReport + "Has a paper problem. "; - } - if (!(pq->HasToner)) - { - statusReport = statusReport + "Is out of toner. "; - } - if (pq->IsDoorOpened) - { - statusReport = statusReport + "Has an open door. "; - } - if (pq->IsInError) - { - statusReport = statusReport + "Is in an error state. "; - } - if (pq->IsNotAvailable) - { - statusReport = statusReport + "Is not available. "; - } - if (pq->IsOffline) - { - statusReport = statusReport + "Is off line. "; - } - if (pq->IsOutOfMemory) - { - statusReport = statusReport + "Is out of memory. "; - } - if (pq->IsOutOfPaper) - { - statusReport = statusReport + "Is out of paper. "; - } - if (pq->IsOutputBinFull) - { - statusReport = statusReport + "Has a full output bin. "; - } - if (pq->IsPaperJammed) - { - statusReport = statusReport + "Has a paper jam. "; - } - if (pq->IsPaused) - { - statusReport = statusReport + "Is paused. "; - } - if (pq->IsTonerLow) - { - statusReport = statusReport + "Is low on toner. "; - } - if (pq->NeedUserIntervention) - { - statusReport = statusReport + "Needs user intervention. "; - } - - // Check if queue is even available at this time of day - // The following method is defined in the complete example. - ReportAvailabilityAtThisTime(statusReport, pq); - }; - // - - // - internal: - // Check for possible trouble states of a printer using the flags of the QueueStatus property - static void SpotTroubleUsingQueueAttributes (System::String^% statusReport, System::Printing::PrintQueue^ pq) - { - if ((pq->QueueStatus & PrintQueueStatus::PaperProblem) == PrintQueueStatus::PaperProblem) - { - statusReport = statusReport + "Has a paper problem. "; - } - if ((pq->QueueStatus & PrintQueueStatus::NoToner) == PrintQueueStatus::NoToner) - { - statusReport = statusReport + "Is out of toner. "; - } - if ((pq->QueueStatus & PrintQueueStatus::DoorOpen) == PrintQueueStatus::DoorOpen) - { - statusReport = statusReport + "Has an open door. "; - } - if ((pq->QueueStatus & PrintQueueStatus::Error) == PrintQueueStatus::Error) - { - statusReport = statusReport + "Is in an error state. "; - } - if ((pq->QueueStatus & PrintQueueStatus::NotAvailable) == PrintQueueStatus::NotAvailable) - { - statusReport = statusReport + "Is not available. "; - } - if ((pq->QueueStatus & PrintQueueStatus::Offline) == PrintQueueStatus::Offline) - { - statusReport = statusReport + "Is off line. "; - } - if ((pq->QueueStatus & PrintQueueStatus::OutOfMemory) == PrintQueueStatus::OutOfMemory) - { - statusReport = statusReport + "Is out of memory. "; - } - if ((pq->QueueStatus & PrintQueueStatus::PaperOut) == PrintQueueStatus::PaperOut) - { - statusReport = statusReport + "Is out of paper. "; - } - if ((pq->QueueStatus & PrintQueueStatus::OutputBinFull) == PrintQueueStatus::OutputBinFull) - { - statusReport = statusReport + "Has a full output bin. "; - } - if ((pq->QueueStatus & PrintQueueStatus::PaperJam) == PrintQueueStatus::PaperJam) - { - statusReport = statusReport + "Has a paper jam. "; - } - if ((pq->QueueStatus & PrintQueueStatus::Paused) == PrintQueueStatus::Paused) - { - statusReport = statusReport + "Is paused. "; - } - if ((pq->QueueStatus & PrintQueueStatus::TonerLow) == PrintQueueStatus::TonerLow) - { - statusReport = statusReport + "Is low on toner. "; - } - if ((pq->QueueStatus & PrintQueueStatus::UserIntervention) == PrintQueueStatus::UserIntervention) - { - statusReport = statusReport + "Needs user intervention. "; - } - - // Check if queue is even available at this time of day - // The method below is defined in the complete example. - ReportAvailabilityAtThisTime(statusReport, pq); - }; - // - - // - private: - static void ReportAvailabilityAtThisTime (System::String^% statusReport, System::Printing::PrintQueue^ pq) - { - if (pq->StartTimeOfDay != pq->UntilTimeOfDay) - { - System::DateTime utcNow = DateTime::UtcNow; - System::Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes; - - // If now is not within the range of available times . . . - if (!((pq->StartTimeOfDay < utcNowAsMinutesAfterMidnight) && (utcNowAsMinutesAfterMidnight < pq->UntilTimeOfDay))) - { - statusReport = statusReport + " Is not available at this time of day. "; - } - } - }; - // - }; - - private ref class Program { - - public: - static void Main (array^ args) - { - // Obtain a list of print servers - Console::Write("Enter path and file name of CRLF-delimited list of print servers: "); - System::String^ pathToListOfPrintServers = Console::ReadLine(); - System::IO::StreamReader^ fileOfPrintServers = gcnew System::IO::StreamReader(pathToListOfPrintServers); - - // Prompt user to determine the method of reading queue status that will be used - Console::Write("Enter \"y\" to check queues using their QueueStatus attributes.\nOtherwise, press Return and they will be checked using their specific properties: "); - System::String^ useAttributesResponse = Console::ReadLine(); - - // - // Survey queue status for every queue on every print server - System::String^ line; - System::String^ statusReport = "\n\nAny problem states are indicated below:\n\n"; - while ((line = fileOfPrintServers->ReadLine()) != nullptr) - { - System::Printing::PrintServer^ myPS = gcnew System::Printing::PrintServer(line, PrintSystemDesiredAccess::AdministrateServer); - System::Printing::PrintQueueCollection^ myPrintQueues = myPS->GetPrintQueues(); - statusReport = statusReport + "\n" + line; - for each (System::Printing::PrintQueue^ pq in myPrintQueues) - { - pq->Refresh(); - statusReport = statusReport + "\n\t" + pq->Name + ":"; - if (useAttributesResponse == "y") - { - TroubleSpotter::SpotTroubleUsingQueueAttributes(statusReport, pq); - // TroubleSpotter class is defined in the complete example. - } else - { - TroubleSpotter::SpotTroubleUsingProperties(statusReport, pq); - } - } - } - fileOfPrintServers->Close(); - Console::WriteLine(statusReport); - Console::WriteLine("\nPress Return to continue."); - Console::ReadLine(); - // - }; - }; - -} - -//Entry Point: -[System::STAThreadAttribute()] -int main (array^ args) -{ - PrinterStatusSurvey::Program::Main(args); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj b/snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj deleted file mode 100644 index 4ab6335b9cf..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21208.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Console - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp b/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp deleted file mode 100644 index 8739a01220b..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp +++ /dev/null @@ -1,86 +0,0 @@ -//ScrollViewer_wcp.cpp file - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Shapes; -using namespace System::Threading; - -namespace SDKSample { - - public ref class app : Application { - - private: - ScrollViewer^ myScrollViewer; - StackPanel^ myStackPanel; - Window^ mainWindow; - - protected: - virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // - - // Create the application's main window - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "ScrollViewer Sample"; - - // Define a ScrollViewer - myScrollViewer = gcnew ScrollViewer(); - myScrollViewer->HorizontalScrollBarVisibility = ScrollBarVisibility::Auto; - - // Add Layout control - myStackPanel = gcnew StackPanel(); - myStackPanel->HorizontalAlignment = HorizontalAlignment::Left; - myStackPanel->VerticalAlignment = VerticalAlignment::Top; - - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->TextWrapping = TextWrapping::Wrap; - myTextBlock->Margin = System::Windows::Thickness(0, 0, 0, 20); - myTextBlock->Text = "Scrolling is enabled when it is necessary. Resize the Window, making it larger and smaller."; - - Rectangle^ myRectangle = gcnew Rectangle(); - myRectangle->Fill = Brushes::Red; - myRectangle->Width = 500; - myRectangle->Height = 500; - - // Add child elements to the parent StackPanel - myStackPanel->Children->Add(myTextBlock); - myStackPanel->Children->Add(myRectangle); - - // Add the StackPanel as the lone Child of the Border - myScrollViewer->Content = myStackPanel; - - // Add the Border as the Content of the Parent Window Object - mainWindow->Content = myScrollViewer; - mainWindow->Show(); - - // - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj b/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj deleted file mode 100644 index 46659bd0f75..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj +++ /dev/null @@ -1,118 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - ScrollViewer - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30109.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp b/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp deleted file mode 100644 index d45a1b4ef20..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp +++ /dev/null @@ -1,264 +0,0 @@ -//ShapesProcedural.cpp file - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Shapes; -using namespace System::Threading; - -namespace ShapesProcedural { - - public ref class app : Application { - - private: - Border^ myBorder; - Rectangle^ myRect; - Ellipse^ myEllipse; - Line^ myLine; - Path^ myPath; - Polygon^ myPolygon; - Polyline^ myPolyline; - Grid^ myGrid; - TextBlock^ myTextBlock; - ColumnDefinition^ myColDef1; - ColumnDefinition^ myColDef2; - RowDefinition^ myRowDef; - RowDefinition^ myRowDef1; - RowDefinition^ myRowDef2; - RowDefinition^ myRowDef3; - RowDefinition^ myRowDef4; - RowDefinition^ myRowDef5; - RowDefinition^ myRowDef6; - Window^ myWindow; - - protected: virtual void OnStartup (StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: void CreateAndShowMainWindow () - { - // Create the application's main window - myWindow = gcnew Window(); - - // Add a Border - myBorder = gcnew Border(); - myBorder->BorderBrush = Brushes::Black; - myBorder->BorderThickness = Thickness(2); - myBorder->Width = 400; - myBorder->Height = 600; - myBorder->Padding = Thickness(15); - myBorder->Background = Brushes::White; - - // Create a Grid to host the Shapes - myGrid = gcnew Grid(); - myGrid->Margin = Thickness(15); - myColDef1 = gcnew ColumnDefinition(); - myColDef1->Width = GridLength(125); - myColDef2 = gcnew ColumnDefinition(); - myColDef2->Width = GridLength(1, GridUnitType::Star); - myGrid->ColumnDefinitions->Add(myColDef1); - myGrid->ColumnDefinitions->Add(myColDef2); - myRowDef = gcnew RowDefinition(); - myRowDef1 = gcnew RowDefinition(); - myRowDef2 = gcnew RowDefinition(); - myRowDef3 = gcnew RowDefinition(); - myRowDef4 = gcnew RowDefinition(); - myRowDef5 = gcnew RowDefinition(); - myRowDef6 = gcnew RowDefinition(); - myGrid->RowDefinitions->Add(myRowDef); - myGrid->RowDefinitions->Add(myRowDef1); - myGrid->RowDefinitions->Add(myRowDef2); - myGrid->RowDefinitions->Add(myRowDef3); - myGrid->RowDefinitions->Add(myRowDef4); - myGrid->RowDefinitions->Add(myRowDef5); - myGrid->RowDefinitions->Add(myRowDef6); - myTextBlock = gcnew TextBlock(); - myTextBlock->FontSize = 20; - myTextBlock->Text = "WPF Shapes Gallery"; - myTextBlock->HorizontalAlignment = HorizontalAlignment::Left; - myTextBlock->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock); - Grid::SetRow(myTextBlock, 0); - Grid::SetColumnSpan(myTextBlock, 2); - - // - - // Add a Rectangle Element - myRect = gcnew Rectangle(); - myRect->Stroke = Brushes::Black; - myRect->Fill = Brushes::SkyBlue; - myRect->HorizontalAlignment = HorizontalAlignment::Left; - myRect->VerticalAlignment = VerticalAlignment::Center; - myRect->Height = 50; - myRect->Width = 50; - myGrid->Children->Add(myRect); - // - Grid::SetRow(myRect, 1); - Grid::SetColumn(myRect, 0); - TextBlock^ myTextBlock1 = gcnew TextBlock(); - myTextBlock1->FontSize = 14; - myTextBlock1->Text = "A Rectangle Element"; - myTextBlock1->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock1); - Grid::SetRow(myTextBlock1, 1); - Grid::SetColumn(myTextBlock1, 1); - - // - - // Add an Ellipse Element - myEllipse = gcnew Ellipse(); - myEllipse->Stroke = Brushes::Black; - myEllipse->Fill = Brushes::DarkBlue; - myEllipse->HorizontalAlignment = HorizontalAlignment::Left; - myEllipse->VerticalAlignment = VerticalAlignment::Center; - myEllipse->Width = 50; - myEllipse->Height = 75; - myGrid->Children->Add(myEllipse); - // - Grid::SetRow(myEllipse, 2); - Grid::SetColumn(myEllipse, 0); - TextBlock^ myTextBlock2 = gcnew TextBlock(); - myTextBlock2->FontSize = 14; - myTextBlock2->Text = "An Ellipse Element"; - myTextBlock2->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock2); - Grid::SetRow(myTextBlock2, 2); - Grid::SetColumn(myTextBlock2, 1); - - // - - // Add a Line Element - myLine = gcnew Line(); - myLine->Stroke = Brushes::LightSteelBlue; - myLine->X1 = 1; - myLine->X2 = 50; - myLine->Y1 = 1; - myLine->Y2 = 50; - myLine->HorizontalAlignment = HorizontalAlignment::Left; - myLine->VerticalAlignment = VerticalAlignment::Center; - myLine->StrokeThickness = 2; - myGrid->Children->Add(myLine); - // - Grid::SetRow(myLine, 3); - Grid::SetColumn(myLine, 0); - TextBlock^ myTextBlock3 = gcnew TextBlock(); - myTextBlock3->FontSize = 14; - myTextBlock3->Text = "A Line Element"; - myTextBlock3->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock3); - Grid::SetRow(myTextBlock3, 3); - Grid::SetColumn(myTextBlock3, 1); - - // - - //Add the Path Element - myPath = gcnew Path(); - myPath->Stroke = Brushes::Black; - myPath->Fill = Brushes::MediumSlateBlue; - myPath->StrokeThickness = 4; - myPath->HorizontalAlignment = HorizontalAlignment::Left; - myPath->VerticalAlignment = VerticalAlignment::Center; - EllipseGeometry^ myEllipseGeometry = gcnew EllipseGeometry(); - myEllipseGeometry->Center = Point(50, 50); - myEllipseGeometry->RadiusX = 25; - myEllipseGeometry->RadiusY = 25; - myPath->Data = myEllipseGeometry; - myGrid->Children->Add(myPath); - // - Grid::SetRow(myPath, 4); - Grid::SetColumn(myPath, 0); - TextBlock^ myTextBlock4 = gcnew TextBlock(); - myTextBlock4->FontSize = 14; - myTextBlock4->Text = "A Path Element"; - myTextBlock4->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock4); - Grid::SetRow(myTextBlock4, 4); - Grid::SetColumn(myTextBlock4, 1); - - // - - //Add the Polygon Element - myPolygon = gcnew Polygon(); - myPolygon->Stroke = Brushes::Black; - myPolygon->Fill = Brushes::LightSeaGreen; - myPolygon->StrokeThickness = 2; - myPolygon->HorizontalAlignment = HorizontalAlignment::Left; - myPolygon->VerticalAlignment = VerticalAlignment::Center; - Point Point1 = Point(1, 50); - Point Point2 = Point(10, 80); - Point Point3 = Point(50, 50); - PointCollection^ myPointCollection = gcnew PointCollection(); - myPointCollection->Add(Point1); - myPointCollection->Add(Point2); - myPointCollection->Add(Point3); - myPolygon->Points = myPointCollection; - myGrid->Children->Add(myPolygon); - // - Grid::SetRow(myPolygon, 5); - Grid::SetColumn(myPolygon, 0); - TextBlock^ myTextBlock5 = gcnew TextBlock(); - myTextBlock5->Text = "A Polygon Element"; - myTextBlock5->FontSize = 14; - myTextBlock5->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock5); - Grid::SetRow(myTextBlock5, 5); - Grid::SetColumn(myTextBlock5, 1); - - // - - // Add the Polyline Element - myPolyline = gcnew Polyline(); - myPolyline->Stroke = Brushes::SlateGray; - myPolyline->StrokeThickness = 2; - myPolyline->FillRule = FillRule::EvenOdd; - Point Point4 = Point(1, 50); - Point Point5 = Point(10, 80); - Point Point6 = Point(20, 40); - PointCollection^ myPointCollection2 = gcnew PointCollection(); - myPointCollection2->Add(Point4); - myPointCollection2->Add(Point5); - myPointCollection2->Add(Point6); - myPolyline->Points = myPointCollection2; - myGrid->Children->Add(myPolyline); - // - Grid::SetRow(myPolyline, 6); - Grid::SetColumn(myPolyline, 0); - TextBlock^ myTextBlock6 = gcnew TextBlock(); - myTextBlock6->FontSize = 14; - myTextBlock6->Text = "A Polyline Element"; - myTextBlock6->VerticalAlignment = VerticalAlignment::Center; - myGrid->Children->Add(myTextBlock6); - Grid::SetRow(myTextBlock6, 6); - Grid::SetColumn(myTextBlock6, 1); - - // Add the Grid to the Window as Content and show the Window - myBorder->Child = myGrid; - myWindow->Content = myBorder; - myWindow->Background = Brushes::LightSlateGray; - myWindow->Title = "Shapes Sample"; - myWindow->Show(); - - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - ShapesProcedural::app^ app = gcnew ShapesProcedural::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return ShapesProcedural::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj b/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj deleted file mode 100644 index 6a714f7e91c..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21230.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp b/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp deleted file mode 100644 index 76064af5593..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp +++ /dev/null @@ -1,141 +0,0 @@ -//StackPanel_Ovw_Sample4.cpp file - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; - -namespace SDKSample { - - public ref class app : Application { - - private: - Border^ myBorder; - Grid^ myGrid; - StackPanel^ myStackPanel; - DockPanel^ myDockPanel; - System::Windows::Window^ mainWindow; - - protected: - virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // - - // Create the application's main window - mainWindow = gcnew Window(); - mainWindow->Title = "StackPanel vs. DockPanel"; - - // Add root Grid - myGrid = gcnew Grid(); - myGrid->Width = 175; - myGrid->Height = 150; - RowDefinition^ myRowDef1 = gcnew RowDefinition(); - RowDefinition^ myRowDef2 = gcnew RowDefinition(); - myGrid->RowDefinitions->Add(myRowDef1); - myGrid->RowDefinitions->Add(myRowDef2); - - // Define the DockPanel - myDockPanel = gcnew DockPanel(); - Grid::SetRow(myDockPanel, 0); - - //Define an Image and Source - Image^ myImage = gcnew Image(); - BitmapImage^ bi = gcnew BitmapImage(); - bi->BeginInit(); - bi->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); - bi->EndInit(); - myImage->Source = bi; - - Image^ myImage2 = gcnew Image(); - BitmapImage^ bi2 = gcnew BitmapImage(); - bi2->BeginInit(); - bi2->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); - bi2->EndInit(); - myImage2->Source = bi2; - - // - Image^ myImage3 = gcnew Image(); - BitmapImage^ bi3 = gcnew BitmapImage(); - bi3->BeginInit(); - bi3->UriSource = gcnew System::Uri("smiley_stackpanel.PNG", UriKind::Relative); - bi3->EndInit(); - myImage3->Stretch = Stretch::Fill; - myImage3->Source = bi3; - // - - // Add the images to the parent DockPanel - myDockPanel->Children->Add(myImage); - myDockPanel->Children->Add(myImage2); - myDockPanel->Children->Add(myImage3); - - //Define a StackPanel - myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Horizontal; - Grid::SetRow(myStackPanel, 1); - - Image^ myImage4 = gcnew Image(); - BitmapImage^ bi4 = gcnew BitmapImage(); - bi4->BeginInit(); - bi4->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); - bi4->EndInit(); - myImage4->Source = bi4; - - Image^ myImage5 = gcnew Image(); - BitmapImage^ bi5 = gcnew BitmapImage(); - bi5->BeginInit(); - bi5->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); - bi5->EndInit(); - myImage5->Source = bi5; - - Image^ myImage6 = gcnew Image(); - BitmapImage^ bi6 = gcnew BitmapImage(); - bi6->BeginInit(); - bi6->UriSource = gcnew System::Uri("smiley_stackpanel.PNG", UriKind::Relative); - bi6->EndInit(); - myImage6->Stretch = Stretch::Fill; - myImage6->Source = bi6; - - // Add the images to the parent StackPanel - myStackPanel->Children->Add(myImage4); - myStackPanel->Children->Add(myImage5); - myStackPanel->Children->Add(myImage6); - - // Add the layout panels as children of the Grid - myGrid->Children->Add(myDockPanel); - myGrid->Children->Add(myStackPanel); - - // Add the Grid as the Content of the Parent Window Object - mainWindow->Content = myGrid; - mainWindow->Show(); - - // - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/smiley_stackpanel.PNG b/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/smiley_stackpanel.PNG deleted file mode 100644 index 1e0b9496cad2e2133d1edb7c4d3511a059772473..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4599 zcmV002t}1^@s6I8J)%00009a7bBm000id z000id0mpBsWB>pWsYygZRCt{2oOxW7<=V%uXBpHo1RX#YK~zLgGt*F!7JEHzWu)es zrJnHEDLa|_LDS=sp^1WmqPdWWiKw83iHSQXF8GKn;g}nOAcDipGus2q@BA@hnj13= zLht+j@%u;l-1l{T@9Vywd%3Qmy+^KULSl2I(Cu}v6>+&zSbUxozVni_A}&`7*_tUW z+MFTHU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vKiN)~Y zED{q=yf6tdJT>qNx`(KQxMR* zH#}Rng^RNsJ$uM7`~$-5S%j#ygruJd$Bz**&i$bi#|g>%3DKJgGo}+pk0SK!!NEap z4-a=w^zie;q<;h<+dn({VDM75(ozme>Ar53~JH=M4lk>08vX2xr3NCpvK;? zY1SEX_nv6i={@uvJQ-7i*JA6gQ^?3w;o@Z-&gGONJ+rh - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp deleted file mode 100644 index 685472dce19..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp +++ /dev/null @@ -1,130 +0,0 @@ -//TiffEncoderDecoder.cpp file - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; -using namespace System::Security; - - -namespace SDKSample { - - public ref class app : Application { - - private: System::Windows::Window^ mainWindow; - - protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: void CreateAndShowMainWindow () - { - - // Create the application's main window. - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "TIFF Imaging Sample"; - ScrollViewer^ mySV = gcnew ScrollViewer(); - - // - int width = 128; - int height = width; - int stride = width / 8; - array^ pixels = gcnew array(height * stride); - - // Define the image palette. - BitmapPalette^ myPalette = BitmapPalettes::WebPalette; - - // Creates a new empty image with the pre-defined palette. - - // - BitmapSource^ image = BitmapSource::Create(width, - height, - 96, - 96, - PixelFormats::Indexed1, - myPalette, - pixels, - stride); - // - - // - FileStream^ stream = gcnew FileStream("new.tif", FileMode::Create); - TiffBitmapEncoder^ encoder = gcnew TiffBitmapEncoder(); - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); - encoder->Compression = TiffCompressOption::Zip; - encoder->Frames->Add(BitmapFrame::Create(image)); - encoder->Save(stream); - // - - // - - // - // Open a Stream and decode a TIFF image. - Stream^ imageStreamSource = gcnew FileStream("tulipfarm.tif", FileMode::Open, FileAccess::Read, FileShare::Read); - TiffBitmapDecoder^ decoder = gcnew TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource = decoder->Frames[0]; - - // Draw the Image. - Image^ myImage = gcnew Image(); - myImage->Source = bitmapSource; - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - // - - // - - // Open a Uri and decode a TIFF image. - System::Uri^ myUri = gcnew System::Uri("tulipfarm.tif", UriKind::RelativeOrAbsolute); - TiffBitmapDecoder^ decoder2 = gcnew TiffBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource2 = decoder2->Frames[0]; - - // Draw the Image. - Image^ myImage2 = gcnew Image(); - myImage2->Source = bitmapSource2; - myImage2->Stretch = Stretch::None; - myImage2->Margin = System::Windows::Thickness(20); - // - - // Define a StackPanel to host the decoded TIFF images. - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; - - // Add the Image and TextBlock to the parent Grid. - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myImage2); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the Content of the Parent Window Object. - mySV->Content = myStackPanel; - mainWindow->Content = mySV; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj deleted file mode 100644 index 7c1873181a0..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tulipfarm.tif b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tulipfarm.tif deleted file mode 100644 index 50746baa7337e95b753c26ca85e73556ba9a1d00..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 697320 zcmeFa_n#HT_AY#Xe*b{?-uIsKJsz_X6hSfPa6rYJbIyu6U=GKK0 z&N)mV%#c;gu-@mX-fK@yP1oMtd-mQlBmKkrtg7nj>guXh>#4P>y1I4iM*nMc|NrNI zZ7vfj1Z^r6*;0C!}h z<~IJL_FL3^h3elzmz&5>{g9uia(1BR3&mdQ?3BIXa$kO5x(_3Fp!_)GE9XEeWMrdPGaMRaEzWl!Q0}UVR!~5>Q{AqiN68pFQ zj5Xhws?X_#!pB0Fo8WIE_w{*PY2AFdsn=cZ%kN9~;ZYPj&d%d2=Rixh+ayys!QVvx zxMMe$c%gB!P~|81o5+7I@?PwFe7G669=>vX__!VGk#WdZ&ViO5wapU$bE1FZj^VKU zg~G=|mz&^kBL89XT;I}sxEZ&ezH)r{7!^k}pRb$)EnV9q8&B{z(LZs=a9I9A<7A=A zPw+R9|1fzz(9*KuL~XD8@Yh$aFMmTx_q~^!uK2qR``9Z$Tej}6_WeP=3Le-(rGd-u1;mB&Kq(L{gN z5B*uF{w;L5iTuWBw4JF<8UT(VLFZVxlZJ3fbZe?v+4y_cI_4Szk~a_2+d z3#CUB{h9x_ zdyZqiWV}#%G|`{=8-um#Yn%bfb3p4mxpJ7uPd$;J0?z$wCD#W?yb-o$bJd@2J7kOVtdcNt@6-0Iz_{J2^BLz{&#?CN zeHY+M535UErn&8)@ok%M#+pTyXbY0tK4EQQr`cuXGwiERK4qWpq3w}xo~yjsZCfA0 z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=n6VuZ*g$5KWIV?ERV*+Ch;~$LM42`|y*o!fhv6=A&!x8j2g)xjVkMTa^ zGQ*#%mCqQ*c%E^Haf<gEb|=xcYNAen*U(_6!Qr)Wl{;bWXB?B-j$?(1L(uXQvd(} diff --git a/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/ViewboxCode.cpp b/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/ViewboxCode.cpp deleted file mode 100644 index d9c0f207bd9..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/ViewboxCode.cpp +++ /dev/null @@ -1,107 +0,0 @@ -//ViewboxCode.cpp file -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Shapes; -using namespace System::Threading; - -namespace ViewboxCode { - - public ref class app : Application { - - private: - Canvas^ myCanvas; - Window^ mainWindow; - Viewbox^ myViewbox; - Grid^ myGrid; - TextBlock^ myTextBlock; - Ellipse^ myEllipse; - - protected: - virtual void OnStartup (StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - } - ; - - private: - void CreateAndShowMainWindow () - { - // Create the application's main window - mainWindow = gcnew Window(); - - // Create a Canvas sized to fill the window - myCanvas = gcnew Canvas(); - myCanvas->Background = Brushes::Silver; - myCanvas->Width = 600; - myCanvas->Height = 600; - // - - // - - // Create a Viewbox and add it to the Canvas - myViewbox = gcnew Viewbox(); - myViewbox->StretchDirection = StretchDirection::Both; - myViewbox->Stretch = Stretch::Fill; - myViewbox->MaxWidth = 400; - myViewbox->MaxHeight = 400; - // - - // Create a Grid that will be hosted inside the Viewbox - myGrid = gcnew Grid(); - - // Create an Ellipse that will be hosted inside the Viewbox - myEllipse = gcnew Ellipse(); - myEllipse->Stroke = Brushes::RoyalBlue; - myEllipse->Fill = Brushes::LightBlue; - - // Create an TextBlock that will be hosted inside the Viewbox - myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "Viewbox"; - - // Add the children to the Grid - myGrid->Children->Add(myEllipse); - myGrid->Children->Add(myTextBlock); - - // - - // Add the Grid as the single child of the Viewbox - myViewbox->Child = myGrid; - - // - - // Position the Viewbox in the Parent Canvas - Canvas::SetTop(myViewbox, 100); - Canvas::SetLeft(myViewbox, 100); - myCanvas->Children->Add(myViewbox); - - // - - // Set the Window content - mainWindow->Content = myCanvas; - mainWindow->Show(); - - - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - ViewboxCode::app^ app = gcnew ViewboxCode::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return ViewboxCode::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj b/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj deleted file mode 100644 index b20c477fb8b..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21230.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp deleted file mode 100644 index a50b95e31c5..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp +++ /dev/null @@ -1,142 +0,0 @@ -//WDPEncoderDecoder.cpp file - - -using namespace System; -using namespace System::Collections::Generic; -using namespace System::IO; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Imaging; -using namespace System::Threading; -using namespace System::Security; - - -namespace SDKSample { - - public ref class app : Application { - - private: Window^ mainWindow; - - protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: void CreateAndShowMainWindow () - { - - // Create the application's main window - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "WDP Imaging Sample"; - ScrollViewer^ mySV = gcnew ScrollViewer(); - - // - int width = 128; - int height = width; - int stride = width / 8; - array^ pixels = gcnew array(height * stride); - - // Define the image palette - BitmapPalette^ myPalette = BitmapPalettes::WebPalette; - - // Creates a new empty image with the pre-defined palette - - // - BitmapSource^ image = BitmapSource::Create( - width, - height, - 96, - 96, - PixelFormats::Indexed1, - myPalette, - pixels, - stride); - // - - // - FileStream^ stream = gcnew FileStream("new.wdp", FileMode::Create); - WmpBitmapEncoder^ encoder = gcnew WmpBitmapEncoder(); - TextBlock^ myTextBlock = gcnew TextBlock(); - myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); - encoder->Frames->Add(BitmapFrame::Create(image)); - encoder->Save(stream); - // - - // - - // - - // Open a Stream and decode a WDP image - Stream^ imageStreamSource = gcnew FileStream("tulipfarm.wdp", FileMode::Open, FileAccess::Read, FileShare::Read); - WmpBitmapDecoder^ decoder = gcnew WmpBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource = decoder->Frames[0]; - - // Draw the Image - Image^ myImage = gcnew Image(); - myImage->Source = bitmapSource; - myImage->Stretch = Stretch::None; - myImage->Margin = System::Windows::Thickness(20); - // - - // - - // Open a Uri and decode a WDP image - System::Uri^ myUri = gcnew System::Uri("tulipfarm.wdp", UriKind::RelativeOrAbsolute); - WmpBitmapDecoder^ decoder3 = gcnew WmpBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource3 = decoder3->Frames[0]; - - // Draw the Image - Image^ myImage2 = gcnew Image(); - myImage2->Source = bitmapSource3; - myImage2->Stretch = Stretch::None; - myImage2->Margin = System::Windows::Thickness(20); - // - - // - FileStream^ stream2 = gcnew FileStream("tulipfarm.jpg", FileMode::Open); - JpegBitmapDecoder^ decoder2 = gcnew JpegBitmapDecoder(stream2, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); - BitmapSource^ bitmapSource2 = decoder2->Frames[0]; - FileStream^ stream3 = gcnew FileStream("new2.wdp", FileMode::Create); - WmpBitmapEncoder^ encoder2 = gcnew WmpBitmapEncoder(); - encoder2->Frames->Add(BitmapFrame::Create(bitmapSource2)); - encoder2->Save(stream3); - // - - // Define a StackPanel to host the decoded WDP images - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Orientation = Orientation::Vertical; - myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; - myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; - - // Add the Image and TextBlock to the parent Grid - myStackPanel->Children->Add(myImage); - myStackPanel->Children->Add(myImage2); - myStackPanel->Children->Add(myTextBlock); - - // Add the StackPanel as the Content of the Parent Window Object - mySV->Content = myStackPanel; - mainWindow->Content = mySV; - mainWindow->Show(); - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - SDKSample::app^ app = gcnew SDKSample::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return SDKSample::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg deleted file mode 100644 index 2ce60cad09155366d0c4ef18b9e01dedd61a1cb8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 110238 zcma&N1z1#F_cnfJh8()PhZK=iK#)#}p;JIYN{~+J9y$e-7;nx>vWg4- zv!^uv`wF2__>hCjzt6e2!2A&(v=R>azjkt2hZ<@_dH{T=q>}g5i-&|W59&k+h=@b< zVu1GWe|rBjIH6ubF+7P+i9tq3&}QJm9P$IS4LF1z_Pz%Wy3bCuWaWQa`IpI@$itzS z$hZoCFUSV^Uk%{N#th-}pdZJy|JU^X|NOug!I!@<4c2YQY}>a_^KU<`(?TMMH(DLx z^kR?HLH7{^Og;wBm&uwFWw4=ljZ_o8yR~!td(R)VAma+{e;kJgNiLKG z`}njpfqe<1$feka|Q zUL$!{S`P?FuRu%dA&*!u2E1^hH@VLr)$# z(LwYlT#)RKN1-s__er*Yng3^&EPosIrw3b*IC!gi^S}uG>~qwAO$VYdt}yv8_Tcp4 zs#yY^J)YE1Ltkt-W+xn;(hgvDA|U_!atIkC?Qj2G*0lr-kNR-`X-K)&!?{Ue4B2!S z+#|Im{SQzVc9Q#}GU#DRrWcb{if0#LzhFEeF@Ym~0ybAf_&3^r9PvArDF0(00Wpl- z@Mx$)OBf3F^VhIM2JOYSQ!HL;mGQJP<&30S}15JU}D+cLN1&eI5&F zfuUOk&abc?K!aRi&HYzH4CDfRL`pNjzmNpG1T8E6zeeXj7TP(2a}e%hnf1jo#el9f z^zBRg<3(~B77x&iP(={>-%O&12($m;zy%c;V2pXfzsCgkL&BxeTM?MwQehYV-Hub` zKS=xq$lne7teyT}d{pXNfx&qGHidW6XGj&TFauDt2t)p9{zHL$NwQc`3EHR%AjV*x zG2$N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VTrNX+`AXTdyjW+-Q diff --git a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj deleted file mode 100644 index 82611d115d4..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - .\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp b/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp deleted file mode 100644 index 95e061129c3..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp +++ /dev/null @@ -1,92 +0,0 @@ -//WrapPanel_Code.cpp file - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Controls; -using namespace System::Windows::Media; -using namespace System::Threading; - -namespace WrapPanel_Demo { - - public ref class app : System::Windows::Application { - - private: - System::Windows::Controls::Button^ btn1; - System::Windows::Controls::Button^ btn2; - System::Windows::Controls::Button^ btn3; - System::Windows::Controls::WrapPanel^ myWrapPanel; - System::Windows::Window^ mainWindow; - - protected: - virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // - - // Create the application's main window - mainWindow = gcnew System::Windows::Window(); - mainWindow->Title = "WrapPanel Sample"; - - // - - // Instantiate a new WrapPanel and set properties - myWrapPanel = gcnew WrapPanel(); - myWrapPanel->Background = Brushes::Azure; - myWrapPanel->Orientation = Orientation::Horizontal; - // - myWrapPanel->ItemHeight = 25; - // - - // - myWrapPanel->ItemWidth = 75; - // - myWrapPanel->Width = 150; - myWrapPanel->HorizontalAlignment = HorizontalAlignment::Left; - myWrapPanel->VerticalAlignment = VerticalAlignment::Top; - - // Define 3 button elements. Each button is sized at width of 75, so the third button wraps to the next line. - btn1 = gcnew Button(); - btn1->Content = "Button 1"; - btn2 = gcnew Button(); - btn2->Content = "Button 2"; - btn3 = gcnew Button(); - btn3->Content = "Button 3"; - - // Add the buttons to the parent WrapPanel using the Children.Add method. - myWrapPanel->Children->Add(btn1); - myWrapPanel->Children->Add(btn2); - myWrapPanel->Children->Add(btn3); - - // Add the WrapPanel to the MainWindow as Content - mainWindow->Content = myWrapPanel; - mainWindow->Show(); - // - - // - }; - }; - - private ref class EntryClass { - - public: - [System::STAThread()] - static void Main () - { - WrapPanel_Demo::app^ app = gcnew WrapPanel_Demo::app(); - app->Run(); - }; - }; -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return WrapPanel_Demo::EntryClass::Main(); -} diff --git a/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj b/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj deleted file mode 100644 index 98f58d453c0..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - WrapPanel_Code - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21125.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp deleted file mode 100644 index f96bf18a4ff..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp +++ /dev/null @@ -1,459 +0,0 @@ -//XpsCreate.cpp file - -using namespace System; -using namespace System::IO; -using namespace System::Collections::Generic; -using namespace System::IO::Packaging; -using namespace System::Xml; -using namespace System::Windows::Forms; -using namespace System::Windows::Xps; -using namespace System::Windows::Xps::Packaging; -using namespace System::Printing; - -public ref class XpsCreate { - -private: - literal System::String^ packageWithPrintTicketName = "XpsDocument-withPrintTicket.xps"; - literal System::String^ packageName = "XpsDocument.xps"; - literal System::String^ image1 = "picture.jpg"; - literal System::String^ image2 = "image.tif"; - literal System::String^ font1 = "courier.ttf"; - literal System::String^ font2 = "arial.ttf"; - literal System::String^ fontContentType = "application/vnd.ms-package.obfuscated-opentype"; - -public: - [STAThread()] - static void Main (array^ args) - { - XpsCreate^ xpsCreate = gcnew XpsCreate(); - xpsCreate->Run(); - }; - -public: - // -------------------------------- Run ----------------------------------- - ///

- /// Creates two XpsDocument packages, the first without a PrintTicket - /// and a second with a PrintTicket. - void Run () - { - // First, create an XpsDocument without a PrintTicket. - - - - - - - - - - // If the document package exists from a previous run, delete it. - if (File::Exists(packageName)) - { - File::Delete(packageName); - } - // - // Create an XpsDocument package (without PrintTicket). - { - Package^ package = Package::Open(packageName); - try - { - XpsDocument^ xpsDocument = gcnew XpsDocument(package); - - // Add the package content (false=without PrintTicket). - AddPackageContent(xpsDocument, false); - - // Close the package. - xpsDocument->Close(); - } finally - { - delete package; - } - // - - // Next, create a second XpsDocument with a PrintTicket. - - - - - - - - - // If the document package exists from a previous run, delete it. - if (File::Exists(packageWithPrintTicketName)) - { - File::Delete(packageWithPrintTicketName); - } - - // Create an XpsDocument with PrintTicket. - { - Package^ package2 = Package::Open(packageWithPrintTicketName); - try - { - XpsDocument^ xpsDocumentWithPrintTicket = gcnew XpsDocument(package2); - - // Add the package content (true=with PrintTicket). - AddPackageContent(xpsDocumentWithPrintTicket, true); - - // Close the package. - xpsDocumentWithPrintTicket->Close(); - } finally - { - delete package2; - } - } - - System::String^ msg = "Created two XPS document packages:\n - " + packageName + "\n - " + packageWithPrintTicketName; - MessageBox::Show(msg, "Normal Completion", MessageBoxButtons::OK, MessageBoxIcon::Information); - } - }; - -private: - // - // ------------------------- AddPackageContent ---------------------------- - /// - /// Adds a predefined set of content to a given XPS document. - /// - /// The package to add the document content to. - /// - /// true to include a PrintTicket with the - /// document; otherwise, false. - void AddPackageContent (XpsDocument^ xpsDocument, bool attachPrintTicket) - { - try - { - PrintTicket^ printTicket = GetPrintTicketFromPrinter(); - // PrintTicket is null, there is no need to attach one. - if (printTicket == nullptr) - { - attachPrintTicket = false; - } - // Add a FixedDocumentSequence at the Package root - IXpsFixedDocumentSequenceWriter^ documentSequenceWriter = xpsDocument->AddFixedDocumentSequence(); - - // Add the 1st FixedDocument to the FixedDocumentSequence. - - - - - - IXpsFixedDocumentWriter^ fixedDocumentWriter = documentSequenceWriter->AddFixedDocument(); - - AddDocumentContent(fixedDocumentWriter); - - // Commit the 1st Document - fixedDocumentWriter->Commit(); - - // Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - - - fixedDocumentWriter = documentSequenceWriter->AddFixedDocument(); - - // Add content to the 2nd document. - AddDocumentContent(fixedDocumentWriter); - - // If attaching PrintTickets, attach one at the FixedDocument level. - if (attachPrintTicket) - { - fixedDocumentWriter->PrintTicket = printTicket; - } - // Commit the 2nd document. - fixedDocumentWriter->Commit(); - - // If attaching PrintTickets, attach one at - // the package FixedDocumentSequence level. - if (attachPrintTicket) - { - documentSequenceWriter->PrintTicket = printTicket; - } - // Commit the FixedDocumentSequence - documentSequenceWriter->Commit(); - } catch (XpsPackagingException^ xpsException) - { - throw xpsException; - - } - };// end:AddPackageContent() - // - - - // - // ------------------------- AddDocumentContent --------------------------- - /// - /// Adds a predefined set of content to a given document writer. - /// - /// The document writer to add the content to. - void AddDocumentContent (IXpsFixedDocumentWriter^ fixedDocumentWriter) - { - // Collection of image and font resources used on the current page. - // Key: "XpsImage", "XpsFont" - // Value: List of XpsImage or XpsFont resources - Dictionary^>^ resources; - - try - { - // Add Page 1 to current document. - IXpsFixedPageWriter^ fixedPageWriter = fixedDocumentWriter->AddFixedPage(); - // Add the resources for Page 1 and get the resource collection. - resources = AddPageResources(fixedPageWriter); - - // Write page content for Page 1. - WritePageContent(fixedPageWriter->XmlWriter, "Page 1 of " + fixedDocumentWriter->Uri->ToString(), resources); - // Commit Page 1. - fixedPageWriter->Commit(); - - // Add Page 2 to current document. - fixedPageWriter = fixedDocumentWriter->AddFixedPage(); - - // Add the resources for Page 2 and get the resource collection. - resources = AddPageResources(fixedPageWriter); - - // Write page content to Page 2. - WritePageContent(fixedPageWriter->XmlWriter, "Page 2 of " + fixedDocumentWriter->Uri->ToString(), resources); - // Commit Page 2. - fixedPageWriter->Commit(); - } catch (XpsPackagingException^ xpsException) - { - throw xpsException; - - } - };// end:AddDocumentContent() - // - - - // - // -------------------------- AddPageResources ---------------------------- - Dictionary^>^ AddPageResources (IXpsFixedPageWriter^ fixedPageWriter) - { - // Collection of all resources for this page. - // Key: "XpsImage", "XpsFont" - // Value: List of XpsImage or XpsFont - Dictionary^>^ resources = gcnew Dictionary^>(); - - // Collections of images and fonts used in the current page. - List^ xpsImages = gcnew List(); - List^ xpsFonts = gcnew List(); - - try - { - XpsImage^ xpsImage; - XpsFont^ xpsFont; - - // Add, Write, and Commit image1 to the current page. - xpsImage = fixedPageWriter->AddImage(XpsImageType::JpegImageType); - WriteToStream(xpsImage->GetStream(), image1); - xpsImage->Commit(); - xpsImages->Add(xpsImage); // Add image1 as a required resource. - - // Add, Write, and Commit font 1 to the current page. - xpsFont = fixedPageWriter->AddFont(); - WriteObfuscatedStream(xpsFont->Uri->ToString(), xpsFont->GetStream(), font1); - xpsFont->Commit(); - xpsFonts->Add(xpsFont); // Add font1 as a required resource. - - // Add, Write, and Commit image2 to the current page. - xpsImage = fixedPageWriter->AddImage(XpsImageType::TiffImageType); - WriteToStream(xpsImage->GetStream(), image2); - xpsImage->Commit(); - xpsImages->Add(xpsImage); // Add image2 as a required resource. - - // Add, Write, and Commit font2 to the current page. - xpsFont = fixedPageWriter->AddFont(false); - WriteToStream(xpsFont->GetStream(), font2); - xpsFont->Commit(); - xpsFonts->Add(xpsFont); // Add font2 as a required resource. - - // Return the image and font resources in a combined collection. - resources->Add("XpsImage", xpsImages); - resources->Add("XpsFont", xpsFonts); - return resources; - } catch (XpsPackagingException^ xpsException) - { - throw xpsException; - - } - };// end:AddPageResources() - // - - - // - // ---------------------- GetPrintTicketFromPrinter ----------------------- - /// - /// Returns a PrintTicket based on the current default printer. - /// - /// A PrintTicket for the current local default printer. - PrintTicket^ GetPrintTicketFromPrinter () - { - PrintQueue^ printQueue = nullptr; - - LocalPrintServer^ localPrintServer = gcnew LocalPrintServer(); - - // Retrieving collection of local printer on user machine - PrintQueueCollection^ localPrinterCollection = localPrintServer->GetPrintQueues(); - - System::Collections::IEnumerator^ localPrinterEnumerator = localPrinterCollection->GetEnumerator(); - - if (localPrinterEnumerator->MoveNext()) - { - // Get PrintQueue from first available printer - printQueue = ((PrintQueue^)localPrinterEnumerator->Current); - } else - { - return nullptr; - } - // Get default PrintTicket from printer - PrintTicket^ printTicket = printQueue->DefaultPrintTicket; - - PrintCapabilities^ printCapabilities = printQueue->GetPrintCapabilities(); - - // Modify PrintTicket - if (printCapabilities->CollationCapability->Contains(Collation::Collated)) - { - printTicket->Collation = Collation::Collated; - } - if (printCapabilities->DuplexingCapability->Contains(Duplexing::TwoSidedLongEdge)) - { - printTicket->Duplexing = Duplexing::TwoSidedLongEdge; - } - if (printCapabilities->StaplingCapability->Contains(Stapling::StapleDualLeft)) - { - printTicket->Stapling = Stapling::StapleDualLeft; - } - return printTicket; - };// end:GetPrintTicketFromPrinter() - // - - - // - // --------------------------- WritePageContent --------------------------- - void WritePageContent (System::Xml::XmlWriter^ xmlWriter, System::String^ documentUri, Dictionary^>^ resources) - { - List^ xpsImages = resources["XpsImage"]; - List^ xpsFonts = resources["XpsFont"]; - - // Element are indented for reading purposes only - xmlWriter->WriteStartElement("FixedPage"); - xmlWriter->WriteAttributeString("Width", "816"); - xmlWriter->WriteAttributeString("Height", "1056"); - xmlWriter->WriteAttributeString("xmlns", "http://schemas.microsoft.com/xps/2005/06"); - xmlWriter->WriteAttributeString("xml:lang", "en-US"); - - xmlWriter->WriteStartElement("Glyphs"); - xmlWriter->WriteAttributeString("Fill", "#ff000000"); - xmlWriter->WriteAttributeString("FontUri", xpsFonts[0]->Uri->ToString()); - xmlWriter->WriteAttributeString("FontRenderingEmSize", "18"); - xmlWriter->WriteAttributeString("OriginX", "120"); - xmlWriter->WriteAttributeString("OriginY", "110"); - xmlWriter->WriteAttributeString("UnicodeString", documentUri); - xmlWriter->WriteEndElement(); - - xmlWriter->WriteStartElement("Glyphs"); - xmlWriter->WriteAttributeString("Fill", "#ff000000"); - xmlWriter->WriteAttributeString("FontUri", xpsFonts[1]->Uri->ToString()); - xmlWriter->WriteAttributeString("FontRenderingEmSize", "16"); - xmlWriter->WriteAttributeString("OriginX", "120"); - xmlWriter->WriteAttributeString("OriginY", "130"); - xmlWriter->WriteAttributeString("UnicodeString", "Test String in Arial"); - xmlWriter->WriteEndElement(); - - xmlWriter->WriteStartElement("Path"); - xmlWriter->WriteAttributeString("Data", "M 120,187 L 301,187 301,321 120,321 z"); - xmlWriter->WriteStartElement("Path.Fill"); - xmlWriter->WriteStartElement("ImageBrush"); - xmlWriter->WriteAttributeString("ImageSource", xpsImages[0]->Uri->ToString()); - xmlWriter->WriteAttributeString("Viewbox", "0,0,181,134"); - xmlWriter->WriteAttributeString("TileMode", "None"); - xmlWriter->WriteAttributeString("ViewboxUnits", "Absolute"); - xmlWriter->WriteAttributeString("ViewportUnits", "Absolute"); - xmlWriter->WriteAttributeString("Viewport", "120,187,181,134"); - xmlWriter->WriteEndElement(); - xmlWriter->WriteEndElement(); - xmlWriter->WriteEndElement(); - - xmlWriter->WriteStartElement("Path"); - xmlWriter->WriteAttributeString("Data", "M 120,357 L 324,357 324,510 120,510 z"); - xmlWriter->WriteStartElement("Path.Fill"); - xmlWriter->WriteStartElement("ImageBrush"); - xmlWriter->WriteAttributeString("ImageSource", xpsImages[1]->Uri->ToString()); - xmlWriter->WriteAttributeString("Viewbox", "0,0,204,153"); - xmlWriter->WriteAttributeString("TileMode", "None"); - xmlWriter->WriteAttributeString("ViewboxUnits", "Absolute"); - xmlWriter->WriteAttributeString("ViewportUnits", "Absolute"); - xmlWriter->WriteAttributeString("Viewport", "120,357,204,153"); - xmlWriter->WriteEndElement(); - xmlWriter->WriteEndElement(); - xmlWriter->WriteEndElement(); - xmlWriter->WriteEndElement(); - };// end:WritePageContent() - // - - - // ----------------------------- WriteToStream ---------------------------- - void WriteToStream (System::IO::Stream^ stream, System::String^ resource) - { - int bufSize = 0x1000; - array^ buf = gcnew array(bufSize); - int bytesRead = 0; - { - System::IO::FileStream^ fileStream = gcnew System::IO::FileStream(resource, FileMode::Open, FileAccess::Read); - try - { - while ((bytesRead = fileStream->Read(buf, 0, bufSize)) > 0) - { - stream->Write(buf, 0, bytesRead); - } - } finally - { - delete fileStream; - } - } - }; - - // ------------------------- WriteObfuscatedStream ------------------------ - void WriteObfuscatedStream (System::String^ resourceName, System::IO::Stream^ stream, System::String^ resource) { - int bufSize = 0x1000; - int guidByteSize = 16; - int obfuscatedByte = 32; - - // Get the GUID byte from the resource name. Typical Font name: - // /Resources/Fonts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.ODTTF - int startPos = resourceName->LastIndexOf('/') + 1; - int length = resourceName->LastIndexOf('.') - startPos; - resourceName = resourceName->Substring(startPos, length); - - System::Guid guid = System::Guid(resourceName); - - System::String^ guidString = guid.ToString("N"); - - // Parsing the guid string and coverted into byte value - array^ guidBytes = gcnew array(guidByteSize); - - for ( - int i = 0; - i < guidBytes->Length; - i++) - { - guidBytes[i] = Convert::ToByte(guidString->Substring(i * 2, 2), 16); - } - - { - System::IO::FileStream^ filestream = gcnew System::IO::FileStream(resource, FileMode::Open); - try - { - // XOR the first 32 bytes of the source - // resource stream with GUID byte. - array^ buf = gcnew array(obfuscatedByte); - filestream->Read(buf, 0, obfuscatedByte); - - for ( - int i = 0; - i < obfuscatedByte; - i++) - { - int guidBytesPos = guidBytes->Length - (i % guidBytes->Length) - 1; - buf[i] ^= guidBytes[guidBytesPos]; - } - - stream->Write(buf, 0, obfuscatedByte); - - // copy remaining stream from source without obfuscation - buf = gcnew array(bufSize); - int bytesRead = 0; - while ((bytesRead = filestream->Read(buf, 0, bufSize)) > 0) - { - stream->Write(buf, 0, bytesRead); - } - } finally - { - delete filestream; - } - } - }; - -}; - - -//Entry Point: -int main (array^ args) -{ - XpsCreate::Main(args); - return 0; -} diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf deleted file mode 100644 index ff0815cd8c64b0a245ec780eb8d21867509155b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 367112 zcmeFa37lj}Rqr2Jxvw`fZ{FPZwJNJJyQ;dos<-Lc8JJ<%dS*aG0f$Y70b~;u1w)is^^&K z^Q)Blu^Z0add$F=mi3rttl@ z-}%I6|MgW*KV{7Cy%(gOe)|ia*S%}{`!6u&^KYcS&8Iy3sdxU?H+;q2#(Z*<^fRCO z#OFTSR85llewX_4PkqKWJSF$p@BTXzs(;ah|N3j5_M|&s_$&YIzyE+S$6jyD53fG$ z$xnRJ2VOV+UhsL5+J71u#iPYN((fQWeA=DQdtvU_W3Do0|{*U>-`^+ca`Q&&1^OH}TXyx6; zG_ucr)^nft-JkrUZ!ytr%3rSnfV=18ld0l&-usS!`TX0z^whjbWJo3{uP*f)zH z_8lq{`woID%?nK2teCtxVs3-XS=tSg4uxM8`W_QCCVF@DC>1pPIQ)C&DJ#W9bR`{& ztjI--`Nmhi#IM()ck{EJ`7Cpl>F#|o`Um$tGITV4HuN)Bnb6)I<4Bte6jx3%iaz|* z${(4pjy%_Rz(e9K^Yzi&%ws~YG>=_*t9g+i+%i{1e!@J5@^2-5HSxRjE#+?oJ`9`z zZUgFo@@@v62%J-zvhUQl)bVW9W8>$V$0j=FS<&0}zC?R>Mc-$h0=$9edmfSdjs)fNWY2a$MN0f;yD?Ajj55B1Y+c`QO|b* z>hmQ0Yi1|%+`W&|m#?7C8-Z8Q#v_Oy1l&X!m-rgsm7({USB2iUcMtE0&C6*2mC6UM zTf`5ho|p6fO1>MC_cEUA;1MHsfF7{A@)PFdO3C~Z@e%s}Xusd|{e9+X;CK(Q-zWM) z9m45i@Nv9}cjtjNe;F98oZR~aaguidZo+RFUPgKu9uhukUP9g-Km&N>%5R%HBM&tp z#_I>8pDOW5d+4_NPEz(SDf2i1`4tQBIb-!seWUNG zYqa3Qdo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h>%GLI&xo;w?3T*4_4CH8*6A*r zx8$ekde5xH^M%E(2QGj7C%60ta)ZAA&29r1`EVL-^R;dlNM ze(kQn^N!~O(&d2%0;1N>WM^h(jxIYphcZ?Ht%hAXj#Cn=e6R-Fr z`Ov)cL)M=5#eU|)rh|1AD{mj!X=97 z8vU*M2lUdr=_lk9NW4!}Fz9V@O*-3-QXbD@ICU6KM(Kl~uV%1Joh}7+*HHR014huK z!3fgU0X|uCLP)sHeDJ6%5eysw-UsaKN)%7~Y}LE}Mff^Q%Dz4?me zCHtFp@r0eNu>amJYIwGc+jhC&?Sv5BvJ)vgpMiAH@kF-fOtVF!vEUqw-i4rA4TrN6 zAAyZ{)-S}hgUE

" ); + transformXml = String::Concat( transformXml, + L"" ); + transformXml = String::Concat( transformXml, + L"" ); + transformXml = String::Concat( transformXml, + L"" ); + transformXml = String::Concat( transformXml, + L"" ); + Console::WriteLine( L"\nCreated the following Xslt tranform:" ); + Console::WriteLine( transformXml ); + XmlDocument^ xmlDoc = gcnew XmlDocument; + xmlDoc->LoadXml( transformXml ); + return xmlDoc->GetElementsByTagName( L"xsl:transform" ); + } + + // Encrypt the text in the specified XmlDocument. + static void ShowTransformProperties( XmlDsigXsltTransform^ xmlTransform ) + { + // + String^ classDescription = xmlTransform->ToString(); + // + Console::WriteLine( L"\n** Summary for {0} **", classDescription ); + + // Retrieve the XML representation of the current transform. + // + XmlElement^ xmlInTransform = xmlTransform->GetXml(); + // + Console::WriteLine( L"Xml representation of the current transform:\n{0}", + xmlInTransform->OuterXml ); + + // Ensure the transform is using the proper algorithm. + // + xmlTransform->Algorithm = SignedXml::XmlDsigXsltTransformUrl; + // + Console::WriteLine( L"Algorithm used: {0}", classDescription ); + + // Retrieve the valid input types for the current transform. + // + array^validInTypes = xmlTransform->InputTypes; + // + Console::WriteLine( L"Transform accepts the following inputs:" ); + for ( int i = 0; i < validInTypes->Length; i++ ) + { + Console::WriteLine( L"\t{0}", validInTypes[ i ] ); + + } + + // + array^validOutTypes = xmlTransform->OutputTypes; + // + Console::WriteLine( L"Transform outputs in the following types:" ); + for ( int i = validOutTypes->Length - 1; i >= 0; i-- ) + { + Console::WriteLine( L"\t {0}", validOutTypes[ i ] ); + if ( validOutTypes[ i ] == Object::typeid ) + { + // + Object^ outputObject = xmlTransform->GetOutput(); + // + } + } + } + + // Create an XML document describing various products. + static XmlDocument^ LoadProducts() + { + String^ contosoProducts = L""; + contosoProducts = String::Concat( contosoProducts, + L"" ); + contosoProducts = String::Concat( contosoProducts, + L"1" ); + contosoProducts = String::Concat( contosoProducts, + L"Widgets" ); + contosoProducts = String::Concat( contosoProducts, + L"2" ); + contosoProducts = String::Concat( contosoProducts, + L"Gadgits" ); + contosoProducts = String::Concat( contosoProducts, + L"" ); + Console::WriteLine( + L"\nCreated the following Xml document for tranformation:" ); + Console::WriteLine( contosoProducts ); + XmlDocument^ xmlDoc = gcnew XmlDocument; + xmlDoc->LoadXml( contosoProducts ); + return xmlDoc; + } + + // Resolve the specified base and relative Uri's . + static Uri^ ResolveUris( Uri^ baseUri, String^ relativeUri ) + { + // + XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver; + xmlResolver->Credentials = + System::Net::CredentialCache::DefaultCredentials; + + XmlDsigXsltTransform^ xmlTransform = gcnew XmlDsigXsltTransform; + xmlTransform->Resolver = xmlResolver; + // + + Uri^ absoluteUri = xmlResolver->ResolveUri( baseUri, relativeUri ); + if ( absoluteUri != nullptr ) + { + Console::WriteLine( + L"\nResolved the base Uri and relative Uri to the following:" ); + Console::WriteLine( absoluteUri ); + } + else + { + Console::WriteLine( L"Unable to resolve the base Uri and relative Uri" ); + } + + return absoluteUri; + } +}; + +int main() +{ + Class1::Main(); +} + +// +// This sample produces the following output: +// +// Created the following Xml document for tranformation: +// 1Widgets2Gadgits +// +// Created the following Xslt tranform: +//
ProductIdName
C_rX+dIDJ$T$6QH4Zg-dFkzDG{9SJ8imr))Pyp}Z zhOFwnR!Qw$Q=hgd{UvKtgrQr$m~&CD(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tpcj&_Cjya58cU4BK|ydf!az;IT~xDkOLIxD%`XZw{LxR7=Jwd6J-#6C_j@MZ(l z>K^vQzGN+>YYf+wAFAiPx0bnk3cAlh0TePA{pi3kS;W<>%~F->gDMNFLa; z^-3Ad4lB^~-)ldPs+k>snEE5)XI4T`8ecOmlo`6)Np-Q(zx#{V_|=OT3P45pnZ1j^ zj0W$GMTC)ed?Fa`(DP2lN*TS$M>5>`+&}>wX=ps2#(wPCy41q)q&B4T5@KbBo7Jw@ z`2hcITZnC4>Cx9s43Dfl1rQ9gP3bHfO!3CIQh=VThE<=tgeGLt^~%+^2(D(zUY-^e zgwytf}>@J(W{`tB@gpU`IW^c?D2%iguQay9$)LHFt=3Sc|4ltjLX=Q_T$accK6 z;q+y}Ts3Fur`r*2)iV|Tvt8k{$v;wBu!2)r{S-j5pkJC(gkzakC^lNm_#Wje0LCQ2 zObajqOaKdj0Wme0X#ob%&vtmS_HX&OL=S2XGt)2Kp`P&{%R`AC)ckGvTW0yk^0$on zFPRRMv0zw^<=5c9QRj(fIB=8w1Nfl2Pc7;3dB&b=D|S#=%03Q0s!#`gA)N52pEwAYjw~D z`=|Y|4=dPyI3^2N*#6iEf;OBG_^);ph;e@~D~P%N^gZk&@^9lS{#!fF5CWLc06;k! c0tguX=8ORCBSEYT)+kO05cLO#gZME0AGitcj{pDw diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg deleted file mode 100644 index 5aaafc1aa06d950d16a6204a8eaf693499ec8e8f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 18216 zcmeHucUTn7w`P+;l1PpNl2nr9Bp@On0+Mrf$Qg!=fPhNQNrE6b4IpXANy3mbLl(&y zL~`EI@B4*&clWt>cc1;w8mgp_;$Z9QV&z~DAk*Dnx&R9D^LP163mu9by@jnAQW-!;W{=-`l=uFnCu!?q<>G4kPYt@?_6~8CovrL$ z=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|4*`eN^FGBx{55uNbMH|%9o0W^tu#37cHo`(`Ebb8W#Ro ze?ELAn-}9}tGk6cwQ9=9SYGxBi`J&(%&#mjaEXMcdDc7a`PGr|_X)%H_TJI*UF54h zgii!jjv;F4&sG&y0>o%V zbEOo48I@hKOzHjJswbZalGGB?G9twp^(9MaCE8E9JMAn!rb}<^cRB5F`%8NYo8vh} zHttboh0&-Mv-Bosg|eweXXjF6g`&Kt%nC&(+1-VU3DLM^g|hR}fzxqme5|Teo*H}^ zf*8=o2vWV|3u3QB>aBHLkz>@wxx5|B&>eY?q9RTDNp|l(i?+s&ka$&(3}g3>WmX+x zMb<^RUW|9pn)(Gor}y#JgRJ_vDuU2d!t}nr9#w9Qr=s1gDG!QsS(Xa}ERZ-k4m^0^ z9a*4e{quLWQq;Q)N)+AOI=rHyNioUEUv!c~n3hWwNz^M%XQidWQyyeh>(T5(Zm0hT Db^_A} diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj deleted file mode 100644 index 3061287a6bb..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {9E46617A-3919-4B6F-94D6-B3873EC9E79C} - TemplateNamespace - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21208.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp deleted file mode 100644 index 1fd1457f99a..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp +++ /dev/null @@ -1,125 +0,0 @@ -//InteractiveExample.cpp file -// -/* - -This sample animates the position of an ellipse when -the user clicks within the main border. If the user -left-clicks, the SnapshotAndReplace HandoffBehavior -is used when applying the animations. If the user -right-clicks, the Compose HandoffBehavior is used -instead. - -*/ - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Navigation; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Animation; -using namespace System::Windows::Shapes; -using namespace System::Windows::Controls; -using namespace System::Windows::Input; - -namespace Microsoft { - namespace Samples { - namespace Animation { - namespace LocalAnimations { - public ref class InteractiveAnimationExample : Page { - private: - TranslateTransform^ interactiveTranslateTransform; - Border^ containerBorder; - Ellipse^ interactiveEllipse; - - public: - InteractiveAnimationExample () - { - WindowTitle = "Interactive Animation Example"; - DockPanel^ myPanel = gcnew DockPanel(); - myPanel->Margin = Thickness(20.0); - - containerBorder = gcnew Border(); - containerBorder->Background = Brushes::White; - containerBorder->BorderBrush = Brushes::Black; - containerBorder->BorderThickness = Thickness(2.0); - containerBorder->VerticalAlignment = System::Windows::VerticalAlignment::Stretch; - - interactiveEllipse = gcnew Ellipse(); - interactiveEllipse->Fill = Brushes::Lime; - interactiveEllipse->Stroke = Brushes::Black; - interactiveEllipse->StrokeThickness = 2.0; - interactiveEllipse->Width = 25; - interactiveEllipse->Height = 25; - interactiveEllipse->HorizontalAlignment = System::Windows::HorizontalAlignment::Left; - interactiveEllipse->VerticalAlignment = System::Windows::VerticalAlignment::Top; - - interactiveTranslateTransform = gcnew TranslateTransform(); - interactiveEllipse->RenderTransform = interactiveTranslateTransform; - - containerBorder->MouseLeftButtonDown += - gcnew MouseButtonEventHandler(this, &Microsoft::Samples::Animation::LocalAnimations::InteractiveAnimationExample::border_mouseLeftButtonDown); - containerBorder->MouseRightButtonDown += - gcnew MouseButtonEventHandler(this, &Microsoft::Samples::Animation::LocalAnimations::InteractiveAnimationExample::border_mouseRightButtonDown); - containerBorder->Child = interactiveEllipse; - - myPanel->Children->Add(containerBorder); - this->Content = myPanel; - }; - - private: - // When the user left-clicks, use the - // SnapshotAndReplace HandoffBehavior when applying the animation. - void border_mouseLeftButtonDown (System::Object^ sender, System::Windows::Input::MouseButtonEventArgs^ e) - { - System::Windows::Point clickPoint = Mouse::GetPosition(containerBorder); - - // Set the target point so the center of the ellipse - // ends up at the clicked point. - Point targetPoint = Point(); - targetPoint.X = clickPoint.X - interactiveEllipse->Width / 2; - targetPoint.Y = clickPoint.Y - interactiveEllipse->Height / 2; - - // Animate to the target point. - DoubleAnimation^ xAnimation = gcnew DoubleAnimation(targetPoint.X, - Duration(TimeSpan::FromSeconds(4))); - interactiveTranslateTransform->BeginAnimation(TranslateTransform::XProperty, xAnimation, HandoffBehavior::SnapshotAndReplace); - - DoubleAnimation^ yAnimation = gcnew DoubleAnimation(targetPoint.Y, - Duration(TimeSpan::FromSeconds(4))); - interactiveTranslateTransform->BeginAnimation(TranslateTransform::YProperty, yAnimation, HandoffBehavior::SnapshotAndReplace); - - // Chage the color of the ellipse. - interactiveEllipse->Fill = Brushes::Lime; - } - - private: - // When the user right-clicks, use the - // Compose HandoffBehavior when applying the animation. - void border_mouseRightButtonDown (System::Object^ sender, System::Windows::Input::MouseButtonEventArgs^ e) - { - // Find the point where the use clicked. - Point clickPoint = Mouse::GetPosition(containerBorder); - - // Set the target point so the center of the ellipse - // ends up at the clicked point. - Point targetPoint = System::Windows::Point(); - targetPoint.X = clickPoint.X - interactiveEllipse->Width / 2; - targetPoint.Y = clickPoint.Y - interactiveEllipse->Height / 2; - - // Animate to the target point. - DoubleAnimation^ xAnimation = gcnew DoubleAnimation(targetPoint.X, - Duration(TimeSpan::FromSeconds(4))); - interactiveTranslateTransform->BeginAnimation(TranslateTransform::XProperty, xAnimation, HandoffBehavior::Compose); - - DoubleAnimation^ yAnimation = gcnew DoubleAnimation(targetPoint.Y, - Duration(TimeSpan::FromSeconds(4))); - - // Change the color of the ellipse. - interactiveTranslateTransform->BeginAnimation(TranslateTransform::YProperty, yAnimation, HandoffBehavior::Compose); - interactiveEllipse->Fill = Brushes::Orange; - } - }; - } - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp deleted file mode 100644 index 7660b657d00..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp +++ /dev/null @@ -1,72 +0,0 @@ -//LocalAnimationExample.cpp file -// -/* - - This sample demonstrates how to apply non-storyboard animations to a property. - To animate in markup, you must use storyboards. - -*/ - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Navigation; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Animation; -using namespace System::Windows::Shapes; -using namespace System::Windows::Controls; - - -namespace Microsoft { - namespace Samples { - namespace Animation { - namespace LocalAnimations { - // Create the demonstration. - public ref class LocalAnimationExample : Page { - - public: - LocalAnimationExample () - { - WindowTitle = "Local Animation Example"; - StackPanel^ myStackPanel = gcnew StackPanel(); - myStackPanel->Margin = Thickness(20); - - // Create and set the Button. - Button^ aButton = gcnew Button(); - aButton->Content = "A Button"; - - // Animate the Button's Width. - DoubleAnimation^ myDoubleAnimation = gcnew DoubleAnimation(); - myDoubleAnimation->From = 75; - myDoubleAnimation->To = 300; - myDoubleAnimation->Duration = Duration(TimeSpan::FromSeconds(5)); - myDoubleAnimation->AutoReverse = true; - myDoubleAnimation->RepeatBehavior = RepeatBehavior::Forever; - - // Apply the animation to the button's Width property. - aButton->BeginAnimation(Button::WidthProperty, myDoubleAnimation); - - // Create and animate a Brush to set the button's Background. - SolidColorBrush^ myBrush = gcnew SolidColorBrush(); - myBrush->Color = Colors::Blue; - - ColorAnimation^ myColorAnimation = gcnew ColorAnimation(); - myColorAnimation->From = Colors::Blue; - myColorAnimation->To = Colors::Red; - myColorAnimation->Duration = Duration(TimeSpan::FromMilliseconds(7000)); - myColorAnimation->AutoReverse = true; - myColorAnimation->RepeatBehavior = RepeatBehavior::Forever; - - // Apply the animation to the brush's Color property. - myBrush->BeginAnimation(SolidColorBrush::ColorProperty, myColorAnimation); - aButton->Background = myBrush; - - // Add the Button to the panel. - myStackPanel->Children->Add(aButton); - this->Content = myStackPanel; - }; - }; - } - } - } -} -// diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj deleted file mode 100644 index ad5eb76eab3..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - LocalAnimationsExample - {1006019E-21B6-40FF-915C-EBB1C580417E} - Microsoft.Samples.Animation.LocalAnimations - ManagedCProj - - - - Application - Unicode - Pure - true - - - Application - Unicode - Pure - - - - - - - - - - - - - <_ProjectFileVersion>10.0.21230.0 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - WIN32;_DEBUG;%(PreprocessorDefinitions) - MultiThreadedDebugDLL - - - Level3 - ProgramDatabase - - - - - true - true - Windows - main - false - - - MachineX86 - - - - - WIN32;NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level3 - ProgramDatabase - - - - - true - Windows - main - false - - - MachineX86 - - - - - true - true - - - true - true - - - true - true - - - true - true - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp deleted file mode 100644 index dae3f92d86b..00000000000 --- a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp +++ /dev/null @@ -1,99 +0,0 @@ -//app.cpp file - - -using namespace System; -using namespace System::Windows; -using namespace System::Windows::Navigation; -using namespace System::Windows::Media; -using namespace System::Windows::Media::Animation; -using namespace System::Windows::Shapes; -using namespace System::Windows::Controls; -using namespace System::Windows::Input; - - -namespace Microsoft { - namespace Samples { - namespace Animation { - namespace LocalAnimations { - - // Forward class declaration. - public ref class LocalAnimationExample : Page { - public: - LocalAnimationExample () ; - }; - - // Forward class declaration. - public ref class InteractiveAnimationExample : Page { - public: - InteractiveAnimationExample () ; - private: - TranslateTransform^ interactiveTranslateTransform; - Border^ containerBorder; - Ellipse^ interactiveEllipse; - void border_mouseLeftButtonDown (System::Object^ sender, MouseButtonEventArgs^ e) ; - void border_mouseRightButtonDown (System::Object^ sender, MouseButtonEventArgs^ e) ; - }; - - // SampleViewer class. - public ref class SampleViewer : Window { - public: - SampleViewer (){ - TabControl^ tControl = gcnew TabControl(); - TabItem^ tItem = gcnew TabItem(); - tItem->Header = "Local Animation Example"; - Frame^ contentFrame = gcnew Frame(); - contentFrame->Content = gcnew LocalAnimationExample(); - tItem->Content = contentFrame; - tControl->Items->Add(tItem); - tItem = gcnew System::Windows::Controls::TabItem(); - tItem->Header = "Interactive Animation Example"; - contentFrame = gcnew System::Windows::Controls::Frame(); - contentFrame->Content = gcnew InteractiveAnimationExample(); - tItem->Content = contentFrame; - tControl->Items->Add(tItem); - this->Content = tControl; - this->Title = "Local Animations Example"; - } ; - }; - - // Application class. - public ref class app : Application { - protected: - virtual void OnStartup (System::Windows::StartupEventArgs^ e) override - { - Application::OnStartup(e); - CreateAndShowMainWindow(); - }; - - private: - void CreateAndShowMainWindow () - { - // Create the application's main window. - Window^ sViewer = gcnew SampleViewer(); - MainWindow = sViewer; - sViewer->Show(); - }; - }; - - private ref class EntryClass sealed { - public: - [System::STAThread()] - static void Main () - { - LocalAnimations::app^ app = gcnew LocalAnimations::app(); - app->Run(); - } - ; - }; - - } - } - } -} - -//Entry Point: -[System::STAThreadAttribute()] -void main () -{ - return Microsoft::Samples::Animation::LocalAnimations::EntryClass::Main(); -} From 0cdc612f1f67da2f398ad62b44efa2af11421b36 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 15:48:52 -0700 Subject: [PATCH 3/8] Revert "delete the referenced snippets" This reverts commit b2acfb19b892fa47b034f3f1ba7bae75a42e3e99. --- .../CPP/adapplicationbase.cpp | 29 + .../CPP/adclearprivatepath.cpp | 35 + .../ADDynamicBase/CPP/addynamicbase.cpp | 107 ++ .../cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp | 126 ++ .../ADGetAssemblies/CPP/adgetassemblies.cpp | 32 + .../ADGetData/CPP/adgetdata.cpp | 28 + .../ADMultiDomain/CPP/admultidomain.cpp | 49 + .../ADPrincipal/CPP/adprincipal.cpp | 55 + .../CPP/adsetappdomainpolicy.cpp | 46 + .../VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp | 39 + .../ADShadowCopy/CPP/adshadowcopy.cpp | 66 + .../ADToString/CPP/adtostring.cpp | 28 + .../VS_Snippets_CLR/ADUnload/CPP/adunload.cpp | 35 + .../ActivatorX/cpp/ActivatorX.cpp | 48 + .../ActivatorX/cpp/source2.cpp | 67 + .../AnimalAttributes/CPP/customattribute.cpp | 98 + .../CPP/reflectiononly.cpp | 47 + .../AppDomainInitializer/cpp/source.cpp | 68 + .../AppDomainX/cpp/AppDomainX.cpp | 102 + .../CPP/assemblyload.cpp | 45 + .../CPP/createcominstancefrom.cpp | 51 + .../CPP/ignorecase.cpp | 35 + .../CPP/definedynamicassembly.cpp | 56 + .../CPP/docallback_byref.cpp | 48 + .../CPP/docallback_byval.cpp | 49 + .../CPP/docallback_static.cpp | 40 + .../CPP/executeassembly.cpp | 17 + .../AppDomain_LoadRaw/CPP/loadraw.cpp | 77 + .../AppDomain_Setup/CPP/setup.cpp | 21 + .../AppDomain_TypeResolve/CPP/typeresolve.cpp | 90 + .../CPP/unhandledexception.cpp | 51 + .../cpp/ArgumentException.cpp | 38 + .../cpp/argumentexception2.cpp | 34 + .../ArrayList/CPP/ArrayListSample.cpp | 78 + .../CPP/arraytypemismatch_constructor1.cpp | 56 + .../CPP/arraytypemismatch_constructor2.cpp | 57 + .../CPP/arraytypemismatch_constructor3.cpp | 56 + .../Array_ConvertAll/cpp/source.cpp | 55 + .../Array_FindEtAl/cpp/source.cpp | 169 ++ .../Array_FindIndex/cpp/source.cpp | 60 + .../Array_FindLastIndex/cpp/source.cpp | 60 + .../Array_IndexOf/cpp/source.cpp | 48 + .../Array_LastIndexOf/cpp/source.cpp | 51 + .../Array_Sort2IntIntIComparer/cpp/source.cpp | 124 ++ .../Array_SortComparison/cpp/source.cpp | 106 ++ .../Array_SortIntIntIComparer/cpp/source.cpp | 80 + .../Array_SortSearch/cpp/source.cpp | 91 + .../Array_SortSearchComparer/cpp/source.cpp | 103 + .../Assembly.FullName/CPP/Example.cpp | 23 + .../Assembly.GetExportedTypes/CPP/source.cpp | 78 + .../Assembly.Load1/CPP/load1.cpp | 23 + .../CPP/assemblybuilder_defineresource.cpp | 54 + .../AssemblyBuilderClass/cpp/24895.cpp | 222 +++ .../cpp/AssemblyBuilderClass.vcxproj | 147 ++ .../cpp/snippets.5000.json | 3 + ...ssemblybuilder_defineunmanagedresource.cpp | 66 + ...semblybuilder_defineunmanagedresource2.cpp | 66 + ...emblybuilder_defineversioninforesource.cpp | 167 ++ .../assemblybuilder_setcustomattribute1.cpp | 62 + .../assemblybuilder_setcustomattribute2.cpp | 59 + .../AssemblyClass/cpp/source.cpp | 75 + .../AssemblyDelaySignAttribute/cpp/source.cpp | 13 + .../AssemblyFlagsAttribute/CPP/source.cpp | 79 + .../CPP/assemblyinstaller.cpp | 41 + .../assemblyinstaller_checkifinstallable.cpp | 35 + .../CPP/assemblyinstaller_helptext.cpp | 55 + .../CPP/assemblyinstaller_install.cpp | 53 + .../CPP/assemblyinstaller_rollback.cpp | 57 + .../CPP/assemblyinstaller_uninstall.cpp | 49 + .../AssemblyName.Version/cpp/Example.cpp | 21 + .../CPP/assemblyname_codebase.cpp | 99 + .../CPP/assemblyname_constructor.cpp | 84 + .../AssemblyName_Constructor_2/CPP/source.cpp | 24 + .../CPP/assemblyname_getassemblyname.cpp | 30 + .../CPP/assemblyname_keypair.cpp | 123 ++ .../CPP/assemblyname_setpublickey.cpp | 125 ++ .../AssemblyResolve/CPP/assemblyresolve.cpp | 79 + .../AsyncDelegateExamples/cpp/TestMethod.cpp | 27 + .../AsyncDelegateExamples/cpp/callback.cpp | 79 + .../AsyncDelegateExamples/cpp/polling.cpp | 43 + .../AsyncDelegateExamples/cpp/waithandle.cpp | 47 + .../AsyncResult.NewExamples/CPP/ad.cpp | 122 ++ .../AttrTargs/CPP/attrtargs.cpp | 73 + .../VS_Snippets_CLR/Binder_1/CPP/binder.cpp | 449 +++++ .../BindingFlags/CPP/bindingflagssample.cpp | 365 ++++ .../VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp | 80 + .../CertSelect/CPP/certselect.cpp | 47 + .../CipherReference2/CPP/example.cpp | 38 + .../cpp/ClassInterfaceType.cpp | 41 + ...codeargumentreferenceexpressionexample.cpp | 43 + .../CPP/codearraycreateexpressionsnippet.cpp | 289 +++ .../CPP/codearrayindexerexpressionsnippet.cpp | 301 +++ .../CPP/codeassignstatementsnippet.cpp | 289 +++ .../CPP/codeattacheventstatementexample.cpp | 81 + .../CPP/class1.cpp | 82 + .../CPP/class1.cpp | 90 + .../codebasereferenceexpressionexample.cpp | 29 + .../codebinaryoperatorexpressionexample.cpp | 32 + .../CPP/codecastexpressionexample.cpp | 33 + .../CPP/class1.cpp | 78 + .../CPP/codecommentexample.cpp | 37 + .../CPP/class1.cpp | 80 + .../CPP/codeconditionstatementexample.cpp | 40 + .../CPP/codeconstructorexample.cpp | 130 ++ .../codedelegateinvokeexpressionexample.cpp | 98 + .../CodeDomExample/CPP/source.cpp | 309 +++ .../CodeDomPartialTypeExample/CPP/source.cpp | 439 +++++ .../CodeDomSampleBatch/CPP/class1.cpp | 100 + .../CodeDom_CompilerInfo/CPP/source.cpp | 327 ++++ .../CPP/codeentrypointmethodexample.cpp | 59 + .../CPP/class1.cpp | 77 + .../CPP/class1.cpp | 37 + .../CPP/codegotostatementexample.cpp | 59 + .../CPP/codeiterationstatementexample.cpp | 35 + .../CPP/codemembereventexample.cpp | 59 + .../CPP/codememberfieldexample.cpp | 46 + .../CPP/class1.cpp | 38 + .../CPP/codemembermethodexample.cpp | 37 + .../CPP/codememberpropertyexample.cpp | 95 + .../CPP/codemethodinvokeexpressionexample.cpp | 32 + .../CPP/codemethodreferenceexample.cpp | 53 + .../CodeMultiExample/CPP/codemultiexample.cpp | 66 + .../CPP/class1.cpp | 78 + .../CPP/codenamespaceexample.cpp | 32 + .../CPP/codenamespaceimportexample.cpp | 45 + .../CPP/codeparameterdeclarationexample.cpp | 52 + .../CPP/class1.cpp | 81 + .../CPP/codeprimitiveexpressionexample.cpp | 37 + .../CPP/codepropertysetvalueexample.cpp | 70 + .../CPP/codereferenceexample.cpp | 53 + .../CPP/coderemoveeventexample.cpp | 33 + .../CPP/class1.cpp | 78 + .../codethrowexceptionstatementexample.cpp | 24 + .../CPP/codetrycatchfinallyexample.cpp | 81 + .../CPP/codetypeconstructorexample.cpp | 42 + .../CPP/class1.cpp | 80 + .../CPP/codetypedeclarationexample.cpp | 41 + .../CPP/codetypedelegateexample.cpp | 78 + .../CPP/class1.cpp | 79 + .../CPP/codetypeofexample.cpp | 63 + .../CPP/class1.cpp | 78 + ...odevariabledeclarationstatementexample.cpp | 28 + .../CompareInfo/cpp/CompareInfo.cpp | 46 + .../CPP/class1.cpp | 77 + .../CompilerParametersExample/CPP/source.cpp | 234 +++ .../CompilerResultsExample/CPP/class1.cpp | 54 + .../componentinstaller_copyfromcomponent.cpp | 51 + .../Console-EXPANDTABSEX/CPP/expandtabsex.cpp | 66 + .../CPP/constructorbuilder_attributes_4.cpp | 155 ++ .../CPP/constructorbuilder_getmodule_4.cpp | 127 ++ .../CPP/constructorbuilder_name_5.cpp | 123 ++ ...constructorbuilder_setcustomattribute1.cpp | 91 + ...constructorbuilder_setcustomattribute2.cpp | 86 + ...structorbuilder_setimplementationflags.cpp | 128 ++ ...nstructorbuilder_setsymcustomattribute.cpp | 106 ++ ...countercreationdatacollection_addrange.cpp | 65 + ...countercreationdatacollection_contains.cpp | 79 + .../countercreationdatacollection_ctor.cpp | 66 + .../countercreationdatacollection_ctor.cpp | 62 + ...rcreationdatacollection_insert_indexof.cpp | 75 + .../CPP/countersample_ctor_2.cpp | 69 + .../CreateInstanceAndUnwrap2/cpp/source.cpp | 36 + .../CPP/fileexample.cpp | 146 ++ .../CPP/memoryexample.cpp | 170 ++ .../CPP/asnencodeddata.cpp | 90 + .../CPP/fileexample.cpp | 146 ++ .../CPP/memoryexample.cpp | 170 ++ .../CPP/fileexample.cpp | 113 ++ .../CPP/memoryexample.cpp | 105 ++ .../CPP/dataprotectionsample.cpp | 82 + .../Cryptography.KeyNumber/cpp/sample.cpp | 20 + .../CPP/memoryprotectionsample.cpp | 19 + .../Cryptography.Oid/CPP/cryptography.oid.cpp | 61 + .../cpp/sample.cpp | 100 + .../CPP/fileexample.cpp | 146 ++ .../CPP/memoryexample.cpp | 170 ++ .../cpp/example.cpp | 57 + .../CPP/example.cpp | 52 + .../CPP/example.cpp | 81 + .../CPP/example.cpp | 107 ++ .../CPP/example.cpp | 94 + .../CPP/example.cpp | 110 ++ .../CPP/example2.cpp | 77 + .../CPP/example.cpp | 174 ++ .../CPP/example.cpp | 104 + .../CPP/example.cpp | 175 ++ .../CPP/sample.cpp | 63 + .../CPP/Cryptography.SmartCardCSP.cpp | 38 + .../CPP/sample.cpp | 29 + .../CPP/sample.cpp | 28 + .../CPP/example.cpp | 27 + .../CPP/sample.cpp | 63 + .../CPP/sample.cpp | 207 ++ .../CPP/sample.cpp | 178 ++ .../CPP/sample.cpp | 169 ++ .../CPP/sample.cpp | 179 ++ .../CPP/Cryptography.XML.XMLEncMapKey.cpp | 200 ++ .../CPP/Cryptography.XML.XMLEncMapKeyX509.cpp | 133 ++ .../Cryptography.XML.XMLEncMinimalDecrypt.cpp | 135 ++ ...ptography.XML.XMLEncMinimalDecryptData.cpp | 196 ++ .../CPP/example.cpp | 181 ++ .../CPP/sample.cpp | 178 ++ .../CPP/sample.cpp | 202 ++ .../CPP/sample.cpp | 193 ++ .../cpp/sample.cpp | 75 + .../CPP/currencydecimaldigits.cpp | 29 + .../CPP/currencydecimalseparator.cpp | 29 + .../CPP/currencygroupseparator.cpp | 29 + .../CPP/currencygroupsizes.cpp | 34 + .../CustomAttributeData/CPP/source.cpp | 234 +++ .../DataBinding/CPP/webcustomcontrol1.cpp | 328 ++++ .../DateTime Operators/CPP/class1.cpp | 30 + .../DateTime.Add/CPP/class1.cpp | 12 + .../DateTime.AddDays/CPP/class1.cpp | 15 + .../DateTime.CompareTo/CPP/class1.cpp | 34 + .../DateTime.DayOfWeek/CPP/dow.cpp | 21 + .../DateTime.DaysInMonth/CPP/class1.cpp | 22 + .../DateTime.Equals/CPP/class1.cpp | 22 + .../DateTime.FromFileTime/CPP/class1.cpp | 44 + .../CPP/class1.cpp | 34 + .../DateTime.Subtraction/CPP/class1.cpp | 27 + .../DateTime.ToFileTime/CPP/class1.cpp | 21 + .../CPP/class1.cpp | 49 + .../Decimal Example/CPP/source.cpp | 144 ++ .../cpp/source.cpp | 51 + .../cpp/source.cpp | 56 + .../CPP/source.cpp | 78 + .../CPP/diagnostics_countercreationdata.cpp | 63 + .../Dictionary/cpp/Dictionary.cpp | 398 ++++ .../Dictionary/cpp/remarks.cpp | 44 + .../CPP/dirinfo class example.cpp | 37 + .../DirInfo Create/CPP/dirinfo create.cpp | 37 + .../DirInfo Ctor/CPP/dirinfo ctor.cpp | 30 + .../DirInfo Delete1/CPP/dirinfo delete1.cpp | 29 + .../DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp | 28 + .../Dir_CreateDir/CPP/dir_createdir.cpp | 35 + .../Dir_GetCreation/CPP/dir_getcreation.cpp | 40 + .../Dir_GetCurDir/CPP/dir_getcurdir.cpp | 37 + .../Dir_GetDirs2/CPP/dir_getdirs2.cpp | 26 + .../Dir_GetFiles2/CPP/dir_getfiles2.cpp | 26 + .../CPP/dir_getlastaccess.cpp | 32 + .../Dir_GetLastWrite/CPP/dir_getlastwrite.cpp | 37 + .../CPP/dir_setlastaccess.cpp | 32 + .../Dir_SetLastWrite/CPP/dir_setlastwrite.cpp | 37 + .../CPP/copydirectory.cpp | 36 + .../Double Example/CPP/source.cpp | 531 ++++++ .../CPP/gettype.cpp | 30 + .../CPP/referenceequals.cpp | 24 + .../Emit.ArgIterator/cpp/source.cpp | 111 ++ .../EmitGenericType/CPP/source.cpp | 300 +++ .../CPP/entrywritteneventargs_ctor1.cpp | 49 + .../CPP/entrywritteneventargs_ctor2.cpp | 59 + .../CPP/enumbuilder_properties_4.cpp | 87 + .../CPP/enumbuilder_properties_5.cpp | 92 + .../CPP/enumbuilder_setcustomattribute1.cpp | 107 ++ .../CPP/enumbuilder_setcustomattribute2.cpp | 93 + .../CPP/getcommandlineargs.cpp | 20 + .../CPP/getenvironmentvariables.cpp | 16 + .../CPP/getfolderpath.cpp | 16 + .../CPP/getlogicaldrives.cpp | 17 + .../CPP/machinename.cpp | 19 + .../Environment.NewLine/CPP/newline.cpp | 18 + .../Environment.StackTrace/CPP/stacktrace.cpp | 19 + .../CPP/systemdirectory.cpp | 18 + .../Environment.TickCount/CPP/tickcount.cpp | 20 + .../CPP/userinteractive.cpp | 16 + .../Environment.UserName/CPP/username.cpp | 13 + .../Environment.Version/CPP/version.cpp | 17 + .../Environment.WorkingSet/CPP/workingset.cpp | 15 + .../VS_Snippets_CLR/EventArg/CPP/eventarg.cpp | 29 + .../CPP/eventlogentrytype_6.cpp | 110 ++ .../CPP/eventlogentry_copyto.cpp | 72 + .../CPP/eventlogentry_item.cpp | 67 + .../CPP/eventlogentry_source.cpp | 65 + .../CPP/eventloginstaller.cpp | 50 + .../EventLogProperties/CPP/source.cpp | 187 ++ .../CPP/source.cpp | 137 ++ .../CPP/eventlog_exists_1.cpp | 36 + .../CPP/eventlog_writeentry_1_3.cpp | 53 + .../CPP/eventlog_writeentry_4.cpp | 42 + .../CPP/eventlog_writeentry_5.cpp | 58 + .../ExToString/CPP/extostring.cpp | 34 + .../FInfo AppendText/CPP/finfo appendtext.cpp | 79 + .../FInfo Class/CPP/finfo class.cpp | 60 + .../FInfo CopyTo2/CPP/finfo copyto2.cpp | 38 + .../FInfo Create/CPP/finfo create.cpp | 53 + .../FInfo CreateText/CPP/finfo createtext.cpp | 48 + .../FInfo Ctor/CPP/finfo ctor.cpp | 72 + .../FInfo Delete/CPP/finfo delete.cpp | 39 + .../FInfo Open1/CPP/finfo open1.cpp | 65 + .../FInfo Open2/CPP/finfo open2.cpp | 80 + .../FInfo OpenRead/CPP/finfo openread.cpp | 64 + .../FInfo OpenText/CPP/file opentext.cpp | 47 + .../FInfo OpenWrite/CPP/file openwrite.cpp | 63 + .../FStream CanSeek/CPP/fstream canseek.cpp | 35 + .../FStream CanWrite/CPP/fstream canwrite.cpp | 32 + .../FStream Class/CPP/fstream class.cpp | 68 + .../CPP/fieldbuilder_reflectedtype.cpp | 84 + .../CPP/fieldbuilder_setcustomattributes.cpp | 132 ++ .../CPP/fieldbuilder_setoffset.cpp | 74 + .../FieldInfo/CPP/fieldinfo.cpp | 34 + .../CPP/fieldinfo_fieldhandle.cpp | 50 + .../CPP/fieldinfo_getfieldfromhandle.cpp | 36 + .../CPP/fieldinfo_getvalue.cpp | 40 + .../CPP/fieldinfo_isnotserialized.cpp | 34 + .../CPP/fieldinfo_ispinvokeimpl.cpp | 29 + .../CPP/fieldinfo_isprivate.cpp | 53 + .../CPP/fieldinfo_isspecialname.cpp | 34 + .../CPP/fieldinfo_setvalue.cpp | 51 + .../CPP/file class example.cpp | 61 + .../File Create1/CPP/file create1.cpp | 41 + .../File Create2/CPP/file create2.cpp | 41 + .../File CreateText/CPP/file createtext.cpp | 41 + .../CPP/file getattributes.cpp | 32 + .../CPP/file getlastaccess.cpp | 32 + .../CPP/file getlastwrite.cpp | 37 + .../File Move/CPP/file move.cpp | 44 + .../File Open1/CPP/file open1.cpp | 41 + .../File Open2/CPP/file open2.cpp | 57 + .../File Open3/CPP/file open3.cpp | 65 + .../File OpenRead/CPP/file openread.cpp | 45 + .../File OpenText/CPP/file opentext.cpp | 43 + .../File OpenWrite/CPP/file openwrite.cpp | 47 + .../CPP/file setlastaccess.cpp | 34 + .../CPP/file setlastwrite.cpp | 37 + .../FileInfoCopyTo1/CPP/fileinfocopyto1.cpp | 50 + .../FileLength/CPP/filelength.cpp | 45 + .../FileSystemInfo/cpp/program.cpp | 58 + .../File_AppendText/CPP/file_appendtext.cpp | 58 + .../GCNotification/cpp/program.cpp | 242 +++ .../Generic.Dictionary/cpp/source.cpp | 184 ++ .../Generic.Dictionary/cpp/source2.cpp | 35 + .../Generic.IDictionary/cpp/source.cpp | 182 ++ .../Generic.IDictionary/cpp/source2.cpp | 34 + .../Generic.LinkedList/cpp/source.cpp | 264 +++ .../Generic.SortedList/cpp/remarks.cpp | 41 + .../Generic.SortedList/cpp/source.cpp | 198 ++ .../GenericMethodBuilder/cpp/source.cpp | 114 ++ .../GetCustomAttributes/CPP/ca1.cpp | 42 + .../GetCustomAttributes/CPP/custattrs.cpp | 258 +++ .../GetFldVal/CPP/getfldval.cpp | 22 + .../HMACRIPEMD160/CPP/hmacripemd160.cpp | 134 ++ .../HMACSHA256/CPP/hmacsha256.cpp | 134 ++ .../HMACSHA384/CPP/hmacsha384.cpp | 134 ++ .../HMACSHA512/CPP/hmacsha512.cpp | 134 ++ .../IComparable Example/CPP/source.cpp | 81 + .../IComparable`1 Example/CPP/source.cpp | 99 + .../CPP/ilgenerator_beginfaultblock.cpp | 102 + .../CPP/ILGenerator_BeginFinallyBlock_2.cpp | 114 ++ .../CPP/ilgenerator_begin_endscope.cpp | 97 + .../cpp/sample.cpp | 86 + .../IO.File.Encrypt-Decrypt/cpp/sample.cpp | 49 + .../cpp/sample.cpp | 67 + .../IO.File.Replace/cpp/sample.cpp | 39 + .../cpp/sample.cpp | 60 + .../IO.FileInfo.Exists/cpp/sample.cpp | 49 + .../cpp/sample.cpp | 97 + .../IO.FileInfo.Replace/cpp/sample.cpp | 64 + .../IO.FileInfo.isReadOnly/cpp/sample.cpp | 47 + .../IO.FileStream.ctor1/cpp/example.cpp | 60 + .../IO.FileStream.ctor2/cpp/example.cpp | 74 + .../cpp/example.cpp | 67 + .../IO.Ports.GetPortNames/cpp/example.cpp | 30 + .../ImprovedInteropSnippets/CPP/codefile1.cpp | 14 + .../ImprovedInteropSnippets/CPP/codefile2.cpp | 57 + .../ImprovedInteropSnippets/CPP/codefile3.cpp | 31 + .../ImprovedInteropSnippets/CPP/codefile4.cpp | 25 + .../ImprovedInteropSnippets/CPP/codefile5.cpp | 26 + .../IndentedTextWriterExample/CPP/form1.cpp | 120 ++ .../VS_Snippets_CLR/InnerEx/CPP/innerex.cpp | 53 + .../CPP/installcontext_installcontext.cpp | 136 ++ .../InstallEventArgs/CPP/installeventargs.cpp | 124 ++ .../InstallException/CPP/installexception.cpp | 114 ++ .../Installer/CPP/installer.cpp | 82 + .../CPP/installercollection_add.cpp | 114 ++ .../CPP/installercollection_addrange1.cpp | 60 + .../CPP/installercollection_copyto.cpp | 65 + .../CPP/installercollection_insert.cpp | 60 + .../CPP/installercollection_item.cpp | 65 + .../CPP/installercollection_remove.cpp | 81 + .../CPP/installer_afterinstall.cpp | 88 + .../CPP/installer_afterrollback.cpp | 72 + .../CPP/installer_afteruninstall.cpp | 89 + .../CPP/installer_beforeinstall.cpp | 90 + .../CPP/installer_beforerollback.cpp | 88 + .../CPP/installer_beforeuninstall.cpp | 89 + .../CPP/installer_committed.cpp | 83 + .../CPP/installer_committed.cpp | 58 + .../CPP/installer_committing.cpp | 59 + .../CPP/installer_context.cpp | 73 + .../CPP/installer_helptext.cpp | 69 + .../CPP/installer_install.cpp | 48 + .../CPP/installer_installers.cpp | 51 + .../CPP/installer_oninstall.cpp | 79 + .../CPP/installer_rollback.cpp | 53 + .../CPP/installer_uninstall.cpp | 41 + .../Int16_Equals/CPP/int16_equals.cpp | 357 ++++ .../Int32_Equals/CPP/int32_equals.cpp | 357 ++++ .../Int64_Equals/CPP/int64_equals.cpp | 357 ++++ .../CPP/callingconv.cpp | 25 + .../Interop InOutParameters/CPP/inout.cpp | 29 + .../InvokeMem/CPP/invokemem.cpp | 90 + .../IsDefaultAttribute/CPP/defattr.cpp | 85 + .../IsDefined/CPP/isdefined.cpp | 276 +++ .../IsolatedStoragePermissionAttribute.cpp | 92 + .../KeyedCollection/cpp/source.cpp | 220 +++ .../KeyedCollection2/cpp/source.cpp | 341 ++++ .../CPP/lcidattrsample.cpp | 42 + .../LayoutKind/CPP/layoutkind.cpp | 76 + .../List`1_AsReadOnly/cpp/source.cpp | 68 + .../List`1_Class/cpp/source.cpp | 104 + .../List`1_ConvertAll/cpp/source.cpp | 51 + .../List`1_CopyTo/cpp/source.cpp | 53 + .../List`1_FindEtAl/cpp/source.cpp | 97 + .../List`1_IndexOf/cpp/source.cpp | 51 + .../List`1_LastIndexOf/cpp/source.cpp | 51 + .../List`1_Ranges/cpp/source.cpp | 105 ++ .../List`1_Reverse/cpp/source.cpp | 64 + .../List`1_SortComparison/cpp/source.cpp | 106 ++ .../List`1_SortSearch/cpp/source.cpp | 89 + .../List`1_SortSearchComparer/cpp/source.cpp | 164 ++ .../cpp/source.cpp | 141 ++ .../CPP/localbuilder_sample_4.cpp | 92 + .../cpp/source.cpp | 71 + .../VS_Snippets_CLR/Marshal/cpp/marshal.cpp | 67 + .../MathSample/CPP/mathsample.cpp | 88 + ...emberinfo_getcustomattribute_isdefined.cpp | 68 + .../CPP/memberinfo_getcustomattributes1.cpp | 67 + .../VS_Snippets_CLR/MethodBody/cpp/source.cpp | 157 ++ .../cpp/source.cpp | 41 + .../CPP/methodbuilderclass.cpp | 67 + .../MethodInfo.Generics/cpp/source.cpp | 132 ++ .../CPP/source.cpp | 92 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 64 + .../CPP/source2.cpp | 34 + .../CPP/source.cpp | 93 + .../cpp/MissingMethodException.cpp | 72 + .../ModuleBuilder_Class/CPP/modulebuilder.cpp | 80 + .../modulebuilder_createglobalfunctions.cpp | 79 + .../CPP/modulebuilder_definedocument.cpp | 49 + .../CPP/modulebuilder_defineenum.cpp | 46 + .../modulebuilder_defineinitializeddata.cpp | 67 + .../modulebuilder_definepinvokemethod1.cpp | 68 + .../CPP/modulebuilder_defineresource1.cpp | 50 + .../CPP/modulebuilder_defineresource2.cpp | 50 + .../CPP/modulebuilder_getarraymethod.cpp | 110 ++ .../MonitorExmpl2/CPP/monitor2.cpp | 331 ++++ .../CPP/delegatestring.cpp | 149 ++ .../CPP/numberdecimaldigits.cpp | 27 + .../CPP/numberdecimalseparator.cpp | 28 + .../NumberFormatInfo/cpp/NumberFormatInfo.cpp | 47 + .../CPP/numbergroupseparator.cpp | 27 + .../NumberGroupSizes/CPP/numbergroupsizes.cpp | 32 + .../NumberStyles/cpp/NumberStyles.cpp | 41 + .../ObjDispEx/CPP/objdispexc.cpp | 20 + .../ObjectModel.Collection/cpp/source.cpp | 115 ++ .../VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp | 107 ++ .../OperatingSystem.ServicePack/CPP/sp.cpp | 18 + .../CPP/osvs.cpp | 20 + .../CPP/parameterinfo_attributes1.cpp | 38 + ...meterInfo_GetCustomAttribute_IsDefined.cpp | 87 + .../CPP/source.cpp | 82 + .../ParameterInfo_IsIn_IsOut_IsOptional.cpp | 103 + .../Path Class/CPP/path class.cpp | 38 + .../CPP/percentdecimaldigits.cpp | 27 + .../CPP/percentdecimalseparator.cpp | 28 + .../CPP/percentgroupseparator.cpp | 28 + .../CPP/percentgroupsizes.cpp | 33 + .../PerfCounter/CPP/perfcounter.cpp | 102 + .../PerfCounter_ccd/CPP/ccd.cpp | 25 + .../CPP/performancecounterinstaller.cpp | 50 + .../CPP/averagecount32.cpp | 138 ++ .../CPP/elapsedtime.cpp | 208 ++ .../Permission/cpp/Permission.cpp | 279 +++ .../CPP/processstaticget.cpp | 40 + .../CPP/processstart.cpp | 28 + .../CPP/processstartstatic.cpp | 47 + .../CPP/processstartstatic2.cpp | 52 + .../CPP/processstartstatic3.cpp | 17 + .../ProcessModule/CPP/processmodule.cpp | 56 + .../CPP/processmodule_baseaddress.cpp | 53 + .../CPP/processmodule_entrypoint.cpp | 50 + .../CPP/processmodule_filename.cpp | 53 + .../CPP/processmodule_fileversioninfo.cpp | 52 + .../CPP/processmodule_modulememorysize.cpp | 53 + .../CPP/processmodule_modulename.cpp | 53 + .../CPP/processmodule_tostring.cpp | 53 + .../ProcessOneStream/CPP/stdstr.cpp | 24 + .../CPP/process_mainwindowtitle.cpp | 41 + .../Process_StandardError/CPP/source.cpp | 48 + .../CPP/process_standardinput.cpp | 76 + .../CPP/process_standardoutput.cpp | 26 + .../CPP/process_synchronizingobject.cpp | 110 ++ .../CPP/remarks.cpp | 138 ++ .../CPP/progidattribute_value.cpp | 39 + .../CPP/propertybuilder_setgetmethod_4.cpp | 130 ++ .../PropertyInfo.SetValue/cpp/Example.cpp | 132 ++ .../PropertyInfo.SetValue/cpp/example2.cpp | 65 + .../PtrToStructure/CPP/pts.cpp | 77 + .../RIPEMD160/CPP/ripemd160.cpp | 77 + .../cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp | 75 + .../ReadTextFile/CPP/readtextfile.cpp | 35 + .../CPP/directorylisting.cpp | 69 + .../cpp/source.cpp | 253 +++ .../cpp/source.cpp | 81 + .../Reflection/CPP/reflection.cpp | 172 ++ .../VS_Snippets_CLR/Regex_Words/CPP/words.cpp | 36 + .../RegistryKey.OpenSubKey/CPP/opensubkey.cpp | 41 + .../RegistrySecurity101/cpp/source.cpp | 145 ++ .../CPP/RegistryValueOptions.cpp | 30 + .../CPP/source.cpp | 28 + .../CPP/resourcepermissionbase.cpp | 149 ++ .../RijndaelManaged Example/CPP/class1.cpp | 172 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../cpp/sample.cpp | 128 ++ .../CPP/sample.cpp | 127 ++ .../cpp/sample.cpp | 18 + .../cpp/sample.cpp | 16 + .../cpp/sample.cpp | 19 + .../cpp/sample.cpp | 19 + .../cpp/sample.cpp | 20 + .../cpp/sample.cpp | 19 + .../cpp/sample.cpp | 21 + .../cpp/sample.cpp | 18 + .../cpp/sample.cpp | 22 + .../cpp/sample.cpp | 18 + .../CPP/stringtohglobalansi.cpp | 23 + .../CPP/sample.cpp | 20 + .../cpp/RuntimeEnvironment.cpp | 46 + .../SecureString.xAt/CPP/SecureString.xAt.cpp | 85 + .../CPP/SecureString.xChar.cpp | 62 + .../CPP/SecurityElementMembers.cpp | 290 +++ .../CPP/servicecontroller.cpp | 344 ++++ .../ServiceInstallConfig/CPP/source.cpp | 372 ++++ .../StackFrameSample1/CPP/source.cpp | 280 +++ .../CPP/stacktracesample1.cpp | 147 ++ .../CPP/stacktracesample2.cpp | 72 + .../CPP/stacktracesample3.cpp | 88 + .../StopWatchPerfSample/CPP/source.cpp | 201 ++ .../StringBuilder/cpp/StringBuilder.cpp | 59 + .../CPP/stringcompareordinal.cpp | 34 + .../StringCompareTo/CPP/stringcompareto.cpp | 40 + .../StringInfo/cpp/StringInfo.cpp | 84 + .../StrmRdrRead/CPP/strmrdrread.cpp | 24 + .../StrmReader Ctor1/CPP/strmreader ctor1.cpp | 52 + .../StrmReader Ctor2/CPP/strmreader ctor2.cpp | 44 + .../CPP/strmreader currentencoding.cpp | 53 + .../StrmReader Peek/CPP/strmreader peek.cpp | 45 + .../StrmReader Read1/CPP/strmreader read1.cpp | 44 + .../StrmReader Read2/CPP/strmreader read2.cpp | 52 + .../CPP/strmreader readline.cpp | 45 + .../CPP/strmreader readtoend.cpp | 42 + .../cpp/strongnamekeypairx.cpp | 49 + .../CPP/structlayoutattribute.cpp | 78 + .../VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp | 134 ++ .../cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp | 181 ++ .../TestBaseType/CPP/testbasetype.cpp | 10 + .../TestFullName/CPP/TestFullName.cpp | 14 + .../CPP/TestGetElementType.cpp | 23 + .../cpp/testisassignablefrom.cpp | 108 ++ .../TestIsEnum/CPP/TestIsEnum.cpp | 21 + .../CPP/testisinstanceoftype.cpp | 38 + .../cpp/source.cpp | 47 + .../ThreadAbEx/CPP/threadabex.cpp | 46 + .../ThreadStEx/CPP/threadstex.cpp | 33 + .../ThreadStart/CPP/threadstart.cpp | 37 + .../TimeoutException.class/cpp/to.cpp | 53 + .../CPP/transactedinstaller.cpp | 129 ++ .../Type.IsPublic/CPP/type_ispublic.cpp | 20 + .../CPP/Type.StructLayoutAttribute.cpp | 40 + .../cpp/source.cpp | 104 + .../typebuilder_adddeclarativesecurity.cpp | 47 + .../CPP/typebuilder_definenestedtype1.cpp | 94 + .../cpp/100656_fix.cpp | 64 + .../typebuilder_defineuninitializeddata.cpp | 98 + .../CPP/typebuilder_getevents1.cpp | 64 + .../CPP/typebuilder_properties.cpp | 66 + .../CPP/typebuilder_sample_4.cpp | 103 + .../TypeLibVar/CPP/codefile6.cpp | 25 + .../CPP/typeloadexception_constructor2.cpp | 32 + .../CPP/typeloadexception_constructor3.cpp | 56 + .../CPP/typeloadexception_getobjectdata.cpp | 112 ++ .../CPP/typeloadexception_typename.cpp | 39 + .../Type_Assembly/CPP/type_assembly.cpp | 20 + .../CPP/type_defaultbinder.cpp | 32 + .../CPP/type_filterattribute.cpp | 36 + .../CPP/type_filternameignorecase.cpp | 36 + .../CPP/type_findinterfaces.cpp | 69 + .../Type_FindMembers/CPP/type_findmembers.cpp | 48 + .../CPP/type_getarrayrank.cpp | 27 + .../CPP/type_getconstructor.cpp | 42 + .../CPP/type_getconstructor2.cpp | 50 + .../CPP/type_getconstructor3.cpp | 50 + .../CPP/type_getdefaultmembers.cpp | 58 + .../Type_GetEvent/CPP/type_getevent.cpp | 41 + .../Type_GetField/CPP/type_getfield.cpp | 97 + .../CPP/type_gethashcode_getfields.cpp | 49 + .../CPP/type_getinterface.cpp | 52 + .../CPP/type_getinterfaces1.cpp | 30 + .../Type_GetMember/CPP/type_getmember.cpp | 100 + .../Type_GetMembers1/CPP/type_getmembers1.cpp | 52 + .../Type_GetMembers2/CPP/type_getmembers2.cpp | 66 + .../Type_GetMethod1/CPP/type_getmethod1.cpp | 24 + .../Type_GetMethod2/CPP/type_getmethod2.cpp | 25 + .../Type_GetMethod3/CPP/type_getmethod3.cpp | 64 + .../Type_GetMethod4/CPP/type_getmethod4.cpp | 47 + .../Type_GetMethod5/CPP/type_getmethod5.cpp | 59 + .../Type_GetMethods2/CPP/type_getmethods2.cpp | 54 + .../CPP/type_getnestedclassesabs.cpp | 56 + .../CPP/type_getnestedtypes.cpp | 43 + .../CPP/type_getproperties2.cpp | 153 ++ .../CPP/type_getproperty1.cpp | 45 + .../CPP/type_getproperty2.cpp | 45 + .../CPP/type_getproperty3.cpp | 58 + .../CPP/type_getproperty2.cpp | 53 + .../CPP/type_getproperty_types.cpp | 55 + .../Type_GetType/CPP/type_gettype.cpp | 32 + .../Type_GetTypeCode/CPP/type_gettypecode.cpp | 72 + .../CPP/type_gettypefromhandle.cpp | 23 + .../CPP/type_gettypefromprogid2.cpp | 32 + .../CPP/Type_GetTypeFromProgID3.cpp | 32 + .../CPP/Type_GetTypeFromProgID4.cpp | 35 + .../CPP/Type_GetTypeHandle.cpp | 57 + .../Type_Guid/CPP/type_guid.cpp | 25 + .../CPP/type_haselementtype.cpp | 55 + .../CPP/type_haselementtypeimpl.cpp | 86 + .../Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp | 38 + .../Type_IsArrayImpl/CPP/type_isarrayimpl.cpp | 68 + .../CPP/type_isautolayout.cpp | 40 + .../Type_IsClass/CPP/type_isclass.cpp | 23 + .../CPP/type_iscontextful.cpp | 49 + .../CPP/type_iscontextfulimpl.cpp | 82 + .../Type_IsInterface/CPP/type_isinterface.cpp | 35 + .../CPP/type_islayoutsequential.cpp | 40 + .../CPP/type_ismarshalbyrefimpl.cpp | 81 + .../CPP/type_isprimitiveimpl.cpp | 73 + .../Type_IsSealed/CPP/type_issealed.cpp | 21 + .../CPP/type_isserializable.cpp | 37 + .../Type_IsValueType/CPP/type_isvaluetype.cpp | 24 + .../Type_ToString/CPP/type_tostring.cpp | 31 + .../Type_TypeHandle/CPP/type_typehandle.cpp | 42 + .../UInt16 Example/CPP/source.cpp | 631 +++++++ .../UInt16_Equals/CPP/uint16_equals.cpp | 34 + .../UInt32 Example/CPP/source.cpp | 417 +++++ .../UInt32_Equals/CPP/uint32_equals.cpp | 34 + .../UInt64 Example/CPP/source.cpp | 405 ++++ .../UInt64_Equals/CPP/uint64_equals.cpp | 23 + .../CPP/uninstallaction_noaction_remove_3.cpp | 95 + .../UnmanagedMarshalObsolete/cpp/source.cpp | 63 + .../Uri_IsHexDigit/CPP/uri_ishexdigit.cpp | 43 + .../ValueType.Equals Example/CPP/source.cpp | 28 + .../WaitHandle/cpp/WaitHandle.cpp | 71 + .../CPP/source.cpp | 93 + .../CPP/example.cpp | 25 + .../CPP/example.cpp | 18 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 26 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 26 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 26 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 26 + .../CPP/example.cpp | 21 + .../CPP/example.cpp | 27 + .../CPP/sample.cpp | 173 ++ .../XMLDSIG Signing/CPP/source.cpp | 57 + .../XMLDSIG Verification/CPP/source.cpp | 36 + .../adproperties/CPP/adproperties.cpp | 67 + .../VS_Snippets_CLR/capikey/CPP/capikey.cpp | 22 + .../VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp | 57 + .../char.surrogate/CPP/sur.cpp | 85 + .../VS_Snippets_CLR/console.beep/CPP/beep.cpp | 42 + .../VS_Snippets_CLR/console.beep2/CPP/b2.cpp | 124 ++ .../console.bufferHW/CPP/hw.cpp | 18 + .../console.cancelkeypress/cpp/ckp.cpp | 74 + .../console.cursorLTS/CPP/lts.cpp | 75 + .../console.cursorsize/CPP/csize.cpp | 45 + .../console.cursorvis/CPP/vis.cpp | 75 + .../console.keyavailable/CPP/ka.cpp | 40 + .../VS_Snippets_CLR/console.read/CPP/read.cpp | 82 + .../console.readkey1/CPP/rk.cpp | 37 + .../console.readkey2/CPP/rkbool.cpp | 35 + .../console.setwindowsize/CPP/sws.cpp | 55 + .../console.title/CPP/mytitle.cpp | 26 + .../console.windowLT/CPP/wlt.cpp | 135 ++ .../console.writelineFmt1/cpp/wl.cpp | 102 + .../consolein/CPP/consolein.cpp | 15 + .../convert.tobase64chararray/CPP/tb64ca.cpp | 100 + .../convert.tobase64string/CPP/tb64s.cpp | 113 ++ .../CPP/convertchangetype.cpp | 14 + .../cpp/encrypteddata.cpp | 61 + .../CPP/example.cpp | 71 + .../CPP/encrypteddata.cpp | 55 + .../datetime.ctor_Int64/CPP/ticks.cpp | 39 + .../CPP/directoryinfocreatesub.cpp | 28 + .../CPP/directoryinfodelete.cpp | 29 + .../CPP/directoryinfogetdirectories.cpp | 23 + .../CPP/directoryinfomoveto.cpp | 44 + .../CPP/directoryinfoparent.cpp | 27 + .../enum.tostring/CPP/tostr.cpp | 47 + .../enumcompareto/CPP/EnumCompareTo.cpp | 31 + .../enumequals/CPP/EnumEquals.cpp | 44 + .../enumformat/CPP/EnumFormat.cpp | 20 + .../enumgetname/CPP/EnumGetName.cpp | 22 + .../enumgetnames/CPP/EnumGetNames.cpp | 49 + .../enumgetvalues/CPP/EnumGetValues.cpp | 48 + .../enumparse/CPP/EnumParse.cpp | 42 + .../CPP/commandline.cpp | 19 + .../CPP/expandenvironmentvariables.cpp | 23 + .../environment.class/CPP/env0.cpp | 104 + .../environment.processorcount/CPP/pc.cpp | 16 + .../CPP/source.cpp | 73 + .../eventlog_WriteEvent/CPP/source.cpp | 277 +++ .../eventsoverview/cpp/programwithdata.cpp | 67 + .../exception.data/CPP/data.cpp | 89 + .../CPP/fileinfoappendtext.cpp | 29 + .../fileinfocopyto/CPP/fileinfocopyto.cpp | 43 + .../fileinfodelete/CPP/fileinfodelete.cpp | 21 + .../CPP/fileinfodirectory.cpp | 35 + .../fileinfomain/CPP/fileinfomain.cpp | 28 + .../fileinfoname/CPP/fileinfoname.cpp | 31 + .../fileinfoopen/CPP/fileinfoopen.cpp | 40 + .../generic.ReadOnlyCollection/cpp/source.cpp | 92 + .../VS_Snippets_CLR/math.atanx/CPP/atan.cpp | 47 + .../math.bigmul/CPP/bigmul.cpp | 22 + .../cpp/VS_Snippets_CLR/math.max/CPP/max.cpp | 59 + .../cpp/VS_Snippets_CLR/math.min/CPP/min.cpp | 59 + .../VS_Snippets_CLR/math.sign/CPP/sign.cpp | 59 + .../pathcombine/CPP/pathcombine.cpp | 40 + .../platformID.class/CPP/pid.cpp | 39 + .../CPP/datareceivedevent.cpp | 55 + .../process_asyncstreams/CPP/net_async.cpp | 227 +++ .../process_asyncstreams/CPP/nmake_async.cpp | 258 +++ .../process_asyncstreams/CPP/sort_async.cpp | 136 ++ .../process_refresh/CPP/process_refresh.cpp | 60 + .../process_sample/CPP/process_sample.cpp | 73 + .../cpp/snippet8.cpp | 52 + .../VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp | 96 + .../string.LastIndexOf7/CPP/lastixof7.cpp | 39 + .../string.LastIndexOf8/CPP/lastixof8.cpp | 44 + .../string.LastIndexOfAny1/CPP/lastixany1.cpp | 38 + .../string.LastIndexOfAny2/CPP/lastixany2.cpp | 38 + .../string.LastIndexOfAny3/CPP/lastixany3.cpp | 38 + .../string.ToCharArray1/CPP/tocharry1.cpp | 32 + .../string.comp4/CPP/string.comp4.cpp | 34 + .../string.compare3/CPP/comp3.cpp | 28 + .../string.compare4/CPP/comp4.cpp | 40 + .../string.compare5/CPP/comp5.cpp | 41 + .../string.compareordinal/CPP/comp0.cpp | 28 + .../string.concat5/CPP/string.concat5.cpp | 33 + .../string.contains/CPP/cont.cpp | 21 + .../string.equals/CPP/equals.cpp | 55 + .../string.gettypecode/CPP/gtc.cpp | 16 + .../string.indexof1/CPP/ixof1.cpp | 42 + .../string.indexof8/CPP/ixof8.cpp | 49 + .../string.indexofany2/CPP/ixany2.cpp | 38 + .../string.indexofany3/CPP/ixany3.cpp | 40 + .../string.intern/CPP/string_intern.cpp | 26 + .../string.isNullOrEmpty/CPP/inoe.cpp | 25 + .../string.isinterned/CPP/isin.cpp | 45 + .../string.join2/CPP/join2.cpp | 22 + .../string.lastindexof1/CPP/lastixof1.cpp | 37 + .../string.lastindexof2/CPP/lastixof2.cpp | 44 + .../string.length/CPP/length.cpp | 20 + .../string.normalize/CPP/norm.cpp | 117 ++ .../VS_Snippets_CLR/string.remove/CPP/r.cpp | 25 + .../string.replace1/CPP/string.replace1.cpp | 16 + .../string.split3/CPP/omit.cpp | 76 + .../string.tolower1/CPP/tolower.cpp | 75 + .../string.tostring/CPP/string.tostring.cpp | 26 + .../stringbuilder.appendformat/CPP/appfmt.cpp | 46 + .../stringbuilder.appendline/CPP/al.cpp | 49 + .../stringbuilder.copyto2/CPP/ct2.cpp | 43 + .../stringbuilder.ensurecapacity/CPP/cap.cpp | 61 + .../stringbuilder.insert/CPP/insert.cpp | 118 ++ .../stringbuilder.remove/CPP/remove.cpp | 43 + .../stringbuilder.replace/CPP/replace.cpp | 67 + .../stringconcat3/CPP/stringconcat3.cpp | 22 + .../stringconcat4/CPP/stringconcat4.cpp | 23 + .../stringcopyto/CPP/stringcopyto.cpp | 31 + .../stringendswith/CPP/stringendswith.cpp | 76 + .../stringexample1/CPP/source.cpp | 80 + .../stringindexof4/CPP/stringindexof4.cpp | 38 + .../stringinsert/CPP/stringinsert.cpp | 30 + .../stringjoin/CPP/stringjoin.cpp | 24 + .../stringlowerupper/CPP/stringtolower.cpp | 53 + .../stringremove/CPP/stringremove.cpp | 21 + .../stringreplace/CPP/stringreplace.cpp | 22 + .../stringstartswith/CPP/stringstartswith.cpp | 61 + .../sys.glob.NFI.nativeDigits/cpp/nd.cpp | 31 + .../sys.glob.calendartype/CPP/caltype.cpp | 34 + .../sys.glob.carib1/CPP/carib.cpp | 71 + .../sys.glob.ci.getCFUIC/cpp/cfuic.cpp | 20 + .../cpp/rgn5props.cpp | 31 + .../sys.txt.fallbackDecExc/cpp/fallDecExc.cpp | 141 ++ .../sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp | 115 ++ .../sys.txt.fallbackEncExc/cpp/fallEncExc.cpp | 96 + .../sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp | 106 ++ .../thread.sleep/cpp/example.cpp | 25 + .../thread.sleep_timespan/cpp/example.cpp | 27 + .../type_getevent1/CPP/type_getevent1.cpp | 44 + .../type_getevents1/CPP/type_getevents1.cpp | 38 + .../type_getevents2/CPP/type_getevents2.cpp | 41 + .../x509chaintest/CPP/remarks.cpp | 26 + .../x509chaintest/CPP/x509chaintest.cpp | 73 + .../x509store2/CPP/x509store2.cpp | 79 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 75 + .../classic Array Example/CPP/source.cpp | 74 + .../classic Array Example/CPP/source3.cpp | 68 + .../CPP/source.cpp | 80 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 67 + .../CPP/source2.cpp | 61 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 77 + .../CPP/source.cpp | 63 + .../CPP/source.cpp | 51 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 61 + .../CPP/source.cpp | 61 + .../classic ArrayList Example/CPP/source.cpp | 44 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 58 + .../CPP/source2.cpp | 67 + .../CPP/source.cpp | 86 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 76 + .../CPP/source.cpp | 91 + .../CPP/source.cpp | 127 ++ .../CPP/source.cpp | 31 + .../CPP/source2.cpp | 35 + .../CPP/source.cpp | 76 + .../CPP/source.cpp | 91 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 61 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 32 + .../classic BitArray Example/CPP/source.cpp | 119 ++ .../classic BitArray Example/CPP/source2.cpp | 37 + .../CPP/source.cpp | 98 + .../CPP/source.cpp | 104 + .../CPP/source.cpp | 78 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 98 + .../CPP/source.cpp | 99 + .../CPP/remarks.cpp | 30 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 13 + .../CPP/source.cpp | 16 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 8 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 80 + .../CPP/source.cpp | 46 + .../classic DES Example/CPP/source.cpp | 46 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 109 ++ .../classic Debug Example/CPP/source.cpp | 24 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 29 + .../classic Debug.Fail Example/CPP/source.cpp | 57 + .../CPP/source.cpp | 59 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 25 + .../classic Decoder Example/CPP/source.cpp | 29 + .../classic Delegate Example/CPP/source.cpp | 63 + .../CPP/source.cpp | 12 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 16 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 59 + .../CPP/source.cpp | 62 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 50 + .../CPP/source.cpp | 83 + .../CPP/source.cpp | 78 + .../CPP/source.cpp | 87 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 28 + .../classic FileAccess Example/CPP/source.cpp | 13 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 13 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 11 + .../classic Hash.SHA1 Example/CPP/source.cpp | 22 + .../CPP/source.cpp | 22 + .../classic Hashtable Example/CPP/source2.cpp | 76 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 65 + .../CPP/source.cpp | 65 + .../CPP/source.cpp | 63 + .../CPP/remarks.cpp | 40 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 14 + .../CPP/source.cpp | 28 + .../classic Math.Round Example/CPP/source.cpp | 12 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 73 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 91 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 161 ++ .../CPP/source.cpp | 85 + .../CPP/source.cpp | 92 + .../CPP/source.cpp | 59 + .../CPP/source.cpp | 92 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 67 + .../classic Queue Example/CPP/source.cpp | 41 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 66 + .../CPP/source.cpp | 32 + .../CPP/source2.cpp | 35 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 78 + .../CPP/source.cpp | 20 + .../classic SHA256 Example/CPP/source.cpp | 76 + .../classic SHA384 Example/CPP/source.cpp | 23 + .../CPP/source.cpp | 24 + .../classic SHA512 Example/CPP/source.cpp | 23 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 57 + .../CPP/remarks.cpp | 27 + .../classic SortedList Example/CPP/source.cpp | 53 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 106 ++ .../CPP/source.cpp | 63 + .../CPP/source.cpp | 59 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 33 + .../CPP/source2.cpp | 35 + .../CPP/source.cpp | 89 + .../CPP/source.cpp | 62 + .../classic Stack Example/CPP/source.cpp | 41 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 32 + .../CPP/source2.cpp | 35 + .../classic Stack.Peek Example/CPP/source.cpp | 65 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 13 + .../CPP/source.cpp | 16 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 19 + .../classic Switch Example/CPP/remarks.cpp | 30 + .../classic Switch Example/CPP/source.cpp | 127 ++ .../CPP/source.cpp | 27 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 18 + .../classic Timer Example/CPP/source.cpp | 73 + .../CPP/source.cpp | 53 + .../classic Trace Example/CPP/source.cpp | 23 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../classic Trace.Fail Example/CPP/source.cpp | 56 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 42 + .../CPP/remarks.cpp | 33 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 78 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 26 + .../CPP/source1.cpp | 26 + .../CPP/source2.cpp | 25 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 15 + .../cpp/source.cpp | 64 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/class1.cpp | 317 ++++ .../CPP/cfromchar.cpp | 26 + .../CPP/cfromdouble.cpp | 66 + .../CPP/cfromsingle.cpp | 66 + .../CPP/cfromint16.cpp | 23 + .../CPP/cfromint32.cpp | 23 + .../CPP/cfromint64.cpp | 24 + .../CPP/cfromsbyte.cpp | 23 + .../CPP/cfrombyte.cpp | 23 + .../CPP/cfromuint16.cpp | 23 + .../CPP/cfromuint32.cpp | 24 + .../CPP/cfromuint64.cpp | 24 + .../System.Decimal.ConvTo/CPP/ctos_byte.cpp | 43 + .../System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp | 31 + .../System.Decimal.ConvTo/CPP/ctou_int16.cpp | 88 + .../System.Decimal.ConvTo/CPP/ctou_int32.cpp | 88 + .../System.Decimal.ConvTo/CPP/ctou_int64.cpp | 88 + .../System.IntPtr.ToPointer/cpp/topointer.cpp | 55 + .../cpp/source.cpp | 54 + .../CPP/class1.cpp | 153 ++ .../cpp/Substring10.cpp | 35 + .../system.Action/cpp/action.cpp | 42 + .../system.Action~1/cpp/action`1.cpp | 36 + .../system.Action~1/cpp/delegate.cpp | 34 + .../System.AppDomain.IsDefaultAppDomain.cpp | 34 + .../CPP/arrayasreadonly.cpp | 116 ++ .../system.Array.Clone/CPP/arrayclone.cpp | 73 + .../CPP/System.Array.Resize.cpp | 83 + .../system.Array.Sort/CPP/arraysort.cpp | 119 ++ .../system.Array.Sort2/CPP/arraysort2.cpp | 109 ++ .../system.Array.SyncRoot/cpp/source.cpp | 22 + .../system.ArraySegment/CPP/arraysegment.cpp | 126 ++ .../system.ArrayTypeMismatch/CPP/class1.cpp | 68 + .../CPP/array_getenumerator.cpp | 42 + .../CPP/array_getsetvalue.cpp | 47 + .../system.Attribute.Equals/CPP/equals.cpp | 124 ++ .../CPP/getcustattrparam.cpp | 130 ++ .../CPP/getcustattrprminh.cpp | 152 ++ .../system.Attribute.TypeId/CPP/typeid.cpp | 136 ++ .../system.BitConverter.Class/CPP/bitconv.cpp | 44 + .../CPP/littleend.cpp | 19 + .../CPP/bitstodbl.cpp | 67 + .../CPP/dbltobits.cpp | 71 + .../CPP/bytesbool.cpp | 23 + .../CPP/byteschar.cpp | 46 + .../CPP/bytesdouble.cpp | 64 + .../CPP/bytessingle.cpp | 64 + .../CPP/bytesint16.cpp | 32 + .../CPP/bytesint32.cpp | 34 + .../CPP/bytesint64.cpp | 42 + .../CPP/bytesuint16.cpp | 42 + .../CPP/bytesuint32.cpp | 44 + .../CPP/bytesuint64.cpp | 48 + .../CPP/batostring.cpp | 51 + .../CPP/batostringii.cpp | 65 + .../CPP/batobool.cpp | 30 + .../CPP/batochar.cpp | 59 + .../CPP/batodouble.cpp | 96 + .../CPP/batosingle.cpp | 93 + .../CPP/batoint16.cpp | 55 + .../CPP/batoint64.cpp | 85 + .../CPP/batouint16.cpp | 54 + .../CPP/batouint32.cpp | 56 + .../CPP/batouint64.cpp | 78 + .../system.Boolean/CPP/booleanmembers.cpp | 26 + .../system.Buffer.BlockCopy/CPP/bcopy.cpp | 137 ++ .../system.Buffer.BlockCopy/CPP/buffer.cpp | 62 + .../system.Buffer.BlockCopy/CPP/overlap1.cpp | 37 + .../system.Buffer.Bytes/CPP/bytelength.cpp | 52 + .../system.Buffer.Bytes/CPP/getbyte.cpp | 83 + .../system.Buffer.Bytes/CPP/setbyte.cpp | 71 + .../system.Byte Examples/CPP/systembyte.cpp | 106 ++ .../system.Byte.Parse/cpp/parse.cpp | 162 ++ .../CPP/newbytemembers.cpp | 29 + .../CPP/newbytemembers2.cpp | 79 + .../system.Byte.TryParse/cpp/tryparse.cpp | 37 + .../system.Byte.TryParse/cpp/tryparse2.cpp | 75 + .../CPP/charstructure.cpp | 26 + .../system.Char.CompareTo/CPP/compareto.cpp | 13 + .../system.Char.Equals/CPP/equals.cpp | 12 + .../CPP/getnumericvalue.cpp | 11 + .../CPP/getunicodecategory.cpp | 13 + .../system.Char.IsControl/CPP/iscontrol1.cpp | 35 + .../system.Char.IsControl/CPP/iscontrol2.cpp | 22 + .../system.Char.IsDigit/CPP/isdigit.cpp | 11 + .../system.Char.IsLetter/CPP/isletter.cpp | 11 + .../CPP/isletterordigit.cpp | 11 + .../system.Char.IsLower/CPP/islower.cpp | 11 + .../system.Char.IsNumber/CPP/isnumber.cpp | 11 + .../CPP/ispunctuation.cpp | 11 + .../CPP/isseparator.cpp | 11 + .../CPP/isseparator1.cpp | 36 + .../CPP/issurrogate.cpp | 11 + .../system.Char.IsSymbol/CPP/issymbol.cpp | 11 + .../CPP/iswhitespace.cpp | 11 + .../system.Char.Parse/CPP/parse.cpp | 9 + .../system.Char.ToLower/CPP/tolower.cpp | 12 + .../system.Char.ToString/CPP/tostring.cpp | 11 + .../cpp/charenumerator1.cpp | 75 + .../CPP/source2.cpp | 39 + .../CPP/stringdictionary.cpp | 117 ++ .../CPP/stringdictionary_addremove.cpp | 65 + .../CPP/stringdictionary_contains.cpp | 67 + .../CPP/stringdictionary_enumeration.cpp | 90 + .../CPP/values.cpp | 38 + .../cpp/source.cpp | 94 + .../cpp/source2.cpp | 69 + .../CPP/arraylist_sort2.cpp | 98 + .../CPP/arraylist_sort3.cpp | 98 + .../CPP/arraylist_toarray.cpp | 80 + .../CPP/caseinsensitive.cpp | 55 + .../CPP/collectionbase.cpp | 183 ++ .../CPP/remarks.cpp | 118 ++ .../CPP/comparercultures.cpp | 36 + .../CPP/dictionarybase.cpp | 258 +++ .../CPP/source2.cpp | 171 ++ .../cpp/dictionaryentrysample.cpp | 46 + .../cpp/program.cpp | 62 + .../cpp/source2.cpp | 122 ++ .../CPP/llctor.cpp | 48 + .../cpp/llnctor.cpp | 87 + .../cpp/hashtable_example.cpp | 130 ++ .../cpp/remarks.cpp | 36 + .../CPP/hashtable_ctor.cpp | 110 ++ .../CPP/hashtable_ctordictionary.cpp | 95 + .../CPP/hashtable_ctordictionaryfloat.cpp | 93 + .../CPP/hashtable_ctorint.cpp | 97 + .../CPP/hashtable_ctorintfloat.cpp | 97 + .../CPP/readonlycollectionbase.cpp | 107 ++ .../CPP/source2.cpp | 80 + .../CPP/sortedlist_ctor.cpp | 116 ++ .../CPP/sortedlist_ctordictionary.cpp | 126 ++ .../CPP/sortedlist_ctorint.cpp | 139 ++ .../CPP/bitvector32_createmasks.cpp | 40 + .../CPP/bitvector32_equals.cpp | 78 + .../CPP/bitvector32_bitflags.cpp | 42 + .../CPP/bitvector32_sections.cpp | 68 + .../CPP/hybriddictionary.cpp | 222 +++ .../CPP/source2.cpp | 48 + .../CPP/hybriddictionary_addremove.cpp | 110 ++ .../CPP/hybriddictionary_contains.cpp | 87 + .../CPP/hybriddictionary_copyto.cpp | 109 ++ .../CPP/hybriddictionary_enumerator.cpp | 147 ++ .../cpp/iordereddictionary.cpp | 318 ++++ .../cpp/remarks.cpp | 297 +++ .../CPP/listdictionary.cpp | 151 ++ .../CPP/source2.cpp | 50 + .../CPP/listdictionary_addremove.cpp | 74 + .../CPP/listdictionary_contains.cpp | 63 + .../CPP/listdictionary_copyto.cpp | 73 + .../CPP/listdictionary_enumerator.cpp | 99 + .../CPP/nocb_baseadd.cpp | 65 + .../CPP/nocb_baseclear.cpp | 83 + .../CPP/nocb_baseget.cpp | 92 + .../CPP/nocb_basegetall.cpp | 124 ++ .../CPP/nocb_basehaskeys.cpp | 78 + .../CPP/nocb_baseremove.cpp | 98 + .../CPP/nocb_baseset.cpp | 108 ++ .../CPP/nocb_isreadonly.cpp | 91 + .../CPP/nameobjectcollectionbase.cpp | 192 ++ .../CPP/remarks.cpp | 130 ++ .../CPP/nvc.cpp | 101 + .../cpp/ordereddictionary1.cpp | 138 ++ .../cpp/source2.cpp | 26 + .../CPP/remarks.cpp | 39 + .../CPP/stringcollection.cpp | 182 ++ .../CPP/stringcollectionadd.cpp | 76 + .../CPP/stringcollectioncontains.cpp | 58 + .../CPP/stringcollectioncopyto.cpp | 73 + .../CPP/stringcollectionremove.cpp | 91 + .../CPP/stringdictionary_copyto.cpp | 56 + .../CPP/stringenumerator.cpp | 44 + .../CPP/inserttabs.cpp | 63 + .../system.Console-REFORMAT/CPP/reformat.cpp | 72 + .../CPP/decode.cpp | 20 + .../cpp/ReadLineSimple.cpp | 20 + .../system.Console.ReadLine/cpp/readline2.cpp | 28 + .../system.Console.SetError/cpp/seterror1.cpp | 32 + .../system.Console.WriteLine/CPP/newline1.cpp | 39 + .../CPP/writeline_boolean1.cpp | 22 + .../CPP/writeline_obj1.cpp | 18 + .../CPP/writeline_vararg.cpp | 43 + .../system.ConsoleKey/cpp/consolekey.cpp | 72 + .../cpp/consolekeyinfo.equals.cpp | 101 + .../cpp/hash.cpp | 85 + .../CPP/system.convert snippet.cpp | 593 ++++++ .../cpp/toint_str_int32.cpp | 45 + .../cpp/toboolean1.cpp | 37 + .../cpp/toboolean2.cpp | 303 +++ .../CPP/stringnonnum.cpp | 75 + .../CPP/toint16.cpp | 105 ++ .../CPP/tosbyte.cpp | 100 + .../CPP/nonnumeric.cpp | 94 + .../CPP/objectifp.cpp | 458 +++++ .../system.DateTime.Date/cpp/date1.cpp | 22 + .../system.DateTime.Minute etc/CPP/class1.cpp | 31 + .../cpp/datetime.tryparse1.cpp | 37 + .../CPP/comp_equal.cpp | 65 + .../CPP/cto_eq_obj.cpp | 88 + .../CPP/ctoriarr.cpp | 117 ++ .../CPP/ctoriiibby.cpp | 108 ++ .../system.Decimal.Ctor.Ints/CPP/ctori.cpp | 47 + .../system.Decimal.Ctor.Ints/CPP/ctorl.cpp | 47 + .../system.Decimal.Ctor.Ints/CPP/ctorui.cpp | 47 + .../system.Decimal.Ctor.Ints/CPP/ctorul.cpp | 47 + .../system.Decimal.Ctor.Reals/CPP/ctordo.cpp | 73 + .../system.Decimal.Ctor.Reals/CPP/ctors.cpp | 73 + .../system.Decimal.Fields/CPP/fields.cpp | 46 + .../CPP/floor_neg_trunc.cpp | 66 + .../CPP/getbits.cpp | 56 + .../CPP/gettypecode.cpp | 25 + .../CPP/mul_div_rem.cpp | 76 + .../CPP/fromoacurrency.cpp | 59 + .../CPP/tooacurrency.cpp | 82 + .../system.Decimal.ToXXX/CPP/tosgl_dbl.cpp | 60 + .../cpp/correlationmanager.cpp | 51 + .../cpp/program.cpp | 105 ++ .../CPP/eventschematracelistener.cpp | 99 + .../CPP/instdatacopyto.cpp | 187 ++ .../cpp/perfcountercatgetcount.cpp | 91 + .../cpp/perfcountercatgetinst.cpp | 84 + .../cpp/perfcountergetcat.cpp | 72 + .../CPP/tracesource2.cpp | 143 ++ .../system.Double.ToString/cpp/tostring1.cpp | 63 + .../system.Double.ToString/cpp/tostring3.cpp | 223 +++ .../system.Double/CPP/doublesample.cpp | 150 ++ .../system.Environment/CPP/Vars1.cpp | 24 + .../system.Exception.Ctor/CPP/new.cpp | 108 ++ .../system.Exception.Ctor/CPP/news.cpp | 116 ++ .../system.Exception.Ctor/CPP/newsi.cpp | 109 ++ .../CPP/getbaseexc.cpp | 137 ++ .../CPP/getobjdata.cpp | 149 ++ .../system.Exception.HResult/CPP/hresult.cpp | 70 + .../CPP/exception_properties.vcxproj | 123 ++ .../CPP/properties.cpp | 121 ++ .../system.FlagsAttribute/CPP/flags.cpp | 79 + .../system.FlagsAttribute/CPP/flags1.cpp | 75 + .../system.Func~2/cpp/Example.cpp | 44 + .../system.GC.Collect Example/CPP/class1.cpp | 31 + .../CPP/systemgcgetgenerationweak.cpp | 72 + .../CPP/gckeepalive.cpp | 108 ++ .../CPP/class1.cpp | 64 + .../CPP/class1.cpp | 70 + .../CPP/yslin_calendar_getweekofyear.cpp | 37 + .../CPP/calendar.cpp | 77 + .../CPP/calendar_compare.cpp | 125 ++ .../CPP/charunicodeinfo_char.cpp | 54 + .../CPP/charunicodeinfo_string.cpp | 41 + .../CPP/comparestrintintstrintint.cpp | 41 + .../CPP/comparestrintintstrintintopt.cpp | 40 + .../CPP/comparestrintstrint.cpp | 42 + .../CPP/comparestrintstrintopt.cpp | 39 + .../CPP/comparestrstr.cpp | 41 + .../CPP/comparestrstropt.cpp | 39 + .../CPP/indexof.cpp | 118 ++ .../CPP/indexofint.cpp | 205 ++ .../CPP/indexofintint.cpp | 134 ++ .../CPP/isprefixsuffix.cpp | 35 + .../CPP/isprefixsuffixopt.cpp | 42 + .../CPP/yslin_cultureinfo_clone.cpp | 37 + .../CPP/currentculture.cpp | 28 + .../CPP/getcultures.cpp | 45 + .../CPP/neutralculture.cpp | 44 + .../CPP/parentculture.cpp | 38 + .../CPP/yslin_cultureinfo_readonly.cpp | 35 + .../CPP/spanishspain.cpp | 63 + .../CPP/dtfi_fulldatetimepattern.cpp | 32 + .../CPP/dtfi_longdatepattern.cpp | 32 + .../CPP/dtfi_longtimepattern.cpp | 32 + .../CPP/dtfi_monthdaypattern.cpp | 32 + .../CPP/dtfi_rfc1123pattern.cpp | 32 + .../CPP/dtfi_shorttimepattern.cpp | 32 + .../CPP/dtfi_sortabledatetimepattern.cpp | 32 + .../dtfi_universalsortabledatetimepattern.cpp | 33 + .../CPP/dtfi_yearmonthpattern.cpp | 32 + .../CPP/gregoriancalendar_getdaysinmonth.cpp | 44 + .../CPP/gregoriancalendar_getdaysinyear.cpp | 43 + .../CPP/gregorian_getera.cpp | 64 + .../CPP/gregoriancalendar_getmonthsinyear.cpp | 43 + .../CPP/gregoriancalendar_isleapday.cpp | 55 + .../CPP/gregoriancalendar_isleapmonth.cpp | 36 + .../CPP/gregoriancalendar_isleapyear.cpp | 43 + .../CPP/gregorianlocalized.cpp | 40 + .../CPP/gregoriancalendartypes.cpp | 44 + .../CPP/gregoriancalendar_addget.cpp | 59 + .../CPP/gregoriancalendar_minmax.cpp | 29 + .../CPP/hebrewcalendar_getdaysinmonth.cpp | 44 + .../CPP/hebrewcalendar_getmonthsinyear.cpp | 43 + .../CPP/hebrewcalendar_isleapday.cpp | 55 + .../CPP/hebrewcalendar_isleapmonth.cpp | 36 + .../CPP/hebrewcalendar_isleapyear.cpp | 43 + .../CPP/hebrewcalendar_addget.cpp | 59 + .../CPP/hebrewcalendar_getdaysinyear.cpp | 43 + .../CPP/hebrewcalendar_minmax.cpp | 34 + .../CPP/hijricalendar_getdaysinmonth.cpp | 45 + .../CPP/hijricalendar_getdaysinyear.cpp | 44 + .../CPP/hijricalendar_getmonthsinyear.cpp | 44 + .../CPP/hijriadjustment.cpp | 53 + .../CPP/hijricalendar_isleapday.cpp | 55 + .../CPP/hijricalendar_isleapmonth.cpp | 36 + .../CPP/hijricalendar_isleapyear.cpp | 43 + .../CPP/hijricalendar_addget.cpp | 59 + .../CPP/hijricalendar_minmax.cpp | 34 + .../CPP/yslin_japanesecalendar_eras.cpp | 29 + .../CPP/japanesecalendar_getdaysinmonth.cpp | 47 + .../CPP/japanesecalendar_getdaysinyear.cpp | 46 + .../CPP/japanesecalendar_getmonthsinyear.cpp | 30 + .../CPP/japanesecalendar_isleapday.cpp | 52 + .../CPP/japanesecalendar_isleapmonth.cpp | 36 + .../CPP/japanesecalendar_isleapyear.cpp | 41 + .../CPP/japanesecalendar_addget.cpp | 59 + .../CPP/japanesecalendar_minmax.cpp | 34 + .../CPP/juliancalendar_getdaysinmonth.cpp | 44 + .../CPP/juliancalendar_getdaysinyear.cpp | 43 + .../CPP/juliancalendar_getmonthsinyear.cpp | 43 + .../CPP/juliancalendar_isleapday.cpp | 55 + .../CPP/juliancalendar_isleapmonth.cpp | 36 + .../CPP/juliancalendar_isleapyear.cpp | 43 + .../CPP/juliancalendar_addget.cpp | 59 + .../CPP/juliancalendar_minmax.cpp | 34 + .../CPP/koreancalendar_getdaysinmonth.cpp | 44 + .../CPP/koreancalendar_getdaysinyear.cpp | 43 + .../CPP/koreancalendar_getmonthsinyear.cpp | 43 + .../CPP/koreancalendar_isleapday.cpp | 55 + .../CPP/koreancalendar_isleapmonth.cpp | 35 + .../CPP/koreancalendar_isleapyear.cpp | 43 + .../CPP/koreancalendar_addget.cpp | 59 + .../CPP/koreancalendar_minmax.cpp | 35 + .../CPP/invariantinfo.cpp | 82 + .../CPP/regioninfo_ctorculturename.cpp | 112 ++ .../CPP/regioninfo.cpp | 46 + .../CPP/regioninfo_equals.cpp | 28 + .../CPP/regioninfo_properties.cpp | 36 + .../CPP/sortkey_compare.cpp | 36 + .../CPP/sortkey_equals.cpp | 80 + .../CPP/taiwancalendar_getdaysinmonth.cpp | 44 + .../CPP/taiwancalendar_getdaysinyear.cpp | 43 + .../CPP/taiwancalendar_getmonthsinyear.cpp | 43 + .../CPP/taiwancalendar_isleapday.cpp | 54 + .../CPP/taiwancalendar_isleapmonth.cpp | 35 + .../CPP/taiwancalendar_isleapyear.cpp | 43 + .../CPP/taiwancalendar_addget.cpp | 59 + .../CPP/taiwancalendar_minmax.cpp | 35 + .../CPP/tee_summary.cpp | 36 + .../CPP/textinfo_casing.cpp | 34 + .../thaibuddhistcalendar_getdaysinmonth.cpp | 44 + .../thaibuddhistcalendar_getdaysinyear.cpp | 43 + .../thaibuddhistcalendar_getmonthsinyear.cpp | 43 + .../CPP/thaibuddhistcalendar_isleapday.cpp | 55 + .../CPP/thaibuddhistcalendar_isleapmonth.cpp | 35 + .../CPP/thaibuddhistcalendar_isleapyear.cpp | 43 + .../CPP/thaibuddhistcalendar_addget.cpp | 59 + .../CPP/thaibuddhistcalendar_minmax.cpp | 34 + .../system.IConvertible/CPP/iconvertible.cpp | 144 ++ .../CPP/idisposabledispose.cpp | 80 + .../CPP/rwbyte.cpp | 48 + .../CPP/rwbytes.cpp | 44 + .../CPP/rwchar.cpp | 38 + .../CPP/rwreadchar.cpp | 38 + .../CPP/rwchars.cpp | 27 + .../CPP/rwreadchars.cpp | 30 + .../CPP/rwdouble.cpp | 66 + .../CPP/source3.cpp | 100 + .../system.IO.BufferedStream1/CPP/client.cpp | 168 ++ .../system.IO.BufferedStream2/CPP/server.cpp | 91 + .../system.IO.Directory/CPP/class1.cpp | 163 ++ .../cpp/searchoption.cpp | 44 + .../system.IO.DirectoryRoot/CPP/example.cpp | 34 + .../system.IO.FileStream1/CPP/source.cpp | 46 + .../system.IO.FileStream2/CPP/source.cpp | 156 ++ .../system.IO.FileStream3/CPP/fstreamlock.cpp | 144 ++ .../CPP/remarks.cpp | 61 + .../CPP/source.cpp | 422 +++++ .../system.IO.MemoryStream/CPP/memstream.cpp | 74 + .../CPP/pathmembers.cpp | 307 +++ .../cpp/program.cpp | 51 + .../cpp/program.cpp | 65 + .../cpp/program.cpp | 160 ++ .../cpp/datareceived.cpp | 49 + .../cpp/serialport.cpp | 207 ++ .../CPP/streamreadersample.cpp | 177 ++ .../system.IO.StreamWriter/CPP/logger.cpp | 201 ++ .../CPP/stringrw.cpp | 76 + .../CPP/strwriter1.cpp | 30 + .../CPP/strwriter2.cpp | 18 + .../CPP/strwriter3.cpp | 24 + .../system.IO.TextReaderWriter/CPP/textrw.cpp | 46 + .../system.IO.UTCExample/CPP/example.cpp | 54 + .../system.Int16.MaxValue/cpp/minvalue.cpp | 30 + .../system.Int16.Parse/cpp/parse1.cpp | 54 + .../system.Int16.Parse/cpp/parse2.cpp | 87 + .../system.Int16.Parse/cpp/parse3.cpp | 62 + .../system.Int16.Parse/cpp/parse4.cpp | 66 + .../system.Int32.Parse/cpp/parse1.cpp | 40 + .../system.Int32.Parse/cpp/parse2.cpp | 50 + .../system.Int32.Parse/cpp/parse3.cpp | 61 + .../system.Int32.ToString/cpp/ToString1.cpp | 26 + .../system.Int32.ToString/cpp/ToString2.cpp | 22 + .../system.Int32.ToString/cpp/ToString3.cpp | 56 + .../system.Int32.ToString/cpp/ToString4.cpp | 60 + .../cpp/int32.tryparse1.cpp | 43 + .../cpp/int32.tryparse2.cpp | 100 + .../system.Math.E/CPP/efield.cpp | 66 + .../system.Math.Exp/CPP/exp.cpp | 96 + .../system.Math.Log_Overloads/CPP/loggen.cpp | 66 + .../system.Math.SinCos/CPP/sincos.cpp | 120 ++ .../system.Math.SinhCosh/CPP/sinhcosh.cpp | 115 ++ .../system.Math.Tanh/CPP/tanh.cpp | 87 + .../cpp/equals.cpp | 76 + .../cpp/equals2.cpp | 43 + .../CPP/clone.cpp | 56 + .../CPP/ctor_tostr.cpp | 60 + .../CPP/plat_ver.cpp | 64 + .../system.Random.Ctor/CPP/ctor.cpp | 95 + .../system.Random.Next/CPP/next.cpp | 99 + .../system.Random.Next/CPP/next1.cpp | 27 + .../system.Random.Next/CPP/next2.cpp | 47 + .../system.Random.Next/CPP/next3.cpp | 35 + .../system.Random.Next/CPP/next4.cpp | 27 + .../system.Random.Sample/cpp/sampleex.cpp | 149 ++ .../system.Random/cpp/random2.cpp | 54 + .../CPP/source.cpp | 56 + .../CPP/GetAssembly1.cpp | 19 + .../CPP/assembly.cpp | 182 ++ .../CPP/codebase1.cpp | 16 + .../CPP/getcallingassembly1.cpp | 18 + .../CPP/source.cpp | 137 ++ .../CPP/source.cpp | 65 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 236 +++ .../CPP/source.cpp | 150 ++ .../CPP/source.cpp | 118 ++ .../CPP/source.cpp | 89 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 116 ++ .../CPP/source.cpp | 159 ++ .../CPP/source.cpp | 81 + .../CPP/source.cpp | 105 ++ .../CPP/source.cpp | 33 + .../CPP/source3.cpp | 34 + .../CPP/source4.cpp | 29 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 28 + .../CPP/source2.cpp | 28 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 90 + .../CPP/source.cpp | 107 ++ .../CPP/nestedenum.cpp | 121 ++ .../cpp/source.cpp | 32 + .../cpp/hide.cpp | 90 + .../CPP/class1.cpp | 17 + .../CPP/class1.cpp | 30 + .../CPP/class1.cpp | 32 + .../CPP/class1.cpp | 16 + .../CPP/class1.cpp | 51 + .../CPP/class1.cpp | 52 + .../CPP/class1.cpp | 25 + .../CPP/class1.cpp | 25 + .../CPP/class1.cpp | 25 + .../CPP/class1.cpp | 44 + .../CPP/class1.cpp | 16 + .../CPP/class1.cpp | 16 + .../CPP/resxresourcereader.cpp | 30 + .../CPP/useresxdatanodes.cpp | 112 ++ .../CPP/getenumerator.cpp | 22 + .../CPP/getenumerator.cpp | 22 + .../CPP/resourcewritercstr1.cpp | 24 + .../CPP/resourcewriterdispose.cpp | 24 + .../CPP/resourcewritergenerate.cpp | 25 + .../cpp/sample.cpp | 18 + .../cpp/sample.cpp | 26 + .../CPP/convert1.cpp | 52 + .../CPP/marshalas.sizeparamindex.cpp | 31 + .../CPP/convert2.cpp | 49 + .../AllowPartiallyTrustedCallersAttribute.cpp | 150 ++ .../cpp/customcrypto.cpp | 320 ++++ .../cpp/customcryptoimpl.cpp | 129 ++ .../CPP/members.cpp | 199 ++ .../CPP/members.cpp | 71 + .../CPP/cryptographicexceptionmembers.cpp | 243 +++ .../CPP/sample.cpp | 50 + .../CPP/sample.cpp | 36 + .../CPP/class1.cpp | 56 + .../CPP/members.cpp | 110 ++ .../CPP/contosokeyedhash.cpp | 80 + .../CPP/maskgenerator.cpp | 114 ++ .../CPP/sample.cpp | 52 + .../CPP/sample.cpp | 25 + .../CPP/sample.cpp | 33 + .../CPP/sample.cpp | 106 ++ .../CPP/rsaencoder.cpp | 213 +++ .../CPP/members.cpp | 129 ++ .../CPP/xmldsigdetach.cpp | 132 ++ .../CPP/xmldsigenv.cpp | 171 ++ .../CPP/exampledetached.cpp | 132 ++ .../CPP/exampleenvelope.cpp | 174 ++ .../CPP/examplecreatedetached.cpp | 100 + .../CPP/examplecreateenvelope.cpp | 135 ++ .../CPP/exampleenvelope.cpp | 170 ++ .../CPP/example.cpp | 172 ++ .../CPP/exampledetached.cpp | 124 ++ .../CPP/exampleenvelope.cpp | 159 ++ .../CPP/xmldsigdetachedkeyedhashalg.cpp | 117 ++ .../CPP/xmldsigenvkeyedhashalg.cpp | 160 ++ .../CPP/sampledetached.cpp | 134 ++ .../CPP/sampleenvelope.cpp | 168 ++ .../CPP/members.cpp | 219 +++ .../CPP/members.cpp | 334 ++++ .../cpp/members.cpp | 290 +++ .../CPP/members.cpp | 261 +++ .../CPP/permissionset.cpp | 164 ++ .../CPP/nameidpermissionattribute.cpp | 59 + .../CPP/dataprotect.cpp | 234 +++ .../CPP/fileiopermission.cpp | 534 ++++++ .../CPP/remarks.cpp | 95 + .../CPP/fileiopermissionattribute.cpp | 102 + .../CPP/gacidentitypermission.cpp | 260 +++ .../CPP/gacidentitypermissionattribute.cpp | 51 + .../CPP/hostprotectionattribute.cpp | 243 +++ .../CPP/keycontainerpermission.cpp | 296 +++ .../CPP/nameidpermission.cpp | 280 +++ .../CPP/publisheridentitypermission.cpp | 166 ++ .../CPP/securitypermissionattribute.cpp | 457 +++++ .../CPP/storepermission.cpp | 143 ++ .../CPP/strongnameidentity.cpp | 244 +++ .../CPP/uipermission.cpp | 178 ++ .../CPP/urlidentity.cpp | 121 ++ .../CPP/evidence_evidence.cpp | 220 +++ .../CPP/members.cpp | 314 ++++ .../CPP/members.cpp | 359 ++++ .../system.Security.Policy.Gac/CPP/gac.cpp | 39 + .../CPP/gacmembershipcondition.cpp | 227 +++ .../CPP/members.cpp | 224 +++ .../CPP/genericidentitymembers.cpp | 81 + .../CPP/genericprincipalmembers.cpp | 98 + .../CPP/source.cpp | 41 + .../CPP/windowsidentitymembers.cpp | 220 +++ .../cpp/Ctor2.cpp | 25 + .../cpp/Ctor3.cpp | 25 + .../CPP/form1.cpp | 243 +++ .../CPP/policylevel.cpp | 272 +++ .../system.Single/CPP/singlesample.cpp | 163 ++ .../cpp/system.string.class.cpp | 10 + .../system.String.Compare/cpp/compare02.cpp | 30 + .../system.String.Compare/cpp/example.cpp | 65 + .../system.String.Compare/cpp/remarks.cpp | 197 ++ .../system.String.CompareCmp/cpp/cmpcmp.cpp | 140 ++ .../system.String.EndsWithCmp/cpp/ewcmp.cpp | 83 + .../system.String.Equality/CPP/equalityop.cpp | 28 + .../system.String.Format/cpp/format4.cpp | 24 + .../system.String.Format/cpp/format5.cpp | 33 + .../system.String.Format/cpp/format7.cpp | 41 + .../cpp/format_paramarray1.cpp | 48 + .../cpp/formatexample2.cpp | 77 + .../cpp/formatexample4.cpp | 32 + .../cpp/formatoverload1.cpp | 20 + .../cpp/formatoverload2.cpp | 41 + .../cpp/formatsyntax1.cpp | 16 + .../system.String.Format/cpp/interceptor2.cpp | 122 ++ .../system.String.Format/cpp/starting1.cpp | 80 + .../system.String.Format/cpp/starting2.cpp | 37 + .../CPP/getenumerator.cpp | 69 + .../CPP/gethashcode.cpp | 43 + .../system.String.IndexOf/CPP/indexof_c.cpp | 33 + .../system.String.IndexOf/CPP/indexofcii.cpp | 61 + .../system.String.IndexOf/CPP/simple1.cpp | 15 + .../CPP/inequalityop.cpp | 28 + .../system.String.ToUpper/cpp/ToUpperEx.cpp | 82 + .../system.String.Trim/cpp/trim1.cpp | 16 + .../system.String.Trim/cpp/trim2.cpp | 30 + .../system.StringComparer/cpp/omni.cpp | 139 ++ .../CPP/snippet.cpp | 67 + .../CPP/getbytecount-char[]-int32-int32.cpp | 18 + .../CPP/getbytecount-string.cpp | 13 + ...tbytes-string-int32-int32-byte[]-int32.cpp | 26 + ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 + .../CPP/getcharcount-byte[]-int32-int32.cpp | 13 + ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 + .../CPP/getmaxbytecount-int32.cpp | 13 + .../CPP/getmaxcharcount-int32.cpp | 13 + .../CPP/getstring-byte[].cpp | 29 + .../CPP/ctor.cpp | 12 + .../CPP/getcharcount-byte[]-int32-int32.cpp | 19 + ...tchars-byte[]-int32-int32-char[]-int32.cpp | 33 + .../CPP/ctor.cpp | 32 + .../CPP/snippet.cpp | 125 ++ .../CPP/getbytecount-char[]-int32-int32.cpp | 24 + ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 38 + .../CPP/ctor.cpp | 33 + .../CPP/ascii.cpp | 65 + .../CPP/bigendianunicode.cpp | 19 + .../CPP/codepage.cpp | 176 ++ .../CPP/convert.cpp | 32 + .../CPP/equals.cpp | 25 + .../CPP/getbytes_chararr.cpp | 82 + .../CPP/getbytes_chararric.cpp | 85 + .../CPP/getbytes_string.cpp | 121 ++ .../CPP/getchars.cpp | 64 + .../CPP/getcharsic.cpp | 69 + .../CPP/preamble.cpp | 41 + .../CPP/isprops.cpp | 173 ++ .../system.Text.Encoding.Names/CPP/names.cpp | 52 + .../CPP/webname.cpp | 39 + .../CPP/encodinginfo.cpp | 188 ++ .../CPP/constructors.cpp | 127 ++ .../CPP/encdec.cpp | 56 + .../CPP/equals.cpp | 94 + .../CPP/errordetection.cpp | 70 + .../CPP/getbytes_chararr.cpp | 87 + .../CPP/getbytes_string.cpp | 85 + .../CPP/getchars.cpp | 88 + .../CPP/getpreamble.cpp | 44 + .../CPP/snippet.cpp | 38 + .../CPP/getbytecount-char[]-int32-int32.cpp | 18 + ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 + ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 + .../CPP/getdecoder-.cpp | 26 + .../CPP/getencoder-.cpp | 26 + .../CPP/getmaxbytecount-int32.cpp | 13 + .../CPP/getmaxcharcount-int32.cpp | 13 + .../CPP/ctor.cpp | 12 + .../CPP/ctor-boolean.cpp | 47 + .../CPP/getstring.cpp | 34 + .../CPP/snippet.cpp | 51 + .../CPP/equals-object.cpp | 34 + ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 + ...tbytes-string-int32-int32-byte[]-int32.cpp | 26 + .../CPP/getcharcount-byte[]-int32-int32.cpp | 13 + ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 + .../CPP/getdecoder-.cpp | 26 + .../CPP/getencoder-.cpp | 26 + .../CPP/gethashcode-.cpp | 21 + .../CPP/getmaxbytecount-int32.cpp | 13 + .../CPP/getmaxcharcount-int32.cpp | 13 + .../CPP/getpreamble-.cpp | 42 + .../CPP/ctor.cpp | 12 + .../CPP/ctor-boolean.cpp | 28 + .../CPP/ctor-boolean-boolean.cpp | 39 + .../CPP/snippet.cpp | 38 + .../CPP/charsize.cpp | 10 + .../CPP/encdec.cpp | 56 + .../CPP/errordetection.cpp | 71 + ...tbytes-char[]-int32-int32-byte[]-int32.cpp | 31 + ...tbytes-string-int32-int32-byte[]-int32.cpp | 26 + .../CPP/getcharcount-byte[]-int32-int32.cpp | 13 + ...tchars-byte[]-int32-int32-char[]-int32.cpp | 26 + .../CPP/getmaxbytecount-int32.cpp | 13 + .../CPP/getmaxcharcount-int32.cpp | 13 + .../CPP/getpreamble-.cpp | 30 + .../CPP/ctor.cpp | 12 + .../CPP/ctor-boolean-boolean.cpp | 45 + .../CPP/koax.cpp | 148 ++ .../CPP/class1.cpp | 51 + .../CPP/simplerisbetter.cpp | 105 ++ .../CPP/source.cpp | 197 ++ .../CPP/source.cpp | 70 + .../CPP/class1.cpp | 71 + .../CPP/source.cpp | 117 ++ .../CPP/class1.cpp | 82 + .../CPP/class1.cpp | 27 + .../CPP/class1.cpp | 56 + .../CPP/class1.cpp | 66 + .../CPP/source.cpp | 197 ++ .../CPP/source.cpp | 49 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 320 ++++ .../CPP/source.cpp | 58 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 186 ++ .../CPP/source.cpp | 79 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 75 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 103 + .../CPP/source.cpp | 86 + .../CPP/source.cpp | 114 ++ .../CPP/source.cpp | 28 + .../CPP/source.cpp | 49 + .../system.Threading.Timer/CPP/source.cpp | 98 + .../system.Threading.Timer2/CPP/source2.cpp | 59 + .../CPP/source.cpp | 125 ++ .../CPP/source1.cpp | 93 + .../CPP/source2.cpp | 102 + .../CPP/source3.cpp | 102 + .../CPP/source2.cpp | 83 + .../CPP/source3.cpp | 83 + .../CPP/source1.cpp | 37 + .../CPP/source2.cpp | 46 + .../CPP/source3.cpp | 46 + .../CPP/comp_equal.cpp | 64 + .../CPP/cto_eq_obj.cpp | 78 + .../system.TimeSpan.Ctor/CPP/ctoriii.cpp | 45 + .../system.TimeSpan.Ctor/CPP/ctoriiii.cpp | 42 + .../system.TimeSpan.Ctor/CPP/ctoriiiii.cpp | 51 + .../system.TimeSpan.Ctor/CPP/ctorl.cpp | 54 + .../CPP/dura_nega_una.cpp | 48 + .../system.TimeSpan.Fields/CPP/fields.cpp | 58 + .../system.TimeSpan.From/CPP/fromdays.cpp | 58 + .../system.TimeSpan.From/CPP/fromhours.cpp | 58 + .../system.TimeSpan.From/CPP/frommillisec.cpp | 58 + .../system.TimeSpan.From/CPP/fromminutes.cpp | 58 + .../system.TimeSpan.From/CPP/fromseconds.cpp | 58 + .../system.TimeSpan.From/CPP/fromticks.cpp | 58 + .../CPP/hashcode.cpp | 73 + .../CPP/properties.cpp | 88 + .../CPP/relationalops.cpp | 76 + .../system.TimeZone.Class/CPP/tzclass.cpp | 61 + .../CPP/source.cpp | 100 + .../CPP/source.cpp | 126 ++ .../CPP/source.cpp | 70 + .../CPP/source.cpp | 108 ++ .../CPP/source.cpp | 101 + .../system.Type.IsGenericType/cpp/remarks.cpp | 21 + .../system.Type.IsGenericType/cpp/source.cpp | 110 ++ .../CPP/source.cpp | 101 + .../system.Type.IsVisible/CPP/source.cpp | 36 + .../system.Type.MakeXxxType/CPP/source.cpp | 82 + .../system.Type/cpp/source.cpp | 27 + .../system.TypeCode/CPP/iconvertible.cpp | 153 ++ .../system.action.delegate/cpp/delegate.cpp | 42 + .../cpp/delegate.vcxproj | 89 + .../cpp/remarks.cpp | 18 + .../cpp/example.cpp | 54 + .../system.appdomain.load/cpp/source.cpp | 31 + .../system.array.foreach/cpp/source.cpp | 40 + .../system.array.getlength/cpp/source.cpp | 64 + .../system.array.getupperbound/cpp/source.cpp | 65 + .../system.byte.equals/cpp/eq.cpp | 24 + .../cpp/source.cpp | 37 + .../cpp/source.cpp | 32 + .../cpp/source.cpp | 48 + .../cpp/source.cpp | 39 + .../cpp/remarks.cpp | 59 + .../cpp/source.cpp | 63 + .../cpp/source.cpp | 131 ++ .../system.console.setout/cpp/source.cpp | 29 + .../cpp/windowleft1.cpp | 53 + .../system.console.write/cpp/con_write.cpp | 23 + .../cpp/changetype00.cpp | 98 + .../cpp/changetype03.cpp | 239 +++ .../cpp/changetype_01.cpp | 21 + .../system.convert.tobyte/cpp/tobyte1.cpp | 19 + .../cpp/addminutes1.cpp | 33 + .../system.datetime.now/cpp/now1.cpp | 23 + .../system.datetime.now/cpp/now2.cpp | 42 + .../cpp/tosbyte.cpp | 43 + .../cpp/tosingle1.cpp | 31 + .../cpp/source.cpp | 52 + .../cpp/dllmain.cpp | 19 + .../cpp/stdafx.cpp | 8 + .../cpp/stdafx.h | 16 + .../cpp/targetver.h | 8 + .../cpp/testdll.cpp | 23 + .../cpp/testdll.h | 22 + .../cpp/testdll.vcxproj | 100 + .../cpp/ToStringEx1.cpp | 47 + .../CPP/class1.cpp | 54 + .../system.int32.maxvalue/cpp/maxvalue1.cpp | 29 + .../system.intptr/cpp/topointer.cpp | 55 + .../system.io.pipes.pipestream/cpp/sample.cpp | 98 + .../system.nullableOfT.class/cpp/tarow.cpp | 80 + .../system.object.tostring/cpp/tostring1.cpp | 11 + .../system.object.tostring/cpp/tostring2.cpp | 18 + .../system.object.tostring/cpp/tostring3.cpp | 29 + .../cpp/getexecutingassembly1.cpp | 32 + .../cpp/remarks.cpp | 43 + .../cpp/remarks.cpp | 32 + .../cpp/source.cpp | 46 + .../cpp/friend1.cpp | 39 + .../cpp/friend2.cpp | 12 + .../cpp/source.cpp | 23 + .../cpp/source.cpp | 18 + .../cpp/source.cpp | 18 + .../cpp/source.cpp | 34 + .../cpp/source.cpp | 62 + .../cpp/source.cpp | 18 + .../cpp/encryptor.cpp | 54 + .../cpp/remarks.cpp | 39 + .../cpp/ctor1.cpp | 23 + .../cpp/remarks.cpp | 44 + .../system.string.concat/cpp/Concat6.cpp | 15 + .../system.string.ctor/cpp/assignment.cpp | 18 + .../system.string.ctor/cpp/char1_ctor.cpp | 20 + .../system.string.ctor/cpp/char2_ctor.cpp | 32 + .../system.string.ctor/cpp/chptrctor_null.cpp | 24 + .../system.string.ctor/cpp/ptrctor_null.cpp | 27 + .../cpp/NullString1.cpp | 32 + .../cpp/isnullorempty1.cpp | 18 + .../cpp/StartsWith2.cpp | 23 + .../cpp/startswith1.cpp | 54 + .../CPP/regexreplace.cpp | 49 + .../cpp/source.cpp | 36 + .../cpp/source.cpp | 102 + .../system.timers.timer/cpp/timer1.cpp | 49 + .../system.type.basetype/cpp/remarks.cpp | 11 + .../system.type.declaringtype/cpp/remarks.cpp | 12 + .../cpp/remarks.cpp | 18 + .../cpp/remarks.cpp | 26 + .../system.typedreference/cpp/source.cpp | 33 + .../system.version.revision/cpp/rev.cpp | 32 + .../FxCop.Reliability.ReliabilityContract.cpp | 11 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 67 + .../CPP/source.cpp | 49 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 97 + .../CPP/source.cpp | 100 + .../CPP/source.cpp | 115 ++ .../CPP/source.cpp | 70 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 74 + .../CPP/source.cpp | 106 ++ .../CPP/source.cpp | 96 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 103 + .../CPP/source.cpp | 118 ++ .../CPP/source.cpp | 89 + .../CPP/source.cpp | 66 + .../CPP/source.cpp | 108 ++ .../CPP/notation.cpp | 52 + .../CPP/source.cpp | 89 + .../CPP/namespaces.cpp | 30 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 100 + .../CPP/source.cpp | 119 ++ .../CPP/source.cpp | 32 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 82 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 74 + .../CPP/source.cpp | 61 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 75 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 75 + .../CPP/source.cpp | 67 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 49 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 51 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 79 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 83 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 90 + .../CPP/source.cpp | 117 ++ .../CPP/source.cpp | 30 + .../CPP/complextype.cpp | 68 + .../CPP/datatype.cpp | 57 + .../CPP/documentation.cpp | 114 ++ .../CPP/element.cpp | 94 + .../CPP/fractiondigitsfacet.cpp | 84 + .../CPP/import_include_sample.cpp | 63 + .../CPP/key_sample.cpp | 83 + .../CPP/lengthfacet.cpp | 77 + .../CPP/maxexclusivefacet.cpp | 78 + .../CPP/maxinclusivefacet.cpp | 78 + .../CPP/maxlengthfacet.cpp | 79 + .../CPP/minexclusivefacet.cpp | 78 + .../CPP/mininclusivefacet.cpp | 78 + .../CPP/minlengthfacet.cpp | 79 + .../CPP/patternfacet.cpp | 78 + .../CPP/simpletypeunion.cpp | 78 + .../CPP/unique.cpp | 128 ++ .../CPP/whitespacefacet.cpp | 68 + .../IHasXmlNode.GetNode/CPP/hasxmlnode.cpp | 26 + .../IXmlLineInfo/CPP/lineinfo.cpp | 60 + .../NameTable/CPP/nametable.cpp | 31 + .../CPP/severity.cpp | 67 + .../CPP/returntype.cpp | 54 + .../CPP/xpathnavigatormethods.cpp | 1166 ++++++++++++ .../CPP/xpathnavigatorproperties.cpp | 134 ++ .../XPathValidation/CPP/XPathValidation.cpp | 68 + .../XmlConvert.EncodeName/CPP/convert.cpp | 24 + .../XmlConvert.ToDouble/CPP/readData.cpp | 38 + .../XmlConvert.VerifyName/CPP/verifyname.cpp | 35 + .../CPP/getrow.cpp | 30 + .../XmlDataDocument.Load/CPP/loadrdr.cpp | 31 + .../CPP/docresolver.cpp | 27 + .../XmlDocument.cctor/CPP/docload.cpp | 56 + .../XmlEntity/CPP/entities.cpp | 39 + .../XmlNode.SelectNodes1/CPP/selectnodes1.cpp | 31 + .../CPP/selectsingnode.cpp | 25 + .../CPP/XmlNode.SelectSingleNode2.cpp | 25 + .../CPP/nodeevent.cpp | 64 + .../XmlNotation/CPP/notation.cpp | 32 + .../CPP/XmlReaderSettings.DtdValidate.cpp | 33 + .../CPP/XmlReaderSettings.cctor.cpp | 38 + .../CPP/XmlReader_Validate_SchemaSet.cpp | 50 + .../CPP/schemaevent.cpp | 37 + .../CPP/schemacolladd.cpp | 55 + .../XmlSchemaCollection.Basic/CPP/aa.cpp | 45 + .../CPP/XmlSchemaInferenceExamples.cpp | 101 + .../CPP/xmlschemasetexample.cpp | 36 + .../CPP/secresolver2.cpp | 37 + .../CPP/secresolver.cpp | 41 + .../XmlTextReader.Cctor/CPP/readfrag.cpp | 47 + .../XmlTextReader.LineNum/CPP/readlinenum.cpp | 57 + .../CPP/readnormal.cpp | 45 + .../CPP/readattrval.cpp | 46 + .../CPP/resetstate.cpp | 31 + .../XmlTextReader.XmlLang/CPP/readlang.cpp | 50 + .../CPP/rdr_resolver.cpp | 34 + .../XmlTextReader.XmlSpace/CPP/readspace.cpp | 41 + .../XmlTextReader.cctor1/CPP/rdrcctor1.cpp | 41 + .../XmlTextWriter.Flush/CPP/write2docs.cpp | 32 + .../CPP/valid_xsd2.cpp | 64 + .../CPP/readdefattr.cpp | 31 + .../CPP/schematype.cpp | 51 + .../CPP/vrdr_resolver.cpp | 59 + .../XmlWriter.Close/CPP/XmlWriter.Close.cpp | 32 + .../XmlWriter.Flush/CPP/write2docs_v2.cpp | 33 + .../CPP/writeattrstring.cpp | 29 + .../CPP/writeattrs_v2.cpp | 32 + .../XmlWriter.WriteBase64/CPP/writebase64.cpp | 143 ++ .../CPP/writeelemstring_v2.cpp | 71 + .../XmlWriter.WriteNode/CPP/writenode.cpp | 40 + .../CPP/trans_snip4.cpp | 25 + .../XslTransform.Load3/CPP/trans3.cpp | 38 + .../XslTransform.Load4/CPP/trans_ev.cpp | 35 + .../CPP/trans_snip.cpp | 27 + .../CPP/trans_snip3.cpp | 41 + .../CPP/trans_snip2.cpp | 20 + .../cpp/source.cpp | 47 + .../cpp/source.cpp | 63 + ...atedservicetypeentry_objecttype_server.cpp | 53 + .../CPP/authenticationmanager_unregister2.cpp | 63 + .../CPP/authorization_constructor3.cpp | 104 + .../CPP/authorization_protectionrealm.cpp | 192 ++ .../CPP/bindingcollectionsample2.cpp | 170 ++ .../CPP/bindingcollectionsample1.cpp | 62 + .../CPP/bindingcollectionsample3.cpp | 51 + .../CallContext/CPP/client.cpp | 49 + .../CallContext/CPP/service.cpp | 94 + .../CPP/callcontext_client.cpp | 110 ++ .../CPP/callcontext_share.cpp | 69 + .../CPP/channelservices_getchannel_client.cpp | 56 + ...nnelservices_registeredchannels_client.cpp | 50 + ...nnelservices_registeredchannels_server.cpp | 69 + ...nelservices_syncdispatchmessage_client.cpp | 132 ++ .../CPP/source.cpp | 25 + .../Classic Dns Example/CPP/source.cpp | 20 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 16 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 166 ++ .../CPP/source.cpp | 157 ++ .../CPP/source.cpp | 156 ++ .../CPP/source.cpp | 154 ++ .../CPP/source.cpp | 68 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 61 + .../CPP/source.cpp | 61 + .../CPP/source.cpp | 58 + .../CPP/source.cpp | 61 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 62 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 106 ++ .../Classic TcpListenerExample/CPP/source.cpp | 83 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 280 +++ .../Classic UdpClientExample/CPP/source.cpp | 45 + .../Classic Uri Example/CPP/source.cpp | 34 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 18 + .../Classic Uri.Host Example/CPP/source.cpp | 20 + .../CPP/source.cpp | 29 + .../Classic Uri.Port Example/CPP/source.cpp | 20 + .../Classic Uri.Scheme Example/CPP/source.cpp | 20 + .../Classic Uri.Uri Example/CPP/source.cpp | 18 + .../Classic Uri.Uri1 Example/CPP/source.cpp | 18 + .../Classic Uri.Uri3 Example/CPP/source.cpp | 20 + .../Classic Uri.Uri4 Example/CPP/source.cpp | 12 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 37 + .../Classic WebProxy Example/CPP/source.cpp | 22 + .../Classic WebRequest Example/CPP/source.cpp | 24 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 132 ++ .../CPP/source.cpp | 62 + .../CPP/source.cpp | 111 ++ .../CPP/source.cpp | 22 + .../CPP/source.cpp | 162 ++ .../CPP/source.cpp | 22 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 93 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 59 + .../CPP/source.cpp | 75 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 65 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 113 ++ .../CPP/source.cpp | 102 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 85 + .../CPP/source.cpp | 107 ++ .../CPP/source.cpp | 78 + .../CPP/source.cpp | 112 ++ .../CPP/source.cpp | 88 + .../CPP/source.cpp | 101 + .../CPP/source.cpp | 80 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 74 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 115 ++ .../CPP/source.cpp | 55 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 20 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 64 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 19 + .../CPP/source.cpp | 96 + .../CPP/source.cpp | 100 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 80 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 43 + .../CPP/source2.cpp | 23 + .../CPP/source3.cpp | 46 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 17 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 67 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 62 + .../CPP/source.cpp | 216 +++ .../CPP/source.cpp | 26 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 91 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 79 + .../CPP/source.cpp | 181 ++ .../CPP/source.cpp | 51 + .../CPP/source.cpp | 58 + .../CPP/source.cpp | 137 ++ .../CPP/source.cpp | 133 ++ .../CPP/source.cpp | 46 + .../CPP/source.cpp | 82 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 99 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 248 +++ .../CPP/clientsponsor_client.cpp | 61 + .../CPP/commontransportkeys.cpp | 228 +++ .../CPP/contractreference.cpp | 63 + .../CPP/contractreference_contract.cpp | 52 + .../CPP/contractreference_defaultfilename.cpp | 41 + .../CPP/contractreference_readdocument.cpp | 37 + .../CPP/contractreference_ref.cpp | 46 + .../CPP/contractreference_writedocument.cpp | 45 + .../CPP/contractreference_ctor1.cpp | 56 + .../CPP/contractreference_ctor2.cpp | 57 + .../CPP/CookieCollection_Item_1.cpp | 147 ++ .../CPP/CookieCollection_Item_2.cpp | 143 ++ .../CreateObjRef/CPP/example.cpp | 141 ++ .../CreateObjRef2/CPP/example.cpp | 139 ++ .../CPP/credentialcache_add_remove.cpp | 84 + .../credentialcache_defaultcredentials.cpp | 82 + .../CPP/credentialcache_getcredential.cpp | 86 + .../CPP/credentialcache_getenumerator.cpp | 92 + .../CPP/customproxy_sample.cpp | 250 +++ ...ateclient_socketpermission_constructor.cpp | 168 ++ .../CPP/dateclient_socketpermission_toxml.cpp | 193 ++ .../CPP/descriptionnamespacesample1.cpp | 213 +++ .../CPP/discoveryclientdocumentcollection.cpp | 60 + ...discoveryclientdocumentcollection_keys.cpp | 68 + ...discoveryclientdocumentcollection_ctor.cpp | 70 + ...ryclientprotocol_additionalinformation.cpp | 49 + .../CPP/discoveryclientprotocol_download.cpp | 38 + .../CPP/discoveryclientprotocol_download.cpp | 36 + .../CPP/discoveryclientprotocol_errors.cpp | 54 + .../discoveryclientreferencecollection.cpp | 63 + ...scoveryclientreferencecollection_items.cpp | 75 + ...iscoveryclientreferencecollection_keys.cpp | 67 + .../CPP/discoveryclientresult.cpp | 46 + .../CPP/discoveryclientresultcollection.cpp | 62 + .../CPP/discoveryclientresult_filename.cpp | 96 + .../CPP/discoveryclientresult_ctor.cpp | 64 + .../discoveryclientresultsfile_results.cpp | 66 + .../CPP/discoverydocument.cpp | 64 + ...iscoverydocumentreference_readdocument.cpp | 44 + ...overydocumentreference_ctor_properties.cpp | 59 + ...rydocumentreference_ctor_writedocument.cpp | 61 + .../discoverydocument_discoverydocument.cpp | 70 + .../CPP/discoverydocument_write1.cpp | 62 + .../CPP/discoverydocument_write2.cpp | 64 + ...eryexceptiondictionary_property_method.cpp | 115 ++ .../CPP/discoveryreference.cpp | 119 ++ .../CPP/discoveryreference.cpp | 122 ++ .../CPP/discoveryreferencecollection.cpp | 58 + .../CPP/discovery_soapbinding.cpp | 64 + .../CPP/dnspermission_constructor.cpp | 69 + .../CPP/dnspermission_copy.cpp | 67 + .../CPP/dnspermission_fromxml.cpp | 95 + .../CPP/dnspermission_issubsetof.cpp | 84 + .../CPP/dnspermission_isunrestricted.cpp | 73 + .../CPP/dns_begin_endresolve.cpp | 80 + .../CPP/dns_gethostbyaddress_ipaddress.cpp | 80 + .../CPP/dns_gethostbyname.cpp | 73 + .../Dns_GetHostName/CPP/dns_gethostname.cpp | 45 + .../Dns_Resolve/CPP/dns_resolve.cpp | 84 + .../CPP/documentableitemsample.cpp | 48 + .../CPP/deployservicedcomponent.cpp | 69 + .../CPP/class1.cpp | 108 ++ .../CPP/class1.cpp | 19 + .../cpp/class1.cpp | 72 + .../cpp/class1.cpp | 45 + .../cpp/class1.cpp | 49 + .../cpp/class1.cpp | 48 + .../cpp/class1.cpp | 46 + .../CPP/calculator.cpp | 23 + .../EnterpriseServices_Crm/cpp/crmclient.cpp | 27 + .../EnterpriseServices_Crm/cpp/crmserver.cpp | 289 +++ .../CPP/inspector.cpp | 60 + .../CPP/employeeinformation.cpp | 91 + .../CPP/receiptcounterclass.cpp | 54 + .../CPP/transaction.cpp | 27 + .../CPP/faultbindingcollection_add.cpp | 217 +++ .../CPP/faultbindingcollection_item.cpp | 47 + .../CPP/faultbindingcollection_remove.cpp | 89 + .../CPP/filewebrequest_contentlength.cpp | 72 + .../CPP/filewebrequest_reqbeginend.cpp | 118 ++ .../CPP/filewebrequest_resbeginend.cpp | 105 ++ .../CPP/filewebresponse_close.cpp | 58 + ...ewebresponse_contentlength_contenttype.cpp | 56 + .../CPP/filewebresponse_getresponsestream.cpp | 77 + .../CPP/filewebresponse_headers.cpp | 57 + .../CPP/filewebresponse_responseuri.cpp | 56 + .../CPP/httpbinding_ctor.cpp | 93 + .../CPP/class1.cpp | 219 +++ .../CPP/class1.cpp | 215 +++ .../HttpChannel.GetUrlsFromUri/CPP/class1.cpp | 33 + .../HttpChannel/CPP/server.cpp | 30 + .../CPP/httpgetclientprotocol_constructor.cpp | 77 + .../httppostclientprotocol_constructor.cpp | 75 + .../CPP/httpclientchannel_6_client.cpp | 71 + .../CPP/httpserverchannel_9_server.cpp | 84 + .../CPP/source.cpp | 60 + .../CPP/httpversion_version10.cpp | 49 + .../CPP/httpwebclientprotocol_useragent.cpp | 78 + .../CPP/httpwebrequest_accept.cpp | 92 + .../CPP/httpwebrequest_allowautoredirect.cpp | 60 + ...tpwebrequest_allowwritestreambuffering.cpp | 81 + .../httpwebrequest_begingetrequeststream.cpp | 97 + .../CPP/httpwebrequest_begingetresponse.cpp | 158 ++ .../CPP/httpwebrequest_connection.cpp | 94 + .../CPP/httpwebrequest_contentlength.cpp | 102 + .../CPP/httpwebrequest_headers.cpp | 57 + .../CPP/httpwebrequest_ifmodifiedsince.cpp | 90 + .../CPP/httpwebrequest_pipelined.cpp | 86 + .../CPP/httpwebrequest_protocolversion.cpp | 67 + .../CPP/httpwebrequest_referer.cpp | 89 + .../CPP/httpwebrequest_sendchunked.cpp | 112 ++ .../CPP/httpwebrequest_timeout.cpp | 61 + .../CPP/httpwebrequest_useragent.cpp | 58 + .../CPP/httpwebresponse_close.cpp | 52 + .../CPP/source.cpp | 82 + .../CPP/httpwebresponse_getresponseheader.cpp | 70 + .../CPP/httpwebresponse_getresponsestream.cpp | 73 + .../CPP/httpwebresponse_headers.cpp | 61 + .../CPP/httpwebresponse_lastmodified.cpp | 67 + .../CPP/httpwebresponse_method_server.cpp | 59 + .../CPP/httpwebresponse_protocolversion.cpp | 59 + .../CPP/httpwebresponse_responseuri.cpp | 63 + ...bresponse_statuscode_statusdescription.cpp | 56 + .../CPP/httpwebrequest_haveresponse.cpp | 78 + .../CPP/httpwebrequest_proxy.cpp | 110 ++ .../CPP/ichanneldatastore.cpp | 69 + .../ichannelreceiverhook_channelscheme.cpp | 141 ++ .../ichannelreceiver_channeldata_server.cpp | 174 ++ .../CPP/ichannelsender_2_client.cpp | 71 + .../ICredential/CPP/icredential.cpp | 125 ++ .../ILease_ILease/CPP/ilease_client.cpp | 91 + .../CPP/imessagesink_client.cpp | 149 ++ .../CPP/imethodcallmessage.cpp | 108 ++ .../CPP/imethodmessage_logicalcallcontext.cpp | 104 + .../CPP/imethodmessage_methodname.cpp | 111 ++ .../CPP/imethodreturnmessage_exception.cpp | 87 + .../CPP/imethodreturnmessage_returnvalue.cpp | 106 ++ .../CPP/ipaddress_broadcast_loopback.cpp | 33 + .../CPP/ipaddress_networktohost.cpp | 87 + .../IPAddress_None/CPP/ipaddress_none.cpp | 22 + .../CPP/ipendpoint_properties.cpp | 123 ++ .../CPP/iphostentry_addresslist.cpp | 59 + .../CPP/iserverchannelsinkprovider_3.cpp | 71 + .../ISponsor_Client/CPP/isponsor_client.cpp | 68 + .../CPP/itransportheaders_3_server.cpp | 115 ++ .../CPP/iwebproxy_interface.cpp | 87 + .../CPP/importcollection_6.cpp | 71 + .../Importsample/CPP/importsample.cpp | 88 + .../CPP/logicalmethodinfo_begininvoke.cpp | 123 ++ .../CPP/logicalmethodinfo_constructor.cpp | 66 + .../CPP/logicalmethodinfo_create1.cpp | 76 + .../CPP/logicalmethodinfo_create2.cpp | 78 + .../logicalmethodinfo_getcustomattribute.cpp | 124 ++ .../CPP/logicalmethodinfo_isbeginmethod.cpp | 80 + .../CPP/SvcClient_MatchAttribute.cpp | 141 ++ .../CPP/message_acknowledgment.cpp | 145 ++ .../Message.Body/CPP/message_sendreceive.cpp | 117 ++ .../CPP/message_defaultandpriority.cpp | 107 ++ .../CPP/messagebinding_sample.cpp | 85 + .../CPP/messagecollection.cpp | 80 + .../CPP/messagepartcollection.cpp | 106 ++ .../MessagePropertyFilter/CPP/class1.cpp | 930 +++++++++ .../CPP/mqbeginpeek_timeoutstateobject.cpp | 75 + .../CPP/mqbeginpeek_noparms.cpp | 55 + .../CPP/mqbeginpeek_timeout.cpp | 61 + .../CPP/mqbeginreceive_noparms_mre.cpp | 69 + .../CPP/mqbeginreceive_noparms_wh.cpp | 64 + .../MessageQueue.Close/CPP/mqclose.cpp | 76 + .../CPP/mqcreate_transactional.cpp | 106 ++ .../MessageQueue.Create_path/CPP/mqcreate.cpp | 80 + .../CPP/mqdefaultpropertiestosend.cpp | 76 + .../CPP/mqexistsdelete.cpp | 36 + .../CPP/mqgetmessageenumerator.cpp | 55 + .../mqgetmessagequeueenumerator_criteria.cpp | 60 + .../CPP/mqgetmessagequeueenumerator.cpp | 54 + .../CPP/mqgetqueuelists.cpp | 155 ++ .../CPP/mqmessagereadpropertyfilter.cpp | 117 ++ .../MessageQueue.Path/CPP/mqpath.cpp | 125 ++ .../CPP/mqpeek_noparms.cpp | 127 ++ .../CPP/mqpeek_timeout.cpp | 73 + .../CPP/mqreceivecompletedeventhandler.cpp | 58 + .../CPP/mqreceive_timeouttransaction.cpp | 121 ++ .../CPP/mqreceive_noparms.cpp | 100 + .../CPP/mqreceive_timeout.cpp | 85 + .../CPP/mqreceive_transaction.cpp | 113 ++ .../CPP/mqsend_objtransaction.cpp | 113 ++ .../CPP/mqsend_generic.cpp | 55 + .../CPP/mqctor_denysharedreceive.cpp | 63 + .../MessageQueue2/cpp/class1.cpp | 1101 +++++++++++ .../MessageQueue4/cpp/class1.cpp | 43 + .../MessageQueueBeginPeek/cpp/class1.cpp | 69 + .../MessageQueueBeginReceive1/cpp/class1.cpp | 82 + .../MessageQueueBeginReceive2/cpp/class1.cpp | 86 + .../MessageQueueBeginReceive3/cpp/class1.cpp | 81 + .../cpp/class1.cpp | 62 + .../cpp/class1.cpp | 213 +++ .../cpp/class1.cpp | 208 ++ .../cpp/class1.cpp | 408 ++++ .../Message_Samples3/CPP/message_samples3.cpp | 58 + .../CPP/source.cpp | 15 + .../CPP/source.cpp | 48 + .../CPP/source.cpp | 50 + .../CPP/mimecontentbinding_part_4.cpp | 53 + .../mimemultipartrelatedbinding_parts_2.cpp | 55 + .../CPP/mimepartcollection_1.cpp | 66 + .../CPP/mimepartcollection_8.cpp | 146 ++ .../MimePart_3/CPP/mimepart_3.cpp | 60 + .../MimeTextMatch_5/CPP/mimetextmatch_5.cpp | 138 ++ .../CPP/mimetext_binding_match_8.cpp | 128 ++ .../CPP/mimetext_match_matchcoll_9.cpp | 180 ++ .../CPP/mimexmlbinding_part_3.cpp | 93 + .../NCLAutoProxy/CPP/proxy.cpp | 235 +++ .../NCLCookies/CPP/cookiessnippets.cpp | 77 + .../NCLCredPolicy/CPP/NCLCredPolicy.cpp | 249 +++ .../NCLCustomWebClient/CPP/mywebclient.cpp | 188 ++ .../NCLEmptyWebProxy/CPP/test.cpp | 31 + .../NCLFtpAsync/CPP/async.cpp | 227 +++ .../NCLFtpClient/CPP/ftptests.cpp | 842 +++++++++ .../NCLMailSync/CPP/NclMailSync.cpp | 1082 +++++++++++ .../NCLNetInfo2/CPP/networkexamples.cpp | 1010 ++++++++++ .../NCLNetInfoReport/CPP/netinfo.cpp | 603 ++++++ .../CPP/NCLPhysicalAddress.cpp | 140 ++ .../NCLPingSampler/CPP/pingtest.cpp | 249 +++ .../NCLResponse1/CPP/httpwebrequest1.cpp | 51 + .../NCLServicePoint/CPP/nclservicepoint.cpp | 88 + .../NCLSimpleCache/CPP/NCLSimpleCache.cpp | 274 +++ .../CPP/nclsocketenhancements.cpp | 713 +++++++ .../CPP/iocontrolserver.cpp | 68 + .../NCLSocketIoControl1/CPP/iocontrolcode.cpp | 70 + .../NCLTcpClientSync/CPP/tcpclient.cpp | 36 + .../CPP/nclurienhancements.cpp | 150 ++ .../NCLUriExamples/CPP/uriexamples.cpp | 271 +++ .../NCLWebClientAsync/CPP/asyncmethods.cpp | 843 +++++++++ .../NCLWebClientUserAgent/CPP/useragent.cpp | 31 + .../NCLWebProxy/CPP/nclwebproxy.cpp | 186 ++ .../NCLWebRequestSimple/CPP/webrequestget.cpp | 45 + .../CPP/source.cpp | 40 + .../NclCodeGroup/cpp/sample.cpp | 167 ++ .../NclMailASync/cpp/mailasync.cpp | 94 + .../NclMailPerms/CPP/mailpermissions.cpp | 98 + .../CPP/NclNegoAsyncServer.cpp | 239 +++ .../CPP/NclNegoSyncClient.cpp | 107 ++ .../CPP/NclNegoSyncServer.cpp | 73 + .../CPP/NclNegoasyncClient.cpp | 128 ++ .../NclNetAddressChanged1/CPP/changed.cpp | 27 + .../CPP/NclNetworkInfoPerms.cpp | 48 + .../NclPingAsync/CPP/asyncping.cpp | 115 ++ .../NclPingSync/CPP/syncping.cpp | 48 + .../CPP/NclSslClientAsync.cpp | 337 ++++ .../NclSslClientSync/CPP/clientsync.cpp | 260 +++ .../CPP/NclSslServerAsync.cpp | 265 +++ .../NclSslServerSync/CPP/NclSslServerSync.cpp | 235 +++ .../NclTcpServerSync/cpp/tcplistener.cpp | 39 + .../NestingLevel/cpp/nestinglevel.cpp | 43 + .../CPP/networkcredential_constructor2.cpp | 67 + .../CPP/networkcredential_getcredential.cpp | 68 + ...orkcredential_username_password_domain.cpp | 74 + .../CPP/source.cpp | 51 + .../CPP/source.cpp | 108 ++ .../ObjectHandle/CPP/objecthandleassembly.cpp | 48 + ...gcollection_operationbindingcollection.cpp | 134 ++ .../CPP/operationbinding_operationbinding.cpp | 127 ++ .../CPP/operationcollection_methods.cpp | 92 + .../CPP/operationfaultcollection_7.cpp | 114 ++ .../CPP/operationfaultcollection_add.cpp | 54 + .../CPP/operationfaultcollection_item.cpp | 53 + .../CPP/operationfault_operationfault.cpp | 55 + .../CPP/operationflow_enum.cpp | 141 ++ .../CPP/operationinput_operationinput.cpp | 127 ++ .../CPP/operationmessagecollection_sample.cpp | 129 ++ .../CPP/operationmessage_properties.cpp | 64 + .../CPP/operationoutput_operationoutput.cpp | 127 ++ .../Operation_2/CPP/operation_2.cpp | 155 ++ .../Operation_5/CPP/operation_5.cpp | 72 + .../Operation_Faults/CPP/operation_faults.cpp | 47 + .../CPP/operation_isboundby.cpp | 95 + .../PortClass/CPP/portclass.cpp | 166 ++ .../CPP/portcollection_add.cpp | 67 + .../CPP/portcollection_copyto.cpp | 71 + .../CPP/portcollection_item.cpp | 71 + .../PortType/CPP/porttype.cpp | 75 + .../CPP/porttypecollection_1.cpp | 59 + .../CPP/porttypecollection_2.cpp | 68 + .../CPP/porttypecollection_class.cpp | 64 + .../CPP/porttypecollection_copyto.cpp | 50 + .../PortType_Class/CPP/porttype_class.cpp | 71 + .../RealProxy_Sample/CPP/realproxy_sample.cpp | 131 ++ .../Remoting.ObjRef/CPP/client.cpp | 54 + .../CPP/client.cpp | 36 + .../CPP/server.cpp | 21 + .../CPP/service.cpp | 36 + .../CPP/server.cpp | 61 + .../CPP/client.cpp | 38 + .../CPP/server.cpp | 27 + .../CPP/service.cpp | 34 + ...remotingconfiguration_configure_server.cpp | 40 + ...n_GetRegisteredActivatedService_server.cpp | 44 + ...on_getregisteredwellknownclient_client.cpp | 36 + ..._isremotelyactivatedclienttype1_client.cpp | 43 + ..._isremotelyactivatedclienttype2_client.cpp | 52 + ...guration_iswellknownclienttype1_client.cpp | 37 + ...guration_iswellknownclienttype2_client.cpp | 42 + .../CPP/class1.cpp | 56 + .../CPP/basicclient.cpp | 45 + .../CPP/manualserver.cpp | 33 + .../CPP/serviceclass.cpp | 153 ++ .../CPP/client.cpp | 54 + .../CPP/timerclient.cpp | 75 + .../RemotingServices.Unmarshal/CPP/client.cpp | 39 + .../Remoting_Ipc/CPP/client.cpp | 33 + .../Remoting_Ipc/CPP/counter.cpp | 24 + .../Remoting_Ipc/CPP/server.cpp | 40 + .../Remoting_Sinks/CPP/clientsink.cpp | 142 ++ .../Remoting_Sinks/CPP/serversink.cpp | 137 ++ .../Remoting_TcpAuth/CPP/client.cpp | 35 + .../Remoting_TcpAuth/CPP/server.cpp | 34 + .../Remoting_TcpInfo/CPP/client.cpp | 35 + .../Remoting_TcpInfo/CPP/remotable.cpp | 22 + .../Remoting_TcpInfo/CPP/server.cpp | 45 + .../SchemaReference/CPP/schemareference.cpp | 83 + .../SelectModeExample/CPP/source.cpp | 65 + .../SerializationAttributes/CPP/s.cpp | 77 + .../ServiceClass/CPP/serviceclass.cpp | 84 + .../CPP/servicecollection_copyto.cpp | 111 ++ .../CPP/servicecollection_item.cpp | 80 + .../CPP/servicedescription.cpp | 84 + .../CPP/servicedescriptionbasecollection.cpp | 192 ++ .../CPP/servicedescriptioncollection.cpp | 57 + .../CPP/sdcollection_constructor_add_item.cpp | 50 + ...ervicedescriptioncollection_getbinding.cpp | 52 + ...ervicedescriptioncollection_getmessage.cpp | 52 + ...rvicedescriptioncollection_getporttype.cpp | 53 + ...ervicedescriptioncollection_getservice.cpp | 53 + .../CPP/sdcollection_insert_item_copyto.cpp | 62 + .../servicedescriptionformatextension_13.cpp | 142 ++ .../servicedescriptionimportstyle_client.cpp | 39 + .../servicedescriptionimportwarnings_enum.cpp | 82 + .../CPP/servicedescription_bindings.cpp | 85 + .../CPP/servicedescription_constructor_4.cpp | 59 + .../CPP/servicedescription_extensions_2.cpp | 42 + .../CPP/servicedescription_imports.cpp | 42 + .../CPP/servicedescription_namespace.cpp | 30 + .../CPP/servicedescription_porttypes_2.cpp | 69 + .../CPP/servicedescription_read.cpp | 85 + .../CPP/servicedescription_read1.cpp | 44 + .../CPP/servicedescription_read2.cpp | 44 + .../CPP/servicedescription_types.cpp | 101 + .../Service_Class4/CPP/service_class.cpp | 95 + .../SinkProviders/CPP/source.cpp | 23 + .../CPP/defvalue.cpp | 126 ++ .../SoapAttribute/CPP/soapattribute.cpp | 115 ++ .../CPP/soapattributeex2.cpp | 76 + .../CPP/attadd.cpp | 72 + .../CPP/attadd2.cpp | 72 + .../SoapAttributes1/CPP/s.cpp | 50 + .../SoapAttributesOverrides/CPP/soapover.cpp | 246 +++ .../CPP/soapbindingstyle_rpc.cpp | 110 ++ .../CPP/soapprotocol.cpp | 178 ++ .../CPP/soapbodybinding_parts.cpp | 89 + ...ntformattersinkprovider_customprovider.cpp | 173 ++ ...ntformattersinkprovider_customprovider.cpp | 270 +++ .../CPP/SoapClientMessage.cpp | 269 +++ .../CPP/soapelementoverrides.cpp | 106 ++ .../CPP/soapenumoverrides.cpp | 94 + .../CPP/traceextension.cpp | 156 ++ .../CPP/SoapExtensionAttribute.cpp | 230 +++ .../SoapFaultBinding/CPP/soapfaultbinding.cpp | 68 + .../CPP/soapfaultbinding_ctor.cpp | 110 ++ .../CPP/soapformatter.cpp | 90 + .../CPP/soapheaderbinding.cpp | 67 + .../CPP/soapheaderbinding_maptoproperty.cpp | 35 + .../CPP/soapheaderbinding_use.cpp | 87 + .../CPP/SoapHeaderCollection.cpp | 257 +++ .../CPP/SoapHeaderCollection_Contains.cpp | 253 +++ .../CPP/soapheader_encodedmustunderstand.cpp | 53 + .../CPP/source.cpp | 60 + .../SoapMessage/CPP/SoapMessage.cpp | 322 ++++ .../SoapMessageState/CPP/SoapMessageState.cpp | 225 +++ .../CPP/SoapMessage_Headers.cpp | 281 +++ .../CPP/soapoperationbinding.cpp | 104 + .../CPP/soaptype.cpp | 171 ++ .../SocketPermissionExample/CPP/source.cpp | 122 ++ .../SocketPropertyTester/CPP/class1.cpp | 105 ++ .../Socket_Select/CPP/source.cpp | 75 + .../Socket_Send_Receive/CPP/source.cpp | 128 ++ .../Socket_Socket_Options/CPP/source.cpp | 105 ++ .../Socket_Sync_Send_Receive/CPP/source.cpp | 449 +++++ .../CPP/queuedcomponent.cpp | 47 + .../CPP/queuedcomponentclientclass.cpp | 24 + .../CPP/custombasicauthentication.cpp | 355 ++++ .../System.Net.Dns/CPP/dnsnewmethods.cpp | 145 ++ .../CPP/getresponse.cpp | 120 ++ .../CPP/getrequeststream.cpp | 134 ++ .../CPP/noneanyloopback.cpp | 140 ++ .../CPP/isloopback.cpp | 75 + .../System.Net.IPAddress.Parse/CPP/parse.cpp | 73 + .../System.Net.IPAddress/CPP/ipaddress.cpp | 142 ++ .../System.Net.IPEndPoint/CPP/ipendpoint.cpp | 230 +++ .../CPP/servicepoint.cpp | 203 ++ .../cpp/servicepoint.cpp | 241 +++ .../CPP/custombasicauthentication.cpp | 344 ++++ .../CPP/listener.cpp | 130 ++ .../CPP/sender.cpp | 107 ++ .../CPP/beginconnect.cpp | 128 ++ .../CPP/sendgeneric.cpp | 175 ++ .../CPP/tcpclient.cpp | 118 ++ .../CPP/newtcpclient.cpp | 125 ++ .../CPP/tcpserver.cpp | 226 +++ .../cpp/tcpserver.cpp | 150 ++ .../CPP/joinmulticastgroup.cpp | 326 ++++ .../CPP/newudpclient.cpp | 88 + .../cpp/asyncudp.cpp | 261 +++ .../CPP/activatedclienttypeentry_client.cpp | 56 + .../CPP/activatedclienttypeentry_server.cpp | 19 + .../CPP/activatedclienttypeentry_share.cpp | 21 + .../CPP/client.cpp | 47 + .../CPP/remoteobject.cpp | 27 + .../CPP/server.cpp | 35 + .../CPP/client.cpp | 68 + .../CPP/client2.cpp | 93 + .../CPP/common.cpp | 22 + .../CPP/server.cpp | 26 + .../CPP/client.cpp | 31 + .../CPP/common.cpp | 19 + .../CPP/server.cpp | 91 + .../CPP/server2.cpp | 97 + .../CPP/client.cpp | 46 + .../CPP/common.cpp | 21 + .../CPP/server.cpp | 76 + .../CPP/server2.cpp | 43 + .../CPP/client.cpp | 70 + .../CPP/client2.cpp | 73 + .../CPP/server.cpp | 75 + .../CPP/server2.cpp | 86 + .../CPP/client.cpp | 51 + .../CPP/common.cpp | 25 + .../CPP/server.cpp | 68 + .../CPP/server.cpp | 54 + .../CPP/client.cpp | 57 + .../CPP/server.cpp | 44 + .../CPP/server.cpp | 55 + .../CPP/server.cpp | 29 + .../CPP/demo.cpp | 69 + .../CPP/demo.cpp | 50 + .../CPP/demo2.cpp | 34 + .../CPP/demo.cpp | 57 + .../CPP/demo2.cpp | 40 + .../CPP/demo.cpp | 55 + .../CPP/demo2.cpp | 42 + .../CPP/demo.cpp | 34 + .../CPP/demo.cpp | 61 + .../CPP/demo2.cpp | 31 + .../CPP/demo.cpp | 49 + .../CPP/demo.cpp | 56 + .../CPP/demo2.cpp | 38 + .../CPP/demo.cpp | 50 + .../CPP/demo2.cpp | 36 + .../CPP/demo.cpp | 69 + .../CPP/demo2.cpp | 31 + .../CPP/demo.cpp | 62 + .../CPP/demo2.cpp | 33 + .../CPP/demo.cpp | 51 + .../CPP/demo2.cpp | 35 + .../CPP/demo.cpp | 54 + .../CPP/demo2.cpp | 33 + .../CPP/demo.cpp | 53 + .../CPP/demo2.cpp | 36 + .../CPP/demo.cpp | 79 + .../CPP/demo2.cpp | 36 + .../CPP/demo.cpp | 51 + .../CPP/demo2.cpp | 35 + .../CPP/demo.cpp | 73 + .../CPP/demo2.cpp | 63 + .../CPP/demo.cpp | 55 + .../CPP/demo2.cpp | 31 + .../CPP/demo.cpp | 55 + .../CPP/demo2.cpp | 41 + .../CPP/demo.cpp | 57 + .../CPP/demo2.cpp | 41 + .../CPP/remotingservicessample.cpp | 232 +++ .../CPP/demo.cpp | 371 ++++ .../CPP/class1.cpp | 28 + .../TcpChannel.GetUrlsForUri/CPP/class1.cpp | 32 + .../CPP/source.cpp | 44 + .../CPP/class1.cpp | 32 + .../CPP/unrefobj.cpp | 90 + .../UriBuilderSample/cpp/main.cpp | 27 + .../WebClient/CPP/webclient.cpp | 37 + .../CPP/webclientauth.cpp | 27 + .../webclient_baseaddress_responseheaders.cpp | 67 + .../CPP/webclient_downloaddata.cpp | 48 + .../CPP/webclient_downloadfile.cpp | 47 + .../CPP/webclient_openread.cpp | 49 + .../CPP/webclient_openwrite.cpp | 56 + .../CPP/webclient_openwrite2.cpp | 58 + .../CPP/webclient_querystring.cpp | 65 + .../CPP/webclient_uploaddata2.cpp | 52 + .../CPP/webclient_uploaddata_headers.cpp | 62 + .../CPP/webclient_uploadfile.cpp | 56 + .../CPP/webclient_uploadfile2.cpp | 55 + .../CPP/webclient_uploadvalues.cpp | 68 + .../CPP/webclient_uploadvalues2.cpp | 68 + .../CPP/webexception_constructor1.cpp | 63 + .../CPP/webexception_constructor2.cpp | 62 + .../CPP/webexception_constructor3.cpp | 62 + .../CPP/webexception_constructor4.cpp | 64 + .../CPP/webexception_constructor5.cpp | 117 ++ .../CPP/webexception_status_response.cpp | 40 + .../CPP/webheadercollection_add.cpp | 67 + .../CPP/webheadercollection_getvalues_1.cpp | 58 + .../CPP/webheadercollection_isrestricted.cpp | 49 + .../CPP/webheadercollection_remove.cpp | 79 + .../CPP/webheadercollection_set.cpp | 65 + .../CPP/source.cpp | 52 + .../webpermissionattribute_acceptconnect.cpp | 46 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 50 + .../CPP/source.cpp | 51 + .../CPP/source.cpp | 47 + .../CPP/webpermission_acceptconnectlist.cpp | 99 + .../CPP/webpermission_constructor4.cpp | 80 + .../CPP/webpermission_copy.cpp | 91 + .../CPP/webpermission_fromtoxml.cpp | 76 + .../CPP/webpermission_intersect.cpp | 104 + .../CPP/webpermission_issubset.cpp | 109 ++ .../WebPermission_IsSubset2/CPP/source.cpp | 41 + .../WebPermission_Regex/CPP/regex.cpp | 50 + .../CPP/webpermission_union.cpp | 92 + .../CPP/webrequest_begingetrequest.cpp | 92 + .../CPP/webrequest_contenttype.cpp | 95 + .../CPP/webrequest_create.cpp | 60 + .../CPP/webrequest_headers.cpp | 44 + .../WebRequest_Proxy/CPP/webrequest_proxy.cpp | 108 ++ .../CPP/webrequest_requesturi.cpp | 49 + .../CPP/webrequest_timeout.cpp | 66 + .../CPP/webresponse_close.cpp | 58 + .../CPP/webresponse_contentlength_type.cpp | 59 + .../CPP/webresponse_getresponsestream.cpp | 81 + .../CPP/webresponse_headers.cpp | 64 + .../CPP/webresponse_responseuri.cpp | 67 + .../CPP/import.cpp | 63 + .../CPP/httpbinding.cpp | 151 ++ .../CPP/wellknownclienttypeentry_client.cpp | 43 + .../CPP/wellknownservicetypeentry_server.cpp | 41 + .../CPP/xmlAttributeAttribute_ctr1_2.cpp | 100 + .../CPP/xmlrootattribute_constructor.cpp | 76 + .../CPP/xmlrootattribute_elementname.cpp | 74 + .../CPP/xmltypeattribute1_2.cpp | 77 + .../CPP/source.cpp | 59 + .../CPP/anyattover.cpp | 58 + .../CPP/anyelement.cpp | 117 ++ .../CPP/arrayitem.cpp | 107 ++ .../CPP/xmlanyover.cpp | 71 + .../CPP/xmlns.cpp | 86 + .../CPP/choice.cpp | 131 ++ .../CPP/person.cpp | 58 + .../CPP/reader.cpp | 19 + .../CPP/writer.cpp | 22 + .../CPP/unknownelement.cpp | 56 + .../xmlserializernamespaces_constructor.cpp | 79 + .../XmlTypeMapping Example/CPP/mapping.cpp | 67 + .../CPP/dnspermission_union_intersect.cpp | 97 + .../CPP/colorbuilderdesigner.cpp | 102 + .../CPP/controladapter.control.cpp | 29 + .../CPP/controladapter_browser.cpp | 30 + .../CPP/controladapter_oninit.cpp | 25 + .../CPP/webcustomcontrol1.cpp | 282 +++ .../CPP/datasourcetypeconverterexamples.cpp | 114 ++ .../CPP/htmltextwriter_addstyleattribute.cpp | 65 + .../HtmlTextWriter_Methods/CPP/htw.cpp | 116 ++ .../HtmlTextWriter_Methods1/CPP/htw2.cpp | 73 + .../CPP/htmltextwriter_methods3.cpp | 126 ++ .../CPP/htmltextwriter_methods4.cpp | 120 ++ .../CPP/htmltextwriter_properties1.cpp | 81 + .../CPP/htmltextwriter.cpp | 59 + .../CPP/urlbuilderdesigner.cpp | 103 + .../CPP/accesssitemapprovider.cpp | 219 +++ .../CPP/webcustomcontrol1.cpp | 175 ++ .../ActiveDesignerEventArgs/CPP/class1.cpp | 15 + .../CPP/activedesignereventhandlerexample.cpp | 41 + .../AngleEditor/CPP/angleeditor.cpp | 335 ++++ .../cpp/AppSettingsSample.cpp | 321 ++++ .../Appearance/CPP/form1.cpp | 34 + .../Application/CPP/source.cpp | 249 +++ .../ArrayEditorExample/CPP/class1.cpp | 41 + .../CPP/basicsplitcontainer.cpp | 179 ++ .../CPP/canceledit.cpp | 161 ++ .../CPP/bindingmanagerbase_removeat.cpp | 126 ++ ...dingmanagerbase_suspend_resume_binding.cpp | 209 +++ .../Binding_Editable/CPP/binding_editable.cpp | 412 ++++ .../CPP/bindingscollectionthis.cpp | 39 + .../BitmapEditorExample/CPP/usercontrol1.cpp | 65 + .../CPP/bufferingtest.cpp | 176 ++ .../CPP/bufferingexamples.cpp | 76 + .../ButtonState/CPP/buttonstate1.cpp | 49 + .../ByteViewerExample/CPP/form1.cpp | 149 ++ .../CPP/toolboxcategorynamescontrol.cpp | 81 + .../CheckedListBox/CPP/source.cpp | 163 ++ .../CPP/checkoutexceptionexample.cpp | 19 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 50 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 89 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 27 + .../CPP/Source.cpp | 38 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 74 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 39 + .../Classic Binding Example/CPP/source.cpp | 281 +++ .../CPP/source.cpp | 34 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 83 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 81 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 172 ++ .../Classic Clipboard Example/CPP/source.cpp | 51 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 91 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 99 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 65 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 18 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 58 + .../CPP/source.cpp | 74 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 51 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 79 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 29 + .../Classic DataGrid Example/CPP/source.cpp | 252 +++ .../CPP/source.cpp | 24 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 50 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 64 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 53 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 44 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 73 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 75 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 50 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 70 + .../Classic DataObject Example/CPP/source.cpp | 55 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 43 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 55 + .../CPP/source.cpp | 57 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 51 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 100 + .../CPP/source.cpp | 29 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 68 + .../CPP/source.cpp | 65 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 33 + .../Classic FontDialog Example/CPP/source.cpp | 34 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 23 + .../CPP/source.cpp | 95 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 99 + .../CPP/source.cpp | 58 + .../CPP/source.cpp | 22 + .../CPP/source.cpp | 60 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 21 + .../CPP/source.cpp | 29 + .../Classic HScrollBar Example/CPP/source.cpp | 27 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 25 + .../Classic ImageList Example/CPP/source.cpp | 224 +++ .../CPP/source.cpp | 45 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 52 + .../CPP/source2.cpp | 39 + .../Classic Label Example/CPP/source.cpp | 43 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 43 + .../Classic ListBox Example/CPP/source.cpp | 63 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 34 + .../Classic Margins Example/CPP/source.cpp | 65 + .../CPP/source.cpp | 68 + .../Classic Menu Example/CPP/source.cpp | 49 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 59 + .../CPP/source.cpp | 25 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 24 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 58 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 67 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 29 + .../Classic MessageBox Example/CPP/source.cpp | 29 + .../CPP/source.cpp | 84 + .../Classic OSFeature Example/CPP/source.cpp | 48 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 52 + .../CPP/source.cpp | 53 + .../Classic Panel Example/CPP/source.cpp | 42 + .../CPP/source.cpp | 26 + .../Classic PictureBox Example/CPP/source.cpp | 52 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 116 ++ .../CPP/source.cpp | 39 + .../CPP/source.cpp | 87 + .../CPP/source.cpp | 111 ++ .../CPP/source.cpp | 85 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 91 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 41 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 30 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 40 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 38 + .../CPP/source.cpp | 46 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 36 + .../CPP/source.cpp | 34 + .../CPP/source.cpp | 146 ++ .../CPP/source.cpp | 36 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 56 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 71 + .../CPP/source.cpp | 73 + .../CPP/source.cpp | 39 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 33 + .../Classic TabControl Example/CPP/source.cpp | 139 ++ .../CPP/source.cpp | 37 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 42 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 72 + .../CPP/source.cpp | 47 + .../CPP/source.cpp | 33 + .../CPP/source.cpp | 26 + .../CPP/source.cpp | 35 + .../CPP/source.cpp | 32 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 71 + .../Classic Timer Example 2/CPP/source.cpp | 67 + .../CPP/source.cpp | 37 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 28 + .../CPP/source.cpp | 70 + .../CPP/source.cpp | 27 + .../CPP/source.cpp | 31 + .../CPP/source.cpp | 54 + .../CPP/source.cpp | 69 + .../CPP/source.cpp | 37 + .../Classic UpDownBase Example/CPP/source.cpp | 106 ++ .../CPP/source.cpp | 90 + .../CPP/source.cpp | 45 + .../CPP/source.cpp | 163 ++ .../CPP/source.cpp | 219 +++ .../Classic VScrollBar Example/CPP/source.cpp | 30 + .../ClearItems/CPP/clearitems.cpp | 112 ++ .../CloneMenu/CPP/form1.cpp | 106 ++ .../CPP/source.cpp | 21 + .../ComboBox/CPP/comboboxmembers.cpp | 138 ++ .../ComboBox/CPP/comboboxtype.cpp | 140 ++ .../CPP/componentchangedeventargsexample.cpp | 28 + .../componentchangedeventhandlerexample.cpp | 36 + .../CPP/componentchangingeventargsexample.cpp | 26 + .../componentchangingeventhandlerexample.cpp | 34 + .../CPP/examplecomponent.cpp | 62 + .../CPP/componenteventargsexample.cpp | 27 + .../CPP/componenteventhandlerexample.cpp | 46 + .../CPP/componentrenameeventargsexample.cpp | 29 + .../componentrenameeventhandlerexample.cpp | 38 + .../ContainsItems/CPP/containsitems.cpp | 55 + .../ContextStackExample/CPP/class1.cpp | 36 + .../Control.ControlRemoved/CPP/form1.cpp | 162 ++ .../Control.DoubleClick/CPP/form1.cpp | 142 ++ .../Control.Enter/CPP/form1.cpp | 128 ++ .../Control.FindForm/CPP/form1.cpp | 126 ++ .../Control.KeyDown/CPP/form1.cpp | 134 ++ .../Control.KeyUp/CPP/form1.cpp | 113 ++ .../Control.Layout/CPP/layout.cpp | 74 + .../Control.Move/CPP/form1.cpp | 86 + .../Control.Paint/CPP/form1.cpp | 109 ++ .../Control.Validating/CPP/validating.cpp | 114 ++ .../CPP/controlcollection.cpp | 223 +++ .../CPP/controldesignerexample.cpp | 97 + .../CPP/controliskeylocked.cpp | 21 + .../CPP/control_begininvoke.cpp | 121 ++ .../control_contextmenu_creategraphics.cpp | 157 ++ .../Control_Font/CPP/control_font.cpp | 92 + .../Control_Invoke1/CPP/control_invoke1.cpp | 115 ++ .../Control_Invoke2/CPP/control_invoke2.cpp | 109 ++ .../Control_Scale1/CPP/control_scale1.cpp | 135 ++ .../CPP/control_stylechanged.cpp | 98 + .../CPP/control_visiblechanged.cpp | 107 ++ .../Converters/CPP/converters.cpp | 264 +++ .../CountProperty/CPP/countitems.cpp | 45 + .../CreateParams/CPP/createparams.cpp | 199 ++ .../CurrencyManager.List Example/CPP/list.cpp | 68 + .../CursorFromResource/CPP/mycursor.cpp | 153 ++ .../CPP/dataformats_dif.cpp | 48 + .../CPP/dataformats_getformat.cpp | 26 + .../CPP/dataformats_stringformat.cpp | 46 + .../CPP/dataformats_unicodetext.cpp | 57 + .../CPP/overridemousedown.cpp | 133 ++ .../CPP/boolcolumn.cpp | 252 +++ .../CPP/datagridboolcolumn.cpp | 284 +++ .../CPP/timecolumn.cpp | 292 +++ .../datagridcolumnstyle_alignmentchanged.cpp | 123 ++ .../datagridcolumnstyle_headertextchanged.cpp | 126 ++ ...datagridcolumnstyle_mappingnamechanged.cpp | 135 ++ .../datagridcolumnstyle_nulltextchanged.cpp | 132 ++ .../CPP/propertydescriptorchanged.cpp | 128 ++ .../datagridcolumnstyle_readonlychanged.cpp | 126 ++ .../datagridcolumnstyle_resetheadertext.cpp | 116 ++ .../CPP/datagridcolumnstyle_widthchanged.cpp | 229 +++ .../CPP/bindarray.cpp | 284 +++ .../CPP/datagridtablestyle_forecolor.cpp | 190 ++ .../CPP/datagridtablestyle_header_4.cpp | 241 +++ ...atagridtablestyle_preferredcolumnwidth.cpp | 220 +++ .../datagridtablestyle_preferredrowheight.cpp | 141 ++ .../CPP/preferredrowheightchanged.cpp | 152 ++ .../datagridtablestyle_readonlychanged.cpp | 133 ++ .../CPP/resetalternatingbackcolor.cpp | 117 ++ .../CPP/datagridtablestyle_resetbackcolor.cpp | 123 ++ .../CPP/datagridtablestyle_resetforecolor.cpp | 144 ++ .../datagridtablestyle_resetgridlinecolor.cpp | 132 ++ ...atagridtablestyle_resetheaderbackcolor.cpp | 133 ++ .../datagridtablestyle_resetheaderfont1.cpp | 124 ++ ...atagridtablestyle_resetheaderforecolor.cpp | 137 ++ .../CPP/datagridtablestyle_resetlinkcolor.cpp | 288 +++ .../CPP/rowheaderwidth.cpp | 217 +++ .../CPP/rowheadersvisiblechanged.cpp | 186 ++ .../CPP/datagridtablestyle_sample.cpp | 268 +++ .../CPP/datagridtablestyle_sample2.cpp | 247 +++ .../CPP/datagridtablestyle_sample3.cpp | 286 +++ .../CPP/selectionbackcolor.cpp | 234 +++ .../CPP/selectionforecolor.cpp | 237 +++ .../CPP/datagridtablestyle_sample1.cpp | 256 +++ .../CPP/datagridtablestyle_sample5.cpp | 257 +++ .../CPP/datagridtextboxcolumn format.cpp | 34 + .../CPP/datagridtextboxcolumn_2.cpp | 147 ++ ...datagridtextbox_isineditornavigatemode.cpp | 165 ++ .../CPP/datagridtextbox_setdatagrid.cpp | 149 ++ .../CPP/mydatagrid_allownavigationchanged.cpp | 213 +++ .../CPP/mydatagrid_backgroundcolorchanged.cpp | 216 +++ .../CPP/mydatagrid_captionvisiblechanged.cpp | 244 +++ .../DataGrid_ColorMembers/CPP/datagrid_10.cpp | 731 ++++++++ .../datagrid_parentrowslabelstylechanged.cpp | 197 ++ .../datagrid_showparentdetailsbuttonclick.cpp | 156 ++ .../CPP/datagrid_unselect.cpp | 145 ++ .../CPP/calendarfont.cpp | 29 + .../CPP/calendarforecolor.cpp | 27 + .../CPP/calendarmonthbackground.cpp | 27 + .../DateTimePicker.Value/CPP/value.cpp | 31 + .../CPP/form1.cpp | 126 ++ .../CPP/examplecomponent.cpp | 43 + .../CPP/designereventargsexample.cpp | 29 + .../CPP/designereventhandlerexample.cpp | 36 + .../DesignerHostAcquisition/CPP/source.cpp | 29 + .../CPP/source.cpp | 41 + .../DesignerTransaction Sample/CPP/source.cpp | 196 ++ ...signertransactioncloseeventargsexample.cpp | 31 + ...nertransactioncloseeventhandlerexample.cpp | 42 + .../DesignerVerb Example/CPP/component1.cpp | 65 + .../CPP/class1.cpp | 85 + .../DisplayRectangle1/CPP/form1.cpp | 48 + .../DlgOpenFileReadOnly/CPP/form1.cpp | 112 ++ .../DrawItem/CPP/drawitem.cpp | 62 + .../DrawMode/CPP/drawmode.cpp | 51 + .../EditorAttributesExample/CPP/class1.cpp | 132 ++ .../CPP/ctleditorbrowsable.cpp | 41 + .../EventDescriptor/CPP/eventdescriptor.cpp | 117 ++ .../EventsTabExample/CPP/class1.cpp | 106 ++ .../CPP/extenderlistserviceexample.cpp | 72 + .../CPP/extenderservicedesigner.cpp | 101 + .../FontDialog.ShowApply/CPP/form1.cpp | 131 ++ .../Form.AddOwnedForm/CPP/form1.cpp | 132 ++ .../Form.AutoScroll/CPP/form1.cpp | 127 ++ .../Form.Closing/CPP/form1.cpp | 122 ++ .../Form.MDIChildren/CPP/form1.cpp | 144 ++ .../Form.MDIParent/CPP/form1.cpp | 122 ++ .../Form.Modal/CPP/form1.cpp | 123 ++ .../Form.Opacity/CPP/form1.cpp | 121 ++ .../Form.OwnedForms/CPP/form1.cpp | 140 ++ .../Form.ShowInTaskbar/CPP/form1.cpp | 114 ++ .../Form.SizeGripStyle/CPP/form1.cpp | 115 ++ .../Form.TopMost/CPP/form1.cpp | 125 ++ .../FormBorderStyle/CPP/form1.cpp | 41 + .../CPP/formstartposition.cpp | 44 + .../FormWindowState/CPP/formwindowstate.cpp | 41 + .../GetContextMenu2/CPP/form1.cpp | 135 ++ .../GetData1/CPP/getdata1.cpp | 119 ++ .../GetData2/CPP/getdata2.cpp | 109 ++ .../GetData3/CPP/getdata3.cpp | 113 ++ .../GetDataPresent1/CPP/getdatapresent1.cpp | 85 + .../GetDataPresent2/CPP/getdatapresent2.cpp | 130 ++ .../GetDataPresent3/CPP/getdatapresent3.cpp | 110 ++ .../GetFormats1/CPP/getformats1.cpp | 38 + .../GetFormats2/CPP/getformats2.cpp | 47 + .../GetMainMenu/CPP/form1.cpp | 130 ++ .../GetTabPageOfComponent/CPP/form1.cpp | 62 + .../GetTabRect/CPP/gettabrect.cpp | 51 + .../gridcolumnstylescollection_members.cpp | 307 +++ .../gridcolumnstylescollection_removeat.cpp | 216 +++ .../CPP/resetpropertydescriptor.cpp | 148 ++ .../CPP/gridtablestylescollectionexamples.cpp | 162 ++ .../CPP/fontdialogoverride.cpp | 66 + .../HorizontalAlignment/CPP/form1.cpp | 109 ++ .../HotTrack/CPP/form1.cpp | 50 + .../HtmlElementEventHandler/CPP/form1.cpp | 121 ++ .../CPP/mybutton.cpp | 61 + .../CPP/icomponentchangeserviceexample.cpp | 173 ++ .../CPP/mycontainercontrol.cpp | 61 + .../CPP/source.cpp | 143 ++ .../IDesignerExample/CPP/testcontrol.cpp | 93 + .../CPP/idesignerhostexample.cpp | 151 ++ .../CPP/idesigneroptionservicecontrol.cpp | 95 + .../idesignerserializationmanagersample.cpp | 88 + .../IDictionaryServiceExample/CPP/source.cpp | 143 ++ .../CPP/source.cpp | 117 ++ .../IHelpServiceExample/CPP/source.cpp | 68 + .../CPP/class1.cpp | 102 + .../CPP/ireferenceserviceexample.cpp | 176 ++ .../IResourceServiceExample/CPP/source.cpp | 138 ++ .../IRootDesigner Sample/CPP/class1.cpp | 124 ++ .../CPP/csiselectionserviceexample.cpp | 139 ++ .../CPP/selectioncomponent.cpp | 141 ++ .../CPP/serviceform.cpp | 580 ++++++ .../CPP/itoolboxservicecontrol.cpp | 239 +++ .../IToolboxUserExample/CPP/samplecontrol.cpp | 178 ++ .../CPP/source.cpp | 372 ++++ .../CPP/ityperesolutionservicecontrol.cpp | 373 ++++ .../IUIServiceExample/CPP/class1.cpp | 124 ++ .../IndexOf/CPP/indexof.cpp | 56 + .../InputLanguageChanged/CPP/form1.cpp | 49 + .../CPP/instancedescriptor.cpp | 154 ++ .../IsParent/CPP/form1.cpp | 112 ++ .../ItemSize/CPP/form1.cpp | 44 + .../KeyEventArgs.Modifiers/CPP/form1.cpp | 120 ++ .../KeyPressEventArgs/CPP/form1.cpp | 36 + .../Label_Image/CPP/form1.cpp | 99 + .../LayoutEventArgs/CPP/form1.cpp | 149 ++ .../LicenseException/CPP/licenseex.cpp | 99 + .../LinkLabel Overview/CPP/linklabelex.cpp | 111 ++ .../ListBox.FindString/CPP/form1.cpp | 162 ++ .../ListBox.FindString2/CPP/form1.cpp | 131 ++ .../ListBox.FindStringExact/CPP/form1.cpp | 129 ++ .../ListBox.FindStringExact2/CPP/form1.cpp | 158 ++ .../ListBox.GetSelected/CPP/form1.cpp | 158 ++ .../ListBox.PreferredHeight/CPP/form1.cpp | 121 ++ .../ListBox.SelectedIndex/CPP/form1.cpp | 133 ++ .../CPP/form1.cpp | 125 ++ .../ListBox.UseTabStops/CPP/form1.cpp | 113 ++ .../ListControl/CPP/form1.cpp | 104 + .../ListView.AfterLabelEdit/CPP/form1.cpp | 144 ++ .../CPP/listviewsort1.cpp | 121 ++ .../ListView.HorizontalExtent/CPP/form1.cpp | 138 ++ .../ListViewExample/CPP/form1.cpp | 177 ++ .../CPP/class1.cpp | 205 ++ .../MeasureItemEventArgs/CPP/form1.cpp | 134 ++ .../MenuCommand Example/CPP/component1.cpp | 38 + .../MenuItem.Popup/CPP/form1.cpp | 177 ++ .../MenuItem.Select/CPP/form1.cpp | 180 ++ .../MenuItemClick/CPP/form1.cpp | 118 ++ .../MergeMenu/CPP/form1.cpp | 111 ++ .../MessageBox.Show Variations/CPP/form1.cpp | 233 +++ .../MonthCalendar/CPP/mc.cpp | 487 +++++ .../MoreEventArgsExamples/CPP/class1.cpp | 59 + .../MoreEventHandlerExamples/CPP/form1.cpp | 105 ++ .../Multiline/CPP/form1.cpp | 56 + .../CPP/mydatagridclass_flatmode_readonly.cpp | 213 +++ .../mydatagridclass_resetheaderbackcolor.cpp | 385 ++++ .../NativeWindow/CPP/form1.cpp | 165 ++ .../OwnerDraw example/CPP/form1.cpp | 163 ++ .../Padding/CPP/form1.cpp | 50 + .../CPP/source.cpp | 338 ++++ .../ParentForm2/CPP/form1.cpp | 117 ++ .../ParentForm2/CPP/form2.cpp | 91 + .../ParentMenu/CPP/form1.cpp | 106 ++ .../PerformClick/CPP/form1.cpp | 116 ++ .../PerformSelect/CPP/form1.cpp | 116 ++ .../CPP/powerstatusbrowser.cpp | 92 + .../ProgressBar.Increment/CPP/form1.cpp | 168 ++ .../ProgressBarOverview/CPP/form1.cpp | 151 ++ .../CPP/propertydescriptor.cpp | 121 ++ .../PropertyTabExample/CPP/class1.cpp | 90 + .../RefreshEventHandler/CPP/refreshevent.cpp | 137 ++ .../RemoveAt/CPP/removeat.cpp | 49 + .../RemoveMenuItems/CPP/removeitems.cpp | 116 ++ .../RichTextBox.AllowDrop/CPP/form1.cpp | 140 ++ .../RichTextBox.BulletIndent/CPP/form1.cpp | 157 ++ .../RichTextBox.FindChar1/CPP/form1.cpp | 136 ++ .../RichTextBox.FindChar2/CPP/form1.cpp | 138 ++ .../CPP/form1.cpp | 139 ++ .../RichTextBox.GetCharAtIndex/CPP/form1.cpp | 112 ++ .../CPP/form1.cpp | 118 ++ .../RichTextBox.MaxLength/CPP/form1.cpp | 124 ++ .../RichTextBox.RedoAction/CPP/form1.cpp | 127 ++ .../CPP/form1.cpp | 129 ++ .../RichTextBox.SelectionBullet/CPP/form1.cpp | 152 ++ .../CPP/form1.cpp | 151 ++ .../CPP/form1.cpp | 130 ++ .../RichTextBox.SelectionIndent/CPP/form1.cpp | 130 ++ .../RichTextBox.SelectionLength/CPP/form1.cpp | 131 ++ .../CPP/form1.cpp | 133 ++ .../CPP/form1.cpp | 134 ++ .../RichTextBox.ZoomFactor/CPP/form1.cpp | 129 ++ .../RichTextDragDrop/CPP/form1.cpp | 146 ++ .../RichText_Paste/CPP/form1.cpp | 124 ++ .../RowCount/CPP/form1.cpp | 50 + .../Screen Object Example/CPP/form1.cpp | 130 ++ .../Screen.FromPoint/CPP/form1.cpp | 104 + .../SelectedIndex/CPP/form1.cpp | 52 + .../SelectedTab/CPP/form1.cpp | 50 + .../CPP/serviceform.cpp | 421 +++++ .../ServiceContainerExample/CPP/form1.cpp | 232 +++ .../SetData1/CPP/setdata1.cpp | 56 + .../SetData2/CPP/setdata2.cpp | 43 + .../SetData3/CPP/setdata3.cpp | 58 + .../SetData4/CPP/form1.cpp | 111 ++ .../SizeMode/CPP/form1.cpp | 45 + .../CPP/splitcontainerevents.cpp | 90 + .../Splitter Example/CPP/form1.cpp | 112 ++ .../CPP/form1.cpp | 144 ++ .../StatusBar.DrawItem/CPP/form1.cpp | 148 ++ .../CPP/fibonacciform.cpp | 310 +++ .../CPP/form1.cpp | 263 +++ .../cpp/form1.cpp | 112 ++ .../CPP/form1.cpp | 197 ++ .../CPP/form1.cpp | 297 +++ .../CPP/form1.cpp | 568 ++++++ .../CPP/form1.cpp | 192 ++ .../CPP/form1.cpp | 276 +++ .../CPP/form1.cpp | 224 +++ .../CPP/form1.cpp | 1666 +++++++++++++++++ .../CPP/form1.cpp | 1292 +++++++++++++ .../CPP/form1.cpp | 1410 ++++++++++++++ .../cpp/form1.cpp | 83 + .../CPP/form1.cpp | 300 +++ .../CPP/form1.cpp | 55 + .../CPP/form1.cpp | 55 + .../CPP/form1.cpp | 65 + .../CPP/form1.cpp | 273 +++ .../CPP/form1.cpp | 133 ++ .../CPP/form1.cpp | 147 ++ .../CPP/form1.cpp | 401 ++++ .../CPP/form1.cpp | 273 +++ .../CPP/form1.cpp | 240 +++ .../CPP/form1.cpp | 74 + .../System.Drawing.Converters/CPP/form1.cpp | 122 ++ .../CPP/form1.cpp | 753 ++++++++ .../CPP/form1.cpp | 569 ++++++ .../CPP/form1.cpp | 276 +++ .../CPP/form1.cpp | 393 ++++ .../CPP/form1.cpp | 145 ++ .../CPP/form1.cpp | 256 +++ .../System.Drawing.FontsExample/cpp/form1.cpp | 203 ++ .../CPP/form1.cpp | 237 +++ .../System.Drawing.ImageExample/CPP/form1.cpp | 381 ++++ .../CPP/form1.cpp | 57 + .../cpp/form1.cpp | 146 ++ .../System.Drawing.Misc2/CPP/form1.cpp | 295 +++ .../System.Drawing.MiscExamples/CPP/form1.cpp | 489 +++++ .../System.Drawing.PensExample/CPP/form1.cpp | 169 ++ .../CPP/form1.cpp | 268 +++ .../CPP/form1.cpp | 275 +++ .../cpp/usercontrol1.cpp | 270 +++ .../CPP/chartcontrol.cpp | 599 ++++++ .../CPP/form1.cpp | 46 + .../cpp/form1.cpp | 201 ++ .../cpp/form1.cpp | 155 ++ .../CPP/form1.cpp | 166 ++ .../CPP/form1.cpp | 100 + .../CPP/form1.cpp | 87 + .../CPP/form1.cpp | 153 ++ .../CPP/form1.cpp | 146 ++ .../cpp/form1.cpp | 172 ++ .../CPP/form1.cpp | 127 ++ .../CPP/form1.cpp | 319 ++++ .../CPP/form1.cpp | 168 ++ .../CPP/form1.cpp | 81 + .../CPP/form1.cpp | 80 + .../CPP/form1.cpp | 103 + .../CPP/form1.cpp | 146 ++ .../CPP/form1.cpp | 71 + .../CPP/form1.cpp | 152 ++ .../CPP/form1.cpp | 98 + .../CPP/cursorstuff.cpp | 135 ++ .../CPP/cursorexample.cpp | 120 ++ .../CPP/form1.cpp | 181 ++ .../CPP/form1.cpp | 253 +++ .../CPP/form1.cpp | 169 ++ .../CPP/form1.cpp | 178 ++ .../CPP/form1.cpp | 215 +++ .../cpp/form1.cpp | 120 ++ .../CPP/autosizing.cpp | 303 +++ .../CPP/DataGridViewBandDemo.cpp | 328 ++++ .../CPP/DataGridViewColumnDemo.cpp | 441 +++++ .../CPP/DataGridViewRowDemo.cpp | 304 +++ .../CPP/tictactoe.cpp | 480 +++++ .../CPP/mousesizing.cpp | 311 +++ .../CPP/programmaticsizing.cpp | 281 +++ .../CPP/datagridviewrowtemplate.cpp | 48 + .../CPP/virtualmode.cpp | 355 ++++ .../CPP/virtual.cpp | 174 ++ .../cpp/datagridviewcell.tooltiptext.cpp | 89 + .../CPP/employees.cpp | 479 +++++ .../cpp/trivaluevirtualcheckbox.cpp | 96 + .../CPP/sharedrows.cpp | 210 +++ .../CPP/form1.cpp | 118 ++ .../cpp/Form1.cpp | 227 +++ .../CPP/errorproviderexample.cpp | 215 +++ .../CPP/filedialogform.cpp | 203 ++ .../cpp/form1.cpp | 243 +++ .../CPP/form1.cpp | 167 ++ .../CPP/form1.cpp | 164 ++ .../CPP/form1.cpp | 137 ++ .../CPP/form1.cpp | 151 ++ .../CPP/form1.cpp | 214 +++ .../CPP/form1.cpp | 165 ++ .../CPP/form1.cpp | 364 ++++ .../CPP/form1.cpp | 136 ++ .../cpp/form1.cpp | 130 ++ .../CPP/helpsnippet.cpp | 158 ++ .../CPP/helpevent.cpp | 117 ++ .../CPP/form1.cpp | 128 ++ .../CPP/helpprovider.cpp | 121 ++ .../CPP/form1.cpp | 150 ++ .../CPP/form1.cpp | 211 +++ .../CPP/form1.cpp | 85 + .../cpp/DemoFlowLayout.cpp | 134 ++ .../CPP/linklabel.cpp | 100 + .../CPP/form1.cpp | 138 ++ .../CPP/form1.cpp | 152 ++ .../CPP/form1.cpp | 105 ++ .../CPP/listviewgroupsexample.cpp | 258 +++ .../CPP/listviewinsertionmarkexample.cpp | 160 ++ .../CPP/listviewtilingexample.cpp | 88 + .../CPP/form1.cpp | 153 ++ .../CPP/form1.cpp | 170 ++ .../CPP/form1.cpp | 81 + .../CPP/form1.cpp | 106 ++ .../CPP/form1.cpp | 167 ++ .../cpp/form1.cpp | 188 ++ .../CPP/form1.cpp | 103 + .../CPP/form1.cpp | 115 ++ .../CPP/form1.cpp | 92 + .../CPP/form1.cpp | 141 ++ .../CPP/form1.cpp | 112 ++ .../CPP/form1.cpp | 233 +++ .../CPP/monthcalendar.cpp | 115 ++ .../CPP/form1.cpp | 53 + .../CPP/mouseeventexample.cpp | 268 +++ .../CPP/source.cpp | 95 + .../CPP/form1.cpp | 98 + .../CPP/form1.cpp | 103 + .../CPP/form1.cpp | 124 ++ .../system.windows.forms.sound.playasync.cpp | 103 + .../CPP/form1.cpp | 140 ++ .../CPP/form1.cpp | 124 ++ .../CPP/form1.cpp | 103 + .../cpp/form1.cpp | 227 +++ .../CPP/form1.cpp | 144 ++ .../cpp/form1.cpp | 161 ++ .../CPP/form1.cpp | 170 ++ .../CPP/form1.cpp | 160 ++ .../CPP/form1.cpp | 129 ++ .../CPP/form1.cpp | 95 + .../cpp/form1.cpp | 421 +++++ .../CPP/form1.cpp | 127 ++ .../CPP/selectionrangeobj.cpp | 173 ++ .../CPP/form1.cpp | 110 ++ .../CPP/soundtestform.cpp | 414 ++++ .../CPP/form1.cpp | 144 ++ .../CPP/form1.cpp | 148 ++ .../CPP/form1.cpp | 119 ++ .../cpp/form1.cpp | 156 ++ .../CPP/form1.cpp | 137 ++ .../cpp/form1.cpp | 132 ++ .../CPP/form1.cpp | 151 ++ .../CPP/form1.cpp | 469 +++++ .../CPP/form1.cpp | 332 ++++ .../CPP/form1.cpp | 155 ++ .../CPP/source.cpp | 73 + .../CPP/form1.cpp | 128 ++ .../cpp/form1.cpp | 234 +++ .../CPP/form1.cpp | 241 +++ .../CPP/form1.cpp | 133 ++ .../cpp/Form1.cpp | 267 +++ .../cpp/form1.cpp | 384 ++++ .../cpp/form1.cpp | 73 + .../cpp/form1.cpp | 438 +++++ .../cpp/visualstylestate.cpp | 96 + .../CPP/form1.cpp | 502 +++++ .../SystemEvents/cpp/SystemEvents.cpp | 57 + .../CPP/sysinfobrowser.cpp | 114 ++ .../SystemSoundsExample/CPP/form1.cpp | 82 + .../TabAlignment/CPP/form1.cpp | 54 + .../TabControl.ImageList/CPP/form1.cpp | 48 + .../TabControl_constructor/CPP/form1.cpp | 42 + .../TabCount/CPP/form1.cpp | 48 + .../TabPage.ImageIndex/CPP/form1.cpp | 44 + .../TabPage.ToString/CPP/form1.cpp | 46 + .../TabPage/CPP/form1.cpp | 46 + .../TabPageCollection.Add/CPP/form1.cpp | 38 + .../TabPageCollection.AddRange/CPP/form1.cpp | 43 + .../TabPageCollection.Clear/CPP/form1.cpp | 48 + .../TabPageCollection.Contains/CPP/form1.cpp | 49 + .../TabPageCollection.Count/CPP/form1.cpp | 49 + .../TabPageCollection.IndexOf/CPP/form1.cpp | 40 + .../CPP/form1.cpp | 44 + .../TabPageCollection.Remove/CPP/form1.cpp | 47 + .../TabPageCollection.RemoveAt/CPP/form1.cpp | 52 + .../TabPageControlCollection.Add/CPP/add.cpp | 43 + .../TabPage_constructor/CPP/form1.cpp | 38 + .../TabPage_withText/CPP/form1.cpp | 43 + .../TabText/CPP/form1.cpp | 45 + .../TextBoxBase.AppendText/CPP/form1.cpp | 141 ++ .../ToolBar/CPP/mytoolbar.cpp | 226 +++ .../ToolTip Example/CPP/form1.cpp | 110 ++ .../ToolTipText/CPP/form1.cpp | 51 + .../CPP/textdatatextboxcomponent.cpp | 168 ++ .../CPP/class1.cpp | 54 + .../Trackbar/CPP/form1.cpp | 197 ++ .../CPP/treenodecollection.cpp | 176 ++ .../CPP/treenodecollection_clear.cpp | 231 +++ ...enodecollection_contains_getenumerator.cpp | 127 ++ .../CPP/treenodecollection_count_copyto.cpp | 125 ++ .../TreeNode_Bounds/CPP/treenode_bounds.cpp | 254 +++ .../TreeNode_Checked/CPP/treenode_checked.cpp | 189 ++ .../CPP/treenode_ensurevisible_4.cpp | 222 +++ .../CPP/treenode_forecolor.cpp | 291 +++ .../TreeNode_Parent/CPP/treenode_parent.cpp | 304 +++ .../CPP/treenode_treenode.cpp | 188 ++ .../CPP/tn_checked.cpp | 136 ++ .../TreeView/CPP/treeview.cpp | 213 +++ .../CPP/treeviewcustomization.cpp | 89 + .../TreeViewDragDrop/CPP/treeviewdragdrop.cpp | 156 ++ .../CPP/treeviewownerdraw.cpp | 175 ++ .../CPP/treeviewshowcheckednodes1.cpp | 126 ++ .../CPP/treeviewshowcheckednodes2.cpp | 127 ++ .../WarningException/CPP/warningex_doc.cpp | 25 + .../Win32Exception/CPP/win32exception.cpp | 45 + .../WinForms.Control.Resize/CPP/form1.cpp | 69 + .../winformsedserviceeditordialogexample.cpp | 150 ++ ...winformsedserviceeditordropdownexample.cpp | 159 ++ .../CPP/controlmembers5.cpp | 161 ++ .../CPP/controlmembers2.cpp | 289 +++ .../CPP/controlmembers4.cpp | 213 +++ .../CPP/controlproperties.cpp | 170 ++ .../CPP/misccontrolproperties.cpp | 212 +++ .../CPP/aboutdialog.cpp | 91 + .../CPP/controlsizelocation.cpp | 125 ++ .../CPP/controlaccessibility.cpp | 152 ++ .../CPP/imagedrag.cpp | 147 ++ .../CPP/controlmembers6.cpp | 225 +++ .../CPP/controlmethods.cpp | 99 + .../CPP/onpropertychangedevents.cpp | 114 ++ .../CPP/propertychangedevents.cpp | 99 + .../CPP/scrollablecontrol.cpp | 102 + .../Windows.Forms.TreeNode/CPP/treenode.cpp | 148 ++ .../enumException/CPP/enumexception.cpp | 101 + .../BitMapMetadata/CPP/BitmapMetadata.cpp | 92 + .../BitMapMetadata/CPP/bitmapmetadata.vcxproj | 123 ++ .../BitMapMetadata/CPP/smiley.png | Bin 0 -> 4599 bytes .../BmpBitmapDecoderEncoder/CPP/BitmapFrame.h | 46 + .../CPP/anotherfile.cpp | 134 ++ .../CPP/anotherproject.vcxproj | 97 + .../CPP/anotherproject.vcxproj.filters | 32 + .../BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp | Bin 0 -> 921654 bytes .../CanvasZ-Order/CPP/CanvasZ-Order.cpp | 131 ++ .../CanvasZ-Order/CPP/canvasz-order.vcxproj | 117 ++ .../CPP/Program.cpp | 345 ++++ .../CPP/diagnoseproblematicprintjob.vcxproj | 131 ++ .../CPP/DockPanel_Ovw_Sample.cpp | 123 ++ .../CPP/dockpanel_ovw_sample.vcxproj | 123 ++ .../CPP/Program.cpp | 44 + .../CPP/enumeratesubsetofprintqueues.vcxproj | 131 ++ .../CPP/GifEncoderDecoder.cpp | 133 ++ .../CPP/gifencoderdecoder.vcxproj | 126 ++ .../GifBitmapDecoderEncoder/CPP/tulipfarm.gif | Bin 0 -> 170770 bytes .../CPP/jpegencoderdecoder.cpp | 133 ++ .../CPP/jpegencoderdecoder.vcxproj | 129 ++ .../CPP/tulipfarm.jpg | Bin 0 -> 110238 bytes .../LayoutTransform/CPP/LayoutTransform.cpp | 195 ++ .../CPP/layouttransform.vcxproj | 123 ++ .../CPP/Margin_Padding_Alignment_Sample.cpp | 220 +++ .../margin_padding_alignment_sample.vcxproj | 123 ++ .../PlotPanel/CPP/PlotPanel.cpp | 101 + .../PlotPanel/CPP/plotpanel.vcxproj | 123 ++ .../CPP/PngEncoderDecoder.cpp | 130 ++ .../CPP/pngencoderdecoder.vcxproj | 126 ++ .../PngBitmapDecoderEncoder/CPP/smiley.png | Bin 0 -> 4599 bytes .../PrinterStatusSurvey/CPP/Program.cpp | 213 +++ .../CPP/printerstatussurvey.vcxproj | 127 ++ .../ScrollViewer/CPP/ScrollViewer_wcp.cpp | 86 + .../ScrollViewer/CPP/scrollviewer_cpp.vcxproj | 118 ++ .../ShapesProcedural/CPP/ShapesProcedural.cpp | 264 +++ .../CPP/shapesprocedural.vcxproj | 123 ++ .../CPP/StackPanel_Ovw_Sample4.cpp | 141 ++ .../StackPanelOvw4/CPP/smiley_stackpanel.PNG | Bin 0 -> 4599 bytes .../CPP/stackpanel_ovw_sample4.vcxproj | 123 ++ .../CPP/TiffEncoderDecoder.cpp | 130 ++ .../CPP/tiffencoderdecoder.vcxproj | 126 ++ .../CPP/tulipfarm.tif | Bin 0 -> 697320 bytes .../ViewBoxCode/CPP/ViewboxCode.cpp | 107 ++ .../ViewBoxCode/CPP/viewboxcode.vcxproj | 123 ++ .../CPP/WDPEncoderDecoder.cpp | 142 ++ .../WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg | Bin 0 -> 110238 bytes .../WdpBitmapDecoderEncoder/CPP/tulipfarm.wdp | Bin 0 -> 124413 bytes .../CPP/wdpencoderdecoder.vcxproj | 126 ++ .../WrapPanel_Intro/CPP/WrapPanel_Code.cpp | 92 + .../CPP/wrappanel_code_cpp.vcxproj | 124 ++ .../XpsCreate/CPP/XpsCreate.cpp | 459 +++++ .../VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf | Bin 0 -> 367112 bytes .../VS_Snippets_Wpf/XpsCreate/CPP/courier.ttf | Bin 0 -> 303296 bytes .../VS_Snippets_Wpf/XpsCreate/CPP/image.tif | Bin 0 -> 72782 bytes .../VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg | Bin 0 -> 18216 bytes .../XpsCreate/CPP/xpscreate.vcxproj | 131 ++ .../CPP/InteractiveExample.cpp | 125 ++ .../CPP/LocalAnimationExample.cpp | 72 + .../CPP/animagionproperty_cpp.vcxproj | 135 ++ .../animateproperty/CPP/app.cpp | 99 + 3927 files changed, 320122 insertions(+) create mode 100644 snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp create mode 100644 snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp create mode 100644 snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp create mode 100644 snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp create mode 100644 snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp create mode 100644 snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp create mode 100644 snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/smiley.png create mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/BitmapFrame.h create mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters create mode 100644 snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp create mode 100644 snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/CanvasZ-Order.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/tulipfarm.gif create mode 100644 snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/tulipfarm.jpg create mode 100644 snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/LayoutTransform.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/smiley.png create mode 100644 snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/Program.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/smiley_stackpanel.PNG create mode 100644 snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/stackpanel_ovw_sample4.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tulipfarm.tif create mode 100644 snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/ViewboxCode.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg create mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.wdp create mode 100644 snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf create mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/courier.ttf create mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/image.tif create mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg create mode 100644 snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp create mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj create mode 100644 snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp diff --git a/snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp b/snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp new file mode 100644 index 00000000000..edf32009f79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADApplicationBase/CPP/adapplicationbase.cpp @@ -0,0 +1,29 @@ +// +using namespace System; + +int main() +{ + AppDomain^ root = AppDomain::CurrentDomain; + + AppDomainSetup^ setup = gcnew AppDomainSetup(); + setup->ApplicationBase = + root->SetupInformation->ApplicationBase + "MyAppSubfolder\\"; + + AppDomain^ domain = AppDomain::CreateDomain("MyDomain", nullptr, setup); + + Console::WriteLine("Application base of {0}:\r\n\t{1}", + root->FriendlyName, root->SetupInformation->ApplicationBase); + Console::WriteLine("Application base of {0}:\r\n\t{1}", + domain->FriendlyName, domain->SetupInformation->ApplicationBase); + + AppDomain::Unload(domain); +} + +/* This example produces output similar to the following: + +Application base of MyApp.exe: + C:\Program Files\MyApp\ +Application base of MyDomain: + C:\Program Files\MyApp\MyAppSubfolder\ + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp b/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp new file mode 100644 index 00000000000..2da48b17c60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADClearPrivatePath/CPP/adclearprivatepath.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Policy; + +//for evidence Object +int main() +{ + + //Create evidence for new appdomain. + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + //Create the new application domain. + AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence ); + + //Display the current relative search path. + Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath ); + + //Append the relative path. + String^ Newpath = "www.code.microsoft.com"; + domain->AppendPrivatePath( Newpath ); + + //Display the new relative search path. + Console::WriteLine( "Relative search path is: {0}", domain->RelativeSearchPath ); + + //Clear the private search path. + domain->ClearPrivatePath(); + + //Display the new relative search path. + Console::WriteLine( "Relative search path is now: {0}", domain->RelativeSearchPath ); + AppDomain::Unload( domain ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp b/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp new file mode 100644 index 00000000000..163e81b104a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADDynamicBase/CPP/addynamicbase.cpp @@ -0,0 +1,107 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class Example : MarshalByRefObject +{ +public: + void Test() + { + Assembly^ dynAssem = Assembly::Load( + "DynamicHelloWorld, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"); + + Type^ myType = dynAssem->GetType("HelloWorld"); + myType->InvokeMember("HelloFromAD", BindingFlags::Public | + BindingFlags::Static | BindingFlags::InvokeMethod, + Type::DefaultBinder, nullptr, nullptr); + } +}; + + +static void GenerateDynamicAssembly(String^ location) +{ + // Define the dynamic assembly and the module. There is only one + // module in this assembly. Note that the call to DefineDynamicAssembly + // specifies the location where the assembly will be saved. The + // assembly version is 1.0.0.0. + // + AssemblyName^ asmName = gcnew AssemblyName("DynamicHelloWorld"); + asmName->Version = gcnew Version("1.0.0.0"); + + AssemblyBuilder^ ab = + AppDomain::CurrentDomain->DefineDynamicAssembly( + asmName, AssemblyBuilderAccess::Save, location); + + String^ moduleName = asmName->Name + ".exe"; + ModuleBuilder^ mb = ab->DefineDynamicModule(asmName->Name, moduleName); + + // Define the "HelloWorld" type, with one static method. + TypeBuilder^ tb = mb->DefineType("HelloWorld", TypeAttributes::Public); + MethodBuilder^ hello = tb->DefineMethod("HelloFromAD", + MethodAttributes::Public | MethodAttributes::Static, nullptr, nullptr); + + // The method displays a message that contains the name of the application + // domain where the method is executed. + ILGenerator^ il = hello->GetILGenerator(); + il->Emit(OpCodes::Ldstr, "Hello from '{0}'!"); + il->Emit(OpCodes::Call, AppDomain::typeid->GetProperty("CurrentDomain")->GetGetMethod()); + il->Emit(OpCodes::Call, AppDomain::typeid->GetProperty("FriendlyName")->GetGetMethod()); + il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine", + gcnew array { String::typeid, String::typeid })); + il->Emit(OpCodes::Ret); + + // Complete the HelloWorld type and save the assembly. The assembly + // is placed in the location specified by DefineDynamicAssembly. + Type^ myType = tb->CreateType(); + ab->Save(moduleName); +}; + +void main() +{ + // Prepare to create a new application domain. + AppDomainSetup^ setup = gcnew AppDomainSetup(); + + // Set the application name before setting the dynamic base. + setup->ApplicationName = "Example"; + + // Set the location of the base directory where assembly resolution + // probes for dynamic assemblies. Note that the hash code of the + // application name is concatenated to the base directory name you + // supply. + setup->DynamicBase = "C:\\DynamicAssemblyDir"; + Console::WriteLine("DynamicBase is set to '{0}'.", setup->DynamicBase); + + AppDomain^ ad = AppDomain::CreateDomain("MyDomain", nullptr, setup); + + // The dynamic directory name is the dynamic base concatenated with + // the application name: \\ + String^ dynamicDir = ad->DynamicDirectory; + Console::WriteLine("Dynamic directory is '{0}'.", dynamicDir); + + // The AssemblyBuilder won't create this directory automatically. + if (!System::IO::Directory::Exists(dynamicDir)) + { + Console::WriteLine("Creating the dynamic directory."); + System::IO::Directory::CreateDirectory(dynamicDir); + } + + // Generate a dynamic assembly and store it in the dynamic + // directory. + GenerateDynamicAssembly(dynamicDir); + + // Create an instance of the Example class in the application domain, + // and call its Test method to load the dynamic assembly and use it. + Example^ ex = (Example^) ad->CreateInstanceAndUnwrap( + Example::typeid->Assembly->FullName, "Example"); + ex->Test(); +} + +/* This example produces output similar to the following: + +DynamicBase is set to 'C:\DynamicAssemblyDir\5e4a7545'. +Dynamic directory is 'C:\DynamicAssemblyDir\5e4a7545\Example'. +Creating the dynamic directory. +Hello from 'MyDomain'! + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp b/snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp new file mode 100644 index 00000000000..501cca2a2d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADDyno/CPP/addyno.cpp @@ -0,0 +1,126 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::Remoting; + +ref class ADDyno +{ +public: + static Type^ CreateADynamicAssembly( interior_ptr myNewDomain, String^ executableNameNoExe ) + { + String^ executableName = String::Concat( executableNameNoExe, ".exe" ); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = executableNameNoExe; + myAsmName->CodeBase = Environment::CurrentDirectory; + AssemblyBuilder^ myAsmBuilder = ( *myNewDomain)->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + Console::WriteLine( "-- Dynamic Assembly instantiated." ); + ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( executableNameNoExe, executableName ); + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( executableNameNoExe, TypeAttributes::Public, MarshalByRefObject::typeid ); + array^temp0 = nullptr; + MethodBuilder^ myFCMethod = myTypeBuilder->DefineMethod( "CountLocalFiles", static_cast(MethodAttributes::Public | MethodAttributes::Static), nullptr, temp0 ); + MethodInfo^ currentDirGetMI = Environment::typeid->GetProperty( "CurrentDirectory" )->GetGetMethod(); + array^temp1 = {String::typeid}; + MethodInfo^ writeLine0objMI = Console::typeid->GetMethod( "WriteLine", temp1 ); + array^temp2 = {String::typeid,Object::typeid,Object::typeid}; + MethodInfo^ writeLine2objMI = Console::typeid->GetMethod( "WriteLine", temp2 ); + array^temp3 = {String::typeid}; + MethodInfo^ getFilesMI = Directory::typeid->GetMethod( "GetFiles", temp3 ); + myFCMethod->InitLocals = true; + ILGenerator^ myFCIL = myFCMethod->GetILGenerator(); + Console::WriteLine( "-- Generating MSIL method body..." ); + LocalBuilder^ v0 = myFCIL->DeclareLocal( String::typeid ); + LocalBuilder^ v1 = myFCIL->DeclareLocal( int::typeid ); + LocalBuilder^ v2 = myFCIL->DeclareLocal( String::typeid ); + LocalBuilder^ v3 = myFCIL->DeclareLocal( array::typeid ); + Label evalForEachLabel = myFCIL->DefineLabel(); + Label topOfForEachLabel = myFCIL->DefineLabel(); + + // Build the method body. + myFCIL->EmitCall( OpCodes::Call, currentDirGetMI, nullptr ); + myFCIL->Emit( OpCodes::Stloc_S, v0 ); + myFCIL->Emit( OpCodes::Ldc_I4_0 ); + myFCIL->Emit( OpCodes::Stloc_S, v1 ); + myFCIL->Emit( OpCodes::Ldstr, "---" ); + myFCIL->EmitCall( OpCodes::Call, writeLine0objMI, nullptr ); + myFCIL->Emit( OpCodes::Ldloc_S, v0 ); + myFCIL->EmitCall( OpCodes::Call, getFilesMI, nullptr ); + myFCIL->Emit( OpCodes::Stloc_S, v3 ); + myFCIL->Emit( OpCodes::Br_S, evalForEachLabel ); + + // foreach loop starts here. + myFCIL->MarkLabel( topOfForEachLabel ); + + // Load array of strings and index, store value at index for output. + myFCIL->Emit( OpCodes::Ldloc_S, v3 ); + myFCIL->Emit( OpCodes::Ldloc_S, v1 ); + myFCIL->Emit( OpCodes::Ldelem_Ref ); + myFCIL->Emit( OpCodes::Stloc_S, v2 ); + myFCIL->Emit( OpCodes::Ldloc_S, v2 ); + myFCIL->EmitCall( OpCodes::Call, writeLine0objMI, nullptr ); + + // Increment counter by one. + myFCIL->Emit( OpCodes::Ldloc_S, v1 ); + myFCIL->Emit( OpCodes::Ldc_I4_1 ); + myFCIL->Emit( OpCodes::Add ); + myFCIL->Emit( OpCodes::Stloc_S, v1 ); + + // Determine if end of file list array has been reached. + myFCIL->MarkLabel( evalForEachLabel ); + myFCIL->Emit( OpCodes::Ldloc_S, v1 ); + myFCIL->Emit( OpCodes::Ldloc_S, v3 ); + myFCIL->Emit( OpCodes::Ldlen ); + myFCIL->Emit( OpCodes::Conv_I4 ); + myFCIL->Emit( OpCodes::Blt_S, topOfForEachLabel ); + + //foreach loop end here. + myFCIL->Emit( OpCodes::Ldstr, "---" ); + myFCIL->EmitCall( OpCodes::Call, writeLine0objMI, nullptr ); + myFCIL->Emit( OpCodes::Ldstr, "There are {0} files in {1}." ); + myFCIL->Emit( OpCodes::Ldloc_S, v1 ); + myFCIL->Emit( OpCodes::Box, int::typeid ); + myFCIL->Emit( OpCodes::Ldloc_S, v0 ); + myFCIL->EmitCall( OpCodes::Call, writeLine2objMI, nullptr ); + myFCIL->Emit( OpCodes::Ret ); + Type^ myType = myTypeBuilder->CreateType(); + myAsmBuilder->SetEntryPoint( myFCMethod ); + myAsmBuilder->Save( executableName ); + Console::WriteLine( "-- Method generated, type completed, and assembly saved to disk." ); + return myType; + } +}; + +int main() +{ + String^ domainDir; + String^ executableName = nullptr; + Console::Write( "Enter a name for the file counting assembly: " ); + String^ executableNameNoExe = Console::ReadLine(); + executableName = String::Concat( executableNameNoExe, ".exe" ); + Console::WriteLine( "---" ); + domainDir = Environment::CurrentDirectory; + AppDomain^ curDomain = Thread::GetDomain(); + + // Create a new AppDomain, with the current directory as the base. + Console::WriteLine( "Current Directory: {0}", Environment::CurrentDirectory ); + AppDomainSetup^ mySetupInfo = gcnew AppDomainSetup; + mySetupInfo->ApplicationBase = domainDir; + mySetupInfo->ApplicationName = executableNameNoExe; + mySetupInfo->LoaderOptimization = LoaderOptimization::SingleDomain; + AppDomain^ myDomain = AppDomain::CreateDomain( executableNameNoExe, nullptr, mySetupInfo ); + Console::WriteLine( "Creating a new AppDomain '{0}'...", executableNameNoExe ); + Console::WriteLine( "-- Base Directory = '{0}'", myDomain->BaseDirectory ); + Console::WriteLine( "-- Shadow Copy? = '{0}'", myDomain->ShadowCopyFiles ); + Console::WriteLine( "---" ); + Type^ myFCType = ADDyno::CreateADynamicAssembly( &curDomain, executableNameNoExe ); + Console::WriteLine( "Loading '{0}' from '{1}'...", executableName, myDomain->BaseDirectory ); + BindingFlags bFlags = static_cast(BindingFlags::Public | BindingFlags::CreateInstance | BindingFlags::Instance); + Object^ myObjInstance = myDomain->CreateInstanceAndUnwrap( executableNameNoExe, executableNameNoExe, false, bFlags, nullptr, nullptr, nullptr, nullptr, nullptr ); + Console::WriteLine( "Executing method 'CountLocalFiles' in {0}...", myObjInstance ); + array^temp4 = nullptr; + myFCType->InvokeMember( "CountLocalFiles", BindingFlags::InvokeMethod, nullptr, myObjInstance, temp4 ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp b/snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp new file mode 100644 index 00000000000..fb5fa78276b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADGetAssemblies/CPP/adgetassemblies.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Policy; + +//for Evidence Object +int main() +{ + AppDomain^ currentDomain = AppDomain::CurrentDomain; + + //Provide the current application domain evidence for the assembly. + Evidence^ asEvidence = currentDomain->Evidence; + + //Load the assembly from the application directory using a simple name. + //Create an assembly called CustomLibrary to run this sample. + currentDomain->Load( "CustomLibrary", asEvidence ); + + //Make an array for the list of assemblies. + array^assems = currentDomain->GetAssemblies(); + + //List the assemblies in the current application domain. + Console::WriteLine( "List of assemblies loaded in current appdomain:" ); + System::Collections::IEnumerator^ myEnum = assems->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Assembly^ assem = safe_cast(myEnum->Current); + Console::WriteLine( assem ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp b/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp new file mode 100644 index 00000000000..2c9683ae785 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADGetData/CPP/adgetdata.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Reflection; + +int main() +{ + // appdomain setup information + AppDomain^ currentDomain = AppDomain::CurrentDomain; + + //Create a new value pair for the appdomain + currentDomain->SetData( "ADVALUE", "Example value" ); + + //get the value specified in the setdata method + Console::WriteLine( "ADVALUE is: {0}", currentDomain->GetData( "ADVALUE" ) ); + + //get a system value specified at appdomainsetup + Console::WriteLine( "System value for loader optimization: {0}", + currentDomain->GetData( "LOADER_OPTIMIZATION" ) ); +} + +/* This code example produces the following output: + +ADVALUE is: Example value +System value for loader optimization: NotSpecified + */ + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp b/snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp new file mode 100644 index 00000000000..0cace0ddf7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADMultiDomain/CPP/admultidomain.cpp @@ -0,0 +1,49 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Policy; + +ref class Worker : MarshalByRefObject +{ +public: + void TestLoad() + { + // You must supply a valid fully qualified assembly name here. + Assembly::Load("Text assembly name, Culture, PublicKeyToken, Version"); + for each (Assembly^ assem in AppDomain::CurrentDomain->GetAssemblies()) + Console::WriteLine(assem->FullName); + } +}; + +//for evidence Object* +// The following attribute indicates to loader that multiple application +// domains are used in this application. + +[LoaderOptimizationAttribute(LoaderOptimization::MultiDomainHost)] +int main() +{ + + // Create application domain setup information for new application domain. + AppDomainSetup^ domaininfo = gcnew AppDomainSetup; + domaininfo->ApplicationBase = System::Environment::CurrentDirectory; + domaininfo->ApplicationName = "MyMultiDomain Application"; + + //Create evidence for the new appdomain from evidence of current application domain. + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + // Create appdomain. + AppDomain^ newDomain = AppDomain::CreateDomain( "MyMultiDomain", adevidence, domaininfo ); + + // Load an assembly into the new application domain. + Worker^ w = (Worker^) newDomain->CreateInstanceAndUnwrap( + Worker::typeid->Assembly->GetName()->Name, + "Worker" + ); + w->TestLoad(); + + //Unload the application domain, which also unloads the assembly. + AppDomain::Unload(newDomain); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp b/snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp new file mode 100644 index 00000000000..d7de6e72c21 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADPrincipal/CPP/adprincipal.cpp @@ -0,0 +1,55 @@ + +// +using namespace System; +using namespace System::Security::Principal; +using namespace System::Threading; +ref class ADPrincipal +{ +public: + static void PrintPrincipalInformation() + { + IPrincipal^ curPrincipal = Thread::CurrentPrincipal; + if ( curPrincipal != nullptr ) + { + Console::WriteLine( "Type: {0}", curPrincipal->GetType()->Name ); + Console::WriteLine( "Name: {0}", curPrincipal->Identity->Name ); + Console::WriteLine( "Authenticated: {0}", curPrincipal->Identity->IsAuthenticated ); + Console::WriteLine(); + } + } + +}; + +int main() +{ + + // Create a new thread with a generic principal. + Thread^ t = gcnew Thread( gcnew ThreadStart( ADPrincipal::PrintPrincipalInformation ) ); + t->Start(); + t->Join(); + + // Set the principal policy to WindowsPrincipal. + AppDomain^ currentDomain = AppDomain::CurrentDomain; + currentDomain->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal ); + + // The new thread will have a Windows principal representing the + // current user. + t = gcnew Thread( gcnew ThreadStart( ADPrincipal::PrintPrincipalInformation ) ); + t->Start(); + t->Join(); + + // Create a principal to use for new threads. + IIdentity^ identity = gcnew GenericIdentity( "NewUser" ); + IPrincipal^ principal = gcnew GenericPrincipal( identity,nullptr ); + currentDomain->SetThreadPrincipal( principal ); + + // Create a new thread with the principal created above. + t = gcnew Thread( gcnew ThreadStart( ADPrincipal::PrintPrincipalInformation ) ); + t->Start(); + t->Join(); + + // Wait for user input before terminating. + Console::ReadLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp b/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp new file mode 100644 index 00000000000..54f58550e69 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADSetAppDomainPolicy/CPP/adsetappdomainpolicy.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; +int main() +{ + + // Create a new application domain. + AppDomain^ domain = System::AppDomain::CreateDomain( "MyDomain" ); + + // Create a new AppDomain PolicyLevel. + PolicyLevel^ polLevel = PolicyLevel::CreateAppDomainLevel(); + + // Create a new, empty permission set. + PermissionSet^ permSet = gcnew PermissionSet( PermissionState::None ); + + // Add permission to execute code to the permission set. + permSet->AddPermission( gcnew SecurityPermission( SecurityPermissionFlag::Execution ) ); + + // Give the policy level's root code group a new policy statement based + // on the new permission set. + polLevel->RootCodeGroup->PolicyStatement = gcnew PolicyStatement( permSet ); + + // Give the new policy level to the application domain. + domain->SetAppDomainPolicy( polLevel ); + + // Try to execute the assembly. + try + { + + // This will throw a PolicyException if the executable tries to + // access any resources like file I/O or tries to create a window. + domain->ExecuteAssembly( "Assemblies\\MyWindowsExe.exe" ); + } + catch ( PolicyException^ e ) + { + Console::WriteLine( "PolicyException: {0}", e->Message ); + } + + AppDomain::Unload( domain ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp b/snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp new file mode 100644 index 00000000000..17c1ac6e7ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADSetup/CPP/adsetup.cpp @@ -0,0 +1,39 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Reflection; +using namespace System::Security::Policy; // For Evidence object. + +int main() +{ + + // Create application domain setup information + AppDomainSetup^ domaininfo = gcnew AppDomainSetup; + domaininfo->ConfigurationFile = String::Format("{0}{1}ADSetup.exe.config", + Environment::CurrentDirectory, + Path::DirectorySeparatorChar); + domaininfo->ApplicationBase = String::Format("{0}", System::Environment::CurrentDirectory); + + //Create evidence for the new appdomain from evidence of the current application domain + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + // Create appdomain + AppDomain^ domain = AppDomain::CreateDomain("Domain2", adevidence, domaininfo); + + // Display application domain information + Console::WriteLine("Host domain: {0}", AppDomain::CurrentDomain->FriendlyName); + Console::WriteLine("Child domain: {0}", domain->FriendlyName); + Console::WriteLine(); + Console::WriteLine("Configuration file: {0}", domain->SetupInformation->ConfigurationFile); + Console::WriteLine( "Application Base Directory: {0}", domain->BaseDirectory); + + AppDomain::Unload(domain); +} +// The example displays output like the following: +// Host domain: adsetup.exe +// Child domain: Domain2 +// +// Configuration file: C:\Test\ADSetup.exe.config +// Application Base Directory: C:\Test +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp b/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp new file mode 100644 index 00000000000..228dd62f2ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADShadowCopy/CPP/adshadowcopy.cpp @@ -0,0 +1,66 @@ + +// +using namespace System; +using namespace System::Security::Policy; + +//for evidence Object* +int main() +{ + AppDomainSetup^ setup = gcnew AppDomainSetup; + + // Shadow copying will not work unless the application has a name. + setup->ApplicationName = "MyApplication"; + + //Create evidence for the new application domain from evidence of + // current application domain. + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + // Create a new application domain. + AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup ); + + // MyAssembly.dll is located in the Assemblies subdirectory. + domain->AppendPrivatePath( "Assemblies" ); + + // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the + // MoreAssemblies subdirectory. + domain->AppendPrivatePath( "MoreAssemblies" ); + + // Display the relative search path. + Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath ); + + // Because Load returns an Assembly Object*, the assemblies must be + // loaded into the current domain as well. This will fail unless the + // current domain also has these directories in its search path. + AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" ); + AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" ); + + // Save shadow copies to C:\Cache + domain->SetCachePath( "C:\\Cache" ); + + // Shadow copy only the assemblies in the Assemblies directory. + domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) ); + + // Turn shadow copying on. + domain->SetShadowCopyFiles(); + + // This will be copied. + // You must supply a valid fully qualified assembly name here. + domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" ); + + // This will not be copied. + // You must supply a valid fully qualified assembly name here. + domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" ); + + // When the shadow copy path is cleared, the CLR will make shadow copies + // of all private assemblies. + domain->ClearShadowCopyPath(); + + // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. + // You must supply a valid fully qualified assembly name here. + domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" ); + + // Unload the domain. + AppDomain::Unload( domain ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp b/snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp new file mode 100644 index 00000000000..52694e50b43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADToString/CPP/adtostring.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Policy; + +//for evidence Object* +int main() +{ + + // Create application domain setup information + AppDomainSetup^ domaininfo = gcnew AppDomainSetup; + + //Create evidence for the new appdomain from evidence of the current application domain + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + // Create appdomain + AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, domaininfo ); + + // Write out application domain information + Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName ); + Console::WriteLine( "child domain: {0}", domain->FriendlyName ); + Console::WriteLine( "child domain name using ToString: {0}", domain ); + Console::WriteLine(); + AppDomain::Unload( domain ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp b/snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp new file mode 100644 index 00000000000..66cd1bdcd86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ADUnload/CPP/adunload.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Policy; + +//for evidence Object* +int main() +{ + + //Create evidence for the new appdomain. + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + // Create the new application domain. + AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence ); + Console::WriteLine( "Host domain: {0}", AppDomain::CurrentDomain->FriendlyName ); + Console::WriteLine( "child domain: {0}", domain->FriendlyName ); + + // Unload the application domain. + AppDomain::Unload( domain ); + try + { + Console::WriteLine(); + + // Note that the following statement creates an exception because the domain no longer exists. + Console::WriteLine( "child domain: {0}", domain->FriendlyName ); + } + catch ( AppDomainUnloadedException^ /*e*/ ) + { + Console::WriteLine( "The appdomain MyDomain does not exist." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp new file mode 100644 index 00000000000..23f9d8bfc08 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/ActivatorX.cpp @@ -0,0 +1,48 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Text; + +public ref class SomeType +{ +public: + void DoSomething(int x) + { + Console::WriteLine("100 / {0} = {1}", x, 100 / x); + } +}; + +void main() +{ + // + // Create an instance of the StringBuilder type using + // Activator.CreateInstance. + Object^ o = Activator::CreateInstance(StringBuilder::typeid); + + // Append a string into the StringBuilder object and display the + // StringBuilder. + StringBuilder^ sb = (StringBuilder^) o; + sb->Append("Hello, there."); + Console::WriteLine(sb); + // + + // + // Create an instance of the SomeType class that is defined in this + // assembly. + System::Runtime::Remoting::ObjectHandle^ oh = + Activator::CreateInstanceFrom(Assembly::GetEntryAssembly()->CodeBase, + SomeType::typeid->FullName); + + // Call an instance method defined by the SomeType type using this object. + SomeType^ st = (SomeType^) oh->Unwrap(); + + st->DoSomething(5); + // +}; + +/* This code produces the following output: + +Hello, there. +100 / 5 = 20 + */ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp new file mode 100644 index 00000000000..d02d7ca37f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ActivatorX/cpp/source2.cpp @@ -0,0 +1,67 @@ +// +using namespace System; + +ref class DynamicInstanceList +{ +private: + static String^ instanceSpec = "System.EventArgs;System.Random;" + + "System.Exception;System.Object;System.Version"; + +public: + static void Main() + { + array^ instances = instanceSpec->Split(';'); + Array^ instlist = Array::CreateInstance(Object::typeid, instances->Length); + Object^ item; + + for (int i = 0; i < instances->Length; i++) + { + // create the object from the specification string + Console::WriteLine("Creating instance of: {0}", instances[i]); + item = Activator::CreateInstance(Type::GetType(instances[i])); + instlist->SetValue(item, i); + } + Console::WriteLine("\nObjects and their default values:\n"); + for each (Object^ o in instlist) + { + Console::WriteLine("Type: {0}\nValue: {1}\nHashCode: {2}\n", + o->GetType()->FullName, o->ToString(), o->GetHashCode()); + } + } +}; + +int main() +{ + DynamicInstanceList::Main(); +} + +// This program will display output similar to the following: +// +// Creating instance of: System.EventArgs +// Creating instance of: System.Random +// Creating instance of: System.Exception +// Creating instance of: System.Object +// Creating instance of: System.Version +// +// Objects and their default values: +// +// Type: System.EventArgs +// Value: System.EventArgs +// HashCode: 46104728 +// +// Type: System.Random +// Value: System.Random +// HashCode: 12289376 +// +// Type: System.Exception +// Value: System.Exception: Exception of type 'System.Exception' was thrown. +// HashCode: 55530882 +// +// Type: System.Object +// Value: System.Object +// HashCode: 30015890 +// +// Type: System.Version +// Value: 0.0 +// HashCode: 1048575 +// diff --git a/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp b/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp new file mode 100644 index 00000000000..46b9455a618 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AnimalAttributes/CPP/customattribute.cpp @@ -0,0 +1,98 @@ + +// +using namespace System; +using namespace System::Reflection; + +// An enumeration of animals. Start at 1 (0 = uninitialized). +public enum class Animal +{ + // Pets. + Dog = 1, + Cat, Bird +}; + +// A custom attribute to allow a target to have a pet. +public ref class AnimalTypeAttribute: public Attribute +{ +public: + + // The constructor is called when the attribute is set. + AnimalTypeAttribute( Animal pet ) + { + thePet = pet; + } + + +protected: + + // Keep a variable internally ... + Animal thePet; + +public: + + property Animal Pet + { + // .. and show a copy to the outside world. + Animal get() + { + return thePet; + } + + void set( Animal value ) + { + thePet = value; + } + } +}; + +// A test class where each method has its own pet. +ref class AnimalTypeTestClass +{ +public: + + [AnimalType(Animal::Dog)] + void DogMethod(){} + + + [AnimalType(Animal::Cat)] + void CatMethod(){} + + [AnimalType(Animal::Bird)] + void BirdMethod(){} + +}; + +int main() +{ + AnimalTypeTestClass^ testClass = gcnew AnimalTypeTestClass; + Type^ type = testClass->GetType(); + + // Iterate through all the methods of the class. + System::Collections::IEnumerator^ myEnum = + type->GetMethods()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MethodInfo^ mInfo = safe_cast(myEnum->Current); + + // Iterate through all the Attributes for each method. + System::Collections::IEnumerator^ myEnum1 = + Attribute::GetCustomAttributes( mInfo )->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Attribute^ attr = safe_cast(myEnum1->Current); + + // Check for the AnimalType attribute. + if ( attr->GetType() == AnimalTypeAttribute::typeid ) + Console::WriteLine( "Method {0} has a pet {1} attribute.", + mInfo->Name, (dynamic_cast(attr))->Pet ); + } + } +} + +/* + * Output: + * Method DogMethod has a pet Dog attribute. + * Method CatMethod has a pet Cat attribute. + * Method BirdMethod has a pet Bird attribute. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp new file mode 100644 index 00000000000..c5dd8fefacd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain.ReflectionOnlyGetAssemblies/CPP/reflectiononly.cpp @@ -0,0 +1,47 @@ + +// +using namespace System; +using namespace System::Reflection; + +#using + +using namespace System::Timers; +using namespace System::Collections; +int main() +{ + + // Get the assembly display name for System.dll, the assembly + // that contains System.Timers.Timer. Note that this causes + // System.dll to be loaded into the execution context. + // + String^ displayName = Timer::typeid->Assembly->FullName; + + // Load System.dll into the reflection-only context. Note that + // if you obtain the display name (for example, by running this + // example program), and enter it as a literal string in the + // preceding line of code, you can load System.dll into the + // reflection-only context without loading it into the execution + // context. + Assembly::ReflectionOnlyLoad( displayName ); + + // Display the assemblies loaded into the execution and + // reflection-only contexts. System.dll appears in both contexts. + // + Console::WriteLine( L"------------- Execution Context --------------" ); + IEnumerator^ myEnum = AppDomain::CurrentDomain->GetAssemblies()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Assembly^ a = safe_cast(myEnum->Current); + Console::WriteLine( L"\t{0}", a->GetName() ); + } + + Console::WriteLine( L"------------- Reflection-only Context --------------" ); + IEnumerator^ myEnum1 = AppDomain::CurrentDomain->ReflectionOnlyGetAssemblies()->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Assembly^ a = safe_cast(myEnum1->Current); + Console::WriteLine( L"\t{0}", a->GetName() ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp new file mode 100644 index 00000000000..bd93fb5f6a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomainInitializer/cpp/source.cpp @@ -0,0 +1,68 @@ +// +using namespace System; +using namespace System::Security::Policy; + +public ref class AppDomainInitializerExample +{ + // The callback method invoked when the child application domain is + // initialized. The method simply displays the arguments that were + // passed to it. + // +public: + static void AppDomainInit(array^ args) + { + Console::WriteLine("AppDomain \"{0}\" is initialized with these " + + "arguments:", AppDomain::CurrentDomain->FriendlyName); + for each (String^ arg in args) + { + Console::WriteLine(" {0}", arg); + } + } +}; + +int main() +{ + // Get a reference to the default application domain. + // + AppDomain^ currentDomain = AppDomain::CurrentDomain; + + // Create the AppDomainSetup that will be used to set up the child + // AppDomain. + AppDomainSetup^ domainSetup = gcnew AppDomainSetup(); + + // Use the evidence from the default application domain to + // create evidence for the child application domain. + // + Evidence^ evidence = gcnew Evidence(currentDomain->Evidence); + + // Create an AppDomainInitializer delegate that represents the + // callback method, AppDomainInit. Assign this delegate to the + // AppDomainInitializer property of the AppDomainSetup object. + // + AppDomainInitializer^ domainInitializer = + gcnew AppDomainInitializer(AppDomainInitializerExample::AppDomainInit); + domainSetup->AppDomainInitializer = domainInitializer; + + // Create an array of strings to pass as arguments to the callback + // method. Assign the array to the AppDomainInitializerArguments + // property. + array^ initialArguments = {"String1", "String2"}; + domainSetup->AppDomainInitializerArguments = initialArguments; + + // Create a child application domain named "ChildDomain", using + // the evidence and the AppDomainSetup object. + // + AppDomain^ appDomain = AppDomain::CreateDomain("ChildDomain", + evidence, domainSetup); + + Console::WriteLine("Press the Enter key to exit the example program."); + Console::ReadLine(); +} + +/* This code example produces the following output: + +AppDomain "ChildDomain" is initialized with these arguments: +String1 +String2 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp new file mode 100644 index 00000000000..c3e20a5292a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomainX/cpp/AppDomainX.cpp @@ -0,0 +1,102 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Threading; +using namespace System::Security::Policy; + +// +// Because this class is derived from MarshalByRefObject, a proxy +// to a MarshalByRefType object can be returned across an AppDomain +// boundary. +ref class MarshalByRefType : MarshalByRefObject +{ +public: + // Call this method via a proxy. + void SomeMethod(String^ callingDomainName) + { + // Get this AppDomain's settings and display some of them. + AppDomainSetup^ ads = AppDomain::CurrentDomain->SetupInformation; + Console::WriteLine("AppName={0}, AppBase={1}, ConfigFile={2}", + ads->ApplicationName, + ads->ApplicationBase, + ads->ConfigurationFile + ); + + // Display the name of the calling AppDomain and the name + // of the second domain. + // NOTE: The application's thread has transitioned between + // AppDomains. + Console::WriteLine("Calling from '{0}' to '{1}'.", + callingDomainName, + Thread::GetDomain()->FriendlyName + ); + }; +}; +// + +// +void main() +{ + // Get and display the friendly name of the default AppDomain. + String^ callingDomainName = Thread::GetDomain()->FriendlyName; + Console::WriteLine(callingDomainName); + + // Get and display the full name of the EXE assembly. + String^ exeAssembly = Assembly::GetEntryAssembly()->FullName; + Console::WriteLine(exeAssembly); + + // Construct and initialize settings for a second AppDomain. + AppDomainSetup^ ads = gcnew AppDomainSetup(); + ads->ApplicationBase = AppDomain::CurrentDomain->BaseDirectory; + + ads->DisallowBindingRedirects = false; + ads->DisallowCodeDownload = true; + ads->ConfigurationFile = + AppDomain::CurrentDomain->SetupInformation->ConfigurationFile; + + // Create the second AppDomain. + AppDomain^ ad2 = AppDomain::CreateDomain("AD #2", + AppDomain::CurrentDomain->Evidence, ads); + + // Create an instance of MarshalbyRefType in the second AppDomain. + // A proxy to the object is returned. + MarshalByRefType^ mbrt = + (MarshalByRefType^) ad2->CreateInstanceAndUnwrap( + exeAssembly, + MarshalByRefType::typeid->FullName + ); + + // Call a method on the object via the proxy, passing the + // default AppDomain's friendly name in as a parameter. + mbrt->SomeMethod(callingDomainName); + + // Unload the second AppDomain. This deletes its object and + // invalidates the proxy object. + AppDomain::Unload(ad2); + try + { + // Call the method again. Note that this time it fails + // because the second AppDomain was unloaded. + mbrt->SomeMethod(callingDomainName); + Console::WriteLine("Sucessful call."); + } + catch(AppDomainUnloadedException^) + { + Console::WriteLine("Failed call; this is expected."); + } +} +// + +/* This code produces output similar to the following: + +AppDomainX.exe +AppDomainX, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null +AppName=, AppBase=C:\AppDomain\bin, ConfigFile=C:\AppDomain\bin\AppDomainX.exe.config +Calling from 'AppDomainX.exe' to 'AD #2'. +Failed call; this is expected. + */ +// + + + + diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp new file mode 100644 index 00000000000..ecd3b28ecd6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_AssemblyLoad/CPP/assemblyload.cpp @@ -0,0 +1,45 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class Test +{ +public: + static void MyAssemblyLoadEventHandler( Object^ sender, AssemblyLoadEventArgs^ args ) + { + Console::WriteLine( "ASSEMBLY LOADED: {0}", args->LoadedAssembly->FullName ); + Console::WriteLine(); + } + +}; + +void PrintLoadedAssemblies( AppDomain^ domain ) +{ + Console::WriteLine( "LOADED ASSEMBLIES:" ); + System::Collections::IEnumerator^ myEnum = domain->GetAssemblies()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Assembly^ a = safe_cast(myEnum->Current); + Console::WriteLine( a->FullName ); + } + + Console::WriteLine(); +} + +int main() +{ + AppDomain^ currentDomain = AppDomain::CurrentDomain; + currentDomain->AssemblyLoad += gcnew AssemblyLoadEventHandler( Test::MyAssemblyLoadEventHandler ); + PrintLoadedAssemblies( currentDomain ); + + // Lists mscorlib and this assembly + // You must supply a valid fully qualified assembly name here. + currentDomain->CreateInstance( "System.Windows.Forms, Version, Culture, PublicKeyToken", "System.Windows.Forms.TextBox" ); + + // Loads System, System::Drawing, System::Windows::Forms + PrintLoadedAssemblies( currentDomain ); + + // Lists all five assemblies +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp new file mode 100644 index 00000000000..94f31e4024a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateComInstanceFrom/CPP/createcominstancefrom.cpp @@ -0,0 +1,51 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +[ComVisible(true)] +public ref class MyComVisibleType +{ +public: + MyComVisibleType() + { + Console::WriteLine( "MyComVisibleType instantiated!" ); + } + +}; + + +[ComVisible(false)] +public ref class MyComNonVisibleType +{ +public: + MyComNonVisibleType() + { + Console::WriteLine( "MyComNonVisibleType instantiated!" ); + } + +}; + +void CreateComInstance( String^ typeName ) +{ + try + { + AppDomain^ currentDomain = AppDomain::CurrentDomain; + String^ assemblyName = currentDomain->FriendlyName; + currentDomain->CreateComInstanceFrom( assemblyName, typeName ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +int main() +{ + CreateComInstance( "MyComNonVisibleType" ); // Fail! + CreateComInstance( "MyComVisibleType" ); // OK! +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp new file mode 100644 index 00000000000..5348a8644bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_CreateInstance_IgnoreCase/CPP/ignorecase.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::Reflection; +static void InstantiateINT32( bool ignoreCase ) +{ + try + { + AppDomain^ currentDomain = AppDomain::CurrentDomain; + Object^ instance = currentDomain->CreateInstanceAndUnwrap( + "mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", + "SYSTEM.INT32", + ignoreCase, + BindingFlags::Default, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr ); + Console::WriteLine( instance->GetType() ); + } + catch ( TypeLoadException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +int main() +{ + InstantiateINT32( false ); // Failed! + InstantiateINT32( true ); // OK! +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp new file mode 100644 index 00000000000..ae2ce9f4402 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_DefineDynamicAssembly/CPP/definedynamicassembly.cpp @@ -0,0 +1,56 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +ref class Test +{ +public: + static void InstantiateMyDynamicType( AppDomain^ domain ) + { + try + { + + // You must supply a valid fully qualified assembly name here. + domain->CreateInstance( "Assembly text name, Version, Culture, PublicKeyToken", "MyDynamicType" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + + } + + static Assembly^ MyResolveEventHandler( Object^ sender, ResolveEventArgs^ args ) + { + return DefineDynamicAssembly( dynamic_cast(sender) ); + } + + static Assembly^ DefineDynamicAssembly( AppDomain^ domain ) + { + + // Build a dynamic assembly using Reflection Emit API. + AssemblyName^ assemblyName = gcnew AssemblyName; + assemblyName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ assemblyBuilder = domain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Run ); + ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule( "MyDynamicModule" ); + TypeBuilder^ typeBuilder = moduleBuilder->DefineType( "MyDynamicType", TypeAttributes::Public ); + ConstructorBuilder^ constructorBuilder = typeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, nullptr ); + ILGenerator^ ilGenerator = constructorBuilder->GetILGenerator(); + ilGenerator->EmitWriteLine( "MyDynamicType instantiated!" ); + ilGenerator->Emit( OpCodes::Ret ); + typeBuilder->CreateType(); + return assemblyBuilder; + } + +}; + +int main() +{ + AppDomain^ currentDomain = AppDomain::CurrentDomain; + Test::InstantiateMyDynamicType( currentDomain ); // Failed! + currentDomain->AssemblyResolve += gcnew ResolveEventHandler( Test::MyResolveEventHandler ); + Test::InstantiateMyDynamicType( currentDomain ); // OK! +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp new file mode 100644 index 00000000000..6de7aba1837 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byref.cpp @@ -0,0 +1,48 @@ + +using namespace System; + +// +public ref class PingPong : public MarshalByRefObject +{ +private: + String^ greetings; + +public: + PingPong() + { + greetings = "PING!"; + } + + static void Main() + { + AppDomain^ otherDomain = AppDomain::CreateDomain("otherDomain"); + + PingPong^ pp = gcnew PingPong(); + pp->MyCallBack(); + pp->greetings = "PONG!"; + otherDomain->DoCallBack(gcnew CrossAppDomainDelegate( pp, &PingPong::MyCallBack)); + + // Output: + // PING! from defaultDomain + // PONG! from defaultDomain + } + + // Callback will always execute within defaultDomain due to inheritance from + // MarshalByRefObject + void MyCallBack() + { + String^ name = AppDomain::CurrentDomain->FriendlyName; + if (name == AppDomain::CurrentDomain->SetupInformation->ApplicationName) + { + name = "defaultDomain"; + } + Console::WriteLine(greetings + " from " + name); + } +}; + +int main() +{ + PingPong::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp new file mode 100644 index 00000000000..f11f478ba46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_byval.cpp @@ -0,0 +1,49 @@ + +using namespace System; + +// + +[Serializable] +public ref class PingPong +{ +private: + String^ greetings; + +public: + PingPong() + { + greetings = "PING!"; + } + + static void Main() + { + AppDomain^ otherDomain = AppDomain::CreateDomain("otherDomain"); + + PingPong^ pp = gcnew PingPong(); + pp->MyCallBack(); + pp->greetings = "PONG!"; + otherDomain->DoCallBack(gcnew CrossAppDomainDelegate( pp, &PingPong::MyCallBack)); + + // Output: + // PING! from defaultDomain + // PONG! from otherDomain + } + + void MyCallBack() + { + String^ name = AppDomain::CurrentDomain->FriendlyName; + + if (name == AppDomain::CurrentDomain->SetupInformation->ApplicationName) + { + name = "defaultDomain"; + } + Console::WriteLine(greetings + " from " + name); + } +}; + +int main() +{ + PingPong::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp new file mode 100644 index 00000000000..3a97986292e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_DoCallBack/CPP/docallback_static.cpp @@ -0,0 +1,40 @@ + +using namespace System; + +// +public ref class PingPong +{ +private: + static String^ greetings = "PONG!"; + +public: + static void Main() + { + AppDomain^ otherDomain = AppDomain::CreateDomain("otherDomain"); + + greetings = "PING!"; + MyCallBack(); + otherDomain->DoCallBack(gcnew CrossAppDomainDelegate(MyCallBack)); + + // Output: + // PING! from defaultDomain + // PONG! from otherDomain + } + + static void MyCallBack() + { + String^ name = AppDomain::CurrentDomain->FriendlyName; + + if (name == AppDomain::CurrentDomain->SetupInformation->ApplicationName) + { + name = "defaultDomain"; + } + Console::WriteLine(greetings + " from " + name); + } +}; + +int main() +{ + PingPong::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp new file mode 100644 index 00000000000..51295fdce3f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_ExecuteAssembly/CPP/executeassembly.cpp @@ -0,0 +1,17 @@ + +using namespace System; + +// +int main() +{ + AppDomain^ currentDomain = AppDomain::CurrentDomain; + AppDomain^ otherDomain = AppDomain::CreateDomain( "otherDomain" ); + currentDomain->ExecuteAssembly( "MyExecutable.exe" ); + + // Prints S"MyExecutable running on [default]" + otherDomain->ExecuteAssembly( "MyExecutable.exe" ); + + // Prints S"MyExecutable running on otherDomain" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp new file mode 100644 index 00000000000..b17c8ebe02b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_LoadRaw/CPP/loadraw.cpp @@ -0,0 +1,77 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +void InstantiateMyType( AppDomain^ domain ) +{ + try + { + + // You must supply a valid fully qualified assembly name here. + domain->CreateInstance( "Assembly text name, Version, Culture, PublicKeyToken", "MyType" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} + + +// Loads the content of a file to a Byte array. +array^ loadFile( String^ filename ) +{ + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + array^buffer = gcnew array((int)fs->Length); + fs->Read( buffer, 0, buffer->Length ); + fs->Close(); + return buffer; +} + + +// Creates a dynamic assembly with symbol information +// and saves them to temp.dll and temp.pdb +void EmitAssembly( AppDomain^ domain ) +{ + AssemblyName^ assemblyName = gcnew AssemblyName; + assemblyName->Name = "MyAssembly"; + AssemblyBuilder^ assemblyBuilder = domain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Save ); + ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule( "MyModule", "temp.dll", true ); + TypeBuilder^ typeBuilder = moduleBuilder->DefineType( "MyType", TypeAttributes::Public ); + ConstructorBuilder^ constructorBuilder = typeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, nullptr ); + ILGenerator^ ilGenerator = constructorBuilder->GetILGenerator(); + ilGenerator->EmitWriteLine( "MyType instantiated!" ); + ilGenerator->Emit( OpCodes::Ret ); + typeBuilder->CreateType(); + assemblyBuilder->Save( "temp.dll" ); +} + +ref class Resolver +{ +public: + static Assembly^ MyResolver( Object^ sender, ResolveEventArgs^ args ) + { + AppDomain^ domain = dynamic_cast(sender); + + // Once the files are generated, this call is + // actually no longer necessary. + EmitAssembly( domain ); + array^rawAssembly = loadFile( "temp.dll" ); + array^rawSymbolStore = loadFile( "temp.pdb" ); + Assembly^ assembly = domain->Load( rawAssembly, rawSymbolStore ); + return assembly; + } + +}; + +int main() +{ + AppDomain^ currentDomain = AppDomain::CurrentDomain; + InstantiateMyType( currentDomain ); // Failed! + currentDomain->AssemblyResolve += gcnew ResolveEventHandler( Resolver::MyResolver ); + InstantiateMyType( currentDomain ); // OK! +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp new file mode 100644 index 00000000000..1b6c10fd7b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_Setup/CPP/setup.cpp @@ -0,0 +1,21 @@ +using namespace System; +using namespace System::Security::Policy; + +int main() +{ + // + // Set up the AppDomainSetup + AppDomainSetup^ setup = gcnew AppDomainSetup; + setup->ApplicationBase = "(some directory)"; + setup->ConfigurationFile = "(some file)"; + + // Set up the Evidence + Evidence^ baseEvidence = AppDomain::CurrentDomain->Evidence; + Evidence^ evidence = gcnew Evidence( baseEvidence ); + evidence->AddAssembly( "(some assembly)" ); + evidence->AddHost( "(some host)" ); + + // Create the AppDomain + AppDomain^ newDomain = AppDomain::CreateDomain( "newDomain", evidence, setup ); + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp new file mode 100644 index 00000000000..7c1b00f5f41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_TypeResolve/CPP/typeresolve.cpp @@ -0,0 +1,90 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +ref class Test +{ +private: + static Assembly^ HandleTypeResolve(Object^ sender, ResolveEventArgs^ args) + { + Console::WriteLine("TypeResolve event handler."); + + // Save the dynamic assembly, and then load it using its + // display name. Return the loaded assembly. + // + ab->Save(moduleName); + return Assembly::Load(ab->FullName); + } + + // For this code example, the following information needs to be + // available to both Demo and the HandleTypeResolve event + // handler: + static AssemblyBuilder^ ab; + static String^ moduleName; + +public: + static void Demo() + { + AppDomain^ currDom = AppDomain::CurrentDomain; + + // Create a dynamic assembly with one module, to be saved to + // disk (AssemblyBuilderAccess::Save). + // + AssemblyName^ aName = gcnew AssemblyName(); + aName->Name = "Transient"; + moduleName = aName->Name + ".dll"; + ab = currDom->DefineDynamicAssembly(aName, + AssemblyBuilderAccess::Save); + ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name, moduleName); + + // The dynamic assembly has just one dummy type, to demonstrate + // type resolution. + TypeBuilder^ tb = mb->DefineType("Example"); + tb->CreateType(); + + + // First, try to load the type without saving the dynamic + // assembly and without hooking up the TypeResolve event. The + // type cannot be loaded. + try + { + Type^ temp = Type::GetType("Example", true); + Console::WriteLine("Loaded type {0}.", temp); + } + catch (TypeLoadException^) + { + Console::WriteLine("Loader could not resolve the type."); + } + + // Hook up the TypeResolve event. + // + currDom->TypeResolve += + gcnew ResolveEventHandler(HandleTypeResolve); + + // Now try to load the type again. The TypeResolve event is + // raised, the dynamic assembly is saved, and the dummy type is + // loaded successfully. Display it to the console, and create + // an instance. + Type^ t = Type::GetType("Example", true); + Console::WriteLine("Loaded type \"{0}\".", t); + Object^ o = Activator::CreateInstance(t); + } +}; + +void main() +{ + Test::Demo(); +} + +/* This code example produces the following output: + +Loader could not resolve the type. +TypeResolve event handler. +Loaded type "Example". + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp b/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp new file mode 100644 index 00000000000..8929a8c5fda --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AppDomain_UnhandledException/CPP/unhandledexception.cpp @@ -0,0 +1,51 @@ + +// +// The example should be compiled with the /clr:pure compiler option. +using namespace System; +using namespace System::Security::Permissions; + +public ref class Example +{ + + +private: + static void MyHandler(Object^ sender, UnhandledExceptionEventArgs^ args) + { + Exception^ e = dynamic_cast(args->ExceptionObject); + Console::WriteLine( "MyHandler caught : {0}", e->Message ); + Console::WriteLine("Runtime terminating: {0}", args->IsTerminating); + } + +public: + [SecurityPermissionAttribute( SecurityAction::Demand, ControlAppDomain = true )] + static void Main() + { + AppDomain^ currentDomain = AppDomain::CurrentDomain; + currentDomain->UnhandledException += gcnew UnhandledExceptionEventHandler(Example::MyHandler); + try + { + throw gcnew Exception("1"); + } + catch (Exception^ e) + { + Console::WriteLine( "Catch clause caught : {0}\n", e->Message ); + } + + throw gcnew Exception("2"); + } +}; + +void main() +{ + Example::Main(); +} +// The example displays the following output: +// Catch clause caught : 1 +// +// MyHandler caught : 2 +// Runtime terminating: True +// +// Unhandled Exception: System.Exception: 2 +// at Example.Main() +// at mainCRTStartup(String[] arguments) +// diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp new file mode 100644 index 00000000000..34a424f0c5f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/ArgumentException.cpp @@ -0,0 +1,38 @@ +// Types:System.ArgumentException +// +using namespace System; + +// +int DivideByTwo(int num) +{ + // If num is an odd number, throw an ArgumentException. + if ((num & 1) == 1) + { + throw gcnew ArgumentException("Number must be even", "num"); + } + // num is even, return half of its value. + return num / 2; +} +// + +int main() +{ + // ArgumentException is not thrown because 10 is an even number. + Console::WriteLine("10 divided by 2 is {0}", DivideByTwo(10)); + try + { + // ArgumentException is thrown because 7 is not an even number. + Console::WriteLine("7 divided by 2 is {0}", DivideByTwo(7)); + } + catch (ArgumentException^) + { + // Show the user that 7 cannot be divided by 2. + Console::WriteLine("7 is not divided by 2 integrally."); + } +} + +// This code produces the following output. +// +// 10 divided by 2 is 5 +// 7 is not divided by 2 integrally. +// diff --git a/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp new file mode 100644 index 00000000000..63ffdbb6142 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ArgumentException/cpp/argumentexception2.cpp @@ -0,0 +1,34 @@ +// +using namespace System; + +static int DivideByTwo(int num) +{ + // If num is an odd number, throw an ArgumentException. + if ((num & 1) == 1) + throw gcnew ArgumentException(String::Format("{0} is not an even number", num), + "num"); + + // num is even, return half of its value. + return num / 2; +} + +void main() +{ + // Define some integers for a division operation. + array^ values = { 10, 7 }; + for each (int value in values) { + try { + Console::WriteLine("{0} divided by 2 is {1}", value, DivideByTwo(value)); + } + catch (ArgumentException^ e) { + Console::WriteLine("{0}: {1}", e->GetType()->Name, e->Message); + } + Console::WriteLine(); + } +} +// This example displays the following output: +// 10 divided by 2 is 5 +// +// ArgumentException: 7 is not an even number +// Parameter name: num +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp new file mode 100644 index 00000000000..dfe97aa75c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ArrayList/CPP/ArrayListSample.cpp @@ -0,0 +1,78 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; + +// +ref class ReverseStringComparer: public IComparer +{ +public: + virtual int Compare( Object^ x, Object^ y ) + { + String^ s1 = dynamic_cast(x); + String^ s2 = dynamic_cast(y); + + //negate the return value to get the reverse order + return -String::Compare( s1, s2 ); + } + +}; +// + +// +void PrintValues( String^ title, IEnumerable^ myList ) +{ + Console::Write( "{0,10}: ", title ); + StringBuilder^ sb = gcnew StringBuilder; + { + IEnumerator^ en = myList->GetEnumerator(); + String^ s; + while ( en->MoveNext() ) + { + s = en->Current->ToString(); + sb->AppendFormat( "{0}, ", s ); + } + } + sb->Remove( sb->Length - 2, 2 ); + Console::WriteLine( sb ); +} +// + +void main() +{ + // + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "Eric" ); + myAL->Add( "Mark" ); + myAL->Add( "Lance" ); + myAL->Add( "Rob" ); + myAL->Add( "Kris" ); + myAL->Add( "Brad" ); + myAL->Add( "Kit" ); + myAL->Add( "Bradley" ); + myAL->Add( "Keith" ); + myAL->Add( "Susan" ); + + // Displays the properties and values of the ArrayList. + Console::WriteLine( "Count: {0}", myAL->Count.ToString() ); + // + + PrintValues( "Unsorted", myAL ); + + // + myAL->Sort(); + PrintValues( "Sorted", myAL ); + // + + // + myAL->Sort( gcnew ReverseStringComparer ); + PrintValues( "Reverse", myAL ); + // + + // + array^names = dynamic_cast^>(myAL->ToArray( String::typeid )); + // +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp new file mode 100644 index 00000000000..3bd578173ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/CPP/arraytypemismatch_constructor1.cpp @@ -0,0 +1,56 @@ + +// System::ArrayTypeMismatchException::ArrayTypeMismatchException +/* + * The following example demonstrates the 'ArrayTypeMismatchException()' constructor of class + * ArrayTypeMismatchException class. It creates a function which takes two arrays as arguments. + * It checks whether the two arrays are of same type or not. If two arrays are not of same type + * then a new 'ArrayTypeMismatchException' object is created and thrown. That exception is caught + * in the calling method. + */ +// +using namespace System; +public ref class ArrayTypeMisMatchConst +{ +public: + void CopyArray( Array^ myArray, Array^ myArray1 ) + { + String^ typeArray1 = myArray->GetType()->ToString(); + String^ typeArray2 = myArray1->GetType()->ToString(); + + // Check whether the two arrays are of same type or not. + if ( typeArray1 == typeArray2 ) + { + + // Copy the values from one array to another. + myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 ); + myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 ); + } + else + { + + // Throw an exception of type 'ArrayTypeMismatchException'. + throw gcnew ArrayTypeMismatchException; + } + } + +}; + +int main() +{ + try + { + array^myStringArray = gcnew array(2); + myStringArray->SetValue( "Jones", 0 ); + myStringArray->SetValue( "John", 1 ); + array^myIntArray = gcnew array(2); + ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; + myArrayType->CopyArray( myStringArray, myIntArray ); + } + catch ( ArrayTypeMismatchException^ e ) + { + Console::WriteLine( "The Exception is : {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp new file mode 100644 index 00000000000..d83f12c18e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/CPP/arraytypemismatch_constructor2.cpp @@ -0,0 +1,57 @@ + +// System::ArrayTypeMismatchException::ArrayTypeMismatchException +/* + The following example demonstrates the 'ArrayTypeMismatchException(String*)' + constructor of class ArrayTypeMismatchException class. A function has been + created which takes two arrays as arguments. It checks whether the two arrays + are of same type or not. If two arrays are of not same type then a new + 'ArrayTypeMismatchException' object is created and thrown. That exception is + caught in the calling method. + */ +// +using namespace System; +public ref class ArrayTypeMisMatchConst +{ +public: + void CopyArray( Array^ myArray, Array^ myArray1 ) + { + String^ typeArray1 = myArray->GetType()->ToString(); + String^ typeArray2 = myArray1->GetType()->ToString(); + + // Check whether the two arrays are of same type or not. + if ( typeArray1 == typeArray2 ) + { + + // Copies the values from one array to another. + myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 0 )->ToString() ), 0 ); + myArray->SetValue( String::Concat( "Name: ", myArray1->GetValue( 1 )->ToString() ), 1 ); + } + else + { + + // Throw an exception of type 'ArrayTypeMismatchException' with a message String* as parameter. + throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are not of same type." ); + } + } + +}; + +int main() +{ + try + { + array^myStringArray = gcnew array(2); + myStringArray->SetValue( "Jones", 0 ); + myStringArray->SetValue( "John", 1 ); + array^myIntArray = gcnew array(2); + ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; + myArrayType->CopyArray( myStringArray, myIntArray ); + } + catch ( ArrayTypeMismatchException^ e ) + { + Console::WriteLine( "The Exception Message is : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp new file mode 100644 index 00000000000..83d9a347667 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/CPP/arraytypemismatch_constructor3.cpp @@ -0,0 +1,56 @@ + +// System::ArrayTypeMismatchException::ArrayTypeMismatchException +/* + The following example demonstrates the 'ArrayTypeMismatchException(String*, innerException)' + constructor of class ArrayTypeMismatchException class. It creates a + function which takes two arrays as arguments. It copies elements of + one array to another array. If two arrays are of not same type then + an exception has been thrown. In the 'Catch' block a new 'WebException' + object is created and thrown to the caller. That exception is caught + in the calling method and the error message is displayed to the console. + */ +// +using namespace System; +public ref class ArrayTypeMisMatchConst +{ +public: + void CopyArray( Array^ myArray, Array^ myArray1 ) + { + try + { + + // Copies the value of one array into another array. + myArray->SetValue( myArray1->GetValue( 0 ), 0 ); + myArray->SetValue( myArray1->GetValue( 1 ), 1 ); + } + catch ( Exception^ e ) + { + + // Throw an exception of with a message and innerexception. + throw gcnew ArrayTypeMismatchException( "The Source and destination arrays are of not same type.",e ); + } + + } + +}; + +int main() +{ + try + { + array^myStringArray = gcnew array(2); + myStringArray->SetValue( "Jones", 0 ); + myStringArray->SetValue( "John", 1 ); + array^myIntArray = gcnew array(2); + ArrayTypeMisMatchConst^ myArrayType = gcnew ArrayTypeMisMatchConst; + myArrayType->CopyArray( myStringArray, myIntArray ); + } + catch ( ArrayTypeMismatchException^ e ) + { + Console::WriteLine( "The Exception Message is : {0}", e->Message ); + Console::WriteLine( "The Inner exception is : {0}", e->InnerException ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp new file mode 100644 index 00000000000..6ea5b937007 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_ConvertAll/cpp/source.cpp @@ -0,0 +1,55 @@ +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections::Generic; + +Point PointFToPoint(PointF pf) +{ + return Point((int) pf.X, (int) pf.Y); +}; + +void main() +{ + // Create an array of PointF objects. + array^ apf = { + PointF(27.8F, 32.62F), + PointF(99.3F, 147.273F), + PointF(7.5F, 1412.2F) }; + + + // Display each element in the PointF array. + Console::WriteLine(); + for each(PointF p in apf) + { + Console::WriteLine(p); + } + + // Convert each PointF element to a Point object. + array^ ap = + Array::ConvertAll(apf, + gcnew Converter(PointFToPoint) + ); + + // Display each element in the Point array. + Console::WriteLine(); + for each(Point p in ap) + { + Console::WriteLine(p); + } +} + +/* This code example produces the following output: + +{X=27.8, Y=32.62} +{X=99.3, Y=147.273} +{X=7.5, Y=1412.2} + +{X=27,Y=32} +{X=99,Y=147} +{X=7,Y=1412} + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp new file mode 100644 index 00000000000..61bb710737e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_FindEtAl/cpp/source.cpp @@ -0,0 +1,169 @@ +// +using namespace System; + +public ref class DinoDiscoverySet +{ +public: + static void Main() + { + array^ dinosaurs = + { + "Compsognathus", "Amargasaurus", "Oviraptor", + "Velociraptor", "Deinonychus", "Dilophosaurus", + "Gallimimus", "Triceratops" + }; + + DinoDiscoverySet^ GoMesozoic = gcnew DinoDiscoverySet(dinosaurs); + + GoMesozoic->DiscoverAll(); + GoMesozoic->DiscoverByEnding("saurus"); + } + + DinoDiscoverySet(array^ items) + { + dinosaurs = items; + } + + void DiscoverAll() + { + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + } + + void DiscoverByEnding(String^ Ending) + { + Predicate^ dinoType; + + if (Ending->ToLower() == "raptor") + { + dinoType = + gcnew Predicate(&DinoDiscoverySet::EndsWithRaptor); + } + else if (Ending->ToLower() == "tops") + { + dinoType = + gcnew Predicate(&DinoDiscoverySet::EndsWithTops); + } + else if (Ending->ToLower() == "saurus") + { + dinoType = + gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus); + } + else + { + dinoType = + gcnew Predicate(&DinoDiscoverySet::EndsWithSaurus); + } + + Console::WriteLine( + "\nArray::Exists(dinosaurs, \"{0}\"): {1}", + Ending, + Array::Exists(dinosaurs, dinoType)); + + Console::WriteLine( + "\nArray::TrueForAll(dinosaurs, \"{0}\"): {1}", + Ending, + Array::TrueForAll(dinosaurs, dinoType)); + + Console::WriteLine( + "\nArray::Find(dinosaurs, \"{0}\"): {1}", + Ending, + Array::Find(dinosaurs, dinoType)); + + Console::WriteLine( + "\nArray::FindLast(dinosaurs, \"{0}\"): {1}", + Ending, + Array::FindLast(dinosaurs, dinoType)); + + Console::WriteLine( + "\nArray::FindAll(dinosaurs, \"{0}\"):", Ending); + + array^ subArray = + Array::FindAll(dinosaurs, dinoType); + + for each(String^ dinosaur in subArray) + { + Console::WriteLine(dinosaur); + } + } + +private: + array^ dinosaurs; + + // Search predicate returns true if a string ends in "saurus". + static bool EndsWithSaurus(String^ s) + { + if ((s->Length > 5) && + (s->Substring(s->Length - 6)->ToLower() == "saurus")) + { + return true; + } + else + { + return false; + } + } + + // Search predicate returns true if a string ends in "raptor". + static bool EndsWithRaptor(String^ s) + { + if ((s->Length > 5) && + (s->Substring(s->Length - 6)->ToLower() == "raptor")) + { + return true; + } + else + { + return false; + } + } + + // Search predicate returns true if a string ends in "tops". + static bool EndsWithTops(String^ s) + { + if ((s->Length > 3) && + (s->Substring(s->Length - 4)->ToLower() == "tops")) + { + return true; + } + else + { + return false; + } + } +}; + +int main() +{ + DinoDiscoverySet::Main(); +} + +/* This code example produces the following output: + +Compsognathus +Amargasaurus +Oviraptor +Velociraptor +Deinonychus +Dilophosaurus +Gallimimus +Triceratops + +Array.Exists(dinosaurs, "saurus"): True + +Array.TrueForAll(dinosaurs, "saurus"): False + +Array.Find(dinosaurs, "saurus"): Amargasaurus + +Array.FindLast(dinosaurs, "saurus"): Dilophosaurus + +Array.FindAll(dinosaurs, "saurus"): +Amargasaurus +Dilophosaurus +*/ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp new file mode 100644 index 00000000000..da0510c1de8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_FindIndex/cpp/source.cpp @@ -0,0 +1,60 @@ +// +using namespace System; + +// Search predicate returns true if a string ends in "saurus". +bool EndsWithSaurus(String^ s) +{ + if ((s->Length > 5) && + (s->Substring(s->Length - 6)->ToLower() == "saurus")) + { + return true; + } + else + { + return false; + } +}; + +void main() +{ + array^ dinosaurs = { "Compsognathus", + "Amargasaurus", "Oviraptor", "Velociraptor", + "Deinonychus", "Dilophosaurus", "Gallimimus", + "Triceratops" }; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nArray::FindIndex(dinosaurs, EndsWithSaurus): {0}", + Array::FindIndex(dinosaurs, gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, EndsWithSaurus): {0}", + Array::FindIndex(dinosaurs, 2, gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nArray::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): {0}", + Array::FindIndex(dinosaurs, 2, 3, gcnew Predicate(EndsWithSaurus))); +} + +/* This code example produces the following output: + +Compsognathus +Amargasaurus +Oviraptor +Velociraptor +Deinonychus +Dilophosaurus +Gallimimus +Triceratops + +Array::FindIndex(dinosaurs, EndsWithSaurus): 1 + +Array::FindIndex(dinosaurs, 2, EndsWithSaurus): 5 + +Array::FindIndex(dinosaurs, 2, 3, EndsWithSaurus): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp new file mode 100644 index 00000000000..2ce93684dce --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_FindLastIndex/cpp/source.cpp @@ -0,0 +1,60 @@ +// +using namespace System; + +// Search predicate returns true if a string ends in "saurus". +bool EndsWithSaurus(String^ s) +{ + if ((s->Length > 5) && + (s->Substring(s->Length - 6)->ToLower() == "saurus")) + { + return true; + } + else + { + return false; + } +}; + +void main() +{ + array^ dinosaurs = { "Compsognathus", + "Amargasaurus", "Oviraptor", "Velociraptor", + "Deinonychus", "Dilophosaurus", "Gallimimus", + "Triceratops" }; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nArray::FindLastIndex(dinosaurs, EndsWithSaurus): {0}", + Array::FindLastIndex(dinosaurs, gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, EndsWithSaurus): {0}", + Array::FindLastIndex(dinosaurs, 4, gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nArray::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): {0}", + Array::FindLastIndex(dinosaurs, 4, 3, gcnew Predicate(EndsWithSaurus))); +} + +/* This code example produces the following output: + +Compsognathus +Amargasaurus +Oviraptor +Velociraptor +Deinonychus +Dilophosaurus +Gallimimus +Triceratops + +Array::FindLastIndex(dinosaurs, EndsWithSaurus): 5 + +Array::FindLastIndex(dinosaurs, 4, EndsWithSaurus): 1 + +Array::FindLastIndex(dinosaurs, 4, 3, EndsWithSaurus): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp new file mode 100644 index 00000000000..946551d8cde --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_IndexOf/cpp/source.cpp @@ -0,0 +1,48 @@ +// +using namespace System; + +void main() +{ + array^ dinosaurs = { "Tyrannosaurus", + "Amargasaurus", + "Mamenchisaurus", + "Brachiosaurus", + "Deinonychus", + "Tyrannosaurus", + "Compsognathus" }; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\"): {0}", + Array::IndexOf(dinosaurs, "Tyrannosaurus")); + + Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}", + Array::IndexOf(dinosaurs, "Tyrannosaurus", 3)); + + Console::WriteLine("\nArray.IndexOf(dinosaurs, \"Tyrannosaurus\", 2, 2): {0}", + Array::IndexOf(dinosaurs, "Tyrannosaurus", 2, 2)); +} + +/* This code example produces the following output: + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Brachiosaurus +Deinonychus +Tyrannosaurus +Compsognathus + +Array.IndexOf(dinosaurs, "Tyrannosaurus"): 0 + +Array.IndexOf(dinosaurs, "Tyrannosaurus", 3): 5 + +Array.IndexOf(dinosaurs, "Tyrannosaurus", 2, 2): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp new file mode 100644 index 00000000000..2f297639c6a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_LastIndexOf/cpp/source.cpp @@ -0,0 +1,51 @@ +// +using namespace System; + +void main() +{ + array^ dinosaurs = { "Tyrannosaurus", + "Amargasaurus", + "Mamenchisaurus", + "Brachiosaurus", + "Deinonychus", + "Tyrannosaurus", + "Compsognathus" }; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine( + "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\"): {0}", + Array::LastIndexOf(dinosaurs, "Tyrannosaurus")); + + Console::WriteLine( + "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 3): {0}", + Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 3)); + + Console::WriteLine( + "\nArray.LastIndexOf(dinosaurs, \"Tyrannosaurus\", 4, 4): {0}", + Array::LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4)); +} + +/* This code example produces the following output: + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Brachiosaurus +Deinonychus +Tyrannosaurus +Compsognathus + +Array.LastIndexOf(dinosaurs, "Tyrannosaurus"): 5 + +Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 3): 0 + +Array.LastIndexOf(dinosaurs, "Tyrannosaurus", 4, 4): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp new file mode 100644 index 00000000000..0eece7d8c34 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_Sort2IntIntIComparer/cpp/source.cpp @@ -0,0 +1,124 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class ReverseComparer: IComparer +{ +public: + virtual int Compare(String^ x, String^ y) + { + // Compare y and x in reverse order. + return y->CompareTo(x); + } +}; + +void main() +{ + array^ dinosaurs = { + "Seismosaurus", + "Chasmosaurus", + "Coelophysis", + "Mamenchisaurus", + "Caudipteryx", + "Cetiosaurus" }; + + array^ dinosaurSizes = { 40, 5, 3, 22, 1, 18 }; + + Console::WriteLine(); + for (int i = 0; i < dinosaurs->Length; i++) + { + Console::WriteLine("{0}: up to {1} meters long.", + dinosaurs[i], dinosaurSizes[i]); + } + + Console::WriteLine("\nSort(dinosaurs, dinosaurSizes)"); + Array::Sort(dinosaurs, dinosaurSizes); + + Console::WriteLine(); + for (int i = 0; i < dinosaurs->Length; i++) + { + Console::WriteLine("{0}: up to {1} meters long.", + dinosaurs[i], dinosaurSizes[i]); + } + + ReverseComparer^ rc = gcnew ReverseComparer(); + + Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, rc)"); + Array::Sort(dinosaurs, dinosaurSizes, rc); + + Console::WriteLine(); + for (int i = 0; i < dinosaurs->Length; i++) + { + Console::WriteLine("{0}: up to {1} meters long.", + dinosaurs[i], dinosaurSizes[i]); + } + + Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3)"); + Array::Sort(dinosaurs, dinosaurSizes, 3, 3); + + Console::WriteLine(); + for (int i = 0; i < dinosaurs->Length; i++) + { + Console::WriteLine("{0}: up to {1} meters long.", + dinosaurs[i], dinosaurSizes[i]); + } + + Console::WriteLine("\nSort(dinosaurs, dinosaurSizes, 3, 3, rc)"); + Array::Sort(dinosaurs, dinosaurSizes, 3, 3, rc); + + Console::WriteLine(); + for (int i = 0; i < dinosaurs->Length; i++) + { + Console::WriteLine("{0}: up to {1} meters long.", + dinosaurs[i], dinosaurSizes[i]); + } +} + +/* This code example produces the following output: + +Seismosaurus: up to 40 meters long. +Chasmosaurus: up to 5 meters long. +Coelophysis: up to 3 meters long. +Mamenchisaurus: up to 22 meters long. +Caudipteryx: up to 1 meters long. +Cetiosaurus: up to 18 meters long. + +Sort(dinosaurs, dinosaurSizes) + +Caudipteryx: up to 1 meters long. +Cetiosaurus: up to 18 meters long. +Chasmosaurus: up to 5 meters long. +Coelophysis: up to 3 meters long. +Mamenchisaurus: up to 22 meters long. +Seismosaurus: up to 40 meters long. + +Sort(dinosaurs, dinosaurSizes, rc) + +Seismosaurus: up to 40 meters long. +Mamenchisaurus: up to 22 meters long. +Coelophysis: up to 3 meters long. +Chasmosaurus: up to 5 meters long. +Cetiosaurus: up to 18 meters long. +Caudipteryx: up to 1 meters long. + +Sort(dinosaurs, dinosaurSizes, 3, 3) + +Seismosaurus: up to 40 meters long. +Mamenchisaurus: up to 22 meters long. +Coelophysis: up to 3 meters long. +Caudipteryx: up to 1 meters long. +Cetiosaurus: up to 18 meters long. +Chasmosaurus: up to 5 meters long. + +Sort(dinosaurs, dinosaurSizes, 3, 3, rc) + +Seismosaurus: up to 40 meters long. +Mamenchisaurus: up to 22 meters long. +Coelophysis: up to 3 meters long. +Chasmosaurus: up to 5 meters long. +Cetiosaurus: up to 18 meters long. +Caudipteryx: up to 1 meters long. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp new file mode 100644 index 00000000000..8570582fcc3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_SortComparison/cpp/source.cpp @@ -0,0 +1,106 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +int CompareDinosByLength(String^ x, String^ y) +{ + if (x == nullptr) + { + if (y == nullptr) + { + // If x is null and y is null, they're + // equal. + return 0; + } + else + { + // If x is null and y is not null, y + // is greater. + return -1; + } + } + else + { + // If x is not null... + // + if (y == nullptr) + // ...and y is null, x is greater. + { + return 1; + } + else + { + // ...and y is not null, compare the + // lengths of the two strings. + // + int retval = x->Length.CompareTo(y->Length); + + if (retval != 0) + { + // If the strings are not of equal length, + // the longer string is greater. + // + return retval; + } + else + { + // If the strings are of equal length, + // sort them with ordinary string comparison. + // + return x->CompareTo(y); + } + } + } +}; + +void Display(array^ arr) +{ + Console::WriteLine(); + for each(String^ s in arr) + { + if (s == nullptr) + Console::WriteLine("(null)"); + else + Console::WriteLine("\"{0}\"", s); + } +}; + +void main() +{ + array^ dinosaurs = { + "Pachycephalosaurus", + "Amargasaurus", + "", + nullptr, + "Mamenchisaurus", + "Deinonychus" }; + Display(dinosaurs); + + Console::WriteLine("\nSort with generic Comparison delegate:"); + Array::Sort(dinosaurs, + gcnew Comparison(CompareDinosByLength)); + Display(dinosaurs); + +} + +/* This code example produces the following output: + +"Pachycephalosaurus" +"Amargasaurus" +"" +(null) +"Mamenchisaurus" +"Deinonychus" + +Sort with generic Comparison delegate: + +(null) +"" +"Deinonychus" +"Amargasaurus" +"Mamenchisaurus" +"Pachycephalosaurus" + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp new file mode 100644 index 00000000000..d51b2194310 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_SortIntIntIComparer/cpp/source.cpp @@ -0,0 +1,80 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class ReverseComparer: IComparer +{ +public: + virtual int Compare(String^ x, String^ y) + { + // Compare y and x in reverse order. + return y->CompareTo(x); + } +}; + +void main() +{ + array^ dinosaurs = {"Pachycephalosaurus", + "Amargasaurus", + "Mamenchisaurus", + "Tarbosaurus", + "Tyrannosaurus", + "Albertasaurus"}; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nSort(dinosaurs, 3, 3)"); + Array::Sort(dinosaurs, 3, 3); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + ReverseComparer^ rc = gcnew ReverseComparer(); + + Console::WriteLine("\nSort(dinosaurs, 3, 3, rc)"); + Array::Sort(dinosaurs, 3, 3, rc); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } +} + +/* This code example produces the following output: + +Pachycephalosaurus +Amargasaurus +Mamenchisaurus +Tarbosaurus +Tyrannosaurus +Albertasaurus + +Sort(dinosaurs, 3, 3) + +Pachycephalosaurus +Amargasaurus +Mamenchisaurus +Albertasaurus +Tarbosaurus +Tyrannosaurus + +Sort(dinosaurs, 3, 3, rc) + +Pachycephalosaurus +Amargasaurus +Mamenchisaurus +Tyrannosaurus +Tarbosaurus +Albertasaurus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp new file mode 100644 index 00000000000..1d9c96cc967 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_SortSearch/cpp/source.cpp @@ -0,0 +1,91 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +generic void ShowWhere(array^ arr, int index) +{ + if (index<0) + { + // If the index is negative, it represents the bitwise + // complement of the next larger element in the array. + // + index = ~index; + + Console::Write("Not found. Sorts between: "); + + if (index == 0) + Console::Write("beginning of array and "); + else + Console::Write("{0} and ", arr[index-1]); + + if (index == arr->Length) + Console::WriteLine("end of array."); + else + Console::WriteLine("{0}.", arr[index]); + } + else + { + Console::WriteLine("Found at index {0}.", index); + } +}; + +void main() +{ + array^ dinosaurs = {"Pachycephalosaurus", + "Amargasaurus", + "Tyrannosaurus", + "Mamenchisaurus", + "Deinonychus", + "Edmontosaurus"}; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nSort"); + Array::Sort(dinosaurs); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nBinarySearch for 'Coelophysis':"); + int index = Array::BinarySearch(dinosaurs, "Coelophysis"); + ShowWhere(dinosaurs, index); + + Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':"); + index = Array::BinarySearch(dinosaurs, "Tyrannosaurus"); + ShowWhere(dinosaurs, index); +} + +/* This code example produces the following output: + +Pachycephalosaurus +Amargasaurus +Tyrannosaurus +Mamenchisaurus +Deinonychus +Edmontosaurus + +Sort + +Amargasaurus +Deinonychus +Edmontosaurus +Mamenchisaurus +Pachycephalosaurus +Tyrannosaurus + +BinarySearch for 'Coelophysis': +Not found. Sorts between: Amargasaurus and Deinonychus. + +BinarySearch for 'Tyrannosaurus': +Found at index 5. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp new file mode 100644 index 00000000000..d19063bd802 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Array_SortSearchComparer/cpp/source.cpp @@ -0,0 +1,103 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class ReverseComparer: IComparer +{ +public: + virtual int Compare(String^ x, String^ y) + { + // Compare y and x in reverse order. + return y->CompareTo(x); + } +}; + +generic void ShowWhere(array^ arr, int index) +{ + if (index<0) + { + // If the index is negative, it represents the bitwise + // complement of the next larger element in the array. + // + index = ~index; + + Console::Write("Not found. Sorts between: "); + + if (index == 0) + Console::Write("beginning of array and "); + else + Console::Write("{0} and ", arr[index-1]); + + if (index == arr->Length) + Console::WriteLine("end of array."); + else + Console::WriteLine("{0}.", arr[index]); + } + else + { + Console::WriteLine("Found at index {0}.", index); + } +}; + +void main() +{ + array^ dinosaurs = {"Pachycephalosaurus", + "Amargasaurus", + "Tyrannosaurus", + "Mamenchisaurus", + "Deinonychus", + "Edmontosaurus"}; + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + ReverseComparer^ rc = gcnew ReverseComparer(); + + Console::WriteLine("\nSort"); + Array::Sort(dinosaurs, rc); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nBinarySearch for 'Coelophysis':"); + int index = Array::BinarySearch(dinosaurs, "Coelophysis", rc); + ShowWhere(dinosaurs, index); + + Console::WriteLine("\nBinarySearch for 'Tyrannosaurus':"); + index = Array::BinarySearch(dinosaurs, "Tyrannosaurus", rc); + ShowWhere(dinosaurs, index); +} + +/* This code example produces the following output: + +Pachycephalosaurus +Amargasaurus +Tyrannosaurus +Mamenchisaurus +Deinonychus +Edmontosaurus + +Sort + +Tyrannosaurus +Pachycephalosaurus +Mamenchisaurus +Edmontosaurus +Deinonychus +Amargasaurus + +BinarySearch for 'Coelophysis': +Not found. Sorts between: Deinonychus and Amargasaurus. + +BinarySearch for 'Tyrannosaurus': +Found at index 0. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp new file mode 100644 index 00000000000..54654202f49 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Assembly.FullName/CPP/Example.cpp @@ -0,0 +1,23 @@ +// +using namespace System; +using namespace System::Reflection; + +void main() +{ + Console::WriteLine("The FullName property (also called the display name) of..."); + Console::WriteLine("...the currently executing assembly:"); + Console::WriteLine(Assembly::GetExecutingAssembly()->FullName); + + Console::WriteLine("...the assembly that contains the Int32 type:"); + Console::WriteLine(int::typeid->Assembly->FullName); +} + +/* This example produces output similar to the following: + +The FullName property (also called the display name) of... +...the currently executing assembly: +ExampleAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +...the assembly that contains the Int32 type: +mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + */ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp new file mode 100644 index 00000000000..85c7081e152 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Assembly.GetExportedTypes/CPP/source.cpp @@ -0,0 +1,78 @@ +// +using namespace System; +using namespace System::Reflection; + +namespace ExportedClassExample +{ + public ref class Example sealed + { + private: + Example() + { + } + + public: + void static EnumerateExportedTypes() + { + for each (Type^ exportedType in + Example::typeid->Assembly->GetExportedTypes()) + { + Console::WriteLine(exportedType); + } + } + }; + + public ref class PublicClass + { + public: + ref class PublicNestedClass + { + }; + + protected: + ref class ProtectedNestedClass + { + }; + + internal: + ref class FriendNestedClass + { + }; + + private: + ref class PrivateNestedClass + { + }; + }; + + ref class FriendClass + { + public: + ref class PublicNestedClass + { + }; + + protected: + ref class ProtectedNestedClass + { + }; + + internal: + ref class FriendNestedClass + { + }; + + private: + ref class PrivateNestedClass + { + }; + }; +} + +int main() +{ + ExportedClassExample::Example::EnumerateExportedTypes(); + + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp b/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp new file mode 100644 index 00000000000..8735dfb6dac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Assembly.Load1/CPP/load1.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; +int main() +{ + // You must supply a valid fully qualified assembly name. + Assembly^ SampleAssembly = Assembly::Load + ( "SampleAssembly, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3" ); + array^ Types = SampleAssembly->GetTypes(); + + // Display all the types contained in the specified assembly. + IEnumerator^ myEnum = Types->GetEnumerator(); + Type^ oType; + while ( myEnum->MoveNext() ) + { + oType = safe_cast(myEnum->Current); + Console::WriteLine( oType->Name ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp new file mode 100644 index 00000000000..d5ff911a579 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder.DefineResource Example 2/CPP/assemblybuilder_defineresource.cpp @@ -0,0 +1,54 @@ + +// +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Resources; + +/* + The following program demonstrates the 'DefineResource' and 'DefineVersionInfoResource' + methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime. + The unmanaged version information like product, product version, Company, Copyright, + trademark are defined with 'DefineVersionInfoResource' method. +*/ +static Type^ CreateAssembly( AppDomain^ appDomain ); + +int main() +{ + AssemblyBuilder^ myAssembly; + IResourceWriter^ myResourceWriter; + myAssembly = safe_cast(CreateAssembly( Thread::GetDomain() )->Assembly); + myResourceWriter = myAssembly->DefineResource( "myResourceFile", "A sample Resource File", "MyEmitAssembly.MyResource.resources" ); + myResourceWriter->AddResource( "AddResource 1", "First added resource" ); + myResourceWriter->AddResource( "AddResource 2", "Second added resource" ); + myResourceWriter->AddResource( "AddResource 3", "Third added resource" ); + myAssembly->DefineVersionInfoResource( "AssemblySample", "2:0:0:1", "Microsoft Corporation", "@Copyright Microsoft Corp. 1990-2001", ".NET is a trademark of Microsoft Corporation" ); + myAssembly->Save( "MyEmitAssembly.dll" ); +} + +// Create the callee transient dynamic assembly. +static Type^ CreateAssembly( AppDomain^ appDomain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "MyEmitAssembly"; + AssemblyBuilder^ myAssembly = appDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); + + // Define a public class named "HelloWorld" in the assembly. + TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Define the Display method. + MethodBuilder^ myMethod = helloWorldClass->DefineMethod( "Display", MethodAttributes::Public, String::typeid, nullptr ); + + // Generate IL for GetGreeting. + ILGenerator^ methodIL = myMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldstr, "Display method get called." ); + methodIL->Emit( OpCodes::Ret ); + + // Returns the type HelloWorld. + return (helloWorldClass->CreateType()); +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp new file mode 100644 index 00000000000..28daac1e840 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/24895.cpp @@ -0,0 +1,222 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +void main() +{ + // This code creates an assembly that contains one type, + // named "MyDynamicType", that has a private field, a property + // that gets and sets the private field, constructors that + // initialize the private field, and a method that multiplies + // a user-supplied number by the private field value and returns + // the result. In Visual C++ the type might look like this: + /* + public ref class MyDynamicType + { + private: + int m_number; + + public: + MyDynamicType() : m_number(42) {}; + MyDynamicType(int initNumber) : m_number(initNumber) {}; + + property int Number + { + int get() { return m_number; } + void set(int value) { m_number = value; } + } + + int MyMethod(int multiplier) + { + return m_number * multiplier; + } + }; + */ + + AssemblyName^ aName = gcnew AssemblyName("DynamicAssemblyExample"); + AssemblyBuilder^ ab = + AssemblyBuilder::DefineDynamicAssembly( + aName, + AssemblyBuilderAccess::Run); + + // The module name is usually the same as the assembly name + ModuleBuilder^ mb = + ab->DefineDynamicModule(aName->Name); + + TypeBuilder^ tb = mb->DefineType( + "MyDynamicType", + TypeAttributes::Public); + + // Add a private field of type int (Int32). + FieldBuilder^ fbNumber = tb->DefineField( + "m_number", + int::typeid, + FieldAttributes::Private); + + // Define a constructor that takes an integer argument and + // stores it in the private field. + array^ parameterTypes = { int::typeid }; + ConstructorBuilder^ ctor1 = tb->DefineConstructor( + MethodAttributes::Public, + CallingConventions::Standard, + parameterTypes); + + ILGenerator^ ctor1IL = ctor1->GetILGenerator(); + // For a constructor, argument zero is a reference to the new + // instance. Push it on the stack before calling the base + // class constructor. Specify the default constructor of the + // base class (System::Object) by passing an empty array of + // types (Type::EmptyTypes) to GetConstructor. + ctor1IL->Emit(OpCodes::Ldarg_0); + ctor1IL->Emit(OpCodes::Call, + Object::typeid->GetConstructor(Type::EmptyTypes)); + // Push the instance on the stack before pushing the argument + // that is to be assigned to the private field m_number. + ctor1IL->Emit(OpCodes::Ldarg_0); + ctor1IL->Emit(OpCodes::Ldarg_1); + ctor1IL->Emit(OpCodes::Stfld, fbNumber); + ctor1IL->Emit(OpCodes::Ret); + + // Define a default constructor that supplies a default value + // for the private field. For parameter types, pass the empty + // array of types or pass nullptr. + ConstructorBuilder^ ctor0 = tb->DefineConstructor( + MethodAttributes::Public, + CallingConventions::Standard, + Type::EmptyTypes); + + ILGenerator^ ctor0IL = ctor0->GetILGenerator(); + ctor0IL->Emit(OpCodes::Ldarg_0); + ctor0IL->Emit(OpCodes::Call, + Object::typeid->GetConstructor(Type::EmptyTypes)); + // For a constructor, argument zero is a reference to the new + // instance. Push it on the stack before pushing the default + // value on the stack. + ctor0IL->Emit(OpCodes::Ldarg_0); + ctor0IL->Emit(OpCodes::Ldc_I4_S, 42); + ctor0IL->Emit(OpCodes::Stfld, fbNumber); + ctor0IL->Emit(OpCodes::Ret); + + // Define a property named Number that gets and sets the private + // field. + // + // The last argument of DefineProperty is nullptr, because the + // property has no parameters. (If you don't specify nullptr, you must + // specify an array of Type objects. For a parameterless property, + // use the built-in array with no elements: Type::EmptyTypes) + PropertyBuilder^ pbNumber = tb->DefineProperty( + "Number", + PropertyAttributes::HasDefault, + int::typeid, + nullptr); + + // The property "set" and property "get" methods require a special + // set of attributes. + MethodAttributes getSetAttr = MethodAttributes::Public | + MethodAttributes::SpecialName | MethodAttributes::HideBySig; + + // Define the "get" accessor method for Number. The method returns + // an integer and has no arguments. (Note that nullptr could be + // used instead of Types::EmptyTypes) + MethodBuilder^ mbNumberGetAccessor = tb->DefineMethod( + "get_Number", + getSetAttr, + int::typeid, + Type::EmptyTypes); + + ILGenerator^ numberGetIL = mbNumberGetAccessor->GetILGenerator(); + // For an instance property, argument zero is the instance. Load the + // instance, then load the private field and return, leaving the + // field value on the stack. + numberGetIL->Emit(OpCodes::Ldarg_0); + numberGetIL->Emit(OpCodes::Ldfld, fbNumber); + numberGetIL->Emit(OpCodes::Ret); + + // Define the "set" accessor method for Number, which has no return + // type and takes one argument of type int (Int32). + MethodBuilder^ mbNumberSetAccessor = tb->DefineMethod( + "set_Number", + getSetAttr, + nullptr, + gcnew array { int::typeid }); + + ILGenerator^ numberSetIL = mbNumberSetAccessor->GetILGenerator(); + // Load the instance and then the numeric argument, then store the + // argument in the field. + numberSetIL->Emit(OpCodes::Ldarg_0); + numberSetIL->Emit(OpCodes::Ldarg_1); + numberSetIL->Emit(OpCodes::Stfld, fbNumber); + numberSetIL->Emit(OpCodes::Ret); + + // Last, map the "get" and "set" accessor methods to the + // PropertyBuilder. The property is now complete. + pbNumber->SetGetMethod(mbNumberGetAccessor); + pbNumber->SetSetMethod(mbNumberSetAccessor); + + // Define a method that accepts an integer argument and returns + // the product of that integer and the private field m_number. This + // time, the array of parameter types is created on the fly. + MethodBuilder^ meth = tb->DefineMethod( + "MyMethod", + MethodAttributes::Public, + int::typeid, + gcnew array { int::typeid }); + + ILGenerator^ methIL = meth->GetILGenerator(); + // To retrieve the private instance field, load the instance it + // belongs to (argument zero). After loading the field, load the + // argument one and then multiply. Return from the method with + // the return value (the product of the two numbers) on the + // execution stack. + methIL->Emit(OpCodes::Ldarg_0); + methIL->Emit(OpCodes::Ldfld, fbNumber); + methIL->Emit(OpCodes::Ldarg_1); + methIL->Emit(OpCodes::Mul); + methIL->Emit(OpCodes::Ret); + + // Finish the type-> + Type^ t = tb->CreateType(); + + // Because AssemblyBuilderAccess includes Run, the code can be + // executed immediately. Start by getting reflection objects for + // the method and the property. + MethodInfo^ mi = t->GetMethod("MyMethod"); + PropertyInfo^ pi = t->GetProperty("Number"); + + // Create an instance of MyDynamicType using the default + // constructor. + Object^ o1 = Activator::CreateInstance(t); + + // Display the value of the property, then change it to 127 and + // display it again. Use nullptr to indicate that the property + // has no index. + Console::WriteLine("o1->Number: {0}", pi->GetValue(o1, nullptr)); + pi->SetValue(o1, 127, nullptr); + Console::WriteLine("o1->Number: {0}", pi->GetValue(o1, nullptr)); + + // Call MyMethod, passing 22, and display the return value, 22 + // times 127. Arguments must be passed as an array, even when + // there is only one. + array^ arguments = { 22 }; + Console::WriteLine("o1->MyMethod(22): {0}", + mi->Invoke(o1, arguments)); + + // Create an instance of MyDynamicType using the constructor + // that specifies m_Number. The constructor is identified by + // matching the types in the argument array. In this case, + // the argument array is created on the fly. Display the + // property value. + Object^ o2 = Activator::CreateInstance(t, + gcnew array { 5280 }); + Console::WriteLine("o2->Number: {0}", pi->GetValue(o2, nullptr)); +}; + +/* This code produces the following output: + +o1->Number: 42 +o1->Number: 127 +o1->MyMethod(22): 2794 +o2->Number: 5280 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj new file mode 100644 index 00000000000..f0b6e04f882 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/AssemblyBuilderClass.vcxproj @@ -0,0 +1,147 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 15.0 + {2C2BE6AE-166F-4B41-8A58-5A6088ED4869} + v4.7.2 + ManagedCProj + AssemblyBuilderClass + 10.0.17134.0 + + + + Application + true + v141 + true + Unicode + + + Application + false + v141 + true + Unicode + + + Application + true + v141 + true + Unicode + + + Application + false + v141 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + + + + Console + + + + + NotUsing + Level3 + Disabled + _DEBUG;%(PreprocessorDefinitions) + + + + Console + + + + + NotUsing + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + + + + Console + + + + + NotUsing + Level3 + NDEBUG;%(PreprocessorDefinitions) + + + + Console + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json new file mode 100644 index 00000000000..da9ebf8da2f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilderClass/cpp/snippets.5000.json @@ -0,0 +1,3 @@ +{ + "host": "visualstudio" +} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp new file mode 100644 index 00000000000..be95d74e2dc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource/CPP/assemblybuilder_defineunmanagedresource.cpp @@ -0,0 +1,66 @@ + +// +/* + The following program demonstrates the 'DefineResource' and 'DefineUnmanagedResource' + methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime. + An unmanaged resource file is also defined for the same resource file. The EmittedTest2.cpp file + calls the methods of "MyEmitAssembly.dll" assembly and the message is displayed to console. +*/ +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Resources; + + static AssemblyBuilder^ CreateAssembly( String^ name ) + { + AssemblyName^ aName = gcnew AssemblyName(name); + AssemblyBuilder^ myAssembly = + AppDomain::CurrentDomain->DefineDynamicAssembly( aName, + AssemblyBuilderAccess::Save ); + + // Define a dynamic module. + ModuleBuilder^ myModule = + myAssembly->DefineDynamicModule( aName->Name, aName->Name + ".dll" ); + + // Define a public class named "EmitClass" in the assembly. + TypeBuilder^ myEmitClass = + myModule->DefineType( "EmitClass", TypeAttributes::Public ); + + // Define the Display method. + MethodBuilder^ myMethod = + myEmitClass->DefineMethod( "Display", MethodAttributes::Public, + String::typeid, nullptr ); + + // Generate IL for Display method. + ILGenerator^ methodIL = myMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldstr, "Display method gets called." ); + methodIL->Emit( OpCodes::Ret ); + + myEmitClass->CreateType(); + + return (myAssembly); + }; + + // + // + void main() + { + AssemblyBuilder^ myAssembly = CreateAssembly("MyEmitTestAssembly"); + + // Defines a standalone managed resource for this assembly. + IResourceWriter^ myResourceWriter = + myAssembly->DefineResource( "myResourceFile", "A sample Resource File", + "MyAssemblyResource.resources", ResourceAttributes::Private ); + + myResourceWriter->AddResource( "AddResource Test", "Testing for the added resource" ); + + myAssembly->Save(myAssembly->GetName()->Name + ".dll" ); + + // Defines an unmanaged resource file for this assembly. + myAssembly->DefineUnmanagedResource( "MyAssemblyResource.resources" ); + }; + +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp new file mode 100644 index 00000000000..6f099f1d8c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineUnmanagedResource2/CPP/assemblybuilder_defineunmanagedresource2.cpp @@ -0,0 +1,66 @@ + +// +/* + The following program demonstrates the 'DefineResource' and 'DefineUnmanagedResource' + methods of 'AssemblyBuilder' class. It builds an assembly and a resource file at runtime. + An unmanaged resource file is also defined for the same resource file. The EmittedTest2.cpp file + calls the methods of "MyEmitAssembly.dll" assembly and the message is displayed to console. +*/ +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Resources; + + static AssemblyBuilder^ CreateAssembly( String^ name ) + { + AssemblyName^ aName = gcnew AssemblyName(name); + AssemblyBuilder^ myAssembly = + AppDomain::CurrentDomain->DefineDynamicAssembly( aName, + AssemblyBuilderAccess::Save ); + + // Define a dynamic module. + ModuleBuilder^ myModule = + myAssembly->DefineDynamicModule( aName->Name, aName->Name + ".dll" ); + + // Define a public class named "EmitClass" in the assembly. + TypeBuilder^ myEmitClass = + myModule->DefineType( "EmitClass", TypeAttributes::Public ); + + // Define the Display method. + MethodBuilder^ myMethod = + myEmitClass->DefineMethod( "Display", MethodAttributes::Public, + String::typeid, nullptr ); + + // Generate IL for Display method. + ILGenerator^ methodIL = myMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldstr, "Display method gets called." ); + methodIL->Emit( OpCodes::Ret ); + + myEmitClass->CreateType(); + + return (myAssembly); + }; + + // + // + void main() + { + AssemblyBuilder^ myAssembly = CreateAssembly("MyEmitTestAssembly"); + + // Defines a standalone managed resource for this assembly. + IResourceWriter^ myResourceWriter = + myAssembly->DefineResource( "myResourceFile", "A sample Resource File", + "MyAssemblyResource.resources", ResourceAttributes::Private ); + + myResourceWriter->AddResource( "AddResource Test", "Testing for the added resource" ); + + myAssembly->Save(myAssembly->GetName()->Name + ".dll" ); + + // Defines an unmanaged resource file for this assembly. + myAssembly->DefineUnmanagedResource( gcnew array{01, 00, 01} ); + }; + +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp new file mode 100644 index 00000000000..8b17c3f5d4f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_DefineVersionInfoResource/CPP/assemblybuilder_defineversioninforesource.cpp @@ -0,0 +1,167 @@ +// System::Reflection::Emit::AssemblyBuilder.DefineVersionInfoResource() + +// This code example shows how to use the AssemblyBuilder::DefineVersionInfoResource method +// to add Windows version information to a dynamic assembly. The code example builds an +// assembly with one module and no types. Several attributes are applied to the assembly, +// DefineVersionInfoResource is used to create the Windows version information resource, +// and then the assembly is saved as EmittedAssembly.exe. The Windows Explorer can be used +// to examine the version information for the assembly. + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + + +/* +// Create the callee transient dynamic assembly. +static Type^ CreateAssembly( AppDomain^ myDomain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "MyEmittedAssembly"; + AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); + + // Set Company Attribute to the assembly. + Type^ companyAttribute = AssemblyCompanyAttribute::typeid; + array^types1 = {String::typeid}; + ConstructorInfo^ myConstructorInfo1 = companyAttribute->GetConstructor( types1 ); + array^obj1 = {"Microsoft Corporation"}; + CustomAttributeBuilder^ attributeBuilder1 = gcnew CustomAttributeBuilder( myConstructorInfo1,obj1 ); + myAssembly->SetCustomAttribute( attributeBuilder1 ); + + // Set Copyright Attribute to the assembly. + Type^ copyrightAttribute = AssemblyCopyrightAttribute::typeid; + array^types2 = {String::typeid}; + ConstructorInfo^ myConstructorInfo2 = copyrightAttribute->GetConstructor( types2 ); + array^obj2 = {"@Copyright Microsoft Corp. 1990-2001"}; + CustomAttributeBuilder^ attributeBuilder2 = gcnew CustomAttributeBuilder( myConstructorInfo2,obj2 ); + myAssembly->SetCustomAttribute( attributeBuilder2 ); + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); + + // Define a public class named S"HelloWorld" in the assembly. + TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Define the Display method. + MethodBuilder^ myMethod = helloWorldClass->DefineMethod( "Display", MethodAttributes::Public, String::typeid, nullptr ); + + // Generate IL for GetGreeting. + ILGenerator^ methodIL = myMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldstr, "Display method get called." ); + methodIL->Emit( OpCodes::Ret ); + + // Returns the type HelloWorld. + return (helloWorldClass->CreateType()); +} +*/ + +int main() +{ + AssemblyName^ assemName = gcnew AssemblyName(); + assemName->Name = "EmittedAssembly"; + + // Create a dynamic assembly in the current application domain, + // specifying that the assembly is to be saved. + // + AssemblyBuilder^ myAssembly = + AppDomain::CurrentDomain->DefineDynamicAssembly(assemName, + AssemblyBuilderAccess::Save); + + + // To apply an attribute to a dynamic assembly, first get the + // attribute type. The AssemblyFileVersionAttribute sets the + // File Version field on the Version tab of the Windows file + // properties dialog. + // + Type^ attributeType = AssemblyFileVersionAttribute::typeid; + + // To identify the constructor, use an array of types representing + // the constructor's parameter types. This ctor takes a string. + // + array^ ctorParameters = { String::typeid }; + + // Get the constructor for the attribute. + // + ConstructorInfo^ ctor = attributeType->GetConstructor(ctorParameters); + + // Pass the constructor and an array of arguments (in this case, + // an array containing a single string) to the + // CustomAttributeBuilder constructor. + // + array^ ctorArgs = { "2.0.3033.0" }; + CustomAttributeBuilder^ attribute = + gcnew CustomAttributeBuilder(ctor, ctorArgs); + + // Finally, apply the attribute to the assembly. + // + myAssembly->SetCustomAttribute(attribute); + + + // The pattern described above is used to create and apply + // several more attributes. As it happens, all these attributes + // have a constructor that takes a string, so the same ctorArgs + // variable works for all of them. + + + // The AssemblyTitleAttribute sets the Description field on + // the General tab and the Version tab of the Windows file + // properties dialog. + // + attributeType = AssemblyTitleAttribute::typeid; + ctor = attributeType->GetConstructor(ctorParameters); + ctorArgs = gcnew array { "The Application Title" }; + attribute = gcnew CustomAttributeBuilder(ctor, ctorArgs); + myAssembly->SetCustomAttribute(attribute); + + // The AssemblyCopyrightAttribute sets the Copyright field on + // the Version tab. + // + attributeType = AssemblyCopyrightAttribute::typeid; + ctor = attributeType->GetConstructor(ctorParameters); + ctorArgs = gcnew array { "� My Example Company 1991-2005" }; + attribute = gcnew CustomAttributeBuilder(ctor, ctorArgs); + myAssembly->SetCustomAttribute(attribute); + + // The AssemblyDescriptionAttribute sets the Comment item. + // + attributeType = AssemblyDescriptionAttribute::typeid; + ctor = attributeType->GetConstructor(ctorParameters); + attribute = gcnew CustomAttributeBuilder(ctor, + gcnew array { "This is a comment." }); + myAssembly->SetCustomAttribute(attribute); + + // The AssemblyCompanyAttribute sets the Company item. + // + attributeType = AssemblyCompanyAttribute::typeid; + ctor = attributeType->GetConstructor(ctorParameters); + attribute = gcnew CustomAttributeBuilder(ctor, + gcnew array { "My Example Company" }); + myAssembly->SetCustomAttribute(attribute); + + // The AssemblyProductAttribute sets the Product Name item. + // + attributeType = AssemblyProductAttribute::typeid; + ctor = attributeType->GetConstructor(ctorParameters); + attribute = gcnew CustomAttributeBuilder(ctor, + gcnew array { "My Product Name" }); + myAssembly->SetCustomAttribute(attribute); + + + // Define the assembly's only module. For a single-file assembly, + // the module name is the assembly name. + // + ModuleBuilder^ myModule = + myAssembly->DefineDynamicModule(assemName->Name, + assemName->Name + ".exe"); + + // No types or methods are created for this example. + + + // Define the unmanaged version information resource, which + // contains the attribute informaion applied earlier, and save + // the assembly. Use the Windows Explorer to examine the properties + // of the .exe file. + // + myAssembly->DefineVersionInfoResource(); + myAssembly->Save(assemName->Name + ".exe"); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp new file mode 100644 index 00000000000..668ee141f99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute1/CPP/assemblybuilder_setcustomattribute1.cpp @@ -0,0 +1,62 @@ + +// System.Reflection.Emit.SetCustomAttribute(CustomAttributeBuilder) +/* +The following program demonstrates the 'SetCustomAttribute(CustomAttributeBuilder)' +method of 'AssemblyBuilder' class. It defines a 'MyAttribute' class which is derived +from 'Attribute' class. It builds an assembly by setting 'MyAttribute' custom attribute +and defines 'HelloWorld' type. Then it gets the custom attributes of 'HelloWorld' type +and displays its contents to the console. +*/ +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute: public Attribute +{ +public: + String^ s; + int x; + MyAttribute( String^ s, int x ) + { + this->s = s; + this->x = x; + } +}; + +Type^ CreateCallee( AppDomain^ domain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + Type^ myType = MyAttribute::typeid; + array^temp0 = {String::typeid,int::typeid}; + ConstructorInfo^ infoConstructor = myType->GetConstructor( temp0 ); + array^temp1 = {"Hello",2}; + CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( infoConstructor,temp1 ); + myAssembly->SetCustomAttribute( attributeBuilder ); + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Define a public class named "HelloWorld" in the assembly. + TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + return (helloWorldClass->CreateType()); +} + +int main() +{ + Type^ customAttribute = CreateCallee( Thread::GetDomain() ); + array^attributes = customAttribute->Assembly->GetCustomAttributes( true ); + Console::WriteLine( "MyAttribute custom attribute contains : " ); + for ( int index = 0; index < attributes->Length; index++ ) + { + if ( dynamic_cast(attributes[ index ]) ) + { + Console::WriteLine( "s : {0}", (dynamic_cast(attributes[ index ]))->s ); + Console::WriteLine( "x : {0}", (dynamic_cast(attributes[ index ]))->x ); + break; + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp new file mode 100644 index 00000000000..008090d756e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyBuilder_SetCustomAttribute2/CPP/assemblybuilder_setcustomattribute2.cpp @@ -0,0 +1,59 @@ + +// System.Reflection.Emit.SetCustomAttribute(ConstructorInfo, byte[]) +/* +The following program demonstrates the 'SetCustomAttribute(ConstructorInfo, byte[])' +method of 'AssemblyBuilder' class. It defines a 'MyAttribute' class which is derived +from 'Attribute' class. It builds an assembly by setting 'MyAttribute' custom attribute +and defines 'HelloWorld' type. Then it gets the custom attributes of 'HelloWorld' type +and displays its contents to the console. +*/ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute: public Attribute +{ +public: + bool s; + MyAttribute( bool s ) + { + this->s = s; + } +}; + +Type^ CreateCallee( AppDomain^ domain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + Type^ myType = MyAttribute::typeid; + array^temp0 = {bool::typeid}; + ConstructorInfo^ infoConstructor = myType->GetConstructor( temp0 ); + array^temp1 = {01,00,01}; + myAssembly->SetCustomAttribute( infoConstructor, temp1 ); + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Define a public class named "HelloWorld" in the assembly. + TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + return (helloWorldClass->CreateType()); +} + +int main() +{ + Type^ customAttribute = CreateCallee( Thread::GetDomain() ); + array^attributes = customAttribute->Assembly->GetCustomAttributes( true ); + Console::WriteLine( "MyAttribute custom attribute contains : " ); + for ( int index = 0; index < attributes->Length; index++ ) + { + if ( dynamic_cast(attributes[ index ]) ) + { + Console::WriteLine( "s : {0}", (dynamic_cast(attributes[ index ]))->s ); + break; + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp new file mode 100644 index 00000000000..2384a6c6a11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyClass/cpp/source.cpp @@ -0,0 +1,75 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Permissions; + +[assembly:AssemblyVersionAttribute("1.0.2000.0")]; + +public ref class Example +{ +private: + int factor; + +public: + Example(int f) + { + factor = f; + } + + int SampleMethod(int x) + { + Console::WriteLine("\nExample->SampleMethod({0}) executes.", x); + return x * factor; + } +}; + +void main() +{ + Assembly^ assem = Example::typeid->Assembly; + + Console::WriteLine("Assembly Full Name:"); + Console::WriteLine(assem->FullName); + + // The AssemblyName type can be used to parse the full name. + AssemblyName^ assemName = assem->GetName(); + Console::WriteLine("\nName: {0}", assemName->Name); + Console::WriteLine("Version: {0}.{1}", + assemName->Version->Major, assemName->Version->Minor); + + Console::WriteLine("\nAssembly CodeBase:"); + Console::WriteLine(assem->CodeBase); + + // Create an object from the assembly, passing in the correct number and + // type of arguments for the constructor. + Object^ o = assem->CreateInstance("Example", false, + BindingFlags::ExactBinding, + nullptr, gcnew array { 2 }, nullptr, nullptr); + + // Make a late-bound call to an instance method of the object. + MethodInfo^ m = assem->GetType("Example")->GetMethod("SampleMethod"); + Object^ ret = m->Invoke(o, gcnew array { 42 }); + Console::WriteLine("SampleMethod returned {0}.", ret); + + Console::WriteLine("\nAssembly entry point:"); + Console::WriteLine(assem->EntryPoint); +} + +/* This code example produces output similar to the following: + +Assembly Full Name: +source, Version=1.0.2000.0, Culture=neutral, PublicKeyToken=null + +Name: source +Version: 1.0 + +Assembly CodeBase: +file:///C:/sdtree/AssemblyClass/cpp/source.exe + +Example->SampleMethod(42) executes. +SampleMethod returned 84. + +Assembly entry point: +UInt32 _mainCRTStartup() + */ +// + diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp new file mode 100644 index 00000000000..9ec81948d79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyDelaySignAttribute/cpp/source.cpp @@ -0,0 +1,13 @@ +// Per Kitg, from cut QuickStart (vswhidbey 160832) +// +using namespace System; +using namespace System::Reflection; + +[assembly:AssemblyKeyFileAttribute("TestPublicKey.snk")]; +[assembly:AssemblyDelaySignAttribute(true)]; + +namespace DelaySign +{ + public ref class Test { }; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp new file mode 100644 index 00000000000..28ca23085e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyFlagsAttribute/CPP/source.cpp @@ -0,0 +1,79 @@ +// +using namespace System; +using namespace System::Reflection; + +// Specify a combination of AssemblyNameFlags for this +// assembly. +[assembly:AssemblyFlagsAttribute( + AssemblyNameFlags::EnableJITcompileOptimizer + | AssemblyNameFlags::Retargetable)]; + +public ref class Example +{ +public: + static void Main() + { + // Get this assembly. + Assembly^ thisAsm = Example::typeid->Assembly; + + // Get the AssemblyName for this assembly. + AssemblyName^ thisAsmName = thisAsm->GetName( false ); + + // Display the flags that were set for this assembly. + ListFlags( thisAsmName->Flags ); + + // Create an instance of AssemblyFlagsAttribute with the + // same combination of flags that was specified for this + // assembly. Note that PublicKey is included automatically + // for the assembly, but not for this instance of + // AssemblyFlagsAttribute. + AssemblyFlagsAttribute^ afa = gcnew AssemblyFlagsAttribute( + static_cast (AssemblyNameFlags::EnableJITcompileOptimizer + | AssemblyNameFlags::Retargetable) ); + + // Get the flags. The property returns an integer, so + // the return value must be cast to AssemblyNameFlags. + AssemblyNameFlags anf = static_cast(afa->AssemblyFlags); + + // Display the flags. + Console::WriteLine(); + ListFlags( anf ); + } + +private: + static void ListFlags( AssemblyNameFlags anf ) + { + if ( anf == AssemblyNameFlags::None ) + { + Console::WriteLine( L"AssemblyNameFlags.None" ); + } + else + { + if ( 0 != static_cast(anf & AssemblyNameFlags::Retargetable) ) + Console::WriteLine( L"AssemblyNameFlags.Retargetable" ); + if ( 0 != static_cast(anf & AssemblyNameFlags::PublicKey) ) + Console::WriteLine( L"AssemblyNameFlags.PublicKey" ); + if ( 0 != static_cast(anf & AssemblyNameFlags::EnableJITcompileOptimizer) ) + Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileOptimizer" ); + if ( 0 != static_cast(anf & AssemblyNameFlags::EnableJITcompileTracking) ) + Console::WriteLine( L"AssemblyNameFlags.EnableJITcompileTracking" ); + } + } + +}; + +int main() +{ + Example::Main(); +} + +/* This code example produces the following output: + +AssemblyNameFlags.Retargetable +AssemblyNameFlags.PublicKey +AssemblyNameFlags.EnableJITcompileOptimizer + +AssemblyNameFlags.Retargetable +AssemblyNameFlags.EnableJITcompileOptimizer +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp new file mode 100644 index 00000000000..727999e0bf2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller/CPP/assemblyinstaller.cpp @@ -0,0 +1,41 @@ +// System::Configuration::Install::AssemblyInstaller +/* The following example demonstrates the 'AssemblyInstaller' class. +An object of the AssemblyInstaller class is created by invoking the constructor. +The properties of this object are set and the install and commit methods are +called to install the 'MyAssembly.exe' assembly. +*/ +// +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Collections; +using namespace System::Collections::Specialized; +int main() +{ + IDictionary^ mySavedState = gcnew Hashtable; + Console::WriteLine( "" ); + try + { + + // Set the commandline argument array for 'logfile'. + array^commandLineOptions = {"/LogFile=example.log"}; + + // Create an object of the 'AssemblyInstaller' class. + AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller( + "MyAssembly.exe", commandLineOptions ); + myAssemblyInstaller->UseNewContext = true; + + // Install the 'MyAssembly' assembly. + myAssemblyInstaller->Install( mySavedState ); + + // Commit the 'MyAssembly' assembly. + myAssemblyInstaller->Commit( mySavedState ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp new file mode 100644 index 00000000000..15aa57873e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_CheckIfInstallable/CPP/assemblyinstaller_checkifinstallable.cpp @@ -0,0 +1,35 @@ + + +// System::Configuration::Install::AssemblyInstaller.CheckIfInstallable +/* The following example demonstrates the 'CheckIfInstallable' method +of the 'AssemblyInstaller' class. +The 'CheckIfInstallable' method is applied to an existent and +nonexistent assembly and the results of the call are displayed +onto the console. +*/ +// +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +int main() +{ + try + { + + // Determine whether the assembly 'MyAssembly' is installable. + AssemblyInstaller::CheckIfInstallable( "MyAssembly_CheckIfInstallable.exe" ); + Console::WriteLine( "The assembly 'MyAssembly_CheckIfInstallable' is installable" ); + + // Determine whether the assembly 'NonExistant' is installable. + AssemblyInstaller::CheckIfInstallable( "NonExistant" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp new file mode 100644 index 00000000000..837a4ff8d94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_HelpText/CPP/assemblyinstaller_helptext.cpp @@ -0,0 +1,55 @@ +// System::Configuration::Install::AssemblyInstaller.UseNewContext +// System::Configuration::Install::AssemblyInstaller.HelpText +/* The following example demonstrates the 'UseNewContext' and the +'HelpText' properties of the 'AssemblyInstaller' class. +An object of the AssemblyInstaller class is created by invoking the constructor. +The 'UseNewContext' property of this object is set to true and the install +method is invoked on the 'MyAssembly_HelpText.exe' assembly. Due +to this the log messages are displayed on the console. The 'HelpText' +property for the object is displayed on the console. +*/ +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void main() +{ + IDictionary^ mySavedState = gcnew Hashtable; + Console::WriteLine( "" ); + try + { + array^ commandLineOptions = {"/LogFile=example.log"}; + + // + // Create an Object* of the 'AssemblyInstaller' class. + AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller( + "MyAssembly_HelpText.exe", commandLineOptions ); + + // Set the 'UseNewContext' property to true. + myAssemblyInstaller->UseNewContext = true; + + // + // Install the 'MyAssembly_HelpText' assembly. + myAssemblyInstaller->Install( mySavedState ); + + // + Console::WriteLine( "The 'HelpText' is-" ); + + // Display the 'HelpText' of this AssemblyInstaller Object*. + Console::WriteLine( myAssemblyInstaller->HelpText ); + + // + } + catch ( ArgumentException^ ) + { + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp new file mode 100644 index 00000000000..27158e54816 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Install/CPP/assemblyinstaller_install.cpp @@ -0,0 +1,53 @@ +// System::Configuration::Install::AssemblyInstaller.AssemblyInstaller() +// System::Configuration::Install::AssemblyInstaller.Install +// System::Configuration::Install::AssemblyInstaller.Commit +/* The following example demonstrates the 'AssemblyInstaller()' constructor and +the 'Install' and 'Commit' methods of the 'AssemblyInstaller' class. +An object of the AssemblyInstaller class is created by invoking the constructor. +The properties of this object are set and the install and commit methods are +called to install the 'MyAssembly_Install.exe' assembly. +*/ +// +// +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void main() +{ + IDictionary^ mySavedState = gcnew Hashtable; + Console::WriteLine( "" ); + try + { + // Set the commandline argument array for 'logfile'. + array^myString = {"/logFile=example.log"}; + + // + // Create an Object* of the 'AssemblyInstaller' class. + AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; + // + + // Set the properties to install the required assembly. + myAssemblyInstaller->Path = "MyAssembly_Install.exe"; + myAssemblyInstaller->CommandLine = myString; + myAssemblyInstaller->UseNewContext = true; + + // Clear the 'IDictionary' Object*. + mySavedState->Clear(); + + // Install the 'MyAssembly_Install' assembly. + myAssemblyInstaller->Install( mySavedState ); + + // Commit the 'MyAssembly_Install' assembly. + myAssemblyInstaller->Commit( mySavedState ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp new file mode 100644 index 00000000000..6d5648101ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Rollback/CPP/assemblyinstaller_rollback.cpp @@ -0,0 +1,57 @@ +// System::Configuration::Install::AssemblyInstaller.Rollback +// System::Configuration::Install::AssemblyInstaller.Path +// System::Configuration::Install::AssemblyInstaller.CommandLine +/* The following example demonstrates the 'Rollback' method and the +'Path' and 'CommandLine' properties of the 'AssemblyInstaller' class. +An object of the AssemblyInstaller class is created by invoking the constructor. +The properties of this object are set and the install method is invoked on the +'MyAssembly.exe' assembly. The 'Rollback' method is called to undo the +install process on the specified assembly. +*/ +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void main() +{ + IDictionary^ mySavedState = gcnew Hashtable; + Console::WriteLine( "" ); + try + { + // + // Create an object of the 'AssemblyInstaller' class. + AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; + + // Set the path property of the AssemblyInstaller object. + myAssemblyInstaller->Path = "MyAssembly_Rollback.exe"; + + // + // + // Set the logfile name in the commandline argument array. + array^commandLineOptions = {"/LogFile=example.log"}; + myAssemblyInstaller->CommandLine = commandLineOptions; + + // + // Set the 'UseNewContext' property to true. + myAssemblyInstaller->UseNewContext = true; + + // Install the 'MyAssembly_Rollback' assembly. + myAssemblyInstaller->Install( mySavedState ); + + // + // 'Rollback' the installation process. + myAssemblyInstaller->Rollback( mySavedState ); + + // + } + catch ( ArgumentException^ ) + { + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp new file mode 100644 index 00000000000..44a53315ff6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyInstaller_Uninstall/CPP/assemblyinstaller_uninstall.cpp @@ -0,0 +1,49 @@ +// System::Configuration::Install::AssemblyInstaller.AssemblyInstaller(String*, String*->Item[]) +// System::Configuration::Install::AssemblyInstaller.Uninstall +/* The following example demonstrates the 'AssemblyInstaller(String*, String*->Item[])' +constructor and the 'Uninstall' method of the 'AssemblyInstaller' class. +An object of the AssemblyInstaller class is created by invoking the constructor +with the assembly to install and the commandline argument array as +parameters. The uninstall method is called after installing and committing +the assembly passed as the parameter to the constructor. +*/ +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void main() +{ + IDictionary^ mySavedState = gcnew Hashtable; + Console::WriteLine( "" ); + try + { + // + array^myStringArray = {"/logFile=example.log"}; + String^ myString = "MyAssembly_Uninstall.exe"; + + // Create an object of the 'AssemblyInstaller' class. + AssemblyInstaller^ myAssemblyInstaller = + gcnew AssemblyInstaller( myString,myStringArray ); + // + + // Install and commit the 'MyAssembly_Uninstall' assembly. + mySavedState->Clear(); + myAssemblyInstaller->Install( mySavedState ); + myAssemblyInstaller->Commit( mySavedState ); + + // + // Uninstall the 'MyAssembly_Uninstall' assembly. + myAssemblyInstaller->Uninstall( mySavedState ); + // + } + catch ( ArgumentException^ ) + { + } + catch ( Exception^ myException ) + { + Console::WriteLine( myException->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp new file mode 100644 index 00000000000..7a72383a28c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName.Version/cpp/Example.cpp @@ -0,0 +1,21 @@ +// +using namespace System; +using namespace System::Reflection; + +[assembly:AssemblyVersion("1.1.0.0")]; + +void main() +{ + Console::WriteLine("The version of the currently executing assembly is: {0}", + Assembly::GetExecutingAssembly()->GetName()->Version); + + Console::WriteLine("The version of mscorlib.dll is: {0}", + String::typeid->Assembly->GetName()->Version); +} + +/* This example produces output similar to the following: + +The version of the currently executing assembly is: 1.1.0.0 +The version of mscorlib.dll is: 2.0.0.0 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp new file mode 100644 index 00000000000..1879b4dc9fd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName_CodeBase/CPP/assemblyname_codebase.cpp @@ -0,0 +1,99 @@ + +// System::Reflection::AssemblyName::CodeBase +// System::Reflection::AssemblyName::CultureInfo +// System::Reflection::AssemblyName::HashAlgorithm +// System::Reflection::AssemblyName::FullName +/* + The following example demonstrates the 'CodeBase', 'CultureInfo' + 'HashAlgorithm' and 'FullName' properties of the 'AssemblyName' class. Creates + a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and + a type within the module named 'MyType'. The type 'MyType' has a single + method called 'Main' which is also the entry point to the assembly. The + creation of the dynamic assembly is carried out by the method called + 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly' + the assemblies currently loaded are found and the dynamic assembly that we + have created is searched for, which is displayed to the console. The dynamic + assembly is also saved to a file named 'MyAssembly.exe'. + + Note : Run 'MyAssembly.exe' which this example has created for a simple + 'Hello World!' display. +*/ +// +// +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Threading; +using namespace System::IO; +using namespace System::Globalization; +using namespace System::Reflection::Emit; +using namespace System::Configuration::Assemblies; +static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) +{ + // Get the assembly builder from the application domain associated with the current thread. + AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a dynamic module in the assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); + + // Create a method called 'Main'. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); + + // Get the Intermediate Language generator for the method. + ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); + + // Use the utility method to generate the IL instructions that print a String* to the console. + myILGenerator->EmitWriteLine( "Hello World!" ); + + // Generate the 'ret' IL instruction. + myILGenerator->Emit( OpCodes::Ret ); + + // End the creation of the type. + myTypeBuilder->CreateType(); + + // Set the method with name 'Main' as the entry point in the assembly. + myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); + myAssemblyBuilder->Save( fileName ); +} + +int main() +{ + // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + + // Set the codebase to the physical directory were the assembly resides. + myAssemblyName->CodeBase = Directory::GetCurrentDirectory(); + + // Set the culture information of the assembly to 'English-American'. + myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" ); + + // Set the hash algorithm to 'SHA256'. + myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256; + myAssemblyName->Name = "MyAssembly"; + myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); + MakeAssembly( myAssemblyName, "MyAssembly.exe" ); + + // Get all the assemblies currently loaded in the application domain. + array^myAssemblies = Thread::GetDomain()->GetAssemblies(); + + // Get the dynamic assembly named 'MyAssembly'. + Assembly^ myAssembly = nullptr; + for ( int i = 0; i < myAssemblies->Length; i++ ) + { + if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) + myAssembly = myAssemblies[ i ]; + } + if ( myAssembly != nullptr ) + { + Console::WriteLine( "\nDisplaying the full assembly name\n" ); + Console::WriteLine( myAssembly->GetName()->FullName ); + } +} +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp new file mode 100644 index 00000000000..21eae3f4c19 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor/CPP/assemblyname_constructor.cpp @@ -0,0 +1,84 @@ + +// System::Reflection::AssemblyName::AssemblyName() +// System::Reflection::AssemblyName::Name +// System::Reflection::AssemblyName::Version +/* + The following example demonstrates the constructor 'AssemblyName()' and + the 'Name' and 'Version' properties of the 'AssemblyName' class. Creates + a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and + a type within the module named 'MyType'. The type 'MyType' has a single + method called 'Main' which is also the entry point to the assembly. The + creation of the dynamic assembly is carried out by the method called + 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly' + the assemblies currently loaded are found and the dynamic assembly that we + have created is searched for, which is displayed to the console. The dynamic + assembly is also saved to a file named 'MyAssembly.exe'. + + Note : Run 'MyAssembly.exe' which this example has created for a simple + 'Hello World!' display. +*/ +// +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Threading; +using namespace System::Reflection::Emit; +static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) +{ + // Get the assembly builder from the application domain associated with the current thread. + AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a dynamic module in the assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); + + // Create a method called 'Main'. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); + + // Get the Intermediate Language generator for the method. + ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); + + // Use the utility method to generate the IL instructions that print a String* to the console. + myILGenerator->EmitWriteLine( "Hello World!" ); + + // Generate the 'ret' IL instruction. + myILGenerator->Emit( OpCodes::Ret ); + + // End the creation of the type. + myTypeBuilder->CreateType(); + + // Set the method with name 'Main' as the entry point in the assembly. + myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); + myAssemblyBuilder->Save( fileName ); +} + +int main() +{ + // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "MyAssembly"; + myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); + MakeAssembly( myAssemblyName, "MyAssembly.exe" ); + + // Get all the assemblies currently loaded in the application domain. + array^myAssemblies = Thread::GetDomain()->GetAssemblies(); + + // Get the dynamic assembly named 'MyAssembly'. + Assembly^ myAssembly = nullptr; + for ( int i = 0; i < myAssemblies->Length; i++ ) + { + if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) + myAssembly = myAssemblies[ i ]; + } + if ( myAssembly != nullptr ) + { + Console::WriteLine( "\nDisplaying the assembly name\n" ); + Console::WriteLine( myAssembly ); + } +} +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp new file mode 100644 index 00000000000..7bd4f7d79f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName_Constructor_2/CPP/source.cpp @@ -0,0 +1,24 @@ +// Simplified snippet per SuzCook tech review. +// +using namespace System; +using namespace System::Reflection; + +int main() +{ + // Create an AssemblyName, specifying the display name, and then + // print the properties. + AssemblyName^ myAssemblyName = + gcnew AssemblyName("Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null"); + Console::WriteLine("Name: {0}", myAssemblyName->Name); + Console::WriteLine("Version: {0}", myAssemblyName->Version); + Console::WriteLine("CultureInfo: {0}", myAssemblyName->CultureInfo); + Console::WriteLine("FullName: {0}", myAssemblyName->FullName); +} +/* This code example produces output similar to the following: + +Name: Example +Version: 1.0.0.2001 +CultureInfo: en-US +FullName: Example, Version=1.0.0.2001, Culture=en-US, PublicKeyToken=null + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp new file mode 100644 index 00000000000..2f372084604 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName_GetAssemblyName/CPP/assemblyname_getassemblyname.cpp @@ -0,0 +1,30 @@ + + +// System::Reflection::AssemblyName::GetAssemblyName(String*) +// System::Reflection::AssemblyName +/* + This example demonstrates the 'GetAssemblyName(String*)' and 'ToString()' + methods of the 'AssemblyName' class. Get the path of 'System.dll' from + the path of 'mscorlib.dll'. Get the assembly information from 'System.dll' + and display the information to the console. + */ +// +// +#using + +using namespace System; +using namespace System::Reflection; +int main() +{ + + // Replace the string "MyAssembly.exe" with the name of an assembly, + // including a path if necessary. If you do not have another assembly + // to use, you can use whatever name you give to this assembly. + // + AssemblyName^ myAssemblyName = AssemblyName::GetAssemblyName( "MyAssembly.exe" ); + Console::WriteLine( "\nDisplaying assembly information:\n" ); + Console::WriteLine( myAssemblyName ); +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp new file mode 100644 index 00000000000..ce82c90bc54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName_KeyPair/CPP/assemblyname_keypair.cpp @@ -0,0 +1,123 @@ + +// System::Reflection::AssemblyName::KeyPair +// System::Reflection::AssemblyName::GetPublicKey() +// System::Reflection::AssemblyName::GetPublicKeyToken() +// System::Reflection::AssemblyName::Flags +// System::Reflection::AssemblyName::VersionCompatibility +/* + The following example demonstrates the 'GetPublicKey()' and + 'GetPublicKeyToken()' methods and the 'KeyPair', 'Flags' and 'VersionCompatibility' + properties of the 'AssemblyName' class. Creates a dynamic assembly named 'MyAssembly' + with a module named 'MyModule' and a type within the module named 'MyType'. + The type 'MyType' has a single method called 'Main' which is also the entry + point to the assembly. The creation of the dynamic assembly is carried out + by the method called 'MakeAssembly'. After the assembly is created with the + help of 'MakeAssembly' the assemblies currently loaded are found and the + dynamic assembly that we have created is searched for, which is displayed + to the console. Moreover the public key and the public key token are displayed + The dynamic assembly is also saved to a file named 'MyAssembly.exe'. The + dynamic assembly that has been created has a strong name containing a private + and a public key which is generated by a tool named 'Sn.exe'. The key pair + is stored in a file named 'KeyPair.snk'. + + Note : Run 'MyAssembly.exe' which this example has created for a simple + 'Hello World!' display. +*/ +// +// +// +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Threading; +using namespace System::IO; +using namespace System::Globalization; +using namespace System::Reflection::Emit; +using namespace System::Configuration::Assemblies; +using namespace System::Text; +static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) +{ + // Get the assembly builder from the application domain associated with the current thread. + AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a dynamic module in the assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); + + // Create a method called 'Main'. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); + + // Get the Intermediate Language generator for the method. + ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); + + // Use the utility method to generate the IL instructions that print a String* to the console. + myILGenerator->EmitWriteLine( "Hello World!" ); + + // Generate the 'ret' IL instruction. + myILGenerator->Emit( OpCodes::Ret ); + + // End the creation of the type. + myTypeBuilder->CreateType(); + + // Set the method with name 'Main' as the entry point in the assembly. + myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); + myAssemblyBuilder->Save( fileName ); +} + +int main() +{ + // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + + // Set the codebase to the physical directory were the assembly resides. + myAssemblyName->CodeBase = Directory::GetCurrentDirectory(); + + // Set the culture information of the assembly to 'English-American'. + myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" ); + + // Set the hash algorithm to 'SHA256'. + myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256; + myAssemblyName->VersionCompatibility = AssemblyVersionCompatibility::SameProcess; + myAssemblyName->Flags = AssemblyNameFlags::PublicKey; + + // Provide this assembly with a strong name. + myAssemblyName->KeyPair = gcnew StrongNameKeyPair( File::Open( "KeyPair.snk", FileMode::Open, FileAccess::Read ) ); + myAssemblyName->Name = "MyAssembly"; + myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); + MakeAssembly( myAssemblyName, "MyAssembly.exe" ); + + // Get the assemblies loaded in the current application domain. + array^myAssemblies = Thread::GetDomain()->GetAssemblies(); + + // Get the dynamic assembly named 'MyAssembly'. + Assembly^ myAssembly = nullptr; + for ( int i = 0; i < myAssemblies->Length; i++ ) + if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) + myAssembly = myAssemblies[ i ]; + + // Display the full assembly information to the console. + if ( myAssembly != nullptr ) + { + Console::WriteLine( "\nDisplaying the full assembly name.\n" ); + Console::WriteLine( myAssembly->GetName()->FullName ); + Console::WriteLine( "\nDisplaying the public key.\n" ); + array^pk; + pk = myAssembly->GetName()->GetPublicKey(); + for ( int i = 0; i < pk->GetLength( 0 ); i++ ) + Console::Write( " {0:x2}", pk[ i ] ); + Console::WriteLine(); + Console::WriteLine( "\nDisplaying the public key token.\n" ); + array^pt; + pt = myAssembly->GetName()->GetPublicKeyToken(); + for ( int i = 0; i < pt->GetLength( 0 ); i++ ) + Console::Write( " {0:x2}", pt[ i ] ); + } +} +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp new file mode 100644 index 00000000000..105e762cd75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyName_SetPublicKey/CPP/assemblyname_setpublickey.cpp @@ -0,0 +1,125 @@ + +// System::Reflection::AssemblyName::SetPublicKey(Byte->Item[]) +// System::Reflection::AssemblyName::SetPublicKeyToken(Byte->Item[]) +/* + The following example demonstrates the 'SetPublicKey(Byte->Item[])' and the + 'SetPublicKeyToken(Byte->Item[])' methods of the 'AssemblyName' class. Creates + a dynamic assembly named 'MyAssembly' with a module named 'MyModule' and + a type within the module named 'MyType'. The type 'MyType' has a single + method called 'Main' which is also the entry point to the assembly. The + creation of the dynamic assembly is carried out by the method called + 'MakeAssembly'. After the assembly is created with the help of 'MakeAssembly' + the assemblies currently loaded are found and the dynamic assembly that we + have created is searched for, which is displayed to the console. The dynamic + assembly is also saved to a file named 'MyAssembly.exe'. The assembly is + provided with a strong name. This is done by getting the public key and + the public key token from the 'KeyPair.snk' (private and public key file). + The public key is stored in 'PublicKey.snk' and the public key token is + stored in 'PublicKeyToken.snk' with the help of the tool named 'sn.exe'. + + Note : Running 'MyAssembly.exe' with this example does not display 'Hello World!' + since this assembly has been stongly signed. +*/ + +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Threading; +using namespace System::IO; +using namespace System::Globalization; +using namespace System::Reflection::Emit; +using namespace System::Configuration::Assemblies; +using namespace System::Text; + +static void MakeAssembly( AssemblyName^ myAssemblyName, String^ fileName ) +{ + // Get the assembly builder from the application domain associated with the current thread. + AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a dynamic module in the assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", fileName ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); + + // Create a method called 'Main'. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "Main", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), void::typeid, nullptr ); + + // Get the Intermediate Language generator for the method. + ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); + + // Use the utility method to generate the IL instructions that print a String* to the console. + myILGenerator->EmitWriteLine( "Hello World!" ); + + // Generate the 'ret' IL instruction. + myILGenerator->Emit( OpCodes::Ret ); + + // End the creation of the type. + myTypeBuilder->CreateType(); + + // Set the method with name 'Main' as the entry point in the assembly. + myAssemblyBuilder->SetEntryPoint( myMethodBuilder ); + myAssemblyBuilder->Save( fileName ); +} + +int main() +{ + // Create a dynamic assembly with name 'MyAssembly' and build version '1.0.0.2001'. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + + // Set the codebase to the physical directory were the assembly resides. + myAssemblyName->CodeBase = Directory::GetCurrentDirectory(); + + // Set the culture information of the assembly to 'English-American'. + myAssemblyName->CultureInfo = gcnew CultureInfo( "en-US" ); + + // Set the hash algorithm to 'SHA256'. + myAssemblyName->HashAlgorithm = AssemblyHashAlgorithm::SHA256; + myAssemblyName->VersionCompatibility = AssemblyVersionCompatibility::SameProcess; + myAssemblyName->Flags = AssemblyNameFlags::PublicKey; + + // Get the whole contents of the 'PublicKey.snk' into a Byte array. + FileStream^ publicKeyStream = File::Open( "PublicKey.snk", FileMode::Open ); + array^publicKey = gcnew array(publicKeyStream->Length); + publicKeyStream->Read( publicKey, 0, (int)publicKeyStream->Length ); + + // Provide the assembly with a public key. + myAssemblyName->SetPublicKey( publicKey ); + + // Get the whole contents of the 'PublicKeyToken.snk' into a Byte array. + FileStream^ publicKeyTokenStream = File::Open( "PublicKeyToken.snk", FileMode::Open ); + array^publicKeyToken = gcnew array(publicKeyTokenStream->Length); + publicKeyTokenStream->Read( publicKeyToken, 0, (int)publicKeyToken->Length ); + + // Provide the assembly with a public key token. + myAssemblyName->SetPublicKeyToken( publicKeyToken ); + myAssemblyName->Name = "MyAssembly"; + myAssemblyName->Version = gcnew Version( "1.0.0.2001" ); + MakeAssembly( myAssemblyName, "MyAssembly.exe" ); + + // Get the assemblies loaded in the current application domain. + array^myAssemblies = Thread::GetDomain()->GetAssemblies(); + + // Get the dynamic assembly named 'MyAssembly'. + Assembly^ myAssembly = nullptr; + for ( int i = 0; i < myAssemblies->Length; i++ ) + if ( String::Compare( myAssemblies[ i ]->GetName()->Name, "MyAssembly" ) == 0 ) + myAssembly = myAssemblies[ i ]; + + // Display the full assembly information to the console. + if ( myAssembly != nullptr ) + { + Console::WriteLine( "\nDisplaying the full assembly name\n" ); + String^ assemblyName = myAssembly->GetName()->FullName; + Console::WriteLine( assemblyName ); + Console::WriteLine( "\nDisplaying the public key for the assembly\n" ); + array^publicKeyBytes = myAssembly->GetName()->GetPublicKey(); + Console::WriteLine( Encoding::ASCII->GetString( publicKeyBytes ) ); + Console::WriteLine( "\nDisplaying the public key token for the assembly\n" ); + array^publicKeyTokenBytes = myAssembly->GetName()->GetPublicKeyToken(); + Console::WriteLine( Encoding::ASCII->GetString( publicKeyTokenBytes ) ); + } +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp b/snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp new file mode 100644 index 00000000000..240c13bea6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AssemblyResolve/CPP/assemblyresolve.cpp @@ -0,0 +1,79 @@ +using namespace System; +using namespace System::Reflection; + +// +public ref class MyType +{ +public: + MyType() + { + Console::WriteLine(); + Console::WriteLine("MyType instantiated!"); + } +}; + +class Test +{ +public: + static void Main() + { + AppDomain^ currentDomain = AppDomain::CurrentDomain; + + // This call will fail to create an instance of MyType since the + // assembly resolver is not set + InstantiateMyTypeFail(currentDomain); + + currentDomain->AssemblyResolve += gcnew ResolveEventHandler(&Test::MyResolveEventHandler); + + // This call will succeed in creating an instance of MyType since the + // assembly resolver is now set. + InstantiateMyTypeFail(currentDomain); + + // This call will succeed in creating an instance of MyType since the + // assembly name is valid. + InstantiateMyTypeSucceed(currentDomain); + } + +private: + static void InstantiateMyTypeFail(AppDomain^ domain) + { + // Calling InstantiateMyType will always fail since the assembly info + // given to CreateInstance is invalid. + try + { + // You must supply a valid fully qualified assembly name here. + domain->CreateInstance("Assembly text name, Version, Culture, PublicKeyToken", "MyType"); + } + catch (Exception^ e) + { + Console::WriteLine(); + Console::WriteLine(e->Message); + } + } + + static void InstantiateMyTypeSucceed(AppDomain^ domain) + { + try + { + String^ asmname = Assembly::GetCallingAssembly()->FullName; + domain->CreateInstance(asmname, "MyType"); + } + catch (Exception^ e) + { + Console::WriteLine(); + Console::WriteLine(e->Message); + } + } + + static Assembly^ MyResolveEventHandler(Object^ sender, ResolveEventArgs^ args) + { + Console::WriteLine("Resolving..."); + return MyType::typeid->Assembly; + } +}; + +int main() +{ + Test::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp new file mode 100644 index 00000000000..91ec8999683 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/TestMethod.cpp @@ -0,0 +1,27 @@ +// +using namespace System; +using namespace System::Threading; +using namespace System::Runtime::InteropServices; + +namespace Examples { +namespace AdvancedProgramming { +namespace AsynchronousOperations +{ + public ref class AsyncDemo + { + public: + // The method to be executed asynchronously. + String^ TestMethod(int callDuration, [OutAttribute] int% threadId) + { + Console::WriteLine("Test method begins."); + Thread::Sleep(callDuration); + threadId = Thread::CurrentThread->ManagedThreadId; + return String::Format("My call time was {0}.", callDuration); + } + }; + + // The delegate must have the same signature as the method + // it will call asynchronously. + public delegate String^ AsyncMethodCaller(int callDuration, [OutAttribute] int% threadId); +}}} +// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp new file mode 100644 index 00000000000..4f99e90248e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/callback.cpp @@ -0,0 +1,79 @@ +// +#using + +using namespace System; +using namespace System::Threading; +using namespace System::Runtime::Remoting::Messaging; +using namespace Examples::AdvancedProgramming::AsynchronousOperations; + +// The callback method must have the same signature as the +// AsyncCallback delegate. +void CallbackMethod(IAsyncResult^ ar) +{ + // Retrieve the delegate. + AsyncResult^ result = (AsyncResult^) ar; + AsyncMethodCaller^ caller = (AsyncMethodCaller^) result->AsyncDelegate; + + // Retrieve the format string that was passed as state + // information. + String^ formatString = (String^) ar->AsyncState; + + // Define a variable to receive the value of the out parameter. + // If the parameter were ref rather than out then it would have to + // be a class-level field so it could also be passed to BeginInvoke. + int threadId = 0; + + // Call EndInvoke to retrieve the results. + String^ returnValue = caller->EndInvoke(threadId, ar); + + // Use the format string to format the output message. + Console::WriteLine(formatString, threadId, returnValue); +}; + +void main() +{ + // Create an instance of the test class. + AsyncDemo^ ad = gcnew AsyncDemo(); + + // Create the delegate. + AsyncMethodCaller^ caller = gcnew AsyncMethodCaller(ad, &AsyncDemo::TestMethod); + + // The threadId parameter of TestMethod is an out parameter, so + // its input value is never used by TestMethod. Therefore, a dummy + // variable can be passed to the BeginInvoke call. If the threadId + // parameter were a ref parameter, it would have to be a class- + // level field so that it could be passed to both BeginInvoke and + // EndInvoke. + int dummy = 0; + + // Initiate the asynchronous call, passing three seconds (3000 ms) + // for the callDuration parameter of TestMethod; a dummy variable + // for the out parameter (threadId); the callback delegate; and + // state information that can be retrieved by the callback method. + // In this case, the state information is a string that can be used + // to format a console message. + IAsyncResult^ result = caller->BeginInvoke(3000, + dummy, + gcnew AsyncCallback(&CallbackMethod), + "The call executed on thread {0}, with return value \"{1}\"."); + + Console::WriteLine("The main thread {0} continues to execute...", + Thread::CurrentThread->ManagedThreadId); + + // The callback is made on a ThreadPool thread. ThreadPool threads + // are background threads, which do not keep the application running + // if the main thread ends. Comment out the next line to demonstrate + // this. + Thread::Sleep(4000); + Console::WriteLine("The main thread ends."); +} + +/* This example produces output similar to the following: + +The main thread 1 continues to execute... +Test method begins. +The call executed on thread 3, with return value "My call time was 3000.". +The main thread ends. + */ +// + diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp new file mode 100644 index 00000000000..c0c1952f583 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/polling.cpp @@ -0,0 +1,43 @@ +// +#using + +using namespace System; +using namespace System::Threading; +using namespace Examples::AdvancedProgramming::AsynchronousOperations; + +void main() +{ + // The asynchronous method puts the thread id here. + int threadId; + + // Create an instance of the test class. + AsyncDemo^ ad = gcnew AsyncDemo(); + + // Create the delegate. + AsyncMethodCaller^ caller = gcnew AsyncMethodCaller(ad, &AsyncDemo::TestMethod); + + // Initiate the asychronous call. + IAsyncResult^ result = caller->BeginInvoke(3000, + threadId, nullptr, nullptr); + + // Poll while simulating work. + while(!result->IsCompleted) + { + Thread::Sleep(250); + Console::Write("."); + } + + // Call EndInvoke to retrieve the results. + String^ returnValue = caller->EndInvoke(threadId, result); + + Console::WriteLine("\nThe call executed on thread {0}, with return value \"{1}\".", + threadId, returnValue); +} + +/* This example produces output similar to the following: + +Test method begins. +............. +The call executed on thread 3, with return value "My call time was 3000.". + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp new file mode 100644 index 00000000000..8ce4877786e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AsyncDelegateExamples/cpp/waithandle.cpp @@ -0,0 +1,47 @@ +// +#using + +using namespace System; +using namespace System::Threading; +using namespace Examples::AdvancedProgramming::AsynchronousOperations; + +void main() +{ + // The asynchronous method puts the thread id here. + int threadId; + + // Create an instance of the test class. + AsyncDemo^ ad = gcnew AsyncDemo(); + + // Create the delegate. + AsyncMethodCaller^ caller = gcnew AsyncMethodCaller(ad, &AsyncDemo::TestMethod); + + // Initiate the asychronous call. + IAsyncResult^ result = caller->BeginInvoke(3000, + threadId, nullptr, nullptr); + + Thread::Sleep(0); + Console::WriteLine("Main thread {0} does some work.", + Thread::CurrentThread->ManagedThreadId); + + // Wait for the WaitHandle to become signaled. + result->AsyncWaitHandle->WaitOne(); + + // Perform additional processing here. + // Call EndInvoke to retrieve the results. + String^ returnValue = caller->EndInvoke(threadId, result); + + // Close the wait handle. + result->AsyncWaitHandle->Close(); + + Console::WriteLine("The call executed on thread {0}, with return value \"{1}\".", + threadId, returnValue); +} + +/* This example produces output similar to the following: + +Main thread 1 does some work. +Test method begins. +The call executed on thread 3, with return value "My call time was 3000.". + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp b/snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp new file mode 100644 index 00000000000..4f3ebd80ce7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AsyncResult.NewExamples/CPP/ad.cpp @@ -0,0 +1,122 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Runtime::Remoting::Messaging; + +// +// Context-bound type with the Synchronization context attribute. + +[Synchronization] +public ref class SampleSynchronized: public ContextBoundObject +{ +public: + + // A method that does some work, and returns the square of the given number. + int Square( int i ) + { + Console::Write( "The hash of the thread executing " ); + Console::WriteLine( "SampleSynchronized::Square is: {0}", Thread::CurrentThread->GetHashCode() ); + return i * i; + } + +}; +// + +// The async delegate used to call a method with this signature asynchronously. +delegate int SampSyncSqrDelegate( int i ); + +public ref class AsyncResultSample +{ +public: + + // + // Asynchronous Callback method. + static void MyCallback( IAsyncResult^ ar ) + { + + // Obtains the last parameter of the delegate call. + int value = Convert::ToInt32( ar->AsyncState ); + + // Obtains return value from the delegate call using EndInvoke. + AsyncResult^ aResult = dynamic_cast(ar); + SampSyncSqrDelegate^ temp = static_cast(aResult->AsyncDelegate); + int result = temp->EndInvoke( ar ); + Console::Write( "Simple::SomeMethod (AsyncCallback): Result of " ); + Console::WriteLine( " {0} in SampleSynchronized::Square is {1} ", value, result ); + } + + // +}; + +int main() +{ + int result; + int param; + + // + // Creates an instance of a context-bound type SampleSynchronized. + SampleSynchronized^ sampSyncObj = gcnew SampleSynchronized; + + // Checks whether the Object* is a proxy, since it is context-bound. + if ( RemotingServices::IsTransparentProxy( sampSyncObj ) ) + Console::WriteLine( "sampSyncObj is a proxy." ); + else + Console::WriteLine( "sampSyncObj is NOT a proxy." ); + + + // + // + param = 10; + Console::WriteLine( "" ); + Console::WriteLine( "Making a synchronous call on the context-bound Object*:" ); + result = sampSyncObj->Square( param ); + Console::Write( "The result of calling sampSyncObj.Square with " ); + Console::WriteLine( " {0} is {1}.", param, result ); + Console::WriteLine( "" ); + + // + // + SampSyncSqrDelegate^ sampleDelegate = gcnew SampSyncSqrDelegate( sampSyncObj, &SampleSynchronized::Square ); + param = 8; + Console::WriteLine( "Making a single asynchronous call on the context-bound Object*:" ); + IAsyncResult^ ar1 = sampleDelegate->BeginInvoke( param, gcnew AsyncCallback( AsyncResultSample::MyCallback ), param ); + Console::WriteLine( "Waiting for the asynchronous call to complete..." ); + WaitHandle^ wh = ar1->AsyncWaitHandle; + wh->WaitOne(); + wh->Close(); + + Console::WriteLine( "" ); + Console::WriteLine( "Waiting for the AsyncCallback to complete..." ); + // Note that normally, a callback and a wait handle would not + // both be used on the same asynchronous call. Callbacks are + // useful in cases where the original thread does not need to + // be synchronized with the result of the call, and in that + // scenario they provide a place to call EndInvoke. Sleep is + // used here because the callback is on a ThreadPool thread. + // ThreadPool threads are background threads, and will not keep + // a process running when the main thread ends. + Thread::Sleep( 1000 ); + return 0; + + // +} + +/* This code produces output similar to the following: + +sampSyncObj is a proxy. + +Making a synchronous call on the context-bound object: +The hash of the thread executing SampleSynchronized.Square is: 1 +The result of calling sampSyncObj.Square with 10 is 100. + +Making a single asynchronous call on the context-bound object: +Waiting for the asynchronous call to complete... +The hash of the thread executing SampleSynchronized.Square is: 6 + +Waiting for the AsyncCallback to complete... +Simple.SomeMethod (AsyncCallback): Result of 8 in SampleSynchronized.Square is 64 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp b/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp new file mode 100644 index 00000000000..41f69f4f144 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/AttrTargs/CPP/attrtargs.cpp @@ -0,0 +1,73 @@ + +// +using namespace System; + +namespace AttTargsCS +{ + + // This attribute is only valid on a class. + + [AttributeUsage(AttributeTargets::Class)] + public ref class ClassTargetAttribute: public Attribute{}; + + + // This attribute is only valid on a method. + + [AttributeUsage(AttributeTargets::Method)] + public ref class MethodTargetAttribute: public Attribute{}; + + + // This attribute is only valid on a constructor. + + [AttributeUsage(AttributeTargets::Constructor)] + public ref class ConstructorTargetAttribute: public Attribute{}; + + + // This attribute is only valid on a field. + + [AttributeUsage(AttributeTargets::Field)] + public ref class FieldTargetAttribute: public Attribute{}; + + + // This attribute is valid on a class or a method. + + [AttributeUsage(AttributeTargets::Class|AttributeTargets::Method)] + public ref class ClassMethodTargetAttribute: public Attribute{}; + + + // This attribute is valid on any target. + + [AttributeUsage(AttributeTargets::All)] + public ref class AllTargetsAttribute: public Attribute{}; + + + [ClassTarget] + [ClassMethodTarget] + [AllTargets] + public ref class TestClassAttribute + { + private: + + [ConstructorTarget] + [AllTargets] + TestClassAttribute(){} + + + public: + + [MethodTarget] + [ClassMethodTarget] + [AllTargets] + void Method1(){} + + + [FieldTarget] + [AllTargets] + int myInt; + static void Main(){} + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp b/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp new file mode 100644 index 00000000000..382e0b264dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Binder_1/CPP/binder.cpp @@ -0,0 +1,449 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Globalization; +using namespace System::Runtime::InteropServices; +public ref class MyBinder: public Binder +{ +public: + MyBinder() + : Binder() + {} + +private: + ref class BinderState + { + public: + array^args; + }; + +public: + virtual FieldInfo^ BindToField( BindingFlags bindingAttr, array^match, Object^ value, CultureInfo^ culture ) override + { + if ( match == nullptr ) + throw gcnew ArgumentNullException( "match" ); + + // Get a field for which the value parameter can be converted to the specified field type. + for ( int i = 0; i < match->Length; i++ ) + if ( ChangeType( value, match[ i ]->FieldType, culture ) != nullptr ) + return match[ i ]; + + return nullptr; + } + + virtual MethodBase^ BindToMethod( BindingFlags bindingAttr, array^match, array^%args, array^ modifiers, CultureInfo^ culture, array^names, [Out]Object^% state ) override + { + // Store the arguments to the method in a state Object*. + BinderState^ myBinderState = gcnew BinderState; + array^arguments = gcnew array(args->Length); + args->CopyTo( arguments, 0 ); + myBinderState->args = arguments; + state = myBinderState; + if ( match == nullptr ) + throw gcnew ArgumentNullException; + + // Find a method that has the same parameters as those of the args parameter. + for ( int i = 0; i < match->Length; i++ ) + { + // Count the number of parameters that match. + int count = 0; + array^parameters = match[ i ]->GetParameters(); + + // Go on to the next method if the number of parameters do not match. + if ( args->Length != parameters->Length ) + continue; + + // Match each of the parameters that the user expects the method to have. + for ( int j = 0; j < args->Length; j++ ) + { + // If the names parameter is not 0, then reorder args. + if ( names != nullptr ) + { + if ( names->Length != args->Length ) + throw gcnew ArgumentException( "names and args must have the same number of elements." ); + + for ( int k = 0; k < names->Length; k++ ) + if ( String::Compare( parameters[ j ]->Name, names[ k ] ) == 0 ) + args[ j ] = myBinderState->args[ k ]; + } + + // Determine whether the types specified by the user can be converted to the parameter type. + if ( ChangeType( args[ j ], parameters[ j ]->ParameterType, culture ) != nullptr ) + count += 1; + else + break; + } + if ( count == args->Length ) + return match[ i ]; + } + return nullptr; + } + + virtual Object^ ChangeType( Object^ value, Type^ myChangeType, CultureInfo^ culture ) override + { + // Determine whether the value parameter can be converted to a value of type myType. + if ( CanConvertFrom( value->GetType(), myChangeType ) ) + // Return the converted Object*. + return Convert::ChangeType( value, myChangeType ); + else + return nullptr; + } + + virtual void ReorderArgumentArray( array^%args, Object^ state ) override + { + // Return the args that had been reordered by BindToMethod. + (safe_cast(state))->args->CopyTo( args, 0 ); + } + + virtual MethodBase^ SelectMethod( BindingFlags bindingAttr, array^match, array^types, array^ modifiers ) override + { + if ( match == nullptr ) + throw gcnew ArgumentNullException( "match" ); + + for ( int i = 0; i < match->Length; i++ ) + { + // Count the number of parameters that match. + int count = 0; + array^parameters = match[ i ]->GetParameters(); + + // Go on to the next method if the number of parameters do not match. + if ( types->Length != parameters->Length ) + continue; + + // Match each of the parameters that the user expects the method to have. + for ( int j = 0; j < types->Length; j++ ) + { + // Determine whether the types specified by the user can be converted to parameter type. + if ( CanConvertFrom( types[ j ], parameters[ j ]->ParameterType ) ) + count += 1; + else + break; + } + // Determine whether the method has been found. + if ( count == types->Length ) + return match[ i ]; + } + return nullptr; + } + + virtual PropertyInfo^ SelectProperty( BindingFlags bindingAttr, array^match, Type^ returnType, array^indexes, array^ modifiers ) override + { + if ( match == nullptr ) + throw gcnew ArgumentNullException( "match" ); + + for ( int i = 0; i < match->Length; i++ ) + { + // Count the number of indexes that match. + int count = 0; + array^parameters = match[ i ]->GetIndexParameters(); + + // Go on to the next property if the number of indexes do not match. + if ( indexes->Length != parameters->Length ) + continue; + + // Match each of the indexes that the user expects the property to have. + for ( int j = 0; j < indexes->Length; j++ ) + // Determine whether the types specified by the user can be converted to index type. + if ( CanConvertFrom( indexes[ j ], parameters[ j ]->ParameterType ) ) + count += 1; + else + break; + + // Determine whether the property has been found. + if ( count == indexes->Length ) + { + // Determine whether the return type can be converted to the properties type. + if ( CanConvertFrom( returnType, match[ i ]->PropertyType ) ) + return match[ i ]; + else + continue; + } + } + return nullptr; + } + +private: + + // Determines whether type1 can be converted to type2. Check only for primitive types. + bool CanConvertFrom( Type^ type1, Type^ type2 ) + { + if ( type1->IsPrimitive && type2->IsPrimitive ) + { + TypeCode typeCode1 = Type::GetTypeCode( type1 ); + TypeCode typeCode2 = Type::GetTypeCode( type2 ); + + // If both type1 and type2 have the same type, return true. + if ( typeCode1 == typeCode2 ) + return true; + + // Possible conversions from Char follow. + if ( typeCode1 == TypeCode::Char ) + { + switch ( typeCode2 ) + { + case TypeCode::UInt16: + return true; + + case TypeCode::UInt32: + return true; + + case TypeCode::Int32: + return true; + + case TypeCode::UInt64: + return true; + + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from Byte follow. + if ( typeCode1 == TypeCode::Byte ) + { + switch ( typeCode2 ) + { + case TypeCode::Char: + return true; + + case TypeCode::UInt16: + return true; + + case TypeCode::Int16: + return true; + + case TypeCode::UInt32: + return true; + + case TypeCode::Int32: + return true; + + case TypeCode::UInt64: + return true; + + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from SByte follow. + if ( typeCode1 == TypeCode::SByte ) + { + switch ( typeCode2 ) + { + case TypeCode::Int16: + return true; + + case TypeCode::Int32: + return true; + + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from UInt16 follow. + if ( typeCode1 == TypeCode::UInt16 ) + { + switch ( typeCode2 ) + { + case TypeCode::UInt32: + return true; + + case TypeCode::Int32: + return true; + + case TypeCode::UInt64: + return true; + + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from Int16 follow. + if ( typeCode1 == TypeCode::Int16 ) + { + switch ( typeCode2 ) + { + case TypeCode::Int32: + return true; + + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from UInt32 follow. + if ( typeCode1 == TypeCode::UInt32 ) + { + switch ( typeCode2 ) + { + case TypeCode::UInt64: + return true; + + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from Int32 follow. + if ( typeCode1 == TypeCode::Int32 ) + { + switch ( typeCode2 ) + { + case TypeCode::Int64: + return true; + + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from UInt64 follow. + if ( typeCode1 == TypeCode::UInt64 ) + { + switch ( typeCode2 ) + { + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from Int64 follow. + if ( typeCode1 == TypeCode::Int64 ) + { + switch ( typeCode2 ) + { + case TypeCode::Single: + return true; + + case TypeCode::Double: + return true; + + default: + return false; + } + } + + // Possible conversions from Single follow. + if ( typeCode1 == TypeCode::Single ) + { + switch ( typeCode2 ) + { + case TypeCode::Double: + return true; + + default: + return false; + } + } + } + + return false; + } + +}; + +public ref class MyClass1 +{ +public: + short myFieldB; + int myFieldA; + void MyMethod( long i, char k ) + { + Console::WriteLine( "\nThis is MyMethod(long i, char k)" ); + } + + void MyMethod( long i, long j ) + { + Console::WriteLine( "\nThis is MyMethod(long i, long j)" ); + } +}; + +int main() +{ + // Get the type of MyClass1. + Type^ myType = MyClass1::typeid; + + // Get the instance of MyClass1. + MyClass1^ myInstance = gcnew MyClass1; + Console::WriteLine( "\nDisplaying the results of using the MyBinder binder.\n" ); + + // Get the method information for MyMethod. + array^types = {short::typeid,short::typeid}; + MethodInfo^ myMethod = myType->GetMethod( "MyMethod", static_cast(BindingFlags::Public | BindingFlags::Instance), gcnew MyBinder, types, nullptr ); + Console::WriteLine( myMethod ); + + // Invoke MyMethod. + array^obj = {32,32}; + myMethod->Invoke( myInstance, BindingFlags::InvokeMethod, gcnew MyBinder, obj, CultureInfo::CurrentCulture ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp b/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp new file mode 100644 index 00000000000..9657b10660c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/BindingFlags/CPP/bindingflagssample.cpp @@ -0,0 +1,365 @@ +// +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; +using namespace System::IO; + +//namespace BindingFlagsSnippet { +public ref class TestClass +{ +public: + String^ Name; + +private: + array^ values; + int methodCalled; + +public: + + property Object^ Item [int] + { + Object^ get( int index ) + { + return values[ index ]; + } + + void set( int index, Object^ value ) + { + values[ index ] = value; + } + } + + property Object^ Value + { + Object^ get() + { + return "the value"; + } + } + + TestClass() + { + Name = "initialName"; + values = gcnew array {(int^)0,1,2,3,4,5,6,7,8,9}; + methodCalled = 0; + } + + TestClass(String^ initName) + { + Name = initName; + values = gcnew array {(int^)0,1,2,3,4,5,6,7,8,9}; + methodCalled = 0; + } + + static void SayHello() + { + Console::WriteLine( "Hello" ); + } + + void AddUp() + { + methodCalled++; + Console::WriteLine( "AddUp Called {0} times", methodCalled ); + } + + static double ComputeSum( double d1, double d2 ) + { + return d1 + d2; + } + + static void PrintName( String^ firstName, String^ lastName ) + { + Console::WriteLine( "{0},{1}", lastName, firstName ); + } + + void PrintTime() + { + Console::WriteLine( DateTime::Now ); + } + + void Swap( interior_ptr a, interior_ptr b ) + { + int x = *a; + *a = *b; + *b = x; + } +}; + + +[DefaultMemberAttribute("PrintTime")] +public ref class TestClass2 +{ +public: + void PrintTime() + { + Console::WriteLine( DateTime::Now ); + } + +}; + +public ref class Base +{ +private: + static int BaseOnlyPrivate = 0; +protected: + static int BaseOnly = 0; +}; + +public ref class Derived : Base +{ +public: + static int DerivedOnly = 0; +}; + +public ref class MostDerived : Derived {}; + +void main() +{ + array^ noArguments; + + // BindingFlags::InvokeMethod + // Call a static method. + Type^ t = TestClass::typeid; + Console::WriteLine(); + Console::WriteLine( "Invoking a static method." ); + Console::WriteLine( "-------------------------" ); + t->InvokeMember( "SayHello", BindingFlags::InvokeMethod | BindingFlags::Public | BindingFlags::Static, + nullptr, nullptr, noArguments ); + + // BindingFlags::InvokeMethod + // Call an instance method. + TestClass^ c = gcnew TestClass; + Console::WriteLine(); + Console::WriteLine( "Invoking an instance method." ); + Console::WriteLine( "----------------------------" ); + c->GetType()->InvokeMember( "AddUp", BindingFlags::InvokeMethod, nullptr, c, noArguments ); + c->GetType()->InvokeMember( "AddUp", BindingFlags::InvokeMethod, nullptr, c, noArguments ); + + // BindingFlags::InvokeMethod + // Call a method with parameters. + array^args = {100.09,184.45}; + Object^ result; + Console::WriteLine(); + Console::WriteLine( "Invoking a method with parameters." ); + Console::WriteLine( "---------------------------------" ); + result = t->InvokeMember( "ComputeSum", BindingFlags::InvokeMethod, nullptr, nullptr, args ); + Console::WriteLine( " {0} + {1} = {2}", args[ 0 ], args[ 1 ], result ); + + // BindingFlags::GetField, SetField + Console::WriteLine(); + Console::WriteLine( "Invoking a field (getting and setting.)" ); + Console::WriteLine( "--------------------------------------" ); + + // Get a field value. + result = t->InvokeMember( "Name", BindingFlags::GetField, nullptr, c, noArguments ); + Console::WriteLine( "Name == {0}", result ); + + // Set a field. + array^obj2 = {"NewName"}; + t->InvokeMember( "Name", BindingFlags::SetField, nullptr, c, obj2 ); + result = t->InvokeMember( "Name", BindingFlags::GetField, nullptr, c, noArguments ); + Console::WriteLine( "Name == {0}", result ); + Console::WriteLine(); + Console::WriteLine( "Invoking an indexed property (getting and setting.)" ); + Console::WriteLine( "--------------------------------------------------" ); + + // BindingFlags::GetProperty + // Get an indexed property value. + int index = 3; + array^obj3 = {index}; + result = t->InvokeMember( "Item", BindingFlags::GetProperty, nullptr, c, obj3 ); + Console::WriteLine( "Item->Item[ {0}] == {1}", index, result ); + + // BindingFlags::SetProperty + // Set an indexed property value. + index = 3; + array^obj4 = {index,"NewValue"}; + t->InvokeMember( "Item", BindingFlags::SetProperty, nullptr, c, obj4 ); + result = t->InvokeMember( "Item", BindingFlags::GetProperty, nullptr, c, obj3 ); + Console::WriteLine( "Item->Item[ {0}] == {1}", index, result ); + Console::WriteLine(); + Console::WriteLine( "Getting a field or property." ); + Console::WriteLine( "----------------------------" ); + + // BindingFlags::GetField + // Get a field or property. + result = t->InvokeMember( "Name", static_cast(BindingFlags::GetField | + BindingFlags::GetProperty), nullptr, c, noArguments ); + Console::WriteLine( "Name == {0}", result ); + + // BindingFlags::GetProperty + result = t->InvokeMember( "Value", static_cast(BindingFlags::GetField | + BindingFlags::GetProperty), nullptr, c, noArguments ); + Console::WriteLine( "Value == {0}", result ); + Console::WriteLine(); + Console::WriteLine( "Invoking a method with named parameters." ); + Console::WriteLine( "---------------------------------------" ); + + // BindingFlags::InvokeMethod + // Call a method using named parameters. + array^argValues = {"Mouse","Micky"}; + array^argNames = {"lastName","firstName"}; + t->InvokeMember( "PrintName", BindingFlags::InvokeMethod, nullptr, nullptr, argValues, nullptr, + nullptr, argNames ); + Console::WriteLine(); + Console::WriteLine( "Invoking a default member of a type." ); + Console::WriteLine( "------------------------------------" ); + + // BindingFlags::Default + // Call the default member of a type. + Type^ t3 = TestClass2::typeid; + t3->InvokeMember( "", static_cast(BindingFlags::InvokeMethod | BindingFlags::Default), + nullptr, gcnew TestClass2, noArguments ); + + // BindingFlags::Static, NonPublic, and Public + // Invoking a member with ref parameters. + Console::WriteLine(); + Console::WriteLine( "Invoking a method with ref parameters." ); + Console::WriteLine( "--------------------------------------" ); + MethodInfo^ m = t->GetMethod( "Swap" ); + args = gcnew array(2); + args[ 0 ] = 1; + args[ 1 ] = 2; + m->Invoke( gcnew TestClass, args ); + Console::WriteLine( "{0}, {1}", args[ 0 ], args[ 1 ] ); + + // BindingFlags::CreateInstance + // Creating an instance with a parameterless constructor. + Console::WriteLine(); + Console::WriteLine( "Creating an instance with a parameterless constructor." ); + Console::WriteLine( "------------------------------------------------------" ); + Object^ obj = t->InvokeMember( "TestClass", static_cast(BindingFlags::Public | + BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, noArguments ); + Console::WriteLine("Instance of {0} created.", obj->GetType()->Name); + + // Creating an instance with a constructor that has parameters. + Console::WriteLine(); + Console::WriteLine( "Creating an instance with a constructor that has parameters." ); + Console::WriteLine( "------------------------------------------------------------" ); + obj = t->InvokeMember( "TestClass", static_cast(BindingFlags::Public | + BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, + gcnew array { "Hello, World!" } ); + Console::WriteLine("Instance of {0} created with initial value '{1}'.", obj->GetType()->Name, + obj->GetType()->InvokeMember("Name", BindingFlags::GetField, nullptr, obj, noArguments)); + + // BindingFlags::DeclaredOnly + Console::WriteLine(); + Console::WriteLine( "DeclaredOnly instance members." ); + Console::WriteLine( "------------------------------" ); + array^memInfo = t->GetMembers( BindingFlags::DeclaredOnly | + BindingFlags::Instance | BindingFlags::Public); + for ( int i = 0; i < memInfo->Length; i++ ) + { + Console::WriteLine( memInfo[ i ]->Name ); + + } + + // BindingFlags::IgnoreCase + Console::WriteLine(); + Console::WriteLine( "Using IgnoreCase and invoking the PrintName method." ); + Console::WriteLine( "---------------------------------------------------" ); + t->InvokeMember( "printname", static_cast(BindingFlags::IgnoreCase | + BindingFlags::Static | BindingFlags::Public | BindingFlags::InvokeMethod), + nullptr, nullptr, gcnew array {"Brad","Smith"}); + + // BindingFlags::FlattenHierarchy + Console::WriteLine(); + Console::WriteLine( "Using FlattenHierarchy to get inherited static protected and public members." ); + Console::WriteLine( "----------------------------------------------------------------------------" ); + array^ finfos = MostDerived::typeid->GetFields(BindingFlags::NonPublic | + BindingFlags::Public | BindingFlags::Static | BindingFlags::FlattenHierarchy); + for each (FieldInfo^ finfo in finfos) + { + Console::WriteLine("{0} defined in {1}.", finfo->Name, finfo->DeclaringType->Name); + } + + Console::WriteLine(); + Console::WriteLine("Without FlattenHierarchy." ); + Console::WriteLine("-------------------------"); + finfos = MostDerived::typeid->GetFields(BindingFlags::NonPublic | BindingFlags::Public | + BindingFlags::Static); + for each (FieldInfo^ finfo in finfos) + { + Console::WriteLine("{0} defined in {1}.", finfo->Name, finfo->DeclaringType->Name); + } +}; + +/* This example produces output similar to the following: + +Invoking a static method. +------------------------- +Hello + +Invoking an instance method. +---------------------------- +AddUp Called 1 times +AddUp Called 2 times + +Invoking a method with parameters. +--------------------------------- + 100.09 + 184.45 = 284.54 + +Invoking a field (getting and setting.) +-------------------------------------- +Name == initialName +Name == NewName + +Invoking an indexed property (getting and setting.) +-------------------------------------------------- +Item->Item[ 3] == 3 +Item->Item[ 3] == NewValue + +Getting a field or property. +---------------------------- +Name == NewName +Value == the value + +Invoking a method with named parameters. +--------------------------------------- +Mouse,Micky + +Invoking a default member of a type. +------------------------------------ +12/23/2009 4:19:06 PM + +Invoking a method with ref parameters. +-------------------------------------- +2, 1 + +Creating an instance with a parameterless constructor. +------------------------------------------------------ +Instance of TestClass created. + +Creating an instance with a constructor that has parameters. +------------------------------------------------------------ +Instance of TestClass created with initial value 'Hello, World!'. + +DeclaredOnly instance members. +------------------------------ +get_Item +set_Item +get_Value +AddUp +PrintTime +Swap +.ctor +.ctor +Value +Item +Name +methodCalled + +Using IgnoreCase and invoking the PrintName method. +--------------------------------------------------- +Smith,Brad + +Using FlattenHierarchy to get inherited static protected and public members. +---------------------------------------------------------------------------- +DerivedOnly defined in Derived. +BaseOnly defined in Base. + +Without FlattenHierarchy. +------------------------- + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp b/snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp new file mode 100644 index 00000000000..d20aed62b38 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CertInfo/CPP/certinfo.cpp @@ -0,0 +1,80 @@ + + +// +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Permissions; +using namespace System::IO; +using namespace System::Security::Cryptography::X509Certificates; + +//Reads a file. +array^ ReadFile( String^ fileName ) +{ + FileStream^ f = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + int size = (int)f->Length; + array^data = gcnew array(size); + size = f->Read( data, 0, size ); + f->Close(); + return data; +} + +[SecurityPermissionAttribute(SecurityAction::LinkDemand, Unrestricted = true)] +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + //Test for correct number of arguments. + if ( args->Length < 2 ) + { + Console::WriteLine( "Usage: CertInfo " ); + return -1; + } + + try + { + System::Security::Cryptography::X509Certificates::X509Certificate2 ^ x509 = + gcnew System::Security::Cryptography::X509Certificates::X509Certificate2; + + //Create X509Certificate2 object from .cer file. + array^rawData = ReadFile( args[ 1 ] ); + + x509->Import(rawData); + + //Print to console information contained in the certificate. + Console::WriteLine( "{0}Subject: {1}{0}", Environment::NewLine, x509->Subject ); + Console::WriteLine( "{0}Issuer: {1}{0}", Environment::NewLine, x509->Issuer ); + Console::WriteLine( "{0}Version: {1}{0}", Environment::NewLine, x509->Version ); + Console::WriteLine( "{0}Valid Date: {1}{0}", Environment::NewLine, x509->NotBefore ); + Console::WriteLine( "{0}Expiry Date: {1}{0}", Environment::NewLine, x509->NotAfter ); + Console::WriteLine( "{0}Thumbprint: {1}{0}", Environment::NewLine, x509->Thumbprint ); + Console::WriteLine( "{0}Serial Number: {1}{0}", Environment::NewLine, x509->SerialNumber ); + Console::WriteLine( "{0}Friendly Name: {1}{0}", Environment::NewLine, x509->PublicKey->Oid->FriendlyName ); + Console::WriteLine( "{0}Public Key Format: {1}{0}", Environment::NewLine, x509->PublicKey->EncodedKeyValue->Format(true) ); + Console::WriteLine( "{0}Raw Data Length: {1}{0}", Environment::NewLine, x509->RawData->Length ); + Console::WriteLine( "{0}Certificate to string: {1}{0}", Environment::NewLine, x509->ToString( true ) ); + Console::WriteLine( "{0}Certificate to XML String: {1}{0}", Environment::NewLine, x509->PublicKey->Key->ToXmlString( false ) ); + + //Add the certificate to a X509Store. + X509Store ^ store = gcnew X509Store; + store->Open( OpenFlags::MaxAllowed ); + store->Add( x509 ); + store->Close(); + } + catch ( DirectoryNotFoundException^ ) + { + Console::WriteLine( "Error: The directory specified could not be found." ); + } + catch ( IOException^ ) + { + Console::WriteLine( "Error: A file in the directory could not be accessed." ); + } + catch ( NullReferenceException^ ) + { + Console::WriteLine( "File must be a .cer file. Program does not have access to that type of file." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp b/snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp new file mode 100644 index 00000000000..bbe9ba49645 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CertSelect/CPP/certselect.cpp @@ -0,0 +1,47 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Permissions; +using namespace System::IO; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + try + { + X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser ); + store->Open( static_cast(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); + X509Certificate2Collection ^ collection = dynamic_cast(store->Certificates); + X509Certificate2Collection ^ fcollection = dynamic_cast(collection->Find( X509FindType::FindByTimeValid, DateTime::Now, false )); + X509Certificate2Collection ^ scollection = X509Certificate2UI::SelectFromCollection(fcollection, "Test Certificate Select","Select a certificate from the following list to get information on that certificate",X509SelectionFlag::MultiSelection); + Console::WriteLine( "Number of certificates: {0}{1}", scollection->Count, Environment::NewLine ); + System::Collections::IEnumerator^ myEnum = scollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + X509Certificate2 ^ x509 = safe_cast(myEnum->Current); + array^rawdata = x509->RawData; + Console::WriteLine( "Content Type: {0}{1}", X509Certificate2::GetCertContentType( rawdata ), Environment::NewLine ); + Console::WriteLine( "Friendly Name: {0}{1}", x509->FriendlyName, Environment::NewLine ); + Console::WriteLine( "Certificate Verified?: {0}{1}", x509->Verify(), Environment::NewLine ); + Console::WriteLine( "Simple Name: {0}{1}", x509->GetNameInfo( X509NameType::SimpleName, true ), Environment::NewLine ); + Console::WriteLine( "Signature Algorithm: {0}{1}", x509->SignatureAlgorithm->FriendlyName, Environment::NewLine ); + Console::WriteLine( "Private Key: {0}{1}", x509->PrivateKey->ToXmlString( false ), Environment::NewLine ); + Console::WriteLine( "Public Key: {0}{1}", x509->PublicKey->Key->ToXmlString( false ), Environment::NewLine ); + Console::WriteLine( "Certificate Archived?: {0}{1}", x509->Archived, Environment::NewLine ); + Console::WriteLine( "Length of Raw Data: {0}{1}", x509->RawData->Length, Environment::NewLine ); + x509->Reset(); + } + store->Close(); + } + catch ( CryptographicException^ ) + { + Console::WriteLine( "Information could not be written out for this certificate." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp new file mode 100644 index 00000000000..262a32465c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CipherReference2/CPP/example.cpp @@ -0,0 +1,38 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography::Xml; +using namespace System::Xml; +using namespace System::IO; + +/// This sample used the GetXml method in the CipherReference class to +/// write the XML values for the CipherReference to the console. + +[STAThread] +int main() +{ + + //Create a URI string. + String^ uri = "http://www.woodgrovebank.com/document.xml"; + + // Create a Base64 transform. The input content retrieved from the + // URI should be Base64-decoded before other processing. + Transform^ base64 = gcnew XmlDsigBase64Transform; + + //Create a transform chain and add the transform to it. + TransformChain^ tc = gcnew TransformChain; + tc->Add( base64 ); + + //Create information. + CipherReference ^ reference = gcnew CipherReference( uri,tc ); + + // Write the CipherReference value to the console. + Console::WriteLine( "Cipher Reference data: {0}", reference->GetXml()->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp b/snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp new file mode 100644 index 00000000000..20b2ee5c8d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ClassInterfaceType/cpp/ClassInterfaceType.cpp @@ -0,0 +1,41 @@ +//Types:System.Runtime.InteropServices.ClassInterfaceType +// +using namespace System; +using namespace System::Runtime::InteropServices; + +// Have the CLR expose a class interface (derived from IDispatch) +// for this type. COM clients can call the members of this +// class using the Invoke method from the IDispatch interface. +[ClassInterface(ClassInterfaceType::AutoDispatch)] +public ref class AClassUsableViaCOM +{ +public: + AClassUsableViaCOM() + { + } + +public: + int Add(int x, int y) + { + return x + y; + } +}; + +// The CLR does not expose a class interface for this type. +// COM clients can call the members of this class using +// the methods from the IComparable interface. +[ClassInterface(ClassInterfaceType::None)] +public ref class AnotherClassUsableViaCOM : public IComparable +{ +public: + AnotherClassUsableViaCOM() + { + } + + virtual int CompareTo(Object^ o) = IComparable::CompareTo + { + return 0; + } +}; +// + diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp new file mode 100644 index 00000000000..cafb9d2dab4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeArgumentReferenceExpressionExample/CPP/codeargumentreferenceexpressionexample.cpp @@ -0,0 +1,43 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeArgumentReferenceExpressionExample + { + public: + CodeArgumentReferenceExpressionExample() + { + + // + // Declare a method that accepts a string parameter named text. + CodeMemberMethod^ cmm = gcnew CodeMemberMethod; + cmm->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","text" ) ); + cmm->Name = "WriteString"; + cmm->ReturnType = gcnew CodeTypeReference( "System::Void" ); + array^ce = {gcnew CodeArgumentReferenceExpression( "test1" )}; + + // Create a method invoke statement to output the string passed to the method. + CodeMethodInvokeExpression^ cmie = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine",ce ); + + // Add the method invoke expression to the method's statements collection. + cmm->Statements->Add( cmie ); + + // A C++ code generator produces the following source code for the preceeding example code: + // private: + // void WriteString(String text) { + // Console::WriteLine(text); + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp new file mode 100644 index 00000000000..ba586aa0cf3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeArrayCreateExpressionSnippet/CPP/codearraycreateexpressionsnippet.cpp @@ -0,0 +1,289 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; +using namespace Microsoft::CSharp; +using namespace Microsoft::VisualBasic; +using namespace Microsoft::JScript; + +///

+/// Provides a wrapper for CodeDOM samples. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::CodeDom::CodeCompileUnit^ cu; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::RadioButton^ radioButton1; + System::Windows::Forms::RadioButton^ radioButton2; + System::Windows::Forms::RadioButton^ radioButton3; + int language; + System::ComponentModel::Container^ components; + +public: + Form1() + { + language = 1; // 1 = Csharp 2 = VB 3 = JScript + components = nullptr; + InitializeComponent(); + cu = CreateGraph(); + } + + // +public: + CodeCompileUnit^ CreateGraph() + { + // Create a compile unit to contain a CodeDOM graph + CodeCompileUnit^ cu = gcnew CodeCompileUnit; + + // Create a namespace named "TestSpace" + CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); + + // Create a new type named "TestClass" + CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); + + // Create a new entry point method + CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod; + + // + // Create an initialization expression for a new array of type Int32 with 10 indices + CodeArrayCreateExpression^ ca1 = gcnew CodeArrayCreateExpression( "System.Int32",10 ); + + // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression + CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32[]","x",ca1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // int[] x = new int[10]; + // + + // Add the variable declaration and initialization statement to the entry point method + cm->Statements->Add( cv1 ); + + // Add the entry point method to the "TestClass" type + cd->Members->Add( cm ); + + // Add the "TestClass" type to the namespace + cn->Types->Add( cd ); + + // Add the "TestSpace" namespace to the compile unit + cu->Namespaces->Add( cn ); + return cu; + } + // + +private: + void OutputGraph() + { + // Create string writer to output to textbox + StringWriter^ sw = gcnew StringWriter; + + // Create appropriate CodeProvider + System::CodeDom::Compiler::CodeDomProvider^ cp; + switch ( language ) + { + case 2: + // VB + cp = CodeDomProvider::CreateProvider("VisualBasic"); + break; + + case 3: + // JScript + cp = CodeDomProvider::CreateProvider("JScript"); + break; + + default: + // CSharp + cp = CodeDomProvider::CreateProvider("CSharp"); + break; + } + + // Create a code generator that will output to the string writer + ICodeGenerator^ cg = cp->CreateGenerator( sw ); + + // Generate code from the compile unit and outputs it to the string writer + cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions ); + + // Output the contents of the string writer to the textbox + this->textBox1->Text = sw->ToString(); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->groupBox1 = gcnew System::Windows::Forms::GroupBox; + this->radioButton1 = gcnew System::Windows::Forms::RadioButton; + this->radioButton2 = gcnew System::Windows::Forms::RadioButton; + this->radioButton3 = gcnew System::Windows::Forms::RadioButton; + this->groupBox1->SuspendLayout(); + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 16, 112 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both; + this->textBox1->Size = System::Drawing::Size( 664, 248 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + this->textBox1->WordWrap = false; + + // + // button1 + // + this->button1->BackColor = System::Drawing::Color::Aquamarine; + this->button1->Location = System::Drawing::Point( 16, 16 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "Generate"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->BackColor = System::Drawing::Color::MediumTurquoise; + this->button2->Location = System::Drawing::Point( 112, 16 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 2; + this->button2->Text = "Show Code"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // groupBox1 + // + array^temp0 = {this->radioButton3,this->radioButton2,this->radioButton1}; + this->groupBox1->Controls->AddRange( temp0 ); + this->groupBox1->Location = System::Drawing::Point( 16, 48 ); + this->groupBox1->Name = "groupBox1"; + this->groupBox1->Size = System::Drawing::Size( 384, 56 ); + this->groupBox1->TabIndex = 3; + this->groupBox1->TabStop = false; + this->groupBox1->Text = "Language selection"; + + // + // radioButton1 + // + this->radioButton1->Checked = true; + this->radioButton1->Location = System::Drawing::Point( 16, 24 ); + this->radioButton1->Name = "radioButton1"; + this->radioButton1->TabIndex = 0; + this->radioButton1->TabStop = true; + this->radioButton1->Text = "CSharp"; + this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // radioButton2 + // + this->radioButton2->Location = System::Drawing::Point( 144, 24 ); + this->radioButton2->Name = "radioButton2"; + this->radioButton2->TabIndex = 1; + this->radioButton2->Text = "Visual Basic"; + this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged ); + + // + // radioButton3 + // + this->radioButton3->Location = System::Drawing::Point( 272, 24 ); + this->radioButton3->Name = "radioButton3"; + this->radioButton3->TabIndex = 2; + this->radioButton3->Text = "JScript"; + this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged ); + + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 714, 367 ); + array^temp1 = {this->groupBox1,this->button2,this->button1,this->textBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "CodeDOM Samples Framework"; + this->groupBox1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void ShowCode() + { + this->textBox1->Text = ""; + } + + // Show code button + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowCode(); + } + + // Generate and show code button + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + OutputGraph(); + } + + // Csharp language selection button + void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = true; + radioButton2->Checked = false; + radioButton3->Checked = false; + language = 1; + } + + // Visual Basic language selection button + void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = false; + radioButton2->Checked = true; + radioButton3->Checked = false; + language = 2; + } + + // JScript language selection button + void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = false; + radioButton2->Checked = false; + radioButton3->Checked = true; + language = 3; + } + +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp new file mode 100644 index 00000000000..e565079d0a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeArrayIndexerExpressionSnippet/CPP/codearrayindexerexpressionsnippet.cpp @@ -0,0 +1,301 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; +using namespace Microsoft::CSharp; +using namespace Microsoft::VisualBasic; +using namespace Microsoft::JScript; + +/// +/// Provides a wrapper for CodeDOM samples. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::CodeDom::CodeCompileUnit^ cu; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::RadioButton^ radioButton1; + System::Windows::Forms::RadioButton^ radioButton2; + System::Windows::Forms::RadioButton^ radioButton3; + int language; + System::ComponentModel::Container^ components; + +public: + Form1() + { + language = 1; // 1 = Csharp 2 = VB 3 = JScript + components = nullptr; + InitializeComponent(); + cu = CreateGraph(); + } + + // +public: + CodeCompileUnit^ CreateGraph() + { + // Create a compile unit to contain a CodeDOM graph + CodeCompileUnit^ cu = gcnew CodeCompileUnit; + + // Create a namespace named "TestSpace" + CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); + + // Create a new type named "TestClass" + CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); + + // Create an entry point method + CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod; + + // Create the initialization expression for an array of type Int32 with 10 indices + CodeArrayCreateExpression^ ca1 = gcnew CodeArrayCreateExpression( "System.Int32",10 ); + + // Declare an array of type Int32, using the CodeArrayCreateExpression ca1 as the initialization expression + CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32[]","x",ca1 ); + + // Add the array declaration and initialization statement to the entry point method class member + cm->Statements->Add( cv1 ); + // + + // Create an array indexer expression that references index 5 of array "x" + array^temp = {gcnew CodePrimitiveExpression( 5 )}; + CodeArrayIndexerExpression^ ci1 = gcnew CodeArrayIndexerExpression( gcnew CodeVariableReferenceExpression( "x" ),temp ); + + // A C# code generator produces the following source code for the preceeding example code: + // x[5] + // + // Declare a variable of type Int32 and adds it to the entry point method + CodeVariableDeclarationStatement^ cv2 = gcnew CodeVariableDeclarationStatement( "System.Int32","y" ); + cm->Statements->Add( cv2 ); + + // Assign the value of the array indexer ci1 to variable "y" + CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "y" ),ci1 ); + + // Add the assignment statement to the entry point method + cm->Statements->Add( as1 ); + + // Add the entry point method to the "TestClass" type + cd->Members->Add( cm ); + + // Add the "TestClass" type to the namespace + cn->Types->Add( cd ); + + // Add the "TestSpace" namespace to the compile unit + cu->Namespaces->Add( cn ); + return cu; + } + // + +private: + void OutputGraph() + { + // Create string writer to output to textbox + StringWriter^ sw = gcnew StringWriter; + + // Create appropriate CodeProvider + System::CodeDom::Compiler::CodeDomProvider^ cp; + switch ( language ) + { + case 2: + // VB + cp = CodeDomProvider::CreateProvider("VisualBasic"); + break; + + case 3: + // JScript + cp = CodeDomProvider::CreateProvider("JScript"); + break; + + default: + // CSharp + cp = CodeDomProvider::CreateProvider("CSharp"); + break; + } + + // Create a code generator that will output to the string writer + ICodeGenerator^ cg = cp->CreateGenerator( sw ); + + // Generate code from the compile unit and outputs it to the string writer + cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions ); + + // Output the contents of the string writer to the textbox + this->textBox1->Text = sw->ToString(); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->groupBox1 = gcnew System::Windows::Forms::GroupBox; + this->radioButton1 = gcnew System::Windows::Forms::RadioButton; + this->radioButton2 = gcnew System::Windows::Forms::RadioButton; + this->radioButton3 = gcnew System::Windows::Forms::RadioButton; + this->groupBox1->SuspendLayout(); + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 16, 112 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both; + this->textBox1->Size = System::Drawing::Size( 664, 248 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + this->textBox1->WordWrap = false; + + // + // button1 + // + this->button1->BackColor = System::Drawing::Color::Aquamarine; + this->button1->Location = System::Drawing::Point( 16, 16 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "Generate"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->BackColor = System::Drawing::Color::MediumTurquoise; + this->button2->Location = System::Drawing::Point( 112, 16 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 2; + this->button2->Text = "Show Code"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // groupBox1 + // + array^temp2 = {this->radioButton3,this->radioButton2,this->radioButton1}; + this->groupBox1->Controls->AddRange( temp2 ); + this->groupBox1->Location = System::Drawing::Point( 16, 48 ); + this->groupBox1->Name = "groupBox1"; + this->groupBox1->Size = System::Drawing::Size( 384, 56 ); + this->groupBox1->TabIndex = 3; + this->groupBox1->TabStop = false; + this->groupBox1->Text = "Language selection"; + + // + // radioButton1 + // + this->radioButton1->Checked = true; + this->radioButton1->Location = System::Drawing::Point( 16, 24 ); + this->radioButton1->Name = "radioButton1"; + this->radioButton1->TabIndex = 0; + this->radioButton1->TabStop = true; + this->radioButton1->Text = "CSharp"; + this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // radioButton2 + // + this->radioButton2->Location = System::Drawing::Point( 144, 24 ); + this->radioButton2->Name = "radioButton2"; + this->radioButton2->TabIndex = 1; + this->radioButton2->Text = "Visual Basic"; + this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged ); + + // + // radioButton3 + // + this->radioButton3->Location = System::Drawing::Point( 272, 24 ); + this->radioButton3->Name = "radioButton3"; + this->radioButton3->TabIndex = 2; + this->radioButton3->Text = "JScript"; + this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged ); + + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 714, 367 ); + array^temp3 = {this->groupBox1,this->button2,this->button1,this->textBox1}; + this->Controls->AddRange( temp3 ); + this->Name = "Form1"; + this->Text = "CodeDOM Samples Framework"; + this->groupBox1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void ShowCode() + { + this->textBox1->Text = ""; + } + + // Show code button + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowCode(); + } + + // Generate and show code button + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + OutputGraph(); + } + + // Csharp language selection button + void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = true; + radioButton2->Checked = false; + radioButton3->Checked = false; + language = 1; + } + + // Visual Basic language selection button + void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = false; + radioButton2->Checked = true; + radioButton3->Checked = false; + language = 2; + } + + // JScript language selection button + void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = false; + radioButton2->Checked = false; + radioButton3->Checked = true; + language = 3; + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp new file mode 100644 index 00000000000..a94dc0b0c36 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeAssignStatement/CPP/codeassignstatementsnippet.cpp @@ -0,0 +1,289 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; +using namespace Microsoft::CSharp; +using namespace Microsoft::VisualBasic; +using namespace Microsoft::JScript; + +/// +/// Provides a wrapper for CodeDOM samples. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::CodeDom::CodeCompileUnit^ cu; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::RadioButton^ radioButton1; + System::Windows::Forms::RadioButton^ radioButton2; + System::Windows::Forms::RadioButton^ radioButton3; + int language; + System::ComponentModel::Container^ components; + +public: + Form1() + { + language = 1; // 1 = Csharp 2 = VB 3 = JScript + components = nullptr; + InitializeComponent(); + cu = CreateGraph(); + } + + // + CodeCompileUnit^ CreateGraph() + { + // Create a compile unit to contain a CodeDOM graph + CodeCompileUnit^ cu = gcnew CodeCompileUnit; + + // Create a namespace named "TestSpace" + CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); + + // Create a new type named "TestClass" + CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); + + // Create a new entry point method + CodeEntryPointMethod^ cm = gcnew CodeEntryPointMethod; + + // Declare a variable of type Int32 named "i" + CodeVariableDeclarationStatement^ cv1 = gcnew CodeVariableDeclarationStatement( "System.Int32","i" ); + + // Add the variable declaration statement to the entry point method + cm->Statements->Add( cv1 ); + + // + // Assigns the value of the 10 to the integer variable "i". + CodeAssignStatement^ as1 = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "i" ),gcnew CodePrimitiveExpression( 10 ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // i=10; + // + // Add the assignment statement to the entry point method + cm->Statements->Add( as1 ); + + // Add the entry point method to the "TestClass" type + cd->Members->Add( cm ); + + // Add the "TestClass" type to the namespace + cn->Types->Add( cd ); + + // Add the "TestSpace" namespace to the compile unit + cu->Namespaces->Add( cn ); + return cu; + } + // + +private: + void OutputGraph() + { + // Create string writer to output to textbox + StringWriter^ sw = gcnew StringWriter; + + // Create appropriate CodeProvider + System::CodeDom::Compiler::CodeDomProvider^ cp; + switch ( language ) + { + case 2: + // VB + cp = CodeDomProvider::CreateProvider("VisualBasic"); + break; + + case 3: + // JScript + cp = CodeDomProvider::CreateProvider("JScript"); + break; + + default: + // CSharp + cp = CodeDomProvider::CreateProvider("CSharp"); + break; + } + + // Create a code generator that will output to the string writer + ICodeGenerator^ cg = cp->CreateGenerator( sw ); + + // Generate code from the compile unit and outputs it to the string writer + cg->GenerateCodeFromCompileUnit( cu, sw, gcnew CodeGeneratorOptions ); + + // Output the contents of the string writer to the textbox + this->textBox1->Text = sw->ToString(); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->groupBox1 = gcnew System::Windows::Forms::GroupBox; + this->radioButton1 = gcnew System::Windows::Forms::RadioButton; + this->radioButton2 = gcnew System::Windows::Forms::RadioButton; + this->radioButton3 = gcnew System::Windows::Forms::RadioButton; + this->groupBox1->SuspendLayout(); + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 16, 112 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Both; + this->textBox1->Size = System::Drawing::Size( 664, 248 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + this->textBox1->WordWrap = false; + + // + // button1 + // + this->button1->BackColor = System::Drawing::Color::Aquamarine; + this->button1->Location = System::Drawing::Point( 16, 16 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "Generate"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->BackColor = System::Drawing::Color::MediumTurquoise; + this->button2->Location = System::Drawing::Point( 112, 16 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 2; + this->button2->Text = "Show Code"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // groupBox1 + // + array^temp0 = {this->radioButton3,this->radioButton2,this->radioButton1}; + this->groupBox1->Controls->AddRange( temp0 ); + this->groupBox1->Location = System::Drawing::Point( 16, 48 ); + this->groupBox1->Name = "groupBox1"; + this->groupBox1->Size = System::Drawing::Size( 384, 56 ); + this->groupBox1->TabIndex = 3; + this->groupBox1->TabStop = false; + this->groupBox1->Text = "Language selection"; + + // + // radioButton1 + // + this->radioButton1->Checked = true; + this->radioButton1->Location = System::Drawing::Point( 16, 24 ); + this->radioButton1->Name = "radioButton1"; + this->radioButton1->TabIndex = 0; + this->radioButton1->TabStop = true; + this->radioButton1->Text = "CSharp"; + this->radioButton1->Click += gcnew System::EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // radioButton2 + // + this->radioButton2->Location = System::Drawing::Point( 144, 24 ); + this->radioButton2->Name = "radioButton2"; + this->radioButton2->TabIndex = 1; + this->radioButton2->Text = "Visual Basic"; + this->radioButton2->Click += gcnew System::EventHandler( this, &Form1::radioButton2_CheckedChanged ); + + // + // radioButton3 + // + this->radioButton3->Location = System::Drawing::Point( 272, 24 ); + this->radioButton3->Name = "radioButton3"; + this->radioButton3->TabIndex = 2; + this->radioButton3->Text = "JScript"; + this->radioButton3->Click += gcnew System::EventHandler( this, &Form1::radioButton3_CheckedChanged ); + + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 714, 367 ); + array^temp1 = {this->groupBox1,this->button2,this->button1,this->textBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "CodeDOM Samples Framework"; + this->groupBox1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void ShowCode() + { + this->textBox1->Text = ""; + } + + // Show code button + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowCode(); + } + + // Generate and show code button + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + OutputGraph(); + } + + // Csharp language selection button + void radioButton1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = true; + radioButton2->Checked = false; + radioButton3->Checked = false; + language = 1; + } + + // Visual Basic language selection button + void radioButton2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = false; + radioButton2->Checked = true; + radioButton3->Checked = false; + language = 2; + } + + // JScript language selection button + void radioButton3_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioButton1->Checked = false; + radioButton2->Checked = false; + radioButton3->Checked = true; + language = 3; + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp new file mode 100644 index 00000000000..bf0e69c601b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeAttachEventStatementExample/CPP/codeattacheventstatementexample.cpp @@ -0,0 +1,81 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeAttachEventStatementExample + { + public: + CodeAttachEventStatementExample() + { + + // + // Declares a type to contain the delegate and constructor method. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "AttachEventTest" ); + + // Declares an event that needs no custom event arguments class. + CodeMemberEvent^ event1 = gcnew CodeMemberEvent; + event1->Name = "TestEvent"; + event1->Type = gcnew CodeTypeReference( "System.EventHandler" ); + + // Adds the event to the type members. + type1->Members->Add( event1 ); + + // Declares a method that matches the System.EventHandler method signature. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "TestMethod"; + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); + + // Adds the method to the type members. + type1->Members->Add( method1 ); + + // Defines a constructor that attaches a TestDelegate delegate pointing to + // the TestMethod method to the TestEvent event. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + + // + // Defines a delegate creation expression that creates an EventHandler delegate pointing to a method named TestMethod. + CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"TestMethod" ); + + // Attaches an EventHandler delegate pointing to TestMethod to the TestEvent event. + CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestEvent += new System.EventHandler(this.TestMethod); + // + // Adds the constructor statements to the construtor. + constructor1->Statements->Add( attachStatement1 ); + + // Adds the construtor to the type members. + type1->Members->Add( constructor1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class AttachEventTest + // { + // + // public AttachEventTest() + // { + // this.TestEvent += new System.EventHandler(this.TestMethod); + // } + // + // private event System.EventHandler TestEvent; + // + // private void TestMethod(object sender, System.EventArgs e) + // { + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..0e04788981c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeAttributeArgumentCollectionExample/CPP/class1.cpp @@ -0,0 +1,82 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +namespace CodeAttributeArgumentCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + + // CodeAttributeArgumentCollection + void CodeAttributeArgumentCollectionExample() + { + + // + // + // Creates an empty CodeAttributeArgumentCollection. + CodeAttributeArgumentCollection^ collection = gcnew CodeAttributeArgumentCollection; + // + + // + // Adds a CodeAttributeArgument to the collection. + collection->Add( gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ) ); + // + + // + // Adds an array of CodeAttributeArgument objects to the collection. + array^arguments = {gcnew CodeAttributeArgument,gcnew CodeAttributeArgument}; + collection->AddRange( arguments ); + + // Adds a collection of CodeAttributeArgument objects to + // the collection. + CodeAttributeArgumentCollection^ argumentsCollection = gcnew CodeAttributeArgumentCollection; + argumentsCollection->Add( gcnew CodeAttributeArgument( "TestBooleanArgument",gcnew CodePrimitiveExpression( true ) ) ); + argumentsCollection->Add( gcnew CodeAttributeArgument( "TestIntArgument",gcnew CodePrimitiveExpression( 1 ) ) ); + collection->AddRange( argumentsCollection ); + // + + // + // Tests for the presence of a CodeAttributeArgument + // within the collection, and retrieves its index if it is found. + CodeAttributeArgument^ testArgument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ); + int itemIndex = -1; + if ( collection->Contains( testArgument ) ) + itemIndex = collection->IndexOf( testArgument ); + // + + // + // Copies the contents of the collection beginning at index 0, + // to the specified CodeAttributeArgument array. + // 'arguments' is a CodeAttributeArgument array. + collection->CopyTo( arguments, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeAttributeArgument at index 0 of the collection. + collection->Insert( 0, gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ) ); + // + + // + // Removes the specified CodeAttributeArgument from the collection. + CodeAttributeArgument^ argument = gcnew CodeAttributeArgument( "Test Boolean Argument",gcnew CodePrimitiveExpression( true ) ); + collection->Remove( argument ); + // + + // + // Removes the CodeAttributeArgument at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..cfcbb80230e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeAttributeDeclarationCollectionExample/CPP/class1.cpp @@ -0,0 +1,90 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Collections; + +namespace CodeAttributeDeclarationCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeAttributeDeclarationCollection + void CodeAttributeDeclarationCollectionExample() + { + + // + // + // Creates an empty CodeAttributeDeclarationCollection. + CodeAttributeDeclarationCollection^ collection = gcnew CodeAttributeDeclarationCollection; + // + + // + // Adds a CodeAttributeDeclaration to the collection. + array^temp = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; + collection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp ) ); + // + + // + // Adds an array of CodeAttributeDeclaration objects + // to the collection. + array^declarations = {gcnew CodeAttributeDeclaration,gcnew CodeAttributeDeclaration}; + collection->AddRange( declarations ); + + // Adds a collection of CodeAttributeDeclaration objects + // to the collection. + CodeAttributeDeclarationCollection^ declarationsCollection = gcnew CodeAttributeDeclarationCollection; + array^temp1 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; + declarationsCollection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp1 ) ); + array^temp2 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( true ) )}; + declarationsCollection->Add( gcnew CodeAttributeDeclaration( "BrowsableAttribute",temp2 ) ); + collection->AddRange( declarationsCollection ); + // + + // + // Tests for the presence of a CodeAttributeDeclaration in + // the collection, and retrieves its index if it is found. + array^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; + CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 ); + int itemIndex = -1; + if ( collection->Contains( testdeclaration ) ) + itemIndex = collection->IndexOf( testdeclaration ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified CodeAttributeDeclaration array. + // 'declarations' is a CodeAttributeDeclaration array. + collection->CopyTo( declarations, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeAttributeDeclaration at index 0 of the collection. + array^temp4 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; + collection->Insert( 0, gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp4 ) ); + // + + // + // Removes the specified CodeAttributeDeclaration from + // the collection. + array^temp5 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )}; + CodeAttributeDeclaration^ declaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp5 ); + collection->Remove( declaration ); + // + + // + // Removes the CodeAttributeDeclaration at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp new file mode 100644 index 00000000000..636d5881825 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeBaseReferenceExpressionExample/CPP/codebasereferenceexpressionexample.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +public ref class CodeBaseReferenceExpressionExample +{ +public: + CodeBaseReferenceExpressionExample() + { + + // + // Example method invoke expression uses CodeBaseReferenceExpression to produce + // a base.Dispose method call + CodeMethodInvokeExpression^ methodInvokeExpression = + gcnew CodeMethodInvokeExpression( // Creates a method invoke expression + gcnew CodeBaseReferenceExpression, // targetObjectparameter can be a base class reference + "Dispose",gcnew array{} ); // Method name and method parameter arguments + + // A C# code generator produces the following source code for the preceeding example code: + // base.Dispose(); + // + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp new file mode 100644 index 00000000000..5acadb676c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeBinaryOperatorExpression/CPP/codebinaryoperatorexpressionexample.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeBinaryOperatorExpressionExample + { + public: + CodeBinaryOperatorExpressionExample() + { + + // + // This CodeBinaryOperatorExpression represents the addition of 1 and 2. + + // Right operand. + CodeBinaryOperatorExpression^ addMethod = gcnew CodeBinaryOperatorExpression( gcnew CodePrimitiveExpression( 1 ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 2 ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // (1 + 2) + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp new file mode 100644 index 00000000000..6bcd05541f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeCastExpressionExample/CPP/codecastexpressionexample.cpp @@ -0,0 +1,33 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeCastExpressionExample + { + public: + CodeCastExpressionExample() + { + + // + // This CodeCastExpression casts an Int32 of 1000 to an Int64. + + // targetType parameter indicating the target type of the cast. + // The CodeExpression to cast, here an Int32 value of 1000. + CodeCastExpression^ castExpression = gcnew CodeCastExpression( "System.Int64",gcnew CodePrimitiveExpression( 1000 ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // ((long)(1000)); + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..b1f1d3cb90e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeCatchClauseCollectionExample/CPP/class1.cpp @@ -0,0 +1,78 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +namespace CodeCatchClauseCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeCatchClauseCollection + void CodeCatchClauseCollectionExample() + { + // + // + // Creates an empty CodeCatchClauseCollection. + CodeCatchClauseCollection^ collection = gcnew CodeCatchClauseCollection; + // + + // + // Adds a CodeCatchClause to the collection. + collection->Add( gcnew CodeCatchClause( "e" ) ); + // + + // + // Adds an array of CodeCatchClause objects to the collection. + array^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause}; + collection->AddRange( clauses ); + + // Adds a collection of CodeCatchClause objects to the collection. + CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection; + clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) ); + clausesCollection->Add( gcnew CodeCatchClause( "e" ) ); + collection->AddRange( clausesCollection ); + // + + // + // Tests for the presence of a CodeCatchClause in the + // collection, and retrieves its index if it is found. + CodeCatchClause^ testClause = gcnew CodeCatchClause( "e" ); + int itemIndex = -1; + if ( collection->Contains( testClause ) ) + itemIndex = collection->IndexOf( testClause ); + // + + // + // Copies the contents of the collection beginning at index 0 to the specified CodeCatchClause array. + // 'clauses' is a CodeCatchClause array. + collection->CopyTo( clauses, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeCatchClause at index 0 of the collection. + collection->Insert( 0, gcnew CodeCatchClause( "e" ) ); + // + + // + // Removes the specified CodeCatchClause from the collection. + CodeCatchClause^ clause = gcnew CodeCatchClause( "e" ); + collection->Remove( clause ); + // + + // + // Removes the CodeCatchClause at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp new file mode 100644 index 00000000000..f4f7099d6a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeCommentExample/CPP/codecommentexample.cpp @@ -0,0 +1,37 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeCommentExample + { + public: + CodeCommentExample() + { + + // + // Create a CodeComment with some example comment text. + + // The text of the comment. + // Whether the comment is a comment intended for documentation purposes. + CodeComment^ comment = gcnew CodeComment( "This comment was generated from a System.CodeDom.CodeComment",false ); + + // Create a CodeCommentStatement that contains the comment, in order + // to add the comment to a CodeTypeDeclaration Members collection. + CodeCommentStatement^ commentStatement = gcnew CodeCommentStatement( comment ); + + // A C# code generator produces the following source code for the preceeding example code: + // // This comment was generated from a System.CodeDom.CodeComment + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..c779ba5e491 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeCommentStatementCollectionExample/CPP/class1.cpp @@ -0,0 +1,80 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +namespace CodeCommentStatementCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeCommentStatementCollection + void CodeCommentStatementCollectionExample() + { + + // + // + // Creates an empty CodeCommentStatementCollection. + CodeCommentStatementCollection^ collection = gcnew CodeCommentStatementCollection; + // + + // + // Adds a CodeCommentStatement to the collection. + collection->Add( gcnew CodeCommentStatement( "Test comment" ) ); + // + + // + // Adds an array of CodeCommentStatement objects to the collection. + array^comments = {gcnew CodeCommentStatement( "Test comment" ),gcnew CodeCommentStatement( "Another test comment" )}; + collection->AddRange( comments ); + + // Adds a collection of CodeCommentStatement objects to the collection. + CodeCommentStatementCollection^ commentsCollection = gcnew CodeCommentStatementCollection; + commentsCollection->Add( gcnew CodeCommentStatement( "Test comment" ) ); + commentsCollection->Add( gcnew CodeCommentStatement( "Another test comment" ) ); + collection->AddRange( commentsCollection ); + // + + // + // Tests for the presence of a CodeCommentStatement in the + // collection, and retrieves its index if it is found. + CodeCommentStatement^ testComment = gcnew CodeCommentStatement( "Test comment" ); + int itemIndex = -1; + if ( collection->Contains( testComment ) ) + itemIndex = collection->IndexOf( testComment ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified CodeCommentStatement array. + // 'comments' is a CodeCommentStatement array. + collection->CopyTo( comments, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeCommentStatement at index 0 of the collection. + collection->Insert( 0, gcnew CodeCommentStatement( "Test comment" ) ); + // + + // + // Removes the specified CodeCommentStatement from the collection. + CodeCommentStatement^ comment = gcnew CodeCommentStatement( "Test comment" ); + collection->Remove( comment ); + // + + // + // Removes the CodeCommentStatement at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp new file mode 100644 index 00000000000..9209d6fd754 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeConditionStatementExample/CPP/codeconditionstatementexample.cpp @@ -0,0 +1,40 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeConditionStatementExample + { + public: + CodeConditionStatementExample() + { + + // + // Create a CodeConditionStatement that tests a boolean value named boolean. + array^temp0 = {gcnew CodeCommentStatement( "If condition is true, execute these statements." )}; + array^temp1 = {gcnew CodeCommentStatement( "Else block. If condition is false, execute these statements." )}; + + // The statements to execute if the condition evalues to false. + CodeConditionStatement^ conditionalStatement = gcnew CodeConditionStatement( gcnew CodeVariableReferenceExpression( "boolean" ),temp0,temp1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // if (boolean) + // { + // // If condition is true, execute these statements. + // } + // else { + // // Else block. If condition is false, execute these statements. + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp new file mode 100644 index 00000000000..f222b742baf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeConstructorExample/CPP/codeconstructorexample.cpp @@ -0,0 +1,130 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::Reflection; + +namespace CodeDomSamples +{ + public ref class CodeConstructorExample + { + public: + CodeConstructorExample() + { + + // + // This example declares two types, one of which inherits from another, + // and creates a set of different styles of constructors using CodeConstructor. + // Creates a new CodeCompileUnit to contain the program graph. + CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit; + + // Declares a new namespace object and names it. + CodeNamespace^ Samples = gcnew CodeNamespace( "Samples" ); + + // Adds the namespace object to the compile unit. + CompileUnit->Namespaces->Add( Samples ); + + // Adds a new namespace import for the System namespace. + Samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); + + // Declares a new type and names it. + CodeTypeDeclaration^ BaseType = gcnew CodeTypeDeclaration( "BaseType" ); + + // Adds the new type to the namespace object's type collection. + Samples->Types->Add( BaseType ); + + // Declares a default constructor that takes no arguments. + CodeConstructor^ defaultConstructor = gcnew CodeConstructor; + defaultConstructor->Attributes = MemberAttributes::Public; + + // Adds the constructor to the Members collection of the BaseType. + BaseType->Members->Add( defaultConstructor ); + + // Declares a constructor that takes a string argument. + CodeConstructor^ stringConstructor = gcnew CodeConstructor; + stringConstructor->Attributes = MemberAttributes::Public; + + // Declares a parameter of type string named "TestStringParameter". + stringConstructor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","TestStringParameter" ) ); + + // Adds the constructor to the Members collection of the BaseType. + BaseType->Members->Add( stringConstructor ); + + // Declares a type that derives from BaseType and names it. + CodeTypeDeclaration^ DerivedType = gcnew CodeTypeDeclaration( "DerivedType" ); + + // The DerivedType class inherits from the BaseType class. + DerivedType->BaseTypes->Add( gcnew CodeTypeReference( "BaseType" ) ); + + // Adds the new type to the namespace object's type collection. + Samples->Types->Add( DerivedType ); + + // Declare a constructor that takes a string argument and calls the base class constructor with it. + CodeConstructor^ baseStringConstructor = gcnew CodeConstructor; + baseStringConstructor->Attributes = MemberAttributes::Public; + + // Declares a parameter of type string named "TestStringParameter". + baseStringConstructor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","TestStringParameter" ) ); + + // Calls a base class constructor with the TestStringParameter parameter. + baseStringConstructor->BaseConstructorArgs->Add( gcnew CodeVariableReferenceExpression( "TestStringParameter" ) ); + + // Adds the constructor to the Members collection of the DerivedType. + DerivedType->Members->Add( baseStringConstructor ); + + // Declares a constructor overload that calls another constructor for the type with a predefined argument. + CodeConstructor^ overloadConstructor = gcnew CodeConstructor; + overloadConstructor->Attributes = MemberAttributes::Public; + + // Sets the argument to pass to a base constructor method. + overloadConstructor->ChainedConstructorArgs->Add( gcnew CodePrimitiveExpression( "Test" ) ); + + // Adds the constructor to the Members collection of the DerivedType. + DerivedType->Members->Add( overloadConstructor ); + + // Declares a constructor overload that calls the default constructor for the type. + CodeConstructor^ overloadConstructor2 = gcnew CodeConstructor; + overloadConstructor2->Attributes = MemberAttributes::Public; + overloadConstructor2->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Int32","TestIntParameter" ) ); + + // Sets the argument to pass to a base constructor method. + overloadConstructor2->ChainedConstructorArgs->Add( gcnew CodeSnippetExpression( "" ) ); + + // Adds the constructor to the Members collection of the DerivedType. + DerivedType->Members->Add( overloadConstructor2 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class BaseType { + // + // public BaseType() { + // } + // + // public BaseType(string TestStringParameter) { + // } + // } + // + // public class DerivedType : BaseType { + // + // public DerivedType(string TestStringParameter) : + // base(TestStringParameter) { + // } + // + // public DerivedType() : + // this("Test") { + // } + // + // public DerivedType(int TestIntParameter) : + // this() { + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp new file mode 100644 index 00000000000..7e7167c2f2c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeDelegateInvokeExpressionExample/CPP/codedelegateinvokeexpressionexample.cpp @@ -0,0 +1,98 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeDelegateInvokeExpressionExample + { + public: + CodeDelegateInvokeExpressionExample() + { + + // + // Declares a type to contain the delegate and constructor method. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "DelegateInvokeTest" ); + + // Declares an event that accepts a custom delegate type of "TestDelegate". + CodeMemberEvent^ event1 = gcnew CodeMemberEvent; + event1->Name = "TestEvent"; + event1->Type = gcnew CodeTypeReference( "DelegateInvokeTest.TestDelegate" ); + type1->Members->Add( event1 ); + + // Declares a delegate type called TestDelegate with an EventArgs parameter. + CodeTypeDelegate^ delegate1 = gcnew CodeTypeDelegate( "TestDelegate" ); + delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); + delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); + type1->Members->Add( delegate1 ); + + // Declares a method that matches the "TestDelegate" method signature. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "TestMethod"; + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); + type1->Members->Add( method1 ); + + // Defines a constructor that attaches a TestDelegate delegate pointing to the TestMethod method + // to the TestEvent event. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + constructor1->Statements->Add( gcnew CodeCommentStatement( "Attaches a delegate to the TestEvent event." ) ); + + // Creates and attaches a delegate to the TestEvent. + CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "DelegateInvokeTest.TestDelegate" ),gcnew CodeThisReferenceExpression,"TestMethod" ); + CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 ); + constructor1->Statements->Add( attachStatement1 ); + constructor1->Statements->Add( gcnew CodeCommentStatement( "Invokes the TestEvent event." ) ); + + // Invokes the TestEvent. + array^temp0 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )}; + CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp0 ); + constructor1->Statements->Add( invoke1 ); + type1->Members->Add( constructor1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class DelegateInvokeTest + // { + // + // public DelegateInvokeTest() + // { + // // Attaches a delegate to the TestEvent event. + // this.TestEvent += new DelegateInvokeTest.TestDelegate(this.TestMethod); + // // Invokes the TestEvent event. + // this.TestEvent(this, new System.EventArgs()); + // } + // + // private event DelegateInvokeTest.TestDelegate TestEvent; + // + // private void TestMethod(object sender, System.EventArgs e) + // { + // } + // + // public delegate void TestDelegate(object sender, System.EventArgs e); + // } + // + } + + void DelegateInvokeOnlyType() + { + + // + // Invokes the delegates for an event named TestEvent, passing a local object reference and a new System.EventArgs. + array^temp1 = {gcnew CodeThisReferenceExpression,gcnew CodeObjectCreateExpression( "System.EventArgs", nullptr )}; + CodeDelegateInvokeExpression^ invoke1 = gcnew CodeDelegateInvokeExpression( gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ),temp1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestEvent(this, new System.EventArgs()); + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp new file mode 100644 index 00000000000..2f548be0a78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeDomExample/CPP/source.cpp @@ -0,0 +1,309 @@ +/* +// CodeDOMExample_CPP.cpp : main project file. + +#include "stdafx.h" + +using namespace System; + +int main(array ^args) +{ + Console::WriteLine(L"Hello World"); + return 0; +} +*/ + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Diagnostics; +using namespace System::Drawing; +using namespace System::IO; +using namespace System::Windows::Forms; +using namespace Microsoft::CSharp; +using namespace Microsoft::VisualBasic; +using namespace Microsoft::JScript; +using namespace System::Security::Permissions; + +// This example demonstrates building a Hello World program graph +// using System.CodeDom elements. It calls code generator and +// code compiler methods to build the program using CSharp, VB, or +// JScript. A Windows Forms interface is included. Note: Code +// must be compiled and linked with the Microsoft.JScript assembly. +namespace CodeDOMExample +{ + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + public ref class CodeDomExample + { + public: + // + // Build a Hello World program graph using + // System::CodeDom types. + static CodeCompileUnit^ BuildHelloWorldGraph() + { + // Create a new CodeCompileUnit to contain + // the program graph. + CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; + + // Declare a new namespace called Samples. + CodeNamespace^ samples = gcnew CodeNamespace( "Samples" ); + + // Add the new namespace to the compile unit. + compileUnit->Namespaces->Add( samples ); + + // Add the new namespace import for the System namespace. + samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); + + // Declare a new type called Class1. + CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" ); + + // Add the new type to the namespace's type collection. + samples->Types->Add( class1 ); + + // Declare a new code entry point method. + CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod; + + // Create a type reference for the System::Console class. + CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" ); + + // Build a Console::WriteLine statement. + CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression("Hello World!") ); + + // Add the WriteLine call to the statement collection. + start->Statements->Add( cs1 ); + + // Build another Console::WriteLine statement. + CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine", gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) ); + + // Add the WriteLine call to the statement collection. + start->Statements->Add( cs2 ); + + // Build a call to System::Console::ReadLine. + CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression( csSystemConsoleType, "ReadLine" ); + CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression( csReadLine, gcnew array(0) ); + + // Add the ReadLine statement. + start->Statements->Add( cs3 ); + + // Add the code entry point method to + // the Members collection of the type. + class1->Members->Add( start ); + return compileUnit; + } + // + + // + static void GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit ) + { + // Build the source file name with the appropriate + // language extension. + String^ sourceFile; + if ( provider->FileExtension->StartsWith( "." ) ) + { + sourceFile = String::Concat( "TestGraph", provider->FileExtension ); + } + else + { + sourceFile = String::Concat( "TestGraph.", provider->FileExtension ); + } + + // Create an IndentedTextWriter, constructed with + // a StreamWriter to the source file. + IndentedTextWriter^ tw = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false )," " ); + + // Generate source code using the code generator. + provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions ); + + // Close the output file. + tw->Close(); + } + // + + // + static CompilerResults^ CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile ) + { + // Configure a CompilerParameters that links System.dll + // and produces the specified executable file. + array^referenceAssemblies = {"System.dll"}; + CompilerParameters^ cp = gcnew CompilerParameters( referenceAssemblies,exeFile,false ); + + // Generate an executable rather than a DLL file. + cp->GenerateExecutable = true; + + // Invoke compilation. + CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile ); + + // Return the results of compilation. + return cr; + } + // + }; + + public ref class CodeDomExampleForm: public System::Windows::Forms::Form + { + private: + static System::Windows::Forms::Button^ run_button = gcnew System::Windows::Forms::Button; + static System::Windows::Forms::Button^ compile_button = gcnew System::Windows::Forms::Button; + static System::Windows::Forms::Button^ generate_button = gcnew System::Windows::Forms::Button; + static System::Windows::Forms::TextBox^ textBox1 = gcnew System::Windows::Forms::TextBox; + static System::Windows::Forms::ComboBox^ comboBox1 = gcnew System::Windows::Forms::ComboBox; + static System::Windows::Forms::Label^ label1 = gcnew System::Windows::Forms::Label; + void generate_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CodeDomProvider^ provider = GetCurrentProvider(); + CodeDomExample::GenerateCode( provider, CodeDomExample::BuildHelloWorldGraph() ); + + // Build the source file name with the appropriate + // language extension. + String^ sourceFile; + if ( provider->FileExtension->StartsWith( "." ) ) + { + sourceFile = String::Concat( "TestGraph", provider->FileExtension ); + } + else + { + sourceFile = String::Concat( "TestGraph.", provider->FileExtension ); + } + + + // Read in the generated source file and + // display the source text. + StreamReader^ sr = gcnew StreamReader( sourceFile ); + textBox1->Text = sr->ReadToEnd(); + sr->Close(); + } + + CodeDomProvider^ GetCurrentProvider() + { + CodeDomProvider^ provider; + if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "CSharp" ) == 0 ) + provider = CodeDomProvider::CreateProvider("CSharp"); + else + if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "Visual Basic" ) == 0 ) + provider = CodeDomProvider::CreateProvider("VisualBasic"); + else + if ( String::Compare( dynamic_cast(this->comboBox1->SelectedItem), "JScript" ) == 0 ) + provider = CodeDomProvider::CreateProvider("JScript"); + else + provider = CodeDomProvider::CreateProvider("CSharp"); + + return provider; + } + + void compile_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CodeDomProvider^ provider = GetCurrentProvider(); + + // Build the source file name with the appropriate + // language extension. + String^ sourceFile = String::Concat( "TestGraph.", provider->FileExtension ); + + // Compile the source file into an executable output file. + CompilerResults^ cr = CodeDomExample::CompileCode( provider, sourceFile, "TestGraph.exe" ); + if ( cr->Errors->Count > 0 ) + { + // Display compilation errors. + textBox1->Text = String::Concat( "Errors encountered while building ", sourceFile, " into ", cr->PathToAssembly, ": \r\n\n" ); + System::CodeDom::Compiler::CompilerError^ ce; + for ( int i = 0; i < cr->Errors->Count; i++ ) + { + ce = cr->Errors[i]; + textBox1->AppendText( String::Concat( ce->ToString(), "\r\n" ) ); + + } + run_button->Enabled = false; + } + else + { + textBox1->Text = String::Concat( "Source ", sourceFile, " built into ", cr->PathToAssembly, " with no errors." ); + run_button->Enabled = true; + } + } + + void run_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Process::Start( "TestGraph.exe" ); + } + + public: + CodeDomExampleForm() + { + this->SuspendLayout(); + + // Set properties for label1. + this->label1->Location = System::Drawing::Point( 395, 20 ); + this->label1->Size = System::Drawing::Size( 180, 22 ); + this->label1->Text = "Select a programming language:"; + + // Set properties for comboBox1. + this->comboBox1->Location = System::Drawing::Point( 560, 16 ); + this->comboBox1->Size = System::Drawing::Size( 190, 23 ); + this->comboBox1->Name = "comboBox1"; + array^temp1 = {"CSharp","Visual Basic","JScript"}; + this->comboBox1->Items->AddRange( temp1 ); + this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right | System::Windows::Forms::AnchorStyles::Top); + this->comboBox1->SelectedIndex = 0; + + // Set properties for generate_button. + this->generate_button->Location = System::Drawing::Point( 8, 16 ); + this->generate_button->Name = "generate_button"; + this->generate_button->Size = System::Drawing::Size( 120, 23 ); + this->generate_button->Text = "Generate Code"; + this->generate_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::generate_button_Click ); + + // Set properties for compile_button. + this->compile_button->Location = System::Drawing::Point( 136, 16 ); + this->compile_button->Name = "compile_button"; + this->compile_button->Size = System::Drawing::Size( 120, 23 ); + this->compile_button->Text = "Compile"; + this->compile_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::compile_button_Click ); + + // Set properties for run_button. + this->run_button->Enabled = false; + this->run_button->Location = System::Drawing::Point( 264, 16 ); + this->run_button->Name = "run_button"; + this->run_button->Size = System::Drawing::Size( 120, 23 ); + this->run_button->Text = "Run"; + this->run_button->Click += gcnew System::EventHandler( this, &CodeDomExampleForm::run_button_Click ); + + // Set properties for textBox1. + this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->textBox1->Location = System::Drawing::Point( 8, 48 ); + this->textBox1->Multiline = true; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 744, 280 ); + this->textBox1->Text = ""; + + // Set properties for the CodeDomExampleForm. + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 768, 340 ); + this->MinimumSize = System::Drawing::Size( 750, 340 ); + array^myControl = {this->textBox1,this->run_button,this->compile_button,this->generate_button,this->comboBox1,this->label1}; + this->Controls->AddRange( myControl ); + this->Name = "CodeDomExampleForm"; + this->Text = "CodeDom Hello World Example"; + this->ResumeLayout( false ); + } + + public: + ~CodeDomExampleForm() + { + } + }; + +} + +[STAThread] +int main() +{ + Application::Run( gcnew CodeDOMExample::CodeDomExampleForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp new file mode 100644 index 00000000000..080c30b3d2c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeDomPartialTypeExample/CPP/source.cpp @@ -0,0 +1,439 @@ + +// The following example builds a CodeDom source graph for a simple +// class that represents document properties. The source for the +// graph is generated, saved to a file, compiled into an executable, +// and run. +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::IO; +using namespace System::Diagnostics; + +// +// Build the source graph using System.CodeDom types. +CodeCompileUnit^ DocumentPropertyGraphBase() +{ + // Create a new CodeCompileUnit for the source graph. + CodeCompileUnit^ docPropUnit = gcnew CodeCompileUnit; + + // Declare a new namespace called DocumentSamples. + CodeNamespace^ sampleSpace = gcnew CodeNamespace( "DocumentSamples" ); + + // Add the new namespace to the compile unit. + docPropUnit->Namespaces->Add( sampleSpace ); + + // Add an import statement for the System namespace. + sampleSpace->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); + + // Declare a new class called DocumentProperties. + // + CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties" ); + baseClass->IsPartial = true; + baseClass->IsClass = true; + baseClass->Attributes = MemberAttributes::Public; + baseClass->BaseTypes->Add( gcnew CodeTypeReference( System::Object::typeid ) ); + + // Add the DocumentProperties class to the namespace. + sampleSpace->Types->Add( baseClass ); + // + + // ------Build the DocumentProperty.Main method------ + // Declare the Main method of the class. + CodeEntryPointMethod^ mainMethod = gcnew CodeEntryPointMethod; + mainMethod->Comments->Add( gcnew CodeCommentStatement( " Perform a simple test of the class methods." ) ); + + // Add the code entry point method to the Members + // collection of the type. + baseClass->Members->Add( mainMethod ); + mainMethod->Statements->Add( gcnew CodeCommentStatement( "Initialize a class instance and display it." ) ); + + // + // Initialize a local DocumentProperty instance, named myDoc. + // Use the DocumentProperty constructor to set the author, + // title, and date. Set the publish date to DateTime.Now. + CodePrimitiveExpression^ docTitlePrimitive = gcnew CodePrimitiveExpression( "Cubicle Survival Strategies" ); + CodePrimitiveExpression^ docAuthorPrimitive = gcnew CodePrimitiveExpression( "John Smith" ); + + // Store the value of DateTime.Now in a local variable, to re-use + // the same value later. + CodeTypeReferenceExpression^ docDateClass = gcnew CodeTypeReferenceExpression( "DateTime" ); + CodePropertyReferenceExpression^ docDateNow = gcnew CodePropertyReferenceExpression( docDateClass,"Now" ); + CodeVariableDeclarationStatement^ publishNow = gcnew CodeVariableDeclarationStatement( DateTime::typeid,"publishNow",docDateNow ); + mainMethod->Statements->Add( publishNow ); + CodeVariableReferenceExpression^ publishNowRef = gcnew CodeVariableReferenceExpression( "publishNow" ); + array^ctorParams = {docTitlePrimitive,docAuthorPrimitive,publishNowRef}; + CodeObjectCreateExpression^ initDocConstruct = gcnew CodeObjectCreateExpression( "DocumentProperties",ctorParams ); + CodeVariableDeclarationStatement^ myDocDeclare = gcnew CodeVariableDeclarationStatement( "DocumentProperties","myDoc",initDocConstruct ); + mainMethod->Statements->Add( myDocDeclare ); + // + + // Create a variable reference for the myDoc instance. + CodeVariableReferenceExpression^ myDocInstance = gcnew CodeVariableReferenceExpression( "myDoc" ); + + // Create a type reference for the System.Console class. + CodeTypeReferenceExpression^ csSystemConsoleType = gcnew CodeTypeReferenceExpression( "System.Console" ); + + // Build Console.WriteLine statement. + CodeMethodInvokeExpression^ consoleWriteLine0 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "** Document properties test **" ) ); + + // Add the WriteLine call to the statement collection. + mainMethod->Statements->Add( consoleWriteLine0 ); + + // Build Console.WriteLine("First document:"). + CodeMethodInvokeExpression^ consoleWriteLine1 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "First document:" ) ); + + // Add the WriteLine call to the statement collection. + mainMethod->Statements->Add( consoleWriteLine1 ); + + // Add a statement to display the myDoc instance properties. + CodeMethodInvokeExpression^ myDocToString = gcnew CodeMethodInvokeExpression( myDocInstance,"ToString" ); + CodeMethodInvokeExpression^ consoleWriteLine2 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",myDocToString ); + mainMethod->Statements->Add( consoleWriteLine2 ); + + // Add a statement to display the myDoc instance hashcode property. + CodeMethodInvokeExpression^ myDocHashCode = gcnew CodeMethodInvokeExpression( myDocInstance,"GetHashCode" ); + array^writeHashCodeParams = {gcnew CodePrimitiveExpression( " Hash code: {0}" ),myDocHashCode}; + CodeMethodInvokeExpression^ consoleWriteLine3 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",writeHashCodeParams ); + mainMethod->Statements->Add( consoleWriteLine3 ); + + // Add statements to create another instance. + mainMethod->Statements->Add( gcnew CodeCommentStatement( "Create another instance." ) ); + CodeVariableDeclarationStatement^ myNewDocDeclare = gcnew CodeVariableDeclarationStatement( "DocumentProperties","myNewDoc",initDocConstruct ); + mainMethod->Statements->Add( myNewDocDeclare ); + + // Create a variable reference for the myNewDoc instance. + CodeVariableReferenceExpression^ myNewDocInstance = gcnew CodeVariableReferenceExpression( "myNewDoc" ); + + // Build Console.WriteLine("Second document:"). + CodeMethodInvokeExpression^ consoleWriteLine5 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Second document:" ) ); + + // Add the WriteLine call to the statement collection. + mainMethod->Statements->Add( consoleWriteLine5 ); + + // Add a statement to display the myNewDoc instance properties. + CodeMethodInvokeExpression^ myNewDocToString = gcnew CodeMethodInvokeExpression( myNewDocInstance,"ToString" ); + CodeMethodInvokeExpression^ consoleWriteLine6 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",myNewDocToString ); + mainMethod->Statements->Add( consoleWriteLine6 ); + + // Add a statement to display the myNewDoc instance hashcode property. + CodeMethodInvokeExpression^ myNewDocHashCode = gcnew CodeMethodInvokeExpression( myNewDocInstance,"GetHashCode" ); + array^writeNewHashCodeParams = {gcnew CodePrimitiveExpression( " Hash code: {0}" ),myNewDocHashCode}; + CodeMethodInvokeExpression^ consoleWriteLine7 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",writeNewHashCodeParams ); + mainMethod->Statements->Add( consoleWriteLine7 ); + + // + // Build a compound statement to compare the two instances. + mainMethod->Statements->Add( gcnew CodeCommentStatement( "Compare the two instances." ) ); + CodeMethodInvokeExpression^ myDocEquals = gcnew CodeMethodInvokeExpression( myDocInstance,"Equals",myNewDocInstance ); + CodePrimitiveExpression^ equalLine = gcnew CodePrimitiveExpression( "Second document is equal to the first." ); + CodePrimitiveExpression^ notEqualLine = gcnew CodePrimitiveExpression( "Second document is not equal to the first." ); + CodeMethodInvokeExpression^ equalWriteLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",equalLine ); + CodeMethodInvokeExpression^ notEqualWriteLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",notEqualLine ); + array^equalStatements = {gcnew CodeExpressionStatement( equalWriteLine )}; + array^notEqualStatements = {gcnew CodeExpressionStatement( notEqualWriteLine )}; + CodeConditionStatement^ docCompare = gcnew CodeConditionStatement( myDocEquals,equalStatements,notEqualStatements ); + mainMethod->Statements->Add( docCompare ); + // + + // + // Add a statement to change the myDoc.Author property: + mainMethod->Statements->Add( gcnew CodeCommentStatement( "Change the author of the original instance." ) ); + CodePropertyReferenceExpression^ myDocAuthor = gcnew CodePropertyReferenceExpression( myDocInstance,"Author" ); + CodePrimitiveExpression^ newDocAuthor = gcnew CodePrimitiveExpression( "Jane Doe" ); + CodeAssignStatement^ myDocAuthorAssign = gcnew CodeAssignStatement( myDocAuthor,newDocAuthor ); + mainMethod->Statements->Add( myDocAuthorAssign ); + // + + // Add a statement to display the modified instance. + CodeMethodInvokeExpression^ consoleWriteLine8 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Modified original document:" ) ); + mainMethod->Statements->Add( consoleWriteLine8 ); + + // Reuse the myDoc.ToString statement built earlier. + mainMethod->Statements->Add( consoleWriteLine2 ); + + // Reuse the comparison block built earlier. + mainMethod->Statements->Add( gcnew CodeCommentStatement( "Compare the two instances again." ) ); + mainMethod->Statements->Add( docCompare ); + + // Add a statement to prompt the user to hit a key. + + // Build another call to System.WriteLine. + // Add string parameter to the WriteLine method. + CodeMethodInvokeExpression^ consoleWriteLine9 = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"WriteLine",gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) ); + mainMethod->Statements->Add( consoleWriteLine9 ); + + // Build a call to System.ReadLine. + CodeMethodInvokeExpression^ consoleReadLine = gcnew CodeMethodInvokeExpression( csSystemConsoleType,"ReadLine" ); + mainMethod->Statements->Add( consoleReadLine ); + + // Define a few common expressions for the class methods. + CodePropertyReferenceExpression^ thisTitle = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ); + CodePropertyReferenceExpression^ thisAuthor = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ); + CodePropertyReferenceExpression^ thisDate = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ); + CodeTypeReferenceExpression^ stringType = gcnew CodeTypeReferenceExpression( String::typeid ); + CodePrimitiveExpression^ trueConst = gcnew CodePrimitiveExpression( true ); + CodePrimitiveExpression^ falseConst = gcnew CodePrimitiveExpression( false ); + + // ------Build the DocumentProperty.Equals method------ + CodeMemberMethod^ baseEquals = gcnew CodeMemberMethod; + baseEquals->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override | MemberAttributes::Overloaded); + baseEquals->ReturnType = gcnew CodeTypeReference( bool::typeid ); + baseEquals->Name = "Equals"; + baseEquals->Parameters->Add( gcnew CodeParameterDeclarationExpression( Object::typeid,"obj" ) ); + baseEquals->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.Equals method." ) ); + CodeVariableReferenceExpression^ objVar = gcnew CodeVariableReferenceExpression( "obj" ); + CodeCastExpression^ objCast = gcnew CodeCastExpression( "DocumentProperties",objVar ); + CodePropertyReferenceExpression^ objTitle = gcnew CodePropertyReferenceExpression( objCast,"Title" ); + CodePropertyReferenceExpression^ objAuthor = gcnew CodePropertyReferenceExpression( objCast,"Author" ); + CodePropertyReferenceExpression^ objDate = gcnew CodePropertyReferenceExpression( objCast,"PublishDate" ); + CodeMethodInvokeExpression^ objTitleEquals = gcnew CodeMethodInvokeExpression( objTitle,"Equals",thisTitle ); + CodeMethodInvokeExpression^ objAuthorEquals = gcnew CodeMethodInvokeExpression( objAuthor,"Equals",thisAuthor ); + CodeMethodInvokeExpression^ objDateEquals = gcnew CodeMethodInvokeExpression( objDate,"Equals",thisDate ); + CodeBinaryOperatorExpression^ andEquals1 = gcnew CodeBinaryOperatorExpression( objTitleEquals,CodeBinaryOperatorType::BooleanAnd,objAuthorEquals ); + CodeBinaryOperatorExpression^ andEquals2 = gcnew CodeBinaryOperatorExpression( andEquals1,CodeBinaryOperatorType::BooleanAnd,objDateEquals ); + array^returnTrueStatements = {gcnew CodeMethodReturnStatement( trueConst )}; + array^returnFalseStatements = {gcnew CodeMethodReturnStatement( falseConst )}; + CodeConditionStatement^ objEquals = gcnew CodeConditionStatement( andEquals2,returnTrueStatements,returnFalseStatements ); + baseEquals->Statements->Add( objEquals ); + baseClass->Members->Add( baseEquals ); + + // ------Build the DocumentProperty.GetHashCode method------ + CodeMemberMethod^ baseHash = gcnew CodeMemberMethod; + baseHash->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override); + baseHash->ReturnType = gcnew CodeTypeReference( int::typeid ); + baseHash->Name = "GetHashCode"; + baseHash->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.GetHashCode method." ) ); + CodeMethodInvokeExpression^ hashTitle = gcnew CodeMethodInvokeExpression( thisTitle,"GetHashCode" ); + CodeMethodInvokeExpression^ hashAuthor = gcnew CodeMethodInvokeExpression( thisAuthor,"GetHashCode" ); + CodeMethodInvokeExpression^ hashDate = gcnew CodeMethodInvokeExpression( thisDate,"GetHashCode" ); + CodeBinaryOperatorExpression^ orHash1 = gcnew CodeBinaryOperatorExpression( hashTitle,CodeBinaryOperatorType::BitwiseOr,hashAuthor ); + CodeBinaryOperatorExpression^ andHash = gcnew CodeBinaryOperatorExpression( orHash1,CodeBinaryOperatorType::BitwiseAnd,hashDate ); + baseHash->Statements->Add( gcnew CodeMethodReturnStatement( andHash ) ); + baseClass->Members->Add( baseHash ); + + // ------Build the DocumentProperty.ToString method------ + CodeMemberMethod^ docToString = gcnew CodeMemberMethod; + docToString->Attributes = static_cast(MemberAttributes::Public | MemberAttributes::Override); + docToString->ReturnType = gcnew CodeTypeReference( String::typeid ); + docToString->Name = "ToString"; + docToString->Statements->Add( gcnew CodeCommentStatement( "Override System.Object.ToString method." ) ); + CodeMethodInvokeExpression^ baseToString = gcnew CodeMethodInvokeExpression( gcnew CodeBaseReferenceExpression,"ToString" ); + CodePrimitiveExpression^ formatString = gcnew CodePrimitiveExpression( "{0} ({1} by {2}, {3})" ); + array^formatParams = {formatString,baseToString,thisTitle,thisAuthor,thisDate}; + CodeMethodInvokeExpression^ stringFormat = gcnew CodeMethodInvokeExpression( stringType,"Format",formatParams ); + docToString->Statements->Add( gcnew CodeMethodReturnStatement( stringFormat ) ); + baseClass->Members->Add( docToString ); + return docPropUnit; +} +// + +void DocumentPropertyGraphExpand( interior_ptr docPropUnit ) +{ + // Expand on the DocumentProperties class, + // adding the constructor and property implementation. + // + CodeTypeDeclaration^ baseClass = gcnew CodeTypeDeclaration( "DocumentProperties" ); + baseClass->IsPartial = true; + baseClass->IsClass = true; + baseClass->Attributes = MemberAttributes::Public; + + // Extend the DocumentProperties class in the unit namespace. + ( *docPropUnit)->Namespaces[ 0 ]->Types->Add( baseClass ); + // + + // ------Declare the internal class fields------ + baseClass->Members->Add( gcnew CodeMemberField( "String","docTitle" ) ); + baseClass->Members->Add( gcnew CodeMemberField( "String","docAuthor" ) ); + baseClass->Members->Add( gcnew CodeMemberField( "DateTime","docDate" ) ); + + // ------Build the DocumentProperty constructor------ + CodeConstructor^ docPropCtor = gcnew CodeConstructor; + docPropCtor->Attributes = MemberAttributes::Public; + docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","title" ) ); + docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "String","author" ) ); + docPropCtor->Parameters->Add( gcnew CodeParameterDeclarationExpression( "DateTime","publishDate" ) ); + CodeFieldReferenceExpression^ myTitle = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ); + CodeVariableReferenceExpression^ inTitle = gcnew CodeVariableReferenceExpression( "title" ); + CodeAssignStatement^ myDocTitleAssign = gcnew CodeAssignStatement( myTitle,inTitle ); + docPropCtor->Statements->Add( myDocTitleAssign ); + CodeFieldReferenceExpression^ myAuthor = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ); + CodeVariableReferenceExpression^ inAuthor = gcnew CodeVariableReferenceExpression( "author" ); + CodeAssignStatement^ myDocAuthorAssign = gcnew CodeAssignStatement( myAuthor,inAuthor ); + docPropCtor->Statements->Add( myDocAuthorAssign ); + CodeFieldReferenceExpression^ myDate = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ); + CodeVariableReferenceExpression^ inDate = gcnew CodeVariableReferenceExpression( "publishDate" ); + CodeAssignStatement^ myDocDateAssign = gcnew CodeAssignStatement( myDate,inDate ); + docPropCtor->Statements->Add( myDocDateAssign ); + baseClass->Members->Add( docPropCtor ); + + // ------Build the DocumentProperty properties------ + CodeMemberProperty^ docTitleProp = gcnew CodeMemberProperty; + docTitleProp->HasGet = true; + docTitleProp->HasSet = true; + docTitleProp->Name = "Title"; + docTitleProp->Type = gcnew CodeTypeReference( "String" ); + docTitleProp->Attributes = MemberAttributes::Public; + docTitleProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ) ) ); + docTitleProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docTitle" ),gcnew CodePropertySetValueReferenceExpression ) ); + baseClass->Members->Add( docTitleProp ); + CodeMemberProperty^ docAuthorProp = gcnew CodeMemberProperty; + docAuthorProp->HasGet = true; + docAuthorProp->HasSet = true; + docAuthorProp->Name = "Author"; + docAuthorProp->Type = gcnew CodeTypeReference( "String" ); + docAuthorProp->Attributes = MemberAttributes::Public; + docAuthorProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ) ) ); + docAuthorProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docAuthor" ),gcnew CodePropertySetValueReferenceExpression ) ); + baseClass->Members->Add( docAuthorProp ); + CodeMemberProperty^ docDateProp = gcnew CodeMemberProperty; + docDateProp->HasGet = true; + docDateProp->HasSet = true; + docDateProp->Name = "PublishDate"; + docDateProp->Type = gcnew CodeTypeReference( "DateTime" ); + docDateProp->Attributes = MemberAttributes::Public; + docDateProp->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ) ) ); + docDateProp->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"docDate" ),gcnew CodePropertySetValueReferenceExpression ) ); + baseClass->Members->Add( docDateProp ); +} + +String^ GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileUnit ) +{ + // Build the source file name with the language + // extension (vb, cs, js). + String^ sourceFile = ""; + + // Write the source out in the selected language if + // the code generator supports partial type declarations. + if ( provider->Supports( GeneratorSupport::PartialTypes ) ) + { + if ( provider->FileExtension[ 0 ] == '.' ) + { + sourceFile = String::Format( "DocProp{0}", provider->FileExtension ); + } + else + { + sourceFile = String::Format( "DocProp.{0}", provider->FileExtension ); + } + + // Create a TextWriter to a StreamWriter to an output file. + IndentedTextWriter^ outWriter = gcnew IndentedTextWriter( gcnew StreamWriter( sourceFile,false )," " ); + + // Generate source code using the code generator. + provider->GenerateCodeFromCompileUnit( compileUnit, outWriter, nullptr ); + + // Close the output file. + outWriter->Close(); + } + + return sourceFile; +} + +// +bool CompileCode( CodeDomProvider^ provider, String^ sourceFile, String^ exeFile ) +{ + CompilerParameters^ cp = gcnew CompilerParameters; + + // Generate an executable instead of + // a class library. + cp->GenerateExecutable = true; + + // Set the assembly file name to generate. + cp->OutputAssembly = exeFile; + + // Save the assembly as a physical file. + cp->GenerateInMemory = false; + + // Generate debug information. + cp->IncludeDebugInformation = true; + + // Add an assembly reference. + cp->ReferencedAssemblies->Add( "System.dll" ); + + // Set the warning level at which + // the compiler should abort compilation + // if a warning of this level occurs. + cp->WarningLevel = 3; + + // Set whether to treat all warnings as errors. + cp->TreatWarningsAsErrors = false; + if ( provider->Supports( GeneratorSupport::EntryPointMethod ) ) + { + // Specify the class that contains + // the main method of the executable. + cp->MainClass = "DocumentSamples.DocumentProperties"; + } + + // Invoke compilation. + CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile ); + if ( cr->Errors->Count > 0 ) + { + // Display compilation errors. + Console::WriteLine( "Errors building {0} into {1}", sourceFile, cr->PathToAssembly ); + IEnumerator^ myEnum = cr->Errors->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + CompilerError^ ce = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", ce ); + Console::WriteLine(); + } + } + else + { + Console::WriteLine( "Source {0} built into {1} successfully.", sourceFile, cr->PathToAssembly ); + } + + // Return the results of compilation. + if ( cr->Errors->Count > 0 ) + { + return false; + } + else + { + return true; + } +} +// + +[STAThread] +int main() +{ + CodeDomProvider^ provider = nullptr; + String^ exeName = "DocProp.exe"; + Console::WriteLine( "Enter the source language for DocumentProperties class (cs, vb, etc):" ); + String^ inputLang = Console::ReadLine(); + Console::WriteLine(); + if ( CodeDomProvider::IsDefinedLanguage( inputLang ) ) + { + provider = CodeDomProvider::CreateProvider( inputLang ); + } + + if ( provider == nullptr ) + { + Console::WriteLine( "There is no CodeDomProvider for the input language." ); + } + else + { + CodeCompileUnit^ docPropertyUnit = DocumentPropertyGraphBase(); + DocumentPropertyGraphExpand( &docPropertyUnit ); + String^ sourceFile = GenerateCode( provider, docPropertyUnit ); + if ( !String::IsNullOrEmpty( sourceFile ) ) + { + Console::WriteLine( "Document property class code generated." ); + if ( CompileCode( provider, sourceFile, exeName ) ) + { + Console::WriteLine( "Starting DocProp executable." ); + Process::Start( exeName ); + } + } + else + { + Console::WriteLine( "Could not generate source file." ); + Console::WriteLine( "Target language code generator might not support partial type declarations." ); + } + } +} + diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp new file mode 100644 index 00000000000..1cc24bf7789 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeDomSampleBatch/CPP/class1.cpp @@ -0,0 +1,100 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSampleBatch +{ + public ref class Class1 + { + public: + Class1(){} + + static CodeCompileUnit^ CreateCompileUnit() + { + CodeCompileUnit^ cu = gcnew CodeCompileUnit; + + // + // Creates a code expression for a CodeExpressionStatement to contain. + array^ temp = {gcnew CodePrimitiveExpression( "Example string" )}; + CodeExpression^ invokeExpression = gcnew CodeMethodInvokeExpression( + gcnew CodeTypeReferenceExpression( "Console" ),"Write",temp ); + + // Creates a statement using a code expression. + CodeExpressionStatement^ expressionStatement; + expressionStatement = gcnew CodeExpressionStatement( invokeExpression ); + + // A C++ code generator produces the following source code for the preceeding example code: + + // Console::Write( "Example string" ); + // + + // + // Creates a CodeLinePragma that references line 100 of the file "example.cs". + CodeLinePragma^ pragma = gcnew CodeLinePragma( "example.cs",100 ); + // + + // + // Creates a CodeSnippetExpression that represents a literal string that + // can be used as an expression in a CodeDOM graph. + CodeSnippetExpression^ literalExpression = + gcnew CodeSnippetExpression( "Literal expression" ); + // + + // + // Creates a statement using a literal string. + CodeSnippetStatement^ literalStatement = + gcnew CodeSnippetStatement( "Console.Write(\"Test literal statement output\")" ); + // + + // + // Creates a type member using a literal string. + CodeSnippetTypeMember^ literalMember = + gcnew CodeSnippetTypeMember( "public static void TestMethod() {}" ); + // + return cu; + } + + static CodeCompileUnit^ CreateSnippetCompileUnit() + { + // + // Creates a compile unit using a literal sring; + String^ literalCode; + literalCode = "using System; namespace TestLiteralCode " + + "{ public class TestClass { public TestClass() {} } }"; + CodeSnippetCompileUnit^ csu = gcnew CodeSnippetCompileUnit( literalCode ); + // + return csu; + } + + // CodeNamespaceImportCollection + void CodeNamespaceImportCollectionExample() + { + // + // + // Creates an empty CodeNamespaceImportCollection. + CodeNamespaceImportCollection^ collection = + gcnew CodeNamespaceImportCollection; + // + + // + // Adds a CodeNamespaceImport to the collection. + collection->Add( gcnew CodeNamespaceImport( "System" ) ); + // + + // + // Adds an array of CodeNamespaceImport objects to the collection. + array^ Imports = { + gcnew CodeNamespaceImport( "System" ), + gcnew CodeNamespaceImport( "System.Drawing" )}; + collection->AddRange( Imports ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp new file mode 100644 index 00000000000..6d0058c9957 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeDom_CompilerInfo/CPP/source.cpp @@ -0,0 +1,327 @@ + + +// System.CodeDom.Compiler.CompilerInfo +// +// Requires .NET Framework version 2.0 or higher. +// +// The following example displays compiler configuration settings. +// Command-line arguments are used to specify a compiler language, +// file extension, or provider type. For the given input, the +// example determines the corresponding code compiler settings. +// +// +// Command-line argument examples: +// +// - Displays Visual Basic, C#, and JScript compiler settings. +// Language CSharp +// - Displays the compiler settings for C#. +// All +// - Displays settings for all configured compilers. +// Config Pascal +// - Displays settings for configured Pascal language provider, +// if one exists. +// Extension .vb +// - Displays settings for the compiler associated with the .vb +// file extension. +#using +#using + +using namespace System; +using namespace System::Globalization; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace Microsoft::CSharp; +using namespace Microsoft::VisualBasic; +using namespace System::Configuration; +using namespace System::Security::Permissions; + +namespace CodeDomCompilerInfoSample +{ + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + public ref class CompilerInfoSample + { + public: + static void Main( array^args ) + { + String^ queryCommand = ""; + String^ queryArg = ""; + int iNumArguments = args->Length; + + // Get input command-line arguments. + if ( iNumArguments > 0 ) + { + queryCommand = args[ 0 ]->ToUpper( CultureInfo::InvariantCulture ); + if ( iNumArguments > 1 ) + queryArg = args[ 1 ]; + } + + // Determine which method to call. + Console::WriteLine(); + if ( queryCommand->Equals( "LANGUAGE" ) ) + DisplayCompilerInfoForLanguage( queryArg ); // Display compiler information for input language. + else if ( queryCommand->Equals( "EXTENSION" ) ) + DisplayCompilerInfoUsingExtension( queryArg ); // Display compiler information for input file extension. + else if ( queryCommand->Equals( "CONFIG" ) ) + DisplayCompilerInfoForConfigLanguage( queryArg ); // Display settings for the configured language provider. + else if ( queryCommand->Equals( "ALL" ) ) + DisplayAllCompilerInfo(); // Display compiler information for all configured language providers. + else + { + // There was no command-line argument, or the + // command-line argument was not recognized. + // Display the C#, Visual Basic and JScript + // compiler information. + DisplayCSharpCompilerInfo(); + DisplayVBCompilerInfo(); + DisplayJScriptCompilerInfo(); + } + } + + + private: + static void DisplayCSharpCompilerInfo() + { + // + // Get the provider for Microsoft.CSharp +// CodeDomProvider^ provider = CodeDomProvider.CreateProvider("CSharp"); + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + if ( provider ) + { + // Display the C# language provider information. + Console::WriteLine( "CSharp provider is {0}", provider->ToString() ); + Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() ); + Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); + } + + // + Console::WriteLine(); + } + + static void DisplayVBCompilerInfo() + { + // + // Get the provider for Microsoft.VisualBasic +// CodeDomProvider^ provider = CodeDomProvider.CreateProvider("VisualBasic"); + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("VisualBasic"); + if ( provider ) // Display the Visual Basic language provider information. + { + Console::WriteLine( "Visual Basic provider is {0}", provider->ToString() ); + Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() ); + Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); + } + + // + Console::WriteLine(); + } + + static void DisplayJScriptCompilerInfo() + { + // + // Get the provider for JScript. + CodeDomProvider^ provider; + try + { +// provider = CodeDomProvider.CreateProvider("JScript"); + provider = CodeDomProvider::CreateProvider("JScript"); + if ( provider ) + { + // Display the JScript language provider information. + Console::WriteLine( "JScript language provider is {0}", provider->ToString() ); + Console::WriteLine( " Provider hash code: {0}", provider->GetHashCode().ToString() ); + Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); + Console::WriteLine(); + } + } + catch ( ConfigurationException^ e ) + { + // The JScript language provider was not found. + Console::WriteLine( "There is no configured JScript language provider." ); + } + + // + } + + static void DisplayCompilerInfoUsingExtension( String^ fileExtension ) + { + // + if ( !fileExtension->StartsWith( "." ) ) + fileExtension = String::Concat( ".", fileExtension ); + + // Get the language associated with the file extension. + CodeDomProvider^ provider = nullptr; + if ( CodeDomProvider::IsDefinedExtension( fileExtension ) ) + { + String^ language = CodeDomProvider::GetLanguageFromExtension( fileExtension ); + if ( language ) + Console::WriteLine( "The language \"{0}\" is associated with file extension \"{1}\"\n", + language, fileExtension ); + + // Check for a corresponding language provider. + if ( language && CodeDomProvider::IsDefinedLanguage( language ) ) + { + provider = CodeDomProvider::CreateProvider( language ); + if ( provider ) + { + // Display information about this language provider. + Console::WriteLine( "Language provider: {0}\n", provider->ToString() ); + + // Get the compiler settings for this language. + CompilerInfo^ langCompilerInfo = CodeDomProvider::GetCompilerInfo( language ); + if ( langCompilerInfo ) + { + CompilerParameters^ langCompilerConfig = langCompilerInfo->CreateDefaultCompilerParameters(); + if ( langCompilerConfig ) + { + Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); + Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); + } + } + } + } + } + + if ( provider == nullptr ) // Tell the user that the language provider was not found. + Console::WriteLine( "There is no language provider associated with input file extension \"{0}\".", fileExtension ); + + // + } + + static void DisplayCompilerInfoForLanguage( String^ language ) + { + // + CodeDomProvider^ provider = nullptr; + + // Check for a provider corresponding to the input language. + if ( CodeDomProvider::IsDefinedLanguage( language ) ) + { + provider = CodeDomProvider::CreateProvider( language ); + if ( provider ) + { + // Display information about this language provider. + Console::WriteLine( "Language provider: {0}", provider->ToString() ); + Console::WriteLine(); + Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); + Console::WriteLine(); + + // Get the compiler settings for this language. + CompilerInfo^ langCompilerInfo = CodeDomProvider::GetCompilerInfo( language ); + if ( langCompilerInfo ) + { + CompilerParameters^ langCompilerConfig = langCompilerInfo->CreateDefaultCompilerParameters(); + if ( langCompilerConfig ) + { + Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); + Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); + } + } + } + } + + if ( provider == nullptr ) // Tell the user that the language provider was not found. + Console::WriteLine( "There is no provider configured for input language \"{0}\".", language ); + + // + } + + static void DisplayCompilerInfoForConfigLanguage( String^ configLanguage ) + { + // + CodeDomProvider^ provider = nullptr; + CompilerInfo^ info = CodeDomProvider::GetCompilerInfo( configLanguage ); + + // Check whether there is a provider configured for this language. + if ( info->IsCodeDomProviderTypeValid ) + { + // Get a provider instance using the configured type information. + provider = dynamic_cast(Activator::CreateInstance( info->CodeDomProviderType )); + if ( provider ) + { + // Display information about this language provider. + Console::WriteLine( "Language provider: {0}", provider->ToString() ); + Console::WriteLine(); + Console::WriteLine( " Default file extension: {0}", provider->FileExtension ); + Console::WriteLine(); + + // Get the compiler settings for this language. + CompilerParameters^ langCompilerConfig = info->CreateDefaultCompilerParameters(); + if ( langCompilerConfig ) + { + Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); + Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); + } + } + } + + if ( provider == nullptr ) // Tell the user that the language provider was not found. + Console::WriteLine( "There is no provider configured for input language \"{0}\".", configLanguage ); + + // + } + + static void DisplayAllCompilerInfo() + { + // + array^allCompilerInfo = CodeDomProvider::GetAllCompilerInfo(); + for ( int i = 0; i < allCompilerInfo->Length; i++ ) + { + String^ defaultLanguage; + String^ defaultExtension; + CompilerInfo^ info = allCompilerInfo[ i ]; + CodeDomProvider^ provider = nullptr; + if ( info ) + provider = info->CreateProvider(); + + if ( provider ) + { + // Display information about this configured provider. + Console::WriteLine( "Language provider: {0}", provider->ToString() ); + Console::WriteLine(); + Console::WriteLine( " Supported file extension(s):" ); + array^extensions = info->GetExtensions(); + for ( int i = 0; i < extensions->Length; i++ ) + Console::WriteLine( " {0}", extensions[ i ] ); + + defaultExtension = provider->FileExtension; + if ( !defaultExtension->StartsWith( "." ) ) + defaultExtension = String::Concat( ".", defaultExtension ); + + Console::WriteLine( " Default file extension: {0}\n", defaultExtension ); + Console::WriteLine( " Supported language(s):" ); + array^languages = info->GetLanguages(); + for ( int i = 0; i < languages->Length; i++ ) + Console::WriteLine( " {0}", languages[ i ] ); + + defaultLanguage = CodeDomProvider::GetLanguageFromExtension( defaultExtension ); + Console::WriteLine( " Default language: {0}", defaultLanguage ); + Console::WriteLine(); + + // Get the compiler settings for this provider. + CompilerParameters^ langCompilerConfig = info->CreateDefaultCompilerParameters(); + if ( langCompilerConfig ) + { + Console::WriteLine( " Compiler options: {0}", langCompilerConfig->CompilerOptions ); + Console::WriteLine( " Compiler warning level: {0}", langCompilerConfig->WarningLevel.ToString() ); + } + } + + } + // + } + + }; + +} + + +// The main entry point for the application. + +[STAThread] +int main( int argc, char *argv[] ) +{ + CodeDomCompilerInfoSample::CompilerInfoSample::Main( Environment::GetCommandLineArgs() ); + Console::WriteLine("\n\nPress ENTER to return"); + Console::ReadLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp new file mode 100644 index 00000000000..98d30708b47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeEntryPointMethod/CPP/codeentrypointmethodexample.cpp @@ -0,0 +1,59 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeEntryPointMethodExample + { + public: + + // + // Builds a Hello World Program Graph using System.CodeDom objects + static CodeCompileUnit^ BuildHelloWorldGraph() + { + + // Create a new CodeCompileUnit to contain the program graph + CodeCompileUnit^ CompileUnit = gcnew CodeCompileUnit; + + // Declare a new namespace object and name it + CodeNamespace^ Samples = gcnew CodeNamespace( "Samples" ); + + // Add the namespace object to the compile unit + CompileUnit->Namespaces->Add( Samples ); + + // Add a new namespace import for the System namespace + Samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); + + // Declare a new type object and name it + CodeTypeDeclaration^ Class1 = gcnew CodeTypeDeclaration( "Class1" ); + + // Add the new type to the namespace object's type collection + Samples->Types->Add( Class1 ); + + // Declare a new code entry point method + CodeEntryPointMethod^ Start = gcnew CodeEntryPointMethod; + + // Create a new method invoke expression + array^temp = {gcnew CodePrimitiveExpression( "Hello World!" )}; + CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp ); + + // Add the new method code statement + Start->Statements->Add( gcnew CodeExpressionStatement( cs1 ) ); + + // Add the code entry point method to the type's members collection + Class1->Members->Add( Start ); + return CompileUnit; + + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..8a1f531f50a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeExpressionCollectionExample/CPP/class1.cpp @@ -0,0 +1,77 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeExpressionCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeExpressionCollection + void CodeExpressionCollectionExample() + { + // + // + // Creates an empty CodeExpressionCollection. + CodeExpressionCollection^ collection = gcnew CodeExpressionCollection; + // + + // + // Adds a CodeExpression to the collection. + collection->Add( gcnew CodePrimitiveExpression( true ) ); + // + + // + // Adds an array of CodeExpression objects to the collection. + array^expressions = {gcnew CodePrimitiveExpression( true ),gcnew CodePrimitiveExpression( true )}; + collection->AddRange( expressions ); + + // Adds a collection of CodeExpression objects to the collection. + CodeExpressionCollection^ expressionsCollection = gcnew CodeExpressionCollection; + expressionsCollection->Add( gcnew CodePrimitiveExpression( true ) ); + expressionsCollection->Add( gcnew CodePrimitiveExpression( true ) ); + collection->AddRange( expressionsCollection ); + // + + // + // Tests for the presence of a CodeExpression in the + // collection, and retrieves its index if it is found. + CodeExpression^ testComment = gcnew CodePrimitiveExpression( true ); + int itemIndex = -1; + if ( collection->Contains( testComment ) ) + itemIndex = collection->IndexOf( testComment ); + // + + // + // Copies the contents of the collection beginning at index 0 to the specified CodeExpression array. + // 'expressions' is a CodeExpression array. + collection->CopyTo( expressions, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeExpression at index 0 of the collection. + collection->Insert( 0, gcnew CodePrimitiveExpression( true ) ); + // + + // + // Removes the specified CodeExpression from the collection. + CodeExpression^ expression = gcnew CodePrimitiveExpression( true ); + collection->Remove( expression ); + // + + // + // Removes the CodeExpression at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp new file mode 100644 index 00000000000..be4a228d29c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeGeneratorOptionsExample/CPP/class1.cpp @@ -0,0 +1,37 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +[STAThread] +int main() +{ + // + // Creates a new CodeGeneratorOptions. + CodeGeneratorOptions^ genOptions = gcnew CodeGeneratorOptions; + + // Sets a value indicating that the code generator should insert blank lines between type members. + genOptions->BlankLinesBetweenMembers = true; + + // Sets the style of bracing format to use: either S"Block" to start a + // bracing block on the same line as the declaration of its container, or + // S"C" to start the bracing for the block on the following line. + genOptions->BracingStyle = "C"; + + // Sets a value indicating that the code generator should not append an else, + // catch or finally block, including brackets, at the closing line of a preceeding if or try block. + genOptions->ElseOnClosing = false; + + // Sets the String* to indent each line with. + genOptions->IndentString = " "; + + // Uses the CodeGeneratorOptions indexer property to set an + // example Object* to the type's String*-keyed ListDictionary. + // Custom ICodeGenerator* implementations can use objects + // in this dictionary to customize process behavior. + genOptions[ "CustomGeneratorOptionStringExampleID" ] = "BuildFlags: /A /B /C /D /E"; + // + + Console::WriteLine( genOptions ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp new file mode 100644 index 00000000000..cab34001736 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeGotoStatementExample/CPP/codegotostatementexample.cpp @@ -0,0 +1,59 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeGotoStatementExample + { + public: + CodeGotoStatementExample() + { + + // + // Declares a type to contain the example code. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); + + // Declares an entry point method. + CodeEntryPointMethod^ entry1 = gcnew CodeEntryPointMethod; + type1->Members->Add( entry1 ); + + // Adds a goto statement to continue program flow at the "JumpToLabel" label. + CodeGotoStatement^ goto1 = gcnew CodeGotoStatement( "JumpToLabel" ); + entry1->Statements->Add( goto1 ); + + // Invokes Console.WriteLine to print "Test Output", which is skipped by the goto statement. + array^temp = {gcnew CodePrimitiveExpression( "Test Output." )}; + CodeMethodInvokeExpression^ method1 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp ); + entry1->Statements->Add( method1 ); + + // Declares a label named "JumpToLabel" associated with a method to output a test string using Console.WriteLine. + array^temp2 = {gcnew CodePrimitiveExpression( "Output from labeled statement." )}; + CodeMethodInvokeExpression^ method2 = gcnew CodeMethodInvokeExpression( gcnew CodeTypeReferenceExpression( "System.Console" ),"WriteLine",temp2 ); + CodeLabeledStatement^ label1 = gcnew CodeLabeledStatement( "JumpToLabel",gcnew CodeExpressionStatement( method2 ) ); + entry1->Statements->Add( label1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class Type1 + // { + // + // public static void Main() + // { + // goto JumpToLabel; + // System.Console.WriteLine("Test Output"); + // JumpToLabel: + // System.Console.WriteLine("Output from labeled statement."); + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp new file mode 100644 index 00000000000..c3a1463a6e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeIterationStatementExample/CPP/codeiterationstatementexample.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeIterationStatementExample + { + public: + CodeIterationStatementExample() + { + // + // Declares and initializes an integer variable named testInt. + CodeVariableDeclarationStatement^ testInt = gcnew CodeVariableDeclarationStatement( int::typeid,"testInt",gcnew CodePrimitiveExpression( (int^)0 ) ); + array^writelineparams = {gcnew CodeMethodInvokeExpression( gcnew CodeVariableReferenceExpression( "testInt" ),"ToString",nullptr )}; + array^codestatements = {gcnew CodeExpressionStatement( gcnew CodeMethodInvokeExpression( gcnew CodeMethodReferenceExpression( gcnew CodeTypeReferenceExpression( "Console" ),"WriteLine" ),writelineparams ) )}; + + // Creates a for loop that sets testInt to 0 and continues incrementing testInt by 1 each loop until testInt is not less than 10. + + // Each loop iteration the value of the integer is output using the Console.WriteLine method. + CodeIterationStatement^ forLoop = gcnew CodeIterationStatement( gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "testInt" ),gcnew CodePrimitiveExpression( 1 ) ),gcnew CodeBinaryOperatorExpression( gcnew CodeVariableReferenceExpression( "testInt" ),CodeBinaryOperatorType::LessThan,gcnew CodePrimitiveExpression( 10 ) ),gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "testInt" ),gcnew CodeBinaryOperatorExpression( gcnew CodeVariableReferenceExpression( "testInt" ),CodeBinaryOperatorType::Add,gcnew CodePrimitiveExpression( 1 ) ) ),codestatements ); + + // A C# code generator produces the following source code for the preceeding example code: + // int testInt = 0; + // for (testInt = 1; (testInt < 10); testInt = (testInt + 1)) { + // Console.WriteLine(testInt.ToString()); + // + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp new file mode 100644 index 00000000000..26b6cf744fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMemberEventSample/CPP/codemembereventexample.cpp @@ -0,0 +1,59 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeMemberEventExample + { + public: + CodeMemberEventExample() + { + + // + // Declares a type to contain an event and constructor method. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "EventTest" ); + + // + // Declares an event that accepts a delegate type of System.EventHandler. + CodeMemberEvent^ event1 = gcnew CodeMemberEvent; + + // Sets a name for the event. + event1->Name = "TestEvent"; + + // Sets the type of event. + event1->Type = gcnew CodeTypeReference( "System.EventHandler" ); + + // A C# code generator produces the following source code for the preceeding example code: + // private event System.EventHandler TestEvent; + // + // Adds the event to the type members collection. + type1->Members->Add( event1 ); + + // Declares an empty type constructor. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class EventTest + // { + // + // public EventTest() + // { + // } + // + // private event System.EventHandler TestEvent; + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp new file mode 100644 index 00000000000..a6523e8e7f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldExample/CPP/codememberfieldexample.cpp @@ -0,0 +1,46 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeMemberFieldExample + { + public: + CodeMemberFieldExample() + { + + // + // Declares a type to contain a field and a constructor method. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "FieldTest" ); + + // Declares a field of type String named testStringField. + CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","TestStringField" ); + type1->Members->Add( field1 ); + + // Declares an empty type constructor. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class FieldTest + // { + // private string testStringField; + // + // public FieldTest() + // { + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp new file mode 100644 index 00000000000..85f2cca6311 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMemberFieldPublicConstExample/CPP/class1.cpp @@ -0,0 +1,38 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeMemberField_PublicConst_Example +{ + public ref class Class1 + { + private: + static CodeCompileUnit^ GetCompileUnit() + { + CodeCompileUnit^ cu = gcnew CodeCompileUnit; + CodeNamespace^ nsp = gcnew CodeNamespace( "TestNamespace" ); + cu->Namespaces->Add( nsp ); + CodeTypeDeclaration^ testType = gcnew CodeTypeDeclaration( "testType" ); + nsp->Types->Add( testType ); + + // + // This example demonstrates declaring a public constant type member field. + + // When declaring a public constant type member field, you must set a particular + // access and scope mask to the member attributes of the field in order for the + // code generator to properly generate the field as a constant field. + + // Declares an integer field using a CodeMemberField + CodeMemberField^ constPublicField = gcnew CodeMemberField( int::typeid,"testConstPublicField" ); + + // Resets the access and scope mask bit flags of the member attributes of the field + // before setting the member attributes of the field to public and constant. + constPublicField->Attributes = (MemberAttributes)((constPublicField->Attributes & ~MemberAttributes::AccessMask & ~MemberAttributes::ScopeMask) | MemberAttributes::Public | MemberAttributes::Const); + // + + testType->Members->Add( constPublicField ); + return cu; + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp new file mode 100644 index 00000000000..8175a5921e6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMemberMethodExample/CPP/codemembermethodexample.cpp @@ -0,0 +1,37 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeMemberMethodExample + { + public: + CodeMemberMethodExample() + { + + // + // Defines a method that returns a string passed to it. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "ReturnString"; + method1->ReturnType = gcnew CodeTypeReference( "System.String" ); + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.String","text" ) ); + method1->Statements->Add( gcnew CodeMethodReturnStatement( gcnew CodeArgumentReferenceExpression( "text" ) ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // private string ReturnString(string text) + // { + // return text; + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp new file mode 100644 index 00000000000..7e2bc0cca2b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMemberPropertyExample/CPP/codememberpropertyexample.cpp @@ -0,0 +1,95 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeMemberPropertyExample + { + public: + CodeMemberPropertyExample() + { + + // + // Declares a type to contain a field and a constructor method. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "PropertyTest" ); + + // Declares a field of type String named testStringField. + CodeMemberField^ field1 = gcnew CodeMemberField( "System.String","testStringField" ); + type1->Members->Add( field1 ); + + // Declares a property of type String named StringProperty. + CodeMemberProperty^ property1 = gcnew CodeMemberProperty; + property1->Name = "StringProperty"; + property1->Type = gcnew CodeTypeReference( "System.String" ); + property1->Attributes = MemberAttributes::Public; + property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ) ) ); + property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ),gcnew CodePropertySetValueReferenceExpression ) ); + type1->Members->Add( property1 ); + + // Declares an empty type constructor. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class PropertyTest + // { + // + // private string testStringField; + // + // public PropertyTest() + // { + // } + // + // public virtual string StringProperty + // { + // get + // { + // return this.testStringField; + // } + // set + // { + // this.testStringField = value; + // } + // } + // } + // + } + + void SpecificExample() + { + + // + // Declares a property of type String named StringProperty. + CodeMemberProperty^ property1 = gcnew CodeMemberProperty; + property1->Name = "StringProperty"; + property1->Type = gcnew CodeTypeReference( "System.String" ); + property1->Attributes = MemberAttributes::Public; + property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ) ) ); + property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"testStringField" ),gcnew CodePropertySetValueReferenceExpression ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // public virtual string StringProperty + // { + // get + // { + // return this.testStringField; + // } + // set + // { + // this.testStringField = value; + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp new file mode 100644 index 00000000000..e6f645922d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMethodInvokeExpression/CPP/codemethodinvokeexpressionexample.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeMethodInvokeExpressionExample + { + public: + CodeMethodInvokeExpressionExample() + { + + // + array^temp0 = {gcnew CodePrimitiveExpression( true )}; + + // parameters array contains the parameters for the method. + CodeMethodInvokeExpression^ methodInvoke = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"Dispose",temp0 ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.Dispose(true); + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp new file mode 100644 index 00000000000..5bb3d9a74c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMethodReferenceExample/CPP/codemethodreferenceexample.cpp @@ -0,0 +1,53 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +public ref class CodeMethodReferenceExample +{ +public: + CodeMethodReferenceExample() + { + + // + // Declares a type to contain the example code. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); + + // Declares a method. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "TestMethod"; + type1->Members->Add( method1 ); + + // Declares a type constructor that calls a method. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // Invokes the TestMethod method of the current type object. + CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" ); + array^temp0; + CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp0 ); + constructor1->Statements->Add( invoke1 ); + + // + } + + void InvokeExample() + { + + // + // Invokes the TestMethod method of the current type object. + CodeMethodReferenceExpression^ methodRef1 = gcnew CodeMethodReferenceExpression( gcnew CodeThisReferenceExpression,"TestMethod" ); + array^temp1; + CodeMethodInvokeExpression^ invoke1 = gcnew CodeMethodInvokeExpression( methodRef1,temp1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestMethod(); + // + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp new file mode 100644 index 00000000000..038d748adc7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeMultiExample/CPP/codemultiexample.cpp @@ -0,0 +1,66 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +public ref class CodeMultiExample +{ +public: + CodeMultiExample(){} + + void CodeEventReferenceExample() + { + + // + // Represents a reference to an event. + CodeEventReferenceExpression^ eventRef1 = gcnew CodeEventReferenceExpression( gcnew CodeThisReferenceExpression,"TestEvent" ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestEvent + // + } + + void CodeIndexerExample() + { + + // + array^temp1 = {gcnew CodePrimitiveExpression( 1 )}; + System::CodeDom::CodeIndexerExpression^ indexerExpression = gcnew CodeIndexerExpression( gcnew CodeThisReferenceExpression,temp1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // this[1]; + // + } + + void CodeDirectionExample() + { + + // + // Declares a parameter passed by reference using a CodeDirectionExpression. + array^param1 = {gcnew CodeDirectionExpression( FieldDirection::Ref,gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestParameter" ) )}; + + // Invokes a method on this named TestMethod using the direction expression as a parameter. + CodeMethodInvokeExpression^ methodInvoke1 = gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"TestMethod",param1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestMethod(ref TestParameter); + // + } + + void CreateExpressionExample() + { + + // + array^temp0 = gcnew array(0); + CodeObjectCreateExpression^ objectCreate1 = gcnew CodeObjectCreateExpression( "System.DateTime",temp0 ); + + // A C# code generator produces the following source code for the preceeding example code: + // new System.DateTime(); + // + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..1fa3cdbea7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceCollectionExample/CPP/class1.cpp @@ -0,0 +1,78 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeNamespaceCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeNamespaceCollection + void CodeNamespaceCollectionExample() + { + // + // + // Creates an empty CodeNamespaceCollection. + CodeNamespaceCollection^ collection = gcnew CodeNamespaceCollection; + // + + // + // Adds a CodeNamespace to the collection. + collection->Add( gcnew CodeNamespace( "TestNamespace" ) ); + // + + // + // Adds an array of CodeNamespace objects to the collection. + array^namespaces = {gcnew CodeNamespace( "TestNamespace1" ),gcnew CodeNamespace( "TestNamespace2" )}; + collection->AddRange( namespaces ); + + // Adds a collection of CodeNamespace objects to the collection. + CodeNamespaceCollection^ namespacesCollection = gcnew CodeNamespaceCollection; + namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace1" ) ); + namespacesCollection->Add( gcnew CodeNamespace( "TestNamespace2" ) ); + collection->AddRange( namespacesCollection ); + // + + // + // Tests for the presence of a CodeNamespace in the collection, + // and retrieves its index if it is found. + CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" ); + int itemIndex = -1; + if ( collection->Contains( testNamespace ) ) + itemIndex = collection->IndexOf( testNamespace ); + // + + // + // Copies the contents of the collection beginning at index 0, + // to the specified CodeNamespace array. + // 'namespaces' is a CodeNamespace array. + collection->CopyTo( namespaces, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeNamespace at index 0 of the collection. + collection->Insert( 0, gcnew CodeNamespace( "TestNamespace" ) ); + // + + // + // Removes the specified CodeNamespace from the collection. + CodeNamespace^ namespace_ = gcnew CodeNamespace( "TestNamespace" ); + collection->Remove( namespace_ ); + // + + // + // Removes the CodeNamespace at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp new file mode 100644 index 00000000000..e2d0cf27fab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceExample/CPP/codenamespaceexample.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeMemberEventExample + { + public: + CodeMemberEventExample() + { + + // + CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; + CodeNamespace^ namespace1 = gcnew CodeNamespace( "TestNamespace" ); + compileUnit->Namespaces->Add( namespace1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // namespace TestNamespace { + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp new file mode 100644 index 00000000000..ac420b30839 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeNamespaceImportExample/CPP/codenamespaceimportexample.cpp @@ -0,0 +1,45 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeNamespaceImportExample + { + public: + CodeNamespaceImportExample() + { + + // + // Declares a compile unit to contain a namespace. + CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; + + // Declares a namespace named TestNamespace. + CodeNamespace^ testNamespace = gcnew CodeNamespace( "TestNamespace" ); + + // Adds the namespace to the namespace collection of the compile unit. + compileUnit->Namespaces->Add( testNamespace ); + + // Declares a namespace import of the System namespace. + CodeNamespaceImport^ import1 = gcnew CodeNamespaceImport( "System" ); + + // Adds the namespace import to the namespace imports collection of the namespace. + testNamespace->Imports->Add( import1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // namespace TestNamespace { + // using System; + // + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp new file mode 100644 index 00000000000..8e07b2222f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExample/CPP/codeparameterdeclarationexample.cpp @@ -0,0 +1,52 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeParameterDeclarationExample + { + public: + CodeParameterDeclarationExample() + { + + // + // Declares a new type to contain the example methods. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // + // Declares a method. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "TestMethod"; + + // Declares a string parameter passed by reference. + CodeParameterDeclarationExpression^ param1 = gcnew CodeParameterDeclarationExpression( "System.String","stringParam" ); + param1->Direction = FieldDirection::Ref; + method1->Parameters->Add( param1 ); + + // Declares a Int32 parameter passed by incoming field. + CodeParameterDeclarationExpression^ param2 = gcnew CodeParameterDeclarationExpression( "System.Int32","intParam" ); + param2->Direction = FieldDirection::Out; + method1->Parameters->Add( param2 ); + + // A C# code generator produces the following source code for the preceeding example code: + // private void TestMethod(ref string stringParam, out int intParam) { + // } + // + type1->Members->Add( method1 ); + + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..3b66a3fe5b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeParameterDeclarationExpressionCollectionExample/CPP/class1.cpp @@ -0,0 +1,81 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeParameterDeclarationExpressionCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeParameterDeclarationExpressionCollection + void CodeParameterDeclarationExpressionCollectionExample() + { + // + // + // Creates an empty CodeParameterDeclarationExpressionCollection. + CodeParameterDeclarationExpressionCollection^ collection = gcnew CodeParameterDeclarationExpressionCollection; + // + + // + // Adds a CodeParameterDeclarationExpression to the collection. + collection->Add( gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) ); + // + + // + // Adds an array of CodeParameterDeclarationExpression objects + // to the collection. + array^parameters = {gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ),gcnew CodeParameterDeclarationExpression( bool::typeid,"testBoolArgument" )}; + collection->AddRange( parameters ); + + // Adds a collection of CodeParameterDeclarationExpression objects + // to the collection. + CodeParameterDeclarationExpressionCollection^ parametersCollection = gcnew CodeParameterDeclarationExpressionCollection; + parametersCollection->Add( gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) ); + parametersCollection->Add( gcnew CodeParameterDeclarationExpression( bool::typeid,"testBoolArgument" ) ); + collection->AddRange( parametersCollection ); + // + + // + // Tests for the presence of a CodeParameterDeclarationExpression + // in the collection, and retrieves its index if it is found. + CodeParameterDeclarationExpression^ testParameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ); + int itemIndex = -1; + if ( collection->Contains( testParameter ) ) + itemIndex = collection->IndexOf( testParameter ); + // + + // + // Copies the contents of the collection beginning at index 0 to the specified CodeParameterDeclarationExpression array. + // 'parameters' is a CodeParameterDeclarationExpression array. + collection->CopyTo( parameters, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeParameterDeclarationExpression at index 0 + // of the collection. + collection->Insert( 0, gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ) ); + // + + // + // Removes the specified CodeParameterDeclarationExpression + // from the collection. + CodeParameterDeclarationExpression^ parameter = gcnew CodeParameterDeclarationExpression( int::typeid,"testIntArgument" ); + collection->Remove( parameter ); + // + + // + // Removes the CodeParameterDeclarationExpression at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp new file mode 100644 index 00000000000..9056a9d5683 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodePrimitiveExpressionExample/CPP/codeprimitiveexpressionexample.cpp @@ -0,0 +1,37 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodePrimitiveExpressionExample + { + public: + CodePrimitiveExpressionExample() + { + + // + // Represents a string. + CodePrimitiveExpression^ stringPrimitive = gcnew CodePrimitiveExpression( "Test String" ); + + // Represents an integer. + CodePrimitiveExpression^ intPrimitive = gcnew CodePrimitiveExpression( 10 ); + + // Represents a floating point number. + CodePrimitiveExpression^ floatPrimitive = gcnew CodePrimitiveExpression( 1.03189 ); + + // Represents a null value expression. + CodePrimitiveExpression^ nullPrimitive = gcnew CodePrimitiveExpression( 0 ); + + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp new file mode 100644 index 00000000000..6a937caac58 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodePropertySetValueExample/CPP/codepropertysetvalueexample.cpp @@ -0,0 +1,70 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodePropertySetValueExample + { + public: + CodePropertySetValueExample() + { + + // + // Declares a type. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); + + // Declares a constructor. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // Declares an integer field. + CodeMemberField^ field1 = gcnew CodeMemberField( "System.Int32","integerField" ); + type1->Members->Add( field1 ); + + // Declares a property. + CodeMemberProperty^ property1 = gcnew CodeMemberProperty; + + // Declares a property get statement to return the value of the integer field. + property1->GetStatements->Add( gcnew CodeMethodReturnStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ) ) ); + + // Declares a property set statement to set the value to the integer field. + // The CodePropertySetValueReferenceExpression represents the value argument passed to the property set statement. + property1->SetStatements->Add( gcnew CodeAssignStatement( gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"integerField" ),gcnew CodePropertySetValueReferenceExpression ) ); + type1->Members->Add( property1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class Type1 + // { + // + // private int integerField; + // + // public Type1() + // { + // } + // + // private int integerProperty + // { + // get + // { + // return this.integerField; + // } + // set + // { + // this.integerField = value; + // } + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp new file mode 100644 index 00000000000..b6dcd099dd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeReferenceExample/CPP/codereferenceexample.cpp @@ -0,0 +1,53 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeReferenceExample + { + public: + CodeReferenceExample(){} + + void CodeFieldReferenceExample() + { + + // + CodeFieldReferenceExpression^ fieldRef1 = gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestField + // + } + + void CodePropertyReferenceExample() + { + + // + CodePropertyReferenceExpression^ propertyRef1 = gcnew CodePropertyReferenceExpression( gcnew CodeThisReferenceExpression,"TestProperty" ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestProperty + // + } + + void CodeVariableReferenceExample() + { + + // + CodeVariableReferenceExpression^ variableRef1 = gcnew CodeVariableReferenceExpression( "TestVariable" ); + + // A C# code generator produces the following source code for the preceeding example code: + // TestVariable + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp new file mode 100644 index 00000000000..4f5f9c70446 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeRemoveEventExample/CPP/coderemoveeventexample.cpp @@ -0,0 +1,33 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeRemoveEventExample + { + public: + CodeRemoveEventExample() + { + + // + // Creates a delegate of type System.EventHandler pointing to a method named OnMouseEnter. + CodeDelegateCreateExpression^ mouseEnterDelegate = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "System.EventHandler" ),gcnew CodeThisReferenceExpression,"OnMouseEnter" ); + + // Creates a remove event statement that removes the delegate from the TestEvent event. + CodeRemoveEventStatement^ removeEvent1 = gcnew CodeRemoveEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",mouseEnterDelegate ); + + // A C# code generator produces the following source code for the preceeding example code: + // this.TestEvent -= new System.EventHandler(this.OnMouseEnter); + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..03265e75e7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeStatementCollectionExample/CPP/class1.cpp @@ -0,0 +1,78 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeStatementCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeStatementCollection + void CodeStatementCollectionExample() + { + + // + // + // Creates an empty CodeStatementCollection. + CodeStatementCollection^ collection = gcnew CodeStatementCollection; + // + + // + // Adds a CodeStatement to the collection. + collection->Add( gcnew CodeCommentStatement( "Test comment statement" ) ); + // + + // + // Adds an array of CodeStatement objects to the collection. + array^statements = {gcnew CodeCommentStatement( "Test comment statement" ),gcnew CodeCommentStatement( "Test comment statement" )}; + collection->AddRange( statements ); + + // Adds a collection of CodeStatement objects to the collection. + CodeStatement^ testStatement = gcnew CodeCommentStatement( "Test comment statement" ); + CodeStatementCollection^ statementsCollection = gcnew CodeStatementCollection; + statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) ); + statementsCollection->Add( gcnew CodeCommentStatement( "Test comment statement" ) ); + statementsCollection->Add( testStatement ); + collection->AddRange( statementsCollection ); + // + + // + // Tests for the presence of a CodeStatement in the + // collection, and retrieves its index if it is found. + int itemIndex = -1; + if ( collection->Contains( testStatement ) ) + itemIndex = collection->IndexOf( testStatement ); + // + + // + // Copies the contents of the collection beginning at index 0 to the specified CodeStatement array. + // 'statements' is a CodeStatement array. + collection->CopyTo( statements, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeStatement at index 0 of the collection. + collection->Insert( 0, gcnew CodeCommentStatement( "Test comment statement" ) ); + // + + // + // Removes the specified CodeStatement from the collection. + collection->Remove( testStatement ); + // + + // + // Removes the CodeStatement at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp new file mode 100644 index 00000000000..54009857661 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeThrowExceptionStatement/CPP/codethrowexceptionstatementexample.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +public ref class CodeThrowExceptionStatementExample +{ +public: + CodeThrowExceptionStatementExample() + { + // + // This CodeThrowExceptionStatement throws a new System.Exception. + array^temp0; + CodeThrowExceptionStatement^ throwException = gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( gcnew CodeTypeReference( System::Exception::typeid ),temp0 ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // throw new System.Exception(); + // + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp new file mode 100644 index 00000000000..cb97225e885 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTryCatchFinallyExample/CPP/codetrycatchfinallyexample.cpp @@ -0,0 +1,81 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +public ref class CodeTryCatchFinallyExample +{ +public: + CodeTryCatchFinallyExample() + { + + // + // Declares a type to contain a try...catch block. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "TryCatchTest" ); + + // Defines a method that throws an exception of type System.ApplicationException. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "ThrowApplicationException"; + array^temp = {gcnew CodePrimitiveExpression( "Test Application Exception" )}; + method1->Statements->Add( gcnew CodeThrowExceptionStatement( gcnew CodeObjectCreateExpression( "System.ApplicationException",temp ) ) ); + type1->Members->Add( method1 ); + + // Defines a constructor that calls the ThrowApplicationException method from a try block. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + type1->Members->Add( constructor1 ); + + // Defines a try statement that calls the ThrowApplicationException method. + CodeTryCatchFinallyStatement^ try1 = gcnew CodeTryCatchFinallyStatement; + try1->TryStatements->Add( gcnew CodeMethodInvokeExpression( gcnew CodeThisReferenceExpression,"ThrowApplicationException", nullptr ) ); + constructor1->Statements->Add( try1 ); + + // Defines a catch clause for exceptions of type ApplicationException. + CodeCatchClause^ catch1 = gcnew CodeCatchClause( "ex",gcnew CodeTypeReference( "System.ApplicationException" ) ); + catch1->Statements->Add( gcnew CodeCommentStatement( "Handle any System.ApplicationException here." ) ); + try1->CatchClauses->Add( catch1 ); + + // Defines a catch clause for any remaining unhandled exception types. + CodeCatchClause^ catch2 = gcnew CodeCatchClause( "ex" ); + catch2->Statements->Add( gcnew CodeCommentStatement( "Handle any other exception type here." ) ); + try1->CatchClauses->Add( catch2 ); + + // Defines a finally block by adding to the FinallyStatements collection. + try1->FinallyStatements->Add( gcnew CodeCommentStatement( "Handle any finally block statements." ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class TryCatchTest + // { + // + // public TryCatchTest() + // { + // try + // { + // this.ThrowApplicationException(); + // } + // catch (System.ApplicationException ex) + // { + // // Handle any System.ApplicationException here. + // } + // catch (System.Exception ex) + // { + // // Handle any other exception type here. + // } + // finally { + // // Handle any finally block statements. + // } + // } + // + // private void ThrowApplicationException() + // { + // throw new System.ApplicationException("Test Application Exception"); + // } + // } + // + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp new file mode 100644 index 00000000000..aefa0b83158 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeConstructorExample/CPP/codetypeconstructorexample.cpp @@ -0,0 +1,42 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeTypeConstructorExample + { + public: + CodeTypeConstructorExample() + { + + // + // Declares a new type for a static constructor. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "Type1" ); + + // Declares a static constructor. + CodeTypeConstructor^ constructor2 = gcnew CodeTypeConstructor; + + // Adds the static constructor to the type. + type1->Members->Add( constructor2 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class Type1 + // { + // + // static Type1() + // { + // } + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..eb0a71bdaee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationCollectionExample/CPP/class1.cpp @@ -0,0 +1,80 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeTypeDeclarationCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeTypeDeclarationCollection + void CodeTypeDeclarationCollectionExample() + { + + // + // + // Creates an empty CodeTypeDeclarationCollection. + CodeTypeDeclarationCollection^ collection = gcnew CodeTypeDeclarationCollection; + // + + // + // Adds a CodeTypeDeclaration to the collection. + collection->Add( gcnew CodeTypeDeclaration( "TestType" ) ); + // + + // + // Adds an array of CodeTypeDeclaration objects to the collection. + array^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )}; + collection->AddRange( declarations ); + + // Adds a collection of CodeTypeDeclaration objects to the + // collection. + CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection; + declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) ); + declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) ); + collection->AddRange( declarationsCollection ); + // + + // + // Tests for the presence of a CodeTypeDeclaration in the + // collection, and retrieves its index if it is found. + CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" ); + int itemIndex = -1; + if ( collection->Contains( testDeclaration ) ) + itemIndex = collection->IndexOf( testDeclaration ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified CodeTypeDeclaration array. + // 'declarations' is a CodeTypeDeclaration array. + collection->CopyTo( declarations, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeTypeDeclaration at index 0 of the collection. + collection->Insert( 0, gcnew CodeTypeDeclaration( "TestType" ) ); + // + + // + // Removes the specified CodeTypeDeclaration from the collection. + CodeTypeDeclaration^ declaration = gcnew CodeTypeDeclaration( "TestType" ); + collection->Remove( declaration ); + // + + // + // Removes the CodeTypeDeclaration at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp new file mode 100644 index 00000000000..ac817d9918f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeDeclarationExample/CPP/codetypedeclarationexample.cpp @@ -0,0 +1,41 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::Reflection; + +namespace CodeDomSamples +{ + public ref class CodeTypeDeclarationExample + { + public: + CodeTypeDeclarationExample() + { + + // + // Creates a new type declaration. + + // name parameter indicates the name of the type. + CodeTypeDeclaration^ newType = gcnew CodeTypeDeclaration( "TestType" ); + + // Sets the member attributes for the type to private. + newType->Attributes = MemberAttributes::Private; + + // Sets a base class which the type inherits from. + newType->BaseTypes->Add( "BaseType" ); + + // A C# code generator produces the following source code for the preceeding example code: + // class TestType : BaseType + // { + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp new file mode 100644 index 00000000000..79266531f92 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeDelegateExample/CPP/codetypedelegateexample.cpp @@ -0,0 +1,78 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeTypeDelegateExample + { + public: + CodeTypeDelegateExample() + { + + // + // Declares a type to contain the delegate and constructor method. + CodeTypeDeclaration^ type1 = gcnew CodeTypeDeclaration( "DelegateTest" ); + + // Declares an event that accepts a custom delegate type of "TestDelegate". + CodeMemberEvent^ event1 = gcnew CodeMemberEvent; + event1->Name = "TestEvent"; + event1->Type = gcnew CodeTypeReference( "DelegateTest.TestDelegate" ); + type1->Members->Add( event1 ); + + // + // Declares a delegate type called TestDelegate with an EventArgs parameter. + CodeTypeDelegate^ delegate1 = gcnew CodeTypeDelegate( "TestDelegate" ); + delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); + delegate1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // public delegate void TestDelegate(object sender, System.EventArgs e); + // + type1->Members->Add( delegate1 ); + + // Declares a method that matches the "TestDelegate" method signature. + CodeMemberMethod^ method1 = gcnew CodeMemberMethod; + method1->Name = "TestMethod"; + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.Object","sender" ) ); + method1->Parameters->Add( gcnew CodeParameterDeclarationExpression( "System.EventArgs","e" ) ); + type1->Members->Add( method1 ); + + // Defines a constructor that attaches a TestDelegate delegate pointing to the TestMethod method + // to the TestEvent event. + CodeConstructor^ constructor1 = gcnew CodeConstructor; + constructor1->Attributes = MemberAttributes::Public; + CodeDelegateCreateExpression^ createDelegate1 = gcnew CodeDelegateCreateExpression( gcnew CodeTypeReference( "DelegateTest.TestDelegate" ),gcnew CodeThisReferenceExpression,"TestMethod" ); + CodeAttachEventStatement^ attachStatement1 = gcnew CodeAttachEventStatement( gcnew CodeThisReferenceExpression,"TestEvent",createDelegate1 ); + constructor1->Statements->Add( attachStatement1 ); + type1->Members->Add( constructor1 ); + + // A C# code generator produces the following source code for the preceeding example code: + // public class DelegateTest + // { + // + // public DelegateTest() + // { + // this.TestEvent += new DelegateTest.TestDelegate(this.TestMethod); + // } + // + // private event DelegateTest.TestDelegate TestEvent; + // + // private void TestMethod(object sender, System.EventArgs e) + // { + // } + // + // public delegate void TestDelegate(object sender, System.EventArgs e); + // } + // + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..764de1a8a1d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeMemberCollectionExample/CPP/class1.cpp @@ -0,0 +1,79 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeTypeMemberCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeTypeMemberCollection + void CodeTypeMemberCollectionExample() + { + + // + // + // Creates an empty CodeTypeMemberCollection. + CodeTypeMemberCollection^ collection = gcnew CodeTypeMemberCollection; + // + + // + // Adds a CodeTypeMember to the collection. + collection->Add( gcnew CodeMemberField( "System.String","TestStringField" ) ); + // + + // + // Adds an array of CodeTypeMember objects to the collection. + array^members = {gcnew CodeMemberField( "System.String","TestStringField1" ),gcnew CodeMemberField( "System.String","TestStringField2" )}; + collection->AddRange( members ); + + // Adds a collection of CodeTypeMember objects to the collection. + CodeTypeMemberCollection^ membersCollection = gcnew CodeTypeMemberCollection; + membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField1" ) ); + membersCollection->Add( gcnew CodeMemberField( "System.String","TestStringField2" ) ); + collection->AddRange( membersCollection ); + // + + // + // Tests for the presence of a CodeTypeMember in the collection, + // and retrieves its index if it is found. + CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" ); + int itemIndex = -1; + if ( collection->Contains( testMember ) ) + itemIndex = collection->IndexOf( testMember ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified CodeTypeMember array. + // 'members' is a CodeTypeMember array. + collection->CopyTo( members, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeTypeMember at index 0 of the collection. + collection->Insert( 0, gcnew CodeMemberField( "System.String","TestStringField" ) ); + // + + // + // Removes the specified CodeTypeMember from the collection. + CodeTypeMember^ member = gcnew CodeMemberField( "System.String","TestStringField" ); + collection->Remove( member ); + // + + // + // Removes the CodeTypeMember at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp new file mode 100644 index 00000000000..c1b459722a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeOfExample/CPP/codetypeofexample.cpp @@ -0,0 +1,63 @@ +// +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +namespace CodeDomSamples +{ + public ref class CodeTypeOfExample + { + public: + static void Main() + { + ShowTypeReference(); + Console::WriteLine(); + ShowTypeReferenceExpression(); + } + + static void ShowTypeReference() + { + // + // Creates a reference to the System.DateTime type. + CodeTypeReference^ typeRef1 = gcnew CodeTypeReference("System.DateTime"); + + // Creates a typeof expression for the specified type reference. + CodeTypeOfExpression^ typeof1 = gcnew CodeTypeOfExpression(typeRef1); + + // Create a C# code provider + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Generate code and send the output to the console + provider->GenerateCodeFromExpression(typeof1, Console::Out, gcnew CodeGeneratorOptions()); + // The code generator produces the following source code for the preceeding example code: + // typeof(System.DateTime) + // + } + + static void ShowTypeReferenceExpression() + { + // + // Creates an expression referencing the System.DateTime type. + CodeTypeReferenceExpression^ typeRef1 = gcnew CodeTypeReferenceExpression("System.DateTime"); + + // Create a C# code provider + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Generate code and send the output to the console + provider->GenerateCodeFromExpression(typeRef1, Console::Out, gcnew CodeGeneratorOptions()); + // The code generator produces the following source code for the preceeding example code: + + // System.DateTime + + // + } + }; +} + +int main() +{ + CodeDomSamples::CodeTypeOfExample::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp new file mode 100644 index 00000000000..ab613ec0d11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeTypeReferenceCollection/CPP/class1.cpp @@ -0,0 +1,78 @@ +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeTypeReferenceCollectionExample +{ + public ref class Class1 + { + public: + Class1(){} + + // CodeTypeReferenceCollection + void CodeTypeReferenceCollectionExample() + { + // + // + // Creates an empty CodeTypeReferenceCollection. + CodeTypeReferenceCollection^ collection = gcnew CodeTypeReferenceCollection; + // + + // + // Adds a CodeTypeReference to the collection. + collection->Add( gcnew CodeTypeReference( bool::typeid ) ); + // + + // + // Adds an array of CodeTypeReference objects to the collection. + array^references = {gcnew CodeTypeReference( bool::typeid ),gcnew CodeTypeReference( bool::typeid )}; + collection->AddRange( references ); + + // Adds a collection of CodeTypeReference objects to the collection. + CodeTypeReferenceCollection^ referencesCollection = gcnew CodeTypeReferenceCollection; + referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) ); + referencesCollection->Add( gcnew CodeTypeReference( bool::typeid ) ); + collection->AddRange( referencesCollection ); + // + + // + // Tests for the presence of a CodeTypeReference in the + // collection, and retrieves its index if it is found. + CodeTypeReference^ testReference = gcnew CodeTypeReference( bool::typeid ); + int itemIndex = -1; + if ( collection->Contains( testReference ) ) + itemIndex = collection->IndexOf( testReference ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified CodeTypeReference array. + // 'references' is a CodeTypeReference array. + collection->CopyTo( references, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CodeTypeReference at index 0 of the collection. + collection->Insert( 0, gcnew CodeTypeReference( bool::typeid ) ); + // + + // + // Removes the specified CodeTypeReference from the collection. + CodeTypeReference^ reference = gcnew CodeTypeReference( bool::typeid ); + collection->Remove( reference ); + // + + // + // Removes the CodeTypeReference at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp b/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp new file mode 100644 index 00000000000..a97b2b691ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CodeVariableDeclarationStatementExample/CPP/codevariabledeclarationstatementexample.cpp @@ -0,0 +1,28 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; + +namespace CodeDomSamples +{ + public ref class CodeVariableDeclarationStatementExample + { + public: + CodeVariableDeclarationStatementExample() + { + // + // Type of the variable to declare. + // Name of the variable to declare. + // Optional initExpression parameter initializes the variable. + CodeVariableDeclarationStatement^ variableDeclaration = gcnew CodeVariableDeclarationStatement( String::typeid,"TestString",gcnew CodePrimitiveExpression( "Testing" ) ); + + // A C# code generator produces the following source code for the preceeding example code: + // string TestString = "Testing"; + // + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp b/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp new file mode 100644 index 00000000000..914c8f0a8fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CompareInfo/cpp/CompareInfo.cpp @@ -0,0 +1,46 @@ +// Types:System.Globalization.CompareInfo +// +using namespace System; +using namespace System::Text; +using namespace System::Globalization; + +int main() +{ + array^ sign = gcnew array { "<", "=", ">" }; + + // The code below demonstrates how strings compare + // differently for different cultures. + String^ s1 = "Coté"; + String^ s2 = "coté"; + String^ s3 = "côte"; + + // Set sort order of strings for French in France. + CompareInfo^ ci = (gcnew CultureInfo("fr-FR"))->CompareInfo; + Console::WriteLine(L"The LCID for {0} is {1}.", ci->Name, ci->LCID); + + // Display the result using fr-FR Compare of Coté = coté. + Console::WriteLine(L"fr-FR Compare: {0} {2} {1}", + s1, s2, sign[ci->Compare(s1, s2, CompareOptions::IgnoreCase) + 1]); + + // Display the result using fr-FR Compare of coté > côte. + Console::WriteLine(L"fr-FR Compare: {0} {2} {1}", + s2, s3, sign[ci->Compare(s2, s3, CompareOptions::None) + 1]); + + // Set sort order of strings for Japanese as spoken in Japan. + ci = (gcnew CultureInfo("ja-JP"))->CompareInfo; + Console::WriteLine(L"The LCID for {0} is {1}.", ci->Name, ci->LCID); + + // Display the result using ja-JP Compare of coté < côte. + Console::WriteLine("ja-JP Compare: {0} {2} {1}", + s2, s3, sign[ci->Compare(s2, s3) + 1]); +} + +// This code produces the following output. +// +// The LCID for fr-FR is 1036. +// fr-FR Compare: Coté = coté +// fr-FR Compare: coté > côte +// The LCID for ja-JP is 1041. +// ja-JP Compare: coté < côte +// + diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..8a41cb9003d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CompilerErrorCollectionExample/CPP/class1.cpp @@ -0,0 +1,77 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +public ref class Class1 +{ +public: + Class1(){} + + // CompilerErrorCollection + void CompilerErrorCollectionExample() + { + + // + // + // Creates an empty CompilerErrorCollection. + CompilerErrorCollection^ collection = gcnew CompilerErrorCollection; + // + + // + // Adds a CompilerError to the collection. + collection->Add( gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" ) ); + // + + // + // Adds an array of CompilerError objects to the collection. + array^errors = {gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ),gcnew CompilerError( "Testfile::cs",5,10,"CS0001","Example error text" )}; + collection->AddRange( errors ); + + // Adds a collection of CompilerError objects to the collection. + CompilerErrorCollection^ errorsCollection = gcnew CompilerErrorCollection; + errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) ); + errorsCollection->Add( gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) ); + collection->AddRange( errorsCollection ); + // + + // + // Tests for the presence of a CompilerError in the + // collection, and retrieves its index if it is found. + CompilerError^ testError = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ); + int itemIndex = -1; + if ( collection->Contains( testError ) ) + itemIndex = collection->IndexOf( testError ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified CompilerError array. + // 'errors' is a CompilerError array. + collection->CopyTo( errors, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a CompilerError at index 0 of the collection. + collection->Insert( 0, gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ) ); + // + + // + // Removes the specified CompilerError from the collection. + CompilerError^ error = gcnew CompilerError( "Testfile.cs",5,10,"CS0001","Example error text" ); + collection->Remove( error ); + // + + // + // Removes the CompilerError at index 0. + collection->RemoveAt( 0 ); + // + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp new file mode 100644 index 00000000000..2ee1d38b759 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CompilerParametersExample/CPP/source.cpp @@ -0,0 +1,234 @@ +// The following example builds a CodeDom source graph for a simple +// Hello World program. The source is then saved to a file, +// compiled into an executable, and run. + +// This example is based loosely on the CodeDom example, but its +// primary intent is to illustrate the CompilerParameters class. + +// Notice that the snippet is conditionally compiled for Everett vs. +// Whidbey builds. Whidbey introduced new APIs that are not available +// in Everett. Snippet IDs do not overlap between Whidbey and Everett; +// Snippet #1 is Everett, Snippet #2 is Whidbey. +#using +// +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::IO; +using namespace System::Diagnostics; + +// Build a Hello World program graph using System.CodeDom types. +static CodeCompileUnit^ BuildHelloWorldGraph() +{ + // Create a new CodeCompileUnit to contain the program graph. + CodeCompileUnit^ compileUnit = gcnew CodeCompileUnit; + + // Declare a new namespace called Samples. + CodeNamespace^ samples = gcnew CodeNamespace( "Samples" ); + // Add the new namespace to the compile unit. + compileUnit->Namespaces->Add( samples ); + + // Add the new namespace import for the System namespace. + samples->Imports->Add( gcnew CodeNamespaceImport( "System" ) ); + + // Declare a new type called Class1. + CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration( "Class1" ); + // Add the new type to the namespace's type collection. + samples->Types->Add( class1 ); + + // Declare a new code entry point method + CodeEntryPointMethod^ start = gcnew CodeEntryPointMethod; + + // Create a type reference for the System::Console class. + CodeTypeReferenceExpression^ csSystemConsoleType = + gcnew CodeTypeReferenceExpression( "System.Console" ); + + // Build a Console::WriteLine statement. + CodeMethodInvokeExpression^ cs1 = gcnew CodeMethodInvokeExpression( + csSystemConsoleType, "WriteLine", + gcnew CodePrimitiveExpression( "Hello World!" ) ); + + // Add the WriteLine call to the statement collection. + start->Statements->Add( cs1 ); + + // Build another Console::WriteLine statement. + CodeMethodInvokeExpression^ cs2 = gcnew CodeMethodInvokeExpression( + csSystemConsoleType, "WriteLine", + gcnew CodePrimitiveExpression( "Press the Enter key to continue." ) ); + // Add the WriteLine call to the statement collection. + start->Statements->Add( cs2 ); + + // Build a call to System::Console::ReadLine. + CodeMethodReferenceExpression^ csReadLine = gcnew CodeMethodReferenceExpression( + csSystemConsoleType, "ReadLine" ); + CodeMethodInvokeExpression^ cs3 = gcnew CodeMethodInvokeExpression( + csReadLine,gcnew array(0) ); + + // Add the ReadLine statement. + start->Statements->Add( cs3 ); + + // Add the code entry point method to the Members collection + // of the type. + class1->Members->Add( start ); + + return compileUnit; +} + +static String^ GenerateCode( CodeDomProvider^ provider, CodeCompileUnit^ compileunit ) +{ + // Build the source file name with the language extension (vb, cs, js). + String^ sourceFile = String::Empty; + + if ( provider->FileExtension->StartsWith( "." ) ) + { + sourceFile = String::Concat( "HelloWorld", provider->FileExtension ); + } + else + { + sourceFile = String::Concat( "HelloWorld.", provider->FileExtension ); + } + + // Create a TextWriter to a StreamWriter to an output file. + IndentedTextWriter^ tw = gcnew IndentedTextWriter( + gcnew StreamWriter( sourceFile,false )," " ); + // Generate source code using the code generator. + provider->GenerateCodeFromCompileUnit( compileunit, tw, gcnew CodeGeneratorOptions ); + // Close the output file. + tw->Close(); + return sourceFile; +} + +// +static bool CompileCode( CodeDomProvider^ provider, + String^ sourceFile, + String^ exeFile ) +{ + + CompilerParameters^ cp = gcnew CompilerParameters; + if ( !cp) + { + return false; + } + + // Generate an executable instead of + // a class library. + cp->GenerateExecutable = true; + + // Set the assembly file name to generate. + cp->OutputAssembly = exeFile; + + // Generate debug information. + cp->IncludeDebugInformation = true; + + // Add an assembly reference. + cp->ReferencedAssemblies->Add( "System.dll" ); + + // Save the assembly as a physical file. + cp->GenerateInMemory = false; + + // Set the level at which the compiler + // should start displaying warnings. + cp->WarningLevel = 3; + + // Set whether to treat all warnings as errors. + cp->TreatWarningsAsErrors = false; + + // Set compiler argument to optimize output. + cp->CompilerOptions = "/optimize"; + + // Set a temporary files collection. + // The TempFileCollection stores the temporary files + // generated during a build in the current directory, + // and does not delete them after compilation. + cp->TempFiles = gcnew TempFileCollection( ".",true ); + + if ( provider->Supports( GeneratorSupport::EntryPointMethod ) ) + { + // Specify the class that contains + // the main method of the executable. + cp->MainClass = "Samples.Class1"; + } + + if ( Directory::Exists( "Resources" ) ) + { + if ( provider->Supports( GeneratorSupport::Resources ) ) + { + // Set the embedded resource file of the assembly. + // This is useful for culture-neutral resources, + // or default (fallback) resources. + cp->EmbeddedResources->Add( "Resources\\Default.resources" ); + + // Set the linked resource reference files of the assembly. + // These resources are included in separate assembly files, + // typically localized for a specific language and culture. + cp->LinkedResources->Add( "Resources\\nb-no.resources" ); + } + } + + // Invoke compilation. + CompilerResults^ cr = provider->CompileAssemblyFromFile( cp, sourceFile ); + + if ( cr->Errors->Count > 0 ) + { + // Display compilation errors. + Console::WriteLine( "Errors building {0} into {1}", + sourceFile, cr->PathToAssembly ); + for each ( CompilerError^ ce in cr->Errors ) + { + Console::WriteLine( " {0}", ce->ToString() ); + Console::WriteLine(); + } + } + else + { + Console::WriteLine( "Source {0} built into {1} successfully.", + sourceFile, cr->PathToAssembly ); + } + + // Return the results of compilation. + if ( cr->Errors->Count > 0 ) + { + return false; + } + else + { + return true; + } +} +// + +[STAThread] +void main() +{ + String^ exeName = "HelloWorld.exe"; + CodeDomProvider^ provider = nullptr; + + Console::WriteLine( "Enter the source language for Hello World (cs, vb, etc):" ); + String^ inputLang = Console::ReadLine(); + Console::WriteLine(); + + if ( CodeDomProvider::IsDefinedLanguage( inputLang ) ) + { + CodeCompileUnit^ helloWorld = BuildHelloWorldGraph(); + provider = CodeDomProvider::CreateProvider( inputLang ); + if ( helloWorld && provider ) + { + String^ sourceFile = GenerateCode( provider, helloWorld ); + Console::WriteLine( "HelloWorld source code generated." ); + if ( CompileCode( provider, sourceFile, exeName ) ) + { + Console::WriteLine( "Starting HelloWorld executable." ); + Process::Start( exeName ); + } + } + } + + if ( provider == nullptr ) + { + Console::WriteLine( "There is no CodeDomProvider for the input language." ); + } +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp new file mode 100644 index 00000000000..89f9230ed7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CompilerResultsExample/CPP/class1.cpp @@ -0,0 +1,54 @@ +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::Collections; +using namespace System::Security::Permissions; + +public ref class Class1 +{ +public: + Class1(){} + + // + // Displays information from a CompilerResults. + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + static void DisplayCompilerResults( System::CodeDom::Compiler::CompilerResults^ cr ) + { + + // If errors occurred during compilation, output the compiler output and errors. + if ( cr->Errors->Count > 0 ) + { + for ( int i = 0; i < cr->Output->Count; i++ ) + Console::WriteLine( cr->Output[ i ] ); + for ( int i = 0; i < cr->Errors->Count; i++ ) + Console::WriteLine( String::Concat( i, ": ", cr->Errors[ i ] ) ); + } + else + { + + // Display information ab->Item[Out] the* compiler's exit code and the generated assembly. + Console::WriteLine( "Compiler returned with result code: {0}", cr->NativeCompilerReturnValue ); + Console::WriteLine( "Generated assembly name: {0}", cr->CompiledAssembly->FullName ); + if ( cr->PathToAssembly == nullptr ) + Console::WriteLine( "The assembly has been generated in memory." ); + else + Console::WriteLine( "Path to assembly: {0}", cr->PathToAssembly ); + + // Display temporary files information. + if ( !cr->TempFiles->KeepFiles ) + Console::WriteLine( "Temporary build files were deleted." ); + else + { + Console::WriteLine( "Temporary build files were not deleted." ); + + // Display a list of the temporary build files + IEnumerator^ enu = cr->TempFiles->GetEnumerator(); + for ( int i = 0; enu->MoveNext(); i++ ) + Console::WriteLine("TempFile " + i.ToString() + ": " + (String^)(enu->Current) ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp b/snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp new file mode 100644 index 00000000000..c3bc51ec87e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ComponentInstaller_CopyFromComponent/CPP/componentinstaller_copyfromcomponent.cpp @@ -0,0 +1,51 @@ +// System::Configuration::Install::ComponentInstaller.CopyFromComponent +// System::Configuration::Install::ComponentInstaller.IsEquivalentInstaller + +/* The following example demonstrates the 'CopyFromComponent' and +the 'IsEquivalentInstaller' methods of the 'ComponentInstaller' class. +It defines a class MyInstallClass, which creates the event log and copies +the properties of the event log component to the 'EventLogInstaller' object. +It also checks whether 'ServiceInstaller' object can handle the same kind of +installation as 'EventLogInstaller' object. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::ServiceProcess; + +int main() +{ +// + EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller; + // Create a source for the specified event log, on local computer. + EventLog::CreateEventSource( "MyEventSource", "MyEventLog", "." ); + // Create an event log instance and associate it with the log . + EventLog^ myEventLog = gcnew EventLog( "MyEventLog",".","MyEventSource" ); + // Copy the properties that are required at install time from + // the event log component to the installer. + myEventLogInstaller->CopyFromComponent( myEventLog ); +// + Console::WriteLine( "The properties of the event log component : " ); + Console::WriteLine( myEventLogInstaller->Log ); + Console::WriteLine( myEventLogInstaller->Source ); +// + ServiceInstaller^ myServiceInstaller = gcnew ServiceInstaller; + // Check whether 'ServiceInstaller' object can handle the same + // kind of installation as 'EventLogInstaller' object. + if ( myEventLogInstaller->IsEquivalentInstaller( myServiceInstaller ) ) + { + Console::WriteLine( "'ServiceInstaller' can handle the same kind " + + "of installation as EventLogInstaller" ); + } + else + { + Console::WriteLine( "'ServiceInstaller' can't handle the same " + + "kind of installation as 'EventLogInstaller'" ); + } +// + EventLog::Delete( "MyEventLog", "." ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp b/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp new file mode 100644 index 00000000000..3c72773fc05 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Console-EXPANDTABSEX/CPP/expandtabsex.cpp @@ -0,0 +1,66 @@ + + +// This sample takes a given input and replaces each +// occurence of the tab character with 4 space characters. +// It also takes two command-line arguements: input file name, & output file name. +// Usage: +// EXPANDTABS inputfile.txt outputfile.txt +// System.Console.Read +// System.Console.WriteLine +// System.Console.Write +// System.Console.SetIn +// System.Console.SetOut +// System.Console.Error +// System.Console.Out +// +using namespace System; +using namespace System::IO; + +void main() +{ + const int tabSize = 4; + array^args = Environment::GetCommandLineArgs(); + String^ usageText = "Usage: EXPANDTABSEX inputfile.txt outputfile.txt"; + StreamWriter^ writer = nullptr; + + if ( args->Length < 3 ) + { + Console::WriteLine( usageText ); + return; + } + + try + { + writer = gcnew StreamWriter( args[ 2 ] ); + Console::SetOut( writer ); + Console::SetIn( gcnew StreamReader( args[ 1 ] ) ); + } + catch ( IOException^ e ) + { + TextWriter^ errorWriter = Console::Error; + errorWriter->WriteLine( e->Message ); + errorWriter->WriteLine( usageText ); + return; + } + + int i; + while ( (i = Console::Read()) != -1 ) + { + Char c = (Char)i; + if ( c == '\t' ) + Console::Write( ((String^)"")->PadRight( tabSize, ' ' ) ); + else + Console::Write( c ); + } + + writer->Close(); + + // Recover the standard output stream so that a + // completion message can be displayed. + StreamWriter^ standardOutput = gcnew StreamWriter(Console::OpenStandardOutput()); + standardOutput->AutoFlush = true; + Console::SetOut(standardOutput); + Console::WriteLine( "EXPANDTABSEX has completed the processing of {0}.", args[ 0 ] ); + return; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp new file mode 100644 index 00000000000..da26b213429 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Attributes_4/CPP/constructorbuilder_attributes_4.cpp @@ -0,0 +1,155 @@ +// System.Reflection.Emit.ConstructorBuilder.AddDeclarativeSecurity() +// System.Reflection.Emit.ConstructorBuilder.Attributes +// System.Reflection.Emit.ConstructorBuilder.DeclaringType +// System.Reflection.Emit.ConstructorBuilder.DefineParameter() + +/* The following program demonstrates the 'AddDeclarativeSecurity', +'DefineParameter' methods, and 'Attributes', 'DeclaringType' properties +of the ConstructorBuilder class. Create the assembly in the current domain +with dynamic module in the assembly. Constructor builder is used in +conjunction with the 'TypeBuilder' class to create constructor at run time. +Add declarative security to the constructor. Display the 'Attributes', +'DeclaringType' and 'DefineParameter'. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Security::Permissions; +using namespace System::Security; + +public ref class MyConstructorBuilder +{ +private: + Type^ myType1; + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + MyConstructorBuilder() + { + myModuleBuilder = nullptr; + myAssemblyBuilder = nullptr; + +// +// +// + MethodBuilder^ myMethodBuilder = nullptr; + + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + // Create assembly in current CurrentDomain + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + // Create a dynamic assembly + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( + myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + // Create a dynamic module in the assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); + FieldInfo^ myFieldInfo = + myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); + // Create a type in the module + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); + FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", + String::typeid, FieldAttributes::Public ); + array^myConstructorArgs = {String::typeid}; + // Define a constructor of the dynamic class. + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( + MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); + PermissionSet^ myPset = gcnew PermissionSet( PermissionState::Unrestricted ); + // Add declarative security to the constructor. + Console::WriteLine( "Adding declarative security to the constructor....." ); + Console::WriteLine( "The Security action to be taken is \"DENY\" and" + + " Permission set is \"UNRESTRICTED\"." ); + myConstructor->AddDeclarativeSecurity( SecurityAction::Deny, myPset ); +// + MethodAttributes myMethodAttributes = myConstructor->Attributes; + Type^ myAttributeType = MethodAttributes::typeid; + int myAttribValue = (int)myMethodAttributes; + if ( !myAttributeType->IsEnum ) + { + Console::WriteLine( "This is not an Enum" ); + } + array^myFieldInfo1 = myAttributeType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); + Console::WriteLine( "The Field info names of the Attributes for the constructor are:" ); + for ( int i = 0; i < myFieldInfo1->Length; i++ ) + { + int myFieldValue = *dynamic_cast(myFieldInfo1[ i ]->GetValue( nullptr )); + if ( (myFieldValue & myAttribValue) == myFieldValue ) + { + Console::WriteLine( " {0}", myFieldInfo1[ i ]->Name ); + } + } + + Type^ myType2 = myConstructor->DeclaringType; + Console::WriteLine( "The declaring type is : {0}", myType2 ); +// + ParameterBuilder^ myParameterBuilder1 = + myConstructor->DefineParameter( 1, ParameterAttributes::Out, "My Parameter Name1" ); + Console::WriteLine( "The name of the parameter is : {0}", + myParameterBuilder1->Name ); + if ( myParameterBuilder1->IsIn ) + Console::WriteLine( "{0} is Input parameter.", myParameterBuilder1->Name ); + else + Console::WriteLine( "{0} is not Input Parameter.", myParameterBuilder1->Name ); + ParameterBuilder^ myParameterBuilder2 = + myConstructor->DefineParameter( 1, ParameterAttributes::In, "My Parameter Name2" ); + Console::WriteLine( "The Parameter name is : {0}", + myParameterBuilder2->Name ); + if ( myParameterBuilder2->IsIn ) + Console::WriteLine( "{0} is Input parameter.", myParameterBuilder2->Name ); + else + Console::WriteLine( "{0} is not Input Parameter.", myParameterBuilder2->Name ); +// + // Generate MSIL for the method, call its base class constructor and store the arguments + // in the private field. + ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator(); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); + myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + myILGenerator3->Emit( OpCodes::Ldarg_1 ); + myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); + myILGenerator3->Emit( OpCodes::Ret ); + // Add a method to the type. + myMethodBuilder = myTypeBuilder->DefineMethod( + "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); + // Generate MSIL for the method. + ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); + myILGenerator2->EmitWriteLine( "Hello World from global" ); + myILGenerator2->Emit( OpCodes::Ret ); + myModuleBuilder->CreateGlobalFunctions(); + myType1 = myTypeBuilder->CreateType(); + } + property Type^ MyTypeProperty + { + Type^ get() + { + return this->myType1; + } + } +}; +int main() +{ + MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; + Type^ myType1 = myConstructorBuilder->MyTypeProperty; + if ( nullptr != myType1 ) + { + Console::WriteLine( "Instantiating the new type..." ); + array^myObject = {"hello"}; + Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); + MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); + if ( nullptr != myMethodInfo ) + { + Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); + myMethodInfo->Invoke( myObject1, nullptr ); + } + else + { + Console::WriteLine( "Could not locate HelloWorld method" ); + } + } + else + { + Console::WriteLine( "Could not access Type." ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp new file mode 100644 index 00000000000..6bc0d5da26e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_GetModule_4/CPP/constructorbuilder_getmodule_4.cpp @@ -0,0 +1,127 @@ +// System.Reflection.Emit.ConstructorBuilder.GetModule() +// System.Reflection.Emit.ConstructorBuilder.GetToken() +// System.Reflection.Emit.ConstructorBuilder.GetMethodImplementationFlags() +// System.Reflection.Emit.ConstructorBuilder.GetParameters() + +/* The following program demonstrates the 'GetModule','GetToken', +'GetMethodImplementationFlags' and 'GetParameters' +methods of 'ConstructorBuilder' class. Create the assembly +in the current domain with dynamic module in the assembly. Constructor +builder is used in conjunction with the 'TypeBuilder' class to create +constructor at run time. Set a custom attribute using a custom attribute +builder and displays module name, Token id and parameter info of this class. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Security; +using namespace System::Security::Permissions; + +public ref class MyConstructorBuilder +{ +private: + Type^ myType1; + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + MyConstructorBuilder() + { + myModuleBuilder = nullptr; + myAssemblyBuilder = nullptr; +// +// + + MethodBuilder^ myMethodBuilder = nullptr; + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + // Create assembly in current CurrentDomain. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + // Create a dynamic assembly. + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + // Create a dynamic module in the assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); + FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", + String::typeid, FieldAttributes::Public ); + array^myConstructorArgs = {String::typeid}; +// +// + // Define a constructor of the dynamic class. + ConstructorBuilder^ myConstructorBuilder = myTypeBuilder->DefineConstructor( + MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); + // Get a reference to the module that contains this constructor. + Module^ myModule = myConstructorBuilder->GetModule(); + Console::WriteLine( "Module Name : {0}", myModule->Name ); + // Get the 'MethodToken' that represents the token for this constructor. + MethodToken myMethodToken = myConstructorBuilder->GetToken(); + Console::WriteLine( "Constructor Token is : {0}", myMethodToken.Token ); + // Get the method implementation flags for this constructor. + MethodImplAttributes myMethodImplAttributes = myConstructorBuilder->GetMethodImplementationFlags(); + Console::WriteLine( "MethodImplAttributes : {0}", myMethodImplAttributes ); +// +// +// + // Generate IL for the method, call its base class constructor and store the arguments + // in the private field. + ILGenerator^ myILGenerator3 = myConstructorBuilder->GetILGenerator(); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); + myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + myILGenerator3->Emit( OpCodes::Ldarg_1 ); + myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); + myILGenerator3->Emit( OpCodes::Ret ); + // Add a method to the type. + myMethodBuilder = myTypeBuilder->DefineMethod( + "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); + // Generate IL for the method. + ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); + myILGenerator2->EmitWriteLine( "Hello World from global" ); + myILGenerator2->Emit( OpCodes::Ret ); + myModuleBuilder->CreateGlobalFunctions(); + myType1 = myTypeBuilder->CreateType(); + + // Get the parameters of this constructor. + array^myParameterInfo = myConstructorBuilder->GetParameters(); + for ( int i = 0; i < myParameterInfo->Length; i++ ) + { + Console::WriteLine( "Declaration type : {0}", myParameterInfo[ i ]->Member->DeclaringType ); + } +// + } + property Type^ MyTypeProperty + { + Type^ get() + { + return this->myType1; + } + } +}; + +int main() +{ + MyConstructorBuilder^ myConstructorBuilder1 = gcnew MyConstructorBuilder; + Type^ myTypeProperty = myConstructorBuilder1->MyTypeProperty; + if ( nullptr != myTypeProperty ) + { + array^myObject = {"Hello"}; + Object^ myObject1 = Activator::CreateInstance( myTypeProperty, myObject, (Object^) 0 ); + MethodInfo^ myMethodInfo = myTypeProperty->GetMethod( "HelloWorld" ); + + if ( nullptr != myMethodInfo ) + { + myMethodInfo->Invoke( myObject1, nullptr ); + } + else + { + Console::WriteLine( "Could not locate HelloWorld method" ); + } + } + else + { + Console::WriteLine( "Could not access Type." ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp new file mode 100644 index 00000000000..90448fc379b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_Name_5/CPP/constructorbuilder_name_5.cpp @@ -0,0 +1,123 @@ + +// System.Reflection.Emit.ConstructorBuilder +// System.Reflection.Emit.ConstructorBuilder.Name +// System.Reflection.Emit.ConstructorBuilder.ReflectedType +// System.Reflection.Emit.ConstructorBuilder.Signature +// System.Reflection.Emit.ConstructorBuilder.ToString() +/* The following program demonstrates the 'ConstructorBuilder' class, +its 'Name', 'ReflectedType', 'Signature' properties and 'ToString' +method. Create the assembly in the current domain with dynamic module +in the assembly. ConstructorBuilder is used in conjunction with the +'TypeBuilder' class to create constructor at run time. Display the +'Name', 'Signature' and 'ReflectedType' to the console. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +public ref class MyConstructorBuilder +{ +private: + Type^ myType1; + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + MyConstructorBuilder() + { + myModuleBuilder = nullptr; + myAssemblyBuilder = nullptr; + + // + MethodBuilder^ myMethodBuilder = nullptr; + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + + // Create assembly in current CurrentDomain. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Create a dynamic assembly. + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module in the assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); + FieldInfo^ myFieldInfo = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); + FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); + array^myConstructorArgs = {String::typeid}; + + // Define a constructor of the dynamic class. + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); + + // Display the name of the constructor. + Console::WriteLine( "The constructor name is : {0}", myConstructor->Name ); + + // Display the 'Type' object from which this object was obtained. + Console::WriteLine( "The reflected type is : {0}", myConstructor->ReflectedType ); + + // Display the signature of the field. + Console::WriteLine( myConstructor->Signature ); + + // Display the constructor builder instance as a string. + Console::WriteLine( myConstructor ); + // + + // Generate IL for the method, call its superclass constructor and store the arguments + // in the private field. + ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator(); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); + myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + myILGenerator3->Emit( OpCodes::Ldarg_1 ); + myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); + myILGenerator3->Emit( OpCodes::Ret ); + + // Add a method to the type. + myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); + + // Generate IL for the method. + ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); + myILGenerator2->EmitWriteLine( "Hello World from global" ); + myILGenerator2->Emit( OpCodes::Ret ); + myModuleBuilder->CreateGlobalFunctions(); + myType1 = myTypeBuilder->CreateType(); + } + + property Type^ MyTypeProperty + { + Type^ get() + { + return this->myType1; + } + } +}; + +int main() +{ + MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; + Type^ myType1 = myConstructorBuilder->MyTypeProperty; + if ( nullptr != myType1 ) + { + Console::WriteLine( "Instantiating the new type..." ); + array^myObject = {"hello"}; + Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); + MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); + if ( nullptr != myMethodInfo ) + { + Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); + myMethodInfo->Invoke( myObject1, nullptr ); + } + else + { + Console::WriteLine( "Could not locate HelloWorld method" ); + } + } + else + { + Console::WriteLine( "Could not access Type." ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp new file mode 100644 index 00000000000..df97697cd2e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute1/CPP/constructorbuilder_setcustomattribute1.cpp @@ -0,0 +1,91 @@ + +// System::Reflection::Emit::ConstructorBuilder.SetCustomAttribute(CustomAttributeBuilder) +/* + The following program demonstrates the 'SetCustomAttribute(CustomAttributeBuilder)' + method of 'ConstructorBuilder' class. It defines a 'MyAttribute' class which is derived + from 'Attribute' class. It builds a constructor by setting 'MyAttribute' custom attribute + and defines 'Helloworld' type. Then it gets the custom attributes of 'HelloWorld' type + and displays its contents to the console. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute: public Attribute +{ +public: + String^ myString; + int myInteger; + MyAttribute( String^ myString, int myInteger ) + { + this->myString = myString; + this->myInteger = myInteger; + } + +}; + +static Type^ MyCreateCallee( AppDomain^ domain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Define a dynamic assembly in the current application domain-> + AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Define a dynamic module in this assembly-> + ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Construct a 'TypeBuilder' given the name and attributes. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Define a constructor of the dynamic class. + array^type1 = {String::typeid}; + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, type1 ); + ILGenerator^ myILGenerator = myConstructor->GetILGenerator(); + myILGenerator->Emit( OpCodes::Ldstr, "Constructor is invoked" ); + myILGenerator->Emit( OpCodes::Ldarg_1 ); + array^type2 = {String::typeid}; + MethodInfo^ myMethodInfo = Console::typeid->GetMethod( "WriteLine", type2 ); + myILGenerator->Emit( OpCodes::Call, myMethodInfo ); + myILGenerator->Emit( OpCodes::Ret ); + Type^ myType = MyAttribute::typeid; + array^type3 = {String::typeid,int::typeid}; + ConstructorInfo^ myConstructorInfo = myType->GetConstructor( type3 ); + array^obj1 = {"Hello",2}; + CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 ); + try + { + myConstructor->SetCustomAttribute( attributeBuilder ); + } + catch ( ArgumentNullException^ ex ) + { + Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); + } + + return myTypeBuilder->CreateType(); +} + +int main() +{ + Type^ myHelloworld = MyCreateCallee( Thread::GetDomain() ); + array^type1 = {String::typeid}; + ConstructorInfo^ myConstructor = myHelloworld->GetConstructor( type1 ); + array^myAttributes1 = myConstructor->GetCustomAttributes( true ); + Console::WriteLine( "MyAttribute custom attribute contains " ); + for ( int index = 0; index < myAttributes1->Length; index++ ) + { + if ( dynamic_cast(myAttributes1[ index ]) ) + { + Console::WriteLine( "The value of myString is : {0}", (safe_cast(myAttributes1[ index ]))->myString ); + Console::WriteLine( "The value of myInteger is : {0}", (safe_cast(myAttributes1[ index ]))->myInteger ); + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp new file mode 100644 index 00000000000..7c6ae9bf4cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetCustomAttribute2/CPP/constructorbuilder_setcustomattribute2.cpp @@ -0,0 +1,86 @@ + +// System::Reflection::Emit::ConstructorBuilder.SetCustomAttribute(ConstructorInfo, Byte->Item[]) +/* + The following program demonstrates the 'SetCustomAttribute(ConstructorInfo, Byte[])' + method of 'ConstructorBuilder' class. It defines a 'MyAttribute' class which is derived + from 'Attribute' class. It builds a constructor by setting 'MyAttribute' custom attribute + and defines 'Helloworld' type. Then it gets the custom attributes of 'HelloWorld' type + and displays its contents to the console. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute: public Attribute +{ +public: + bool myBoolean; + MyAttribute( bool myBoolean ) + { + this->myBoolean = myBoolean; + } +}; + +static Type^ MyCreateCallee( AppDomain^ domain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Define a dynamic assembly in the current application domain. + AssemblyBuilder^ myAssembly = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Define a dynamic module in this assembly. + ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Construct a 'TypeBuilder' given the name and attributes. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Define a constructor of the dynamic class. + array^type1 = {String::typeid}; + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, type1 ); + ILGenerator^ myILGenerator = myConstructor->GetILGenerator(); + myILGenerator->Emit( OpCodes::Ldstr, "Constructor is invoked" ); + myILGenerator->Emit( OpCodes::Ldarg_1 ); + array^type2 = {String::typeid}; + MethodInfo^ myMethodInfo = Console::typeid->GetMethod( "WriteLine", type2 ); + myILGenerator->Emit( OpCodes::Call, myMethodInfo ); + myILGenerator->Emit( OpCodes::Ret ); + Type^ myType = MyAttribute::typeid; + array^type3 = {bool::typeid}; + ConstructorInfo^ myConstructorInfo = myType->GetConstructor( type3 ); + try + { + array^bytes = {01,00,01}; + myConstructor->SetCustomAttribute( myConstructorInfo, bytes ); + } + catch ( ArgumentNullException^ ex ) + { + Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); + } + + return myTypeBuilder->CreateType(); +} + +int main() +{ + Type^ myHelloworld = MyCreateCallee( Thread::GetDomain() ); + array^type1 = {String::typeid}; + ConstructorInfo^ myConstructor = myHelloworld->GetConstructor( type1 ); + array^myAttributes1 = myConstructor->GetCustomAttributes( true ); + Console::WriteLine( "MyAttribute custom attribute contains " ); + for ( int index = 0; index < myAttributes1->Length; index++ ) + { + if ( dynamic_cast(myAttributes1[ index ]) ) + { + Console::WriteLine( "myBoolean : {0}", safe_cast(myAttributes1[ index ])->myBoolean ); + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp new file mode 100644 index 00000000000..9ff254e4a6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetImplementationFlags/CPP/constructorbuilder_setimplementationflags.cpp @@ -0,0 +1,128 @@ + +// System::Reflection::Emit::ConstructorBuilder.SetImplementationFlags() +/* The following program demonstrates the 'SetImplementationFlags' + method of ConstructorBuilder class. It creates an assembly in the + current domain with a dynamic module in the assembly. Constructor + builder is used in conjunction with the 'TypeBuilder' class to create + constructor at run time. It then sets the method implementation flags + for the constructor and displays the same. +*/ +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +public ref class MyConstructorBuilder +{ +private: + Type^ myType1; + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + MyConstructorBuilder() + { + myModuleBuilder = nullptr; + myAssemblyBuilder = nullptr; + try + { + // + MethodBuilder^ myMethodBuilder = nullptr; + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + + // Create assembly in current CurrentDomain. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Create a dynamic assembly. + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module in the assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true ); + FieldInfo^ myFieldInfo2 = myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); + FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); + array^myConstructorArgs = {String::typeid}; + + // Define a constructor of the dynamic class. + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); + + // Set the method implementation flags for the constructor. + myConstructor->SetImplementationFlags( static_cast(MethodImplAttributes::PreserveSig | MethodImplAttributes::Runtime) ); + + // Get the method implementation flags for the constructor. + MethodImplAttributes myMethodAttributes = myConstructor->GetMethodImplementationFlags(); + Type^ myAttributeType = MethodImplAttributes::typeid; + int myAttribValue = (int)myMethodAttributes; + if ( !myAttributeType->IsEnum ) + { + Console::WriteLine( "This is not an Enum" ); + } + + // Display the field info names of the retrieved method implementation flags. + array^myFieldInfo = myAttributeType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); + Console::WriteLine( "The Field info names of the MethodImplAttributes for the constructor are:" ); + for ( int i = 0; i < myFieldInfo->Length; i++ ) + { + int myFieldValue = *safe_cast(myFieldInfo[ i ]->GetValue( nullptr )); + if ( (myFieldValue & myAttribValue) == myFieldValue ) + { + Console::WriteLine( " {0}", myFieldInfo[ i ]->Name ); + } + } + // + + // Add a method to the type. + myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); + + // Generate IL for the method. + ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); + myILGenerator2->EmitWriteLine( "Hello World from global" ); + myILGenerator2->Emit( OpCodes::Ret ); + myModuleBuilder->CreateGlobalFunctions(); + myType1 = myTypeBuilder->CreateType(); + } + catch ( InvalidOperationException^ ex ) + { + Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "The following exception has occurred : {0}", ex->Message ); + } + } + + property Type^ MyTypeProperty + { + Type^ get() + { + return this->myType1; + } + } +}; + +void main() +{ + MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; + Type^ myType1 = myConstructorBuilder->MyTypeProperty; + if ( nullptr != myType1 ) + { + Console::WriteLine( "Instantiating the new type..." ); + array^myObject = {"hello"}; + Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); + MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); + if ( nullptr != myMethodInfo ) + { + Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); + myMethodInfo->Invoke( myObject1, nullptr ); + } + else + { + Console::WriteLine( "Could not locate HelloWorld method" ); + } + } + else + { + Console::WriteLine( "Could not access Type." ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp new file mode 100644 index 00000000000..16aca594b6f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ConstructorBuilder_SetSymCustomAttribute/CPP/constructorbuilder_setsymcustomattribute.cpp @@ -0,0 +1,106 @@ +// System.Reflection.Emit.ConstructorBuilder.SetSymCustomAttribute() + +/* The following program demonstrates the 'SetSymCustomAttribute' method +of ConstructorBuilder class. It creates an assembly in the current +domain with dynamic module in the assembly. Constructor builder is +used in conjunction with the 'TypeBuilder' class to create constructor +at run time. It then sets this constructor's custom attribute associated +with symbolic information. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class MyConstructorBuilder +{ +private: + Type^ myType1; + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + MyConstructorBuilder() + { + myModuleBuilder = nullptr; + myAssemblyBuilder = nullptr; + +// + MethodBuilder^ myMethodBuilder = nullptr; + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + // Create assembly in current CurrentDomain. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + // Create a dynamic assembly. + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( + myAssemblyName, AssemblyBuilderAccess::Run ); + // Create a dynamic module in the assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", true ); + FieldInfo^ myFieldInfo = + myModuleBuilder->DefineUninitializedData( "myField", 2, FieldAttributes::Public ); + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); + FieldBuilder^ myGreetingField = myTypeBuilder->DefineField( "Greeting", + String::typeid, FieldAttributes::Public ); + array^ myConstructorArgs = {String::typeid}; + // Define a constructor of the dynamic class. + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); + // Display the name of the constructor. + Console::WriteLine( "The constructor name is : {0}", myConstructor->Name ); + array^ temp0 = {01,00,00}; + myConstructor->SetSymCustomAttribute( "MySimAttribute", temp0 ); +// + // Generate the IL for the method and call its superclass constructor. + ILGenerator^ myILGenerator3 = myConstructor->GetILGenerator(); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ myConstructorInfo = Object::typeid->GetConstructor( gcnew array(0) ); + myILGenerator3->Emit( OpCodes::Call, myConstructorInfo ); + myILGenerator3->Emit( OpCodes::Ldarg_0 ); + myILGenerator3->Emit( OpCodes::Ldarg_1 ); + myILGenerator3->Emit( OpCodes::Stfld, myGreetingField ); + myILGenerator3->Emit( OpCodes::Ret ); + // Add a method to the type. + myMethodBuilder = myTypeBuilder->DefineMethod( + "HelloWorld", MethodAttributes::Public, nullptr, nullptr ); + // Generate IL for the method. + ILGenerator^ myILGenerator2 = myMethodBuilder->GetILGenerator(); + myILGenerator2->EmitWriteLine( "Hello World from global" ); + myILGenerator2->Emit( OpCodes::Ret ); + myModuleBuilder->CreateGlobalFunctions(); + myType1 = myTypeBuilder->CreateType(); + } + + property Type^ MyTypeProperty + { + Type^ get() + { + return this->myType1; + } + } +}; + +int main() +{ + MyConstructorBuilder^ myConstructorBuilder = gcnew MyConstructorBuilder; + Type^ myType1 = myConstructorBuilder->MyTypeProperty; + if ( nullptr != myType1 ) + { + Console::WriteLine( "Instantiating the new type..." ); + array^ myObject = {"hello"}; + Object^ myObject1 = Activator::CreateInstance( myType1, myObject, nullptr ); + MethodInfo^ myMethodInfo = myType1->GetMethod( "HelloWorld" ); + if ( nullptr != myMethodInfo ) + { + Console::WriteLine( "Invoking dynamically created HelloWorld method..." ); + myMethodInfo->Invoke( myObject1, nullptr ); + } + else + { + Console::WriteLine( "Could not locate HelloWorld method" ); + } + } + else + { + Console::WriteLine( "Could not access Type." ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp new file mode 100644 index 00000000000..2c6841d495b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_AddRange/CPP/countercreationdatacollection_addrange.cpp @@ -0,0 +1,65 @@ + + +// System::Diagnostics->CounterCreationDataCollection::ctor +// System::Diagnostics->CounterCreationDataCollection->AddRange(CounterCreationDataCollection) +/* +The following program demonstrates 'CounterCreationDataCollection()' constructor and +'AddRange(CounterCreationDataCollection)' method of 'CounterCreationDataCollection' class. +A 'CounterCreationData' Object* is created and added to an instance of 'CounterCreationDataCollection' +class. Then counters in the 'CounterCreationDataCollection' are displayed to the console. +*/ +// +// +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + PerformanceCounter^ myCounter; + try + { + String^ myCategoryName; + int numberOfCounters; + Console::Write( "Enter the number of counters : " ); + numberOfCounters = Int32::Parse( Console::ReadLine() ); + array^myCounterCreationData = gcnew array(numberOfCounters); + for ( int i = 0; i < numberOfCounters; i++ ) + { + Console::Write( "Enter the counter name for {0} counter : ", i ); + myCounterCreationData[ i ] = gcnew CounterCreationData; + myCounterCreationData[ i ]->CounterName = Console::ReadLine(); + } + CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData ); + Console::Write( "Enter the category Name : " ); + myCategoryName = Console::ReadLine(); + + // Check if the category already exists or not. + if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) + { + CounterCreationDataCollection^ myNewCounterCollection = gcnew CounterCreationDataCollection; + + // Add the 'CounterCreationDataCollection' to 'CounterCreationDataCollection' Object*. + myNewCounterCollection->AddRange( myCounterCollection ); + PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myNewCounterCollection ); + for ( int i = 0; i < numberOfCounters; i++ ) + { + myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false ); + + } + Console::WriteLine( "The list of counters in CounterCollection are: " ); + for ( int i = 0; i < myNewCounterCollection->Count; i++ ) + Console::WriteLine( "Counter {0} is '{1}'", i + 1, myNewCounterCollection[ i ]->CounterName ); + } + else + { + Console::WriteLine( "The category already exists" ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}.", e->Message ); + } +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp new file mode 100644 index 00000000000..04c88582196 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Contains/CPP/countercreationdatacollection_contains.cpp @@ -0,0 +1,79 @@ +// System::Diagnostics->CounterCreationDataCollection::Contains(CounterCreationData) +// System::Diagnostics->CounterCreationDataCollection::Remove(CounterCreationData) + +/* +The following program demonstrates 'Contains' and 'Remove' methods of +'CounterCreationDataCollection' class. An instance of 'CounterCreationDataCollection' +is created by passing an array of 'CounterCreationData'. A particular instance of +'CounterCreationData' is removed if it exist in the 'CounterCreationDataCollection'. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + PerformanceCounter^ myCounter; + try + { +// +// + String^ myCategoryName; + int numberOfCounters; + Console::Write( "Enter the category Name :" ); + myCategoryName = Console::ReadLine(); + // Check if the category already exists or not. + if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) + { + Console::Write( "Enter the number of counters : " ); + numberOfCounters = Int32::Parse( Console::ReadLine() ); + array^ myCounterCreationData = + gcnew array(numberOfCounters); + for ( int i = 0; i < numberOfCounters; i++ ) + { + Console::Write( "Enter the counter name for {0} counter : ", i ); + myCounterCreationData[ i ] = gcnew CounterCreationData; + myCounterCreationData[ i ]->CounterName = Console::ReadLine(); + } + CounterCreationDataCollection^ myCounterCollection = + gcnew CounterCreationDataCollection; + // Add the 'CounterCreationData[]' to 'CounterCollection'. + myCounterCollection->AddRange( myCounterCreationData ); + + PerformanceCounterCategory::Create( myCategoryName, + "Sample Category", myCounterCollection ); + + for ( int i = 0; i < numberOfCounters; i++ ) + { + myCounter = gcnew PerformanceCounter( myCategoryName, + myCounterCreationData[ i ]->CounterName, "", false ); + } + if ( myCounterCreationData->Length > 0 ) + { + if ( myCounterCollection->Contains( myCounterCreationData[ 0 ] ) ) + { + myCounterCollection->Remove( myCounterCreationData[ 0 ] ); + Console::WriteLine( "'{0}' counter is removed from the" + + " CounterCreationDataCollection", myCounterCreationData[ 0 ]->CounterName ); + } + } + else + { + Console::WriteLine( "The counters does not exist" ); + } + } + else + { + Console::WriteLine( "The category already exists" ); + } +// +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}.", e->Message ); + return; + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp new file mode 100644 index 00000000000..5af877a5275 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationData/CPP/countercreationdatacollection_ctor.cpp @@ -0,0 +1,66 @@ +// System::Diagnostics->CounterCreationDataCollection->CounterCreationDataCollection(CounterCreationData->Item[]) + +/* +The following program demonstrates 'CounterCreationDataCollection(CounterCreationData->Item[])' +constructor of 'CounterCreationDataCollection' class. +An instance of 'CounterCreationDataCollection' is created by passing an array of +'CounterCreationData' to the constructor. The counters of the 'CounterCreationDataCollection' +are displayed to the console. + +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + PerformanceCounter^ myCounter; + try + { + +// + String^ myCategoryName; + int numberOfCounters; + Console::Write( "Enter the category Name : " ); + myCategoryName = Console::ReadLine(); + + // Check if the category already exists or not. + if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) + { + Console::Write( "Enter the number of counters : " ); + numberOfCounters = Int32::Parse( Console::ReadLine() ); + array^myCounterCreationData = gcnew array(numberOfCounters); + for ( int i = 0; i < numberOfCounters; i++ ) + { + Console::Write( "Enter the counter name for {0} counter : ", i ); + myCounterCreationData[ i ] = gcnew CounterCreationData; + myCounterCreationData[ i ]->CounterName = Console::ReadLine(); + + } + CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData ); + + // Create the category. + PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myCounterCollection ); + for ( int i = 0; i < numberOfCounters; i++ ) + { + myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false ); + + } + Console::WriteLine( "The list of counters in 'CounterCollection' are :" ); + for ( int i = 0; i < myCounterCollection->Count; i++ ) + Console::WriteLine( "Counter {0} is '{1}'", i, myCounterCollection[ i ]->CounterName ); + } + else + { + Console::WriteLine( "The category already exists" ); + } +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}.", e->Message ); + return; + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp new file mode 100644 index 00000000000..d9619066739 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_CounterCreationDataCollection/CPP/countercreationdatacollection_ctor.cpp @@ -0,0 +1,62 @@ + + +// System::Diagnostics->CounterCreationDataCollection->CounterCreationDataCollection(CounterCreationDataCollection) +/* +The following program demonstrates 'CounterCreationDataCollection(CounterCreationDataCollection)' +constructor of 'CounterCreationDataCollection' class. +An instance of 'CounterCreationDataCollection' is created by passing another instance +of 'CounterCreationDataCollection'. The counters of the 'CounterCreationDataCollection' +are displayed to the console. +*/ +#using + +using namespace System; +using namespace System::Diagnostics; +void main() +{ + PerformanceCounter^ myCounter; + try + { +// + String^ myCategoryName; + int numberOfCounters; + Console::Write( "Enter the number of counters : " ); + numberOfCounters = Int32::Parse( Console::ReadLine() ); + array^myCounterCreationData = gcnew array(numberOfCounters); + for ( int i = 0; i < numberOfCounters; i++ ) + { + Console::Write( "Enter the counter name for {0} counter : ", i ); + myCounterCreationData[ i ] = gcnew CounterCreationData; + myCounterCreationData[ i ]->CounterName = Console::ReadLine(); + + } + CounterCreationDataCollection^ myCounterCollection = gcnew CounterCreationDataCollection( myCounterCreationData ); + Console::Write( "Enter the category Name:" ); + myCategoryName = Console::ReadLine(); + + // Check if the category already exists or not. + if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) + { + CounterCreationDataCollection^ myNewCounterCollection = gcnew CounterCreationDataCollection( myCounterCollection ); + PerformanceCounterCategory::Create( myCategoryName, "Sample Category", myNewCounterCollection ); + for ( int i = 0; i < numberOfCounters; i++ ) + { + myCounter = gcnew PerformanceCounter( myCategoryName,myCounterCreationData[ i ]->CounterName,"",false ); + + } + Console::WriteLine( "The list of counters in 'CounterCollection' are : " ); + for ( int i = 0; i < myNewCounterCollection->Count; i++ ) + Console::WriteLine( "Counter {0} is '{1}'", i, myNewCounterCollection[ i ]->CounterName ); + } + else + { + Console::WriteLine( "The category already exists" ); + } +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}.", e->Message ); + return; + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp new file mode 100644 index 00000000000..e4e097db2f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CounterCreationDataCollection_Insert_IndexOf/CPP/countercreationdatacollection_insert_indexof.cpp @@ -0,0 +1,75 @@ +// System::Diagnostics->CounterCreationDataCollection::Insert(int, CounterCreationData) +// System::Diagnostics->CounterCreationDataCollection::IndexOf(CounterCreationData) + +/* +The following program demonstrates 'IndexOf(CounterCreationData)' and 'Insert(int, CounterCreationData)' +methods of 'CounterCreationDataCollection' class. An instance of 'CounterCreationDataCollection' +is created by passing an array of 'CounterCreationData' to the constructor. A counter is inserted +into the 'CounterCreationDataCollection' at specified index. The inserted counter and +its index are displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + PerformanceCounter^ myCounter; + try + { +// +// + String^ myCategoryName; + int numberOfCounters; + Console::Write( "Enter the category Name : " ); + myCategoryName = Console::ReadLine(); + // Check if the category already exists or not. + if ( !PerformanceCounterCategory::Exists( myCategoryName ) ) + { + Console::Write( "Enter the number of counters : " ); + numberOfCounters = Int32::Parse( Console::ReadLine() ); + array^ myCounterCreationData = + gcnew array(numberOfCounters); + + for ( int i = 0; i < numberOfCounters; i++ ) + { + Console::Write( "Enter the counter name for {0} counter ", i ); + myCounterCreationData[ i ] = gcnew CounterCreationData; + myCounterCreationData[ i ]->CounterName = Console::ReadLine(); + } + CounterCreationDataCollection^ myCounterCollection = + gcnew CounterCreationDataCollection( myCounterCreationData ); + CounterCreationData^ myInsertCounterCreationData = gcnew CounterCreationData( + "CounterInsert","",PerformanceCounterType::NumberOfItems32 ); + // Insert an instance of 'CounterCreationData' in the 'CounterCreationDataCollection'. + myCounterCollection->Insert( myCounterCollection->Count - 1, + myInsertCounterCreationData ); + Console::WriteLine( "'{0}' counter is inserted into 'CounterCreationDataCollection'", + myInsertCounterCreationData->CounterName ); + // Create the category. + PerformanceCounterCategory::Create( myCategoryName, "Sample Category", + myCounterCollection ); + + for ( int i = 0; i < numberOfCounters; i++ ) + { + myCounter = gcnew PerformanceCounter( myCategoryName, + myCounterCreationData[ i ]->CounterName, "", false ); + } + Console::WriteLine( "The index of '{0}' counter is {1}", + myInsertCounterCreationData->CounterName, myCounterCollection->IndexOf( myInsertCounterCreationData ) ); + } + else + { + Console::WriteLine( "The category already exists" ); + } +// +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}.", e->Message ); + return; + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp b/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp new file mode 100644 index 00000000000..2fe2f7b3082 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CounterSample_Ctor_2/CPP/countersample_ctor_2.cpp @@ -0,0 +1,69 @@ +// System::Diagnostics->CounterSample->CounterSample(long, long, long, long, long, long, PerformanceCounterType) +// System::Diagnostics->CounterSample->CounterSample(long, long, long, long, long, long, PerformanceCounterType, long) + +/* The following program demonstrates the constructors of the 'CounterSample' +structure. It creates an instance of performance counter, configures it +to interact with 'Processor' category, '% Processor Time' counter and +'0' instance, creates an instance of 'CounterSample', and displays +the corresponding fields. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ +// + PerformanceCounter^ myPerformanceCounter1 = gcnew PerformanceCounter( + "Processor","% Processor Time","0" ); + CounterSample myCounterSample1( 10L, 20L, 30L, 40L, 50L, 60L, + PerformanceCounterType::AverageCount64 ); + Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample1.CounterTimeStamp ); + + Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue ); + Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue ); + Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency ); + Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency ); + Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp ); + Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec ); + Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType ); + // Hold the results of sample. + myCounterSample1 = myPerformanceCounter1->NextSample(); + Console::WriteLine( "BaseValue = {0}", myCounterSample1.BaseValue ); + Console::WriteLine( "RawValue = {0}", myCounterSample1.RawValue ); + Console::WriteLine( "CounterFrequency = {0}", myCounterSample1.CounterFrequency ); + Console::WriteLine( "SystemFrequency = {0}", myCounterSample1.SystemFrequency ); + Console::WriteLine( "TimeStamp = {0}", myCounterSample1.TimeStamp ); + Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample1.TimeStamp100nSec ); + Console::WriteLine( "CounterType = {0}", myCounterSample1.CounterType ); +// + Console::WriteLine( "" ); + Console::WriteLine( "" ); +// + PerformanceCounter^ myPerformanceCounter2 = + gcnew PerformanceCounter( "Processor","% Processor Time","0" ); + CounterSample myCounterSample2( 10L, 20L, 30L, 40L, 50L, 60L, + PerformanceCounterType::AverageCount64,300); + Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp ); + Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue ); + Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue ); + Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency ); + Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency ); + Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp ); + Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec ); + Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType ); + Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp ); + // Hold the results of sample. + myCounterSample2 = myPerformanceCounter2->NextSample(); + Console::WriteLine( "BaseValue = {0}", myCounterSample2.BaseValue ); + Console::WriteLine( "RawValue = {0}", myCounterSample2.RawValue ); + Console::WriteLine( "CounterFrequency = {0}", myCounterSample2.CounterFrequency ); + Console::WriteLine( "SystemFrequency = {0}", myCounterSample2.SystemFrequency ); + Console::WriteLine( "TimeStamp = {0}", myCounterSample2.TimeStamp ); + Console::WriteLine( "TimeStamp100nSec = {0}", myCounterSample2.TimeStamp100nSec ); + Console::WriteLine( "CounterType = {0}", myCounterSample2.CounterType ); + Console::WriteLine( "CounterTimeStamp = {0}", myCounterSample2.CounterTimeStamp ); +// +} diff --git a/snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp new file mode 100644 index 00000000000..515adb362ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CreateInstanceAndUnwrap2/cpp/source.cpp @@ -0,0 +1,36 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Worker : MarshalByRefObject +{ +public: + void PrintDomain() + { + Console::WriteLine("Object is executing in AppDomain \"{0}\"", + AppDomain::CurrentDomain->FriendlyName); + } +}; + +void main() +{ + // Create an ordinary instance in the current AppDomain + Worker^ localWorker = gcnew Worker(); + localWorker->PrintDomain(); + + // Create a new application domain, create an instance + // of Worker in the application domain, and execute code + // there. + AppDomain^ ad = AppDomain::CreateDomain("New domain"); + Worker^ remoteWorker = (Worker^) ad->CreateInstanceAndUnwrap( + Worker::typeid->Assembly->FullName, + "Worker"); + remoteWorker->PrintDomain(); +} + +/* This code produces output similar to the following: + +Object is executing in AppDomain "source.exe" +Object is executing in AppDomain "New domain" + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp new file mode 100644 index 00000000000..99c669d9f27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.File/CPP/fileexample.cpp @@ -0,0 +1,146 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; +using namespace System::Text; + +void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv); +String^ DecryptTextFromFile(String^ path, array^ key, array^ iv); + +int main() +{ + try + { + array^ key; + array^ iv; + + // Create a new TripleDES object to generate a random key + // and initialization vector (IV). + { + TripleDES^ tripleDes; + + try + { + tripleDes = TripleDES::Create(); + key = tripleDes->Key; + iv = tripleDes->IV; + } + finally + { + delete tripleDes; + } + } + + // Create a string to encrypt. + String^ original = "Here is some data to encrypt."; + // The name/path of the file to write. + String^ filename = "CText.enc"; + + // Encrypt the string to a file. + EncryptTextToFile(original, filename, key, iv); + + // Decrypt the file back to a string. + String^ decrypted = DecryptTextFromFile(filename, key, iv); + + // Display the decrypted string to the console. + Console::WriteLine(decrypted); + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv) +{ + FileStream^ fStream = nullptr; + TripleDES^ tripleDes = nullptr; + ICryptoTransform^ encryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create or open the specified file. + fStream = File::Open(path, FileMode::Create); + // Create a new TripleDES object. + tripleDes = TripleDES::Create(); + // Create a TripleDES encryptor from the key and IV + encryptor = tripleDes->CreateEncryptor(key, iv); + // Create a CryptoStream using the FileStream and encryptor + cStream = gcnew CryptoStream(fStream, encryptor, CryptoStreamMode::Write); + + // Convert the provided string to a byte array. + array^ toEncrypt = Encoding::UTF8->GetBytes(text); + + // Write the byte array to the crypto stream. + cStream->Write(toEncrypt, 0, toEncrypt->Length); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (encryptor != nullptr) + delete encryptor; + + if (tripleDes != nullptr) + delete tripleDes; + + if (fStream != nullptr) + delete fStream; + } +} + +String^ DecryptTextFromFile(String^ path, array^ key, array^ iv) +{ + FileStream^ fStream = nullptr; + TripleDES^ tripleDes = nullptr; + ICryptoTransform^ decryptor = nullptr; + CryptoStream^ cStream = nullptr; + StreamReader^ reader = nullptr; + + try + { + // Open the specified file + fStream = File::OpenRead(path); + // Create a new TripleDES object. + tripleDes = TripleDES::Create(); + // Create a TripleDES decryptor from the key and IV + decryptor = tripleDes->CreateDecryptor(key, iv); + // Create a CryptoStream using the FileStream and decryptor + cStream = gcnew CryptoStream(fStream, decryptor, CryptoStreamMode::Read); + // Create a StreamReader to turn the bytes back into text + reader = gcnew StreamReader(cStream, Encoding::UTF8); + + // Read back all of the text from the StreamReader, which receives + // the decrypted bytes from the CryptoStream, which receives the + // encrypted bytes from the FileStream. + return reader->ReadToEnd(); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (decryptor != nullptr) + delete decryptor; + + if (tripleDes != nullptr) + delete tripleDes; + + if (fStream != nullptr) + delete fStream; + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp new file mode 100644 index 00000000000..f1d7dc04657 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.3DES.Create.Memory/CPP/memoryexample.cpp @@ -0,0 +1,170 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +using namespace System::IO; + +array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); +String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); + +int main() +{ + try + { + array^ key; + array^ iv; + + // Create a new TripleDES object to generate a random key + // and initialization vector (IV). + { + TripleDES^ tripleDes; + + try + { + tripleDes = TripleDES::Create(); + key = tripleDes->Key; + iv = tripleDes->IV; + } + finally + { + delete tripleDes; + } + } + + // Create a string to encrypt. + String^ original = "Here is some data to encrypt."; + + // Encrypt the string to an in-memory buffer. + array^ encrypted = EncryptTextToMemory(original, key, iv); + + // Decrypt the buffer back to a string. + String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); + + // Display the decrypted string to the console. + Console::WriteLine(decrypted); + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) +{ + MemoryStream^ mStream = nullptr; + + try + { + // Create a MemoryStream. + mStream = gcnew MemoryStream; + + TripleDES^ tripleDes = nullptr; + ICryptoTransform^ encryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create a new TripleDES object. + tripleDes = TripleDES::Create(); + // Create a TripleDES encryptor from the key and IV + encryptor = tripleDes->CreateEncryptor(key, iv); + // Create a CryptoStream using the MemoryStream and encryptor + cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); + + // Convert the provided string to a byte array. + array^ toEncrypt = Encoding::UTF8->GetBytes(text); + + // Write the byte array to the crypto stream. + cStream->Write(toEncrypt, 0, toEncrypt->Length); + + // Disposing the CryptoStream completes the encryption and flushes the stream. + delete cStream; + + // Get an array of bytes from the MemoryStream that holds the encrypted data. + array^ ret = mStream->ToArray(); + + // Return the encrypted buffer. + return ret; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (encryptor != nullptr) + delete encryptor; + + if (tripleDes != nullptr) + delete tripleDes; + } + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (mStream != nullptr) + delete mStream; + } +} + +String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) +{ + MemoryStream^ mStream = nullptr; + TripleDES^ tripleDes = nullptr; + ICryptoTransform^ decryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create buffer to hold the decrypted data. + // TripleDES-encrypted data will always be slightly bigger than the decrypted data. + array^ decrypted = gcnew array(encrypted->Length); + Int32 offset = 0; + + // Create a new MemoryStream using the provided array of encrypted data. + mStream = gcnew MemoryStream(encrypted); + // Create a new TripleDES object. + tripleDes = TripleDES::Create(); + // Create a TripleDES decryptor from the key and IV + decryptor = tripleDes->CreateDecryptor(key, iv); + // Create a CryptoStream using the MemoryStream and decryptor + cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); + + // Keep reading from the CryptoStream until it finishes (returns 0). + Int32 read = 1; + + while (read > 0) + { + read = cStream->Read(decrypted, offset, decrypted->Length - offset); + offset += read; + } + + // Convert the buffer into a string and return it. + return Encoding::UTF8->GetString(decrypted, 0, offset); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (decryptor != nullptr) + delete decryptor; + + if (tripleDes != nullptr) + delete tripleDes; + + if (mStream != nullptr) + delete mStream; + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp new file mode 100644 index 00000000000..3f109c53866 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.AsnEncodedData/CPP/asnencodeddata.cpp @@ -0,0 +1,90 @@ + +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; + +int main() +{ + + //The following example demonstrates the usage of the AsnEncodedData classes. + // Asn encoded data is read from the extensions of an X509 certificate. + try + { + + // Open the certificate store. + X509Store^ store = gcnew X509Store( L"MY",StoreLocation::CurrentUser ); + store->Open( static_cast(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); + X509Certificate2Collection^ collection = dynamic_cast(store->Certificates); + X509Certificate2Collection^ fcollection = dynamic_cast(collection->Find( X509FindType::FindByTimeValid, DateTime::Now, false )); + + // Select one or more certificates to display extensions information. + X509Certificate2Collection^ scollection = X509Certificate2UI::SelectFromCollection(fcollection, L"Certificate Select",L"Select certificates from the following list to get extension information on that certificate",X509SelectionFlag::MultiSelection); + + // Create a new AsnEncodedDataCollection object. + AsnEncodedDataCollection^ asncoll = gcnew AsnEncodedDataCollection; + for ( int i = 0; i < scollection->Count; i++ ) + { + + // Display certificate information. + Console::ForegroundColor = ConsoleColor::Red; + Console::WriteLine( L"Certificate name: {0}", scollection[i]->GetName() ); + Console::ResetColor(); + + // Display extensions information. + System::Collections::IEnumerator^ myEnum = scollection[i]->Extensions->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + X509Extension^ extension = safe_cast(myEnum->Current); + + // Create an AsnEncodedData object using the extensions information. + AsnEncodedData^ asndata = gcnew AsnEncodedData( extension->Oid,extension->RawData ); + Console::ForegroundColor = ConsoleColor::Green; + Console::WriteLine( L"Extension type: {0}", extension->Oid->FriendlyName ); + Console::WriteLine( L"Oid value: {0}", asndata->Oid->Value ); + Console::WriteLine( L"Raw data length: {0} {1}", asndata->RawData->Length, Environment::NewLine ); + Console::ResetColor(); + Console::WriteLine( asndata->Format(true) ); + Console::WriteLine( Environment::NewLine ); + + // Add the AsnEncodedData object to the AsnEncodedDataCollection object. + asncoll->Add( asndata ); + } + + Console::WriteLine( Environment::NewLine ); + + } + Console::ForegroundColor = ConsoleColor::Red; + Console::WriteLine( L"Number of AsnEncodedData items in the collection: {0} {1}", asncoll->Count, Environment::NewLine ); + Console::ResetColor(); + store->Close(); + + //Create an enumerator for moving through the collection. + AsnEncodedDataEnumerator^ asne = asncoll->GetEnumerator(); + + //You must execute a MoveNext() to get to the first item in the collection. + asne->MoveNext(); + + // Write out AsnEncodedData in the collection. + Console::ForegroundColor = ConsoleColor::Blue; + Console::WriteLine( L"First AsnEncodedData in the collection: {0}", asne->Current->Format(true) ); + Console::ResetColor(); + asne->MoveNext(); + Console::ForegroundColor = ConsoleColor::DarkBlue; + Console::WriteLine( L"Second AsnEncodedData in the collection: {0}", asne->Current->Format(true) ); + Console::ResetColor(); + + //Return index in the collection to the beginning. + asne->Reset(); + } + catch ( CryptographicException^ ) + { + Console::WriteLine( L"Information could not be written out for this certificate." ); + } + + return 1; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp new file mode 100644 index 00000000000..e48f4e14aa9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.File/CPP/fileexample.cpp @@ -0,0 +1,146 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; +using namespace System::Text; + +void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv); +String^ DecryptTextFromFile(String^ path, array^ key, array^ iv); + +int main() +{ + try + { + array^ key; + array^ iv; + + // Create a new DES object to generate a random key + // and initialization vector (IV). + { + DES^ des; + + try + { + des = DES::Create(); + key = des->Key; + iv = des->IV; + } + finally + { + delete des; + } + } + + // Create a string to encrypt. + String^ original = "Here is some data to encrypt."; + // The name/path of the file to write. + String^ filename = "CText.enc"; + + // Encrypt the string to a file. + EncryptTextToFile(original, filename, key, iv); + + // Decrypt the file back to a string. + String^ decrypted = DecryptTextFromFile(filename, key, iv); + + // Display the decrypted string to the console. + Console::WriteLine(decrypted); + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv) +{ + FileStream^ fStream = nullptr; + DES^ des = nullptr; + ICryptoTransform^ encryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create or open the specified file. + fStream = File::Open(path, FileMode::Create); + // Create a new DES object. + des = DES::Create(); + // Create a DES encryptor from the key and IV + encryptor = des->CreateEncryptor(key, iv); + // Create a CryptoStream using the FileStream and encryptor + cStream = gcnew CryptoStream(fStream, encryptor, CryptoStreamMode::Write); + + // Convert the provided string to a byte array. + array^ toEncrypt = Encoding::UTF8->GetBytes(text); + + // Write the byte array to the crypto stream. + cStream->Write(toEncrypt, 0, toEncrypt->Length); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (encryptor != nullptr) + delete encryptor; + + if (des != nullptr) + delete des; + + if (fStream != nullptr) + delete fStream; + } +} + +String^ DecryptTextFromFile(String^ path, array^ key, array^ iv) +{ + FileStream^ fStream = nullptr; + DES^ des = nullptr; + ICryptoTransform^ decryptor = nullptr; + CryptoStream^ cStream = nullptr; + StreamReader^ reader = nullptr; + + try + { + // Open the specified file + fStream = File::OpenRead(path); + // Create a new DES object. + des = DES::Create(); + // Create a DES decryptor from the key and IV + decryptor = des->CreateDecryptor(key, iv); + // Create a CryptoStream using the FileStream and decryptor + cStream = gcnew CryptoStream(fStream, decryptor, CryptoStreamMode::Read); + // Create a StreamReader to turn the bytes back into text + reader = gcnew StreamReader(cStream, Encoding::UTF8); + + // Read back all of the text from the StreamReader, which receives + // the decrypted bytes from the CryptoStream, which receives the + // encrypted bytes from the FileStream. + return reader->ReadToEnd(); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (decryptor != nullptr) + delete decryptor; + + if (des != nullptr) + delete des; + + if (fStream != nullptr) + delete fStream; + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp new file mode 100644 index 00000000000..27a8c01000f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.DES.Create.Memory/CPP/memoryexample.cpp @@ -0,0 +1,170 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +using namespace System::IO; + +array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); +String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); + +int main() +{ + try + { + array^ key; + array^ iv; + + // Create a new DES object to generate a random key + // and initialization vector (IV). + { + DES^ des; + + try + { + des = DES::Create(); + key = des->Key; + iv = des->IV; + } + finally + { + delete des; + } + } + + // Create a string to encrypt. + String^ original = "Here is some data to encrypt."; + + // Encrypt the string to an in-memory buffer. + array^ encrypted = EncryptTextToMemory(original, key, iv); + + // Decrypt the buffer back to a string. + String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); + + // Display the decrypted string to the console. + Console::WriteLine(decrypted); + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) +{ + MemoryStream^ mStream = nullptr; + + try + { + // Create a MemoryStream. + mStream = gcnew MemoryStream; + + DES^ des = nullptr; + ICryptoTransform^ encryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create a new DES object. + des = DES::Create(); + // Create a DES encryptor from the key and IV + encryptor = des->CreateEncryptor(key, iv); + // Create a CryptoStream using the MemoryStream and encryptor + cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); + + // Convert the provided string to a byte array. + array^ toEncrypt = Encoding::UTF8->GetBytes(text); + + // Write the byte array to the crypto stream. + cStream->Write(toEncrypt, 0, toEncrypt->Length); + + // Disposing the CryptoStream completes the encryption and flushes the stream. + delete cStream; + + // Get an array of bytes from the MemoryStream that holds the encrypted data. + array^ ret = mStream->ToArray(); + + // Return the encrypted buffer. + return ret; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (encryptor != nullptr) + delete encryptor; + + if (des != nullptr) + delete des; + } + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (mStream != nullptr) + delete mStream; + } +} + +String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) +{ + MemoryStream^ mStream = nullptr; + DES^ des = nullptr; + ICryptoTransform^ decryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create buffer to hold the decrypted data. + // DES-encrypted data will always be slightly bigger than the decrypted data. + array^ decrypted = gcnew array(encrypted->Length); + Int32 offset = 0; + + // Create a new MemoryStream using the provided array of encrypted data. + mStream = gcnew MemoryStream(encrypted); + // Create a new DES object. + des = DES::Create(); + // Create a DES decryptor from the key and IV + decryptor = des->CreateDecryptor(key, iv); + // Create a CryptoStream using the MemoryStream and decryptor + cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); + + // Keep reading from the CryptoStream until it finishes (returns 0). + Int32 read = 1; + + while (read > 0) + { + read = cStream->Read(decrypted, offset, decrypted->Length - offset); + offset += read; + } + + // Convert the buffer into a string and return it. + return Encoding::UTF8->GetString(decrypted, 0, offset); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (decryptor != nullptr) + delete decryptor; + + if (des != nullptr) + delete des; + + if (mStream != nullptr) + delete mStream; + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp new file mode 100644 index 00000000000..0aeedb91f59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.File/CPP/fileexample.cpp @@ -0,0 +1,113 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +using namespace System::IO; +void EncryptTextToFile( String^ Data, String^ FileName, array^Key, array^IV ) +{ + try + { + + // Create or open the specified file. + FileStream^ fStream = File::Open( FileName, FileMode::OpenOrCreate ); + + // Create a CryptoStream using the FileStream + // and the passed key and initialization vector (IV). + CryptoStream^ cStream = gcnew CryptoStream( fStream,(gcnew DESCryptoServiceProvider)->CreateEncryptor( Key, IV ),CryptoStreamMode::Write ); + + // Create a StreamWriter using the CryptoStream. + StreamWriter^ sWriter = gcnew StreamWriter( cStream ); + + // Write the data to the stream + // to encrypt it. + sWriter->WriteLine( Data ); + + // Close the streams and + // close the file. + sWriter->Close(); + cStream->Close(); + fStream->Close(); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); + } + catch ( UnauthorizedAccessException^ e ) + { + Console::WriteLine( "A file error occurred: {0}", e->Message ); + } + +} + +String^ DecryptTextFromFile( String^ FileName, array^Key, array^IV ) +{ + try + { + + // Create or open the specified file. + FileStream^ fStream = File::Open( FileName, FileMode::OpenOrCreate ); + + // Create a CryptoStream using the FileStream + // and the passed key and initialization vector (IV). + CryptoStream^ cStream = gcnew CryptoStream( fStream,(gcnew DESCryptoServiceProvider)->CreateDecryptor( Key, IV ),CryptoStreamMode::Read ); + + // Create a StreamReader using the CryptoStream. + StreamReader^ sReader = gcnew StreamReader( cStream ); + + // Read the data from the stream + // to decrypt it. + String^ val = sReader->ReadLine(); + + // Close the streams and + // close the file. + sReader->Close(); + cStream->Close(); + fStream->Close(); + + // Return the string. + return val; + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); + return nullptr; + } + catch ( UnauthorizedAccessException^ e ) + { + Console::WriteLine( "A file error occurred: {0}", e->Message ); + return nullptr; + } + +} + +int main() +{ + try + { + + // Create a new DESCryptoServiceProvider object + // to generate a key and initialization vector (IV). + DESCryptoServiceProvider^ DESalg = gcnew DESCryptoServiceProvider; + + // Create a string to encrypt. + String^ sData = "Here is some data to encrypt."; + String^ FileName = "CText.txt"; + + // Encrypt text to a file using the file name, key, and IV. + EncryptTextToFile( sData, FileName, DESalg->Key, DESalg->IV ); + + // Decrypt the text from a file using the file name, key, and IV. + String^ Final = DecryptTextFromFile( FileName, DESalg->Key, DESalg->IV ); + + // Display the decrypted string to the console. + Console::WriteLine( Final ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp new file mode 100644 index 00000000000..3fdcdbcd1dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/CPP/memoryexample.cpp @@ -0,0 +1,105 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +using namespace System::IO; +array^ EncryptTextToMemory( String^ Data, array^Key, array^IV ) +{ + try + { + + // Create a MemoryStream. + MemoryStream^ mStream = gcnew MemoryStream; + + // Create a CryptoStream using the MemoryStream + // and the passed key and initialization vector (IV). + CryptoStream^ cStream = gcnew CryptoStream( mStream,(gcnew DESCryptoServiceProvider)->CreateEncryptor( Key, IV ),CryptoStreamMode::Write ); + + // Convert the passed string to a byte array. + array^toEncrypt = (gcnew ASCIIEncoding)->GetBytes( Data ); + + // Write the byte array to the crypto stream and flush it. + cStream->Write( toEncrypt, 0, toEncrypt->Length ); + cStream->FlushFinalBlock(); + + // Get an array of bytes from the + // MemoryStream that holds the + // encrypted data. + array^ret = mStream->ToArray(); + + // Close the streams. + cStream->Close(); + mStream->Close(); + + // Return the encrypted buffer. + return ret; + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); + return nullptr; + } + +} + +String^ DecryptTextFromMemory( array^Data, array^Key, array^IV ) +{ + try + { + + // Create a new MemoryStream using the passed + // array of encrypted data. + MemoryStream^ msDecrypt = gcnew MemoryStream( Data ); + + // Create a CryptoStream using the MemoryStream + // and the passed key and initialization vector (IV). + CryptoStream^ csDecrypt = gcnew CryptoStream( msDecrypt,(gcnew DESCryptoServiceProvider)->CreateDecryptor( Key, IV ),CryptoStreamMode::Read ); + + // Create buffer to hold the decrypted data. + array^fromEncrypt = gcnew array(Data->Length); + + // Read the decrypted data out of the crypto stream + // and place it into the temporary buffer. + csDecrypt->Read( fromEncrypt, 0, fromEncrypt->Length ); + + //Convert the buffer into a string and return it. + return (gcnew ASCIIEncoding)->GetString( fromEncrypt ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "A Cryptographic error occurred: {0}", e->Message ); + return nullptr; + } + +} + +int main() +{ + try + { + + // Create a new DESCryptoServiceProvider object + // to generate a key and initialization vector (IV). + DESCryptoServiceProvider^ DESalg = gcnew DESCryptoServiceProvider; + + // Create a string to encrypt. + String^ sData = "Here is some data to encrypt."; + + // Encrypt the string to an in-memory buffer. + array^Data = EncryptTextToMemory( sData, DESalg->Key, DESalg->IV ); + + // Decrypt the buffer back to a string. + String^ Final = DecryptTextFromMemory( Data, DESalg->Key, DESalg->IV ); + + // Display the decrypted string to the console. + Console::WriteLine( Final ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp new file mode 100644 index 00000000000..7b3ed1ec455 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.DataProtectionSample/CPP/dataprotectionsample.cpp @@ -0,0 +1,82 @@ +// +#using + +using namespace System; +using namespace System::Security::Cryptography; + +public ref class DataProtectionSample +{ +private: + + // Create byte array for additional entropy when using Protect method. + static array^s_additionalEntropy = {9,8,7,6,5}; + +public: + static void Main() + { + + // Create a simple byte array containing data to be encrypted. + array^secret = {0,1,2,3,4,1,2,3,4}; + + //Encrypt the data. + array^encryptedSecret = Protect( secret ); + Console::WriteLine( "The encrypted byte array is:" ); + PrintValues( encryptedSecret ); + + // Decrypt the data and store in a byte array. + array^originalData = Unprotect( encryptedSecret ); + Console::WriteLine( "{0}The original data is:", Environment::NewLine ); + PrintValues( originalData ); + } + + static array^ Protect( array^data ) + { + try + { + + // Encrypt the data using DataProtectionScope.CurrentUser. The result can be decrypted + // only by the same current user. + return ProtectedData::Protect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "Data was not encrypted. An error occurred." ); + Console::WriteLine( e ); + return nullptr; + } + } + + static array^ Unprotect( array^data ) + { + try + { + + //Decrypt the data using DataProtectionScope.CurrentUser. + return ProtectedData::Unprotect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "Data was not decrypted. An error occurred." ); + Console::WriteLine( e ); + return nullptr; + } + } + + static void PrintValues( array^myArr ) + { + System::Collections::IEnumerator^ myEnum = myArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte i = safe_cast(myEnum->Current); + Console::Write( "\t{0}", i ); + } + + Console::WriteLine(); + } +}; + +int main() +{ + DataProtectionSample::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp new file mode 100644 index 00000000000..8bd6a68686f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.KeyNumber/cpp/sample.cpp @@ -0,0 +1,20 @@ +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Security::Cryptography; + +int main() +{ + // + // Create a new CspParameters object. + CspParameters^ cspParams = gcnew CspParameters(); + + // Specify an exchange key. + cspParams->KeyNumber = (int) KeyNumber::Exchange; + + // Initialize the RSACryptoServiceProvider + // with the CspParameters object. + RSACryptoServiceProvider^ RSACSP = gcnew RSACryptoServiceProvider(cspParams); + // +}; + diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp new file mode 100644 index 00000000000..a3c08414188 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.MemoryProtectionSample/CPP/memoryprotectionsample.cpp @@ -0,0 +1,19 @@ +// +#using + +using namespace System; +using namespace System::Security::Cryptography; + +int main() +{ + + // Create the original data to be encrypted (The data length should be a multiple of 16). + array^secret = {1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4}; + + // Encrypt the data in memory. The result is stored in the same array as the original data. + ProtectedMemory::Protect( secret, MemoryProtectionScope::SameLogon ); + + // Decrypt the data in memory and store in the original array. + ProtectedMemory::Unprotect( secret, MemoryProtectionScope::SameLogon ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp new file mode 100644 index 00000000000..3189ba48a53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.Oid/CPP/cryptography.oid.cpp @@ -0,0 +1,61 @@ + + +// +#using + +using namespace System; +using namespace System::Security::Cryptography; +int main() +{ + + // Assign values to strings. + String^ Value1 = "1.2.840.113549.1.1.1"; + String^ Name1 = "3DES"; + String^ Value2 = "1.3.6.1.4.1.311.20.2"; + String^ InvalidName = "This name is not a valid name"; + String^ InvalidValue = "1.1.1.1.1.1.1.1"; + + // Create new Oid objects using the specified values. + // Note that the corresponding Value or Friendly Name property is automatically added to the object. + Oid ^ o1 = gcnew Oid( Value1 ); + Oid ^ o2 = gcnew Oid( Name1 ); + + // Create a new Oid object using the specified Value and Friendly Name properties. + // Note that the two are not compared to determine if the Value is associated + // with the Friendly Name. + Oid ^ o3 = gcnew Oid( Value2,InvalidName ); + + //Create a new Oid object using the specified Value. Note that if the value + // is invalid or not known, no value is assigned to the Friendly Name property. + Oid ^ o4 = gcnew Oid( InvalidValue ); + + //Write out the property information of the Oid objects. + Console::WriteLine( "Oid1: Automatically assigned Friendly Name: {0}, {1}", o1->FriendlyName, o1->Value ); + Console::WriteLine( "Oid2: Automatically assigned Value: {0}, {1}", o2->FriendlyName, o2->Value ); + Console::WriteLine( "Oid3: Name and Value not compared: {0}, {1}", o3->FriendlyName, o3->Value ); + Console::WriteLine( "Oid4: Invalid Value used: {0}, {1} {2}", o4->FriendlyName, o4->Value, Environment::NewLine ); + + //Create an Oid collection and add several Oid objects. + OidCollection ^ oc = gcnew OidCollection; + oc->Add( o1 ); + oc->Add( o2 ); + oc->Add( o3 ); + Console::WriteLine( "Number of Oids in the collection: {0}", oc->Count ); + Console::WriteLine( "Is synchronized: {0} {1}", oc->IsSynchronized, Environment::NewLine ); + + //Create an enumerator for moving through the collection. + OidEnumerator ^ oe = oc->GetEnumerator(); + + //You must execute a MoveNext() to get to the first item in the collection. + oe->MoveNext(); + + // Write out Oids in the collection. + Console::WriteLine( "First Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value ); + oe->MoveNext(); + Console::WriteLine( "Second Oid in collection: {0},{1}", oe->Current->FriendlyName, oe->Current->Value ); + + //Return index in the collection to the beginning. + oe->Reset(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp new file mode 100644 index 00000000000..06b5a8483db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.PasswordDerivedbytes/cpp/sample.cpp @@ -0,0 +1,100 @@ +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; + +// Generates a random salt value of the specified length. +array^ CreateRandomSalt(int length) +{ + // Create a buffer + array^ randomBytes; + + if (length >= 1) + { + randomBytes = gcnew array (length); + } + else + { + randomBytes = gcnew array (1); + } + + // Create a new RandomNumberGenerator. + RandomNumberGenerator^ randomNumberGenerator = + RandomNumberGenerator::Create(); + + // Fill the buffer with random bytes. + randomNumberGenerator->GetBytes(randomBytes); + + // return the bytes. + return randomBytes; +} + +// Clears the bytes in a buffer so they can't later be read from memory. +void ClearBytes(array^ buffer) +{ + // Check arguments. + if (buffer == nullptr) + { + throw gcnew ArgumentNullException("buffer"); + } + + // Set each byte in the buffer to 0. + for (int x = 0; x <= buffer->Length - 1; x++) + { + buffer[x] = 0; + } +} + +int main(array^ args) +{ + + // Get a password from the user. + Console::WriteLine("Enter a password to produce a key:"); + + // Security Note: Never hard-code a password within your + // source code. Hard-coded passwords can be retrieved + // from a compiled assembly. + array^ password = Encoding::Unicode->GetBytes(Console::ReadLine()); + + array^ randomSalt = CreateRandomSalt(7); + + // Create a TripleDESCryptoServiceProvider object. + TripleDESCryptoServiceProvider^ cryptoDESProvider = + gcnew TripleDESCryptoServiceProvider(); + + try + { + Console::WriteLine("Creating a key with PasswordDeriveBytes..."); + + // Create a PasswordDeriveBytes object and then create + // a TripleDES key from the password and salt. + PasswordDeriveBytes^ passwordDeriveBytes = gcnew PasswordDeriveBytes + (password->ToString(), randomSalt); + + // + // Create the key and set it to the Key property + // of the TripleDESCryptoServiceProvider object. + // This example uses the SHA1 algorithm. + // Due to collision problems with SHA1, Microsoft recommends SHA256 or better. + cryptoDESProvider->Key = passwordDeriveBytes->CryptDeriveKey + ("TripleDES", "SHA1", 192, cryptoDESProvider->IV); + // + Console::WriteLine("Operation complete."); + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + } + finally + { + // Clear the buffers + ClearBytes(password); + ClearBytes(randomSalt); + + // Clear the key. + cryptoDESProvider->Clear(); + } + + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp new file mode 100644 index 00000000000..c6753a5be6f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.File/CPP/fileexample.cpp @@ -0,0 +1,146 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; +using namespace System::Text; + +void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv); +String^ DecryptTextFromFile(String^ path, array^ key, array^ iv); + +int main() +{ + try + { + array^ key; + array^ iv; + + // Create a new RC2 object to generate a random key + // and initialization vector (IV). + { + RC2^ rc2; + + try + { + rc2 = RC2::Create(); + key = rc2->Key; + iv = rc2->IV; + } + finally + { + delete rc2; + } + } + + // Create a string to encrypt. + String^ original = "Here is some data to encrypt."; + // The name/path of the file to write. + String^ filename = "CText.enc"; + + // Encrypt the string to a file. + EncryptTextToFile(original, filename, key, iv); + + // Decrypt the file back to a string. + String^ decrypted = DecryptTextFromFile(filename, key, iv); + + // Display the decrypted string to the console. + Console::WriteLine(decrypted); + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +void EncryptTextToFile(String^ text, String^ path, array^ key, array^ iv) +{ + FileStream^ fStream = nullptr; + RC2^ rc2 = nullptr; + ICryptoTransform^ encryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create or open the specified file. + fStream = File::Open(path, FileMode::Create); + // Create a new RC2 object. + rc2 = RC2::Create(); + // Create an RC2 encryptor from the key and IV + encryptor = rc2->CreateEncryptor(key, iv); + // Create a CryptoStream using the FileStream and encryptor + cStream = gcnew CryptoStream(fStream, encryptor, CryptoStreamMode::Write); + + // Convert the provided string to a byte array. + array^ toEncrypt = Encoding::UTF8->GetBytes(text); + + // Write the byte array to the crypto stream. + cStream->Write(toEncrypt, 0, toEncrypt->Length); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (encryptor != nullptr) + delete encryptor; + + if (rc2 != nullptr) + delete rc2; + + if (fStream != nullptr) + delete fStream; + } +} + +String^ DecryptTextFromFile(String^ path, array^ key, array^ iv) +{ + FileStream^ fStream = nullptr; + RC2^ rc2 = nullptr; + ICryptoTransform^ decryptor = nullptr; + CryptoStream^ cStream = nullptr; + StreamReader^ reader = nullptr; + + try + { + // Open the specified file + fStream = File::OpenRead(path); + // Create a new RC2 object. + rc2 = RC2::Create(); + // Create an RC2 decryptor from the key and IV + decryptor = rc2->CreateDecryptor(key, iv); + // Create a CryptoStream using the FileStream and decryptor + cStream = gcnew CryptoStream(fStream, decryptor, CryptoStreamMode::Read); + // Create a StreamReader to turn the bytes back into text + reader = gcnew StreamReader(cStream, Encoding::UTF8); + + // Read back all of the text from the StreamReader, which receives + // the decrypted bytes from the CryptoStream, which receives the + // encrypted bytes from the FileStream. + return reader->ReadToEnd(); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (decryptor != nullptr) + delete decryptor; + + if (rc2 != nullptr) + delete rc2; + + if (fStream != nullptr) + delete fStream; + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp new file mode 100644 index 00000000000..3179ea1bfc1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/CPP/memoryexample.cpp @@ -0,0 +1,170 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +using namespace System::IO; + +array^ EncryptTextToMemory(String^ text, array^ key, array^ iv); +String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv); + +int main() +{ + try + { + array^ key; + array^ iv; + + // Create a new RC2 object to generate a random key + // and initialization vector (IV). + { + RC2^ rc2; + + try + { + rc2 = RC2::Create(); + key = rc2->Key; + iv = rc2->IV; + } + finally + { + delete rc2; + } + } + + // Create a string to encrypt. + String^ original = "Here is some data to encrypt."; + + // Encrypt the string to an in-memory buffer. + array^ encrypted = EncryptTextToMemory(original, key, iv); + + // Decrypt the buffer back to a string. + String^ decrypted = DecryptTextFromMemory(encrypted, key, iv); + + // Display the decrypted string to the console. + Console::WriteLine(decrypted); + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +array^ EncryptTextToMemory(String^ text, array^ key, array^ iv) +{ + MemoryStream^ mStream = nullptr; + + try + { + // Create a MemoryStream. + mStream = gcnew MemoryStream; + + RC2^ rc2 = nullptr; + ICryptoTransform^ encryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create a new RC2 object. + rc2 = RC2::Create(); + // Create an RC2 encryptor from the key and IV + encryptor = rc2->CreateEncryptor(key, iv); + // Create a CryptoStream using the MemoryStream and encryptor + cStream = gcnew CryptoStream(mStream, encryptor, CryptoStreamMode::Write); + + // Convert the provided string to a byte array. + array^ toEncrypt = Encoding::UTF8->GetBytes(text); + + // Write the byte array to the crypto stream. + cStream->Write(toEncrypt, 0, toEncrypt->Length); + + // Disposing the CryptoStream completes the encryption and flushes the stream. + delete cStream; + + // Get an array of bytes from the MemoryStream that holds the encrypted data. + array^ ret = mStream->ToArray(); + + // Return the encrypted buffer. + return ret; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (encryptor != nullptr) + delete encryptor; + + if (rc2 != nullptr) + delete rc2; + } + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (mStream != nullptr) + delete mStream; + } +} + +String^ DecryptTextFromMemory(array^ encrypted, array^ key, array^ iv) +{ + MemoryStream^ mStream = nullptr; + RC2^ rc2 = nullptr; + ICryptoTransform^ decryptor = nullptr; + CryptoStream^ cStream = nullptr; + + try + { + // Create buffer to hold the decrypted data. + // RC2-encrypted data will always be slightly bigger than the decrypted data. + array^ decrypted = gcnew array(encrypted->Length); + Int32 offset = 0; + + // Create a new MemoryStream using the provided array of encrypted data. + mStream = gcnew MemoryStream(encrypted); + // Create a new RC2 object. + rc2 = RC2::Create(); + // Create an RC2 decryptor from the key and IV + decryptor = rc2->CreateDecryptor(key, iv); + // Create a CryptoStream using the MemoryStream and decryptor + cStream = gcnew CryptoStream(mStream, decryptor, CryptoStreamMode::Read); + + // Keep reading from the CryptoStream until it finishes (returns 0). + Int32 read = 1; + + while (read > 0) + { + read = cStream->Read(decrypted, offset, decrypted->Length - offset); + offset += read; + } + + // Convert the buffer into a string and return it. + return Encoding::UTF8->GetString(decrypted, 0, offset); + } + catch (CryptographicException^ e) + { + Console::WriteLine("A Cryptographic error occurred: {0}", e->Message); + throw; + } + finally + { + if (cStream != nullptr) + delete cStream; + + if (decryptor != nullptr) + delete decryptor; + + if (rc2 != nullptr) + delete rc2; + + if (mStream != nullptr) + delete mStream; + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp new file mode 100644 index 00000000000..2c8834fcc20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/cpp/example.cpp @@ -0,0 +1,57 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Security::Cryptography; + +int main() +{ + array ^ originalBytes = + ASCIIEncoding::ASCII->GetBytes("Here is some data."); + + //Create a new RC2CryptoServiceProvider. + RC2CryptoServiceProvider^ rc2Provider = + gcnew RC2CryptoServiceProvider(); + rc2Provider->UseSalt = true; + + rc2Provider->GenerateKey(); + rc2Provider->GenerateIV(); + + //Encrypt the data. + MemoryStream^ encryptionMemoryStream = gcnew MemoryStream(); + CryptoStream^ encryptionCryptoStream = gcnew CryptoStream( + encryptionMemoryStream, rc2Provider->CreateEncryptor( + rc2Provider->Key, rc2Provider->IV), CryptoStreamMode::Write); + + //Write all data to the crypto stream and flush it. + encryptionCryptoStream->Write(originalBytes, 0, originalBytes->Length); + encryptionCryptoStream->FlushFinalBlock(); + + //Get encrypted array of bytes. + array^ encryptedBytes = encryptionMemoryStream->ToArray(); + + //Decrypt the previously encrypted message. + MemoryStream^ decryptionMemoryStream = + gcnew MemoryStream(encryptedBytes); + CryptoStream^ decryptionCryptoStream = + gcnew CryptoStream(decryptionMemoryStream, + rc2Provider->CreateDecryptor(rc2Provider->Key,rc2Provider->IV), + CryptoStreamMode::Read); + + array^ unencryptedBytes = + gcnew array(originalBytes->Length); + + //Read the data out of the crypto stream. + decryptionCryptoStream->Read(unencryptedBytes, 0, + unencryptedBytes->Length); + + //Convert the byte array back into a string. + String^ plainText = ASCIIEncoding::ASCII->GetString(unencryptedBytes); + + //Display the results. + Console::WriteLine("Unencrypted text: {0}", plainText); + + Console::ReadLine(); +} + +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp new file mode 100644 index 00000000000..97053716b78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.Decrypt/CPP/example.cpp @@ -0,0 +1,52 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +int main() +{ + try + { + + //Create a UnicodeEncoder to convert between byte array and string. + ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; + String^ dataString = "Data to Encrypt"; + + //Create byte arrays to hold original, encrypted, and decrypted data. + array^dataToEncrypt = ByteConverter->GetBytes( dataString ); + array^encryptedData; + array^decryptedData; + + //Create a new instance of the RSACryptoServiceProvider class + // and automatically create a new key-pair. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + + //Display the origianl data to the console. + Console::WriteLine( "Original Data: {0}", dataString ); + + //Encrypt the byte array and specify no OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + encryptedData = RSAalg->Encrypt( dataToEncrypt, false ); + + //Display the encrypted data to the console. + Console::WriteLine( "Encrypted Data: {0}", ByteConverter->GetString( encryptedData ) ); + + //Pass the data to ENCRYPT and boolean flag specifying + //no OAEP padding. + decryptedData = RSAalg->Decrypt( encryptedData, false ); + + //Display the decrypted plaintext to the console. + Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); + } + catch ( CryptographicException^ e ) + { + + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp new file mode 100644 index 00000000000..aac2730c2f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.PersistKey/CPP/example.cpp @@ -0,0 +1,81 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +void RSAPersistKeyInCSP( String^ ContainerName ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider to generate + //a new key pair. Pass the CspParameters class to persist the + //key in the container. The PersistKeyInCsp property is true by + //default, allowing the key to be persisted. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Indicate that the key was persisted. + Console::WriteLine( "The RSA key was persisted in the container, \"{0}\".", ContainerName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +void RSADeleteKeyInCSP( String^ ContainerName ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider. + //Pass the CspParameters class to use the + //key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Explicitly set the PersistKeyInCsp property to false + //to delete the key entry in the container. + RSAalg->PersistKeyInCsp = false; + + //Call Clear to release resources and delete the key from the container. + RSAalg->Clear(); + + //Indicate that the key was persisted. + Console::WriteLine( "The RSA key was deleted from the container, \"{0}\".", ContainerName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +int main() +{ + String^ KeyContainerName = "MyKeyContainer"; + + //Create a new key and persist it in + //the key container. + RSAPersistKeyInCSP( KeyContainerName ); + + //Delete the key from the key container. + RSADeleteKeyInCSP( KeyContainerName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp new file mode 100644 index 00000000000..cea1dc68672 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData1/CPP/example.cpp @@ -0,0 +1,107 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +array^ HashAndSignBytes( array^DataToSign, RSAParameters Key, int Index, int Length ) +{ + try + { + + // Create a new instance of RSACryptoServiceProvider using the + // key from RSAParameters. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + RSAalg->ImportParameters( Key ); + + // Hash and sign the data. Pass a new instance of SHA256 + // to specify the hashing algorithm. + return RSAalg->SignData( DataToSign, Index, Length, SHA256::Create() ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +bool VerifySignedHash( array^DataToVerify, array^SignedData, RSAParameters Key ) +{ + try + { + + // Create a new instance of RSACryptoServiceProvider using the + // key from RSAParameters. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + RSAalg->ImportParameters( Key ); + + // Verify the data using the signature. Pass a new instance of SHA256 + // to specify the hashing algorithm. + return RSAalg->VerifyData( DataToVerify, SHA256::Create(), SignedData ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return false; + } + +} + +int main() +{ + try + { + + // Create a UnicodeEncoder to convert between byte array and string. + ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; + String^ dataString = "Data to Sign"; + + // Create byte arrays to hold original, encrypted, and decrypted data. + array^originalData = ByteConverter->GetBytes( dataString ); + array^signedData; + array^smallArray; + + // Create a new instance of the RSACryptoServiceProvider class + // and automatically create a new key-pair. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + + // Export the key information to an RSAParameters object. + // You must pass true to export the private key for signing. + // However, you do not need to export the private key + // for verification. + RSAParameters Key = RSAalg->ExportParameters( true ); + + // Hash and sign the data. Start at the fifth offset + // only use data from the next 7 bytes. + signedData = HashAndSignBytes( originalData, Key, 5, 7 ); + + // The previous method only signed one segment + // of the array. Create a new array for verification + // that only holds the data that was actually signed. + // + // Initialize the array. + smallArray = gcnew array(7); + + // Copy 7 bytes starting at the 5th index to + // the new array. + Array::Copy( originalData, 5, smallArray, 0, 7 ); + + // Verify the data and display the result to the + // console. + if ( VerifySignedHash( smallArray, signedData, Key ) ) + { + Console::WriteLine( "The data was verified." ); + } + else + { + Console::WriteLine( "The data does not match the signature." ); + } + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "The data was not signed or verified" ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp new file mode 100644 index 00000000000..aa2a389c449 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData2/CPP/example.cpp @@ -0,0 +1,94 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +array^ HashAndSignBytes( array^DataToSign, RSAParameters Key ) +{ + try + { + + // Create a new instance of RSACryptoServiceProvider using the + // key from RSAParameters. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + RSAalg->ImportParameters( Key ); + + // Hash and sign the data. Pass a new instance of SHA256 + // to specify the hashing algorithm. + return RSAalg->SignData( DataToSign, SHA256::Create() ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +bool VerifySignedHash( array^DataToVerify, array^SignedData, RSAParameters Key ) +{ + try + { + + // Create a new instance of RSACryptoServiceProvider using the + // key from RSAParameters. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + RSAalg->ImportParameters( Key ); + + // Verify the data using the signature. Pass a new instance of SHA256 + // to specify the hashing algorithm. + return RSAalg->VerifyData( DataToVerify, SHA256::Create(), SignedData ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return false; + } + +} + +int main() +{ + try + { + + // Create a UnicodeEncoder to convert between byte array and string. + ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; + String^ dataString = "Data to Sign"; + + // Create byte arrays to hold original, encrypted, and decrypted data. + array^originalData = ByteConverter->GetBytes( dataString ); + array^signedData; + + // Create a new instance of the RSACryptoServiceProvider class + // and automatically create a new key-pair. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + + // Export the key information to an RSAParameters object. + // You must pass true to export the private key for signing. + // However, you do not need to export the private key + // for verification. + RSAParameters Key = RSAalg->ExportParameters( true ); + + // Hash and sign the data. + signedData = HashAndSignBytes( originalData, Key ); + + // Verify the data and display the result to the + // console. + if ( VerifySignedHash( originalData, signedData, Key ) ) + { + Console::WriteLine( "The data was verified." ); + } + else + { + Console::WriteLine( "The data does not match the signature." ); + } + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "The data was not signed or verified" ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp new file mode 100644 index 00000000000..ac322898229 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.SignData3/CPP/example.cpp @@ -0,0 +1,110 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +using namespace System::IO; +array^ HashAndSignBytes( Stream^ DataStream, RSAParameters Key ) +{ + try + { + + // Reset the current position in the stream to + // the beginning of the stream (0). RSACryptoServiceProvider + // can't verify the data unless the stream position + // is set to the starting position of the data. + DataStream->Position = 0; + + // Create a new instance of RSACryptoServiceProvider using the + // key from RSAParameters. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + RSAalg->ImportParameters( Key ); + + // Hash and sign the data. Pass a new instance of SHA256 + // to specify the hashing algorithm. + return RSAalg->SignData( DataStream, SHA256::Create() ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +bool VerifySignedHash( array^DataToVerify, array^SignedData, RSAParameters Key ) +{ + try + { + + // Create a new instance of RSACryptoServiceProvider using the + // key from RSAParameters. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + RSAalg->ImportParameters( Key ); + + // Verify the data using the signature. Pass a new instance of SHA256 + // to specify the hashing algorithm. + return RSAalg->VerifyData( DataToVerify, SHA256(), SignedData ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return false; + } + +} + +int main() +{ + try + { + ASCIIEncoding^ ByteConverter = gcnew ASCIIEncoding; + + // Create some bytes to be signed. + array^dataBytes = ByteConverter->GetBytes( "Here is some data to sign!" ); + + // Create a buffer for the memory stream. + array^buffer = gcnew array(dataBytes->Length); + + // Create a MemoryStream. + MemoryStream^ mStream = gcnew MemoryStream( buffer ); + + // Write the bytes to the stream and flush it. + mStream->Write( dataBytes, 0, dataBytes->Length ); + mStream->Flush(); + + // Create a new instance of the RSACryptoServiceProvider class + // and automatically create a new key-pair. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + + // Export the key information to an RSAParameters object. + // You must pass true to export the private key for signing. + // However, you do not need to export the private key + // for verification. + RSAParameters Key = RSAalg->ExportParameters( true ); + + // Hash and sign the data. + array^signedData = HashAndSignBytes( mStream, Key ); + + // Verify the data and display the result to the + // console. + if ( VerifySignedHash( dataBytes, signedData, Key ) ) + { + Console::WriteLine( "The data was verified." ); + } + else + { + Console::WriteLine( "The data does not match the signature." ); + } + + // Close the MemoryStream. + mStream->Close(); + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "The data was not signed or verified" ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp new file mode 100644 index 00000000000..68adc843467 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.UseMachineKey/CPP/example2.cpp @@ -0,0 +1,77 @@ +// +using namespace System; +using namespace System::Security::Cryptography; + +ref class RSAKeyStoreSample +{ +public: + static void Main() + { + // Set the static UseMachineKeyStore property to use the machine key + // store instead of the user profile key store. All CSP instances not + // initialized with CspParameters will use this setting. + RSACryptoServiceProvider::UseMachineKeyStore = true; + try + { + RSACryptoServiceProvider^ RSAalg; + + // This CSP instance will use the Machine Store as set above and is + // initialized with no parameters. + RSAalg = gcnew RSACryptoServiceProvider(); + ShowContainerInfo(RSAalg->CspKeyContainerInfo); + RSAalg->PersistKeyInCsp = false; + delete RSAalg; + + CspParameters^ cspParams = gcnew CspParameters(); + + cspParams->KeyContainerName = "MyKeyContainer"; + + // This CSP instance will use the User Store since cspParams are used. + RSAalg = gcnew RSACryptoServiceProvider(cspParams); + ShowContainerInfo(RSAalg->CspKeyContainerInfo); + RSAalg->PersistKeyInCsp = false; + delete RSAalg; + + cspParams->Flags |= CspProviderFlags::UseMachineKeyStore; + + // This CSP instance will use the Machine Store. Although cspParams are used, + // the cspParams.Flags is set to CspProviderFlags.UseMachineKeyStore. + RSAalg = gcnew RSACryptoServiceProvider(cspParams); + ShowContainerInfo(RSAalg->CspKeyContainerInfo); + RSAalg->PersistKeyInCsp = false; + delete RSAalg; + } + catch (CryptographicException^ e) + { + Console::WriteLine("Exception: {0}", e->GetType()->FullName); + Console::WriteLine(e->Message); + } + } + + static void ShowContainerInfo(CspKeyContainerInfo^ containerInfo) + { + String^ keyStore; + + Console::WriteLine(); + if (containerInfo->MachineKeyStore) + { + keyStore = "Machine Store"; + } + else + { + keyStore = "User Store"; + } + Console::WriteLine("Key Store: {0}", keyStore); + Console::WriteLine("Key Provider: {0}", containerInfo->ProviderName); + Console::WriteLine("Key Container: \"{0}\"", containerInfo->KeyContainerName); + Console::WriteLine("Generated: {0}", containerInfo->RandomlyGenerated); + Console::WriteLine("Key Nubmer: {0}", containerInfo->KeyNumber); + Console::WriteLine("Removable Key: {0}", containerInfo->Removable); + } +}; + +int main() +{ + RSAKeyStoreSample::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp new file mode 100644 index 00000000000..b99a174d918 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-csp/CPP/example.cpp @@ -0,0 +1,174 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +void RSAPersistKeyInCSP( String^ ContainerName ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider to generate + //a new key pair. Pass the CspParameters class to persist the + //key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Indicate that the key was persisted. + Console::WriteLine( "The RSA key was persisted in the container, \"{0}\".", ContainerName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +void RSADeleteKeyInCSP( String^ ContainerName ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider. + //Pass the CspParameters class to use the + //key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Delete the key entry in the container. + RSAalg->PersistKeyInCsp = false; + + //Call Clear to release resources and delete the key from the container. + RSAalg->Clear(); + + //Indicate that the key was persisted. + Console::WriteLine( "The RSA key was deleted from the container, \"{0}\".", ContainerName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +array^ RSAEncrypt( array^DataToEncrypt, String^ ContainerName, bool DoOAEPPadding ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider. + //Pass the CspParameters class to use the key + //from the key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Encrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + return RSAalg->Encrypt( DataToEncrypt, DoOAEPPadding ); + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +array^ RSADecrypt( array^DataToDecrypt, String^ ContainerName, bool DoOAEPPadding ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider. + //Pass the CspParameters class to use the key + //from the key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Decrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + return RSAalg->Decrypt( DataToDecrypt, DoOAEPPadding ); + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e ); + return nullptr; + } + +} + +int main() +{ + try + { + String^ KeyContainerName = "MyKeyContainer"; + + //Create a new key and persist it in + //the key container. + RSAPersistKeyInCSP( KeyContainerName ); + + //Create a UnicodeEncoder to convert between byte array and string. + UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; + + //Create byte arrays to hold original, encrypted, and decrypted data. + array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); + array^encryptedData; + array^decryptedData; + + //Pass the data to ENCRYPT, the name of the key container, + //and a boolean flag specifying no OAEP padding. + encryptedData = RSAEncrypt( dataToEncrypt, KeyContainerName, false ); + + //Pass the data to DECRYPT, the name of the key container, + //and a boolean flag specifying no OAEP padding. + decryptedData = RSADecrypt( encryptedData, KeyContainerName, false ); + + //Display the decrypted plaintext to the console. + Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); + RSADeleteKeyInCSP( KeyContainerName ); + } + catch ( ArgumentNullException^ ) + { + + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( "Encryption failed." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp new file mode 100644 index 00000000000..19f120af03a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-2/CPP/example.cpp @@ -0,0 +1,104 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +array^ RSAEncrypt( array^DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) +{ + try + { + + //Create a new instance of RSACryptoServiceProvider. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + + //Import the RSA Key information. This only needs + //toinclude the public key information. + RSAalg->ImportParameters( RSAKeyInfo ); + + //Encrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + return RSAalg->Encrypt( DataToEncrypt, DoOAEPPadding ); + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +array^ RSADecrypt( array^DataToDecrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) +{ + try + { + + //Create a new instance of RSACryptoServiceProvider. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider; + + //Import the RSA Key information. This needs + //to include the private key information. + RSAalg->ImportParameters( RSAKeyInfo ); + + //Decrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + return RSAalg->Decrypt( DataToDecrypt, DoOAEPPadding ); + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e ); + return nullptr; + } + +} + +int main() +{ + try + { + + //Create a UnicodeEncoder to convert between byte array and string. + UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; + + //Create byte arrays to hold original, encrypted, and decrypted data. + array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); + array^encryptedData; + array^decryptedData; + + //Create a new instance of RSACryptoServiceProvider to generate + //public and private key data. Pass an integer specifying a key- + //length of 2048. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( 2048 ); + + //Display the key-legth to the console. + Console::WriteLine( "A new key pair of legth {0} was created", RSAalg->KeySize ); + + //Pass the data to ENCRYPT, the public key information + //(using RSACryptoServiceProvider.ExportParameters(false), + //and a boolean flag specifying no OAEP padding. + encryptedData = RSAEncrypt( dataToEncrypt, RSAalg->ExportParameters( false ), false ); + + //Pass the data to DECRYPT, the private key information + //(using RSACryptoServiceProvider.ExportParameters(true), + //and a boolean flag specifying no OAEP padding. + decryptedData = RSADecrypt( encryptedData, RSAalg->ExportParameters( true ), false ); + + //Display the decrypted plaintext to the console. + Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); + } + catch ( ArgumentNullException^ ) + { + + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( "Encryption failed." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp new file mode 100644 index 00000000000..f1f072b4665 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RSACSP.ctor-int32-csp/CPP/example.cpp @@ -0,0 +1,175 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +void RSAPersistKeyInCSP( String^ ContainerName ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of RSACryptoServiceProvider to generate + //a new key pair. Pass the CspParameters class to persist the + //key in the container. Pass an intger of 2048 to specify the + //key-size. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( 2048,cspParams ); + + //Indicate that the key was persisted. + Console::WriteLine( "The RSA key with a key-size of {0} was persisted in the container, \"{1}\".", RSAalg->KeySize, ContainerName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +void RSADeleteKeyInCSP( String^ ContainerName ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of DSACryptoServiceProvider. + //Pass the CspParameters class to use the + //key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Delete the key entry in the container. + RSAalg->PersistKeyInCsp = false; + + //Call Clear to release resources and delete the key from the container. + RSAalg->Clear(); + + //Indicate that the key was persisted. + Console::WriteLine( "The RSA key was deleted from the container, \"{0}\".", ContainerName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +array^ RSAEncrypt( array^DataToEncrypt, String^ ContainerName, bool DoOAEPPadding ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of DSACryptoServiceProvider. + //Pass the CspParameters class to use the key + //from the key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Encrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + return RSAalg->Encrypt( DataToEncrypt, DoOAEPPadding ); + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +array^ RSADecrypt( array^DataToDecrypt, String^ ContainerName, bool DoOAEPPadding ) +{ + try + { + + // Create a new instance of CspParameters. Pass + // 13 to specify a DSA container or 1 to specify + // an RSA container. The default is 1. + CspParameters^ cspParams = gcnew CspParameters; + + // Specify the container name using the passed variable. + cspParams->KeyContainerName = ContainerName; + + //Create a new instance of DSACryptoServiceProvider. + //Pass the CspParameters class to use the key + //from the key in the container. + RSACryptoServiceProvider^ RSAalg = gcnew RSACryptoServiceProvider( cspParams ); + + //Decrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + return RSAalg->Decrypt( DataToDecrypt, DoOAEPPadding ); + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e ); + return nullptr; + } + +} + +int main() +{ + try + { + String^ KeyContainerName = "MyKeyContainer"; + + //Create a new key and persist it in + //the key container. + RSAPersistKeyInCSP( KeyContainerName ); + + //Create a UnicodeEncoder to convert between byte array and string. + UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; + + //Create byte arrays to hold original, encrypted, and decrypted data. + array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); + array^encryptedData; + array^decryptedData; + + //Pass the data to ENCRYPT, the name of the key container, + //and a boolean flag specifying no OAEP padding. + encryptedData = RSAEncrypt( dataToEncrypt, KeyContainerName, false ); + + //Pass the data to DECRYPT, the name of the key container, + //and a boolean flag specifying no OAEP padding. + decryptedData = RSADecrypt( encryptedData, KeyContainerName, false ); + + //Display the decrypted plaintext to the console. + Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); + RSADeleteKeyInCSP( KeyContainerName ); + } + catch ( ArgumentNullException^ ) + { + + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( "Encryption failed." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp new file mode 100644 index 00000000000..87f5955ad65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.RsaCryptoServiceProvider.CspKeyContainerInfo/CPP/sample.cpp @@ -0,0 +1,63 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +int main() +{ + RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider; + try + { + + // Note: In cases where a random key is generated, + // a key container is not created until you call + // a method that uses the key. This example calls + // the Encrypt method before calling the + // CspKeyContainerInfo property so that a key + // container is created. + // Create some data to encrypt and display it. + String^ data = L"Here is some data to encrypt."; + Console::WriteLine( L"Data to encrypt: {0}", data ); + + // Convert the data to an array of bytes and + // encrypt it. + array^byteData = Encoding::ASCII->GetBytes( data ); + array^encData = rsa->Encrypt( byteData, false ); + + // Display the encrypted value. + Console::WriteLine( L"Encrypted Data: {0}", Encoding::ASCII->GetString( encData ) ); + Console::WriteLine(); + Console::WriteLine( L"CspKeyContainerInfo information:" ); + Console::WriteLine(); + + // Create a new CspKeyContainerInfo object. + CspKeyContainerInfo^ keyInfo = rsa->CspKeyContainerInfo; + + // Display the value of each property. + Console::WriteLine( L"Accessible property: {0}", keyInfo->Accessible ); + Console::WriteLine( L"Exportable property: {0}", keyInfo->Exportable ); + Console::WriteLine( L"HardwareDevice property: {0}", keyInfo->HardwareDevice ); + Console::WriteLine( L"KeyContainerName property: {0}", keyInfo->KeyContainerName ); + Console::WriteLine( L"KeyNumber property: {0}", keyInfo->KeyNumber ); + Console::WriteLine( L"MachineKeyStore property: {0}", keyInfo->MachineKeyStore ); + Console::WriteLine( L"Protected property: {0}", keyInfo->Protected ); + Console::WriteLine( L"ProviderName property: {0}", keyInfo->ProviderName ); + Console::WriteLine( L"ProviderType property: {0}", keyInfo->ProviderType ); + Console::WriteLine( L"RandomlyGenerated property: {0}", keyInfo->RandomlyGenerated ); + Console::WriteLine( L"Removable property: {0}", keyInfo->Removable ); + Console::WriteLine( L"UniqueKeyContainerName property: {0}", keyInfo->UniqueKeyContainerName ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + finally + { + + // Clear the key. + rsa->Clear(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp new file mode 100644 index 00000000000..ab2873ba3a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.SmartCardCSP/CPP/Cryptography.SmartCardCSP.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::Security::Cryptography; +int main() +{ + + // To idendify the Smart Card CryptoGraphic Providers on your + // computer, use the Microsoft Registry Editor (Regedit.exe). + // The available Smart Card CryptoGraphic Providers are listed + // in HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider. + // Create a new CspParameters object that identifies a + // Smart Card CryptoGraphic Provider. + // The 1st parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider Types. + // The 2nd parameter comes from HKEY_LOCAL_MACHINE\Software\Microsoft\Cryptography\Defaults\Provider. + CspParameters^ csp = gcnew CspParameters( 1,L"Schlumberger Cryptographic Service Provider" ); + csp->Flags = CspProviderFlags::UseDefaultKeyContainer; + + // Initialize an RSACryptoServiceProvider object using + // the CspParameters object. + RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( csp ); + + // Create some data to sign. + array^data = gcnew array{ + 0,1,2,3,4,5,6,7 + }; + Console::WriteLine( L"Data : {0}", BitConverter::ToString( data ) ); + + // Sign the data using the Smart Card CryptoGraphic Provider. + array^sig = rsa->SignData( data, L"SHA256" ); + Console::WriteLine( L"Signature : {0}", BitConverter::ToString( sig ) ); + + // Verify the data using the Smart Card CryptoGraphic Provider. + bool verified = rsa->VerifyData( data, L"SHA256", sig ); + Console::WriteLine( L"Verified : {0}", verified ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp new file mode 100644 index 00000000000..99639f7a588 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import-Export/CPP/sample.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = L"test.pfx"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = gcnew X509Certificate( Certificate ); + array^certData = cert->Export( X509ContentType::Cert ); + X509Certificate^ newCert = gcnew X509Certificate( certData ); + + // Get the value. + String^ resultsTrue = newCert->ToString( true ); + + // Display the value to the console. + Console::WriteLine( resultsTrue ); + + // Get the value. + String^ resultsFalse = newCert->ToString( false ); + + // Display the value to the console. + Console::WriteLine( resultsFalse ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp new file mode 100644 index 00000000000..c67a8cb4a04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate.Import/CPP/sample.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = L"Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = gcnew X509Certificate; + cert->Import(Certificate); + + // Get the value. + String^ resultsTrue = cert->ToString( true ); + + // Display the value to the console. + Console::WriteLine( resultsTrue ); + + // Get the value. + String^ resultsFalse = cert->ToString( false ); + + // Display the value to the console. + Console::WriteLine( resultsFalse ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp new file mode 100644 index 00000000000..d2dab6fe3be --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Certificate/CPP/example.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = L"Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = gcnew X509Certificate( Certificate ); + + // Get the value. + String^ resultsTrue = cert->ToString( true ); + + // Display the value to the console. + Console::WriteLine( resultsTrue ); + + // Get the value. + String^ resultsFalse = cert->ToString( false ); + + // Display the value to the console. + Console::WriteLine( resultsFalse ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp new file mode 100644 index 00000000000..574abf906a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.X509Certificates.X509Extensions/CPP/sample.cpp @@ -0,0 +1,63 @@ + +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + try + { + X509Store^ store = gcnew X509Store( L"MY",StoreLocation::CurrentUser ); + store->Open( static_cast(OpenFlags::ReadOnly | OpenFlags::OpenExistingOnly) ); + X509Certificate2Collection^ collection = dynamic_cast(store->Certificates); + for ( int i = 0; i < collection->Count; i++ ) + { + System::Collections::IEnumerator^ myEnum = collection[ i ]->Extensions->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + X509Extension^ extension = safe_cast(myEnum->Current); + Console::WriteLine( L"{0}({1})", extension->Oid->FriendlyName, extension->Oid->Value ); + if ( extension->Oid->FriendlyName == L"Key Usage" ) + { + X509KeyUsageExtension^ ext = dynamic_cast(extension); + Console::WriteLine( ext->KeyUsages ); + } + if ( extension->Oid->FriendlyName == L"Basic Constraints" ) + { + X509BasicConstraintsExtension^ ext = dynamic_cast(extension); + Console::WriteLine( ext->CertificateAuthority ); + Console::WriteLine( ext->HasPathLengthConstraint ); + Console::WriteLine( ext->PathLengthConstraint ); + } + if ( extension->Oid->FriendlyName == L"Subject Key Identifier" ) + { + X509SubjectKeyIdentifierExtension^ ext = dynamic_cast(extension); + Console::WriteLine( ext->SubjectKeyIdentifier ); + } + if ( extension->Oid->FriendlyName == L"Enhanced Key Usage" ) + { + X509EnhancedKeyUsageExtension^ ext = dynamic_cast(extension); + OidCollection^ oids = ext->EnhancedKeyUsages; + System::Collections::IEnumerator^ myEnum1 = oids->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Oid^ oid = safe_cast(myEnum1->Current); + Console::WriteLine( L"{0}({1})", oid->FriendlyName, oid->Value ); + } + } + } + + } + store->Close(); + } + catch ( CryptographicException^ ) + { + Console::WriteLine( L"Information could not be written out for this certificate." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp new file mode 100644 index 00000000000..c7f4f074317 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.MainXMLEncDecryptDataOOP/CPP/sample.cpp @@ -0,0 +1,207 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; + +ref class TrippleDESDocumentEncryption +{ +protected: + XmlDocument^ docValue; + TripleDES^ algValue; + +public: + TrippleDESDocumentEncryption( XmlDocument^ Doc, TripleDES^ Key ) + { + if ( Doc != nullptr ) + { + docValue = Doc; + } + else + { + throw gcnew ArgumentNullException( L"Doc" ); + } + + if ( Key != nullptr ) + { + algValue = Key; + } + else + { + throw gcnew ArgumentNullException( L"Key" ); + } + } + + + property XmlDocument^ Doc + { + XmlDocument^ get() + { + return docValue; + } + + void set( XmlDocument^ value ) + { + docValue = value; + } + + } + + property TripleDES^ Alg + { + TripleDES^ get() + { + return algValue; + } + + void set( TripleDES^ value ) + { + algValue = value; + } + + } + void Clear() + { + if ( algValue != nullptr ) + { + algValue->Clear(); + } + else + { + throw gcnew Exception( L"No TripleDES key was found to clear." ); + } + } + + void Encrypt( String^ Element ) + { + + // Find the element by name and create a new + // XmlElement object. + XmlElement^ inputElement = dynamic_cast(docValue->GetElementsByTagName( Element )->Item( 0 )); + + // If the element was not found, throw an exception. + if ( inputElement == nullptr ) + { + throw gcnew Exception( L"The element was not found." ); + } + + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml( docValue ); + + // Encrypt the element using the symmetric key. + array^rgbOutput = exml->EncryptData( inputElement, algValue, false ); + + // Create an EncryptedData object and populate it. + EncryptedData^ ed = gcnew EncryptedData; + + // Specify the namespace URI for XML encryption elements. + ed->Type = EncryptedXml::XmlEncElementUrl; + + // Specify the namespace URI for the TrippleDES algorithm. + ed->EncryptionMethod = gcnew EncryptionMethod( EncryptedXml::XmlEncTripleDESUrl ); + + // Create a CipherData element. + ed->CipherData = gcnew CipherData; + + // Set the CipherData element to the value of the encrypted XML element. + ed->CipherData->CipherValue = rgbOutput; + + // Replace the plaintext XML elemnt with an EncryptedData element. + EncryptedXml::ReplaceElement( inputElement, ed, false ); + } + + void Decrypt() + { + + // XmlElement object. + XmlElement^ encryptedElement = dynamic_cast(docValue->GetElementsByTagName( L"EncryptedData" )->Item( 0 )); + + // If the EncryptedData element was not found, throw an exception. + if ( encryptedElement == nullptr ) + { + throw gcnew Exception( L"The EncryptedData element was not found." ); + } + + + // Create an EncryptedData object and populate it. + EncryptedData^ ed = gcnew EncryptedData; + ed->LoadXml( encryptedElement ); + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml; + + // Decrypt the element using the symmetric key. + array^rgbOutput = exml->DecryptData( ed, algValue ); + + // Replace the encryptedData element with the plaintext XML elemnt. + exml->ReplaceData( encryptedElement, rgbOutput ); + } + +}; + +int main() +{ + + // Create an XmlDocument object. + XmlDocument^ xmlDoc = gcnew XmlDocument; + + // Load an XML file into the XmlDocument object. + try + { + xmlDoc->PreserveWhitespace = true; + xmlDoc->Load( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + return 0; + } + + + // Create a new TripleDES key. + TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; + + // Create a new instance of the TrippleDESDocumentEncryption object + // defined in this sample. + TrippleDESDocumentEncryption^ xmlTDES = gcnew TrippleDESDocumentEncryption( xmlDoc,tDESkey ); + try + { + + // Encrypt the "creditcard" element. + xmlTDES->Encrypt( L"creditcard" ); + + // Display the encrypted XML to the console. + Console::WriteLine( L"Encrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlTDES->Doc->OuterXml ); + + // Decrypt the "creditcard" element. + xmlTDES->Decrypt(); + + // Display the encrypted XML to the console. + Console::WriteLine(); + Console::WriteLine( L"Decrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlTDES->Doc->OuterXml ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear the TripleDES key. + xmlTDES->Clear(); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp new file mode 100644 index 00000000000..c1e61870173 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.SignVerifyEnvelope - Specify Element/CPP/sample.cpp @@ -0,0 +1,178 @@ + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. +static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, array^ElementsToSign ) +{ + + // Check the arguments. + if ( FileName == nullptr ) + throw gcnew ArgumentNullException( L"FileName" ); + + if ( SignedFileName == nullptr ) + throw gcnew ArgumentNullException( L"SignedFileName" ); + + if ( Key == nullptr ) + throw gcnew ArgumentNullException( L"Key" ); + + if ( ElementsToSign == nullptr ) + throw gcnew ArgumentNullException( L"ElementsToSign" ); + + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Loop through each passed element to sign + // and create a reference. + System::Collections::IEnumerator^ myEnum = ElementsToSign->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ s = safe_cast(myEnum->Current); + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = s; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + } + + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( dynamic_cast(doc->FirstChild) ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +static Boolean VerifyXmlFile( String^ Name ) +{ + + // Check the arguments. + if ( Name == nullptr ) + throw gcnew ArgumentNullException( L"Name" ); + + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + +int main() +{ + + // Generate a signing key. + RSA^ Key = RSA::Create(); + try + { + + // Specify an element to sign. + array^elements = {L"#tag1"}; + + // Sign an XML file and save the signature to a + // new file. + SignXmlFile( L"Test.xml", L"SignedExample.xml", Key, elements ); + Console::WriteLine( L"XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( L"Verifying signature..." ); + bool result = VerifyXmlFile( L"SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( L"The XML signature is valid." ); + } + else + { + Console::WriteLine( L"The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear resources associated with the + // RSA instance. + Key->Clear(); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp new file mode 100644 index 00000000000..cdae3dcaebf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.Signature - Envelope/CPP/sample.cpp @@ -0,0 +1,169 @@ + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. +static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) +{ + + // Check the arguments. + if ( FileName == nullptr ) + throw gcnew ArgumentNullException( L"FileName" ); + + if ( SignedFileName == nullptr ) + throw gcnew ArgumentNullException( L"SignedFileName" ); + + if ( Key == nullptr ) + throw gcnew ArgumentNullException( L"Key" ); + + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Get the signature object from the SignedXml object. + Signature^ XMLSignature = signedXml->Signature; + + // Create a reference to be signed. Pass "" + // to specify that all of the current XML + // document should be signed. + Reference^ reference = gcnew Reference( L"" ); + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the Reference object to the Signature object. + XMLSignature->SignedInfo->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); + + // Add the KeyInfo object to the Reference object. + XMLSignature->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( dynamic_cast(doc->FirstChild) ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +static Boolean VerifyXmlFile( String^ Name ) +{ + + // Check the arguments. + if ( Name == nullptr ) + throw gcnew ArgumentNullException( L"Name" ); + + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + +int main() +{ + + // Generate a signing key. + RSA^ Key = RSA::Create(); + try + { + + // Sign an XML file and save the signature to a + // new file. + SignXmlFile( L"Test.xml", L"SignedExample.xml", Key ); + Console::WriteLine( L"XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( L"Verifying signature..." ); + bool result = VerifyXmlFile( L"SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( L"The XML signature is valid." ); + } + else + { + Console::WriteLine( L"The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear resources associated with the + // RSA instance. + Key->Clear(); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp new file mode 100644 index 00000000000..97cfce97aee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncImbedKey/CPP/sample.cpp @@ -0,0 +1,179 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, RSA^ Alg, String^ KeyName ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( ElementToEncrypt == nullptr ) + throw gcnew ArgumentNullException( L"ElementToEncrypt" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + + //////////////////////////////////////////////// + // Find the specified element in the XmlDocument + // object and create a new XmlElemnt object. + //////////////////////////////////////////////// + XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); + + // Throw an XmlException if the element was not found. + if ( elementToEncrypt == nullptr ) + { + throw gcnew XmlException( L"The specified element was not found" ); + } + + + ////////////////////////////////////////////////// + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the + // a new random symmetric key. + ////////////////////////////////////////////////// + // Create a 256 bit Aes key. + Aes^ sessionKey = Aes::Create(); + sessionKey->KeySize = 256; + EncryptedXml^ eXml = gcnew EncryptedXml; + array^encryptedElement = eXml->EncryptData( elementToEncrypt, sessionKey, false ); + + //////////////////////////////////////////////// + // Construct an EncryptedData object and populate + // it with the desired encryption information. + //////////////////////////////////////////////// + EncryptedData^ edElement = gcnew EncryptedData; + edElement->Type = EncryptedXml::XmlEncElementUrl; + + // Create an EncryptionMethod element so that the + // receiver knows which algorithm to use for decryption. + edElement->EncryptionMethod = gcnew EncryptionMethod( EncryptedXml::XmlEncAES256Url ); + + // Encrypt the session key and add it to an EncryptedKey element. + EncryptedKey^ ek = gcnew EncryptedKey; + array^encryptedKey = EncryptedXml::EncryptKey( sessionKey->Key, Alg, false ); + ek->CipherData = gcnew CipherData( encryptedKey ); + ek->EncryptionMethod = gcnew EncryptionMethod( EncryptedXml::XmlEncRSA15Url ); + + // Set the KeyInfo element to specify the + // name of the RSA key. + // Create a new KeyInfo element. + edElement->KeyInfo = gcnew KeyInfo; + + // Create a new KeyInfoName element. + KeyInfoName^ kin = gcnew KeyInfoName; + + // Specify a name for the key. + kin->Value = KeyName; + + // Add the KeyInfoName element to the + // EncryptedKey object. + ek->KeyInfo->AddClause( kin ); + + // Add the encrypted key to the + // EncryptedData object. + edElement->KeyInfo->AddClause( gcnew KeyInfoEncryptedKey( ek ) ); + + // Add the encrypted element data to the + // EncryptedData object. + edElement->CipherData->CipherValue = encryptedElement; + + //////////////////////////////////////////////////// + // Replace the element from the original XmlDocument + // object with the EncryptedData element. + //////////////////////////////////////////////////// + EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); +} + +static void Decrypt( XmlDocument^ Doc, RSA^ Alg, String^ KeyName ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + if ( KeyName == nullptr ) + throw gcnew ArgumentNullException( L"KeyName" ); + + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml( Doc ); + + // Add a key-name mapping. + // This method can only decrypt documents + // that present the specified key name. + exml->AddKeyNameMapping( KeyName, Alg ); + + // Decrypt the element. + exml->DecryptDocument(); +} + +int main() +{ + + // Create an XmlDocument object. + XmlDocument^ xmlDoc = gcnew XmlDocument; + + // Load an XML file into the XmlDocument object. + try + { + xmlDoc->PreserveWhitespace = true; + xmlDoc->Load( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + return 0; + } + + + // Create a new RSA key. This key will encrypt a symmetric key, + // which will then be imbedded in the XML document. + RSA^ rsaKey = RSA::Create(); + try + { + + // Encrypt the "creditcard" element. + Encrypt( xmlDoc, L"creditcard", rsaKey, L"rsaKey" ); + + // Display the encrypted XML to the console. + Console::WriteLine( L"Encrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + xmlDoc->Save( L"test.xml" ); + + // Decrypt the "creditcard" element. + Decrypt( xmlDoc, rsaKey, L"rsaKey" ); + + // Display the encrypted XML to the console. + Console::WriteLine(); + Console::WriteLine( L"Decrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + xmlDoc->Save( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear the RSA key. + rsaKey->Clear(); + } + + return 1; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp new file mode 100644 index 00000000000..3856ce1b7b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKey/CPP/Cryptography.XML.XMLEncMapKey.cpp @@ -0,0 +1,200 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, SymmetricAlgorithm^ Alg, String^ KeyName ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( ElementToEncrypt == nullptr ) + throw gcnew ArgumentNullException( L"ElementToEncrypt" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + + //////////////////////////////////////////////// + // Find the specified element in the XmlDocument + // object and create a new XmlElemnt object. + //////////////////////////////////////////////// + XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); + + // Throw an XmlException if the element was not found. + if ( elementToEncrypt == nullptr ) + { + throw gcnew XmlException( L"The specified element was not found" ); + } + + + ////////////////////////////////////////////////// + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the + // symmetric key. + ////////////////////////////////////////////////// + EncryptedXml^ eXml = gcnew EncryptedXml; + array^encryptedElement = eXml->EncryptData( elementToEncrypt, Alg, false ); + + //////////////////////////////////////////////// + // Construct an EncryptedData object and populate + // it with the desired encryption information. + //////////////////////////////////////////////// + EncryptedData^ edElement = gcnew EncryptedData; + edElement->Type = EncryptedXml::XmlEncElementUrl; + + // Create an EncryptionMethod element so that the + // receiver knows which algorithm to use for decryption. + // Determine what kind of algorithm is being used and + // supply the appropriate URL to the EncryptionMethod element. + String^ encryptionMethod = nullptr; + if ( dynamic_cast(Alg) ) + { + encryptionMethod = EncryptedXml::XmlEncTripleDESUrl; + } + else + if ( dynamic_cast(Alg) ) + { + encryptionMethod = EncryptedXml::XmlEncDESUrl; + } + else + if ( dynamic_cast(Alg) ) + { + switch ( Alg->KeySize ) + { + case 128: + encryptionMethod = EncryptedXml::XmlEncAES128Url; + break; + + case 192: + encryptionMethod = EncryptedXml::XmlEncAES192Url; + break; + + case 256: + encryptionMethod = EncryptedXml::XmlEncAES256Url; + break; + } + } + else + { + + // Throw an exception if the transform is not in the previous categories + throw gcnew CryptographicException( L"The specified algorithm is not supported for XML Encryption." ); + } + + + + edElement->EncryptionMethod = gcnew EncryptionMethod( encryptionMethod ); + + // Set the KeyInfo element to specify the + // name of a key. + // Create a new KeyInfo element. + edElement->KeyInfo = gcnew KeyInfo; + + // Create a new KeyInfoName element. + KeyInfoName^ kin = gcnew KeyInfoName; + + // Specify a name for the key. + kin->Value = KeyName; + + // Add the KeyInfoName element. + edElement->KeyInfo->AddClause( kin ); + + // Add the encrypted element data to the + // EncryptedData object. + edElement->CipherData->CipherValue = encryptedElement; + + //////////////////////////////////////////////////// + // Replace the element from the original XmlDocument + // object with the EncryptedData element. + //////////////////////////////////////////////////// + EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); +} + +static void Decrypt( XmlDocument^ Doc, SymmetricAlgorithm^ Alg, String^ KeyName ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + if ( KeyName == nullptr ) + throw gcnew ArgumentNullException( L"KeyName" ); + + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml( Doc ); + + // Add a key-name mapping. + // This method can only decrypt documents + // that present the specified key name. + exml->AddKeyNameMapping( KeyName, Alg ); + + // Decrypt the element. + exml->DecryptDocument(); +} + +int main() +{ + + // Create an XmlDocument object. + XmlDocument^ xmlDoc = gcnew XmlDocument; + + // Load an XML file into the XmlDocument object. + try + { + xmlDoc->PreserveWhitespace = true; + xmlDoc->Load( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + return 0; + } + + + // Create a new TripleDES key. + TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; + try + { + + // Encrypt the "creditcard" element. + Encrypt( xmlDoc, L"creditcard", tDESkey, L"tDESKey" ); + + // Display the encrypted XML to the console. + Console::WriteLine( L"Encrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + + // Decrypt the "creditcard" element. + Decrypt( xmlDoc, tDESkey, L"tDESKey" ); + + // Display the encrypted XML to the console. + Console::WriteLine(); + Console::WriteLine( L"Decrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear the TripleDES key. + tDESkey->Clear(); + } + return 1; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp new file mode 100644 index 00000000000..0ed4e81288a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMapKeyX509/CPP/Cryptography.XML.XMLEncMapKeyX509.cpp @@ -0,0 +1,133 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Security::Cryptography::X509Certificates; +static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, X509Certificate2^ Cert ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( ElementToEncrypt == nullptr ) + throw gcnew ArgumentNullException( L"ElementToEncrypt" ); + + if ( Cert == nullptr ) + throw gcnew ArgumentNullException( L"Cert" ); + + + //////////////////////////////////////////////// + // Find the specified element in the XmlDocument + // object and create a new XmlElemnt object. + //////////////////////////////////////////////// + XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); + + // Throw an XmlException if the element was not found. + if ( elementToEncrypt == nullptr ) + { + throw gcnew XmlException( L"The specified element was not found" ); + } + + + ////////////////////////////////////////////////// + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the + // X.509 Certificate. + ////////////////////////////////////////////////// + EncryptedXml^ eXml = gcnew EncryptedXml; + + // Encrypt the element. + EncryptedData^ edElement = eXml->Encrypt( elementToEncrypt, Cert ); + + //////////////////////////////////////////////////// + // Replace the element from the original XmlDocument + // object with the EncryptedData element. + //////////////////////////////////////////////////// + EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); +} + +static void Decrypt( XmlDocument^ Doc ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml( Doc ); + + // Decrypt the XML document. + exml->DecryptDocument(); +} + +int main() +{ + + // Create an XmlDocument object. + XmlDocument^ xmlDoc = gcnew XmlDocument; + + // Load an XML file into the XmlDocument object. + try + { + xmlDoc->PreserveWhitespace = true; + xmlDoc->Load( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + return 0; + } + + + // Create a new X509Certificate2 object by loading + // an X.509 certificate file. To use XML encryption + // with an X.509 certificate, use an X509Certificate2 + // object to encrypt, but use a certificate in a certificate + // store to decrypt. + // You can create a new test certificate file using the + // makecert.exe tool. + // Create an X509Certificate2 object for encryption. + X509Certificate2^ cert = gcnew X509Certificate2( L"test.pfx" ); + + // Put the certificate in certificate store for decryption. + X509Store^ store = gcnew X509Store( StoreLocation::CurrentUser ); + store->Open( OpenFlags::ReadWrite ); + store->Add( cert ); + store->Close(); + try + { + + // Encrypt the "creditcard" element. + Encrypt( xmlDoc, L"creditcard", cert ); + + // Display the encrypted XML to the console. + Console::WriteLine( L"Encrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + + // Decrypt the "creditcard" element. + Decrypt( xmlDoc ); + + // Display the encrypted XML to the console. + Console::WriteLine(); + Console::WriteLine( L"Decrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp new file mode 100644 index 00000000000..c8b0ef17967 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecrypt/CPP/Cryptography.XML.XMLEncMinimalDecrypt.cpp @@ -0,0 +1,135 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, SymmetricAlgorithm^ Alg, String^ KeyName ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( ElementToEncrypt == nullptr ) + throw gcnew ArgumentNullException( L"ElementToEncrypt" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + + //////////////////////////////////////////////// + // Find the specified element in the XmlDocument + // object and create a new XmlElemnt object. + //////////////////////////////////////////////// + XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); + + // Throw an XmlException if the element was not found. + if ( elementToEncrypt == nullptr ) + { + throw gcnew XmlException( L"The specified element was not found" ); + } + + + ////////////////////////////////////////////////// + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the + // symmetric key. + ////////////////////////////////////////////////// + EncryptedXml^ eXml = gcnew EncryptedXml; + + // Add the key mapping. + eXml->AddKeyNameMapping( KeyName, Alg ); + + // Encrypt the element. + EncryptedData^ edElement = eXml->Encrypt( elementToEncrypt, KeyName ); + + //////////////////////////////////////////////////// + // Replace the element from the original XmlDocument + // object with the EncryptedData element. + //////////////////////////////////////////////////// + EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); +} + +static void Decrypt( XmlDocument^ Doc, SymmetricAlgorithm^ Alg, String^ KeyName ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + if ( KeyName == nullptr ) + throw gcnew ArgumentNullException( L"KeyName" ); + + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml( Doc ); + + // Add the key name mapping. + exml->AddKeyNameMapping( KeyName, Alg ); + + // Decrypt the XML document. + exml->DecryptDocument(); +} + +int main() +{ + + // Create an XmlDocument object. + XmlDocument^ xmlDoc = gcnew XmlDocument; + + // Load an XML file into the XmlDocument object. + try + { + xmlDoc->PreserveWhitespace = true; + xmlDoc->Load( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + + + // Create a new TripleDES key. + TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; + try + { + + // Encrypt the "creditcard" element. + Encrypt( xmlDoc, L"creditcard", tDESkey, L"tDesKey" ); + + // Display the encrypted XML to the console. + Console::WriteLine( L"Encrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + + // Decrypt the "creditcard" element. + Decrypt( xmlDoc, tDESkey, L"tDesKey" ); + + // Display the encrypted XML to the console. + Console::WriteLine(); + Console::WriteLine( L"Decrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear the TripleDES key. + tDESkey->Clear(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp new file mode 100644 index 00000000000..ae795778f31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XMLEncMinimalDecryptData/CPP/Cryptography.XML.XMLEncMinimalDecryptData.cpp @@ -0,0 +1,196 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +static void Encrypt( XmlDocument^ Doc, String^ ElementToEncrypt, SymmetricAlgorithm^ Alg ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( ElementToEncrypt == nullptr ) + throw gcnew ArgumentNullException( L"ElementToEncrypt" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + + //////////////////////////////////////////////// + // Find the specified element in the XmlDocument + // object and create a new XmlElemnt object. + //////////////////////////////////////////////// + XmlElement^ elementToEncrypt = dynamic_cast(Doc->GetElementsByTagName( ElementToEncrypt )->Item( 0 )); + + // Throw an XmlException if the element was not found. + if ( elementToEncrypt == nullptr ) + { + throw gcnew XmlException( L"The specified element was not found" ); + } + + + ////////////////////////////////////////////////// + // Create a new instance of the EncryptedXml class + // and use it to encrypt the XmlElement with the + // symmetric key. + ////////////////////////////////////////////////// + EncryptedXml^ eXml = gcnew EncryptedXml; + array^encryptedElement = eXml->EncryptData( elementToEncrypt, Alg, false ); + + //////////////////////////////////////////////// + // Construct an EncryptedData object and populate + // it with the desired encryption information. + //////////////////////////////////////////////// + EncryptedData^ edElement = gcnew EncryptedData; + edElement->Type = EncryptedXml::XmlEncElementUrl; + + // Create an EncryptionMethod element so that the + // receiver knows which algorithm to use for decryption. + // Determine what kind of algorithm is being used and + // supply the appropriate URL to the EncryptionMethod element. + String^ encryptionMethod = nullptr; + if ( dynamic_cast(Alg) ) + { + encryptionMethod = EncryptedXml::XmlEncTripleDESUrl; + } + else + if ( dynamic_cast(Alg) ) + { + encryptionMethod = EncryptedXml::XmlEncDESUrl; + } + else + if ( dynamic_cast(Alg) ) + { + switch ( Alg->KeySize ) + { + case 128: + encryptionMethod = EncryptedXml::XmlEncAES128Url; + break; + + case 192: + encryptionMethod = EncryptedXml::XmlEncAES192Url; + break; + + case 256: + encryptionMethod = EncryptedXml::XmlEncAES256Url; + break; + } + } + else + { + + // Throw an exception if the transform is not in the previous categories + throw gcnew CryptographicException( L"The specified algorithm is not supported for XML Encryption." ); + } + + + + edElement->EncryptionMethod = gcnew EncryptionMethod( encryptionMethod ); + + // Add the encrypted element data to the + // EncryptedData object. + edElement->CipherData->CipherValue = encryptedElement; + + //////////////////////////////////////////////////// + // Replace the element from the original XmlDocument + // object with the EncryptedData element. + //////////////////////////////////////////////////// + EncryptedXml::ReplaceElement( elementToEncrypt, edElement, false ); +} + +static void Decrypt( XmlDocument^ Doc, SymmetricAlgorithm^ Alg ) +{ + + // Check the arguments. + if ( Doc == nullptr ) + throw gcnew ArgumentNullException( L"Doc" ); + + if ( Alg == nullptr ) + throw gcnew ArgumentNullException( L"Alg" ); + + + // Find the EncryptedData element in the XmlDocument. + XmlElement^ encryptedElement = dynamic_cast(Doc->GetElementsByTagName( L"EncryptedData" )->Item( 0 )); + + // If the EncryptedData element was not found, throw an exception. + if ( encryptedElement == nullptr ) + { + throw gcnew XmlException( L"The EncryptedData element was not found." ); + } + + + // Create an EncryptedData object and populate it. + EncryptedData^ edElement = gcnew EncryptedData; + edElement->LoadXml( encryptedElement ); + + // Create a new EncryptedXml object. + EncryptedXml^ exml = gcnew EncryptedXml; + + // Decrypt the element using the symmetric key. + array^rgbOutput = exml->DecryptData( edElement, Alg ); + + // Replace the encryptedData element with the plaintext XML element. + exml->ReplaceData( encryptedElement, rgbOutput ); +} + +int main() +{ + + // Create an XmlDocument object. + XmlDocument^ xmlDoc = gcnew XmlDocument; + + // Load an XML file into the XmlDocument object. + try + { + xmlDoc->PreserveWhitespace = true; + xmlDoc->Load( L"test.xml" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + return 0; + } + + + // Create a new TripleDES key. + TripleDESCryptoServiceProvider^ tDESkey = gcnew TripleDESCryptoServiceProvider; + try + { + + // Encrypt the "creditcard" element. + Encrypt( xmlDoc, L"creditcard", tDESkey ); + + // Display the encrypted XML to the console. + Console::WriteLine( L"Encrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + + // Decrypt the "creditcard" element. + Decrypt( xmlDoc, tDESkey ); + + // Display the encrypted XML to the console. + Console::WriteLine(); + Console::WriteLine( L"Decrypted XML:" ); + Console::WriteLine(); + Console::WriteLine( xmlDoc->OuterXml ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + + // Clear the TripleDES key. + tDESkey->Clear(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp new file mode 100644 index 00000000000..2d4df6a368d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NTransform/CPP/example.cpp @@ -0,0 +1,181 @@ + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. +static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Specify a canonicalization method. + signedXml->SignedInfo->CanonicalizationMethod = SignedXml::XmlDsigExcC14NTransformUrl; + + // Set the InclusiveNamespacesPrefixList property. + XmlDsigExcC14NTransform^ canMethod = dynamic_cast(signedXml->SignedInfo->CanonicalizationMethodObject); + canMethod->InclusiveNamespacesPrefixList = L"Sign"; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = L""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( dynamic_cast(doc->FirstChild) ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +static Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// Create example data to sign. +static void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); + + // Append the node to the document. + document->AppendChild( node ); + + // Create a new XmlNode object. + XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"TempElement", L"Sign" ); + + // Add some text to the node. + subnode->InnerText = L"Here is some data to sign."; + + // Append the node to the document. + document->DocumentElement->AppendChild( subnode ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( L"Example.xml" ); + Console::WriteLine( L"New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( L"Example.xml", L"SignedExample.xml", Key ); + Console::WriteLine( L"XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( L"Verifying signature..." ); + bool result = VerifyXmlFile( L"SignedExample.xml" ); + + // Display the results of the signature verification to \ + // the console. + if ( result ) + { + Console::WriteLine( L"The XML signature is valid." ); + } + else + { + Console::WriteLine( L"The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp new file mode 100644 index 00000000000..ce578aa7c43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigExcC14NWithCommentsTransform/CPP/sample.cpp @@ -0,0 +1,178 @@ + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. +static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Specify a canonicalization method. + signedXml->SignedInfo->CanonicalizationMethod = SignedXml::XmlDsigExcC14NWithCommentsTransformUrl; + + // Set the InclusiveNamespacesPrefixList property. + XmlDsigExcC14NWithCommentsTransform^ canMethod = dynamic_cast(signedXml->SignedInfo->CanonicalizationMethodObject); + canMethod->InclusiveNamespacesPrefixList = L"Sign"; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = L""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( dynamic_cast(doc->FirstChild) ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +static Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// Create example data to sign. +static void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); + + // Append the node to the document. + document->AppendChild( node ); + + // Create a new XmlNode object. + XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"TempElement", L"Sign" ); + + // Add some text to the node. + subnode->InnerText = L"Here is some data to sign."; + + // Append the node to the document. + document->DocumentElement->AppendChild( subnode ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Create an XML file to sign. + CreateSomeXml( L"Example.xml" ); + Console::WriteLine( L"New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + //SignXmlFile("Example.xml", "SignedExample.xml", Key); + Console::WriteLine( L"XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( L"Verifying signature..." ); + bool result = VerifyXmlFile( L"SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( L"The XML signature is valid." ); + } + else + { + Console::WriteLine( L"The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp new file mode 100644 index 00000000000..6edd984e6b9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXPathTransform/CPP/sample.cpp @@ -0,0 +1,202 @@ + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Create the XML that represents the transform. +static XmlDsigXPathTransform^ CreateXPathTransform( String^ XPathString ) +{ + + // Create a new XMLDocument object. + XmlDocument^ doc = gcnew XmlDocument; + + // Create a new XmlElement. + XmlElement^ xPathElem = doc->CreateElement( L"XPath" ); + + // Set the element text to the value + // of the XPath string. + xPathElem->InnerText = XPathString; + + // Create a new XmlDsigXPathTransform object. + XmlDsigXPathTransform^ xForm = gcnew XmlDsigXPathTransform; + + // Load the XPath XML from the element. + xForm->LoadInnerXml( xPathElem->SelectNodes( L"." ) ); + + // Return the XML that represents the transform. + return xForm; +} + + +// Sign an XML file and save the signature in a new file. +static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, String^ XPathString ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = L""; + + // Create an XmlDsigXPathTransform object using + // the helper method 'CreateXPathTransform' defined + // later in this sample. + XmlDsigXPathTransform^ XPathTransform = CreateXPathTransform( XPathString ); + + // Add the transform to the reference. + reference->AddTransform( XPathTransform ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +static Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// Create example data to sign. +static void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); + + // Append the node to the document. + document->AppendChild( node ); + + // Create a new XmlNode object. + XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"TempElement", L"Sign" ); + + // Add some text to the node. + subnode->InnerText = L"Here is some data to sign."; + + // Append the node to the document. + document->DocumentElement->AppendChild( subnode ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + + // Generate a signing key. + RSA^ Key = RSA::Create(); + try + { + + // Create an XML file to sign. + CreateSomeXml( L"Example.xml" ); + Console::WriteLine( L"New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( L"Example.xml", L"SignedExample.xml", Key, L"ancestor-or-self::TempElement" ); + Console::WriteLine( L"XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( L"Verifying signature..." ); + bool result = VerifyXmlFile( L"SignedExample.xml" ); + + // Display the results of the signature verification to \ + // the console. + if ( result ) + { + Console::WriteLine( L"The XML signature is valid." ); + } + else + { + Console::WriteLine( L"The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + Key->Clear(); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp new file mode 100644 index 00000000000..6693cd9c0f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlDsigXsltTransform/CPP/sample.cpp @@ -0,0 +1,193 @@ + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Create the XML that represents the transform. +static XmlDsigXsltTransform^ CreateXsltTransform( String^ xsl ) +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( xsl ); + XmlDsigXsltTransform^ xform = gcnew XmlDsigXsltTransform; + xform->LoadInnerXml( doc->ChildNodes ); + return xform; +} + + +// Sign an XML file and save the signature in a new file. +static void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, String^ XSLString ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = L""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Create an XmlDsigXPathTransform object using + // the helper method 'CreateXPathTransform' defined + // later in this sample. + XmlDsigXsltTransform^ XsltTransform = CreateXsltTransform( XSLString ); + + // Add the transform to the reference. + reference->AddTransform( XsltTransform ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( dynamic_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +static Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( L"Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// Create example data to sign. +static void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, L"", L"MyXML", L"Don't_Sign" ); + + // Append the node to the document. + document->AppendChild( node ); + + // Create a new XmlNode object. + XmlNode^ subnode = document->CreateNode( XmlNodeType::Element, L"", L"ElementToTransform", L"Sign" ); + + // Add some text to the node. + subnode->InnerText = L"Here is some data to sign."; + + // Append the node to the document. + document->DocumentElement->AppendChild( subnode ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + + // Generate a signing key. + RSA^ Key = RSA::Create(); + String^ xsl = L"\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n "; + try + { + + // Create an XML file to sign. + CreateSomeXml( L"Example.xml" ); + Console::WriteLine( L"New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( L"Example.xml", L"SignedExample.xml", Key, xsl ); + Console::WriteLine( L"XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( L"Verifying signature..." ); + bool result = VerifyXmlFile( L"SignedExample.xml" ); + + // Display the results of the signature verification to \ + // the console. + if ( result ) + { + Console::WriteLine( L"The XML signature is valid." ); + } + else + { + Console::WriteLine( L"The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + Key->Clear(); + } + + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp new file mode 100644 index 00000000000..4477c20eac3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Cryptography.XML.XmlLicenseTransform/cpp/sample.cpp @@ -0,0 +1,75 @@ +// +#using +#using +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; + +// +void CheckSignatureWithEncryptedGrant( + String^ fileName, IRelDecryptor^ decryptor) +{ + // Create a new XML document. + XmlDocument^ sourceDocument = gcnew XmlDocument(); + XmlNamespaceManager^ namespaceManager = + gcnew XmlNamespaceManager(sourceDocument->NameTable); + + // Format using white spaces. + sourceDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + sourceDocument->Load(fileName); + namespaceManager->AddNamespace("dsig", + SignedXml::XmlDsigNamespaceUrl); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = + sourceDocument->SelectNodes("//dsig:Signature", namespaceManager); + + for (int i = 0, count = nodeList->Count; i < count; i++) + { + XmlDocument^ clone = (XmlDocument^) sourceDocument->Clone(); + XmlNodeList^ signatures = + clone->SelectNodes("//dsig:Signature", namespaceManager); + + // Create a new SignedXml object and pass into it the + // XML document clone. + SignedXml^ signedDocument = gcnew SignedXml(clone); + + // Load the signature node. + signedDocument->LoadXml((XmlElement^)signatures[i]); + + // Set the context for license transform + Transform^ licenseTransform = ((Reference^)signedDocument-> + SignedInfo->References[0])->TransformChain[0]; + + if ((licenseTransform::typeid == XmlLicenseTransform::typeid) + && (decryptor != nullptr)) + { + // Decryptor is used to decrypt encryptedGrant + // elements. + ((XmlLicenseTransform^) licenseTransform)->Decryptor = decryptor; + } + + // Check the signature and display the result. + if (signedDocument->CheckSignature()) + { + Console::WriteLine("SUCCESS: " + + "CheckSignatureWithEncryptedGrant - issuer index #" + i); + } + else + { + Console::WriteLine("FAILURE: " + + "CheckSignatureWithEncryptedGrant - issuer index #" + i); + } + } +} +// + +int main() +{ +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp new file mode 100644 index 00000000000..e5ffc2a58d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalDigits/CPP/currencydecimaldigits.cpp @@ -0,0 +1,29 @@ + +// The following code example demonstrates the effect of changing the +// CurrencyDecimalDigits property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a negative value with the default number of decimal digits (2). + Int64 myInt = -1234; + Console::WriteLine( myInt.ToString( "C", nfi ) ); + + // Displays the same value with four decimal digits. + nfi->CurrencyDecimalDigits = 4; + Console::WriteLine( myInt.ToString( "C", nfi ) ); +} + +/* +This code produces the following output. + +($1, 234.00) +($1, 234.0000) +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp new file mode 100644 index 00000000000..9620c7b2591 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CurrencyDecimalSeparator/CPP/currencydecimalseparator.cpp @@ -0,0 +1,29 @@ + +// The following code example demonstrates the effect of changing the +// CurrencyDecimalSeparator property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S"."). + Int64 myInt = 123456789; + Console::WriteLine( myInt.ToString( "C", nfi ) ); + + // Displays the same value with a blank as the separator. + nfi->CurrencyDecimalSeparator = " "; + Console::WriteLine( myInt.ToString( "C", nfi ) ); +} + +/* +This code produces the following output. + +$123, 456, 789.00 +$123, 456, 789 00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp new file mode 100644 index 00000000000..0421ff605f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSeparator/CPP/currencygroupseparator.cpp @@ -0,0 +1,29 @@ + +// The following code example demonstrates the effect of changing the +// CurrencyGroupSeparator property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S", "). + Int64 myInt = 123456789; + Console::WriteLine( myInt.ToString( "C", nfi ) ); + + // Displays the same value with a blank as the separator. + nfi->CurrencyGroupSeparator = " "; + Console::WriteLine( myInt.ToString( "C", nfi ) ); +} + +/* +This code produces the following output. + +$123, 456, 789.00 +$123 456 789.00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp new file mode 100644 index 00000000000..a06da3edcbf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CurrencyGroupSizes/CPP/currencygroupsizes.cpp @@ -0,0 +1,34 @@ + +// The following code example demonstrates the effect of changing the +// CurrencyGroupSizes property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S"."). + Int64 myInt = 123456789012345; + Console::WriteLine( myInt.ToString( "C", nfi ) ); + + // Displays the same value with different groupings. + array^mySizes1 = {2,3,4}; + array^mySizes2 = {2,3,0}; + nfi->CurrencyGroupSizes = mySizes1; + Console::WriteLine( myInt.ToString( "C", nfi ) ); + nfi->CurrencyGroupSizes = mySizes2; + Console::WriteLine( myInt.ToString( "C", nfi ) ); +} + +/* +This code produces the following output. + +$123, 456, 789, 012, 345.00 +$12, 3456, 7890, 123, 45.00 +$1234567890, 123, 45.00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp new file mode 100644 index 00000000000..95a1012b1d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/CustomAttributeData/CPP/source.cpp @@ -0,0 +1,234 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; +using namespace System::Collections::ObjectModel; + +// An enumeration used by the ExampleAttribute class. +public enum class ExampleKind +{ + FirstKind, SecondKind, ThirdKind, FourthKind +}; + +// An example attribute. The attribute can be applied to all +// targets, from assemblies to parameters. +// +[AttributeUsage(AttributeTargets::All)] +public ref class ExampleAttribute: public Attribute +{ +private: + // Data for properties. + ExampleKind kindValue; + String^ noteValue; + array^ arrayStrings; + array^ arrayNumbers; + + // Constructors. + void ExampleAttributeInitialize( ExampleKind initKind, array^ initStrings ) + { + kindValue = initKind; + arrayStrings = initStrings; + } +public: + ExampleAttribute() + { + ExampleAttributeInitialize( ExampleKind::FirstKind, nullptr ); + } + ExampleAttribute( ExampleKind initKind ) + { + ExampleAttributeInitialize( initKind, nullptr ); + } + ExampleAttribute( ExampleKind initKind, array^ initStrings ) + { + ExampleAttributeInitialize( initKind, initStrings ); + } + + // Properties. The Note and Numbers properties must be read/write, so they + // can be used as named parameters. + // + property ExampleKind Kind + { + ExampleKind get() + { + return kindValue; + } + } + property array^ Strings + { + array^ get() + { + return arrayStrings; + } + } + property String^ Note + { + String^ get() + { + return noteValue; + } + + void set( String^ value ) + { + noteValue = value; + } + } + property array^ Numbers + { + array^ get() + { + return arrayNumbers; + } + + void set( array^ value ) + { + arrayNumbers = value; + } + } +}; + +// The example attribute is applied to the assembly. +[assembly:Example(ExampleKind::ThirdKind,Note="This is a note on the assembly.")]; + +// The example attribute is applied to the test class. +// +[Example(ExampleKind::SecondKind, + gcnew array { "String array argument, line 1", + "String array argument, line 2", + "String array argument, line 3" }, + Note="This is a note on the class.", + Numbers = gcnew array { 53, 57, 59 })] +public ref class Test +{ +public: + // The example attribute is applied to a method, using the + // parameterless constructor and supplying a named argument. + // The attribute is also applied to the method parameter. + // + [Example(Note="This is a note on a method.")] + void TestMethod( [Example] Object^ arg ){} + + // Main() gets objects representing the assembly, the test + // type, the test method, and the method parameter. Custom + // attribute data is displayed for each of these. + // + static void Main() + { + Assembly^ assembly = Assembly::ReflectionOnlyLoad( "Source" ); + Type^ t = assembly->GetType( "Test" ); + MethodInfo^ m = t->GetMethod( "TestMethod" ); + array^p = m->GetParameters(); + + Console::WriteLine( "\r\nAttributes for assembly: '{0}'", assembly ); + ShowAttributeData( CustomAttributeData::GetCustomAttributes( assembly ) ); + Console::WriteLine( "\r\nAttributes for type: '{0}'", t ); + ShowAttributeData( CustomAttributeData::GetCustomAttributes( t ) ); + Console::WriteLine( "\r\nAttributes for member: '{0}'", m ); + ShowAttributeData( CustomAttributeData::GetCustomAttributes( m ) ); + Console::WriteLine( "\r\nAttributes for parameter: '{0}'", p ); + ShowAttributeData( CustomAttributeData::GetCustomAttributes( p[ 0 ] ) ); + } + +private: + static void ShowValueOrArray(CustomAttributeTypedArgument^ cata) + { + if (cata->Value->GetType() == ReadOnlyCollection::typeid) + { + Console::WriteLine(" Array of '{0}':", cata->ArgumentType); + + for each (CustomAttributeTypedArgument^ cataElement in + (ReadOnlyCollection^) cata->Value) + { + Console::WriteLine(" Type: '{0}' Value: '{1}'", + cataElement->ArgumentType, cataElement->Value); + } + } + else + { + Console::WriteLine( " Type: '{0}' Value: '{1}'", + cata->ArgumentType, cata->Value ); + } + } + + static void ShowAttributeData( IList< CustomAttributeData^ >^ attributes ) + { + for each ( CustomAttributeData^ cad in attributes ) + { + Console::WriteLine( " {0}", cad ); + Console::WriteLine( " Constructor: '{0}'", cad->Constructor ); + + Console::WriteLine( " Constructor arguments:" ); + for each ( CustomAttributeTypedArgument^ cata in cad->ConstructorArguments ) + { + ShowValueOrArray(cata); + } + + Console::WriteLine( " Named arguments:" ); + for each ( CustomAttributeNamedArgument cana in cad->NamedArguments ) + { + Console::WriteLine( " MemberInfo: '{0}'", cana.MemberInfo ); + ShowValueOrArray(cana.TypedValue); + } + } + } +}; + +int main() +{ + Test::Main(); +} + +/* This code example produces output similar to the following: + +Attributes for assembly: 'source, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' + [System.Runtime.CompilerServices.CompilationRelaxationsAttribute((Int32)8)] + Constructor: 'Void .ctor(Int32)' + Constructor arguments: + Type: 'System.Int32' Value: '8' + Named arguments: + [System.Runtime.CompilerServices.RuntimeCompatibilityAttribute(WrapNonExceptionThrows = True)] + Constructor: 'Void .ctor()' + Constructor arguments: + Named arguments: + MemberInfo: 'Boolean WrapNonExceptionThrows' + Type: 'System.Boolean' Value: 'True' + [ExampleAttribute((ExampleKind)2, Note = "This is a note on the assembly.")] + Constructor: 'Void .ctor(ExampleKind)' + Constructor arguments: + Type: 'ExampleKind' Value: '2' + Named arguments: + MemberInfo: 'System.String Note' + Type: 'System.String' Value: 'This is a note on the assembly.' + +Attributes for type: 'Test' + [ExampleAttribute((ExampleKind)1, new String[3] { "String array argument, line 1", "String array argument, line 2", "String array argument, line 3" }, Note = "This is a note on the class.", Numbers = new Int32[3] { 53, 57, 59 })] + Constructor: 'Void .ctor(ExampleKind, System.String[])' + Constructor arguments: + Type: 'ExampleKind' Value: '1' + Array of 'System.String[]': + Type: 'System.String' Value: 'String array argument, line 1' + Type: 'System.String' Value: 'String array argument, line 2' + Type: 'System.String' Value: 'String array argument, line 3' + Named arguments: + MemberInfo: 'System.String Note' + Type: 'System.String' Value: 'This is a note on the class.' + MemberInfo: 'Int32[] Numbers' + Array of 'System.Int32[]': + Type: 'System.Int32' Value: '53' + Type: 'System.Int32' Value: '57' + Type: 'System.Int32' Value: '59' + +Attributes for member: 'Void TestMethod(System.Object)' + [ExampleAttribute(Note = "This is a note on a method.")] + Constructor: 'Void .ctor()' + Constructor arguments: + Named arguments: + MemberInfo: 'System.String Note' + Type: 'System.String' Value: 'This is a note on a method.' + +Attributes for parameter: 'System.Object arg' + [ExampleAttribute()] + Constructor: 'Void .ctor()' + Constructor arguments: + Named arguments: +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp b/snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp new file mode 100644 index 00000000000..1bb36cb458d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DataBinding/CPP/webcustomcontrol1.cpp @@ -0,0 +1,328 @@ +// System.Web.UI.DataBinding.Expression +// System.Web.UI.DataBindingCollection.Remove(string) +// System.Web.UI.DataBindingCollection.Item +// System.Web.UI.DataBinding.DataBinding +// System.Web.UI.DataBinding.Expression +// System.Web.UI.DataBindingCollection.SyncRoot +// System.Web.UI.DataBindingCollection.Add(DataBinding) +// System.Web.UI.DataBindingCollection.DataBindingCollection +// System.Web.UI.DataBindingCollection.RemovedBindings +// System.Web.UI.DataBindingCollection.GetEnumerator +// System.Web.UI.DataBinding.PropertyName +// System.Web.UI.DataBinding.PropertyType +// System.Web.UI.DataBindingCollection.Count +// System.Web.UI.DataBindingCollection.IsReadOnly +// System.Web.UI.DataBindingCollection.IsSynchronized +// System.Web.UI.DataBindingCollection.CopyTo +// System.Web.UI.DataBindingCollection.GetHashCode +// System.Web.UI.DataBindingCollection.Remove(DataBinding) +// System.Web.UI.DataBindingCollection.Remove(string,true) +// System.Web.UI.DataBindingCollection.Clear() +// System.Web.UI.DataBindingHandlerAttribute +// System.Web.UI.DataBindingHandlerAttribute.IsDefaultAttribute(). +/*The following example demonstrates the members of 'DataBinding' and +' 'DataBindingCollection'. A new control 'SimpleWebControl' is created +and a 'Designer' attribute is attached to it which actually refers to the +DesignTimeClass. The 'OnBindingsCollectionChanged(string)' method is overridden +to actually capture the DataBindingCollection instance and add the +DataBinding Expression to the property in the ASPX file. When 'Text' property of the +SimpleWebControl is bound to the 'Text' property of 'Button1' at the DesignTime +using the IDE, the 'OnBindingCollectionChanged' method is called and +the 'Text' property of the 'SimpleWebControl' is updated in .aspx file. +The actual DataBinding is done at the runtime. The properties of the 'DataBinding' +and 'DataBindingCollection' are written into a text file (DataBindingOutput.txt) +in drive C. The Output is written at the design time itself. + +Note:This program has to be tested at "DesignTime". +These are the instructions to be followed to successfully test the functionality of the program. +1) Create a new "C# WebApplication" project. +2) Add Reference "System.Design.dll" to the project. +3) Add the 'DataBinding.aspx' and 'WebCustomControl1.cs' files to the project, +which are provided with this example. +4) In the 'DataBinding.aspx' file, make the assembly name same as the +"Project Name", created in step1. +5)Build the project. +6)Go to the "DesignTab" of the 'DataBinding.aspx' file. +7)Go to the properties window of the SimpleWebcontrol, built in Step5. +8)Go to the DataBindings column. +9)Select the "Text" property. +10)Select the "CustomBindingExpression" option. +11)Associate the Text property to any property of any control which is of the +type string. +12)Observe in "C:\" a file created with the name "DataBindingOutput.txt". +This file contains the properties of 'DataBinding' and 'DataBindingCollection' +classes demonstrated. +*/ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::WebControls; +using namespace System::ComponentModel; +using namespace System::Web::UI::Design; +using namespace System::IO; +using namespace System::Text; +using namespace System::Collections; + +namespace DataBindingTest +{ + public ref class SimpleDesigner: public System::Web::UI::Design::ControlDesigner + { + public: + + property String^ Text + { + + // The DesigneTime manipulation is done by this class. + String^ get() + { + // + DataBinding^ myBinding = DataBindings[ "Text" ]; + if ( myBinding != nullptr ) + { + return myBinding->Expression; + } + + return String::Empty; + // + } + + void set( String^ value ) + { + // + if ( (value == nullptr) || (value->Length == 0) ) + { + DataBindings->Remove( "Text" ); + } + // + else + { + // + DataBinding^ binding = DataBindings[ "Text" ]; + // + + // + if ( binding == nullptr ) + { + binding = gcnew DataBinding( "Text",String::typeid,value ); + } + // + // + else + { + binding->Expression = value; + } + // + // + // + DataBinding^ binding1 = dynamic_cast(DataBindings->SyncRoot); + DataBindings->Add( binding ); + DataBindings->Add( binding1 ); + + // + // + } + + OnBindingsCollectionChanged( "Text" ); + } + } + + protected: + virtual void OnBindingsCollectionChanged( String^ propName ) override + { + // This method actually forms an DataBindingExpression of the design time and associates it to the Property of the Control. + IHtmlControlDesignerBehavior^ myHtmlControlDesignBehavior = Behavior; + DataBindingCollection^ myDataBindingCollection; + DataBinding^ myDataBinding1; + DataBinding^ myDataBinding2; + String^ myStringReplace1; + String^ myDataBindingExpression1; + String^ removedBinding; + String^ removedBindingAfterReplace; + String^ myDataBindingExpression2; + String^ myStringReplace2; + array^removedBindings1; + array^removedBindings2; + Int32 temp; + IEnumerator^ myEnumerator; + if ( myHtmlControlDesignBehavior == nullptr ) + return; + + // + DataBindingCollection^ myDataBindingCollection1 = gcnew DataBindingCollection; + myDataBindingCollection1 = myDataBindingCollection = DataBindings; + // + if ( propName != nullptr ) + { + myDataBinding1 = myDataBindingCollection[ propName ]; + myStringReplace1 = propName->Replace( ".", "-" ); + if ( myDataBinding1 == nullptr ) + { + myHtmlControlDesignBehavior->RemoveAttribute( myStringReplace1, true ); + return; + } + + // DataBinding is not null. + myDataBindingExpression1 = String::Concat( "<%#", myDataBinding1->Expression, "%>" ); + myHtmlControlDesignBehavior->SetAttribute( myStringReplace1, myDataBindingExpression1, true ); + int index = myStringReplace1->IndexOf( "-" ); + } + else + { + // + removedBindings2 = removedBindings1 = DataBindings->RemovedBindings; + // + + temp = 0; + while ( removedBindings2->Length > temp ) + { + removedBinding = removedBindings2[ temp ]; + removedBindingAfterReplace = removedBinding->Replace( '.', '-' ); + myHtmlControlDesignBehavior->RemoveAttribute( removedBindingAfterReplace, true ); + temp = temp + 1; + } + myDataBindingCollection = DataBindings; + myEnumerator = myDataBindingCollection->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + { + // + // + myDataBinding2 = dynamic_cast(myEnumerator->Current); + String^ dataBindingOutput1; + String^ dataBindingOutput2; + String^ dataBindingOutput3; + dataBindingOutput1 = String::Concat( "The property name is ", myDataBinding2->PropertyName ); + dataBindingOutput2 = String::Concat( "The property type is ", myDataBinding2->PropertyType->ToString(), "-", dataBindingOutput1 ); + dataBindingOutput3 = String::Concat( "The expression is ", myDataBinding2->Expression, "-", dataBindingOutput2 ); + WriteToFile( dataBindingOutput3 ); + // + // + + myDataBindingExpression2 = String::Concat( "<%#", myDataBinding2->Expression, "%>" ); + myStringReplace2 = myDataBinding2->PropertyName->Replace( ".", "-" ); + myHtmlControlDesignBehavior->SetAttribute( myStringReplace2, myDataBindingExpression2, true ); + int index = myStringReplace2->IndexOf( '-' ); + } + // + // + // + String^ dataBindingOutput4; + String^ dataBindingOutput5; + String^ dataBindingOutput6; + String^ dataBindingOutput7; + String^ dataBindingOutput8; + dataBindingOutput4 = String::Concat( "The Count of the collection is ", myDataBindingCollection1->Count ); + dataBindingOutput5 = String::Concat( "The IsSynchronised property of the collection is ", myDataBindingCollection1->IsSynchronized, "-", dataBindingOutput4 ); + dataBindingOutput6 = String::Concat( "The IsReadOnly property of the collection is ", myDataBindingCollection1->IsReadOnly, "-", dataBindingOutput5 ); + WriteToFile( dataBindingOutput6 ); + + // + // + // + // + System::Array^ dataBindingCollectionArray = Array::CreateInstance( Object::typeid, myDataBindingCollection1->Count ); + myDataBindingCollection1->CopyTo( dataBindingCollectionArray, 0 ); + dataBindingOutput7 = String::Concat( "The count of DataBindingArray is ", dataBindingCollectionArray->Length ); + WriteToFile( dataBindingOutput7 ); + + // + IEnumerator^ myEnumerator1 = myDataBindingCollection1->GetEnumerator(); + if ( myEnumerator1->MoveNext() ) + { + // + myDataBinding1 = dynamic_cast(myEnumerator1->Current); + dataBindingOutput8 = String::Concat( "The HashCode is", myDataBinding1->GetHashCode().ToString() ); + WriteToFile( dataBindingOutput8 ); + + // + myDataBindingCollection1->Remove( myDataBinding1 ); + dataBindingOutput8 = String::Concat( "The Count of the collection after DataBinding is removed is ", myDataBindingCollection1->Count ); + WriteToFile( dataBindingOutput8 ); + // + // + } + else + { + myDataBinding1 = dynamic_cast(myEnumerator1->Current); + + // + myDataBindingCollection1->Remove( "Text", true ); + dataBindingOutput8 = String::Concat( "The Count of the collection after DataBinding is removed is ", myDataBindingCollection1->Count ); + WriteToFile( dataBindingOutput8 ); + // + + // + myDataBindingCollection1->Clear(); + dataBindingOutput8 = String::Concat( "The Count of the collection after clear method is called ", myDataBindingCollection1->Count ); + WriteToFile( dataBindingOutput8 ); + // + } + } + } + + public: + void WriteToFile( String^ input ) + { + // This method writes the values of the properties at the design time into a Text file DataBindingOutput.txt in the "C" of the system. + StreamWriter^ myFile = File::AppendText( "C:\\DataBindingOutput.txt" ); + ASCIIEncoding^ encoder = gcnew ASCIIEncoding; + array^ByteArray = encoder->GetBytes( input ); + array^CharArray = encoder->GetChars( ByteArray ); + myFile->WriteLine( CharArray, 0, input->Length ); + myFile->Close(); + } + }; + // + [DefaultProperty("Text"), + ToolboxData("<{0}:Simple runat=server>"), + Designer("DataBindingTest.SimpleDesigner"), + DataBindingHandlerAttribute(System::Web::UI::Design::TextDataBindingHandler::typeid) + ] + // + public ref class SimpleWebControl: public WebControl + { + private: + + //A control derived from 'System.Web.UI.WebControl' class with single property 'Text'. + String^ _Text; + + public: + property String^ Text + { + + [Bindable(true)] + String^ get() + { + return _Text; + } + + void set( String^ value ) + { + _Text = value; + } + } + + protected: + // + virtual void Render( HtmlTextWriter^ output ) override + { + output->Write( "
This is the Text of SimpleWebControl : {0}", _Text ); + IEnumerator^ myEnum = SimpleWebControl::typeid->GetCustomAttributes( true )->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ attribute = safe_cast(myEnum->Current); + if ( dynamic_cast(attribute) ) + { + DataBindingHandlerAttribute^ myDataBindingHandlerAttribute = dynamic_cast(attribute); + output->Write( "


The IsDefaultAttribute of DataBindingHandlerAttribute is :{0}", myDataBindingHandlerAttribute->IsDefaultAttribute() ); + output->Write( "


DataBinding HandlerTypeName:{0}", myDataBindingHandlerAttribute->HandlerTypeName ); + } + } + } + //
+ }; +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp new file mode 100644 index 00000000000..e1bc418aedf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime Operators/CPP/class1.cpp @@ -0,0 +1,30 @@ +using namespace System; + +int main() +{ + // Addition operator + // + System::DateTime dTime( 1980, 8, 5 ); + + // tSpan is 17 days, 4 hours, 2 minutes and 1 second. + System::TimeSpan tSpan( 17, 4, 2, 1 ); + + // Result gets 8/22/1980 4:02:01 AM. + System::DateTime result = dTime + tSpan; + // + + System::Console::WriteLine( result ); + + // Equality operator. + // + System::DateTime april19( 2001, 4, 19 ); + System::DateTime otherDate( 1991, 6, 5 ); + + // areEqual gets false. + bool areEqual = april19 == otherDate; + + otherDate = DateTime( 2001, 4, 19 ); + // areEqual gets true. + areEqual = april19 == otherDate; + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp new file mode 100644 index 00000000000..8d23921d77c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.Add/CPP/class1.cpp @@ -0,0 +1,12 @@ +using namespace System; + +int main() +{ + // + // Calculate what day of the week is 36 days from this instant. + System::DateTime today = System::DateTime::Now; + System::TimeSpan duration( 36, 0, 0, 0 ); + System::DateTime answer = today.Add( duration ); + System::Console::WriteLine( " {0:dddd}", answer ); + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp new file mode 100644 index 00000000000..0cd42a84a60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.AddDays/CPP/class1.cpp @@ -0,0 +1,15 @@ +// +using namespace System; + +int main() +{ + // Calculate what day of the week is 36 days from this instant. + DateTime today = System::DateTime::Now; + DateTime answer = today.AddDays( 36 ); + Console::WriteLine("Today: {0:dddd}", today); + Console::WriteLine("36 days from today: {0:dddd}", answer); +} +// The example displays output like the following: +// Today: Wednesday +// 36 days from today: Thursday +// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp new file mode 100644 index 00000000000..90e6be09498 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.CompareTo/CPP/class1.cpp @@ -0,0 +1,34 @@ +// +using namespace System; +void main() +{ + + + System::DateTime theDay(System::DateTime::Today.Year,7,28); + int compareValue; + try + { + compareValue = theDay.CompareTo( System::DateTime::Today ); + } + catch ( ArgumentException^ ) + { + System::Console::WriteLine( "Value is not a DateTime" ); + return; + } + + if ( compareValue < 0 ) + { + System::Console::WriteLine( "{0:d} is in the past.", theDay ); + } + else + if ( compareValue == 0 ) + { + System::Console::WriteLine( "{0:d} is today!", theDay ); + } + else + // compareValue > 0 + { + System::Console::WriteLine( "{0:d} has not come yet.", theDay ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp new file mode 100644 index 00000000000..9c3486e2cfa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.DayOfWeek/CPP/dow.cpp @@ -0,0 +1,21 @@ + +// +// This example demonstrates the DateTime.DayOfWeek property +using namespace System; +int main() +{ + + // Assume the current culture is en-US. + // Create a DateTime for the first of May, 2003. + DateTime dt = DateTime(2003,5,1); + Console::WriteLine( "Is Thursday the day of the week for {0:d}?: {1}", dt, dt.DayOfWeek == DayOfWeek::Thursday ); + Console::WriteLine( "The day of the week for {0:d} is {1}.", dt, dt.DayOfWeek ); +} + +/* +This example produces the following results: + +Is Thursday the day of the week for 5/1/2003?: True +The day of the week for 5/1/2003 is Thursday. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp new file mode 100644 index 00000000000..4cd3cdc577f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.DaysInMonth/CPP/class1.cpp @@ -0,0 +1,22 @@ +// +using namespace System; + +int main() +{ + const int July = 7; + const int Feb = 2; + + int daysInJuly = System::DateTime::DaysInMonth( 2001, July ); + Console::WriteLine(daysInJuly); + // daysInFeb gets 28 because the year 1998 was not a leap year. + int daysInFeb = System::DateTime::DaysInMonth( 1998, Feb ); + Console::WriteLine(daysInFeb); + // daysInFebLeap gets 29 because the year 1996 was a leap year. + int daysInFebLeap = System::DateTime::DaysInMonth( 1996, Feb ); + Console::WriteLine(daysInFebLeap); +} +// The example displays the following output: +// 31 +// 28 +// 29 +// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp new file mode 100644 index 00000000000..3bccccac024 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.Equals/CPP/class1.cpp @@ -0,0 +1,22 @@ +using namespace System; + +int main() +{ + // + System::DateTime today1 = System::DateTime( + System::DateTime::Today.Ticks ); + System::DateTime today2 = System::DateTime( + System::DateTime::Today.Ticks ); + System::DateTime tomorrow = System::DateTime( + System::DateTime::Today.AddDays( 1 ).Ticks ); + + // todayEqualsToday gets true. + bool todayEqualsToday = System::DateTime::Equals( today1, today2 ); + + // todayEqualsTomorrow gets false. + bool todayEqualsTomorrow = System::DateTime::Equals( today1, tomorrow ); + // + + System::Console::WriteLine( todayEqualsToday ); + System::Console::WriteLine( todayEqualsTomorrow ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp new file mode 100644 index 00000000000..6e94f44f925 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.FromFileTime/CPP/class1.cpp @@ -0,0 +1,44 @@ +using namespace System; +using namespace System::IO; + +// This function takes a file's creation time as an unsigned long, +// and returns its age. +// +System::TimeSpan FileAge( long fileCreationTime ) +{ + System::DateTime now = System::DateTime::Now; + try + { + System::DateTime fCreationTime = + System::DateTime::FromFileTime( fileCreationTime ); + System::TimeSpan fileAge = now.Subtract( fCreationTime ); + return fileAge; + } + catch ( ArgumentOutOfRangeException^ ) + { + // fileCreationTime is not valid, so re-throw the exception. + throw; + } +} +// + +void main() +{ + System::Console::WriteLine( "Enter a file's path" ); + String^ filePath = System::Console::ReadLine(); + System::IO::FileInfo^ fInfo; + try + { + fInfo = gcnew System::IO::FileInfo( filePath ); + } + catch ( Exception^ ) + { + System::Console::WriteLine( "Error opening {0}", filePath ); + return; + } + + long fileTime = System::Convert::ToInt64( + fInfo->CreationTime.ToFileTime() ); + System::TimeSpan fileAge = FileAge( fileTime ); + System::Console::WriteLine( " {0}", fileAge ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp new file mode 100644 index 00000000000..436ff3e6d0e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.GetDateTimeFormats/CPP/class1.cpp @@ -0,0 +1,34 @@ + +using namespace System; + +int main() +{ + // + DateTime july28 = DateTime(2009, 7, 28, 5, 23, 15, 16); + array^july28Formats = july28.GetDateTimeFormats(); + + // Print [Out] july28* in all DateTime formats using the default culture. + System::Collections::IEnumerator^ myEnum = july28Formats->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ format = safe_cast(myEnum->Current); + System::Console::WriteLine( format ); + } + // + + // + DateTime juil28 = DateTime(2009, 7, 28, 5, 23, 15, 16); + IFormatProvider^ culture = gcnew System::Globalization::CultureInfo("fr-FR", true ); + + // Get the short date formats using the S"fr-FR" culture. + array^frenchJuly28Formats = juil28.GetDateTimeFormats(culture ); + + // Print [Out] july28* in all DateTime formats using fr-FR culture. + System::Collections::IEnumerator^ myEnum2 = frenchJuly28Formats->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + String^ format = safe_cast(myEnum2->Current); + System::Console::WriteLine(format ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp new file mode 100644 index 00000000000..d3d290772b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.Subtraction/CPP/class1.cpp @@ -0,0 +1,27 @@ +using namespace System; + +int main() +{ + // + System::DateTime date1 = System::DateTime( 1996, 6, 3, 22, 15, 0 ); + System::DateTime date2 = System::DateTime( 1996, 12, 6, 13, 2, 0 ); + System::DateTime date3 = System::DateTime( 1996, 10, 12, 8, 42, 0 ); + + // diff1 gets 185 days, 14 hours, and 47 minutes. + System::TimeSpan diff1 = date2.Subtract( date1 ); + + // date4 gets 4/9/1996 5:55:00 PM. + System::DateTime date4 = date3.Subtract( diff1 ); + + // diff2 gets 55 days 4 hours and 20 minutes. + System::TimeSpan diff2 = date2 - date3; + + // date5 gets 4/9/1996 5:55:00 PM. + System::DateTime date5 = date1 - diff2; + // + + System::Console::WriteLine( diff1 ); + System::Console::WriteLine( date4 ); + System::Console::WriteLine( diff2 ); + System::Console::WriteLine( date4 ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp new file mode 100644 index 00000000000..fd732ab14d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.ToFileTime/CPP/class1.cpp @@ -0,0 +1,21 @@ + +using namespace System; + +// +int main() +{ + System::Console::WriteLine( "Enter the file path:" ); + String^ filePath = System::Console::ReadLine(); + if ( System::IO::File::Exists( filePath ) ) + { + System::DateTime fileCreationDateTime = System::IO::File::GetCreationTime( filePath ); + __int64 fileCreationFileTime = fileCreationDateTime.ToFileTime(); + System::Console::WriteLine( "{0} in file time is {1}.", fileCreationDateTime, fileCreationFileTime ); + } + else + { + System::Console::WriteLine( "{0} is an invalid file", filePath ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp new file mode 100644 index 00000000000..9b140cbb13e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DateTime.ToLocalTime ToUniversalTime/CPP/class1.cpp @@ -0,0 +1,49 @@ +// +using namespace System; + +void main() +{ + Console::WriteLine("Enter a date and time."); + String^ strDateTime = Console::ReadLine(); + + DateTime localDateTime, univDateTime; + try + { + localDateTime = DateTime::Parse(strDateTime); + univDateTime = localDateTime.ToUniversalTime(); + + Console::WriteLine("{0} local time is {1} universal time.", + localDateTime, univDateTime ); + } + catch (FormatException^) + { + Console::WriteLine("Invalid format."); + return; + } + + Console::WriteLine("Enter a date and time in universal time."); + strDateTime = Console::ReadLine(); + + try + { + univDateTime = DateTime::Parse(strDateTime); + localDateTime = univDateTime.ToLocalTime(); + + Console::WriteLine("{0} universal time is {1} local time.", + univDateTime, localDateTime ); + } + catch (FormatException^) + { + Console::WriteLine("Invalid format."); + return; + } +} +// The example displays output like the following when run on a +// computer whose culture is en-US in the Pacific Standard Time zone: +// Enter a date and time. +// 12/10/2015 6:18 AM +// 12/10/2015 6:18:00 AM local time is 12/10/2015 2:18:00 PM universal time. +// Enter a date and time in universal time. +// 12/20/2015 6:42:00 +// 12/20/2015 6:42:00 AM universal time is 12/19/2015 10:42:00 PM local time. +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp new file mode 100644 index 00000000000..1d76e0d1879 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Decimal Example/CPP/source.cpp @@ -0,0 +1,144 @@ +using namespace System; + +namespace Snippets +{ +// + /// + /// Keeping my fortune in Decimals to avoid the round-off errors. + /// + public ref class PiggyBank + { + protected: + Decimal MyFortune; + + public: + void AddPenny() + { + MyFortune = System::Decimal::Add( MyFortune, Decimal(.01) ); + } + + System::Decimal Capacity() + { + return MyFortune.MaxValue; + } + + Decimal Dollars() + { + return Decimal::Floor( MyFortune ); + } + + Decimal Cents() + { + return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) ); + } + + virtual System::String^ ToString() override + { + return MyFortune.ToString("C")+" in piggy bank"; + } + }; +} +// + +using namespace Snippets; +int main( void ) +{ + PiggyBank ^ pb = gcnew PiggyBank; + for ( Int32 i = 0; i < 378; i++ ) + { + pb->AddPenny(); + + } + Console::WriteLine( pb ); +} + + +namespace Snippets2 +{ + // + public ref class PiggyBank + { + public: + Decimal Capacity() + { + return MyFortune.MaxValue; + } + + void AddPenny() + { + MyFortune = Decimal::Add(MyFortune, (Decimal).01); + } + + protected: + Decimal MyFortune; + }; + +} +// + +namespace Snippets3 +{ + // + public ref class PiggyBank + { + public: + Decimal Dollars() + { + return Decimal::Floor( MyFortune ); + } + + void AddPenny() + { + MyFortune = Decimal::Add(MyFortune, (Decimal).01); + } + + protected: + Decimal MyFortune; + }; + +} +// + +namespace Snippets4 +{ +// + public ref class PiggyBank + { + public: + Decimal Cents() + { + return Decimal::Subtract( MyFortune, Decimal::Floor( MyFortune ) ); + } + + void AddPenny() + { + MyFortune = Decimal::Add(MyFortune, (Decimal).01); + } + + protected: + Decimal MyFortune; + }; +} +// + +namespace Snippets5 +{ +// + public ref class PiggyBank + { + public: + void AddPenny() + { + MyFortune = Decimal::Add( MyFortune, (Decimal).01 ); + } + + virtual System::String^ ToString() override + { + return MyFortune.ToString("C")+" in piggy bank"; + } + + protected: + Decimal MyFortune; + }; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp new file mode 100644 index 00000000000..4ead255443e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DefineDynamicAssemblyWithAttributes/cpp/source.cpp @@ -0,0 +1,51 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Security; + +void main() +{ + // Create a CustomAttributeBuilder for the assembly attribute. + // + // SecurityTransparentAttribute has a parameterless constructor, + // which is retrieved by passing an array of empty types for the + // constructor's parameter types. The CustomAttributeBuilder is + // then created by passing the ConstructorInfo and an empty array + // of objects to represent the parameters. + // + ConstructorInfo^ transparentCtor = + SecurityTransparentAttribute::typeid->GetConstructor( + Type::EmptyTypes); + CustomAttributeBuilder^ transparent = gcnew CustomAttributeBuilder( + transparentCtor, + gcnew array {} ); + + // Create a dynamic assembly using the attribute. The attribute is + // passed as an array with one element. + AssemblyName^ aName = gcnew AssemblyName("EmittedAssembly"); + AssemblyBuilder^ ab = AppDomain::CurrentDomain->DefineDynamicAssembly( + aName, + AssemblyBuilderAccess::Run, + gcnew array { transparent } ); + + ModuleBuilder^ mb = ab->DefineDynamicModule( aName->Name ); + TypeBuilder^ tb = mb->DefineType( + "MyDynamicType", + TypeAttributes::Public ); + tb->CreateType(); + + Console::WriteLine("{0}\nAssembly attributes:", ab); + for each (Attribute^ attr in ab->GetCustomAttributes(true)) + { + Console::WriteLine("\t{0}", attr); + } +}; + +/* This code example produces the following output: + +EmittedAssembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +Assembly attributes: + System.Security.SecurityTransparentAttribute + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp new file mode 100644 index 00000000000..e8b0c924c07 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Delegate.CreateDelegate_RelaxedFit/cpp/source.cpp @@ -0,0 +1,56 @@ +// +using namespace System; +using namespace System::Reflection; + +// Define two classes to use in the demonstration, a base class and +// a class that derives from it. +// +public ref class Base {}; + +public ref class Derived : Base +{ + // Define a static method to use in the demonstration. The method + // takes an instance of Base and returns an instance of Derived. + // For the purposes of the demonstration, it is not necessary for + // the method to do anything useful. + // +public: + static Derived^ MyMethod(Base^ arg) + { + Base^ dummy = arg; + return gcnew Derived(); + } +}; + +// Define a delegate that takes an instance of Derived and returns an +// instance of Base. +// +public delegate Base^ Example(Derived^ arg); + +void main() +{ + // The binding flags needed to retrieve MyMethod. + BindingFlags flags = BindingFlags::Public | BindingFlags::Static; + + // Get a MethodInfo that represents MyMethod. + MethodInfo^ minfo = Derived::typeid->GetMethod("MyMethod", flags); + + // Demonstrate contravariance of parameter types and covariance + // of return types by using the delegate Example to represent + // MyMethod. The delegate binds to the method because the + // parameter of the delegate is more restrictive than the + // parameter of the method (that is, the delegate accepts an + // instance of Derived, which can always be safely passed to + // a parameter of type Base), and the return type of MyMethod + // is more restrictive than the return type of Example (that + // is, the method returns an instance of Derived, which can + // always be safely cast to type Base). + // + Example^ ex = + (Example^) Delegate::CreateDelegate(Example::typeid, minfo); + + // Execute MyMethod using the delegate Example. + // + Base^ b = ex(gcnew Derived()); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp new file mode 100644 index 00000000000..a0af052a1d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Diag_Process_MemoryProperties64/CPP/source.cpp @@ -0,0 +1,78 @@ +// The following example starts an instance of Notepad. The example +// then retrieves and displays various properties of the associated +// process. The example detects when the process exits, and displays +// the process's exit code. +// +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + + // Define variables to track the peak + // memory usage of the process. + _int64 peakPagedMem = 0,peakWorkingSet = 0,peakVirtualMem = 0; + Process^ myProcess = nullptr; + try + { + + // Start the process. + myProcess = Process::Start( "NotePad.exe" ); + + // Display the process statistics until + // the user closes the program. + do + { + if ( !myProcess->HasExited ) + { + + // Refresh the current process property values. + myProcess->Refresh(); + Console::WriteLine(); + + // Display current process statistics. + Console::WriteLine( "{0} -", myProcess ); + Console::WriteLine( "-------------------------------------" ); + Console::WriteLine( " physical memory usage: {0}", myProcess->WorkingSet64 ); + Console::WriteLine( " base priority: {0}", myProcess->BasePriority ); + Console::WriteLine( " priority class: {0}", myProcess->PriorityClass ); + Console::WriteLine( " user processor time: {0}", myProcess->UserProcessorTime ); + Console::WriteLine( " privileged processor time: {0}", myProcess->PrivilegedProcessorTime ); + Console::WriteLine( " total processor time: {0}", myProcess->TotalProcessorTime ); + Console::WriteLine(" PagedSystemMemorySize64: {0}", myProcess->PagedSystemMemorySize64); + Console::WriteLine(" PagedMemorySize64: {0}", myProcess->PagedMemorySize64); + + // Update the values for the overall peak memory statistics. + peakPagedMem = myProcess->PeakPagedMemorySize64; + peakVirtualMem = myProcess->PeakVirtualMemorySize64; + peakWorkingSet = myProcess->PeakWorkingSet64; + if ( myProcess->Responding ) + { + Console::WriteLine( "Status = Running" ); + } + else + { + Console::WriteLine( "Status = Not Responding" ); + } + } + } + while ( !myProcess->WaitForExit( 1000 ) ); + Console::WriteLine(); + Console::WriteLine( "Process exit code: {0}", myProcess->ExitCode ); + + // Display peak memory statistics for the process. + Console::WriteLine( "Peak physical memory usage of the process: {0}", peakWorkingSet ); + Console::WriteLine( "Peak paged memory usage of the process: {0}", peakPagedMem ); + Console::WriteLine( "Peak virtual memory usage of the process: {0}", peakVirtualMem ); + } + finally + { + if ( myProcess != nullptr ) + { + myProcess->Close(); + } + } + +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp b/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp new file mode 100644 index 00000000000..1ec20413156 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Diagnostics_CounterCreationData/CPP/diagnostics_countercreationdata.cpp @@ -0,0 +1,63 @@ +// System::Diagnostics->CounterCreationData +// System::Diagnostics->CounterCreationData(String*, String*, PerformanceCounterType) +// System::Diagnostics->CounterCreationData() +// System::Diagnostics->CounterCreationData->CounterName +// System::Diagnostics->CounterCreationData->CounterHelp +// System::Diagnostics->CounterCreationData->CounterType + +/* The following program demonstrates 'CounterCreationData' class, +CounterCreationData(String*, String*, PerformanceCounterType)', +'CounterCreationData()', 'CounterName', 'CounterHelp' and +'CounterType' members of 'System::Diagnostics->CounterCreationData' +class. It creates the custom counters with 'CounterCreationData' +and binds them to 'PerformanceCounterCategory' object. */ + +// +// +// +// +// +// +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + CounterCreationDataCollection^ myCol = gcnew CounterCreationDataCollection; + + // Create two custom counter objects. + CounterCreationData^ myCounter1 = gcnew CounterCreationData( "Counter1","First custom counter",PerformanceCounterType::CounterDelta32 ); + CounterCreationData^ myCounter2 = gcnew CounterCreationData; + + // Set the properties of the 'CounterCreationData' Object*. + myCounter2->CounterName = "Counter2"; + myCounter2->CounterHelp = "Second custom counter"; + myCounter2->CounterType = PerformanceCounterType::NumberOfItemsHEX32; + + // Add custom counter objects to CounterCreationDataCollection. + myCol->Add( myCounter1 ); + myCol->Add( myCounter2 ); + if ( PerformanceCounterCategory::Exists( "New Counter Category" ) ) + PerformanceCounterCategory::Delete( "New Counter Category" ); + + // Bind the counters to a PerformanceCounterCategory. + PerformanceCounterCategory^ myCategory = PerformanceCounterCategory::Create( "New Counter Category", "Category Help", myCol ); + Console::WriteLine( "Counter Information:" ); + Console::WriteLine( "Category Name: {0}", myCategory->CategoryName ); + for ( int i = 0; i < myCol->Count; i++ ) + { + // Display the properties of the CounterCreationData objects. + Console::WriteLine( "CounterName : {0}", myCol[ i ]->CounterName ); + Console::WriteLine( "CounterHelp : {0}", myCol[ i ]->CounterHelp ); + Console::WriteLine( "CounterType : {0}", myCol[ i ]->CounterType ); + } +} + +// +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp new file mode 100644 index 00000000000..b5b6c7488d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/Dictionary.cpp @@ -0,0 +1,398 @@ +//Types:System.Collections.DictionaryEntry +//Types:System.Collections.IDictionary +//Types:System.Collections.IDictionaryEnumerator +// +using namespace System; +using namespace System::Collections; + +// +// This class implements a simple dictionary using an array of +// DictionaryEntry objects (key/value pairs). +public ref class SimpleDictionary : public IDictionary +{ + // The array of items +private: + array^ items; +private: + int itemsInUse; + + // Construct the SimpleDictionary with the desired number of + // items. The number of items cannot change for the life time of + // this SimpleDictionary. +public: + SimpleDictionary(int size) + { + items = gcnew array(size); + } + + #pragma region IDictionary Members + // +public: + property virtual bool IsReadOnly + { + bool get() + { + return false; + } + } + // + // +public: + virtual bool Contains(Object^ key) + { + int index; + return TryGetIndexOfKey(key, &index); + } + // + // +public: + virtual property bool IsFixedSize + { + bool get() + { + return false; + } + } + // + // +public: + virtual void Remove(Object^ key) + { + if (key == nullptr) + { + throw gcnew ArgumentNullException("key"); + } + // Try to find the key in the DictionaryEntry array + int index; + if (TryGetIndexOfKey(key, &index)) + { + // If the key is found, slide all the items down. + Array::Copy(items, index + 1, items, index, itemsInUse - + index - 1); + itemsInUse--; + } + else + { + // If the key is not in the dictionary, just return. + return; + } + } + // + // +public: + virtual void Clear() + { + itemsInUse = 0; + } + // + // +public: + virtual void Add(Object^ key, Object^ value) + { + // Add the new key/value pair even if this key already exists + // in the dictionary. + if (itemsInUse == items->Length) + { + throw gcnew InvalidOperationException + ("The dictionary cannot hold any more items."); + } + items[itemsInUse++] = gcnew DictionaryEntry(key, value); + } + // + // +public: + virtual property ICollection^ Keys + { + ICollection^ get() + { + // Return an array where each item is a key. + array^ keys = gcnew array(itemsInUse); + for (int i = 0; i < itemsInUse; i++) + { + keys[i] = items[i]->Key; + } + return keys; + } + } + // + // +public: + virtual property ICollection^ Values + { + ICollection^ get() + { + // Return an array where each item is a value. + array^ values = gcnew array(itemsInUse); + for (int i = 0; i < itemsInUse; i++) + { + values[i] = items[i]->Value; + } + return values; + } + } + // + // +public: + virtual property Object^ default[Object^] + { + Object^ get(Object^ key) + { + // If this key is in the dictionary, return its value. + int index; + if (TryGetIndexOfKey(key, &index)) + { + // The key was found; return its value. + return items[index]->Value; + } + else + { + // The key was not found; return null. + return nullptr; + } + } + + void set(Object^ key, Object^ value) + { + // If this key is in the dictionary, change its value. + int index; + if (TryGetIndexOfKey(key, &index)) + { + // The key was found; change its value. + items[index]->Value = value; + } + else + { + // This key is not in the dictionary; add this + // key/value pair. + Add(key, value); + } + } + } + // +private: + bool TryGetIndexOfKey(Object^ key, int* index) + { + for (*index = 0; *index < itemsInUse; *index++) + { + // If the key is found, return true (the index is also + // returned). + if (items[*index]->Key->Equals(key)) + { + return true; + } + } + + // Key not found, return false (index should be ignored by + // the caller). + return false; + } +// +// +private: + ref class SimpleDictionaryEnumerator : public IDictionaryEnumerator + { + // A copy of the SimpleDictionary object's key/value pairs. +private: + array^ items; +private: + int index; + +public: + SimpleDictionaryEnumerator(SimpleDictionary^ sd) + { + // Make a copy of the dictionary entries currently in the + // SimpleDictionary object. + items = gcnew array(sd->Count); + Array::Copy(sd->items, 0, items, 0, sd->Count); + index = -1; + } + + // Return the current item. +public: + virtual property Object^ Current + { + Object^ get() + { + ValidateIndex(); + return items[index]; + } + } + + // Return the current dictionary entry. +public: + virtual property DictionaryEntry Entry + { + DictionaryEntry get() + { + return (DictionaryEntry) Current; + } + } + + // Return the key of the current item. +public: + virtual property Object^ Key + { + Object^ get() + { + ValidateIndex(); + return items[index]->Key; + } + } + + // Return the value of the current item. +public: + virtual property Object^ Value + { + Object^ get() + { + ValidateIndex(); + return items[index]->Value; + } + } + + // Advance to the next item. +public: + virtual bool MoveNext() + { + if (index < items->Length - 1) + { + index++; + return true; + } + return false; + } + + // Validate the enumeration index and throw an exception if + // the index is out of range. +private: + void ValidateIndex() + { + if (index < 0 || index >= items->Length) + { + throw gcnew InvalidOperationException + ("Enumerator is before or after the collection."); + } + } + + // Reset the index to restart the enumeration. +public: + virtual void Reset() + { + index = -1; + } + }; + // +public: + virtual IDictionaryEnumerator^ GetEnumerator() + { + // Construct and return an enumerator. + return gcnew SimpleDictionaryEnumerator(this); + } + // + #pragma endregion + + #pragma region ICollection Members +public: + virtual property bool IsSynchronized + { + bool get() + { + return false; + } + } + +public: + virtual property Object^ SyncRoot + { + Object^ get() + { + throw gcnew NotImplementedException(); + } + } + +public: + virtual property int Count + { + int get() + { + return itemsInUse; + } + } + +public: + virtual void CopyTo(Array^ array, int index) + { + throw gcnew NotImplementedException(); + } + #pragma endregion + + #pragma region IEnumerable Members + + virtual IEnumerator^ IEnumerable_GetEnumerator() + = IEnumerable::GetEnumerator + { + // Construct and return an enumerator. + return ((IDictionary^)this)->GetEnumerator(); + } + #pragma endregion +}; +// + +int main() +{ + // Create a dictionary that contains no more than three + // entries. + IDictionary^ d = gcnew SimpleDictionary(3); + + // Add three people and their ages to the dictionary. + d->Add("Jeff", 40); + d->Add("Kristin", 34); + d->Add("Aidan", 1); + + Console::WriteLine("Number of elements in dictionary = {0}", + d->Count); + + Console::WriteLine("Does dictionary contain 'Jeff'? {0}", + d->Contains("Jeff")); + Console::WriteLine("Jeff's age is {0}", d["Jeff"]); + + // Display every entry's key and value. + for each (DictionaryEntry^ de in d) + { + Console::WriteLine("{0} is {1} years old.", de->Key, + de->Value); + } + + // Remove an entry that exists. + d->Remove("Jeff"); + + // Remove an entry that does not exist, but do not throw an + // exception. + d->Remove("Max"); + + // Show the names (keys) of the people in the dictionary. + for each (String^ s in d->Keys) + { + Console::WriteLine(s); + } + + // Show the ages (values) of the people in the dictionary. + for each (int age in d->Values) + { + Console::WriteLine(age); + } +} + +// This code produces the following output. +// +// Number of elements in dictionary = 3 +// Does dictionary contain 'Jeff'? True +// Jeff's age is 40 +// Jeff is 40 years old. +// Kristin is 34 years old. +// Aidan is 1 years old. +// Kristin +// Aidan +// 34 +// 1 +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp new file mode 100644 index 00000000000..6d4e4af244c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dictionary/cpp/remarks.cpp @@ -0,0 +1,44 @@ +using namespace System; +using namespace System::Collections; + +public ref class SimpleDictionary : DictionaryBase +{ +}; + +public ref class DictionaySamples +{ +public: + static void Main() + { + // Create a dictionary that contains no more than three entries. + IDictionary^ myDictionary = gcnew SimpleDictionary(); + + // Add three people and their ages to the dictionary. + myDictionary->Add("Jeff", 40); + myDictionary->Add("Kristin", 34); + myDictionary->Add("Aidan", 1); + // Display every entry's key and value. + for each (DictionaryEntry de in myDictionary) + { + Console::WriteLine("{0} is {1} years old.", de.Key, de.Value); + } + + // Remove an entry that exists. + myDictionary->Remove("Jeff"); + + // Remove an entry that does not exist, but do not throw an exception. + myDictionary->Remove("Max"); + + // + for each (DictionaryEntry de in myDictionary) + { + //... + } + // + } +}; + +int main() +{ + DictionaySamples::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp new file mode 100644 index 00000000000..ad273901016 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DirInfo Class Example/CPP/dirinfo class example.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Specify the directories you want to manipulate. + DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\MyDir" ); + try + { + + // Determine whether the directory exists. + if ( di->Exists ) + { + + // Indicate that the directory already exists. + Console::WriteLine( "That path exists already." ); + return 0; + } + + // Try to create the directory. + di->Create(); + Console::WriteLine( "The directory was created successfully." ); + + // Delete the directory. + di->Delete(); + Console::WriteLine( "The directory was deleted successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp new file mode 100644 index 00000000000..b172c01236b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DirInfo Create/CPP/dirinfo create.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Specify the directories you want to manipulate. + DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\MyDir" ); + try + { + + // Determine whether the directory exists. + if ( di->Exists ) + { + + // Indicate that it already exists. + Console::WriteLine( "That path exists already." ); + return 0; + } + + // Try to create the directory. + di->Create(); + Console::WriteLine( "The directory was created successfully." ); + + // Delete the directory. + di->Delete(); + Console::WriteLine( "The directory was deleted successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp new file mode 100644 index 00000000000..8a3584321aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DirInfo Ctor/CPP/dirinfo ctor.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Specify the directories you want to manipulate. + DirectoryInfo^ di1 = gcnew DirectoryInfo( "c:\\MyDir" ); + DirectoryInfo^ di2 = gcnew DirectoryInfo( "c:\\MyDir\\temp" ); + try + { + + // Create the directories. + di1->Create(); + di2->Create(); + + // This operation will not be allowed because there are subdirectories. + Console::WriteLine( "I am about to attempt to delete {0}.", di1->Name ); + di1->Delete(); + Console::WriteLine( "The Delete operation was successful, which was unexpected." ); + } + catch ( Exception^ ) + { + Console::WriteLine( "The Delete operation failed as expected." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp new file mode 100644 index 00000000000..c0751c822f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DirInfo Delete1/CPP/dirinfo delete1.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Specify the directories you want to manipulate. + DirectoryInfo^ di1 = gcnew DirectoryInfo( "c:\\MyDir" ); + try + { + + // Create the directories. + di1->Create(); + di1->CreateSubdirectory( "temp" ); + + //This operation will not be allowed because there are subdirectories. + Console::WriteLine( "I am about to attempt to delete {0}", di1->Name ); + di1->Delete(); + Console::WriteLine( "The Delete operation was successful, which was unexpected." ); + } + catch ( Exception^ ) + { + Console::WriteLine( "The Delete operation failed as expected." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp b/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp new file mode 100644 index 00000000000..7ecd08dfd25 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DirInfo GetDirs2/CPP/dirinfo getdirs2.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" ); + + // Get only subdirectories that contain the letter "p." + array^dirs = di->GetDirectories( "*p*" ); + Console::WriteLine( "The number of directories containing the letter p is {0}.", dirs->Length ); + Collections::IEnumerator^ myEnum = dirs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DirectoryInfo^ diNext = safe_cast(myEnum->Current); + Console::WriteLine( "The number of files in {0} is {1}", diNext, diNext->GetFiles()->Length ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp new file mode 100644 index 00000000000..550cc864617 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_CreateDir/CPP/dir_createdir.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Specify the directory you want to manipulate. + String^ path = "c:\\MyDir"; + try + { + + // Determine whether the directory exists. + if ( Directory::Exists( path ) ) + { + Console::WriteLine( "That path exists already." ); + return 0; + } + + // Try to create the directory. + DirectoryInfo^ di = Directory::CreateDirectory( path ); + Console::WriteLine( "The directory was created successfully at {0}.", Directory::GetCreationTime( path ) ); + + // Delete the directory. + di->Delete(); + Console::WriteLine( "The directory was deleted successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp new file mode 100644 index 00000000000..86cac85e3fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_GetCreation/CPP/dir_getcreation.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + + // Get the creation time of a well-known directory. + DateTime dt = Directory::GetCreationTime( Environment::CurrentDirectory ); + + // Give feedback to the user. + if ( DateTime::Now.Subtract( dt ).TotalDays > 364 ) + { + Console::WriteLine( "This directory is over a year old." ); + } + else + if ( DateTime::Now.Subtract( dt ).TotalDays > 30 ) + { + Console::WriteLine( "This directory is over a month old." ); + } + else + if ( DateTime::Now.Subtract( dt ).TotalDays <= 1 ) + { + Console::WriteLine( "This directory is less than a day old." ); + } + else + { + Console::WriteLine( "This directory was created on {0}", dt ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp new file mode 100644 index 00000000000..716792cead5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_GetCurDir/CPP/dir_getcurdir.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + + // Get the current directory. + String^ path = Directory::GetCurrentDirectory(); + String^ target = "c:\\temp"; + Console::WriteLine( "The current directory is {0}", path ); + if ( !Directory::Exists( target ) ) + { + Directory::CreateDirectory( target ); + } + + // Change the current directory. + Environment::CurrentDirectory = target; + if ( path->Equals( Directory::GetCurrentDirectory() ) ) + { + Console::WriteLine( "You are in the temp directory." ); + } + else + { + Console::WriteLine( "You are not in the temp directory." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp new file mode 100644 index 00000000000..0896d4ca1b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_GetDirs2/CPP/dir_getdirs2.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + + // Only get subdirectories that begin with the letter "p." + array^dirs = Directory::GetDirectories( "c:\\", "p*" ); + Console::WriteLine( "The number of directories starting with p is {0}.", dirs->Length ); + Collections::IEnumerator^ myEnum = dirs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Console::WriteLine( myEnum->Current ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp new file mode 100644 index 00000000000..95bb8528e02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_GetFiles2/CPP/dir_getfiles2.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + + // Only get files that begin with the letter "c". + array^dirs = Directory::GetFiles( "c:\\", "c*" ); + Console::WriteLine( "The number of files starting with c is {0}.", dirs->Length ); + Collections::IEnumerator^ myEnum = dirs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Console::WriteLine( myEnum->Current ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp new file mode 100644 index 00000000000..d38d877f932 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastAccess/CPP/dir_getlastaccess.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\MyDir"; + if ( !Directory::Exists( path ) ) + { + Directory::CreateDirectory( path ); + } + Directory::SetLastAccessTime( path, DateTime(1985,5,4) ); + + // Get the creation time of a well-known directory. + DateTime dt = Directory::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this directory was {0}", dt ); + + // Update the last access time. + Directory::SetLastAccessTime( path, DateTime::Now ); + dt = Directory::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this directory was {0}", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp new file mode 100644 index 00000000000..75e5bee709d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_GetLastWrite/CPP/dir_getlastwrite.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\MyDir"; + if ( !Directory::Exists( path ) ) + { + Directory::CreateDirectory( path ); + } + else + { + + // Take an action which will affect the write time. + Directory::SetLastWriteTime( path, DateTime(1985,4,3) ); + } + + // Get the creation time of a well-known directory. + DateTime dt = Directory::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this directory was {0}", dt ); + + // Update the last write time. + Directory::SetLastWriteTime( path, DateTime::Now ); + dt = Directory::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this directory was {0}", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp new file mode 100644 index 00000000000..0da03649338 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastAccess/CPP/dir_setlastaccess.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\MyDir"; + if ( !Directory::Exists( path ) ) + { + Directory::CreateDirectory( path ); + } + Directory::SetLastAccessTime( path, DateTime(1985,5,4) ); + + // Get the last access time of a well-known directory. + DateTime dt = Directory::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this directory was {0}", dt ); + + // Update the last access time. + Directory::SetLastAccessTime( path, DateTime::Now ); + dt = Directory::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this directory was {0}", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp new file mode 100644 index 00000000000..45c4c45428c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Dir_SetLastWrite/CPP/dir_setlastwrite.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +void main() +{ + try + { + String^ path = "c:\\MyDir"; + if ( !Directory::Exists( path ) ) + { + Directory::CreateDirectory( path ); + } + else + { + + // Take an action that will affect the write time. + Directory::SetLastWriteTime( path, DateTime(1985,4,3) ); + } + + // Get the last write time of a well-known directory. + DateTime dt = Directory::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this directory was {0}", dt ); + + //Update the last write time. + Directory::SetLastWriteTime( path, DateTime::Now ); + dt = Directory::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this directory was {0}", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp b/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp new file mode 100644 index 00000000000..9647674e17e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/DirectoryInfo Usage Example/CPP/copydirectory.cpp @@ -0,0 +1,36 @@ + +// +using namespace System; +using namespace System::IO; + +// Copy a source directory to a target directory. +void CopyDirectory( String^ SourceDirectory, String^ TargetDirectory ) +{ + DirectoryInfo^ source = gcnew DirectoryInfo( SourceDirectory ); + DirectoryInfo^ target = gcnew DirectoryInfo( TargetDirectory ); + + //Determine whether the source directory exists. + if ( !source->Exists ) + return; + + if ( !target->Exists ) + target->Create(); + + + //Copy files. + array^sourceFiles = source->GetFiles(); + for ( int i = 0; i < sourceFiles->Length; ++i ) + File::Copy( sourceFiles[ i ]->FullName, String::Concat( target->FullName, "\\", sourceFiles[ i ]->Name ), true ); + + //Copy directories. + array^sourceDirectories = source->GetDirectories(); + for ( int j = 0; j < sourceDirectories->Length; ++j ) + CopyDirectory( sourceDirectories[ j ]->FullName, String::Concat( target->FullName, "\\", sourceDirectories[ j ]->Name ) ); +} + +int main() +{ + CopyDirectory( "D:\\Tools", "D:\\NewTools" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp new file mode 100644 index 00000000000..95b5dde57f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Double Example/CPP/source.cpp @@ -0,0 +1,531 @@ +using namespace System; +using namespace System::Globalization; + +namespace Snippets +{ + // + // The Temperature class stores the temperature as a Double + // and delegates most of the functionality to the Double + // implementation. + public ref class Temperature: public IComparable, public IFormattable + { + // IComparable.CompareTo implementation. + public: + virtual int CompareTo( Object^ obj ) + { + if (obj == nullptr) return 1; + + if (dynamic_cast(obj) ) + { + Temperature^ temp = (Temperature^)(obj); + return m_value.CompareTo( temp->m_value ); + } + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + // IFormattable.ToString implementation. + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr ) + { + if ( format->Equals( "F" ) ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + if ( format->Equals( "C" ) ) + { + return String::Format( "{0}'C", this->Celsius.ToString() ); + } + } + return m_value.ToString( format, provider ); + } + + // Parses the temperature from a string in the form + // [ws][sign]digits['F|'C][ws] + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) + { + temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) + { + temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = Double::Parse( s, styles, provider ); + } + return temp; + } + + protected: + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; + // + + ref class Launcher + { + public: + static void Main() + { + Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Float, nullptr ); + Console::WriteLine( t1->ToString( "F", nullptr ) ); + + String^ str1 = t1->ToString( "C", nullptr ); + Console::WriteLine( str1 ); + + Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Float, nullptr ); + Console::WriteLine( t2->ToString( "F", nullptr ) ); + + Console::WriteLine( t1->CompareTo( t2 ) ); + + Temperature^ t3 = Temperature::Parse( "20'C", NumberStyles::Float, nullptr ); + Console::WriteLine( t3->ToString( "F", nullptr ) ); + + Console::WriteLine( t1->CompareTo( t3 ) ); + + Console::ReadLine(); + } + }; +} + +namespace Snippets2 +{ + // + public ref class Temperature + { + public: + static property double MinValue + { + double get() + { + return Double::MinValue; + } + } + + static property double MaxValue + { + double get() + { + return Double::MaxValue; + } + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +namespace Snippets3 +{ + // + public ref class Temperature: public IComparable + { + // IComparable.CompareTo implementation. + public: + virtual int CompareTo( Object^ obj ) + { + if (obj == nullptr) return 1; + + if ( dynamic_cast(obj) ) + { + Temperature^ temp = dynamic_cast(obj); + + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +namespace Snippets4 +{ + // + public ref class Temperature: public IFormattable + { + // IFormattable.ToString implementation. + public: + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr ) + { + if ( format->Equals( "F" ) ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + if ( format->Equals( "C" ) ) + { + return String::Format( "{0}'C", this->Celsius.ToString() ); + } + } + + return m_value.ToString( format, provider ); + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +namespace Snippets5 +{ + // + public ref class Temperature + { + // Parses the temperature from a string in form + // [ws][sign]digits['F|'C][ws] + public: + static Temperature^ Parse( String^ s ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) + { + temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); + } + else + if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) + { + temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); + } + else + { + temp->Value = Double::Parse( s ); + } + + return temp; + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +namespace Snippets6 +{ + // + public ref class Temperature + { + // Parses the temperature from a string in form + // [ws][sign]digits['F|'C][ws] + public: + static Temperature^ Parse( String^ s, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) + { + temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); + } + else + if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) + { + temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); + } + else + { + temp->Value = Double::Parse( s, provider ); + } + + return temp; + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +namespace Snippets7 +{ + // + public ref class Temperature + { + // Parses the temperature from a string in form + // [ws][sign]digits['F|'C][ws] + public: + static Temperature^ Parse( String^ s, NumberStyles styles ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) + { + temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); + } + else + if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) + { + temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); + } + else + { + temp->Value = Double::Parse( s, styles ); + } + + return temp; + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +namespace Snippets8 +{ + // + public ref class Temperature + { + // Parses the temperature from a string in the form + // [ws][sign]digits['F|'C][ws] + public: + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd(nullptr)->EndsWith( "'F" ) ) + { + temp->Value = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + if ( s->TrimEnd(nullptr)->EndsWith( "'C" ) ) + { + temp->Celsius = Double::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = Double::Parse( s, styles, provider ); + } + + return temp; + } + + protected: + // The value holder + double m_value; + + public: + property double Value + { + double get() + { + return m_value; + } + void set( double value ) + { + m_value = value; + } + } + + property double Celsius + { + double get() + { + return (m_value - 32.0) / 1.8; + } + void set( double value ) + { + m_value = 1.8 * value + 32.0; + } + } + }; +// +} + +int main() +{ + Snippets::Launcher::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp new file mode 100644 index 00000000000..6ee946709cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.GetType/CPP/gettype.cpp @@ -0,0 +1,30 @@ +// +using namespace System; + +public ref class MyBaseClass {}; + +public ref class MyDerivedClass: MyBaseClass{}; + +int main() +{ + MyBaseClass^ myBase = gcnew MyBaseClass; + MyDerivedClass^ myDerived = gcnew MyDerivedClass; + Object^ o = myDerived; + MyBaseClass^ b = myDerived; + Console::WriteLine( "mybase: Type is {0}", myBase->GetType() ); + Console::WriteLine( "myDerived: Type is {0}", myDerived->GetType() ); + Console::WriteLine( "object o = myDerived: Type is {0}", o->GetType() ); + Console::WriteLine( "MyBaseClass b = myDerived: Type is {0}", b->GetType() ); +} + +/* + +This code produces the following output. + +mybase: Type is MyBaseClass +myDerived: Type is MyDerivedClass +object o = myDerived: Type is MyDerivedClass +MyBaseClass b = myDerived: Type is MyDerivedClass + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp new file mode 100644 index 00000000000..994eab40042 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ECMA-System.Object.ReferenceEquals/CPP/referenceequals.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +int main() +{ + Object^ o = nullptr; + Object^ p = nullptr; + Object^ q = gcnew Object; + Console::WriteLine( Object::ReferenceEquals( o, p ) ); + p = q; + Console::WriteLine( Object::ReferenceEquals( p, q ) ); + Console::WriteLine( Object::ReferenceEquals( o, p ) ); +} + +/* + +This code produces the following output. + +True +True +False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp new file mode 100644 index 00000000000..0ee3bf8e579 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Emit.ArgIterator/cpp/source.cpp @@ -0,0 +1,111 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +void main() +{ + String^ name = "InMemory"; + + AssemblyBuilder^ asmBldr = + AppDomain::CurrentDomain->DefineDynamicAssembly(gcnew AssemblyName(name), + AssemblyBuilderAccess::Run); + ModuleBuilder^ modBldr = asmBldr->DefineDynamicModule(name); + + TypeBuilder^ tb = modBldr->DefineType("DemoVararg"); + + // Create a vararg method with no return value and one + // string argument. (The string argument type is the only + // element of an array of Type objects.) + // + MethodBuilder^ mb1 = tb->DefineMethod("VarargMethod", + MethodAttributes::Public | MethodAttributes::Static, + CallingConventions::VarArgs, + nullptr, + gcnew array { String::typeid }); + + ILGenerator^ il1 = mb1->GetILGenerator(); + + LocalBuilder^ locAi = il1->DeclareLocal(ArgIterator::typeid); + LocalBuilder^ locNext = il1->DeclareLocal(bool::typeid); + + Label labelCheckCondition = il1->DefineLabel(); + Label labelNext = il1->DefineLabel(); + + // Load the fixed argument and print it. + il1->Emit(OpCodes::Ldarg_0); + il1->Emit(OpCodes::Call, Console::typeid->GetMethod("Write", + gcnew array { String::typeid })); + + // Load the address of the local variable represented by + // locAi, which will hold the ArgIterator. + il1->Emit(OpCodes::Ldloca_S, locAi); + + // Load the address of the argument list, and call the + // ArgIterator constructor that takes an array of runtime + // argument handles. + il1->Emit(OpCodes::Arglist); + il1->Emit(OpCodes::Call, ArgIterator::typeid->GetConstructor( + gcnew array { RuntimeArgumentHandle::typeid })); + + // Enter the loop at the point where the remaining argument + // count is tested. + il1->Emit(OpCodes::Br_S, labelCheckCondition); + + // At the top of the loop, call GetNextArg to get the next + // argument from the ArgIterator. Convert the typed reference + // to an object reference and write the object to the console. + il1->MarkLabel(labelNext); + il1->Emit(OpCodes::Ldloca_S, locAi); + il1->Emit(OpCodes::Call, ArgIterator::typeid->GetMethod("GetNextArg", Type::EmptyTypes)); + il1->Emit(OpCodes::Call, TypedReference::typeid->GetMethod("ToObject")); + il1->Emit(OpCodes::Call, Console::typeid->GetMethod("Write", + gcnew array { Object::typeid })); + + il1->MarkLabel(labelCheckCondition); + il1->Emit(OpCodes::Ldloca_S, locAi); + il1->Emit(OpCodes::Call, ArgIterator::typeid->GetMethod("GetRemainingCount")); + + // If the remaining count is greater than zero, go to + // the top of the loop. + il1->Emit(OpCodes::Ldc_I4_0); + il1->Emit(OpCodes::Cgt); + il1->Emit(OpCodes::Stloc_1); + il1->Emit(OpCodes::Ldloc_1); + il1->Emit(OpCodes::Brtrue_S, labelNext); + + il1->Emit(OpCodes::Ret); + + // Create a method that contains a call to the vararg + // method. + MethodBuilder^ mb2 = tb->DefineMethod("CallVarargMethod", + MethodAttributes::Public | MethodAttributes::Static, + CallingConventions::Standard, + nullptr, Type::EmptyTypes); + + ILGenerator^ il2 = mb2->GetILGenerator(); + + // Push arguments on the stack: one for the fixed string + // parameter, and two for the list. + il2->Emit(OpCodes::Ldstr, "Hello "); + il2->Emit(OpCodes::Ldstr, "world "); + il2->Emit(OpCodes::Ldc_I4, 2006); + + // Call the vararg method, specifying the types of the + // arguments in the list. + il2->EmitCall(OpCodes::Call, mb1, + gcnew array { String::typeid, int::typeid }); + + il2->Emit(OpCodes::Ret); + + Type^ type = tb->CreateType(); + type->GetMethod("CallVarargMethod")->Invoke(nullptr, nullptr); +} + +/* This code example produces the following output: + +Hello world 2006 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp new file mode 100644 index 00000000000..e0695468622 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EmitGenericType/CPP/source.cpp @@ -0,0 +1,300 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Collections::Generic; + +// Dummy class to satisfy TFirst constraints. +// +public ref class Example {}; + +// Define a trivial base class and two trivial interfaces +// to use when demonstrating constraints. +// +public ref class ExampleBase {}; +public interface class IExampleA {}; +public interface class IExampleB {}; + +// Define a trivial type that can substitute for type parameter +// TSecond. +// +public ref class ExampleDerived : ExampleBase, IExampleA, IExampleB {}; + +// List the constraint flags. The GenericParameterAttributes +// enumeration contains two sets of attributes, variance and +// constraints. For this example, only constraints are used. +// +static void ListConstraintAttributes( Type^ t ) +{ + // Mask off the constraint flags. + GenericParameterAttributes constraints = + t->GenericParameterAttributes & + GenericParameterAttributes::SpecialConstraintMask; + + if ((constraints & GenericParameterAttributes::ReferenceTypeConstraint) + != GenericParameterAttributes::None) + Console::WriteLine( L" ReferenceTypeConstraint"); + + if ((constraints & GenericParameterAttributes::NotNullableValueTypeConstraint) + != GenericParameterAttributes::None) + Console::WriteLine( L" NotNullableValueTypeConstraint"); + + if ((constraints & GenericParameterAttributes::DefaultConstructorConstraint) + != GenericParameterAttributes::None) + Console::WriteLine( L" DefaultConstructorConstraint"); +} + +static void DisplayGenericParameters( Type^ t ) +{ + if (!t->IsGenericType) + { + Console::WriteLine( L"Type '{0}' is not generic." ); + return; + } + if (!t->IsGenericTypeDefinition) + t = t->GetGenericTypeDefinition(); + + array^ typeParameters = t->GetGenericArguments(); + Console::WriteLine( L"\r\nListing {0} type parameters for type '{1}'.", + typeParameters->Length, t ); + + for each ( Type^ tParam in typeParameters ) + { + Console::WriteLine( L"\r\nType parameter {0}:", + tParam->ToString() ); + + for each (Type^ c in tParam->GetGenericParameterConstraints()) + { + if (c->IsInterface) + Console::WriteLine( L" Interface constraint: {0}", c); + else + Console::WriteLine( L" Base type constraint: {0}", c); + } + ListConstraintAttributes(tParam); + } +} + +void main() +{ + // Define a dynamic assembly to contain the sample type. The + // assembly will be run and also saved to disk, so + // AssemblyBuilderAccess.RunAndSave is specified. + // + // + AppDomain^ myDomain = AppDomain::CurrentDomain; + AssemblyName^ myAsmName = gcnew AssemblyName( L"GenericEmitExample1" ); + AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( + myAsmName, AssemblyBuilderAccess::RunAndSave ); + // + + // An assembly is made up of executable modules. For a single- + // module assembly, the module name and file name are the same + // as the assembly name. + // + // + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( + myAsmName->Name, String::Concat( myAsmName->Name, L".dll" ) ); + // + + // Get type objects for the base class trivial interfaces to + // be used as constraints. + // + Type^ baseType = ExampleBase::typeid; + Type^ interfaceA = IExampleA::typeid; + Type^ interfaceB = IExampleB::typeid; + + // Define the sample type. + // + // + TypeBuilder^ myType = myModule->DefineType( L"Sample", + TypeAttributes::Public ); + // + + Console::WriteLine( L"Type 'Sample' is generic: {0}", + myType->IsGenericType ); + + // Define type parameters for the type. Until you do this, + // the type is not generic, as the preceding and following + // WriteLine statements show. The type parameter names are + // specified as an array of strings. To make the code + // easier to read, each GenericTypeParameterBuilder is placed + // in a variable with the same name as the type parameter. + // + // + array^typeParamNames = {L"TFirst",L"TSecond"}; + array^typeParams = + myType->DefineGenericParameters( typeParamNames ); + + GenericTypeParameterBuilder^ TFirst = typeParams[0]; + GenericTypeParameterBuilder^ TSecond = typeParams[1]; + // + + Console::WriteLine( L"Type 'Sample' is generic: {0}", + myType->IsGenericType ); + + // Apply constraints to the type parameters. + // + // A type that is substituted for the first parameter, TFirst, + // must be a reference type and must have a parameterless + // constructor. + // + TFirst->SetGenericParameterAttributes( + GenericParameterAttributes::DefaultConstructorConstraint | + GenericParameterAttributes::ReferenceTypeConstraint + ); + // + + // A type that is substituted for the second type + // parameter must implement IExampleA and IExampleB, and + // inherit from the trivial test class ExampleBase. The + // interface constraints are specified as an array + // containing the interface types. + // + array^interfaceTypes = { interfaceA, interfaceB }; + TSecond->SetInterfaceConstraints( interfaceTypes ); + TSecond->SetBaseTypeConstraint( baseType ); + // + + // The following code adds a private field named ExampleField, + // of type TFirst. + // + FieldBuilder^ exField = + myType->DefineField("ExampleField", TFirst, + FieldAttributes::Private); + // + + // Define a static method that takes an array of TFirst and + // returns a List containing all the elements of + // the array. To define this method it is necessary to create + // the type List by calling MakeGenericType on the + // generic type definition, generic List. + // The parameter type is created by using the + // MakeArrayType method. + // + // + Type^ listOf = List::typeid; + Type^ listOfTFirst = listOf->MakeGenericType(TFirst); + array^ mParamTypes = { TFirst->MakeArrayType() }; + + MethodBuilder^ exMethod = + myType->DefineMethod("ExampleMethod", + MethodAttributes::Public | MethodAttributes::Static, + listOfTFirst, + mParamTypes); + // + + // Emit the method body. + // The method body consists of just three opcodes, to load + // the input array onto the execution stack, to call the + // List constructor that takes IEnumerable, + // which does all the work of putting the input elements into + // the list, and to return, leaving the list on the stack. The + // hard work is getting the constructor. + // + // The GetConstructor method is not supported on a + // GenericTypeParameterBuilder, so it is not possible to get + // the constructor of List directly. There are two + // steps, first getting the constructor of generic List and then + // calling a method that converts it to the corresponding + // constructor of List. + // + // The constructor needed here is the one that takes an + // IEnumerable. Note, however, that this is not the + // generic type definition of generic IEnumerable; instead, the + // T from generic List must be substituted for the T of + // generic IEnumerable. (This seems confusing only because both + // types have type parameters named T. That is why this example + // uses the somewhat silly names TFirst and TSecond.) To get + // the type of the constructor argument, take the generic + // type definition generic IEnumerable and + // call MakeGenericType with the first generic type parameter + // of generic List. The constructor argument list must be passed + // as an array, with just one argument in this case. + // + // Now it is possible to get the constructor of generic List, + // using GetConstructor on the generic type definition. To get + // the constructor of List, pass List and + // the constructor from generic List to the static + // TypeBuilder.GetConstructor method. + // + // + ILGenerator^ ilgen = exMethod->GetILGenerator(); + + Type^ ienumOf = IEnumerable::typeid; + Type^ TfromListOf = listOf->GetGenericArguments()[0]; + Type^ ienumOfT = ienumOf->MakeGenericType(TfromListOf); + array^ ctorArgs = {ienumOfT}; + + ConstructorInfo^ ctorPrep = listOf->GetConstructor(ctorArgs); + ConstructorInfo^ ctor = + TypeBuilder::GetConstructor(listOfTFirst, ctorPrep); + + ilgen->Emit(OpCodes::Ldarg_0); + ilgen->Emit(OpCodes::Newobj, ctor); + ilgen->Emit(OpCodes::Ret); + // + + // Create the type and save the assembly. + // + Type^ finished = myType->CreateType(); + myAssembly->Save( String::Concat( myAsmName->Name, L".dll" ) ); + // + + // Invoke the method. + // ExampleMethod is not generic, but the type it belongs to is + // generic, so in order to get a MethodInfo that can be invoked + // it is necessary to create a constructed type. The Example + // class satisfies the constraints on TFirst, because it is a + // reference type and has a default constructor. In order to + // have a class that satisfies the constraints on TSecond, + // this code example defines the ExampleDerived type. These + // two types are passed to MakeGenericMethod to create the + // constructed type. + // + // + array^ typeArgs = + { Example::typeid, ExampleDerived::typeid }; + Type^ constructed = finished->MakeGenericType(typeArgs); + MethodInfo^ mi = constructed->GetMethod("ExampleMethod"); + // + + // Create an array of Example objects, as input to the generic + // method. This array must be passed as the only element of an + // array of arguments. The first argument of Invoke is + // null, because ExampleMethod is static. Display the count + // on the resulting List. + // + // + array^ input = { gcnew Example(), gcnew Example() }; + array^ arguments = { input }; + + List^ listX = + (List^) mi->Invoke(nullptr, arguments); + + Console::WriteLine( + "\nThere are {0} elements in the List.", + listX->Count); + // + + DisplayGenericParameters(finished); +} + +/* This code example produces the following output: + +Type 'Sample' is generic: False +Type 'Sample' is generic: True + +There are 2 elements in the List. + +Listing 2 type parameters for type 'Sample[TFirst,TSecond]'. + +Type parameter TFirst: + ReferenceTypeConstraint + DefaultConstructorConstraint + +Type parameter TSecond: + Interface constraint: IExampleA + Interface constraint: IExampleB + Base type constraint: ExampleBase + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp new file mode 100644 index 00000000000..3f5ffdf0349 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor1/CPP/entrywritteneventargs_ctor1.cpp @@ -0,0 +1,49 @@ +// System::Diagnostics::EntryWrittenEventArgs::ctor() + +/* +The following example demonstrates 'EntryWrittenEventArgs ()' +constructor of the 'EntryWrittenEventArgs' class. It creates a custom 'EventLog' +and writes an entry into it. Then creates an 'EntryWrittenEventArgs' Object* +using the first entry in the custom eventlog. This Object* is used to notify a message +*/ + +// +#using + +using namespace System; +using namespace System::Diagnostics; + +void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e ) +{ + if ( !e->Entry ) + Console::WriteLine( "A new entry is written in MyNewLog." ); +} + +int main() +{ + try + { + EventLog^ myNewLog = gcnew EventLog; + myNewLog->Log = "MyNewLog"; + myNewLog->Source = "MySource"; + + // Create the source if it does not exist already. + if ( !EventLog::SourceExists( "MySource" ) ) + { + EventLog::CreateEventSource( "MySource", "MyNewLog" ); + Console::WriteLine( "CreatingEventSource" ); + } + + // Write an entry to the EventLog. + myNewLog->WriteEntry( "The Latest entry in the Event Log" ); + int myEntries = myNewLog->Entries->Count; + EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ]; + EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs; + MyOnEntry( myNewLog, myEntryEventArgs ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Raised{0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp new file mode 100644 index 00000000000..96f9f0f008b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EntryWrittenEventArgs_ctor2/CPP/entrywritteneventargs_ctor2.cpp @@ -0,0 +1,59 @@ +// System::Diagnostics::EntryWrittenEventArgs::ctor(EventLogEntry) +// System::Diagnostics::EntryWrittenEventArgs::Entry + +/* +The following example demonstrates the 'Entry' property and EntryWrittenEventArgs (EventLogEntry) +constructor of the 'EntryWrittenEventArgs' class. It creates a custom 'EventLog' and writes an +entry into it. Then creates an 'EntryWrittenEventArgs' Object* using the first entry in the custom +eventlog. This Object* is used to notify a message +*/ + +// +#using + +using namespace System; +using namespace System::Diagnostics; + +// +void MyOnEntry( Object^ source, EntryWrittenEventArgs^ e ) +{ + EventLogEntry^ myEventLogEntry = e->Entry; + if ( myEventLogEntry ) + { + Console::WriteLine( "Current message entry is: '{0}'", myEventLogEntry->Message ); + } + else + { + Console::WriteLine( "The current entry is null" ); + } +} +// + +int main() +{ + try + { + EventLog^ myNewLog = gcnew EventLog; + myNewLog->Log = "MyNewLog"; + myNewLog->Source = "MySource"; + + // Create the source if it does not exist already. + if ( !EventLog::SourceExists( "MySource" ) ) + { + EventLog::CreateEventSource( "MySource", "MyNewLog" ); + Console::WriteLine( "CreatingEventSource" ); + } + + // Write an entry to the EventLog. + myNewLog->WriteEntry( "The Latest entry in the Event Log" ); + int myEntries = myNewLog->Entries->Count; + EventLogEntry^ entry = myNewLog->Entries[ myEntries - 1 ]; + EntryWrittenEventArgs^ myEntryEventArgs = gcnew EntryWrittenEventArgs( entry ); + MyOnEntry( myNewLog, myEntryEventArgs ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Raised {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp new file mode 100644 index 00000000000..47c3f438a04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_4.cs/CPP/enumbuilder_properties_4.cpp @@ -0,0 +1,87 @@ + +// System.Reflection.Emit.EnumBuilder.TypeToken +// System.Reflection.Emit.EnumBuilder.UnderlyingField +// System.Reflection.Emit.EnumBuilder.UnderlyingSystemType +// System.Reflection.Emit.EnumBuilder.GUID +/* The following program demonstrates 'TypeToken', 'UnderlyingField', + 'UnderlyingSystemType' and ''GUID' properties of + 'System.Reflection.Emit.EnumBuilder' class. This example defines + a class 'MyEnumBuilderSample'. The main function calls the CreateCalle + method in which the 'EnumBuilder' class and its fields are constructed. + The output of the 'EnumBuilder' properties are displayed on the console + in the main method. */ +// +// +// +// +using namespace System; +using namespace System::Collections; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +public ref class MyEnumBuilderSample +{ +private: + static AssemblyBuilder^ myAssemblyBuilder; + static ModuleBuilder^ myModuleBuilder; + static EnumBuilder^ myEnumBuilder; + +public: + static void Main() + { + try + { + CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save ); + array^myTypeArray = myModuleBuilder->GetTypes(); + IEnumerator^ myEnum = myTypeArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ myType = safe_cast(myEnum->Current); + Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name ); + } + Console::WriteLine( "Enum TypeToken is :{0}", myEnumBuilder->TypeToken ); + Console::WriteLine( "Enum UnderLyingField is :{0}", myEnumBuilder->UnderlyingField ); + Console::WriteLine( "Enum UnderLyingSystemType is :{0}", myEnumBuilder->UnderlyingSystemType ); + Console::WriteLine( "Enum GUID is :{0}", myEnumBuilder->GUID ); + myAssemblyBuilder->Save( "EmittedAssembly.dll" ); + } + catch ( NotSupportedException^ ex ) + { + Console::WriteLine( "The following is the exception is raised: {0}", ex->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following is the exception raised: {0}", e->Message ); + } + } + + +private: + static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ ) + { + // Create a name for the assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Create the dynamic assembly. + myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); + + // Create a dynamic module. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); + + // Create a dynamic Enum. + myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); + FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); + FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); + myEnumBuilder->CreateType(); + } +}; + +int main() +{ + MyEnumBuilderSample::Main(); +} +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp new file mode 100644 index 00000000000..e210b66486f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_Properties_5/CPP/enumbuilder_properties_5.cpp @@ -0,0 +1,92 @@ + +// System.Reflection.Emit.EnumBuilder.Assembly +// System.Reflection.Emit.EnumBuilder.AssemblyQualifiedName +// System.Reflection.Emit.EnumBuilder.Module +// System.Reflection.Emit.EnumBuilder.Name +// System.Reflection.Emit.EnumBuilder.Namespace +/* The following program demonstrates 'Assembly', 'AssemblyQualifiedName', + 'Module', 'Name' and 'Namespace' properties of + 'System.Reflection.Emit.EnumBuilder' class. This example defines a + class 'MyEnumBuilderSample'. The main function calls the CreateCalle + method in which the 'EnumBuilder' class and its fields are constructed. + The output of the 'EnumBuilder' properties are displayed on the console + in the main method. */ +// +// +// +// +// +using namespace System; +using namespace System::Collections; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class MyEnumBuilderSample +{ +private: + static AssemblyBuilder^ myAssemblyBuilder; + static ModuleBuilder^ myModuleBuilder; + static EnumBuilder^ myEnumBuilder; + +public: + static void Main() + { + try + { + CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::Save ); + array^myTypeArray = myModuleBuilder->GetTypes(); + IEnumerator^ myEnum = myTypeArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ myType = safe_cast(myEnum->Current); + Console::WriteLine( "Enum Builder defined in the module builder is: {0}", myType->Name ); + } + Console::WriteLine( "Properties of EnumBuilder : " ); + Console::WriteLine( "Enum Assembly is :{0}", myEnumBuilder->Assembly ); + Console::WriteLine( "Enum AssemblyQualifiedName is :{0}", myEnumBuilder->AssemblyQualifiedName ); + Console::WriteLine( "Enum Module is :{0}", myEnumBuilder->Module ); + Console::WriteLine( "Enum Name is :{0}", myEnumBuilder->Name ); + Console::WriteLine( "Enum NameSpace is :{0}", myEnumBuilder->Namespace ); + myAssemblyBuilder->Save( "EmittedAssembly.dll" ); + } + catch ( NotSupportedException^ ex ) + { + Console::WriteLine( "The following is the exception is raised: {0}", ex->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following is the exception raised: {0}", e->Message ); + } + } + +private: + static void CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess /*access*/ ) + { + // Create a name for the assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Create the dynamic assembly. + myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); + + // Create a dynamic module. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); + + // Create a dynamic Enum. + myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); + FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); + FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); + myEnumBuilder->CreateType(); + } +}; + +int main() +{ + MyEnumBuilderSample::Main(); +} +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp new file mode 100644 index 00000000000..6fa6db382ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute1/CPP/enumbuilder_setcustomattribute1.cpp @@ -0,0 +1,107 @@ + +// System.Reflection.Emit.EnumBuilder +// System.Reflection.Emit.EnumBuilder.IsDefined() +// System.Reflection.Emit.EnumBuilder.GetCustomAttributes(Type, bool) +// System.Reflection.Emit.EnumBuilder.SetCustomAttribute(CustomAttributeBuilder) +/* + The following program demonstrates the EnumBuilder class and + its methods 'IsDefined', 'GetCustomAttributes(Type, bool)' and + 'SetCustomAttribute(CustomAttributeBuilder)'. It defines a 'MyAttribute' + class which is derived from 'System.Attribute' class. It builds an Enum + and sets 'MyAttribute' as custom attribute to the Enum. It gets the + custom attributes of the Enum type and displays its contents on the console. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute: public Attribute +{ +public: + String^ myString; + int myInteger; + MyAttribute( String^ myString1, int myInteger1 ) + { + this->myString = myString1; + this->myInteger = myInteger1; + } + +}; + +ref class MyApplication +{ +private: + static AssemblyBuilder^ myAssemblyBuilder; + static EnumBuilder^ myEnumBuilder; + +public: + static void Main() + { + try + { + CreateCallee( Thread::GetDomain() ); + if ( myEnumBuilder->IsDefined( MyAttribute::typeid, false ) ) + { + array^myAttributesArray = myEnumBuilder->GetCustomAttributes( MyAttribute::typeid, false ); + Console::WriteLine( "Custom attribute contains: " ); + + // Read the attributes and display them on the console. + for ( int index = 0; index < myAttributesArray->Length; index++ ) + { + if ( dynamic_cast(myAttributesArray[ index ]) ) + { + Console::WriteLine( "The value of myString is: {0}", (dynamic_cast(myAttributesArray[ index ]))->myString ); + Console::WriteLine( "The value of myInteger is: {0}", (dynamic_cast(myAttributesArray[ index ]))->myInteger ); + } + } + } + else + { + Console::WriteLine( "Custom Attributes are not set for the EnumBuilder" ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception is raised:{0}", e->Message ); + } + + } + +private: + static void CreateCallee( AppDomain^ domain ) + { + // Create a name for the assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Create the dynamic assembly. + myAssemblyBuilder = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + Type^ myType = MyAttribute::typeid; + array^temp0 = {String::typeid,int::typeid}; + ConstructorInfo^ myInfo = myType->GetConstructor( temp0 ); + array^temp1 = {"Hello",2}; + CustomAttributeBuilder^ myCustomAttributeBuilder = gcnew CustomAttributeBuilder( myInfo,temp1 ); + + // Create a dynamic module. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" ); + + // Create a dynamic Enum. + myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); + FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); + FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); + myEnumBuilder->CreateType(); + myEnumBuilder->SetCustomAttribute( myCustomAttributeBuilder ); + } +}; + +int main() +{ + MyApplication::Main(); +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp new file mode 100644 index 00000000000..2e1b90bdfc9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EnumBuilder_SetCustomAttribute2/CPP/enumbuilder_setcustomattribute2.cpp @@ -0,0 +1,93 @@ + +// System.Reflection.Emit.EnumBuilder.GetCustomAttributes(bool) +// System.Reflection.Emit.EnumBuilder.SetCustomAttribute(ConstructorInfo, byte[]) +/* + The following program demonstrates 'GetCustomAttributes(bool)' + and 'SetCustomAttribute(ConstructorInfo, byte[])' methods of + 'System.Reflection.Emit.EnumBuilder' class. It defines 'MyAttribute' + class which is derived from 'System.Attribute' class. It builds an + Enum and sets 'MyAttribute' as custom attribute to the Enum. + It gets the custom attributes of the Enum type and displays its contents + on the console. +*/ +// +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute: public Attribute +{ +public: + bool myBoolValue; + MyAttribute( bool myBool ) + { + this->myBoolValue = myBool; + } +}; + +ref class MyApplication +{ +private: + static EnumBuilder^ myEnumBuilder; + +public: + static void Main() + { + try + { + CreateCallee( Thread::GetDomain() ); + array^myAttributesArray = myEnumBuilder->GetCustomAttributes( true ); + + // Read the attributes and display them on the console. + Console::WriteLine( "Custom attribute contains: " ); + for ( int index = 0; index < myAttributesArray->Length; index++ ) + { + if ( dynamic_cast(myAttributesArray[ index ]) ) + { + Console::WriteLine( "myBoolValue: {0}", (dynamic_cast(myAttributesArray[ index ]))->myBoolValue ); + } + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception is raised:{0}", e->Message ); + } + + } + +private: + static void CreateCallee( AppDomain^ domain ) + { + AssemblyName^ myAssemblyName = gcnew AssemblyName; + + // Create a name for the assembly. + myAssemblyName->Name = "EmittedAssembly"; + + // Create the dynamic assembly. + AssemblyBuilder^ myAssemblyBuilder = domain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + Type^ myType = MyAttribute::typeid; + array^temp0 = {bool::typeid}; + ConstructorInfo^ myInfo = myType->GetConstructor( temp0 ); + + // Create a dynamic module. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" ); + + // Create a dynamic Enum. + myEnumBuilder = myModuleBuilder->DefineEnum( "MyNamespace.MyEnum", TypeAttributes::Public, Int32::typeid ); + FieldBuilder^ myFieldBuilder1 = myEnumBuilder->DefineLiteral( "FieldOne", 1 ); + FieldBuilder^ myFieldBuilder2 = myEnumBuilder->DefineLiteral( "FieldTwo", 2 ); + myEnumBuilder->CreateType(); + array^temp1 = {01,00,01}; + myEnumBuilder->SetCustomAttribute( myInfo, temp1 ); + } +}; + +int main() +{ + MyApplication::Main(); +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp new file mode 100644 index 00000000000..91579bc8326 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.GetCommandLineArgs/CPP/getcommandlineargs.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; + +int main() +{ + Console::WriteLine(); + + // Invoke this sample with an arbitrary set of command line arguments. + array^ arguments = Environment::GetCommandLineArgs(); + Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) ); +} +/* +This example produces output like the following: + + C:\>GetCommandLineArgs ARBITRARY TEXT + + GetCommandLineArgs: GetCommandLineArgs, ARBITRARY, TEXT +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp new file mode 100644 index 00000000000..e99e9275e62 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.GetEnvironmentVariables/CPP/getenvironmentvariables.cpp @@ -0,0 +1,16 @@ + +// +using namespace System; +using namespace System::Collections; + +int main() +{ + Console::WriteLine( "GetEnvironmentVariables: " ); + for each (DictionaryEntry^ de in Environment::GetEnvironmentVariables()) + Console::WriteLine( " {0} = {1}", de->Key, de->Value ); +} +// Output from the example is not shown, since it is: +// Lengthy. +// Specific to the machine on which the example is run. +// May reveal information that should remain secure. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp new file mode 100644 index 00000000000..724d32024ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.GetFolderPath/CPP/getfolderpath.cpp @@ -0,0 +1,16 @@ + +// +// Sample for the Environment::GetFolderPath method +using namespace System; +int main() +{ + Console::WriteLine(); + Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) ); +} + +/* +This example produces the following results: + +GetFolderPath: C:\WINNT\System32 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp new file mode 100644 index 00000000000..214308f0a70 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.GetLogicalDrives/CPP/getlogicaldrives.cpp @@ -0,0 +1,17 @@ + +// +// Sample for the Environment::GetLogicalDrives method +using namespace System; +int main() +{ + Console::WriteLine(); + array^drives = Environment::GetLogicalDrives(); + Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) ); +} + +/* +This example produces the following results: + +GetLogicalDrives: A:\, C:\, D:\ +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp new file mode 100644 index 00000000000..344e571ae41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.MachineName/CPP/machinename.cpp @@ -0,0 +1,19 @@ + +// +// Sample for the Environment::MachineName property +using namespace System; +int main() +{ + Console::WriteLine(); + + // <-- Keep this information secure! --> + Console::WriteLine( "MachineName: {0}", Environment::MachineName ); +} + +/* +This example produces the following results: +(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) + +MachineName: !---OMITTED---! +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp new file mode 100644 index 00000000000..f1681245632 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.NewLine/CPP/newline.cpp @@ -0,0 +1,18 @@ +// +// Sample for the Environment::NewLine property +using namespace System; + +int main() +{ + Console::WriteLine(); + Console::WriteLine("NewLine: {0} first line {0} second line", Environment::NewLine); +} + +/* +This example produces the following results: + +NewLine: +first line +second line +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp new file mode 100644 index 00000000000..b6f0511a800 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.StackTrace/CPP/stacktrace.cpp @@ -0,0 +1,19 @@ + +// +// Sample for the Environment::StackTrace property +using namespace System; +int main() +{ + Console::WriteLine(); + Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); +} + +/* +This example produces the following results: + +StackTrace: ' at System::Environment::GetStackTrace(Exception e) +at System::Environment::GetStackTrace(Exception e) +at System::Environment::get_StackTrace() +at Sample::Main()' +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp new file mode 100644 index 00000000000..687b4f85405 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.SystemDirectory/CPP/systemdirectory.cpp @@ -0,0 +1,18 @@ + +// +// Sample for the Environment::SystemDirectory property +using namespace System; +int main() +{ + Console::WriteLine(); + + // <-- Keep this information secure! --> + Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory ); +} + +/* +This example produces the following results: + +SystemDirectory: C:\WINNT\System32 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp new file mode 100644 index 00000000000..009bcb3a1d1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.TickCount/CPP/tickcount.cpp @@ -0,0 +1,20 @@ + +// +// Sample for the Environment::TickCount property +// TickCount cycles between Int32::MinValue, which is a negative +// number, and Int32::MaxValue once every 49.8 days. This sample +// removes the sign bit to yield a nonnegative number that cycles +// between zero and Int32::MaxValue once every 24.9 days. +using namespace System; +int main() +{ + int result = Environment::TickCount & Int32::MaxValue; + Console::WriteLine( "TickCount: {0}", result ); +} + +/* +This example produces an output similar to the following: + +TickCount: 101931139 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp new file mode 100644 index 00000000000..b3fe458162d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.UserInteractive/CPP/userinteractive.cpp @@ -0,0 +1,16 @@ + +// +// Sample for the Environment::UserInteractive property +using namespace System; +int main() +{ + Console::WriteLine(); + Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive ); +} + +/* +This example produces the following results: + +UserInteractive: True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp new file mode 100644 index 00000000000..9fd924b3c30 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.UserName/CPP/username.cpp @@ -0,0 +1,13 @@ + +// +// Sample for the Environment::UserName property +using namespace System; +int main() +{ + Console::WriteLine(); + + // <-- Keep this information secure! --> + Console::WriteLine( "UserName: {0}", Environment::UserName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp new file mode 100644 index 00000000000..cba784628bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.Version/CPP/version.cpp @@ -0,0 +1,17 @@ + +// +// Sample for the Environment::Version property +using namespace System; +int main() +{ + Console::WriteLine(); + Console::WriteLine( "Version: {0}", Environment::Version ); +} + +/* +This example produces the following results: +(Any result that is lengthy, specific to the machine on which this sample was tested, or reveals information that should remain secure, has been omitted and marked S"!---OMITTED---!".) + +Version: !---OMITTED---! +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp b/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp new file mode 100644 index 00000000000..10d59ac8fe5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Environment.WorkingSet/CPP/workingset.cpp @@ -0,0 +1,15 @@ + +// +// Sample for the Environment::WorkingSet property +using namespace System; +int main() +{ + Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet ); +} + +/* +This example produces the following results: + +WorkingSet: 5038080 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp b/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp new file mode 100644 index 00000000000..1b826c1f2bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventArg/CPP/eventarg.cpp @@ -0,0 +1,29 @@ + +// +// The following example uses instances of classes in +// the System::Reflection namespace to discover an event argument type. +using namespace System; +using namespace System::Reflection; + +public delegate void MyDelegate( int i ); +public ref class MainClass +{ +public: + event MyDelegate^ ev; +}; + +int main() +{ + Type^ delegateType = MainClass::typeid->GetEvent( "ev" )->EventHandlerType; + MethodInfo^ invoke = delegateType->GetMethod( "Invoke" ); + array^pars = invoke->GetParameters(); + System::Collections::IEnumerator^ myEnum = pars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + ParameterInfo^ p = safe_cast(myEnum->Current); + Console::WriteLine( p->ParameterType ); + } +} +// The example displays the following output: +// System.Int32 +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp new file mode 100644 index 00000000000..54a15c9b13c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLogEntryType_6/CPP/eventlogentrytype_6.cpp @@ -0,0 +1,110 @@ + + +// System::Diagnostics::EventLogEntryType +// System::Diagnostics::EventLogEntryType::Error +// System::Diagnostics::EventLogEntryType::Warning +// System::Diagnostics::EventLogEntryType::Information +// System::Diagnostics::EventLogEntryType::FailureAudit +// System::Diagnostics::EventLogEntryType::SuccessAudit +/* The following program demonstrates 'Error', 'Warning', +'Information', 'FailureAudit' and 'SuccessAudit' members of +'EventLogEntryType' enumerator. It creates new source with a +specified event log, new ID, EventLogEntryType and message, +if does not exist. +*/ +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Runtime::Serialization; +void main() +{ + try + { + EventLog^ myEventLog; + String^ mySource = nullptr; + String^ myLog = nullptr; + String^ myType = nullptr; + String^ myMessage = "A new event is created."; + String^ myEventID = nullptr; + int myIntLog = 0; + int myID = 0; + Console::Write( "Enter source name for new event (eg: Print): " ); + mySource = Console::ReadLine(); + Console::Write( "Enter log name in which to write an event(eg: System): " ); + myLog = Console::ReadLine(); + Console::WriteLine( "" ); + Console::WriteLine( " Select type of event to write:" ); + Console::WriteLine( " 1. Error " ); + Console::WriteLine( " 2. Warning" ); + Console::WriteLine( " 3. Information" ); + Console::WriteLine( " 4. FailureAudit" ); + Console::WriteLine( " 5. SuccessAudit" ); + Console::Write( "Enter the choice(eg. 1): " ); + myType = Console::ReadLine(); + myIntLog = Convert::ToInt32( myType ); + Console::Write( "Enter ID with which to write an event(eg: 0-65535): " ); + myEventID = Console::ReadLine(); + myID = Convert::ToInt32( myEventID ); + + // + // Check whether source exist in event log. + if ( !EventLog::SourceExists( mySource ) ) + { + + // Create a new source in a specified log on a system. + EventLog::CreateEventSource( mySource, myLog ); + } + + // Create an event log instance.* myEventLog = new EventLog(myLog); + // Initialize source property of obtained instance. + myEventLog->Source = mySource; + switch ( myIntLog ) + { + case 1: + + // Write an 'Error' entry in specified log of event log. + myEventLog->WriteEntry( myMessage, EventLogEntryType::Error, myID ); + break; + + case 2: + + // Write a 'Warning' entry in specified log of event log. + myEventLog->WriteEntry( myMessage, EventLogEntryType::Warning, myID ); + break; + + case 3: + + // Write an 'Information' entry in specified log of event log. + myEventLog->WriteEntry( myMessage, EventLogEntryType::Information, myID ); + break; + + case 4: + + // Write a 'FailureAudit' entry in specified log of event log. + myEventLog->WriteEntry( myMessage, EventLogEntryType::FailureAudit, myID ); + break; + + case 5: + + // Write a 'SuccessAudit' entry in specified log of event log. + myEventLog->WriteEntry( myMessage, EventLogEntryType::SuccessAudit, myID ); + break; + + default: + Console::WriteLine( "Error: Failed to create an event in event log." ); + break; + } + Console::WriteLine( "A new event in log '{0}' with ID '{1}' is successfully written into event log.", myEventLog->Log, myID ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp new file mode 100644 index 00000000000..6cb7dbb7107 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_CopyTo/CPP/eventlogentry_copyto.cpp @@ -0,0 +1,72 @@ +// System::Diagnostics::EventLogEntryCollection +// System::Diagnostics::EventLogEntryCollection::CopyTo(EventLogEntry->Item[],int) + +/* +The following example demonstrates the EventLogEntryCollection class and the +CopyTo method of EventLogEntryCollection class. A new Source for eventlog 'MyNewLog' +is created. A new entry is created for 'MyNewLog'. The entries of EventLog are copied +to an Array. +*/ + +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Diagnostics; +int main() +{ + try + { + String^ myLogName = "MyNewLog"; + + // Check if the source exists. + if ( !EventLog::SourceExists( "MySource" ) ) + { + //Create source. + EventLog::CreateEventSource( "MySource", myLogName ); + Console::WriteLine( "Creating EventSource" ); + } + else + myLogName = EventLog::LogNameFromSourceName( "MySource", "." ); + + // Get the EventLog associated if the source exists. + // Create an EventLog instance and assign its source. + EventLog^ myEventLog2 = gcnew EventLog; + myEventLog2->Source = "MySource"; + + // Write an informational entry to the event log. + myEventLog2->WriteEntry( "Successfully created a new Entry in the Log" ); + myEventLog2->Close(); + + // Create a new EventLog Object*. + EventLog^ myEventLog1 = gcnew EventLog; + myEventLog1->Log = myLogName; + + // Obtain the Log Entries of S"MyNewLog". + EventLogEntryCollection^ myEventLogEntryCollection = myEventLog1->Entries; + myEventLog1->Close(); + Console::WriteLine( "The number of entries in 'MyNewLog' = {0}", myEventLogEntryCollection->Count ); + + // Display the 'Message' property of EventLogEntry. + for ( int i = 0; i < myEventLogEntryCollection->Count; i++ ) + { + Console::WriteLine( "The Message of the EventLog is : {0}", myEventLogEntryCollection[ i ]->Message ); + } + + // Copy the EventLog entries to Array of type EventLogEntry. + array^myEventLogEntryArray = gcnew array(myEventLogEntryCollection->Count); + myEventLogEntryCollection->CopyTo( myEventLogEntryArray, 0 ); + IEnumerator^ myEnumerator = myEventLogEntryArray->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + { + EventLogEntry^ myEventLogEntry = safe_cast(myEnumerator->Current); + Console::WriteLine( "The LocalTime the Event is generated is {0}", myEventLogEntry->TimeGenerated ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp new file mode 100644 index 00000000000..60cc220d29d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Item/CPP/eventlogentry_item.cpp @@ -0,0 +1,67 @@ +// System::Diagnostics::EventLogEntryCollection->Count +// System::Diagnostics::EventLogEntryCollection::Item + +/* +The following example demonstrates 'Item','Count' properties of +EventLogEntryCollection class. A new Source for eventlog 'MyNewLog' is created. +The program checks if a Event source exists. If the source already exists, it gets +the Log name associated with it otherwise, creates a new event source. +A new entry is created for 'MyNewLog'.Entries of 'MyNewLog' are obtained and +the count and the messages are displayed. + +*/ + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Diagnostics; + +void main() +{ + try + { + String^ myLogName = "MyNewLog"; + + // Check if the source exists. + if ( !EventLog::SourceExists( "MySource" ) ) + { + + //Create source. + EventLog::CreateEventSource( "MySource", myLogName ); + Console::WriteLine( "Creating EventSource" ); + } + else + myLogName = EventLog::LogNameFromSourceName( "MySource", "." ); + + // Get the EventLog associated if the source exists. + // Create an EventLog instance and assign its source. + EventLog^ myEventLog2 = gcnew EventLog; + myEventLog2->Source = "MySource"; + + //Write an entry to the event log. + myEventLog2->WriteEntry( "Successfully created a new Entry in the Log. " ); + + // + // + // Create a new EventLog object. + EventLog^ myEventLog1 = gcnew EventLog; + myEventLog1->Log = myLogName; + + // Obtain the Log Entries of the Event Log + EventLogEntryCollection^ myEventLogEntryCollection = myEventLog1->Entries; + Console::WriteLine( "The number of entries in 'MyNewLog' = {0}", myEventLogEntryCollection->Count ); + + // Display the 'Message' property of EventLogEntry. + for ( int i = 0; i < myEventLogEntryCollection->Count; i++ ) + { + Console::WriteLine( "The Message of the EventLog is : {0}", myEventLogEntryCollection[ i ]->Message ); + } + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught! {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp new file mode 100644 index 00000000000..2c9c0d22442 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLogEntry_Source/CPP/eventlogentry_source.cpp @@ -0,0 +1,65 @@ +// System::Diagnostics::EventLogEntry::EntryType +// System::Diagnostics::EventLogEntry::Source + +/* +The following example demonstrates the properties 'EntryType' and 'Source' +of the class 'EventLogEntry'. +A new instance of 'EventLog' class is created and is associated to existing +System Log file of local machine. User selects the event type and the latest +entry in the log file of that type and it's source is displayed. +*/ + +// +// +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + String^ myEventType = nullptr; + + // Associate the instance of 'EventLog' with local System Log. + EventLog^ myEventLog = gcnew EventLog( "System","." ); + Console::WriteLine( "1:Error" ); + Console::WriteLine( "2:Information" ); + Console::WriteLine( "3:Warning" ); + Console::WriteLine( "Select the Event Type" ); + int myOption = Convert::ToInt32( Console::ReadLine() ); + switch ( myOption ) + { + case 1: + myEventType = "Error"; + break; + + case 2: + myEventType = "Information"; + break; + + case 3: + myEventType = "Warning"; + break; + + default: + break; + } + EventLogEntryCollection^ myLogEntryCollection = myEventLog->Entries; + int myCount = myLogEntryCollection->Count; + + // Iterate through all 'EventLogEntry' instances in 'EventLog'. + for ( int i = myCount - 1; i > -1; i-- ) + { + EventLogEntry^ myLogEntry = myLogEntryCollection[ i ]; + + // Select the entry having desired EventType. + if ( myLogEntry->EntryType.Equals( myEventType ) ) + { + // Display Source of the event. + Console::WriteLine( "{0} was the source of last event of type {1}", myLogEntry->Source, myLogEntry->EntryType ); + return 0; + } + } +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp new file mode 100644 index 00000000000..24f99e2bd0d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLogInstaller/CPP/eventloginstaller.cpp @@ -0,0 +1,50 @@ +// System.Diagnostics.EventLogInstaller + +// The following example demonstrates the EventLogInstaller class. +// It defines the instance MyEventLogInstaller with the +// attribute RunInstallerAttribute. +// +// The Log and Source properties of the new instance are set, +// and the instance is added to the Installers collection. +// +// Note: +// 1) Run this program using the following command: +// InstallUtil.exe +// 2) Uninstall the event log created in step 1 using the +// following command: +// InstallUtil.exe /u + +// +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Diagnostics; +using namespace System::ComponentModel; + +[RunInstaller(true)] +ref class MyEventLogInstaller: public Installer +{ +private: + EventLogInstaller^ myEventLogInstaller; + +public: + MyEventLogInstaller() + { + // Create an instance of an EventLogInstaller. + myEventLogInstaller = gcnew EventLogInstaller; + + // Set the source name of the event log. + myEventLogInstaller->Source = "NewLogSource"; + + // Set the event log that the source writes entries to. + myEventLogInstaller->Log = "MyNewLog"; + + // Add myEventLogInstaller to the Installer collection. + Installers->Add( myEventLogInstaller ); + } +}; +// + +void main(){} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp new file mode 100644 index 00000000000..f89e23b187c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLogProperties/CPP/source.cpp @@ -0,0 +1,187 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Globalization; +using namespace System::IO; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace Microsoft::Win32; +void GetNewOverflowSetting( OverflowAction * newOverflow, interior_ptr numDays ); +void DisplayEventLogProperties(); +void ChangeEventLogOverflowAction( String^ logName ); + +/// The main entry point for the sample application. + +[STAThread] +int main() +{ + DisplayEventLogProperties(); + Console::WriteLine(); + Console::WriteLine( "Enter the name of an event log to change the" ); + Console::WriteLine( "overflow policy (or press Enter to exit): " ); + String^ input = Console::ReadLine(); + if ( !String::IsNullOrEmpty( input ) ) + { + ChangeEventLogOverflowAction( input ); + } +} + + +// Prompt the user for the overflow policy setting. +void GetNewOverflowSetting( OverflowAction * newOverflow, interior_ptr numDays ) +{ + Console::Write( "Enter the new overflow policy setting [" ); + Console::Write( " OverwriteOlder," ); + Console::Write( " DoNotOverwrite," ); + Console::Write( " OverwriteAsNeeded" ); + Console::WriteLine( "] : " ); + String^ input = Console::ReadLine(); + if ( !String::IsNullOrEmpty( input ) ) + { + String^ INPUT = input->Trim()->ToUpper( CultureInfo::InvariantCulture ); + if ( INPUT->Equals( "OVERWRITEOLDER" ) ) + { + *newOverflow = OverflowAction::OverwriteOlder; + Console::WriteLine( "Enter the number of days to retain events: " ); + input = Console::ReadLine(); + + if ( ( !Int32::TryParse( input, *numDays )) || ( *numDays == 0) ) + { + Console::WriteLine( " Invalid input, defaulting to 7 days." ); + *numDays = 7; + } + } + else + if ( INPUT->Equals( "DONOTOVERWRITE" ) ) + { + *newOverflow = OverflowAction::DoNotOverwrite; + } + else + if ( INPUT->Equals( "OVERWRITEASNEEDED" ) ) + { + *newOverflow = OverflowAction::OverwriteAsNeeded; + } + else + Console::WriteLine( "Unrecognized overflow policy." ); + } + + Console::WriteLine(); +} + + +// +void DisplayEventLogProperties() +{ + + // Iterate through the current set of event log files, + // displaying the property settings for each file. + array^eventLogs = EventLog::GetEventLogs(); + System::Collections::IEnumerator^ myEnum = eventLogs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLog^ e = safe_cast(myEnum->Current); + Int64 sizeKB = 0; + Console::WriteLine(); + Console::WriteLine( "{0}:", e->LogDisplayName ); + Console::WriteLine( " Log name = \t\t {0}", e->Log ); + Console::WriteLine( " Number of event log entries = {0}", e->Entries->Count ); + + // Determine if there is a file for this event log. + RegistryKey ^ regEventLog = Registry::LocalMachine->OpenSubKey( String::Format( "System\\CurrentControlSet\\Services\\EventLog\\{0}", e->Log ) ); + if ( regEventLog ) + { + Object^ temp = regEventLog->GetValue( "File" ); + if ( temp != nullptr ) + { + Console::WriteLine( " Log file path = \t {0}", temp ); + FileInfo^ file = gcnew FileInfo( temp->ToString() ); + + // Get the current size of the event log file. + if ( file->Exists ) + { + sizeKB = file->Length / 1024; + if ( (file->Length % 1024) != 0 ) + { + sizeKB++; + } + Console::WriteLine( " Current size = \t {0} kilobytes", sizeKB ); + } + } + else + { + Console::WriteLine( " Log file path = \t " ); + } + } + + // Display the maximum size and overflow settings. + sizeKB = e->MaximumKilobytes; + Console::WriteLine( " Maximum size = \t {0} kilobytes", sizeKB ); + Console::WriteLine( " Overflow setting = \t {0}", e->OverflowAction ); + switch ( e->OverflowAction ) + { + case OverflowAction::OverwriteOlder: + Console::WriteLine( "\t Entries are retained a minimum of {0} days.", e->MinimumRetentionDays ); + break; + + case OverflowAction::DoNotOverwrite: + Console::WriteLine( "\t Older entries are not overwritten." ); + break; + + case OverflowAction::OverwriteAsNeeded: + Console::WriteLine( "\t If number of entries equals max size limit, a new event log entry overwrites the oldest entry." ); + break; + + default: + break; + } + } +} + + +// +// +// Display the current event log overflow settings, and +// prompt the user to input a new overflow setting. +void ChangeEventLogOverflowAction( String^ logName ) +{ + if ( EventLog::Exists( logName ) ) + { + + // Display the current overflow setting of the + // specified event log. + EventLog^ inputLog = gcnew EventLog( logName ); + Console::WriteLine( " Event log {0}", inputLog->Log ); + OverflowAction logOverflow = inputLog->OverflowAction; + Int32 numDays = inputLog->MinimumRetentionDays; + Console::WriteLine( " Current overflow setting = {0}", logOverflow ); + if ( logOverflow == OverflowAction::OverwriteOlder ) + { + Console::WriteLine( "\t Entries are retained a minimum of {0} days.", numDays ); + } + + // Prompt user for a new overflow setting. + GetNewOverflowSetting( &logOverflow, &numDays ); + + // Change the overflow setting on the event log. + if ( logOverflow != inputLog->OverflowAction ) + { + inputLog->ModifyOverflowPolicy( logOverflow, numDays ); + Console::WriteLine( "Event log overflow policy was modified successfully!" ); + } + else + { + Console::WriteLine( "Event log overflow policy was not modified." ); + } + } + else + { + Console::WriteLine( "Event log {0} was not found.", logName ); + } +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp new file mode 100644 index 00000000000..f61b7647435 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLog_EventSourceCreation_Properties/CPP/source.cpp @@ -0,0 +1,137 @@ + + +// +#using + +using namespace System; +using namespace System::Globalization; +using namespace System::Diagnostics; + +[STAThread] +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // + EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( "","" ); + bool registerSource = true; + + // Process input parameters. + if ( args->Length > 1 ) + { + + // Require at least the source name. + mySourceData->Source = args[ 1 ]; + if ( args->Length > 2 ) + { + mySourceData->LogName = args[ 2 ]; + } + + if ( args->Length > 3 ) + { + mySourceData->MachineName = args[ 3 ]; + } + + if ( (args->Length > 4) && (args[ 4 ]->Length > 0) ) + { + mySourceData->MessageResourceFile = args[ 4 ]; + } + } + else + { + + // Display a syntax help message. + Console::WriteLine( "Input:" ); + Console::WriteLine( " source [event log] [machine name] [resource file]" ); + registerSource = false; + } + + + // Set defaults for parameters missing input. + if ( mySourceData->MachineName->Length == 0 ) + { + + // Default to the local computer. + mySourceData->MachineName = "."; + } + + if ( mySourceData->LogName->Length == 0 ) + { + + // Default to the Application log. + mySourceData->LogName = "Application"; + } + + + // + // Determine if the source exists on the specified computer. + if ( !EventLog::SourceExists( mySourceData->Source, mySourceData->MachineName ) ) + { + + // The source does not exist. + // Verify that the message file exists + // and the event log is local. + if ( (mySourceData->MessageResourceFile != nullptr) && (mySourceData->MessageResourceFile->Length > 0) ) + { + if ( mySourceData->MachineName->Equals( "." ) ) + { + if ( !System::IO::File::Exists( mySourceData->MessageResourceFile ) ) + { + Console::WriteLine( "File {0} not found - message file not set for source.", mySourceData->MessageResourceFile ); + registerSource = false; + } + } + else + { + + // For simplicity, do not allow setting the message + // file for a remote event log. To set the message + // for a remote event log, and for source registration, + // the file path should be specified with system-wide + // environment variables that are valid on the remote + // computer, such as + // "%SystemRoot%\system32\myresource.dll". + Console::WriteLine( "Message resource file ignored for remote event log." ); + registerSource = false; + } + } + } + else + { + + // Do not register the source, it already exists. + registerSource = false; + + // Get the event log corresponding to the existing source. + String^ sourceLog; + sourceLog = EventLog::LogNameFromSourceName( mySourceData->Source, mySourceData->MachineName ); + + // Determine if the event source is registered for the + // specified log. + if ( sourceLog->ToUpper( CultureInfo::InvariantCulture ) != mySourceData->LogName->ToUpper( CultureInfo::InvariantCulture ) ) + { + + // An existing source is registered + // to write to a different event log. + Console::WriteLine( "Warning: source {0} is already registered to write to event log {1}", mySourceData->Source, sourceLog ); + } + else + { + + // The source is already registered + // to write to the specified event log. + Console::WriteLine( "Source {0} already registered to write to event log {1}", mySourceData->Source, sourceLog ); + } + } + + if ( registerSource ) + { + + // Register the new event source for the specified event log. + Console::WriteLine( "Registering new source {0} for event log {1}.", mySourceData->Source, mySourceData->LogName ); + EventLog::CreateEventSource( mySourceData ); + Console::WriteLine( "Event source was registered successfully!" ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp new file mode 100644 index 00000000000..07109b189ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLog_Exists_1/CPP/eventlog_exists_1.cpp @@ -0,0 +1,36 @@ + + +// System::Diagnostics::EventLog::Exists(String) +/* +The following sample demonstrates the 'Exists(String)'method of +'EventLog' class. It checks for the existence of a log and displays +the result accordingly. +*/ +#using + +using namespace System; +using namespace System::Diagnostics; +void main() +{ + try + { + + // + String^ myLog = "myNewLog"; + if ( EventLog::Exists( myLog ) ) + { + Console::WriteLine( "Log '{0}' exists.", myLog ); + } + else + { + Console::WriteLine( "Log '{0}' does not exist.", myLog ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp new file mode 100644 index 00000000000..663444e9b51 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_1_3/CPP/eventlog_writeentry_1_3.cpp @@ -0,0 +1,53 @@ +// System::Diagnostics::EventLog::WriteEntry(String, String, EventLogEntryType, Int32, Int16) +// System::Diagnostics::EventLog::WriteEntry(String, String, EventLogEntryType, Int32, Int16, Byte->Item[]) +// System::Diagnostics::EventLog::EventLog.WriteEntry(String, EventLogEntryType, Int32, Int16) + +/* The following example demonstrates the method +'WriteEntry(String, String, EventLogEntryType, Int32, Int16)', +'WriteEntry(String, String, EventLogEntryType, Int32, Int16, Byte->Item[]) ' +and 'WriteEntry(String, EventLogEntryType, Int32, Int16)' of class +'EventLog'. The following example writes the information to an event log. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + // + int myEventID = 20; + short myCategory = 10; + + // Write an informational entry to the event log. + Console::WriteLine( "Write from first source " ); + EventLog::WriteEntry( "FirstSource", "Writing warning to event log.", + EventLogEntryType::Information, myEventID, myCategory ); + // + + // + //Create a byte array for binary data to associate with the entry. + array^myByte = gcnew array(10); + //Populate the byte array with simulated data. + for ( int i = 0; i < 10; i++ ) + { + myByte[ i ] = (Byte)(i % 2); + } + //Write an entry to the event log that includes associated binary data. + Console::WriteLine( "Write from second source " ); + EventLog::WriteEntry( "SecondSource", "Writing warning to event log.", + EventLogEntryType::Error, myEventID, myCategory, myByte ); + // + + // + // Create an EventLog instance and assign its source. + EventLog^ myLog = gcnew EventLog; + myLog->Source = "ThirdSource"; + + // Write an informational entry to the event log. + Console::WriteLine( "Write from third source " ); + myLog->WriteEntry( "Writing warning to event log.", + EventLogEntryType::Warning, myEventID, myCategory ); + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp new file mode 100644 index 00000000000..5d40a7c71c9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_4/CPP/eventlog_writeentry_4.cpp @@ -0,0 +1,42 @@ +// System::Diagnostics::EventLog::WriteEntry(String,String,EventLogEntryType,Int32) + +/* +The following sample demonstrates the +'WriteEntry(String,String,EventLogEntryType,Int32)' method of +'EventLog' class. It writes an entry to a custom event log, S"MyNewLog". +It creates the source S"MySource" if the source does not already exist. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + try + { +// + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + EventLog::CreateEventSource( "MySource", "myNewLog" ); + Console::WriteLine( "Creating EventSource" ); + } + + // Set the 'description' for the event. + String^ myMessage = "This is my event."; + EventLogEntryType myEventLogEntryType = EventLogEntryType::Warning; + int myApplicationEventId = 100; + + // Write the entry in the event log. + Console::WriteLine( "Writing to EventLog.. " ); + EventLog::WriteEntry( "MySource", myMessage, + myEventLogEntryType, myApplicationEventId ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception:{0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp new file mode 100644 index 00000000000..4771b4f0eb5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/EventLog_WriteEntry_5/CPP/eventlog_writeentry_5.cpp @@ -0,0 +1,58 @@ +// System::Diagnostics::EventLog::WriteEntry(String, EventLogEntryType, Int32, Int16, Byte[]) + +/* +The following sample demonstrates the +'WriteEntry(String, EventLogEntryType, Int32, Int16, Byte->Item[])' method of +'EventLog' class. It writes an entry to a custom event log, S"MyLog". +It creates the source S"MySource" if the source does not already exist. +It creates an 'EventLog' Object* and calls 'WriteEntry' passing the +description, Log entry type, application specific identifier for the event, +application specific subcategory and data to be associated with the entry. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + try + { +// + // Create the source, if it does not already exist. + String^ myLogName = "myNewLog"; + if ( !EventLog::SourceExists( "MySource" ) ) + { + EventLog::CreateEventSource( "MySource", myLogName ); + Console::WriteLine( "Creating EventSource" ); + } + else + myLogName = EventLog::LogNameFromSourceName( "MySource", "." ); + + // Create an EventLog and assign source. + EventLog^ myEventLog = gcnew EventLog; + myEventLog->Source = "MySource"; + myEventLog->Log = myLogName; + + // Set the 'description' for the event. + String^ myMessage = "This is my event."; + EventLogEntryType myEventLogEntryType = EventLogEntryType::Warning; + int myApplicatinEventId = 1100; + short myApplicatinCategoryId = 1; + + // Set the 'data' for the event. + array^ myRawData = gcnew array(4); + for ( int i = 0; i < 4; i++ ) + { + myRawData[ i ] = 1; + } + Console::WriteLine( "Writing to EventLog.. " ); + myEventLog->WriteEntry( myMessage, myEventLogEntryType, myApplicatinEventId, myApplicatinCategoryId, myRawData ); +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception:{0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp b/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp new file mode 100644 index 00000000000..c94bc78e16b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ExToString/CPP/extostring.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; + +public ref class TestClass{}; + +int main() +{ + TestClass^ test = gcnew TestClass; + array^ objectsToCompare = { test, test->ToString(), 123, + (123).ToString(), "some text", + "Some Text" }; + String^ s = "some text"; + for each (Object^ objectToCompare in objectsToCompare) { + try { + Int32 i = s->CompareTo(objectToCompare); + Console::WriteLine("Comparing '{0}' with '{1}': {2}", + s, objectToCompare, i); + } + catch (ArgumentException^ e) { + Console::WriteLine("Bad argument: {0} (type {1})", + objectToCompare, + objectToCompare->GetType()->Name); + } + } +} +// The example displays the following output: +// Bad argument: TestClass (type TestClass) +// Comparing 'some text' with 'TestClass': -1 +// Bad argument: 123 (type Int32) +// Comparing 'some text' with '123': 1 +// Comparing 'some text' with 'some text': 0 +// Comparing 'some text' with 'Some Text': -1 +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp new file mode 100644 index 00000000000..f18b6e52fe0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo AppendText/CPP/finfo appendtext.cpp @@ -0,0 +1,79 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + FileInfo^ fi = gcnew FileInfo( "c:\\MyTest.txt" ); + + // This text is added only once to the file. + if ( !fi->Exists ) + { + //Create a file to write to. + StreamWriter^ sw = fi->CreateText(); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + } + + // This text will always be added, making the file longer over time + // if it is not deleted. + StreamWriter^ sw = fi->AppendText(); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is Extra" ); + sw->WriteLine( "Text" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + + //Open the file to read from. + StreamReader^ sr = fi->OpenText(); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//Hello +//And +//Welcome +//This +//is Extra +//Text +// +//When you run this application a second time, you will see the following output: +// +//Hello +//And +//Welcome +//This +//is Extra +//Text +//This +//is Extra +//Text +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp new file mode 100644 index 00000000000..cd1f26bb6ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo Class/CPP/finfo class.cpp @@ -0,0 +1,60 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = Path::GetTempFileName(); + FileInfo^ fi1 = gcnew FileInfo( path ); + //Create a file to write to. + StreamWriter^ sw = fi1->CreateText(); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + + //Open the file to read from. + StreamReader^ sr = fi1->OpenText(); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } + + try + { + String^ path2 = Path::GetTempFileName(); + FileInfo^ fi2 = gcnew FileInfo( path2 ); + + //Ensure that the target does not exist. + fi2->Delete(); + + //Copy the file. + fi1->CopyTo( path2 ); + Console::WriteLine( "{0} was copied to {1}.", path, path2 ); + + //Delete the newly created file. + fi2->Delete(); + Console::WriteLine( "{0} was successfully deleted.", path2 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp new file mode 100644 index 00000000000..457a43483a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo CopyTo2/CPP/finfo copyto2.cpp @@ -0,0 +1,38 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + String^ path2 = "c:\\MyTest.txttemp"; + FileInfo^ fi1 = gcnew FileInfo( path ); + FileInfo^ fi2 = gcnew FileInfo( path2 ); + try + { + // Create the file and clean up handles. + FileStream^ fs = fi1->Create(); + if ( fs ) + delete (IDisposable^)fs; + + //Ensure that the target does not exist. + fi2->Delete(); + + //Copy the file. + fi1->CopyTo( path2 ); + Console::WriteLine( "{0} was copied to {1}.", path, path2 ); + + //Try to copy it again, which should succeed. + fi1->CopyTo( path2, true ); + Console::WriteLine( "The second Copy operation succeeded, which is expected." ); + } + catch ( Exception^ ) + { + Console::WriteLine( "Double copying was not allowed, which is not expected." ); + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//The second Copy operation succeeded, which is expected. +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp new file mode 100644 index 00000000000..8533b4ee458 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo Create/CPP/finfo create.cpp @@ -0,0 +1,53 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi = gcnew FileInfo( path ); + + // Delete the file if it exists. + if ( fi->Exists ) + { + fi->Delete(); + } + + //Create the file. + FileStream^ fs = fi->Create(); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + //Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + + //Open the stream and read it back. + StreamReader^ sr = fi->OpenText(); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} + +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is some text in the file. +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp new file mode 100644 index 00000000000..eecfff022ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo CreateText/CPP/finfo createtext.cpp @@ -0,0 +1,48 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi = gcnew FileInfo( path ); + if ( !fi->Exists ) + { + //Create a file to write to. + StreamWriter^ sw = fi->CreateText(); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + } + + //Open the file to read from. + StreamReader^ sr = fi->OpenText(); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//Hello +//And +//Welcome +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp new file mode 100644 index 00000000000..d0901ff161a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo Ctor/CPP/finfo ctor.cpp @@ -0,0 +1,72 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi1 = gcnew FileInfo( path ); + if ( !fi1->Exists ) + { + //Create a file to write to. + StreamWriter^ sw = fi1->CreateText(); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + } + + //Open the file to read from. + StreamReader^ sr = fi1->OpenText(); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } + + try + { + String^ path2 = String::Concat( path, "temp" ); + FileInfo^ fi2 = gcnew FileInfo( path2 ); + + //Ensure that the target does not exist. + fi2->Delete(); + + //Copy the file. + fi1->CopyTo( path2 ); + Console::WriteLine( "{0} was copied to {1}.", path, path2 ); + + //Delete the newly created file. + fi2->Delete(); + Console::WriteLine( "{0} was successfully deleted.", path2 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} + +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//Hello +//And +//Welcome +//c:\MyTest.txt was copied to c:\MyTest.txttemp. +//c:\MyTest.txttemp was successfully deleted. +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp new file mode 100644 index 00000000000..c219e088f8c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo Delete/CPP/finfo delete.cpp @@ -0,0 +1,39 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi1 = gcnew FileInfo( path ); + try + { + StreamWriter^ sw = fi1->CreateText(); + if ( sw ) + delete (IDisposable^)sw; + + String^ path2 = String::Concat( path, "temp" ); + FileInfo^ fi2 = gcnew FileInfo( path2 ); + + //Ensure that the target does not exist. + fi2->Delete(); + + //Copy the file. + fi1->CopyTo( path2 ); + Console::WriteLine( "{0} was copied to {1}.", path, path2 ); + + //Delete the newly created file. + fi2->Delete(); + Console::WriteLine( "{0} was successfully deleted.", path2 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//c:\MyTest.txt was copied to c:\MyTest.txttemp. +//c:\MyTest.txttemp was successfully deleted. +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp new file mode 100644 index 00000000000..052607a8faf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo Open1/CPP/finfo open1.cpp @@ -0,0 +1,65 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi = gcnew FileInfo( path ); + + // Delete the file if it exists. + if ( !fi->Exists ) + { + //Create the file. + FileStream^ fs = fi->Create(); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + //Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + //Open the stream and read it back. + FileStream^ fs = fi->Open( FileMode::Open ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} + +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is some text in the file. +// +// +// +// +// +// +// +// +// +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp new file mode 100644 index 00000000000..7996e15f1cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo Open2/CPP/finfo open2.cpp @@ -0,0 +1,80 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi = gcnew FileInfo( path ); + + // Delete the file if it exists. + if ( !fi->Exists ) + { + + //Create the file. + FileStream^ fs = fi->Create(); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + //Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + //Open the stream and read it back. + FileStream^ fs = fi->Open( FileMode::Open, FileAccess::Read ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + try + { + //Try to write to the file. + fs->Write( b, 0, b->Length ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Writing was disallowed, as expected: {0}", e ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is some text in the file. +// +// +// +// +// +// +// +// +// +// +// +// +//Writing was disallowed, as expected: System.NotSupportedException: Stream does +//not support writing. +// at System.IO.__Error.WriteNotSupported() +// at System.IO.FileStream.Write(Byte[] array, Int32 offset, Int32 count) +// at main() in c:\documents and settings\MyComputer\my documents\ +//visual studio 2005\projects\finfo open2\finfo open2\ +//cpp_console_application.cpp:line 46 +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp new file mode 100644 index 00000000000..f81348f3afa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo OpenRead/CPP/finfo openread.cpp @@ -0,0 +1,64 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\MyTest.txt"; + FileInfo^ fi = gcnew FileInfo( path ); + + // Delete the file if it exists. + if ( !fi->Exists ) + { + //Create the file. + FileStream^ fs = fi->Create(); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + //Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + //Open the stream and read it back. + FileStream^ fs = fi->OpenRead(); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is some text in the file. +// +// +// +// +// +// +// +// +// +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp new file mode 100644 index 00000000000..3868e7e68fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo OpenText/CPP/file opentext.cpp @@ -0,0 +1,47 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +public ref class OpenTextTest +{ +public: + static void Main() + { + String^ path = "c:\\MyTest.txt"; + + FileInfo^ fi = gcnew FileInfo(path); + + // Check for existing file + if (!fi->Exists) + { + // Create the file. + FileStream^ fs = fi->Create(); + array^ info = + (gcnew UTF8Encoding(true))->GetBytes("This is some text in the file."); + + // Add some information to the file. + fs->Write(info, 0, info->Length); + fs->Close(); + } + + // Open the stream and read it back. + StreamReader^ sr = fi->OpenText(); + String^ s = ""; + while ((s = sr->ReadLine()) != nullptr) + { + Console::WriteLine(s); + } + } +}; + +int main() +{ + OpenTextTest::Main(); +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is some text in the file. +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp b/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp new file mode 100644 index 00000000000..e4a0ca98bdb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FInfo OpenWrite/CPP/file openwrite.cpp @@ -0,0 +1,63 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\Temp\\MyTest.txt"; + FileInfo^ fi = gcnew FileInfo( path ); + + // Open the stream for writing. + { + FileStream^ fs = fi->OpenWrite(); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is to test the OpenWrite method." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + // Open the stream and read it back. + { + FileStream^ fs = fi->OpenRead(); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is to test the OpenWrite method. +// +// +// +// +// +// +// +// +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp b/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp new file mode 100644 index 00000000000..e79c45b3672 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FStream CanSeek/CPP/fstream canseek.cpp @@ -0,0 +1,35 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Delete the file if it exists. + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + + //Create the file. + FileStream^ fs = File::Create( path ); + try + { + if ( fs->CanSeek ) + { + Console::WriteLine( "The stream connected to {0} is seekable.", path ); + } + else + { + Console::WriteLine( "The stream connected to {0} is not seekable.", path ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp b/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp new file mode 100644 index 00000000000..7dd44acda66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FStream CanWrite/CPP/fstream canwrite.cpp @@ -0,0 +1,32 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Ensure that the file is readonly. + File::SetAttributes( path, static_cast(File::GetAttributes( path ) | FileAttributes::ReadOnly) ); + + //Create the file. + FileStream^ fs = gcnew FileStream( path,FileMode::OpenOrCreate,FileAccess::Read ); + try + { + if ( fs->CanWrite ) + { + Console::WriteLine( "The stream for file {0} is writable.", path ); + } + else + { + Console::WriteLine( "The stream for file {0} is not writable.", path ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp b/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp new file mode 100644 index 00000000000..cc2e6916562 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FStream Class/CPP/fstream class.cpp @@ -0,0 +1,68 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +void AddText( FileStream^ fs, String^ value ) +{ + array^info = (gcnew UTF8Encoding( true ))->GetBytes( value ); + fs->Write( info, 0, info->Length ); +} + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Delete the file if it exists. + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + + //Create the file. + { + FileStream^ fs = File::Create( path ); + try + { + AddText( fs, "This is some text" ); + AddText( fs, "This is some more text," ); + AddText( fs, "\r\nand this is on a new line" ); + AddText( fs, "\r\n\r\nThe following is a subset of characters:\r\n" ); + for ( int i = 1; i < 120; i++ ) + { + AddText( fs, Convert::ToChar( i ).ToString() ); + + //Split the output at every 10th character. + if ( Math::IEEERemainder( Convert::ToDouble( i ), 10 ) == 0 ) + { + AddText( fs, "\r\n" ); + } + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + //Open the stream and read it back. + { + FileStream^ fs = File::OpenRead( path ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp new file mode 100644 index 00000000000..8b038438f4b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_ReflectedType/CPP/fieldbuilder_reflectedtype.cpp @@ -0,0 +1,84 @@ + +// System::Reflection::Emit::FieldBuilder.ReflectedType +// System::Reflection::Emit::FieldBuilder.Attributes +/* + The following example demonstrates 'ReflectedType' and 'Attributes' + properties of 'FieldBuilder' class.A new class 'MyClass' is created. + A Field and a method are defined in the class.In the constructor of the class + the field is initialized.Method of the class gets the value of the Field. + An instance of the class is created and method is invoked. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ CreateType( AppDomain^ currentDomain ) +{ + // Create an assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "DynamicAssembly"; + AssemblyBuilder^ myAssembly = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module in Dynamic Assembly. + ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "MyModule" ); + + // Define a public class named S"MyClass" in the assembly. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyClass", TypeAttributes::Public ); + + // Define a private String field named S"MyField" in the type. + FieldBuilder^ myFieldBuilder = myTypeBuilder->DefineField( "MyField", String::typeid, static_cast(FieldAttributes::Private | FieldAttributes::Static) ); + + // Create the constructor. + array^constructorArgs = {String::typeid}; + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, constructorArgs ); + ILGenerator^ constructorIL = myConstructor->GetILGenerator(); + constructorIL->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ superConstructor = Object::typeid->GetConstructor( gcnew array(0) ); + constructorIL->Emit( OpCodes::Call, superConstructor ); + constructorIL->Emit( OpCodes::Ldarg_0 ); + constructorIL->Emit( OpCodes::Ldarg_1 ); + constructorIL->Emit( OpCodes::Stfld, myFieldBuilder ); + constructorIL->Emit( OpCodes::Ret ); + + // Create the MyMethod method. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, String::typeid, nullptr ); + ILGenerator^ methodIL = myMethodBuilder->GetILGenerator(); + methodIL->Emit( OpCodes::Ldarg_0 ); + methodIL->Emit( OpCodes::Ldfld, myFieldBuilder ); + methodIL->Emit( OpCodes::Ret ); + if ( myFieldBuilder->Attributes.Equals( FieldAttributes::Static ) ) + { + Console::WriteLine( "Field attribute defined as Static" ); + } + else + if ( myFieldBuilder->Attributes.Equals( FieldAttributes::Static | FieldAttributes::Private ) ) + { + Console::WriteLine( "Field attributes are Static and Private" ); + } + + + Console::WriteLine( "ReflectedType of Field is : {0}", myFieldBuilder->ReflectedType ); + return myTypeBuilder->CreateType(); +} + +int main() +{ + try + { + Type^ myType = CreateType( Thread::GetDomain() ); + + // Create an instance of the S"HelloWorld" class. + array^type = {"HelloWorld"}; + Object^ helloWorld = Activator::CreateInstance( myType, type ); + + // Invoke the S"MyMethod" of the S"MyClass". + Object^ myObject = myType->InvokeMember( "MyMethod", BindingFlags::InvokeMethod, nullptr, helloWorld, nullptr ); + Console::WriteLine( "MyClass::MyMethod returned: \"{0}\"", myObject ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp new file mode 100644 index 00000000000..fab865dd934 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetCustomAttributes/CPP/fieldbuilder_setcustomattributes.cpp @@ -0,0 +1,132 @@ + +// System::Reflection::Emit::FieldBuilder.SetCustomAttribute(ConstructorInfo, Byte->Item[]) +// System::Reflection::Emit::FieldBuilder.SetCustomAttribute(CustomAttributeBuilder) +/* + The following program demonstrates 'SetCustomAttribute(ConstructorInfo, Byte[])' + and 'SetCustomAttribute(CustomAttributeBuilder)' methods of 'FieldBuilder' class. + A dynamic assembly is created. A new class of type 'MyClass' is created. + A 'Method' and a 'Field are defined in the class.Two 'CustomAttributes' are + set to the field. The method initializes a value to 'Field'.Value of the field + is displayed to console.Values of Attributes applied to field are retrieved and + displayed to console. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute1: public Attribute +{ +public: + String^ myCustomAttributeValue; + MyAttribute1( String^ myString ) + { + myCustomAttributeValue = myString; + } +}; + + +[AttributeUsage(AttributeTargets::All,AllowMultiple=false)] +public ref class MyAttribute2: public Attribute +{ +public: + bool myCustomAttributeValue; + MyAttribute2( bool myBool ) + { + myCustomAttributeValue = myBool; + } +}; + +Type^ CreateCallee( AppDomain^ currentDomain ) +{ + // Create a simple name for the assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Create the called dynamic assembly. + AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); + + // Define a public class named 'CustomClass' in the assembly. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "CustomClass", TypeAttributes::Public ); + + // Define a private String field named 'MyField' in the type. + FieldBuilder^ myFieldBuilder = myTypeBuilder->DefineField( "MyField", String::typeid, FieldAttributes::Public ); + Type^ myAttributeType1 = MyAttribute1::typeid; + + // Create a Constructorinfo Object* for attribute 'MyAttribute1'. + array^type1 = {String::typeid}; + ConstructorInfo^ myConstructorInfo = myAttributeType1->GetConstructor( type1 ); + + // Create the CustomAttribute instance of attribute of type 'MyAttribute1'. + array^obj1 = {"Test"}; + CustomAttributeBuilder^ attributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 ); + + // Set the CustomAttribute 'MyAttribute1' to the Field. + myFieldBuilder->SetCustomAttribute( attributeBuilder ); + Type^ myAttributeType2 = MyAttribute2::typeid; + + // Create a Constructorinfo Object* for attribute 'MyAttribute2'. + array^type2 = {bool::typeid}; + ConstructorInfo^ myConstructorInfo2 = myAttributeType2->GetConstructor( type2 ); + + // Set the CustomAttribute 'MyAttribute2' to the Field. + array^bytes = {01,00,01,00,00}; + myFieldBuilder->SetCustomAttribute( myConstructorInfo2, bytes ); + + // Create a method. + array^type3 = {String::typeid,int::typeid}; + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, nullptr, type3 ); + ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); + myILGenerator->Emit( OpCodes::Ldarg_0 ); + myILGenerator->Emit( OpCodes::Ldarg_1 ); + myILGenerator->Emit( OpCodes::Stfld, myFieldBuilder ); + myILGenerator->EmitWriteLine( "Value of the Field is :" ); + myILGenerator->EmitWriteLine( myFieldBuilder ); + myILGenerator->Emit( OpCodes::Ret ); + return myTypeBuilder->CreateType(); +} + +int main() +{ + try + { + Type^ myCustomClass = CreateCallee( Thread::GetDomain() ); + + // Construct an instance of a type. + Object^ myObject = Activator::CreateInstance( myCustomClass ); + Console::WriteLine( "FieldBuilder Sample" ); + + // Find a method in this type and call it on this Object*. + MethodInfo^ myMethodInfo = myCustomClass->GetMethod( "MyMethod" ); + array^obj1 = {"Sample string",3}; + myMethodInfo->Invoke( myObject, obj1 ); + + // Retrieve the values of Attributes applied to field and display to console. + array^myFieldInfo = myCustomClass->GetFields(); + for ( int i = 0; i < myFieldInfo->Length; i++ ) + { + array^attributes = myFieldInfo[ i ]->GetCustomAttributes( true ); + for ( int index = 0; index < attributes->Length; index++ ) + { + if ( dynamic_cast(attributes[ index ]) ) + { + MyAttribute1^ myCustomAttribute = safe_cast(attributes[ index ]); + Console::WriteLine( "Attribute Value of (MyAttribute1): {0}", myCustomAttribute->myCustomAttributeValue ); + } + if ( dynamic_cast(attributes[ index ]) ) + { + MyAttribute2^ myCustomAttribute = safe_cast(attributes[ index ]); + Console::WriteLine( "Attribute Value of (MyAttribute2): {0}", myCustomAttribute->myCustomAttributeValue ); + } + } + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp new file mode 100644 index 00000000000..0fe41fc175c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldBuilder_SetOffset/CPP/fieldbuilder_setoffset.cpp @@ -0,0 +1,74 @@ + +// System::Reflection::Emit::FieldBuilder.SetOffset +// System::Reflection::Emit::FieldBuilder.SetMarshal +/* + The following program demonstrates 'SetOffset' and 'SetMarshal' + methods of 'FieldBuilder' class.A new Class is defined and a + 'PInvoke' method 'OpenFile' method of 'Kernel32.dll' is defined + in the class.Instance of the class is created and the method is invoked. + To execute this program, make sure a file named 'MyFile.txt' should be there + in the current directory. +*/ +// +using namespace System; +using namespace System::Runtime::InteropServices; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +Type^ CreateType( AppDomain^ currentDomain ) +{ + // Create an assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "DynamicAssembly"; + AssemblyBuilder^ myAssembly = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a dynamic module in Dynamic Assembly. + ModuleBuilder^ myModuleBuilder = myAssembly->DefineDynamicModule( "MyModule", "MyModule.mod" ); + + // Define a public class named S"MyClass" in the assembly. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyClass", TypeAttributes::Public ); + TypeBuilder^ myTypeBuilder2 = myModuleBuilder->DefineType( "MyClass2", static_cast(TypeAttributes::Public | TypeAttributes::BeforeFieldInit | TypeAttributes::SequentialLayout | TypeAttributes::AnsiClass | TypeAttributes::Sealed) ); + FieldBuilder^ myFieldBuilder1 = myTypeBuilder2->DefineField( "myBytes1", Byte::typeid, FieldAttributes::Public ); + FieldBuilder^ myFieldBuilder2 = myTypeBuilder2->DefineField( "myBytes2", Byte::typeid, FieldAttributes::Public ); + FieldBuilder^ myFieldBuilder3 = myTypeBuilder2->DefineField( "myErrorCode", short::typeid, FieldAttributes::Public ); + FieldBuilder^ myFieldBuilder4 = myTypeBuilder2->DefineField( "myReserved1", short::typeid, FieldAttributes::Public ); + FieldBuilder^ myFieldBuilder5 = myTypeBuilder2->DefineField( "myReserved2", short::typeid, FieldAttributes::Public ); + FieldBuilder^ myFieldBuilder6 = myTypeBuilder2->DefineField( "myPathName", array::typeid,FieldAttributes::Public ); + myFieldBuilder6->SetMarshal( UnmanagedMarshal::DefineByValArray( 128 ) ); + myFieldBuilder6->SetOffset( 4 ); + Type^ myType1 = myTypeBuilder2->CreateType(); + + // Create the PInvoke method for 'OpenFile' method of 'Kernel32.dll'. + array^myParameters = {String::typeid,myType1,UInt32::typeid}; + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefinePInvokeMethod( "OpenFile", "kernel32.dll", static_cast(MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::HideBySig), CallingConventions::Standard, IntPtr::typeid, myParameters, CallingConvention::Winapi, CharSet::None ); + Type^ myAttributeType = MethodImplAttribute::typeid; + array^type1 = {MethodImplOptions::typeid}; + ConstructorInfo^ myConstructorInfo = myAttributeType->GetConstructor( type1 ); + array^obj1 = {MethodImplOptions::PreserveSig}; + CustomAttributeBuilder^ myAttributeBuilder = gcnew CustomAttributeBuilder( myConstructorInfo,obj1 ); + myMethodBuilder->SetCustomAttribute( myAttributeBuilder ); + ParameterBuilder^ myParameterBuilder2 = myMethodBuilder->DefineParameter( 2, ParameterAttributes::Out, "myClass2" ); + Type^ myType = myTypeBuilder->CreateType(); + myAssembly->Save( "EmittedAssembly.dll" ); + return myType; +} + +int main() +{ + try + { + Type^ myType = CreateType( Thread::GetDomain() ); + Type^ myClass2 = myType->Module->GetType( "MyClass2" ); + Object^ myParam2 = Activator::CreateInstance( myClass2 ); + UInt32 myUint = 0x00000800; + array^myArgs = {"MyFile.Txt",myParam2,myUint}; + Object^ myObject = myType->InvokeMember( "OpenFile", static_cast(BindingFlags::Public | BindingFlags::InvokeMethod | BindingFlags::Static), nullptr, nullptr, myArgs ); + Console::WriteLine( "MyClass::OpenFile method returned: \"{0}\"", myObject ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp new file mode 100644 index 00000000000..58a29d2bc11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo/CPP/fieldinfo.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class FieldInfoClass +{ +public: + int myField1; + +protected: + String^ myField2; +}; + +int main() +{ + array^myFieldInfo; + Type^ myType = FieldInfoClass::typeid; + + // Get the type and fields of FieldInfoClass. + myFieldInfo = myType->GetFields( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Public) ); + Console::WriteLine( "\nThe fields of FieldInfoClass are \n" ); + + // Display the field information of FieldInfoClass. + for ( int i = 0; i < myFieldInfo->Length; i++ ) + { + Console::WriteLine( "\nName : {0}", myFieldInfo[ i ]->Name ); + Console::WriteLine( "Declaring Type : {0}", myFieldInfo[ i ]->DeclaringType ); + Console::WriteLine( "IsPublic : {0}", myFieldInfo[ i ]->IsPublic ); + Console::WriteLine( "MemberType : {0}", myFieldInfo[ i ]->MemberType ); + Console::WriteLine( "FieldType : {0}", myFieldInfo[ i ]->FieldType ); + Console::WriteLine( "IsFamily : {0}", myFieldInfo[ i ]->IsFamily ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp new file mode 100644 index 00000000000..8d70ea8d553 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_FieldHandle/CPP/fieldinfo_fieldhandle.cpp @@ -0,0 +1,50 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class MyClass +{ +public: + String^ MyField; +}; + +void DisplayFieldHandle( RuntimeFieldHandle myFieldHandle ) +{ + // Get the type from the handle. + FieldInfo^ myField = FieldInfo::GetFieldFromHandle( myFieldHandle ); + + // Display the type. + Console::WriteLine( "\nDisplaying the field from the handle.\n" ); + Console::WriteLine( "The type is {0}.", myField ); +} + +int main() +{ + MyClass^ myClass = gcnew MyClass; + + // Get the type of MyClass. + Type^ myType = MyClass::typeid; + try + { + // Get the field information of MyField. + FieldInfo^ myFieldInfo = myType->GetField( "MyField", static_cast(BindingFlags::Public | BindingFlags::Instance) ); + + // Determine whether or not the FieldInfo Object* is 0. + if ( myFieldInfo != nullptr ) + { + // Get the handle for the field. + RuntimeFieldHandle myFieldHandle = myFieldInfo->FieldHandle; + DisplayFieldHandle( myFieldHandle ); + } + else + { + Console::WriteLine( "The myFieldInfo Object* is 0." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp new file mode 100644 index 00000000000..558c1eaa9ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetFieldFromHandle/CPP/fieldinfo_getfieldfromhandle.cpp @@ -0,0 +1,36 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class FieldInfo_GetFieldFromHandle +{ +public: + String^ x; + Char y; + float a; + int b; +}; + +int main() +{ + // Get the type of the FieldInfo_GetFieldFromHandle class. + Type^ myType = FieldInfo_GetFieldFromHandle::typeid; + + // Get the fields of the FieldInfo_GetFieldFromHandle class. + array^myFieldInfoArray = myType->GetFields(); + Console::WriteLine( "\nThe field information of the declared fields x, y, a, and b is:\n" ); + RuntimeFieldHandle myRuntimeFieldHandle; + for ( int i = 0; i < myFieldInfoArray->Length; i++ ) + { + // Get the RuntimeFieldHandle of myFieldInfoArray. + myRuntimeFieldHandle = myFieldInfoArray[ i ]->FieldHandle; + + // Call the GetFieldFromHandle method. + FieldInfo^ myFieldInfo = FieldInfo::GetFieldFromHandle( myRuntimeFieldHandle ); + + // Display the FieldInfo of myFieldInfo. + Console::WriteLine( " {0}", myFieldInfo ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp new file mode 100644 index 00000000000..b4d9d357a06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_GetValue/CPP/fieldinfo_getvalue.cpp @@ -0,0 +1,40 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class FieldsClass +{ + public: + String^ fieldA; + String^ fieldB; + + FieldsClass() + { + fieldA = "A public field"; + fieldB = "Another public field"; + } +}; + +int main() +{ + FieldsClass^ fieldsInst = gcnew FieldsClass; + + // Get the type of FieldsClass. + Type^ fieldsType = FieldsClass::typeid; + + // Get the FieldInfo of FieldsClass. + array^ fields = fieldsType->GetFields(static_cast(BindingFlags::Public | BindingFlags::Instance)); + + // Display the values of the fields. + Console::WriteLine("Displaying the values of the fields of {0}:", fieldsType); + for (int i = 0; i < fields->Length; i++) + { + Console::WriteLine(" {0}:\t'{1}'", + fields[i]->Name, fields[i]->GetValue(fieldsInst)); + } +} +// The example displays the following output: +// Displaying the values of the fields of FieldsClass: +// fieldA: 'A public field' +// fieldB: 'Another public field' +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp new file mode 100644 index 00000000000..49b86026b86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsNotSerialized/CPP/fieldinfo_isnotserialized.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::Serialization; + +public ref class MyClass +{ +public: + short myShort; + + // The following field will not be serialized. + + [NonSerialized] + int myInt; +}; + +int main() +{ + // Get the type of MyClass. + Type^ myType = MyClass::typeid; + + // Get the fields of MyClass. + array^myFields = myType->GetFields( static_cast(BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::Static) ); + Console::WriteLine( "\nDisplaying whether or not the field is serializable.\n" ); + + // Display whether or not the field is serializable. + for ( int i = 0; i < myFields->Length; i++ ) + if ( myFields[ i ]->IsNotSerialized ) + Console::WriteLine( "The {0} field is not serializable.", myFields[ i ] ); + else + Console::WriteLine( "The {0} field is serializable.", myFields[ i ] ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp new file mode 100644 index 00000000000..5d8ebfb8a80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPInvokeImpl/CPP/fieldinfo_ispinvokeimpl.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class Fieldinfo_IsPinvoke +{ +public: + String^ myField; + Fieldinfo_IsPinvoke() + { + myField = "A public field"; + } +}; + +int main() +{ + Fieldinfo_IsPinvoke^ myObject = gcnew Fieldinfo_IsPinvoke; + + // Get the Type and FieldInfo. + Type^ myType1 = Fieldinfo_IsPinvoke::typeid; + FieldInfo^ myFieldInfo = myType1->GetField( "myField", static_cast(BindingFlags::Public | BindingFlags::Instance) ); + + // Display the name, field and the PInvokeImpl attribute for the field. + Console::Write( "\n Name of class: {0}", myType1->FullName ); + Console::Write( "\n Value of field: {0}", myFieldInfo->GetValue( myObject ) ); + Console::Write( "\n IsPinvokeImpl: {0}", myFieldInfo->IsPinvokeImpl ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp new file mode 100644 index 00000000000..19e2ca9f358 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsPrivate/CPP/fieldinfo_isprivate.cpp @@ -0,0 +1,53 @@ + +// +using namespace System; +using namespace System::Reflection; + +ref class MyClass +{ +private: + String^ myField; + +public: + array^myArray; + MyClass() + { + myField = "Microsoft"; + array^s = {"New York","New Jersey"}; + myArray = s; + } + + property String^ GetField + { + String^ get() + { + return myField; + } + } +}; + +int main() +{ + try + { + // Gets the type of MyClass. + Type^ myType = MyClass::typeid; + + // Gets the field information of MyClass. + array^myFields = myType->GetFields( static_cast(BindingFlags::NonPublic | BindingFlags::Public | BindingFlags::Instance) ); + Console::WriteLine( "\nDisplaying whether the fields of {0} are private or not:\n", myType ); + for ( int i = 0; i < myFields->Length; i++ ) + { + // Check whether the field is private or not. + if ( myFields[ i ]->IsPrivate ) + Console::WriteLine( " {0} is a private field.", myFields[ i ]->Name ); + else + Console::WriteLine( " {0} is not a private field.", myFields[ i ]->Name ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0} ", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp new file mode 100644 index 00000000000..0e31a95a459 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_IsSpecialName/CPP/fieldinfo_isspecialname.cpp @@ -0,0 +1,34 @@ + + +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel::Design; + +int main() +{ + try + { + // Get the type handle of a specified class. + Type^ myType = ViewTechnology::typeid; + + // Get the fields of the specified class. + array^myField = myType->GetFields(); + Console::WriteLine( "\nDisplaying fields that have SpecialName attributes:\n" ); + for ( int i = 0; i < myField->Length; i++ ) + { + // Determine whether or not each field is a special name. + if ( myField[ i ]->IsSpecialName ) + { + Console::WriteLine( "The field {0} has a SpecialName attribute.", myField[ i ]->Name ); + } + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0} ", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp b/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp new file mode 100644 index 00000000000..5ba37dacd8a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FieldInfo_SetValue/CPP/fieldinfo_setvalue.cpp @@ -0,0 +1,51 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Globalization; + +public ref class Example +{ +private: + String^ myString; + +public: + Example() + { + myString = "Old value"; + } + + property String^ StringProperty + { + String^ get() + { + return myString; + } + } +}; + +int main() +{ + Example^ myObject = gcnew Example; + Type^ myType = Example::typeid; + FieldInfo^ myFieldInfo = myType->GetField( "myString", + BindingFlags::NonPublic | BindingFlags::Instance); + + // Display the string before applying SetValue to the field. + Console::WriteLine( "\nThe field value of myString is \"{0}\".", + myFieldInfo->GetValue( myObject ) ); + // Display the SetValue signature used to set the value of a field. + Console::WriteLine( "Applying SetValue(Object, Object)." ); + + // Change the field value using the SetValue method. + myFieldInfo->SetValue( myObject, "New value" ); + // Display the string after applying SetValue to the field. + Console::WriteLine( "The field value of mystring is \"{0}\".", + myFieldInfo->GetValue(myObject)); +} +/* This code produces the following output: + +The field value of myString is "Old value". +Applying SetValue(Object, Object). +The field value of mystring is "New value". + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp b/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp new file mode 100644 index 00000000000..1f0ebf4662f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Class Example/CPP/file class example.cpp @@ -0,0 +1,61 @@ +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + if ( !File::Exists( path ) ) + { + + // Create a file to write to. + StreamWriter^ sw = File::CreateText( path ); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)(sw); + } + } + + // Open the file to read from. + StreamReader^ sr = File::OpenText( path ); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)(sr); + } + + try + { + String^ path2 = String::Concat( path, "temp" ); + + // Ensure that the target does not exist. + File::Delete( path2 ); + + // Copy the file. + File::Copy( path, path2 ); + Console::WriteLine( "{0} was copied to {1}.", path, path2 ); + + // Delete the newly created file. + File::Delete( path2 ); + Console::WriteLine( "{0} was successfully deleted.", path2 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp b/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp new file mode 100644 index 00000000000..9c511bd99e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Create1/CPP/file create1.cpp @@ -0,0 +1,41 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Create the file, or overwrite if the file exists. + FileStream^ fs = File::Create( path ); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + + // Open the stream and read it back. + StreamReader^ sr = File::OpenText( path ); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp b/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp new file mode 100644 index 00000000000..e79d7bdd9ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Create2/CPP/file create2.cpp @@ -0,0 +1,41 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Create the file, or overwrite if the file exists. + FileStream^ fs = File::Create( path, 1024 ); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + + // Open the stream and read it back. + StreamReader^ sr = File::OpenText( path ); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp b/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp new file mode 100644 index 00000000000..e93de3ce721 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File CreateText/CPP/file createtext.cpp @@ -0,0 +1,41 @@ +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + if ( !File::Exists( path ) ) + { + + // Create a file to write to. + StreamWriter^ sw = File::CreateText( path ); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + } + + // Open the file to read from. + StreamReader^ sr = File::OpenText( path ); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp b/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp new file mode 100644 index 00000000000..502539dd149 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File GetAttributes/CPP/file getattributes.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Create the file if it does not exist. + if ( !File::Exists( path ) ) + { + File::Create( path ); + } + + if ( (File::GetAttributes( path ) & FileAttributes::Hidden) == FileAttributes::Hidden ) + { + + // Show the file. + File::SetAttributes(path, File::GetAttributes( path ) & ~FileAttributes::Hidden); + Console::WriteLine( "The {0} file is no longer hidden.", path ); + } + else + { + + // Hide the file. + File::SetAttributes( path, static_cast(File::GetAttributes( path ) | FileAttributes::Hidden) ); + Console::WriteLine( "The {0} file is now hidden.", path ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp new file mode 100644 index 00000000000..80e27831de7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File GetLastAccess/CPP/file getlastaccess.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\Temp\\MyTest.txt"; + if ( !File::Exists( path ) ) + { + File::Create( path ); + } + File::SetLastAccessTime( path, DateTime(1985,5,4) ); + + // Get the creation time of a well-known directory. + DateTime dt = File::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this file was {0}.", dt ); + + // Update the last access time. + File::SetLastAccessTime( path, DateTime::Now ); + dt = File::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this file was {0}.", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp new file mode 100644 index 00000000000..8b796882ead --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File GetLastWrite/CPP/file getlastwrite.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\Temp\\MyTest.txt"; + if ( !File::Exists( path ) ) + { + File::Create( path ); + } + else + { + + // Take an action that will affect the write time. + File::SetLastWriteTime( path, DateTime(1985,4,3) ); + } + + // Get the creation time of a well-known directory. + DateTime dt = File::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this file was {0}.", dt ); + + // Update the last write time. + File::SetLastWriteTime( path, DateTime::Now ); + dt = File::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this file was {0}.", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp b/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp new file mode 100644 index 00000000000..38bf0f2cab3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Move/CPP/file move.cpp @@ -0,0 +1,44 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + String^ path2 = "c:\\temp2\\MyTest.txt"; + try + { + if ( !File::Exists( path ) ) + { + + // This statement ensures that the file is created, + // but the handle is not kept. + FileStream^ fs = File::Create( path ); + if ( fs ) + delete (IDisposable^)fs; + } + + // Ensure that the target does not exist. + if ( File::Exists( path2 ) ) + File::Delete( path2 ); + + // Move the file. + File::Move( path, path2 ); + Console::WriteLine( "{0} was moved to {1}.", path, path2 ); + + // See if the original exists now. + if ( File::Exists( path ) ) + { + Console::WriteLine( "The original file still exists, which is unexpected." ); + } + else + { + Console::WriteLine( "The original file no longer exists, which is expected." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp b/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp new file mode 100644 index 00000000000..1378629c6eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Open1/CPP/file open1.cpp @@ -0,0 +1,41 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + // Create a temporary file, and put some data into it. + String^ path = Path::GetTempFileName(); + FileStream^ fs = File::Open( path, FileMode::Open, FileAccess::Write, FileShare::None ); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + + // Open the stream and read it back. + fs = File::Open( path, FileMode::Open ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp b/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp new file mode 100644 index 00000000000..09b89e18c7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Open2/CPP/file open2.cpp @@ -0,0 +1,57 @@ +// + +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + // This sample assumes that you have a folder named "c:\temp" on your computer. + String^ filePath = "c:\\temp\\MyTest.txt"; + // Delete the file if it exists. + if (File::Exists( filePath )) + { + File::Delete( filePath ); + } + // Create the file. + FileStream^ fs = File::Create( filePath ); + try + { + array^ info = ( gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + + // Open the stream and read it back. + fs = File::Open( filePath, FileMode::Open, FileAccess::Read ); + try + { + array^ b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + try + { + // Try to write to the file. + fs->Write( b, 0, b->Length ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Writing was disallowed, as expected: {0}", e->ToString() ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp b/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp new file mode 100644 index 00000000000..c8b21c2f7d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File Open3/CPP/file open3.cpp @@ -0,0 +1,65 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Create the file if it does not exist. + if ( !File::Exists( path ) ) + { + // Create the file. + FileStream^ fs = File::Create( path ); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + // Open the stream and read it back. + FileStream^ fs = File::Open( path, FileMode::Open, FileAccess::Read, FileShare::None ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + try + { + // Try to get another handle to the same file. + FileStream^ fs2 = File::Open( path, FileMode::Open ); + try + { + // Do some task here. + } + finally + { + if ( fs2 ) + delete (IDisposable^)fs2; + } + } + catch ( Exception^ e ) + { + Console::Write( "Opening the file twice is disallowed." ); + Console::WriteLine( ", as expected: {0}", e ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp new file mode 100644 index 00000000000..d257fe26072 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File OpenRead/CPP/file openread.cpp @@ -0,0 +1,45 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + if ( !File::Exists( path ) ) + { + // Create the file. + FileStream^ fs = File::Create( path ); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + // Open the stream and read it back. + FileStream^ fs = File::OpenRead( path ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp new file mode 100644 index 00000000000..8bbd948b4c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File OpenText/CPP/file opentext.cpp @@ -0,0 +1,43 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + if ( !File::Exists( path ) ) + { + // Create the file. + FileStream^ fs = File::Create( path ); + try + { + array^info = (gcnew UTF8Encoding( true ))->GetBytes( "This is some text in the file." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + // Open the stream and read it back. + StreamReader^ sr = File::OpenText( path ); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp new file mode 100644 index 00000000000..e08318b7bf6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File OpenWrite/CPP/file openwrite.cpp @@ -0,0 +1,47 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // Open the stream and write to it. + { + FileStream^ fs = File::OpenWrite( path ); + try + { + array^info = (gcnew UTF8Encoding( true ))-> + GetBytes( "This is to test the OpenWrite method." ); + + // Add some information to the file. + fs->Write( info, 0, info->Length ); + } + finally + { + if ( fs ) + delete (IDisposable^)fs; + } + } + + // Open the stream and read it back. + { + FileStream^ fs = File::OpenRead( path ); + try + { + array^b = gcnew array(1024); + UTF8Encoding^ temp = gcnew UTF8Encoding( true ); + while ( fs->Read( b, 0, b->Length ) > 0 ) + { + Console::WriteLine( temp->GetString( b ) ); + } + } + finally + { + if ( fs ) + delete(IDisposable^)fs; + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp b/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp new file mode 100644 index 00000000000..3fe8c6832a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File SetLastAccess/CPP/file setlastaccess.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\Temp\\MyTest.txt"; + if ( !File::Exists( path ) ) + { + File::Create( path ); + + // Update the last access time. + } + File::SetLastAccessTime( path, DateTime(1985,5,4) ); + + // Get the creation time of a well-known directory. + DateTime dt = File::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this file was {0}.", dt ); + + // Update the last access time. + File::SetLastAccessTime( path, DateTime::Now ); + dt = File::GetLastAccessTime( path ); + Console::WriteLine( "The last access time for this file was {0}.", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp b/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp new file mode 100644 index 00000000000..8b796882ead --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File SetLastWrite/CPP/file setlastwrite.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + String^ path = "c:\\Temp\\MyTest.txt"; + if ( !File::Exists( path ) ) + { + File::Create( path ); + } + else + { + + // Take an action that will affect the write time. + File::SetLastWriteTime( path, DateTime(1985,4,3) ); + } + + // Get the creation time of a well-known directory. + DateTime dt = File::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this file was {0}.", dt ); + + // Update the last write time. + File::SetLastWriteTime( path, DateTime::Now ); + dt = File::GetLastWriteTime( path ); + Console::WriteLine( "The last write time for this file was {0}.", dt ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp b/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp new file mode 100644 index 00000000000..f16d9cbcb6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FileInfoCopyTo1/CPP/fileinfocopyto1.cpp @@ -0,0 +1,50 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + + // Create a reference to a file, which might or might not exist. + // If it does not exist, it is not yet created. + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Create a writer, ready to add entries to the file. + StreamWriter^ sw = fi->AppendText(); + sw->WriteLine( "Add as many lines as you like..." ); + sw->WriteLine( "Add another line to the output..." ); + sw->Flush(); + sw->Close(); + + // Get the information out of the file and display it. + StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); + Console::WriteLine( "This is the information in the first file:" ); + while ( sr->Peek() != -1 ) + Console::WriteLine( sr->ReadLine() ); + + // Copy this file to another file. The file will not be overwritten if it already exists. + FileInfo^ newfi = fi->CopyTo( "newTemp.txt" ); + + // Get the information out of the new file and display it.* sr = new StreamReader(newfi->OpenRead()); + Console::WriteLine( "{0}This is the information in the second file:", Environment::NewLine ); + while ( sr->Peek() != -1 ) + Console::WriteLine( sr->ReadLine() ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is the information in the first file: +//Add as many lines as you like... +//Add another line to the output... +// +//This is the information in the second file: + +// diff --git a/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp b/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp new file mode 100644 index 00000000000..49b2ff55954 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FileLength/CPP/filelength.cpp @@ -0,0 +1,45 @@ + +// +// The following example displays the names and sizes +// of the files in the specified directory. +using namespace System; +using namespace System::IO; +int main() +{ + + // Make a reference to a directory. + DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" ); + + // Get a reference to each file in that directory. + array^fiArr = di->GetFiles(); + + // Display the names and sizes of the files. + Console::WriteLine( "The directory {0} contains the following files:", di->Name ); + System::Collections::IEnumerator^ myEnum = fiArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FileInfo^ f = safe_cast(myEnum->Current); + Console::WriteLine( "The size of {0} is {1} bytes.", f->Name, f->Length ); + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//The directory c:\ contains the following files: +//The size of MyComputer.log is 274 bytes. +//The size of AUTOEXEC.BAT is 0 bytes. +//The size of boot.ini is 211 bytes. +//The size of CONFIG.SYS is 0 bytes. +//The size of hiberfil.sys is 1072775168 bytes. +//The size of IO.SYS is 0 bytes. +//The size of MASK.txt is 2700 bytes. +//The size of mfc80.dll is 1093632 bytes. +//The size of mfc80u.dll is 1079808 bytes. +//The size of MSDOS.SYS is 0 bytes. +//The size of NTDETECT.COM is 47564 bytes. +//The size of ntldr is 250032 bytes. +//The size of pagefile.sys is 1610612736 bytes. +//The size of UpdatePatch.log is 22778 bytes. +//The size of UpdatePatch.txt is 30 bytes. +//The size of wt3d.ini is 234 bytes. +// diff --git a/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp new file mode 100644 index 00000000000..c6df18efd4e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/FileSystemInfo/cpp/program.cpp @@ -0,0 +1,58 @@ +// +using namespace System; +using namespace System::IO; + + +namespace ConsoleApplication2 +{ + public ref class Program + { + public: + static void Main() + { + // Loop through all the immediate subdirectories of C. + for each (String^ entry in Directory::GetDirectories("C:\\")) + { + DisplayFileSystemInfoAttributes(gcnew DirectoryInfo(entry)); + } + // Loop through all the files in C. + for each (String^ entry in Directory::GetFiles("C:\\")) + { + DisplayFileSystemInfoAttributes(gcnew FileInfo(entry)); + } + } + // + static void DisplayFileSystemInfoAttributes(FileSystemInfo^ fsi) + { + // Assume that this entry is a file. + String^ entryType = "File"; + + // Determine if entry is really a directory + if ((fsi->Attributes & FileAttributes::Directory) == FileAttributes::Directory) + { + entryType = "Directory"; + } + // Show this entry's type, name, and creation date. + Console::WriteLine("{0} entry {1} was created on {2:D}", entryType, fsi->FullName, fsi->CreationTime); + } + // + }; +}; + +int main() +{ + ConsoleApplication2::Program::Main(); +} + + // Output will vary based on contents of drive C. + + // Directory entry C:\Documents and Settings was created on Tuesday, November 25, 2003 + // Directory entry C:\Inetpub was created on Monday, January 12, 2004 + // Directory entry C:\Program Files was created on Tuesday, November 25, 2003 + // Directory entry C:\RECYCLER was created on Tuesday, November 25, 2003 + // Directory entry C:\System Volume Information was created on Tuesday, November 2, 2003 + // Directory entry C:\WINDOWS was created on Tuesday, November 25, 2003 + // File entry C:\IO.SYS was created on Tuesday, November 25, 2003 + // File entry C:\MSDOS.SYS was created on Tuesday, November 25, 2003 + // File entry C:\pagefile.sys was created on Saturday, December 27, 2003 +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp b/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp new file mode 100644 index 00000000000..33129302fbb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/File_AppendText/CPP/file_appendtext.cpp @@ -0,0 +1,58 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + + // This text is added only once to the file. + if ( !File::Exists( path ) ) + { + // Create a file to write to. + StreamWriter^ sw = File::CreateText( path ); + try + { + sw->WriteLine( "Hello" ); + sw->WriteLine( "And" ); + sw->WriteLine( "Welcome" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + } + + // This text is always added, making the file longer over time + // if it is not deleted. + StreamWriter^ sw = File::AppendText( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is Extra" ); + sw->WriteLine( "Text" ); + } + finally + { + if ( sw ) + delete (IDisposable^)sw; + } + + // Open the file to read from. + StreamReader^ sr = File::OpenText( path ); + try + { + String^ s = ""; + while ( s = sr->ReadLine() ) + { + Console::WriteLine( s ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp new file mode 100644 index 00000000000..44aa0f37782 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/GCNotification/cpp/program.cpp @@ -0,0 +1,242 @@ +// +// +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Threading; + +namespace GCNotify +{ + ref class Program + { + private: + // Variable for continual checking in the + // While loop in the WaitForFullGCProc method. + static bool checkForNotify = false; + + // Variable for suspending work + // (such servicing allocated server requests) + // after a notification is received and then + // resuming allocation after inducing a garbage collection. + static bool bAllocate = false; + + // Variable for ending the example. + static bool finalExit = false; + + // Collection for objects that + // simulate the server request workload. + static List^>^ load = gcnew List^>(); + + + public: + static void Main() + { + try + { + // Register for a notification. + GC::RegisterForFullGCNotification(10, 10); + Console::WriteLine("Registered for GC notification."); + + checkForNotify = true; + bAllocate = true; + + // Start a thread using WaitForFullGCProc. + Thread^ thWaitForFullGC = gcnew Thread(gcnew ThreadStart(&WaitForFullGCProc)); + thWaitForFullGC->Start(); + + // While the thread is checking for notifications in + // WaitForFullGCProc, create objects to simulate a server workload. + try + { + int lastCollCount = 0; + int newCollCount = 0; + + + while (true) + { + if (bAllocate) + { + load->Add(gcnew array(1000)); + newCollCount = GC::CollectionCount(2); + if (newCollCount != lastCollCount) + { + // Show collection count when it increases: + Console::WriteLine("Gen 2 collection count: {0}", GC::CollectionCount(2).ToString()); + lastCollCount = newCollCount; + } + + // For ending the example (arbitrary). + if (newCollCount == 500) + { + finalExit = true; + checkForNotify = false; + break; + } + } + } + + } + catch (OutOfMemoryException^) + { + Console::WriteLine("Out of memory."); + } + + + // + finalExit = true; + checkForNotify = false; + GC::CancelFullGCNotification(); + // + + } + catch (InvalidOperationException^ invalidOp) + { + + Console::WriteLine("GC Notifications are not supported while concurrent GC is enabled.\n" + + invalidOp->Message); + } + } + + // + public: + static void OnFullGCApproachNotify() + { + Console::WriteLine("Redirecting requests."); + + // Method that tells the request queuing + // server to not direct requests to this server. + RedirectRequests(); + + // Method that provides time to + // finish processing pending requests. + FinishExistingRequests(); + + // This is a good time to induce a GC collection + // because the runtime will induce a full GC soon. + // To be very careful, you can check precede with a + // check of the GC.GCCollectionCount to make sure + // a full GC did not already occur since last notified. + GC::Collect(); + Console::WriteLine("Induced a collection."); + + } + // + + + // + public: + static void OnFullGCCompleteEndNotify() + { + // Method that informs the request queuing server + // that this server is ready to accept requests again. + AcceptRequests(); + Console::WriteLine("Accepting requests again."); + } + // + + // + public: + static void WaitForFullGCProc() + { + while (true) + { + // CheckForNotify is set to true and false in Main. + while (checkForNotify) + { + // + // Check for a notification of an approaching collection. + GCNotificationStatus s = GC::WaitForFullGCApproach(); + if (s == GCNotificationStatus::Succeeded) + { + Console::WriteLine("GC Notifiction raised."); + OnFullGCApproachNotify(); + } + else if (s == GCNotificationStatus::Canceled) + { + Console::WriteLine("GC Notification cancelled."); + break; + } + else + { + // This can occur if a timeout period + // is specified for WaitForFullGCApproach(Timeout) + // or WaitForFullGCComplete(Timeout) + // and the time out period has elapsed. + Console::WriteLine("GC Notification not applicable."); + break; + } + // + + // + // Check for a notification of a completed collection. + s = GC::WaitForFullGCComplete(); + if (s == GCNotificationStatus::Succeeded) + { + Console::WriteLine("GC Notification raised."); + OnFullGCCompleteEndNotify(); + } + else if (s == GCNotificationStatus::Canceled) + { + Console::WriteLine("GC Notification cancelled."); + break; + } + else + { + // Could be a time out. + Console::WriteLine("GC Notification not applicable."); + break; + } + // + } + + + Thread::Sleep(500); + // FinalExit is set to true right before + // the main thread cancelled notification. + if (finalExit) + { + break; + } + } + } + // + + // + private: + static void RedirectRequests() + { + // Code that sends requests + // to other servers. + + // Suspend work. + bAllocate = false; + + } + + static void FinishExistingRequests() + { + // Code that waits a period of time + // for pending requests to finish. + + // Clear the simulated workload. + load->Clear(); + + } + + static void AcceptRequests() + { + // Code that resumes processing + // requests on this server. + + // Resume work. + bAllocate = true; + } + // + }; +} + +int main() +{ + GCNotify::Program::Main(); +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp new file mode 100644 index 00000000000..5c9e28f3fbd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source.cpp @@ -0,0 +1,184 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class Example +{ +public: + static void Main() + { + // + // Create a new dictionary of strings, with string keys. + // + Dictionary^ openWith = + gcnew Dictionary(); + + // Add some elements to the dictionary. There are no + // duplicate keys, but some of the values are duplicates. + openWith->Add("txt", "notepad.exe"); + openWith->Add("bmp", "paint.exe"); + openWith->Add("dib", "paint.exe"); + openWith->Add("rtf", "wordpad.exe"); + + // The Add method throws an exception if the new key is + // already in the dictionary. + try + { + openWith->Add("txt", "winword.exe"); + } + catch (ArgumentException^) + { + Console::WriteLine("An element with Key = \"txt\" already exists."); + } + // + + // + // The Item property is another name for the indexer, so you + // can omit its name when accessing elements. + Console::WriteLine("For key = \"rtf\", value = {0}.", + openWith["rtf"]); + + // The indexer can be used to change the value associated + // with a key. + openWith["rtf"] = "winword.exe"; + Console::WriteLine("For key = \"rtf\", value = {0}.", + openWith["rtf"]); + + // If a key does not exist, setting the indexer for that key + // adds a new key/value pair. + openWith["doc"] = "winword.exe"; + // + + // + // The indexer throws an exception if the requested key is + // not in the dictionary. + try + { + Console::WriteLine("For key = \"tif\", value = {0}.", + openWith["tif"]); + } + catch (KeyNotFoundException^) + { + Console::WriteLine("Key = \"tif\" is not found."); + } + // + + // + // When a program often has to try keys that turn out not to + // be in the dictionary, TryGetValue can be a more efficient + // way to retrieve values. + String^ value = ""; + if (openWith->TryGetValue("tif", value)) + { + Console::WriteLine("For key = \"tif\", value = {0}.", value); + } + else + { + Console::WriteLine("Key = \"tif\" is not found."); + } + // + + // + // ContainsKey can be used to test keys before inserting + // them. + if (!openWith->ContainsKey("ht")) + { + openWith->Add("ht", "hypertrm.exe"); + Console::WriteLine("Value added for key = \"ht\": {0}", + openWith["ht"]); + } + // + + // + // When you use foreach to enumerate dictionary elements, + // the elements are retrieved as KeyValuePair objects. + Console::WriteLine(); + for each( KeyValuePair kvp in openWith ) + { + Console::WriteLine("Key = {0}, Value = {1}", + kvp.Key, kvp.Value); + } + // + + // + // To get the values alone, use the Values property. + Dictionary::ValueCollection^ valueColl = + openWith->Values; + + // The elements of the ValueCollection are strongly typed + // with the type that was specified for dictionary values. + Console::WriteLine(); + for each( String^ s in valueColl ) + { + Console::WriteLine("Value = {0}", s); + } + // + + // + // To get the keys alone, use the Keys property. + Dictionary::KeyCollection^ keyColl = + openWith->Keys; + + // The elements of the KeyCollection are strongly typed + // with the type that was specified for dictionary keys. + Console::WriteLine(); + for each( String^ s in keyColl ) + { + Console::WriteLine("Key = {0}", s); + } + // + + // + // Use the Remove method to remove a key/value pair. + Console::WriteLine("\nRemove(\"doc\")"); + openWith->Remove("doc"); + + if (!openWith->ContainsKey("doc")) + { + Console::WriteLine("Key \"doc\" is not found."); + } + // + } +}; + +int main() +{ + Example::Main(); +} + +/* This code example produces the following output: + +An element with Key = "txt" already exists. +For key = "rtf", value = wordpad.exe. +For key = "rtf", value = winword.exe. +Key = "tif" is not found. +Key = "tif" is not found. +Value added for key = "ht": hypertrm.exe + +Key = txt, Value = notepad.exe +Key = bmp, Value = paint.exe +Key = dib, Value = paint.exe +Key = rtf, Value = winword.exe +Key = doc, Value = winword.exe +Key = ht, Value = hypertrm.exe + +Value = notepad.exe +Value = paint.exe +Value = paint.exe +Value = winword.exe +Value = winword.exe +Value = hypertrm.exe + +Key = txt +Key = bmp +Key = dib +Key = rtf +Key = doc +Key = ht + +Remove("doc") +Key "doc" is not found. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp new file mode 100644 index 00000000000..b16f6d80b9c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.Dictionary/cpp/source2.cpp @@ -0,0 +1,35 @@ +using namespace System; +using namespace System::Collections::Generic; +//using namespace System::Threading; + +public ref class Example +{ +public: + static void Main() + { + // Create a new dictionary of strings, with string keys. + // + Dictionary^ myDictionary = + gcnew Dictionary(); + + // Add some elements to the dictionary. There are no + // duplicate keys, but some of the values are duplicates. + myDictionary->Add("txt", "notepad.exe"); + myDictionary->Add("bmp", "paint.exe"); + myDictionary->Add("dib", "paint.exe"); + myDictionary->Add("rtf", "wordpad.exe"); + + // + for each(KeyValuePair kvp in myDictionary) + { + Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); + } + // + } +}; + +int main() +{ + Example::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp new file mode 100644 index 00000000000..96a21ffd2f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source.cpp @@ -0,0 +1,182 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class Example +{ +public: + static void Main() + { + // + // Create a new dictionary of strings, with string keys, + // and access it through the IDictionary generic interface. + IDictionary^ openWith = + gcnew Dictionary(); + + // Add some elements to the dictionary. There are no + // duplicate keys, but some of the values are duplicates. + openWith->Add("txt", "notepad.exe"); + openWith->Add("bmp", "paint.exe"); + openWith->Add("dib", "paint.exe"); + openWith->Add("rtf", "wordpad.exe"); + + // The Add method throws an exception if the new key is + // already in the dictionary. + try + { + openWith->Add("txt", "winword.exe"); + } + catch (ArgumentException^) + { + Console::WriteLine("An element with Key = \"txt\" already exists."); + } + // + + // + // The Item property is another name for the indexer, so you + // can omit its name when accessing elements. + Console::WriteLine("For key = \"rtf\", value = {0}.", + openWith["rtf"]); + + // The indexer can be used to change the value associated + // with a key. + openWith["rtf"] = "winword.exe"; + Console::WriteLine("For key = \"rtf\", value = {0}.", + openWith["rtf"]); + + // If a key does not exist, setting the indexer for that key + // adds a new key/value pair. + openWith["doc"] = "winword.exe"; + // + + // + // The indexer throws an exception if the requested key is + // not in the dictionary. + try + { + Console::WriteLine("For key = \"tif\", value = {0}.", + openWith["tif"]); + } + catch (KeyNotFoundException^) + { + Console::WriteLine("Key = \"tif\" is not found."); + } + // + + // + // When a program often has to try keys that turn out not to + // be in the dictionary, TryGetValue can be a more efficient + // way to retrieve values. + String^ value = ""; + if (openWith->TryGetValue("tif", value)) + { + Console::WriteLine("For key = \"tif\", value = {0}.", value); + } + else + { + Console::WriteLine("Key = \"tif\" is not found."); + } + // + + // + // ContainsKey can be used to test keys before inserting + // them. + if (!openWith->ContainsKey("ht")) + { + openWith->Add("ht", "hypertrm.exe"); + Console::WriteLine("Value added for key = \"ht\": {0}", + openWith["ht"]); + } + // + + // + // When you use foreach to enumerate dictionary elements, + // the elements are retrieved as KeyValuePair objects. + Console::WriteLine(); + for each( KeyValuePair kvp in openWith ) + { + Console::WriteLine("Key = {0}, Value = {1}", + kvp.Key, kvp.Value); + } + // + + // + // To get the values alone, use the Values property. + ICollection^ icoll = openWith->Values; + + // The elements of the ValueCollection are strongly typed + // with the type that was specified for dictionary values. + Console::WriteLine(); + for each( String^ s in icoll ) + { + Console::WriteLine("Value = {0}", s); + } + // + + // + // To get the keys alone, use the Keys property. + icoll = openWith->Keys; + + // The elements of the ValueCollection are strongly typed + // with the type that was specified for dictionary values. + Console::WriteLine(); + for each( String^ s in icoll ) + { + Console::WriteLine("Key = {0}", s); + } + // + + // + // Use the Remove method to remove a key/value pair. + Console::WriteLine("\nRemove(\"doc\")"); + openWith->Remove("doc"); + + if (!openWith->ContainsKey("doc")) + { + Console::WriteLine("Key \"doc\" is not found."); + } + // + } +}; + +int main() +{ + Example::Main(); +} + +/* This code example produces the following output: + +An element with Key = "txt" already exists. +For key = "rtf", value = wordpad.exe. +For key = "rtf", value = winword.exe. +Key = "tif" is not found. +Key = "tif" is not found. +Value added for key = "ht": hypertrm.exe + +Key = txt, Value = notepad.exe +Key = bmp, Value = paint.exe +Key = dib, Value = paint.exe +Key = rtf, Value = winword.exe +Key = doc, Value = winword.exe +Key = ht, Value = hypertrm.exe + +Value = notepad.exe +Value = paint.exe +Value = paint.exe +Value = winword.exe +Value = winword.exe +Value = hypertrm.exe + +Key = txt +Key = bmp +Key = dib +Key = rtf +Key = doc +Key = ht + +Remove("doc") +Key "doc" is not found. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp new file mode 100644 index 00000000000..d3c038ba91c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.IDictionary/cpp/source2.cpp @@ -0,0 +1,34 @@ +using namespace System; +using namespace System::Collections::Generic; + +public ref class Example +{ +public: + static void Main() + { + // Create a new dictionary of strings, with string keys. + // + Dictionary^ exDictionary = + gcnew Dictionary(); + + // Add some elements to the dictionary. There are no + // duplicate keys, but some of the values are duplicates. + exDictionary->Add(0, "notepad.exe"); + exDictionary->Add(1, "paint.exe"); + exDictionary->Add(2, "paint.exe"); + exDictionary->Add(3, "wordpad.exe"); + IDictionary^ myDictionary = exDictionary; + // + for each(KeyValuePair kvp in myDictionary) + { + Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); + } + // + } +}; + +int main() +{ + Example::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp new file mode 100644 index 00000000000..1439a447483 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.LinkedList/cpp/source.cpp @@ -0,0 +1,264 @@ +// +#using + +using namespace System; +using namespace System::Text; +using namespace System::Collections::Generic; + +public ref class Example +{ +public: + static void Main() + { + // + // Create the link list. + array^ words = + { "the", "fox", "jumped", "over", "the", "dog" }; + LinkedList^ sentence = gcnew LinkedList(words); + Display(sentence, "The linked list values:"); + Console::WriteLine("sentence.Contains(\"jumped\") = {0}", + sentence->Contains("jumped")); + // + + // Add the word 'today' to the beginning of the linked list. + sentence->AddFirst("today"); + Display(sentence, "Test 1: Add 'today' to beginning of the list:"); + + // + // Move the first node to be the last node. + LinkedListNode^ mark1 = sentence->First; + sentence->RemoveFirst(); + sentence->AddLast(mark1); + // + Display(sentence, "Test 2: Move first node to be last node:"); + + // Change the last node to 'yesterday'. + sentence->RemoveLast(); + sentence->AddLast("yesterday"); + Display(sentence, "Test 3: Change the last node to 'yesterday':"); + + // + // Move the last node to be the first node. + mark1 = sentence->Last; + sentence->RemoveLast(); + sentence->AddFirst(mark1); + // + Display(sentence, "Test 4: Move last node to be first node:"); + + + // + // Indicate the last occurence of 'the'. + sentence->RemoveFirst(); + LinkedListNode^ current = sentence->FindLast("the"); + // + IndicateNode(current, "Test 5: Indicate last occurence of 'the':"); + + // + // Add 'lazy' and 'old' after 'the' (the LinkedListNode named current). + sentence->AddAfter(current, "old"); + sentence->AddAfter(current, "lazy"); + // + IndicateNode(current, "Test 6: Add 'lazy' and 'old' after 'the':"); + + // + // Indicate 'fox' node. + current = sentence->Find("fox"); + IndicateNode(current, "Test 7: Indicate the 'fox' node:"); + + // Add 'quick' and 'brown' before 'fox': + sentence->AddBefore(current, "quick"); + sentence->AddBefore(current, "brown"); + // + IndicateNode(current, "Test 8: Add 'quick' and 'brown' before 'fox':"); + + // Keep a reference to the current node, 'fox', + // and to the previous node in the list. Indicate the 'dog' node. + mark1 = current; + LinkedListNode^ mark2 = current->Previous; + current = sentence->Find("dog"); + IndicateNode(current, "Test 9: Indicate the 'dog' node:"); + + // The AddBefore method throws an InvalidOperationException + // if you try to add a node that already belongs to a list. + Console::WriteLine("Test 10: Throw exception by adding node (fox) already in the list:"); + try + { + sentence->AddBefore(current, mark1); + } + catch (InvalidOperationException^ ex) + { + Console::WriteLine("Exception message: {0}", ex->Message); + } + Console::WriteLine(); + + // + // Remove the node referred to by mark1, and then add it + // before the node referred to by current. + // Indicate the node referred to by current. + sentence->Remove(mark1); + sentence->AddBefore(current, mark1); + // + IndicateNode(current, "Test 11: Move a referenced node (fox) before the current node (dog):"); + + // + // Remove the node referred to by current. + sentence->Remove(current); + // + IndicateNode(current, "Test 12: Remove current node (dog) and attempt to indicate it:"); + + // Add the node after the node referred to by mark2. + sentence->AddAfter(mark2, current); + IndicateNode(current, "Test 13: Add node removed in test 11 after a referenced node (brown):"); + + // The Remove method finds and removes the + // first node that that has the specified value. + sentence->Remove("old"); + Display(sentence, "Test 14: Remove node that has the value 'old':"); + + // + // When the linked list is cast to ICollection(Of String), + // the Add method adds a node to the end of the list. + sentence->RemoveLast(); + ICollection^ icoll = sentence; + icoll->Add("rhinoceros"); + // + Display(sentence, "Test 15: Remove last node, cast to ICollection, and add 'rhinoceros':"); + + Console::WriteLine("Test 16: Copy the list to an array:"); + // + // Create an array with the same number of + // elements as the inked list. + array^ sArray = gcnew array(sentence->Count); + sentence->CopyTo(sArray, 0); + + for each (String^ s in sArray) + { + Console::WriteLine(s); + } + // + + + // + // Release all the nodes. + sentence->Clear(); + + Console::WriteLine(); + Console::WriteLine("Test 17: Clear linked list. Contains 'jumped' = {0}", + sentence->Contains("jumped")); + // + + Console::ReadLine(); + } + +private: + static void Display(LinkedList^ words, String^ test) + { + Console::WriteLine(test); + for each (String^ word in words) + { + Console::Write(word + " "); + } + Console::WriteLine(); + Console::WriteLine(); + } + + static void IndicateNode(LinkedListNode^ node, String^ test) + { + Console::WriteLine(test); + if (node->List == nullptr) + { + Console::WriteLine("Node '{0}' is not in the list.\n", + node->Value); + return; + } + + StringBuilder^ result = gcnew StringBuilder("(" + node->Value + ")"); + LinkedListNode^ nodeP = node->Previous; + + while (nodeP != nullptr) + { + result->Insert(0, nodeP->Value + " "); + nodeP = nodeP->Previous; + } + + node = node->Next; + while (node != nullptr) + { + result->Append(" " + node->Value); + node = node->Next; + } + + Console::WriteLine(result); + Console::WriteLine(); + } +}; + +int main() +{ + Example::Main(); +} + +//This code example produces the following output: +// +//The linked list values: +//the fox jumped over the dog + +//Test 1: Add 'today' to beginning of the list: +//today the fox jumped over the dog + +//Test 2: Move first node to be last node: +//the fox jumped over the dog today + +//Test 3: Change the last node to 'yesterday': +//the fox jumped over the dog yesterday + +//Test 4: Move last node to be first node: +//yesterday the fox jumped over the dog + +//Test 5: Indicate last occurence of 'the': +//the fox jumped over (the) dog + +//Test 6: Add 'lazy' and 'old' after 'the': +//the fox jumped over (the) lazy old dog + +//Test 7: Indicate the 'fox' node: +//the (fox) jumped over the lazy old dog + +//Test 8: Add 'quick' and 'brown' before 'fox': +//the quick brown (fox) jumped over the lazy old dog + +//Test 9: Indicate the 'dog' node: +//the quick brown fox jumped over the lazy old (dog) + +//Test 10: Throw exception by adding node (fox) already in the list: +//Exception message: The LinkedList node belongs a LinkedList. + +//Test 11: Move a referenced node (fox) before the current node (dog): +//the quick brown jumped over the lazy old fox (dog) + +//Test 12: Remove current node (dog) and attempt to indicate it: +//Node 'dog' is not in the list. + +//Test 13: Add node removed in test 11 after a referenced node (brown): +//the quick brown (dog) jumped over the lazy old fox + +//Test 14: Remove node that has the value 'old': +//the quick brown dog jumped over the lazy fox + +//Test 15: Remove last node, cast to ICollection, and add 'rhinoceros': +//the quick brown dog jumped over the lazy rhinoceros + +//Test 16: Copy the list to an array: +//the +//quick +//brown +//dog +//jumped +//over +//the +//lazy +//rhinoceros + +//Test 17: Clear linked list. Contains 'jumped' = False +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp new file mode 100644 index 00000000000..8e667bffa93 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/remarks.cpp @@ -0,0 +1,41 @@ +#using + +using namespace System; +using namespace System::Collections::Generic; + +public ref class Example +{ +public: + static void Main() + { + // Create a new sorted list of strings, with string + // keys. + SortedList^ mySortedList = + gcnew SortedList(); + + // Add some elements to the list. There are no + // duplicate keys, but some of the values are duplicates. + mySortedList->Add(0, "notepad.exe"); + mySortedList->Add(1, "paint.exe"); + mySortedList->Add(2, "paint.exe"); + mySortedList->Add(3, "wordpad.exe"); + + // + String^ v = mySortedList->Values[3]; + // + + Console::WriteLine("Value at index 3: {0}", v); + + // + for each( KeyValuePair kvp in mySortedList ) + { + Console::WriteLine("Key = {0}, Value = {1}", kvp.Key, kvp.Value); + } + // + } +}; + +int main() +{ + Example::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp new file mode 100644 index 00000000000..47488deda3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Generic.SortedList/cpp/source.cpp @@ -0,0 +1,198 @@ +// +#using + +using namespace System; +using namespace System::Collections::Generic; + +public ref class Example +{ +public: + static void Main() + { + // + // Create a new sorted list of strings, with string + // keys. + SortedList^ openWith = + gcnew SortedList(); + + // Add some elements to the list. There are no + // duplicate keys, but some of the values are duplicates. + openWith->Add("txt", "notepad.exe"); + openWith->Add("bmp", "paint.exe"); + openWith->Add("dib", "paint.exe"); + openWith->Add("rtf", "wordpad.exe"); + + // The Add method throws an exception if the new key is + // already in the list. + try + { + openWith->Add("txt", "winword.exe"); + } + catch (ArgumentException^) + { + Console::WriteLine("An element with Key = \"txt\" already exists."); + } + // + + // + // The Item property is another name for the indexer, so you + // can omit its name when accessing elements. + Console::WriteLine("For key = \"rtf\", value = {0}.", + openWith["rtf"]); + + // The indexer can be used to change the value associated + // with a key. + openWith["rtf"] = "winword.exe"; + Console::WriteLine("For key = \"rtf\", value = {0}.", + openWith["rtf"]); + + // If a key does not exist, setting the indexer for that key + // adds a new key/value pair. + openWith["doc"] = "winword.exe"; + // + + // + // The indexer throws an exception if the requested key is + // not in the list. + try + { + Console::WriteLine("For key = \"tif\", value = {0}.", + openWith["tif"]); + } + catch (KeyNotFoundException^) + { + Console::WriteLine("Key = \"tif\" is not found."); + } + // + + // + // When a program often has to try keys that turn out not to + // be in the list, TryGetValue can be a more efficient + // way to retrieve values. + String^ value = ""; + if (openWith->TryGetValue("tif", value)) + { + Console::WriteLine("For key = \"tif\", value = {0}.", value); + } + else + { + Console::WriteLine("Key = \"tif\" is not found."); + } + // + + // + // ContainsKey can be used to test keys before inserting + // them. + if (!openWith->ContainsKey("ht")) + { + openWith->Add("ht", "hypertrm.exe"); + Console::WriteLine("Value added for key = \"ht\": {0}", + openWith["ht"]); + } + // + + // + // When you use foreach to enumerate list elements, + // the elements are retrieved as KeyValuePair objects. + Console::WriteLine(); + for each( KeyValuePair kvp in openWith ) + { + Console::WriteLine("Key = {0}, Value = {1}", + kvp.Key, kvp.Value); + } + // + + // + // To get the values alone, use the Values property. + IList^ ilistValues = openWith->Values; + + // The elements of the list are strongly typed with the + // type that was specified for the SortedList values. + Console::WriteLine(); + for each( String^ s in ilistValues ) + { + Console::WriteLine("Value = {0}", s); + } + + // The Values property is an efficient way to retrieve + // values by index. + Console::WriteLine("\nIndexed retrieval using the Values " + + "property: Values[2] = {0}", openWith->Values[2]); + // + + // + // To get the keys alone, use the Keys property. + IList^ ilistKeys = openWith->Keys; + + // The elements of the list are strongly typed with the + // type that was specified for the SortedList keys. + Console::WriteLine(); + for each( String^ s in ilistKeys ) + { + Console::WriteLine("Key = {0}", s); + } + + // The Keys property is an efficient way to retrieve + // keys by index. + Console::WriteLine("\nIndexed retrieval using the Keys " + + "property: Keys[2] = {0}", openWith->Keys[2]); + // + + // + // Use the Remove method to remove a key/value pair. + Console::WriteLine("\nRemove(\"doc\")"); + openWith->Remove("doc"); + + if (!openWith->ContainsKey("doc")) + { + Console::WriteLine("Key \"doc\" is not found."); + } + // + } +}; + +int main() +{ + Example::Main(); +} + +/* This code example produces the following output: + +An element with Key = "txt" already exists. +For key = "rtf", value = wordpad.exe. +For key = "rtf", value = winword.exe. +Key = "tif" is not found. +Key = "tif" is not found. +Value added for key = "ht": hypertrm.exe + +Key = bmp, Value = paint.exe +Key = dib, Value = paint.exe +Key = doc, Value = winword.exe +Key = ht, Value = hypertrm.exe +Key = rtf, Value = winword.exe +Key = txt, Value = notepad.exe + +Value = paint.exe +Value = paint.exe +Value = winword.exe +Value = hypertrm.exe +Value = winword.exe +Value = notepad.exe + +Indexed retrieval using the Values property: Values[2] = winword.exe + +Key = bmp +Key = dib +Key = doc +Key = ht +Key = rtf +Key = txt + +Indexed retrieval using the Keys property: Keys[2] = doc + +Remove("doc") +Key "doc" is not found. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp new file mode 100644 index 00000000000..9f909725077 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/GenericMethodBuilder/cpp/source.cpp @@ -0,0 +1,114 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class GenericReflectionSample +{ +}; + +int main() +{ + // Creating a dynamic assembly requires an AssemblyName + // object, and the current application domain. + // + AssemblyName^ asmName = + gcnew AssemblyName("EmittedAssembly"); + AppDomain^ domain = AppDomain::CurrentDomain; + AssemblyBuilder^ sampleAssemblyBuilder = + domain->DefineDynamicAssembly(asmName, + AssemblyBuilderAccess::RunAndSave); + + // Define the module that contains the code. For an + // assembly with one module, the module name is the + // assembly name plus a file extension. + ModuleBuilder^ sampleModuleBuilder = + sampleAssemblyBuilder->DefineDynamicModule(asmName->Name, + asmName->Name + ".dll"); + + TypeBuilder^ sampleTypeBuilder = + sampleModuleBuilder->DefineType("SampleType", + TypeAttributes::Public | TypeAttributes::Abstract); + + // + // Define a Shared, Public method with standard calling + // conventions. Do not specify the parameter types or the + // return type, because type parameters will be used for + // those types, and the type parameters have not been + // defined yet. + MethodBuilder^ sampleMethodBuilder = + sampleTypeBuilder->DefineMethod("SampleMethod", + MethodAttributes::Public | MethodAttributes::Static); + // + + // + // Defining generic parameters for the method makes it a + // generic method. By convention, type parameters are + // single alphabetic characters. T and U are used here. + // + array^ genericTypeNames = {"T", "U"}; + array^ genericTypes = + sampleMethodBuilder->DefineGenericParameters( + genericTypeNames); + // + + // + // Use the IsGenericMethod property to find out if a + // dynamic method is generic, and IsGenericMethodDefinition + // to find out if it defines a generic method. + Console::WriteLine("Is SampleMethod generic? {0}", + sampleMethodBuilder->IsGenericMethod); + Console::WriteLine( + "Is SampleMethod a generic method definition? {0}", + sampleMethodBuilder->IsGenericMethodDefinition); + // + + // + // Set parameter types for the method. The method takes + // one parameter, and its type is specified by the first + // type parameter, T. + array^ parameterTypes = {genericTypes[0]}; + sampleMethodBuilder->SetParameters(parameterTypes); + + // Set the return type for the method. The return type is + // specified by the second type parameter, U. + sampleMethodBuilder->SetReturnType(genericTypes[1]); + // + + // Generate a code body for the method. The method doesn't + // do anything except return null. + // + ILGenerator^ ilgen = sampleMethodBuilder->GetILGenerator(); + ilgen->Emit(OpCodes::Ldnull); + ilgen->Emit(OpCodes::Ret); + + // + // Complete the type. + Type^ sampleType = sampleTypeBuilder->CreateType(); + + // To bind types to a dynamic generic method, you must + // first call the GetMethod method on the completed type. + // You can then define an array of types, and bind them + // to the method. + MethodInfo^ sampleMethodInfo = sampleType->GetMethod("SampleMethod"); + array^ boundParameters = + {String::typeid, GenericReflectionSample::typeid}; + MethodInfo^ boundMethodInfo = + sampleMethodInfo->MakeGenericMethod(boundParameters); + // Display a string representing the bound method. + Console::WriteLine(boundMethodInfo); + // + + // Save the assembly, so it can be examined with Ildasm.exe. + sampleAssemblyBuilder->Save(asmName->Name + ".dll"); +} + +/* This code example produces the following output: +Is SampleMethod generic? True +Is SampleMethod a generic method definition? True +GenericReflectionSample SampleMethod[String,GenericReflectionSample](System.String) +*/ +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp new file mode 100644 index 00000000000..d3c27fc9117 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/ca1.cpp @@ -0,0 +1,42 @@ +// +using namespace System; +using namespace System::Reflection; + +[assembly:AssemblyTitle("CustAttrs1CPP")]; +[assembly:AssemblyDescription("GetCustomAttributes() Demo")]; +[assembly:AssemblyCompany("Microsoft")]; + +ref class Example +{}; + +static void main() +{ + Type^ clsType = Example::typeid; + + // Get the Assembly type to access its metadata. + Assembly^ assy = clsType->Assembly; + + // Iterate through the attributes for the assembly. + System::Collections::IEnumerator^ myEnum = Attribute::GetCustomAttributes( assy )->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Attribute^ attr = safe_cast(myEnum->Current); + + // Check for the AssemblyTitle attribute. + if ( attr->GetType() == AssemblyTitleAttribute::typeid ) + Console::WriteLine( "Assembly title is \"{0}\".", (dynamic_cast(attr))->Title ); + // Check for the AssemblyDescription attribute. + else + // Check for the AssemblyDescription attribute. + if ( attr->GetType() == AssemblyDescriptionAttribute::typeid ) + Console::WriteLine( "Assembly description is \"{0}\".", (dynamic_cast(attr))->Description ); + // Check for the AssemblyCompany attribute. + else if ( attr->GetType() == AssemblyCompanyAttribute::typeid ) + Console::WriteLine( "Assembly company is {0}.", (dynamic_cast(attr))->Company ); + } +} +// The example displays the following output: +// Assembly description is "GetCustomAttributes() Demo". +// Assembly company is Microsoft. +// Assembly title is "CustAttrs1CPP". +// diff --git a/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp new file mode 100644 index 00000000000..1756e0d976f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/GetCustomAttributes/CPP/custattrs.cpp @@ -0,0 +1,258 @@ + + +// +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel; + +// Assign some attributes to the module. +// Set the module's CLSCompliant attribute to false +// The CLSCompliant attribute is applicable for /target:module. +[module:Description("A sample description")]; +[module:CLSCompliant(false)]; +namespace CustAttrs2CS +{ + ref class DemoClass + { + public: + static void Main() + { + Type^ clsType = DemoClass::typeid; + + // Get the Module type to access its metadata. + Module^ module = clsType->Module; + + // Iterate through all the attributes for the module. + System::Collections::IEnumerator^ myEnum1 = Attribute::GetCustomAttributes( module )->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Attribute^ attr = safe_cast(myEnum1->Current); + + // Check for the Description attribute. + if ( attr->GetType() == DescriptionAttribute::typeid ) + Console::WriteLine( "Module {0} has the description \"{1}\".", module->Name, (dynamic_cast(attr))->Description ); + // Check for the CLSCompliant attribute. + else + + // Check for the CLSCompliant attribute. + if ( attr->GetType() == CLSCompliantAttribute::typeid ) + Console::WriteLine( "Module {0} {1} CLSCompliant.", module->Name, (dynamic_cast(attr))->IsCompliant ? (String^)"is" : "is not" ); + } + } + }; +} + + +/* + * Output: + * Module CustAttrs2CS.exe is not CLSCompliant. + * Module CustAttrs2CS.exe has the description "A sample description". + */ +// +// +using namespace System; +using namespace System::Runtime::InteropServices; + +namespace CustAttrs3CS +{ + // Set a GUID and ProgId attribute for this class. + + [Guid("BF235B41-52D1-46CC-9C55-046793DB363F")] + [ProgId("CustAttrs3CS.ClassWithGuidAndProgId")] + public ref class ClassWithGuidAndProgId{}; + + ref class DemoClass + { + public: + static void Main() + { + // Get the Class type to access its metadata. + Type^ clsType = ClassWithGuidAndProgId::typeid; + + // Iterate through all the attributes for the class. + System::Collections::IEnumerator^ myEnum2 = Attribute::GetCustomAttributes( clsType )->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + Attribute^ attr = safe_cast(myEnum2->Current); + + // Check for the Guid attribute. + if ( attr->GetType() == GuidAttribute::typeid ) + { + // Display the GUID. + Console::WriteLine( "Class {0} has a GUID.", clsType->Name ); + Console::WriteLine( "GUID: {{0}}.", (dynamic_cast(attr))->Value ); + } + // Check for the ProgId attribute. + else + + // Check for the ProgId attribute. + if ( attr->GetType() == ProgIdAttribute::typeid ) + { + // Display the ProgId. + Console::WriteLine( "Class {0} has a ProgId.", clsType->Name ); + Console::WriteLine( "ProgId: \"{0}\".", (dynamic_cast(attr))->Value ); + } + } + } + }; +} + + +/* + * Output: + * Class ClassWithGuidAndProgId has a GUID. + * GUID: {BF235B41-52D1-46CC-9C55-046793DB363F}. + * Class ClassWithGuidAndProgId has a ProgId. + * ProgId: "CustAttrs3CS.ClassWithGuidAndProgId". + */ +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security; +using namespace System::Runtime::InteropServices; + +namespace CustAttrs4CS +{ + // Create a class for Win32 imported unmanaged functions. + public ref class Win32 + { + public: + + [DllImport("user32.dll", CharSet = CharSet::Unicode)] + static int MessageBox( int hWnd, String^ text, String^ caption, UInt32 type ); + }; + + public ref class AClass + { + public: + + // Add some attributes to the Win32CallMethod. + + [Obsolete("This method is obsolete. Use managed MsgBox instead.")] + void Win32CallMethod() + { + Win32::MessageBox( 0, "This is an unmanaged call.", "Be Careful!", 0 ); + } + + }; + + ref class DemoClass + { + public: + static void Main() + { + // Get the Class type to access its metadata. + Type^ clsType = AClass::typeid; + + // Get the type information for the Win32CallMethod. + MethodInfo^ mInfo = clsType->GetMethod( "Win32CallMethod" ); + if ( mInfo != nullptr ) + { + // Iterate through all the attributes for the method. + System::Collections::IEnumerator^ myEnum3 = Attribute::GetCustomAttributes( mInfo )->GetEnumerator(); + while ( myEnum3->MoveNext() ) + { + Attribute^ attr = safe_cast(myEnum3->Current); + + // Check for the Obsolete attribute. + if ( attr->GetType() == ObsoleteAttribute::typeid ) + { + Console::WriteLine( "Method {0} is obsolete. " + "The message is:", mInfo->Name ); + Console::WriteLine( (dynamic_cast(attr))->Message ); + } + // Check for the SuppressUnmanagedCodeSecurity attribute. + else + + // Check for the SuppressUnmanagedCodeSecurity attribute. + if ( attr->GetType() == SuppressUnmanagedCodeSecurityAttribute::typeid ) + { + Console::WriteLine( "This method calls unmanaged code " + "with no security check." ); + Console::WriteLine( "Please do not use unless absolutely necessary." ); + AClass^ myCls = gcnew AClass; + myCls->Win32CallMethod(); + } + } + } + } + }; +} + + +/* + * Output: + * Method Win32CallMethod is obsolete. The message is: + * This method is obsolete. Use managed MsgBox instead. + * This method calls unmanaged code with no security check. + * Please do not use unless absolutely necessary. + */ +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel; + +namespace CustAttrs5CS +{ + public ref class AClass + { + public: + void ParamArrayAndDesc( + // Add ParamArray and Description attributes. + [Description("This argument is a ParamArray")] + array^args ) + {} + }; + + ref class DemoClass + { + public: + static void Main() + { + // Get the Class type to access its metadata. + Type^ clsType = AClass::typeid; + + // Get the type information for the method. + MethodInfo^ mInfo = clsType->GetMethod( "ParamArrayAndDesc" ); + if ( mInfo != nullptr ) + { + // Get the parameter information. + array^pInfo = mInfo->GetParameters(); + if ( pInfo != nullptr ) + { + // Iterate through all the attributes for the parameter. + System::Collections::IEnumerator^ myEnum4 = Attribute::GetCustomAttributes( pInfo[ 0 ] )->GetEnumerator(); + while ( myEnum4->MoveNext() ) + { + Attribute^ attr = safe_cast(myEnum4->Current); + + // Check for the ParamArray attribute. + if ( attr->GetType() == ParamArrayAttribute::typeid ) + Console::WriteLine( "Parameter {0} for method {1} " + "has the ParamArray attribute.", pInfo[ 0 ]->Name, mInfo->Name ); + // Check for the Description attribute. + else + + // Check for the Description attribute. + if ( attr->GetType() == DescriptionAttribute::typeid ) + { + Console::WriteLine( "Parameter {0} for method {1} " + "has a description attribute.", pInfo[ 0 ]->Name, mInfo->Name ); + Console::WriteLine( "The description is: \"{0}\"", (dynamic_cast(attr))->Description ); + } + } + } + } + } + }; +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp b/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp new file mode 100644 index 00000000000..4fd14cbab59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/GetFldVal/CPP/getfldval.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::Reflection; + +ref class Example +{ + public: + static String^ val = "test"; +}; + +int main() +{ + FieldInfo^ fld = Example::typeid->GetField( "val" ); + Console::WriteLine(fld->GetValue(nullptr) ); + Example::val = "hi"; + Console::WriteLine(fld->GetValue(nullptr) ); +} +// The example displays the following output: +// test +// hi +// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp new file mode 100644 index 00000000000..0f9f1c2f6ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACRIPEMD160/CPP/hmacripemd160.cpp @@ -0,0 +1,134 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +// Computes a keyed hash for a source file, creates a target file with the keyed hash +// prepended to the contents of the source file, then decrypts the file and compares +// the source and the decrypted files. +void EncodeFile( array^key, String^ sourceFile, String^ destFile ) +{ + + // Initialize the keyed hash object. + HMACRIPEMD160^ myhmacRIPEMD160 = gcnew HMACRIPEMD160( key ); + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); + + // Compute the hash of the input file. + array^hashValue = myhmacRIPEMD160->ComputeHash( inStream ); + + // Reset inStream to the beginning of the file. + inStream->Position = 0; + + // Write the computed hash value to the output file. + outStream->Write( hashValue, 0, hashValue->Length ); + + // Copy the contents of the sourceFile to the destFile. + int bytesRead; + + // read 1K at a time + array^buffer = gcnew array(1024); + do + { + + // Read from the wrapping CryptoStream. + bytesRead = inStream->Read( buffer, 0, 1024 ); + outStream->Write( buffer, 0, bytesRead ); + } + while ( bytesRead > 0 ); + + myhmacRIPEMD160->Clear(); + + // Close the streams + inStream->Close(); + outStream->Close(); + return; +} // end EncodeFile + + + +// Decrypt the encoded file and compare to original file. +bool DecodeFile( array^key, String^ sourceFile ) +{ + + // Initialize the keyed hash object. + HMACRIPEMD160^ hmacRIPEMD160 = gcnew HMACRIPEMD160( key ); + + // Create an array to hold the keyed hash value read from the file. + array^storedHash = gcnew array(hmacRIPEMD160->HashSize / 8); + + // Create a FileStream for the source file. + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + + // Read in the storedHash. + inStream->Read( storedHash, 0, storedHash->Length ); + + // Compute the hash of the remaining contents of the file. + // The stream is properly positioned at the beginning of the content, + // immediately after the stored hash value. + array^computedHash = hmacRIPEMD160->ComputeHash( inStream ); + + // compare the computed hash with the stored value + bool err = false; + for ( int i = 0; i < storedHash->Length; i++ ) + { + if ( computedHash[ i ] != storedHash[ i ] ) + { + err = true; + } + } + if (err) + { + Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); + return false; + } + else + { + Console::WriteLine("Hash values agree -- no tampering occurred."); + return true; + } + +} //end DecodeFile + + +int main() +{ + array^Fileargs = Environment::GetCommandLineArgs(); + String^ usageText = "Usage: HMACRIPEMD160 inputfile.txt encryptedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; + + //If no file names are specified, write usage text. + if ( Fileargs->Length < 3 ) + { + Console::WriteLine( usageText ); + } + else + { + try + { + + // Create a random key using a random number generator. This would be the + // secret key shared by sender and receiver. + array^secretkey = gcnew array(64); + + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + + // The array is now filled with cryptographically strong random bytes. + rng->GetBytes( secretkey ); + + // Use the secret key to encode the message file. + EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); + + // Take the encoded file and decode + DecodeFile( secretkey, Fileargs[ 2 ] ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "Error: File not found", e ); + } + + } +} //end main + + +// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp new file mode 100644 index 00000000000..d26844e8082 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA256/CPP/hmacsha256.cpp @@ -0,0 +1,134 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +// Computes a keyed hash for a source file, creates a target file with the keyed hash +// prepended to the contents of the source file, then decodes the file and compares +// the source and the decoded files. +void EncodeFile( array^key, String^ sourceFile, String^ destFile ) +{ + + // Initialize the keyed hash object. + HMACSHA256^ myhmacsha256 = gcnew HMACSHA256( key ); + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); + + // Compute the hash of the input file. + array^hashValue = myhmacsha256->ComputeHash( inStream ); + + // Reset inStream to the beginning of the file. + inStream->Position = 0; + + // Write the computed hash value to the output file. + outStream->Write( hashValue, 0, hashValue->Length ); + + // Copy the contents of the sourceFile to the destFile. + int bytesRead; + + // read 1K at a time + array^buffer = gcnew array(1024); + do + { + + // Read from the wrapping CryptoStream. + bytesRead = inStream->Read( buffer, 0, 1024 ); + outStream->Write( buffer, 0, bytesRead ); + } + while ( bytesRead > 0 ); + + myhmacsha256->Clear(); + + // Close the streams + inStream->Close(); + outStream->Close(); + return; +} // end EncodeFile + + + +// Decode the encoded file and compare to original file. +bool DecodeFile( array^key, String^ sourceFile ) +{ + + // Initialize the keyed hash object. + HMACSHA256^ hmacsha256 = gcnew HMACSHA256( key ); + + // Create an array to hold the keyed hash value read from the file. + array^storedHash = gcnew array(hmacsha256->HashSize / 8); + + // Create a FileStream for the source file. + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + + // Read in the storedHash. + inStream->Read( storedHash, 0, storedHash->Length ); + + // Compute the hash of the remaining contents of the file. + // The stream is properly positioned at the beginning of the content, + // immediately after the stored hash value. + array^computedHash = hmacsha256->ComputeHash( inStream ); + + // compare the computed hash with the stored value + bool err = false; + for ( int i = 0; i < storedHash->Length; i++ ) + { + if ( computedHash[ i ] != storedHash[ i ] ) + { + err = true; + } + } + if (err) + { + Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); + return false; + } + else + { + Console::WriteLine("Hash values agree -- no tampering occurred."); + return true; + } + +} //end DecodeFile + + +int main() +{ + array^Fileargs = Environment::GetCommandLineArgs(); + String^ usageText = "Usage: HMACSHA256 inputfile.txt encodedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; + + //If no file names are specified, write usage text. + if ( Fileargs->Length < 3 ) + { + Console::WriteLine( usageText ); + } + else + { + try + { + + // Create a random key using a random number generator. This would be the + // secret key shared by sender and receiver. + array^secretkey = gcnew array(64); + + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + + // The array is now filled with cryptographically strong random bytes. + rng->GetBytes( secretkey ); + + // Use the secret key to encode the message file. + EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); + + // Take the encoded file and decode + DecodeFile( secretkey, Fileargs[ 2 ] ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "Error: File not found", e ); + } + + } +} //end main + + +// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp new file mode 100644 index 00000000000..6dfcd8a29fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA384/CPP/hmacsha384.cpp @@ -0,0 +1,134 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +// Computes a keyed hash for a source file, creates a target file with the keyed hash +// prepended to the contents of the source file, then decrypts the file and compares +// the source and the decrypted files. +void EncodeFile( array^key, String^ sourceFile, String^ destFile ) +{ + + // Initialize the keyed hash object. + HMACSHA384^ myhmacsha384 = gcnew HMACSHA384( key ); + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); + + // Compute the hash of the input file. + array^hashValue = myhmacsha384->ComputeHash( inStream ); + + // Reset inStream to the beginning of the file. + inStream->Position = 0; + + // Write the computed hash value to the output file. + outStream->Write( hashValue, 0, hashValue->Length ); + + // Copy the contents of the sourceFile to the destFile. + int bytesRead; + + // read 1K at a time + array^buffer = gcnew array(1024); + do + { + + // Read from the wrapping CryptoStream. + bytesRead = inStream->Read( buffer, 0, 1024 ); + outStream->Write( buffer, 0, bytesRead ); + } + while ( bytesRead > 0 ); + + myhmacsha384->Clear(); + + // Close the streams + inStream->Close(); + outStream->Close(); + return; +} // end EncodeFile + + + +// Decrypt the encoded file and compare to original file. +bool DecodeFile( array^key, String^ sourceFile ) +{ + + // Initialize the keyed hash object. + HMACSHA384^ hmacsha384 = gcnew HMACSHA384( key ); + + // Create an array to hold the keyed hash value read from the file. + array^storedHash = gcnew array(hmacsha384->HashSize / 8); + + // Create a FileStream for the source file. + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + + // Read in the storedHash. + inStream->Read( storedHash, 0, storedHash->Length ); + + // Compute the hash of the remaining contents of the file. + // The stream is properly positioned at the beginning of the content, + // immediately after the stored hash value. + array^computedHash = hmacsha384->ComputeHash( inStream ); + + // compare the computed hash with the stored value + bool err = false; + for ( int i = 0; i < storedHash->Length; i++ ) + { + if ( computedHash[ i ] != storedHash[ i ] ) + { + err = true; + } + } + if (err) + { + Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); + return false; + } + else + { + Console::WriteLine("Hash values agree -- no tampering occurred."); + return true; + } + +} //end DecodeFile + + +int main() +{ + array^Fileargs = Environment::GetCommandLineArgs(); + String^ usageText = "Usage: HMACSHA384 inputfile.txt encryptedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; + + //If no file names are specified, write usage text. + if ( Fileargs->Length < 3 ) + { + Console::WriteLine( usageText ); + } + else + { + try + { + + // Create a random key using a random number generator. This would be the + // secret key shared by sender and receiver. + array^secretkey = gcnew array(64); + + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + + // The array is now filled with cryptographically strong random bytes. + rng->GetBytes( secretkey ); + + // Use the secret key to encode the message file. + EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); + + // Take the encoded file and decode + DecodeFile( secretkey, Fileargs[ 2 ] ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "Error: File not found", e ); + } + + } +} //end main + + +// diff --git a/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp new file mode 100644 index 00000000000..4f83ce4b8b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/HMACSHA512/CPP/hmacsha512.cpp @@ -0,0 +1,134 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +// Computes a keyed hash for a source file, creates a target file with the keyed hash +// prepended to the contents of the source file, then decrypts the file and compares +// the source and the decrypted files. +void EncodeFile( array^key, String^ sourceFile, String^ destFile ) +{ + + // Initialize the keyed hash object. + HMACSHA512^ myhmacsha512 = gcnew HMACSHA512( key ); + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + FileStream^ outStream = gcnew FileStream( destFile,FileMode::Create ); + + // Compute the hash of the input file. + array^hashValue = myhmacsha512->ComputeHash( inStream ); + + // Reset inStream to the beginning of the file. + inStream->Position = 0; + + // Write the computed hash value to the output file. + outStream->Write( hashValue, 0, hashValue->Length ); + + // Copy the contents of the sourceFile to the destFile. + int bytesRead; + + // read 1K at a time + array^buffer = gcnew array(1024); + do + { + + // Read from the wrapping CryptoStream. + bytesRead = inStream->Read( buffer, 0, 1024 ); + outStream->Write( buffer, 0, bytesRead ); + } + while ( bytesRead > 0 ); + + myhmacsha512->Clear(); + + // Close the streams + inStream->Close(); + outStream->Close(); + return; +} // end EncodeFile + + + +// Decrypt the encoded file and compare to original file. +bool DecodeFile( array^key, String^ sourceFile ) +{ + + // Initialize the keyed hash object. + HMACSHA512^ hmacsha512 = gcnew HMACSHA512( key ); + + // Create an array to hold the keyed hash value read from the file. + array^storedHash = gcnew array(hmacsha512->HashSize / 8); + + // Create a FileStream for the source file. + FileStream^ inStream = gcnew FileStream( sourceFile,FileMode::Open ); + + // Read in the storedHash. + inStream->Read( storedHash, 0, storedHash->Length ); + + // Compute the hash of the remaining contents of the file. + // The stream is properly positioned at the beginning of the content, + // immediately after the stored hash value. + array^computedHash = hmacsha512->ComputeHash( inStream ); + + // compare the computed hash with the stored value + bool err = false; + for ( int i = 0; i < storedHash->Length; i++ ) + { + if ( computedHash[ i ] != storedHash[ i ] ) + { + err = true; + } + } + if (err) + { + Console::WriteLine("Hash values differ! Encoded file has been tampered with!"); + return false; + } + else + { + Console::WriteLine("Hash values agree -- no tampering occurred."); + return true; + } + +} //end DecodeFile + + +int main() +{ + array^Fileargs = Environment::GetCommandLineArgs(); + String^ usageText = "Usage: HMACSHA512 inputfile.txt encryptedfile.hsh\nYou must specify the two file names. Only the first file must exist.\n"; + + //If no file names are specified, write usage text. + if ( Fileargs->Length < 3 ) + { + Console::WriteLine( usageText ); + } + else + { + try + { + + // Create a random key using a random number generator. This would be the + // secret key shared by sender and receiver. + array^secretkey = gcnew array(64); + + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + + // The array is now filled with cryptographically strong random bytes. + rng->GetBytes( secretkey ); + + // Use the secret key to encode the message file. + EncodeFile( secretkey, Fileargs[ 1 ], Fileargs[ 2 ] ); + + // Take the encoded file and decode + DecodeFile( secretkey, Fileargs[ 2 ] ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "Error: File not found", e ); + } + + } +} //end main + + +// diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp new file mode 100644 index 00000000000..b421c5517db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IComparable Example/CPP/source.cpp @@ -0,0 +1,81 @@ +// IComparableExample.cpp : main project file. + +// +using namespace System; +using namespace System::Collections; + +public ref class Temperature: public IComparable { + /// + /// IComparable.CompareTo implementation. + /// +protected: + // The value holder + Double m_value; + +public: + virtual Int32 CompareTo( Object^ obj ) { + + if (obj == nullptr) return 1; + + if ( obj->GetType() == Temperature::typeid ) { + Temperature^ temp = dynamic_cast(obj); + + return m_value.CompareTo( temp->m_value ); + } + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + property Double Value { + Double get() { + return m_value; + } + void set( Double value ) { + m_value = value; + } + } + + property Double Celsius { + Double get() { + return (m_value - 32) / 1.8; + } + void set( Double value ) { + m_value = (value * 1.8) + 32; + } + } +}; + +int main() +{ + ArrayList^ temperatures = gcnew ArrayList; + // Initialize random number generator. + Random^ rnd = gcnew Random; + + // Generate 10 temperatures between 0 and 100 randomly. + for (int ctr = 1; ctr <= 10; ctr++) + { + int degrees = rnd->Next(0, 100); + Temperature^ temp = gcnew Temperature; + temp->Value = degrees; + temperatures->Add(temp); + } + + // Sort ArrayList. + temperatures->Sort(); + + for each (Temperature^ temp in temperatures) + Console::WriteLine(temp->Value); + return 0; +} +// The example displays the following output to the console (individual +// values may vary because they are randomly generated): +// 2 +// 7 +// 16 +// 17 +// 31 +// 37 +// 58 +// 66 +// 72 +// 95 +// diff --git a/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp new file mode 100644 index 00000000000..8c4f0f164e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IComparable`1 Example/CPP/source.cpp @@ -0,0 +1,99 @@ +// +#using + +using namespace System; +using namespace System::Collections::Generic; + +public ref class Temperature: public IComparable { + +protected: + // The underlying temperature value. + Double m_value; + +public: + // Implement the generic CompareTo method with the Temperature class + // as the Type parameter. + virtual Int32 CompareTo( Temperature^ other ) { + + // If other is not a valid object reference, this instance + // is greater. + if (other == nullptr) return 1; + + // The temperature comparison depends on the comparison of the + // the underlying Double values. + return m_value.CompareTo( other->m_value ); + } + + // Define the is greater than operator. + bool operator>= (Temperature^ other) + { + return CompareTo(other) >= 0; + } + + // Define the is less than operator. + bool operator< (Temperature^ other) + { + return CompareTo(other) < 0; + } + + // Define the is greater than or equal to operator. + bool operator> (Temperature^ other) + { + return CompareTo(other) > 0; + } + + // Define the is less than or equal to operator. + bool operator<= (Temperature^ other) + { + return CompareTo(other) <= 0; + } + + property Double Celsius { + Double get() { + return m_value + 273.15; + } + } + + property Double Kelvin { + Double get() { + return m_value; + } + void set( Double value ) { + if (value < 0) + throw gcnew ArgumentException("Temperature cannot be less than absolute zero."); + else + m_value = value; + } + } + + Temperature(Double kelvins) { + this->Kelvin = kelvins; + } +}; + +int main() { + SortedList^ temps = + gcnew SortedList(); + + // Add entries to the sorted list, out of order. + temps->Add(gcnew Temperature(2017.15), "Boiling point of Lead"); + temps->Add(gcnew Temperature(0), "Absolute zero"); + temps->Add(gcnew Temperature(273.15), "Freezing point of water"); + temps->Add(gcnew Temperature(5100.15), "Boiling point of Carbon"); + temps->Add(gcnew Temperature(373.15), "Boiling point of water"); + temps->Add(gcnew Temperature(600.65), "Melting point of Lead"); + + for each( KeyValuePair^ kvp in temps ) + { + Console::WriteLine("{0} is {1} degrees Celsius.", kvp->Value, kvp->Key->Celsius); + } +} +/* The example displays the following output: + Absolute zero is 273.15 degrees Celsius. + Freezing point of water is 546.3 degrees Celsius. + Boiling point of water is 646.3 degrees Celsius. + Melting point of Lead is 873.8 degrees Celsius. + Boiling point of Lead is 2290.3 degrees Celsius. + Boiling point of Carbon is 5373.3 degrees Celsius. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp new file mode 100644 index 00000000000..59545a35ced --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFaultBlock/CPP/ilgenerator_beginfaultblock.cpp @@ -0,0 +1,102 @@ + +// System.Reflection.Emit.ILGenerator.BeginFaultBlock() +/* +The following program demonstrates the 'BeginFaultBlock()' method of 'ILGenerator' +class. Exception is raised by passing two integer values which are out of range, +the same is caught in the 'BeginExceptionBlock' which is non-filtered. First it +checks for the exception thrown in the 'BeginFaultBlock' and then emits the MSIL +instructions in 'BeginExceptFilterBlock'. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +Type^ AddType() +{ + // Create an assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "AdderExceptionAsm"; + + // Create dynamic assembly. + AppDomain^ myAppDomain = Thread::GetDomain(); + AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "AdderExceptionMod" ); + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "Adder" ); + array^myAdderParams = {int::typeid,int::typeid}; + + // Method to add two numbers. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, myAdderParams ); + ILGenerator^ myAdderIL = myMethodBuilder->GetILGenerator(); + + // Create constructor. + array^temp0 = {String::typeid}; + ConstructorInfo^ myConstructorInfo = OverflowException::typeid->GetConstructor( temp0 ); + MethodInfo^ myExToStrMI = OverflowException::typeid->GetMethod( "ToString" ); + array^temp1 = {String::typeid,Object::typeid}; + MethodInfo^ myWriteLineMI = Console::typeid->GetMethod( "WriteLine", temp1 ); + + // Declare local variable. + LocalBuilder^ myLocalBuilder1 = myAdderIL->DeclareLocal( int::typeid ); + LocalBuilder^ myLocalBuilder2 = myAdderIL->DeclareLocal( OverflowException::typeid ); + + // Define label. + Label myFailedLabel = myAdderIL->DefineLabel(); + Label myEndOfMethodLabel = myAdderIL->DefineLabel(); + + // Begin exception block. + Label myLabel = myAdderIL->BeginExceptionBlock(); + myAdderIL->Emit( OpCodes::Ldarg_0 ); + myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); + myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); + myAdderIL->Emit( OpCodes::Ldarg_1 ); + myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); + myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); + myAdderIL->Emit( OpCodes::Ldarg_0 ); + myAdderIL->Emit( OpCodes::Ldarg_1 ); + myAdderIL->Emit( OpCodes::Add_Ovf_Un ); + myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); + myAdderIL->Emit( OpCodes::Br_S, myEndOfMethodLabel ); + myAdderIL->MarkLabel( myFailedLabel ); + myAdderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 10 for addition." ); + myAdderIL->Emit( OpCodes::Newobj, myConstructorInfo ); + myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder2 ); + myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); + + // Call fault block. + myAdderIL->BeginFaultBlock(); + Console::WriteLine( "Fault block called." ); + + //Throw exception. + myAdderIL->ThrowException( NotSupportedException::typeid ); + + // Call finally block. + myAdderIL->BeginFinallyBlock(); + myAdderIL->Emit( OpCodes::Ldstr, "{0}" ); + myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); + myAdderIL->EmitCall( OpCodes::Callvirt, myExToStrMI, nullptr ); + myAdderIL->EmitCall( OpCodes::Call, myWriteLineMI, nullptr ); + myAdderIL->Emit( OpCodes::Ldc_I4_M1 ); + myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); + + // End exception block. + myAdderIL->EndExceptionBlock(); + myAdderIL->MarkLabel( myEndOfMethodLabel ); + myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder1 ); + myAdderIL->Emit( OpCodes::Ret ); + return myTypeBuilder->CreateType(); +} + +int main() +{ + Type^ myAddType = AddType(); + Object^ myObject1 = Activator::CreateInstance( myAddType ); + array^myObject2 = {11,12}; + + // Invoke member. + myAddType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, myObject1, myObject2 ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp new file mode 100644 index 00000000000..bc0c0c8e893 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ILGenerator_BeginFinallyBlock_2/CPP/ILGenerator_BeginFinallyBlock_2.cpp @@ -0,0 +1,114 @@ + +// System::Reflection::Emit::ILGenerator.BeginExceptFilterBlock() +// System::Reflection::Emit::ILGenerator.BeginFinallyBlock() +/* + The following program demonstrates the 'BeginExceptFilterBlock()' method and + 'BeginFinallyBlock()' of 'ILGenerator' class. Exception is raised by passing + two integer values which are out of range, the same is caught in the + 'BeginExceptionBlock' which is non-filtered and then emits the MSIL + instructions in 'BeginExceptFilterBlock' and 'BeginFinallyBlock'. +*/ +// +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class ILGenerator_BeginFinallyBlock +{ +public: + static Type^ AddType() + { + // Create an assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "AdderExceptionAsm"; + + // Create dynamic assembly. + AppDomain^ myAppDomain = Thread::GetDomain(); + AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "AdderExceptionMod" ); + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "Adder" ); + array^adderParams = {int::typeid,int::typeid}; + + // Define method to add two numbers. + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, adderParams ); + ILGenerator^ myAdderIL = myMethodBuilder->GetILGenerator(); + + // Create constructor. + array^type1 = {String::typeid}; + ConstructorInfo^ myConstructorInfo = OverflowException::typeid->GetConstructor( type1 ); + MethodInfo^ myExToStrMI = OverflowException::typeid->GetMethod( "ToString" ); + array^type2 = {String::typeid,Object::typeid}; + MethodInfo^ myWriteLineMI = Console::typeid->GetMethod( "WriteLine", type2 ); + + // Declare local variable. + LocalBuilder^ myLocalBuilder1 = myAdderIL->DeclareLocal( int::typeid ); + LocalBuilder^ myLocalBuilder2 = myAdderIL->DeclareLocal( OverflowException::typeid ); + + // Define label. + Label myFailedLabel = myAdderIL->DefineLabel(); + Label myEndOfMethodLabel = myAdderIL->DefineLabel(); + + // Begin exception block. + Label myLabel = myAdderIL->BeginExceptionBlock(); + myAdderIL->Emit( OpCodes::Ldarg_0 ); + myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); + myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); + myAdderIL->Emit( OpCodes::Ldarg_1 ); + myAdderIL->Emit( OpCodes::Ldc_I4_S, 10 ); + myAdderIL->Emit( OpCodes::Bgt_S, myFailedLabel ); + myAdderIL->Emit( OpCodes::Ldarg_0 ); + myAdderIL->Emit( OpCodes::Ldarg_1 ); + myAdderIL->Emit( OpCodes::Add_Ovf_Un ); + myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); + myAdderIL->Emit( OpCodes::Br_S, myEndOfMethodLabel ); + myAdderIL->MarkLabel( myFailedLabel ); + myAdderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 10 for add." ); + myAdderIL->Emit( OpCodes::Newobj, myConstructorInfo ); + myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder2 ); + myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); + + // Throw the exception. + myAdderIL->ThrowException( OverflowException::typeid ); + + // Call 'BeginExceptFilterBlock'. + myAdderIL->BeginExceptFilterBlock(); + myAdderIL->EmitWriteLine( "Except filter block called." ); + + // Call catch block. + myAdderIL->BeginCatchBlock( nullptr ); + + // Call other catch block. + myAdderIL->BeginCatchBlock( OverflowException::typeid ); + myAdderIL->Emit( OpCodes::Ldstr, "{0}" ); + myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder2 ); + myAdderIL->EmitCall( OpCodes::Callvirt, myExToStrMI, nullptr ); + myAdderIL->EmitCall( OpCodes::Call, myWriteLineMI, nullptr ); + myAdderIL->Emit( OpCodes::Ldc_I4_M1 ); + myAdderIL->Emit( OpCodes::Stloc_S, myLocalBuilder1 ); + + // Call finally block. + myAdderIL->BeginFinallyBlock(); + myAdderIL->EmitWriteLine( "Finally block called." ); + + // End the exception block. + myAdderIL->EndExceptionBlock(); + myAdderIL->MarkLabel( myEndOfMethodLabel ); + myAdderIL->Emit( OpCodes::Ldloc_S, myLocalBuilder1 ); + myAdderIL->Emit( OpCodes::Ret ); + return myTypeBuilder->CreateType(); + } +}; + +int main() +{ + Type^ myAddType = ILGenerator_BeginFinallyBlock::AddType(); + Object^ myObject1 = Activator::CreateInstance( myAddType ); + array^myObject2 = {15,15}; + myAddType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, myObject1, myObject2 ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp b/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp new file mode 100644 index 00000000000..125264cb896 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ILGenerator_Begin_EndScope/CPP/ilgenerator_begin_endscope.cpp @@ -0,0 +1,97 @@ + +// System.Reflection.Emit.ILGenerator +// System.Reflection.Emit.ILGenerator.BeginScope() +// System.Reflection.Emit.ILGenerator.EndScope() +/* +This program demonstrates the 'BeginScope()', 'EndScope()' methods and the class +'ILGenerator'. A dynamic class 'myTypeBuilder' is created in which a +constructor 'myConstructor' and a method 'myMethod' are created dynamically. Their IL's +are generated. A local variable 'myLocalBuilder' is declared using 'DeclareLocal' property +of 'myMethodIL'. The scope of 'myLocalBuilder' is specified using 'BeginScope' and +'EndScope' methods. Respective messages related to scope are printed on the console. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +int main() +{ + try + { + // + // + // Get the current AppDomain. + AppDomain^ myAppDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "SampleAssembly"; + + // Create a dynamic assembly 'myAssembly' with access mode 'Run'. + AssemblyBuilder^ myAssembly = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module 'myModule' in 'myAssembly'. + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "MyDynamicModule", true ); + + // Define a public class 'MyDynamicClass'. + TypeBuilder^ myTypeBuilder = myModule->DefineType( "MyDynamicClass", TypeAttributes::Public ); + + // Define a public string field. + FieldBuilder^ myField = myTypeBuilder->DefineField( "MyDynamicField", String::typeid, FieldAttributes::Public ); + + // Create the constructor. + array^myConstructorArgs = {String::typeid}; + ConstructorBuilder^ myConstructor = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, myConstructorArgs ); + + // Generate IL for 'myConstructor'. + ILGenerator^ myConstructorIL = myConstructor->GetILGenerator(); + + // Emit the necessary opcodes. + myConstructorIL->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ mySuperConstructor = Object::typeid->GetConstructor( gcnew array(0) ); + myConstructorIL->Emit( OpCodes::Call, mySuperConstructor ); + myConstructorIL->Emit( OpCodes::Ldarg_0 ); + myConstructorIL->Emit( OpCodes::Ldarg_1 ); + myConstructorIL->Emit( OpCodes::Stfld, myField ); + myConstructorIL->Emit( OpCodes::Ret ); + + // Define a dynamic method named 'MyDynamicMethod'. + MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyDynamicMethod", MethodAttributes::Public, String::typeid, nullptr ); + + // Generate IL for 'myMethod'. + ILGenerator^ myMethodIL = myMethod->GetILGenerator(); + + // Begin the scope for a local variable. + myMethodIL->BeginScope(); + LocalBuilder^ myLocalBuilder = myMethodIL->DeclareLocal( int::typeid ); + Console::WriteLine( "\nTrying to access the local variable within the scope." ); + Console::WriteLine( "'myLocalBuilder' type is :{0}", myLocalBuilder->LocalType ); + myMethodIL->Emit( OpCodes::Ldstr, "Local value" ); + myMethodIL->Emit( OpCodes::Stloc_0, myLocalBuilder ); + + // End the scope of 'myLocalBuilder'. + myMethodIL->EndScope(); + + // Access the local variable outside the scope. + Console::WriteLine( "\nTrying to access the local variable outside the scope:\n" ); + myMethodIL->Emit( OpCodes::Stloc_0, myLocalBuilder ); + myMethodIL->Emit( OpCodes::Ldloc_0 ); + myMethodIL->Emit( OpCodes::Ret ); + + // Create 'MyDynamicClass' class. + Type^ myType1 = myTypeBuilder->CreateType(); + // + // + + // Create an instance of the 'MyDynamicClass'. + array^temp0 = {"HelloWorld"}; + Object^ myObject1 = Activator::CreateInstance( myType1, temp0 ); + + // Invoke 'MyDynamicMethod' method of 'MyDynamicClass'. + Object^ myObject2 = myType1->InvokeMember( "MyDynamicMethod", BindingFlags::InvokeMethod, nullptr, myObject1, nullptr ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception :{0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp new file mode 100644 index 00000000000..aa305292301 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.DiretoryInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp @@ -0,0 +1,86 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::AccessControl; + +// Adds an ACL entry on the specified directory for the +// specified account. +void AddDirectorySecurity(String^ directoryName, String^ account, + FileSystemRights rights, AccessControlType controlType) +{ + // Create a new DirectoryInfo object. + DirectoryInfo^ dInfo = gcnew DirectoryInfo(directoryName); + + // Get a DirectorySecurity object that represents the + // current security settings. + DirectorySecurity^ dSecurity = dInfo->GetAccessControl(); + + // Add the FileSystemAccessRule to the security settings. + dSecurity->AddAccessRule( gcnew FileSystemAccessRule(account, + rights, controlType)); + + // Set the new access settings. + dInfo->SetAccessControl(dSecurity); +} + +// Removes an ACL entry on the specified directory for the +// specified account. +void RemoveDirectorySecurity(String^ directoryName, String^ account, + FileSystemRights rights, AccessControlType controlType) +{ + // Create a new DirectoryInfo object. + DirectoryInfo^ dInfo = gcnew DirectoryInfo(directoryName); + + // Get a DirectorySecurity object that represents the + // current security settings. + DirectorySecurity^ dSecurity = dInfo->GetAccessControl(); + + // Add the FileSystemAccessRule to the security settings. + dSecurity->RemoveAccessRule(gcnew FileSystemAccessRule(account, + rights, controlType)); + + // Set the new access settings. + dInfo->SetAccessControl(dSecurity); +} + +int main() +{ + String^ directoryName = "TestDirectory"; + String^ accountName = "MYDOMAIN\\MyAccount"; + if (!Directory::Exists(directoryName)) + { + Console::WriteLine("The directory {0} could not be found.", + directoryName); + return 0; + } + try + { + Console::WriteLine("Adding access control entry for {0}", + directoryName); + + // Add the access control entry to the directory. + AddDirectorySecurity(directoryName, accountName, + FileSystemRights::ReadData, AccessControlType::Allow); + + Console::WriteLine("Removing access control entry from {0}", + directoryName); + + // Remove the access control entry from the directory. + RemoveDirectorySecurity(directoryName, accountName, + FileSystemRights::ReadData, AccessControlType::Allow); + + Console::WriteLine("Done."); + } + catch (UnauthorizedAccessException^) + { + Console::WriteLine("You are not authorised to carry" + + " out this procedure."); + } + catch (System::Security::Principal:: + IdentityNotMappedException^) + { + Console::WriteLine("The account {0} could not be found.", accountName); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp new file mode 100644 index 00000000000..506b780b31a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.File.Encrypt-Decrypt/cpp/sample.cpp @@ -0,0 +1,49 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ fileName = "test.xml"; + if (!File::Exists(fileName)) + { + Console::WriteLine("The file " + fileName + + " does not exist."); + return 0; + } + try + { + Console::WriteLine("Encrypt " + fileName); + + // Encrypt the file. + File::Encrypt(fileName); + + Console::WriteLine("Decrypt " + fileName); + + // Decrypt the file. + File::Decrypt(fileName); + + Console::WriteLine("Done"); + } + catch (IOException^ ex) + { + Console::WriteLine("There was an IO problem."); + Console::WriteLine(ex->Message); + } + catch (PlatformNotSupportedException^) + { + Console::WriteLine("Encryption is not supported on " + + "this system."); + } + catch (NotSupportedException^) + { + Console::WriteLine("Encryption is not supported on " + + "this system."); + } + catch (UnauthorizedAccessException^) + { + Console::WriteLine("The operation could not be " + + "carried out."); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp new file mode 100644 index 00000000000..5bd01722472 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.File.GetAccessControl-SetAccessControl/cpp/sample.cpp @@ -0,0 +1,67 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::AccessControl; + +// Adds an ACL entry on the specified file for the specified account. + +void AddFileSecurity(String^ fileName, String^ account, + FileSystemRights rights, AccessControlType controlType) +{ + // Get a FileSecurity object that represents the + // current security settings. + FileSecurity^ fSecurity = File::GetAccessControl(fileName); + + // Add the FileSystemAccessRule to the security settings. + fSecurity->AddAccessRule(gcnew FileSystemAccessRule + (account,rights, controlType)); + + // Set the new access settings. + File::SetAccessControl(fileName, fSecurity); +} + +// Removes an ACL entry on the specified file for the specified account. + +void RemoveFileSecurity(String^ fileName, String^ account, + FileSystemRights rights, AccessControlType controlType) +{ + + // Get a FileSecurity object that represents the + // current security settings. + FileSecurity^ fSecurity = File::GetAccessControl(fileName); + + // Remove the FileSystemAccessRule from the security settings. + fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule + (account,rights, controlType)); + + // Set the new access settings. + File::SetAccessControl(fileName, fSecurity); +} + +int main() +{ + try + { + String^ fileName = "test.xml"; + + Console::WriteLine("Adding access control entry for " + fileName); + + // Add the access control entry to the file. + AddFileSecurity(fileName, "MYDOMAIN\\MyAccount", + FileSystemRights::ReadData, AccessControlType::Allow); + + Console::WriteLine("Removing access control entry from " + fileName); + + // Remove the access control entry from the file. + RemoveFileSecurity(fileName, "MYDOMAIN\\MyAccount", + FileSystemRights::ReadData, AccessControlType::Allow); + + Console::WriteLine("Done."); + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp new file mode 100644 index 00000000000..4876d14c2dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.File.Replace/cpp/sample.cpp @@ -0,0 +1,39 @@ +// +using namespace System; +using namespace System::IO; + + +// Move a file into another file, delete the original, +// and create a backup of the replaced file. + +void ReplaceFile(String^ fileToMoveAndDelete, + String^ fileToReplace, String^ backupOfFileToReplace) +{ + File::Replace(fileToMoveAndDelete, fileToReplace, + backupOfFileToReplace, false); +} + + +int main() +{ + try + { + String^ originalFile = "test.xml"; + String^ fileToReplace = "test2.xml"; + String^ backUpOfFileToReplace = "test2.xml.bac"; + + Console::WriteLine("Move the contents of " + originalFile + " into " + + fileToReplace + ", delete " + originalFile + + ", and create a backup of " + fileToReplace + "."); + + // Replace the file. + ReplaceFile(originalFile, fileToReplace, backUpOfFileToReplace); + + Console::WriteLine("Done"); + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp new file mode 100644 index 00000000000..3cbff62e773 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Encrypt-Decrypt/cpp/sample.cpp @@ -0,0 +1,60 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::AccessControl; + + + static void Addencryption(String^ fileName) +{ + // Create a new FileInfo object. + FileInfo^ fInfo = gcnew FileInfo(fileName); + if (!fInfo->Exists) + { + fInfo->Create(); + } + // Add encryption. + fInfo->Encrypt(); + +} + + + static void Removeencryption(String^ fileName) +{ +// Create a new FileInfo object. + FileInfo^ fInfo = gcnew FileInfo(fileName); + if (!fInfo->Exists) + { + fInfo->Create(); + } + // Remove encryption. + fInfo->Decrypt(); +} + +int main() +{ + try + { + String^ fileName = "c:\\MyTest.txt"; + Console::WriteLine("Encrypt " + fileName); + + // Encrypt the file. + + Addencryption(fileName); + Console::WriteLine("Decrypt " + fileName); + + // Decrypt the file. + Removeencryption(fileName); + Console::WriteLine("Done"); + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//Encrypt c:\MyTest.txt +//Decrypt c:\MyTest.txt +//Done +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp new file mode 100644 index 00000000000..27fb4bdc1ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Exists/cpp/sample.cpp @@ -0,0 +1,49 @@ +using namespace System; +using namespace System::IO; + +// +array^ Openfile(String^ fileName) +{ + // Check the fileName argument. + if (fileName == nullptr || fileName->Length == 0) + { + throw gcnew ArgumentNullException("fileName"); + } + + // Check to see if the file exists. + FileInfo^ fInfo = gcnew FileInfo(fileName); + + // You can throw a personalized exception if + // the file does not exist. + if (!fInfo->Exists) + { + throw gcnew FileNotFoundException("The file was not found.", + fileName); + } + + try + { + // Open the file. + FileStream^ fStream = gcnew FileStream(fileName, FileMode::Open); + + // Create a buffer. + array^ buffer = gcnew array(fStream->Length); + + // Read the file contents to the buffer. + fStream->Read(buffer, 0, (int)fStream->Length); + + // return the buffer. + return buffer; + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + return nullptr; + } +} +// + +int main() +{ + +}; diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp new file mode 100644 index 00000000000..eb8b7aeaec2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.GetAccessControl-SetAccessControl/cpp/sample.cpp @@ -0,0 +1,97 @@ +// +#using +using namespace System; +using namespace System::IO; +using namespace System::Security::AccessControl; +using namespace System::Security::Principal; + +// Adds an ACL entry on the specified file for the specified account. +static void AddFileSecurity(String^ fileName, String^ account, + FileSystemRights^ rights, + AccessControlType^ controlType) +{ + // Create a new FileInfo object. + FileInfo^ fInfo = gcnew FileInfo(fileName); + if (!fInfo->Exists) + { + fInfo->Create(); + } + + // Get a FileSecurity object that represents the + // current security settings. + FileSecurity^ fSecurity = fInfo->GetAccessControl(); + + // Add the FileSystemAccessRule to the security settings. + fSecurity->AddAccessRule(gcnew FileSystemAccessRule(account, + *rights, *controlType)); + + // Set the new access settings. + fInfo->SetAccessControl(fSecurity); +} + +// Removes an ACL entry on the specified file for the specified account. +static void RemoveFileSecurity(String^ fileName, String^ account, + FileSystemRights^ rights, + AccessControlType^ controlType) +{ + // Create a new FileInfo object. + FileInfo^ fInfo = gcnew FileInfo(fileName); + if (!fInfo->Exists) + { + fInfo->Create(); + } + + // Get a FileSecurity object that represents the + // current security settings. + FileSecurity^ fSecurity = fInfo->GetAccessControl(); + + // Remove the FileSystemAccessRule from the security settings. + fSecurity->RemoveAccessRule(gcnew FileSystemAccessRule(account, + *rights, *controlType)); + + // Set the new access settings. + fInfo->SetAccessControl(fSecurity); +} + +int main() +{ + try + { + String^ fileName = "c:\\test.xml"; + + Console::WriteLine("Adding access control entry for " + + fileName); + + // Add the access control entry to the file. + // Before compiling this snippet, change MyDomain to your + // domain name and MyAccessAccount to the name + // you use to access your domain. + AddFileSecurity(fileName, "MyDomain\\MyAccessAccount", + FileSystemRights::ReadData, AccessControlType::Allow); + + Console::WriteLine("Removing access control entry from " + + fileName); + + // Remove the access control entry from the file. + // Before compiling this snippet, change MyDomain to your + // domain name and MyAccessAccount to the name + // you use to access your domain. + RemoveFileSecurity(fileName, "MyDomain\\MyAccessAccount", + FileSystemRights::ReadData, AccessControlType::Allow); + + Console::WriteLine("Done."); + } + catch (Exception^ e) + { + Console::WriteLine(e); + } + +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//Adding access control entry for c:\test.xml +//Removing access control entry from c:\test.xml +//Done. +// +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp new file mode 100644 index 00000000000..f7dbe0f1cb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.Replace/cpp/sample.cpp @@ -0,0 +1,64 @@ +// + +using namespace System; +using namespace System::IO; + + +// Move a file into another file, delete the original, +// and create a backup of the replaced file. +void ReplaceFile(String^ fileToMoveAndDelete, + String^ fileToReplace, String^ backupOfFileToReplace) +{ + // Create a new FileInfo object. + FileInfo^ fInfo = gcnew FileInfo(fileToMoveAndDelete); + + // replace the file. + fInfo->Replace(fileToReplace, backupOfFileToReplace, false); +} + + +int main() +{ + try + { + // originalFile and fileToReplace must contain + // the path to files that already exist in the + // file system. backUpOfFileToReplace is created + // during the execution of the Replace method. + + String^ originalFile = "test.xml"; + String^ fileToReplace = "test2.xml"; + String^ backUpOfFileToReplace = "test2.xml.bak"; + + if (File::Exists(originalFile) && (File::Exists(fileToReplace))) + { + Console::WriteLine("Move the contents of {0} into {1}, " + + "delete {0}, and create a backup of {1}", + originalFile, fileToReplace); + + // Replace the file. + ReplaceFile(originalFile, fileToReplace, + backUpOfFileToReplace); + Console::WriteLine("Done"); + } + else + { + Console::WriteLine("Either the file {0} or {1} doesn't " + + "exist.", originalFile, fileToReplace); + } + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } +} + + +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//Move the contents of c:\test1.xml into c:\test2.xml, delete c:\test1.xml, +//and create a backup of c:\test2.xml +//Done + +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp new file mode 100644 index 00000000000..e5fb1ade0c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileInfo.isReadOnly/cpp/sample.cpp @@ -0,0 +1,47 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + // Create a temporary file. + String^ filePath = Path::GetTempFileName(); + Console::WriteLine("Created a temp file at '{0}.", filePath); + + // Create a new FileInfo object. + FileInfo^ fInfo = gcnew FileInfo(filePath); + + // Get the read-only value for a file. + bool isReadOnly = fInfo->IsReadOnly; + + // Display whether the file is read-only. + Console::WriteLine("The file read-only value for '{0}' is {1}.", fInfo->Name, isReadOnly); + + // Set the file to read-only. + Console::WriteLine("Setting the read-only value for '{0}' to true.", fInfo->Name); + fInfo->IsReadOnly = true; + + // Get the read-only value for a file. + isReadOnly = fInfo->IsReadOnly; + + // Display that the file is now read-only. + Console::WriteLine("The file read-only value for '{0}' is {1}.", fInfo->Name, isReadOnly); + + // Make the file mutable again so it can be deleted. + fInfo->IsReadOnly = false; + + // Delete the temporary file. + fInfo->Delete(); + + return 0; +}; + +// This code produces output similar to the following, +// though results may vary based on the computer, file structure, etc.: +// +// Created a temp file at 'C:\Users\UserName\AppData\Local\Temp\tmpB438.tmp'. +// The file read-only value for 'tmpB438.tmp' is False. +// Setting the read-only value for 'tmpB438.tmp' to true. +// The file read-only value for 'tmpB438.tmp' is True. +// +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp new file mode 100644 index 00000000000..d31fd98984e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor1/cpp/example.cpp @@ -0,0 +1,60 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Security::AccessControl; + +int main() +{ + try + { + // Create a file and write data to it. + + // Create an array of bytes. + array^ messageByte = + Encoding::ASCII->GetBytes("Here is some data."); + + // Create a file using the FileStream class. + FileStream^ fWrite = gcnew FileStream("test.txt", FileMode::Create, + FileAccess::ReadWrite, FileShare::None, 8, FileOptions::None); + + // Write the number of bytes to the file. + fWrite->WriteByte((Byte)messageByte->Length); + + // Write the bytes to the file. + fWrite->Write(messageByte, 0, messageByte->Length); + + // Close the stream. + fWrite->Close(); + + + // Open a file and read the number of bytes. + + FileStream^ fRead = gcnew FileStream("test.txt", + FileMode::Open); + + // The first byte is the string length. + int length = (int)fRead->ReadByte(); + + // Create a new byte array for the data. + array^ readBytes = gcnew array(length); + + // Read the data from the file. + fRead->Read(readBytes, 0, readBytes->Length); + + // Close the stream. + fRead->Close(); + + // Display the data. + Console::WriteLine(Encoding::ASCII->GetString(readBytes)); + + Console::WriteLine("Done writing and reading data."); + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp new file mode 100644 index 00000000000..3c25ca60661 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.FileStream.ctor2/cpp/example.cpp @@ -0,0 +1,74 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Security::AccessControl; +using namespace System::Security::Principal; + +int main() +{ + try + { + // Create a file and write data to it. + + // Create an array of bytes. + array^ messageByte = + Encoding::ASCII->GetBytes("Here is some data."); + + // Specify an access control list (ACL) + FileSecurity^ fs = gcnew FileSecurity(); + + fs->AddAccessRule( + gcnew FileSystemAccessRule("MYDOMAIN\\MyAccount", + FileSystemRights::Modify, AccessControlType::Allow)); + + // Create a file using the FileStream class. + FileStream^ fWrite = gcnew FileStream("test.txt", + FileMode::Create, FileSystemRights::Modify, + FileShare::None, 8, FileOptions::None, fs); + + // Write the number of bytes to the file. + fWrite->WriteByte((Byte)messageByte->Length); + + // Write the bytes to the file. + fWrite->Write(messageByte, 0, messageByte->Length); + + // Close the stream. + fWrite->Close(); + + // Open a file and read the number of bytes. + + FileStream^ fRead = + gcnew FileStream("test.txt", FileMode::Open); + + // The first byte is the string length. + int length = (int)fRead->ReadByte(); + + // Create a new byte array for the data. + array^ readBytes = gcnew array(length); + + // Read the data from the file. + fRead->Read(readBytes, 0, readBytes->Length); + + // Close the stream. + fRead->Close(); + + // Display the data. + Console::WriteLine(Encoding::ASCII->GetString(readBytes)); + + Console::WriteLine("Done writing and reading data."); + } + + catch (IdentityNotMappedException^) + { + Console::WriteLine("You need to use your own credentials " + + " 'MYDOMAIN\\MyAccount'."); + } + + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp new file mode 100644 index 00000000000..98e59f68290 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.Path.GetInvalidFile-PathChars/cpp/example.cpp @@ -0,0 +1,67 @@ +// +using namespace System; +using namespace System::IO; + +namespace PathExample +{ + public ref class GetCharExample + { + public: + static void Main() + { + // Get a list of invalid path characters. + array^ invalidPathChars = Path::GetInvalidPathChars(); + + Console::WriteLine("The following characters are invalid in a path:"); + ShowChars(invalidPathChars); + Console::WriteLine(); + + // Get a list of invalid file characters. + array^ invalidFileChars = Path::GetInvalidFileNameChars(); + + Console::WriteLine("The following characters are invalid in a filename:"); + ShowChars(invalidFileChars); + } + + static void ShowChars(array^ charArray) + { + Console::WriteLine("Char\tHex Value"); + // Display each invalid character to the console. + for each (Char someChar in charArray) + { + if (Char::IsWhiteSpace(someChar)) + { + Console::WriteLine(",\t{0:X4}", (Int16)someChar); + } + else + { + Console::WriteLine("{0:c},\t{1:X4}", someChar, (Int16)someChar); + } + } + } + }; +}; + +int main() +{ + PathExample::GetCharExample::Main(); +} +// Note: Some characters may not be displayable on the console. +// The output will look something like: +// +// The following characters are invalid in a path: +// Char Hex Value +// ", 0022 +// <, 003C +// >, 003E +// |, 007C +// ... +// +// The following characters are invalid in a filename: +// Char Hex Value +// ", 0022 +// <, 003C +// >, 003E +// |, 007C +// ... +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp new file mode 100644 index 00000000000..47d43906d84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IO.Ports.GetPortNames/cpp/example.cpp @@ -0,0 +1,30 @@ +// +#using + +using namespace System; +using namespace System::IO::Ports; +using namespace System::ComponentModel; + +void main() +{ + array^ serialPorts = nullptr; + try + { + // Get a list of serial port names. + serialPorts = SerialPort::GetPortNames(); + } + catch (Win32Exception^ ex) + { + Console::WriteLine(ex->Message); + } + + Console::WriteLine("The following serial ports were found:"); + + // Display each port name to the console. + for each(String^ port in serialPorts) + { + Console::WriteLine(port); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp new file mode 100644 index 00000000000..f485421aac8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile1.cpp @@ -0,0 +1,14 @@ + +//System::Runtime::InteropServices::IDispatchImplAttribute* +//System::Runtime::InteropServices::IDispatchImplType* +// +using namespace System; +using namespace System::Runtime::InteropServices; + +// by default all classes in this assembly will use COM implementaion +// // But this class will use runtime implementaion + +[assembly:IDispatchImpl(IDispatchImplType::CompatibleImpl)]; +[IDispatchImpl(IDispatchImplType::InternalImpl)] +ref class MyClass{}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp new file mode 100644 index 00000000000..d06ee10f022 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile2.cpp @@ -0,0 +1,57 @@ + +// System::Runtime::InteropServices::ComImportAttribute +// System::Runtime::InteropServices::InAttribute +// System::Runtime::InteropServices::OutAttribute +// System::Runtime::InteropServices::UnmanagedType +// System::Runtime::InteropServices::VarEnum + +// +using namespace System; +using namespace System::Runtime::InteropServices; + +// If you do not have a type library for an interface +// you can redeclare it using ComImportAttribute. +// This is how the interface would look in an idl file. +//[ +//object, +//uuid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26"), +//dual, helpstring("IMyStorage Interface"), +//pointer_default(unique) +//] +//interface IMyStorage : IDispatch +//{ +// [id(1)] +// HRESULT GetItem([in] BSTR bstrName, [out, retval] IDispatch ** ppItem); +// [id(2)] +// HRESULT GetItems([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT)* pItems); +// [id(3)] +// HRESULT GetItemDescriptions([in] BSTR bstrLocation, [out] SAFEARRAY(VARIANT) ** ppItems); +// [id(4), propget] +// HRESULT get_IsEmpty([out, retval] BOOL * pfEmpty); +//}; +// This is the managed declaration. + +[ComImport] +[Guid("73EB4AF8-BE9C-4b49-B3A4-24F4FF657B26")] +interface class IMyStorage +{ + [DispId(1)] + Object^ GetItem( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrName ); + + //[return : MarshalAs(UnmanagedType::Interface)] + + [DispId(2)] + void GetItems( [In,MarshalAs(UnmanagedType::BStr)]String^ bstrLocation, [Out,MarshalAs(UnmanagedType::SafeArray, + SafeArraySubType=VarEnum::VT_VARIANT)]array^Items ); + + [DispId(3)] + void GetItemDescriptions( [In]String^ bstrLocation, [In,Out,MarshalAs(UnmanagedType::SafeArray)]array^varDescriptions ); + + property bool IsEmpty + { + [DispId(4)] + [returnvalue:MarshalAs(UnmanagedType::VariantBool)] + bool get(); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp new file mode 100644 index 00000000000..578ba56242a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile3.cpp @@ -0,0 +1,31 @@ + +// System::Assembly::GetCustomAttributes +// System::Runtime::InteropServices::ImportedFromTypeLibAttribute + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +class ClassA +{ +private: + static bool IsCOMAssembly( Assembly^ a ) + { + array^AsmAttributes = a->GetCustomAttributes( ImportedFromTypeLibAttribute::typeid, true ); + if ( AsmAttributes->Length > 0 ) + { + ImportedFromTypeLibAttribute^ imptlb = dynamic_cast(AsmAttributes[ 0 ]); + String^ strImportedFrom = imptlb->Value; + + // Print out the name of the DLL from which the assembly is imported. + Console::WriteLine( "Assembly {0} is imported from {1}", a->FullName, strImportedFrom ); + return true; + } + + // This is not a COM assembly. + Console::WriteLine( "Assembly {0} is not imported from COM", a->FullName ); + return false; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp new file mode 100644 index 00000000000..78097a7488d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile4.cpp @@ -0,0 +1,25 @@ + +// System::Runtime::InteropServices::TypeLibTypeAttribute +// System::Runtime::InteropServices::TypeLibTypeFlags + +// +using namespace System; +using namespace System::Runtime::InteropServices; + +ref class ClassB +{ +private: + static bool IsHiddenInterface( Type^ InterfaceType ) + { + array^InterfaceAttributes = InterfaceType->GetCustomAttributes( TypeLibTypeAttribute::typeid, false ); + if ( InterfaceAttributes->Length > 0 ) + { + TypeLibTypeAttribute^ tlt = dynamic_cast(InterfaceAttributes[ 0 ]); + TypeLibTypeFlags flags = tlt->Value; + return (flags & TypeLibTypeFlags::FHidden) != TypeLibTypeFlags(0); + } + + return false; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp new file mode 100644 index 00000000000..6484b104239 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ImprovedInteropSnippets/CPP/codefile5.cpp @@ -0,0 +1,26 @@ + +// System::Runtime::InteropServices::TypeLibFuncAttribute +// System::Runtime::InteropServices::TypeLibFuncFlags + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +ref class ClassC +{ +private: + static bool IsHiddenMethod( MethodInfo^ mi ) + { + array^MethodAttributes = mi->GetCustomAttributes( TypeLibFuncAttribute::typeid, true ); + if ( MethodAttributes->Length > 0 ) + { + TypeLibFuncAttribute^ tlf = dynamic_cast(MethodAttributes[ 0 ]); + TypeLibFuncFlags flags = tlf->Value; + return (flags & TypeLibFuncFlags::FHidden) != (TypeLibFuncFlags)0; + } + + return false; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp new file mode 100644 index 00000000000..4c29bcd1705 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IndentedTextWriterExample/CPP/form1.cpp @@ -0,0 +1,120 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace System::ComponentModel; +using namespace System::IO; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + // + String^ CreateMultilevelIndentString() + { + + // + // Creates a TextWriter to use as the base output writer. + System::IO::StringWriter^ baseTextWriter = gcnew System::IO::StringWriter; + + // Create an IndentedTextWriter and set the tab string to use + // as the indentation string for each indentation level. + System::CodeDom::Compiler::IndentedTextWriter^ indentWriter = gcnew IndentedTextWriter( baseTextWriter," " ); + + // + // + // Sets the indentation level. + indentWriter->Indent = 0; + + // + // Output test strings at stepped indentations through a recursive loop method. + WriteLevel( indentWriter, 0, 5 ); + + // Return the resulting string from the base StringWriter. + return baseTextWriter->ToString(); + } + + + // + void WriteLevel( IndentedTextWriter^ indentWriter, int level, int totalLevels ) + { + + // Output a test string with a new-line character at the end. + indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level ); + + // If not yet at the highest recursion level, call this output method for the next level of indentation. + if ( level < totalLevels ) + { + + // Increase the indentation count for the next level of indented output. + indentWriter->Indent++; + + // Call the WriteLevel method to write test output for the next level of indentation. + WriteLevel( indentWriter, level + 1, totalLevels ); + + // Restores the indentation count for this level after the recursive branch method has returned. + indentWriter->Indent--; + } + else + // + // Outputs a string using the WriteLineNoTabs method. + indentWriter->WriteLineNoTabs( "This is a test phrase written with the IndentTextWriter.WriteLineNoTabs method." ); + // + // Outputs a test string with a new-line character at the end. + indentWriter->WriteLine( "This is a test phrase. Current indentation level: {0}", level ); + } + + + // + // + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + textBox1->Text = CreateMultilevelIndentString(); + } + + +public: + Form1() + { + System::Windows::Forms::Button^ button1 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->textBox1->Location = System::Drawing::Point( 8, 40 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 391, 242 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + button1->Location = System::Drawing::Point( 11, 8 ); + button1->Name = "button1"; + button1->Size = System::Drawing::Size( 229, 23 ); + button1->TabIndex = 1; + button1->Text = "Generate string using IndentedTextWriter"; + button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 407, 287 ); + this->Controls->Add( button1 ); + this->Controls->Add( this->textBox1 ); + this->Name = "Form1"; + this->Text = "IndentedTextWriter example"; + this->ResumeLayout( false ); + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp b/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp new file mode 100644 index 00000000000..b75ca626687 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InnerEx/CPP/innerex.cpp @@ -0,0 +1,53 @@ + +// +using namespace System; + +public ref class AppException: public Exception +{ +public: + AppException(String^ message ) : Exception(message) + {} + + AppException(String^ message, Exception^ inner) : Exception(message, inner) + {} +}; + +public ref class Example +{ +public: + void ThrowInner() + { + throw gcnew AppException("Exception in ThrowInner method."); + } + + void CatchInner() + { + try { + this->ThrowInner(); + } + catch (AppException^ e) { + throw gcnew AppException("Error in CatchInner caused by calling the ThrowInner method.", e); + } + } +}; + +int main() +{ + Example^ ex = gcnew Example(); + try { + ex->CatchInner(); + } + catch (AppException^ e) { + Console::WriteLine("In catch block of Main method."); + Console::WriteLine("Caught: {0}", e->Message); + if (e->InnerException != nullptr) + Console::WriteLine("Inner exception: {0}", e->InnerException); + } +} +// The example displays the following output: +// In catch block of Main method. +// Caught: Error in CatchInner caused by calling the ThrowInner method. +// Inner exception: AppException: Exception in ThrowInner method. +// at Example.ThrowInner() +// at Example.CatchInner() +// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp b/snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp new file mode 100644 index 00000000000..2dad18f9049 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallContext_InstallContext/CPP/installcontext_installcontext.cpp @@ -0,0 +1,136 @@ +// System::Configuration::Install::InstallContext +// System::Configuration::Install::InstallContext.InstallContext() +// System::Configuration::Install::InstallContext.InstallContext(String*, String*[]) +// System::Configuration::Install::InstallContext.IsParameterTrue +// System::Configuration::Install::InstallContext.LogMessage +// System::Configuration::Install::InstallContext.Parameters + +/* The following example demonstrates the 'InstallContext()' and +InstallContext(String*, String*->Item[]) constructors, the 'Parameters' property +and the 'LogMessage' and 'IsParameterTrue' methods of the +'InstallContext' class. +When the program is invoked without any arguments an empty InstallContext +object is created and when the '/LogFile' and '/LogtoConsole' are +specified the InstallContext Object* is created by passing the respective +arguments to InstallContext(String*, String*[]). When the install method of the +installer is called, it checks for parameters from the command line and +depending on that it displays the progress messages onto the console and +also saves it to the specified log file. +*/ + +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +[RunInstallerAttribute(true)] +ref class InstallContext_Example: public Installer +{ +public: + InstallContext^ myInstallContext; + virtual void Install( IDictionary^ mySavedState ) override + { + // + StringDictionary^ myStringDictionary = myInstallContext->Parameters; + if ( myStringDictionary->Count == 0 ) + { + Console::Write( "No parameters have been entered in the command line " ); + Console::WriteLine( "hence, the install will take place in the silent mode" ); + } + else + { + // + // + // Check whether the "LogtoConsole" parameter has been set. + if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) + { + // Display the message to the console and add it to the logfile. + myInstallContext->LogMessage( "The 'Install' method has been called" ); + } + // + // + } + // + // The 'Install procedure should be added here. + } + + virtual void Uninstall( IDictionary^ mySavedState ) override + { + // The 'Uninstall' procedure should be added here. + } + + virtual void Rollback( IDictionary^ mySavedState ) override + { + if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) + { + myInstallContext->LogMessage( "The 'Rollback' method has been called" ); + } + + // The 'Rollback' procedure should be added here. + } + + virtual void Commit( IDictionary^ mySavedState ) override + { + if ( myInstallContext->IsParameterTrue( "LogtoConsole" ) ) + { + myInstallContext->LogMessage( "The 'Commit' method has been called" ); + } + + // The 'Commit' procedure should be added here. + } +}; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + InstallContext_Example^ myInstallObject = gcnew InstallContext_Example; + IDictionary^ mySavedState = gcnew Hashtable; + if ( args->Length < 2 ) + { + // + // There are no command line arguments, create an empty 'InstallContext'. + myInstallObject->myInstallContext = gcnew InstallContext; + // + } + else + if ( (args->Length == 2) && (args[ 1 ]->Equals( "/?" )) ) + { + // Display the 'Help' for this utility. + Console::WriteLine( "Specify the '/Logfile' and '/LogtoConsole' parameters" ); + Console::WriteLine( "Example: " ); + Console::WriteLine( "InstallContext_InstallContext.exe /LogFile=example.log /LogtoConsole=true" ); + return 0; + } + else + { + // + // Create an InstallContext object with the given parameters. + array^commandLine = gcnew array(args->Length - 1); + for ( int i = 0; i < args->Length - 1; i++ ) + { + commandLine[ i ] = args[ i + 1 ]; + } + myInstallObject->myInstallContext = gcnew InstallContext( args[ 1 ],commandLine ); + // + } + + try + { + // Call the 'Install' method. + myInstallObject->Install( mySavedState ); + + // Call the 'Commit' method. + myInstallObject->Commit( mySavedState ); + } + catch ( Exception^ ) + { + // Call the 'Rollback' method. + myInstallObject->Rollback( mySavedState ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp b/snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp new file mode 100644 index 00000000000..f395a783e17 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallEventArgs/CPP/installeventargs.cpp @@ -0,0 +1,124 @@ +// System::Configuration::Install::InstallEventArgs +// System::Configuration::Install::InstallEventArgs.InstallEventArgs() +// System::Configuration::Install::InstallEventArgs.InstallEventArgs(IDictionary*) +// System::Configuration::Install::InstallEventArgs.SavedState + +/* + The following example demonstrates the 'InstallEventArgs()' and + 'InstallEventArgs(IDictionary*)' constructors and the 'SavedState' + property of the 'InstallEventArgs' property. There are two new + events called 'BeforeCommit' and 'AfterCommit'. The handlers of + these events are invoked from the protected: + methods named 'OnBeforeCommit' + and 'OnAfterCommit' respectively. These events are raised when the + 'Commit' method is called. + + Note : + a) The two events named 'BeforeCommit' and 'AfterCommit' are added + only for example purposes, since there are already + events named 'Committing' and 'Committed' which perform the same + function. This example can be made a basis for a new stage being + added to the already existing four stages namely 'Install', 'Commit', + 'Rollback' and 'Uninstall'. + + b) Run the example with the help of InstallUtil.exe + InstallUtil InstallEventArgs.exe +*/ + +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ +public: + // Simple events to handle before and after commit handlers. + event InstallEventHandler^ BeforeCommit; + event InstallEventHandler^ AfterCommit; + + MyInstaller() + { + // Add handlers to the events. + BeforeCommit += gcnew InstallEventHandler( this, &MyInstaller::BeforeCommitHandler ); + AfterCommit += gcnew InstallEventHandler( this, &MyInstaller::AfterCommitHandler ); + } + + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + Console::WriteLine( "Install ...\n" ); + } + + virtual void Commit( IDictionary^ savedState ) override + { + Console::WriteLine( "Before Committing ...\n" ); + // Call the 'OnBeforeCommit' protected method. + OnBeforeCommit( savedState ); + Installer::Commit( savedState ); + Console::WriteLine( "Committing ...\n" ); + // Call the 'OnAfterCommit' protected method. + OnAfterCommit( savedState ); + Console::WriteLine( "After Committing ...\n" ); + } + + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + Console::WriteLine( "RollBack ...\n" ); + } + + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + Console::WriteLine( "UnInstall ...\n" ); + } + +// + // Protected method that invoke the handlers associated with the 'BeforeCommit' event. +protected: + virtual void OnBeforeCommit( IDictionary^ savedState ) + { + BeforeCommit( this, gcnew InstallEventArgs( savedState ) ); + } +// + +// + // Protected method that invoke the handlers associated with the 'AfterCommit' event. +protected: + virtual void OnAfterCommit( IDictionary^ savedState ) + { + AfterCommit( this, gcnew InstallEventArgs ); + } +// + +// + // A simple event handler to exemplify the example. + void BeforeCommitHandler( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "BeforeCommitHandler event handler has been called\n" ); + Console::WriteLine( "The count of saved state objects are : {0}\n", + e->SavedState->Count ); + } +// + + // A simple event handler to exemplify the example. +private: + void AfterCommitHandler( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "AfterCommitHandler event handler has been called\n" ); + } +}; +// + +// An Assembly that has its own installer. +void main() +{ + Console::WriteLine( "This assembly is just an example for the Installer\n" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp b/snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp new file mode 100644 index 00000000000..1f1bcfe9e83 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallException/CPP/installexception.cpp @@ -0,0 +1,114 @@ + + +// System::Configuration::Install::InstallException +// System::Configuration::Install::InstallException.InstallException() +// System::Configuration::Install::InstallException.InstallException(String, Exception) +// System::Configuration::Install::InstallException.InstallException(String) +/* +The following example demonstrates the 'InstallException()', 'InstallException(String)' +and 'InstallException(String, Exception)' constructors for 'InstallException' class. +This example shows an assembly having its own installer named 'MyInstaller' +which has an attribute 'RunInstallerAttribute', indicating that this installer +will be invoked by InstallUtil.exe. InstallUtil.exe calls the 'Install', 'Commit', +'Rollback' and 'Uninstall' methods. The code in 'Commit' method presumes that +a file named 'FileDoesNotExist.txt' exists before the installation of the +assembly can be committed. If the file 'FileDoesNotExist.txt' does not exist +'Commit' raises a 'InstallException'. Same is the case with 'Uninstall', +uninstalltion will only progress if the file named 'FileDoesNotExist.txt' +exists else it raises an 'InstallException'. In 'Rollback' some piece of +code is executed which may raise an exception. If the exception is raised then +it is caught and an 'InstallException' is raised with that exception being passed +to it. + +Note : Run this example with the help of 'InstallUtil.exe' +InstallUtil InstallException.exe +InstallUtil /u InstallException.exe +*/ +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ +public: + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + Console::WriteLine( "Install ..." ); + + // Commit is called when install goes through successfully. + // Rollback is called if there is any error during Install. + // Uncommenting the code below will lead to 'RollBack' being called, + // currently 'Commit' shall be called. + // throw new IOException(); + } + + + // + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + Console::WriteLine( "Commit ..." ); + + // Throw an error if a particular file doesn't exist. + if ( !File::Exists( "FileDoesNotExist.txt" ) ) + throw gcnew InstallException; + + + // Perform the final installation if the file exists. + } + + + // + // + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + Console::WriteLine( "RollBack ..." ); + try + { + + // Performing some activity during rollback that raises an 'IOException*'. + throw gcnew IOException; + } + catch ( Exception^ e ) + { + throw gcnew InstallException( "IOException* raised",e ); + } + + + // Perform the remaining rollback activites if no exception raised. + } + + + // + // + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + Console::WriteLine( "UnInstall ..." ); + + // Throw an error if a particular file doesn't exist. + if ( !File::Exists( "FileDoesNotExist.txt" ) ) + throw gcnew InstallException( "The file 'FileDoesNotExist' does not exist" ); + + + // Perform the uninstall activites if the file exists. + } + + // +}; + +int main() +{ + Console::WriteLine( "This assembly is just an example for the Installer" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp b/snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp new file mode 100644 index 00000000000..6806f207863 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer/CPP/installer.cpp @@ -0,0 +1,82 @@ + + +// System::Configuration::Install::Installer +/* The following program demonstrates the use of the 'Installer' +class. It creates a class which inherits from 'Installer'. +When the 'Commit' is about to complete, 'Committing' event +occurs and a message is displayed when the event occurs. +*/ +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +// Set 'RunInstaller' attribute to true. + +[RunInstaller(true)] +ref class MyInstallerClass: public Installer +{ +private: + + // Event handler for 'Committing' event. + void MyInstaller_Committing( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "" ); + Console::WriteLine( "Committing Event occurred." ); + Console::WriteLine( "" ); + } + + + // Event handler for 'Committed' event. + void MyInstaller_Committed( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "" ); + Console::WriteLine( "Committed Event occurred." ); + Console::WriteLine( "" ); + } + + +public: + MyInstallerClass() + { + + // Attach the 'Committed' event. + this->Committed += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committed ); + + // Attach the 'Committing' event. + this->Committing += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committing ); + } + + + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + } + + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + +}; + +int main() +{ + Console::WriteLine( "Usage : installutil.exe Installer.exe " ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp new file mode 100644 index 00000000000..9451bee27cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Add/CPP/installercollection_add.cpp @@ -0,0 +1,114 @@ +// System::Configuration::Install::InstallerCollection +// System::Configuration::Install::InstallerCollection.Add(Installer) + +/* +The following example demonstrates the Add(Installer) +method of the 'InstallerCollection' class. This example provides +an implementation similar to that of 'InstallUtil.exe'. It installs +assemblies with the options preceding that particular assembly. +If an option is not specified for an assembly the previous assemblies +options are taken if there is a previous assembly in the list. If the +'/u' or '/uninstall' option is specified then the assemblies are uninstalled. +If the '/?' or '/help' option is provided then the help information is +displayed to the console. +*/ + +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +void PrintHelpMessage() +{ + Console::WriteLine( "Usage : InstallerCollection_Add [/u | /uninstall] [option [...]] assembly " + + "[[option [...]] assembly] [...]]" ); + Console::WriteLine( "InstallerCollection_Add executes the installers in each of" + + "the given assembly. If /u or /uninstall option" + + "option is given it uninstalls the assemblies." ); +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + ArrayList^ options = gcnew ArrayList; + String^ myOption; + bool toUnInstall = false; + bool toPrintHelp = false; + TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller; + InstallContext^ myInstallContext; + + try + { + for ( int i = 0; i < args->Length; i++ ) + { + // Process the arguments. + if ( args[ i ]->StartsWith( "/" ) || args[ i ]->StartsWith( "-" ) ) + { + myOption = args[ i ]->Substring( 1 ); + // Determine whether the option is to 'uninstall' a assembly. + if ( String::Compare( myOption, "u", true ) == 0 || + String::Compare( myOption, "uninstall", true ) == 0 ) + { + toUnInstall = true; + continue; + } + // Determine whether the option is for printing help information. + if ( String::Compare( myOption, "?", true ) == 0 || + String::Compare( myOption, "help", true ) == 0 ) + { + toPrintHelp = true; + continue; + } + // Add the option encountered to the list of all options + // encountered for the current assembly. + options->Add( myOption ); + } + else + { + // Determine whether the assembly file exists. + if ( !File::Exists( args[ i ] ) ) + { + // If assembly file doesn't exist then print error. + Console::WriteLine( " Error : {0} - Assembly file doesn't exist.", args[ i ] ); + return 0; + } +// + // Create an instance of 'AssemblyInstaller' that installs the given assembly. + myAssemblyInstaller = gcnew AssemblyInstaller( args[ i ], + (array^)(options->ToArray( String::typeid )) ); + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Add( myAssemblyInstaller ); +// + } + } + // then print help message. + if ( toPrintHelp || myTransactedInstaller->Installers->Count == 0 ) + { + PrintHelpMessage(); + return 0; + } + + // Create an instance of 'InstallContext' with the options specified. + myInstallContext = + gcnew InstallContext( "Install.log", + (array^)(options->ToArray( String::typeid )) ); + myTransactedInstaller->Context = myInstallContext; + + // Install or Uninstall an assembly depending on the option provided. + if ( !toUnInstall ) + myTransactedInstaller->Install( gcnew Hashtable ); + else + myTransactedInstaller->Uninstall( nullptr ); + } + catch ( Exception^ e ) + { + Console::WriteLine( " Exception raised : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp new file mode 100644 index 00000000000..777a3ed5ce2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_AddRange1/CPP/installercollection_addrange1.cpp @@ -0,0 +1,60 @@ +// System::Configuration::Install::InstallerCollection.AddRange(Installer->Item[]) + +/* + The following example demonstrates the 'AddRange(Installer->Item[])' + method of the 'InstallerCollection' class. It Creates 'AssemblyInstaller' + instances for 'MyAssembly1.exe' and for 'MyAssembly2.exe'. These + instances are added to an instance of 'TransactedInstaller'. The installation + process installs both 'MyAssembly1.exe' and 'MyAssembly2.exe'. +*/ + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +void main() +{ + try + { +// + ArrayList^ myInstallers = gcnew ArrayList; + TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller; + InstallContext^ myInstallContext; + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. + myAssemblyInstaller = + gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the list of installers. + myInstallers->Add( myAssemblyInstaller ); + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. + myAssemblyInstaller = + gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the list of installers. + myInstallers->Add( myAssemblyInstaller ); + + // Add the installers to the 'TransactedInstaller' instance. + myTransactedInstaller->Installers->AddRange( safe_cast^>(myInstallers->ToArray( Installer::typeid )) ); +// + + // Create a instance of 'InstallContext' with log file named 'Install::log'. + myInstallContext = + gcnew InstallContext( "Install.log",nullptr ); + myTransactedInstaller->Context = myInstallContext; + + // Install an assembly. + myTransactedInstaller->Install( gcnew Hashtable ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp new file mode 100644 index 00000000000..abbfe8fd906 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_CopyTo/CPP/installercollection_copyto.cpp @@ -0,0 +1,65 @@ +// System::Configuration::Install::InstallerCollection.CopyTo(Installer->Item[], Int32) + +/* + The following example demonstrates the 'CopyTo(Installer->Item[], Int32)' method + of the 'InstallerCollection' class. It Creates 'AssemblyInstaller' instances + for 'MyAssembly1.exe' and 'MyAssembly2.exe'. These instances of + 'AssemblyInstaller' are added to an instance of 'TransactedInstaller' + instance. The names of the assemblies to be installed + are displayed on the console. The installation process then installs + both 'MyAssembly1.exe' and 'MyAssembly2.exe'. +*/ + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +void main() +{ + // + TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller; + InstallContext^ myInstallContext; + + // Create an instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. + myAssemblyInstaller = + gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Add( myAssemblyInstaller ); + + // Create an instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. + myAssemblyInstaller = + gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Add( myAssemblyInstaller ); + + array^ myInstallers = + gcnew array(myTransactedInstaller->Installers->Count); + + myTransactedInstaller->Installers->CopyTo( myInstallers, 0 ); + // Print the assemblies to be installed. + Console::WriteLine( "Printing all assemblies to be installed -" ); + for ( int i = 0; i < myInstallers->Length; i++ ) + { + if ( dynamic_cast( myInstallers[ i ] ) ) + { + Console::WriteLine( "{0} {1}", i + 1, ( (AssemblyInstaller^)( myInstallers[ i ]) )->Path ); + } + } +// + + // Create a instance of 'InstallContext' with log file named 'Install.log'. + myInstallContext = + gcnew InstallContext( "Install.log",nullptr ); + myTransactedInstaller->Context = myInstallContext; + + // Install an assembly. + myTransactedInstaller->Install( gcnew Hashtable ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp new file mode 100644 index 00000000000..0a38efbeaf8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Insert/CPP/installercollection_insert.cpp @@ -0,0 +1,60 @@ +// System::Configuration::Install::InstallerCollection.Insert(Int32, Installer) +// System::Configuration::Install::InstallerCollection.AddRange(InstallerCollection) + +/* +The following example demonstrates the 'Insert(Int32, Installer)' and +'AddRange(InstallerCollection)' methods of the 'InstallerCollection' +class. It Creates 'AssemblyInstaller' instances for 'MyAssembly1.exe' +and 'MyAssembly2.exe'. These instances of 'AssemblyInstaller' are +added to an instance of 'TransactedInstaller' named 'myTransactedInstaller1'. +The installers in the 'myTransactedInstaller1' are copied to another +instance of 'TransactedInstaller' named 'myTransactedInstaller2'.The +installation process installs both 'MyAssembly1.exe' and 'MyAssembly2.exe'. +*/ + +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +void main() +{ +// +// + TransactedInstaller^ myTransactedInstaller1 = gcnew TransactedInstaller; + TransactedInstaller^ myTransactedInstaller2 = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; + InstallContext^ myInstallContext; + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. + myAssemblyInstaller = + gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller1->Installers->Insert( 0, myAssemblyInstaller ); + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. + myAssemblyInstaller = + gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller1->Installers->Insert( 1, myAssemblyInstaller ); + + // Copy the installers of 'myTransactedInstaller1' to 'myTransactedInstaller2'. + myTransactedInstaller2->Installers->AddRange( myTransactedInstaller1->Installers ); +// +// + + // Create a instance of 'InstallContext' with log file named 'Install.log'. + myInstallContext = + gcnew InstallContext( "Install.log",nullptr ); + myTransactedInstaller2->Context = myInstallContext; + + // Install an assembly. + myTransactedInstaller2->Install( gcnew Hashtable ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp new file mode 100644 index 00000000000..e5228341c9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Item/CPP/installercollection_item.cpp @@ -0,0 +1,65 @@ +// System::Configuration::Install::InstallerCollection.Item(Int32) + +/* +The following example demonstrates the 'Item(Int32)' method of the +'InstallerCollection' class. It creates 'AssemblyInstaller' instances +for 'MyAssembly1.exe' and 'MyAssembly2.exe'. These instances are added +to an instance of 'TransactedInstaller'. The names of all the assemblies +that are to be installed are displayed to the console. The installation +process installs both 'MyAssembly1.exe' and 'MyAssembly2.exe'. +*/ + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +void main() +{ + try + { + // + TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller; + InstallContext^ myInstallContext; + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. + myAssemblyInstaller = gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Add( myAssemblyInstaller ); + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. + myAssemblyInstaller = gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Add( myAssemblyInstaller ); + + //Print the assemblies to be installed. + InstallerCollection^ myInstallers = myTransactedInstaller->Installers; + Console::WriteLine( "\nPrinting all assemblies to be installed" ); + for ( int i = 0; i < myInstallers->Count; i++ ) + { + if ( dynamic_cast(myInstallers[ i ]) ) + { + Console::WriteLine( "{0} {1}", i + 1, safe_cast(myInstallers[ i ])->Path ); + } + } + // + + // Create a instance of 'InstallContext' with log file named 'Install.log'. + myInstallContext = gcnew InstallContext( "Install.log",nullptr ); + myTransactedInstaller->Context = myInstallContext; + + // Install an assembly . + myTransactedInstaller->Install( gcnew Hashtable ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp new file mode 100644 index 00000000000..a06d225c140 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InstallerCollection_Remove/CPP/installercollection_remove.cpp @@ -0,0 +1,81 @@ +// System::Configuration::Install::InstallerCollection.Remove(Installer) +// System::Configuration::Install::InstallerCollection.Contains(Installer) +// System::Configuration::Install::InstallerCollection.IndexOf(Installer) + +/* +The following example demonstrates the 'Remove(Installer)', +'Contains(Installer)' and 'IndexOf(Installer)' methods of the +'InstallerCollection' class. Create's 'AssemblyInstaller' instances +for 'MyAssembly1.exe' and for 'MyAssembly2.exe'. These instances +of 'AssemblyInstaller' are added to an instance of 'TransactedInstaller'. +The 'AssemblyIntaller' instance for 'MyAssembly2.exe' is removed +from the installers collection of the 'TransactedInstaller' instance. +The installation process is started which installs only 'MyAssembly1.exe'. +*/ + +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; +void main() +{ + try + { + // + // + // + TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller1; + AssemblyInstaller^ myAssemblyInstaller2; + InstallContext^ myInstallContext; + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly1.exe'. + myAssemblyInstaller1 = gcnew AssemblyInstaller( "MyAssembly1.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Insert( 0, myAssemblyInstaller1 ); + + // Create a instance of 'AssemblyInstaller' that installs 'MyAssembly2.exe'. + myAssemblyInstaller2 = gcnew AssemblyInstaller( "MyAssembly2.exe",nullptr ); + + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Insert( 1, myAssemblyInstaller2 ); + + // Remove the 'myAssemblyInstaller2' from the 'Installers' collection. + if ( myTransactedInstaller->Installers->Contains( myAssemblyInstaller2 ) ) + { + Console::WriteLine( "\nInstaller at index : {0} is being removed", myTransactedInstaller->Installers->IndexOf( myAssemblyInstaller2 ) ); + myTransactedInstaller->Installers->Remove( myAssemblyInstaller2 ); + } + // + // + // + + //Print the installers to be installed. + InstallerCollection^ myInstallers = myTransactedInstaller->Installers; + Console::WriteLine( "\nPrinting all installers to be installed\n" ); + for ( int i = 0; i < myInstallers->Count; i++ ) + { + if ( dynamic_cast(myInstallers[ i ]) ) + { + Console::WriteLine( "{0} {1}", i + 1, safe_cast(myInstallers[ i ])->Path ); + } + } + + // Create a instance of 'InstallContext' with log file named 'Install.log'. + myInstallContext = gcnew InstallContext( "Install.log",nullptr ); + myTransactedInstaller->Context = myInstallContext; + + // Install an assembly. + myTransactedInstaller->Install( gcnew Hashtable ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp new file mode 100644 index 00000000000..391cd5a87a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_AfterInstall/CPP/installer_afterinstall.cpp @@ -0,0 +1,88 @@ +/* + System::Configuration::Install::Installer.AfterInstall + + The following example demonstrates the event 'AfterInstall' of the + 'Installer' class. The event 'AfterInstall' is raised by the method + 'OnAfterInstall'. + + Use the installer process 'InstallUtil' to run the assembly + 'Installer_AfterInstall.exe'. + +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ + // + // MyInstaller is derived from the class 'Installer'. +public: + MyInstaller() + { + AfterInstall += gcnew InstallEventHandler( this, &MyInstaller::AfterInstallEventHandler ); + } + +private: + void AfterInstallEventHandler( Object^ sender, InstallEventArgs^ e ) + { + // Add steps to perform any actions after the install process. + Console::WriteLine( "Code for AfterInstallEventHandler" ); + } + // + + // Override the 'Install' method. +public: + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "Install method of MyInstaller called" ); + Console::WriteLine( "" ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + } + + // Override the 'OnBeforeInstall' method. + virtual void OnBeforeInstall( IDictionary^ savedState ) override + { + Installer::OnBeforeInstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnBeforeInstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } + +protected: + // Override the 'OnAfterInstall' method. + virtual void OnAfterInstall( IDictionary^ savedState ) override + { + Installer::OnAfterInstall( savedState ); + } +}; + +void main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly Installer_AfterInstall.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp new file mode 100644 index 00000000000..da1a8c557cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_AfterRollback/CPP/installer_afterrollback.cpp @@ -0,0 +1,72 @@ + + +// System::Configuration::Install::Installer.AfterRollback +/* The following program demonstrates the 'AfterRollback' event of the +'Installer' class. It overrides the Install method, explicitly throws +arguement exception so that 'Rollback' method is called. When the +'RollBack' is complete, 'AfterRollback' event occurs and a message is +displayed when the event occurs. +*/ +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +// Set 'RunInstaller' attribute to true. + +[RunInstaller(true)] +ref class MyInstallerClass: public Installer +{ +private: + + // Event handler for 'AfterRollback' event. + void MyInstaller_AfterRollBack( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "AfterRollBack Event occurred." ); + } + + +public: + MyInstallerClass() + { + + // Attach the 'AfterRollback' event. + this->AfterRollback += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_AfterRollBack ); + } + + + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + + // Explicitly throw an exception so that roll back is called. + throw gcnew ArgumentException( "Arg Exception" ); + } + + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + +}; + +int main() +{ + Console::WriteLine( "Usage : installutil.exe Installer_AfterRollback.exe " ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp new file mode 100644 index 00000000000..7125f43cb9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_AfterUninstall/CPP/installer_afteruninstall.cpp @@ -0,0 +1,89 @@ +/* +System::Configuration::Install::Installer.AfterUninstall + +The following example demonstrates the event 'AfterUninstall' of the +'Installer' class. This event is raised by the method 'OnAfterUninstall'. + +Use the installer process 'InstallUtil -u' to run the assembly +'Installer_AfterUninstall.exe'. + +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ + // + // MyInstaller is derived from the class 'Installer'. +private: + MyInstaller() + { + AfterUninstall += gcnew InstallEventHandler( this, &MyInstaller::AfterUninstallEventHandler ); + } + + void AfterUninstallEventHandler( Object^ sender, InstallEventArgs^ e ) + { + // Add steps to perform any actions before the Uninstall process. + Console::WriteLine( "Code for AfterUninstallEventHandler" ); + } + // + +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "Uninstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } + + // Override the 'OnBeforeUninstall' method. + virtual void OnBeforeUninstall( IDictionary^ savedState ) override + { + Installer::OnBeforeUninstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnBeforeUninstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } + +protected: + // Override the 'OnAfterUninstall' method. + virtual void OnAfterUninstall( IDictionary^ savedState ) override + { + Installer::OnAfterUninstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnAfterUninstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } +}; + +void main() +{ + Console::WriteLine( "Use 'installutil.exe -u' to run the assembly Installer_AfterUninstall.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp new file mode 100644 index 00000000000..d29ac6f3c70 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeInstall/CPP/installer_beforeinstall.cpp @@ -0,0 +1,90 @@ +/* +System::Configuration::Install::Installer.BeforeInstall + +The following example demonstrates the event 'BeforeInstall' of the +'Installer' class. The event 'BeforeInstall' is raised by the method +'OnBeforeInstall'. + +Use the installer process 'InstallUtil' to run the assembly +Installer_BeforeInstall.exe. + +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ + // + // MyInstaller is derived from the class 'Installer'. +private: + MyInstaller() + { + BeforeInstall += gcnew InstallEventHandler( this, &MyInstaller::BeforeInstallEventHandler ); + } + + void BeforeInstallEventHandler( Object^ sender, InstallEventArgs^ e ) + { + // Add steps to perform any actions before the install process. + Console::WriteLine( "Code for BeforeInstallEventHandler" ); + } + // + +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "Install method of MyInstaller called" ); + Console::WriteLine( "" ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + } + +protected: + // Override the 'OnBeforeInstall' method. + virtual void OnBeforeInstall( IDictionary^ savedState ) override + { + Installer::OnBeforeInstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnBeforeInstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } + + // Override the 'OnAfterInstall' method. + virtual void OnAfterInstall( IDictionary^ savedState ) override + { + Installer::OnAfterInstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnAfterInstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } +}; + +void main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly Installer_BeforeInstall.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp new file mode 100644 index 00000000000..aa830ddd1d5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeRollback/CPP/installer_beforerollback.cpp @@ -0,0 +1,88 @@ + + +// System::Configuration::Install::Installer.BeforeRollback +/* The following program demonstrates the 'BeforeRollback' event of the +'Installer' class. It overrides the Install method, explicitly throws +arguement exception so that 'Rollback' method is called. When the +'RollBack' is about to complete, 'BeforeRollback' event occurs and +a message is displayed when the event occurs. +*/ +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +// Set 'RunInstaller' attribute to true. + +[RunInstaller(true)] +ref class MyInstallerClass: public Installer +{ +public: + MyInstallerClass() + { + + // Attach the 'BeforeRollback' event. + this->BeforeRollback += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_BeforeRollBack ); + + // Attach the 'AfterRollback' event. + this->AfterRollback += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_AfterRollback ); + } + + +private: + + // Event handler for 'BeforeRollback' event. + void MyInstaller_BeforeRollBack( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "" ); + Console::WriteLine( "BeforeRollback Event occurred." ); + Console::WriteLine( "" ); + } + + + // Event handler for 'AfterRollback' event. + void MyInstaller_AfterRollback( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "" ); + Console::WriteLine( "AfterRollback Event occurred." ); + Console::WriteLine( "" ); + } + + +public: + + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + + // Explicitly throw an exception so that roll back is called. + throw gcnew ArgumentException( "Arg Exception" ); + } + + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + +}; + +int main() +{ + Console::WriteLine( "Usage : installutil.exe Installer_BeforeRollback.exe " ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp new file mode 100644 index 00000000000..cc85c76dcf5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_BeforeUninstall/CPP/installer_beforeuninstall.cpp @@ -0,0 +1,89 @@ +/* +System::Configuration::Install::Installer.BeforeUninstall + +The following example demonstrates the event 'BeforeUninstall' of the +'Installer' class. This event is raised by the method 'OnBeforeUninstall'. + +Use the installer process 'InstallUtil -u' to run the assembly +'Installer_BeforeUninstall.exe'. + +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ + // + // MyInstaller is derived from the class 'Installer'. +private: + MyInstaller() + { + BeforeUninstall += gcnew InstallEventHandler( this, &MyInstaller::BeforeUninstallEventHandler ); + } + + void BeforeUninstallEventHandler( Object^ sender, InstallEventArgs^ e ) + { + // Add steps to perform any actions before the Uninstall process. + Console::WriteLine( "Code for BeforeUninstallEventHandler" ); + } + // + +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "Uninstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } + +protected: + // Override the 'OnBeforeUninstall' method. + virtual void OnBeforeUninstall( IDictionary^ savedState ) override + { + Installer::OnBeforeUninstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnBeforeUninstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } + + // Override the 'OnAfterUninstall' method. + virtual void OnAfterUninstall( IDictionary^ savedState ) override + { + Installer::OnAfterUninstall( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "OnAfterUninstall method of MyInstaller called" ); + Console::WriteLine( "" ); + } +}; + +void main() +{ + Console::WriteLine( "Use 'installutil.exe -u' to run the assembly Installer_BeforeUninstall.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp new file mode 100644 index 00000000000..fe813f41274 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Committed/CPP/installer_committed.cpp @@ -0,0 +1,83 @@ +/* +System::Configuration::Install::Installer.OnCommitting(Idictionary savedState) +System::Configuration::Install::Installer.OnCommitted(Idictionary savedState) + +The following example demonstrates the methods 'OnCommitting' and +'OnCommitted' of the 'Installer' class. The methods 'OnCommitting' and +'OnCommitted' are overridden in the derived class. Space is provided +for the user to add the steps to be performed before committing and +after committing. + +'Installer_Committed.exe' needs to be run using the installer process +'installutil'. +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ +public: + + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + Console::WriteLine( "" ); + Console::WriteLine( "Install method of MyInstaller called" ); + Console::WriteLine( "" ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + } + + // + // Override the 'OnCommitting' method. +protected: + virtual void OnCommitting( IDictionary^ savedState ) override + { + Installer::OnCommitting( savedState ); + + // Add steps to be done before committing an application. + Console::WriteLine( "The OnCommitting method of MyInstaller called" ); + } + // + + // + // Override the 'OnCommitted' method. +protected: + virtual void OnCommitted( IDictionary^ savedState ) override + { + Installer::OnCommitted( savedState ); + + // Add steps to be done after committing an application. + Console::WriteLine( "The OnCommitted method of MyInstaller called" ); + } + // +}; + +void main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly Installer_Committed.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp new file mode 100644 index 00000000000..99af9bbebfc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Committed1/CPP/installer_committed.cpp @@ -0,0 +1,58 @@ +// System::Configuration::Install::Installer.Committed +/* The following program demonstrates the 'Committed' event of the +'Installer' class. When the 'Commit' is complete, 'Committed' event +is fired and a message is displayed. +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +// Set 'RunInstaller' attribute to true. +[RunInstaller(true)] +ref class MyInstallerClass: public Installer +{ + // +public: + MyInstallerClass() + { + // Attach the 'Committed' event. + this->Committed += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committed ); + } + +private: + // Event handler for 'Committed' event. + void MyInstaller_Committed( Object^ sender, InstallEventArgs^ e ) + { + Console::WriteLine( "Committed Event occurred." ); + } + // + +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } +}; + +void main() +{ + Console::WriteLine( "Usage : installutil.exe Installer_Committed.exe " ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp new file mode 100644 index 00000000000..eeade68268f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Committing/CPP/installer_committing.cpp @@ -0,0 +1,59 @@ +// System::Configuration::Install::Installer.Committing +/* The following program demonstrates the 'Committing' event of the +'Installer' class. When the 'Commit' is ab->Item[Out] to* complete, +'Committing' event is fired and a message is displayed. +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +// Set 'RunInstaller' attribute to true. +[RunInstaller(true)] +public ref class MyInstallerClass: public Installer +{ + // +public: + MyInstallerClass() + : Installer() + { + // Attach the 'Committing' event. + this->Committing += gcnew InstallEventHandler( this, &MyInstallerClass::MyInstaller_Committing ); + } + +private: + // Event handler for 'Committing' event. + void MyInstaller_Committing( Object^ /*sender*/, InstallEventArgs^ /*e*/ ) + { + Console::WriteLine( "Committing Event occurred." ); + } + // + +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + __super::Install( savedState ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + __super::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + __super::Rollback( savedState ); + } +}; + +int main() +{ + Console::WriteLine( "Usage : installutil.exe Installer_Committing.exe " ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp new file mode 100644 index 00000000000..f4b0501ac9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Context/CPP/installer_context.cpp @@ -0,0 +1,73 @@ +/* +System::Configuration::Install::Installer.Context + +The following example demonstrates the 'Context' property of +the 'Installer' class. The contents of the 'Context' property +like information about the location of the log file for the +installation, the location of the file to save information +required by the Uninstall method, and the command line that +was entered when the installation executable was run is +displayed on the console. + +Use 'installutil' to run the assembly Installer_Context.exe +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; +using namespace System::Collections::Specialized; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ +public: + + // Override the 'Install' method. + virtual void Install( IDictionary^ mySavedState ) override + { + Installer::Install( mySavedState ); + Console::WriteLine( "" ); + + // + StringDictionary^ myStringDictionary = Context->Parameters; + if ( Context->Parameters->Count > 0 ) + { + Console::WriteLine( "Context Property : " ); + IEnumerator^ myEnum = Context->Parameters->Keys->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ myString = safe_cast(myEnum->Current); + Console::WriteLine( Context->Parameters[ myString ] ); + } + } + // + Console::WriteLine( "" ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + } +}; + +void main() +{ + Console::WriteLine( "Run the assembly Installer_Context.exe using the installer process 'installutil'" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp new file mode 100644 index 00000000000..8f3bd6adc00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_HelpText/CPP/installer_helptext.cpp @@ -0,0 +1,69 @@ +/* +System::Configuration::Install::Installer.HelpText + +The following example demonstrates the property 'HelpText'. The +'HelpText' property is defined in the 'Installer', which when called +returns the description of the 'Installer' and the command line +options for the installation executable, such as the InstallUtil.exe utility, +that can be passed to and understood by the 'Installer'. + +Use 'installutil' to run the assembly Installer_HelpText.exe. +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + String^ myHelpText = HelpText; + Console::WriteLine( "Help Text : " ); + Console::WriteLine( myHelpText ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + } + +// + // Override the property 'HelpText'. + property String^ HelpText + { + virtual String^ get() override + { + return "Installer Description : This is a sample Installer\n" + + "HelpText is used to provide useful information about the " + + "installer."; + } + } +// +}; + +int main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly Installer_HelpText.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp new file mode 100644 index 00000000000..b13ecba3e96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Install/CPP/installer_install.cpp @@ -0,0 +1,48 @@ +/* +System::Configuration::Install::Installer.Install +System::Configuration::Install::Installer.Commit + +The following example demonstrates the 'Install' and 'Commit' methods +of the 'Installer' class. +A class is derived from the 'Installer' base class and the Install +and Commit methods are overridden. +*/ + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; +using namespace System::Collections; + +[RunInstaller(true)] +ref class MyInstallerSample: public Installer +{ +// + // Override the 'Install' method of the Installer class. +public: + virtual void Install( IDictionary^ mySavedState ) override + { + Installer::Install( mySavedState ); + // Code maybe written for installation of an application. + Console::WriteLine( "The Install method of 'MyInstallerSample' has been called" ); + } +// + +// + // Override the 'Commit' method of the Installer class. + virtual void Commit( IDictionary^ mySavedState ) override + { + Installer::Commit( mySavedState ); + Console::WriteLine( "The Commit method of 'MyInstallerSample' " + "has been called" ); + } +// +}; + +void main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly" + + " Installer_Install.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp new file mode 100644 index 00000000000..4bd8e8e06b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Installers/CPP/installer_installers.cpp @@ -0,0 +1,51 @@ +/* +System::Configuration::Install::Installer.Installers +System::Configuration::Install::Installer.Parent + +The following example demonstrates the properties 'Installers' and +'Parent'. The Installers property shows the InstallerCollection +associated with an Installer and the Parent property gets the +installer containing the collection that this installer belongs to. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ServiceProcess; +using namespace System::Diagnostics; +using namespace System::Configuration::Install; + +void main() +{ +// + AssemblyInstaller^ myAssemblyInstaller = gcnew AssemblyInstaller; + ServiceInstaller^ myServiceInstaller = gcnew ServiceInstaller; + EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller; + + InstallerCollection^ myInstallerCollection = myAssemblyInstaller->Installers; + + // Add Installers to the InstallerCollection of 'myAssemblyInstaller'. + myInstallerCollection->Add( myServiceInstaller ); + myInstallerCollection->Add( myEventLogInstaller ); + + array^ myInstaller = gcnew array(2); + myInstallerCollection->CopyTo( myInstaller, 0 ); + // Show the contents of the InstallerCollection of 'myAssemblyInstaller'. + Console::WriteLine( "Installers in the InstallerCollection : " ); + for ( int iIndex = 0; iIndex < myInstaller->Length; iIndex++ ) + Console::WriteLine( myInstaller[ iIndex ]->ToString() ); +// + Console::WriteLine( "" ); +// + AssemblyInstaller^ myAssemblyInstaller1 = gcnew AssemblyInstaller; + InstallerCollection^ myInstallerCollection1 = myAssemblyInstaller1->Installers; + // 'myAssemblyInstaller' is an installer of type 'AssemblyInstaller'. + myInstallerCollection1->Add( myAssemblyInstaller ); + + Installer^ myInstaller1 = myAssemblyInstaller->Parent; + Console::WriteLine( "Parent of myAssembly : {0}", myInstaller1 ); +// +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp new file mode 100644 index 00000000000..bbb7e27bb5d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_OnInstall/CPP/installer_oninstall.cpp @@ -0,0 +1,79 @@ +/* +System::Configuration::Install::Installer.OnBeforeInstall(IDictionary* savedState) +System::Configuration::Install::Installer.OnAfterInstall(IDictionary* savedState) + +The following example demonstrates the methods 'OnBeforeInstall' and +'OnAfterInstall' of the 'Installer' class. The methods 'OnBeforeInstall' +and 'OnAfterInstall' are overridden in the derived class. Space is provided +to add steps to be done before the installation in 'OnBeforeInstall' method +and after the installation in 'OnAfterInstall' method. + +Use the installer process 'InstallUtil' to run the assembly +Installer_OnInstall.exe. + +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyInstaller: public Installer +{ +public: + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Installer::Install( savedState ); + } + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + // Override the 'Uninstall' method. + virtual void Uninstall( IDictionary^ savedState ) override + { + Installer::Uninstall( savedState ); + } + +// + // Override the 'OnBeforeInstall' method. +protected: + virtual void OnBeforeInstall( IDictionary^ savedState ) override + { + Installer::OnBeforeInstall( savedState ); + + // Add steps to be done before the installation starts. + Console::WriteLine( "OnBeforeInstall method of MyInstaller called" ); + } +// + +// + // Override the 'OnAfterInstall' method. +protected: + virtual void OnAfterInstall( IDictionary^ savedState ) override + { + Installer::OnAfterInstall( savedState ); + // Add steps to be done after the installation is over. + Console::WriteLine( "OnAfterInstall method of MyInstaller called" ); + } +// +}; + +void main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly Installer_OnInstall.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp new file mode 100644 index 00000000000..570fbfacc63 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Rollback/CPP/installer_rollback.cpp @@ -0,0 +1,53 @@ +/* +System::Configuration::Install::Installer.Rollback + +The following example demonstrates the Rollback method +of the class 'installer'. The Rollback method is overridden +in a derived class of 'installer'.An exception is generated to +force an installation rollback. +*/ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; +using namespace System::Collections; + +[RunInstaller(true)] +ref class MyInstallerSample: public Installer +{ +public: + + // Override 'Install' method of Installer class. + virtual void Install( IDictionary^ mySavedState ) override + { + Installer::Install( mySavedState ); + Console::WriteLine( "" ); + + // Include code to install an application. + Console::WriteLine( "The Install method of 'MyInstallerSample' has been called" ); + Console::WriteLine( "" ); + + // Exception generated to call Rollback method. + Exception^ myException = gcnew Exception; + Console::WriteLine( "Exception thrown during Installation" ); + throw myException; + } + +// + // Override 'Rollback' method of Installer class. +public: + virtual void Rollback( IDictionary^ mySavedState ) override + { + Installer::Rollback( mySavedState ); + Console::WriteLine( "The Rollback method of 'MyInstallerSample'" + + " has been called" ); + } +// +}; + +void main() +{ + Console::WriteLine( "Use installutil.exe to run the assembly Installer_Rollback.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp b/snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp new file mode 100644 index 00000000000..fd987e21d11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Installer_Uninstall/CPP/installer_uninstall.cpp @@ -0,0 +1,41 @@ +/* +System::Configuration::Install::Installer.Uninstall + +The following example demonstrates the Uninstall method +of the class 'installer'. The method Uninstall is overridden +in the derived class of 'installer'. +*/ + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; +using namespace System::Collections; + +[RunInstaller(true)] +ref class MyInstallerSample: public Installer +{ +// + // Override 'Uninstall' method of Installer class. +public: + virtual void Uninstall( IDictionary^ mySavedState ) override + { + if ( mySavedState == nullptr ) + { + Console::WriteLine( "Uninstallation Error !" ); + } + else + { + Installer::Uninstall( mySavedState ); + Console::WriteLine( "The Uninstall method of 'MyInstallerSample' has been called" ); + } + } +// +}; + +void main() +{ + Console::WriteLine( "Use 'installutil.exe -u' to run the assembly Installer_Uninstall.exe" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp new file mode 100644 index 00000000000..0d107fe1e0e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Int16_Equals/CPP/int16_equals.cpp @@ -0,0 +1,357 @@ + +// System::Int16::Equals(Object) +/* +The following program demonstrates the 'Equals(Object)' method +of struct 'Int16'. This compares an instance of 'Int16' with the +passed in Object* and returns true if they are equal. +*/ +using namespace System; +int main() +{ + try + { + + // + Int16 myVariable1 = 20; + Int16 myVariable2 = 20; + + // Get and display the declaring type. + Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); + Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); + + // Compare 'myVariable1' instance with 'myVariable2' Object. + if ( myVariable1.Equals( myVariable2 ) ) + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); + else + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +/* expected return values: +20'F +-6'C +20'F +0 +72'F +-52 +*/ +/* +namespace Snippets2 { + // + + public __gc class Temperature { + // The value holder + protected: + short m_value; + + public: + __property static short get_MinValue() { + return Int16.MinValue; + } + + __property static short get_MaxValue() { + return Int16.MaxValue; + } + + __property short get_Value(){ + return m_value; + } + __property void set_Value( short value){ + m_value = value; + } + + __property short get_Celsius(){ + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value){ + m_value = (short)(value*2+32); + } + } + // +} + +namespace Snippets3 { + // + public __gc class Temperature : IComparable { + /// + /// IComparable.CompareTo implementation. + /// + // The value holder + protected: + short m_value; + + public: + Int32 CompareTo(Object* obj) { + if(obj->GetType() == __typeof(Temperature)) { + Temperature temp = dynamic_cast(obj); + return m_value.CompareTo(temp.m_value); + } + + throw new ArgumentException("object is not a Temperature"); + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( Int32 value) { + m_value = (short)(value*2+32); + } + } + // +} + +namespace Snippets4 { + // + public __gc class Temperature : IFormattable { + /// + /// IFormattable.ToString implementation. + /// + // The value holder + protected: + short m_value; + + public: + String* ToString(String* format, IFormatProvider provider) { + if( format != NULL ) { + if( format->Equals("F") ) { + return String::Format("{0}'F", this->Value->ToString()); + } + if( format->Equals("C") ) { + return String::Format("{0}'C", this->Celsius->ToString()); + } + } + + return m_value->ToString(format, provider); + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets5 { + // + public __gc class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) ); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2) ); + } + else { + temp->Value = Int16::Parse(s); + } + } + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + } + // +} +namespace Snippets6 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, IFormatProvider provider) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); + } + else { + temp->Value = Int16::Parse(s, provider); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets7 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, NumberStyles styles) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); + } + else { + temp->Value = Int16::Parse(s, styles); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets8 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int16::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); + } + else { + temp->Value = Int16::Parse(s, styles, provider); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp new file mode 100644 index 00000000000..a5199f2b75d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Int32_Equals/CPP/int32_equals.cpp @@ -0,0 +1,357 @@ + +// System::Int32::Equals(Object) +/* +The following program demonstrates the 'Equals(Object)' method +of struct 'Int32'. This compares an instance of 'Int32' with the +passed in object and returns true if they are equal. +*/ +using namespace System; +int main() +{ + try + { + + // + Int32 myVariable1 = 60; + Int32 myVariable2 = 60; + + // Get and display the declaring type. + Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); + Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); + + // Compare 'myVariable1' instance with 'myVariable2' Object. + if ( myVariable1.Equals( myVariable2 ) ) + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); + else + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +/* expected return values: +20'F +-6'C +20'F +0 +72'F +-52 +*/ +/* +namespace Snippets2 { + // + + public __gc class Temperature { + // The value holder + protected: + short m_value; + + public: + __property static short get_MinValue() { + return Int32.MinValue; + } + + __property static short get_MaxValue() { + return Int32.MaxValue; + } + + __property short get_Value(){ + return m_value; + } + __property void set_Value( short value){ + m_value = value; + } + + __property short get_Celsius(){ + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value){ + m_value = (short)(value*2+32); + } + } + // +} + +namespace Snippets3 { + // + public __gc class Temperature : IComparable { + /// + /// IComparable.CompareTo implementation. + /// + // The value holder + protected: + short m_value; + + public: + Int32 CompareTo(Object* obj) { + if(obj->GetType() == __typeof(Temperature)) { + Temperature temp = dynamic_cast(obj); + return m_value.CompareTo(temp.m_value); + } + + throw new ArgumentException("object is not a Temperature"); + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( Int32 value) { + m_value = (short)(value*2+32); + } + } + // +} + +namespace Snippets4 { + // + public __gc class Temperature : IFormattable { + /// + /// IFormattable.ToString implementation. + /// + // The value holder + protected: + short m_value; + + public: + String* ToString(String* format, IFormatProvider provider) { + if( format != NULL ) { + if( format->Equals("F") ) { + return String::Format("{0}'F", this->Value->ToString()); + } + if( format->Equals("C") ) { + return String::Format("{0}'C", this->Celsius->ToString()); + } + } + + return m_value->ToString(format, provider); + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets5 { + // + public __gc class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) ); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2) ); + } + else { + temp->Value = Int32::Parse(s); + } + } + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + } + // +} +namespace Snippets6 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, IFormatProvider provider) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); + } + else { + temp->Value = Int32::Parse(s, provider); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets7 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, NumberStyles styles) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); + } + else { + temp->Value = Int32::Parse(s, styles); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets8 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int32::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); + } + else { + temp->Value = Int32::Parse(s, styles, provider); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp new file mode 100644 index 00000000000..b4f54b5d004 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Int64_Equals/CPP/int64_equals.cpp @@ -0,0 +1,357 @@ + +// System::Int64::Equals(Object) +/* +The following program demonstrates the 'Equals(Object)' method +of struct 'Int64'. This compares an instance of 'Int64' with the +passed in Object and returns true if they are equal. +*/ +using namespace System; +int main() +{ + try + { + + // + Int64 myVariable1 = 80; + Int64 myVariable2 = 80; + + // Get and display the declaring type. + Console::WriteLine( "\nType of 'myVariable1' is ' {0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); + Console::WriteLine( "Type of 'myVariable2' is ' {0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); + + // Compare 'myVariable1' instance with 'myVariable2' Object. + if ( myVariable1.Equals( myVariable2 ) ) + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); + else + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +/* expected return values: +20'F +-6'C +20'F +0 +72'F +-52 +*/ +/* +namespace Snippets2 { + // + + public __gc class Temperature { + // The value holder + protected: + short m_value; + + public: + __property static short get_MinValue() { + return Int64.MinValue; + } + + __property static short get_MaxValue() { + return Int64.MaxValue; + } + + __property short get_Value(){ + return m_value; + } + __property void set_Value( short value){ + m_value = value; + } + + __property short get_Celsius(){ + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value){ + m_value = (short)(value*2+32); + } + } + // +} + +namespace Snippets3 { + // + public __gc class Temperature : IComparable { + /// + /// IComparable.CompareTo implementation. + /// + // The value holder + protected: + short m_value; + + public: + Int64 CompareTo(Object* obj) { + if(obj->GetType() == __typeof(Temperature)) { + Temperature temp = dynamic_cast(obj); + return m_value.CompareTo(temp.m_value); + } + + throw new ArgumentException("object is not a Temperature"); + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( Int64 value) { + m_value = (short)(value*2+32); + } + } + // +} + +namespace Snippets4 { + // + public __gc class Temperature : IFormattable { + /// + /// IFormattable.ToString implementation. + /// + // The value holder + protected: + short m_value; + + public: + String* ToString(String* format, IFormatProvider provider) { + if( format != NULL ) { + if( format->Equals("F") ) { + return String::Format("{0}'F", this->Value->ToString()); + } + if( format->Equals("C") ) { + return String::Format("{0}'C", this->Celsius->ToString()); + } + } + + return m_value->ToString(format, provider); + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets5 { + // + public __gc class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) ); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2) ); + } + else { + temp->Value = Int64::Parse(s); + } + } + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + } + // +} +namespace Snippets6 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, IFormatProvider provider) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), provider); + } + else { + temp->Value = Int64::Parse(s, provider); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets7 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, NumberStyles styles) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles); + } + else { + temp->Value = Int64::Parse(s, styles); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +namespace Snippets8 { + // + public class Temperature { + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + + // The value holder + protected: + short m_value; + + public: + static Temperature* Parse(String* s, NumberStyles styles, IFormatProvider* provider) { + Temperature* temp = new Temperature(); + + if( s->TrimEnd(NULL)->EndsWith("'F") ) { + temp->Value = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); + } + else { + if( s->TrimEnd(NULL)->EndsWith("'C") ) { + temp->Celsius = Int64::Parse( s->Remove(s->LastIndexOf('\''), 2), styles, provider); + } + else { + temp->Value = Int64::Parse(s, styles, provider); + } + } + + return temp; + } + + __property short get_Value() { + return m_value; + } + + __property void set_Value( short value) { + m_value = value; + } + + __property short get_Celsius() { + return (short)((m_value-32)/2); + } + + __property void set_Celsius( short value) { + m_value = (short)(value*2+32); + } + } + // +} +*/ diff --git a/snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp b/snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp new file mode 100644 index 00000000000..8b8a740a62a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Interop CallingConvention/CPP/callingconv.cpp @@ -0,0 +1,25 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +private ref class NativeMethods +{ +public: + + // CallingConvention.Cdecl must be used since the stack is + // cleaned up by the caller. + // int printf( const char *format [, argument]... ) + + [DllImport("msvcrt.dll", CharSet = CharSet::Unicode, CallingConvention = CallingConvention::Cdecl)] + static int printf(String^ format, int i, double d); + + [DllImport("msvcrt.dll", CharSet = CharSet::Unicode, CallingConvention = CallingConvention::Cdecl)] + static int printf(String^ format, int i, String^ s); +}; + +int main() +{ + NativeMethods::printf("\nPrint params: %i %f", 99, 99.99); + NativeMethods::printf("\nPrint params: %i %s", 99, "abcd"); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp b/snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp new file mode 100644 index 00000000000..349f1fefdba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Interop InOutParameters/CPP/inout.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::Runtime::InteropServices; + +// Declare a class member for each structure element. + +[StructLayout(LayoutKind::Sequential, CharSet = CharSet::Unicode)] +public ref class OpenFileName +{ +public: + int structSize; + String^ filter; + String^ file; + // ... +}; + +private ref class NativeMethods +{ +public: + + // Declare a managed prototype for the unmanaged function. + + [DllImport("Comdlg32.dll", CharSet = CharSet::Unicode)] + static bool GetOpenFileName([In, Out]OpenFileName^ ofn); +}; + +void main() {} +// diff --git a/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp b/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp new file mode 100644 index 00000000000..ce2f1b81b12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/InvokeMem/CPP/invokemem.cpp @@ -0,0 +1,90 @@ + +// +using namespace System; +using namespace System::Reflection; + +// This sample class has a field, constructor, method, and property. +ref class MyType +{ +private: + Int32 myField; + +public: + MyType( interior_ptr x ) + { + *x *= 5; + } + + virtual String^ ToString() override + { + return myField.ToString(); + } + + property Int32 MyProp + { + Int32 get() + { + return myField; + } + + void set( Int32 value ) + { + if ( value < 1 ) + throw gcnew ArgumentOutOfRangeException( "value",value,"value must be > 0" ); + + myField = value; + } + } +}; + +int main() +{ + Type^ t = MyType::typeid; + + // Create an instance of a type. + array^args = {8}; + Console::WriteLine( "The value of x before the constructor is called is {0}.", args[ 0 ] ); + Object^ obj = t->InvokeMember( nullptr, static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::CreateInstance), nullptr, nullptr, args ); + Console::WriteLine( "Type: {0}", obj->GetType() ); + Console::WriteLine( "The value of x after the constructor returns is {0}.", args[ 0 ] ); + + // Read and write to a field. + array^obj5 = {5}; + t->InvokeMember( "myField", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetField), nullptr, obj, obj5 ); + Int32 v = safe_cast(t->InvokeMember( "myField", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::GetField), nullptr, obj, nullptr )); + Console::WriteLine( "myField: {0}", v ); + + // Call a method. + String^ s = safe_cast(t->InvokeMember( "ToString", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::InvokeMethod), nullptr, obj, nullptr )); + Console::WriteLine( "ToString: {0}", s ); + + // Read and write a property. First, attempt to assign an + // invalid value; then assign a valid value; finally, get + // the value. + try + { + // Assign the value zero to MyProp. The Property Set + // throws an exception, because zero is an invalid value. + // InvokeMember catches the exception, and throws + // TargetInvocationException. To discover the real cause + // you must catch TargetInvocationException and examine + // the inner exception. + array^obj0 = {(int^)0}; + t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetProperty), nullptr, obj, obj0 ); + } + catch ( TargetInvocationException^ e ) + { + // If the property assignment failed for some unexpected + // reason, rethrow the TargetInvocationException. + if ( e->InnerException->GetType() != ArgumentOutOfRangeException::typeid ) + throw; + + Console::WriteLine( "An invalid value was assigned to MyProp." ); + } + + array^obj2 = {2}; + t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::SetProperty), nullptr, obj, obj2 ); + v = safe_cast(t->InvokeMember( "MyProp", static_cast(BindingFlags::DeclaredOnly | BindingFlags::Public | BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::GetProperty), nullptr, obj, nullptr )); + Console::WriteLine( "MyProp: {0}", v ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp new file mode 100644 index 00000000000..bbdb493fd1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IsDefaultAttribute/CPP/defattr.cpp @@ -0,0 +1,85 @@ + +// +using namespace System; +using namespace System::Reflection; + +// An enumeration of animals. Start at 1 (0 = uninitialized). +public enum class Animal +{ + // Pets. + Dog = 1, + Cat, Bird +}; + + +// A custom attribute to allow a target to have a pet. +public ref class AnimalTypeAttribute: public Attribute +{ +public: + + // The constructor is called when the attribute is set. + AnimalTypeAttribute( Animal pet ) + { + thePet = pet; + } + + // Provide a default constructor and make Dog the default. + AnimalTypeAttribute() + { + thePet = Animal::Dog; + } + +protected: + + // Keep a variable internally ... + Animal thePet; + +public: + + property Animal Pet + { + // .. and show a copy to the outside world. + Animal get() + { + return thePet; + } + void set( Animal value ) + { + thePet = value; + } + + } + + // Override IsDefaultAttribute to return the correct response. + virtual bool IsDefaultAttribute() override + { + return thePet == Animal::Dog; + } +}; + +public ref class TestClass +{ +public: + + // Use the default constructor. + + [AnimalType] + void Method1(){} +}; + +int main() +{ + // Get the class type to access its metadata. + Type^ clsType = TestClass::typeid; + + // Get type information for the method. + MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); + + // Get the AnimalType attribute for the method. + AnimalTypeAttribute^ atAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, AnimalTypeAttribute::typeid )); + + // Check to see if the default attribute is applied. + Console::WriteLine( "The attribute {0} for method {1} in class {2}", atAttr->Pet, mInfo->Name, clsType->Name ); + Console::WriteLine( "{0} the default for the AnimalType attribute.", atAttr->IsDefaultAttribute() ? (String^)"is" : "is not" ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp new file mode 100644 index 00000000000..cf2f401b63a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IsDefined/CPP/isdefined.cpp @@ -0,0 +1,276 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Add an AssemblyDescription attribute +[assembly:AssemblyDescription("A sample description")]; +namespace IsDef1CS +{ + ref class DemoClass + { + public: + static void Main() + { + + // Get the class type to access its metadata. + Type^ clsType = DemoClass::typeid; + + // Get the assembly object. + Assembly^ assy = clsType->Assembly; + + // Store the assembly's name. + String^ assyName = assy->GetName()->Name; + + //Type assyType = assy.GetType(); + // See if the Assembly Description is defined. + bool isdef = Attribute::IsDefined( assy, AssemblyDescriptionAttribute::typeid ); + if ( isdef ) + { + + // Affirm that the attribute is defined. + Console::WriteLine( "The AssemblyDescription attribute " + "is defined for assembly {0}.", assyName ); + + // Get the description attribute itself. + AssemblyDescriptionAttribute^ adAttr = dynamic_cast(Attribute::GetCustomAttribute( assy, AssemblyDescriptionAttribute::typeid )); + + // Display the description. + if ( adAttr != nullptr ) + Console::WriteLine( "The description is \"{0}\".", adAttr->Description ); + else + Console::WriteLine( "The description could not " + "be retrieved." ); + } + else + Console::WriteLine( "The AssemblyDescription attribute is not " + "defined for assembly {0}.", assyName ); + } + + }; + +} + + +/* + * Output: + * The AssemblyDescription attributeis defined for assembly IsDef1CS. + * The description is "A sample description". + */ +// +// +using namespace System; +using namespace System::Diagnostics; + +// Add the Debuggable attribute to the module. +[module:Debuggable(true,false)]; +namespace IsDef2CS +{ + ref class DemoClass + { + public: + static void Main() + { + + // Get the class type to access its metadata. + Type^ clsType = DemoClass::typeid; + + // See if the Debuggable attribute is defined for this module. + bool isDef = Attribute::IsDefined( clsType->Module, DebuggableAttribute::typeid ); + + // Display the result. + Console::WriteLine( "The Debuggable attribute {0} " + "defined for Module {1}.", isDef ? (String^)"is" : "is not", clsType->Module->Name ); + + // If the attribute is defined, display the JIT settings. + if ( isDef ) + { + + // Retrieve the attribute itself. + DebuggableAttribute^ dbgAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType->Module, DebuggableAttribute::typeid )); + if ( dbgAttr != nullptr ) + { + Console::WriteLine( "JITTrackingEnabled is {0}.", dbgAttr->IsJITTrackingEnabled ); + Console::WriteLine( "JITOptimizerDisabled is {0}.", dbgAttr->IsJITOptimizerDisabled ); + } + else + Console::WriteLine( "The Debuggable attribute " + "could not be retrieved." ); + } + } + + }; + +} + + +/* + * Output: + * The Debuggable attribute is defined for Module IsDef2CS.exe. + * JITTrackingEnabled is True. + * JITOptimizerDisabled is False. + */ +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +namespace IsDef3CS +{ + + // Assign a Guid attribute to a class. + + [Guid("BF235B41-52D1-46cc-9C55-046793DB363F")] + public ref class TestClass{}; + + ref class DemoClass + { + public: + static void Main() + { + + // Get the class type to access its metadata. + Type^ clsType = TestClass::typeid; + + // See if the Guid attribute is defined for the class. + bool isDef = Attribute::IsDefined( clsType, GuidAttribute::typeid ); + + // Display the result. + Console::WriteLine( "The Guid attribute {0} defined for class {1}.", isDef ? (String^)"is" : "is not", clsType->Name ); + + // If it's defined, display the GUID. + if ( isDef ) + { + GuidAttribute^ guidAttr = dynamic_cast(Attribute::GetCustomAttribute( clsType, GuidAttribute::typeid )); + if ( guidAttr != nullptr ) + Console::WriteLine( "GUID: {{0}}.", guidAttr->Value ); + else + Console::WriteLine( "The Guid attribute could " + "not be retrieved." ); + } + } + + }; + +} + + +/* + * Output: + * The Guid attribute is defined for class TestClass. + * GUID: {BF235B41-52D1-46cc-9C55-046793DB363F}. + */ +// +// +using namespace System; +using namespace System::Reflection; + +namespace IsDef4CS +{ + public ref class TestClass + { + public: + + // Assign the Obsolete attribute to a method. + + [Obsolete("This method is obsolete. Use Method2 instead.")] + void Method1(){} + + void Method2(){} + + }; + + ref class DemoClass + { + public: + static void Main() + { + + // Get the class type to access its metadata. + Type^ clsType = TestClass::typeid; + + // Get the MethodInfo object for Method1. + MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); + + // See if the Obsolete attribute is defined for this method. + bool isDef = Attribute::IsDefined( mInfo, ObsoleteAttribute::typeid ); + + // Display the result. + Console::WriteLine( "The Obsolete Attribute {0} defined for {1} of class {2}.", isDef ? (String^)"is" : "is not", mInfo->Name, clsType->Name ); + + // If it's defined, display the attribute's message. + if ( isDef ) + { + ObsoleteAttribute^ obsAttr = dynamic_cast(Attribute::GetCustomAttribute( mInfo, ObsoleteAttribute::typeid )); + if ( obsAttr != nullptr ) + Console::WriteLine( "The message is: \"{0}\".", obsAttr->Message ); + else + Console::WriteLine( "The message could not be retrieved." ); + } + } + + }; + +} + + +/* + * Output: + * The Obsolete Attribute is defined for Method1 of class TestClass. + * The message is: "This method is obsolete. Use Method2 instead.". + */ +// +// +using namespace System; +using namespace System::Reflection; + +namespace IsDef5CS +{ + public ref class TestClass + { + public: + + // Assign a ParamArray attribute to the parameter using the keyword. + void Method1(... array^args ){} + + }; + + ref class DemoClass + { + public: + static void Main() + { + + // Get the class type to access its metadata. + Type^ clsType = TestClass::typeid; + + // Get the MethodInfo object for Method1. + MethodInfo^ mInfo = clsType->GetMethod( "Method1" ); + + // Get the ParameterInfo array for the method parameters. + array^pInfo = mInfo->GetParameters(); + if ( pInfo != nullptr ) + { + + // See if the ParamArray attribute is defined. + bool isDef = Attribute::IsDefined( pInfo[ 0 ], ParamArrayAttribute::typeid ); + + // Display the result. + Console::WriteLine( "The ParamArray attribute {0} defined for " + "parameter {1} of method {2}.", isDef ? (String^)"is" : "is not", pInfo[ 0 ]->Name, mInfo->Name ); + } + else + Console::WriteLine( "The parameters information could " + "not be retrieved for method {0}.", mInfo->Name ); + } + + }; + +} + +/* + * Output: + * The ParamArray attribute is defined for parameter args of method Method1. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp new file mode 100644 index 00000000000..99ec465e315 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/cpp/IsolatedStoragePermissionAttribute.cpp @@ -0,0 +1,92 @@ +//Types:System.Security.Permissions.IsolatedStorageContainment (enum) +//Types:System.Security.Permissions.IsolatedStoragePermissionAttribute +//Types:System.Security.Permissions.SecurityAction +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO::IsolatedStorage; +using namespace System::IO; + + +static void WriteIsolatedStorage() +{ + try + { + // Attempt to create a storage file that is isolated by + // user and assembly. IsolatedStorageFilePermission + // granted to the attribute at the top of this file + // allows CLR to load this assembly and execution of this + // statement. + Stream^ fileCreateStream = gcnew + IsolatedStorageFileStream( + "AssemblyData", + FileMode::Create, + IsolatedStorageFile::GetUserStoreForAssembly()); + + StreamWriter^ streamWriter = gcnew StreamWriter( + fileCreateStream); + try + { + // Write some data out to the isolated file. + + streamWriter->Write("This is some test data."); + streamWriter->Close(); + } + finally + { + delete fileCreateStream; + delete streamWriter; + } + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } + + try + { + Stream^ fileOpenStream = + gcnew IsolatedStorageFileStream( + "AssemblyData", + FileMode::Open, + IsolatedStorageFile::GetUserStoreForAssembly()); + // Attempt to open the file that was previously created. + + StreamReader^ streamReader = gcnew StreamReader( + fileOpenStream); + try + { + // Read the data from the file and display it. + + Console::WriteLine(streamReader->ReadLine()); + streamReader->Close(); + } + finally + { + delete fileOpenStream; + delete streamReader; + } + } + catch (FileNotFoundException^ ex) + { + Console::WriteLine(ex->Message); + } + catch (IOException^ ex) + { + Console::WriteLine(ex->Message); + } +} +// Notify the CLR to only grant IsolatedStorageFilePermission to called methods. +// This restricts the called methods to working only with storage files that are isolated +// by user and assembly. +[IsolatedStorageFilePermission(SecurityAction::PermitOnly, UsageAllowed = IsolatedStorageContainment::AssemblyIsolationByUser)] +int main() +{ + WriteIsolatedStorage(); +} + +// This code produces the following output. +// +// This is some test data. +// diff --git a/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp new file mode 100644 index 00000000000..8997b4e85f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/KeyedCollection/cpp/source.cpp @@ -0,0 +1,220 @@ +// +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Collections::ObjectModel; + +// This class represents a simple line item in an order. All the +// values are immutable except quantity. +// +public ref class OrderItem +{ +private: + int _quantity; + +public: + initonly int PartNumber; + initonly String^ Description; + initonly double UnitPrice; + + OrderItem(int partNumber, String^ description, + int quantity, double unitPrice) + { + this->PartNumber = partNumber; + this->Description = description; + this->Quantity = quantity; + this->UnitPrice = unitPrice; + } + + property int Quantity + { + int get() { return _quantity; } + void set(int value) + { + if (value < 0) + throw gcnew ArgumentException("Quantity cannot be negative."); + + _quantity = value; + } + } + + virtual String^ ToString() override + { + return String::Format( + "{0,9} {1,6} {2,-12} at {3,8:#,###.00} = {4,10:###,###.00}", + PartNumber, _quantity, Description, UnitPrice, + UnitPrice * _quantity); + } +}; + +// This class represents a very simple keyed list of OrderItems, +// inheriting most of its behavior from the KeyedCollection and +// Collection classes. The immediate base class is the constructed +// type KeyedCollection. When you inherit +// from KeyedCollection, the second generic type argument is the +// type that you want to store in the collection -- in this case +// OrderItem. The first type argument is the type that you want +// to use as a key. Its values must be calculated from OrderItem; +// in this case it is the int field PartNumber, so SimpleOrder +// inherits KeyedCollection. +// +public ref class SimpleOrder : KeyedCollection +{ + // The parameterless constructor of the base class creates a + // KeyedCollection with an internal dictionary. For this code + // example, no other constructors are exposed. + // +public: + SimpleOrder() {} + + // This is the only method that absolutely must be overridden, + // because without it the KeyedCollection cannot extract the + // keys from the items. The input parameter type is the + // second generic type argument, in this case OrderItem, and + // the return value type is the first generic type argument, + // in this case int. + // +protected: + virtual int GetKeyForItem(OrderItem^ item) override + { + // In this example, the key is the part number. + return item->PartNumber; + } +}; + +public ref class Demo +{ +public: + static void Main() + { + SimpleOrder^ weekly = gcnew SimpleOrder(); + + // The Add method, inherited from Collection, takes OrderItem. + // + weekly->Add(gcnew OrderItem(110072674, "Widget", 400, 45.17)); + weekly->Add(gcnew OrderItem(110072675, "Sprocket", 27, 5.3)); + weekly->Add(gcnew OrderItem(101030411, "Motor", 10, 237.5)); + weekly->Add(gcnew OrderItem(110072684, "Gear", 175, 5.17)); + + Display(weekly); + + // The Contains method of KeyedCollection takes the key, + // type, in this case int. + // + Console::WriteLine("\nContains(101030411): {0}", + weekly->Contains(101030411)); + + // The default Item property of KeyedCollection takes a key. + // + Console::WriteLine("\nweekly(101030411)->Description: {0}", + weekly[101030411]->Description); + + // The Remove method of KeyedCollection takes a key. + // + Console::WriteLine("\nRemove(101030411)"); + weekly->Remove(101030411); + Display(weekly); + + // The Insert method, inherited from Collection, takes an + // index and an OrderItem. + // + Console::WriteLine("\nInsert(2, New OrderItem(...))"); + weekly->Insert(2, gcnew OrderItem(111033401, "Nut", 10, .5)); + Display(weekly); + + // The default Item property is overloaded. One overload comes + // from KeyedCollection; that overload + // is read-only, and takes Integer because it retrieves by key. + // The other overload comes from Collection, the + // base class of KeyedCollection; it + // retrieves by index, so it also takes an Integer. The compiler + // uses the most-derived overload, from KeyedCollection, so the + // only way to access SimpleOrder by index is to cast it to + // Collection. Otherwise the index is interpreted + // as a key, and KeyNotFoundException is thrown. + // + Collection^ coweekly = weekly; + Console::WriteLine("\ncoweekly[2].Description: {0}", + coweekly[2]->Description); + + Console::WriteLine("\ncoweekly[2] = gcnew OrderItem(...)"); + coweekly[2] = gcnew OrderItem(127700026, "Crank", 27, 5.98); + + OrderItem^ temp = coweekly[2]; + + // The IndexOf method inherited from Collection + // takes an OrderItem instead of a key + // + Console::WriteLine("\nIndexOf(temp): {0}", weekly->IndexOf(temp)); + + // The inherited Remove method also takes an OrderItem. + // + Console::WriteLine("\nRemove(temp)"); + weekly->Remove(temp); + Display(weekly); + + Console::WriteLine("\nRemoveAt(0)"); + weekly->RemoveAt(0); + Display(weekly); + + } + +private: + static void Display(SimpleOrder^ order) + { + Console::WriteLine(); + for each( OrderItem^ item in order ) + { + Console::WriteLine(item); + } + } +}; + +void main() +{ + Demo::Main(); +} + +/* This code example produces the following output: + +110072674 400 Widget at 45.17 = 18,068.00 +110072675 27 Sprocket at 5.30 = 143.10 +101030411 10 Motor at 237.50 = 2,375.00 +110072684 175 Gear at 5.17 = 904.75 + +Contains(101030411): True + +weekly(101030411)->Description: Motor + +Remove(101030411) + +110072674 400 Widget at 45.17 = 18,068.00 +110072675 27 Sprocket at 5.30 = 143.10 +110072684 175 Gear at 5.17 = 904.75 + +Insert(2, New OrderItem(...)) + +110072674 400 Widget at 45.17 = 18,068.00 +110072675 27 Sprocket at 5.30 = 143.10 +111033401 10 Nut at .50 = 5.00 +110072684 175 Gear at 5.17 = 904.75 + +coweekly(2)->Description: Nut + +coweekly[2] = gcnew OrderItem(...) + +IndexOf(temp): 2 + +Remove(temp) + +110072674 400 Widget at 45.17 = 18,068.00 +110072675 27 Sprocket at 5.30 = 143.10 +110072684 175 Gear at 5.17 = 904.75 + +RemoveAt(0) + +110072675 27 Sprocket at 5.30 = 143.10 +110072684 175 Gear at 5.17 = 904.75 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp new file mode 100644 index 00000000000..37225c227f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/KeyedCollection2/cpp/source.cpp @@ -0,0 +1,341 @@ +// +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Collections::ObjectModel; + +public enum class ChangeTypes +{ + Added, + Removed, + Replaced, + Cleared +}; + +ref class SimpleOrderChangedEventArgs; + +// This class represents a simple line item in an order. All the +// values are immutable except quantity. +// +public ref class OrderItem +{ +private: + int _quantity; + +public: + initonly int PartNumber; + initonly String^ Description; + initonly double UnitPrice; + + OrderItem(int partNumber, String^ description, int quantity, + double unitPrice) + { + this->PartNumber = partNumber; + this->Description = description; + this->Quantity = quantity; + this->UnitPrice = unitPrice; + }; + + property int Quantity + { + int get() { return _quantity; }; + void set(int value) + { + if (value < 0) + throw gcnew ArgumentException("Quantity cannot be negative."); + + _quantity = value; + }; + }; + + virtual String^ ToString() override + { + return String::Format( + "{0,9} {1,6} {2,-12} at {3,8:#,###.00} = {4,10:###,###.00}", + PartNumber, _quantity, Description, UnitPrice, + UnitPrice * _quantity); + }; +}; + +// Event argument for the Changed event. +// +public ref class SimpleOrderChangedEventArgs : EventArgs +{ +public: + OrderItem^ ChangedItem; + initonly ChangeTypes ChangeType; + OrderItem^ ReplacedWith; + + SimpleOrderChangedEventArgs(ChangeTypes change, + OrderItem^ item, OrderItem^ replacement) + { + this->ChangeType = change; + this->ChangedItem = item; + this->ReplacedWith = replacement; + } +}; + +// This class derives from KeyedCollection and shows how to override +// the protected ClearItems, InsertItem, RemoveItem, and SetItem +// methods in order to change the behavior of the default Item +// property and the Add, Clear, Insert, and Remove methods. The +// class implements a Changed event, which is raised by all the +// protected methods. +// +// SimpleOrder is a collection of OrderItem objects, and its key +// is the PartNumber field of OrderItem-> PartNumber is an Integer, +// so SimpleOrder inherits KeyedCollection. +// (Note that the key of OrderItem cannot be changed; if it could +// be changed, SimpleOrder would have to override ChangeItemKey.) +// +public ref class SimpleOrder : KeyedCollection +{ +public: + event EventHandler^ Changed; + + // This parameterless constructor calls the base class constructor + // that specifies a dictionary threshold of 0, so that the internal + // dictionary is created as soon as an item is added to the + // collection. + // + SimpleOrder() : KeyedCollection(nullptr, 0) {}; + + // This is the only method that absolutely must be overridden, + // because without it the KeyedCollection cannot extract the + // keys from the items. + // +protected: + virtual int GetKeyForItem(OrderItem^ item) override + { + // In this example, the key is the part number. + return item->PartNumber; + } + + virtual void InsertItem(int index, OrderItem^ newItem) override + { + __super::InsertItem(index, newItem); + + Changed(this, gcnew SimpleOrderChangedEventArgs( + ChangeTypes::Added, newItem, nullptr)); + } + + // + virtual void SetItem(int index, OrderItem^ newItem) override + { + OrderItem^ replaced = this->Items[index]; + __super::SetItem(index, newItem); + + Changed(this, gcnew SimpleOrderChangedEventArgs( + ChangeTypes::Replaced, replaced, newItem)); + } + // + + virtual void RemoveItem(int index) override + { + OrderItem^ removedItem = Items[index]; + __super::RemoveItem(index); + + Changed(this, gcnew SimpleOrderChangedEventArgs( + ChangeTypes::Removed, removedItem, nullptr)); + } + + virtual void ClearItems() override + { + __super::ClearItems(); + + Changed(this, gcnew SimpleOrderChangedEventArgs( + ChangeTypes::Cleared, nullptr, nullptr)); + } + + // + // This method uses the internal reference to the dictionary + // to test fo +public: + void AddOrMerge(OrderItem^ newItem) + { + + int key = this->GetKeyForItem(newItem); + OrderItem^ existingItem = nullptr; + + // The dictionary is not created until the first item is + // added, so it is necessary to test for null. Using + // AndAlso ensures that TryGetValue is not called if the + // dictionary does not exist. + // + if (this->Dictionary != nullptr && + this->Dictionary->TryGetValue(key, existingItem)) + { + existingItem->Quantity += newItem->Quantity; + } + else + { + this->Add(newItem); + } + } + // +}; + +public ref class Demo +{ +public: + static void Main() + { + SimpleOrder^ weekly = gcnew SimpleOrder(); + weekly->Changed += gcnew + EventHandler(ChangedHandler); + + // The Add method, inherited from Collection, takes OrderItem-> + // + weekly->Add(gcnew OrderItem(110072674, "Widget", 400, 45.17)); + weekly->Add(gcnew OrderItem(110072675, "Sprocket", 27, 5.3)); + weekly->Add(gcnew OrderItem(101030411, "Motor", 10, 237.5)); + weekly->Add(gcnew OrderItem(110072684, "Gear", 175, 5.17)); + + Display(weekly); + + // The Contains method of KeyedCollection takes TKey. + // + Console::WriteLine("\nContains(101030411): {0}", + weekly->Contains(101030411)); + + // The default Item property of KeyedCollection takes the key + // type, Integer. The property is read-only. + // + Console::WriteLine("\nweekly[101030411]->Description: {0}", + weekly[101030411]->Description); + + // The Remove method of KeyedCollection takes a key. + // + Console::WriteLine("\nRemove(101030411)"); + weekly->Remove(101030411); + + // The Insert method, inherited from Collection, takes an + // index and an OrderItem. + // + Console::WriteLine("\nInsert(2, gcnew OrderItem(...))"); + weekly->Insert(2, gcnew OrderItem(111033401, "Nut", 10, .5)); + + // The default Item property is overloaded. One overload comes + // from KeyedCollection; that overload + // is read-only, and takes Integer because it retrieves by key. + // The other overload comes from Collection, the + // base class of KeyedCollection; it + // retrieves by index, so it also takes an Integer. The compiler + // uses the most-derived overload, from KeyedCollection, so the + // only way to access SimpleOrder by index is to cast it to + // Collection. Otherwise the index is interpreted + // as a key, and KeyNotFoundException is thrown. + // + Collection^ coweekly = weekly; + Console::WriteLine("\ncoweekly[2].Description: {0}", + coweekly[2]->Description); + + Console::WriteLine("\ncoweekly[2] = gcnew OrderItem(...)"); + coweekly[2] = gcnew OrderItem(127700026, "Crank", 27, 5.98); + + OrderItem^ temp = coweekly[2]; + + // The IndexOf method, inherited from Collection, + // takes an OrderItem instead of a key. + // + Console::WriteLine("\nIndexOf(temp): {0}", weekly->IndexOf(temp)); + + // The inherited Remove method also takes an OrderItem-> + // + Console::WriteLine("\nRemove(temp)"); + weekly->Remove(temp); + + Console::WriteLine("\nRemoveAt(0)"); + weekly->RemoveAt(0); + + weekly->AddOrMerge(gcnew OrderItem(110072684, "Gear", 1000, 5.17)); + + Display(weekly); + + Console::WriteLine(); + weekly->Clear(); + } + +private: + static void Display(SimpleOrder^ order) + { + Console::WriteLine(); + for each( OrderItem^ item in order ) + { + Console::WriteLine(item); + } + } + + static void ChangedHandler(Object^ source, + SimpleOrderChangedEventArgs^ e) + { + OrderItem^ item = e->ChangedItem; + + if (e->ChangeType == ChangeTypes::Replaced) + { + OrderItem^ replacement = e->ReplacedWith; + + Console::WriteLine("{0} (quantity {1}) was replaced " + + "by {2}, (quantity {3}).", item->Description, + item->Quantity, replacement->Description, + replacement->Quantity); + } + else if(e->ChangeType == ChangeTypes::Cleared) + { + Console::WriteLine("The order list was cleared."); + } + else + { + Console::WriteLine("{0} (quantity {1}) was {2}.", + item->Description, item->Quantity, e->ChangeType); + } + } +}; + +void main() +{ + Demo::Main(); +} + +/* This code example produces the following output: + +Widget (quantity 400) was Added. +Sprocket (quantity 27) was Added. +Motor (quantity 10) was Added. +Gear (quantity 175) was Added. + +110072674 400 Widget at 45.17 = 18,068.00 +110072675 27 Sprocket at 5.30 = 143.10 +101030411 10 Motor at 237.50 = 2,375.00 +110072684 175 Gear at 5.17 = 904.75 + +Contains(101030411): True + +weekly[101030411]->Description: Motor + +Remove(101030411) +Motor (quantity 10) was Removed. + +Insert(2, gcnew OrderItem(...)) +Nut (quantity 10) was Added. + +coweekly[2].Description: Nut + +coweekly[2] = gcnew OrderItem(...) +Nut (quantity 10) was replaced by Crank, (quantity 27). + +IndexOf(temp): 2 + +Remove(temp) +Crank (quantity 27) was Removed. + +RemoveAt(0) +Widget (quantity 400) was Removed. + +110072675 27 Sprocket at 5.30 = 143.10 +110072684 1175 Gear at 5.17 = 6,074.75 + +The order list was cleared. + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp b/snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp new file mode 100644 index 00000000000..68aeee21dd5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/LCIDConversionAttributeSample2/CPP/lcidattrsample.cpp @@ -0,0 +1,42 @@ + +// +using namespace System; +using namespace System::Runtime::InteropServices; +using namespace System::Reflection; + +#define LCID_INSTALLED 1 +#define LCID_SUPPORTED 2 + +ref class LCIDAttrSample +{ +public: + + // Position of the LCID argument + + [DllImport("KERNEL32.DLL",EntryPoint="IsValidLocale",SetLastError=true,CharSet=CharSet::Auto)] + [LCIDConversionAttribute(0)] + static bool IsValidLocale( int dwFlags ); // options + + void CheckCurrentLCID() + { + MethodInfo^ mthIfo = this->GetType()->GetMethod( "IsValidLocale" ); + Attribute^ attr = Attribute::GetCustomAttribute( mthIfo, LCIDConversionAttribute::typeid ); + if ( attr != nullptr ) + { + LCIDConversionAttribute^ lcidAttr = dynamic_cast(attr); + Console::WriteLine( "Position of the LCID argument in the unmanaged signature: {0}", lcidAttr->Value ); + } + + bool res = IsValidLocale( LCID_INSTALLED ); + Console::WriteLine( "Result LCID_INSTALLED {0}", res ); + res = IsValidLocale( LCID_SUPPORTED ); + Console::WriteLine( "Result LCID_SUPPORTED {0}", res ); + } +}; + +int main() +{ + LCIDAttrSample^ smpl = gcnew LCIDAttrSample; + smpl->CheckCurrentLCID(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp b/snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp new file mode 100644 index 00000000000..0763df330bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/LayoutKind/CPP/layoutkind.cpp @@ -0,0 +1,76 @@ + +using namespace System; +using namespace System::Runtime::InteropServices; + +// +// +enum class Bool +{ + False = 0, + True +}; + + +[StructLayout(LayoutKind::Sequential)] +value struct Point +{ +public: + int x; + int y; +}; + + +[StructLayout(LayoutKind::Explicit)] +value struct Rect +{ +public: + + [FieldOffset(0)] + int left; + + [FieldOffset(4)] + int top; + + [FieldOffset(8)] + int right; + + [FieldOffset(12)] + int bottom; +}; + +ref class NativeMethods +{ +public: + + [DllImport("user32.dll",CallingConvention=CallingConvention::StdCall)] + static Bool PtInRect( Rect * r, Point p ); +}; + +int main() +{ + try + { + Bool bPointInRect = (Bool)0; + Rect myRect = Rect( ); + myRect.left = 10; + myRect.right = 100; + myRect.top = 10; + myRect.bottom = 100; + Point myPoint = Point( ); + myPoint.x = 50; + myPoint.y = 50; + bPointInRect = NativeMethods::PtInRect( &myRect, myPoint ); + if ( bPointInRect == Bool::True ) + Console::WriteLine( "Point lies within the Rect" ); + else + Console::WriteLine( "Point did not lie within the Rect" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp new file mode 100644 index 00000000000..8fb5233f28b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_AsReadOnly/cpp/source.cpp @@ -0,0 +1,68 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(4); + + Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); + + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Deinonychus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nIList^ roDinosaurs = dinosaurs->AsReadOnly()"); + IList^ roDinosaurs = dinosaurs->AsReadOnly(); + + Console::WriteLine("\nElements in the read-only IList:"); + for each(String^ dinosaur in roDinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\ndinosaurs[2] = \"Coelophysis\""); + dinosaurs[2] = "Coelophysis"; + + Console::WriteLine("\nElements in the read-only IList:"); + for each(String^ dinosaur in roDinosaurs) + { + Console::WriteLine(dinosaur); + } +} + +/* This code example produces the following output: + +Capacity: 4 + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Deinonychus + +IList^ roDinosaurs = dinosaurs->AsReadOnly() + +Elements in the read-only IList: +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Deinonychus + +dinosaurs[2] = "Coelophysis" + +Elements in the read-only IList: +Tyrannosaurus +Amargasaurus +Coelophysis +Deinonychus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp new file mode 100644 index 00000000000..df52855da1d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_Class/cpp/source.cpp @@ -0,0 +1,104 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(); + + Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); + + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Deinonychus"); + dinosaurs->Add("Compsognathus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); + Console::WriteLine("Count: {0}", dinosaurs->Count); + + Console::WriteLine("\nContains(\"Deinonychus\"): {0}", + dinosaurs->Contains("Deinonychus")); + + Console::WriteLine("\nInsert(2, \"Compsognathus\")"); + dinosaurs->Insert(2, "Compsognathus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\ndinosaurs[3]: {0}", dinosaurs[3]); + + Console::WriteLine("\nRemove(\"Compsognathus\")"); + dinosaurs->Remove("Compsognathus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + dinosaurs->TrimExcess(); + Console::WriteLine("\nTrimExcess()"); + Console::WriteLine("Capacity: {0}", dinosaurs->Capacity); + Console::WriteLine("Count: {0}", dinosaurs->Count); + + dinosaurs->Clear(); + Console::WriteLine("\nClear()"); + Console::WriteLine("Capacity: {0}", dinosaurs->Capacity); + Console::WriteLine("Count: {0}", dinosaurs->Count); +} + +/* This code example produces the following output: + +Capacity: 0 + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Deinonychus +Compsognathus + +Capacity: 8 +Count: 5 + +Contains("Deinonychus"): True + +Insert(2, "Compsognathus") + +Tyrannosaurus +Amargasaurus +Compsognathus +Mamenchisaurus +Deinonychus +Compsognathus + +dinosaurs[3]: Mamenchisaurus + +Remove("Compsognathus") + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Deinonychus +Compsognathus + +TrimExcess() +Capacity: 5 +Count: 5 + +Clear() +Capacity: 5 +Count: 0 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp new file mode 100644 index 00000000000..eb95c6a9af7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_ConvertAll/cpp/source.cpp @@ -0,0 +1,51 @@ +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections::Generic; + +Point PointFToPoint(PointF pf) +{ + return Point((int) pf.X, (int) pf.Y); +}; + +void main() +{ + List^ lpf = gcnew List(); + + lpf->Add(PointF(27.8F, 32.62F)); + lpf->Add(PointF(99.3F, 147.273F)); + lpf->Add(PointF(7.5F, 1412.2F)); + + Console::WriteLine(); + for each(PointF p in lpf) + { + Console::WriteLine(p); + } + + List^ lp = + lpf->ConvertAll( + gcnew Converter(PointFToPoint) + ); + + Console::WriteLine(); + for each(Point p in lp) + { + Console::WriteLine(p); + } +} + +/* This code example produces the following output: + +{X=27.8, Y=32.62} +{X=99.3, Y=147.273} +{X=7.5, Y=1412.2} + +{X=27,Y=32} +{X=99,Y=147} +{X=7,Y=1412} + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp new file mode 100644 index 00000000000..ce250927500 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_CopyTo/cpp/source.cpp @@ -0,0 +1,53 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Brachiosaurus"); + dinosaurs->Add("Compsognathus"); + + Console::WriteLine(); + for each(String^ dinosaurs in dinosaurs ) + { + Console::WriteLine(dinosaurs); + } + + // Create an array of 15 strings. + array^ arr = gcnew array(15); + + dinosaurs->CopyTo(arr); + dinosaurs->CopyTo(arr, 6); + dinosaurs->CopyTo(2, arr, 12, 3); + + Console::WriteLine("\nContents of the array:"); + for each(String^ dinosaurs in arr ) + { + Console::WriteLine(dinosaurs); + } +} + +/* This code example produces the following output: + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Brachiosaurus +Deinonychus +Tyrannosaurus +Compsognathus + +IndexOf("Tyrannosaurus"): 0 + +IndexOf("Tyrannosaurus", 3): 5 + +IndexOf("Tyrannosaurus", 2, 2): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp new file mode 100644 index 00000000000..d4033713e6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_FindEtAl/cpp/source.cpp @@ -0,0 +1,97 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +// Search predicate returns true if a string ends in "saurus". +bool EndsWithSaurus(String^ s) +{ + return s->ToLower()->EndsWith("saurus"); +}; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Compsognathus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Oviraptor"); + dinosaurs->Add("Velociraptor"); + dinosaurs->Add("Deinonychus"); + dinosaurs->Add("Dilophosaurus"); + dinosaurs->Add("Gallimimus"); + dinosaurs->Add("Triceratops"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nTrueForAll(EndsWithSaurus): {0}", + dinosaurs->TrueForAll(gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nFind(EndsWithSaurus): {0}", + dinosaurs->Find(gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nFindLast(EndsWithSaurus): {0}", + dinosaurs->FindLast(gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nFindAll(EndsWithSaurus):"); + List^ sublist = + dinosaurs->FindAll(gcnew Predicate(EndsWithSaurus)); + + for each(String^ dinosaur in sublist) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine( + "\n{0} elements removed by RemoveAll(EndsWithSaurus).", + dinosaurs->RemoveAll(gcnew Predicate(EndsWithSaurus))); + + Console::WriteLine("\nList now contains:"); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nExists(EndsWithSaurus): {0}", + dinosaurs->Exists(gcnew Predicate(EndsWithSaurus))); +} + +/* This code example produces the following output: + +Compsognathus +Amargasaurus +Oviraptor +Velociraptor +Deinonychus +Dilophosaurus +Gallimimus +Triceratops + +TrueForAll(EndsWithSaurus): False + +Find(EndsWithSaurus): Amargasaurus + +FindLast(EndsWithSaurus): Dilophosaurus + +FindAll(EndsWithSaurus): +Amargasaurus +Dilophosaurus + +2 elements removed by RemoveAll(EndsWithSaurus). + +List now contains: +Compsognathus +Oviraptor +Velociraptor +Deinonychus +Gallimimus +Triceratops + +Exists(EndsWithSaurus): False + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp new file mode 100644 index 00000000000..6ca3a08037e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_IndexOf/cpp/source.cpp @@ -0,0 +1,51 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Brachiosaurus"); + dinosaurs->Add("Deinonychus"); + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Compsognathus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nIndexOf(\"Tyrannosaurus\"): {0}", + dinosaurs->IndexOf("Tyrannosaurus")); + + Console::WriteLine("\nIndexOf(\"Tyrannosaurus\", 3): {0}", + dinosaurs->IndexOf("Tyrannosaurus", 3)); + + Console::WriteLine("\nIndexOf(\"Tyrannosaurus\", 2, 2): {0}", + dinosaurs->IndexOf("Tyrannosaurus", 2, 2)); +} + +/* This code example produces the following output: + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Brachiosaurus +Deinonychus +Tyrannosaurus +Compsognathus + +IndexOf("Tyrannosaurus"): 0 + +IndexOf("Tyrannosaurus", 3): 5 + +IndexOf("Tyrannosaurus", 2, 2): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp new file mode 100644 index 00000000000..c6ffc2e2707 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_LastIndexOf/cpp/source.cpp @@ -0,0 +1,51 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Brachiosaurus"); + dinosaurs->Add("Deinonychus"); + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Compsognathus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\"): {0}", + dinosaurs->LastIndexOf("Tyrannosaurus")); + + Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\", 3): {0}", + dinosaurs->LastIndexOf("Tyrannosaurus", 3)); + + Console::WriteLine("\nLastIndexOf(\"Tyrannosaurus\", 4, 4): {0}", + dinosaurs->LastIndexOf("Tyrannosaurus", 4, 4)); +} + +/* This code example produces the following output: + +Tyrannosaurus +Amargasaurus +Mamenchisaurus +Brachiosaurus +Deinonychus +Tyrannosaurus +Compsognathus + +LastIndexOf("Tyrannosaurus"): 5 + +LastIndexOf("Tyrannosaurus", 3): 0 + +LastIndexOf("Tyrannosaurus", 4, 4): -1 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp new file mode 100644 index 00000000000..fbee67ad25b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_Ranges/cpp/source.cpp @@ -0,0 +1,105 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + array^ input = { "Brachiosaurus", + "Amargasaurus", + "Mamenchisaurus" }; + + List^ dinosaurs = + gcnew List((IEnumerable^) input); + + Console::WriteLine("\nCapacity: {0}", dinosaurs->Capacity); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nAddRange(dinosaurs)"); + dinosaurs->AddRange(dinosaurs); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nRemoveRange(2, 2)"); + dinosaurs->RemoveRange(2, 2); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + input = gcnew array { "Tyrannosaurus", + "Deinonychus", + "Velociraptor"}; + + Console::WriteLine("\nInsertRange(3, (IEnumerable^) input)"); + dinosaurs->InsertRange(3, (IEnumerable^) input); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\noutput = dinosaurs->GetRange(2, 3)->ToArray()"); + array^ output = dinosaurs->GetRange(2, 3)->ToArray(); + + Console::WriteLine(); + for each(String^ dinosaur in output ) + { + Console::WriteLine(dinosaur); + } +} + +/* This code example produces the following output: + +Capacity: 3 + +Brachiosaurus +Amargasaurus +Mamenchisaurus + +AddRange(dinosaurs) + +Brachiosaurus +Amargasaurus +Mamenchisaurus +Brachiosaurus +Amargasaurus +Mamenchisaurus + +RemoveRange(2, 2) + +Brachiosaurus +Amargasaurus +Amargasaurus +Mamenchisaurus + +InsertRange(3, (IEnumerable^) input) + +Brachiosaurus +Amargasaurus +Amargasaurus +Tyrannosaurus +Deinonychus +Velociraptor +Mamenchisaurus + +output = dinosaurs->GetRange(2, 3)->ToArray() + +Amargasaurus +Tyrannosaurus +Deinonychus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp new file mode 100644 index 00000000000..71c584db785 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_Reverse/cpp/source.cpp @@ -0,0 +1,64 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Pachycephalosaurus"); + dinosaurs->Add("Parasauralophus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Coelophysis"); + dinosaurs->Add("Oviraptor"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + dinosaurs->Reverse(); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + dinosaurs->Reverse(1, 4); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } +} + +/* This code example produces the following output: + +Pachycephalosaurus +Parasauralophus +Mamenchisaurus +Amargasaurus +Coelophysis +Oviraptor + +Oviraptor +Coelophysis +Amargasaurus +Mamenchisaurus +Parasauralophus +Pachycephalosaurus + +Oviraptor +Parasauralophus +Mamenchisaurus +Amargasaurus +Coelophysis +Pachycephalosaurus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp new file mode 100644 index 00000000000..4ae53587c2f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_SortComparison/cpp/source.cpp @@ -0,0 +1,106 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +int CompareDinosByLength(String^ x, String^ y) +{ + if (x == nullptr) + { + if (y == nullptr) + { + // If x is null and y is null, they're + // equal. + return 0; + } + else + { + // If x is null and y is not null, y + // is greater. + return -1; + } + } + else + { + // If x is not null... + // + if (y == nullptr) + // ...and y is null, x is greater. + { + return 1; + } + else + { + // ...and y is not null, compare the + // lengths of the two strings. + // + int retval = x->Length.CompareTo(y->Length); + + if (retval != 0) + { + // If the strings are not of equal length, + // the longer string is greater. + // + return retval; + } + else + { + // If the strings are of equal length, + // sort them with ordinary string comparison. + // + return x->CompareTo(y); + } + } + } +}; + +void Display(List^ list) +{ + Console::WriteLine(); + for each(String^ s in list) + { + if (s == nullptr) + Console::WriteLine("(null)"); + else + Console::WriteLine("\"{0}\"", s); + } +}; + +void main() +{ + List^ dinosaurs = gcnew List(); + dinosaurs->Add("Pachycephalosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add(""); + dinosaurs->Add(nullptr); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Deinonychus"); + Display(dinosaurs); + + Console::WriteLine("\nSort with generic Comparison delegate:"); + dinosaurs->Sort( + gcnew Comparison(CompareDinosByLength)); + Display(dinosaurs); + +} + +/* This code example produces the following output: + +"Pachycephalosaurus" +"Amargasaurus" +"" +(null) +"Mamenchisaurus" +"Deinonychus" + +Sort with generic Comparison delegate: + +(null) +"" +"Deinonychus" +"Amargasaurus" +"Mamenchisaurus" +"Pachycephalosaurus" + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp new file mode 100644 index 00000000000..e37961290a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearch/cpp/source.cpp @@ -0,0 +1,89 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Pachycephalosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Deinonychus"); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nSort"); + dinosaurs->Sort(); + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nBinarySearch and Insert \"Coelophysis\":"); + int index = dinosaurs->BinarySearch("Coelophysis"); + if (index < 0) + { + dinosaurs->Insert(~index, "Coelophysis"); + } + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nBinarySearch and Insert \"Tyrannosaurus\":"); + index = dinosaurs->BinarySearch("Tyrannosaurus"); + if (index < 0) + { + dinosaurs->Insert(~index, "Tyrannosaurus"); + } + + Console::WriteLine(); + for each(String^ dinosaur in dinosaurs) + { + Console::WriteLine(dinosaur); + } +} + +/* This code example produces the following output: + +Pachycephalosaurus +Amargasaurus +Mamenchisaurus +Deinonychus + +Sort + +Amargasaurus +Deinonychus +Mamenchisaurus +Pachycephalosaurus + +BinarySearch and Insert "Coelophysis": + +Amargasaurus +Coelophysis +Deinonychus +Mamenchisaurus +Pachycephalosaurus + +BinarySearch and Insert "Tyrannosaurus": + +Amargasaurus +Coelophysis +Deinonychus +Mamenchisaurus +Pachycephalosaurus +Tyrannosaurus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp new file mode 100644 index 00000000000..396d3d9f86e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparer/cpp/source.cpp @@ -0,0 +1,164 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class DinoComparer: IComparer +{ +public: + virtual int Compare(String^ x, String^ y) + { + if (x == nullptr) + { + if (y == nullptr) + { + // If x is null and y is null, they're + // equal. + return 0; + } + else + { + // If x is null and y is not null, y + // is greater. + return -1; + } + } + else + { + // If x is not null... + // + if (y == nullptr) + // ...and y is null, x is greater. + { + return 1; + } + else + { + // ...and y is not null, compare the + // lengths of the two strings. + // + int retval = x->Length.CompareTo(y->Length); + + if (retval != 0) + { + // If the strings are not of equal length, + // the longer string is greater. + // + return retval; + } + else + { + // If the strings are of equal length, + // sort them with ordinary string comparison. + // + return x->CompareTo(y); + } + } + } + } +}; + +void SearchAndInsert(List^ list, String^ insert, + DinoComparer^ dc) +{ + Console::WriteLine("\nBinarySearch and Insert \"{0}\":", insert); + + int index = list->BinarySearch(insert, dc); + + if (index < 0) + { + list->Insert(~index, insert); + } +}; + +void Display(List^ list) +{ + Console::WriteLine(); + for each(String^ s in list) + { + Console::WriteLine(s); + } +}; + +void main() +{ + List^ dinosaurs = gcnew List(); + dinosaurs->Add("Pachycephalosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Deinonychus"); + Display(dinosaurs); + + DinoComparer^ dc = gcnew DinoComparer(); + + Console::WriteLine("\nSort with alternate comparer:"); + dinosaurs->Sort(dc); + Display(dinosaurs); + + SearchAndInsert(dinosaurs, "Coelophysis", dc); + Display(dinosaurs); + + SearchAndInsert(dinosaurs, "Oviraptor", dc); + Display(dinosaurs); + + SearchAndInsert(dinosaurs, "Tyrannosaur", dc); + Display(dinosaurs); + + SearchAndInsert(dinosaurs, nullptr, dc); + Display(dinosaurs); +} + +/* This code example produces the following output: + +Pachycephalosaurus +Amargasaurus +Mamenchisaurus +Deinonychus + +Sort with alternate comparer: + +Deinonychus +Amargasaurus +Mamenchisaurus +Pachycephalosaurus + +BinarySearch and Insert "Coelophysis": + +Coelophysis +Deinonychus +Amargasaurus +Mamenchisaurus +Pachycephalosaurus + +BinarySearch and Insert "Oviraptor": + +Oviraptor +Coelophysis +Deinonychus +Amargasaurus +Mamenchisaurus +Pachycephalosaurus + +BinarySearch and Insert "Tyrannosaur": + +Oviraptor +Coelophysis +Deinonychus +Tyrannosaur +Amargasaurus +Mamenchisaurus +Pachycephalosaurus + +BinarySearch and Insert "": + + +Oviraptor +Coelophysis +Deinonychus +Tyrannosaur +Amargasaurus +Mamenchisaurus +Pachycephalosaurus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp new file mode 100644 index 00000000000..dbb74dd3f43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/List`1_SortSearchComparerRange/cpp/source.cpp @@ -0,0 +1,141 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +public ref class DinoComparer: IComparer +{ +public: + virtual int Compare(String^ x, String^ y) + { + if (x == nullptr) + { + if (y == nullptr) + { + // If x is null and y is null, they're + // equal. + return 0; + } + else + { + // If x is null and y is not null, y + // is greater. + return -1; + } + } + else + { + // If x is not null... + // + if (y == nullptr) + // ...and y is null, x is greater. + { + return 1; + } + else + { + // ...and y is not null, compare the + // lengths of the two strings. + // + int retval = x->Length.CompareTo(y->Length); + + if (retval != 0) + { + // If the strings are not of equal length, + // the longer string is greater. + // + return retval; + } + else + { + // If the strings are of equal length, + // sort them with ordinary string comparison. + // + return x->CompareTo(y); + } + } + } + } +}; + +void Display(List^ list) +{ + Console::WriteLine(); + for each(String^ s in list) + { + Console::WriteLine(s); + } +}; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Pachycephalosaurus"); + dinosaurs->Add("Parasauralophus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Galimimus"); + dinosaurs->Add("Mamenchisaurus"); + dinosaurs->Add("Deinonychus"); + dinosaurs->Add("Oviraptor"); + dinosaurs->Add("Tyrannosaurus"); + + int herbivores = 5; + Display(dinosaurs); + + DinoComparer^ dc = gcnew DinoComparer(); + + Console::WriteLine("\nSort a range with the alternate comparer:"); + dinosaurs->Sort(0, herbivores, dc); + Display(dinosaurs); + + Console::WriteLine("\nBinarySearch a range and Insert \"{0}\":", + "Brachiosaurus"); + + int index = dinosaurs->BinarySearch(0, herbivores, "Brachiosaurus", dc); + + if (index < 0) + { + dinosaurs->Insert(~index, "Brachiosaurus"); + herbivores++; + } + + Display(dinosaurs); +} + +/* This code example produces the following output: + +Pachycephalosaurus +Parasauralophus +Amargasaurus +Galimimus +Mamenchisaurus +Deinonychus +Oviraptor +Tyrannosaurus + +Sort a range with the alternate comparer: + +Galimimus +Amargasaurus +Mamenchisaurus +Parasauralophus +Pachycephalosaurus +Deinonychus +Oviraptor +Tyrannosaurus + +BinarySearch a range and Insert "Brachiosaurus": + +Galimimus +Amargasaurus +Brachiosaurus +Mamenchisaurus +Parasauralophus +Pachycephalosaurus +Deinonychus +Oviraptor +Tyrannosaurus + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp b/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp new file mode 100644 index 00000000000..75e16a96906 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/LocalBuilder_Sample_SetLocalSymInfo/CPP/localbuilder_sample_4.cpp @@ -0,0 +1,92 @@ + +// System.Reflection.Emit.LocalBuilder +// System.Reflection.Emit.ILGenerator.DeclareLocal(Type) +// System.Reflection.Emit.LocalBuilder.SetLocalSymInfo(String) +// System.Reflection.Emit.LocalBuilder.LocalType() +// System.Reflection.Emit.LocalBuilder.SetLocalSymInfo(String, Int32, Int32) +/* + +This program demonstrates 'LocalType' property, 'SetLocalSymInfo(String)', +'SetLocalSymInfo(String, Int32,Int32)' methods, class level for 'LocalBuilder' and +'DeclareLocal(Type)' method of ILGenerator class. An assembly 'myClass' is created using +AssemblyBuilder, ModuleBuilder, FieldBuilder, TypeBuilder, ConstructorBuilder classes. +Localbuilder class is used to create local variables of the specified type. + +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Threading; +int main() +{ + // Create an assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "SampleAssembly"; + AssemblyBuilder^ myAssembly = Thread::GetDomain()->DefineDynamicAssembly( + myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a module. For a single-file assembly the module + // name is usually the same as the assembly name. + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( + myAssemblyName->Name, myAssemblyName->Name + ".dll", true ); + + // Define a public class 'Example'. + TypeBuilder^ myTypeBuilder = myModule->DefineType( "Example", TypeAttributes::Public ); + + // Create the 'Function1' public method, which takes an integer + // and returns a string. + MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "Function1", + MethodAttributes::Public | MethodAttributes::Static, String::typeid, + gcnew array { int::typeid } ); + + // Generate IL for 'Function1'. The function body demonstrates + // assigning an argument to a local variable, assigning a + // constant string to a local variable, and putting the contents + // of local variables on the stack. + ILGenerator^ myMethodIL = myMethod->GetILGenerator(); + + // + // Create local variables named myString and myInt. + LocalBuilder^ myLB1 = myMethodIL->DeclareLocal( String::typeid ); + myLB1->SetLocalSymInfo( "myString" ); + Console::WriteLine( "local 'myString' type is: {0}", myLB1->LocalType ); + + LocalBuilder^ myLB2 = myMethodIL->DeclareLocal( int::typeid ); + myLB2->SetLocalSymInfo( "myInt", 1, 2 ); + Console::WriteLine( "local 'myInt' type is: {0}", myLB2->LocalType ); + // + + // Store the function argument in myInt. + myMethodIL->Emit( OpCodes::Ldarg_0 ); + myMethodIL->Emit( OpCodes::Stloc_1 ); + + // Store a literal value in myString, and return the value. + myMethodIL->Emit( OpCodes::Ldstr, "string value" ); + myMethodIL->Emit( OpCodes::Stloc_0 ); + myMethodIL->Emit( OpCodes::Ldloc_0 ); + myMethodIL->Emit( OpCodes::Ret ); + + // Create "Example" class. + Type^ myType1 = myTypeBuilder->CreateType(); + Console::WriteLine( "'Example' is created." ); + + myAssembly->Save(myAssemblyName->Name + ".dll"); + Console::WriteLine( "'{0}' is created.", myAssemblyName->Name + ".dll" ); + + // Invoke 'Function1' method of 'Example', passing the value 42. + Object^ myObject2 = myType1->InvokeMember( "Function1", + BindingFlags::InvokeMethod, nullptr, nullptr, + gcnew array { 42 } ); + + Console::WriteLine( "Example::Function1 returned: {0}", myObject2 ); +} +/* This code example produces the following output: + +local 'myString' type is: System.String +local 'myInt' type is: System.Int32 +'Example' is created. +'SampleAssembly.dll' is created. +Example::Function1 returned: string value + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp new file mode 100644 index 00000000000..e978a2ab18b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MakeXxxGenericTypeParameterBuilder/cpp/source.cpp @@ -0,0 +1,71 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +int main() +{ + // Define a dynamic assembly to contain the sample type. The + // assembly will not be run, but only saved to disk, so + // AssemblyBuilderAccess.Save is specified. + // + AppDomain^ appDomain = AppDomain::CurrentDomain; + AssemblyName^ assemblyName = gcnew + AssemblyName("MakeXxxGenericTypeParameterExample"); + AssemblyBuilder^ assemblyBuilder = appDomain->DefineDynamicAssembly + (assemblyName, AssemblyBuilderAccess::Save); + + // An assembly is made up of executable modules. For a single + // module assembly, the module name and file name are the + // same as the assembly name. + ModuleBuilder^ moduleBuilder = assemblyBuilder->DefineDynamicModule + (assemblyName->Name, assemblyName->Name + ".dll"); + + // Define the sample type. + TypeBuilder^ typeBuilder = moduleBuilder->DefineType("Sample", + TypeAttributes::Public | TypeAttributes::Abstract); + + // Make the sample type a generic type, by defining a type + // parameter T. All type parameters are defined at the same + // time, by passing an array containing the type parameter + // names. + array^ typeParamNames = {"T"}; + array^ typeParams = + typeBuilder->DefineGenericParameters(typeParamNames); + + // Define a method that takes a ByRef argument of type T, a + // pointer to type T, and one-dimensional array of type T. + // The method returns a two-dimensional array of type T. + // + // To create this method, you need Type objects that repre- + // sent the parameter types and the return type. Use the + // MakeByRefType, MakePointerType, and MakeArrayType methods + // to create the Type objects, using the generic type para- + // meter T. + // + Type^ byRefType = typeParams[0]->MakeByRefType(); + Type^ pointerType = typeParams[0]->MakePointerType(); + Type^ arrayType = typeParams[0]->MakeArrayType(); + Type^ twoDimArrayType = typeParams[0]->MakeArrayType(2); + + // Create the array of parameter types. + array^ parameterTypes = {byRefType, pointerType, arrayType}; + + // Define the abstract Test method. After you have compiled + // and run this example code, you can use ildasm.exe to open + // MakeXxxGenericTypeParameterExample.dll, examine the Sample + // type, and verify the parameter types and return type of + // the TestMethod method. + // + MethodBuilder^ methodBuilder = typeBuilder->DefineMethod("TestMethod", + MethodAttributes::Abstract | MethodAttributes::Virtual + | MethodAttributes::Public, twoDimArrayType, parameterTypes); + + // Create the type and save the assembly. For a single-file + // assembly, there is only one module to store the manifest + // information in. + // + typeBuilder->CreateType(); + assemblyBuilder->Save(assemblyName->Name + ".dll"); +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp b/snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp new file mode 100644 index 00000000000..87fd8d8dab6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Marshal/cpp/marshal.cpp @@ -0,0 +1,67 @@ +//Types:System.Runtime.InteropServices.Marshal +// +using namespace System; +using namespace System::Runtime::InteropServices; + +public value struct Point +{ +public: + property int X; + property int Y; +}; +// +extern bool CloseHandle(IntPtr h); + +int main() +{ + // + // Demonstrate the use of public static fields of the Marshal + // class. + Console::WriteLine( + "SystemDefaultCharSize={0},SystemMaxDBCSCharSize={1}", + Marshal::SystemDefaultCharSize, + Marshal::SystemMaxDBCSCharSize); + // + + // + // Demonstrate the use of the SizeOf method of the Marshal + // class. + Console::WriteLine("Number of bytes needed by a Point object: {0}", + Marshal::SizeOf(Point::typeid)); + Point point; + Console::WriteLine("Number of bytes needed by a Point object: {0}", + Marshal::SizeOf(point)); + // + + // + // Demonstrate how to call GlobalAlloc and + // GlobalFree using the Marshal class. + IntPtr hglobal = Marshal::AllocHGlobal(100); + Marshal::FreeHGlobal(hglobal); + // + + // Demonstrate how to use the Marshal class to get the Win32 + // error code when a Win32 method fails. + bool isCloseHandleSuccess = CloseHandle(IntPtr(-1)); + if (!isCloseHandleSuccess) + { + Console::WriteLine( + "CloseHandle call failed with an error code of: {0}", + Marshal::GetLastWin32Error()); + } +}; + +// This is a platform invoke prototype. SetLastError is true, +// which allows the GetLastWin32Error method of the Marshal class +// to work correctly. +[DllImport("Kernel32", ExactSpelling = true, SetLastError = true)] +extern bool CloseHandle(IntPtr h); +// + +// This code produces the following output. +// +// SystemDefaultCharSize=2, SystemMaxDBCSCharSize=1 +// Number of bytes needed by a Point object: 8 +// Number of bytes needed by a Point object: 8 +// CloseHandle call failed with an error code of: 6 +// diff --git a/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp b/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp new file mode 100644 index 00000000000..b71de67675c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MathSample/CPP/mathsample.cpp @@ -0,0 +1,88 @@ + + +// +/// +/// The following class represents simple functionality of the trapezoid. +/// +using namespace System; + +public ref class MathTrapezoidSample +{ +private: + double m_longBase; + double m_shortBase; + double m_leftLeg; + double m_rightLeg; + +public: + MathTrapezoidSample( double longbase, double shortbase, double leftLeg, double rightLeg ) + { + m_longBase = Math::Abs( longbase ); + m_shortBase = Math::Abs( shortbase ); + m_leftLeg = Math::Abs( leftLeg ); + m_rightLeg = Math::Abs( rightLeg ); + } + + +private: + double GetRightSmallBase() + { + return (Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( m_leftLeg, 2.0 ) + Math::Pow( m_longBase, 2.0 ) + Math::Pow( m_shortBase, 2.0 ) - 2 * m_shortBase * m_longBase) / (2 * (m_longBase - m_shortBase)); + } + + +public: + double GetHeight() + { + double x = GetRightSmallBase(); + return Math::Sqrt( Math::Pow( m_rightLeg, 2.0 ) - Math::Pow( x, 2.0 ) ); + } + + double GetSquare() + { + return GetHeight() * m_longBase / 2.0; + } + + double GetLeftBaseRadianAngle() + { + double sinX = GetHeight() / m_leftLeg; + return Math::Round( Math::Asin( sinX ), 2 ); + } + + double GetRightBaseRadianAngle() + { + double x = GetRightSmallBase(); + double cosX = (Math::Pow( m_rightLeg, 2.0 ) + Math::Pow( x, 2.0 ) - Math::Pow( GetHeight(), 2.0 )) / (2 * x * m_rightLeg); + return Math::Round( Math::Acos( cosX ), 2 ); + } + + double GetLeftBaseDegreeAngle() + { + double x = GetLeftBaseRadianAngle() * 180 / Math::PI; + return Math::Round( x, 2 ); + } + + double GetRightBaseDegreeAngle() + { + double x = GetRightBaseRadianAngle() * 180 / Math::PI; + return Math::Round( x, 2 ); + } + +}; + +int main() +{ + MathTrapezoidSample^ trpz = gcnew MathTrapezoidSample( 20.0,10.0,8.0,6.0 ); + Console::WriteLine( "The trapezoid's bases are 20.0 and 10.0, the trapezoid's legs are 8.0 and 6.0" ); + double h = trpz->GetHeight(); + Console::WriteLine( "Trapezoid height is: {0}", h.ToString() ); + double dxR = trpz->GetLeftBaseRadianAngle(); + Console::WriteLine( "Trapezoid left base angle is: {0} Radians", dxR.ToString() ); + double dyR = trpz->GetRightBaseRadianAngle(); + Console::WriteLine( "Trapezoid right base angle is: {0} Radians", dyR.ToString() ); + double dxD = trpz->GetLeftBaseDegreeAngle(); + Console::WriteLine( "Trapezoid left base angle is: {0} Degrees", dxD.ToString() ); + double dyD = trpz->GetRightBaseDegreeAngle(); + Console::WriteLine( "Trapezoid right base angle is: {0} Degrees", dyD.ToString() ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp new file mode 100644 index 00000000000..3586a67f36a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttribute_IsDefined/CPP/memberinfo_getcustomattribute_isdefined.cpp @@ -0,0 +1,68 @@ +// +using namespace System; +using namespace System::Reflection; + +// Define a custom attribute with one named parameter. + +[AttributeUsage(AttributeTargets::All)] +public ref class MyAttribute: public Attribute +{ +private: + String^ myName; + +public: + MyAttribute( String^ name ) + { + myName = name; + } + + property String^ Name + { + String^ get() + { + return myName; + } + } +}; + +// Define a class that has the custom attribute associated with one of its members. +public ref class MyClass1 +{ +public: + + [MyAttribute("This is an example attribute.")] + void MyMethod( int i ){} +}; + +int main() +{ + try + { + // Get the type of MyClass1. + Type^ myType = MyClass1::typeid; + + // Get the members associated with MyClass1. + array^myMembers = myType->GetMembers(); + + // Display the attributes for each of the members of MyClass1. + for ( int i = 0; i < myMembers->Length; i++ ) + { + // Display the attribute if it is of type MyAttribute. + if ( myMembers[ i ]->IsDefined( MyAttribute::typeid, false ) ) + { + array^myAttributes = myMembers[ i ]->GetCustomAttributes( MyAttribute::typeid, false ); + Console::WriteLine( "\nThe attributes of type MyAttribute for the member {0} are: \n", myMembers[ i ] ); + for ( int j = 0; j < myAttributes->Length; j++ ) + + // Display the value associated with the attribute. + Console::WriteLine( "The value of the attribute is : \"{0}\"", + (safe_cast(myAttributes[ j ]))->Name ); + } + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp new file mode 100644 index 00000000000..6153b2ffb03 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MemberInfo_GetCustomAttributes1/CPP/memberinfo_getcustomattributes1.cpp @@ -0,0 +1,67 @@ +// +using namespace System; +using namespace System::Reflection; + +// Define a custom attribute with one named parameter. + +[AttributeUsage(AttributeTargets::All)] +public ref class MyAttribute: public Attribute +{ +private: + String^ myName; + +public: + MyAttribute( String^ name ) + { + myName = name; + } + + property String^ Name + { + String^ get() + { + return myName; + } + } +}; + +// Define a class that has the custom attribute associated with one of its members. +public ref class MyClass1 +{ +public: + + [MyAttribute("This is an example attribute.")] + void MyMethod( int i ) + { + return; + } +}; + +int main() +{ + try + { + // Get the type of MyClass1. + Type^ myType = MyClass1::typeid; + + // Get the members associated with MyClass1. + array^myMembers = myType->GetMembers(); + + // Display the attributes for each of the members of MyClass1. + for ( int i = 0; i < myMembers->Length; i++ ) + { + array^myAttributes = myMembers[ i ]->GetCustomAttributes( true ); + if ( myAttributes->Length > 0 ) + { + Console::WriteLine( "\nThe attributes for the member {0} are: \n", myMembers[ i ] ); + for ( int j = 0; j < myAttributes->Length; j++ ) + Console::WriteLine( "The type of the attribute is {0}.", myAttributes[ j ] ); + } + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp new file mode 100644 index 00000000000..44d2576e6eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MethodBody/cpp/source.cpp @@ -0,0 +1,157 @@ +// 1 - (entire sample) MethodBody class +// 2 - (everything through GetMethodBody and displaying InitLocals & MaxStackSize) +// 3 - (displaying locals) +// 4 - (displaying exception clauses) +// 5 - (end of Main, example method, beginning of output through output for snippet 2) +// 6 - (output for snippet 3 (locals)) +// 7 - (output for snippet 4 (clauses)) +// 2,5 - InitLocals, MaxStackSize +// 2,3,5,6 - lvis property, lviInfo class +// 2,4,5,7 - ExceptionHandlingClauses property, ExceptionHandlingClause class, ExceptionHandlingClauseFlags enum +// +// +// +#using + +using namespace System; +using namespace System::Reflection; + +public ref class Example +{ + // + // The Main method contains code to analyze this method, using + // the properties and methods of the MethodBody class. +public: + void MethodBodyExample(Object^ arg) + { + // Define some local variables. In addition to these variables, + // the local variable list includes the variables scoped to + // the catch clauses. + int var1 = 42; + String^ var2 = "Forty-two"; + + try + { + // Depending on the input value, throw an ArgumentException or + // an ArgumentNullException to test the Catch clauses. + if (arg == nullptr) + { + throw gcnew ArgumentNullException("The argument cannot " + + "be null."); + } + if (arg->GetType() == String::typeid) + { + throw gcnew ArgumentException("The argument cannot " + + "be a string."); + } + } + + // There is no Filter clause in this code example. See the Visual + // Basic code for an example of a Filter clause. + + // This catch clause handles the ArgumentException class, and + // any other class derived from Exception. + catch (ArgumentException^ ex) + { + Console::WriteLine("Ordinary exception-handling clause caught:" + + " {0}", ex->GetType()); + } + finally + { + var1 = 3033; + var2 = "Another string."; + } + } + // +}; + +int main() +{ + // Get method body information. + MethodInfo^ mi = + Example::typeid->GetMethod("MethodBodyExample"); + + MethodBody^ mb = mi->GetMethodBody(); + Console::WriteLine("\r\nMethod: {0}", mi); + + // Display the general information included in the + // MethodBody object. + Console::WriteLine(" Local variables are initialized: {0}", + mb->InitLocals); + Console::WriteLine(" Maximum number of items on the operand " + + "stack: {0}", mb->MaxStackSize); + // + // + + // Display information about the local variables in the + // method body. + Console::WriteLine(); + for each (LocalVariableInfo^ lvi in mb->LocalVariables) + { + Console::WriteLine("Local variable: {0}", lvi); + } + // + // + + // Display exception handling clauses. + Console::WriteLine(); + for each(ExceptionHandlingClause^ exhc in mb->ExceptionHandlingClauses) + { + Console::WriteLine(exhc->Flags.ToString()); + + // The FilterOffset property is meaningful only for Filter + // clauses. The CatchType property is not meaningful for + // Filter or Finally clauses. + switch(exhc->Flags) + { + case ExceptionHandlingClauseOptions::Filter: + Console::WriteLine(" Filter Offset: {0}", + exhc->FilterOffset); + break; + case ExceptionHandlingClauseOptions::Finally: + break; + default: + Console::WriteLine(" Type of exception: {0}", + exhc->CatchType); + break; + } + + Console::WriteLine(" Handler Length: {0}", + exhc->HandlerLength); + Console::WriteLine(" Handler Offset: {0}", + exhc->HandlerOffset); + Console::WriteLine(" Try Block Length: {0}", exhc->TryLength); + Console::WriteLine(" Try Block Offset: {0}", exhc->TryOffset); + } + // +} + +//This code example produces output similar to the following: +// +//Method: Void MethodBodyExample(System.Object) +// Local variables are initialized: False +// Maximum number of items on the operand stack: 4 +// +// +//Local variable: System.ArgumentException (0) +//Local variable: System.String (1) +//Local variable: System.Int32 (2) +// +// +//Clause +// Type of exception: System.ArgumentException +// Handler Length: 29 +// Handler Offset: 78 +// Try Block Length: 65 +// Try Block Offset: 13 +//Finally +// Handler Length: 13 +// Handler Offset: 113 +// Try Block Length: 100 +// Try Block Offset: 13 +// +// + + + + diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp new file mode 100644 index 00000000000..546d0961119 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MethodBuilder.MakeGenericMethod/cpp/source.cpp @@ -0,0 +1,41 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +void main() +{ + // Define a transient dynamic assembly (only to run, not + // to save) with one module and a type "Test". + // + AssemblyName^ aName = gcnew AssemblyName("MyDynamic"); + AssemblyBuilder^ ab = + AppDomain::CurrentDomain->DefineDynamicAssembly( + aName, + AssemblyBuilderAccess::Run); + ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name); + TypeBuilder^ tb = mb->DefineType("Test"); + + // Add a public static method "M" to Test, and make it a + // generic method with one type parameter named "T"). + // + MethodBuilder^ meb = tb->DefineMethod("M", + MethodAttributes::Public | MethodAttributes::Static); + array^ typeParams = + meb->DefineGenericParameters(gcnew array { "T" }); + + // Give the method one parameter, of type T, and a + // return type of T. + meb->SetParameters(typeParams); + meb->SetReturnType(typeParams[0]); + + // Create a MethodInfo for M, which can be used in + // emitted code. This is possible even though the method + // does not yet have a body, and the enclosing type is not + // created. + MethodInfo^ mi = meb->MakeGenericMethod(String::typeid); + // Note that this is actually a subclass of MethodInfo, + // which has rather limited capabilities -- for + // example, you cannot reflect on its parameters. +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp b/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp new file mode 100644 index 00000000000..f43a09ff0c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MethodBuilderClass_TypeSample/CPP/methodbuilderclass.cpp @@ -0,0 +1,67 @@ + +// System.Reflection.Emit.MethodBuilder +/* +This program demonstrates 'MethodBuilder' class. A dynamic class 'myTypeBuilder' +is created in which a constructor 'myConstructorBuilder' and a method 'myMethodBuilder' +are created dynamically. Their IL's are generated. The Non-Public methods of the class +are printed on the console. The attributes and signature of 'MyDynamicMethod' are displayed +on the console using 'Attributes' and 'Signature' properties of the 'MethodBuilder' class. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +int main() +{ + try + { + // Get the current AppDomain. + AppDomain^ myAppDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "MyDynamicAssembly"; + + // Create the dynamic assembly and set its access mode to 'Save'. + AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Save ); + + // Create a dynamic module 'myModuleBuilder'. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyDynamicModule", true ); + + // Define a public class 'MyDynamicClass'. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyDynamicClass", TypeAttributes::Public ); + + // Define a public string field named 'myField'. + FieldBuilder^ myField = myTypeBuilder->DefineField( "MyDynamicField", String::typeid, FieldAttributes::Public ); + + // Define the dynamic method 'MyDynamicMethod'. + array^temp0 = gcnew array(0); + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyDynamicMethod", MethodAttributes::Private, int::typeid, temp0 ); + + // Generate the IL for 'myMethodBuilder'. + ILGenerator^ myMethodIL = myMethodBuilder->GetILGenerator(); + + // Emit the necessary opcodes. + myMethodIL->Emit( OpCodes::Ldarg_0 ); + myMethodIL->Emit( OpCodes::Ldfld, myField ); + myMethodIL->Emit( OpCodes::Ret ); + + // Create 'myTypeBuilder' class. + Type^ myType1 = myTypeBuilder->CreateType(); + + // Get the method information of 'myTypeBuilder'. + array^myInfo = myType1->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + + // Print non-public methods present of 'myType1'. + Console::WriteLine( "\nThe Non-Public methods present in 'myType1' are:\n" ); + for ( int i = 0; i < myInfo->Length; i++ ) + { + Console::WriteLine( myInfo[ i ]->Name ); + } + Console::WriteLine( "\nThe Attribute of 'MyDynamicMethod' is :{0}", myMethodBuilder->Attributes ); + Console::WriteLine( "\nThe Signature of 'MyDynamicMethod' is : \n{0}", myMethodBuilder->Signature ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception :{0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp new file mode 100644 index 00000000000..f2e621d6748 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MethodInfo.Generics/cpp/source.cpp @@ -0,0 +1,132 @@ +// +using namespace System; +using namespace System::Reflection; + +// +// Define a class with a generic method. +ref class Example +{ +public: + generic static void Generic(T toDisplay) + { + Console::WriteLine("\r\nHere it is: {0}", toDisplay); + } +}; +// + +void DisplayGenericMethodInfo(MethodInfo^ mi) +{ + Console::WriteLine("\r\n{0}", mi); + + // + Console::WriteLine("\tIs this a generic method definition? {0}", + mi->IsGenericMethodDefinition); + // + + // + Console::WriteLine("\tIs it a generic method? {0}", + mi->IsGenericMethod); + // + + // + Console::WriteLine("\tDoes it have unassigned generic parameters? {0}", + mi->ContainsGenericParameters); + // + + // + // If this is a generic method, display its type arguments. + // + if (mi->IsGenericMethod) + { + array^ typeArguments = mi->GetGenericArguments(); + + Console::WriteLine("\tList type arguments ({0}):", + typeArguments->Length); + + for each (Type^ tParam in typeArguments) + { + // IsGenericParameter is true only for generic type + // parameters. + // + if (tParam->IsGenericParameter) + { + Console::WriteLine("\t\t{0} parameter position {1}" + + "\n\t\t declaring method: {2}", + tParam, + tParam->GenericParameterPosition, + tParam->DeclaringMethod); + } + else + { + Console::WriteLine("\t\t{0}", tParam); + } + } + } + // +}; + +void main() +{ + Console::WriteLine("\r\n--- Examine a generic method."); + + // + // Create a Type object representing class Example, and + // get a MethodInfo representing the generic method. + // + Type^ ex = Example::typeid; + MethodInfo^ mi = ex->GetMethod("Generic"); + + DisplayGenericMethodInfo(mi); + + // Assign the int type to the type parameter of the Example + // method. + // + MethodInfo^ miConstructed = mi->MakeGenericMethod(int::typeid); + + DisplayGenericMethodInfo(miConstructed); + // + + // Invoke the method. + array^ args = { 42 }; + miConstructed->Invoke((Object^) 0, args); + + // Invoke the method normally. + Example::Generic(42); + + // + // Get the generic type definition from the closed method, + // and show it's the same as the original definition. + // + MethodInfo^ miDef = miConstructed->GetGenericMethodDefinition(); + Console::WriteLine("\r\nThe definition is the same: {0}", + miDef == mi); + // +}; + +/* This example produces the following output: + +--- Examine a generic method. + +Void Generic[T](T) + Is this a generic method definition? True + Is it a generic method? True + Does it have unassigned generic parameters? True + List type arguments (1): + T parameter position 0 + declaring method: Void Generic[T](T) + +Void Generic[Int32](Int32) + Is this a generic method definition? False + Is it a generic method? True + Does it have unassigned generic parameters? False + List type arguments (1): + System.Int32 + +Here it is: 42 + +Here it is: 42 + +The definition is the same: True + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp new file mode 100644 index 00000000000..f0cad63b50a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.Registry.GetSet/CPP/source.cpp @@ -0,0 +1,92 @@ +// +using namespace System; +using namespace Microsoft::Win32; + +int main() +{ + // The name of the key must include a valid root. + String^ userRoot = "HKEY_CURRENT_USER"; + String^ subKey = "RegistrySetValueExample2"; + String^ keyName = String::Concat(userRoot, "\\", subKey); + + // An int value can be stored without specifying the + // registry data type, but Int64 values will be stored + // as strings unless you specify the type. Note that + // the int is stored in the default name/value + // pair. + Registry::SetValue(keyName, "", 5280); + Registry::SetValue(keyName, "TestInt64", 12345678901234, + RegistryValueKind::QWord); + + // Strings with expandable environment variables are + // stored as ordinary strings unless you specify the + // data type. + Registry::SetValue(keyName, "TestExpand", "My path: %path%"); + Registry::SetValue(keyName, "TestExpand2", "My path: %path%", + RegistryValueKind::ExpandString); + + // Arrays of strings are stored automatically as + // MultiString. Similarly, arrays of Byte are stored + // automatically as Binary. + array^ strings = {"One", "Two", "Three"}; + Registry::SetValue(keyName, "TestArray", strings); + + // Your default value is returned if the name/value pair + // does not exist. + String^ noSuch = (String^)Registry::GetValue(keyName, + "NoSuchName", + "Return this default if NoSuchName does not exist."); + Console::WriteLine("\r\nNoSuchName: {0}", noSuch); + + // Retrieve the int and Int64 values, specifying + // numeric default values in case the name/value pairs + // do not exist. The int value is retrieved from the + // default (nameless) name/value pair for the key. + int testInteger = (int)Registry::GetValue(keyName, "", -1); + Console::WriteLine("(Default): {0}", testInteger); + long long testInt64 = (long long)Registry::GetValue(keyName, + "TestInt64", System::Int64::MinValue); + Console::WriteLine("TestInt64: {0}", testInt64); + + // When retrieving a MultiString value, you can specify + // an array for the default return value. + array^ testArray = (array^)Registry::GetValue( + keyName, "TestArray", + gcnew array {"Default if TestArray does not exist."}); + for (int i = 0; i < testArray->Length; i++) + { + Console::WriteLine("TestArray({0}): {1}", i, testArray[i]); + } + + // A string with embedded environment variables is not + // expanded if it was stored as an ordinary string. + String^ testExpand = (String^)Registry::GetValue(keyName, + "TestExpand", "Default if TestExpand does not exist."); + Console::WriteLine("TestExpand: {0}", testExpand); + + // A string stored as ExpandString is expanded. + String^ testExpand2 = (String^)Registry::GetValue(keyName, + "TestExpand2", "Default if TestExpand2 does not exist."); + Console::WriteLine( + "TestExpand2: {0}...", testExpand2->Substring(0, 40)); + Console::WriteLine( + "\r\nUse the registry editor to examine the key."); + Console::WriteLine("Press the Enter key to delete the key."); + Console::ReadLine(); + Registry::CurrentUser->DeleteSubKey(subKey); +} +// +// This code example produces output similar to the following: +// +// NoSuchName: Return this default if NoSuchName does not exist. +// (Default): 5280 +// TestInt64: 12345678901234 +// TestArray(0): One +// TestArray(1): Two +// TestArray(2): Three +// TestExpand: My path: %path% +// TestExpand2: My path: D:\Program Files\Microsoft.NET\... +// +// Use the registry editor to examine the key. +// Press the Enter key to delete the key. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp new file mode 100644 index 00000000000..d2c646822c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.OpenRemoteBaseKey/CPP/source.cpp @@ -0,0 +1,48 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Permissions; +using namespace Microsoft::Win32; + + +int main( int argc, char *argv[] ) +{ + RegistryKey ^ environmentKey; + + // Check that an argument was specified when the + // program was invoked. + if ( argc == 1 ) + { + Console::WriteLine( "Error: The name of the remote computer " + "must be specified as input on the command line." ); + return -1; + } + + try + { + + // Open HKEY_CURRENT_USER\Environment on a remote computer. + environmentKey = RegistryKey::OpenRemoteBaseKey( RegistryHive::CurrentUser, gcnew String(argv[ 1 ]) )->OpenSubKey( "Environment" ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "{0}: {1}", e->GetType()->Name, e->Message ); + return -1; + } + + + // Print the values. + Console::WriteLine( "\nThere are {0} values for {1}.", environmentKey->ValueCount.ToString(), environmentKey->Name ); + array^valueNames = environmentKey->GetValueNames(); + for ( int i = 0; i < environmentKey->ValueCount; i++ ) + { + Console::WriteLine( "{0,-20}: {1}", valueNames[ i ], environmentKey->GetValue( valueNames[ i ] )->ToString() ); + + } + + // Close the registry key. + environmentKey->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp new file mode 100644 index 00000000000..d7525ab162b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey.SetValue1/CPP/source.cpp @@ -0,0 +1,71 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +int main() +{ + + // Delete and recreate the test key. + Registry::CurrentUser->DeleteSubKey( "RegistrySetValueExample", false ); + RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( "RegistrySetValueExample" ); + + // Create name/value pairs. + // Numeric values that cannot be interpreted as DWord (int) values + // are stored as strings. + rk->SetValue( "LargeNumberValue1", (long)42 ); + rk->SetValue( "LargeNumberValue2", 42000000000 ); + rk->SetValue( "DWordValue", 42 ); + array^temp0 = {"One","Two","Three"}; + rk->SetValue( "MultipleStringValue", temp0 ); + array^temp1 = {10,43,44,45,14,255}; + rk->SetValue( "BinaryValue", temp1 ); + + // This overload of SetValue does not support expanding strings. Use + // the overload that allows you to specify RegistryValueKind. + rk->SetValue( "StringValue", "The path is %PATH%" ); + + // Display all the name/value pairs stored in the test key, with + // the registry data type in parentheses. + // + array^valueNames = rk->GetValueNames(); + System::Collections::IEnumerator^ myEnum = valueNames->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ s = safe_cast(myEnum->Current); + RegistryValueKind rvk = rk->GetValueKind( s ); + switch ( rvk ) + { + case RegistryValueKind::MultiString: + { + array^values = (array^)rk->GetValue( s ); + Console::Write( "\r\n {0} ({1}) = \"{2}\"", s, rvk, values[ 0 ] ); + for ( int i = 1; i < values->Length; i++ ) + { + Console::Write( ", \"{0}\"", values[ i ] ); + + } + Console::WriteLine(); + break; + } + case RegistryValueKind::Binary: + { + array^bytes = (array^)rk->GetValue( s ); + Console::Write( "\r\n {0} ({1}) = {2:X2}", s, rvk, bytes[ 0 ] ); + for ( int i = 1; i < bytes->Length; i++ ) + { + + // Display each byte as two hexadecimal digits. + Console::Write( " {0:X2}", bytes[ i ] ); + + } + Console::WriteLine(); + break; + } + default: + Console::WriteLine( "\r\n {0} ({1}) = {2}", s, rvk, rk->GetValue( s ) ); + break; + } + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp new file mode 100644 index 00000000000..e9f720004e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source.cpp @@ -0,0 +1,64 @@ + +// +using namespace System; +using namespace System::Security::Permissions; +using namespace Microsoft::Win32; + +int main() +{ + // Create a subkey named Test9999 under HKEY_CURRENT_USER. + RegistryKey ^ test9999 = Registry::CurrentUser->CreateSubKey( "Test9999" ); + + // Create two subkeys under HKEY_CURRENT_USER\Test9999. + test9999->CreateSubKey( "TestName" )->Close(); + RegistryKey ^ testSettings = test9999->CreateSubKey( "TestSettings" ); + + // Create data for the TestSettings subkey. + testSettings->SetValue( "Language", "French" ); + testSettings->SetValue( "Level", "Intermediate" ); + testSettings->SetValue( "ID", 123 ); + testSettings->Close(); + + // + // Print the information from the Test9999 subkey. + Console::WriteLine( "There are {0} subkeys under Test9999.", test9999->SubKeyCount.ToString() ); + array^subKeyNames = test9999->GetSubKeyNames(); + for ( int i = 0; i < subKeyNames->Length; i++ ) + { + RegistryKey ^ tempKey = test9999->OpenSubKey( subKeyNames[ i ] ); + Console::WriteLine( "\nThere are {0} values for {1}.", tempKey->ValueCount.ToString(), tempKey->Name ); + array^valueNames = tempKey->GetValueNames(); + for ( int j = 0; j < valueNames->Length; j++ ) + { + Console::WriteLine( "{0,-8}: {1}", valueNames[ j ], tempKey->GetValue( valueNames[ j ] )->ToString() ); + + } + } + // + + // + // Delete the ID value. + testSettings = test9999->OpenSubKey( "TestSettings", true ); + testSettings->DeleteValue( "id" ); + + // Verify the deletion. + Console::WriteLine( dynamic_cast(testSettings->GetValue( "id", "ID not found." )) ); + testSettings->Close(); + // + + // + // Delete or close the new subkey. + Console::Write( "\nDelete newly created registry key? (Y/N) " ); + if ( Char::ToUpper( Convert::ToChar( Console::Read() ) ) == 'Y' ) + { + Registry::CurrentUser->DeleteSubKeyTree( "Test9999" ); + Console::WriteLine( "\nRegistry key {0} deleted.", test9999->Name ); + } + else + { + Console::WriteLine( "\nRegistry key {0} closed.", test9999->ToString() ); + test9999->Close(); + } + // +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp new file mode 100644 index 00000000000..e13a94e5145 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryKey2/CPP/source2.cpp @@ -0,0 +1,34 @@ +// +using namespace System; +using namespace Microsoft::Win32; + +public ref class RegKeyDel +{ +public: + static void Main() + { + // Create a subkey named Test9999 under HKEY_CURRENT_USER. + RegistryKey^ test9999 = + Registry::CurrentUser->CreateSubKey("Test9999"); + // Create two subkeys under HKEY_CURRENT_USER\Test9999. The + // keys are disposed when execution exits the using statement. + RegistryKey^ testName = test9999->CreateSubKey("TestName"); + RegistryKey^ testSettings = test9999->CreateSubKey("TestSettings"); + + // Create data for the TestSettings subkey. + testSettings->SetValue("Language", "French"); + testSettings->SetValue("Level", "Intermediate"); + testSettings->SetValue("ID", 123); + + // delete the subkey "TestName" + test9999->DeleteSubKey("TestName"); + // delete everything under and including "Test9999" + Registry::CurrentUser->DeleteSubKeyTree("Test9999"); + } +}; + +int main() +{ + RegKeyDel::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp new file mode 100644 index 00000000000..3f19093fe47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Microsoft.Win32.RegistryValueKind/CPP/source.cpp @@ -0,0 +1,93 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +int main() +{ + + // Delete and recreate the test key. + Registry::CurrentUser->DeleteSubKey( "RegistryValueKindExample", false ); + RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( "RegistryValueKindExample" ); + + // Create name/value pairs. + // This overload supports QWord (long) values. + rk->SetValue( "QuadWordValue", 42, RegistryValueKind::QWord ); + + // The following SetValue calls have the same effect as using the + // SetValue overload that does not specify RegistryValueKind. + // + rk->SetValue( "DWordValue", 42, RegistryValueKind::DWord ); + rk->SetValue( "MultipleStringValue", gcnew array{ + "One","Two","Three" + }, RegistryValueKind::MultiString ); + rk->SetValue( "BinaryValue", gcnew array{ + 10,43,44,45,14,255 + }, RegistryValueKind::Binary ); + rk->SetValue( "StringValue", "The path is %PATH%", RegistryValueKind::String ); + + // This overload supports setting expandable string values. Compare + // the output from this value with the previous string value. + rk->SetValue( "ExpandedStringValue", "The path is %PATH%", RegistryValueKind::ExpandString ); + + // Display all the name/value pairs stored in the test key, with the + // registry data type in parentheses. + // + array^valueNames = rk->GetValueNames(); + System::Collections::IEnumerator^ myEnum = valueNames->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ s = safe_cast(myEnum->Current); + RegistryValueKind rvk = rk->GetValueKind( s ); + switch ( rvk ) + { + case RegistryValueKind::MultiString: + { + array^values = (array^)rk->GetValue( s ); + Console::Write( "\r\n {0} ({1}) =", s, rvk ); + for ( int i = 0; i < values->Length; i++ ) + { + if (i != 0) Console::Write(","); + Console::Write( " \"{0}\"", values[ i ] ); + + } + Console::WriteLine(); + break; + } + case RegistryValueKind::Binary: + { + array^bytes = (array^)rk->GetValue( s ); + Console::Write( "\r\n {0} ({1}) =", s, rvk ); + for ( int i = 0; i < bytes->Length; i++ ) + { + + // Display each byte as two hexadecimal digits. + Console::Write( " {0:X2}", bytes[ i ] ); + + } + Console::WriteLine(); + break; + } + default: + Console::WriteLine( "\r\n {0} ({1}) = {2}", s, rvk, rk->GetValue( s ) ); + break; + } + } +} +/* + +This code example produces the following output: + QuadWordValue (QWord) = 42 + + DWordValue (DWord) = 42 + + MultipleStringValue (MultiString) =, "One", "Two", "Three" + + BinaryValue (Binary) = 0A 2B 2C 2D 0E FF + + StringValue (String) = The path is %PATH% + + ExpandedStringValue (ExpandString) = The path is C:\Program Files\Microsoft.NET\SDK\v2.0\Bin; + [***The remainder of this output is omitted.***] + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp b/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp new file mode 100644 index 00000000000..5f170354fb3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MissingMethodException/cpp/MissingMethodException.cpp @@ -0,0 +1,72 @@ +//Types:System.MissingMethodException +//Types:System.MissingMemberException +//Types:System.MissingFieldException +// +using namespace System; +using namespace System::Reflection; + +ref class App +{ +}; + +int main() +{ + // + try + { + // Attempt to call a static DoSomething method defined in the App class. + // However, because the App class does not define this method, + // a MissingMethodException is thrown. + App::typeid->InvokeMember("DoSomething", BindingFlags::Static | + BindingFlags::InvokeMethod, nullptr, nullptr, nullptr); + } + catch (MissingMethodException^ ex) + { + // Show the user that the DoSomething method cannot be called. + Console::WriteLine("Unable to call the DoSomething method: {0}", + ex->Message); + } + // + + // + try + { + // Attempt to access a static AField field defined in the App class. + // However, because the App class does not define this field, + // a MissingFieldException is thrown. + App::typeid->InvokeMember("AField", BindingFlags::Static | + BindingFlags::SetField, nullptr, nullptr, gcnew array{5}); + } + catch (MissingFieldException^ ex) + { + // Show the user that the AField field cannot be accessed. + Console::WriteLine("Unable to access the AField field: {0}", + ex->Message); + } + // + + // + try + { + // Attempt to access a static AnotherField field defined in the App class. + // However, because the App class does not define this field, + // a MissingFieldException is thrown. + App::typeid->InvokeMember("AnotherField", BindingFlags::Static | + BindingFlags::GetField, nullptr, nullptr, nullptr); + } + catch (MissingMemberException^ ex) + { + // Notice that this code is catching MissingMemberException which is the + // base class of MissingMethodException and MissingFieldException. + // Show the user that the AnotherField field cannot be accessed. + Console::WriteLine("Unable to access the AnotherField field: {0}", + ex->Message); + } + // +} +// This code produces the following output. +// +// Unable to call the DoSomething method: Method 'App.DoSomething' not found. +// Unable to access the AField field: Field 'App.AField' not found. +// Unable to access the AnotherField field: Field 'App.AnotherField' not found. +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp new file mode 100644 index 00000000000..f498738331b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_Class/CPP/modulebuilder.cpp @@ -0,0 +1,80 @@ + +// System.Reflection.Emit.ModuleBuilder +/* +The following example demonstrates the 'ModuleBuilder' class. +A dynamic assembly with a module in it is created in 'CodeGenerator' class. +A run time class having a method and a field is created using the 'ModuleBuilder' +class and created class is called from the 'TestClass'. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +public ref class CodeGenerator +{ +private: + AssemblyBuilder^ myAssemblyBuilder; + +public: + CodeGenerator() + { + // Get the current application domain for the current thread. + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define a dynamic assembly in the current application domain. + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Define a dynamic module in this assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); + + // Define a runtime class with specified name and attributes. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "TempClass", TypeAttributes::Public ); + + // Add 'Greeting' field to the class, with the specified attribute and type. + FieldBuilder^ greetingField = myTypeBuilder->DefineField( "Greeting", String::typeid, FieldAttributes::Public ); + array^myMethodArgs = {String::typeid}; + + // Add 'MyMethod' method to the class, with the specified attribute and signature. + MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "MyMethod", MethodAttributes::Public, CallingConventions::Standard, nullptr, myMethodArgs ); + ILGenerator^ methodIL = myMethod->GetILGenerator(); + methodIL->EmitWriteLine( "In the method..." ); + methodIL->Emit( OpCodes::Ldarg_0 ); + methodIL->Emit( OpCodes::Ldarg_1 ); + methodIL->Emit( OpCodes::Stfld, greetingField ); + methodIL->Emit( OpCodes::Ret ); + myTypeBuilder->CreateType(); + } + + property AssemblyBuilder^ MyAssembly + { + AssemblyBuilder^ get() + { + return this->myAssemblyBuilder; + } + } +}; + +int main() +{ + CodeGenerator^ myCodeGenerator = gcnew CodeGenerator; + + // Get the assembly builder for 'myCodeGenerator' object. + AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyAssembly; + + // Get the module builder for the above assembly builder object . + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->GetDynamicModule( "TempModule" ); + Console::WriteLine( "The fully qualified name and path to this module is :{0}", myModuleBuilder->FullyQualifiedName ); + Type^ myType = myModuleBuilder->GetType( "TempClass" ); + MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" ); + + // Get the token used to identify the method within this module. + MethodToken myMethodToken = myModuleBuilder->GetMethodToken( myMethodInfo ); + Console::WriteLine( "Token used to identify the method of 'myType'" + " within the module is {0:x}", myMethodToken.Token ); + array^args = {"Hello."}; + Object^ myObject = Activator::CreateInstance( myType, nullptr, nullptr ); + myMethodInfo->Invoke( myObject, args ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp new file mode 100644 index 00000000000..3979e2356e6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_CreateGlobalFunctions/CPP/modulebuilder_createglobalfunctions.cpp @@ -0,0 +1,79 @@ +// System.Reflection.Emit.ModuleBuilder.DefineGlobalMethod(String,MethodAttributes,Type,Type[]) +// System.Reflection.Emit.ModuleBuilder.CreateGlobalFunctions + +/* +The following example demonstrates the 'DefineGlobalMethod(String,MethodAttributes,Type,Type[])' +and 'CreateGlobalFunctions' methods of 'ModuleBuilder' class. +A dynamic assembly with a module in it is created in 'CodeGenerator' class. Then a global method +is created in the module using the 'DefineGlobalMethod' method. The global method is called from +the 'CallerClass'. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class CodeGenerator +{ +private: + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + CodeGenerator() + { + myModuleBuilder = nullptr; + myAssemblyBuilder = nullptr; + + // + // + AppDomain^ currentDomain; + AssemblyName^ myAssemblyName; + MethodBuilder^ myMethodBuilder = nullptr; + ILGenerator^ myILGenerator; + + // Get the current application domain for the current thread. + currentDomain = AppDomain::CurrentDomain; + myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define a dynamic assembly in the 'currentDomain'. + myAssemblyBuilder = + currentDomain->DefineDynamicAssembly( + myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Define a dynamic module in "TempAssembly" assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); + + // Define a global method in the 'TempModule' module. + myMethodBuilder = myModuleBuilder->DefineGlobalMethod( + "MyMethod1", (MethodAttributes)(MethodAttributes::Static | MethodAttributes::Public), + nullptr, nullptr ); + myILGenerator = myMethodBuilder->GetILGenerator(); + myILGenerator->EmitWriteLine( "Hello World from global method." ); + myILGenerator->Emit( OpCodes::Ret ); + + // Fix up the 'TempModule' module . + myModuleBuilder->CreateGlobalFunctions(); + // + // + } + + property AssemblyBuilder^ MyAssembly + { + AssemblyBuilder^ get() + { + return this->myAssemblyBuilder; + } + } +}; + +int main() +{ + CodeGenerator^ myGenerator = gcnew CodeGenerator; + AssemblyBuilder^ myAssembly = myGenerator->MyAssembly; + ModuleBuilder^ myBuilder = myAssembly->GetDynamicModule( "TempModule" ); + Console::WriteLine( "Invoking the global method..." ); + MethodInfo^ myMethodInfo = myBuilder->GetMethod( "MyMethod1" ); + myMethodInfo->Invoke( nullptr, nullptr ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp new file mode 100644 index 00000000000..d74a7ca473d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineDocument/CPP/modulebuilder_definedocument.cpp @@ -0,0 +1,49 @@ + +// System::Reflection::Emit::ModuleBuilder.DefineDocument +/* +The following example demonstrates the 'DefineDocument' method +of 'ModuleBuilder' class. +A dynamic assembly with a module in it is created in 'CodeGenerator' class. +It gets the Object* representing the defined document using the method +'DefineDocument'. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Resources; +using namespace System::Diagnostics::SymbolStore; +public ref class CodeGenerator +{ +private: + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + CodeGenerator() + { + + // Get the current application domain for the current thread. + AppDomain^ currentDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define a dynamic assembly in the current domain. + myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Define a dynamic module in S"TempAssembly" assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "Resource.mod", true ); + + // Define a document for source.on 'TempModule' module. + ISymbolDocumentWriter^ myDocument = myModuleBuilder->DefineDocument( "RTAsm.il", SymDocumentType::Text, SymLanguageType::ILAssembly, SymLanguageVendor::Microsoft ); + Console::WriteLine( "The object representing the defined document is: {0}", myDocument ); + } + +}; + +int main() +{ + CodeGenerator^ myGenerator = gcnew CodeGenerator; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp new file mode 100644 index 00000000000..b40b5fe22cc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineEnum/CPP/modulebuilder_defineenum.cpp @@ -0,0 +1,46 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +void main() +{ + // Get the current application domain for the current thread. + AppDomain^ currentDomain = AppDomain::CurrentDomain; + + // Create a dynamic assembly in the current application domain, + // and allow it to be executed and saved to disk. + AssemblyName^ aName = gcnew AssemblyName("TempAssembly"); + AssemblyBuilder^ ab = currentDomain->DefineDynamicAssembly( + aName, AssemblyBuilderAccess::RunAndSave); + + // Define a dynamic module in "TempAssembly" assembly. For a single- + // module assembly, the module has the same name as the assembly. + ModuleBuilder^ mb = + ab->DefineDynamicModule(aName->Name, aName->Name + ".dll"); + + // Define a public enumeration with the name "Elevation" and an + // underlying type of Int32. + EnumBuilder^ eb = + mb->DefineEnum("Elevation", TypeAttributes::Public, int::typeid); + + // Define two members, "High" and "Low". + eb->DefineLiteral("Low", (Object^) 0); + eb->DefineLiteral("High", 1); + + // Create the type and save the assembly. + Type^ finished = eb->CreateType(); + ab->Save(aName->Name + ".dll"); + + for each (Object^ o in Enum::GetValues(finished)) + { + Console::WriteLine("{0}.{1} = {2}", finished, o, (int)o); + } +} + +/* This code example produces the following output: + +Elevation.Low = 0 +Elevation.High = 1 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp new file mode 100644 index 00000000000..d87da81e582 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineInitializedData/CPP/modulebuilder_defineinitializeddata.cpp @@ -0,0 +1,67 @@ +// System.Reflection.Emit.ModuleBuilder.DefineInitializedData + +/* +The following example demonstrates the 'DefineInitializedData' method of +'ModuleBuilder' class. +A dynamic assembly with a module in it is created in 'CodeGenerator' class. +A initialized data field is created using 'DefineInitializedData' +method for creating the initialized data. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class CodeGenerator +{ +private: + ModuleBuilder^ myModuleBuilder; + AssemblyBuilder^ myAssemblyBuilder; + +public: + CodeGenerator() + { + // + AppDomain^ currentDomain; + AssemblyName^ myAssemblyName; + + // Get the current application domain for the current thread. + currentDomain = AppDomain::CurrentDomain; + myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define a dynamic assembly in the 'currentDomain'. + myAssemblyBuilder = + currentDomain->DefineDynamicAssembly( + myAssemblyName, AssemblyBuilderAccess::Run ); + + // Define a dynamic module in "TempAssembly" assembly. + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule" ); + + // Define the initialized data field in the .sdata section of the PE file. + array^ temp0 = {01,00,01}; + FieldBuilder^ myFieldBuilder = + myModuleBuilder->DefineInitializedData( "MyField", temp0, + (FieldAttributes)(FieldAttributes::Static | FieldAttributes::Public) ); + myModuleBuilder->CreateGlobalFunctions(); + // + } + + property AssemblyBuilder^ MyAssembly + { + AssemblyBuilder^ get() + { + return this->myAssemblyBuilder; + } + } +}; + +int main() +{ + CodeGenerator^ myGenerator = gcnew CodeGenerator; + AssemblyBuilder^ myAssembly = myGenerator->MyAssembly; + ModuleBuilder^ myBuilder = myAssembly->GetDynamicModule( "TempModule" ); + FieldInfo^ myInfo = myBuilder->GetField( "MyField" ); + Console::WriteLine( "The name of the initialized data field is :" + myInfo->Name ); + Console::WriteLine( "The object having the field value is :" + myInfo->GetValue( myBuilder ) ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp new file mode 100644 index 00000000000..3e81dcf0345 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefinePInvokeMethod1/CPP/modulebuilder_definepinvokemethod1.cpp @@ -0,0 +1,68 @@ +// System.Reflection.Emit.ModuleBuilder.DefinePInvokeMethod(String,String,MethodAttributes, +// CallingConventions,Type,Type[],CallingConvention,CharSet) +/* + The following example demonstrates that DefinePInvokeMethod doesn't work unless you + add a DLLImportAttribute...which you can do just as well with DefineGlobalMethod. + +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; + +const int MB_RETRYCANCEL = 5; + +void main() +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName("TempAssembly"); + + // Define a dynamic assembly in the current application domain. + AssemblyBuilder^ myAssemblyBuilder = + AppDomain::CurrentDomain->DefineDynamicAssembly( + myAssemblyName, AssemblyBuilderAccess::Run); + + // Define a dynamic module in "TempAssembly" assembly. + ModuleBuilder^ myModuleBuilder = + myAssemblyBuilder->DefineDynamicModule("TempModule"); + + array^ paramTypes = + { int::typeid, String::typeid, String::typeid, int::typeid }; + + // Define a PInvoke method. + MethodBuilder^ piMethodBuilder = myModuleBuilder->DefinePInvokeMethod( + "MessageBoxA", + "user32.dll", + MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::PinvokeImpl, + CallingConventions::Standard, + int::typeid, + paramTypes, + CallingConvention::Winapi, + CharSet::Ansi); + + // Add PreserveSig to the method implementation flags. NOTE: If this line + // is commented out, the return value will be zero when the method is + // invoked. + piMethodBuilder->SetImplementationFlags( + piMethodBuilder->GetMethodImplementationFlags() | MethodImplAttributes::PreserveSig); + + // Create global methods. + myModuleBuilder->CreateGlobalFunctions(); + + // Arguments for calling the method. + array^ arguments = + { (Object^)(int) 0, "Hello World", "Title", MB_RETRYCANCEL }; + + MethodInfo^ pinvokeMethod = myModuleBuilder->GetMethod("MessageBoxA"); + Console::WriteLine("Testing module-level PInvoke method created with DefinePInvokeMethod..."); + Console::WriteLine("Message box returned: {0}", + pinvokeMethod->Invoke(nullptr, arguments)); +}; + + +/* This code example produces input similar to the following: + +Testing module-level PInvoke method created with DefinePInvokeMethod... +Message box returned: 4 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp new file mode 100644 index 00000000000..8cbc472c421 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource1/CPP/modulebuilder_defineresource1.cpp @@ -0,0 +1,50 @@ + +// System::Reflection::Emit::ModuleBuilder.DefineResource(String, String) +/* +The following example demonstrates the 'DefineResource(String, String)' method +of 'ModuleBuilder' class. +A dynamic assembly with a module in it is created in 'CodeGenerator' class. +Then a managed resource is defined in the module using the 'DefineResource' +method. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Resources; +public ref class CodeGenerator +{ +public: + CodeGenerator() + { + + // Get the current application domain for the current thread. + AppDomain^ currentDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define 'TempAssembly' assembly in the current application domain. + AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Define 'TempModule' module in 'TempAssembly' assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "TempModule.netmodule", true ); + + // Define the managed embedded resource, 'MyResource' in 'TempModule'. + IResourceWriter^ myResourceWriter = myModuleBuilder->DefineResource( "MyResource.resource", "Description" ); + + // Add resources to the resource writer. + myResourceWriter->AddResource( "String 1", "First String" ); + myResourceWriter->AddResource( "String 2", "Second String" ); + myResourceWriter->AddResource( "String 3", "Third String" ); + myAssemblyBuilder->Save( "MyAssembly.dll" ); + } + +}; + +int main() +{ + CodeGenerator^ myGenerator = gcnew CodeGenerator; + Console::WriteLine( "A resource named 'MyResource.resource' has been created and can be viewed in the 'MyAssembly.dll'" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp new file mode 100644 index 00000000000..5caa523989d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_DefineResource2/CPP/modulebuilder_defineresource2.cpp @@ -0,0 +1,50 @@ + +// System::Reflection::Emit::ModuleBuilder.DefineResource(String, String, ResourceAttributes) +/* +The following example demonstrates the 'DefineResource(String, String, ResourceAttributes)' +method of 'ModuleBuilder' class. +A dynamic assembly with a module in it is created in 'CodeGenerator' class. +Then a managed resource is defined in the module using the 'DefineResource' method. +*/ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Resources; +public ref class CodeGenerator +{ +public: + CodeGenerator() + { + + // Get the current application domain for the current thread. + AppDomain^ currentDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define 'TempAssembly' assembly in the current application domain. + AssemblyBuilder^ myAssemblyBuilder = currentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Define 'TempModule' module in 'TempAssembly' assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "TempModule", "TempModule.netmodule", true ); + + // Define the managed embedded resource, 'MyResource' in 'TempModule' + // with the specified attribute. + IResourceWriter^ writer = myModuleBuilder->DefineResource( "MyResource.resource", "Description", ResourceAttributes::Public ); + + // Add resources to the resource writer. + writer->AddResource( "String 1", "First String" ); + writer->AddResource( "String 2", "Second String" ); + writer->AddResource( "String 3", "Third String" ); + myAssemblyBuilder->Save( "MyAssembly.dll" ); + } + +}; + +int main() +{ + CodeGenerator^ myGenerator = gcnew CodeGenerator; + Console::WriteLine( "A resource named 'MyResource::resource' has been created and can be viewed in the 'MyAssembly.dll'" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp new file mode 100644 index 00000000000..574e5fa1686 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ModuleBuilder_GetArrayMethod/CPP/modulebuilder_getarraymethod.cpp @@ -0,0 +1,110 @@ +// System.Reflection.Emit.ModuleBuilder.GetArrayMethod +// System.Reflection.Emit.ModuleBuilder.GetArrayMethodToken + +/* +The following example demonstrates 'GetArrayMethod' and 'GetArrayMethodToken' +methods of 'ModuleBuilder' class. +A dynamic assembly with a module having a runtime class, 'TempClass' is created. +This class defines a method, 'SortArray', which sorts the elements of the array +passed to it. The 'GetArrayMethod' method is used to obtain the 'MethodInfo' object +corresponding to the 'Sort' method of the 'Array'. The token used to identify the 'Sort' +method in dynamic module is displayed using 'GetArrayMethodToken' method. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class CodeGenerator +{ +private: + AssemblyBuilder^ myAssemblyBuilder; + +public: + CodeGenerator() + { + AppDomain^ myCurrentDomain = AppDomain::CurrentDomain; + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "TempAssembly"; + + // Define a dynamic assembly in the current application domain. + myAssemblyBuilder = myCurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + +// +// + // Define a dynamic module in "TempAssembly" assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder-> + DefineDynamicModule( "TempModule" ); + + // Define a runtime class with specified name and attributes. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( + "TempClass", TypeAttributes::Public ); + array^ paramArray = { Array::typeid }; + // Add 'SortArray' method to the class, with the given signature. + MethodBuilder^ myMethod = myTypeBuilder->DefineMethod( "SortArray", + MethodAttributes::Public, Array::typeid, paramArray ); + + array^ myArrayClass = gcnew array( 1 ); + array^ parameterTypes = { Array::typeid }; + // Get the 'MethodInfo' object corresponding to 'Sort' method of 'Array' class. + MethodInfo^ myMethodInfo = myModuleBuilder->GetArrayMethod( + myArrayClass->GetType(), "Sort", CallingConventions::Standard, + nullptr, parameterTypes ); + + // Get the token corresponding to 'Sort' method of 'Array' class. + MethodToken myMethodToken = myModuleBuilder->GetArrayMethodToken( + myArrayClass->GetType(), "Sort", CallingConventions::Standard, + nullptr, parameterTypes ); + Console::WriteLine( "Token used by module to identify the 'Sort' method" + + " of 'Array' class is : {0:x} ", myMethodToken.Token ); + + ILGenerator^ methodIL = myMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldarg_1 ); + methodIL->Emit( OpCodes::Call, myMethodInfo ); + methodIL->Emit( OpCodes::Ldarg_1 ); + methodIL->Emit( OpCodes::Ret ); + + // Complete the creation of type. + myTypeBuilder->CreateType(); + // + // + } + + property AssemblyBuilder^ MyBuilder + { + AssemblyBuilder^ get() + { + return this->myAssemblyBuilder; + } + } +}; + +int main() +{ + CodeGenerator^ myCodeGenerator = gcnew CodeGenerator; + AssemblyBuilder^ myAssemblyBuilder = myCodeGenerator->MyBuilder; + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder-> + GetDynamicModule( "TempModule" ); + Type^ myType = myModuleBuilder->GetType( "TempClass" ); + Object^ myObject = Activator::CreateInstance( myType ); + MethodInfo^ sortArray = myType->GetMethod( "SortArray" ); + if ( nullptr != sortArray ) + { + array^ arrayToSort = {"I","am","not","sorted"}; + Console::WriteLine( "Array elements before sorting " ); + for ( int i = 0; i < arrayToSort->Length; i++ ) + { + Console::WriteLine( "Array element {0} : {1} ", i, arrayToSort[ i ] ); + } + array^arguments = {arrayToSort}; + Console::WriteLine( "Invoking our dynamically " + + "created SortArray method..." ); + Object^ myOutput = sortArray->Invoke( myObject, arguments ); + array^ mySortedArray = ( array^ )myOutput; + Console::WriteLine( "Array elements after sorting " ); + for ( int i = 0; i < mySortedArray->Length; i++ ) + { + Console::WriteLine( "Array element {0} : {1} ", i, mySortedArray[ i ] ); + } + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp b/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp new file mode 100644 index 00000000000..b45d3fbc13a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/MonitorExmpl2/CPP/monitor2.cpp @@ -0,0 +1,331 @@ +// +#using + +using namespace System; +using namespace System::Threading; +using namespace System::Collections::Generic; +using namespace System::Text; + +generic public ref class SafeQueue +{ +private: + // + // + // A queue that is protected by Monitor. + Queue^ m_inputQueue; + // + +public: + SafeQueue() + { + m_inputQueue = gcnew Queue(); + }; + + // Lock the queue and add an element. + void Enqueue(T qValue) + { + // Request the lock, and block until it is obtained. + Monitor::Enter(m_inputQueue); + try + { + // When the lock is obtained, add an element. + m_inputQueue->Enqueue(qValue); + } + finally + { + // Ensure that the lock is released. + Monitor::Exit(m_inputQueue); + } + }; + // + + // + // Try to add an element to the queue: Add the element to the queue + // only if the lock is immediately available. + bool TryEnqueue(T qValue) + { + // Request the lock. + if (Monitor::TryEnter(m_inputQueue)) + { + try + { + m_inputQueue->Enqueue(qValue); + } + finally + { + // Ensure that the lock is released. + Monitor::Exit(m_inputQueue); + } + return true; + } + else + { + return false; + } + }; + // + + // + // Try to add an element to the queue: Add the element to the queue + // only if the lock becomes available during the specified time + // interval. + bool TryEnqueue(T qValue, int waitTime) + { + // Request the lock. + if (Monitor::TryEnter(m_inputQueue, waitTime)) + { + try + { + m_inputQueue->Enqueue(qValue); + } + finally + { + // Ensure that the lock is released. + Monitor::Exit(m_inputQueue); + } + return true; + } + else + { + return false; + } + }; + // + + // Lock the queue and dequeue an element. + T Dequeue() + { + T retval; + + // Request the lock, and block until it is obtained. + Monitor::Enter(m_inputQueue); + try + { + // When the lock is obtained, dequeue an element. + retval = m_inputQueue->Dequeue(); + } + finally + { + // Ensure that the lock is released. + Monitor::Exit(m_inputQueue); + } + + return retval; + }; + + // Delete all elements that equal the given object. + int Remove(T qValue) + { + int removedCt = 0; + + // Wait until the lock is available and lock the queue. + Monitor::Enter(m_inputQueue); + try + { + int counter = m_inputQueue->Count; + while (counter > 0) + // Check each element. + { + T elem = m_inputQueue->Dequeue(); + if (!elem->Equals(qValue)) + { + m_inputQueue->Enqueue(elem); + } + else + { + // Keep a count of items removed. + removedCt += 1; + } + counter = counter - 1; + } + } + finally + { + // Ensure that the lock is released. + Monitor::Exit(m_inputQueue); + } + + return removedCt; + }; + + // Print all queue elements. + String^ PrintAllElements() + { + StringBuilder^ output = gcnew StringBuilder(); + + // Lock the queue. + Monitor::Enter(m_inputQueue); + try + { + for each ( T elem in m_inputQueue ) + { + // Print the next element. + output->AppendLine(elem->ToString()); + } + } + finally + { + // Ensure that the lock is released. + Monitor::Exit(m_inputQueue); + } + + return output->ToString(); + }; +}; + +public ref class Example +{ +private: + static SafeQueue^ q = gcnew SafeQueue(); + static int threadsRunning = 0; + static array^>^ results = gcnew array^>(3); + + static void ThreadProc(Object^ state) + { + DateTime finish = DateTime::Now.AddSeconds(10); + Random^ rand = gcnew Random(); + array^ result = { 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + int threadNum = (int) state; + + while (DateTime::Now < finish) + + { + int what = rand->Next(250); + int how = rand->Next(100); + + if (how < 16) + { + q->Enqueue(what); + result[(int)ThreadResultIndex::EnqueueCt] += 1; + } + else if (how < 32) + { + if (q->TryEnqueue(what)) + { + result[(int)ThreadResultIndex::TryEnqueueSucceedCt] += 1; + } + else + { + result[(int)ThreadResultIndex::TryEnqueueFailCt] += 1; + } + } + else if (how < 48) + { + // Even a very small wait significantly increases the success + // rate of the conditional enqueue operation. + if (q->TryEnqueue(what, 10)) + { + result[(int)ThreadResultIndex::TryEnqueueWaitSucceedCt] += 1; + } + else + { + result[(int)ThreadResultIndex::TryEnqueueWaitFailCt] += 1; + } + } + else if (how < 96) + { + result[(int)ThreadResultIndex::DequeueCt] += 1; + try + { + q->Dequeue(); + } + catch (Exception^ ex) + { + result[(int)ThreadResultIndex::DequeueExCt] += 1; + } + } + else + { + result[(int)ThreadResultIndex::RemoveCt] += 1; + result[(int)ThreadResultIndex::RemovedCt] += q->Remove(what); + } + } + + results[threadNum] = result; + + if (0 == Interlocked::Decrement(threadsRunning)) + { + StringBuilder^ sb = gcnew StringBuilder( + " Thread 1 Thread 2 Thread 3 Total\n"); + + for (int row = 0; row < 9; row++) + { + int total = 0; + sb->Append(titles[row]); + + for(int col = 0; col < 3; col++) + { + sb->Append(String::Format("{0,9}", results[col][row])); + total += results[col][row]; + } + + sb->AppendLine(String::Format("{0,9}", total)); + } + + Console::WriteLine(sb->ToString()); + } + }; + + static array^ titles = { + "Enqueue ", + "TryEnqueue succeeded ", + "TryEnqueue failed ", + "TryEnqueue(T, wait) succeeded ", + "TryEnqueue(T, wait) failed ", + "Dequeue attempts ", + "Dequeue exceptions ", + "Remove operations ", + "Queue elements removed "}; + + enum class ThreadResultIndex + { + EnqueueCt, + TryEnqueueSucceedCt, + TryEnqueueFailCt, + TryEnqueueWaitSucceedCt, + TryEnqueueWaitFailCt, + DequeueCt, + DequeueExCt, + RemoveCt, + RemovedCt + }; + +public: + static void Demo() + { + Console::WriteLine("Working..."); + + for(int i = 0; i < 3; i++) + { + Thread^ t = gcnew Thread(gcnew ParameterizedThreadStart(Example::ThreadProc)); + t->Start(i); + Interlocked::Increment(threadsRunning); + } + }; +}; + +void main() +{ + Example::Demo(); +} + + +/* This example produces output similar to the following: + +Working... + Thread 1 Thread 2 Thread 3 Total +Enqueue 274718 513514 337895 1126127 +TryEnqueue succeeded 274502 513516 337480 1125498 +TryEnqueue failed 119 235 141 495 +TryEnqueue(T, wait) succeeded 274552 513116 338532 1126200 +TryEnqueue(T, wait) failed 0 1 0 1 +Dequeue attempts 824038 1541866 1015006 3380910 +Dequeue exceptions 12828 23416 14799 51043 +Remove operations 68746 128218 84306 281270 +Queue elements removed 11464 22024 14470 47958 +Queue elements removed 2921 4690 2982 10593 + */ +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp b/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp new file mode 100644 index 00000000000..0017618eb8d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Multicast Delegate Introduction/CPP/delegatestring.cpp @@ -0,0 +1,149 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +ref class StringContainer +{ +private: + // A generic list object that holds the strings. + List^ container = gcnew List; + +public: + // Define a delegate to handle string display. + delegate void CheckAndDisplayDelegate(String^ str); + + // A method that adds more strings to the collection. + void AddString(String^ str) + { + container->Add(str); + } + + // Iterate through the strings and invoke the method(s) that the delegate points to. + void DisplayAllQualified(CheckAndDisplayDelegate^ displayDelegate) + { + for each (String^ str in container) + displayDelegate(str); +// System::Collections::IEnumerator^ myEnum = container->GetEnumerator(); +// while ( myEnum->MoveNext() ) +// { +// String^ str = safe_cast(myEnum->Current); +// displayDelegate(str); +// } + } +}; + +//end of class StringContainer +// This class contains a few sample methods +ref class StringFuncs +{ +public: + + // This method prints a String* that it is passed if the String* starts with a vowel + static void ConStart(String^ str) + { + if ( !(str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') ) + Console::WriteLine( str ); + } + + // This method prints a String* that it is passed if the String* starts with a consonant + static void VowelStart( String^ str ) + { + if ( (str[ 0 ] == 'a' || str[ 0 ] == 'e' || str[ 0 ] == 'i' || str[ 0 ] == 'o' || str[ 0 ] == 'u') ) + Console::WriteLine( str ); + } +}; + +// This function demonstrates using Delegates, including using the Remove and +// Combine methods to create and modify delegate combinations. +int main() +{ + // Declare the StringContainer class and add some strings + StringContainer^ container = gcnew StringContainer; + container->AddString( "This" ); + container->AddString( "is" ); + container->AddString( "a" ); + container->AddString( "multicast" ); + container->AddString( "delegate" ); + container->AddString( "example" ); + +// RETURN HERE. + // Create two delegates individually using different methods + StringContainer::CheckAndDisplayDelegate^ conStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::ConStart ); + StringContainer::CheckAndDisplayDelegate^ vowelStart = gcnew StringContainer::CheckAndDisplayDelegate( StringFuncs::VowelStart ); + + // Get the list of all delegates assigned to this MulticastDelegate instance. + array^ delegateList = conStart->GetInvocationList(); + Console::WriteLine("conStart contains {0} delegate(s).", delegateList->Length); + delegateList = vowelStart->GetInvocationList(); + Console::WriteLine("vowelStart contains {0} delegate(s).\n", delegateList->Length ); + + // Determine whether the delegates are System::Multicast delegates + if ( dynamic_cast(conStart) && dynamic_cast(vowelStart) ) + { + Console::WriteLine("conStart and vowelStart are derived from MulticastDelegate.\n"); + } + + // Execute the two delegates. + Console::WriteLine("Executing the conStart delegate:" ); + container->DisplayAllQualified(conStart); + Console::WriteLine(); + Console::WriteLine("Executing the vowelStart delegate:" ); + container->DisplayAllQualified(vowelStart); + + // Create a new MulticastDelegate and call Combine to add two delegates. + StringContainer::CheckAndDisplayDelegate^ multipleDelegates = + dynamic_cast(Delegate::Combine(conStart, vowelStart)); + + // How many delegates does multipleDelegates contain? + delegateList = multipleDelegates->GetInvocationList(); + Console::WriteLine("\nmultipleDelegates contains {0} delegates.\n", + delegateList->Length ); + + // // Pass this multicast delegate to DisplayAllQualified. + Console::WriteLine("Executing the multipleDelegate delegate."); + container->DisplayAllQualified(multipleDelegates); + // Call remove and combine to change the contained delegates. + multipleDelegates = dynamic_cast + (Delegate::Remove(multipleDelegates, vowelStart)); + multipleDelegates = dynamic_cast + (Delegate::Combine(multipleDelegates, conStart)); + + // Pass multipleDelegates to DisplayAllQualified again. + Console::WriteLine("\nExecuting the multipleDelegate delegate with two conStart delegates:"); + container->DisplayAllQualified(multipleDelegates); +} +// The example displays the following output: +// conStart contains 1 delegate(s). +// vowelStart contains 1 delegate(s). +// +// conStart and vowelStart are derived from MulticastDelegate. +// +// Executing the conStart delegate: +// This +// multicast +// delegate +// +// Executing the vowelStart delegate: +// is +// a +// example +// +// +// multipleDelegates contains 2 delegates. +// +// Executing the multipleDelegate delegate. +// This +// is +// a +// multicast +// delegate +// example +// +// Executing the multipleDelegate delegate with two conStart delegates: +// This +// This +// multicast +// multicast +// delegate +// delegate +// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp new file mode 100644 index 00000000000..4836a5745f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/NumberDecimalDigits/CPP/numberdecimaldigits.cpp @@ -0,0 +1,27 @@ + +// The following code example demonstrates the effect of changing the NumberDecimalDigits property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a negative value with the default number of decimal digits (2). + Int64 myInt = -1234; + Console::WriteLine( myInt.ToString( "N", nfi ) ); + + // Displays the same value with four decimal digits. + nfi->NumberDecimalDigits = 4; + Console::WriteLine( myInt.ToString( "N", nfi ) ); +} + +/* +This code produces the following output. +-1, 234.00 +-1, 234.0000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp new file mode 100644 index 00000000000..3314e9eab5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/NumberDecimalSeparator/CPP/numberdecimalseparator.cpp @@ -0,0 +1,28 @@ + +// The following code example demonstrates the effect of changing the +// NumberDecimalSeparator property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S"."). + Int64 myInt = 123456789; + Console::WriteLine( myInt.ToString( "N", nfi ) ); + + // Displays the same value with a blank as the separator. + nfi->NumberDecimalSeparator = " "; + Console::WriteLine( myInt.ToString( "N", nfi ) ); +} + +/* +This code produces the following output. +123, 456, 789.00 +123, 456, 789 00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp b/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp new file mode 100644 index 00000000000..8211f6d47a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/NumberFormatInfo/cpp/NumberFormatInfo.cpp @@ -0,0 +1,47 @@ +//Types:System.Globalization.NumberFormatInfo +// +using namespace System; +using namespace System::Globalization; +using namespace System::Text; + +int main() +{ + StringBuilder^ builder = gcnew StringBuilder(); + + // Loop through all the specific cultures known to the CLR. + for each(CultureInfo^ culture in + CultureInfo::GetCultures (CultureTypes::SpecificCultures)) + { + // Only show the currency symbols for cultures + // that speak English. + if (culture->TwoLetterISOLanguageName == "en") + { + // + // Display the culture name and currency symbol. + NumberFormatInfo^ numberFormat = culture->NumberFormat; + builder->AppendFormat("The currency symbol for '{0}'"+ + "is '{1}'",culture->DisplayName, + numberFormat->CurrencySymbol); + builder->AppendLine(); + // + } + } + Console::WriteLine(builder); +} + +// This code produces the following output. +// +// The currency symbol for 'English (United States)' is '$' +// The currency symbol for 'English (United Kingdom)' is 'Ј' +// The currency symbol for 'English (Australia)' is '$' +// The currency symbol for 'English (Canada)' is '$' +// The currency symbol for 'English (New Zealand)' is '$' +// The currency symbol for 'English (Ireland)' is '?' +// The currency symbol for 'English (South Africa)' is 'R' +// The currency symbol for 'English (Jamaica)' is 'J$' +// The currency symbol for 'English (Caribbean)' is '$' +// The currency symbol for 'English (Belize)' is 'BZ$' +// The currency symbol for 'English (Trinidad and Tobago)' is 'TT$' +// The currency symbol for 'English (Zimbabwe)' is 'Z$' +// The currency symbol for 'English (Republic of the Philippines)' is 'Php' +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp new file mode 100644 index 00000000000..96cb476c415 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/NumberGroupSeparator/CPP/numbergroupseparator.cpp @@ -0,0 +1,27 @@ + +// The following code example demonstrates the effect of changing the NumberGroupSeparator property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S", "). + Int64 myInt = 123456789; + Console::WriteLine( myInt.ToString( "N", nfi ) ); + + // Displays the same value with a blank as the separator. + nfi->NumberGroupSeparator = " "; + Console::WriteLine( myInt.ToString( "N", nfi ) ); +} + +/* +This code produces the following output. +123, 456, 789.00 +123 456 789.00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp new file mode 100644 index 00000000000..f51cb7d8d13 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/NumberGroupSizes/CPP/numbergroupsizes.cpp @@ -0,0 +1,32 @@ + +// The following code example demonstrates the effect of changing the NumberGroupSizes property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S"."). + Int64 myInt = 123456789012345; + Console::WriteLine( myInt.ToString( "N", nfi ) ); + + // Displays the same value with different groupings. + array^mySizes1 = {2,3,4}; + array^mySizes2 = {2,3,0}; + nfi->NumberGroupSizes = mySizes1; + Console::WriteLine( myInt.ToString( "N", nfi ) ); + nfi->NumberGroupSizes = mySizes2; + Console::WriteLine( myInt.ToString( "N", nfi ) ); +} + +/* +This code produces the following output. +123, 456, 789, 012, 345.00 +12, 3456, 7890, 123, 45.00 +1234567890, 123, 45.00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp b/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp new file mode 100644 index 00000000000..5fe0650df9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/NumberStyles/cpp/NumberStyles.cpp @@ -0,0 +1,41 @@ +//Types:System.Globalization.NumberStyles (enum) +// +using namespace System; +using namespace System::Text; +using namespace System::Globalization; + + +int main() +{ + // Parse the string as a hex value and display the + // value as a decimal. + String^ numberString = "A"; + int stringValue = Int32::Parse(numberString, NumberStyles::HexNumber); + Console::WriteLine("{0} in hex = {1} in decimal.", + numberString, stringValue); + + // Parse the string, allowing a leading sign, and ignoring + // leading and trailing white spaces. + numberString = " -45 "; + stringValue =Int32::Parse(numberString, NumberStyles::AllowLeadingSign | + NumberStyles::AllowLeadingWhite | NumberStyles::AllowTrailingWhite); + Console::WriteLine("'{0}' parsed to an int is '{1}'.", + numberString, stringValue); + + // Parse the string, allowing parentheses, and ignoring + // leading and trailing white spaces. + numberString = " (37) "; + stringValue = Int32::Parse(numberString, NumberStyles::AllowParentheses | + NumberStyles::AllowLeadingSign | NumberStyles::AllowLeadingWhite | + NumberStyles::AllowTrailingWhite); + + Console::WriteLine("'{0}' parsed to an int is '{1}'.", + numberString, stringValue); +} + +// This code produces the following output. +// +// A in hex = 10 in decimal. +// ' -45 ' parsed to an int is '-45'. +// ' (37) ' parsed to an int is '-37'. +// diff --git a/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp b/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp new file mode 100644 index 00000000000..90c4a5a1302 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ObjDispEx/CPP/objdispexc.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + MemoryStream^ ms = gcnew MemoryStream( 16 ); + ms->Close(); + try + { + ms->ReadByte(); + } + catch ( ObjectDisposedException^ e ) + { + Console::WriteLine( "Caught: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp new file mode 100644 index 00000000000..75724099841 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ObjectModel.Collection/cpp/source.cpp @@ -0,0 +1,115 @@ +// +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Collections::ObjectModel; + +public ref class Demo +{ +public: + static void Main() + { + Collection^ dinosaurs = gcnew Collection(); + + dinosaurs->Add("Psitticosaurus"); + dinosaurs->Add("Caudipteryx"); + dinosaurs->Add("Compsognathus"); + dinosaurs->Add("Muttaburrasaurus"); + + Console::WriteLine("{0} dinosaurs:", dinosaurs->Count); + Display(dinosaurs); + + Console::WriteLine("\nIndexOf(\"Muttaburrasaurus\"): {0}", + dinosaurs->IndexOf("Muttaburrasaurus")); + + Console::WriteLine("\nContains(\"Caudipteryx\"): {0}", + dinosaurs->Contains("Caudipteryx")); + + Console::WriteLine("\nInsert(2, \"Nanotyrannus\")"); + dinosaurs->Insert(2, "Nanotyrannus"); + Display(dinosaurs); + + Console::WriteLine("\ndinosaurs[2]: {0}", dinosaurs[2]); + + Console::WriteLine("\ndinosaurs[2] = \"Microraptor\""); + dinosaurs[2] = "Microraptor"; + Display(dinosaurs); + + Console::WriteLine("\nRemove(\"Microraptor\")"); + dinosaurs->Remove("Microraptor"); + Display(dinosaurs); + + Console::WriteLine("\nRemoveAt(0)"); + dinosaurs->RemoveAt(0); + Display(dinosaurs); + + Console::WriteLine("\ndinosaurs.Clear()"); + dinosaurs->Clear(); + Console::WriteLine("Count: {0}", dinosaurs->Count); + } + +private: + static void Display(Collection^ cs) + { + Console::WriteLine(); + for each( String^ item in cs ) + { + Console::WriteLine(item); + } + } +}; + +int main() +{ + Demo::Main(); +} + +/* This code example produces the following output: + +4 dinosaurs: + +Psitticosaurus +Caudipteryx +Compsognathus +Muttaburrasaurus + +IndexOf("Muttaburrasaurus"): 3 + +Contains("Caudipteryx"): True + +Insert(2, "Nanotyrannus") + +Psitticosaurus +Caudipteryx +Nanotyrannus +Compsognathus +Muttaburrasaurus + +dinosaurs[2]: Nanotyrannus + +dinosaurs[2] = "Microraptor" + +Psitticosaurus +Caudipteryx +Microraptor +Compsognathus +Muttaburrasaurus + +Remove("Microraptor") + +Psitticosaurus +Caudipteryx +Compsognathus +Muttaburrasaurus + +RemoveAt(0) + +Caudipteryx +Compsognathus +Muttaburrasaurus + +dinosaurs.Clear() +Count: 0 + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp b/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp new file mode 100644 index 00000000000..d13e56d248d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ObjectX/cpp/ObjectX.cpp @@ -0,0 +1,107 @@ +//Types:System.Object +// +using namespace System; + +// The Point class is derived from System.Object. +ref class Point +{ +public: + int x; +public: + int y; + +public: + Point(int x, int y) + { + this->x = x; + this->y = y; + } + + // +public: + virtual bool Equals(Object^ obj) override + { + // If this and obj do not refer to the same type, + // then they are not equal. + if (obj->GetType() != this->GetType()) + { + return false; + } + + // Return true if x and y fields match. + Point^ other = (Point^) obj; + return (this->x == other->x) && (this->y == other->y); + } + // + + // + // Return the XOR of the x and y fields. +public: + virtual int GetHashCode() override + { + return x ^ y; + } + // + + // + // Return the point's value as a string. +public: + virtual String^ ToString() override + { + return String::Format("({0}, {1})", x, y); + } + // + + // + // Return a copy of this point object by making a simple + // field copy. +public: + Point^ Copy() + { + return (Point^) this->MemberwiseClone(); + } + // +}; + +int main() +{ + // Construct a Point object. + Point^ p1 = gcnew Point(1, 2); + + // Make another Point object that is a copy of the first. + Point^ p2 = p1->Copy(); + + // Make another variable that references the first + // Point object. + Point^ p3 = p1; + + // + // The line below displays false because p1 and + // p2 refer to two different objects. + Console::WriteLine( + Object::ReferenceEquals(p1, p2)); + // + + // + // The line below displays true because p1 and p2 refer + // to two different objects that have the same value. + Console::WriteLine(Object::Equals(p1, p2)); + // + + // The line below displays true because p1 and + // p3 refer to one object. + Console::WriteLine(Object::ReferenceEquals(p1, p3)); + + // + // The line below displays: p1's value is: (1, 2) + Console::WriteLine("p1's value is: {0}", p1->ToString()); + // +} + +// This code produces the following output. +// +// False +// True +// True +// p1's value is: (1, 2) +// diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp new file mode 100644 index 00000000000..c2c7e1cf179 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.ServicePack/CPP/sp.cpp @@ -0,0 +1,18 @@ + +// +// This example demonstrates the OperatingSystem.ServicePack property. +using namespace System; +int main() +{ + OperatingSystem^ os = Environment::OSVersion; + String^ sp = os->ServicePack; + Console::WriteLine( "Service pack version = \"{0}\"", sp ); +} + +/* +This example produces the following results: + +Service pack version = "Service Pack 1" + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp new file mode 100644 index 00000000000..6c87d9dff1f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/OperatingSystem.VersionString/CPP/osvs.cpp @@ -0,0 +1,20 @@ + +// +// This example demonstrates the VersionString property. +using namespace System; +int main() +{ + OperatingSystem^ os = Environment::OSVersion; + + // Display the value of OperatingSystem.VersionString. By default, this is + // the same value as OperatingSystem.ToString. + Console::WriteLine( L"This operating system is {0}", os->VersionString ); + return 0; +} + +/* +This example produces the following results: + +This operating system is Microsoft Windows NT 5.1.2600.0 Service Pack 1 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp new file mode 100644 index 00000000000..a0934b9b3d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_Attributes1/CPP/parameterinfo_attributes1.cpp @@ -0,0 +1,38 @@ + +// System::Reflection::ParameterInfo::Attributes +/* + The following example displays the attributes associated with the + parameters of the method called 'MyMethod' of class 'ParameterInfo_Example'. + */ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +public ref class MyClass1 +{ +public: + int MyMethod( int i, [Out]short * j, long * k ) + { + *j = 2; + return 0; + } + +}; + +void main() +{ + // Get the type. + Type^ myType = MyClass1::typeid; + + // Get the method named 'MyMethod' from the type. + MethodBase^ myMethodBase = myType->GetMethod( "MyMethod" ); + + // Get the parameters associated with the method. + array^myParameters = myMethodBase->GetParameters(); + Console::WriteLine( "\nThe method {0} has the {1} parameters :", "ParameterInfo_Example::MyMethod", myParameters->Length ); + + // Print the attributes associated with each of the parameters. + for ( int i = 0; i < myParameters->Length; i++ ) + Console::WriteLine( "\tThe {0} parameter has the attribute : {1}", i + 1, myParameters[ i ]->Attributes ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp new file mode 100644 index 00000000000..06e6497934c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttribute_IsDefined/CPP/ParameterInfo_GetCustomAttribute_IsDefined.cpp @@ -0,0 +1,87 @@ +// +// System::Reflection::ParameterInfo::GetCustomAttributes(Type, bool) +// System::Reflection::ParameterInfo::IsDefined(Type, bool) +using namespace System; +using namespace System::Reflection; + +// Define a custom attribute with one named parameter. +[AttributeUsage(AttributeTargets::Parameter)] +public ref class MyAttribute: public Attribute +{ +private: + String^ myName; + +public: + MyAttribute( String^ name ) + { + myName = name; + } + + property String^ Name + { + String^ get() + { + return myName; + } + } +}; + +// Derive another custom attribute from MyAttribute. +[AttributeUsage(AttributeTargets::Parameter)] +public ref class MyDerivedAttribute: public MyAttribute +{ +public: + MyDerivedAttribute( String^ name ) : MyAttribute( name ) {} +}; + +// Define a class with a method that has three parameters. Apply +// MyAttribute to one parameter, MyDerivedAttribute to another, and +// no attributes to the third. +public ref class MyClass1 +{ +public: + void MyMethod( [MyAttribute("This is an example parameter attribute")] + int i, + [MyDerivedAttribute("This is another parameter attribute")] + int j, + int k ){} +}; + +void main() +{ + // Get the type of the class 'MyClass1'. + Type^ myType = MyClass1::typeid; + + // Get the members associated with the class 'MyClass1'. + array^myMethods = myType->GetMethods(); + + // For each method of the class 'MyClass1', display all the parameters + // to which MyAttribute or its derived types have been applied. + for each ( MethodInfo^ mi in myMethods ) + { + // Get the parameters for the method. + array^ myParameters = mi->GetParameters(); + if ( myParameters->Length > 0 ) + { + Console::WriteLine("\nThe following parameters of {0} have MyAttribute or a derived type:", mi); + for each ( ParameterInfo^ pi in myParameters) + { + if (pi->IsDefined(MyAttribute::typeid, false)) + { + Console::WriteLine("Parameter {0}, name = {1}, type = {2}", + pi->Position, pi->Name, pi->ParameterType); + } + } + } + } +} + +/* This code example produces the following output: + +The following parameters of Void MyMethod(Int32, Int32, Int32) have MyAttribute or a derived type: +Parameter 0, name = i, type = System.Int32 +Parameter 1, name = j, type = System.Int32 + +The following parameters of Boolean Equals(System.Object) have MyAttribute or a derived type: + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp new file mode 100644 index 00000000000..f864dfbd878 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_GetCustomAttributes/CPP/source.cpp @@ -0,0 +1,82 @@ +// +using namespace System; +using namespace System::Reflection; + +// Define a custom attribute with one named parameter. +[AttributeUsage(AttributeTargets::Parameter)] +public ref class MyAttribute: public Attribute +{ +private: + String^ myName; + +public: + MyAttribute( String^ name ) + { + myName = name; + } + + property String^ Name + { + String^ get() + { + return myName; + } + } +}; + +// Define a class which has a custom attribute associated with one of the +// parameters of a method. +public ref class MyClass1 +{ +public: + void MyMethod( + [MyAttribute("This is an example parameter attribute")] + int i ) {} +}; + +void main() +{ + // Get the type of the class 'MyClass1'. + Type^ myType = MyClass1::typeid; + + // Get the members associated with the class 'MyClass1'. + array^myMethods = myType->GetMethods(); + + // Display the attributes for each of the parameters of each method of the class 'MyClass1'. + for ( int i = 0; i < myMethods->Length; i++ ) + { + // Get the parameters for the method. + array^myParameters = myMethods[ i ]->GetParameters(); + + if ( myParameters->Length > 0 ) + { + Console::WriteLine( "\nThe parameters for the method \"{0}\" that have custom attributes are:", myMethods[ i ] ); + for ( int j = 0; j < myParameters->Length; j++ ) + { + // Get the attributes of type 'MyAttribute' for each parameter. + array^myAttributes = myParameters[ j ]->GetCustomAttributes( MyAttribute::typeid, false ); + + if ( myAttributes->Length > 0 ) + { + Console::WriteLine( "Parameter {0}, name = {1}, type = {2} has attributes:", + myParameters[ j ]->Position, + myParameters[ j ]->Name, + myParameters[ j ]->ParameterType ); + for ( int k = 0; k < myAttributes->Length; k++ ) + { + Console::WriteLine( "\t{0}", myAttributes[ k ] ); + } + } + } + } + } +} +/* This code example produces the following output: + +The parameters for the method Void MyMethod(Int32) that have custom attributes are : +Parameter 0, name = i, type = System.Int32 has attributes: + MyAttribute + +The parameters for the method Boolean Equals(System.Object) that have custom attributes are : + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp new file mode 100644 index 00000000000..c568d6441a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ParameterInfo_IsIn_IsOut_IsOptional/CPP/ParameterInfo_IsIn_IsOut_IsOptional.cpp @@ -0,0 +1,103 @@ + +// System::Reflection::ParameterInfo::IsIn +// System::Reflection::ParameterInfo::IsOptional +// System::Reflection::ParameterInfo::IsOut +/* +The following program creates a dynamic assembly named 'MyAssembly', defines a +module named 'MyModule' within the assembly. It defines a type called 'MyType' +within the module and also defines a static method named 'MyMethod' for the +type. This dynamic assembly is then queried for the type defined within it and +then the attributes of all the parameters of the method named 'MyMethod' is +displayed. +*/ +// +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Threading; +using namespace System::Reflection::Emit; +void DefineMethod() +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "MyAssembly"; + + // Get the assembly builder from the application domain associated with the current thread. + AssemblyBuilder^ myAssemblyBuilder = Thread::GetDomain()->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + + // Create a dynamic module in the assembly. + ModuleBuilder^ myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "MyModule", "MyAssembly.dll" ); + + // Create a type in the module. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyType" ); + + // Create a method called MyMethod. + array^type1 = {int::typeid,short::typeid,long::typeid}; + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "MyMethod", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::Static), String::typeid, type1 ); + + // Set the attributes for the parameters of the method. + // Set the attribute for the first parameter to IN. + ParameterBuilder^ myParameterBuilder = myMethodBuilder->DefineParameter( 1, ParameterAttributes::In, "MyIntParameter" ); + + // Set the attribute for the second parameter to OUT. + myParameterBuilder = myMethodBuilder->DefineParameter( 2, ParameterAttributes::Out, "MyShortParameter" ); + + // Set the attribute for the third parameter to OPTIONAL. + myParameterBuilder = myMethodBuilder->DefineParameter( 3, static_cast(ParameterAttributes::Optional | ParameterAttributes::HasDefault), "MyLongParameter" ); + + // Get the Microsoft Intermediate Language generator for the method. + ILGenerator^ myILGenerator = myMethodBuilder->GetILGenerator(); + + // Use the utility method to generate the MSIL instructions that print a String* to the console. + myILGenerator->EmitWriteLine( "Hello World!" ); + + // Generate the S"ret" MSIL instruction. + myILGenerator->Emit( OpCodes::Ret ); + + // End the creation of the type. + myTypeBuilder->CreateType(); +} + +int main() +{ + // Create a dynamic assembly with a type named MyType. + DefineMethod(); + + // Get the assemblies currently loaded in the application domain. + array^myAssemblies = Thread::GetDomain()->GetAssemblies(); + Assembly^ myAssembly = nullptr; + + // Get the assembly named MyAssembly. + for ( int i = 0; i < myAssemblies->Length; i++ ) + if ( String::Compare( myAssemblies[ i ]->GetName( false )->Name, "MyAssembly" ) == 0 ) + myAssembly = myAssemblies[ i ]; + + if ( myAssembly != nullptr ) + { + // Get a type named MyType. + Type^ myType = myAssembly->GetType( "MyType" ); + + // Get a method named MyMethod from the type. + MethodBase^ myMethodBase = myType->GetMethod( "MyMethod" ); + + // Get the parameters associated with the method. + array^myParameters = myMethodBase->GetParameters(); + Console::WriteLine( "\nThe method {0} has the {1} parameters :", myMethodBase, myParameters->Length ); + + // Print the IN, OUT and OPTIONAL attributes associated with each of the parameters. + for ( int i = 0; i < myParameters->Length; i++ ) + { + if ( myParameters[ i ]->IsIn ) + Console::WriteLine( "\tThe {0} parameter has the In attribute", i + 1 ); + if ( myParameters[ i ]->IsOptional ) + Console::WriteLine( "\tThe {0} parameter has the Optional attribute", i + 1 ); + if ( myParameters[ i ]->IsOut ) + Console::WriteLine( "\tThe {0} parameter has the Out attribute", i + 1 ); + } + } + else + Console::WriteLine( "Could not find a assembly named 'MyAssembly' for the current application domain" ); +} +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp b/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp new file mode 100644 index 00000000000..08709a04488 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Path Class/CPP/path class.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path1 = "c:\\temp\\MyTest.txt"; + String^ path2 = "c:\\temp\\MyTest"; + String^ path3 = "temp"; + if ( Path::HasExtension( path1 ) ) + { + Console::WriteLine( "{0} has an extension.", path1 ); + } + + if ( !Path::HasExtension( path2 ) ) + { + Console::WriteLine( "{0} has no extension.", path2 ); + } + + if ( !Path::IsPathRooted( path3 ) ) + { + Console::WriteLine( "The string {0} contains no root information.", path3 ); + } + + Console::WriteLine( "The full path of {0} is {1}.", path3, Path::GetFullPath( path3 ) ); + Console::WriteLine( "{0} is the location for temporary files.", Path::GetTempPath() ); + Console::WriteLine( "{0} is a file available for use.", Path::GetTempFileName() ); + Console::WriteLine( "\r\nThe set of invalid characters in a path is:" ); + Console::WriteLine( "(Note that the wildcard characters '*' and '?' are not invalid.):" ); + Collections::IEnumerator^ myEnum = Path::InvalidPathChars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = *safe_cast(myEnum->Current); + Console::WriteLine( c ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp b/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp new file mode 100644 index 00000000000..331d7abbb90 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PercentDecimalDigits/CPP/percentdecimaldigits.cpp @@ -0,0 +1,27 @@ + +// The following code example demonstrates the effect of changing the PercentDecimalDigits property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a negative value with the default number of decimal digits (2). + Double myInt = 0.1234; + Console::WriteLine( myInt.ToString( "P", nfi ) ); + + // Displays the same value with four decimal digits. + nfi->PercentDecimalDigits = 4; + Console::WriteLine( myInt.ToString( "P", nfi ) ); +} + +/* +This code produces the following output. +12.34 % +12.3400 % +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp b/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp new file mode 100644 index 00000000000..de975569dfb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PercentDecimalSeparator/CPP/percentdecimalseparator.cpp @@ -0,0 +1,28 @@ + +// The following code example demonstrates the effect of changing the +// PercentDecimalSeparator property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S"."). + Double myInt = 0.1234; + Console::WriteLine( myInt.ToString( "P", nfi ) ); + + // Displays the same value with a blank as the separator. + nfi->PercentDecimalSeparator = " "; + Console::WriteLine( myInt.ToString( "P", nfi ) ); +} + +/* +This code produces the following output. +12.34 % +12 34 % +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp b/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp new file mode 100644 index 00000000000..39d7c7a20ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PercentGroupSeparator/CPP/percentgroupseparator.cpp @@ -0,0 +1,28 @@ + +// The following code example demonstrates the effect of changing the +// PercentGroupSeparator property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S", "). + Double myInt = 1234.5678; + Console::WriteLine( myInt.ToString( "P", nfi ) ); + + // Displays the same value with a blank as the separator. + nfi->PercentGroupSeparator = " "; + Console::WriteLine( myInt.ToString( "P", nfi ) ); +} + +/* +This code produces the following output. +123, 456.78 % +123 456.78 % +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp b/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp new file mode 100644 index 00000000000..2edc2ec4edf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PercentGroupSizes/CPP/percentgroupsizes.cpp @@ -0,0 +1,33 @@ + +// The following code example demonstrates the effect of changing the PercentGroupSizes property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets a NumberFormatInfo associated with the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + NumberFormatInfo^ nfi = MyCI->NumberFormat; + + // Displays a value with the default separator (S"."). + Double myInt = 123456789012345.6789; + Console::WriteLine( myInt.ToString( "P", nfi ) ); + + // Displays the same value with different groupings. + array^mySizes1 = {2,3,4}; + array^mySizes2 = {2,3,0}; + nfi->PercentGroupSizes = mySizes1; + Console::WriteLine( myInt.ToString( "P", nfi ) ); + nfi->PercentGroupSizes = mySizes2; + Console::WriteLine( myInt.ToString( "P", nfi ) ); +} + +/* +This code produces the following output. + +12, 345, 678, 901, 234, 600.00 % +1234, 5678, 9012, 346, 00.00 % +123456789012, 346, 00.00 % +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp b/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp new file mode 100644 index 00000000000..ec0c28aeb8c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PerfCounter/CPP/perfcounter.cpp @@ -0,0 +1,102 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Diagnostics; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + PerformanceCounter^ PC = gcnew PerformanceCounter; + PC->CategoryName = "Process"; + PC->CounterName = "Private Bytes"; + PC->InstanceName = "Explorer"; + MessageBox::Show( PC->NextValue().ToString() ); + // + + // + Array^ PerfCat = PerformanceCounterCategory::GetCategories(); + MessageBox::Show( String::Concat( "The number of performance counter categories in the local machine is ", PerfCat->Length ) ); + // + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +//Output: +//11.11 % +//11.11 Percent diff --git a/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp b/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp new file mode 100644 index 00000000000..9cdd3a26593 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PerfCounter_ccd/CPP/ccd.cpp @@ -0,0 +1,25 @@ +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + + // + if ( !PerformanceCounterCategory::Exists( "Orders" ) ) + { + CounterCreationData^ milk = gcnew CounterCreationData; + milk->CounterName = "milk"; + milk->CounterType = PerformanceCounterType::NumberOfItems32; + + CounterCreationData^ milkPerSecond = gcnew CounterCreationData; + milkPerSecond->CounterName = "milk orders/second"; + milkPerSecond->CounterType = PerformanceCounterType::RateOfCountsPerSecond32; + + CounterCreationDataCollection^ ccds = gcnew CounterCreationDataCollection; + ccds->Add( milkPerSecond ); + ccds->Add( milk ); + PerformanceCounterCategory::Create( "Orders", "Number of processed orders", ccds ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp new file mode 100644 index 00000000000..fe5c4b92d7c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterInstaller/CPP/performancecounterinstaller.cpp @@ -0,0 +1,50 @@ +// cpp.cpp : main project file. +// System::Diagnostics.PerformanceCounterInstaller +/* +The following example demonstrates 'PerformanceCounterInstaller' class. +A class is inherited from 'Installer' having 'RunInstallerAttribute' set to true. +A new instance of 'PerformanceCounterInstaller' is created and its 'CategoryName' +is set. Then this instance is added to 'InstallerCollection'. +Note: +1)To run this example use the following command: +InstallUtil::exe PerformanceCounterInstaller::exe +2)To uninstall the perfomance counter use the following command: +InstallUtil::exe /u PerformanceCounterInstaller::exe +*/ +// +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Diagnostics; +using namespace System::ComponentModel; + +[RunInstaller(true)] +ref class MyPerformanceCounterInstaller: public Installer +{ +public: + MyPerformanceCounterInstaller() + { + try + { + // Create an instance of 'PerformanceCounterInstaller'. + PerformanceCounterInstaller^ myPerformanceCounterInstaller = + gcnew PerformanceCounterInstaller; + // Set the 'CategoryName' for performance counter. + myPerformanceCounterInstaller->CategoryName = + "MyPerformanceCounter"; + CounterCreationData^ myCounterCreation = gcnew CounterCreationData; + myCounterCreation->CounterName = "MyCounter"; + myCounterCreation->CounterHelp = "Counter Help"; + // Add a counter to collection of myPerformanceCounterInstaller. + myPerformanceCounterInstaller->Counters->Add( myCounterCreation ); + Installers->Add( myPerformanceCounterInstaller ); + } + catch ( Exception^ e ) + { + this->Context->LogMessage( "Error occurred : " + e->Message ); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp new file mode 100644 index 00000000000..f51c915deba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.AverageCounter64/CPP/averagecount32.cpp @@ -0,0 +1,138 @@ +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Diagnostics; + +// Output information about the counter sample. +void OutputSample( CounterSample s ) +{ + Console::WriteLine( "\r\n+++++++++++" ); + Console::WriteLine( "Sample values - \r\n" ); + Console::WriteLine( " BaseValue = {0}", s.BaseValue ); + Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency ); + Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp ); + Console::WriteLine( " CounterType = {0}", s.CounterType ); + Console::WriteLine( " RawValue = {0}", s.RawValue ); + Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency ); + Console::WriteLine( " TimeStamp = {0}", s.TimeStamp ); + Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec ); + Console::WriteLine( "++++++++++++++++++++++" ); +} + +//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++ +// Description - This counter type shows how many items are processed, on average, +// during an operation. Counters of this type display a ratio of the items +// processed (such as bytes sent) to the number of operations completed. The +// ratio is calculated by comparing the number of items processed during the +// last interval to the number of operations completed during the last interval. +// Generic type - Average +// Formula - (N1 - N0) / (D1 - D0), where the numerator (N) represents the number +// of items processed during the last sample interval and the denominator (D) +// represents the number of operations completed during the last two sample +// intervals. +// Average (Nx - N0) / (Dx - D0) +// Example PhysicalDisk\ Avg. Disk Bytes/Transfer +//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++//++++++++ +float MyComputeCounterValue( CounterSample s0, CounterSample s1 ) +{ + float numerator = (float)s1.RawValue - (float)s0.RawValue; + float denomenator = (float)s1.BaseValue - (float)s0.BaseValue; + float counterValue = numerator / denomenator; + return counterValue; +} + +bool SetupCategory() +{ + if ( !PerformanceCounterCategory::Exists( "AverageCounter64SampleCategory" ) ) + { + CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection; + + // Add the counter. + CounterCreationData^ averageCount64 = gcnew CounterCreationData; + averageCount64->CounterType = PerformanceCounterType::AverageCount64; + averageCount64->CounterName = "AverageCounter64Sample"; + CCDC->Add( averageCount64 ); + + // Add the base counter. + CounterCreationData^ averageCount64Base = gcnew CounterCreationData; + averageCount64Base->CounterType = PerformanceCounterType::AverageBase; + averageCount64Base->CounterName = "AverageCounter64SampleBase"; + CCDC->Add( averageCount64Base ); + + // Create the category. + PerformanceCounterCategory::Create( "AverageCounter64SampleCategory", "Demonstrates usage of the AverageCounter64 performance counter type.", CCDC ); + return (true); + } + else + { + Console::WriteLine( "Category exists - AverageCounter64SampleCategory" ); + return (false); + } +} + +void CreateCounters( PerformanceCounter^% PC, PerformanceCounter^% BPC ) +{ + + // Create the counters. + // + PC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64Sample",false ); + // + + BPC = gcnew PerformanceCounter( "AverageCounter64SampleCategory","AverageCounter64SampleBase",false ); + PC->RawValue = 0; + BPC->RawValue = 0; +} +// +void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC, PerformanceCounter^ BPC ) +{ + Random^ r = gcnew Random( DateTime::Now.Millisecond ); + + // Loop for the samples. + for ( int j = 0; j < 100; j++ ) + { + int value = r->Next( 1, 10 ); + Console::Write( "{0} = {1}", j, value ); + PC->IncrementBy( value ); + BPC->Increment(); + if ( (j % 10) == 9 ) + { + OutputSample( PC->NextSample() ); + samplesList->Add( PC->NextSample() ); + } + else + Console::WriteLine(); + System::Threading::Thread::Sleep( 50 ); + } +} +// + +void CalculateResults( ArrayList^ samplesList ) +{ + for ( int i = 0; i < (samplesList->Count - 1); i++ ) + { + // Output the sample. + OutputSample( *safe_cast(samplesList[ i ]) ); + OutputSample( *safe_cast(samplesList[ i + 1 ]) ); + + // Use .NET to calculate the counter value. + Console::WriteLine( ".NET computed counter value = {0}", CounterSampleCalculator::ComputeCounterValue( *safe_cast(samplesList[ i ]), *safe_cast(samplesList[ i + 1 ]) ) ); + + // Calculate the counter value manually. + Console::WriteLine( "My computed counter value = {0}", MyComputeCounterValue( *safe_cast(samplesList[ i ]), *safe_cast(samplesList[ i + 1 ]) ) ); + } +} + +int main() +{ + ArrayList^ samplesList = gcnew ArrayList; + PerformanceCounter^ PC; + PerformanceCounter^ BPC; + SetupCategory(); + CreateCounters( PC, BPC ); + CollectSamples( samplesList, PC, BPC ); + CalculateResults( samplesList ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp new file mode 100644 index 00000000000..0c6d5707320 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PerformanceCounterType.ElapsedTime/CPP/elapsedtime.cpp @@ -0,0 +1,208 @@ +// Notice that the sample is conditionally compiled for Everett vs. +// Whidbey builds. Whidbey introduced new APIs that are not available +// in Everett. Snippet IDs do not overlap between Whidbey and Everett; +// Snippet #1 is Everett, Snippet #2 and #3 are Whidbey. + +#if ( BELOW_WHIDBEY_BUILD ) + +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Diagnostics; +using namespace System::Runtime::InteropServices; + +void OutputSample( CounterSample s ) +{ + Console::WriteLine( "\r\n+++++++++++" ); + Console::WriteLine( "Sample values - \r\n" ); + Console::WriteLine( " BaseValue = {0}", s.BaseValue ); + Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency ); + Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp ); + Console::WriteLine( " CounterType = {0}", s.CounterType ); + Console::WriteLine( " RawValue = {0}", s.RawValue ); + Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency ); + Console::WriteLine( " TimeStamp = {0}", s.TimeStamp ); + Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec ); + Console::WriteLine( "++++++++++++++++++++++" ); +} + +// Reads the counter information to enable setting the RawValue. +[DllImport("Kernel32.dll")] +extern bool QueryPerformanceCounter( [Out]__int64 * value ); + +bool SetupCategory() +{ + if ( !PerformanceCounterCategory::Exists( "ElapsedTimeSampleCategory" ) ) + { + CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection; + + // Add the counter. + CounterCreationData^ ETimeData = gcnew CounterCreationData; + ETimeData->CounterType = PerformanceCounterType::ElapsedTime; + ETimeData->CounterName = "ElapsedTimeSample"; + CCDC->Add( ETimeData ); + + // Create the category. + PerformanceCounterCategory::Create( "ElapsedTimeSampleCategory", + "Demonstrates usage of the ElapsedTime performance counter type.", + CCDC ); + return true; + } + else + { + Console::WriteLine( "Category exists - ElapsedTimeSampleCategory" ); + return false; + } +} + +void CreateCounters( PerformanceCounter^% PC ) +{ + // Create the counter. + PC = gcnew PerformanceCounter( "ElapsedTimeSampleCategory", + "ElapsedTimeSample", + false ); +} + +void CollectSamples( ArrayList^ samplesList, PerformanceCounter^ PC ) +{ + __int64 pcValue; + DateTime Start; + + // Initialize the counter. + QueryPerformanceCounter( &pcValue ); + PC->RawValue = pcValue; + Start = DateTime::Now; + + // Loop for the samples. + for ( int j = 0; j < 1000; j++ ) + { + // Output the values. + if ( (j % 10) == 9 ) + { + Console::WriteLine( "NextValue() = {0}", PC->NextValue() ); + Console::WriteLine( "Actual elapsed time = {0}", DateTime::Now.Subtract( Start ) ); + OutputSample( PC->NextSample() ); + samplesList->Add( PC->NextSample() ); + } + + // reset the counter on 100th iteration. + if ( j % 100 == 0 ) + { + QueryPerformanceCounter( &pcValue ); + PC->RawValue = pcValue; + Start = DateTime::Now; + } + System::Threading::Thread::Sleep( 50 ); + } + + Console::WriteLine( "Elapsed time = {0}", DateTime::Now.Subtract( Start ) ); +} + +void main() +{ + ArrayList^ samplesList = gcnew ArrayList; +// PerformanceCounter^ PC; + SetupCategory(); +// CreateCounters( PC ); + CreateCounters(); + CollectSamples( samplesList, PC ); +} +// + +#else +// Build sample for Whidbey or higher. + +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Diagnostics; +using namespace System::Runtime::InteropServices; + +void OutputSample( CounterSample s ) +{ + Console::WriteLine( "\r\n+++++++++++" ); + Console::WriteLine( "Sample values - \r\n" ); + Console::WriteLine( " BaseValue = {0}", s.BaseValue ); + Console::WriteLine( " CounterFrequency = {0}", s.CounterFrequency ); + Console::WriteLine( " CounterTimeStamp = {0}", s.CounterTimeStamp ); + Console::WriteLine( " CounterType = {0}", s.CounterType ); + Console::WriteLine( " RawValue = {0}", s.RawValue ); + Console::WriteLine( " SystemFrequency = {0}", s.SystemFrequency ); + Console::WriteLine( " TimeStamp = {0}", s.TimeStamp ); + Console::WriteLine( " TimeStamp100nSec = {0}", s.TimeStamp100nSec ); + Console::WriteLine( "++++++++++++++++++++++" ); +} + +void CollectSamples() +{ + String^ categoryName = "ElapsedTimeSampleCategory"; + String^ counterName = "ElapsedTimeSample"; + + // Create the performance counter category. + if ( !PerformanceCounterCategory::Exists( categoryName ) ) + { + CounterCreationDataCollection^ CCDC = gcnew CounterCreationDataCollection; + + // Add the counter. + CounterCreationData^ ETimeData = gcnew CounterCreationData; + ETimeData->CounterType = PerformanceCounterType::ElapsedTime; + ETimeData->CounterName = counterName; + CCDC->Add( ETimeData ); + + // Create the category. + PerformanceCounterCategory::Create( categoryName, + "Demonstrates ElapsedTime performance counter usage.", + CCDC ); + } + else + { + Console::WriteLine( "Category exists - {0}", categoryName ); + } + + + // + // Create the performance counter. + PerformanceCounter^ PC = gcnew PerformanceCounter( categoryName, + counterName, + false ); + // Initialize the counter. + PC->RawValue = Stopwatch::GetTimestamp(); + // + + DateTime Start = DateTime::Now; + + // Loop for the samples. + for ( int j = 0; j < 100; j++ ) + { + // Output the values. + if ( (j % 10) == 9 ) + { + Console::WriteLine( "NextValue() = {0}", PC->NextValue() ); + Console::WriteLine( "Actual elapsed time = {0}", DateTime::Now.Subtract( Start ) ); + OutputSample( PC->NextSample() ); + } + + // Reset the counter on every 20th iteration. + if ( j % 20 == 0 ) + { + PC->RawValue = Stopwatch::GetTimestamp(); + Start = DateTime::Now; + } + System::Threading::Thread::Sleep( 50 ); + } + + Console::WriteLine( "Elapsed time = {0}", DateTime::Now.Subtract( Start ) ); +} + +int main() +{ + CollectSamples(); +} +// +#endif diff --git a/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp b/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp new file mode 100644 index 00000000000..e61059912b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Permission/cpp/Permission.cpp @@ -0,0 +1,279 @@ +// Types:System.Security.IPermission Vendor:Richter +// Types:System.Security.ISecurityEncodable Vendor:Richter +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Reflection; + +// Enumerated type for permission states. +[Serializable] +public enum class SoundPermissionState +{ + NoSound = 0, + PlaySystemSounds = 1, + PlayAnySound = 2 +}; + +// Derive from CodeAccessPermission to gain implementations of the following +// sealed IStackWalk methods: Assert, Demand, Deny, and PermitOnly. +// Implement the following abstract IPermission methods: +// Copy, Intersect, and IsSubSetOf. +// Implementing the Union method of the IPermission class is optional. +// Implement the following abstract ISecurityEncodable methods: +// FromXml and ToXml. +// Making the class 'sealed' is optional. + +public ref class SoundPermission sealed : public CodeAccessPermission, + public IPermission, public IUnrestrictedPermission, + public ISecurityEncodable, public ICloneable +{ +private: + bool specifiedAsUnrestricted; +private: + SoundPermissionState stateFlags; + + // This constructor creates and initializes + // a permission with generic access. +public: + SoundPermission(PermissionState^ state) + { + specifiedAsUnrestricted = (state == PermissionState::Unrestricted); + } + + // This constructor creates and initializes + // a permission with specific access. +public: + SoundPermission(SoundPermissionState flags) + { + if (flags < SoundPermissionState::NoSound || + flags > SoundPermissionState::PlayAnySound) + { + throw gcnew ArgumentException("The value of \"flags\" is not" + + " valid for the SoundPermissionState enumerated type"); + } + stateFlags = flags; + } + + // For debugging, return the state of this object as XML. +public: + virtual String^ ToString() override + { + return ToXml()->ToString(); + } + + // Private method to cast (if possible) an IPermission to the type. +private: + SoundPermission^ VerifyTypeMatch(IPermission^ target) + { + if (GetType() != target->GetType()) + { + throw gcnew ArgumentException(String::Format( + "The variable \"target\" must be of the {0} type", + GetType()->FullName)); + } + return (SoundPermission^) target; + } + + // This is the Private Clone helper method. +private: + SoundPermission^ Clone(bool specifiedAsUnrestricted, + SoundPermissionState flags) + { + SoundPermission^ soundPerm = (SoundPermission^) Clone(); + soundPerm->specifiedAsUnrestricted = specifiedAsUnrestricted; + soundPerm->stateFlags = specifiedAsUnrestricted ? + SoundPermissionState::PlayAnySound : flags; + return soundPerm; + } + + #pragma region IPermission^ Members + // + // Return a new object that contains the intersection + // of 'this' and 'target'. +public: + virtual IPermission^ Intersect(IPermission^ target) override + { + // If 'target' is null, return null. + if (target == nullptr) + { + return nullptr; + } + + // Both objects must be the same type. + SoundPermission^ soundPerm = VerifyTypeMatch(target); + + // If 'this' and 'target' are unrestricted, + // return a new unrestricted permission. + if (specifiedAsUnrestricted && soundPerm->specifiedAsUnrestricted) + { + return Clone(true, SoundPermissionState::PlayAnySound); + } + + // Calculate the intersected permissions. + // If there are none, return null. + SoundPermissionState minimumPermission = (SoundPermissionState) + Math::Min((int) stateFlags, (int) soundPerm->stateFlags); + if ((int)minimumPermission == 0) + { + return nullptr; + } + + // Return a new object with the intersected permission value. + return Clone(false, minimumPermission); + } + // + + // + // Called by the Demand method: returns true + // if 'this' is a subset of 'target'. +public: + virtual bool IsSubsetOf(IPermission^ target) override + { + // If 'target' is null and this permission allows nothing, + // return true. + if (target == nullptr) + { + return (int)stateFlags == 0; + } + + // Both objects must be the same type. + SoundPermission^ soundPerm = VerifyTypeMatch(target); + + // Return true if the permissions of 'this' + // is a subset of 'target'. + return stateFlags <= soundPerm->stateFlags; + } + // + + // + // Return a new object that matches 'this' object's permissions. +public: + virtual IPermission^ Copy () override sealed + { + return (IPermission^) Clone(); + } + // + + // + // Return a new object that contains the union of 'this' and 'target'. + // Note: You do not have to implement this method. + // If you do not, the version + // in CodeAccessPermission does this: + // 1. If target is not null, a NotSupportedException is thrown. + // 2. If target is null, then Copy is called and + // the new object is returned. +public: + virtual IPermission^ Union(IPermission^ target) override + { + // If 'target' is null, then return a copy of 'this'. + if (target == nullptr) + { + return Copy(); + } + + // Both objects must be the same type. + SoundPermission^ soundPerm = VerifyTypeMatch(target); + + // If 'this' or 'target' are unrestricted, + // return a new unrestricted permission. + if (specifiedAsUnrestricted || soundPerm->specifiedAsUnrestricted) + { + return Clone(true, SoundPermissionState::PlayAnySound); + } + + // Return a new object with the calculated, unioned permission value. + return Clone(false, (SoundPermissionState) + Math::Max((int) stateFlags, (int) soundPerm->stateFlags)); + } + // + #pragma endregion + + #pragma region ISecurityEncodable^ Members + // + // Populate the permission's fields from XML. +public: + virtual void FromXml(SecurityElement^ element) override + { + specifiedAsUnrestricted = false; + stateFlags = (SoundPermissionState)0; + + // If XML indicates an unrestricted permission, + // make this permission unrestricted. + String^ attributeString = + (String^) element->Attributes["Unrestricted"]; + if (attributeString != nullptr) + { + specifiedAsUnrestricted = Convert::ToBoolean(attributeString); + if (specifiedAsUnrestricted) + { + stateFlags = SoundPermissionState::PlayAnySound; + } + } + + // If XML indicates a restricted permission, parse the flags. + if (!specifiedAsUnrestricted) + { + attributeString = (String^) element->Attributes["Flags"]; + if (attributeString != nullptr) + { + stateFlags = (SoundPermissionState) Convert::ToInt32( + Enum::Parse(SoundPermissionState::typeid, + attributeString, true)); + } + } + } + // + + // + // Produce XML from the permission's fields. +public: + virtual SecurityElement^ ToXml() override + { + // These first three lines create an element with the required format. + SecurityElement^ element = gcnew SecurityElement("IPermission"); + // Replace the double quotation marks () + // with single quotation marks () + // to remain XML compliant when the culture is not neutral. + element->AddAttribute("class", + GetType()->AssemblyQualifiedName->Replace('\"', '\'')); + element->AddAttribute("version", "1"); + + if (!specifiedAsUnrestricted) + { + element->AddAttribute("Flags", + Enum::Format(SoundPermissionState::typeid, stateFlags, "G")); + } + else + { + element->AddAttribute("Unrestricted", "true"); + } + return element; + } + // + #pragma endregion + + #pragma region IUnrestrictedPermission^ Members + // + // Returns true if permission is effectively unrestricted. +public: + virtual bool IsUnrestricted() + { + // This means that the object is unrestricted at runtime. + return stateFlags == SoundPermissionState::PlayAnySound; + } + // + #pragma endregion + + #pragma region ICloneable^ Members + + // Return a copy of the permission. +public: + virtual Object^ Clone() + { + return MemberwiseClone(); + } + + #pragma endregion +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp b/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp new file mode 100644 index 00000000000..c551e40c3f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process.GetProcesses_noexception/CPP/processstaticget.cpp @@ -0,0 +1,40 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::ComponentModel; +int main() +{ + // Get the current process. + Process^ currentProcess = Process::GetCurrentProcess(); + + // Get all processes running on the local computer. + array^localAll = Process::GetProcesses(); + + // Get all instances of Notepad running on the local computer. + // This will return an empty array if notepad isn't running. + array^localByName = Process::GetProcessesByName("notepad"); + + // Get a process on the local computer, using the process id. + // This will throw an exception if there is no such process. + Process^ localById = Process::GetProcessById(1234); + + + // Get processes running on a remote computer. Note that this + // and all the following calls will timeout and throw an exception + // if "myComputer" and 169.0.0.0 do not exist on your local network. + + // Get all processes on a remote computer. + array^remoteAll = Process::GetProcesses("myComputer"); + + // Get all instances of Notepad running on the specific computer, using machine name. + array^remoteByName = Process::GetProcessesByName( "notepad", "myComputer" ); + + // Get all instances of Notepad running on the specific computer, using IP address. + array^ipByName = Process::GetProcessesByName( "notepad", "169.0.0.0" ); + + // Get a process on a remote computer, using the process id and machine name. + Process^ remoteById = Process::GetProcessById( 2345, "myComputer" ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp new file mode 100644 index 00000000000..b4879144d08 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process.Start_instance/CPP/processstart.cpp @@ -0,0 +1,28 @@ +// +#using +using namespace System; +using namespace System::Diagnostics; +using namespace System::ComponentModel; + +int main() +{ + Process^ myProcess = gcnew Process; + + try + { + myProcess->StartInfo->UseShellExecute = false; + // You can start any process, HelloWorld is a do-nothing example. + myProcess->StartInfo->FileName = "C:\\HelloWorld.exe"; + myProcess->StartInfo->CreateNoWindow = true; + myProcess->Start(); + // This code assumes the process you are starting will terminate itself. + // Given that it is started without a window so you cannot terminate it + // on the desktop, it must terminate itself or you can do it programmatically + // from this application using the Kill method. + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp new file mode 100644 index 00000000000..6db5fa36f59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic.cpp @@ -0,0 +1,47 @@ +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::ComponentModel; + +// Opens the Internet Explorer application. +void OpenApplication(String^ myFavoritesPath) +{ + // Start Internet Explorer. Defaults to the home page. + Process::Start("IExplore.exe"); + + // Display the contents of the favorites folder in the browser. + Process::Start(myFavoritesPath); +} + +// Opens urls and .html documents using Internet Explorer. +void OpenWithArguments() +{ + // URLs are not considered documents. They can only be opened + // by passing them as arguments. + Process::Start("IExplore.exe", "www.northwindtraders.com"); + + // Start a Web page using a browser associated with .html and .asp files. + Process::Start("IExplore.exe", "C:\\myPath\\myFile.htm"); + Process::Start("IExplore.exe", "C:\\myPath\\myFile.asp"); +} + +// Uses the ProcessStartInfo class to start new processes, +// both in a minimized mode. +void OpenWithStartInfo() +{ + ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("IExplore.exe"); + startInfo->WindowStyle = ProcessWindowStyle::Minimized; + Process::Start(startInfo); + startInfo->Arguments = "www.northwindtraders.com"; + Process::Start(startInfo); +} + +int main() +{ + // Get the path that stores favorite links. + String^ myFavoritesPath = Environment::GetFolderPath(Environment::SpecialFolder::Favorites); + OpenApplication(myFavoritesPath); + OpenWithArguments(); + OpenWithStartInfo(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp new file mode 100644 index 00000000000..b84436e8b00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic2.cpp @@ -0,0 +1,52 @@ +// Place the following code into a console project called StartArgsEcho. It depends on the +// console application named argsecho.exe. + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + ProcessStartInfo^ startInfo = gcnew ProcessStartInfo("argsecho.exe"); + startInfo->WindowStyle = ProcessWindowStyle::Normal; + + // Start with one argument. + // Output of ArgsEcho: + // [0]=/a + startInfo->Arguments = "/a"; + Process::Start(startInfo); + + // Start with multiple arguments separated by spaces. + // Output of ArgsEcho: + // [0] = /a + // [1] = /b + // [2] = c:\temp + startInfo->Arguments = "/a /b c:\\temp"; + Process::Start(startInfo); + + // An argument with spaces inside quotes is interpreted as multiple arguments. + // Output of ArgsEcho: + // [0] = /a + // [1] = literal string arg + startInfo->Arguments = "/a \"literal string arg\""; + Process::Start(startInfo); + + // An argument inside double quotes is interpreted as if the quote weren't there, + // that is, as separate arguments. + // Output of ArgsEcho: + // [0] = /a + // [1] = /b:string + // [2] = in + // [3] = double + // [4] = quotes + startInfo->Arguments = "/a /b:\"\"string in double quotes\"\""; + Process::Start(startInfo); + + // Triple-escape quotation marks to include the character in the final argument received + // by the target process. + // [0] = /a + // [1] = /b:"quoted string" + startInfo->Arguments = "/a /b:\"\"\"quoted string\"\"\""; + Process::Start(startInfo); + + return 0; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp new file mode 100644 index 00000000000..d4fd5c0b6cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process.Start_static/CPP/processstartstatic3.cpp @@ -0,0 +1,17 @@ +// Place this code into a console project called ArgsEcho to build the argsecho.exe target + +using namespace System; + +int main(array ^args) +{ + Console::WriteLine("Received the following arguments:\n"); + + for (int i = 0; i < args->Length; i++) + { + Console::WriteLine("[" + i + "] = " + args[i]); + } + + Console::WriteLine("\nPress any key to exit"); + Console::ReadLine(); + return 0; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp new file mode 100644 index 00000000000..57ea4cc3263 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule/CPP/processmodule.cpp @@ -0,0 +1,56 @@ +// System::Diagnostics::ProcessModule +/* The following program demonstrates the use of 'ProcessModule' class. +It creates a notepad, gets the 'MainModule' and all other modules of +the process 'notepad.exe', displays some of the properties of each modules. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "Properties of the modules associated with 'notepad' are:" ); + + // Display the properties of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "The moduleName is {0}", myProcessModule->ModuleName ); + Console::WriteLine( "The {0}'s base address is: {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress ); + Console::WriteLine( "The {0}'s Entry point address is: {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress ); + Console::WriteLine( "The {0}'s File name is: {1}", myProcessModule->ModuleName, myProcessModule->FileName ); + } + myProcessModule = myProcess->MainModule; + + // Display the properties of the main module. + Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName ); + Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress ); + Console::WriteLine( "The process's main module's Entry point address is: {0}", myProcessModule->EntryPointAddress ); + Console::WriteLine( "The process's main module's File name is: {0}", myProcessModule->FileName ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp new file mode 100644 index 00000000000..c941fb56f0d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_BaseAddress/CPP/processmodule_baseaddress.cpp @@ -0,0 +1,53 @@ +// System::Diagnostics::ProcessModule::BaseAddress + +/* The following program demonstrates the use of 'BaseAddress' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'BaseAddress' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "Base addresses of the modules associated with 'notepad' are:" ); + + // Display the 'BaseAddress' of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->BaseAddress ); + } + myProcessModule = myProcess->MainModule; + + // Display the 'BaseAddress' of the main module. + Console::WriteLine( "The process's main module's base address is: {0}", myProcessModule->BaseAddress ); + myProcess->CloseMainWindow(); + // + + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp new file mode 100644 index 00000000000..a03a38206d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_EntryPoint/CPP/processmodule_entrypoint.cpp @@ -0,0 +1,50 @@ +// System::Diagnostics::ProcessModule::EntryPointAddress + +/* The following program demonstrates the use of 'EntryPointAddress' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'EntryPointAddress' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "Entry point addresses of the modules associated with 'notepad' are:" ); + + // Display the 'EntryPointAddress' of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->EntryPointAddress ); + } + myProcessModule = myProcess->MainModule; + Console::WriteLine( "The process's main module's EntryPointAddress is: {0}", myProcessModule->EntryPointAddress ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp new file mode 100644 index 00000000000..a67c20e8412 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileName/CPP/processmodule_filename.cpp @@ -0,0 +1,53 @@ +// System::Diagnostics::ProcessModule::FileName + +/* The following program demonstrates the use of 'FileName' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'FileName' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "File names of the modules associated with 'notepad' are:" ); + + // Display the 'FileName' of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "{0:s} : {1:s}", myProcessModule->ModuleName, myProcessModule->FileName ); + } + myProcessModule = myProcess->MainModule; + + // Display the 'FileName' of the main module. + Console::WriteLine( "The process's main module's FileName is: {0}", myProcessModule->FileName ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp new file mode 100644 index 00000000000..62a1569e9f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_FileVersionInfo/CPP/processmodule_fileversioninfo.cpp @@ -0,0 +1,52 @@ +// System::Diagnostics::ProcessModule::FileVersionInfo + +/* The following program demonstrates the use of 'FileVersionInfo' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'FileVersionInfo' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "'FileversionInfo' of the modules associated with 'notepad' are:" ); + + // Display the 'FileVersionInfo' of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->FileVersionInfo ); + } + myProcessModule = myProcess->MainModule; + + // Display the 'FileVersionInfo' of main module. + Console::WriteLine( "The process's main module's FileVersionInfo is: {0}", myProcessModule->FileVersionInfo ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp new file mode 100644 index 00000000000..8d5907528ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleMemorySize/CPP/processmodule_modulememorysize.cpp @@ -0,0 +1,53 @@ +// System::Diagnostics::ProcessModule::ModuleMemorySize + +/* The following program demonstrates the use of 'ModuleMemorySize' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'ModuleMemorySize' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "Module memory sizes of the modules associated with 'notepad' are:" ); + + // Display the 'ModuleMemorySize' of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "{0} : {1}", myProcessModule->ModuleName, myProcessModule->ModuleMemorySize ); + } + myProcessModule = myProcess->MainModule; + + // Display the 'ModuleMemorySize' of the main module. + Console::WriteLine( "The process's main module's ModuleMemorySize is: {0}", myProcessModule->ModuleMemorySize ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp new file mode 100644 index 00000000000..96abbee1dab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ModuleName/CPP/processmodule_modulename.cpp @@ -0,0 +1,53 @@ +// System::Diagnostics::ProcessModule::ModuleName + +/* The following program demonstrates the use of 'ModuleName' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'ModuleName' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' object. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "Module names of the modules associated with 'notepad' are:" ); + + // Display the 'ModuleName' of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( myProcessModule->ModuleName ); + } + myProcessModule = myProcess->MainModule; + + // Display the 'ModuleName' of the main module. + Console::WriteLine( "The process's main moduleName is: {0}", myProcessModule->ModuleName ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp new file mode 100644 index 00000000000..9bd9a254aa0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessModule_ToString/CPP/processmodule_tostring.cpp @@ -0,0 +1,53 @@ +// System::Diagnostics::ProcessModule::ToString + +/* The following program demonstrates the use of 'ToString' property of +'ProcessModule' class. It creates a notepad, gets the 'MainModule' and +all other modules of the process 'notepad.exe', displays 'ToString' +for all the modules and the main module. +*/ + +#using + +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + try + { + // + Process^ myProcess = gcnew Process; + + // Get the process start information of notepad. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "notepad.exe" ); + + // Assign 'StartInfo' of notepad to 'StartInfo' of 'myProcess' Object*. + myProcess->StartInfo = myProcessStartInfo; + + // Create a notepad. + myProcess->Start(); + System::Threading::Thread::Sleep( 1000 ); + ProcessModule^ myProcessModule; + + // Get all the modules associated with 'myProcess'. + ProcessModuleCollection^ myProcessModuleCollection = myProcess->Modules; + Console::WriteLine( "ToString properties of the modules associated with 'notepad' are:" ); + + // Display the ToString of each of the modules. + for ( int i = 0; i < myProcessModuleCollection->Count; i++ ) + { + myProcessModule = myProcessModuleCollection[ i ]; + Console::WriteLine( "{0} : {1}", myProcessModuleCollection[ i ]->ModuleName, myProcessModule->ToString() ); + } + myProcessModule = myProcess->MainModule; + + // Display the ToString of the main module. + Console::WriteLine( "The process's main module is : {0}", myProcessModule->ToString() ); + myProcess->CloseMainWindow(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp b/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp new file mode 100644 index 00000000000..dc1a08793ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProcessOneStream/CPP/stdstr.cpp @@ -0,0 +1,24 @@ +#using + +using namespace System; +using namespace System::Diagnostics; + +void main() +{ + // + // Run "cl.exe /cld stdstr.cpp /link /out:sample.exe". UseShellExecute is false because we're specifying + // an executable directly and in this case depending on it being in a PATH folder. By setting + // RedirectStandardOutput to true, the output of cl.exe is directed to the Process.StandardOutput stream + // which is then displayed in this console window directly. + Process^ compiler = gcnew Process; + compiler->StartInfo->FileName = "cl.exe"; + compiler->StartInfo->Arguments = "/clr stdstr.cpp /link /out:sample.exe"; + compiler->StartInfo->UseShellExecute = false; + compiler->StartInfo->RedirectStandardOutput = true; + compiler->Start(); + + Console::WriteLine( compiler->StandardOutput->ReadToEnd() ); + + compiler->WaitForExit(); + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp b/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp new file mode 100644 index 00000000000..194770fb873 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process_MainWindowTitle/CPP/process_mainwindowtitle.cpp @@ -0,0 +1,41 @@ + + +// System::Diagnostics::Process::MainWindowTitle +/* The following program demonstrates the property 'MainWindowTitle' of class 'Process'. +It creates a new process notepad on local computer and displays its caption to console. +*/ +// +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + try + { + + // Create an instance of process component. + Process^ myProcess = gcnew Process; + + // Create an instance of 'myProcessStartInfo'. + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo; + myProcessStartInfo->FileName = "notepad"; + myProcess->StartInfo = myProcessStartInfo; + + // Start process. + myProcess->Start(); + + // Allow the process to finish starting. + myProcess->WaitForInputIdle(); + Console::Write( "Main window Title : {0}", myProcess->MainWindowTitle ); + myProcess->CloseMainWindow(); + myProcess->Close(); + } + catch ( Exception^ e ) + { + Console::Write( " Message : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp new file mode 100644 index 00000000000..b295733c646 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process_StandardError/CPP/source.cpp @@ -0,0 +1,48 @@ +// System::Diagnostics::Process::StandardError +/* +The following example demonstrates property 'StandardError' of +'Process' class. + +It starts a process(net.exe) which writes an error message on to the standard +error when a bad network path is given. This program gets 'StandardError' of +net.exe process and reads output from its stream reader.*/ + +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::ComponentModel; +using namespace System::IO; + +void GetStandardError( array^args ) +{ +// + Process^ myProcess = gcnew Process; + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "net ",String::Concat( "use ", args[ 0 ] ) ); + + myProcessStartInfo->UseShellExecute = false; + myProcessStartInfo->RedirectStandardError = true; + myProcess->StartInfo = myProcessStartInfo; + myProcess->Start(); + + StreamReader^ myStreamReader = myProcess->StandardError; + // Read the standard error of net.exe and write it on to console. + Console::WriteLine( myStreamReader->ReadLine() ); + myProcess->Close(); +// +} + +void main( int argc, char *argv[] ) +{ + if ( argc < 2 ) + { + Console::WriteLine( "\nThis requires a machine name as a parameter which is not on the network." ); + Console::WriteLine( "\nUsage:" ); + Console::WriteLine( "Process_StandardError <\\\\machine name>" ); + } + else + { + GetStandardError( Environment::GetCommandLineArgs() ); + } + return; +} diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp new file mode 100644 index 00000000000..02249c8a531 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process_StandardInput/CPP/process_standardinput.cpp @@ -0,0 +1,76 @@ + + +/// System.Diagnostics.Process.StandardInput +// +// +// The following example illustrates how to redirect the StandardInput +// stream of a process. The example starts the sort command with +// redirected input. It then prompts the user for text, and passes +// that to the sort command by means of the redirected input stream. +// The sort command results are displayed to the user on the console. +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; +using namespace System::ComponentModel; +int main() +{ + Console::WriteLine( "Ready to sort one or more text lines..." ); + + // Start the Sort.exe process with redirected input. + // Use the sort command to sort the input text. + Process^ myProcess = gcnew Process; + if ( myProcess ) + { + myProcess->StartInfo->FileName = "Sort.exe"; + myProcess->StartInfo->UseShellExecute = false; + myProcess->StartInfo->RedirectStandardInput = true; + myProcess->Start(); + StreamWriter^ myStreamWriter = myProcess->StandardInput; + if ( myStreamWriter ) + { + + // Prompt the user for input text lines to sort. + // Write each line to the StandardInput stream of + // the sort command. + String^ inputText; + int numLines = 0; + do + { + Console::WriteLine( "Enter a line of text (or press the Enter key to stop):" ); + inputText = Console::ReadLine(); + if ( inputText && inputText->Length > 0 ) + { + numLines++; + myStreamWriter->WriteLine( inputText ); + } + } + while ( inputText && inputText->Length != 0 ); + + // Write a report header to the console. + if ( numLines > 0 ) + { + Console::WriteLine( " {0} sorted text line(s) ", numLines.ToString() ); + Console::WriteLine( "------------------------" ); + } + else + { + Console::WriteLine( " No input was sorted" ); + } + + // End the input stream to the sort command. + // When the stream closes, the sort command + // writes the sorted text lines to the + // console. + myStreamWriter->Close(); + } + + // Wait for the sort process to write the sorted text lines. + myProcess->WaitForExit(); + myProcess->Close(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp b/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp new file mode 100644 index 00000000000..6820437e824 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process_StandardOutput/CPP/process_standardoutput.cpp @@ -0,0 +1,26 @@ +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +int main() +{ + Process^ process = gcnew Process(); + process->StartInfo->FileName = "ipconfig.exe"; + process->StartInfo->UseShellExecute = false; + process->StartInfo->RedirectStandardOutput = true; + process->Start(); + + // Synchronously read the standard output of the spawned process-> + StreamReader^ reader = process->StandardOutput; + String^ output = reader->ReadToEnd(); + + // Write the redirected output to this application's window. + Console::WriteLine(output); + + process->WaitForExit(); + process->Close(); + + Console::WriteLine("\n\nPress any key to exit"); + Console::ReadLine(); + return 0; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp new file mode 100644 index 00000000000..7494c07f40a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/process_synchronizingobject.cpp @@ -0,0 +1,110 @@ +// System::Diagnostics::Process::SynchronizingObject + +/* +The following example demonstrates the property 'SynchronizingObject' +of 'Process' class. + +It starts a process 'mspaint.exe' on button click. +It attaches 'MyProcessExited' method of 'MyButton' class as EventHandler to +'Exited' event of the process. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +ref class Form1: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + + // + ref class MyButton: public Button + { + public: + void MyProcessExited( Object^ source, EventArgs^ e ) + { + MessageBox::Show( "The process has exited." ); + } + }; + +public: + MyButton^ button1; +private: + void MyProcessExited( Object^ source, EventArgs^ e ) + { + MessageBox::Show( "The process has exited." ); + } + void button1_Click( Object^ sender, EventArgs^ e ) + { + Process^ myProcess = gcnew Process; + ProcessStartInfo^ myProcessStartInfo = gcnew ProcessStartInfo( "mspaint" ); + myProcess->StartInfo = myProcessStartInfo; + myProcess->Start(); + myProcess->Exited += gcnew System::EventHandler( this, &Form1::MyProcessExited ); + + // Set 'EnableRaisingEvents' to true, to raise 'Exited' event when process is terminated. + myProcess->EnableRaisingEvents = true; + + // Set method handling the exited event to be called ; + // on the same thread on which MyButton was created. + myProcess->SynchronizingObject = button1; + MessageBox::Show( "Waiting for the process 'mspaint' to exit...." ); + myProcess->WaitForExit(); + myProcess->Close(); + } + // + + void InitializeComponent() + { + this->button1 = gcnew MyButton; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 40, 80 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 168, 32 ); + this->button1->TabIndex = 0; + this->button1->Text = "Click Me"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^newControls = {this->button1}; + this->Controls->AddRange( newControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +public: + Form1() + : components( nullptr ) + { + InitializeComponent(); + } +}; + +[STAThread] +void main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp new file mode 100644 index 00000000000..70a6c01850b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Process_SynchronizingObject/CPP/remarks.cpp @@ -0,0 +1,138 @@ +// This is kind of a ripoff of 'process_synchronizingobject.cs' for use as a znippet +// for the remarks section. + +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +namespace SynchronizingObjectTest +{ + public ref class SyncForm : System::Windows::Forms::Form + { + + public: + SyncForm() : components( nullptr ) + { + InitializeComponent(); + } + + ~SyncForm() + { + if ( components != nullptr ) + { + delete components; + } + } + + static void Main() + { + Application::Run(gcnew SyncForm); + } +#if 0 // Dispose is implicit + protected: + virtual void Dispose( bool disposing ) override + { + if( disposing ) + { + if (components != null) + { + components->Dispose(); + } + } + base->Dispose( disposing ); + } +#endif + + private: + System::ComponentModel::Container^ components; + Process^ process1; + Button^ button1; + Label^ label1; + + void InitializeComponent() + { + this->button1 = gcnew Button(); + this->label1 = gcnew Label(); + this->SuspendLayout(); + // + // button1 + // + this->button1->Location = System::Drawing::Point(20, 20); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size(160, 30); + this->button1->TabIndex = 0; + this->button1->Text = "Click Me"; + this->button1->Click += gcnew EventHandler(this, &SyncForm::button1_Click); + // + // textbox + // + this->label1->Location = System::Drawing::Point(20, 20); + this->label1->Name = "textbox1"; + this->label1->Size = System::Drawing::Size(160, 30); + this->label1->TabIndex = 1; + this->label1->Text = "Waiting for the process 'notepad' to exit...."; + this->label1->ForeColor = System::Drawing::Color::Red; + this->label1->Visible = false; + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(200, 70); + this->Controls->Add(this->button1); + this->Controls->Add(this->label1); + this->Name = "SyncForm"; + this->Text = "SyncForm"; + this->ResumeLayout(false); + } + + + + void button1_Click(Object^ sender, System::EventArgs^ e) + { + this->button1->Hide(); + this->label1->Show(); + + process1 = gcnew Process(); + ProcessStartInfo^ process1StartInfo= gcnew ProcessStartInfo("notepad"); + + // + this->process1->StartInfo->Domain = ""; + this->process1->StartInfo->LoadUserProfile = false; + this->process1->StartInfo->Password = nullptr; + this->process1->StartInfo->StandardErrorEncoding = nullptr; + this->process1->StartInfo->StandardOutputEncoding = nullptr; + this->process1->StartInfo->UserName = ""; + this->process1->SynchronizingObject = this; + // + + // Set method handling the exited event to be called + process1->Exited += gcnew EventHandler(this, &SyncForm::TheProcessExited); + // Set 'EnableRaisingEvents' to true, to raise 'Exited' event when process is terminated. + process1->EnableRaisingEvents = true; + + this->Refresh(); + process1->StartInfo = process1StartInfo; + process1->Start(); + + process1->WaitForExit(); + process1->Close(); + } + + void TheProcessExited(Object^ source, EventArgs^ e) + { + this->label1->Hide(); + this->button1->Show(); + MessageBox::Show("The process has exited."); + } + }; +} + +[STAThread] +int main() +{ + SynchronizingObjectTest::SyncForm::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp b/snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp new file mode 100644 index 00000000000..7e27af608f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ProgIdAttribute_Value/CPP/progidattribute_value.cpp @@ -0,0 +1,39 @@ +/* +System::Runtime::InteropServices::ProgIdAttribute.Value + +The program shows MyClass as a COM class with prog id 'InteropSample::MyClass'. +It gets all attributes of MyClass by calling GetAttributes method of TypeDescriptor +then prints the 'Value' property of 'ProgIdAttribute' class. +*/ + +#using + +using namespace System; +using namespace System::Runtime::InteropServices; +using namespace System::ComponentModel; + +// +[ClassInterface(ClassInterfaceType::AutoDispatch)] +[ProgId("InteropSample.MyClass")] +public ref class MyClass +{ +public: + MyClass(){} + +}; + +int main() +{ + try + { + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( MyClass::typeid ); + ProgIdAttribute^ progIdAttributeObj = dynamic_cast(attributes[ ProgIdAttribute::typeid ]); + Console::WriteLine( "ProgIdAttribute's value is set to : {0}", progIdAttributeObj->Value ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp new file mode 100644 index 00000000000..f64e0f64c9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PropertyBuilder_SetGetMethod_4/CPP/propertybuilder_setgetmethod_4.cpp @@ -0,0 +1,130 @@ + +// System.Reflection.Emit.PropertyBuilder.SetGetMethod +// System.Reflection.Emit.PropertyBuilder.SetSetMethod +// System.Reflection.Emit.PropertyBuilder.AddOtherMethod +// System.Reflection.Emit.PropertyBuilder +/* +This following program demonstrates methods 'SetGetMethod','SetSetMethod' and +'AddOtherMethod' of class 'PropertyBuilder'. + +A dynamic assembly is generated with a class having a property 'Greeting'. +Its 'get' and 'set' method are created by returning and setting a string respectively. +This property value is reset with default string using othermethod. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// Create the callee transient dynamic assembly. +Type^ CreateCallee( AppDomain^ myAppDomain, AssemblyBuilderAccess access ) +{ + // Create a simple name for the callee assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Create the callee dynamic assembly. + AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, access ); + + // Create a dynamic module named "EmittedModule" in the callee assembly. + ModuleBuilder^ myModule; + if ( access == AssemblyBuilderAccess::Run ) + { + myModule = myAssemblyBuilder->DefineDynamicModule( "EmittedModule" ); + } + else + { + myModule = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", "EmittedModule.mod" ); + } + + // + TypeBuilder^ helloWorldTypeBuilder = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Define a private String field named "m_greeting" in "HelloWorld" class. + FieldBuilder^ greetingFieldBuilder = helloWorldTypeBuilder->DefineField( "m_greeting", String::typeid, FieldAttributes::Private ); + + // Create constructor args and define constructor. + array^constructorArgs = {String::typeid}; + ConstructorBuilder^ constructor = helloWorldTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, constructorArgs ); + + // Generate IL code for the method. The constructor stores its argument in the private field. + ILGenerator^ constructorIL = constructor->GetILGenerator(); + constructorIL->Emit( OpCodes::Ldarg_0 ); + constructorIL->Emit( OpCodes::Ldarg_1 ); + constructorIL->Emit( OpCodes::Stfld, greetingFieldBuilder ); + constructorIL->Emit( OpCodes::Ret ); + + // + // Define property Greeting. + PropertyBuilder^ greetingPropertyBuilder = helloWorldTypeBuilder->DefineProperty( "Greeting", PropertyAttributes::None, String::typeid, nullptr ); + + // Define the 'get_Greeting' method. + MethodBuilder^ getGreetingMethod = helloWorldTypeBuilder->DefineMethod( "get_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::SpecialName), String::typeid, nullptr ); + + // Generate IL code for 'get_Greeting' method. + ILGenerator^ methodIL = getGreetingMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldarg_0 ); + methodIL->Emit( OpCodes::Ldfld, greetingFieldBuilder ); + methodIL->Emit( OpCodes::Ret ); + greetingPropertyBuilder->SetGetMethod( getGreetingMethod ); + // + + + // Define the set_Greeting method. + array^methodArgs = {String::typeid}; + MethodBuilder^ setGreetingMethod = helloWorldTypeBuilder->DefineMethod( "set_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig | MethodAttributes::SpecialName), void::typeid, methodArgs ); + + // Generate IL code for set_Greeting method. + methodIL = setGreetingMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldarg_0 ); + methodIL->Emit( OpCodes::Ldarg_1 ); + methodIL->Emit( OpCodes::Stfld, greetingFieldBuilder ); + methodIL->Emit( OpCodes::Ret ); + greetingPropertyBuilder->SetSetMethod( setGreetingMethod ); + // + + // + // Define the reset_Greeting method. + MethodBuilder^ otherGreetingMethod = helloWorldTypeBuilder->DefineMethod( "reset_Greeting", static_cast(MethodAttributes::Public | MethodAttributes::HideBySig), void::typeid, nullptr ); + + // Generate IL code for reset_Greeting method. + methodIL = otherGreetingMethod->GetILGenerator(); + methodIL->Emit( OpCodes::Ldarg_0 ); + methodIL->Emit( OpCodes::Ldstr, "Default String." ); + methodIL->Emit( OpCodes::Stfld, greetingFieldBuilder ); + methodIL->Emit( OpCodes::Ret ); + greetingPropertyBuilder->AddOtherMethod( otherGreetingMethod ); + // + + // Create the class HelloWorld. + return (helloWorldTypeBuilder->CreateType()); +} + +int main() +{ + // Create the "HelloWorld" type in an assembly with mode 'RunAndSave'. + Type^ helloWorldType = CreateCallee( Thread::GetDomain(), AssemblyBuilderAccess::RunAndSave ); + + // Create an instance of the "HelloWorld" class. + array^temp0 = {"HelloWorld"}; + Object^ helloWorld = Activator::CreateInstance( helloWorldType, temp0 ); + Object^ returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr ); + Console::WriteLine( "HelloWorld.GetGreeting returned: \"{0}\"", returnValue ); + + // Set 'Greeting' property with 'NewMessage!!!'. + array^temp1 = {"New Message !!!"}; + helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::SetProperty), nullptr, helloWorld, temp1 ); + returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr ); + Console::WriteLine( "After Set operation HelloWorld.GetGreeting returned: \"{0}\"", returnValue ); + + // Reset 'Greeting' property to 'Default String'. + helloWorldType->InvokeMember( "reset_Greeting", static_cast(BindingFlags::Default | BindingFlags::InvokeMethod), nullptr, helloWorld, nullptr ); + returnValue = helloWorldType->InvokeMember( "Greeting", static_cast(BindingFlags::Default | BindingFlags::GetProperty), nullptr, helloWorld, nullptr ); + Console::WriteLine( "After Reset operation HelloWorld.GetGreeting returned: \"{0}\"", returnValue ); + AssemblyBuilder^ myAssembly = dynamic_cast(helloWorldType->Assembly); + + // Save to disk. + myAssembly->Save( "EmittedAssembly.dll" ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp new file mode 100644 index 00000000000..3ec2d28a977 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/Example.cpp @@ -0,0 +1,132 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; + +ref class Example +{ +private: + int static _sharedProperty = 41; + int _instanceProperty; + Dictionary^ _indexedInstanceProperty; + +public: + Example() + { + _instanceProperty = 42; + _indexedInstanceProperty = gcnew Dictionary(); + }; + + static property int SharedProperty + { + int get() { return _sharedProperty; } + void set(int value) { _sharedProperty = value; } + }; + + property int InstanceProperty + { + int get() { return _instanceProperty; } + void set(int value) { _instanceProperty = value; } + }; + + // By default, the name of the default indexed property (class + // indexer) is Item, and that name must be used to search for the + // property with reflection. The property can be given a different + // name by using the IndexerNameAttribute attribute. + property String^ default[int] + { + String^ get(int key) + { + String^ returnValue; + if (_indexedInstanceProperty->TryGetValue(key, returnValue)) + { + return returnValue; + } + else + { + return nullptr; + } + } + void set(int key, String^ value) + { + if (value == nullptr) + { + throw gcnew ArgumentNullException( + "IndexedInstanceProperty value can be an empty string, but it cannot be null."); + } + else + { + if (_indexedInstanceProperty->ContainsKey(key)) + { + _indexedInstanceProperty[key] = value; + } + else + { + _indexedInstanceProperty->Add(key, value); + } + } + } + }; +}; + +void main() +{ + Console::WriteLine("Initial value of class-level property: {0}", + Example::SharedProperty); + + PropertyInfo^ piShared = + Example::typeid->GetProperty("SharedProperty"); + piShared->SetValue(nullptr, 76, nullptr); + + Console::WriteLine("Final value of class-level property: {0}", + Example::SharedProperty); + + + Example^ exam = gcnew Example(); + + Console::WriteLine("\nInitial value of instance property: {0}", + exam->InstanceProperty); + + PropertyInfo^ piInstance = + Example::typeid->GetProperty("InstanceProperty"); + piInstance->SetValue(exam, 37, nullptr); + + Console::WriteLine("Final value of instance property: {0}", + exam->InstanceProperty); + + + exam[17] = "String number 17"; + exam[46] = "String number 46"; + exam[9] = "String number 9"; + + Console::WriteLine( + "\nInitial value of indexed instance property(17): '{0}'", + exam[17]); + + // By default, the name of the default indexed property (class + // indexer) is Item, and that name must be used to search for the + // property with reflection. The property can be given a different + // name by using the IndexerNameAttribute attribute. + PropertyInfo^ piIndexedInstance = + Example::typeid->GetProperty("Item"); + piIndexedInstance->SetValue( + exam, + "New value for string number 17", + gcnew array { 17 }); + + Console::WriteLine("Final value of indexed instance property(17): '{0}'", + exam[17]); +}; + +/* This example produces the following output: + +Initial value of class-level property: 41 +Final value of class-level property: 76 + +Initial value of instance property: 42 +Final value of instance property: 37 + +Initial value of indexed instance property(17): 'String number 17' +Final value of indexed instance property(17): 'New value for string number 17' + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp new file mode 100644 index 00000000000..f6ea3e649aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PropertyInfo.SetValue/cpp/example2.cpp @@ -0,0 +1,65 @@ +// +using namespace System; +using namespace System::Reflection; + +ref class Example +{ +private: + int static _sharedProperty = 41; + int _instanceProperty; + + +public: + Example() + { + _instanceProperty = 42; + }; + + static property int SharedProperty + { + int get() { return _sharedProperty; } + void set(int value) { _sharedProperty = value; } + }; + + property int InstanceProperty + { + int get() { return _instanceProperty; } + void set(int value) { _instanceProperty = value; } + }; + +}; + +void main() +{ + Console::WriteLine("Initial value of static property: {0}", + Example::SharedProperty); + + PropertyInfo^ piShared = + Example::typeid->GetProperty("SharedProperty"); + piShared->SetValue(nullptr, 76, nullptr); + + Console::WriteLine("New value of static property: {0}", + Example::SharedProperty); + + + Example^ exam = gcnew Example(); + + Console::WriteLine("\nInitial value of instance property: {0}", + exam->InstanceProperty); + + PropertyInfo^ piInstance = + Example::typeid->GetProperty("InstanceProperty"); + piInstance->SetValue(exam, 37, nullptr); + + Console::WriteLine("New value of instance property: {0}", + exam->InstanceProperty); +}; + +/* The example displays the following output: + Initial value of static property: 41 + New value of static property: 76 + + Initial value of instance property: 42 + New value of instance property: 37 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp b/snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp new file mode 100644 index 00000000000..9f5c2be1644 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/PtrToStructure/CPP/pts.cpp @@ -0,0 +1,77 @@ +#using + +using namespace System; +using namespace System::Runtime::InteropServices; + +namespace PtrToStructureExample +{ + ref class PtrToStructureTester + { + public: + // + [StructLayout(LayoutKind::Sequential)] + ref class INNER + { + public: + [MarshalAs(UnmanagedType::ByValTStr,SizeConst=10)] + String^ field; + + INNER() + { + field = "Test"; + } + }; + + [StructLayout(LayoutKind::Sequential)] + value struct OUTER + { + public: + [MarshalAs(UnmanagedType::ByValTStr,SizeConst=10)] + String^ field; + + [MarshalAs(UnmanagedType::ByValArray,SizeConst=100)] + array^ inner; + }; + + [DllImport("SomeTestDLL.dll")] + static void CallTest(OUTER^ outerStructurePointer); + + void static Work() + { + OUTER outerStructure; + array^ innerArray = gcnew array(10); + INNER^ innerStructure = gcnew INNER; + int structSize = Marshal::SizeOf(innerStructure); + int size = innerArray->Length * structSize; + outerStructure.inner = gcnew array(size); + + try + { + CallTest(outerStructure); + } + catch (SystemException^ ex) + { + Console::WriteLine(ex->Message); + } + + IntPtr buffer = Marshal::AllocCoTaskMem(structSize * 10); + Marshal::Copy(outerStructure.inner, 0, buffer, structSize * 10); + int currentOffset = 0; + for (int i = 0; i < 10; i++) + { + innerArray[i] = safe_cast(Marshal::PtrToStructure( + IntPtr(buffer.ToInt32() + currentOffset), + INNER::typeid)); + currentOffset += structSize; + } + Console::WriteLine(outerStructure.field); + Marshal::FreeCoTaskMem(buffer); + } + // + }; +} + +void main() +{ + PtrToStructureExample::PtrToStructureTester::Work(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp b/snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp new file mode 100644 index 00000000000..5f87c29dc97 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RIPEMD160/CPP/ripemd160.cpp @@ -0,0 +1,77 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +// Print the byte array in a readable format. +void PrintByteArray( array^array ) +{ + int i; + for ( i = 0; i < array->Length; i++ ) + { + Console::Write( String::Format( "{0:X2}", array[ i ] ) ); + if ( (i % 4) == 3 ) + Console::Write( " " ); + + } + Console::WriteLine(); +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "Usage: hashdir " ); + return 0; + } + + try + { + + // Create a DirectoryInfo object representing the specified directory. + DirectoryInfo^ dir = gcnew DirectoryInfo( args[ 1 ] ); + + // Get the FileInfo objects for every file in the directory. + array^files = dir->GetFiles(); + + // Initialize a RIPE160 hash object. + RIPEMD160 ^ myRIPEMD160 = RIPEMD160Managed::Create(); + array^hashValue; + + // Compute and print the hash values for each file in directory. + System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FileInfo^ fInfo = safe_cast(myEnum->Current); + + // Create a fileStream for the file. + FileStream^ fileStream = fInfo->Open( FileMode::Open ); + + // Compute the hash of the fileStream. + hashValue = myRIPEMD160->ComputeHash( fileStream ); + + // Write the name of the file to the Console. + Console::Write( "{0}: ", fInfo->Name ); + + // Write the hash value to the Console. + PrintByteArray( hashValue ); + + // Close the file. + fileStream->Close(); + } + return 0; + } + catch ( DirectoryNotFoundException^ ) + { + Console::WriteLine( "Error: The directory specified could not be found." ); + } + catch ( IOException^ ) + { + Console::WriteLine( "Error: A file in the directory could not be accessed." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp b/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp new file mode 100644 index 00000000000..743f3c8001f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RNGCSP/cpp/rngcsp.cpp @@ -0,0 +1,75 @@ +// +//The following sample uses the Cryptography class to simulate the roll of a dice. + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Security::Cryptography; + +ref class RNGCSP +{ +public: + // Main method. + static void Main() + { + const int totalRolls = 25000; + array^ results = gcnew array(6); + + // Roll the dice 25000 times and display + // the results to the console. + for (int x = 0; x < totalRolls; x++) + { + Byte roll = RollDice((Byte)results->Length); + results[roll - 1]++; + } + for (int i = 0; i < results->Length; ++i) + { + Console::WriteLine("{0}: {1} ({2:p1})", i + 1, results[i], (double)results[i] / (double)totalRolls); + } + } + + // This method simulates a roll of the dice. The input parameter is the + // number of sides of the dice. + + static Byte RollDice(Byte numberSides) + { + if (numberSides <= 0) + throw gcnew ArgumentOutOfRangeException("numberSides"); + // Create a new instance of the RNGCryptoServiceProvider. + RNGCryptoServiceProvider^ rngCsp = gcnew RNGCryptoServiceProvider(); + // Create a byte array to hold the random value. + array^ randomNumber = gcnew array(1); + do + { + // Fill the array with a random value. + rngCsp->GetBytes(randomNumber); + } + while (!IsFairRoll(randomNumber[0], numberSides)); + // Return the random number mod the number + // of sides. The possible values are zero- + // based, so we add one. + return (Byte)((randomNumber[0] % numberSides) + 1); + } + +private: + static bool IsFairRoll(Byte roll, Byte numSides) + { + // There are MaxValue / numSides full sets of numbers that can come up + // in a single byte. For instance, if we have a 6 sided die, there are + // 42 full sets of 1-6 that come up. The 43rd set is incomplete. + int fullSetsOfValues = Byte::MaxValue / numSides; + + // If the roll is within this range of fair values, then we let it continue. + // In the 6 sided die case, a roll between 0 and 251 is allowed. (We use + // < rather than <= since the = portion allows through an extra 0 value). + // 252 through 255 would provide an extra 0, 1, 2, 3 so they are not fair + // to use. + return roll < numSides * fullSetsOfValues; + } +}; + +int main() +{ + RNGCSP::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp b/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp new file mode 100644 index 00000000000..327d731d991 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ReadTextFile/CPP/readtextfile.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + try + { + // Create an instance of StreamReader to read from a file. + StreamReader^ sr = gcnew StreamReader( "TestFile.txt" ); + try + { + String^ line; + + // Read and display lines from the file until the end of + // the file is reached. + while ( line = sr->ReadLine() ) + { + Console::WriteLine( line ); + } + } + finally + { + if ( sr ) + delete (IDisposable^)sr; + } + } + catch ( Exception^ e ) + { + // Let the user know what went wrong. + Console::WriteLine( "The file could not be read:" ); + Console::WriteLine( e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp b/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp new file mode 100644 index 00000000000..abd2bed7dea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Recursive file finder/CPP/directorylisting.cpp @@ -0,0 +1,69 @@ + +// +// For Directory::GetFiles and Directory::GetDirectories +// +// For File::Exists, Directory::Exists +using namespace System; +using namespace System::IO; +using namespace System::Collections; + +// Insert logic for processing found files here. +void ProcessFile( String^ path ) +{ + Console::WriteLine( "Processed file '{0}'.", path ); +} + + +// Process all files in the directory passed in, recurse on any directories +// that are found, and process the files they contain. +void ProcessDirectory( String^ targetDirectory ) +{ + + // Process the list of files found in the directory. + array^fileEntries = Directory::GetFiles( targetDirectory ); + IEnumerator^ files = fileEntries->GetEnumerator(); + while ( files->MoveNext() ) + { + String^ fileName = safe_cast(files->Current); + ProcessFile( fileName ); + } + + + // Recurse into subdirectories of this directory. + array^subdirectoryEntries = Directory::GetDirectories( targetDirectory ); + IEnumerator^ dirs = subdirectoryEntries->GetEnumerator(); + while ( dirs->MoveNext() ) + { + String^ subdirectory = safe_cast(dirs->Current); + ProcessDirectory( subdirectory ); + } +} + +int main( int argc, char *argv[] ) +{ + for ( int i = 1; i < argc; i++ ) + { + String^ path = gcnew String(argv[ i ]); + if ( File::Exists( path ) ) + { + + // This path is a file + ProcessFile( path ); + } + else + if ( Directory::Exists( path ) ) + { + + // This path is a directory + ProcessDirectory( path ); + } + else + { + Console::WriteLine( "{0} is not a valid file or directory.", path ); + } + + } +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp new file mode 100644 index 00000000000..28a75c1bc29 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.All/cpp/source.cpp @@ -0,0 +1,253 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Globalization; + +// Declare a delegate type that can be used to execute the completed +// dynamic method. +private delegate int HelloDelegate(String^ msg, int ret); + +void main() +{ + // Create an array that specifies the types of the parameters + // of the dynamic method. This dynamic method has a String + // parameter and an Integer parameter. + array^ helloArgs = { String::typeid, int::typeid }; + + // Create a dynamic method with the name "Hello", a return type + // of Integer, and two parameters whose types are specified by + // the array helloArgs. Create the method in the module that + // defines the String class. + DynamicMethod^ hello = gcnew DynamicMethod("Hello", + int::typeid, + helloArgs, + String::typeid->Module); + + // + // Create an array that specifies the parameter types of the + // overload of Console::WriteLine to be used in Hello. + array^ writeStringArgs = { String::typeid }; + // Get the overload of Console::WriteLine that has one + // String parameter. + MethodInfo^ writeString = Console::typeid->GetMethod("WriteLine", + writeStringArgs); + + // Get an ILGenerator and emit a body for the dynamic method, + // using a stream size larger than the IL that will be + // emitted. + ILGenerator^ il = hello->GetILGenerator(256); + // Load the first argument, which is a string, onto the stack. + il->Emit(OpCodes::Ldarg_0); + // Call the overload of Console::WriteLine that prints a string. + il->EmitCall(OpCodes::Call, writeString, nullptr); + // The Hello method returns the value of the second argument; + // to do this, load the onto the stack and return. + il->Emit(OpCodes::Ldarg_1); + il->Emit(OpCodes::Ret); + // + + // + // Add parameter information to the dynamic method. (This is not + // necessary, but can be useful for debugging.) For each parameter, + // identified by position, supply the parameter attributes and a + // parameter name. + hello->DefineParameter(1, ParameterAttributes::In, "message"); + hello->DefineParameter(2, ParameterAttributes::In, "valueToReturn"); + // + + // + // Create a delegate that represents the dynamic method. This + // action completes the method. Any further attempts to + // change the method are ignored. + HelloDelegate^ hi = + (HelloDelegate^) hello->CreateDelegate(HelloDelegate::typeid); + + // Use the delegate to execute the dynamic method. + Console::WriteLine("\r\nUse the delegate to execute the dynamic method:"); + int retval = hi("\r\nHello, World!", 42); + Console::WriteLine("Invoking delegate hi(\"Hello, World!\", 42) returned: " + retval); + + // Execute it again, with different arguments. + retval = hi("\r\nHi, Mom!", 5280); + Console::WriteLine("Invoking delegate hi(\"Hi, Mom!\", 5280) returned: " + retval); + // + + // + Console::WriteLine("\r\nUse the Invoke method to execute the dynamic method:"); + // Create an array of arguments to use with the Invoke method. + array^ invokeArgs = { "\r\nHello, World!", 42 }; + // Invoke the dynamic method using the arguments. This is much + // slower than using the delegate, because you must create an + // array to contain the arguments, and value-type arguments + // must be boxed. + Object^ objRet = hello->Invoke(nullptr, BindingFlags::ExactBinding, nullptr, invokeArgs, gcnew CultureInfo("en-us")); + Console::WriteLine("hello.Invoke returned: " + objRet); + // + + Console::WriteLine("\r\n ----- Display information about the dynamic method -----"); + // + // Display MethodAttributes for the dynamic method, set when + // the dynamic method was created. + Console::WriteLine("\r\nMethod Attributes: {0}", hello->Attributes); + // + + // + // Display the calling convention of the dynamic method, set when the + // dynamic method was created. + Console::WriteLine("\r\nCalling convention: {0}", hello->CallingConvention); + // + + // + // Display the declaring type, which is always null for dynamic + // methods. + if (hello->DeclaringType == nullptr) + { + Console::WriteLine("\r\nDeclaringType is always null for dynamic methods."); + } + else + { + Console::WriteLine("DeclaringType: {0}", hello->DeclaringType); + } + // + + // + // Display the default value for InitLocals. + if (hello->InitLocals) + { + Console::Write("\r\nThis method contains verifiable code."); + } + else + { + Console::Write("\r\nThis method contains unverifiable code."); + } + Console::WriteLine(" (InitLocals = {0})", hello->InitLocals); + // + + // + // Display the module specified when the dynamic method was created. + Console::WriteLine("\r\nModule: {0}", hello->Module); + // + + // + // Display the name specified when the dynamic method was created. + // Note that the name can be blank. + Console::WriteLine("\r\nName: {0}", hello->Name); + // + + // + // For dynamic methods, the reflected type is always null. + if (hello->ReflectedType == nullptr) + { + Console::WriteLine("\r\nReflectedType is null."); + } + else + { + Console::WriteLine("\r\nReflectedType: {0}", hello->ReflectedType); + } + // + + // + if (hello->ReturnParameter == nullptr) + { + Console::WriteLine("\r\nMethod has no return parameter."); + } + else + { + Console::WriteLine("\r\nReturn parameter: {0}", hello->ReturnParameter); + } + // + + // + // If the method has no return type, ReturnType is System.Void. + Console::WriteLine("\r\nReturn type: {0}", hello->ReturnType); + // + + // + // ReturnTypeCustomAttributes returns an ICustomeAttributeProvider + // that can be used to enumerate the custom attributes of the + // return value. At present, there is no way to set such custom + // attributes, so the list is empty. + if (hello->ReturnType == Void::typeid) + { + Console::WriteLine("The method has no return type."); + } + else + { + ICustomAttributeProvider^ caProvider = hello->ReturnTypeCustomAttributes; + array^ returnAttributes = caProvider->GetCustomAttributes(true); + if (returnAttributes->Length == 0) + { + Console::WriteLine("\r\nThe return type has no custom attributes."); + } + else + { + Console::WriteLine("\r\nThe return type has the following custom attributes:"); + for each (Object^ attr in returnAttributes) + { + Console::WriteLine("\t{0}", attr->ToString()); + } + } + } + // + + // + Console::WriteLine("\r\nToString: {0}", hello->ToString()); + // + + // + // Display parameter information. + array^ parameters = hello->GetParameters(); + Console::WriteLine("\r\nParameters: name, type, ParameterAttributes"); + for each (ParameterInfo^ p in parameters) + { + Console::WriteLine("\t{0}, {1}, {2}", + p->Name, p->ParameterType, p->Attributes); + } + // +} + +/* This code example produces the following output: + +Use the delegate to execute the dynamic method: + +Hello, World! +Invoking delegate hi("Hello, World!", 42) returned: 42 + +Hi, Mom! +Invoking delegate hi("Hi, Mom!", 5280) returned: 5280 + +Use the Invoke method to execute the dynamic method: + +Hello, World! +hello.Invoke returned: 42 + + ----- Display information about the dynamic method ----- + +Method Attributes: PrivateScope, Public, Static + +Calling convention: Standard + +DeclaringType is always null for dynamic methods. + +This method contains verifiable code. (InitLocals = True) + +Module: CommonLanguageRuntimeLibrary + +Name: Hello + +ReflectedType is null. + +Method has no return parameter. + +Return type: System.Int32 + +The return type has no custom attributes. + +ToString: Int32 Hello(System.String, Int32) + +Parameters: name, type, ParameterAttributes + message, System.String, In + valueToReturn, System.Int32, In + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp new file mode 100644 index 00000000000..86d3112fd26 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Reflection.DynamicMethod.ctor1/cpp/source.cpp @@ -0,0 +1,81 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class Test +{ +}; + +// Declare a delegate that will be used to execute the completed +// dynamic method. +delegate int HelloInvoker(String^ msg, int ret); + +int main() +{ + // Create an array that specifies the types of the parameters + // of the dynamic method. This method has a string parameter + // and an int parameter. + array^ helloArgs = {String::typeid, int::typeid}; + + // Create a dynamic method with the name "Hello", a return type + // of int, and two parameters whose types are specified by the + // array helloArgs. Create the method in the module that + // defines the Test class. + DynamicMethod^ hello = gcnew DynamicMethod("Hello", + int::typeid, + helloArgs, + Test::typeid->Module); + + // + // Create an array that specifies the parameter types of the + // overload of Console.WriteLine to be used in Hello. + array^ writeStringArgs = {String::typeid}; + // Get the overload of Console.WriteLine that has one + // String parameter. + MethodInfo^ writeString = + Console::typeid->GetMethod("WriteLine", writeStringArgs); + + // Get an ILGenerator and emit a body for the dynamic method. + ILGenerator^ ilgen = hello->GetILGenerator(); + // Load the first argument, which is a string, onto the stack. + ilgen->Emit(OpCodes::Ldarg_0); + // Call the overload of Console.WriteLine that prints a string. + ilgen->EmitCall(OpCodes::Call, writeString, nullptr); + // The Hello method returns the value of the second argument; + // to do this, load the onto the stack and return. + ilgen->Emit(OpCodes::Ldarg_1); + ilgen->Emit(OpCodes::Ret); + // + + // + // Create a delegate that represents the dynamic method. This + // action completes the method, and any further attempts to + // change the method will cause an exception. + HelloInvoker^ helloDelegate = + (HelloInvoker^) hello->CreateDelegate(HelloInvoker::typeid); + // + + // Use the delegate to execute the dynamic method. Save and + // print the return value. + int returnValue = helloDelegate("\r\nHello, World!", 42); + Console::WriteLine("helloDelegate(\"Hello, World!\", 42) returned {0}", + returnValue); + + // Do it again, with different arguments. + returnValue = helloDelegate("\r\nHi, Mom!", 5280); + Console::WriteLine("helloDelegate(\"Hi, Mom!\", 5280) returned {0}", + returnValue); + + // + // Create an array of arguments to use with the Invoke method. + array^ delegateArgs = {"\r\nHello, World!", 42}; + // Invoke the dynamic method using the arguments. This is much + // slower than using the delegate, because you must create an + // array to contain the arguments, and ValueType arguments + // must be boxed. + Object^ returnValueObject = hello->Invoke(nullptr, delegateArgs); + Console::WriteLine("hello.Invoke returned {0}", returnValueObject); + // +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp b/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp new file mode 100644 index 00000000000..f6f2d74c1e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Reflection/CPP/reflection.cpp @@ -0,0 +1,172 @@ +// +using namespace System; +using namespace System::Reflection; + +static void Display(Int32 indent, String^ format, ... array^param) +{ + Console::Write("{0}", gcnew String (' ', indent)); + Console::WriteLine(format, param); +} + +// Displays the custom attributes applied to the specified member. +static void DisplayAttributes(Int32 indent, MemberInfo^ mi) +{ + // Get the set of custom attributes; if none exist, just return. + array^attrs = mi->GetCustomAttributes(false); + + if (attrs->Length==0) + { + return; + } + + // Display the custom attributes applied to this member. + Display(indent+1, "Attributes:"); + for each ( Object^ o in attrs ) + { + Display(indent*2, "{0}", o); + } +} + +void main() +{ + try + { + // This variable holds the amount of indenting that + // should be used when displaying each line of information. + Int32 indent = 0; + // Display information about the EXE assembly. + // + Assembly^ a = System::Reflection::Assembly::GetExecutingAssembly(); + + Display(indent, "Assembly identity={0}", gcnew array {a->FullName}); + Display(indent+1, "Codebase={0}", gcnew array {a->CodeBase}); + + // Display the set of assemblies our assemblies reference. + + Display(indent, "Referenced assemblies:"); + + for each ( AssemblyName^ an in a->GetReferencedAssemblies() ) + { + Display(indent + 1, "Name={0}, Version={1}, Culture={2}, PublicKey token={3}", gcnew array {an->Name, an->Version, an->CultureInfo, (BitConverter::ToString(an->GetPublicKeyToken()))}); + } + // + Display(indent, ""); + // Display information about each assembly loading into this AppDomain. + for each ( Assembly^ b in AppDomain::CurrentDomain->GetAssemblies()) + { + Display(indent, "Assembly: {0}", gcnew array {b}); + // Display information about each module of this assembly. + + for each ( Module^ m in b->GetModules(true) ) + { + Display(indent+1, "Module: {0}", gcnew array {m->Name}); + } + // Display information about each type exported from this assembly. + + indent += 1; + for each ( Type^ t in b->GetExportedTypes() ) + { + Display(0, ""); + Display(indent, "Type: {0}", gcnew array {t}); + + // For each type, show its members & their custom attributes. + + indent += 1; + for each (MemberInfo^ mi in t->GetMembers() ) + { + Display(indent, "Member: {0}", gcnew array {mi->Name}); + DisplayAttributes(indent, mi); + + // If the member is a method, display information about its parameters. + if (mi->MemberType==MemberTypes::Method) + { + + for each ( ParameterInfo^ pi in (((MethodInfo^) mi)->GetParameters())) + { + Display(indent+1, "Parameter: Type={0}, Name={1}", gcnew array {pi->ParameterType, pi->Name}); + } + } + + // If the member is a property, display information about the property's accessor methods. + if (mi->MemberType==MemberTypes::Property) + { + for each ( MethodInfo^ am in (((PropertyInfo^) mi)->GetAccessors()) ) + { + Display(indent+1, "Accessor method: {0}", gcnew array {am}); + } + } + } + // Display a formatted string indented by the specified amount. + indent -= 1; + } + indent -= 1; + } + } + catch (Exception^ e) + { + Console::WriteLine(e->Message); + } +} + +// The output shown below is abbreviated. +// +//Assembly identity=Reflection, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +// Codebase=file:///C:/Reflection.exe +//Referenced assemblies: +// Name=mscorlib, Version=1.0.5000.0, Culture=, PublicKey token=B7-7A-5C-56-19-34-E0-89 +// Name=Microsoft.VisualBasic, Version=7.0.5000.0, Culture=, PublicKey token=B0-3F-5F-7F-11-D5-0A-3A +// +//Assembly: mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 +// Module: mscorlib.dll +// Module: prc.nlp +// Module: prcp.nlp +// Module: ksc.nlp +// Module: ctype.nlp +// Module: xjis.nlp +// Module: bopomofo.nlp +// Module: culture.nlp +// Module: region.nlp +// Module: sortkey.nlp +// Module: charinfo.nlp +// Module: big5.nlp +// Module: sorttbls.nlp +// Module: l_intl.nlp +// Module: l_except.nlp +// +// Type: System.Object +// Member: GetHashCode +// Member: Equals +// Parameter: Type=System.Object, Name=obj +// Member: ToString +// Member: Equals +// Parameter: Type=System.Object, Name=objA +// Parameter: Type=System.Object, Name=objB +// Member: ReferenceEquals +// Parameter: Type=System.Object, Name=objA +// Parameter: Type=System.Object, Name=objB +// Member: GetType +// Member: .ctor +// +// Type: System.ICloneable +// Member: Clone +// +// Type: System.Collections.IEnumerable +// Member: GetEnumerator +// Attributes: +// System.Runtime.InteropServices.DispIdAttribute +// +// Type: System.Collections.ICollection +// Member: get_IsSynchronized +// Member: get_SyncRoot +// Member: get_Count +// Member: CopyTo +// Parameter: Type=System.Array, Name=array +// Parameter: Type=System.Int32, Name=index +// Member: Count +// Accessor method: Int32 get_Count() +// Member: SyncRoot +// Accessor method: System.Object get_SyncRoot() +// Member: IsSynchronized +// Accessor method: Boolean get_IsSynchronized() +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp b/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp new file mode 100644 index 00000000000..1cfed0722c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Regex_Words/CPP/words.cpp @@ -0,0 +1,36 @@ +// +#using + +using namespace System; +using namespace System::Text::RegularExpressions; +int main() +{ + // + // Define a regular expression for repeated words. + Regex^ rx = gcnew Regex( "\\b(?\\w+)\\s+(\\k)\\b",static_cast(RegexOptions::Compiled | RegexOptions::IgnoreCase) ); + // + + // Define a test string. + String^ text = "The the quick brown fox fox jumps over the lazy dog dog."; + + // + // Find matches. + MatchCollection^ matches = rx->Matches( text ); + // + + // + // Report the number of matches found. + Console::WriteLine( "{0} matches found.", matches->Count ); + // + + // + // Report on each match. + for each (Match^ match in matches) + { + String^ word = match->Groups["word"]->Value; + int index = match->Index; + Console::WriteLine("{0} repeated at position {1}", word, index); + } + // +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp b/snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp new file mode 100644 index 00000000000..2b2373c1b72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RegistryKey.OpenSubKey/CPP/opensubkey.cpp @@ -0,0 +1,41 @@ +// +#using + +using namespace System; +using namespace Microsoft::Win32; +using namespace Microsoft::VisualBasic; + +int main() +{ + // Delete and recreate the test key. + Registry::CurrentUser->DeleteSubKey( L"RegistryOpenSubKeyExample", false ); + RegistryKey ^ rk = Registry::CurrentUser->CreateSubKey( L"RegistryOpenSubKeyExample" ); + rk->Close(); + + // Obtain an instance of RegistryKey for the CurrentUser registry + // root. + RegistryKey ^ rkCurrentUser = Registry::CurrentUser; + + // Obtain the test key (read-only) and display it. + RegistryKey ^ rkTest = rkCurrentUser->OpenSubKey( L"RegistryOpenSubKeyExample" ); + Console::WriteLine( L"Test key: {0}", rkTest ); + rkTest->Close(); + rkCurrentUser->Close(); + + // Obtain the test key in one step, using the CurrentUser registry + // root. + rkTest = Registry::CurrentUser->OpenSubKey( L"RegistryOpenSubKeyExample" ); + Console::WriteLine( L"Test key: {0}", rkTest ); + rkTest->Close(); + + // Open the test key in read/write mode. + rkTest = Registry::CurrentUser->OpenSubKey( L"RegistryOpenSubKeyExample", true ); + rkTest->SetValue( L"TestName", L"TestValue" ); + Console::WriteLine( L"Test value for TestName: {0}", rkTest->GetValue( L"TestName" ) ); + rkTest->Close(); + + return 0; +} //Main +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp new file mode 100644 index 00000000000..a7c67a66588 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RegistrySecurity101/cpp/source.cpp @@ -0,0 +1,145 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace Microsoft::Win32; +using namespace System::Security::AccessControl; +using namespace System::Security; + +int main() +{ + // Delete the example key if it exists. + try + { + Registry::CurrentUser->DeleteSubKey("RegistryRightsExample"); + Console::WriteLine("Example key has been deleted."); + } + catch (ArgumentException^) + { + // ArgumentException is thrown if the key does not exist. In + // this case, there is no reason to display a message. + } + catch (InvalidOperationException^ ex) + { + Console::WriteLine( + "{0}Unable to delete key: it appears to have child subkeys:{0}{1}", + Environment::NewLine, ex); + return 0; + } + catch (SecurityException^ ex) + { + Console::WriteLine("{0}You do not have the permissions required " + + "to delete this key:{0}{1}", Environment::NewLine, ex); + return 0; + } + + String^ user = Environment::UserDomainName + "\\" + Environment::UserName; + + RegistrySecurity^ regSecurity = gcnew RegistrySecurity(); + + // Allow the current user to read and delete the key. + // + regSecurity->AddAccessRule(gcnew RegistryAccessRule(user, + RegistryRights::ReadKey | RegistryRights::Delete, + InheritanceFlags::None, + PropagationFlags::None, + AccessControlType::Allow)); + + // Prevent the current user from writing or changing the + // permission set of the key. Note that if Delete permission + // were not allowed in the previous access rule, denying + // WriteKey permission would prevent the user from deleting the + // key. + regSecurity->AddAccessRule(gcnew RegistryAccessRule(user, + RegistryRights::WriteKey | RegistryRights::ChangePermissions, + InheritanceFlags::None, + PropagationFlags::None, + AccessControlType::Deny)); + + // Create the example key with registry security. + RegistryKey^ createdKey = nullptr; + try + { + createdKey = Registry::CurrentUser->CreateSubKey( + "RegistryRightsExample", RegistryKeyPermissionCheck::Default, + regSecurity); + Console::WriteLine("{0}Example key created.", Environment::NewLine); + createdKey->SetValue("ValueName", "StringValue"); + } + catch (SecurityException^ ex) + { + Console::WriteLine("{0}You do not have the permissions required " + + "to create the example key:{0}{1}", Environment::NewLine, ex); + return 0; + } + if (createdKey != nullptr) + { + createdKey->Close(); + } + + RegistryKey^ openedKey; + + // Open the key with read access. + openedKey = Registry::CurrentUser->OpenSubKey("RegistryRightsExample", + false); + Console::WriteLine("{0}Retrieved value: {1}", + Environment::NewLine, openedKey->GetValue("ValueName")); + openedKey->Close(); + + // Attempt to open the key with write access. + try + { + openedKey = Registry::CurrentUser->OpenSubKey("RegistryRightsExample", + true); + } + catch (SecurityException^ ex) + { + Console::WriteLine("{0}You do not have the permissions required " + + "to write to the example key:{0}{1}", Environment::NewLine, ex); + } + if (openedKey != nullptr) + { + openedKey->Close(); + } + + // Attempt to change permissions for the key. + try + { + regSecurity = gcnew RegistrySecurity(); + regSecurity->AddAccessRule(gcnew RegistryAccessRule(user, + RegistryRights::WriteKey, + InheritanceFlags::None, + PropagationFlags::None, + AccessControlType::Allow)); + openedKey = Registry::CurrentUser->OpenSubKey("RegistryRightsExample", + false); + openedKey->SetAccessControl(regSecurity); + Console::WriteLine("{0}Example key permissions were changed.", + Environment::NewLine); + } + catch (UnauthorizedAccessException^ ex) + { + Console::WriteLine("{0}You are not authorized to change " + + "permissions for the example key:{0}{1}", Environment::NewLine, ex); + } + if (openedKey != nullptr) + { + openedKey->Close(); + } + + Console::WriteLine("{0}Press Enter to delete the example key.", + Environment::NewLine); + Console::ReadLine(); + + try + { + Registry::CurrentUser->DeleteSubKey("RegistryRightsExample"); + Console::WriteLine("Example key was deleted."); + } + catch(SecurityException^ ex) + { + Console::WriteLine("{0}You do not have the permissions required to " + + "delete the example key:{0}{1}", Environment::NewLine, ex); + } +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp b/snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp new file mode 100644 index 00000000000..ab2f233cbf5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RegistryValueOptions/CPP/RegistryValueOptions.cpp @@ -0,0 +1,30 @@ +// +#using + +using namespace System; +using namespace Microsoft::Win32; +using namespace Microsoft::VisualBasic; + +int main() +{ + // Delete and recreate the test key. + Registry::CurrentUser->DeleteSubKey( L"RegistryValueOptionsExample", false ); + RegistryKey ^ rk = + Registry::CurrentUser->CreateSubKey( L"RegistryValueOptionsExample" ); + + // Add a value that contains an environment variable. + rk->SetValue( L"ExpandValue", L"The path is %PATH%", + RegistryValueKind::ExpandString ); + + // Retrieve the value, first without expanding the environment + // variable and then expanding it. + Console::WriteLine( L"Unexpanded: \"{0}\"", + rk->GetValue( L"ExpandValue", + L"No Value", + RegistryValueOptions::DoNotExpandEnvironmentNames ) ); + Console::WriteLine( L"Expanded: \"{0}\"", rk->GetValue( L"ExpandValue" ) ); + + return 0; +} //Main +// + diff --git a/snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp new file mode 100644 index 00000000000..8810e3a661a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RemotingServices.SetObjectUriForMarshal/CPP/source.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Security::Permissions; + +public ref class SetObjectUriForMarshalTest +{ +public: + ref class TestClass: public MarshalByRefObject{}; + + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::RemotingConfiguration)] + static void Main() + { + TestClass^ obj = gcnew TestClass; + RemotingServices::SetObjectUriForMarshal( obj, "testUri" ); + RemotingServices::Marshal(obj); + Console::WriteLine( RemotingServices::GetObjectUri( obj ) ); + } + +}; +// + +int main() +{ + SetObjectUriForMarshalTest::TestClass^ testerobject = gcnew SetObjectUriForMarshalTest::TestClass; + SetObjectUriForMarshalTest::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp b/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp new file mode 100644 index 00000000000..a3567246321 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ResourcePermissionBase/CPP/resourcepermissionbase.cpp @@ -0,0 +1,149 @@ +// +#using + +using namespace System; +using namespace System::Security::Permissions; +using namespace System::Collections; + +[Flags] + +public enum class MailslotPermissionAccess +{ + None = 0, + Send = 1 << 1, + Receive = 1 << 2 | MailslotPermissionAccess::Send +}; + + +[Serializable] +public ref class MailslotPermissionEntry +{ +private: + String^ name; + String^ machineName; + MailslotPermissionAccess permissionAccess; + +internal: + MailslotPermissionEntry( ResourcePermissionBaseEntry^ baseEntry ) + { + this->permissionAccess = (MailslotPermissionAccess)baseEntry->PermissionAccess; + this->name = baseEntry->PermissionAccessPath[ 0 ]->ToString(); + this->machineName = baseEntry->PermissionAccessPath[ 1 ]->ToString(); + } + + ResourcePermissionBaseEntry^ GetBaseEntry() + { + array^newStrings = {this->Name,this->MachineName}; + ResourcePermissionBaseEntry^ baseEntry = gcnew ResourcePermissionBaseEntry( (int)(this->PermissionAccess),newStrings ); + return baseEntry; + } + +public: + MailslotPermissionEntry( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName ) + { + this->permissionAccess = permissionAccess; + this->name = name; + this->machineName = machineName; + } + + property String^ Name + { + String^ get() + { + return this->name; + } + } + + property String^ MachineName + { + String^ get() + { + return this->machineName; + } + } + + property MailslotPermissionAccess PermissionAccess + { + MailslotPermissionAccess get() + { + return this->permissionAccess; + } + } +}; + + +[Serializable] +public ref class MailslotPermission: public ResourcePermissionBase +{ +private: + ArrayList^ innerCollection; + void SetNames() + { + this->PermissionAccessType = MailslotPermissionAccess::typeid; + array^newStrings = {"Name","Machine"}; + this->TagNames = newStrings; + } + + +internal: + void AddPermissionAccess( MailslotPermissionEntry^ entry ) + { + ResourcePermissionBase::AddPermissionAccess( entry->GetBaseEntry() ); + } + + void Clear() + { + ResourcePermissionBase::Clear(); + } + + void RemovePermissionAccess( MailslotPermissionEntry^ entry ) + { + ResourcePermissionBase::RemovePermissionAccess( entry->GetBaseEntry() ); + } + + +public: + MailslotPermission() + { + SetNames(); + } + + MailslotPermission( PermissionState state ) + : ResourcePermissionBase( state ) + { + SetNames(); + } + + // + MailslotPermission( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName ) + { + SetNames(); + this->AddPermissionAccess( gcnew MailslotPermissionEntry( permissionAccess,name,machineName ) ); + } + + MailslotPermission( array^permissionAccessEntries ) + { + SetNames(); + if ( permissionAccessEntries == nullptr ) + throw gcnew ArgumentNullException( "permissionAccessEntries" ); + + for ( int index = 0; index < permissionAccessEntries->Length; ++index ) + this->AddPermissionAccess( permissionAccessEntries[ index ] ); + } + // + + property ArrayList^ PermissionEntries + { + ArrayList^ get() + { + if ( this->innerCollection == nullptr ) + this->innerCollection = gcnew ArrayList; + + this->innerCollection->InsertRange( 0, safe_cast(ResourcePermissionBase::GetPermissionEntries()) ); + return this->innerCollection; + } + } +}; +// + +void main(){} diff --git a/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp new file mode 100644 index 00000000000..cb616efc570 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RijndaelManaged Example/CPP/class1.cpp @@ -0,0 +1,172 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + + +class RijndaelMemoryExample +{ +public: + static array^ encryptStringToBytes_AES(String^ plainText, array^ Key, array^ IV) + { + // Check arguments. + if (!plainText || plainText->Length <= 0) + throw gcnew ArgumentNullException("plainText"); + if (!Key || Key->Length <= 0) + throw gcnew ArgumentNullException("Key"); + if (!IV || IV->Length <= 0) + throw gcnew ArgumentNullException("IV"); + + // Declare the streams used + // to encrypt to an in memory + // array of bytes. + MemoryStream^ msEncrypt; + CryptoStream^ csEncrypt; + StreamWriter^ swEncrypt; + + // Declare the RijndaelManaged object + // used to encrypt the data. + RijndaelManaged^ aesAlg; + + try + { + // Create a RijndaelManaged object + // with the specified key and IV. + aesAlg = gcnew RijndaelManaged(); + aesAlg->Padding = PaddingMode::PKCS7; + aesAlg->Key = Key; + aesAlg->IV = IV; + + // Create an encryptor to perform the stream transform. + ICryptoTransform^ encryptor = aesAlg->CreateEncryptor(aesAlg->Key, aesAlg->IV); + + // Create the streams used for encryption. + msEncrypt = gcnew MemoryStream(); + csEncrypt = gcnew CryptoStream(msEncrypt, encryptor, CryptoStreamMode::Write); + swEncrypt = gcnew StreamWriter(csEncrypt); + + //Write all data to the stream. + swEncrypt->Write(plainText); + swEncrypt->Flush(); + csEncrypt->FlushFinalBlock(); + msEncrypt->Flush(); + } + finally + { + // Clean things up. + + // Close the streams. + if(swEncrypt) + swEncrypt->Close(); + if (csEncrypt) + csEncrypt->Close(); + + + // Clear the RijndaelManaged object. + if (aesAlg) + aesAlg->Clear(); + } + + // Return the encrypted bytes from the memory stream. + return msEncrypt->ToArray(); + } + + static String^ decryptStringFromBytes_AES(array^ cipherText, array^ Key, array^ IV) + { + // Check arguments. + if (!cipherText || cipherText->Length <= 0) + throw gcnew ArgumentNullException("cipherText"); + if (!Key || Key->Length <= 0) + throw gcnew ArgumentNullException("Key"); + if (!IV || IV->Length <= 0) + throw gcnew ArgumentNullException("IV"); + + // TDeclare the streams used + // to decrypt to an in memory + // array of bytes. + MemoryStream^ msDecrypt; + CryptoStream^ csDecrypt; + StreamReader^ srDecrypt; + + // Declare the RijndaelManaged object + // used to decrypt the data. + RijndaelManaged^ aesAlg; + + // Declare the string used to hold + // the decrypted text. + String^ plaintext; + + try + { + // Create a RijndaelManaged object + // with the specified key and IV. + aesAlg = gcnew RijndaelManaged(); + aesAlg->Padding = PaddingMode::PKCS7; + aesAlg->Key = Key; + aesAlg->IV = IV; + + // Create a decryptor to perform the stream transform. + ICryptoTransform^ decryptor = aesAlg->CreateDecryptor(aesAlg->Key, aesAlg->IV); + + // Create the streams used for decryption. + msDecrypt = gcnew MemoryStream(cipherText); + csDecrypt = gcnew CryptoStream(msDecrypt, decryptor, CryptoStreamMode::Read); + srDecrypt = gcnew StreamReader(csDecrypt); + + // Read the decrypted bytes from the decrypting stream + // and place them in a string. + plaintext = srDecrypt->ReadToEnd(); + } + finally + { + // Clean things up. + + // Close the streams. + if (srDecrypt) + srDecrypt->Close(); + if (csDecrypt) + csDecrypt->Close(); + if (msDecrypt) + msDecrypt->Close(); + + // Clear the RijndaelManaged object. + if (aesAlg) + aesAlg->Clear(); + } + + return plaintext; + } +}; + +int main() +{ + try + { + String^ original = "Here is some data to encrypt!"; + + // Create a new instance of the RijndaelManaged + // class. This generates a new key and initialization + // vector (IV). + RijndaelManaged^ myRijndael = gcnew RijndaelManaged(); + + // Encrypt the string to an array of bytes. + array^ encrypted = RijndaelMemoryExample::encryptStringToBytes_AES(original, myRijndael->Key, myRijndael->IV); + + // Decrypt the bytes to a string. + String^ roundtrip = RijndaelMemoryExample::decryptStringFromBytes_AES(encrypted, myRijndael->Key, myRijndael->IV); + + //Display the original data and the decrypted data. + Console::WriteLine("Original: {0}", original); + Console::WriteLine("Round Trip: {0}", roundtrip); + } + catch (Exception^ e) + { + Console::WriteLine("Error: {0}", e->Message); + } + + return 0; +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp new file mode 100644 index 00000000000..261c5964049 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsBoxed/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsBoxed::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp new file mode 100644 index 00000000000..6bcd696486c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsByValue/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsByValue::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp new file mode 100644 index 00000000000..83156793bc8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsConst/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsConst::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp new file mode 100644 index 00000000000..80c5153f951 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsExplicitlyDereferenced/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsExplicitlyDereferenced::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.IntPtr"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp new file mode 100644 index 00000000000..d27a6c343f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsImplicitlyDereferenced/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsImplicitlyDereferenced::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.IntPtr"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp new file mode 100644 index 00000000000..a1de5c68353 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsLong/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsLong::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Int64"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp new file mode 100644 index 00000000000..93467c8949e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsPinned/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsPinned::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Int32"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp new file mode 100644 index 00000000000..0119caa3d48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsSignUnspecifiedByte/cpp/sample.cpp @@ -0,0 +1,128 @@ +// + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void main() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("program.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsSignUnspecifiedByte::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Byte"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp new file mode 100644 index 00000000000..b36907eae59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.CompilerServices.IsUdtReturn/CPP/sample.cpp @@ -0,0 +1,127 @@ +// + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::CompilerServices; +using namespace System::Threading; + + +ref class CodeEmitter +{ +private: + AssemblyBuilder^ asmBuilder; + String^ asmName; + ModuleBuilder^ modBuilder; + + + void prepareAssembly(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + asmName = name; + + // Create an AssemblyName object and set the name. + AssemblyName^ asmName = gcnew AssemblyName(); + + asmName->Name = name; + + // Use the AppDomain class to create an AssemblyBuilder instance. + + AppDomain^ currentDomain = Thread::GetDomain(); + + asmBuilder = currentDomain->DefineDynamicAssembly(asmName,AssemblyBuilderAccess::RunAndSave); + + // Create a dynamic module. + modBuilder = asmBuilder->DefineDynamicModule(name); + } + + +public: + + // Constructor. + CodeEmitter(String ^ AssemblyName){ + + prepareAssembly(AssemblyName); + } + + // Create a new type. + TypeBuilder^ CreateType(String^ name){ + + // Check the input. + if(!name){ + + throw gcnew ArgumentNullException("AssemblyName"); + } + + return modBuilder->DefineType( name ); + } + + // Write the assembly. + void WriteAssembly(MethodBuilder^ entryPoint){ + + // Check the input. + if(!entryPoint){ + + throw gcnew ArgumentNullException("entryPoint"); + } + + asmBuilder->SetEntryPoint( entryPoint ); + asmBuilder->Save( asmName ); + } + +}; + +void _tmain() +{ + + // Create a CodeEmitter to handle assembly creation. + CodeEmitter ^ e = gcnew CodeEmitter("programAssem.exe"); + + // Create a new type. + TypeBuilder^ mainClass = e->CreateType("MainClass"); + + // Create a new method. + MethodBuilder^ mBuilder = mainClass->DefineMethod("mainMethod", MethodAttributes::Static); + + // Create an ILGenerator and emit IL for + // a simple "Hello World." program. + ILGenerator^ ilGen = mBuilder->GetILGenerator(); + + ilGen->Emit(OpCodes::Ldstr, "Hello World"); + + array^mType = {String::typeid}; + + MethodInfo^ writeMI = Console::typeid->GetMethod( "WriteLine", mType ); + + ilGen->EmitCall(OpCodes::Call, writeMI, nullptr ); + + ilGen->Emit( OpCodes::Ret ); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + // Apply a required custom modifier + // to a field. + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + array^fType = {IsUdtReturn::typeid}; + + mainClass->DefineField("modifiedInteger", Type::GetType("System.Type"), fType, nullptr, FieldAttributes::Private); + + // Create the type. + mainClass->CreateType(); + + // Write the assembly using a reference to + // the entry point. + e->WriteAssembly(mBuilder); + + Console::WriteLine(L"Assembly created."); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp new file mode 100644 index 00000000000..19e9aa78fb8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr-int/cpp/sample.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged c string. + const char * myString = "Hello managed world (from the unmanaged world)!"; + + // Convert the c string to a managed String. + String ^ myManagedString = Marshal::PtrToStringAnsi((IntPtr) (char *) myString); + + // Display the string to the console. + Console::WriteLine(myManagedString); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp new file mode 100644 index 00000000000..5014e38232f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.PtrToStringAnsi-IntPtr/cpp/sample.cpp @@ -0,0 +1,16 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +void main() +{ + // Create an unmanaged c string. + const char * myString = "Hello managed world (from the unmanaged world)!"; + + // Convert the c string to a managed String. + String ^ myManagedString = Marshal::PtrToStringAnsi((IntPtr) (char *) myString); + + // Display the string to the console. + Console::WriteLine(myManagedString); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp new file mode 100644 index 00000000000..8ae9ef7be08 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte-IntPtr-int/cpp/sample.cpp @@ -0,0 +1,19 @@ +// + +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged byte. + const char * myString = "bB"; + + // Read the second character of the c string as a managed byte. + Byte ^ myManagedByte = Marshal::ReadByte((IntPtr) (char *) myString, 1); + + // Display the byte to the console. + Console::WriteLine(myManagedByte); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp new file mode 100644 index 00000000000..ef30a93a73e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadByte/cpp/sample.cpp @@ -0,0 +1,19 @@ +// + +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged byte. + const char * myString = "b"; + + // Read the c string as a managed byte. + Byte ^ myManagedByte = Marshal::ReadByte((IntPtr) (char *) myString); + + // Display the byte to the console. + Console::WriteLine(myManagedByte); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp new file mode 100644 index 00000000000..cd13dbea9ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16-IntPtr-Int/cpp/sample.cpp @@ -0,0 +1,20 @@ +// + +using namespace System; +using namespace System::Runtime::InteropServices; + +void main() +{ + // Create an unmanaged short pointer. + short * myShort; + short tmp = 42; + // Initialize it to another value. + myShort = &tmp; + + // Read value as a managed Int16. + Int16 ^ myManagedVal = Marshal::ReadInt16((IntPtr) myShort, 0); + + // Display the value to the console. + Console::WriteLine(myManagedVal); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp new file mode 100644 index 00000000000..5c4fa47e54d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt16/cpp/sample.cpp @@ -0,0 +1,19 @@ +// + +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged short. + short myShort = 42; + + // Read the short as a managed Int16. + Int16 ^ myManagedVal = Marshal::ReadInt16((IntPtr) &myShort); + + // Display the value to the console. + Console::WriteLine(myManagedVal); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp new file mode 100644 index 00000000000..914ec7fc2b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32-IntPtr-Int/cpp/sample.cpp @@ -0,0 +1,21 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged int pointer. + int * myVal; + int tmp = 42; + // Initialize it to another value. + myVal = &tmp; + + // Read value as a managed Int32. + Int32 ^ myManagedVal = Marshal::ReadInt32((IntPtr) myVal, 0); + + // Display the value to the console. + Console::WriteLine(myManagedVal); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp new file mode 100644 index 00000000000..2179d45c1c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt32/cpp/sample.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged integer. + int myVal = 42; + + // Read the int as a managed Int32. + Int32 ^ myManagedVal = Marshal::ReadInt32((IntPtr) &myVal); + + // Display the value to the console. + Console::WriteLine(myManagedVal); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp new file mode 100644 index 00000000000..0a92279d908 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64-IntPtr-Int/cpp/sample.cpp @@ -0,0 +1,22 @@ +// + +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged __int64 pointer. + __int64 * myVal; + __int64 tmp = 42; + // Initialize it to another value. + myVal = &tmp; + + // Read value as a managed Int64. + Int64 ^ myManagedVal = Marshal::ReadInt64((IntPtr) myVal, 0); + + // Display the value to the console. + Console::WriteLine(myManagedVal); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp new file mode 100644 index 00000000000..3161dd47176 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.ReadInt64/cpp/sample.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + + + +void main() +{ + // Create an unmanaged __int64. + __int64 myVal = 42; + + // Read the value as a managed Int64. + Int64 ^ myManagedVal = Marshal::ReadInt64((IntPtr) &myVal); + + // Display the value to the console. + Console::WriteLine(myManagedVal); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp new file mode 100644 index 00000000000..c749e16e7aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAnsi/CPP/stringtohglobalansi.cpp @@ -0,0 +1,23 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +#include // for printf + + +int main() +{ + // Create a managed string. + String^ managedString = "Hello unmanaged world (from the managed world)."; + + // Marshal the managed string to unmanaged memory. + char* stringPointer = (char*) Marshal::StringToHGlobalAnsi(managedString ).ToPointer(); + + printf("stringPointer = %s\n", stringPointer); + + // Always free the unmanaged string. + Marshal::FreeHGlobal(IntPtr(stringPointer)); + + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp new file mode 100644 index 00000000000..ca8439537a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Runtime.InteropServices.Marshal.StringToHGlobalAuto/CPP/sample.cpp @@ -0,0 +1,20 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +int main() +{ + // Create a managed string. + String^ managedString = "Hello unmanaged world (from the managed world)."; + + // Marshal the managed string to unmanaged memory. + char* stringPointer = (char*) Marshal::StringToHGlobalAuto(managedString).ToPointer(); + + // Pass the string to an unmanaged API. + + // Always free the unmanaged string. + Marshal::FreeHGlobal(IntPtr(stringPointer)); + + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp b/snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp new file mode 100644 index 00000000000..24d170d28cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/RuntimeEnvironment/cpp/RuntimeEnvironment.cpp @@ -0,0 +1,46 @@ +//Types:System.Runtime.InteropServices.RuntimeEnvironment +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +int main() +{ + // + // Show whether the EXE assembly was loaded from the GAC or from a + // private subdirectory. + Console::WriteLine("Did the {0} assembly load from the GAC? {1}", + Assembly::GetExecutingAssembly(), + RuntimeEnvironment::FromGlobalAccessCache( + Assembly::GetExecutingAssembly())); + // + + // + // Show the path where the CLR was loaded from. + Console::WriteLine("Runtime directory: {0}", + RuntimeEnvironment::GetRuntimeDirectory()); + // + + // + // Show the CLR's version number. + Console::WriteLine("System version: {0}", + RuntimeEnvironment::GetSystemVersion()); + // + + // + // Show the path of the machine's configuration file. + Console::WriteLine("System configuration file: {0}", + RuntimeEnvironment::SystemConfigurationFile); + // +} + +// This code produces the following output. +// +// Did the RuntimeEnvironment, Version=0.0.0.0, Culture=neutral, +// PublicKeyToken=null +// assembly load from the GAC? False +// Runtime directory: C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\ +// System version: v2.0.40607 +// System configuration file: +// C:\WINDOWS\Microsoft.NET\Framework\v2.0.40607\config\machine.config +// diff --git a/snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp b/snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp new file mode 100644 index 00000000000..bdc5fda9a9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/SecureString.xAt/CPP/SecureString.xAt.cpp @@ -0,0 +1,85 @@ +// +using namespace System; +using namespace System::Security; + +void main() +{ + String^ msg = L" The current length of the SecureString object: {0}\n"; + SecureString ^ ss = gcnew SecureString; + + Console::WriteLine(L"1) Instantiate the SecureString object:"); + Console::WriteLine(msg, ss->Length ); + + Console::WriteLine(L"2) Append 'a' to the value:"); + ss->AppendChar('a'); + Console::WriteLine(msg, ss->Length ); + + Console::WriteLine(L"3) Append 'X' to the value:"); + ss->AppendChar('X'); + Console::WriteLine(msg, ss->Length); + + Console::WriteLine(L"4) Append 'c' to the value:"); + ss->AppendChar('c'); + Console::WriteLine(msg, ss->Length); + + Console::WriteLine(L"5) Insert 'd' at the end of the value:"); + ss->InsertAt(ss->Length, 'd'); + Console::WriteLine(msg, ss->Length); + + Console::WriteLine(L"6) Remove the last character ('d') from the value:"); + ss->RemoveAt(3); + Console::WriteLine(msg, ss->Length); + + Console::WriteLine(L"7) Set the second character ('X') of the value to 'b':" ); + ss->SetAt(1, 'b'); + Console::WriteLine(msg, ss->Length ); + + Console::WriteLine(L"8) Delete the value of the SecureString object:"); + ss->Clear(); + Console::WriteLine(msg, ss->Length); + + delete ss; +} + +/* +This code example produces the following results: + +This example demonstrates the effect of the AppendChar, InsertAt, +RemoveAt, SetAt, and Clear methods on the value of a SecureString +object. This example simulates the value of the object because the +actual value is encrypted. + +1) The initial value of the SecureString object: + SecureString = "" + Length = 0 + +2) AppendChar: Append 'a' to the value: + SecureString = "a" + Length = 1 + +3) AppendChar: Append 'X' to the value: + SecureString = "aX" + Length = 2 + +4) AppendChar: Append 'c' to the value: + SecureString = "aXc" + Length = 3 + +5) InsertAt: Insert 'd' at the end of the value (equivalent + to AppendChar): + SecureString = "aXcd" + Length = 4 + +6) RemoveAt: Remove the last character ('d') from the value: + SecureString = "aXc" + Length = 3 + +7) SetAt: Set the second character ('X') of the value to 'b': + SecureString = "abc" + Length = 3 + +8) Clear: Delete the value of the SecureString object: + SecureString = "" + Length = 0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp b/snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp new file mode 100644 index 00000000000..4a5db9f067c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/SecureString.xChar/CPP/SecureString.xChar.cpp @@ -0,0 +1,62 @@ + +// +using namespace System; +using namespace System::Security; + +void main() +{ + bool go = true; + ConsoleKeyInfo cki; + String^ m = L"\nEnter your password (up to 15 letters, numbers, and underscores)\n" + L"Press BACKSPACE to delete the last character entered. " + + L"\nPress Enter when done, or ESCAPE to quit:"; + SecureString ^ password = gcnew SecureString; + int top; + int left; + + // The Console.TreatControlCAsInput property prevents CTRL+C from + // ending this example. + Console::TreatControlCAsInput = true; + + Console::Clear(); + Console::WriteLine(m); + + top = Console::CursorTop; + left = Console::CursorLeft; + + do { + cki = Console::ReadKey(true); + if (cki.Key == ConsoleKey::Escape) + break; + + if (cki.Key == ConsoleKey::Backspace){ + if (password->Length > 0) { + Console::SetCursorPosition(left + password->Length - 1, top); + Console::Write(' '); + Console::SetCursorPosition(left + password->Length - 1, top); + password->RemoveAt(password->Length - 1); + } + } + else { + if ((password->Length < 15) && + (Char::IsLetterOrDigit( cki.KeyChar ) || + cki.KeyChar == '_') ) { + password->AppendChar( cki.KeyChar ); + Console::SetCursorPosition( left + password->Length - 1, top ); + Console::Write("*"); + } + } + } while (cki.Key != ConsoleKey::Enter & password->Length < 15); + + // Make the password read-only to prevent modification. + password->MakeReadOnly(); + // Dispose of the SecureString instance. + delete password; + +} +// The example displays output like the following: +// Enter your password (up to 15 letters, numbers, and underscores) +// Press BACKSPACE to delete the last character entered. +// Press Enter when done, or ESCAPE to quit: +// ************ +// diff --git a/snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp b/snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp new file mode 100644 index 00000000000..51ea424f825 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/SecurityElementMembers/CPP/SecurityElementMembers.cpp @@ -0,0 +1,290 @@ + +// This sample demonstrates how to use members of the SecurityElement class. +// The sample creates a SecurityElement for the root of the XML tree and +// demonstrates how to add attributes and child elements. +// +using namespace System; +using namespace System::Security; +using namespace System::Collections; +ref class SecurityElementMembers +{ +public: + + [STAThread] + int TestSecurityElementMembers() + { + // + SecurityElement^ xmlRootElement = gcnew SecurityElement( L"RootTag",L"XML security tree" ); + // + + AddAttribute( xmlRootElement, L"creationdate", DateTime::Now.ToString() ); + AddChildElement( xmlRootElement, L"destroytime", DateTime::Now.AddSeconds( 1.0 ).ToString() ); + + // + SecurityElement^ windowsRoleElement = gcnew SecurityElement( L"WindowsMembership.WindowsRole" ); + // + + // + windowsRoleElement->AddAttribute( L"version", L"1.00" ); + // + + // Add a child element and a creationdate attribute. + AddChildElement( windowsRoleElement, L"BabyElement", L"This is a child element" ); + AddAttribute( windowsRoleElement, L"creationdate", DateTime::Now.ToString() ); + + // + xmlRootElement->AddChild( windowsRoleElement ); + // + + CompareAttributes( xmlRootElement, L"creationdate" ); + ConvertToHashTable( xmlRootElement ); + DisplaySummary( xmlRootElement ); + + // Determine if the security element is too old to keep. + xmlRootElement = DestroyTree( xmlRootElement ); + if ( xmlRootElement != nullptr ) + { + // + String^ elementInXml = xmlRootElement->ToString(); + // + + Console::WriteLine( elementInXml ); + } + + Console::WriteLine( L"This sample completed successfully; " + L"press Enter to exit." ); + Console::ReadLine(); + return 1; + } + + +private: + + // Add an attribute to the specified security element. + static SecurityElement^ AddAttribute( SecurityElement^ xmlElement, String^ attributeName, String^ attributeValue ) + { + if ( xmlElement != nullptr ) + { + // Verify that the attribute name and value are valid XML formats. + // + // + if ( SecurityElement::IsValidAttributeName( attributeName ) && + SecurityElement::IsValidAttributeValue( attributeValue ) ) + // + // + { + // Add the attribute to the security element. + // + xmlElement->AddAttribute( attributeName, attributeValue ); + // + } + } + + return xmlElement; + } + + + // Add a child element to the specified security element. + static SecurityElement^ AddChildElement( SecurityElement^ parentElement, String^ tagName, String^ tagText ) + { + if ( parentElement != nullptr ) + { + // Ensure that the tag text is in valid XML format. + // + if ( !SecurityElement::IsValidText( tagText ) ) + // + { + // Replace invalid text with valid XML text + // to enforce proper XML formatting. + // + tagText = SecurityElement::Escape( tagText ); + // + } + + // Determine whether the tag is in valid XML format. + // + if ( SecurityElement::IsValidTag( tagName ) ) + // + { + // + SecurityElement^ childElement; + childElement = parentElement->SearchForChildByTag( tagName ); + // + if ( childElement != nullptr ) + { + // + String^ elementText; + elementText = parentElement->SearchForTextOfTag( tagName ); + // + if ( !elementText->Equals( tagText ) ) + { + // Add child element to the parent security element. + parentElement->AddChild( gcnew SecurityElement( tagName,tagText ) ); + } + } + else + { + // Add child element to the parent security element. + parentElement->AddChild( gcnew SecurityElement( tagName,tagText ) ); + } + } + } + + return parentElement; + } + + + // Create and display a summary sentence + // about the specified security element. + static void DisplaySummary( SecurityElement^ xmlElement ) + { + // Retrieve tag name for the security element. + // + String^ xmlTreeName = xmlElement->Tag->ToString(); + // + // Retrieve tag text for the security element. + // + String^ xmlTreeDescription = xmlElement->Text; + // + // Retrieve value of the creationdate attribute. + // + String^ xmlCreationDate = xmlElement->Attribute(L"creationdate"); + // + // Retrieve the number of children under the security element. + // + String^ childrenCount = xmlElement->Children->Count.ToString(); + // + String^ outputMessage = String::Format( L"The security XML tree named {0}", xmlTreeName ); + outputMessage = String::Concat( outputMessage, String::Format( L"({0})", xmlTreeDescription ) ); + outputMessage = String::Concat( outputMessage, String::Format( L" was created on {0} and ", xmlCreationDate ) ); + outputMessage = String::Concat( outputMessage, String::Format( L"contains {0} child elements.", childrenCount ) ); + Console::WriteLine( outputMessage ); + } + + // Compare the first two occurrences of an attribute + // in the specified security element. + static void CompareAttributes( SecurityElement^ xmlElement, String^ attributeName ) + { + // Create a hash table containing the security element's attributes. + // + Hashtable^ attributeKeys = xmlElement->Attributes; + String^ attributeValue = attributeKeys[ attributeName ]->ToString(); + // + IEnumerator^ myEnum = xmlElement->Children->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + SecurityElement^ xmlChild = safe_cast(myEnum->Current); + if ( attributeValue->Equals( xmlChild->Attribute(attributeName) ) ) + { + // The security elements were created at the exact same time. + } + } + } + + // Convert the contents of the specified security element + // to hash codes stored in a hash table. + static void ConvertToHashTable( SecurityElement^ xmlElement ) + { + // Create a hash table to hold hash codes of the security elements. + // + Hashtable^ xmlAsHash = gcnew Hashtable; + int rootIndex = xmlElement->GetHashCode(); + xmlAsHash->Add( rootIndex, L"root" ); + // + int parentNum = 0; + IEnumerator^ myEnum1 = xmlElement->Children->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + SecurityElement^ xmlParent = safe_cast(myEnum1->Current); + parentNum++; + xmlAsHash->Add( xmlParent->GetHashCode(), String::Format( L"parent{0}", parentNum ) ); + if ( (xmlParent->Children != nullptr) && (xmlParent->Children->Count > 0) ) + { + int childNum = 0; + IEnumerator^ myEnum2 = xmlParent->Children->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + SecurityElement^ xmlChild = safe_cast(myEnum2->Current); + childNum++; + xmlAsHash->Add( xmlChild->GetHashCode(), String::Format( L"child{0}", childNum ) ); + } + } + } + } + + // Delete the specified security element if the current time is past + // the time stored in the destroytime tag. + static SecurityElement^ DestroyTree( SecurityElement^ xmlElement ) + { + SecurityElement^ localXmlElement = xmlElement; + SecurityElement^ destroyElement = localXmlElement->SearchForChildByTag( L"destroytime" ); + + // Verify that a destroytime tag exists. + // + if ( localXmlElement->SearchForChildByTag( L"destroytime" ) != nullptr ) + // + { + // Retrieve the destroytime text to get the time + // the tree can be destroyed. + // + String^ storedDestroyTime = localXmlElement->SearchForTextOfTag( L"destroytime" ); + // + DateTime destroyTime = DateTime::Parse( storedDestroyTime ); + if ( DateTime::Now > destroyTime ) + { + localXmlElement = nullptr; + Console::WriteLine( L"The XML security tree has been deleted." ); + } + } + + + // Verify that xmlElement is of type SecurityElement. + // + if ( xmlElement->GetType()->Equals( System::Security::SecurityElement::typeid ) ) + // + { + // Determine whether the localXmlElement object + // differs from xmlElement. + // + if ( xmlElement->Equals( localXmlElement ) ) + // + { + // Verify that the tags, attributes and children of the + // two security elements are identical. + // + if ( xmlElement->Equal( localXmlElement ) ) + // + { + // Return the original security element. + return xmlElement; + } + } + } + + // Return the modified security element. + return localXmlElement; + } + +}; + +int main() +{ + SecurityElementMembers^ sem = gcnew SecurityElementMembers; + sem->TestSecurityElementMembers(); +} + +// +// This sample produces the following output: +// +// The security XML tree named RootTag(XML security tree) +// was created on 2/23/2004 1:23:00 PM and contains 2 child elements. +//XML security tree +// 2/23/2004 1:23:01 PM +// +// This is a child element. +// +// +// +//This sample completed successfully; press Exit to continue. +// diff --git a/snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp b/snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp new file mode 100644 index 00000000000..937d62b4562 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ServiceController/CPP/servicecontroller.cpp @@ -0,0 +1,344 @@ +// System.ServiceProcess.ServiceController +// +// The following example application performs basic service queries/commands. +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Data; +using namespace System::ServiceProcess; +using namespace System::Management; + +namespace ServiceControllerSample +{ + public ref class ServiceControllerInfo + { + public: + ServiceControllerInfo() + { + // Constructor... + } + + public: + ~ServiceControllerInfo() + { + // destructor... + } + + public: + static void Main() + { + try + { + // This is a simple interface for exercising the snippet code. + Console::WriteLine( "Service options:" ); + Console::WriteLine( " 1. Ensure the Alerter service is started" ); + Console::WriteLine( " 2. Toggle the Telnet service state (stop/start)" ); + Console::WriteLine( " 3. List services dependent on the Event Log service" ); + Console::WriteLine( " 4. List services that the Messenger service depends on" ); + Console::WriteLine( " 5. List device driver services on this computer" ); + Console::WriteLine( " 6. List the running services on this computer" ); + Console::WriteLine( "Enter the desired option (or any other key to quit): " ); + + // Get the input number. + String^ inputText = Console::ReadLine(); + int inputNum = 0; + if ( (inputText) && (inputText->Length > 0) ) + { + inputNum = Int32::Parse( inputText ); + } + + // Perform the requested option. + switch ( inputNum ) + { + case 1: + CheckAlerterServiceStarted(); + break; + + case 2: + ToggleTelNetServiceState(); + break; + + case 3: + CheckDependenciesOnEventLogService(); + break; + + case 4: + CheckMessengerServiceDependencies(); + break; + + case 5: + ListDeviceDriverServices(); + break; + + case 6: + ListRunningServices(); + break; + + default: + + // Quit if input was any other key. + break; + } + } + catch ( Object^ e ) + { + Console::WriteLine( "Exception:" ); + Console::WriteLine( e->ToString() ); + } + + } + + private: + static void CheckAlerterServiceStarted() + { + // The following example uses the ServiceController class to + // check whether the Alerter service is stopped. If the service is + // stopped, the example starts the service and waits until + // the service status is set to "Running". + // + // Check whether the Alerter service is started. + ServiceController^ sc = gcnew ServiceController; + if ( sc ) + { + sc->ServiceName = "Alerter"; + Console::WriteLine( "The Alerter service status is currently set to {0}", sc->Status ); + if ( sc->Status == (ServiceControllerStatus::Stopped) ) + { + // Start the service if the current status is stopped. + Console::WriteLine( "Starting the Alerter service..." ); + try + { + // Start the service, and wait until its status is "Running". + sc->Start(); + sc->WaitForStatus( ServiceControllerStatus::Running ); + + // Display the current service status. + Console::WriteLine( "The Alerter service status is now set to {0}.", sc->Status ); + } + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( "Could not start the Alerter service." ); + } + } + } + // + } + + static void ToggleTelNetServiceState() + { + // The following example uses the ServiceController class to + // check the current status of the TelNet service. + // If the service is stopped, the example starts the service. + // If the service is running, the example stops the service. + Console::WriteLine(); + + // + // Toggle the Telnet service - + // If it is started (running, paused, etc), stop the service. + // If it is stopped, start the service. + ServiceController^ sc = gcnew ServiceController( "Telnet" ); + if ( sc ) + { + Console::WriteLine( "The Telnet service status is currently set to {0}", sc->Status ); + if ( (sc->Status == (ServiceControllerStatus::Stopped) ) || (sc->Status == (ServiceControllerStatus::StopPending) ) ) + { + // Start the service if the current status is stopped. + Console::WriteLine( "Starting the Telnet service..." ); + sc->Start(); + } + else + { + // Stop the service if its status is not set to "Stopped". + Console::WriteLine( "Stopping the Telnet service..." ); + sc->Stop(); + } + + // Refresh and display the current service status. + sc->Refresh(); + Console::WriteLine( "The Telnet service status is now set to {0}.", sc->Status ); + // + } + } + + static void CheckDependenciesOnEventLogService() + { + Console::WriteLine(); + + // The following example uses the ServiceController class to + // display the set of services that are dependent on the + // Event Log service. + // + ServiceController^ sc = gcnew ServiceController( "Event Log" ); + array^scServices = nullptr; + if ( sc ) + { + scServices = sc->DependentServices; + } + + if ( sc && scServices ) + { + // Display the list of services dependent on the Event Log service. + if ( scServices->Length == 0 ) + { + Console::WriteLine( "There are no services dependent on {0}", sc->ServiceName ); + } + else + { + Console::WriteLine( "Services dependent on {0}:", sc->ServiceName ); + for each (ServiceController^ scTemp in scServices) + { + Console::WriteLine(" {0}", scTemp->DisplayName); + } + } + } + // + } + + static void CheckMessengerServiceDependencies() + { + // The following example uses the ServiceController class to + // display the set of services that the "Messenger" service + // is dependent on. + Console::WriteLine(); + + // + ServiceController^ sc = gcnew ServiceController( "Messenger" ); + array^scServices = nullptr; + if ( sc ) + { + scServices = sc->ServicesDependedOn; + } + + if ( sc && scServices ) + { + // Display the services that the Messenger service is dependent on. + if ( scServices->Length == 0 ) + { + Console::WriteLine( "{0} service is not dependent on any other services.", sc->ServiceName ); + } + else + { + Console::WriteLine( "{0} service is dependent on the following:", sc->ServiceName ); + for each (ServiceController^ scTemp in scServices) + { + Console::WriteLine(" {0}", scTemp->DisplayName); + } + } + } + // + } + + static void ListDeviceDriverServices() + { + // The following example uses the ServiceController class to + // display the device driver services on the local computer. + Console::WriteLine(); + + // + array^scDevices = ServiceController::GetDevices(); + if ( scDevices->Length ) + { + int numAdapter = 0,numFileSystem = 0,numKernel = 0,numRecognizer = 0; + + // Display the list of device driver services. + Console::WriteLine( "Device driver services on the local computer:" ); + + for each (ServiceController^ scTemp in scDevices) + { + // Display the status and the service name, for example, + // [Running] PCI Bus Driver + // Type = KernelDriver + Console::WriteLine( " [{0}] {1}", scTemp->Status, scTemp->DisplayName ); + Console::WriteLine( " Type = {0}", scTemp->ServiceType ); + + // Update counters using the service type bit flags. + if ( (scTemp->ServiceType & ServiceType::Adapter) != (ServiceType)0 ) + { + numAdapter++; + } + if ( (scTemp->ServiceType & ServiceType::FileSystemDriver) != (ServiceType)0 ) + { + numFileSystem++; + } + if ( (scTemp->ServiceType & ServiceType::KernelDriver) != (ServiceType)0 ) + { + numKernel++; + } + if ( (scTemp->ServiceType & ServiceType::RecognizerDriver) != (ServiceType)0 ) + { + numRecognizer++; + } + } + Console::WriteLine(); + Console::WriteLine( "Total of {0} device driver services", scDevices->Length.ToString() ); + Console::WriteLine( " {0} are adapter drivers", numAdapter.ToString() ); + Console::WriteLine( " {0} are file system drivers", numFileSystem.ToString() ); + Console::WriteLine( " {0} are kernel drivers", numKernel.ToString() ); + Console::WriteLine( " {0} are file system recognizer drivers", numRecognizer.ToString() ); + // + } + } + + static void ListRunningServices() + { + // The following example uses the ServiceController class to + // display the services that are running on the local computer. + Console::WriteLine(); + + // + array^scServices = ServiceController::GetServices(); + + // Display the list of services currently running on this computer. + Console::WriteLine( "Services running on the local computer:" ); + for each (ServiceController^ scTemp in scServices) + { + if ( scTemp->Status == ServiceControllerStatus::Running ) + { + // Write the service name and the display name + // for each running service. + Console::WriteLine(); + Console::WriteLine( " Service : {0}", scTemp->ServiceName ); + Console::WriteLine( " Display name: {0}", scTemp->DisplayName ); + + // Query WMI for additional information about this service. + // Display the start name (LocalSystem, etc) and the service + // description. + ManagementObject^ wmiService; + String^ objPath; + objPath = String::Format( "Win32_Service.Name='{0}'", scTemp->ServiceName ); + wmiService = gcnew ManagementObject( objPath ); + if ( wmiService ) + { + wmiService->Get(); + Object^ objStartName = wmiService["StartName"]; + Object^ objDescription = wmiService["Description"]; + if ( objStartName ) + { + Console::WriteLine( " Start name: {0}", objStartName->ToString() ); + } + if ( objDescription ) + { + Console::WriteLine( " Description: {0}", objDescription->ToString() ); + } + } + } + } + // + } + }; +} + +// end of class +// end of namespace +/// The main entry point for the application. + +[STAThread] +int main() +{ + ServiceControllerSample::ServiceControllerInfo::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp new file mode 100644 index 00000000000..178337b709c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ServiceInstallConfig/CPP/source.cpp @@ -0,0 +1,372 @@ +#using +#using +#using +#using +#using +#using +#using + +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Data; +using namespace System::Globalization; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; +using namespace System::ServiceProcess; +using namespace System::ServiceProcess::Design; +using namespace System::Management; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class ServiceChange +{ +public: + + // Define the console application entry point. + + [STAThread] + static void ConsoleTestMain() + { + ServiceController^ sc = gcnew ServiceController; + Console::WriteLine( "Query by service name or display name [S|D]:" ); + String^ inputText = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); + String^ serviceInput = ""; + if ( inputText->Equals( "S" ) ) + { + Console::WriteLine( "Enter the service name:" ); + serviceInput = Console::ReadLine()->ToLower(); + if ( serviceInput->Length > 0 ) + { + sc->ServiceName = serviceInput; + } + } + + if ( inputText->Equals( "D" ) ) + { + Console::WriteLine( "Enter the service display name:" ); + serviceInput = Console::ReadLine(); + if ( serviceInput->Length > 0 ) + { + sc->DisplayName = serviceInput; + } + } + else + { + // Quit if input was any other key. + } + + String^ scInfo; + if ( QueryService( &sc, &scInfo ) ) + { + Console::WriteLine( scInfo ); + Console::WriteLine( "Would you like to change the service start mode [Y|N]:" ); + inputText = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); + if ( inputText->Equals( "Y" ) ) + { + Console::WriteLine( "Enter the new start mode [Auto|Manual|Disabled]:" ); + serviceInput = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); + if ( serviceInput->Length > 0 ) + { + ChangeServiceStartMode( &sc, serviceInput, &scInfo ); + } + } + } + } + + static bool QueryService( interior_ptr sc, [Out]interior_ptr scInfo ) + { + bool serviceValid = false; + *scInfo = ""; + try + { + if ( (( *sc)->ServiceName->Length > 0) || (( *sc)->DisplayName->Length > 0) ) + { + ( *sc)->Refresh(); + + // Display information about this service. + *scInfo = String::Concat( String::Concat( *scInfo, Environment::NewLine ), String::Concat( "Service name:\t", ( *sc)->ServiceName, Environment::NewLine ), String::Concat( "Display name:\t", ( *sc)->DisplayName, Environment::NewLine ), String::Concat( "Service type:\t", ( *sc)->ServiceType, Environment::NewLine ), String::Concat( "Status:\t\t", ( *sc)->Status, Environment::NewLine ) ); + serviceValid = true; + + // Query WMI for additional information about this service. + ManagementObject^ wmiService; + wmiService = gcnew ManagementObject( String::Format( "Win32_Service.Name='{0}'", ( *sc)->ServiceName ) ); + wmiService->Get(); + *scInfo = String::Concat( *scInfo, String::Concat( "Start name:\t", wmiService[ "StartName" ], Environment::NewLine ), String::Concat( "Start mode:\t", wmiService[ "StartMode" ], Environment::NewLine ), String::Concat( "Service path:\t", wmiService[ "PathName" ], Environment::NewLine ), String::Concat( "Description:\t", wmiService[ "Description" ], Environment::NewLine ) ); + } + } + catch ( InvalidOperationException^ ) + { + serviceValid = false; + *scInfo = ""; + } + + return serviceValid; + } + + static bool ChangeServiceStartMode( interior_ptr sc, String^ startMode, [Out]interior_ptr scInfo ) + { + bool startModeChanged = false; + ManagementObject^ wmiService; + wmiService = gcnew ManagementObject( String::Format( "Win32_Service.Name='{0}'", ( *sc)->ServiceName ) ); + wmiService->Get(); + String^ origStartMode = wmiService[ "StartMode" ]->ToString(); + *scInfo = ""; + startMode = startMode->ToUpper( CultureInfo::InvariantCulture ); + if ( startMode->Equals( "AUTO" ) || startMode->Equals( "MANUAL" ) || startMode->Equals( "DISABLED" ) ) + { + if ( startMode->Equals( origStartMode->ToUpper( CultureInfo::InvariantCulture ) ) ) + { + *scInfo = String::Format( "{0}Requested mode is the same as the current mode; no change necessary.{1}", *scInfo, Environment::NewLine ); + } + else + { + // Change the start mode to requested value. + *scInfo = String::Format( "{0}Setting service start mode to {1}...{2}", *scInfo, startMode, Environment::NewLine ); + + // See Win32_Service schema for ChangeStartMode input values. + array^startArgs = {startMode}; + Object^ retVal; + retVal = wmiService->InvokeMethod( "ChangeStartMode", startArgs ); + if ( !retVal->ToString()->Equals( "0" ) ) + { + *scInfo = String::Format( "{0}Warning: Win32_Service.ChangeStartMode failed with return value {1}{2}", *scInfo, retVal->ToString(), Environment::NewLine ); + } + else + { + *scInfo = String::Concat( String::Format( "{0}Service {1} start mode changed to {2}{3}", *scInfo, ( *sc)->ServiceName, startMode ), Environment::NewLine ); + } + } + } + else + { + *scInfo = String::Format( "{0}Invalid start mode.{1}", *scInfo, Environment::NewLine ); + } + + return startModeChanged; + } + + // + // Prompt the user for service installation account values. +public: + static bool GetServiceAccount( interior_ptr svcInst ) + { + bool accountSet = false; + ServiceInstallerDialog^ svcDialog = gcnew ServiceInstallerDialog; + + // Query the user for the service account type. + do + { + svcDialog->TopMost = true; + svcDialog->ShowDialog(); + if ( svcDialog->Result == ServiceInstallerDialogResult::OK ) + { + // Do a very simple validation on the user + // input. Check to see whether the user name + // or password is blank. + if ( (svcDialog->Username->Length > 0) && (svcDialog->Password->Length > 0) ) + { + // Use the account and password. + accountSet = true; + ( *svcInst)->Account = ServiceAccount::User; + ( *svcInst)->Username = svcDialog->Username; + ( *svcInst)->Password = svcDialog->Password; + } + } + else + if ( svcDialog->Result == ServiceInstallerDialogResult::UseSystem ) + { + ( *svcInst)->Account = ServiceAccount::LocalSystem; + ( *svcInst)->Username = nullptr; + ( *svcInst)->Password = nullptr; + accountSet = true; + } + + if ( !accountSet ) + { + // Display a message box. Tell the user to + // enter a valid user and password, or cancel + // out to leave the service account alone. + DialogResult result; + result = MessageBox::Show( "Invalid user name or password for service installation." + " Press Cancel to leave the service account unchanged.", "Change Service Account", + MessageBoxButtons::OKCancel, MessageBoxIcon::Hand ); + if ( result == DialogResult::Cancel ) + { + // Break out of loop. + break; + } + } + } + while ( !accountSet ); + + return accountSet; + } + // +}; + +public ref class ServiceSampleForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ query_button; + System::Windows::Forms::Button^ startMode_button; + System::Windows::Forms::Button^ changeMode_button; + System::Windows::Forms::Button^ startName_button; + System::Windows::Forms::TextBox^ textBox; + System::Windows::Forms::Label ^ modeLabel; + System::Windows::Forms::ComboBox^ modeComboBox; + ServiceController^ currentService; + void query_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + textBox->Text = "Querying service configuration..."; + String^ scInfo; + currentService->DisplayName = "TelNet"; + if ( ServiceChange::QueryService( ¤tService, &scInfo ) ) + { + textBox->Text = scInfo; + this->startName_button->Enabled = true; + this->startMode_button->Enabled = true; + this->modeLabel->Visible = true; + this->modeComboBox->Visible = true; + } + else + { + textBox->Text = "Could not read configuration information for service."; + } + } + + void startMode_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + String^ scInfo; + String^ wmiStartMode = ""; + if ( this->modeComboBox->SelectedItem->ToString()->Equals( "Automatic" ) ) + { + wmiStartMode = "Auto"; + } + else + if ( this->modeComboBox->SelectedItem->ToString()->Equals( "Manual" ) ) + { + wmiStartMode = "Manual"; + } + else + if ( this->modeComboBox->SelectedItem->ToString()->Equals( "Disabled" ) ) + { + wmiStartMode = "Disabled"; + } + + if ( ServiceChange::ChangeServiceStartMode( ¤tService, wmiStartMode, &scInfo ) ) + { + textBox->Text = "Service start mode updated successfully."; + } + else + { + textBox->Text = scInfo; + } + } + + void startName_button_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ServiceProcessInstaller^ svcProcInst = gcnew ServiceProcessInstaller; + textBox->Text = "Displaying service installer dialog..."; + if ( ServiceChange::GetServiceAccount( &svcProcInst ) ) + { + textBox->Text = "Changing the service account is not currently implemented in this application."; + } + else + { + textBox->Text = "No change made to service account."; + } + + String^ scInfo; + if ( ServiceChange::QueryService( ¤tService, &scInfo ) ) + { + textBox->Text = String::Concat( textBox->Text, Environment::NewLine, scInfo ); + } + } + + +public: + ServiceSampleForm() + { + query_button = gcnew System::Windows::Forms::Button; + startMode_button = gcnew System::Windows::Forms::Button; + changeMode_button = gcnew System::Windows::Forms::Button; + startName_button = gcnew System::Windows::Forms::Button; + textBox = gcnew System::Windows::Forms::TextBox; + modeLabel = gcnew System::Windows::Forms::Label; + modeComboBox = gcnew System::Windows::Forms::ComboBox; + currentService = gcnew ServiceController; + this->SuspendLayout(); + + // Set properties for query_button. + this->query_button->Enabled = true; + this->query_button->Location = System::Drawing::Point( 8, 16 ); + this->query_button->Name = "query_button"; + this->query_button->Size = System::Drawing::Size( 124, 30 ); + this->query_button->Text = "Query Service"; + this->query_button->Click += gcnew System::EventHandler( this, &ServiceSampleForm::query_button_Click ); + + // Set properties for startMode_button. + this->startMode_button->Enabled = false; + this->startMode_button->Location = System::Drawing::Point( 264, 16 ); + this->startMode_button->Name = "startMode_button"; + this->startMode_button->Size = System::Drawing::Size( 124, 30 ); + this->startMode_button->Text = "Change Service Start Mode"; + this->startMode_button->Click += gcnew System::EventHandler( this, &ServiceSampleForm::startMode_button_Click ); + + // Set properties for modeLabel + this->modeLabel->Location = System::Drawing::Point( 395, 20 ); + this->modeLabel->Size = System::Drawing::Size( 180, 22 ); + this->modeLabel->Text = "Select a service mode:"; + this->modeLabel->Visible = false; + + // Set properties for modeComboBox + this->modeComboBox->Location = System::Drawing::Point( 560, 16 ); + this->modeComboBox->Size = System::Drawing::Size( 190, 23 ); + this->modeComboBox->Name = "modeComboBox"; + array^temp0 = {"Automatic","Manual","Disabled"}; + this->modeComboBox->Items->AddRange( temp0 ); + this->modeComboBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right | System::Windows::Forms::AnchorStyles::Top); + this->modeComboBox->SelectedIndex = 0; + this->modeComboBox->Visible = false; + + // Set properties for startName_button. + this->startName_button->Enabled = false; + this->startName_button->Location = System::Drawing::Point( 136, 16 ); + this->startName_button->Name = "startName_button"; + this->startName_button->Size = System::Drawing::Size( 124, 30 ); + this->startName_button->Text = "Change Service Account"; + this->startName_button->Click += gcnew System::EventHandler( this, &ServiceSampleForm::startName_button_Click ); + + // Set properties for textBox. + this->textBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->textBox->Location = System::Drawing::Point( 8, 48 ); + this->textBox->Multiline = true; + this->textBox->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->textBox->Name = "textBox"; + this->textBox->Size = System::Drawing::Size( 744, 280 ); + this->textBox->Text = ""; + + // Set properties for the ServiceSampleForm. + this->AutoScaleBaseSize = System::Drawing::Size( 5, 13 ); + this->ClientSize = System::Drawing::Size( 768, 340 ); + this->MinimumSize = System::Drawing::Size( 750, 340 ); + array^temp1 = {this->textBox,this->query_button,this->startMode_button,this->startName_button,this->modeComboBox,this->modeLabel}; + this->Controls->AddRange( temp1 ); + this->Name = "ServiceSampleForm"; + this->Text = "Query and Change Service Configuration"; + this->ResumeLayout( false ); + } + +public: + ~ServiceSampleForm() + { + } +}; + +// Define the windows application entry point. + +[STAThread] +int main() +{ + Application::Run( gcnew ServiceSampleForm ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp new file mode 100644 index 00000000000..b873188879c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StackFrameSample1/CPP/source.cpp @@ -0,0 +1,280 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; + +// This console application illustrates various uses +// of the StackTrace and StackFrame classes. +namespace SampleInternal +{ + public ref class ClassLevel6 + { + public: + void Level6Method() + { + throw gcnew Exception( "An error occurred in the lowest internal class method." ); + } + + }; + + public ref class ClassLevel5 + { + public: + + // + void Level5Method() + { + try + { + ClassLevel6^ nestedClass = gcnew ClassLevel6; + nestedClass->Level6Method(); + } + catch ( Exception^ e ) + { + Console::WriteLine( " Level5Method exception handler" ); + StackTrace^ st = gcnew StackTrace; + + // Display the most recent function call. + StackFrame^ sf = st->GetFrame( 0 ); + Console::WriteLine(); + Console::WriteLine( " Exception in method: " ); + Console::WriteLine( " {0}", sf->GetMethod() ); + if ( st->FrameCount > 1 ) + { + + // Display the highest-level function call + // in the trace. + sf = st->GetFrame( st->FrameCount - 1 ); + Console::WriteLine( " Original function call at top of call stack):" ); + Console::WriteLine( " {0}", sf->GetMethod() ); + } + Console::WriteLine(); + Console::WriteLine( " ... throwing exception to next level ..." ); + Console::WriteLine( "-------------------------------------------------\n" ); + throw e; + } + + } + + // + }; + + public ref class ClassLevel4 + { + public: + void Level4Method() + { + + // + try + { + ClassLevel5^ nestedClass = gcnew ClassLevel5; + nestedClass->Level5Method(); + } + catch ( Exception^ e ) + { + Console::WriteLine( " Level4Method exception handler" ); + + // Build a stack trace from a dummy stack frame. + // Explicitly specify the source file name, line number + // and column number. + StackTrace^ st = gcnew StackTrace( gcnew StackFrame( "source.cs",79,24 ) ); + Console::WriteLine( " Stack trace with dummy stack frame: {0}", st->ToString() ); + + // Access the StackFrames explicitly to display the file + // name, line number and column number properties. + // StackTrace.ToString only includes the method name. + for ( int i = 0; i < st->FrameCount; i++ ) + { + StackFrame^ sf = st->GetFrame( i ); + Console::WriteLine( " File: {0}", sf->GetFileName() ); + Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() ); + Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() ); + + } + Console::WriteLine(); + Console::WriteLine( " ... throwing exception to next level ..." ); + Console::WriteLine( "-------------------------------------------------\n" ); + throw e; + } + + + // + } + + }; + + public ref class ClassLevel3 + { + public: + + // + void Level3Method() + { + try + { + ClassLevel4^ nestedClass = gcnew ClassLevel4; + nestedClass->Level4Method(); + } + catch ( Exception^ e ) + { + Console::WriteLine( " Level3Method exception handler" ); + + // Build a stack trace from a dummy stack frame. + // Explicitly specify the source file name and line number. + StackTrace^ st = gcnew StackTrace( gcnew StackFrame( "source.cs",60 ) ); + Console::WriteLine( " Stack trace with dummy stack frame: {0}", st->ToString() ); + for ( int i = 0; i < st->FrameCount; i++ ) + { + + // + // Display the stack frame properties. + StackFrame^ sf = st->GetFrame( i ); + Console::WriteLine( " File: {0}", sf->GetFileName() ); + Console::WriteLine( " Line Number: {0}", sf->GetFileLineNumber().ToString() ); + + // Note that the column number defaults to zero + // when not initialized. + Console::WriteLine( " Column Number: {0}", sf->GetFileColumnNumber().ToString() ); + Console::WriteLine( " Intermediate Language Offset: {0}", sf->GetILOffset().ToString() ); + Console::WriteLine( " Native Offset: {0}", sf->GetNativeOffset().ToString() ); + + // + + } + Console::WriteLine(); + Console::WriteLine( " ... throwing exception to next level ..." ); + Console::WriteLine( "-------------------------------------------------\n" ); + throw e; + } + + } + + // + }; + + public ref class ClassLevel2 + { + public: + + // + void Level2Method() + { + try + { + ClassLevel3^ nestedClass = gcnew ClassLevel3; + nestedClass->Level3Method(); + } + catch ( Exception^ e ) + { + Console::WriteLine( " Level2Method exception handler" ); + + // Display the full call stack at this level. + StackTrace^ st1 = gcnew StackTrace( true ); + Console::WriteLine( " Stack trace for this level: {0}", st1->ToString() ); + + // Build a stack trace from one frame, skipping the + // current frame and using the next frame. + StackTrace^ st2 = gcnew StackTrace( gcnew StackFrame( 1,true ) ); + Console::WriteLine( " Stack trace built with next level frame: {0}", st2->ToString() ); + + // Build a stack trace skipping the current frame, and + // including all the other frames. + StackTrace^ st3 = gcnew StackTrace( 1,true ); + Console::WriteLine( " Stack trace built from the next level up: {0}", st3->ToString() ); + Console::WriteLine(); + Console::WriteLine( " ... throwing exception to next level ..." ); + Console::WriteLine( "-------------------------------------------------\n" ); + throw e; + } + + } + + // + }; + + public ref class ClassLevel1 + { + public: + + // + void InternalMethod() + { + try + { + ClassLevel2^ nestedClass = gcnew ClassLevel2; + nestedClass->Level2Method(); + } + catch ( Exception^ e ) + { + Console::WriteLine( " InternalMethod exception handler" ); + + // Build a stack trace from one frame, skipping the + // current frame and using the next frame. By + // default, file and line information are not displayed. + StackTrace^ st = gcnew StackTrace( gcnew StackFrame( 1 ) ); + Console::WriteLine( " Stack trace for next level frame: {0}", st->ToString() ); + Console::WriteLine( " Stack frame for next level: " ); + Console::WriteLine( " {0}", st->GetFrame( 0 )->ToString() ); + Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() ); + Console::WriteLine(); + Console::WriteLine( " ... throwing exception to next level ..." ); + Console::WriteLine( "-------------------------------------------------\n" ); + throw e; + } + + } + + // + }; + +} + + +using namespace SampleInternal; + +namespace SamplePublic +{ + class ConsoleApp + { + public: + + // + + [STAThread] + static void Main() + { + ClassLevel1 ^ mainClass = gcnew ClassLevel1; + try + { + mainClass->InternalMethod(); + } + catch ( Exception^ e ) + { + Console::WriteLine( " Main method exception handler" ); + + // Display file and line information, if available. + StackTrace^ st = gcnew StackTrace( gcnew StackFrame( true ) ); + Console::WriteLine( " Stack trace for current level: {0}", st->ToString() ); + Console::WriteLine( " File: {0}", st->GetFrame( 0 )->GetFileName() ); + Console::WriteLine( " Line Number: {0}", st->GetFrame( 0 )->GetFileLineNumber().ToString() ); + Console::WriteLine(); + Console::WriteLine( "-------------------------------------------------\n" ); + } + + } + + // + }; + +} + +int main() +{ + SamplePublic::ConsoleApp::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp new file mode 100644 index 00000000000..83e6e596d61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StackTraceSample1/CPP/stacktracesample1.cpp @@ -0,0 +1,147 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +ref class StackTraceSample +{ +private: + ref class MyInternalClass + { + public: + void ThrowsException() + { + try + { + throw gcnew Exception( "A problem was encountered." ); + } + catch ( Exception^ e ) + { + + // Create a StackTrace that captures + // filename, line number, and column + // information for the current thread. + StackTrace^ st = gcnew StackTrace( true ); + String^ stackIndent = ""; + for ( int i = 0; i < st->FrameCount; i++ ) + { + + // Note that at this level, there are five + // stack frames, one for each method invocation. + StackFrame^ sf = st->GetFrame( i ); + Console::WriteLine(); + Console::WriteLine( "{0}Method: {1}", stackIndent, sf->GetMethod() ); + Console::WriteLine( "{0}File: {1}", stackIndent, sf->GetFileName() ); + Console::WriteLine( "{0}Line Number: {1}", stackIndent, sf->GetFileLineNumber().ToString() ); + stackIndent = String::Concat( stackIndent, " " ); + + } + throw e; + } + + } + + }; + + +protected: + void MyProtectedMethod() + { + MyInternalClass^ mic = gcnew MyInternalClass; + mic->ThrowsException(); + } + + +public: + void MyPublicMethod() + { + MyProtectedMethod(); + } + +}; + +int main() +{ + StackTraceSample^ sample = gcnew StackTraceSample; + try + { + sample->MyPublicMethod(); + } + catch ( Exception^ ) + { + + // Create a StackTrace that captures + // filename, line number, and column + // information for the current thread. + StackTrace^ st = gcnew StackTrace( true ); + for ( int i = 0; i < st->FrameCount; i++ ) + { + + // For an executable built from C++, there + // are two stack frames here: one for main, + // and one for the _mainCRTStartup stub. + StackFrame^ sf = st->GetFrame( i ); + Console::WriteLine(); + Console::WriteLine( "High up the call stack, Method: {0}", sf->GetMethod()->ToString() ); + Console::WriteLine( "High up the call stack, Line Number: {0}", sf->GetFileLineNumber().ToString() ); + + } + } + +} + +/* +This console application produces the following output when +compiled with the Debug configuration. + + Method: Void ThrowsException() + File: c:\samples\stacktraceframe\myclass.cpp + Line Number: 20 + + Method: Void MyProtectedMethod() + File: c:\samples\stacktraceframe\myclass.cpp + Line Number: 45 + + Method: Void MyPublicMethod() + File: c:\samples\stacktraceframe\myclass.cpp + Line Number: 50 + + Method: Int32 main() + File: c:\samples\stacktraceframe\myclass.cpp + Line Number: 56 + + Method: UInt32 _mainCRTStartup() + File: + Line Number: 0 + + High up the call stack, Method: Int32 main() + High up the call stack, Line Number: 62 + + High up the call stack, Method: UInt32 _mainCRTStartup() + High up the call stack, Line Number: 0 + +This console application produces the following output when +compiled with the Release configuration. + + Method: Void ThrowsException() + File: + Line Number: 0 + + Method: Int32 main() + File: + Line Number: 0 + + Method: UInt32 _mainCRTStartup() + File: + Line Number: 0 + + High up the call stack, Method: Int32 main() + High up the call stack, Line Number: 0 + + High up the call stack, Method: UInt32 _mainCRTStartup() + High up the call stack, Line Number: 0 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp new file mode 100644 index 00000000000..2dcb2ce73fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StackTraceSample2/CPP/stacktracesample2.cpp @@ -0,0 +1,72 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +ref class MyConsoleApp +{ +private: + ref class MyInnerClass + { + public: + void ThrowsException() + { + try + { + throw gcnew Exception( "A problem was encountered." ); + } + catch ( Exception^ ) + { + + // Create a StackTrace starting at the next level + // stack frame. Skip the first frame, the frame of + // this level, which hides the internal implementation + // of the ThrowsException method. Include the line + // number, file name, and column number information + // for each frame. + // + StackTrace^ st = gcnew StackTrace( 1,true ); + array^stFrames = st->GetFrames(); + for ( int i; i < stFrames->Length; i++ ) + { + StackFrame^ sf = stFrames[ i ]; + Console::WriteLine( "Method: {0}", sf->GetMethod() ); + + } + // + } + + } + + }; + + +public: + void MyPublicMethod() + { + MyInnerClass^ helperClass = gcnew MyInnerClass; + helperClass->ThrowsException(); + } + +}; + +void main() +{ + MyConsoleApp^ myApp = gcnew MyConsoleApp; + myApp->MyPublicMethod(); +} + +/* +This console application produces the following output +when compiled with optimization off. + +Note that the ThrowsException() method is not identified in +this stack trace. + + Method: Void MyPublicMethod() + Method: Void Main() + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp b/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp new file mode 100644 index 00000000000..49e44641a2b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StackTraceSample3/CPP/stacktracesample3.cpp @@ -0,0 +1,88 @@ + + +#using + +using namespace System; +using namespace System::Diagnostics; +ref class MyConsoleApp +{ +private: + + // + ref class MyInnerClass + { + public: + void ThrowsException() + { + try + { + throw gcnew Exception( "A problem was encountered." ); + } + catch ( Exception^ ) + { + + // Log the Exception. We do not want to reveal the + // inner workings of the class, or be too verbose, so + // we will create a StackTrace with a single + // StackFrame, where the frame is that of the calling + // method. + // + StackFrame^ fr = gcnew StackFrame( 1,true ); + StackTrace^ st = gcnew StackTrace( fr ); + EventLog::WriteEntry( fr->GetMethod()->Name, st->ToString(), EventLogEntryType::Warning ); + // + + // Note that whenever this application is run, the EventLog + // contains an Event similar to the following Event. + // + // Event Type: Warning + // Event Source: MyPublicMethod + // Event Category: None + // Event ID: 0 + // Date: 6/17/2001 + // Time: 6:39:56 PM + // User: N/A + // Computer: MYCOMPUTER + // Description: + // + // at MyConsoleApp.MyPublicMethod() + // + // For more information, see Help and Support Center at + // http://go.microsoft.com/fwlink/events.asp. + } + + } + + }; + // + + +public: + + // + void MyPublicMethod() + { + MyInnerClass^ helperClass = gcnew MyInnerClass; + helperClass->ThrowsException(); + } + +}; + +void main() +{ + MyConsoleApp^ helperClass = gcnew MyConsoleApp; + helperClass->MyPublicMethod(); +} + +/* +This console application produces the following output +when compiled with optimization off. + +Note that the ThrowsException() method is not identified in +this stack trace. + + Method: Void MyPublicMethod() + Method: Void Main() + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp new file mode 100644 index 00000000000..3b2fe7a7575 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StopWatchPerfSample/CPP/source.cpp @@ -0,0 +1,201 @@ + + +// System.Diagnostics.Stopwatch +// +#using + +using namespace System; +using namespace System::Diagnostics; + +// +void DisplayTimerProperties() +{ + // Display the timer frequency and resolution. + if ( Stopwatch::IsHighResolution ) + { + Console::WriteLine( "Operations timed using the system's high-resolution performance counter." ); + } + else + { + Console::WriteLine( "Operations timed using the DateTime class." ); + } + + Int64 frequency = Stopwatch::Frequency; + Console::WriteLine( " Timer frequency in ticks per second = {0}", frequency ); + Int64 nanosecPerTick = (1000L * 1000L * 1000L) / frequency; + Console::WriteLine( " Timer is accurate within {0} nanoseconds", nanosecPerTick ); +} +// + +// +void TimeOperations() +{ + Int64 nanosecPerTick = (1000L * 1000L * 1000L) / Stopwatch::Frequency; + const long numIterations = 10000; + + // Define the operation title names. + array^operationNames = {"Operation: Int32.Parse(\"0\")","Operation: Int32.TryParse(\"0\")","Operation: Int32.Parse(\"a\")","Operation: Int32.TryParse(\"a\")"}; + + // Time four different implementations for parsing + // an integer from a string. + for ( int operation = 0; operation <= 3; operation++ ) + { + // + // Define variables for operation statistics. + Int64 numTicks = 0; + Int64 numRollovers = 0; + Int64 maxTicks = 0; + Int64 minTicks = Int64::MaxValue; + int indexFastest = -1; + int indexSlowest = -1; + Int64 milliSec = 0; + Stopwatch ^ time10kOperations = Stopwatch::StartNew(); + + // Run the current operation 10001 times. + // The first execution time will be tossed + // out, since it can skew the average time. + for ( int i = 0; i <= numIterations; i++ ) + { + // + Int64 ticksThisTime = 0; + int inputNum; + Stopwatch ^ timePerParse; + switch ( operation ) + { + case 0: + + // Parse a valid integer using + // a try-catch statement. + // Start a new stopwatch timer. + timePerParse = Stopwatch::StartNew(); + try + { + inputNum = Int32::Parse( "0" ); + } + catch ( FormatException^ ) + { + inputNum = 0; + } + + // Stop the timer, and save the + // elapsed ticks for the operation. + timePerParse->Stop(); + ticksThisTime = timePerParse->ElapsedTicks; + break; + + case 1: + + // Parse a valid integer using + // the TryParse statement. + // Start a new stopwatch timer. + timePerParse = Stopwatch::StartNew(); + if ( !Int32::TryParse( "0", inputNum ) ) + { + inputNum = 0; + } + + // Stop the timer, and save the + // elapsed ticks for the operation. + timePerParse->Stop(); + ticksThisTime = timePerParse->ElapsedTicks; + break; + + case 2: + + // Parse an invalid value using + // a try-catch statement. + // Start a new stopwatch timer. + timePerParse = Stopwatch::StartNew(); + try + { + inputNum = Int32::Parse( "a" ); + } + catch ( FormatException^ ) + { + inputNum = 0; + } + + // Stop the timer, and save the + // elapsed ticks for the operation. + timePerParse->Stop(); + ticksThisTime = timePerParse->ElapsedTicks; + break; + + case 3: + + // Parse an invalid value using + // the TryParse statement. + // Start a new stopwatch timer. + timePerParse = Stopwatch::StartNew(); + if ( !Int32::TryParse( "a", inputNum ) ) + { + inputNum = 0; + } + + // Stop the timer, and save the + // elapsed ticks for the operation. + timePerParse->Stop(); + ticksThisTime = timePerParse->ElapsedTicks; + break; + + default: + break; + } + // + + // Skip over the time for the first operation, + // just in case it caused a one-time + // performance hit. + if ( i == 0 ) + { + time10kOperations->Reset(); + time10kOperations->Start(); + } + else + { + // Update operation statistics + // for iterations 1-10001. + if ( maxTicks < ticksThisTime ) + { + indexSlowest = i; + maxTicks = ticksThisTime; + } + if ( minTicks > ticksThisTime ) + { + indexFastest = i; + minTicks = ticksThisTime; + } + numTicks += ticksThisTime; + if ( numTicks < ticksThisTime ) + { + // Keep track of rollovers. + numRollovers++; + } + } + } + + // Display the statistics for 10000 iterations. + time10kOperations->Stop(); + milliSec = time10kOperations->ElapsedMilliseconds; + Console::WriteLine(); + Console::WriteLine( "{0} Summary:", operationNames[ operation ] ); + Console::WriteLine( " Slowest time: #{0}/{1} = {2} ticks", indexSlowest, numIterations, maxTicks ); + Console::WriteLine( " Fastest time: #{0}/{1} = {2} ticks", indexFastest, numIterations, minTicks ); + Console::WriteLine( " Average time: {0} ticks = {1} nanoseconds", numTicks / numIterations, (numTicks * nanosecPerTick) / numIterations ); + Console::WriteLine( " Total time looping through {0} operations: {1} milliseconds", numIterations, milliSec ); + // + + } +} +// + +int main() +{ + DisplayTimerProperties(); + Console::WriteLine(); + Console::WriteLine( "Press the Enter key to begin:" ); + Console::ReadLine(); + Console::WriteLine(); + TimeOperations(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp b/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp new file mode 100644 index 00000000000..ba044bc83d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StringBuilder/cpp/StringBuilder.cpp @@ -0,0 +1,59 @@ +//Code Modification: Removed AppendLine and associated comment after the AppendFormat line. +//The CR/LF bytes introduces by AppendLine made the sb.Length appear incorrect. +// Before +//sb.AppendFormat("GHI{0}{1}", 'J', 'k'); +////APpend a blank line to the end of the StringBuilder. +// sb.AppendLine(); +// After +//sb.AppendFormat("GHI{0}{1}", 'J', 'k'); +//Code Modification: End +//Types:System.Text.StringBuilder +// +using namespace System; +using namespace System::Text; + +int main() +{ + // + // Create a StringBuilder that expects to hold 50 characters. + // Initialize the StringBuilder with "ABC". + StringBuilder^ sb = gcnew StringBuilder("ABC", 50); + // + + // + // Append three characters (D, E, and F) to the end of the + // StringBuilder. + sb->Append(gcnew array{'D', 'E', 'F'}); + // + + // + // Append a format string to the end of the StringBuilder. + sb->AppendFormat("GHI{0}{1}", (Char)'J', (Char)'k'); + // + + // + // Display the number of characters in the StringBuilder + // and its string. + Console::WriteLine("{0} chars: {1}", sb->Length, sb->ToString()); + // + + // + // Insert a string at the beginning of the StringBuilder. + sb->Insert(0, "Alphabet: "); + // + + // + // Replace all lowercase k's with uppercase K's. + sb->Replace('k', 'K'); + // + + // Display the number of characters in the StringBuilder + // and its string. + Console::WriteLine("{0} chars: {1}", sb->Length, sb->ToString()); +} + +// This code produces the following output. +// +// 11 chars: ABCDEFGHIJk +// 21 chars: Alphabet: ABCDEFGHIJK +// diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp new file mode 100644 index 00000000000..6541e6b0a6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StringCompareOrdinal/CPP/stringcompareordinal.cpp @@ -0,0 +1,34 @@ +// +using namespace System; +using namespace System::Globalization; +int main() +{ + String^ strLow = "abc"; + String^ strCap = "ABC"; + String^ result = "equal to "; + int x = 0; + int pos = 1; + + // The Unicode codepoint for 'b' is greater than the codepoint for 'B'. + x = String::CompareOrdinal( strLow, pos, strCap, pos, 1 ); + if ( x < 0 ) + result = "less than"; + + if ( x > 0 ) + result = "greater than"; + + Console::WriteLine( "CompareOrdinal(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos ); + Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] ); + + // In U.S. English culture, 'b' is linguistically less than 'B'. + x = String::Compare( strLow, pos, strCap, pos, 1, false, gcnew CultureInfo( "en-US" ) ); + if ( x < 0 ) + result = "less than"; + else + if ( x > 0 ) + result = "greater than"; + + Console::WriteLine( "Compare(\"{0}\"[{2}], \"{1}\"[{2}]):", strLow, strCap, pos ); + Console::WriteLine( " '{0}' is {1} '{2}'", strLow[ pos ], result, strCap[ pos ] ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp b/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp new file mode 100644 index 00000000000..389943d7364 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StringCompareTo/CPP/stringcompareto.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; + +String^ CompareStrings(String^ str1, String^ str2) +{ + // compare the values, using the CompareTo method on the first string + int cmpVal = str1->CompareTo(str2); + if (cmpVal == 0) + // the values are the same + return "The strings occur in the same position in the sort order."; + else if (cmpVal < 0) + return "The first string precedes the second in the sort order."; + else + return "The first string follows the second in the sort order."; +} + +int main() +{ + String^ strFirst = "Goodbye"; + String^ strSecond = "Hello"; + String^ strThird = "a small String*"; + String^ strFourth = "goodbye"; + + // Compare a string to itself. + Console::WriteLine(CompareStrings(strFirst, strFirst)); + Console::WriteLine(CompareStrings(strFirst, strSecond)); + Console::WriteLine(CompareStrings(strFirst, strThird)); + + // Compare a string to another string that varies only by case. + Console::WriteLine(CompareStrings(strFirst, strFourth)); + Console::WriteLine(CompareStrings(strFourth, strFirst)); +} +// The example displays the following output: +// The strings occur in the same position in the sort order. +// The first string precedes the second in the sort order. +// The first string follows the second in the sort order. +// The first string follows the second in the sort order. +// The first string precedes the second in the sort order. +// diff --git a/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp b/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp new file mode 100644 index 00000000000..15c96facbe9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StringInfo/cpp/StringInfo.cpp @@ -0,0 +1,84 @@ +//Types:System.Globalization.StringInfo +// +using namespace System; +using namespace System::Text; +using namespace System::Globalization; + + +// Show how to enumerate each real character (honoring surrogates) +// in a string. + +void EnumTextElements(String^ combiningChars) +{ + // This StringBuilder holds the output results. + StringBuilder^ sb = gcnew StringBuilder(); + + // Use the enumerator returned from GetTextElementEnumerator + // method to examine each real character. + TextElementEnumerator^ charEnum = + StringInfo::GetTextElementEnumerator(combiningChars); + while (charEnum->MoveNext()) + { + sb->AppendFormat("Character at index {0} is '{1}'{2}", + charEnum->ElementIndex, charEnum->GetTextElement(), + Environment::NewLine); + } + + // Show the results. + Console::WriteLine("Result of GetTextElementEnumerator:"); + Console::WriteLine(sb); +} + + +// Show how to discover the index of each real character +// (honoring surrogates) in a string. + +void EnumTextElementIndexes(String^ combiningChars) +{ + // This StringBuilder holds the output results. + StringBuilder^ sb = gcnew StringBuilder(); + + // Use the ParseCombiningCharacters method to + // get the index of each real character in the string. + array ^ textElemIndex = + StringInfo::ParseCombiningCharacters(combiningChars); + + // Iterate through each real character showing the character + // and the index where it was found. + for (int i = 0; i < textElemIndex->Length; i++) + { + sb->AppendFormat("Character {0} starts at index {1}{2}", + i, textElemIndex[i], Environment::NewLine); + } + + // Show the results. + Console::WriteLine("Result of ParseCombiningCharacters:"); + Console::WriteLine(sb); +} + +int main() +{ + + // The string below contains combining characters. + String^ combiningChars = L"a\u0304\u0308bc\u0327"; + + // Show each 'character' in the string. + EnumTextElements(combiningChars); + + // Show the index in the string where each 'character' starts. + EnumTextElementIndexes(combiningChars); + +}; + +// This code produces the following output. +// +// Result of GetTextElementEnumerator: +// Character at index 0 is 'a-"' +// Character at index 3 is 'b' +// Character at index 4 is 'c,' +// +// Result of ParseCombiningCharacters: +// Character 0 starts at index 0 +// Character 1 starts at index 3 +// Character 2 starts at index 4 +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp b/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp new file mode 100644 index 00000000000..7d915b93810 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmRdrRead/CPP/strmrdrread.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + //Create a FileInfo instance representing an existing text file. + FileInfo^ MyFile = gcnew FileInfo( "c:\\csc.txt" ); + + //Instantiate a StreamReader to read from the text file. + StreamReader^ sr = MyFile->OpenText(); + + //Read a single character. + int FirstChar = sr->Read(); + + //Display the ASCII number of the character read in both decimal and hexadecimal format. + Console::WriteLine( "The ASCII number of the first character read is {0:D} in decimal and {1:X} in hexadecimal.", FirstChar, FirstChar ); + + // + sr->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp new file mode 100644 index 00000000000..91fe38d447f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor1/CPP/strmreader ctor1.cpp @@ -0,0 +1,52 @@ +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + FileStream^ fs = gcnew FileStream( path,FileMode::Open ); + try + { + StreamReader^ sr = gcnew StreamReader( fs ); + try + { + while ( sr->Peek() >= 0 ) + { + Console::WriteLine( sr->ReadLine() ); + } + } + finally + { + delete sr; + } + } + finally + { + delete fs; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp new file mode 100644 index 00000000000..9966a619ccf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader Ctor2/CPP/strmreader ctor2.cpp @@ -0,0 +1,44 @@ +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path ); + try + { + while ( sr->Peek() >= 0 ) + { + Console::WriteLine( sr->ReadLine() ); + } + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp new file mode 100644 index 00000000000..2bd7741e9da --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader CurrentEncoding/CPP/strmreader currentencoding.cpp @@ -0,0 +1,53 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + + //Use an encoding other than the default (UTF8). + StreamWriter^ sw = gcnew StreamWriter( path,false,gcnew UnicodeEncoding ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path,true ); + try + { + while ( sr->Peek() >= 0 ) + { + Console::Write( (Char)sr->Read() ); + } + + //Test for the encoding after reading, or at least + //after the first read. + Console::WriteLine( "The encoding used was {0}.", sr->CurrentEncoding ); + Console::WriteLine(); + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp new file mode 100644 index 00000000000..cbfd1711768 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader Peek/CPP/strmreader peek.cpp @@ -0,0 +1,45 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path ); + try + { + while ( sr->Peek() > -1 ) + { + Console::WriteLine( sr->ReadLine() ); + } + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp new file mode 100644 index 00000000000..3b817c31cf1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader Read1/CPP/strmreader read1.cpp @@ -0,0 +1,44 @@ +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path ); + try + { + while ( sr->Peek() >= 0 ) + { + Console::Write( (Char)sr->Read() ); + } + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp new file mode 100644 index 00000000000..5ce83649e21 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader Read2/CPP/strmreader read2.cpp @@ -0,0 +1,52 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path ); + try + { + //This is an arbitrary size for this example. + array^c = nullptr; + while ( sr->Peek() >= 0 ) + { + c = gcnew array(5); + sr->Read( c, 0, c->Length ); + + //The output will look odd, because + //only five characters are read at a time. + Console::WriteLine( c ); + } + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp new file mode 100644 index 00000000000..5829e1a8108 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadLine/CPP/strmreader readline.cpp @@ -0,0 +1,45 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path ); + try + { + while ( sr->Peek() >= 0 ) + { + Console::WriteLine( sr->ReadLine() ); + } + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp new file mode 100644 index 00000000000..5ae01bcfc2e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrmReader ReadToEnd/CPP/strmreader readtoend.cpp @@ -0,0 +1,42 @@ +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ path = "c:\\temp\\MyTest.txt"; + try + { + if ( File::Exists( path ) ) + { + File::Delete( path ); + } + StreamWriter^ sw = gcnew StreamWriter( path ); + try + { + sw->WriteLine( "This" ); + sw->WriteLine( "is some text" ); + sw->WriteLine( "to test" ); + sw->WriteLine( "Reading" ); + } + finally + { + delete sw; + } + + StreamReader^ sr = gcnew StreamReader( path ); + try + { + //This allows you to do one Read operation. + Console::WriteLine( sr->ReadToEnd() ); + } + finally + { + delete sr; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The process failed: {0}", e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp b/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp new file mode 100644 index 00000000000..97c560511ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StrongNameKeyPairX/cpp/strongnamekeypairx.cpp @@ -0,0 +1,49 @@ +//Types:System.Reflection.StrongNameKeyPair +// +using namespace System; +using namespace System::IO; +using namespace System::Reflection; + +ref class snkX +{ +public: + static void Main() + { + // Open a file that contains a public key value. The line below + // assumes that the Strong Name tool (SN.exe) was executed from + // a command prompt as follows: + // SN.exe -k C:\Company.keys + FileStream^ fs = File::Open("C:\\Company.keys", FileMode::Open); + + // + // Construct a StrongNameKeyPair object. This object should obtain + // the public key from the Company.keys file. + StrongNameKeyPair^ k = gcnew StrongNameKeyPair(fs); + // + + // + // Display the bytes that make up the public key. + Console::WriteLine(BitConverter::ToString(k->PublicKey)); + // + + // Close the file. + fs->Close(); + } +}; + +int main() +{ + snkX::Main(); +} + +// Output will vary by user. +// +// 00-24-00-00-04-80-00-00-94-69-89-78-BB-F1-F2-71-00-00-00-34-26- +// 69-89-78-BB-F1-F2-71-00-F1-FA-F2-F9-4A-A8-5E-82-55-AB-49-4D-A6- +// ED-AB-5F-CE-DE-59-49-8D-63-01-B0-E1-BF-43-07-FA-55-D4-36-75-EE- +// 8B-83-32-39-B7-02-DE-3D-81-29-7B-E8-EA-F0-2E-78-94-96-F1-73-79- +// 69-89-78-BB-F1-F2-71-0E-4E-F4-5D-DD-A4-7F-11-54-DF-65-DE-89-23- +// 91-AD-53-E1-C0-DA-9E-0C-88-BE-AA-7B-39-20-9C-9B-55-34-26-3B-1A- +// 53-41-31-00-04-00-00-01-00-01-00-9D-F1-EA-14-4C-88-34-26-3B-1A- +// 2D-D7-A0-AB-F6-7E-B7-24-7F-87-DF-3E-97 +// diff --git a/snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp b/snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp new file mode 100644 index 00000000000..4c5c693094c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/StructLayoutAttribute/CPP/structlayoutattribute.cpp @@ -0,0 +1,78 @@ + +/* +System::Runtime::InteropServices::StructLayoutAttribute.StructLayoutAttribute(LayoutKind) +System::Runtime::InteropServices::StructLayoutAttribute.CharSet +System::Runtime::InteropServices::StructLayoutAttribute.Size + +The program shows a managed declaration of the GetSystemTime function and defines +MySystemTime class with explicit layout. The GetSystemTime get the system time +and print to the console. +*/ + +// +using namespace System; +using namespace System::Runtime::InteropServices; + +// +// + +[StructLayout(LayoutKind::Explicit,Size=16,CharSet=CharSet::Ansi)] +value class MySystemTime +{ +public: + + [FieldOffset(0)] + short wYear; + + [FieldOffset(2)] + short wMonth; + + [FieldOffset(4)] + short wDayOfWeek; + + [FieldOffset(6)] + short wDay; + + [FieldOffset(8)] + short wHour; + + [FieldOffset(10)] + short wMinute; + + [FieldOffset(12)] + short wSecond; + + [FieldOffset(14)] + short wMilliseconds; +}; + +ref class NativeMethods +{ +public: + + [DllImport("kernel32.dll")] + static void GetSystemTime( MySystemTime * st ); +}; + +int main() +{ + try + { + MySystemTime sysTime; + NativeMethods::GetSystemTime( &sysTime ); + Console::WriteLine( "The System time is {0}/{1}/{2} {3}:{4}:{5}", sysTime.wDay, sysTime.wMonth, sysTime.wYear, sysTime.wHour, sysTime.wMinute, sysTime.wSecond ); + } + catch ( TypeLoadException^ e ) + { + Console::WriteLine( "TypeLoadException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp b/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp new file mode 100644 index 00000000000..10d4eb14002 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/T.CompareTo/CPP/cat.cpp @@ -0,0 +1,134 @@ + +// +// This example demonstrates the two versions of the +// CompareTo method for several base types. +// The general version takes a parameter of type Object, while the specific +// version takes a type-specific parameter, such as Boolean, Int32, or Double. +using namespace System; + +void Show( String^ caption, Object^ var1, Object^ var2, int resultGeneric, int resultNonGeneric ) +{ + String^ relation; + Console::Write( caption ); + if ( resultGeneric == resultNonGeneric ) + { + if ( resultGeneric < 0 ) + relation = "less than"; + else + if ( resultGeneric > 0 ) + relation = "greater than"; + else + relation = "equal to"; + Console::WriteLine( "{0} is {1} {2}", var1, relation, var2 ); + } + // The following condition will never occur because the generic and non-generic + // CompareTo methods are equivalent. + else + { + Console::WriteLine( "Generic CompareTo = {0}; non-generic CompareTo = {1}", resultGeneric, resultNonGeneric ); + } +} + +int main() +{ + String^ nl = Environment::NewLine; + String^ msg = "{0}The following is the result of using the generic and non-generic{0}" + "versions of the CompareTo method for several base types:{0}"; + Object^ obj; // An Object used to insure CompareTo(Object) is called. + + DateTime now = DateTime::Now; + + // Time span = 11 days, 22 hours, 33 minutes, 44 seconds + TimeSpan tsX = TimeSpan(11,22,33,44); + + // Version = 1.2.333.4 + Version^ versX = gcnew Version( "1.2.333.4" ); + + // Guid = CA761232-ED42-11CE-BACD-00AA0057B223 + Guid guidX = Guid( "{CA761232-ED42-11CE-BACD-00AA0057B223}"); + Boolean a1 = true,a2 = true; + Byte b1 = 1,b2 = 1; + Int16 c1 = -2,c2 = 2; + Int32 d1 = 3,d2 = 3; + Int64 e1 = 4,e2 = -4; + Decimal f1 = Decimal(-5.5), f2 = Decimal(5.5); + Single g1 = 6.6f,g2 = 6.6f; + Double h1 = 7.7,h2 = -7.7; + Char i1 = 'A',i2 = 'A'; + String^ j1 = "abc", ^j2 = "abc"; + DateTime k1 = now,k2 = now; + TimeSpan l1 = tsX,l2 = tsX; + Version^ m1 = versX, ^m2 = gcnew Version( "2.0" ); + Guid n1 = guidX,n2 = guidX; + + // The following types are not CLS-compliant. + SByte w1 = 8,w2 = 8; + UInt16 x1 = 9,x2 = 9; + UInt32 y1 = 10,y2 = 10; + UInt64 z1 = 11,z2 = 11; + + // + Console::WriteLine( msg, nl ); + try + { + Show( "Boolean: ", a1, a2, a1.CompareTo( a2 ), a1.CompareTo( a2 ) ); + Show( "Byte: ", b1, b2, b1.CompareTo( b2 ), b1.CompareTo( b2 ) ); + Show( "Int16: ", c1, c2, c1.CompareTo( c2 ), c1.CompareTo( c2 ) ); + Show( "Int32: ", d1, d2, d1.CompareTo( d2 ), d1.CompareTo( d2 ) ); + Show( "Int64: ", e1, e2, e1.CompareTo( e2 ), e1.CompareTo( e2 ) ); + Show( "Decimal: ", f1, f2, f1.CompareTo( f2 ), f1.CompareTo( f2 ) ); + Show( "Single: ", g1, g2, g1.CompareTo( g2 ), g1.CompareTo( g2 ) ); + Show( "Double: ", h1, h2, h1.CompareTo( h2 ), h1.CompareTo( h2 ) ); + Show( "Char: ", i1, i2, i1.CompareTo( i2 ), i1.CompareTo( i2 ) ); + + // Use an anonymous object to hide the String object. + obj = j2; + Show( "String: ", j1, j2, j1->CompareTo( j2 ), j1->CompareTo( obj ) ); + Show( "DateTime:", k1, k2, k1.CompareTo( k2 ), k1.CompareTo( k2 ) ); + Show( "TimeSpan: ", l1, l2, l1.CompareTo( l2 ), l1.CompareTo( l2 ) ); + + // Use an anonymous object to hide the Version object. + obj = m2; + Show( "Version: ", m1, m2, m1->CompareTo( m2 ), m1->CompareTo( obj ) ); + Show( "Guid: ", n1, n2, n1.CompareTo( n2 ), n1.CompareTo( n2 ) ); + + // + Console::WriteLine( "{0}The following types are not CLS-compliant:", nl ); + Show( "SByte: ", w1, w2, w1.CompareTo( w2 ), w1.CompareTo( w2 ) ); + Show( "UInt16: ", x1, x2, x1.CompareTo( x2 ), x1.CompareTo( x2 ) ); + Show( "UInt32: ", y1, y2, y1.CompareTo( y2 ), y1.CompareTo( y2 ) ); + Show( "UInt64: ", z1, z2, z1.CompareTo( z2 ), z1.CompareTo( z2 ) ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + +} +// This example displays the following output: +// +// The following is the result of using the generic and non-generic versions of the +// CompareTo method for several base types: +// +// Boolean: True is equal to True +// Byte: 1 is equal to 1 +// Int16: -2 is less than 2 +// Int32: 3 is equal to 3 +// Int64: 4 is greater than -4 +// Decimal: -5.5 is less than 5.5 +// Single: 6.6 is equal to 6.6 +// Double: 7.7 is greater than -7.7 +// Char: A is equal to A +// String: abc is equal to abc +// DateTime: 12/1/2003 5:37:46 PM is equal to 12/1/2003 5:37:46 PM +// TimeSpan: 11.22:33:44 is equal to 11.22:33:44 +// Version: 1.2.333.4 is less than 2.0 +// Guid: ca761232-ed42-11ce-bacd-00aa0057b223 is equal to ca761232-ed42-11ce-bacd-00 +// aa0057b223 +// +// The following types are not CLS-compliant: +// SByte: 8 is equal to 8 +// UInt16: 9 is equal to 9 +// UInt32: 10 is equal to 10 +// UInt64: 11 is equal to 11 +// diff --git a/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp new file mode 100644 index 00000000000..cc253499947 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/T.TryParse/CPP/tp.cpp @@ -0,0 +1,181 @@ +// +// This example demonstrates overloads of the TryParse method for +// several base types, and the TryParseExact method for DateTime. +// In most cases, this example uses the most complex overload; that is, the overload +// with the most parameters for a particular type. If a complex overload specifies +// null (Nothing in Visual Basic) for the IFormatProvider parameter, formatting +// information is obtained from the culture associated with the current thread. +// If a complex overload specifies the style parameter, the parameter value is +// the default value used by the equivalent simple overload. +using namespace System; +using namespace System::Globalization; + +static void Show( bool parseResult, String^ typeName, String^ parseValue ) +{ + String^ msgSuccess = L"Parse for {0} = {1}"; + String^ msgFailure = L"** Parse for {0} failed. Invalid input."; + + // + if ( parseResult ) + Console::WriteLine( msgSuccess, typeName, parseValue ); + else + Console::WriteLine( msgFailure, typeName ); +} + +void main() +{ + bool result; + CultureInfo^ ci; + String^ nl = Environment::NewLine; + String^ msg1 = L"This example demonstrates overloads of the TryParse method for{0}" + L"several base types, as well as the TryParseExact method for DateTime.{0}"; + String^ msg2 = L"Non-numeric types:{0}"; + String^ msg3 = L"{0}Numeric types:{0}"; + String^ msg4 = L"{0}The following types are not CLS-compliant:{0}"; + + // Non-numeric types. + Boolean booleanVal; + Char charVal; + DateTime datetimeVal; + + // Numeric types. + Byte byteVal; + Int16 int16Val; + Int32 int32Val; + Int64 int64Val; + Decimal decimalVal; + Single singleVal; + Double doubleVal; + + // The following types are not CLS-compliant. + SByte sbyteVal; + UInt16 uint16Val; + UInt32 uint32Val; + UInt64 uint64Val; + + // + Console::WriteLine( msg1, nl ); + + // Non-numeric types: + Console::WriteLine( msg2, nl ); + + // DateTime + // TryParse: + // Assume current culture is en-US, and dates of the form: MMDDYYYY. + result = DateTime::TryParse( L"7/4/2004 12:34:56", datetimeVal ); + Show( result, L"DateTime #1", datetimeVal.ToString() ); + + // Use fr-FR culture, and dates of the form: DDMMYYYY. + ci = gcnew CultureInfo( L"fr-FR" ); + result = DateTime::TryParse( L"4/7/2004 12:34:56", ci, DateTimeStyles::None, datetimeVal ); + Show( result, L"DateTime #2", datetimeVal.ToString() ); + + // TryParseExact: + // Use fr-FR culture. The format, "G", is short date and long time. + result = DateTime::TryParseExact( L"04/07/2004 12:34:56", L"G", ci, DateTimeStyles::None, datetimeVal ); + Show( result, L"DateTime #3", datetimeVal.ToString() ); + + // Assume en-US culture. + array^dateFormats = {L"f",L"F",L"g",L"G"}; + result = DateTime::TryParseExact( L"7/4/2004 12:34:56 PM", dateFormats, nullptr, DateTimeStyles::None, datetimeVal ); + Show( result, L"DateTime #4", datetimeVal.ToString() ); + Console::WriteLine(); + + // Boolean + result = Boolean::TryParse( L"true", booleanVal ); + Show( result, L"Boolean", booleanVal.ToString() ); + + // Char + result = Char::TryParse( L"A", charVal ); + Show( result, L"Char", charVal.ToString() ); + + // Numeric types: + Console::WriteLine( msg3, nl ); + + // Byte + result = Byte::TryParse( L"1", NumberStyles::Integer, nullptr, byteVal ); + Show( result, L"Byte", byteVal.ToString() ); + + // Int16 + result = Int16::TryParse( L"-2", NumberStyles::Integer, nullptr, int16Val ); + Show( result, L"Int16", int16Val.ToString() ); + + // Int32 + result = Int32::TryParse( L"3", NumberStyles::Integer, nullptr, int32Val ); + Show( result, L"Int32", int32Val.ToString() ); + + // Int64 + result = Int64::TryParse( L"4", NumberStyles::Integer, nullptr, int64Val ); + Show( result, L"Int64", int64Val.ToString() ); + + // Decimal + result = Decimal::TryParse( L"-5.5", NumberStyles::Number, nullptr, decimalVal ); + Show( result, L"Decimal", decimalVal.ToString() ); + + // Single + result = Single::TryParse( L"6.6", static_cast((NumberStyles::Float | NumberStyles::AllowThousands)), nullptr, singleVal ); + Show( result, L"Single", singleVal.ToString() ); + + // Double + result = Double::TryParse( L"-7", static_cast(NumberStyles::Float | NumberStyles::AllowThousands), nullptr, doubleVal ); + Show( result, L"Double", doubleVal.ToString() ); + + // Use the simple Double.TryParse overload, but specify an invalid value. + result = Double::TryParse( L"abc", doubleVal ); + Show( result, L"Double #2", doubleVal.ToString() ); + + // + Console::WriteLine( msg4, nl ); + + // SByte + result = SByte::TryParse( L"-8", NumberStyles::Integer, nullptr, sbyteVal ); + Show( result, L"SByte", sbyteVal.ToString() ); + + // UInt16 + result = UInt16::TryParse( L"9", NumberStyles::Integer, nullptr, uint16Val ); + Show( result, L"UInt16", uint16Val.ToString() ); + + // UInt32 + result = UInt32::TryParse( L"10", NumberStyles::Integer, nullptr, uint32Val ); + Show( result, L"UInt32", uint32Val.ToString() ); + + // UInt64 + result = UInt64::TryParse( L"11", NumberStyles::Integer, nullptr, uint64Val ); + Show( result, L"UInt64", uint64Val.ToString() ); +} + +/* +This example produces the following results: + +This example demonstrates overloads of the TryParse method for +several base types, as well as the TryParseExact method for DateTime. + +Non-numeric types: + +Parse for DateTime #1 = 7/4/2004 12:34:56 PM +Parse for DateTime #2 = 7/4/2004 12:34:56 PM +Parse for DateTime #3 = 7/4/2004 12:34:56 PM +Parse for DateTime #4 = 7/4/2004 12:34:56 PM + +Parse for Boolean = True +Parse for Char = A + +Numeric types: + +Parse for Byte = 1 +Parse for Int16 = -2 +Parse for Int32 = 3 +Parse for Int64 = 4 +Parse for Decimal = -5.5 +Parse for Single = 6.6 +Parse for Double = -7 +** Parse for Double #2 failed. Invalid input. + +The following types are not CLS-compliant: + +Parse for SByte = -8 +Parse for UInt16 = 9 +Parse for UInt32 = 10 +Parse for UInt64 = 11 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp b/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp new file mode 100644 index 00000000000..e6f659eaf11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TestBaseType/CPP/testbasetype.cpp @@ -0,0 +1,10 @@ + +// +using namespace System; +void main() +{ + Type^ t = int::typeid; + Console::WriteLine( "{0} inherits from {1}.", t, t->BaseType ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp b/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp new file mode 100644 index 00000000000..9faf8c82ca5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TestFullName/CPP/TestFullName.cpp @@ -0,0 +1,14 @@ + +// +using namespace System; +int main() +{ + Type^ t = Array::typeid; + Console::WriteLine( "The full name of the Array type is {0}.", t->FullName ); +} + +/* This example produces the following output: + +The full name of the Array type is System.Array. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp b/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp new file mode 100644 index 00000000000..801fb6bb503 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TestGetElementType/CPP/TestGetElementType.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; +public ref class TestGetElementType{}; + +int main() +{ + array^array = {1,2,3}; + Type^ t = array->GetType(); + Type^ t2 = t->GetElementType(); + Console::WriteLine( "The element type of {0} is {1}.", array, t2 ); + TestGetElementType^ newMe = gcnew TestGetElementType; + t = newMe->GetType(); + t2 = t->GetElementType(); + Console::WriteLine( "The element type of {0} is {1}.", newMe, t2 == nullptr ? "null" : t2->ToString() ); +} + +/* This code produces the following output: + +The element type of System.Int32[] is System.Int32. +The element type of TestGetElementType is null. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp new file mode 100644 index 00000000000..aea549667ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TestIsAssignableFrom/cpp/testisassignablefrom.cpp @@ -0,0 +1,108 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +ref class Room +{ +}; + +ref class Kitchen : Room +{ +}; + +ref class Bedroom : Room +{ +}; + +ref class Guestroom : Bedroom +{ +}; + +ref class MasterBedroom : Bedroom +{ +}; + +ref class Program +{ +public: + static void Main() + { + // Demonstrate classes: + Console::WriteLine("Defined Classes:"); + Room^ room1 = gcnew Room(); + Kitchen^ kitchen1 = gcnew Kitchen(); + Bedroom^ bedroom1 = gcnew Bedroom(); + Guestroom^ guestroom1 = gcnew Guestroom(); + MasterBedroom^ masterbedroom1 = gcnew MasterBedroom(); + + Type^ room1Type = room1->GetType(); + Type^ kitchen1Type = kitchen1->GetType(); + Type^ bedroom1Type = bedroom1->GetType(); + Type^ guestroom1Type = guestroom1->GetType(); + Type^ masterbedroom1Type = masterbedroom1->GetType(); + + Console::WriteLine("room assignable from kitchen: {0}", room1Type->IsAssignableFrom(kitchen1Type)); + Console::WriteLine("bedroom assignable from guestroom: {0}", bedroom1Type->IsAssignableFrom(guestroom1Type)); + Console::WriteLine("kitchen assignable from masterbedroom: {0}", kitchen1Type->IsAssignableFrom(masterbedroom1Type)); + + // Demonstrate arrays: + Console::WriteLine(); + Console::WriteLine("Integer arrays:"); + array^ array2 = gcnew array(2); + array^ array10 = gcnew array(10); + array^ array22 = gcnew array(2, 2); + array^ array24 = gcnew array(2, 4); + + Type^ array2Type = array2->GetType(); + Type^ array10Type = array10->GetType(); + Type^ array22Type = array22->GetType(); + Type^ array24Type = array24->GetType(); + + Console::WriteLine("Int32[2] assignable from Int32[10]: {0}", array2Type->IsAssignableFrom(array10Type)); + Console::WriteLine("Int32[2] assignable from Int32[2,4]: {0}", array2Type->IsAssignableFrom(array24Type)); + Console::WriteLine("Int32[2,4] assignable from Int32[2,2]: {0}", array24Type->IsAssignableFrom(array22Type)); + + // Demonstrate generics: + Console::WriteLine(); + Console::WriteLine("Generics:"); + + // Note that "int?[]" is the same as "Nullable[]" + //int?[] arrayNull = new int?[10]; + array^ arrayNull = gcnew array(10); + List^ genIntList = gcnew List(); + List^ genTList = gcnew List(); + + Type^ arrayNullType = arrayNull->GetType(); + Type^ genIntListType = genIntList->GetType(); + Type^ genTListType = genTList->GetType(); + + Console::WriteLine("Int32[10] assignable from Nullable[10]: {0}", array10Type->IsAssignableFrom(arrayNullType)); + Console::WriteLine("List assignable from List: {0}", genIntListType->IsAssignableFrom(genTListType)); + Console::WriteLine("List assignable from List: {0}", genTListType->IsAssignableFrom(genIntListType)); + + Console::ReadLine(); + } +}; + +int main() +{ + Program::Main(); +} + +//This code example produces the following output: +// +// Defined Classes: +// room assignable from kitchen: True +// bedroom assignable from guestroom: True +//kitchen assignable from masterbedroom: False +// +// Integer arrays: +// Int32[2] assignable from Int32[10]: True +// Int32[2] assignable from Int32[2,4]: False +// Int32[2,4] assignable from Int32[2,2]: True +// +// Generics: +// Int32[10] assignable from Nullable[10]: False +// List assignable from List: False +// List assignable from List: False +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp new file mode 100644 index 00000000000..9c1f8344454 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TestIsEnum/CPP/TestIsEnum.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +enum class Color +{ Red, Blue, Green }; + +int main() +{ + Type^ colorType = Color::typeid; + Type^ enumType = Enum::typeid; + Console::WriteLine( "Is Color an enum? {0}.", colorType->IsEnum ); + Console::WriteLine( "Is Color a value type? {0}.", colorType->IsValueType ); + Console::WriteLine( "Is Enum an enum Type? {0}.", enumType->IsEnum ); + Console::WriteLine( "Is Enum a value type? {0}.", enumType->IsValueType ); +} +// The example displays the following output: +// Is Color an enum? True. +// Is Color a value type? True. +// Is Enum an enum type? False. +// Is Enum a value type? False. +// diff --git a/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp b/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp new file mode 100644 index 00000000000..b2152ac3fa7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TestIsInstanceOfType/CPP/testisinstanceoftype.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; + +public interface class IExample{}; + +public ref class BaseClass: IExample{}; + +public ref class DerivedClass: BaseClass{}; + +void main() +{ + Type^ interfaceType = IExample::typeid; + BaseClass^ base1 = gcnew BaseClass; + Type^ base1Type = base1->GetType(); + BaseClass^ derived1 = gcnew DerivedClass; + Type^ derived1Type = derived1->GetType(); + array^ arr = gcnew array(11); + Type^ arrayType = Array::typeid; + + Console::WriteLine("Is Int32[] an instance of the Array class? {0}.", + arrayType->IsInstanceOfType( arr ) ); + Console::WriteLine("Is myclass an instance of BaseClass? {0}.", + base1Type->IsInstanceOfType( base1 ) ); + Console::WriteLine("Is myderivedclass an instance of BaseClass? {0}.", + base1Type->IsInstanceOfType( derived1 ) ); + Console::WriteLine("Is myclass an instance of IExample? {0}.", + interfaceType->IsInstanceOfType( base1 ) ); + Console::WriteLine("Is myderivedclass an instance of IExample? {0}.", + interfaceType->IsInstanceOfType( derived1 ) ); +} +// The example displays the following output: +// Is int[] an instance of the Array class? True. +// Is base1 an instance of BaseClass? True. +// Is derived1 an instance of BaseClass? True. +// Is base1 an instance of IExample? True. +// Is derived1 an instance of IExample? True. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp new file mode 100644 index 00000000000..00fb6116cb7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Thread.GetSetTrySetApartmentState/cpp/source.cpp @@ -0,0 +1,47 @@ +// +using namespace System; +using namespace System::Threading; + +void ThreadProc() +{ + Thread::Sleep(2000); +}; + +void main() +{ + Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); + Console::WriteLine("Before setting apartment state: {0}", + t->GetApartmentState()); + + t->SetApartmentState(ApartmentState::STA); + Console::WriteLine("After setting apartment state: {0}", + t->GetApartmentState()); + + bool result = t->TrySetApartmentState(ApartmentState::MTA); + Console::WriteLine("Try to change state: {0}", result); + + t->Start(); + + Thread::Sleep(500); + + try + { + t->TrySetApartmentState(ApartmentState::STA); + } + catch (ThreadStateException^) + { + Console::WriteLine("ThreadStateException occurs " + + "if apartment state is set after starting thread."); + } + + t->Join(); +} + +/* This code example produces the following output: + +Before setting apartment state: Unknown +After setting apartment state: STA +Try to change state: False +ThreadStateException occurs if apartment state is set after starting thread. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp new file mode 100644 index 00000000000..b1f06ee79ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ThreadAbEx/CPP/threadabex.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Security::Permissions; +ref class ThreadWork +{ +public: + static void DoWork() + { + try + { + for ( int i = 0; i < 100; i++ ) + { + Console::WriteLine( "Thread - working." ); + Thread::Sleep( 100 ); + + } + } + catch ( ThreadAbortException^ e ) + { + Console::WriteLine( "Thread - caught ThreadAbortException - resetting." ); + Console::WriteLine( "Exception message: {0}", e->Message ); + Thread::ResetAbort(); + } + + Console::WriteLine( "Thread - still alive and working." ); + Thread::Sleep( 1000 ); + Console::WriteLine( "Thread - finished working." ); + } + +}; + +int main() +{ + ThreadStart^ myThreadDelegate = gcnew ThreadStart( ThreadWork::DoWork ); + Thread^ myThread = gcnew Thread( myThreadDelegate ); + myThread->Start(); + Thread::Sleep( 100 ); + Console::WriteLine( "Main - aborting my thread." ); + myThread->Abort(); + myThread->Join(); + Console::WriteLine( "Main ending." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp new file mode 100644 index 00000000000..45cf4ed9674 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ThreadStEx/CPP/threadstex.cpp @@ -0,0 +1,33 @@ + +// +using namespace System; +using namespace System::Threading; +ref class ThreadWork +{ +public: + static void DoWork() + { + Console::WriteLine( "Working thread..." ); + } + +}; + +int main() +{ + ThreadStart^ myThreadDelegate = gcnew ThreadStart( ThreadWork::DoWork ); + Thread^ myThread = gcnew Thread( myThreadDelegate ); + myThread->Start(); + Thread::Sleep( 0 ); + Console::WriteLine( "In main. Attempting to restart myThread." ); + try + { + myThread->Start(); + } + catch ( ThreadStateException^ e ) + { + Console::WriteLine( "Caught: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp b/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp new file mode 100644 index 00000000000..d59246f431a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ThreadStart/CPP/threadstart.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::Threading; + +public ref class ThreadWork +{ +public: + static void DoWork() + { + for ( int i = 0; i < 3; i++ ) + { + Console::WriteLine( "Working thread..." ); + Thread::Sleep( 100 ); + } + } +}; + +int main() +{ + ThreadStart^ myThreadDelegate = gcnew ThreadStart(&ThreadWork::DoWork); + Thread^ thread1 = gcnew Thread( myThreadDelegate ); + thread1->Start(); + for ( int i = 0; i < 3; i++ ) + { + Console::WriteLine( "In main." ); + Thread::Sleep( 100 ); + } +} +// The example displays output like the following: +// In main. +// Working thread... +// In main. +// Working thread... +// In main. +// Working thread... +// diff --git a/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp b/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp new file mode 100644 index 00000000000..29339b956eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TimeoutException.class/cpp/to.cpp @@ -0,0 +1,53 @@ +// +// This example demonstrates the use of the TimeoutException +// exception in conjunction with the SerialPort class. + +#using + +using namespace System; +using namespace System::IO::Ports; + +int main() +{ + String^ input; + try + { + // Set the COM1 serial port to speed = 4800 baud, parity = odd, + // data bits = 8, stop bits = 1. + SerialPort^ port = gcnew SerialPort("COM1", + 4800, Parity::Odd, 8, StopBits::One); + // Timeout after 2 seconds. + port->ReadTimeout = 2000; + port->Open(); + + // Read until either the default newline termination string + // is detected or the read operation times out. + input = port->ReadLine(); + + port->Close(); + + // Echo the input. + Console::WriteLine(input); + } + + // Only catch timeout exceptions. + catch (TimeoutException^ ex) + { + Console::WriteLine(ex); + } +}; +/* +This example produces the following results: + +(Data received at the serial port is echoed to the console if the +read operation completes successfully before the specified timeout period +expires. Otherwise, a timeout exception like the following is thrown.) + +System.TimeoutException: The operation has timed-out. +at System.IO.Ports.SerialStream.ReadByte(Int32 timeout) +at System.IO.Ports.SerialPort.ReadOneChar(Int32 timeout) +at System.IO.Ports.SerialPort.ReadTo(String value) +at System.IO.Ports.SerialPort.ReadLine() +at Sample.Main() +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp b/snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp new file mode 100644 index 00000000000..0e97e3124f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TransactedInstaller/CPP/transactedinstaller.cpp @@ -0,0 +1,129 @@ +// System::Configuration::Install::TransactedInstaller +// System::Configuration::Install::TransactedInstaller.TransactedInstaller() +// System::Configuration::Install::TransactedInstaller.Install(IDictionary*) +// System::COnfiguration::Install::TransactedInstaller.Uninstall(IDictionary*) + +/* +The following example demonstrates the constructor, Install(IDictionary*) and +Uninstall(IDictionary*) methods of the 'TransactedInstaller' class. +This example provides an implementation similar to that of 'InstallUtil.exe'. +It installs assemblies with the options preceding that particular assembly. +If an option is not specified for an assembly the previous assemblies options +are taken if there is a previous assembly in the list. If the '/u' or +'/uninstall' option is specified then the assemblies are uninstalled. +If the '/?' or '/help' option is provided then the help information is +printed to the console. +*/ + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::IO; + +void PrintHelpMessage() +{ + Console::WriteLine( "Usage : TransactedInstaller [/u | /uninstall] [option [...]] assembly" + + " [[option [...]] assembly] [...]]" ); + Console::WriteLine( "TransactedInstaller executes the installers in each of" + + " the given assembly. If /u or /uninstall option" + + " is given it uninstalls the assemblies." ); +} + +int main() +{ + // + // + // + // + array^ args = Environment::GetCommandLineArgs(); + ArrayList^ myOptions = gcnew ArrayList; + String^ myOption; + bool toUnInstall = false; + bool toPrintHelp = false; + TransactedInstaller^ myTransactedInstaller = gcnew TransactedInstaller; + AssemblyInstaller^ myAssemblyInstaller; + InstallContext^ myInstallContext; + + try + { + for ( int i = 1; i < args->Length; i++ ) + { + // Process the arguments. + if ( args[ i ]->StartsWith( "/" ) || args[ i ]->StartsWith( "-" ) ) + { + myOption = args[ i ]->Substring( 1 ); + // Determine whether the option is to 'uninstall' an assembly. + if ( String::Compare( myOption, "u", true ) == 0 || + String::Compare( myOption, "uninstall", true ) == 0 ) + { + toUnInstall = true; + continue; + } + // Determine whether the option is for printing help information. + if ( String::Compare( myOption, "?", true ) == 0 || + String::Compare( myOption, "help", true ) == 0 ) + { + toPrintHelp = true; + continue; + } + // Add the option encountered to the list of all options + // encountered for the current assembly. + myOptions->Add( myOption ); + } + else + { + // Determine whether the assembly file exists. + if ( !File::Exists( args[ i ] ) ) + { + // If assembly file doesn't exist then print error. + Console::WriteLine( "\nError : {0} - Assembly file doesn't exist.", + args[ i ] ); + return 0; + } + + // Create a instance of 'AssemblyInstaller' that installs the given assembly. + myAssemblyInstaller = + gcnew AssemblyInstaller( args[ i ], + (array^)( myOptions->ToArray( String::typeid ) ) ); + // Add the instance of 'AssemblyInstaller' to the 'TransactedInstaller'. + myTransactedInstaller->Installers->Add( myAssemblyInstaller ); + } + } + + // If user requested help or didn't provide any assemblies to install + // then print help message. + if ( toPrintHelp || myTransactedInstaller->Installers->Count == 0 ) + { + PrintHelpMessage(); + return 0; + } + + // Create a instance of 'InstallContext' with the options specified. + myInstallContext = + gcnew InstallContext( "Install.log", + (array^)( myOptions->ToArray( String::typeid ) ) ); + myTransactedInstaller->Context = myInstallContext; + + // Install or Uninstall an assembly depending on the option provided. + if ( !toUnInstall ) + { + myTransactedInstaller->Install( gcnew Hashtable ); + } + else + { + myTransactedInstaller->Uninstall( nullptr ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised : {0}", e->Message ); + } + // + // + // + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp b/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp new file mode 100644 index 00000000000..813adf57610 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type.IsPublic/CPP/type_ispublic.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; + +// Declare MyTestClass as public. +public ref class TestClass{}; + +int main() +{ + TestClass^ testClassInstance = gcnew TestClass; + + // Get the type of myTestClassInstance. + Type^ testType = testClassInstance->GetType(); + + // Get the IsPublic property of the myTestClassInstance. + bool isPublic = testType->IsPublic; + Console::WriteLine( "Is {0} public? {1}", testType->FullName, isPublic); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp new file mode 100644 index 00000000000..3f49f739983 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type.StructLayoutAttribute/CPP/Type.StructLayoutAttribute.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; +using namespace System::Runtime::InteropServices; +value struct Test1 +{ +public: + Byte B1; + short S; + Byte B2; +}; + + +[StructLayout(LayoutKind::Explicit,Pack=1)] +value struct Test2 +{ +public: + + [FieldOffset(0)] + Byte B1; + + [FieldOffset(1)] + short S; + + [FieldOffset(3)] + Byte B2; +}; + +static void DisplayLayoutAttribute( StructLayoutAttribute^ sla ) +{ + Console::WriteLine( L"\r\nCharSet: {0}\r\n Pack: {1}\r\n Size: {2}\r\n Value: {3}", sla->CharSet, sla->Pack, sla->Size, sla->Value ); +} + +int main() +{ + DisplayLayoutAttribute( Test1::typeid->StructLayoutAttribute ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp new file mode 100644 index 00000000000..c9151536fe5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder.DefineMethodOverride/cpp/source.cpp @@ -0,0 +1,104 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public interface class I +{ + void M(); +}; + +public ref class A +{ +public: + virtual void M() { Console::WriteLine("In method A.M"); } +}; + +// The object of this code example is to emit code equivalent to +// the following C++ code: +// +public ref class C : A, I +{ +public: + virtual void M() override + { + Console::WriteLine("Overriding A.M from C.M"); + } + +private: + // In order to provide a different implementation from C.M when + // emitting the following explicit interface implementation, + // it is necessary to use a MethodImpl. + // + virtual void IM() sealed = I::M + { + Console::WriteLine("The I::M implementation of C"); + } +}; + +void main() +{ + String^ name = "DefineMethodOverrideExample"; + AssemblyName^ asmName = gcnew AssemblyName(name); + AssemblyBuilder^ ab = + AppDomain::CurrentDomain->DefineDynamicAssembly( + asmName, AssemblyBuilderAccess::RunAndSave); + ModuleBuilder^ mb = ab->DefineDynamicModule(name, name + ".dll"); + + TypeBuilder^ tb = + mb->DefineType("C", TypeAttributes::Public, A::typeid); + tb->AddInterfaceImplementation(I::typeid); + + // Build the method body for the explicit interface + // implementation. The name used for the method body + // can be anything. Here, it is the name of the method, + // qualified by the interface name. + // + MethodBuilder^ mbIM = tb->DefineMethod("I.M", + MethodAttributes::Private | MethodAttributes::HideBySig | + MethodAttributes::NewSlot | MethodAttributes::Virtual | + MethodAttributes::Final, + nullptr, + Type::EmptyTypes); + ILGenerator^ il = mbIM->GetILGenerator(); + il->Emit(OpCodes::Ldstr, "The I.M implementation of C"); + il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine", + gcnew array { String::typeid })); + il->Emit(OpCodes::Ret); + + // DefineMethodOverride is used to associate the method + // body with the interface method that is being implemented. + // + tb->DefineMethodOverride(mbIM, I::typeid->GetMethod("M")); + + MethodBuilder^ mbM = tb->DefineMethod("M", + MethodAttributes::Public | MethodAttributes::ReuseSlot | + MethodAttributes::Virtual | MethodAttributes::HideBySig, + nullptr, + Type::EmptyTypes); + il = mbM->GetILGenerator(); + il->Emit(OpCodes::Ldstr, "Overriding A.M from C.M"); + il->Emit(OpCodes::Call, Console::typeid->GetMethod("WriteLine", + gcnew array { String::typeid })); + il->Emit(OpCodes::Ret); + + Type^ tc = tb->CreateType(); + + // Save the emitted assembly, to examine with Ildasm.exe. + ab->Save(name + ".dll"); + + Object^ test = Activator::CreateInstance(tc); + + MethodInfo^ mi = I::typeid->GetMethod("M"); + mi->Invoke(test, nullptr); + + mi = A::typeid->GetMethod("M"); + mi->Invoke(test, nullptr); +} + +/* This code example produces the following output: + +The I.M implementation of C +Overriding A.M from C.M + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp new file mode 100644 index 00000000000..6ea81968d31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_AddDeclarativeSecurity/CPP/typebuilder_adddeclarativesecurity.cpp @@ -0,0 +1,47 @@ + +// System::Reflection::Emit::TypeBuilder.AddDeclarativeSecurity +/* The following example demonstrates method AddDeclarativeSecurity +of 'TypeBuilder' class. +The program creates a dynamic assembly and a type in it having support for declarative security. +It demands an Environmentpermission read access on 'TEMP'. +Caller (main) is able to create an instance successfully with +default permission(as local machine executes with full trust permission set). +*/ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Security; +using namespace System::Security::Permissions; + +int main() +{ + // Create a simple name for the assembly; create the assembly and module. + AssemblyName^ myAssemblyName = gcnew AssemblyName("EmittedAssembly"); + AssemblyBuilder^ myAssemblyBuilder = + AppDomain::CurrentDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ myModuleBuilder = + myAssemblyBuilder->DefineDynamicModule( "EmittedAssembly", "EmittedAssembly.dll"); + + // Define a public class named "MyDynamicClass" in the assembly. + TypeBuilder^ myTypeBuilder = myModuleBuilder->DefineType( "MyDynamicClass", TypeAttributes::Public ); + + + // Create a permission set and add a security permission + // with the ControlEvidence flag. + // + PermissionSet^ myPermissionSet = gcnew PermissionSet(PermissionState::None); + myPermissionSet->AddPermission( + gcnew SecurityPermission(SecurityPermissionFlag::ControlEvidence)); + + // Add the permission set to the MyDynamicClass type, + // as a declarative security demand. + // + myTypeBuilder->AddDeclarativeSecurity(SecurityAction::Demand, myPermissionSet); + + + Type^ myType = myTypeBuilder->CreateType(); + myAssemblyBuilder->Save("EmittedAssembly.dll"); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp new file mode 100644 index 00000000000..c19e9adcb71 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineNestedType1/CPP/typebuilder_definenestedtype1.cpp @@ -0,0 +1,94 @@ + +// System.Reflection.Emit.TypeBuilder.DefineNestedType(string, TypeAttributes, Type, Type[]) +// System.Reflection.Emit.TypeBuilder.DefineMethodOverride(MethodInfo, MethodInfo) +// System.Reflection.Emit.TypeBuilder.DefineMethod(string, MethodAttributes,Type,Type[]) +/* +The following program demonstrates the 'DefineNestedType', 'DefineMethodOverride' and +'DefineMethod' methods of 'TypeBuilder' class. It builds an assembly by defining +'MyHelloWorld' type. 'MyHelloWorld' class has a nested class 'MyNestedClass' which extends +'EmittedClass' and implements 'IMyInterface' interface. Then it creates and instance of +'MyNestedClass' type and calls the 'HelloMethod' using 'IMyInterface' object and +results are displayed to the console. +*/ +// +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +public interface class IMyInterface +{ + String^ HelloMethod( String^ parameter ); +}; + +public ref class EmittedClass +{ +public: + // Because this method calls Activator::CreateInstance, + // it requires full trust. + [System::Security::Permissions::PermissionSetAttribute + (System::Security::Permissions::SecurityAction::Demand, Name = "FullTrust")] + static void Main() + { + Type^ myNestedClassType = CreateCallee( Thread::GetDomain() ); + + // Create an instance of 'MyNestedClass'. + IMyInterface^ myInterface = dynamic_cast(Activator::CreateInstance( myNestedClassType )); + Console::WriteLine( myInterface->HelloMethod( "Bill" ) ); + } + +private: + + // Create the callee transient dynamic assembly. + static Type^ CreateCallee( AppDomain^ myAppDomain ) + { + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedClass"; + + // Create the callee dynamic assembly. + AssemblyBuilder^ myAssembly = myAppDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module in the callee assembly. + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Define a public class named "MyHelloWorld". + TypeBuilder^ myHelloWorldType = myModule->DefineType( "MyHelloWorld", TypeAttributes::Public ); + + // Define a public nested class named 'MyNestedClass'. + array^temp0 = {IMyInterface::typeid}; + TypeBuilder^ myNestedClassType = myHelloWorldType->DefineNestedType( "MyNestedClass", TypeAttributes::NestedPublic, EmittedClass::typeid, temp0 ); + + // Implement 'IMyInterface' interface. + myNestedClassType->AddInterfaceImplementation( IMyInterface::typeid ); + + // Define 'HelloMethod' of 'IMyInterface'. + array^temp1 = {String::typeid}; + MethodBuilder^ myHelloMethod = myNestedClassType->DefineMethod( "HelloMethod", static_cast(MethodAttributes::Public | MethodAttributes::Virtual), String::typeid, temp1 ); + + // Generate IL for 'GetGreeting' method. + ILGenerator^ myMethodIL = myHelloMethod->GetILGenerator(); + myMethodIL->Emit( OpCodes::Ldstr, "Hi! " ); + myMethodIL->Emit( OpCodes::Ldarg_1 ); + array^temp2 = {String::typeid,String::typeid}; + MethodInfo^ infoMethod = String::typeid->GetMethod( "Concat", temp2 ); + myMethodIL->Emit( OpCodes::Call, infoMethod ); + myMethodIL->Emit( OpCodes::Ret ); + MethodInfo^ myHelloMethodInfo = IMyInterface::typeid->GetMethod( "HelloMethod" ); + + // Implement 'HelloMethod' of 'IMyInterface'. + myNestedClassType->DefineMethodOverride( myHelloMethod, myHelloMethodInfo ); + + // Create 'MyHelloWorld' type. + Type^ myType = myHelloWorldType->CreateType(); + + // Create 'MyNestedClass' type. + return myNestedClassType->CreateType(); + } +}; + +int main() +{ + EmittedClass::Main(); +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp new file mode 100644 index 00000000000..15212e47056 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefinePInvokeMethod_Fix/cpp/100656_fix.cpp @@ -0,0 +1,64 @@ +// +using namespace System; +using namespace System::Text; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; + + void main() + { + // Create the AssemblyBuilder. + AssemblyName^ asmName = gcnew AssemblyName("PInvokeTest"); + AssemblyBuilder^ dynamicAsm = AppDomain::CurrentDomain->DefineDynamicAssembly( + asmName, + AssemblyBuilderAccess::RunAndSave + ); + + // Create the module. + ModuleBuilder^ dynamicMod = + dynamicAsm->DefineDynamicModule(asmName->Name, asmName->Name + ".dll"); + + // Create the TypeBuilder for the class that will contain the + // signature for the PInvoke call. + TypeBuilder^ tb = dynamicMod->DefineType( + "MyType", + TypeAttributes::Public | TypeAttributes::UnicodeClass + ); + + MethodBuilder^ mb = tb->DefinePInvokeMethod( + "GetTickCount", + "Kernel32.dll", + MethodAttributes::Public | MethodAttributes::Static | MethodAttributes::PinvokeImpl, + CallingConventions::Standard, + int::typeid, + Type::EmptyTypes, + CallingConvention::Winapi, + CharSet::Ansi); + + // Add PreserveSig to the method implementation flags. NOTE: If this line + // is commented out, the return value will be zero when the method is + // invoked. + mb->SetImplementationFlags( + mb->GetMethodImplementationFlags() | MethodImplAttributes::PreserveSig); + + // The PInvoke method does not have a method body. + + // Create the class and test the method. + Type^ t = tb->CreateType(); + + MethodInfo^ mi = t->GetMethod("GetTickCount"); + Console::WriteLine("Testing PInvoke method..."); + Console::WriteLine("GetTickCount returned: {0}", mi->Invoke(nullptr, nullptr)); + + // Produce the .dll file. + Console::WriteLine("Saving: " + asmName->Name + ".dll"); + dynamicAsm->Save(asmName->Name + ".dll"); + }; + +/* This example produces output similar to the following: + +Testing PInvoke method... +GetTickCount returned: 1314410994 +Saving: PInvokeTest.dll + */ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp new file mode 100644 index 00000000000..ad88d21ef91 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_DefineUninitializedData/CPP/typebuilder_defineuninitializeddata.cpp @@ -0,0 +1,98 @@ + + +// System::Reflection::Emit::TypeBuilder::DefineUninitializedData(string,int,FieldAttributes) +/* +The following program demonstrates the 'DefineUninitializedData' +method of 'TypeBuilder' class. It builds an assembly by defining 'MyHelloWorld' type and +it has 'MyGreeting' field. Then it displays the initial value of 'MyGreeting' +field to the console. +*/ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +public ref class Example +{ +public: + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + static void Main() + { + Type^ myHelloWorldType = CreateCallee( Thread::GetDomain() ); + Object^ myHelloWorldInstance = Activator::CreateInstance( myHelloWorldType ); + FieldInfo^ myGreetingFieldInfo = myHelloWorldType->GetField( "MyGreeting" ); + Object^ oval = Activator::CreateInstance( myGreetingFieldInfo->FieldType ); + IntPtr myIntPtr = Marshal::AllocHGlobal( 4 ); + Random^ rand = gcnew Random; + int iTempSeed = rand->Next(); + array^bINITBYTE = GetRandBytes( iTempSeed, 4 ); + IntPtr intptrTemp = myIntPtr; + for ( int j = 0; j < 4; j++ ) + { + Marshal::WriteByte( myIntPtr, bINITBYTE[ j ] ); + myIntPtr = (IntPtr)((int)myIntPtr + 1); + + } + myIntPtr = intptrTemp; + Object^ oValNew = Marshal::PtrToStructure( myIntPtr, myGreetingFieldInfo->FieldType ); + Marshal::FreeHGlobal( myIntPtr ); + myIntPtr = Marshal::AllocHGlobal( 4 ); + Object^ myObj = myGreetingFieldInfo->GetValue( myHelloWorldInstance ); + Marshal::StructureToPtr( myObj, myIntPtr, true ); + intptrTemp = myIntPtr; + Console::WriteLine( "The value of 'MyGreeting' field : " ); + for ( int j = 0; j < 4; j++ ) + { + Marshal::WriteByte( myIntPtr, bINITBYTE[ j ] ); + Console::WriteLine( bINITBYTE[ j ] ); + myIntPtr = (IntPtr)((int)myIntPtr + 1); + + } + } + + +private: + static array^ GetRandBytes( int iRandSeed, int iSize ) + { + array^barr = gcnew array(iSize); + Random^ randTemp = gcnew Random( iRandSeed ); + randTemp->NextBytes( barr ); + return barr; + } + + + // Create the callee transient dynamic assembly. + static Type^ CreateCallee( AppDomain^ myDomain ) + { + + // Create a simple name for the callee assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedClass"; + + // Create the callee dynamic assembly. + AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module in the callee assembly. + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Define a public class named "MyHelloWorld" + TypeBuilder^ myHelloWorldType = myModule->DefineType( "MyHelloWorld", TypeAttributes::Public ); + + // Define a 'MyGreeting' field and initialize it. + FieldBuilder^ myFieldBuilder = myHelloWorldType->DefineUninitializedData( "MyGreeting", 4, FieldAttributes::Public ); + + // Create the 'MyHelloWorld' class. + return (myHelloWorldType->CreateType()); + } + +}; + +int main() +{ + Example::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp new file mode 100644 index 00000000000..e35e284ec04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_GetEvents1/CPP/typebuilder_getevents1.cpp @@ -0,0 +1,64 @@ + +// System::Reflection::Emit::TypeBuilder.GetEvents(BindingFlags) +/* +The program demonstrates the 'GetEvents' method of the 'TypeBuilder' class. +It builds an assembly by defining 'HelloWorld' type and creates a 'Click' and +'MouseUp' events on the type. Then displays all events to the Console. +*/ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +ref class MyApplication +{ +private: + delegate void MyEvent( Object^ temp ); + +public: + + // Create the callee transient dynamic assembly. + static TypeBuilder^ CreateCallee( AppDomain^ myDomain ) + { + AssemblyName^ assemblyName = gcnew AssemblyName; + assemblyName->Name = "EmittedAssembly"; + + // Create the callee dynamic assembly. + AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( assemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Define a public class named "HelloWorld" in the assembly. + TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + array^typeArray = gcnew array(1); + typeArray[ 0 ] = Object::typeid; + MethodBuilder^ myMethod1 = helloWorldClass->DefineMethod( "OnClick", MethodAttributes::Public, void::typeid, typeArray ); + ILGenerator^ methodIL1 = myMethod1->GetILGenerator(); + methodIL1->Emit( OpCodes::Ret ); + MethodBuilder^ myMethod2 = helloWorldClass->DefineMethod( "OnMouseUp", MethodAttributes::Public, void::typeid, typeArray ); + ILGenerator^ methodIL2 = myMethod2->GetILGenerator(); + methodIL2->Emit( OpCodes::Ret ); + + // Create the events. + EventBuilder^ myEvent1 = helloWorldClass->DefineEvent( "Click", EventAttributes::None, MyEvent::typeid ); + myEvent1->SetRaiseMethod( myMethod1 ); + EventBuilder^ myEvent2 = helloWorldClass->DefineEvent( "MouseUp", EventAttributes::None, MyEvent::typeid ); + myEvent2->SetRaiseMethod( myMethod2 ); + helloWorldClass->CreateType(); + return (helloWorldClass); + } +}; + +int main() +{ + TypeBuilder^ helloWorldClass = MyApplication::CreateCallee( Thread::GetDomain() ); + array^info = helloWorldClass->GetEvents( static_cast(BindingFlags::Public | BindingFlags::Instance) ); + Console::WriteLine( "'HelloWorld' type has following events :" ); + for ( int i = 0; i < info->Length; i++ ) + Console::WriteLine( info[ i ]->Name ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp new file mode 100644 index 00000000000..a6d8a10bd75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Properties1/CPP/typebuilder_properties.cpp @@ -0,0 +1,66 @@ + +// System.Reflection.Emit.TypeBuilder.FullName +// System.Reflection.Emit.TypeBuilder.GetConstructors +// System.Reflection.Emit.TypeBuilder.DefineTypeInitializer +/* +The following program demonstrates DefineTypeInitializer and 'GetConstructors' methods and +the 'FullName' property of 'TypeBuilder' class. It builds an assembly by defining 'HelloWorld' +type. It also defines a constructor for 'HelloWorld' type. Then it displays the +full name of type and its constructors to the console. +*/ +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// +// +// +// Create the callee transient dynamic assembly. +TypeBuilder^ CreateCallee( AppDomain^ myDomain ) +{ + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + + // Create the callee dynamic assembly. + AssemblyBuilder^ myAssembly = myDomain->DefineDynamicAssembly( myAssemblyName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module named "CalleeModule" in the callee assembly. + ModuleBuilder^ myModule = myAssembly->DefineDynamicModule( "EmittedModule" ); + + // Define a public class named "HelloWorld" in the assembly. + TypeBuilder^ helloWorldClass = myModule->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Define a private String field named "Greeting" in the type. + FieldBuilder^ greetingField = helloWorldClass->DefineField( "Greeting", String::typeid, FieldAttributes::Private ); + + // Create the constructor. + ConstructorBuilder^ constructor = helloWorldClass->DefineTypeInitializer(); + + // Generate IL for the method. The constructor calls its base class + // constructor. The constructor stores its argument in the private field. + ILGenerator^ constructorIL = constructor->GetILGenerator(); + constructorIL->Emit( OpCodes::Ldarg_0 ); + ConstructorInfo^ superConstructor = Object::typeid->GetConstructor( gcnew array(0) ); + constructorIL->Emit( OpCodes::Call, superConstructor ); + constructorIL->Emit( OpCodes::Ldarg_0 ); + constructorIL->Emit( OpCodes::Ldarg_1 ); + constructorIL->Emit( OpCodes::Stfld, greetingField ); + constructorIL->Emit( OpCodes::Ret ); + helloWorldClass->CreateType(); + return (helloWorldClass); +} + +int main() +{ + // Create the "HelloWorld" class + TypeBuilder^ helloWorldClass = CreateCallee( Thread::GetDomain() ); + Console::WriteLine( "Full Name : {0}", helloWorldClass->FullName ); + Console::WriteLine( "Constructors :" ); + array^info = helloWorldClass->GetConstructors( static_cast(BindingFlags::Public | BindingFlags::Instance) ); + for ( int index = 0; index < info->Length; index++ ) + Console::WriteLine( info[ index ] ); +} +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp new file mode 100644 index 00000000000..073d9d96852 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeBuilder_Sample_4/CPP/typebuilder_sample_4.cpp @@ -0,0 +1,103 @@ +// System.Reflection.Emit.TypeBuilder.DefineField() +// System.Reflection.Emit.TypeBuilder.DefineConstructor() +// System.Reflection.Emit.TypeBuilder.AddInterfaceImplementation() +// System.Reflection.Emit.TypeBuilder.BaseType + +/* The following program demonstrates the property 'BaseType' and methods + 'DefineField','DefineConstructor','AddInterfaceImplementation' of the + class 'TypeBuilder'. + The program creates a dynamic assembly and a type within it called as + 'HelloWorld' This defines a field and implements an interface. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Threading; + +// Declare the interface. +interface class IHello +{ + void SayHello(); +}; + +// Create the transient dynamic assembly. +Type^ CreateDynamicAssembly( AppDomain^ myAppDomain, AssemblyBuilderAccess myAccess ) +{ + // Create a simple name for assembly. + AssemblyName^ myAssemblyName = gcnew AssemblyName; + myAssemblyName->Name = "EmittedAssembly"; + // Create the dynamic assembly. + AssemblyBuilder^ myAssemblyBuilder = myAppDomain->DefineDynamicAssembly( myAssemblyName, myAccess ); + // Create a dynamic module named 'CalleeModule' in the assembly. + ModuleBuilder^ myModuleBuilder; + myModuleBuilder = myAssemblyBuilder->DefineDynamicModule( "EmittedModule", + "EmittedModule.mod" ); +// +// + // Define a public class named 'myHelloWorld' in the assembly. + TypeBuilder^ helloWorldTypeBuilder = + myModuleBuilder->DefineType( "HelloWorld", TypeAttributes::Public ); + + // Get base type. + Console::WriteLine( "Base Type :{0}", helloWorldTypeBuilder->BaseType->Name ); +// + + // Define 'myGreetingField' field. + FieldBuilder^ myGreetingField = + helloWorldTypeBuilder->DefineField( "myGreeting", String::typeid, + FieldAttributes::Public ); +// + +// + // Define the constructor. + array^ constructorArgs = {String::typeid}; + ConstructorBuilder^ myConstructorBuilder = + helloWorldTypeBuilder->DefineConstructor( MethodAttributes::Public, + CallingConventions::Standard, constructorArgs ); + // Generate IL for the method. The constructor stores its argument in the private field. + ILGenerator^ myConstructorIL = myConstructorBuilder->GetILGenerator(); + myConstructorIL->Emit( OpCodes::Ldarg_0 ); + myConstructorIL->Emit( OpCodes::Ldarg_1 ); + myConstructorIL->Emit( OpCodes::Stfld, myGreetingField ); + myConstructorIL->Emit( OpCodes::Ret ); +// + +// + // Mark the class as implementing 'IHello' interface. + helloWorldTypeBuilder->AddInterfaceImplementation( IHello::typeid ); + MethodBuilder^ myMethodBuilder = + helloWorldTypeBuilder->DefineMethod( "SayHello", + (MethodAttributes)(MethodAttributes::Public | MethodAttributes::Virtual), + nullptr, + nullptr ); + // Generate IL for 'SayHello' method. + ILGenerator^ myMethodIL = myMethodBuilder->GetILGenerator(); + myMethodIL->EmitWriteLine( myGreetingField ); + myMethodIL->Emit( OpCodes::Ret ); + MethodInfo^ sayHelloMethod = IHello::typeid->GetMethod( "SayHello" ); + helloWorldTypeBuilder->DefineMethodOverride( myMethodBuilder, sayHelloMethod ); +// + return (helloWorldTypeBuilder->CreateType()); +} + +int main() +{ + Console::WriteLine( "TypeBuilder Sample" ); + Console::WriteLine( "----------------------" ); + + // Create 'helloWorldType' . + Type^ helloWorldType = CreateDynamicAssembly( Thread::GetDomain(), AssemblyBuilderAccess::RunAndSave ); + + // Create an instance of 'HelloWorld' class. + array^ temp0 = {"Called HelloWorld"}; + Object^ helloWorld = Activator::CreateInstance( helloWorldType, temp0 ); + + // Invoke 'SayHello' method. + helloWorldType->InvokeMember( "SayHello", static_cast(BindingFlags::Default | BindingFlags::InvokeMethod), nullptr, helloWorld, nullptr ); + + // Get defined field in the class. + Console::WriteLine( "Defined Field :{0}", helloWorldType->GetField( "myGreeting" )->Name ); + AssemblyBuilder^ myAssemblyBuilder = dynamic_cast(helloWorldType->Assembly); + myAssemblyBuilder->Save( "EmittedAssembly.dll" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp new file mode 100644 index 00000000000..1da14c506f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeLibVar/CPP/codefile6.cpp @@ -0,0 +1,25 @@ + +// System.Runtime.InteropServices.TypeLibVarAttribute +// System.Runtime.InteropServices.TypeLibVarFlags +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +ref class ClassD +{ +public: + static bool IsHiddenField( FieldInfo^ fi ) + { + array^FieldAttributes = fi->GetCustomAttributes( TypeLibVarAttribute::typeid, true ); + if ( FieldAttributes->Length > 0 ) + { + TypeLibVarAttribute^ tlv = dynamic_cast(FieldAttributes[ 0 ]); + TypeLibVarFlags flags = tlv->Value; + return (flags & TypeLibVarFlags::FHidden) != (TypeLibVarFlags)0; + } + + return false; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp new file mode 100644 index 00000000000..cb8e0c58917 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor2/CPP/typeloadexception_constructor2.cpp @@ -0,0 +1,32 @@ +// +using namespace System; + +class TypeLoadExceptionDemoClass +{ + public: + static bool GenerateException() + { + // Throw a TypeLoadException with a custom message. + throw gcnew TypeLoadException("This is a custom TypeLoadException error message."); + } +}; + +int main() +{ + try { + // Call a method that throws an exception. + TypeLoadExceptionDemoClass::GenerateException(); + } + catch ( TypeLoadException^ e ) { + Console::WriteLine("TypeLoadException:\n {0}", e->Message); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message ); + } + +} +// The example displays the following output: +// TypeLoadException: +// This is a custom TypeLoadException error message. +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp new file mode 100644 index 00000000000..649e2fc5034 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_Constructor3/CPP/typeloadexception_constructor3.cpp @@ -0,0 +1,56 @@ + +// System::TypeLoadException::TypeLoadException +/* This program demonstrates the 'TypeLoadException(String*, Exception)' + constructor of 'TypeLoadException' class. It attempts to call a + non-existent method located in NonExistentDLL.dll, which will + throw an exception. A new exception is thrown with this exception + as an inner exception. +*/ +// +using namespace System; +using namespace System::Runtime::InteropServices; +ref class TypeLoadExceptionDemoClass +{ +public: + + // A call to this method will raise a TypeLoadException. + + [DllImport("NonExistentDLL.DLL",EntryPoint="MethodNotExists")] + static void NonExistentMethod(); + static void GenerateException() + { + try + { + NonExistentMethod(); + } + catch ( TypeLoadException^ e ) + { + + // Rethrow exception with the exception as inner exception + throw gcnew TypeLoadException( "This exception was raised due to a call to an invalid method.",e ); + } + + } + +}; + +int main() +{ + Console::WriteLine( "Calling a method in a non-existent DLL which triggers a TypeLoadException." ); + try + { + TypeLoadExceptionDemoClass::GenerateException(); + } + catch ( TypeLoadException^ e ) + { + Console::WriteLine( "TypeLoadException: \n\tError Message = {0}", e->Message ); + Console::WriteLine( "TypeLoadException: \n\tInnerException Message = {0}", e->InnerException->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: \n\tError Message = {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp new file mode 100644 index 00000000000..6b8fd92068e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_GetObjectData/CPP/typeloadexception_getobjectdata.cpp @@ -0,0 +1,112 @@ + + +// System::TypeLoadException::GetObjectData +// System::TypeLoadException +/* This program demonstrates the 'GetObjectData' method and the + protected constructor TypeLoadException(SerializationInfo, StreamingContext) + of 'TypeLoadException' class. It generates an exception and + serializes the exception data to a file and then reconstitutes the + exception. +*/ +// +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Serialization::Formatters::Soap; +using namespace System::IO; + +// This class overrides the GetObjectData method and initializes +// its data with current time. + +[Serializable] +public ref class MyTypeLoadExceptionChild: public TypeLoadException +{ +public: + System::DateTime ErrorDateTime; + MyTypeLoadExceptionChild() + { + ErrorDateTime = DateTime::Now; + } + + MyTypeLoadExceptionChild( DateTime myDateTime ) + { + ErrorDateTime = myDateTime; + } + + +protected: + MyTypeLoadExceptionChild( SerializationInfo^ sInfo, StreamingContext * sContext ) + { + + // Reconstitute the deserialized information into the instance. + ErrorDateTime = sInfo->GetDateTime( "ErrorDate" ); + } + + +public: + void GetObjectData( SerializationInfo^ sInfo, StreamingContext * sContext ) + { + + // Add a value to the Serialization information. + sInfo->AddValue( "ErrorDate", ErrorDateTime ); + } + +}; + +int main() +{ + + // Load the mscorlib assembly and get a reference to it. + // You must supply the fully qualified assembly name for mscorlib.dll here. + Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); + try + { + Console::WriteLine( "Attempting to load a type not present in the assembly 'mscorlib'" ); + + // This loading of invalid type raises a TypeLoadException + Type^ myType = myAssembly->GetType( "System::NonExistentType", true ); + } + catch ( TypeLoadException^ ) + { + + // Serialize the exception to disk and reconstitute it back again. + try + { + System::DateTime ErrorDatetime = DateTime::Now; + Console::WriteLine( "A TypeLoadException has been raised." ); + + // Create MyTypeLoadException instance with current time. + MyTypeLoadExceptionChild^ myTypeLoadExceptionChild = gcnew MyTypeLoadExceptionChild( ErrorDatetime ); + IFormatter^ myFormatter = gcnew SoapFormatter; + Stream^ myFileStream = gcnew FileStream( "typeload.xml",FileMode::Create,FileAccess::Write,FileShare::None ); + Console::WriteLine( "Serializing the TypeLoadException with DateTime as {0}", ErrorDatetime ); + + // Serialize the MyTypeLoadException instance to a file. + myFormatter->Serialize( myFileStream, myTypeLoadExceptionChild ); + myFileStream->Close(); + Console::WriteLine( "Deserializing the Exception." ); + myFileStream = gcnew FileStream( "typeload.xml",FileMode::Open,FileAccess::Read,FileShare::None ); + + // Deserialize and reconstitute the instance from file. + myTypeLoadExceptionChild = safe_cast(myFormatter->Deserialize( myFileStream )); + myFileStream->Close(); + Console::WriteLine( "Deserialized exception has ErrorDateTime = {0}", myTypeLoadExceptionChild->ErrorDateTime ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp new file mode 100644 index 00000000000..102cf32f110 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/TypeLoadException_TypeName/CPP/typeloadexception_typename.cpp @@ -0,0 +1,39 @@ +// System::TypeLoadException::TypeName;System::TypeLoadException::Message + +/* This program demonstrates the 'TypeName' and 'Message' properties + of the 'TypeLoadException' class. It attempts to load a + non-existent type from the mscorlib assembly which throws an + exception. This exception is caught and the TypeName and Message + values are displayed. +*/ + +using namespace System; +using namespace System::Reflection; + +int main() +{ + // + // + // Load the mscorlib assembly and get a reference to it. + // You must supply the fully qualified assembly name for mscorlib.dll here. + Assembly^ myAssembly = Assembly::Load( "Assembly text name, Version, Culture, PublicKeyToken" ); + try + { + Console::WriteLine( "This program throws an exception upon successful run." ); + + // Attempt to load a non-existent type from an assembly. + Type^ myType = myAssembly->GetType( "System.NonExistentType", true ); + } + catch ( TypeLoadException^ e ) + { + // Display the name of the Type that was not found. + Console::WriteLine( "TypeLoadException: \n\tError loading the type '{0}' from the assembly 'mscorlib'", e->TypeName ); + Console::WriteLine( "\tError Message = {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: Error Message = {0}", e->Message ); + } + // + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp new file mode 100644 index 00000000000..4ae236700c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_Assembly/CPP/type_assembly.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Type^ objType = System::Array::typeid; + + // Print the full assembly name. + Console::WriteLine( "Full assembly name: {0}.", objType->Assembly->FullName ); + + // Print the qualified assembly name. + Console::WriteLine( "Qualified assembly name: {0}.", objType->AssemblyQualifiedName ); +} +// The example displays the following output if run under the .NET Framework 4.5: +// Full assembly name: +// mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. +// Qualified assembly name: +// System.Array, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp b/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp new file mode 100644 index 00000000000..f9301b87911 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_DefaultBinder/CPP/type_defaultbinder.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyClass +{ +public: + void HelloWorld() + { + Console::WriteLine( "Hello World" ); + } + +}; + +int main() +{ + try + { + Binder^ defaultBinder = Type::DefaultBinder; + MyClass^ myClass = gcnew MyClass; + + // Invoke the HelloWorld method of MyClass. + myClass->GetType()->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, defaultBinder, myClass, nullptr ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp new file mode 100644 index 00000000000..bcb5e2a58a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_FilterAttribute/CPP/type_filterattribute.cpp @@ -0,0 +1,36 @@ + +// +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; +using namespace System::Security; +int main() +{ + try + { + MemberFilter^ myFilter = Type::FilterAttribute; + Type^ myType = System::String::typeid; + array^myMemberInfoArray = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, MethodAttributes::SpecialName ); + IEnumerator^ myEnum = myMemberInfoArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MemberInfo^ myMemberinfo = safe_cast(myEnum->Current); + Console::Write( "\n {0}", myMemberinfo->Name ); + Console::Write( " is a {0}", myMemberinfo->MemberType ); + } + } + catch ( ArgumentNullException^ e ) + { + Console::Write( "ArgumentNullException : {0}", e->Message ); + } + catch ( SecurityException^ e ) + { + Console::Write( "SecurityException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::Write( "Exception : {0}", e->Message ); + } + +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp new file mode 100644 index 00000000000..38bf38a1528 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_FilterNameIgnoreCase/CPP/type_filternameignorecase.cpp @@ -0,0 +1,36 @@ + +// +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; +using namespace System::Security; +int main() +{ + try + { + MemberFilter^ myFilter = Type::FilterNameIgnoreCase; + Type^ myType = System::String::typeid; + array^myMemberinfo1 = myType->FindMembers( static_cast(MemberTypes::Constructor | MemberTypes::Method), static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), myFilter, "C*" ); + IEnumerator^ myEnum = myMemberinfo1->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MemberInfo^ myMemberinfo2 = safe_cast(myEnum->Current); + Console::Write( "\n {0}", myMemberinfo2->Name ); + MemberTypes Mymembertypes = myMemberinfo2->MemberType; + Console::WriteLine( " is a {0}", Mymembertypes ); + } + } + catch ( ArgumentNullException^ e ) + { + Console::Write( "ArgumentNullException : {0}", e->Message ); + } + catch ( SecurityException^ e ) + { + Console::Write( "SecurityException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::Write( "Exception : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp new file mode 100644 index 00000000000..12d2c367f57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_FindInterfaces/CPP/type_findinterfaces.cpp @@ -0,0 +1,69 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Reflection; +public ref class MyFindInterfacesSample +{ +public: + static bool MyInterfaceFilter(Type^ typeObj, Object^ criteriaObj) + { + if(typeObj->ToString()->Equals(criteriaObj->ToString())) + return true; + else + return false; + } +}; + +int main() +{ + try + { + XmlDocument^ myXMLDoc = gcnew XmlDocument; + myXMLDoc->LoadXml("" + + "Pride And Prejudice "); + Type^ myType = myXMLDoc->GetType(); + + // Specify the TypeFilter delegate that compares the interfaces + // against filter criteria. + TypeFilter^ myFilter = gcnew TypeFilter( + MyFindInterfacesSample::MyInterfaceFilter); + array^myInterfaceList = {"System.Collections.IEnumerable", + "System.Collections.ICollection"}; + for(int index = 0; index < myInterfaceList->Length; index++) + { + array^myInterfaces = myType->FindInterfaces( + myFilter, myInterfaceList[index]); + if(myInterfaces->Length > 0) + { + Console::WriteLine("\n{0} implements the interface {1}.", + myType, myInterfaceList[index]); + for(int j = 0; j < myInterfaces->Length; j++) + Console::WriteLine("Interfaces supported: {0}.", + myInterfaces[j]); + } + else + Console::WriteLine( + "\n{0} does not implement the interface {1}.", + myType, myInterfaceList[index]); + + } + } + catch(ArgumentNullException^ e) + { + Console::WriteLine("ArgumentNullException: {0}", e->Message); + } + catch(TargetInvocationException^ e) + { + Console::WriteLine("TargetInvocationException: {0}", e->Message); + } + catch(Exception^ e) + { + Console::WriteLine("Exception: {0}", e->Message); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp new file mode 100644 index 00000000000..759df40e831 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_FindMembers/CPP/type_findmembers.cpp @@ -0,0 +1,48 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyFindMembersClass +{ +public: + static void Test() + { + Object^ objTest = gcnew Object; + Type^ objType = objTest->GetType(); + array^arrayMemberInfo; + try + { + + //Find all static or public methods in the Object class that match the specified name. + arrayMemberInfo = objType->FindMembers( MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::Instance), gcnew MemberFilter( DelegateToSearchCriteria ), "ReferenceEquals" ); + for ( int index = 0; index < arrayMemberInfo->Length; index++ ) + Console::WriteLine( "Result of FindMembers -\t {0}", String::Concat( arrayMemberInfo[ index ], "\n" ) ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e ); + } + + } + + static bool DelegateToSearchCriteria( MemberInfo^ objMemberInfo, Object^ objSearch ) + { + + // Compare the name of the member function with the filter criteria. + if ( objMemberInfo->Name->Equals( objSearch->ToString() ) ) + return true; + else + return false; + } + +}; + +int main() +{ + MyFindMembersClass::Test(); +} +/* The example produces the following output: + +Result of FindMembers - Boolean ReferenceEquals(System.Object, System.Object) +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp new file mode 100644 index 00000000000..0917b237224 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetArrayRank/CPP/type_getarrayrank.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +int main() +{ + try + { + array^myArray = gcnew array(3,4,5); + Type^ myType = myArray->GetType(); + Console::WriteLine( "myArray has {0} dimensions.", myType->GetArrayRank() ); + } + catch ( NotSupportedException^ e ) + { + Console::WriteLine( "NotSupportedException raised." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp new file mode 100644 index 00000000000..b0cdfecb09c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor/CPP/type_getconstructor.cpp @@ -0,0 +1,42 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security; +public ref class MyClass1 +{ +public: + MyClass1(){} + + MyClass1( int i ){} + +}; + +int main() +{ + try + { + Type^ myType = MyClass1::typeid; + array^types = gcnew array(1); + types[ 0 ] = int::typeid; + + // Get the constructor that takes an integer as a parameter. + ConstructorInfo^ constructorInfoObj = myType->GetConstructor( types ); + if ( constructorInfoObj != nullptr ) + { + Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is: " ); + Console::WriteLine( constructorInfoObj ); + } + else + { + Console::WriteLine( "The constructor of MyClass1 that takes an integer as a parameter is not available." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp new file mode 100644 index 00000000000..66f4064a45d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor2/CPP/type_getconstructor2.cpp @@ -0,0 +1,50 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security; +public ref class MyClass1 +{ +public: + MyClass1( int i ){} + +}; + +int main() +{ + try + { + Type^ myType = MyClass1::typeid; + array^types = gcnew array(1); + types[ 0 ] = int::typeid; + + // Get the constructor that is public and takes an integer parameter. + ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, types, nullptr ); + if ( constructorInfoObj != nullptr ) + { + Console::WriteLine( "The constructor of MyClass1 that is public and takes an integer as a parameter is:" ); + Console::WriteLine( constructorInfoObj ); + } + else + { + Console::WriteLine( "The constructor of the MyClass1 that is public and takes an integer as a parameter is not available." ); + } + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException: {0}", e->Message ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( "ArgumentException: {0}", e->Message ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp new file mode 100644 index 00000000000..6d911a7f1cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetConstructor3/CPP/type_getconstructor3.cpp @@ -0,0 +1,50 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security; +public ref class MyClass1 +{ +public: + MyClass1( int i ){} + +}; + +int main() +{ + try + { + Type^ myType = MyClass1::typeid; + array^types = gcnew array(1); + types[ 0 ] = int::typeid; + + // Get the public instance constructor that takes an integer parameter. + ConstructorInfo^ constructorInfoObj = myType->GetConstructor( static_cast(BindingFlags::Instance | BindingFlags::Public), nullptr, CallingConventions::HasThis, types, nullptr ); + if ( constructorInfoObj != nullptr ) + { + Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is: " ); + Console::WriteLine( constructorInfoObj ); + } + else + { + Console::WriteLine( "The constructor of MyClass1 that is a public instance method and takes an integer as a parameter is not available." ); + } + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException: {0}", e->Message ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( "ArgumentException: {0}", e->Message ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp new file mode 100644 index 00000000000..b924dff4307 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetDefaultMembers/CPP/type_getdefaultmembers.cpp @@ -0,0 +1,58 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::IO; + +[DefaultMemberAttribute("Age")] +public ref class MyClass +{ +public: + void Name( String^ s ){} + + + property int Age + { + int get() + { + return 20; + } + + } + +}; + +int main() +{ + try + { + Type^ myType = MyClass::typeid; + array^memberInfoArray = myType->GetDefaultMembers(); + if ( memberInfoArray->Length > 0 ) + { + System::Collections::IEnumerator^ myEnum = memberInfoArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MemberInfo^ memberInfoObj = safe_cast(myEnum->Current); + Console::WriteLine( "The default member name is: {0}", memberInfoObj ); + } + } + else + { + Console::WriteLine( "No default members are available." ); + } + } + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( "InvalidOperationException: {0}", e->Message ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "IOException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp new file mode 100644 index 00000000000..f6faf3d5c38 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetEvent/CPP/type_getevent.cpp @@ -0,0 +1,41 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Security; + +int main() +{ + try + { + Type^ myType = System::Windows::Forms::Button::typeid; + EventInfo^ myEvent = myType->GetEvent( "Click" ); + if ( myEvent != nullptr ) + { + Console::WriteLine( "Looking for the Click event in the Button class." ); + Console::WriteLine( myEvent ); + } + else + Console::WriteLine( "The Click event is not available in the Button class." ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp new file mode 100644 index 00000000000..1921939e115 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetField/CPP/type_getfield.cpp @@ -0,0 +1,97 @@ + +// +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security; +public ref class MyFieldClassA +{ +public: + String^ field; + MyFieldClassA() + { + field = "A Field"; + } + + + property String^ Field + { + String^ get() + { + return field; + } + + void set( String^ value ) + { + if ( field != value ) + { + field = value; + } + } + + } + +}; + +public ref class MyFieldClassB +{ +public: + String^ field; + MyFieldClassB() + { + field = "B Field"; + } + + + property String^ Field + { + String^ get() + { + return field; + } + + void set( String^ value ) + { + if ( field != value ) + { + field = value; + } + } + + } + +}; + +int main() +{ + try + { + MyFieldClassB^ myFieldObjectB = gcnew MyFieldClassB; + MyFieldClassA^ myFieldObjectA = gcnew MyFieldClassA; + Type^ myTypeA = Type::GetType( "MyFieldClassA" ); + FieldInfo^ myFieldInfo = myTypeA->GetField( "field" ); + Type^ myTypeB = Type::GetType( "MyFieldClassB" ); + FieldInfo^ myFieldInfo1 = myTypeB->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) ); + Console::WriteLine( "The value of the field is : {0} ", myFieldInfo->GetValue( myFieldObjectA ) ); + Console::WriteLine( "The value of the field is : {0} ", myFieldInfo1->GetValue( myFieldObjectB ) ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Exception Raised!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "Exception Raised!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Raised!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp new file mode 100644 index 00000000000..38a4f53dbdb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetHashCode_GetFields/CPP/type_gethashcode_getfields.cpp @@ -0,0 +1,49 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Security; +using namespace System::Reflection; + +int main() +{ + Type^ myType = System::Net::IPAddress::typeid; + array^myFields = myType->GetFields( static_cast(BindingFlags::Static | BindingFlags::NonPublic) ); + Console::WriteLine( "\nThe IPAddress class has the following nonpublic fields: " ); + System::Collections::IEnumerator^ myEnum = myFields->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FieldInfo^ myField = safe_cast(myEnum->Current); + Console::WriteLine( myField ); + } + + Type^ myType1 = System::Net::IPAddress::typeid; + array^myFields1 = myType1->GetFields(); + Console::WriteLine( "\nThe IPAddress class has the following public fields: " ); + System::Collections::IEnumerator^ myEnum2 = myFields1->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + FieldInfo^ myField = safe_cast(myEnum2->Current); + Console::WriteLine( myField ); + } + + try + { + Console::WriteLine( "The HashCode of the System::Windows::Forms::Button type is: {0}", System::Windows::Forms::Button::typeid->GetHashCode() ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Message: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Message: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp new file mode 100644 index 00000000000..6bd012509e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetInterface/CPP/type_getinterface.cpp @@ -0,0 +1,52 @@ + +/* +System::Type::GetInterface(String) +System::Type::GetInterface(String, bool) +System::Type::GetInterfaceMap + +The following program get the type of Hashtable class and searches for the interface +with the specified name. Then prints the method name of that interface. +*/ +using namespace System; +using namespace System::Reflection; +using namespace System::Collections; + +// +// +// +int main() +{ + Hashtable^ hashtableObj = gcnew Hashtable; + Type^ objType = hashtableObj->GetType(); + array^arrayMemberInfo; + array^arrayMethodInfo; + try + { + // Get the methods implemented in 'IDeserializationCallback' interface. + arrayMethodInfo = objType->GetInterface( "IDeserializationCallback" )->GetMethods(); + Console::WriteLine( "\nMethods of 'IDeserializationCallback' Interface :" ); + for ( int index = 0; index < arrayMethodInfo->Length; index++ ) + Console::WriteLine( arrayMethodInfo[ index ] ); + + // Get FullName for interface by using Ignore case search. + Console::WriteLine( "\nMethods of 'IEnumerable' Interface" ); + arrayMethodInfo = objType->GetInterface( "ienumerable", true )->GetMethods(); + for ( int index = 0; index < arrayMethodInfo->Length; index++ ) + Console::WriteLine( arrayMethodInfo[ index ] ); + + //Get the Interface methods for 'IDictionary*' interface + InterfaceMapping interfaceMappingObj; + interfaceMappingObj = objType->GetInterfaceMap( IDictionary::typeid ); + arrayMemberInfo = interfaceMappingObj.InterfaceMethods; + Console::WriteLine( "\nHashtable class Implements the following IDictionary Interface methods :" ); + for ( int index = 0; index < arrayMemberInfo->Length; index++ ) + Console::WriteLine( arrayMemberInfo[ index ] ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e ); + } +} +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp new file mode 100644 index 00000000000..d6ba8989b72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetInterfaces1/CPP/type_getinterfaces1.cpp @@ -0,0 +1,30 @@ +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + Console::WriteLine("\r\nInterfaces implemented by Dictionary:\r\n"); + + for each (Type^ tinterface in Dictionary::typeid->GetInterfaces()) + { + Console::WriteLine(tinterface->ToString()); + } + + //Console::ReadLine() // Uncomment this line for Visual Studio. +} + +/* This example produces output similar to the following: + +Interfaces implemented by Dictionary: + +System.Collections.Generic.IDictionary`2[System.Int32,System.String] +System.Collections.Generic.ICollection`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]] +System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.String]] +System.Collection.IEnumerable +System.Collection.IDictionary +System.Collection.ICollection +System.Runtime.Serialization.ISerializable +System.Runtime.Serialization.IDeserializationCallback + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp new file mode 100644 index 00000000000..509f20ff956 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMember/CPP/type_getmember.cpp @@ -0,0 +1,100 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Reflection; + +// forward declarations: +void GetMemberInfo(); +void GetPublicStaticMemberInfo(); +void GetPublicInstanceMethodMemberInfo(); +int main() +{ + try + { + GetMemberInfo(); + GetPublicStaticMemberInfo(); + GetPublicInstanceMethodMemberInfo(); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException occurred." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + catch ( NotSupportedException^ e ) + { + Console::WriteLine( "NotSupportedException occurred." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException occurred." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception occurred." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + +} + +void GetMemberInfo() +{ + String^ myString = "GetMember_String"; + Type^ myType = myString->GetType(); + + // Get the members for myString starting with the letter C. + array^myMembers = myType->GetMember( "C*" ); + if ( myMembers->Length > 0 ) + { + Console::WriteLine( "\nThe member(s) starting with the letter C for type {0}:", myType ); + for ( int index = 0; index < myMembers->Length; index++ ) + Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); + } + else + Console::WriteLine( "No members match the search criteria." ); +} +// + +// +void GetPublicStaticMemberInfo() +{ + String^ myString = "GetMember_String_BindingFlag"; + Type^ myType = myString->GetType(); + + // Get the public static members for the class myString starting with the letter C + array^myMembers = myType->GetMember( "C*", static_cast(BindingFlags::Public | BindingFlags::Static) ); + if ( myMembers->Length > 0 ) + { + Console::WriteLine( "\nThe public static member(s) starting with the letter C for type {0}:", myType ); + for ( int index = 0; index < myMembers->Length; index++ ) + Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); + } + else + Console::WriteLine( "No members match the search criteria." ); +} +// + +// +void GetPublicInstanceMethodMemberInfo() +{ + String^ myString = "GetMember_String_MemberType_BindingFlag"; + Type^ myType = myString->GetType(); + + // Get the public instance methods for myString starting with the letter C. + array^myMembers = myType->GetMember( "C*", MemberTypes::Method, static_cast(BindingFlags::Public | BindingFlags::Instance) ); + if ( myMembers->Length > 0 ) + { + Console::WriteLine( "\nThe public instance method(s) starting with the letter C for type {0}:", myType ); + for ( int index = 0; index < myMembers->Length; index++ ) + Console::WriteLine( "Member {0}: {1}", index + 1, myMembers[ index ] ); + } + else + Console::WriteLine( "No members match the search criteria." ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp new file mode 100644 index 00000000000..f80aa9bb4c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers1/CPP/type_getmembers1.cpp @@ -0,0 +1,52 @@ + +// System::Type::GetMembers() +/* +This program demonstrates GetMembers() method of System::Type Class. +Get the members (properties, methods, fields, events, and so on) +of the class 'MyClass' and displays the same to the console. +*/ +using namespace System; +using namespace System::Reflection; +using namespace System::Security; + +// +ref class MyClass +{ +public: + int myInt; + String^ myString; + MyClass(){} + + void Myfunction(){} + +}; + +int main() +{ + try + { + MyClass^ myObject = gcnew MyClass; + array^myMemberInfo; + + // Get the type of 'MyClass'. + Type^ myType = myObject->GetType(); + + // Get the information related to all public members of 'MyClass'. + myMemberInfo = myType->GetMembers(); + Console::WriteLine( "\nThe members of class '{0}' are :\n", myType ); + for ( int i = 0; i < myMemberInfo->Length; i++ ) + { + + // Display name and type of the concerned member. + Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType ); + + } + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp new file mode 100644 index 00000000000..41bb6aea10f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMembers2/CPP/type_getmembers2.cpp @@ -0,0 +1,66 @@ + +// System::Type::GetMembers(BindingFlags) +/* +This program demonstrates 'GetMembers(BindingFlags)' method of +System::Type Class. This will get all the public instance members +declared or inherited by this type and displays the members to +the console. +*/ +using namespace System; +using namespace System::Reflection; +using namespace System::Security; + +// +ref class MyClass +{ +public: + int * myInt; + String^ myString; + MyClass(){} + + void Myfunction(){} + +}; + +int main() +{ + try + { + MyClass^ MyObject = gcnew MyClass; + array^myMemberInfo; + + // Get the type of the class 'MyClass'. + Type^ myType = MyObject->GetType(); + + // Get the public instance members of the class 'MyClass'. + myMemberInfo = myType->GetMembers( static_cast(BindingFlags::Public | BindingFlags::Instance) ); + Console::WriteLine( "\nThe public instance members of class '{0}' are : \n", myType ); + for ( int i = 0; i < myMemberInfo->Length; i++ ) + { + + // Display name and type of the member of 'MyClass'. + Console::WriteLine( "'{0}' is a {1}", myMemberInfo[ i ]->Name, myMemberInfo[ i ]->MemberType ); + + } + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException : {0}", e->Message ); + } + + + //Output: + //The public instance members of class 'MyClass' are : + + //'Myfunction' is a Method + //'ToString' is a Method + //'Equals' is a Method + //'GetHashCode' is a Method + //'GetType' is a Method + //'.ctor' is a Constructor + //'myInt' is a Field + //'myString' is a Field + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp new file mode 100644 index 00000000000..baf1615c7c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod1/CPP/type_getmethod1.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class Program +{ + + public: + + // Method to get: + void MethodA() { } + + }; + + int main() + { + + // Get MethodA() + MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA"); + Console::WriteLine("Found method: {0}", mInfo ); + + } +// + diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp new file mode 100644 index 00000000000..b4f0669dc23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod2/CPP/type_getmethod2.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class Program +{ + + public: + + // Method to get: + void MethodA() { } + + }; + + int main() + { + + // Get MethodA() + MethodInfo^ mInfo = Program::typeid->GetMethod("MethodA", + static_cast(BindingFlags::Public | BindingFlags::Instance)); + Console::WriteLine("Found method: {0}", mInfo ); + + } +// + diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp new file mode 100644 index 00000000000..635d6dcd96c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod3/CPP/type_getmethod3.cpp @@ -0,0 +1,64 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Program +{ + +public: + // Methods to get: + + void MethodA(int i, int j) { } + + void MethodA(array^ iarry) { } + + void MethodA(double *ip) { } + + // Method that takes a managed reference paramter. + void MethodA(int% r) {} +}; + +int main() +{ + MethodInfo^ mInfo; + + + // Get MethodA(int i, int j) + mInfo = Program::typeid->GetMethod("MethodA", + BindingFlags::Public | BindingFlags::Instance, + nullptr, + CallingConventions::Any, + gcnew array {int::typeid, int::typeid}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(array^ iarry) + mInfo = Program::typeid->GetMethod("MethodA", + BindingFlags::Public | BindingFlags::Instance, + nullptr, + CallingConventions::Any, + gcnew array {int::typeid->MakeArrayType()}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(double *ip) + mInfo = Program::typeid->GetMethod("MethodA", + BindingFlags::Public | BindingFlags::Instance, + nullptr, + CallingConventions::Any, + gcnew array {double::typeid->MakePointerType()}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(int% r) + mInfo = Program::typeid->GetMethod("MethodA", + BindingFlags::Public | BindingFlags::Instance, + nullptr, + CallingConventions::Any, + gcnew array {int::typeid->MakeByRefType()}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp new file mode 100644 index 00000000000..5e67e5d4695 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod4/CPP/type_getmethod4.cpp @@ -0,0 +1,47 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class Program +{ + +public: + // Methods to get: + + void MethodA(int i, int j) { } + + void MethodA(array^ iarry) { } + + void MethodA(double *ip) { } + + // Method that takes a managed reference parameter. + void MethodA(int% r) {} +}; + +int main() +{ + MethodInfo^ mInfo; + + + // Get MethodA(int i, int j) + mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid,int::typeid}); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(array^ iarry) + mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeArrayType()}); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(double *ip) + mInfo = Program::typeid->GetMethod("MethodA", gcnew array {double::typeid->MakePointerType()}); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(int% r) + mInfo = Program::typeid->GetMethod("MethodA", gcnew array {int::typeid->MakeByRefType()}); + // Display the method information. + Console::WriteLine("Found method: {0}", mInfo ); + +} +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp new file mode 100644 index 00000000000..8fb1d143de6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMethod5/CPP/type_getmethod5.cpp @@ -0,0 +1,59 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Program +{ + +public: + // Methods to get: + + void MethodA(int i, int j) { } + + void MethodA(array^ iarry) { } + + void MethodA(double *ip) { } + + // Method that takes a managed reference parameter. + void MethodA(int% r) {} +}; + +int main() +{ + MethodInfo^ mInfo; + + + // Get MethodA(int i, int j) + mInfo = Program::typeid->GetMethod("MethodA", + static_cast(BindingFlags::Public | BindingFlags::Instance), + nullptr, + gcnew array {int::typeid, int::typeid}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(array^ iarry) + mInfo = Program::typeid->GetMethod("MethodA", + static_cast(BindingFlags::Public | BindingFlags::Instance), + nullptr, + gcnew array {int::typeid->MakeArrayType()}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(double *ip) + mInfo = Program::typeid->GetMethod("MethodA", + static_cast(BindingFlags::Public | BindingFlags::Instance), + nullptr, + gcnew array {double::typeid->MakePointerType()}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); + + // Get MethodA(int% r) + mInfo = Program::typeid->GetMethod("MethodA", + static_cast(BindingFlags::Public | BindingFlags::Instance), + nullptr, + gcnew array {int::typeid->MakeByRefType()}, + nullptr); + Console::WriteLine("Found method: {0}", mInfo ); +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp new file mode 100644 index 00000000000..c249289de27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetMethods2/CPP/type_getmethods2.cpp @@ -0,0 +1,54 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// Create a class having two public methods and one protected method. +public ref class MyTypeClass +{ +public: + void MyMethods(){} + + int MyMethods1() + { + return 3; + } + + +protected: + String^ MyMethods2() + { + return "hello"; + } +}; + +void DisplayMethodInfo( array^myArrayMethodInfo ) +{ + // Display information for all methods. + for ( int i = 0; i < myArrayMethodInfo->Length; i++ ) + { + MethodInfo^ myMethodInfo = dynamic_cast(myArrayMethodInfo[ i ]); + Console::WriteLine( "\nThe name of the method is {0}.", myMethodInfo->Name ); + } +} + +int main() +{ + Type^ myType = MyTypeClass::typeid; + + // Get the public methods. + array^myArrayMethodInfo = myType->GetMethods( static_cast(BindingFlags::Public | BindingFlags::Instance | BindingFlags::DeclaredOnly) ); + Console::WriteLine( "\nThe number of public methods is {0}->", myArrayMethodInfo->Length ); + + // Display all the methods. + DisplayMethodInfo( myArrayMethodInfo ); + + // Get the nonpublic methods. + array^myArrayMethodInfo1 = myType->GetMethods( static_cast(BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly) ); + Console::WriteLine( "\nThe number of protected methods is {0}->", myArrayMethodInfo1->Length ); + + // Display information for all methods. + DisplayMethodInfo( myArrayMethodInfo1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp new file mode 100644 index 00000000000..8c37fe7a44c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedClassesAbs/CPP/type_getnestedclassesabs.cpp @@ -0,0 +1,56 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Create a class with two nested public classes and two nested protected classes. +public ref class MyTypeClass +{ + public: + ref class Myclass1{}; + + public: + ref class Myclass2{}; + + protected: + ref class MyClass3{}; + + protected: + ref class MyClass4{}; +}; + +void DisplayTypeInfo(array^ myArrayType) +{ + // Display the information for all the nested classes. + for each (Type^ t in myArrayType) + Console::WriteLine( "The name of the nested class is {0}.", t->FullName); +} + +int main() +{ + Type^ myType = MyTypeClass::typeid; + + // Get the public nested classes. + array^myTypeArray = myType->GetNestedTypes( static_cast(BindingFlags::Public)); + Console::WriteLine( "The number of nested public classes is {0}.", myTypeArray->Length ); + + // Display all the public nested classes. + DisplayTypeInfo( myTypeArray ); + Console::WriteLine(); + + // Get the nonpublic nested classes. + array^myTypeArray1 = myType->GetNestedTypes( static_cast(BindingFlags::NonPublic)); + Console::WriteLine( "The number of nested protected classes is {0}.", myTypeArray1->Length ); + + // Display all the nonpublic nested classes. + DisplayTypeInfo( myTypeArray1 ); +} +// The example displays the following output: +// The number of public nested classes is 2. +// The name of the nested class is MyTypeClass+Myclass1. +// The name of the nested class is MyTypeClass+Myclass2. +// +// The number of protected nested classes is 2. +// The name of the nested class is MyTypeClass+MyClass3. +// The name of the nested class is MyTypeClass+MyClass4. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp new file mode 100644 index 00000000000..53d43153bd8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetNestedTypes/CPP/type_getnestedtypes.cpp @@ -0,0 +1,43 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyClass +{ +public: + ref class NestClass + { + public: + static int myPublicInt = 0; + }; + + ref struct NestStruct + { + public: + static int myPublicInt = 0; + }; +}; + +int main() +{ + try + { + // Get the Type object corresponding to MyClass. + Type^ myType = MyClass::typeid; + + // Get an array of nested type objects in MyClass. + array^nestType = myType->GetNestedTypes(); + Console::WriteLine( "The number of nested types is {0}.", nestType->Length ); + System::Collections::IEnumerator^ myEnum = nestType->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ t = safe_cast(myEnum->Current); + Console::WriteLine( "Nested type is {0}.", t ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp new file mode 100644 index 00000000000..9be794b12cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperties2/CPP/type_getproperties2.cpp @@ -0,0 +1,153 @@ +// +using namespace System; +using namespace System::Reflection; + +// Create a class having three properties. +public ref class PropertyClass +{ + +public: + property String^ Property1 + { + String^ get() + { + return "hello"; + } + } + + property String^ Property2 + { + String^ get() + { + return "hello"; + } + } + +protected: + property String^ Property3 + { + String^ get() + { + return "hello"; + } + } + +private: + property int Property4 + { + int get() + { + return 32; + } + } + +internal: + property String^ Property5 + { + String^ get() + { + return "value"; + } + } + +public protected: + property String^ Property6 + { + String^ get() + { + return "value"; + } + } +}; + +String^ GetVisibility(MethodInfo^ accessor) +{ + if (accessor->IsPublic) + return "Public"; + else if (accessor->IsPrivate) + return "Private"; + else if (accessor->IsFamily) + return "Protected"; + else if (accessor->IsAssembly) + return "Internal/Friend"; + else + return "Protected Internal/Friend"; +} + +void DisplayPropertyInfo(array^ propInfos ) +{ + // Display information for all properties. + for each(PropertyInfo^ propInfo in propInfos) { + bool readable = propInfo->CanRead; + bool writable = propInfo->CanWrite; + + Console::WriteLine(" Property name: {0}", propInfo->Name); + Console::WriteLine(" Property type: {0}", propInfo->PropertyType); + Console::WriteLine(" Read-Write: {0}", readable && writable); + if (readable) { + MethodInfo^ getAccessor = propInfo->GetMethod; + Console::WriteLine(" Visibility: {0}", + GetVisibility(getAccessor)); + } + if (writable) { + MethodInfo^ setAccessor = propInfo->SetMethod; + Console::WriteLine(" Visibility: {0}", + GetVisibility(setAccessor)); + } + Console::WriteLine(); + } +} + +void main() +{ + Type^ myType = PropertyClass::typeid; + + // Get the public properties. + array^propInfos = myType->GetProperties( static_cast(BindingFlags::Public | BindingFlags::Instance) ); + Console::WriteLine("The number of public properties: {0}.\n", + propInfos->Length); + // Display the public properties. + DisplayPropertyInfo( propInfos ); + + // Get the non-public properties. + array^propInfos1 = myType->GetProperties( static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + Console::WriteLine("The number of non-public properties: {0}.\n", + propInfos1->Length); + // Display all the non-public properties. + DisplayPropertyInfo(propInfos1); +} +// The example displays the following output: +// The number of public properties: 2. +// +// Property name: Property2 +// Property type: System.String +// Read-Write: False +// Visibility: Public +// +// Property name: Property1 +// Property type: System.String +// Read-Write: False +// Visibility: Public +// +// The number of non-public properties: 4. +// +// Property name: Property6 +// Property type: System.String +// Read-Write: False +// Visibility: Protected Internal/Friend +// +// Property name: Property5 +// Property type: System.String +// Read-Write: False +// Visibility: Internal/Friend +// +// Property name: Property4 +// Property type: System.Int32 +// Read-Write: False +// Visibility: Private +// +// Property name: Property3 +// Property type: System.String +// Read-Write: False +// Visibility: Protected +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp new file mode 100644 index 00000000000..8ae8ea145d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty1/CPP/type_getproperty1.cpp @@ -0,0 +1,45 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyClass +{ +private: + int myProperty; + +public: + + property int MyProperty + { + // Declare MyProperty. + int get() + { + return myProperty; + } + + void set( int value ) + { + myProperty = value; + } + } +}; + +int main() +{ + try + { + // Get the Type object corresponding to MyClass. + Type^ myType = MyClass::typeid; + + // Get the PropertyInfo object by passing the property name. + PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty" ); + + // Display the property name. + Console::WriteLine( "The {0} property exists in MyClass.", myPropInfo->Name ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "The property does not exist in MyClass. {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp new file mode 100644 index 00000000000..9301970d3b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty2/CPP/type_getproperty2.cpp @@ -0,0 +1,45 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyClass +{ +private: + int myProperty; + +public: + + property int MyProperty + { + // Declare MyProperty. + int get() + { + return myProperty; + } + + void set( int value ) + { + myProperty = value; + } + } +}; + +int main() +{ + try + { + // Get Type object of MyClass. + Type^ myType = MyClass::typeid; + + // Get the PropertyInfo by passing the property name and specifying the BindingFlags. + PropertyInfo^ myPropInfo = myType->GetProperty( "MyProperty", static_cast(BindingFlags::Public | BindingFlags::Instance) ); + + // Display Name property to console. + Console::WriteLine( "{0} is a property of MyClass.", myPropInfo->Name ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "MyProperty does not exist in MyClass. {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp new file mode 100644 index 00000000000..8b7ac89dba4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty3/CPP/type_getproperty3.cpp @@ -0,0 +1,58 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyClass1 +{ +private: + array^myArray; + +public: + + property int Item [int, int] + { + + // Declare an indexer. + int get( int i, int j ) + { + return myArray[ i,j ]; + } + + void set( int i, int j, int value ) + { + myArray[ i,j ] = value; + } + + } + +}; + +int main() +{ + try + { + + // Get the Type object. + Type^ myType = MyClass1::typeid; + array^myTypeArr = gcnew array(2); + + // Create an instance of a Type array. + myTypeArr->SetValue( int::typeid, 0 ); + myTypeArr->SetValue( int::typeid, 1 ); + + // Get the PropertyInfo object for the indexed property Item, which has two integer parameters. + PropertyInfo^ myPropInfo = myType->GetProperty( "Item", myTypeArr ); + + // Display the property. + Console::WriteLine( "The {0} property exists in MyClass1.", myPropInfo ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp new file mode 100644 index 00000000000..905e696e9f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty5/CPP/type_getproperty2.cpp @@ -0,0 +1,53 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyPropertyClass +{ +private: + array^ myPropertyArray; + +public: + + property int Item [int, int] + { + // Declare an indexer. + int get( int i, int j ) + { + return myPropertyArray[ i,j ]; + } + + void set( int i, int j, int value ) + { + myPropertyArray[ i,j ] = value; + } + + } + +}; + +int main() +{ + try + { + Type^ myType = MyPropertyClass::typeid; + array^myTypeArray = gcnew array(2); + + // Create an instance of the Type array representing the number, order + // and type of the parameters for the property. + myTypeArray->SetValue( int::typeid, 0 ); + myTypeArray->SetValue( int::typeid, 1 ); + + // Search for the indexed property whose parameters match the + // specified argument types and modifiers. + PropertyInfo^ myPropertyInfo = myType->GetProperty( "Item", int::typeid, myTypeArray, nullptr ); + Console::WriteLine( "{0}.{1} has a property type of {2}", myType->FullName, myPropertyInfo->Name, myPropertyInfo->PropertyType ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "An exception occurred {0}", ex->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp new file mode 100644 index 00000000000..406346579d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetProperty_Types/CPP/type_getproperty_types.cpp @@ -0,0 +1,55 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyClass1 +{ +private: + String^ myMessage; + +public: + + property String^ MyProperty1 + { + String^ get() + { + return myMessage; + } + + void set( String^ value ) + { + myMessage = value; + } + } +}; + +int main() +{ + try + { + Type^ myType = MyClass1::typeid; + + // Get the PropertyInfo Object* representing MyProperty1. + PropertyInfo^ myStringProperties1 = myType->GetProperty( "MyProperty1", String::typeid ); + Console::WriteLine( "The name of the first property of MyClass1 is {0}.", myStringProperties1->Name ); + Console::WriteLine( "The type of the first property of MyClass1 is {0}.", myStringProperties1->PropertyType ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException : {0}", e->Message ); + } + catch ( AmbiguousMatchException^ e ) + { + Console::WriteLine( "AmbiguousMatchException : {0}", e->Message ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + //Output: + //The name of the first property of MyClass1 is MyProperty1. + //The type of the first property of MyClass1 is System.String. + +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp new file mode 100644 index 00000000000..eb10775df99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetType/CPP/type_gettype.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; + +int main() +{ + try { + // Get the type of a specified class. + Type^ myType1 = Type::GetType( "System.Int32" ); + Console::WriteLine( "The full name is {0}.\n", myType1->FullName ); + } + catch ( TypeLoadException^ e ) { + Console::WriteLine("{0}: Unable to load type System.Int32", + e->GetType()->Name); + } + + try { + // Since NoneSuch does not exist in this assembly, GetType throws a TypeLoadException. + Type^ myType2 = Type::GetType( "NoneSuch", true ); + Console::WriteLine( "The full name is {0}.", myType2->FullName ); + } + catch ( TypeLoadException^ e ) { + Console::WriteLine("{0}: Unable to load type NoneSuch", + e->GetType()->Name); + } + +} +// The example displays the following output: +// The full name is System.Int32. +// +// TypeLoadException: Unable to load type NoneSuch +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp new file mode 100644 index 00000000000..4eedf13f6b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeCode/CPP/type_gettypecode.cpp @@ -0,0 +1,72 @@ + +// System::Type::GetTypeCode() +// System::Type::GetProperties() +// System::Type::GetTypeArray() +// System::Type::GetType(String, Boolean, Boolean) +/* The following example demonstrates the 'GetTypeCode()', 'GetProperties()', 'GetTypeArray()', +'GetType(String, Boolean, Boolean)' methods of 'Type' class. +An object of 'Type' corresponding to 'System::Int32 is obtained '. Properties of 'System::Type' +is retrieved into 'PropertyInfo' array and displayed. Array of 'Type' objects is created +which represents the type specified by an arbitary set of objects. When 'Type' object is +attempted to create for 'sYSTem.iNT32', an exception is thrown when case-sensitive search +is done. +*/ +using namespace System; +using namespace System::Reflection; +int main() +{ + // + // Create an object of 'Type' class. + Type^ myType1 = Type::GetType( "System.Int32" ); + + // Get the 'TypeCode' of the 'Type' class object created above. + TypeCode myTypeCode = Type::GetTypeCode( myType1 ); + Console::WriteLine( "TypeCode is: {0}", myTypeCode ); + // + + // + array^myPropertyInfo; + + // Get the properties of 'Type' class object. + myPropertyInfo = Type::GetType( "System.Type" )->GetProperties(); + Console::WriteLine( "Properties of System.Type are:" ); + for ( int i = 0; i < myPropertyInfo->Length; i++ ) + { + Console::WriteLine( myPropertyInfo[ i ] ); + + } + // + + // + array^myObject = gcnew array(3); + myObject[ 0 ] = 66; + myObject[ 1 ] = "puri"; + myObject[ 2 ] = 33.33; + + // Get the array of 'Type' class objects. + array^myTypeArray = Type::GetTypeArray( myObject ); + Console::WriteLine( "Full names of the 'Type' objects in the array are:" ); + for ( int h = 0; h < myTypeArray->Length; h++ ) + { + Console::WriteLine( myTypeArray[ h ]->FullName ); + + } + // + + // + try + { + // Throws 'TypeLoadException' because of case-sensitive search. + Type^ myType2 = Type::GetType( "sYSTem.iNT32", true, false ); + Console::WriteLine( myType2->FullName ); + } + catch ( TypeLoadException^ e ) + { + Console::WriteLine( e->Message ); + } + // + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp new file mode 100644 index 00000000000..3bdbda50535 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromHandle/CPP/type_gettypefromhandle.cpp @@ -0,0 +1,23 @@ +// System::Type::GetTypeFromHandle(RuntimeTypeHandle) + +/* +The following example demonstrates the 'GetTypeFromHandle(RuntimeTypeHandle)' method +of the 'Type' Class. +It defines an empty class 'Myclass1' and obtains an object of 'Myclass1'. Then the runtime handle of +the object is obtained and passed as an argument to 'GetTypeFromHandle(RuntimeTypeHandle)'method. That +returns the type referenced by the specified type handle. +*/ + +using namespace System; +using namespace System::Reflection; +public ref class MyClass1{}; + +int main() +{ + // + MyClass1^ myClass1 = gcnew MyClass1; + // Get the type referenced by the specified type handle. + Type^ myClass1Type = Type::GetTypeFromHandle( Type::GetTypeHandle( myClass1 ) ); + Console::WriteLine( "The Names of the Attributes : {0}", myClass1Type->Attributes ); + // +} diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp new file mode 100644 index 00000000000..f5e69fb913a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID2/CPP/type_gettypefromprogid2.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +int main() +{ + try + { + + // Use the ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. + String^ myString1 = "DIRECT.ddPalette.3"; + + // Use a nonexistent ProgID WrongProgID. + String^ myString2 = "WrongProgID"; + + // Make a call to the method to get the type information of the given ProgID. + Type^ myType1 = Type::GetTypeFromProgID( myString1, true ); + Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); + + // Throw an exception because the ProgID is invalid and the throwOnError + // parameter is set to True. + Type^ myType2 = Type::GetTypeFromProgID( myString2, true ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp new file mode 100644 index 00000000000..1e6853e4688 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID3/CPP/Type_GetTypeFromProgID3.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +int main() +{ + try + { + + // Use the ProgID localhost\HKEY_CLASSES_ROOT\DirControl::DirList.1. + String^ theProgramID = "DirControl.DirList.1"; + + // Use the server name localhost. + String^ theServer = "localhost"; + + // Make a call to the method to get the type information for the given ProgID. + Type^ myType = Type::GetTypeFromProgID( theProgramID, theServer ); + if ( myType == nullptr ) + { + throw gcnew Exception( "Invalid ProgID or Server." ); + } + Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType->GUID ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp new file mode 100644 index 00000000000..706229d1e8d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeFromProgID4/CPP/Type_GetTypeFromProgID4.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +int main() +{ + try + { + + // Use server localhost. + String^ theServer = "localhost"; + + // Use ProgID HKEY_CLASSES_ROOT\DirControl.DirList.1. + String^ myString1 = "DirControl.DirList.1"; + + // Use a wrong ProgID WrongProgID. + String^ myString2 = "WrongProgID"; + + // Make a call to the method to get the type information for the given ProgID. + Type^ myType1 = Type::GetTypeFromProgID( myString1, theServer, true ); + Console::WriteLine( "GUID for ProgID DirControl.DirList.1 is {0}.", myType1->GUID ); + + // Throw an exception because the ProgID is invalid and the throwOnError + // parameter is set to True. + Type^ myType2 = Type::GetTypeFromProgID( myString2, theServer, true ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred. The ProgID is wrong." ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp new file mode 100644 index 00000000000..fe262565879 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_GetTypeHandle/CPP/Type_GetTypeHandle.cpp @@ -0,0 +1,57 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class MyClass1 +{ +private: + int x; + +public: + int MyMethod() + { + return x; + } +}; + +int main() +{ + MyClass1^ myClass1 = gcnew MyClass1; + + // Get the RuntimeTypeHandle from an object. + RuntimeTypeHandle myRTHFromObject = Type::GetTypeHandle( myClass1 ); + + // Get the RuntimeTypeHandle from a type. + RuntimeTypeHandle myRTHFromType = MyClass1::typeid->TypeHandle; + + Console::WriteLine( "\nmyRTHFromObject.Value: {0}", myRTHFromObject.Value ); + Console::WriteLine( "myRTHFromObject.GetType(): {0}", myRTHFromObject.GetType() ); + Console::WriteLine( "Get the type back from the handle..." ); + Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromObject): {0}", + Type::GetTypeFromHandle(myRTHFromObject) ); + + Console::WriteLine( "\nmyRTHFromObject.Equals(myRTHFromType): {0}", + myRTHFromObject.Equals(myRTHFromType) ); + + Console::WriteLine( "\nmyRTHFromType.Value: {0}", myRTHFromType.Value ); + Console::WriteLine( "myRTHFromType.GetType(): {0}", myRTHFromType.GetType() ); + Console::WriteLine( "Get the type back from the handle..." ); + Console::WriteLine( "Type::GetTypeFromHandle(myRTHFromType): {0}", + Type::GetTypeFromHandle(myRTHFromType) ); +} + +/* This code example produces output similar to the following: + +myRTHFromObject.Value: 3295832 +myRTHFromObject.GetType(): System.RuntimeTypeHandle +Get the type back from the handle... +Type::GetTypeFromHandle(myRTHFromObject): MyClass1 + +myRTHFromObject.Equals(myRTHFromType): True + +myRTHFromType.Value: 3295832 +myRTHFromType.GetType(): System.RuntimeTypeHandle +Get the type back from the handle... +Type::GetTypeFromHandle(myRTHFromType): MyClass1 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp b/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp new file mode 100644 index 00000000000..5f399d51673 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_Guid/CPP/type_guid.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +ref class MyGetTypeFromCLSID +{ +public: + ref class MyClass1 + { + public: + void MyMethod1(){} + }; +}; + +int main() +{ + + // Get the type corresponding to the class MyClass. + Type^ myType = MyGetTypeFromCLSID::MyClass1::typeid; + + // Get the Object* of the Guid. + Guid myGuid = (Guid)myType->GUID; + Console::WriteLine( "The name of the class is {0}", myType ); + Console::WriteLine( "The ClassId of MyClass is {0}", myType->GUID ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp new file mode 100644 index 00000000000..c11f4e80d20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_HasElementType/CPP/type_haselementtype.cpp @@ -0,0 +1,55 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +public ref class Example +{ +public: + // This method is for demonstration purposes. It includes a + // tracking reference (C# ref, VB ByRef), an out parameter, + // and a pointer. + void Test(int% x, [OutAttribute()] int% y, int* z) + { + *z = x = y = 0; + } +}; + +int main() +{ + // All of the following display 'True'. + + // Define a managed array, get its type, and display HasElementType. + array^ examples = {gcnew Example(), gcnew Example()}; + Type^ t = examples::typeid; + Console::WriteLine(t); + Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType); + + // When you use Reflection Emit to emit dynamic methods and + // assemblies, you can create array types using MakeArrayType. + // The following creates the type 'array of Example'. + t = Example::typeid->MakeArrayType(); + Console::WriteLine("HasElementType is '{0}' for managed array types.", t->HasElementType); + + // When you reflect over methods, HasElementType is true for + // ref, out, and pointer parameter types. The following + // gets the Test method, defined above, and examines its + // parameters. + MethodInfo^ mi = Example::typeid->GetMethod("Test"); + array^ parms = mi->GetParameters(); + t = parms[0]->ParameterType; + Console::WriteLine("HasElementType is '{0}' for ref parameter types.", t->HasElementType); + t = parms[1]->ParameterType; + Console::WriteLine("HasElementType is '{0}' for out parameter types.", t->HasElementType); + t = parms[2]->ParameterType; + Console::WriteLine("HasElementType is '{0}' for pointer parameter types.", t->HasElementType); + + // When you use Reflection Emit to emit dynamic methods and + // assemblies, you can create pointer and ByRef types to use + // when you define method parameters. + t = Example::typeid->MakePointerType(); + Console::WriteLine("HasElementType is '{0}' for pointer types.", t->HasElementType); + t = Example::typeid->MakeByRefType(); + Console::WriteLine("HasElementType is '{0}' for ByRef types.", t->HasElementType); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp new file mode 100644 index 00000000000..a2a8c92e5cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_HasElementTypeImpl/CPP/type_haselementtypeimpl.cpp @@ -0,0 +1,86 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyTypeDelegator: public TypeDelegator +{ +public: + String^ myElementType; + +private: + Type^ myType; + +public: + MyTypeDelegator( Type^ myType ) + : TypeDelegator( myType ) + { + this->myType = myType; + } + + +protected: + + // Override Type::HasElementTypeImpl(). + virtual bool HasElementTypeImpl() override + { + + // Determine whether the type is an array. + if ( myType->IsArray ) + { + myElementType = "array"; + return true; + } + + + // Determine whether the type is a reference. + if ( myType->IsByRef ) + { + myElementType = "reference"; + return true; + } + + + // Determine whether the type is a pointer. + if ( myType->IsPointer ) + { + myElementType = "pointer"; + return true; + } + + + // Return false if the type is not a reference, array, or pointer type. + return false; + } + +}; + +int main() +{ + try + { + int myInt = 0; + array^myArray = gcnew array(5); + MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() ); + + // Determine whether myType is an array, pointer, reference type. + Console::WriteLine( "\nDetermine whether a variable is an array, pointer, or reference type.\n" ); + if ( myType->HasElementType ) + Console::WriteLine( "The type of myArray is {0}.", myType->myElementType ); + else + Console::WriteLine( "myArray is not an array, pointer, or reference type." ); + myType = gcnew MyTypeDelegator( myInt.GetType() ); + + // Determine whether myType is an array, pointer, reference type. + if ( myType->HasElementType ) + Console::WriteLine( "The type of myInt is {0}.", myType->myElementType ); + else + Console::WriteLine( "myInt is not an array, pointer, or reference type." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp new file mode 100644 index 00000000000..6bdc99f8a1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsAnsiClass/CPP/Type_IsAnsiClass.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyClass +{ +protected: + String^ myField; + +public: + MyClass() + { + myField = "A sample protected field"; + } +}; + +int main() +{ + try + { + MyClass^ myObject = gcnew MyClass; + + // Get the type of the 'MyClass'. + Type^ myType = MyClass::typeid; + + // Get the field information and the attributes associated with MyClass. + FieldInfo^ myFieldInfo = myType->GetField( "myField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + Console::WriteLine( "\nChecking for the AnsiClass attribute for a field.\n" ); + + // Get and display the name, field, and the AnsiClass attribute. + Console::WriteLine( "Name of Class: {0} \nValue of Field: {1} \nIsAnsiClass = {2}", myType->FullName, myFieldInfo->GetValue( myObject ), myType->IsAnsiClass ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp new file mode 100644 index 00000000000..dadf165d511 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsArrayImpl/CPP/type_isarrayimpl.cpp @@ -0,0 +1,68 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyTypeDelegator: public TypeDelegator +{ +public: + String^ myElementType; + Type^ myType; + MyTypeDelegator( Type^ myType ) + : TypeDelegator( myType ) + { + this->myType = myType; + } + + +protected: + + // Override IsArrayImpl(). + virtual bool IsArrayImpl() override + { + + // Determine whether the type is an array. + if ( myType->IsArray ) + { + myElementType = "array"; + return true; + } + + + // Return false if the type is not an array. + return false; + } + +}; + +int main() +{ + try + { + int myInt = 0; + + // Create an instance of an array element. + array^myArray = gcnew array(5); + MyTypeDelegator^ myType = gcnew MyTypeDelegator( myArray->GetType() ); + Console::WriteLine( "\nDetermine whether the variable is an array.\n" ); + + // Determine whether myType is an array type. + if ( myType->IsArray ) + Console::WriteLine( "The type of myArray is {0}.", myType->myElementType ); + else + Console::WriteLine( "myArray is not an array." ); + myType = gcnew MyTypeDelegator( myInt.GetType() ); + + // Determine whether myType is an array type. + if ( myType->IsArray ) + Console::WriteLine( "The type of myInt is {0}.", myType->myElementType ); + else + Console::WriteLine( "myInt is not an array." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp new file mode 100644 index 00000000000..9c15d3604d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsAutoLayout/CPP/type_isautolayout.cpp @@ -0,0 +1,40 @@ + + +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel; +using namespace System::Runtime::InteropServices; + +// The MyDemoAttribute class is selected as AutoLayout. + +[StructLayoutAttribute(LayoutKind::Auto)] +public ref class MyDemoAttribute{}; + +void MyAutoLayoutMethod( String^ typeName ) +{ + try + { + + // Create an instance of the Type class using the GetType method. + Type^ myType = Type::GetType( typeName ); + + // Get and display the IsAutoLayout property of the + // MyDemoAttribute instance. + Console::WriteLine( "\nThe AutoLayout property for the MyDemoAttribute is {0}.", myType->IsAutoLayout ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); + } + +} + +int main() +{ + MyAutoLayoutMethod( "MyDemoAttribute" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp new file mode 100644 index 00000000000..028383c4410 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsClass/CPP/type_isclass.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyDemoClass{}; + +int main() +{ + try + { + Type^ myType = Type::GetType( "MyDemoClass" ); + + // Get and display the 'IsClass' property of the 'MyDemoClass' instance. + Console::WriteLine( "\nIs the specified type a class? {0}.", myType->IsClass ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp new file mode 100644 index 00000000000..a9a34cadfd5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsContextful/CPP/type_iscontextful.cpp @@ -0,0 +1,49 @@ + +// +using namespace System; +using namespace System::Runtime::Remoting::Contexts; + +public ref class ContextBoundClass: public ContextBoundObject +{ + public: + String^ Value; +}; + +public ref class Example +{ +public: + void Demo() + { + // Determine whether the types can be hosted in a Context. + Console::WriteLine("The IsContextful property for the {0} type is {1}.", + Example::typeid->Name, Example::typeid->IsContextful); + Console::WriteLine("The IsContextful property for the {0} type is {1}.", + ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsContextful); + + // Determine whether the types are marshalled by reference. + Console::WriteLine("The IsMarshalByRef property of {0} is {1}.", + Example::typeid->Name, Example::typeid->IsMarshalByRef ); + Console::WriteLine("The IsMarshalByRef property of {0} is {1}.", + ContextBoundClass::typeid->Name, ContextBoundClass::typeid->IsMarshalByRef ); + + // Determine whether the types are primitive datatypes. + Console::WriteLine("{0} is a primitive data type: {1}.", + int::typeid->Name, int::typeid->IsPrimitive ); + Console::WriteLine("{0} is a primitive data type: {1}.", + String::typeid->Name, String::typeid->IsPrimitive ); + } +}; + +int main() +{ + Example^ ex = gcnew Example; + ex->Demo(); +} +// The example displays the following output: +// The IsContextful property for the Example type is False. +// The IsContextful property for the ContextBoundClass type is True. +// The IsMarshalByRef property of Example is False. +// The IsMarshalByRef property of ContextBoundClass is True. +// Int32 is a primitive data type: True. +// String is a primitive data type: False. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp new file mode 100644 index 00000000000..1ce5137c1af --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsContextfulImpl/CPP/type_iscontextfulimpl.cpp @@ -0,0 +1,82 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class MyTypeDelegatorClass: public TypeDelegator +{ +public: + String^ myElementType; + +private: + Type^ myType; + +public: + MyTypeDelegatorClass( Type^ myType ) + : TypeDelegator( myType ) + { + this->myType = myType; + } + +protected: + + // Override IsContextfulImpl. + virtual bool IsContextfulImpl() override + { + + // Check whether the type is contextful. + if ( myType->IsContextful ) + { + myElementType = " is contextful "; + return true; + } + + return false; + } + +}; + +public ref class MyTypeDemoClass{}; + + +// This class demonstrates IsContextfulImpl. +public ref class MyContextBoundClass: public ContextBoundObject +{ +public: + String^ myString; +}; + +int main() +{ + try + { + MyTypeDelegatorClass^ myType; + Console::WriteLine( "Check whether MyContextBoundClass can be hosted in a context." ); + + // Check whether MyContextBoundClass is contextful. + myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid ); + if ( myType->IsContextful ) + { + Console::WriteLine( "{0} can be hosted in a context.", MyContextBoundClass::typeid ); + } + else + { + Console::WriteLine( "{0} cannot be hosted in a context.", MyContextBoundClass::typeid ); + } + myType = gcnew MyTypeDelegatorClass( MyTypeDemoClass::typeid ); + Console::WriteLine( "\nCheck whether MyTypeDemoClass can be hosted in a context." ); + if ( myType->IsContextful ) + { + Console::WriteLine( "{0} can be hosted in a context.", MyTypeDemoClass::typeid ); + } + else + { + Console::WriteLine( "{0} cannot be hosted in a context.", MyTypeDemoClass::typeid ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp new file mode 100644 index 00000000000..f8e795207a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsInterface/CPP/type_isinterface.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; + +// Declare an interface. +interface class myIFace{}; +public ref class MyIsInterface{}; + +void main() +{ + try + { + // Get the IsInterface attribute for myIFace. + bool myBool1 = myIFace::typeid->IsInterface; + + //Display the IsInterface attribute for myIFace. + Console::WriteLine( "Is the specified type an interface? {0}.", myBool1 ); + + // Get the attribute IsInterface for MyIsInterface. + bool myBool2 = MyIsInterface::typeid->IsInterface; + + //Display the IsInterface attribute for MyIsInterface. + Console::WriteLine( "Is the specified type an interface? {0}.", myBool2 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nAn exception occurred: {0}.", e->Message ); + } +} +/* The example produces the following output: + +Is the specified type an interface? True. +Is the specified type an interface? False. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp new file mode 100644 index 00000000000..db0652f266e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsLayoutSequential/CPP/type_islayoutsequential.cpp @@ -0,0 +1,40 @@ + + +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::ComponentModel; +using namespace System::Runtime::InteropServices; +ref class MyTypeSequential1{}; + + +[StructLayoutAttribute(LayoutKind::Sequential)] +ref class MyTypeSequential2{}; + +int main() +{ + try + { + + // Create an instance of myTypeSeq1. + MyTypeSequential1^ myObj1 = gcnew MyTypeSequential1; + + // Check for and display the SequentialLayout attribute. + Console::WriteLine( "\nThe object myObj1 has IsLayoutSequential: {0}.", myObj1->GetType()->IsLayoutSequential ); + + // Create an instance of 'myTypeSeq2' class. + MyTypeSequential2^ myObj2 = gcnew MyTypeSequential2; + + // Check for and display the SequentialLayout attribute. + Console::WriteLine( "\nThe object myObj2 has IsLayoutSequential: {0}.", myObj2->GetType()->IsLayoutSequential ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nAn exception occurred: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp new file mode 100644 index 00000000000..d6c5c85b0f9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsMarshalByRefImpl/CPP/type_ismarshalbyrefimpl.cpp @@ -0,0 +1,81 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class MyTypeDelegatorClass: public TypeDelegator +{ +public: + String^ myElementType; + +private: + Type^ myType; + +public: + MyTypeDelegatorClass( Type^ myType ) + : TypeDelegator( myType ) + { + this->myType = myType; + } + +protected: + + // Override IsMarshalByRefImpl. + virtual bool IsMarshalByRefImpl() override + { + // Determine whether the type is marshalled by reference. + if ( myType->IsMarshalByRef ) + { + myElementType = " marshalled by reference"; + return true; + } + + return false; + } +}; + +public ref class MyTypeDemoClass{}; + + +// This class is used to demonstrate the IsMarshalByRefImpl method. +public ref class MyContextBoundClass: public ContextBoundObject +{ +public: + String^ myString; +}; + +int main() +{ + try + { + MyTypeDelegatorClass^ myType; + Console::WriteLine( "Determine whether MyContextBoundClass is marshalled by reference." ); + + // Determine whether MyContextBoundClass type is marshalled by reference. + myType = gcnew MyTypeDelegatorClass( MyContextBoundClass::typeid ); + if ( myType->IsMarshalByRef ) + { + Console::WriteLine( "{0} is marshalled by reference.", MyContextBoundClass::typeid ); + } + else + { + Console::WriteLine( "{0} is not marshalled by reference.", MyContextBoundClass::typeid ); + } + + // Determine whether int type is marshalled by reference. + myType = gcnew MyTypeDelegatorClass( int::typeid ); + Console::WriteLine( "\nDetermine whether int is marshalled by reference." ); + if ( myType->IsMarshalByRef ) + { + Console::WriteLine( "{0} is marshalled by reference.", int::typeid ); + } + else + { + Console::WriteLine( "{0} is not marshalled by reference.", int::typeid ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp new file mode 100644 index 00000000000..777086959b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsPrimitiveImpl/CPP/type_isprimitiveimpl.cpp @@ -0,0 +1,73 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class MyTypeDelegatorClass: public TypeDelegator +{ +public: + String^ myElementType; + +private: + Type^ myType; + +public: + MyTypeDelegatorClass( Type^ myType ) + : TypeDelegator( myType ) + { + this->myType = myType; + } + +protected: + + // Override the IsPrimitiveImpl. + virtual bool IsPrimitiveImpl() override + { + + // Determine whether the type is a primitive type. + if ( myType->IsPrimitive ) + { + myElementType = "primitive"; + return true; + } + + return false; + } +}; + +int main() +{ + try + { + Console::WriteLine( "Determine whether int is a primitive type." ); + MyTypeDelegatorClass^ myType; + myType = gcnew MyTypeDelegatorClass( int::typeid ); + + // Determine whether int is a primitive type. + if ( myType->IsPrimitive ) + { + Console::WriteLine( "{0} is a primitive type.", int::typeid ); + } + else + { + Console::WriteLine( "{0} is not a primitive type.", int::typeid ); + } + Console::WriteLine( "\nDetermine whether String is a primitive type." ); + myType = gcnew MyTypeDelegatorClass( String::typeid ); + + // Determine if String is a primitive type. + if ( myType->IsPrimitive ) + { + Console::WriteLine( "{0} is a primitive type.", String::typeid ); + } + else + { + Console::WriteLine( "{0} is not a primitive type.", String::typeid ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp new file mode 100644 index 00000000000..ef24b8b9c18 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsSealed/CPP/type_issealed.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; + +// Declare MyTestClass as sealed. +ref class TestClass sealed{}; + +int main() +{ + TestClass^ testClassInstance = gcnew TestClass; + + // Get the type of testClassInstance. + Type^ type = testClassInstance->GetType(); + + // Get the IsSealed property of the myTestClassInstance. + bool sealed = type->IsSealed; + Console::WriteLine("{0} is sealed: {1}.", type->FullName, sealed); +} +// The example displays the following output: +// TestClass is sealed: True. +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp new file mode 100644 index 00000000000..80e31b7ccbb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsSerializable/CPP/type_isserializable.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +public ref class MyClass +{ +public: + + // Declare a public class with the [Serializable] attribute. + + [Serializable] + ref class MyTestClass{}; + + +}; + +int main() +{ + try + { + bool myBool = false; + MyClass::MyTestClass^ myTestClassInstance = gcnew MyClass::MyTestClass; + + // Get the type of myTestClassInstance. + Type^ myType = myTestClassInstance->GetType(); + + // Get the IsSerializable property of myTestClassInstance. + myBool = myType->IsSerializable; + Console::WriteLine( "\nIs {0} serializable? {1}.", myType->FullName, myBool ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nAn exception occurred: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp b/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp new file mode 100644 index 00000000000..c8ad8156905 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_IsValueType/CPP/type_isvaluetype.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; + +// Declare an enum type. +public enum class NumEnum +{ + One, Two +}; + +int main() +{ + bool flag = false; + NumEnum testEnum = NumEnum::One; + + // Get the type of testEnum. + Type^ t = testEnum.GetType(); + + // Get the IsValueType property of the testEnum + // variable. + flag = t->IsValueType; + Console::WriteLine("{0} is a value type: {1}", t->FullName, flag); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp b/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp new file mode 100644 index 00000000000..d6e8a01a328 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_ToString/CPP/type_tostring.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; + +namespace MyNamespace +{ + ref class MyClass + { + }; +} + +void main() +{ + Type^ myType = MyNamespace::MyClass::typeid; + Console::WriteLine("Displaying information about {0}:", myType ); + + // Get the namespace of the class MyClass. + Console::WriteLine(" Namespace: {0}", myType->Namespace ); + + // Get the name of the module. + Console::WriteLine(" Module: {0}", myType->Module ); + + // Get the fully qualified common language runtime namespace. + Console::WriteLine(" Fully qualified type: {0}", myType ); +} +// The example displays the following output: +// Displaying information about MyNamespace.MyClass: +// Namespace: MyNamespace +// Module: type_tostring.exe +// Fully qualified name: MyNamespace.MyClass +// diff --git a/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp b/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp new file mode 100644 index 00000000000..23ac79f22ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Type_TypeHandle/CPP/type_typehandle.cpp @@ -0,0 +1,42 @@ + +// +using namespace System; +using namespace System::Reflection; +ref class MyClass +{ +public: + int myField; +}; + +void DisplayTypeHandle( RuntimeTypeHandle myTypeHandle ) +{ + + // Get the type from the handle. + Type^ myType = Type::GetTypeFromHandle( myTypeHandle ); + + // Display the type. + Console::WriteLine( "\nDisplaying the type from the handle:\n" ); + Console::WriteLine( "The type is {0}.", myType ); +} + +int main() +{ + try + { + MyClass^ myClass = gcnew MyClass; + + // Get the type of MyClass. + Type^ myClassType = myClass->GetType(); + + // Get the runtime handle of MyClass. + RuntimeTypeHandle myClassHandle = myClassType->TypeHandle; + DisplayTypeHandle( myClassHandle ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp new file mode 100644 index 00000000000..439589d1a61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UInt16 Example/CPP/source.cpp @@ -0,0 +1,631 @@ + +// This is the main DLL file. +using namespace System; +using namespace System::Globalization; + +#define NULL 0 + +// +/// +/// Temperature class stores the value as UInt16 +/// and delegates most of the functionality +/// to the UInt16 implementation. +/// +public ref class Temperature: public IComparable, public IFormattable +{ +protected: + + /// + /// IComparable.CompareTo implementation. + /// + short m_value; + +public: + virtual Int32 CompareTo( Object^ obj ) + { + if ( obj->GetType() == Temperature::typeid ) + { + Temperature^ temp = dynamic_cast(obj); + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + + /// + /// IFormattable.ToString implementation. + /// + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr ) + { + if ( format->Equals( "F" ) ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + if ( format->Equals( "C" ) ) + { + return String::Format( "{0}'C", this->Celsius.ToString() ); + } + } + + return m_value.ToString( format, provider ); + } + + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + if ( s->EndsWith( "F" ) ) + { + temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + if ( s->EndsWith( "C" ) ) + { + temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = UInt16::Parse( s, styles, provider ); + } + } + + return temp; + } + + + property short Value + { + + // The value holder + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + static property short MinValue + { + short get() + { + return UInt16::MinValue; + } + + } + + static property short MaxValue + { + short get() + { + return UInt16::MaxValue; + } + + } + +}; +// + +void main() +{ + Temperature^ t1 = Temperature::Parse( "40'F", NumberStyles::Integer, nullptr ); + Console::WriteLine( t1->ToString( "F", nullptr ) ); + String^ str1 = t1->ToString( "C", nullptr ); + Console::WriteLine( str1 ); + Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); + Console::WriteLine( t2->ToString( "F", nullptr ) ); + Console::WriteLine( t1->CompareTo( t2 ) ); + Temperature^ t3 = Temperature::Parse( "40'C", NumberStyles::Integer, nullptr ); + Console::WriteLine( t3->ToString( "F", nullptr ) ); + Console::WriteLine( t1->CompareTo( t3 ) ); +} + + +/* expected return values: +40'F +4'C +40'F +0 +112'F +-72 +*/ +namespace Snippets2 +{ + // + public ref class Temperature + { + protected: + + // The value holder + short m_value; + + public: + + static property short MinValue + { + short get() + { + return UInt16::MinValue; + } + + } + + static property short MaxValue + { + short get() + { + return UInt16::MaxValue; + } + + } + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + }; + +} +// + +namespace Snippets3 +{ + + // + public ref class Temperature: public IComparable + { + protected: + + /// + /// IComparable.CompareTo implementation. + /// + // The value holder + short m_value; + + public: + virtual Int32 CompareTo( Object^ obj ) + { + if ( obj->GetType() == Temperature::typeid ) + { + Temperature^ temp = dynamic_cast(obj); + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (value * 2 + 32); + } + + } + + }; + +} +// + +namespace Snippets4 +{ + + // + public ref class Temperature: public IFormattable + { + protected: + + /// + /// IFormattable.ToString implementation. + /// + // The value holder + short m_value; + + public: + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr ) + { + if ( format->Equals( "F" ) ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + if ( format->Equals( "C" ) ) + { + return String::Format( "{0}'C", this->Celsius.ToString() ); + } + } + + return m_value.ToString( format, provider ); + } + + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + }; + +} +// + +namespace Snippets5 +{ + // + public ref class Temperature + { + protected: + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + short m_value; + + public: + static Temperature^ Parse( String^ s ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) + { + temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); + } + else + { + if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) + { + temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); + } + else + { + temp->Value = UInt16::Parse( s ); + } + } + + return temp; + } + + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + }; + +} +// + +namespace Snippets6 +{ + // + public ref class Temperature + { + protected: + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + short m_value; + + public: + static Temperature^ Parse( String^ s, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) + { + temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); + } + else + { + if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) + { + temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); + } + else + { + temp->Value = UInt16::Parse( s, provider ); + } + } + + return temp; + } + + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + }; + +} +// + +namespace Snippets7 +{ + // + public ref class Temperature + { + protected: + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + short m_value; + + public: + static Temperature^ Parse( String^ s, NumberStyles styles ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) + { + temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); + } + else + { + if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) + { + temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); + } + else + { + temp->Value = UInt16::Parse( s, styles ); + } + } + + return temp; + } + + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + }; + +} +// + +namespace Snippets8 +{ + // + public ref class Temperature + { + protected: + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + // The value holder + short m_value; + + public: + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + if ( s->TrimEnd( NULL )->EndsWith( "'F" ) ) + { + temp->Value = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + if ( s->TrimEnd( NULL )->EndsWith( "'C" ) ) + { + temp->Celsius = UInt16::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = UInt16::Parse( s, styles, provider ); + } + } + + return temp; + } + + + property short Value + { + short get() + { + return m_value; + } + + void set( short value ) + { + m_value = value; + } + + } + + property short Celsius + { + short get() + { + return (short)((m_value - 32) / 2); + } + + void set( short value ) + { + m_value = (short)(value * 2 + 32); + } + + } + + }; + +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp new file mode 100644 index 00000000000..03bba64ea5d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UInt16_Equals/CPP/uint16_equals.cpp @@ -0,0 +1,34 @@ + +// System::UInt16::Equals(Object) +/* +The following program demonstrates the 'Equals(Object)' method +of struct 'UInt16'. This compares an instance of 'UInt16' with the +passed in Object* and returns true if they are equal. +*/ +using namespace System; + +int main() +{ + try + { + // + UInt16 myVariable1 = 10; + UInt16 myVariable2 = 10; + + //Display the declaring type. + Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); + Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); + + // Compare 'myVariable1' instance with 'myVariable2' Object. + if ( myVariable1.Equals( myVariable2 ) ) + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); + else + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp new file mode 100644 index 00000000000..75a62e5c82b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UInt32 Example/CPP/source.cpp @@ -0,0 +1,417 @@ +using namespace System; +using namespace System::Globalization; + +namespace Snippets +{ + // + /// + /// Temperature class stores the value as UInt32 + /// and delegates most of the functionality + /// to the UInt32 implementation. + /// + public ref class Temperature: public IComparable, public IFormattable + { + public: + /// + /// IComparable.CompareTo implementation. + /// + virtual int CompareTo( Object^ obj ) + { + if ( (Temperature^)( obj ) ) + { + Temperature^ temp = (Temperature^)( obj ); + + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + /// + /// IFormattable.ToString implementation. + /// + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr && format == "F" ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + return m_value.ToString( format, provider ); + } + + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = UInt32::Parse( s, styles, provider ); + } + + return temp; + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets2 +{ + // + public ref class Temperature + { + public: + static property UInt32 MinValue + { + UInt32 get() + { + return UInt32::MinValue; + } + } + + static property UInt32 MaxValue + { + UInt32 get() + { + return UInt32::MaxValue; + } + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets3 +{ + // + public ref class Temperature: public IComparable + { + public: + /// + /// IComparable.CompareTo implementation. + /// + virtual int CompareTo( Object^ obj ) + { + if ( (Temperature^)( obj ) ) + { + Temperature^ temp = (Temperature^)( obj ); + + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets4 +{ + // + public ref class Temperature: public IFormattable + { + public: + /// + /// IFormattable.ToString implementation. + /// + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr && format == "F" ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + return m_value.ToString( format, provider ); + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets5 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); + } + else + { + temp->Value = UInt32::Parse( s ); + } + + return temp; + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets6 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); + } + else + { + temp->Value = UInt32::Parse( s, provider ); + } + + return temp; + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets7 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); + } + else + { + temp->Value = UInt32::Parse( s, styles ); + } + + return temp; + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets8 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt32::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = UInt32::Parse( s, styles, provider ); + } + + return temp; + } + + protected: + // The value holder + UInt32 m_value; + + public: + property UInt32 Value + { + UInt32 get() + { + return m_value; + } + void set( UInt32 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets +{ + void Main() + { + Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr ); + Console::WriteLine( t1->ToString( "F", nullptr ) ); + + String^ str1 = t1->ToString( "G", nullptr ); + Console::WriteLine( str1 ); + + Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); + Console::WriteLine( t2->ToString( "F", nullptr ) ); + + Console::WriteLine( t1->CompareTo( t2 ) ); + + Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr ); + Console::WriteLine( t3->ToString( "F", nullptr ) ); + + Console::WriteLine( t1->CompareTo( t3 ) ); + + Console::ReadLine(); + } +} + +int main() +{ + Snippets::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp new file mode 100644 index 00000000000..66564fc6421 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UInt32_Equals/CPP/uint32_equals.cpp @@ -0,0 +1,34 @@ + +// System::UInt32::Equals(Object) +/* +The following program demonstrates the 'Equals(Object)' method +of struct 'UInt32'. This compares an instance of 'UInt32' with the +passed in Object* and returns true if they are equal. +*/ +using namespace System; + +int main() +{ + try + { + // + UInt32 myVariable1 = 20; + UInt32 myVariable2 = 20; + + // Display the declaring type. + Console::WriteLine( "\nType of 'myVariable1' is '{0}' and value is : {1}", myVariable1.GetType(), myVariable1 ); + Console::WriteLine( "Type of 'myVariable2' is '{0}' and value is : {1}", myVariable2.GetType(), myVariable2 ); + + // Compare 'myVariable1' instance with 'myVariable2' Object. + if ( myVariable1.Equals( myVariable2 ) ) + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are equal" ); + else + Console::WriteLine( "\nStructures 'myVariable1' and 'myVariable2' are not equal" ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } + +} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp new file mode 100644 index 00000000000..0e4d7eef2ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UInt64 Example/CPP/source.cpp @@ -0,0 +1,405 @@ +using namespace System; +using namespace System::Globalization; + +// +/// +/// Temperature class stores the value as UInt64 +/// and delegates most of the functionality +/// to the UInt64 implementation. +/// +public ref class Temperature: public IComparable, public IFormattable +{ +public: + /// + /// IComparable.CompareTo implementation. + /// + virtual int CompareTo( Object^ obj ) + { + if ( (Temperature^)( obj ) ) + { + Temperature^ temp = (Temperature^)( obj ); + + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + /// + /// IFormattable.ToString implementation. + /// + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr && format == "F" ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + return m_value.ToString( format, provider ); + } + + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = UInt64::Parse( s, styles, provider ); + } + + return temp; + } + +protected: + // The value holder + UInt64 m_value; + +public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } +}; +// + +namespace Snippets2 +{ + // + public ref class Temperature + { + public: + static property Int64 MinValue + { + Int64 get() + { + return UInt64::MinValue; + } + } + + static property UInt64 MaxValue + { + UInt64 get() + { + return UInt64::MaxValue; + } + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets3 +{ + // + public ref class Temperature: public IComparable + { + public: + /// + /// IComparable.CompareTo implementation. + /// + virtual int CompareTo( Object^ obj ) + { + if ( (Temperature^)( obj ) ) + { + Temperature^ temp = (Temperature^)( obj ); + + return m_value.CompareTo( temp->m_value ); + } + + throw gcnew ArgumentException( "object is not a Temperature" ); + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets4 +{ + // + public ref class Temperature: public IFormattable + { + public: + /// + /// IFormattable.ToString implementation. + /// + virtual String^ ToString( String^ format, IFormatProvider^ provider ) + { + if ( format != nullptr && format == "F" ) + { + return String::Format( "{0}'F", this->Value.ToString() ); + } + + return m_value.ToString( format, provider ); + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets5 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ) ); + } + else + { + temp->Value = UInt64::Parse( s ); + } + + return temp; + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets6 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), provider ); + } + else + { + temp->Value = UInt64::Parse( s, provider ); + } + + return temp; + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets7 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles ); + } + else + { + temp->Value = UInt64::Parse( s, styles ); + } + + return temp; + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +namespace Snippets8 +{ + // + public ref class Temperature + { + public: + /// + /// Parses the temperature from a string in form + /// [ws][sign]digits['F|'C][ws] + /// + static Temperature^ Parse( String^ s, NumberStyles styles, IFormatProvider^ provider ) + { + Temperature^ temp = gcnew Temperature; + + if ( s->TrimEnd( 0 )->EndsWith( "'F" ) ) + { + temp->Value = UInt64::Parse( s->Remove( s->LastIndexOf( '\'' ), 2 ), styles, provider ); + } + else + { + temp->Value = UInt64::Parse( s, styles, provider ); + } + + return temp; + } + + protected: + // The value holder + UInt64 m_value; + + public: + property UInt64 Value + { + UInt64 get() + { + return m_value; + } + void set( UInt64 value ) + { + m_value = value; + } + } + }; +} +// + +int main() +{ + Temperature^ t1 = Temperature::Parse( "20'F", NumberStyles::Integer, nullptr ); + Console::WriteLine( t1->ToString( "F", nullptr ) ); + + String^ str1 = t1->ToString( "G", nullptr ); + Console::WriteLine( str1 ); + + Temperature^ t2 = Temperature::Parse( str1, NumberStyles::Integer, nullptr ); + Console::WriteLine( t2->ToString( "F", nullptr ) ); + + Console::WriteLine( t1->CompareTo( t2 ) ); + + Temperature^ t3 = Temperature::Parse( "30'F", NumberStyles::Integer, nullptr ); + Console::WriteLine( t3->ToString( "F", nullptr ) ); + + Console::WriteLine( t1->CompareTo( t3 ) ); + + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp b/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp new file mode 100644 index 00000000000..b5928f9ee25 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UInt64_Equals/CPP/uint64_equals.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +int main() +{ + UInt64 value1 = 50; + UInt64 value2 = 50; + + // Display the values. + Console::WriteLine("value1: Type: {0} Value: {1}", + value1.GetType()->Name, value1); + Console::WriteLine("value2: Type: {0} Value: {1}", + value2.GetType()->Name, value2); + + // Compare the two values. + Console::WriteLine("value1 and value2 are equal: {0}", + value1.Equals(value2)); +} +// The example displays the following output: +// value1: Type: UInt64 Value: 50 +// value2: Type: UInt64 Value: 50 +// value1 and value2 are equal: True +// diff --git a/snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp b/snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp new file mode 100644 index 00000000000..dd812c872af --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UninstallAction_NoAction_Remove_3/CPP/uninstallaction_noaction_remove_3.cpp @@ -0,0 +1,95 @@ + + +// System::Configuration::Install::UninstallAction +// System::Configuration::Install::UninstallAction.NoAction +// System::Configuration::Install::UninstallAction.Remove +/* The following program demonstrates S"NoAction" and S"Remove" +members of S"UninstallAction" enumeration. A resource is +installed and uninstalled using 'installutil.exe' in an event +log depending on the user input. +*/ +// +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Configuration::Install; + +[RunInstaller(true)] +ref class MyUninstallActionClass: public Installer +{ +private: + EventLogInstaller^ myInstaller; + +public: + MyUninstallActionClass() + { + myInstaller = gcnew EventLogInstaller; + } + + + // Override the 'Install' method. + virtual void Install( IDictionary^ savedState ) override + { + Console::Write( "Enter a new log to create (eg: MyLog): " ); + myInstaller->Log = Console::ReadLine(); + Console::Write( "Enter a source for log (eg: MySource): " ); + myInstaller->Source = Console::ReadLine(); + Installers->Add( myInstaller ); + Installer::Install( savedState ); + } + + + // Override the 'Commit' method. + virtual void Commit( IDictionary^ savedState ) override + { + Installer::Commit( savedState ); + } + + + // Override the 'Rollback' method. + virtual void Rollback( IDictionary^ savedState ) override + { + Installer::Rollback( savedState ); + } + + + // + // + virtual void Uninstall( IDictionary^ savedState ) override + { + Console::Write( "Enter a source from log to uninstall(eg: MySource): " ); + myInstaller->Source = Console::ReadLine(); + Console::Write( "Do you want to uninstall, press 'y' for 'YES' and 'n' for 'NO':" ); + String^ myUninstall = Console::ReadLine(); + if ( myUninstall->Equals( "n" ) ) + { + + // No action to be taken on the resource in the event log. + myInstaller->UninstallAction = UninstallAction::NoAction; + } + else + { + + // Remove the resource from the event log. + myInstaller->UninstallAction = UninstallAction::Remove; + } + + Installers->Add( myInstaller ); + Installer::Uninstall( savedState ); + } + + // + // +}; + +int main() +{ + Console::WriteLine( "Syntax for install: installutil.exe UninstallAction_NoAction_Remove_3.exe " ); + Console::WriteLine( "Syntax for uninstall: installutil.exe /u UninstallAction_NoAction_Remove_3.exe " ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp new file mode 100644 index 00000000000..bf3e8e72213 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/UnmanagedMarshalObsolete/cpp/source.cpp @@ -0,0 +1,63 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; + +void main() +{ + AppDomain^ myDomain = AppDomain::CurrentDomain; + AssemblyName^ myAsmName = gcnew AssemblyName("EmitMarshalAs"); + + AssemblyBuilder^ myAssembly = + myDomain->DefineDynamicAssembly(myAsmName, + AssemblyBuilderAccess::RunAndSave); + + ModuleBuilder^ myModule = + myAssembly->DefineDynamicModule(myAsmName->Name, + myAsmName->Name + ".dll"); + + TypeBuilder^ myType = + myModule->DefineType("Sample", TypeAttributes::Public); + + MethodBuilder^ myMethod = + myType->DefineMethod("Test", MethodAttributes::Public, + nullptr, gcnew array { String::typeid }); + + + // Get a parameter builder for the parameter that needs the + // attribute, using the HasFieldMarshal attribute. In this + // example, the parameter is at position 0 and has the name + // "arg". + ParameterBuilder^ pb = + myMethod->DefineParameter(0, + ParameterAttributes::HasFieldMarshal, "arg"); + + // Get the MarshalAsAttribute constructor that takes an + // argument of type UnmanagedType. + // + //Type^ maattrType = MarshalAsAttribute::typeid; + ConstructorInfo^ ci = + (MarshalAsAttribute::typeid)->GetConstructor( + gcnew array { UnmanagedType::typeid }); + + // Create a CustomAttributeBuilder representing the attribute, + // specifying the necessary unmanaged type. In this case, + // UnmanagedType.BStr is specified. + // + CustomAttributeBuilder^ cabuilder = + gcnew CustomAttributeBuilder( + ci, gcnew array { UnmanagedType::BStr }); + + // Apply the attribute to the parameter. + // + pb->SetCustomAttribute(cabuilder); + + + ILGenerator^ il = myMethod->GetILGenerator(); + il->Emit(OpCodes::Ret); + + Type^ finished = myType->CreateType(); + myAssembly->Save(myAsmName->Name + ".dll"); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp b/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp new file mode 100644 index 00000000000..6a1f8f2f542 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/Uri_IsHexDigit/CPP/uri_ishexdigit.cpp @@ -0,0 +1,43 @@ + + +/* +System.Uri.IsHexDigit + +The following program reads a string from console and determines whether the +specified character is valid hexadecimal digit. +*/ +#using + +using namespace System; +int main() +{ + try + { + // + Console::Write( "Type a string : " ); + String^ myString = Console::ReadLine(); + for ( int i = 0; i < myString->Length; i++ ) + if ( Uri::IsHexDigit( myString[ i ] ) ) + Console::WriteLine( "{0} is a hexadecimal digit.", myString[ i ] ); + else + Console::WriteLine( "{0} is not a hexadecimal digit.", myString[ i ] ); + // The example produces output like the following: + // Type a string : 3f5EaZ + // 3 is a hexadecimal digit. + // f is a hexadecimal digit. + // 5 is a hexadecimal digit. + // E is a hexadecimal digit. + // a is a hexadecimal digit. + // Z is not a hexadecimal digit. + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} + +// ***** Output ***** +/* + +*/ diff --git a/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp new file mode 100644 index 00000000000..dfec68d03a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/ValueType.Equals Example/CPP/source.cpp @@ -0,0 +1,28 @@ + +using namespace System; + +// +public ref struct Complex +{ +public: + double m_Re; + double m_Im; + virtual bool Equals( Object^ ob ) override + { + if ( dynamic_cast(ob) ) + { + Complex^ c = dynamic_cast(ob); + return m_Re == c->m_Re && m_Im == c->m_Im; + } + else + { + return false; + } + } + + virtual int GetHashCode() override + { + return m_Re.GetHashCode() ^ m_Im.GetHashCode(); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp b/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp new file mode 100644 index 00000000000..a5590808eaa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/WaitHandle/cpp/WaitHandle.cpp @@ -0,0 +1,71 @@ +//Types:System.Threading.WaitHandle +// +using namespace System; +using namespace System::Threading; + +public ref class WaitHandleExample +{ + // Define a random number generator for testing. +private: + static Random^ random = gcnew Random(); +public: + static void DoTask(Object^ state) + { + AutoResetEvent^ autoReset = (AutoResetEvent^) state; + int time = 1000 * random->Next(2, 10); + Console::WriteLine("Performing a task for {0} milliseconds.", time); + Thread::Sleep(time); + autoReset->Set(); + } +}; + +// +int main() +{ + // Define an array with two AutoResetEvent WaitHandles. + array^ handles = gcnew array { + gcnew AutoResetEvent(false), gcnew AutoResetEvent(false)}; + + // Queue up two tasks on two different threads; + // wait until all tasks are completed. + DateTime timeInstance = DateTime::Now; + Console::WriteLine("Main thread is waiting for BOTH tasks to " + + "complete."); + ThreadPool::QueueUserWorkItem( + gcnew WaitCallback(WaitHandleExample::DoTask), handles[0]); + ThreadPool::QueueUserWorkItem( + gcnew WaitCallback(WaitHandleExample::DoTask), handles[1]); + WaitHandle::WaitAll(handles); + // The time shown below should match the longest task. + Console::WriteLine("Both tasks are completed (time waited={0})", + (DateTime::Now - timeInstance).TotalMilliseconds); + + // Queue up two tasks on two different threads; + // wait until any tasks are completed. + timeInstance = DateTime::Now; + Console::WriteLine(); + Console::WriteLine("The main thread is waiting for either task to " + + "complete."); + ThreadPool::QueueUserWorkItem( + gcnew WaitCallback(WaitHandleExample::DoTask), handles[0]); + ThreadPool::QueueUserWorkItem( + gcnew WaitCallback(WaitHandleExample::DoTask), handles[1]); + int index = WaitHandle::WaitAny(handles); + // The time shown below should match the shortest task. + Console::WriteLine("Task {0} finished first (time waited={1}).", + index + 1, (DateTime::Now - timeInstance).TotalMilliseconds); +} +// + +// This code produces the following sample output. +// +// Main thread is waiting for BOTH tasks to complete. +// Performing a task for 7000 milliseconds. +// Performing a task for 4000 milliseconds. +// Both tasks are completed (time waited=7064.8052) + +// The main thread is waiting for either task to complete. +// Performing a task for 2000 milliseconds. +// Performing a task for 2000 milliseconds. +// Task 1 finished first (time waited=2000.6528). +// diff --git a/snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp new file mode 100644 index 00000000000..5565d07259a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/WindowsIdentity Impersonation/CPP/source.cpp @@ -0,0 +1,93 @@ + + +// +// This sample demonstrates the use of the WindowsIdentity class to impersonate a user. +// IMPORTANT NOTES: +// This sample requests the user to enter a password on the console screen. +// Because the console window does not support methods allowing the password to be masked, +// it will be visible to anyone viewing the screen. +// On Windows Vista and later this sample must be run as an administrator. + +#using + +using namespace System; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Principal; +using namespace System::Security::Permissions; + + +[DllImport("advapi32.dll",SetLastError=true)] +bool LogonUser( String^ lpszUsername, String^ lpszDomain, String^ lpszPassword, int dwLogonType, int dwLogonProvider, IntPtr * phToken ); + +[DllImport("kernel32.dll",CharSet=CharSet::Auto)] +bool CloseHandle( IntPtr handle ); + +// Test harness. +// If you incorporate this code into a DLL, be sure to demand FullTrust. + +[PermissionSetAttribute(SecurityAction::Demand,Name="FullTrust")] +int main() +{ + IntPtr tokenHandle = IntPtr(0); + + try + { + String^ userName; + String^ domainName; + + // Get the user token for the specified user, domain, and password using the + // unmanaged LogonUser method. + // The local machine name can be used for the domain name to impersonate a user on this machine. + Console::Write( "Enter the name of the domain on which to log on: " ); + domainName = Console::ReadLine(); + Console::Write( "Enter the login of a user on {0} that you wish to impersonate: ", domainName ); + userName = Console::ReadLine(); + Console::Write( "Enter the password for {0}: ", userName ); + const int LOGON32_PROVIDER_DEFAULT = 0; + + //This parameter causes LogonUser to create a primary token. + const int LOGON32_LOGON_INTERACTIVE = 2; + const int SecurityImpersonation = 2; + tokenHandle = IntPtr::Zero; + + // Call LogonUser to obtain a handle to an access token. + bool returnValue = LogonUser( userName, domainName, Console::ReadLine(), LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, &tokenHandle ); + Console::WriteLine( "LogonUser called." ); + if ( false == returnValue ) + { + int ret = Marshal::GetLastWin32Error(); + Console::WriteLine( "LogonUser failed with error code : {0}", ret ); + throw gcnew System::ComponentModel::Win32Exception( ret ); + } + Console::WriteLine( "Did LogonUser Succeed? {0}", (returnValue ? (String^)"Yes" : "No") ); + Console::WriteLine( "Value of Windows NT token: {0}", tokenHandle ); + + // Check the identity. + Console::WriteLine( "Before impersonation: {0}", WindowsIdentity::GetCurrent()->Name ); + + // The token that is passed to the following constructor must + // be a primary token in order to use it for impersonation. + WindowsIdentity^ newId = gcnew WindowsIdentity( tokenHandle ); + WindowsImpersonationContext^ impersonatedUser = newId->Impersonate(); + + // Check the identity. + Console::WriteLine( "After impersonation: {0}", WindowsIdentity::GetCurrent()->Name ); + + // Stop impersonating the user. + impersonatedUser->Undo(); + + // Check the identity. + Console::WriteLine( "After Undo: {0}", WindowsIdentity::GetCurrent()->Name ); + + // Free the tokens. + if ( tokenHandle != IntPtr::Zero ) + CloseHandle( tokenHandle ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Exception occurred. {0}", ex->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp new file mode 100644 index 00000000000..9772134cfdc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.Equals Method/CPP/example.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + String^ OtherCertificate = "OtherCertificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Load the certificate into an X509Certificate object. + X509Certificate^ certTwo = X509Certificate::CreateFromCertFile( OtherCertificate ); + + // Get the value. + bool result = cert->Equals( certTwo ); + + // Display the value to the console. + Console::WriteLine( result ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp new file mode 100644 index 00000000000..5af220ab9f7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHash Method/CPP/example.cpp @@ -0,0 +1,18 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + array^results = cert->GetCertHash(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp new file mode 100644 index 00000000000..55ab6046d0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetCertHashString Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetCertHashString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp new file mode 100644 index 00000000000..bdd5c733874 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetEffectiveDateString Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetEffectiveDateString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp new file mode 100644 index 00000000000..7c7ba844a14 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetExpirationDateString Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetExpirationDateString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp new file mode 100644 index 00000000000..478464e28d5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetFormat Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetFormat(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp new file mode 100644 index 00000000000..fbd037afed5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetHashCode Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + int results = cert->GetHashCode(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp new file mode 100644 index 00000000000..c8cc924a1df --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetIssuerName Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetIssuerName(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp new file mode 100644 index 00000000000..6c0355deedf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithm Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetKeyAlgorithm(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp new file mode 100644 index 00000000000..834343b8ca2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParameters Method/CPP/example.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + array^results = cert->GetKeyAlgorithmParameters(); + + // Display the value to the console. + System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); + while ( enum0->MoveNext() ) + { + Byte b = safe_cast(enum0->Current); + Console::Write( b ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp new file mode 100644 index 00000000000..3ebc0887b84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetKeyAlgorithmParametersString/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetKeyAlgorithmParametersString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp new file mode 100644 index 00000000000..14cc5940220 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetName Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetName(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp new file mode 100644 index 00000000000..e30ffdb3735 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKey Method/CPP/example.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + array^results = cert->GetPublicKey(); + + // Display the value to the console. + System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); + while ( enum0->MoveNext() ) + { + Byte b = safe_cast(enum0->Current); + Console::Write( b ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp new file mode 100644 index 00000000000..53861be1cdc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetPublicKeyString Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetPublicKeyString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp new file mode 100644 index 00000000000..da8eae2d858 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertData Method/CPP/example.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + array^results = cert->GetRawCertData(); + + // Display the value to the console. + System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); + while ( enum0->MoveNext() ) + { + Byte b = safe_cast(enum0->Current); + Console::Write( b ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp new file mode 100644 index 00000000000..17f1ada058c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetRawCertDataString Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetRawCertDataString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp new file mode 100644 index 00000000000..fe0562f72c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumber Method/CPP/example.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + array^results = cert->GetSerialNumber(); + + // Display the value to the console. + System::Collections::IEnumerator^ enum0 = results->GetEnumerator(); + while ( enum0->MoveNext() ) + { + Byte b = safe_cast(enum0->Current); + Console::Write( b ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp new file mode 100644 index 00000000000..f0bcfd5314f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.GetSerialNumberString Method/CPP/example.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ results = cert->GetSerialNumberString(); + + // Display the value to the console. + Console::WriteLine( results ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp new file mode 100644 index 00000000000..311195b9c1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/X509Certificate.ToString Method/CPP/example.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +using namespace System::Security::Cryptography::X509Certificates; +int main() +{ + + // The path to the certificate. + String^ Certificate = "Certificate.cer"; + + // Load the certificate into an X509Certificate object. + X509Certificate^ cert = X509Certificate::CreateFromCertFile( Certificate ); + + // Get the value. + String^ resultsTrue = cert->ToString( true ); + + // Display the value to the console. + Console::WriteLine( resultsTrue ); + + // Get the value. + String^ resultsFalse = cert->ToString( false ); + + // Display the value to the console. + Console::WriteLine( resultsFalse ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp new file mode 100644 index 00000000000..aa1fd739b5b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/XMLDSIG - Signature - Detached/CPP/sample.cpp @@ -0,0 +1,173 @@ +// +// +// This example signs a URL using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + + +namespace Sample +{ + public ref class SignVerifyEnvelope + { + public: + static void Work() + { + // Generate a signing key. + RSA^ key = RSA::Create(); + + try + { + + // Sign the detached resource and save the + // signature in an XML file. + SignDetachedResource("http://www.microsoft.com", + "SignedExample.xml", key); + + Console::WriteLine("XML file signed."); + + // Verify the signature of the signed XML. + Console::WriteLine("Verifying signature..."); + + bool result = VerifyXmlFile("SignedExample.xml"); + + // Display the results of the signature verification + // to the console. + if (result) + { + Console::WriteLine("The XML signature" + " is valid."); + } + else + { + Console::WriteLine("The XML signature" + " is not valid."); + } + Console::ReadLine(); + } + + catch (CryptographicException^ ex) + { + Console::WriteLine(ex->Message); + } + finally + { + // Clear resources associated with the + // RSA instance. + key->Clear(); + } + } + + + // Sign an XML file and save the signature in a new file. + static void SignDetachedResource(String^ uri, + String^ xmlFileName, RSA^ key) + { + // Check the arguments. + if (uri->Length == 0) + { + throw gcnew ArgumentException("uri"); + } + if (xmlFileName->Length == 0) + { + throw gcnew ArgumentException("xmlFileName"); + } + if (key->KeySize == 0) + { + throw gcnew ArgumentException("key"); + } + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml(); + + // Assign the key to the SignedXml object. + signedXml->SigningKey = key; + + // Get the signature object from the SignedXml object. + Signature^ xmlSignature = signedXml->Signature; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference(); + + // Add the passed URI to the reference object. + reference->Uri = uri; + + // Add the Reference object to the Signature object. + xmlSignature->SignedInfo->AddReference(reference); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient + // find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo(); + keyInfo->AddClause( + gcnew RSAKeyValue(key)); + + // Add the KeyInfo object to the Reference object. + xmlSignature->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmlTextWriter = gcnew XmlTextWriter( + xmlFileName, gcnew UTF8Encoding(false)); + + xmlDigitalSignature->WriteTo(xmlTextWriter); + xmlTextWriter->Close(); + } + + + // Verify the signature of an XML file and return the result. + static Boolean VerifyXmlFile(String^ documentName) + { + // Check the arguments. + if (documentName->Length == 0) + { + throw gcnew ArgumentException("documentName"); + } + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument(); + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load(documentName); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml(xmlDocument); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = + xmlDocument->GetElementsByTagName("Signature"); + + // Load the signature node. + signedXml->LoadXml( + (XmlElement^) nodeList->Item(0)); + + // Check the signature and return the result. + return signedXml->CheckSignature(); + } + }; +} + + +int main() +{ + Sample::SignVerifyEnvelope::Work(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp new file mode 100644 index 00000000000..95b151171e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/XMLDSIG Signing/CPP/source.cpp @@ -0,0 +1,57 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Xml; +int main() +{ + + // Create example data to sign. + XmlDocument^ document = gcnew XmlDocument; + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + node->InnerText = "This is some text"; + document->AppendChild( node ); + Console::Error->WriteLine( "Data to sign:\n{0}\n", document->OuterXml ); + + // Create the SignedXml message. + SignedXml^ signedXml = gcnew SignedXml; + RSA^ key = RSA::Create(); + signedXml->SigningKey = key; + + // Create a data object to hold the data to sign. + DataObject^ dataObject = gcnew DataObject; + dataObject->Data = document->ChildNodes; + dataObject->Id = "MyObjectId"; + + // Add the data object to the signature. + signedXml->AddObject( dataObject ); + + // Create a reference to be able to package everything into the + // message. + Reference^ reference = gcnew Reference; + reference->Uri = "#MyObjectId"; + + // Add it to the message. + signedXml->AddReference( reference ); + + // Add a KeyInfo. + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( key ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature. + XmlElement^ xmlSignature = signedXml->GetXml(); + Console::WriteLine( xmlSignature->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp new file mode 100644 index 00000000000..74689b19c1f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/XMLDSIG Verification/CPP/source.cpp @@ -0,0 +1,36 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + array^args = System::Environment::GetCommandLineArgs(); + Console::WriteLine( "Verifying {0}...", args[ 1 ] ); + + // Create a SignedXml. + SignedXml^ signedXml = gcnew SignedXml; + + // Load the XML. + XmlDocument^ xmlDocument = gcnew XmlDocument; + xmlDocument->PreserveWhitespace = true; + xmlDocument->Load( gcnew XmlTextReader( args[ 1 ] ) ); + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + signedXml->LoadXml( safe_cast(nodeList[ 0 ]) ); + if ( signedXml->CheckSignature() ) + { + Console::WriteLine( "Signature check OK" ); + } + else + { + Console::WriteLine( "Signature check FAILED" ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp b/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp new file mode 100644 index 00000000000..fb78282dd30 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/adproperties/CPP/adproperties.cpp @@ -0,0 +1,67 @@ + +// +using namespace System; +using namespace System::Security::Policy; + +//for evidence object +int main() +{ + AppDomainSetup^ setup = gcnew AppDomainSetup; + + // Shadow copying will not work unless the application has a name. + setup->ApplicationName = "MyApplication"; + + //Create evidence for the new application domain from evidence of + // current application domain. + Evidence^ adevidence = AppDomain::CurrentDomain->Evidence; + + // Create a new application domain. + AppDomain^ domain = AppDomain::CreateDomain( "MyDomain", adevidence, setup ); + + // MyAssembly.dll is located in the Assemblies subdirectory. + domain->AppendPrivatePath( "Assemblies" ); + + // MyOtherAssembly.dll and MyThirdAssembly.dll are located in the + // MoreAssemblies subdirectory. + domain->AppendPrivatePath( "MoreAssemblies" ); + + // Display the relative search path. + Console::WriteLine( "RelativeSearchPath: {0}", domain->RelativeSearchPath ); + + // Because Load returns an Assembly object, the assemblies must be + // loaded into the current domain as well. This will fail unless the + // current domain also has these directories in its search path. + AppDomain::CurrentDomain->AppendPrivatePath( "Assemblies" ); + AppDomain::CurrentDomain->AppendPrivatePath( "MoreAssemblies" ); + + // Save shadow copies to C:\Cache + domain->SetCachePath( "C:\\Cache" ); + + // Shadow copy only the assemblies in the Assemblies directory. + domain->SetShadowCopyPath( String::Concat( domain->BaseDirectory, "Assemblies" ) ); + + // Turn shadow copying on. + domain->SetShadowCopyFiles(); + Console::WriteLine( "ShadowCopyFiles turned on: {0}", domain->ShadowCopyFiles ); + + // This will be copied. + // You must supply a valid fully qualified assembly name here. + domain->Load( "Assembly1 text name, Version, Culture, PublicKeyToken" ); + + // This will not be copied. + // You must supply a valid fully qualified assembly name here. + domain->Load( "Assembly2 text name, Version, Culture, PublicKeyToken" ); + + // When the shadow copy path is cleared, the CLR will make shadow copies + // of all private assemblies. + domain->ClearShadowCopyPath(); + + // MoreAssemblies\MyThirdAssembly.dll should be shadow copied this time. + // You must supply a valid fully qualified assembly name here. + domain->Load( "Assembly3 text name, Version, Culture, PublicKeyToken" ); + + // Unload the domain. + AppDomain::Unload( domain ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp b/snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp new file mode 100644 index 00000000000..e3a2a599d6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/capikey/CPP/capikey.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; +int main() +{ + + // creates the CspParameters object and sets the key container name used to store the RSA key pair + CspParameters^ cp = gcnew CspParameters; + cp->KeyContainerName = "MyKeyContainerName"; + + // instantiates the rsa instance accessing the key container MyKeyContainerName + RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider( cp ); + + // add the below line to delete the key entry in MyKeyContainerName + // rsa.PersistKeyInCsp = false; + //writes out the current key pair used in the rsa instance + Console::WriteLine( "Key is : \n{0}", rsa->ToXmlString( true ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp b/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp new file mode 100644 index 00000000000..7cd42aba971 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/char.cvtutf32/CPP/utf.cpp @@ -0,0 +1,57 @@ + +// +// This example demonstrates the Char.ConvertFromUtf32() method +// and Char.ConvertToUtf32() overloads. +using namespace System; +void Show( String^ s ) +{ +// Console::Write( "0x{0:X}, 0x{1:X}", (int)s->get_Chars( 0 ), (int)s->get_Chars( 1 ) ); + Console::Write( "0x{0:X}, 0x{1:X}", (int)s[ 0 ], (int)s[ 1 ] ); +} + +int main() +{ + int music = 0x1D161; //U+1D161 = MUSICAL SYMBOL SIXTEENTH NOTE + + String^ s1; + String^ comment1a = "Create a UTF-16 encoded string from a code point."; + String^ comment1b = "Create a code point from a surrogate pair at a certain position in a string."; + String^ comment1c = "Create a code point from a high surrogate and a low surrogate code point."; + + // ------------------------------------------------------------------- + // Convert the code point U+1D161 to UTF-16. The UTF-16 equivalent of + // U+1D161 is a surrogate pair with hexadecimal values D834 and DD61. + Console::WriteLine( comment1a ); + s1 = Char::ConvertFromUtf32( music ); + Console::Write( " 1a) 0x{0:X} => ", music ); + Show( s1 ); + Console::WriteLine(); + + // Convert the surrogate pair in the string at index position + // zero to a code point. + Console::WriteLine( comment1b ); + music = Char::ConvertToUtf32( s1, 0 ); + Console::Write( " 1b) " ); + Show( s1 ); + Console::WriteLine( " => 0x{0:X}", music ); + + // Convert the high and low characters in the surrogate pair into a code point. + Console::WriteLine( comment1c ); + music = Char::ConvertToUtf32( s1[ 0 ], s1[ 1 ] ); + Console::Write( " 1c) " ); + Show( s1 ); + Console::WriteLine( " => 0x{0:X}", music ); +} + +/* +This example produces the following results: + +Create a UTF-16 encoded string from a code point. + 1a) 0x1D161 => 0xD834, 0xDD61 +Create a code point from a surrogate pair at a certain position in a string. + 1b) 0xD834, 0xDD61 => 0x1D161 +Create a code point from a high surrogate and a low surrogate code point. + 1c) 0xD834, 0xDD61 => 0x1D161 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp b/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp new file mode 100644 index 00000000000..1a9d98b34ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/char.surrogate/CPP/sur.cpp @@ -0,0 +1,85 @@ + +// +// This example demonstrates the Char.IsLowSurrogate() method +// IsHighSurrogate() method +// IsSurrogatePair() method +using namespace System; +int main() +{ + Char cHigh = L'\xD800'; + Char cLow = L'\xDC00'; + array^temp0 = {L'a',L'\xD800',L'\xDC00',L'z'}; + String^ s1 = gcnew String( temp0 ); + String^ divider = String::Concat( Environment::NewLine, gcnew String( '-',70 ), Environment::NewLine ); + Console::WriteLine(); + Console::WriteLine( "Hexadecimal code point of the character, cHigh: {0:X4}", (int)cHigh ); + Console::WriteLine( "Hexadecimal code point of the character, cLow: {0:X4}", (int)cLow ); + Console::WriteLine(); + Console::WriteLine( "Characters in string, s1: 'a', high surrogate, low surrogate, 'z'" ); + Console::WriteLine( "Hexadecimal code points of the characters in string, s1: " ); + for ( int i = 0; i < s1->Length; i++ ) + { + Console::WriteLine( "s1[{0}] = {1:X4} ", i, (int)s1[ i ] ); + } + Console::WriteLine( divider ); + Console::WriteLine( "Is each of the following characters a high surrogate?" ); + Console::WriteLine( "A1) cLow? - {0}", Char::IsHighSurrogate( cLow ) ); + Console::WriteLine( "A2) cHigh? - {0}", Char::IsHighSurrogate( cHigh ) ); + Console::WriteLine( "A3) s1[0]? - {0}", Char::IsHighSurrogate( s1, 0 ) ); + Console::WriteLine( "A4) s1[1]? - {0}", Char::IsHighSurrogate( s1, 1 ) ); + Console::WriteLine( divider ); + Console::WriteLine( "Is each of the following characters a low surrogate?" ); + Console::WriteLine( "B1) cLow? - {0}", Char::IsLowSurrogate( cLow ) ); + Console::WriteLine( "B2) cHigh? - {0}", Char::IsLowSurrogate( cHigh ) ); + Console::WriteLine( "B3) s1[0]? - {0}", Char::IsLowSurrogate( s1, 0 ) ); + Console::WriteLine( "B4) s1[2]? - {0}", Char::IsLowSurrogate( s1, 2 ) ); + Console::WriteLine( divider ); + Console::WriteLine( "Is each of the following pairs of characters a surrogate pair?" ); + Console::WriteLine( "C1) cHigh and cLow? - {0}", Char::IsSurrogatePair( cHigh, cLow ) ); + Console::WriteLine( "C2) s1[0] and s1[1]? - {0}", Char::IsSurrogatePair( s1, 0 ) ); + Console::WriteLine( "C3) s1[1] and s1[2]? - {0}", Char::IsSurrogatePair( s1, 1 ) ); + Console::WriteLine( "C4) s1[2] and s1[3]? - {0}", Char::IsSurrogatePair( s1, 2 ) ); + Console::WriteLine( divider ); +} + +/* +This example produces the following results: + +Hexadecimal code point of the character, cHigh: D800 +Hexadecimal code point of the character, cLow: DC00 + +Characters in string, s1: 'a', high surrogate, low surrogate, 'z' +Hexadecimal code points of the characters in string, s1: +s1[0] = 0061 +s1[1] = D800 +s1[2] = DC00 +s1[3] = 007A + +---------------------------------------------------------------------- + +Is each of the following characters a high surrogate? +A1) cLow? - False +A2) cHigh? - True +A3) s1[0]? - False +A4) s1[1]? - True + +---------------------------------------------------------------------- + +Is each of the following characters a low surrogate? +B1) cLow? - True +B2) cHigh? - False +B3) s1[0]? - False +B4) s1[2]? - True + +---------------------------------------------------------------------- + +Is each of the following pairs of characters a surrogate pair? +C1) cHigh and cLow? - True +C2) s1[0] and s1[1]? - False +C3) s1[1] and s1[2]? - True +C4) s1[2] and s1[3]? - False + +---------------------------------------------------------------------- + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp new file mode 100644 index 00000000000..23e5a5ec992 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.beep/CPP/beep.cpp @@ -0,0 +1,42 @@ + +// +// This example demonstrates the Console.Beep() method. +using namespace System; +int main() +{ + array^args = Environment::GetCommandLineArgs(); + int x = 0; + + // + if ( (args->Length == 2) && (Int32::TryParse( args[ 1 ], x )) && ((x >= 1) && (x <= 9)) ) + { + for ( int i = 1; i <= x; i++ ) + { + Console::WriteLine( "Beep number {0}.", i ); + Console::Beep(); + + } + } + else + Console::WriteLine( "Usage: Enter the number of times (between 1 and 9) to beep." ); +} + +/* +This example produces the following results: + +>beep +Usage: Enter the number of times (between 1 and 9) to beep + +>beep 9 +Beep number 1. +Beep number 2. +Beep number 3. +Beep number 4. +Beep number 5. +Beep number 6. +Beep number 7. +Beep number 8. +Beep number 9. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp b/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp new file mode 100644 index 00000000000..d933d3fdf50 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.beep2/CPP/b2.cpp @@ -0,0 +1,124 @@ + +// +// This example demonstrates the Console.Beep(Int32, Int32) method +using namespace System; +using namespace System::Threading; +ref class Sample +{ +protected: + + // Define the frequencies of notes in an octave, as well as + // silence (rest). + enum class Tone + { + REST = 0, + GbelowC = 196, + A = 220, + Asharp = 233, + B = 247, + C = 262, + Csharp = 277, + D = 294, + Dsharp = 311, + E = 330, + F = 349, + Fsharp = 370, + G = 392, + Gsharp = 415 + }; + + + // Define the duration of a note in units of milliseconds. + enum class Duration + { + WHOLE = 1600, + HALF = Duration::WHOLE / 2, + QUARTER = Duration::HALF / 2, + EIGHTH = Duration::QUARTER / 2, + SIXTEENTH = Duration::EIGHTH / 2 + }; + + +public: + + // Define a note as a frequency (tone) and the amount of + // time (duration) the note plays. + value struct Note + { + public: + Tone toneVal; + Duration durVal; + + // Define a constructor to create a specific note. + Note( Tone frequency, Duration time ) + { + toneVal = frequency; + durVal = time; + } + + + property Tone NoteTone + { + + // Define properties to return the note's tone and duration. + Tone get() + { + return toneVal; + } + + } + + property Duration NoteDuration + { + Duration get() + { + return durVal; + } + + } + + }; + + +protected: + + // Play the notes in a song. + static void Play( array^ tune ) + { + System::Collections::IEnumerator^ myEnum = tune->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Note n = *safe_cast(myEnum->Current); + if ( n.NoteTone == Tone::REST ) + Thread::Sleep( (int)n.NoteDuration ); + else + Console::Beep( (int)n.NoteTone, (int)n.NoteDuration ); + } + } + + +public: + static void Main() + { + + // Declare the first few notes of the song, "Mary Had A Little Lamb". + array^ Mary = {Note( Tone::B, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::GbelowC, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::QUARTER ),Note( Tone::B, Duration::HALF ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::QUARTER ),Note( Tone::A, Duration::HALF ),Note( Tone::B, Duration::QUARTER ),Note( Tone::D, Duration::QUARTER ),Note( Tone::D, Duration::HALF )}; + + // Play the song + Play( Mary ); + } + +}; + +int main() +{ + Sample::Main(); +} + +/* +This example produces the following results: + +This example plays the first few notes of "Mary Had A Little Lamb" +through the console speaker. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp b/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp new file mode 100644 index 00000000000..75f186ab055 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.bufferHW/CPP/hw.cpp @@ -0,0 +1,18 @@ + +// +// This example demonstrates the Console.BufferHeight and +// Console.BufferWidth properties. +using namespace System; +int main() +{ + Console::WriteLine( "The current buffer height is {0} rows.", Console::BufferHeight ); + Console::WriteLine( "The current buffer width is {0} columns.", Console::BufferWidth ); +} + +/* +This example produces the following results: + +The current buffer height is 300 rows. +The current buffer width is 85 columns. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp b/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp new file mode 100644 index 00000000000..4ad4c4573e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.cancelkeypress/cpp/ckp.cpp @@ -0,0 +1,74 @@ +// +using namespace System; + +void OnCancelKeyPressed(Object^ sender, + ConsoleCancelEventArgs^ args) +{ + Console::WriteLine("{0}The read operation has been interrupted.", + Environment::NewLine); + + Console::WriteLine(" Key pressed: {0}", args->SpecialKey); + + Console::WriteLine(" Cancel property: {0}", args->Cancel); + + // Set the Cancel property to true to prevent the process from + // terminating. + Console::WriteLine("Setting the Cancel property to true..."); + args->Cancel = true; + + // Announce the new value of the Cancel property. + Console::WriteLine(" Cancel property: {0}", args->Cancel); + Console::WriteLine("The read operation will resume...{0}", + Environment::NewLine); +} + +int main() +{ + // Clear the screen. + Console::Clear(); + + // Establish an event handler to process key press events. + Console::CancelKeyPress += + gcnew ConsoleCancelEventHandler(OnCancelKeyPressed); + + while (true) + { + // Prompt the user. + Console::Write("Press any key, or 'X' to quit, or "); + Console::WriteLine("CTRL+C to interrupt the read operation:"); + + // Start a console read operation. Do not display the input. + ConsoleKeyInfo^ keyInfo = Console::ReadKey(true); + + // Announce the name of the key that was pressed . + Console::WriteLine(" Key pressed: {0}{1}", keyInfo->Key, + Environment::NewLine); + + // Exit if the user pressed the 'X' key. + if (keyInfo->Key == ConsoleKey::X) + { + break; + } + } +} +// The example displays output similar to the following: +// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: +// Key pressed: J +// +// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: +// Key pressed: Enter +// +// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: +// +// The read operation has been interrupted. +// Key pressed: ControlC +// Cancel property: False +// Setting the Cancel property to true... +// Cancel property: True +// The read operation will resume... +// +// Key pressed: Q +// +// Press any key, or 'X' to quit, or CTRL+C to interrupt the read operation: +// Key pressed: X +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp new file mode 100644 index 00000000000..fb1544c6848 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.cursorLTS/CPP/lts.cpp @@ -0,0 +1,75 @@ + +// +// This example demonstrates the +// Console.CursorLeft and +// Console.CursorTop properties, and the +// Console.SetCursorPosition and +// Console.Clear methods. +using namespace System; +int origRow; +int origCol; +void WriteAt( String^ s, int x, int y ) +{ + try + { + Console::SetCursorPosition( origCol + x, origRow + y ); + Console::Write( s ); + } + catch ( ArgumentOutOfRangeException^ e ) + { + Console::Clear(); + Console::WriteLine( e->Message ); + } + +} + +int main() +{ + + // Clear the screen, then save the top and left coordinates. + Console::Clear(); + origRow = Console::CursorTop; + origCol = Console::CursorLeft; + + // Draw the left side of a 5x5 rectangle, from top to bottom. + WriteAt( "+", 0, 0 ); + WriteAt( "|", 0, 1 ); + WriteAt( "|", 0, 2 ); + WriteAt( "|", 0, 3 ); + WriteAt( "+", 0, 4 ); + + // Draw the bottom side, from left to right. + WriteAt( "-", 1, 4 ); // shortcut: WriteAt("---", 1, 4) + WriteAt( "-", 2, 4 ); // ... + WriteAt( "-", 3, 4 ); // ... + WriteAt( "+", 4, 4 ); + + // Draw the right side, from bottom to top. + WriteAt( "|", 4, 3 ); + WriteAt( "|", 4, 2 ); + WriteAt( "|", 4, 1 ); + WriteAt( "+", 4, 0 ); + + // Draw the top side, from right to left. + WriteAt( "-", 3, 0 ); // shortcut: WriteAt("---", 1, 0) + WriteAt( "-", 2, 0 ); // ... + WriteAt( "-", 1, 0 ); // ... + + // + WriteAt( "All done!", 0, 6 ); + Console::WriteLine(); +} + +/* +This example produces the following results: + ++---+ +| | +| | +| | ++---+ + +All done! + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp new file mode 100644 index 00000000000..d04872cd7db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.cursorsize/CPP/csize.cpp @@ -0,0 +1,45 @@ + +// +// This example demonstrates the Console.CursorSize property. +using namespace System; +int main() +{ + String^ m0 = "This example increments the cursor size from 1% to 100%:\n"; + String^ m1 = "Cursor size = {0}%. (Press any key to continue...)"; + array^sizes = {1,10,20,30,40,50,60,70,80,90,100}; + int saveCursorSize; + + // + saveCursorSize = Console::CursorSize; + Console::WriteLine( m0 ); + System::Collections::IEnumerator^ myEnum = sizes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + int size = *safe_cast(myEnum->Current); + Console::CursorSize = size; + Console::WriteLine( m1, size ); + Console::ReadKey(); + } + + Console::CursorSize = saveCursorSize; +} + +/* +This example produces the following results: + +This example increments the cursor size from 1% to 100%: + +Cursor size = 1%. (Press any key to continue...) +Cursor size = 10%. (Press any key to continue...) +Cursor size = 20%. (Press any key to continue...) +Cursor size = 30%. (Press any key to continue...) +Cursor size = 40%. (Press any key to continue...) +Cursor size = 50%. (Press any key to continue...) +Cursor size = 60%. (Press any key to continue...) +Cursor size = 70%. (Press any key to continue...) +Cursor size = 80%. (Press any key to continue...) +Cursor size = 90%. (Press any key to continue...) +Cursor size = 100%. (Press any key to continue...) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp new file mode 100644 index 00000000000..bf60e0028a7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.cursorvis/CPP/vis.cpp @@ -0,0 +1,75 @@ +// +// This example demonstrates the Console.CursorVisible property. +using namespace System; + +int main() +{ + String^ m1 = "\nThe cursor is {0}.\nType any text then press Enter. " + "Type '+' in the first column to show \n" + "the cursor, '-' to hide the cursor, " + "or lowercase 'x' to quit:"; + String^ s; + bool saveCursorVisibile; + int saveCursorSize; + + // + Console::CursorVisible = true; // Initialize the cursor to visible. + saveCursorVisibile = Console::CursorVisible; + saveCursorSize = Console::CursorSize; + Console::CursorSize = 100; // Emphasize the cursor. + for ( ; ; ) + { + Console::WriteLine( m1, ((Console::CursorVisible == true) ? (String^)"VISIBLE" : "HIDDEN") ); + s = Console::ReadLine(); + if ( !String::IsNullOrEmpty( s ) ) + if ( s[ 0 ] == '+' ) + Console::CursorVisible = true; + else + if ( s[ 0 ] == '-' ) + Console::CursorVisible = false; + else + if ( s[ 0 ] == 'x' ) + break; + + } + Console::CursorVisible = saveCursorVisibile; + Console::CursorSize = saveCursorSize; +} + +/* +This example produces the following results. Note that these results +cannot depict cursor visibility. You must run the example to see the +cursor behavior: + +The cursor is VISIBLE. +Type any text then press Enter. Type '+' in the first column to show +the cursor, '-' to hide the cursor, or lowercase 'x' to quit: +The quick brown fox + +The cursor is VISIBLE. +Type any text then press Enter. Type '+' in the first column to show +the cursor, '-' to hide the cursor, or lowercase 'x' to quit: +- + +The cursor is HIDDEN. +Type any text then press Enter. Type '+' in the first column to show +the cursor, '-' to hide the cursor, or lowercase 'x' to quit: +jumps over + +The cursor is HIDDEN. +Type any text then press Enter. Type '+' in the first column to show +the cursor, '-' to hide the cursor, or lowercase 'x' to quit: ++ + +The cursor is VISIBLE. +Type any text then press Enter. Type '+' in the first column to show +the cursor, '-' to hide the cursor, or lowercase 'x' to quit: +the lazy dog. + +The cursor is VISIBLE. +Type any text then press Enter. Type '+' in the first column to show +the cursor, '-' to hide the cursor, or lowercase 'x' to quit: +x + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp new file mode 100644 index 00000000000..8b8f1a06db8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.keyavailable/CPP/ka.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; +using namespace System::Threading; +int main() +{ + ConsoleKeyInfo cki; + do + { + Console::WriteLine( "\nPress a key to display; press the 'x' key to quit." ); + + // Your code could perform some useful task in the following loop. However, + // for the sake of this example we'll merely pause for a quarter second. + while ( !Console::KeyAvailable ) + Thread::Sleep( 250 ); + cki = Console::ReadKey( true ); + Console::WriteLine( "You pressed the '{0}' key.", cki.Key ); + } + while ( cki.Key != ConsoleKey::X ); +} + +/* +This example produces results similar to the following: + +Press a key to display; press the 'x' key to quit. +You pressed the 'H' key. + +Press a key to display; press the 'x' key to quit. +You pressed the 'E' key. + +Press a key to display; press the 'x' key to quit. +You pressed the 'PageUp' key. + +Press a key to display; press the 'x' key to quit. +You pressed the 'DownArrow' key. + +Press a key to display; press the 'x' key to quit. +You pressed the 'X' key. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp b/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp new file mode 100644 index 00000000000..fa7edff4517 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.read/CPP/read.cpp @@ -0,0 +1,82 @@ + +// +// This example demonstrates the Console.Read() method. +using namespace System; +int main() +{ + String^ m1 = "\nType a string of text then press Enter. " + "Type '+' anywhere in the text to quit:\n"; + String^ m2 = "Character '{0}' is hexadecimal 0x{1:x4}."; + String^ m3 = "Character is hexadecimal 0x{0:x4}."; + Char ch; + int x; + + // + Console::WriteLine( m1 ); + do + { + x = Console::Read(); + try + { + ch = Convert::ToChar( x ); + if ( Char::IsWhiteSpace( ch ) ) + { + Console::WriteLine( m3, x ); + if ( ch == 0x0a ) + Console::WriteLine( m1 ); + } + else + Console::WriteLine( m2, ch, x ); + } + catch ( OverflowException^ e ) + { + Console::WriteLine( "{0} Value read = {1}.", e->Message, x ); + ch = Char::MinValue; + Console::WriteLine( m1 ); + } + + } + while ( ch != '+' ); +} + +/* +This example produces the following results: + +Type a string of text then press Enter. Type '+' anywhere in the text to quit: + +The quick brown fox. +Character 'T' is hexadecimal 0x0054. +Character 'h' is hexadecimal 0x0068. +Character 'e' is hexadecimal 0x0065. +Character is hexadecimal 0x0020. +Character 'q' is hexadecimal 0x0071. +Character 'u' is hexadecimal 0x0075. +Character 'i' is hexadecimal 0x0069. +Character 'c' is hexadecimal 0x0063. +Character 'k' is hexadecimal 0x006b. +Character is hexadecimal 0x0020. +Character 'b' is hexadecimal 0x0062. +Character 'r' is hexadecimal 0x0072. +Character 'o' is hexadecimal 0x006f. +Character 'w' is hexadecimal 0x0077. +Character 'n' is hexadecimal 0x006e. +Character is hexadecimal 0x0020. +Character 'f' is hexadecimal 0x0066. +Character 'o' is hexadecimal 0x006f. +Character 'x' is hexadecimal 0x0078. +Character '.' is hexadecimal 0x002e. +Character is hexadecimal 0x000d. +Character is hexadecimal 0x000a. + +Type a string of text then press Enter. Type '+' anywhere in the text to quit: + +^Z +Value was either too large or too small for a character. Value read = -1. + +Type a string of text then press Enter. Type '+' anywhere in the text to quit: + ++ +Character '+' is hexadecimal 0x002b. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp new file mode 100644 index 00000000000..d2f1a175be4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.readkey1/CPP/rk.cpp @@ -0,0 +1,37 @@ +// Console.ReadKey.cpp : main project file. + +// +using namespace System; + +void main() +{ + ConsoleKeyInfo cki; + // Prevent example from ending if CTL+C is pressed. + Console::TreatControlCAsInput = true; + + Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key."); + Console::WriteLine("Press the Escape (Esc) key to quit: \n"); + do + { + cki = Console::ReadKey(); + Console::Write(" --- You pressed "); + if((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+"); + if((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+"); + if((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+"); + Console::WriteLine(cki.Key.ToString()); + } while (cki.Key != ConsoleKey::Escape); +} +// This example displays output similar to the following: +// Press any combination of CTL, ALT, and SHIFT, and a console key. +// Press the Escape (Esc) key to quit: +// +// a --- You pressed A +// k --- You pressed ALT+K +// â–º --- You pressed CTL+P +// --- You pressed RightArrow +// R --- You pressed SHIFT+R +// --- You pressed CTL+I +// j --- You pressed ALT+J +// O --- You pressed SHIFT+O +// § --- You pressed CTL+U } +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp b/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp new file mode 100644 index 00000000000..f354fdf3929 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.readkey2/CPP/rkbool.cpp @@ -0,0 +1,35 @@ +// Console.ReadKey2.cpp : main project file. + +// +using namespace System; + +void main() +{ + ConsoleKeyInfo cki; + // Prevent example from ending if CTL+C is pressed. + Console::TreatControlCAsInput = true; + + Console::WriteLine("Press any combination of CTL, ALT, and SHIFT, and a console key."); + Console::WriteLine("Press the Escape (Esc) key to quit: \n"); + do { + cki = Console::ReadKey(true); + Console::Write("You pressed "); + if ((cki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) Console::Write("ALT+"); + if ((cki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) Console::Write("SHIFT+"); + if ((cki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) Console::Write("CTL+"); + Console::WriteLine("{0} (character '{1}')", cki.Key, cki.KeyChar); + } while (cki.Key != ConsoleKey::Escape); +} +// This example displays output similar to the following: +// Press any combination of CTL, ALT, and SHIFT, and a console key. +// Press the Escape (Esc) key to quit: +// +// You pressed CTL+A (character '☺') +// You pressed C (character 'c') +// You pressed CTL+C (character '♥') +// You pressed K (character 'k') +// You pressed ALT+I (character 'i') +// You pressed ALT+U (character 'u') +// You pressed ALT+SHIFT+H (character 'H') +// You pressed Escape (character 'â†') +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp b/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp new file mode 100644 index 00000000000..074acc11362 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.setwindowsize/CPP/sws.cpp @@ -0,0 +1,55 @@ + +// +// This example demonstrates the Console.SetWindowSize method, +// the Console.WindowWidth property, +// and the Console.WindowHeight property. +using namespace System; +int main() +{ + int origWidth; + int width; + int origHeight; + int height; + String^ m1 = "The current window width is {0}, and the " + "current window height is {1}."; + String^ m2 = "The new window width is {0}, and the new " + "window height is {1}."; + String^ m4 = " (Press any key to continue...)"; + + // + // Step 1: Get the current window dimensions. + // + origWidth = Console::WindowWidth; + origHeight = Console::WindowHeight; + Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight ); + Console::WriteLine( m4 ); + Console::ReadKey( true ); + + // + // Step 2: Cut the window to 1/4 its original size. + // + width = origWidth / 2; + height = origHeight / 2; + Console::SetWindowSize( width, height ); + Console::WriteLine( m2, Console::WindowWidth, Console::WindowHeight ); + Console::WriteLine( m4 ); + Console::ReadKey( true ); + + // + // Step 3: Restore the window to its original size. + // + Console::SetWindowSize( origWidth, origHeight ); + Console::WriteLine( m1, Console::WindowWidth, Console::WindowHeight ); +} + +/* +This example produces the following results: + +The current window width is 85, and the current window height is 43. + (Press any key to continue...) +The new window width is 42, and the new window height is 21. + (Press any key to continue...) +The current window width is 85, and the current window height is 43. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp b/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp new file mode 100644 index 00000000000..9fd1a51bc1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.title/CPP/mytitle.cpp @@ -0,0 +1,26 @@ + +// +// This example demonstrates the Console.Title property. +using namespace System; +int main() +{ + Console::WriteLine( "The current console title is: \"{0}\"", Console::Title ); + Console::WriteLine( " (Press any key to change the console title.)" ); + Console::ReadKey( true ); + Console::Title = "The title has changed!"; + Console::WriteLine( "Note that the new console title is \"{0}\"\n" + " (Press any key to quit.)", Console::Title ); + Console::ReadKey( true ); +} + +/* +This example produces the following results: + +>myTitle +The current console title is: "Command Prompt - myTitle" + (Press any key to change the console title.) +Note that the new console title is "The title has changed!" + (Press any key to quit.) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp b/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp new file mode 100644 index 00000000000..cb5364bab15 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.windowLT/CPP/wlt.cpp @@ -0,0 +1,135 @@ + +// +// This example demonstrates the Console.WindowLeft and +// Console.WindowTop properties. +using namespace System; +using namespace System::Text; +using namespace System::IO; + +// +int saveBufferWidth; +int saveBufferHeight; +int saveWindowHeight; +int saveWindowWidth; +bool saveCursorVisible; + +// +int main() +{ + String^ m1 = "1) Press the cursor keys to move the console window.\n" + "2) Press any key to begin. When you're finished...\n" + "3) Press the Escape key to quit."; + String^ g1 = "+----"; + String^ g2 = "| "; + String^ grid1; + String^ grid2; + StringBuilder^ sbG1 = gcnew StringBuilder; + StringBuilder^ sbG2 = gcnew StringBuilder; + ConsoleKeyInfo cki; + int y; + + // + try + { + saveBufferWidth = Console::BufferWidth; + saveBufferHeight = Console::BufferHeight; + saveWindowHeight = Console::WindowHeight; + saveWindowWidth = Console::WindowWidth; + saveCursorVisible = Console::CursorVisible; + + // + Console::Clear(); + Console::WriteLine( m1 ); + Console::ReadKey( true ); + + // Set the smallest possible window size before setting the buffer size. + Console::SetWindowSize( 1, 1 ); + Console::SetBufferSize( 80, 80 ); + Console::SetWindowSize( 40, 20 ); + + // Create grid lines to fit the buffer. (The buffer width is 80, but + // this same technique could be used with an arbitrary buffer width.) + for ( y = 0; y < Console::BufferWidth / g1->Length; y++ ) + { + sbG1->Append( g1 ); + sbG2->Append( g2 ); + + } + sbG1->Append( g1, 0, Console::BufferWidth % g1->Length ); + sbG2->Append( g2, 0, Console::BufferWidth % g2->Length ); + grid1 = sbG1->ToString(); + grid2 = sbG2->ToString(); + Console::CursorVisible = false; + Console::Clear(); + for ( y = 0; y < Console::BufferHeight - 1; y++ ) + { + if ( y % 3 == 0 ) + Console::Write( grid1 ); + else + Console::Write( grid2 ); + + } + Console::SetWindowPosition( 0, 0 ); + do + { + cki = Console::ReadKey( true ); + switch ( cki.Key ) + { + case ConsoleKey::LeftArrow: + if ( Console::WindowLeft > 0 ) + Console::SetWindowPosition( Console::WindowLeft - 1, Console::WindowTop ); + break; + + case ConsoleKey::UpArrow: + if ( Console::WindowTop > 0 ) + Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop - 1 ); + break; + + case ConsoleKey::RightArrow: + if ( Console::WindowLeft < (Console::BufferWidth - Console::WindowWidth) ) + Console::SetWindowPosition( Console::WindowLeft + 1, Console::WindowTop ); + break; + + case ConsoleKey::DownArrow: + if ( Console::WindowTop < (Console::BufferHeight - Console::WindowHeight) ) + Console::SetWindowPosition( Console::WindowLeft, Console::WindowTop + 1 ); + break; + } + } + while ( cki.Key != ConsoleKey::Escape ); + } + catch ( IOException^ e ) + { + Console::WriteLine( e->Message ); + } + finally + { + Console::Clear(); + Console::SetWindowSize( 1, 1 ); + Console::SetBufferSize( saveBufferWidth, saveBufferHeight ); + Console::SetWindowSize( saveWindowWidth, saveWindowHeight ); + Console::CursorVisible = saveCursorVisible; + } + +} // end Main + + +/* +This example produces results similar to the following: + +1) Press the cursor keys to move the console window. +2) Press any key to begin. When you're finished... +3) Press the Escape key to quit. + +... + ++----+----+----+- +| | | | +| | | | ++----+----+----+- +| | | | +| | | | ++----+----+----+- + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp b/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp new file mode 100644 index 00000000000..b31dd5edc66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/console.writelineFmt1/cpp/wl.cpp @@ -0,0 +1,102 @@ +// +// This code example demonstrates the Console.WriteLine() method. +// Formatting for this example uses the "en-US" culture. + +using namespace System; + +public enum class Color {Yellow = 1, Blue, Green}; + +int main() +{ + DateTime thisDate = DateTime::Now; + Console::Clear(); + + // Format a negative integer or floating-point number in various ways. + Console::WriteLine("Standard Numeric Format Specifiers"); + Console::WriteLine( + "(C) Currency: . . . . . . . . {0:C}\n" + + "(D) Decimal:. . . . . . . . . {0:D}\n" + + "(E) Scientific: . . . . . . . {1:E}\n" + + "(F) Fixed point:. . . . . . . {1:F}\n" + + "(G) General:. . . . . . . . . {0:G}\n" + + " (default):. . . . . . . . {0} (default = 'G')\n" + + "(N) Number: . . . . . . . . . {0:N}\n" + + "(P) Percent:. . . . . . . . . {1:P}\n" + + "(R) Round-trip: . . . . . . . {1:R}\n" + + "(X) Hexadecimal:. . . . . . . {0:X}\n", + -123, -123.45f); + + // Format the current date in various ways. + Console::WriteLine("Standard DateTime Format Specifiers"); + Console::WriteLine( + "(d) Short date: . . . . . . . {0:d}\n" + + "(D) Long date:. . . . . . . . {0:D}\n" + + "(t) Short time: . . . . . . . {0:t}\n" + + "(T) Long time:. . . . . . . . {0:T}\n" + + "(f) Full date/short time: . . {0:f}\n" + + "(F) Full date/long time:. . . {0:F}\n" + + "(g) General date/short time:. {0:g}\n" + + "(G) General date/long time: . {0:G}\n" + + " (default):. . . . . . . . {0} (default = 'G')\n" + + "(M) Month:. . . . . . . . . . {0:M}\n" + + "(R) RFC1123:. . . . . . . . . {0:R}\n" + + "(s) Sortable: . . . . . . . . {0:s}\n" + + "(u) Universal sortable: . . . {0:u} (invariant)\n" + + "(U) Universal full date/time: {0:U}\n" + + "(Y) Year: . . . . . . . . . . {0:Y}\n", + thisDate); + + // Format a Color enumeration value in various ways. + Console::WriteLine("Standard Enumeration Format Specifiers"); + Console::WriteLine( + "(G) General:. . . . . . . . . {0:G}\n" + + " (default):. . . . . . . . {0} (default = 'G')\n" + + "(F) Flags:. . . . . . . . . . {0:F} (flags or integer)\n" + + "(D) Decimal number: . . . . . {0:D}\n" + + "(X) Hexadecimal:. . . . . . . {0:X}\n", + Color::Green); + +}; + + +/* +This code example produces the following results: + +Standard Numeric Format Specifiers +(C) Currency: . . . . . . . . ($123.00) +(D) Decimal:. . . . . . . . . -123 +(E) Scientific: . . . . . . . -1.234500E+002 +(F) Fixed point:. . . . . . . -123.45 +(G) General:. . . . . . . . . -123 +(default):. . . . . . . . -123 (default = 'G') +(N) Number: . . . . . . . . . -123.00 +(P) Percent:. . . . . . . . . -12,345.00 % +(R) Round-trip: . . . . . . . -123.45 +(X) Hexadecimal:. . . . . . . FFFFFF85 + +Standard DateTime Format Specifiers +(d) Short date: . . . . . . . 6/26/2004 +(D) Long date:. . . . . . . . Saturday, June 26, 2004 +(t) Short time: . . . . . . . 8:11 PM +(T) Long time:. . . . . . . . 8:11:04 PM +(f) Full date/short time: . . Saturday, June 26, 2004 8:11 PM +(F) Full date/long time:. . . Saturday, June 26, 2004 8:11:04 PM +(g) General date/short time:. 6/26/2004 8:11 PM +(G) General date/long time: . 6/26/2004 8:11:04 PM +(default):. . . . . . . . 6/26/2004 8:11:04 PM (default = 'G') +(M) Month:. . . . . . . . . . June 26 +(R) RFC1123:. . . . . . . . . Sat, 26 Jun 2004 20:11:04 GMT +(s) Sortable: . . . . . . . . 2004-06-26T20:11:04 +(u) Universal sortable: . . . 2004-06-26 20:11:04Z (invariant) +(U) Universal full date/time: Sunday, June 27, 2004 3:11:04 AM +(Y) Year: . . . . . . . . . . June, 2004 + +Standard Enumeration Format Specifiers +(G) General:. . . . . . . . . Green +(default):. . . . . . . . Green (default = 'G') +(F) Flags:. . . . . . . . . . Green (flags or integer) +(D) Decimal number: . . . . . 3 +(X) Hexadecimal:. . . . . . . 00000003 + +*/ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp b/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp new file mode 100644 index 00000000000..528816ff13d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/consolein/CPP/consolein.cpp @@ -0,0 +1,15 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + TextReader^ tIn = Console::In; + TextWriter^ tOut = Console::Out; + tOut->WriteLine( "Hola Mundo!" ); + tOut->Write( "What is your name: " ); + String^ name = tIn->ReadLine(); + tOut->WriteLine( "Buenos Dias, {0}!", name ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp new file mode 100644 index 00000000000..a876518582c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/convert.tobase64chararray/CPP/tb64ca.cpp @@ -0,0 +1,100 @@ + +// +// This example demonstrates the Convert.ToBase64CharArray() and +// Convert.FromBase64CharArray methods +using namespace System; +bool ArraysAreEqual( array^a1, array^a2 ); +int main() +{ + array^byteArray1 = gcnew array(256); + array^byteArray2 = gcnew array(256); + array^charArray = gcnew array(352); + int charArrayLength; + String^ nl = Environment::NewLine; + String^ ruler1a = " 1 2 3 4"; + String^ ruler2a = "1234567890123456789012345678901234567890"; + String^ ruler3a = "----+----+----+----+----+----+----+----+"; + String^ ruler1b = " 5 6 7 "; + String^ ruler2b = "123456789012345678901234567890123456"; + String^ ruler3b = "----+----+----+----+----+----+----+-"; + String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b ); + + // 1) Initialize and display a Byte array of arbitrary data. + Console::WriteLine( "1) Input: A Byte array of arbitrary data.{0}", nl ); + for ( int x = 0; x < byteArray1->Length; x++ ) + { + byteArray1[ x ] = (Byte)x; + Console::Write( "{0:X2} ", byteArray1[ x ] ); + if ( ((x + 1) % 20) == 0 ) + Console::WriteLine(); + + } + Console::Write( "{0}{0}", nl ); + + // 2) Convert the input Byte array to a Char array, with newlines inserted. + charArrayLength = Convert::ToBase64CharArray( byteArray1, 0, byteArray1->Length, + charArray, 0, + Base64FormattingOptions::InsertLineBreaks ); + Console::WriteLine( "2) Convert the input Byte array to a Char array with newlines." ); + Console::Write( " Output: A Char array (length = {0}). ", charArrayLength ); + Console::WriteLine( "The elements of the array are:{0}", nl ); + Console::WriteLine( ruler ); + Console::WriteLine( gcnew String( charArray ) ); + Console::WriteLine(); + + // 3) Convert the Char array back to a Byte array. + Console::WriteLine( "3) Convert the Char array to an output Byte array." ); + byteArray2 = Convert::FromBase64CharArray( charArray, 0, charArrayLength ); + + // 4) Are the input and output Byte arrays equivalent? + Console::WriteLine( "4) The output Byte array is equal to the input Byte array: {0}", ArraysAreEqual( byteArray1, byteArray2 ) ); +} + +bool ArraysAreEqual( array^a1, array^a2 ) +{ + if ( a1->Length != a2->Length ) + return false; + + for ( int i = 0; i < a1->Length; i++ ) + if ( a1[ i ] != a2[ i ] ) + return false; + + return true; +} + +/* +This example produces the following results: + +1) Input: A Byte array of arbitrary data. + +00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 +14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 +28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B +3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F +50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 +64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 +78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B +8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F +A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 +B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 +C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB +DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF +F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + +2) Convert the input Byte array to a Char array with newlines. + Output: A Char array (length = 352). The elements of the array are: + + 1 2 3 4 5 6 7 +1234567890123456789012345678901234567890123456789012345678901234567890123456 +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+- +AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4 +OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx +cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq +q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj +5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== + +3) Convert the Char array to an output Byte array. +4) The output Byte array is equal to the input Byte array: True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp b/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp new file mode 100644 index 00000000000..316e8eeab95 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/convert.tobase64string/CPP/tb64s.cpp @@ -0,0 +1,113 @@ + +// +// This example demonstrates the Convert.ToBase64String() and +// Convert.FromBase64String() methods +using namespace System; +bool ArraysAreEqual( array^a1, array^a2 ); +int main() +{ + array^inArray = gcnew array(256); + array^outArray = gcnew array(256); + String^ s2; + String^ s3; + String^ step1 = "1) The input is a byte array (inArray) of arbitrary data."; + String^ step2 = "2) Convert a subarray of the input data array to a base 64 string."; + String^ step3 = "3) Convert the entire input data array to a base 64 string."; + String^ step4 = "4) The two methods in steps 2 and 3 produce the same result: {0}"; + String^ step5 = "5) Convert the base 64 string to an output byte array (outArray)."; + String^ step6 = "6) The input and output arrays, inArray and outArray, are equal: {0}"; + int x; + String^ nl = Environment::NewLine; + String^ ruler1a = " 1 2 3 4"; + String^ ruler2a = "1234567890123456789012345678901234567890"; + String^ ruler3a = "----+----+----+----+----+----+----+----+"; + String^ ruler1b = " 5 6 7 "; + String^ ruler2b = "123456789012345678901234567890123456"; + String^ ruler3b = "----+----+----+----+----+----+----+-"; + String^ ruler = String::Concat( ruler1a, ruler1b, nl, ruler2a, ruler2b, nl, ruler3a, ruler3b, nl ); + + // 1) Display an arbitrary array of input data (inArray). The data could be + // derived from user input, a file, an algorithm, etc. + Console::WriteLine( step1 ); + Console::WriteLine(); + for ( x = 0; x < inArray->Length; x++ ) + { + inArray[ x ] = (Byte)x; + Console::Write( "{0:X2} ", inArray[ x ] ); + if ( ((x + 1) % 20) == 0 ) + Console::WriteLine(); + + } + Console::Write( "{0}{0}", nl ); + + // 2) Convert a subarray of the input data to a base64 string. In this case, + // the subarray is the entire input data array. New lines (CRLF) are inserted. + Console::WriteLine( step2 ); + s2 = Convert::ToBase64String( inArray, 0, inArray->Length, Base64FormattingOptions::InsertLineBreaks ); + Console::WriteLine( "{0}{1}{2}{3}", nl, ruler, s2, nl ); + + // 3) Convert the input data to a base64 string. In this case, the entire + // input data array is converted by default. New lines (CRLF) are inserted. + Console::WriteLine( step3 ); + s3 = Convert::ToBase64String( inArray, Base64FormattingOptions::InsertLineBreaks ); + + // 4) Test whether the methods in steps 2 and 3 produce the same result. + Console::WriteLine( step4, s2->Equals( s3 ) ); + + // 5) Convert the base 64 string to an output array (outArray). + Console::WriteLine( step5 ); + outArray = Convert::FromBase64String( s2 ); + + // 6) Is outArray equal to inArray? + Console::WriteLine( step6, ArraysAreEqual( inArray, outArray ) ); +} + +bool ArraysAreEqual( array^a1, array^a2 ) +{ + if ( a1->Length != a2->Length ) + return false; + + for ( int i = 0; i < a1->Length; i++ ) + if ( a1[ i ] != a2[ i ] ) + return false; + + return true; +} + +/* +This example produces the following results: + +1) The input is a byte array (inArray) of arbitrary data. + +00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 10 11 12 13 +14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 +28 29 2A 2B 2C 2D 2E 2F 30 31 32 33 34 35 36 37 38 39 3A 3B +3C 3D 3E 3F 40 41 42 43 44 45 46 47 48 49 4A 4B 4C 4D 4E 4F +50 51 52 53 54 55 56 57 58 59 5A 5B 5C 5D 5E 5F 60 61 62 63 +64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 +78 79 7A 7B 7C 7D 7E 7F 80 81 82 83 84 85 86 87 88 89 8A 8B +8C 8D 8E 8F 90 91 92 93 94 95 96 97 98 99 9A 9B 9C 9D 9E 9F +A0 A1 A2 A3 A4 A5 A6 A7 A8 A9 AA AB AC AD AE AF B0 B1 B2 B3 +B4 B5 B6 B7 B8 B9 BA BB BC BD BE BF C0 C1 C2 C3 C4 C5 C6 C7 +C8 C9 CA CB CC CD CE CF D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 DA DB +DC DD DE DF E0 E1 E2 E3 E4 E5 E6 E7 E8 E9 EA EB EC ED EE EF +F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 FA FB FC FD FE FF + +2) Convert a subarray of the input data array to a base 64 string. + + 1 2 3 4 5 6 7 +1234567890123456789012345678901234567890123456789012345678901234567890123456 +----+----+----+----+----+----+----+----+----+----+----+----+----+----+----+- +AAECAwQFBgcICQoLDA0ODxAREhMUFRYXGBkaGxwdHh8gISIjJCUmJygpKissLS4vMDEyMzQ1Njc4 +OTo7PD0+P0BBQkNERUZHSElKS0xNTk9QUVJTVFVWV1hZWltcXV5fYGFiY2RlZmdoaWprbG1ub3Bx +cnN0dXZ3eHl6e3x9fn+AgYKDhIWGh4iJiouMjY6PkJGSk5SVlpeYmZqbnJ2en6ChoqOkpaanqKmq +q6ytrq+wsbKztLW2t7i5uru8vb6/wMHCw8TFxsfIycrLzM3Oz9DR0tPU1dbX2Nna29zd3t/g4eLj +5OXm5+jp6uvs7e7v8PHy8/T19vf4+fr7/P3+/w== + +3) Convert the entire input data array to a base 64 string. +4) The two methods in steps 2 and 3 produce the same result: True +5) Convert the base 64 string to an output byte array (outArray). +6) The input and output arrays, inArray and outArray, are equal: True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp b/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp new file mode 100644 index 00000000000..38f78b48eef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/convertchangetype/CPP/convertchangetype.cpp @@ -0,0 +1,14 @@ + +// +using namespace System; + +int main() +{ + Double d = -2.345; + int i = *safe_cast(Convert::ChangeType( d, int::typeid )); + Console::WriteLine( "The double value {0} when converted to an int becomes {1}", d, i ); + String^ s = "12/12/98"; + DateTime dt = *safe_cast(Convert::ChangeType( s, DateTime::typeid )); + Console::WriteLine( "The string value {0} when converted to a Date becomes {1}", s, dt ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp b/snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp new file mode 100644 index 00000000000..486c6233b75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/cryptgraphy.Xml.EncryptedData/cpp/encrypteddata.cpp @@ -0,0 +1,61 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::IO; + +/// This sample used the EncryptedData class to create a EncryptedData element +/// and write it to an XML file. +int main() +{ + // + // Create a new CipherData object. + CipherData^ cipher = gcnew CipherData(); + // Assign a byte array to be the CipherValue. This is a + // byte array representing encrypted data. + cipher->CipherValue = gcnew array(8); + // + // + // Create a new EncryptedData object. + EncryptedData^ encryptionRoot = gcnew EncryptedData(); + // + //Add an encryption method to the object. + encryptionRoot->Id = "ED"; + encryptionRoot->EncryptionMethod = gcnew EncryptionMethod( + "http://www.w3.org/2001/04/xmlenc#aes128-cbc"); + encryptionRoot->CipherData = cipher; + + //Add key information to the object. + KeyInfo^ keyDetails = gcnew KeyInfo(); + keyDetails->AddClause(gcnew KeyInfoRetrievalMethod("#EK", + "http://www.w3.org/2001/04/xmlenc#EncryptedKey")); + encryptionRoot->KeyInfo = keyDetails; + + // Create new XML document and put encrypted data into it. + XmlDocument^ doc = gcnew XmlDocument(); + XmlElement^ encryptionPropertyElement = + doc->CreateElement("EncryptionProperty", + EncryptedXml::XmlEncNamespaceUrl); + EncryptionProperty^ property = gcnew EncryptionProperty( + encryptionPropertyElement); + encryptionRoot->AddProperty(property); + + // Output the resulting XML information into a file. + String^ path = "test.xml"; + try + { + File::WriteAllText(path, encryptionRoot->GetXml()->OuterXml); + } + catch (IOException^ ex) + { + Console::WriteLine("There was an error writing to {0}", path); + Console::WriteLine(ex->Message); + } + //Console.WriteLine(ed.GetXml().OuterXml); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp new file mode 100644 index 00000000000..e1fe39c2ee1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.CipherReference/CPP/example.cpp @@ -0,0 +1,71 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography::Xml; +using namespace System::Xml; +using namespace System::IO; + +/// This sample used the EncryptedData class to create an encrypted data element +/// and write it to an XML file. It demonstrates the use of CipherReference. + +[STAThread] +int main() +{ + + //Create a URI string. + String^ uri = "http://www.woodgrovebank.com/document.xml"; + + // Create a Base64 transform. The input content retrieved from the + // URI should be Base64-decoded before other processing. + Transform^ base64 = gcnew XmlDsigBase64Transform; + + //Create a transform chain and add the transform to it. + TransformChain^ tc = gcnew TransformChain; + tc->Add( base64 ); + + //Create information. + CipherReference ^ reference = gcnew CipherReference( uri,tc ); + + // Create a new CipherData object using the CipherReference information. + // Note that you cannot assign both a CipherReference and a CipherValue + // to a CipherData object. + CipherData ^ cd = gcnew CipherData( reference ); + + // Create a new EncryptedData object. + EncryptedData^ ed = gcnew EncryptedData; + + //Add an encryption method to the object. + ed->Id = "ED"; + ed->EncryptionMethod = gcnew EncryptionMethod( "http://www.w3.org/2001/04/xmlenc#aes128-cbc" ); + ed->CipherData = cd; + + //Add key information to the object. + KeyInfo^ ki = gcnew KeyInfo; + ki->AddClause( gcnew KeyInfoRetrievalMethod( "#EK","http://www.w3.org/2001/04/xmlenc#EncryptedKey" ) ); + ed->KeyInfo = ki; + + // Create new XML document and put encrypted data into it. + XmlDocument^ doc = gcnew XmlDocument; + XmlElement^ encryptionPropertyElement = dynamic_cast(doc->CreateElement( "EncryptionProperty", EncryptedXml::XmlEncNamespaceUrl )); + EncryptionProperty ^ ep = gcnew EncryptionProperty( encryptionPropertyElement ); + ed->AddProperty( ep ); + + // Output the resulting XML information into a file. + try + { + String^ path = "c:\\test\\MyTest.xml"; + File::WriteAllText( path, ed->GetXml()->OuterXml ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "File IO error. {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp b/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp new file mode 100644 index 00000000000..a13819251ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/cryptography.Xml.EncryptedData2/CPP/encrypteddata.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography::Xml; +using namespace System::Xml; +using namespace System::IO; + +/// This sample used the EncryptedData class to create a EncryptedData element +/// and write it to an XML file. + +[STAThread] +int main() +{ + + // + // + // Create a new CipherData object using a byte array to represent encrypted data. + array^sampledata = gcnew array(8); + CipherData ^ cd = gcnew CipherData( sampledata ); + + // + // Create a new EncryptedData object. + EncryptedData^ ed = gcnew EncryptedData; + + //Add an encryption method to the object. + ed->Id = "ED"; + ed->EncryptionMethod = gcnew EncryptionMethod( "http://www.w3.org/2001/04/xmlenc#aes128-cbc" ); + ed->CipherData = cd; + + // + // + //Add key information to the object. + KeyInfo^ ki = gcnew KeyInfo; + ki->AddClause( gcnew KeyInfoRetrievalMethod( "#EK","http://www.w3.org/2001/04/xmlenc#EncryptedKey" ) ); + ed->KeyInfo = ki; + + // + // Create new XML document and put encrypted data into it. + XmlDocument^ doc = gcnew XmlDocument; + XmlElement^ encryptionPropertyElement = dynamic_cast(doc->CreateElement( "EncryptionProperty", EncryptedXml::XmlEncNamespaceUrl )); + EncryptionProperty ^ ep = gcnew EncryptionProperty( encryptionPropertyElement ); + ed->AddProperty( ep ); + + // Output the resulting XML information into a file. Change the path variable to point to a directory where + // the XML file should be written. + String^ path = "c:\\test\\MyTest.xml"; + File::WriteAllText( path, ed->GetXml()->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp b/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp new file mode 100644 index 00000000000..1e507f938a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/datetime.ctor_Int64/CPP/ticks.cpp @@ -0,0 +1,39 @@ + +// +// This example demonstrates the DateTime(Int64) constructor. +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Instead of using the implicit, default "G" date and time format string, we + // use a custom format string that aligns the results and inserts leading zeroes. + String^ format = "{0}) The {1} date and time is {2:MM/dd/yyyy hh:mm:ss tt}"; + + // Create a DateTime for the maximum date and time using ticks. + DateTime dt1 = DateTime(DateTime::MaxValue.Ticks); + + // Create a DateTime for the minimum date and time using ticks. + DateTime dt2 = DateTime(DateTime::MinValue.Ticks); + + // Create a custom DateTime for 7/28/1979 at 10:35:05 PM using a + // calendar based on the "en-US" culture, and ticks. + Int64 ticks = DateTime(1979,07,28,22,35,5,(gcnew CultureInfo( "en-US",false ))->Calendar).Ticks; + DateTime dt3 = DateTime(ticks); + Console::WriteLine( format, 1, "maximum", dt1 ); + Console::WriteLine( format, 2, "minimum", dt2 ); + Console::WriteLine( format, 3, "custom ", dt3 ); + Console::WriteLine( "\nThe custom date and time is created from {0:N0} ticks.", ticks ); +} + +/* +This example produces the following results: + +1) The maximum date and time is 12/31/9999 11:59:59 PM +2) The minimum date and time is 01/01/0001 12:00:00 AM +3) The custom date and time is 07/28/1979 10:35:05 PM + +The custom date and time is created from 624,376,461,050,000,000 ticks. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp new file mode 100644 index 00000000000..ab6a5a558b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/directoryinfocreatesub/CPP/directoryinfocreatesub.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Create a reference to a directory. + DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); + + // Create the directory only if it does not already exist. + if ( !di->Exists ) + di->Create(); + + + // Create a subdirectory in the directory just created. + DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); + + // Process that directory as required. + // ... + // Delete the subdirectory. + dis->Delete( true ); + + // Delete the directory. + di->Delete( true ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp new file mode 100644 index 00000000000..26deda48521 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/directoryinfodelete/CPP/directoryinfodelete.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Make a reference to a directory. + DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); + + // Create the directory only if it does not already exist. + if ( !di->Exists ) + di->Create(); + + + // Create a subdirectory in the directory just created. + DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); + + // Process that directory as required. + // ... + // Delete the subdirectory. The true indicates that if subdirectories + // or files are in this directory, they are to be deleted as well. + dis->Delete( true ); + + // Delete the directory. + di->Delete( true ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp new file mode 100644 index 00000000000..e9e232e4458 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/directoryinfogetdirectories/CPP/directoryinfogetdirectories.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Make a reference to a directory. + DirectoryInfo^ di = gcnew DirectoryInfo( "c:\\" ); + + // Get a reference to each directory in that directory. + array^diArr = di->GetDirectories(); + + // Display the names of the directories. + Collections::IEnumerator^ myEnum = diArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DirectoryInfo^ dri = safe_cast(myEnum->Current); + Console::WriteLine( dri->Name ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp new file mode 100644 index 00000000000..3acf01cd274 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/directoryinfomoveto/CPP/directoryinfomoveto.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Make a reference to a directory. + DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); + + // Create the directory only if it does not already exist. + if ( !di->Exists ) + di->Create(); + + + // Create a subdirectory in the directory just created. + DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); + + // Move the main directory. Note that the contents move with the directory. + if ( !Directory::Exists( "NewTempDir" ) ) + di->MoveTo( "NewTempDir" ); + + try + { + + // Attempt to delete the subdirectory. Note that because it has been + // moved, an exception is thrown. + dis->Delete( true ); + } + catch ( Exception^ ) + { + + // Handle this exception in some way, such as with the following code: + // Console::WriteLine(S"That directory does not exist."); + } + + + // Point the DirectoryInfo reference to the new directory. + //di = new DirectoryInfo(S"NewTempDir"); + // Delete the directory. + //di->Delete(true); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp b/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp new file mode 100644 index 00000000000..73ca8a192a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/directoryinfoparent/CPP/directoryinfoparent.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Make a reference to a directory. + DirectoryInfo^ di = gcnew DirectoryInfo( "TempDir" ); + + // Create the directory only if it does not already exist. + if ( !di->Exists ) + di->Create(); + + + // Create a subdirectory in the directory just created. + DirectoryInfo^ dis = di->CreateSubdirectory( "SubDir" ); + + // Get a reference to the parent directory of the subdirectory you just made. + DirectoryInfo^ parentDir = dis->Parent; + Console::WriteLine( "The parent directory of '{0}' is '{1}'", dis->Name, parentDir->Name ); + + // Delete the parent directory. + di->Delete( true ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp b/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp new file mode 100644 index 00000000000..a798bc4a24c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enum.tostring/CPP/tostr.cpp @@ -0,0 +1,47 @@ +// +// Sample for Enum::ToString(String) + +using namespace System; + +public enum class Colors +{ + Red, Green, Blue, Yellow = 12 +}; + +int main() +{ + Colors myColor = Colors::Yellow; + Console::WriteLine( "Colors::Red = {0}", Colors::Red.ToString( "d" ) ); + Console::WriteLine( "Colors::Green = {0}", Colors::Green.ToString( "d" ) ); + Console::WriteLine( "Colors::Blue = {0}", Colors::Blue.ToString( "d" ) ); + Console::WriteLine( "Colors::Yellow = {0}", Colors::Yellow.ToString( "d" ) ); + Console::WriteLine( " {0}myColor = Colors::Yellow {0}", Environment::NewLine ); + Console::WriteLine( "myColor->ToString(\"g\") = {0}", myColor.ToString( "g" ) ); + Console::WriteLine( "myColor->ToString(\"G\") = {0}", myColor.ToString( "G" ) ); + Console::WriteLine( "myColor->ToString(\"x\") = {0}", myColor.ToString( "x" ) ); + Console::WriteLine( "myColor->ToString(\"X\") = {0}", myColor.ToString( "X" ) ); + Console::WriteLine( "myColor->ToString(\"d\") = {0}", myColor.ToString( "d" ) ); + Console::WriteLine( "myColor->ToString(\"D\") = {0}", myColor.ToString( "D" ) ); + Console::WriteLine( "myColor->ToString(\"f\") = {0}", myColor.ToString( "f" ) ); + Console::WriteLine( "myColor->ToString(\"F\") = {0}", myColor.ToString( "F" ) ); +} + +/* +This example produces the following results: +Colors::Red = 0 +Colors::Green = 1 +Colors::Blue = 2 +Colors::Yellow = 12 + +myColor = Colors::Yellow + +myColor->ToString("g") = Yellow +myColor->ToString("G") = Yellow +myColor->ToString("x") = 0000000C +myColor->ToString("X") = 0000000C +myColor->ToString("d") = 12 +myColor->ToString("D") = 12 +myColor->ToString("f") = Yellow +myColor->ToString("F") = Yellow +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp b/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp new file mode 100644 index 00000000000..8d067455708 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumcompareto/CPP/EnumCompareTo.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; + +public enum class VehicleDoors +{ + Motorbike = 0, + Sportscar = 2, + Sedan = 4, + Hatchback = 5 +}; + +int main() +{ + VehicleDoors myVeh = VehicleDoors::Sportscar; + VehicleDoors yourVeh = VehicleDoors::Motorbike; + VehicleDoors otherVeh = VehicleDoors::Sedan; + Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, yourVeh ); + Int32 iRes = myVeh.CompareTo( yourVeh ); + Console::WriteLine( "{0}{1}", iRes > 0 ? (String^)"Yes" : "No", Environment::NewLine ); + Console::WriteLine( "Does a {0} have more doors than a {1}?", myVeh, otherVeh ); + iRes = myVeh.CompareTo( otherVeh ); + Console::WriteLine( "{0}", iRes > 0 ? (String^)"Yes" : "No" ); +} +// The example displays the following output: +// Does a Sportscar have more doors than a Motorbike? +// Yes +// +// Does a Sportscar have more doors than a Sedan? +// No +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp b/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp new file mode 100644 index 00000000000..2c8b0fb26db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumequals/CPP/EnumEquals.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +public enum class Colors +{ + Red, Green, Blue, Yellow +}; + +public enum class Mammals +{ + Cat, Dog, Horse, Dolphin +}; + +int main() +{ + Mammals myPet = Mammals::Cat; + Colors myColor = Colors::Red; + Mammals yourPet = Mammals::Dog; + Colors yourColor = Colors::Red; + Console::WriteLine( "My favorite animal is a {0}", myPet ); + Console::WriteLine( "Your favorite animal is a {0}", yourPet ); + Console::WriteLine( "Do we like the same animal? {0}", myPet.Equals( yourPet ) ? (String^)"Yes" : "No" ); + Console::WriteLine(); + Console::WriteLine( "My favorite color is {0}", myColor ); + Console::WriteLine( "Your favorite color is {0}", yourColor ); + Console::WriteLine( "Do we like the same color? {0}", myColor.Equals( yourColor ) ? (String^)"Yes" : "No" ); + Console::WriteLine(); + Console::WriteLine( "The value of my color ({0}) is {1}", myColor, Enum::Format( Colors::typeid, myColor, "d" ) ); + Console::WriteLine( "The value of my pet (a {0}) is {1}", myPet, Enum::Format( Mammals::typeid, myPet, "d" ) ); + Console::WriteLine( "Even though they have the same value, are they equal? {0}", myColor.Equals( myPet ) ? (String^)"Yes" : "No" ); +} +// The example displays the following output: +// My favorite animal is a Cat +// Your favorite animal is a Dog +// Do we like the same animal? No +// +// My favorite color is Red +// Your favorite color is Red +// Do we like the same color? Yes +// +// The value of my color (Red) is 0 +// The value of my pet (a Cat) is 0 +// Even though they have the same value, are they equal? No +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp b/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp new file mode 100644 index 00000000000..1176bcd60d1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumformat/CPP/EnumFormat.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +public enum class Colors +{ + Red, Green, Blue, Yellow +}; + +int main() +{ + Colors myColor = Colors::Blue; + Console::WriteLine( "My favorite color is {0}.", myColor ); + Console::WriteLine( "The value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "d" ) ); + Console::WriteLine( "The hex value of my favorite color is {0}.", Enum::Format( Colors::typeid, myColor, "x" ) ); +} +// The example displays the folowing output: +// My favorite color is Blue. +// The value of my favorite color is 2. +// The hex value of my favorite color is 00000002. +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp new file mode 100644 index 00000000000..f5f08936cf6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumgetname/CPP/EnumGetName.cpp @@ -0,0 +1,22 @@ +// +using namespace System; + +enum class Colors +{ + Red, Green, Blue, Yellow +}; + +enum class Styles +{ + Plaid, Striped, Tartan, Corduroy +}; + +int main() +{ + Console::WriteLine( "The 4th value of the Colors Enum is {0}", Enum::GetName( Colors::typeid, 3 ) ); + Console::WriteLine( "The 4th value of the Styles Enum is {0}", Enum::GetName( Styles::typeid, 3 ) ); +} +// The example displays the following output: +// The 4th value of the Colors Enum is Yellow +// The 4th value of the Styles Enum is Corduroy +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp new file mode 100644 index 00000000000..5c01de3f879 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumgetnames/CPP/EnumGetNames.cpp @@ -0,0 +1,49 @@ + +// +using namespace System; +enum class Colors +{ + Red, Green, Blue, Yellow +}; + +enum class Styles +{ + Plaid, Striped, Tartan, Corduroy +}; + +int main() +{ + Console::WriteLine( "The members of the Colors enum are:" ); + Array^ a = Enum::GetNames( Colors::typeid ); + Int32 i = 0; + do + { + Object^ o = a->GetValue( i ); + Console::WriteLine( o->ToString() ); + } + while ( ++i < a->Length ); + + Console::WriteLine(); + Console::WriteLine( "The members of the Styles enum are:" ); + Array^ b = Enum::GetNames( Styles::typeid ); + i = 0; + do + { + Object^ o = b->GetValue( i ); + Console::WriteLine( o->ToString() ); + } + while ( ++i < b->Length ); +} +// The example displays the following output: +// The members of the Colors enum are: +// Red +// Green +// Blue +// Yellow +// +// The members of the Styles enum are: +// Plaid +// Striped +// Tartan +// Corduroy +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp b/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp new file mode 100644 index 00000000000..69416cafd99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumgetvalues/CPP/EnumGetValues.cpp @@ -0,0 +1,48 @@ + +// +using namespace System; +enum class Colors +{ + Red, Green, Blue, Yellow +}; + +enum class Styles +{ + Plaid = 0, + Striped = 23, + Tartan = 65, + Corduroy = 78 +}; + +int main() +{ + Console::WriteLine( "The values of the Colors Enum are:" ); + Array^ a = Enum::GetValues( Colors::typeid ); + for ( Int32 i = 0; i < a->Length; i++ ) + { + Object^ o = a->GetValue( i ); + Console::WriteLine( "{0}", Enum::Format( Colors::typeid, o, "D" ) ); + } + Console::WriteLine(); + Console::WriteLine( "The values of the Styles Enum are:" ); + Array^ b = Enum::GetValues( Styles::typeid ); + for ( Int32 i = 0; i < b->Length; i++ ) + { + Object^ o = b->GetValue( i ); + Console::WriteLine( "{0}", Enum::Format( Styles::typeid, o, "D" ) ); + + } +} +// The example produces the following output: +// The values of the Colors Enum are: +// 0 +// 1 +// 2 +// 3 +// +// The values of the Styles Enum are: +// 0 +// 23 +// 65 +// 78 +// diff --git a/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp b/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp new file mode 100644 index 00000000000..a5fc6c7c51d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/enumparse/CPP/EnumParse.cpp @@ -0,0 +1,42 @@ +// +using namespace System; + +[Flags] +enum class Colors +{ + Red = 1, + Green = 2, + Blue = 4, + Yellow = 8 +}; + +int main() +{ + Console::WriteLine( "The entries of the Colors enumeration are:" ); + Array^ a = Enum::GetNames( Colors::typeid ); + Int32 i = 0; + while ( i < a->Length ) + { + Object^ o = a->GetValue( i ); + Console::WriteLine( o->ToString() ); + i++; + } + + Console::WriteLine(); + Object^ orange = Enum::Parse( Colors::typeid, "Red, Yellow" ); + Console::WriteLine("The orange value has the combined entries of {0}", orange ); +} + +/* +This code example produces the following results: + +The entries of the Colors Enum are: +Red +Green +Blue +Yellow + +The orange value has the combined entries of Red, Yellow + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp b/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp new file mode 100644 index 00000000000..d8cae622055 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/environment.CommandLine/CPP/commandline.cpp @@ -0,0 +1,19 @@ + +// +using namespace System; + +int main() +{ + Console::WriteLine(); + + // Invoke this sample with an arbitrary set of command line arguments. + Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); +} +/* +The example displays output like the following: + +C:\>env0 ARBITRARY TEXT + +CommandLine: env0 ARBITRARY TEXT +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp b/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp new file mode 100644 index 00000000000..8da45abecdb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/environment.ExpandEnvironmentVariables/CPP/expandenvironmentvariables.cpp @@ -0,0 +1,23 @@ + +// +// Sample for the Environment::ExpandEnvironmentVariables method +using namespace System; +int main() +{ + String^ str; + String^ nl = Environment::NewLine; + Console::WriteLine(); + + // <-- Keep this information secure! --> + String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%"; + str = Environment::ExpandEnvironmentVariables( query ); + Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str ); +} + +/* +This example produces the following results: + +ExpandEnvironmentVariables: +My system drive is C: and my system root is C:\WINNT +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp b/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp new file mode 100644 index 00000000000..3da3cc965d5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/environment.class/CPP/env0.cpp @@ -0,0 +1,104 @@ + +// +// Sample for Environment class summary +using namespace System; +using namespace System::Collections; +int main() +{ + String^ str; + String^ nl = Environment::NewLine; + + // + Console::WriteLine(); + Console::WriteLine( "-- Environment members --" ); + + // Invoke this sample with an arbitrary set of command line arguments. + Console::WriteLine( "CommandLine: {0}", Environment::CommandLine ); + array^arguments = Environment::GetCommandLineArgs(); + Console::WriteLine( "GetCommandLineArgs: {0}", String::Join( ", ", arguments ) ); + + // <-- Keep this information secure! --> + Console::WriteLine( "CurrentDirectory: {0}", Environment::CurrentDirectory ); + Console::WriteLine( "ExitCode: {0}", Environment::ExitCode ); + Console::WriteLine( "HasShutdownStarted: {0}", Environment::HasShutdownStarted ); + + // <-- Keep this information secure! --> + Console::WriteLine( "MachineName: {0}", Environment::MachineName ); + Console::WriteLine( "NewLine: {0} first line {0} second line {0} third line", Environment::NewLine ); + Console::WriteLine( "OSVersion: {0}", Environment::OSVersion ); + Console::WriteLine( "StackTrace: ' {0}'", Environment::StackTrace ); + + // <-- Keep this information secure! --> + Console::WriteLine( "SystemDirectory: {0}", Environment::SystemDirectory ); + Console::WriteLine( "TickCount: {0}", Environment::TickCount ); + + // <-- Keep this information secure! --> + Console::WriteLine( "UserDomainName: {0}", Environment::UserDomainName ); + Console::WriteLine( "UserInteractive: {0}", Environment::UserInteractive ); + + // <-- Keep this information secure! --> + Console::WriteLine( "UserName: {0}", Environment::UserName ); + Console::WriteLine( "Version: {0}", Environment::Version ); + Console::WriteLine( "WorkingSet: {0}", Environment::WorkingSet ); + + // No example for Exit(exitCode) because doing so would terminate this example. + // <-- Keep this information secure! --> + String^ query = "My system drive is %SystemDrive% and my system root is %SystemRoot%"; + str = Environment::ExpandEnvironmentVariables( query ); + Console::WriteLine( "ExpandEnvironmentVariables: {0} {1}", nl, str ); + Console::WriteLine( "GetEnvironmentVariable: {0} My temporary directory is {1}.", nl, Environment::GetEnvironmentVariable( "TEMP" ) ); + Console::WriteLine( "GetEnvironmentVariables: " ); + IDictionary^ environmentVariables = Environment::GetEnvironmentVariables(); + IEnumerator^ myEnum = environmentVariables->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ de = safe_cast(myEnum->Current); + Console::WriteLine( " {0} = {1}", de->Key, de->Value ); + } + + Console::WriteLine( "GetFolderPath: {0}", Environment::GetFolderPath( Environment::SpecialFolder::System ) ); + array^drives = Environment::GetLogicalDrives(); + Console::WriteLine( "GetLogicalDrives: {0}", String::Join( ", ", drives ) ); +} + +/* +This example produces results similar to the following: +(Any result that is lengthy or reveals information that should remain +secure has been omitted and marked S"!---OMITTED---!".) + +C:\>env0 ARBITRARY TEXT + +-- Environment members -- +CommandLine: env0 ARBITRARY TEXT +GetCommandLineArgs: env0, ARBITRARY, TEXT +CurrentDirectory: C:\Documents and Settings\!---OMITTED---! +ExitCode: 0 +HasShutdownStarted: False +MachineName: !---OMITTED---! +NewLine: + first line + second line + third line +OSVersion: Microsoft Windows NT 5.1.2600.0 +StackTrace: ' at System::Environment::GetStackTrace(Exception e) + at System::Environment::GetStackTrace(Exception e) + at System::Environment::get_StackTrace() + at Sample::Main()' +SystemDirectory: C:\WINNT\System32 +TickCount: 17995355 +UserDomainName: !---OMITTED---! +UserInteractive: True +UserName: !---OMITTED---! +Version: !---OMITTED---! +WorkingSet: 5038080 +ExpandEnvironmentVariables: + My system drive is C: and my system root is C:\WINNT +GetEnvironmentVariable: + My temporary directory is C:\DOCUME~1\!---OMITTED---!\LOCALS~1\Temp. +GetEnvironmentVariables: + !---OMITTED---! +GetFolderPath: C:\WINNT\System32 +GetLogicalDrives: A:\, C:\, D:\ + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp b/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp new file mode 100644 index 00000000000..8a06d998c6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/environment.processorcount/CPP/pc.cpp @@ -0,0 +1,16 @@ + +// +// This example demonstrates the +// Environment.ProcessorCount property. +using namespace System; +int main() +{ + Console::WriteLine( "The number of processors on this computer is {0}.", Environment::ProcessorCount ); +} + +/* +This example produces the following results: + +The number of processors on this computer is 1. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp new file mode 100644 index 00000000000..becae48d9ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/eventlogInstaller_Resources/CPP/source.cpp @@ -0,0 +1,73 @@ + + +// System.Diagnostics.EventLogInstaller +// The following example demonstrates the EventLogInstaller class. +// It defines the instance SampleEventLogInstaller with the +// attribute RunInstallerAttribute. +// +// The Log and Source properties of the new instance are set, +// along with the new resource file properties, +// and the instance is added to the collection of installers +// to be run during an installation. +// +// Note: +// 1) Run this program using the following command: +// InstallUtil.exe +// 2) Uninstall the event log created in step 1 using the +// following command: +// InstallUtil.exe /u +// +#using +#using + +using namespace System; +using namespace System::Configuration::Install; +using namespace System::Diagnostics; +using namespace System::ComponentModel; + +[RunInstaller(true)] +public ref class SampleEventLogInstaller : public Installer +{ +private: + EventLogInstaller^ myEventLogInstaller; + +public: + SampleEventLogInstaller() + { + + // Create an instance of an EventLogInstaller. + myEventLogInstaller = gcnew EventLogInstaller; + + // Set the source name of the event log. + myEventLogInstaller->Source = "ApplicationEventSource"; + + // Set the event log into which the source writes entries. + //myEventLogInstaller.Log = "MyCustomLog"; + myEventLogInstaller->Log = "myNewLog"; + + // Set the resource file for the event log. + // The message strings are defined in EventLogMsgs.mc; the message + // identifiers used in the application must match those defined in the + // corresponding message resource file. The messages must be built + // into a Win32 resource library and copied to the target path on the + // system. + myEventLogInstaller->CategoryResourceFile = + Environment::SystemDirectory + "\\eventlogmsgs.dll"; + myEventLogInstaller->CategoryCount = 3; + myEventLogInstaller->MessageResourceFile = + Environment::SystemDirectory + "\\eventlogmsgs.dll"; + myEventLogInstaller->ParameterResourceFile = + Environment::SystemDirectory + "\\eventlogmsgs.dll"; + + // Add myEventLogInstaller to the installer collection. + Installers->Add( myEventLogInstaller ); + } + +}; + +int main() +{ + Console::WriteLine( "Usage: InstallUtil.exe [.exe | .dll]" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp new file mode 100644 index 00000000000..7bfe2badf7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/eventlog_WriteEvent/CPP/source.cpp @@ -0,0 +1,277 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +void CleanUp(); +void CreateEventSourceSample1( String^ messageFile ); +void WriteEventSample1(); +void WriteEventSample2(); +void EventInstanceSamples(); + +// +// The following constants match the message definitions +// in the message resource file. They are used to specify +// the resource identifier for a localized string in the +// message resource file. +// The message resource file is an .mc file built into a +// Win32 resource file using the message compiler (MC) tool. +// +const short InstallCategoryMsgId = 1; +const short QueryCategoryMsgId = 2; +const short RefreshCategoryMsgId = 3; +const short CategoryCount = 3; + +// +// +// Define the resource identifiers for the event messages. +// Resource identifiers combine the message ID and the severity field. +const long AuditSuccessMsgId = 1000; +const long AuditFailedMsgId = 1001 + 0x80000000; +const long InformationMsgId = 1002; +const long WarningMsgId = 1003 + 0x80000000; +const long UpdateCycleCompleteMsgId = 1004; +const long ServerConnectionDownMsgId = 1005 + 0x80000000; + +// +// +const long DisplayNameMsgId = 5001; +const long ServiceNameMsgId = 5002; + +// +// + +[STAThread] +int main() +{ + array^args = Environment::GetCommandLineArgs(); + String^ messageFile; + if ( args->Length > 1 ) + { + + // Use the input argument as the message resource file. + messageFile = args[ 1 ]; + } + else + { + + // Use the default message dll. + messageFile = String::Format( "{0}\\{1}", System::Environment::CurrentDirectory, "EventLogMsgs.dll" ); + } + + CleanUp(); + CreateEventSourceSample1( messageFile ); + WriteEventSample1(); + WriteEventSample2(); + EventInstanceSamples(); +} + +void CleanUp() +{ + String^ sourceName = "SampleApplicationSource"; + + // Delete the event source in order to re-register + // the source with the latest configuration properties. + if ( EventLog::SourceExists( sourceName ) ) + { + Console::WriteLine( "Deleting event source {0}.", sourceName ); + EventLog::DeleteEventSource( sourceName ); + } +} +// +void CreateEventSourceSample1( String^ messageFile ) +{ + String^ myLogName; + String^ sourceName = "SampleApplicationSource"; + + // Create the event source if it does not exist. + if ( !EventLog::SourceExists( sourceName ) ) + { + + // Create a new event source for the custom event log + // named "myNewLog." + myLogName = "myNewLog"; + EventSourceCreationData ^ mySourceData = gcnew EventSourceCreationData( sourceName,myLogName ); + + // Set the message resource file that the event source references. + // All event resource identifiers correspond to text in this file. + if ( !System::IO::File::Exists( messageFile ) ) + { + Console::WriteLine( "Input message resource file does not exist - {0}", messageFile ); + messageFile = ""; + } + else + { + + // Set the specified file as the resource + // file for message text, category text, and + // message parameter strings. + mySourceData->MessageResourceFile = messageFile; + mySourceData->CategoryResourceFile = messageFile; + mySourceData->CategoryCount = CategoryCount; + mySourceData->ParameterResourceFile = messageFile; + Console::WriteLine( "Event source message resource file set to {0}", messageFile ); + } + + Console::WriteLine( "Registering new source for event log." ); + EventLog::CreateEventSource( mySourceData ); + } + else + { + + // Get the event log corresponding to the existing source. + myLogName = EventLog::LogNameFromSourceName( sourceName, "." ); + } + + + // Register the localized name of the event log. + // For example, the actual name of the event log is "myNewLog," but + // the event log name displayed in the Event Viewer might be + // "Sample Application Log" or some other application-specific + // text. + EventLog^ myEventLog = gcnew EventLog( myLogName,".",sourceName ); + if ( messageFile->Length > 0 ) + { + myEventLog->RegisterDisplayName( messageFile, DisplayNameMsgId ); + } +} +// + +void WriteEventSample1() +{ + // + // Create the event source if it does not exist. + String^ sourceName = "SampleApplicationSource"; + if ( !EventLog::SourceExists( sourceName ) ) + { + + // Call a local method to register the event log source + // for the event log "myNewLog." Use the resource file + // EventLogMsgs.dll in the current directory for message text. + String^ messageFile = String::Format( "{0}\\{1}", System::Environment::CurrentDirectory, "EventLogMsgs.dll" ); + CreateEventSourceSample1( messageFile ); + } + + // Get the event log corresponding to the existing source. + String^ myLogName = EventLog::LogNameFromSourceName( sourceName, "." ); + EventLog^ myEventLog = gcnew EventLog( myLogName,".",sourceName ); + + // Define two audit events. + // The message identifiers correspond to the message text in the + // message resource file defined for the source. + EventInstance ^ myAuditSuccessEvent = gcnew EventInstance( AuditSuccessMsgId,0,EventLogEntryType::SuccessAudit ); + EventInstance ^ myAuditFailEvent = gcnew EventInstance( AuditFailedMsgId,0,EventLogEntryType::FailureAudit ); + + // Insert the method name into the event log message. + array^insertStrings = {"EventLogSamples.WriteEventSample1"}; + + // Write the events to the event log. + myEventLog->WriteEvent( myAuditSuccessEvent, insertStrings ); + + // Append binary data to the audit failure event entry. + array^binaryData = {3,4,5,6}; + myEventLog->WriteEvent( myAuditFailEvent, binaryData, insertStrings ); + + // +} + +void WriteEventSample2() +{ + // + String^ sourceName = "SampleApplicationSource"; + if ( EventLog::SourceExists( sourceName ) ) + { + + // Define an informational event and a warning event. + // The message identifiers correspond to the message text in the + // message resource file defined for the source. + EventInstance ^ myInfoEvent = gcnew EventInstance( InformationMsgId,0,EventLogEntryType::Information ); + EventInstance ^ myWarningEvent = gcnew EventInstance( WarningMsgId,0,EventLogEntryType::Warning ); + + // Insert the method name into the event log message. + array^insertStrings = {"EventLogSamples.WriteEventSample2"}; + + // Write the events to the event log. + EventLog::WriteEvent( sourceName, myInfoEvent, 0 ); + + // Append binary data to the warning event entry. + array^binaryData = {7,8,9,10}; + EventLog::WriteEvent( sourceName, myWarningEvent, binaryData, insertStrings ); + } + else + { + Console::WriteLine( "Warning - event source {0} not registered", sourceName ); + } + // +} + +void EventInstanceSamples() +{ + + // + // Ensure that the source has already been registered using + // EventLogInstaller or EventLog.CreateEventSource. + String^ sourceName = "SampleApplicationSource"; + if ( EventLog::SourceExists( sourceName ) ) + { + // Define an informational event with no category. + // The message identifier corresponds to the message text in the + // message resource file defined for the source. + EventInstance ^ myEvent = gcnew EventInstance( UpdateCycleCompleteMsgId,0 ); + + // Write the event to the event log using the registered source. + EventLog::WriteEvent( sourceName, myEvent, 0 ); + + // Reuse the event data instance for another event entry. + // Set the entry category and message identifiers for + // the appropriate resource identifiers in the resource files + // for the registered source. Set the event type to Warning. + myEvent->CategoryId = RefreshCategoryMsgId; + myEvent->EntryType = EventLogEntryType::Warning; + myEvent->InstanceId = ServerConnectionDownMsgId; + + // Write the event to the event log using the registered source. + // Insert the machine name into the event message text. + array^ss = {Environment::MachineName}; + EventLog::WriteEvent( sourceName, myEvent, ss ); + } + else + { + Console::WriteLine( "Warning - event source {0} not registered", sourceName ); + } + // + // + + // Get the event log corresponding to the existing source. + String^ myLogName = EventLog::LogNameFromSourceName( sourceName, "." ); + + // Find each instance of a specific event log entry in a + // particular event log. + EventLog^ myEventLog = gcnew EventLog( myLogName,"." ); + int count = 0; + Console::WriteLine( "Searching event log entries for the event ID {0}...", ServerConnectionDownMsgId ); + + // Search for the resource ID, display the event text, + // and display the number of matching entries. + System::Collections::IEnumerator^ myEnum = myEventLog->Entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLogEntry^ entry = safe_cast(myEnum->Current); + if ( entry->InstanceId == ServerConnectionDownMsgId ) + { + count++; + Console::WriteLine(); + Console::WriteLine( "Entry ID = {0}", entry->InstanceId ); + Console::WriteLine( "Reported at {0}", entry->TimeWritten ); + Console::WriteLine( "Message text:" ); + Console::WriteLine( "\t{0}", entry->Message ); + } + } + + Console::WriteLine(); + Console::WriteLine( "Found {0} events with ID {1} in event log {2}.", count, ServerConnectionDownMsgId, myLogName ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp b/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp new file mode 100644 index 00000000000..d1bc63b6472 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/eventsoverview/cpp/programwithdata.cpp @@ -0,0 +1,67 @@ +// +using namespace System; + +public ref class ThresholdReachedEventArgs : public EventArgs +{ + public: + property int Threshold; + property DateTime TimeReached; +}; + +public ref class Counter +{ + private: + int threshold; + int total; + + public: + Counter() {}; + + Counter(int passedThreshold) + { + threshold = passedThreshold; + } + + void Add(int x) + { + total += x; + if (total >= threshold) { + ThresholdReachedEventArgs^ args = gcnew ThresholdReachedEventArgs(); + args->Threshold = threshold; + args->TimeReached = DateTime::Now; + OnThresholdReached(args); + } + } + + event EventHandler^ ThresholdReached; + + protected: + virtual void OnThresholdReached(ThresholdReachedEventArgs^ e) + { + ThresholdReached(this, e); + } +}; + +public ref class SampleHandler +{ + public: + static void c_ThresholdReached(Object^ sender, ThresholdReachedEventArgs^ e) + { + Console::WriteLine("The threshold of {0} was reached at {1}.", + e->Threshold, e->TimeReached); + Environment::Exit(0); + } +}; + +void main() +{ + Counter^ c = gcnew Counter((gcnew Random())->Next(10)); + c->ThresholdReached += gcnew EventHandler(SampleHandler::c_ThresholdReached); + + Console::WriteLine("press 'a' key to increase total"); + while (Console::ReadKey(true).KeyChar == 'a') { + Console::WriteLine("adding one"); + c->Add(1); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp b/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp new file mode 100644 index 00000000000..57b3be51deb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/exception.data/CPP/data.cpp @@ -0,0 +1,89 @@ +// +using namespace System; +using namespace System::Collections; + +void NestedRunTest( bool displayDetails ); // forward declarations +void NestedRoutine1( bool displayDetails ); +void NestedRoutine2( bool displayDetails ); +void RunTest( bool displayDetails ); + +int main() +{ + Console::WriteLine("\nException with some extra information..." ); + RunTest(false); + Console::WriteLine("\nException with all extra information..." ); + RunTest(true); +} + +void RunTest( bool displayDetails ) +{ + try + { + NestedRoutine1( displayDetails ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown." ); + Console::WriteLine( e->Message ); + if ( e->Data != nullptr ) + { + Console::WriteLine( " Extra details:" ); + + for each (DictionaryEntry de in e->Data) + Console::WriteLine(" Key: {0,-20} Value: {1}", + "'" + de.Key->ToString() + "'", de.Value); + } + } +} + +void NestedRoutine1( bool displayDetails ) +{ + try + { + NestedRoutine2( displayDetails ); + } + catch ( Exception^ e ) + { + e->Data[ "ExtraInfo" ] = "Information from NestedRoutine1."; + e->Data->Add( "MoreExtraInfo", "More information from NestedRoutine1." ); + throw; + } +} + +void NestedRoutine2( bool displayDetails ) +{ + Exception^ e = gcnew Exception( "This statement is the original exception message." ); + if ( displayDetails ) + { + String^ s = "Information from NestedRoutine2."; + int i = -903; + DateTime dt = DateTime::Now; + e->Data->Add( "stringInfo", s ); + e->Data[ "IntInfo" ] = i; + e->Data[ "DateTimeInfo" ] = dt; + } + + throw e; +} + +/* +This example produces the following results: + +Exception with some extra information... +An exception was thrown. +This statement is the original exception message. + Extra details: + The key is 'ExtraInfo' and the value is: Information from NestedRoutine1. + The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1. + +Exception with all extra information... +An exception was thrown. +This statement is the original exception message. + Extra details: + The key is 'stringInfo' and the value is: Information from NestedRoutine2. + The key is 'IntInfo' and the value is: -903 + The key is 'DateTimeInfo' and the value is: 11/26/2002 2:12:58 PM + The key is 'ExtraInfo' and the value is: Information from NestedRoutine1. + The key is 'MoreExtraInfo' and the value is: More information from NestedRoutine1. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp new file mode 100644 index 00000000000..9006e0e4c6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfoappendtext/CPP/fileinfoappendtext.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Create a writer, ready to add entries to the file. + StreamWriter^ sw = fi->AppendText(); + sw->WriteLine( "Add as many lines as you like..." ); + sw->WriteLine( "Add another line to the output..." ); + sw->Flush(); + sw->Close(); + + // Get the information out of the file and display it. + // Remember that the file might have other lines if it already existed. + StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); + while ( sr->Peek() != -1 ) + Console::WriteLine( sr->ReadLine() ); +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +//Add as many lines as you like... +//Add another line to the output... + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp new file mode 100644 index 00000000000..3b56ad744a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfocopyto/CPP/fileinfocopyto.cpp @@ -0,0 +1,43 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Create a reference to a file, which might or might not exist. + // If it does not exist, it is not yet created. + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Create a writer, ready to add entries to the file. + StreamWriter^ sw = fi->AppendText(); + sw->WriteLine( "Add as many lines as you like..." ); + sw->WriteLine( "Add another line to the output..." ); + sw->Flush(); + sw->Close(); + + // Get the information out of the file and display it. + StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); + Console::WriteLine( "This is the information in the first file:" ); + while ( sr->Peek() != -1 ) + Console::WriteLine( sr->ReadLine() ); + + + // Copy this file to another file. The true parameter specifies + // that the file will be overwritten if it already exists. + FileInfo^ newfi = fi->CopyTo( "newTemp.txt", true ); + + // Get the information out of the new file and display it.* sr = new StreamReader( newfi->OpenRead() ); + Console::WriteLine( "{0}This is the information in the second file:", Environment::NewLine ); + while ( sr->Peek() != -1 ) + Console::WriteLine( sr->ReadLine() ); +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is the information in the first file: +//Add as many lines as you like... +//Add another line to the output... +//This is the information in the second file: +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp new file mode 100644 index 00000000000..a5bcc91ed5d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfodelete/CPP/fileinfodelete.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Create a reference to a file. + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Actually create the file. + FileStream^ fs = fi->Create(); + + // Modify the file as required, and then close the file. + fs->Close(); + + // Delete the file. + fi->Delete(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp new file mode 100644 index 00000000000..194a71d29f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfodirectory/CPP/fileinfodirectory.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Open an existing file, or create a new one. + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Determine the full path of the file just created. + DirectoryInfo^ di = fi->Directory; + + // Figure out what other entries are in that directory. + array^fsi = di->GetFileSystemInfos(); + Console::WriteLine( "The directory '{0}' contains the following files and directories:", di->FullName ); + + // Print the names of all the files and subdirectories of that directory. + Collections::IEnumerator^ myEnum = fsi->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FileSystemInfo^ info = safe_cast(myEnum->Current); + Console::WriteLine( info->Name ); + } +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//The directory 'C:\Visual Studio 2005\release' contains the following files +//and directories: +//fileinfodirectory.exe +//fileinfodirectory.pdb +//newTemp.txt +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp new file mode 100644 index 00000000000..bdd66b10555 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfomain/CPP/fileinfomain.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Open an existing file, or create a new one. + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Create a writer, ready to add entries to the file. + StreamWriter^ sw = fi->AppendText(); + sw->WriteLine( "This is a new entry to add to the file" ); + sw->WriteLine( "This is yet another line to add..." ); + sw->Flush(); + sw->Close(); + + // Get the information out of the file and display it. + StreamReader^ sr = gcnew StreamReader( fi->OpenRead() ); + while ( sr->Peek() != -1 ) + Console::WriteLine( sr->ReadLine() ); +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//This is a new entry to add to the file +//This is yet another line to add... +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp new file mode 100644 index 00000000000..e29a987391a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfoname/CPP/fileinfoname.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Create a reference to the current directory. + DirectoryInfo^ di = gcnew DirectoryInfo( Environment::CurrentDirectory ); + + // Create an array representing the files in the current directory. + array^fi = di->GetFiles(); + Console::WriteLine( "The following files exist in the current directory:" ); + + // Print out the names of the files in the current directory. + Collections::IEnumerator^ myEnum = fi->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FileInfo^ fiTemp = safe_cast(myEnum->Current); + Console::WriteLine( fiTemp->Name ); + } +} + +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//The following files exist in the current directory: +//fileinfoname.exe +//fileinfoname.pdb +//newTemp.txt +// diff --git a/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp b/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp new file mode 100644 index 00000000000..7919473364a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/fileinfoopen/CPP/fileinfoopen.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Open an existing file, or create a new one. + FileInfo^ fi = gcnew FileInfo( "temp.txt" ); + + // Open the file just specified such that no one else can use it. + FileStream^ fs = fi->Open( FileMode::OpenOrCreate, FileAccess::ReadWrite, FileShare::None ); + + // Create another reference to the same file. + FileInfo^ nextfi = gcnew FileInfo( "temp.txt" ); + try + { + + // Try opening the same file, which was locked by the previous process. + nextfi->Open( FileMode::OpenOrCreate, FileAccess::Read ); + Console::WriteLine( "The file was not locked, and was opened by a second process." ); + } + catch ( IOException^ ) + { + Console::WriteLine( "The file could not be opened because it was locked by another process." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + + + // Close the file so it can be deleted. + fs->Close(); +} +//This code produces output similar to the following; +//results may vary based on the computer/file structure/etc.: +// +//The file could not be opened because it was locked by another process. +// diff --git a/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp new file mode 100644 index 00000000000..feda725012e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/generic.ReadOnlyCollection/cpp/source.cpp @@ -0,0 +1,92 @@ +// +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Collections::ObjectModel; + +void main() +{ + List^ dinosaurs = gcnew List(); + + dinosaurs->Add("Tyrannosaurus"); + dinosaurs->Add("Amargasaurus"); + dinosaurs->Add("Deinonychus"); + dinosaurs->Add("Compsognathus"); + + ReadOnlyCollection^ readOnlyDinosaurs = + gcnew ReadOnlyCollection(dinosaurs); + + Console::WriteLine(); + for each(String^ dinosaur in readOnlyDinosaurs ) + { + Console::WriteLine(dinosaur); + } + + Console::WriteLine("\nCount: {0}", readOnlyDinosaurs->Count); + + Console::WriteLine("\nContains(\"Deinonychus\"): {0}", + readOnlyDinosaurs->Contains("Deinonychus")); + + Console::WriteLine("\nreadOnlyDinosaurs[3]: {0}", + readOnlyDinosaurs[3]); + + Console::WriteLine("\nIndexOf(\"Compsognathus\"): {0}", + readOnlyDinosaurs->IndexOf("Compsognathus")); + + Console::WriteLine("\nInsert into the wrapped List:"); + Console::WriteLine("Insert(2, \"Oviraptor\")"); + dinosaurs->Insert(2, "Oviraptor"); + + Console::WriteLine(); + for each( String^ dinosaur in readOnlyDinosaurs ) + { + Console::WriteLine(dinosaur); + } + + array^ dinoArray = + gcnew array(readOnlyDinosaurs->Count + 2); + readOnlyDinosaurs->CopyTo(dinoArray, 1); + + Console::WriteLine("\nCopied array has {0} elements:", + dinoArray->Length); + for each( String^ dinosaur in dinoArray ) + { + Console::WriteLine("\"{0}\"", dinosaur); + } +} + +/* This code example produces the following output: + +Tyrannosaurus +Amargasaurus +Deinonychus +Compsognathus + +Count: 4 + +Contains("Deinonychus"): True + +readOnlyDinosaurs[3]: Compsognathus + +IndexOf("Compsognathus"): 3 + +Insert into the wrapped List: +Insert(2, "Oviraptor") + +Tyrannosaurus +Amargasaurus +Oviraptor +Deinonychus +Compsognathus + +Copied array has 7 elements: +"" +"Tyrannosaurus" +"Amargasaurus" +"Oviraptor" +"Deinonychus" +"Compsognathus" +"" + */ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp b/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp new file mode 100644 index 00000000000..66e8c71ecbd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/math.atanx/CPP/atan.cpp @@ -0,0 +1,47 @@ + +// +// This example demonstrates Math.Atan() +// Math.Atan2() +// Math.Tan() +using namespace System; +int main() +{ + double x = 1.0; + double y = 2.0; + double angle; + double radians; + double result; + + // Calculate the tangent of 30 degrees. + angle = 30; + radians = angle * (Math::PI / 180); + result = Math::Tan( radians ); + Console::WriteLine( "The tangent of 30 degrees is {0}.", result ); + + // Calculate the arctangent of the previous tangent. + radians = Math::Atan( result ); + angle = radians * (180 / Math::PI); + Console::WriteLine( "The previous tangent is equivalent to {0} degrees.", angle ); + + // Calculate the arctangent of an angle. + String^ line1 = "{0}The arctangent of the angle formed by the x-axis and "; + String^ line2 = "a vector to point ({0},{1}) is {2}, "; + String^ line3 = "which is equivalent to {0} degrees."; + radians = Math::Atan2( y, x ); + angle = radians * (180 / Math::PI); + Console::WriteLine( line1, Environment::NewLine ); + Console::WriteLine( line2, x, y, radians ); + Console::WriteLine( line3, angle ); +} + +/* +This example produces the following results: + +The tangent of 30 degrees is 0.577350269189626. +The previous tangent is equivalent to 30 degrees. + +The arctangent of the angle formed by the x-axis and +a vector to point (1,2) is 1.10714871779409, +which is equivalent to 63.434948822922 degrees. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp b/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp new file mode 100644 index 00000000000..ce21aac3d31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/math.bigmul/CPP/bigmul.cpp @@ -0,0 +1,22 @@ + +// +// This example demonstrates Math.BigMul() +using namespace System; +int main() +{ + int int1 = Int32::MaxValue; + int int2 = Int32::MaxValue; + Int64 longResult; + + // + longResult = Math::BigMul( int1, int2 ); + Console::WriteLine( "Calculate the product of two Int32 values:" ); + Console::WriteLine( "{0} * {1} = {2}", int1, int2, longResult ); +} + +/* +This example produces the following results: +Calculate the product of two Int32 values: +2147483647 * 2147483647 = 4611686014132420609 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp b/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp new file mode 100644 index 00000000000..30f8d543207 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/math.max/CPP/max.cpp @@ -0,0 +1,59 @@ + +// +// This example demonstrates Math.Max() +using namespace System; +int main() +{ + String^ str = "{0}: The greater of {1,3} and {2,3} is {3}."; + String^ nl = Environment::NewLine; + Byte xByte1 = 1,xByte2 = 51; + short xShort1 = -2,xShort2 = 52; + int xInt1 = -3,xInt2 = 53; + long xLong1 = -4,xLong2 = 54; + float xSingle1 = 5.0f,xSingle2 = 55.0f; + double xDouble1 = 6.0,xDouble2 = 56.0; + Decimal xDecimal1 = 7,xDecimal2 = 57; + + // The following types are not CLS-compliant. + SByte xSbyte1 = 101,xSbyte2 = 111; + UInt16 xUshort1 = 102,xUshort2 = 112; + UInt32 xUint1 = 103,xUint2 = 113; + UInt64 xUlong1 = 104,xUlong2 = 114; + Console::WriteLine( "{0}Display the greater of two values:{0}", nl ); + Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Max( xByte1, xByte2 ) ); + Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Max( xShort1, xShort2 ) ); + Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Max( xInt1, xInt2 ) ); + Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Max( xLong1, xLong2 ) ); + Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Max( xSingle1, xSingle2 ) ); + Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Max( xDouble1, xDouble2 ) ); + Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Max( xDecimal1, xDecimal2 ) ); + + // + Console::WriteLine( "{0}The following types are not CLS-compliant.{0}", nl ); + Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Max( xSbyte1, xSbyte2 ) ); + Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Max( xUshort1, xUshort2 ) ); + Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Max( xUint1, xUint2 ) ); + Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Max( xUlong1, xUlong2 ) ); +} + +/* +This example produces the following results: + +Display the greater of two values: + +Byte : The greater of 1 and 51 is 51. +Int16 : The greater of -2 and 52 is 52. +Int32 : The greater of -3 and 53 is 53. +Int64 : The greater of -4 and 54 is 54. +Single : The greater of 5 and 55 is 55. +Double : The greater of 6 and 56 is 56. +Decimal: The greater of 7 and 57 is 57. + +(The following types are not CLS-compliant.) + +SByte : The greater of 101 and 111 is 111. +UInt16 : The greater of 102 and 112 is 112. +UInt32 : The greater of 103 and 113 is 113. +UInt64 : The greater of 104 and 114 is 114. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp b/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp new file mode 100644 index 00000000000..fe4036cee2d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/math.min/CPP/min.cpp @@ -0,0 +1,59 @@ + +// +// This example demonstrates Math.Min() +using namespace System; +int main() +{ + String^ str = "{0}: The lesser of {1,3} and {2,3} is {3}."; + String^ nl = Environment::NewLine; + Byte xByte1 = 1,xByte2 = 51; + short xShort1 = -2,xShort2 = 52; + int xInt1 = -3,xInt2 = 53; + long xLong1 = -4,xLong2 = 54; + float xSingle1 = 5.0f,xSingle2 = 55.0f; + double xDouble1 = 6.0,xDouble2 = 56.0; + Decimal xDecimal1 = 7,xDecimal2 = 57; + + // The following types are not CLS-compliant. + SByte xSbyte1 = 101,xSbyte2 = 111; + UInt16 xUshort1 = 102,xUshort2 = 112; + UInt32 xUint1 = 103,xUint2 = 113; + UInt64 xUlong1 = 104,xUlong2 = 114; + Console::WriteLine( "{0}Display the lesser of two values:{0}", nl ); + Console::WriteLine( str, "Byte ", xByte1, xByte2, Math::Min( xByte1, xByte2 ) ); + Console::WriteLine( str, "Int16 ", xShort1, xShort2, Math::Min( xShort1, xShort2 ) ); + Console::WriteLine( str, "Int32 ", xInt1, xInt2, Math::Min( xInt1, xInt2 ) ); + Console::WriteLine( str, "Int64 ", xLong1, xLong2, Math::Min( xLong1, xLong2 ) ); + Console::WriteLine( str, "Single ", xSingle1, xSingle2, Math::Min( xSingle1, xSingle2 ) ); + Console::WriteLine( str, "Double ", xDouble1, xDouble2, Math::Min( xDouble1, xDouble2 ) ); + Console::WriteLine( str, "Decimal", xDecimal1, xDecimal2, Math::Min( xDecimal1, xDecimal2 ) ); + + // + Console::WriteLine( "{0}The following types are not CLS-compliant:{0}", nl ); + Console::WriteLine( str, "SByte ", xSbyte1, xSbyte2, Math::Min( xSbyte1, xSbyte2 ) ); + Console::WriteLine( str, "UInt16 ", xUshort1, xUshort2, Math::Min( xUshort1, xUshort2 ) ); + Console::WriteLine( str, "UInt32 ", xUint1, xUint2, Math::Min( xUint1, xUint2 ) ); + Console::WriteLine( str, "UInt64 ", xUlong1, xUlong2, Math::Min( xUlong1, xUlong2 ) ); +} + +/* +This example produces the following results: + +Display the lesser of two values: + +Byte : The lesser of 1 and 51 is 1. +Int16 : The lesser of -2 and 52 is -2. +Int32 : The lesser of -3 and 53 is -3. +Int64 : The lesser of -4 and 54 is -4. +Single : The lesser of 5 and 55 is 5. +Double : The lesser of 6 and 56 is 6. +Decimal: The lesser of 7 and 57 is 7. + +The following types are not CLS-compliant: + +SByte : The lesser of 101 and 111 is 101. +UInt16 : The lesser of 102 and 112 is 102. +UInt32 : The lesser of 103 and 113 is 103. +UInt64 : The lesser of 104 and 114 is 104. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp b/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp new file mode 100644 index 00000000000..200dda534ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/math.sign/CPP/sign.cpp @@ -0,0 +1,59 @@ + +// +// This example demonstrates Math.Sign() +using namespace System; +String^ Test( int compare ) +{ + if ( compare == 0 ) + return "equal to"; + else + if ( compare < 0 ) + return "less than"; + else + return "greater than"; +} + +int main() +{ + String^ str = "{0}: {1,3} is {2} zero."; + String^ nl = Environment::NewLine; + Byte xByte1 = 0; + short xShort1 = -2; + int xInt1 = -3; + long xLong1 = -4; + float xSingle1 = 0.0f; + double xDouble1 = 6.0; + Decimal xDecimal1 = -7; + + // The following type is not CLS-compliant. + SByte xSbyte1 = -101; + Console::WriteLine( "{0}Test the sign of the following types of values:", nl ); + Console::WriteLine( str, "Byte ", xByte1, Test( Math::Sign( xByte1 ) ) ); + Console::WriteLine( str, "Int16 ", xShort1, Test( Math::Sign( xShort1 ) ) ); + Console::WriteLine( str, "Int32 ", xInt1, Test( Math::Sign( xInt1 ) ) ); + Console::WriteLine( str, "Int64 ", xLong1, Test( Math::Sign( xLong1 ) ) ); + Console::WriteLine( str, "Single ", xSingle1, Test( Math::Sign( xSingle1 ) ) ); + Console::WriteLine( str, "Double ", xDouble1, Test( Math::Sign( xDouble1 ) ) ); + Console::WriteLine( str, "Decimal", xDecimal1, Test( Math::Sign( xDecimal1 ) ) ); + + // + Console::WriteLine( "{0}The following type is not CLS-compliant.", nl ); + Console::WriteLine( str, "SByte ", xSbyte1, Test( Math::Sign( xSbyte1 ) ) ); +} + +/* +This example produces the following results: + +Test the sign of the following types of values: +Byte : 0 is equal to zero. +Int16 : -2 is less than zero. +Int32 : -3 is less than zero. +Int64 : -4 is less than zero. +Single : 0 is equal to zero. +Double : 6 is greater than zero. +Decimal: -7 is less than zero. + +The following type is not CLS-compliant. +SByte : -101 is less than zero. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp b/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp new file mode 100644 index 00000000000..c576f3dc408 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/pathcombine/CPP/pathcombine.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; +using namespace System::IO; +void CombinePaths( String^ p1, String^ p2 ) +{ + try + { + String^ combination = Path::Combine( p1, p2 ); + Console::WriteLine( "When you combine '{0}' and '{1}', the result is: {2}'{3}'", p1, p2, Environment::NewLine, combination ); + } + catch ( Exception^ e ) + { + if (p1 == nullptr) + p1 = "nullptr"; + if (p2 == nullptr) + p2 = "nullptr"; + Console::WriteLine( "You cannot combine '{0}' and '{1}' because: {2}{3}", p1, p2, Environment::NewLine, e->Message ); + } + + Console::WriteLine(); +} + +int main() +{ + String^ path1 = "c:\\temp"; + String^ path2 = "subdir\\file.txt"; + String^ path3 = "c:\\temp.txt"; + String^ path4 = "c:^*&)(_=@#'\\^.*(.txt"; + String^ path5 = ""; + String^ path6 = nullptr; + CombinePaths( path1, path2 ); + CombinePaths( path1, path3 ); + CombinePaths( path3, path2 ); + CombinePaths( path4, path2 ); + CombinePaths( path5, path2 ); + CombinePaths( path6, path2 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp b/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp new file mode 100644 index 00000000000..0db73927f0c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/platformID.class/CPP/pid.cpp @@ -0,0 +1,39 @@ + +// +// This example demonstrates the PlatformID enumeration. +using namespace System; +int main() +{ + String^ msg1 = L"This is a Windows operating system."; + String^ msg2 = L"This is a Unix operating system."; + String^ msg3 = L"ERROR: This platform identifier is invalid."; + + // Assume this example is run on a Windows operating system. + OperatingSystem^ os = Environment::OSVersion; + PlatformID pid = os->Platform; + switch ( pid ) + { + case PlatformID::Win32NT: + case PlatformID::Win32S: + case PlatformID::Win32Windows: + case PlatformID::WinCE: + Console::WriteLine( msg1 ); + break; + + case PlatformID::Unix: + Console::WriteLine( msg2 ); + break; + + default: + Console::WriteLine( msg3 ); + break; + } + return 1; +} + +/* +This example produces the following results: + +This is a Windows operating system. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp new file mode 100644 index 00000000000..ea3629d178b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/datareceivedevent.cpp @@ -0,0 +1,55 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; +using namespace System::Text; + +ref class StandardAsyncOutputExample +{ +private: + static int lineCount = 0; + static StringBuilder^ output = nullptr; + +public: + static void Run() + { + Process^ process = gcnew Process(); + process->StartInfo->FileName = "ipconfig.exe"; + process->StartInfo->UseShellExecute = false; + process->StartInfo->RedirectStandardOutput = true; + output = gcnew StringBuilder(); + process->OutputDataReceived += gcnew DataReceivedEventHandler(OutputHandler); + process->Start(); + + // Asynchronously read the standard output of the spawned process. + // This raises OutputDataReceived events for each line of output. + process->BeginOutputReadLine(); + process->WaitForExit(); + + // Write the redirected output to this application's window. + Console::WriteLine(output); + + process->WaitForExit(); + process->Close(); + + Console::WriteLine("\n\nPress any key to exit"); + Console::ReadLine(); + } + +private: + static void OutputHandler(Object^ sender, DataReceivedEventArgs^ e) + { + // Prepend line numbers to each line of the output. + if (!String::IsNullOrEmpty(e->Data)) + { + lineCount++; + output->Append("\n[" + lineCount + "]: " + e->Data); + } + } +}; + +int main() +{ + StandardAsyncOutputExample::Run(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp new file mode 100644 index 00000000000..6dc1d4e11d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/net_async.cpp @@ -0,0 +1,227 @@ +// System.Diagnostics +// +// Requires .NET Framework version 1.2 or higher. + +// The following example uses the net view command to list the +// available network resources available on a remote computer, +// and displays the results to the console. Specifying the optional +// error log file redirects error output to that file. + +// +// Define the namespaces used by this sample. +#using + +using namespace System; +using namespace System::Text; +using namespace System::Globalization; +using namespace System::IO; +using namespace System::Diagnostics; +using namespace System::Threading; +using namespace System::ComponentModel; + +ref class ProcessNetStreamRedirection +{ +private: + // Define static variables shared by class methods. + static StreamWriter^ streamError = nullptr; + static String^ netErrorFile = ""; + static StringBuilder^ netOutput = nullptr; + static bool errorRedirect = false; + static bool errorsWritten = false; + +public: + static void RedirectNetCommandStreams() + { + String^ netArguments; + Process^ netProcess; + + // Get the input computer name. + Console::WriteLine( "Enter the computer name for the net view command:" ); + netArguments = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); + if ( String::IsNullOrEmpty( netArguments ) ) + { + // Default to the help command if there is not an input argument. + netArguments = "/?"; + } + + // Check if errors should be redirected to a file. + errorsWritten = false; + Console::WriteLine( "Enter a fully qualified path to an error log file" ); + Console::WriteLine( " or just press Enter to write errors to console:" ); + netErrorFile = Console::ReadLine()->ToUpper( CultureInfo::InvariantCulture ); + if ( !String::IsNullOrEmpty( netErrorFile ) ) + { + errorRedirect = true; + } + + // Note that at this point, netArguments and netErrorFile + // are set with user input. If the user did not specify + // an error file, then errorRedirect is set to false. + + // Initialize the process and its StartInfo properties. + netProcess = gcnew Process; + netProcess->StartInfo->FileName = "Net.exe"; + + // Build the net command argument list. + netProcess->StartInfo->Arguments = String::Format( "view {0}", netArguments ); + + // Set UseShellExecute to false for redirection. + netProcess->StartInfo->UseShellExecute = false; + + // Redirect the standard output of the net command. + // This stream is read asynchronously using an event handler. + netProcess->StartInfo->RedirectStandardOutput = true; + netProcess->OutputDataReceived += gcnew DataReceivedEventHandler( NetOutputDataHandler ); + netOutput = gcnew StringBuilder; + if ( errorRedirect ) + { + + // Redirect the error output of the net command. + netProcess->StartInfo->RedirectStandardError = true; + netProcess->ErrorDataReceived += gcnew DataReceivedEventHandler( NetErrorDataHandler ); + } + else + { + + // Do not redirect the error output. + netProcess->StartInfo->RedirectStandardError = false; + } + + Console::WriteLine( "\nStarting process: net {0}", + netProcess->StartInfo->Arguments ); + if ( errorRedirect ) + { + Console::WriteLine( "Errors will be written to the file {0}", netErrorFile ); + } + + // Start the process. + netProcess->Start(); + + // Start the asynchronous read of the standard output stream. + netProcess->BeginOutputReadLine(); + + if ( errorRedirect ) + { + // Start the asynchronous read of the standard + // error stream. + netProcess->BeginErrorReadLine(); + } + + // Let the net command run, collecting the output. + netProcess->WaitForExit(); + + if ( streamError != nullptr ) + { + // Close the error file. + streamError->Close(); + } + else + { + // Set errorsWritten to false if the stream is not + // open. Either there are no errors, or the error + // file could not be opened. + errorsWritten = false; + } + + if ( netOutput->Length > 0 ) + { + // If the process wrote more than just + // white space, write the output to the console. + Console::WriteLine( "\nPublic network shares from net view:\n{0}\n", + netOutput->ToString() ); + } + + if ( errorsWritten ) + { + // Signal that the error file had something + // written to it. + array^errorOutput = File::ReadAllLines( netErrorFile ); + if ( errorOutput->Length > 0 ) + { + Console::WriteLine( "\nThe following error output was appended to {0}.", + netErrorFile ); + System::Collections::IEnumerator^ myEnum = errorOutput->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ errLine = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", errLine ); + } + } + Console::WriteLine(); + } + + netProcess->Close(); + + } + +private: + static void NetOutputDataHandler( Object^ /*sendingProcess*/, + DataReceivedEventArgs^ outLine ) + { + // Collect the net view command output. + if ( !String::IsNullOrEmpty( outLine->Data ) ) + { + // Add the text to the collected output. + netOutput->AppendFormat( "\n {0}", outLine->Data ); + } + } + + static void NetErrorDataHandler( Object^ /*sendingProcess*/, + DataReceivedEventArgs^ errLine ) + { + // Write the error text to the file if there is something to + // write and an error file has been specified. + + if ( !String::IsNullOrEmpty( errLine->Data ) ) + { + if ( !errorsWritten ) + { + if ( streamError == nullptr ) + { + // Open the file. + try + { + streamError = gcnew StreamWriter( netErrorFile,true ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Could not open error file!" ); + Console::WriteLine( e->Message->ToString() ); + } + } + + if ( streamError != nullptr ) + { + // Write a header to the file if this is the first + // call to the error output handler. + streamError->WriteLine(); + streamError->WriteLine( DateTime::Now.ToString() ); + streamError->WriteLine( "Net View error output:" ); + } + errorsWritten = true; + } + + if ( streamError != nullptr ) + { + // Write redirected errors to the file. + streamError->WriteLine( errLine->Data ); + streamError->Flush(); + } + } + } +}; +// + +/// The main entry point for the application. +void main() +{ + try + { + ProcessNetStreamRedirection::RedirectNetCommandStreams(); + } + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( "Exception:" ); + Console::WriteLine( e ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp new file mode 100644 index 00000000000..037704e8279 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/nmake_async.cpp @@ -0,0 +1,258 @@ +// System.Diagnostics +// +// Requires .NET Framework version 1.2 or higher. + +// Define the namespaces used by this sample. +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Diagnostics; +using namespace System::Threading; +using namespace System::ComponentModel; + +// +ref class ProcessNMakeStreamRedirection +{ +private: + // Define static variables shared by class methods. + static StreamWriter^ buildLogStream = nullptr; + static Mutex^ logMutex = gcnew Mutex; + static int maxLogLines = 25; + static int currentLogLines = 0; + +public: + static void RedirectNMakeCommandStreams() + { + String^ nmakeArguments = nullptr; + Process^ nmakeProcess; + + // Get the input nmake command-line arguments. + Console::WriteLine( "Enter the NMake command line arguments (@commandfile or /f makefile, etc):" ); + String^ inputText = Console::ReadLine(); + if ( !String::IsNullOrEmpty( inputText ) ) + { + nmakeArguments = inputText; + } + + Console::WriteLine( "Enter max line limit for log file (default is 25):" ); + inputText = Console::ReadLine(); + if ( !String::IsNullOrEmpty( inputText ) ) + { + if ( !Int32::TryParse( inputText, maxLogLines ) ) + { + maxLogLines = 25; + } + } + Console::WriteLine( "Output beyond {0} lines will be ignored.", + maxLogLines.ToString() ); + + // Initialize the process and its StartInfo properties. + nmakeProcess = gcnew Process; + nmakeProcess->StartInfo->FileName = "NMake.exe"; + + // Build the nmake command argument list. + if ( !String::IsNullOrEmpty( nmakeArguments ) ) + { + nmakeProcess->StartInfo->Arguments = nmakeArguments; + } + + // Set UseShellExecute to false for redirection. + nmakeProcess->StartInfo->UseShellExecute = false; + + // Redirect the standard output of the nmake command. + // Read the stream asynchronously using an event handler. + nmakeProcess->StartInfo->RedirectStandardOutput = true; + nmakeProcess->OutputDataReceived += gcnew DataReceivedEventHandler( NMakeOutputDataHandler ); + + // Redirect the error output of the nmake command. + nmakeProcess->StartInfo->RedirectStandardError = true; + nmakeProcess->ErrorDataReceived += gcnew DataReceivedEventHandler( NMakeErrorDataHandler ); + + logMutex->WaitOne(); + + currentLogLines = 0; + + // Write a header to the log file. + String^ buildLogFile = "NmakeCmd.Txt"; + try + { + buildLogStream = gcnew StreamWriter( buildLogFile,true ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Could not open output file {0}", buildLogFile ); + Console::WriteLine( "Exception = {0}", e->ToString() ); + Console::WriteLine( e->Message->ToString() ); + + buildLogStream = nullptr; + } + + if ( buildLogStream != nullptr ) + { + Console::WriteLine( "Nmake output logged to {0}", buildLogFile ); + + buildLogStream->WriteLine(); + buildLogStream->WriteLine( DateTime::Now.ToString() ); + if ( !String::IsNullOrEmpty( nmakeArguments ) ) + { + buildLogStream->Write( "Command line = NMake {0}", nmakeArguments ); + } + else + { + buildLogStream->Write( "Command line = Nmake" ); + } + buildLogStream->WriteLine(); + buildLogStream->Flush(); + + logMutex->ReleaseMutex(); + + // Start the process. + Console::WriteLine(); + Console::WriteLine( "\nStarting Nmake command" ); + Console::WriteLine(); + nmakeProcess->Start(); + + // Start the asynchronous read of the output stream. + nmakeProcess->BeginOutputReadLine(); + + // Start the asynchronous read of the error stream. + nmakeProcess->BeginErrorReadLine(); + + // Let the nmake command run, collecting the output. + nmakeProcess->WaitForExit(); + + nmakeProcess->Close(); + buildLogStream->Close(); + logMutex->Dispose(); + } + } + +private: + static void NMakeOutputDataHandler( Object^ sendingProcess, + DataReceivedEventArgs^ outLine ) + { + // Collect the output, displaying it to the screen and + // logging it to the output file. Cancel the read + // operation when the maximum line limit is reached. + + if ( !String::IsNullOrEmpty( outLine->Data ) ) + { + logMutex->WaitOne(); + + currentLogLines++; + if ( currentLogLines > maxLogLines ) + { + // Display the line to the console. + // Skip writing the line to the log file. + Console::WriteLine( "StdOut: {0}", outLine->Data->ToString() ); + } + else + if ( currentLogLines == maxLogLines ) + { + LogToFile( "StdOut", "", true ); + + // Stop reading the output streams. + Process^ p = dynamic_cast(sendingProcess); + if ( p != nullptr ) + { + p->CancelOutputRead(); + p->CancelErrorRead(); + } + } + else + { + // Write the line to the log file. + LogToFile( "StdOut", outLine->Data, true ); + } + logMutex->ReleaseMutex(); + } + } + + static void NMakeErrorDataHandler( Object^ sendingProcess, + DataReceivedEventArgs^ errLine ) + { + + // Collect the error output, displaying it to the screen and + // logging it to the output file. Cancel the error output + // read operation when the maximum line limit is reached. + + if ( !String::IsNullOrEmpty( errLine->Data ) ) + { + logMutex->WaitOne(); + + currentLogLines++; + if ( currentLogLines > maxLogLines ) + { + + // Display the line to the console. + // Skip writing the line to the log file. + Console::WriteLine( "StdErr: {0}", errLine->Data->ToString() ); + } + else + if ( currentLogLines == maxLogLines ) + { + LogToFile( "StdOut", "", true ); + + // Stop reading the output streams. + Process^ p = dynamic_cast(sendingProcess); + if ( p != nullptr ) + { + p->CancelOutputRead(); + p->CancelErrorRead(); + } + } + else + { + // Write the line to the log file. + LogToFile( "StdErr", errLine->Data, true ); + } + logMutex->ReleaseMutex(); + } + } + + static void LogToFile( String^ logPrefix, String^ logText, + bool echoToConsole ) + { + // Write the specified line to the log file stream. + StringBuilder^ logString = gcnew StringBuilder; + + if ( !String::IsNullOrEmpty( logPrefix ) ) + { + logString->AppendFormat( "{0}> ", logPrefix ); + } + + if ( !String::IsNullOrEmpty( logText ) ) + { + logString->Append( logText ); + } + + if ( buildLogStream != nullptr ) + { + buildLogStream->WriteLine( "[{0}] {1}", + DateTime::Now.ToString(), logString->ToString() ); + buildLogStream->Flush(); + } + + if ( echoToConsole ) + { + Console::WriteLine( logString->ToString() ); + } + } +}; +// + +/// The main entry point for the application. +void main() +{ + try + { + ProcessNMakeStreamRedirection::RedirectNMakeCommandStreams(); + } + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( "Exception:" ); + Console::WriteLine( e ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp new file mode 100644 index 00000000000..87b8730cbc4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/process_asyncstreams/CPP/sort_async.cpp @@ -0,0 +1,136 @@ +// System.Diagnostics +// +// Requires .NET Framework version 1.2 or higher. + +// The following example uses the sort command to sort a list +// of input text lines, and displays the sorted list to the console. + +// +// Define the namespaces used by this sample. +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Diagnostics; +using namespace System::Threading; +using namespace System::ComponentModel; + +ref class SortOutputRedirection +{ +private: + // Define static variables shared by class methods. + static StringBuilder^ sortOutput = nullptr; + static int numOutputLines = 0; + +public: + static void SortInputListText() + { + // Initialize the process and its StartInfo properties. + // The sort command is a console application that + // reads and sorts text input. + + Process^ sortProcess; + sortProcess = gcnew Process; + sortProcess->StartInfo->FileName = "Sort.exe"; + + // Set UseShellExecute to false for redirection. + sortProcess->StartInfo->UseShellExecute = false; + + // Redirect the standard output of the sort command. + // This stream is read asynchronously using an event handler. + sortProcess->StartInfo->RedirectStandardOutput = true; + sortOutput = gcnew StringBuilder; + + // Set our event handler to asynchronously read the sort output. + sortProcess->OutputDataReceived += gcnew DataReceivedEventHandler( SortOutputHandler ); + + // Redirect standard input as well. This stream + // is used synchronously. + sortProcess->StartInfo->RedirectStandardInput = true; + + // Start the process. + sortProcess->Start(); + + // Use a stream writer to synchronously write the sort input. + StreamWriter^ sortStreamWriter = sortProcess->StandardInput; + + // Start the asynchronous read of the sort output stream. + sortProcess->BeginOutputReadLine(); + + // Prompt the user for input text lines. Write each + // line to the redirected input stream of the sort command. + Console::WriteLine( "Ready to sort up to 50 lines of text" ); + + String^ inputText; + int numInputLines = 0; + do + { + Console::WriteLine( "Enter a text line (or press the Enter key to stop):" ); + + inputText = Console::ReadLine(); + if ( !String::IsNullOrEmpty( inputText ) ) + { + numInputLines++; + sortStreamWriter->WriteLine( inputText ); + } + } + while ( !String::IsNullOrEmpty( inputText ) && (numInputLines < 50) ); + + Console::WriteLine( "" ); + Console::WriteLine(); + + // End the input stream to the sort command. + sortStreamWriter->Close(); + + // Wait for the sort process to write the sorted text lines. + sortProcess->WaitForExit(); + + if ( numOutputLines > 0 ) + { + + // Write the formatted and sorted output to the console. + Console::WriteLine( " Sort results = {0} sorted text line(s) ", + numOutputLines.ToString() ); + Console::WriteLine( "----------" ); + Console::WriteLine( sortOutput->ToString() ); + } + else + { + Console::WriteLine( " No input lines were sorted." ); + } + + sortProcess->Close(); + } + +private: + static void SortOutputHandler( Object^ /*sendingProcess*/, + DataReceivedEventArgs^ outLine ) + { + // Collect the sort command output. + if ( !String::IsNullOrEmpty( outLine->Data ) ) + { + numOutputLines++; + + // Add the text to the collected output. + sortOutput->AppendFormat( "\n[{0}] {1}", + numOutputLines.ToString(), outLine->Data ); + } + } +}; + +/// The main entry point for the application. +void main() +{ + try + { + SortOutputRedirection::SortInputListText(); + } + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( "Exception:" ); + Console::WriteLine( e ); + } +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp b/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp new file mode 100644 index 00000000000..5289fe8f30b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/process_refresh/CPP/process_refresh.cpp @@ -0,0 +1,60 @@ + + +// System::Diagnostics::Process::Refresh +// System::Diagnostics::Process::HasExited +// System::Diagnostics::Process::Close +// System::Diagnostics::Process::CloseMainWindow +// The following example starts an instance of Notepad. It then +// retrieves the physical memory usage of the associated process at +// 2 second intervals for a maximum of 10 seconds. The example detects +// whether the process exits before 10 seconds have elapsed. +// The example closes the process if it is still running after +// 10 seconds. +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + try + { + Process^ myProcess; + myProcess = Process::Start( "Notepad.exe" ); + + // Display physical memory usage 5 times at intervals of 2 seconds. + for ( int i = 0; i < 5; i++ ) + { + if ( !myProcess->HasExited ) + { + + // Discard cached information about the process. + myProcess->Refresh(); + + // Print working set to console. + Console::WriteLine( "Physical Memory Usage : {0}", myProcess->WorkingSet.ToString() ); + + // Wait 2 seconds. + Thread::Sleep( 2000 ); + } + else + { + break; + } + + } + myProcess->CloseMainWindow(); + + // Free resources associated with process. + myProcess->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: " ); + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp b/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp new file mode 100644 index 00000000000..db06be9bee1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/process_sample/CPP/process_sample.cpp @@ -0,0 +1,73 @@ + + +// System::Diagnostics::Process::WorkingSet +// System::Diagnostics::Process::BasePriority +// System::Diagnostics::Process::UserProcessorTime +// System::Diagnostics::Process::PrivilegedProcessorTime +// System::Diagnostics::Process::TotalProcessorTime +// System::Diagnostics::Process::ToString +// System::Diagnostics::Process::Responding +// System::Diagnostics::Process::PriorityClass +// System::Diagnostics::Process::ExitCode +// The following example starts an instance of Notepad. The example +// then retrieves and displays various properties of the associated +// process. The example detects when the process exits, and displays the process's exit code. +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + try + { + Process^ myProcess; + myProcess = Process::Start( "NotePad.exe" ); + while ( !myProcess->HasExited ) + { + Console::WriteLine(); + + // Get physical memory usage of the associated process. + Console::WriteLine( "Process's physical memory usage: {0}", myProcess->WorkingSet.ToString() ); + + // Get base priority of the associated process. + Console::WriteLine( "Base priority of the associated process: {0}", myProcess->BasePriority.ToString() ); + + // Get priority class of the associated process. + Console::WriteLine( "Priority class of the associated process: {0}", myProcess->PriorityClass ); + + // Get user processor time for this process. + Console::WriteLine( "User Processor Time: {0}", myProcess->UserProcessorTime.ToString() ); + + // Get privileged processor time for this process. + Console::WriteLine( "Privileged Processor Time: {0}", myProcess->PrivilegedProcessorTime.ToString() ); + + // Get total processor time for this process. + Console::WriteLine( "Total Processor Time: {0}", myProcess->TotalProcessorTime.ToString() ); + + // Invoke overloaded ToString function. + Console::WriteLine( "Process's Name: {0}", myProcess->ToString() ); + Console::WriteLine( "-------------------------------------" ); + if ( myProcess->Responding ) + { + Console::WriteLine( "Status: Responding to user interface" ); + myProcess->Refresh(); + } + else + { + Console::WriteLine( "Status: Not Responding" ); + } + Thread::Sleep( 1000 ); + } + Console::WriteLine(); + Console::WriteLine( "Process exit code: {0}", myProcess->ExitCode.ToString() ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp b/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp new file mode 100644 index 00000000000..8695804de6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/regex match, nextmatch, groups, captures/cpp/snippet8.cpp @@ -0,0 +1,52 @@ +// +#using + +using namespace System; +using namespace System::Text::RegularExpressions; +void main() +{ + + String^ text = "One car red car blue car"; + String^ pat = "(\\w+)\\s+(car)"; + + // Compile the regular expression. + Regex^ r = gcnew Regex( pat,RegexOptions::IgnoreCase ); + + // Match the regular expression pattern against a text string. + Match^ m = r->Match(text); + int matchCount = 0; + while ( m->Success ) + { + Console::WriteLine( "Match{0}", ++matchCount ); + for ( int i = 1; i <= 2; i++ ) + { + Group^ g = m->Groups[ i ]; + Console::WriteLine( "Group{0}='{1}'", i, g ); + CaptureCollection^ cc = g->Captures; + for ( int j = 0; j < cc->Count; j++ ) + { + Capture^ c = cc[ j ]; + System::Console::WriteLine( "Capture{0}='{1}', Position={2}", j, c, c->Index ); + } + } + m = m->NextMatch(); + } +} +// This example displays the following output: +// Match1 +// Group1='One' +// Capture0='One', Position=0 +// Group2='car' +// Capture0='car', Position=4 +// Match2 +// Group1='red' +// Capture0='red', Position=8 +// Group2='car' +// Capture0='car', Position=12 +// Match3 +// Group1='blue' +// Capture0='blue', Position=16 +// Group2='car' +// Capture0='car', Position=21 +// + diff --git a/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp b/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp new file mode 100644 index 00000000000..0494e4ad274 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/rfc28981/CPP/rfc28981.cpp @@ -0,0 +1,96 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Security::Cryptography; + +// Generate a key k1 with password pwd1 and salt salt1. +// Generate a key k2 with password pwd1 and salt salt1. +// Encrypt data1 with key k1 using symmetric encryption, creating edata1. +// Decrypt edata1 with key k2 using symmetric decryption, creating data2. +// data2 should equal data1. + +int main() +{ + array^passwordargs = Environment::GetCommandLineArgs(); + String^ usageText = "Usage: RFC2898 \nYou must specify the password for encryption.\n"; + + //If no file name is specified, write usage text. + if ( passwordargs->Length == 1 ) + { + Console::WriteLine( usageText ); + } + else + { + // + String^ pwd1 = passwordargs[ 1 ]; + + array^salt1 = gcnew array(8); + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + rng->GetBytes(salt1); + //data1 can be a string or contents of a file. + String^ data1 = "Some test data"; + + // + //The default iteration count is 1000 so the two methods use the same iteration count. + int myIterations = 1000; + // + + // + try + { + // + Rfc2898DeriveBytes ^ k1 = gcnew Rfc2898DeriveBytes( pwd1,salt1,myIterations ); + Rfc2898DeriveBytes ^ k2 = gcnew Rfc2898DeriveBytes( pwd1,salt1 ); + // + + // Encrypt the data. + Aes^ encAlg = Aes::Create(); + encAlg->Key = k1->GetBytes( 16 ); + MemoryStream^ encryptionStream = gcnew MemoryStream; + CryptoStream^ encrypt = gcnew CryptoStream( encryptionStream,encAlg->CreateEncryptor(),CryptoStreamMode::Write ); + array^utfD1 = (gcnew System::Text::UTF8Encoding( false ))->GetBytes( data1 ); + // + + encrypt->Write( utfD1, 0, utfD1->Length ); + encrypt->FlushFinalBlock(); + encrypt->Close(); + array^edata1 = encryptionStream->ToArray(); + k1->Reset(); + + // Try to decrypt, thus showing it can be round-tripped. + Aes^ decAlg = Aes::Create(); + decAlg->Key = k2->GetBytes( 16 ); + decAlg->IV = encAlg->IV; + MemoryStream^ decryptionStreamBacking = gcnew MemoryStream; + CryptoStream^ decrypt = gcnew CryptoStream( decryptionStreamBacking,decAlg->CreateDecryptor(),CryptoStreamMode::Write ); + + // + decrypt->Write( edata1, 0, edata1->Length ); + decrypt->Flush(); + decrypt->Close(); + k2->Reset(); + // + + String^ data2 = (gcnew UTF8Encoding( false ))->GetString( decryptionStreamBacking->ToArray() ); + if ( !data1->Equals( data2 ) ) + { + Console::WriteLine( "Error: The two values are not equal." ); + } + else + { + Console::WriteLine( "The two values are equal." ); + Console::WriteLine( "k1 iterations: {0}", k1->IterationCount ); + Console::WriteLine( "k2 iterations: {0}", k2->IterationCount ); + } + // + } + + catch ( Exception^ e ) + { + Console::WriteLine( "Error: ", e ); + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp new file mode 100644 index 00000000000..985c85cb847 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf7/CPP/lastixof7.cpp @@ -0,0 +1,39 @@ + +// +// Sample for String::LastIndexOf(String, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + start = str->Length - 1; + Console::WriteLine( "All occurrences of 'he' from position {0} to 0.", start ); + Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str ); + Console::Write( "The string 'he' occurs at position(s): " ); + at = 0; + while ( (start > -1) && (at > -1) ) + { + at = str->LastIndexOf( "he", start ); + if ( at > -1 ) + { + Console::Write( " {0} ", at ); + start = at - 1; + } + } + + Console::WriteLine(); +} + +/* +This example produces the following results: +All occurrences of 'he' from position 66 to 0. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +The string 'he' occurs at position(s): 56 45 8 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp new file mode 100644 index 00000000000..707743dd829 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOf8/CPP/lastixof8.cpp @@ -0,0 +1,44 @@ + +// +// Sample for String::LastIndexOf(String, Int32, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + int count; + int end; + start = str->Length - 1; + end = start / 2 - 1; + Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "The string 'he' occurs at position(s): " ); + count = 0; + at = 0; + while ( (start > -1) && (at > -1) ) + { + count = start - end; //Count must be within the substring. + at = str->LastIndexOf( "he", start, count ); + if ( at > -1 ) + { + Console::Write( "{0} ", at ); + start = at - 1; + } + } + + Console::Write( "{0} {0} {0}", Environment::NewLine ); +} + +/* +This example produces the following results: +All occurrences of 'he' from position 66 to 32. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +The string 'he' occurs at position(s): 56 45 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp new file mode 100644 index 00000000000..545ffd356be --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny1/CPP/lastixany1.cpp @@ -0,0 +1,38 @@ + +// +// Sample for String::LastIndexOfAny(Char[]) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + String^ target = "is"; + array^anyOf = target->ToCharArray(); + start = str->Length - 1; + Console::WriteLine( "The last character occurrence from position {0} to 0.", start ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "A character in '{0}' occurs at position: ", target ); + at = str->LastIndexOfAny( anyOf ); + if ( at > -1 ) + Console::Write( at ); + else + Console::Write( "(not found)" ); + + Console::Write( "{0}{0}{0}", Environment::NewLine ); +} + +/* +This example produces the following results: +The last character occurrence from position 66 to 0. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +A character in 'is' occurs at position: 58 + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp new file mode 100644 index 00000000000..4328318576a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny2/CPP/lastixany2.cpp @@ -0,0 +1,38 @@ + +// +// Sample for String::LastIndexOfAny(Char, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + String^ target = "is"; + array^anyOf = target->ToCharArray(); + start = (str->Length - 1) / 2; + Console::WriteLine( "The last character occurrence from position {0} to 0.", start ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "A character in '{0}' occurs at position: ", target ); + at = str->LastIndexOfAny( anyOf, start ); + if ( at > -1 ) + Console::Write( at ); + else + Console::Write( "(not found)" ); + + Console::Write( "{0}{0}{0}", Environment::NewLine ); +} + +/* +This example produces the following results: +The last character occurrence from position 33 to 0. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +A character in 'is' occurs at position: 12 + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp new file mode 100644 index 00000000000..2c3f5ecd695 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.LastIndexOfAny3/CPP/lastixany3.cpp @@ -0,0 +1,38 @@ + +// +// Sample for String::LastIndexOfAny(Char[], Int32, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + int count; + String^ target = "aid"; + array^anyOf = target->ToCharArray(); + start = ((str->Length - 1) * 2) / 3; + count = (str->Length - 1) / 3; + Console::WriteLine( "The last character occurrence from position {0} for {1} characters.", start, count ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "A character in '{0}' occurs at position: ", target ); + at = str->LastIndexOfAny( anyOf, start, count ); + if ( at > -1 ) + Console::Write( at ); + else + Console::Write( "(not found)" ); + + Console::Write( "{0}{0}{0}", Environment::NewLine ); +} + +/* +This example produces the following results: +The last character occurrence from position 44 for 22 characters. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +A character in 'aid' occurs at position: 27 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp b/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp new file mode 100644 index 00000000000..338ffdc3b4f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.ToCharArray1/CPP/tocharry1.cpp @@ -0,0 +1,32 @@ + +// +// Sample for String::ToCharArray(Int32, Int32) +using namespace System; +using namespace System::Collections; +int main() +{ + String^ str = "012wxyz789"; + array^arr; + arr = str->ToCharArray( 3, 4 ); + Console::Write( "The letters in '{0}' are: '", str ); + Console::Write( arr ); + Console::WriteLine( "'" ); + Console::WriteLine( "Each letter in '{0}' is:", str ); + IEnumerator^ myEnum = arr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::WriteLine( c ); + } +} + +/* +This example produces the following results: +The letters in '012wxyz789' are: 'wxyz' +Each letter in '012wxyz789' is: +w +x +y +z +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp new file mode 100644 index 00000000000..67cba53ecab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.comp4/CPP/string.comp4.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::Globalization; +String^ symbol( int r ) +{ + String^ s = "="; + if ( r < 0 ) + s = "<"; + else + if ( r > 0 ) + s = ">"; + + + return s; +} + +int main() +{ + String^ str1 = "change"; + String^ str2 = "dollar"; + String^ relation = nullptr; + relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "en-US" ) ) ); + Console::WriteLine( "For en-US: {0} {1} {2}", str1, relation, str2 ); + relation = symbol( String::Compare( str1, str2, false, gcnew CultureInfo( "cs-CZ" ) ) ); + Console::WriteLine( "For cs-CZ: {0} {1} {2}", str1, relation, str2 ); +} + +/* +This example produces the following results. +For en-US: change < dollar +For cs-CZ: change > dollar +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp new file mode 100644 index 00000000000..069e685cc76 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.compare3/CPP/comp3.cpp @@ -0,0 +1,28 @@ + +// +// Sample for String::Compare(String, Int32, String, Int32, Int32) +using namespace System; +int main() +{ + + // 0123456 + String^ str1 = "machine"; + String^ str2 = "device"; + String^ str; + int result; + Console::WriteLine(); + Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); + result = String::Compare( str1, 2, str2, 0, 2 ); + str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); + Console::Write( "Substring '{0}' in ' {1}' is ", str1->Substring( 2, 2 ), str1 ); + Console::Write( " {0} ", str ); + Console::WriteLine( "substring '{0}' in ' {1}'.", str2->Substring( 0, 2 ), str2 ); +} + +/* +This example produces the following results: + +str1 = 'machine', str2 = 'device' +Substring 'ch' in 'machine' is less than substring 'de' in 'device'. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp new file mode 100644 index 00000000000..0e2fd3df934 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.compare4/CPP/comp4.cpp @@ -0,0 +1,40 @@ + +// +// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean) +using namespace System; +int main() +{ + + // 0123456 + String^ str1 = "MACHINE"; + String^ str2 = "machine"; + String^ str; + int result; + Console::WriteLine(); + Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); + Console::WriteLine( "Ignore case:" ); + result = String::Compare( str1, 2, str2, 2, 2, true ); + str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); + Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 ); + Console::Write( " {0} ", str ); + Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 ); + Console::WriteLine(); + Console::WriteLine( "Honor case:" ); + result = String::Compare( str1, 2, str2, 2, 2, false ); + str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); + Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 2, 2 ), str1 ); + Console::Write( " {0} ", str ); + Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 2, 2 ), str2 ); +} + +/* +This example produces the following results: + +str1 = 'MACHINE', str2 = 'machine' +Ignore case: +Substring 'CH' in 'MACHINE' is equal to substring 'ch' in 'machine'. + +Honor case: +Substring 'CH' in 'MACHINE' is greater than substring 'ch' in 'machine'. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp b/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp new file mode 100644 index 00000000000..3afdbfd074c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.compare5/CPP/comp5.cpp @@ -0,0 +1,41 @@ + +// +// Sample for String::Compare(String, Int32, String, Int32, Int32, Boolean, CultureInfo) +using namespace System; +using namespace System::Globalization; +int main() +{ + + // 0123456 + String^ str1 = "MACHINE"; + String^ str2 = "machine"; + String^ str; + int result; + Console::WriteLine(); + Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); + Console::WriteLine( "Ignore case, Turkish culture:" ); + result = String::Compare( str1, 4, str2, 4, 2, true, gcnew CultureInfo( "tr-TR" ) ); + str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); + Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 ); + Console::Write( " {0} ", str ); + Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 ); + Console::WriteLine(); + Console::WriteLine( "Ignore case, invariant culture:" ); + result = String::Compare( str1, 4, str2, 4, 2, true, CultureInfo::InvariantCulture ); + str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); + Console::Write( "Substring '{0}' in '{1}' is ", str1->Substring( 4, 2 ), str1 ); + Console::Write( " {0} ", str ); + Console::WriteLine( "substring '{0}' in '{1}'.", str2->Substring( 4, 2 ), str2 ); +} + +/* +This example produces the following results: + +str1 = 'MACHINE', str2 = 'machine' +Ignore case, Turkish culture: +Substring 'IN' in 'MACHINE' is less than substring 'in' in 'machine'. + +Ignore case, invariant culture: +Substring 'IN' in 'MACHINE' is equal to substring 'in' in 'machine'. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp b/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp new file mode 100644 index 00000000000..52112724b74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.compareordinal/CPP/comp0.cpp @@ -0,0 +1,28 @@ + +// +// Sample for String::CompareOrdinal(String, String) +using namespace System; +int main() +{ + String^ str1 = "ABCD"; + String^ str2 = "abcd"; + String^ str; + int result; + Console::WriteLine(); + Console::WriteLine( "Compare the numeric values of the corresponding Char objects in each string." ); + Console::WriteLine( "str1 = '{0}', str2 = '{1}'", str1, str2 ); + result = String::CompareOrdinal( str1, str2 ); + str = ((result < 0) ? "less than" : ((result > 0) ? (String^)"greater than" : "equal to")); + Console::Write( "String '{0}' is ", str1 ); + Console::Write( "{0} ", str ); + Console::WriteLine( "String '{0}'.", str2 ); +} + +/* +This example produces the following results: + +Compare the numeric values of the corresponding Char objects in each string. +str1 = 'ABCD', str2 = 'abcd' +String 'ABCD' is less than String 'abcd'. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp b/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp new file mode 100644 index 00000000000..4b457f0078d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.concat5/CPP/string.concat5.cpp @@ -0,0 +1,33 @@ + +// +using namespace System; + +int main() +{ + int i = -123; + Object^ o = i; + array^objs = { -123, -456, -789}; + Console::WriteLine("Concatenate 1, 2, and 3 objects:"); + Console::WriteLine("1) {0}", String::Concat(o)); + Console::WriteLine("2) {0}", String::Concat(o, o)); + Console::WriteLine("3) {0}", String::Concat(o, o, o)); + + Console::WriteLine("\nConcatenate 4 objects and a variable length parameter list:" ); + Console::WriteLine("4) {0}", String::Concat(o, o, o, o)); + Console::WriteLine("5) {0}", String::Concat( o, o, o, o, o)); + Console::WriteLine("\nConcatenate a 3-element object array:"); + Console::WriteLine("6) {0}", String::Concat(objs)); +} +// The example displays the following output: +// Concatenate 1, 2, and 3 objects: +// 1) -123 +// 2) -123-123 +// 3) -123-123-123 +// +// Concatenate 4 objects and a variable length parameter list: +// 4) -123-123-123-123 +// 5) -123-123-123-123-123 +// +// Concatenate a 3-element object array: +// 6) -123-456-789 +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp b/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp new file mode 100644 index 00000000000..d9beeec7af6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.contains/CPP/cont.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; + +int main() +{ + String^ s1 = "The quick brown fox jumps over the lazy dog"; + String^ s2 = "fox"; + bool b = s1->Contains( s2 ); + Console::WriteLine( "Is the string, s2, in the string, s1?: {0}", b ); + if (b) { + int index = s1->IndexOf(s2); + if (index >= 0) + Console::WriteLine("'{0} begins at character position {1}", + s2, index + 1); + } +} +// This example displays the following output: +// 'fox' is in the string 'The quick brown fox jumps over the lazy dog': True +// 'fox begins at character position 17 +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp new file mode 100644 index 00000000000..94de0334063 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.equals/CPP/equals.cpp @@ -0,0 +1,55 @@ + +// +// Sample for String::Equals(Object) +// String::Equals(String) +// String::Equals(String, String) +using namespace System; +using namespace System::Text; +int main() +{ + StringBuilder^ sb = gcnew StringBuilder( "abcd" ); + String^ str1 = "abcd"; + String^ str2 = nullptr; + Object^ o2 = nullptr; + Console::WriteLine(); + Console::WriteLine( " * The value of String str1 is '{0}'.", str1 ); + Console::WriteLine( " * The value of StringBuilder sb is '{0}'.", sb ); + Console::WriteLine(); + Console::WriteLine( "1a) String::Equals(Object). Object is a StringBuilder, not a String." ); + Console::WriteLine( " Is str1 equal to sb?: {0}", str1->Equals( sb ) ); + Console::WriteLine(); + Console::WriteLine( "1b) String::Equals(Object). Object is a String." ); + str2 = sb->ToString(); + o2 = str2; + Console::WriteLine( " * The value of Object o2 is '{0}'.", o2 ); + Console::WriteLine( " Is str1 equal to o2?: {0}", str1->Equals( o2 ) ); + Console::WriteLine(); + Console::WriteLine( " 2) String::Equals(String)" ); + Console::WriteLine( " * The value of String str2 is '{0}'.", str2 ); + Console::WriteLine( " Is str1 equal to str2?: {0}", str1->Equals( str2 ) ); + Console::WriteLine(); + Console::WriteLine( " 3) String::Equals(String, String)" ); + Console::WriteLine( " Is str1 equal to str2?: {0}", String::Equals( str1, str2 ) ); +} + +/* +This example produces the following results: + + * The value of String str1 is 'abcd'. + * The value of StringBuilder sb is 'abcd'. + +1a) String::Equals(Object). Object is a StringBuilder, not a String. + Is str1 equal to sb?: False + +1b) String::Equals(Object). Object is a String. + * The value of Object o2 is 'abcd'. + Is str1 equal to o2?: True + + 2) String::Equals(String) + * The value of String str2 is 'abcd'. + Is str1 equal to str2?: True + + 3) String::Equals(String, String) + Is str1 equal to str2?: True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp b/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp new file mode 100644 index 00000000000..536db349ec4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.gettypecode/CPP/gtc.cpp @@ -0,0 +1,16 @@ + +// +// Sample for String.GetTypeCode() +using namespace System; +int main() +{ + String^ str = "abc"; + TypeCode tc = str->GetTypeCode(); + Console::WriteLine( "The type code for '{0}' is {1}, which represents {2}.", str, tc.ToString( "D" ), tc.ToString( "F" ) ); +} + +/* +This example produces the following results: +The type code for 'abc' is 18, which represents String. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp new file mode 100644 index 00000000000..30d08ce5ace --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.indexof1/CPP/ixof1.cpp @@ -0,0 +1,42 @@ + +// +// Sample for String::IndexOf(Char, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + Console::WriteLine(); + Console::WriteLine( "All occurrences of 't' from position 0 to {0}.", str->Length - 1 ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "The letter 't' occurs at position(s): " ); + at = 0; + start = 0; + while ( (start < str->Length) && (at > -1) ) + { + at = str->IndexOf( 't', start ); + if ( at == -1 ) + break; + + Console::Write( "{0} ", at ); + start = at + 1; + } + + Console::WriteLine(); +} + +/* +This example produces the following results: + +All occurrences of 't' from position 0 to 66. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +The letter 't' occurs at position(s): 7 11 33 41 44 55 64 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp new file mode 100644 index 00000000000..f8a1385b749 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.indexof8/CPP/ixof8.cpp @@ -0,0 +1,49 @@ + +// +// Sample for String::IndexOf(String, Int32, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + int end; + int count; + end = str->Length; + start = end / 2; + Console::WriteLine(); + Console::WriteLine( "All occurrences of 'he' from position {0} to {1}.", start, end - 1 ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "The string 'he' occurs at position(s): " ); + count = 0; + at = 0; + while ( (start <= end) && (at > -1) ) + { + + // start+count must be a position within -str-. + count = end - start; + at = str->IndexOf( "he", start, count ); + if ( at == -1 ) + break; + + Console::Write( "{0} ", at ); + start = at + 1; + } + + Console::WriteLine(); +} + +/* +This example produces the following results: + +All occurrences of 'he' from position 33 to 66. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +The string 'he' occurs at position(s): 45 56 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp new file mode 100644 index 00000000000..47b0a1db97c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.indexofany2/CPP/ixany2.cpp @@ -0,0 +1,38 @@ + +// +// Sample for String::IndexOfAny(Char[], Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + String^ target = "is"; + array^anyOf = target->ToCharArray(); + start = str->Length / 2; + Console::WriteLine(); + Console::WriteLine( "The first character occurrence from position {0} to {1}.", start, str->Length - 1 ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "A character in '{0}' occurs at position: ", target ); + at = str->IndexOfAny( anyOf, start ); + if ( at > -1 ) + Console::Write( at ); + else + Console::Write( "(not found)" ); + + Console::WriteLine(); +} + +/* + +The first character occurrence from position 33 to 66. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +A character in 'is' occurs at position: 49 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp b/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp new file mode 100644 index 00000000000..4bd03080726 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.indexofany3/CPP/ixany3.cpp @@ -0,0 +1,40 @@ + +// +// Sample for String::IndexOfAny(Char[], Int32, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + int count; + String^ target = "aid"; + array^anyOf = target->ToCharArray(); + start = (str->Length - 1) / 3; + count = (str->Length - 1) / 4; + Console::WriteLine(); + Console::WriteLine( "The first character occurrence from position {0} for {1} characters.", start, count ); + Console::WriteLine( "{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + Console::Write( "A character in '{0}' occurs at position: ", target ); + at = str->IndexOfAny( anyOf, start, count ); + if ( at > -1 ) + Console::Write( at ); + else + Console::Write( "(not found)" ); + + Console::WriteLine(); +} + +/* + +The first character occurrence from position 22 for 16 characters. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +A character in 'aid' occurs at position: 27 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp b/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp new file mode 100644 index 00000000000..b70c604b0b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.intern/CPP/string_intern.cpp @@ -0,0 +1,26 @@ + +// +// Sample for String::Intern(String) +using namespace System; +using namespace System::Text; +int main() +{ + String^ s1 = "MyTest"; + String^ s2 = (gcnew StringBuilder)->Append( "My" )->Append( "Test" )->ToString(); + String^ s3 = String::Intern( s2 ); + Console::WriteLine( "s1 == '{0}'", s1 ); + Console::WriteLine( "s2 == '{0}'", s2 ); + Console::WriteLine( "s3 == '{0}'", s3 ); + Console::WriteLine( "Is s2 the same reference as s1?: {0}", s2 == s1 ); + Console::WriteLine( "Is s3 the same reference as s1?: {0}", s3 == s1 ); +} + +/* +This example produces the following results: +s1 == 'MyTest' +s2 == 'MyTest' +s3 == 'MyTest' +Is s2 the same reference as s1?: False +Is s3 the same reference as s1?: True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp b/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp new file mode 100644 index 00000000000..a9a9593c87e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.isNullOrEmpty/CPP/inoe.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +String^ Test( String^ s ) +{ + if (String::IsNullOrEmpty(s)) + return "is null or empty"; + else + return String::Format( "(\"{0}\") is neither null nor empty", s ); +} + +int main() +{ + String^ s1 = "abcd"; + String^ s2 = ""; + String^ s3 = nullptr; + Console::WriteLine( "String s1 {0}.", Test( s1 ) ); + Console::WriteLine( "String s2 {0}.", Test( s2 ) ); + Console::WriteLine( "String s3 {0}.", Test( s3 ) ); +} +// The example displays the following output: +// String s1 ("abcd") is neither null nor empty. +// String s2 is null or empty. +// String s3 is null or empty. +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp b/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp new file mode 100644 index 00000000000..bec722b1e9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.isinterned/CPP/isin.cpp @@ -0,0 +1,45 @@ +// +// Sample for String::IsInterned(String) +using namespace System; +using namespace System::Text; +using namespace System::Runtime::CompilerServices; + +// In the .NET Framework 2.0 the following attribute declaration allows you to +// avoid the use of the interning when you use NGEN.exe to compile an assembly +// to the native image cache. +[assembly:CompilationRelaxations(CompilationRelaxations::NoStringInterning)]; +void Test( int sequence, String^ str ) +{ + Console::Write( "{0} The string '", sequence ); + String^ strInterned = String::IsInterned( str ); + if ( strInterned == nullptr ) + Console::WriteLine( "{0}' is not interned.", str ); + else + Console::WriteLine( "{0}' is interned.", strInterned ); +} + +int main() +{ + + // String str1 is known at compile time, and is automatically interned. + String^ str1 = "abcd"; + + // Constructed string, str2, is not explicitly or automatically interned. + String^ str2 = (gcnew StringBuilder)->Append( "wx" )->Append( "yz" )->ToString(); + Console::WriteLine(); + Test( 1, str1 ); + Test( 2, str2 ); +} + +//This example produces the following results: + +//1) The string, 'abcd', is interned. +//2) The string, 'wxyz', is not interned. + +//If you use NGEN.exe to compile the assembly to the native image cache, this +//example produces the following results: + +//1) The string, 'abcd', is not interned. +//2) The string, 'wxyz', is not interned. + +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp b/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp new file mode 100644 index 00000000000..07f204ebd9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.join2/CPP/join2.cpp @@ -0,0 +1,22 @@ + +// +// Sample for String::Join(String, String[], int int) +using namespace System; +int main() +{ + array^val = {"apple","orange","grape","pear"}; + String^ sep = ", "; + String^ result; + Console::WriteLine( "sep = '{0}'", sep ); + Console::WriteLine( "val[] = {{'{0}' '{1}' '{2}' '{3}'}}", val[ 0 ], val[ 1 ], val[ 2 ], val[ 3 ] ); + result = String::Join( sep, val, 1, 2 ); + Console::WriteLine( "String::Join(sep, val, 1, 2) = '{0}'", result ); +} + +/* +This example produces the following results: +sep = ', ' +val[] = {'apple' 'orange' 'grape' 'pear'} +String::Join(sep, val, 1, 2) = 'orange, grape' +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp new file mode 100644 index 00000000000..809d2c001d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.lastindexof1/CPP/lastixof1.cpp @@ -0,0 +1,37 @@ + +// +// Sample for String::LastIndexOf(Char, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + start = str->Length - 1; + Console::WriteLine( "All occurrences of 't' from position {0} to 0.", start ); + Console::WriteLine( "{0}\n{1}\n{2}\n", br1, br2, str ); + Console::Write( "The letter 't' occurs at position(s): " ); + at = 0; + while ( (start > -1) && (at > -1) ) + { + at = str->LastIndexOf( 't', start ); + if ( at > -1 ) + { + Console::Write( " {0} ", at ); + start = at - 1; + } + } +} + +/* +This example produces the following results: +All occurrences of 't' from position 66 to 0. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +The letter 't' occurs at position(s): 64 55 44 41 33 11 7 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp b/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp new file mode 100644 index 00000000000..881187073e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.lastindexof2/CPP/lastixof2.cpp @@ -0,0 +1,44 @@ + +// +// Sample for String::LastIndexOf(Char, Int32, Int32) +using namespace System; +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----4----+----5----+----6----+-"; + String^ br2 = "0123456789012345678901234567890123456789012345678901234567890123456"; + String^ str = "Now is the time for all good men to come to the aid of their party."; + int start; + int at; + int count; + int end; + start = str->Length - 1; + end = start / 2 - 1; + Console::WriteLine( "All occurrences of 't' from position {0} to {1}.", start, end ); + Console::WriteLine( "\n{0}\n{1}\n{2}", br1, br2, str ); + Console::Write( "The letter 't' occurs at position(s): " ); + count = 0; + at = 0; + while ( (start > -1) && (at > -1) ) + { + count = start - end; //Count must be within the substring. + at = str->LastIndexOf( 't', start, count ); + if ( at > -1 ) + { + Console::Write( " {0} ", at ); + start = at - 1; + } + } +} + +/* +This example produces the following results: +All occurrences of 't' from position 66 to 32. +0----+----1----+----2----+----3----+----4----+----5----+----6----+- +0123456789012345678901234567890123456789012345678901234567890123456 +Now is the time for all good men to come to the aid of their party. + +The letter 't' occurs at position(s): 64 55 44 41 33 + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp b/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp new file mode 100644 index 00000000000..e3a6250c8ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.length/CPP/length.cpp @@ -0,0 +1,20 @@ + +// +// Sample for String::Length +using namespace System; +int main() +{ + String^ str = "abcdefg"; + Console::WriteLine( "1) The length of '{0}' is {1}", str, str->Length ); + Console::WriteLine( "2) The length of '{0}' is {1}", "xyz", ((String^)"xyz")->Length ); + int length = str->Length; + Console::WriteLine( "1) The length of '{0}' is {1}", str, length ); +} + +/* +This example displays the following output: + 1) The length of 'abcdefg' is 7 + 2) The length of 'xyz' is 3 + 3) The length of 'abcdefg' is 7 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp b/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp new file mode 100644 index 00000000000..8193a3115e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.normalize/CPP/norm.cpp @@ -0,0 +1,117 @@ + +// +using namespace System; +using namespace System::Text; + +void Show( String^ title, String^ s ) +{ + Console::Write( "Characters in string {0} = ", title ); + for each (short x in s) { + Console::Write("{0:X4} ", x); + } + Console::WriteLine(); +} + +int main() +{ + + // Character c; combining characters acute and cedilla; character 3/4 + array^temp0 = {L'c',L'\u0301',L'\u0327',L'\u00BE'}; + String^ s1 = gcnew String( temp0 ); + String^ s2 = nullptr; + String^ divider = gcnew String( '-',80 ); + divider = String::Concat( Environment::NewLine, divider, Environment::NewLine ); + + Show( "s1", s1 ); + Console::WriteLine(); + Console::WriteLine( "U+0063 = LATIN SMALL LETTER C" ); + Console::WriteLine( "U+0301 = COMBINING ACUTE ACCENT" ); + Console::WriteLine( "U+0327 = COMBINING CEDILLA" ); + Console::WriteLine( "U+00BE = VULGAR FRACTION THREE QUARTERS" ); + Console::WriteLine( divider ); + Console::WriteLine( "A1) Is s1 normalized to the default form (Form C)?: {0}", s1->IsNormalized() ); + Console::WriteLine( "A2) Is s1 normalized to Form C?: {0}", s1->IsNormalized( NormalizationForm::FormC ) ); + Console::WriteLine( "A3) Is s1 normalized to Form D?: {0}", s1->IsNormalized( NormalizationForm::FormD ) ); + Console::WriteLine( "A4) Is s1 normalized to Form KC?: {0}", s1->IsNormalized( NormalizationForm::FormKC ) ); + Console::WriteLine( "A5) Is s1 normalized to Form KD?: {0}", s1->IsNormalized( NormalizationForm::FormKD ) ); + Console::WriteLine( divider ); + Console::WriteLine( "Set string s2 to each normalized form of string s1." ); + Console::WriteLine(); + Console::WriteLine( "U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE" ); + Console::WriteLine( "U+0033 = DIGIT THREE" ); + Console::WriteLine( "U+2044 = FRACTION SLASH" ); + Console::WriteLine( "U+0034 = DIGIT FOUR" ); + Console::WriteLine( divider ); + s2 = s1->Normalize(); + Console::Write( "B1) Is s2 normalized to the default form (Form C)?: " ); + Console::WriteLine( s2->IsNormalized() ); + Show( "s2", s2 ); + Console::WriteLine(); + s2 = s1->Normalize( NormalizationForm::FormC ); + Console::Write( "B2) Is s2 normalized to Form C?: " ); + Console::WriteLine( s2->IsNormalized( NormalizationForm::FormC ) ); + Show( "s2", s2 ); + Console::WriteLine(); + s2 = s1->Normalize( NormalizationForm::FormD ); + Console::Write( "B3) Is s2 normalized to Form D?: " ); + Console::WriteLine( s2->IsNormalized( NormalizationForm::FormD ) ); + Show( "s2", s2 ); + Console::WriteLine(); + s2 = s1->Normalize( NormalizationForm::FormKC ); + Console::Write( "B4) Is s2 normalized to Form KC?: " ); + Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKC ) ); + Show( "s2", s2 ); + Console::WriteLine(); + s2 = s1->Normalize( NormalizationForm::FormKD ); + Console::Write( "B5) Is s2 normalized to Form KD?: " ); + Console::WriteLine( s2->IsNormalized( NormalizationForm::FormKD ) ); + Show( "s2", s2 ); + Console::WriteLine(); +} + +/* +This example produces the following results: + +Characters in string s1 = 0063 0301 0327 00BE + +U+0063 = LATIN SMALL LETTER C +U+0301 = COMBINING ACUTE ACCENT +U+0327 = COMBINING CEDILLA +U+00BE = VULGAR FRACTION THREE QUARTERS + +-------------------------------------------------------------------------------- + +A1) Is s1 normalized to the default form (Form C)?: False +A2) Is s1 normalized to Form C?: False +A3) Is s1 normalized to Form D?: False +A4) Is s1 normalized to Form KC?: False +A5) Is s1 normalized to Form KD?: False + +-------------------------------------------------------------------------------- + +Set string s2 to each normalized form of string s1. + +U+1E09 = LATIN SMALL LETTER C WITH CEDILLA AND ACUTE +U+0033 = DIGIT THREE +U+2044 = FRACTION SLASH +U+0034 = DIGIT FOUR + +-------------------------------------------------------------------------------- + +B1) Is s2 normalized to the default form (Form C)?: True +Characters in string s2 = 1E09 00BE + +B2) Is s2 normalized to Form C?: True +Characters in string s2 = 1E09 00BE + +B3) Is s2 normalized to Form D?: True +Characters in string s2 = 0063 0327 0301 00BE + +B4) Is s2 normalized to Form KC?: True +Characters in string s2 = 1E09 0033 2044 0034 + +B5) Is s2 normalized to Form KD?: True +Characters in string s2 = 0063 0327 0301 0033 2044 0034 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp b/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp new file mode 100644 index 00000000000..a7be6a4bd78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.remove/CPP/r.cpp @@ -0,0 +1,25 @@ + +// +// This example demonstrates the String.Remove() method. +using namespace System; +int main() +{ + String^ s = "abc---def"; + + // + Console::WriteLine( "Index: 012345678" ); + Console::WriteLine( "1) {0}", s ); + Console::WriteLine( "2) {0}", s->Remove( 3 ) ); + Console::WriteLine( "3) {0}", s->Remove( 3, 3 ) ); +} + +/* +This example produces the following results: + +Index: 012345678 +1) abc---def +2) abc +3) abcdef + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp b/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp new file mode 100644 index 00000000000..5bb7e44d58f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.replace1/CPP/string.replace1.cpp @@ -0,0 +1,16 @@ + +// +using namespace System; +int main() +{ + String^ str = "1 2 3 4 5 6 7 8 9"; + Console::WriteLine( "Original string: \"{0}\"", str ); + Console::WriteLine( "CSV string: \"{0}\"", str->Replace( ' ', ',' ) ); +} + +// +// This example produces the following output: +// Original string: "1 2 3 4 5 6 7 8 9" +// CSV string: "1,2,3,4,5,6,7,8,9" +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp b/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp new file mode 100644 index 00000000000..c976a43115b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.split3/CPP/omit.cpp @@ -0,0 +1,76 @@ + +// +// This example demonstrates the String.Split(Char[], Boolean) and +// String.Split(Char[], Int32, Boolean) methods +using namespace System; +void Show( array^entries ) +{ + Console::WriteLine( "The return value contains these {0} elements:", entries->Length ); + System::Collections::IEnumerator^ myEnum = entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ entry = safe_cast(myEnum->Current); + Console::Write( "<{0}>", entry ); + } + + Console::Write( "{0}{0}", Environment::NewLine ); +} + +int main() +{ + String^ s = ",one,,,two,,,,,three,,"; + array^sep = gcnew array{ + ',' + }; + array^result; + + // + Console::WriteLine( "The original string is \"{0}\".", s ); + Console::WriteLine( "The separation character is '{0}'.", sep[ 0 ] ); + Console::WriteLine(); + + // + Console::WriteLine( "Split the string and return all elements:" ); + result = s->Split( sep, StringSplitOptions::None ); + Show( result ); + + // + Console::WriteLine( "Split the string and return all non-empty elements:" ); + result = s->Split( sep, StringSplitOptions::RemoveEmptyEntries ); + Show( result ); + + // + Console::WriteLine( "Split the string and return 2 elements:" ); + result = s->Split( sep, 2, StringSplitOptions::None ); + Show( result ); + + // + Console::WriteLine( "Split the string and return 2 non-empty elements:" ); + result = s->Split( sep, 2, StringSplitOptions::RemoveEmptyEntries ); + Show( result ); +} + +/* +This example produces the following results: + +The original string is ",one,,,two,,,,,three,,". +The separation character is ','. + +Split the string and return all elements: +The return value contains these 12 elements: +<><><><><><><><><> + +Split the string and return all non-empty elements: +The return value contains these 3 elements: + + +Split the string and return 2 elements: +The return value contains these 2 elements: +<> + +Split the string and return 2 non-empty elements: +The return value contains these 2 elements: +<,,two,,,,,three,,> + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp new file mode 100644 index 00000000000..bb7a31a327d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.tolower1/CPP/tolower.cpp @@ -0,0 +1,75 @@ + +// +// Sample for String::ToLower(CultureInfo) +using namespace System; +using namespace System::Globalization; +void CodePoints( String^ title, String^ s ) +{ + Console::Write( "{0}The code points in {1} are: {0}", Environment::NewLine, title ); + System::Collections::IEnumerator^ myEnum = s->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + UInt16 u = safe_cast(myEnum->Current); + Console::Write( "{0:x4} ", u ); + } + + Console::WriteLine(); +} + +int main() +{ + String^ str1 = "INDIGO"; + + // str2 = str1, except each 'I' is '\u0130' (Unicode LATIN CAPITAL I WITH DOT ABOVE). + array^temp = {L'\u0130',L'N',L'D',L'\u0130',L'G',L'O'}; + String^ str2 = gcnew String( temp ); + String^ str3; + String^ str4; + Console::WriteLine(); + Console::WriteLine( "str1 = '{0}'", str1 ); + Console::WriteLine(); + Console::WriteLine( "str1 is {0} to str2.", ((0 == String::CompareOrdinal( str1, str2 )) ? (String^)"equal" : "not equal") ); + CodePoints( "str1", str1 ); + CodePoints( "str2", str2 ); + Console::WriteLine(); + + // str3 is a lower case copy of str2, using English-United States culture. + Console::WriteLine( "str3 = Lower case copy of str2 using English-United States culture." ); + str3 = str2->ToLower( gcnew CultureInfo( "en-US",false ) ); + + // str4 is a lower case copy of str2, using Turkish-Turkey culture. + Console::WriteLine( "str4 = Lower case copy of str2 using Turkish-Turkey culture." ); + str4 = str2->ToLower( gcnew CultureInfo( "tr-TR",false ) ); + + // Compare the code points in str3 and str4. + Console::WriteLine(); + Console::WriteLine( "str3 is {0} to str4.", ((0 == String::CompareOrdinal( str3, str4 )) ? (String^)"equal" : "not equal") ); + CodePoints( "str3", str3 ); + CodePoints( "str4", str4 ); +} + +/* +This example produces the following results: + +str1 = 'INDIGO' + +str1 is not equal to str2. + +The code points in str1 are: +0049 004e 0044 0049 0047 004f + +The code points in str2 are: +0130 004e 0044 0130 0047 004f + +str3 = Lower case copy of str2 using English-United States culture. +str4 = Lower case copy of str2 using Turkish-Turkey culture. + +str3 is equal to str4. + +The code points in str3 are: +0069 006e 0064 0069 0067 006f + +The code points in str4 are: +0069 006e 0064 0069 0067 006f +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp b/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp new file mode 100644 index 00000000000..389fdf3e61a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/string.tostring/CPP/string.tostring.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +int main() +{ + String^ str1 = "123"; + String^ str2 = "abc"; + Console::WriteLine( "Original str1: {0}", str1 ); + Console::WriteLine( "Original str2: {0}", str2 ); + Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) ); + str2 = str1; + Console::WriteLine(); + Console::WriteLine( "New str2: {0}", str2 ); + Console::WriteLine( "str1 same as str2?: {0}", Object::ReferenceEquals( str1, str2 ) ); +} + +/* +This code produces the following output: +Original str1: 123 +Original str2: abc +str1 same as str2?: False + +New str2: 123 +str1 same as str2?: True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp new file mode 100644 index 00000000000..3cb652fc45a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendformat/CPP/appfmt.cpp @@ -0,0 +1,46 @@ + +// This example demonstrates the StringBuilder.AppendFormat method +// +using namespace System; +using namespace System::Text; +using namespace System::Globalization; +void Show( StringBuilder^ sbs ) +{ + Console::WriteLine( sbs ); + sbs->Length = 0; +} + +int main() +{ + StringBuilder^ sb = gcnew StringBuilder; + int var1 = 111; + float var2 = 2.22F; + String^ var3 = "abcd"; + array^var4 = {3,4.4,(Char)'X'}; + Console::WriteLine(); + Console::WriteLine( "StringBuilder.AppendFormat method:" ); + sb->AppendFormat( "1) {0}", var1 ); + Show( sb ); + sb->AppendFormat( "2) {0}, {1}", var1, var2 ); + Show( sb ); + sb->AppendFormat( "3) {0}, {1}, {2}", var1, var2, var3 ); + Show( sb ); + sb->AppendFormat( "4) {0}, {1}, {2}", var4 ); + Show( sb ); + CultureInfo^ ci = gcnew CultureInfo( "es-ES",true ); + array^temp1 = {var2}; + sb->AppendFormat( ci, "5) {0}", temp1 ); + Show( sb ); +} + +/* +This example produces the following results: + +StringBuilder.AppendFormat method: +1) 111 +2) 111, 2.22 +3) 111, 2.22, abcd +4) 3, 4.4, X +5) 2,22 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp new file mode 100644 index 00000000000..8d70a9a85d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.appendline/CPP/al.cpp @@ -0,0 +1,49 @@ +// +// This example demonstrates the StringBuilder.AppendLine() +// method. + +using namespace System; +using namespace System::Text; + +int main() +{ + StringBuilder^ sb = gcnew StringBuilder; + String^ line = L"A line of text."; + int number = 123; + + // Append two lines of text. + sb->AppendLine( L"The first line of text." ); + sb->AppendLine( line ); + + // Append a new line, an empty string, and a null cast as a string. + sb->AppendLine(); + sb->AppendLine( L"" ); + sb->AppendLine( L"" ); + + // Append the non-string value, 123, and two new lines. + sb->Append( number )->AppendLine()->AppendLine(); + + // Append two lines of text. + sb->AppendLine( line ); + sb->AppendLine( L"The last line of text." ); + + // Convert the value of the StringBuilder to a string and display the string. + Console::WriteLine( sb ); + + return 0; +} + +/* +This example produces the following results: + +The first line of text. +A line of text. + + + +123 + +A line of text. +The last line of text. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp new file mode 100644 index 00000000000..be8fea41b47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.copyto2/CPP/ct2.cpp @@ -0,0 +1,43 @@ +// +// This example demonstrates the CopyTo(Int32, Char[], Int32, Int32) method. +// Typically the destination array is small, preallocated, and global while +// the StringBuilder is large with programmatically defined data. +// However, for this example both the array and StringBuilder are small +// and the StringBuilder has predefined data. + +using namespace System; +using namespace System::Text; + +int main() +{ + array^dest = gcnew array(6); + StringBuilder^ src = gcnew StringBuilder( "abcdefghijklmnopqrstuvwxyz!" ); + dest[ 1 ] = ')'; + dest[ 2 ] = ' '; + + // Copy the source to the destination in 9 pieces, 3 characters per piece. + Console::WriteLine( "\nPiece) Data:" ); + for ( int ix = 0; ix < 9; ix++ ) + { + dest[ 0 ] = ix.ToString()[ 0 ]; + src->CopyTo( ix * 3, dest, 3, 3 ); + Console::Write( " " ); + Console::WriteLine( dest ); + } +} + +/* +This example produces the following results: + +Piece) Data: + 0) abc + 1) def + 2) ghi + 3) jkl + 4) mno + 5) pqr + 6) stu + 7) vwx + 8) yz! +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp new file mode 100644 index 00000000000..8043d615414 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.ensurecapacity/CPP/cap.cpp @@ -0,0 +1,61 @@ + +// This example demonstrates StringBuilder.EnsureCapacity +// StringBuilder.Capacity +// StringBuilder.Length +// StringBuilder.Equals +// +using namespace System; +using namespace System::Text; +int main() +{ + StringBuilder^ sb1 = gcnew StringBuilder( "abc" ); + StringBuilder^ sb2 = gcnew StringBuilder( "abc",16 ); + Console::WriteLine(); + Console::WriteLine( "a1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity ); + Console::WriteLine( "a2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity ); + Console::WriteLine( "a3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 ); + Console::WriteLine( "a4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) ); + Console::WriteLine(); + Console::WriteLine( "Ensure sb1 has a capacity of at least 50 characters." ); + sb1->EnsureCapacity( 50 ); + Console::WriteLine(); + Console::WriteLine( "b1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity ); + Console::WriteLine( "b2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity ); + Console::WriteLine( "b3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 ); + Console::WriteLine( "b4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) ); + Console::WriteLine(); + Console::WriteLine( "Set the length of sb1 to zero." ); + Console::WriteLine( "Set the capacity of sb2 to 51 characters." ); + sb1->Length = 0; + sb2->Capacity = 51; + Console::WriteLine(); + Console::WriteLine( "c1) sb1->Length = {0}, sb1->Capacity = {1}", sb1->Length, sb1->Capacity ); + Console::WriteLine( "c2) sb2->Length = {0}, sb2->Capacity = {1}", sb2->Length, sb2->Capacity ); + Console::WriteLine( "c3) sb1 = \"{0}\", sb2 = \"{1}\"", sb1, sb2 ); + Console::WriteLine( "c4) sb1 equals sb2: {0}", sb1->Equals( sb2 ) ); +} + +/* +The example displays the following output: + +a1) sb1->Length = 3, sb1->Capacity = 16 +a2) sb2->Length = 3, sb2->Capacity = 16 +a3) sb1 = "abc", sb2 = "abc" +a4) sb1 equals sb2: True + +Ensure sb1 has a capacity of at least 50 characters. + +b1) sb1->Length = 3, sb1->Capacity = 50 +b2) sb2->Length = 3, sb2->Capacity = 16 +b3) sb1 = "abc", sb2 = "abc" +b4) sb1 equals sb2: False + +Set the length of sb1 to zero. +Set the capacity of sb2 to 51 characters. + +c1) sb1->Length = 0, sb1->Capacity = 50 +c2) sb2->Length = 3, sb2->Capacity = 51 +c3) sb1 = "", sb2 = "abc" +c4) sb1 equals sb2: False +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp new file mode 100644 index 00000000000..03de6cb972e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.insert/CPP/insert.cpp @@ -0,0 +1,118 @@ + +// This example demonstrates StringBuilder.Insert() +// +using namespace System; +using namespace System::Text; +ref class Sample +{ +private: + + // index: 012345 + static String^ initialValue = "--[]--"; + static StringBuilder^ sb; + +public: + static void Main() + { + String^ xyz = "xyz"; + array^abc = {'a','b','c'}; + Char star = '*'; + Object^ obj = 0; + bool xBool = true; + Byte xByte = 1; + short xInt16 = 2; + int xInt32 = 3; + long xInt64 = 4; + Decimal xDecimal = 5; + float xSingle = 6.6F; + double xDouble = 7.7; + + // The following types are not CLS-compliant. + UInt16 xUInt16 = 8; + UInt32 xUInt32 = 9; + UInt64 xUInt64 = 10; + SByte xSByte = -11; + + // + Console::WriteLine( "StringBuilder.Insert method" ); + sb = gcnew StringBuilder( initialValue ); + sb->Insert( 3, xyz, 2 ); + Show( 1, sb ); + sb->Insert( 3, xyz ); + Show( 2, sb ); + sb->Insert( 3, star ); + Show( 3, sb ); + sb->Insert( 3, abc ); + Show( 4, sb ); + sb->Insert( 3, abc, 1, 2 ); + Show( 5, sb ); + sb->Insert( 3, xBool ); // True + Show( 6, sb ); + sb->Insert( 3, obj ); // 0 + Show( 7, sb ); + sb->Insert( 3, xByte ); // 1 + Show( 8, sb ); + sb->Insert( 3, xInt16 ); // 2 + Show( 9, sb ); + sb->Insert( 3, xInt32 ); // 3 + Show( 10, sb ); + sb->Insert( 3, xInt64 ); // 4 + Show( 11, sb ); + sb->Insert( 3, xDecimal ); // 5 + Show( 12, sb ); + sb->Insert( 3, xSingle ); // 6.6 + Show( 13, sb ); + sb->Insert( 3, xDouble ); // 7.7 + Show( 14, sb ); + + // The following Insert methods are not CLS-compliant. + sb->Insert( 3, xUInt16 ); // 8 + Show( 15, sb ); + sb->Insert( 3, xUInt32 ); // 9 + Show( 16, sb ); + sb->Insert( 3, xUInt64 ); // 10 + Show( 17, sb ); + sb->Insert( 3, xSByte ); // -11 + Show( 18, sb ); + + // + } + + static void Show( int overloadNumber, StringBuilder^ sbs ) + { + Console::WriteLine( "{0,2:G} = {1}", overloadNumber, sbs ); + sb = gcnew StringBuilder( initialValue ); + } + +}; + +int main() +{ + Sample::Main(); +} + +/* +This example produces the following results: + +StringBuilder.Insert method + 1 = --[xyzxyz]-- + 2 = --[xyz]-- + 3 = --[*]-- + 4 = --[abc]-- + 5 = --[bc]-- + 6 = --[True]-- + 7 = --[0]-- + 8 = --[1]-- + 9 = --[2]-- +10 = --[3]-- +11 = --[4]-- +12 = --[5]-- +13 = --[6.6]-- +14 = --[7.7]-- +15 = --[8]-- +16 = --[9]-- +17 = --[10]-- +18 = --[-11]-- + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp new file mode 100644 index 00000000000..df36afedca8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.remove/CPP/remove.cpp @@ -0,0 +1,43 @@ + +// This example demonstrates StringBuilder.Remove() +// +using namespace System; +using namespace System::Text; +int main() +{ + String^ rule1 = "0----+----1----+----2----+----3----+----4---"; + String^ rule2 = "01234567890123456789012345678901234567890123"; + String^ str = "The quick brown fox jumps over the lazy dog."; + StringBuilder^ sb = gcnew StringBuilder( str ); + Console::WriteLine(); + Console::WriteLine( "StringBuilder.Remove method" ); + Console::WriteLine(); + Console::WriteLine( "Original value:" ); + Console::WriteLine( rule1 ); + Console::WriteLine( rule2 ); + Console::WriteLine( "{0}", sb ); + Console::WriteLine(); + sb->Remove( 10, 6 ); // Remove "brown " + Console::WriteLine( "New value:" ); + Console::WriteLine( rule1 ); + Console::WriteLine( rule2 ); + Console::WriteLine( "{0}", sb ); +} + +/* +This example produces the following results: + +StringBuilder.Remove method + +Original value: +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick brown fox jumps over the lazy dog. + +New value: +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick fox jumps over the lazy dog. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp b/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp new file mode 100644 index 00000000000..56420a34a24 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringbuilder.replace/CPP/replace.cpp @@ -0,0 +1,67 @@ + +// This example demonstrates StringBuilder.Replace() +// +using namespace System; +using namespace System::Text; +void Show( StringBuilder^ sbs ) +{ + String^ rule1 = "0----+----1----+----2----+----3----+----4---"; + String^ rule2 = "01234567890123456789012345678901234567890123"; + Console::WriteLine( rule1 ); + Console::WriteLine( rule2 ); + Console::WriteLine( "{0}", sbs ); + Console::WriteLine(); +} + +int main() +{ + + // 0----+----1----+----2----+----3----+----4--- + // 01234567890123456789012345678901234567890123 + String^ str = "The quick br!wn d#g jumps #ver the lazy cat."; + StringBuilder^ sb = gcnew StringBuilder( str ); + Console::WriteLine(); + Console::WriteLine( "StringBuilder.Replace method" ); + Console::WriteLine(); + Console::WriteLine( "Original value:" ); + Show( sb ); + sb->Replace( '#', '!', 15, 29 ); // Some '#' -> '!' + Show( sb ); + sb->Replace( '!', 'o' ); // All '!' -> 'o' + Show( sb ); + sb->Replace( "cat", "dog" ); // All "cat" -> "dog" + Show( sb ); + sb->Replace( "dog", "fox", 15, 20 ); // Some "dog" -> "fox" + Console::WriteLine( "Final value:" ); + Show( sb ); +} + +/* +This example produces the following results: + +StringBuilder.Replace method + +Original value: +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick br!wn d#g jumps #ver the lazy cat. + +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick br!wn d!g jumps !ver the lazy cat. + +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick brown dog jumps over the lazy cat. + +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick brown dog jumps over the lazy dog. + +Final value: +0----+----1----+----2----+----3----+----4--- +01234567890123456789012345678901234567890123 +The quick brown fox jumps over the lazy dog. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp new file mode 100644 index 00000000000..9f50fa95027 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringconcat3/CPP/stringconcat3.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; + +int main() +{ + + // Make an array of strings. Note that we have included spaces. + array^s = { "hello ", "and ", "welcome ", "to ", + "this ", "demo! "}; + + // Put all the strings together. + Console::WriteLine( String::Concat(s) ); + + // Sort the strings, and put them together. + Array::Sort( s ); + Console::WriteLine( String::Concat(s)); +} +// The example displays the following output: +// hello and welcome to this demo! +// and demo! hello this to welcome +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp b/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp new file mode 100644 index 00000000000..a8d0614ca35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringconcat4/CPP/stringconcat4.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; +int main() +{ + + // we want to simply quickly add this person's name together + String^ fName = "Simon"; + String^ mName = "Jake"; + String^ lName = "Harrows"; + + // because we want a name to appear with a space in between each name, + // put a space on the front of the middle, and last name, allowing for + // the fact that a space may already be there + mName = String::Concat( " ", mName->Trim() ); + lName = String::Concat( " ", lName->Trim() ); + + // this line simply concatenates the two strings + Console::WriteLine( "Welcome to this page, '{0}'!", String::Concat( String::Concat( fName, mName ), lName ) ); +} +// The example displays the following output: +// Welcome to this page, 'Simon Jake Harrows'! +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp b/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp new file mode 100644 index 00000000000..683bae6c061 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringcopyto/CPP/stringcopyto.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +int main() +{ + + // Embed an array of characters in a string + String^ strSource = "changed"; + array^destination = {'T','h','e',' ','i','n','i','t','i','a','l',' ','a','r','r','a','y'}; + + // Print the char array + Console::WriteLine( destination ); + + // Embed the source string in the destination string + strSource->CopyTo( 0, destination, 4, strSource->Length ); + + // Print the resulting array + Console::WriteLine( destination ); + strSource = "A different string"; + + // Embed only a section of the source string in the destination + strSource->CopyTo( 2, destination, 3, 9 ); + + // Print the resulting array + Console::WriteLine( destination ); +} +// The example displays the following output: +// The initial array +// The changed array +// Thedifferentarray +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp new file mode 100644 index 00000000000..da9802a9dc7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringendswith/CPP/stringendswith.cpp @@ -0,0 +1,76 @@ + +// +using namespace System; +using namespace System::Collections; + +String^ StripEndTags( String^ item ) +{ + bool found = false; + + // try to find a tag at the end of the line using EndsWith + if ( item->Trim()->EndsWith( ">" ) ) + { + + // now search for the opening tag... + int lastLocation = item->LastIndexOf( "= 0 ) { + item = item->Substring( 0, lastLocation ); + found = true; + } + } + + if (found) item = StripEndTags(item); + + return item; +} + +int main() +{ + + // process an input file that contains html tags. + // this sample checks for multiple tags at the end of the line, rather than simply + // removing the last one. + // note: HTML markup tags always end in a greater than symbol (>). + array^strSource = {"This is bold text","

This is large Text

","This has multiple tags","This has embedded tags.","This line simply ends with a greater than symbol, it should not be modified>"}; + Console::WriteLine( "The following lists the items before the ends have been stripped:" ); + Console::WriteLine( "-----------------------------------------------------------------" ); + + // print out the initial array of strings + IEnumerator^ myEnum1 = strSource->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + String^ s = safe_cast(myEnum1->Current); + Console::WriteLine( s ); + } + + Console::WriteLine(); + Console::WriteLine( "The following lists the items after the ends have been stripped:" ); + Console::WriteLine( "----------------------------------------------------------------" ); + + // Display the array of strings. + IEnumerator^ myEnum2 = strSource->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + String^ s = safe_cast(myEnum2->Current); + Console::WriteLine( StripEndTags( s ) ); + } +} +// The example displays the following output: +// The following lists the items before the ends have been stripped: +// ----------------------------------------------------------------- +// This is bold text +//

This is large Text

+// This has multiple tags +// This has embedded tags. +// This line simply ends with a greater than symbol, it should not be modified> +// +// The following lists the items after the ends have been stripped: +// ---------------------------------------------------------------- +// This is bold text +//

This is large Text +// This has multiple tags +// This has embedded tags. +// This line simply ends with a greater than symbol, it should not be modified> +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp new file mode 100644 index 00000000000..4f76320ec42 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringexample1/CPP/source.cpp @@ -0,0 +1,80 @@ + + +// This is the main project file for VC++ application project +// generated using an Application Wizard. +#define _UNICODE + +#include + +using namespace System; +using namespace System::Text; + +// This is the entry point for this application +int _tmain( void ) +{ + // + // Unicode Mathematical operators + wchar_t charArray1[4] = {L'\x2200',L'\x2202',L'\x200F',L'\x2205'}; + wchar_t * lptstr1 = &charArray1[ 0 ]; + String^ wszMathSymbols = gcnew String( lptstr1 ); + + // Unicode Letterlike Symbols + wchar_t charArray2[4] = {L'\x2111',L'\x2118',L'\x2122',L'\x2126'}; + wchar_t * lptstr2 = &charArray2[ 0 ]; + String^ wszLetterLike = gcnew String( lptstr2 ); + + // Compare Strings - the result is false + Console::WriteLine( String::Concat( L"The Strings are equal? ", (0 == String::Compare( wszLetterLike, wszMathSymbols ) ? (String^)"TRUE" : "FALSE") ) ); + // + + // + // Null terminated ASCII characters in a simple char array + char charArray3[4] = {0x41,0x42,0x43,0x00}; + char * pstr3 = &charArray3[ 0 ]; + String^ szAsciiUpper = gcnew String( pstr3 ); + char charArray4[4] = {0x61,0x62,0x63,0x00}; + char * pstr4 = &charArray4[ 0 ]; + String^ szAsciiLower = gcnew String( pstr4,0,sizeof(charArray4) ); + + // Prints "ABC abc" + Console::WriteLine( String::Concat( szAsciiUpper, " ", szAsciiLower ) ); + + // Compare Strings - the result is true + Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper->ToUpper(), szAsciiLower->ToUpper() ) ? (String^)"TRUE" : "FALSE") ) ); + + // This is the effective equivalent of another Compare method, which ignores case + Console::WriteLine( String::Concat( "The Strings are equal when capitalized ? ", (0 == String::Compare( szAsciiUpper, szAsciiLower, true ) ? (String^)"TRUE" : "FALSE") ) ); + // + + // + // Create a Unicode String with 5 Greek Alpha characters + String^ szGreekAlpha = gcnew String( L'\x0391',5 ); + + // Create a Unicode String with a Greek Omega character + wchar_t charArray5[3] = {L'\x03A9',L'\x03A9',L'\x03A9'}; + String^ szGreekOmega = gcnew String( charArray5,2,1 ); + String^ szGreekLetters = String::Concat( szGreekOmega, szGreekAlpha, szGreekOmega->Clone() ); + + // Examine the result + Console::WriteLine( szGreekLetters ); + + // The first index of Alpha + int ialpha = szGreekLetters->IndexOf( L'\x0391' ); + + // The last index of Omega + int iomega = szGreekLetters->LastIndexOf( L'\x03A9' ); + Console::WriteLine( String::Concat( "The Greek letter Alpha first appears at index ", Convert::ToString( ialpha ) ) ); + Console::WriteLine( String::Concat( " and Omega last appears at index ", Convert::ToString( iomega ), " in this String." ) ); + // + + // + char asciiChars[6] = {0x51,0x52,0x53,0x54,0x54,0x56}; + char * pstr6 = &asciiChars[ 0 ]; + UTF8Encoding^ encoding = gcnew UTF8Encoding( true,true ); + String^ utfeightstring = gcnew String( pstr6,0,sizeof(asciiChars),encoding ); + + // prints "QRSTTV" + Console::WriteLine( String::Concat( "The UTF8 String is ", utfeightstring ) ); + // + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp b/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp new file mode 100644 index 00000000000..9ca351899a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringindexof4/CPP/stringindexof4.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +int main() +{ + String^ strSource = "This is the string which we will perform the search on"; + Console::WriteLine( "The search string is: {0}\"{1}\" {0}", Environment::NewLine, strSource ); + String^ strTarget = ""; + int found = 0; + int totFinds = 0; + do + { + Console::Write( "Please enter a search value to look for in the above string (hit Enter to exit) ==> " ); + strTarget = Console::ReadLine(); + if ( !strTarget->Equals( "" ) ) + { + for ( int i = 0; i < strSource->Length; i++ ) + { + found = strSource->IndexOf( strTarget, i ); + if (found >= 0) + { + totFinds++; + i = found; + } + else + break; + + } + } + else + return 0; + Console::WriteLine( "{0}The search parameter '{1}' was found {2} times. {0}", Environment::NewLine, strTarget, totFinds ); + totFinds = 0; + } + while ( true ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp b/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp new file mode 100644 index 00000000000..1bd127d5ce3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringinsert/CPP/stringinsert.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; + +int main() +{ + String^ animal1 = "fox"; + String^ animal2 = "dog"; + String^ strTarget = String::Format( "The {0} jumps over the {1}.", animal1, animal2 ); + Console::WriteLine( "The original string is:{0}{1}{0}", Environment::NewLine, strTarget ); + Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal1 ); + String^ adj1 = Console::ReadLine(); + Console::Write( "Enter an adjective (or group of adjectives) to describe the {0}: ==> ", animal2 ); + String^ adj2 = Console::ReadLine(); + adj1 = String::Concat( adj1->Trim(), " " ); + adj2 = String::Concat( adj2->Trim(), " " ); + strTarget = strTarget->Insert( strTarget->IndexOf( animal1 ), adj1 ); + strTarget = strTarget->Insert( strTarget->IndexOf( animal2 ), adj2 ); + Console::WriteLine( " {0}The final string is: {0} {1}", Environment::NewLine, strTarget ); +} +// Output from the example might appear as follows: +// The original string is: +// The fox jumps over the dog. +// +// Enter an adjective (or group of adjectives) to describe the fox: ==> bold +// Enter an adjective (or group of adjectives) to describe the dog: ==> lazy +// +// The final string is: +// The bold fox jumps over the lazy dog. +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp b/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp new file mode 100644 index 00000000000..8f6a431148c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringjoin/CPP/stringjoin.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +String^ MakeLine( int initVal, int multVal, String^ sep ) +{ + array^sArr = gcnew array(10); + for ( int i = initVal; i < initVal + 10; i++ ) + sArr[ i - initVal ] = String::Format( "{0, -3}", i * multVal ); + return String::Join( sep, sArr ); +} + +int main() +{ + Console::WriteLine( MakeLine( 0, 5, ", " ) ); + Console::WriteLine( MakeLine( 1, 6, " " ) ); + Console::WriteLine( MakeLine( 9, 9, ": " ) ); + Console::WriteLine( MakeLine( 4, 7, "< " ) ); +} +// The example displays the following output: +// 0 , 5 , 10 , 15 , 20 , 25 , 30 , 35 , 40 , 45 +// 6 12 18 24 30 36 42 48 54 60 +// 81 : 90 : 99 : 108: 117: 126: 135: 144: 153: 162 +// 28 < 35 < 42 < 49 < 56 < 63 < 70 < 77 < 84 < 91 +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp b/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp new file mode 100644 index 00000000000..4ea0b86e8aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringlowerupper/CPP/stringtolower.cpp @@ -0,0 +1,53 @@ + +// +using namespace System; +using namespace System::Collections; +int main() +{ + array^info = {"Name","Title","Age","Location","Gender"}; + Console::WriteLine( "The initial values in the array are:" ); + IEnumerator^ myEnum = info->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ s = safe_cast(myEnum->Current); + Console::WriteLine( s ); + } + + Console::WriteLine( " {0}The lowercase of these values is:", Environment::NewLine ); + IEnumerator^ myEnum1 = info->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + String^ s = safe_cast(myEnum1->Current); + Console::WriteLine( s->ToLower() ); + } + + Console::WriteLine( " {0}The uppercase of these values is:", Environment::NewLine ); + IEnumerator^ myEnum2 = info->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + String^ s = safe_cast(myEnum2->Current); + Console::WriteLine( s->ToUpper() ); + } +} +// The example displays the following output: +// The initial values in the array are: +// Name +// Title +// Age +// Location +// Gender +// +// The lowercase of these values is: +// name +// title +// age +// location +// gender +// +// The uppercase of these values is: +// NAME +// TITLE +// AGE +// LOCATION +// GENDER +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp b/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp new file mode 100644 index 00000000000..4960d17021a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringremove/CPP/stringremove.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +int main() +{ + String^ name = "Michelle Violet Banks"; + Console::WriteLine( "The entire name is '{0}'", name ); + + // remove the middle name, identified by finding the spaces in the middle of the name->->. + int foundS1 = name->IndexOf( " " ); + int foundS2 = name->IndexOf( " ", foundS1 + 1 ); + if ( foundS1 != foundS2 && foundS1 >= 0 ) + { + name = name->Remove( foundS1 + 1, foundS2 - foundS1 ); + Console::WriteLine( "After removing the middle name, we are left with '{0}'", name ); + } +} +// The example displays the following output: +// The entire name is 'Michelle Violet Banks' +// After removing the middle name, we are left with 'Michelle Banks' +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp b/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp new file mode 100644 index 00000000000..4d7cac7c4d1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringreplace/CPP/stringreplace.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +int main() +{ + String^ errString = "This docment uses 3 other docments to docment the docmentation"; + Console::WriteLine( "The original string is:\n'{0}'\n", errString ); + + // Correct the spelling of S"document". + String^ correctString = errString->Replace( "docment", "document" ); + Console::WriteLine( "After correcting the string, the result is:\n'{0}'", correctString ); +} +// +// This code example produces the following output: +// +// The original string is: +// 'This docment uses 3 other docments to docment the docmentation' +// +// After correcting the string, the result is: +// 'This document uses 3 other documents to document the documentation' +// +// diff --git a/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp b/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp new file mode 100644 index 00000000000..66a53e4c6dc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/stringstartswith/CPP/stringstartswith.cpp @@ -0,0 +1,61 @@ +// +using namespace System; + +String^ StripStartTags( String^ item ) +{ + // Determine whether a tag begins the string. + if (item->Trim()->StartsWith("<")) { + // Find the closing tag. + int lastLocation = item->IndexOf(">"); + + // Remove the tag. + if ( lastLocation >= 0 ) { + item = item->Substring(lastLocation+ 1); + + // Remove any additional starting tags. + item = StripStartTags(item); + } + } + + return item; +} + +int main() +{ + array^ strSource = { "This is bold text", + "

This is large Text

", + "This has multiple tags", + "This has embedded tags.", + "This is bold text
+//

This is large Text

+// This has multiple tags +// This has embedded tags. +// +// This is large Text

+// This has multiple tags +// This has embedded tags.
+// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp new file mode 100644 index 00000000000..7af27ada416 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.glob.NFI.nativeDigits/cpp/nd.cpp @@ -0,0 +1,31 @@ +// +// This example demonstrates the NativeDigits property. + +using namespace System; +using namespace System::Globalization; +using namespace System::Threading; + +int main() +{ + CultureInfo^ currentCI = Thread::CurrentThread->CurrentCulture; + NumberFormatInfo^ nfi = currentCI->NumberFormat; + array^ nativeDigitList = nfi->NativeDigits; + + Console::WriteLine("The native digits for the {0} culture are:", + currentCI->Name); + + for each (String^ nativeDigit in nativeDigitList) + { + Console::Write("\"{0}\" ", nativeDigit); + } + + Console::WriteLine(); +} +/* +This code example produces the following results: + +The native digits for the en-US culture are: +"0" "1" "2" "3" "4" "5" "6" "7" "8" "9" + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp new file mode 100644 index 00000000000..415a49fc640 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.glob.calendartype/CPP/caltype.cpp @@ -0,0 +1,34 @@ +// +using namespace System; +using namespace System::Globalization; + +namespace CalendarTypeExample +{ + static void Display(Calendar^ genericCalendar) + { + String^ calendarName = + genericCalendar->ToString()->PadRight(50, '.'); + Console::WriteLine("{0} {1}", calendarName, genericCalendar->GetType()); + } +} + +int main() +{ + GregorianCalendar^ gregorianCalendar = gcnew GregorianCalendar(); + HijriCalendar^ hijriCalendar = gcnew HijriCalendar(); + JapaneseLunisolarCalendar^ japaneseCalendar = + gcnew JapaneseLunisolarCalendar(); + CalendarTypeExample::Display(gregorianCalendar); + CalendarTypeExample::Display(hijriCalendar); + CalendarTypeExample::Display(japaneseCalendar); + return 0; +} + +/* This code example produces the following output. + +System.Globalization.GregorianCalendar............ System.Globalization.GregorianCalendar +System.Globalization.HijriCalendar................ System.Globalization.HijriCalendar +System.Globalization.JapaneseLunisolarCalendar.... System.Globalization.JapaneseLunisolarCalendar + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp new file mode 100644 index 00000000000..0e754047e7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.glob.carib1/CPP/carib.cpp @@ -0,0 +1,71 @@ +// +// This example demonstrates a System.Globalization.Culture- +// AndRegionInfoBuilder constructor and some of the properties +// of a custom culture object created with the constructor. + +#using + +using namespace System; +using namespace System::Globalization; + +int main() +{ + CultureAndRegionInfoBuilder^ builder = + gcnew CultureAndRegionInfoBuilder + ("x-en-US-sample", CultureAndRegionModifiers::None); + + // Display some of the properties + // for the en-US culture. + Console::WriteLine("CultureName:. . . . . . . . . . {0}", + builder->CultureName); + Console::WriteLine("CultureEnglishName: . . . . . . {0}", + builder->CultureEnglishName); + Console::WriteLine("CultureNativeName:. . . . . . . {0}", + builder->CultureNativeName); + Console::WriteLine("GeoId:. . . . . . . . . . . . . {0}", + builder->GeoId); + Console::WriteLine("IsMetric: . . . . . . . . . . . {0}", + builder->IsMetric); + Console::WriteLine("ISOCurrencySymbol:. . . . . . . {0}", + builder->ISOCurrencySymbol); + Console::WriteLine("RegionEnglishName:. . . . . . . {0}", + builder->RegionEnglishName); + Console::WriteLine("RegionName: . . . . . . . . . . {0}", + builder->RegionName); + Console::WriteLine("RegionNativeName: . . . . . . . {0}", + builder->RegionNativeName); + Console::WriteLine("ThreeLetterISOLanguageName: . . {0}", + builder->ThreeLetterISOLanguageName); + Console::WriteLine("ThreeLetterISORegionName: . . . {0}", + builder->ThreeLetterISORegionName); + Console::WriteLine("ThreeLetterWindowsLanguageName: {0}", + builder->ThreeLetterWindowsLanguageName); + Console::WriteLine("ThreeLetterWindowsRegionName: . {0}", + builder->ThreeLetterWindowsRegionName); + Console::WriteLine("TwoLetterISOLanguageName: . . . {0}", + builder->TwoLetterISOLanguageName); + Console::WriteLine("TwoLetterISORegionName: . . . . {0}", + builder->TwoLetterISORegionName); +} + +/* +This code example produces the following results: + +CultureName:. . . . . . . . . . en-US +CultureEnglishName: . . . . . . English (United States) +CultureNativeName:. . . . . . . English (United States) +GeoId:. . . . . . . . . . . . . 244 +IsMetric: . . . . . . . . . . . False +ISOCurrencySymbol:. . . . . . . USD +RegionEnglishName:. . . . . . . United States +RegionName: . . . . . . . . . . US +RegionNativeName: . . . . . . . United States +ThreeLetterISOLanguageName: . . eng +ThreeLetterISORegionName: . . . USA +ThreeLetterWindowsLanguageName: ENU +ThreeLetterWindowsRegionName: . USA +TwoLetterISOLanguageName: . . . en +TwoLetterISORegionName: . . . . US + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp new file mode 100644 index 00000000000..846861d5752 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.glob.ci.getCFUIC/cpp/cfuic.cpp @@ -0,0 +1,20 @@ +// +// This example demonstrates the GetConsoleFallbackUICulture() method +using namespace System; +using namespace System::Globalization; + +int main() +{ + CultureInfo^ ci = gcnew CultureInfo("ar-DZ"); + Console::WriteLine("Culture name: . . . . . . . . . {0}", ci->Name); + Console::WriteLine("Console fallback UI culture:. . {0}", + ci->GetConsoleFallbackUICulture()->Name); +} +/* +This code example produces the following results: + +Culture name: . . . . . . . . . ar-DZ +Console fallback UI culture:. . fr-FR + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp b/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp new file mode 100644 index 00000000000..573d82f64eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.glob.regioninfo.rgn5props/cpp/rgn5props.cpp @@ -0,0 +1,31 @@ +// +// This example demonstrates the RegionInfo.EnglishName, NativeName, +// CurrencyEnglishName, CurrencyNativeName, and GeoId properties. + +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Regional Info for Sweden + RegionInfo^ ri = gcnew RegionInfo("SE"); + + Console::WriteLine("Region English Name: . . . {0}", ri->EnglishName); + Console::WriteLine("Native Name: . . . . . . . {0}", ri->NativeName); + Console::WriteLine("Currency English Name: . . {0}", + ri->CurrencyEnglishName); + Console::WriteLine("Currency Native Name:. . . {0}", + ri->CurrencyNativeName); + Console::WriteLine("Geographical ID: . . . . . {0}", ri->GeoId); +} +/* +This code example produces the following results: + +Region English Name: . . . Sweden +Native Name: . . . . . . . Sverige +Currency English Name: . . Swedish Krona +Currency Native Name:. . . Svensk krona +Geographical ID: . . . . . 221 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp new file mode 100644 index 00000000000..6728f14abce --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecExc/cpp/fallDecExc.cpp @@ -0,0 +1,141 @@ +// +// This example demonstrates the DecoderExceptionFallback class. + +using namespace System; +using namespace System::Text; + +int main() +{ + // Create an encoding, which is equivalent to calling the + // ASCIIEncoding class constructor. + // The DecoderExceptionFallback parameter specifies that an exception + // is thrown if a character cannot be encoded. + // An encoder exception fallback is also specified, but in this code + // example the encoding operation cannot fail. + + Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii", + gcnew EncoderExceptionFallback(), gcnew DecoderExceptionFallback()); + String^ inputString = "XYZ"; + String^ decodedString; + String^ twoNewLines = Environment::NewLine + Environment::NewLine ; + + array^ encodedBytes = + gcnew array(asciiEncoding->GetByteCount(inputString)); + int numberOfEncodedBytes = 0; + + // --------------------------------------------------------------------- + Console::Clear(); + + // Display the name of the encoding. + Console::WriteLine("The name of the encoding is \"{0}\".{1}", + asciiEncoding->WebName, Environment::NewLine); + + // Display the input string in text. + Console::WriteLine("Input string ({0} characters): \"{1}\"", + inputString->Length, inputString); + + // Display the input string in hexadecimal. + Console::Write("Input string in hexadecimal: "); + for each (char c in inputString) + { + Console::Write("0x{0:X2} ", c); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Encode the input string. + + Console::WriteLine("Encode the input string..."); + + numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0, + inputString->Length, encodedBytes, 0); + + // Display the encoded bytes. + Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", + numberOfEncodedBytes, Environment::NewLine); + for each (Byte b in encodedBytes) + { + Console::Write("0x{0:X2} ", b); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + + // Replace the encoded byte sequences for the characters 'X' and 'Z' + // with the value 0xFF, which is outside the valid range of 0x00 to 0x7F + // for ASCIIEncoding. The resulting byte sequence is actually the + // beginning of this code example because it is the input to the decoder + // operation, and is equivalent to a corrupted or improperly encoded + // byte sequence. + + encodedBytes[0] = 0xFF; + encodedBytes[2] = 0xFF; + + Console::WriteLine("Display the corrupted byte sequence..."); + Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", + numberOfEncodedBytes, Environment::NewLine); + for each (Byte b in encodedBytes) + { + Console::Write("0x{0:X2} ", b); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Attempt to decode the encoded bytes. However, an exception is thrown + // before the byte sequence can be decoded. + + Console::WriteLine("Compare the decoded bytes to the input string..."); + + try + { + decodedString = asciiEncoding->GetString(encodedBytes); + // This statement is never executed. + Console::WriteLine("This statement is never executed."); + } + catch (DecoderFallbackException^ ex) + { + Console::WriteLine(ex); + Console::WriteLine( + "{0}*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***", + Environment::NewLine); + } +} + + +/* +This code example produces the following results: + +The name of the encoding is "us-ascii". + +Input string (3 characters): "XYZ" +Input string in hexadecimal: 0x58 0x59 0x5A + +Encode the input string... +Encoded bytes in hexadecimal (3 bytes): + +0x58 0x59 0x5A + +Display the corrupted byte sequence... +Encoded bytes in hexadecimal (3 bytes): + +0xFF 0x59 0xFF + +Compare the decoded bytes to the input string... +System.Text.DecoderFallbackException: Unable to translate bytes [FF] at index 0 from speci +fied code page to Unicode. +at System.Text.DecoderExceptionFallbackBuffer.Throw(Byte[] bytesUnknown, Int32 index) +at System.Text.DecoderExceptionFallbackBuffer.Fallback(Byte[] bytesUnknown, Int32 index +) +at System.Text.DecoderFallbackBuffer.InternalFallback(Byte[] bytes, Byte* pBytes) +at System.Text.ASCIIEncoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS decoder) + +at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encod +ing) +at System.Text.ASCIIEncoding.GetString(Byte[] bytes, Int32 byteIndex, Int32 byteCount) +at System.Text.Encoding.GetString(Byte[] bytes) +at Sample.Main() + +*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. *** + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp new file mode 100644 index 00000000000..332c5a91b7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackDecRpl/cpp/fallDecRpl.cpp @@ -0,0 +1,115 @@ +// +// This example demonstrates the DecoderReplacementFallback class. + +using namespace System; +using namespace System::Text; + +int main() +{ + // Create an encoding, which is equivalent to calling the + // ASCIIEncoding class constructor. + // The DecoderReplacementFallback parameter specifies that the + // string "(error)" is to replace characters that cannot be decoded. + // An encoder replacement fallback is also specified, but in this code + // example the encoding operation cannot fail. + + Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii", + gcnew EncoderReplacementFallback("(unknown)"), + gcnew DecoderReplacementFallback("(error)")); + String^ inputString = "XYZ"; + String^ decodedString; + String^ twoNewLines = Environment::NewLine + Environment::NewLine; + array^ encodedBytes = gcnew array( + asciiEncoding->GetByteCount(inputString)); + int numberOfEncodedBytes = 0; + + // --------------------------------------------------------------------- + Console::Clear(); + + // Display the name of the encoding. + Console::WriteLine("The name of the encoding is \"{0}\".{1}", + asciiEncoding->WebName, Environment::NewLine); + + // Display the input string in text. + Console::WriteLine("Input string ({0} characters): \"{1}\"", + inputString->Length, inputString); + + // Display the input string in hexadecimal. + Console::Write("Input string in hexadecimal: "); + for each (char c in inputString) + { + Console::Write("0x{0:X2} ", c); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Encode the input string. + + Console::WriteLine("Encode the input string..."); + numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0, + inputString->Length, encodedBytes, 0); + + // Display the encoded bytes. + Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", + numberOfEncodedBytes, Environment::NewLine); + for each (Byte b in encodedBytes) + { + Console::Write("0x{0:X2} ", b); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + + // Replace the encoded byte sequences for the characters 'X' and 'Z' + // with the value 0xFF, which is outside the valid range of 0x00 to 0x7F + // for ASCIIEncoding. The resulting byte sequence is actually the + // beginning of this code example because it is the input to the decoder + // operation, and is equivalent to a corrupted or improperly encoded + // byte sequence. + + encodedBytes[0] = 0xFF; + encodedBytes[2] = 0xFF; + + Console::WriteLine("Display the corrupted byte sequence..."); + Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", + numberOfEncodedBytes, Environment::NewLine); + for each (Byte b in encodedBytes) + { + Console::Write("0x{0:X2} ", b); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Decode the encoded bytes. + + Console::WriteLine("Compare the decoded bytes to the input string..."); + decodedString = asciiEncoding->GetString(encodedBytes); + + // Display the input string and the decoded string for comparison. + Console::WriteLine("Input string: \"{0}\"", inputString); + Console::WriteLine("Decoded string:\"{0}\"", decodedString); +} +/* +This code example produces the following results: + +The name of the encoding is "us-ascii". + +Input string (3 characters): "XYZ" +Input string in hexadecimal: 0x58 0x59 0x5A + +Encode the input string... +Encoded bytes in hexadecimal (3 bytes): + +0x58 0x59 0x5A + +Display the corrupted byte sequence... +Encoded bytes in hexadecimal (3 bytes): + +0xFF 0x59 0xFF + +Compare the decoded bytes to the input string... +Input string: "XYZ" +Decoded string:"(error)Y(error)" + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp new file mode 100644 index 00000000000..3207d7a7fb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncExc/cpp/fallEncExc.cpp @@ -0,0 +1,96 @@ +// +// This example demonstrates the EncoderExceptionFallback class. + +using namespace System; +using namespace System::Text; + +int main() +{ + // Create an encoding, which is equivalent to calling the + // ASCIIEncoding class constructor. + // The EncoderExceptionFallback parameter causes an exception to + // be thrown when a character cannot be encoded. + // A decoder exception fallback is also specified, but it is not + // used because this example terminates during the encoding operation. + + Encoding^ asciiEncoding = Encoding::GetEncoding("us-ascii", + gcnew EncoderExceptionFallback(), gcnew DecoderExceptionFallback()); + + // The input string consists of the Unicode characters LEFT POINTING + // DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT + // POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB). + // The encoding can only encode characters in the US-ASCII range of + // U+0000 through U+007F. Consequently, the characters bracketing the + // 'X' character cause an exception. + String^ inputString = L"\u00abX\u00bb"; + + String^ twoNewLines = Environment::NewLine + Environment::NewLine; + array^ encodedBytes = gcnew array( + asciiEncoding->GetMaxByteCount(inputString->Length)); + int numberOfEncodedBytes = 0; + + // --------------------------------------------------------------------- + Console::Clear(); + + // Display the name of the encoding. + Console::WriteLine("The name of the encoding is \"{0}\".{1}", + asciiEncoding->WebName, Environment::NewLine); + + // Display the input string in text. + Console::WriteLine("Input string ({0} characters): \"{1}\"", + inputString->Length, inputString); + + // Display the input string in hexadecimal. + Console::Write("Input string in hexadecimal: "); + for each (char c in inputString) + { + Console::Write("0x{0:X2} ", c); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Attempt to encode the input string. However, an exception is thrown + // before the input string can be encoded. + + Console::WriteLine("Encode the input string..."); + + // The code example terminates during the call to the GetBytes() method. + try + { + numberOfEncodedBytes = asciiEncoding->GetBytes(inputString, 0, + inputString->Length, encodedBytes, 0); + // This statement is never executed. + Console::WriteLine("This statement is never executed."); + } + catch (EncoderFallbackException^ ex) + { + Console::WriteLine(ex); + Console::WriteLine( + "{0}*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. ***", + Environment::NewLine); + } +} + +/* +This code example produces the following results: + +The name of the encoding is "us-ascii". + +Input string (3 characters): "X" +Input string in hexadecimal: 0xAB 0x58 0xBB + +Encode the input string... +System.Text.EncoderFallbackException: Unable to translate Unicode character \u00AB at inde +x 0 to specified code page. +at System.Text.EncoderExceptionFallbackBuffer.Fallback(Char charUnknown, Int32 index) +at System.Text.EncoderFallbackBuffer.InternalFallback(Char ch, Char*& chars) +at System.Text.ASCIIEncoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 +byteCount, EncoderNLS encoder) +at System.Text.ASCIIEncoding.GetBytes(String chars, Int32 charIndex, Int32 charCount, B +yte[] bytes, Int32 byteIndex) +at Sample.Main() + +*** THE CODE EXAMPLE TERMINATES HERE AS INTENDED. *** + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp new file mode 100644 index 00000000000..ec4a3456bd1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/sys.txt.fallbackEncRpl/cpp/fallEncRpl.cpp @@ -0,0 +1,106 @@ +// +// This example demonstrates the EncoderReplacementFallback class. + +using namespace System; +using namespace System::Text; + +int main() +{ + // Create an encoding, which is equivalent to calling the + // ASCIIEncoding class constructor. + // The EncoderReplacementFallback parameter specifies that the + // string, "(unknown)", replace characters that cannot be encoded. + // A decoder replacement fallback is also specified, but in this + // code example the decoding operation cannot fail. + + Encoding^ ascii = Encoding::GetEncoding("us-ascii", + gcnew EncoderReplacementFallback("(unknown)"), + gcnew DecoderReplacementFallback("(error)")); + + // The input string consists of the Unicode characters LEFT POINTING + // DOUBLE ANGLE QUOTATION MARK (U+00AB), 'X' (U+0058), and RIGHT + // POINTING DOUBLE ANGLE QUOTATION MARK (U+00BB). + // The encoding can only encode characters in the US-ASCII range of + // U+0000 through U+007F. Consequently, the characters bracketing the + // 'X' character are replaced with the fallback replacement string, + // "(unknown)". + + String^ inputString = "\u00abX\u00bb"; + String^ decodedString; + String^ twoNewLines = Environment::NewLine + Environment::NewLine; + array ^ encodedBytes = + gcnew array(ascii->GetByteCount(inputString)); + int numberOfEncodedBytes = 0; + + // --------------------------------------------------------------------- + // Display the name of the encoding. + Console::WriteLine("The name of the encoding is \"{0}\".{1}", + ascii->WebName, Environment::NewLine); + + // Display the input string in text. + Console::WriteLine("Input string ({0} characters): \"{1}\"", + inputString->Length, inputString); + + // Display the input string in hexadecimal. + Console::Write("Input string in hexadecimal: "); + for each (char c in inputString) + { + Console::Write("0x{0:X2} ", c); + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Encode the input string. + + Console::WriteLine("Encode the input string..."); + numberOfEncodedBytes = ascii->GetBytes(inputString, 0, inputString->Length, + encodedBytes, 0); + + // Display the encoded bytes. + Console::WriteLine("Encoded bytes in hexadecimal ({0} bytes):{1}", + numberOfEncodedBytes, Environment::NewLine); + for(int i = 0; i < encodedBytes->Length; i++) + { + Console::Write("0x{0:X2} ", encodedBytes[i]); + if(((i + 1) % 6) == 0) + { + Console::WriteLine(); + } + } + Console::Write(twoNewLines); + + // --------------------------------------------------------------------- + // Decode the encoded bytes, yielding a reconstituted string. + + Console::WriteLine("Decode the encoded bytes..."); + decodedString = ascii->GetString(encodedBytes); + + // Display the input string and the decoded string for comparison. + Console::WriteLine("Input string: \"{0}\"", inputString); + Console::WriteLine("Decoded string:\"{0}\"", decodedString); +} + + + +/* +This code example produces the following results: + +The name of the encoding is "us-ascii". + +Input string (3 characters): "X" +Input string in hexadecimal: 0xAB 0x58 0xBB + +Encode the input string... +Encoded bytes in hexadecimal (19 bytes): + +0x28 0x75 0x6E 0x6B 0x6E 0x6F +0x77 0x6E 0x29 0x58 0x28 0x75 +0x6E 0x6B 0x6E 0x6F 0x77 0x6E +0x29 + +Decode the encoded bytes... +Input string: "X" +Decoded string:"(unknown)X(unknown)" + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp new file mode 100644 index 00000000000..79399d8f51e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/thread.sleep/cpp/example.cpp @@ -0,0 +1,25 @@ +// +using namespace System; +using namespace System::Threading; + +int main() +{ + for (int i = 0; i < 5; i++) + { + Console::WriteLine("Sleep for 2 seconds."); + Thread::Sleep(2000); + } + + Console::WriteLine("Main thread exits."); +} + +/* This example produces the following output: + +Sleep for 2 seconds. +Sleep for 2 seconds. +Sleep for 2 seconds. +Sleep for 2 seconds. +Sleep for 2 seconds. +Main thread exits. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp new file mode 100644 index 00000000000..4f50e318256 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/thread.sleep_timespan/cpp/example.cpp @@ -0,0 +1,27 @@ +// +using namespace System; +using namespace System::Threading; + +int main() +{ + TimeSpan interval = TimeSpan(0, 0, 2); + + for (int i = 0; i < 5; i++) + { + Console::WriteLine("Sleep for 2 seconds."); + Thread::Sleep(interval); + } + + Console::WriteLine("Main thread exits."); +} + +/* This example produces the following output: + +Sleep for 2 seconds. +Sleep for 2 seconds. +Sleep for 2 seconds. +Sleep for 2 seconds. +Sleep for 2 seconds. +Main thread exits. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp new file mode 100644 index 00000000000..552ea842e18 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/type_getevent1/CPP/type_getevent1.cpp @@ -0,0 +1,44 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Security; +using namespace System::Windows::Forms; + +int main() +{ + try + { + // Creates a bitmask based on BindingFlags. + BindingFlags myBindingFlags = static_cast(BindingFlags::Instance | BindingFlags::Public | BindingFlags::NonPublic); + Type^ myTypeBindingFlags = System::Windows::Forms::Button::typeid; + EventInfo^ myEventBindingFlags = myTypeBindingFlags->GetEvent( "Click", myBindingFlags ); + if ( myEventBindingFlags != nullptr ) + { + Console::WriteLine( "Looking for the Click event in the Button class with the specified BindingFlags." ); + Console::WriteLine( myEventBindingFlags ); + } + else + Console::WriteLine( "The Click event is not available with the Button class." ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "An exception occurred." ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp new file mode 100644 index 00000000000..f2daabba2aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/type_getevents1/CPP/type_getevents1.cpp @@ -0,0 +1,38 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Security; + +int main() +{ + try + { + Type^ myType = System::Windows::Forms::Button::typeid; + array^myEvents = myType->GetEvents(); + Console::WriteLine( "The events on the Button class are: " ); + for ( int index = 0; index < myEvents->Length; index++ ) + { + Console::WriteLine( myEvents[ index ] ); + + } + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp b/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp new file mode 100644 index 00000000000..2c09a6f7f39 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/type_getevents2/CPP/type_getevents2.cpp @@ -0,0 +1,41 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Security; + +int main() +{ + try + { + + // Create a bitmask based on BindingFlags. + BindingFlags myBindingFlags = static_cast(BindingFlags::Instance | BindingFlags::Public); + Type^ myTypeEvent = System::Windows::Forms::Button::typeid; + array^myEventsBindingFlags = myTypeEvent->GetEvents( myBindingFlags ); + Console::WriteLine( "\nThe events on the Button class with the specified BindingFlags are:" ); + for ( int index = 0; index < myEventsBindingFlags->Length; index++ ) + { + Console::WriteLine( myEventsBindingFlags[ index ] ); + + } + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp new file mode 100644 index 00000000000..fbbf07e7429 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/remarks.cpp @@ -0,0 +1,26 @@ + +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; + +int main() +{ +// + X509Chain^ ch = gcnew X509Chain(); + ch->ChainPolicy->ApplicationPolicy->Add(gcnew Oid("1.2.1.1")); +// + //Output chain information about the chain. + Console::WriteLine("Chain Information"); + ch->ChainPolicy->RevocationMode = X509RevocationMode::Online; + Console::WriteLine("Chain revocation flag: {0}", ch->ChainPolicy->RevocationFlag); + Console::WriteLine("Chain revocation mode: {0}", ch->ChainPolicy->RevocationMode); + Console::WriteLine("Chain verification flag: {0}", ch->ChainPolicy->VerificationFlags); + Console::WriteLine("Chain verification time: {0}", ch->ChainPolicy->VerificationTime); + Console::WriteLine("Chain status length: {0}", ch->ChainStatus->Length); + Console::WriteLine("Chain application policy count: {0}", ch->ChainPolicy->ApplicationPolicy->Count); + Console::WriteLine("Chain certificate policy count: {0} {1}", ch->ChainPolicy->CertificatePolicy->Count, Environment::NewLine); +} diff --git a/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp b/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp new file mode 100644 index 00000000000..7b57914985d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/x509chaintest/CPP/x509chaintest.cpp @@ -0,0 +1,73 @@ +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; + +int main() +{ + // + //Create new X509 store from local certificate store. + X509Store ^ store = gcnew X509Store( "MY",StoreLocation::CurrentUser ); + store->Open( static_cast(OpenFlags::OpenExistingOnly | OpenFlags::ReadWrite) ); + + //Output store information. + Console::WriteLine( "Store Information" ); + Console::WriteLine( "Number of certificates in the store: {0}", store->Certificates->Count ); + Console::WriteLine( "Store location: {0}", store->Location ); + Console::WriteLine( "Store name: {0} {1}", store->Name, Environment::NewLine ); + + //Put certificates from the store into a collection so user can select one. + X509Certificate2Collection ^ fcollection = dynamic_cast(store->Certificates); + X509Certificate2Collection ^ collection = X509Certificate2UI::SelectFromCollection(fcollection, "Select an X509 Certificate","Choose a certificate to examine.",X509SelectionFlag::SingleSelection); + X509Certificate2 ^ certificate = collection[ 0 ]; + X509Certificate2UI::DisplayCertificate(certificate); + // + + // + //Output chain information of the selected certificate. + X509Chain ^ ch = gcnew X509Chain; + ch->ChainPolicy->RevocationMode = X509RevocationMode::Online; + ch->Build( certificate ); + Console::WriteLine( "Chain Information" ); + Console::WriteLine( "Chain revocation flag: {0}", ch->ChainPolicy->RevocationFlag ); + Console::WriteLine( "Chain revocation mode: {0}", ch->ChainPolicy->RevocationMode ); + Console::WriteLine( "Chain verification flag: {0}", ch->ChainPolicy->VerificationFlags ); + Console::WriteLine( "Chain verification time: {0}", ch->ChainPolicy->VerificationTime ); + Console::WriteLine( "Chain status length: {0}", ch->ChainStatus->Length ); + Console::WriteLine( "Chain application policy count: {0}", ch->ChainPolicy->ApplicationPolicy->Count ); + Console::WriteLine( "Chain certificate policy count: {0} {1}", ch->ChainPolicy->CertificatePolicy->Count, Environment::NewLine ); + // + + // + //Output chain element information. + Console::WriteLine( "Chain Element Information" ); + Console::WriteLine( "Number of chain elements: {0}", ch->ChainElements->Count ); + Console::WriteLine( "Chain elements synchronized? {0} {1}", ch->ChainElements->IsSynchronized, Environment::NewLine ); + System::Collections::IEnumerator^ myEnum = ch->ChainElements->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + X509ChainElement ^ element = safe_cast(myEnum->Current); + Console::WriteLine( "Element issuer name: {0}", element->Certificate->Issuer ); + Console::WriteLine( "Element certificate valid until: {0}", element->Certificate->NotAfter ); + Console::WriteLine( "Element certificate is valid: {0}", element->Certificate->Verify() ); + Console::WriteLine( "Element error status length: {0}", element->ChainElementStatus->Length ); + Console::WriteLine( "Element information: {0}", element->Information ); + Console::WriteLine( "Number of element extensions: {0}{1}", element->Certificate->Extensions->Count, Environment::NewLine ); + if ( ch->ChainStatus->Length > 1 ) + { + for ( int index = 0; index < element->ChainElementStatus->Length; index++ ) + { + Console::WriteLine( element->ChainElementStatus[ index ].Status ); + Console::WriteLine( element->ChainElementStatus[ index ].StatusInformation ); + } + } + } + + store->Close(); + // +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp b/snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp new file mode 100644 index 00000000000..e1db565ed35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR/x509store2/CPP/x509store2.cpp @@ -0,0 +1,79 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; +int main() +{ + + //Create new X509 store called teststore from the local certificate store. + X509Store ^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser ); + store->Open( OpenFlags::ReadWrite ); + X509Certificate2 ^ certificate = gcnew X509Certificate2; + + //Create certificates from certificate files. + //You must put in a valid path to three certificates in the following constructors. + X509Certificate2 ^ certificate1 = gcnew X509Certificate2( "c:\\mycerts\\*****.cer" ); + X509Certificate2 ^ certificate2 = gcnew X509Certificate2( "c:\\mycerts\\*****.cer" ); + X509Certificate2 ^ certificate5 = gcnew X509Certificate2( "c:\\mycerts\\*****.cer" ); + + //Create a collection and add two of the certificates. + X509Certificate2Collection ^ collection = gcnew X509Certificate2Collection; + collection->Add( certificate2 ); + collection->Add( certificate5 ); + + //Add certificates to the store. + store->Add( certificate1 ); + store->AddRange( collection ); + X509Certificate2Collection ^ storecollection = dynamic_cast(store->Certificates); + Console::WriteLine( "Store name: {0}", store->Name ); + Console::WriteLine( "Store location: {0}", store->Location ); + System::Collections::IEnumerator^ myEnum = storecollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + X509Certificate2 ^ x509 = safe_cast(myEnum->Current); + Console::WriteLine( "certificate name: {0}", x509->Subject ); + } + + + //Remove a certificate. + store->Remove( certificate1 ); + X509Certificate2Collection ^ storecollection2 = dynamic_cast(store->Certificates); + Console::WriteLine( "{1}Store name: {0}", store->Name, Environment::NewLine ); + System::Collections::IEnumerator^ myEnum1 = storecollection2->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + X509Certificate2 ^ x509 = safe_cast(myEnum1->Current); + Console::WriteLine( "certificate name: {0}", x509->Subject ); + } + + + //Remove a range of certificates. + store->RemoveRange( collection ); + X509Certificate2Collection ^ storecollection3 = dynamic_cast(store->Certificates); + Console::WriteLine( "{1}Store name: {0}", store->Name, Environment::NewLine ); + if ( storecollection3->Count == 0 ) + { + Console::WriteLine( "Store contains no certificates." ); + } + else + { + System::Collections::IEnumerator^ myEnum2 = storecollection3->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + X509Certificate2 ^ x509 = safe_cast(myEnum2->Current); + Console::WriteLine( "certificate name: {0}", x509->Subject ); + } + } + + + //Close the store. + store->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp new file mode 100644 index 00000000000..79226085d31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/Classic FileVersionInfo.Comments Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: Form +{ +protected: + TextBox^ textBox1; + // + void GetComments() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); + // Print the comments in a text box. + textBox1->Text = "Comments: " + myFileVersionInfo->Comments; + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp new file mode 100644 index 00000000000..2b2375d4317 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CPP/source.cpp @@ -0,0 +1,75 @@ +// +using namespace System; +using namespace System::Reflection; + +namespace Ambiguity +{ + ref class Myambiguous + { + public: + + //The first overload is typed to an Int32 + static void Mymethod(Int32 number) + { + Console::WriteLine("I am from 'Int32' method"); + } + + //The second overload is typed to a String^ + static void Mymethod(String^ alpha) + { + Console::WriteLine("I am from 'String^' method."); + } + + static void Main() + { + try + { + //The following does not cause as exception + Mymethod(2); // goes to Mymethod (Int32) + Mymethod("3"); // goes to Mymethod (String*) + Type^ Mytype = Type::GetType("Ambiguity.Myambiguous"); + array^temp0 = {Int32::typeid}; + MethodInfo^ Mymethodinfo32 = Mytype->GetMethod("Mymethod", temp0); + array^temp1 = {System::String::typeid}; + MethodInfo^ Mymethodinfostr = Mytype->GetMethod("Mymethod", temp1); + + //Invoke a method, utilizing a Int32 integer + array^temp2 = {2}; + Mymethodinfo32->Invoke(nullptr, temp2); + + //Invoke the method utilizing a String^ + array^temp3 = {"1"}; + Mymethodinfostr->Invoke(nullptr, temp3); + + //The following line causes an ambiguous exception + MethodInfo^ Mymethodinfo = Mytype->GetMethod("Mymethod"); + } + catch (AmbiguousMatchException^ ex) + { + Console::WriteLine("\n{0}\n{1}", ex->GetType()->FullName, ex->Message); + } + catch (...) + { + Console::WriteLine("\nSome other exception."); + } + + return; + } + }; +} + +int main() +{ + Ambiguity::Myambiguous::Main(); +} + +//This code produces the following output: +// +// I am from 'Int32' method +// I am from 'String^' method. +// I am from 'Int32' method +// I am from 'String^' method. +// +// System.Reflection.AmbiguousMatchException +// Ambiguous match found. +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp new file mode 100644 index 00000000000..bc8df83efca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source.cpp @@ -0,0 +1,74 @@ +// +using namespace System; + +void PrintValues(array^myArr); +void PrintValues(array^myArr); +void main() +{ + // Creates and initializes a new int array and a new Object array. + array^myIntArray = { 1,2,3,4,5 }; + array^myObjArray = { 26,27,28,29,30 }; + + // Prints the initial values of both arrays. + Console::WriteLine("Initially:"); + Console::Write("int array: "); + PrintValues(myIntArray); + Console::Write("Object array:"); + PrintValues(myObjArray); + + // Copies the first two elements from the int array to the Object array. + System::Array::Copy(myIntArray, myObjArray, 2); + + // Prints the values of the modified arrays. + Console::WriteLine("\nAfter copying the first two elements of the int array to the Object array:"); + Console::Write("int array: "); + PrintValues(myIntArray); + Console::Write("Object array:"); + PrintValues(myObjArray); + + // Copies the last two elements from the Object array to the int array. + System::Array::Copy(myObjArray, myObjArray->GetUpperBound(0) - 1, myIntArray, myIntArray->GetUpperBound(0) - 1, 2); + + // Prints the values of the modified arrays. + Console::WriteLine("\nAfter copying the last two elements of the Object array to the int array:"); + Console::Write("int array: "); + PrintValues(myIntArray); + Console::Write("Object array:"); + PrintValues(myObjArray); +} + +void PrintValues(array^myArr) +{ + for (int i = 0; i < myArr->Length; i++) + { + Console::Write("\t{0}", myArr[i]); + + } + Console::WriteLine(); +} + +void PrintValues(array^myArr) +{ + for (int i = 0; i < myArr->Length; i++) + { + Console::Write("\t{0}", myArr[i]); + + } + Console::WriteLine(); +} + + +/* +This code produces the following output. + +Initially: +int array: 1 2 3 4 5 +Object array: 26 27 28 29 30 +After copying the first two elements of the int array to the Object array: +int array: 1 2 3 4 5 +Object array: 1 2 28 29 30 +After copying the last two elements of the Object array to the int array: +int array: 1 2 3 29 30 +Object array: 1 2 28 29 30 +*/ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp new file mode 100644 index 00000000000..10f90aa8ae1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array Example/CPP/source3.cpp @@ -0,0 +1,68 @@ +// +using namespace System; +void PrintValues(Array^ myArr); +void main() +{ + // Creates and initializes a new three-dimensional Array instance of type Int32. + Array^ myArr = Array::CreateInstance( Int32::typeid, 2, 3, 4 ); + for ( int i = myArr->GetLowerBound( 0 ); i <= myArr->GetUpperBound( 0 ); i++ ) + { + for ( int j = myArr->GetLowerBound( 1 ); j <= myArr->GetUpperBound( 1 ); j++ ) + { + for ( int k = myArr->GetLowerBound( 2 ); k <= myArr->GetUpperBound( 2 ); k++ ) + myArr->SetValue( (i * 100) + (j * 10) + k, i, j, k ); + + } + } + + // Displays the properties of the Array. + Console::WriteLine( "The Array instance has {0} dimension(s) and a total of {1} elements.", myArr->Rank, myArr->Length ); + Console::WriteLine( "\tLength\tLower\tUpper" ); + for ( int i = 0; i < myArr->Rank; i++ ) + { + Console::Write( "{0}:\t{1}", i, myArr->GetLength( i ) ); + Console::WriteLine( "\t{0}\t{1}", myArr->GetLowerBound( i ), myArr->GetUpperBound( i ) ); + + } + Console::WriteLine( "The Array instance contains the following values:" ); + PrintValues( myArr ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + i++; + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The Array instance has 3 dimension(s) and a total of 24 elements. + Length Lower Upper + 0: 2 0 1 + 1: 3 0 2 + 2: 4 0 3 + The Array instance contains the following values: + 0 1 2 3 + 10 11 12 13 + 20 21 22 23 + 100 101 102 103 + 110 111 112 113 + 120 121 122 123 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp new file mode 100644 index 00000000000..40db20d5eb6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.BinarySearch Example/CPP/source.cpp @@ -0,0 +1,80 @@ +// +using namespace System; + +public ref class SamplesArray +{ +public: + static void Main() + { + // Creates and initializes a new Array. + Array^ myIntArray = Array::CreateInstance(Int32::typeid, 5); + + myIntArray->SetValue(8, 0); + myIntArray->SetValue(2, 1); + myIntArray->SetValue(6, 2); + myIntArray->SetValue(3, 3); + myIntArray->SetValue(7, 4); + + // Do the required sort first + Array::Sort(myIntArray); + + // Displays the values of the Array. + Console::WriteLine("The Int32 array contains the following:"); + PrintValues(myIntArray); + + // Locates a specific object that does not exist in the Array. + Object^ myObjectOdd = 1; + FindMyObject(myIntArray, myObjectOdd); + + // Locates an object that exists in the Array. + Object^ myObjectEven = 6; + FindMyObject(myIntArray, myObjectEven); + } + + static void FindMyObject(Array^ myArr, Object^ myObject) + { + int myIndex = Array::BinarySearch(myArr, myObject); + if (myIndex < 0) + { + Console::WriteLine("The object to search for ({0}) is not found. The next larger object is at index {1}.", myObject, ~myIndex); + } + else + { + Console::WriteLine("The object to search for ({0}) is at index {1}.", myObject, myIndex); + } + } + + static void PrintValues(Array^ myArr) + { + int i = 0; + int cols = myArr->GetLength(myArr->Rank - 1); + for each (Object^ o in myArr) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + Console::Write("\t{0}", o); + } + Console::WriteLine(); + } +}; + +int main() +{ + SamplesArray::Main(); +} +// This code produces the following output. +// +//The Int32 array contains the following: +// 2 3 6 7 8 +//The object to search for (1) is not found. The next larger object is at index 0 +// +//The object to search for (6) is at index 2. +// + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp new file mode 100644 index 00000000000..16882781c33 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Copy1 Example/CPP/source.cpp @@ -0,0 +1,72 @@ + +// +using namespace System; +void PrintValues( Array^ myArr ); +void main() +{ + + // Creates and initializes a new Array instance of type Int32. + Array^ myIntArray = Array::CreateInstance( Type::GetType( "System.Int32" ), 5 ); + for ( int i = myIntArray->GetLowerBound( 0 ); i <= myIntArray->GetUpperBound( 0 ); i++ ) + myIntArray->SetValue( i + 1, i ); + + // Creates and initializes a new Array instance of type Object. + Array^ myObjArray = Array::CreateInstance( Type::GetType( "System.Object" ), 5 ); + for ( int i = myObjArray->GetLowerBound( 0 ); i <= myObjArray->GetUpperBound( 0 ); i++ ) + myObjArray->SetValue( i + 26, i ); + + // Displays the initial values of both arrays. + Console::WriteLine( "Int32 array:" ); + PrintValues( myIntArray ); + Console::WriteLine( "Object array:" ); + PrintValues( myObjArray ); + + // Copies the first element from the Int32 array to the Object array. + Array::Copy( myIntArray, myIntArray->GetLowerBound( 0 ), myObjArray, myObjArray->GetLowerBound( 0 ), 1 ); + + // Copies the last two elements from the Object array to the Int32 array. + Array::Copy( myObjArray, myObjArray->GetUpperBound( 0 ) - 1, myIntArray, myIntArray->GetUpperBound( 0 ) - 1, 2 ); + + // Displays the values of the modified arrays. + Console::WriteLine( "Int32 array - Last two elements should now be the same as Object array:" ); + PrintValues( myIntArray ); + Console::WriteLine( "Object array - First element should now be the same as Int32 array:" ); + PrintValues( myObjArray ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Int32 array: + 1 2 3 4 5 + Object array: + 26 27 28 29 30 + Int32 array - Last two elements should now be the same as Object array: + 1 2 3 29 30 + Object array - First element should now be the same as Int32 array: + 1 27 28 29 30 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..2caab9082ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source.cpp @@ -0,0 +1,67 @@ + +// +using namespace System; + +void main() +{ + // Creates and initializes two new Array instances. + Array^ mySourceArray = Array::CreateInstance(String::typeid, 6); + mySourceArray->SetValue("three", 0); + mySourceArray->SetValue("napping", 1); + mySourceArray->SetValue("cats", 2); + mySourceArray->SetValue("in", 3); + mySourceArray->SetValue("the", 4); + mySourceArray->SetValue("barn", 5); + Array^ myTargetArray = Array::CreateInstance(String::typeid, 15); + myTargetArray->SetValue("The", 0); + myTargetArray->SetValue("quick", 1); + myTargetArray->SetValue("brown", 2); + myTargetArray->SetValue("fox", 3); + myTargetArray->SetValue("jumps", 4); + myTargetArray->SetValue("over", 5); + myTargetArray->SetValue("the", 6); + myTargetArray->SetValue("lazy", 7); + myTargetArray->SetValue("dog", 8); + + // Displays the values of the Array. + Console::WriteLine( "The target Array instance contains the following (before and after copying):"); + PrintValues(myTargetArray); + + // Copies the source Array to the target Array, starting at index 6. + mySourceArray->CopyTo(myTargetArray, 6); + + // Displays the values of the Array. + PrintValues(myTargetArray); +} + +void PrintValues(Array^ myArr) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength(myArr->Rank - 1); + while (myEnumerator->MoveNext()) + { + if (i < cols) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( " {0}", myEnumerator->Current); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Array instance contains the following (before and after copying): + The quick brown fox jumps over the lazy dog + The quick brown fox jumps over three napping cats in the barn + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp new file mode 100644 index 00000000000..ca74d220df4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CopyTo Example/CPP/source2.cpp @@ -0,0 +1,61 @@ +// +using namespace System; + +void main() +{ + // Creates and initializes the source Array. + Array^ myArrayZero = Array::CreateInstance(String::typeid, 3); + myArrayZero->SetValue("zero", 0); + myArrayZero->SetValue("one", 1); + + // Displays the source Array. + Console::WriteLine("The array with lowbound=0 contains:"); + PrintIndexAndValues(myArrayZero); + + // Creates and initializes the target Array. + array^myArrLen = {4}; + array^myArrLow = {2}; + Array^ myArrayTwo = Array::CreateInstance(String::typeid, myArrLen, myArrLow); + myArrayTwo->SetValue("two", 2); + myArrayTwo->SetValue("three", 3); + myArrayTwo->SetValue("four", 4); + myArrayTwo->SetValue("five", 5); + + // Displays the target Array. + Console::WriteLine("The array with lowbound=2 contains:"); + PrintIndexAndValues(myArrayTwo); + + // Copy from the array with lowbound=0 to the array with lowbound=2. + myArrayZero->CopyTo(myArrayTwo, 3); + + // Displays the modified target Array. + Console::WriteLine("\nAfter copying at relative index 1:"); + PrintIndexAndValues(myArrayTwo); +} + +void PrintIndexAndValues(Array^ myArray) +{ + for (int i = myArray->GetLowerBound(0); i <= myArray->GetUpperBound(0); i++) + Console::WriteLine("\t[{0}]:\t{1}", i, myArray->GetValue(i)); +} + +/* + This code produces the following output. + + The array with lowbound=0 contains: + [0]: zero + [1]: one + [2]: + The array with lowbound=2 contains: + [2]: two + [3]: three + [4]: four + [5]: five + + After copying at relative index 1: + [2]: two + [3]: zero + [4]: one + [5]: + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp new file mode 100644 index 00000000000..6fb07cb3bf1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance Example/CPP/source.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +void PrintValues( Array^ myArr ); +void main() +{ + // Creates and initializes a one-dimensional Array instance of type Int32. + Array^ my1DArray = Array::CreateInstance( Int32::typeid, 5 ); + for ( int i = my1DArray->GetLowerBound( 0 ); i <= my1DArray->GetUpperBound( 0 ); i++ ) + my1DArray->SetValue( i + 1, i ); + + // Displays the values of the Array. + Console::WriteLine( "The one-dimensional Array instance contains the following values:" ); + PrintValues( my1DArray ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The one-dimensional Array instance contains the following values: + 1 2 3 4 5 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp new file mode 100644 index 00000000000..782e95f0280 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance1 Example/CPP/source.cpp @@ -0,0 +1,48 @@ + +// +using namespace System; +void PrintValues( Array^ myArr ); +void main() +{ + // Creates and initializes a two-dimensional Array instance of type String. + Array^ my2DArray = Array::CreateInstance( String::typeid, 2, 3 ); + for ( int i = my2DArray->GetLowerBound( 0 ); i <= my2DArray->GetUpperBound( 0 ); i++ ) + for ( int j = my2DArray->GetLowerBound( 1 ); j <= my2DArray->GetUpperBound( 1 ); j++ ) + my2DArray->SetValue( String::Concat( "abc", i, j ), i, j ); + + // Displays the values of the Array. + Console::WriteLine( "The two-dimensional Array instance contains the following values:" ); + PrintValues( my2DArray ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The two-dimensional Array instance contains the following values: + abc00 abc01 abc02 + abc10 abc11 abc12 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp new file mode 100644 index 00000000000..dfc52829993 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance2 Example/CPP/source.cpp @@ -0,0 +1,53 @@ + +// +using namespace System; +void PrintValues( Array^ myArr ); +void main() +{ + // Creates and initializes a three-dimensional Array instance of type Object. + Array^ my3DArray = Array::CreateInstance( Object::typeid, 2, 3, 4 ); + for ( int i = my3DArray->GetLowerBound( 0 ); i <= my3DArray->GetUpperBound( 0 ); i++ ) + for ( int j = my3DArray->GetLowerBound( 1 ); j <= my3DArray->GetUpperBound( 1 ); j++ ) + for ( int k = my3DArray->GetLowerBound( 2 ); k <= my3DArray->GetUpperBound( 2 ); k++ ) + my3DArray->SetValue( String::Concat( "abc", i, j, k ), i, j, k ); + + // Displays the values of the Array. + Console::WriteLine( "The three-dimensional Array instance contains the following values:" ); + PrintValues( my3DArray ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The three-dimensional Array instance contains the following values: + abc000 abc001 abc002 abc003 + abc010 abc011 abc012 abc013 + abc020 abc021 abc022 abc023 + abc100 abc101 abc102 abc103 + abc110 abc111 abc112 abc113 + abc120 abc121 abc122 abc123 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp new file mode 100644 index 00000000000..cf5aac93295 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance3 Example/CPP/source.cpp @@ -0,0 +1,77 @@ + +// +using namespace System; +void PrintValues( Array^ myArr ); +void main() +{ + // Creates and initializes a multidimensional Array instance of type String. + array^myLengthsArray = {2,3,4,5}; + Array^ my4DArray = Array::CreateInstance( String::typeid, myLengthsArray ); + for ( int i = my4DArray->GetLowerBound( 0 ); i <= my4DArray->GetUpperBound( 0 ); i++ ) + for ( int j = my4DArray->GetLowerBound( 1 ); j <= my4DArray->GetUpperBound( 1 ); j++ ) + for ( int k = my4DArray->GetLowerBound( 2 ); k <= my4DArray->GetUpperBound( 2 ); k++ ) + for ( int l = my4DArray->GetLowerBound( 3 ); l <= my4DArray->GetUpperBound( 3 ); l++ ) + { + array^myIndicesArray = {i,j,k,l}; + my4DArray->SetValue( String::Concat( Convert::ToString( i ), j, k, l ), myIndicesArray ); + + } + + // Displays the values of the Array. + Console::WriteLine( "The four-dimensional Array instance contains the following values:" ); + PrintValues( my4DArray ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The four-dimensional Array instance contains the following values: + 0000 0001 0002 0003 0004 + 0010 0011 0012 0013 0014 + 0020 0021 0022 0023 0024 + 0030 0031 0032 0033 0034 + 0100 0101 0102 0103 0104 + 0110 0111 0112 0113 0114 + 0120 0121 0122 0123 0124 + 0130 0131 0132 0133 0134 + 0200 0201 0202 0203 0204 + 0210 0211 0212 0213 0214 + 0220 0221 0222 0223 0224 + 0230 0231 0232 0233 0234 + 1000 1001 1002 1003 1004 + 1010 1011 1012 1013 1014 + 1020 1021 1022 1023 1024 + 1030 1031 1032 1033 1034 + 1100 1101 1102 1103 1104 + 1110 1111 1112 1113 1114 + 1120 1121 1122 1123 1124 + 1130 1131 1132 1133 1134 + 1200 1201 1202 1203 1204 + 1210 1211 1212 1213 1214 + 1220 1221 1222 1223 1224 + 1230 1231 1232 1233 1234 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp new file mode 100644 index 00000000000..cc1ff6dbbc9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.CreateInstance4 Example/CPP/source.cpp @@ -0,0 +1,63 @@ + +// +using namespace System; +void PrintValues( Array^ myArr ); +void main() +{ + // Creates and initializes a multidimensional Array instance of type String. + array^myLengthsArray = {3,5}; + array^myBoundsArray = {2,3}; + Array^ myArray = Array::CreateInstance( String::typeid, myLengthsArray, myBoundsArray ); + for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) + for ( int j = myArray->GetLowerBound( 1 ); j <= myArray->GetUpperBound( 1 ); j++ ) + { + array^myIndicesArray = {i,j}; + myArray->SetValue( String::Concat( Convert::ToString( i ), j ), myIndicesArray ); + + } + + // Displays the lower bounds and the upper bounds of each dimension. + Console::WriteLine( "Bounds:\tLower\tUpper" ); + for ( int i = 0; i < myArray->Rank; i++ ) + Console::WriteLine( "{0}:\t{1}\t{2}", i, myArray->GetLowerBound( i ), myArray->GetUpperBound( i ) ); + + // Displays the values of the Array. + Console::WriteLine( "The Array instance contains the following values:" ); + PrintValues( myArray ); +} + +void PrintValues( Array^ myArr ) +{ + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + int i = 0; + int cols = myArr->GetLength( myArr->Rank - 1 ); + while ( myEnumerator->MoveNext() ) + { + if ( i < cols ) + { + i++; + } + else + { + Console::WriteLine(); + i = 1; + } + + Console::Write( "\t{0}", myEnumerator->Current ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Bounds: Lower Upper + 0: 2 4 + 1: 3 7 + The Array instance contains the following values: + 23 24 25 26 27 + 33 34 35 36 37 + 43 44 45 46 47 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp new file mode 100644 index 00000000000..18923bcbb6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.IndexOf Example/CPP/source.cpp @@ -0,0 +1,51 @@ + +// +using namespace System; + +void main() +{ + // Create a string array with 3 elements having the same value. + array^ strings = { "the", "quick", "brown", "fox", + "jumps", "over", "the", "lazy", "dog", + "in", "the", "barn" }; + + // Display the elements of the array. + Console::WriteLine("The array contains the following values:"); + for (int i = strings->GetLowerBound(0); i <= strings->GetUpperBound(0); i++) + Console::WriteLine(" [{0,2}]: {1}", i, strings[i]); + + // Search for the first occurrence of the duplicated value. + String^ searchString = "the"; + int index = Array::IndexOf(strings, searchString); + Console::WriteLine("The first occurrence of \"{0}\" is at index {1}.", + searchString, index); + + // Search for the first occurrence of the duplicated value in the last section of the array. + index = Array::IndexOf( strings, searchString, 4); + Console::WriteLine("The first occurrence of \"{0}\" between index 4 and the end is at index {1}.", + searchString, index); + + // Search for the first occurrence of the duplicated value in a section of the array. + int position = index + 1; + index = Array::IndexOf(strings, searchString, position, strings->GetUpperBound(0) - position + 1); + Console::WriteLine("The first occurrence of \"{0}\" between index {1} and index {2} is at index {3}.", + searchString, position, strings->GetUpperBound(0), index); +} +// The example displays the following output: +// The array contains the following values: +// [ 0]: the +// [ 1]: quick +// [ 2]: brown +// [ 3]: fox +// [ 4]: jumps +// [ 5]: over +// [ 6]: the +// [ 7]: lazy +// [ 8]: dog +// [ 9]: in +// [10]: the +// [11]: barn +// The first occurrence of "the" is at index 0. +// The first occurrence of "the" between index 4 and the end is at index 6. +// The first occurrence of "the" between index 7 and index 11 is at index 10. +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp new file mode 100644 index 00000000000..1b8d7459315 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.LastIndexOf Example/CPP/source.cpp @@ -0,0 +1,68 @@ + +// +using namespace System; +void PrintIndexAndValues( Array^ myArray ); + +void main() +{ + // Creates and initializes a new Array instance with three elements of the same value. + Array^ myArray = Array::CreateInstance( String::typeid, 12 ); + myArray->SetValue( "the", 0 ); + myArray->SetValue( "quick", 1 ); + myArray->SetValue( "brown", 2 ); + myArray->SetValue( "fox", 3 ); + myArray->SetValue( "jumps", 4 ); + myArray->SetValue( "over", 5 ); + myArray->SetValue( "the", 6 ); + myArray->SetValue( "lazy", 7 ); + myArray->SetValue( "dog", 8 ); + myArray->SetValue( "in", 9 ); + myArray->SetValue( "the", 10 ); + myArray->SetValue( "barn", 11 ); + + // Displays the values of the Array. + Console::WriteLine( "The Array instance contains the following values:" ); + PrintIndexAndValues( myArray ); + + // Searches for the last occurrence of the duplicated value. + String^ myString = "the"; + int myIndex = Array::LastIndexOf( myArray, myString ); + Console::WriteLine( "The last occurrence of \"{0}\" is at index {1}.", myString, myIndex ); + + // Searches for the last occurrence of the duplicated value in the first section of the Array. + myIndex = Array::LastIndexOf( myArray, myString, 8 ); + Console::WriteLine( "The last occurrence of \"{0}\" between the start and index 8 is at index {1}.", myString, myIndex ); + + // Searches for the last occurrence of the duplicated value in a section of the Array. + // Note that the start index is greater than the end index because the search is done backward. + myIndex = Array::LastIndexOf( myArray, myString, 10, 6 ); + Console::WriteLine( "The last occurrence of \"{0}\" between index 5 and index 10 is at index {1}.", myString, myIndex ); +} + +void PrintIndexAndValues( Array^ myArray ) +{ + for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) + Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); +} + +/* + This code produces the following output. + + The Array instance contains the following values: + [0]: the + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + [9]: in + [10]: the + [11]: barn + The last occurrence of "the" is at index 10. + The last occurrence of "the" between the start and index 8 is at index 6. + The last occurrence of "the" between index 5 and index 10 is at index 10. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp new file mode 100644 index 00000000000..097d0727938 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse Example/CPP/source.cpp @@ -0,0 +1,61 @@ + +// +using namespace System; +void PrintIndexAndValues( Array^ myArray ); +void main() +{ + // Creates and initializes a new Array instance. + Array^ myArray = Array::CreateInstance( String::typeid, 9 ); + myArray->SetValue( "The", 0 ); + myArray->SetValue( "quick", 1 ); + myArray->SetValue( "brown", 2 ); + myArray->SetValue( "fox", 3 ); + myArray->SetValue( "jumps", 4 ); + myArray->SetValue( "over", 5 ); + myArray->SetValue( "the", 6 ); + myArray->SetValue( "lazy", 7 ); + myArray->SetValue( "dog", 8 ); + + // Displays the values of the Array. + Console::WriteLine( "The Array instance initially contains the following values:" ); + PrintIndexAndValues( myArray ); + + // Reverses the sort of the values of the Array. + Array::Reverse( myArray ); + + // Displays the values of the Array. + Console::WriteLine( "After reversing:" ); + PrintIndexAndValues( myArray ); +} + +void PrintIndexAndValues( Array^ myArray ) +{ + for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) + Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); +} + +/* + This code produces the following output. + + The Array instance initially contains the following values: + [0]: The + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + After reversing: + [0]: dog + [1]: lazy + [2]: the + [3]: over + [4]: jumps + [5]: fox + [6]: brown + [7]: quick + [8]: The + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp new file mode 100644 index 00000000000..1f394ab0ee6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Array.Reverse1 Example/CPP/source.cpp @@ -0,0 +1,61 @@ + +// +using namespace System; +void PrintIndexAndValues( Array^ myArray ); +void main() +{ + // Creates and initializes a new Array instance. + Array^ myArray = Array::CreateInstance( String::typeid, 9 ); + myArray->SetValue( "The", 0 ); + myArray->SetValue( "QUICK", 1 ); + myArray->SetValue( "BROWN", 2 ); + myArray->SetValue( "FOX", 3 ); + myArray->SetValue( "jumps", 4 ); + myArray->SetValue( "over", 5 ); + myArray->SetValue( "the", 6 ); + myArray->SetValue( "lazy", 7 ); + myArray->SetValue( "dog", 8 ); + + // Displays the values of the Array. + Console::WriteLine( "The Array instance initially contains the following values:" ); + PrintIndexAndValues( myArray ); + + // Reverses the sort of the values of the Array. + Array::Reverse( myArray, 1, 3 ); + + // Displays the values of the Array. + Console::WriteLine( "After reversing:" ); + PrintIndexAndValues( myArray ); +} + +void PrintIndexAndValues( Array^ myArray ) +{ + for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) + Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); +} + +/* + This code produces the following output. + + The Array instance initially contains the following values: + [0]: The + [1]: QUICK + [2]: BROWN + [3]: FOX + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + After reversing: + [0]: The + [1]: FOX + [2]: BROWN + [3]: QUICK + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp new file mode 100644 index 00000000000..49678c8cdc2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList Example/CPP/source.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "Hello" ); + myAL->Add( "World" ); + myAL->Add( "!" ); + + // Displays the properties and values of the ArrayList. + Console::WriteLine( "myAL" ); + Console::WriteLine( " Count: {0}", myAL->Count ); + Console::WriteLine( " Capacity: {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* +This code produces output similar to the following: + +myAL + Count: 3 + Capacity: 4 + Values: Hello World ! + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..2755de2cbe1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Add Example/CPP/source.cpp @@ -0,0 +1,60 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, char mySeparator ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + + // Creates and initializes a new Queue. + Queue^ myQueue = gcnew Queue; + myQueue->Enqueue( "jumps" ); + myQueue->Enqueue( "over" ); + myQueue->Enqueue( "the" ); + myQueue->Enqueue( "lazy" ); + myQueue->Enqueue( "dog" ); + + // Displays the ArrayList and the Queue. + Console::WriteLine( "The ArrayList initially contains the following:" ); + PrintValues( myAL, '\t' ); + Console::WriteLine( "The Queue initially contains the following:" ); + PrintValues( myQueue, '\t' ); + + // Copies the Queue elements to the end of the ArrayList. + myAL->AddRange( myQueue ); + + // Displays the ArrayList. + Console::WriteLine( "The ArrayList now contains the following:" ); + PrintValues( myAL, '\t' ); +} + +void PrintValues( IEnumerable^ myList, char mySeparator ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( "{0}{1}", mySeparator, obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. + +The ArrayList initially contains the following: + The quick brown fox +The Queue initially contains the following: + jumps over the lazy dog +The ArrayList now contains the following: + The quick brown fox jumps over the lazy dog +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp new file mode 100644 index 00000000000..f7052b8c414 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source.cpp @@ -0,0 +1,58 @@ + +// +using namespace System; +using namespace System::Collections; +void FindMyObject( ArrayList^ myList, Object^ myObject ); +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. BinarySearch requires + // a sorted ArrayList. + ArrayList^ myAL = gcnew ArrayList; + for ( int i = 0; i <= 4; i++ ) + myAL->Add( i * 2 ); + + // Displays the ArrayList. + Console::WriteLine( "The Int32 ArrayList contains the following:" ); + PrintValues( myAL ); + + // Locates a specific object that does not exist in the ArrayList. + Object^ myObjectOdd = 3; + FindMyObject( myAL, myObjectOdd ); + + // Locates an object that exists in the ArrayList. + Object^ myObjectEven = 6; + FindMyObject( myAL, myObjectEven ); +} + +void FindMyObject( ArrayList^ myList, Object^ myObject ) +{ + int myIndex = myList->BinarySearch( myObject ); + if ( myIndex < 0 ) + Console::WriteLine( "The object to search for ({0}) is not found. The next larger object is at index {1}.", myObject, ~myIndex ); + else + Console::WriteLine( "The object to search for ({0}) is at index {1}.", myObject, myIndex ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The Int32 ArrayList contains the following: + 0 2 4 6 8 + The object to search for (3) is not found. The next larger object is at index 2. + The object to search for (6) is at index 3. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp new file mode 100644 index 00000000000..cd02a23fd6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.BinarySearch1 Example/CPP/source2.cpp @@ -0,0 +1,67 @@ +// +using namespace System; +using namespace System::Collections; + +public ref class SimpleStringComparer : public IComparer +{ + virtual int Compare(Object^ x, Object^ y) sealed = IComparer::Compare + { + String^ cmpstr = (String^)x; + return cmpstr->CompareTo((String^)y); + } +}; + +public ref class MyArrayList : public ArrayList +{ +public: + static void Main() + { + // Creates and initializes a new ArrayList. + MyArrayList^ coloredAnimals = gcnew MyArrayList(); + + coloredAnimals->Add("White Tiger"); + coloredAnimals->Add("Pink Bunny"); + coloredAnimals->Add("Red Dragon"); + coloredAnimals->Add("Green Frog"); + coloredAnimals->Add("Blue Whale"); + coloredAnimals->Add("Black Cat"); + coloredAnimals->Add("Yellow Lion"); + + // BinarySearch requires a sorted ArrayList. + coloredAnimals->Sort(); + + // Compare results of an iterative search with a binary search + int index = coloredAnimals->IterativeSearch("White Tiger"); + Console::WriteLine("Iterative search, item found at index: {0}", index); + + index = coloredAnimals->BinarySearch("White Tiger", gcnew SimpleStringComparer()); + Console::WriteLine("Binary search, item found at index: {0}", index); + } + + int IterativeSearch(Object^ finditem) + { + int index = -1; + + for (int i = 0; i < this->Count; i++) + { + if (finditem->Equals(this[i])) + { + index = i; + break; + } + } + return index; + } +}; + +int main() +{ + MyArrayList::Main(); +} +// +// This code produces the following output. +// +// Iterative search, item found at index: 5 +// Binary search, item found at index: 5 +// +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..ecce0f77c76 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Clear Example/CPP/source.cpp @@ -0,0 +1,86 @@ +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + + // Displays the count, capacity and values of the ArrayList. + Console::WriteLine( "Initially," ); + Console::WriteLine( " Count : {0}", myAL->Count ); + Console::WriteLine( " Capacity : {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); + + // Trim the ArrayList. + myAL->TrimToSize(); + + // Displays the count, capacity and values of the ArrayList. + Console::WriteLine( "After TrimToSize," ); + Console::WriteLine( " Count : {0}", myAL->Count ); + Console::WriteLine( " Capacity : {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); + + // Clear the ArrayList. + myAL->Clear(); + + // Displays the count, capacity and values of the ArrayList. + Console::WriteLine( "After Clear," ); + Console::WriteLine( " Count : {0}", myAL->Count ); + Console::WriteLine( " Capacity : {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); + + // Trim the ArrayList again. + myAL->TrimToSize(); + + // Displays the count, capacity and values of the ArrayList. + Console::WriteLine( "After the second TrimToSize," ); + Console::WriteLine( " Count : {0}", myAL->Count ); + Console::WriteLine( " Capacity : {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initially, + Count : 5 + Capacity : 16 + Values: The quick brown fox jumps + After TrimToSize, + Count : 5 + Capacity : 5 + Values: The quick brown fox jumps + After Clear, + Count : 0 + Capacity : 5 + Values: + After the second TrimToSize, + Count : 0 + Capacity : 16 + Values: + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..350784fe0ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo Example/CPP/source.cpp @@ -0,0 +1,68 @@ +// +using namespace System; +using namespace System::Collections; +void PrintValues( array^myArr, char mySeparator ); +int main() +{ + + // Creates and initializes the source ArrayList. + ArrayList^ mySourceList = gcnew ArrayList; + mySourceList->Add( "three" ); + mySourceList->Add( "napping" ); + mySourceList->Add( "cats" ); + mySourceList->Add( "in" ); + mySourceList->Add( "the" ); + mySourceList->Add( "barn" ); + + // Creates and initializes the one-dimensional target Array. + array^myTargetArray = gcnew array(15); + myTargetArray[ 0 ] = "The"; + myTargetArray[ 1 ] = "quick"; + myTargetArray[ 2 ] = "brown"; + myTargetArray[ 3 ] = "fox"; + myTargetArray[ 4 ] = "jumps"; + myTargetArray[ 5 ] = "over"; + myTargetArray[ 6 ] = "the"; + myTargetArray[ 7 ] = "lazy"; + myTargetArray[ 8 ] = "dog"; + + // Displays the values of the target Array. + Console::WriteLine( "The target Array contains the following (before and after copying):" ); + PrintValues( myTargetArray, ' ' ); + + // Copies the second element from the source ArrayList to the target ArrayList starting at index 7. + mySourceList->CopyTo( 1, myTargetArray, 7, 1 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source ArrayList to the target ArrayList starting at index 6. + mySourceList->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source ArrayList to the target ArrayList starting at index 0. + mySourceList->CopyTo( myTargetArray ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); +} + +void PrintValues( array^myArr, char mySeparator ) +{ + for ( int i = 0; i < myArr->Length; i++ ) + Console::Write( "{0}{1}", mySeparator, myArr[ i ] ); + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Array contains the following (before and after copying): + The quick brown fox jumps over the lazy dog + The quick brown fox jumps over the napping dog + The quick brown fox jumps over three napping cats in the barn + three napping cats in the barn three napping cats in the barn + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp new file mode 100644 index 00000000000..de10c82aaf7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.CopyTo1 Example/CPP/source.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( array^myArr, char mySeparator ); +int main() +{ + + // Creates and initializes the source ArrayList. + ArrayList^ mySourceList = gcnew ArrayList; + mySourceList->Add( "three" ); + mySourceList->Add( "napping" ); + mySourceList->Add( "cats" ); + mySourceList->Add( "in" ); + mySourceList->Add( "the" ); + mySourceList->Add( "barn" ); + + // Creates and initializes the one-dimensional target Array. + array^myTargetArray = gcnew array(15); + myTargetArray[ 0 ] = "The"; + myTargetArray[ 1 ] = "quick"; + myTargetArray[ 2 ] = "brown"; + myTargetArray[ 3 ] = "fox"; + myTargetArray[ 4 ] = "jumps"; + myTargetArray[ 5 ] = "over"; + myTargetArray[ 6 ] = "the"; + myTargetArray[ 7 ] = "lazy"; + myTargetArray[ 8 ] = "dog"; + + // Displays the values of the target Array. + Console::WriteLine( "The target Array contains the following (before and after copying):" ); + PrintValues( myTargetArray, ' ' ); + + // Copies the second element from the source ArrayList to the target Array, starting at index 7. + mySourceList->CopyTo( 1, myTargetArray, 7, 1 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source ArrayList to the target Array, starting at index 6. + mySourceList->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source ArrayList to the target Array, starting at index 0. + mySourceList->CopyTo( myTargetArray ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); +} + +void PrintValues( array^myArr, char mySeparator ) +{ + for ( int i = 0; i < myArr->Length; i++ ) + Console::Write( "{0}{1}", mySeparator, myArr[ i ] ); + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Array contains the following (before and after copying): + The quick brown fox jumps over the lazy dog + The quick brown fox jumps over the napping dog + The quick brown fox jumps over three napping cats in the barn + three napping cats in the barn three napping cats in the barn + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp new file mode 100644 index 00000000000..2d45857cac0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IndexOf Example/CPP/source.cpp @@ -0,0 +1,76 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList with three elements of the same value. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "the" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + myAL->Add( "in" ); + myAL->Add( "the" ); + myAL->Add( "barn" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList contains the following values:" ); + PrintIndexAndValues( myAL ); + + // Search for the first occurrence of the duplicated value. + String^ myString = "the"; + int myIndex = myAL->IndexOf( myString ); + Console::WriteLine( "The first occurrence of \"{0}\" is at index {1}.", myString, myIndex ); + + // Search for the first occurrence of the duplicated value in the last section of the ArrayList. + myIndex = myAL->IndexOf( myString, 4 ); + Console::WriteLine( "The first occurrence of \"{0}\" between index 4 and the end is at index {1}.", myString, myIndex ); + + // Search for the first occurrence of the duplicated value in a section of the ArrayList. + myIndex = myAL->IndexOf( myString, 6, 6 ); + Console::WriteLine( "The first occurrence of \"{0}\" between index 6 and index 11 is at index {1}.", myString, myIndex ); +} + +void PrintIndexAndValues( IEnumerable^ myList ) +{ + int i = 0; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " [{0}]: {1}", i++, obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList contains the following values: + [0]: the + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + [9]: in + [10]: the + [11]: barn + + The first occurrence of "the" is at index 0. + The first occurrence of "the" between index 4 and the end is at index 6. + The first occurrence of "the" between index 6 and index 11 is at index 6. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp new file mode 100644 index 00000000000..f29a6c01426 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Insert Example/CPP/source.cpp @@ -0,0 +1,91 @@ +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList using Insert instead of Add. + ArrayList^ myAL = gcnew ArrayList; + myAL->Insert( 0, "The" ); + myAL->Insert( 1, "fox" ); + myAL->Insert( 2, "jumps" ); + myAL->Insert( 3, "over" ); + myAL->Insert( 4, "the" ); + myAL->Insert( 5, "dog" ); + + // Creates and initializes a new Queue. + Queue^ myQueue = gcnew Queue; + myQueue->Enqueue( "quick" ); + myQueue->Enqueue( "brown" ); + + // Displays the ArrayList and the Queue. + Console::WriteLine( "The ArrayList initially contains the following:" ); + PrintValues( myAL ); + Console::WriteLine( "The Queue initially contains the following:" ); + PrintValues( myQueue ); + + // Copies the Queue elements to the ArrayList at index 1. + myAL->InsertRange( 1, myQueue ); + + // Displays the ArrayList. + Console::WriteLine( "After adding the Queue, the ArrayList now contains:" ); + PrintValues( myAL ); + + // Search for "dog" and add "lazy" before it. + myAL->Insert( myAL->IndexOf( "dog" ), "lazy" ); + + // Displays the ArrayList. + Console::WriteLine( "After adding \"lazy\", the ArrayList now contains:" ); + PrintValues( myAL ); + + // Add "!!!" at the end. + myAL->Insert( myAL->Count, "!!!" ); + + // Displays the ArrayList. + Console::WriteLine( "After adding \"!!!\", the ArrayList now contains:" ); + PrintValues( myAL ); + + // Inserting an element beyond Count throws an exception. + try + { + myAL->Insert( myAL->Count + 1, "anystring" ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList initially contains the following: + The fox jumps over the dog + The Queue initially contains the following: + quick brown + After adding the Queue, the ArrayList now contains: + The quick brown fox jumps over the dog + After adding "lazy", the ArrayList now contains: + The quick brown fox jumps over the lazy dog + After adding "!!!", the ArrayList now contains: + The quick brown fox jumps over the lazy dog !!! + Exception: System.ArgumentOutOfRangeException: Insertion index was out of range. Must be non-negative and less than or equal to size. + Parameter name: index + at System.Collections.ArrayList.Insert(Int32 index, Object value) + at SamplesArrayList.Main() + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp new file mode 100644 index 00000000000..e5271eb3ea7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsFixedSize Example/CPP/source.cpp @@ -0,0 +1,127 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, char mySeparator ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Create a fixed-size wrapper around the ArrayList. + ArrayList^ myFixedSizeAL = ArrayList::FixedSize( myAL ); + + // Display whether the ArrayLists have a fixed size or not. + Console::WriteLine( "myAL {0}.", myAL->IsFixedSize ? (String^)"has a fixed size" : "does not have a fixed size" ); + Console::WriteLine( "myFixedSizeAL {0}.", myFixedSizeAL->IsFixedSize ? (String^)"has a fixed size" : "does not have a fixed size" ); + Console::WriteLine(); + + // Display both ArrayLists. + Console::WriteLine( "Initially," ); + Console::Write( "Standard :" ); + PrintValues( myAL, ' ' ); + Console::Write( "Fixed size:" ); + PrintValues( myFixedSizeAL, ' ' ); + + // Sort is allowed in the fixed-size ArrayList. + myFixedSizeAL->Sort(); + + // Display both ArrayLists. + Console::WriteLine( "After Sort," ); + Console::Write( "Standard :" ); + PrintValues( myAL, ' ' ); + Console::Write( "Fixed size:" ); + PrintValues( myFixedSizeAL, ' ' ); + + // Reverse is allowed in the fixed-size ArrayList. + myFixedSizeAL->Reverse(); + + // Display both ArrayLists. + Console::WriteLine( "After Reverse," ); + Console::Write( "Standard :" ); + PrintValues( myAL, ' ' ); + Console::Write( "Fixed size:" ); + PrintValues( myFixedSizeAL, ' ' ); + + // Add an element to the standard ArrayList. + myAL->Add( "AddMe" ); + + // Display both ArrayLists. + Console::WriteLine( "After adding to the standard ArrayList," ); + Console::Write( "Standard :" ); + PrintValues( myAL, ' ' ); + Console::Write( "Fixed size:" ); + PrintValues( myFixedSizeAL, ' ' ); + Console::WriteLine(); + + // Adding or inserting elements to the fixed-size ArrayList throws an exception. + try + { + myFixedSizeAL->Add( "AddMe2" ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + + try + { + myFixedSizeAL->Insert( 3, "InsertMe" ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + +} + +void PrintValues( IEnumerable^ myList, char mySeparator ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( "{0}{1}", mySeparator, obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + myAL does not have a fixed size. + myFixedSizeAL has a fixed size. + + Initially, + Standard : The quick brown fox jumps over the lazy dog + Fixed size: The quick brown fox jumps over the lazy dog + After Sort, + Standard : brown dog fox jumps lazy over quick the The + Fixed size: brown dog fox jumps lazy over quick the The + After Reverse, + Standard : The the quick over lazy jumps fox dog brown + Fixed size: The the quick over lazy jumps fox dog brown + After adding to the standard ArrayList, + Standard : The the quick over lazy jumps fox dog brown AddMe + Fixed size: The the quick over lazy jumps fox dog brown AddMe + + Exception: System.NotSupportedException: Collection was of a fixed size. + at System.Collections.FixedSizeArrayList.Add(Object obj) + at SamplesArrayList.Main() + Exception: System.NotSupportedException: Collection was of a fixed size. + at System.Collections.FixedSizeArrayList.Insert(Int32 index, Object obj) + at SamplesArrayList.Main() + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp new file mode 100644 index 00000000000..83e78208a4d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Collections; +int main() +{ + + // Creates and initializes a new ArrayList instance. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + + // Creates a synchronized wrapper around the ArrayList. + ArrayList^ mySyncdAL = ArrayList::Synchronized( myAL ); + + // Displays the sychronization status of both ArrayLists. + String^ szRes = myAL->IsSynchronized ? (String^)"synchronized" : "not synchronized"; + Console::WriteLine( "myAL is {0}.", szRes ); + String^ szSyncRes = mySyncdAL->IsSynchronized ? (String^)"synchronized" : "not synchronized"; + Console::WriteLine( "mySyncdAL is {0}.", szSyncRes ); +} + +/* + This code produces the following output. + + myAL is not synchronized. + mySyncdAL is synchronized. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp new file mode 100644 index 00000000000..7180bf8a5e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.IsSynchronized Example/CPP/source2.cpp @@ -0,0 +1,35 @@ +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class SamplesArrayList +{ +public: + static void Main() + { + // + ArrayList^ myCollection = gcnew ArrayList(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesArrayList::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp new file mode 100644 index 00000000000..29c9798e23c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.LastIndexOf Example/CPP/source.cpp @@ -0,0 +1,76 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList with three elements of the same value. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "the" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + myAL->Add( "in" ); + myAL->Add( "the" ); + myAL->Add( "barn" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList contains the following values:" ); + PrintIndexAndValues( myAL ); + + // Searches for the last occurrence of the duplicated value. + String^ myString = "the"; + int myIndex = myAL->LastIndexOf( myString ); + Console::WriteLine( "The last occurrence of \"{0}\" is at index {1}.", myString, myIndex ); + + // Searches for the last occurrence of the duplicated value in the first section of the ArrayList. + myIndex = myAL->LastIndexOf( myString, 8 ); + Console::WriteLine( "The last occurrence of \"{0}\" between the start and index 8 is at index {1}.", myString, myIndex ); + + // Searches for the last occurrence of the duplicated value in a section of the ArrayList. Note that the start index is greater than the end index because the search is done backward. + myIndex = myAL->LastIndexOf( myString, 10, 6 ); + Console::WriteLine( "The last occurrence of \"{0}\" between index 10 and index 5 is at index {1}.", myString, myIndex ); +} + +void PrintIndexAndValues( IEnumerable^ myList ) +{ + int i = 0; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " [{0}]: {1}", i++, obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList contains the following values: + [0]: the + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + [9]: in + [10]: the + [11]: barn + + The last occurrence of "the" is at index 10. + The last occurrence of "the" between the start and index 8 is at index 6. + The last occurrence of "the" between index 10 and index 5 is at index 10. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp new file mode 100644 index 00000000000..874f42b2001 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.ReadOnly1 Example/CPP/source.cpp @@ -0,0 +1,91 @@ + +// +#using + +using namespace System; +using namespace System::Collections; +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "red" ); + myAL->Add( "orange" ); + myAL->Add( "yellow" ); + + // Creates a read-only copy of the ArrayList. + ArrayList^ myReadOnlyAL = ArrayList::ReadOnly( myAL ); + + // Displays whether the ArrayList is read-only or writable. + Console::WriteLine( "myAL is {0}.", myAL->IsReadOnly ? (String^)"read-only" : "writable" ); + Console::WriteLine( "myReadOnlyAL is {0}.", myReadOnlyAL->IsReadOnly ? (String^)"read-only" : "writable" ); + + // Displays the contents of both collections. + Console::WriteLine( "\nInitially," ); + Console::WriteLine( "The original ArrayList myAL contains:" ); + for ( int i(0); i < myAL->Count; ++i ) + Console::WriteLine( " {0}", static_cast(myAL[ i ]) ); + Console::WriteLine( "The read-only ArrayList myReadOnlyAL contains:" ); + for ( int i(0); i < myReadOnlyAL->Count; ++i ) + Console::WriteLine( " {0}", static_cast(myReadOnlyAL[ i ]) ); + + // Adding an element to a read-only ArrayList throws an exception. + Console::WriteLine( "\nTrying to add a new element to the read-only ArrayList:" ); + try + { + myReadOnlyAL->Add( "green" ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( String::Concat( "Exception: ", myException->ToString() ) ); + } + + + // Adding an element to the original ArrayList affects the read-only ArrayList. + myAL->Add( "blue" ); + + // Displays the contents of both collections again. + Console::WriteLine( "\nAfter adding a new element to the original ArrayList," ); + Console::WriteLine( "The original ArrayList myAL contains:" ); + for ( int i(0); i < myAL->Count; ++i ) + Console::WriteLine( " {0}", static_cast(myAL[ i ]) ); + Console::WriteLine( "The read-only ArrayList myReadOnlyAL contains:" ); + for ( int i(0); i < myReadOnlyAL->Count; ++i ) + Console::WriteLine( " {0}", static_cast(myReadOnlyAL[ i ]) ); +} + +/* +This code produces the following output. + +myAL is writable. +myReadOnlyAL is read-only. + +Initially, +The original ArrayList myAL contains: + red + orange + yellow +The read-only ArrayList myReadOnlyAL contains: + red + orange + yellow + +Trying to add a new element to the read-only ArrayList: +Exception: System.NotSupportedException: Collection is read-only. + at System.Collections.ReadOnlyArrayList.Add(Object obj) + at SamplesArrayList.Main() + +After adding a new element to the original ArrayList, +The original ArrayList myAL contains: + red + orange + yellow + blue +The read-only ArrayList myReadOnlyAL contains: + red + orange + yellow + blue + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp new file mode 100644 index 00000000000..4b53513ceb4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Remove Example/CPP/source.cpp @@ -0,0 +1,71 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the ArrayList. + Console::WriteLine( "The ArrayList initially contains the following:" ); + PrintValues( myAL ); + + // Removes the element containing "lazy". + myAL->Remove( "lazy" ); + + // Displays the current state of the ArrayList. + Console::WriteLine( "After removing \"lazy\":" ); + PrintValues( myAL ); + + // Removes the element at index 5. + myAL->RemoveAt( 5 ); + + // Displays the current state of the ArrayList. + Console::WriteLine( "After removing the element at index 5:" ); + PrintValues( myAL ); + + // Removes three elements starting at index 4. + myAL->RemoveRange( 4, 3 ); + + // Displays the current state of the ArrayList. + Console::WriteLine( "After removing three elements starting at index 4:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList initially contains the following: + The quick brown fox jumps over the lazy dog + After removing "lazy": + The quick brown fox jumps over the dog + After removing the element at index 5: + The quick brown fox jumps the dog + After removing three elements starting at index 4: + The quick brown fox + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp new file mode 100644 index 00000000000..0de76e16267 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Repeat Example/CPP/source.cpp @@ -0,0 +1,55 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates a new ArrayList with five elements and initialize each element with a null value. + ArrayList^ myAL = ArrayList::Repeat( 0, 5 ); + + // Displays the count, capacity and values of the ArrayList. + Console::WriteLine( "ArrayList with five elements with a null value" ); + Console::WriteLine( " Count : {0}", myAL->Count ); + Console::WriteLine( " Capacity : {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); + + // Creates a new ArrayList with seven elements and initialize each element with the string "abc". + myAL = ArrayList::Repeat( "abc", 7 ); + + // Displays the count, capacity and values of the ArrayList. + Console::WriteLine( "ArrayList with seven elements with a string value" ); + Console::WriteLine( " Count : {0}", myAL->Count ); + Console::WriteLine( " Capacity : {0}", myAL->Capacity ); + Console::Write( " Values:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + ArrayList with five elements with a null value + Count : 5 + Capacity : 16 + Values: + ArrayList with seven elements with a string value + Count : 7 + Capacity : 16 + Values: abc abc abc abc abc abc abc + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp new file mode 100644 index 00000000000..0fed55d8877 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse Example/CPP/source.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList initially contains the following values:" ); + PrintValues( myAL ); + + // Reverses the sort order of the values of the ArrayList. + myAL->Reverse(); + + // Displays the values of the ArrayList. + Console::WriteLine( "After reversing:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList initially contains the following values: + The + quick + brown + fox + jumps + over + the + lazy + dog + + After reversing: + dog + lazy + the + over + jumps + fox + brown + quick + The + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp new file mode 100644 index 00000000000..94b787234f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Reverse1 Example/CPP/source.cpp @@ -0,0 +1,71 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "QUICK" ); + myAL->Add( "BROWN" ); + myAL->Add( "FOX" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList initially contains the following values:" ); + PrintValues( myAL ); + + // Reverses the sort order of the values of the ArrayList. + myAL->Reverse( 1, 3 ); + + // Displays the values of the ArrayList. + Console::WriteLine( "After reversing:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList initially contains the following values: + The + QUICK + BROWN + FOX + jumps + over + the + lazy + dog + + After reversing: + The + FOX + BROWN + QUICK + jumps + over + the + lazy + dog + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp new file mode 100644 index 00000000000..87913eb48c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.SetRange Example/CPP/source.cpp @@ -0,0 +1,61 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, char mySeparator ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Creates and initializes the source ICollection. + Queue^ mySourceList = gcnew Queue; + mySourceList->Enqueue( "big" ); + mySourceList->Enqueue( "gray" ); + mySourceList->Enqueue( "wolf" ); + + // Displays the values of five elements starting at index 0. + ArrayList^ mySubAL = myAL->GetRange( 0, 5 ); + Console::WriteLine( "Index 0 through 4 contains:" ); + PrintValues( mySubAL, '\t' ); + + // Replaces the values of five elements starting at index 1 with the values in the ICollection. + myAL->SetRange( 1, mySourceList ); + + // Displays the values of five elements starting at index 0. + mySubAL = myAL->GetRange( 0, 5 ); + Console::WriteLine( "Index 0 through 4 now contains:" ); + PrintValues( mySubAL, '\t' ); +} + +void PrintValues( IEnumerable^ myList, char mySeparator ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( "{0}{1}", mySeparator, obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Index 0 through 4 contains: + The quick brown fox jumps + Index 0 through 4 now contains: + The big gray wolf jumps + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp new file mode 100644 index 00000000000..0b0876c0b0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ArrayList.Sort Example/CPP/source.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList ); +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList initially contains the following values:" ); + PrintValues( myAL ); + + // Sorts the values of the ArrayList. + myAL->Sort(); + + // Displays the values of the ArrayList. + Console::WriteLine( "After sorting:" ); + PrintValues( myAL ); +} + +void PrintValues( IEnumerable^ myList ) +{ + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The ArrayList initially contains the following values: + The + quick + brown + fox + jumps + over + the + lazy + dog + + After sorting: + brown + dog + fox + jumps + lazy + over + quick + the + The + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp new file mode 100644 index 00000000000..ecaba9d9d0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Assembly.GetModules Example/CPP/source.cpp @@ -0,0 +1,15 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Assembly^ mainAssembly = Assembly::GetExecutingAssembly(); + Console::WriteLine( "The executing assembly is {0}.", mainAssembly ); + array^mods = mainAssembly->GetModules(); + Console::WriteLine( "\tModules in the assembly:" ); + for ( int i = 0; i < mods->Length; i++ ) + Console::WriteLine( "\t{0}", mods[ i ] ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..2aa6055f25c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic AttributeUsageAttribute.AttributeUsageAttribute Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +#using + +using namespace System; + +// +namespace InteropServices +{ + [AttributeUsage(AttributeTargets::Method| + AttributeTargets::Field| + AttributeTargets::Property) + ] + public ref class DispIdAttribute: public Attribute + { + public: + DispIdAttribute( int value ) + { + // . . . + } + + property int Value + { + int get() + { + // . . . + return 0; + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp new file mode 100644 index 00000000000..d0f81ed9be8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source.cpp @@ -0,0 +1,119 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, int myWidth ); +int main() +{ + + // Creates and initializes several BitArrays. + BitArray^ myBA1 = gcnew BitArray( 5 ); + BitArray^ myBA2 = gcnew BitArray( 5,false ); + array^myBytes = {1,2,3,4,5}; + BitArray^ myBA3 = gcnew BitArray( myBytes ); + array^myBools = {true,false,true,true,false}; + BitArray^ myBA4 = gcnew BitArray( myBools ); + array^myInts = {6,7,8,9,10}; + BitArray^ myBA5 = gcnew BitArray( myInts ); + + // Displays the properties and values of the BitArrays. + Console::WriteLine( "myBA1" ); + Console::WriteLine( " Count: {0}", myBA1->Count ); + Console::WriteLine( " Length: {0}", myBA1->Length ); + Console::WriteLine( " Values:" ); + PrintValues( myBA1, 8 ); + Console::WriteLine( "myBA2" ); + Console::WriteLine( " Count: {0}", myBA2->Count ); + Console::WriteLine( " Length: {0}", myBA2->Length ); + Console::WriteLine( " Values:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine( "myBA3" ); + Console::WriteLine( " Count: {0}", myBA3->Count ); + Console::WriteLine( " Length: {0}", myBA3->Length ); + Console::WriteLine( " Values:" ); + PrintValues( myBA3, 8 ); + Console::WriteLine( "myBA4" ); + Console::WriteLine( " Count: {0}", myBA4->Count ); + Console::WriteLine( " Length: {0}", myBA4->Length ); + Console::WriteLine( " Values:" ); + PrintValues( myBA4, 8 ); + Console::WriteLine( "myBA5" ); + Console::WriteLine( " Count: {0}", myBA5->Count ); + Console::WriteLine( " Length: {0}", myBA5->Length ); + Console::WriteLine( " Values:" ); + PrintValues( myBA5, 8 ); +} + +void PrintValues( IEnumerable^ myList, int myWidth ) +{ + int i = myWidth; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + if ( i <= 0 ) + { + i = myWidth; + Console::WriteLine(); + } + + i--; + Console::Write( "{0,8}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + myBA1 + Count: 5 + Length: 5 + Values: + False False False False False + myBA2 + Count: 5 + Length: 5 + Values: + False False False False False + myBA3 + Count: 40 + Length: 40 + Values: + True False False False False False False False + False True False False False False False False + True True False False False False False False + False False True False False False False False + True False True False False False False False + myBA4 + Count: 5 + Length: 5 + Values: + True False True True False + myBA5 + Count: 160 + Length: 160 + Values: + False True True False False False False False + False False False False False False False False + False False False False False False False False + False False False False False False False False + True True True False False False False False + False False False False False False False False + False False False False False False False False + False False False False False False False False + False False False True False False False False + False False False False False False False False + False False False False False False False False + False False False False False False False False + True False False True False False False False + False False False False False False False False + False False False False False False False False + False False False False False False False False + False True False True False False False False + False False False False False False False False + False False False False False False False False + False False False False False False False False + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp new file mode 100644 index 00000000000..fec3d1d5c3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray Example/CPP/source2.cpp @@ -0,0 +1,37 @@ +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class SamplesLocker +{ +public: + static void Main() + { + // + BitArray^ myCollection = gcnew BitArray(64, true); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesLocker::Main(); +} + + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp new file mode 100644 index 00000000000..cfd52ecb27a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.And Example/CPP/source.cpp @@ -0,0 +1,98 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, int myWidth ); +int main() +{ + + // Creates and initializes two BitArrays of the same size. + BitArray^ myBA1 = gcnew BitArray( 4 ); + BitArray^ myBA2 = gcnew BitArray( 4 ); + myBA1[ 0 ] = false; + myBA1[ 1 ] = false; + myBA1[ 2 ] = true; + myBA1[ 3 ] = true; + myBA2[ 0 ] = false; + myBA2[ 2 ] = false; + myBA2[ 1 ] = true; + myBA2[ 3 ] = true; + + // Performs a bitwise AND operation between BitArray instances of the same size. + Console::WriteLine( "Initial values" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + Console::WriteLine( "Result" ); + Console::Write( "AND:" ); + PrintValues( myBA1->And( myBA2 ), 8 ); + Console::WriteLine(); + Console::WriteLine( "After AND" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + + // Performing AND between BitArray instances of different sizes returns an exception. + try + { + BitArray^ myBA3 = gcnew BitArray( 8 ); + myBA3[ 0 ] = false; + myBA3[ 1 ] = false; + myBA3[ 2 ] = false; + myBA3[ 3 ] = false; + myBA3[ 4 ] = true; + myBA3[ 5 ] = true; + myBA3[ 6 ] = true; + myBA3[ 7 ] = true; + myBA1->And( myBA3 ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + +} + +void PrintValues( IEnumerable^ myList, int myWidth ) +{ + int i = myWidth; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + if ( i <= 0 ) + { + i = myWidth; + Console::WriteLine(); + } + + i--; + Console::Write( "{0,8}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initial values + myBA1: False False True True + myBA2: False True False True + + Result + AND: False False False True + + After AND + myBA1: False False False True + myBA2: False True False True + + Exception: System.ArgumentException: Array lengths must be the same. + at System.Collections.BitArray.And(BitArray value) + at SamplesBitArray.Main() + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..c1f547de31b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.CopyTo Example/CPP/source.cpp @@ -0,0 +1,104 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myArr ); +int main() +{ + // Creates and initializes the source BitArray. + BitArray^ myBA = gcnew BitArray( 4 ); + myBA[ 0 ] = true; + myBA[ 1 ] = true; + myBA[ 2 ] = true; + myBA[ 3 ] = true; + + // Creates and initializes the one-dimensional target Array of type Boolean. + array^myBoolArray = gcnew array(8); + myBoolArray[ 0 ] = false; + myBoolArray[ 1 ] = false; + + // Displays the values of the target Array. + Console::WriteLine( "The target Boolean Array contains the following (before and after copying):" ); + PrintValues( dynamic_cast(myBoolArray) ); + + // Copies the entire source BitArray to the target BitArray, starting at index 3. + myBA->CopyTo( myBoolArray, 3 ); + + // Displays the values of the target Array. + PrintValues( dynamic_cast(myBoolArray) ); + + // Creates and initializes the one-dimensional target Array of type integer. + array^myIntArray = gcnew array(8); + myIntArray[ 0 ] = 42; + myIntArray[ 1 ] = 43; + + // Displays the values of the target Array. + Console::WriteLine( "The target integer Array contains the following (before and after copying):" ); + PrintValues( dynamic_cast(myIntArray) ); + + // Copies the entire source BitArray to the target BitArray, starting at index 3. + myBA->CopyTo( myIntArray, 3 ); + + // Displays the values of the target Array. + PrintValues( dynamic_cast(myIntArray) ); + + // Creates and initializes the one-dimensional target Array of type byte. + Array^ myByteArray = Array::CreateInstance( Byte::typeid, 8 ); + myByteArray->SetValue( (Byte)10, 0 ); + myByteArray->SetValue( (Byte)11, 1 ); + + // Displays the values of the target Array. + Console::WriteLine( "The target byte Array contains the following (before and after copying):" ); + PrintValues( myByteArray ); + + // Copies the entire source BitArray to the target BitArray, starting at index 3. + myBA->CopyTo( myByteArray, 3 ); + + // Displays the values of the target Array. + PrintValues( myByteArray ); + + // Returns an exception if the array is not of type Boolean, integer or byte. + try + { + Array^ myStringArray = Array::CreateInstance( String::typeid, 8 ); + myStringArray->SetValue( "Hello", 0 ); + myStringArray->SetValue( "World", 1 ); + myBA->CopyTo( myStringArray, 3 ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + +} + +void PrintValues( IEnumerable^ myArr ) +{ + IEnumerator^ myEnum = myArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( "{0,8}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Boolean Array contains the following (before and after copying): + False False False False False False False False + False False False True True True True False + The target integer Array contains the following (before and after copying): + 42 43 0 0 0 0 0 0 + 42 43 0 15 0 0 0 0 + The target byte Array contains the following (before and after copying): + 10 11 0 0 0 0 0 0 + 10 11 0 15 0 0 0 0 + Exception: System.ArgumentException: Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[]. + at System.Collections.BitArray.CopyTo(Array array, Int32 index) + at SamplesBitArray.Main() + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp new file mode 100644 index 00000000000..6417fdd49ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Get Example/CPP/source.cpp @@ -0,0 +1,78 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndValues( IEnumerable^ myCol ); +int main() +{ + + // Creates and initializes a BitArray. + BitArray^ myBA = gcnew BitArray( 5 ); + + // Displays the properties and values of the BitArray. + Console::WriteLine( "myBA values:" ); + PrintIndexAndValues( myBA ); + + // Sets all the elements to true. + myBA->SetAll( true ); + + // Displays the properties and values of the BitArray. + Console::WriteLine( "After setting all elements to true," ); + PrintIndexAndValues( myBA ); + + // Sets the last index to false. + myBA->Set( myBA->Count - 1, false ); + + // Displays the properties and values of the BitArray. + Console::WriteLine( "After setting the last element to false," ); + PrintIndexAndValues( myBA ); + + // Gets the value of the last two elements. + Console::WriteLine( "The last two elements are: " ); + Console::WriteLine( " at index {0} : {1}", myBA->Count - 2, myBA->Get( myBA->Count - 2 ) ); + Console::WriteLine( " at index {0} : {1}", myBA->Count - 1, myBA->Get( myBA->Count - 1 ) ); +} + +void PrintIndexAndValues( IEnumerable^ myCol ) +{ + int i = 0; + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " [{0}]: {1}", i++, obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + myBA values: + [0]: False + [1]: False + [2]: False + [3]: False + [4]: False + + After setting all elements to true, + [0]: True + [1]: True + [2]: True + [3]: True + [4]: True + + After setting the last element to false, + [0]: True + [1]: True + [2]: True + [3]: True + [4]: False + + The last two elements are: + at index 3 : True + at index 4 : False + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp new file mode 100644 index 00000000000..ca1de36ae1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Not Example/CPP/source.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, int myWidth ); +int main() +{ + + // Creates and initializes two BitArrays of the same size. + BitArray^ myBA1 = gcnew BitArray( 4 ); + BitArray^ myBA2 = gcnew BitArray( 4 ); + myBA1[ 0 ] = false; + myBA1[ 1 ] = false; + myBA1[ 2 ] = true; + myBA1[ 3 ] = true; + myBA2[ 0 ] = false; + myBA2[ 1 ] = true; + myBA2[ 2 ] = false; + myBA2[ 3 ] = true; + + // Performs a bitwise NOT operation between BitArray instances of the same size. + Console::WriteLine( "Initial values" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + myBA1->Not(); + myBA2->Not(); + Console::WriteLine( "After NOT" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); +} + +void PrintValues( IEnumerable^ myList, int myWidth ) +{ + int i = myWidth; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + if ( i <= 0 ) + { + i = myWidth; + Console::WriteLine(); + } + + i--; + Console::Write( "{0,8}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initial values + myBA1: False False True True + myBA2: False True False True + + After NOT + myBA1: True True False False + myBA2: True False True False + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp new file mode 100644 index 00000000000..0a5de2543d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Or Example/CPP/source.cpp @@ -0,0 +1,98 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, int myWidth ); +int main() +{ + + // Creates and initializes two BitArrays of the same size. + BitArray^ myBA1 = gcnew BitArray( 4 ); + BitArray^ myBA2 = gcnew BitArray( 4 ); + myBA1[ 0 ] = false; + myBA1[ 1 ] = false; + myBA1[ 2 ] = true; + myBA1[ 3 ] = true; + myBA2[ 0 ] = false; + myBA2[ 1 ] = true; + myBA2[ 2 ] = false; + myBA2[ 3 ] = true; + + // Performs a bitwise OR operation between BitArray instances of the same size. + Console::WriteLine( "Initial values" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + Console::WriteLine( "Result" ); + Console::Write( "OR:" ); + PrintValues( myBA1->Or( myBA2 ), 8 ); + Console::WriteLine(); + Console::WriteLine( "After OR" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + + // Performing OR between BitArray instances of different sizes returns an exception. + try + { + BitArray^ myBA3 = gcnew BitArray( 8 ); + myBA3[ 0 ] = false; + myBA3[ 1 ] = false; + myBA3[ 2 ] = false; + myBA3[ 3 ] = false; + myBA3[ 4 ] = true; + myBA3[ 5 ] = true; + myBA3[ 6 ] = true; + myBA3[ 7 ] = true; + myBA1->Or( myBA3 ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + +} + +void PrintValues( IEnumerable^ myList, int myWidth ) +{ + int i = myWidth; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + if ( i <= 0 ) + { + i = myWidth; + Console::WriteLine(); + } + + i--; + Console::Write( "{0,8}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initial values + myBA1: False False True True + myBA2: False True False True + + Result + OR: False True True True + + After OR + myBA1: False True True True + myBA2: False True False True + + Exception: System.ArgumentException: Array lengths must be the same. + at System.Collections.BitArray.Or(BitArray value) + at SamplesBitArray.Main() + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp new file mode 100644 index 00000000000..cd12c4f4ea2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BitArray.Xor Example/CPP/source.cpp @@ -0,0 +1,99 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myList, int myWidth ); +int main() +{ + + // Creates and initializes two BitArrays of the same size. + BitArray^ myBA1 = gcnew BitArray( 4 ); + BitArray^ myBA2 = gcnew BitArray( 4 ); + myBA1[ 0 ] = false; + myBA1[ 1 ] = false; + myBA1[ 2 ] = true; + myBA1[ 3 ] = true; + myBA2[ 0 ] = false; + myBA2[ 1 ] = true; + myBA2[ 2 ] = false; + myBA2[ 3 ] = true; + + // Performs a bitwise XOR operation between BitArray instances of the same size. + Console::WriteLine( "Initial values" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + Console::WriteLine( "Result" ); + Console::Write( "XOR:" ); + PrintValues( myBA1->Xor( myBA2 ), 8 ); + Console::WriteLine(); + Console::WriteLine( "After XOR" ); + Console::Write( "myBA1:" ); + PrintValues( myBA1, 8 ); + Console::Write( "myBA2:" ); + PrintValues( myBA2, 8 ); + Console::WriteLine(); + + // Performing XOR between BitArray instances of different sizes returns an exception. + try + { + BitArray^ myBA3 = gcnew BitArray( 8 ); + myBA3[ 0 ] = false; + myBA3[ 1 ] = false; + myBA3[ 2 ] = false; + myBA3[ 3 ] = false; + myBA3[ 4 ] = true; + myBA3[ 5 ] = true; + myBA3[ 6 ] = true; + myBA3[ 7 ] = true; + myBA1->Xor( myBA3 ); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception: {0}", myException ); + } + +} + +void PrintValues( IEnumerable^ myList, int myWidth ) +{ + int i = myWidth; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + if ( i <= 0 ) + { + i = myWidth; + Console::WriteLine(); + } + + i--; + Console::Write( "{0,8}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initial values + myBA1: False False True True + myBA2: False True False True + + Result + XOR: False True True False + + After XOR + myBA1: False True True False + myBA2: False True False True + + Exception: System.ArgumentException: Array lengths must be the same. + at System.Collections.BitArray.Xor(BitArray value) + at SamplesBitArray.Main() + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp new file mode 100644 index 00000000000..cd78af80b5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/remarks.cpp @@ -0,0 +1,30 @@ +#using + +using namespace System; +using namespace System::Diagnostics; + +public ref class SomeClass +{ +// +private: + static BooleanSwitch^ boolSwitch = gcnew BooleanSwitch("mySwitch", + "Switch in config file"); + +public: + static void Main( ) + { + //... + Console::WriteLine("Boolean switch {0} configured as {1}", + boolSwitch->DisplayName, ((Boolean^)boolSwitch->Enabled)->ToString()); + if (boolSwitch->Enabled) + { + //... + } + } +// +}; + +int main() +{ + SomeClass::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp new file mode 100644 index 00000000000..824f579d9be --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.BooleanSwitch Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +// +public ref class BooleanSwitchTest +{ +private: + + /* Create a BooleanSwitch for data.*/ + static BooleanSwitch^ dataSwitch = gcnew BooleanSwitch( "Data","DataAccess module" ); + +public: + static void MyMethod( String^ location ) + { + + //Insert code here to handle processing. + if ( dataSwitch->Enabled ) + Console::WriteLine( "Error happened at {0}", location ); + } + +}; + +int main() +{ + + //Run the method which writes an error message specifying the location of the error. + BooleanSwitchTest::MyMethod( "in main" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp new file mode 100644 index 00000000000..fb8731a2646 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic BooleanSwitch.Enabled Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +// +public ref class BooleanSwitchTest +{ +private: + + /* Create a BooleanSwitch for data.*/ + static BooleanSwitch^ dataSwitch = gcnew BooleanSwitch( "Data","DataAccess module" ); + +public: + static void MyMethod( String^ location ) + { + + //Insert code here to handle processing. + if ( dataSwitch->Enabled ) + Console::WriteLine( "Error happened at {0}", location ); + } + +}; + +int main() +{ + + //Run the method that writes an error message specifying the location of the error. + BooleanSwitchTest::MyMethod( "in main" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..cf7e2053472 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ClassInterfaceAttribute Example/CPP/source.cpp @@ -0,0 +1,13 @@ + +// +using namespace System::Runtime::InteropServices; + +[ClassInterface(ClassInterfaceType::AutoDispatch)] +public ref class MyClass +{ +public: + MyClass(){} + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp new file mode 100644 index 00000000000..1264a13f77c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic CodeGroup.PolicyStatement Example/CPP/source.cpp @@ -0,0 +1,16 @@ +using namespace System; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; + +public ref class Sample +{ +private: + void Method() + { + FirstMatchCodeGroup^ codeGroup = gcnew FirstMatchCodeGroup( nullptr,gcnew PolicyStatement( gcnew PermissionSet( PermissionState::None ) ) ); + // + codeGroup->PolicyStatement = gcnew PolicyStatement( gcnew NamedPermissionSet( "MyPermissionSet" ) ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..6f07c6f7725 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComAliasNameAttribute Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Runtime::InteropServices; + +/* +*/ +// +interface class Baz +{ + void SetColor( [ComAliasName("stdole.OLE_COLOR")]int cl ); + + [returnvalue:ComAliasName("stdole.OLE_COLOR")] + int GetColor(); +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..5f0c83c0974 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComRegisterFunctionAttribute Example/CPP/source.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Runtime::InteropServices; +public ref class MyClassThatNeedsToRegister +{ +public: + + [ComRegisterFunctionAttribute] + static void RegisterFunction( Type^ t ) + { + + //Insert code here. + } + + + [ComUnregisterFunctionAttribute] + static void UnregisterFunction( Type^ t ) + { + + //Insert code here. + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..fb779b2bf59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComSourceInterfacesAttribute Example/CPP/source.cpp @@ -0,0 +1,8 @@ + +// +using namespace System::Runtime::InteropServices; + +[ComSourceInterfacesAttribute("ButtonEventsLib.ButtonEvents, ButtonEventsLib")] +public ref class Baz{}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..51b8108af9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ComVisibleAttribute Example/CPP/source.cpp @@ -0,0 +1,45 @@ + +using namespace System; +// +using namespace System::Runtime::InteropServices; + +[ComVisible(false)] +ref class MyClass +{ +private: + int myProperty; + +public: + MyClass() + { + + //Insert code here. + } + + + [ComVisible(false)] + int MyMethod( String^ param ) + { + return 0; + } + + bool MyOtherMethod() + { + return true; + } + + + property int MyProperty + { + + [ComVisible(false)] + int get() + { + return myProperty; + } + + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp new file mode 100644 index 00000000000..b9c151ae5a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic CompilerError Example/CPP/source.cpp @@ -0,0 +1,80 @@ + + +// +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; +using namespace Microsoft::CSharp; +CodeCompileUnit^ GetCompileUnit() +{ + + // Create a compile unit to contain a CodeDOM graph. + CodeCompileUnit^ cu = gcnew CodeCompileUnit; + + // Create a namespace named TestSpace. + CodeNamespace^ cn = gcnew CodeNamespace( "TestSpace" ); + + // Declare a new type named TestClass. + CodeTypeDeclaration^ cd = gcnew CodeTypeDeclaration( "TestClass" ); + + // Declare a new member string field named TestField. + CodeMemberField^ cmf = gcnew CodeMemberField( "System.String","TestField" ); + + // Add the field to the type. + cd->Members->Add( cmf ); + + // Declare a new member method named TestMethod. + CodeMemberMethod^ cm = gcnew CodeMemberMethod; + cm->Name = "TestMethod"; + + // Declare a string variable named TestVariable. + CodeVariableDeclarationStatement^ cvd = gcnew CodeVariableDeclarationStatement( "System.String1","TestVariable" ); + cm->Statements->Add( cvd ); + + // Cast the TestField reference expression to string and assign it to the TestVariable. + CodeAssignStatement^ ca = gcnew CodeAssignStatement( gcnew CodeVariableReferenceExpression( "TestVariable" ),gcnew CodeCastExpression( "System.String2",gcnew CodeFieldReferenceExpression( gcnew CodeThisReferenceExpression,"TestField" ) ) ); + + // This code can be used to generate the following code in C#: + // TestVariable = ((string)(this.TestField)); + cm->Statements->Add( ca ); + + // Add the TestMethod member to the TestClass type. + cd->Members->Add( cm ); + + // Add the TestClass type to the namespace. + cn->Types->Add( cd ); + + // Add the TestSpace namespace to the compile unit. + cu->Namespaces->Add( cn ); + return cu; +} + +int main() +{ + + // Output some program information using Console.WriteLine. + Console::WriteLine( "This program compiles a CodeDOM program that incorrectly declares multiple data" ); + Console::WriteLine( "types to demonstrate handling compiler errors programmatically." ); + Console::WriteLine( "" ); + + // Compile the CodeCompileUnit retrieved from the GetCompileUnit() method. + //CSharpCodeProvider ^ provider = gcnew Microsoft::CSharp::CSharpCodeProvider; + CodeDomProvider ^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Initialize a CompilerParameters with the options for compilation. + array^assemblies = {"System.dll"}; + CompilerParameters^ options = gcnew CompilerParameters( assemblies,"output.exe" ); + + // Compile the CodeDOM graph and store the results in a CompilerResults. + CompilerResults^ results = provider->CompileAssemblyFromDom( options, GetCompileUnit() ); + + // Compilation produces errors. Print out each error. + Console::WriteLine( "Listing errors from compilation: " ); + Console::WriteLine( "" ); + for ( int i = 0; i < results->Errors->Count; i++ ) + Console::WriteLine( results->Errors[ i ] ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp new file mode 100644 index 00000000000..d67485dbd80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic CryptoStream Example/CPP/source.cpp @@ -0,0 +1,46 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::ComponentModel; +using namespace System::Security::Cryptography; + +// +void EncryptData( String^ inName, String^ outName, array^aesKey, array^aesIV ) +{ + + //Create the file streams to handle the input and output files. + FileStream^ fin = gcnew FileStream( inName,FileMode::Open,FileAccess::Read ); + FileStream^ fout = gcnew FileStream( outName,FileMode::OpenOrCreate,FileAccess::Write ); + fout->SetLength( 0 ); + + //Create variables to help with read and write. + array^bin = gcnew array(100); + long rdlen = 0; //This is the total number of bytes written. + + long totlen = (long)fin->Length; //This is the total length of the input file. + + int len; //This is the number of bytes to be written at a time. + + Aes^ aes = Aes::Create(); + + CryptoStream^ encStream = gcnew CryptoStream( fout,aes->CreateEncryptor( aesKey, aesIV ),CryptoStreamMode::Write ); + Console::WriteLine( "Encrypting..." ); + + //Read from the input file, then encrypt and write to the output file. + while ( rdlen < totlen ) + { + len = fin->Read( bin, 0, 100 ); + encStream->Write( bin, 0, len ); + rdlen = rdlen + len; + Console::WriteLine( "{0} bytes processed", rdlen ); + } + + encStream->Close(); + fout->Close(); + fin->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp new file mode 100644 index 00000000000..505973f52b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic DES Example/CPP/source.cpp @@ -0,0 +1,46 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Windows::Forms; +using namespace System::Security::Cryptography; + +// +void EncryptData( String^ inName, String^ outName, array^desKey, array^desIV ) +{ + + //Create the file streams to handle the input and output files. + FileStream^ fin = gcnew FileStream( inName,FileMode::Open,FileAccess::Read ); + FileStream^ fout = gcnew FileStream( outName,FileMode::OpenOrCreate,FileAccess::Write ); + fout->SetLength( 0 ); + + //Create variables to help with read and write. + array^bin = gcnew array(100); + long rdlen = 0; //This is the total number of bytes written. + + long totlen = (long)fin->Length; //This is the total length of the input file. + + int len; //This is the number of bytes to be written at a time. + + DES^ des = gcnew DESCryptoServiceProvider; + CryptoStream^ encStream = gcnew CryptoStream( fout,des->CreateEncryptor( desKey, desIV ),CryptoStreamMode::Write ); + Console::WriteLine( "Encrypting..." ); + + //Read from the input file, then encrypt and write to the output file. + while ( rdlen < totlen ) + { + len = fin->Read( bin, 0, 100 ); + encStream->Write( bin, 0, len ); + rdlen = rdlen + len; + Console::WriteLine( "{0} bytes processed", rdlen ); + } + + encStream->Close(); + fout->Close(); + fin->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp new file mode 100644 index 00000000000..494de16ea1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTime.ToString2 Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace System::Globalization; +void main() +{ + DateTime dt = DateTime::Now; + array^format = {L"d",L"D",L"f",L"F",L"g",L"G",L"m",L"r",L"s",L"t",L"T",L"u",L"U",L"y",L"dddd, MMMM dd yyyy",L"ddd, MMM d \"'\"yy",L"dddd, MMMM dd",L"M/yy",L"dd-MM-yy"}; + String^ date; + for ( int i = 0; i < format->Length; i++ ) + { + date = dt.ToString( format[ i ], DateTimeFormatInfo::InvariantInfo ); + Console::WriteLine( String::Concat( format[ i ], L" :", date ) ); + + } + + /** Output. + * + * d :08/17/2000 + * D :Thursday, August 17, 2000 + * f :Thursday, August 17, 2000 16:32 + * F :Thursday, August 17, 2000 16:32:32 + * g :08/17/2000 16:32 + * G :08/17/2000 16:32:32 + * m :August 17 + * r :Thu, 17 Aug 2000 23:32:32 GMT + * s :2000-08-17T16:32:32 + * t :16:32 + * T :16:32:32 + * u :2000-08-17 23:32:32Z + * U :Thursday, August 17, 2000 23:32:32 + * y :August, 2000 + * dddd, MMMM dd yyyy :Thursday, August 17 2000 + * ddd, MMM d "'"yy :Thu, Aug 17 '00 + * dddd, MMMM dd :Thursday, August 17 + * M/yy :8/00 + * dd-MM-yy :17-08-00 + */ +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp new file mode 100644 index 00000000000..ca1ec41a454 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic DateTimeFormatInfo.GetAllDateTimePatterns Example/CPP/source.cpp @@ -0,0 +1,109 @@ + + +// +#using + +using namespace System; +using namespace System::Globalization; +public ref class SamplesDateTimeFormatInfo +{ +public: + static void Main() + { + + // Creates a new DateTimeFormatinfo. + DateTimeFormatInfo^ myDtfi = gcnew DateTimeFormatInfo; + + // Gets and prints all the patterns + array^myPatternsArray = myDtfi->GetAllDateTimePatterns(); + Console::WriteLine( "ALL the patterns:" ); + PrintIndexAndValues( myPatternsArray ); + + // Gets and prints the pattern(s) associated with some of the format characters. + myPatternsArray = myDtfi->GetAllDateTimePatterns( 'd' ); + Console::WriteLine( "The patterns for 'd':" ); + PrintIndexAndValues( myPatternsArray ); + myPatternsArray = myDtfi->GetAllDateTimePatterns( 'D' ); + Console::WriteLine( "The patterns for 'D':" ); + PrintIndexAndValues( myPatternsArray ); + myPatternsArray = myDtfi->GetAllDateTimePatterns( 'f' ); + Console::WriteLine( "The patterns for 'f':" ); + PrintIndexAndValues( myPatternsArray ); + myPatternsArray = myDtfi->GetAllDateTimePatterns( 'F' ); + Console::WriteLine( "The patterns for 'F':" ); + PrintIndexAndValues( myPatternsArray ); + myPatternsArray = myDtfi->GetAllDateTimePatterns( 'r' ); + Console::WriteLine( "The patterns for 'r':" ); + PrintIndexAndValues( myPatternsArray ); + myPatternsArray = myDtfi->GetAllDateTimePatterns( 'R' ); + Console::WriteLine( "The patterns for 'R':" ); + PrintIndexAndValues( myPatternsArray ); + } + + public: + static void PrintIndexAndValues( array^myArray ) { + int i = 0; + for each ( String^ s in myArray ) + Console::WriteLine( "\t[{0}]:\t{1}", i++, s ); + Console::WriteLine(); + } +}; + +int main() +{ + SamplesDateTimeFormatInfo::Main(); +} + +/* +This code produces the following output. + +ALL the patterns: + [0]: MM/dd/yyyy + [1]: dddd, dd MMMM yyyy + [2]: dddd, dd MMMM yyyy HH:mm + [3]: dddd, dd MMMM yyyy hh:mm tt + [4]: dddd, dd MMMM yyyy H:mm + [5]: dddd, dd MMMM yyyy h:mm tt + [6]: dddd, dd MMMM yyyy HH:mm:ss + [7]: MM/dd/yyyy HH:mm + [8]: MM/dd/yyyy hh:mm tt + [9]: MM/dd/yyyy H:mm + [10]: MM/dd/yyyy h:mm tt + [11]: MM/dd/yyyy HH:mm:ss + [12]: MMMM dd + [13]: MMMM dd + [14]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' + [15]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' + [16]: yyyy'-'MM'-'dd'T'HH':'mm':'ss + [17]: HH:mm + [18]: hh:mm tt + [19]: H:mm + [20]: h:mm tt + [21]: HH:mm:ss + [22]: yyyy'-'MM'-'dd HH':'mm':'ss'Z' + [23]: dddd, dd MMMM yyyy HH:mm:ss + [24]: yyyy MMMM + [25]: yyyy MMMM + +The patterns for 'd': + [0]: MM/dd/yyyy + +The patterns for 'D': + [0]: dddd, dd MMMM yyyy + +The patterns for 'f': + [0]: dddd, dd MMMM yyyy HH:mm + [1]: dddd, dd MMMM yyyy hh:mm tt + [2]: dddd, dd MMMM yyyy H:mm + [3]: dddd, dd MMMM yyyy h:mm tt + +The patterns for 'F': + [0]: dddd, dd MMMM yyyy HH:mm:ss + +The patterns for 'r': + [0]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' + +The patterns for 'R': + [0]: ddd, dd MMM yyyy HH':'mm':'ss 'GMT' +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp new file mode 100644 index 00000000000..3aab3172dfa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug Example/CPP/source.cpp @@ -0,0 +1,24 @@ +// +// Specify /DDEBUG when compiling. + +#using +using namespace System; +using namespace System::Diagnostics; + +int main( void ) +{ + #if defined(DEBUG) + Debug::Listeners->Add( gcnew TextWriterTraceListener( Console::Out ) ); + Debug::AutoFlush = true; + Debug::Indent(); + Debug::WriteLine( "Entering Main" ); + #endif + Console::WriteLine( "Hello World." ); + #if defined(DEBUG) + Debug::WriteLine( "Exiting Main" ); + Debug::Unindent(); + #endif + return 0; +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp new file mode 100644 index 00000000000..4cd8faa26fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +int main( void ) +{ + + // + // Create a local value. + int index; + + // Perform some action that sets the local value. + index = -40; + + // Test that the local value is valid. + #if defined(DEBUG) + Debug::Assert( index > -1 ); + #endif + // + + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp new file mode 100644 index 00000000000..db8c6bd2ccb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert1 Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +void MyMethod( Object^ obj, Type^ type ); + +int main( void ) +{ + MyMethod( nullptr, nullptr ); + return 0; +} + +// +void MyMethod( Object^ obj, Type^ type ) +{ + #if defined(DEBUG) + Debug::Assert( type != nullptr, "Type paramater is null" ); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp new file mode 100644 index 00000000000..06b428a1024 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Assert2 Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +void MyMethod( Object^ obj, Type^ type ); + +int main( void ) +{ + MyMethod( nullptr, nullptr ); + return 0; +} + +// +void MyMethod( Object^ obj, Type^ type ) +{ + #if defined(DEBUG) + Debug::Assert( type != nullptr, "Type paramater is null", "Can't get object for null type" ); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp new file mode 100644 index 00000000000..a9769743b9c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Close Example/CPP/source.cpp @@ -0,0 +1,29 @@ +// +// Specify /DDEBUG when compiling. + +#using +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +void main() +{ + #if defined(DEBUG) + // Create a new stream object for an output file named TestFile.txt. + FileStream^ myFileStream = + gcnew FileStream( "TestFile.txt", FileMode::Append ); + + // Add the stream object to the trace listeners. + TextWriterTraceListener^ myTextListener = + gcnew TextWriterTraceListener( myFileStream ); + Debug::Listeners->Add( myTextListener ); + + // Write output to the file. + Debug::WriteLine( "Test output" ); + + // Flush and close the output stream. + Debug::Flush(); + Debug::Close(); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp new file mode 100644 index 00000000000..52656e679ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail Example/CPP/source.cpp @@ -0,0 +1,57 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +enum class Option +{ + First, Second, Last +}; + +ref class Test +{ +public: + void SomeMethod() + { + int option = (int)Option::Last + 1; + double result; + // + switch ( option ) + { + case Option::First: + result = 1.0; + break; + + // Insert additional cases. + + default: + #if defined(DEBUG) + Debug::Fail( "Unknown Option" + option ); + #endif + result = 1.0; + break; + } + // + } +}; + +int main( void ) +{ + try + { + Object^ b; + b->ToString(); + } + // + catch ( Exception^ e ) + { + #if defined(DEBUG) + Debug::Fail( "Unknown Option " + option + ", using the default." ); + #endif + } + // + + Test^ test = gcnew Test(); + test->SomeMethod(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp new file mode 100644 index 00000000000..3333cf56f0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Fail1 Example/CPP/source.cpp @@ -0,0 +1,59 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +enum class Option +{ + First, Second, Last +}; + +ref class Test +{ +public: + void SomeMethod() + { + int option = (int)Option::Last + 1; + double result; + // + switch ( option ) + { + case Option::First: + result = 1.0; + break; + + // Insert additional cases. + + default: + #if defined(DEBUG) + Debug::Fail( "Unknown Option" + option, "Result set to 1.0" ); + #endif + result = 1.0; + break; + } + // + } +}; + +int main( void ) +{ + try + { + Object^ b; + b->ToString(); + } + // + catch ( Exception^ e ) + { + #if defined(DEBUG) + Debug::Fail( "Cannot find SpecialController, proceeding with StandardController", "Setting Controller to default value" ); + #endif + } + // + + Test^ test = gcnew Test(); + test->SomeMethod(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp new file mode 100644 index 00000000000..daaf7687108 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.IndentLevel Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +int main( void ) +{ + // + #if defined(DEBUG) + Debug::WriteLine( "List of errors:" ); + Debug::Indent(); + Debug::WriteLine( "Error 1: File not found" ); + Debug::WriteLine( "Error 2: Directory not found" ); + Debug::Unindent(); + Debug::WriteLine( "End of list of errors" ); + #endif + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp new file mode 100644 index 00000000000..267bc674630 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Listeners Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +int main( void ) +{ + + // + // Create a listener that outputs to the console screen + // and add it to the debug listeners. + #if defined(DEBUG) + TextWriterTraceListener^ myWriter = + gcnew TextWriterTraceListener( System::Console::Out ); + Debug::Listeners->Add( myWriter ); + #endif + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp new file mode 100644 index 00000000000..6b4827ca3c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.Write Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( generalSwitch->TraceError ) + { + #if defined(DEBUG) + Debug::Write( myObject, category ); + #endif + } + // Write a second message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + #if defined(DEBUG) + Debug::Write( " Object is not valid for this category." ); + #endif + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp new file mode 100644 index 00000000000..db1cf0381a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod() + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceError, "My error message. " ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteIf( generalSwitch->TraceVerbose, + "My second error message." ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp new file mode 100644 index 00000000000..21e33495423 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf1 Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceError, myObject ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceVerbose, + " is not a valid value for this method." ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp new file mode 100644 index 00000000000..9fa1f596191 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf2 Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceVerbose, String::Concat( myObject, + " is not a valid object for category: " ), category ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceError, + " Please use a different category." ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp new file mode 100644 index 00000000000..aa9a5022701 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteIf3 Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceVerbose, myObject, category ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceError, + " Object is not valid for this category." ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp new file mode 100644 index 00000000000..ef9961a738d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod() + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( generalSwitch->TraceError ) + { + #if defined(DEBUG) + Debug::Write( "My error message. " ); + #endif + } + // Write a second message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + #if defined(DEBUG) + Debug::WriteLine( "My second error message." ); + #endif + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp new file mode 100644 index 00000000000..c3a53e7adcd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine1 Example/CPP/source.cpp @@ -0,0 +1,33 @@ + +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( generalSwitch->TraceError ) + { + #if defined(DEBUG) + Debug::Write( "Invalid object. " ); + #endif + } + // Write a second message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + #if defined(DEBUG) + Debug::WriteLine( myObject ); + #endif + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp new file mode 100644 index 00000000000..05f395a2ce6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine2 Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( generalSwitch->TraceError ) + { + #if defined(DEBUG) + Debug::Write( "My error message. " ); + #endif + } + // Write a second message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + #if defined(DEBUG) + Debug::WriteLine( "My second error message.", category ); + #endif + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp new file mode 100644 index 00000000000..8c64d37cc22 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLine3 Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( generalSwitch->TraceError ) + { + #if defined(DEBUG) + Debug::Write( "Invalid object for category. " ); + #endif + } + // Write a second message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + #if defined(DEBUG) + Debug::WriteLine( myObject, category ); + #endif + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp new file mode 100644 index 00000000000..8ded25d813b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod() + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceError, "My error message. " ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceVerbose, + "My second error message." ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp new file mode 100644 index 00000000000..fefafc88fcc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf1 Example/CPP/source.cpp @@ -0,0 +1,26 @@ + +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceError, "Invalid object. " ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceVerbose, myObject ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp new file mode 100644 index 00000000000..ee7c49907b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf2 Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf( generalSwitch->TraceError, "My error message. " ); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceVerbose, + "My second error message.", category ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp new file mode 100644 index 00000000000..d7fb6a3dfaa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Debug.WriteLineIf3 Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ + // + // Class-level declaration. + // Create a TraceSwitch. + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General","Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + // Write the message if the TraceSwitch level is set to Error or higher. + #if defined(DEBUG) + Debug::WriteIf(generalSwitch->TraceError, "Invalid object for category. "); + + // Write a second message if the TraceSwitch level is set to Verbose. + Debug::WriteLineIf( generalSwitch->TraceVerbose, myObject, category ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp new file mode 100644 index 00000000000..56512d92aca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Decoder Example/CPP/source.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // These bytes in UTF-8 correspond to 3 different Unicode + // characters: space (U+0020), # (U+0023), and the biohazard + // symbol (U+2623). Note the biohazard symbol requires 3 bytes + // in UTF-8 (hexadecimal e2, 98, a3). Decoders store state across + // multiple calls to GetChars, handling the case when one char + // is in multiple byte arrays. + array^bytes1 = {0x20,0x23,0xe2}; + array^bytes2 = {0x98,0xa3}; + array^chars = gcnew array(3); + Decoder^ d = Encoding::UTF8->GetDecoder(); + int charLen = d->GetChars( bytes1, 0, bytes1->Length, chars, 0 ); + + // The value of charLen should be 2 now. + charLen += d->GetChars( bytes2, 0, bytes2->Length, chars, charLen ); + for ( UInt16 index(0); index < chars->Length; ++index ) + { + Console::Write( "U+{0:X4} ", static_cast(chars[ index ]) ); + + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp new file mode 100644 index 00000000000..ec2ce96c984 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Delegate Example/CPP/source.cpp @@ -0,0 +1,63 @@ + + +// +using namespace System; +delegate String^ myMethodDelegate( // Declares a delegate for a method that takes in an int and returns a String. +int myInt ); + +// Defines some methods to which the delegate can point. +ref class mySampleClass +{ +public: + + // Defines an instance method. + String^ myStringMethod( int myInt ) + { + if ( myInt > 0 ) + return ("positive"); + + if ( myInt < 0 ) + return ("negative"); + + return ("zero"); + } + + + // Defines a static method. + static String^ mySignMethod( int myInt ) + { + if ( myInt > 0 ) + return ("+"); + + if ( myInt < 0 ) + return ("-"); + + return (""); + } + +}; + +int main() +{ + + // Creates one delegate for each method. For the instance method, an + // instance (mySC) must be supplied. For the static method, only the + // method name is needed. + mySampleClass^ mySC = gcnew mySampleClass; + myMethodDelegate^ myD1 = gcnew myMethodDelegate( mySC, &mySampleClass::myStringMethod ); + myMethodDelegate^ myD2 = gcnew myMethodDelegate( mySampleClass::mySignMethod ); + + // Invokes the delegates. + Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", 5, myD1( 5 ), myD2( 5 ) ); + Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", -3, myD1( -3 ), myD2( -3 ) ); + Console::WriteLine( "{0} is {1}; use the sign \"{2}\".", 0, myD1( 0 ), myD2( 0 ) ); +} + +/* +This code produces the following output: + +5 is positive; use the sign "+". +-3 is negative; use the sign "-". +0 is zero; use the sign "". +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..296584f4b92 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic DirectoryInfo.Name Example/CPP/source.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + DirectoryInfo^ dir = gcnew DirectoryInfo( "." ); + String^ dirName = dir->Name; + Console::WriteLine( "DirectoryInfo name is {0}.", dirName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..0bcc87c363d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic DispIdAttribute Example/CPP/source.cpp @@ -0,0 +1,23 @@ + +// +using namespace System::Runtime::InteropServices; +public ref class MyClass +{ +public: + MyClass(){} + + + [DispId(8)] + void MyMethod(){} + + int MyOtherMethod() + { + return 0; + } + + + [DispId(9)] + bool MyField; +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp new file mode 100644 index 00000000000..f3f215111a7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Enum.ToString2 Example/CPP/source.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; +public ref class EnumSample +{ +public: + enum class Colors + { + Red = 1, + Blue = 2 + }; + + static void main() + { + Enum ^ myColors = Colors::Red; + Console::WriteLine( "The value of this instance is '{0}'", myColors ); + } + +}; + +int main() +{ + EnumSample::main(); +} + +/* +Output. +The value of this instance is 'Red'. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp new file mode 100644 index 00000000000..1d5d2c3bae2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Windows::Forms; + +// +int main() +{ + + // Creates an exception with an error message. + Exception^ myException = gcnew Exception( "This is an exception test" ); + + // Creates an ErrorEventArgs with the exception. + ErrorEventArgs^ myErrorEventArgs = gcnew ErrorEventArgs( myException ); + + // Extracts the exception from the ErrorEventArgs and display it. + Exception^ myReturnedException = myErrorEventArgs->GetException(); + MessageBox::Show( String::Concat( "The returned exception is: ", myReturnedException->Message ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp new file mode 100644 index 00000000000..dafe3cd798d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ErrorEventArgs.ErrorEventArgs Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Windows::Forms; + +// +int main() +{ + + //Creates an exception with an error message. + Exception^ myException = gcnew Exception( "This is an exception test" ); + + //Creates an ErrorEventArgs with the exception. + ErrorEventArgs^ myErrorEventArgs = gcnew ErrorEventArgs( myException ); + + //Extracts the exception from the ErrorEventArgs and display it. + Exception^ myReturnedException = myErrorEventArgs->GetException(); + MessageBox::Show( String::Concat( "The returned exception is: ", myReturnedException->Message ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..220658df802 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Clear Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Create an EventLog instance and assign its log name. + EventLog^ myLog = gcnew EventLog; + myLog->Log = "myNewLog"; + myLog->Clear(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp new file mode 100644 index 00000000000..837b9e669dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.CreateEventSource Example/CPP/source.cpp @@ -0,0 +1,32 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + //An event log source should not be created and immediately used. + //There is a latency time to enable the source, it should be created + //prior to executing the application that uses the source. + //Execute this sample a second time to use the new source. + EventLog::CreateEventSource( "MySource", "MyNewLog" ); + Console::WriteLine( "CreatingEventSource" ); + // The source is created. Exit the application to allow it to be registered. + return 0; + } + + + // Create an EventLog instance and assign its source. + EventLog^ myLog = gcnew EventLog; + myLog->Source = "MySource"; + + // Write an informational entry to the event log. + myLog->WriteEntry( "Writing to event log." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp new file mode 100644 index 00000000000..d34be2b024f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Delete1 Example/CPP/source.cpp @@ -0,0 +1,33 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + String^ logName; + if ( EventLog::SourceExists( "MySource", "MyMachine") ) + { + + // Find the log associated with this source. + logName = EventLog::LogNameFromSourceName( "MySource", "MyMachine" ); + // Make sure the source is in the log we believe it to be in + if (logName != "MyLog") + return -1; + // Delete the source and the log. + EventLog::DeleteEventSource( "MySource", "MyMachine" ); + EventLog::Delete( logName, "MyMachine" ); + Console::WriteLine( "{0} deleted.", logName ); + } + else + { + // Create the event source to make next try successful. + EventSourceCreationData^ mySourceData = gcnew EventSourceCreationData("MySource", "MyLog"); + mySourceData->MachineName = "MyMachine"; + EventLog::CreateEventSource(mySourceData); + } +} + +// + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp new file mode 100644 index 00000000000..7fbbf42dd7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.DeleteEventSource Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + String^ logName; + if ( EventLog::SourceExists( "MySource" ) ) + { + + // Find the log associated with this source. + logName = EventLog::LogNameFromSourceName( "MySource", "." ); + // Make sure the source is in the log we believe it to be in + if (logName != "MyLog") + return -1; + // Delete the source and the log. + EventLog::DeleteEventSource( "MySource" ); + EventLog::Delete( logName ); + Console::WriteLine( "{0} deleted.", logName ); + } + else + { + // Create the event source to make next try successful. + EventLog::CreateEventSource("MySource", "MyLog"); + } +} + +// + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp new file mode 100644 index 00000000000..8d2633a605a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EnableRaisingEvents Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +ref class MySample +{ +public: + static void MyOnEntryWritten( Object^ /*source*/, EntryWrittenEventArgs^ e ) + { + Console::WriteLine( "Written: {0}", e->Entry->Message ); + } + +}; + +int main() +{ + EventLog^ myNewLog = gcnew EventLog; + myNewLog->Log = "MyCustomLog"; + myNewLog->EntryWritten += gcnew EntryWrittenEventHandler( MySample::MyOnEntryWritten ); + myNewLog->EnableRaisingEvents = true; + Console::WriteLine( "Press \'q\' to quit." ); + + // Wait for the EntryWrittenEvent or a quit command. + while ( Console::Read() != 'q' ) + { + + // Wait. + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp new file mode 100644 index 00000000000..b53690fb654 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Entries Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + EventLog^ myLog = gcnew EventLog; + myLog->Log = "MyNewLog"; + System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLogEntry^ entry = safe_cast(myEnum->Current); + Console::WriteLine( "\tEntry: {0}", entry->Message ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp new file mode 100644 index 00000000000..6a70ed0eae5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EntryWritten Example/CPP/source.cpp @@ -0,0 +1,39 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +ref class MySample +{ +private: + + // This member is used to wait for events. + static AutoResetEvent^ signal; + +public: + static void main() + { + signal = gcnew AutoResetEvent( false ); + EventLog^ myNewLog = gcnew EventLog; + myNewLog->Source = "testEventLogEvent"; + myNewLog->EntryWritten += gcnew EntryWrittenEventHandler( MyOnEntryWritten ); + myNewLog->EnableRaisingEvents = true; + myNewLog->WriteEntry("Test message", EventLogEntryType::Information); + signal->WaitOne(); + } + + static void MyOnEntryWritten( Object^ /*source*/, EntryWrittenEventArgs^ /*e*/ ) + { + Console::WriteLine("In event handler"); + signal->Set(); + } + +}; + +int main() +{ + MySample::main(); +} + +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp new file mode 100644 index 00000000000..784d135be2e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog1 Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + //An event log source should not be created and immediately used. + //There is a latency time to enable the source, it should be created + //prior to executing the application that uses the source. + //Execute this sample a second time to use the new source. + EventLog::CreateEventSource( "MySource", "MyNewLog" ); + Console::WriteLine( "CreatingEventSource" ); + // The source is created. Exit the application to allow it to be registered. + return 0; + } + + + // Create an EventLog instance and assign its log name. + EventLog^ myLog = gcnew EventLog( "myNewLog" ); + + // Read the event log entries. + System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLogEntry^ entry = safe_cast(myEnum->Current); + Console::WriteLine( "\tEntry: {0}", entry->Message ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp new file mode 100644 index 00000000000..d4a6b83d0d1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog2 Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + //An event log source should not be created and immediately used. + //There is a latency time to enable the source, it should be created + //prior to executing the application that uses the source. + //Execute this sample a second time to use the new source. + EventLog::CreateEventSource( "MySource", "MyNewLog", "myServer" ); + Console::WriteLine( "CreatingEventSource" ); + // The source is created. Exit the application to allow it to be registered. + return 0; + } + + // Create an EventLog instance and assign its log name. + EventLog^ myLog = gcnew EventLog( "myNewLog","myServer" ); + + // Read the event log entries. + System::Collections::IEnumerator^ myEnum = myLog->Entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLogEntry^ entry = safe_cast(myEnum->Current); + Console::WriteLine( "\tEntry: {0}", entry->Message ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp new file mode 100644 index 00000000000..1406cddf5c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.EventLog3 Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + //An event log source should not be created and immediately used. + //There is a latency time to enable the source, it should be created + //prior to executing the application that uses the source. + //Execute this sample a second time to use the new source. + EventLog::CreateEventSource( "MySource", "MyNewLog"); + Console::WriteLine( "CreatingEventSource" ); + // The source is created. Exit the application to allow it to be registered. + return 0; + } + + // Create an EventLog instance and assign its source. + EventLog^ myLog = gcnew EventLog( "myNewLog",".","MySource" ); + + // Write an entry to the log. + myLog->WriteEntry( String::Format( "Writing to event log on {0}", myLog->MachineName ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp new file mode 100644 index 00000000000..0bb3db04e83 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.GetEventLogs1 Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + array^remoteEventLogs; + remoteEventLogs = EventLog::GetEventLogs( "myServer" ); + Console::WriteLine( "Number of logs on computer: {0}", remoteEventLogs->Length ); + System::Collections::IEnumerator^ myEnum = remoteEventLogs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLog^ log = safe_cast(myEnum->Current); + Console::WriteLine( "Log: {0}", log->Log ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp new file mode 100644 index 00000000000..e9a75f0cb41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Log Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + EventLog^ myNewLog = gcnew EventLog; + myNewLog->Log = "NewEventLog"; + System::Collections::IEnumerator^ myEnum = myNewLog->Entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLogEntry^ entry = safe_cast(myEnum->Current); + Console::WriteLine( "\tEntry: {0}", entry->Message ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp new file mode 100644 index 00000000000..fe550a181e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.MachineName Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +int main() +{ + EventLog^ myNewLog = gcnew EventLog; + myNewLog->Log = "NewEventLog"; + myNewLog->MachineName = "MyServer"; + System::Collections::IEnumerator^ myEnum = myNewLog->Entries->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventLogEntry^ entry = safe_cast(myEnum->Current); + Console::WriteLine( "\tEntry: {0}", entry->Message ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp new file mode 100644 index 00000000000..44c4682c561 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.Source Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + EventLog::CreateEventSource( "MySource", "MyNewLog" ); + Console::WriteLine( "CreatingEventSource" ); + } + + + // Create an EventLog instance and assign its source. + EventLog^ myLog = gcnew EventLog; + myLog->Source = "MySource"; + + // Write an informational entry to the event log. + myLog->WriteEntry( "Writing to event log." ); + Console::WriteLine( "Message written to event log." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp new file mode 100644 index 00000000000..c66d775c270 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.SourceExists1 Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource", "MyServer" ) ) + { + EventLog::CreateEventSource( "MySource", "MyNewLog", "MyServer" ); + Console::WriteLine( "CreatingEventSource" ); + } + + + // Create an EventLog instance and assign its source. + EventLog^ myLog = gcnew EventLog; + myLog->Source = "MySource"; + + // Write an informational entry to the event log. + myLog->WriteEntry( "Writing to event log." ); + Console::WriteLine( "Message written to event log." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp new file mode 100644 index 00000000000..8980996197a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry1 Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Create the source, if it does not already exist. + if ( !EventLog::SourceExists( "MySource" ) ) + { + EventLog::CreateEventSource( "MySource", "myNewLog" ); + Console::WriteLine( "CreatingEventSource" ); + } + + + // Write an informational entry to the event log. + EventLog::WriteEntry( "MySource", "Writing to event log." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp new file mode 100644 index 00000000000..52610a420c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry2 Example/CPP/source.cpp @@ -0,0 +1,18 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Create an EventLog instance and assign its source. + EventLog^ myLog = gcnew EventLog("MyNewLog"); + myLog->Source = "MyNewLogSource"; + + // Write an informational entry to the event log. + myLog->WriteEntry( "Writing warning to event log.", EventLogEntryType::Warning ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp new file mode 100644 index 00000000000..126dd6381a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLog.WriteEntry3 Example/CPP/source.cpp @@ -0,0 +1,16 @@ + + +// +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Threading; +int main() +{ + + // Write an informational entry to the event log. + EventLog::WriteEntry( "MySource", "Writing warning to event log.", EventLogEntryType::Warning ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp new file mode 100644 index 00000000000..bae18050fe1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic EventLogTraceListener Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +// +int main() +{ + #if defined(TRACE) + + // Create a trace listener for the event log. + EventLogTraceListener^ myTraceListener = + gcnew EventLogTraceListener( "myEventLogSource" ); + + // Add the event log trace listener to the collection. + Trace::Listeners->Add( myTraceListener ); + + // Write output to the event log. + Trace::WriteLine( "Test output" ); + + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp new file mode 100644 index 00000000000..e16c6ffd058 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ExtensibleClassFactory Example/CPP/source.cpp @@ -0,0 +1,59 @@ + +using namespace System; +using namespace System::Runtime::InteropServices; + +//This namespace is a placeholder for the ECFSRV32Lib - since +// this library may not exist on the build machine we place +// a dummy namespace with dummy classes to keep the compiler +// happy. +namespace ECFSRV32Lib +{ + public ref class BaseComponent{}; + + public interface class IObjectActivator + { + int CreateBaseComponent( int Aggregator ); + }; + + public ref class ObjectActivator: public IObjectActivator + { + public: + virtual int CreateBaseComponent( int Aggregator ) + { + return 0; + } + }; +} + +// +public ref class CallBack +{ +public: + IntPtr Activate( IntPtr Aggregator ) + { + ECFSRV32Lib::ObjectActivator^ oCOM = gcnew ECFSRV32Lib::ObjectActivator; + ECFSRV32Lib::IObjectActivator^ itf = dynamic_cast(oCOM); + return (IntPtr)itf->CreateBaseComponent( (int)Aggregator ); + } +}; + +// +// The EcfInner class. First .NET class derived directly from COM class. +// +public ref class EcfInner: public ECFSRV32Lib::BaseComponent +{ +private: + static CallBack^ callbackInner; + static void RegisterInner() + { + callbackInner = gcnew CallBack; + System::Runtime::InteropServices::ExtensibleClassFactory::RegisterObjectCreationCallback( gcnew System::Runtime::InteropServices::ObjectCreationDelegate( callbackInner, &CallBack::Activate ) ); + } + + //This is the static initializer. + static EcfInner() + { + RegisterInner(); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..2c4a0747c4a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldAttributes Example/CPP/source.cpp @@ -0,0 +1,62 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Permissions; + +public ref class Demo +{ +private: + // Make three fields: + // The first field is private. + String^ m_field; + + // The second field is public. +public: + String^ Field; + + // The third field is public and literal. + literal String^ FieldC = "String C"; + + Demo() { m_field = "String A"; Field = "String B"; } +}; + +static void DisplayField(Object^ obj, FieldInfo^ f) +{ + // Display the field name, value, and attributes. + // + Console::WriteLine("{0} = \"{1}\"; attributes: {2}", + f->Name, f->GetValue(obj), f->Attributes); +}; + +void main() +{ + Console::WriteLine ("\nReflection.FieldAttributes"); + Demo^ d = gcnew Demo(); + + // Get a Type object for Demo, and a FieldInfo for each of + // the three fields. Use the FieldInfo to display field + // name, value for the Demo object in d, and attributes. + // + Type^ myType = Demo::typeid; + + FieldInfo^ fiPrivate = myType->GetField("m_field", + BindingFlags::NonPublic | BindingFlags::Instance); + DisplayField(d, fiPrivate); + + FieldInfo^ fiPublic = myType->GetField("Field", + BindingFlags::Public | BindingFlags::Instance); + DisplayField(d, fiPublic); + + FieldInfo^ fiConstant = myType->GetField("FieldC", + BindingFlags::Public | BindingFlags::Static); + DisplayField(d, fiConstant); +} + +/* This code example produces the following output: + +Reflection.FieldAttributes +m_field = "String A"; attributes: Private +Field = "String B"; attributes: Public +FieldC = "String C"; attributes: Public, Static, Literal, HasDefault + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp new file mode 100644 index 00000000000..d04993ffecd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.FieldType Example/CPP/source.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class TestClass +{ + // Define a field. + private: + String^ field = "private field" ; + +// public: +// Myfield() +// : field( "private field" ) +// {} +// +// +// property String^ Field +// { +// String^ get() +// { +// return field; +// } +// +// } +}; + +void main() +{ + TestClass^ cl = gcnew TestClass; + + // Get the type and FieldInfo. + Type^ t = cl->GetType(); + FieldInfo^ fi = t->GetField("field", + static_cast(BindingFlags::Instance | BindingFlags::NonPublic)); + + // Get and display the Ftype s ieldType. + Console::WriteLine("Field Name: {0}.{1}", t->FullName, fi->Name ); + Console::WriteLine("Field Value: '{0}'", fi->GetValue(cl)); + Console::WriteLine("Field Type: {0}", fi->FieldType); +} +// The example displays the following output: +// Field Name: TestClass.field +// Field Value: 'private field' +// Field Type: System.String +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp new file mode 100644 index 00000000000..11c0acbac47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsAssembly Example/CPP/source.cpp @@ -0,0 +1,50 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Example +{ +public: + int f_public; +internal: + int f_internal; +protected: + int f_protected; +protected public: + int f_protected_public; +protected private: + int f_protected_private; +}; + +void main() +{ + Console::WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly"); + Console::WriteLine("{0,-21}{1,-18}{2,-18}{3}\n", + "", "IsPublic", "IsFamily", "IsFamilyAndAssembly"); + + for each (FieldInfo^ f in Example::typeid->GetFields( + BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::Public)) + { + Console::WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}", + f->Name, + f->IsPublic, + f->IsAssembly, + f->IsFamily, + f->IsFamilyOrAssembly, + f->IsFamilyAndAssembly + ); + } +} + +/* This code example produces output similar to the following: + + IsAssembly IsFamilyOrAssembly + IsPublic IsFamily IsFamilyAndAssembly + +f_public True False False False False +f_internal False True False False False +f_protected False False True False False +f_protected_public False False False True False +f_protected_private False False False False True + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..e4ab406d1aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsInitOnly Example/CPP/source.cpp @@ -0,0 +1,83 @@ + +// +using namespace System; +using namespace System::Reflection; + +//Make two fields, one public and one read-only. +public ref class Myfielda +{ +public: + String^ field; + Myfielda() + : field( "A - public field" ) + {} + + + property String^ Field + { + String^ get() + { + return field; + } + + void set( String^ value ) + { + if ( field != value ) + { + field = value; + } + } + + } + +}; + +public ref class Myfieldb +{ +private: + String^ const field; + +public: + Myfieldb() + : field( "B - readonly field" ) + {} + + + property String^ Field + { + String^ get() + { + return field; + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.FieldInfo" ); + Myfielda^ myfielda = gcnew Myfielda; + Myfieldb^ myfieldb = gcnew Myfieldb; + + //Get the Type and FieldInfo. + Type^ MyTypea = Type::GetType( "Myfielda" ); + FieldInfo^ Myfieldinfoa = MyTypea->GetField( "field", static_cast(BindingFlags::Public | BindingFlags::Instance) ); + Type^ MyTypeb = Type::GetType( "Myfieldb" ); + FieldInfo^ Myfieldinfob = MyTypeb->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + + //Modify the fields. + //Note that Myfieldb is not modified, as it is + //read-only (IsInitOnly is True). + myfielda->field = "A- modified"; + + //Myfieldb.field = "B- modified"; + //For the first field, get and display the name, field, and IsInitOnly state. + Console::Write( "\n{0} - {1}, IsInitOnly = {2} ", MyTypea->FullName, Myfieldinfoa->GetValue( myfielda ), Myfieldinfoa->IsInitOnly ); + + //For the second field get and display the name, field, and IsInitOnly state. + Console::Write( "\n{0} - {1}, IsInitOnly = {2} ", MyTypeb->FullName, Myfieldinfob->GetValue( myfieldb ), Myfieldinfob->IsInitOnly ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp new file mode 100644 index 00000000000..622ef650283 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsPublic Example/CPP/source.cpp @@ -0,0 +1,78 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Make two fields. +// private +public ref class Myfielda +{ +private: + String^ SomeField; + +public: + Myfielda() + : SomeField( "private field" ) + {} + + + property String^ Field + { + String^ get() + { + return SomeField; + } + + } + +}; + + +// public +public ref class Myfieldb +{ +public: + String^ SomeField; + Myfieldb() + : SomeField( "public field" ) + {} + + + property String^ Field + { + String^ get() + { + return SomeField; + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.FieldInfo" ); + Myfielda^ myfielda = gcnew Myfielda; + Myfieldb^ myfieldb = gcnew Myfieldb; + + // Get the Type and FieldInfo. + Type^ MyTypea = Type::GetType( "Myfielda" ); + FieldInfo^ Myfieldinfoa = MyTypea->GetField( "SomeField", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + Type^ MyTypeb = Type::GetType( "Myfieldb" ); + FieldInfo^ Myfieldinfob = MyTypeb->GetField( "SomeField" ); + + // Get and display the IsPublic and IsPrivate property values. + Console::Write( "\n{0}.", MyTypea->FullName ); + Console::Write( "{0} - ", Myfieldinfoa->Name ); + Console::Write( "{0}", myfielda->Field ); + Console::Write( "\n IsPublic = {0}", Myfieldinfoa->IsPublic ); + Console::Write( "\n IsPrivate = {0}", Myfieldinfoa->IsPrivate ); + Console::Write( "\n{0}.", MyTypeb->FullName ); + Console::Write( "{0} - ", Myfieldinfob->Name ); + Console::Write( "{0};", myfieldb->Field ); + Console::Write( "\n IsPublic = {0}", Myfieldinfob->IsPublic ); + Console::Write( "\n IsPrivate = {0}", Myfieldinfob->IsPrivate ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp new file mode 100644 index 00000000000..cac0b79e4d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.IsStatic Example/CPP/source.cpp @@ -0,0 +1,87 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Make two fields. +public ref class Myfielda +{ +private: + String^ field; + +public: + Myfielda() + : field( "A private field" ) + {} + + + property String^ Field + { + String^ get() + { + return field; + } + + void set( String^ value ) + { + if ( field != value ) + { + field = value; + } + } + + } + +}; + +public ref class Myfieldb +{ +private: + static String^ field = "B static field"; + +public: + + property String^ Field + { + String^ get() + { + return field; + } + + void set( String^ value ) + { + if ( field != value ) + { + field = value; + } + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.FieldInfo" ); + Myfielda^ myfielda = gcnew Myfielda; + Myfieldb^ myfieldb = gcnew Myfieldb; + + // Get the Type and FieldInfo. + Type^ MyTypea = Type::GetType( "Myfielda" ); + FieldInfo^ Myfieldinfoa = MyTypea->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + Type^ MyTypeb = Type::GetType( "Myfieldb" ); + FieldInfo^ Myfieldinfob = MyTypeb->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Static) ); + + // For the first field, get and display the name, field, and IsStatic property value. + Console::Write( "\n{0} - ", MyTypea->FullName ); + Console::Write( "{0}; ", Myfieldinfoa->GetValue( myfielda ) ); + Console::Write( "IsStatic - {0}", Myfieldinfoa->IsStatic ); + + // For the second field get and display the name, field, and IsStatic property value. + Console::Write( "\n{0} - ", MyTypeb->FullName ); + Console::Write( "{0}; ", Myfieldinfob->GetValue( myfieldb ) ); + Console::Write( "IsStatic - {0}", Myfieldinfob->IsStatic ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp new file mode 100644 index 00000000000..0daa04b49b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldInfo.MemberType Example/CPP/source.cpp @@ -0,0 +1,47 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Make a field. +public ref class Myfield +{ +private: + String^ field; + +public: + Myfield() + : field( "a private field" ) + {} + + + property String^ Field + { + String^ get() + { + return field; + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.FieldInfo" ); + Myfield^ myfield = gcnew Myfield; + + // Get the Type and FieldInfo. + Type^ MyType = Type::GetType( "Myfield" ); + FieldInfo^ Myfieldinfo = MyType->GetField( "field", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + + // Get and display the MemberType. + Console::Write( "\n{0}.", MyType->FullName ); + Console::Write( "{0} - ", Myfieldinfo->Name ); + Console::Write( "{0};", myfield->Field ); + MemberTypes Mymembertypes = Myfieldinfo->MemberType; + Console::Write( "MemberType is a {0}.", Mymembertypes ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..0189476aa87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FieldOffsetAttribute Example/CPP/source.cpp @@ -0,0 +1,28 @@ + +using namespace System; +using namespace System::Runtime::InteropServices; + +// + +[StructLayout(LayoutKind::Explicit)] +public ref class SYSTEM_INFO +{ +public: + + [FieldOffset(0)] + UInt64 OemId; + + [FieldOffset(8)] + UInt64 PageSize; + + [FieldOffset(24)] + UInt64 ActiveProcessorMask; + + [FieldOffset(32)] + UInt64 NumberOfProcessors; + + [FieldOffset(40)] + UInt64 ProcessorType; +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp new file mode 100644 index 00000000000..d0051f61250 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileAccess Example/CPP/source.cpp @@ -0,0 +1,13 @@ +using namespace System; +using namespace System::IO; + +public ref class Form1 +{ +protected: + void Method( String^ name ) + { +// +FileStream^ s2 = gcnew FileStream( name, FileMode::Open, FileAccess::Read, FileShare::Read ); +// + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..f0687bcf481 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileDialogPermissionAttribute Example/CPP/source.cpp @@ -0,0 +1,23 @@ +using namespace System; +using namespace System::Security::Permissions; + +// + [assembly:FileDialogPermissionAttribute(SecurityAction::RequestMinimum,Unrestricted=true)]; + //In C++, you must specify that you are using the assembly scope when making a request. +// + +namespace Snippet2 +{ +// + [FileDialogPermissionAttribute(SecurityAction::Demand,Unrestricted=true)] +// + public ref class SampleClass{}; +} + +namespace Snippet3 +{ +// + //[FileDialogPermissionAttribute(SecurityAction::Assert,Unrestricted=true)] +// + public ref class SampleClass{}; +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp new file mode 100644 index 00000000000..d14379899fe --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermission Example/CPP/source.cpp @@ -0,0 +1,55 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Security::Permissions; +using namespace System::Windows::Forms; +using namespace System::Security; + +public ref class Form1: public Form +{ +protected: + void Method() + { +// + FileIOPermission^ f = gcnew FileIOPermission( PermissionState::None ); + f->AllLocalFiles = FileIOPermissionAccess::Read; + try + { + f->Demand(); + } + catch (SecurityException^ s) + { + Console::WriteLine(s->Message); + } +// + +// + FileIOPermission^ f2 = gcnew FileIOPermission( FileIOPermissionAccess::Read,"C:\\test_r" ); + f2->AddPathList( (FileIOPermissionAccess) (FileIOPermissionAccess::Write | FileIOPermissionAccess::Read), "C:\\example\\out.txt" ); + try + { + f2->Demand(); + } + catch (SecurityException^ s) + { + Console::WriteLine(s->Message); + } +// + + // + FileIOPermission^ f3 = gcnew FileIOPermission( PermissionState::None ); + f->AllFiles = FileIOPermissionAccess::Read; + try + { + f3->Demand(); + } + catch (SecurityException^ s) + { + Console::WriteLine(s->Message); + } +// + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..6279477dcee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileIOPermissionAttribute Example/CPP/source.cpp @@ -0,0 +1,25 @@ +using namespace System; +using namespace System::Security::Permissions; + +namespace Snippet1 +{ +// +[FileIOPermissionAttribute(SecurityAction::PermitOnly,ViewAndModify="C:\\example\\sample.txt")] +// + public ref class SampleClass{}; +} +namespace Snippet2 +{ +// + [FileIOPermissionAttribute(SecurityAction::Demand,Unrestricted=true)] +// + public ref class SampleClass{}; +} + +namespace Snippet3 +{ +// + //[FileIOPermissionAttribute(SecurityAction::Assert,Unrestricted=true)] +// + public ref class SampleClass{}; +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp new file mode 100644 index 00000000000..73b079909b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanRead Example/CPP/source.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +using namespace System::IO; +int main( void ) +{ + FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Read ); + if ( fs->CanRead && fs->CanWrite ) + { + Console::WriteLine( "MyFile.txt can be both written to and read from." ); + } + else + { + Console::WriteLine( "MyFile.txt is not writable" ); + } + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp new file mode 100644 index 00000000000..1c4c9b8a84c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.CanWrite Example/CPP/source.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +using namespace System::IO; +int main( void ) +{ + FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Write ); + if ( fs->CanRead && fs->CanWrite ) + { + Console::WriteLine( "MyFile.txt can be both written to and read from." ); + } + else + { + Console::WriteLine( "MyFile.txt is writable." ); + } + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp new file mode 100644 index 00000000000..6d129222b6a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileStream.Length Example/CPP/source.cpp @@ -0,0 +1,13 @@ +using namespace System; +using namespace System::IO; +using namespace System::IO::IsolatedStorage; + +void Method( FileStream^ s ) +{ + // + if ( s->Length == s->Position ) + { + Console::WriteLine( "End of file has been reached." ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp new file mode 100644 index 00000000000..9239a2c8f3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo Example/CPP/source.cpp @@ -0,0 +1,33 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + + +public ref class Class1 +{ + +public: + static void Main() + { + // Get the file version for the notepad. + // Use either of the two following methods. + FileVersionInfo::GetVersionInfo(Path::Combine(Environment::SystemDirectory, "Notepad.exe")); + FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); + + + // Print the file name and version number. + Console::WriteLine("File: " + myFileVersionInfo->FileDescription + "\n" + + "Version number: " + myFileVersionInfo->FileVersion); + } +}; + +int main() +{ + Class1::Main(); +} +// + + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp new file mode 100644 index 00000000000..2a2d18167f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.CompanyName Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetCompanyName() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); + + // Print the company name. + textBox1->Text = "The company name: " + myFileVersionInfo->CompanyName; + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp new file mode 100644 index 00000000000..0766d0bcf94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileBuildPart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetFileBuildPart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo(Environment::SystemDirectory + "\\Notepad.exe"); + + // Print the file build number. + textBox1->Text = String::Format( "File build number: {0}", myFileVersionInfo->FileBuildPart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp new file mode 100644 index 00000000000..944efb43eff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileDescription Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Diagnostics; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetFileDescription() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the file description. + textBox1->Text = String::Concat( "File description: ", myFileVersionInfo->FileDescription ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp new file mode 100644 index 00000000000..fe1fceca8b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMajorPart Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetFileMajorPart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = FileVersionInfo::GetVersionInfo( "%systemroot%\\Notepad.exe" ); + + // Print the file major part number. + textBox1->Text = String::Concat( "File major part number: ", myFileVersionInfo->FileMajorPart ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp new file mode 100644 index 00000000000..1c1a34b3c9a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileMinorPart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetFileMinorPart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the file minor part number. + textBox1->Text = String::Concat( "File minor part number: ", myFileVersionInfo->FileMinorPart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp new file mode 100644 index 00000000000..c9afaf47525 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FileName Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetFileName() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the file name. + textBox1->Text = String::Concat( "File name: ", myFileVersionInfo->FileName ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp new file mode 100644 index 00000000000..ff28177ca51 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.FilePrivatePart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetFilePrivatePart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the file private part number. + textBox1->Text = String::Concat( "File private part number: ", myFileVersionInfo->FilePrivatePart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp new file mode 100644 index 00000000000..d957207f64e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.InternalName Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetInternalName() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the internal name. + textBox1->Text = String::Concat( "Internal name: ", myFileVersionInfo->InternalName ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp new file mode 100644 index 00000000000..03806600176 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsDebug Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetIsDebug() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print whether the file contains debugging information. + textBox1->Text = String::Concat( "File contains debugging information: ", + myFileVersionInfo->IsDebug ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp new file mode 100644 index 00000000000..679f5f4c274 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPatched Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetIsPatched() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print whether the file has a patch installed. + textBox1->Text = String::Concat( "File has patch installed: ", myFileVersionInfo->IsPatched ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp new file mode 100644 index 00000000000..fc4df817667 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPreRelease Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetIsPreRelease() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print whether the file is a prerelease version. + textBox1->Text = String::Concat( "File is prerelease version ", myFileVersionInfo->IsPreRelease ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp new file mode 100644 index 00000000000..83dd4978d95 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsPrivateBuild Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetIsPrivateBuild() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print whether the version is a private build. + textBox1->Text = String::Concat( "Version is a private build: ", myFileVersionInfo->IsPrivateBuild ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp new file mode 100644 index 00000000000..252a113a733 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.IsSpecialBuild Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetIsSpecialBuild() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print whether the file is a special build. + textBox1->Text = String::Concat( "File is a special build: ", myFileVersionInfo->IsSpecialBuild ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp new file mode 100644 index 00000000000..c4f8e392537 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalCopyright Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetCopyright() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the copyright notice. + textBox1->Text = String::Concat( "Copyright notice: ", myFileVersionInfo->LegalCopyright ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp new file mode 100644 index 00000000000..0ed892c3443 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.LegalTrademarks Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetTrademarks() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the trademarks. + textBox1->Text = String::Concat( "Trademarks: ", myFileVersionInfo->LegalTrademarks ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp new file mode 100644 index 00000000000..06de83f723a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.OriginalFilename Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetOriginalName() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the original file name. + textBox1->Text = String::Concat( "Original file name: ", myFileVersionInfo->OriginalFilename ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp new file mode 100644 index 00000000000..9087c661b55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.PrivateBuild Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetPrivateBuild() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the private build number. + textBox1->Text = String::Concat( "Private build number: ", myFileVersionInfo->PrivateBuild ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp new file mode 100644 index 00000000000..81913117b81 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductBuildPart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetProductBuildPart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the product build part number. + textBox1->Text = String::Concat( "Product build part number: ", myFileVersionInfo->ProductBuildPart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp new file mode 100644 index 00000000000..c08b8bbc59b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMajorPart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetProductMajorPart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the product major part number. + textBox1->Text = String::Concat( "Product major part number: ", myFileVersionInfo->ProductMajorPart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp new file mode 100644 index 00000000000..a419d991f9a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductMinorPart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetProductMinorPart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the product minor part number. + textBox1->Text = String::Concat( "Product minor part number: ", myFileVersionInfo->ProductMinorPart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp new file mode 100644 index 00000000000..4b5b6d28591 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductName Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetProductName() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the product name. + textBox1->Text = String::Concat( "Product name: ", myFileVersionInfo->ProductName ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp new file mode 100644 index 00000000000..9ef151fdcab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductPrivatePart Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetProductPrivatePart() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the product private part number. + textBox1->Text = String::Concat( "Product private part number: ", myFileVersionInfo->ProductPrivatePart ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp new file mode 100644 index 00000000000..37638630d5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ProductVersion Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetProductVersion() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the product version number. + textBox1->Text = String::Concat( "Product version number: ", myFileVersionInfo->ProductVersion ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp new file mode 100644 index 00000000000..a3f209f9682 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.SpecialBuild Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetSpecialBuild() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print the special build information. + textBox1->Text = String::Concat( "Special build information: ", myFileVersionInfo->SpecialBuild ); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp new file mode 100644 index 00000000000..fbecc3c9e0c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic FileVersionInfo.ToString Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1 : public Form +{ +protected: + TextBox^ textBox1; + +// +private: + void GetFileVersion2() + { + // Get the file version for the notepad. + FileVersionInfo^ myFileVersionInfo = + FileVersionInfo::GetVersionInfo( Environment::SystemDirectory + "\\Notepad.exe" ); + + // Print all the version information. + textBox1->Text = myFileVersionInfo->ToString(); + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..3f96bf804aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic GuidAttribute Example/CPP/source.cpp @@ -0,0 +1,11 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + + +[GuidAttribute("9ED54F84-A89D-4fcd-A854-44251E925F09")] +public ref class SampleClass +{ + // Insert class members here. +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp new file mode 100644 index 00000000000..3acaccabe57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hash.SHA1 Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Policy; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Assembly^ myAssembly; + + void Method() + { + // + Hash^ hash = gcnew Hash( myAssembly ); + array^ hashcode = hash->SHA1; + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp new file mode 100644 index 00000000000..69ae75d0f48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic HashAlgorithm Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Policy; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + array^dataArray; + + void Method() + { + // + HashAlgorithm^ sha = SHA256::Create(); + array^ result = sha->ComputeHash( dataArray ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp new file mode 100644 index 00000000000..473f4a7a126 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable Example/CPP/source2.cpp @@ -0,0 +1,76 @@ +// +using namespace System; +using namespace System::Collections; + +public class HashtableExample +{ +public: + static void Main() + { + // Creates and initializes a new Hashtable. + Hashtable^ clouds = gcnew Hashtable(); + clouds->Add("Cirrus", "Castellanus"); + clouds->Add("Cirrocumulus", "Stratiformis"); + clouds->Add("Altostratus", "Radiatus"); + clouds->Add("Stratocumulus", "Perlucidus"); + clouds->Add("Stratus", "Fractus"); + clouds->Add("Nimbostratus", "Pannus"); + clouds->Add("Cumulus", "Humilis"); + clouds->Add("Cumulonimbus", "Incus"); + + // Displays the keys and values of the Hashtable using GetEnumerator() + + IDictionaryEnumerator^ denum = clouds->GetEnumerator(); + DictionaryEntry dentry; + + Console::WriteLine(); + Console::WriteLine(" Cloud Type Variation"); + Console::WriteLine(" -----------------------------"); + while (denum->MoveNext()) + { + dentry = (DictionaryEntry) denum->Current; + Console::WriteLine(" {0,-17}{1}", dentry.Key, dentry.Value); + } + Console::WriteLine(); + + // Displays the keys and values of the Hashtable using foreach statement + + Console::WriteLine(" Cloud Type Variation"); + Console::WriteLine(" -----------------------------"); + for each (DictionaryEntry de in clouds) + { + Console::WriteLine(" {0,-17}{1}", de.Key, de.Value); + } + Console::WriteLine(); + } +}; + +int main() +{ + HashtableExample::Main(); +} + +// The program displays the following output to the console: +// +// Cloud Type Variation +// ----------------------------- +// Cirrocumulus Stratiformis +// Stratocumulus Perlucidus +// Cirrus Castellanus +// Cumulus Humilis +// Nimbostratus Pannus +// Stratus Fractus +// Altostratus Radiatus +// Cumulonimbus Incus +// +// Cloud Type Variation +// ----------------------------- +// Cirrocumulus Stratiformis +// Stratocumulus Perlucidus +// Cirrus Castellanus +// Cumulus Humilis +// Nimbostratus Pannus +// Stratus Fractus +// Altostratus Radiatus +// Cumulonimbus Incus*/ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..21cce15687b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Add Example/CPP/source.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintKeysAndValues( Hashtable^ myHT ); +int main() +{ + + // Creates and initializes a new Hashtable. + Hashtable^ myHT = gcnew Hashtable; + myHT->Add( "one", "The" ); + myHT->Add( "two", "quick" ); + myHT->Add( "three", "brown" ); + myHT->Add( "four", "fox" ); + + // Displays the Hashtable. + Console::WriteLine( "The Hashtable contains the following:" ); + PrintKeysAndValues( myHT ); +} + +void PrintKeysAndValues( Hashtable^ myHT ) +{ + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + IEnumerator^ myEnum = myHT->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = *safe_cast(myEnum->Current); + Console::WriteLine( "\t{0}:\t{1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The Hashtable contains the following: + -KEY- -VALUE- + two: quick + three: brown + four: fox + one: The + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..87875e40e37 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Clear Example/CPP/source.cpp @@ -0,0 +1,65 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintKeysAndValues( Hashtable^ myHT ); +int main() +{ + + // Creates and initializes a new Hashtable. + Hashtable^ myHT = gcnew Hashtable; + myHT->Add( "one", "The" ); + myHT->Add( "two", "quick" ); + myHT->Add( "three", "brown" ); + myHT->Add( "four", "fox" ); + myHT->Add( "five", "jumps" ); + + // Displays the count and values of the Hashtable. + Console::WriteLine( "Initially," ); + Console::WriteLine( " Count : {0}", myHT->Count ); + Console::WriteLine( " Values:" ); + PrintKeysAndValues( myHT ); + + // Clears the Hashtable. + myHT->Clear(); + + // Displays the count and values of the Hashtable. + Console::WriteLine( "After Clear," ); + Console::WriteLine( " Count : {0}", myHT->Count ); + Console::WriteLine( " Values:" ); + PrintKeysAndValues( myHT ); +} + +void PrintKeysAndValues( Hashtable^ myHT ) +{ + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + IEnumerator^ myEnum = myHT->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = *safe_cast(myEnum->Current); + Console::WriteLine( "\t{0}:\t{1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initially, + Count : 5 + Values: + -KEY- -VALUE- + two: quick + three: brown + four: fox + five: jumps + one: The + + After Clear, + Count : 0 + Values: + -KEY- -VALUE- + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp new file mode 100644 index 00000000000..b6d25cecb55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Contains Example/CPP/source.cpp @@ -0,0 +1,65 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndKeysAndValues( Hashtable^ myHT ); +int main() +{ + + // Creates and initializes a new Hashtable. + Hashtable^ myHT = gcnew Hashtable; + myHT->Add( (int^)0, "zero" ); + myHT->Add( 1, "one" ); + myHT->Add( 2, "two" ); + myHT->Add( 3, "three" ); + myHT->Add( 4, "four" ); + + // Displays the values of the Hashtable. + Console::WriteLine( "The Hashtable contains the following values:" ); + PrintIndexAndKeysAndValues( myHT ); + + // Searches for a specific key. + int myKey = 2; + Console::WriteLine( "The key \"{0}\" is {1}.", myKey, myHT->ContainsKey( myKey ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); + myKey = 6; + Console::WriteLine( "The key \"{0}\" is {1}.", myKey, myHT->ContainsKey( myKey ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); + + // Searches for a specific value. + String^ myValue = "three"; + Console::WriteLine( "The value \"{0}\" is {1}.", myValue, myHT->ContainsValue( myValue ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); + myValue = "nine"; + Console::WriteLine( "The value \"{0}\" is {1}.", myValue, myHT->ContainsValue( myValue ) ? (String^)"in the Hashtable" : "NOT in the Hashtable" ); +} + +void PrintIndexAndKeysAndValues( Hashtable^ myHT ) +{ + int i = 0; + Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); + IEnumerator^ myEnum = myHT->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = *safe_cast(myEnum->Current); + Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i++, de.Key, de.Value ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The Hashtable contains the following values: + -INDEX- -KEY- -VALUE- + [0]: 4 four + [1]: 3 three + [2]: 2 two + [3]: 1 one + [4]: 0 zero + + The key "2" is in the Hashtable. + The key "6" is NOT in the Hashtable. + The value "three" is in the Hashtable. + The value "nine" is NOT in the Hashtable. + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..70190cc955d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.CopyTo Example/CPP/source.cpp @@ -0,0 +1,63 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( array^myArr, char mySeparator ); +int main() +{ + + // Creates and initializes the source Hashtable. + Hashtable^ mySourceHT = gcnew Hashtable; + mySourceHT->Add( "A", "valueA" ); + mySourceHT->Add( "B", "valueB" ); + + // Creates and initializes the one-dimensional target Array. + array^myTargetArray = gcnew array(15); + myTargetArray[ 0 ] = "The"; + myTargetArray[ 1 ] = "quick"; + myTargetArray[ 2 ] = "brown"; + myTargetArray[ 3 ] = "fox"; + myTargetArray[ 4 ] = "jumps"; + myTargetArray[ 5 ] = "over"; + myTargetArray[ 6 ] = "the"; + myTargetArray[ 7 ] = "lazy"; + myTargetArray[ 8 ] = "dog"; + + // Displays the values of the target Array. + Console::WriteLine( "The target Array contains the following before:" ); + PrintValues( myTargetArray, ' ' ); + + // Copies the keys in the source Hashtable to the target Hashtable, starting at index 6. + Console::WriteLine( "After copying the keys, starting at index 6:" ); + mySourceHT->Keys->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the values in the source Hashtable to the target Hashtable, starting at index 6. + Console::WriteLine( "After copying the values, starting at index 6:" ); + mySourceHT->Values->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); +} + +void PrintValues( array^myArr, char mySeparator ) +{ + for ( int i = 0; i < myArr->Length; i++ ) + Console::Write( "{0}{1}", mySeparator, myArr[ i ] ); + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Array contains the following before: + The quick brown fox jumps over the lazy dog + After copying the keys, starting at index 6: + The quick brown fox jumps over B A dog + After copying the values, starting at index 6: + The quick brown fox jumps over valueB valueA dog + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp new file mode 100644 index 00000000000..5e205ba0c28 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/remarks.cpp @@ -0,0 +1,40 @@ + + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class SamplesHashtable +{ +public: + static void Main() + { + // + Hashtable^ myCollection = gcnew Hashtable(); + bool lockTaken = false; + + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +void main() +{ + SamplesHashtable::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp new file mode 100644 index 00000000000..4696c2337e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.IsSynchronized Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void main() +{ + + // Creates and initializes a new Hashtable. + Hashtable^ myHT = gcnew Hashtable; + myHT->Add( (int^)0, "zero" ); + myHT->Add( 1, "one" ); + myHT->Add( 2, "two" ); + myHT->Add( 3, "three" ); + myHT->Add( 4, "four" ); + + // Creates a synchronized wrapper around the Hashtable. + Hashtable^ mySyncdHT = Hashtable::Synchronized( myHT ); + + // Displays the sychronization status of both Hashtables. + Console::WriteLine( "myHT is {0}.", myHT->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); + Console::WriteLine( "mySyncdHT is {0}.", mySyncdHT->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); +} + +/* + This code produces the following output. + + myHT is not synchronized. + mySyncdHT is synchronized. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp new file mode 100644 index 00000000000..23ce290b57a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Hashtable.Remove Example/CPP/source.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintKeysAndValues( Hashtable^ myHT ); +int main() +{ + + // Creates and initializes a new Hashtable. + Hashtable^ myHT = gcnew Hashtable; + myHT->Add( "1a", "The" ); + myHT->Add( "1b", "quick" ); + myHT->Add( "1c", "brown" ); + myHT->Add( "2a", "fox" ); + myHT->Add( "2b", "jumps" ); + myHT->Add( "2c", "over" ); + myHT->Add( "3a", "the" ); + myHT->Add( "3b", "lazy" ); + myHT->Add( "3c", "dog" ); + + // Displays the Hashtable. + Console::WriteLine( "The Hashtable initially contains the following:" ); + PrintKeysAndValues( myHT ); + + // Removes the element with the key "3b". + myHT->Remove( "3b" ); + + // Displays the current state of the Hashtable. + Console::WriteLine( "After removing \"lazy\":" ); + PrintKeysAndValues( myHT ); +} + +void PrintKeysAndValues( Hashtable^ myHT ) +{ + IEnumerator^ myEnum = myHT->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = *safe_cast(myEnum->Current); + Console::WriteLine( " {0}: {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The Hashtable initially contains the following: + 2c: over + 3a: the + 2b: jumps + 3b: lazy + 1b: quick + 3c: dog + 2a: fox + 1c: brown + 1a: The + + After removing "lazy": + 2c: over + 3a: the + 2b: jumps + 1b: quick + 3c: dog + 2a: fox + 1c: brown + 1a: The + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp new file mode 100644 index 00000000000..adbeb6fbeac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic IReflect.InvokeMember Example/CPP/source.cpp @@ -0,0 +1,17 @@ + + +// +#using + +using namespace System; +using namespace System::Reflection; + +#define NULL 0 +void main() +{ + Type^ tDate = Type::GetType( L"System.DateTime" ); + Object^ result = tDate->InvokeMember( L"Now", BindingFlags::GetProperty, nullptr, NULL, gcnew array(0) ); + Console::WriteLine( result->ToString() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..262e0c5bca9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic InterfaceTypeAttribute Example/CPP/source.cpp @@ -0,0 +1,14 @@ + +// +using namespace System::Runtime::InteropServices; + +//Interface is exposed to COM as dual. +interface class IMyInterface1{}; + +//Insert code here. +//Interface is exposed to COM as IDispatch. + +[InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIDispatch)] +interface class IMyInterface2{}; +//Insert code here. +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp new file mode 100644 index 00000000000..9458c1d30b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MarshalByRefObject.InitializeLifetimeService Example/CPP/source.cpp @@ -0,0 +1,28 @@ + +using namespace System; +using namespace System::Runtime::Remoting::Lifetime; + +// +public ref class MyClass: public MarshalByRefObject +{ +public: + + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::Demand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual Object^ InitializeLifetimeService() override + { + ILease^ lease = dynamic_cast(MarshalByRefObject::InitializeLifetimeService()); + if ( lease->CurrentState == LeaseState::Initial ) + { + lease->InitialLeaseTime = TimeSpan::FromMinutes( 1 ); + lease->SponsorshipTimeout = TimeSpan::FromMinutes( 2 ); + lease->RenewOnCallTime = TimeSpan::FromSeconds( 2 ); + } + + return lease; + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp new file mode 100644 index 00000000000..13ab6a90a87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round Example/CPP/source.cpp @@ -0,0 +1,12 @@ +// +using namespace System; + +void main() +{ + Console::WriteLine("Classic Math.Round in CPP"); + Console::WriteLine(Math::Round(4.4)); // 4 + Console::WriteLine(Math::Round(4.5)); // 4 + Console::WriteLine(Math::Round(4.6)); // 5 + Console::WriteLine(Math::Round(5.5)); // 6 +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp new file mode 100644 index 00000000000..e9c1085e6f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Math.Round2 Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using + +using namespace System; + +ref class Sample +{ +private: + void Method() + { + // + Math::Round(3.44, 1); //Returns 3.4. + Math::Round(3.45, 1); //Returns 3.4. + Math::Round(3.46, 1); //Returns 3.5. + + Math::Round(4.34, 1); // Returns 4.3 + Math::Round(4.35, 1); // Returns 4.4 + Math::Round(4.36, 1); // Returns 4.4 + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp new file mode 100644 index 00000000000..fca76263e2b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.MemberType Example/CPP/source.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Console::WriteLine( "\nReflection.MemberInfo" ); + + // Get the Type and MemberInfo. + Type^ MyType = Type::GetType( "System.Reflection.PropertyInfo" ); + array^Mymemberinfoarray = MyType->GetMembers(); + + // Get the MemberType method and display the elements. + Console::Write( "\nThere are {0} members in ", Mymemberinfoarray->GetLength( 0 ) ); + Console::Write( "{0}.", MyType->FullName ); + for ( int counter = 0; counter < Mymemberinfoarray->Length; counter++ ) + { + Console::Write( "\n{0}. {1} Member type - {2}", counter, Mymemberinfoarray[ counter ]->Name, Mymemberinfoarray[ counter ]->MemberType ); + + } + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..f4a7d06c3ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.Name Example/CPP/source.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Reflection; + +void main() +{ + // Get the Type and MemberInfo. + Type^ t = Type::GetType("System.Empty"); + array^ memberArray = t->GetMembers(); + + // Get and display the type that declares the member. + Console::WriteLine("There are {0} members in {1}", + memberArray->Length, t->FullName); + for each (MemberInfo^ member in memberArray) { + Console::WriteLine("Member {0} declared by {1}", + member->Name, member->DeclaringType); + } +} +// The example displays the following output: +// There are 6 members in System.Empty +// Member ToString declared by System.Empty +// Member GetObjectData declared by System.Empty +// Member Equals declared by System.Object +// Member GetHashCode declared by System.Object +// Member GetType declared by System.Object +// Member Value declared by System.Empty +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp new file mode 100644 index 00000000000..04e9498bfd7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MemberInfo.ReflectedType Example/CPP/source.cpp @@ -0,0 +1,27 @@ +// +using namespace System; +using namespace System::Reflection; + +int main() +{ + MemberInfo^ m1 = Object::typeid->GetMethod("ToString"); + MemberInfo^ m2 = MemberInfo::typeid->GetMethod("ToString"); + + Console::WriteLine("m1.DeclaringType: {0}", m1->DeclaringType); + Console::WriteLine("m1.ReflectedType: {0}", m1->ReflectedType); + Console::WriteLine(); + Console::WriteLine("m2.DeclaringType: {0}", m2->DeclaringType); + Console::WriteLine("m2.ReflectedType: {0}", m2->ReflectedType); + + //Console::ReadLine(); +} + +/* This code example produces the following output: + +m1.DeclaringType: System.Object +m1.ReflectedType: System.Object + +m2.DeclaringType: System.Object +m2.ReflectedType: System.Reflection.MemberInfo + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..d9f1db69a7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodAttributes Example/CPP/source.cpp @@ -0,0 +1,55 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +public ref class AttributesSample +{ +public: + void Mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) + { + *str2m = "in Mymethod"; + } +}; + +void PrintAttributes( Type^ attribType, int iAttribValue ) +{ + if ( !attribType->IsEnum ) + { + Console::WriteLine( "This type is not an enum." ); + return; + } + + array^fields = attribType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); + for ( int i = 0; i < fields->Length; i++ ) + { + int fieldvalue = safe_cast(fields[ i ]->GetValue( nullptr )); + if ( (fieldvalue & iAttribValue) == fieldvalue ) + { + Console::WriteLine( fields[ i ]->Name ); + } + } +} + +int main() +{ + Console::WriteLine( "Reflection.MethodBase.Attributes Sample" ); + + // Get the type of the chosen class. + Type^ MyType = Type::GetType( "AttributesSample" ); + + // Get the method Mymethod on the type. + MethodBase^ Mymethodbase = MyType->GetMethod( "Mymethod" ); + + // Display the method name and signature. + Console::WriteLine( "Mymethodbase = {0}", Mymethodbase ); + + // Get the MethodAttribute enumerated value. + MethodAttributes Myattributes = Mymethodbase->Attributes; + + // Display the flags that are set. + PrintAttributes( System::Reflection::MethodAttributes::typeid, (int)Myattributes ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp new file mode 100644 index 00000000000..b803afb891b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Attributes Example/CPP/source.cpp @@ -0,0 +1,54 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +public ref class AttributesSample +{ +public: + void Mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) + { + *str2m = "in Mymethod"; + } +}; + +void PrintAttributes( Type^ attribType, int iAttribValue ) +{ + if ( !attribType->IsEnum ) + { + Console::WriteLine( "This type is not an enum." ); + return; + } + + array^fields = attribType->GetFields( static_cast(BindingFlags::Public | BindingFlags::Static) ); + for ( int i = 0; i < fields->Length; i++ ) + { + int fieldvalue = safe_cast(fields[ i ]->GetValue( nullptr )); + if ( (fieldvalue & iAttribValue) == fieldvalue ) + { + Console::WriteLine( fields[ i ]->Name ); + } + } +} + +int main() +{ + Console::WriteLine( "Reflection.MethodBase.Attributes Sample" ); + + // Get the type. + Type^ MyType = Type::GetType( "AttributesSample" ); + + // Get the method Mymethod on the type. + MethodBase^ Mymethodbase = MyType->GetMethod( "Mymethod" ); + + // Display the method name. + Console::WriteLine( "Mymethodbase = {0}", Mymethodbase ); + + // Get the MethodAttribute enumerated value. + MethodAttributes Myattributes = Mymethodbase->Attributes; + + // Display the flags that are set. + PrintAttributes( System::Reflection::MethodAttributes::typeid, (int)Myattributes ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp new file mode 100644 index 00000000000..945399096dc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.Invoke1 Example/CPP/source.cpp @@ -0,0 +1,53 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class MagicClass +{ +private: + int magicBaseValue; + +public: + MagicClass() + { + magicBaseValue = 9; + } + + int ItsMagic(int preMagic) + { + return preMagic * magicBaseValue; + } +}; + +public ref class TestMethodInfo +{ +public: + static void Main() + { + // Get the constructor and create an instance of MagicClass + + Type^ magicType = Type::GetType("MagicClass"); + ConstructorInfo^ magicConstructor = magicType->GetConstructor(Type::EmptyTypes); + Object^ magicClassObject = magicConstructor->Invoke(gcnew array(0)); + + // Get the ItsMagic method and invoke with a parameter value of 100 + + MethodInfo^ magicMethod = magicType->GetMethod("ItsMagic"); + Object^ magicValue = magicMethod->Invoke(magicClassObject, gcnew array(1){100}); + + Console::WriteLine("MethodInfo.Invoke() Example\n"); + Console::WriteLine("MagicClass.ItsMagic() returned: {0}", magicValue); + } +}; + +int main() +{ + TestMethodInfo::Main(); +} + +// The example program gives the following output: +// +// MethodInfo.Invoke() Example +// +// MagicClass.ItsMagic() returned: 900 +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp new file mode 100644 index 00000000000..a8d47e52181 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAbstract Example/CPP/source.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Console::WriteLine( "\nReflection.MethodBase" ); + + // Get the types. + Type^ MyType1 = Type::GetType( "System.Runtime.Serialization.Formatter" ); + Type^ MyType2 = Type::GetType( "System.Reflection.MethodBase" ); + + // Get and display the methods. + MethodBase^ Mymethodbase1 = MyType1->GetMethod( "WriteInt32", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + MethodBase^ Mymethodbase2 = MyType2->GetMethod( "GetCurrentMethod", static_cast(BindingFlags::Public | BindingFlags::Static) ); + Console::Write( "\nMymethodbase = {0}", Mymethodbase1 ); + if ( Mymethodbase1->IsAbstract ) + Console::Write( "\nMymethodbase is an abstract method." ); + else + Console::Write( "\nMymethodbase is not an abstract method." ); + + Console::Write( "\n\nMymethodbase = {0}", Mymethodbase2 ); + if ( Mymethodbase2->IsAbstract ) + Console::Write( "\nMymethodbase is an abstract method." ); + else + Console::Write( "\nMymethodbase is not an abstract method." ); + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp new file mode 100644 index 00000000000..72f077ad3a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsAssembly Example/CPP/source.cpp @@ -0,0 +1,53 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Example +{ +public: + void m_public() {}; +internal: + void m_internal() {}; +protected: + void m_protected() {}; +protected public: + void m_protected_public() {}; +protected private: + void m_protected_private() {}; +}; + +void main() +{ + Console::WriteLine("\n{0,-30}{1,-18}{2}", "", "IsAssembly", "IsFamilyOrAssembly"); + Console::WriteLine("{0,-21}{1,-18}{2,-18}{3}\n", + "", "IsPublic", "IsFamily", "IsFamilyAndAssembly"); + + for each (MethodBase^ m in Example::typeid->GetMethods( + BindingFlags::Instance | BindingFlags::NonPublic | BindingFlags::Public)) + { + if (m->Name->Substring(0, 1) == "m") + { + Console::WriteLine("{0,-21}{1,-9}{2,-9}{3,-9}{4,-9}{5,-9}", + m->Name, + m->IsPublic, + m->IsAssembly, + m->IsFamily, + m->IsFamilyOrAssembly, + m->IsFamilyAndAssembly + ); + } + } +} + +/* This code example produces output similar to the following: + + IsAssembly IsFamilyOrAssembly + IsPublic IsFamily IsFamilyAndAssembly + +m_public True False False False False +m_internal False True False False False +m_protected False False True False False +m_protected_public False False False True False +m_protected_private False False False False True + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp new file mode 100644 index 00000000000..a7ea8cf252b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsPublic Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Windows::Forms; + +// +int main() +{ + Console::WriteLine( "\nReflection.MethodBase" ); + + //Get the MethodBase of a method. + //Get the type + Type^ MyType = Type::GetType( "System.MulticastDelegate" ); + + //Get and display the method + MethodBase^ Mymethodbase = MyType->GetMethod( "RemoveImpl", static_cast(BindingFlags::NonPublic | BindingFlags::Instance) ); + Console::Write( "\nMymethodbase = {0}", Mymethodbase ); + bool Myispublic = Mymethodbase->IsPublic; + if ( Myispublic ) + Console::Write( "\nMymethodbase is a public method" ); + else + Console::Write( "\nMymethodbase is not a public method" ); + + return 0; +} + +/* +Produces the following output + +Reflection.MethodBase +Mymethodbase = System.Delegate RemoveImpl (System.Delegate) +Mymethodbase is not a public method +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp new file mode 100644 index 00000000000..f96f32346d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodBase.IsVirtual Example/CPP/source.cpp @@ -0,0 +1,18 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class MyClass +{ +public: + void MyMethod(){} +}; + +int main() +{ + MethodBase^ m = MyClass::typeid->GetMethod( "MyMethod" ); + Console::WriteLine( "The IsFinal property value of MyMethod is {0}.", m->IsFinal ); + Console::WriteLine( "The IsVirtual property value of MyMethod is {0}.", m->IsVirtual ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp new file mode 100644 index 00000000000..b878d322184 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.MemberType Example/CPP/source.cpp @@ -0,0 +1,60 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Console::WriteLine( "Reflection.MethodInfo" ); + + // Get the Type and MethodInfo. + Type^ MyType = Type::GetType( "System.Reflection.FieldInfo" ); + MethodInfo^ Mymethodinfo = MyType->GetMethod( "GetValue" ); + Console::WriteLine( "{0}.{1}", MyType->FullName, Mymethodinfo->Name ); + + // Get and display the MemberType property. + MemberTypes Mymembertypes = Mymethodinfo->MemberType; + if ( MemberTypes::Constructor == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type All." ); + } + else + if ( MemberTypes::Custom == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type Custom." ); + } + else + if ( MemberTypes::Event == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type Event." ); + } + else + if ( MemberTypes::Field == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type Field." ); + } + else + if ( MemberTypes::Method == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type Method." ); + } + else + if ( MemberTypes::Property == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type Property." ); + } + else + if ( MemberTypes::TypeInfo == Mymembertypes ) + { + Console::WriteLine( "MemberType is of type TypeInfo." ); + } + + + + + + + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp new file mode 100644 index 00000000000..9e122d5e99d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodInfo.ReturnType Example/CPP/source.cpp @@ -0,0 +1,19 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Console::WriteLine( "\nReflection.MethodInfo" ); + + // Get the Type and MethodInfo. + Type^ MyType = Type::GetType( "System.Reflection.FieldInfo" ); + MethodInfo^ Mymethodinfo = MyType->GetMethod( "GetValue" ); + Console::Write( "\n{0}.{1}", MyType->FullName, Mymethodinfo->Name ); + + // Get and display the ReturnType. + Console::Write( "\nReturnType = {0}", Mymethodinfo->ReturnType ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp new file mode 100644 index 00000000000..744eed074a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic MethodRental.SwapMethodBody Example/CPP/source.cpp @@ -0,0 +1,73 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; + +// First make a method that returns 0. +// Then swap the method body with a body that returns 1. +int main() +{ + // Construct a dynamic assembly + Guid g = Guid::NewGuid(); + AssemblyName^ asmname = gcnew AssemblyName; + asmname->Name = String::Concat( "tempfile", g ); + AssemblyBuilder^ asmbuild = System::Threading::Thread::GetDomain()->DefineDynamicAssembly( asmname, AssemblyBuilderAccess::Run ); + + // Add a dynamic module that contains one type that has one method that + // has no arguments. + ModuleBuilder^ modbuild = asmbuild->DefineDynamicModule( "test" ); + TypeBuilder^ tb = modbuild->DefineType( "name of the Type" ); + array^temp2; + MethodBuilder^ somemethod = tb->DefineMethod( "My method Name", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, temp2 ); + + // Define the body of the method to return 0. + ILGenerator^ ilg = somemethod->GetILGenerator(); + ilg->Emit( OpCodes::Ldc_I4_0 ); + ilg->Emit( OpCodes::Ret ); + + // Complete the type and verify that it returns 0. + Type^ tbBaked = tb->CreateType(); + array^temp0; + int res1 = safe_cast(tbBaked->GetMethod( "My method Name" )->Invoke( nullptr, temp0 )); + if ( res1 != 0 ) + { + Console::WriteLine( "Err_001a, should have returned 0" ); + } + else + { + Console::WriteLine( "Original method returned 0" ); + } + + // Define a new method body that will return a 1 instead. + + // code size + // ldc_i4_1 + // ret + array^methodBytes = {0x03,0x30,0x0A,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x17,0x2a}; + + // Get the token for the method whose body you are replacing. + MethodToken somemethodToken = somemethod->GetToken(); + + // Get the pointer to the method body. + GCHandle hmem = GCHandle::Alloc( (Object^)methodBytes, GCHandleType::Pinned ); + IntPtr addr = hmem.AddrOfPinnedObject(); + int cbSize = methodBytes->Length; + + // Swap the old method body with the new body. + MethodRental::SwapMethodBody( tbBaked, somemethodToken.Token, addr, cbSize, MethodRental::JitImmediate ); + + // Verify that the modified method returns 1. + array^temp1; + int res2 = safe_cast(tbBaked->GetMethod( "My method Name" )->Invoke( nullptr, temp1 )); + if ( res2 != 1 ) + { + Console::WriteLine( "Err_001b, should have returned 1" ); + } + else + { + Console::WriteLine( "Swapped method body returned 1" ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..d2aa22fa155 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.Name Example/CPP/source.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ]; + Console::WriteLine( "Module Name is {0}", mod->Name ); + Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName ); + Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName ); +} + +/* +This code produces the following output: + +Module Name is modname.exe +Module FullyQualifiedName is C:\Bin\modname.exe +Module ScopeName is modname.exe +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp new file mode 100644 index 00000000000..591da3b46bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Module.ScopeName Example/CPP/source.cpp @@ -0,0 +1,19 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Module^ mod = Assembly::GetExecutingAssembly()->GetModules()[ 0 ]; + Console::WriteLine( "Module Name is {0}", mod->Name ); + Console::WriteLine( "Module FullyQualifiedName is {0}", mod->FullyQualifiedName ); + Console::WriteLine( "Module ScopeName is {0}", mod->ScopeName ); +} + +/* +Produces this output: +Module Name is modname.exe +Module FullyQualifiedName is C:\Bin\modname.exe +Module ScopeName is modname.exe +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp new file mode 100644 index 00000000000..009ddd456c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ModuleBuilder.DefineType Example/CPP/source.cpp @@ -0,0 +1,22 @@ +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class Sample +{ +public: + void Method() + { + // + AssemblyName^ asmname = gcnew AssemblyName; + asmname->Name = "assemfilename.exe"; + AssemblyBuilder^ asmbuild = System::Threading::Thread::GetDomain()-> + DefineDynamicAssembly( asmname, AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ modbuild = asmbuild->DefineDynamicModule( "modulename", + "assemfilename.exe" ); + TypeBuilder^ typebuild1 = modbuild->DefineType( "typename" ); + typebuild1->CreateType(); + asmbuild->Save( "assemfilename.exe" ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp new file mode 100644 index 00000000000..c9eb24638ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic NotifyFilters Example/CPP/source.cpp @@ -0,0 +1,91 @@ +// +#include "pch.h" + +using namespace System; +using namespace System::IO; + +class MyClassCPP +{ +public: + + int static Run() + { + FileSystemWatcher^ watcher = gcnew FileSystemWatcher("C:\\path\\to\\folder"); + + watcher->NotifyFilter = static_cast(NotifyFilters::Attributes + | NotifyFilters::CreationTime + | NotifyFilters::DirectoryName + | NotifyFilters::FileName + | NotifyFilters::LastAccess + | NotifyFilters::LastWrite + | NotifyFilters::Security + | NotifyFilters::Size); + + watcher->Changed += gcnew FileSystemEventHandler(MyClassCPP::OnChanged); + watcher->Created += gcnew FileSystemEventHandler(MyClassCPP::OnCreated); + watcher->Deleted += gcnew FileSystemEventHandler(MyClassCPP::OnDeleted); + watcher->Renamed += gcnew RenamedEventHandler(MyClassCPP::OnRenamed); + watcher->Error += gcnew ErrorEventHandler(MyClassCPP::OnError); + + watcher->Filter = "*.txt"; + watcher->IncludeSubdirectories = true; + watcher->EnableRaisingEvents = true; + + Console::WriteLine("Press enter to exit."); + Console::ReadLine(); + + return 0; + } + +private: + + static void OnChanged(Object^ sender, FileSystemEventArgs^ e) + { + if (e->ChangeType != WatcherChangeTypes::Changed) + { + return; + } + Console::WriteLine("Changed: {0}", e->FullPath); + } + + static void OnCreated(Object^ sender, FileSystemEventArgs^ e) + { + Console::WriteLine("Created: {0}", e->FullPath); + } + + static void OnDeleted(Object^ sender, FileSystemEventArgs^ e) + { + Console::WriteLine("Deleted: {0}", e->FullPath); + } + + static void OnRenamed(Object^ sender, RenamedEventArgs^ e) + { + Console::WriteLine("Renamed:"); + Console::WriteLine(" Old: {0}", e->OldFullPath); + Console::WriteLine(" New: {0}", e->FullPath); + } + + static void OnError(Object^ sender, ErrorEventArgs^ e) + { + PrintException(e->GetException()); + } + + static void PrintException(Exception^ ex) + { + if (ex != nullptr) + { + Console::WriteLine("Message: {0}", ex->Message); + Console::WriteLine("Stacktrace:"); + Console::WriteLine(ex->StackTrace); + Console::WriteLine(); + PrintException(ex->InnerException); + } + } +}; + + +int main() +{ + MyClassCPP::Run(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp new file mode 100644 index 00000000000..0c7dbce3903 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberGroupSizes Example/CPP/source.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::Globalization; +String^ PrintArraySet( array^myArr ) +{ + String^ myStr = nullptr; + myStr = myArr[ 0 ].ToString(); + for ( int i = 1; i < myArr->Length; i++ ) + myStr = String::Concat( myStr, ", ", myArr[ i ].ToString() ); + return myStr; +} + +int main() +{ + + // Creates a new NumberFormatinfo. + NumberFormatInfo^ myNfi = gcnew NumberFormatInfo; + + // Takes a long value. + Int64 myInt = 123456789012345; + + // Displays the value with default formatting. + Console::WriteLine( "Default \t\t:\t{0}", myInt.ToString( "N", myNfi ) ); + + // Displays the value with three elements in the GroupSize array. + array^newInts1 = {2,3,4}; + myNfi->NumberGroupSizes = newInts1; + Console::WriteLine( "Grouping ( {0} )\t:\t{1}", PrintArraySet( myNfi->NumberGroupSizes ), myInt.ToString( "N", myNfi ) ); + + // Displays the value with zero as the last element in the GroupSize array. + array^newInts2 = {2,4,0}; + myNfi->NumberGroupSizes = newInts2; + Console::WriteLine( "Grouping ( {0} )\t:\t{1}", PrintArraySet( myNfi->NumberGroupSizes ), myInt.ToString( "N", myNfi ) ); +} + +/* +This code produces the following output. + +Default : 123, 456, 789, 012, 345.00 +Grouping (2, 3, 4) : 12, 3456, 7890, 123, 45.00 +Grouping (2, 4, 0) : 123456789, 0123, 45.00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp new file mode 100644 index 00000000000..25d277574d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic NumberFormatInfo.NumberNegativePattern Example/CPP/source.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create a new NumberFormatinfo. + NumberFormatInfo^ nfi = gcnew NumberFormatInfo; + + // Takes a negative value. + Int64 value = -1234; + + // Displays the value with default formatting. + Console::WriteLine("{0,-20} {1,-10}", "Default:", + value.ToString("N", nfi)); + + // Displays the value with other patterns. + for (int i = 0; i <= 4; i++) { + nfi->NumberNegativePattern = i; + Console::WriteLine("{0,-20} {1,-10}", + String::Format("Pattern {0}:", + nfi->NumberNegativePattern), + value.ToString("N", nfi)); + } +} +// The example displays the following output: +// Default: -1,234.00 +// Pattern 0: (1,234.00) +// Pattern 1: -1,234.00 +// Pattern 2: - 1,234.00 +// Pattern 3: 1,234.00- +// Pattern 4: 1,234.00 - +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..cefa875d170 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterAttributes Example/CPP/source.cpp @@ -0,0 +1,36 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +public ref class paramatt +{ +public: + static void mymethod( String^ str1, [Out]interior_ptr str2, interior_ptr str3 ) + { + *str2 = "string"; + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.ParameterAttributes" ); + + // Get the Type and the method. + Type^ Mytype = Type::GetType( "paramatt" ); + MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); + + // Display the method. + Console::Write( "\nMymethodbase = {0}", Mymethodbase ); + + // Get the ParameterInfo array. + array^Myarray = Mymethodbase->GetParameters(); + + // Get and display the attributes for the second parameter. + ParameterAttributes Myparamattributes = Myarray[ 1 ]->Attributes; + Console::Write( "\nFor the second parameter:\nMyparamattributes = {0}, which is an {1}", (int)Myparamattributes, Myparamattributes ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp new file mode 100644 index 00000000000..9d1bd81902a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.IsOut Example/CPP/source.cpp @@ -0,0 +1,52 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +public ref class parminfo +{ +public: + static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) + { + *str2m = "in mymethod"; + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.Parameterinfo" ); + + //Get the ParameterInfo parameter of a function. + //Get the type. + Type^ Mytype = Type::GetType( "parminfo" ); + + //Get and display the method. + MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); + Console::Write( "\nMymethodbase = {0}", Mymethodbase ); + + //Get the ParameterInfo array. + array^Myarray = Mymethodbase->GetParameters(); + + //Get and display the IsOut of each parameter. + System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator(); + while ( enum0->MoveNext() ) + { + ParameterInfo^ Myparam = safe_cast(enum0->Current); + Console::Write( "\nFor parameter # {0}, the IsOut is - {1}", Myparam->Position, Myparam->IsOut ); + } + + return 0; +} + +/* +This code produces the following output: + +Reflection.ParameterInfo + +Mymethodbase = Void mymethod (Int32, System.String ByRef, System.String ByRef) +For parameter # 0, the IsOut is - False +For parameter # 1, the IsOut is - True +For parameter # 2, the IsOut is - False +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..f604a9598d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.Name Example/CPP/source.cpp @@ -0,0 +1,53 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +public ref class parminfo +{ +public: + static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) + { + *str2m = "in mymethod"; + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.Parameterinfo" ); + + //Get the ParameterInfo parameter of a function. + //Get the type. + Type^ Mytype = Type::GetType( "parminfo" ); + + //Get and display the method. + MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); + Console::Write( "\nMymethodbase = {0}", Mymethodbase ); + + //Get the ParameterInfo array. + array^Myarray = Mymethodbase->GetParameters(); + + //Get and display the name of each parameter. + System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator(); + while ( enum0->MoveNext() ) + { + ParameterInfo^ Myparam = safe_cast(enum0->Current); + Console::Write( "\nFor parameter # {0}, the Name is - {1}", Myparam->Position, Myparam->Name ); + } + + return 0; +} + +/* +This code produces the following output: + +Reflection.ParameterInfo + +Mymethodbase += Void mymethod (Int32, System.String ByRef, System.String ByRef) +For parameter # 0, the Name is - int1m +For parameter # 1, the Name is - str2m +For parameter # 2, the Name is - str3m +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp new file mode 100644 index 00000000000..e005d0ef83a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ParameterInfo.ParameterType Example/CPP/source.cpp @@ -0,0 +1,52 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +public ref class parminfo +{ +public: + static void mymethod( int int1m, [Out]interior_ptr str2m, interior_ptr str3m ) + { + *str2m = "in mymethod"; + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.Parameterinfo" ); + + //Get the ParameterInfo parameter of a function. + //Get the type. + Type^ Mytype = Type::GetType( "parminfo" ); + + //Get and display the method. + MethodBase^ Mymethodbase = Mytype->GetMethod( "mymethod" ); + Console::Write( "\nMymethodbase = {0}", Mymethodbase ); + + //Get the ParameterInfo array. + array^Myarray = Mymethodbase->GetParameters(); + + //Get and display the ParameterInfo of each parameter. + System::Collections::IEnumerator^ enum0 = Myarray->GetEnumerator(); + while ( enum0->MoveNext() ) + { + ParameterInfo^ Myparam = safe_cast(enum0->Current); + Console::Write( "\nFor parameter # {0}, the ParameterType is - {1}", Myparam->Position, Myparam->ParameterType ); + } + + return 0; +} + +/* +This code produces the following output: + +Reflection.Parameterinfo + +Mymethodbase = Void mymethod(Int32, System.String ByRef, System.String ByRef) +For parameter # 0, the ParameterType is - System.Int32 +For parameter # 1, the ParameterType is - System.String& +For parameter # 2, the ParameterType is - System.String& +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp new file mode 100644 index 00000000000..da729d96fce --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission Example/CPP/source.cpp @@ -0,0 +1,17 @@ +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Policy; +using namespace System::Security::Principal; + +int main(array ^args) +{ + System::String^ null; + AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal); + PrincipalPermission^ principalPerm = gcnew PrincipalPermission(null, "Administrators" ); + principalPerm->Demand(); + Console::WriteLine("Demand succeeded"); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp new file mode 100644 index 00000000000..0bde5631510 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermission.IsSubsetOf Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using + +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Policy; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + void Method() + { + // + //Define users and roles. + PrincipalPermission^ ppBob = gcnew PrincipalPermission( "Bob", "Manager" ); + PrincipalPermission^ ppLouise = gcnew PrincipalPermission( "Louise", "Supervisor" ); + PrincipalPermission^ ppGreg = gcnew PrincipalPermission( "Greg", "Employee" ); + + //Define groups of users. + PrincipalPermission^ pp1 = (PrincipalPermission^) (ppBob->Union( ppLouise )); + PrincipalPermission^ pp2 = (PrincipalPermission^) (ppGreg->Union( pp1 )); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..cbff0e29e8a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PrincipalPermissionAttribute Example/CPP/source.cpp @@ -0,0 +1,35 @@ +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Policy; +using namespace System::Security::Principal; + +[PrincipalPermission(SecurityAction::Demand, Role = "Administrators")] +void CheckAdministrator() +{ + Console::WriteLine("User is an administrator."); +} +int main(array ^args) +{ + try + { + // Must set PrincipalPolicy to WindowsPrincipal + AppDomain::CurrentDomain->SetPrincipalPolicy(PrincipalPolicy::WindowsPrincipal); + // Check using declarative security. + CheckAdministrator(); + // Check using Imperative security. + System::String^ null; + PrincipalPermission^ principalPerm = gcnew PrincipalPermission(null, "Administrators" ); + principalPerm->Demand(); + Console::WriteLine("Demand succeeded"); + } + catch (Exception ^e) + { + Console::WriteLine(e->Message); + } + return 0; +} + + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..189cd35d9c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyAttributes Example/CPP/source.cpp @@ -0,0 +1,161 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Define three properties: one read-write, one default, +// and one read only. +// Define a read-write property. +public ref class Aproperty +{ +private: + String^ caption; + +public: + Aproperty() + : caption( "A Default caption" ) + {} + + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + + +// Define a default property. +public ref class Bproperty +{ +private: + String^ caption; + +public: + Bproperty() + : caption( "B Default caption" ) + {} + +public: + property String^ Item + { + String^ get() + { + return "1"; + } + + } + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + + +// Define a read-only property. +public ref class Cproperty +{ +private: + String^ caption; + +public: + Cproperty() + : caption( "C Default caption" ) + {} + + + property String^ Caption + { + String^ get() + { + return caption; + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.PropertyAttributes" ); + + // Determine whether a property exists, and change its value. + Aproperty^ Mypropertya = gcnew Aproperty; + Bproperty^ Mypropertyb = gcnew Bproperty; + Cproperty^ Mypropertyc = gcnew Cproperty; + Console::Write( "\n1. Mypropertya->Caption = {0}", Mypropertya->Caption ); + Console::Write( "\n1. Mypropertyb->Caption = {0}", Mypropertyb->Caption ); + Console::Write( "\n1. Mypropertyc->Caption = {0}", Mypropertyc->Caption ); + + // Only Mypropertya can be changed, as Mypropertyb is read-only. + Mypropertya->Caption = "A- This is changed."; + Mypropertyb->Caption = "B- This is changed."; + + // Note that Mypropertyc is not changed because it is read only + Console::Write( "\n\n2. Mypropertya->Caption = {0}", Mypropertya->Caption ); + Console::Write( "\n2. Mypropertyb->Caption = {0}", Mypropertyb->Caption ); + Console::Write( "\n2. Mypropertyc->Caption = {0}", Mypropertyc->Caption ); + + // Get the PropertyAttributes enumeration of the property. + // Get the type. + Type^ MyTypea = Type::GetType( "Aproperty" ); + Type^ MyTypeb = Type::GetType( "Bproperty" ); + Type^ MyTypec = Type::GetType( "Cproperty" ); + + // Get the property attributes. + PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); + PropertyAttributes Myattributesa = Mypropertyinfoa->Attributes; + PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Item" ); + PropertyAttributes Myattributesb = Mypropertyinfob->Attributes; + PropertyInfo^ Mypropertyinfoc = MyTypec->GetProperty( "Caption" ); + PropertyAttributes Myattributesc = Mypropertyinfoc->Attributes; + + // Display the property attributes value. + Console::Write( "\n\na- {0}", Myattributesa ); + Console::Write( "\nb- {0}", Myattributesb ); + Console::Write( "\nc- {0}", Myattributesc ); + return 0; +} + +// This example displays the following output to the console +// +// Reflection.PropertyAttributes +// +// 1. Mypropertya.Caption = A Default caption +// 1. Mypropertyb.Caption = B Default caption +// 1. Mypropertyc.Caption = C Default caption +// +// 2. Mypropertya.Caption = A- This is changed. +// 2. Mypropertyb.Caption = B- This is changed. +// 2. Mypropertyc.Caption = C Default caption +// +// a- None +// b- None +// c- None +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp new file mode 100644 index 00000000000..5e3598f1d39 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanRead Example/CPP/source.cpp @@ -0,0 +1,85 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Define one readable property and one not readable. +public ref class Mypropertya +{ +private: + String^ caption; + +public: + Mypropertya() + : caption( "A Default caption" ) + {} + + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + +public ref class Mypropertyb +{ +private: + String^ caption; + +public: + Mypropertyb() + : caption( "B Default caption" ) + {} + + + property String^ Caption + { + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.PropertyInfo" ); + + // Define two properties. + Mypropertya^ mypropertya = gcnew Mypropertya; + Mypropertyb^ mypropertyb = gcnew Mypropertyb; + Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption ); + + // Mypropertyb.Caption cannot be read, because + // there is no get accessor. + // Get the type and PropertyInfo. + Type^ MyTypea = Type::GetType( "Mypropertya" ); + PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); + Type^ MyTypeb = Type::GetType( "Mypropertyb" ); + PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Caption" ); + + // Get and display the CanRead property. + Console::Write( "\nCanRead a - {0}", Mypropertyinfoa->CanRead ); + Console::Write( "\nCanRead b - {0}", Mypropertyinfob->CanRead ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp new file mode 100644 index 00000000000..c83b78e6d61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.CanWrite Example/CPP/source.cpp @@ -0,0 +1,92 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Define one writable property and one not writable. +public ref class Mypropertya +{ +private: + String^ caption; + +public: + Mypropertya() + : caption( "A Default caption" ) + {} + + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + +public ref class Mypropertyb +{ +private: + String^ caption; + +public: + Mypropertyb() + : caption( "B Default caption" ) + {} + + + property String^ Caption + { + String^ get() + { + return caption; + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.PropertyInfo" ); + + // Define two properties. + Mypropertya^ mypropertya = gcnew Mypropertya; + Mypropertyb^ mypropertyb = gcnew Mypropertyb; + + // Read and display the property. + Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption ); + Console::Write( "\nMypropertyb->Caption = {0}", mypropertyb->Caption ); + + // Write to the property. + mypropertya->Caption = "A- No Change"; + + // Mypropertyb.Caption cannot be written to because + // there is no set accessor. + // Read and display the property. + Console::Write( "\nMypropertya->Caption = {0}", mypropertya->Caption ); + Console::Write( "\nMypropertyb->Caption = {0}", mypropertyb->Caption ); + + // Get the type and PropertyInfo. + Type^ MyTypea = Type::GetType( "Mypropertya" ); + PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); + Type^ MyTypeb = Type::GetType( "Mypropertyb" ); + PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Caption" ); + + // Get and display the CanWrite property. + Console::Write( "\nCanWrite a - {0}", Mypropertyinfoa->CanWrite ); + Console::Write( "\nCanWrite b - {0}", Mypropertyinfob->CanWrite ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp new file mode 100644 index 00000000000..e947e02ff48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetGetMethod1 Example/CPP/source.cpp @@ -0,0 +1,59 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Define a property. +public ref class Myproperty +{ +private: + String^ caption; + +public: + Myproperty() + : caption( "A Default caption" ) + {} + + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.PropertyInfo" ); + + // Get the type and PropertyInfo for two separate properties. + Type^ MyTypea = Type::GetType( "Myproperty" ); + PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); + Type^ MyTypeb = Type::GetType( "System.Reflection.MethodInfo" ); + PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "MemberType" ); + + // Get and display the GetGetMethod method for each property. + MethodInfo^ Mygetmethodinfoa = Mypropertyinfoa->GetGetMethod(); + Console::Write( "\nGetAccessor for {0} returns a {1}", Mypropertyinfoa->Name, Mygetmethodinfoa->ReturnType ); + MethodInfo^ Mygetmethodinfob = Mypropertyinfob->GetGetMethod(); + Console::Write( "\nGetAccessor for {0} returns a {1}", Mypropertyinfob->Name, Mygetmethodinfob->ReturnType ); + + // Display the GetGetMethod without using the MethodInfo. + Console::Write( "\n{0}.{1} GetGetMethod - {2}", MyTypea->FullName, Mypropertyinfoa->Name, Mypropertyinfoa->GetGetMethod() ); + Console::Write( "\n{0}.{1} GetGetMethod - {2}", MyTypeb->FullName, Mypropertyinfob->Name, Mypropertyinfob->GetGetMethod() ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp new file mode 100644 index 00000000000..6c130b9d45f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetIndexParameters Example/CPP/source.cpp @@ -0,0 +1,92 @@ + +// +using namespace System; +using namespace System::Reflection; + +// A class that contains some properties. +public ref class MyProperty +{ +private: + + // Define a simple string property. + String^ caption; + +public: + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +private: + + // A very limited indexer that gets or sets one of four + // strings. + array^strings; + +public: + MyProperty() + { + array^temp0 = {"abc","def","ghi","jkl"}; + strings = temp0; + } + + + property String^ Item [int] + { + String^ get( int Index ) + { + return strings[ Index ]; + } + + void set( int Index, String^ value ) + { + strings[ Index ] = value; + } + + } + +}; + +int main() +{ + + // Get the type and PropertyInfo. + Type^ t = Type::GetType( "MyProperty" ); + PropertyInfo^ pi = t->GetProperty( "Caption" ); + + // Get the public GetIndexParameters method. + array^parms = pi->GetIndexParameters(); + Console::WriteLine( "\n{0}.{1} has {2} parameters.", t->FullName, pi->Name, parms->GetLength( 0 ) ); + + // Display a property that has parameters. + pi = t->GetProperty( "Item" ); + parms = pi->GetIndexParameters(); + Console::WriteLine( "{0}.{1} has {2} parameters.", t->FullName, pi->Name, parms->GetLength( 0 ) ); + for ( int i = 0; i < parms->GetLength( 0 ); i++ ) + { + Console::WriteLine( " Parameter: {0}", parms[ i ]->Name ); + + } + return 0; +} + +/* + This example produces the following output: + MyProperty.Caption has 0 parameters. + MyProperty.Item has 1 parameters. + Parameter: Index + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp new file mode 100644 index 00000000000..490380e255b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.GetSetMethod1 Example/CPP/source.cpp @@ -0,0 +1,55 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Define a property. +public ref class Myproperty +{ +private: + String^ caption; + +public: + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + +int main() +{ + Console::WriteLine( "\nReflection.PropertyInfo" ); + + // Get the type and PropertyInfo for two separate properties. + Type^ MyTypea = Type::GetType( "Myproperty" ); + PropertyInfo^ Mypropertyinfoa = MyTypea->GetProperty( "Caption" ); + Type^ MyTypeb = Type::GetType( "System.Text.StringBuilder" ); + PropertyInfo^ Mypropertyinfob = MyTypeb->GetProperty( "Length" ); + + // Get and display the GetSetMethod method for each property. + MethodInfo^ Mygetmethodinfoa = Mypropertyinfoa->GetSetMethod(); + Console::Write( "\nSetAccessor for {0} returns a {1}", Mypropertyinfoa->Name, Mygetmethodinfoa->ReturnType ); + MethodInfo^ Mygetmethodinfob = Mypropertyinfob->GetSetMethod(); + Console::Write( "\nSetAccessor for {0} returns a {1}", Mypropertyinfob->Name, Mygetmethodinfob->ReturnType ); + + // Display the GetSetMethod without using the MethodInfo. + Console::Write( "\n\n{0}.{1} GetSetMethod - {2}", MyTypea->FullName, Mypropertyinfoa->Name, Mypropertyinfoa->GetSetMethod() ); + Console::Write( "\n{0}.{1} GetSetMethod - {2}", MyTypeb->FullName, Mypropertyinfob->Name, Mypropertyinfob->GetSetMethod() ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp new file mode 100644 index 00000000000..a56525a268e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.MemberType Example/CPP/source.cpp @@ -0,0 +1,18 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + Console::WriteLine( "\nReflection.PropertyInfo" ); + + // Get the type and PropertyInfo. + Type^ MyType = Type::GetType( "System.Reflection.MemberInfo" ); + PropertyInfo^ Mypropertyinfo = MyType->GetProperty( "Name" ); + + // Read and display the MemberType property. + Console::Write( "\nMemberType = {0}", Mypropertyinfo->MemberType ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp new file mode 100644 index 00000000000..7c87302d269 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic PropertyInfo.SetValue1 Example/CPP/source.cpp @@ -0,0 +1,67 @@ + +// +using namespace System; +using namespace System::Reflection; + +// Define a property. +public ref class TestClass +{ +private: + String^ caption; + +public: + TestClass() + { + caption = "A Default caption"; + } + + + property String^ Caption + { + String^ get() + { + return caption; + } + + void set( String^ value ) + { + if ( caption != value ) + { + caption = value; + } + } + + } + +}; + +int main() +{ + TestClass^ t = gcnew TestClass; + + // Get the type and PropertyInfo. + Type^ myType = t->GetType(); + PropertyInfo^ pinfo = myType->GetProperty( "Caption" ); + + // Display the property value, using the GetValue method. + Console::WriteLine( "\nGetValue: {0}", pinfo->GetValue( t, nullptr ) ); + + // Use the SetValue method to change the caption. + pinfo->SetValue( t, "This caption has been changed.", nullptr ); + + // Display the caption again. + Console::WriteLine( "GetValue: {0}", pinfo->GetValue( t, nullptr ) ); + Console::WriteLine( "\nPress the Enter key to continue." ); + Console::ReadLine(); + return 0; +} + +/* +This example produces the following output: + +GetValue: A Default caption +GetValue: This caption has been changed + +Press the Enter key to continue. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp new file mode 100644 index 00000000000..37dced94673 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myCollection ); +int main() +{ + + // Creates and initializes a new Queue. + Queue^ myQ = gcnew Queue; + myQ->Enqueue( "Hello" ); + myQ->Enqueue( "World" ); + myQ->Enqueue( "!" ); + + // Displays the properties and values of the Queue. + Console::WriteLine( "myQ" ); + Console::WriteLine( "\tCount: {0}", myQ->Count ); + Console::Write( "\tValues:" ); + PrintValues( myQ ); +} + +void PrintValues( IEnumerable^ myCollection ) +{ + IEnumerator^ myEnum = myCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + myQ + Count: 3 + Values: Hello World ! +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..7ff5770c590 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Clear Example/CPP/source.cpp @@ -0,0 +1,56 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( Queue^ myQ ); +int main() +{ + + // Creates and initializes a new Queue. + Queue^ myQ = gcnew Queue; + myQ->Enqueue( "The" ); + myQ->Enqueue( "quick" ); + myQ->Enqueue( "brown" ); + myQ->Enqueue( "fox" ); + myQ->Enqueue( "jumps" ); + + // Displays the count and values of the Queue. + Console::WriteLine( "Initially," ); + Console::WriteLine( " Count : {0}", myQ->Count ); + Console::Write( " Values:" ); + PrintValues( myQ ); + + // Clears the Queue. + myQ->Clear(); + + // Displays the count and values of the Queue. + Console::WriteLine( "After Clear," ); + Console::WriteLine( " Count : {0}", myQ->Count ); + Console::Write( " Values:" ); + PrintValues( myQ ); +} + +void PrintValues( Queue^ myQ ) +{ + IEnumerator^ myEnum = myQ->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ myObj = safe_cast(myEnum->Current); + Console::Write( " {0}", myObj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initially, + Count : 5 + Values: The quick brown fox jumps + After Clear, + Count : 0 + Values: + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..da270065dbb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.CopyTo Example/CPP/source.cpp @@ -0,0 +1,69 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( Array^ myArr, char mySeparator ); +int main() +{ + // Creates and initializes the source Queue. + Queue^ mySourceQ = gcnew Queue; + mySourceQ->Enqueue( "three" ); + mySourceQ->Enqueue( "napping" ); + mySourceQ->Enqueue( "cats" ); + mySourceQ->Enqueue( "in" ); + mySourceQ->Enqueue( "the" ); + mySourceQ->Enqueue( "barn" ); + + // Creates and initializes the one-dimensional target Array. + Array^ myTargetArray = Array::CreateInstance( String::typeid, 15 ); + myTargetArray->SetValue( "The", 0 ); + myTargetArray->SetValue( "quick", 1 ); + myTargetArray->SetValue( "brown", 2 ); + myTargetArray->SetValue( "fox", 3 ); + myTargetArray->SetValue( "jumps", 4 ); + myTargetArray->SetValue( "over", 5 ); + myTargetArray->SetValue( "the", 6 ); + myTargetArray->SetValue( "lazy", 7 ); + myTargetArray->SetValue( "dog", 8 ); + + // Displays the values of the target Array. + Console::WriteLine( "The target Array contains the following (before and after copying):" ); + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source Queue to the target Array, starting at index 6. + mySourceQ->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source Queue to a new standard array. + array^myStandardArray = mySourceQ->ToArray(); + + // Displays the values of the new standard array. + Console::WriteLine( "The new standard array contains the following:" ); + PrintValues( myStandardArray, ' ' ); +} + +void PrintValues( Array^ myArr, char mySeparator ) +{ + IEnumerator^ myEnum = myArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ myObj = safe_cast(myEnum->Current); + Console::Write( "{0}{1}", mySeparator, myObj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Array contains the following (before and after copying): + The quick brown fox jumps over the lazy dog + The quick brown fox jumps over three napping cats in the barn + The new standard array contains the following: + three napping cats in the barn + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp new file mode 100644 index 00000000000..7238b539959 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.Enqueue Example/CPP/source.cpp @@ -0,0 +1,66 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myCollection ); +int main() +{ + + // Creates and initializes a new Queue. + Queue^ myQ = gcnew Queue; + myQ->Enqueue( "The" ); + myQ->Enqueue( "quick" ); + myQ->Enqueue( "brown" ); + myQ->Enqueue( "fox" ); + + // Displays the Queue. + Console::Write( "Queue values:" ); + PrintValues( myQ ); + + // Removes an element from the Queue. + Console::WriteLine( "(Dequeue)\t{0}", myQ->Dequeue() ); + + // Displays the Queue. + Console::Write( "Queue values:" ); + PrintValues( myQ ); + + // Removes another element from the Queue. + Console::WriteLine( "(Dequeue)\t{0}", myQ->Dequeue() ); + + // Displays the Queue. + Console::Write( "Queue values:" ); + PrintValues( myQ ); + + // Views the first element in the Queue but does not remove it. + Console::WriteLine( "(Peek) \t{0}", myQ->Peek() ); + + // Displays the Queue. + Console::Write( "Queue values:" ); + PrintValues( myQ ); +} + +void PrintValues( IEnumerable^ myCollection ) +{ + IEnumerator^ myEnum = myCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Queue values: The quick brown fox + (Dequeue) The + Queue values: quick brown fox + (Dequeue) quick + Queue values: brown fox + (Peek) brown + Queue values: brown fox + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp new file mode 100644 index 00000000000..ce3246510e6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +int main() +{ + + // Creates and initializes a new Queue. + Queue^ myQ = gcnew Queue; + myQ->Enqueue( "The" ); + myQ->Enqueue( "quick" ); + myQ->Enqueue( "brown" ); + myQ->Enqueue( "fox" ); + + // Creates a synchronized wrapper around the Queue. + Queue^ mySyncdQ = Queue::Synchronized( myQ ); + + // Displays the sychronization status of both Queues. + Console::WriteLine( "myQ is {0}.", myQ->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); + Console::WriteLine( "mySyncdQ is {0}.", mySyncdQ->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); +} + +/* +This code produces the following output. + +myQ is not synchronized. +mySyncdQ is synchronized. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp new file mode 100644 index 00000000000..8bfdf62af62 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Queue.IsSynchronized Example/CPP/source2.cpp @@ -0,0 +1,35 @@ +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class SamplesQueue +{ +public: + static void Main() + { + // + Queue^ myCollection = gcnew Queue(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesQueue::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp new file mode 100644 index 00000000000..bdf0c7f6486 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Random.NextBytes Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; + +void main() +{ + Random^ rnd = gcnew Random; + array^b = gcnew array(10); + rnd->NextBytes( b ); + Console::WriteLine("The Random bytes are:"); + for ( int i = 0; i < 10; i++ ) + Console::WriteLine("{0}: {1}", i, b[i]); +} +// The example displays output similar to the following: +// The Random bytes are: +// 0: 131 +// 1: 96 +// 2: 226 +// 3: 213 +// 4: 176 +// 5: 208 +// 6: 99 +// 7: 89 +// 8: 226 +// 9: 194 +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp new file mode 100644 index 00000000000..9d881778d4a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetBytes Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Cryptography; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + // + array^ random = gcnew array(100); + + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + rng->GetBytes( random ); // The array is now filled with cryptographically strong random bytes. + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp new file mode 100644 index 00000000000..c9dcb18468c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic RandomNumberGenerator.GetNonZeroBytes Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Cryptography; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + // + array^ random = gcnew array(100); + RandomNumberGenerator^ rng = RandomNumberGenerator::Create(); + rng->GetNonZeroBytes( random ); // The array is now filled with cryptographically strong random bytes, and none are zero. + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp new file mode 100644 index 00000000000..9b6c4198a94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.ClassesRoot Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +void PrintKeys( RegistryKey ^ rkey ) +{ + + // Retrieve all the subkeys for the specified key. + array^names = rkey->GetSubKeyNames(); + int icount = 0; + Console::WriteLine( "Subkeys of {0}", rkey->Name ); + Console::WriteLine( "-----------------------------------------------" ); + + // Print the contents of the array to the console. + System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); + while ( enum0->MoveNext() ) + { + String^ s = safe_cast(enum0->Current); + Console::WriteLine( s ); + + // The following code puts a limit on the number + // of keys displayed. Comment it out to print the + // complete list. + icount++; + if ( icount >= 10 ) + break; + } +} + +int main() +{ + + // Create a RegistryKey, which will access the HKEY_CLASSES_ROOT + // key in the registry of this machine. + RegistryKey ^ rk = Registry::ClassesRoot; + + // Print out the keys. + PrintKeys( rk ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp new file mode 100644 index 00000000000..6baa9bb3a23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentConfig Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +void PrintKeys( RegistryKey ^ rkey ) +{ + + // Retrieve all the subkeys for the specified key. + array^names = rkey->GetSubKeyNames(); + int icount = 0; + Console::WriteLine( "Subkeys of {0}", rkey->Name ); + Console::WriteLine( "-----------------------------------------------" ); + + // Print the contents of the array to the console. + System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); + while ( enum0->MoveNext() ) + { + String^ s = safe_cast(enum0->Current); + Console::WriteLine( s ); + + // The following code puts a limit on the number + // of keys displayed. Comment it out to print the + // complete list. + icount++; + if ( icount >= 10 ) + break; + } +} + +int main() +{ + + // Create a RegistryKey, which will access the HKEY_CURRENT_CONFIG + // key in the registry of this machine. + RegistryKey ^ rk = Registry::CurrentConfig; + + // Print out the keys. + PrintKeys( rk ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp new file mode 100644 index 00000000000..c6f43174e0d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.CurrentUser Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +void PrintKeys( RegistryKey ^ rkey ) +{ + + // Retrieve all the subkeys for the specified key. + array^names = rkey->GetSubKeyNames(); + int icount = 0; + Console::WriteLine( "Subkeys of {0}", rkey->Name ); + Console::WriteLine( "-----------------------------------------------" ); + + // Print the contents of the array to the console. + System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); + while ( enum0->MoveNext() ) + { + String^ s = safe_cast(enum0->Current); + Console::WriteLine( s ); + + // The following code puts a limit on the number + // of keys displayed. Comment it out to print the + // complete list. + icount++; + if ( icount >= 10 ) + break; + } +} + +int main() +{ + + // Create a RegistryKey, which will access the HKEY_CURRENT_USER + // key in the registry of this machine. + RegistryKey ^ rk = Registry::CurrentUser; + + // Print out the keys. + PrintKeys( rk ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp new file mode 100644 index 00000000000..0fe44b29190 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.LocalMachine Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +void PrintKeys( RegistryKey ^ rkey ) +{ + + // Retrieve all the subkeys for the specified key. + array^names = rkey->GetSubKeyNames(); + int icount = 0; + Console::WriteLine( "Subkeys of {0}", rkey->Name ); + Console::WriteLine( "-----------------------------------------------" ); + + // Print the contents of the array to the console. + System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); + while ( enum0->MoveNext() ) + { + String^ s = safe_cast(enum0->Current); + Console::WriteLine( s ); + + // The following code puts a limit on the number + // of keys displayed. Comment it out to print the + // complete list. + icount++; + if ( icount >= 10 ) + break; + } +} + +int main() +{ + + // Create a RegistryKey, which will access the HKEY_LOCAL_MACHINE + // key in the registry of this machine. + RegistryKey ^ rk = Registry::LocalMachine; + + // Print out the keys. + PrintKeys( rk ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp new file mode 100644 index 00000000000..aa60f391bdb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.PerformanceData Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +void PrintKeys( RegistryKey ^ rkey ) +{ + + // Retrieve all the subkeys for the specified key. + array^names = rkey->GetSubKeyNames(); + int icount = 0; + Console::WriteLine( "Subkeys of {0}", rkey->Name ); + Console::WriteLine( "-----------------------------------------------" ); + + // Print the contents of the array to the console. + System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); + while ( enum0->MoveNext() ) + { + String^ s = safe_cast(enum0->Current); + Console::WriteLine( s ); + + // The following code puts a limit on the number + // of keys displayed. Comment it out to print the + // complete list. + icount++; + if ( icount >= 10 ) + break; + } +} + +int main() +{ + + // Create a RegistryKey, which will access the HKEY_PERFORMANCE_DATA + // key in the registry of this machine. + RegistryKey ^ rk = Registry::PerformanceData; + + // Print out the keys. + PrintKeys( rk ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp new file mode 100644 index 00000000000..6131b75f231 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Registry.Users Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace Microsoft::Win32; +void PrintKeys( RegistryKey ^ rkey ) +{ + + // Retrieve all the subkeys for the specified key. + array^names = rkey->GetSubKeyNames(); + int icount = 0; + Console::WriteLine( "Subkeys of {0}", rkey->Name ); + Console::WriteLine( "-----------------------------------------------" ); + + // Print the contents of the array to the console. + System::Collections::IEnumerator^ enum0 = names->GetEnumerator(); + while ( enum0->MoveNext() ) + { + String^ s = safe_cast(enum0->Current); + Console::WriteLine( s ); + + // The following code puts a limit on the number + // of keys displayed. Comment it out to print the + // complete list. + icount++; + if ( icount >= 10 ) + break; + } +} + +int main() +{ + + // Create a RegistryKey, which will access the HKEY_USERS + // key in the registry of this machine. + RegistryKey ^ rk = Registry::Users; + + // Print out the keys. + PrintKeys( rk ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp new file mode 100644 index 00000000000..924a4b4b69f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic RegistryKey.GetValue Example/CPP/source.cpp @@ -0,0 +1,78 @@ +// +using namespace System; +using namespace Microsoft::Win32; + +public ref class RegGetDef +{ +public: + static void Main() + { + // Create a reference to a valid key. In order for this code to + // work, the indicated key must have been created previously. + // The key name is not case-sensitive. + RegistryKey^ rk = Registry::LocalMachine->OpenSubKey("Software\\myTestKey", false); + // Get the value from the specified name/value pair in the key. + String^ valueName = "myTestValue"; + + Console::WriteLine("Retrieving registry value ..."); + Console::WriteLine(); + Object^ o = rk->GetValue(valueName); + Console::WriteLine("Object Type = " + o->GetType()->FullName); + Console::WriteLine(); + switch (rk->GetValueKind(valueName)) + { + case RegistryValueKind::String: + case RegistryValueKind::ExpandString: + Console::WriteLine("Value = " + o); + break; + case RegistryValueKind::Binary: + for each (Byte^ b in (array^)o) + { + Console::Write("{0:x2} ", b); + } + Console::WriteLine(); + break; + case RegistryValueKind::DWord: + Console::WriteLine("Value = " + Convert::ToString((Int32^)o)); + break; + case RegistryValueKind::QWord: + Console::WriteLine("Value = " + Convert::ToString((Int64^)o)); + break; + case RegistryValueKind::MultiString: + for each (String^ s in (array^)o) + { + Console::Write("[{0:s}], ", s); + } + Console::WriteLine(); + break; + default: + Console::WriteLine("Value = (Unknown)"); + break; + } + + // Attempt to retrieve a value that does not exist; the specified + // default value is returned. + String^ def = (String^)rk->GetValue("notavalue", "The default to return"); + Console::WriteLine(); + Console::WriteLine(def); + + rk->Close(); + } +}; + +int main() +{ + RegGetDef::Main(); +} +/* +Output: +Retrieving registry value ... + +Object Type = System.String + +Value = testData + +The default to return +*/ +// + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp new file mode 100644 index 00000000000..ebd4a81690e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ResourceWriter Example/CPP/source.cpp @@ -0,0 +1,20 @@ + +// +using namespace System; +using namespace System::Resources; +int main() +{ + + // Creates a resource writer. + IResourceWriter^ writer = gcnew ResourceWriter( "myResources.resources" ); + + // Adds resources to the resource writer. + writer->AddResource( "String 1", "First String" ); + writer->AddResource( "String 2", "Second String" ); + writer->AddResource( "String 3", "Third String" ); + + // Writes the resources to the file or stream, and closes it. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp new file mode 100644 index 00000000000..aa1b6553ab8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA256 Example/CPP/source.cpp @@ -0,0 +1,76 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +// Print the byte array in a readable format. +void PrintByteArray( array^array ) +{ + int i; + for ( i = 0; i < array->Length; i++ ) + { + Console::Write( String::Format( "{0:X2}", array[ i ] ) ); + if ( (i % 4) == 3 ) + Console::Write( " " ); + + } + Console::WriteLine(); +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "Usage: hashdir " ); + return 0; + } + + try + { + + // Create a DirectoryInfo object representing the specified directory. + DirectoryInfo^ dir = gcnew DirectoryInfo( args[ 1 ] ); + + // Get the FileInfo objects for every file in the directory. + array^files = dir->GetFiles(); + + // Initialize a SHA256 hash object. + SHA256 ^ mySHA256 = SHA256Managed::Create(); + array^hashValue; + + // Compute and print the hash values for each file in directory. + System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FileInfo^ fInfo = safe_cast(myEnum->Current); + + // Create a fileStream for the file. + FileStream^ fileStream = fInfo->Open( FileMode::Open ); + + // Compute the hash of the fileStream. + hashValue = mySHA256->ComputeHash( fileStream ); + + // Write the name of the file to the Console. + Console::Write( "{0}: ", fInfo->Name ); + + // Write the hash value to the Console. + PrintByteArray( hashValue ); + + // Close the file. + fileStream->Close(); + } + return 0; + } + catch ( DirectoryNotFoundException^ ) + { + Console::WriteLine( "Error: The directory specified could not be found." ); + } + catch ( IOException^ ) + { + Console::WriteLine( "Error: A file in the directory could not be accessed." ); + } + +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp new file mode 100644 index 00000000000..471fe0f815a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384 Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Security::Cryptography; + +public ref class Sample +{ +protected: + void Method() + { + int DATA_SIZE = 1024; + + // + array^ data = gcnew array( DATA_SIZE ); + array^ result; + SHA384^ shaM = gcnew SHA384Managed; + result = shaM->ComputeHash( data ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp new file mode 100644 index 00000000000..6a0aa345a43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA384Managed Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Security::Cryptography; + +public ref class Sample +{ +protected: + void Method() + { + int DATA_SIZE = 1024; + + // + array^ data = gcnew array( DATA_SIZE ); + array^ result; + + SHA384^ shaM = gcnew SHA384Managed; + result = shaM->ComputeHash( data ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp new file mode 100644 index 00000000000..2a84c2dc7ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512 Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Security::Cryptography; + +public ref class Sample +{ +protected: + void Method() + { + int DATA_SIZE = 1024; + + // + array^ data = gcnew array( DATA_SIZE ); + array^ result; + SHA512^ shaM = gcnew SHA512Managed; + result = shaM->ComputeHash( data ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp new file mode 100644 index 00000000000..a22a11fb2ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SHA512Managed Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Security::Cryptography; + +public ref class Sample +{ +protected: + void Method() + { + int DATA_SIZE = 1024; + + // + array^ data = gcnew array( DATA_SIZE ); + array^ result; + + SHA512^ shaM = gcnew SHA512Managed; + result = shaM->ComputeHash( data ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp new file mode 100644 index 00000000000..d7c3794882b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic ServiceInstaller Example/CPP/source.cpp @@ -0,0 +1,57 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Configuration::Install; +using namespace System::ServiceProcess; +using namespace System::ComponentModel; + +[RunInstaller(true)] +public ref class MyProjectInstaller : public Installer +{ +private: + ServiceInstaller^ serviceInstaller1; + ServiceInstaller^ serviceInstaller2; + ServiceProcessInstaller^ processInstaller; + +public: + MyProjectInstaller() + { + // Instantiate installers for process and services. + processInstaller = gcnew ServiceProcessInstaller; + serviceInstaller1 = gcnew ServiceInstaller; + serviceInstaller2 = gcnew ServiceInstaller; + + // The services run under the system account. + processInstaller->Account = ServiceAccount::LocalSystem; + + // The services are started manually. + serviceInstaller1->StartType = ServiceStartMode::Manual; + serviceInstaller2->StartType = ServiceStartMode::Manual; + + // ServiceName must equal those on ServiceBase derived classes. + serviceInstaller1->ServiceName = "Hello-World Service 1"; + serviceInstaller2->ServiceName = "Hello-World Service 2"; + + // Add installers to collection. Order is not important. + Installers->Add( serviceInstaller1 ); + Installers->Add( serviceInstaller2 ); + Installers->Add( processInstaller ); + } + + static void Main() + { + Console::WriteLine("Usage: InstallUtil.exe [.exe]"); + } +}; + +int main() +{ + MyProjectInstaller::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp new file mode 100644 index 00000000000..c7e0914d780 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/remarks.cpp @@ -0,0 +1,27 @@ +using namespace System; +using namespace System::Collections; + +public ref class SamplesSortedList +{ +public: + static void Main() + { + // Creates and initializes a new SortedList. + SortedList^ mySortedList = gcnew SortedList(); + mySortedList->Add("Third", "!"); + mySortedList->Add("Second", "World"); + mySortedList->Add("First", "Hello"); + + // + for each (DictionaryEntry de in mySortedList) + { + //... + } + // + } +}; + +int main() +{ + SamplesSortedList::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp new file mode 100644 index 00000000000..bc3817bdcfe --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList Example/CPP/source.cpp @@ -0,0 +1,53 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +public ref class SamplesSortedList +{ +public: + static void PrintKeysAndValues( SortedList^ myList ) + { + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); + } + +}; + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( "Third", "!" ); + mySL->Add( "Second", "World" ); + mySL->Add( "First", "Hello" ); + + // Displays the properties and values of the SortedList. + Console::WriteLine( "mySL" ); + Console::WriteLine( " Count: {0}", mySL->Count ); + Console::WriteLine( " Capacity: {0}", mySL->Capacity ); + Console::WriteLine( " Keys and Values:" ); + SamplesSortedList::PrintKeysAndValues( mySL ); +} + +/* +This code produces the following output. + +mySL +Count: 3 +Capacity: 16 +Keys and Values: +-KEY- -VALUE- +First: Hello +Second: World +Third: ! +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..ce1205d460a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Add Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void PrintKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( "one", "The" ); + mySL->Add( "two", "quick" ); + mySL->Add( "three", "brown" ); + mySL->Add( "four", "fox" ); + + // Displays the SortedList. + Console::WriteLine( "The SortedList contains the following:" ); + PrintKeysAndValues( mySL ); +} + +/* +This code produces the following output. + +The SortedList contains the following: + -KEY- -VALUE- + four: fox + one: The + three: brown + two: quick +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..d4b3dbf1600 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Clear Example/CPP/source.cpp @@ -0,0 +1,106 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void PrintKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( "one", "The" ); + mySL->Add( "two", "quick" ); + mySL->Add( "three", "brown" ); + mySL->Add( "four", "fox" ); + mySL->Add( "five", "jumps" ); + + // Displays the count, capacity and values of the SortedList. + Console::WriteLine( "Initially," ); + Console::WriteLine( " Count : {0}", mySL->Count ); + Console::WriteLine( " Capacity : {0}", mySL->Capacity ); + Console::WriteLine( " Values:" ); + PrintKeysAndValues( mySL ); + + // Trims the SortedList. + mySL->TrimToSize(); + + // Displays the count, capacity and values of the SortedList. + Console::WriteLine( "After TrimToSize," ); + Console::WriteLine( " Count : {0}", mySL->Count ); + Console::WriteLine( " Capacity : {0}", mySL->Capacity ); + Console::WriteLine( " Values:" ); + PrintKeysAndValues( mySL ); + + // Clears the SortedList. + mySL->Clear(); + + // Displays the count, capacity and values of the SortedList. + Console::WriteLine( "After Clear," ); + Console::WriteLine( " Count : {0}", mySL->Count ); + Console::WriteLine( " Capacity : {0}", mySL->Capacity ); + Console::WriteLine( " Values:" ); + PrintKeysAndValues( mySL ); + + // Trims the SortedList again. + mySL->TrimToSize(); + + // Displays the count, capacity and values of the SortedList. + Console::WriteLine( "After the second TrimToSize," ); + Console::WriteLine( " Count : {0}", mySL->Count ); + Console::WriteLine( " Capacity : {0}", mySL->Capacity ); + Console::WriteLine( " Values:" ); + PrintKeysAndValues( mySL ); +} + +/* +This code produces the following output. + +Initially, + Count : 5 + Capacity : 16 + Values: + -KEY- -VALUE- + five: jumps + four: fox + one: The + three: brown + two: quick + +After TrimToSize, + Count : 5 + Capacity : 5 + Values: + -KEY- -VALUE- + five: jumps + four: fox + one: The + three: brown + two: quick + +After Clear, + Count : 0 + Capacity : 16 + Values: + -KEY- -VALUE- + +After the second TrimToSize, + Count : 0 + Capacity : 16 + Values: + -KEY- -VALUE- + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp new file mode 100644 index 00000000000..e233d2f4884 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.Contains Example/CPP/source.cpp @@ -0,0 +1,63 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void PrintIndexAndKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i, myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( 2, "two" ); + mySL->Add( 4, "four" ); + mySL->Add( 1, "one" ); + mySL->Add( 3, "three" ); + mySL->Add( (int^)0, "zero" ); + + // Displays the values of the SortedList. + Console::WriteLine( "The SortedList contains the following values:" ); + PrintIndexAndKeysAndValues( mySL ); + + // Searches for a specific key. + int myKey = 2; + Console::WriteLine( "The key \"{0}\" is {1}.", myKey, mySL->ContainsKey( myKey ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); + myKey = 6; + Console::WriteLine( "The key \"{0}\" is {1}.", myKey, mySL->ContainsKey( myKey ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); + + // Searches for a specific value. + String^ myValue = "three"; + Console::WriteLine( "The value \"{0}\" is {1}.", myValue, mySL->ContainsValue( myValue ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); + myValue = "nine"; + Console::WriteLine( "The value \"{0}\" is {1}.", myValue, mySL->ContainsValue( myValue ) ? (String^)"in the SortedList" : "NOT in the SortedList" ); +} + +/* +This code produces the following output. + +The SortedList contains the following values: + -INDEX- -KEY- -VALUE- + [0]: 0 zero + [1]: 1 one + [2]: 2 two + [3]: 3 three + [4]: 4 four + +The key "2" is in the SortedList. +The key "6" is NOT in the SortedList. +The value "three" is in the SortedList. +The value "nine" is NOT in the SortedList. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..5bb708f958a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.CopyTo Example/CPP/source.cpp @@ -0,0 +1,59 @@ + + +// +using namespace System; +using namespace System::Collections; +void PrintValues( array^ myArr, Char mySeparator ); +int main() +{ + + // Creates and initializes the source SortedList. + SortedList^ mySourceList = gcnew SortedList; + mySourceList->Add( 2, "cats" ); + mySourceList->Add( 3, "in" ); + mySourceList->Add( 1, "napping" ); + mySourceList->Add( 4, "the" ); + mySourceList->Add( 0, "three" ); + mySourceList->Add( 5, "barn" ); + + // Creates and initializes the one-dimensional target Array. + array^tempArray = {"The","quick","brown","fox","jumps","over","the","lazy","dog"}; + array^myTargetArray = gcnew array(15); + int i = 0; + IEnumerator^ myEnum = tempArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ s = safe_cast(myEnum->Current); + myTargetArray[ i ].Key = i; + myTargetArray[ i ].Value = s; + i++; + } + + + // Displays the values of the target Array. + Console::WriteLine( "The target Array contains the following (before and after copying):" ); + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source SortedList to the target SortedList, starting at index 6. + mySourceList->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); +} + +void PrintValues( array^ myArr, Char mySeparator ) +{ + for ( int i = 0; i < myArr->Length; i++ ) + Console::Write( "{0}{1}", mySeparator, myArr[ i ].Value ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +The target Array contains the following (before and after copying): + The quick brown fox jumps over the lazy dog + The quick brown fox jumps over three napping cats in the barn + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp new file mode 100644 index 00000000000..987dd455be0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.GetByIndex Example/CPP/source.cpp @@ -0,0 +1,54 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( 1.3, "fox" ); + mySL->Add( 1.4, "jumps" ); + mySL->Add( 1.5, "over" ); + mySL->Add( 1.2, "brown" ); + mySL->Add( 1.1, "quick" ); + mySL->Add( 1.0, "The" ); + mySL->Add( 1.6, "the" ); + mySL->Add( 1.8, "dog" ); + mySL->Add( 1.7, "lazy" ); + + // Gets the key and the value based on the index. + int myIndex = 3; + Console::WriteLine( "The key at index {0} is {1}.", myIndex, mySL->GetKey( myIndex ) ); + Console::WriteLine( "The value at index {0} is {1}.", myIndex, mySL->GetByIndex( myIndex ) ); + + // Gets the list of keys and the list of values. + IList^ myKeyList = mySL->GetKeyList(); + IList^ myValueList = mySL->GetValueList(); + + // Prints the keys in the first column and the values in the second column. + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < mySL->Count; i++ ) + Console::WriteLine( "\t{0}\t{1}", myKeyList[ i ], myValueList[ i ] ); +} + +/* +This code produces the following output. + +The key at index 3 is 1.3. +The value at index 3 is fox. + -KEY- -VALUE- + 1 The + 1.1 quick + 1.2 brown + 1.3 fox + 1.4 jumps + 1.5 over + 1.6 the + 1.7 lazy + 1.8 dog +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp new file mode 100644 index 00000000000..e9197a41dd1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IndexOfKey Example/CPP/source.cpp @@ -0,0 +1,57 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void PrintIndexAndKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i, myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( 1, "one" ); + mySL->Add( 3, "three" ); + mySL->Add( 2, "two" ); + mySL->Add( 4, "four" ); + mySL->Add( 0, "zero" ); + + // Displays the values of the SortedList. + Console::WriteLine( "The SortedList contains the following values:" ); + PrintIndexAndKeysAndValues( mySL ); + + // Searches for a specific key. + int myKey = 2; + Console::WriteLine( "The key \"{0}\" is at index {1}.", myKey, mySL->IndexOfKey( myKey ) ); + + // Searches for a specific value. + String^ myValue = "three"; + Console::WriteLine( "The value \"{0}\" is at index {1}.", myValue, mySL->IndexOfValue( myValue ) ); +} + +/* +This code produces the following output. + +The SortedList contains the following values: + -INDEX- -KEY- -VALUE- + [0]: 0 zero + [1]: 1 one + [2]: 2 two + [3]: 3 three + [4]: 4 four + +The key "2" is at index 2. +The value "three" is at index 3. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp new file mode 100644 index 00000000000..3808b907c27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( 2, "two" ); + mySL->Add( 3, "three" ); + mySL->Add( 1, "one" ); + mySL->Add( (int^)0, "zero" ); + mySL->Add( 4, "four" ); + + // Creates a synchronized wrapper around the SortedList. + SortedList^ mySyncdSL = SortedList::Synchronized( mySL ); + + // Displays the sychronization status of both SortedLists. + Console::WriteLine( "mySL is {0}.", mySL->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); + Console::WriteLine( "mySyncdSL is {0}.", mySyncdSL->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); +} + +/* +This code produces the following output. + +mySL is not synchronized. +mySyncdSL is synchronized. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp new file mode 100644 index 00000000000..fb191eafec5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.IsSynchronized Example/CPP/source2.cpp @@ -0,0 +1,35 @@ +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class SamplesSortedList +{ +public: + static void Main() + { + // + SortedList^ myCollection = gcnew SortedList(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesSortedList::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp new file mode 100644 index 00000000000..86e30997f0a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.RemoveAt Example/CPP/source.cpp @@ -0,0 +1,89 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void PrintKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t{0}:\t{1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( "3c", "dog" ); + mySL->Add( "2c", "over" ); + mySL->Add( "1c", "brown" ); + mySL->Add( "1a", "The" ); + mySL->Add( "1b", "quick" ); + mySL->Add( "3a", "the" ); + mySL->Add( "3b", "lazy" ); + mySL->Add( "2a", "fox" ); + mySL->Add( "2b", "jumps" ); + + // Displays the SortedList. + Console::WriteLine( "The SortedList initially contains the following:" ); + PrintKeysAndValues( mySL ); + + // Removes the element with the key "3b". + mySL->Remove( "3b" ); + + // Displays the current state of the SortedList. + Console::WriteLine( "After removing \"lazy\":" ); + PrintKeysAndValues( mySL ); + + // Removes the element at index 5. + mySL->RemoveAt( 5 ); + + // Displays the current state of the SortedList. + Console::WriteLine( "After removing the element at index 5:" ); + PrintKeysAndValues( mySL ); +} + +/* +This code produces the following output. + +The SortedList initially contains the following: + -KEY- -VALUE- + 1a: The + 1b: quick + 1c: brown + 2a: fox + 2b: jumps + 2c: over + 3a: the + 3b: lazy + 3c: dog + +After removing "lazy": + -KEY- -VALUE- + 1a: The + 1b: quick + 1c: brown + 2a: fox + 2b: jumps + 2c: over + 3a: the + 3c: dog + +After removing the element at index 5: + -KEY- -VALUE- + 1a: The + 1b: quick + 1c: brown + 2a: fox + 2b: jumps + 3a: the + 3c: dog +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp new file mode 100644 index 00000000000..71da886cdc1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic SortedList.SetByIndex Example/CPP/source.cpp @@ -0,0 +1,62 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +void PrintIndexAndKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( "\t-INDEX-\t-KEY-\t-VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( "\t[{0}]:\t{1}\t{2}", i, myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new SortedList. + SortedList^ mySL = gcnew SortedList; + mySL->Add( 2, "two" ); + mySL->Add( 3, "three" ); + mySL->Add( 1, "one" ); + mySL->Add( 0, "zero" ); + mySL->Add( 4, "four" ); + + // Displays the values of the SortedList. + Console::WriteLine( "The SortedList contains the following values:" ); + PrintIndexAndKeysAndValues( mySL ); + + // Replaces the values at index 3 and index 4. + mySL->SetByIndex( 3, "III" ); + mySL->SetByIndex( 4, "IV" ); + + // Displays the updated values of the SortedList. + Console::WriteLine( "After replacing the value at index 3 and index 4," ); + PrintIndexAndKeysAndValues( mySL ); +} + +/* +This code produces the following output. + +The SortedList contains the following values: + -INDEX- -KEY- -VALUE- + [0]: 0 zero + [1]: 1 one + [2]: 2 two + [3]: 3 three + [4]: 4 four + +After replacing the value at index 3 and index 4, + -INDEX- -KEY- -VALUE- + [0]: 0 zero + [1]: 1 one + [2]: 2 two + [3]: 3 III + [4]: 4 IV +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp new file mode 100644 index 00000000000..fd38bcf4520 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack Example/CPP/source.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myCollection ); +int main() +{ + + // Creates and initializes a new Stack. + Stack^ myStack = gcnew Stack; + myStack->Push( "Hello" ); + myStack->Push( "World" ); + myStack->Push( "!" ); + + // Displays the properties and values of the Stack. + Console::WriteLine( "myStack" ); + Console::WriteLine( "\tCount: {0}", myStack->Count ); + Console::Write( "\tValues:" ); + PrintValues( myStack ); +} + +void PrintValues( IEnumerable^ myCollection ) +{ + IEnumerator^ myEnum = myCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + myStack + Count: 3 + Values: ! World Hello + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..a60b6d00fde --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Clear Example/CPP/source.cpp @@ -0,0 +1,55 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myCollection ); +int main() +{ + + // Creates and initializes a new Stack. + Stack^ myStack = gcnew Stack; + myStack->Push( "The" ); + myStack->Push( "quick" ); + myStack->Push( "brown" ); + myStack->Push( "fox" ); + myStack->Push( "jumps" ); + + // Displays the count and values of the Stack. + Console::WriteLine( "Initially," ); + Console::WriteLine( " Count : {0}", myStack->Count ); + Console::Write( " Values:" ); + PrintValues( myStack ); + + // Clears the Stack. + myStack->Clear(); + + // Displays the count and values of the Stack. + Console::WriteLine( "After Clear," ); + Console::WriteLine( " Count : {0}", myStack->Count ); + Console::Write( " Values:" ); + PrintValues( myStack ); +} + +void PrintValues( IEnumerable^ myCollection ) +{ + IEnumerator^ myEnum = myCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Initially, + Count : 5 + Values: jumps fox brown quick The + After Clear, + Count : 0 + Values: + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..ae4b0f72df0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.CopyTo Example/CPP/source.cpp @@ -0,0 +1,68 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( Array^ myArr, char mySeparator ); +int main() +{ + // Creates and initializes the source Stack. + Stack^ mySourceQ = gcnew Stack; + mySourceQ->Push( "barn" ); + mySourceQ->Push( "the" ); + mySourceQ->Push( "in" ); + mySourceQ->Push( "cats" ); + mySourceQ->Push( "napping" ); + mySourceQ->Push( "three" ); + + // Creates and initializes the one-dimensional target Array. + Array^ myTargetArray = Array::CreateInstance( String::typeid, 15 ); + myTargetArray->SetValue( "The", 0 ); + myTargetArray->SetValue( "quick", 1 ); + myTargetArray->SetValue( "brown", 2 ); + myTargetArray->SetValue( "fox", 3 ); + myTargetArray->SetValue( "jumps", 4 ); + myTargetArray->SetValue( "over", 5 ); + myTargetArray->SetValue( "the", 6 ); + myTargetArray->SetValue( "lazy", 7 ); + myTargetArray->SetValue( "dog", 8 ); + + // Displays the values of the target Array. + Console::WriteLine( "The target Array contains the following (before and after copying):" ); + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source Stack to the target Array, starting at index 6. + mySourceQ->CopyTo( myTargetArray, 6 ); + + // Displays the values of the target Array. + PrintValues( myTargetArray, ' ' ); + + // Copies the entire source Stack to a new standard array. + array^myStandardArray = mySourceQ->ToArray(); + + // Displays the values of the new standard array. + Console::WriteLine( "The new standard array contains the following:" ); + PrintValues( myStandardArray, ' ' ); +} + +void PrintValues( Array^ myArr, char mySeparator ) +{ + IEnumerator^ myEnum = myArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ myObj = safe_cast(myEnum->Current); + Console::Write( "{0}{1}", mySeparator, myObj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + The target Array contains the following (before and after copying): + The quick brown fox jumps over the lazy dog + The quick brown fox jumps over three napping cats in the barn + The new standard array contains the following: + three napping cats in the barn + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp new file mode 100644 index 00000000000..7b964e928e6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +int main() +{ + + // Creates and initializes a new Stack. + Stack^ myStack = gcnew Stack; + myStack->Push( "The" ); + myStack->Push( "quick" ); + myStack->Push( "brown" ); + myStack->Push( "fox" ); + + // Creates a synchronized wrapper around the Stack. + Stack^ mySyncdStack = Stack::Synchronized( myStack ); + + // Displays the sychronization status of both Stacks. + Console::WriteLine( "myStack is {0}.", myStack->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); + Console::WriteLine( "mySyncdStack is {0}.", mySyncdStack->IsSynchronized ? (String^)"synchronized" : "not synchronized" ); +} + +/* +This code produces the following output. + +myStack is not synchronized. +mySyncdStack is synchronized. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp new file mode 100644 index 00000000000..d44a2d7b9a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.IsSynchronized Example/CPP/source2.cpp @@ -0,0 +1,35 @@ +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class SamplesStack +{ +public: + static void Main() + { + // + Stack^ myCollection = gcnew Stack(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesStack::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp new file mode 100644 index 00000000000..1e77a8f04a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stack.Peek Example/CPP/source.cpp @@ -0,0 +1,65 @@ + +// +using namespace System; +using namespace System::Collections; +void PrintValues( IEnumerable^ myCollection, char mySeparator ); +int main() +{ + + // Creates and initializes a new Stack. + Stack^ myStack = gcnew Stack; + myStack->Push( "The" ); + myStack->Push( "quick" ); + myStack->Push( "brown" ); + myStack->Push( "fox" ); + + // Displays the Stack. + Console::Write( "Stack values:" ); + PrintValues( myStack, '\t' ); + + // Removes an element from the Stack. + Console::WriteLine( "(Pop)\t\t{0}", myStack->Pop() ); + + // Displays the Stack. + Console::Write( "Stack values:" ); + PrintValues( myStack, '\t' ); + + // Removes another element from the Stack. + Console::WriteLine( "(Pop)\t\t{0}", myStack->Pop() ); + + // Displays the Stack. + Console::Write( "Stack values:" ); + PrintValues( myStack, '\t' ); + + // Views the first element in the Stack but does not remove it. + Console::WriteLine( "(Peek)\t\t{0}", myStack->Peek() ); + + // Displays the Stack. + Console::Write( "Stack values:" ); + PrintValues( myStack, '\t' ); +} + +void PrintValues( IEnumerable^ myCollection, char mySeparator ) +{ + IEnumerator^ myEnum = myCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::Write( "{0}{1}", mySeparator, obj ); + } + + Console::WriteLine(); +} + +/* + This code produces the following output. + + Stack values: fox brown quick The + (Pop) fox + Stack values: brown quick The + (Pop) brown + Stack values: quick The + (Peek) quick + Stack values: quick The + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp new file mode 100644 index 00000000000..63fd237a4c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.CanWrite Example/CPP/source.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + FileStream^ fs = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate,FileAccess::Write ); + if ( fs->CanRead && fs->CanWrite ) + { + Console::WriteLine( "MyFile.txt can be both written to and read from." ); + } + else + if ( fs->CanWrite ) + { + Console::WriteLine( "MyFile.txt is writable." ); + } +} + +//This code outputs "MyFile.txt is writable." +//To get the output message "MyFile.txt can be both written to and read from.", +//change the FileAccess parameter to ReadWrite in the FileStream constructor. +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp new file mode 100644 index 00000000000..e644fe2a10f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Stream.Read Example/CPP/source.cpp @@ -0,0 +1,44 @@ +// +using namespace System; +using namespace System::IO; + +public ref class Block +{ +public: + static void Main() + { + Stream^ s = gcnew MemoryStream(); + for (int i = 0; i < 100; i++) + { + s->WriteByte((Byte)i); + } + s->Position = 0; + + // Now read s into a byte buffer. + array^ bytes = gcnew array(s->Length); + int numBytesToRead = (int) s->Length; + int numBytesRead = 0; + while (numBytesToRead > 0) + { + // Read may return anything from 0 to 10. + int n = s->Read(bytes, numBytesRead, 10); + // The end of the file is reached. + if (n == 0) + { + break; + } + numBytesRead += n; + numBytesToRead -= n; + } + s->Close(); + // numBytesToRead should be 0 now, and numBytesRead should + // equal 100. + Console::WriteLine("number of bytes read: {0:d}", numBytesRead); + } +}; + +int main() +{ + Block::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp new file mode 100644 index 00000000000..035727fe0c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic StreamWriter.Write2 Example/CPP/source.cpp @@ -0,0 +1,13 @@ +// +using namespace System; +using namespace System::IO; + +int main() +{ + FileStream^ sb = gcnew FileStream( "MyFile.txt",FileMode::OpenOrCreate ); + array^b = {'a','b','c','d','e','f','g','h','i','j','k','l','m'}; + StreamWriter^ sw = gcnew StreamWriter( sb ); + sw->Write( b, 3, 8 ); + sw->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp new file mode 100644 index 00000000000..7c44cb174ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft Example/CPP/source.cpp @@ -0,0 +1,16 @@ +#using + +using namespace System; + +ref class Sample +{ +private: + void Method() + { + // + String^ str = "BBQ and Slaw"; + Console::WriteLine( str->PadLeft( 15 ) ); // Displays " BBQ and Slaw". + Console::WriteLine( str->PadLeft( 5 ) ); // Displays "BBQ and Slaw". + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp new file mode 100644 index 00000000000..4f65f5fcc67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadLeft1 Example/CPP/source.cpp @@ -0,0 +1,15 @@ +#using + +// +using namespace System; + +void main() +{ + String^ str = "forty-two"; + Console::WriteLine( str->PadLeft( 15, L'.' ) ); + Console::WriteLine( str->PadLeft( 2, L'.' ) ); +} +// The example displays the following output: +// ......forty-two +// forty-two +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp new file mode 100644 index 00000000000..d313d14119e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using + +using namespace System; +ref class Sample +{ +private: + void Method() + { + + // + String^ str = "BBQ and Slaw"; + Console::Write( "|" ); + Console::Write( str->PadRight( 15 ) ); + Console::WriteLine( "|" ); // Displays "|BBQ and Slaw |". + Console::Write( "|" ); + Console::Write( str->PadRight( 5 ) ); + Console::WriteLine( "|" ); // Displays "|BBQ and Slaw|". + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp new file mode 100644 index 00000000000..0786d97857d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic String.PadRight1 Example/CPP/source.cpp @@ -0,0 +1,19 @@ +#using + +using namespace System; +ref class Sample +{ +private: + void Method() + { + // + String^ str = "forty-two"; + Console::Write( "|" ); + Console::Write( str->PadRight( 15, '.' ) ); + Console::WriteLine( "|" ); // Displays "|forty-two......|". + Console::Write( "|" ); + Console::Write( str->PadRight( 5, '.' ) ); + Console::WriteLine( "|" ); // Displays "|forty-two|". + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp new file mode 100644 index 00000000000..cf774966a53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/remarks.cpp @@ -0,0 +1,30 @@ +#using + +using namespace System; +using namespace System::Diagnostics; + +public ref class SomeClass +{ +// +private: + static BooleanSwitch^ boolSwitch = gcnew BooleanSwitch("mySwitch", + "Switch in config file"); + +public: + static void Main( ) + { + //... + Console::WriteLine("Boolean switch {0} configured as {1}", + boolSwitch->DisplayName, ((Boolean^)boolSwitch->Enabled)->ToString()); + if (boolSwitch->Enabled) + { + //... + } + } +// +}; + +int main() +{ + SomeClass::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp new file mode 100644 index 00000000000..35f255928a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Switch Example/CPP/source.cpp @@ -0,0 +1,127 @@ +#using + +using namespace System; +using namespace System::Diagnostics; + +// +// The following are possible values for the new switch. +public enum class MethodTracingSwitchLevel +{ + Off = 0, + EnteringMethod = 1, + ExitingMethod = 2, + Both = 3 +}; + + +// +// +public ref class MyMethodTracingSwitch: public Switch +{ +protected: + bool outExit; + bool outEnter; + MethodTracingSwitchLevel level; + +public: + MyMethodTracingSwitch( String^ displayName, String^ description ) + : Switch( displayName, description ) + {} + + property MethodTracingSwitchLevel Level + { + MethodTracingSwitchLevel get() + { + return level; + } + + void set( MethodTracingSwitchLevel value ) + { + SetSwitchSetting( (int)value ); + } + } + +protected: + void SetSwitchSetting( int value ) + { + if ( value < 0 ) + { + value = 0; + } + + if ( value > 3 ) + { + value = 3; + } + + level = (MethodTracingSwitchLevel)value; + outEnter = false; + if ((value == (int)MethodTracingSwitchLevel::EnteringMethod) || + (value == (int)MethodTracingSwitchLevel::Both)) + { + outEnter = true; + } + + outExit = false; + if ((value == (int)MethodTracingSwitchLevel::ExitingMethod) || + (value == (int)MethodTracingSwitchLevel::Both)) + { + outExit = true; + } + } + +public: + property bool OutputExit + { + bool get() + { + return outExit; + } + } + + property bool OutputEnter + { + bool get() + { + return outEnter; + } + } +}; + + +// +// +public ref class Class1 +{ +private: + + /* Create an instance of MyMethodTracingSwitch.*/ + static MyMethodTracingSwitch^ mySwitch = + gcnew MyMethodTracingSwitch( "Methods","Trace entering and exiting method" ); + +public: + static void main() + { + // Add the console listener to see trace messages as console output + Trace::Listeners->Add(gcnew ConsoleTraceListener(true)); + Debug::AutoFlush = true; + + // Set the switch level to both enter and exit + mySwitch->Level = MethodTracingSwitchLevel::Both; + + // Write a diagnostic message if the switch is set to entering. + Debug::WriteLineIf(mySwitch->OutputEnter, "Entering Main"); + + // Insert code to handle processing here... + + // Write another diagnostic message if the switch is set to exiting. + Debug::WriteLineIf(mySwitch->OutputExit, "Exiting Main"); + } +}; +// + +int main() +{ + Class1::main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp new file mode 100644 index 00000000000..830c7d9c618 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +// +void main() +{ + #if defined(TRACE) + // Create a file for output named TestFile.txt. + Stream^ myFile = File::Create( "TestFile.txt" ); + + // Create a new text writer using the output stream and + // add it to the trace listeners. + TextWriterTraceListener^ myTextListener = + gcnew TextWriterTraceListener( myFile ); + Trace::Listeners->Add( myTextListener ); + + // Write output to the file. + Trace::Write( "Test output " ); + + // Flush the output. + Trace::Flush(); + Trace::Close(); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp new file mode 100644 index 00000000000..e338a01270a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Close Example/CPP/source.cpp @@ -0,0 +1,35 @@ +// +#using +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +void main() +{ + #if defined(TRACE) + TextWriterTraceListener^ myTextListener = nullptr; + + // Create a file for output named TestFile.txt. + String^ myFileName = "TestFile.txt"; + StreamWriter^ myOutputWriter = gcnew StreamWriter( myFileName,true ); + + // Add a TextWriterTraceListener for the file. + if ( myOutputWriter ) + { + myTextListener = gcnew TextWriterTraceListener( myOutputWriter ); + Trace::Listeners->Add( myTextListener ); + } + + // Write trace output to all trace listeners. + Trace::WriteLine( + String::Concat( DateTime::Now.ToString(), " - Trace output" ) ); + if ( myTextListener ) + { + // Remove and close the file writer/trace listener. + myTextListener->Flush(); + Trace::Listeners->Remove( myTextListener ); + myTextListener->Close(); + } + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp new file mode 100644 index 00000000000..a8af3ae4585 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Write Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +// +void main() +{ + #if defined(TRACE) + // Create a text writer that writes to the console screen and add + // it to the trace listeners. + TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; + myWriter->Writer = System::Console::Out; + Trace::Listeners->Add( myWriter ); + + // Write the output to the console screen. + myWriter->Write( "Write to console screen. " ); + myWriter->WriteLine( "Again, write to the Console screen." ); + + // Flush and close the output. + myWriter->Flush(); + myWriter->Close(); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp new file mode 100644 index 00000000000..17598cbac6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.WriteLine Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +// +void main() +{ + #if defined(TRACE) + // Create a text writer that writes to the console screen and add + // it to the trace listeners. + TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; + myWriter->Writer = System::Console::Out; + Trace::Listeners->Add( myWriter ); + + // Write the output to the console screen. + myWriter->Write( "Write to the Console screen. " ); + myWriter->WriteLine( "Again, write to console screen." ); + + // Flush and close the output. + myWriter->Flush(); + myWriter->Close(); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp new file mode 100644 index 00000000000..aed5e7442ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TextWriterTraceListener.Writer Example/CPP/source.cpp @@ -0,0 +1,18 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Sample +{ +protected: + void Method() + { + // + #if defined(TRACE) + TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; + myWriter->Writer = System::Console::Out; + Trace::Listeners->Add( myWriter ); + #endif + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp new file mode 100644 index 00000000000..df797ae34f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer Example/CPP/source.cpp @@ -0,0 +1,73 @@ +// +// Use this code inside a project created with the Visual C++ > CLR > CLR Console Application template. +// Replace the code in the default .cpp file with this code. + +#include "stdafx.h" +#using + +using namespace System; + +// To avoid confusion with other Timer classes, this sample always uses the fully-qualified +// name of System::Timers::Timer instead of a using statement for System::Timer. + +public ref class Example +{ +private: + static System::Timers::Timer^ aTimer; + +public: + static void Demo() + { + // Normally, the timer is declared at the class level, so that it stays in scope as long as it + // is needed. If the timer is declared in a long-running method, KeepAlive must be used to prevent + // the JIT compiler from allowing aggressive garbage collection to occur before the method ends. + // You can experiment with this by commenting out the class-level declaration and uncommenting + // the declaration below; then uncomment the GC.KeepAlive(aTimer) at the end of the method. + //System::Timers::Timer^ aTimer; + + // Create a timer and set a two second interval. + aTimer = gcnew System::Timers::Timer(); + aTimer->Interval = 2000; + + // Alternate method: create a Timer with an interval argument to the constructor. + //aTimer = gcnew System::Timers::Timer(2000); + + // Hook up the Elapsed event for the timer. + aTimer->Elapsed += gcnew System::Timers::ElapsedEventHandler(Example::OnTimedEvent); + + // Have the timer fire repeated events (true is the default) + aTimer->AutoReset = true; + + // Start the timer + aTimer->Enabled = true; + + Console::WriteLine("Press the Enter key to exit the program at any time... "); + Console::ReadLine(); + + // If the timer is declared in a long-running method, use KeepAlive to prevent garbage collection + // from occurring before the method ends. + //GC::KeepAlive(aTimer); + } + +private: + static void OnTimedEvent(Object^ source, System::Timers::ElapsedEventArgs^ e) + { + Console::WriteLine("The Elapsed event was raised at {0}", e->SignalTime); + } + +}; + +int main() +{ + Example::Demo(); +} + +// This example displays output like the following: +// Press the Enter key to exit the program at any time... +// The Elapsed event was raised at 5/20/2015 8:48:58 PM +// The Elapsed event was raised at 5/20/2015 8:49:00 PM +// The Elapsed event was raised at 5/20/2015 8:49:02 PM +// The Elapsed event was raised at 5/20/2015 8:49:04 PM +// The Elapsed event was raised at 5/20/2015 8:49:06 PM + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp new file mode 100644 index 00000000000..6f843e8ba21 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Timer.Timer1 Example/CPP/source.cpp @@ -0,0 +1,53 @@ +// +#using + +using namespace System; +using namespace System::Timers; + +public ref class Timer2 +{ +private: + static System::Timers::Timer^ aTimer; + +public: + static void Main() + { + // Create a new Timer with Interval set to 1.5 seconds. + double interval = 1500.0; + aTimer = gcnew System::Timers::Timer(interval); + + // Hook up the event handler for the Elapsed event. + aTimer->Elapsed += gcnew ElapsedEventHandler( OnTimedEvent ); + + // Only raise the event the first time Interval elapses. + aTimer->AutoReset = false; + aTimer->Enabled = true; + + // Ensure the event fires before the exit message appears. + System::Threading::Thread::Sleep((int) interval * 2); + Console::WriteLine("Press the Enter key to exit the program."); + Console::ReadLine(); + + // If the timer is declared in a long-running method, use + // KeepAlive to prevent garbage collection from occurring + // before the method ends. + //GC::KeepAlive(aTimer); + } + +private: + // Handle the Elapsed event. + static void OnTimedEvent( Object^ /*source*/, ElapsedEventArgs^ /*e*/ ) + { + Console::WriteLine( "Hello World!" ); + } + +}; + +int main() +{ + Timer2::Main(); +} +// The example displays the following output: +// Hello World! +// Press the Enter key to exit the program. +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp new file mode 100644 index 00000000000..bfaeea7c89b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace Example/CPP/source.cpp @@ -0,0 +1,23 @@ +// +// Specify /DTRACE when compiling. + +#using +using namespace System; +using namespace System::Diagnostics; + +int main() +{ + #if defined(TRACE) + Trace::Listeners->Add( gcnew TextWriterTraceListener( Console::Out ) ); + Trace::AutoFlush = true; + Trace::Indent(); + Trace::WriteLine( "Entering Main" ); + #endif + Console::WriteLine( "Hello World." ); + #if defined(TRACE) + Trace::WriteLine( "Exiting Main" ); + Trace::Unindent(); + #endif + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp new file mode 100644 index 00000000000..bf1accda6fd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +protected: + // Create an index for an array. + int index; + + void Method() + { + // Perform some action that sets the index. + // Test that the index value is valid. + #if defined(TRACE) + Trace::Assert( index > -1 ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp new file mode 100644 index 00000000000..b8c99bf228b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert1 Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + static void MyMethod( Type^ type, Type^ baseType ) + { + #if defined(TRACE) + Trace::Assert( type != nullptr, "Type parameter is null" ); + #endif + + // Perform some processing. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp new file mode 100644 index 00000000000..862da8804df --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Assert2 Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + static void MyMethod( Type^ type, Type^ baseType ) + { + #if defined(TRACE) + Trace::Assert( type != nullptr, "Type parameter is null", "Can't get object for null type" ); + #endif + + // Perform some processing. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp new file mode 100644 index 00000000000..7f8c353e0c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail Example/CPP/source.cpp @@ -0,0 +1,56 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + enum class Option + { + First, Second + }; + +protected: + double result; + +public: + void Method( Option option ) + { + try + { + // try something here + } + // + catch ( Exception^ ) + { + #if defined(TRACE) + Trace::Fail( "Unknown Option " + option + ", using the default." ); + #endif + } + // + + // + switch ( option ) + { + case Option::First: + result = 1.0; + break; + + // Insert additional cases. + + default: + #if defined(TRACE) + Trace::Fail(String::Format("Unknown Option {0}", option)); + #endif + result = 1.0; + break; + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp new file mode 100644 index 00000000000..377a4428493 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Fail1 Example/CPP/source.cpp @@ -0,0 +1,68 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + enum class Option + { + First, Second + }; + +protected: + double result; + +public: + void Method( Option option, String^ userInput ) + { + int value = 0; + int newValue = 1; + try + { + value = Int32::Parse( userInput ); + } + // + catch ( Exception^ ) + { + #if defined(TRACE) + Trace::Fail( String::Format( "Invalid value: {0}", value ), + "Resetting value to newValue." ); + #endif + value = newValue; + } + // + + // + switch ( option ) + { + case Option::First: + result = 1.0; + break; + + // Insert additional cases. + + default: + #if defined(TRACE) + Trace::Fail( String::Format( "Unsupported option {0}", option ), + "Result set to 1.0" ); + #endif + result = 1.0; + break; + } + // + } + +}; + +void main() +{ + Form1^ myForm = gcnew Form1; + myForm->Method( Form1::Option::Second, "not an integer string" ); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp new file mode 100644 index 00000000000..00e2126d795 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Flush Example/CPP/source.cpp @@ -0,0 +1,30 @@ +// +// Specify /DTRACE when compiling. + +#using +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + +void main() +{ + #if defined(TRACE) + // Create a file for output named TestFile.txt. + FileStream^ myFileStream = + gcnew FileStream( "TestFile.txt", FileMode::Append ); + + // Create a new text writer using the output stream + // and add it to the trace listeners. + TextWriterTraceListener^ myTextListener = + gcnew TextWriterTraceListener( myFileStream ); + Trace::Listeners->Add( myTextListener ); + + // Write output to the file. + Trace::WriteLine( "Test output" ); + + // Flush and close the output stream. + Trace::Flush(); + Trace::Close(); + #endif +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp new file mode 100644 index 00000000000..8465839ad87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.IndentLevel Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + // + Trace::WriteLine( "List of errors:" ); + Trace::Indent(); + Trace::WriteLine( "Error 1: File not found" ); + Trace::WriteLine( "Error 2: Directory not found" ); + Trace::Unindent(); + Trace::WriteLine( "End of list of errors" ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp new file mode 100644 index 00000000000..aaba2c756c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Listeners Example/CPP/source.cpp @@ -0,0 +1,18 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Class1 +{ +public: + void Method() + { + // + // Create a ConsoletTraceListener and add it to the trace listeners. + #if defined(TRACE) + ConsoleTraceListener^ myWriter = gcnew ConsoleTraceListener( ); + Trace::Listeners->Add( myWriter ); + #endif + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp new file mode 100644 index 00000000000..b5c173d444f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod() + { + // Write the message if the TraceSwitch level is set + // to Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::Write( "My error message. " ); + } + + // Write a second message if the TraceSwitch level is set + // to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::WriteLine( "My second error message." ); + } + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp new file mode 100644 index 00000000000..6aa428982f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write1 Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level + // is set to Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::Write( myObject ); + } + + // Write a second message if the TraceSwitch level + // is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::WriteLine( " is not a valid value for this method." ); + } + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp new file mode 100644 index 00000000000..c37eb6cb2bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write2 Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::Write( String::Concat( myObject, + " is not a valid object for category: " ), category ); + } + + // Write a second message if the TraceSwitch level is set to + // Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::WriteLine( " Please use a different category." ); + } + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp new file mode 100644 index 00000000000..815cd36e34c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.Write3 Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::Write( myObject, category ); + } + + // Write a second message if the TraceSwitch level is set to + // Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::WriteLine( " Object is not valid for this category." ); + } + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp new file mode 100644 index 00000000000..49f4eaff259 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod() + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set to + // Error or higher. + Trace::WriteIf( generalSwitch->TraceError, "My error message. " ); + + // Write a second message if the TraceSwitch level is set + // to Verbose. + Trace::WriteLineIf( generalSwitch->TraceVerbose, + "My second error message." ); + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp new file mode 100644 index 00000000000..14dfd2e3487 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf1 Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set + // to Error or higher. + Trace::WriteIf( generalSwitch->TraceError, myObject ); + + // Write a second message if the TraceSwitch level is set + // to Verbose. + Trace::WriteLineIf( generalSwitch->TraceVerbose, + " is not a valid value for this method." ); + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp new file mode 100644 index 00000000000..fa99d333ccc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf2 Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set to Verbose. + Trace::WriteIf( generalSwitch->TraceVerbose, + String::Concat( myObject, + " is not a valid object for category: " ), category ); + + // Write a second message if the TraceSwitch level is set + // to Error or higher. + Trace::WriteLineIf( generalSwitch->TraceError, + " Please use a different category." ); + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp new file mode 100644 index 00000000000..7b433a3415c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteIf3 Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set to Verbose. + Trace::WriteIf( generalSwitch->TraceVerbose, myObject, category ); + + // Write a second message if the TraceSwitch level is set to + // Error or higher. + Trace::WriteLineIf( generalSwitch->TraceError, + " Object is not valid for this category." ); + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp new file mode 100644 index 00000000000..69e7837f9bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine1 Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level + // is set to Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::Write( "Invalid object. " ); + } + + // Write a second message if the TraceSwitch level + // is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::WriteLine( myObject ); + } + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp new file mode 100644 index 00000000000..408ce11e5e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine2 Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level + // is set to Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::Write( "My error message. " ); + } + + // Write a second message if the TraceSwitch level + // is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::WriteLine( "My second error message.", category ); + } + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp new file mode 100644 index 00000000000..9b663621991 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLine3 Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level + // is set to Error or higher. + if ( generalSwitch->TraceError ) + { + Trace::Write( "Invalid object for category. " ); + } + + // Write a second message if the TraceSwitch level + // is set to Verbose. + if ( generalSwitch->TraceVerbose ) + { + Trace::WriteLine( myObject, category ); + } + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp new file mode 100644 index 00000000000..e0248f58cc3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf1 Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level + // is set to Error or higher. + Trace::WriteIf( generalSwitch->TraceError, "Invalid object. " ); + + // Write a second message if the TraceSwitch level is set + // to Verbose. + Trace::WriteLineIf( generalSwitch->TraceVerbose, myObject ); + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp new file mode 100644 index 00000000000..f0ced96de43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf2 Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set + // to Error or higher. + Trace::WriteIf( generalSwitch->TraceError, "My error message. " ); + + // Write a second message if the TraceSwitch level is set + // to Verbose. + Trace::WriteLineIf( generalSwitch->TraceVerbose, + "My second error message.", category ); + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp new file mode 100644 index 00000000000..3b1d19efcba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Trace.WriteLineIf3 Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +using namespace System; +using namespace System::Diagnostics; + +public ref class Test +{ +// +// Class-level declaration. +// Create a TraceSwitch. +private: + static TraceSwitch^ generalSwitch = + gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyErrorMethod( Object^ myObject, String^ category ) + { + #if defined(TRACE) + // Write the message if the TraceSwitch level is set + // to Error or higher. + Trace::WriteIf( generalSwitch->TraceError, + "Invalid object for category. " ); + + // Write a second message if the TraceSwitch level is set + // to Verbose. + Trace::WriteLineIf( generalSwitch->TraceVerbose, + myObject, category ); + #endif + } +// +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..0839abd6837 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceListenerCollection.Add Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + // + /* Create a listener, which outputs to the console screen, and + * add it to the trace listeners. */ + TextWriterTraceListener^ myWriter = gcnew TextWriterTraceListener; + myWriter->Writer = System::Console::Out; + Trace::Listeners->Add( myWriter ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp new file mode 100644 index 00000000000..f2af2f1ef67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.Level Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // + // Class-level declaration. + /* Create a TraceSwitch to use in the entire application.*/ +private: + static TraceSwitch^ mySwitch = gcnew TraceSwitch( "mySwitch","Entire Application" ); + +public: + static void MyMethod() + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( mySwitch->TraceError ) + Console::WriteLine( "My error message." ); + + // Write the message if the TraceSwitch level is set to Verbose. + if ( mySwitch->TraceVerbose ) + Console::WriteLine( "My second error message." ); + } + + static void main() + { + // Run the method that prints error messages based on the switch level. + MyMethod(); + } + // +}; + +int main() +{ + Form1::main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp new file mode 100644 index 00000000000..1c6a7b5ea20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/remarks.cpp @@ -0,0 +1,33 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; + +public ref class TraceErr +{ +// +private: + static TraceSwitch^ appSwitch = gcnew TraceSwitch("mySwitch", + "Switch in config file"); + +public: + static void Main(array^ args) + { + //... + Console::WriteLine("Trace switch {0} configured as {1}", + appSwitch->DisplayName, appSwitch->Level.ToString()); + if (appSwitch->TraceError) + { + //... + } + } +// +}; + +int main() +{ + array^ args = gcnew array{}; + TraceErr::Main(args); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp new file mode 100644 index 00000000000..7806bc0fb37 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceError Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // + // Class-level declaration. + /* Create a TraceSwitch to use in the entire application.*/ +private: + static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyMethod() + { + // Write the message if the TraceSwitch level is set to Error or higher. + if ( mySwitch->TraceError ) + Console::WriteLine( "My error message." ); + + // Write the message if the TraceSwitch level is set to Verbose. + if ( mySwitch->TraceVerbose ) + Console::WriteLine( "My second error message." ); + } + + static void main() + { + // Run the method that prints error messages based on the switch level. + MyMethod(); + } + // +}; + +int main() +{ + Form1::main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp new file mode 100644 index 00000000000..b3d9962e4cc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceInfo Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // + // Class-level declaration. + /* Create a TraceSwitch to use in the entire application.*/ +private: + static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyMethod() + { + // Write the message if the TraceSwitch level is set to Info or higher. + if ( mySwitch->TraceInfo ) + Console::WriteLine( "My error message." ); + + // Write the message if the TraceSwitch level is set to Verbose. + if ( mySwitch->TraceVerbose ) + Console::WriteLine( "My second error message." ); + } + + static void main() + { + // Run the method that prints error messages based on the switch level. + MyMethod(); + } + // +}; + +int main() +{ + Form1::main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp new file mode 100644 index 00000000000..9135da63a48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TraceSwitch.TraceWarning Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // + // Class-level declaration. + /* Create a TraceSwitch to use in the entire application.*/ +private: + static TraceSwitch^ mySwitch = gcnew TraceSwitch( "General", "Entire Application" ); + +public: + static void MyMethod() + { + // Write the message if the TraceSwitch level is set to Warning or higher. + if ( mySwitch->TraceWarning ) + Console::WriteLine( "My error message." ); + + // Write the message if the TraceSwitch level is set to Verbose. + if ( mySwitch->TraceVerbose ) + Console::WriteLine( "My second error message." ); + } + + static void main() + { + // Run the method that prints error messages based on the switch level. + MyMethod(); + } + // +}; + +int main() +{ + Form1::main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..ade13e662f9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic TreeNode.BeginEdit Example/CPP/source.cpp @@ -0,0 +1,78 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TreeView^ treeView1; + TreeNode^ mySelectedNode; + + // + /* Get the tree node under the mouse pointer and + save it in the mySelectedNode variable. */ +private: + void treeView1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + mySelectedNode = treeView1->GetNodeAt( e->X, e->Y ); + } + + void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( mySelectedNode != nullptr && mySelectedNode->Parent != nullptr ) + { + treeView1->SelectedNode = mySelectedNode; + treeView1->LabelEdit = true; + if ( !mySelectedNode->IsEditing ) + { + mySelectedNode->BeginEdit(); + } + } + else + { + MessageBox::Show( String::Concat( "No tree node selected or selected node is a root node.\n", + "Editing of root nodes is not allowed." ), "Invalid selection" ); + } + } + + void treeView1_AfterLabelEdit( Object^ /*sender*/, + System::Windows::Forms::NodeLabelEditEventArgs^ e ) + { + if ( e->Label != nullptr ) + { + if ( e->Label->Length > 0 ) + { + array^ temp0 = {'@','.',',','!'}; + if ( e->Label->IndexOfAny( temp0 ) == -1 ) + { + + // Stop editing without canceling the label change. + e->Node->EndEdit( false ); + } + else + { + /* Cancel the label edit action, inform the user, and + place the node in edit mode again. */ + e->CancelEdit = true; + MessageBox::Show( String::Concat( "Invalid tree node label.\n", + "The invalid characters are: '@','.', ',', '!'" ), + "Node Label Edit" ); + e->Node->BeginEdit(); + } + } + else + { + /* Cancel the label edit action, inform the user, and + place the node in edit mode again. */ + e->CancelEdit = true; + MessageBox::Show( "Invalid tree node label.\nThe label cannot be blank", + "Node Label Edit" ); + e->Node->BeginEdit(); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp new file mode 100644 index 00000000000..16e8d85658e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.DeclaringType Example/CPP/source.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class dtype abstract +{ +public: + ref class MyClassA abstract + { + public: + virtual int m() = 0; + }; + + ref class MyClassB abstract: public MyClassA{}; +}; + +int main() +{ + Console::WriteLine( "The declaring type of m is {0}.", dtype::MyClassB::typeid->GetMethod( "m" )->DeclaringType ); +} +/* The example produces the following output: + +The declaring type of m is dtype+MyClassA. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp new file mode 100644 index 00000000000..ee3ada47aea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.EmptyTypes Example/CPP/source.cpp @@ -0,0 +1,17 @@ +using namespace System; +using namespace System::IO; +using namespace System::Reflection; + +public ref class Sample +{ +public: + void Method( Type^ type ) + { + ConstructorInfo^ cInfo; + + // + cInfo = type->GetConstructor( BindingFlags::ExactBinding, nullptr, + Type::EmptyTypes, nullptr ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp new file mode 100644 index 00000000000..eaae896f09f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.FilterName Example/CPP/source.cpp @@ -0,0 +1,26 @@ +using namespace System; +using namespace System::Reflection; + +// Class added so sample will compile +public ref class Application +{ +public: + void Method(){} +}; + +public ref class Sample +{ +public: + void Method() + { + // + // Get the set of methods associated with the type + array^ mi = Application::typeid->FindMembers( + (MemberTypes)(MemberTypes::Constructor | MemberTypes::Method), + (BindingFlags)(BindingFlags::Public | BindingFlags::Static | + BindingFlags::NonPublic | BindingFlags::Instance | BindingFlags::DeclaredOnly), + Type::FilterName, "*" ); + Console::WriteLine( "Number of methods (includes constructors): {0}", mi->Length ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp new file mode 100644 index 00000000000..4c9e6c12c06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source1.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class t +{ +public: + t(){} + + static t(){} + + t( int /*i*/ ){} + +}; + +int main() +{ + array^p = t::typeid->GetConstructors(); + Console::WriteLine( p->Length ); + for ( int i = 0; i < p->Length; i++ ) + { + Console::WriteLine( p[ i ]->IsStatic ); + + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp new file mode 100644 index 00000000000..881b9216d30 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.GetConstructors Example/CPP/source2.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Reflection; +public ref class t +{ +public: + t(){} + + t( int /*i*/ ){} + + static t(){} + +}; + +int main() +{ + array^p = t::typeid->GetConstructors( static_cast(BindingFlags::Public | BindingFlags::Static | BindingFlags::NonPublic | BindingFlags::Instance) ); + Console::WriteLine( p->Length ); + for ( int i = 0; i < p->Length; i++ ) + { + Console::WriteLine( p[ i ]->IsStatic ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp new file mode 100644 index 00000000000..f0af5fbd409 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsNotPublic Example/CPP/source.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Reflection; + +int main() +{ + //Get the Type and MemberInfo. + Type^ t = Type::GetType("System.IO.File"); + array^ members = t->GetMembers(); + + //Get and display the DeclaringType method. + Console::WriteLine("There are {0} members in {1}.", + members->Length, t->FullName ); + Console::WriteLine("Is {0} non-public? {1}", + t->FullName, t->IsNotPublic ); +} +// The example displays the following output: +// There are 60 members in System.IO.File. +// Is System.IO.File non-public? False +// + +// +public ref class A +{ +public: + ref class B{}; + + +private: + ref class C{}; + + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp new file mode 100644 index 00000000000..47d546e7a06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.IsSpecialName Example/CPP/source.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Reflection; +using namespace System::Text; +public ref class Sample +{ +protected: + bool ShowMethods; + StreamWriter^ myWriter; + +private: + void DumpMethods( Type^ aType ) + { + if ( !ShowMethods ) + return; + + array^mInfo = aType->GetMethods(); + myWriter->WriteLine( "Methods" ); + bool found = false; + if ( mInfo->Length != 0 ) + { + for ( int i = 0; i < mInfo->Length; i++ ) + { + + // Only display methods declared in this type. Also + // filter out any methods with special names, because these + // cannot be generally called by the user. That is, their + // functionality is usually exposed in other ways, for example, + // property get/set methods are exposed as properties. + if ( mInfo[ i ]->DeclaringType == aType && !mInfo[ i ]->IsSpecialName ) + { + found = true; + StringBuilder^ modifiers = gcnew StringBuilder; + if ( mInfo[ i ]->IsStatic ) + { + modifiers->Append( "static " ); + } + if ( mInfo[ i ]->IsPublic ) + { + modifiers->Append( "public " ); + } + if ( mInfo[ i ]->IsFamily ) + { + modifiers->Append( "protected " ); + } + if ( mInfo[ i ]->IsAssembly ) + { + modifiers->Append( "internal " ); + } + if ( mInfo[ i ]->IsPrivate ) + { + modifiers->Append( "private " ); + } + myWriter->WriteLine( "{0} {1}", modifiers, mInfo[ i ] ); + } + + } + } + + if ( !found ) + { + myWriter->WriteLine( "(none)" ); + } + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp new file mode 100644 index 00000000000..5f55897e971 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.MemberType Example/CPP/source.cpp @@ -0,0 +1,15 @@ +using namespace System; +using namespace System::Reflection; + +public ref class Sample +{ +public: + void Method( Type^ t, MemberInfo^ mi ) + { + // + array^ others = t->GetMember( mi->Name, mi->MemberType, + (BindingFlags)(BindingFlags::Public | BindingFlags::Static | + BindingFlags::NonPublic | BindingFlags::Instance) ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp new file mode 100644 index 00000000000..be2838788b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.Missing Example/cpp/source.cpp @@ -0,0 +1,64 @@ +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::CodeDom::Compiler; + +ref class Example +{ +public: + static void Main() + { + // VB source for example. Not all versions of CS and CPP compilers + // support optional arguments. + String^ codeLines = + "Imports System\n\n" + + "Public Class OptionalArg\n" + + " Public Sub MyMethod(ByVal a As Integer, _\n" + + " Optional ByVal b As Double = 1.2, _\n" + + " Optional ByVal c As Integer = 1)\n\n" + + " Console.WriteLine(\"a = \" & a & \" b = \" & b & \" c = \" & c)\n" + + " End Sub\n" + + "End Class\n"; + + // Generate a OptionalArg instance from the source above. + Object^ o = GenerateObjectFromSource("OptionalArg", codeLines, "VisualBasic"); + Type^ t; + + t = o->GetType(); + BindingFlags bf = BindingFlags::Public | BindingFlags::Instance | + BindingFlags::InvokeMethod | BindingFlags::OptionalParamBinding; + + t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, 55.3, 12}); + t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, 1.3, Type::Missing}); + t->InvokeMember("MyMethod", bf, nullptr, o, gcnew array {10, Type::Missing, Type::Missing}); + } + +private: + static Object^ GenerateObjectFromSource(String^ objectName, + String^ sourceLines, String^ providerName) + { + Object^ genObject = nullptr; + CodeDomProvider^ codeProvider = CodeDomProvider::CreateProvider(providerName); + CompilerParameters^ cp = gcnew CompilerParameters(); + + cp->GenerateExecutable = false; + cp->GenerateInMemory = true; + + CompilerResults^ results = + codeProvider->CompileAssemblyFromSource(cp, sourceLines); + if (results->Errors->Count == 0) + { + genObject = results->CompiledAssembly->CreateInstance(objectName); + } + + return genObject; + } +}; + +int main() +{ + Example::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp new file mode 100644 index 00000000000..e40dfeced46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic Type.ReflectedType Example/CPP/source.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Reflection; + +public ref class MyClassA abstract +{ +public: + ref class MyClassB abstract + { + + }; + +}; + +int main() +{ + Console::WriteLine( "Reflected type of MyClassB is {0}", MyClassA::MyClassB::typeid->ReflectedType ); + //Outputs MyClassA, the enclosing type. +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp new file mode 100644 index 00000000000..154b58c3fd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsImpersonationContext.Undo Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method( IntPtr userToken ) + { + // + WindowsImpersonationContext^ ImpersonationCtx = WindowsIdentity::Impersonate( userToken ); + + //Do something under the context of the impersonated user. + + ImpersonationCtx->Undo(); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp new file mode 100644 index 00000000000..6a7fa3ba07b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.Identity Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method() + { + // + WindowsPrincipal^ wp = gcnew WindowsPrincipal( WindowsIdentity::GetCurrent() ); + String^ username = wp->Identity->Name; + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp new file mode 100644 index 00000000000..58a56176dfb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_Classic/classic WindowsPrincipal.WindowsPrincipal Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method() + { + // + WindowsIdentity^ wi = WindowsIdentity::GetCurrent(); + WindowsPrincipal^ wp = gcnew WindowsPrincipal( wi ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp new file mode 100644 index 00000000000..5b668e808cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Convert UUEncodeDecode functions/CPP/class1.cpp @@ -0,0 +1,317 @@ +using namespace System; +using namespace System::IO; + +ref class Coder +{ +private: + String^ inputFileName; + String^ outputFileName; + +public: + Coder( String^ inFile, String^ outFile ) + { + inputFileName = (String^)(inFile->Clone()); + outputFileName = (String^)(outFile->Clone()); + } + + // +public: + void EncodeWithString() + { + FileStream^ inFile; + array^ binaryData; + + try + { + inFile = gcnew FileStream( inputFileName, + FileMode::Open, + FileAccess::Read ); + binaryData = gcnew array((int)(inFile->Length)); + long bytesRead = inFile->Read( binaryData, 0, + (int)inFile->Length ); + inFile->Close(); + } + catch ( Exception^ exp ) + { + // Error creating stream or reading from it. + Console::WriteLine( " {0}", exp->Message ); + return; + } + + // Convert the binary input into Base64 UUEncoded output. + String^ base64String; + try + { + base64String = Convert::ToBase64String( binaryData, + 0, + binaryData->Length ); + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "Binary data array is null." ); + return; + } + + // Write the UUEncoded version to the output file. + StreamWriter^ outFile; + try + { + outFile = gcnew StreamWriter( outputFileName, + false, + Text::Encoding::ASCII ); + outFile->Write( base64String ); + outFile->Close(); + } + catch ( Exception^ exp ) + { + + // Error creating stream or writing to it. + Console::WriteLine( " {0}", exp->Message ); + } + } + // + + // +public: + void EncodeWithCharArray() + { + FileStream^ inFile; + array^binaryData; + + try + { + inFile = gcnew FileStream( inputFileName, + FileMode::Open, + FileAccess::Read ); + binaryData = gcnew array((int)(inFile->Length)); + long bytesRead = inFile->Read( binaryData, 0, + (int)inFile->Length ); + inFile->Close(); + } + catch ( Exception^ exp ) + { + // Error creating stream or reading from it. + Console::WriteLine( "{0}", exp->Message ); + return; + } + + // Convert the binary input into Base64 UUEncoded output. + // Each 3 Byte sequence in the source data becomes a 4 Byte + // sequence in the character array. + long arrayLength = (long)((4.0 / 3.0) * binaryData->Length); + + // If array length is not divisible by 4, go up to the next + // multiple of 4. + if ( arrayLength % 4 != 0 ) + { + arrayLength += 4 - arrayLength % 4; + } + + array^ base64CharArray = gcnew array(arrayLength); + try + { + Convert::ToBase64CharArray( binaryData, + 0, + binaryData->Length, + base64CharArray, 0 ); + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "Binary data array is null." ); + return; + } + catch ( ArgumentOutOfRangeException^ ) + { + Console::WriteLine( "Char Array is not large enough." ); + return; + } + + // Write the UUEncoded version to the output file. + StreamWriter^ outFile; + try + { + outFile = gcnew StreamWriter( outputFileName, + false, + Text::Encoding::ASCII ); + outFile->Write( base64CharArray ); + outFile->Close(); + } + catch ( Exception^ exp ) + { + // Error creating stream or writing to it. + Console::WriteLine( " {0}", exp->Message ); + } + } + // + + // +public: + void DecodeWithCharArray() + { + StreamReader^ inFile; + array^base64CharArray; + try + { + inFile = gcnew StreamReader( inputFileName, + Text::Encoding::ASCII ); + base64CharArray = gcnew array((int)(inFile->BaseStream->Length)); + inFile->Read( base64CharArray, 0, (int)inFile->BaseStream->Length ); + inFile->Close(); + } + catch ( Exception^ exp ) + { + + // Error creating stream or reading from it. + Console::WriteLine( "{0}", exp->Message ); + return; + } + + // Convert the Base64 UUEncoded input into binary output. + array^binaryData; + try + { + binaryData = Convert::FromBase64CharArray( base64CharArray, + 0, + base64CharArray->Length ); + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "Base 64 character array is null." ); + return; + } + catch ( FormatException^ ) + { + Console::WriteLine( "Base 64 Char Array length is not " + + "4 or is not an even multiple of 4." ); + return; + } + + // Write out the decoded data. + FileStream^ outFile; + try + { + outFile = gcnew FileStream( outputFileName, + FileMode::Create, + FileAccess::Write ); + outFile->Write( binaryData, 0, binaryData->Length ); + outFile->Close(); + } + catch ( Exception^ exp ) + { + // Error creating stream or writing to it. + Console::WriteLine( "{0}", exp->Message ); + } + } + // + + // +public: + void DecodeWithString() + { + StreamReader^ inFile; + String^ base64String; + try + { + array^base64CharArray; + inFile = gcnew StreamReader( inputFileName, + Text::Encoding::ASCII ); + base64CharArray = gcnew array((int)(inFile->BaseStream->Length)); + inFile->Read( base64CharArray, 0, (int)inFile->BaseStream->Length ); + base64String = gcnew String( base64CharArray ); + } + catch ( Exception^ exp ) + { + // Error creating stream or reading from it. + Console::WriteLine( "{0}", exp->Message ); + return; + } + + // Convert the Base64 UUEncoded input into binary output. + array^binaryData; + try + { + binaryData = Convert::FromBase64String( base64String ); + } + catch ( ArgumentNullException^ ) + { + Console::WriteLine( "Base 64 String^ is null." ); + return; + } + catch ( FormatException^ ) + { + Console::WriteLine( "Base 64 String^ length is not " + + "4 or is not an even multiple of 4." ); + return; + } + + // Write out the decoded data. + FileStream^ outFile; + try + { + outFile = gcnew FileStream( outputFileName, + FileMode::Create, + FileAccess::Write ); + outFile->Write( binaryData, 0, binaryData->Length ); + outFile->Close(); + } + catch ( Exception^ exp ) + { + // Error creating stream or writing to it. + Console::WriteLine( "{0}", exp->Message ); + } + } + // +}; + +void main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length != 5 ) + { + Console::WriteLine( "Usage: UUCodeC -d | -e " + + "-s | -c inputFile outputFile" ); + return; + } + + String^ inputFileName = args[ 3 ]; + String^ outputFileName = args[ 4 ]; + Coder^ coder = gcnew Coder( inputFileName,outputFileName ); + + if ( args[ 1 ] == "-d" ) + { + if ( args[ 2 ] == "-s" ) + { + coder->DecodeWithString(); + } + else if ( args[ 2 ] == "-c" ) + { + coder->DecodeWithCharArray(); + } + else + { + Console::WriteLine( "Second arg must be -s or -c" ); + return; + } + } + else + if ( args[ 1 ] == "-e" ) + { + if ( args[ 2 ] == "-s" ) + { + coder->EncodeWithString(); + } + else if ( args[ 2 ] == "-c" ) + { + coder->EncodeWithCharArray(); + } + else + { + Console::WriteLine( "Second arg must be -s or -c" ); + return; + } + } + else + { + Console::WriteLine( "First arg must be -d or -e" ); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp new file mode 100644 index 00000000000..a03e6c881a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromchar.cpp @@ -0,0 +1,26 @@ +// +using namespace System; + +void main() +{ + // Define an array of Char values. + array^ values = { L'\0', L' ', L'*', L'A', L'a', + L'{', L'Æ' }; + + // Convert each Char value to a Decimal. + for each (wchar_t value in values) { + Decimal decValue = value; + Console::WriteLine("'{0}' ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// This example displays the following output: +// ' ' (Decimal) --> 0 (Decimal) +// ' ' (Decimal) --> 32 (Decimal) +// '*' (Decimal) --> 42 (Decimal) +// 'A' (Decimal) --> 65 (Decimal) +// 'a' (Decimal) --> 97 (Decimal) +// '{' (Decimal) --> 123 (Decimal) +// 'A' (Decimal) --> 195 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp new file mode 100644 index 00000000000..f923cdfb25d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromdouble.cpp @@ -0,0 +1,66 @@ + +// +// Example of the explicit conversion from double to Decimal. +using namespace System; +#define formatter "{0,25:E16}{1,33}" + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Convert the double argument; catch exceptions that are thrown. +void DecimalFromDouble( double argument ) +{ + Object^ decValue; + + // Convert the double argument to a Decimal value. + try + { + decValue = (Decimal)argument; + } + catch ( Exception^ ex ) + { + decValue = GetExceptionType( ex ); + } + + Console::WriteLine( formatter, argument, decValue ); +} + +int main() +{ + Console::WriteLine( "This example of the explicit conversion from double " + "to Decimal \ngenerates the following output.\n" ); + Console::WriteLine( formatter, "double argument", "Decimal value" ); + Console::WriteLine( formatter, "---------------", "-------------" ); + + // Convert double values and display the results. + DecimalFromDouble( 1.234567890123E-30 ); + DecimalFromDouble( 1.2345678901234E-25 ); + DecimalFromDouble( 1.23456789012345E-20 ); + DecimalFromDouble( 1.234567890123456E-10 ); + DecimalFromDouble( 1.2345678901234567 ); + DecimalFromDouble( 1.23456789012345678E+12 ); + DecimalFromDouble( 1.234567890123456789E+28 ); + DecimalFromDouble( 1.234567890123456789E+30 ); +} + +/* +This example of the explicit conversion from double to Decimal +generates the following output. + + double argument Decimal value + --------------- ------------- + 1.2345678901230000E-030 0 + 1.2345678901233999E-025 0.0000000000000000000000001235 + 1.2345678901234499E-020 0.0000000000000000000123456789 + 1.2345678901234560E-010 0.000000000123456789012346 + 1.2345678901234567E+000 1.23456789012346 + 1.2345678901234568E+012 1234567890123.46 + 1.2345678901234568E+028 12345678901234600000000000000 + 1.2345678901234569E+030 OverflowException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp new file mode 100644 index 00000000000..2b8674f5b9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.Others/CPP/cfromsingle.cpp @@ -0,0 +1,66 @@ + +// +// Example of the explicit conversion from float to Decimal. +using namespace System; +#define formatter "{0,16:E7}{1,33}" + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Convert the float argument; catch exceptions that are thrown. +void DecimalFromSingle( float argument ) +{ + Object^ decValue; + + // Convert the float argument to a Decimal value. + try + { + decValue = (Decimal)argument; + } + catch ( Exception^ ex ) + { + decValue = GetExceptionType( ex ); + } + + Console::WriteLine( formatter, argument, decValue ); +} + +int main() +{ + Console::WriteLine( "This example of the explicit conversion from float " + "to Decimal \ngenerates the following output.\n" ); + Console::WriteLine( formatter, "float argument", "Decimal value" ); + Console::WriteLine( formatter, "--------------", "-------------" ); + + // Convert float values and display the results. + DecimalFromSingle( 1.2345E-30F ); + DecimalFromSingle( 1.2345E-26F ); + DecimalFromSingle( 1.23456E-22F ); + DecimalFromSingle( 1.23456E-12F ); + DecimalFromSingle( 1.234567F ); + DecimalFromSingle( 1.234567E+12F ); + DecimalFromSingle( 1.2345678E+28F ); + DecimalFromSingle( 1.2345678E+30F ); +} + +/* +This example of the explicit conversion from float to Decimal +generates the following output. + + float argument Decimal value + -------------- ------------- + 1.2345000E-030 0 + 1.2345000E-026 0.0000000000000000000000000123 + 1.2345600E-022 0.000000000000000000000123456 + 1.2345600E-012 0.00000000000123456 + 1.2345671E+000 1.234567 + 1.2345670E+012 1234567000000 + 1.2345678E+028 12345680000000000000000000000 + 1.2345678E+030 OverflowException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp new file mode 100644 index 00000000000..6d1843e5d96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint16.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +void main() +{ + // Define an array of 16-bit integer values. + array^ values = { Int16::MinValue, Int16::MaxValue, + 0xFFF, 12345, -10000 }; + // Convert each value to a Decimal. + for each (Int16 value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// -32768 (Int16) --> -32768 (Decimal) +// 32767 (Int16) --> 32767 (Decimal) +// 4095 (Int16) --> 4095 (Decimal) +// 12345 (Int16) --> 12345 (Decimal) +// -10000 (Int16) --> -10000 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp new file mode 100644 index 00000000000..02af50b7b64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint32.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +void main() +{ + // Define an array of 32-bit integer values. + array^ values = { Int32::MinValue, Int32::MaxValue, + 0xFFFFFF, 123456789, -1000000000 }; + // Convert each value to a Decimal. + for each (Int32 value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// -2147483648 (Int32) --> -2147483648 (Decimal) +// 2147483647 (Int32) --> 2147483647 (Decimal) +// 16777215 (Int32) --> 16777215 (Decimal) +// 123456789 (Int32) --> 123456789 (Decimal) +// -1000000000 (Int32) --> -1000000000 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp new file mode 100644 index 00000000000..6276b339c09 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromint64.cpp @@ -0,0 +1,24 @@ +// +using namespace System; + +void main() +{ + // Define an array of 64-bit integer values. + array^ values = { Int64::MinValue, Int64::MaxValue, + 0xFFFFFFFFFFFF, 123456789123456789, + -1000000000000000 }; + // Convert each value to a Decimal. + for each (Int64 value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// -9223372036854775808 (Int64) --> -9223372036854775808 (Decimal) +// 9223372036854775807 (Int64) --> 9223372036854775807 (Decimal) +// 281474976710655 (Int64) --> 281474976710655 (Decimal) +// 123456789123456789 (Int64) --> 123456789123456789 (Decimal) +// -1000000000000000 (Int64) --> -1000000000000000 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp new file mode 100644 index 00000000000..7dc5e10fb54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.SInts/CPP/cfromsbyte.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +void main() +{ + // Define an array of 8-bit signed integer values. + array^ values = { SByte::MinValue, SByte::MaxValue, + 0x3F, 123, -100 }; + // Convert each value to a Decimal. + for each (SByte value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// -128 (SByte) --> -128 (Decimal) +// 127 (SByte) --> 127 (Decimal) +// 63 (SByte) --> 63 (Decimal) +// 123 (SByte) --> 123 (Decimal) +// -100 (SByte) --> -100 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp new file mode 100644 index 00000000000..f1aeb921e60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfrombyte.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +void main() +{ + // Define an array of byte values. + array^ values = { Byte::MinValue, Byte::MaxValue, + 0x3F, 123, 200 }; + // Convert each value to a Decimal. + for each (Byte value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// 0 (Byte) --> 0 (Decimal) +// 255 (Byte) --> 255 (Decimal) +// 63 (Byte) --> 63 (Decimal) +// 123 (Byte) --> 123 (Decimal) +// 200 (Byte) --> 200 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp new file mode 100644 index 00000000000..05b5707b713 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint16.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +void main() +{ + // Define an array of 16-bit unsigned integer values. + array^ values = { UInt16::MinValue, UInt16::MaxValue, + 0xFFF, 12345, 40000 }; + // Convert each value to a Decimal. + for each (UInt16 value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// 0 (UInt16) --> 0 (Decimal) +// 65535 (UInt16) --> 65535 (Decimal) +// 4095 (UInt16) --> 4095 (Decimal) +// 12345 (UInt16) --> 12345 (Decimal) +// 40000 (UInt16) --> 40000 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp new file mode 100644 index 00000000000..66304c49b67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint32.cpp @@ -0,0 +1,24 @@ +// +using namespace System; + +void main() +{ + // Define an array of 32-bit unsigned integer values. + array^ values = { UInt32::MinValue, UInt32::MaxValue, + 0xFFFFFF, 123456789, 4000000000 }; + // Convert each value to a Decimal. + for each (UInt32 value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// 0 (UInt32) --> 0 (Decimal) +// 4294967295 (UInt32) --> 4294967295 (Decimal) +// 16777215 (UInt32) --> 16777215 (Decimal) +// 123456789 (UInt32) --> 123456789 (Decimal) +// 4000000000 (UInt32) --> 4000000000 (Decimal) +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp new file mode 100644 index 00000000000..83f40b676ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvFrom.UInts/CPP/cfromuint64.cpp @@ -0,0 +1,24 @@ +// +using namespace System; + +void main() +{ + // Define an array of 64-bit unsigned integer values. + array^ values = { UInt64::MinValue, UInt64::MaxValue, + 0xFFFFFFFFFFFF, 123456789123456789, + 1000000000000000 }; + // Convert each value to a Decimal. + for each (UInt64 value in values) { + Decimal decValue = value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, decValue, + decValue.GetType()->Name); + } +} +// The example displays the following output: +// 0 (UInt64) --> 0 (Decimal) +// 18446744073709551615 (UInt64) --> 18446744073709551615 (Decimal) +// 281474976710655 (UInt64) --> 281474976710655 (Decimal) +// 123456789123456789 (UInt64) --> 123456789123456789 (Decimal) +// 1000000000000000 (UInt64) --> 1000000000000000 (Decimal) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp new file mode 100644 index 00000000000..b129d97d402 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctos_byte.cpp @@ -0,0 +1,43 @@ +// +using namespace System; + +void main() +{ + // Define an array of decimal values. + array^ values = { Decimal::Parse("78"), + Decimal(78000,0,0,false,3), + Decimal::Parse("78.999"), + Decimal::Parse("255.999"), + Decimal::Parse("256"), + Decimal::Parse("127.999"), + Decimal::Parse("128"), + Decimal::Parse("-0.999"), + Decimal::Parse("-1"), + Decimal::Parse("-128.999"), + Decimal::Parse("-129") }; + for each (Decimal value in values) { + try { + Byte byteValue = (Byte) value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, byteValue, + byteValue.GetType()->Name); + } + catch (OverflowException^ e) { + Console::WriteLine("OverflowException: Cannot convert {0}", + value); + } + } +} +// The example displays the following output: +// 78 (Decimal) --> 78 (Byte) +// 78.000 (Decimal) --> 78 (Byte) +// 78.999 (Decimal) --> 78 (Byte) +// 255.999 (Decimal) --> 255 (Byte) +// OverflowException: Cannot convert 256 +// 127.999 (Decimal) --> 127 (Byte) +// 128 (Decimal) --> 128 (Byte) +// -0.999 (Decimal) --> 0 (Byte) +// OverflowException: Cannot convert -1 +// OverflowException: Cannot convert -128.999 +// OverflowException: Cannot convert -129 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp new file mode 100644 index 00000000000..b9c5dfa766d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctosgl_dbl.cpp @@ -0,0 +1,31 @@ +// +using namespace System; + +void main() +{ + // Define an array of Decimal values. + array^ values = { Decimal::Parse("0.0000000000000000000000000001"), + Decimal::Parse("0.0000000000123456789123456789"), + Decimal::Parse("123"), + Decimal(123000000, 0, 0, false, 6), + Decimal::Parse("123456789.123456789"), + Decimal::Parse("123456789123456789123456789"), + Decimal::MinValue, Decimal::MaxValue }; + // Convert each value to a double. + for each (Decimal value in values) { + double dblValue = (double) value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, dblValue, + dblValue.GetType()->Name); + } +} +// The example displays the following output: +// 0.0000000000000000000000000001 (Decimal) --> 1E-28 (Double) +// 0.0000000000123456789123456789 (Decimal) --> 1.23456789123457E-11 (Double) +// 123 (Decimal) --> 123 (Double) +// 123.000000 (Decimal) --> 123 (Double) +// 123456789.123456789 (Decimal) --> 123456789.123457 (Double) +// 123456789123456789123456789 (Decimal) --> 1.23456789123457E+26 (Double) +// -79228162514264337593543950335 (Decimal) --> -7.92281625142643E+28 (Double) +// 79228162514264337593543950335 (Decimal) --> 7.92281625142643E+28 (Double) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp new file mode 100644 index 00000000000..ba9c3b99b99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int16.cpp @@ -0,0 +1,88 @@ + +// +// Example of the explicit conversions from Decimal to short and +// Decimal to unsigned short. +using namespace System; +#define formatter "{0,16}{1,19}{2,19}" + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Convert the Decimal argument; catch exceptions that are thrown. +void DecimalToU_Int16( Decimal argument ) +{ + Object^ Int16Value; + Object^ UInt16Value; + + // Convert the argument to a short value. + try + { + Int16Value = (short)argument; + } + catch ( Exception^ ex ) + { + Int16Value = GetExceptionType( ex ); + } + + + // Convert the argument to an unsigned short value. + try + { + UInt16Value = (unsigned short)argument; + } + catch ( Exception^ ex ) + { + UInt16Value = GetExceptionType( ex ); + } + + Console::WriteLine( formatter, argument, Int16Value, UInt16Value ); +} + +int main() +{ + Console::WriteLine( "This example of the explicit conversions from Decimal to " + "short \nand Decimal to unsigned short generates the " + "following output. \nIt displays several converted Decimal " + "values.\n" ); + Console::WriteLine( formatter, "Decimal argument", "short", "unsigned short" ); + Console::WriteLine( formatter, "----------------", "-----", "--------------" ); + + // Convert Decimal values and display the results. + DecimalToU_Int16( Decimal::Parse( "123" ) ); + DecimalToU_Int16( Decimal(123000,0,0,false,3) ); + DecimalToU_Int16( Decimal::Parse( "123.999" ) ); + DecimalToU_Int16( Decimal::Parse( "65535.999" ) ); + DecimalToU_Int16( Decimal::Parse( "65536" ) ); + DecimalToU_Int16( Decimal::Parse( "32767.999" ) ); + DecimalToU_Int16( Decimal::Parse( "32768" ) ); + DecimalToU_Int16( Decimal::Parse( "-0.999" ) ); + DecimalToU_Int16( Decimal::Parse( "-1" ) ); + DecimalToU_Int16( Decimal::Parse( "-32768.999" ) ); + DecimalToU_Int16( Decimal::Parse( "-32769" ) ); +} + +/* +This example of the explicit conversions from Decimal to short +and Decimal to unsigned short generates the following output. +It displays several converted Decimal values. + +Decimal argument short unsigned short +---------------- ----- -------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 65535.999 OverflowException 65535 + 65536 OverflowException OverflowException + 32767.999 32767 32767 + 32768 OverflowException 32768 + -0.999 0 0 + -1 -1 OverflowException + -32768.999 -32768 OverflowException + -32769 OverflowException OverflowException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp new file mode 100644 index 00000000000..02cb0e6339f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int32.cpp @@ -0,0 +1,88 @@ + +// +// Example of the explicit conversions from Decimal to int and +// Decimal to unsigned int. +using namespace System; +#define formatter "{0,17}{1,19}{2,19}" + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Convert the Decimal argument; catch exceptions that are thrown. +void DecimalToU_Int32( Decimal argument ) +{ + Object^ Int32Value; + Object^ UInt32Value; + + // Convert the argument to an int value. + try + { + Int32Value = (int)argument; + } + catch ( Exception^ ex ) + { + Int32Value = GetExceptionType( ex ); + } + + + // Convert the argument to an unsigned int value. + try + { + UInt32Value = (unsigned int)argument; + } + catch ( Exception^ ex ) + { + UInt32Value = GetExceptionType( ex ); + } + + Console::WriteLine( formatter, argument, Int32Value, UInt32Value ); +} + +int main() +{ + Console::WriteLine( "This example of the explicit conversions from Decimal to " + "int \nand Decimal to unsigned int generates the " + "following output. \nIt displays several converted Decimal " + "values.\n" ); + Console::WriteLine( formatter, "Decimal argument", "int", "unsigned int" ); + Console::WriteLine( formatter, "----------------", "---", "------------" ); + + // Convert Decimal values and display the results. + DecimalToU_Int32( Decimal::Parse( "123" ) ); + DecimalToU_Int32( Decimal(123000,0,0,false,3) ); + DecimalToU_Int32( Decimal::Parse( "123.999" ) ); + DecimalToU_Int32( Decimal::Parse( "4294967295.999" ) ); + DecimalToU_Int32( Decimal::Parse( "4294967296" ) ); + DecimalToU_Int32( Decimal::Parse( "2147483647.999" ) ); + DecimalToU_Int32( Decimal::Parse( "2147483648" ) ); + DecimalToU_Int32( Decimal::Parse( "-0.999" ) ); + DecimalToU_Int32( Decimal::Parse( "-1" ) ); + DecimalToU_Int32( Decimal::Parse( "-2147483648.999" ) ); + DecimalToU_Int32( Decimal::Parse( "-2147483649" ) ); +} + +/* +This example of the explicit conversions from Decimal to int +and Decimal to unsigned int generates the following output. +It displays several converted Decimal values. + + Decimal argument int unsigned int + ---------------- --- ------------ + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 4294967295.999 OverflowException 4294967295 + 4294967296 OverflowException OverflowException + 2147483647.999 2147483647 2147483647 + 2147483648 OverflowException 2147483648 + -0.999 0 0 + -1 -1 OverflowException + -2147483648.999 -2147483648 OverflowException + -2147483649 OverflowException OverflowException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp new file mode 100644 index 00000000000..5beaab71f7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Decimal.ConvTo/CPP/ctou_int64.cpp @@ -0,0 +1,88 @@ + +// +// Example of the explicit conversions from Decimal to __int64 and +// Decimal to unsigned __int64. +using namespace System; +#define formatter "{0,25}{1,22}{2,22}" + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Convert the Decimal argument; catch exceptions that are thrown. +void DecimalToU_Int64( Decimal argument ) +{ + Object^ Int64Value; + Object^ UInt64Value; + + // Convert the argument to an __int64 value. + try + { + Int64Value = (__int64)argument; + } + catch ( Exception^ ex ) + { + Int64Value = GetExceptionType( ex ); + } + + + // Convert the argument to an unsigned __int64 value. + try + { + UInt64Value = (unsigned __int64)argument; + } + catch ( Exception^ ex ) + { + UInt64Value = GetExceptionType( ex ); + } + + Console::WriteLine( formatter, argument, Int64Value, UInt64Value ); +} + +int main() +{ + Console::WriteLine( "This example of the explicit conversions from Decimal to " + "__int64 \nand Decimal to unsigned __int64 generates the " + "following output. \nIt displays several converted Decimal " + "values.\n" ); + Console::WriteLine( formatter, "Decimal argument", "__int64", "unsigned __int64" ); + Console::WriteLine( formatter, "----------------", "-------", "----------------" ); + + // Convert Decimal values and display the results. + DecimalToU_Int64( Decimal::Parse( "123" ) ); + DecimalToU_Int64( Decimal(123000,0,0,false,3) ); + DecimalToU_Int64( Decimal::Parse( "123.999" ) ); + DecimalToU_Int64( Decimal::Parse( "18446744073709551615.999" ) ); + DecimalToU_Int64( Decimal::Parse( "18446744073709551616" ) ); + DecimalToU_Int64( Decimal::Parse( "9223372036854775807.999" ) ); + DecimalToU_Int64( Decimal::Parse( "9223372036854775808" ) ); + DecimalToU_Int64( Decimal::Parse( "-0.999" ) ); + DecimalToU_Int64( Decimal::Parse( "-1" ) ); + DecimalToU_Int64( Decimal::Parse( "-9223372036854775808.999" ) ); + DecimalToU_Int64( Decimal::Parse( "-9223372036854775809" ) ); +} + +/* +This example of the explicit conversions from Decimal to __int64 +and Decimal to unsigned __int64 generates the following output. +It displays several converted Decimal values. + + Decimal argument __int64 unsigned __int64 + ---------------- ------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp new file mode 100644 index 00000000000..c6b41982d9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.IntPtr.ToPointer/cpp/topointer.cpp @@ -0,0 +1,55 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +class NotTooSafeStringReverse +{ +public: + static void Main() + { + String^ stringA = "I seem to be turned around!"; + int copylen = stringA->Length; + + // Allocate HGlobal memory for source and destination strings + IntPtr sptr = Marshal::StringToHGlobalAnsi(stringA); + IntPtr dptr = Marshal::AllocHGlobal(copylen + 1); + + char *src = (char *)sptr.ToPointer(); + char *dst = (char *)dptr.ToPointer(); + + if (copylen > 0) + { + // set the source pointer to the end of the string + // to do a reverse copy. + src += copylen - 1; + + while (copylen-- > 0) + { + *dst++ = *src--; + } + *dst = 0; + } + String^ stringB = Marshal::PtrToStringAnsi(dptr); + + Console::WriteLine("Original:\n{0}\n", stringA); + Console::WriteLine("Reversed:\n{0}", stringB); + + // Free HGlobal memory + Marshal::FreeHGlobal(dptr); + Marshal::FreeHGlobal(sptr); + } +}; + +int main() +{ + NotTooSafeStringReverse::Main(); +} + +// The progam has the following output: +// +// Original: +// I seem to be turned around! +// +// Reversed: +// !dnuora denrut eb ot mees I +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp new file mode 100644 index 00000000000..d0cc8fad02a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Reflection.MemberTypes/cpp/source.cpp @@ -0,0 +1,54 @@ +// +using namespace System; +using namespace System::Reflection; + +void main() +{ + // Get the type of a chosen class. + Type^ t = ReflectionTypeLoadException::typeid; + + // Get the MemberInfo array. + array^ members = t->GetMembers(); + + // Get and display the name and the MemberType for each member. + Console::WriteLine("Members of {0}", t->Name); + for each (MemberInfo^ member in members) { + MemberTypes memberType = member->MemberType; + Console::WriteLine(" {0}: {1}", member->Name, memberType); + } +} +// The example displays the following output: +// Members of ReflectionTypeLoadException +// get_Types: Method +// get_LoaderExceptions: Method +// GetObjectData: Method +// get_Message: Method +// get_Data: Method +// GetBaseException: Method +// get_InnerException: Method +// get_TargetSite: Method +// get_StackTrace: Method +// get_HelpLink: Method +// set_HelpLink: Method +// get_Source: Method +// set_Source: Method +// ToString: Method +// get_HResult: Method +// GetType: Method +// Equals: Method +// GetHashCode: Method +// GetType: Method +// .ctor: Constructor +// .ctor: Constructor +// Types: Property +// LoaderExceptions: Property +// Message: Property +// Data: Property +// InnerException: Property +// TargetSite: Property +// StackTrace: Property +// HelpLink: Property +// Source: Property +// HResult: Property +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp new file mode 100644 index 00000000000..f17fb57cbb7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.Security.Cryptography.RSACryptoServiceProvider ManualHash Example/CPP/class1.cpp @@ -0,0 +1,153 @@ + + +// +// This example uses the SHA1 algorithm. +// Due to collision problems with SHA1, Microsoft recommends SHA256 or better. +#using + +using namespace System; +using namespace System::Text; +using namespace System::Security::Cryptography; +ref class Sender +{ +private: + RSAParameters rsaPubParams; + RSAParameters rsaPrivateParams; + +public: + Sender() + { + RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; + + //Generate public and private key data. + rsaPrivateParams = rsaCSP->ExportParameters( true ); + rsaPubParams = rsaCSP->ExportParameters( false ); + } + + + property RSAParameters PublicParameters + { + RSAParameters get() + { + return rsaPubParams; + } + + } + + //Manually performs hash and then signs hashed value. + array^ HashAndSign( array^encrypted ) + { + RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; + SHA1Managed^ hash = gcnew SHA1Managed; + array^hashedData; + rsaCSP->ImportParameters( rsaPrivateParams ); + hashedData = hash->ComputeHash( encrypted ); + return rsaCSP->SignHash( hashedData, CryptoConfig::MapNameToOID( "SHA1" ) ); + } + + + //Encrypts using only the public key data. + array^ EncryptData( RSAParameters rsaParams, array^toEncrypt ) + { + RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; + rsaCSP->ImportParameters( rsaParams ); + return rsaCSP->Encrypt( toEncrypt, false ); + } + +}; + +ref class Receiver +{ +private: + RSAParameters rsaPubParams; + RSAParameters rsaPrivateParams; + +public: + Receiver() + { + RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; + + //Generate public and private key data. + rsaPrivateParams = rsaCSP->ExportParameters( true ); + rsaPubParams = rsaCSP->ExportParameters( false ); + } + + + property RSAParameters PublicParameters + { + RSAParameters get() + { + return rsaPubParams; + } + + } + + //Manually performs hash and then verifies hashed value. + // + bool VerifyHash( RSAParameters rsaParams, array^signedData, array^signature ) + { + RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; + SHA1Managed^ hash = gcnew SHA1Managed; + array^hashedData; + rsaCSP->ImportParameters( rsaParams ); + bool dataOK = rsaCSP->VerifyData(signedData, CryptoConfig::MapNameToOID("SHA1"), signature); + hashedData = hash->ComputeHash( signedData ); + return rsaCSP->VerifyHash( hashedData, CryptoConfig::MapNameToOID( "SHA1" ), signature ); + } + // + + + //Decrypt using the private key data. + void DecryptData( array^encrypted ) + { + array^fromEncrypt; + String^ roundTrip; + ASCIIEncoding^ myAscii = gcnew ASCIIEncoding; + RSACryptoServiceProvider^ rsaCSP = gcnew RSACryptoServiceProvider; + rsaCSP->ImportParameters( rsaPrivateParams ); + fromEncrypt = rsaCSP->Decrypt( encrypted, false ); + roundTrip = myAscii->GetString( fromEncrypt ); + Console::WriteLine( "RoundTrip: {0}", roundTrip ); + } + +}; + +int main() +{ + array^toEncrypt; + array^encrypted; + array^signature; + + //Choose a small amount of data to encrypt. + String^ original = "Hello"; + ASCIIEncoding^ myAscii = gcnew ASCIIEncoding; + + //Create a sender and receiver. + Sender^ mySender = gcnew Sender; + Receiver^ myReceiver = gcnew Receiver; + + //Convert the data string to a byte array. + toEncrypt = myAscii->GetBytes( original ); + + //Encrypt data using receiver's public key. + encrypted = mySender->EncryptData( myReceiver->PublicParameters, toEncrypt ); + + //Hash the encrypted data and generate a signature on the hash + // using the sender's private key. + signature = mySender->HashAndSign( encrypted ); + Console::WriteLine( "Original: {0}", original ); + + //Verify the signature is authentic using the sender's public key. + if ( myReceiver->VerifyHash( mySender->PublicParameters, encrypted, signature ) ) + { + + //Decrypt the data using the receiver's private key. + myReceiver->DecryptData( encrypted ); + } + else + { + Console::WriteLine( "Invalid signature" ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp b/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp new file mode 100644 index 00000000000..ffc578df28f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/System.String.Substring/cpp/Substring10.cpp @@ -0,0 +1,35 @@ + +// +using namespace System; +using namespace System::Collections; + +int main() +{ + array^info = { "Name: Felica Walker", "Title: Mz.", + "Age: 47", "Location: Paris", "Gender: F"}; + int found = 0; + Console::WriteLine("The initial values in the array are:"); + for each (String^ s in info) + Console::WriteLine(s); + + Console::WriteLine("\nWe want to retrieve only the key information. That is:"); + for each (String^ s in info) { + found = s->IndexOf(": "); + Console::WriteLine(" {0}", s->Substring(found + 2)); + } +} +// The example displays the following output: +// The initial values in the array are: +// Name: Felica Walker +// Title: Mz. +// Age: 47 +// Location: Paris +// Gender: F +// +// We want to retrieve only the key information. That is: +// Felica Walker +// Mz. +// 47 +// Paris +// F +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp new file mode 100644 index 00000000000..df9aa3a8a84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Action/cpp/action.cpp @@ -0,0 +1,42 @@ +// Action.cpp : main project file. + +//#include "stdafx.h" + +// +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Name +{ +private: + String^ instanceName; + +public: + Name(String^ name) + { + instanceName = name; + } + + void DisplayToConsole() + { + Console::WriteLine(this->instanceName); + } + + void DisplayToWindow() + { + MessageBox::Show(this->instanceName); + } +}; + + +int main() +{ + Name^ testName = gcnew Name(L"Koani"); + System::Action^ showMethod; + showMethod += gcnew Action(testName, &Name::DisplayToWindow); + showMethod(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp new file mode 100644 index 00000000000..c593825b090 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/action`1.cpp @@ -0,0 +1,36 @@ +// Action`1.cpp : main project file. + +//#include "stdafx.h" + +// +#using + +using namespace System; +using namespace System::Windows::Forms; + +namespace ActionExample +{ + public ref class Message + { + public: + static void ShowWindowsMessage(String^ message) + { + MessageBox::Show(message); + } + }; +} + +int main() +{ + Action^ messageTarget; + + if (Environment::GetCommandLineArgs()->Length > 1) + messageTarget = gcnew Action(&ActionExample::Message::ShowWindowsMessage); + else + messageTarget = gcnew Action(&Console::WriteLine); + + messageTarget("Hello, World!"); + return 0; +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp new file mode 100644 index 00000000000..143680f77d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Action~1/cpp/delegate.cpp @@ -0,0 +1,34 @@ +// Delegate.cpp : main project file. + +//#include "stdafx.h" + +// +#using + +using namespace System; +using namespace System::Windows::Forms; + +public delegate void DisplayMessage(String^ message); + +public ref class TestCustomDelegate +{ +public: + static void ShowWindowsMessage(String^ message) + { + MessageBox::Show(message); + } +}; + +int main() +{ + DisplayMessage^ messageTarget; + + if (Environment::GetCommandLineArgs()->Length > 1) + messageTarget = gcnew DisplayMessage(&TestCustomDelegate::ShowWindowsMessage); + else + messageTarget = gcnew DisplayMessage(&Console::WriteLine); + + messageTarget(L"Hello World!"); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp new file mode 100644 index 00000000000..f0be96546c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.AppDomain.IsDefaultAppDomain/CPP/System.AppDomain.IsDefaultAppDomain.cpp @@ -0,0 +1,34 @@ +// +using namespace System; +using namespace System::Reflection; + +// This method has the same signature as the CrossAppDomainDelegate, +// so that it can be executed easily in the new application domain. +// +static void ShowDomainInfo() +{ + AppDomain^ ad = AppDomain::CurrentDomain; + Console::WriteLine(); + Console::WriteLine( L"FriendlyName: {0}", ad->FriendlyName ); + Console::WriteLine( L"Id: {0}", ad->Id ); + Console::WriteLine( L"IsDefaultAppDomain: {0}", ad->IsDefaultAppDomain() ); +} + +// The following attribute indicates to the loader that assemblies +// in the global assembly cache should be shared across multiple +// application domains. +// +[LoaderOptimizationAttribute(LoaderOptimization::MultiDomainHost)] +int main() +{ + // Show information for the default application domain. + ShowDomainInfo(); + + // Create a new application domain and display its information. + AppDomain^ newDomain = AppDomain::CreateDomain( L"MyMultiDomain" ); + newDomain->DoCallBack( gcnew CrossAppDomainDelegate( ShowDomainInfo ) ); + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp new file mode 100644 index 00000000000..bc76d292564 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array.AsReadOnly/CPP/arrayasreadonly.cpp @@ -0,0 +1,116 @@ +// The following example wraps an array in a read-only IList. +#using + +// +using namespace System; +using namespace System::Collections::Generic; + +namespace Samples +{ + public ref class SamplesArray + { + public: + static void Work() + { + + // Create and initialize a new string array. + array ^ textArray = + {"The", "quick", "brown", "fox"}; + + // Display the values of the array. + Console::WriteLine("The string array initially contains " + "the following values:"); + PrintIndexAndValues(textArray); + + // Create a read-only IList wrapper around the array. + IList ^ textList = Array::AsReadOnly(textArray); + + // Display the values of the read-only IList. + Console::WriteLine("The read-only IList contains " + "the following values:"); + PrintIndexAndValues(textList); + + // Attempt to change a value through the wrapper. + try + { + textList[3] = "CAT"; + } + catch (NotSupportedException^ ex) + { + Console::WriteLine("{0} - {1}", ex->GetType(), + ex->Message); + Console::WriteLine(); + } + + + // Change a value in the original array. + textArray[2] = "RED"; + + // Display the values of the array. + Console::WriteLine("After changing the third element," + "the string array contains the following values:"); + PrintIndexAndValues(textArray); + + // Display the values of the read-only IList. + Console::WriteLine("After changing the third element, the" + " read-only IList contains the following values:"); + PrintIndexAndValues(textList); + } + + static void PrintIndexAndValues(array^ textArray) + { + for (int i = 0; i < textArray->Length; i++) + { + Console::WriteLine(" [{0}] : {1}", i, textArray[i]); + } + Console::WriteLine(); + } + + static void PrintIndexAndValues(IList^ textList) + { + for (int i = 0; i < textList->Count; i++) + { + Console::WriteLine(" [{0}] : {1}", i, textList[i]); + } + Console::WriteLine(); + } + }; +} + +int main() +{ + Samples::SamplesArray::Work(); + +} + +/* +This code produces the following output. + +The string array initially contains the following values: +[0] : The +[1] : quick +[2] : brown +[3] : fox + +The read-only IList contains the following values: +[0] : The +[1] : quick +[2] : brown +[3] : fox + +System.NotSupportedException - Collection is read-only. + +After changing the third element, the string array contains the following values: +[0] : The +[1] : quick +[2] : RED +[3] : fox + +After changing the third element, the read-only IList contains the following values: +[0] : The +[1] : quick +[2] : RED +[3] : fox + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp new file mode 100644 index 00000000000..cbcd2d14244 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Clone/CPP/arrayclone.cpp @@ -0,0 +1,73 @@ + +// The following code example clones a CultureInfo array and demonstrates the behavior of a shallow copy. +// +using namespace System; +using namespace System::Globalization; +void PrintIndexAndValues( Array^ myArray ); +int main() +{ + + // Create and initialize a new CultureInfo array. + CultureInfo^ ci0 = gcnew CultureInfo( "ar-SA",false ); + CultureInfo^ ci1 = gcnew CultureInfo( "en-US",false ); + CultureInfo^ ci2 = gcnew CultureInfo( "fr-FR",false ); + CultureInfo^ ci3 = gcnew CultureInfo( "ja-JP",false ); + array^arrCI = {ci0,ci1,ci2,ci3}; + + // Create a clone of the CultureInfo array. + array^arrCIClone = (array^)arrCI->Clone(); + + // Replace an element in the clone array. + CultureInfo^ ci4 = gcnew CultureInfo( "th-TH",false ); + arrCIClone[ 0 ] = ci4; + + // Display the contents of the original array. + Console::WriteLine( "The original array contains the following values:" ); + PrintIndexAndValues( arrCI ); + + // Display the contents of the clone array. + Console::WriteLine( "The clone array contains the following values:" ); + PrintIndexAndValues( arrCIClone ); + + // Display the DateTimeFormatInfo.DateSeparator for the fourth element in both arrays. + Console::WriteLine( "Before changes to the clone:" ); + Console::WriteLine( " Original: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCI[ 3 ]->Name, arrCI[ 3 ]->DateTimeFormat->DateSeparator ); + Console::WriteLine( " Clone: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCIClone[ 3 ]->Name, arrCIClone[ 3 ]->DateTimeFormat->DateSeparator ); + + // Replace the DateTimeFormatInfo.DateSeparator for the fourth element in the clone array. + arrCIClone[ 3 ]->DateTimeFormat->DateSeparator = "-"; + + // Display the DateTimeFormatInfo.DateSeparator for the fourth element in both arrays. + Console::WriteLine( "After changes to the clone:" ); + Console::WriteLine( " Original: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCI[ 3 ]->Name, arrCI[ 3 ]->DateTimeFormat->DateSeparator ); + Console::WriteLine( " Clone: The DateTimeFormatInfo->DateSeparator for {0} is {1}.", arrCIClone[ 3 ]->Name, arrCIClone[ 3 ]->DateTimeFormat->DateSeparator ); +} + +void PrintIndexAndValues( Array^ myArray ) +{ + for ( int i = myArray->GetLowerBound( 0 ); i <= myArray->GetUpperBound( 0 ); i++ ) + Console::WriteLine( "\t[{0}]:\t{1}", i, myArray->GetValue( i ) ); +} + +/* +This code produces the following output. + +The original array contains the following values: + [0]: ar-SA + [1]: en-US + [2]: fr-FR + [3]: ja-JP +The clone array contains the following values: + [0]: th-TH + [1]: en-US + [2]: fr-FR + [3]: ja-JP +Before changes to the clone: + Original: The DateTimeFormatInfo.DateSeparator for ja-JP is /. + Clone: The DateTimeFormatInfo.DateSeparator for ja-JP is /. +After changes to the clone: + Original: The DateTimeFormatInfo.DateSeparator for ja-JP is -. + Clone: The DateTimeFormatInfo.DateSeparator for ja-JP is -. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp new file mode 100644 index 00000000000..3bba94a2dc6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Resize/CPP/System.Array.Resize.cpp @@ -0,0 +1,83 @@ + +// The following example shows how resizing affects the array. +// +using namespace System; +static void PrintIndexAndValues(array^myArr) +{ + for(int i = 0; i < myArr->Length; i++) + { + Console::WriteLine(L" [{0}] : {1}", i, myArr[i]); + } + Console::WriteLine(); +} + +int main() +{ + + // Create and initialize a new string array. + array^myArr = {L"The", L"quick", L"brown", L"fox", + L"jumps", L"over", L"the", L"lazy", L"dog"}; + + // Display the values of the array. + Console::WriteLine( + L"The string array initially contains the following values:"); + PrintIndexAndValues(myArr); + + // Resize the array to a bigger size (five elements larger). + Array::Resize(myArr, myArr->Length + 5); + + // Display the values of the array. + Console::WriteLine(L"After resizing to a larger size, "); + Console::WriteLine(L"the string array contains the following values:"); + PrintIndexAndValues(myArr); + + // Resize the array to a smaller size (four elements). + Array::Resize(myArr, 4); + + // Display the values of the array. + Console::WriteLine(L"After resizing to a smaller size, "); + Console::WriteLine(L"the string array contains the following values:"); + PrintIndexAndValues(myArr); + return 1; +} + +/* +This code produces the following output. + +The string array initially contains the following values: + [0] : The + [1] : quick + [2] : brown + [3] : fox + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + +After resizing to a larger size, +the string array contains the following values: + [0] : The + [1] : quick + [2] : brown + [3] : fox + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + [9] : + [10] : + [11] : + [12] : + [13] : + +After resizing to a smaller size, +the string array contains the following values: + [0] : The + [1] : quick + [2] : brown + [3] : fox + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp new file mode 100644 index 00000000000..a3cb3dea791 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort/CPP/arraysort.cpp @@ -0,0 +1,119 @@ + +// The following example shows how to sort the values in an array using the default comparer +// and a custom comparer that reverses the sort order. + +// +using namespace System; +using namespace System::Collections; + +public ref class ReverseComparer : IComparer +{ +public: + // Call CaseInsensitiveComparer::Compare with the parameters reversed. + virtual int Compare(Object^ x, Object^ y) = IComparer::Compare + { + return ((gcnew CaseInsensitiveComparer)->Compare(y, x)); + } +}; + +void DisplayValues(array^ arr) +{ + for (int i = arr->GetLowerBound(0); i <= arr->GetUpperBound(0); i++) + Console::WriteLine( " [{0}] : {1}", i, arr[ i ] ); + + Console::WriteLine(); +} + +int main() +{ + // Create and initialize a new array. and a new custom comparer. + array^ words = { "The","QUICK","BROWN","FOX","jumps", + "over","the","lazy","dog" }; + // Instantiate the reverse comparer. + IComparer^ revComparer = gcnew ReverseComparer(); + + // Display the values of the Array. + Console::WriteLine( "The original order of elements in the array:" ); + DisplayValues(words); + + // Sort a section of the array using the default comparer. + Array::Sort(words, 1, 3); + Console::WriteLine( "After sorting elements 1-3 by using the default comparer:"); + DisplayValues(words); + + // Sort a section of the array using the reverse case-insensitive comparer. + Array::Sort(words, 1, 3, revComparer); + Console::WriteLine( "After sorting elements 1-3 by using the reverse case-insensitive comparer:"); + DisplayValues(words); + + // Sort the entire array using the default comparer. + Array::Sort(words); + Console::WriteLine( "After sorting the entire array by using the default comparer:"); + DisplayValues(words); + + // Sort the entire array by using the reverse case-insensitive comparer. + Array::Sort(words, revComparer); + Console::WriteLine( "After sorting the entire array using the reverse case-insensitive comparer:"); + DisplayValues(words); +} + +/* +This code produces the following output. + +The Array initially contains the following values: + [0] : The + [1] : QUICK + [2] : BROWN + [3] : FOX + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + +After sorting a section of the Array using the default comparer: + [0] : The + [1] : BROWN + [2] : FOX + [3] : QUICK + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + +After sorting a section of the Array using the reverse case-insensitive comparer: + [0] : The + [1] : QUICK + [2] : FOX + [3] : BROWN + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + +After sorting the entire Array using the default comparer: + [0] : BROWN + [1] : dog + [2] : FOX + [3] : jumps + [4] : lazy + [5] : over + [6] : QUICK + [7] : the + [8] : The + +After sorting the entire Array using the reverse case-insensitive comparer: + [0] : the + [1] : The + [2] : QUICK + [3] : over + [4] : lazy + [5] : jumps + [6] : FOX + [7] : dog + [8] : BROWN + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp new file mode 100644 index 00000000000..ef9afc50bc2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array.Sort2/CPP/arraysort2.cpp @@ -0,0 +1,109 @@ +// The following example shows how to sort two associated arrays +// where the first array contains the keys and the second array contains the values. +// Sorts are done using the default comparer and a custom comparer that reverses the sort order. + +// +using namespace System; +using namespace System::Collections; + +public ref class myReverserClass: public IComparer +{ +private: + + // Calls CaseInsensitiveComparer::Compare with the parameters reversed. + virtual int Compare( Object^ x, Object^ y ) = IComparer::Compare + { + return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); + } +}; + +void PrintKeysAndValues( array^myKeys, array^myValues ) +{ + for ( int i = 0; i < myKeys->Length; i++ ) + { + Console::WriteLine( " {0, -10}: {1}", myKeys[ i ], myValues[ i ] ); + } + Console::WriteLine(); +} + +int main() +{ + // Creates and initializes a new Array and a new custom comparer. + array^myKeys = {"red","GREEN","YELLOW","BLUE","purple","black","orange"}; + array^myValues = {"strawberries","PEARS","LIMES","BERRIES","grapes","olives","cantaloupe"}; + IComparer^ myComparer = gcnew myReverserClass; + + // Displays the values of the Array. + Console::WriteLine( "The Array initially contains the following values:" ); + PrintKeysAndValues( myKeys, myValues ); + + // Sorts a section of the Array using the default comparer. + Array::Sort( myKeys, myValues, 1, 3 ); + Console::WriteLine( "After sorting a section of the Array using the default comparer:" ); + + // Sorts a section of the Array using the reverse case-insensitive comparer. + Array::Sort( myKeys, myValues, 1, 3, myComparer ); + Console::WriteLine( "After sorting a section of the Array using the reverse case-insensitive comparer:" ); + PrintKeysAndValues( myKeys, myValues ); + + // Sorts the entire Array using the default comparer. + Array::Sort( myKeys, myValues ); + Console::WriteLine( "After sorting the entire Array using the default comparer:" ); + PrintKeysAndValues( myKeys, myValues ); + + // Sorts the entire Array using the reverse case-insensitive comparer. + Array::Sort( myKeys, myValues, myComparer ); + Console::WriteLine( "After sorting the entire Array using the reverse case-insensitive comparer:" ); + PrintKeysAndValues( myKeys, myValues ); +} + +/* +This code produces the following output. + +The Array initially contains the following values: + red : strawberries + GREEN : PEARS + YELLOW : LIMES + BLUE : BERRIES + purple : grapes + black : olives + orange : cantaloupe + +After sorting a section of the Array using the default comparer: + red : strawberries + BLUE : BERRIES + GREEN : PEARS + YELLOW : LIMES + purple : grapes + black : olives + orange : cantaloupe + +After sorting a section of the Array using the reverse case-insensitive comparer: + red : strawberries + YELLOW : LIMES + GREEN : PEARS + BLUE : BERRIES + purple : grapes + black : olives + orange : cantaloupe + +After sorting the entire Array using the default comparer: + black : olives + BLUE : BERRIES + GREEN : PEARS + orange : cantaloupe + purple : grapes + red : strawberries + YELLOW : LIMES + +After sorting the entire Array using the reverse case-insensitive comparer: + YELLOW : LIMES + red : strawberries + purple : grapes + orange : cantaloupe + GREEN : PEARS + BLUE : BERRIES + black : olives + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp new file mode 100644 index 00000000000..8133ae99134 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array.SyncRoot/cpp/source.cpp @@ -0,0 +1,22 @@ +using namespace System; +using namespace System::Threading; + +int main() +{ +// + Array^ myArray = gcnew array { 1, 2, 4 }; + try + { + Monitor::Enter(myArray->SyncRoot); + + for each (Int32 item in myArray) + Console::WriteLine(item); + } + finally + { + Monitor::Exit(myArray->SyncRoot); + } +// + + return 1; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp new file mode 100644 index 00000000000..f8fd837a057 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.ArraySegment/CPP/arraysegment.cpp @@ -0,0 +1,126 @@ +// The following code example passes an ArraySegment to a method. + +// +using namespace System; + + +namespace Sample +{ + public ref class SampleArray + { + public: + static void Work() + { + + // Create and initialize a new string array. + array ^ words = {"The", "quick", "brown", + "fox", "jumps", "over", "the", "lazy", "dog"}; + + // Display the initial contents of the array. + Console::WriteLine("The first array segment" + " (with all the array's elements) contains:"); + PrintIndexAndValues(words); + + // Define an array segment that contains the entire array. + ArraySegment segment(words); + + // Display the contents of the ArraySegment. + Console::WriteLine("The first array segment" + " (with all the array's elements) contains:"); + PrintIndexAndValues(segment); + + // Define an array segment that contains the middle five + // values of the array. + ArraySegment middle(words, 2, 5); + + // Display the contents of the ArraySegment. + Console::WriteLine("The second array segment" + " (with the middle five elements) contains:"); + PrintIndexAndValues(middle); + + // Modify the fourth element of the first array + // segment + segment.Array[3] = "LION"; + + // Display the contents of the second array segment + // middle. Note that the value of its second element + // also changed. + Console::WriteLine("After the first array segment" + " is modified,the second array segment" + " now contains:"); + PrintIndexAndValues(middle); + Console::ReadLine(); + } + + static void PrintIndexAndValues(ArraySegment^ segment) + { + for (int i = segment->Offset; + i < (segment->Offset + segment->Count); i++) + { + Console::WriteLine(" [{0}] : {1}", i, + segment->Array[i]); + } + Console::WriteLine(); + } + + static void PrintIndexAndValues(array^ words) + { + for (int i = 0; i < words->Length; i++) + { + Console::WriteLine(" [{0}] : {1}", i, + words[i]); + } + Console::WriteLine(); + } + }; +} + +int main() +{ + Sample::SampleArray::Work(); + return 0; +} + + + /* + This code produces the following output. + + The original array initially contains: + [0] : The + [1] : quick + [2] : brown + [3] : fox + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + + The first array segment (with all the array's elements) contains: + [0] : The + [1] : quick + [2] : brown + [3] : fox + [4] : jumps + [5] : over + [6] : the + [7] : lazy + [8] : dog + + The second array segment (with the middle five elements) contains: + [2] : brown + [3] : fox + [4] : jumps + [5] : over + [6] : the + + After the first array segment is modified, the second array segment now contains: + [2] : brown + [3] : LION + [4] : jumps + [5] : over + [6] : the + + */ + + // diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp new file mode 100644 index 00000000000..2f0f4ea3c86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.ArrayTypeMismatch/CPP/class1.cpp @@ -0,0 +1,68 @@ + +// +using namespace System; +int main() +{ + array^names = { "Dog", "Cat", "Fish"}; + array^objs = dynamic_cast^>(names); + try + { + objs[ 2 ] = (Object^)"Mouse"; + for ( Int32 i = 0; i < objs->Length; i++ ) + { + Console::WriteLine( objs[ i ] ); + + } + } + catch ( System::ArrayTypeMismatchException^ ) + { + + // Not reached, "Mouse" is of the correct type + Console::WriteLine( "Exception Thrown" ); + } + + try + { + Object^ obj = 13; + objs[ 2 ] = obj; + } + catch ( System::ArrayTypeMismatchException^ ) + { + + // Always reached, 13 is not a string. + Console::WriteLine( "New element is not of the correct type" ); + } + + + // Set obj to an array of objects instead of an array of strings + array^objs2 = gcnew array(3); + try + { + objs2[ 0 ] = (Object^)"Turtle"; + objs2[ 1 ] = 12; + objs2[ 2 ] = 2.341; + for ( Int32 i = 0; i < objs->Length; i++ ) + { + Console::WriteLine( objs2[ i ] ); + + } + } + catch ( System::ArrayTypeMismatchException^ ) + { + + // ArrayTypeMismatchException is not thrown this time. + Console::WriteLine( "Exception Thrown" ); + } + +} + +/*expected return values: +Dog +Cat +Mouse +New element is not of the correct type +Turtle +12 +2.341 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp new file mode 100644 index 00000000000..63f0c9c330c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetEnumerator/CPP/array_getenumerator.cpp @@ -0,0 +1,42 @@ +// The following example shows how to use GetEnumerator to list the elements of an array. +// +using namespace System; + +int main() +{ + // Creates and initializes a new Array. + array^myArr = gcnew array(10); + myArr[ 0 ] = "The"; + myArr[ 1 ] = "quick"; + myArr[ 2 ] = "brown"; + myArr[ 3 ] = "fox"; + myArr[ 4 ] = "jumps"; + myArr[ 5 ] = "over"; + myArr[ 6 ] = "the"; + myArr[ 7 ] = "lazy"; + myArr[ 8 ] = "dog"; + + // Displays the values of the Array. + int i = 0; + System::Collections::IEnumerator^ myEnumerator = myArr->GetEnumerator(); + Console::WriteLine( "The Array contains the following values:" ); + while ( (myEnumerator->MoveNext()) && (myEnumerator->Current != nullptr) ) + Console::WriteLine( "[{0}] {1}", i++, myEnumerator->Current ); +} + +/* +This code produces the following output. + +The Array contains the following values: +[0] The +[1] quick +[2] brown +[3] fox +[4] jumps +[5] over +[6] the +[7] lazy +[8] dog + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp new file mode 100644 index 00000000000..bdfd647373c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Array_GetSetValue/CPP/array_getsetvalue.cpp @@ -0,0 +1,47 @@ + +// The following code example demonstrates how to set and get a specific value in a one-dimensional or multidimensional array. +// +using namespace System; +int main() +{ + + // Creates and initializes a one-dimensional array. + array^myArr1 = gcnew array(5); + + // Sets the element at index 3. + myArr1->SetValue( "three", 3 ); + Console::WriteLine( "[3]: {0}", myArr1->GetValue( 3 ) ); + + // Creates and initializes a two-dimensional array. + array^myArr2 = gcnew array(5,5); + + // Sets the element at index 1,3. + myArr2->SetValue( "one-three", 1, 3 ); + Console::WriteLine( "[1,3]: {0}", myArr2->GetValue( 1, 3 ) ); + + // Creates and initializes a three-dimensional array. + array^myArr3 = gcnew array(5,5,5); + + // Sets the element at index 1,2,3. + myArr3->SetValue( "one-two-three", 1, 2, 3 ); + Console::WriteLine( "[1,2,3]: {0}", myArr3->GetValue( 1, 2, 3 ) ); + + // Creates and initializes a seven-dimensional array. + array^myArr7 = gcnew array(5,5,5,5,5,5,5); + + // Sets the element at index 1,2,3,0,1,2,3. + array^myIndices = {1,2,3,0,1,2,3}; + myArr7->SetValue( "one-two-three-zero-one-two-three", myIndices ); + Console::WriteLine( "[1,2,3,0,1,2,3]: {0}", myArr7->GetValue( myIndices ) ); +} + +/* +This code produces the following output. + +[3]: three +[1,3]: one-three +[1,2,3]: one-two-three +[1,2,3,0,1,2,3]: one-two-three-zero-one-two-three + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp new file mode 100644 index 00000000000..e14da9f2add --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.Equals/CPP/equals.cpp @@ -0,0 +1,124 @@ + +using namespace System; +using namespace System::Reflection; + + // Define a custom parameter attribute that takes a single message argument. + +[AttributeUsage(AttributeTargets::Parameter)] +public ref class ArgumentUsageAttribute: public Attribute +{ + protected: + // usageMsg is storage for the attribute message. + String^ usageMsg; + + public: + // This is the attribute constructor. + ArgumentUsageAttribute( String^ UsageMsg ) + { + this->usageMsg = UsageMsg; + } + + + // Override ToString() to append the message to what the base generates. + virtual String^ ToString() override + { + return String::Concat( Attribute::ToString(), ":", usageMsg ); + } +} ; + + + // Define a custom parameter attribute that generates a GUID for each instance. +[AttributeUsage(AttributeTargets::Parameter)] +public ref class ArgumentIDAttribute : Attribute +{ + protected: + // instanceGUID is storage for the generated GUID. + Guid instanceGUID; + + public: + // This is the attribute constructor, which generates the GUID. + ArgumentIDAttribute() + { + this->instanceGUID = Guid::NewGuid(); + } + + // Override ToString() to append the GUID to what the base generates. + virtual String^ ToString() override + { + return String::Concat( Attribute::ToString(), ".", instanceGUID.ToString() ); + } +}; + +public ref class TestClass +{ + public: + // Assign an ArgumentID attribute to each parameter. + // Assign an ArgumentUsage attribute to each parameter. + void TestMethod( [ArgumentID][ArgumentUsage("Must pass an array here.")]array^strArray, + [ArgumentID][ArgumentUsage("Can pass param list or array here.")]array^strList ){} +}; + +int main() +{ + // Get the class type, and then get the MethodInfo object + // for TestMethod to access its metadata. + Type^ clsType = TestClass::typeid; + MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); + + // There will be two elements in pInfoArray, one for each parameter. + array^pInfoArray = mInfo->GetParameters(); + if (pInfoArray != nullptr) + { + // Create an instance of the argument usage attribute on strArray. + ArgumentUsageAttribute^ arrayUsageAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); + + // Create another instance of the argument usage attribute on strArray. + ArgumentUsageAttribute^ arrayUsageAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); + + // Create an instance of the argument usage attribute on strList. + ArgumentUsageAttribute^ listUsageAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentUsageAttribute::typeid )); + + // Create an instance of the argument ID attribute on strArray. + ArgumentIDAttribute^ arrayIDAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentIDAttribute::typeid )); + + // Create another instance of the argument ID attribute on strArray. + ArgumentIDAttribute^ arrayIDAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentIDAttribute::typeid )); + + // Create an instance of the argument ID attribute on strList. + ArgumentIDAttribute^ listIDAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentIDAttribute::typeid )); + + // Compare various pairs of attributes for equality. + Console::WriteLine( "\nCompare a usage attribute instance to " + "another instance of the same attribute:" ); + Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayUsageAttr1->ToString(), arrayUsageAttr2->ToString(), arrayUsageAttr1->Equals( arrayUsageAttr2 ) ); + Console::WriteLine( "\nCompare a usage attribute to another usage attribute:" ); + Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayUsageAttr1->ToString(), listUsageAttr->ToString(), arrayUsageAttr1->Equals( listUsageAttr ) ); + Console::WriteLine( "\nCompare an ID attribute instance to " + "another instance of the same attribute:" ); + Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayIDAttr1->ToString(), arrayIDAttr2->ToString(), arrayIDAttr1->Equals( arrayIDAttr2 ) ); + Console::WriteLine( "\nCompare an ID attribute to another ID attribute:" ); + Console::WriteLine( " \"{0}\" == \n \"{1}\" ? {2}", arrayIDAttr1->ToString(), listIDAttr->ToString(), arrayIDAttr1->Equals( listIDAttr ) ); + } + else + { + Console::WriteLine( "The parameters information could not be retrieved for method {0}.", mInfo->Name ); + } +} +/* +The example displays an output similar to the following: + Compare a usage attribute instance to another instance of the same attribute: + "ArgumentUsageAttribute:Must pass an array here." == + "ArgumentUsageAttribute:Must pass an array here." ? True + + Compare a usage attribute to another usage attribute: + "ArgumentUsageAttribute:Must pass an array here." == + "ArgumentUsageAttribute:Can pass param list or array here." ? False + + Compare an ID attribute instance to another instance of the same attribute: + "ArgumentIDAttribute.22d1a176-4aca-427b-8230-0c1563e13187" == + "ArgumentIDAttribute.7fa94bba-c290-48e1-a0de-e22f6c1e64f1" ? False + + Compare an ID attribute to another ID attribute: + "ArgumentIDAttribute.22d1a176-4aca-427b-8230-0c1563e13187" == + "ArgumentIDAttribute.b9eea70d-9c0f-459e-a984-19c46b6c8789" ? False +*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp new file mode 100644 index 00000000000..b5764d952ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrparam.cpp @@ -0,0 +1,130 @@ + +// +// Example for the Attribute::GetCustomAttribute( ParameterInfo*, Type* ) +// method. +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; + +namespace NDP_UE_CPP +{ + + // + // Define a custom parameter attribute that takes a single message argument. + + [AttributeUsage(AttributeTargets::Parameter)] + public ref class ArgumentUsageAttribute: public Attribute + { + protected: + + // usageMsg is storage for the attribute message. + String^ usageMsg; + + public: + + // This is the attribute constructor. + ArgumentUsageAttribute( String^ UsageMsg ) + { + this->usageMsg = UsageMsg; + } + + + property String^ Message + { + // This is the Message property for the attribute. + String^ get() + { + return usageMsg; + } + + void set( String^ value ) + { + this->usageMsg = value; + } + } + }; + // + + public ref class BaseClass + { + public: + + // Assign an ArgumentUsage attribute to the strArray parameter. + // Assign a ParamArray attribute to strList. + virtual void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, + ...array^strList ){} + }; + + public ref class DerivedClass: public BaseClass + { + public: + + // Assign an ArgumentUsage attributes to the strList parameter. + virtual void TestMethod( array^strArray, [ArgumentUsage( + "Can pass a parameter list or array here.")]array^strList ) override {} + }; +} + +int main() +{ + Console::WriteLine( "This example of Attribute::GetCustomAttribute( Param" + "eterInfo*, Type* )\ngenerates the following output." ); + + // Get the class type, and then get the MethodInfo object + // for TestMethod to access its metadata. + Type^ clsType = NDP_UE_CPP::DerivedClass::typeid; + MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); + + // Iterate through the ParameterInfo array for the method parameters. + array^pInfoArray = mInfo->GetParameters(); + if ( pInfoArray != nullptr ) + { + // This implements foreach( ParameterInfo* paramInfo in pInfoArray ). + IEnumerator^ myEnum = pInfoArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + ParameterInfo^ paramInfo = safe_cast(myEnum->Current); + + // See if the ParamArray attribute is defined. + bool isDef = Attribute::IsDefined( paramInfo, ParamArrayAttribute::typeid ); + if ( isDef ) + Console::WriteLine( "\nThe ParamArray attribute is defined for \n" + "parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); + + // See if ParamUsageAttribute is defined. + // If so, display a message. + NDP_UE_CPP::ArgumentUsageAttribute^ usageAttr = static_cast(Attribute::GetCustomAttribute( paramInfo, NDP_UE_CPP::ArgumentUsageAttribute::typeid )); + if ( usageAttr != nullptr ) + { + Console::WriteLine( "\nThe ArgumentUsage attribute is defined for \n" + "parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); + Console::WriteLine( "\n The usage " + "message for {0} is:\n \"{1}\".", paramInfo->Name, usageAttr->Message ); + } + } + } + else + Console::WriteLine( "The parameters information could " + "not be retrieved for method {0}.", mInfo->Name ); +} + +/* +This example of Attribute::GetCustomAttribute( ParameterInfo*, Type* ) +generates the following output. + +The ArgumentUsage attribute is defined for +parameter strArray of method TestMethod. + + The usage message for strArray is: + "Must pass an array here.". + +The ParamArray attribute is defined for +parameter strList of method TestMethod. + +The ArgumentUsage attribute is defined for +parameter strList of method TestMethod. + + The usage message for strList is: + "Can pass a parameter list or array here.". +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp new file mode 100644 index 00000000000..8197cb5c956 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.GetCustomAttribute/CPP/getcustattrprminh.cpp @@ -0,0 +1,152 @@ + +// +// Example for the Attribute::GetCustomAttribute( ParameterInfo*, Type*, bool ) +// method. +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; + +namespace NDP_UE_CPP +{ + // Define a custom parameter attribute that takes a single message argument. + + [AttributeUsage(AttributeTargets::Parameter)] + public ref class ArgumentUsageAttribute: public Attribute + { + protected: + + // usageMsg is storage for the attribute message. + String^ usageMsg; + + public: + + // This is the attribute constructor. + ArgumentUsageAttribute( String^ UsageMsg ) + { + this->usageMsg = UsageMsg; + } + + property String^ Message + { + // This is the Message property for the attribute. + String^ get() + { + return usageMsg; + } + + void set( String^ value ) + { + this->usageMsg = value; + } + } + }; + + public ref class BaseClass + { + public: + + // Assign an ArgumentUsage attribute to the strArray parameter. + // Assign a ParamArray attribute to strList. + virtual void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, + ...array^strList ){} + }; + + public ref class DerivedClass: public BaseClass + { + public: + + // Assign an ArgumentUsage attributes to the strList parameter. + virtual void TestMethod( array^strArray, [ArgumentUsage( + "Can pass a parameter list or array here.")]array^strList ) override {} + + }; + + void DisplayParameterAttributes( MethodInfo^ mInfo, array^pInfoArray, bool includeInherited ) + { + Console::WriteLine( "\nParameter attribute information for method \"{0}" + "\"\nincludes inheritance from base class: {1}.", mInfo->Name, includeInherited ? (String^)"Yes" : "No" ); + + // This implements foreach( ParameterInfo* paramInfo in pInfoArray ). + IEnumerator^ myEnum = pInfoArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + ParameterInfo^ paramInfo = safe_cast(myEnum->Current); + + // See if the ParamArray attribute is defined. + bool isDef = Attribute::IsDefined( paramInfo, ParamArrayAttribute::typeid ); + if ( isDef ) + Console::WriteLine( "\n The ParamArray attribute is defined " + "for \n parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); + + // See if ParamUsageAttribute is defined. + // If so, display a message. + ArgumentUsageAttribute^ usageAttr = static_cast(Attribute::GetCustomAttribute( paramInfo, ArgumentUsageAttribute::typeid, includeInherited )); + if ( usageAttr != nullptr ) + { + Console::WriteLine( "\n The ArgumentUsage attribute is defined " + "for \n parameter {0} of method {1}.", paramInfo->Name, mInfo->Name ); + Console::WriteLine( "\n The usage " + "message for {0} is:\n \"{1}\".", paramInfo->Name, usageAttr->Message ); + } + } + } + +} + +int main() +{ + Console::WriteLine( "This example of Attribute::GetCustomAttribute( ParameterInfo*, " + "Type*, bool )\ngenerates the following output." ); + + // Get the class type, and then get the MethodInfo object + // for TestMethod to access its metadata. + Type^ clsType = NDP_UE_CPP::DerivedClass::typeid; + MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); + + // Iterate through the ParameterInfo array for the method parameters. + array^pInfoArray = mInfo->GetParameters(); + if ( pInfoArray != nullptr ) + { + NDP_UE_CPP::DisplayParameterAttributes( mInfo, pInfoArray, false ); + NDP_UE_CPP::DisplayParameterAttributes( mInfo, pInfoArray, true ); + } + else + Console::WriteLine( "The parameters information could " + "not be retrieved for method {0}.", mInfo->Name ); +} + +/* +This example of Attribute::GetCustomAttribute( ParameterInfo*, Type*, bool ) +generates the following output. + +Parameter attribute information for method "TestMethod" +includes inheritance from base class: No. + + The ParamArray attribute is defined for + parameter strList of method TestMethod. + + The ArgumentUsage attribute is defined for + parameter strList of method TestMethod. + + The usage message for strList is: + "Can pass a parameter list or array here.". + +Parameter attribute information for method "TestMethod" +includes inheritance from base class: Yes. + + The ArgumentUsage attribute is defined for + parameter strArray of method TestMethod. + + The usage message for strArray is: + "Must pass an array here.". + + The ParamArray attribute is defined for + parameter strList of method TestMethod. + + The ArgumentUsage attribute is defined for + parameter strList of method TestMethod. + + The usage message for strList is: + "Can pass a parameter list or array here.". +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp new file mode 100644 index 00000000000..9cfaa32643e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Attribute.TypeId/CPP/typeid.cpp @@ -0,0 +1,136 @@ + +// +// Example for the Attribute::TypeId property. +using namespace System; +using namespace System::Reflection; + +namespace NDP_UE_CPP +{ + + // Define a custom parameter attribute that takes a single message argument. + + [AttributeUsage(AttributeTargets::Parameter)] + public ref class ArgumentUsageAttribute: public Attribute + { + protected: + + // This is storage for the attribute message and unique ID. + String^ usageMsg; + Guid instanceGUID; + + public: + + // The constructor saves the message and creates a unique identifier. + ArgumentUsageAttribute( String^ UsageMsg ) + { + this->usageMsg = UsageMsg; + this->instanceGUID = Guid::NewGuid(); + } + + property String^ Message + { + // This is the Message property for the attribute. + String^ get() + { + return usageMsg; + } + + void set( String^ value ) + { + this->usageMsg = value; + } + } + + property Object^ TypeId + { + // Override TypeId to provide a unique identifier for the instance. + virtual Object^ get() override + { + return instanceGUID; + } + } + + // Override ToString() to append the message to + // what the base generates. + virtual String^ ToString() override + { + return String::Concat( Attribute::ToString(), ":", usageMsg ); + } + }; + + public ref class TestClass + { + public: + + // Assign an ArgumentUsage attribute to each parameter. + // Assign a ParamArray attribute to strList. + void TestMethod( [ArgumentUsage("Must pass an array here.")]array^strArray, + [ArgumentUsage("Can pass a param list or array here.")]array^strList ){} + }; + + static void ShowAttributeTypeIds() + { + // Get the class type, and then get the MethodInfo object + // for TestMethod to access its metadata. + Type^ clsType = TestClass::typeid; + MethodInfo^ mInfo = clsType->GetMethod( "TestMethod" ); + + // There will be two elements in pInfoArray, one for each parameter. + array^pInfoArray = mInfo->GetParameters(); + if ( pInfoArray != nullptr ) + { + // Create an instance of the param array attribute on strList. + ParamArrayAttribute^ listArrayAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ParamArrayAttribute::typeid )); + + // Create an instance of the argument usage attribute on strArray. + ArgumentUsageAttribute^ arrayUsageAttr1 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); + + // Create another instance of the argument usage attribute + // on strArray. + ArgumentUsageAttribute^ arrayUsageAttr2 = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 0 ], ArgumentUsageAttribute::typeid )); + + // Create an instance of the argument usage attribute on strList. + ArgumentUsageAttribute^ listUsageAttr = static_cast(Attribute::GetCustomAttribute( pInfoArray[ 1 ], ArgumentUsageAttribute::typeid )); + + // Display the attributes and corresponding TypeId values. + Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", listArrayAttr->ToString(), listArrayAttr->TypeId ); + Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", arrayUsageAttr1->ToString(), arrayUsageAttr1->TypeId ); + Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", arrayUsageAttr2->ToString(), arrayUsageAttr2->TypeId ); + Console::WriteLine( "\n\"{0}\" \nTypeId: {1}", listUsageAttr->ToString(), listUsageAttr->TypeId ); + } + else + Console::WriteLine( "The parameters information could " + "not be retrieved for method {0}.", mInfo->Name ); + } +} + +int main() +{ + Console::WriteLine( "This example of the Attribute::TypeId property\n" + "generates the following output." ); + Console::WriteLine( "\nCreate instances from a derived Attribute " + "class that implements TypeId, \nand then " + "display the attributes and corresponding TypeId values:" ); + NDP_UE_CPP::ShowAttributeTypeIds(); +} + +/* +This example of the Attribute::TypeId property +generates output similar to the following: + +Create instances from a derived Attribute class that implements TypeId, +and then display the attributes and corresponding TypeId values: + +"System.ParamArrayAttribute" +TypeId: System.ParamArrayAttribute + +"NDP_UE_CPP.ArgumentUsageAttribute:Must pass an array here." +TypeId: 9316015d-1219-4ce1-b317-e71efb23d42e + +"NDP_UE_CPP.ArgumentUsageAttribute:Must pass an array here." +TypeId: ebc1ba23-2573-4c1f-aea6-90515e733796 + +"NDP_UE_CPP.ArgumentUsageAttribute:Can pass a param list or array here." +TypeId: 624af10b-9bba-4403-a97e-46927e7385fb +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp new file mode 100644 index 00000000000..b6498b4a22a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/bitconv.cpp @@ -0,0 +1,44 @@ + +// +// Example of BitConverter class methods. +using namespace System; +int main() +{ + String^ formatter = "{0,25}{1,30}"; + double aDoubl = 0.1111111111111111111; + float aSingl = 0.1111111111111111111F; + __int64 aLong = 1111111111111111111; + int anInt = 1111111111; + short aShort = 11111; + __wchar_t aChar = L'*'; + bool aBool = true; + Console::WriteLine( "This example of methods of the BitConverter class" + "\ngenerates the following output.\n" ); + Console::WriteLine( formatter, "argument", "byte array" ); + Console::WriteLine( formatter, "--------", "----------" ); + + // Convert values to Byte arrays and display them. + Console::WriteLine( formatter, aDoubl, BitConverter::ToString( BitConverter::GetBytes( aDoubl ) ) ); + Console::WriteLine( formatter, aSingl, BitConverter::ToString( BitConverter::GetBytes( aSingl ) ) ); + Console::WriteLine( formatter, aLong, BitConverter::ToString( BitConverter::GetBytes( aLong ) ) ); + Console::WriteLine( formatter, anInt, BitConverter::ToString( BitConverter::GetBytes( anInt ) ) ); + Console::WriteLine( formatter, aShort, BitConverter::ToString( BitConverter::GetBytes( aShort ) ) ); + Console::WriteLine( formatter, aChar, BitConverter::ToString( BitConverter::GetBytes( aChar ) ) ); + Console::WriteLine( formatter, aBool, BitConverter::ToString( BitConverter::GetBytes( aBool ) ) ); +} + +/* +This example of methods of the BitConverter class +generates the following output. + + argument byte array + -------- ---------- + 0.111111111111111 1C-C7-71-1C-C7-71-BC-3F + 0.1111111 39-8E-E3-3D + 1111111111111111111 C7-71-C4-2B-AB-75-6B-0F + 1111111111 C7-35-3A-42 + 11111 67-2B + * 2A-00 + True 01 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp new file mode 100644 index 00000000000..57627564464 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.Class/CPP/littleend.cpp @@ -0,0 +1,19 @@ + +// +// Example of the BitConverter::IsLittleEndian field. +using namespace System; +int main() +{ + Console::WriteLine( "This example of the BitConverter::IsLittleEndian field " + "generates \nthe following output when run on " + "x86-class computers.\n" ); + Console::WriteLine( "IsLittleEndian: {0}", BitConverter::IsLittleEndian ); +} + +/* +This example of the BitConverter::IsLittleEndian field generates +the following output when run on x86-class computers. + +IsLittleEndian: True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp new file mode 100644 index 00000000000..011dda5201d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/bitstodbl.cpp @@ -0,0 +1,67 @@ + +// +// Example of the BitConverter::Int64BitsToDouble method. +using namespace System; + +// Reinterpret the __int64 argument as a double. +void LongBitsToDouble( __int64 argument ) +{ + double doubleValue; + doubleValue = BitConverter::Int64BitsToDouble( argument ); + + // Display the argument in hexadecimal. + Console::WriteLine( "{0,20}{1,27:E16}", String::Format( "0x{0:X16}", argument ), doubleValue ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::Int64BitsToDouble( " + "__int64 ) \nmethod generates the following output.\n" ); + Console::WriteLine( "{0,20}{1,27:E16}", "__int64 argument", "double value" ); + Console::WriteLine( "{0,20}{1,27:E16}", "----------------", "------------" ); + + // Convert __int64 values and display the results. + LongBitsToDouble( 0 ); + LongBitsToDouble( 0x3FF0000000000000 ); + LongBitsToDouble( 0x402E000000000000 ); + LongBitsToDouble( 0x406FE00000000000 ); + LongBitsToDouble( 0x41EFFFFFFFE00000 ); + LongBitsToDouble( 0x3F70000000000000 ); + LongBitsToDouble( 0x3DF0000000000000 ); + LongBitsToDouble( 0x0000000000000001 ); + LongBitsToDouble( 0x000000000000FFFF ); + LongBitsToDouble( 0x0000FFFFFFFFFFFF ); + LongBitsToDouble( 0xFFFFFFFFFFFFFFFF ); + LongBitsToDouble( 0xFFF0000000000000 ); + LongBitsToDouble( 0x7FF0000000000000 ); + LongBitsToDouble( 0xFFEFFFFFFFFFFFFF ); + LongBitsToDouble( 0x7FEFFFFFFFFFFFFF ); + LongBitsToDouble( Int64::MinValue ); + LongBitsToDouble( Int64::MaxValue ); +} + +/* +This example of the BitConverter::Int64BitsToDouble( __int64 ) +method generates the following output. + + __int64 argument double value + ---------------- ------------ + 0x0000000000000000 0.0000000000000000E+000 + 0x3FF0000000000000 1.0000000000000000E+000 + 0x402E000000000000 1.5000000000000000E+001 + 0x406FE00000000000 2.5500000000000000E+002 + 0x41EFFFFFFFE00000 4.2949672950000000E+009 + 0x3F70000000000000 3.9062500000000000E-003 + 0x3DF0000000000000 2.3283064365386963E-010 + 0x0000000000000001 4.9406564584124654E-324 + 0x000000000000FFFF 3.2378592100206092E-319 + 0x0000FFFFFFFFFFFF 1.3906711615669959E-309 + 0xFFFFFFFFFFFFFFFF NaN + 0xFFF0000000000000 -Infinity + 0x7FF0000000000000 Infinity + 0xFFEFFFFFFFFFFFFF -1.7976931348623157E+308 + 0x7FEFFFFFFFFFFFFF 1.7976931348623157E+308 + 0x8000000000000000 0.0000000000000000E+000 + 0x7FFFFFFFFFFFFFFF NaN +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp new file mode 100644 index 00000000000..347acebc505 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.DoubleInt64/CPP/dbltobits.cpp @@ -0,0 +1,71 @@ + +// +// Example of the BitConverter::DoubleToInt64Bits method. +using namespace System; + +// Reinterpret the double argument as an __int64. +void DoubleToLongBits( double argument ) +{ + __int64 longValue; + longValue = BitConverter::DoubleToInt64Bits( argument ); + + // Display the resulting __int64 in hexadecimal. + Console::WriteLine( "{0,25:E16}{1,23:X16}", argument, longValue ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::DoubleToInt64Bits( " + "double ) \nmethod generates the following output.\n" ); + Console::WriteLine( "{0,25:E16}{1,23:X16}", "double argument", "hexadecimal value" ); + Console::WriteLine( "{0,25:E16}{1,23:X16}", "---------------", "-----------------" ); + + // Convert double values and display the results. + DoubleToLongBits( 1.0 ); + DoubleToLongBits( 15.0 ); + DoubleToLongBits( 255.0 ); + DoubleToLongBits( 4294967295.0 ); + DoubleToLongBits( 0.00390625 ); + DoubleToLongBits( 0.00000000023283064365386962890625 ); + DoubleToLongBits( 1.234567890123E-300 ); + DoubleToLongBits( 1.23456789012345E-150 ); + DoubleToLongBits( 1.2345678901234565 ); + DoubleToLongBits( 1.2345678901234567 ); + DoubleToLongBits( 1.2345678901234569 ); + DoubleToLongBits( 1.23456789012345678E+150 ); + DoubleToLongBits( 1.234567890123456789E+300 ); + DoubleToLongBits( Double::MinValue ); + DoubleToLongBits( Double::MaxValue ); + DoubleToLongBits( Double::Epsilon ); + DoubleToLongBits( Double::NaN ); + DoubleToLongBits( Double::NegativeInfinity ); + DoubleToLongBits( Double::PositiveInfinity ); +} + +/* +This example of the BitConverter::DoubleToInt64Bits( double ) +method generates the following output. + + double argument hexadecimal value + --------------- ----------------- + 1.0000000000000000E+000 3FF0000000000000 + 1.5000000000000000E+001 402E000000000000 + 2.5500000000000000E+002 406FE00000000000 + 4.2949672950000000E+009 41EFFFFFFFE00000 + 3.9062500000000000E-003 3F70000000000000 + 2.3283064365386963E-010 3DF0000000000000 + 1.2345678901230000E-300 01AA74FE1C1E7E45 + 1.2345678901234500E-150 20D02A36586DB4BB + 1.2345678901234565E+000 3FF3C0CA428C59FA + 1.2345678901234567E+000 3FF3C0CA428C59FB + 1.2345678901234569E+000 3FF3C0CA428C59FC + 1.2345678901234569E+150 5F182344CD3CDF9F + 1.2345678901234569E+300 7E3D7EE8BCBBD352 + -1.7976931348623157E+308 FFEFFFFFFFFFFFFF + 1.7976931348623157E+308 7FEFFFFFFFFFFFFF + 4.9406564584124654E-324 0000000000000001 + NaN FFF8000000000000 + -Infinity FFF0000000000000 + Infinity 7FF0000000000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp new file mode 100644 index 00000000000..d6d4ad9fb47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesbool.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; + +int main() +{ + // Define Boolean true and false values. + array^ values = { true, false }; + + // Display the value and its corresponding byte array. + Console::WriteLine("{0,10}{1,16}\n", "Boolean", "Bytes"); + for each (Byte value in values) { + array^ bytes = BitConverter::GetBytes(value); + Console::WriteLine("{0,10}{1,16}", value, + BitConverter::ToString(bytes)); + } +} +// This example displays the following output: +// Boolean Bytes +// +// True 01 +// False 00 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp new file mode 100644 index 00000000000..47d776fe8a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/byteschar.cpp @@ -0,0 +1,46 @@ + +// +// Example of the BitConverter::GetBytes( __wchar_t ) method. +using namespace System; + +// Convert a __wchar_t argument to a byte array and display it. +void GetBytesChar( __wchar_t argument ) +{ + array^byteArray = BitConverter::GetBytes( argument ); + Console::WriteLine( "{0,10}{1,16}", argument, BitConverter::ToString( byteArray ) ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::GetBytes( __wchar_t ) " + "\nmethod generates the following output.\n" ); + Console::WriteLine( "{0,10}{1,16}", "__wchar_t", "byte array" ); + Console::WriteLine( "{0,10}{1,16}", "---------", "----------" ); + + // Convert __wchar_t values and display the results. + GetBytesChar( L'\0' ); + GetBytesChar( L' ' ); + GetBytesChar( L'*' ); + GetBytesChar( L'3' ); + GetBytesChar( L'A' ); + GetBytesChar( L'[' ); + GetBytesChar( L'a' ); + GetBytesChar( L'{' ); +} + +/* +This example of the BitConverter::GetBytes( __wchar_t ) +method generates the following output. + + __wchar_t byte array + --------- ---------- + 00-00 + 20-00 + * 2A-00 + 3 33-00 + A 41-00 + [ 5B-00 + a 61-00 + { 7B-00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp new file mode 100644 index 00000000000..000a26b3a68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytesdouble.cpp @@ -0,0 +1,64 @@ + +// +// Example of the BitConverter::GetBytes( double ) method. +using namespace System; + +// Convert a double argument to a byte array and display it. +void GetBytesDouble( double argument ) +{ + array^byteArray = BitConverter::GetBytes( argument ); + Console::WriteLine( "{0,25:E16}{1,30}", argument, BitConverter::ToString( byteArray ) ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::GetBytes( double ) " + "\nmethod generates the following output.\n" ); + Console::WriteLine( "{0,25:E16}{1,30}", "double", "byte array" ); + Console::WriteLine( "{0,25:E16}{1,30}", "------", "----------" ); + + // Convert double values and display the results. + GetBytesDouble( 0.0 ); + GetBytesDouble( 1.0 ); + GetBytesDouble( 255.0 ); + GetBytesDouble( 4294967295.0 ); + GetBytesDouble( 0.00390625 ); + GetBytesDouble( 0.00000000023283064365386962890625 ); + GetBytesDouble( 1.23456789012345E-300 ); + GetBytesDouble( 1.2345678901234565 ); + GetBytesDouble( 1.2345678901234567 ); + GetBytesDouble( 1.2345678901234569 ); + GetBytesDouble( 1.23456789012345678E+300 ); + GetBytesDouble( Double::MinValue ); + GetBytesDouble( Double::MaxValue ); + GetBytesDouble( Double::Epsilon ); + GetBytesDouble( Double::NaN ); + GetBytesDouble( Double::NegativeInfinity ); + GetBytesDouble( Double::PositiveInfinity ); +} + +/* +This example of the BitConverter::GetBytes( double ) +method generates the following output. + + double byte array + ------ ---------- + 0.0000000000000000E+000 00-00-00-00-00-00-00-00 + 1.0000000000000000E+000 00-00-00-00-00-00-F0-3F + 2.5500000000000000E+002 00-00-00-00-00-E0-6F-40 + 4.2949672950000000E+009 00-00-E0-FF-FF-FF-EF-41 + 3.9062500000000000E-003 00-00-00-00-00-00-70-3F + 2.3283064365386963E-010 00-00-00-00-00-00-F0-3D + 1.2345678901234500E-300 DF-88-1E-1C-FE-74-AA-01 + 1.2345678901234565E+000 FA-59-8C-42-CA-C0-F3-3F + 1.2345678901234567E+000 FB-59-8C-42-CA-C0-F3-3F + 1.2345678901234569E+000 FC-59-8C-42-CA-C0-F3-3F + 1.2345678901234569E+300 52-D3-BB-BC-E8-7E-3D-7E + -1.7976931348623157E+308 FF-FF-FF-FF-FF-FF-EF-FF + 1.7976931348623157E+308 FF-FF-FF-FF-FF-FF-EF-7F + 4.9406564584124654E-324 01-00-00-00-00-00-00-00 + NaN 00-00-00-00-00-00-F8-FF + -Infinity 00-00-00-00-00-00-F0-FF + Infinity 00-00-00-00-00-00-F0-7F +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp new file mode 100644 index 00000000000..c9dbcc43471 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.Others/CPP/bytessingle.cpp @@ -0,0 +1,64 @@ + +// +// Example of the BitConverter::GetBytes( float ) method. +using namespace System; + +// Convert a float argument to a byte array and display it. +void GetBytesSingle( float argument ) +{ + array^byteArray = BitConverter::GetBytes( argument ); + Console::WriteLine( "{0,16:E7}{1,20}", argument, BitConverter::ToString( byteArray ) ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::GetBytes( float ) " + "\nmethod generates the following output.\n" ); + Console::WriteLine( "{0,16:E7}{1,20}", "float", "byte array" ); + Console::WriteLine( "{0,16:E7}{1,20}", "-----", "----------" ); + + // Convert float values and display the results. + GetBytesSingle( 0.0F ); + GetBytesSingle( 1.0F ); + GetBytesSingle( 15.0F ); + GetBytesSingle( 65535.0F ); + GetBytesSingle( 0.00390625F ); + GetBytesSingle( 0.00000000023283064365386962890625F ); + GetBytesSingle( 1.2345E-35F ); + GetBytesSingle( 1.2345671F ); + GetBytesSingle( 1.2345673F ); + GetBytesSingle( 1.2345677F ); + GetBytesSingle( 1.23456789E+35F ); + GetBytesSingle( Single::MinValue ); + GetBytesSingle( Single::MaxValue ); + GetBytesSingle( Single::Epsilon ); + GetBytesSingle( Single::NaN ); + GetBytesSingle( Single::NegativeInfinity ); + GetBytesSingle( Single::PositiveInfinity ); +} + +/* +This example of the BitConverter::GetBytes( float ) +method generates the following output. + + float byte array + ----- ---------- + 0.0000000E+000 00-00-00-00 + 1.0000000E+000 00-00-80-3F + 1.5000000E+001 00-00-70-41 + 6.5535000E+004 00-FF-7F-47 + 3.9062500E-003 00-00-80-3B + 2.3283064E-010 00-00-80-2F + 1.2345000E-035 49-46-83-05 + 1.2345671E+000 4B-06-9E-3F + 1.2345673E+000 4D-06-9E-3F + 1.2345676E+000 50-06-9E-3F + 1.2345679E+035 1E-37-BE-79 + -3.4028235E+038 FF-FF-7F-FF + 3.4028235E+038 FF-FF-7F-7F + 1.4012985E-045 01-00-00-00 + NaN 00-00-C0-FF + -Infinity 00-00-80-FF + Infinity 00-00-80-7F +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp new file mode 100644 index 00000000000..85dfd8f960e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint16.cpp @@ -0,0 +1,32 @@ +// +using namespace System; + +void main() +{ + // Define an array of integers. + array^ values = { 0, 15, -15, 10000, -10000, + Int16::MinValue, Int16::MaxValue}; + + // Convert each integer to a byte array. + Console::WriteLine("{0,16}{1,10}{2,17}", "Integer", + "Endian", "Byte Array"); + Console::WriteLine("{0,16}{1,10}{2,17}", "---", "------", + "----------"); + for each (int value in values) { + array^ byteArray = BitConverter::GetBytes(value); + Console::WriteLine("{0,16}{1,10}{2,17}", value, + BitConverter::IsLittleEndian ? "Little" : " Big", + BitConverter::ToString(byteArray)); + } +} +// This example displays output like the following: +// Integer Endian Byte Array +// --- ------ ---------- +// 0 Little 00-00 +// 15 Little 0F-00 +// -15 Little F1-FF +// 10000 Little 10-27 +// -10000 Little F0-D8 +// -32768 Little 00-80 +// 32767 Little FF-7F +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp new file mode 100644 index 00000000000..f1a781ff180 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint32.cpp @@ -0,0 +1,34 @@ +// +using namespace System; + +void main() +{ + // Define an array of integers. + array^ values = { 0, 15, -15, 0x100000, -0x100000, 1000000000, + -1000000000, Int32::MinValue, Int32::MaxValue }; + + // Convert each integer to a byte array. + Console::WriteLine("{0,16}{1,10}{2,17}", "Integer", + "Endian", "Byte Array"); + Console::WriteLine("{0,16}{1,10}{2,17}", "---", "------", + "----------" ); + for each (int value in values) { + array^ byteArray = BitConverter::GetBytes(value); + Console::WriteLine("{0,16}{1,10}{2,17}", value, + BitConverter::IsLittleEndian ? "Little" : " Big", + BitConverter::ToString(byteArray)); + } +} +// This example displays output like the following: +// Integer Endian Byte Array +// --- ------ ---------- +// 0 Little 00-00-00-00 +// 15 Little 0F-00-00-00 +// -15 Little F1-FF-FF-FF +// 1048576 Little 00-00-10-00 +// -1048576 Little 00-00-F0-FF +// 1000000000 Little 00-CA-9A-3B +// -1000000000 Little 00-36-65-C4 +// -2147483648 Little 00-00-00-80 +// 2147483647 Little FF-FF-FF-7F +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp new file mode 100644 index 00000000000..dace2c6c7a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.SInts/CPP/bytesint64.cpp @@ -0,0 +1,42 @@ + +// +using namespace System; + +void main() +{ + // Define an array of Int64 values. + array^ values = { 0, 0xFFFFFF, -0xFFFFFF, 1000000000, -1000000000, + 0x100000000, -0x100000000, 0xAAAAAAAAAAAA, + -0xAAAAAAAAAAAA, 1000000000000000000, + -1000000000000000000, Int64::MinValue, + Int64::MaxValue}; + + Console::WriteLine( "{0,22}{1,10}{2,30}", "Int64", "Endian", "Byte Array"); + Console::WriteLine( "{0,22}{1,10}{2,30}", "----", "------", "----------"); + + for each (Int64 value in values) { + // Convert each Int64 value to a byte array. + array^ byteArray = BitConverter::GetBytes(value); + // Display the result. + Console::WriteLine("{0,22}{1,10}{2,30}", value, + BitConverter::IsLittleEndian ? "Little" : " Big", + BitConverter::ToString(byteArray)); + } +} +// The example displays output like the following: +// Int64 Endian Byte Array +// ---- ------ ---------- +// 0 Little 00-00-00-00-00-00-00-00 +// 16777215 Little FF-FF-FF-00-00-00-00-00 +// -16777215 Little 01-00-00-FF-FF-FF-FF-FF +// 1000000000 Little 00-CA-9A-3B-00-00-00-00 +// -1000000000 Little 00-36-65-C4-FF-FF-FF-FF +// 4294967296 Little 00-00-00-00-01-00-00-00 +// -4294967296 Little 00-00-00-00-FF-FF-FF-FF +// 187649984473770 Little AA-AA-AA-AA-AA-AA-00-00 +// -187649984473770 Little 56-55-55-55-55-55-FF-FF +// 1000000000000000000 Little 00-00-64-A7-B3-B6-E0-0D +// -1000000000000000000 Little 00-00-9C-58-4C-49-1F-F2 +// -9223372036854775808 Little 00-00-00-00-00-00-00-80 +// 9223372036854775807 Little FF-FF-FF-FF-FF-FF-FF-7F +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp new file mode 100644 index 00000000000..5ec8af9b911 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint16.cpp @@ -0,0 +1,42 @@ + +// +// Example of the BitConverter::GetBytes( unsigned short ) method. +using namespace System; + +// Convert an unsigned short argument to a byte array and display it. +void GetBytesUInt16( unsigned short argument ) +{ + array^byteArray = BitConverter::GetBytes( argument ); + Console::WriteLine( "{0,14}{1,13}", argument, BitConverter::ToString( byteArray ) ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " + "short ) \nmethod generates the following output.\n" ); + Console::WriteLine( "{0,14}{1,13}", "unsigned short", "byte array" ); + Console::WriteLine( "{0,14}{1,13}", "--------------", "----------" ); + + // Convert unsigned short values and display the results. + GetBytesUInt16( 15 ); + GetBytesUInt16( 1023 ); + GetBytesUInt16( 10000 ); + GetBytesUInt16( UInt16::MinValue ); + GetBytesUInt16( Int16::MaxValue ); + GetBytesUInt16( UInt16::MaxValue ); +} + +/* +This example of the BitConverter::GetBytes( unsigned short ) +method generates the following output. + +unsigned short byte array +-------------- ---------- + 15 0F-00 + 1023 FF-03 + 10000 10-27 + 0 00-00 + 32767 FF-7F + 65535 FF-FF +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp new file mode 100644 index 00000000000..e7017024141 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint32.cpp @@ -0,0 +1,44 @@ + +// +// Example of the BitConverter::GetBytes( unsigned int ) method. +using namespace System; + +// Convert an unsigned int argument to a byte array and display it. +void GetBytesUInt32( unsigned int argument ) +{ + array^byteArray = BitConverter::GetBytes( argument ); + Console::WriteLine( "{0,16}{1,20}", argument, BitConverter::ToString( byteArray ) ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " + "int ) \nmethod generates the following output.\n" ); + Console::WriteLine( "{0,16}{1,20}", "unsigned int", "byte array" ); + Console::WriteLine( "{0,16}{1,20}", "------------", "----------" ); + + // Convert unsigned int values and display the results. + GetBytesUInt32( 15 ); + GetBytesUInt32( 1023 ); + GetBytesUInt32( 0x100000 ); + GetBytesUInt32( 1000000000 ); + GetBytesUInt32( UInt32::MinValue ); + GetBytesUInt32( Int32::MaxValue ); + GetBytesUInt32( UInt32::MaxValue ); +} + +/* +This example of the BitConverter::GetBytes( unsigned int ) +method generates the following output. + + unsigned int byte array + ------------ ---------- + 15 0F-00-00-00 + 1023 FF-03-00-00 + 1048576 00-00-10-00 + 1000000000 00-CA-9A-3B + 0 00-00-00-00 + 2147483647 FF-FF-FF-7F + 4294967295 FF-FF-FF-FF +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp new file mode 100644 index 00000000000..7c94f1c6895 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.GetBytes.UInts/CPP/bytesuint64.cpp @@ -0,0 +1,48 @@ + +// +// Example of the BitConverter::GetBytes( unsigned __int64 ) method. +using namespace System; + +// Convert an unsigned __int64 argument to a byte array and display it. +void GetBytesUInt64( unsigned __int64 argument ) +{ + array^byteArray = BitConverter::GetBytes( argument ); + Console::WriteLine( "{0,22}{1,30}", argument, BitConverter::ToString( byteArray ) ); +} + +int main() +{ + Console::WriteLine( "This example of the BitConverter::GetBytes( unsigned " + "__int64 ) \nmethod generates the following output.\n" ); + Console::WriteLine( "{0,22}{1,30}", "unsigned __int64", "byte array" ); + Console::WriteLine( "{0,22}{1,30}", "----------------", "----------" ); + + // Convert unsigned __int64 values and display the results. + GetBytesUInt64( 0xFFFFFF ); + GetBytesUInt64( 1000000000 ); + GetBytesUInt64( 0x100000000 ); + GetBytesUInt64( 0xAAAAAAAAAAAA ); + GetBytesUInt64( 1000000000000000000 ); + GetBytesUInt64( 10000000000000000000 ); + GetBytesUInt64( UInt64::MinValue ); + GetBytesUInt64( Int64::MaxValue ); + GetBytesUInt64( UInt64::MaxValue ); +} + +/* +This example of the BitConverter::GetBytes( unsigned __int64 ) +method generates the following output. + + unsigned __int64 byte array + ---------------- ---------- + 16777215 FF-FF-FF-00-00-00-00-00 + 1000000000 00-CA-9A-3B-00-00-00-00 + 4294967296 00-00-00-00-01-00-00-00 + 187649984473770 AA-AA-AA-AA-AA-AA-00-00 + 1000000000000000000 00-00-64-A7-B3-B6-E0-0D + 10000000000000000000 00-00-E8-89-04-23-C7-8A + 0 00-00-00-00-00-00-00-00 + 9223372036854775807 FF-FF-FF-FF-FF-FF-FF-7F + 18446744073709551615 FF-FF-FF-FF-FF-FF-FF-FF +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp new file mode 100644 index 00000000000..6be5740936b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostring.cpp @@ -0,0 +1,51 @@ + +// +// Example of the BitConverter::ToString( unsigned char[ ] ) method. +using namespace System; + +// Display a byte array with a name. +void WriteByteArray( array^bytes, String^ name ) +{ + String^ underLine = "--------------------------------"; + Console::WriteLine( name ); + Console::WriteLine( underLine->Substring( 0, Math::Min( name->Length, underLine->Length ) ) ); + Console::WriteLine( BitConverter::ToString( bytes ) ); + Console::WriteLine(); +} + +int main() +{ + array^arrayOne = {0,1,2,4,8,16,32,64,128,255}; + array^arrayTwo = {32,0,0,42,0,65,0,125,0,197,0,168,3,41,4,172,32}; + array^arrayThree = {15,0,0,128,16,39,240,216,241,255,127}; + array^arrayFour = {15,0,0,0,0,16,0,255,3,0,0,202,154,59,255,255,255,255,127}; + Console::WriteLine( "This example of the " + "BitConverter::ToString( unsigned char[ ] ) \n" + "method generates the following output.\n" ); + WriteByteArray( arrayOne, "arrayOne" ); + WriteByteArray( arrayTwo, "arrayTwo" ); + WriteByteArray( arrayThree, "arrayThree" ); + WriteByteArray( arrayFour, "arrayFour" ); +} + +/* +This example of the BitConverter::ToString( unsigned char[ ] ) +method generates the following output. + +arrayOne +-------- +00-01-02-04-08-10-20-40-80-FF + +arrayTwo +-------- +20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20 + +arrayThree +---------- +0F-00-00-80-10-27-F0-D8-F1-FF-7F + +arrayFour +--------- +0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp new file mode 100644 index 00000000000..a35ba6d8dc5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToString/CPP/batostringii.cpp @@ -0,0 +1,65 @@ + +// +// Example of some BitConverter::ToString( ) method overloads. +using namespace System; + +// Display a byte array, using multiple lines if necessary. +void WriteMultiLineByteArray( array^bytes, String^ name ) +{ + const int rowSize = 20; + String^ underLine = "--------------------------------"; + int iter; + Console::WriteLine( name ); + Console::WriteLine( underLine->Substring( 0, Math::Min( name->Length, underLine->Length ) ) ); + for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) + { + Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); + Console::WriteLine( "-" ); + + } + Console::WriteLine( BitConverter::ToString( bytes, iter ) ); + Console::WriteLine(); +} + +int main() +{ + array^arrayOne = {0,0,0,0,128,63,0,0,112,65,0,255,127,71,0,0,128,59,0,0,128,47,73,70,131,5,75,6,158,63,77,6,158,63,80,6,158,63,30,55,190,121,255,255,127,255,255,127,127,1,0,0,0,192,255,0,0,128,255,0,0,128,127}; + array^arrayTwo = {255,255,255,0,0,20,0,33,0,0,0,1,0,0,0,100,167,179,182,224,13,0,202,154,59,0,143,91,0,170,170,170,170,170,170,0,0,232,137,4,35,199,138,255,232,244,255,252,205,255,255,129}; + array^arrayThree = {0,222,0,0,0,224,111,64,0,0,224,255,255,255,239,65,0,0,131,0,0,0,112,63,0,143,0,100,0,0,240,61,223,136,30,28,254,116,170,1,250,89,140,66,202,192,243,63,251,89,140,66,202,192,243,63,252,89,140,66,202,192,243,63,82,211,187,188,232,126,255,255,255,244,255,239,127,1,0,0,0,10,17,0,0,248,255,0,88,0,91,0,0,240,255,0,0,240,157}; + Console::WriteLine( "This example of the\n" + " BitConverter::ToString( unsigned char[ ], int ) and \n" + " BitConverter::ToString( unsigned char[ ], int, int ) \n" + "methods generates the following output.\n" ); + WriteMultiLineByteArray( arrayOne, "arrayOne" ); + WriteMultiLineByteArray( arrayTwo, "arrayTwo" ); + WriteMultiLineByteArray( arrayThree, "arrayThree" ); +} + +/* +This example of the + BitConverter::ToString( unsigned char[ ], int ) and + BitConverter::ToString( unsigned char[ ], int, int ) +methods generates the following output. + +arrayOne +-------- +00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00- +80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37- +BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00- +00-80-7F + +arrayTwo +-------- +FF-FF-FF-00-00-14-00-21-00-00-00-01-00-00-00-64-A7-B3-B6-E0- +0D-00-CA-9A-3B-00-8F-5B-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04- +23-C7-8A-FF-E8-F4-FF-FC-CD-FF-FF-81 + +arrayThree +---------- +00-DE-00-00-00-E0-6F-40-00-00-E0-FF-FF-FF-EF-41-00-00-83-00- +00-00-70-3F-00-8F-00-64-00-00-F0-3D-DF-88-1E-1C-FE-74-AA-01- +FA-59-8C-42-CA-C0-F3-3F-FB-59-8C-42-CA-C0-F3-3F-FC-59-8C-42- +CA-C0-F3-3F-52-D3-BB-BC-E8-7E-FF-FF-FF-F4-FF-EF-7F-01-00-00- +00-0A-11-00-00-F8-FF-00-58-00-5B-00-00-F0-FF-00-00-F0-9D +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp new file mode 100644 index 00000000000..d867bc4145f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batobool.cpp @@ -0,0 +1,30 @@ + +// +// Example of the BitConverter::ToBoolean method. +using namespace System; + +int main() +{ + // Define an array of byte values. + array^ bytes = { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }; + + Console::WriteLine("{0,5}{1,16}{2,10}\n", "index", "array element", "bool" ); + // Convert each array element to a Boolean value. + for (int index = 0; index < bytes->Length; index++) + Console::WriteLine("{0,5}{1,16:X2}{2,10}", index, bytes[index], + BitConverter::ToBoolean(bytes, index)); +} +// The example displays the following output: +// index array element bool +// +// 0 00 False +// 1 01 True +// 2 02 True +// 3 04 True +// 4 08 True +// 5 10 True +// 6 20 True +// 7 40 True +// 8 80 True +// 9 FF True +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp new file mode 100644 index 00000000000..cfade12139f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batochar.cpp @@ -0,0 +1,59 @@ + +// +// Example of the BitConverter::ToChar method. +using namespace System; + +// Convert two byte array elements to a __wchar_t and display it. +void BAToChar( array^bytes, int index ) +{ + __wchar_t value = BitConverter::ToChar( bytes, index ); + Console::WriteLine( "{0,5}{1,17}{2,11}", index, BitConverter::ToString( bytes, index, 2 ), value ); +} + +int main() +{ + array^byteArray = {32,0,0,42,0,65,0,125,0,197,0,168,3,41,4,172,32}; + Console::WriteLine( "This example of the BitConverter::ToChar( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to __wchar_t values.\n" ); + Console::WriteLine( "initial unsigned char array" ); + Console::WriteLine( "---------------------------" ); + Console::WriteLine( BitConverter::ToString( byteArray ) ); + Console::WriteLine(); + Console::WriteLine( "{0,5}{1,17}{2,11}", "index", "array elements", "__wchar_t" ); + Console::WriteLine( "{0,5}{1,17}{2,11}", "-----", "--------------", "---------" ); + + // Convert byte array elements to __wchar_t values. + BAToChar( byteArray, 0 ); + BAToChar( byteArray, 1 ); + BAToChar( byteArray, 3 ); + BAToChar( byteArray, 5 ); + BAToChar( byteArray, 7 ); + BAToChar( byteArray, 9 ); + BAToChar( byteArray, 11 ); + BAToChar( byteArray, 13 ); + BAToChar( byteArray, 15 ); +} + +/* +This example of the BitConverter::ToChar(unsigned char[ ], int) +method generates the following output. It converts elements of a +byte array to __wchar_t values. + +initial unsigned char array +--------------------------- +20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20 + +index array elements __wchar_t +----- -------------- --------- + 0 20-00 + 1 00-00 + 3 2A-00 * + 5 41-00 A + 7 7D-00 } + 9 C5-00 Å + 11 A8-03 Ψ + 13 29-04 Щ + 15 AC-20 € +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp new file mode 100644 index 00000000000..9e797cb8ced --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batodouble.cpp @@ -0,0 +1,96 @@ + +// +// Example of the BitConverter::ToDouble method. +using namespace System; + +// Convert eight byte array elements to a double and display it. +void BAToDouble( array^bytes, int index ) +{ + double value = BitConverter::ToDouble( bytes, index ); + Console::WriteLine( "{0,5}{1,27}{2,27:E16}", index, BitConverter::ToString( bytes, index, 8 ), value ); +} + + +// Display a byte array, using multiple lines if necessary. +void WriteMultiLineByteArray( array^bytes ) +{ + const int rowSize = 20; + int iter; + Console::WriteLine( "initial unsigned char array" ); + Console::WriteLine( "---------------------------" ); + for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) + { + Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); + Console::WriteLine( "-" ); + + } + Console::WriteLine( BitConverter::ToString( bytes, iter ) ); + Console::WriteLine(); +} + +int main() +{ + array^byteArray = {0,0,0,0,0,0,0,0,240,63,0,0,0,0,0,224,111,64,0,0,224,255,255,255,239,65,0,0,0,0,0,0,112,63,0,0,0,0,0,0,240,61,223,136,30,28,254,116,170,1,250,89,140,66,202,192,243,63,251,89,140,66,202,192,243,63,252,89,140,66,202,192,243,63,82,211,187,188,232,126,61,126,255,255,255,255,255,255,239,255,255,255,255,255,255,239,127,1,0,0,0,0,0,0,0,248,255,0,0,0,0,0,0,240,255,0,0,0,0,0,0,240,127}; + Console::WriteLine( "This example of the BitConverter::ToDouble( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to double values.\n" ); + WriteMultiLineByteArray( byteArray ); + Console::WriteLine( "{0,5}{1,27}{2,27:E16}", "index", "array elements", "double" ); + Console::WriteLine( "{0,5}{1,27}{2,27:E16}", "-----", "--------------", "------" ); + + // Convert byte array elements to double values. + BAToDouble( byteArray, 0 ); + BAToDouble( byteArray, 2 ); + BAToDouble( byteArray, 10 ); + BAToDouble( byteArray, 18 ); + BAToDouble( byteArray, 26 ); + BAToDouble( byteArray, 34 ); + BAToDouble( byteArray, 42 ); + BAToDouble( byteArray, 50 ); + BAToDouble( byteArray, 58 ); + BAToDouble( byteArray, 66 ); + BAToDouble( byteArray, 74 ); + BAToDouble( byteArray, 82 ); + BAToDouble( byteArray, 89 ); + BAToDouble( byteArray, 97 ); + BAToDouble( byteArray, 99 ); + BAToDouble( byteArray, 107 ); + BAToDouble( byteArray, 115 ); +} + +/* +This example of the BitConverter.ToDouble( byte( ), int ) +method generates the following output. It converts elements +of a byte array to double values. + +initial byte array +------------------ +00-00-00-00-00-00-00-00-F0-3F-00-00-00-00-00-E0-6F-40-00-00- +E0-FF-FF-FF-EF-41-00-00-00-00-00-00-70-3F-00-00-00-00-00-00- +F0-3D-DF-88-1E-1C-FE-74-AA-01-FA-59-8C-42-CA-C0-F3-3F-FB-59- +8C-42-CA-C0-F3-3F-FC-59-8C-42-CA-C0-F3-3F-52-D3-BB-BC-E8-7E- +3D-7E-FF-FF-FF-FF-FF-FF-EF-FF-FF-FF-FF-FF-FF-EF-7F-01-00-00- +00-00-00-00-00-F8-FF-00-00-00-00-00-00-F0-FF-00-00-00-00-00- +00-F0-7F + +index array elements double +----- -------------- ------ + 0 00-00-00-00-00-00-00-00 0.0000000000000000E+000 + 2 00-00-00-00-00-00-F0-3F 1.0000000000000000E+000 + 10 00-00-00-00-00-E0-6F-40 2.5500000000000000E+002 + 18 00-00-E0-FF-FF-FF-EF-41 4.2949672950000000E+009 + 26 00-00-00-00-00-00-70-3F 3.9062500000000000E-003 + 34 00-00-00-00-00-00-F0-3D 2.3283064365386963E-010 + 42 DF-88-1E-1C-FE-74-AA-01 1.2345678901234500E-300 + 50 FA-59-8C-42-CA-C0-F3-3F 1.2345678901234565E+000 + 58 FB-59-8C-42-CA-C0-F3-3F 1.2345678901234567E+000 + 66 FC-59-8C-42-CA-C0-F3-3F 1.2345678901234569E+000 + 74 52-D3-BB-BC-E8-7E-3D-7E 1.2345678901234569E+300 + 82 FF-FF-FF-FF-FF-FF-EF-FF -1.7976931348623157E+308 + 89 FF-FF-FF-FF-FF-FF-EF-7F 1.7976931348623157E+308 + 97 01-00-00-00-00-00-00-00 4.9406564584124654E-324 + 99 00-00-00-00-00-00-F8-FF NaN + 107 00-00-00-00-00-00-F0-FF -Infinity + 115 00-00-00-00-00-00-F0-7F Infinity +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp new file mode 100644 index 00000000000..bd457501a14 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.Others/CPP/batosingle.cpp @@ -0,0 +1,93 @@ + +// +// Example of the BitConverter::ToSingle method. +using namespace System; + +// Convert four byte array elements to a float and display it. +void BAToSingle( array^bytes, int index ) +{ + float value = BitConverter::ToSingle( bytes, index ); + Console::WriteLine( "{0,5}{1,17}{2,18:E7}", index, BitConverter::ToString( bytes, index, 4 ), value ); +} + + +// Display a byte array, using multiple lines if necessary. +void WriteMultiLineByteArray( array^bytes ) +{ + const int rowSize = 20; + int iter; + Console::WriteLine( "initial unsigned char array" ); + Console::WriteLine( "---------------------------" ); + for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) + { + Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); + Console::WriteLine( "-" ); + + } + Console::WriteLine( BitConverter::ToString( bytes, iter ) ); + Console::WriteLine(); +} + +int main() +{ + array^byteArray = {0,0,0,0,128,63,0,0,112,65,0,255,127,71,0,0,128,59,0,0,128,47,73,70,131,5,75,6,158,63,77,6,158,63,80,6,158,63,30,55,190,121,255,255,127,255,255,127,127,1,0,0,0,192,255,0,0,128,255,0,0,128,127}; + Console::WriteLine( "This example of the BitConverter::ToSingle( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to float values.\n" ); + WriteMultiLineByteArray( byteArray ); + Console::WriteLine( "{0,5}{1,17}{2,18:E7}", "index", "array elements", "float" ); + Console::WriteLine( "{0,5}{1,17}{2,18:E7}", "-----", "--------------", "-----" ); + + // Convert byte array elements to float values. + BAToSingle( byteArray, 0 ); + BAToSingle( byteArray, 2 ); + BAToSingle( byteArray, 6 ); + BAToSingle( byteArray, 10 ); + BAToSingle( byteArray, 14 ); + BAToSingle( byteArray, 18 ); + BAToSingle( byteArray, 22 ); + BAToSingle( byteArray, 26 ); + BAToSingle( byteArray, 30 ); + BAToSingle( byteArray, 34 ); + BAToSingle( byteArray, 38 ); + BAToSingle( byteArray, 42 ); + BAToSingle( byteArray, 45 ); + BAToSingle( byteArray, 49 ); + BAToSingle( byteArray, 51 ); + BAToSingle( byteArray, 55 ); + BAToSingle( byteArray, 59 ); +} + +/* +This example of the BitConverter::ToSingle( unsigned char[ ], int ) +method generates the following output. It converts elements of a +byte array to float values. + +initial unsigned char array +--------------------------- +00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00- +80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37- +BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00- +00-80-7F + +index array elements float +----- -------------- ----- + 0 00-00-00-00 0.0000000E+000 + 2 00-00-80-3F 1.0000000E+000 + 6 00-00-70-41 1.5000000E+001 + 10 00-FF-7F-47 6.5535000E+004 + 14 00-00-80-3B 3.9062500E-003 + 18 00-00-80-2F 2.3283064E-010 + 22 49-46-83-05 1.2345000E-035 + 26 4B-06-9E-3F 1.2345671E+000 + 30 4D-06-9E-3F 1.2345673E+000 + 34 50-06-9E-3F 1.2345676E+000 + 38 1E-37-BE-79 1.2345679E+035 + 42 FF-FF-7F-FF -3.4028235E+038 + 45 FF-FF-7F-7F 3.4028235E+038 + 49 01-00-00-00 1.4012985E-045 + 51 00-00-C0-FF NaN + 55 00-00-80-FF -Infinity + 59 00-00-80-7F Infinity +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp new file mode 100644 index 00000000000..92c948b4d19 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint16.cpp @@ -0,0 +1,55 @@ + +// +// Example of the BitConverter::ToInt16 method. +using namespace System; + +// Convert two byte array elements to a short and display it. +void BAToInt16( array^bytes, int index ) +{ + short value = BitConverter::ToInt16( bytes, index ); + Console::WriteLine( "{0,5}{1,17}{2,10}", index, BitConverter::ToString( bytes, index, 2 ), value ); +} + +int main() +{ + array^byteArray = {15,0,0,128,16,39,240,216,241,255,127}; + Console::WriteLine( "This example of the BitConverter::ToInt16( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to short values.\n" ); + Console::WriteLine( "initial byte array" ); + Console::WriteLine( "------------------" ); + Console::WriteLine( BitConverter::ToString( byteArray ) ); + Console::WriteLine(); + Console::WriteLine( "{0,5}{1,17}{2,10}", "index", "array elements", "short" ); + Console::WriteLine( "{0,5}{1,17}{2,10}", "-----", "--------------", "-----" ); + + // Convert byte array elements to short values. + BAToInt16( byteArray, 1 ); + BAToInt16( byteArray, 0 ); + BAToInt16( byteArray, 8 ); + BAToInt16( byteArray, 4 ); + BAToInt16( byteArray, 6 ); + BAToInt16( byteArray, 9 ); + BAToInt16( byteArray, 2 ); +} + +/* +This example of the BitConverter::ToInt16( unsigned char[ ], int ) +method generates the following output. It converts elements of a +byte array to short values. + +initial byte array +------------------ +0F-00-00-80-10-27-F0-D8-F1-FF-7F + +index array elements short +----- -------------- ----- + 1 00-00 0 + 0 0F-00 15 + 8 F1-FF -15 + 4 10-27 10000 + 6 F0-D8 -10000 + 9 FF-7F 32767 + 2 00-80 -32768 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp new file mode 100644 index 00000000000..d3e8f559b3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.SInts/CPP/batoint64.cpp @@ -0,0 +1,85 @@ + +// +// Example of the BitConverter::ToInt64 method. +using namespace System; + +// Convert eight byte array elements to an __int64 and display it. +void BAToInt64( array^bytes, int index ) +{ + __int64 value = BitConverter::ToInt64( bytes, index ); + Console::WriteLine( "{0,5}{1,27}{2,24}", index, BitConverter::ToString( bytes, index, 8 ), value ); +} + + +// Display a byte array, using multiple lines if necessary. +void WriteMultiLineByteArray( array^bytes ) +{ + const int rowSize = 20; + int iter; + Console::WriteLine( "initial unsigned char array" ); + Console::WriteLine( "---------------------------" ); + for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) + { + Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); + Console::WriteLine( "-" ); + + } + Console::WriteLine( BitConverter::ToString( bytes, iter ) ); + Console::WriteLine(); +} + +int main() +{ + array^byteArray = {0,54,101,196,255,255,255,255,0,0,0,0,0,0,0,0,128,0,202,154,59,0,0,0,0,1,0,0,0,0,255,255,255,255,1,0,0,255,255,255,255,255,255,255,127,86,85,85,85,85,85,255,255,170,170,170,170,170,170,0,0,100,167,179,182,224,13,0,0,156,88,76,73,31,242}; + Console::WriteLine( "This example of the BitConverter::ToInt64( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to __int64 values.\n" ); + WriteMultiLineByteArray( byteArray ); + Console::WriteLine( "{0,5}{1,27}{2,24}", "index", "array elements", "__int64" ); + Console::WriteLine( "{0,5}{1,27}{2,24}", "-----", "--------------", "-------" ); + + // Convert byte array elements to __int64 values. + BAToInt64( byteArray, 8 ); + BAToInt64( byteArray, 5 ); + BAToInt64( byteArray, 34 ); + BAToInt64( byteArray, 17 ); + BAToInt64( byteArray, 0 ); + BAToInt64( byteArray, 21 ); + BAToInt64( byteArray, 26 ); + BAToInt64( byteArray, 53 ); + BAToInt64( byteArray, 45 ); + BAToInt64( byteArray, 59 ); + BAToInt64( byteArray, 67 ); + BAToInt64( byteArray, 37 ); + BAToInt64( byteArray, 9 ); +} + +/* +This example of the BitConverter::ToInt64( unsigned char[ ], int ) +method generates the following output. It converts elements of a +byte array to __int64 values. + +initial unsigned char array +--------------------------- +00-36-65-C4-FF-FF-FF-FF-00-00-00-00-00-00-00-00-80-00-CA-9A- +3B-00-00-00-00-01-00-00-00-00-FF-FF-FF-FF-01-00-00-FF-FF-FF- +FF-FF-FF-FF-7F-56-55-55-55-55-55-FF-FF-AA-AA-AA-AA-AA-AA-00- +00-64-A7-B3-B6-E0-0D-00-00-9C-58-4C-49-1F-F2 + +index array elements __int64 +----- -------------- ------- + 8 00-00-00-00-00-00-00-00 0 + 5 FF-FF-FF-00-00-00-00-00 16777215 + 34 01-00-00-FF-FF-FF-FF-FF -16777215 + 17 00-CA-9A-3B-00-00-00-00 1000000000 + 0 00-36-65-C4-FF-FF-FF-FF -1000000000 + 21 00-00-00-00-01-00-00-00 4294967296 + 26 00-00-00-00-FF-FF-FF-FF -4294967296 + 53 AA-AA-AA-AA-AA-AA-00-00 187649984473770 + 45 56-55-55-55-55-55-FF-FF -187649984473770 + 59 00-00-64-A7-B3-B6-E0-0D 1000000000000000000 + 67 00-00-9C-58-4C-49-1F-F2 -1000000000000000000 + 37 FF-FF-FF-FF-FF-FF-FF-7F 9223372036854775807 + 9 00-00-00-00-00-00-00-80 -9223372036854775808 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp new file mode 100644 index 00000000000..c882255558e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint16.cpp @@ -0,0 +1,54 @@ + +// +// Example of the BitConverter::ToUInt16 method. +using namespace System; + +// Convert two byte array elements to an unsigned short and display it. +void BAToUInt16( array^bytes, int index ) +{ + unsigned short value = BitConverter::ToUInt16( bytes, index ); + Console::WriteLine( "{0,5}{1,17}{2,16}", index, BitConverter::ToString( bytes, index, 2 ), value ); +} + +int main() +{ + array^byteArray = {15,0,0,255,3,16,39,255,255,127}; + Console::WriteLine( "This example of the BitConverter::ToUInt16( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to unsigned short " + "values.\n" ); + Console::WriteLine( "initial byte array" ); + Console::WriteLine( "------------------" ); + Console::WriteLine( BitConverter::ToString( byteArray ) ); + Console::WriteLine(); + Console::WriteLine( "{0,5}{1,17}{2,16}", "index", "array elements", "unsigned short" ); + Console::WriteLine( "{0,5}{1,17}{2,16}", "-----", "--------------", "--------------" ); + + // Convert byte array elements to unsigned short values. + BAToUInt16( byteArray, 1 ); + BAToUInt16( byteArray, 0 ); + BAToUInt16( byteArray, 3 ); + BAToUInt16( byteArray, 5 ); + BAToUInt16( byteArray, 8 ); + BAToUInt16( byteArray, 7 ); +} + +/* +This example of the BitConverter::ToUInt16( unsigned char[ ], int ) +method generates the following output. It converts elements of a +byte array to unsigned short values. + +initial byte array +------------------ +0F-00-00-FF-03-10-27-FF-FF-7F + +index array elements unsigned short +----- -------------- -------------- + 1 00-00 0 + 0 0F-00 15 + 3 FF-03 1023 + 5 10-27 10000 + 8 FF-7F 32767 + 7 FF-FF 65535 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp new file mode 100644 index 00000000000..ea1eb361eda --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint32.cpp @@ -0,0 +1,56 @@ + +// +// Example of the BitConverter::ToUInt32 method. +using namespace System; + +// Convert four byte array elements to an unsigned int and display it. +void BAToUInt32( array^bytes, int index ) +{ + unsigned int value = BitConverter::ToUInt32( bytes, index ); + Console::WriteLine( "{0,5}{1,17}{2,15}", index, BitConverter::ToString( bytes, index, 4 ), value ); +} + +int main() +{ + array^byteArray = {15,0,0,0,0,16,0,255,3,0,0,202,154,59,255,255,255,255,127}; + Console::WriteLine( "This example of the BitConverter::ToUInt32( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to unsigned int " + "values.\n" ); + Console::WriteLine( "initial byte array" ); + Console::WriteLine( "------------------" ); + Console::WriteLine( BitConverter::ToString( byteArray ) ); + Console::WriteLine(); + Console::WriteLine( "{0,5}{1,17}{2,15}", "index", "array elements", "unsigned int" ); + Console::WriteLine( "{0,5}{1,17}{2,15}", "-----", "--------------", "------------" ); + + // Convert byte array elements to unsigned int values. + BAToUInt32( byteArray, 1 ); + BAToUInt32( byteArray, 0 ); + BAToUInt32( byteArray, 7 ); + BAToUInt32( byteArray, 3 ); + BAToUInt32( byteArray, 10 ); + BAToUInt32( byteArray, 15 ); + BAToUInt32( byteArray, 14 ); +} + +/* +This example of the BitConverter::ToUInt32( unsigned char[ ], int ) +method generates the following output. It converts elements of a +byte array to unsigned int values. + +initial byte array +------------------ +0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F + +index array elements unsigned int +----- -------------- ------------ + 1 00-00-00-00 0 + 0 0F-00-00-00 15 + 7 FF-03-00-00 1023 + 3 00-00-10-00 1048576 + 10 00-CA-9A-3B 1000000000 + 15 FF-FF-FF-7F 2147483647 + 14 FF-FF-FF-FF 4294967295 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp new file mode 100644 index 00000000000..102a5ced116 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.BitConverter.ToXXX.UInts/CPP/batouint64.cpp @@ -0,0 +1,78 @@ + +// +// Example of the BitConverter::ToUInt64 method. +using namespace System; + +// Convert eight byte array elements to an unsigned __int64 value and +// display it. +void BAToUInt64( array^bytes, int index ) +{ + unsigned __int64 value = BitConverter::ToUInt64( bytes, index ); + Console::WriteLine( "{0,5}{1,27}{2,24}", index, BitConverter::ToString( bytes, index, 8 ), value ); +} + + +// Display a byte array, using multiple lines if necessary. +void WriteMultiLineByteArray( array^bytes ) +{ + const int rowSize = 20; + int iter; + Console::WriteLine( "initial unsigned char array" ); + Console::WriteLine( "---------------------------" ); + for ( iter = 0; iter < bytes->Length - rowSize; iter += rowSize ) + { + Console::Write( BitConverter::ToString( bytes, iter, rowSize ) ); + Console::WriteLine( "-" ); + + } + Console::WriteLine( BitConverter::ToString( bytes, iter ) ); + Console::WriteLine(); +} + +int main() +{ + array^byteArray = {255,255,255,0,0,0,0,0,0,0,0,1,0,0,0,100,167,179,182,224,13,0,202,154,59,0,0,0,0,170,170,170,170,170,170,0,0,232,137,4,35,199,138,255,255,255,255,255,255,255,255,127}; + Console::WriteLine( "This example of the BitConverter::ToUInt64( unsigned " + "char[ ], int ) \nmethod generates the following output. It " + "converts elements of a \nbyte array to unsigned __int64 " + "values.\n" ); + WriteMultiLineByteArray( byteArray ); + Console::WriteLine( "{0,5}{1,27}{2,24}", "index", "array elements", "unsigned __int64" ); + Console::WriteLine( "{0,5}{1,27}{2,24}", "-----", "--------------", "----------------" ); + + // Convert byte array elements to unsigned __int64 values. + BAToUInt64( byteArray, 3 ); + BAToUInt64( byteArray, 0 ); + BAToUInt64( byteArray, 21 ); + BAToUInt64( byteArray, 7 ); + BAToUInt64( byteArray, 29 ); + BAToUInt64( byteArray, 13 ); + BAToUInt64( byteArray, 35 ); + BAToUInt64( byteArray, 44 ); + BAToUInt64( byteArray, 43 ); +} + +/* +This example of the BitConverter::ToUInt64( unsigned char[ ], int ) +method generates the following output. It converts elements of a +byte array to unsigned __int64 values. + +initial unsigned char array +--------------------------- +FF-FF-FF-00-00-00-00-00-00-00-00-01-00-00-00-64-A7-B3-B6-E0- +0D-00-CA-9A-3B-00-00-00-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04- +23-C7-8A-FF-FF-FF-FF-FF-FF-FF-FF-7F + +index array elements unsigned __int64 +----- -------------- ---------------- + 3 00-00-00-00-00-00-00-00 0 + 0 FF-FF-FF-00-00-00-00-00 16777215 + 21 00-CA-9A-3B-00-00-00-00 1000000000 + 7 00-00-00-00-01-00-00-00 4294967296 + 29 AA-AA-AA-AA-AA-AA-00-00 187649984473770 + 13 00-00-64-A7-B3-B6-E0-0D 1000000000000000000 + 35 00-00-E8-89-04-23-C7-8A 10000000000000000000 + 44 FF-FF-FF-FF-FF-FF-FF-7F 9223372036854775807 + 43 FF-FF-FF-FF-FF-FF-FF-FF 18446744073709551615 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp new file mode 100644 index 00000000000..32b17db75b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Boolean/CPP/booleanmembers.cpp @@ -0,0 +1,26 @@ + +using namespace System; +int main() +{ + + // + Boolean raining = false; + Boolean busLate = true; + Console::WriteLine( "raining->ToString() returns {0}", raining.ToString() ); + Console::WriteLine( "busLate->ToString() returns {0}", busLate.ToString() ); + // The example displays the following output: + // raining.ToString() returns False + // busLate.ToString() returns True + // + + // + Boolean val; + String^ input; + input = Boolean::TrueString; + val = Boolean::Parse( input ); + Console::WriteLine( "'{0}' parsed as {1}", input, val ); + // The example displays the following output: + // 'True' parsed as True + // +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp new file mode 100644 index 00000000000..2ece40209b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/bcopy.cpp @@ -0,0 +1,137 @@ +// Buffer.BlockCopy2.cpp : main project file. + +// +using namespace System; + +// Display the individual bytes in the array in hexadecimal. +void DisplayArray(System::Array^ arr, String^ name) +{ + Console::WindowWidth = 120; + Console::Write("{0,11}:", name); + for (int ctr = 0; ctr < arr->Length; ctr++) + { + array^ bytes; + if (arr->GetType() == array::typeid) + bytes = BitConverter::GetBytes((Int64) arr->GetValue(ctr)); + else + bytes = BitConverter::GetBytes((Int16) arr->GetValue(ctr)); + + for each (Byte byteValue in bytes) + Console::Write(" {0:X2}", byteValue); + } + Console::WriteLine(); +} + +// Display the individual array element values in hexadecimal. +void DisplayArrayValues(Array^ arr, String^ name) +{ + // Get the length of one element in the array. + int elementLength = Buffer::ByteLength(arr) / arr->Length; + String^ formatString = String::Format(" {{0:X{0}}}", 2 * elementLength); + Console::Write( "{0,11}:", name); + for (int ctr = 0; ctr < arr->Length; ctr++) + Console::Write(formatString, arr->GetValue(ctr)); + + Console::WriteLine(); +} + +void main() +{ + // These are the source and destination arrays for BlockCopy. + array^ src = gcnew array { 258, 259, 260, 261, 262, 263, 264, + 265, 266, 267, 268, 269, 270 }; + array^ dest = gcnew array { 17, 18, 19, 20 }; + + // Display the initial value of the arrays in memory. + Console::WriteLine( "Initial values of arrays:"); + Console::WriteLine(" Array values as Bytes:"); + DisplayArray(src, "src" ); + DisplayArray(dest, "dest"); + Console::WriteLine(" Array values:"); + DisplayArrayValues(src, "src"); + DisplayArrayValues(dest, "dest"); + Console::WriteLine(); + + // Copy bytes 5-10 from source to index 7 in destination and display the result. + Buffer::BlockCopy(src, 5, dest, 7, 6); + Console::WriteLine("Buffer::BlockCopy(src, 5, dest, 7, 6 )"); + Console::WriteLine(" Array values as Bytes:"); + DisplayArray(src, "src"); + DisplayArray(dest, "dest"); + Console::WriteLine(" Array values:"); + DisplayArrayValues(src, "src"); + DisplayArrayValues(dest, "dest"); + Console::WriteLine(); + + // Copy bytes 16-20 from source to index 22 in destination and display the result. + Buffer::BlockCopy(src, 16, dest, 22, 5); + Console::WriteLine("Buffer.BlockCopy(src, 16, dest, 22, 5)"); + Console::WriteLine(" Array values as Bytes:"); + DisplayArray(src, "src"); + DisplayArray(dest, "dest"); + Console::WriteLine(" Array values:"); + DisplayArrayValues(src, "src"); + DisplayArrayValues(dest, "dest"); + Console::WriteLine(); + + // Copy overlapping range of bytes 4-10 to index 5 in source. + Buffer::BlockCopy(src, 4, src, 5, 7 ); + Console::WriteLine("Buffer.BlockCopy( src, 4, src, 5, 7)"); + Console::WriteLine(" Array values as Bytes:"); + DisplayArray(src, "src"); + DisplayArray(dest, "dest"); + Console::WriteLine(" Array values:"); + DisplayArrayValues(src, "src"); + DisplayArrayValues(dest, "dest"); + Console::WriteLine(); + + // Copy overlapping range of bytes 16-22 to index 15 in source. + Buffer::BlockCopy(src, 16, src, 15, 7); + Console::WriteLine("Buffer.BlockCopy( src, 16, src, 15, 7)"); + Console::WriteLine(" Array values as Bytes:"); + DisplayArray(src, "src"); + DisplayArray(dest, "dest"); + Console::WriteLine(" Array values:"); + DisplayArrayValues(src, "src"); +} +// The example displays the following output: +// Initial values of arrays: +// Array values as Bytes: +// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 +// dest: 11 00 00 00 00 00 00 00 12 00 00 00 00 00 00 00 13 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 +// Array values: +// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E +// dest: 0000000000000011 0000000000000012 0000000000000013 0000000000000014 +// +// Buffer.BlockCopy(src, 5, dest, 7, 6 ) +// Array values as Bytes: +// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 +// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 00 00 14 00 00 00 00 00 00 00 +// Array values: +// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E +// dest: 0100000000000011 0000000701060105 0000000000000013 0000000000000014 +// +// Buffer.BlockCopy(src, 16, dest, 22, 5) +// Array values as Bytes: +// src: 02 01 03 01 04 01 05 01 06 01 07 01 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 +// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 +// Array values: +// src: 0102 0103 0104 0105 0106 0107 0108 0109 010A 010B 010C 010D 010E +// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B +// +// Buffer.BlockCopy( src, 4, src, 5, 7) +// Array values as Bytes: +// src: 02 01 03 01 04 04 01 05 01 06 01 07 08 01 09 01 0A 01 0B 01 0C 01 0D 01 0E 01 +// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 +// Array values: +// src: 0102 0103 0404 0501 0601 0701 0108 0109 010A 010B 010C 010D 010E +// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B +// +// Buffer.BlockCopy( src, 16, src, 15, 7) +// Array values as Bytes: +// src: 02 01 03 01 04 04 01 05 01 06 01 07 08 01 09 0A 01 0B 01 0C 01 0D 0D 01 0E 01 +// dest: 11 00 00 00 00 00 00 01 05 01 06 01 07 00 00 00 13 00 00 00 00 00 0A 01 0B 01 0C 00 00 00 00 00 +// Array values: +// src: 0102 0103 0404 0501 0601 0701 0108 0A09 0B01 0C01 0D01 010D 010E +// dest: 0100000000000011 0000000701060105 010A000000000013 00000000000C010B +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp new file mode 100644 index 00000000000..2ce360f905c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/buffer.cpp @@ -0,0 +1,62 @@ + +// +// Example of the Buffer class methods. +using namespace System; + +// Display the array elements from right to left in hexadecimal. +void DisplayArray( array^arr ) +{ + Console::Write( " arr:" ); + for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) + Console::Write( " {0:X4}", arr[ loopX ] ); + Console::WriteLine(); +} + +int main() +{ + + // This array is to be modified and displayed. + array^arr = {258,259,260,261,262,263,264,265,266,267,268,269,270,271}; + Console::WriteLine( "This example of the Buffer class " + "methods generates the following output.\n" + "Note: The array is displayed from right to left.\n" ); + Console::WriteLine( "Initial values of array:\n" ); + + // Display the initial array values and ByteLength. + DisplayArray( arr ); + Console::WriteLine( "\nBuffer::ByteLength( arr ): {0}", Buffer::ByteLength( arr ) ); + + // Copy a region of the array; set a byte within the array. + Console::WriteLine( "\nCall these methods: \n" + " Buffer::BlockCopy( arr, 5, arr, 16, 9 ),\n" + " Buffer::SetByte( arr, 7, 170 ).\n" ); + Buffer::BlockCopy( arr, 5, arr, 16, 9 ); + Buffer::SetByte( arr, 7, 170 ); + + // Display the array and a byte within the array. + Console::WriteLine( "Final values of array:\n" ); + DisplayArray( arr ); + Console::WriteLine( "\nBuffer::GetByte( arr, 26 ): {0}", Buffer::GetByte( arr, 26 ) ); +} + +/* +This example of the Buffer class methods generates the following output. +Note: The array is displayed from right to left. + +Initial values of array: + + arr: 010F 010E 010D 010C 010B 010A 0109 0108 0107 0106 0105 0104 0103 0102 + +Buffer::ByteLength( arr ): 28 + +Call these methods: + Buffer::BlockCopy( arr, 5, arr, 16, 9 ), + Buffer::SetByte( arr, 7, 170 ). + +Final values of array: + + arr: 010F 0101 0801 0701 0601 0501 0109 0108 0107 0106 AA05 0104 0103 0102 + +Buffer::GetByte( arr, 26 ): 15 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp new file mode 100644 index 00000000000..01bfe45c621 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.BlockCopy/CPP/overlap1.cpp @@ -0,0 +1,37 @@ +// Buffer.BlockCopy.cpp : main project file. + +using namespace System; + +void CopyExample1() +{ + // + const int INT_SIZE = 4; + array^ arr = gcnew array { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; + Buffer::BlockCopy(arr, 0 * INT_SIZE, arr, 3 * INT_SIZE, 4 * INT_SIZE); + for each (int value in arr) + Console::Write("{0} ", value); + // The example displays the following output: + // 2 4 6 2 4 6 8 16 18 20 + // +} + +void CopyExample2() +{ + // + const int INT_SIZE = 4; + array^ arr = gcnew array { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; + Buffer::BlockCopy(arr, 3 * INT_SIZE, arr, 0 * INT_SIZE, 4 * INT_SIZE); + for each (int value in arr) + Console::Write("{0} ", value); + // The example displays the following output: + // 8 10 12 14 10 12 14 16 18 20 + // +} + +void main() +{ + CopyExample1(); + Console::WriteLine(); + CopyExample2(); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp new file mode 100644 index 00000000000..08596f73850 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/bytelength.cpp @@ -0,0 +1,52 @@ + +// +// Example of the Buffer::ByteLength method. +using namespace System; + +void ArrayInfo( Array^ arr, String^ name ) +{ + int byteLength = Buffer::ByteLength( arr ); + + // Display the array name, type, Length, and ByteLength. + Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", name, arr->GetType(), arr->Length, byteLength ); +} + +int main() +{ + array^bytes = {1,2,3,4,5,6,7,8,9,0}; + array^bools = {true,false,true,false,true}; + array^chars = {' ','$','\"','A','{'}; + array^shorts = {258,259,260,261,262,263}; + array^singles = {1,678,2.37E33F,.00415F,8.9F}; + array^doubles = {2E-22,.003,4.4E44,555E55}; + array^longs = {1,10,100,1000,10000,100000}; + Console::WriteLine( "This example of the Buffer::ByteLength( Array* ) " + "\nmethod generates the following output.\n" ); + Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", "Array name", "Array type", "Length", "ByteLength" ); + Console::WriteLine( "{0,10}{1,20}{2,9}{3,12}", "----------", "----------", "------", "----------" ); + + // Display the Length and ByteLength for each array. + ArrayInfo( bytes, "bytes" ); + ArrayInfo( bools, "bools" ); + ArrayInfo( chars, "chars" ); + ArrayInfo( shorts, "shorts" ); + ArrayInfo( singles, "singles" ); + ArrayInfo( doubles, "doubles" ); + ArrayInfo( longs, "longs" ); +} + +/* +This example of the Buffer::ByteLength( Array* ) +method generates the following output. + +Array name Array type Length ByteLength +---------- ---------- ------ ---------- + bytes System.Byte[] 10 10 + bools System.Boolean[] 5 5 + chars System.Char[] 5 10 + shorts System.Int16[] 6 12 + singles System.Single[] 5 20 + doubles System.Double[] 4 32 + longs System.Int32[] 6 24 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp new file mode 100644 index 00000000000..2b8f8c6e6ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/getbyte.cpp @@ -0,0 +1,83 @@ + +// +// Example of the Buffer::GetByte method. +using namespace System; +#define formatter "{0,10}{1,10}{2,9} {3}" + +// Display the array contents in hexadecimal. +void DisplayArray( Array^ arr, String^ name ) +{ + + // Get the array element width; format the formatting string. + int elemWidth = Buffer::ByteLength( arr ) / arr->Length; + String^ format = String::Format( " {{0:X{0}}}", 2 * elemWidth ); + + // Display the array elements from right to left. + Console::Write( "{0,5}:", name ); + for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) + Console::Write( format, arr->GetValue( loopX ) ); + Console::WriteLine(); +} + +void ArrayInfo( Array^ arr, String^ name, int index ) +{ + unsigned char value = Buffer::GetByte( arr, index ); + + // Display the array name, index, and byte to be viewed. + Console::WriteLine( formatter, name, index, value, String::Format( "0x{0:X2}", value ) ); +} + +int main() +{ + + // These are the arrays to be viewed with GetByte. + array<__int64>^longs = {333333333333333333,666666666666666666,999999999999999999}; + array^ints = {111111111,222222222,333333333,444444444,555555555}; + Console::WriteLine( "This example of the " + "Buffer::GetByte( Array*, int ) \n" + "method generates the following output.\n" + "Note: The arrays are displayed from right to left.\n" ); + Console::WriteLine( " Values of arrays:\n" ); + + // Display the values of the arrays. + DisplayArray( longs, "longs" ); + DisplayArray( ints, "ints" ); + Console::WriteLine(); + Console::WriteLine( formatter, "Array", "index", "value", "" ); + Console::WriteLine( formatter, "-----", "-----", "-----", "----" ); + + // Display the Length and ByteLength for each array. + ArrayInfo( ints, "ints", 0 ); + ArrayInfo( ints, "ints", 7 ); + ArrayInfo( ints, "ints", 10 ); + ArrayInfo( ints, "ints", 17 ); + ArrayInfo( longs, "longs", 0 ); + ArrayInfo( longs, "longs", 6 ); + ArrayInfo( longs, "longs", 10 ); + ArrayInfo( longs, "longs", 17 ); + ArrayInfo( longs, "longs", 21 ); +} + +/* +This example of the Buffer::GetByte( Array*, int ) +method generates the following output. +Note: The arrays are displayed from right to left. + + Values of arrays: + +longs: 0DE0B6B3A763FFFF 094079CD1A42AAAA 04A03CE68D215555 + ints: 211D1AE3 1A7DAF1C 13DE4355 0D3ED78E 069F6BC7 + + Array index value + ----- ----- ----- ---- + ints 0 199 0xC7 + ints 7 13 0x0D + ints 10 222 0xDE + ints 17 26 0x1A + longs 0 85 0x55 + longs 6 160 0xA0 + longs 10 66 0x42 + longs 17 255 0xFF + longs 21 182 0xB6 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp new file mode 100644 index 00000000000..564641225bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Buffer.Bytes/CPP/setbyte.cpp @@ -0,0 +1,71 @@ + +// +// Example of the Buffer::SetByte method. +using namespace System; + +// Display the array contents in hexadecimal. +void DisplayArray( Array^ arr, String^ name ) +{ + + // Get the array element width; format the formatting string. + int elemWidth = Buffer::ByteLength( arr ) / arr->Length; + String^ format = String::Format( " {{0:X{0}}}", 2 * elemWidth ); + + // Display the array elements from right to left. + Console::Write( "{0,7}:", name ); + for ( int loopX = arr->Length - 1; loopX >= 0; loopX-- ) + Console::Write( format, arr->GetValue( loopX ) ); + Console::WriteLine(); +} + +int main() +{ + + // These are the arrays to be modified with SetByte. + array^shorts = gcnew array(10); + array^longs = gcnew array(3); + Console::WriteLine( "This example of the " + "Buffer::SetByte( Array*, int, unsigned char ) \n" + "method generates the following output.\n" + "Note: The arrays are displayed from right to left.\n" ); + Console::WriteLine( " Initial values of arrays:\n" ); + + // Display the initial values of the arrays. + DisplayArray( shorts, "shorts" ); + DisplayArray( longs, "longs" ); + + // Copy two regions of source array to destination array, + // and two overlapped copies from source to source. + Console::WriteLine( "\n Array values after setting byte 3 = 25, \n" + " byte 6 = 64, byte 12 = 121, and byte 17 = 196:\n" ); + Buffer::SetByte( shorts, 3, 25 ); + Buffer::SetByte( shorts, 6, 64 ); + Buffer::SetByte( shorts, 12, 121 ); + Buffer::SetByte( shorts, 17, 196 ); + Buffer::SetByte( longs, 3, 25 ); + Buffer::SetByte( longs, 6, 64 ); + Buffer::SetByte( longs, 12, 121 ); + Buffer::SetByte( longs, 17, 196 ); + + // Display the arrays again. + DisplayArray( shorts, "shorts" ); + DisplayArray( longs, "longs" ); +} + +/* +This example of the Buffer::SetByte( Array*, int, unsigned char ) +method generates the following output. +Note: The arrays are displayed from right to left. + + Initial values of arrays: + + shorts: 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 + longs: 0000000000000000 0000000000000000 0000000000000000 + + Array values after setting byte 3 = 25, + byte 6 = 64, byte 12 = 121, and byte 17 = 196: + + shorts: 0000 C400 0000 0079 0000 0000 0040 0000 1900 0000 + longs: 000000000000C400 0000007900000000 0040000019000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp new file mode 100644 index 00000000000..268d4585d1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Byte Examples/CPP/systembyte.cpp @@ -0,0 +1,106 @@ +using namespace System; + +/// +/// Summary description for Class1. +/// +public ref class SystemByteExamples +{ +private: + Byte MemberByte; + +public: + // c'tor() + SystemByteExamples() + { + MemberByte = 0; + } + + // The following example demonstrates using the MinValue and MaxValue fields to + // determine whether an integer value falls within range of a byte. If it does, + // the value is set. If not, an error message is displayed. + + // MemberByte is assumed to exist as a class member + + // +public: + void MinMaxFields( Int32 numberToSet ) + { + if ( numberToSet <= (Int32)Byte::MaxValue && numberToSet >= (Int32)Byte::MinValue ) + { + + // You must explicitly convert an integer to a byte. + MemberByte = (Byte)numberToSet; + + // Displays MemberByte using the ToString() method. + Console::WriteLine( "The MemberByte value is {0}", MemberByte.ToString() ); + } + else + { + Console::WriteLine( "The value {0} is outside of the range of possible Byte values", numberToSet.ToString() ); + } + } + // + + // The following example converts the string representation of a byte + // into its actual numeric value. + + // MemberByte is assumed to exist as a class member + +public: + void ParseByte( String^ stringToConvert ) + { + try + { + MemberByte = Byte::Parse( stringToConvert ); + Console::WriteLine( "The MemberByte value is {0}", MemberByte.ToString() ); + } + catch ( System::OverflowException^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + } + + // The following example checks to see whether a byte passed in is + // greater than, less than, or equal to the member byte. + + // MemberByte is assumed to exist as a class member + + // +public: + void Compare( Byte myByte ) + { + Int32 myCompareResult; + + myCompareResult = MemberByte.CompareTo( myByte ); + + if ( myCompareResult > 0 ) + { + Console::WriteLine( "{0} is less than the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); + } + else + { + if ( myCompareResult < 0 ) + Console::WriteLine( "{0} is greater than the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); + else + Console::WriteLine( "{0} is equal to the MemberByte value {1}", myByte.ToString(), MemberByte.ToString() ); + } + } + // +}; + +void main() +{ + SystemByteExamples^ sbe = gcnew SystemByteExamples; + Int32 numberToSet; + Byte compareByte; + String^ stringToConvert; + + numberToSet = 120; + stringToConvert = "200"; + compareByte = 201; + + sbe->MinMaxFields( numberToSet ); + sbe->ParseByte( stringToConvert ); + + sbe->Compare( compareByte ); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp new file mode 100644 index 00000000000..b8e6646267a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.Parse/cpp/parse.cpp @@ -0,0 +1,162 @@ +// Byte.Parse.cpp : main project file. + +using namespace System; +using namespace System::Globalization; + +// Byte.Parse(String) +void Parse1() +{ + // + String^ stringToConvert = " 162"; + Byte byteValue; + try + { + byteValue = Byte::Parse(stringToConvert); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); + } + catch (FormatException^) + { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); + } + catch (OverflowException^) + { + Console::WriteLine("'{0}' is greater than {1} or less than {2}.", + stringToConvert, Byte::MaxValue, Byte::MinValue); + } + // The example displays the following output to the console: + // Converted ' 162' to 162. + // +} + +// Byte.Parse(String, NumberStyles) +void Parse2a() +{ + // + String^ value; + NumberStyles style; + Byte number; + + // Parse value with no styles allowed. + style = NumberStyles::None; + value = " 241 "; + try + { + number = Byte::Parse(value, style); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException^) { + Console::WriteLine("Unable to parse '{0}'.", value); } + + // Parse value with trailing sign. + style = NumberStyles::Integer | NumberStyles::AllowTrailingSign; + value = " 163+"; + number = Byte::Parse(value, style); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + + // Parse value with leading sign. + value = " +253 "; + number = Byte::Parse(value, style); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + // This example displays the following output to the console: + // Unable to parse ' 241 '. + // Converted ' 163+' to 163. + // Converted ' +253 ' to 253. + // +} + +// Byte.Parse(String, IFormatProvider) +void Parse2b() +{ + // + String^ stringToConvert; + Byte byteValue; + + stringToConvert = " 214 "; + try { + byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); + } + catch (FormatException^) { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } + catch (OverflowException^) { + Console::WriteLine("'{0}' is greater than {1} or less than {2}.", + stringToConvert, Byte::MaxValue, Byte::MinValue); } + + stringToConvert = " + 214 "; + try { + byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); + } + catch (FormatException^) { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } + catch (OverflowException^) { + Console::WriteLine("'{0}' is greater than {1} or less than {2}.", + stringToConvert, Byte::MaxValue, Byte::MinValue); } + + stringToConvert = " +214 "; + try { + byteValue = Byte::Parse(stringToConvert, CultureInfo::InvariantCulture); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, byteValue); + } + catch (FormatException^) { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); } + catch (OverflowException^) { + Console::WriteLine("'{0}' is greater than {1} or less than {2}.", + stringToConvert, Byte::MaxValue, Byte::MinValue); } + // The example displays the following output to the console: + // Converted ' 214 ' to 214. + // Unable to parse ' + 214 '. + // Converted ' +214 ' to 214. + // +} + +void Parse3() +{ + // + NumberStyles style; + CultureInfo^ culture; + String^ value; + Byte number; + + // Parse number with decimals. + // NumberStyles.Float includes NumberStyles.AllowDecimalPoint. + style = NumberStyles::Float; + culture = CultureInfo::CreateSpecificCulture("fr-FR"); + value = "12,000"; + + number = Byte::Parse(value, style, culture); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + + culture = CultureInfo::CreateSpecificCulture("en-GB"); + try + { + number = Byte::Parse(value, style, culture); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException^) { + Console::WriteLine("Unable to parse '{0}'.", value); } + + value = "12.000"; + number = Byte::Parse(value, style, culture); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + // The example displays the following output to the console: + // Converted '12,000' to 12. + // Unable to parse '12,000'. + // Converted '12.000' to 12. + // +}; + +void main() +{ + Parse1(); // Parse(String) + Console::WriteLine(); + Parse2a(); // Parse(String, NumberStyles) + Console::WriteLine(); + Parse2b(); + Console::WriteLine(); + Parse3(); // Parse(String, NumberStyles, IFormatProvider) + Console::WriteLine(); + + Console::ReadLine(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp new file mode 100644 index 00000000000..fbad6b4f72e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers.cpp @@ -0,0 +1,29 @@ +// Byte.ToString.cpp : main project file. + +using namespace System; +using namespace System::Globalization; + +void main() +{ + // + array^ bytes = gcnew array {0, 1, 14, 168, 255}; + array^ providers = {gcnew CultureInfo("en-us"), + gcnew CultureInfo("fr-fr"), + gcnew CultureInfo("de-de"), + gcnew CultureInfo("es-es")}; + for each (Byte byteValue in bytes) + { + for each (CultureInfo^ provider in providers) + Console::Write("{0,3} ({1}) ", + byteValue.ToString(provider), provider->Name); + + Console::WriteLine(); + } + // The example displays the following output to the console: + // 0 (en-US) 0 (fr-FR) 0 (de-DE) 0 (es-ES) + // 1 (en-US) 1 (fr-FR) 1 (de-DE) 1 (es-ES) + // 14 (en-US) 14 (fr-FR) 14 (de-DE) 14 (es-ES) + // 168 (en-US) 168 (fr-FR) 168 (de-DE) 168 (es-ES) + // 255 (en-US) 255 (fr-FR) 255 (de-DE) 255 (es-ES) + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp new file mode 100644 index 00000000000..76bc3225475 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.ToString/CPP/newbytemembers2.cpp @@ -0,0 +1,79 @@ +// Byte.ToString2.cpp : main project file. + +using namespace System; +using namespace System::Globalization; + +// Byte.ToString() +void Byte1() +{ + // + array^ bytes = gcnew array {0, 1, 14, 168, 255}; + for each (Byte byteValue in bytes) + Console::WriteLine(byteValue); + // The example displays the following output to the console if the current + // culture is en-US: + // 0 + // 1 + // 14 + // 168 + // 255 + // +} + +// Byte.ToString(String) +void Byte2() +{ + // + array^ formats = gcnew array {"C3", "D4", "e1", "E2", "F1", "G", "N1", + "P0", "X4", "0000.0000"}; + Byte number = 240; + for each (String^ format in formats) + Console::WriteLine("'{0}' format specifier: {1}", + format, number.ToString(format)); + + // The example displays the following output to the console if the + // current culture is en-us: + // 'C3' format specifier: $240.000 + // 'D4' format specifier: 0240 + // 'e1' format specifier: 2.4e+002 + // 'E2' format specifier: 2.40E+002 + // 'F1' format specifier: 240.0 + // 'G' format specifier: 240 + // 'N1' format specifier: 240.0 + // 'P0' format specifier: 24,000 % + // 'X4' format specifier: 00F0 + // '0000.0000' format specifier: 0240.0000 + // +} + +// ToString(String, IFormatProvider) +void Byte3() +{ + // + Byte byteValue = 250; + array^ providers = gcnew array { gcnew CultureInfo("en-us"), + gcnew CultureInfo("fr-fr"), + gcnew CultureInfo("es-es"), + gcnew CultureInfo("de-de")}; + + for each (CultureInfo^ provider in providers) + Console::WriteLine("{0} ({1})", + byteValue.ToString("N2", provider), provider->Name); + // The example displays the following output to the console: + // 250.00 (en-US) + // 250,00 (fr-FR) + // 250,00 (es-ES) + // 250,00 (de-DE) + // +} + +void main() +{ + Byte1(); + Console::WriteLine(); + Byte2(); + Console::WriteLine(); + Byte3(); + Console::WriteLine(); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp new file mode 100644 index 00000000000..ad5537892ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse.cpp @@ -0,0 +1,37 @@ +// Byte.TryParse.cpp : main project file. +// Byte.TryParse(String, Byte) + +// +using namespace System; + +void main() +{ + array^ byteStrings = gcnew array { nullptr, String::Empty, + "1024", "100.1", "100", + "+100", "-100", "000000000000000100", + "00,100", " 20 ", "FF", "0x1F" }; + Byte byteValue; + for each (String^ byteString in byteStrings) { + bool result = Byte::TryParse(byteString, byteValue); + if (result) + Console::WriteLine("Converted '{0}' to {1}", + byteString, byteValue); + else + Console::WriteLine("Attempted conversion of '{0}' failed.", + byteString); + } +} +// The example displays the following output: +// Attempted conversion of '' failed. +// Attempted conversion of '' failed.` +// Attempted conversion of '1024' failed. +// Attempted conversion of '100.1' failed. +// Converted '100' to 100 +// Converted '+100' to 100 +// Attempted conversion of '-100' failed. +// Converted '000000000000000100' to 100 +// Attempted conversion of '00,100' failed. +// Converted ' 20 ' to 20 +// Attempted conversion of 'FF' failed. +// Attempted conversion of '0x1F' failed.} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp new file mode 100644 index 00000000000..e3e81cd2951 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Byte.TryParse/cpp/tryparse2.cpp @@ -0,0 +1,75 @@ +// Byte.TryParse2.cpp : main project file. + +// +using namespace System; +using namespace System::Globalization; + +void CallTryParse(String^ byteString, NumberStyles styles); + +void main() +{ + String^ byteString; + NumberStyles styles; + + byteString = "1024"; + styles = NumberStyles::Integer; + CallTryParse(byteString, styles); + + byteString = "100.1"; + styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; + CallTryParse(byteString, styles); + + byteString = "100.0"; + CallTryParse(byteString, styles); + + byteString = "+100"; + styles = NumberStyles::Integer | NumberStyles::AllowLeadingSign + | NumberStyles::AllowTrailingSign; + CallTryParse(byteString, styles); + + byteString = "-100"; + CallTryParse(byteString, styles); + + byteString = "000000000000000100"; + CallTryParse(byteString, styles); + + byteString = "00,100"; + styles = NumberStyles::Integer | NumberStyles::AllowThousands; + CallTryParse(byteString, styles); + + byteString = "2E+3 "; + styles = NumberStyles::Integer | NumberStyles::AllowExponent; + CallTryParse(byteString, styles); + + byteString = "FF"; + styles = NumberStyles::HexNumber; + CallTryParse(byteString, styles); + + byteString = "0x1F"; + CallTryParse(byteString, styles); +} + +void CallTryParse(String^ stringToConvert, NumberStyles styles) +{ + Byte byteValue; + bool result = Byte::TryParse(stringToConvert, styles, + (IFormatProvider^) nullptr , byteValue); + if (result) + Console::WriteLine("Converted '{0}' to {1}", + stringToConvert, byteValue); + else + Console::WriteLine("Attempted conversion of '{0}' failed.", + stringToConvert); +} +// The example displays the following output: +// Attempted conversion of '1024' failed. +// Attempted conversion of '100.1' failed. +// Converted '100.0' to 100 +// Converted '+100' to 100 +// Attempted conversion of '-100' failed. +// Converted '000000000000000100' to 100 +// Converted '00,100' to 100 +// Attempted conversion of '2E+3 ' failed. +// Converted 'FF' to 255 +// Attempted conversion of '0x1F' failed.} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp new file mode 100644 index 00000000000..b4230f4b6c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char [Type Level]/CPP/charstructure.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +int main() +{ + char chA = 'A'; + char ch1 = '1'; + String^ str = "test string"; + Console::WriteLine( chA.CompareTo( 'B' ) ); // Output: "-1" (meaning 'A' is 1 less than 'B') + Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True" + Console::WriteLine( Char::GetNumericValue( ch1 ) ); // Output: "1" + Console::WriteLine( Char::IsControl( '\t' ) ); // Output: "True" + Console::WriteLine( Char::IsDigit( ch1 ) ); // Output: "True" + Console::WriteLine( Char::IsLetter( ',' ) ); // Output: "False" + Console::WriteLine( Char::IsLower( 'u' ) ); // Output: "True" + Console::WriteLine( Char::IsNumber( ch1 ) ); // Output: "True" + Console::WriteLine( Char::IsPunctuation( '.' ) ); // Output: "True" + Console::WriteLine( Char::IsSeparator( str, 4 ) ); // Output: "True" + Console::WriteLine( Char::IsSymbol( '+' ) ); // Output: "True" + Console::WriteLine( Char::IsWhiteSpace( str, 4 ) ); // Output: "True" + Console::WriteLine( Char::Parse( "S" ) ); // Output: "S" + Console::WriteLine( Char::ToLower( 'M' ) ); // Output: "m" + Console::WriteLine( 'x' ); // Output: "x" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp new file mode 100644 index 00000000000..317328712b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.CompareTo/CPP/compareto.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +int main() +{ + char chA = 'A'; + char chB = 'B'; + Console::WriteLine( chA.CompareTo( 'A' ) ); // Output: "0" (meaning they're equal) + Console::WriteLine( 'b'.CompareTo( chB ) ); // Output: "32" (meaning 'b' is greater than 'B' by 32) + Console::WriteLine( chA.CompareTo( chB ) ); // Output: "-1" (meaning 'A' is less than 'B' by 1) +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp new file mode 100644 index 00000000000..216b8181b48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Equals/CPP/equals.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +int main() +{ + char chA = 'A'; + char chB = 'B'; + Console::WriteLine( chA.Equals( 'A' ) ); // Output: "True" + Console::WriteLine( 'b'.Equals( chB ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp new file mode 100644 index 00000000000..ea6ef6ca1a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetNumericValue/CPP/getnumericvalue.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + String^ str = "input: 1"; + Console::WriteLine( Char::GetNumericValue( '8' ) ); // Output: "8" + Console::WriteLine( Char::GetNumericValue( str, 7 ) ); // Output: "1" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp new file mode 100644 index 00000000000..6056fad6c22 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.GetUnicodeCategory/CPP/getunicodecategory.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +int main() +{ + char ch2 = '2'; + String^ str = "Upper Case"; + Console::WriteLine( Char::GetUnicodeCategory( 'a' ).ToString() ); // Output: S"LowercaseLetter" + Console::WriteLine( Char::GetUnicodeCategory( ch2 ).ToString() ); // Output: S"DecimalDigitNumber" + Console::WriteLine( Char::GetUnicodeCategory( str, 6 ).ToString() ); // Output: S"UppercaseLetter" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp new file mode 100644 index 00000000000..9f742e155e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol1.cpp @@ -0,0 +1,35 @@ +// Char.IsControl1.cpp : main project file. +// Char.IsControl(Char) + +// +using namespace System; + +void main() +{ + int charsWritten = 0; + + for (int ctr = 0x00; ctr <= 0xFFFF; ctr++) + { + wchar_t ch = ctr; + if (Char::IsControl(ch)) + { + Console::Write(L"\U{0:X4} ", ctr); + charsWritten++; + if (charsWritten % 6 == 0) + Console::WriteLine(); + } + } +} +// The example displays the following output: +// U0000 U0001 U0002 U0003 U0004 U0005 +// U0006 U0007 U0008 U0009 U000A U000B +// U000C U000D U000E U000F U0010 U0011 +// U0012 U0013 U0014 U0015 U0016 U0017 +// U0018 U0019 U001A U001B U001C U001D +// U001E U001F U007F U0080 U0081 U0082 +// U0083 U0084 U0085 U0086 U0087 U0088 +// U0089 U008A U008B U008C U008D U008E +// U008F U0090 U0091 U0092 U0093 U0094 +// U0095 U0096 U0097 U0098 U0099 U009A +// U009B U009C U009D U009E U009F +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp new file mode 100644 index 00000000000..0fa25aafc01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsControl/CPP/iscontrol2.cpp @@ -0,0 +1,22 @@ +// Char.IsControl2.cpp : main project file. + +// Char.IsControl(String, Int32) + +// +using namespace System; + +void main() +{ + String ^ sentence = "This is a " + Environment::NewLine + "two-line sentence."; + for (int ctr = 0; ctr < sentence->Length; ctr++) + { + if (Char::IsControl(sentence, ctr)) + Console::WriteLine("Control character \\U{0} found in position {1}.", + Convert::ToInt32(sentence[ctr]).ToString("X4"), ctr); + } +} +// The example displays the following output: +// Control character \U000D found in position 10. +// Control character \U000A found in position 11. +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp new file mode 100644 index 00000000000..9de55fe04c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsDigit/CPP/isdigit.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + char ch = '8'; + Console::WriteLine( Char::IsDigit( ch ) ); // Output: "True" + Console::WriteLine( Char::IsDigit( "sample string", 7 ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp new file mode 100644 index 00000000000..ca86988a709 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetter/CPP/isletter.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + char ch = '8'; + Console::WriteLine( Char::IsLetter( ch ) ); // False + Console::WriteLine( Char::IsLetter( "sample string", 7 ) ); // True +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp new file mode 100644 index 00000000000..4ffec1eb61f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLetterOrDigit/CPP/isletterordigit.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + String^ str = "newline:\n"; + Console::WriteLine( Char::IsLetterOrDigit( '8' ) ); // Output: "True" + Console::WriteLine( Char::IsLetterOrDigit( str, 8 ) ); // Output: "False", because it's a newline +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp new file mode 100644 index 00000000000..ea6466897e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsLower/CPP/islower.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + char ch = 'a'; + Console::WriteLine( Char::IsLower( ch ) ); // Output: "True" + Console::WriteLine( Char::IsLower( "upperCase", 5 ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp new file mode 100644 index 00000000000..e462ab9c8b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsNumber/CPP/isnumber.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + String^ str = "non-numeric"; + Console::WriteLine( Char::IsNumber( '8' ) ); // Output: "True" + Console::WriteLine( Char::IsNumber( str, 3 ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp new file mode 100644 index 00000000000..21b3c010264 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsPunctuation/CPP/ispunctuation.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + char ch = '.'; + Console::WriteLine( Char::IsPunctuation( ch ) ); // Output: "True" + Console::WriteLine( Char::IsPunctuation( "no punctuation", 3 ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp new file mode 100644 index 00000000000..51132b2f14c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + String^ str = "twain1 twain2"; + Console::WriteLine( Char::IsSeparator( 'a' ) ); // Output: "False" + Console::WriteLine( Char::IsSeparator( str, 6 ) ); // Output: "True" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp new file mode 100644 index 00000000000..ddec2d22729 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSeparator/CPP/isseparator1.cpp @@ -0,0 +1,36 @@ +// Char.IsSeparator.cpp : main project file. + +// +using namespace System; + +int main() +{ + for (int ctr = Convert::ToInt32(Char::MinValue); ctr <= Convert::ToInt32(Char::MaxValue); ctr++) + { + wchar_t ch = ctr; + if (Char::IsSeparator(ch)) + Console::WriteLine("\u{0:X4} ({1})", (int) ch, Char::GetUnicodeCategory(ch).ToString()); + } +} +// The example displays the following output: +// 0020 (SpaceSeparator) +// u00A0 (SpaceSeparator) +// u1680 (SpaceSeparator) +// u180E (SpaceSeparator) +// u2000 (SpaceSeparator) +// u2001 (SpaceSeparator) +// u2002 (SpaceSeparator) +// u2003 (SpaceSeparator) +// u2004 (SpaceSeparator) +// u2005 (SpaceSeparator) +// u2006 (SpaceSeparator) +// u2007 (SpaceSeparator) +// u2008 (SpaceSeparator) +// u2009 (SpaceSeparator) +// u200A (SpaceSeparator) +// u2028 (LineSeparator) +// u2029 (ParagraphSeparator) +// u202F (SpaceSeparator) +// u205F (SpaceSeparator) +// u3000 (SpaceSeparator) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp new file mode 100644 index 00000000000..d82d071c7a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSurrogate/CPP/issurrogate.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + + // - escape params specifying Unicode not implemented in v7.0 + Console::WriteLine( Char::IsSurrogate( 'a' ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp new file mode 100644 index 00000000000..27bcc3f6fc2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsSymbol/CPP/issymbol.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + String^ str = "non-symbolic characters"; + Console::WriteLine( Char::IsSymbol( '+' ) ); // Output: "True" + Console::WriteLine( Char::IsSymbol( str, 8 ) ); // Output: "False" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp new file mode 100644 index 00000000000..f4062420996 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.IsWhiteSpace/CPP/iswhitespace.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + String^ str = "black matter"; + Console::WriteLine( Char::IsWhiteSpace( 'A' ) ); // Output: "False" + Console::WriteLine( Char::IsWhiteSpace( str, 5 ) ); // Output: "True" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp new file mode 100644 index 00000000000..bb4eecacea5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.Parse/CPP/parse.cpp @@ -0,0 +1,9 @@ + +// +using namespace System; +int main() +{ + Console::WriteLine( Char::Parse( "A" ) ); // Output: 'A' +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp new file mode 100644 index 00000000000..6d94d6be514 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToLower/CPP/tolower.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +using namespace System::Globalization; + +// for CultureInfo +void main() +{ + Console::WriteLine( Char::ToLower( 'A' ) ); // Output: "a" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp new file mode 100644 index 00000000000..7c9937fa77e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Char.ToString/CPP/tostring.cpp @@ -0,0 +1,11 @@ + +// +using namespace System; +int main() +{ + char ch = 'a'; + Console::WriteLine( ch ); // Output: "a" + Console::WriteLine( Char::ToString( 'b' ) ); // Output: "b" +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp new file mode 100644 index 00000000000..6dd27c48dfe --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.CharEnumerator.Class/cpp/charenumerator1.cpp @@ -0,0 +1,75 @@ +// CharEnumerator.Current.cpp : main project file. + + +using namespace System; + +void Example1() +{ + // + String ^ title = "A Tale of Two Cities"; + CharEnumerator ^ chEnum = title->GetEnumerator(); + int ctr = 1; + String ^ outputLine1 = nullptr; + String ^ outputLine2 = nullptr; + String ^ outputLine3 = nullptr; + + while (chEnum->MoveNext()) + { + outputLine1 += ctr < 10 || ctr % 10 != 0 ? " " : (ctr / 10) + " "; + outputLine2 += (ctr % 10) + " "; + outputLine3 += chEnum->Current + " "; + ctr++; + } + + Console::WriteLine("The length of the string is {0} characters:", + title->Length); + Console::WriteLine(outputLine1); + Console::WriteLine(outputLine2); + Console::WriteLine(outputLine3); + // The example displays the following output to the console: + // The length of the string is 20 characters: + // 1 2 + // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 + // A T a l e o f T w o C i t i e s + // + Console::ReadLine(); +} + +void Example2() +{ + // + String ^ title = "A Tale of Two Cities"; + int ctr = 1; + String ^ outputLine1 = nullptr; + String ^ outputLine2 = nullptr; + String ^ outputLine3 = nullptr; + + for each (wchar_t ch in title) + { + outputLine1 += ctr < 10 || ctr % 10 != 0 ? " " : (ctr / 10) + " "; + outputLine2 += (ctr % 10) + " "; + outputLine3 += ch + " "; + ctr++; + } + + Console::WriteLine("The length of the string is {0} characters:", + title->Length); + Console::WriteLine(outputLine1); + Console::WriteLine(outputLine2); + Console::WriteLine(outputLine3); + // The example displays the following output to the console: + // The length of the string is 20 characters: + // 1 2 + // 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 + // A T a l e o f T w o C i t i e s + // + Console::ReadLine(); +} + +void main() +{ + Example1(); + Console::WriteLine(); + Example2(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp new file mode 100644 index 00000000000..de9be7b2fe4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/source2.cpp @@ -0,0 +1,39 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Threading; + +public ref class SamplesStringDictionary +{ +public: + static void Main() + { + // + StringDictionary^ myCollection = gcnew StringDictionary(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesStringDictionary::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp new file mode 100644 index 00000000000..5423aa171ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary/CPP/stringdictionary.cpp @@ -0,0 +1,117 @@ +// The following code example demonstrates several of the properties and methods of StringDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues2( StringDictionary^ myCol ); +void PrintKeysAndValues3( StringDictionary^ myCol ); + +int main() +{ + // Creates and initializes a new StringDictionary. + StringDictionary^ myCol = gcnew StringDictionary; + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IEnumerator:" ); + PrintKeysAndValues2( myCol ); + + // Display the contents of the collection using the Keys, Values, Count, and Item properties. + Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); + PrintKeysAndValues3( myCol ); + + // Copies the StringDictionary to an array with DictionaryEntry elements. + array^myArr = gcnew array(myCol->Count); + myCol->CopyTo( myArr, 0 ); + + // Displays the values in the array. + Console::WriteLine( "Displays the elements in the array:" ); + Console::WriteLine( " KEY VALUE" ); + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( " {0,-10} {1}", myArr[ i ].Key, myArr[ i ].Value ); + Console::WriteLine(); + + // Searches for a value. + if ( myCol->ContainsValue( "amarillo" ) ) + Console::WriteLine( "The collection contains the value \"amarillo\"." ); + else + Console::WriteLine( "The collection does not contain the value \"amarillo\"." ); + + Console::WriteLine(); + + // Searches for a key and deletes it. + if ( myCol->ContainsKey( "green" ) ) + myCol->Remove( "green" ); + + Console::WriteLine( "The collection contains the following elements after removing \"green\":" ); + PrintKeysAndValues2( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues2( myCol ); +} + +// Uses the enumerator. +void PrintKeysAndValues2( StringDictionary^ myCol ) +{ + IEnumerator^ myEnumerator = myCol->GetEnumerator(); + DictionaryEntry de; + Console::WriteLine( " KEY VALUE" ); + while ( myEnumerator->MoveNext() ) + { + de = *dynamic_cast(myEnumerator->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +// Uses the Keys, Values, Count, and Item properties. +void PrintKeysAndValues3( StringDictionary^ myCol ) +{ + array^myKeys = gcnew array(myCol->Count); + myCol->Keys->CopyTo( myKeys, 0 ); + Console::WriteLine( " INDEX KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +Displays the elements using the IEnumerator: + KEY VALUE + red rojo + blue azul + green verde + +Displays the elements using the Keys, Values, Count, and Item properties: + INDEX KEY VALUE + 0 red rojo + 1 blue azul + 2 green verde + +Displays the elements in the array: + KEY VALUE + red rojo + blue azul + green verde + +The collection does not contain the value "amarillo". + +The collection contains the following elements after removing "green": + KEY VALUE + red rojo + blue azul + +The collection contains the following elements after it is cleared: + KEY VALUE + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp new file mode 100644 index 00000000000..c477bb3710f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_AddRemove/CPP/stringdictionary_addremove.cpp @@ -0,0 +1,65 @@ + + +// The following code example demonstrates how to add and remove elements from a StringDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( StringDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ enum0 = myCol->GetEnumerator(); + while ( enum0->MoveNext() ) + { + DictionaryEntry^ de = safe_cast(enum0->Current); + Console::WriteLine( " {0,-10} {1}", de->Key, de->Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new StringDictionary. + StringDictionary^ myCol = gcnew StringDictionary; + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + + // Displays the values in the StringDictionary. + Console::WriteLine( "Initial contents of the StringDictionary:" ); + PrintKeysAndValues( myCol ); + + // Deletes an element. + myCol->Remove( "green" ); + Console::WriteLine( "The collection contains the following elements after removing \"green\":" ); + PrintKeysAndValues( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues( myCol ); +} + +/* +This code produces the following output. + +Initial contents of the StringDictionary: + KEY VALUE + green verde + red rojo + blue azul + +The collection contains the following elements after removing "green": + KEY VALUE + red rojo + blue azul + +The collection contains the following elements after it is cleared: + KEY VALUE + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp new file mode 100644 index 00000000000..854a898a04a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Contains/CPP/stringdictionary_contains.cpp @@ -0,0 +1,67 @@ + + +// The following code example searches for an element in a StringDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( StringDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ enum0 = myCol->GetEnumerator(); + while ( enum0->MoveNext() ) + { + DictionaryEntry^ de = safe_cast(enum0->Current); + Console::WriteLine( " {0,-10} {1}", de->Key, de->Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new StringDictionary. + StringDictionary^ myCol = gcnew StringDictionary; + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + + // Displays the values in the StringDictionary. + Console::WriteLine( "Initial contents of the StringDictionary:" ); + PrintKeysAndValues( myCol ); + + // Searches for a key. + if ( myCol->ContainsKey( "red" ) ) + Console::WriteLine( "The collection contains the key \"red\"." ); + else + Console::WriteLine( "The collection does not contain the key \"red\"." ); + + Console::WriteLine(); + + // Searches for a value. + if ( myCol->ContainsValue( "amarillo" ) ) + Console::WriteLine( "The collection contains the value \"amarillo\"." ); + else + Console::WriteLine( "The collection does not contain the value \"amarillo\"." ); + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the StringDictionary: + KEY VALUE + green verde + red rojo + blue azul + +The collection contains the key "red". + +The collection does not contain the value "amarillo". + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp new file mode 100644 index 00000000000..a7c20a92885 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/stringdictionary_enumeration.cpp @@ -0,0 +1,90 @@ +// The following code example enumerates the elements of a StringDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintKeysAndValues1( StringDictionary^ myCol ); +void PrintKeysAndValues2( StringDictionary^ myCol ); +void PrintKeysAndValues3( StringDictionary^ myCol ); + +int main() +{ + // Creates and initializes a new StringDictionary. + StringDictionary^ myCol = gcnew StringDictionary; + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + + // Display the contents of the collection using for each. This is the preferred method. + Console::WriteLine( "Displays the elements using for each:" ); + PrintKeysAndValues1( myCol ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IEnumerator:" ); + PrintKeysAndValues2( myCol ); + + // Display the contents of the collection using the Keys, Values, Count, and Item properties. + Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); + PrintKeysAndValues3( myCol ); +} + +// Uses the for each statement which hides the complexity of the enumerator. +// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. +void PrintKeysAndValues1( StringDictionary^ myCol ) { + Console::WriteLine( " KEY VALUE" ); + for each ( DictionaryEntry^ de in myCol ) + Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintKeysAndValues2( StringDictionary^ myCol ) +{ + IEnumerator^ myEnumerator = myCol->GetEnumerator(); + DictionaryEntry^ de; + Console::WriteLine( " KEY VALUE" ); + while ( myEnumerator->MoveNext() ) + { + de = (DictionaryEntry^)(myEnumerator->Current); + Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); + } + Console::WriteLine(); +} + +// Uses the Keys, Values, Count, and Item properties. +void PrintKeysAndValues3( StringDictionary^ myCol ) +{ + array^myKeys = gcnew array(myCol->Count); + myCol->Keys->CopyTo( myKeys, 0 ); + Console::WriteLine( " INDEX KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +Displays the elements using for each: + KEY VALUE + red rojo + blue azul + green verde + +Displays the elements using the IEnumerator: + KEY VALUE + red rojo + blue azul + green verde + +Displays the elements using the Keys, Values, Count, and Item properties: + INDEX KEY VALUE + 0 red rojo + 1 blue azul + 2 green verde + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp new file mode 100644 index 00000000000..b62ad64ac50 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collection.Specialized.StringDictionary_Enumeration/CPP/values.cpp @@ -0,0 +1,38 @@ +// The following code example enumerates the elements of a StringDictionary. + +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class SamplesStringDictionary +{ +public: + static void Main() + { + // Creates and initializes a new StringDictionary. + StringDictionary^ myCol = gcnew StringDictionary(); + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + + Console::WriteLine("VALUES"); + for each (String^ val in myCol->Values) + { + Console::WriteLine(val); + } + } +}; + +int main() +{ + SamplesStringDictionary::Main(); +} +// This code produces the following output. +// VALUES +// verde +// rojo +// azul +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp new file mode 100644 index 00000000000..a412d7c2739 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source.cpp @@ -0,0 +1,94 @@ +// +using namespace System; +using namespace System::Collections; + +public ref class Example +{ +public: + static void Main() + { + // Create an empty ArrayList, and add some elements. + ArrayList^ stringList = gcnew ArrayList(); + + stringList->Add("a"); + stringList->Add("abc"); + stringList->Add("abcdef"); + stringList->Add("abcdefg"); + + // The Item property is an indexer, so the property name is + // not required. + Console::WriteLine("Element {0} is \"{1}\"", 2, stringList[2]); + + // Assigning a value to the property changes the value of + // the indexed element. + stringList[2] = "abcd"; + Console::WriteLine("Element {0} is \"{1}\"", 2, stringList[2]); + + // Accessing an element outside the current element count + // causes an exception. + Console::WriteLine("Number of elements in the list: {0}", + stringList->Count); + try + { + Console::WriteLine("Element {0} is \"{1}\"", + stringList->Count, stringList[stringList->Count]); + } + catch (ArgumentOutOfRangeException^ aoore) + { + Console::WriteLine("stringList({0}) is out of range.", + stringList->Count); + } + + // You cannot use the Item property to add new elements. + try + { + stringList[stringList->Count] = "42"; + } + catch (ArgumentOutOfRangeException^ aoore) + { + Console::WriteLine("stringList({0}) is out of range.", + stringList->Count); + } + + Console::WriteLine(); + for (int i = 0; i < stringList->Count; i++) + { + Console::WriteLine("Element {0} is \"{1}\"", i, + stringList[i]); + } + + Console::WriteLine(); + for each (Object^ o in stringList) + { + Console::WriteLine(o); + } + } +}; + +int main() +{ + Example::Main(); +} +/* + This code example produces the following output: + +Element 2 is "abcdef" +Element 2 is "abcd" +Number of elements in the list: 4 +stringList(4) is out of range. +stringList(4) is out of range. + +Element 0 is "a" +Element 1 is "abc" +Element 2 is "abcd" +Element 3 is "abcdefg" + +a +abc +abcd +abcdefg + */ +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp new file mode 100644 index 00000000000..5a66b7c3b74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Item/cpp/source2.cpp @@ -0,0 +1,69 @@ +// +using namespace System; +using namespace System::Collections; + +public ref class ScrambleList : public ArrayList +{ +public: + static void Main() + { + // Create an empty ArrayList, and add some elements. + ScrambleList^ integerList = gcnew ScrambleList(); + + for (int i = 0; i < 10; i++) + { + integerList->Add(i); + } + + Console::WriteLine("Ordered:\n"); + for each (int value in integerList) + { + Console::Write("{0}, ", value); + } + Console::WriteLine("\n\nScrambled:\n"); + + // Scramble the order of the items in the list. + integerList->Scramble(); + + for each (int value in integerList) + { + Console::Write("{0}, ", value); + } + Console::WriteLine("\n"); + } + + void Scramble() + { + int limit = this->Count; + int temp; + int swapindex; + Random^ rnd = gcnew Random(); + for (int i = 0; i < limit; i++) + { + // The Item property of ArrayList is the default indexer. Thus, + // this->default[i] and this[i] are used interchangeably. + temp = (int)this->default[i]; + swapindex = rnd->Next(0, limit - 1); + this[i] = this->default[swapindex]; + this[swapindex] = temp; + } + } +}; + +int main() +{ + ScrambleList::Main(); +} +// The program produces output similar to the following: +// +// Ordered: +// +// 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, +// +// Scrambled: +// +// 5, 2, 8, 9, 6, 1, 7, 0, 4, 3, +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp new file mode 100644 index 00000000000..c56559204dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_2/CPP/arraylist_sort2.cpp @@ -0,0 +1,98 @@ + +// The following example shows how to sort the values in an using the default comparer and a custom comparer which reverses the sort order. +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndValues( IEnumerable^ myList ); +ref class myReverserClass: public IComparer +{ +private: + + // Calls CaseInsensitiveComparer.Compare with the parameters reversed. + virtual int Compare( Object^ x, Object^ y ) sealed = IComparer::Compare + { + return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); + } + +}; + +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList initially contains the following values:" ); + PrintIndexAndValues( myAL ); + + // Sorts the values of the ArrayList using the default comparer. + myAL->Sort(); + Console::WriteLine( "After sorting with the default comparer:" ); + PrintIndexAndValues( myAL ); + + // Sorts the values of the ArrayList using the reverse case-insensitive comparer. + IComparer^ myComparer = gcnew myReverserClass; + myAL->Sort( myComparer ); + Console::WriteLine( "After sorting with the reverse case-insensitive comparer:" ); + PrintIndexAndValues( myAL ); +} + +void PrintIndexAndValues( IEnumerable^ myList ) +{ + int i = 0; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( "\t[{0}]:\t{1}", i++, obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. +The ArrayList initially contains the following values: + [0]: The + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + +After sorting with the default comparer: + [0]: brown + [1]: dog + [2]: fox + [3]: jumps + [4]: lazy + [5]: over + [6]: quick + [7]: the + [8]: The + +After sorting with the reverse case-insensitive comparer: + [0]: the + [1]: The + [2]: quick + [3]: over + [4]: lazy + [5]: jumps + [6]: fox + [7]: dog + [8]: brown +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp new file mode 100644 index 00000000000..41bde08602c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.Sort_3/CPP/arraylist_sort3.cpp @@ -0,0 +1,98 @@ + +// The following example shows how to sort the values in a section of an using the default comparer and a custom comparer which reverses the sort order. +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndValues( IEnumerable^ myList ); +ref class myReverserClass: public IComparer +{ +private: + + // Calls CaseInsensitiveComparer.Compare with the parameters reversed. + virtual int Compare( Object^ x, Object^ y ) = IComparer::Compare + { + return ((gcnew CaseInsensitiveComparer)->Compare( y, x )); + } + +}; + +int main() +{ + + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "QUICK" ); + myAL->Add( "BROWN" ); + myAL->Add( "FOX" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList initially contains the following values:" ); + PrintIndexAndValues( myAL ); + + // Sorts the values of the ArrayList using the default comparer. + myAL->Sort( 1, 3, nullptr ); + Console::WriteLine( "After sorting from index 1 to index 3 with the default comparer:" ); + PrintIndexAndValues( myAL ); + + // Sorts the values of the ArrayList using the reverse case-insensitive comparer. + IComparer^ myComparer = gcnew myReverserClass; + myAL->Sort( 1, 3, myComparer ); + Console::WriteLine( "After sorting from index 1 to index 3 with the reverse case-insensitive comparer:" ); + PrintIndexAndValues( myAL ); +} + +void PrintIndexAndValues( IEnumerable^ myList ) +{ + int i = 0; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( "\t[{0}]:\t{1}", i++, obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. +The ArrayList initially contains the following values: + [0]: The + [1]: QUICK + [2]: BROWN + [3]: FOX + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + +After sorting from index 1 to index 3 with the default comparer: + [0]: The + [1]: BROWN + [2]: FOX + [3]: QUICK + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + +After sorting from index 1 to index 3 with the reverse case-insensitive comparer: + [0]: The + [1]: QUICK + [2]: FOX + [3]: BROWN + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp new file mode 100644 index 00000000000..4ffd521bcd4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ArrayList.ToArray/CPP/arraylist_toarray.cpp @@ -0,0 +1,80 @@ + +// The following example shows how to copy the elements of an ArrayList to a string array. +// +using namespace System; +using namespace System::Collections; +void PrintIndexAndValues( ArrayList^ myList ); +void PrintIndexAndValues( array^myArr ); +int main() +{ + // Creates and initializes a new ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "The" ); + myAL->Add( "quick" ); + myAL->Add( "brown" ); + myAL->Add( "fox" ); + myAL->Add( "jumps" ); + myAL->Add( "over" ); + myAL->Add( "the" ); + myAL->Add( "lazy" ); + myAL->Add( "dog" ); + + // Displays the values of the ArrayList. + Console::WriteLine( "The ArrayList contains the following values:" ); + PrintIndexAndValues( myAL ); + + // Copies the elements of the ArrayList to a string array. + array^myArr = reinterpret_cast^>(myAL->ToArray( String::typeid )); + + // Displays the contents of the string array. + Console::WriteLine( "The string array contains the following values:" ); + PrintIndexAndValues( myArr ); +} + +void PrintIndexAndValues( ArrayList^ myList ) +{ + int i = 0; + IEnumerator^ myEnum = myList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "\t[{0}]:\t{1}", i++, o ); + } + + Console::WriteLine(); +} + +void PrintIndexAndValues( array^myArr ) +{ + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( "\t[{0}]:\t{1}", i, myArr[ i ] ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +The ArrayList contains the following values: + [0]: The + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + +The string array contains the following values: + [0]: The + [1]: quick + [2]: brown + [3]: fox + [4]: jumps + [5]: over + [6]: the + [7]: lazy + [8]: dog + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp new file mode 100644 index 00000000000..352f55da5ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CaseInsensitive/CPP/caseinsensitive.cpp @@ -0,0 +1,55 @@ + +// The following code example creates a case-sensitive hashtable and a case-insensitive hashtable +// and demonstrates the difference in their behavior, even if both contain the same elements. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; +int main() +{ + + // Create a Hashtable using the default hash code provider and the default comparer. + Hashtable^ myHT1 = gcnew Hashtable; + myHT1->Add( "FIRST", "Hello" ); + myHT1->Add( "SECOND", "World" ); + myHT1->Add( "THIRD", "!" ); + + // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, + // based on the culture of the current thread. + Hashtable^ myHT2 = gcnew Hashtable( gcnew CaseInsensitiveHashCodeProvider,gcnew CaseInsensitiveComparer ); + myHT2->Add( "FIRST", "Hello" ); + myHT2->Add( "SECOND", "World" ); + myHT2->Add( "THIRD", "!" ); + + // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, + // based on the InvariantCulture. + Hashtable^ myHT3 = gcnew Hashtable( CaseInsensitiveHashCodeProvider::DefaultInvariant,CaseInsensitiveComparer::DefaultInvariant ); + myHT3->Add( "FIRST", "Hello" ); + myHT3->Add( "SECOND", "World" ); + myHT3->Add( "THIRD", "!" ); + + // Create a Hashtable using a case-insensitive code provider and a case-insensitive comparer, + // based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i". + CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); + Hashtable^ myHT4 = gcnew Hashtable( gcnew CaseInsensitiveHashCodeProvider( myCul ),gcnew CaseInsensitiveComparer( myCul ) ); + myHT4->Add( "FIRST", "Hello" ); + myHT4->Add( "SECOND", "World" ); + myHT4->Add( "THIRD", "!" ); + + // Search for a key in each hashtable. + Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT4: {0}", myHT4->ContainsKey( "first" ) ); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +first is in myHT1: False +first is in myHT2: True +first is in myHT3: True +first is in myHT4: False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp new file mode 100644 index 00000000000..c12910d57c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/collectionbase.cpp @@ -0,0 +1,183 @@ + + +// The following code example implements the CollectionBase class and uses that implementation to create a collection of Int16 objects. +// +#using + +using namespace System; +using namespace System::Collections; + +public ref class Int16Collection: public CollectionBase +{ +public: + + property Int16 Item [int] + { + Int16 get( int index ) + { + return ( (Int16)(List[ index ])); + } + + void set( int index, Int16 value ) + { + List[ index ] = value; + } + } + int Add( Int16 value ) + { + return (List->Add( value )); + } + + int IndexOf( Int16 value ) + { + return (List->IndexOf( value )); + } + + void Insert( int index, Int16 value ) + { + List->Insert( index, value ); + } + + void Remove( Int16 value ) + { + List->Remove( value ); + } + + bool Contains( Int16 value ) + { + // If value is not of type Int16, this will return false. + return (List->Contains( value )); + } + +protected: + virtual void OnInsert( int /*index*/, Object^ /*value*/ ) override + { + // Insert additional code to be run only when inserting values. + } + + virtual void OnRemove( int /*index*/, Object^ /*value*/ ) override + { + // Insert additional code to be run only when removing values. + } + + virtual void OnSet( int /*index*/, Object^ /*oldValue*/, Object^ /*newValue*/ ) override + { + // Insert additional code to be run only when setting values. + } + + virtual void OnValidate( Object^ value ) override + { + if ( value->GetType() != Type::GetType( "System.Int16" ) ) + throw gcnew ArgumentException( "value must be of type Int16.","value" ); + } + +}; + +void PrintIndexAndValues( Int16Collection^ myCol ); +void PrintValues2( Int16Collection^ myCol ); +int main() +{ + // Create and initialize a new CollectionBase. + Int16Collection^ myI16 = gcnew Int16Collection; + + // Add elements to the collection. + myI16->Add( (Int16)1 ); + myI16->Add( (Int16)2 ); + myI16->Add( (Int16)3 ); + myI16->Add( (Int16)5 ); + myI16->Add( (Int16)7 ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Contents of the collection (using enumerator):" ); + PrintValues2( myI16 ); + + // Display the contents of the collection using the Count property and the Item property. + Console::WriteLine( "Initial contents of the collection (using Count and Item):" ); + PrintIndexAndValues( myI16 ); + + // Search the collection with Contains and IndexOf. + Console::WriteLine( "Contains 3: {0}", myI16->Contains( 3 ) ); + Console::WriteLine( "2 is at index {0}.", myI16->IndexOf( 2 ) ); + Console::WriteLine(); + + // Insert an element into the collection at index 3. + myI16->Insert( 3, (Int16)13 ); + Console::WriteLine( "Contents of the collection after inserting at index 3:" ); + PrintIndexAndValues( myI16 ); + + // Get and set an element using the index. + myI16->Item[ 4 ] = 123; + Console::WriteLine( "Contents of the collection after setting the element at index 4 to 123:" ); + PrintIndexAndValues( myI16 ); + + // Remove an element from the collection. + myI16->Remove( (Int16)2 ); + + // Display the contents of the collection using the Count property and the Item property. + Console::WriteLine( "Contents of the collection after removing the element 2:" ); + PrintIndexAndValues( myI16 ); +} + +// Uses the Count property and the Item property. +void PrintIndexAndValues( Int16Collection^ myCol ) +{ + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " [{0}]: {1}", i, myCol->Item[ i ] ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintValues2( Int16Collection^ myCol ) +{ + System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0}", myEnumerator->Current ); + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Contents of the collection (using enumerator): + 1 + 2 + 3 + 5 + 7 + +Initial contents of the collection (using Count and Item): + [0]: 1 + [1]: 2 + [2]: 3 + [3]: 5 + [4]: 7 + +Contains 3: True +2 is at index 1. + +Contents of the collection after inserting at index 3: + [0]: 1 + [1]: 2 + [2]: 3 + [3]: 13 + [4]: 5 + [5]: 7 + +Contents of the collection after setting the element at index 4 to 123: + [0]: 1 + [1]: 2 + [2]: 3 + [3]: 13 + [4]: 123 + [5]: 7 + +Contents of the collection after removing the element 2: + [0]: 1 + [1]: 3 + [2]: 13 + [3]: 123 + [4]: 7 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp new file mode 100644 index 00000000000..5c672dbc203 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.CollectionBase/CPP/remarks.cpp @@ -0,0 +1,118 @@ + + +// The following code example implements the CollectionBase class and uses that implementation to create a collection of Int16 objects. +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class Int16Collection: public CollectionBase +{ +public: + + property Int16 Item [int] + { + Int16 get( int index ) + { + return ( (Int16)(List[ index ])); + } + + void set( int index, Int16 value ) + { + List[ index ] = value; + } + } + int Add( Int16 value ) + { + return (List->Add( value )); + } + + int IndexOf( Int16 value ) + { + return (List->IndexOf( value )); + } + + void Insert( int index, Int16 value ) + { + List->Insert( index, value ); + } + + void Remove( Int16 value ) + { + List->Remove( value ); + } + + bool Contains( Int16 value ) + { + // If value is not of type Int16, this will return false. + return (List->Contains( value )); + } + +protected: + virtual void OnInsert( int /*index*/, Object^ /*value*/ ) override + { + // Insert additional code to be run only when inserting values. + } + + virtual void OnRemove( int /*index*/, Object^ /*value*/ ) override + { + // Insert additional code to be run only when removing values. + } + + virtual void OnSet( int /*index*/, Object^ /*oldValue*/, Object^ /*newValue*/ ) override + { + // Insert additional code to be run only when setting values. + } + + virtual void OnValidate( Object^ value ) override + { + if ( value->GetType() != Type::GetType( "System.Int16" ) ) + throw gcnew ArgumentException( "value must be of type Int16.","value" ); + } + +}; + +public ref class SamplesCollectionBase +{ +public: + static void Main() + { + // Create and initialize a new CollectionBase. + Int16Collection^ myCollectionBase = gcnew Int16Collection(); + + // Add elements to the collection. + myCollectionBase->Add( (Int16) 1 ); + myCollectionBase->Add( (Int16) 2 ); + myCollectionBase->Add( (Int16) 3 ); + myCollectionBase->Add( (Int16) 5 ); + myCollectionBase->Add( (Int16) 7 ); + + // + // Get the ICollection interface from the CollectionBase + // derived class. + ICollection^ myCollection = myCollectionBase; + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesCollectionBase::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp new file mode 100644 index 00000000000..8103ba2ad12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Comparer/CPP/comparercultures.cpp @@ -0,0 +1,36 @@ + +// The following code example shows how Compare returns different values depending on the culture associated with the Comparer. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; +int main() +{ + + // Creates the strings to compare. + String^ str1 = "llegar"; + String^ str2 = "lugar"; + Console::WriteLine( "Comparing \"{0}\" and \"{1}\" ...", str1, str2 ); + + // Uses the DefaultInvariant Comparer. + Console::WriteLine( " Invariant Comparer: {0}", Comparer::DefaultInvariant->Compare( str1, str2 ) ); + + // Uses the Comparer based on the culture "es-ES" (Spanish - Spain, international sort). + Comparer^ myCompIntl = gcnew Comparer( gcnew CultureInfo( "es-ES",false ) ); + Console::WriteLine( " International Sort: {0}", myCompIntl->Compare( str1, str2 ) ); + + // Uses the Comparer based on the culture identifier 0x040A (Spanish - Spain, traditional sort). + Comparer^ myCompTrad = gcnew Comparer( gcnew CultureInfo( 0x040A,false ) ); + Console::WriteLine( " Traditional Sort : {0}", myCompTrad->Compare( str1, str2 ) ); +} + +/* +This code produces the following output. + +Comparing "llegar" and "lugar" ... + Invariant Comparer: -1 + International Sort: -1 + Traditional Sort : 1 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp new file mode 100644 index 00000000000..f22de93e8e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/dictionarybase.cpp @@ -0,0 +1,258 @@ + +// The following code example implements the DictionaryBase class and uses that implementation to create a dictionary of String keys and values that have a Length of 5 or less. +// +using namespace System; +using namespace System::Collections; + +public ref class ShortStringDictionary: public DictionaryBase +{ +public: + + property String^ Item [String^] + { + String^ get( String^ key ) + { + return (dynamic_cast(Dictionary[ key ])); + } + + void set( String^ value, String^ key ) + { + Dictionary[ key ] = value; + } + } + + property ICollection^ Keys + { + ICollection^ get() + { + return (Dictionary->Keys); + } + } + + property ICollection^ Values + { + ICollection^ get() + { + return (Dictionary->Values); + } + } + void Add( String^ key, String^ value ) + { + Dictionary->Add( key, value ); + } + + bool Contains( String^ key ) + { + return (Dictionary->Contains( key )); + } + + void Remove( String^ key ) + { + Dictionary->Remove( key ); + } + + +protected: + virtual void OnInsert( Object^ key, Object^ value ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + + if ( value->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "value must be of type String.","value" ); + else + { + String^ strValue = dynamic_cast(value); + if ( strValue->Length > 5 ) + throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); + } + } + + virtual void OnRemove( Object^ key, Object^ /*value*/ ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + } + + virtual void OnSet( Object^ key, Object^ /*oldValue*/, Object^ newValue ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + + if ( newValue->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "newValue must be of type String.","newValue" ); + else + { + String^ strValue = dynamic_cast(newValue); + if ( strValue->Length > 5 ) + throw gcnew ArgumentException( "newValue must be no more than 5 characters in length.","newValue" ); + } + } + + virtual void OnValidate( Object^ key, Object^ value ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + + if ( value->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "value must be of type String.","value" ); + else + { + String^ strValue = dynamic_cast(value); + if ( strValue->Length > 5 ) + throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); + } + } + +}; + +void PrintKeysAndValues2( ShortStringDictionary^ myCol ); +void PrintKeysAndValues3( ShortStringDictionary^ myCol ); +int main() +{ + // Creates and initializes a new DictionaryBase. + ShortStringDictionary^ mySSC = gcnew ShortStringDictionary; + + // Adds elements to the collection. + mySSC->Add( "One", "a" ); + mySSC->Add( "Two", "ab" ); + mySSC->Add( "Three", "abc" ); + mySSC->Add( "Four", "abcd" ); + mySSC->Add( "Five", "abcde" ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Contents of the collection (using enumerator):" ); + PrintKeysAndValues2( mySSC ); + + // Display the contents of the collection using the Keys property and the Item property. + Console::WriteLine( "Initial contents of the collection (using Keys and Item):" ); + PrintKeysAndValues3( mySSC ); + + // Tries to add a value that is too long. + try + { + mySSC->Add( "Ten", "abcdefghij" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + // Tries to add a key that is too long. + try + { + mySSC->Add( "Eleven", "ijk" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + Console::WriteLine(); + + // Searches the collection with Contains. + Console::WriteLine( "Contains \"Three\": {0}", mySSC->Contains( "Three" ) ); + Console::WriteLine( "Contains \"Twelve\": {0}", mySSC->Contains( "Twelve" ) ); + Console::WriteLine(); + + // Removes an element from the collection. + mySSC->Remove( "Two" ); + + // Displays the contents of the collection. + Console::WriteLine( "After removing \"Two\":" ); + PrintKeysAndValues2( mySSC ); +} + +// Uses the enumerator. +void PrintKeysAndValues2( ShortStringDictionary^ myCol ) +{ + DictionaryEntry myDE; + System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + if ( myEnumerator->Current != nullptr ) + { + myDE = *dynamic_cast(myEnumerator->Current); + Console::WriteLine( " {0,-5} : {1}", myDE.Key, myDE.Value ); + } + + Console::WriteLine(); +} + + +// Uses the Keys property and the Item property. +void PrintKeysAndValues3( ShortStringDictionary^ myCol ) +{ + ICollection^ myKeys = myCol->Keys; + IEnumerator^ myEnum1 = myKeys->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + String^ k = safe_cast(myEnum1->Current); + Console::WriteLine( " {0,-5} : {1}", k, myCol->Item[ k ] ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Contents of the collection (using enumerator): + Three : abc + Five : abcde + Two : ab + One : a + Four : abcd + +Initial contents of the collection (using Keys and Item): + Three : abc + Five : abcde + Two : ab + One : a + Four : abcd + +System.ArgumentException: value must be no more than 5 characters in length. +Parameter name: value + at ShortStringDictionary.OnValidate(Object key, Object value) + at System.Collections.DictionaryBase.System.Collections.IDictionary.Add(Object key, Object value) + at SamplesDictionaryBase.Main() +System.ArgumentException: key must be no more than 5 characters in length. +Parameter name: key + at ShortStringDictionary.OnValidate(Object key, Object value) + at System.Collections.DictionaryBase.System.Collections.IDictionary.Add(Object key, Object value) + at SamplesDictionaryBase.Main() + +Contains "Three": True +Contains "Twelve": False + +After removing "Two": + Three : abc + Five : abcde + One : a + Four : abcd + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp new file mode 100644 index 00000000000..6d4bc281691 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryBase/CPP/source2.cpp @@ -0,0 +1,171 @@ + +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class ShortStringDictionary: public DictionaryBase +{ +public: + + property String^ Item [String^] + { + String^ get( String^ key ) + { + return (dynamic_cast(Dictionary[ key ])); + } + + void set( String^ value, String^ key ) + { + Dictionary[ key ] = value; + } + } + + property ICollection^ Keys + { + ICollection^ get() + { + return (Dictionary->Keys); + } + } + + property ICollection^ Values + { + ICollection^ get() + { + return (Dictionary->Values); + } + } + void Add( String^ key, String^ value ) + { + Dictionary->Add( key, value ); + } + + bool Contains( String^ key ) + { + return (Dictionary->Contains( key )); + } + + void Remove( String^ key ) + { + Dictionary->Remove( key ); + } + + +protected: + virtual void OnInsert( Object^ key, Object^ value ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + + if ( value->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "value must be of type String.","value" ); + else + { + String^ strValue = dynamic_cast(value); + if ( strValue->Length > 5 ) + throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); + } + } + + virtual void OnRemove( Object^ key, Object^ /*value*/ ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + } + + virtual void OnSet( Object^ key, Object^ /*oldValue*/, Object^ newValue ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + + if ( newValue->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "newValue must be of type String.","newValue" ); + else + { + String^ strValue = dynamic_cast(newValue); + if ( strValue->Length > 5 ) + throw gcnew ArgumentException( "newValue must be no more than 5 characters in length.","newValue" ); + } + } + + virtual void OnValidate( Object^ key, Object^ value ) override + { + if ( key->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "key must be of type String.","key" ); + else + { + String^ strKey = dynamic_cast(key); + if ( strKey->Length > 5 ) + throw gcnew ArgumentException( "key must be no more than 5 characters in length.","key" ); + } + + if ( value->GetType() != Type::GetType( "System.String" ) ) + throw gcnew ArgumentException( "value must be of type String.","value" ); + else + { + String^ strValue = dynamic_cast(value); + if ( strValue->Length > 5 ) + throw gcnew ArgumentException( "value must be no more than 5 characters in length.","value" ); + } + } + +}; + +public ref class SamplesDictionaryBase +{ +public: + static void Main() + { + DictionaryBase^ myDictionary = gcnew ShortStringDictionary(); + + // + for each (DictionaryEntry de in myDictionary) + { + //... + } + // + + // + ICollection^ myCollection = gcnew ShortStringDictionary(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesDictionaryBase::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp new file mode 100644 index 00000000000..e7587a1e80f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.DictionaryEntry/cpp/dictionaryentrysample.cpp @@ -0,0 +1,46 @@ +// +// A simple example for the DictionaryEntry structure. +using namespace System; +using namespace System::Collections; + +public ref class Example +{ +public: + static void Main() + { + // Create a new hash table. + // + Hashtable^ openWith = gcnew Hashtable(); + + // Add some elements to the hash table. There are no + // duplicate keys, but some of the values are duplicates. + openWith->Add("txt", "notepad.exe"); + openWith->Add("bmp", "paint.exe"); + openWith->Add("dib", "paint.exe"); + openWith->Add("rtf", "wordpad.exe"); + + // When you use foreach to enumerate hash table elements, + // the elements are retrieved as DictionaryEntry objects. + Console::WriteLine(); + // + for each (DictionaryEntry de in openWith) + { + Console::WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); + } + // + } +}; + +int main() +{ + Example::Main(); +} + +/* This code example produces output similar to the following: + +Key = rtf, Value = wordpad.exe +Key = txt, Value = notepad.exe +Key = dib, Value = paint.exe +Key = bmp, Value = paint.exe + */ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp new file mode 100644 index 00000000000..4378b0f208a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/program.cpp @@ -0,0 +1,62 @@ +// +#using + +using namespace System; +using namespace System::Collections::Generic; + +ref class Program +{ +public: + // + static void Main() + { + HashSet^ lowNumbers = gcnew HashSet(); + HashSet^ highNumbers = gcnew HashSet(); + + for (int i = 0; i < 6; i++) + { + lowNumbers->Add(i); + } + + for (int i = 3; i < 10; i++) + { + highNumbers->Add(i); + } + + Console::Write("lowNumbers contains {0} elements: ", lowNumbers->Count); + DisplaySet(lowNumbers); + + Console::Write("highNumbers contains {0} elements: ", highNumbers->Count); + DisplaySet(highNumbers); + + Console::WriteLine("highNumbers ExceptWith lowNumbers..."); + highNumbers->ExceptWith(lowNumbers); + + Console::Write("highNumbers contains {0} elements: ", highNumbers->Count); + DisplaySet(highNumbers); + } + /* This example provides output similar to the following: + * lowNumbers contains 6 elements: { 0 1 2 3 4 5 } + * highNumbers contains 7 elements: { 3 4 5 6 7 8 9 } + * highNumbers ExceptWith lowNumbers... + * highNumbers contains 4 elements: { 6 7 8 9 } + */ + // + +private: + static void DisplaySet(HashSet^ set) + { + Console::Write("{"); + for each (int i in set) + { + Console::Write(" {0}", i); + } + Console::WriteLine(" }"); + } +}; + +int main() +{ + Program::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp new file mode 100644 index 00000000000..2ff29223cc6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.HashSet_ExceptWith/cpp/source2.cpp @@ -0,0 +1,122 @@ +// +#using + +using namespace System; +using namespace System::Collections::Generic; + +ref class Program +{ +public: + static void Main() + { + HashSet ^allVehicles = gcnew HashSet(StringComparer::OrdinalIgnoreCase); + List^ someVehicles = gcnew List(); + + someVehicles->Add("Planes"); + someVehicles->Add("Trains"); + someVehicles->Add("Automobiles"); + + // Add in the vehicles contained in the someVehicles list. + allVehicles->UnionWith(someVehicles); + + Console::WriteLine("The current HashSet contains:\n"); + for each (String^ vehicle in allVehicles) + { + Console::WriteLine(vehicle); + } + + allVehicles->Add("Ships"); + allVehicles->Add("Motorcycles"); + allVehicles->Add("Rockets"); + allVehicles->Add("Helicopters"); + allVehicles->Add("Submarines"); + + Console::WriteLine("\nThe updated HashSet contains:\n"); + for each (String^ vehicle in allVehicles) + { + Console::WriteLine(vehicle); + } + + // Verify that the 'All Vehicles' set contains at least the vehicles in + // the 'Some Vehicles' list. + if (allVehicles->IsSupersetOf(someVehicles)) + { + Console::Write("\nThe 'All' vehicles set contains everything in "); + Console::WriteLine("'Some' vechicles list."); + } + + // Check for Rockets. Here the OrdinalIgnoreCase comparer will compare + // true for the mixed-case vehicle type. + if (allVehicles->Contains("roCKeTs")) + { + Console::WriteLine("\nThe 'All' vehicles set contains 'roCKeTs'"); + } + + allVehicles->ExceptWith(someVehicles); + Console::WriteLine("\nThe excepted HashSet contains:\n"); + for each (String^ vehicle in allVehicles) + { + Console::WriteLine(vehicle); + } + + // Remove all the vehicles that are not 'super cool'. + allVehicles->RemoveWhere(gcnew Predicate(&isNotSuperCool)); + + Console::WriteLine("\nThe super cool vehicles are:\n"); + for each (String^ vehicle in allVehicles) + { + Console::WriteLine(vehicle); + } + } + +private: + // Predicate to determine vehicle 'coolness'. + static bool isNotSuperCool(String^ vehicle) + { + bool superCool = (vehicle == "Helicopters") || (vehicle == "Motorcycles"); + + return !superCool; + } +}; + +int main() +{ + Program::Main(); +} + +// The program writes the following output to the console:: +// +// The current HashSet contains: +// +// Planes +// Trains +// Automobiles +// +// The updated HashSet contains: +// +// Planes +// Trains +// Automobiles +// Ships +// Motorcycles +// Rockets +// Helicopters +// Submarines +// +// The 'All' vehicles set contains everything in 'Some' vechicles list. +// +// The 'All' vehicles set contains 'roCKeTs' +// +// The excepted HashSet contains: +// +// Ships +// Motorcycles +// Rockets +// Helicopters +// Submarines +// +// The super cool vehicles are: +// +// Motorcycles +// Helicopters +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp new file mode 100644 index 00000000000..3533f81fe87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedList.ctor/CPP/llctor.cpp @@ -0,0 +1,48 @@ + +// The following code example creates and initializes a LinkedList of type String and then displays its contents. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Generic; + +void main() +{ + // Create and initialize a new LinkedList. + LinkedList< String^ > ^ ll = gcnew LinkedList< String^ >; + ll->AddLast(L"red"); + ll->AddLast(L"orange"); + ll->AddLast(L"yellow"); + ll->AddLast(L"orange"); + + // Display the contents of the LinkedList. + if (ll->Count > 0) + { + Console::WriteLine(L"The first item in the list is {0}.", ll->First->Value); + Console::WriteLine(L"The last item in the list is {0}.", ll->Last->Value); + Console::WriteLine(L"The LinkedList contains:"); + + for each (String^ s in ll) + { + Console::WriteLine(L" {0}", s); + } + } + else + { + Console::WriteLine(L"The LinkedList is empty."); + } +} + +/* This code produces the following output. + +The first item in the list is red. +The last item in the list is orange. +The LinkedList contains: + red + orange + yellow + orange +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp new file mode 100644 index 00000000000..e6f279e12f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Generic.LinkedListNode/cpp/llnctor.cpp @@ -0,0 +1,87 @@ +// The following code example creates a LinkedList node, adds it to a LinkedList, and tracks the values of its properties as the LinkedList changes. + + +// +#using + +using namespace System; +using namespace System::Collections::Generic; + +public ref class GenericCollection { + +public: + static void Main() { + + // Create a new LinkedListNode of type String and displays its properties. + LinkedListNode^ lln = gcnew LinkedListNode( "orange" ); + Console::WriteLine( "After creating the node ...." ); + DisplayProperties( lln ); + + // Create a new LinkedList. + LinkedList^ ll = gcnew LinkedList(); + + // Add the "orange" node and display its properties. + ll->AddLast( lln ); + Console::WriteLine( "After adding the node to the empty LinkedList ...." ); + DisplayProperties( lln ); + + // Add nodes before and after the "orange" node and display the "orange" node's properties. + ll->AddFirst( "red" ); + ll->AddLast( "yellow" ); + Console::WriteLine( "After adding red and yellow ...." ); + DisplayProperties( lln ); + + } + + static void DisplayProperties( LinkedListNode^ lln ) { + if ( lln->List == nullptr ) + Console::WriteLine( " Node is not linked." ); + else + Console::WriteLine( " Node belongs to a linked list with {0} elements.", lln->List->Count ); + + if ( lln->Previous == nullptr ) + Console::WriteLine( " Previous node is null." ); + else + Console::WriteLine( " Value of previous node: {0}", lln->Previous->Value ); + + Console::WriteLine( " Value of current node: {0}", lln->Value ); + + if ( lln->Next == nullptr ) + Console::WriteLine( " Next node is null." ); + else + Console::WriteLine( " Value of next node: {0}", lln->Next->Value ); + + Console::WriteLine(); + } + +}; + +int main() +{ + GenericCollection::Main(); +} + +/* + +This code produces the following output. + +After creating the node .... + Node is not linked. + Previous node is null. + Value of current node: orange + Next node is null. + +After adding the node to the empty LinkedList .... + Node belongs to a linked list with 1 elements. + Previous node is null. + Value of current node: orange + Next node is null. + +After adding red and yellow .... + Node belongs to a linked list with 3 elements. + Value of previous node: red + Value of current node: orange + Value of next node: yellow + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp new file mode 100644 index 00000000000..987e041929f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/hashtable_example.cpp @@ -0,0 +1,130 @@ +// +using namespace System; +using namespace System::Collections; + +public ref class Example +{ +public: + static void Main() + { + // Create a new hash table. + // + Hashtable^ openWith = gcnew Hashtable(); + + // Add some elements to the hash table. There are no + // duplicate keys, but some of the values are duplicates. + openWith->Add("txt", "notepad.exe"); + openWith->Add("bmp", "paint.exe"); + openWith->Add("dib", "paint.exe"); + openWith->Add("rtf", "wordpad.exe"); + + // The Add method throws an exception if the new key is + // already in the hash table. + try + { + openWith->Add("txt", "winword.exe"); + } + catch(...) + { + Console::WriteLine("An element with Key = \"txt\" already exists."); + } + + // The Item property is the default property, so you + // can omit its name when accessing elements. + Console::WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]); + + // The default Item property can be used to change the value + // associated with a key. + openWith["rtf"] = "winword.exe"; + Console::WriteLine("For key = \"rtf\", value = {0}.", openWith["rtf"]); + + // If a key does not exist, setting the default Item property + // for that key adds a new key/value pair. + openWith["doc"] = "winword.exe"; + + // ContainsKey can be used to test keys before inserting + // them. + if (!openWith->ContainsKey("ht")) + { + openWith->Add("ht", "hypertrm.exe"); + Console::WriteLine("Value added for key = \"ht\": {0}", openWith["ht"]); + } + + // When you use foreach to enumerate hash table elements, + // the elements are retrieved as KeyValuePair objects. + Console::WriteLine(); + for each( DictionaryEntry de in openWith ) + { + Console::WriteLine("Key = {0}, Value = {1}", de.Key, de.Value); + } + + // To get the values alone, use the Values property. + ICollection^ valueColl = openWith->Values; + + // The elements of the ValueCollection are strongly typed + // with the type that was specified for hash table values. + Console::WriteLine(); + for each( String^ s in valueColl ) + { + Console::WriteLine("Value = {0}", s); + } + + // To get the keys alone, use the Keys property. + ICollection^ keyColl = openWith->Keys; + + // The elements of the KeyCollection are strongly typed + // with the type that was specified for hash table keys. + Console::WriteLine(); + for each( String^ s in keyColl ) + { + Console::WriteLine("Key = {0}", s); + } + + // Use the Remove method to remove a key/value pair. + Console::WriteLine("\nRemove(\"doc\")"); + openWith->Remove("doc"); + + if (!openWith->ContainsKey("doc")) + { + Console::WriteLine("Key \"doc\" is not found."); + } + } +}; + +int main() +{ + Example::Main(); +} + +/* This code example produces the following output: + +An element with Key = "txt" already exists. +For key = "rtf", value = wordpad.exe. +For key = "rtf", value = winword.exe. +Value added for key = "ht": hypertrm.exe + +Key = dib, Value = paint.exe +Key = txt, Value = notepad.exe +Key = ht, Value = hypertrm.exe +Key = bmp, Value = paint.exe +Key = rtf, Value = winword.exe +Key = doc, Value = winword.exe + +Value = paint.exe +Value = notepad.exe +Value = hypertrm.exe +Value = paint.exe +Value = winword.exe +Value = winword.exe + +Key = dib +Key = txt +Key = ht +Key = bmp +Key = rtf +Key = doc + +Remove("doc") +Key "doc" is not found. + */ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp new file mode 100644 index 00000000000..5b410769391 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ClassExample/cpp/remarks.cpp @@ -0,0 +1,36 @@ +using namespace System; +using namespace System::Collections; + +public ref class Remarks +{ +public: + static void Main() + { + // Create a new hash table. + // + Hashtable^ myHashtable = gcnew Hashtable(); + + // Add some elements to the hash table. There are no + // duplicate keys, but some of the values are duplicates. + myHashtable->Add("txt", "notepad.exe"); + myHashtable->Add("bmp", "paint.exe"); + myHashtable->Add("dib", "paint.exe"); + myHashtable->Add("rtf", "wordpad.exe"); + + + // When you use foreach to enumerate hash table elements, + // the elements are retrieved as KeyValuePair objects. + // + for each(DictionaryEntry de in myHashtable) + { + // ... + } + // + } +}; + +int main() +{ + Remarks::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp new file mode 100644 index 00000000000..a614056e17b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctor/CPP/hashtable_ctor.cpp @@ -0,0 +1,110 @@ + +// The following code example creates hash tables using different Hashtable constructors +// and demonstrates the differences in the behavior of the hash tables, +// even if each one contains the same elements. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +ref class myComparer : IEqualityComparer +{ +public: + virtual bool Equals(Object^ x, Object^ y) + { + return x->Equals(y); + } + + virtual int GetHashCode(Object^ obj) + { + return obj->ToString()->ToLower()->GetHashCode(); + } +}; + +// +ref class myCultureComparer : IEqualityComparer +{ +private: + CaseInsensitiveComparer^ myComparer; + +public: + myCultureComparer() + { + myComparer = CaseInsensitiveComparer::DefaultInvariant; + } + + myCultureComparer(CultureInfo^ myCulture) + { + myComparer = gcnew CaseInsensitiveComparer(myCulture); + } + + virtual bool Equals(Object^ x, Object^ y) + { + if (myComparer->Compare(x, y) == 0) + { + return true; + } + else + { + return false; + } + } + + virtual int GetHashCode(Object^ obj) + { + return obj->ToString()->ToLower()->GetHashCode(); + } +}; +// + +int main() +{ + + // Create a hash table using the default hash code provider and the default comparer. + Hashtable^ myHT1 = gcnew Hashtable((IEqualityComparer^)nullptr); + myHT1->Add( "FIRST", "Hello" ); + myHT1->Add( "SECOND", "World" ); + myHT1->Add( "THIRD", "!" ); + + // Create a hash table using the specified IEqualityComparer that uses + // the default Object.Equals to determine equality. + Hashtable^ myHT2 = gcnew Hashtable(gcnew myComparer()); + myHT2->Add( "FIRST", "Hello" ); + myHT2->Add( "SECOND", "World" ); + myHT2->Add( "THIRD", "!" ); + + // Create a hash table using a case-insensitive hash code provider and + // case-insensitive comparer based on the InvariantCulture. + Hashtable^ myHT3 = gcnew Hashtable( + CaseInsensitiveHashCodeProvider::DefaultInvariant, + CaseInsensitiveComparer::DefaultInvariant); + myHT3->Add( "FIRST", "Hello" ); + myHT3->Add( "SECOND", "World" ); + myHT3->Add( "THIRD", "!" ); + + // Create a hash table using an IEqualityComparer that is based on + // the Turkish culture (tr-TR) where "I" is not the uppercase + // version of "i". + CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); + Hashtable^ myHT4 = gcnew Hashtable( gcnew myCultureComparer(myCul) ); + myHT4->Add( "FIRST", "Hello" ); + myHT4->Add( "SECOND", "World" ); + myHT4->Add( "THIRD", "!" ); + + // Search for a key in each hash table. + Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT4: {0}", myHT4->ContainsKey( "first" ) ); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +first is in myHT1: False +first is in myHT2: False +first is in myHT3: True +first is in myHT4: False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp new file mode 100644 index 00000000000..ddc083162d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionary/CPP/hashtable_ctordictionary.cpp @@ -0,0 +1,95 @@ +// The following code example creates hash tables using different Hashtable +// constructors and demonstrates the differences in the behavior of the hash +// tables, even if each one contains the same elements. + +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +ref class myCultureComparer : public IEqualityComparer +{ +public: + CaseInsensitiveComparer^ myComparer; + +public: + myCultureComparer() + { + myComparer = CaseInsensitiveComparer::DefaultInvariant; + } + +public: + myCultureComparer(CultureInfo^ myCulture) + { + myComparer = gcnew CaseInsensitiveComparer(myCulture); + } + +public: + virtual bool Equals(Object^ x, Object^ y) + { + if (myComparer->Compare(x, y) == 0) + { + return true; + } + else + { + return false; + } + } + +public: + virtual int GetHashCode(Object^ obj) + { + // Compare the hash code for the lowercase versions of the strings. + return obj->ToString()->ToLower()->GetHashCode(); + } +}; + +public ref class SamplesHashtable +{ + +public: + static void Main() + { + // Create the dictionary. + SortedList^ mySL = gcnew SortedList(); + mySL->Add("FIRST", "Hello"); + mySL->Add("SECOND", "World"); + mySL->Add("THIRD", "!"); + + // Create a hash table using the default comparer. + Hashtable^ myHT1 = gcnew Hashtable(mySL); + + // Create a hash table using the specified IEqualityComparer that uses + // the CaseInsensitiveComparer.DefaultInvariant to determine equality. + Hashtable^ myHT2 = gcnew Hashtable(mySL, gcnew myCultureComparer()); + + // Create a hash table using an IEqualityComparer that is based on + // the Turkish culture (tr-TR) where "I" is not the uppercase + // version of "i". + CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); + Hashtable^ myHT3 = gcnew Hashtable(mySL, gcnew myCultureComparer(myCul)); + + // Search for a key in each hash table. + Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first")); + Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first")); + Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first")); + } +}; + +int main() +{ + SamplesHashtable::Main(); +}; + +/* +This code produces the following output. +Results vary depending on the system's culture settings. + +first is in myHT1: False +first is in myHT2: True +first is in myHT3: False + +*/ +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp new file mode 100644 index 00000000000..aeefb15d534 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorDictionaryFloat/CPP/hashtable_ctordictionaryfloat.cpp @@ -0,0 +1,93 @@ + +// The following code example creates hash tables using different Hashtable constructors +// and demonstrates the differences in the behavior of the hash tables, +// even if each one contains the same elements. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +ref class myCultureComparer : public IEqualityComparer +{ +public: + CaseInsensitiveComparer^ myComparer; + +public: + myCultureComparer() + { + myComparer = CaseInsensitiveComparer::DefaultInvariant; + } + +public: + myCultureComparer(CultureInfo^ myCulture) + { + myComparer = gcnew CaseInsensitiveComparer(myCulture); + } + +public: + virtual bool Equals(Object^ x, Object^ y) + { + if (myComparer->Compare(x, y) == 0) + { + return true; + } + else + { + return false; + } + } + +public: + virtual int GetHashCode(Object^ obj) + { + // Compare the hash code for the lowercase versions of the strings. + return obj->ToString()->ToLower()->GetHashCode(); + } +}; + +public ref class SamplesHashtable +{ + +public: + static void Main() + { + + // Create the dictionary. + SortedList^ mySL = gcnew SortedList; + mySL->Add( "FIRST", "Hello" ); + mySL->Add( "SECOND", "World" ); + mySL->Add( "THIRD", "!" ); + + // Create a hash table using the default hash code provider and the default comparer. + Hashtable^ myHT1 = gcnew Hashtable( mySL, .8f ); + + // Create a hash table using the specified case-insensitive hash code provider and case-insensitive comparer. + Hashtable^ myHT2 = gcnew Hashtable( mySL, .8f, gcnew myCultureComparer() ); + + // Create a hash table using the specified KeyComparer. + // The KeyComparer uses a case-insensitive hash code provider and a case-insensitive comparer, + // which are based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i". + CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); + Hashtable^ myHT3 = gcnew Hashtable( mySL, .8f, gcnew myCultureComparer( myCul ) ); + + // Search for a key in each hash table. + Console::WriteLine( "first is in myHT1: {0}", myHT1->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT2: {0}", myHT2->ContainsKey( "first" ) ); + Console::WriteLine( "first is in myHT3: {0}", myHT3->ContainsKey( "first" ) ); + } +}; + +int main() +{ + SamplesHashtable::Main(); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +first is in myHT1: False +first is in myHT2: True +first is in myHT3: False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp new file mode 100644 index 00000000000..90be7623a99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorInt/CPP/hashtable_ctorint.cpp @@ -0,0 +1,97 @@ + +// The following code example creates hash tables using different Hashtable constructors +// and demonstrates the differences in the behavior of the hash tables, +// even if each one contains the same elements. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +ref class myCultureComparer : public IEqualityComparer +{ +public: + CaseInsensitiveComparer^ myComparer; + +public: + myCultureComparer() + { + myComparer = CaseInsensitiveComparer::DefaultInvariant; + } + +public: + myCultureComparer(CultureInfo^ myCulture) + { + myComparer = gcnew CaseInsensitiveComparer(myCulture); + } + +public: + virtual bool Equals(Object^ x, Object^ y) + { + if (myComparer->Compare(x, y) == 0) + { + return true; + } + else + { + return false; + } + } + +public: + virtual int GetHashCode(Object^ obj) + { + // Compare the hash code for the lowercase versions of the strings. + return obj->ToString()->ToLower()->GetHashCode(); + } +}; + +public ref class SamplesHashtable +{ + +public: + static void Main() + { + // Create a hash table using the default comparer. + Hashtable^ myHT1 = gcnew Hashtable(3); + myHT1->Add("FIRST", "Hello"); + myHT1->Add("SECOND", "World"); + myHT1->Add("THIRD", "!"); + + // Create a hash table using the specified IEqualityComparer that uses + // the CaseInsensitiveComparer.DefaultInvariant to determine equality. + Hashtable^ myHT2 = gcnew Hashtable(3, gcnew myCultureComparer()); + myHT2->Add("FIRST", "Hello"); + myHT2->Add("SECOND", "World"); + myHT2->Add("THIRD", "!"); + + // Create a hash table using an IEqualityComparer that is based on + // the Turkish culture (tr-TR) where "I" is not the uppercase + // version of "i". + CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); + Hashtable^ myHT3 = gcnew Hashtable(3, gcnew myCultureComparer(myCul)); + myHT3->Add("FIRST", "Hello"); + myHT3->Add("SECOND", "World"); + myHT3->Add("THIRD", "!"); + + // Search for a key in each hash table. + Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first")); + Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first")); + Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first")); + + } +}; + +int main() +{ + SamplesHashtable::Main(); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +first is in myHT1: False +first is in myHT2: True +first is in myHT3: False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp new file mode 100644 index 00000000000..a55776fd358 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Hashtable_ctorIntFloat/CPP/hashtable_ctorintfloat.cpp @@ -0,0 +1,97 @@ + +// The following code example creates hash tables using different Hashtable constructors +// and demonstrates the differences in the behavior of the hash tables, +// even if each one contains the same elements. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +ref class myCultureComparer : public IEqualityComparer +{ +public: + CaseInsensitiveComparer^ myComparer; + +public: + myCultureComparer() + { + myComparer = CaseInsensitiveComparer::DefaultInvariant; + } + +public: + myCultureComparer(CultureInfo^ myCulture) + { + myComparer = gcnew CaseInsensitiveComparer(myCulture); + } + +public: + virtual bool Equals(Object^ x, Object^ y) + { + if (myComparer->Compare(x, y) == 0) + { + return true; + } + else + { + return false; + } + } + +public: + virtual int GetHashCode(Object^ obj) + { + // Compare the hash code for the lowercase versions of the strings. + return obj->ToString()->ToLower()->GetHashCode(); + } +}; + +public ref class SamplesHashtable +{ + +public: + static void Main() + { + // Create a hash table using the default comparer. + Hashtable^ myHT1 = gcnew Hashtable(3, .8f); + myHT1->Add("FIRST", "Hello"); + myHT1->Add("SECOND", "World"); + myHT1->Add("THIRD", "!"); + + // Create a hash table using the specified IEqualityComparer that uses + // the CaseInsensitiveComparer.DefaultInvariant to determine equality. + Hashtable^ myHT2 = gcnew Hashtable(3, .8f, gcnew myCultureComparer()); + myHT2->Add("FIRST", "Hello"); + myHT2->Add("SECOND", "World"); + myHT2->Add("THIRD", "!"); + + // Create a hash table using an IEqualityComparer that is based on + // the Turkish culture (tr-TR) where "I" is not the uppercase + // version of "i". + CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); + Hashtable^ myHT3 = gcnew Hashtable(3, .8f, gcnew myCultureComparer(myCul)); + myHT3->Add("FIRST", "Hello"); + myHT3->Add("SECOND", "World"); + myHT3->Add("THIRD", "!"); + + // Search for a key in each hash table. + Console::WriteLine("first is in myHT1: {0}", myHT1->ContainsKey("first")); + Console::WriteLine("first is in myHT2: {0}", myHT2->ContainsKey("first")); + Console::WriteLine("first is in myHT3: {0}", myHT3->ContainsKey("first")); + + } +}; + +int main() +{ + SamplesHashtable::Main(); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +first is in myHT1: False +first is in myHT2: True +first is in myHT3: False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp new file mode 100644 index 00000000000..f1919addfd6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/readonlycollectionbase.cpp @@ -0,0 +1,107 @@ + +// The following code example implements the ReadOnlyCollectionBase class. +// +using namespace System; +using namespace System::Collections; +public ref class ROCollection: public ReadOnlyCollectionBase +{ +public: + ROCollection( IList^ sourceList ) + { + InnerList->AddRange( sourceList ); + } + + property Object^ Item [int] + { + Object^ get( int index ) + { + return (InnerList[ index ]); + } + + } + int IndexOf( Object^ value ) + { + return (InnerList->IndexOf( value )); + } + + bool Contains( Object^ value ) + { + return (InnerList->Contains( value )); + } + +}; + +void PrintIndexAndValues( ROCollection^ myCol ); +void PrintValues2( ROCollection^ myCol ); +int main() +{ + // Create an ArrayList. + ArrayList^ myAL = gcnew ArrayList; + myAL->Add( "red" ); + myAL->Add( "blue" ); + myAL->Add( "yellow" ); + myAL->Add( "green" ); + myAL->Add( "orange" ); + myAL->Add( "purple" ); + + // Create a new ROCollection that contains the elements in myAL. + ROCollection^ myCol = gcnew ROCollection( myAL ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Contents of the collection (using enumerator):" ); + PrintValues2( myCol ); + + // Display the contents of the collection using the Count property and the Item property. + Console::WriteLine( "Contents of the collection (using Count and Item):" ); + PrintIndexAndValues( myCol ); + + // Search the collection with Contains and IndexOf. + Console::WriteLine( "Contains yellow: {0}", myCol->Contains( "yellow" ) ); + Console::WriteLine( "orange is at index {0}.", myCol->IndexOf( "orange" ) ); + Console::WriteLine(); +} + + +// Uses the Count property and the Item property. +void PrintIndexAndValues( ROCollection^ myCol ) +{ + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " [{0}]: {1}", i, myCol->Item[ i ] ); + Console::WriteLine(); +} + + +// Uses the enumerator. +void PrintValues2( ROCollection^ myCol ) +{ + System::Collections::IEnumerator^ myEnumerator = myCol->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0}", myEnumerator->Current ); + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Contents of the collection (using enumerator): + red + blue + yellow + green + orange + purple + +Contents of the collection (using Count and Item): + [0]: red + [1]: blue + [2]: yellow + [3]: green + [4]: orange + [5]: purple + +Contains yellow: True +orange is at index 4. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp new file mode 100644 index 00000000000..aea5c5a39cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.ReadOnlyCollectionBase/CPP/source2.cpp @@ -0,0 +1,80 @@ + +// The following code example implements the ReadOnlyCollectionBase class. +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class ROCollection: public ReadOnlyCollectionBase +{ +public: + ROCollection( IList^ sourceList ) + { + InnerList->AddRange( sourceList ); + } + + property Object^ Item [int] + { + Object^ get( int index ) + { + return (InnerList[ index ]); + } + + } + int IndexOf( Object^ value ) + { + return (InnerList->IndexOf( value )); + } + + bool Contains( Object^ value ) + { + return (InnerList->Contains( value )); + } + +}; + +public ref class SamplesCollectionBase +{ +public: + static void Main() + { + + // Create an ArrayList. + ArrayList^ myAL = gcnew ArrayList(); + myAL->Add( "red" ); + myAL->Add( "blue" ); + myAL->Add( "yellow" ); + myAL->Add( "green" ); + myAL->Add( "orange" ); + myAL->Add( "purple" ); + + // Create a new ROCollection that contains the elements in myAL. + ROCollection^ myReadOnlyCollection = gcnew ROCollection( myAL ); + + // + // Get the ICollection interface from the ReadOnlyCollectionBase + // derived class. + ICollection^ myCollection = myReadOnlyCollection; + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesCollectionBase::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp new file mode 100644 index 00000000000..89c82b72244 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctor/CPP/sortedlist_ctor.cpp @@ -0,0 +1,116 @@ + +// + +// The following code example creates SortedList instances using different constructors +// and demonstrates the differences in the behavior of the SortedList instances. + +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +void PrintKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( " -KEY- -VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Create a SortedList using the default comparer. + SortedList^ mySL1 = gcnew SortedList; + Console::WriteLine( "mySL1 (default):" ); + mySL1->Add( "FIRST", "Hello" ); + mySL1->Add( "SECOND", "World" ); + mySL1->Add( "THIRD", "!" ); + + try { mySL1->Add( "first", "Ola!" ); } + catch ( ArgumentException^ e ) { Console::WriteLine( e ); } + + PrintKeysAndValues( mySL1 ); + + // Create a SortedList using the specified case-insensitive comparer. + SortedList^ mySL2 = gcnew SortedList( gcnew CaseInsensitiveComparer ); + Console::WriteLine( "mySL2 (case-insensitive comparer):" ); + mySL2->Add( "FIRST", "Hello" ); + mySL2->Add( "SECOND", "World" ); + mySL2->Add( "THIRD", "!" ); + + try { mySL2->Add( "first", "Ola!" ); } + catch ( ArgumentException^ e ) { Console::WriteLine( e ); } + + PrintKeysAndValues( mySL2 ); + + // Create a SortedList using the specified KeyComparer. + // The KeyComparer uses a case-insensitive hash code provider and a case-insensitive comparer, + // which are based on the Turkish culture (tr-TR), where "I" is not the uppercase version of "i". + CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); + SortedList^ mySL3 = gcnew SortedList( gcnew CaseInsensitiveComparer( myCul ) ); + Console::WriteLine( "mySL3 (case-insensitive comparer, Turkish culture):" ); + mySL3->Add( "FIRST", "Hello" ); + mySL3->Add( "SECOND", "World" ); + mySL3->Add( "THIRD", "!" ); + + try { mySL3->Add( "first", "Ola!" ); } + catch ( ArgumentException^ e ) { Console::WriteLine( e ); } + + PrintKeysAndValues( mySL3 ); + + // Create a SortedList using the ComparisonType.InvariantCultureIgnoreCase value. + SortedList^ mySL4 = gcnew SortedList( StringComparer::InvariantCultureIgnoreCase ); + Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" ); + mySL4->Add( "FIRST", "Hello" ); + mySL4->Add( "SECOND", "World" ); + mySL4->Add( "THIRD", "!" ); + + try { mySL4->Add( "first", "Ola!" ); } + catch ( ArgumentException^ e ) { Console::WriteLine( e ); } + + PrintKeysAndValues( mySL4 ); + + Console::WriteLine("\n\nHit ENTER to return"); + Console::ReadLine(); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +mySL1 (default): + -KEY- -VALUE- + first : Ola! + FIRST : Hello + SECOND: World + THIRD : ! + +mySL2 (case-insensitive comparer): +System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' + at System.Collections.SortedList.Add(Object key, Object value) + at SamplesSortedList.Main() + -KEY- -VALUE- + FIRST : Hello + SECOND: World + THIRD : ! + +mySL3 (case-insensitive comparer, Turkish culture): + -KEY- -VALUE- + FIRST : Hello + first : Ola! + SECOND: World + THIRD : ! + +mySL4 (InvariantCultureIgnoreCase): +System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' + at System.Collections.SortedList.Add(Object key, Object value) + at SamplesSortedList.Main() + -KEY- -VALUE- + FIRST : Hello + SECOND: World + THIRD : ! + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp new file mode 100644 index 00000000000..89748fd1f54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorDictionary/CPP/sortedlist_ctordictionary.cpp @@ -0,0 +1,126 @@ + +// The following code example creates SortedList instances using different constructors +// and demonstrates the differences in the behavior of the SortedList instances. +// + + +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; +void PrintKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( " -KEY- -VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Create the dictionary. + Hashtable^ myHT = gcnew Hashtable; + myHT->Add( "FIRST", "Hello" ); + myHT->Add( "SECOND", "World" ); + myHT->Add( "THIRD", "!" ); + + // Create a SortedList using the default comparer. + SortedList^ mySL1 = gcnew SortedList( myHT ); + Console::WriteLine( "mySL1 (default):" ); + try + { + mySL1->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL1 ); + + // Create a SortedList using the specified case-insensitive comparer. + SortedList^ mySL2 = gcnew SortedList( myHT,gcnew CaseInsensitiveComparer ); + Console::WriteLine( "mySL2 (case-insensitive comparer):" ); + try + { + mySL2->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL2 ); + + // Create a SortedList using the specified CaseInsensitiveComparer, + // which is based on the Turkish culture (tr-TR), where "I" is not + // the uppercase version of "i". + CultureInfo^ myCul = gcnew CultureInfo( "tr-TR" ); + SortedList^ mySL3 = gcnew SortedList( myHT, gcnew CaseInsensitiveComparer( myCul ) ); + Console::WriteLine( "mySL3 (case-insensitive comparer, Turkish culture):" ); + try + { + mySL3->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL3 ); + + // Create a SortedList using the ComparisonType.InvariantCultureIgnoreCase value. + SortedList^ mySL4 = gcnew SortedList( myHT, StringComparer::InvariantCultureIgnoreCase ); + Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" ); + try + { + mySL4->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL4 ); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +mySL1 (default): + -KEY- -VALUE- + first : Ola! + FIRST : Hello + SECOND: World + THIRD : ! + +mySL2 (case-insensitive comparer): +System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' + at System.Collections.SortedList.Add(Object key, Object value) + at SamplesSortedList.Main() + -KEY- -VALUE- + FIRST : Hello + SECOND: World + THIRD : ! + +mySL3 (case-insensitive comparer, Turkish culture): + -KEY- -VALUE- + FIRST : Hello + first : Ola! + SECOND: World + THIRD : ! + +mySL4 (InvariantCultureIgnoreCase): +System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' + at System.Collections.SortedList.Add(Object key, Object value) + at SamplesSortedList.Main() + -KEY- -VALUE- + FIRST : Hello + SECOND: World + THIRD : ! + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp new file mode 100644 index 00000000000..047062c6747 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.SortedList_ctorInt/CPP/sortedlist_ctorint.cpp @@ -0,0 +1,139 @@ +// +// The following code example creates SortedList instances using different constructors +// and demonstrates the differences in the behavior of the SortedList instances. + + + +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; +void PrintKeysAndValues( SortedList^ myList ) +{ + Console::WriteLine( " Capacity is {0}.", myList->Capacity ); + Console::WriteLine( " -KEY- -VALUE-" ); + for ( int i = 0; i < myList->Count; i++ ) + { + Console::WriteLine( " {0,-6}: {1}", myList->GetKey( i ), myList->GetByIndex( i ) ); + + } + Console::WriteLine(); +} + +int main() +{ + + // Create a SortedList using the default comparer. + SortedList^ mySL1 = gcnew SortedList( 3 ); + Console::WriteLine( "mySL1 (default):" ); + mySL1->Add( "FIRST", "Hello" ); + mySL1->Add( "SECOND", "World" ); + mySL1->Add( "THIRD", "!" ); + try + { + mySL1->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL1 ); + + // Create a SortedList using the specified case-insensitive comparer. + SortedList^ mySL2 = gcnew SortedList( gcnew CaseInsensitiveComparer,3 ); + Console::WriteLine( "mySL2 (case-insensitive comparer):" ); + mySL2->Add( "FIRST", "Hello" ); + mySL2->Add( "SECOND", "World" ); + mySL2->Add( "THIRD", "!" ); + try + { + mySL2->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL2 ); + + // Create a SortedList using the specified CaseInsensitiveComparer, + // which is based on the Turkish culture (tr-TR), where "I" is not + // the uppercase version of "i". + CultureInfo^ myCul = gcnew CultureInfo("tr-TR"); + SortedList^ mySL3 = gcnew SortedList(gcnew CaseInsensitiveComparer(myCul), 3); + + Console::WriteLine("mySL3 (case-insensitive comparer, Turkish culture):"); + + mySL3->Add("FIRST", "Hello"); + mySL3->Add("SECOND", "World"); + mySL3->Add("THIRD", "!"); + try + { + mySL3->Add("first", "Ola!"); + } + catch (ArgumentException^ e) + { + Console::WriteLine(e); + } + PrintKeysAndValues(mySL3); + + // Create a SortedList using the + // StringComparer.InvariantCultureIgnoreCase value. + SortedList^ mySL4 = gcnew SortedList( StringComparer::InvariantCultureIgnoreCase, 3 ); + Console::WriteLine( "mySL4 (InvariantCultureIgnoreCase):" ); + mySL4->Add( "FIRST", "Hello" ); + mySL4->Add( "SECOND", "World" ); + mySL4->Add( "THIRD", "!" ); + try + { + mySL4->Add( "first", "Ola!" ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + PrintKeysAndValues( mySL4 ); +} + +/* +This code produces the following output. Results vary depending on the system's culture settings. + +mySL1 (default): + Capacity is 6. + -KEY- -VALUE- + first : Ola! + FIRST : Hello + SECOND: World + THIRD : ! + +mySL2 (case-insensitive comparer): +System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' + at System.Collections.SortedList.Add(Object key, Object value) + at SamplesSortedList.Main() + Capacity is 3. + -KEY- -VALUE- + FIRST : Hello + SECOND: World + THIRD : ! + +mySL3 (case-insensitive comparer, Turkish culture): + Capacity is 6. + -KEY- -VALUE- + FIRST : Hello + first : Ola! + SECOND: World + THIRD : ! + +mySL4 (InvariantCultureIgnoreCase): +System.ArgumentException: Item has already been added. Key in dictionary: 'FIRST' Key being added: 'first' + at System.Collections.SortedList.Add(Object key, Object value) + at SamplesSortedList.Main() + Capacity is 3. + -KEY- -VALUE- + FIRST : Hello + SECOND: World + THIRD : ! + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp new file mode 100644 index 00000000000..a4aa7596eb9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.CreateMasks/CPP/bitvector32_createmasks.cpp @@ -0,0 +1,40 @@ +// The following code example shows how to create and use masks. +// +#using + +using namespace System; +using namespace System::Collections::Specialized; +int main() +{ + // Creates and initializes a BitVector32 with all bit flags set to FALSE. + BitVector32 myBV; + + // Creates masks to isolate each of the first five bit flags. + int myBit1 = BitVector32::CreateMask(); + int myBit2 = BitVector32::CreateMask( myBit1 ); + int myBit3 = BitVector32::CreateMask( myBit2 ); + int myBit4 = BitVector32::CreateMask( myBit3 ); + int myBit5 = BitVector32::CreateMask( myBit4 ); + Console::WriteLine( "Initial: \t {0}", myBV ); + + // Sets the third bit to TRUE. + myBV[ myBit3 ] = true; + Console::WriteLine( "myBit3 = TRUE \t {0}", myBV ); + + // Combines two masks to access multiple bits at a time. + myBV[ myBit4 + myBit5 ] = true; + Console::WriteLine( "myBit4 + myBit5 = TRUE \t {0}", myBV ); + myBV[ myBit1 | myBit2 ] = true; + Console::WriteLine( "myBit1 | myBit2 = TRUE \t {0}", myBV ); +} + +/* +This code produces the following output. + +Initial: BitVector32 {00000000000000000000000000000000} +myBit3 = TRUE BitVector32 {00000000000000000000000000000100} +myBit4 + myBit5 = TRUE BitVector32 {00000000000000000000000000011100} +myBit1 | myBit2 = TRUE BitVector32 {00000000000000000000000000011111} + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp new file mode 100644 index 00000000000..e3796e3bdc3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32.Equals/CPP/bitvector32_equals.cpp @@ -0,0 +1,78 @@ +// The following code example compares a BitVector32 with another BitVector32 and with an Int32. +// +#using + +using namespace System; +using namespace System::Collections::Specialized; + +int main() +{ + // Creates and initializes a BitVector32 with the value 123. + // This is the BitVector32 that will be compared to different types. + BitVector32 myBV(123); + + // Creates and initializes a new BitVector32 which will be set up as sections. + BitVector32 myBVsect(0); + + // Compares myBV and myBVsect. + Console::WriteLine( "myBV : {0}", myBV ); + Console::WriteLine( "myBVsect : {0}", myBVsect ); + if ( myBV.Equals( myBVsect ) ) + Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data ); + else + Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data ); + + Console::WriteLine(); + + // Assigns values to the sections of myBVsect. + BitVector32::Section mySect1 = BitVector32::CreateSection( 5 ); + BitVector32::Section mySect2 = BitVector32::CreateSection( 1, mySect1 ); + BitVector32::Section mySect3 = BitVector32::CreateSection( 20, mySect2 ); + myBVsect[ mySect1 ] = 3; + myBVsect[ mySect2 ] = 1; + myBVsect[ mySect3 ] = 7; + + // Compares myBV and myBVsect. + Console::WriteLine( "myBV : {0}", myBV ); + Console::WriteLine( "myBVsect with values : {0}", myBVsect ); + if ( myBV.Equals( myBVsect ) ) + Console::WriteLine( " myBV( {0}) equals myBVsect( {1}).", myBV.Data, myBVsect.Data ); + else + Console::WriteLine( " myBV( {0}) does not equal myBVsect( {1}).", myBV.Data, myBVsect.Data ); + + Console::WriteLine(); + + // Compare myBV with an Int32. + Console::WriteLine( "Comparing myBV with an Int32: " ); + Int32 myInt32 = 123; + + // Using Equals will fail because Int32 is not compatible with BitVector32. + if ( myBV.Equals( myInt32 ) ) + Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) equals myInt32( {1}).", myBV.Data, myInt32 ); + else + Console::WriteLine( " Using BitVector32::Equals, myBV( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 ); + + // To compare a BitVector32 with an Int32, use the "==" operator. + if ( myBV.Data == myInt32 ) + Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) equals myInt32( {1}).", myBV.Data, myInt32 ); + else + Console::WriteLine( " Using the \"==\" operator, myBV.Data( {0}) does not equal myInt32( {1}).", myBV.Data, myInt32 ); +} + +/* +This code produces the following output. + +myBV : BitVector32 {00000000000000000000000001111011} +myBVsect : BitVector32 {00000000000000000000000000000000} + myBV(123) does not equal myBVsect(0). + +myBV : BitVector32 {00000000000000000000000001111011} +myBVsect with values : BitVector32 {00000000000000000000000001111011} + myBV(123) equals myBVsect(123). + +Comparing myBV with an Int32: + Using BitVector32::Equals, myBV(123) does not equal myInt32(123). + Using the "==" operator, myBV.Data(123) equals myInt32(123). + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp new file mode 100644 index 00000000000..43f50a3e1db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_BitFlags/CPP/bitvector32_bitflags.cpp @@ -0,0 +1,42 @@ +// The following code example uses a BitVector32 as a collection of bit flags. +// +#using + +using namespace System; +using namespace System::Collections::Specialized; +int main() +{ + + // Creates and initializes a BitVector32 with all bit flags set to FALSE. + BitVector32 myBV(0); + + // Creates masks to isolate each of the first five bit flags. + int myBit1 = BitVector32::CreateMask(); + int myBit2 = BitVector32::CreateMask( myBit1 ); + int myBit3 = BitVector32::CreateMask( myBit2 ); + int myBit4 = BitVector32::CreateMask( myBit3 ); + int myBit5 = BitVector32::CreateMask( myBit4 ); + + // Sets the alternating bits to TRUE. + Console::WriteLine( "Setting alternating bits to TRUE:" ); + Console::WriteLine( " Initial: {0}", myBV ); + myBV[ myBit1 ] = true; + Console::WriteLine( " myBit1 = TRUE: {0}", myBV ); + myBV[ myBit3 ] = true; + Console::WriteLine( " myBit3 = TRUE: {0}", myBV ); + myBV[ myBit5 ] = true; + Console::WriteLine( " myBit5 = TRUE: {0}", myBV ); +} + +/* +This code produces the following output. + +Setting alternating bits to TRUE: +Initial: BitVector32 {00000000000000000000000000000000} +myBit1 = TRUE: BitVector32 {00000000000000000000000000000001} +myBit3 = TRUE: BitVector32 {00000000000000000000000000000101} +myBit5 = TRUE: BitVector32 {00000000000000000000000000010101} + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp new file mode 100644 index 00000000000..91d45f3f84b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.BitVector32_Sections/CPP/bitvector32_sections.cpp @@ -0,0 +1,68 @@ +// The following code example uses a BitVector32 as a collection of sections. +// +#using + +using namespace System; +using namespace System::Collections::Specialized; + +int main() +{ + // Creates and initializes a BitVector32. + BitVector32 myBV(0); + + // Creates four sections in the BitVector32 with maximum values 6, 3, 1, and 15. + // mySect3, which uses exactly one bit, can also be used as a bit flag. + BitVector32::Section mySect1 = BitVector32::CreateSection( 6 ); + BitVector32::Section mySect2 = BitVector32::CreateSection( 3, mySect1 ); + BitVector32::Section mySect3 = BitVector32::CreateSection( 1, mySect2 ); + BitVector32::Section mySect4 = BitVector32::CreateSection( 15, mySect3 ); + + // Displays the values of the sections. + Console::WriteLine( "Initial values:" ); + Console::WriteLine( "\tmySect1: {0}", myBV[ mySect1 ] ); + Console::WriteLine( "\tmySect2: {0}", myBV[ mySect2 ] ); + Console::WriteLine( "\tmySect3: {0}", myBV[ mySect3 ] ); + Console::WriteLine( "\tmySect4: {0}", myBV[ mySect4 ] ); + + // Sets each section to a new value and displays the value of the BitVector32 at each step. + Console::WriteLine( "Changing the values of each section:" ); + Console::WriteLine( "\tInitial: \t {0}", myBV ); + myBV[ mySect1 ] = 5; + Console::WriteLine( "\tmySect1 = 5:\t {0}", myBV ); + myBV[ mySect2 ] = 3; + Console::WriteLine( "\tmySect2 = 3:\t {0}", myBV ); + myBV[ mySect3 ] = 1; + Console::WriteLine( "\tmySect3 = 1:\t {0}", myBV ); + myBV[ mySect4 ] = 9; + Console::WriteLine( "\tmySect4 = 9:\t {0}", myBV ); + + // Displays the values of the sections. + Console::WriteLine( "New values:" ); + Console::WriteLine( "\tmySect1: {0}", myBV[ mySect1 ] ); + Console::WriteLine( "\tmySect2: {0}", myBV[ mySect2 ] ); + Console::WriteLine( "\tmySect3: {0}", myBV[ mySect3 ] ); + Console::WriteLine( "\tmySect4: {0}", myBV[ mySect4 ] ); +} + +/* +This code produces the following output. + +Initial values: + mySect1: 0 + mySect2: 0 + mySect3: 0 + mySect4: 0 +Changing the values of each section: + Initial: BitVector32 {00000000000000000000000000000000} + mySect1 = 5: BitVector32 {00000000000000000000000000000101} + mySect2 = 3: BitVector32 {00000000000000000000000000011101} + mySect3 = 1: BitVector32 {00000000000000000000000000111101} + mySect4 = 9: BitVector32 {00000000000000000000001001111101} +New values: + mySect1: 5 + mySect2: 3 + mySect3: 1 + mySect4: 9 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp new file mode 100644 index 00000000000..f4a12c16ce9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/hybriddictionary.cpp @@ -0,0 +1,222 @@ +// The following code example demonstrates several of the properties and methods of HybridDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintKeysAndValues1( IDictionary^ myCol ); +void PrintKeysAndValues2( IDictionary^ myCol ); +void PrintKeysAndValues3( HybridDictionary^ myCol ); +int main() +{ + + // Creates and initializes a new HybridDictionary. + HybridDictionary^ myCol = gcnew HybridDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + myCol->Add( "Plantain Bananas", "1.49" ); + myCol->Add( "Yellow Bananas", "0.79" ); + myCol->Add( "Strawberries", "3.33" ); + myCol->Add( "Cranberries", "5.98" ); + myCol->Add( "Navel Oranges", "1.29" ); + myCol->Add( "Grapes", "1.99" ); + myCol->Add( "Honeydew Melon", "0.59" ); + myCol->Add( "Seedless Watermelon", "0.49" ); + myCol->Add( "Pineapple", "1.49" ); + myCol->Add( "Nectarine", "1.99" ); + myCol->Add( "Plums", "1.69" ); + myCol->Add( "Peaches", "1.99" ); + + // Display the contents of the collection using for each. This is the preferred method. + Console::WriteLine( "Displays the elements using for each:" ); + PrintKeysAndValues1( myCol ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); + PrintKeysAndValues2( myCol ); + + // Display the contents of the collection using the Keys, Values, Count, and Item properties. + Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); + PrintKeysAndValues3( myCol ); + + // Copies the HybridDictionary to an array with DictionaryEntry elements. + array^myArr = gcnew array(myCol->Count); + myCol->CopyTo( myArr, 0 ); + + // Displays the values in the array. + Console::WriteLine( "Displays the elements in the array:" ); + Console::WriteLine( " KEY VALUE" ); + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); + Console::WriteLine(); + + // Searches for a key. + if ( myCol->Contains( "Kiwis" ) ) + Console::WriteLine( "The collection contains the key \"Kiwis\"." ); + else + Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); + + Console::WriteLine(); + + // Deletes a key. + myCol->Remove( "Plums" ); + Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" ); + PrintKeysAndValues1( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues1( myCol ); +} + +// Uses the for each statement which hides the complexity of the enumerator. +// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. +void PrintKeysAndValues1( IDictionary^ myCol ) { + Console::WriteLine( " KEY VALUE" ); + for each ( DictionaryEntry^ de in myCol ) + Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintKeysAndValues2( IDictionary^ myCol ) +{ + IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); + Console::WriteLine( " KEY VALUE" ); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); + + Console::WriteLine(); +} + +// Uses the Keys, Values, Count, and Item properties. +void PrintKeysAndValues3( HybridDictionary^ myCol ) +{ + array^myKeys = gcnew array(myCol->Count); + myCol->Keys->CopyTo( myKeys, 0 ); + Console::WriteLine( " INDEX KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); + Console::WriteLine(); +} + +/* +This code produces output similar to the following: + +Displays the elements using for each: + KEY VALUE + Strawberries 3.33 + Yellow Bananas 0.79 + Cranberries 5.98 + Grapes 1.99 + Granny Smith Apples 0.89 + Seedless Watermelon 0.49 + Honeydew Melon 0.59 + Red Delicious Apples 0.99 + Navel Oranges 1.29 + Fuji Apples 1.29 + Plantain Bananas 1.49 + Gala Apples 1.49 + Pineapple 1.49 + Plums 1.69 + Braeburn Apples 1.49 + Peaches 1.99 + Golden Delicious Apples 1.29 + Nectarine 1.99 + +Displays the elements using the IDictionaryEnumerator: + KEY VALUE + Strawberries 3.33 + Yellow Bananas 0.79 + Cranberries 5.98 + Grapes 1.99 + Granny Smith Apples 0.89 + Seedless Watermelon 0.49 + Honeydew Melon 0.59 + Red Delicious Apples 0.99 + Navel Oranges 1.29 + Fuji Apples 1.29 + Plantain Bananas 1.49 + Gala Apples 1.49 + Pineapple 1.49 + Plums 1.69 + Braeburn Apples 1.49 + Peaches 1.99 + Golden Delicious Apples 1.29 + Nectarine 1.99 + +Displays the elements using the Keys, Values, Count, and Item properties: + INDEX KEY VALUE + 0 Strawberries 3.33 + 1 Yellow Bananas 0.79 + 2 Cranberries 5.98 + 3 Grapes 1.99 + 4 Granny Smith Apples 0.89 + 5 Seedless Watermelon 0.49 + 6 Honeydew Melon 0.59 + 7 Red Delicious Apples 0.99 + 8 Navel Oranges 1.29 + 9 Fuji Apples 1.29 + 10 Plantain Bananas 1.49 + 11 Gala Apples 1.49 + 12 Pineapple 1.49 + 13 Plums 1.69 + 14 Braeburn Apples 1.49 + 15 Peaches 1.99 + 16 Golden Delicious Apples 1.29 + 17 Nectarine 1.99 + +Displays the elements in the array: + KEY VALUE + Strawberries 3.33 + Yellow Bananas 0.79 + Cranberries 5.98 + Grapes 1.99 + Granny Smith Apples 0.89 + Seedless Watermelon 0.49 + Honeydew Melon 0.59 + Red Delicious Apples 0.99 + Navel Oranges 1.29 + Fuji Apples 1.29 + Plantain Bananas 1.49 + Gala Apples 1.49 + Pineapple 1.49 + Plums 1.69 + Braeburn Apples 1.49 + Peaches 1.99 + Golden Delicious Apples 1.29 + Nectarine 1.99 + +The collection does not contain the key "Kiwis". + +The collection contains the following elements after removing "Plums": + KEY VALUE + Strawberries 3.33 + Yellow Bananas 0.79 + Cranberries 5.98 + Grapes 1.99 + Granny Smith Apples 0.89 + Seedless Watermelon 0.49 + Honeydew Melon 0.59 + Red Delicious Apples 0.99 + Navel Oranges 1.29 + Fuji Apples 1.29 + Plantain Bananas 1.49 + Gala Apples 1.49 + Pineapple 1.49 + Braeburn Apples 1.49 + Peaches 1.99 + Golden Delicious Apples 1.29 + Nectarine 1.99 + +The collection contains the following elements after it is cleared: + KEY VALUE + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp new file mode 100644 index 00000000000..5b82c8e92c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary2/CPP/source2.cpp @@ -0,0 +1,48 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Threading; + +public ref class HybridDictSample +{ +public: + static void Main() + { + // Creates and initializes a new HybridDictionary. + HybridDictionary^ myHybridDictionary = gcnew HybridDictionary(); + + // + for each (DictionaryEntry^ de in myHybridDictionary) + { + //... + } + // + + // + HybridDictionary^ myCollection = gcnew HybridDictionary(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + HybridDictSample::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp new file mode 100644 index 00000000000..1afdca2ae97 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_AddRemove/CPP/hybriddictionary_addremove.cpp @@ -0,0 +1,110 @@ + + +// The following code example adds to and removes elements from a HybridDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( IDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = safe_cast(myEnum->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new HybridDictionary. + HybridDictionary^ myCol = gcnew HybridDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + myCol->Add( "Plantain Bananas", "1.49" ); + myCol->Add( "Yellow Bananas", "0.79" ); + myCol->Add( "Strawberries", "3.33" ); + myCol->Add( "Cranberries", "5.98" ); + myCol->Add( "Navel Oranges", "1.29" ); + myCol->Add( "Grapes", "1.99" ); + myCol->Add( "Honeydew Melon", "0.59" ); + myCol->Add( "Seedless Watermelon", "0.49" ); + myCol->Add( "Pineapple", "1.49" ); + myCol->Add( "Nectarine", "1.99" ); + myCol->Add( "Plums", "1.69" ); + myCol->Add( "Peaches", "1.99" ); + + // Displays the values in the HybridDictionary in three different ways. + Console::WriteLine( "Initial contents of the HybridDictionary:" ); + PrintKeysAndValues( myCol ); + + // Deletes a key. + myCol->Remove( "Plums" ); + Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" ); + PrintKeysAndValues( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues( myCol ); +} + +/* +This code produces output similar to the following: + +Initial contents of the HybridDictionary: + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Plums 1.69 + Navel Oranges 1.29 + Fuji Apples 1.29 + +The collection contains the following elements after removing "Plums": + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Navel Oranges 1.29 + Fuji Apples 1.29 + +The collection contains the following elements after it is cleared: + KEY VALUE + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp new file mode 100644 index 00000000000..831a5749541 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Contains/CPP/hybriddictionary_contains.cpp @@ -0,0 +1,87 @@ + + +// The following code example searches for an element in a HybridDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( IDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = safe_cast(myEnum->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new HybridDictionary. + HybridDictionary^ myCol = gcnew HybridDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + myCol->Add( "Plantain Bananas", "1.49" ); + myCol->Add( "Yellow Bananas", "0.79" ); + myCol->Add( "Strawberries", "3.33" ); + myCol->Add( "Cranberries", "5.98" ); + myCol->Add( "Navel Oranges", "1.29" ); + myCol->Add( "Grapes", "1.99" ); + myCol->Add( "Honeydew Melon", "0.59" ); + myCol->Add( "Seedless Watermelon", "0.49" ); + myCol->Add( "Pineapple", "1.49" ); + myCol->Add( "Nectarine", "1.99" ); + myCol->Add( "Plums", "1.69" ); + myCol->Add( "Peaches", "1.99" ); + + // Displays the values in the HybridDictionary in three different ways. + Console::WriteLine( "Initial contents of the HybridDictionary:" ); + PrintKeysAndValues( myCol ); + + // Searches for a key. + if ( myCol->Contains( "Kiwis" ) ) + Console::WriteLine( "The collection contains the key \"Kiwis\"." ); + else + Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); + + Console::WriteLine(); +} + +/* +This code produces output similar to the following: + +Initial contents of the HybridDictionary: + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Plums 1.69 + Navel Oranges 1.29 + Fuji Apples 1.29 + +The collection does not contain the key "Kiwis". + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp new file mode 100644 index 00000000000..b50664695a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_CopyTo/CPP/hybriddictionary_copyto.cpp @@ -0,0 +1,109 @@ + + +// The following code example copies the elements of a HybridDictionary to an array. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( IDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = safe_cast(myEnum->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new HybridDictionary. + HybridDictionary^ myCol = gcnew HybridDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + myCol->Add( "Plantain Bananas", "1.49" ); + myCol->Add( "Yellow Bananas", "0.79" ); + myCol->Add( "Strawberries", "3.33" ); + myCol->Add( "Cranberries", "5.98" ); + myCol->Add( "Navel Oranges", "1.29" ); + myCol->Add( "Grapes", "1.99" ); + myCol->Add( "Honeydew Melon", "0.59" ); + myCol->Add( "Seedless Watermelon", "0.49" ); + myCol->Add( "Pineapple", "1.49" ); + myCol->Add( "Nectarine", "1.99" ); + myCol->Add( "Plums", "1.69" ); + myCol->Add( "Peaches", "1.99" ); + + // Displays the values in the HybridDictionary in three different ways. + Console::WriteLine( "Initial contents of the HybridDictionary:" ); + PrintKeysAndValues( myCol ); + + // Copies the HybridDictionary to an array with DictionaryEntry elements. + array^myArr = gcnew array(myCol->Count); + myCol->CopyTo( myArr, 0 ); + + // Displays the values in the array. + Console::WriteLine( "Displays the elements in the array:" ); + Console::WriteLine( " KEY VALUE" ); + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); + Console::WriteLine(); +} + +/* +This code produces output similar to the following: + +Initial contents of the HybridDictionary: + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Plums 1.69 + Navel Oranges 1.29 + Fuji Apples 1.29 + +Displays the elements in the array: + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Plums 1.69 + Navel Oranges 1.29 + Fuji Apples 1.29 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp new file mode 100644 index 00000000000..1966022fe36 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.HybridDictionary_Enumerator/CPP/hybriddictionary_enumerator.cpp @@ -0,0 +1,147 @@ +// The following code example enumerates the elements of a HybridDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintKeysAndValues1( IDictionary^ myCol ); +void PrintKeysAndValues2( IDictionary^ myCol ); +void PrintKeysAndValues3( HybridDictionary^ myCol ); + +int main() +{ + // Creates and initializes a new HybridDictionary. + HybridDictionary^ myCol = gcnew HybridDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + myCol->Add( "Plantain Bananas", "1.49" ); + myCol->Add( "Yellow Bananas", "0.79" ); + myCol->Add( "Strawberries", "3.33" ); + myCol->Add( "Cranberries", "5.98" ); + myCol->Add( "Navel Oranges", "1.29" ); + myCol->Add( "Grapes", "1.99" ); + myCol->Add( "Honeydew Melon", "0.59" ); + myCol->Add( "Seedless Watermelon", "0.49" ); + myCol->Add( "Pineapple", "1.49" ); + myCol->Add( "Nectarine", "1.99" ); + myCol->Add( "Plums", "1.69" ); + myCol->Add( "Peaches", "1.99" ); + + // Display the contents of the collection using for each. This is the preferred method. + Console::WriteLine( "Displays the elements using for each:" ); + PrintKeysAndValues1( myCol ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); + PrintKeysAndValues2( myCol ); + + // Display the contents of the collection using the Keys, Values, Count, and Item properties. + Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); + PrintKeysAndValues3( myCol ); +} + +// Uses the foreach statement which hides the complexity of the enumerator. +// NOTE: The foreach statement is the preferred way of enumerating the contents of a collection. +void PrintKeysAndValues1( IDictionary^ myCol ) { + Console::WriteLine( " KEY VALUE" ); + for each ( DictionaryEntry^ de in myCol ) + Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintKeysAndValues2( IDictionary^ myCol ) +{ + IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); + Console::WriteLine( " KEY VALUE" ); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); + + Console::WriteLine(); +} + +// Uses the Keys, Values, Count, and Item properties. +void PrintKeysAndValues3( HybridDictionary^ myCol ) +{ + array^myKeys = gcnew array(myCol->Count); + myCol->Keys->CopyTo( myKeys, 0 ); + Console::WriteLine( " INDEX KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); + Console::WriteLine(); +} + +/* +This code produces output similar to the following: + +Displays the elements using for each: + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Plums 1.69 + Navel Oranges 1.29 + Fuji Apples 1.29 + +Displays the elements using the IDictionaryEnumerator: + KEY VALUE + Seedless Watermelon 0.49 + Nectarine 1.99 + Cranberries 5.98 + Plantain Bananas 1.49 + Honeydew Melon 0.59 + Pineapple 1.49 + Strawberries 3.33 + Grapes 1.99 + Braeburn Apples 1.49 + Peaches 1.99 + Red Delicious Apples 0.99 + Golden Delicious Apples 1.29 + Yellow Bananas 0.79 + Granny Smith Apples 0.89 + Gala Apples 1.49 + Plums 1.69 + Navel Oranges 1.29 + Fuji Apples 1.29 + +Displays the elements using the Keys, Values, Count, and Item properties: + INDEX KEY VALUE + 0 Seedless Watermelon 0.49 + 1 Nectarine 1.99 + 2 Cranberries 5.98 + 3 Plantain Bananas 1.49 + 4 Honeydew Melon 0.59 + 5 Pineapple 1.49 + 6 Strawberries 3.33 + 7 Grapes 1.99 + 8 Braeburn Apples 1.49 + 9 Peaches 1.99 + 10 Red Delicious Apples 0.99 + 11 Golden Delicious Apples 1.29 + 12 Yellow Bananas 0.79 + 13 Granny Smith Apples 0.89 + 14 Gala Apples 1.49 + 15 Plums 1.69 + 16 Navel Oranges 1.29 + 17 Fuji Apples 1.29 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp new file mode 100644 index 00000000000..641e2daadd9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/iordereddictionary.cpp @@ -0,0 +1,318 @@ +// + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +// +public ref class PeopleEnum : IDictionaryEnumerator +{ +private: + // Enumerators are positioned before the first element + // until the first MoveNext() call. + int position; + ArrayList^ _people; + +public: + PeopleEnum(ArrayList^ list) + { + this->Reset(); + _people = list; + } + + virtual bool MoveNext() + { + position++; + return (position < _people->Count); + } + + virtual void Reset() + { + position = -1; + } + + virtual property Object^ Current + { + Object^ get() + { + try + { + return _people[position]; + } + catch (IndexOutOfRangeException^) + { + throw gcnew InvalidOperationException(); + } + } + } + + virtual property DictionaryEntry Entry + { + DictionaryEntry get() + { + return (DictionaryEntry)(Current); + } + } + + virtual property Object^ Key + { + Object^ get() + { + try + { + return ((DictionaryEntry^)_people[position])->Key; + } + catch (IndexOutOfRangeException^) + { + throw gcnew InvalidOperationException(); + } + } + } + + virtual property Object^ Value + { + Object^ get() + { + try + { + return ((DictionaryEntry^)_people[position])->Value; + } + catch (IndexOutOfRangeException^) + { + throw gcnew InvalidOperationException(); + } + } + } +}; + +public ref class People : IOrderedDictionary +{ +private: + ArrayList^ _people; + +public: + People(int numItems) + { + _people = gcnew ArrayList(numItems); + } + + int IndexOfKey(Object^ key) + { + for (int i = 0; i < _people->Count; i++) + { + if (((DictionaryEntry^)_people[i])->Key == key) + return i; + } + + // key not found, return -1. + return -1; + } + + virtual property Object^ default[Object^] + { + Object^ get(Object^ key) + { + return ((DictionaryEntry^)_people[IndexOfKey(key)])->Value; + } + void set(Object^ key, Object^ value) + { + _people[IndexOfKey(key)] = gcnew DictionaryEntry(key, value); + } + } + + // IOrderedDictionary Members + virtual IDictionaryEnumerator^ GetEnumerator() + { + return gcnew PeopleEnum(_people); + } + + virtual void Insert(int index, Object^ key, Object^ value) + { + if (IndexOfKey(key) != -1) + { + throw gcnew ArgumentException("An element with the same key already exists in the collection."); + } + _people->Insert(index, gcnew DictionaryEntry(key, value)); + } + + virtual void RemoveAt(int index) + { + _people->RemoveAt(index); + } + + virtual property Object^ default[int] + { + Object^ get(int index) + { + return ((DictionaryEntry^)_people[index])->Value; + } + void set(int index, Object^ value) + { + Object^ key = ((DictionaryEntry^)_people[index])->Key; + _people[index] = gcnew DictionaryEntry(key, value); + } + } + + // IDictionary Members + + virtual void Add(Object^ key, Object^ value) + { + if (IndexOfKey(key) != -1) + { + throw gcnew ArgumentException("An element with the same key already exists in the collection."); + } + _people->Add(gcnew DictionaryEntry(key, value)); + } + + virtual void Clear() + { + _people->Clear(); + } + + virtual bool Contains(Object^ key) + { + if (IndexOfKey(key) == -1) + { + return false; + } + else + { + return true; + } + } + + virtual property bool IsFixedSize + { + bool get() + { + return false; + } + } + + virtual property bool IsReadOnly + { + bool get() + { + return false; + } + } + + virtual property ICollection^ Keys + { + ICollection^ get() + { + ArrayList^ KeyCollection = gcnew ArrayList(_people->Count); + for (int i = 0; i < _people->Count; i++) + { + KeyCollection->Add( ((DictionaryEntry^)_people[i])->Key ); + } + return KeyCollection; + } + } + + virtual void Remove(Object^ key) + { + _people->RemoveAt(IndexOfKey(key)); + } + + virtual property ICollection^ Values + { + ICollection ^get() + { + ArrayList^ ValueCollection = gcnew ArrayList(_people->Count); + for (int i = 0; i < _people->Count; i++) + { + ValueCollection->Add( ((DictionaryEntry^)_people[i])->Value ); + } + return ValueCollection; + } + } + + // ICollection Members + + virtual void CopyTo(Array^ array, int index) + { + _people->CopyTo(array, index); + } + + virtual property int Count + { + int get() + { + return _people->Count; + } + } + + virtual property bool IsSynchronized + { + bool get() + { + return _people->IsSynchronized; + } + } + + virtual property Object^ SyncRoot + { + Object^ get() + { + return _people->SyncRoot; + } + } + + // IEnumerable Members + + virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator + { + return (IEnumerator^) gcnew PeopleEnum(_people); + } +}; +// + +class App +{ +public: + static void Main() + { + People^ peopleCollection = gcnew People(3); + peopleCollection->Add("John", "Smith"); + peopleCollection->Add("Jim", "Johnson"); + peopleCollection->Add("Sue", "Rabon"); + + Console::WriteLine("Displaying the entries in peopleCollection:"); + for each (DictionaryEntry^ de in peopleCollection) + { + Console::WriteLine("{0} {1}", de->Key, de->Value); + } + Console::WriteLine(); + Console::WriteLine("Displaying the entries in the modified peopleCollection:"); + peopleCollection["Jim"] = "Jackson"; + peopleCollection->Remove("Sue"); + peopleCollection->Insert(0, "Fred", "Anderson"); + + for each (DictionaryEntry^ de in peopleCollection) + { + Console::WriteLine("{0} {1}", de->Key, de->Value); + } + + } +}; + +int main() +{ + App::Main(); +} +/* This code produces output similar to the following: + * + * Displaying the entries in peopleCollection: + * John Smith + * Jim Johnson + * Sue Rabon + * + * Displaying the entries in the modified peopleCollection: + * Fred Anderson + * John Smith + * Jim Jackson + */ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp new file mode 100644 index 00000000000..05fe0cdd917 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.IOrderedDictionary_Implementation/cpp/remarks.cpp @@ -0,0 +1,297 @@ + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class ODEnum : IDictionaryEnumerator +{ +private: + // Enumerators are positioned before the first element + // until the first MoveNext() call. + int position; + ArrayList^ itemlist; + +public: + ODEnum(ArrayList^ list) + { + this->Reset(); + itemlist = list; + } + + virtual bool MoveNext() + { + position++; + return (position < itemlist->Count); + } + + virtual void Reset() + { + position = -1; + } + + virtual property Object^ Current + { + Object^ get() + { + try + { + return itemlist[position]; + } + catch (IndexOutOfRangeException^) + { + throw gcnew InvalidOperationException(); + } + } + } + + virtual property DictionaryEntry Entry + { + DictionaryEntry get() + { + return (DictionaryEntry)(Current); + } + } + + virtual property Object^ Key + { + Object^ get() + { + try + { + return ((DictionaryEntry^)itemlist[position])->Key; + } + catch (IndexOutOfRangeException^) + { + throw gcnew InvalidOperationException(); + } + } + } + + virtual property Object^ Value + { + Object^ get() + { + try + { + return ((DictionaryEntry^)itemlist[position])->Value; + } + catch (IndexOutOfRangeException^) + { + throw gcnew InvalidOperationException(); + } + } + } +}; + +public ref class SimpleOD : IOrderedDictionary +{ +private: + ArrayList^ itemlist; + +public: + SimpleOD(int numItems) + { + itemlist = gcnew ArrayList(numItems); + } + + int IndexOfKey(Object^ key) + { + for (int i = 0; i < itemlist->Count; i++) + { + if (((DictionaryEntry^)itemlist[i])->Key == key) + return i; + } + + // key not found, return -1. + return -1; + } + + virtual property Object^ default[Object^] + { + Object^ get(Object^ key) + { + return ((DictionaryEntry^)itemlist[IndexOfKey(key)])->Value; + } + void set(Object^ key, Object^ value) + { + itemlist[IndexOfKey(key)] = gcnew DictionaryEntry(key, value); + } + } + + // IOrderedDictionary Members + virtual IDictionaryEnumerator^ GetEnumerator() + { + return gcnew ODEnum(itemlist); + } + + virtual void Insert(int index, Object^ key, Object^ value) + { + if (IndexOfKey(key) != -1) + { + throw gcnew ArgumentException("An element with the same key already exists in the collection."); + } + itemlist->Insert(index, gcnew DictionaryEntry(key, value)); + } + + virtual void RemoveAt(int index) + { + itemlist->RemoveAt(index); + } + + virtual property Object^ default[int] + { + Object^ get(int index) + { + return ((DictionaryEntry^)itemlist[index])->Value; + } + void set(int index, Object^ value) + { + Object^ key = ((DictionaryEntry^)itemlist[index])->Key; + itemlist[index] = gcnew DictionaryEntry(Keys, value); + } + } + + // IDictionary Members + + virtual void Add(Object^ key, Object^ value) + { + if (IndexOfKey(key) != -1) + { + throw gcnew ArgumentException("An element with the same key already exists in the collection."); + } + itemlist->Add(gcnew DictionaryEntry(key, value)); + } + + virtual void Clear() + { + itemlist->Clear(); + } + + virtual bool Contains(Object^ key) + { + if (IndexOfKey(key) == -1) + { + return false; + } + else + { + return true; + } + } + + virtual property bool IsFixedSize + { + bool get() + { + return false; + } + } + + virtual property bool IsReadOnly + { + bool get() + { + return false; + } + } + + virtual property ICollection^ Keys + { + ICollection^ get() + { + ArrayList^ KeyCollection = gcnew ArrayList(itemlist->Count); + for (int i = 0; i < itemlist->Count; i++) + { + KeyCollection[i] = ((DictionaryEntry^)itemlist[i])->Key; + } + return KeyCollection; + } + } + + virtual void Remove(Object^ key) + { + itemlist->RemoveAt(IndexOfKey(key)); + } + + virtual property ICollection^ Values + { + ICollection ^get() + { + ArrayList^ ValueCollection = gcnew ArrayList(itemlist->Count); + for (int i = 0; i < itemlist->Count; i++) + { + ValueCollection[i] = ((DictionaryEntry^)itemlist[i])->Value; + } + return ValueCollection; + } + } + + // ICollection Members + + virtual void CopyTo(Array^ array, int index) + { + itemlist->CopyTo(array, index); + } + + virtual property int Count + { + int get() + { + return itemlist->Count; + } + } + + virtual property bool IsSynchronized + { + bool get() + { + return itemlist->IsSynchronized; + } + } + + virtual property Object^ SyncRoot + { + Object^ get() + { + return itemlist->SyncRoot; + } + } + + // IEnumerable Members + + virtual IEnumerator^ IfcGetEnumerator() = IEnumerable::GetEnumerator + { + return (IEnumerator^) gcnew ODEnum(itemlist); + } +}; + +class App +{ +public: + static void Main() + { + int index = 1; + + SimpleOD^ myOrderedDictionary = gcnew SimpleOD(2); + myOrderedDictionary->Add("Way", "ToGo"); + myOrderedDictionary->Add("Far", "Out"); + + Object^ obj; + // + obj = myOrderedDictionary[index]; + // + // + for each (DictionaryEntry de in myOrderedDictionary) + { + //... + } + // + } +}; + +int main() +{ + App::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp new file mode 100644 index 00000000000..d1760135b98 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/listdictionary.cpp @@ -0,0 +1,151 @@ +// The following code example demonstrates several of the properties and methods of ListDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintKeysAndValues1( IDictionary^ myCol ); +void PrintKeysAndValues2( IDictionary^ myCol ); +void PrintKeysAndValues3( ListDictionary^ myCol ); + +int main() +{ + // Creates and initializes a new ListDictionary. + ListDictionary^ myCol = gcnew ListDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + + // Display the contents of the collection using for each. This is the preferred method. + Console::WriteLine( "Displays the elements using for each:" ); + PrintKeysAndValues1( myCol ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); + PrintKeysAndValues2( myCol ); + + // Display the contents of the collection using the Keys, Values, Count, and Item properties. + Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); + PrintKeysAndValues3( myCol ); + + // Copies the ListDictionary to an array with DictionaryEntry elements. + array^myArr = gcnew array(myCol->Count); + myCol->CopyTo( myArr, 0 ); + + // Displays the values in the array. + Console::WriteLine( "Displays the elements in the array:" ); + Console::WriteLine( " KEY VALUE" ); + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); + Console::WriteLine(); + + // Searches for a key. + if ( myCol->Contains( "Kiwis" ) ) + Console::WriteLine( "The collection contains the key \"Kiwis\"." ); + else + Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); + + Console::WriteLine(); + + // Deletes a key. + myCol->Remove( "Plums" ); + Console::WriteLine( "The collection contains the following elements after removing \"Plums\":" ); + PrintKeysAndValues2( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues2( myCol ); +} + +// Uses the for each statement which hides the complexity of the enumerator. +// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. +void PrintKeysAndValues1( IDictionary^ myCol ) { + Console::WriteLine( " KEY VALUE" ); + for each ( DictionaryEntry^ de in myCol ) + Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintKeysAndValues2( IDictionary^ myCol ) +{ + IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); + Console::WriteLine( " KEY VALUE" ); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); + Console::WriteLine(); +} + +// Uses the Keys, Values, Count, and Item properties. +void PrintKeysAndValues3( ListDictionary^ myCol ) +{ + array^myKeys = gcnew array(myCol->Count); + myCol->Keys->CopyTo( myKeys, 0 ); + Console::WriteLine( " INDEX KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +Displays the elements using for each: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +Displays the elements using the IDictionaryEnumerator: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +Displays the elements using the Keys, Values, Count, and Item properties: + INDEX KEY VALUE + 0 Braeburn Apples 1.49 + 1 Fuji Apples 1.29 + 2 Gala Apples 1.49 + 3 Golden Delicious Apples 1.29 + 4 Granny Smith Apples 0.89 + 5 Red Delicious Apples 0.99 + +Displays the elements in the array: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +The collection does not contain the key "Kiwis". + +The collection contains the following elements after removing "Plums": + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +The collection contains the following elements after it is cleared: + KEY VALUE + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp new file mode 100644 index 00000000000..0f3452dcd52 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary2/CPP/source2.cpp @@ -0,0 +1,50 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Threading; + +public ref class SamplesListDictionary +{ +public: + static void Main() + { + // + ListDictionary^ myCollection = gcnew ListDictionary(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } + + static void Dummy() + { + ListDictionary^ myListDictionary = gcnew ListDictionary(); + // + for each (DictionaryEntry de in myListDictionary) + { + //... + } + // + } +}; + +int main() +{ + SamplesListDictionary::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp new file mode 100644 index 00000000000..ef13cdd9540 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_AddRemove/CPP/listdictionary_addremove.cpp @@ -0,0 +1,74 @@ + + +// The following code example adds to and removes elements from a ListDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( IDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = safe_cast(myEnum->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new ListDictionary. + ListDictionary^ myCol = gcnew ListDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + + // Displays the values in the ListDictionary in three different ways. + Console::WriteLine( "Initial contents of the ListDictionary:" ); + PrintKeysAndValues( myCol ); + + // Deletes a key. + myCol->Remove( "Gala Apples" ); + Console::WriteLine( "The collection contains the following elements after removing \"Gala Apples\":" ); + PrintKeysAndValues( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues( myCol ); +} + +/* +This code produces the following output. + +Initial contents of the ListDictionary: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +The collection contains the following elements after removing "Gala Apples": + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +The collection contains the following elements after it is cleared: + KEY VALUE + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp new file mode 100644 index 00000000000..ba69388921b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Contains/CPP/listdictionary_contains.cpp @@ -0,0 +1,63 @@ + + +// The following code example searches for an element in a ListDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( IDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = safe_cast(myEnum->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new ListDictionary. + ListDictionary^ myCol = gcnew ListDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + + // Displays the values in the ListDictionary in three different ways. + Console::WriteLine( "Initial contents of the ListDictionary:" ); + PrintKeysAndValues( myCol ); + + // Searches for a key. + if ( myCol->Contains( "Kiwis" ) ) + Console::WriteLine( "The collection contains the key \"Kiwis\"." ); + else + Console::WriteLine( "The collection does not contain the key \"Kiwis\"." ); + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the ListDictionary: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +The collection does not contain the key "Kiwis". + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp new file mode 100644 index 00000000000..772edf629f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_CopyTo/CPP/listdictionary_copyto.cpp @@ -0,0 +1,73 @@ + + +// The following code example copies the elements of a ListDictionary to an array. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintKeysAndValues( IDictionary^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry de = safe_cast(myEnum->Current); + Console::WriteLine( " {0,-25} {1}", de.Key, de.Value ); + } + + Console::WriteLine(); +} + +int main() +{ + + // Creates and initializes a new ListDictionary. + ListDictionary^ myCol = gcnew ListDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + + // Displays the values in the ListDictionary in three different ways. + Console::WriteLine( "Initial contents of the ListDictionary:" ); + PrintKeysAndValues( myCol ); + + // Copies the ListDictionary to an array with DictionaryEntry elements. + array^myArr = gcnew array(myCol->Count); + myCol->CopyTo( myArr, 0 ); + + // Displays the values in the array. + Console::WriteLine( "Displays the elements in the array:" ); + Console::WriteLine( " KEY VALUE" ); + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( " {0,-25} {1}", myArr[ i ].Key, myArr[ i ].Value ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the ListDictionary: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +Displays the elements in the array: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp new file mode 100644 index 00000000000..2a525d94ac8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.ListDictionary_Enumerator/CPP/listdictionary_enumerator.cpp @@ -0,0 +1,99 @@ +// The following code example enumerates the elements of a ListDictionary. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintKeysAndValues1( IDictionary^ myCol ); +void PrintKeysAndValues2( IDictionary^ myCol ); +void PrintKeysAndValues3( ListDictionary^ myCol ); + +int main() +{ + // Creates and initializes a new ListDictionary. + ListDictionary^ myCol = gcnew ListDictionary; + myCol->Add( "Braeburn Apples", "1.49" ); + myCol->Add( "Fuji Apples", "1.29" ); + myCol->Add( "Gala Apples", "1.49" ); + myCol->Add( "Golden Delicious Apples", "1.29" ); + myCol->Add( "Granny Smith Apples", "0.89" ); + myCol->Add( "Red Delicious Apples", "0.99" ); + + // Display the contents of the collection using for each. This is the preferred method. + Console::WriteLine( "Displays the elements using for each:" ); + PrintKeysAndValues1( myCol ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IDictionaryEnumerator:" ); + PrintKeysAndValues2( myCol ); + + // Display the contents of the collection using the Keys, Values, Count, and Item properties. + Console::WriteLine( "Displays the elements using the Keys, Values, Count, and Item properties:" ); + PrintKeysAndValues3( myCol ); +} + +// Uses the for each statement which hides the complexity of the enumerator. +// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. +void PrintKeysAndValues1( IDictionary^ myCol ) { + Console::WriteLine( " KEY VALUE" ); + for each ( DictionaryEntry^ de in myCol ) + Console::WriteLine( " {0,-25} {1}", de->Key, de->Value ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintKeysAndValues2( IDictionary^ myCol ) +{ + IDictionaryEnumerator^ myEnumerator = myCol->GetEnumerator(); + Console::WriteLine( " KEY VALUE" ); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0,-25} {1}", myEnumerator->Key, myEnumerator->Value ); + + Console::WriteLine(); +} + +// Uses the Keys, Values, Count, and Item properties. +void PrintKeysAndValues3( ListDictionary^ myCol ) +{ + array^myKeys = gcnew array(myCol->Count); + myCol->Keys->CopyTo( myKeys, 0 ); + Console::WriteLine( " INDEX KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0,-5} {1,-25} {2}", i, myKeys[ i ], myCol[ myKeys[ i ] ] ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +Displays the elements using for each: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +Displays the elements using the IDictionaryEnumerator: + KEY VALUE + Braeburn Apples 1.49 + Fuji Apples 1.29 + Gala Apples 1.49 + Golden Delicious Apples 1.29 + Granny Smith Apples 0.89 + Red Delicious Apples 0.99 + +Displays the elements using the Keys, Values, Count, and Item properties: + INDEX KEY VALUE + 0 Braeburn Apples 1.49 + 1 Fuji Apples 1.29 + 2 Gala Apples 1.49 + 3 Golden Delicious Apples 1.29 + 4 Granny Smith Apples 0.89 + 5 Red Delicious Apples 0.99 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp new file mode 100644 index 00000000000..e3a242ae17f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseAdd/CPP/nocb_baseadd.cpp @@ -0,0 +1,65 @@ + + +// The following example uses BaseAdd to create a new NameObjectCollectionBase with elements from another dictionary. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +public ref class MyCollection: public NameObjectCollectionBase +{ +private: + DictionaryEntry _de; + +public: + + property DictionaryEntry Item [ int ] + { + // Gets a key-and-value pair (DictionaryEntry) using an index. + DictionaryEntry get( int index ) + { + _de.Key = this->BaseGetKey( index ); + _de.Value = this->BaseGet( index ); + return (_de); + } + } + + // Adds elements from an IDictionary* into the new collection. + MyCollection( IDictionary^ d ) + { + IEnumerator^ myEnum = d->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ de = safe_cast(myEnum->Current); + this->BaseAdd( safe_cast(de->Key), de->Value ); + } + } +}; + +int main() +{ + // Creates and initializes a new MyCollection instance. + IDictionary^ d = gcnew ListDictionary; + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myCol = gcnew MyCollection( d ); + + // Displays the keys and values of the MyCollection instance. + for ( int i = 0; i < myCol->Count; i++ ) + { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol->Item[ i ].Key, myCol->Item[ i ].Value ); + } +} + +/* +This code produces the following output. + +[0] : red, apple +[1] : yellow, banana +[2] : green, pear + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp new file mode 100644 index 00000000000..7dfd2cf7f8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseClear/CPP/nocb_baseclear.cpp @@ -0,0 +1,83 @@ + + +// The following example uses BaseClear to remove all elements from a NameObjectCollectionBase. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +public ref class MyCollection: public NameObjectCollectionBase +{ +private: + DictionaryEntry _de; + +public: + + property DictionaryEntry Item [ int ] + { + // Gets a key-and-value pair (DictionaryEntry) using an index. + DictionaryEntry get( int index ) + { + _de.Key = this->BaseGetKey( index ); + _de.Value = this->BaseGet( index ); + return (_de); + } + } + + // Adds elements from an IDictionary* into the new collection. + MyCollection( IDictionary^ d ) + { + IEnumerator^ myEnum = d->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ de = safe_cast(myEnum->Current); + this->BaseAdd( safe_cast(de->Key), de->Value ); + } + } + + // Clears all the elements in the collection. + void Clear() + { + this->BaseClear(); + } +}; + +static void PrintKeysAndValues( MyCollection^ myCol ) +{ + for ( int i = 0; i < myCol->Count; i++ ) + { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol->Item[ i ].Key, myCol->Item[ i ].Value ); + + } +} + +int main() +{ + // Creates and initializes a new MyCollection instance. + IDictionary^ d = gcnew ListDictionary; + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myCol = gcnew MyCollection( d ); + Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + + // Removes all elements from the collection. + myCol->Clear(); + Console::WriteLine( "After clearing the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); +} + +/* +This code produces the following output. + +Initial state of the collection (Count = 3): +[0] : red, apple +[1] : yellow, banana +[2] : green, pear +After clearing the collection (Count = 0): + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp new file mode 100644 index 00000000000..d7954215945 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGet/CPP/nocb_baseget.cpp @@ -0,0 +1,92 @@ + +// The following example uses BaseGetKey and BaseGet to get specific keys and values. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Gets a key-and-value pair (DictionaryEntry) using an index. +public: + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get( int index ) { + _de->Key = this->BaseGetKey( index ); + _de->Value = this->BaseGet( index ); + return( _de ); + } + } + + // Gets or sets the value associated with the specified key. + property Object^ default[ String^ ] { + Object^ get(String^ key) { + return( this->BaseGet( key ) ); + } + void set( String^ key, Object^ value ) { + this->BaseSet( key, value ); + } + } + + // Adds elements from an IDictionary into the new collection. + MyCollection( IDictionary^ d ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + } +}; + +public ref class SamplesNameObjectCollectionBase { + +public: + static void Main() { + + // Creates and initializes a new MyCollection instance. + IDictionary^ d = gcnew ListDictionary(); + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myCol = gcnew MyCollection( d ); + Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + + // Gets specific keys and values. + Console::WriteLine( "The key at index 0 is {0}.", myCol[0]->Key ); + Console::WriteLine( "The value at index 0 is {0}.", myCol[0]->Value ); + Console::WriteLine( "The value associated with the key \"green\" is {0}.", myCol["green"] ); + + } + + static void PrintKeysAndValues( MyCollection^ myCol ) { + for ( int i = 0; i < myCol->Count; i++ ) { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); + } + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + +/* +This code produces the following output. + +Initial state of the collection (Count = 3): +[0] : red, apple +[1] : yellow, banana +[2] : green, pear +The key at index 0 is red. +The value at index 0 is apple. +The value associated with the key "green" is pear. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp new file mode 100644 index 00000000000..c96322f4cfa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseGetAll/CPP/nocb_basegetall.cpp @@ -0,0 +1,124 @@ +// The following example uses BaseGetAllKeys and BaseGetAllValues to get an array of the keys or an array of the values. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Gets a key-and-value pair (DictionaryEntry) using an index. +public: + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get(int index) { + _de->Key = this->BaseGetKey( index ); + _de->Value = this->BaseGet( index ); + return( _de ); + } + } + + // Adds elements from an IDictionary into the new collection. + MyCollection( IDictionary^ d ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + } + + // Gets a String array that contains all the keys in the collection. + property array^ AllKeys { + array^ get() { + return( this->BaseGetAllKeys() ); + } + } + + // Gets an Object array that contains all the values in the collection. + property Array^ AllValues { + Array^ get() { + return( this->BaseGetAllValues() ); + } + } + + // Gets a String array that contains all the values in the collection. + property array^ AllStringValues { + array^ get() { + return( (array^) this->BaseGetAllValues( System::String::typeid ) ); + } + } +}; + +public ref class SamplesNameObjectCollectionBase { + +public: + static void Main() { + + // Creates and initializes a new MyCollection instance. + IDictionary^ d = gcnew ListDictionary(); + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myCol = gcnew MyCollection( d ); + Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + + // Displays the list of keys. + Console::WriteLine( "The list of keys:" ); + for each ( String^ s in myCol->AllKeys ) { + Console::WriteLine( " {0}", s ); + } + + // Displays the list of values of type Object. + Console::WriteLine( "The list of values (Object):" ); + for each ( Object^ o in myCol->AllValues ) { + Console::WriteLine( " {0}", o->ToString() ); + } + + // Displays the list of values of type String. + Console::WriteLine( "The list of values (String):" ); + for each ( String^ s in myCol->AllValues ) { + Console::WriteLine( " {0}", s ); + } + } + +public: + static void PrintKeysAndValues( MyCollection^ myCol ) { + for ( int i = 0; i < myCol->Count; i++ ) { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); + } + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + +/* +This code produces the following output. + +Initial state of the collection (Count = 3): +[0] : red, apple +[1] : yellow, banana +[2] : green, pear +The list of keys: + red + yellow + green +The list of values (Object): + apple + banana + pear +The list of values (String): + apple + banana + pear + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp new file mode 100644 index 00000000000..663a6cd5536 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseHasKeys/CPP/nocb_basehaskeys.cpp @@ -0,0 +1,78 @@ +// The following example uses BaseHasKeys to determine if the collection contains keys that are not a null reference. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Gets a key-and-value pair (DictionaryEntry) using an index. +public: + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get(int index) { + _de->Key = this->BaseGetKey( index ); + _de->Value = this->BaseGet( index ); + return( _de ); + } + } + + // Creates an empty collection. + MyCollection() { + _de = gcnew DictionaryEntry(); + } + + // Adds an entry to the collection. + void Add( String^ key, Object^ value ) { + this->BaseAdd( key, value ); + } + + // Gets a value indicating whether the collection contains keys that are not a null reference. + property Boolean HasKeys { + Boolean get() { + return( this->BaseHasKeys() ); + } + } +}; + +void PrintKeysAndValues( MyCollection^ myCol ) { + for ( int i = 0; i < myCol->Count; i++ ) { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); + } +} + +int main() { + + // Creates an empty MyCollection instance. + MyCollection^ myCol = gcnew MyCollection(); + Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + Console::WriteLine( "HasKeys? {0}", myCol->HasKeys ); + + Console::WriteLine(); + + // Adds an item to the collection. + myCol->Add( "blue", "sky" ); + Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + Console::WriteLine( "HasKeys? {0}", myCol->HasKeys ); + +} + +/* +This code produces the following output. + +Initial state of the collection (Count = 0): +HasKeys? False + +Initial state of the collection (Count = 1): +[0] : blue, sky +HasKeys? True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp new file mode 100644 index 00000000000..de50b6634e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseRemove/CPP/nocb_baseremove.cpp @@ -0,0 +1,98 @@ +// The following example uses BaseRemove and BaseRemoveAt to remove elements from a NameObjectCollectionBase. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Gets a key-and-value pair (DictionaryEntry) using an index. +public: + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get(int index) { + _de->Key = this->BaseGetKey( index ); + _de->Value = this->BaseGet( index ); + return( _de ); + } + } + + // Adds elements from an IDictionary into the new collection. + MyCollection( IDictionary^ d ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + } + + // Removes an entry with the specified key from the collection. + void Remove( String^ key ) { + this->BaseRemove( key ); + } + + // Removes an entry in the specified index from the collection. + void Remove( int index ) { + this->BaseRemoveAt( index ); + } +}; + +public ref class SamplesNameObjectCollectionBase { + +public: + static void Main() { + + // Creates and initializes a new MyCollection instance. + IDictionary^ d = gcnew ListDictionary(); + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myCol = gcnew MyCollection( d ); + Console::WriteLine( "Initial state of the collection (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + + // Removes an element at a specific index. + myCol->Remove( 1 ); + Console::WriteLine( "After removing the element at index 1 (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + + // Removes an element with a specific key. + myCol->Remove( "red" ); + Console::WriteLine( "After removing the element with the key \"red\" (Count = {0}):", myCol->Count ); + PrintKeysAndValues( myCol ); + + } + + static void PrintKeysAndValues( MyCollection^ myCol ) { + for ( int i = 0; i < myCol->Count; i++ ) { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); + } + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + +/* +This code produces the following output. + +Initial state of the collection (Count = 3): +[0] : red, apple +[1] : yellow, banana +[2] : green, pear +After removing the element at index 1 (Count = 2): +[0] : red, apple +[1] : green, pear +After removing the element with the key "red" (Count = 1): +[0] : green, pear + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp new file mode 100644 index 00000000000..e9c37f870ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.BaseSet/CPP/nocb_baseset.cpp @@ -0,0 +1,108 @@ +// The following example uses BaseSet to set the value of a specific element. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + + // Gets or sets the value at the specified index. +public: + property Object^ default[ int ] { + Object^ get(int index) { + return( this->BaseGet( index ) ); + } + void set( int index, Object^ value ) { + this->BaseSet( index, value ); + } + } + + // Gets or sets the value associated with the specified key. + property Object^ default[ String^ ] { + Object^ get(String^ key) { + return( this->BaseGet( key ) ); + } + void set( String^ key, Object^ value ) { + this->BaseSet( key, value ); + } + } + + // Gets a String array that contains all the keys in the collection. + property array^ AllKeys { + array^ get() { + return( this->BaseGetAllKeys() ); + } + } + + // Adds elements from an IDictionary into the new collection. + MyCollection( IDictionary^ d ) { + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + } + +}; + +public ref class SamplesNameObjectCollectionBase { + +public: + static void Main() { + + // Creates and initializes a new MyCollection instance. + IDictionary^ d = gcnew ListDictionary(); + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myCol = gcnew MyCollection( d ); + Console::WriteLine( "Initial state of the collection:" ); + PrintKeysAndValues2( myCol ); + Console::WriteLine(); + + // Sets the value at index 1. + myCol[1] = "sunflower"; + Console::WriteLine( "After setting the value at index 1:" ); + PrintKeysAndValues2( myCol ); + Console::WriteLine(); + + // Sets the value associated with the key "red". + myCol["red"] = "tulip"; + Console::WriteLine( "After setting the value associated with the key \"red\":" ); + PrintKeysAndValues2( myCol ); + + } + + static void PrintKeysAndValues2( MyCollection^ myCol ) { + for each ( String^ s in myCol->AllKeys ) { + Console::WriteLine( "{0}, {1}", s, myCol[s] ); + } + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + +/* +This code produces the following output. + +Initial state of the collection: +red, apple +yellow, banana +green, pear + +After setting the value at index 1: +red, apple +yellow, sunflower +green, pear + +After setting the value associated with the key "red": +red, tulip +yellow, sunflower +green, pear + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp new file mode 100644 index 00000000000..c7f2f6f2036 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase.IsReadOnly/CPP/nocb_isreadonly.cpp @@ -0,0 +1,91 @@ +// The following example creates a read-only collection. +// For an expanded version of this example, see the NameObjectCollectionBase class topic. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Gets a key-and-value pair (DictionaryEntry) using an index. +public: + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get( int index ) { + _de->Key = this->BaseGetKey( index ); + _de->Value = this->BaseGet( index ); + return( _de ); + } + } + + // Adds elements from an IDictionary into the new collection. + MyCollection( IDictionary^ d, Boolean bReadOnly ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + this->IsReadOnly = bReadOnly; + } + + // Adds an entry to the collection. + void Add( String^ key, Object^ value ) { + this->BaseAdd( key, value ); + } +}; + +public ref class SamplesNameObjectCollectionBase { + +public: + static void Main() { + + // Creates and initializes a new MyCollection that is read-only. + IDictionary^ d = gcnew ListDictionary(); + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myROCol = gcnew MyCollection( d, true ); + + // Tries to add a new item. + try { + myROCol->Add( "blue", "sky" ); + } + catch ( NotSupportedException^ e ) { + Console::WriteLine( e->ToString() ); + } + + // Displays the keys and values of the MyCollection. + Console::WriteLine( "Read-Only Collection:" ); + PrintKeysAndValues( myROCol ); + } + + static void PrintKeysAndValues( MyCollection^ myCol ) { + for ( int i = 0; i < myCol->Count; i++ ) { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); + } + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + +/* +This code produces the following output. + +System.NotSupportedException: Collection is read-only. + at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value) + at SamplesNameObjectCollectionBase.Main() +Read-Only Collection: +[0] : red, apple +[1] : yellow, banana +[2] : green, pear + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp new file mode 100644 index 00000000000..8f68c652453 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/nameobjectcollectionbase.cpp @@ -0,0 +1,192 @@ +// The following example shows how to implement and use the NameObjectCollectionBase class. + +// +#using +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class MyCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Creates an empty collection. +public: + MyCollection() { + _de = gcnew DictionaryEntry(); + } + + // Adds elements from an IDictionary into the new collection. + MyCollection( IDictionary^ d, Boolean bReadOnly ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + this->IsReadOnly = bReadOnly; + } + + // Gets a key-and-value pair (DictionaryEntry) using an index. + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get(int index) { + _de->Key = this->BaseGetKey(index); + _de->Value = this->BaseGet(index); + return( _de ); + } + } + + // Gets or sets the value associated with the specified key. + property Object^ default[ String^ ] { + Object^ get(String^ key) { + return( this->BaseGet( key ) ); + } + void set( String^ key, Object^ value ) { + this->BaseSet( key, value ); + } + } + + // Gets a String array that contains all the keys in the collection. + property array^ AllKeys { + array^ get() { + return( (array^)this->BaseGetAllKeys() ); + } + } + + // Gets an Object array that contains all the values in the collection. + property Array^ AllValues { + Array^ get() { + return( this->BaseGetAllValues() ); + } + } + + // Gets a String array that contains all the values in the collection. + property array^ AllStringValues { + array^ get() { + return( (array^) this->BaseGetAllValues( String ::typeid )); + } + } + + // Gets a value indicating if the collection contains keys that are not null. + property Boolean HasKeys { + Boolean get() { + return( this->BaseHasKeys() ); + } + } + + // Adds an entry to the collection. + void Add( String^ key, Object^ value ) { + this->BaseAdd( key, value ); + } + + // Removes an entry with the specified key from the collection. + void Remove( String^ key ) { + this->BaseRemove( key ); + } + + // Removes an entry in the specified index from the collection. + void Remove( int index ) { + this->BaseRemoveAt( index ); + } + + // Clears all the elements in the collection. + void Clear() { + this->BaseClear(); + } +}; + +public ref class SamplesNameObjectCollectionBase { + +public: + static void Main() { + // Creates and initializes a new MyCollection that is read-only. + IDictionary^ d = gcnew ListDictionary(); + d->Add( "red", "apple" ); + d->Add( "yellow", "banana" ); + d->Add( "green", "pear" ); + MyCollection^ myROCol = gcnew MyCollection( d, true ); + + // Tries to add a new item. + try { + myROCol->Add( "blue", "sky" ); + } + catch ( NotSupportedException^ e ) { + Console::WriteLine( e->ToString() ); + } + + // Displays the keys and values of the MyCollection. + Console::WriteLine( "Read-Only Collection:" ); + PrintKeysAndValues( myROCol ); + + // Creates and initializes an empty MyCollection that is writable. + MyCollection^ myRWCol = gcnew MyCollection(); + + // Adds new items to the collection. + myRWCol->Add( "purple", "grape" ); + myRWCol->Add( "orange", "tangerine" ); + myRWCol->Add( "black", "berries" ); + Console::WriteLine( "Writable Collection (after adding values):" ); + PrintKeysAndValues( myRWCol ); + + // Changes the value of one element. + myRWCol["orange"] = "grapefruit"; + Console::WriteLine( "Writable Collection (after changing one value):" ); + PrintKeysAndValues( myRWCol ); + + // Removes one item from the collection. + myRWCol->Remove( "black" ); + Console::WriteLine( "Writable Collection (after removing one value):" ); + PrintKeysAndValues( myRWCol ); + + // Removes all elements from the collection. + myRWCol->Clear(); + Console::WriteLine( "Writable Collection (after clearing the collection):" ); + PrintKeysAndValues( myRWCol ); + } + + // Prints the indexes, keys, and values. + static void PrintKeysAndValues( MyCollection^ myCol ) { + for ( int i = 0; i < myCol->Count; i++ ) { + Console::WriteLine( "[{0}] : {1}, {2}", i, myCol[i]->Key, myCol[i]->Value ); + } + } + + // Prints the keys and values using AllKeys. + static void PrintKeysAndValues2( MyCollection^ myCol ) { + for each ( String^ s in myCol->AllKeys ) { + Console::WriteLine( "{0}, {1}", s, myCol[s] ); + } + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + +/* +This code produces the following output. + +System.NotSupportedException: Collection is read-only. + at System.Collections.Specialized.NameObjectCollectionBase.BaseAdd(String name, Object value) + at SamplesNameObjectCollectionBase.Main() +Read-Only Collection: +[0] : red, apple +[1] : yellow, banana +[2] : green, pear +Writable Collection (after adding values): +[0] : purple, grape +[1] : orange, tangerine +[2] : black, berries +Writable Collection (after changing one value): +[0] : purple, grape +[1] : orange, grapefruit +[2] : black, berries +Writable Collection (after removing one value): +[0] : purple, grape +[1] : orange, grapefruit +Writable Collection (after clearing the collection): + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp new file mode 100644 index 00000000000..7865c4fe20e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameObjectCollectionBase/CPP/remarks.cpp @@ -0,0 +1,130 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Threading; + +public ref class DerivedCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Creates an empty collection. +public: + DerivedCollection() { + _de = gcnew DictionaryEntry(); + } + + // Adds elements from an IDictionary into the new collection. + DerivedCollection( IDictionary^ d, Boolean bReadOnly ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + this->IsReadOnly = bReadOnly; + } + + // Gets a key-and-value pair (DictionaryEntry) using an index. + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get(int index) { + _de->Key = this->BaseGetKey(index); + _de->Value = this->BaseGet(index); + return( _de ); + } + } + + // Gets or sets the value associated with the specified key. + property Object^ default[ String^ ] { + Object^ get(String^ key) { + return( this->BaseGet( key ) ); + } + void set( String^ key, Object^ value ) { + this->BaseSet( key, value ); + } + } + + // Gets a String array that contains all the keys in the collection. + property array^ AllKeys { + array^ get() { + return( (array^)this->BaseGetAllKeys() ); + } + } + + // Gets an Object array that contains all the values in the collection. + property Array^ AllValues { + Array^ get() { + return( this->BaseGetAllValues() ); + } + } + + // Gets a String array that contains all the values in the collection. + property array^ AllStringValues { + array^ get() { + return( (array^) this->BaseGetAllValues( String ::typeid )); + } + } + + // Gets a value indicating if the collection contains keys that are not null. + property Boolean HasKeys { + Boolean get() { + return( this->BaseHasKeys() ); + } + } + + // Adds an entry to the collection. + void Add( String^ key, Object^ value ) { + this->BaseAdd( key, value ); + } + + // Removes an entry with the specified key from the collection. + void Remove( String^ key ) { + this->BaseRemove( key ); + } + + // Removes an entry in the specified index from the collection. + void Remove( int index ) { + this->BaseRemoveAt( index ); + } + + // Clears all the elements in the collection. + void Clear() { + this->BaseClear(); + } +}; + +public ref class SamplesNameObjectCollectionBase +{ +public: + static void Main() + { + // + // Create a collection derived from NameObjectCollectionBase + ICollection^ myCollection = gcnew DerivedCollection(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesNameObjectCollectionBase::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp new file mode 100644 index 00000000000..6d13a5bf9be --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.NameValueCollection2/CPP/nvc.cpp @@ -0,0 +1,101 @@ +// The following code example demonstrates several of the properties and methods of NameValueCollection. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintKeysAndValues( NameValueCollection^ myCol ); +void PrintKeysAndValues2( NameValueCollection^ myCol ); + +int main() +{ + // Creates and initializes a new NameValueCollection. + NameValueCollection^ myCol = gcnew NameValueCollection; + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + myCol->Add( "red", "rouge" ); + + // Displays the values in the NameValueCollection in two different ways. + Console::WriteLine( "Displays the elements using the AllKeys property and the Item (indexer) property:" ); + PrintKeysAndValues( myCol ); + Console::WriteLine( "Displays the elements using GetKey and Get:" ); + PrintKeysAndValues2( myCol ); + + // Gets a value either by index or by key. + Console::WriteLine( "Index 1 contains the value {0}.", myCol[ 1 ] ); + Console::WriteLine( "Key \"red\" has the value {0}.", myCol[ "red" ] ); + Console::WriteLine(); + + // Copies the values to a string array and displays the string array. + array^myStrArr = gcnew array(myCol->Count); + myCol->CopyTo( myStrArr, 0 ); + Console::WriteLine( "The string array contains:" ); + for each ( String^ s in myStrArr ) + Console::WriteLine( " {0}", s ); + Console::WriteLine(); + + // Searches for a key and deletes it. + myCol->Remove( "green" ); + Console::WriteLine( "The collection contains the following elements after removing \"green\":" ); + PrintKeysAndValues( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "The collection contains the following elements after it is cleared:" ); + PrintKeysAndValues( myCol ); +} + +void PrintKeysAndValues( NameValueCollection^ myCol ) +{ + Console::WriteLine( " KEY VALUE" ); + for each ( String^ s in myCol->AllKeys ) + Console::WriteLine( " {0,-10} {1}", s, myCol[s] ); + Console::WriteLine(); +} + +void PrintKeysAndValues2( NameValueCollection^ myCol ) +{ + Console::WriteLine( " [INDEX] KEY VALUE" ); + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " [{0}] {1,-10} {2}", i, myCol->GetKey( i ), myCol->Get( i ) ); + Console::WriteLine(); +} + +/* + +This code produces the following output. + +Displays the elements using the AllKeys property and the Item (indexer) property: + KEY VALUE + red rojo,rouge + green verde + blue azul + +Displays the elements using GetKey and Get: + [INDEX] KEY VALUE + [0] red rojo,rouge + [1] green verde + [2] blue azul + +Index 1 contains the value verde. +Key "red" has the value rojo,rouge. + +The string array contains: + rojo,rouge + verde + azul + +The collection contains the following elements after removing "green": + KEY VALUE + red rojo,rouge + blue azul + +The collection contains the following elements after it is cleared: + KEY VALUE + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp new file mode 100644 index 00000000000..c59ed515e67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/ordereddictionary1.cpp @@ -0,0 +1,138 @@ +// +// The following code example enumerates the elements of a OrderedDictionary. +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class OrderedDictionarySample +{ +public: + static void Main() + { + // + // Creates and initializes a OrderedDictionary. + OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary(); + myOrderedDictionary->Add("testKey1", "testValue1"); + myOrderedDictionary->Add("testKey2", "testValue2"); + myOrderedDictionary->Add("keyToDelete", "valueToDelete"); + myOrderedDictionary->Add("testKey3", "testValue3"); + + ICollection^ keyCollection = myOrderedDictionary->Keys; + ICollection^ valueCollection = myOrderedDictionary->Values; + + // Display the contents using the key and value collections + DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count); + // + + // + // Modifying the OrderedDictionary + if (!myOrderedDictionary->IsReadOnly) + { + // Insert a new key to the beginning of the OrderedDictionary + myOrderedDictionary->Insert(0, "insertedKey1", "insertedValue1"); + + // Modify the value of the entry with the key "testKey2" + myOrderedDictionary["testKey2"] = "modifiedValue"; + + // Remove the last entry from the OrderedDictionary: "testKey3" + myOrderedDictionary->RemoveAt(myOrderedDictionary->Count - 1); + + // Remove the "keyToDelete" entry, if it exists + if (myOrderedDictionary->Contains("keyToDelete")) + { + myOrderedDictionary->Remove("keyToDelete"); + } + } + // + + Console::WriteLine( + "{0}Displaying the entries of a modified OrderedDictionary.", + Environment::NewLine); + DisplayContents(keyCollection, valueCollection, myOrderedDictionary->Count); + + // + // Clear the OrderedDictionary and add new values + myOrderedDictionary->Clear(); + myOrderedDictionary->Add("newKey1", "newValue1"); + myOrderedDictionary->Add("newKey2", "newValue2"); + myOrderedDictionary->Add("newKey3", "newValue3"); + + // Display the contents of the "new" Dictionary using an enumerator + IDictionaryEnumerator^ myEnumerator = + myOrderedDictionary->GetEnumerator(); + + Console::WriteLine( + "{0}Displaying the entries of a \"new\" OrderedDictionary.", + Environment::NewLine); + + DisplayEnumerator(myEnumerator); + // + } + + // + // Displays the contents of the OrderedDictionary from its keys and values + static void DisplayContents( + ICollection^ keyCollection, ICollection^ valueCollection, int dictionarySize) + { + array^ myKeys = gcnew array(dictionarySize); + array^ myValues = gcnew array(dictionarySize); + keyCollection->CopyTo(myKeys, 0); + valueCollection->CopyTo(myValues, 0); + + // Displays the contents of the OrderedDictionary + Console::WriteLine(" INDEX KEY VALUE"); + for (int i = 0; i < dictionarySize; i++) + { + Console::WriteLine(" {0,-5} {1,-25} {2}", + i, myKeys[i], myValues[i]); + } + Console::WriteLine(); + } + // + + // + // Displays the contents of the OrderedDictionary using its enumerator + static void DisplayEnumerator(IDictionaryEnumerator^ myEnumerator) + { + Console::WriteLine(" KEY VALUE"); + while (myEnumerator->MoveNext()) + { + Console::WriteLine(" {0,-25} {1}", + myEnumerator->Key, myEnumerator->Value); + } + } + // +}; + +int main() +{ + OrderedDictionarySample::Main(); +} + +/* +This code produces the following output. + + INDEX KEY VALUE + 0 testKey1 testValue1 + 1 testKey2 testValue2 + 2 keyToDelete valueToDelete + 3 testKey3 testValue3 + + +Displaying the entries of a modified OrderedDictionary. + INDEX KEY VALUE + 0 insertedKey1 insertedValue1 + 1 testKey1 testValue1 + 2 testKey2 modifiedValue + + +Displaying the entries of a "new" OrderedDictionary. + KEY VALUE + newKey1 newValue1 + newKey2 newValue2 + newKey3 newValue3 + +*/ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp new file mode 100644 index 00000000000..42c6ceb624c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.OrderedDictionary1/cpp/source2.cpp @@ -0,0 +1,26 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +public ref class OrderedDictionarySample +{ +public: + static void Main() + { + OrderedDictionary^ myOrderedDictionary = gcnew OrderedDictionary(); + // + for each (DictionaryEntry de in myOrderedDictionary) + { + //... + } + // + } +}; + +int main() +{ + OrderedDictionarySample::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp new file mode 100644 index 00000000000..427029d212e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/remarks.cpp @@ -0,0 +1,39 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Threading; + +public ref class SamplesStringCollection +{ +public: + static void Main() + { + // + StringCollection^ myCollection = gcnew StringCollection(); + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesStringCollection::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp new file mode 100644 index 00000000000..c05a22e2367 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollection2/CPP/stringcollection.cpp @@ -0,0 +1,182 @@ +// The following code example demonstrates several of the properties and methods of StringCollection. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +void PrintValues1( StringCollection^ myCol ); +void PrintValues2( StringCollection^ myCol ); +void PrintValues3( StringCollection^ myCol ); + +int main() +{ + + // Create and initializes a new StringCollection. + StringCollection^ myCol = gcnew StringCollection; + + // Add a range of elements from an array to the end of the StringCollection. + array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; + myCol->AddRange( myArr ); + + // Display the contents of the collection using for each. This is the preferred method. + Console::WriteLine( "Displays the elements using for each:" ); + PrintValues1( myCol ); + + // Display the contents of the collection using the enumerator. + Console::WriteLine( "Displays the elements using the IEnumerator:" ); + PrintValues2( myCol ); + + // Display the contents of the collection using the Count and Item properties. + Console::WriteLine( "Displays the elements using the Count and Item properties:" ); + PrintValues3( myCol ); + + // Add one element to the end of the StringCollection and insert another at index 3. + myCol->Add( "* white" ); + myCol->Insert( 3, "* gray" ); + Console::WriteLine( "After adding \"* white\" to the end and inserting \"* gray\" at index 3:" ); + PrintValues1( myCol ); + + // Remove one element from the StringCollection. + myCol->Remove( "yellow" ); + Console::WriteLine( "After removing \"yellow\":" ); + PrintValues1( myCol ); + + // Remove all occurrences of a value from the StringCollection. + int i = myCol->IndexOf( "RED" ); + while ( i > -1 ) + { + myCol->RemoveAt( i ); + i = myCol->IndexOf( "RED" ); + } + + + // Verify that all occurrences of "RED" are gone. + if ( myCol->Contains( "RED" ) ) + Console::WriteLine( "*** The collection still contains \"RED\"." ); + + Console::WriteLine( "After removing all occurrences of \"RED\":" ); + PrintValues1( myCol ); + + // Copy the collection to a new array starting at index 0. + array^myArr2 = gcnew array(myCol->Count); + myCol->CopyTo( myArr2, 0 ); + Console::WriteLine( "The new array contains:" ); + for ( i = 0; i < myArr2->Length; i++ ) + { + Console::WriteLine( " [{0}] {1}", i, myArr2[ i ] ); + + } + Console::WriteLine(); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "After clearing the collection:" ); + PrintValues1( myCol ); +} + + +// Uses the for each statement which hides the complexity of the enumerator. +// NOTE: The for each statement is the preferred way of enumerating the contents of a collection. +void PrintValues1( StringCollection^ myCol ) { + for each ( Object^ obj in myCol ) + Console::WriteLine( " {0}", obj ); + Console::WriteLine(); +} + +// Uses the enumerator. +void PrintValues2( StringCollection^ myCol ) +{ + StringEnumerator^ myEnumerator = myCol->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( " {0}", myEnumerator->Current ); + + Console::WriteLine(); +} + + +// Uses the Count and Item properties. +void PrintValues3( StringCollection^ myCol ) +{ + for ( int i = 0; i < myCol->Count; i++ ) + Console::WriteLine( " {0}", myCol[ i ] ); + Console::WriteLine(); +} + +/* +This code produces the following output. + +Displays the elements using the IEnumerator: + RED + orange + yellow + RED + green + blue + RED + indigo + violet + RED + +Displays the elements using the Count and Item properties: + RED + orange + yellow + RED + green + blue + RED + indigo + violet + RED + +After adding "* white" to the end and inserting "* gray" at index 3: + RED + orange + yellow + * gray + RED + green + blue + RED + indigo + violet + RED + * white + +After removing "yellow": + RED + orange + * gray + RED + green + blue + RED + indigo + violet + RED + * white + +After removing all occurrences of "RED": + orange + * gray + green + blue + indigo + violet + * white + +The new array contains: + [0] orange + [1] * gray + [2] green + [3] blue + [4] indigo + [5] violet + [6] * white + +After clearing the collection: + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp new file mode 100644 index 00000000000..841b997b1e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionAdd/CPP/stringcollectionadd.cpp @@ -0,0 +1,76 @@ + + +// The following code example adds new elements to the StringCollection. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintValues( IEnumerable^ myCol ); +int main() +{ + + // Creates and initializes a new StringCollection. + StringCollection^ myCol = gcnew StringCollection; + Console::WriteLine( "Initial contents of the StringCollection:" ); + PrintValues( myCol ); + + // Adds a range of elements from an array to the end of the StringCollection. + array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; + myCol->AddRange( myArr ); + Console::WriteLine( "After adding a range of elements:" ); + PrintValues( myCol ); + + // Adds one element to the end of the StringCollection and inserts another at index 3. + myCol->Add( "* white" ); + myCol->Insert( 3, "* gray" ); + Console::WriteLine( "After adding \"* white\" to the end and inserting \"* gray\" at index 3:" ); + PrintValues( myCol ); +} + +void PrintValues( IEnumerable^ myCol ) +{ + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the StringCollection: + +After adding a range of elements: + RED + orange + yellow + RED + green + blue + RED + indigo + violet + RED + +After adding "* white" to the end and inserting "* gray" at index 3: + RED + orange + yellow + * gray + RED + green + blue + RED + indigo + violet + RED + * white + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp new file mode 100644 index 00000000000..9d9a32b8e90 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionContains/CPP/stringcollectioncontains.cpp @@ -0,0 +1,58 @@ + + +// The following code example searches the StringCollection for an element. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintValues( IEnumerable^ myCol ); +int main() +{ + + // Creates and initializes a new StringCollection. + StringCollection^ myCol = gcnew StringCollection; + array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; + myCol->AddRange( myArr ); + Console::WriteLine( "Initial contents of the StringCollection:" ); + PrintValues( myCol ); + + // Checks whether the collection contains "orange" and, if so, displays its index. + if ( myCol->Contains( "orange" ) ) + Console::WriteLine( "The collection contains \"orange\" at index {0}.", myCol->IndexOf( "orange" ) ); + else + Console::WriteLine( "The collection does not contain \"orange\"." ); +} + +void PrintValues( IEnumerable^ myCol ) +{ + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the StringCollection: + RED + orange + yellow + RED + green + blue + RED + indigo + violet + RED + +The collection contains "orange" at index 1. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp new file mode 100644 index 00000000000..f90440e4676 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionCopyTo/CPP/stringcollectioncopyto.cpp @@ -0,0 +1,73 @@ + + +// The following code example copies a StringCollection to an array. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintValues( IEnumerable^ myCol ); +int main() +{ + + // Creates and initializes a new StringCollection. + StringCollection^ myCol = gcnew StringCollection; + array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; + myCol->AddRange( myArr ); + Console::WriteLine( "Initial contents of the StringCollection:" ); + PrintValues( myCol ); + + // Copies the collection to a new array starting at index 0. + array^myArr2 = gcnew array(myCol->Count); + myCol->CopyTo( myArr2, 0 ); + Console::WriteLine( "The new array contains:" ); + for ( int i = 0; i < myArr2->Length; i++ ) + { + Console::WriteLine( " [{0}] {1}", i, myArr2[ i ] ); + + } + Console::WriteLine(); +} + +void PrintValues( IEnumerable^ myCol ) +{ + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the StringCollection: + RED + orange + yellow + RED + green + blue + RED + indigo + violet + RED + +The new array contains: + [0] RED + [1] orange + [2] yellow + [3] RED + [4] green + [5] blue + [6] RED + [7] indigo + [8] violet + [9] RED + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp new file mode 100644 index 00000000000..98e049d1393 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringCollectionRemove/CPP/stringcollectionremove.cpp @@ -0,0 +1,91 @@ + + +// The following code example removes elements from the StringCollection. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void PrintValues( IEnumerable^ myCol ); +int main() +{ + + // Creates and initializes a new StringCollection. + StringCollection^ myCol = gcnew StringCollection; + array^myArr = {"RED","orange","yellow","RED","green","blue","RED","indigo","violet","RED"}; + myCol->AddRange( myArr ); + Console::WriteLine( "Initial contents of the StringCollection:" ); + PrintValues( myCol ); + + // Removes one element from the StringCollection. + myCol->Remove( "yellow" ); + Console::WriteLine( "After removing \"yellow\":" ); + PrintValues( myCol ); + + // Removes all occurrences of a value from the StringCollection. + int i = myCol->IndexOf( "RED" ); + while ( i > -1 ) + { + myCol->RemoveAt( i ); + i = myCol->IndexOf( "RED" ); + } + + Console::WriteLine( "After removing all occurrences of \"RED\":" ); + PrintValues( myCol ); + + // Clears the entire collection. + myCol->Clear(); + Console::WriteLine( "After clearing the collection:" ); + PrintValues( myCol ); +} + +void PrintValues( IEnumerable^ myCol ) +{ + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ obj = safe_cast(myEnum->Current); + Console::WriteLine( " {0}", obj ); + } + + Console::WriteLine(); +} + +/* +This code produces the following output. + +Initial contents of the StringCollection: + RED + orange + yellow + RED + green + blue + RED + indigo + violet + RED + +After removing "yellow": + RED + orange + RED + green + blue + RED + indigo + violet + RED + +After removing all occurrences of "RED": + orange + green + blue + indigo + violet + +After clearing the collection: + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp new file mode 100644 index 00000000000..5bf34579a7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringDictionary.CopyTo/CPP/stringdictionary_copyto.cpp @@ -0,0 +1,56 @@ + + +// The following code example shows how a StringDictionary can be copied to an array. +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +void main() +{ + + // Creates and initializes a new StringDictionary. + StringDictionary^ myCol = gcnew StringDictionary; + myCol->Add( "red", "rojo" ); + myCol->Add( "green", "verde" ); + myCol->Add( "blue", "azul" ); + + // Displays the values in the StringDictionary. + Console::WriteLine( "KEYS\tVALUES in the StringDictionary" ); + IEnumerator^ myEnum = myCol->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ myDE = safe_cast(myEnum->Current); + Console::WriteLine( "{0}\t{1}", myDE->Key, myDE->Value ); + Console::WriteLine(); + + // Creates an array with DictionaryEntry elements. + array^myArr = gcnew array(3); + + // Copies the StringDictionary to the array. + myCol->CopyTo( myArr, 0 ); + + // Displays the values in the array. + Console::WriteLine( "KEYS\tVALUES in the array" ); + for ( int i = 0; i < myArr->Length; i++ ) + Console::WriteLine( "{0}\t{1}", myArr[ i ].Key, myArr[ i ].Value ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +KEYS VALUES in the StringDictionary +green verde +red rojo +blue azul + +KEYS VALUES in the array +green verde +red rojo +blue azul + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp new file mode 100644 index 00000000000..c6cea926c77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Collections.Specialized.StringEnumerator2/CPP/stringenumerator.cpp @@ -0,0 +1,44 @@ + + +// The following code example demonstrates several of the properties and methods of StringEnumerator. +// +#using + +using namespace System; +using namespace System::Collections::Specialized; +int main() +{ + + // Creates and initializes a StringCollection. + StringCollection^ myCol = gcnew StringCollection; + array^myArr = {"red","orange","yellow","green","blue","indigo","violet"}; + myCol->AddRange( myArr ); + + // Enumerates the elements in the StringCollection. + StringEnumerator^ myEnumerator = myCol->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( "{0}", myEnumerator->Current ); + + Console::WriteLine(); + + // Resets the enumerator and displays the first element again. + myEnumerator->Reset(); + if ( myEnumerator->MoveNext() ) + Console::WriteLine( "The first element is {0}.", myEnumerator->Current ); +} + +/* +This code produces the following output. + +red +orange +yellow +green +blue +indigo +violet + +The first element is red. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp new file mode 100644 index 00000000000..d9dc7f158c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console-INSERTTABS/CPP/inserttabs.cpp @@ -0,0 +1,63 @@ +// This sample opens a file whose name is passed to it as a parameter. +// It reads each line in the file and replaces every occurrence of 4 +// space characters with a tab character. +// +// It takes two command-line arguments: the input file name, and +// the output file name. +// +// Usage: +// +// INSERTTABS inputfile.txt outputfile.txt +// +// +using namespace System; +using namespace System::IO; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + const int tabSize = 4; + String^ usageText = "Usage: INSERTTABS inputfile.txt outputfile.txt"; + StreamWriter^ writer = nullptr; + if ( args->Length < 3 ) + { + Console::WriteLine( usageText ); + return 1; + } + + try + { + // Attempt to open output file. + writer = gcnew StreamWriter( args[ 2 ] ); + // Redirect standard output from the console to the output file. + Console::SetOut( writer ); + // Redirect standard input from the console to the input file. + Console::SetIn( gcnew StreamReader( args[ 1 ] ) ); + } + catch ( IOException^ e ) + { + TextWriter^ errorWriter = Console::Error; + errorWriter->WriteLine( e->Message ); + errorWriter->WriteLine( usageText ); + return 1; + } + + String^ line; + while ( (line = Console::ReadLine()) != nullptr ) + { + String^ newLine = line->Replace( ((String^)"")->PadRight( tabSize, ' ' ), "\t" ); + Console::WriteLine( newLine ); + } + + writer->Close(); + + // Recover the standard output stream so that a + // completion message can be displayed. + StreamWriter^ standardOutput = gcnew StreamWriter( Console::OpenStandardOutput() ); + standardOutput->AutoFlush = true; + Console::SetOut( standardOutput ); + Console::WriteLine( "INSERTTABS has completed the processing of {0}.", args[ 1 ] ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp new file mode 100644 index 00000000000..05916a9e0cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console-REFORMAT/CPP/reformat.cpp @@ -0,0 +1,72 @@ + +using namespace System; + +// This sample converts tab-delmited input and converts it to +// comma-delimited output. Furthermore, it converts all boolean +// input to numeric representations. +// System.Console.Write +// System.Console.WriteLine +// System.Console.ReadLine +// +int main() +{ + array^lineInputArr = {"1 2.2 hello TRUE","2 5.22 bye FALSE","3 6.38 see ya' TRUE"}; + for ( Int32 i = 0; i < 3; i++ ) + { + String^ lineInput = lineInputArr->GetValue( i )->ToString(); + String^ aChar = "\t"; + array^fields = lineInput->Split( aChar->ToCharArray() ); + Boolean isFirstField = true; + for ( Int32 i = 0; i < fields->Length; i++ ) + { + if ( isFirstField ) + isFirstField = false; + else + Console::Write( "," ); + + // If the field represents a boolean, replace with a numeric representation. + try + { + Console::Write( Convert::ToByte( Convert::ToBoolean( fields[ i ] ) ) ); + } + catch ( FormatException^ ) + { + Console::Write( fields[ i ] ); + } + + + } + Console::WriteLine(); + + } +} + +// +/* +usage examples: +To convert tab-delimited input from the keyboard and display +the output (type CTRL+Z to mark the end of input): + REFORMAT + +To input tab-delimited data from a file and display the output: + REFORMAT commas.txt + +To convert tab-delimited data from a file and output the conversion +to a file: + REFORMAT commas.txt + +Example input: +1 2.2 hello TRUE +2 5.22 bye FALSE +3 6.38 see ya' TRUE + +Example output: +1,2.2,hello,1 +2,5.22,bye,0 +3,6.38,see ya',1 + +*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp new file mode 100644 index 00000000000..28ce20635b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.OpenStandartInput/CPP/decode.cpp @@ -0,0 +1,20 @@ +// System.Console.OpenStandartInput +// + +using namespace System; +using namespace System::Text; +using namespace System::IO; + +int main() +{ + Stream^ inputStream = Console::OpenStandardInput(); + array^bytes = gcnew array(100); + Console::WriteLine( "To decode, type or paste the UTF7 encoded string and press enter:" ); + Console::WriteLine( "(Example: \"M+APw-nchen ist wundervoll\")" ); + int outputLength = inputStream->Read( bytes, 0, 100 ); + array^chars = Encoding::UTF7->GetChars( bytes, 0, outputLength ); + Console::WriteLine( "Decoded string:" ); + Console::WriteLine( gcnew String( chars ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp new file mode 100644 index 00000000000..46250e779de --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/ReadLineSimple.cpp @@ -0,0 +1,20 @@ +// +using namespace System; + +void main() +{ + Console::Clear(); + + DateTime dat = DateTime::Now; + + Console::WriteLine("\nToday is {0:d} at {0:T}.", dat); + Console::Write("\nPress any key to continue... "); + Console::ReadLine(); +} +// The example displays output like the following: +// Today is 10/26/2015 at 12:22:22 PM. +// +// Press any key to continue... + +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp new file mode 100644 index 00000000000..33019ead3ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.ReadLine/cpp/readline2.cpp @@ -0,0 +1,28 @@ +// Console.ReadLine.cpp : main project file. + +// +using namespace System; + +void main() +{ + String^ line; + Console::WriteLine("Enter one or more lines of text (press CTRL+Z to exit):"); + Console::WriteLine(); + do { + Console::Write(" "); + line = Console::ReadLine(); + if (line != nullptr) + Console::WriteLine(" " + line); + } while (line != nullptr); +} +// The following displays possible output from this example: +// Enter one or more lines of text (press CTRL+Z to exit): +// +// This is line #1. +// This is line #1. +// This is line #2 +// This is line #2 +// ^Z +// +// >} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp new file mode 100644 index 00000000000..11038946fd4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.SetError/cpp/seterror1.cpp @@ -0,0 +1,32 @@ +// Console.SetError.cpp : main project file. + +// +using namespace System; +using namespace System::IO; +using namespace System::Reflection; + +ref class RedirectStdErr; + +void main() +{ + // Define file to receive error stream. + DateTime appStart = DateTime::Now; + String^ fn = "c:\\temp\\errlog" + appStart.ToString("yyyyMMddHHmm") + ".log"; + TextWriter^ errStream = gcnew StreamWriter(fn); + String^ appName = Assembly::GetExecutingAssembly()->Location; + appName = appName->Substring(appName->LastIndexOf('\\') + 1); + // Redirect standard error stream to file. + Console::SetError(errStream); + // Write file header. + Console::Error->WriteLine("Error Log for Application {0}", appName); + Console::Error->WriteLine(); + Console::Error->WriteLine("Application started at {0}.", appStart); + Console::Error->WriteLine(); + // + // Application code along with error output + // + // Close redirected error stream. + Console::Error->Close(); +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp new file mode 100644 index 00000000000..a6753c8b965 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/newline1.cpp @@ -0,0 +1,39 @@ +// Console.WriteLine.cpp : main project file. + +// +using namespace System; + +void main() +{ + array^ lines = gcnew array { "This is the first line.", + "This is the second line." }; + // Output the lines using the default newline sequence. + Console::WriteLine("With the default new line characters:"); + Console::WriteLine(); + for each (String^ line in lines) + Console::WriteLine(line); + + Console::WriteLine(); + + // Redefine the newline characters to double space. + Console::Out->NewLine = "\r\n\r\n"; + // Output the lines using the new newline sequence. + Console::WriteLine("With redefined new line characters:"); + Console::WriteLine(); + for each (String^ line in lines) + Console::WriteLine(line); +} +// The example displays the following output: +// With the default new line characters: +// +// This is the first line. +// This is the second line. +// +// With redefined new line characters: +// +// +// +// This is the first line. +// +// This is the second line. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp new file mode 100644 index 00000000000..0a1a1d1bd9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_boolean1.cpp @@ -0,0 +1,22 @@ +// Console.WriteLine1.cpp : main project file. + +// +using namespace System; + +void main() +{ + // Assign 10 random integers to an array. + Random^ rnd = gcnew Random(); + array^ numbers = gcnew array(10); + for (int ctr = 0; ctr <= numbers->GetUpperBound(0); ctr++) + numbers[ctr] = rnd->Next(); + + // Determine whether the numbers are even or odd. + for each (Int32 number in numbers) { + bool even = (number % 2 == 0); + Console::WriteLine("Is {0} even:", number); + Console::WriteLine(even); + Console::WriteLine(); + } +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp new file mode 100644 index 00000000000..821a9d93340 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_obj1.cpp @@ -0,0 +1,18 @@ +// +using namespace System; + +void main() +{ + array^ values = { true, 12.632, 17908, "stringValue", + 'a', (Decimal) 16907.32 }; + for each (Object^ value in values) + Console::WriteLine(value); +} +// The example displays the following output: +// True +// 12.632 +// 17908 +// stringValue +// a +// 16907.32 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp new file mode 100644 index 00000000000..8cf3b32eb2d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Console.WriteLine/CPP/writeline_vararg.cpp @@ -0,0 +1,43 @@ +// +using namespace System; + +int CountLetters(String^ value); +int CountWhitespace(String^ value); + +void main() +{ + String^ value = "This is a test string."; + + + Console::WriteLine("The string '{0}' consists of:" + + "{4}{1} characters{4}{2} letters{4}" + + "{3} white-space characters", + value, value->Length, CountLetters(value), + CountWhitespace(value), Environment::NewLine); +} + +int CountLetters(String^ value) +{ + int nLetters = 0; + for each (Char ch in value) { + if (Char::IsLetter(ch)) + nLetters++; + } + return nLetters; +} + +int CountWhitespace(String^ value) +{ + int nWhitespace = 0; + for each (Char ch in value) { + if (Char::IsWhiteSpace(ch)) + nWhitespace++; + } + return nWhitespace; +} +// The example displays the following output: +// The string 'This is a test string.' consists of: +// 22 characters +// 17 letters +// 4 white-space characters +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp new file mode 100644 index 00000000000..0e3d6bf7e2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKey/cpp/consolekey.cpp @@ -0,0 +1,72 @@ +// ConsoleKey.cpp : main project file. + + +// +using namespace System; +using namespace System::Text; + +void main() +{ + ConsoleKeyInfo input; + do { + Console::WriteLine("Press a key, together with Alt, Ctrl, or Shift."); + Console::WriteLine("Press Esc to exit."); + input = Console::ReadKey(true); + + StringBuilder^ output = gcnew StringBuilder( + String::Format("You pressed {0}", input.Key.ToString())); + bool modifiers = false; + + if ((input.Modifiers & ConsoleModifiers::Alt) == ConsoleModifiers::Alt) { + output->Append(", together with " + ConsoleModifiers::Alt.ToString()); + modifiers = true; + } + if ((input.Modifiers & ConsoleModifiers::Control) == ConsoleModifiers::Control) + { + if (modifiers) { + output->Append(" and "); + } + else { + output->Append(", together with "); + modifiers = true; + } + output->Append(ConsoleModifiers::Control.ToString()); + } + if ((input.Modifiers & ConsoleModifiers::Shift) == ConsoleModifiers::Shift) + { + if (modifiers) { + output->Append(" and "); + } + else { + output->Append(", together with "); + modifiers = true; + } + output->Append(ConsoleModifiers::Shift.ToString()); + } + output->Append("."); + Console::WriteLine(output->ToString()); + Console::WriteLine(); + } while (input.Key != ConsoleKey::Escape); +} +// The output from a sample console session might appear as follows: +// Press a key, along with Alt, Ctrl, or Shift. +// Press Esc to exit. +// You pressed D. +// +// Press a key, along with Alt, Ctrl, or Shift. +// Press Esc to exit. +// You pressed X, along with Shift. +// +// Press a key, along with Alt, Ctrl, or Shift. +// Press Esc to exit. +// You pressed L, along with Control and Shift. +// +// Press a key, along with Alt, Ctrl, or Shift. +// Press Esc to exit. +// You pressed P, along with Alt and Control and Shift. +// +// Press a key, along with Alt, Ctrl, or Shift. +// Press Esc to exit. +// You pressed Escape. +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp new file mode 100644 index 00000000000..1aea3c7af8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.Equals/cpp/consolekeyinfo.equals.cpp @@ -0,0 +1,101 @@ +// ConsoleKeyInfo.Equals.cpp : main project file. + +// ConsoleKeyInfo.Equals(Object) + +// +using namespace System; +using namespace System::Text; + +static String^ KeyCombination(ConsoleKeyInfo sourceCki); + +void main() +{ + String^ k1 = "\nEnter a key ......... "; + String^ k2 = "\nEnter another key ... "; + String^ key1 = ""; + String^ key2 = ""; + String^ areKeysEqual = "The {0} and {1} keys are {2}equal."; + String^ equalValue = ""; + String^ prompt = "Press the escape key (ESC) to quit, " + + "or any other key to continue."; + ConsoleKeyInfo cki1; + ConsoleKeyInfo cki2; + // + // The Console.TreatControlCAsInput property prevents this example from + // ending if you press CTL+C, however all other operating system keys and + // shortcuts, such as ALT+TAB or the Windows Logo key, are still in effect. + // + Console::TreatControlCAsInput = true; + + // Request that the user enter two key presses. A key press and any + // combination shift, CTRL, and ALT modifier keys is permitted. + do + { + Console::Write(k1); + cki1 = Console::ReadKey(false); + Console::Write(k2); + cki2 = Console::ReadKey(false); + Console::WriteLine(); + + key1 = KeyCombination(cki1); + key2 = KeyCombination(cki2); + if (cki1.Equals(cki2)) + equalValue = ""; + else + equalValue = "not "; + + Console::WriteLine(areKeysEqual, key1, key2, equalValue); + + Console::WriteLine(prompt); + cki1 = Console::ReadKey(true); + } while (cki1.Key != ConsoleKey::Escape); +// Note: This example requires the Escape (Esc) key. +} + +// The KeyCombination() method creates a string that specifies what +// key and what combination of shift, CTRL, and ALT modifier keys +// were pressed simultaneously. + +static String^ KeyCombination(ConsoleKeyInfo sourceCki) +{ + StringBuilder^ sb = gcnew StringBuilder(); + sb->Length = 0; + String^ keyCombo; + if (sourceCki.Modifiers != ConsoleModifiers()) + { + if ((sourceCki.Modifiers & ConsoleModifiers::Alt) != ConsoleModifiers()) + sb->Append("ALT+"); + if ((sourceCki.Modifiers & ConsoleModifiers::Shift) != ConsoleModifiers()) + sb->Append("SHIFT+"); + if ((sourceCki.Modifiers & ConsoleModifiers::Control) != ConsoleModifiers()) + sb->Append("CTL+"); + } + sb->Append(sourceCki.Key.ToString()); + keyCombo = sb->ToString(); + return keyCombo; +} +/* +This example produces results similar to the following output: + +Enter a key ......... a +Enter another key ... a +The A and A keys are equal. +Press the escape key (ESC) to quit, or any other key to continue. + +Enter a key ......... a +Enter another key ... A +The A and SHIFT+A keys are not equal. +Press the escape key (ESC) to quit, or any other key to continue. + +Enter a key ......... S +Enter another key ... +The ALT+SHIFT+S and ALT+CTL+F keys are not equal. +Press the escape key (ESC) to quit, or any other key to continue. + +Enter a key ......... +Enter another key ... +The UpArrow and UpArrow keys are equal. +Press the escape key (ESC) to quit, or any other key to continue. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp new file mode 100644 index 00000000000..504f7fe19df --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.ConsoleKeyInfo.GetHashcode/cpp/hash.cpp @@ -0,0 +1,85 @@ +// ConsoleKeyInfo.GetHashCode.cpp : main project file. + + +// +using namespace System; +using namespace System::Text; + +String^ KeyCombination(ConsoleKeyInfo sourceCki); + +void main() +{ + String^ k1 = "\nEnter a key ......... "; + String^ key1 = ""; + String^ hashCodeFmt = "The hash code for the {0} key is {1}."; + String^ prompt = "Press the escape key (ESC) to quit, " + + "or any other key to continue."; + ConsoleKeyInfo cki1; + int hashCode = 0; + + // The Console.TreatControlCAsInput property prevents this example from + // ending if you press CTL+C, however all other operating system keys and + // shortcuts, such as ALT+TAB or the Windows Logo key, are still in effect. + // + Console::TreatControlCAsInput = true; + + // Request that the user enter two key presses. A key press and any + // combination shift, CTRL, and ALT modifier keys is permitted. + do + { + Console::Write(k1); + cki1 = Console::ReadKey(false); + Console::WriteLine(); + + key1 = KeyCombination(cki1); + hashCode = cki1.GetHashCode(); + Console::WriteLine(hashCodeFmt, key1, hashCode); + + Console::WriteLine(prompt); + cki1 = Console::ReadKey(true); + } while (cki1.Key != ConsoleKey::Escape); + // Note: This example requires the Escape (Esc) key. +} + +// The KeyCombination() method creates a string that specifies what +// key and what combination of shift, CTRL, and ALT modifier keys +// were pressed simultaneously. + +static String^ KeyCombination(ConsoleKeyInfo sourceCki) +{ + StringBuilder^ sb = gcnew StringBuilder(); + sb->Length = 0; + String^ keyCombo; + if (sourceCki.Modifiers != (ConsoleModifiers) 0) + { + if ((sourceCki.Modifiers & ConsoleModifiers::Alt) != (ConsoleModifiers) 0) + sb->Append("ALT+"); + if ((sourceCki.Modifiers & ConsoleModifiers::Shift) != (ConsoleModifiers) 0) + sb->Append("SHIFT+"); + if ((sourceCki.Modifiers & ConsoleModifiers::Control) != (ConsoleModifiers) 0) + sb->Append("CTL+"); + } + sb->Append(sourceCki.Key.ToString()); + keyCombo = sb->ToString(); + return keyCombo; +} + + +/* +This example produces results similar to the following output: + +Enter a key ......... a +The hash code for the A key is 97. +Press the escape key (ESC) to quit, or any other key to continue. + +Enter a key ......... S +The hash code for the SHIFT+S key is 83. +Press the escape key (ESC) to quit, or any other key to continue. + +Enter a key ......... +The hash code for the ALT+SHIFT+CTL+J key is 7. +Press the escape key (ESC) to quit, or any other key to continue. + +*/ +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp new file mode 100644 index 00000000000..ec5dbbee4ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert Snippets/CPP/system.convert snippet.cpp @@ -0,0 +1,593 @@ +using namespace System; + +public ref class ConvertSnippet +{ +// +public: + void ConvertDoubleBool( double doubleVal ) + { + bool boolVal; + + // Double to bool conversion cannot overflow. + boolVal = System::Convert::ToBoolean( doubleVal ); + System::Console::WriteLine( " {0} as a Boolean is: {1}.", + doubleVal, boolVal ); + + // bool to double conversion cannot overflow. + doubleVal = System::Convert::ToDouble( boolVal ); + System::Console::WriteLine( " {0} as a double is: {1}.", + boolVal, doubleVal ); + } + // + + // +public: + void ConvertDoubleByte( double doubleVal ) + { + Byte byteVal = 0; + + // Double to Byte conversion can overflow. + try + { + byteVal = System::Convert::ToByte( doubleVal ); + System::Console::WriteLine( " {0} as a Byte is: {1}.", + doubleVal, byteVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in double-to-Byte conversion." ); + } + + // Byte to double conversion cannot overflow. + doubleVal = System::Convert::ToDouble( byteVal ); + System::Console::WriteLine( " {0} as a double is: {1}.", + byteVal, doubleVal ); + } + // + + // +public: + void ConvertDoubleInt( double doubleVal ) + { + int intVal = 0; + + // Double to int conversion can overflow. + try + { + intVal = System::Convert::ToInt32( doubleVal ); + System::Console::WriteLine( " {0} as an int is: {1}", + doubleVal, intVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in double-to-int conversion." ); + } + + // Int to double conversion cannot overflow. + doubleVal = System::Convert::ToDouble( intVal ); + System::Console::WriteLine( " {0} as a double is: {1}", + intVal, doubleVal ); + } + // + + // +public: + void ConvertDoubleDecimal( double doubleVal ) + { + Decimal decimalVal; + + // Conversion from double to decimal cannot overflow. + decimalVal = System::Convert::ToDecimal( doubleVal ); + System::Console::WriteLine( " {0} as a decimal is: {1}", + doubleVal, decimalVal ); + + // Decimal to double conversion can overflow. + try + { + doubleVal = System::Convert::ToDouble( decimalVal ); + System::Console::WriteLine( " {0} as a double is: {1}", + decimalVal, doubleVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in decimal-to-double conversion." ); + } + } + // + + // +public: + void CovertDoubleFloat( double doubleVal ) + { + float floatVal = 0; + + // A conversion from Double to Single cannot overflow. + floatVal = System::Convert::ToSingle( doubleVal ); + System::Console::WriteLine( " {0} as a float is {1}", + doubleVal, floatVal ); + + // A conversion from Single to Double cannot overflow. + doubleVal = System::Convert::ToDouble( floatVal ); + System::Console::WriteLine( " {0} as a double is: {1}", + floatVal, doubleVal ); + } + // + + // +public: + void ConvertDoubleString( double doubleVal ) + { + String^ stringVal; + + // A conversion from Double to String cannot overflow. + stringVal = System::Convert::ToString( doubleVal ); + System::Console::WriteLine( " {0} as a String is: {1}", + doubleVal, stringVal ); + try + { + doubleVal = System::Convert::ToDouble( stringVal ); + System::Console::WriteLine( " {0} as a double is: {1}", + stringVal, doubleVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Conversion from String-to-double overflowed." ); + } + catch ( System::FormatException^ ) + { + System::Console::WriteLine( "The String was not formatted as a double." ); + } + catch ( System::ArgumentException^ ) + { + System::Console::WriteLine( "The String pointed to null." ); + } + } + // + + // +public: + void ConvertLongChar( Int64 longVal ) + { + Char charVal = 'a'; + + try + { + charVal = System::Convert::ToChar( longVal ); + System::Console::WriteLine( " {0} as a char is {1}", + longVal, charVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in long-to-char conversion." ); + } + + + // A conversion from Char to long cannot overflow. + longVal = System::Convert::ToInt64( charVal ); + System::Console::WriteLine( " {0} as an Int64 is {1}", + charVal, longVal ); + } + + + // + // + void ConvertLongByte( Int64 longVal ) + { + Byte byteVal = 0; + + // A conversion from Long to Byte can overflow. + try + { + byteVal = System::Convert::ToByte( longVal ); + System::Console::WriteLine( " {0} as a Byte is {1}", + longVal, byteVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in long-to-Byte conversion." ); + } + + // A conversion from Byte to long cannot overflow. + longVal = System::Convert::ToInt64( byteVal ); + System::Console::WriteLine( " {0} as an Int64 is {1}", + byteVal, longVal ); + } + // + + // +public: + void ConvertLongDecimal( Int64 longVal ) + { + Decimal decimalVal; + + // Long to decimal conversion cannot overflow. + decimalVal = System::Convert::ToDecimal( longVal ); + System::Console::WriteLine( " {0} as a decimal is {1}", + longVal, decimalVal ); + + // Decimal to long conversion can overflow. + try + { + longVal = System::Convert::ToInt64( decimalVal ); + System::Console::WriteLine( " {0} as a long is {1}", + decimalVal, longVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in decimal-to-long conversion." ); + } + } + // + + // +public: + void ConvertLongFloat( Int64 longVal ) + { + float floatVal; + + // A conversion from Long to float cannot overflow. + floatVal = System::Convert::ToSingle( longVal ); + System::Console::WriteLine( " {0} as a float is {1}", + longVal, floatVal ); + + // A conversion from float to long can overflow. + try + { + longVal = System::Convert::ToInt64( floatVal ); + System::Console::WriteLine( " {0} as a long is {1}", + floatVal, longVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( "Overflow in float-to-long conversion." ); + } + } + // + + // +public: + void ConvertStringBoolean( String^ stringVal ) + { + bool boolVal = false; + + try + { + boolVal = System::Convert::ToBoolean( stringVal ); + if ( boolVal ) + { + System::Console::WriteLine( + "String was equal to System::Boolean::TrueString." ); + } + else + { + System::Console::WriteLine( + "String was equal to System::Boolean::FalseString." ); + } + } + catch ( System::FormatException^ ) + { + System::Console::WriteLine( "The String must equal System::Boolean::TrueString " + + "or System::Boolean::FalseString." ); + } + + // A conversion from bool to String will always succeed. + stringVal = System::Convert::ToString( boolVal ); + System::Console::WriteLine( " {0} as a String is {1}", + boolVal, stringVal ); + } + // + + // +public: + void ConvertStringByte( String^ stringVal ) + { + Byte byteVal = 0; + + try + { + byteVal = System::Convert::ToByte( stringVal ); + System::Console::WriteLine( " {0} as a Byte is: {1}", + stringVal, byteVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( + "Conversion from String to Byte overflowed." ); + } + catch ( System::FormatException^ ) + { + System::Console::WriteLine( + "The String is not formatted as a Byte." ); + } + catch ( System::ArgumentNullException^ ) + { + System::Console::WriteLine( "The String is 0." ); + } + + //The conversion from Byte to String is always valid. + stringVal = System::Convert::ToString( byteVal ); + System::Console::WriteLine( " {0} as a String is {1}", + byteVal, stringVal ); + } + // + + // +public: + void ConvertStringChar( String^ stringVal ) + { + Char charVal = 'a'; + + // A String must be one character long to convert to char. + try + { + charVal = System::Convert::ToChar( stringVal ); + System::Console::WriteLine( " {0} as a char is {1}", + stringVal, charVal ); + } + catch ( System::FormatException^ ) + { + System::Console::WriteLine( + "The String is longer than one character." ); + } + catch ( System::ArgumentNullException^ ) + { + System::Console::WriteLine( "The String is 0." ); + } + + // A char to String conversion will always succeed. + stringVal = System::Convert::ToString( charVal ); + System::Console::WriteLine( "The character as a String is {0}", + stringVal ); + } + // + + // +public: + void ConvertStringDecimal( String^ stringVal ) + { + Decimal decimalVal = 0; + + try + { + decimalVal = System::Convert::ToDecimal( stringVal ); + System::Console::WriteLine( "The String as a decimal is {0}.", + decimalVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( + "The conversion from String to decimal overflowed." ); + } + catch ( System::FormatException^ ) + { + System::Console::WriteLine( + "The String is not formatted as a decimal." ); + } + catch ( System::ArgumentNullException^ ) + { + System::Console::WriteLine( "The String is 0." ); + } + + // Decimal to String conversion will not overflow. + stringVal = System::Convert::ToString( decimalVal ); + System::Console::WriteLine( + "The decimal as a String is {0}.", stringVal ); + } + // + + // +public: + void ConvertStringFloat( String^ stringVal ) + { + float floatVal = 0; + + try + { + floatVal = System::Convert::ToSingle( stringVal ); + System::Console::WriteLine( + "The String as a float is {0}.", floatVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( + "The conversion from String-to-float overflowed." ); + } + catch ( System::FormatException^ ) + { + System::Console::WriteLine( + "The String is not formatted as a float." ); + } + catch ( System::ArgumentNullException^ ) + { + System::Console::WriteLine( + "The String is 0." ); + } + + // Float to String conversion will not overflow. + stringVal = System::Convert::ToString( floatVal ); + System::Console::WriteLine( + "The float as a String is {0}.", stringVal ); + } + // + + // +public: + void ConvertCharDecimal( Char charVal ) + { + Decimal decimalVal = 0; + + // Char to decimal conversion is not supported and will always + // throw an InvalidCastException. + try + { + decimalVal = System::Convert::ToDecimal( charVal ); + } + catch ( System::InvalidCastException^ ) + { + System::Console::WriteLine( + "Char-to-Decimal conversion is not supported by the .NET Framework." ); + } + + //Decimal to char conversion is also not supported. + try + { + charVal = System::Convert::ToChar( decimalVal ); + } + catch ( System::InvalidCastException^ ) + { + System::Console::WriteLine( + "Decimal-to-Char conversion is not supported by the .NET Framework." ); + } + } + // + + // +public: + void ConvertByteDecimal( Byte byteVal ) + { + Decimal decimalVal; + + // Byte to decimal conversion will not overflow. + decimalVal = System::Convert::ToDecimal( byteVal ); + System::Console::WriteLine( "The Byte as a decimal is {0}.", + decimalVal ); + + // Decimal to Byte conversion can overflow. + try + { + byteVal = System::Convert::ToByte( decimalVal ); + System::Console::WriteLine( "The Decimal as a Byte is {0}.", + byteVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( + "The decimal value is too large for a Byte." ); + } + } + // + + // +public: + void ConvertByteSingle( Byte byteVal ) + { + float floatVal; + + // Byte to float conversion will not overflow. + floatVal = System::Convert::ToSingle( byteVal ); + System::Console::WriteLine( "The Byte as a float is {0}.", + floatVal ); + + // Float to Byte conversion can overflow. + try + { + byteVal = System::Convert::ToByte( floatVal ); + System::Console::WriteLine( "The float as a Byte is {0}.", + byteVal ); + } + catch ( System::OverflowException^ ) + { + System::Console::WriteLine( + "The float value is too large for a Byte." ); + } + } + // + + // +public: + void ConvertBoolean() + { + const int year = 1979; + const int month = 7; + const int day = 28; + const int hour = 13; + const int minute = 26; + const int second = 15; + const int millisecond = 53; + DateTime dateTime( year, month, day, hour, + minute, second, millisecond ); + bool boolVal; + + // System::InvalidCastException is always thrown. + try + { + boolVal = System::Convert::ToBoolean( dateTime ); + } + catch ( System::InvalidCastException^ ) + { + System::Console::WriteLine( "Conversion from DateTime to Boolean "+ + "is not supported by the .NET Framework." ); + } + } + // + + void ConvertDoubles( double doubleVal ) + { + ConvertDoubleBool( doubleVal ); + ConvertDoubleByte( doubleVal ); + ConvertDoubleInt( doubleVal ); + ConvertDoubleDecimal( doubleVal ); + CovertDoubleFloat( doubleVal ); + ConvertDoubleString( doubleVal ); + } + + void ConvertLongs( Int64 longVal ) + { + ConvertLongChar( longVal ); + ConvertLongByte( longVal ); + ConvertLongDecimal( longVal ); + ConvertLongFloat( longVal ); + } + + void ConvertStrings( String^ stringVal ) + { + ConvertStringBoolean( stringVal ); + ConvertStringByte( stringVal ); + ConvertStringChar( stringVal ); + ConvertStringDecimal( stringVal ); + ConvertStringFloat( stringVal ); + } + + void ConvertChars( Char charVal ) + { + ConvertCharDecimal( charVal ); + } + + void ConvertBytes( Byte byteVal ) + { + ConvertByteDecimal( byteVal ); + ConvertByteSingle( byteVal ); + } +}; + +int main() +{ + ConvertSnippet^ snippet = gcnew ConvertSnippet; + + double doubleVal; + System::Console::WriteLine( "Enter the double value: " ); + doubleVal = System::Convert::ToDouble( System::Console::ReadLine() ); + snippet->ConvertDoubles( doubleVal ); + + Int64 longVal; + System::Console::WriteLine( "Enter the Int64 value: " ); + longVal = System::Convert::ToInt64( System::Console::ReadLine() ); + snippet->ConvertLongs( longVal ); + + String^ stringVal; + System::Console::WriteLine( "Enter the String value: " ); + stringVal = System::Console::ReadLine(); + snippet->ConvertStrings( stringVal ); + + Char charVal; + System::Console::WriteLine( "Enter the char value: " ); + charVal = System::Convert::ToChar( System::Console::ReadLine() ); + snippet->ConvertChars( charVal ); + + Byte byteVal; + System::Console::WriteLine( "Enter the Byte value: " ); + byteVal = System::Convert::ToByte( System::Console::ReadLine() ); + snippet->ConvertBytes( byteVal ); + + snippet->ConvertBoolean(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp new file mode 100644 index 00000000000..6ae7e65bdc1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.BaseConversion/cpp/toint_str_int32.cpp @@ -0,0 +1,45 @@ +// ToInt_Str_Int32.cpp : main project file. + +//#include "stdafx.h" + +using namespace System; + +int main(array ^args) +{ + // + // Create a hexadecimal value out of range of the integer type. + String^ value1 = Convert::ToString((static_cast<__int64>(int::MaxValue)) + 1, 16); + // Convert it back to a number. + try { + int number = Convert::ToInt32(value1, 16); + Console::WriteLine("0x{0} converts to {1}.", value1, number); + } + catch (OverflowException ^e) { + Console::WriteLine("Unable to convert '0x{0}' to an integer.", value1); + } + // The example displays the following output: + // 0x80000000 converts to -2147483648. + // + + // + __int64 sourceNumber2 = (static_cast<__int64>(int::MaxValue)) + 1; + bool isNegative = Math::Sign(sourceNumber2) == -1; + String^ value2 = Convert::ToString(sourceNumber2, 16); + int targetNumber; + try { + targetNumber = Convert::ToInt32(value2, 16); + if (!(isNegative) & (targetNumber & 0x80000000) != 0) + throw gcnew OverflowException(); + else + Console::WriteLine("0x{0} converts to {1}.", value2, targetNumber); + } + catch (OverflowException ^e) { + Console::WriteLine("Unable to convert '0x{0}' to an integer.", value2); + } + // The example displays the following output: + // Unable to convert '0x80000000' to an integer. + // + //Console::Write("Press any key..."); + //Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp new file mode 100644 index 00000000000..7cff3673fb0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean1.cpp @@ -0,0 +1,37 @@ +// Convert.ToBoolean2.cpp : main project file. + +// +using namespace System; + +void main() +{ + array^ values = gcnew array { nullptr, String::Empty, + "true", "TrueString", + "False", " false ", + "-1", "0" }; + for each (String^ value in values) { + try + { + Console::WriteLine("Converted '{0}' to {1}.", value, + Convert::ToBoolean(value)); + } + catch (FormatException^ e) + { + Console::WriteLine("Unable to convert '{0}' to a Boolean.", value); + } + } +} +// The example displays the following output: +// Converted '' to False. +// Unable to convert '' to a Boolean. +// Converted 'true' to True. +// Unable to convert 'TrueString' to a Boolean. +// Converted 'False' to False. +// Converted ' false ' to False. +// Unable to convert '-1' to a Boolean. +// Unable to convert '0' to a Boolean. +// + + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp new file mode 100644 index 00000000000..ed404e69c09 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToBoolean/cpp/toboolean2.cpp @@ -0,0 +1,303 @@ +// Convert.ToBoolean.cpp : main project file. + +using namespace System; + +void ToByte() +{ + // + array^ bytes = gcnew array { Byte::MinValue, 100, 200, Byte::MaxValue }; + bool result; + + for each (Byte byteValue in bytes) + { + result = Convert::ToBoolean(byteValue); + Console::WriteLine("{0,-5} --> {1}", byteValue, result); + } + // The example displays the following output: + // 0 --> False + // 100 --> True + // 200 --> True + // 255 --> True + // +} + +void ToDecimal() +{ + // + array^ numbers = gcnew array { Decimal::MinValue, (Decimal) -12034.87, + (Decimal) -100, (Decimal) 0, (Decimal) 300, + (Decimal) 6790823.45, Decimal::MaxValue }; + bool result; + + for each (Decimal number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-30} --> {1}", number, result); + } + // The example displays the following output: + // -79228162514264337593543950335 --> True + // -12034.87 --> True + // -100 --> True + // 0 --> False + // 300 --> True + // 6790823.45 --> True + // 79228162514264337593543950335 --> True + // +} + +void ToInt16() +{ + // + array^ numbers = gcnew array { Int16::MinValue, -10000, -154, 0, 216, 21453, + Int16::MaxValue }; + bool result; + + for each (Int16 number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-7:N0} --> {1}", number, result); + } + // The example displays the following output: + // -32,768 --> True + // -10,000 --> True + // -154 --> True + // 0 --> False + // 216 --> True + // 21,453 --> True + // 32,767 --> True + // +} + +void ToInt32() +{ + // + array^ numbers = gcnew array { Int32::MinValue, -201649, -68, 0, 612, 4038907, + Int32::MaxValue }; + bool result; + + for each (int number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-15:N0} --> {1}", number, result); + } + // The example displays the following output: + // -2,147,483,648 --> True + // -201,649 --> True + // -68 --> True + // 0 --> False + // 612 --> True + // 4,038,907 --> True + // 2,147,483,647 --> True + // +} + +void ToInt64() +{ + // + array^ numbers = gcnew array { Int64::MinValue, -2016493, -689, 0, 6121, + 403890774, Int64::MaxValue }; + bool result; + + for each (Int64 number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-26:N0} --> {1}", number, result); + } + // The example displays the following output: + // -9,223,372,036,854,775,808 --> True + // -2,016,493 --> True + // -689 --> True + // 0 --> False + // 6,121 --> True + // 403,890,774 --> True + // 9,223,372,036,854,775,807 --> True + // +} + +void ToObject() +{ + // + array^ objects = gcnew array { 16.33, -24, 0, "12", "12.7", String::Empty, + "1String", "True", "false", nullptr, + gcnew System::Collections::ArrayList }; + + for each (Object^ obj in objects) + { + Console::Write("{0,-40} --> ", + obj == nullptr ? "null" : + String::Format("{0} ({1})", obj, obj->GetType()->Name)); + try { + Console::WriteLine("{0}", Convert::ToBoolean((Object^) obj)); + } + catch (FormatException^) { + Console::WriteLine("Bad Format"); + } + catch (InvalidCastException^) { + Console::WriteLine("No Conversion"); + } + } + // The example displays the following output: + // 16.33 (Double) --> True + // -24 (Int32) --> True + // 0 (Int32) --> False + // 12 (String) --> Bad Format + // 12.7 (String) --> Bad Format + // (String) --> Bad Format + // 1String (String) --> Bad Format + // True (String) --> True + // false (String) --> False + // null --> False + // System.Collections.ArrayList (ArrayList) --> No Conversion + // +} + +void ToSByte() +{ + // + array^ numbers = gcnew array { SByte::MinValue, -1, 0, 10, 100, SByte::MaxValue }; + bool result; + + for each (SByte number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-5} --> {1}", number, result); + } + // The example displays the following output: + // -128 --> True + // -1 --> True + // 0 --> False + // 10 --> True + // 100 --> True + // 127 --> True + // +} + +void ToSingle() +{ + // + array^ numbers = gcnew array { Single::MinValue, (float) -193.0012, (float) 20e-15f, 0, + (float) 10551e-10, (float) 100.3398, Single::MaxValue }; + bool result; + + for each (float number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-15} --> {1}", number, result); + } + // The example displays the following output: + // -3.402823E+38 --> True + // -193.0012 --> True + // 2E-14 --> True + // 0 --> False + // 1.0551E-06 --> True + // 100.3398 --> True + // 3.402823E+38 --> True + // +} + +void ToUInt16() +{ + // + array^ numbers = gcnew array { UInt16::MinValue, 216, 21453, UInt16::MaxValue }; + bool result; + + for each (unsigned short number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-7:N0} --> {1}", number, result); + } + // The example displays the following output: + // 0 --> False + // 216 --> True + // 21,453 --> True + // 65,535 --> True + // +} + +void ToUInt32() +{ + // + array^ numbers = gcnew array { UInt32::MinValue, 612, 4038907, Int32::MaxValue }; + bool result; + + for each (unsigned int number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-15:N0} --> {1}", number, result); + } + // The example displays the following output: + // 0 --> False + // 612 --> True + // 4,038,907 --> True + // 2,147,483,647 --> True + // +} + +void ToUInt64() +{ + // + array^ numbers = gcnew array { UInt64::MinValue, 6121, 403890774, UInt64::MaxValue }; + bool result; + + for each (UInt64 number in numbers) + { + result = Convert::ToBoolean(number); + Console::WriteLine("{0,-26:N0} --> {1}", number, result); + } + // The example displays the following output: + // 0 --> False + // 6,121 --> True + // 403,890,774 --> True + // 18,446,744,073,709,551,615 --> True + // +} + +void main() +{ + Console::WriteLine("ToByte:"); + ToByte(); + Console::WriteLine(); + + Console::WriteLine("ToDecimal:"); + ToDecimal(); + Console::WriteLine(); + + Console::WriteLine("ToInt16:"); + ToInt16(); + Console::WriteLine(); + + Console::WriteLine("ToInt32:"); + ToInt32(); + Console::WriteLine(); + + Console::WriteLine("ToInt64:"); + ToInt64(); + Console::WriteLine(); + + Console::WriteLine("ToObject:"); + ToObject(); + Console::WriteLine(); + + Console::WriteLine("ToSByte:"); + ToSByte(); + Console::WriteLine(); + + Console::WriteLine("ToSingle:"); + ToSingle(); + Console::WriteLine(); + + Console::WriteLine("ToUInt16:"); + ToUInt16(); + Console::WriteLine(); + + Console::WriteLine("ToUInt32:"); + ToUInt32(); + Console::WriteLine(); + + Console::WriteLine("ToUInt64:"); + ToUInt64(); + Console::WriteLine(); + + Console::ReadLine(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp new file mode 100644 index 00000000000..868a76dd151 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToNonNum_String/CPP/stringnonnum.cpp @@ -0,0 +1,75 @@ + +// +using namespace System; +using namespace System::Globalization; +ref class DummyProvider: public IFormatProvider +{ +public: + + // Normally, GetFormat returns an object of the requested type + // (usually itself) if it is able; otherwise, it returns Nothing. + virtual Object^ GetFormat( Type^ argType ) + { + // Here, GetFormat displays the name of argType, after removing + // the namespace information. GetFormat always returns null. + String^ argStr = argType->ToString(); + if ( argStr->Equals( "" ) ) + argStr = "Empty"; + + argStr = argStr->Substring( argStr->LastIndexOf( '.' ) + 1 ); + Console::Write( "{0,-20}", argStr ); + return (Object^)0; + } +}; + +int main() +{ + // Create an instance of IFormatProvider. + DummyProvider^ provider = gcnew DummyProvider; + String^ format = "{0,-17}{1,-17}{2}"; + + // Convert these values using DummyProvider. + String^ Int32A = "-252645135"; + String^ DoubleA = "61680.3855"; + String^ DayTimeA = "2001/9/11 13:45"; + String^ BoolA = "True"; + String^ StringA = "Qwerty"; + String^ CharA = "$"; + Console::WriteLine( "This example of selected " + "Convert::To( String*, IFormatProvider* ) \nmethods " + "generates the following output. The example displays the " + "\nprovider type if the IFormatProvider is called." ); + Console::WriteLine( "\nNote: For the " + "ToBoolean, ToString, and ToChar methods, the \n" + "IFormatProvider object is not referenced." ); + + // The format provider is called for the following conversions. + Console::WriteLine(); + Console::WriteLine( format, "ToInt32", Int32A, Convert::ToInt32( Int32A, provider ) ); + Console::WriteLine( format, "ToDouble", DoubleA, Convert::ToDouble( DoubleA, provider ) ); + Console::WriteLine( format, "ToDateTime", DayTimeA, Convert::ToDateTime( DayTimeA, provider ) ); + + // The format provider is not called for these conversions. + Console::WriteLine(); + Console::WriteLine( format, "ToBoolean", BoolA, Convert::ToBoolean( BoolA, provider ) ); + Console::WriteLine( format, "ToString", StringA, Convert::ToString( StringA, provider ) ); + Console::WriteLine( format, "ToChar", CharA, Convert::ToChar( CharA, provider ) ); +} + +/* +This example of selected Convert::To( String*, IFormatProvider* ) +methods generates the following output. The example displays the +provider type if the IFormatProvider is called. + +Note: For the ToBoolean, ToString, and ToChar methods, the +IFormatProvider object is not referenced. + +NumberFormatInfo ToInt32 -252645135 -252645135 +NumberFormatInfo ToDouble 61680.3855 61680.3855 +DateTimeFormatInfo ToDateTime 2001/9/11 13:45 9/11/2001 1:45:00 PM + +ToBoolean True True +ToString Qwerty Qwerty +ToChar $ $ +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp new file mode 100644 index 00000000000..feecf23e2a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/toint16.cpp @@ -0,0 +1,105 @@ + +// +// Example of the Convert::ToInt16( String* ) and +// Convert::ToInt16( String*, IFormatProvider* ) methods. +using namespace System; +using namespace System::Globalization; +const __wchar_t * protoFmt = L"{0,-20}{1,-20}{2}"; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + +void ConvertToInt16( String^ numericStr, IFormatProvider^ provider ) +{ + Object^ defaultValue; + Object^ providerValue; + + // Convert numericStr to Int16 without a format provider. + try + { + defaultValue = Convert::ToInt16( numericStr ); + } + catch ( Exception^ ex ) + { + defaultValue = GetExceptionType( ex ); + } + + + // Convert numericStr to Int16 with a format provider. + try + { + providerValue = Convert::ToInt16( numericStr, provider ); + } + catch ( Exception^ ex ) + { + providerValue = GetExceptionType( ex ); + } + + Console::WriteLine( gcnew String( protoFmt ), numericStr, defaultValue, providerValue ); +} + +int main() +{ + + // Create a NumberFormatInfo object and set several of its + // properties that apply to numbers. + NumberFormatInfo^ provider = gcnew NumberFormatInfo; + + // These properties affect the conversion. + provider->NegativeSign = "neg "; + provider->PositiveSign = "pos "; + + // These properties do not affect the conversion. + // The input string cannot have decimal and group separators. + provider->NumberDecimalSeparator = "."; + provider->NumberGroupSeparator = ","; + array^sizes = {3}; + provider->NumberGroupSizes = sizes; + provider->NumberNegativePattern = 0; + Console::WriteLine( "This example of\n" + " Convert::ToInt16( String* ) and \n" + " Convert::ToInt16( String*, IFormatProvider* ) " + "\ngenerates the following output. It converts " + "several strings to \nshort values, using " + "default formatting or a NumberFormatInfo object.\n" ); + Console::WriteLine( gcnew String( protoFmt ), "String to convert", "Default/exception", "Provider/exception" ); + Console::WriteLine( gcnew String( protoFmt ), "-----------------", "-----------------", "------------------" ); + + // Convert strings, with and without an IFormatProvider. + ConvertToInt16( "12345", provider ); + ConvertToInt16( "+12345", provider ); + ConvertToInt16( "pos 12345", provider ); + ConvertToInt16( "-12345", provider ); + ConvertToInt16( "neg 12345", provider ); + ConvertToInt16( "12345.", provider ); + ConvertToInt16( "12,345", provider ); + ConvertToInt16( "(12345)", provider ); + ConvertToInt16( "32768", provider ); + ConvertToInt16( "-32769", provider ); +} + +/* +This example of + Convert::ToInt16( String* ) and + Convert::ToInt16( String*, IFormatProvider* ) +generates the following output. It converts several strings to +short values, using default formatting or a NumberFormatInfo object. + +String to convert Default/exception Provider/exception +----------------- ----------------- ------------------ +12345 12345 12345 ++12345 12345 FormatException +pos 12345 FormatException 12345 +-12345 -12345 FormatException +neg 12345 FormatException -12345 +12345. FormatException FormatException +12,345 FormatException FormatException +(12345) FormatException FormatException +32768 OverflowException OverflowException +-32769 OverflowException FormatException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp new file mode 100644 index 00000000000..3336b2aa23d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToSInts_String/CPP/tosbyte.cpp @@ -0,0 +1,100 @@ + +// +// Example of the Convert::ToSByte( String* ) and +// Convert::ToSByte( String*, IFormatProvider* ) methods. +using namespace System; +using namespace System::Globalization; +const __wchar_t * protoFmt = L"{0,-20}{1,-20}{2}"; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + +void ConvertToSByte( String^ numericStr, IFormatProvider^ provider ) +{ + Object^ defaultValue; + Object^ providerValue; + + // Convert numericStr to SByte without a format provider. + try + { + defaultValue = Convert::ToSByte( numericStr ); + } + catch ( Exception^ ex ) + { + defaultValue = GetExceptionType( ex ); + } + + + // Convert numericStr to SByte with a format provider. + try + { + providerValue = Convert::ToSByte( numericStr, provider ); + } + catch ( Exception^ ex ) + { + providerValue = GetExceptionType( ex ); + } + + Console::WriteLine( gcnew String( protoFmt ), numericStr, defaultValue, providerValue ); +} + +int main() +{ + + // Create a NumberFormatInfo object and set several of its + // properties that apply to numbers. + NumberFormatInfo^ provider = gcnew NumberFormatInfo; + + // These properties affect the conversion. + provider->NegativeSign = "neg "; + provider->PositiveSign = "pos "; + + // These properties do not affect the conversion. + // The input string cannot have decimal and group separators. + provider->NumberDecimalSeparator = "."; + provider->NumberNegativePattern = 0; + Console::WriteLine( "This example of\n" + " Convert::ToSByte( String* ) and \n" + " Convert::ToSByte( String*, IFormatProvider* ) " + "\ngenerates the following output. It converts " + "several strings to \nSByte values, using " + "default formatting or a NumberFormatInfo object.\n" ); + Console::WriteLine( gcnew String( protoFmt ), "String to convert", "Default/exception", "Provider/exception" ); + Console::WriteLine( gcnew String( protoFmt ), "-----------------", "-----------------", "------------------" ); + + // Convert strings, with and without an IFormatProvider. + ConvertToSByte( "123", provider ); + ConvertToSByte( "+123", provider ); + ConvertToSByte( "pos 123", provider ); + ConvertToSByte( "-123", provider ); + ConvertToSByte( "neg 123", provider ); + ConvertToSByte( "123.", provider ); + ConvertToSByte( "(123)", provider ); + ConvertToSByte( "128", provider ); + ConvertToSByte( "-129", provider ); +} + +/* +This example of + Convert::ToSByte( String* ) and + Convert::ToSByte( String*, IFormatProvider* ) +generates the following output. It converts several strings to +SByte values, using default formatting or a NumberFormatInfo object. + +String to convert Default/exception Provider/exception +----------------- ----------------- ------------------ +123 123 123 ++123 123 FormatException +pos 123 FormatException 123 +-123 -123 FormatException +neg 123 FormatException -123 +123. FormatException FormatException +(123) FormatException FormatException +128 OverflowException OverflowException +-129 OverflowException FormatException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp new file mode 100644 index 00000000000..819130067f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToString.IFormatProvider/CPP/nonnumeric.cpp @@ -0,0 +1,94 @@ + +// +// Example of Convert::ToString( non-numeric types, IFormatProvider ). +using namespace System; +using namespace System::Globalization; + +#define null (Object^)0 + +// An instance of this class can be passed to methods that require +// an IFormatProvider. +ref class DummyProvider: public IFormatProvider +{ +public: + + // Normally, GetFormat returns an object of the requested type + // (usually itself) if it is able; otherwise, it returns Nothing. + virtual Object^ GetFormat( Type^ argType ) + { + // Here, the type of argType is displayed, and GetFormat + // always returns Nothing. + Console::Write( "{0,-40}", argType->ToString() ); + return null; + } +}; + +int main() +{ + // Create an instance of the IFormatProvider. + DummyProvider^ provider = gcnew DummyProvider; + String^ converted; + + // Convert these values using DummyProvider. + int Int32A = -252645135; + double DoubleA = 61680.3855; + Object^ ObjDouble = -98765.4321; + DateTime DayTimeA = DateTime(2001,9,11,13,45,0); + bool BoolA = true; + String^ StringA = "Qwerty"; + Char CharA = '$'; + TimeSpan TSpanA = TimeSpan(0,18,0); + Object^ ObjOther = static_cast(provider); + Console::WriteLine( "This example of " + "Convert::ToString( non-numeric, IFormatProvider* ) \n" + "generates the following output. The provider type, " + "argument type, \nand argument value are displayed." ); + Console::WriteLine( "\nNote: The IFormatProvider object is " + "not called for Boolean, String, \nChar, TimeSpan, " + "and non-numeric Object." ); + + // The format provider is called for these conversions. + Console::WriteLine(); + converted = Convert::ToString( Int32A, provider ); + Console::WriteLine( "int {0}", converted ); + converted = Convert::ToString( DoubleA, provider ); + Console::WriteLine( "double {0}", converted ); + converted = Convert::ToString( ObjDouble, provider ); + Console::WriteLine( "Object {0}", converted ); + converted = Convert::ToString( DayTimeA, provider ); + Console::WriteLine( "DateTime {0}", converted ); + + // The format provider is not called for these conversions. + Console::WriteLine(); + converted = Convert::ToString( BoolA, provider ); + Console::WriteLine( "bool {0}", converted ); + converted = Convert::ToString( StringA, provider ); + Console::WriteLine( "String {0}", converted ); + converted = Convert::ToString( CharA, provider ); + Console::WriteLine( "Char {0}", converted ); + converted = Convert::ToString( TSpanA, provider ); + Console::WriteLine( "TimeSpan {0}", converted ); + converted = Convert::ToString( ObjOther, provider ); + Console::WriteLine( "Object {0}", converted ); +} + +/* +This example of Convert::ToString( non-numeric, IFormatProvider* ) +generates the following output. The provider type, argument type, +and argument value are displayed. + +Note: The IFormatProvider object is not called for Boolean, String, +Char, TimeSpan, and non-numeric Object. + +System.Globalization.NumberFormatInfo int -252645135 +System.Globalization.NumberFormatInfo double 61680.3855 +System.Globalization.NumberFormatInfo Object -98765.4321 +System.Globalization.DateTimeFormatInfo DateTime 9/11/2001 1:45:00 PM + +bool True +String Qwerty +Char $ +TimeSpan 00:18:00 +Object DummyProvider +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp new file mode 100644 index 00000000000..2e233191f16 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Convert.ToXXX_Object_IFP/CPP/objectifp.cpp @@ -0,0 +1,458 @@ + +// +using namespace System; +using namespace System::Collections; + +// Define the types of averaging available in the class +// implementing IConvertible. +public enum class AverageType : short +{ + None = 0, + GeometricMean = 1, + ArithmeticMean = 2, + Median = 3 +}; + + +// Pass an instance of this class to methods that require an +// IFormatProvider. The class instance determines the type of +// average to calculate. +ref class AverageInfo: public IFormatProvider +{ +protected: + AverageType AvgType; + +public: + + // Specify the type of averaging in the constructor. + AverageInfo( AverageType avgType ) + { + this->AvgType = avgType; + } + + + // This method returns a reference to the containing object + // if an object of AverageInfo type is requested. + virtual Object^ GetFormat( Type^ argType ) + { + if ( argType == AverageInfo::typeid) + return this; + else + return (Object^)0; + } + + + property AverageType TypeOfAverage + { + + // Use this property to set or get the type of averaging. + AverageType get() + { + return this->AvgType; + } + + void set( AverageType value ) + { + this->AvgType = value; + } + + } + +}; + + +// This class encapsulates an array of double values and implements +// the IConvertible interface. Most of the IConvertible methods +// return an average of the array elements in one of three types: +// arithmetic mean, geometric mean, or median. +ref class DataSet: public IConvertible +{ +private: + static Object^ null = nullptr; + +protected: + ArrayList^ data; + AverageInfo^ defaultProvider; + + // This method unboxes a boxed double. + double UnBoxDouble( Object^ obj ) + { + return *static_cast(obj); + } + + +public: + + // Construct the object and add an initial list of values. + // Create a default format provider. + DataSet( ... array^values ) + { + data = gcnew ArrayList( (Array^)values ); + defaultProvider = gcnew AverageInfo( AverageType::ArithmeticMean ); + } + + + // Add additional values with this method. + int Add( double value ) + { + data->Add( value ); + return data->Count; + } + + + property double Item[ int ] + { + + // Get, set, and add values with this indexer property. + double get( int index ) + { + if ( index >= 0 && index < data->Count ) + return UnBoxDouble( data[ index ] ); + else + throw gcnew InvalidOperationException( "[DataSet.get] Index out of range." ); + } + + void set( int index, double value ) + { + if ( index >= 0 && index < data->Count ) + data[ index ] = value; + else + if ( index == data->Count ) + data->Add( value ); + else + throw gcnew InvalidOperationException( "[DataSet.set] Index out of range." ); + } + + } + + property int Count + { + + // This property returns the number of elements in the object. + int get() + { + return data->Count; + } + + } + +protected: + + // This method calculates the average of the object's elements. + double Average( AverageType avgType ) + { + double SumProd; + if ( data->Count == 0 ) + return 0.0; + + switch ( avgType ) + { + case AverageType::GeometricMean: + SumProd = 1.0; + for ( int Index = 0; Index < data->Count; Index++ ) + SumProd *= UnBoxDouble( data[ Index ] ); + + // This calculation will not fail with negative + // elements. + return Math::Sign( SumProd ) * Math::Pow( Math::Abs( SumProd ), 1.0 / data->Count ); + + case AverageType::ArithmeticMean: + SumProd = 0.0; + for ( int Index = 0; Index < data->Count; Index++ ) + SumProd += UnBoxDouble( data[ Index ] ); + return SumProd / data->Count; + + case AverageType::Median: + if ( data->Count % 2 == 0 ) + return (UnBoxDouble( data[ data->Count / 2 ] ) + UnBoxDouble( data[ data->Count / 2 - 1 ] )) / 2.0; + else + return UnBoxDouble( data[ data->Count / 2 ] ); + + default: + return 0.0; + } + } + + + // Get the AverageInfo object from the caller's format provider, + // or use the local default. + AverageInfo^ GetAverageInfo( IFormatProvider^ provider ) + { + AverageInfo^ avgInfo = nullptr; + if ( provider != nullptr ) + avgInfo = static_cast(provider->GetFormat( AverageInfo::typeid )); + + if ( avgInfo == nullptr ) + return defaultProvider; + else + return avgInfo; + } + + + // Calculate the average and limit the range. + double CalcNLimitAverage( double min, double max, IFormatProvider^ provider ) + { + + // Get the format provider and calculate the average. + AverageInfo^ avgInfo = GetAverageInfo( provider ); + double avg = Average( avgInfo->TypeOfAverage ); + + // Limit the range, based on the minimum and maximum values + // for the type. + return avg > max ? max : avg < min ? min : avg; + } + + +public: + + // The following elements are required by IConvertible. + // None of these conversion functions throw exceptions. When + // the data is out of range for the type, the appropriate + // MinValue or MaxValue is used. + virtual TypeCode GetTypeCode() + { + return TypeCode::Object; + } + + virtual bool ToBoolean( IFormatProvider^ provider ) + { + + // ToBoolean is false if the dataset is empty. + if ( data->Count <= 0 ) + return false; + // For median averaging, ToBoolean is true if any + // non-discarded elements are nonzero. + else + + // For median averaging, ToBoolean is true if any + // non-discarded elements are nonzero. + if ( AverageType::Median == GetAverageInfo( provider )->TypeOfAverage ) + { + if ( data->Count % 2 == 0 ) + return (UnBoxDouble( data[ data->Count / 2 ] ) != 0.0 || UnBoxDouble( data[ data->Count / 2 - 1 ] ) != 0.0); + else + return UnBoxDouble( data[ data->Count / 2 ] ) != 0.0; + } + // For arithmetic or geometric mean averaging, ToBoolean is + // true if any element of the dataset is nonzero. + else + { + for ( int Index = 0; Index < data->Count; Index++ ) + if ( UnBoxDouble( data[ Index ] ) != 0.0 ) + return true; + return false; + } + } + + virtual Byte ToByte( IFormatProvider^ provider ) + { + return Convert::ToByte( CalcNLimitAverage( Byte::MinValue, Byte::MaxValue, provider ) ); + } + + virtual Char ToChar( IFormatProvider^ provider ) + { + return Convert::ToChar( Convert::ToUInt16( CalcNLimitAverage( Char::MinValue, Char::MaxValue, provider ) ) ); + } + + + // Convert to DateTime by adding the calculated average as + // seconds to the current date and time. A valid DateTime is + // always returned. + virtual DateTime ToDateTime( IFormatProvider^ provider ) + { + double seconds = Average( GetAverageInfo( provider )->TypeOfAverage ); + try + { + return DateTime::Now.AddSeconds( seconds ); + } + catch ( ArgumentOutOfRangeException^ ) + { + return seconds < 0.0 ? DateTime::MinValue : DateTime::MaxValue; + } + + } + + virtual Decimal ToDecimal( IFormatProvider^ provider ) + { + + // The Double conversion rounds Decimal.MinValue and + // Decimal.MaxValue to invalid Decimal values, so the + // following limits must be used. + return Convert::ToDecimal( CalcNLimitAverage( -79228162514264330000000000000.0, 79228162514264330000000000000.0, provider ) ); + } + + virtual double ToDouble( IFormatProvider^ provider ) + { + return Average( GetAverageInfo( provider )->TypeOfAverage ); + } + + virtual short ToInt16( IFormatProvider^ provider ) + { + return Convert::ToInt16( CalcNLimitAverage( Int16::MinValue, Int16::MaxValue, provider ) ); + } + + virtual int ToInt32( IFormatProvider^ provider ) + { + return Convert::ToInt32( CalcNLimitAverage( Int32::MinValue, Int32::MaxValue, provider ) ); + } + + virtual __int64 ToInt64( IFormatProvider^ provider ) + { + + // The Double conversion rounds Int64.MinValue and + // Int64.MaxValue to invalid Int64 values, so the following + // limits must be used. + return Convert::ToInt64( CalcNLimitAverage( -9223372036854775000, 9223372036854775000, provider ) ); + } + + virtual signed char ToSByte( IFormatProvider^ provider ) + { + return Convert::ToSByte( CalcNLimitAverage( SByte::MinValue, SByte::MaxValue, provider ) ); + } + + virtual float ToSingle( IFormatProvider^ provider ) + { + return Convert::ToSingle( CalcNLimitAverage( Single::MinValue, Single::MaxValue, provider ) ); + } + + virtual UInt16 ToUInt16( IFormatProvider^ provider ) + { + return Convert::ToUInt16( CalcNLimitAverage( UInt16::MinValue, UInt16::MaxValue, provider ) ); + } + + virtual UInt32 ToUInt32( IFormatProvider^ provider ) + { + return Convert::ToUInt32( CalcNLimitAverage( UInt32::MinValue, UInt32::MaxValue, provider ) ); + } + + virtual UInt64 ToUInt64( IFormatProvider^ provider ) + { + + // The Double conversion rounds UInt64.MaxValue to an invalid + // UInt64 value, so the following limit must be used. + return Convert::ToUInt64( CalcNLimitAverage( 0, 18446744073709550000.0, provider ) ); + } + + virtual Object^ ToType( Type^ conversionType, IFormatProvider^ provider ) + { + return Convert::ChangeType( Average( GetAverageInfo( provider )->TypeOfAverage ), conversionType ); + } + + virtual String^ ToString( IFormatProvider^ provider ) + { + AverageType avgType = GetAverageInfo( provider )->TypeOfAverage; + return String::Format( "( {0}: {1:G10} )", avgType, Average( avgType ) ); + } + +}; + + +// Display a DataSet with three different format providers. +void DisplayDataSet( DataSet^ ds ) +{ + IFormatProvider^ null = nullptr; + String^ fmt = "{0,-12}{1,20}{2,20}{3,20}"; + AverageInfo^ median = gcnew AverageInfo( AverageType::Median ); + AverageInfo^ geMean = gcnew AverageInfo( AverageType::GeometricMean ); + + // Display the dataset elements. + if ( ds->Count > 0 ) + { + Console::Write( "\nDataSet: [{0}", ds->Item[ 0 ] ); + for ( int iX = 1; iX < ds->Count; iX++ ) + Console::Write( ", {0}", ds->Item[ iX ] ); + Console::WriteLine( "]\n" ); + } + + Console::WriteLine( fmt, "Convert::", "Default", "Geometric Mean", "Median" ); + Console::WriteLine( fmt, "---------", "-------", "--------------", "------" ); + Console::WriteLine( fmt, "ToBoolean", Convert::ToBoolean( ds, null ), Convert::ToBoolean( ds, geMean ), Convert::ToBoolean( ds, median ) ); + Console::WriteLine( fmt, "ToByte", Convert::ToByte( ds, null ), Convert::ToByte( ds, geMean ), Convert::ToByte( ds, median ) ); + Console::WriteLine( fmt, "ToChar", Convert::ToChar( ds, null ), Convert::ToChar( ds, geMean ), Convert::ToChar( ds, median ) ); + Console::WriteLine( "{0,-12}{1,20:yyyy-MM-dd HH:mm:ss}" + "{2,20:yyyy-MM-dd HH:mm:ss}{3,20:yyyy-MM-dd HH:mm:ss}", "ToDateTime", Convert::ToDateTime( ds, null ), Convert::ToDateTime( ds, geMean ), Convert::ToDateTime( ds, median ) ); + Console::WriteLine( fmt, "ToDecimal", Convert::ToDecimal( ds, null ), Convert::ToDecimal( ds, geMean ), Convert::ToDecimal( ds, median ) ); + Console::WriteLine( fmt, "ToDouble", Convert::ToDouble( ds, null ), Convert::ToDouble( ds, geMean ), Convert::ToDouble( ds, median ) ); + Console::WriteLine( fmt, "ToInt16", Convert::ToInt16( ds, null ), Convert::ToInt16( ds, geMean ), Convert::ToInt16( ds, median ) ); + Console::WriteLine( fmt, "ToInt32", Convert::ToInt32( ds, null ), Convert::ToInt32( ds, geMean ), Convert::ToInt32( ds, median ) ); + Console::WriteLine( fmt, "ToInt64", Convert::ToInt64( ds, null ), Convert::ToInt64( ds, geMean ), Convert::ToInt64( ds, median ) ); + Console::WriteLine( fmt, "ToSByte", Convert::ToSByte( ds, null ), Convert::ToSByte( ds, geMean ), Convert::ToSByte( ds, median ) ); + Console::WriteLine( fmt, "ToSingle", Convert::ToSingle( ds, null ), Convert::ToSingle( ds, geMean ), Convert::ToSingle( ds, median ) ); + Console::WriteLine( fmt, "ToUInt16", Convert::ToUInt16( ds, null ), Convert::ToUInt16( ds, geMean ), Convert::ToUInt16( ds, median ) ); + Console::WriteLine( fmt, "ToUInt32", Convert::ToUInt32( ds, null ), Convert::ToUInt32( ds, geMean ), Convert::ToUInt32( ds, median ) ); + Console::WriteLine( fmt, "ToUInt64", Convert::ToUInt64( ds, null ), Convert::ToUInt64( ds, geMean ), Convert::ToUInt64( ds, median ) ); +} + +int main() +{ + Console::WriteLine( "This example of the " + "Convert::To( Object*, IFormatProvider* ) methods " + "\ngenerates the following output. The example " + "displays the values \nreturned by the methods, " + "using several IFormatProvider objects.\n" ); + + // To call a [ParamArray] method in C++, you cannot just + // list the parameters, you need to build an array. + array^dataElem = gcnew array(6); + dataElem[ 0 ] = 10.5; + dataElem[ 1 ] = 22.2; + dataElem[ 2 ] = 45.9; + dataElem[ 3 ] = 88.7; + dataElem[ 4 ] = 156.05; + dataElem[ 5 ] = 297.6; + DataSet^ ds1 = gcnew DataSet( dataElem ); + DisplayDataSet( ds1 ); + dataElem = gcnew array(5); + dataElem[ 0 ] = 359999.95; + dataElem[ 1 ] = 425000; + dataElem[ 2 ] = 499999.5; + dataElem[ 3 ] = 775000; + dataElem[ 4 ] = 1695000; + DataSet^ ds2 = gcnew DataSet( dataElem ); + DisplayDataSet( ds2 ); +} + +/* +This example of the Convert::To( Object*, IFormatProvider* ) methods +generates the following output. The example displays the values +returned by the methods, using several IFormatProvider objects. + +DataSet: [10.5, 22.2, 45.9, 88.7, 156.05, 297.6] + +Convert:: Default Geometric Mean Median +--------- ------- -------------- ------ +ToBoolean True True True +ToByte 103 59 67 +ToChar g ; C +ToDateTime 2003-05-13 15:30:23 2003-05-13 15:29:39 2003-05-13 15:29:47 +ToDecimal 103.491666666667 59.4332135445164 67.3 +ToDouble 103.491666666667 59.4332135445164 67.3 +ToInt16 103 59 67 +ToInt32 103 59 67 +ToInt64 103 59 67 +ToSByte 103 59 67 +ToSingle 103.4917 59.43321 67.3 +ToUInt16 103 59 67 +ToUInt32 103 59 67 +ToUInt64 103 59 67 + +DataSet: [359999.95, 425000, 499999.5, 775000, 1695000] + +Convert:: Default Geometric Mean Median +--------- ------- -------------- ------ +ToBoolean True True True +ToByte 255 255 255 +ToChar ? ? ? +ToDateTime 2003-05-22 08:05:19 2003-05-20 22:54:57 2003-05-19 10:21:59 +ToDecimal 750999.89 631577.237188435 499999.5 +ToDouble 750999.89 631577.237188435 499999.5 +ToInt16 32767 32767 32767 +ToInt32 751000 631577 500000 +ToInt64 751000 631577 500000 +ToSByte 127 127 127 +ToSingle 750999.9 631577.3 499999.5 +ToUInt16 65535 65535 65535 +ToUInt32 751000 631577 500000 +ToUInt64 751000 631577 500000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp new file mode 100644 index 00000000000..caf5fe1bc43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Date/cpp/date1.cpp @@ -0,0 +1,22 @@ +// +using namespace System; + +void main() +{ + DateTime^ date1 = gcnew DateTime(2008, 6, 1, 7, 47, 0); + Console::WriteLine(date1->ToString()); + + // Get date-only portion of date, without its time. + DateTime dateOnly = date1->Date; + // Display date using short date string. + Console::WriteLine(dateOnly.ToString("d")); + // Display date using 24-hour clock. + Console::WriteLine(dateOnly.ToString("g")); + Console::WriteLine(dateOnly.ToString(L"MM/dd/yyyy HH:mm")); +} +// The example displays the following output to the console: +// 6/1/2008 7:47:00 AM +// 6/1/2008 +// 6/1/2008 12:00 AM +// 06/01/2008 00:00 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp new file mode 100644 index 00000000000..1c991227a37 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.Minute etc/CPP/class1.cpp @@ -0,0 +1,31 @@ +using namespace System; + +int main() +{ + // + System::DateTime moment = System::DateTime( + 1999, 1, 13, 3, 57, 32, 11 ); + + // Year gets 1999. + int year = moment.Year; + + // Month gets 1 (January). + int month = moment.Month; + + // Day gets 13. + int day = moment.Day; + + // Hour gets 3. + int hour = moment.Hour; + + // Minute gets 57. + int minute = moment.Minute; + + // Second gets 32. + int second = moment.Second; + + // Millisecond gets 11. + int millisecond = moment.Millisecond; + + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp new file mode 100644 index 00000000000..26954f5c7f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.DateTime.TryParse/cpp/datetime.tryparse1.cpp @@ -0,0 +1,37 @@ +// DateTime.TryParse1.cpp : Defines the entry point for the console application. +// + +// +using namespace System; +using namespace System::Globalization; + +void main() +{ + array^ dateStrings = { "05/01/2009 14:57:32.8", "2009-05-01 14:57:32.8", + "2009-05-01T14:57:32.8375298-04:00", + "5/01/2008 14:57:32.80 -07:00", + "1 May 2008 2:57:32.8 PM", "16-05-2009 1:00:32 PM", + "Fri, 15 May 2009 20:10:57 GMT" }; + DateTime dateValue; + + Console::WriteLine("Attempting to parse strings using {0} culture.", + CultureInfo::CurrentCulture->Name); + for each (String^ dateString in dateStrings) + { + if (DateTime::TryParse(dateString, dateValue)) + Console::WriteLine(" Converted '{0}' to {1} ({2}).", dateString, + dateValue, dateValue.Kind); + else + Console::WriteLine(" Unable to parse '{0}'.", dateString); + } +} +// The example displays the following output: +// Attempting to parse strings using en-US culture. +// Converted '05/01/2009 14:57:32.8' to 5/1/2009 2:57:32 PM (Unspecified). +// Converted '2009-05-01 14:57:32.8' to 5/1/2009 2:57:32 PM (Unspecified). +// Converted '2009-05-01T14:57:32.8375298-04:00' to 5/1/2009 11:57:32 AM (Local). +// Converted '5/01/2008 14:57:32.80 -07:00' to 5/1/2008 2:57:32 PM (Local). +// Converted '1 May 2008 2:57:32.8 PM' to 5/1/2008 2:57:32 PM (Unspecified). +// Unable to parse '16-05-2009 1:00:32 PM'. +// Converted 'Fri, 15 May 2009 20:10:57 GMT' to 5/15/2009 1:10:57 PM (Local). +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp new file mode 100644 index 00000000000..224dd1602e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/comp_equal.cpp @@ -0,0 +1,65 @@ + +// +// Example of the Decimal::Compare and static Decimal::Equals methods. +using namespace System; +const __wchar_t * protoFmt = L"{0,-45}{1}"; + +// Compare Decimal parameters, and display them with the results. +void CompareDecimals( Decimal Left, Decimal Right, String^ RightText ) +{ + String^ dataFmt = gcnew String( protoFmt ); + Console::WriteLine(); + Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); + Console::WriteLine( dataFmt, "Decimal::Equals( Left, Right )", Decimal::Equals( Left, Right ) ); + Console::WriteLine( dataFmt, "Decimal::Compare( Left, Right )", Decimal::Compare( Left, Right ) ); +} + +int main() +{ + Console::WriteLine( "This example of the Decimal::Equals( Decimal, Decimal " + ") and \nDecimal::Compare( Decimal, Decimal ) " + "methods generates the \nfollowing output. It creates " + "several different Decimal \nvalues and compares them " + "with the following reference value.\n" ); + + // Create a reference Decimal value. + Decimal Left = Decimal(123.456); + Console::WriteLine( gcnew String( protoFmt ), "Left: Decimal( 123.456 )", Left ); + + // Create Decimal values to compare with the reference. + CompareDecimals( Left, Decimal(1.2345600E+2), "Decimal( 1.2345600E+2 )" ); + CompareDecimals( Left, Decimal::Parse( "123.4561" ), "Decimal::Parse( \"123.4561\" )" ); + CompareDecimals( Left, Decimal::Parse( "123.4559" ), "Decimal::Parse( \"123.4559\" )" ); + CompareDecimals( Left, Decimal::Parse( "123.456000" ), "Decimal::Parse( \"123.456000\" )" ); + CompareDecimals( Left, Decimal(123456000,0,0,false,6), "Decimal( 123456000, 0, 0, false, 6 )" ); +} + +/* +This example of the Decimal::Equals( Decimal, Decimal ) and +Decimal::Compare( Decimal, Decimal ) methods generates the +following output. It creates several different Decimal +values and compares them with the following reference value. + +Left: Decimal( 123.456 ) 123.456 + +Right: Decimal( 1.2345600E+2 ) 123.456 +Decimal::Equals( Left, Right ) True +Decimal::Compare( Left, Right ) 0 + +Right: Decimal::Parse( "123.4561" ) 123.4561 +Decimal::Equals( Left, Right ) False +Decimal::Compare( Left, Right ) -1 + +Right: Decimal::Parse( "123.4559" ) 123.4559 +Decimal::Equals( Left, Right ) False +Decimal::Compare( Left, Right ) 1 + +Right: Decimal::Parse( "123.456000" ) 123.456000 +Decimal::Equals( Left, Right ) True +Decimal::Compare( Left, Right ) 0 + +Right: Decimal( 123456000, 0, 0, false, 6 ) 123.456000 +Decimal::Equals( Left, Right ) True +Decimal::Compare( Left, Right ) 0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp new file mode 100644 index 00000000000..e155f61c420 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Compare_Equals/CPP/cto_eq_obj.cpp @@ -0,0 +1,88 @@ + +// +// Example of the Decimal::CompareTo and Decimal::Equals instance +// methods. +using namespace System; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Compare the Decimal to the Object parameters, +// and display the Object parameters with the results. +void CompDecimalToObject( Decimal Left, Object^ Right, String^ RightText ) +{ + Console::WriteLine( "{0,-46}{1}", String::Concat( "Object: ", RightText ), Right ); + Console::WriteLine( "{0,-46}{1}", "Left.Equals( Object )", Left.Equals( Right ) ); + Console::Write( "{0,-46}", "Left.CompareTo( Object )" ); + try + { + + // Catch the exception if CompareTo( ) throws one. + Console::WriteLine( "{0}\n", Left.CompareTo( Right ) ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "{0}\n", GetExceptionType( ex ) ); + } + +} + +int main() +{ + Console::WriteLine( "This example of the Decimal::Equals( Object* ) and \n" + "Decimal::CompareTo( Object* ) methods generates the \n" + "following output. It creates several different " + "Decimal \nvalues and compares them with the following " + "reference value.\n" ); + + // Create a reference Decimal value. + Decimal Left = Decimal(987.654); + Console::WriteLine( "{0,-46}{1}\n", "Left: Decimal( 987.654 )", Left ); + + // Create objects to compare with the reference. + CompDecimalToObject( Left, Decimal(9.8765400E+2), "Decimal( 9.8765400E+2 )" ); + CompDecimalToObject( Left, Decimal::Parse( "987.6541" ), "Decimal::Parse( \"987.6541\" )" ); + CompDecimalToObject( Left, Decimal::Parse( "987.6539" ), "Decimal::Parse( \"987.6539\" )" ); + CompDecimalToObject( Left, Decimal(987654000,0,0,false,6), "Decimal( 987654000, 0, 0, false, 6 )" ); + CompDecimalToObject( Left, 9.8765400E+2, "Double 9.8765400E+2" ); + CompDecimalToObject( Left, "987.654", "String \"987.654\"" ); +} + +/* +This example of the Decimal::Equals( Object* ) and +Decimal::CompareTo( Object* ) methods generates the +following output. It creates several different Decimal +values and compares them with the following reference value. + +Left: Decimal( 987.654 ) 987.654 + +Object: Decimal( 9.8765400E+2 ) 987.654 +Left.Equals( Object ) True +Left.CompareTo( Object ) 0 + +Object: Decimal::Parse( "987.6541" ) 987.6541 +Left.Equals( Object ) False +Left.CompareTo( Object ) -1 + +Object: Decimal::Parse( "987.6539" ) 987.6539 +Left.Equals( Object ) False +Left.CompareTo( Object ) 1 + +Object: Decimal( 987654000, 0, 0, false, 6 ) 987.654000 +Left.Equals( Object ) True +Left.CompareTo( Object ) 0 + +Object: Double 9.8765400E+2 987.654 +Left.Equals( Object ) False +Left.CompareTo( Object ) ArgumentException + +Object: String "987.654" 987.654 +Left.Equals( Object ) False +Left.CompareTo( Object ) ArgumentException +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp new file mode 100644 index 00000000000..52935e71178 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriarr.cpp @@ -0,0 +1,117 @@ + +// +// Example of the Decimal( int __gc [ ] ) constructor. +using namespace System; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Create a Decimal object and display its value. +void CreateDecimal( array^bits ) +{ + + // Format the constructor for display. + String^ ctor = String::Format( "Decimal( {{ 0x{0:X}", bits[ 0 ] ); + String^ valOrExc; + for ( int index = 1; index < bits->Length; index++ ) + ctor = String::Concat( ctor, String::Format( ", 0x{0:X}", bits[ index ] ) ); + ctor = String::Concat( ctor, " } )" ); + try + { + + // Construct the Decimal value. + Decimal decimalNum = Decimal(bits); + + // Format the Decimal value for display. + valOrExc = decimalNum.ToString(); + } + catch ( Exception^ ex ) + { + + // Save the exception type if an exception was thrown. + valOrExc = GetExceptionType( ex ); + } + + + // Display the constructor and Decimal value or exception. + int ctorLen = 76 - valOrExc->Length; + + // Display the data on one line if it will fit. + if ( ctorLen > ctor->Length ) + Console::WriteLine( "{0}{1}", ctor->PadRight( ctorLen ), valOrExc ); + // Otherwise, display the data on two lines. + else + { + Console::WriteLine( "{0}", ctor ); + Console::WriteLine( "{0,76}", valOrExc ); + } +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( int __gc [ ] ) " + "constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-38}{1,38}", "Constructor", "Value or Exception" ); + Console::WriteLine( "{0,-38}{1,38}", "-----------", "------------------" ); + + // Construct Decimal objects from integer arrays. + array^zero = {0,0,0,0}; + CreateDecimal( zero ); + array^arrayShort = {0,0,0}; + CreateDecimal( arrayShort ); + array^arrayLong = {0,0,0,0,0}; + CreateDecimal( arrayLong ); + array^word0Data = {1000000000,0,0,0}; + CreateDecimal( word0Data ); + array^word1Data = {0,1000000000,0,0}; + CreateDecimal( word1Data ); + array^word2Data = {0,0,1000000000,0}; + CreateDecimal( word2Data ); + array^word3Data = {0,0,0,1000000000}; + CreateDecimal( word3Data ); + array^decMax = { -1,-1,-1,0}; + CreateDecimal( decMax ); + array^decMin = { -1,-1,-1,0x80000000}; + CreateDecimal( decMin ); + array^fracDig16 = { -1,0,0,0x100000}; + CreateDecimal( fracDig16 ); + array^fracDig28 = { -1,0,0,0x1C0000}; + CreateDecimal( fracDig28 ); + array^fracDig29 = { -1,0,0,0x1D0000}; + CreateDecimal( fracDig29 ); + array^reserved = { -1,0,0,0x1C0001}; + CreateDecimal( reserved ); + array^Same4Words = {0xF0000,0xF0000,0xF0000,0xF0000}; + CreateDecimal( Same4Words ); +} + +/* +This example of the Decimal( int __gc [ ] ) constructor +generates the following output. + +Constructor Value or Exception +----------- ------------------ +Decimal( { 0x0, 0x0, 0x0, 0x0 } ) 0 +Decimal( { 0x0, 0x0, 0x0 } ) ArgumentException +Decimal( { 0x0, 0x0, 0x0, 0x0, 0x0 } ) ArgumentException +Decimal( { 0x3B9ACA00, 0x0, 0x0, 0x0 } ) 1000000000 +Decimal( { 0x0, 0x3B9ACA00, 0x0, 0x0 } ) 4294967296000000000 +Decimal( { 0x0, 0x0, 0x3B9ACA00, 0x0 } ) 18446744073709551616000000000 +Decimal( { 0x0, 0x0, 0x0, 0x3B9ACA00 } ) ArgumentException +Decimal( { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x0 } ) + 79228162514264337593543950335 +Decimal( { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x80000000 } ) + -79228162514264337593543950335 +Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x100000 } ) 0.0000004294967295 +Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1C0000 } ) 0.0000000000000000004294967295 +Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1D0000 } ) ArgumentException +Decimal( { 0xFFFFFFFF, 0x0, 0x0, 0x1C0001 } ) ArgumentException +Decimal( { 0xF0000, 0xF0000, 0xF0000, 0xF0000 } ) + 18133887298.441562272235520 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp new file mode 100644 index 00000000000..c0aef542fb3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Arrays/CPP/ctoriiibby.cpp @@ -0,0 +1,108 @@ + +// +// Example of the Decimal( int, int, int, bool, unsigned char ) +// constructor. +using namespace System; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Create a Decimal object and display its value. +void CreateDecimal( int low, int mid, int high, bool isNeg, unsigned char scale ) +{ + + // Format the constructor for display. + array^boxedParams = gcnew array(5); + boxedParams[ 0 ] = low; + boxedParams[ 1 ] = mid; + boxedParams[ 2 ] = high; + boxedParams[ 3 ] = isNeg; + boxedParams[ 4 ] = scale; + String^ ctor = String::Format( "Decimal( {0}, {1}, {2}, {3}, {4} )", boxedParams ); + String^ valOrExc; + try + { + + // Construct the Decimal value. + Decimal decimalNum = Decimal(low,mid,high,isNeg,scale); + + // Format and save the Decimal value. + valOrExc = decimalNum.ToString(); + } + catch ( Exception^ ex ) + { + + // Save the exception type if an exception was thrown. + valOrExc = GetExceptionType( ex ); + } + + + // Display the constructor and Decimal value or exception. + int ctorLen = 76 - valOrExc->Length; + + // Display the data on one line if it will fit. + if ( ctorLen > ctor->Length ) + Console::WriteLine( "{0}{1}", ctor->PadRight( ctorLen ), valOrExc ); + // Otherwise, display the data on two lines. + else + { + Console::WriteLine( "{0}", ctor ); + Console::WriteLine( "{0,76}", valOrExc ); + } +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( int, int, " + "int, bool, unsigned char ) \nconstructor " + "generates the following output.\n" ); + Console::WriteLine( "{0,-38}{1,38}", "Constructor", "Value or Exception" ); + Console::WriteLine( "{0,-38}{1,38}", "-----------", "------------------" ); + + // Construct Decimal objects from double values. + CreateDecimal( 0, 0, 0, false, 0 ); + CreateDecimal( 0, 0, 0, false, 27 ); + CreateDecimal( 0, 0, 0, true, 0 ); + CreateDecimal( 1000000000, 0, 0, false, 0 ); + CreateDecimal( 0, 1000000000, 0, false, 0 ); + CreateDecimal( 0, 0, 1000000000, false, 0 ); + CreateDecimal( 1000000000, 1000000000, 1000000000, false, 0 ); + CreateDecimal( -1, -1, -1, false, 0 ); + CreateDecimal( -1, -1, -1, true, 0 ); + CreateDecimal( -1, -1, -1, false, 15 ); + CreateDecimal( -1, -1, -1, false, 28 ); + CreateDecimal( -1, -1, -1, false, 29 ); + CreateDecimal( Int32::MaxValue, 0, 0, false, 18 ); + CreateDecimal( Int32::MaxValue, 0, 0, false, 28 ); + CreateDecimal( Int32::MaxValue, 0, 0, true, 28 ); +} + +/* +This example of the Decimal( int, int, int, bool, unsigned char ) +constructor generates the following output. + +Constructor Value or Exception +----------- ------------------ +Decimal( 0, 0, 0, False, 0 ) 0 +Decimal( 0, 0, 0, False, 27 ) 0 +Decimal( 0, 0, 0, True, 0 ) 0 +Decimal( 1000000000, 0, 0, False, 0 ) 1000000000 +Decimal( 0, 1000000000, 0, False, 0 ) 4294967296000000000 +Decimal( 0, 0, 1000000000, False, 0 ) 18446744073709551616000000000 +Decimal( 1000000000, 1000000000, 1000000000, False, 0 ) + 18446744078004518913000000000 +Decimal( -1, -1, -1, False, 0 ) 79228162514264337593543950335 +Decimal( -1, -1, -1, True, 0 ) -79228162514264337593543950335 +Decimal( -1, -1, -1, False, 15 ) 79228162514264.337593543950335 +Decimal( -1, -1, -1, False, 28 ) 7.9228162514264337593543950335 +Decimal( -1, -1, -1, False, 29 ) ArgumentOutOfRangeException +Decimal( 2147483647, 0, 0, False, 18 ) 0.000000002147483647 +Decimal( 2147483647, 0, 0, False, 28 ) 0.0000000000000000002147483647 +Decimal( 2147483647, 0, 0, True, 28 ) -0.0000000000000000002147483647 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp new file mode 100644 index 00000000000..ecdc7081878 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctori.cpp @@ -0,0 +1,47 @@ + +// +// Example of the Decimal( int ) constructor. +using namespace System; + +// Create a Decimal object and display its value. +void CreateDecimal( int value, String^ valToStr ) +{ + Decimal decimalNum = Decimal(value); + + // Format the constructor for display. + String^ ctor = String::Format( "Decimal( {0} )", valToStr ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-30}{1,16}", ctor, decimalNum ); +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( int ) " + "constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-30}{1,16}", "Constructor", "Value" ); + Console::WriteLine( "{0,-30}{1,16}", "-----------", "-----" ); + + // Construct Decimal objects from int values. + CreateDecimal( Int32::MinValue, "Int32::MinValue" ); + CreateDecimal( Int32::MaxValue, "Int32::MaxValue" ); + CreateDecimal( 0, "0" ); + CreateDecimal( 999999999, "999999999" ); + CreateDecimal( 0x40000000, "0x40000000" ); + CreateDecimal( (int)0xC0000000, "(int)0xC0000000" ); +} + +/* +This example of the Decimal( int ) constructor +generates the following output. + +Constructor Value +----------- ----- +Decimal( Int32::MinValue ) -2147483648 +Decimal( Int32::MaxValue ) 2147483647 +Decimal( 0 ) 0 +Decimal( 999999999 ) 999999999 +Decimal( 0x40000000 ) 1073741824 +Decimal( (int)0xC0000000 ) -1073741824 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp new file mode 100644 index 00000000000..1e66c122bf6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorl.cpp @@ -0,0 +1,47 @@ + +// +// Example of the Decimal( __int64 ) constructor. +using namespace System; + +// Create a Decimal object and display its value. +void CreateDecimal( __int64 value, String^ valToStr ) +{ + Decimal decimalNum = Decimal(value); + + // Format the constructor for display. + String^ ctor = String::Format( "Decimal( {0} )", valToStr ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-35}{1,22}", ctor, decimalNum ); +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( __int64 ) " + "constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-35}{1,22}", "Constructor", "Value" ); + Console::WriteLine( "{0,-35}{1,22}", "-----------", "-----" ); + + // Construct Decimal objects from __int64 values. + CreateDecimal( Int64::MinValue, "Int64::MinValue" ); + CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); + CreateDecimal( 0, "0" ); + CreateDecimal( 999999999999999999, "999999999999999999" ); + CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); + CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); +} + +/* +This example of the Decimal( __int64 ) constructor +generates the following output. + +Constructor Value +----------- ----- +Decimal( Int64::MinValue ) -9223372036854775808 +Decimal( Int64::MaxValue ) 9223372036854775807 +Decimal( 0 ) 0 +Decimal( 999999999999999999 ) 999999999999999999 +Decimal( 0x2000000000000000 ) 2305843009213693952 +Decimal( 0xE000000000000000 ) -2305843009213693952 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp new file mode 100644 index 00000000000..4882d3004fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorui.cpp @@ -0,0 +1,47 @@ + +// +// Example of the Decimal( unsigned int ) constructor. +using namespace System; + +// Create a Decimal object and display its value. +void CreateDecimal( unsigned int value, String^ valToStr ) +{ + Decimal decimalNum = Decimal(value); + + // Format the constructor for display. + String^ ctor = String::Format( "Decimal( {0} )", valToStr ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-30}{1,16}", ctor, decimalNum ); +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( unsigned " + "int ) constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-30}{1,16}", "Constructor", "Value" ); + Console::WriteLine( "{0,-30}{1,16}", "-----------", "-----" ); + + // Construct Decimal objects from unsigned int values. + CreateDecimal( UInt32::MinValue, "UInt32::MinValue" ); + CreateDecimal( UInt32::MaxValue, "UInt32::MaxValue" ); + CreateDecimal( Int32::MaxValue, "Int32::MaxValue" ); + CreateDecimal( 999999999, "999999999" ); + CreateDecimal( 0x40000000, "0x40000000" ); + CreateDecimal( 0xC0000000, "0xC0000000" ); +} + +/* +This example of the Decimal( unsigned int ) constructor +generates the following output. + +Constructor Value +----------- ----- +Decimal( UInt32::MinValue ) 0 +Decimal( UInt32::MaxValue ) 4294967295 +Decimal( Int32::MaxValue ) 2147483647 +Decimal( 999999999 ) 999999999 +Decimal( 0x40000000 ) 1073741824 +Decimal( 0xC0000000 ) 3221225472 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp new file mode 100644 index 00000000000..d09060bdbb9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Ints/CPP/ctorul.cpp @@ -0,0 +1,47 @@ + +// +// Example of the Decimal( unsigned __int64 ) constructor. +using namespace System; + +// Create a Decimal object and display its value. +void CreateDecimal( unsigned __int64 value, String^ valToStr ) +{ + Decimal decimalNum = Decimal(value); + + // Format the constructor for display. + String^ ctor = String::Format( "Decimal( {0} )", valToStr ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-33}{1,22}", ctor, decimalNum ); +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( unsigned " + "__int64 ) constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-33}{1,22}", "Constructor", "Value" ); + Console::WriteLine( "{0,-33}{1,22}", "-----------", "-----" ); + + // Construct Decimal objects from unsigned __int64 values. + CreateDecimal( UInt64::MinValue, "UInt64::MinValue" ); + CreateDecimal( UInt64::MaxValue, "UInt64::MaxValue" ); + CreateDecimal( Int64::MaxValue, "Int64::MaxValue" ); + CreateDecimal( 999999999999999999, "999999999999999999" ); + CreateDecimal( 0x2000000000000000, "0x2000000000000000" ); + CreateDecimal( 0xE000000000000000, "0xE000000000000000" ); +} + +/* +This example of the Decimal( unsigned __int64 ) constructor +generates the following output. + +Constructor Value +----------- ----- +Decimal( UInt64::MinValue ) 0 +Decimal( UInt64::MaxValue ) 18446744073709551615 +Decimal( Int64::MaxValue ) 9223372036854775807 +Decimal( 999999999999999999 ) 999999999999999999 +Decimal( 0x2000000000000000 ) 2305843009213693952 +Decimal( 0xE000000000000000 ) 16140901064495857664 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp new file mode 100644 index 00000000000..3ffa533351d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctordo.cpp @@ -0,0 +1,73 @@ + +// +// Example of the Decimal( double ) constructor. +using namespace System; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Create a Decimal object and display its value. +void CreateDecimal( double value, String^ valToStr ) +{ + + // Format and display the constructor. + Console::Write( "{0,-34}", String::Format( "Decimal( {0} )", valToStr ) ); + try + { + + // Construct the Decimal value. + Decimal decimalNum = Decimal(value); + + // Display the value if it was created successfully. + Console::WriteLine( "{0,31}", decimalNum ); + } + catch ( Exception^ ex ) + { + + // Display the exception type if an exception was thrown. + Console::WriteLine( "{0,31}", GetExceptionType( ex ) ); + } + +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( double ) " + "constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-34}{1,31}", "Constructor", "Value or Exception" ); + Console::WriteLine( "{0,-34}{1,31}", "-----------", "------------------" ); + + // Construct Decimal objects from double values. + CreateDecimal( 1.23456789E+5, "1.23456789E+5" ); + CreateDecimal( 1.234567890123E+15, "1.234567890123E+15" ); + CreateDecimal( 1.2345678901234567E+25, "1.2345678901234567E+25" ); + CreateDecimal( 1.2345678901234567E+35, "1.2345678901234567E+35" ); + CreateDecimal( 1.23456789E-5, "1.23456789E-5" ); + CreateDecimal( 1.234567890123E-15, "1.234567890123E-15" ); + CreateDecimal( 1.2345678901234567E-25, "1.2345678901234567E-25" ); + CreateDecimal( 1.2345678901234567E-35, "1.2345678901234567E-35" ); + CreateDecimal( 1.0 / 7.0, "1.0 / 7.0" ); +} + +/* +This example of the Decimal( double ) constructor +generates the following output. + +Constructor Value or Exception +----------- ------------------ +Decimal( 1.23456789E+5 ) 123456.789 +Decimal( 1.234567890123E+15 ) 1234567890123000 +Decimal( 1.2345678901234567E+25 ) 12345678901234600000000000 +Decimal( 1.2345678901234567E+35 ) OverflowException +Decimal( 1.23456789E-5 ) 0.0000123456789 +Decimal( 1.234567890123E-15 ) 0.000000000000001234567890123 +Decimal( 1.2345678901234567E-25 ) 0.0000000000000000000000001235 +Decimal( 1.2345678901234567E-35 ) 0 +Decimal( 1.0 / 7.0 ) 0.142857142857143 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp new file mode 100644 index 00000000000..f2052b72799 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Ctor.Reals/CPP/ctors.cpp @@ -0,0 +1,73 @@ + +// +// Example of the Decimal( float ) constructor. +using namespace System; + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Create a Decimal object and display its value. +void CreateDecimal( float value, String^ valToStr ) +{ + + // Format and display the constructor. + Console::Write( "{0,-27}", String::Format( "Decimal( {0} )", valToStr ) ); + try + { + + // Construct the Decimal value. + Decimal decimalNum = Decimal(value); + + // Display the value if it was created successfully. + Console::WriteLine( "{0,31}", decimalNum ); + } + catch ( Exception^ ex ) + { + + // Display the exception type if an exception was thrown. + Console::WriteLine( "{0,31}", GetExceptionType( ex ) ); + } + +} + +int main() +{ + Console::WriteLine( "This example of the Decimal( float ) " + "constructor \ngenerates the following output.\n" ); + Console::WriteLine( "{0,-27}{1,31}", "Constructor", "Value or Exception" ); + Console::WriteLine( "{0,-27}{1,31}", "-----------", "------------------" ); + + // Construct Decimal objects from float values. + CreateDecimal( 1.2345E+5, "1.2345E+5" ); + CreateDecimal( 1.234567E+15, "1.234567E+15" ); + CreateDecimal( 1.23456789E+25, "1.23456789E+25" ); + CreateDecimal( 1.23456789E+35, "1.23456789E+35" ); + CreateDecimal( 1.2345E-5, "1.2345E-5" ); + CreateDecimal( 1.234567E-15, "1.234567E-15" ); + CreateDecimal( 1.23456789E-25, "1.23456789E-25" ); + CreateDecimal( 1.23456789E-35, "1.23456789E-35" ); + CreateDecimal( 1.0 / 7.0, "1.0 / 7.0" ); +} + +/* +This example of the Decimal( float ) constructor +generates the following output. + +Constructor Value or Exception +----------- ------------------ +Decimal( 1.2345E+5 ) 123450 +Decimal( 1.234567E+15 ) 1234567000000000 +Decimal( 1.23456789E+25 ) 12345680000000000000000000 +Decimal( 1.23456789E+35 ) OverflowException +Decimal( 1.2345E-5 ) 0.000012345 +Decimal( 1.234567E-15 ) 0.000000000000001234567 +Decimal( 1.23456789E-25 ) 0.0000000000000000000000001235 +Decimal( 1.23456789E-35 ) 0 +Decimal( 1.0 / 7.0 ) 0.1428571 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp new file mode 100644 index 00000000000..7f0743a1a5e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Fields/CPP/fields.cpp @@ -0,0 +1,46 @@ + +// +// Example of the Decimal fields. +using namespace System; +int main() +{ + String^ numberFmt = "{0,-25}{1,45:N0}"; + String^ exprFmt = "{0,-55}{1,15}"; + Console::WriteLine( "This example of the fields of the Decimal structure " + "\ngenerates the following output.\n" ); + Console::WriteLine( numberFmt, "Field or Expression", "Value" ); + Console::WriteLine( numberFmt, "-------------------", "-----" ); + + // Display the values of the Decimal fields. + Console::WriteLine( numberFmt, "Decimal::MaxValue", Decimal::MaxValue ); + Console::WriteLine( numberFmt, "Decimal::MinValue", Decimal::MinValue ); + Console::WriteLine( numberFmt, "Decimal::MinusOne", Decimal::MinusOne ); + Console::WriteLine( numberFmt, "Decimal::One", Decimal::One ); + Console::WriteLine( numberFmt, "Decimal::Zero", Decimal::Zero ); + Console::WriteLine(); + + // Display the values of expressions of the Decimal fields. + Console::WriteLine( exprFmt, "( Decimal::MinusOne + Decimal::One ) == Decimal::Zero", (Decimal::MinusOne + Decimal::One) == Decimal::Zero ); + Console::WriteLine( exprFmt, "Decimal::MaxValue + Decimal::MinValue", Decimal::MaxValue + Decimal::MinValue ); + Console::WriteLine( exprFmt, "Decimal::MinValue / Decimal::MaxValue", Decimal::MinValue / Decimal::MaxValue ); + Console::WriteLine( "{0,-40}{1,30}", "100000000000000M / Decimal::MaxValue", Convert::ToDecimal( 100000000000000 ) / Decimal::MaxValue ); +} + +/* +This example of the fields of the Decimal structure +generates the following output. + +Field or Expression Value +------------------- ----- +Decimal::MaxValue 79,228,162,514,264,337,593,543,950,335 +Decimal::MinValue -79,228,162,514,264,337,593,543,950,335 +Decimal::MinusOne -1 +Decimal::One 1 +Decimal::Zero 0 + +( Decimal::MinusOne + Decimal::One ) == Decimal::Zero True +Decimal::MaxValue + Decimal::MinValue 0 +Decimal::MinValue / Decimal::MaxValue -1 +100000000000000M / Decimal::MaxValue 0.0000000000000012621774483536 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp new file mode 100644 index 00000000000..5ec1281cf67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Flr_Neg_Rnd_Trnc/CPP/floor_neg_trunc.cpp @@ -0,0 +1,66 @@ + +// +// Example of the Decimal::Negate, Decimal::Floor, and +// Decimal::Truncate methods. +using namespace System; + +// Display Decimal parameters and the method results. +void ShowDecimalFloorNegTrunc( Decimal Argument ) +{ + String^ dataFmt = "{0,-30}{1,26}"; + Console::WriteLine(); + Console::WriteLine( dataFmt, "Decimal Argument", Argument ); + Console::WriteLine( dataFmt, "Decimal::Negate( Argument )", Decimal::Negate( Argument ) ); + Console::WriteLine( dataFmt, "Decimal::Floor( Argument )", Decimal::Floor( Argument ) ); + Console::WriteLine( dataFmt, "Decimal::Truncate( Argument )", Decimal::Truncate( Argument ) ); +} + +int main() +{ + Console::WriteLine( "This example of the \n" + " Decimal::Negate( Decimal ), \n" + " Decimal::Floor( Decimal ), and \n" + " Decimal::Truncate( Decimal ) \n" + "methods generates the following output." ); + + // Create pairs of Decimal objects. + ShowDecimalFloorNegTrunc( Decimal::Parse( "0" ) ); + ShowDecimalFloorNegTrunc( Decimal::Parse( "123.456" ) ); + ShowDecimalFloorNegTrunc( Decimal::Parse( "-123.456" ) ); + ShowDecimalFloorNegTrunc( Decimal(1230000000,0,0,true,7) ); + ShowDecimalFloorNegTrunc( Decimal::Parse( "-9999999999.9999999999" ) ); +} + +/* +This example of the + Decimal::Negate( Decimal ), + Decimal::Floor( Decimal ), and + Decimal::Truncate( Decimal ) +methods generates the following output. + +Decimal Argument 0 +Decimal::Negate( Argument ) 0 +Decimal::Floor( Argument ) 0 +Decimal::Truncate( Argument ) 0 + +Decimal Argument 123.456 +Decimal::Negate( Argument ) -123.456 +Decimal::Floor( Argument ) 123 +Decimal::Truncate( Argument ) 123 + +Decimal Argument -123.456 +Decimal::Negate( Argument ) 123.456 +Decimal::Floor( Argument ) -124 +Decimal::Truncate( Argument ) -123 + +Decimal Argument -123.0000000 +Decimal::Negate( Argument ) 123.0000000 +Decimal::Floor( Argument ) -123 +Decimal::Truncate( Argument ) -123 + +Decimal Argument -9999999999.9999999999 +Decimal::Negate( Argument ) 9999999999.9999999999 +Decimal::Floor( Argument ) -10000000000 +Decimal::Truncate( Argument ) -9999999999 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp new file mode 100644 index 00000000000..ac862b815f9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/getbits.cpp @@ -0,0 +1,56 @@ +// +using namespace System; + +int main() +{ + // Define an array of Decimal values. + array^ values = gcnew array { Decimal::One, + Decimal::Parse("100000000000000"), + Decimal::Parse("10000000000000000000000000000"), + Decimal::Parse("100000000000000.00000000000000"), + Decimal::Parse("1.0000000000000000000000000000"), + Decimal::Parse("123456789"), + Decimal::Parse("0.123456789"), + Decimal::Parse("0.000000000123456789"), + Decimal::Parse("0.000000000000000000123456789"), + Decimal::Parse("4294967295.0"), + Decimal::Parse("18446744073709551615.0"), + Decimal::MaxValue, Decimal::MinValue, + Decimal::Parse("-7.9228162514264337593543950335") }; + + Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", + "Argument", "Bits[3]", "Bits[2]", "Bits[1]", "Bits[0]" ); + Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", + "--------", "-------", "-------", "-------", "-------" ); + + for each (Decimal value in values) + { + array^ bits = Decimal::GetBits(value); + Console::WriteLine("{0,31} {1,10:X8}{2,10:X8}{3,10:X8}{4,10:X8}", + value, bits[3], bits[2], bits[1], bits[0] ); + } +} + +/* +This example of the Decimal::GetBits( Decimal ) method +generates the following output. It displays the argument +as a Decimal and the result array in hexadecimal. + + Argument Bits[3] Bits[2] Bits[1] Bits[0] + -------- ------- ------- ------- ------- + 1 00000000 00000000 00000000 00000001 + 100000000000000 00000000 00000000 00005AF3 107A4000 + 10000000000000000000000000000 00000000 204FCE5E 3E250261 10000000 + 100000000000000.00000000000000 000E0000 204FCE5E 3E250261 10000000 + 1.0000000000000000000000000000 001C0000 204FCE5E 3E250261 10000000 + 123456789 00000000 00000000 00000000 075BCD15 + 0.123456789 00090000 00000000 00000000 075BCD15 + 0.000000000123456789 00120000 00000000 00000000 075BCD15 + 0.000000000000000000123456789 001B0000 00000000 00000000 075BCD15 + 4294967295 00000000 00000000 00000000 FFFFFFFF + 18446744073709551615 00000000 00000000 FFFFFFFF FFFFFFFF + 79228162514264337593543950335 00000000 FFFFFFFF FFFFFFFF FFFFFFFF + -79228162514264337593543950335 80000000 FFFFFFFF FFFFFFFF FFFFFFFF +-7.9228162514264337593543950335 801C0000 FFFFFFFF FFFFFFFF FFFFFFFF +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp new file mode 100644 index 00000000000..f99684b6727 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Get_Bits_Hash_Type/CPP/gettypecode.cpp @@ -0,0 +1,25 @@ + +// +// Example of the Decimal::GetTypeCode method. +using namespace System; +int main() +{ + Console::WriteLine( "This example of the " + "Decimal::GetTypeCode( ) \nmethod " + "generates the following output.\n" ); + + // Create a Decimal object and get its type code. + Decimal aDecimal = Decimal(1.0); + TypeCode typCode = aDecimal.GetTypeCode(); + Console::WriteLine( "Type Code: \"{0}\"", typCode ); + Console::WriteLine( "Numeric value: {0}", (int)typCode ); +} + +/* +This example of the Decimal::GetTypeCode( ) +method generates the following output. + +Type Code: "Decimal" +Numeric value: 15 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp new file mode 100644 index 00000000000..ec780d29082 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.Mul_Div_Rem/CPP/mul_div_rem.cpp @@ -0,0 +1,76 @@ + +// +// Example of the Decimal::Multiply, Decimal::Divide, and +// Decimal::Remainder methods. +using namespace System; + +// Display Decimal parameters and their product, quotient, and +// remainder. +void ShowDecimalProQuoRem( Decimal Left, Decimal Right ) +{ + String^ dataFmt = "{0,-35}{1,31}"; + Console::WriteLine(); + Console::WriteLine( dataFmt, "Decimal Left", Left ); + Console::WriteLine( dataFmt, "Decimal Right", Right ); + Console::WriteLine( dataFmt, "Decimal::Multiply( Left, Right )", Decimal::Multiply( Left, Right ) ); + Console::WriteLine( dataFmt, "Decimal::Divide( Left, Right )", Decimal::Divide( Left, Right ) ); + Console::WriteLine( dataFmt, "Decimal::Remainder( Left, Right )", Decimal::Remainder( Left, Right ) ); +} + +int main() +{ + Console::WriteLine( "This example of the \n" + " Decimal::Multiply( Decimal, Decimal ), \n" + " Decimal::Divide( Decimal, Decimal ), and \n" + " Decimal::Remainder( Decimal, Decimal ) \n" + "methods generates the following output. It displays " + "the product, \nquotient, and remainder of several " + "pairs of Decimal objects." ); + + // Create pairs of Decimal objects. + ShowDecimalProQuoRem( Decimal::Parse( "1000" ), Decimal::Parse( "7" ) ); + ShowDecimalProQuoRem( Decimal::Parse( "-1000" ), Decimal::Parse( "7" ) ); + ShowDecimalProQuoRem( Decimal(1230000000,0,0,false,7), Decimal::Parse( "0.0012300" ) ); + ShowDecimalProQuoRem( Decimal::Parse( "12345678900000000" ), Decimal::Parse( "0.0000000012345678" ) ); + ShowDecimalProQuoRem( Decimal::Parse( "123456789.0123456789" ), Decimal::Parse( "123456789.1123456789" ) ); +} + +/* +This example of the + Decimal::Multiply( Decimal, Decimal ), + Decimal::Divide( Decimal, Decimal ), and + Decimal::Remainder( Decimal, Decimal ) +methods generates the following output. It displays the product, +quotient, and remainder of several pairs of Decimal objects. + +Decimal Left 1000 +Decimal Right 7 +Decimal::Multiply( Left, Right ) 7000 +Decimal::Divide( Left, Right ) 142.85714285714285714285714286 +Decimal::Remainder( Left, Right ) 6 + +Decimal Left -1000 +Decimal Right 7 +Decimal::Multiply( Left, Right ) -7000 +Decimal::Divide( Left, Right ) -142.85714285714285714285714286 +Decimal::Remainder( Left, Right ) -6 + +Decimal Left 123.0000000 +Decimal Right 0.0012300 +Decimal::Multiply( Left, Right ) 0.15129000000000 +Decimal::Divide( Left, Right ) 100000 +Decimal::Remainder( Left, Right ) 0 + +Decimal Left 12345678900000000 +Decimal Right 0.0000000012345678 +Decimal::Multiply( Left, Right ) 15241577.6390794200000000 +Decimal::Divide( Left, Right ) 10000000729000059778004901.796 +Decimal::Remainder( Left, Right ) 0.000000000983 + +Decimal Left 123456789.0123456789 +Decimal Right 123456789.1123456789 +Decimal::Multiply( Left, Right ) 15241578765584515.651425087878 +Decimal::Divide( Left, Right ) 0.9999999991899999933660999449 +Decimal::Remainder( Left, Right ) 123456789.0123456789 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp new file mode 100644 index 00000000000..2447a44f013 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/fromoacurrency.cpp @@ -0,0 +1,59 @@ + +// +// Example of the Decimal::FromOACurrency method. +using namespace System; +#define dataFmt "{0,21}{1,25}" + +// Display the Decimal::FromOACurrency parameter and Decimal result. +void ShowDecimalFromOACurrency( __int64 Argument ) +{ + Decimal decCurrency = Decimal::FromOACurrency( Argument ); + Console::WriteLine( dataFmt, Argument, decCurrency ); +} + +int main() +{ + Console::WriteLine( "This example of the " + "Decimal::FromOACurrency( ) method generates \nthe " + "following output. It displays the OLE Automation " + "Currency \nvalue as an __int64 and the result as a " + "Decimal.\n" ); + Console::WriteLine( dataFmt, "OA Currency", "Decimal Value" ); + Console::WriteLine( dataFmt, "-----------", "-------------" ); + + // Convert OLE Automation Currency values to Decimal objects. + ShowDecimalFromOACurrency( 0L ); + ShowDecimalFromOACurrency( 1L ); + ShowDecimalFromOACurrency( 100000L ); + ShowDecimalFromOACurrency( 100000000000L ); + ShowDecimalFromOACurrency( 1000000000000000000L ); + ShowDecimalFromOACurrency( 1000000000000000001L ); + ShowDecimalFromOACurrency( Int64::MaxValue ); + ShowDecimalFromOACurrency( Int64::MinValue ); + ShowDecimalFromOACurrency( 123456789L ); + ShowDecimalFromOACurrency( 1234567890000L ); + ShowDecimalFromOACurrency( 1234567890987654321 ); + ShowDecimalFromOACurrency( 4294967295L ); +} + +/* +This example of the Decimal::FromOACurrency( ) method generates +the following output. It displays the OLE Automation Currency +value as an __int64 and the result as a Decimal. + + OA Currency Decimal Value + ----------- ------------- + 0 0 + 1 0.0001 + 100000 10 + 100000000000 10000000 + 1000000000000000000 100000000000000 + 1000000000000000001 100000000000000.0001 + 9223372036854775807 922337203685477.5807 + -9223372036854775808 -922337203685477.5808 + 123456789 12345.6789 + 1234567890000 123456789 + 1234567890987654321 123456789098765.4321 + 4294967295 429496.7295 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp new file mode 100644 index 00000000000..047800b7566 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.OACurrency/CPP/tooacurrency.cpp @@ -0,0 +1,82 @@ + +// +// Example of the Decimal::ToOACurrency method. +using namespace System; +#define dataFmt "{0,31}{1,27}" + +// Get the exception type name; remove the namespace prefix. +String^ GetExceptionType( Exception^ ex ) +{ + String^ exceptionType = ex->GetType()->ToString(); + return exceptionType->Substring( exceptionType->LastIndexOf( '.' ) + 1 ); +} + + +// Display the Decimal::ToOACurrency parameter and the result +// or exception. +void ShowDecimalToOACurrency( Decimal Argument ) +{ + + // Catch the exception if ToOACurrency( ) throws one. + try + { + __int64 oaCurrency = Decimal::ToOACurrency( Argument ); + Console::WriteLine( dataFmt, Argument, oaCurrency ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( dataFmt, Argument, GetExceptionType( ex ) ); + } + +} + +int main() +{ + Console::WriteLine( "This example of the " + "Decimal::ToOACurrency( ) method generates \nthe " + "following output. It displays the argument as a " + "Decimal \nand the OLE Automation Currency value " + "as an __int64.\n" ); + Console::WriteLine( dataFmt, "Argument", "OA Currency or Exception" ); + Console::WriteLine( dataFmt, "--------", "------------------------" ); + + // Convert Decimal values to OLE Automation Currency values. + ShowDecimalToOACurrency( Decimal(0) ); + ShowDecimalToOACurrency( Decimal(1) ); + ShowDecimalToOACurrency( Decimal::Parse( "1.0000000000000000000000000000" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "100000000000000" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "100000000000000.00000000000000" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "10000000000000000000000000000" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "0.000000000123456789" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "0.123456789" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "123456789" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "123456789000000000" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "4294967295" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "18446744073709551615" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "-79.228162514264337593543950335" ) ); + ShowDecimalToOACurrency( Decimal::Parse( "-79228162514264.337593543950335" ) ); +} + +/* +This example of the Decimal::ToOACurrency( ) method generates +the following output. It displays the argument as a Decimal +and the OLE Automation Currency value as an __int64. + + Argument OA Currency or Exception + -------- ------------------------ + 0 0 + 1 10000 + 1.0000000000000000000000000000 10000 + 100000000000000 1000000000000000000 + 100000000000000.00000000000000 1000000000000000000 + 10000000000000000000000000000 OverflowException + 0.000000000123456789 0 + 0.123456789 1235 + 123456789 1234567890000 + 123456789000000000 OverflowException + 4294967295 42949672950000 + 18446744073709551615 OverflowException +-79.228162514264337593543950335 -792282 +-79228162514264.337593543950335 -792281625142643376 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp new file mode 100644 index 00000000000..9aec6164459 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Decimal.ToXXX/CPP/tosgl_dbl.cpp @@ -0,0 +1,60 @@ + +// +// Example of the Decimal::ToSingle and Decimal::ToDouble methods. +using namespace System; +#define formatter "{0,30}{1,17}{2,23}" + +// Convert the Decimal argument; no exceptions are thrown. +void DecimalToSgl_Dbl( Decimal argument ) +{ + Object^ SingleValue; + Object^ DoubleValue; + + // Convert the argument to a float value. + SingleValue = Decimal::ToSingle( argument ); + + // Convert the argument to a double value. + DoubleValue = Decimal::ToDouble( argument ); + Console::WriteLine( formatter, argument, SingleValue, DoubleValue ); +} + +int main() +{ + Console::WriteLine( "This example of the \n" + " Decimal::ToSingle( Decimal ) and \n" + " Decimal::ToDouble( Decimal ) \nmethods " + "generates the following output. It \ndisplays " + "several converted Decimal values.\n" ); + Console::WriteLine( formatter, "Decimal argument", "float", "double" ); + Console::WriteLine( formatter, "----------------", "-----", "------" ); + + // Convert Decimal values and display the results. + DecimalToSgl_Dbl( Decimal::Parse( "0.0000000000000000000000000001" ) ); + DecimalToSgl_Dbl( Decimal::Parse( "0.0000000000123456789123456789" ) ); + DecimalToSgl_Dbl( Decimal::Parse( "123" ) ); + DecimalToSgl_Dbl( Decimal(123000000,0,0,false,6) ); + DecimalToSgl_Dbl( Decimal::Parse( "123456789.123456789" ) ); + DecimalToSgl_Dbl( Decimal::Parse( "123456789123456789123456789" ) ); + DecimalToSgl_Dbl( Decimal::MinValue ); + DecimalToSgl_Dbl( Decimal::MaxValue ); +} + +/* +This example of the + Decimal::ToSingle( Decimal ) and + Decimal::ToDouble( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument float double + ---------------- ----- ------ +0.0000000000000000000000000001 1E-28 1E-28 +0.0000000000123456789123456789 1.234568E-11 1.23456789123457E-11 + 123 123 123 + 123.000000 123 123 + 123456789.123456789 1.234568E+08 123456789.123457 + 123456789123456789123456789 1.234568E+26 1.23456789123457E+26 +-79228162514264337593543950335 -7.922816E+28 -7.92281625142643E+28 + 79228162514264337593543950335 7.922816E+28 7.92281625142643E+28 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp new file mode 100644 index 00000000000..5c947137978 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.CorrelationManager/cpp/correlationmanager.cpp @@ -0,0 +1,51 @@ +// CorrelationManager.cpp : main project file. + + +// +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Text; +using namespace System::Diagnostics; +using namespace System::Threading; + +void ThreadProc() +{ + TraceSource^ ts = gcnew TraceSource("MyApp"); + int i = ts->Listeners->Add(gcnew ConsoleTraceListener()); + ts->Listeners[i]->TraceOutputOptions = TraceOptions::LogicalOperationStack; + ts->Switch = gcnew SourceSwitch("MyAPP", "Verbose"); + // Add another logical operation. + Trace::CorrelationManager->StartLogicalOperation("WorkerThread"); + + ts->TraceEvent(TraceEventType::Error, 1, "Trace an error event."); + Trace::CorrelationManager->StopLogicalOperation(); +} + +void main() +{ + TraceSource^ ts = gcnew TraceSource("MyApp"); + int i = ts->Listeners->Add(gcnew ConsoleTraceListener()); + ts->Listeners[i]->TraceOutputOptions = TraceOptions::LogicalOperationStack; + ts->Switch = gcnew SourceSwitch("MyAPP", "Verbose"); + // Start the logical operation on the Main thread. + Trace::CorrelationManager->StartLogicalOperation("MainThread"); + + ts->TraceEvent(TraceEventType::Error, 1, "Trace an error event."); + Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); +// Start the worker thread. + t->Start(); +// Give the worker thread a chance to execute. + Thread::Sleep(1000); + Trace::CorrelationManager->StopLogicalOperation();} + + + +// This sample generates the following output: +//MyApp Error: 1 : Trace an error event. +// LogicalOperationStack=MainThread +//MyApp Error: 1 : Trace an error event. +// LogicalOperationStack=WorkerThread, MainThread +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp new file mode 100644 index 00000000000..519ff58fbcd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.DebuggerBrowsableAttribute/cpp/program.cpp @@ -0,0 +1,105 @@ +// + +using namespace System; +using namespace System::Collections; +using namespace System::Diagnostics; +using namespace System::Reflection; + +ref class HashtableDebugView; + +// +[DebuggerDisplay("{value}", Name = "{key}")] +ref class KeyValuePairs +{ +private: + IDictionary^ dictionary; + Object^ key; + Object^ value; + +public: + KeyValuePairs(IDictionary^ dictionary, Object^ key, Object^ value) + { + this->value = value; + this->key = key; + this->dictionary = dictionary; + } +}; +// + +// +[DebuggerDisplay("Count = {Count}")] +// +[DebuggerTypeProxy(HashtableDebugView::typeid)] +ref class MyHashtable : Hashtable +// +{ +private: + static const String^ TestString = "This should not appear in the debug window."; + +internal: + ref class HashtableDebugView + { + private: + Hashtable^ hashtable; + public: + static const String^ TestString = "This should appear in the debug window."; + HashtableDebugView(Hashtable^ hashtable) + { + this->hashtable = hashtable; + } + + // + [DebuggerBrowsable(DebuggerBrowsableState::RootHidden)] + property array^ Keys + { + array^ get() + { + array^ keys = gcnew array(hashtable->Count); + + IEnumerator^ ie = hashtable->Keys->GetEnumerator(); + int i = 0; + Object^ key; + while (ie->MoveNext()) + { + key = ie->Current; + keys[i] = gcnew KeyValuePairs(hashtable, key, hashtable[key]); + i++; + } + return keys; + } + } + // + }; +}; +// + +public ref class DebugViewTest +{ +private: + // The following constant will appear in the debug window for DebugViewTest. + static const String^ TabString = " "; +public: + // + // The following DebuggerBrowsableAttribute prevents the property following it + // from appearing in the debug window for the class. + [DebuggerBrowsable(DebuggerBrowsableState::Never)] + static String^ y = "Test String"; + // + + static void Main() + { + MyHashtable^ myHashTable = gcnew MyHashtable(); + myHashTable->Add("one", 1); + myHashTable->Add("two", 2); + Console::WriteLine(myHashTable->ToString()); + Console::WriteLine("In Main."); + } +}; + +int main() +{ + DebugViewTest::Main(); +} +// + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp new file mode 100644 index 00000000000..6ac933cf809 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.EventSchemaTraceListener/CPP/eventschematracelistener.cpp @@ -0,0 +1,99 @@ +// + +/////////////////////////////////////////////////////////////////////// +// +// EventSchemaTraceListener.cpp : main project file. +// Expected Output: +// 1) +// EventSchemaTraceListener CPP Sample +// +// IsThreadSafe? True +// BufferSize = 65536 +// MaximumFileSize = 20480000 +// MaximumNumberOfFiles = 2 +// Name = eventListener +// TraceLogRetentionOption = LimitedCircularFiles +// TraceOutputOptions = DateTime, Timestamp, ProcessId +// +// Press the enter key to exit +// +// 2) An output file is created named TraceOutput.xml. It will be +// opened and displayed in Microsoft Notepad. +// +// NOTE 1: +// Under certain circumstances, the VS C++ compiler will treat +// Console::WriteLine("MyText = " + MyVar); +// differently then the VS CSharp compiler. +// The C++ compiler will produce error C3063, whereas the +// CSharp compiler accepts the statement. +// This occurs when the VS C++ compiler cannot determine the +// datatype of "MyVar" because it is an enumeration type. +// The solution is: +// Use either of the following two methods: +// Console::WriteLine("MyText = {0} " , MyVar); +// Console::WriteLine("MyText = " + MyVar.ToString()); +// +// Although not specific to this particular pieces of code, +// this is demonstrated below in the Display function: The +// last two members, TraceLogRetentionOption, and +// TraceOutputOptions, are enumerations, and cannot simply be +// concatenated into Console::WriteLine. +// +/////////////////////////////////////////////////////////////////////// +#using +#using + +#define NOCONFIGFILE 1 +using namespace System; +using namespace System::IO; +using namespace System::Diagnostics; + + +[STAThreadAttribute] +void main() +{ + Console::WriteLine("EventSchemaTraceListener CPP Sample\n"); + + File::Delete("TraceOutput.xml"); + TraceSource ^ ts = gcnew TraceSource("TestSource"); + + +#if NOCONFIGFILE + ts->Listeners->Add(gcnew EventSchemaTraceListener("TraceOutput.xml", + "eventListener", 65536, + TraceLogRetentionOption::LimitedCircularFiles, + 20480000, 2)); + ts->Listeners["eventListener"]->TraceOutputOptions = + TraceOptions::DateTime | + TraceOptions::ProcessId | + TraceOptions::Timestamp; +#endif + + EventSchemaTraceListener ^ ESTL = + (EventSchemaTraceListener^)(ts->Listeners["eventListener"]); + + + Console::WriteLine("IsThreadSafe? = " + ESTL->IsThreadSafe); + Console::WriteLine("BufferSize = " + ESTL->BufferSize); + Console::WriteLine("MaximumFileSize = " + ESTL->MaximumFileSize); + Console::WriteLine("MaximumNumberOfFiles = " + ESTL->MaximumNumberOfFiles); + Console::WriteLine("Name = " + ESTL->Name); + Console::WriteLine("TraceLogRetentionOption = " + ESTL->TraceLogRetentionOption.ToString()); + Console::WriteLine("TraceOutputOptions = {0}\n", ESTL->TraceOutputOptions); + + ts->Switch->Level = SourceLevels::All; + String ^ testString = "" + + "" + + "11"; + + UnescapedXmlDiagnosticData ^ unXData = gcnew UnescapedXmlDiagnosticData(testString); + ts->TraceData(TraceEventType::Error, 38, unXData); + ts->TraceEvent(TraceEventType::Error, 38, testString); + ts->Flush(); + ts->Close(); + + Process::Start("notepad.exe", "TraceOutput.xml"); + Console::WriteLine("\nPress the enter key to exit"); + Console::ReadLine(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp new file mode 100644 index 00000000000..07d517d64ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.InstanceData.CopyTo/CPP/instdatacopyto.cpp @@ -0,0 +1,187 @@ +// +// InstanceData_CopyTo.cpp : main project file. +#using + +using namespace System; +using namespace System::Diagnostics; + + +/////////////////////////////////////////////////////////////////////// +// +// FORWARD DECLARATIONS +// +/////////////////////////////////////////////////////////////////////// + +// Console Utility Functions: +void InitConsole(); // Init console size +void TitleBlock(); // Write the title block +void CW(String^strText , // Write a colored string + String^ C = "", int LF = 1); + + +// InstanceData subroutines +// Display the contents of an InstanceData object. +void ProcessInstanceDataObject(String^ name, CounterSample CSRef); + +// Display the contents of an InstanceDataCollection. +void ProcessInstanceDataCollection(InstanceDataCollection^ idCol); + + + + +/////////////////////////////////////////////////////////////////////// +// +// MAIN PROGRAM +// +/////////////////////////////////////////////////////////////////////// + +void main() +{ + InitConsole(); + TitleBlock(); + + String^ categoryName; + String^ catNumStr; + int categoryNum; + + + array^ categories = + PerformanceCounterCategory::GetCategories(); + + // Create and sort an array of category names. + array^ categoryNames = gcnew array(categories->Length); + int catX; + for(catX=0; catX < categories->Length; catX++) + categoryNames[catX] = categories[catX]->CategoryName; + Array::Sort(categoryNames); + + while(1) + { + CW("These PerformanceCounterCategory categories are registered \n" + +"on this computer:","Red"); + + for(catX=0; catX < categories->Length; catX++) + Console::WriteLine("{0,4} - {1}", catX+1, categoryNames[catX]); + + // Ask the user to choose a category. + Console::Write("\nEnter a category number from the above list: "); + catNumStr = Console::ReadLine(); + + // Validate the entered category number. + try { + categoryNum = int::Parse(catNumStr); + if (categoryNum < 1 || categoryNum > categories->Length) + throw gcnew Exception(String::Format("The category number "+ + " must be in the range 1..{0}.", categories->Length)); + categoryName = categoryNames[(categoryNum-1)]; + + // Process the InstanceDataCollectionCollection for this category. + PerformanceCounterCategory^ pcc = + gcnew PerformanceCounterCategory(categoryName); + InstanceDataCollectionCollection^ idColCol = pcc->ReadCategory(); + array^ idColArray = + gcnew array(idColCol->Count); + + CW("\nInstanceDataCollectionCollection for \"" +categoryName+"\" " + +"has "+idColCol->Count+" elements.","Blue"); + + idColCol->CopyTo(idColArray, 0); + + for each ( InstanceDataCollection ^ idCol in idColArray ) + ProcessInstanceDataCollection(idCol); + } + catch(Exception^ ex) + { + Console::WriteLine("\"{0}\" is not a valid category number." + + "\n{1}", catNumStr, ex->Message); + } + + CW("\n\nRun again (Y,N)?","Yellow"); + catNumStr = Console::ReadLine(); + if ("Y" != catNumStr && "y" != catNumStr) break; + } +} + + +/////////////////////////////////////////////////////////////////////// +// +// SUBROUTINES +// +/////////////////////////////////////////////////////////////////////// + +void InitConsole() +{ + Console::BufferHeight = 4000; + Console::WindowHeight = 40; +} + +void TitleBlock() +{ +Console::Title = "InstDataCopyTo.cpp Sample"; + +CW( + "///////////////////////////////////////////////////////////////////\n" ++"//\n" ++"// PROGRAM instdatacopyto.cpp\n" ++"// PURPOSE Show how to use InstanceData objects\n" ++"// OUTPUT 1) Displays a numbered list of PerformanceCounter\n" ++"// categories that exist on the local computer.\n" ++"// 2) Prompts the user to select a category.\n" ++"// 3) Displays the instance data associated with each\n" ++"// instance of the PerformanceCounter in the\n" ++"// selected PerformanceCounterCategory\n" ++"//\n" ++ "///////////////////////////////////////////////////////////////////\n" +,"Yellow"); +} + + +// Utility function: ConsoleWrite: Write a colored string +void CW(String^ strText , String^ C, int LF) +{ + if (C != "") Console::ForegroundColor = *dynamic_cast + (Enum::Parse(ConsoleColor::typeid, C)); + Console::Write(strText); + Console::ResetColor(); + Console::Write("\n{0}",LF?"\n":""); +} + +// Display the contents of an InstanceDataCollection. +void ProcessInstanceDataCollection(InstanceDataCollection ^ idCol) +{ + array^ instDataArray = gcnew array(idCol->Count); + + CW("\n InstanceDataCollection for \"" + + idCol->CounterName + "\" has " + idCol->Count + " elements.", "Red"); + + // Copy and process the InstanceData array. + idCol->CopyTo(instDataArray, 0); + + int idX; + for(idX=0; idX < instDataArray->Length; idX++) + ProcessInstanceDataObject(instDataArray[idX]->InstanceName, + instDataArray[idX]->Sample); +} + + +// Display the contents of an InstanceData object. +void ProcessInstanceDataObject(String ^ name, CounterSample CSRef) +{ + InstanceData ^ instData = gcnew InstanceData(name, CSRef); + CW(" Data from InstanceData object:","Red",0); + + CW(" InstanceName: "+instData->InstanceName,"Green",0); + CW(" RawValue: " + instData->RawValue); + + CounterSample sample = instData->Sample; + Console::Write(" Data from CounterSample object:\n" + + " CounterType: {0,-27} SystemFrequency: {1}\n" + + " BaseValue: {2,-27} RawValue: {3}\n" + + " CounterFrequency: {4,-27} CounterTimeStamp: {5}\n" + + " TimeStamp: {6,-27} TimeStamp100nSec: {7}\n\n", + sample.CounterType, sample.SystemFrequency, sample.BaseValue, + sample.RawValue, sample.CounterFrequency, sample.CounterTimeStamp, + sample.TimeStamp, sample.TimeStamp100nSec); +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp new file mode 100644 index 00000000000..63ae0eabe00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetcount.cpp @@ -0,0 +1,91 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; + +ref class PerfCounterCatGetCountMod +{ + // +public: + static void Main(array^ args) + { + String^ categoryName = ""; + String^ machineName = ""; + String^ instanceName = ""; + PerformanceCounterCategory^ pcc; + array^ counters; + + // Copy the supplied arguments into the local variables. + try + { + categoryName = args[1]; + machineName = args[2]=="."? "": args[2]; + instanceName = args[3]; + } + catch (...) + { + // Ignore the exception from non-supplied arguments. + } + + try + { + // Create the appropriate PerformanceCounterCategory object. + if (machineName->Length>0) + { + pcc = gcnew PerformanceCounterCategory(categoryName, machineName); + } + else + { + pcc = gcnew PerformanceCounterCategory(categoryName); + } + + // Get the counters for this instance or a single instance + // of the selected category. + if (instanceName->Length > 0) + { + counters = pcc->GetCounters(instanceName); + } + else + { + counters = pcc->GetCounters(); + } + + } + catch (Exception^ ex) + { + Console::WriteLine("Unable to get counter information for " + + (instanceName->Length>0? "instance \"{2}\" in ": "single-instance ") + + "category \"{0}\" on " + (machineName->Length>0? "computer \"{1}\":": "this computer:"), + categoryName, machineName, instanceName); + Console::WriteLine(ex->Message); + return; + } + + // Display the counter names if GetCounters was successful. + if (counters != nullptr) + { + Console::WriteLine("These counters exist in " + + (instanceName->Length > 0 ? "instance \"{1}\" of" : "single instance") + + " category {0} on " + (machineName->Length > 0 ? "computer \"{2}\":": "this computer:"), + categoryName, instanceName, machineName); + + // Display a numbered list of the counter names. + int objX; + for(objX = 0; objX < counters->Length; objX++) + { + Console::WriteLine("{0,4} - {1}", objX + 1, counters[objX]->CounterName); + } + } + } + // +}; + +int main() +{ + PerfCounterCatGetCountMod::Main(Environment::GetCommandLineArgs()); +} +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp new file mode 100644 index 00000000000..3a2934fc5ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountercatgetinst.cpp @@ -0,0 +1,84 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; + +ref class PerfCounterCatGetInstMod +{ + // +public: + static void Main(array^ args) + { + String^ categoryName = ""; + String^ machineName = ""; + PerformanceCounterCategory^ pcc; + array^ instances; + + // Copy the supplied arguments into the local variables. + try + { + categoryName = args[1]; + machineName = args[2]=="."? "": args[2]; + } + catch (...) + { + // Ignore the exception from non-supplied arguments. + } + + try + { + // Create the appropriate PerformanceCounterCategory object. + if (machineName->Length > 0) + { + pcc = gcnew PerformanceCounterCategory(categoryName, machineName); + } + else + { + pcc = gcnew PerformanceCounterCategory(categoryName); + } + + // Get the instances associated with this category. + instances = pcc->GetInstanceNames(); + + } + catch (Exception^ ex) + { + Console::WriteLine("Unable to get instance information for " + + "category \"{0}\" on " + + (machineName->Length>0? "computer \"{1}\":": "this computer:"), + categoryName, machineName); + Console::WriteLine(ex->Message); + return; + } + + //If an empty array is returned, the category has a single instance. + if (instances->Length==0) + { + Console::WriteLine("Category \"{0}\" on " + + (machineName->Length>0? "computer \"{1}\"": "this computer") + + " is single-instance.", pcc->CategoryName, pcc->MachineName); + } + else + { + // Otherwise, display the instances. + Console::WriteLine("These instances exist in category \"{0}\" on " + + (machineName->Length>0? "computer \"{1}\".": "this computer:"), + pcc->CategoryName, pcc->MachineName); + + Array::Sort(instances); + int objX; + for (objX = 0; objX < instances->Length; objX++) + { + Console::WriteLine("{0,4} - {1}", objX+1, instances[objX]); + } + } + } + // +}; + +int main() +{ + PerfCounterCatGetInstMod::Main(Environment::GetCommandLineArgs()); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp new file mode 100644 index 00000000000..598438b1a46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.PerformanceCounterCategory.GetMembers/cpp/perfcountergetcat.cpp @@ -0,0 +1,72 @@ +// +#using + +using namespace System; +using namespace System::Diagnostics; + +ref class PerfCounterCatGetCatMod +{ + // +public: + static void Main(array^ args) + { + String^ machineName = ""; + array^ categories; + + // Copy the machine name argument into the local variable. + try + { + machineName = args[1]=="."? "": args[1]; + } + catch (...) + { + } + + // Generate a list of categories registered on the specified computer. + try + { + if (machineName->Length > 0) + { + categories = PerformanceCounterCategory::GetCategories(machineName); + } + else + { + categories = PerformanceCounterCategory::GetCategories(); + } + } + catch(Exception^ ex) + { + Console::WriteLine("Unable to get categories on " + + (machineName->Length > 0 ? "computer \"{0}\":": "this computer:"), machineName); + Console::WriteLine(ex->Message); + return; + } + + Console::WriteLine("These categories are registered on " + + (machineName->Length > 0 ? "computer \"{0}\":": "this computer:"), machineName); + + // Create and sort an array of category names. + array^ categoryNames = gcnew array(categories->Length); + int objX; + for (objX = 0; objX < categories->Length; objX++) + { + categoryNames[objX] = categories[objX]->CategoryName; + } + Array::Sort(categoryNames); + + for (objX = 0; objX < categories->Length; objX++) + { + Console::WriteLine("{0,4} - {1}", objX + 1, categoryNames[objX]); + } + } + // +}; + +int main() +{ + PerfCounterCatGetCatMod::Main(Environment::GetCommandLineArgs()); +} +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp new file mode 100644 index 00000000000..43756bed5b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Diagnostics.TraceSource2/CPP/tracesource2.cpp @@ -0,0 +1,143 @@ +// +///////////////////////////////////////////////////////////////////////////////// +// +// NAME TraceSource2.cpp : main project file +// +///////////////////////////////////////////////////////////////////////////////// + + + +// The following configuration file can be used with this sample. +// When using a configuration file #define ConfigFile. +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// +// + +#define TRACE +//#define ConfigFile + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Diagnostics; +using namespace System::Reflection; +using namespace System::IO; +using namespace System::Security::Permissions; + +void DisplayProperties(TraceSource^ ts); // Forward Declaration + + +int main() +{ + TraceSource^ ts = gcnew TraceSource("TraceTest"); + + try + { + // Initialize trace switches. +#if(!ConfigFile) + SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose"); + ts->Switch = sourceSwitch; + int idxConsole = ts->Listeners->Add(gcnew System::Diagnostics::ConsoleTraceListener()); + ts->Listeners[idxConsole]->Name = "console"; +#endif + DisplayProperties(ts); + ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::Callstack; + ts->TraceEvent(TraceEventType::Warning, 1); + ts->Listeners["console"]->TraceOutputOptions = TraceOptions::DateTime; + // Issue file not found message as a warning. + ts->TraceEvent(TraceEventType::Warning, 2, "File Test not found"); + // Issue file not found message as a verbose event using a formatted string. + ts->TraceEvent(TraceEventType::Verbose, 3, "File {0} not found.", "test"); + // Issue file not found message as information. + ts->TraceInformation("File {0} not found.", "test"); + ts->Listeners["console"]->TraceOutputOptions |= TraceOptions::LogicalOperationStack; + // Issue file not found message as an error event. + ts->TraceEvent(TraceEventType::Error, 4, "File {0} not found.", "test"); + + // Test the filter on the ConsoleTraceListener. + ts->Listeners["console"]->Filter = gcnew SourceFilter("No match"); + ts->TraceData(TraceEventType::Error, 5, + "SourceFilter should reject this message for the console trace listener."); + ts->Listeners["console"]->Filter = gcnew SourceFilter("TraceTest"); + ts->TraceData(TraceEventType::Error, 6, + "SourceFilter should let this message through on the console trace listener."); + ts->Listeners["console"]->Filter = nullptr; + + // Use the TraceData method. + ts->TraceData(TraceEventType::Warning, 7, gcnew array{ "Message 1", "Message 2" }); + + // Activity tests. + ts->TraceEvent(TraceEventType::Start, 9, "Will not appear until the switch is changed."); + ts->Switch->Level = SourceLevels::ActivityTracing | SourceLevels::Critical; + ts->TraceEvent(TraceEventType::Suspend, 10, "Switch includes ActivityTracing, this should appear"); + ts->TraceEvent(TraceEventType::Critical, 11, "Switch includes Critical, this should appear"); + ts->Flush(); + ts->Close(); + Console::WriteLine("Press enter key to exit."); + Console::Read(); + } + catch (Exception ^e) + { + // Catch any unexpected exception. + Console::WriteLine("Unexpected exception: " + e->ToString()); + Console::Read(); + } +} + + +void DisplayProperties(TraceSource^ ts) +{ + Console::WriteLine("TraceSource name = " + ts->Name); +// Console::WriteLine("TraceSource switch level = " + ts->Switch->Level); // error C3063: operator '+': all operands must have the same enumeration type + Console::WriteLine("TraceSource switch level = {0}", ts->Switch->Level); // SUCCESS: does compile. Weird + Console::WriteLine("TraceSource Attributes Count " + ts->Attributes->Count); // SUCCESS: also compiles. Really weird + Console::WriteLine("TraceSource Attributes Count = {0}", ts->Attributes->Count); // SUCCESS: okay, I give up. Somebody call me a cab. + + Console::WriteLine("TraceSource switch = " + ts->Switch->DisplayName); + array^ switches = SwitchAttribute::GetAll(TraceSource::typeid->Assembly); + + for (int i = 0; i < switches->Length; i++) + { + Console::WriteLine("Switch name = " + switches[i]->SwitchName); + Console::WriteLine("Switch type = " + switches[i]->SwitchType); + } + +#if(ConfigFile) + // Get the custom attributes for the TraceSource. + Console::WriteLine("Number of custom trace source attributes = " + + ts.Attributes.Count); + foreach (DictionaryEntry de in ts.Attributes) + Console::WriteLine("Custom trace source attribute = " + + de.Key + " " + de.Value); + // Get the custom attributes for the trace source switch. + foreach (DictionaryEntry de in ts.Switch.Attributes) + Console::WriteLine("Custom switch attribute = " + + de.Key + " " + de.Value); +#endif + Console::WriteLine("Number of listeners = " + ts->Listeners->Count); + for each (TraceListener ^ traceListener in ts->Listeners) + { + Console::Write("TraceListener: " + traceListener->Name + "\t"); + // The following output can be used to update the configuration file. + Console::WriteLine("AssemblyQualifiedName = " + + (traceListener->GetType()->AssemblyQualifiedName)); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp new file mode 100644 index 00000000000..b208ee69e6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring1.cpp @@ -0,0 +1,63 @@ +// ToStringCPP.cpp : main project file. + +// +using namespace System; +using namespace System::Globalization; + +int main(array ^args) +{ + double value = 16325.62901; + String^ specifier; + CultureInfo^ culture; + + // Use standard numeric format specifiers. + specifier = "G"; + culture = CultureInfo::CreateSpecificCulture("eu-ES"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 16325,62901 + Console::WriteLine(value.ToString(specifier, CultureInfo::InvariantCulture)); + // Displays: 16325.62901 + + specifier = "C"; + culture = CultureInfo::CreateSpecificCulture("en-US"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: $16,325.63 + culture = CultureInfo::CreateSpecificCulture("en-GB"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: £16,325.63 + + specifier = "E04"; + culture = CultureInfo::CreateSpecificCulture("sv-SE"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 1,6326E+004 + culture = CultureInfo::CreateSpecificCulture("en-NZ"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 1.6326E+004 + + specifier = "F"; + culture = CultureInfo::CreateSpecificCulture("fr-FR"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 16325,63 + culture = CultureInfo::CreateSpecificCulture("en-CA"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 16325.63 + + specifier = "N"; + culture = CultureInfo::CreateSpecificCulture("es-ES"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 16.325,63 + culture = CultureInfo::CreateSpecificCulture("fr-CA"); + Console::WriteLine(value.ToString(specifier, culture)); + // Displays: 16 325,63 + + specifier = "P"; + culture = CultureInfo::InvariantCulture; + Console::WriteLine((value/10000).ToString(specifier, culture)); + // Displays: 163.26 % + culture = CultureInfo::CreateSpecificCulture("ar-EG"); + Console::WriteLine((value/10000).ToString(specifier, culture)); + // Displays: 163.256 % + + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp new file mode 100644 index 00000000000..69e9a30d33e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Double.ToString/cpp/tostring3.cpp @@ -0,0 +1,223 @@ +// +using namespace System; + +void main() +{ + array^ numbers= {1054.32179, -195489100.8377, 1.0437E21, + -1.0573e-05}; + array^ specifiers = { "C", "E", "e", "F", "G", "N", "P", + "R", "#,000.000", "0.###E-000", + "000,000,000,000.00###" }; + for each (Double number in numbers) + { + Console::WriteLine("Formatting of {0}:", number); + for each (String^ specifier in specifiers) { + Console::WriteLine(" {0,-22} {1}", + specifier + ":", number.ToString(specifier)); + // Add precision specifiers from 0 to 3. + if (specifier->Length == 1 & ! specifier->Equals("R")) { + for (int precision = 0; precision <= 3; precision++) { + String^ pSpecifier = String::Format("{0}{1}", specifier, precision); + Console::WriteLine(" {0,-22} {1}", + pSpecifier + ":", number.ToString(pSpecifier)); + } + Console::WriteLine(); + } + } + Console::WriteLine(); + } +} +// The example displays the following output: +// Formatting of 1054.32179: +// C: $1,054.32 +// C0: $1,054 +// C1: $1,054.3 +// C2: $1,054.32 +// C3: $1,054.322 +// +// E: 1.054322E+003 +// E0: 1E+003 +// E1: 1.1E+003 +// E2: 1.05E+003 +// E3: 1.054E+003 +// +// e: 1.054322e+003 +// e0: 1e+003 +// e1: 1.1e+003 +// e2: 1.05e+003 +// e3: 1.054e+003 +// +// F: 1054.32 +// F0: 1054 +// F1: 1054.3 +// F2: 1054.32 +// F3: 1054.322 +// +// G: 1054.32179 +// G0: 1054.32179 +// G1: 1E+03 +// G2: 1.1E+03 +// G3: 1.05E+03 +// +// N: 1,054.32 +// N0: 1,054 +// N1: 1,054.3 +// N2: 1,054.32 +// N3: 1,054.322 +// +// P: 105,432.18 % +// P0: 105,432 % +// P1: 105,432.2 % +// P2: 105,432.18 % +// P3: 105,432.179 % +// +// R: 1054.32179 +// #,000.000: 1,054.322 +// 0.###E-000: 1.054E003 +// 000,000,000,000.00###: 000,000,001,054.32179 +// +// Formatting of -195489100.8377: +// C: ($195,489,100.84) +// C0: ($195,489,101) +// C1: ($195,489,100.8) +// C2: ($195,489,100.84) +// C3: ($195,489,100.838) +// +// E: -1.954891E+008 +// E0: -2E+008 +// E1: -2.0E+008 +// E2: -1.95E+008 +// E3: -1.955E+008 +// +// e: -1.954891e+008 +// e0: -2e+008 +// e1: -2.0e+008 +// e2: -1.95e+008 +// e3: -1.955e+008 +// +// F: -195489100.84 +// F0: -195489101 +// F1: -195489100.8 +// F2: -195489100.84 +// F3: -195489100.838 +// +// G: -195489100.8377 +// G0: -195489100.8377 +// G1: -2E+08 +// G2: -2E+08 +// G3: -1.95E+08 +// +// N: -195,489,100.84 +// N0: -195,489,101 +// N1: -195,489,100.8 +// N2: -195,489,100.84 +// N3: -195,489,100.838 +// +// P: -19,548,910,083.77 % +// P0: -19,548,910,084 % +// P1: -19,548,910,083.8 % +// P2: -19,548,910,083.77 % +// P3: -19,548,910,083.770 % +// +// R: -195489100.8377 +// #,000.000: -195,489,100.838 +// 0.###E-000: -1.955E008 +// 000,000,000,000.00###: -000,195,489,100.8377 +// +// Formatting of 1.0437E+21: +// C: $1,043,700,000,000,000,000,000.00 +// C0: $1,043,700,000,000,000,000,000 +// C1: $1,043,700,000,000,000,000,000.0 +// C2: $1,043,700,000,000,000,000,000.00 +// C3: $1,043,700,000,000,000,000,000.000 +// +// E: 1.043700E+021 +// E0: 1E+021 +// E1: 1.0E+021 +// E2: 1.04E+021 +// E3: 1.044E+021 +// +// e: 1.043700e+021 +// e0: 1e+021 +// e1: 1.0e+021 +// e2: 1.04e+021 +// e3: 1.044e+021 +// +// F: 1043700000000000000000.00 +// F0: 1043700000000000000000 +// F1: 1043700000000000000000.0 +// F2: 1043700000000000000000.00 +// F3: 1043700000000000000000.000 +// +// G: 1.0437E+21 +// G0: 1.0437E+21 +// G1: 1E+21 +// G2: 1E+21 +// G3: 1.04E+21 +// +// N: 1,043,700,000,000,000,000,000.00 +// N0: 1,043,700,000,000,000,000,000 +// N1: 1,043,700,000,000,000,000,000.0 +// N2: 1,043,700,000,000,000,000,000.00 +// N3: 1,043,700,000,000,000,000,000.000 +// +// P: 104,370,000,000,000,000,000,000.00 % +// P0: 104,370,000,000,000,000,000,000 % +// P1: 104,370,000,000,000,000,000,000.0 % +// P2: 104,370,000,000,000,000,000,000.00 % +// P3: 104,370,000,000,000,000,000,000.000 % +// +// R: 1.0437E+21 +// #,000.000: 1,043,700,000,000,000,000,000.000 +// 0.###E-000: 1.044E021 +// 000,000,000,000.00###: 1,043,700,000,000,000,000,000.00 +// +// Formatting of -1.0573E-05: +// C: $0.00 +// C0: $0 +// C1: $0.0 +// C2: $0.00 +// C3: $0.000 +// +// E: -1.057300E-005 +// E0: -1E-005 +// E1: -1.1E-005 +// E2: -1.06E-005 +// E3: -1.057E-005 +// +// e: -1.057300e-005 +// e0: -1e-005 +// e1: -1.1e-005 +// e2: -1.06e-005 +// e3: -1.057e-005 +// +// F: 0.00 +// F0: 0 +// F1: 0.0 +// F2: 0.00 +// F3: 0.000 +// +// G: -1.0573E-05 +// G0: -1.0573E-05 +// G1: -1E-05 +// G2: -1.1E-05 +// G3: -1.06E-05 +// +// N: 0.00 +// N0: 0 +// N1: 0.0 +// N2: 0.00 +// N3: 0.000 +// +// P: 0.00 % +// P0: 0 % +// P1: 0.0 % +// P2: 0.00 % +// P3: -0.001 % +// +// R: -1.0573E-05 +// #,000.000: 000.000 +// 0.###E-000: -1.057E-005 +// 000,000,000,000.00###: -000,000,000,000.00001 +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp new file mode 100644 index 00000000000..7d153608b4c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Double/CPP/doublesample.cpp @@ -0,0 +1,150 @@ +using namespace System; + +int main() +{ + // + Double d = 4.55; + // + + // + Console::WriteLine( "A double is of type {0}.", d.GetType() ); + // + + // + bool done = false; + String^ inp; + do + { + Console::Write( "Enter a real number: " ); + inp = Console::ReadLine(); + try + { + d = Double::Parse( inp ); + Console::WriteLine( "You entered {0}.", d ); + done = true; + } + catch ( FormatException^ ) + { + Console::WriteLine( "You did not enter a number." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred while parsing your response: {0}", e ); + } + + } + while ( !done ); + // + + // + if ( d > Double::MaxValue ) + { + Console::WriteLine( "Your number is bigger than a double." ); + } + // + + // + if ( d < Double::MinValue ) + { + Console::WriteLine( "Your number is smaller than a double." ); + } + // + + // + Console::WriteLine( "Epsilon, or the permittivity of a vacuum, has value {0}", Double::Epsilon ); + // + + // + Double zero = 0; + + // This condition will return false. + if ( (0 / zero) == Double::NaN ) + { + Console::WriteLine( "0 / 0 can be tested with Double::NaN." ); + } + else + { + Console::WriteLine( "0 / 0 cannot be tested with Double::NaN; use Double::IsNan() instead." ); + } + // + + // + // This will return true. + if ( Double::IsNaN( 0 / zero ) ) + { + Console::WriteLine( "Double::IsNan() can determine whether a value is not-a-number." ); + } + // + + // + // This will equal Infinity. + Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Double::NegativeInfinity) ); + // + + // + // This will equal Infinity. + Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Double::PositiveInfinity + 10.0) ); + // + + // + // This will return S"true". + Console::WriteLine( "IsInfinity(3.0 / 0) == {0}.", Double::IsInfinity( 3.0 / zero ) ? (String^)"true" : "false" ); + // + + // + // This will return S"true". + Console::WriteLine( "IsPositiveInfinity(4.0 / 0) == {0}.", Double::IsPositiveInfinity( 4.0 / zero ) ? (String^)"true" : "false" ); + // + + // + // This will return S"true". + Console::WriteLine( "IsNegativeInfinity(-5.0 / 0) == {0}.", Double::IsNegativeInfinity( -5.0 / zero ) ? (String^)"true" : "false" ); + // + + // + Double a; + a = 500; + Object^ obj1; + // + + // + // The variables point to the same objects. + Object^ obj2; + obj1 = a; + obj2 = obj1; + if ( Double::ReferenceEquals( obj1, obj2 ) ) + { + Console::WriteLine( "The variables point to the same double object." ); + } + else + { + Console::WriteLine( "The variables point to different double objects." ); + } + // + + // + obj1 = (Double)450; + if ( a.CompareTo( obj1 ) < 0 ) + { + Console::WriteLine( "{0} is less than {1}.", a, obj1 ); + } + + if ( a.CompareTo( obj1 ) > 0 ) + { + Console::WriteLine( "{0} is greater than {1}.", a, obj1 ); + } + + if ( a.CompareTo( obj1 ) == 0 ) + { + Console::WriteLine( "{0} equals {1}.", a, obj1 ); + } + // + + // + obj1 = (Double)500; + if ( a.Equals( obj1 ) ) + { + Console::WriteLine( "The value type and reference type values are equal." ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp new file mode 100644 index 00000000000..9a426f16689 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Environment/CPP/Vars1.cpp @@ -0,0 +1,24 @@ +// +using namespace System; +using namespace System::IO; + +void main() +{ + if (Environment::OSVersion->Platform == PlatformID::Win32NT) + { + // Change the directory to %WINDIR% + Environment::CurrentDirectory = Environment::GetEnvironmentVariable( "windir" ); + DirectoryInfo^ info = gcnew DirectoryInfo( "." ); + + Console::WriteLine("Directory Info: {0}", info->FullName); + } + else + { + Console::WriteLine("This example runs on Windows only."); + } +} +// The example displays output like the following on a .NET implementation running on Windows: +// Directory Info: C:\windows +// The example displays the following output on a .NET implementation on Unix-based systems: +// This example runs on Windows only. +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp new file mode 100644 index 00000000000..dcea5c7890b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/new.cpp @@ -0,0 +1,108 @@ + +// +// Example for the Exception( ) constructor. +using namespace System; + +namespace NDP_UE_CPP +{ + + // Derive an exception with a predefined message. + public ref class NotEvenException: public Exception + { + public: + NotEvenException() + : Exception( "The argument to a function requiring " + "even input is not divisible by 2." ) + {} + + }; + + + // Half throws a base exception if the input is not even. + int Half( int input ) + { + if ( input % 2 != 0 ) + throw gcnew Exception; + else + return input / 2; + } + + + // Half2 throws a derived exception if the input is not even. + int Half2( int input ) + { + if ( input % 2 != 0 ) + throw gcnew NotEvenException; + else + return input / 2; + } + + + // CalcHalf calls Half and catches any thrown exceptions. + void CalcHalf( int input ) + { + try + { + int halfInput = Half( input ); + Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( ex->ToString() ); + } + + } + + + // CalcHalf2 calls Half2 and catches any thrown exceptions. + void CalcHalf2( int input ) + { + try + { + int halfInput = Half2( input ); + Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( ex->ToString() ); + } + + } + +} + +int main() +{ + Console::WriteLine( "This example of the Exception( ) constructor " + "generates the following output." ); + Console::WriteLine( "\nHere, an exception is thrown using the \n" + "parameterless constructor of the base class.\n" ); + NDP_UE_CPP::CalcHalf( 12 ); + NDP_UE_CPP::CalcHalf( 15 ); + Console::WriteLine( "\nHere, an exception is thrown using the \n" + "parameterless constructor of a derived class.\n" ); + NDP_UE_CPP::CalcHalf2( 24 ); + NDP_UE_CPP::CalcHalf2( 27 ); +} + +/* +This example of the Exception( ) constructor generates the following output. + +Here, an exception is thrown using the +parameterless constructor of the base class. + +Half of 12 is 6. +System.Exception: Exception of type System.Exception was thrown. + at NDP_UE_CPP.Half(Int32 input) + at NDP_UE_CPP.CalcHalf(Int32 input) + +Here, an exception is thrown using the +parameterless constructor of a derived class. + +Half of 24 is 12. +NDP_UE_CPP.NotEvenException: The argument to a function requiring even input is + not divisible by 2. + at NDP_UE_CPP.Half2(Int32 input) + at NDP_UE_CPP.CalcHalf2(Int32 input) +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp new file mode 100644 index 00000000000..680a5c851ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/news.cpp @@ -0,0 +1,116 @@ + +// +// Example for the Exception( String* ) constructor. +using namespace System; + +namespace NDP_UE_CPP +{ + + // Derive an exception with a specifiable message. + public ref class NotEvenException: public Exception + { + private: + static String^ notEvenMessage = "The argument to a function requiring " + "even input is not divisible by 2."; + + public: + NotEvenException() + : Exception( notEvenMessage ) + {} + + NotEvenException( String^ auxMessage ) + : Exception( String::Format( "{0} - {1}", auxMessage, notEvenMessage ) ) + {} + + }; + + + // Half throws a base exception if the input is not even. + int Half( int input ) + { + if ( input % 2 != 0 ) + throw gcnew Exception( String::Format( "The argument {0} is not divisible by 2.", input ) ); + else + return input / 2; + } + + + // Half2 throws a derived exception if the input is not even. + int Half2( int input ) + { + if ( input % 2 != 0 ) + throw gcnew NotEvenException( String::Format( "Invalid argument: {0}", input ) ); + else + return input / 2; + } + + + // CalcHalf calls Half and catches any thrown exceptions. + void CalcHalf( int input ) + { + try + { + int halfInput = Half( input ); + Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( ex->ToString() ); + } + + } + + + // CalcHalf2 calls Half2 and catches any thrown exceptions. + void CalcHalf2( int input ) + { + try + { + int halfInput = Half2( input ); + Console::WriteLine( "Half of {0} is {1}.", input, halfInput ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( ex->ToString() ); + } + + } + +} + +int main() +{ + Console::WriteLine( "This example of the Exception( String* )\n" + "constructor generates the following output." ); + Console::WriteLine( "\nHere, an exception is thrown using the \n" + "constructor of the base class.\n" ); + NDP_UE_CPP::CalcHalf( 18 ); + NDP_UE_CPP::CalcHalf( 21 ); + Console::WriteLine( "\nHere, an exception is thrown using the \n" + "constructor of a derived class.\n" ); + NDP_UE_CPP::CalcHalf2( 30 ); + NDP_UE_CPP::CalcHalf2( 33 ); +} + +/* +This example of the Exception( String* ) +constructor generates the following output. + +Here, an exception is thrown using the +constructor of the base class. + +Half of 18 is 9. +System.Exception: The argument 21 is not divisible by 2. + at NDP_UE_CPP.Half(Int32 input) + at NDP_UE_CPP.CalcHalf(Int32 input) + +Here, an exception is thrown using the +constructor of a derived class. + +Half of 30 is 15. +NDP_UE_CPP.NotEvenException: Invalid argument: 33 - The argument to a function +requiring even input is not divisible by 2. + at NDP_UE_CPP.Half2(Int32 input) + at NDP_UE_CPP.CalcHalf2(Int32 input) +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp new file mode 100644 index 00000000000..c1923e2fbc7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Ctor/CPP/newsi.cpp @@ -0,0 +1,109 @@ + +// +// Example for the Exception( String*, Exception* ) constructor. +using namespace System; + +namespace NDP_UE_CPP +{ + + // Derive an exception with a specifiable message and inner exception. + public ref class LogTableOverflowException: public Exception + { + private: + static String^ overflowMessage = "The log table has overflowed."; + + public: + LogTableOverflowException() + : Exception( overflowMessage ) + {} + + LogTableOverflowException( String^ auxMessage ) + : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ) ) + {} + + LogTableOverflowException( String^ auxMessage, Exception^ inner ) + : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) + {} + + }; + + public ref class LogTable + { + public: + LogTable( int numElements ) + { + logArea = gcnew array(numElements); + elemInUse = 0; + } + + + protected: + array^logArea; + int elemInUse; + + public: + + // The AddRecord method throws a derived exception + // if the array bounds exception is caught. + int AddRecord( String^ newRecord ) + { + try + { + logArea[ elemInUse ] = newRecord; + return elemInUse++; + } + catch ( Exception^ ex ) + { + throw gcnew LogTableOverflowException( String::Format( "Record \"{0}\" was not logged.", newRecord ),ex ); + } + + } + + }; + + + // Create a log table and force an overflow. + void ForceOverflow() + { + LogTable^ log = gcnew LogTable( 4 ); + try + { + for ( int count = 1; ; count++ ) + { + log->AddRecord( String::Format( "Log record number {0}", count ) ); + + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( ex->ToString() ); + } + + } + +} + +int main() +{ + Console::WriteLine( "This example of the Exception( String*, Exception* )\n" + "constructor generates the following output." ); + Console::WriteLine( "\nExample of a derived exception " + "that references an inner exception:\n" ); + NDP_UE_CPP::ForceOverflow(); +} + +/* +This example of the Exception( String*, Exception* ) +constructor generates the following output. + +Example of a derived exception that references an inner exception: + +NDP_UE_CPP.LogTableOverflowException: The log table has overflowed. - Record "L +og record number 5" was not logged. ---> System.IndexOutOfRangeException: Index + was outside the bounds of the array. + at NDP_UE_CPP.LogTable.AddRecord(String newRecord) + --- End of inner exception stack trace --- + at NDP_UE_CPP.LogTable.AddRecord(String newRecord) + at NDP_UE_CPP.ForceOverflow() +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp new file mode 100644 index 00000000000..38d74dc3b35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetBaseException/CPP/getbaseexc.cpp @@ -0,0 +1,137 @@ + +// +// Example for the Exception::GetBaseException method. +using namespace System; + +namespace NDP_UE_CPP +{ + + // Define two derived exceptions to demonstrate nested exceptions. + ref class SecondLevelException: public Exception + { + public: + SecondLevelException( String^ message, Exception^ inner ) + : Exception( message, inner ) + {} + + }; + + ref class ThirdLevelException: public Exception + { + public: + ThirdLevelException( String^ message, Exception^ inner ) + : Exception( message, inner ) + {} + + }; + + + // DivideBy0 forces a division by 0 and throws a second exception. + void DivideBy0() + { + try + { + int zero = 0; + int ecks = 1 / zero; + } + catch ( Exception^ ex ) + { + throw gcnew SecondLevelException( "Forced a division by 0 and threw " + "a second exception.",ex ); + } + + } + + + // This function catches the exception from the called function + // DivideBy0( ) and throws another in response. + void Rethrow() + { + try + { + DivideBy0(); + } + catch ( Exception^ ex ) + { + throw gcnew ThirdLevelException( "Caught the second exception and " + "threw a third in response.",ex ); + } + + } + +} + +int main() +{ + Console::WriteLine( "This example of Exception.GetBaseException " + "generates the following output." ); + Console::WriteLine( "\nThe program forces a division by 0, " + "then throws the exception \ntwice more, " + "using a different derived exception each time.\n" ); + try + { + + // This function calls another that forces a division by 0. + NDP_UE_CPP::Rethrow(); + } + catch ( Exception^ e ) + { + Exception^ current; + Console::WriteLine( "Unwind the nested exceptions using " + "the InnerException property:\n" ); + + // This code unwinds the nested exceptions using the + // InnerException property. + current = e; + while ( current != (Object^)0 ) + { + Console::WriteLine( current->ToString() ); + Console::WriteLine(); + current = current->InnerException; + } + + // Display the innermost exception. + Console::WriteLine( "Display the base exception using the \n" + "GetBaseException method:\n" ); + Console::WriteLine( e->GetBaseException()->ToString() ); + } + +} + +/* +This example of Exception.GetBaseException generates the following output. + +The program forces a division by 0, then throws the exception +twice more, using a different derived exception each time. + +Unwind the nested exceptions using the InnerException property: + +NDP_UE_CPP.ThirdLevelException: Caught the second exception and threw a third i +n response. ---> NDP_UE_CPP.SecondLevelException: Forced a division by 0 and th +rew a second exception. ---> System.DivideByZeroException: Attempted to divide +by zero. + at NDP_UE_CPP.DivideBy0() + --- End of inner exception stack trace --- + at NDP_UE_CPP.DivideBy0() + at NDP_UE_CPP.Rethrow() + --- End of inner exception stack trace --- + at NDP_UE_CPP.Rethrow() + at main() + +NDP_UE_CPP.SecondLevelException: Forced a division by 0 and threw a second exce +ption. ---> System.DivideByZeroException: Attempted to divide by zero. + at NDP_UE_CPP.DivideBy0() + --- End of inner exception stack trace --- + at NDP_UE_CPP.DivideBy0() + at NDP_UE_CPP.Rethrow() + +System.DivideByZeroException: Attempted to divide by zero. + at NDP_UE_CPP.DivideBy0() + +Display the base exception using the +GetBaseException method: + +System.DivideByZeroException: Attempted to divide by zero. + at NDP_UE_CPP.DivideBy0() +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp new file mode 100644 index 00000000000..02481fe745f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.GetObjectData/CPP/getobjdata.cpp @@ -0,0 +1,149 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Serialization::Formatters::Soap; + +// Define a serializable derived exception class. + +[Serializable] +ref class SecondLevelException: public Exception, public ISerializable +{ +public: + + // This public constructor is used by class instantiators. + SecondLevelException( String^ message, Exception^ inner ) + : Exception( message, inner ) + { + HelpLink = "http://MSDN.Microsoft.com"; + Source = "Exception_Class_Samples"; + } + + +protected: + + // This protected constructor is used for deserialization. + SecondLevelException( SerializationInfo^ info, StreamingContext context ) + : Exception( info, context ) + {} + + +public: + + // GetObjectData performs a custom serialization. + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] + virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override + { + + // Change the case of two properties, and then use the + // method of the base class. + HelpLink = HelpLink->ToLower(); + Source = Source->ToUpperInvariant(); + Exception::GetObjectData( info, context ); + } + +}; + +int main() +{ + Console::WriteLine( "This example of the Exception constructor " + "and Exception.GetObjectData\nwith Serialization" + "Info and StreamingContext parameters " + "generates \nthe following output.\n" ); + try + { + + // This code forces a division by 0 and catches the + // resulting exception. + try + { + int zero = 0; + int ecks = 1 / zero; + } + catch ( Exception^ ex ) + { + + // Create a new exception to throw again. + SecondLevelException^ newExcept = gcnew SecondLevelException( "Forced a division by 0 and threw " + "another exception.",ex ); + Console::WriteLine( "Forced a division by 0, caught the " + "resulting exception, \n" + "and created a derived exception:\n" ); + Console::WriteLine( "HelpLink: {0}", newExcept->HelpLink ); + Console::WriteLine( "Source: {0}", newExcept->Source ); + + // This FileStream is used for the serialization. + FileStream^ stream = gcnew FileStream( "NewException.dat",FileMode::Create ); + try + { + + // Serialize the derived exception. + SoapFormatter^ formatter = gcnew SoapFormatter( nullptr,StreamingContext(StreamingContextStates::File) ); + formatter->Serialize( stream, newExcept ); + + // Rewind the stream and deserialize the + // exception. + stream->Position = 0; + SecondLevelException^ deserExcept = dynamic_cast(formatter->Deserialize( stream )); + Console::WriteLine( "\nSerialized the exception, and then " + "deserialized the resulting stream " + "into a \nnew exception. " + "The deserialization changed the case " + "of certain properties:\n" ); + + // Throw the deserialized exception again. + throw deserExcept; + } + catch ( SerializationException^ se ) + { + Console::WriteLine( "Failed to serialize: {0}", se->ToString() ); + } + finally + { + stream->Close(); + } + + } + + } + catch ( Exception^ ex ) + { + Console::WriteLine( "HelpLink: {0}", ex->HelpLink ); + Console::WriteLine( "Source: {0}", ex->Source ); + Console::WriteLine(); + Console::WriteLine( ex->ToString() ); + } + +} + +/* +This example of the Exception constructor and Exception.GetObjectData +with SerializationInfo and StreamingContext parameters generates +the following output. + +Forced a division by 0, caught the resulting exception, +and created a derived exception: + +HelpLink: http://MSDN.Microsoft.com +Source: Exception_Class_Samples + +Serialized the exception, and then deserialized the resulting stream into a +new exception. The deserialization changed the case of certain properties: + +HelpLink: http://msdn.microsoft.com +Source: EXCEPTION_CLASS_SAMPLES + +SecondLevelException: Forced a division by 0 and threw another exception. ---> S +ystem.DivideByZeroException: Attempted to divide by zero. + at main() + --- End of inner exception stack trace --- + at main() + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp new file mode 100644 index 00000000000..b3714fff6d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.HResult/CPP/hresult.cpp @@ -0,0 +1,70 @@ + +// +// Example for the Exception::HResult property. +using namespace System; + +namespace NDP_UE_CPP +{ + + // Create the derived exception class. + ref class SecondLevelException: public Exception + { + private: + static int SecondLevelHResult = (int)0x81234567; + + public: + + // Set HResult for this exception, and include it in + // the exception message. + SecondLevelException( String^ message, Exception^ inner ) + : Exception( String::Format( "(HRESULT:0x{1:X8}) {0}", message, SecondLevelHResult ), inner ) + { + HResult = SecondLevelHResult; + } + + }; + + + // This function forces a division by 0 and throws + // a second exception. + void DivideBy0() + { + try + { + try + { + int zero = 0; + int ecks = 1 / zero; + } + catch ( Exception^ ex ) + { + throw gcnew SecondLevelException( "Forced a division by 0 and threw " + "a second exception.",ex ); + } + + } + catch ( Exception^ ex ) + { + Console::WriteLine( ex->ToString() ); + } + + } + +} + +int main() +{ + NDP_UE_CPP::DivideBy0(); +} + +/* +This example of Exception::HResult generates the following output. + +NDP_UE_CPP.SecondLevelException: (HRESULT:0x81234567) Forced a division by 0 an +d threw a second exception. ---> System.DivideByZeroException: Attempted to div +ide by zero. + at NDP_UE_CPP.DivideBy0() + --- End of inner exception stack trace --- + at NDP_UE_CPP.DivideBy0() +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj new file mode 100644 index 00000000000..62a1c06daf2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/exception_properties.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + NDP_UE_CPP + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp new file mode 100644 index 00000000000..5597ab64333 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Exception.Properties/CPP/properties.cpp @@ -0,0 +1,121 @@ + +// +// Example for the Exception::HelpLink, Exception::Source, +// Exception::StackTrace, and Exception::TargetSite properties. +using namespace System; + +namespace NDP_UE_CPP +{ + + // Derive an exception; the constructor sets the HelpLink and + // Source properties. + public ref class LogTableOverflowException: public Exception + { + private: + static String^ overflowMessage = "The log table has overflowed."; + + public: + LogTableOverflowException( String^ auxMessage, Exception^ inner ) + : Exception( String::Format( "{0} - {1}", overflowMessage, auxMessage ), inner ) + { + this->HelpLink = "https://learn.microsoft.com"; + this->Source = "Exception_Class_Samples"; + } + + }; + + public ref class LogTable + { + public: + LogTable( int numElements ) + { + logArea = gcnew array(numElements); + elemInUse = 0; + } + + + protected: + array^logArea; + int elemInUse; + + public: + + // The AddRecord method throws a derived exception if + // the array bounds exception is caught. + int AddRecord( String^ newRecord ) + { + try + { + logArea[ elemInUse ] = newRecord; + return elemInUse++; + } + catch ( Exception^ ex ) + { + throw gcnew LogTableOverflowException( String::Format( "Record \"{0}\" was not logged.", newRecord ),ex ); + } + + } + + }; + + + // Create a log table and force an overflow. + void ForceOverflow() + { + LogTable^ log = gcnew LogTable( 4 ); + try + { + for ( int count = 1; ; count++ ) + { + log->AddRecord( String::Format( "Log record number {0}", count ) ); + + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( "\nMessage ---\n{0}", ex->Message ); + Console::WriteLine( "\nHelpLink ---\n{0}", ex->HelpLink ); + Console::WriteLine( "\nSource ---\n{0}", ex->Source ); + Console::WriteLine( "\nStackTrace ---\n{0}", ex->StackTrace ); + Console::WriteLine( "\nTargetSite ---\n{0}", ex->TargetSite->ToString() ); + } + + } + +} + +int main() +{ + Console::WriteLine( "This example of \n Exception::Message, \n" + " Exception::HelpLink, \n Exception::Source, \n" + " Exception::StackTrace, and \n Exception::" + "TargetSite \ngenerates the following output." ); + NDP_UE_CPP::ForceOverflow(); +} + +/* +This example of + Exception::Message, + Exception::HelpLink, + Exception::Source, + Exception::StackTrace, and + Exception::TargetSite +generates the following output. + +Message --- +The log table has overflowed. - Record "Log record number 5" was not logged. + +HelpLink --- +https://learn.microsoft.com + +Source --- +Exception_Class_Samples + +StackTrace --- + at NDP_UE_CPP.LogTable.AddRecord(String newRecord) + at NDP_UE_CPP.ForceOverflow() + +TargetSite --- +Int32 AddRecord(System.String) +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp new file mode 100644 index 00000000000..f572f53062b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags.cpp @@ -0,0 +1,79 @@ + +// +using namespace System; + +// Define an Enum without FlagsAttribute. +public enum class SingleHue : short +{ + None = 0, + Black = 1, + Red = 2, + Green = 4, + Blue = 8 +}; + +// Define an Enum with FlagsAttribute. +[Flags] +enum class MultiHue : short +{ + None = 0, + Black = 1, + Red = 2, + Green = 4, + Blue = 8 +}; + +int main() +{ + // Display all possible combinations of values. + Console::WriteLine( + "All possible combinations of values without FlagsAttribute:"); + for (int val = 0; val <= 16; val++) + Console::WriteLine("{0,3} - {1:G}", val, (SingleHue)val); + + Console::WriteLine( + "\nAll possible combinations of values with FlagsAttribute:"); + + // Display all combinations of values, and invalid values. + for (int val = 0; val <= 16; val++ ) + Console::WriteLine("{0,3} - {1:G}", val, (MultiHue)val); +} +// The example displays the following output: +// All possible combinations of values without FlagsAttribute: +// 0 - None +// 1 - Black +// 2 - Red +// 3 - 3 +// 4 - Green +// 5 - 5 +// 6 - 6 +// 7 - 7 +// 8 - Blue +// 9 - 9 +// 10 - 10 +// 11 - 11 +// 12 - 12 +// 13 - 13 +// 14 - 14 +// 15 - 15 +// 16 - 16 +// +// All possible combinations of values with FlagsAttribute: +// 0 - None +// 1 - Black +// 2 - Red +// 3 - Black, Red +// 4 - Green +// 5 - Black, Green +// 6 - Red, Green +// 7 - Black, Red, Green +// 8 - Blue +// 9 - Black, Blue +// 10 - Red, Blue +// 11 - Black, Red, Blue +// 12 - Green, Blue +// 13 - Black, Green, Blue +// 14 - Red, Green, Blue +// 15 - Black, Red, Green, Blue +// 16 - 16 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp new file mode 100644 index 00000000000..71b62c4c010 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.FlagsAttribute/CPP/flags1.cpp @@ -0,0 +1,75 @@ +// +using namespace System; + +[Flags] +enum class PhoneService +{ + None = 0, + LandLine = 1, + Cell = 2, + Fax = 4, + Internet = 8, + Other = 16 +}; + +void main() +{ + // Define three variables representing the types of phone service + // in three households. + PhoneService household1 = PhoneService::LandLine | PhoneService::Cell | + PhoneService::Internet; + PhoneService household2 = PhoneService::None; + PhoneService household3 = PhoneService::Cell | PhoneService::Internet; + + // Store the variables in an array for ease of access. + array^ households = { household1, household2, household3 }; + + // Which households have no service? + for (int ctr = 0; ctr < households->Length; ctr++) + Console::WriteLine("Household {0} has phone service: {1}", + ctr + 1, + households[ctr] == PhoneService::None ? + "No" : "Yes"); + Console::WriteLine(); + + // Which households have cell phone service? + for (int ctr = 0; ctr < households->Length; ctr++) + Console::WriteLine("Household {0} has cell phone service: {1}", + ctr + 1, + (households[ctr] & PhoneService::Cell) == PhoneService::Cell ? + "Yes" : "No"); + Console::WriteLine(); + + // Which households have cell phones and land lines? + PhoneService cellAndLand = PhoneService::Cell | PhoneService::LandLine; + for (int ctr = 0; ctr < households->Length; ctr++) + Console::WriteLine("Household {0} has cell and land line service: {1}", + ctr + 1, + (households[ctr] & cellAndLand) == cellAndLand ? + "Yes" : "No"); + Console::WriteLine(); + + // List all types of service of each household?// + for (int ctr = 0; ctr < households->Length; ctr++) + Console::WriteLine("Household {0} has: {1:G}", + ctr + 1, households[ctr]); + Console::WriteLine(); +} +// The example displays the following output: +// Household 1 has phone service: Yes +// Household 2 has phone service: No +// Household 3 has phone service: Yes +// +// Household 1 has cell phone service: Yes +// Household 2 has cell phone service: No +// Household 3 has cell phone service: Yes +// +// Household 1 has cell and land line service: Yes +// Household 2 has cell and land line service: No +// Household 3 has cell and land line service: No +// +// Household 1 has: LandLine, Cell, Internet +// Household 2 has: None +// Household 3 has: Cell, Internet +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp new file mode 100644 index 00000000000..55b8b589334 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Func~2/cpp/Example.cpp @@ -0,0 +1,44 @@ +using namespace System; +using namespace System::Linq; +using namespace System::Collections; +using namespace System::Collections::Generic; + +// +// Declare a delegate +delegate String ^ MyDel(String ^); + +// Create wrapper class and function that takes in a string and converts it to uppercase +ref class DelegateWrapper { +public: + String ^ ToUpper(String ^ s) { + return s->ToUpper(); + } +}; + +int main() { + // Declare delegate + DelegateWrapper ^ delegateWrapper = gcnew DelegateWrapper; + MyDel ^ DelInst = gcnew MyDel(delegateWrapper, &DelegateWrapper::ToUpper); + + // Cast into Func + Func ^ selector = reinterpret_cast ^>(DelInst); + + // Create an array of strings + array ^ words = { "orange", "apple", "Article", "elephant" }; + + // Query the array and select strings according to the selector method + Generic::IEnumerable ^ aWords = Enumerable::Select((Generic::IEnumerable^)words, selector); + + // Output the results to the console + for each(String ^ word in aWords) + Console::WriteLine(word); + /* + This code example produces the following output: + + ORANGE + APPLE + ARTICLE + ELEPHANT + */ +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp new file mode 100644 index 00000000000..8583565fa53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.GC.Collect Example/CPP/class1.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; + +const int maxGarbage = 1000; + +void MakeSomeGarbage() +{ + Version^ vt; + for ( int i = 0; i < maxGarbage; i++ ) { + // Create objects and release them to fill up memory with unused objects. + vt = gcnew Version; + } +} + +void main() +{ + // Put some objects in memory. + MakeSomeGarbage(); + Console::WriteLine("Memory used before collection: {0:N0}", + GC::GetTotalMemory( false ) ); + + // Collect all generations of memory. + GC::Collect(); + Console::WriteLine("Memory used after full collection: {0:N0}", + GC::GetTotalMemory( true ) ); +} +// The output from the example resembles the following: +// Memory used before collection: 79,392 +// Memory used after full collection: 52,640 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp new file mode 100644 index 00000000000..e3587de2c56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.GC.GetGenerationWeak Example/CPP/systemgcgetgenerationweak.cpp @@ -0,0 +1,72 @@ + +// +using namespace System; +ref class MyGCCollectClass +{ +private: + static const long maxGarbage = 1000; + +public: + void MakeSomeGarbage() + { + Version^ vt; + for ( int i = 0; i < maxGarbage; i++ ) + { + + // Create objects and release them to fill up memory + // with unused objects. + vt = gcnew Version; + + } + } + +}; + +int main() +{ + + // Create a strong reference to an Object. + MyGCCollectClass^ myGCCol = gcnew MyGCCollectClass; + + // Put some objects in memory. + myGCCol->MakeSomeGarbage(); + + // Get the generation of managed memory where myGCCol is stored. + Console::WriteLine( "The object is in generation: {0}", GC::GetGeneration( myGCCol ) ); + + // Perform a full garbage collection. + // Because there is a strong reference to myGCCol, it will + // not be garbage collected. + GC::Collect(); + + // Get the generation of managed memory where myGCCol is stored. + Console::WriteLine( "The object is in generation: {0}", GC::GetGeneration( myGCCol ) ); + + // Create a WeakReference to myGCCol. + WeakReference^ wkref = gcnew WeakReference( myGCCol ); + + // Remove the strong reference to myGCCol. + myGCCol = nullptr; + + // Get the generation of managed memory where wkref is stored. + Console::WriteLine( "The WeakReference to the object is in generation: {0}", GC::GetGeneration( wkref ) ); + + // Perform another full garbage collection. + // A WeakReference will not survive a garbage collection. + GC::Collect(); + + // Try to get the generation of managed memory where wkref is stored. + // Because it has been collected, an exception will be thrown. + try + { + Console::WriteLine( "The WeakReference to the object is in generation: {0}", GC::GetGeneration( wkref ) ); + Console::Read(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The WeakReference to the object has been garbage collected: ' {0}'", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp new file mode 100644 index 00000000000..b457b3d8f57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.GC.KeepAlive Example2/CPP/gckeepalive.cpp @@ -0,0 +1,108 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Runtime::InteropServices; + +// A simple class that exposes two static Win32 functions. +// One is a delegate type and the other is an enumerated type. +public ref class MyWin32 +{ +public: + + // An enumerated type for the control messages sent to the handler routine. + enum class CtrlTypes + { + CTRL_C_EVENT = 0, + CTRL_BREAK_EVENT, CTRL_CLOSE_EVENT, CTRL_LOGOFF_EVENT = 5, + CTRL_SHUTDOWN_EVENT + }; + + delegate Boolean HandlerRoutine( // A delegate type to be used as the Handler Routine for SetConsoleCtrlHandler. + CtrlTypes CtrlType ); + + // Declare the SetConsoleCtrlHandler function as external and receiving a delegate. + + [DllImport("Kernel32")] + static Boolean SetConsoleCtrlHandler( HandlerRoutine^ Handler, Boolean Add ); +}; + +public ref class MyApp +{ +private: + + // A private static handler function in the MyApp class. + static Boolean Handler( MyWin32::CtrlTypes CtrlType ) + { + String^ message = "This message should never be seen!"; + + // A switch to handle the event type. + switch ( CtrlType ) + { + case MyWin32::CtrlTypes::CTRL_C_EVENT: + message = "A CTRL_C_EVENT was raised by the user."; + break; + + case MyWin32::CtrlTypes::CTRL_BREAK_EVENT: + message = "A CTRL_BREAK_EVENT was raised by the user."; + break; + + case MyWin32::CtrlTypes::CTRL_CLOSE_EVENT: + message = "A CTRL_CLOSE_EVENT was raised by the user."; + break; + + case MyWin32::CtrlTypes::CTRL_LOGOFF_EVENT: + message = "A CTRL_LOGOFF_EVENT was raised by the user."; + break; + + case MyWin32::CtrlTypes::CTRL_SHUTDOWN_EVENT: + message = "A CTRL_SHUTDOWN_EVENT was raised by the user."; + break; + } + + // Use interop to display a message for the type of event. + Console::WriteLine( message ); + return true; + } + + +public: + static void Test() + { + + // Use interop to set a console control handler. + MyWin32::HandlerRoutine^ hr = gcnew MyWin32::HandlerRoutine( Handler ); + MyWin32::SetConsoleCtrlHandler( hr, true ); + + // Give the user some time to raise a few events. + Console::WriteLine( "Waiting 30 seconds for console ctrl events..." ); + + // The Object hr is not referred to again. + // The garbage collector can detect that the object has no + // more managed references and might clean it up here while + // the unmanaged SetConsoleCtrlHandler method is still using it. + // Force a garbage collection to demonstrate how the hr + // object will be handled. + GC::Collect(); + GC::WaitForPendingFinalizers(); + GC::Collect(); + Thread::Sleep( 30000 ); + + // Display a message to the console when the unmanaged method + // has finished its work. + Console::WriteLine( "Finished!" ); + + // Call GC::KeepAlive(hr) at this point to maintain a reference to hr. + // This will prevent the garbage collector from collecting the + // object during the execution of the SetConsoleCtrlHandler method. + GC::KeepAlive( hr ); + } + +}; + +int main() +{ + MyApp::Test(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp new file mode 100644 index 00000000000..9a8cc79ec77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.GC.ReRegisterForFinalize Example/CPP/class1.cpp @@ -0,0 +1,64 @@ + +// +using namespace System; +ref class MyFinalizeObject +{ +public: + static MyFinalizeObject^ currentInstance = nullptr; + +private: + bool hasFinalized; + +public: + MyFinalizeObject() + { + hasFinalized = false; + } + + ~MyFinalizeObject() + { + if ( !hasFinalized ) + { + Console::WriteLine( "First finalization" ); + + // Put this object back into a root by creating + // a reference to it. + MyFinalizeObject::currentInstance = this; + + // Indicate that this instance has finalized once. + hasFinalized = true; + + // Place a reference to this object back in the + // finalization queue. + GC::ReRegisterForFinalize( this ); + } + else + { + Console::WriteLine( "Second finalization" ); + } + } + +}; + +int main() +{ + + // Create a MyFinalizeObject. + MyFinalizeObject^ mfo = gcnew MyFinalizeObject; + + // Release the reference to mfo. + mfo = nullptr; + + // Force a garbage collection. + GC::Collect(); + + // At this point mfo will have gone through the first Finalize. + // There should now be a reference to mfo in the static + // MyFinalizeObject::currentInstance field. Setting this value + // to 0 and forcing another garbage collection will now + // cause the object to Finalize permanently. + MyFinalizeObject::currentInstance = nullptr; + GC::Collect(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp new file mode 100644 index 00000000000..c542afe35eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.GC.WaitForPendingFinalizers Example/CPP/class1.cpp @@ -0,0 +1,70 @@ + +// +using namespace System; +ref class MyFinalizeObject +{ +private: + + // Make this number very large to cause the finalizer to + // do more work. + literal int maxIterations = 10000; + ~MyFinalizeObject() + { + Console::WriteLine( "Finalizing a MyFinalizeObject" ); + + // Do some work. + for ( int i = 0; i < maxIterations; i++ ) + { + + // This method performs no operation on i, but prevents + // the JIT compiler from optimizing away the code inside + // the loop. + GC::KeepAlive( i ); + + } + } + +}; + + +// You can increase this number to fill up more memory. +const int numMfos = 1000; + +// You can increase this number to cause more +// post-finalization work to be done. +const int maxIterations = 100; +int main() +{ + MyFinalizeObject^ mfo = nullptr; + + // Create and release a large number of objects + // that require finalization. + for ( int j = 0; j < numMfos; j++ ) + { + mfo = gcnew MyFinalizeObject; + + } + + //Release the last object created in the loop. + mfo = nullptr; + + //Force garbage collection. + GC::Collect(); + + // Wait for all finalizers to complete before continuing. + // Without this call to GC::WaitForPendingFinalizers, + // the worker loop below might execute at the same time + // as the finalizers. + // With this call, the worker loop executes only after + // all finalizers have been called. + GC::WaitForPendingFinalizers(); + + // Worker loop to perform post-finalization code. + for ( int i = 0; i < maxIterations; i++ ) + { + Console::WriteLine( "Doing some post-finalize work" ); + + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp new file mode 100644 index 00000000000..4e3179203c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar.GetWeekOfYear/CPP/yslin_calendar_getweekofyear.cpp @@ -0,0 +1,37 @@ + +// The following code example shows how the result of GetWeekOfYear varies depending on the +// FirstDayOfWeek and the CalendarWeekRule used. +// If the specified date is the last day of the year, GetWeekOfYear returns the total number of weeks in that year. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Gets the Calendar instance associated with a CultureInfo. + CultureInfo^ myCI = gcnew CultureInfo( "en-US" ); + Calendar^ myCal = myCI->Calendar; + + // Gets the DTFI properties required by GetWeekOfYear. + CalendarWeekRule myCWR = myCI->DateTimeFormat->CalendarWeekRule; + DayOfWeek myFirstDOW = myCI->DateTimeFormat->FirstDayOfWeek; + + // Displays the number of the current week relative to the beginning of the year. + Console::WriteLine( "The CalendarWeekRule used for the en-US culture is {0}.", myCWR ); + Console::WriteLine( "The FirstDayOfWeek used for the en-US culture is {0}.", myFirstDOW ); + Console::WriteLine( "Therefore, the current week is Week {0} of the current year.", myCal->GetWeekOfYear( DateTime::Now, myCWR, myFirstDOW ) ); + + // Displays the total number of weeks in the current year. + DateTime LastDay = System::DateTime( DateTime::Now.Year, 12, 31 ); + Console::WriteLine( "There are {0} weeks in the current year ( {1}).", myCal->GetWeekOfYear( LastDay, myCWR, myFirstDOW ), LastDay.Year ); +} + +/* +This code produces the following output. Results vary depending on the system date. + +The CalendarWeekRule used for the en-US culture is FirstDay. +The FirstDayOfWeek used for the en-US culture is Sunday. +Therefore, the current week is Week 1 of the current year. +There are 53 weeks in the current year (2001). +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp new file mode 100644 index 00000000000..0df7a5a06b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar/CPP/calendar.cpp @@ -0,0 +1,77 @@ + +// The following code example demonstrates the members of the Calendar class. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine( " Hour: {0}", myCal->GetHour( myDT ) ); + Console::WriteLine( " Minute: {0}", myCal->GetMinute( myDT ) ); + Console::WriteLine( " Second: {0}", myCal->GetSecond( myDT ) ); + Console::WriteLine( " Milliseconds: {0}", myCal->GetMilliseconds( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Uses the default calendar of the InvariantCulture. + Calendar^ myCal = CultureInfo::InvariantCulture->Calendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds 5 to every component of the DateTime. + myDT = myCal->AddYears( myDT, 5 ); + myDT = myCal->AddMonths( myDT, 5 ); + myDT = myCal->AddWeeks( myDT, 5 ); + myDT = myCal->AddDays( myDT, 5 ); + myDT = myCal->AddHours( myDT, 5 ); + myDT = myCal->AddMinutes( myDT, 5 ); + myDT = myCal->AddSeconds( myDT, 5 ); + myDT = myCal->AddMilliseconds( myDT, 5 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding 5 to each component of the DateTime:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar: +Era: 1 +Year: 2002 +Month: 4 +DayOfYear: 93 +DayOfMonth: 3 +DayOfWeek: Wednesday +Hour: 0 +Minute: 0 +Second: 0 +Milliseconds: 0 + +After adding 5 to each component of the DateTime: +Era: 1 +Year: 2007 +Month: 10 +DayOfYear: 286 +DayOfMonth: 13 +DayOfWeek: Saturday +Hour: 5 +Minute: 5 +Second: 5 +Milliseconds: 5 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp new file mode 100644 index 00000000000..865e7a9526e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.Calendar_Compare/CPP/calendar_compare.cpp @@ -0,0 +1,125 @@ + +// The following code example compares different implementations of the Calendar class. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates an instance of every Calendar type. + array^myCals = gcnew array(8); + myCals[ 0 ] = gcnew GregorianCalendar; + myCals[ 1 ] = gcnew HebrewCalendar; + myCals[ 2 ] = gcnew HijriCalendar; + myCals[ 3 ] = gcnew JapaneseCalendar; + myCals[ 4 ] = gcnew JulianCalendar; + myCals[ 5 ] = gcnew KoreanCalendar; + myCals[ 6 ] = gcnew TaiwanCalendar; + myCals[ 7 ] = gcnew ThaiBuddhistCalendar; + + // For each calendar, displays the current year, the number of months in that year, + // and the number of days in each month of that year. + int i; + int j; + int iYear; + int iMonth; + int iDay; + DateTime myDT = DateTime::Today; + for ( i = 0; i < myCals->Length; i++ ) + { + iYear = myCals[ i ]->GetYear( myDT ); + Console::WriteLine(); + Console::WriteLine( " {0}, Year: {1}", myCals[ i ]->GetType(), myCals[ i ]->GetYear( myDT ) ); + Console::WriteLine( " MonthsInYear: {0}", myCals[ i ]->GetMonthsInYear( iYear ) ); + Console::WriteLine( " DaysInYear: {0}", myCals[ i ]->GetDaysInYear( iYear ) ); + Console::WriteLine( " Days in each month:" ); + Console::Write( " " ); + for ( j = 1; j <= myCals[ i ]->GetMonthsInYear( iYear ); j++ ) + Console::Write( " {0, -5}", myCals[ i ]->GetDaysInMonth( iYear, j ) ); + Console::WriteLine(); + iMonth = myCals[ i ]->GetMonth( myDT ); + iDay = myCals[ i ]->GetDayOfMonth( myDT ); + Console::WriteLine( " IsLeapDay: {0}", myCals[ i ]->IsLeapDay( iYear, iMonth, iDay ) ); + Console::WriteLine( " IsLeapMonth: {0}", myCals[ i ]->IsLeapMonth( iYear, iMonth ) ); + Console::WriteLine( " IsLeapYear: {0}", myCals[ i ]->IsLeapYear( iYear ) ); + + } +} + +/* +This code produces the following output. The results vary depending on the date. + +System::Globalization::GregorianCalendar, Year: 2002 +MonthsInYear: 12 +DaysInYear: 365 +Days in each month: +31 28 31 30 31 30 31 31 30 31 30 31 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: False + +System::Globalization::HebrewCalendar, Year: 5763 +MonthsInYear: 13 +DaysInYear: 385 +Days in each month: +30 30 30 29 30 30 29 30 29 30 29 30 29 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: True + +System::Globalization::HijriCalendar, Year: 1423 +MonthsInYear: 12 +DaysInYear: 355 +Days in each month: +30 29 30 29 30 29 30 29 30 29 30 30 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: True + +System::Globalization::JapaneseCalendar, Year: 14 +MonthsInYear: 12 +DaysInYear: 365 +Days in each month: +31 28 31 30 31 30 31 31 30 31 30 31 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: False + +System::Globalization::JulianCalendar, Year: 2002 +MonthsInYear: 12 +DaysInYear: 365 +Days in each month: +31 28 31 30 31 30 31 31 30 31 30 31 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: False + +System::Globalization::KoreanCalendar, Year: 4335 +MonthsInYear: 12 +DaysInYear: 365 +Days in each month: +31 28 31 30 31 30 31 31 30 31 30 31 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: False + +System::Globalization::TaiwanCalendar, Year: 91 +MonthsInYear: 12 +DaysInYear: 365 +Days in each month: +31 28 31 30 31 30 31 31 30 31 30 31 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: False + +System::Globalization::ThaiBuddhistCalendar, Year: 2545 +MonthsInYear: 12 +DaysInYear: 365 +Days in each month: +31 28 31 30 31 30 31 31 30 31 30 31 +IsLeapDay: False +IsLeapMonth: False +IsLeapYear: False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp new file mode 100644 index 00000000000..868fb637de7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_Char/CPP/charunicodeinfo_char.cpp @@ -0,0 +1,54 @@ + +// The following code example shows the values returned by each method for different types of characters. +// +using namespace System; +using namespace System::Globalization; +void PrintProperties( Char c ); +int main() +{ + Console::WriteLine( " c Num Dig Dec UnicodeCategory" ); + Console::Write( "U+0061 LATIN SMALL LETTER A " ); + PrintProperties( L'a' ); + Console::Write( "U+0393 GREEK CAPITAL LETTER GAMMA " ); + PrintProperties( L'\u0393' ); + Console::Write( "U+0039 DIGIT NINE " ); + PrintProperties( L'9' ); + Console::Write( "U+00B2 SUPERSCRIPT TWO " ); + PrintProperties( L'\u00B2' ); + Console::Write( "U+00BC VULGAR FRACTION ONE QUARTER " ); + PrintProperties( L'\u00BC' ); + Console::Write( "U+0BEF TAMIL DIGIT NINE " ); + PrintProperties( L'\u0BEF' ); + Console::Write( "U+0BF0 TAMIL NUMBER TEN " ); + PrintProperties( L'\u0BF0' ); + Console::Write( "U+0F33 TIBETAN DIGIT HALF ZERO " ); + PrintProperties( L'\u0F33' ); + Console::Write( "U+2788 CIRCLED SANS-SERIF DIGIT NINE " ); + PrintProperties( L'\u2788' ); +} + +void PrintProperties( Char c ) +{ + Console::Write( " {0,-3}", c ); + Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( c ) ); + Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( c ) ); + Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( c ) ); + Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( c ) ); +} + +/* +This code produces the following output. Some characters might not display at the console. + + c Num Dig Dec UnicodeCategory +U+0061 LATIN SMALL LETTER A a -1 -1 -1 LowercaseLetter +U+0393 GREEK CAPITAL LETTER GAMMA Γ -1 -1 -1 UppercaseLetter +U+0039 DIGIT NINE 9 9 9 9 DecimalDigitNumber +U+00B2 SUPERSCRIPT TWO ² 2 2 -1 OtherNumber +U+00BC VULGAR FRACTION ONE QUARTER ¼ 0.25 -1 -1 OtherNumber +U+0BEF TAMIL DIGIT NINE ௯ 9 9 9 DecimalDigitNumber +U+0BF0 TAMIL NUMBER TEN ௰ 10 -1 -1 OtherNumber +U+0F33 TIBETAN DIGIT HALF ZERO ༳ -0.5 -1 -1 OtherNumber +U+2788 CIRCLED SANS-SERIF DIGIT NINE ➈ 9 9 -1 OtherNumber + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp new file mode 100644 index 00000000000..1ff91fb5a7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CharUnicodeInfo_String/CPP/charunicodeinfo_string.cpp @@ -0,0 +1,41 @@ + +// The following code example shows the values returned by each method for different types of characters. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // The String to get information for. + String^ s = "a9\u0393\u00B2\u00BC\u0BEF\u0BF0\u2788"; + Console::WriteLine( "String: {0}", s ); + + // Print the values for each of the characters in the string. + Console::WriteLine( "index c Num Dig Dec UnicodeCategory" ); + for ( int i = 0; i < s->Length; i++ ) + { + Console::Write( "{0,-5} {1,-3}", i, s[ i ] ); + Console::Write( " {0,-5}", CharUnicodeInfo::GetNumericValue( s, i ) ); + Console::Write( " {0,-5}", CharUnicodeInfo::GetDigitValue( s, i ) ); + Console::Write( " {0,-5}", CharUnicodeInfo::GetDecimalDigitValue( s, i ) ); + Console::WriteLine( "{0}", CharUnicodeInfo::GetUnicodeCategory( s, i ) ); + + } +} + +/* +This code produces the following output. Some characters might not display at the console. + +String: a9Γ²¼௯௰➈ +index c Num Dig Dec UnicodeCategory +0 a -1 -1 -1 LowercaseLetter +1 9 9 9 9 DecimalDigitNumber +2 Γ -1 -1 -1 UppercaseLetter +3 ² 2 2 -1 OtherNumber +4 ¼ 0.25 -1 -1 OtherNumber +5 ௯ 9 9 9 DecimalDigitNumber +6 ௰ 10 -1 -1 OtherNumber +7 ➈ 9 9 -1 OtherNumber + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp new file mode 100644 index 00000000000..96de17a4d52 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntInt/CPP/comparestrintintstrintint.cpp @@ -0,0 +1,41 @@ + +// The following code example compares portions of two strings using the different CompareInfo instances: +// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort, +// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and +// a CompareInfo instance associated with the InvariantCulture. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "calle"; + String^ myStr2 = "calor"; + + // Uses GetCompareInfo to create the CompareInfo that uses the S"es-ES" culture with international sort. + CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" ); + + // Uses GetCompareInfo to create the CompareInfo that uses the S"es-ES" culture with traditional sort. + CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A ); + + // Uses the CompareInfo property of the InvariantCulture. + CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo; + + // Compares two strings using myCompIntl. + Console::WriteLine( "Comparing \" {0}\" and \" {1}\"", myStr1->Substring( 2, 2 ), myStr2->Substring( 2, 2 ) ); + Console::WriteLine( " With myCompIntl->Compare: {0}", myCompIntl->Compare( myStr1, 2, 2, myStr2, 2, 2 ) ); + Console::WriteLine( " With myCompTrad->Compare: {0}", myCompTrad->Compare( myStr1, 2, 2, myStr2, 2, 2 ) ); + Console::WriteLine( " With myCompInva->Compare: {0}", myCompInva->Compare( myStr1, 2, 2, myStr2, 2, 2 ) ); +} + +/* +This code produces the following output. + +Comparing S"ll" and S"lo" +With myCompIntl.Compare: -1 +With myCompTrad.Compare: 1 +With myCompInva.Compare: -1 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp new file mode 100644 index 00000000000..4c7273f97da --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntIntStrIntIntOpt/CPP/comparestrintintstrintintopt.cpp @@ -0,0 +1,40 @@ + +// The following code example compares portions of two strings using different CompareOptions settings. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "My Uncle Bill's clients"; + String^ myStr2 = "My uncle bills clients"; + + // Creates a CompareInfo that uses the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // Compares two strings using myComp. + Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 3, 10 ), myStr2->Substring( 3, 10 ) ); + Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10 ) ); + Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::None ) ); + Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::Ordinal ) ); + Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::StringSort ) ); + Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::IgnoreCase ) ); + Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, CompareOptions::IgnoreSymbols ) ); + Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, 3, 10, myStr2, 3, 10, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) ); +} + +/* +This code produces the following output. + +Comparing "Uncle Bill" and "uncle bill" + With no CompareOptions : 1 + With None : 1 + With Ordinal : -32 + With StringSort : 1 + With IgnoreCase : 0 + With IgnoreSymbols : 1 + With IgnoreCase and IgnoreSymbols : 0 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp new file mode 100644 index 00000000000..678b54b5912 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrInt/CPP/comparestrintstrint.cpp @@ -0,0 +1,42 @@ + +// The following code example compares portions of two strings using the different CompareInfo instances: +// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort, +// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and +// a CompareInfo instance associated with the InvariantCulture. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "calle"; + String^ myStr2 = "calor"; + + // Uses GetCompareInfo to create the CompareInfo that + // uses the S"es-ES" culture with international sort. + CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" ); + + // Uses GetCompareInfo to create the CompareInfo that + // uses the S"es-ES" culture with traditional sort. + CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A ); + + // Uses the CompareInfo property of the InvariantCulture. + CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo; + + // Compares two strings using myCompIntl. + Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 2 ), myStr2->Substring( 2 ) ); + Console::WriteLine( " With myCompIntl::Compare: {0}", myCompIntl->Compare( myStr1, 2, myStr2, 2 ) ); + Console::WriteLine( " With myCompTrad::Compare: {0}", myCompTrad->Compare( myStr1, 2, myStr2, 2 ) ); + Console::WriteLine( " With myCompInva::Compare: {0}", myCompInva->Compare( myStr1, 2, myStr2, 2 ) ); +} + +/* +This code produces the following output. + +Comparing "lle" and "lor" + With myCompIntl::Compare: -1 + With myCompTrad::Compare: 1 + With myCompInva::Compare: -1 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp new file mode 100644 index 00000000000..b180520da7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrIntStrIntOpt/CPP/comparestrintstrintopt.cpp @@ -0,0 +1,39 @@ + +// The following code example compares portions of two strings using different CompareOptions settings. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "My Uncle Bill's clients"; + String^ myStr2 = "My uncle bills clients"; + + // Creates a CompareInfo that uses the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // Compares two strings using myComp. + Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1->Substring( 10 ), myStr2->Substring( 10 ) ); + Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, 10, myStr2, 10 ) ); + Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::None ) ); + Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::Ordinal ) ); + Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::StringSort ) ); + Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::IgnoreCase ) ); + Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, 10, myStr2, 10, CompareOptions::IgnoreSymbols ) ); + Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, 10, myStr2, 10, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) ); +} + +/* +This code produces the following output. + +Comparing "ill's clients" and "ills clients" + With no CompareOptions : 1 + With None : 1 + With Ordinal : -76 + With StringSort : -1 + With IgnoreCase : 1 + With IgnoreSymbols : 0 + With IgnoreCase and IgnoreSymbols : 0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp new file mode 100644 index 00000000000..f479b4c5433 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStr/CPP/comparestrstr.cpp @@ -0,0 +1,41 @@ +// +// The following code example compares two strings using the different CompareInfo instances: +// a CompareInfo instance associated with the S"Spanish - Spain" culture with international sort, +// a CompareInfo instance associated with the S"Spanish - Spain" culture with traditional sort, and +// a CompareInfo instance associated with the InvariantCulture. +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "calle"; + String^ myStr2 = "calor"; + + // Uses GetCompareInfo to create the CompareInfo that + // uses the S"es-ES" culture with international sort. + CompareInfo^ myCompIntl = CompareInfo::GetCompareInfo( "es-ES" ); + + // Uses GetCompareInfo to create the CompareInfo that + // uses the S"es-ES" culture with traditional sort. + CompareInfo^ myCompTrad = CompareInfo::GetCompareInfo( 0x040A ); + + // Uses the CompareInfo property of the InvariantCulture. + CompareInfo^ myCompInva = CultureInfo::InvariantCulture->CompareInfo; + + // Compares two strings using myCompIntl. + Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 ); + Console::WriteLine( " With myCompIntl::Compare: {0}", myCompIntl->Compare( myStr1, myStr2 ) ); + Console::WriteLine( " With myCompTrad::Compare: {0}", myCompTrad->Compare( myStr1, myStr2 ) ); + Console::WriteLine( " With myCompInva::Compare: {0}", myCompInva->Compare( myStr1, myStr2 ) ); +} + +/* +This code produces the following output. + +Comparing "calle" and "calor" + With myCompIntl::Compare: -1 + With myCompTrad::Compare: 1 + With myCompInva::Compare: -1 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp new file mode 100644 index 00000000000..2e1193e0288 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.CompareStrStrOpt/CPP/comparestrstropt.cpp @@ -0,0 +1,39 @@ + +// The following code example compares two strings using different CompareOptions settings. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "My Uncle Bill's clients"; + String^ myStr2 = "My uncle bills clients"; + + // Creates a CompareInfo which uses the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // Compares two strings using myComp. + Console::WriteLine( "Comparing \"{0}\" and \"{1}\"", myStr1, myStr2 ); + Console::WriteLine( " With no CompareOptions : {0}", myComp->Compare( myStr1, myStr2 ) ); + Console::WriteLine( " With None : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::None ) ); + Console::WriteLine( " With Ordinal : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::Ordinal ) ); + Console::WriteLine( " With StringSort : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::StringSort ) ); + Console::WriteLine( " With IgnoreCase : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::IgnoreCase ) ); + Console::WriteLine( " With IgnoreSymbols : {0}", myComp->Compare( myStr1, myStr2, CompareOptions::IgnoreSymbols ) ); + Console::WriteLine( " With IgnoreCase and IgnoreSymbols : {0}", myComp->Compare( myStr1, myStr2, static_cast(CompareOptions::IgnoreCase | CompareOptions::IgnoreSymbols) ) ); +} + +/* +This code produces the following output. + +Comparing "My Uncle Bill's clients" and "My uncle bills clients" + With no CompareOptions : 1 + With None : 1 + With Ordinal : -32 + With StringSort : -1 + With IgnoreCase : 1 + With IgnoreSymbols : 1 + With IgnoreCase and IgnoreSymbols : 0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp new file mode 100644 index 00000000000..b82a9f2e5ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOf/CPP/indexof.cpp @@ -0,0 +1,118 @@ + +// The following code example determines the indexes of the first and last occurrences of a character or a substring within a string. +// +using namespace System; +using namespace System::Globalization; +void PrintMarker( String^ Prefix, int First, int Last ) +{ + + // Determines the size of the array to create. + int mySize; + if ( Last > First ) + mySize = Last; + else + mySize = First; + + if ( mySize > -1 ) + { + + // Creates an array of Char to hold the markers. + array^myCharArr = gcnew array(mySize + 1); + + // Inserts the appropriate markers. + if ( First > -1 ) + myCharArr[ First ] = 'f'; + if ( Last > -1 ) + myCharArr[ Last ] = 'l'; + if ( First == Last ) + myCharArr[ First ] = 'b'; + + // Displays the array of Char as a String. + Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) ); + } + else + Console::WriteLine( Prefix ); +} + +int main() +{ + + // Creates CompareInfo for the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // Searches for the ligature Æ. + String^ myStr = "Is AE or ae the same as Æ or æ?"; + Console::WriteLine(); + Console::WriteLine( "No options : {0}", myStr ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE" ), myComp->LastIndexOf( myStr, "AE" ) ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae" ), myComp->LastIndexOf( myStr, "ae" ) ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ' ), myComp->LastIndexOf( myStr, L'Æ' ) ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ' ), myComp->LastIndexOf( myStr, L'æ' ) ); + Console::WriteLine( "Ordinal : {0}", myStr ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "AE", CompareOptions::Ordinal ) ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "ae", CompareOptions::Ordinal ) ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Æ', CompareOptions::Ordinal ) ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'æ', CompareOptions::Ordinal ) ); + Console::WriteLine( "IgnoreCase : {0}", myStr ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "AE", CompareOptions::IgnoreCase ) ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "ae", CompareOptions::IgnoreCase ) ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Æ', CompareOptions::IgnoreCase ) ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'æ', CompareOptions::IgnoreCase ) ); + + // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. + myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?"; + Console::WriteLine(); + Console::WriteLine( "No options : {0}", myStr ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308" ), myComp->LastIndexOf( myStr, "U\u0308" ) ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308" ), myComp->LastIndexOf( myStr, "u\u0308" ) ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü' ), myComp->LastIndexOf( myStr, L'Ü' ) ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü' ), myComp->LastIndexOf( myStr, L'ü' ) ); + Console::WriteLine( "Ordinal : {0}", myStr ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "U\u0308", CompareOptions::Ordinal ) ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "u\u0308", CompareOptions::Ordinal ) ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Ü', CompareOptions::Ordinal ) ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'ü', CompareOptions::Ordinal ) ); + Console::WriteLine( "IgnoreCase : {0}", myStr ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "U\u0308", CompareOptions::IgnoreCase ) ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "u\u0308", CompareOptions::IgnoreCase ) ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Ü', CompareOptions::IgnoreCase ) ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'ü', CompareOptions::IgnoreCase ) ); +} + +/* +This code produces the following output. + +No options : Is AE or ae the same as Æ or æ? + AE : f l + ae : f l + Æ : f l + æ : f l +Ordinal : Is AE or ae the same as Æ or æ? + AE : b + ae : b + Æ : b + æ : b +IgnoreCase : Is AE or ae the same as Æ or æ? + AE : f l + ae : f l + Æ : f l + æ : f l + +No options : Is U" or u" the same as Ü or ü? + U" : f l + u" : f l + Ü : f l + ü : f l +Ordinal : Is U" or u" the same as Ü or ü? + U" : b + u" : b + Ü : b + ü : b +IgnoreCase : Is U" or u" the same as Ü or ü? + U" : f l + u" : f l + Ü : f l + ü : f l + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp new file mode 100644 index 00000000000..f5d3d8ae905 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfInt/CPP/indexofint.cpp @@ -0,0 +1,205 @@ + +// The following code example determines the indexes of the first and last occurrences of a character or a substring within a portion of a string. +// Note that IndexOf and LastIndexOf are searching in different portions of the string, even with the same StartIndex parameter. +// +using namespace System; +using namespace System::Globalization; +void PrintMarker( String^ Prefix, int First, int Last ) +{ + + // Determines the size of the array to create. + int mySize; + if ( Last > First ) + mySize = Last; + else + mySize = First; + + if ( mySize > -1 ) + { + + // Creates an array of Char to hold the markers. + array^myCharArr = gcnew array(mySize + 1); + + // Inserts the appropriate markers. + if ( First > -1 ) + myCharArr[ First ] = 'f'; + if ( Last > -1 ) + myCharArr[ Last ] = 'l'; + if ( First == Last ) + myCharArr[ First ] = 'b'; + + // Displays the array of Char as a String. + Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) ); + } + else + Console::WriteLine( Prefix ); +} + +int main() +{ + + // Creates CompareInfo for the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // iS is the starting index of the substring. + int iS = 20; + + // myT1 is the string used for padding. + String^ myT1; + + // Searches for the ligature Æ. + String^ myStr = "Is AE or ae the same as Æ or æ?"; + Console::WriteLine(); + myT1 = gcnew String( '-',iS ); + Console::WriteLine( "IndexOf( String, *, {0}, * )", iS ); + Console::WriteLine( "Original : {0}", myStr ); + Console::WriteLine( "No options : {0}{1}", myT1, myStr->Substring( iS ) ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS ), -1 ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS ), -1 ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS ), -1 ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS ), -1 ); + Console::WriteLine( "Ordinal : {0}{1}", myT1, myStr->Substring( iS ) ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, CompareOptions::Ordinal ), -1 ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, CompareOptions::Ordinal ), -1 ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, CompareOptions::Ordinal ), -1 ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, CompareOptions::Ordinal ), -1 ); + Console::WriteLine( "IgnoreCase : {0}{1}", myT1, myStr->Substring( iS ) ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, CompareOptions::IgnoreCase ), -1 ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, CompareOptions::IgnoreCase ), -1 ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, CompareOptions::IgnoreCase ), -1 ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, CompareOptions::IgnoreCase ), -1 ); + myT1 = gcnew String( '-',myStr->Length - iS - 1 ); + Console::WriteLine( "LastIndexOf( String, *, {0}, * )", iS ); + Console::WriteLine( "Original : {0}", myStr ); + Console::WriteLine( "No options : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); + PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS ) ); + PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS ) ); + PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS ) ); + PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS ) ); + Console::WriteLine( "Ordinal : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); + PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS, CompareOptions::Ordinal ) ); + PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS, CompareOptions::Ordinal ) ); + PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS, CompareOptions::Ordinal ) ); + PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS, CompareOptions::Ordinal ) ); + Console::WriteLine( "IgnoreCase : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); + PrintMarker( " AE : ", -1, myComp->LastIndexOf( myStr, "AE", iS, CompareOptions::IgnoreCase ) ); + PrintMarker( " ae : ", -1, myComp->LastIndexOf( myStr, "ae", iS, CompareOptions::IgnoreCase ) ); + PrintMarker( " Æ : ", -1, myComp->LastIndexOf( myStr, L'Æ', iS, CompareOptions::IgnoreCase ) ); + PrintMarker( " æ : ", -1, myComp->LastIndexOf( myStr, L'æ', iS, CompareOptions::IgnoreCase ) ); + + // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. + myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?"; + Console::WriteLine(); + myT1 = gcnew String( '-',iS ); + Console::WriteLine( "IndexOf( String, *, {0}, * )", iS ); + Console::WriteLine( "Original : {0}", myStr ); + Console::WriteLine( "No options : {0}{1}", myT1, myStr->Substring( iS ) ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS ), -1 ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS ), -1 ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS ), -1 ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS ), -1 ); + Console::WriteLine( "Ordinal : {0}{1}", myT1, myStr->Substring( iS ) ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, CompareOptions::Ordinal ), -1 ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, CompareOptions::Ordinal ), -1 ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, CompareOptions::Ordinal ), -1 ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, CompareOptions::Ordinal ), -1 ); + Console::WriteLine( "IgnoreCase : {0}{1}", myT1, myStr->Substring( iS ) ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, CompareOptions::IgnoreCase ), -1 ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, CompareOptions::IgnoreCase ), -1 ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, CompareOptions::IgnoreCase ), -1 ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, CompareOptions::IgnoreCase ), -1 ); + myT1 = gcnew String( '-',myStr->Length - iS - 1 ); + Console::WriteLine( "LastIndexOf( String, *, {0}, * )", iS ); + Console::WriteLine( "Original : {0}", myStr ); + Console::WriteLine( "No options : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); + PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS ) ); + PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS ) ); + PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS ) ); + PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS ) ); + Console::WriteLine( "Ordinal : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); + PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS, CompareOptions::Ordinal ) ); + PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS, CompareOptions::Ordinal ) ); + PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS, CompareOptions::Ordinal ) ); + PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS, CompareOptions::Ordinal ) ); + Console::WriteLine( "IgnoreCase : {0}{1}", myStr->Substring( 0, iS + 1 ), myT1 ); + PrintMarker( " U\u0308 : ", -1, myComp->LastIndexOf( myStr, "U\u0308", iS, CompareOptions::IgnoreCase ) ); + PrintMarker( " u\u0308 : ", -1, myComp->LastIndexOf( myStr, "u\u0308", iS, CompareOptions::IgnoreCase ) ); + PrintMarker( " Ü : ", -1, myComp->LastIndexOf( myStr, L'Ü', iS, CompareOptions::IgnoreCase ) ); + PrintMarker( " ü : ", -1, myComp->LastIndexOf( myStr, L'ü', iS, CompareOptions::IgnoreCase ) ); +} + +/* +This code produces the following output. + +IndexOf( String, *, 20, * ) +Original : Is AE or ae the same as Æ or æ? +No options : -------------------- as Æ or æ? + AE : f + ae : f + Æ : f + æ : f +Ordinal : -------------------- as Æ or æ? + AE : + ae : + Æ : f + æ : f +IgnoreCase : -------------------- as Æ or æ? + AE : f + ae : f + Æ : f + æ : f +LastIndexOf( String, *, 20, * ) +Original : Is AE or ae the same as Æ or æ? +No options : Is AE or ae the same ---------- + AE : l + ae : l + Æ : l + æ : l +Ordinal : Is AE or ae the same ---------- + AE : l + ae : l + Æ : + æ : +IgnoreCase : Is AE or ae the same ---------- + AE : l + ae : l + Æ : l + æ : l + +IndexOf( String, *, 20, * ) +Original : Is U" or u" the same as Ü or ü? +No options : -------------------- as Ü or ü? + U" : f + u" : f + Ü : f + ü : f +Ordinal : -------------------- as Ü or ü? + U" : + u" : + Ü : f + ü : f +IgnoreCase : -------------------- as Ü or ü? + U" : f + u" : f + Ü : f + ü : f +LastIndexOf( String, *, 20, * ) +Original : Is U" or u" the same as Ü or ü? +No options : Is U" or u" the same ---------- + U" : l + u" : l + Ü : l + ü : l +Ordinal : Is U" or u" the same ---------- + U" : l + u" : l + Ü : + ü : +IgnoreCase : Is U" or u" the same ---------- + U" : l + u" : l + Ü : l + ü : l + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp new file mode 100644 index 00000000000..381970926e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IndexOfIntInt/CPP/indexofintint.cpp @@ -0,0 +1,134 @@ + +// The following code example determines the indexes of the first and last occurrences of a character or a substring within a portion of a string. +// +using namespace System; +using namespace System::Globalization; +void PrintMarker( String^ Prefix, int First, int Last ) +{ + + // Determines the size of the array to create. + int mySize; + if ( Last > First ) + mySize = Last; + else + mySize = First; + + if ( mySize > -1 ) + { + + // Creates an array of Char to hold the markers. + array^myCharArr = gcnew array(mySize + 1); + + // Inserts the appropriate markers. + if ( First > -1 ) + myCharArr[ First ] = 'f'; + if ( Last > -1 ) + myCharArr[ Last ] = 'l'; + if ( First == Last ) + myCharArr[ First ] = 'b'; + + // Displays the array of Char as a String. + Console::WriteLine( "{0}{1}", Prefix, gcnew String( myCharArr ) ); + } + else + Console::WriteLine( Prefix ); +} + +int main() +{ + + // Creates CompareInfo for the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // iS is the starting index of the substring. + int iS = 8; + + // iL is the length of the substring. + int iL = 18; + + // myT1 and myT2 are the strings used for padding. + String^ myT1 = gcnew String( '-',iS ); + String^ myT2; + + // Searches for the ligature Æ. + String^ myStr = "Is AE or ae the same as Æ or æ?"; + myT2 = gcnew String( '-',myStr->Length - iS - iL ); + Console::WriteLine(); + Console::WriteLine( "Original : {0}", myStr ); + Console::WriteLine( "No options : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL ) ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL ) ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL ) ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL ) ); + Console::WriteLine( "Ordinal : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL, CompareOptions::Ordinal ) ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL, CompareOptions::Ordinal ) ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL, CompareOptions::Ordinal ) ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL, CompareOptions::Ordinal ) ); + Console::WriteLine( "IgnoreCase : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); + PrintMarker( " AE : ", myComp->IndexOf( myStr, "AE", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "AE", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + PrintMarker( " ae : ", myComp->IndexOf( myStr, "ae", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "ae", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + PrintMarker( " Æ : ", myComp->IndexOf( myStr, L'Æ', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Æ', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + PrintMarker( " æ : ", myComp->IndexOf( myStr, L'æ', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'æ', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + + // Searches for the combining character sequence Latin capital letter U with diaeresis or Latin small letter u with diaeresis. + myStr = "Is U\u0308 or u\u0308 the same as \u00DC or \u00FC?"; + myT2 = gcnew String( '-',myStr->Length - iS - iL ); + Console::WriteLine(); + Console::WriteLine( "Original : {0}", myStr ); + Console::WriteLine( "No options : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL ) ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL ) ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL ) ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL ) ); + Console::WriteLine( "Ordinal : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL, CompareOptions::Ordinal ) ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL, CompareOptions::Ordinal ) ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL, CompareOptions::Ordinal ) ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL, CompareOptions::Ordinal ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL, CompareOptions::Ordinal ) ); + Console::WriteLine( "IgnoreCase : {0}{1}{2}", myT1, myStr->Substring( iS, iL ), myT2 ); + PrintMarker( " U\u0308 : ", myComp->IndexOf( myStr, "U\u0308", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "U\u0308", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + PrintMarker( " u\u0308 : ", myComp->IndexOf( myStr, "u\u0308", iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, "u\u0308", iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + PrintMarker( " Ü : ", myComp->IndexOf( myStr, L'Ü', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'Ü', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); + PrintMarker( " ü : ", myComp->IndexOf( myStr, L'ü', iS, iL, CompareOptions::IgnoreCase ), myComp->LastIndexOf( myStr, L'ü', iS + iL - 1, iL, CompareOptions::IgnoreCase ) ); +} + +/* +This code produces the following output. + +Original : Is AE or ae the same as Æ or æ? +No options : -------- ae the same as Æ ----- + AE : b + ae : b + Æ : b + æ : b +Ordinal : -------- ae the same as Æ ----- + AE : + ae : b + Æ : b + æ : +IgnoreCase : -------- ae the same as Æ ----- + AE : f l + ae : f l + Æ : f l + æ : f l + +Original : Is U" or u" the same as Ü or ü? +No options : -------- u" the same as Ü ----- + U" : b + u" : b + Ü : b + ü : b +Ordinal : -------- u" the same as Ü ----- + U" : + u" : b + Ü : b + ü : +IgnoreCase : -------- u" the same as Ü ----- + U" : f l + u" : f l + Ü : f l + ü : f l + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp new file mode 100644 index 00000000000..67bd06172ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffix/CPP/isprefixsuffix.cpp @@ -0,0 +1,35 @@ + +// The following code example determines whether a String* is the prefix or suffix of another String*. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "calle"; + String^ myStr2 = "llegar"; + String^ myXfix = "lle"; + + // Uses the CompareInfo property of the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + + // Determines whether myXfix is a prefix of S"calle" and S"llegar". + Console::WriteLine( "IsPrefix( {0}, {1}) : {2}", myStr1, myXfix, myComp->IsPrefix( myStr1, myXfix ) ); + Console::WriteLine( "IsPrefix( {0}, {1}) : {2}", myStr2, myXfix, myComp->IsPrefix( myStr2, myXfix ) ); + + // Determines whether myXfix is a suffix of S"calle" and S"llegar". + Console::WriteLine( "IsSuffix( {0}, {1}) : {2}", myStr1, myXfix, myComp->IsSuffix( myStr1, myXfix ) ); + Console::WriteLine( "IsSuffix( {0}, {1}) : {2}", myStr2, myXfix, myComp->IsSuffix( myStr2, myXfix ) ); +} + +/* +This code produces the following output. + +IsPrefix(calle, lle) : False +IsPrefix(llegar, lle) : True +IsSuffix(calle, lle) : True +IsSuffix(llegar, lle) : False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp new file mode 100644 index 00000000000..4873c4342d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CompareInfo.IsPrefixSuffixOpt/CPP/isprefixsuffixopt.cpp @@ -0,0 +1,42 @@ + +// The following code example determines whether a String* is the prefix or suffix of another String* using CompareOptions. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the strings to compare. + String^ myStr1 = "calle"; + String^ myStr2 = "llegar"; + String^ myXfix = "LLE"; + + // Uses the CompareInfo property of the InvariantCulture. + CompareInfo^ myComp = CultureInfo::InvariantCulture->CompareInfo; + Console::WriteLine( "IsSuffix \"{0}\", \"{1}\"", myStr1, myXfix ); + Console::WriteLine( " With no CompareOptions : {0}", myComp->IsSuffix( myStr1, myXfix ) ); + Console::WriteLine( " With None : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::None ) ); + Console::WriteLine( " With Ordinal : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::Ordinal ) ); + Console::WriteLine( " With IgnoreCase : {0}", myComp->IsSuffix( myStr1, myXfix, CompareOptions::IgnoreCase ) ); + Console::WriteLine( "IsPrefix \"{0}\", \"{1}\"", myStr2, myXfix ); + Console::WriteLine( " With no CompareOptions : {0}", myComp->IsPrefix( myStr2, myXfix ) ); + Console::WriteLine( " With None : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::None ) ); + Console::WriteLine( " With Ordinal : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::Ordinal ) ); + Console::WriteLine( " With IgnoreCase : {0}", myComp->IsPrefix( myStr2, myXfix, CompareOptions::IgnoreCase ) ); +} + +/* +This code produces the following output. + +IsSuffix "calle", "LLE" + With no CompareOptions : False + With None : False + With Ordinal : False + With IgnoreCase : True +IsPrefix "llegar", "LLE" + With no CompareOptions : False + With None : False + With Ordinal : False + With IgnoreCase : True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp new file mode 100644 index 00000000000..36c0e20d3fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Clone/CPP/yslin_cultureinfo_clone.cpp @@ -0,0 +1,37 @@ + +// The following code example shows that CultureInfo::Clone also clones the DateTimeFormatInfo and +// NumberFormatInfo instances associated with the CultureInfo. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a CultureInfo. + CultureInfo^ myCI = gcnew CultureInfo( "en-US",false ); + + // Clones myCI and modifies the DTFI and NFI instances associated with the clone. + CultureInfo^ myCIclone = dynamic_cast(myCI->Clone()); + myCIclone->DateTimeFormat->AMDesignator = "a.m."; + myCIclone->DateTimeFormat->DateSeparator = "-"; + myCIclone->NumberFormat->CurrencySymbol = "USD"; + myCIclone->NumberFormat->NumberDecimalDigits = 4; + + // Displays the properties of the DTFI and NFI instances associated with the original and with the clone. + Console::WriteLine( "DTFI/NFI PROPERTY\tORIGINAL\tMODIFIED CLONE" ); + Console::WriteLine( "DTFI.AMDesignator\t{0}\t\t{1}", myCI->DateTimeFormat->AMDesignator, myCIclone->DateTimeFormat->AMDesignator ); + Console::WriteLine( "DTFI.DateSeparator\t{0}\t\t{1}", myCI->DateTimeFormat->DateSeparator, myCIclone->DateTimeFormat->DateSeparator ); + Console::WriteLine( "NFI.CurrencySymbol\t{0}\t\t{1}", myCI->NumberFormat->CurrencySymbol, myCIclone->NumberFormat->CurrencySymbol ); + Console::WriteLine( "NFI.NumberDecimalDigits\t{0}\t\t{1}", myCI->NumberFormat->NumberDecimalDigits, myCIclone->NumberFormat->NumberDecimalDigits ); +} + +/* +This code produces the following output. + +DTFI/NFI PROPERTY ORIGINAL MODIFIED CLONE +DTFI.AMDesignator AM a.m. +DTFI.DateSeparator / - +NFI.CurrencySymbol $ USD +NFI.NumberDecimalDigits 2 4 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp new file mode 100644 index 00000000000..39d0500f201 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.CurrentCulture2/CPP/currentculture.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Globalization; +using namespace System::Threading; + +int main() +{ + // Display the name of the current thread culture. + Console::WriteLine("CurrentCulture is {0}.", CultureInfo::CurrentCulture->Name); + + // Change the current culture to th-TH. + CultureInfo::CurrentCulture = gcnew CultureInfo("th-TH",false); + Console::WriteLine("CurrentCulture is now {0}.", CultureInfo::CurrentCulture->Name); + + // Displays the name of the CurrentUICulture of the current thread. + Console::WriteLine("CurrentUICulture is {0}.", CultureInfo::CurrentCulture->Name); + + // Changes the CurrentUICulture of the current thread to ja-JP. + CultureInfo::CurrentUICulture = gcnew CultureInfo("ja-JP",false); + Console::WriteLine("CurrentUICulture is now {0}.", CultureInfo::CurrentCulture->Name); +} +// The example displays the following output: +// CurrentCulture is en-US. +// CurrentCulture is now th-TH. +// CurrentUICulture is en-US. +// CurrentUICulture is now ja-JP. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp new file mode 100644 index 00000000000..895e3754d36 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.GetCultures/CPP/getcultures.cpp @@ -0,0 +1,45 @@ + +// The following code example displays several properties of the neutral cultures. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Displays several properties of the neutral cultures. + Console::WriteLine( "CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME" ); + System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::NeutralCultures )->GetEnumerator(); + while ( enum0->MoveNext() ) + { + CultureInfo^ ci = safe_cast(enum0->Current); + Console::Write( "{0,-7}", ci->Name ); + Console::Write( " {0,-3}", ci->TwoLetterISOLanguageName ); + Console::Write( " {0,-3}", ci->ThreeLetterISOLanguageName ); + Console::Write( " {0,-3}", ci->ThreeLetterWindowsLanguageName ); + Console::Write( " {0,-40}", ci->DisplayName ); + Console::WriteLine( " {0,-40}", ci->EnglishName ); + } +} + +/* +This code produces the following output. This output has been cropped for brevity. + +CULTURE ISO ISO WIN DISPLAYNAME ENGLISHNAME +ar ar ara ARA Arabic Arabic +bg bg bul BGR Bulgarian Bulgarian +ca ca cat CAT Catalan Catalan +zh-Hans zh zho CHS Chinese (Simplified) Chinese (Simplified) +cs cs ces CSY Czech Czech +da da dan DAN Danish Danish +de de deu DEU German German +el el ell ELL Greek Greek +en en eng ENU English English +es es spa ESP Spanish Spanish +fi fi fin FIN Finnish Finnish +zh zh zho CHS Chinese Chinese +zh-Hant zh zho CHT Chinese (Traditional) Chinese (Traditional) +zh-CHS zh zho CHS Chinese (Simplified) Legacy Chinese (Simplified) Legacy +zh-CHT zh zho CHT Chinese (Traditional) Legacy Chinese (Traditional) Legacy + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp new file mode 100644 index 00000000000..c7d200f5865 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.IsNeutralCulture2/CPP/neutralculture.cpp @@ -0,0 +1,44 @@ + +// The following code example determines which cultures using the Chinese language are neutral cultures. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Lists the cultures that use the Chinese language and determines if each is a neutral culture. + System::Collections::IEnumerator^ enum0 = CultureInfo::GetCultures( CultureTypes::AllCultures )->GetEnumerator(); + while ( enum0->MoveNext() ) + { + CultureInfo^ ci = safe_cast(enum0->Current); + if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) ) + { + Console::Write( "{0,-7} {1,-40}", ci->Name, ci->EnglishName ); + if ( ci->IsNeutralCulture ) + { + Console::WriteLine( ": neutral" ); + } + else + { + Console::WriteLine( ": specific" ); + } + } + } +} + +/* +This code produces the following output. + +zh-Hans Chinese (Simplified) : neutral +zh-TW Chinese (Traditional, Taiwan) : specific +zh-CN Chinese (Simplified, PRC) : specific +zh-HK Chinese (Traditional, Hong Kong S.A.R.) : specific +zh-SG Chinese (Simplified, Singapore) : specific +zh-MO Chinese (Traditional, Macao S.A.R.) : specific +zh Chinese : neutral +zh-Hant Chinese (Traditional) : neutral +zh-CHS Chinese (Simplified) Legacy : neutral +zh-CHT Chinese (Traditional) Legacy : neutral + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp new file mode 100644 index 00000000000..bc3ff941693 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.Parent/CPP/parentculture.cpp @@ -0,0 +1,38 @@ + +// The following code example displays the parent culture of each specific +// culture using the Chinese language. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Prints the header. + Console::WriteLine( "SPECIFIC CULTURE PARENT CULTURE" ); + + // Determines the specific cultures that use the Chinese language, + // and displays the parent culture. + System::Collections::IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator(); + while ( en->MoveNext() ) + { + CultureInfo^ ci = safe_cast(en->Current); + if ( ci->TwoLetterISOLanguageName->Equals( "zh" ) ) + { + Console::Write( "0x{0} {1} {2,-40}", ci->LCID.ToString( "X4" ), ci->Name, ci->EnglishName ); + Console::WriteLine( "0x{0} {1} {2}", ci->Parent->LCID.ToString( "X4" ), ci->Parent->Name, ci->Parent->EnglishName ); + } + } +} + +/* +This code produces the following output. + +SPECIFIC CULTURE PARENT CULTURE +0x0404 zh-TW Chinese (Traditional, Taiwan) 0x7C04 zh-CHT Chinese (Traditional) Legacy +0x0804 zh-CN Chinese (Simplified, PRC) 0x0004 zh-CHS Chinese (Simplified) Legacy +0x0C04 zh-HK Chinese (Traditional, Hong Kong S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy +0x1004 zh-SG Chinese (Simplified, Singapore) 0x0004 zh-CHS Chinese (Simplified) Legacy +0x1404 zh-MO Chinese (Traditional, Macao S.A.R.) 0x7C04 zh-CHT Chinese (Traditional) Legacy + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp new file mode 100644 index 00000000000..c2e98b06394 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo.ReadOnly/CPP/yslin_cultureinfo_readonly.cpp @@ -0,0 +1,35 @@ + +// The following code example shows that CultureInfo::ReadOnly also protects the +// DateTimeFormatInfo and NumberFormatInfo instances associated with the CultureInfo. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates a CultureInfo. + CultureInfo^ myCI = gcnew CultureInfo( "en-US" ); + + // Creates a read-only CultureInfo based on myCI -> + CultureInfo^ myReadOnlyCI = CultureInfo::ReadOnly( myCI ); + + // Display the read-only status of each CultureInfo and their DateTimeFormat and NumberFormat properties. + Console::WriteLine( "myCI is {0}.", myCI->IsReadOnly ? (String^)"read only" : "writable" ); + Console::WriteLine( "myCI -> DateTimeFormat is {0}.", myCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" ); + Console::WriteLine( "myCI -> NumberFormat is {0}.", myCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" ); + Console::WriteLine( "myReadOnlyCI is {0}.", myReadOnlyCI->IsReadOnly ? (String^)"read only" : "writable" ); + Console::WriteLine( "myReadOnlyCI -> DateTimeFormat is {0}.", myReadOnlyCI->DateTimeFormat->IsReadOnly ? (String^)"read only" : "writable" ); + Console::WriteLine( "myReadOnlyCI -> NumberFormat is {0}.", myReadOnlyCI->NumberFormat->IsReadOnly ? (String^)"read only" : "writable" ); +} + +/* +This code produces the following output. + +myCI is writable. +myCI -> DateTimeFormat is writable. +myCI -> NumberFormat is writable. +myReadOnlyCI is read only. +myReadOnlyCI -> DateTimeFormat is read only. +myReadOnlyCI -> NumberFormat is read only. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp new file mode 100644 index 00000000000..5a683e17740 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.CultureInfo_esES/CPP/spanishspain.cpp @@ -0,0 +1,63 @@ + +// The following code example shows how to create a CultureInfo for S"Spanish - Spain" +// with the international sort and another with the traditional sort. +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes the CultureInfo which uses the international sort. + CultureInfo^ myCIintl = gcnew CultureInfo( "es-ES",false ); + + // Creates and initializes the CultureInfo which uses the traditional sort. + CultureInfo^ myCItrad = gcnew CultureInfo( 0x040A,false ); + + // Displays the properties of each culture. + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "PROPERTY", "INTERNATIONAL", "TRADITIONAL" ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "CompareInfo", myCIintl->CompareInfo, myCItrad->CompareInfo ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "DisplayName", myCIintl->DisplayName, myCItrad->DisplayName ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "EnglishName", myCIintl->EnglishName, myCItrad->EnglishName ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsNeutralCulture", myCIintl->IsNeutralCulture, myCItrad->IsNeutralCulture ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "IsReadOnly", myCIintl->IsReadOnly, myCItrad->IsReadOnly ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "LCID", myCIintl->LCID, myCItrad->LCID ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Name", myCIintl->Name, myCItrad->Name ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "NativeName", myCIintl->NativeName, myCItrad->NativeName ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "Parent", myCIintl->Parent, myCItrad->Parent ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TextInfo", myCIintl->TextInfo, myCItrad->TextInfo ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterISOLanguageName", myCIintl->ThreeLetterISOLanguageName, myCItrad->ThreeLetterISOLanguageName ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "ThreeLetterWindowsLanguageName", myCIintl->ThreeLetterWindowsLanguageName, myCItrad->ThreeLetterWindowsLanguageName ); + Console::WriteLine( "{0,-31}{1,-47}{2,-25}", "TwoLetterISOLanguageName", myCIintl->TwoLetterISOLanguageName, myCItrad->TwoLetterISOLanguageName ); + Console::WriteLine(); + + // Compare two strings using myCIintl -> + Console::WriteLine( "Comparing \"llegar\" and \"lugar\"" ); + Console::WriteLine( " With myCIintl -> CompareInfo -> Compare: {0}", myCIintl->CompareInfo->Compare( "llegar", "lugar" ) ); + Console::WriteLine( " With myCItrad -> CompareInfo -> Compare: {0}", myCItrad->CompareInfo->Compare( "llegar", "lugar" ) ); +} + +/* +This code produces the following output. + +PROPERTY INTERNATIONAL TRADITIONAL +CompareInfo CompareInfo - es-ES CompareInfo - es-ES_tradnl +DisplayName Spanish (Spain) Spanish (Spain) +EnglishName Spanish (Spain, International Sort) Spanish (Spain, Traditional Sort) +IsNeutralCulture False False +IsReadOnly False False +LCID 3082 1034 +Name es-ES es-ES +NativeName Español (España, alfabetización internacional) Español (España, alfabetización tradicional) +Parent es es +TextInfo TextInfo - es-ES TextInfo - es-ES_tradnl +ThreeLetterISOLanguageName spa spa +ThreeLetterWindowsLanguageName ESN ESP +TwoLetterISOLanguageName es es + +Comparing "llegar" and "lugar" + With myCIintl -> CompareInfo -> Compare: -1 + With myCItrad -> CompareInfo -> Compare: 1 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp new file mode 100644 index 00000000000..c9f0bdb0a61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.FullDateTimePattern/CPP/dtfi_fulldatetimepattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of FullDateTimePattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->FullDateTimePattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. The question marks take the place of native script characters. + +CULTURE PROPERTY VALUE +en-US dddd, MMMM dd, yyyy h:mm:ss tt +ja-JP yyyy'å¹´'M'月'd'æ—¥' H:mm:ss +fr-FR dddd d MMMM yyyy HH:mm:ss + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp new file mode 100644 index 00000000000..64fb0d7708a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongDatePattern/CPP/dtfi_longdatepattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of LongDatePattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->LongDatePattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output: + +CULTURE PROPERTY VALUE +en-US dddd, MMMM dd, yyyy +ja-JP yyyy'å¹´'M'月'd'æ—¥' +fr-FR dddd d MMMM yyyy + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp new file mode 100644 index 00000000000..035bc98e2a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.LongTimePattern/CPP/dtfi_longtimepattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of LongTimePattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->LongTimePattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. + +CULTURE PROPERTY VALUE +en-US h:mm:ss tt +ja-JP H:mm:ss +fr-FR HH:mm:ss + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp new file mode 100644 index 00000000000..29e0b173c0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.MonthDayPattern/CPP/dtfi_monthdaypattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of MonthDayPattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->MonthDayPattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. The question marks take the place of native script characters. + +CULTURE PROPERTY VALUE +en-US MMMM dd +ja-JP M'?'d'?' +fr-FR d MMMM + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp new file mode 100644 index 00000000000..6f5088a4914 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.RFC1123Pattern/CPP/dtfi_rfc1123pattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of RFC1123Pattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->RFC1123Pattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. + +CULTURE PROPERTY VALUE +en-US ddd, dd MMM yyyy HH':'mm':'ss 'GMT' +ja-JP ddd, dd MMM yyyy HH':'mm':'ss 'GMT' +fr-FR ddd, dd MMM yyyy HH':'mm':'ss 'GMT' + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp new file mode 100644 index 00000000000..7bc1dc8a065 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.ShortTimePattern/CPP/dtfi_shorttimepattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of ShortTimePattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->ShortTimePattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. + +CULTURE PROPERTY VALUE +en-US h:mm tt +ja-JP H:mm +fr-FR HH:mm + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp new file mode 100644 index 00000000000..e49b6b214a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.SortableDateTimePattern/CPP/dtfi_sortabledatetimepattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of SortableDateTimePattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->SortableDateTimePattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. + +CULTURE PROPERTY VALUE +en-US yyyy'-'MM'-'dd'T'HH':'mm':'ss +ja-JP yyyy'-'MM'-'dd'T'HH':'mm':'ss +fr-FR yyyy'-'MM'-'dd'T'HH':'mm':'ss + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp new file mode 100644 index 00000000000..f3e77ca4e46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.UniversalSortableDateTimePattern/CPP/dtfi_universalsortabledatetimepattern.cpp @@ -0,0 +1,33 @@ + +// The following code example displays the value of UniversalSortableDateTimePattern +// for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->UniversalSortableDateTimePattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. + +CULTURE PROPERTY VALUE +en-US yyyy'-'MM'-'dd HH':'mm':'ss'Z' +ja-JP yyyy'-'MM'-'dd HH':'mm':'ss'Z' +fr-FR yyyy'-'MM'-'dd HH':'mm':'ss'Z' + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp new file mode 100644 index 00000000000..549fe6aecfd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.DateTimeFormatInfo.YearMonthPattern/CPP/dtfi_yearmonthpattern.cpp @@ -0,0 +1,32 @@ + +// The following code example displays the value of YearMonthPattern for selected cultures. +// +using namespace System; +using namespace System::Globalization; +void PrintPattern( String^ myCulture ) +{ + CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false ); + DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat; + Console::WriteLine( " {0} {1}", myCulture, myDTFI->YearMonthPattern ); +} + +int main() +{ + + // Displays the values of the pattern properties. + Console::WriteLine( " CULTURE PROPERTY VALUE" ); + PrintPattern( "en-US" ); + PrintPattern( "ja-JP" ); + PrintPattern( "fr-FR" ); +} + +/* +This code produces the following output. The question marks take the place of native script characters. + + CULTURE PROPERTY VALUE + en-US MMMM yyyy + ja-JP yyyyå¹´M月 + fr-FR MMMM yyyy + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..cde0e811c88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInMonth/CPP/gregoriancalendar_getdaysinmonth.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInMonth for the second month in each of +// 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, GregorianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: 28 28 28 29 28 +Era 1: 28 28 28 29 28 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..a15e780eff2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetDaysInYear/CPP/gregoriancalendar_getdaysinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, GregorianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: 365 365 365 366 365 +Era 1: 365 365 365 366 365 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp new file mode 100644 index 00000000000..990c729f21e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetEra/CPP/gregorian_getera.cpp @@ -0,0 +1,64 @@ + +// The following code example shows that DTFI ignores the punctuation in the +// era name only if the calendar is Gregorian and the culture uses the era name "A.D.". +// +using namespace System; +using namespace System::Globalization; +using namespace System::Collections; +int main() +{ + + // Creates strings with punctuation and without. + String^ strADPunc = "A.D."; + String^ strADNoPunc = "AD"; + String^ strCEPunc = "C.E."; + String^ strCENoPunc = "CE"; + + // Calls DTFI::GetEra for each culture that uses GregorianCalendar as the default calendar. + Console::WriteLine( " ----- AD ----- ----- CE -----" ); + Console::WriteLine( "CULTURE PUNC NO PUNC PUNC NO PUNC CALENDAR" ); + IEnumerator^ en = CultureInfo::GetCultures( CultureTypes::SpecificCultures )->GetEnumerator(); + while ( en->MoveNext() ) + { + CultureInfo^ myCI = safe_cast(en->Current); + Console::Write( "{0, -12}", myCI ); + Console::Write( "{0,-7}{1,-9}", myCI->DateTimeFormat->GetEra( strADPunc ), myCI->DateTimeFormat->GetEra( strADNoPunc ) ); + Console::Write( "{0, -7}{1, -9}", myCI->DateTimeFormat->GetEra( strCEPunc ), myCI->DateTimeFormat->GetEra( strCENoPunc ) ); + Console::Write( "{0}", myCI->Calendar ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. This output has been cropped for brevity. + + ----- AD ----- ----- CE ----- +CULTURE PUNC NO PUNC PUNC NO PUNC CALENDAR +ar-SA -1 -1 -1 -1 System.Globalization.HijriCalendar +ar-IQ 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-EG 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-LY 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-DZ 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-MA 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-TN 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-OM 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-YE 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-SY 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-JO 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-LB 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-KW 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-AE 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-BH 1 1 -1 -1 System.Globalization.GregorianCalendar +ar-QA 1 1 -1 -1 System.Globalization.GregorianCalendar +bg-BG 1 1 -1 -1 System.Globalization.GregorianCalendar +ca-ES -1 -1 -1 -1 System.Globalization.GregorianCalendar +zh-TW -1 -1 -1 -1 System.Globalization.GregorianCalendar +zh-CN -1 -1 -1 -1 System.Globalization.GregorianCalendar +zh-HK 1 1 -1 -1 System.Globalization.GregorianCalendar +zh-SG 1 1 -1 -1 System.Globalization.GregorianCalendar +zh-MO 1 1 -1 -1 System.Globalization.GregorianCalendar +cs-CZ -1 -1 -1 -1 System.Globalization.GregorianCalendar +da-DK 1 1 -1 -1 System.Globalization.GregorianCalendar + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..dfe3801afab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.GetMonthsInYear/CPP/gregoriancalendar_getmonthsinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, GregorianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: 12 12 12 12 12 +Era 1: 12 12 12 12 12 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp new file mode 100644 index 00000000000..e69e21eeaba --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapDay/CPP/gregoriancalendar_isleapday.cpp @@ -0,0 +1,55 @@ + +// The following code example calls IsLeapDay for the last day of the second +// month (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, GregorianCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, GregorianCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp new file mode 100644 index 00000000000..140956b9f7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapMonth/CPP/gregoriancalendar_isleapmonth.cpp @@ -0,0 +1,36 @@ + +// The following code example calls IsLeapMonth for all the months in five years +// in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 2001; y <= 2005; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, GregorianCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, GregorianCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +2001: False False False False False False False False False False False False +2002: False False False False False False False False False False False False +2003: False False False False False False False False False False False False +2004: False False False False False False False False False False False False +2005: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp new file mode 100644 index 00000000000..6331dd01784 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar.IsLeapYear/CPP/gregoriancalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, GregorianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp new file mode 100644 index 00000000000..1a0b6a1e910 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarLocalized/CPP/gregorianlocalized.cpp @@ -0,0 +1,40 @@ + +// The following code example prints a DateTime using a GregorianCalendar that is localized. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes three different CultureInfo. + CultureInfo^ myCIdeDE = gcnew CultureInfo( "de-DE",false ); + CultureInfo^ myCIenUS = gcnew CultureInfo( "en-US",false ); + CultureInfo^ myCIfrFR = gcnew CultureInfo( "fr-FR",false ); + CultureInfo^ myCIruRU = gcnew CultureInfo( "ru-RU",false ); + + // Creates a Localized GregorianCalendar. + // GregorianCalendarTypes::Localized is the default when using the GregorianCalendar constructor with->Item[Out] parameters. + Calendar^ myCal = gcnew GregorianCalendar; + + // Sets the DateTimeFormatInfo::Calendar property to a Localized GregorianCalendar. + // Localized GregorianCalendar is the default calendar for de-DE, en-US, and fr-FR, + myCIruRU->DateTimeFormat->Calendar = myCal; + + // Creates a DateTime. + DateTime myDT = DateTime(2002,1,3,13,30,45); + + // Displays the DateTime. + Console::WriteLine( "de-DE: {0}", myDT.ToString( "F", myCIdeDE ) ); + Console::WriteLine( "en-US: {0}", myDT.ToString( "F", myCIenUS ) ); + Console::WriteLine( "fr-FR: {0}", myDT.ToString( "F", myCIfrFR ) ); + Console::WriteLine( "ru-RU: {0}", myDT.ToString( "F", myCIruRU ) ); +} + +/* +The example displays the following output: + de-DE: Donnerstag, 3. Januar 2002 13:30:45 + en-US: Thursday, January 03, 2002 1:30:45 PM + fr-FR: jeudi 3 janvier 2002 13:30:45 + ru-RU: 3 ÑÐ½Ð²Ð°Ñ€Ñ 2002 г. 13:30:45 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp new file mode 100644 index 00000000000..698b5b3e06f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendarTypes/CPP/gregoriancalendartypes.cpp @@ -0,0 +1,44 @@ + +// The following code example demonstrates how to determine the GregorianCalendar +// version supported by the culture. +// +using namespace System; +using namespace System::Globalization; +using namespace System::Collections; +int main() +{ + + // Calendar* myOptCals[] = new CultureInfo(S"ar-SA") -> OptionalCalendars; + CultureInfo^ MyCI = gcnew CultureInfo( "ar-SA" ); + array^myOptCals = MyCI->OptionalCalendars; + + // Checks which ones are GregorianCalendar then determines the GregorianCalendar version. + Console::WriteLine( "The ar-SA culture supports the following calendars:" ); + IEnumerator^ myEnum = myOptCals->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Calendar^ cal = safe_cast(myEnum->Current); + if ( cal->GetType() == GregorianCalendar::typeid ) + { + GregorianCalendar^ myGreCal = dynamic_cast(cal); + GregorianCalendarTypes calType = myGreCal->CalendarType; + Console::WriteLine( " {0} ( {1})", cal, calType ); + } + else + Console::WriteLine( " {0}", cal ); + } +} + +/* +This code produces the following output. + +The ar-SA culture supports the following calendars: + System.Globalization.HijriCalendar + System.Globalization.GregorianCalendar ( USEnglish) + System.Globalization.GregorianCalendar ( MiddleEastFrench) + System.Globalization.GregorianCalendar ( Arabic) + System.Globalization.GregorianCalendar ( Localized) + System.Globalization.GregorianCalendar ( TransliteratedFrench) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp new file mode 100644 index 00000000000..372b38993c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_AddGet/CPP/gregoriancalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Gregorian calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the GregorianCalendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar: + Era: 1 + Year: 2002 + Month: 4 + DayOfYear: 93 + DayOfMonth: 3 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 2005 + Month: 2 + DayOfYear: 34 + DayOfMonth: 3 + DayOfWeek: Thursday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp new file mode 100644 index 00000000000..f3640634df9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.GregorianCalendar_MinMax/CPP/gregoriancalendar_minmax.cpp @@ -0,0 +1,29 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create an instance of the calendar. + GregorianCalendar^ myCal = gcnew GregorianCalendar; + Console::WriteLine( myCal ); + + // Display the MinSupportedDateTime. + DateTime myMin = myCal->MinSupportedDateTime; + Console::WriteLine( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::WriteLine( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.GregorianCalendar +MinSupportedDateTime: 01/01/0001 +MaxSupportedDateTime: 12/31/9999 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..bc4213e8f2e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetDaysInMonth/CPP/hebrewcalendar_getdaysinmonth.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInMonth for the second month in each of +// 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 5761 5762 5763 5764 5765 +CurrentEra: 29 29 30 30 29 +Era 1: 29 29 30 30 29 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..57e2ea00d8c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.GetMonthsInYear/CPP/hebrewcalendar_getmonthsinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, HebrewCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 5761 5762 5763 5764 5765 +CurrentEra: 12 12 13 12 13 +Era 1: 12 12 13 12 13 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp new file mode 100644 index 00000000000..9c1c73168c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapDay/CPP/hebrewcalendar_isleapday.cpp @@ -0,0 +1,55 @@ + +// The following code example calls IsLeapDay for the last day of the second month +// (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 5761; y <= 5765; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, HebrewCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HebrewCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 5761; y <= 5765; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 5761 5762 5763 5764 5765 +CurrentEra: False False False False False +Era 1: False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp new file mode 100644 index 00000000000..1da1268009b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapMonth/CPP/hebrewcalendar_isleapmonth.cpp @@ -0,0 +1,36 @@ + +// The following code example calls IsLeapMonth for all the months in five years +// in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 5761; y <= 5765; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, HebrewCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, HebrewCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +5761: False False False False False False False False False False False False +5762: False False False False False False False False False False False False +5763: False False False False False False True False False False False False False +5764: False False False False False False False False False False False False +5765: False False False False False False True False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp new file mode 100644 index 00000000000..f7458927a3b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar.IsLeapYear/CPP/hebrewcalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, HebrewCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 5761 5762 5763 5764 5765 +CurrentEra: False False True False True +Era 1: False False True False True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp new file mode 100644 index 00000000000..cadc36701b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_AddGet/CPP/hebrewcalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Hebrew calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Hebrew calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the Hebrew calendar: + Era: 1 + Year: 5762 + Month: 7 + DayOfYear: 198 + DayOfMonth: 21 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 5765 + Month: 5 + DayOfYear: 138 + DayOfMonth: 21 + DayOfWeek: Monday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..d739184677c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_GetDaysInYear/CPP/hebrewcalendar_getdaysinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HebrewCalendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, HebrewCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 5761; y <= 5765; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 5761 5762 5763 5764 5765 +CurrentEra: 353 354 385 355 383 +Era 1: 353 354 385 355 383 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp new file mode 100644 index 00000000000..6355880b6f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HebrewCalendar_MinMax/CPP/hebrewcalendar_minmax.cpp @@ -0,0 +1,34 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create an instance of the calendar. + HebrewCalendar^ myCal = gcnew HebrewCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.HebrewCalendar +MinSupportedDateTime: 04/07/5343 (in Gregorian, 01/01/1583) +MaxSupportedDateTime: 13/29/5999 (in Gregorian, 09/29/2239) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..b31c1af503b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInMonth/CPP/hijricalendar_getdaysinmonth.cpp @@ -0,0 +1,45 @@ + +// The following code example calls GetDaysInMonth for the twelfth month in +// each of 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 12, HijriCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 12, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. The results might vary depending on +the settings in Regional and Language Options (or Regional Options or Regional Settings). + +YEAR 1421 1422 1423 1424 1425 +CurrentEra: 29 29 30 29 29 +Era 1: 29 29 30 29 29 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..036e38f6962 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetDaysInYear/CPP/hijricalendar_getdaysinyear.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, HijriCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. The results might vary depending on +the settings in Regional and Language Options (or Regional Options or Regional Settings). + +YEAR 1421 1422 1423 1424 1425 +CurrentEra: 354 354 355 354 354 +Era 1: 354 354 355 354 354 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..f922542fad0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.GetMonthsInYear/CPP/hijricalendar_getmonthsinyear.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, HijriCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. The results might vary depending on +the settings in Regional and Language Options (or Regional Options or Regional Settings). + +YEAR 1421 1422 1423 1424 1425 +CurrentEra: 12 12 12 12 12 +Era 1: 12 12 12 12 12 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp new file mode 100644 index 00000000000..8ad91079056 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.HijriAdjustment/CPP/hijriadjustment.cpp @@ -0,0 +1,53 @@ + +// The following code example shows how HijriAdjustment affects the date. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Creates a DateTime and initializes it to the second day of the first month of the year 1422. + DateTime myDT = DateTime(1422,1,2,myCal); + + // Displays the current values of the DateTime. + Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); + Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); + Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); + + // Sets the HijriAdjustment property to 2. + myCal->HijriAdjustment = 2; + Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); + Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); + Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); + + // Sets the HijriAdjustment property to -2. + myCal->HijriAdjustment = -2; + Console::WriteLine( "HijriAdjustment is {0}.", myCal->HijriAdjustment ); + Console::WriteLine( " Year is {0}.", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month is {0}.", myCal->GetMonth( myDT ) ); + Console::WriteLine( " Day is {0}.", myCal->GetDayOfMonth( myDT ) ); +} + +/* +This code produces the following output. Results vary depending on the registry settings. + +HijriAdjustment is 0. +Year is 1422. +Month is 1. +Day is 2. +HijriAdjustment is 2. +Year is 1422. +Month is 1. +Day is 4. +HijriAdjustment is -2. +Year is 1421. +Month is 12. +Day is 29. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp new file mode 100644 index 00000000000..374dfbf3d96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapDay/CPP/hijricalendar_isleapday.cpp @@ -0,0 +1,55 @@ + +// The following code example calls IsLeapDay for the last day of the second +// month (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 1421; y <= 1425; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, HijriCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, HijriCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1421; y <= 1425; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 1421 1422 1423 1424 1425 +CurrentEra: False False False False False +Era 1: False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp new file mode 100644 index 00000000000..aa01d2f822d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapMonth/CPP/hijricalendar_isleapmonth.cpp @@ -0,0 +1,36 @@ + +// The following code example calls IsLeapMonth for all the months in +// five years in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 1421; y <= 1425; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, HijriCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, HijriCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +1421: False False False False False False False False False False False False +1422: False False False False False False False False False False False False +1423: False False False False False False False False False False False False +1424: False False False False False False False False False False False False +1425: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp new file mode 100644 index 00000000000..e3896e85af1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar.IsLeapYear/CPP/hijricalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, HijriCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1421; y <= 1425; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 1421 1422 1423 1424 1425 +CurrentEra: False False True False False +Era 1: False False True False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp new file mode 100644 index 00000000000..8585d7966f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_AddGet/CPP/hijricalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Hijri calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the HijriCalendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Hijri calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the Hijri calendar: + Era: 1 + Year: 1423 + Month: 1 + DayOfYear: 21 + DayOfMonth: 21 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 1425 + Month: 11 + DayOfYear: 316 + DayOfMonth: 21 + DayOfWeek: Saturday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp new file mode 100644 index 00000000000..4c8f361ea5f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.HijriCalendar_MinMax/CPP/hijricalendar_minmax.cpp @@ -0,0 +1,34 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create an instance of the calendar. + HijriCalendar^ myCal = gcnew HijriCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.HijriCalendar +MinSupportedDateTime: 01/01/0001 (in Gregorian, 07/18/0622) +MaxSupportedDateTime: 04/03/9666 (in Gregorian, 12/31/9999) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp new file mode 100644 index 00000000000..41a3f5fffa3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.Eras/CPP/yslin_japanesecalendar_eras.cpp @@ -0,0 +1,29 @@ + +// The following code example displays the values contained in the Eras property. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::WriteLine( "Eras[ {0}] = {1}", i, myCal->Eras[ i ] ); + + } +} + +/* +This code produces the following output. + +Eras->Item[0] = 4 +Eras->Item[1] = 3 +Eras->Item[2] = 2 +Eras->Item[3] = 1 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..18dc3f18f24 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInMonth/CPP/japanesecalendar_getdaysinmonth.cpp @@ -0,0 +1,47 @@ + +// The following code example calls GetDaysInMonth for the second month in each +// of 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, JapaneseCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 1 2 3 4 5 +CurrentEra: 28 28 28 29 28 +Era 4: 28 28 28 29 28 +Era 3: 28 28 29 28 28 +Era 2: 29 28 28 28 29 +Era 1: 29 28 28 28 29 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..b7c757179f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetDaysInYear/CPP/japanesecalendar_getdaysinyear.cpp @@ -0,0 +1,46 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, JapaneseCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 1 2 3 4 5 +CurrentEra: 365 365 365 366 365 +Era 4: 365 365 365 366 365 +Era 3: 365 365 366 365 365 +Era 2: 366 365 365 365 366 +Era 1: 366 365 365 365 366 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..8fff71ba264 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.GetMonthsInYear/CPP/japanesecalendar_getmonthsinyear.cpp @@ -0,0 +1,30 @@ + +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + } +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp new file mode 100644 index 00000000000..085173db873 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapDay/CPP/japanesecalendar_isleapday.cpp @@ -0,0 +1,52 @@ + +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Creates a holder for the last day of the second month (February)-> + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 1; y <= 5; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, JapaneseCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, JapaneseCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1; y <= 5; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + } + Console::WriteLine(); + } +} +/* +This code produces the following output. + +YEAR 1 2 3 4 5 +CurrentEra: False True False False False +Era 5: False True False False False +Era 4: False False False True False +Era 3: False False True False False +Era 2: True False False False True +Era 1: True False False False True + +*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp new file mode 100644 index 00000000000..de254b59da9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapMonth/CPP/japanesecalendar_isleapmonth.cpp @@ -0,0 +1,36 @@ + +// The following code example calls IsLeapMonth for all the months +// in five years in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 1; y <= 5; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, JapaneseCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JapaneseCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +1: False False False False False False False False False False False False +2: False False False False False False False False False False False False +3: False False False False False False False False False False False False +4: False False False False False False False False False False False False +5: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp new file mode 100644 index 00000000000..5a922425510 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar.IsLeapYear/CPP/japanesecalendar_isleapyear.cpp @@ -0,0 +1,41 @@ +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Creates and initializes a JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, JapaneseCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 1; y <= 5; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + } +} +/* +This code produces the following output. + +YEAR 1 2 3 4 5 +CurrentEra: False True False False False +Era 5: False True False False False +Era 4: False False False True False +Era 3: False False True False False +Era 2: True False False False True +Era 1: True False False False True + +*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp new file mode 100644 index 00000000000..b5ce5f316e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_AddGet/CPP/japanesecalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Japanese calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the JapaneseCalendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Japanese calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the Japanese calendar: + Era: 4 + Year: 14 + Month: 4 + DayOfYear: 93 + DayOfMonth: 3 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 4 + Year: 17 + Month: 2 + DayOfYear: 34 + DayOfMonth: 3 + DayOfWeek: Thursday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp new file mode 100644 index 00000000000..d982671caed --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JapaneseCalendar_MinMax/CPP/japanesecalendar_minmax.cpp @@ -0,0 +1,34 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create an instance of the calendar. + JapaneseCalendar^ myCal = gcnew JapaneseCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.JapaneseCalendar +MinSupportedDateTime: 09/08/0001 (in Gregorian, 09/08/1868) +MaxSupportedDateTime: 12/31/8011 (in Gregorian, 12/31/9999) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..34d49e99fe2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInMonth/CPP/juliancalendar_getdaysinmonth.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInMonth for the second month in +// each of 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, JulianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: 28 28 28 29 28 +Era 1: 28 28 28 29 28 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..3e36971f4c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetDaysInYear/CPP/juliancalendar_getdaysinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, JulianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: 365 365 365 366 365 +Era 1: 365 365 365 366 365 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..113ce8b1c77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.GetMonthsInYear/CPP/juliancalendar_getmonthsinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, JulianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: 12 12 12 12 12 +Era 1: 12 12 12 12 12 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp new file mode 100644 index 00000000000..b8036ac7e05 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapDay/CPP/juliancalendar_isleapday.cpp @@ -0,0 +1,55 @@ + +// The following code example calls IsLeapDay for the last day of the +// second month (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, JulianCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, JulianCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp new file mode 100644 index 00000000000..b2d0997f2f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapMonth/CPP/juliancalendar_isleapmonth.cpp @@ -0,0 +1,36 @@ + +// The following code example calls IsLeapMonth for all the months in +// five years in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 2001; y <= 2005; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, JulianCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, JulianCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +2001: False False False False False False False False False False False False +2002: False False False False False False False False False False False False +2003: False False False False False False False False False False False False +2004: False False False False False False False False False False False False +2005: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp new file mode 100644 index 00000000000..5436dfbd8b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar.IsLeapYear/CPP/juliancalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, JulianCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2001; y <= 2005; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2001 2002 2003 2004 2005 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp new file mode 100644 index 00000000000..e14dd6e99a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_AddGet/CPP/juliancalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Julian calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the JulianCalendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the Julian calendar: + Era: 1 + Year: 2002 + Month: 3 + DayOfYear: 80 + DayOfMonth: 21 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 2005 + Month: 1 + DayOfYear: 21 + DayOfMonth: 21 + DayOfWeek: Thursday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp new file mode 100644 index 00000000000..5aa56fb4924 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.JulianCalendar_MinMax/CPP/juliancalendar_minmax.cpp @@ -0,0 +1,34 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create an instance of the calendar. + JulianCalendar^ myCal = gcnew JulianCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.JulianCalendar +MinSupportedDateTime: 01/03/0001 (in Gregorian, 01/01/0001) +MaxSupportedDateTime: 10/19/9999 (in Gregorian, 12/31/9999) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..6b3c77a66da --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInMonth/CPP/koreancalendar_getdaysinmonth.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInMonth for the second month +// in each of 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 4334 4335 4336 4337 4338 +CurrentEra: 28 28 28 29 28 +Era 1: 28 28 28 29 28 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..5211726ccf0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetDaysInYear/CPP/koreancalendar_getdaysinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, KoreanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 4334 4335 4336 4337 4338 +CurrentEra: 365 365 365 366 365 +Era 1: 365 365 365 366 365 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..33b5c948bd3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.GetMonthsInYear/CPP/koreancalendar_getmonthsinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, KoreanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 4334 4335 4336 4337 4338 +CurrentEra: 12 12 12 12 12 +Era 1: 12 12 12 12 12 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp new file mode 100644 index 00000000000..d973b468e66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapDay/CPP/koreancalendar_isleapday.cpp @@ -0,0 +1,55 @@ + +// The following code example calls IsLeapDay for the last day of the second +// month (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 4334; y <= 4338; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, KoreanCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, KoreanCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 4334; y <= 4338; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 4334 4335 4336 4337 4338 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp new file mode 100644 index 00000000000..3446270064d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapMonth/CPP/koreancalendar_isleapmonth.cpp @@ -0,0 +1,35 @@ + +// The following code example calls IsLeapMonth for all the months in five years in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 4334; y <= 4338; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, KoreanCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, KoreanCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +4334: False False False False False False False False False False False False +4335: False False False False False False False False False False False False +4336: False False False False False False False False False False False False +4337: False False False False False False False False False False False False +4338: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp new file mode 100644 index 00000000000..5e2e16c671d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar.IsLeapYear/CPP/koreancalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, KoreanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 4334; y <= 4338; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 4334 4335 4336 4337 4338 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp new file mode 100644 index 00000000000..0af45b0db54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_AddGet/CPP/koreancalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Korean calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the KoreanCalendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Korean calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the Korean calendar: + Era: 1 + Year: 4335 + Month: 4 + DayOfYear: 93 + DayOfMonth: 3 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 4338 + Month: 2 + DayOfYear: 34 + DayOfMonth: 3 + DayOfWeek: Thursday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp new file mode 100644 index 00000000000..00de6b90a65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.KoreanCalendar_MinMax/CPP/koreancalendar_minmax.cpp @@ -0,0 +1,35 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + + // Create an instance of the calendar. + KoreanCalendar^ myCal = gcnew KoreanCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.KoreanCalendar +MinSupportedDateTime: 01/01/2334 (in Gregorian, 01/01/0001) +MaxSupportedDateTime: 12/31/12332 (in Gregorian, 12/31/9999) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp new file mode 100644 index 00000000000..0725c178ee9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.NumberFormatInfo.InvariantInfo/CPP/invariantinfo.cpp @@ -0,0 +1,82 @@ + +// +using namespace System; +using namespace System::Globalization; +using namespace System::Text; +int main() +{ + + // Gets the InvariantInfo. + NumberFormatInfo^ myInv = NumberFormatInfo::InvariantInfo; + + // Gets a UnicodeEncoding to display the Unicode value of symbols. + UnicodeEncoding^ myUE = gcnew UnicodeEncoding( true,false ); + array^myCodes; + + // Displays the default values for each of the properties. + Console::WriteLine( "InvariantInfo:\nNote: Symbols might not display correctly on the console, \ntherefore, Unicode values are included." ); + Console::WriteLine( "\tCurrencyDecimalDigits\t\t {0}", myInv->CurrencyDecimalDigits ); + Console::WriteLine( "\tCurrencyDecimalSeparator\t {0}", myInv->CurrencyDecimalSeparator ); + Console::WriteLine( "\tCurrencyGroupSeparator\t\t {0}", myInv->CurrencyGroupSeparator ); + Console::WriteLine( "\tCurrencyGroupSizes\t\t {0}", myInv->CurrencyGroupSizes[ 0 ] ); + Console::WriteLine( "\tCurrencyNegativePattern\t\t {0}", myInv->CurrencyNegativePattern ); + Console::WriteLine( "\tCurrencyPositivePattern\t\t {0}", myInv->CurrencyPositivePattern ); + myCodes = myUE->GetBytes( myInv->CurrencySymbol ); + Console::WriteLine( "\tCurrencySymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->CurrencySymbol, myCodes[ 0 ], myCodes[ 1 ] ); + Console::WriteLine( "\tNaNSymbol\t\t\t {0}", myInv->NaNSymbol ); + Console::WriteLine( "\tNegativeInfinitySymbol\t\t {0}", myInv->NegativeInfinitySymbol ); + Console::WriteLine( "\tNegativeSign\t\t\t {0}", myInv->NegativeSign ); + Console::WriteLine( "\tNumberDecimalDigits\t\t {0}", myInv->NumberDecimalDigits ); + Console::WriteLine( "\tNumberDecimalSeparator\t\t {0}", myInv->NumberDecimalSeparator ); + Console::WriteLine( "\tNumberGroupSeparator\t\t {0}", myInv->NumberGroupSeparator ); + Console::WriteLine( "\tNumberGroupSizes\t\t {0}", myInv->NumberGroupSizes[ 0 ] ); + Console::WriteLine( "\tNumberNegativePattern\t\t {0}", myInv->NumberNegativePattern ); + Console::WriteLine( "\tPercentDecimalDigits\t\t {0}", myInv->PercentDecimalDigits ); + Console::WriteLine( "\tPercentDecimalSeparator\t\t {0}", myInv->PercentDecimalSeparator ); + Console::WriteLine( "\tPercentGroupSeparator\t\t {0}", myInv->PercentGroupSeparator ); + Console::WriteLine( "\tPercentGroupSizes\t\t {0}", myInv->PercentGroupSizes[ 0 ] ); + Console::WriteLine( "\tPercentNegativePattern\t\t {0}", myInv->PercentNegativePattern ); + Console::WriteLine( "\tPercentPositivePattern\t\t {0}", myInv->PercentPositivePattern ); + myCodes = myUE->GetBytes( myInv->PercentSymbol ); + Console::WriteLine( "\tPercentSymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->PercentSymbol, myCodes[ 0 ], myCodes[ 1 ] ); + myCodes = myUE->GetBytes( myInv->PerMilleSymbol ); + Console::WriteLine( "\tPerMilleSymbol\t\t\t {0}\t(U+ {1:x2} {2:x2})", myInv->PerMilleSymbol, myCodes[ 0 ], myCodes[ 1 ] ); + Console::WriteLine( "\tPositiveInfinitySymbol\t\t {0}", myInv->PositiveInfinitySymbol ); + Console::WriteLine( "\tPositiveSign\t\t\t {0}", myInv->PositiveSign ); +} + +/* + +This code produces the following output. + +InvariantInfo: +Note: Symbols might not display correctly on the console, +therefore, Unicode values are included. +CurrencyDecimalDigits 2 +CurrencyDecimalSeparator . +CurrencyGroupSeparator , +CurrencyGroupSizes 3 +CurrencyNegativePattern 0 +CurrencyPositivePattern 0 +CurrencySymbol (U+00a4) +NaNSymbol NaN +NegativeInfinitySymbol -Infinity +NegativeSign - +NumberDecimalDigits 2 +NumberDecimalSeparator . +NumberGroupSeparator , +NumberGroupSizes 3 +NumberNegativePattern 1 +PercentDecimalDigits 2 +PercentDecimalSeparator . +PercentGroupSeparator , +PercentGroupSizes 3 +PercentNegativePattern 0 +PercentPositivePattern 0 +PercentSymbol % (U+0025) +PerMilleSymbol % (U+2030) +PositiveInfinitySymbol Infinity +PositiveSign + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp new file mode 100644 index 00000000000..1a0bf689d64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo.ctorCultureName/CPP/regioninfo_ctorculturename.cpp @@ -0,0 +1,112 @@ +// The following code example creates instances of +// T:System.Globalization.RegionInfo using culture names. + +// +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; + +namespace Sample +{ + public ref class SamplesRegionInfo + { + public: + static void Work() + { + + // Creates an array containing culture names. + array ^ commonCultures = + {"", "ar", "ar-DZ", "en", "en-US"}; + + // Creates a RegionInfo for each of the culture names. + // Note that "ar" is the culture name for the neutral + // culture "Arabic", but it is also the region name for + // the country/region "Argentina"; therefore, it does not + // fail as expected. + Console::WriteLine("Without checks..."); + for each (String^ cultureID in commonCultures) + { + try + { + RegionInfo^ region = + gcnew RegionInfo(cultureID); + } + + catch (ArgumentException^ ex) + { + Console::WriteLine(ex); + } + } + + Console::WriteLine(); + + Console::WriteLine("Checking the culture" + " names first..."); + + for each (String^ cultureID in commonCultures) + { + if (cultureID->Length == 0) + { + Console::WriteLine( + "The culture is the invariant culture."); + } + else + { + CultureInfo^ culture = + gcnew CultureInfo(cultureID, false); + if (culture->IsNeutralCulture) + { + Console::WriteLine("The culture {0} is " + "a neutral culture.", cultureID); + } + else + { + Console::WriteLine("The culture {0} is " + "a specific culture.", cultureID); + try + { + RegionInfo^ region = + gcnew RegionInfo(cultureID); + } + catch (ArgumentException^ ex) + { + Console::WriteLine(ex); + } + } + } + } + Console::ReadLine(); + } + }; +} + +int main() +{ + Sample::SamplesRegionInfo::Work(); + return 0; +} + +/* +This code produces the following output. + +Without checks... +System.ArgumentException: Region name '' is not supported. +Parameter name: name +at System.Globalization.RegionInfo..ctor(String name) +at SamplesRegionInfo.Main() +System.ArgumentException: Region name 'en' is not supported. +Parameter name: name +at System.Globalization.CultureTableRecord..ctor(String regionName, + Boolean useUserOverride) +at System.Globalization.RegionInfo..ctor(String name) +at SamplesRegionInfo.Main() + +Checking the culture names first... +The culture is the invariant culture. +The culture ar is a neutral culture. +The culture ar-DZ is a specific culture. +The culture en is a neutral culture. +The culture en-US is a specific culture. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp new file mode 100644 index 00000000000..afae697de7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo/CPP/regioninfo.cpp @@ -0,0 +1,46 @@ + +// The following code example demonstrates several members of the RegionInfo class. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Displays the property values of the RegionInfo for "US". + RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); + Console::WriteLine( " Name: {0}", myRI1->Name ); + Console::WriteLine( " DisplayName: {0}", myRI1->DisplayName ); + Console::WriteLine( " EnglishName: {0}", myRI1->EnglishName ); + Console::WriteLine( " IsMetric: {0}", myRI1->IsMetric ); + Console::WriteLine( " ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName ); + Console::WriteLine( " ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName ); + Console::WriteLine( " TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName ); + Console::WriteLine( " CurrencySymbol: {0}", myRI1->CurrencySymbol ); + Console::WriteLine( " ISOCurrencySymbol: {0}", myRI1->ISOCurrencySymbol ); + Console::WriteLine(); + + // Compares the RegionInfo above with another RegionInfo created using CultureInfo. + RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID ); + if ( myRI1->Equals( myRI2 ) ) + Console::WriteLine( "The two RegionInfo instances are equal." ); + else + Console::WriteLine( "The two RegionInfo instances are NOT equal." ); +} + +/* +This code produces the following output. + + Name: US + DisplayName: United States + EnglishName: United States + IsMetric: False + ThreeLetterISORegionName: USA + ThreeLetterWindowsRegionName: USA + TwoLetterISORegionName: US + CurrencySymbol: $ + ISOCurrencySymbol: USD + +The two RegionInfo instances are equal. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp new file mode 100644 index 00000000000..59f19db370c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Equals/CPP/regioninfo_equals.cpp @@ -0,0 +1,28 @@ + +// The following code example compares two instances of RegionInfo that were created differently. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates a RegionInfo using the ISO 3166 two-letter code. + RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); + + // Creates a RegionInfo using a CultureInfo.LCID. + RegionInfo^ myRI2 = gcnew RegionInfo( (gcnew CultureInfo( "en-US",false ))->LCID ); + + // Compares the two instances. + if ( myRI1->Equals( myRI2 ) ) + Console::WriteLine( "The two RegionInfo instances are equal." ); + else + Console::WriteLine( "The two RegionInfo instances are NOT equal." ); +} + +/* +This code produces the following output. + +The two RegionInfo instances are equal. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp new file mode 100644 index 00000000000..b61096e79cc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.RegionInfo_Properties/CPP/regioninfo_properties.cpp @@ -0,0 +1,36 @@ + +// The following code example displays the properties of the RegionInfo class. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Displays the property values of the RegionInfo for "US". + RegionInfo^ myRI1 = gcnew RegionInfo( "US" ); + Console::WriteLine( " Name: {0}", myRI1->Name ); + Console::WriteLine( " DisplayName: {0}", myRI1->DisplayName ); + Console::WriteLine( " EnglishName: {0}", myRI1->EnglishName ); + Console::WriteLine( " IsMetric: {0}", myRI1->IsMetric ); + Console::WriteLine( " ThreeLetterISORegionName: {0}", myRI1->ThreeLetterISORegionName ); + Console::WriteLine( " ThreeLetterWindowsRegionName: {0}", myRI1->ThreeLetterWindowsRegionName ); + Console::WriteLine( " TwoLetterISORegionName: {0}", myRI1->TwoLetterISORegionName ); + Console::WriteLine( " CurrencySymbol: {0}", myRI1->CurrencySymbol ); + Console::WriteLine( " ISOCurrencySymbol: {0}", myRI1->ISOCurrencySymbol ); +} + +/* +This code produces the following output. + + Name: US + DisplayName: United States + EnglishName: United States + IsMetric: False + ThreeLetterISORegionName: USA + ThreeLetterWindowsRegionName: USA + TwoLetterISORegionName: US + CurrencySymbol: $ + ISOCurrencySymbol: USD + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp new file mode 100644 index 00000000000..1b59bd014bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Compare/CPP/sortkey_compare.cpp @@ -0,0 +1,36 @@ + +// The following code example compares SortKey objects created with +// cultures that have different sort orders. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates a SortKey using the en-US culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + CompareInfo^ myComp_enUS = MyCI->CompareInfo; + SortKey^ mySK1 = myComp_enUS->GetSortKey( "llama" ); + + // Creates a SortKey using the es-ES culture with international sort. + MyCI = gcnew CultureInfo( "es-ES",false ); + CompareInfo^ myComp_esES = MyCI->CompareInfo; + SortKey^ mySK2 = myComp_esES->GetSortKey( "llama" ); + + // Creates a SortKey using the es-ES culture with traditional sort. + MyCI = gcnew CultureInfo( 0x040A,false ); + CompareInfo^ myComp_es = MyCI->CompareInfo; + SortKey^ mySK3 = myComp_es->GetSortKey( "llama" ); + + // Compares the en-US SortKey with each of the es-ES SortKey objects. + Console::WriteLine( "Comparing \"llama\" in en-US and in es-ES with international sort : {0}", SortKey::Compare( mySK1, mySK2 ) ); + Console::WriteLine( "Comparing \"llama\" in en-US and in es-ES with traditional sort : {0}", SortKey::Compare( mySK1, mySK3 ) ); +} + +/* +This code produces the following output. + +Comparing S"llama" in en-US and in es-ES with international sort : 0 +Comparing S"llama" in en-US and in es-ES with traditional sort : -1 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp new file mode 100644 index 00000000000..3f300f6813f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.SortKey.Equals/CPP/sortkey_equals.cpp @@ -0,0 +1,80 @@ + +// The following code example shows the results of SortKey->Equals +// when compared with different SortKey objects. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates two identical en-US cultures and one de-DE culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + CompareInfo^ myComp_enUS1 = MyCI->CompareInfo; + MyCI = gcnew CultureInfo( "en-US",false ); + CompareInfo^ myComp_enUS2 = MyCI->CompareInfo; + MyCI = gcnew CultureInfo( "de-DE",false ); + CompareInfo^ myComp_deDE = MyCI->CompareInfo; + + // Creates the base SortKey to compare with all the others. + SortKey^ mySK1 = myComp_enUS1->GetSortKey( "cant", CompareOptions::StringSort ); + + // Creates a SortKey that is derived exactly the same way as the base SortKey. + SortKey^ mySK2 = myComp_enUS1->GetSortKey( "cant", CompareOptions::StringSort ); + + // Creates a SortKey that uses word sort, which is the default sort. + SortKey^ mySK3 = myComp_enUS1->GetSortKey( "cant" ); + + // Creates a SortKey for a different String*. + SortKey^ mySK4 = myComp_enUS1->GetSortKey( "can't", CompareOptions::StringSort ); + + // Creates a SortKey from a different CompareInfo with the same culture. + SortKey^ mySK5 = myComp_enUS2->GetSortKey( "cant", CompareOptions::StringSort ); + + // Creates a SortKey from a different CompareInfo with a different culture. + SortKey^ mySK6 = myComp_deDE->GetSortKey( "cant", CompareOptions::StringSort ); + + // Compares the base SortKey with itself. + Console::WriteLine( "Comparing the base SortKey with itself: {0}", mySK1->Equals( mySK1 ) ); + Console::WriteLine(); + + // Prints the header for the table. + Console::WriteLine( "CompareInfo Culture OriginalString CompareOptions Equals()" ); + + // Compares the base SortKey with a SortKey that is + // created from the same CompareInfo with the same String* and the same CompareOptions. + Console::WriteLine( "same same same same {0}", mySK1->Equals( mySK2 ) ); + + // Compares the base SortKey with a SortKey that is + // created from the same CompareInfo with the same String* but with different CompareOptions. + Console::WriteLine( "same same same different {0}", mySK1->Equals( mySK3 ) ); + + // Compares the base SortKey with a SortKey that is + // created from the same CompareInfo with the different String* + // but with the same CompareOptions. + Console::WriteLine( "same same different same {0}", mySK1->Equals( mySK4 ) ); + + // Compares the base SortKey with a SortKey that is + // created from a different CompareInfo (same culture) + // with the same String* and the same CompareOptions. + Console::WriteLine( "different same same same {0}", mySK1->Equals( mySK5 ) ); + + // Compares the base SortKey with a SortKey that is + // created from a different CompareInfo (different culture) + // with the same String* and the same CompareOptions. + Console::WriteLine( "different different same same {0}", mySK1->Equals( mySK6 ) ); +} + +/* +This code produces the following output. + +Comparing the base SortKey with itself: True + +CompareInfo Culture OriginalString CompareOptions Equals() +same same same same True +same same same different False +same same different same False +different same same same True +different different same same False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..59e7fbd6cec --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInMonth/CPP/taiwancalendar_getdaysinmonth.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInMonth for the second month in each +// of 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, TaiwanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 90 91 92 93 94 +CurrentEra: 28 28 28 29 28 +Era 1: 28 28 28 29 28 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..be31d941d3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetDaysInYear/CPP/taiwancalendar_getdaysinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, TaiwanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 90 91 92 93 94 +CurrentEra: 365 365 365 366 365 +Era 1: 365 365 365 366 365 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..5dd8e46be7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.GetMonthsInYear/CPP/taiwancalendar_getmonthsinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, TaiwanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 90 91 92 93 94 +CurrentEra: 12 12 12 12 12 +Era 1: 12 12 12 12 12 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp new file mode 100644 index 00000000000..89fc7fb7e6f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapDay/CPP/taiwancalendar_isleapday.cpp @@ -0,0 +1,54 @@ + +// The following code example calls IsLeapDay for the last day of the second month (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t{0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 90; y <= 94; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, TaiwanCalendar::CurrentEra ); + Console::Write( "\t{0}", myCal->IsLeapDay( y, 2, iLastDay, TaiwanCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 90; y <= 94; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t{0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 90 91 92 93 94 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp new file mode 100644 index 00000000000..914453cabe8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapMonth/CPP/taiwancalendar_isleapmonth.cpp @@ -0,0 +1,35 @@ + +// The following code example calls IsLeapMonth for all the months in five years in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 90; y <= 94; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, TaiwanCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, TaiwanCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +90: False False False False False False False False False False False False +91: False False False False False False False False False False False False +92: False False False False False False False False False False False False +93: False False False False False False False False False False False False +94: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp new file mode 100644 index 00000000000..dc8bffdcf80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar.IsLeapYear/CPP/taiwancalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, TaiwanCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 90; y <= 94; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 90 91 92 93 94 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp new file mode 100644 index 00000000000..99c84b107ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_AddGet/CPP/taiwancalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the Taiwan calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the TaiwanCalendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the Taiwan calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the Taiwan calendar: + Era: 1 + Year: 91 + Month: 4 + DayOfYear: 93 + DayOfMonth: 3 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 94 + Month: 2 + DayOfYear: 34 + DayOfMonth: 3 + DayOfWeek: Thursday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp new file mode 100644 index 00000000000..3deda76056f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TaiwanCalendar_MinMax/CPP/taiwancalendar_minmax.cpp @@ -0,0 +1,35 @@ + +// The following code example gets the minimum value and the maximum value of the calendar. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Create an instance of the calendar. + TaiwanCalendar^ myCal = gcnew TaiwanCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.TaiwanCalendar +MinSupportedDateTime: 01/01/0001 (in Gregorian, 01/01/1912) +MaxSupportedDateTime: 12/31/8088 (in Gregorian, 12/31/9999) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp new file mode 100644 index 00000000000..9e73e264824 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextElementEnumerator.Summary/CPP/tee_summary.cpp @@ -0,0 +1,36 @@ + +// The following code example shows the values returned by TextElementEnumerator. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a String containing the following: + // - a surrogate pair (high surrogate U+D800 and low surrogate U+DC00) + // - a combining character sequence (the Latin small letter S"a" followed by the combining grave accent) + // - a base character (the ligature S"") + String^ myString = L"\xD800\xDC00" + L"a\u0300\u00C6"; + + // Creates and initializes a TextElementEnumerator for myString. + TextElementEnumerator^ myTEE = StringInfo::GetTextElementEnumerator( myString ); + + // Displays the values returned by ElementIndex, Current and GetTextElement. + // Current and GetTextElement return a String* containing the entire text element. + Console::WriteLine( "Index\tCurrent\tGetTextElement" ); + myTEE->Reset(); + while ( myTEE->MoveNext() ) + Console::WriteLine( "[{0}]:\t {1}\t {2}", myTEE->ElementIndex, myTEE->Current, myTEE->GetTextElement() ); +} + +/* +This code produces the following output. The question marks take the place of high and low surrogates. + +Index Current GetTextElement +[0]: ð€€ ð€€ +[2]: aÌ€ aÌ€ +[4]: Æ Æ + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp new file mode 100644 index 00000000000..c77a0736012 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.TextInfo_casing/CPP/textinfo_casing.cpp @@ -0,0 +1,34 @@ + +// The following code example changes the casing of a String*. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Defines the String* with mixed casing. + String^ myString = "wAr aNd pEaCe"; + + // Creates a TextInfo based on the S"en-US" culture. + CultureInfo^ MyCI = gcnew CultureInfo( "en-US",false ); + TextInfo^ myTI = MyCI->TextInfo; + + // Changes a String* to lowercase. + Console::WriteLine( "\"{0}\" to lowercase: {1}", myString, myTI->ToLower( myString ) ); + + // Changes a String* to uppercase. + Console::WriteLine( "\"{0}\" to uppercase: {1}", myString, myTI->ToUpper( myString ) ); + + // Changes a String* to titlecase. + Console::WriteLine( "\"{0}\" to titlecase: {1}", myString, myTI->ToTitleCase( myString ) ); +} + +/* +This code produces the following output. + +S"wAr aNd pEaCe" to lowercase: war and peace +S"wAr aNd pEaCe" to uppercase: WAR AND PEACE +S"wAr aNd pEaCe" to titlecase: War And Peace + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp new file mode 100644 index 00000000000..88271b26c94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInMonth/CPP/thaibuddhistcalendar_getdaysinmonth.cpp @@ -0,0 +1,44 @@ + +// The following code example calls GetDaysInMonth for the second month in each of 5 +// years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, ThaiBuddhistCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2544 2545 2546 2547 2548 +CurrentEra: 28 28 28 29 28 +Era 1: 28 28 28 29 28 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp new file mode 100644 index 00000000000..9aa2d9d8dee --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetDaysInYear/CPP/thaibuddhistcalendar_getdaysinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetDaysInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, ThaiBuddhistCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->GetDaysInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2544 2545 2546 2547 2548 +CurrentEra: 365 365 365 366 365 +Era 1: 365 365 365 366 365 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp new file mode 100644 index 00000000000..3a8a6d35a73 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.GetMonthsInYear/CPP/thaibuddhistcalendar_getmonthsinyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls GetMonthsInYear for 5 years in each era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Displays the value of the CurrentEra property. + Console::Write( "CurrentEra:" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, ThaiBuddhistCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Displays the values in the Eras property. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->GetMonthsInYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2544 2545 2546 2547 2548 +CurrentEra: 12 12 12 12 12 +Era 1: 12 12 12 12 12 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp new file mode 100644 index 00000000000..356591167c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapDay/CPP/thaibuddhistcalendar_isleapday.cpp @@ -0,0 +1,55 @@ + +// The following code example calls IsLeapDay for the last day of the +// second month (February) for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Creates a holder for the last day of the second month (February). + int iLastDay; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 2544; y <= 2548; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, ThaiBuddhistCalendar::CurrentEra ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, ThaiBuddhistCalendar::CurrentEra ) ); + + } + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2544; y <= 2548; y++ ) + { + iLastDay = myCal->GetDaysInMonth( y, 2, myCal->Eras[ i ] ); + Console::Write( "\t {0}", myCal->IsLeapDay( y, 2, iLastDay, myCal->Eras[ i ] ) ); + + } + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2544 2545 2546 2547 2548 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp new file mode 100644 index 00000000000..23dd963fa16 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapMonth/CPP/thaibuddhistcalendar_isleapmonth.cpp @@ -0,0 +1,35 @@ + +// The following code example calls IsLeapMonth for all the months in five years in the current era. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Checks all the months in five years in the current era. + int iMonthsInYear; + for ( int y = 2544; y <= 2548; y++ ) + { + Console::Write( " {0}:\t", y ); + iMonthsInYear = myCal->GetMonthsInYear( y, ThaiBuddhistCalendar::CurrentEra ); + for ( int m = 1; m <= iMonthsInYear; m++ ) + Console::Write( "\t {0}", myCal->IsLeapMonth( y, m, ThaiBuddhistCalendar::CurrentEra ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +2544: False False False False False False False False False False False False +2545: False False False False False False False False False False False False +2546: False False False False False False False False False False False False +2547: False False False False False False False False False False False False +2548: False False False False False False False False False False False False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp new file mode 100644 index 00000000000..f8db76f0cbb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar.IsLeapYear/CPP/thaibuddhistcalendar_isleapyear.cpp @@ -0,0 +1,43 @@ + +// The following code example calls IsLeapYear for five years in each of the eras. +// +using namespace System; +using namespace System::Globalization; +int main() +{ + + // Creates and initializes a ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Displays the header. + Console::Write( "YEAR\t" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", y ); + Console::WriteLine(); + + // Checks five years in the current era. + Console::Write( "CurrentEra:" ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, ThaiBuddhistCalendar::CurrentEra ) ); + Console::WriteLine(); + + // Checks five years in each of the eras. + for ( int i = 0; i < myCal->Eras->Length; i++ ) + { + Console::Write( "Era {0}:\t", myCal->Eras[ i ] ); + for ( int y = 2544; y <= 2548; y++ ) + Console::Write( "\t {0}", myCal->IsLeapYear( y, myCal->Eras[ i ] ) ); + Console::WriteLine(); + + } +} + +/* +This code produces the following output. + +YEAR 2544 2545 2546 2547 2548 +CurrentEra: False False False True False +Era 1: False False False True False + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp new file mode 100644 index 00000000000..814657e163c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_AddGet/CPP/thaibuddhistcalendar_addget.cpp @@ -0,0 +1,59 @@ + +// The following code example displays the values of several components of a DateTime in terms of the ThaiBuddhist calendar. +// +using namespace System; +using namespace System::Globalization; +void DisplayValues( Calendar^ myCal, DateTime myDT ) +{ + Console::WriteLine( " Era: {0}", myCal->GetEra( myDT ) ); + Console::WriteLine( " Year: {0}", myCal->GetYear( myDT ) ); + Console::WriteLine( " Month: {0}", myCal->GetMonth( myDT ) ); + Console::WriteLine( " DayOfYear: {0}", myCal->GetDayOfYear( myDT ) ); + Console::WriteLine( " DayOfMonth: {0}", myCal->GetDayOfMonth( myDT ) ); + Console::WriteLine( " DayOfWeek: {0}", myCal->GetDayOfWeek( myDT ) ); + Console::WriteLine(); +} + +int main() +{ + + // Sets a DateTime to April 3, 2002 of the Gregorian calendar. + DateTime myDT = DateTime(2002,4,3,gcnew GregorianCalendar); + + // Creates an instance of the ThaiBuddhistCalendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + + // Displays the values of the DateTime. + Console::WriteLine( "April 3, 2002 of the Gregorian calendar equals the following in the ThaiBuddhist calendar:" ); + DisplayValues( myCal, myDT ); + + // Adds two years and ten months. + myDT = myCal->AddYears( myDT, 2 ); + myDT = myCal->AddMonths( myDT, 10 ); + + // Displays the values of the DateTime. + Console::WriteLine( "After adding two years and ten months:" ); + DisplayValues( myCal, myDT ); +} + +/* +This code produces the following output. + +April 3, 2002 of the Gregorian calendar equals the following in the ThaiBuddhist calendar: + Era: 1 + Year: 2545 + Month: 4 + DayOfYear: 93 + DayOfMonth: 3 + DayOfWeek: Wednesday + +After adding two years and ten months: + Era: 1 + Year: 2548 + Month: 2 + DayOfYear: 34 + DayOfMonth: 3 + DayOfWeek: Thursday + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp new file mode 100644 index 00000000000..a3628cd7019 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Globalization.ThaiBuddhistCalendar_MinMax/CPP/thaibuddhistcalendar_minmax.cpp @@ -0,0 +1,34 @@ +// The following code example gets the minimum date and the maximum date of the calendar. +// +using namespace System; +using namespace System::Globalization; + +int main() +{ + // Create an instance of the calendar. + ThaiBuddhistCalendar^ myCal = gcnew ThaiBuddhistCalendar; + Console::WriteLine( myCal ); + + // Create an instance of the GregorianCalendar. + GregorianCalendar^ myGre = gcnew GregorianCalendar; + + // Display the MinSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMin = myCal->MinSupportedDateTime; + Console::Write( "MinSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMin ), myCal->GetDayOfMonth( myMin ), myCal->GetYear( myMin ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMin ), myGre->GetDayOfMonth( myMin ), myGre->GetYear( myMin ) ); + + // Display the MaxSupportedDateTime and its equivalent in the GregorianCalendar. + DateTime myMax = myCal->MaxSupportedDateTime; + Console::Write( "MaxSupportedDateTime: {0:D2}/{1:D2}/{2:D4}", myCal->GetMonth( myMax ), myCal->GetDayOfMonth( myMax ), myCal->GetYear( myMax ) ); + Console::WriteLine( " (in Gregorian, {0:D2}/{1:D2}/{2:D4})", myGre->GetMonth( myMax ), myGre->GetDayOfMonth( myMax ), myGre->GetYear( myMax ) ); +} + +/* +This code produces the following output. + +System.Globalization.ThaiBuddhistCalendar +MinSupportedDateTime: 01/01/0544 (in Gregorian, 01/01/0001) +MaxSupportedDateTime: 12/31/10542 (in Gregorian, 12/31/9999) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp new file mode 100644 index 00000000000..8b5d97c0b94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IConvertible/CPP/iconvertible.cpp @@ -0,0 +1,144 @@ + + +// +#using + +using namespace System; + +/// Class that implements IConvertible +ref class Complex: public IConvertible +{ +private: + double x; + double y; + +public: + Complex( double x, double y ) + { + this->x = x; + this->y = y; + } + + virtual TypeCode GetTypeCode() + { + return TypeCode::Object; + } + + virtual bool ToBoolean( IFormatProvider^ /*provider*/ ) = IConvertible::ToBoolean + { + if ( (x != 0.0) || (y != 0.0) ) + return true; + else + return false; + } + + double GetDoubleValue() + { + return Math::Sqrt( x * x + y * y ); + } + + virtual Byte ToByte( IFormatProvider^ /*provider*/ ) = IConvertible::ToByte + { + return Convert::ToByte( GetDoubleValue() ); + } + + virtual Char ToChar( IFormatProvider^ /*provider*/ ) = IConvertible::ToChar + { + return Convert::ToChar( GetDoubleValue() ); + } + + virtual DateTime ToDateTime( IFormatProvider^ /*provider*/ ) = IConvertible::ToDateTime + { + return Convert::ToDateTime( GetDoubleValue() ); + } + + virtual Decimal ToDecimal( IFormatProvider^ /*provider*/ ) = IConvertible::ToDecimal + { + return Convert::ToDecimal( GetDoubleValue() ); + } + + virtual double ToDouble( IFormatProvider^ /*provider*/ ) = IConvertible::ToDouble + { + return GetDoubleValue(); + } + + virtual short ToInt16( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt16 + { + return Convert::ToInt16( GetDoubleValue() ); + } + + virtual int ToInt32( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt32 + { + return Convert::ToInt32( GetDoubleValue() ); + } + + virtual Int64 ToInt64( IFormatProvider^ /*provider*/ ) = IConvertible::ToInt64 + { + return Convert::ToInt64( GetDoubleValue() ); + } + + virtual signed char ToSByte( IFormatProvider^ /*provider*/ ) = IConvertible::ToSByte + { + return Convert::ToSByte( GetDoubleValue() ); + } + + virtual float ToSingle( IFormatProvider^ /*provider*/ ) = IConvertible::ToSingle + { + return Convert::ToSingle( GetDoubleValue() ); + } + + virtual String^ ToString( IFormatProvider^ /*provider*/ ) = IConvertible::ToString + { + return String::Format( "( {0} , {1} )", x, y ); + } + + virtual Object^ ToType( Type^ conversionType, IFormatProvider^ /*provider*/ ) = IConvertible::ToType + { + return Convert::ChangeType( GetDoubleValue(), conversionType ); + } + + virtual UInt16 ToUInt16( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt16 + { + return Convert::ToUInt16( GetDoubleValue() ); + } + + virtual UInt32 ToUInt32( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt32 + { + return Convert::ToUInt32( GetDoubleValue() ); + } + + virtual UInt64 ToUInt64( IFormatProvider^ /*provider*/ ) = IConvertible::ToUInt64 + { + return Convert::ToUInt64( GetDoubleValue() ); + } + +}; + +void WriteObjectInfo( Object^ testObject ) +{ + TypeCode typeCode = Type::GetTypeCode( testObject->GetType() ); + switch ( typeCode ) + { + case TypeCode::Boolean: + Console::WriteLine( "Boolean: {0}", testObject ); + break; + + case TypeCode::Double: + Console::WriteLine( "Double: {0}", testObject ); + break; + + default: + Console::WriteLine( "{0}: {1}", typeCode, testObject ); + break; + } +} + +int main() +{ + Complex^ testComplex = gcnew Complex( 4,7 ); + WriteObjectInfo( testComplex ); + WriteObjectInfo( Convert::ToBoolean( testComplex ) ); + WriteObjectInfo( Convert::ToDecimal( testComplex ) ); + WriteObjectInfo( Convert::ToString( testComplex ) ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp new file mode 100644 index 00000000000..7ec610d0749 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IDisposable.Dispose Example/CPP/idisposabledispose.cpp @@ -0,0 +1,80 @@ +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// The following example demonstrates how to create a class that +// implements the IDisposable interface and the IDisposable.Dispose +// method with finalization to clean up unmanaged resources. +// +public ref class MyResource: public IDisposable +{ +private: + + // Pointer to an external unmanaged resource. + IntPtr handle; + + // A managed resource this class uses. + Component^ component; + + // Track whether Dispose has been called. + bool disposed; + +public: + // The class constructor. + MyResource( IntPtr handle, Component^ component ) + { + this->handle = handle; + this->component = component; + disposed = false; + } + + // This method is called if the user explicitly disposes of the + // object (by calling the Dispose method in other managed languages, + // or the destructor in C++). The compiler emits as a call to + // GC::SuppressFinalize( this ) for you, so there is no need to + // call it here. + ~MyResource() + { + // Dispose of managed resources. + component->~Component(); + + // Call C++ finalizer to clean up unmanaged resources. + this->!MyResource(); + + // Mark the class as disposed. This flag allows you to throw an + // exception if a disposed object is accessed. + disposed = true; + } + + // Use interop to call the method necessary to clean up the + // unmanaged resource. + // + [System::Runtime::InteropServices::DllImport("Kernel32")] + static Boolean CloseHandle( IntPtr handle ); + + // The C++ finalizer destructor ensures that unmanaged resources get + // released if the user releases the object without explicitly + // disposing of it. + // + !MyResource() + { + // Call the appropriate methods to clean up unmanaged + // resources here. If disposing is false when Dispose(bool, + // disposing) is called, only the following code is executed. + CloseHandle( handle ); + handle = IntPtr::Zero; + } + +}; + +void main() +{ + // Insert code here to create and use the MyResource object. + MyResource^ mr = gcnew MyResource((IntPtr) 42, (Component^) gcnew Button()); + mr->~MyResource(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp new file mode 100644 index 00000000000..f1c0b919c12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWByte/CPP/rwbyte.cpp @@ -0,0 +1,48 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + int i = 0; + + // Create random data to write to the stream. + array^writeArray = gcnew array(1000); + (gcnew Random)->NextBytes( writeArray ); + BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); + BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); + try + { + + // Write the data to the stream. + Console::WriteLine( "Writing the data." ); + for ( i = 0; i < writeArray->Length; i++ ) + { + binWriter->Write( writeArray[ i ] ); + + } + + // Set the stream position to the beginning of the stream. + binReader->BaseStream->Position = 0; + + // Read and verify the data from the stream. + for ( i = 0; i < writeArray->Length; i++ ) + { + if ( binReader->ReadByte() != writeArray[ i ] ) + { + Console::WriteLine( "Error writing the data." ); + return -1; + } + + } + Console::WriteLine( "The data was written and verified." ); + } + // Catch the EndOfStreamException and write an error message. + catch ( EndOfStreamException^ e ) + { + Console::WriteLine( "Error writing the data.\n{0}", e->GetType()->Name ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp new file mode 100644 index 00000000000..a47e5998074 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWBytes1/CPP/rwbytes.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + const int arrayLength = 1000; + + // Create random data to write to the stream. + array^dataArray = gcnew array(arrayLength); + (gcnew Random)->NextBytes( dataArray ); + BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); + + // Write the data to the stream. + Console::WriteLine( "Writing the data." ); + binWriter->Write( dataArray ); + + // Create the reader using the stream from the writer. + BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); + + // Set the stream position to the beginning of the stream. + binReader->BaseStream->Position = 0; + + // Read and verify the data. + array^verifyArray = binReader->ReadBytes( arrayLength ); + if ( verifyArray->Length != arrayLength ) + { + Console::WriteLine( "Error writing the data." ); + return -1; + } + + for ( int i = 0; i < arrayLength; i++ ) + { + if ( verifyArray[ i ] != dataArray[ i ] ) + { + Console::WriteLine( "Error writing the data." ); + return -1; + } + + } + Console::WriteLine( "The data was written and verified." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp new file mode 100644 index 00000000000..f77f117e2d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar1/CPP/rwchar.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + int i; + array^invalidPathChars = Path::InvalidPathChars; + MemoryStream^ memStream = gcnew MemoryStream; + BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); + + // Write to memory. + binWriter->Write( "Invalid file path characters are: " ); + for ( i = 0; i < invalidPathChars->Length; i++ ) + { + binWriter->Write( invalidPathChars[ i ] ); + + } + + // Create the reader using the same MemoryStream + // as used with the writer. + BinaryReader^ binReader = gcnew BinaryReader( memStream ); + + // Set Position to the beginning of the stream. + binReader->BaseStream->Position = 0; + + // Read the data from memory and write it to the console. + Console::Write( binReader->ReadString() ); + array^memoryData = gcnew array(memStream->Length - memStream->Position); + for ( i = 0; i < memoryData->Length; i++ ) + { + memoryData[ i ] = binReader->ReadChar(); + + } + Console::WriteLine( memoryData ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp new file mode 100644 index 00000000000..1e60a82c46f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChar2/CPP/rwreadchar.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + int i; + array^invalidPathChars = Path::InvalidPathChars; + MemoryStream^ memStream = gcnew MemoryStream; + BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); + + // Write to memory. + binWriter->Write( "Invalid file path characters are: " ); + for ( i = 0; i < invalidPathChars->Length; i++ ) + { + binWriter->Write( invalidPathChars[ i ] ); + + } + + // Create the reader using the same MemoryStream + // as used with the writer. + BinaryReader^ binReader = gcnew BinaryReader( memStream ); + + // Set Position to the beginning of the stream. + binReader->BaseStream->Position = 0; + + // Read the data from memory and write it to the console. + Console::Write( binReader->ReadString() ); + array^memoryData = gcnew array(memStream->Length - memStream->Position); + for ( i = 0; i < memoryData->Length; i++ ) + { + memoryData[ i ] = Convert::ToChar( binReader->Read() ); + + } + Console::WriteLine( memoryData ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp new file mode 100644 index 00000000000..18e3d52cf62 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars1/CPP/rwchars.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + array^invalidPathChars = Path::InvalidPathChars; + MemoryStream^ memStream = gcnew MemoryStream; + BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); + + // Write to memory. + binWriter->Write( "Invalid file path characters are: " ); + binWriter->Write( Path::InvalidPathChars ); + + // Create the reader using the same MemoryStream + // as used with the writer. + BinaryReader^ binReader = gcnew BinaryReader( memStream ); + + // Set Position to the beginning of the stream. + binReader->BaseStream->Position = 0; + + // Read the data from memory and write it to the console. + Console::Write( binReader->ReadString() ); + Console::WriteLine( binReader->ReadChars( (int)(memStream->Length - memStream->Position) ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp new file mode 100644 index 00000000000..591906554cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWChars2/CPP/rwreadchars.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + array^invalidPathChars = Path::InvalidPathChars; + MemoryStream^ memStream = gcnew MemoryStream; + BinaryWriter^ binWriter = gcnew BinaryWriter( memStream ); + + // Write to memory. + binWriter->Write( "Invalid file path characters are: " ); + binWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length ); + + // Create the reader using the same MemoryStream + // as used with the writer. + BinaryReader^ binReader = gcnew BinaryReader( memStream ); + + // Set Position to the beginning of the stream. + binReader->BaseStream->Position = 0; + + // Read the data from memory and write it to the console. + Console::Write( binReader->ReadString() ); + int arraySize = (int)(memStream->Length - memStream->Position); + array^memoryData = gcnew array(arraySize); + binReader->Read( memoryData, 0, arraySize ); + Console::WriteLine( memoryData ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp new file mode 100644 index 00000000000..68e90396c8a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter.RWDouble/CPP/rwdouble.cpp @@ -0,0 +1,66 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + int i; + const int arrayLength = 1000; + + // Create random data to write to the stream. + array^dataArray = gcnew array(arrayLength); + Random^ randomGenerator = gcnew Random; + for ( i = 0; i < arrayLength; i++ ) + { + dataArray[ i ] = 100.1 * randomGenerator->NextDouble(); + + } + BinaryWriter^ binWriter = gcnew BinaryWriter( gcnew MemoryStream ); + try + { + + // Write data to the stream. + Console::WriteLine( "Writing data to the stream." ); + i = 0; + for ( i = 0; i < arrayLength; i++ ) + { + binWriter->Write( dataArray[ i ] ); + + } + + // Create a reader using the stream from the writer. + BinaryReader^ binReader = gcnew BinaryReader( binWriter->BaseStream ); + + // Return to the beginning of the stream. + binReader->BaseStream->Position = 0; + try + { + + // Read and verify the data. + i = 0; + Console::WriteLine( "Verifying the written data." ); + for ( i = 0; i < arrayLength; i++ ) + { + if ( binReader->ReadDouble() != dataArray[ i ] ) + { + Console::WriteLine( "Error writing data." ); + break; + } + + } + Console::WriteLine( "The data was written and verified." ); + } + catch ( EndOfStreamException^ e ) + { + Console::WriteLine( "Error writing data: {0}.", e->GetType()->Name ); + } + + } + finally + { + binWriter->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp new file mode 100644 index 00000000000..432c26e3d9c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BinaryReaderWriter/CPP/source3.cpp @@ -0,0 +1,100 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +public ref class BinReadWrite +{ +public: + static void Main() + { + String^ testfile = "C:\\temp\\testfile.bin"; + + // create a test file using BinaryWriter + FileStream^ fs = File::Create(testfile); + UTF8Encoding^ utf8 = gcnew UTF8Encoding(); + + BinaryWriter^ bw = gcnew BinaryWriter(fs, utf8); + // write a series of bytes to the file, each time incrementing + // the value from 0 - 127 + int pos; + + for (pos = 0; pos < 128; pos++) + { + bw->Write((Byte)pos); + } + + // reset the stream position for the next write pass + bw->Seek(0, SeekOrigin::Begin); + // write marks in file with the value of 255 going forward + for (pos = 0; pos < 120; pos += 8) + { + bw->Seek(7, SeekOrigin::Current); + bw->Write((Byte)255); + } + + // reset the stream position for the next write pass + bw->Seek(0, SeekOrigin::End); + // write marks in file with the value of 254 going backward + for (pos = 128; pos > 6; pos -= 6) + { + bw->Seek(-6, SeekOrigin::Current); + bw->Write((Byte)254); + bw->Seek(-1, SeekOrigin::Current); + } + + // now dump the contents of the file using the original file stream + fs->Seek(0, SeekOrigin::Begin); + array^ rawbytes = gcnew array(fs->Length); + fs->Read(rawbytes, 0, (int)fs->Length); + + int i = 0; + for each (Byte b in rawbytes) + { + switch (b) + { + case 254: + { + Console::Write("-%- "); + } + break; + + case 255: + { + Console::Write("-*- "); + } + break; + + default: + { + Console::Write("{0:d3} ", b); + } + break; + } + i++; + if (i == 16) + { + Console::WriteLine(); + i = 0; + } + } + fs->Close(); + } +}; + +int main() +{ + BinReadWrite::Main(); +} + +//The output from the program is this: +// +// 000 001 -%- 003 004 005 006 -*- -%- 009 010 011 012 013 -%- -*- +// 016 017 018 019 -%- 021 022 -*- 024 025 -%- 027 028 029 030 -*- +// -%- 033 034 035 036 037 -%- -*- 040 041 042 043 -%- 045 046 -*- +// 048 049 -%- 051 052 053 054 -*- -%- 057 058 059 060 061 -%- -*- +// 064 065 066 067 -%- 069 070 -*- 072 073 -%- 075 076 077 078 -*- +// -%- 081 082 083 084 085 -%- -*- 088 089 090 091 -%- 093 094 -*- +// 096 097 -%- 099 100 101 102 -*- -%- 105 106 107 108 109 -%- -*- +// 112 113 114 115 -%- 117 118 -*- 120 121 -%- 123 124 125 126 127 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp new file mode 100644 index 00000000000..c0d99cbb370 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream1/CPP/client.cpp @@ -0,0 +1,168 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Globalization; +using namespace System::Net; +using namespace System::Net::Sockets; +static const int streamBufferSize = 1000; +public ref class Client +{ +private: + literal int dataArraySize = 100; + literal int numberOfLoops = 10000; + Client(){} + + +public: + static void ReceiveData( Stream^ netStream, Stream^ bufStream ) + { + DateTime startTime; + Double networkTime; + Double bufferedTime = 0; + int bytesReceived = 0; + array^receivedData = gcnew array(dataArraySize); + + // Receive data using the NetworkStream. + Console::WriteLine( "Receiving data using NetworkStream." ); + startTime = DateTime::Now; + while ( bytesReceived < numberOfLoops * receivedData->Length ) + { + bytesReceived += netStream->Read( receivedData, 0, receivedData->Length ); + } + + networkTime = (DateTime::Now - startTime).TotalSeconds; + Console::WriteLine( "{0} bytes received in {1} seconds.\n", bytesReceived.ToString(), networkTime.ToString( "F1" ) ); + + // + // Receive data using the BufferedStream. + Console::WriteLine( "Receiving data using BufferedStream." ); + bytesReceived = 0; + startTime = DateTime::Now; + while ( bytesReceived < numberOfLoops * receivedData->Length ) + { + bytesReceived += bufStream->Read( receivedData, 0, receivedData->Length ); + } + + bufferedTime = (DateTime::Now - startTime).TotalSeconds; + Console::WriteLine( "{0} bytes received in {1} seconds.\n", bytesReceived.ToString(), bufferedTime.ToString( "F1" ) ); + + // + // Print the ratio of read times. + Console::WriteLine( "Receiving data using the buffered " + "network stream was {0} {1} than using the network " + "stream alone.", (networkTime / bufferedTime).ToString( "P0" ), bufferedTime < networkTime ? (String^)"faster" : "slower" ); + } + + static void SendData( Stream^ netStream, Stream^ bufStream ) + { + DateTime startTime; + Double networkTime; + Double bufferedTime; + + // Create random data to send to the server. + array^dataToSend = gcnew array(dataArraySize); + (gcnew Random)->NextBytes( dataToSend ); + + // Send the data using the NetworkStream. + Console::WriteLine( "Sending data using NetworkStream." ); + startTime = DateTime::Now; + for ( int i = 0; i < numberOfLoops; i++ ) + { + netStream->Write( dataToSend, 0, dataToSend->Length ); + + } + networkTime = (DateTime::Now - startTime).TotalSeconds; + Console::WriteLine( "{0} bytes sent in {1} seconds.\n", (numberOfLoops * dataToSend->Length).ToString(), networkTime.ToString( "F1" ) ); + + // + // Send the data using the BufferedStream. + Console::WriteLine( "Sending data using BufferedStream." ); + startTime = DateTime::Now; + for ( int i = 0; i < numberOfLoops; i++ ) + { + bufStream->Write( dataToSend, 0, dataToSend->Length ); + + } + bufStream->Flush(); + bufferedTime = (DateTime::Now - startTime).TotalSeconds; + Console::WriteLine( "{0} bytes sent in {1} seconds.\n", (numberOfLoops * dataToSend->Length).ToString(), bufferedTime.ToString( "F1" ) ); + + // + // Print the ratio of write times. + Console::WriteLine( "Sending data using the buffered " + "network stream was {0} {1} than using the network " + "stream alone.\n", (networkTime / bufferedTime).ToString( "P0" ), bufferedTime < networkTime ? (String^)"faster" : "slower" ); + } + +}; + +int main( int argc, char *argv[] ) +{ + + // Check that an argument was specified when the + // program was invoked. + if ( argc == 1 ) + { + Console::WriteLine( "Error: The name of the host computer" + " must be specified when the program is invoked." ); + return -1; + } + + String^ remoteName = gcnew String( argv[ 1 ] ); + + // Create the underlying socket and connect to the server. + Socket^ clientSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + clientSocket->Connect( gcnew IPEndPoint( Dns::Resolve( remoteName )->AddressList[ 0 ],1800 ) ); + Console::WriteLine( "Client is connected.\n" ); + + // + // Create a NetworkStream that owns clientSocket and + // then create a BufferedStream on top of the NetworkStream. + NetworkStream^ netStream = gcnew NetworkStream( clientSocket,true ); + BufferedStream^ bufStream = gcnew BufferedStream( netStream,streamBufferSize ); + + // + try + { + + // + // Check whether the underlying stream supports seeking. + Console::WriteLine( "NetworkStream {0} seeking.\n", bufStream->CanSeek ? (String^)"supports" : "does not support" ); + + // + // Send and receive data. + // + if ( bufStream->CanWrite ) + { + Client::SendData( netStream, bufStream ); + } + + // + // + if ( bufStream->CanRead ) + { + Client::ReceiveData( netStream, bufStream ); + } + + // + } + finally + { + + // + // When bufStream is closed, netStream is in turn closed, + // which in turn shuts down the connection and closes + // clientSocket. + Console::WriteLine( "\nShutting down connection." ); + bufStream->Close(); + + // + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp new file mode 100644 index 00000000000..fef12f4fa47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.BufferedStream2/CPP/server.cpp @@ -0,0 +1,91 @@ + + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +int main() +{ + + // This is a Windows Sockets 2 error code. + const int WSAETIMEDOUT = 10060; + Socket^ serverSocket; + int bytesReceived; + int totalReceived = 0; + array^receivedData = gcnew array(2000000); + + // Create random data to send to the client. + array^dataToSend = gcnew array(2000000); + (gcnew Random)->NextBytes( dataToSend ); + IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; + IPEndPoint^ ipEndpoint = gcnew IPEndPoint( ipAddress,1800 ); + + // Create a socket and listen for incoming connections. + Socket^ listenSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + try + { + listenSocket->Bind( ipEndpoint ); + listenSocket->Listen( 1 ); + + // Accept a connection and create a socket to handle it. + serverSocket = listenSocket->Accept(); + Console::WriteLine( "Server is connected.\n" ); + } + finally + { + listenSocket->Close(); + } + + try + { + + // Send data to the client. + Console::Write( "Sending data ... " ); + int bytesSent = serverSocket->Send( dataToSend, 0, dataToSend->Length, SocketFlags::None ); + Console::WriteLine( "{0} bytes sent.\n", bytesSent.ToString() ); + + // Set the timeout for receiving data to 2 seconds. + serverSocket->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::ReceiveTimeout, 2000 ); + + // Receive data from the client. + Console::Write( "Receiving data ... " ); + try + { + do + { + bytesReceived = serverSocket->Receive( receivedData, 0, receivedData->Length, SocketFlags::None ); + totalReceived += bytesReceived; + } + while ( bytesReceived != 0 ); + } + catch ( SocketException^ e ) + { + if ( e->ErrorCode == WSAETIMEDOUT ) + { + + // Data was not received within the given time. + // Assume that the transmission has ended. + } + else + { + Console::WriteLine( "{0}: {1}\n", e->GetType()->Name, e->Message ); + } + } + finally + { + Console::WriteLine( "{0} bytes received.\n", totalReceived.ToString() ); + } + + } + finally + { + serverSocket->Shutdown( SocketShutdown::Both ); + Console::WriteLine( "Connection shut down." ); + serverSocket->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp new file mode 100644 index 00000000000..c11186b5225 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Directory/CPP/class1.cpp @@ -0,0 +1,163 @@ + +// +// +// +// +// +using namespace System; +class Class1 +{ +public: + void PrintFileSystemEntries( String^ path ) + { + try + { + + // Obtain the file system entries in the directory path. + array^directoryEntries = System::IO::Directory::GetFileSystemEntries( path ); + for ( int i = 0; i < directoryEntries->Length; i++ ) + { + System::Console::WriteLine( directoryEntries[ i ] ); + + } + } + catch ( ArgumentNullException^ ) + { + System::Console::WriteLine( "Path is a null reference." ); + } + catch ( System::Security::SecurityException^ ) + { + System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); + } + catch ( ArgumentException^ ) + { + System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." ); + } + catch ( System::IO::DirectoryNotFoundException^ ) + { + System::Console::WriteLine( "The path encapsulated in the \HelloServer' Directory object does not exist." ); + } + + } + + void PrintFileSystemEntries( String^ path, String^ pattern ) + { + try + { + + // Obtain the file system entries in the directory + // path that match the pattern. + array^directoryEntries = System::IO::Directory::GetFileSystemEntries( path, pattern ); + for ( int i = 0; i < directoryEntries->Length; i++ ) + { + System::Console::WriteLine( directoryEntries[ i ] ); + + } + } + catch ( ArgumentNullException^ ) + { + System::Console::WriteLine( "Path is a null reference." ); + } + catch ( System::Security::SecurityException^ ) + { + System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); + } + catch ( ArgumentException^ ) + { + System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." ); + } + catch ( System::IO::DirectoryNotFoundException^ ) + { + System::Console::WriteLine( "The path encapsulated in the \HelloServer' Directory object does not exist." ); + } + + } + + + // Print out all logical drives on the system. + void GetLogicalDrives() + { + try + { + array^drives = System::IO::Directory::GetLogicalDrives(); + for ( int i = 0; i < drives->Length; i++ ) + { + System::Console::WriteLine( drives[ i ] ); + + } + } + catch ( System::IO::IOException^ ) + { + System::Console::WriteLine( "An I/O error occurs." ); + } + catch ( System::Security::SecurityException^ ) + { + System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); + } + + } + + void GetParent( String^ path ) + { + try + { + System::IO::DirectoryInfo^ directoryInfo = System::IO::Directory::GetParent( path ); + System::Console::WriteLine( directoryInfo->FullName ); + } + catch ( ArgumentNullException^ ) + { + System::Console::WriteLine( "Path is a null reference." ); + } + catch ( ArgumentException^ ) + { + System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, or \HelloServer' contains invalid characters." ); + } + + } + + void Move( String^ sourcePath, String^ destinationPath ) + { + try + { + System::IO::Directory::Move( sourcePath, destinationPath ); + System::Console::WriteLine( "The directory move is complete." ); + } + catch ( ArgumentNullException^ ) + { + System::Console::WriteLine( "Path is a null reference." ); + } + catch ( System::Security::SecurityException^ ) + { + System::Console::WriteLine( "The caller does not have the \HelloServer' required permission." ); + } + catch ( ArgumentException^ ) + { + System::Console::WriteLine( "Path is an empty String, \HelloServer' contains only white spaces, \HelloServer' or contains invalid characters." ); + } + catch ( System::IO::IOException^ ) + { + System::Console::WriteLine( "An attempt was made to move a \HelloServer' directory to a different \HelloServer' volume, or destDirName \HelloServer' already exists." ); + } + + } + +}; + +int main() +{ + Class1 * snippets = new Class1; + String^ path = System::IO::Directory::GetCurrentDirectory(); + String^ filter = "*.exe"; + snippets->PrintFileSystemEntries( path ); + snippets->PrintFileSystemEntries( path, filter ); + snippets->GetLogicalDrives(); + snippets->GetParent( path ); + snippets->Move( "C:\\proof", "C:\\Temp" ); + return 0; +} + +// +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp new file mode 100644 index 00000000000..4223289ec56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryInfo_SearchOptions/cpp/searchoption.cpp @@ -0,0 +1,44 @@ +// +using namespace System; +using namespace System::IO; + +ref class App +{ +public: + static void Main() + { + // Specify the directory you want to manipulate. + String^ path = "c:\\"; + String^ searchPattern = "c*"; + + DirectoryInfo^ di = gcnew DirectoryInfo(path); + array^ directories = + di->GetDirectories(searchPattern, SearchOption::TopDirectoryOnly); + + array^ files = + di->GetFiles(searchPattern, SearchOption::TopDirectoryOnly); + + Console::WriteLine( + "Directories that begin with the letter \"c\" in {0}", path); + for each (DirectoryInfo^ dir in directories) + { + Console::WriteLine( + "{0,-25} {1,25}", dir->FullName, dir->LastWriteTime); + } + + Console::WriteLine(); + Console::WriteLine( + "Files that begin with the letter \"c\" in {0}", path); + for each (FileInfo^ file in files) + { + Console::WriteLine( + "{0,-25} {1,25}", file->Name, file->LastWriteTime); + } + } // Main() +}; // App() + +int main() +{ + App::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp new file mode 100644 index 00000000000..5bae2a921c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.DirectoryRoot/CPP/example.cpp @@ -0,0 +1,34 @@ + +// +// This sample shows how to set the current directory and how to determine +// the root directory. +using namespace System; +using namespace System::IO; +int main() +{ + + // Create string for a directory. This value should be an existing directory + // or the sample will throw a DirectoryNotFoundException. + String^ dir = "C:\\test"; + try + { + + //Set the current directory. + Directory::SetCurrentDirectory( dir ); + } + catch ( DirectoryNotFoundException^ e ) + { + Console::WriteLine( "The specified directory does not exist. {0}", e ); + } + + + // Print to console the results. + Console::WriteLine( "Root directory: {0}", Directory::GetDirectoryRoot( dir ) ); + Console::WriteLine( "Current directory: {0}", Directory::GetCurrentDirectory() ); +} + +// The output of this sample depends on what value you assign to the variable dir. +// If the directory c:\test exists, the output for this sample is: +// Root directory: C:\ +// Current directory: C:\test +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp new file mode 100644 index 00000000000..fc1124722e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream1/CPP/source.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ fileName = "Test@##@.dat"; + + // Create random data to write to the file. + array^dataArray = gcnew array(100000); + (gcnew Random)->NextBytes( dataArray ); + FileStream^ fileStream = gcnew FileStream( fileName,FileMode::Create ); + try + { + + // Write the data to the file, byte by byte. + for ( int i = 0; i < dataArray->Length; i++ ) + { + fileStream->WriteByte( dataArray[ i ] ); + + } + + // Set the stream position to the beginning of the file. + fileStream->Seek( 0, SeekOrigin::Begin ); + + // Read and verify the data. + for ( int i = 0; i < fileStream->Length; i++ ) + { + if ( dataArray[ i ] != fileStream->ReadByte() ) + { + Console::WriteLine( "Error writing data." ); + return -1; + } + + } + Console::WriteLine( "The data was written to {0} " + "and verified.", fileStream->Name ); + } + finally + { + fileStream->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp new file mode 100644 index 00000000000..e6d0b8b59b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream2/CPP/source.cpp @@ -0,0 +1,156 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Threading; + +// Maintain state information to be passed to +// EndWriteCallback and EndReadCallback. +ref class State +{ +private: + + // fStream is used to read and write to the file. + FileStream^ fStream; + + // writeArray stores data that is written to the file. + array^writeArray; + + // readArray stores data that is read from the file. + array^readArray; + + // manualEvent signals the main thread + // when verification is complete. + ManualResetEvent^ manualEvent; + +public: + State( FileStream^ fStream, array^writeArray, ManualResetEvent^ manualEvent ) + { + this->fStream = fStream; + this->writeArray = writeArray; + this->manualEvent = manualEvent; + readArray = gcnew array(writeArray->Length); + } + + + property FileStream^ FStream + { + FileStream^ get() + { + return fStream; + } + + } + + property array^ WriteArray + { + array^ get() + { + return writeArray; + } + + } + + property array^ ReadArray + { + array^ get() + { + return readArray; + } + + } + + property ManualResetEvent^ ManualEvent + { + ManualResetEvent^ get() + { + return manualEvent; + } + + } + +}; + +ref class FStream +{ +private: + + // When BeginRead is finished reading data from the file, the + // EndReadCallback method is called to end the asynchronous + // read operation and then verify the data. + // + static void EndReadCallback( IAsyncResult^ asyncResult ) + { + State^ tempState = dynamic_cast(asyncResult->AsyncState); + int readCount = tempState->FStream->EndRead( asyncResult ); + int i = 0; + while ( i < readCount ) + { + if ( tempState->ReadArray[ i ] != tempState->WriteArray[ i++ ] ) + { + Console::WriteLine( "Error writing data." ); + tempState->FStream->Close(); + return; + } + } + + Console::WriteLine( "The data was written to {0} " + "and verified.", tempState->FStream->Name ); + tempState->FStream->Close(); + + // Signal the main thread that the verification is finished. + tempState->ManualEvent->Set(); + } + + +public: + + // + // When BeginWrite is finished writing data to the file, the + // EndWriteCallback method is called to end the asynchronous + // write operation and then read back and verify the data. + // + static void EndWriteCallback( IAsyncResult^ asyncResult ) + { + State^ tempState = dynamic_cast(asyncResult->AsyncState); + FileStream^ fStream = tempState->FStream; + fStream->EndWrite( asyncResult ); + + // Asynchronously read back the written data. + fStream->Position = 0; + asyncResult = fStream->BeginRead( tempState->ReadArray, 0, tempState->ReadArray->Length, gcnew AsyncCallback( &FStream::EndReadCallback ), tempState ); + + // Concurrently do other work, such as + // logging the write operation. + } + +}; + + +// +// +int main() +{ + + // Create a synchronization object that gets + // signaled when verification is complete. + ManualResetEvent^ manualEvent = gcnew ManualResetEvent( false ); + + // Create the data to write to the file. + array^writeArray = gcnew array(100000); + (gcnew Random)->NextBytes( writeArray ); + FileStream^ fStream = gcnew FileStream( "Test#@@#.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::None,4096,true ); + + // Check that the FileStream was opened asynchronously. + Console::WriteLine( "fStream was {0}opened asynchronously.", fStream->IsAsync ? (String^)"" : "not " ); + + // Asynchronously write to the file. + IAsyncResult^ asyncResult = fStream->BeginWrite( writeArray, 0, writeArray->Length, gcnew AsyncCallback( &FStream::EndWriteCallback ), gcnew State( fStream,writeArray,manualEvent ) ); + + // Concurrently do other work and then wait + // for the data to be written and verified. + manualEvent->WaitOne( 5000, false ); +} + +// +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp new file mode 100644 index 00000000000..c9d04e24506 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.FileStream3/CPP/fstreamlock.cpp @@ -0,0 +1,144 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +int main() +{ + UnicodeEncoding^ uniEncoding = gcnew UnicodeEncoding; + String^ lastRecordText = "The last processed record number was: "; + int textLength = uniEncoding->GetByteCount( lastRecordText ); + int recordNumber = 13; + int byteCount = uniEncoding->GetByteCount( recordNumber.ToString() ); + String^ tempString; + + // + FileStream^ fileStream = gcnew FileStream( "Test#@@#.dat",FileMode::OpenOrCreate,FileAccess::ReadWrite,FileShare::ReadWrite ); + + // + try + { + + // + // Write the original file data. + if ( fileStream->Length == 0 ) + { + tempString = String::Concat( lastRecordText, recordNumber.ToString() ); + fileStream->Write( uniEncoding->GetBytes( tempString ), 0, uniEncoding->GetByteCount( tempString ) ); + } + + // + // Allow the user to choose the operation. + Char consoleInput = 'R'; + array^readText = gcnew array(fileStream->Length); + while ( consoleInput != 'X' ) + { + Console::Write( "\nEnter 'R' to read, 'W' to write, 'L' to " + "lock, 'U' to unlock, anything else to exit: " ); + if ( (tempString = Console::ReadLine())->Length == 0 ) + { + break; + } + consoleInput = Char::ToUpper( tempString[0] ); + switch ( consoleInput ) + { + case 'R': + try + { + fileStream->Seek( 0, SeekOrigin::Begin ); + fileStream->Read( readText, 0, (int)fileStream->Length ); + tempString = gcnew String( uniEncoding->GetChars( readText, 0, readText->Length ) ); + Console::WriteLine( tempString ); + recordNumber = Int32::Parse( tempString->Substring( tempString->IndexOf( ':' ) + 2 ) ); + } + // Catch the IOException generated if the + // specified part of the file is locked. + catch ( IOException^ e ) + { + Console::WriteLine( "{0}: The read " + "operation could not be performed " + "because the specified part of the " + "file is locked.", e->GetType()->Name ); + } + + break; + + // + // Update the file. + case 'W': + try + { + fileStream->Seek( textLength, SeekOrigin::Begin ); + fileStream->Read( readText, textLength - 1, byteCount ); + tempString = gcnew String( uniEncoding->GetChars( readText, textLength - 1, byteCount ) ); + recordNumber = Int32::Parse( tempString ) + 1; + fileStream->Seek( textLength, SeekOrigin::Begin ); + fileStream->Write( uniEncoding->GetBytes( recordNumber.ToString() ), 0, byteCount ); + fileStream->Flush(); + Console::WriteLine( "Record has been updated." ); + } + // + // + // Catch the IOException generated if the + // specified part of the file is locked. + catch ( IOException^ e ) + { + Console::WriteLine( "{0}: The write operation could not " + "be performed because the specified " + "part of the file is locked.", e->GetType()->Name ); + } + + + // + break; + + // Lock the specified part of the file. + case 'L': + try + { + fileStream->Lock( textLength - 1, byteCount ); + Console::WriteLine( "The specified part " + "of file has been locked." ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "{0}: The specified part of file is" + " already locked.", e->GetType()->Name ); + } + + break; + + // + // Unlock the specified part of the file. + case 'U': + try + { + fileStream->Unlock( textLength - 1, byteCount ); + Console::WriteLine( "The specified part " + "of file has been unlocked." ); + } + catch ( IOException^ e ) + { + Console::WriteLine( "{0}: The specified part of file is " + "not locked by the current process.", e->GetType()->Name ); + } + + break; + + default: + + // + // Exit the program. + consoleInput = 'X'; + break; + } + } + } + finally + { + fileStream->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp new file mode 100644 index 00000000000..af3bee22a32 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/remarks.cpp @@ -0,0 +1,61 @@ +using namespace System; +using namespace System::IO; +using namespace System::IO::IsolatedStorage; + +public ref class IsoFileGetStoreSample +{ +public: + static void Main() + { + IsolatedStorageFile^ isoFile; + + // remarks for GetMachineStoreForApplication() + // + isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application | + IsolatedStorageScope::Machine, (Type^)nullptr); + // + isoFile->Close(); + + // remarks for GetMachineStoreForAssembly() + // + isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | + IsolatedStorageScope::Machine, (Type^)nullptr, (Type^)nullptr); + // + isoFile->Close(); + + // remarks for GetMachineStoreForDomain() + // + isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | + IsolatedStorageScope::Domain | IsolatedStorageScope::Machine, + (Type^)nullptr, (Type^)nullptr); + // + isoFile->Close(); + + // remarks for GetUserStoreForApplication() + // + isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Application | + IsolatedStorageScope::User, (Type^)nullptr); + // + isoFile->Close(); + + // remarks for GetUserStoreForAssembly() + // + isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | + IsolatedStorageScope::User, (Type^)nullptr, (Type^)nullptr); + // + isoFile->Close(); + + // remarks for GetUserStoreForDomain() + // + isoFile = IsolatedStorageFile::GetStore(IsolatedStorageScope::Assembly | + IsolatedStorageScope::Domain | IsolatedStorageScope::User, + (Type^)nullptr, (Type^)nullptr); + // + isoFile->Close(); + } +}; + +int main() +{ + IsoFileGetStoreSample::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp new file mode 100644 index 00000000000..daaf6e6e7ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.IsolatedStorage.IsolatedStorage/CPP/source.cpp @@ -0,0 +1,422 @@ + +// +// This sample demonstrates methods of classes found in the System.IO IsolatedStorage namespace. +using namespace System; +using namespace System::IO; +using namespace System::IO::IsolatedStorage; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; + +public ref class LoginPrefs +{ +private: + String^ userName; + String^ newsUrl; + String^ sportsUrl; + bool newPrefs; + +public: + + // + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + bool GetPrefsForUser() + { + try + { + + // + // Retrieve an IsolatedStorageFile for the current Domain and Assembly. + IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), (Type^)nullptr, nullptr ); + IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::Open,FileAccess::ReadWrite,isoFile ); + + // + // farThe code executes to this point only if a file corresponding to the username exists. + // Though you can perform operations on the stream, you cannot get a handle to the file. + try + { + IntPtr aFileHandle = isoStream->Handle; + Console::WriteLine( "A pointer to a file handle has been obtained. {0} {1}", aFileHandle, aFileHandle.GetHashCode() ); + } + catch ( Exception^ e ) + { + + // Handle the exception. + Console::WriteLine( "Expected exception" ); + Console::WriteLine( e->ToString() ); + } + + StreamReader^ reader = gcnew StreamReader( isoStream ); + + // Read the data. + this->NewsUrl = reader->ReadLine(); + this->SportsUrl = reader->ReadLine(); + reader->Close(); + isoFile->Close(); + isoStream->Close(); + return false; + } + catch ( Exception^ e ) + { + + // Expected exception if a file cannot be found. This indicates that we have a new user. + String^ errorMessage = e->ToString(); + return true; + } + + } + + + // + // + bool GetIsoStoreInfo() + { + + // Get a User store with type evidence for the current Domain and the Assembly. + IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); + + // + array^dirNames = isoFile->GetDirectoryNames( "*" ); + array^fileNames = isoFile->GetFileNames( "*" ); + + // List directories currently in this Isolated Storage. + if ( dirNames->Length > 0 ) + { + for ( int i = 0; i < dirNames->Length; ++i ) + { + Console::WriteLine( "Directory Name: {0}", dirNames[ i ] ); + + } + } + + + // List the files currently in this Isolated Storage. + // The list represents all users who have personal preferences stored for this application. + if ( fileNames->Length > 0 ) + { + for ( int i = 0; i < fileNames->Length; ++i ) + { + Console::WriteLine( "File Name: {0}", fileNames[ i ] ); + + } + } + + + // + isoFile->Close(); + return true; + } + + + // + // + double SetPrefsForUser() + { + try + { + + // + IsolatedStorageFile^ isoFile; + isoFile = IsolatedStorageFile::GetUserStoreForDomain(); + + // Open or create a writable file. + IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,isoFile ); + StreamWriter^ writer = gcnew StreamWriter( isoStream ); + writer->WriteLine( this->NewsUrl ); + writer->WriteLine( this->SportsUrl ); + + // Calculate the amount of space used to record the user's preferences. + double d = isoFile->CurrentSize / isoFile->MaximumSize; + Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() ); + Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() ); + writer->Close(); + isoFile->Close(); + isoStream->Close(); + return d; + + // + } + catch ( Exception^ e ) + { + // Add code here to handle the exception. + Console::WriteLine( e->ToString() ); + return 0.0; + } + + } + + + // + // + void DeleteFiles() + { + + // + try + { + IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); + array^dirNames = isoFile->GetDirectoryNames( "*" ); + array^fileNames = isoFile->GetFileNames( "*" ); + + // + // List the files currently in this Isolated Storage. + // The list represents all users who have personal + // preferences stored for this application. + if ( fileNames->Length > 0 ) + { + for ( int i = 0; i < fileNames->Length; ++i ) + { + + //Delete the files. + isoFile->DeleteFile( fileNames[ i ] ); + + } + fileNames = isoFile->GetFileNames( "*" ); + } + isoFile->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + + } + + + // + // + // This method deletes directories in the specified Isolated Storage, after first + // deleting the files they contain. In this example, the Archive directory is deleted. + // There should be no other directories in this Isolated Storage. + void DeleteDirectories() + { + try + { + IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); + array^dirNames = isoFile->GetDirectoryNames( "*" ); + array^fileNames = isoFile->GetFileNames( "Archive\\*" ); + + // Delete the current files within the Archive directory. + if ( fileNames->Length > 0 ) + { + for ( int i = 0; i < fileNames->Length; ++i ) + { + + //delete files + isoFile->DeleteFile( String::Concat("Archive\\", fileNames[ i ]) ); + + } + fileNames = isoFile->GetFileNames( "Archive\\*" ); + } + if ( dirNames->Length > 0 ) + { + for ( int i = 0; i < dirNames->Length; ++i ) + { + + // Delete the Archive directory. + isoFile->DeleteDirectory( dirNames[ i ] ); + + } + } + dirNames = isoFile->GetDirectoryNames( "*" ); + isoFile->Remove(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + + } + + + // + // + double SetNewPrefsForUser() + { + try + { + Byte inputChar; + IsolatedStorageFile^ isoFile = IsolatedStorageFile::GetStore( static_cast(IsolatedStorageScope::User | IsolatedStorageScope::Assembly | IsolatedStorageScope::Domain), System::Security::Policy::Url::typeid, System::Security::Policy::Url::typeid ); + + // If this is not a new user, archive the old preferences and + // overwrite them using the new preferences. + if ( !this->NewPrefs ) + { + if ( isoFile->GetDirectoryNames( "Archive" )->Length == 0 ) + isoFile->CreateDirectory( "Archive" ); + else + { + + // + // This is the stream to which data will be written. + IsolatedStorageFileStream^ source = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,isoFile ); + + // This is the stream from which data will be read. + Console::WriteLine( "Is the source file readable? {0}", (source->CanRead ? (String^)"true" : "false") ); + Console::WriteLine( "Creating new IsolatedStorageFileStream for Archive." ); + + // Open or create a writable file. + IsolatedStorageFileStream^ target = gcnew IsolatedStorageFileStream( String::Concat("Archive\\",this->userName),FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,isoFile ); + + // + // + Console::WriteLine( "Is the target file writable? {0}", (target->CanWrite ? (String^)"true" : "false") ); + + // + // Stream the old file to a new file in the Archive directory. + if ( source->IsAsync && target->IsAsync ) + { + + // IsolatedStorageFileStreams cannot be asynchronous. However, you + // can use the asynchronous BeginRead and BeginWrite functions + // with some possible performance penalty. + Console::WriteLine( "IsolatedStorageFileStreams cannot be asynchronous." ); + } + else + { + + // + Console::WriteLine( "Writing data to the new file." ); + while ( source->Position < source->Length ) + { + inputChar = (Byte)source->ReadByte(); + target->WriteByte( (Byte)source->ReadByte() ); + } + + // Determine the size of the IsolatedStorageFileStream + // by checking its Length property. + Console::WriteLine( "Total Bytes Read: {0}", source->Length.ToString() ); + + // + } + + // After you have read and written to the streams, close them. + target->Close(); + source->Close(); + } + } + + // + // Open or create a writable file, no larger than 10k + IsolatedStorageFileStream^ isoStream = gcnew IsolatedStorageFileStream( this->userName,FileMode::OpenOrCreate,FileAccess::Write,FileShare::Write,10240,isoFile ); + + // + isoStream->Position = 0; // Position to overwrite the old data. + + // + // + StreamWriter^ writer = gcnew StreamWriter( isoStream ); + + // Update the data based on the new inputs. + writer->WriteLine( this->NewsUrl ); + writer->WriteLine( this->SportsUrl ); + + // Calculate the amount of space used to record this user's preferences. + double d = isoFile->CurrentSize / isoFile->MaximumSize; + Console::WriteLine( "CurrentSize = {0}", isoFile->CurrentSize.ToString() ); + Console::WriteLine( "MaximumSize = {0}", isoFile->MaximumSize.ToString() ); + + // + // StreamWriter.Close implicitly closes isoStream. + writer->Close(); + isoFile->Close(); + return d; + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + return 0.0; + } + + } + + LoginPrefs( String^ aUserName ) + { + userName = aUserName; + newPrefs = GetPrefsForUser(); + } + + + property String^ NewsUrl + { + String^ get() + { + return newsUrl; + } + + void set( String^ value ) + { + newsUrl = value; + } + + } + + property String^ SportsUrl + { + String^ get() + { + return sportsUrl; + } + + void set( String^ value ) + { + sportsUrl = value; + } + + } + + property bool NewPrefs + { + bool get() + { + return newPrefs; + } + + } + +}; + +void GatherInfoFromUser( LoginPrefs^ lp ) +{ + Console::WriteLine( "Please enter the URL of your news site." ); + lp->NewsUrl = Console::ReadLine(); + Console::WriteLine( "Please enter the URL of your sports site." ); + lp->SportsUrl = Console::ReadLine(); +} + +int main() +{ + + // Prompt the user for their username. + Console::WriteLine( "Enter your login ID:" ); + + // Does no error checking. + LoginPrefs^ lp = gcnew LoginPrefs( Console::ReadLine() ); + if ( lp->NewPrefs ) + { + Console::WriteLine( "Please set preferences for a new user." ); + GatherInfoFromUser( lp ); + + // Write the new preferences to storage. + double percentUsed = lp->SetPrefsForUser(); + Console::WriteLine( "Your preferences have been written. Current space used is {0}%", percentUsed ); + } + else + { + Console::WriteLine( "Welcome back." ); + Console::WriteLine( "Your preferences have expired, please reset them." ); + GatherInfoFromUser( lp ); + lp->SetNewPrefsForUser(); + Console::WriteLine( "Your news site has been set to {0}\n and your sports site has been set to {1}.", lp->NewsUrl, lp->SportsUrl ); + } + + lp->GetIsoStoreInfo(); + Console::WriteLine( "Enter 'd' to delete the IsolatedStorage files and exit, or press any other key to exit without deleting files." ); + String^ consoleInput = Console::ReadLine(); + if ( consoleInput->Equals( "d" ) ) + { + lp->DeleteFiles(); + lp->DeleteDirectories(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp new file mode 100644 index 00000000000..6d60f8f19f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.MemoryStream/CPP/memstream.cpp @@ -0,0 +1,74 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + int count; + array^byteArray; + array^charArray; + UnicodeEncoding^ uniEncoding = gcnew UnicodeEncoding; + + // Create the data to write to the stream. + array^firstString = uniEncoding->GetBytes( "Invalid file path characters are: " ); + array^secondString = uniEncoding->GetBytes( Path::InvalidPathChars ); + + // + MemoryStream^ memStream = gcnew MemoryStream( 100 ); + // + try + { + // + // Write the first string to the stream. + memStream->Write( firstString, 0, firstString->Length ); + // + + // + // Write the second string to the stream, byte by byte. + count = 0; + while ( count < secondString->Length ) + { + memStream->WriteByte( secondString[ count++ ] ); + } + // + + + // + // Write the stream properties to the console. + Console::WriteLine( "Capacity = {0}, Length = {1}, " + "Position = {2}\n", memStream->Capacity.ToString(), memStream->Length.ToString(), memStream->Position.ToString() ); + // + + // + // Set the stream position to the beginning of the stream. + memStream->Seek( 0, SeekOrigin::Begin ); + // + + // + // Read the first 20 bytes from the stream. + byteArray = gcnew array(memStream->Length); + count = memStream->Read( byteArray, 0, 20 ); + // + + // + // Read the remaining bytes, byte by byte. + while ( count < memStream->Length ) + { + byteArray[ count++ ] = Convert::ToByte( memStream->ReadByte() ); + } + // + + // Decode the Byte array into a Char array + // and write it to the console. + charArray = gcnew array(uniEncoding->GetCharCount( byteArray, 0, count )); + uniEncoding->GetDecoder()->GetChars( byteArray, 0, count, charArray, 0 ); + Console::WriteLine( charArray ); + } + finally + { + memStream->Close(); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp new file mode 100644 index 00000000000..ea4a47ab8ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Path Members/CPP/pathmembers.cpp @@ -0,0 +1,307 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +void ChangeExtension() +{ + String^ goodFileName = "C:\\mydir\\myfile.com.extension"; + String^ badFileName = "C:\\mydir\\"; + String^ result; + result = Path::ChangeExtension( goodFileName, ".old" ); + Console::WriteLine( "ChangeExtension({0}, '.old') returns '{1}'", goodFileName, result ); + result = Path::ChangeExtension( goodFileName, "" ); + Console::WriteLine( "ChangeExtension({0}, '') returns '{1}'", goodFileName, result ); + result = Path::ChangeExtension( badFileName, ".old" ); + Console::WriteLine( "ChangeExtension({0}, '.old') returns '{1}'", badFileName, result ); + + // This code produces output similar to the following: + // + // ChangeExtension(C:\mydir\myfile.com.extension, '.old') returns 'C:\mydir\myfile.com.old' + // ChangeExtension(C:\mydir\myfile.com.extension, '') returns 'C:\mydir\myfile.com.' + // ChangeExtension(C:\mydir\, '.old') returns 'C:\mydir\.old' + // + Console::WriteLine(); +} + +void Combine() +{ + // + String^ path1 = " C:\\mydir1"; + String^ path2 = "mydir2"; + String^ path3 = " mydir3"; + String^ combinedPaths; + combinedPaths = Path::Combine( path1, path2 ); + Console::WriteLine( "Combine('{0}', '{1}') returns '{2}'", path1, path2, combinedPaths ); + combinedPaths = Path::Combine( path1, path3 ); + Console::WriteLine( "Combine('{0}', '{1}') returns '{2}'", path1, path3, combinedPaths ); + + // This code produces output similar to the following: + // + // Combine(' C:\mydir1', 'mydir2') returns ' C:\mydir1\mydir2' + // Combine(' C:\mydir1', ' mydir3') returns ' C:\mydir1\ mydir3' + // + Console::WriteLine(); +} + +void GetDirectoryName() +{ + // + String^ filePath = "C:\\MyDir\\MySubDir\\myfile.ext"; + String^ directoryName; + int i = 0; + + while (filePath != nullptr) + { + directoryName = Path::GetDirectoryName(filePath); + Console::WriteLine("GetDirectoryName('{0}') returns '{1}'", + filePath, directoryName); + filePath = directoryName; + if (i == 1) + { + filePath = directoryName + "\\"; // this will preserve the previous path + } + i++; + } + /* + This code produces the following output: + + GetDirectoryName('C:\MyDir\MySubDir\myfile.ext') returns 'C:\MyDir\MySubDir' + GetDirectoryName('C:\MyDir\MySubDir') returns 'C:\MyDir' + GetDirectoryName('C:\MyDir\') returns 'C:\MyDir' + GetDirectoryName('C:\MyDir') returns 'C:\' + GetDirectoryName('C:\') returns '' + */ + // + Console::WriteLine(); +} + +void GetExtension() +{ + // + String^ fileName = "C:\\mydir.old\\myfile.ext"; + String^ path = "C:\\mydir.old\\"; + String^ extension; + extension = Path::GetExtension( fileName ); + Console::WriteLine( "GetExtension('{0}') returns '{1}'", fileName, extension ); + extension = Path::GetExtension( path ); + Console::WriteLine( "GetExtension('{0}') returns '{1}'", path, extension ); + + // This code produces output similar to the following: + // + // GetExtension('C:\mydir.old\myfile.ext') returns '.ext' + // GetExtension('C:\mydir.old\') returns '' + // + Console::WriteLine(); +} + +void GetFileName() +{ + // + String^ fileName = "C:\\mydir\\myfile.ext"; + String^ path = "C:\\mydir\\"; + String^ result; + result = Path::GetFileName( fileName ); + Console::WriteLine( "GetFileName('{0}') returns '{1}'", fileName, result ); + result = Path::GetFileName( path ); + Console::WriteLine( "GetFileName('{0}') returns '{1}'", path, result ); + + // This code produces output similar to the following: + // + // GetFileName('C:\mydir\myfile.ext') returns 'myfile.ext' + // GetFileName('C:\mydir\') returns '' + // + Console::WriteLine(); +} + +void GetFileNameWithoutExtension() +{ + // + String^ fileName = "C:\\mydir\\myfile.ext"; + String^ path = "C:\\mydir\\"; + String^ result; + result = Path::GetFileNameWithoutExtension( fileName ); + Console::WriteLine( "GetFileNameWithoutExtension('{0}') returns '{1}'", fileName, result ); + result = Path::GetFileName( path ); + Console::WriteLine( "GetFileName('{0}') returns '{1}'", path, result ); + + // This code produces output similar to the following: + // + // GetFileNameWithoutExtension('C:\mydir\myfile.ext') returns 'myfile' + // GetFileName('C:\mydir\') returns '' + // + Console::WriteLine(); +} + +void GetFullPath() +{ + // + String^ fileName = "myfile.ext"; + String^ path = "\\mydir\\"; + String^ fullPath; + fullPath = Path::GetFullPath( path ); + Console::WriteLine( "GetFullPath('{0}') returns '{1}'", path, fullPath ); + fullPath = Path::GetFullPath( fileName ); + Console::WriteLine( "GetFullPath('{0}') returns '{1}'", fileName, fullPath ); + + // Output is based on your current directory, except + // in the last case, where it is based on the root drive + // GetFullPath('mydir') returns 'C:\temp\Demo\mydir' + // GetFullPath('myfile.ext') returns 'C:\temp\Demo\myfile.ext' + // GetFullPath('\mydir') returns 'C:\mydir' + // + Console::WriteLine(); +} + +void GetPathRoot() +{ + // + String^ path = "\\mydir\\"; + String^ fileName = "myfile.ext"; + String^ fullPath = "C:\\mydir\\myfile.ext"; + String^ pathRoot; + pathRoot = Path::GetPathRoot( path ); + Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", path, pathRoot ); + pathRoot = Path::GetPathRoot( fileName ); + Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", fileName, pathRoot ); + pathRoot = Path::GetPathRoot( fullPath ); + Console::WriteLine( "GetPathRoot('{0}') returns '{1}'", fullPath, pathRoot ); + + // This code produces output similar to the following: + // + // GetPathRoot('\mydir\') returns '\' + // GetPathRoot('myfile.ext') returns '' + // GetPathRoot('C:\mydir\myfile.ext') returns 'C:\' + // + Console::WriteLine(); +} + +void GetTempFileName() +{ + // + String^ fileName = Path::GetTempFileName(); + FileInfo^ fileInfo = gcnew FileInfo( fileName ); + Console::WriteLine( "File '{0}' created of size {1} bytes", fileName, (fileInfo->Length).ToString() ); + + // Write some text to the file. + FileStream^ f = gcnew FileStream( fileName,FileMode::Open ); + StreamWriter^ s = gcnew StreamWriter( f ); + s->WriteLine( "Output to the file" ); + s->Close(); + f->Close(); + fileInfo->Refresh(); + Console::WriteLine( "File '{0}' now has size {1} bytes", fileName, (fileInfo->Length).ToString() ); + + // This code produces output similar to the following: + // + // File 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp38.tmp' created of size 0 bytes + // File 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\tmp38.tmp' now has size 20 bytes + // + Console::WriteLine(); +} + +void GetTempPath() +{ + // + String^ tempPath = Path::GetTempPath(); + Console::WriteLine( "Temporary path is '{0}'", tempPath ); + DirectoryInfo^ tempDir = gcnew DirectoryInfo( tempPath ); + Console::WriteLine( "{0} contains {1} files", tempPath, (tempDir->GetFiles()->Length).ToString() ); + + // This code produces output similar to the following: + // + // Temporary path is 'D:\Documents and Settings\cliffc\Local Settings\Temp\8\' + // D:\Documents and Settings\cliffc\Local Settings\Temp\8\ contains 6 files + // + Console::WriteLine(); +} + +void HasExtension() +{ + // + String^ fileName1 = "myfile.ext"; + String^ fileName2 = "mydir\\myfile"; + String^ path = "C:\\mydir.ext\\"; + bool result; + result = Path::HasExtension( fileName1 ); + Console::WriteLine( "HasExtension('{0}') returns {1}", fileName1, result.ToString() ); + result = Path::HasExtension( fileName2 ); + Console::WriteLine( "HasExtension('{0}') returns {1}", fileName2, result.ToString() ); + result = Path::HasExtension( path ); + Console::WriteLine( "HasExtension('{0}') returns {1}", path, result.ToString() ); + + // This code produces output similar to the following: + // + // HasExtension('myfile.ext') returns True + // HasExtension('mydir\myfile') returns False + // HasExtension('C:\mydir.ext\') returns False + // + Console::WriteLine(); +} + +void IsPathRooted() +{ + // + String^ fileName = "C:\\mydir\\myfile.ext"; + String^ UncPath = "\\\\myPc\\mydir\\myfile"; + String^ relativePath = "mydir\\sudir\\"; + bool result; + result = Path::IsPathRooted( fileName ); + Console::WriteLine( "IsPathRooted('{0}') returns {1}", fileName, result.ToString() ); + result = Path::IsPathRooted( UncPath ); + Console::WriteLine( "IsPathRooted('{0}') returns {1}", UncPath, result.ToString() ); + result = Path::IsPathRooted( relativePath ); + Console::WriteLine( "IsPathRooted('{0}') returns {1}", relativePath, result.ToString() ); + + // This code produces output similar to the following: + // + // IsPathRooted('C:\mydir\myfile.ext') returns True + // IsPathRooted('\\myPc\mydir\myfile') returns True + // IsPathRooted('mydir\sudir\') returns False + // + Console::WriteLine(); +} + +void StaticProperties() +{ + // + Console::WriteLine( "Path::AltDirectorySeparatorChar={0}", (Path::AltDirectorySeparatorChar).ToString() ); + Console::WriteLine( "Path::DirectorySeparatorChar={0}", (Path::DirectorySeparatorChar).ToString() ); + Console::WriteLine( "Path::PathSeparator={0}", (Path::PathSeparator).ToString() ); + Console::WriteLine( "Path::VolumeSeparatorChar={0}", (Path::VolumeSeparatorChar).ToString() ); + Console::Write( "Path::InvalidPathChars=" ); + for ( int i = 0; i < Path::InvalidPathChars->Length; i++ ) + Console::Write( Path::InvalidPathChars[ i ] ); + Console::WriteLine(); + + // This code produces output similar to the following: + // Note that the InvalidPathCharacters contain characters + // outside of the printable character set. + // + // Path.AltDirectorySeparatorChar=/ + // Path.DirectorySeparatorChar=\ + // Path.PathSeparator=; + // Path.VolumeSeparatorChar=: + // + Console::WriteLine(); +} + +int main( void ) +{ + Console::WriteLine(); + StaticProperties(); + ChangeExtension(); + Combine(); + GetDirectoryName(); + GetExtension(); + GetFileName(); + GetFileNameWithoutExtension(); + GetFullPath(); + GetPathRoot(); + GetTempFileName(); + GetTempPath(); + HasExtension(); + IsPathRooted(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp new file mode 100644 index 00000000000..2aed9679b07 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeClientStream_Sample/cpp/program.cpp @@ -0,0 +1,51 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::IO::Pipes; + +ref class PipeClient +{ +public: + static void Main(array^ args) + { + if (args->Length > 1) + { + PipeStream^ pipeClient = gcnew AnonymousPipeClientStream(PipeDirection::In, args[1]); + + Console::WriteLine("[CLIENT] Current TransmissionMode: {0}.", + pipeClient->TransmissionMode); + + StreamReader^ sr = gcnew StreamReader(pipeClient); + + // Display the read text to the console + String^ temp; + + // Wait for 'sync message' from the server. + do + { + Console::WriteLine("[CLIENT] Wait for sync..."); + temp = sr->ReadLine(); + } + while (!temp->StartsWith("SYNC")); + + // Read the server data and echo to the console. + while ((temp = sr->ReadLine()) != nullptr) + { + Console::WriteLine("[CLIENT] Echo: " + temp); + } + sr->Close(); + pipeClient->Close(); + } + Console::Write("[CLIENT] Press Enter to continue..."); + Console::ReadLine(); + } +}; + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + PipeClient::Main(args); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp new file mode 100644 index 00000000000..26174ff6fe9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.AnonymousPipeServerStream_Sample/cpp/program.cpp @@ -0,0 +1,65 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::IO::Pipes; +using namespace System::Diagnostics; + +ref class PipeServer +{ +public: + static void Main() + { + Process^ pipeClient = gcnew Process(); + + pipeClient->StartInfo->FileName = "pipeClient.exe"; + + AnonymousPipeServerStream^ pipeServer = + gcnew AnonymousPipeServerStream(PipeDirection::Out, + HandleInheritability::Inheritable); + + Console::WriteLine("[SERVER] Current TransmissionMode: {0}.", + pipeServer->TransmissionMode); + + // Pass the client process a handle to the server. + pipeClient->StartInfo->Arguments = + pipeServer->GetClientHandleAsString(); + pipeClient->StartInfo->UseShellExecute = false; + pipeClient->Start(); + + pipeServer->DisposeLocalCopyOfClientHandle(); + + try + { + // Read user input and send that to the client process. + StreamWriter^ sw = gcnew StreamWriter(pipeServer); + + sw->AutoFlush = true; + // Send a 'sync message' and wait for client to receive it. + sw->WriteLine("SYNC"); + pipeServer->WaitForPipeDrain(); + // Send the console input to the client process. + Console::Write("[SERVER] Enter text: "); + sw->WriteLine(Console::ReadLine()); + sw->Close(); + } + // Catch the IOException that is raised if the pipe is broken + // or disconnected. + catch (IOException^ e) + { + Console::WriteLine("[SERVER] Error: {0}", e->Message); + } + pipeServer->Close(); + pipeClient->WaitForExit(); + pipeClient->Close(); + Console::WriteLine("[SERVER] Client quit. Server terminating."); + } +}; + +int main() +{ + PipeServer::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp new file mode 100644 index 00000000000..8908a781218 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Pipes.NamedPipeServerStream_ImpersonationSample1/cpp/program.cpp @@ -0,0 +1,160 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::IO::Pipes; +using namespace System::Text; +using namespace System::Threading; + +// Defines the data protocol for reading and writing strings on our stream +public ref class StreamString +{ +private: + Stream^ ioStream; + UnicodeEncoding^ streamEncoding; + +public: + StreamString(Stream^ ioStream) + { + this->ioStream = ioStream; + streamEncoding = gcnew UnicodeEncoding(); + } + + String^ ReadString() + { + int len; + + len = ioStream->ReadByte() * 256; + len += ioStream->ReadByte(); + array^ inBuffer = gcnew array(len); + ioStream->Read(inBuffer, 0, len); + + return streamEncoding->GetString(inBuffer); + } + + int WriteString(String^ outString) + { + array^ outBuffer = streamEncoding->GetBytes(outString); + int len = outBuffer->Length; + if (len > UInt16::MaxValue) + { + len = (int)UInt16::MaxValue; + } + ioStream->WriteByte((Byte)(len / 256)); + ioStream->WriteByte((Byte)(len & 255)); + ioStream->Write(outBuffer, 0, len); + ioStream->Flush(); + + return outBuffer->Length + 2; + } +}; + +// Contains the method executed in the context of the impersonated user +public ref class ReadFileToStream +{ +private: + String^ fn; + StreamString ^ss; + +public: + ReadFileToStream(StreamString^ str, String^ filename) + { + fn = filename; + ss = str; + } + + void Start() + { + String^ contents = File::ReadAllText(fn); + ss->WriteString(contents); + } +}; + +public ref class PipeServer +{ +private: + static int numThreads = 4; + +public: + static void Main() + { + int i; + array^ servers = gcnew array(numThreads); + + Console::WriteLine("\n*** Named pipe server stream with impersonation example ***\n"); + Console::WriteLine("Waiting for client connect...\n"); + for (i = 0; i < numThreads; i++) + { + servers[i] = gcnew Thread(gcnew ThreadStart(&ServerThread)); + servers[i]->Start(); + } + Thread::Sleep(250); + while (i > 0) + { + for (int j = 0; j < numThreads; j++) + { + if (servers[j] != nullptr) + { + if (servers[j]->Join(250)) + { + Console::WriteLine("Server thread[{0}] finished.", servers[j]->ManagedThreadId); + servers[j] = nullptr; + i--; // decrement the thread watch count + } + } + } + } + Console::WriteLine("\nServer threads exhausted, exiting."); + } + +private: + static void ServerThread() + { + NamedPipeServerStream^ pipeServer = + gcnew NamedPipeServerStream("testpipe", PipeDirection::InOut, numThreads); + + int threadId = Thread::CurrentThread->ManagedThreadId; + + // Wait for a client to connect + pipeServer->WaitForConnection(); + + Console::WriteLine("Client connected on thread[{0}].", threadId); + try + { + // + // Read the request from the client. Once the client has + // written to the pipe its security token will be available. + + StreamString^ ss = gcnew StreamString(pipeServer); + + // Verify our identity to the connected client using a + // string that the client anticipates. + + ss->WriteString("I am the one true server!"); + String^ filename = ss->ReadString(); + + // Read in the contents of the file while impersonating the client. + ReadFileToStream^ fileReader = gcnew ReadFileToStream(ss, filename); + + // Display the name of the user we are impersonating. + Console::WriteLine("Reading file: {0} on thread[{1}] as user: {2}.", + filename, threadId, pipeServer->GetImpersonationUserName()); + pipeServer->RunAsClient(gcnew PipeStreamImpersonationWorker(fileReader, &ReadFileToStream::Start)); + // + } + // Catch the IOException that is raised if the pipe is broken + // or disconnected. + catch (IOException^ e) + { + Console::WriteLine("ERROR: {0}", e->Message); + } + pipeServer->Close(); + } +}; + +int main() +{ + PipeServer::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp new file mode 100644 index 00000000000..17fffe2f8bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/datareceived.cpp @@ -0,0 +1,49 @@ +// +#using + +using namespace System; +using namespace System::IO::Ports; + +ref class PortDataReceived +{ +public: + static void Main() + { + // + SerialPort^ mySerialPort = gcnew SerialPort("COM1"); + + mySerialPort->BaudRate = 9600; + mySerialPort->Parity = Parity::None; + mySerialPort->StopBits = StopBits::One; + mySerialPort->DataBits = 8; + mySerialPort->Handshake = Handshake::None; + mySerialPort->RtsEnable = true; + // + + mySerialPort->DataReceived += gcnew SerialDataReceivedEventHandler(DataReceivedHandler); + + mySerialPort->Open(); + + Console::WriteLine("Press any key to continue..."); + Console::WriteLine(); + Console::ReadKey(); + mySerialPort->Close(); + } + +private: + static void DataReceivedHandler( + Object^ sender, + SerialDataReceivedEventArgs^ e) + { + SerialPort^ sp = (SerialPort^)sender; + String^ indata = sp->ReadExisting(); + Console::WriteLine("Data Received:"); + Console::Write(indata); + } +}; + +int main() +{ + PortDataReceived::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp new file mode 100644 index 00000000000..86631d9ff20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.Ports.SerialPort/cpp/serialport.cpp @@ -0,0 +1,207 @@ +// +#using + +using namespace System; +using namespace System::IO::Ports; +using namespace System::Threading; + +public ref class PortChat +{ +private: + static bool _continue; + static SerialPort^ _serialPort; + + // +public: + static void Main() + { + String^ name; + String^ message; + StringComparer^ stringComparer = StringComparer::OrdinalIgnoreCase; + Thread^ readThread = gcnew Thread(gcnew ThreadStart(PortChat::Read)); + + // Create a new SerialPort object with default settings. + _serialPort = gcnew SerialPort(); + + // Allow the user to set the appropriate properties. + _serialPort->PortName = SetPortName(_serialPort->PortName); + _serialPort->BaudRate = SetPortBaudRate(_serialPort->BaudRate); + _serialPort->Parity = SetPortParity(_serialPort->Parity); + _serialPort->DataBits = SetPortDataBits(_serialPort->DataBits); + _serialPort->StopBits = SetPortStopBits(_serialPort->StopBits); + _serialPort->Handshake = SetPortHandshake(_serialPort->Handshake); + + // Set the read/write timeouts + _serialPort->ReadTimeout = 500; + _serialPort->WriteTimeout = 500; + + _serialPort->Open(); + _continue = true; + readThread->Start(); + + Console::Write("Name: "); + name = Console::ReadLine(); + + Console::WriteLine("Type QUIT to exit"); + + while (_continue) + { + message = Console::ReadLine(); + + if (stringComparer->Equals("quit", message)) + { + _continue = false; + } + else + { + _serialPort->WriteLine( + String::Format("<{0}>: {1}", name, message) ); + } + } + + readThread->Join(); + _serialPort->Close(); + } + + static void Read() + { + while (_continue) + { + try + { + String^ message = _serialPort->ReadLine(); + Console::WriteLine(message); + } + catch (TimeoutException ^) { } + } + } + // + + // + static String^ SetPortName(String^ defaultPortName) + { + String^ portName; + + Console::WriteLine("Available Ports:"); + for each (String^ s in SerialPort::GetPortNames()) + { + Console::WriteLine(" {0}", s); + } + + Console::Write("Enter COM port value (Default: {0}): ", defaultPortName); + portName = Console::ReadLine(); + + if (portName == "") + { + portName = defaultPortName; + } + return portName; + } + // + + static Int32 SetPortBaudRate(Int32 defaultPortBaudRate) + { + String^ baudRate; + + Console::Write("Baud Rate(default:{0}): ", defaultPortBaudRate); + baudRate = Console::ReadLine(); + + if (baudRate == "") + { + baudRate = defaultPortBaudRate.ToString(); + } + + return Int32::Parse(baudRate); + } + + // + static Parity SetPortParity(Parity defaultPortParity) + { + String^ parity; + + Console::WriteLine("Available Parity options:"); + for each (String^ s in Enum::GetNames(Parity::typeid)) + { + Console::WriteLine(" {0}", s); + } + + Console::Write("Enter Parity value (Default: {0}):", defaultPortParity.ToString()); + parity = Console::ReadLine(); + + if (parity == "") + { + parity = defaultPortParity.ToString(); + } + + return (Parity)Enum::Parse(Parity::typeid, parity); + } + // + + static Int32 SetPortDataBits(Int32 defaultPortDataBits) + { + String^ dataBits; + + Console::Write("Enter DataBits value (Default: {0}): ", defaultPortDataBits); + dataBits = Console::ReadLine(); + + if (dataBits == "") + { + dataBits = defaultPortDataBits.ToString(); + } + + return Int32::Parse(dataBits); + } + + // + static StopBits SetPortStopBits(StopBits defaultPortStopBits) + { + String^ stopBits; + + Console::WriteLine("Available Stop Bits options:"); + for each (String^ s in Enum::GetNames(StopBits::typeid)) + { + Console::WriteLine(" {0}", s); + } + + Console::Write("Enter StopBits value (None is not supported and \n" + + "raises an ArgumentOutOfRangeException. \n (Default: {0}):", defaultPortStopBits.ToString()); + stopBits = Console::ReadLine(); + + if (stopBits == "") + { + stopBits = defaultPortStopBits.ToString(); + } + + return (StopBits)Enum::Parse(StopBits::typeid, stopBits); + } + // + + // + static Handshake SetPortHandshake(Handshake defaultPortHandshake) + { + String^ handshake; + + Console::WriteLine("Available Handshake options:"); + for each (String^ s in Enum::GetNames(Handshake::typeid)) + { + Console::WriteLine(" {0}", s); + } + + Console::Write("Enter Handshake value (Default: {0}):", defaultPortHandshake.ToString()); + handshake = Console::ReadLine(); + + if (handshake == "") + { + handshake = defaultPortHandshake.ToString(); + } + + return (Handshake)Enum::Parse(Handshake::typeid, handshake); + } + // +}; + +int main() +{ + PortChat::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp new file mode 100644 index 00000000000..a1f9f662b60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamReader/CPP/streamreadersample.cpp @@ -0,0 +1,177 @@ + +// +using namespace System; +using namespace System::IO; +ref class StreamReaderSample: public TextReader +{ +public: + + // + StreamReaderSample() + { + printInfo(); + usePeek(); + usePosition(); + useNull(); + useReadLine(); + useReadToEnd(); + } + + +private: + + //All Overloaded Constructors for StreamReader + // + void getNewStreamReader() + { + + //Get a new StreamReader in ASCII format from a + //file using a buffer and byte order mark detection + StreamReader^ srAsciiFromFileFalse512 = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII,false,512 ); + + //Get a new StreamReader in ASCII format from a + //file with byte order mark detection = false + StreamReader^ srAsciiFromFileFalse = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII,false ); + + //Get a new StreamReader in ASCII format from a file + StreamReader^ srAsciiFromFile = gcnew StreamReader( "C:\\Temp\\Test.txt",System::Text::Encoding::ASCII ); + + //Get a new StreamReader from a + //file with byte order mark detection = false + StreamReader^ srFromFileFalse = gcnew StreamReader( "C:\\Temp\\Test.txt",false ); + + //Get a new StreamReader from a file + StreamReader^ srFromFile = gcnew StreamReader( "C:\\Temp\\Test.txt" ); + + //Get a new StreamReader in ASCII format from a + //FileStream with byte order mark detection = false and a buffer + StreamReader^ srAsciiFromStreamFalse512 = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII,false,512 ); + + //Get a new StreamReader in ASCII format from a + //FileStream with byte order mark detection = false + StreamReader^ srAsciiFromStreamFalse = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII,false ); + + //Get a new StreamReader in ASCII format from a FileStream + StreamReader^ srAsciiFromStream = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + + //Get a new StreamReader from a + //FileStream with byte order mark detection = false + StreamReader^ srFromStreamFalse = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),false ); + + //Get a new StreamReader from a FileStream + StreamReader^ srFromStream = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ) ); + } + + + // + // + void printInfo() + { + + // + // + StreamReader^ srEncoding = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + Console::WriteLine( "Encoding: {0}", srEncoding->CurrentEncoding->EncodingName ); + srEncoding->Close(); + + // + } + + void usePeek() + { + + // + StreamReader^ srPeek = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + + // set the file pointer to the beginning + srPeek->BaseStream->Seek( 0, SeekOrigin::Begin ); + + // cycle while there is a next char + while ( srPeek->Peek() > -1 ) + { + Console::Write( srPeek->ReadLine() ); + } + + srPeek->Close(); + + // + } + + void usePosition() + { + + // + StreamReader^ srRead = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + + // set the file pointer to the beginning + srRead->BaseStream->Seek( 0, SeekOrigin::Begin ); + srRead->BaseStream->Position = 0; + while ( srRead->BaseStream->Position < srRead->BaseStream->Length ) + { + array<__wchar_t>^buffer = gcnew array<__wchar_t>(1); + srRead->Read( buffer, 0, 1 ); + Console::Write( buffer[ 0 ].ToString() ); + srRead->BaseStream->Position = srRead->BaseStream->Position + 1; + } + + srRead->DiscardBufferedData(); + srRead->Close(); + + // + } + + void useNull() + { + + // + StreamReader^ srNull = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + if ( !srNull->Equals( StreamReader::Null ) ) + { + srNull->BaseStream->Seek( 0, SeekOrigin::Begin ); + Console::WriteLine( srNull->ReadToEnd() ); + } + + srNull->Close(); + + // + } + + void useReadLine() + { + + // + StreamReader^ srReadLine = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + srReadLine->BaseStream->Seek( 0, SeekOrigin::Begin ); + while ( srReadLine->Peek() > -1 ) + { + Console::WriteLine( srReadLine->ReadLine() ); + } + + srReadLine->Close(); + + // + } + + void useReadToEnd() + { + + // + StreamReader^ srReadToEnd = gcnew StreamReader( File::OpenRead( "C:\\Temp\\Test.txt" ),System::Text::Encoding::ASCII ); + srReadToEnd->BaseStream->Seek( 0, SeekOrigin::Begin ); + Console::WriteLine( srReadToEnd->ReadToEnd() ); + srReadToEnd->Close(); + + // + // + } + + // + // +}; + + +// +void main( int argc ) +{ + StreamReaderSample^ srs = gcnew StreamReaderSample; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp new file mode 100644 index 00000000000..a901e502b87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StreamWriter/CPP/logger.cpp @@ -0,0 +1,201 @@ +// +using namespace System; +using namespace System::IO; +using namespace System::Runtime; +using namespace System::Reflection; +using namespace System::Runtime::Remoting::Lifetime; +using namespace System::Security::Permissions; + +namespace StreamWriterSample +{ + public ref class Logger + { +// + public: + //Constructors + Logger() + { + BeginWrite(); + } + + Logger( String^ logFile ) + { + BeginWrite( logFile ); + } + + //Destructor + ~Logger() + { + EndWrite(); + } + + // + void CreateTextFile( String^ fileName, String^ textToAdd ) + { + String^ logFile = String::Concat( DateTime::Now.ToShortDateString() + ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ); + + FileStream^ fs = gcnew FileStream( fileName, + FileMode::CreateNew, FileAccess::Write, FileShare::None ); + + StreamWriter^ swFromFile = gcnew StreamWriter( logFile ); + swFromFile->Write( textToAdd ); + swFromFile->Flush(); + swFromFile->Close(); + + StreamWriter^ swFromFileStream = gcnew StreamWriter( fs ); + swFromFileStream->Write( textToAdd ); + swFromFileStream->Flush(); + swFromFileStream->Close(); + + StreamWriter^ swFromFileStreamDefaultEnc = + gcnew System::IO::StreamWriter( fs, + System::Text::Encoding::Default ); + swFromFileStreamDefaultEnc->Write( textToAdd ); + swFromFileStreamDefaultEnc->Flush(); + swFromFileStreamDefaultEnc->Close(); + + StreamWriter^ swFromFileTrue = + gcnew StreamWriter( fileName,true ); + swFromFileTrue->Write( textToAdd ); + swFromFileTrue->Flush(); + swFromFileTrue->Close(); + + StreamWriter^ swFromFileTrueUTF8Buffer = + gcnew StreamWriter( fileName, + true, System::Text::Encoding::UTF8, 512 ); + swFromFileTrueUTF8Buffer->Write( textToAdd ); + swFromFileTrueUTF8Buffer->Flush(); + swFromFileTrueUTF8Buffer->Close(); + + StreamWriter^ swFromFileTrueUTF8 = + gcnew StreamWriter( fileName, true, + System::Text::Encoding::UTF8 ); + swFromFileTrueUTF8->Write( textToAdd ); + swFromFileTrueUTF8->Flush(); + swFromFileTrueUTF8->Close(); + + StreamWriter^ swFromFileStreamUTF8Buffer = + gcnew StreamWriter( fs, System::Text::Encoding::UTF8, 512 ); + swFromFileStreamUTF8Buffer->Write( textToAdd ); + swFromFileStreamUTF8Buffer->Flush(); + swFromFileStreamUTF8Buffer->Close(); + } + // + + // + private: + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + void BeginWrite( String^ logFile ) + { + // + // + StreamWriter^ sw = gcnew StreamWriter( logFile,true ); + + // + // + // Gets or sets a value indicating whether the StreamWriter + // will flush its buffer to the underlying stream after every + // call to StreamWriter.Write. + sw->AutoFlush = true; + // + // + if ( sw->Equals( StreamWriter::Null ) ) + { + sw->WriteLine( "The store can be written to, but not read from." ); + } + // + // + sw->Write( Char::Parse( " " ) ); + // + // + String^ hello = "Hellow World!"; + array^ buffer = hello->ToCharArray(); + sw->Write( buffer ); + // + // + String^ helloWorld = "Hellow World!"; + // writes out "low World" + sw->Write( helloWorld ); + // + // + sw->WriteLine( "---Begin Log Entry---" ); + // + // + // Write out the current text encoding + sw->WriteLine( "Encoding: {0}", + sw->Encoding->ToString() ); + // + // + // Display the Format Provider + sw->WriteLine( "Format Provider: {0} ", + sw->FormatProvider->ToString() ); + // + // + // Set the characters you would like to designate a new line + sw->NewLine = "\r\n"; + // + // + ILease^ obj = dynamic_cast(sw->InitializeLifetimeService()); + if ( obj != nullptr ) + { + sw->WriteLine( "Object initialized lease " + + "time remaining: {0}.", + obj->CurrentLeaseTime.ToString() ); + } + // + // + ILease^ lease = dynamic_cast(sw->GetLifetimeService()); + if ( lease != nullptr ) + { + sw->WriteLine( "Object lease time remaining: {0}.", + lease->CurrentLeaseTime.ToString() ); + } + // + + // + // update underlying file + sw->Flush(); + // + // + // close the file by closing the writer + sw->Close(); + // + // + } + // + + void BeginWrite() + { + BeginWrite( String::Concat( DateTime::Now.ToShortDateString() + ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ) ); + } + + void EndWrite( String^ logFile ) + { + StreamWriter^ sw = gcnew StreamWriter( logFile,true ); + + // Set the file pointer to the end of file. + sw->BaseStream->Seek( 0, SeekOrigin::End ); + // Write text to the file. + sw->WriteLine( "---End Log Entry---\r\n" ); + // Update the underlying file. + sw->Flush(); + // Close the file by closing the writer. + sw->Close(); + } + + void EndWrite() + { + EndWrite( String::Concat( DateTime::Now.ToShortDateString() + ->Replace( "/", "-" )->Replace( "\\", "-" ), ".log" ) ); + } + // + }; +} +// + +int main() +{ + StreamWriterSample::Logger^ l = gcnew StreamWriterSample::Logger; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp new file mode 100644 index 00000000000..0e1c9ac1f5b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringReaderWriter/CPP/stringrw.cpp @@ -0,0 +1,76 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + String^ textReaderText = "TextReader is the abstract base " + "class of StreamReader and StringReader, which read " + "characters from streams and strings, respectively.\n\n" + "Create an instance of TextReader to open a text file " + "for reading a specified range of characters, or to " + "create a reader based on an existing stream.\n\n" + "You can also use an instance of TextReader to read " + "text from a custom backing store using the same " + "APIs you would use for a string or a stream.\n\n"; + Console::WriteLine( "Original text:\n\n{0}", textReaderText ); + + // + // From textReaderText, create a continuous paragraph + // with two spaces between each sentence. + String^ aLine; + String^ aParagraph; + StringReader^ strReader = gcnew StringReader( textReaderText ); + while ( true ) + { + aLine = strReader->ReadLine(); + if ( aLine != nullptr ) + { + aParagraph = String::Concat( aParagraph, aLine, " " ); + } + else + { + aParagraph = String::Concat( aParagraph, "\n" ); + break; + } + } + + Console::WriteLine( "Modified text:\n\n{0}", aParagraph ); + + // + // Re-create textReaderText from aParagraph. + int intCharacter; + Char convertedCharacter; + StringWriter^ strWriter = gcnew StringWriter; + strReader = gcnew StringReader( aParagraph ); + while ( true ) + { + intCharacter = strReader->Read(); + + // Check for the end of the string + // before converting to a character. + if ( intCharacter == -1 ) + break; + + + // + convertedCharacter = Convert::ToChar( intCharacter ); + if ( convertedCharacter == '.' ) + { + strWriter->Write( ".\n\n" ); + + // Bypass the spaces between sentences. + strReader->Read(); + strReader->Read(); + } + // + else + { + strWriter->Write( convertedCharacter ); + } + } + + Console::WriteLine( "\nOriginal text:\n\n{0}", strWriter->ToString() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp new file mode 100644 index 00000000000..8c1ec78fa24 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter1/CPP/strwriter1.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +int main() +{ + StringWriter^ strWriter = gcnew StringWriter; + + // + // Use the three overloads of the Write method that are + // overridden by the StringWriter class. + strWriter->Write( "file path characters are: " ); + strWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length ); + strWriter->Write( Char::Parse( "." ) ); + + // + // + // Use the underlying StringBuilder for more complex + // manipulations of the string. + strWriter->GetStringBuilder()->Insert( 0, "Invalid " ); + + // + // + Console::WriteLine( "The following string is {0} encoded.\n{1}", strWriter->Encoding->EncodingName, strWriter->ToString() ); + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp new file mode 100644 index 00000000000..3314eaac96a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter2/CPP/strwriter2.cpp @@ -0,0 +1,18 @@ + +// +using namespace System; +using namespace System::Globalization; +using namespace System::IO; +int main() +{ + StringWriter^ strWriter = gcnew StringWriter( gcnew CultureInfo( "ar-DZ" ) ); + strWriter->Write( DateTime::Now ); + + // + Console::WriteLine( "Current date and time using the invariant culture: {0}\n" + "Current date and time using the Algerian culture: {1}", DateTime::Now.ToString(), strWriter->ToString() ); + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp new file mode 100644 index 00000000000..10ced5c03d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.StringWriter3/CPP/strwriter3.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Text; +int main() +{ + StringBuilder^ strBuilder = gcnew StringBuilder( "file path characters are: " ); + StringWriter^ strWriter = gcnew StringWriter( strBuilder ); + strWriter->Write( Path::InvalidPathChars, 0, Path::InvalidPathChars->Length ); + + // + strWriter->Close(); + + // Since the StringWriter is closed, an exception will + // be thrown if the Write method is called. However, + // the StringBuilder can still manipulate the string. + strBuilder->Insert( 0, "Invalid " ); + Console::WriteLine( strWriter->ToString() ); + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp new file mode 100644 index 00000000000..e9352f717a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::IO; + +// +void WriteText( TextWriter^ textWriter ) +{ + textWriter->Write( "Invalid file path characters are: " ); + textWriter->Write( Path::InvalidPathChars ); + textWriter->Write( Char::Parse( "." ) ); +} + + +// +// +void ReadText( TextReader^ textReader ) +{ + Console::WriteLine( "From {0} - {1}", textReader->GetType()->Name, textReader->ReadToEnd() ); +} + + +// +int main() +{ + + // + TextWriter^ stringWriter = gcnew StringWriter; + TextWriter^ streamWriter = gcnew StreamWriter( "InvalidPathChars.txt" ); + + // + WriteText( stringWriter ); + WriteText( streamWriter ); + streamWriter->Close(); + + // + TextReader^ stringReader = gcnew StringReader( stringWriter->ToString() ); + TextReader^ streamReader = gcnew StreamReader( "InvalidPathChars.txt" ); + + // + ReadText( stringReader ); + ReadText( streamReader ); + streamReader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp new file mode 100644 index 00000000000..bcc6eb8fc3a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.IO.UTCExample/CPP/example.cpp @@ -0,0 +1,54 @@ + +// +// This sample shows the differences between dates from methods that use +//coordinated universal time (UTC) format and those that do not. +using namespace System; +using namespace System::IO; +int main() +{ + + // Set the directory. + String^ n = "C:\\test\\newdir"; + + //Create two variables to use to set the time. + DateTime dtime1 = DateTime(2002,1,3); + DateTime dtime2 = DateTime(1999,1,1); + + //Create the directory. + try + { + Directory::CreateDirectory( n ); + } + catch ( IOException^ e ) + { + Console::WriteLine( e ); + } + + + //Set the creation and last access times to a variable DateTime value. + Directory::SetCreationTime( n, dtime1 ); + Directory::SetLastAccessTimeUtc( n, dtime1 ); + + // Print to console the results. + Console::WriteLine( "Creation Date: {0}", Directory::GetCreationTime( n ) ); + Console::WriteLine( "UTC creation Date: {0}", Directory::GetCreationTimeUtc( n ) ); + Console::WriteLine( "Last write time: {0}", Directory::GetLastWriteTime( n ) ); + Console::WriteLine( "UTC last write time: {0}", Directory::GetLastWriteTimeUtc( n ) ); + Console::WriteLine( "Last access time: {0}", Directory::GetLastAccessTime( n ) ); + Console::WriteLine( "UTC last access time: {0}", Directory::GetLastAccessTimeUtc( n ) ); + + //Set the last write time to a different value. + Directory::SetLastWriteTimeUtc( n, dtime2 ); + Console::WriteLine( "Changed last write time: {0}", Directory::GetLastWriteTimeUtc( n ) ); +} + +// Obviously, since this sample deals with dates and times, the output will vary +// depending on when you run the executable. Here is one example of the output: +//Creation Date: 1/3/2002 12:00:00 AM +//UTC creation Date: 1/3/2002 8:00:00 AM +//Last write time: 12/31/1998 4:00:00 PM +//UTC last write time: 1/1/1999 12:00:00 AM +//Last access time: 1/2/2002 4:00:00 PM +//UTC last access time: 1/3/2002 12:00:00 AM +//Changed last write time: 1/1/1999 12:00:00 AM +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp new file mode 100644 index 00000000000..ced314ab27c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.MaxValue/cpp/minvalue.cpp @@ -0,0 +1,30 @@ +// MinValue.cpp : main project file. + +using namespace System; + +int main(array ^args) +{ + // + array^ numbersToConvert = {162345, 32183, -54000}; + Int16 newNumber; + for each (Int64 number in numbersToConvert) + { + if (number >= Int16::MinValue && number <= Int16::MaxValue) + { + newNumber = Convert::ToInt16(number); + Console::WriteLine("Successfully converted {0} to an Int16.", + newNumber); + } + else + { + Console::WriteLine("Unable to convert {0} to an Int16.", number); + } + } + // The example displays the following output: + // Unable to convert 162345 to an Int16. + // Successfully converted 32183 to an Int16. + // Unable to convert -54000 to an Int16. + // + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp new file mode 100644 index 00000000000..aeaef4e7bea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse1.cpp @@ -0,0 +1,54 @@ +// Parse1.cpp : main project file. +// Code example for Int16.Parse(String) + +using namespace System; + +int main(array ^args) +{ + // + String^ value; + Int16 number; + + value = " 12603 "; + try + { + number = Int16::Parse(value); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", + value); + } + + value = " 16,054"; + try + { + number = Int16::Parse(value); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", + value); + } + + value = " -17264"; + try + { + number = Int16::Parse(value); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to convert '{0}' to a 16-bit signed integer.", + value); + } + // The example displays the following output to the console: + // Converted ' 12603 ' to 12603. + // Unable to convert ' 16,054' to a 16-bit signed integer. + // Converted ' -17264' to -17264. + // + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp new file mode 100644 index 00000000000..0b5222a1f6f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse2.cpp @@ -0,0 +1,87 @@ +// Parse2.cpp : main project file. + +// +using namespace System; +using namespace System::Globalization; + +ref class ParseSample +{ +public: + static void Main() + { + String^ value; + NumberStyles style; + + // Parse a number with a thousands separator (throws an exception). + value = "14,644"; + style = NumberStyles::None; + ParseSample::ParseToInt16(value, style); + + style = NumberStyles::AllowThousands; + ParseToInt16(value, style); + + // Parse a number with a thousands separator and decimal point. + value = "14,644.00"; + style = NumberStyles::AllowThousands | NumberStyles::Integer | + NumberStyles::AllowDecimalPoint; + ParseToInt16(value, style); + + // Parse a number with a fractional component (throws an exception). + value = "14,644.001"; + ParseToInt16(value, style); + + // Parse a number in exponential notation. + value = "145E02"; + style = style | NumberStyles::AllowExponent; + ParseToInt16(value, style); + + // Parse a number in exponential notation with a positive sign. + value = "145E+02"; + ParseToInt16(value, style); + + // Parse a number in exponential notation with a negative sign + // (throws an exception). + value = "145E-02"; + ParseToInt16(value, style); + } + +private: + static void ParseToInt16(String^ value, NumberStyles style) + { + try + { + Int16 number = Int16::Parse(value, style); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to parse '{0}' with style {1}.", value, + style); + } + catch (OverflowException ^e) + { + Console::WriteLine("'{0}' is out of range of the Int16 type.", value); + } + } +}; + +int main() +{ + ParseSample::Main(); + Console::ReadLine(); + return 0; +} +// The example displays the following output: +// Unable to parse '14,644' with style None. +// Converted '14,644' to 14644. +// Converted '14,644.00' to 14644. +// '14,644.001' is out of range of the Int16 type. +// Converted '145E02' to 14500. +// Converted '145E+02' to 14500. +// '145E-02' is out of range of the Int16 type. +// + + + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp new file mode 100644 index 00000000000..e17d9457ac6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse3.cpp @@ -0,0 +1,62 @@ +// Parse3.cpp : main project file. + +using namespace System; +using namespace System::Globalization; + +int main(array ^args) +{ + // + String^ value; + Int16 number; + NumberStyles style; + + // Parse string using "." as the thousands separator + // and " " as the decimal separator. + value = "19 694,00"; + style = NumberStyles::AllowDecimalPoint | NumberStyles::AllowThousands; + CultureInfo^ provider = gcnew CultureInfo("fr-FR"); + + number = Int16::Parse(value, style, provider); + Console::WriteLine("'{0}' converted to {1}.", value, number); + // Displays: + // '19 694,00' converted to 19694. + + try + { + number = Int16::Parse(value, style, CultureInfo::InvariantCulture); + Console::WriteLine("'{0}' converted to {1}.", value, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to parse '{0}'.", value); + } + // Displays: + // Unable to parse '19 694,00'. + + // Parse string using "$" as the currency symbol for en_GB and + // en-US cultures. + value = "$6,032.00"; + style = NumberStyles::Number | NumberStyles::AllowCurrencySymbol; + provider = gcnew CultureInfo("en-GB"); + + try + { + number = Int16::Parse(value, style, CultureInfo::InvariantCulture); + Console::WriteLine("'{0}' converted to {1}.", value, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to parse '{0}'.", value); + } + // Displays: + // Unable to parse '$6,032.00'. + + provider = gcnew CultureInfo("en-US"); + number = Int16::Parse(value, style, provider); + Console::WriteLine("'{0}' converted to {1}.", value, number); + // Displays: + // '$6,032.00' converted to 6032. + // + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp new file mode 100644 index 00000000000..111fb90e90d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int16.Parse/cpp/parse4.cpp @@ -0,0 +1,66 @@ +// Parse4.cpp : main project file. + +using namespace System; +using namespace System::Globalization; + +int main(array ^args) +{ + // + String^ stringToConvert; + Int16 number; + + stringToConvert = " 214 "; + try + { + number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); + } + catch (OverflowException ^e) + { + Console::WriteLine("'{0'} is out of range of the Int16 data type.", + stringToConvert); + } + + stringToConvert = " + 214"; + try + { + number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); + } + catch (OverflowException ^e) + { + Console::WriteLine("'{0'} is out of range of the Int16 data type.", + stringToConvert); + } + + stringToConvert = " +214 "; + try + { + number = Int16::Parse(stringToConvert, CultureInfo::InvariantCulture); + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); + } + catch (FormatException ^e) + { + Console::WriteLine("Unable to parse '{0}'.", stringToConvert); + } + catch (OverflowException ^e) + { + Console::WriteLine("'{0'} is out of range of the Int16 data type.", + stringToConvert); + } + // The example displays the following output to the console: + // Converted ' 214 ' to 214. + // Unable to parse ' + 214'. + // Converted ' +214 ' to 214. + // + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp new file mode 100644 index 00000000000..3eb4dcbf5d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse1.cpp @@ -0,0 +1,40 @@ +// +using namespace System; + +void main() +{ + array^ values = { "+13230", "-0", "1,390,146", "$190,235,421,127", + "0xFA1B", "163042", "-10", "007", "2147483647", + "2147483648", "16e07", "134985.0", "-12034", + "-2147483648", "-2147483649" }; + for each (String^ value in values) + { + try { + Int32 number = Int32::Parse(value); + Console::WriteLine("{0} --> {1}", value, number); + } + catch (FormatException^ e) { + Console::WriteLine("{0}: Bad Format", value); + } + catch (OverflowException^ e) { + Console::WriteLine("{0}: Overflow", value); + } + } +} +// The example displays the following output: +// +13230 --> 13230 +// -0 --> 0 +// 1,390,146: Bad Format +// $190,235,421,127: Bad Format +// 0xFA1B: Bad Format +// 163042 --> 163042 +// -10 --> -10 +// 007 --> 7 +// 2147483647 --> 2147483647 +// 2147483648: Overflow +// 16e07: Bad Format +// 134985.0: Bad Format +// -12034 --> -12034 +// -2147483648 --> -2147483648 +// -2147483649: Overflow +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp new file mode 100644 index 00000000000..763b56c34a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse2.cpp @@ -0,0 +1,50 @@ +// +using namespace System; +using namespace System::Globalization; + +public ref class ParseInt32 +{ +public: + static void Main() + { + Convert("104.0", NumberStyles::AllowDecimalPoint); + Convert("104.9", NumberStyles::AllowDecimalPoint); + Convert(" $17,198,064.42", NumberStyles::AllowCurrencySymbol | + NumberStyles::Number); + Convert("103E06", NumberStyles::AllowExponent); + Convert("-1,345,791", NumberStyles::AllowThousands); + Convert("(1,345,791)", NumberStyles::AllowThousands | + NumberStyles::AllowParentheses); + } + +private: + static void Convert(String^ value, NumberStyles style) + { + try + { + int number = Int32::Parse(value, style); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException^) + { + Console::WriteLine("Unable to convert '{0}'.", value); + } + catch (OverflowException^) + { + Console::WriteLine("'{0}' is out of range of the Int32 type.", value); + } + } +}; + +int main() +{ + ParseInt32::Main(); +} +// The example displays the following output to the console: +// Converted '104.0' to 104. +// '104.9' is out of range of the Int32 type. +// ' $17,198,064.42' is out of range of the Int32 type. +// Converted '103E06' to 103000000. +// Unable to convert '-1,345,791'. +// Converted '(1,345,791)' to -1345791. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp new file mode 100644 index 00000000000..6d7ea5b521f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.Parse/cpp/parse3.cpp @@ -0,0 +1,61 @@ +// +using namespace System; +using namespace System::Globalization; + +public ref class ParseInt32 +{ +public: + static void Main() + { + Convert("12,000", NumberStyles::Float | NumberStyles::AllowThousands, + gcnew CultureInfo("en-GB")); + Convert("12,000", NumberStyles::Float | NumberStyles::AllowThousands, + gcnew CultureInfo("fr-FR")); + Convert("12,000", NumberStyles::Float, gcnew CultureInfo("en-US")); + + Convert("12 425,00", NumberStyles::Float | NumberStyles::AllowThousands, + gcnew CultureInfo("sv-SE")); + Convert("12,425.00", NumberStyles::Float | NumberStyles::AllowThousands, + NumberFormatInfo::InvariantInfo); + Convert("631,900", NumberStyles::Integer | NumberStyles::AllowDecimalPoint, + gcnew CultureInfo("fr-FR")); + Convert("631,900", NumberStyles::Integer | NumberStyles::AllowDecimalPoint, + gcnew CultureInfo("en-US")); + Convert("631,900", NumberStyles::Integer | NumberStyles::AllowThousands, + gcnew CultureInfo("en-US")); + } + +private: + static void Convert(String^ value, NumberStyles style, + IFormatProvider^ provider) + { + try + { + int number = Int32::Parse(value, style, provider); + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + catch (FormatException^) + { + Console::WriteLine("Unable to convert '{0}'.", value); + } + catch (OverflowException^) + { + Console::WriteLine("'{0}' is out of range of the Int32 type.", value); + } + } +}; + +int main() +{ + ParseInt32::Main(); +} +// This example displays the following output to the console: +// Converted '12,000' to 12000. +// Converted '12,000' to 12. +// Unable to convert '12,000'. +// Converted '12 425,00' to 12425. +// Converted '12,425.00' to 12425. +// '631,900' is out of range of the Int32 type. +// Unable to convert '631,900'. +// Converted '631,900' to 631900. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp new file mode 100644 index 00000000000..490a4147b45 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString1.cpp @@ -0,0 +1,26 @@ +// +using namespace System; + +void main() +{ + int value = -16325; + // Display value using default ToString method. + Console::WriteLine(value.ToString()); + // Display value using some standard format specifiers. + Console::WriteLine(value.ToString("G")); + Console::WriteLine(value.ToString("C")); + Console::WriteLine(value.ToString("D")); + Console::WriteLine(value.ToString("F")); + Console::WriteLine(value.ToString("N")); + Console::WriteLine(value.ToString("X")); +} +// The example displays the following output: +// -16325 +// -16325 +// ($16,325.00) +// -16325 +// -16325.00 +// -16,325.00 +// FFFFC03B +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp new file mode 100644 index 00000000000..9db3bc117d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString2.cpp @@ -0,0 +1,22 @@ +// +using namespace System; +using namespace System::Globalization; + +void main() +{ + int value = -16325; + // Display value using the invariant culture. + Console::WriteLine(value.ToString(CultureInfo::InvariantCulture)); + // Display value using the en-GB culture. + Console::WriteLine(value.ToString(CultureInfo::CreateSpecificCulture("en-GB"))); + // Display value using the de-DE culture. + Console::WriteLine(value.ToString(CultureInfo::CreateSpecificCulture("de-DE"))); +} +// The example displays the following output: +// -16325 +// -16325 +// -16325 +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp new file mode 100644 index 00000000000..890b1ae948c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString3.cpp @@ -0,0 +1,56 @@ +// +using namespace System; + +void main() +{ + int value = -16325; + String^ specifier; + + // Use standard numeric format specifiers. + specifier = "G"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "C"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "D8"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "E4"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "e3"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "F"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "N"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "P"; + Console::WriteLine("{0}: {1}", specifier, (value/100000).ToString(specifier)); + + specifier = "X"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + // Use custom numeric format specifiers. + specifier = "0,0.000"; + Console::WriteLine("{0}: {1}", specifier, value.ToString(specifier)); + + specifier = "#,#.00#;(#,#.00#)"; + Console::WriteLine("{0}: {1}", specifier, (value*-1).ToString(specifier)); +} +// The example displays the following output: +// G: -16325 +// C: ($16,325.00) +// D8: -00016325 +// E4: -1.6325E+004 +// e3: -1.633e+004 +// F: -16325.00 +// N: -16,325.00 +// P: 0.00 % +// X: FFFFC03B +// 0,0.000: -16,325.000 +// #,#.00#;(#,#.00#): 16,325.00 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp new file mode 100644 index 00000000000..60f27268433 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.ToString/cpp/ToString4.cpp @@ -0,0 +1,60 @@ +// +using namespace System; +using namespace System::Globalization; + +void main() +{ + // Define cultures whose formatting conventions are to be used. + array^ cultures = { CultureInfo::CreateSpecificCulture("en-US"), + CultureInfo::CreateSpecificCulture("fr-FR"), + CultureInfo::CreateSpecificCulture("es-ES") }; + int positiveNumber = 1679; + int negativeNumber = -3045; + array^ specifiers = {"G", "C", "D8", "E2", "F", "N", "P", "X8"}; + + for each (String^ specifier in specifiers) + { + for each (CultureInfo^ culture in cultures) + { + // Display values with "G" format specifier. + Console::WriteLine("{0} format using {1} culture: {2, 16} {3, 16}", + specifier, culture->Name, + positiveNumber.ToString(specifier, culture), + negativeNumber.ToString(specifier, culture)); + } + Console::WriteLine(); + } +} +// The example displays the following output: +// G format using en-US culture: 1679 -3045 +// G format using fr-FR culture: 1679 -3045 +// G format using es-ES culture: 1679 -3045 +// +// C format using en-US culture: $1,679.00 ($3,045.00) +// C format using fr-FR culture: 1 679,00 € -3 045,00 € +// C format using es-ES culture: 1.679,00 € -3.045,00 € +// +// D8 format using en-US culture: 00001679 -00003045 +// D8 format using fr-FR culture: 00001679 -00003045 +// D8 format using es-ES culture: 00001679 -00003045 +// +// E2 format using en-US culture: 1.68E+003 -3.05E+003 +// E2 format using fr-FR culture: 1,68E+003 -3,05E+003 +// E2 format using es-ES culture: 1,68E+003 -3,05E+003 +// +// F format using en-US culture: 1679.00 -3045.00 +// F format using fr-FR culture: 1679,00 -3045,00 +// F format using es-ES culture: 1679,00 -3045,00 +// +// N format using en-US culture: 1,679.00 -3,045.00 +// N format using fr-FR culture: 1 679,00 -3 045,00 +// N format using es-ES culture: 1.679,00 -3.045,00 +// +// P format using en-US culture: 167,900.00 % -304,500.00 % +// P format using fr-FR culture: 167 900,00 % -304 500,00 % +// P format using es-ES culture: 167.900,00 % -304.500,00 % +// +// X8 format using en-US culture: 0000068F FFFFF41B +// X8 format using fr-FR culture: 0000068F FFFFF41B +// X8 format using es-ES culture: 0000068F FFFFF41B +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp new file mode 100644 index 00000000000..8772bdc80e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse1.cpp @@ -0,0 +1,43 @@ +// ConsoleApplication1.cpp : Defines the entry point for the console application. +// + + +// +using namespace System; + + + void TryToParse(String^ value) + { + Int32 number; + bool result = Int32::TryParse(value, number); + if (result) { + Console::WriteLine("Converted '{0}' to {1}.", value, number); + } + else { + if (value == nullptr) value = ""; + Console::WriteLine("Attempted conversion of '{0}' failed.", value); + } + } + + +void main() +{ + TryToParse(nullptr); + TryToParse("160519"); + TryToParse("9432.0"); + TryToParse("16,667"); + TryToParse(" -322 "); + TryToParse("+4302"); + TryToParse("(100);"); + TryToParse("01FA"); +} +// The example displays the following output: +// Attempted conversion of '' failed. +// Converted '160519' to 160519. +// Attempted conversion of '9432.0' failed. +// Attempted conversion of '16,667' failed. +// Converted ' -322 ' to -322. +// Converted '+4302' to 4302. +// Attempted conversion of '(100);' failed. +// Attempted conversion of '01FA' failed. +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp new file mode 100644 index 00000000000..0639d8b9dc6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Int32.TryParse/cpp/int32.tryparse2.cpp @@ -0,0 +1,100 @@ +// Int32.TryParse2.cpp : Defines the entry point for the console application. +// + + +// +using namespace System; +using namespace System::Globalization; + +void CallTryParse(String^ stringToConvert, NumberStyles styles) +{ + Int32 number; + CultureInfo^ provider; + + // If currency symbol is allowed, use en-US culture. + if (((Int32) (styles & NumberStyles::AllowCurrencySymbol)) > 0) + provider = gcnew CultureInfo("en-US"); + else + provider = CultureInfo::InvariantCulture; + + bool result = Int32::TryParse(stringToConvert, styles, + provider, number); + if (result) + Console::WriteLine("Converted '{0}' to {1}.", stringToConvert, number); + else + Console::WriteLine("Attempted conversion of '{0}' failed.", + Convert::ToString(stringToConvert)); +} + +void main() +{ + String^ numericString; + NumberStyles styles; + + numericString = "106779"; + styles = NumberStyles::Integer; + CallTryParse(numericString, styles); + + numericString = "-30677"; + styles = NumberStyles::None; + CallTryParse(numericString, styles); + + styles = NumberStyles::AllowLeadingSign; + CallTryParse(numericString, styles); + + numericString = "301677-"; + CallTryParse(numericString, styles); + + styles = styles | NumberStyles::AllowTrailingSign; + CallTryParse(numericString, styles); + + numericString = "$10634"; + styles = NumberStyles::Integer; + CallTryParse(numericString, styles); + + styles = NumberStyles::Integer | NumberStyles::AllowCurrencySymbol; + CallTryParse(numericString, styles); + + numericString = "10345.00"; + styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; + CallTryParse(numericString, styles); + + numericString = "10345.72"; + styles = NumberStyles::Integer | NumberStyles::AllowDecimalPoint; + CallTryParse(numericString, styles); + + numericString = "22,593"; + styles = NumberStyles::Integer | NumberStyles::AllowThousands; + CallTryParse(numericString, styles); + + numericString = "12E-01"; + styles = NumberStyles::Integer | NumberStyles::AllowExponent; + CallTryParse(numericString, styles); + + numericString = "12E03"; + CallTryParse(numericString, styles); + + numericString = "80c1"; + CallTryParse(numericString, NumberStyles::HexNumber); + + numericString = "0x80C1"; + CallTryParse(numericString, NumberStyles::HexNumber); + Console::ReadLine(); +} +// The example displays the following output: +// Converted '106779' to 106779. +// Attempted conversion of '-30677' failed. +// Converted '-30677' to -30677. +// Attempted conversion of '301677-' failed. +// Converted '301677-' to -301677. +// Attempted conversion of '$10634' failed. +// Converted '$10634' to 10634. +// Converted '10345.00' to 10345. +// Attempted conversion of '10345.72' failed. +// Converted '22,593' to 22593. +// Attempted conversion of '12E-01' failed. +// Converted '12E03' to 12000. +// Converted '80c1' to 32961. +// Attempted conversion of '0x80C1' failed. +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp new file mode 100644 index 00000000000..8a1d8bb47db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Math.E/CPP/efield.cpp @@ -0,0 +1,66 @@ + +// +// Example for the Math::E field. +using namespace System; + +// Approximate E with a power series. +void CalcPowerSeries() +{ + double factorial = 1.0; + double PS = 0.0; + + // Stop iterating when the series converges, + // and prevent a runaway process. + for ( int n = 0; n < 999 && Math::Abs( Math::E - PS ) > 1.0E-15; n++ ) + { + + // Calculate a running factorial. + if ( n > 0 ) + factorial *= (double)n; + + // Calculate and display the power series. + PS += 1.0 / factorial; + Console::WriteLine( "PS({0:D2}) == {1:E16}, Math::E - PS({0:D2}) == {2:E16}", n, PS, Math::E - PS ); + + } +} + +int main() +{ + Console::WriteLine( "This example of Math::E == {0:E16}\n" + "generates the following output.\n", Math::E ); + Console::WriteLine( "Define the power series PS(n) = Sum(k->0,n)[1/k!]" ); + Console::WriteLine( " (limit n->infinity)PS(n) == e" ); + Console::WriteLine( "Display PS(n) and Math::E - PS(n), " + "and stop when delta < 1.0E-15\n" ); + CalcPowerSeries(); +} + +/* +This example of Math::E == 2.7182818284590451E+000 +generates the following output. + +Define the power series PS(n) = Sum(k->0,n)[1/k!] + (limit n->infinity)PS(n) == e +Display PS(n) and Math::E - PS(n), and stop when delta < 1.0E-15 + +PS(00) == 1.0000000000000000E+000, Math::E - PS(00) == 1.7182818284590451E+000 +PS(01) == 2.0000000000000000E+000, Math::E - PS(01) == 7.1828182845904509E-001 +PS(02) == 2.5000000000000000E+000, Math::E - PS(02) == 2.1828182845904509E-001 +PS(03) == 2.6666666666666665E+000, Math::E - PS(03) == 5.1615161792378572E-002 +PS(04) == 2.7083333333333330E+000, Math::E - PS(04) == 9.9484951257120535E-003 +PS(05) == 2.7166666666666663E+000, Math::E - PS(05) == 1.6151617923787498E-003 +PS(06) == 2.7180555555555554E+000, Math::E - PS(06) == 2.2627290348964380E-004 +PS(07) == 2.7182539682539684E+000, Math::E - PS(07) == 2.7860205076724043E-005 +PS(08) == 2.7182787698412700E+000, Math::E - PS(08) == 3.0586177750535626E-006 +PS(09) == 2.7182815255731922E+000, Math::E - PS(09) == 3.0288585284310443E-007 +PS(10) == 2.7182818011463845E+000, Math::E - PS(10) == 2.7312660577649694E-008 +PS(11) == 2.7182818261984929E+000, Math::E - PS(11) == 2.2605521898810821E-009 +PS(12) == 2.7182818282861687E+000, Math::E - PS(12) == 1.7287637987806193E-010 +PS(13) == 2.7182818284467594E+000, Math::E - PS(13) == 1.2285727990501982E-011 +PS(14) == 2.7182818284582302E+000, Math::E - PS(14) == 8.1490370007486490E-013 +PS(15) == 2.7182818284589949E+000, Math::E - PS(15) == 5.0182080713057076E-014 +PS(16) == 2.7182818284590429E+000, Math::E - PS(16) == 2.2204460492503131E-015 +PS(17) == 2.7182818284590455E+000, Math::E - PS(17) == -4.4408920985006262E-016 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp new file mode 100644 index 00000000000..a74b9251364 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Exp/CPP/exp.cpp @@ -0,0 +1,96 @@ + +// +// Example for the Math::Exp( double ) method. +using namespace System; + +// Evaluate logarithmic/exponential identity with a given argument. +void UseLnExp( double arg ) +{ + + // Evaluate e ^ ln(X) == ln(e ^ X) == X. + Console::WriteLine( "\n Math::Exp(Math::Log({0})) == {1:E16}\n" + " Math::Log(Math::Exp({0})) == {2:E16}", arg, Math::Exp( Math::Log( arg ) ), Math::Log( Math::Exp( arg ) ) ); +} + + +// Evaluate exponential identities that are functions of two arguments. +void UseTwoArgs( double argX, double argY ) +{ + + // Evaluate (e ^ X) * (e ^ Y) == e ^ (X + Y). + Console::WriteLine( "\nMath::Exp({0}) * Math::Exp({1}) == {2:E16}" + "\n Math::Exp({0} + {1}) == {3:E16}", argX, argY, Math::Exp( argX ) * Math::Exp( argY ), Math::Exp( argX + argY ) ); + + // Evaluate (e ^ X) ^ Y == e ^ (X * Y). + Console::WriteLine( " Math::Pow(Math::Exp({0}), {1}) == {2:E16}" + "\n Math::Exp({0} * {1}) == {3:E16}", argX, argY, Math::Pow( Math::Exp( argX ), argY ), Math::Exp( argX * argY ) ); + + // Evaluate X ^ Y == e ^ (Y * ln(X)). + Console::WriteLine( " Math::Pow({0}, {1}) == {2:E16}" + "\nMath::Exp({1} * Math::Log({0})) == {3:E16}", argX, argY, Math::Pow( argX, argY ), Math::Exp( argY * Math::Log( argX ) ) ); +} + +int main() +{ + Console::WriteLine( "This example of Math::Exp( double ) " + "generates the following output.\n" ); + Console::WriteLine( "Evaluate [e ^ ln(X) == ln(e ^ X) == X] " + "with selected values for X:" ); + UseLnExp( 0.1 ); + UseLnExp( 1.2 ); + UseLnExp( 4.9 ); + UseLnExp( 9.9 ); + Console::WriteLine( "\nEvaluate these identities with " + "selected values for X and Y:" ); + Console::WriteLine( " (e ^ X) * (e ^ Y) == e ^ (X + Y)" ); + Console::WriteLine( " (e ^ X) ^ Y == e ^ (X * Y)" ); + Console::WriteLine( " X ^ Y == e ^ (Y * ln(X))" ); + UseTwoArgs( 0.1, 1.2 ); + UseTwoArgs( 1.2, 4.9 ); + UseTwoArgs( 4.9, 9.9 ); +} + +/* +This example of Math::Exp( double ) generates the following output. + +Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X: + + Math::Exp(Math::Log(0.1)) == 1.0000000000000001E-001 + Math::Log(Math::Exp(0.1)) == 1.0000000000000008E-001 + + Math::Exp(Math::Log(1.2)) == 1.2000000000000000E+000 + Math::Log(Math::Exp(1.2)) == 1.2000000000000000E+000 + + Math::Exp(Math::Log(4.9)) == 4.9000000000000012E+000 + Math::Log(Math::Exp(4.9)) == 4.9000000000000004E+000 + + Math::Exp(Math::Log(9.9)) == 9.9000000000000004E+000 + Math::Log(Math::Exp(9.9)) == 9.9000000000000004E+000 + +Evaluate these identities with selected values for X and Y: + (e ^ X) * (e ^ Y) == e ^ (X + Y) + (e ^ X) ^ Y == e ^ (X * Y) + X ^ Y == e ^ (Y * ln(X)) + +Math::Exp(0.1) * Math::Exp(1.2) == 3.6692966676192444E+000 + Math::Exp(0.1 + 1.2) == 3.6692966676192444E+000 + Math::Pow(Math::Exp(0.1), 1.2) == 1.1274968515793757E+000 + Math::Exp(0.1 * 1.2) == 1.1274968515793757E+000 + Math::Pow(0.1, 1.2) == 6.3095734448019331E-002 +Math::Exp(1.2 * Math::Log(0.1)) == 6.3095734448019344E-002 + +Math::Exp(1.2) * Math::Exp(4.9) == 4.4585777008251705E+002 + Math::Exp(1.2 + 4.9) == 4.4585777008251716E+002 + Math::Pow(Math::Exp(1.2), 4.9) == 3.5780924170885260E+002 + Math::Exp(1.2 * 4.9) == 3.5780924170885277E+002 + Math::Pow(1.2, 4.9) == 2.4433636334442981E+000 +Math::Exp(4.9 * Math::Log(1.2)) == 2.4433636334442981E+000 + +Math::Exp(4.9) * Math::Exp(9.9) == 2.6764450551890982E+006 + Math::Exp(4.9 + 9.9) == 2.6764450551891015E+006 + Math::Pow(Math::Exp(4.9), 9.9) == 1.1684908531676833E+021 + Math::Exp(4.9 * 9.9) == 1.1684908531676829E+021 + Math::Pow(4.9, 9.9) == 6.8067718210957060E+006 +Math::Exp(9.9 * Math::Log(4.9)) == 6.8067718210956985E+006 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp new file mode 100644 index 00000000000..aa7f305520b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Log_Overloads/CPP/loggen.cpp @@ -0,0 +1,66 @@ + +// +// Example for the Math::Log( double ) and Math::Log( double, double ) methods. +using namespace System; + +// Evaluate logarithmic identities that are functions of two arguments. +void UseBaseAndArg( double argB, double argX ) +{ + + // Evaluate log(B)[X] == 1 / log(X)[B]. + Console::WriteLine( "\n Math::Log({1}, {0}) == {2:E16}" + "\n 1.0 / Math::Log({0}, {1}) == {3:E16}", argB, argX, Math::Log( argX, argB ), 1.0 / Math::Log( argB, argX ) ); + + // Evaluate log(B)[X] == ln[X] / ln[B]. + Console::WriteLine( " Math::Log({1}) / Math::Log({0}) == {2:E16}", argB, argX, Math::Log( argX ) / Math::Log( argB ) ); + + // Evaluate log(B)[X] == log(B)[e] * ln[X]. + Console::WriteLine( "Math::Log(Math::E, {0}) * Math::Log({1}) == {2:E16}", argB, argX, Math::Log( Math::E, argB ) * Math::Log( argX ) ); +} + +void main() +{ + Console::WriteLine( "This example of Math::Log( double ) and " + "Math::Log( double, double )\n" + "generates the following output.\n" ); + Console::WriteLine( "Evaluate these identities with " + "selected values for X and B (base):" ); + Console::WriteLine( " log(B)[X] == 1 / log(X)[B]" ); + Console::WriteLine( " log(B)[X] == ln[X] / ln[B]" ); + Console::WriteLine( " log(B)[X] == log(B)[e] * ln[X]" ); + UseBaseAndArg( 0.1, 1.2 ); + UseBaseAndArg( 1.2, 4.9 ); + UseBaseAndArg( 4.9, 9.9 ); + UseBaseAndArg( 9.9, 0.1 ); +} + +/* +This example of Math::Log( double ) and Math::Log( double, double ) +generates the following output. + +Evaluate these identities with selected values for X and B (base): + log(B)[X] == 1 / log(X)[B] + log(B)[X] == ln[X] / ln[B] + log(B)[X] == log(B)[e] * ln[X] + + Math::Log(1.2, 0.1) == -7.9181246047624818E-002 + 1.0 / Math::Log(0.1, 1.2) == -7.9181246047624818E-002 + Math::Log(1.2) / Math::Log(0.1) == -7.9181246047624818E-002 +Math::Log(Math::E, 0.1) * Math::Log(1.2) == -7.9181246047624804E-002 + + Math::Log(4.9, 1.2) == 8.7166610085093179E+000 + 1.0 / Math::Log(1.2, 4.9) == 8.7166610085093161E+000 + Math::Log(4.9) / Math::Log(1.2) == 8.7166610085093179E+000 +Math::Log(Math::E, 1.2) * Math::Log(4.9) == 8.7166610085093179E+000 + + Math::Log(9.9, 4.9) == 1.4425396251981288E+000 + 1.0 / Math::Log(4.9, 9.9) == 1.4425396251981288E+000 + Math::Log(9.9) / Math::Log(4.9) == 1.4425396251981288E+000 +Math::Log(Math::E, 4.9) * Math::Log(9.9) == 1.4425396251981288E+000 + + Math::Log(0.1, 9.9) == -1.0043839404494075E+000 + 1.0 / Math::Log(9.9, 0.1) == -1.0043839404494075E+000 + Math::Log(0.1) / Math::Log(9.9) == -1.0043839404494075E+000 +Math::Log(Math::E, 9.9) * Math::Log(0.1) == -1.0043839404494077E+000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp new file mode 100644 index 00000000000..e16651faef4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinCos/CPP/sincos.cpp @@ -0,0 +1,120 @@ + +// +// Example for the trigonometric Math.Sin( double ) +// and Math.Cos( double ) methods. +using namespace System; + +// Evaluate trigonometric identities with a given angle. +void UseSineCosine( double degrees ) +{ + double angle = Math::PI * degrees / 180.0; + double sinAngle = Math::Sin( angle ); + double cosAngle = Math::Cos( angle ); + + // Evaluate sin^2(X) + cos^2(X) == 1. + Console::WriteLine( "\n Math::Sin({0} deg) == {1:E16}\n" + " Math::Cos({0} deg) == {2:E16}", degrees, Math::Sin( angle ), Math::Cos( angle ) ); + Console::WriteLine( "(Math::Sin({0} deg))^2 + (Math::Cos({0} deg))^2 == {1:E16}", degrees, sinAngle * sinAngle + cosAngle * cosAngle ); + + // Evaluate sin(2 * X) == 2 * sin(X) * cos(X). + Console::WriteLine( " Math::Sin({0} deg) == {1:E16}", 2.0 * degrees, Math::Sin( 2.0 * angle ) ); + Console::WriteLine( " 2 * Math::Sin({0} deg) * Math::Cos({0} deg) == {1:E16}", degrees, 2.0 * sinAngle * cosAngle ); + + // Evaluate cos(2 * X) == cos^2(X) - sin^2(X). + Console::WriteLine( " Math::Cos({0} deg) == {1:E16}", 2.0 * degrees, Math::Cos( 2.0 * angle ) ); + Console::WriteLine( "(Math::Cos({0} deg))^2 - (Math::Sin({0} deg))^2 == {1:E16}", degrees, cosAngle * cosAngle - sinAngle * sinAngle ); +} + + +// Evaluate trigonometric identities that are functions of two angles. +void UseTwoAngles( double degreesX, double degreesY ) +{ + double angleX = Math::PI * degreesX / 180.0; + double angleY = Math::PI * degreesY / 180.0; + + // Evaluate sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y). + Console::WriteLine( "\n Math::Sin({0} deg) * Math::Cos({1} deg) +\n" + " Math::Cos({0} deg) * Math::Sin({1} deg) == {2:E16}", degreesX, degreesY, Math::Sin( angleX ) * Math::Cos( angleY ) + Math::Cos( angleX ) * Math::Sin( angleY ) ); + Console::WriteLine( " Math::Sin({0} deg) == {1:E16}", degreesX + degreesY, Math::Sin( angleX + angleY ) ); + + // Evaluate cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y). + Console::WriteLine( " Math::Cos({0} deg) * Math::Cos({1} deg) -\n" + " Math::Sin({0} deg) * Math::Sin({1} deg) == {2:E16}", degreesX, degreesY, Math::Cos( angleX ) * Math::Cos( angleY ) - Math::Sin( angleX ) * Math::Sin( angleY ) ); + Console::WriteLine( " Math::Cos({0} deg) == {1:E16}", degreesX + degreesY, Math::Cos( angleX + angleY ) ); +} + +int main() +{ + Console::WriteLine( "This example of trigonometric " + "Math::Sin( double ) and Math::Cos( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "Convert selected values for X to radians \n" + "and evaluate these trigonometric identities:" ); + Console::WriteLine( " sin^2(X) + cos^2(X) == 1\n" + " sin(2 * X) == 2 * sin(X) * cos(X)" ); + Console::WriteLine( " cos(2 * X) == cos^2(X) - sin^2(X)" ); + UseSineCosine( 15.0 ); + UseSineCosine( 30.0 ); + UseSineCosine( 45.0 ); + Console::WriteLine( "\nConvert selected values for X and Y to radians \n" + "and evaluate these trigonometric identities:" ); + Console::WriteLine( " sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y)" ); + Console::WriteLine( " cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y)" ); + UseTwoAngles( 15.0, 30.0 ); + UseTwoAngles( 30.0, 45.0 ); +} + +/* +This example of trigonometric Math::Sin( double ) and Math::Cos( double ) +generates the following output. + +Convert selected values for X to radians +and evaluate these trigonometric identities: + sin^2(X) + cos^2(X) == 1 + sin(2 * X) == 2 * sin(X) * cos(X) + cos(2 * X) == cos^2(X) - sin^2(X) + + Math::Sin(15 deg) == 2.5881904510252074E-001 + Math::Cos(15 deg) == 9.6592582628906831E-001 +(Math::Sin(15 deg))^2 + (Math::Cos(15 deg))^2 == 1.0000000000000000E+000 + Math::Sin(30 deg) == 4.9999999999999994E-001 + 2 * Math::Sin(15 deg) * Math::Cos(15 deg) == 4.9999999999999994E-001 + Math::Cos(30 deg) == 8.6602540378443871E-001 +(Math::Cos(15 deg))^2 - (Math::Sin(15 deg))^2 == 8.6602540378443871E-001 + + Math::Sin(30 deg) == 4.9999999999999994E-001 + Math::Cos(30 deg) == 8.6602540378443871E-001 +(Math::Sin(30 deg))^2 + (Math::Cos(30 deg))^2 == 1.0000000000000000E+000 + Math::Sin(60 deg) == 8.6602540378443860E-001 + 2 * Math::Sin(30 deg) * Math::Cos(30 deg) == 8.6602540378443860E-001 + Math::Cos(60 deg) == 5.0000000000000011E-001 +(Math::Cos(30 deg))^2 - (Math::Sin(30 deg))^2 == 5.0000000000000022E-001 + + Math::Sin(45 deg) == 7.0710678118654746E-001 + Math::Cos(45 deg) == 7.0710678118654757E-001 +(Math::Sin(45 deg))^2 + (Math::Cos(45 deg))^2 == 1.0000000000000000E+000 + Math::Sin(90 deg) == 1.0000000000000000E+000 + 2 * Math::Sin(45 deg) * Math::Cos(45 deg) == 1.0000000000000000E+000 + Math::Cos(90 deg) == 6.1230317691118863E-017 +(Math::Cos(45 deg))^2 - (Math::Sin(45 deg))^2 == 2.2204460492503131E-016 + +Convert selected values for X and Y to radians +and evaluate these trigonometric identities: + sin(X + Y) == sin(X) * cos(Y) + cos(X) * sin(Y) + cos(X + Y) == cos(X) * cos(Y) - sin(X) * sin(Y) + + Math::Sin(15 deg) * Math::Cos(30 deg) + + Math::Cos(15 deg) * Math::Sin(30 deg) == 7.0710678118654746E-001 + Math::Sin(45 deg) == 7.0710678118654746E-001 + Math::Cos(15 deg) * Math::Cos(30 deg) - + Math::Sin(15 deg) * Math::Sin(30 deg) == 7.0710678118654757E-001 + Math::Cos(45 deg) == 7.0710678118654757E-001 + + Math::Sin(30 deg) * Math::Cos(45 deg) + + Math::Cos(30 deg) * Math::Sin(45 deg) == 9.6592582628906831E-001 + Math::Sin(75 deg) == 9.6592582628906820E-001 + Math::Cos(30 deg) * Math::Cos(45 deg) - + Math::Sin(30 deg) * Math::Sin(45 deg) == 2.5881904510252085E-001 + Math::Cos(75 deg) == 2.5881904510252096E-001 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp new file mode 100644 index 00000000000..c3fdb8d9939 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Math.SinhCosh/CPP/sinhcosh.cpp @@ -0,0 +1,115 @@ + +// +// Example for the hyperbolic Math.Sinh( double ) +// and Math.Cosh( double ) methods. +using namespace System; + +// Evaluate hyperbolic identities with a given argument. +void UseSinhCosh( double arg ) +{ + double sinhArg = Math::Sinh( arg ); + double coshArg = Math::Cosh( arg ); + + // Evaluate cosh^2(X) - sinh^2(X) == 1. + Console::WriteLine( "\n Math::Sinh({0}) == {1:E16}\n" + " Math::Cosh({0}) == {2:E16}", arg, Math::Sinh( arg ), Math::Cosh( arg ) ); + Console::WriteLine( "(Math::Cosh({0}))^2 - (Math::Sinh({0}))^2 == {1:E16}", arg, coshArg * coshArg - sinhArg * sinhArg ); + + // Evaluate sinh(2 * X) == 2 * sinh(X) * cosh(X). + Console::WriteLine( " Math::Sinh({0}) == {1:E16}", 2.0 * arg, Math::Sinh( 2.0 * arg ) ); + Console::WriteLine( " 2 * Math::Sinh({0}) * Math::Cosh({0}) == {1:E16}", arg, 2.0 * sinhArg * coshArg ); + + // Evaluate cosh(2 * X) == cosh^2(X) + sinh^2(X). + Console::WriteLine( " Math::Cosh({0}) == {1:E16}", 2.0 * arg, Math::Cosh( 2.0 * arg ) ); + Console::WriteLine( "(Math::Cosh({0}))^2 + (Math::Sinh({0}))^2 == {1:E16}", arg, coshArg * coshArg + sinhArg * sinhArg ); +} + + +// Evaluate hyperbolic identities that are functions of two arguments. +void UseTwoArgs( double argX, double argY ) +{ + + // Evaluate sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y). + Console::WriteLine( "\n Math::Sinh({0}) * Math::Cosh({1}) +\n" + " Math::Cosh({0}) * Math::Sinh({1}) == {2:E16}", argX, argY, Math::Sinh( argX ) * Math::Cosh( argY ) + Math::Cosh( argX ) * Math::Sinh( argY ) ); + Console::WriteLine( " Math::Sinh({0}) == {1:E16}", argX + argY, Math::Sinh( argX + argY ) ); + + // Evaluate cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y). + Console::WriteLine( " Math::Cosh({0}) * Math::Cosh({1}) +\n" + " Math::Sinh({0}) * Math::Sinh({1}) == {2:E16}", argX, argY, Math::Cosh( argX ) * Math::Cosh( argY ) + Math::Sinh( argX ) * Math::Sinh( argY ) ); + Console::WriteLine( " Math::Cosh({0}) == {1:E16}", argX + argY, Math::Cosh( argX + argY ) ); +} + +int main() +{ + Console::WriteLine( "This example of hyperbolic " + "Math::Sinh( double ) and Math::Cosh( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "Evaluate these hyperbolic identities " + "with selected values for X:" ); + Console::WriteLine( " cosh^2(X) - sinh^2(X) == 1\n" + " sinh(2 * X) == 2 * sinh(X) * cosh(X)" ); + Console::WriteLine( " cosh(2 * X) == cosh^2(X) + sinh^2(X)" ); + UseSinhCosh( 0.1 ); + UseSinhCosh( 1.2 ); + UseSinhCosh( 4.9 ); + Console::WriteLine( "\nEvaluate these hyperbolic identities " + "with selected values for X and Y:" ); + Console::WriteLine( " sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y)" ); + Console::WriteLine( " cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y)" ); + UseTwoArgs( 0.1, 1.2 ); + UseTwoArgs( 1.2, 4.9 ); +} + +/* +This example of hyperbolic Math::Sinh( double ) and Math::Cosh( double ) +generates the following output. + +Evaluate these hyperbolic identities with selected values for X: + cosh^2(X) - sinh^2(X) == 1 + sinh(2 * X) == 2 * sinh(X) * cosh(X) + cosh(2 * X) == cosh^2(X) + sinh^2(X) + + Math::Sinh(0.1) == 1.0016675001984403E-001 + Math::Cosh(0.1) == 1.0050041680558035E+000 +(Math::Cosh(0.1))^2 - (Math::Sinh(0.1))^2 == 9.9999999999999989E-001 + Math::Sinh(0.2) == 2.0133600254109399E-001 + 2 * Math::Sinh(0.1) * Math::Cosh(0.1) == 2.0133600254109396E-001 + Math::Cosh(0.2) == 1.0200667556190759E+000 +(Math::Cosh(0.1))^2 + (Math::Sinh(0.1))^2 == 1.0200667556190757E+000 + + Math::Sinh(1.2) == 1.5094613554121725E+000 + Math::Cosh(1.2) == 1.8106555673243747E+000 +(Math::Cosh(1.2))^2 - (Math::Sinh(1.2))^2 == 1.0000000000000000E+000 + Math::Sinh(2.4) == 5.4662292136760939E+000 + 2 * Math::Sinh(1.2) * Math::Cosh(1.2) == 5.4662292136760939E+000 + Math::Cosh(2.4) == 5.5569471669655064E+000 +(Math::Cosh(1.2))^2 + (Math::Sinh(1.2))^2 == 5.5569471669655064E+000 + + Math::Sinh(4.9) == 6.7141166550932297E+001 + Math::Cosh(4.9) == 6.7148613134003227E+001 +(Math::Cosh(4.9))^2 - (Math::Sinh(4.9))^2 == 1.0000000000000000E+000 + Math::Sinh(9.8) == 9.0168724361884615E+003 + 2 * Math::Sinh(4.9) * Math::Cosh(4.9) == 9.0168724361884615E+003 + Math::Cosh(9.8) == 9.0168724916400624E+003 +(Math::Cosh(4.9))^2 + (Math::Sinh(4.9))^2 == 9.0168724916400606E+003 + +Evaluate these hyperbolic identities with selected values for X and Y: + sinh(X + Y) == sinh(X) * cosh(Y) + cosh(X) * sinh(Y) + cosh(X + Y) == cosh(X) * cosh(Y) + sinh(X) * sinh(Y) + + Math::Sinh(0.1) * Math::Cosh(1.2) + + Math::Cosh(0.1) * Math::Sinh(1.2) == 1.6983824372926155E+000 + Math::Sinh(1.3) == 1.6983824372926160E+000 + Math::Cosh(0.1) * Math::Cosh(1.2) + + Math::Sinh(0.1) * Math::Sinh(1.2) == 1.9709142303266281E+000 + Math::Cosh(1.3) == 1.9709142303266285E+000 + + Math::Sinh(1.2) * Math::Cosh(4.9) + + Math::Cosh(1.2) * Math::Sinh(4.9) == 2.2292776360739879E+002 + Math::Sinh(6.1) == 2.2292776360739885E+002 + Math::Cosh(1.2) * Math::Cosh(4.9) + + Math::Sinh(1.2) * Math::Sinh(4.9) == 2.2293000647511826E+002 + Math::Cosh(6.1) == 2.2293000647511832E+002 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp new file mode 100644 index 00000000000..00a5cb83a3d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Math.Tanh/CPP/tanh.cpp @@ -0,0 +1,87 @@ + +// +// Example for the hyperbolic Math::Tanh( double ) method. +using namespace System; + +// Evaluate hyperbolic identities with a given argument. +void UseTanh( double arg ) +{ + double tanhArg = Math::Tanh( arg ); + + // Evaluate tanh(X) == sinh(X) / cosh(X). + Console::WriteLine( "\n Math::Tanh({0}) == {1:E16}\n" + " Math::Sinh({0}) / Math::Cosh({0}) == {2:E16}", arg, tanhArg, (Math::Sinh( arg ) / Math::Cosh( arg )) ); + + // Evaluate tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)). + Console::WriteLine( " 2 * Math::Tanh({0}) /", arg, 2.0 * tanhArg ); + Console::WriteLine( " (1 + (Math::Tanh({0}))^2) == {1:E16}", arg, 2.0 * tanhArg / (1.0 + tanhArg * tanhArg) ); + Console::WriteLine( " Math::Tanh({0}) == {1:E16}", 2.0 * arg, Math::Tanh( 2.0 * arg ) ); +} + + +// Evaluate a hyperbolic identity that is a function of two arguments. +void UseTwoArgs( double argX, double argY ) +{ + + // Evaluate tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)). + Console::WriteLine( "\n (Math::Tanh({0}) + Math::Tanh({1})) /\n" + "(1 + Math::Tanh({0}) * Math::Tanh({1})) == {2:E16}", argX, argY, (Math::Tanh( argX ) + Math::Tanh( argY )) / (1.0 + Math::Tanh( argX ) * Math::Tanh( argY )) ); + Console::WriteLine( " Math::Tanh({0}) == {1:E16}", argX + argY, Math::Tanh( argX + argY ) ); +} + +int main() +{ + Console::WriteLine( "This example of hyperbolic Math::Tanh( double )\n" + "generates the following output." ); + Console::WriteLine( "\nEvaluate these hyperbolic identities " + "with selected values for X:" ); + Console::WriteLine( " tanh(X) == sinh(X) / cosh(X)" ); + Console::WriteLine( " tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))" ); + UseTanh( 0.1 ); + UseTanh( 1.2 ); + UseTanh( 4.9 ); + Console::WriteLine( "\nEvaluate [tanh(X + Y) == " + "(tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]" + "\nwith selected values for X and Y:" ); + UseTwoArgs( 0.1, 1.2 ); + UseTwoArgs( 1.2, 4.9 ); +} + +/* +This example of hyperbolic Math::Tanh( double ) +generates the following output. + +Evaluate these hyperbolic identities with selected values for X: + tanh(X) == sinh(X) / cosh(X) + tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)) + + Math::Tanh(0.1) == 9.9667994624955819E-002 + Math::Sinh(0.1) / Math::Cosh(0.1) == 9.9667994624955819E-002 + 2 * Math::Tanh(0.1) / + (1 + (Math::Tanh(0.1))^2) == 1.9737532022490401E-001 + Math::Tanh(0.2) == 1.9737532022490401E-001 + + Math::Tanh(1.2) == 8.3365460701215521E-001 + Math::Sinh(1.2) / Math::Cosh(1.2) == 8.3365460701215521E-001 + 2 * Math::Tanh(1.2) / + (1 + (Math::Tanh(1.2))^2) == 9.8367485769368024E-001 + Math::Tanh(2.4) == 9.8367485769368024E-001 + + Math::Tanh(4.9) == 9.9988910295055444E-001 + Math::Sinh(4.9) / Math::Cosh(4.9) == 9.9988910295055433E-001 + 2 * Math::Tanh(4.9) / + (1 + (Math::Tanh(4.9))^2) == 9.9999999385024030E-001 + Math::Tanh(9.8) == 9.9999999385024030E-001 + +Evaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))] +with selected values for X and Y: + + (Math::Tanh(0.1) + Math::Tanh(1.2)) / +(1 + Math::Tanh(0.1) * Math::Tanh(1.2)) == 8.6172315931330645E-001 + Math::Tanh(1.3) == 8.6172315931330634E-001 + + (Math::Tanh(1.2) + Math::Tanh(4.9)) / +(1 + Math::Tanh(1.2) * Math::Tanh(4.9)) == 9.9998993913939649E-001 + Math::Tanh(6.1) == 9.9998993913939649E-001 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp new file mode 100644 index 00000000000..3caae363b62 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals.cpp @@ -0,0 +1,76 @@ +// Equals.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +#using + +using namespace System; +using namespace System::Numerics; + +void main() +{ + BigInteger bigIntValue; + + Byte byteValue = 16; + bigIntValue = BigInteger(byteValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + byteValue.GetType()->Name, byteValue, + bigIntValue.Equals((Int64)byteValue)); + + SByte sbyteValue = -16; + bigIntValue = BigInteger(sbyteValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + sbyteValue.GetType()->Name, sbyteValue, + bigIntValue.Equals((Int64)sbyteValue)); + + Int16 shortValue = 1233; + bigIntValue = BigInteger(shortValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + shortValue.GetType()->Name, shortValue, + bigIntValue.Equals((Int64)shortValue)); + + UInt16 ushortValue = 64000; + bigIntValue = BigInteger(ushortValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + ushortValue.GetType()->Name, ushortValue, + bigIntValue.Equals((Int64)ushortValue)); + + int intValue = -1603854; + bigIntValue = BigInteger(intValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + intValue.GetType()->Name, intValue, + bigIntValue.Equals((Int64)intValue)); + + UInt32 uintValue = 1223300; + bigIntValue = BigInteger(uintValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + uintValue.GetType()->Name, uintValue, + bigIntValue.Equals((Int64)uintValue)); + + Int64 longValue = -123822229012; + bigIntValue = BigInteger(longValue); + Console::WriteLine("{0} {1} = {2} {3} : {4}", + bigIntValue.GetType()->Name, bigIntValue, + longValue.GetType()->Name, longValue, + bigIntValue.Equals((Int64)longValue)); +} +/* +The example displays output like the following: + BigInteger 16 = Byte 16 : True + BigInteger -16 = SByte -16 : True + BigInteger 1233 = Int16 1233 : True + BigInteger 64000 = UInt16 64000 : True + BigInteger -1603854 = Int32 -1603854 : True + BigInteger 1223300 = UInt32 1223300 : True + BigInteger -123822229012 = Int64 -123822229012 : True +*/ +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp new file mode 100644 index 00000000000..c480f604daa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Numerics.BigInteger.Equals/cpp/equals2.cpp @@ -0,0 +1,43 @@ +// Equals2.cpp : Defines the entry point for the console application. +// + +// +#using + +using namespace System; +using namespace System::Numerics; + + +void main() +{ + const Int64 LIGHT_YEAR = 5878625373183; + + BigInteger altairDistance = 17 * LIGHT_YEAR; + BigInteger epsilonIndiDistance = 12 * LIGHT_YEAR; + BigInteger ursaeMajoris47Distance = 46 * LIGHT_YEAR; + Int64 tauCetiDistance = 12 * LIGHT_YEAR; + UInt64 procyon2Distance = 12 * LIGHT_YEAR; + Object^ wolf424ABDistance = 14 * LIGHT_YEAR; + + Console::WriteLine("Approx. equal distances from Epsilon Indi to:"); + Console::WriteLine(" Altair: {0}", + epsilonIndiDistance.Equals(altairDistance)); + Console::WriteLine(" Ursae Majoris 47: {0}", + epsilonIndiDistance.Equals(ursaeMajoris47Distance)); + Console::WriteLine(" TauCeti: {0}", + epsilonIndiDistance.Equals(tauCetiDistance)); + Console::WriteLine(" Procyon 2: {0}", + epsilonIndiDistance.Equals(procyon2Distance)); + Console::WriteLine(" Wolf 424 AB: {0}", + epsilonIndiDistance.Equals(wolf424ABDistance)); +} +/* +The example displays output like the following: + Approx. equal distances from Epsilon Indi to: + Altair: False + Ursae Majoris 47: False + TauCeti: True + Procyon 2: True + Wolf 424 AB: False +*/ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp new file mode 100644 index 00000000000..f6ba5145e9c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Clone/CPP/clone.cpp @@ -0,0 +1,56 @@ + +// +// Example for the OperatingSystem::Clone method. +using namespace System; + +// Copy, clone, and duplicate an OperatingSystem object. +void CopyOperatingSystemObjects() +{ + + // The Version object does not need to correspond to an + // actual OS version. + Version^ verMMBVer = gcnew Version( 5,6,7,8 ); + OperatingSystem^ opCreate1 = gcnew OperatingSystem( PlatformID::Win32NT,verMMBVer ); + + // Create another OperatingSystem object with the same + // parameters as opCreate1. + OperatingSystem^ opCreate2 = gcnew OperatingSystem( PlatformID::Win32NT,verMMBVer ); + + // Clone opCreate1 and copy the opCreate1 reference. + OperatingSystem^ opClone = safe_cast(opCreate1->Clone()); + OperatingSystem^ opCopy = opCreate1; + + // Compare the various objects for equality. + Console::WriteLine( "{0,-50}{1}", "Is the second object the same as the original?", opCreate1->Equals( opCreate2 ) ); + Console::WriteLine( "{0,-50}{1}", "Is the object clone the same as the original?", opCreate1->Equals( opClone ) ); + Console::WriteLine( "{0,-50}{1}", "Is the copied object the same as the original?", opCreate1->Equals( opCopy ) ); +} + +int main() +{ + Console::WriteLine( "This example of OperatingSystem::Clone( ) " + "generates the following output.\n" ); + Console::WriteLine( "Create an OperatingSystem object, and then " + "create another object with the \n" + "same parameters. Clone and copy the original " + "object, and then compare \n" + "each object with the original " + "using the Equals( ) method. Equals( ) \n" + "returns true only when both " + "references refer to the same object.\n" ); + CopyOperatingSystemObjects(); +} + +/* +This example of OperatingSystem::Clone( ) generates the following output. + +Create an OperatingSystem object, and then create another object with the +same parameters. Clone and copy the original object, and then compare +each object with the original using the Equals( ) method. Equals( ) +returns true only when both references refer to the same object. + +Is the second object the same as the original? False +Is the object clone the same as the original? False +Is the copied object the same as the original? True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp new file mode 100644 index 00000000000..51ca7637c6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Ctor_ToString/CPP/ctor_tostr.cpp @@ -0,0 +1,60 @@ + +// +// Example for the OperatingSystem constructor and the +// OperatingSystem::ToString( ) method. +using namespace System; + +// Create and display an OperatingSystem object. +void BuildOSObj( PlatformID pID, Version^ ver ) +{ + OperatingSystem^ os = gcnew OperatingSystem( pID,ver ); + Console::WriteLine( " {0}", os->ToString() ); +} + +void BuildOperatingSystemObjects() +{ + + // The Version object does not need to correspond to an + // actual OS version. + Version^ verNull = gcnew Version; + Version^ verMajMin = gcnew Version( 3,11 ); + Version^ verMMBld = gcnew Version( 5,25,625 ); + Version^ verMMBVer = gcnew Version( 5,6,7,8 ); + Version^ verString = gcnew Version( "3.5.8.13" ); + + // All PlatformID members are shown here. + BuildOSObj( PlatformID::Win32NT, verNull ); + BuildOSObj( PlatformID::Win32S, verMajMin ); + BuildOSObj( PlatformID::Win32Windows, verMMBld ); + BuildOSObj( PlatformID::WinCE, verMMBVer ); + BuildOSObj( PlatformID::Win32NT, verString ); +} + +int main() +{ + Console::WriteLine( "This example of the OperatingSystem constructor and \n" + "OperatingSystem::ToString( ) generates the following " + "output.\n" ); + Console::WriteLine( "Create and display several different " + "OperatingSystem objects:\n" ); + BuildOperatingSystemObjects(); + Console::WriteLine( "\nThe OS version of the host computer is:\n\n {0}", Environment::OSVersion->ToString() ); +} + +/* +This example of the OperatingSystem constructor and +OperatingSystem::ToString( ) generates the following output. + +Create and display several different OperatingSystem objects: + + Microsoft Windows NT 0.0 + Microsoft Win32S 3.11 + Microsoft Windows 98 5.25.625 + Microsoft Windows CE 5.6.7.8 + Microsoft Windows NT 3.5.8.13 + +The OS version of the host computer is: + + Microsoft Windows NT 5.1.2600.0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp new file mode 100644 index 00000000000..955079bbbca --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.OperatingSystem.Platform_Version/CPP/plat_ver.cpp @@ -0,0 +1,64 @@ + +// +// Example for the OperatingSystem.Platform and +// OperatingSystem.Version properties. +using namespace System; + +// Create an OperatingSystem object and display the Platform +// and Version properties. +void BuildOSObj( PlatformID pID, Version^ ver ) +{ + OperatingSystem^ opSys = gcnew OperatingSystem( pID,ver ); + PlatformID platform = opSys->Platform; + Version^ version = opSys->Version; + Console::WriteLine( " Platform: {0,-15} Version: {1}", platform, version ); +} + +void BuildOperatingSystemObjects() +{ + + // The Version object does not need to correspond to an + // actual OS version. + Version^ verNull = gcnew Version; + Version^ verString = gcnew Version( "3.5.8.13" ); + Version^ verMajMin = gcnew Version( 6,10 ); + Version^ verMMBld = gcnew Version( 5,25,5025 ); + Version^ verMMBVer = gcnew Version( 5,6,7,8 ); + + // All PlatformID members are shown here. + BuildOSObj( PlatformID::Win32NT, verNull ); + BuildOSObj( PlatformID::Win32S, verString ); + BuildOSObj( PlatformID::Win32Windows, verMajMin ); + BuildOSObj( PlatformID::WinCE, verMMBld ); + BuildOSObj( PlatformID::Win32NT, verMMBVer ); +} + +int main() +{ + Console::WriteLine( "This example of OperatingSystem::Platform " + "and OperatingSystem::Version \n" + "generates the following output.\n" ); + Console::WriteLine( "Create several OperatingSystem objects " + "and display their properties:\n" ); + BuildOperatingSystemObjects(); + Console::WriteLine( "\nThe operating system of the host computer is:\n" ); + BuildOSObj( Environment::OSVersion->Platform, Environment::OSVersion->Version ); +} + +/* +This example of OperatingSystem::Platform and OperatingSystem::Version +generates the following output. + +Create several OperatingSystem objects and display their properties: + + Platform: Win32NT Version: 0.0 + Platform: Win32S Version: 3.5.8.13 + Platform: Win32Windows Version: 6.10 + Platform: WinCE Version: 5.25.5025 + Platform: Win32NT Version: 5.6.7.8 + +The operating system of the host computer is: + + Platform: Win32NT Version: 5.1.2600.0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp new file mode 100644 index 00000000000..cb05859164c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Ctor/CPP/ctor.cpp @@ -0,0 +1,95 @@ + +// +// Example of the Random class constructors and Random::NextDouble() +// method. +using namespace System; +using namespace System::Threading; + +// Generate random numbers from the specified Random object. +void RunIntNDoubleRandoms(Random^ randObj) +{ + + // Generate the first six random integers. + for (int j = 0; j < 6; j++) + Console::Write(" {0,10} ", randObj->Next()); + Console::WriteLine(); + + // Generate the first six random doubles. + for (int j = 0; j < 6; j++) + Console::Write(" {0:F8} ", randObj->NextDouble()); + Console::WriteLine(); +} + + +// Create a Random object with the specified seed. +void FixedSeedRandoms(int seed) +{ + Console::WriteLine("\nRandom numbers from a Random object with seed = {0}:", seed); + Random^ fixRand = gcnew Random(seed); + RunIntNDoubleRandoms(fixRand); +} + + +// Create a random object with a timer-generated seed. +void AutoSeedRandoms() +{ + + // Wait to allow the timer to advance. + Thread::Sleep(1); + Console::WriteLine("\nRandom numbers from a Random object " + "with an auto-generated seed:"); + Random^ autoRand = gcnew Random; + RunIntNDoubleRandoms(autoRand); +} + +int main() +{ + Console::WriteLine("This example of the Random class constructors and Random" + "::NextDouble() \ngenerates the following output.\n"); + Console::WriteLine("Create Random objects, and then generate and " + "display six integers and \nsix doubles from each."); + FixedSeedRandoms(123); + FixedSeedRandoms(123); + FixedSeedRandoms(456); + FixedSeedRandoms(456); + AutoSeedRandoms(); + AutoSeedRandoms(); + AutoSeedRandoms(); +} + +/* +This example of the Random class constructors and Random::NextDouble() +generates an output similar to the following: + +Create Random objects, and then generate and display six integers and +six doubles from each. + +Random numbers from a Random object with seed = 123: + 2114319875 1949518561 1596751841 1742987178 1586516133 103755708 + 0.01700087 0.14935942 0.19470390 0.63008947 0.90976122 0.49519146 + +Random numbers from a Random object with seed = 123: + 2114319875 1949518561 1596751841 1742987178 1586516133 103755708 + 0.01700087 0.14935942 0.19470390 0.63008947 0.90976122 0.49519146 + +Random numbers from a Random object with seed = 456: + 2044805024 1323311594 1087799997 1907260840 179380355 120870348 + 0.21988117 0.21026556 0.39236514 0.42420498 0.24102703 0.47310170 + +Random numbers from a Random object with seed = 456: + 2044805024 1323311594 1087799997 1907260840 179380355 120870348 + 0.21988117 0.21026556 0.39236514 0.42420498 0.24102703 0.47310170 + +Random numbers from a Random object with an auto-generated seed: + 1624372556 1894939458 302472229 588108304 23919954 1085111949 + 0.14595512 0.30162298 0.92267372 0.55707657 0.25430079 0.74143239 + +Random numbers from a Random object with an auto-generated seed: + 2105952511 1753605347 280739490 876793040 1129567796 524571616 + 0.62652210 0.31846701 0.15984073 0.24458755 0.62160607 0.54857684 + +Random numbers from a Random object with an auto-generated seed: + 440048819 1612271236 259006751 1165477776 87731991 2111514930 + 0.10708907 0.33531104 0.39700773 0.93209853 0.98891135 0.35572129 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp new file mode 100644 index 00000000000..167584f6cc6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next.cpp @@ -0,0 +1,99 @@ + +// +// Example of the Random::Next() methods. +using namespace System; + +// Generate random numbers with no bounds specified. +void NoBoundsRandoms(int seed) +{ + Console::WriteLine("\nRandom object, seed = {0}, no bounds:", seed); + Random^ randObj = gcnew Random(seed); + + // Generate six random integers from 0 to int.MaxValue. + for (int j = 0; j < 6; j++) + Console::Write("{0,11} ", randObj->Next()); + Console::WriteLine(); +} + + +// Generate random numbers with an upper bound specified. +void UpperBoundRandoms(int seed, int upper) +{ + Console::WriteLine("\nRandom object, seed = {0}, upper bound = {1}:", seed, upper); + Random^ randObj = gcnew Random(seed); + + // Generate six random integers from 0 to the upper bound. + for (int j = 0; j < 6; j++) + Console::Write("{0,11} ", randObj->Next(upper)); + Console::WriteLine(); +} + + +// Generate random numbers with both bounds specified. +void BothBoundsRandoms(int seed, int lower, int upper) +{ + Console::WriteLine("\nRandom object, seed = {0}, lower = {1}, upper = {2}:", seed, lower, upper); + Random^ randObj = gcnew Random(seed); + + // Generate six random integers from the lower to + // upper bounds. + for (int j = 0; j < 6; j++) + Console::Write("{0,11} ", randObj->Next(lower, upper)); + Console::WriteLine(); +} + +int main() +{ + Console::WriteLine("This example of the Random::Next() methods\n" + "generates the following output.\n"); + Console::WriteLine("Create Random objects all with the same seed and " + "generate\nsequences of numbers with different " + "bounds. Note the effect\nthat the various " + "combinations of bounds have on the sequences."); + NoBoundsRandoms(234); + UpperBoundRandoms(234, Int32::MaxValue); + UpperBoundRandoms(234, 2000000000); + UpperBoundRandoms(234, 200000000); + BothBoundsRandoms(234, 0, Int32::MaxValue); + BothBoundsRandoms(234, Int32::MinValue, Int32::MaxValue); + BothBoundsRandoms(234, -2000000000, 2000000000); + BothBoundsRandoms(234, -200000000, 200000000); + BothBoundsRandoms(234, -2000, 2000); +} + +/* +This example of the Random::Next() methods +generates the following output. + +Create Random objects all with the same seed and generate +sequences of numbers with different bounds. Note the effect +that the various combinations of bounds have on the sequences. + +Random object, seed = 234, no bounds: + 2091148258 1024955023 711273344 1081917183 1833298756 109460588 + +Random object, seed = 234, upper bound = 2147483647: + 2091148258 1024955023 711273344 1081917183 1833298756 109460588 + +Random object, seed = 234, upper bound = 2000000000: + 1947533580 954563751 662424922 1007613896 1707392518 101943116 + +Random object, seed = 234, upper bound = 200000000: + 194753358 95456375 66242492 100761389 170739251 10194311 + +Random object, seed = 234, lower = 0, upper = 2147483647: + 2091148258 1024955023 711273344 1081917183 1833298756 109460588 + +Random object, seed = 234, lower = -2147483648, upper = 2147483647: + 2034812868 -97573602 -724936960 16350718 1519113864 -1928562472 + +Random object, seed = 234, lower = -2000000000, upper = 2000000000: + 1895067160 -90872498 -675150156 15227793 1414785036 -1796113767 + +Random object, seed = 234, lower = -200000000, upper = 200000000: + 189506716 -9087250 -67515016 1522779 141478503 -179611377 + +Random object, seed = 234, lower = -2000, upper = 2000: + 1895 -91 -676 15 1414 -1797 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp new file mode 100644 index 00000000000..fad6b704dab --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next1.cpp @@ -0,0 +1,27 @@ +// +using namespace System; + +void main() +{ + Random^ rnd = gcnew Random(); + array^ malePetNames = { "Rufus", "Bear", "Dakota", "Fido", + "Vanya", "Samuel", "Koani", "Volodya", + "Prince", "Yiska" }; + array^ femalePetNames = { "Maggie", "Penny", "Saya", "Princess", + "Abby", "Laila", "Sadie", "Olivia", + "Starlight", "Talla" }; + + // Generate random indexes for pet names. + int mIndex = rnd->Next(malePetNames->Length); + int fIndex = rnd->Next(femalePetNames->Length); + + // Display the result. + Console::WriteLine("Suggested pet name of the day: "); + Console::WriteLine(" For a male: {0}", malePetNames[mIndex]); + Console::WriteLine(" For a female: {0}", femalePetNames[fIndex]); +} +// The example displays output similar to the following: +// Suggested pet name of the day: +// For a male: Koani +// For a female: Maggie +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp new file mode 100644 index 00000000000..6f5970848da --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next2.cpp @@ -0,0 +1,47 @@ +// +using namespace System; + +void main() +{ + Random^ rnd = gcnew Random(); + + Console::WriteLine("\n20 random integers from -100 to 100:"); + for (int ctr = 1; ctr <= 20; ctr++) + { + Console::Write("{0,6}", rnd->Next(-100, 101)); + if (ctr % 5 == 0) Console::WriteLine(); + } + + Console::WriteLine("\n20 random integers from 1000 to 10000:"); + for (int ctr = 1; ctr <= 20; ctr++) + { + Console::Write("{0,8}", rnd->Next(1000, 10001)); + if (ctr % 5 == 0) Console::WriteLine(); + } + + Console::WriteLine("\n20 random integers from 1 to 10:"); + for (int ctr = 1; ctr <= 20; ctr++) + { + Console::Write("{0,6}", rnd->Next(1, 11)); + if (ctr % 5 == 0) Console::WriteLine(); + } +} +// The example displays output similar to the following: +// 20 random integers from -100 to 100: +// 65 -95 -10 90 -35 +// -83 -16 -15 -19 41 +// -67 -93 40 12 62 +// -80 -95 67 -81 -21 +// +// 20 random integers from 1000 to 10000: +// 4857 9897 4405 6606 1277 +// 9238 9113 5151 8710 1187 +// 2728 9746 1719 3837 3736 +// 8191 6819 4923 2416 3028 +// +// 20 random integers from 1 to 10: +// 9 8 5 9 9 +// 9 1 2 3 8 +// 1 4 8 10 5 +// 9 7 9 10 5 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp new file mode 100644 index 00000000000..6f999eb0477 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next3.cpp @@ -0,0 +1,35 @@ +// +using namespace System; + +void main() +{ + Console::Write("Number of random numbers to generate: "); + String^ line = Console::ReadLine(); + unsigned int numbers = 0; + Random^ rnd = gcnew Random(); + + if (!UInt32::TryParse(line, numbers)) + numbers = 10; + + for (unsigned int ctr = 1; ctr <= numbers; ctr++) + Console::WriteLine("{0,15:N0}", rnd->Next()); +} +// The example displays output like the following when asked to generate +// 15 random numbers: +// Number of random numbers to generate: 15 +// 1,733,189,596 +// 566,518,090 +// 1,166,108,546 +// 1,931,426,514 +// 1,341,108,291 +// 1,012,698,049 +// 890,578,409 +// 1,377,589,722 +// 2,108,384,181 +// 1,532,939,448 +// 762,207,767 +// 815,074,920 +// 1,521,208,785 +// 1,950,436,671 +// 1,266,596,666 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp new file mode 100644 index 00000000000..9b547303cfa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Next/CPP/next4.cpp @@ -0,0 +1,27 @@ +// +using namespace System; + +void main() +{ + Random^ rnd = gcnew Random(); + array^ malePetNames = { "Rufus", "Bear", "Dakota", "Fido", + "Vanya", "Samuel", "Koani", "Volodya", + "Prince", "Yiska" }; + array^ femalePetNames = { "Maggie", "Penny", "Saya", "Princess", + "Abby", "Laila", "Sadie", "Olivia", + "Starlight", "Talla" }; + + // Generate random indexes for pet names. + int mIndex = rnd->Next(0, malePetNames->Length); + int fIndex = rnd->Next(0, femalePetNames->Length); + + // Display the result. + Console::WriteLine("Suggested pet name of the day: "); + Console::WriteLine(" For a male: {0}", malePetNames[mIndex]); + Console::WriteLine(" For a female: {0}", femalePetNames[fIndex]); +} +// The example displays the following output: +// Suggested pet name of the day: +// For a male: Koani +// For a female: Maggie +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp new file mode 100644 index 00000000000..9e0bb8434a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random.Sample/cpp/sampleex.cpp @@ -0,0 +1,149 @@ +// SampleEx.cpp : main project file. + +// +using namespace System; + +// This derived class converts the uniformly distributed random +// numbers generated by base.Sample() to another distribution. +public ref class RandomProportional : Random +{ + // The Sample method generates a distribution proportional to the value + // of the random numbers, in the range [0.0, 1.0]. +protected: + virtual double Sample() override + { + return Math::Sqrt(Random::Sample()); + } + +public: + RandomProportional() + {} + + virtual int Next() override + { + return (int) (Sample() * Int32::MaxValue); + } +}; + +int main(array ^args) +{ + const int rows = 4, cols = 6; + const int runCount = 1000000; + const int distGroupCount = 10; + const double intGroupSize = + ((double) Int32::MaxValue + 1.0) / (double)distGroupCount; + + RandomProportional ^randObj = gcnew RandomProportional(); + + array^ intCounts = gcnew array(distGroupCount); + array^ realCounts = gcnew array(distGroupCount); + + Console::WriteLine( + "\nThe derived RandomProportional class overrides " + + "the Sample method to \ngenerate random numbers " + + "in the range [0.0, 1.0]. The distribution \nof " + + "the numbers is proportional to their numeric values. " + + "For example, \nnumbers are generated in the " + + "vicinity of 0.75 with three times the \n" + + "probability of those generated near 0.25."); + Console::WriteLine( + "\nRandom doubles generated with the NextDouble() " + + "method:\n"); + + // Generate and display [rows * cols] random doubles. + for (int i = 0; i < rows; i++) + { + for (int j = 0; j < cols; j++) + Console::Write("{0,12:F8}", randObj->NextDouble()); + Console::WriteLine(); + } + + Console::WriteLine( + "\nRandom integers generated with the Next() " + + "method:\n"); + + // Generate and display [rows * cols] random integers. + for (int i = 0; i < rows; i++) + { + for (int j = 0; j < cols; j++) + Console::Write("{0,12}", randObj->Next()); + Console::WriteLine(); + } + + Console::WriteLine( + "\nTo demonstrate the proportional distribution, " + + "{0:N0} random \nintegers and doubles are grouped " + + "into {1} equal value ranges. This \n" + + "is the count of values in each range:\n", + runCount, distGroupCount); + Console::WriteLine( + "{0,21}{1,10}{2,20}{3,10}", "Integer Range", + "Count", "Double Range", "Count"); + Console::WriteLine( + "{0,21}{1,10}{2,20}{3,10}", "-------------", + "-----", "------------", "-----"); + + // Generate random integers and doubles, and then count + // them by group. + for (int i = 0; i < runCount; i++) + { + intCounts[ (int)((double)randObj->Next() / + intGroupSize) ]++; + realCounts[ (int)(randObj->NextDouble() * + (double)distGroupCount) ]++; + } + + // Display the count of each group. + for (int i = 0; i < distGroupCount; i++) + Console::WriteLine( + "{0,10}-{1,10}{2,10:N0}{3,12:N5}-{4,7:N5}{5,10:N0}", + (int)((double)i * intGroupSize), + (int)((double)(i + 1) * intGroupSize - 1.0), + intCounts[ i ], + ((double)i) / (double)distGroupCount, + ((double)(i + 1)) / (double)distGroupCount, + realCounts[ i ]); + return 0; +} + +/* +This example of Random.Sample() displays output similar to the following: + + The derived RandomProportional class overrides the Sample method to + generate random numbers in the range [0.0, 1.0). The distribution + of the numbers is proportional to the number values. For example, + numbers are generated in the vicinity of 0.75 with three times the + probability of those generated near 0.25. + + Random doubles generated with the NextDouble() method: + + 0.59455719 0.17589882 0.83134398 0.35795862 0.91467727 0.54022658 + 0.93716947 0.54817519 0.94685080 0.93705478 0.18582318 0.71272428 + 0.77708682 0.95386216 0.70412393 0.86099417 0.08275804 0.79108316 + 0.71019941 0.84205103 0.41685082 0.58186880 0.89492302 0.73067715 + + Random integers generated with the Next() method: + + 1570755704 1279192549 1747627711 1705700211 1372759203 1849655615 + 2046235980 1210843924 1554274149 1307936697 1480207570 1057595022 + 337854215 844109928 2028310798 1386669369 2073517658 1291729809 + 1537248240 1454198019 1934863511 1640004334 2032620207 534654791 + + To demonstrate the proportional distribution, 1,000,000 random + integers and doubles are grouped into 10 equal value ranges. This + is the count of values in each range: + + Integer Range Count Double Range Count + ------------- ----- ------------ ----- + 0- 214748363 10,079 0.00000-0.10000 10,148 + 214748364- 429496728 29,835 0.10000-0.20000 29,849 + 429496729- 644245093 49,753 0.20000-0.30000 49,948 + 644245094- 858993458 70,325 0.30000-0.40000 69,656 + 858993459-1073741823 89,906 0.40000-0.50000 90,337 + 1073741824-1288490187 109,868 0.50000-0.60000 110,225 + 1288490188-1503238552 130,388 0.60000-0.70000 129,986 + 1503238553-1717986917 149,231 0.70000-0.80000 150,428 + 1717986918-1932735282 170,234 0.80000-0.90000 169,610 + 1932735283-2147483647 190,381 0.90000-1.00000 189,813 +*/ +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp new file mode 100644 index 00000000000..8fba2211c96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Random/cpp/random2.cpp @@ -0,0 +1,54 @@ +// +using namespace System; + +void main() +{ + // Instantiate random number generator using system-supplied value as seed. + Random^ rand = gcnew Random(); + // Generate and display 5 random byte (integer) values. + array^ bytes = gcnew array(4); + rand->NextBytes(bytes); + Console::WriteLine("Five random byte values:"); + for each (Byte byteValue in bytes) + Console::Write("{0, 5}", byteValue); + Console::WriteLine(); + // Generate and display 5 random integers. + Console::WriteLine("Five random integer values:"); + for (int ctr = 0; ctr <= 4; ctr++) + Console::Write("{0,15:N0}", rand->Next()); + Console::WriteLine(); + // Generate and display 5 random integers between 0 and 100.// + Console::WriteLine("Five random integers between 0 and 100:"); + for (int ctr = 0; ctr <= 4; ctr++) + Console::Write("{0,8:N0}", rand->Next(101)); + Console::WriteLine(); + // Generate and display 5 random integers from 50 to 100. + Console::WriteLine("Five random integers between 50 and 100:"); + for (int ctr = 0; ctr <= 4; ctr++) + Console::Write("{0,8:N0}", rand->Next(50, 101)); + Console::WriteLine(); + // Generate and display 5 random floating point values from 0 to 1. + Console::WriteLine("Five Doubles."); + for (int ctr = 0; ctr <= 4; ctr++) + Console::Write("{0,8:N3}", rand->NextDouble()); + Console::WriteLine(); + // Generate and display 5 random floating point values from 0 to 5. + Console::WriteLine("Five Doubles between 0 and 5."); + for (int ctr = 0; ctr <= 4; ctr++) + Console::Write("{0,8:N3}", rand->NextDouble() * 5); +} +// The example displays output like the following: +// Five random byte values: +// 194 185 239 54 116 +// Five random integer values: +// 507,353,531 1,509,532,693 2,125,074,958 1,409,512,757 652,767,128 +// Five random integers between 0 and 100: +// 16 78 94 79 52 +// Five random integers between 50 and 100: +// 56 66 96 60 65 +// Five Doubles. +// 0.943 0.108 0.744 0.563 0.415 +// Five Doubles between 0 and 5. +// 2.934 3.130 0.292 1.432 4.369 +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp new file mode 100644 index 00000000000..44abeeae6c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Refelction.Emit.MethodBuilder.CreateMethodBody Example/CPP/source.cpp @@ -0,0 +1,56 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +class MethodBodyDemo +{ +public: + + // This class will demonstrate how to create a method body using + // the MethodBuilder::CreateMethodBody(Byte[], int) method. + static Type^ BuildDynType() + { + Type^ addType = nullptr; + AppDomain^ currentDom = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBldr = currentDom->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + + // The dynamic assembly space has been created. Next, create a module + // within it. The type Point will be reflected into this module. + ModuleBuilder^ myModuleBldr = myAsmBldr->DefineDynamicModule( "MyModule" ); + TypeBuilder^ myTypeBldr = myModuleBldr->DefineType( "Adder" ); + array^temp0 = {int::typeid,int::typeid}; + MethodBuilder^ myMthdBldr = myTypeBldr->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, temp0 ); + + // Build the array of Bytes holding the MSIL instructions. + + /* 02h is the opcode for ldarg.0 */ + /* 03h is the opcode for ldarg.1 */ + /* 58h is the opcode for add */ + /* 2Ah is the opcode for ret */ + array^temp1 = {0x02,0x03,0x58,0x2A}; + array^ILcodes = temp1; + myMthdBldr->CreateMethodBody( ILcodes, ILcodes->Length ); + addType = myTypeBldr->CreateType(); + return addType; + } + +}; + +int main() +{ + Type^ myType = MethodBodyDemo::BuildDynType(); + Console::WriteLine( "---" ); + Console::Write( "Enter the first integer to add: " ); + int aVal = Convert::ToInt32( Console::ReadLine() ); + Console::Write( "Enter the second integer to add: " ); + int bVal = Convert::ToInt32( Console::ReadLine() ); + Object^ adderInst = Activator::CreateInstance( myType, gcnew array(0) ); + array^temp1 = {aVal,bVal}; + Console::WriteLine( "The value of adding {0} to {1} is: {2}.", aVal, bVal, myType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, adderInst, temp1 ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp new file mode 100644 index 00000000000..bd325cd3b40 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/GetAssembly1.cpp @@ -0,0 +1,19 @@ +// +using namespace System; +using namespace System::Reflection; + +void main() +{ + // Get a Type object. + Type^ t = int::typeid; + // Instantiate an Assembly class to the assembly housing the Integer type. + Assembly^ assem = Assembly::GetAssembly(t); + // Display the name of the assembly. + Console::WriteLine("Name: {0}", assem->FullName); + // Get the location of the assembly using the file: protocol. + Console::WriteLine("CodeBase: {0}", assem->CodeBase); +} +// The example displays output like the following: +// Name: mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 +// CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp new file mode 100644 index 00000000000..21eed0e53a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/assembly.cpp @@ -0,0 +1,182 @@ +using namespace System; +using namespace System::Reflection; +using namespace System::Collections; + +void Snippet1() +{ + Assembly^ SampleAssembly; + // Instantiate a target object. + Int32 Integer1(0); + Type^ Type1; + // Set the Type instance to the target class type. + Type1 = Integer1.GetType(); + // Instantiate an Assembly class to the assembly housing the Integer type. + SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); + // Gets the location of the assembly using file: protocol. + Console::WriteLine( "CodeBase= {0}", SampleAssembly->CodeBase ); +} +void Snippet2() +{ + // + Assembly^ SampleAssembly; + // Instantiate a target object. + Int32 Integer1(0); + Type^ Type1; + // Set the Type instance to the target class type. + Type1 = Integer1.GetType(); + // Instantiate an Assembly class to the assembly housing the Integer type. + SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); + // Write the display name of assembly including base name and version. + Console::WriteLine( "FullName= {0}", SampleAssembly->FullName ); + // The example displays the following output: + // FullName=mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + // +} +void Snippet3() +{ + // + Assembly^ SampleAssembly; + // Instantiate a target object. + Int32 Integer1(0); + Type^ Type1; + // Set the Type instance to the target class type. + Type1 = Integer1.GetType(); + // Instantiate an Assembly class to the assembly housing the Integer type. + SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); + // Display the physical location of the assembly containing the manifest. + Console::WriteLine( "Location= {0}", SampleAssembly->Location ); + // The example displays the following output: + // Location=C:\Windows\Microsoft.NET\Framework64\v4.0.30319\mscorlib.dll + // +} + +void Snippet5() +{ + // + Assembly^ SampleAssembly; + // Instantiate a target object. + Int32 Integer1(0); + Type^ Type1; + // Set the Type instance to the target class type. + Type1 = Integer1.GetType(); + // Instantiate an Assembly class to the assembly housing the Integer type. + SampleAssembly = Assembly::GetAssembly( Integer1.GetType() ); + // Display the name of the assembly currently executing + Console::WriteLine( "GetExecutingAssembly= {0}", Assembly::GetExecutingAssembly()->FullName ); + // The example displays the following output: + // GetExecutingAssembly=assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null + // +} +void Snippet6() +{ + // + Assembly^ SampleAssembly; + // Load the assembly by providing the location of the assembly file. + SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); + for each ( Type^ ExportedType in SampleAssembly->GetExportedTypes() ) + { + Console::WriteLine( ExportedType ); + } + // +} +void Snippet7() +{ + // + Assembly^ SampleAssembly; + // Load the assembly by providing the type name. + SampleAssembly = Assembly::Load( "MyAssembly" ); + for each ( String^ Resource in SampleAssembly->GetManifestResourceNames() ) + { + Console::WriteLine( Resource ); + } + // +} +void Snippet8() +{ + // + Assembly^ SampleAssembly; + SampleAssembly = Assembly::Load( "System.Data" ); + array^ Types = SampleAssembly->GetTypes(); + for each ( Type^ oType in Types ) + { + Console::WriteLine( oType->Name ); + } + // +} +void Snippet9() +{ + // + Assembly^ SampleAssembly; + SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); + + // Obtain a reference to the first class contained in the assembly. + Type^ oType = SampleAssembly->GetTypes()[ 0 ]; + // Obtain a reference to the public properties of the type. + array^ Props = oType->GetProperties(); + // Display information about public properties of assembly type. + // Prop = Prop1 + // DeclaringType = Sample::Assembly.Class1 + // Type = System::String + // Readable = True + // Writable = False + for each ( PropertyInfo^ Prop in Props ) + { + Console::WriteLine( "Prop= {0}", Prop->Name ); + Console::WriteLine( " DeclaringType= {0}", Prop->DeclaringType ); + Console::WriteLine( " Type= {0}", Prop->PropertyType ); + Console::WriteLine( " Readable= {0}", Prop->CanRead ); + Console::WriteLine( " Writable= {0}", Prop->CanWrite ); + } + // +} +void Snippet10() +{ + // + Assembly^ SampleAssembly; + SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); + array^ Methods = SampleAssembly->GetTypes()[ 0 ]->GetMethods(); + // Obtain a reference to the method members + for each ( MethodInfo^ Method in Methods ) + { + Console::WriteLine( "Method Name= {0}", Method->Name ); + } + // +} +void Snippet11() +{ + // + Assembly^ SampleAssembly; + SampleAssembly = Assembly::LoadFrom( "c:\\Sample.Assembly.dll" ); + // Obtain a reference to a method known to exist in assembly. + MethodInfo^ Method = SampleAssembly->GetTypes()[ 0 ]->GetMethod( "Method1" ); + // Obtain a reference to the parameters collection of the MethodInfo instance. + array^ Params = Method->GetParameters(); + // Display information about method parameters. + // Param = sParam1 + // Type = System::String + // Position = 0 + // Optional=False + for each ( ParameterInfo^ Param in Params ) + { + Console::WriteLine( "Param= {0}", Param->Name ); + Console::WriteLine( " Type= {0}", Param->ParameterType ); + Console::WriteLine( " Position= {0}", Param->Position ); + Console::WriteLine( " Optional= {0}", Param->IsOptional ); + } + // + Console::ReadLine(); +} + +void main() +{ + Snippet1(); + Snippet2(); + Snippet3(); + Snippet5(); + Snippet6(); + Snippet7(); + Snippet8(); + Snippet9(); + Snippet10(); + Snippet11(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp new file mode 100644 index 00000000000..3c54fa6e1c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/codebase1.cpp @@ -0,0 +1,16 @@ +// +using namespace System; +using namespace System::Reflection; + +void main() +{ + // Instantiate a target object. + int integer1 = 1632; + // Instantiate an Assembly class to the assembly housing the Integer type. + Assembly^ systemAssembly = integer1.GetType()->Assembly; + // Get the location of the assembly using the file: protocol. + Console::WriteLine("CodeBase = {0}", systemAssembly->CodeBase); +} +// The example displays output like the following: +// CodeBase = file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp new file mode 100644 index 00000000000..a109f1df474 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Assembly/CPP/getcallingassembly1.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Reflection; + +void main() +{ + // Instantiate a target object. + Int32 integer1 = 0; + // Set the Type instance to the target class type. + Type^ type1 = integer1.GetType(); + // Instantiate an Assembly class to the assembly housing the Integer type. + Assembly^ sampleAssembly = Assembly::GetAssembly(integer1.GetType()); + // Display the name of the assembly that is calling the method. + Console::WriteLine("GetCallingAssembly = {0}", Assembly::GetCallingAssembly()->FullName); +} +// The example displays output like the following: +// GetCallingAssembly = Example, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp new file mode 100644 index 00000000000..ba2e35bfbb6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit ILGenerator Example/CPP/source.cpp @@ -0,0 +1,137 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ DynamicDotProductGen() +{ + Type^ ivType = nullptr; + array^temp0 = {int::typeid,int::typeid,int::typeid}; + array^ctorParams = temp0; + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "IntVectorAsm"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ IntVectorModule = myAsmBuilder->DefineDynamicModule( "IntVectorModule", "Vector.dll" ); + TypeBuilder^ ivTypeBld = IntVectorModule->DefineType( "IntVector", TypeAttributes::Public ); + FieldBuilder^ xField = ivTypeBld->DefineField( "x", int::typeid, FieldAttributes::Private ); + FieldBuilder^ yField = ivTypeBld->DefineField( "y", int::typeid, FieldAttributes::Private ); + FieldBuilder^ zField = ivTypeBld->DefineField( "z", int::typeid, FieldAttributes::Private ); + Type^ objType = Type::GetType( "System.Object" ); + ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); + ConstructorBuilder^ ivCtor = ivTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); + ILGenerator^ ctorIL = ivCtor->GetILGenerator(); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Call, objCtor ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_1 ); + ctorIL->Emit( OpCodes::Stfld, xField ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_2 ); + ctorIL->Emit( OpCodes::Stfld, yField ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_3 ); + ctorIL->Emit( OpCodes::Stfld, zField ); + ctorIL->Emit( OpCodes::Ret ); + + // This method will find the dot product of the stored vector + // with another. + array^temp1 = {ivTypeBld}; + array^dpParams = temp1; + + // Here, you create a MethodBuilder containing the + // name, the attributes (public, static, private, and so on), + // the return type (int, in this case), and a array of Type + // indicating the type of each parameter. Since the sole parameter + // is a IntVector, the very class you're creating, you will + // pass in the TypeBuilder (which is derived from Type) instead of + // a Type object for IntVector, avoiding an exception. + // -- This method would be declared in C# as: + // public int DotProduct(IntVector aVector) + MethodBuilder^ dotProductMthd = ivTypeBld->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, dpParams ); + + // A ILGenerator can now be spawned, attached to the MethodBuilder. + ILGenerator^ mthdIL = dotProductMthd->GetILGenerator(); + + // Here's the body of our function, in MSIL form. We're going to find the + // "dot product" of the current vector instance with the passed vector + // instance. For reference purposes, the equation is: + // (x1 * x2) + (y1 * y2) + (z1 * z2) = the dot product + // First, you'll load the reference to the current instance "this" + // stored in argument 0 (ldarg.0) onto the stack. Ldfld, the subsequent + // instruction, will pop the reference off the stack and look up the + // field "x", specified by the FieldInfo token "xField". + mthdIL->Emit( OpCodes::Ldarg_0 ); + mthdIL->Emit( OpCodes::Ldfld, xField ); + + // That completed, the value stored at field "x" is now atop the stack. + // Now, you'll do the same for the Object reference we passed as a + // parameter, stored in argument 1 (ldarg.1). After Ldfld executed, + // you'll have the value stored in field "x" for the passed instance + // atop the stack. + mthdIL->Emit( OpCodes::Ldarg_1 ); + mthdIL->Emit( OpCodes::Ldfld, xField ); + + // There will now be two values atop the stack - the "x" value for the + // current vector instance, and the "x" value for the passed instance. + // You'll now multiply them, and push the result onto the evaluation stack. + mthdIL->Emit( OpCodes::Mul_Ovf_Un ); + + // Now, repeat this for the "y" fields of both vectors. + mthdIL->Emit( OpCodes::Ldarg_0 ); + mthdIL->Emit( OpCodes::Ldfld, yField ); + mthdIL->Emit( OpCodes::Ldarg_1 ); + mthdIL->Emit( OpCodes::Ldfld, yField ); + mthdIL->Emit( OpCodes::Mul_Ovf_Un ); + + // At this time, the results of both multiplications should be atop + // the stack. You'll now add them and push the result onto the stack. + mthdIL->Emit( OpCodes::Add_Ovf_Un ); + + // Multiply both "z" field and push the result onto the stack. + mthdIL->Emit( OpCodes::Ldarg_0 ); + mthdIL->Emit( OpCodes::Ldfld, zField ); + mthdIL->Emit( OpCodes::Ldarg_1 ); + mthdIL->Emit( OpCodes::Ldfld, zField ); + mthdIL->Emit( OpCodes::Mul_Ovf_Un ); + + // Finally, add the result of multiplying the "z" fields with the + // result of the earlier addition, and push the result - the dot product - + // onto the stack. + mthdIL->Emit( OpCodes::Add_Ovf_Un ); + + // The "ret" opcode will pop the last value from the stack and return it + // to the calling method. You're all done! + mthdIL->Emit( OpCodes::Ret ); + ivType = ivTypeBld->CreateType(); + return ivType; +} + +int main() +{ + Type^ IVType = nullptr; + Object^ aVector1 = nullptr; + Object^ aVector2 = nullptr; + array^temp2 = {int::typeid,int::typeid,int::typeid}; + array^aVtypes = temp2; + array^temp3 = {10,10,10}; + array^aVargs1 = temp3; + array^temp4 = {20,20,20}; + array^aVargs2 = temp4; + + // Call the method to build our dynamic class. + IVType = DynamicDotProductGen(); + Console::WriteLine( "---" ); + ConstructorInfo^ myDTctor = IVType->GetConstructor( aVtypes ); + aVector1 = myDTctor->Invoke( aVargs1 ); + aVector2 = myDTctor->Invoke( aVargs2 ); + array^passMe = gcnew array(1); + passMe[ 0 ] = dynamic_cast(aVector2); + Console::WriteLine( "(10, 10, 10) . (20, 20, 20) = {0}", IVType->InvokeMember( "DotProduct", BindingFlags::InvokeMethod, nullptr, aVector1, passMe ) ); +} + +// +++ OUTPUT +++ +// --- +// (10, 10, 10) . (20, 20, 20) = 600 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp new file mode 100644 index 00000000000..210c6ee6489 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.AddResourceFile Example/CPP/source.cpp @@ -0,0 +1,65 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +ref class AsmBuilderGetFileDemo +{ +public: + static String^ myResourceFileName = "MyResource.txt"; + static FileInfo^ CreateResourceFile() + { + FileInfo^ f = gcnew FileInfo( myResourceFileName ); + StreamWriter^ sw = f->CreateText(); + sw->WriteLine( "Hello, world!" ); + sw->Close(); + return f; + } + + static AssemblyBuilder^ BuildDynAssembly() + { + String^ myAsmFileName = "MyAsm.dll"; + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + myAsmBuilder->AddResourceFile( "MyResource", myResourceFileName ); + + // To confirm that the resource file has been added to the manifest, + // we will save the assembly as MyAsm.dll. You can view the manifest + // and confirm the presence of the resource file by running + // "ildasm MyAsm.dll" from the prompt in the directory where you executed + // the compiled code. + myAsmBuilder->Save( myAsmFileName ); + return myAsmBuilder; + } + +}; + +int main() +{ + FileStream^ myResourceFS = nullptr; + AsmBuilderGetFileDemo::CreateResourceFile(); + Console::WriteLine( "The contents of MyResource.txt, via GetFile:" ); + AssemblyBuilder^ myAsm = AsmBuilderGetFileDemo::BuildDynAssembly(); + try + { + myResourceFS = myAsm->GetFile( AsmBuilderGetFileDemo::myResourceFileName ); + } + catch ( NotSupportedException^ ) + { + Console::WriteLine( "---" ); + Console::WriteLine( "System::Reflection::Emit::AssemblyBuilder::GetFile\nis not supported in this SDK build." ); + Console::WriteLine( "The file data will now be retrieved directly, via a new FileStream." ); + Console::WriteLine( "---" ); + myResourceFS = gcnew FileStream( AsmBuilderGetFileDemo::myResourceFileName,FileMode::Open ); + } + + StreamReader^ sr = gcnew StreamReader( myResourceFS,System::Text::Encoding::ASCII ); + Console::WriteLine( sr->ReadToEnd() ); + sr->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp new file mode 100644 index 00000000000..90c18c11fa1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.DefineDynamicModule Example/CPP/source.cpp @@ -0,0 +1,71 @@ +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +class TypeBuilderMemberDemo +{ +public: + static void DefineDynamicModuleDemo1() + { + // + AppDomain^ myAppDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyAssembly"; + AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( + myAsmName, AssemblyBuilderAccess::Run ); + + // Create a transient dynamic module. Since no DLL name is specified with + // this constructor, it cannot be saved. + ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( "MyModule1" ); + // + } + + static void DefineDynamicModuleDemo2() + { + // + AppDomain^ myAppDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyAssembly"; + AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( + myAsmName, AssemblyBuilderAccess::Run ); + + // Create a transient dynamic module. Since no DLL name is specified with + // this constructor, it can not be saved. By specifying the second parameter + // of the constructor as false, we can suppress the emission of symbol info. + ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( + "MyModule2", false ); + // + } + + static void DefineDynamicModuleDemo3() + { + // + AppDomain^ myAppDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyAssembly"; + AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( + myAsmName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module that can be saved as the specified DLL name. + ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( + "MyModule3", "MyModule3.dll" ); + // + } + + static void DefineDynamicModuleDemo4() + { + // + AppDomain^ myAppDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyAssembly"; + AssemblyBuilder^ myAsmBuilder = myAppDomain->DefineDynamicAssembly( + myAsmName, AssemblyBuilderAccess::Run ); + + // Create a dynamic module that can be saved as the specified DLL name. By + // specifying the third parameter as true, we can allow the emission of symbol info. + ModuleBuilder^ myModuleBuilder = myAsmBuilder->DefineDynamicModule( + "MyModule4", "MyModule4.dll", true ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp new file mode 100644 index 00000000000..7ecadcfc345 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.AssemblyBuilder.Save Example/CPP/source.cpp @@ -0,0 +1,236 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// The Point class is the class we will reflect on and copy into our +// dynamic assembly. The public static function PointMain() will be used +// as our entry point. +// +// We are constructing the type seen here dynamically, and will write it +// out into a .exe file for later execution from the command-line. +// --- +// __gc class Point { +// +// private: +// int x; +// int y; +// +// public: +// Point(int ix, int iy) { +// +// this->x = ix; +// this->y = iy; +// +// } +// +// int DotProduct (Point* p) { +// +// return ((this->x * p->x) + (this->y * p->y)); +// +// } +// +// static void PointMain() { +// +// Console::Write(S"Enter the 'x' value for point 1: "); +// int x1 = Convert::ToInt32(Console::ReadLine()); +// +// Console::Write(S"Enter the 'y' value for point 1: "); +// int y1 = Convert::ToInt32(Console::ReadLine()); +// +// Console::Write(S"Enter the 'x' value for point 2: "); +// int x2 = Convert::ToInt32(Console::ReadLine()); +// +// Console::Write(S"Enter the 'y' value for point 2: "); +// int y2 = Convert::ToInt32(Console::ReadLine()); +// +// Point* p1 = new Point(x1, y1); +// Point* p2 = new Point(x2, y2); +// +// Console::WriteLine(S"( {0}, {1}) . ( {2}, {3}) = {4}.", +// __box(x1), __box(y1), __box(x2), __box(y2), p1->DotProduct(p2)); +// +// } +// +// }; +// --- +Type^ BuildDynAssembly() +{ + Type^ pointType = nullptr; + AppDomain^ currentDom = Thread::GetDomain(); + Console::Write( "Please enter a name for your new assembly: " ); + StringBuilder^ asmFileNameBldr = gcnew StringBuilder; + asmFileNameBldr->Append( Console::ReadLine() ); + asmFileNameBldr->Append( ".exe" ); + String^ asmFileName = asmFileNameBldr->ToString(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBldr = currentDom->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + + // We've created a dynamic assembly space - now, we need to create a module + // within it to reflect the type Point into. + ModuleBuilder^ myModuleBldr = myAsmBldr->DefineDynamicModule( asmFileName, asmFileName ); + TypeBuilder^ myTypeBldr = myModuleBldr->DefineType( "Point" ); + FieldBuilder^ xField = myTypeBldr->DefineField( "x", int::typeid, FieldAttributes::Private ); + FieldBuilder^ yField = myTypeBldr->DefineField( "y", int::typeid, FieldAttributes::Private ); + + // Build the constructor. + Type^ objType = Type::GetType( "System.Object" ); + ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); + array^temp4 = {int::typeid,int::typeid}; + array^ctorParams = temp4; + ConstructorBuilder^ pointCtor = myTypeBldr->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); + ILGenerator^ ctorIL = pointCtor->GetILGenerator(); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Call, objCtor ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_1 ); + ctorIL->Emit( OpCodes::Stfld, xField ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_2 ); + ctorIL->Emit( OpCodes::Stfld, yField ); + ctorIL->Emit( OpCodes::Ret ); + + // Build the DotProduct method. + Console::WriteLine( "Constructor built." ); + array^temp0 = {myTypeBldr}; + MethodBuilder^ pointDPBldr = myTypeBldr->DefineMethod( "DotProduct", MethodAttributes::Public, int::typeid, temp0 ); + ILGenerator^ dpIL = pointDPBldr->GetILGenerator(); + dpIL->Emit( OpCodes::Ldarg_0 ); + dpIL->Emit( OpCodes::Ldfld, xField ); + dpIL->Emit( OpCodes::Ldarg_1 ); + dpIL->Emit( OpCodes::Ldfld, xField ); + dpIL->Emit( OpCodes::Mul_Ovf_Un ); + dpIL->Emit( OpCodes::Ldarg_0 ); + dpIL->Emit( OpCodes::Ldfld, yField ); + dpIL->Emit( OpCodes::Ldarg_1 ); + dpIL->Emit( OpCodes::Ldfld, yField ); + dpIL->Emit( OpCodes::Mul_Ovf_Un ); + dpIL->Emit( OpCodes::Add_Ovf_Un ); + dpIL->Emit( OpCodes::Ret ); + + // Build the PointMain method. + Console::WriteLine( "DotProduct built." ); + MethodBuilder^ pointMainBldr = myTypeBldr->DefineMethod( "PointMain", static_cast(MethodAttributes::Public | MethodAttributes::Static), void::typeid, nullptr ); + pointMainBldr->InitLocals = true; + ILGenerator^ pmIL = pointMainBldr->GetILGenerator(); + + // We have four methods that we wish to call, and must represent as + // MethodInfo tokens: + // - void Console::WriteLine(String*) + // - String* Console::ReadLine() + // - int Convert::Int32(String*) + // - void Console::WriteLine(String*, Object*[]) + array^temp1 = {String::typeid}; + MethodInfo^ writeMI = Console::typeid->GetMethod( "Write", temp1 ); + MethodInfo^ readLineMI = Console::typeid->GetMethod( "ReadLine", gcnew array(0) ); + array^temp2 = {String::typeid}; + MethodInfo^ convertInt32MI = Convert::typeid->GetMethod( "ToInt32", temp2 ); + array^temp5 = {String::typeid,array::typeid}; + array^wlParams = temp5; + MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", wlParams ); + + // Although we could just refer to the local variables by + // index (short ints for Ldloc/Stloc, bytes for LdLoc_S/Stloc_S), + // this time, we'll use LocalBuilders for clarity and to + // demonstrate their usage and syntax. + LocalBuilder^ x1LB = pmIL->DeclareLocal( int::typeid ); + LocalBuilder^ y1LB = pmIL->DeclareLocal( int::typeid ); + LocalBuilder^ x2LB = pmIL->DeclareLocal( int::typeid ); + LocalBuilder^ y2LB = pmIL->DeclareLocal( int::typeid ); + LocalBuilder^ point1LB = pmIL->DeclareLocal( myTypeBldr ); + LocalBuilder^ point2LB = pmIL->DeclareLocal( myTypeBldr ); + LocalBuilder^ tempObjArrLB = pmIL->DeclareLocal( array::typeid ); + pmIL->Emit( OpCodes::Ldstr, "Enter the 'x' value for point 1: " ); + pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); + pmIL->Emit( OpCodes::Stloc, x1LB ); + pmIL->Emit( OpCodes::Ldstr, "Enter the 'y' value for point 1: " ); + pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); + pmIL->Emit( OpCodes::Stloc, y1LB ); + pmIL->Emit( OpCodes::Ldstr, "Enter the 'x' value for point 2: " ); + pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); + pmIL->Emit( OpCodes::Stloc, x2LB ); + pmIL->Emit( OpCodes::Ldstr, "Enter the 'y' value for point 2: " ); + pmIL->EmitCall( OpCodes::Call, writeMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, readLineMI, nullptr ); + pmIL->EmitCall( OpCodes::Call, convertInt32MI, nullptr ); + pmIL->Emit( OpCodes::Stloc, y2LB ); + pmIL->Emit( OpCodes::Ldloc, x1LB ); + pmIL->Emit( OpCodes::Ldloc, y1LB ); + pmIL->Emit( OpCodes::Newobj, pointCtor ); + pmIL->Emit( OpCodes::Stloc, point1LB ); + pmIL->Emit( OpCodes::Ldloc, x2LB ); + pmIL->Emit( OpCodes::Ldloc, y2LB ); + pmIL->Emit( OpCodes::Newobj, pointCtor ); + pmIL->Emit( OpCodes::Stloc, point2LB ); + pmIL->Emit( OpCodes::Ldstr, "( {0}, {1}) . ( {2}, {3}) = {4}." ); + pmIL->Emit( OpCodes::Ldc_I4_5 ); + pmIL->Emit( OpCodes::Newarr, Object::typeid ); + pmIL->Emit( OpCodes::Stloc, tempObjArrLB ); + pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); + pmIL->Emit( OpCodes::Ldc_I4_0 ); + pmIL->Emit( OpCodes::Ldloc, x1LB ); + pmIL->Emit( OpCodes::Box, int::typeid ); + pmIL->Emit( OpCodes::Stelem_Ref ); + pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); + pmIL->Emit( OpCodes::Ldc_I4_1 ); + pmIL->Emit( OpCodes::Ldloc, y1LB ); + pmIL->Emit( OpCodes::Box, int::typeid ); + pmIL->Emit( OpCodes::Stelem_Ref ); + pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); + pmIL->Emit( OpCodes::Ldc_I4_2 ); + pmIL->Emit( OpCodes::Ldloc, x2LB ); + pmIL->Emit( OpCodes::Box, int::typeid ); + pmIL->Emit( OpCodes::Stelem_Ref ); + pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); + pmIL->Emit( OpCodes::Ldc_I4_3 ); + pmIL->Emit( OpCodes::Ldloc, y2LB ); + pmIL->Emit( OpCodes::Box, int::typeid ); + pmIL->Emit( OpCodes::Stelem_Ref ); + pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); + pmIL->Emit( OpCodes::Ldc_I4_4 ); + pmIL->Emit( OpCodes::Ldloc, point1LB ); + pmIL->Emit( OpCodes::Ldloc, point2LB ); + pmIL->EmitCall( OpCodes::Callvirt, pointDPBldr, nullptr ); + pmIL->Emit( OpCodes::Box, int::typeid ); + pmIL->Emit( OpCodes::Stelem_Ref ); + pmIL->Emit( OpCodes::Ldloc, tempObjArrLB ); + pmIL->EmitCall( OpCodes::Call, writeLineMI, nullptr ); + pmIL->Emit( OpCodes::Ret ); + Console::WriteLine( "PointMain (entry point) built." ); + pointType = myTypeBldr->CreateType(); + Console::WriteLine( "Type completed." ); + myAsmBldr->SetEntryPoint( pointMainBldr ); + myAsmBldr->Save( asmFileName ); + Console::WriteLine( "Assembly saved as ' {0}'.", asmFileName ); + Console::WriteLine( "Type ' {0}' at the prompt to run your new dynamically generated dot product calculator.", asmFileName ); + + // After execution, this program will have generated and written to disk, + // in the directory you executed it from, a program named + // .exe. You can run it by typing + // the name you gave it during execution, in the same directory where + // you executed this program. + return pointType; +} + +int main() +{ + Type^ myType = BuildDynAssembly(); + Console::WriteLine( "---" ); + + // Let's invoke the type 'Point' created in our dynamic assembly. + array^temp3 = {nullptr,nullptr}; + Object^ ptInstance = Activator::CreateInstance( myType, temp3 ); + myType->InvokeMember( "PointMain", BindingFlags::InvokeMethod, nullptr, ptInstance, gcnew array(0) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp new file mode 100644 index 00000000000..5fc4617dce5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ConstructorBuilder Example/CPP/source.cpp @@ -0,0 +1,150 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ DynamicPointTypeGen() +{ + Type^ pointType = nullptr; + array^temp0 = {int::typeid,int::typeid,int::typeid}; + array^ctorParams = temp0; + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ pointModule = myAsmBuilder->DefineDynamicModule( "PointModule", "Point.dll" ); + TypeBuilder^ pointTypeBld = pointModule->DefineType( "Point", TypeAttributes::Public ); + FieldBuilder^ xField = pointTypeBld->DefineField( "x", int::typeid, FieldAttributes::Public ); + FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public ); + FieldBuilder^ zField = pointTypeBld->DefineField( "z", int::typeid, FieldAttributes::Public ); + Type^ objType = Type::GetType( "System.Object" ); + ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); + ConstructorBuilder^ pointCtor = pointTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); + ILGenerator^ ctorIL = pointCtor->GetILGenerator(); + + // NOTE: ldarg.0 holds the "this" reference - ldarg.1, ldarg.2, and ldarg.3 + // hold the actual passed parameters. ldarg.0 is used by instance methods + // to hold a reference to the current calling bject instance. Static methods + // do not use arg.0, since they are not instantiated and hence no reference + // is needed to distinguish them. + ctorIL->Emit( OpCodes::Ldarg_0 ); + + // Here, we wish to create an instance of System::Object by invoking its + // constructor, as specified above. + ctorIL->Emit( OpCodes::Call, objCtor ); + + // Now, we'll load the current instance in arg 0, along + // with the value of parameter "x" stored in arg 1, into stfld. + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_1 ); + ctorIL->Emit( OpCodes::Stfld, xField ); + + // Now, we store arg 2 "y" in the current instance with stfld. + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_2 ); + ctorIL->Emit( OpCodes::Stfld, yField ); + + // Last of all, arg 3 "z" gets stored in the current instance. + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_3 ); + ctorIL->Emit( OpCodes::Stfld, zField ); + + // Our work complete, we return. + ctorIL->Emit( OpCodes::Ret ); + + // Now, let's create three very simple methods so we can see our fields. + array^temp1 = {"GetX","GetY","GetZ"}; + array^mthdNames = temp1; + System::Collections::IEnumerator^ myEnum = mthdNames->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ mthdName = safe_cast(myEnum->Current); + MethodBuilder^ getFieldMthd = pointTypeBld->DefineMethod( mthdName, MethodAttributes::Public, int::typeid, nullptr ); + ILGenerator^ mthdIL = getFieldMthd->GetILGenerator(); + mthdIL->Emit( OpCodes::Ldarg_0 ); + if ( mthdName->Equals( "GetX" ) ) + mthdIL->Emit( OpCodes::Ldfld, xField ); + else + if ( mthdName->Equals( "GetY" ) ) + mthdIL->Emit( OpCodes::Ldfld, yField ); + else + if ( mthdName->Equals( "GetZ" ) ) + mthdIL->Emit( OpCodes::Ldfld, zField ); + + + + mthdIL->Emit( OpCodes::Ret ); + } + + pointType = pointTypeBld->CreateType(); + + // Let's save it, just for posterity. + myAsmBuilder->Save( "Point.dll" ); + return pointType; +} + +int main() +{ + Type^ myDynamicType = nullptr; + Object^ aPoint = nullptr; + array^temp2 = {int::typeid,int::typeid,int::typeid}; + array^aPtypes = temp2; + array^temp3 = {4,5,6}; + array^aPargs = temp3; + + // Call the method to build our dynamic class. + myDynamicType = DynamicPointTypeGen(); + Console::WriteLine( "Some information about my new Type '{0}':", myDynamicType->FullName ); + Console::WriteLine( "Assembly: '{0}'", myDynamicType->Assembly ); + Console::WriteLine( "Attributes: '{0}'", myDynamicType->Attributes ); + Console::WriteLine( "Module: '{0}'", myDynamicType->Module ); + Console::WriteLine( "Members: " ); + System::Collections::IEnumerator^ myEnum = myDynamicType->GetMembers()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MemberInfo^ member = safe_cast(myEnum->Current); + Console::WriteLine( "-- {0} {1};", member->MemberType, member->Name ); + } + + Console::WriteLine( "---" ); + + // Let's take a look at the constructor we created. + ConstructorInfo^ myDTctor = myDynamicType->GetConstructor( aPtypes ); + Console::WriteLine( "Constructor: {0};", myDTctor ); + Console::WriteLine( "---" ); + + // Now, we get to use our dynamically-created class by invoking the constructor. + aPoint = myDTctor->Invoke( aPargs ); + Console::WriteLine( "aPoint is type {0}.", aPoint->GetType() ); + + // Finally, let's reflect on the instance of our new type - aPoint - and + // make sure everything proceeded according to plan. + Console::WriteLine( "aPoint.x = {0}", myDynamicType->InvokeMember( "GetX", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) ); + Console::WriteLine( "aPoint.y = {0}", myDynamicType->InvokeMember( "GetY", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) ); + Console::WriteLine( "aPoint.z = {0}", myDynamicType->InvokeMember( "GetZ", BindingFlags::InvokeMethod, nullptr, aPoint, gcnew array(0) ) ); + + // +++ OUTPUT +++ + // Some information about my new Type 'Point': + // Assembly: 'MyDynamicAssembly, Version=0.0.0.0' + // Attributes: 'AutoLayout, AnsiClass, NotPublic, Public' + // Module: 'PointModule' + // Members: + // -- Field x; + // -- Field y; + // -- Field z; + // -- Method GetHashCode; + // -- Method Equals; + // -- Method ToString; + // -- Method GetType; + // -- Constructor .ctor; + // --- + // Constructor: Void .ctor(Int32, Int32, Int32); + // --- + // aPoint is type Point. + // aPoint.x = 4 + // aPoint.y = 5 + // aPoint.z = 6 +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp new file mode 100644 index 00000000000..0529bd4ec8c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.CustomAttributeBuilder Example/CPP/source.cpp @@ -0,0 +1,118 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// We will apply this custom attribute to our dynamic type. +public ref class ClassCreator: public Attribute +{ +private: + String^ creator; + +public: + + property String^ Creator + { + String^ get() + { + return creator; + } + + } + ClassCreator( String^ name ) + { + this->creator = name; + } + +}; + + +// We will apply this dynamic attribute to our dynamic method. +public ref class DateLastUpdated: public Attribute +{ +private: + String^ dateUpdated; + +public: + + property String^ DateUpdated + { + String^ get() + { + return dateUpdated; + } + + } + DateLastUpdated( String^ theDate ) + { + this->dateUpdated = theDate; + } + +}; + +Type^ BuildTypeWithCustomAttributesOnMethod() +{ + AppDomain^ currentDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyAssembly"; + AssemblyBuilder^ myAsmBuilder = currentDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); + ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyModule" ); + + // First, we'll build a type with a custom attribute attached. + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyType", TypeAttributes::Public ); + array^temp6 = {String::typeid}; + array^ctorParams = temp6; + ConstructorInfo^ classCtorInfo = ClassCreator::typeid->GetConstructor( ctorParams ); + array^temp0 = {"Joe Programmer"}; + CustomAttributeBuilder^ myCABuilder = gcnew CustomAttributeBuilder( classCtorInfo,temp0 ); + myTypeBuilder->SetCustomAttribute( myCABuilder ); + + // Now, let's build a method and add a custom attribute to it. + array^temp1 = gcnew array(0); + MethodBuilder^ myMethodBuilder = myTypeBuilder->DefineMethod( "HelloWorld", MethodAttributes::Public, nullptr, temp1 ); + array^temp7 = {String::typeid}; + ctorParams = temp7; + classCtorInfo = DateLastUpdated::typeid->GetConstructor( ctorParams ); + array^temp2 = {DateTime::Now.ToString()}; + CustomAttributeBuilder^ myCABuilder2 = gcnew CustomAttributeBuilder( classCtorInfo,temp2 ); + myMethodBuilder->SetCustomAttribute( myCABuilder2 ); + ILGenerator^ myIL = myMethodBuilder->GetILGenerator(); + myIL->EmitWriteLine( "Hello, world!" ); + myIL->Emit( OpCodes::Ret ); + return myTypeBuilder->CreateType(); +} + +int main() +{ + Type^ myType = BuildTypeWithCustomAttributesOnMethod(); + Object^ myInstance = Activator::CreateInstance( myType ); + array^customAttrs = myType->GetCustomAttributes( true ); + Console::WriteLine( "Custom Attributes for Type 'MyType':" ); + Object^ attrVal = nullptr; + System::Collections::IEnumerator^ myEnum = customAttrs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ customAttr = safe_cast(myEnum->Current); + array^temp3 = gcnew array(0); + attrVal = ClassCreator::typeid->InvokeMember( "Creator", BindingFlags::GetProperty, nullptr, customAttr, temp3 ); + Console::WriteLine( "-- Attribute: [{0} = \"{1}\"]", customAttr, attrVal ); + } + + Console::WriteLine( "Custom Attributes for Method 'HelloWorld()' in 'MyType':" ); + customAttrs = myType->GetMember( "HelloWorld" )[ 0 ]->GetCustomAttributes( true ); + System::Collections::IEnumerator^ myEnum2 = customAttrs->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + Object^ customAttr = safe_cast(myEnum2->Current); + array^temp4 = gcnew array(0); + attrVal = DateLastUpdated::typeid->InvokeMember( "DateUpdated", BindingFlags::GetProperty, nullptr, customAttr, temp4 ); + Console::WriteLine( "-- Attribute: [{0} = \"{1}\"]", customAttr, attrVal ); + } + + Console::WriteLine( "---" ); + array^temp5 = gcnew array(0); + Console::WriteLine( myType->InvokeMember( "HelloWorld", BindingFlags::InvokeMethod, nullptr, myInstance, temp5 ) ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp new file mode 100644 index 00000000000..2c62a49f16a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.Emit Example 2/CPP/source.cpp @@ -0,0 +1,89 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ BuildMyType() +{ + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); + ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyJumpTableDemo" ); + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "JumpTableDemo", TypeAttributes::Public ); + array^temp0 = {int::typeid}; + MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "SwitchMe", static_cast(MethodAttributes::Public | MethodAttributes::Static), String::typeid, temp0 ); + ILGenerator^ myIL = myMthdBuilder->GetILGenerator(); + Label defaultCase = myIL->DefineLabel(); + Label endOfMethod = myIL->DefineLabel(); + + // We are initializing our jump table. Note that the labels + // will be placed later using the MarkLabel method. + array diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp new file mode 100644 index 00000000000..06f186f7b7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.EmitCalli Example/CPP/source.cpp @@ -0,0 +1,42 @@ +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +class MyDynamicAssembly +{ +public: + static void BuildDynamicMethod( TypeBuilder^ myTypeBuilder, + array^ mthdParamTypes, + Type^ returnType, + int addrOfLegacyNumberObject ) + { + // + MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod", + MethodAttributes::Public, + returnType, mthdParamTypes ); + + // We will assume that an external unmanaged type "LegacyNumber" has been loaded, and + // that it has a method "ToString" which returns a String. + + MethodInfo^ unmanagedMthdMI = Type::GetType( "LegacyNumber" )->GetMethod( "ToString" ); + ILGenerator^ myMthdIL = myMthdBuilder->GetILGenerator(); + + // Code to emit various IL opcodes here ... + + // Load a reference to the specific Object instance onto the stack. + + myMthdIL->Emit( OpCodes::Ldc_I4, addrOfLegacyNumberObject ); + myMthdIL->Emit( OpCodes::Ldobj, Type::GetType( "LegacyNumber" ) ); + + // Make the call to the unmanaged type method, telling it that the method is + // the member of a specific instance, to expect a String + // as a return value, and that there are no explicit parameters. + myMthdIL->EmitCalli( OpCodes::Calli, + System::Runtime::InteropServices::CallingConvention::ThisCall, + String::typeid, + gcnew array( 0 ) ); + + // More IL code emission here ... + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp new file mode 100644 index 00000000000..cc26ae7bb54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.OpCodes Example/CPP/source.cpp @@ -0,0 +1,116 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ CreateDynamicType() +{ + array^ctorParams = {int::typeid,int::typeid}; + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); + ModuleBuilder^ pointModule = myAsmBuilder->DefineDynamicModule( "PointModule", "Point.dll" ); + TypeBuilder^ pointTypeBld = pointModule->DefineType( "Point", TypeAttributes::Public ); + FieldBuilder^ xField = pointTypeBld->DefineField( "x", int::typeid, FieldAttributes::Public ); + FieldBuilder^ yField = pointTypeBld->DefineField( "y", int::typeid, FieldAttributes::Public ); + Type^ objType = Type::GetType( "System.Object" ); + ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); + ConstructorBuilder^ pointCtor = pointTypeBld->DefineConstructor( MethodAttributes::Public, CallingConventions::Standard, ctorParams ); + ILGenerator^ ctorIL = pointCtor->GetILGenerator(); + + // First, you build the constructor. + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Call, objCtor ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_1 ); + ctorIL->Emit( OpCodes::Stfld, xField ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_2 ); + ctorIL->Emit( OpCodes::Stfld, yField ); + ctorIL->Emit( OpCodes::Ret ); + + // Now, you'll build a method to output some information on the + // inside your dynamic class. This method will have the following + // definition in C#: + // public void WritePoint() + MethodBuilder^ writeStrMthd = pointTypeBld->DefineMethod( "WritePoint", MethodAttributes::Public, void::typeid, nullptr ); + ILGenerator^ writeStrIL = writeStrMthd->GetILGenerator(); + + // The below ILGenerator created demonstrates a few ways to create + // String* output through STDIN. + // ILGenerator::EmitWriteLine(String*) will generate a ldstr and a + // call to WriteLine for you. + writeStrIL->EmitWriteLine( "The value of this current instance is:" ); + + // Here, you will do the hard work yourself. First, you need to create + // the String* we will be passing and obtain the correct WriteLine overload + // for said String*. In the below case, you are substituting in two values, + // so the chosen overload is Console::WriteLine(String*, Object*, Object*). + String^ inStr = "( {0}, {1})"; + array^wlParams = {String::typeid,Object::typeid,Object::typeid}; + + // We need the MethodInfo to pass into EmitCall later. + MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", wlParams ); + + // Push the String* with the substitutions onto the stack. + // This is the first argument for WriteLine - the String* one. + writeStrIL->Emit( OpCodes::Ldstr, inStr ); + + // Since the second argument is an Object*, and it corresponds to + // to the substitution for the value of our integer field, you + // need to box that field to an Object*. First, push a reference + // to the current instance, and then push the value stored in + // field 'x'. We need the reference to the current instance (stored + // in local argument index 0) so Ldfld can load from the correct + // instance (this one). + writeStrIL->Emit( OpCodes::Ldarg_0 ); + writeStrIL->Emit( OpCodes::Ldfld, xField ); + + // Now, we execute the box opcode, which pops the value of field 'x', + // returning a reference to the integer value boxed as an Object*. + writeStrIL->Emit( OpCodes::Box, int::typeid ); + + // Atop the stack, you'll find our String* inStr, followed by a reference + // to the boxed value of 'x'. Now, you need to likewise box field 'y'. + writeStrIL->Emit( OpCodes::Ldarg_0 ); + writeStrIL->Emit( OpCodes::Ldfld, yField ); + writeStrIL->Emit( OpCodes::Box, int::typeid ); + + // Now, you have all of the arguments for your call to + // Console::WriteLine(String*, Object*, Object*) atop the stack: + // the String* InStr, a reference to the boxed value of 'x', and + // a reference to the boxed value of 'y'. + // Call Console::WriteLine(String*, Object*, Object*) with EmitCall. + writeStrIL->EmitCall( OpCodes::Call, writeLineMI, nullptr ); + + // Lastly, EmitWriteLine can also output the value of a field + // using the overload EmitWriteLine(FieldInfo). + writeStrIL->EmitWriteLine( "The value of 'x' is:" ); + writeStrIL->EmitWriteLine( xField ); + writeStrIL->EmitWriteLine( "The value of 'y' is:" ); + writeStrIL->EmitWriteLine( yField ); + + // Since we return no value (void), the ret opcode will not + // return the top stack value. + writeStrIL->Emit( OpCodes::Ret ); + return pointTypeBld->CreateType(); +} + +int main() +{ + array^ctorParams = gcnew array(2); + Console::Write( "Enter a integer value for X: " ); + String^ myX = Console::ReadLine(); + Console::Write( "Enter a integer value for Y: " ); + String^ myY = Console::ReadLine(); + Console::WriteLine( "---" ); + ctorParams[ 0 ] = Convert::ToInt32( myX ); + ctorParams[ 1 ] = Convert::ToInt32( myY ); + Type^ ptType = CreateDynamicType(); + Object^ ptInstance = Activator::CreateInstance( ptType, ctorParams ); + ptType->InvokeMember( "WritePoint", BindingFlags::InvokeMethod, nullptr, ptInstance, gcnew array(0) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp new file mode 100644 index 00000000000..a8bc130aeb6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ILGenerator.ThrowException Example/CPP/source.cpp @@ -0,0 +1,159 @@ +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +int main() +{ + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "AdderExceptionAsm"; + AssemblyBuilder^ myAsmBldr = myDomain->DefineDynamicAssembly( myAsmName, + AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ myModBldr = myAsmBldr->DefineDynamicModule( myAsmName->Name, + myAsmName->Name + ".dll" ); + TypeBuilder^ myTypeBldr = myModBldr->DefineType( "Adder" ); + array^adderParams = {int::typeid,int::typeid}; + + // This method will add two numbers which are 100 or less. If either of the + // passed integer vales are greater than 100, it will throw an exception. + MethodBuilder^ adderBldr = myTypeBldr->DefineMethod( "DoAdd", + static_cast(MethodAttributes::Public | MethodAttributes::Static), + int::typeid, adderParams ); + ILGenerator^ adderIL = adderBldr->GetILGenerator(); + + // Types and methods used in the code to throw, catch, and + // display OverflowException. Note that if the catch block were + // for a more general type, such as Exception, we would need + // a MethodInfo for that type's ToString method. + // + Type^ overflow = OverflowException::typeid; + ConstructorInfo^ exCtorInfo = overflow->GetConstructor( + gcnew array { String::typeid }); + MethodInfo^ exToStrMI = overflow->GetMethod( "ToString" ); + MethodInfo^ writeLineMI = Console::typeid->GetMethod( "WriteLine", + gcnew array { String::typeid, Object::typeid } ); + + LocalBuilder^ tmp1 = adderIL->DeclareLocal( int::typeid ); + LocalBuilder^ tmp2 = adderIL->DeclareLocal( overflow ); + + // In order to successfully branch, we need to create labels + // representing the offset IL instruction block to branch to. + // These labels, when the MarkLabel(Label) method is invoked, + // will specify the IL instruction to branch to. + // + Label failed = adderIL->DefineLabel(); + Label endOfMthd = adderIL->DefineLabel(); + + // Begin the try block. + Label exBlock = adderIL->BeginExceptionBlock(); + + // First, load argument 0 and the integer value of S"100" onto the + // stack. If arg0 > 100, branch to the label S"failed", which is marked + // as the address of the block that throws an exception. + adderIL->Emit( OpCodes::Ldarg_0 ); + adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); + adderIL->Emit( OpCodes::Bgt_S, failed ); + + // Now, check to see if argument 1 was greater than 100. If it was, + // branch to S"failed." Otherwise, fall through and perform the addition, + // branching unconditionally to the instruction at the label S"endOfMthd". + adderIL->Emit( OpCodes::Ldarg_1 ); + adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); + adderIL->Emit( OpCodes::Bgt_S, failed ); + + adderIL->Emit( OpCodes::Ldarg_0 ); + adderIL->Emit( OpCodes::Ldarg_1 ); + adderIL->Emit( OpCodes::Add_Ovf_Un ); + // Store the result of the addition. + adderIL->Emit( OpCodes::Stloc_S, tmp1 ); + adderIL->Emit( OpCodes::Br_S, endOfMthd ); + + // If one of the arguments was greater than 100, we need to throw an + // exception. We'll use "OverflowException" with a customized message. + // First, we load our message onto the stack, and then create a new + // exception Object using the constructor overload that accepts a + // String* message. + adderIL->MarkLabel( failed ); + adderIL->Emit( OpCodes::Ldstr, "Cannot accept values over 100 for add." ); + adderIL->Emit( OpCodes::Newobj, exCtorInfo ); + + // We're going to need to refer to that exception Object later, so let's + // store it in a temporary variable. Since the store function pops the + // the value/reference off the stack, and we'll need it to throw the + // exception, we will subsequently load it back onto the stack as well. + adderIL->Emit( OpCodes::Stloc_S, tmp2 ); + adderIL->Emit( OpCodes::Ldloc_S, tmp2 ); + + // Throw the exception now on the stack. + adderIL->ThrowException( overflow ); + + // Start the catch block for OverflowException. + // + adderIL->BeginCatchBlock( overflow ); + + // When we enter the catch block, the thrown exception + // is on the stack. Store it, then load the format string + // for WriteLine. + // + adderIL->Emit(OpCodes::Stloc_S, tmp2); + adderIL->Emit(OpCodes::Ldstr, "Caught {0}"); + + // Push the thrown exception back on the stack, then + // call its ToString() method. Note that if this catch block + // were for a more general exception type, like Exception, + // it would be necessary to use the ToString for that type. + // + adderIL->Emit(OpCodes::Ldloc_S, tmp2); + adderIL->EmitCall(OpCodes::Callvirt, exToStrMI, nullptr); + + // The format string and the return value from ToString() are + // now on the stack. Call WriteLine(string, object). + // + adderIL->EmitCall( OpCodes::Call, writeLineMI, nullptr ); + + // Since our function has to return an integer value, we'll load -1 onto + // the stack to indicate an error, and store it in local variable tmp1. + adderIL->Emit( OpCodes::Ldc_I4_M1 ); + adderIL->Emit( OpCodes::Stloc_S, tmp1 ); + + // End the exception handling block. + adderIL->EndExceptionBlock(); + + // The end of the method. If no exception was thrown, the correct value + // will be saved in tmp1. If an exception was thrown, tmp1 will be equal + // to -1. Either way, we'll load the value of tmp1 onto the stack and return. + adderIL->MarkLabel( endOfMthd ); + adderIL->Emit( OpCodes::Ldloc_S, tmp1 ); + adderIL->Emit( OpCodes::Ret ); + + Type^ adderType = myTypeBldr->CreateType(); + + Object^ addIns = Activator::CreateInstance( adderType ); + + array^addParams = gcnew array(2); + + Console::Write( "Enter an integer value: " ); + addParams[ 0 ] = Convert::ToInt32( Console::ReadLine() ); + + Console::Write( "Enter another integer value: " ); + addParams[ 1 ] = Convert::ToInt32( Console::ReadLine() ); + + Console::WriteLine( "If either integer was > 100, an exception will be thrown." ); + + Console::WriteLine( "---" ); + Console::WriteLine( " {0} + {1} = {2}", addParams[ 0 ], addParams[ 1 ], adderType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, addIns, addParams ) ); +} + +/* This code produces output similar to the following: + +Enter an integer value: 24 +Enter another integer value: 101 +If either integer was > 100, an exception will be thrown. +--- +Caught System.OverflowException: Arithmetic operation resulted in an overflow. + at Adder.DoAdd(Int32 , Int32 ) + 24 + 101 = -1 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp new file mode 100644 index 00000000000..8b29b655e66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.Label Example/CPP/source.cpp @@ -0,0 +1,81 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ BuildAdderType() +{ + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "AdderExceptionAsm"; + AssemblyBuilder^ myAsmBldr = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); + ModuleBuilder^ myModBldr = myAsmBldr->DefineDynamicModule( "AdderExceptionMod" ); + TypeBuilder^ myTypeBldr = myModBldr->DefineType( "Adder" ); + array^adderParams = {int::typeid,int::typeid}; + + // This method will add two numbers which are 100 or less. If either of the + // passed integer vales are greater than 100, it will return the value of -1. + MethodBuilder^ adderBldr = myTypeBldr->DefineMethod( "DoAdd", static_cast(MethodAttributes::Public | MethodAttributes::Static), int::typeid, adderParams ); + ILGenerator^ adderIL = adderBldr->GetILGenerator(); + + // In order to successfully branch, we need to create labels + // representing the offset IL instruction block to branch to. + // These labels, when the MarkLabel(Label) method is invoked, + // will specify the IL instruction to branch to. + Label failed = adderIL->DefineLabel(); + Label endOfMthd = adderIL->DefineLabel(); + + // First, load argument 0 and the integer value of "100" onto the + // stack. If arg0 > 100, branch to the label "failed", which is marked + // as the address of the block that loads -1 onto the stack, bypassing + // the addition. + adderIL->Emit( OpCodes::Ldarg_0 ); + adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); + adderIL->Emit( OpCodes::Bgt_S, failed ); + + // Now, check to see if argument 1 was greater than 100. If it was, + // branch to "failed." Otherwise, fall through and perform the addition, + // branching unconditionally to the instruction at the label "endOfMthd". + adderIL->Emit( OpCodes::Ldarg_1 ); + adderIL->Emit( OpCodes::Ldc_I4_S, 100 ); + adderIL->Emit( OpCodes::Bgt_S, failed ); + adderIL->Emit( OpCodes::Ldarg_0 ); + adderIL->Emit( OpCodes::Ldarg_1 ); + adderIL->Emit( OpCodes::Add_Ovf_Un ); + adderIL->Emit( OpCodes::Br_S, endOfMthd ); + + // If this label is branched to (the failure case), load -1 onto the stack + // and fall through to the return opcode. + adderIL->MarkLabel( failed ); + adderIL->Emit( OpCodes::Ldc_I4_M1 ); + + // The end of the method. If both values were less than 100, the + // correct result will return. If one of the arguments was greater + // than 100, the result will be -1. + adderIL->MarkLabel( endOfMthd ); + adderIL->Emit( OpCodes::Ret ); + return myTypeBldr->CreateType(); +} + +int main() +{ + Type^ adderType = BuildAdderType(); + Object^ addIns = Activator::CreateInstance( adderType ); + array^addParams = gcnew array(2); + Console::Write( "Enter an integer value: " ); + addParams[ 0 ] = Convert::ToInt32( Console::ReadLine() ); + Console::Write( "Enter another integer value: " ); + addParams[ 1 ] = Convert::ToInt32( Console::ReadLine() ); + Console::WriteLine( "---" ); + int adderResult = safe_cast(adderType->InvokeMember( "DoAdd", BindingFlags::InvokeMethod, nullptr, addIns, addParams )); + if ( adderResult != -1 ) + { + Console::WriteLine( " {0} + {1} = {2}", addParams[ 0 ], addParams[ 1 ], adderResult ); + } + else + { + Console::WriteLine( "One of the integers to add was greater than 100!" ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp new file mode 100644 index 00000000000..13c415b9f79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder Example/CPP/source.cpp @@ -0,0 +1,105 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +void AddMethodDynamically( TypeBuilder^ myTypeBld, + String^ mthdName, + array^ mthdParams, + Type^ returnType, + String^ mthdAction ) +{ + MethodBuilder^ myMthdBld = myTypeBld->DefineMethod( mthdName, static_cast(MethodAttributes::Public | MethodAttributes::Static), returnType, mthdParams ); + ILGenerator^ ILOut = myMthdBld->GetILGenerator(); + int numParams = mthdParams->Length; + for ( Byte x = 0; x < numParams; x++ ) + { + ILOut->Emit( OpCodes::Ldarg_S, x ); + + } + if ( numParams > 1 ) + { + for ( int y = 0; y < (numParams - 1); y++ ) + { + if ( mthdAction->Equals( "A" ) ) + ILOut->Emit( OpCodes::Add ); + else + if ( mthdAction->Equals( "M" ) ) + ILOut->Emit( OpCodes::Mul ); + else + ILOut->Emit( OpCodes::Add ); + + } + } + + ILOut->Emit( OpCodes::Ret ); +}; + +void main() +{ + AppDomain^ myDomain = AppDomain::CurrentDomain; + AssemblyName^ asmName = gcnew AssemblyName; + asmName->Name = "MyDynamicAsm"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( asmName, + AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ myModule = myAsmBuilder->DefineDynamicModule( "MyDynamicAsm", + "MyDynamicAsm.dll" ); + TypeBuilder^ myTypeBld = myModule->DefineType( "MyDynamicType", + TypeAttributes::Public ); + + // Get info from the user to build the method dynamically. + Console::WriteLine( "Let's build a simple method dynamically!" ); + Console::WriteLine( "Please enter a few numbers, separated by spaces." ); + String^ inputNums = Console::ReadLine(); + Console::Write( "Do you want to [A]dd (default) or [M]ultiply these numbers? " ); + String^ myMthdAction = Console::ReadLine()->ToUpper(); + Console::Write( "Lastly, what do you want to name your new dynamic method? " ); + String^ myMthdName = Console::ReadLine(); + + // Process inputNums into an array and create a corresponding Type array + int index = 0; + array^inputNumsList = inputNums->Split(); + array^myMthdParams = gcnew array(inputNumsList->Length); + array^inputValsList = gcnew array(inputNumsList->Length); + for each (String^ inputNum in inputNumsList) + { + inputValsList[ index ] = Convert::ToInt32( inputNum ); + myMthdParams[ index ] = int::typeid; + index++; + } + + + // Now, call the method building method with the parameters, passing the + // TypeBuilder by reference. + AddMethodDynamically( myTypeBld, + myMthdName, + myMthdParams, + int::typeid, + myMthdAction ); + Type^ myType = myTypeBld->CreateType(); + + Console::WriteLine( "---" ); + Console::WriteLine( "The result of {0} the inputted values is: {1}", + ((myMthdAction->Equals( "M" )) ? "multiplying" : "adding"), + myType->InvokeMember( myMthdName, + BindingFlags::InvokeMethod | BindingFlags::Public | BindingFlags::Static, + nullptr, + nullptr, + inputValsList ) ); + Console::WriteLine( "---" ); + + // Let's take a look at the method we created. + // If you are interested in seeing the MSIL generated dynamically for the method + // your program generated, change to the directory where you ran the compiled + // code sample and type "ildasm MyDynamicAsm.dll" at the prompt. When the list + // of manifest contents appears, click on "MyDynamicType" and then on the name of + // of the method you provided during execution. + + myAsmBuilder->Save( "MyDynamicAsm.dll" ); + + MethodInfo^ myMthdInfo = myType->GetMethod( myMthdName ); + Console::WriteLine( "Your Dynamic Method: {0};", myMthdInfo ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp new file mode 100644 index 00000000000..e11b9039eea --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.AddDeclarativeSecurity Example/CPP/source.cpp @@ -0,0 +1,33 @@ +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +class MyMethodBuilderDemo +{ +public: + static void BuildDynMethod( ModuleBuilder^ myModBuilder ) + { + // + // myModBuilder is an instance of ModuleBuilder. + // Note that for the use of PermissionSet and SecurityAction, + // the namespaces System::Security and System::Security::Permissions + // should be included. + + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyType", + TypeAttributes::Public ); + + array^ temp0 = {int::typeid, int::typeid}; + MethodBuilder^ myMethod1 = myTypeBuilder->DefineMethod( "MyMethod", + MethodAttributes::Public, + int::typeid, temp0 ); + + PermissionSet^ myMethodPermissions = gcnew PermissionSet( + PermissionState::Unrestricted ); + + myMethod1->AddDeclarativeSecurity( SecurityAction::Demand, + myMethodPermissions ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp new file mode 100644 index 00000000000..b0197f9c238 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetModule/CPP/source3.cpp @@ -0,0 +1,34 @@ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +class MoreMethodBuilderSnippets +{ +public: + static void ContainerMethod( AssemblyBuilder^ myAsmBuilder ) + { + + // + ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MathFunctions" ); + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "MyMathFunctions", TypeAttributes::Public ); + array^temp0 = {int::typeid,int::typeid}; + MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "Adder", MethodAttributes::Public, int::typeid, temp0 ); + + // Create body via ILGenerator here ... + Type^ myNewType = myTypeBuilder->CreateType(); + Module^ myModule = myMthdBuilder->GetModule(); + array^myModTypes = myModule->GetTypes(); + Console::WriteLine( "Module: {0}", myModule->Name ); + Console::WriteLine( "------- with path {0}", myModule->FullyQualifiedName ); + Console::WriteLine( "------- in assembly {0}", myModule->Assembly->FullName ); + System::Collections::IEnumerator^ myEnum = myModTypes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ myModType = safe_cast(myEnum->Current); + Console::WriteLine( "------- has type {0}", myModType->FullName ); + } + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp new file mode 100644 index 00000000000..8588434c8e6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.GetParameters Example/CPP/source4.cpp @@ -0,0 +1,29 @@ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +class MoreMethodBuilderSnippets +{ +public: + static void ContainerMethod( ModuleBuilder^ myModBuilder ) + { + // + TypeBuilder^ myType1 = myModBuilder->DefineType( "MyMathFunctions", TypeAttributes::Public ); + array^temp0 = {Type::GetType( "System.Int32&" ),int::typeid}; + MethodBuilder^ myMthdBuilder = myType1->DefineMethod( "AddToRefValue", MethodAttributes::Public, void::typeid, temp0 ); + ParameterBuilder^ myParam1 = myMthdBuilder->DefineParameter( 1, ParameterAttributes::Out, "thePool" ); + ParameterBuilder^ myParam2 = myMthdBuilder->DefineParameter( 2, ParameterAttributes::In, "addMeToPool" ); + + // Create body via ILGenerator here, and complete the type. + array^myParams = myMthdBuilder->GetParameters(); + Console::WriteLine( "Method: {0}", myMthdBuilder->Name ); + + for each (ParameterInfo^ myParam in myParams) + { + Console::WriteLine("------- Parameter: {0} {1} at pos {2}, with attribute {3}", + myParam->ParameterType, myParam->Name, myParam->Position, + myParam->Attributes.ToString()); + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp new file mode 100644 index 00000000000..3f7e32af646 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetImplementationFlags Example/CPP/source.cpp @@ -0,0 +1,31 @@ +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +class MethodBuilderAssortedMembersDemo +{ +public: + static void MemberSnippets( TypeBuilder^ myTypeBuilder ) + { + // + array^ temp0 = { int::typeid, int::typeid }; + MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "MyMethod", + MethodAttributes::Public, + CallingConventions::HasThis, + int::typeid, + temp0 ); + + // Specifies that the dynamic method declared above has a an MSIL implementation, + // is managed, synchronized (single-threaded) through the body, and that it + // cannot be inlined. + + myMthdBuilder->SetImplementationFlags( (MethodImplAttributes)( + MethodImplAttributes::IL | + MethodImplAttributes::Managed | + MethodImplAttributes::Synchronized | + MethodImplAttributes::NoInlining) ); + + // Create an ILGenerator for the MethodBuilder and emit MSIL here ... + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp new file mode 100644 index 00000000000..43dd7762fff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetMarshal Example/CPP/source.cpp @@ -0,0 +1,28 @@ +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +class VariousMethodBuilderSnippets +{ +public: + static void ContainerMethod( TypeBuilder^ myDynamicType ) + { + // + array^ temp0 = { String::typeid }; + MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethodReturnsMarshal", + MethodAttributes::Public, + UInt32::typeid, + temp0 ); + + // We want the return value of our dynamic method to be marshalled as + // an 64-bit (8-Byte) signed integer, instead of the default 32-bit + // unsigned int as specified above. The UnmanagedMarshal class can perform + // the type conversion. + + UnmanagedMarshal^ marshalMeAsI8 = UnmanagedMarshal::DefineUnmanagedMarshal( + System::Runtime::InteropServices::UnmanagedType::I8 ); + + myMethod->SetMarshal( marshalMeAsI8 ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp new file mode 100644 index 00000000000..f2b05b30c44 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.MethodBuilder.SetSymCustomAttribute Example/CPP/source2.cpp @@ -0,0 +1,28 @@ +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +class VariousMethodBuilderSnippets +{ +public: + static void ContainerMethod( TypeBuilder^ myDynamicType ) + { + // + array^ temp0 = { String::typeid }; + MethodBuilder^ myMethod = myDynamicType->DefineMethod( "MyMethod", + MethodAttributes::Public, + int::typeid, + temp0 ); + + // A 128-bit key in hex form, represented as a Byte array. + array^ keyVal = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xFF, 0xFF}; + + System::Text::ASCIIEncoding^ encoder = gcnew System::Text::ASCIIEncoding; + array^ symFullName = encoder->GetBytes( "My Dynamic Method" ); + + myMethod->SetSymCustomAttribute( "SymID", keyVal ); + myMethod->SetSymCustomAttribute( "SymFullName", symFullName ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp new file mode 100644 index 00000000000..2f0d3457db5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.OpCodes.TakesSingleByteArgument Example/CPP/source.cpp @@ -0,0 +1,27 @@ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +// +int main() +{ + + // We need a blank OpCode Object for reference when calling FieldInfo::GetValue(). + OpCode blankOpCode; + Type^ myOpCodesType = Type::GetType( "System.Reflection.Emit.OpCodes" ); + array^listOfOpCodes = myOpCodesType->GetFields(); + Console::WriteLine( "Which OpCodes take single-Byte arguments?" ); + Console::WriteLine( "-----------------------------------------" ); + + // Now, let's reflect on each FieldInfo and create an instance of the OpCode it represents. + System::Collections::IEnumerator^ myEnum = listOfOpCodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FieldInfo^ opCodeFI = safe_cast(myEnum->Current); + Object^ theOpCode = opCodeFI->GetValue( blankOpCode ); + Console::WriteLine( " {0}: {1}", opCodeFI->Name, OpCodes::TakesSingleByteArgument( *dynamic_cast(theOpCode) ) ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp new file mode 100644 index 00000000000..7039d6968a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.ParameterBuilder Example/CPP/source.cpp @@ -0,0 +1,90 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ BuildCustomerDataType() +{ + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + AssemblyBuilder^ myAsmBuilder = myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::Run ); + ModuleBuilder^ myModBuilder = myAsmBuilder->DefineDynamicModule( "MyMod" ); + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public ); + FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private ); + FieldBuilder^ acctIDBldr = myTypeBuilder->DefineField( "acctID", String::typeid, FieldAttributes::Private ); + FieldBuilder^ balanceAmtBldr = myTypeBuilder->DefineField( "balanceAmt", double::typeid, FieldAttributes::Private ); + array^temp0 = {String::typeid,String::typeid,double::typeid}; + ConstructorBuilder^ myCtorBuilder = myTypeBuilder->DefineConstructor( MethodAttributes::Public, CallingConventions::HasThis, temp0 ); + ILGenerator^ ctorIL = myCtorBuilder->GetILGenerator(); + Type^ objType = Type::GetType( "System.Object" ); + ConstructorInfo^ objCtor = objType->GetConstructor( gcnew array(0) ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Call, objCtor ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_1 ); + ctorIL->Emit( OpCodes::Stfld, customerNameBldr ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_2 ); + ctorIL->Emit( OpCodes::Stfld, acctIDBldr ); + ctorIL->Emit( OpCodes::Ldarg_0 ); + ctorIL->Emit( OpCodes::Ldarg_3 ); + ctorIL->Emit( OpCodes::Stfld, balanceAmtBldr ); + ctorIL->Emit( OpCodes::Ret ); + + // This method will take an amount from a static pool and add it to the balance. + // Note that we are passing the first parameter, fundsPool, by reference. Therefore, + // we need to inform the MethodBuilder to expect a ref, by declaring the first + // parameter's type to be System::Double& (a reference to a double). + array^temp4 = {Type::GetType( "System.Double&" ),double::typeid}; + MethodBuilder^ myMthdBuilder = myTypeBuilder->DefineMethod( "AddFundsFromPool", MethodAttributes::Public, double::typeid, temp4 ); + ParameterBuilder^ poolRefBuilder = myMthdBuilder->DefineParameter( 1, ParameterAttributes::Out, "fundsPool" ); + ParameterBuilder^ amountFromPoolBuilder = myMthdBuilder->DefineParameter( 2, ParameterAttributes::In, "amountFromPool" ); + ILGenerator^ mthdIL = myMthdBuilder->GetILGenerator(); + mthdIL->Emit( OpCodes::Ldarg_1 ); + mthdIL->Emit( OpCodes::Ldarg_1 ); + mthdIL->Emit( OpCodes::Ldind_R8 ); + mthdIL->Emit( OpCodes::Ldarg_2 ); + mthdIL->Emit( OpCodes::Sub ); + mthdIL->Emit( OpCodes::Stind_R8 ); + mthdIL->Emit( OpCodes::Ldarg_0 ); + mthdIL->Emit( OpCodes::Ldarg_0 ); + mthdIL->Emit( OpCodes::Ldfld, balanceAmtBldr ); + mthdIL->Emit( OpCodes::Ldarg_2 ); + mthdIL->Emit( OpCodes::Add ); + mthdIL->Emit( OpCodes::Stfld, balanceAmtBldr ); + mthdIL->Emit( OpCodes::Ldarg_0 ); + mthdIL->Emit( OpCodes::Ldfld, balanceAmtBldr ); + mthdIL->Emit( OpCodes::Ret ); + return myTypeBuilder->CreateType(); +} + +int main() +{ + Type^ custType = nullptr; + Object^ custObj = nullptr; + array^custArgTypes = {String::typeid,String::typeid,double::typeid}; + + // Call the method to build our dynamic class. + custType = BuildCustomerDataType(); + Console::WriteLine( "---" ); + ConstructorInfo^ myCustCtor = custType->GetConstructor( custArgTypes ); + double initialBalance = 100.00; + array^temp5 = {"Joe Consumer","5678-XYZ",initialBalance}; + custObj = myCustCtor->Invoke( temp5 ); + array^myMemberInfo = custType->GetMember( "AddFundsFromPool" ); + double thePool = 1000.00; + Console::WriteLine( "The pool is currently ${0}", thePool ); + Console::WriteLine( "The original balance of the account instance is ${0}", initialBalance ); + double amountFromPool = 50.00; + Console::WriteLine( "The amount to be subtracted from the pool and added to the account is ${0}", amountFromPool ); + Console::WriteLine( "---" ); + Console::WriteLine( "Calling {0} ...", myMemberInfo[ 0 ] ); + Console::WriteLine( "---" ); + array^passMe = {thePool,amountFromPool}; + Console::WriteLine( "The new balance in the account instance is ${0}", custType->InvokeMember( "AddFundsFromPool", BindingFlags::InvokeMethod, nullptr, custObj, passMe ) ); + thePool = safe_cast(passMe[ 0 ]); + Console::WriteLine( "The new amount in the pool is ${0}", thePool ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp new file mode 100644 index 00000000000..8f782758f2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.PropertyBuilder Example/CPP/source.cpp @@ -0,0 +1,107 @@ + +// +using namespace System; +using namespace System::Threading; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +Type^ BuildDynamicTypeWithProperties() +{ + AppDomain^ myDomain = Thread::GetDomain(); + AssemblyName^ myAsmName = gcnew AssemblyName; + myAsmName->Name = "MyDynamicAssembly"; + + // To generate a persistable assembly, specify AssemblyBuilderAccess::RunAndSave. + AssemblyBuilder^ myAsmBuilder = + myDomain->DefineDynamicAssembly( myAsmName, AssemblyBuilderAccess::RunAndSave ); + + // Generate a persistable single-module assembly. + ModuleBuilder^ myModBuilder = + myAsmBuilder->DefineDynamicModule( myAsmName->Name, myAsmName->Name + ".dll" ); + TypeBuilder^ myTypeBuilder = myModBuilder->DefineType( "CustomerData", TypeAttributes::Public ); + + // Define a private field to hold the property value. + FieldBuilder^ customerNameBldr = myTypeBuilder->DefineField( "customerName", String::typeid, FieldAttributes::Private ); + + // The last argument of DefineProperty is an empty array of Type + // objects, because the property has no parameters. (Alternatively, + // you can specify a null value.) + PropertyBuilder^ custNamePropBldr = + myTypeBuilder->DefineProperty( "CustomerName", PropertyAttributes::HasDefault, String::typeid, gcnew array(0) ); + + // The property set and property get methods require a special + // set of attributes. + MethodAttributes getSetAttr = + MethodAttributes::Public | MethodAttributes::SpecialName | + MethodAttributes::HideBySig; + + // Define the "get" accessor method for CustomerName. + MethodBuilder^ custNameGetPropMthdBldr = + myTypeBuilder->DefineMethod( "get_CustomerName", + getSetAttr, + String::typeid, + Type::EmptyTypes ); + + ILGenerator^ custNameGetIL = custNameGetPropMthdBldr->GetILGenerator(); + custNameGetIL->Emit( OpCodes::Ldarg_0 ); + custNameGetIL->Emit( OpCodes::Ldfld, customerNameBldr ); + custNameGetIL->Emit( OpCodes::Ret ); + + // Define the "set" accessor method for CustomerName. + array^temp2 = {String::typeid}; + MethodBuilder^ custNameSetPropMthdBldr = + myTypeBuilder->DefineMethod( "set_CustomerName", + getSetAttr, + nullptr, + temp2 ); + + ILGenerator^ custNameSetIL = custNameSetPropMthdBldr->GetILGenerator(); + custNameSetIL->Emit( OpCodes::Ldarg_0 ); + custNameSetIL->Emit( OpCodes::Ldarg_1 ); + custNameSetIL->Emit( OpCodes::Stfld, customerNameBldr ); + custNameSetIL->Emit( OpCodes::Ret ); + + // Last, we must map the two methods created above to our PropertyBuilder to + // their corresponding behaviors, "get" and "set" respectively. + custNamePropBldr->SetGetMethod( custNameGetPropMthdBldr ); + custNamePropBldr->SetSetMethod( custNameSetPropMthdBldr ); + + Type^ retval = myTypeBuilder->CreateType(); + + // Save the assembly so it can be examined with Ildasm.exe, + // or referenced by a test program. + myAsmBuilder->Save(myAsmName->Name + ".dll"); + return retval; +} + +int main() +{ + Type^ custDataType = BuildDynamicTypeWithProperties(); + array^custDataPropInfo = custDataType->GetProperties(); + System::Collections::IEnumerator^ myEnum = custDataPropInfo->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + PropertyInfo^ pInfo = safe_cast(myEnum->Current); + Console::WriteLine( "Property '{0}' created!", pInfo ); + } + + Console::WriteLine( "---" ); + + // Note that when invoking a property, you need to use the proper BindingFlags - + // BindingFlags::SetProperty when you invoke the "set" behavior, and + // BindingFlags::GetProperty when you invoke the "get" behavior. Also note that + // we invoke them based on the name we gave the property, as expected, and not + // the name of the methods we bound to the specific property behaviors. + Object^ custData = Activator::CreateInstance( custDataType ); + array^temp3 = {"Joe User"}; + custDataType->InvokeMember( "CustomerName", BindingFlags::SetProperty, nullptr, custData, temp3 ); + Console::WriteLine( "The customerName field of instance custData has been set to '{0}'.", custDataType->InvokeMember( "CustomerName", BindingFlags::GetProperty, nullptr, custData, gcnew array(0) ) ); +} + +// --- O U T P U T --- +// The output should be as follows: +// ------------------- +// Property 'System.String CustomerName' created! +// --- +// The customerName field of instance custData has been set to 'Joe User'. +// ------------------- +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp new file mode 100644 index 00000000000..bfeecb340d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Emit.TypeBuilder.CreateType Example/CPP/nestedenum.cpp @@ -0,0 +1,121 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Threading; +using namespace System::Text; +using namespace System::Resources; +using namespace System::Collections; +using namespace System::IO; + +// Helper class called when a resolve type event is raised. +ref class TypeResolveHandler +{ +private: + Module^ m_Module; + +public: + TypeResolveHandler( Module^ mod ) + { + m_Module = mod; + } + + Assembly^ ResolveEvent( Object^ sender, ResolveEventArgs^ args ); +}; + +ref class NestedEnum +{ +internal: + static TypeBuilder^ enumType = nullptr; + static Type^ tNested = nullptr; + static Type^ tNesting = nullptr; + +public: + static void Main() + { + AssemblyName^ asmName = gcnew AssemblyName; + asmName->Name = "NestedEnum"; + AssemblyBuilder^ asmBuild = Thread::GetDomain()->DefineDynamicAssembly( asmName, AssemblyBuilderAccess::RunAndSave ); + ModuleBuilder^ modBuild = asmBuild->DefineDynamicModule( "ModuleOne", "NestedEnum.dll" ); + + // Hook up the event listening. + TypeResolveHandler^ typeResolveHandler = gcnew TypeResolveHandler( modBuild ); + + // Add a listener for the type resolve events. + AppDomain^ currentDomain = Thread::GetDomain(); + ResolveEventHandler^ resolveHandler = gcnew ResolveEventHandler( typeResolveHandler, &TypeResolveHandler::ResolveEvent ); + currentDomain->TypeResolve += resolveHandler; + TypeBuilder^ tb = modBuild->DefineType( "AType", TypeAttributes::Public ); + TypeBuilder^ eb = tb->DefineNestedType( "AnEnum", static_cast(TypeAttributes::NestedPublic | TypeAttributes::Sealed), Enum::typeid, 0 ); + eb->DefineField( "value__", int::typeid, static_cast(FieldAttributes::Private | FieldAttributes::SpecialName) ); + FieldBuilder^ fb = eb->DefineField( "Field1", eb, static_cast(FieldAttributes::Public | FieldAttributes::Literal | FieldAttributes::Static) ); + fb->SetConstant( 1 ); + enumType = eb; + + // Comment out this field. + // When this field is defined, the loader cannot determine the size + // of the type. Therefore, a TypeResolve event is generated when the + // nested type is completed. + tb->DefineField( "Field2", eb, FieldAttributes::Public ); + tNesting = tb->CreateType(); + if ( tNesting == nullptr ) + Console::WriteLine( "NestingType CreateType failed but didn't throw!" ); + + try + { + tNested = eb->CreateType(); + if ( tNested == nullptr ) + Console::WriteLine( "NestedType CreateType failed but didn't throw!" ); + } + catch ( Exception^ ) + { + + // This is needed because you might have already completed the type in the TypeResolve event. + } + + if ( tNested != nullptr ) + { + Type^ x = tNested->DeclaringType; + if ( x == nullptr ) + Console::WriteLine( "Declaring type is null." ); + else + Console::WriteLine( x->Name ); + } + + asmBuild->Save( "NestedEnum.dll" ); + + // Remove the listener for the type resolve events. + currentDomain->TypeResolve -= resolveHandler; + } + +}; + +Assembly^ TypeResolveHandler::ResolveEvent( Object^ sender, ResolveEventArgs^ args ) +{ + Console::WriteLine( args->Name ); + + // Use args.Name to look up the type name. In this case, you are getting AnEnum. + try + { + NestedEnum::tNested = NestedEnum::enumType->CreateType(); + } + catch ( Exception^ ) + { + + // This is needed to throw away InvalidOperationException. + // Loader might send the TypeResolve event more than once + // and the type might be complete already. + } + + + // Complete the type. + return m_Module->Assembly; +} + +int main() +{ + NestedEnum::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp new file mode 100644 index 00000000000..8f8a66f0c27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MemberInfo.Module/cpp/source.cpp @@ -0,0 +1,32 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Test +{ +public: + virtual String^ ToString() override + { + return "An instance of class Test!"; + } +}; + +int main() +{ + Test^ target = gcnew Test(); + MethodInfo^ toStringInfo = target->GetType()->GetMethod("ToString"); + Console::WriteLine("{0} is defined in {1}", toStringInfo->Name, + toStringInfo->Module->Name); + + MethodInfo^ getHashCodeInfo = target->GetType()->GetMethod("GetHashCode"); + Console::WriteLine("{0} is defined in {1}", getHashCodeInfo->Name, + getHashCodeInfo->Module->Name); +} + +/* +* This example produces the following console output: +* +* ToString is defined in source.exe +* GetHashCode is defined in mscorlib.dll +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp new file mode 100644 index 00000000000..2ba285b7284 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.MethodBase.IsHideBySig/cpp/hide.cpp @@ -0,0 +1,90 @@ +// +using namespace System; +using namespace System::Reflection; + +// The base class Parent contains an overloaded method PrintCall. +// +public ref class Parent +{ +public: + virtual void PrintCall() + { + Console::WriteLine("Parent's PrintCall()"); + } +public: + virtual void PrintCall(int x) + { + Console::WriteLine("Parent's PrintCall({0})", x); + } +}; + +// The derived class Child hides one overload of the inherited +// method PrintCall. +// +public ref class Child : public Parent +{ +public: + void PrintCall(int i) new + { + Console::WriteLine("Child's PrintCall({0})", i); + } +}; + +int main() +{ + Child^ childInstance = gcnew Child(); + + // In C#, the method in the derived class hides by name and by + // signature, so the overload in the derived class hides only one + // of the overloads in the base class. + // + Console::WriteLine("------ List the overloads of PrintCall in the " + + "derived class Child ------"); + Type^ t = childInstance->GetType(); + for each(MethodInfo^ minfo in t->GetMethods()) + { + if (minfo->Name == "PrintCall") + { + Console::WriteLine("Overload of PrintCall: {0}" + + " IsHideBySig = {1}, DeclaringType = {2}", + minfo, minfo->IsHideBySig, minfo->DeclaringType); + } + } + + // The method PrintCall in the derived class hides one overload of the + // method in Parent. Contrast this with Visual Basic, which hides by + // name instead of by name and signature. In Visual Basic, the + // parameterless overload of PrintCall would be unavailable from Child. + // + Console::WriteLine( + "------ Call the overloads of PrintCall available in Child ------"); + childInstance->PrintCall(); + childInstance->PrintCall(42); + + // If Child is cast to the base type Parent, both overloads of the + // shadowed method can be called. + // + Console::WriteLine( + "------ Call the shadowed overloads of PrintCall ------"); + Parent^ parentInstance = childInstance; + parentInstance->PrintCall(); + parentInstance->PrintCall(42); +} + +/* This code example produces the following output: + +------ List the overloads of PrintCall in the derived class Child ------ +Overload of PrintCall: Void PrintCall(Int32) IsHideBySig = True, DeclaringType = Child +Overload of PrintCall: Void PrintCall() IsHideBySig = True, DeclaringType = Parent +Overload of PrintCall: Void PrintCall(Int32) IsHideBySig = True, DeclaringType = Parent +------ Call the overloads of PrintCall available in Child ------ +Parent's PrintCall() +Child's PrintCall(42) +------ Call the shadowed overloads of PrintCall ------ +Parent's PrintCall() +Parent's PrintCall(42) + +*/ + +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp new file mode 100644 index 00000000000..2fca1e3a971 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.Assembly Example/CPP/class1.cpp @@ -0,0 +1,17 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + array^moduleArray; + moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); + + // In a simple project with only one module, the module at index + // 0 will be the module containing this class. + Module^ myModule = moduleArray[ 0 ]; + Assembly^ myAssembly = myModule->Assembly; + Console::WriteLine( "myModule.Assembly = {0}.", myAssembly->FullName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp new file mode 100644 index 00000000000..82159ee05f7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeName Example/CPP/class1.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections; +public ref class MySecondClass{}; + + +// This class does not fit the filter criterion My*. +public ref class YourClass{}; + +int main() +{ + array^moduleArray; + moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); + + // In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + Module^ myModule = moduleArray[ 0 ]; + array^tArray; + tArray = myModule->FindTypes( Module::FilterTypeName, "My*" ); + IEnumerator^ myEnum = tArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ t = safe_cast(myEnum->Current); + Console::WriteLine( "Found a module beginning with My*: {0}.", t->Name ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp new file mode 100644 index 00000000000..3aa584f6d2c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FilterTypeNameIgnoreCase Example/CPP/class1.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections; +public ref class MyMainClass{}; + +public ref class MySecondClass{}; + + +// This class does not fit the filter criteria my*. +public ref class YourClass{}; + +int main() +{ + array^moduleArray; + moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); + + // In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + Module^ myModule = moduleArray[ 0 ]; + array^tArray; + tArray = myModule->FindTypes( Module::FilterTypeNameIgnoreCase, "my*" ); + IEnumerator^ myEnum = tArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ t = safe_cast(myEnum->Current); + Console::WriteLine( "Found a module beginning with my*: {0}", t->Name ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp new file mode 100644 index 00000000000..68633196a7c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.FullyQualifiedName/CPP/class1.cpp @@ -0,0 +1,16 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + array^moduleArray; + moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); + + // In a simple project with only one module, the module at index + // 0 will be the module containing this class. + Module^ myModule = moduleArray[ 0 ]; + Console::WriteLine( "myModule.FullyQualifiedName = {0}", myModule->FullyQualifiedName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp new file mode 100644 index 00000000000..38137adc219 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 1Arg Example/CPP/class1.cpp @@ -0,0 +1,51 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections; + +namespace ReflectionModule_Examples +{ + + //Define a module-level attribute. + //A very simple custom attribute. + + [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)] + public ref class MySimpleAttribute: public Attribute + { + private: + String^ name; + + public: + MySimpleAttribute( String^ newName ) + { + name = newName; + } + + }; + + + [module:MySimpleAttribute("module-level")]; + ref class MyMainClass{}; + +} + +int main() +{ + array^moduleArray; + moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false ); + + // In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + System::Reflection::Module^ myModule = moduleArray[ 0 ]; + array^attributes; + attributes = myModule->GetCustomAttributes( true ); + IEnumerator^ myEnum = attributes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "Found this attribute on myModule: {0}.", o ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp new file mode 100644 index 00000000000..3cf8509d34b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetCustomAttributes 2Arg Example/CPP/class1.cpp @@ -0,0 +1,52 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections; + +namespace ReflectionModule_Examples +{ + + // Define a very simple custom attribute + + [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)] + public ref class MySimpleAttribute: public Attribute + { + private: + String^ name; + + public: + MySimpleAttribute( String^ newName ) + { + name = newName; + } + + }; + +} + + +//Define a module-level attribute. + +[module:ReflectionModule_Examples::MySimpleAttribute("module-level")]; +int main() +{ + array^moduleArray; + moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false ); + + // In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + System::Reflection::Module^ myModule = moduleArray[ 0 ]; + array^attributes; + + //Get only MySimpleAttribute attributes for this module. + attributes = myModule->GetCustomAttributes( myModule->GetType( "ReflectionModule_Examples.MySimpleAttribute", false, false ), true ); + IEnumerator^ myEnum = attributes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "Found this attribute on myModule: {0}", o ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp new file mode 100644 index 00000000000..e7972909d1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 1Arg Example/CPP/class1.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Reflection; + +namespace ReflectionModule_Examples +{ + public ref class MyMainClass{}; + +} + +int main() +{ + array^moduleArray; + moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false ); + + //In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + Module^ myModule = moduleArray[ 0 ]; + Type^ myType; + myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass" ); + Console::WriteLine( "Got type: {0}", myType ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp new file mode 100644 index 00000000000..7c898abb0c9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 2Arg Example/CPP/class1.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Reflection; + +namespace ReflectionModule_Examples +{ + public ref class MyMainClass{}; + +} + +int main() +{ + array^moduleArray; + moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false ); + + //In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + Module^ myModule = moduleArray[ 0 ]; + Type^ myType; + myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false ); + Console::WriteLine( "Got type: {0}", myType ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp new file mode 100644 index 00000000000..3759068bbe0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.GetType 3Arg Example/CPP/class1.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Reflection; + +namespace ReflectionModule_Examples +{ + public ref class MyMainClass{}; + +} + +int main() +{ + array^moduleArray; + moduleArray = ReflectionModule_Examples::MyMainClass::typeid->Assembly->GetModules( false ); + + //In a simple project with only one module, the module at index + // 0 will be the module containing this class. + Module^ myModule = moduleArray[ 0 ]; + Type^ myType; + myType = myModule->GetType( "ReflectionModule_Examples.MyMainClass", false, false ); + Console::WriteLine( "Got type: {0}", myType ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp new file mode 100644 index 00000000000..651c5025f0d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsDefined Example/CPP/class1.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::Reflection; + +namespace ReflectionModule_Examples +{ + + //A very simple custom attribute. + + [AttributeUsage(AttributeTargets::Class|AttributeTargets::Module)] + public ref class MySimpleAttribute: public Attribute + { + private: + String^ name; + + public: + MySimpleAttribute( String^ newName ) + { + name = newName; + } + + }; + +} + + +//Define a module-level attribute. + +[module:ReflectionModule_Examples::MySimpleAttribute("module-level")]; +int main() +{ + array^moduleArray; + moduleArray = ReflectionModule_Examples::MySimpleAttribute::typeid->Assembly->GetModules( false ); + + //In a simple project with only one module, the module at index + // 0 will be the module containing these classes. + System::Reflection::Module^ myModule = moduleArray[ 0 ]; + Type^ myType; + myType = myModule->GetType( "ReflectionModule_Examples.MySimpleAttribute" ); + Console::WriteLine( "IsDefined(MySimpleAttribute) = {0}", myModule->IsDefined( myType, false ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp new file mode 100644 index 00000000000..41922a945e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.IsResource Example/CPP/class1.cpp @@ -0,0 +1,16 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + array^moduleArray; + moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); + + //In a simple project with only one module, the module at index + // 0 will be the module containing this class. + Module^ myModule = moduleArray[ 0 ]; + Console::WriteLine( "myModule->IsResource() = {0}", myModule->IsResource() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp new file mode 100644 index 00000000000..bd17af9afb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Reflection.Module.ToString Example/CPP/class1.cpp @@ -0,0 +1,16 @@ + +// +using namespace System; +using namespace System::Reflection; +int main() +{ + array^moduleArray; + moduleArray = Assembly::GetExecutingAssembly()->GetModules( false ); + + //In a simple project with only one module, the module at index + // 0 will be the module containing this class. + Module^ myModule = moduleArray[ 0 ]; + Console::WriteLine( "myModule->ToString returns: {0}", myModule ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp new file mode 100644 index 00000000000..c07a0a5476f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/resxresourcereader.cpp @@ -0,0 +1,30 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Resources; +using namespace System::Collections; +void main() +{ + + // Create a ResXResourceReader for the file items.resx. + ResXResourceReader^ rsxr = gcnew ResXResourceReader( "items.resx" ); + + + // Iterate through the resources and display the contents to the console. + IEnumerator^ myEnum = rsxr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ d = safe_cast(myEnum->Current); + Console::WriteLine( "{0}:\t {1}", d->Key, d->Value ); + } + + + //Close the reader. + rsxr->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp new file mode 100644 index 00000000000..d1d5faf2d6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResXResourceReader Example/CPP/useresxdatanodes.cpp @@ -0,0 +1,112 @@ +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Resources; +using namespace System::ComponentModel::Design; + +namespace UseDataNodesExample +{ + public ref class Program + { + public: + static void Main() + { + Console::WriteLine("\nEnumerating as data items..."); + EnumResourceItems("Resource1.resx", false); + + Console::WriteLine("\nEnumerating as data nodes..."); + EnumResourceItems("Resource1.resx", true); + } + + static void EnumResourceItems(String^ resxFile, bool useDataNodes) + { + ResXResourceReader^ reader = gcnew ResXResourceReader(resxFile); + + reader->UseResXDataNodes = useDataNodes; + + // + // Enumerate using IEnumerable.GetEnumerator(). + Console::WriteLine("\n Default enumerator:"); + for each (DictionaryEntry entry in reader) + { + ShowResourceItem(entry, useDataNodes); + } + // + + // + // Enumerate using GetMetadataEnumerator() + IDictionaryEnumerator^ metadataEnumerator = reader->GetMetadataEnumerator(); + + Console::WriteLine("\n MetadataEnumerator:"); + while (metadataEnumerator->MoveNext()) + { + ShowResourceItem(metadataEnumerator->Entry, useDataNodes); + } + // + + // + // Enumerate using GetEnumerator() + IDictionaryEnumerator^ enumerator = reader->GetEnumerator(); + + Console::WriteLine("\n Enumerator:"); + while (enumerator->MoveNext()) + { + ShowResourceItem(enumerator->Entry, useDataNodes); + } + // + delete reader; + } + + static void ShowResourceItem(DictionaryEntry entry, bool isDataNode) + { + // Use a nullptr type resolver. + ITypeResolutionService^ typeres = nullptr; + ResXDataNode^ dnode; + + if (isDataNode) + { + // Display from node info. + dnode = (ResXDataNode^)entry.Value; + Console::WriteLine(" {0}={1}", dnode->Name, dnode->GetValue(typeres)); + } + else + { + // Display as DictionaryEntry info. + Console::WriteLine(" {0}={1}", entry.Key, entry.Value); + } + } + }; +} + +int main() +{ + UseDataNodesExample::Program::Main(); +} +// The example program will have the following output: +// +// Enumerating as data items... +// +// Default enumerator: +// DataSample=Sample DATA value +// +// MetadataEnumerator: +// MetadataSample=Sample METADATA value +// +// Enumerator: +// DataSample=Sample DATA value +// +// Enumerating as data nodes... +// +// Default enumerator: +// DataSample=Sample DATA value +// MetadataSample=Sample METADATA value +// +// MetadataEnumerator: +// +// Enumerator: +// DataSample=Sample DATA value +// MetadataSample=Sample METADATA value +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp new file mode 100644 index 00000000000..07b62bf13b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceReader.GetEnumerator Example/CPP/getenumerator.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::Resources; +using namespace System::Collections; +int main() +{ + + // Create a ResourceReader for the file items.resources. + ResourceReader^ rr = gcnew ResourceReader( "items.resources" ); + + // Create an IDictionaryEnumerator* to iterate through the resources. + IDictionaryEnumerator^ id = rr->GetEnumerator(); + + // Iterate through the resources and display the contents to the console. + while ( id->MoveNext() ) + Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value ); + + rr->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp new file mode 100644 index 00000000000..8f81922ead1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceSet.GetEnumerator/CPP/getenumerator.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::Resources; +using namespace System::Collections; +int main() +{ + + // Create a ResourceSet for the file items.resources. + ResourceSet^ rs = gcnew ResourceSet( "items.resources" ); + + // Create an IDictionaryEnumerator* to read the data in the ResourceSet. + IDictionaryEnumerator^ id = rs->GetEnumerator(); + + // Iterate through the ResourceSet and display the contents to the console. + while ( id->MoveNext() ) + Console::WriteLine( "\n [{0}] \t {1}", id->Key, id->Value ); + + rs->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp new file mode 100644 index 00000000000..b782b33e9ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter Cstr1 Example/CPP/resourcewritercstr1.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::Resources; +using namespace System::IO; +int main() +{ + + // Create a file stream to encapsulate items.resources. + FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); + + // Open a resource writer to write from the stream. + IResourceWriter^ writer = gcnew ResourceWriter( fs ); + + // Add resources to the resource writer. + writer->AddResource( "String 1", "First String" ); + writer->AddResource( "String 2", "Second String" ); + writer->AddResource( "String 3", "Third String" ); + + // Write the resources to the stream, and close it. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp new file mode 100644 index 00000000000..f96fb6c9ed2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Dispose Example/CPP/resourcewriterdispose.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::Resources; +using namespace System::IO; +int main() +{ + // Create a file stream to encapsulate items.resources. + FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); + + // Open a resource writer to write from the stream. + IResourceWriter^ writer = gcnew ResourceWriter( fs ); + + // Add resources to the resource writer. + writer->AddResource( "String 1", "First String" ); + writer->AddResource( "String 2", "Second String" ); + writer->AddResource( "String 3", "Third String" ); + + // Write the resources to the stream, + // and clean up all resources associated with the writer. + // Calling Dispose is equivalent to calling Close. + writer->~IResourceWriter(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp new file mode 100644 index 00000000000..ae4c0f1b512 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Resources.ResourceWriter.Generate Example/CPP/resourcewritergenerate.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Resources; +using namespace System::IO; +int main() +{ + + // Create a file stream to encapsulate items.resources. + FileStream^ fs = gcnew FileStream( "items.resources",FileMode::OpenOrCreate,FileAccess::Write ); + + // Open a resource writer to write from the stream. + IResourceWriter^ writer = gcnew ResourceWriter( fs ); + + // Add resources to the resource writer. + writer->AddResource( "String 1", "First String" ); + writer->AddResource( "String 2", "Second String" ); + writer->AddResource( "String 3", "Third String" ); + + // Generate the resources, and close the writer. + writer->Generate(); + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp new file mode 100644 index 00000000000..caaabb17d70 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeCompatibilityAttribute/cpp/sample.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Runtime::CompilerServices; + +[assembly:RuntimeCompatibilityAttribute(WrapNonExceptionThrows = false)]; + +void run() +{ + Console::WriteLine("The RuntimeCompatibilityAttribute was applied to disable exception wrapping."); +} + +int main() +{ + run(); + + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp new file mode 100644 index 00000000000..851d140008f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.CompilerServices.RuntimeWrappedException/cpp/sample.cpp @@ -0,0 +1,26 @@ +// +using namespace System; +using namespace System::Runtime::CompilerServices; + +[assembly:RuntimeCompatibilityAttribute(WrapNonExceptionThrows = true)]; + +void run() +{ + try + { + throw gcnew String("This is a string"); + + } + catch(RuntimeWrappedException^ e) + { + Console::WriteLine("RuntimeWrappedException caught!"); + } +} + +int main() +{ + run(); + + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp new file mode 100644 index 00000000000..cc68dfa8f88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.ConvertTypelibToASSembly/CPP/convert1.cpp @@ -0,0 +1,52 @@ + +// Convert::cpp +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; + +enum class RegKind +{ + RegKind_Default, RegKind_Register, RegKind_None +}; + +ref class ConversionEventHandler: public ITypeLibImporterNotifySink +{ +public: + virtual void ReportEvent( ImporterEventKind eventKind, int eventCode, String^ eventMsg ) + { + + // handle warning event here... + } + + virtual Assembly^ ResolveRef( Object^ typeLib ) + { + + // resolve reference here and return a correct assembly... + return nullptr; + } + +}; + + +[DllImport("oleaut32.dll",CharSet=CharSet::Unicode,PreserveSig=false)] +extern void LoadTypeLibEx( String^ strTypeLibName, RegKind regkind, + [MarshalAs(UnmanagedType::Interface)] interior_ptr typeLib ); + +int main() +{ + Object^ typeLib = gcnew Object; + LoadTypeLibEx( "SHDocVw.dll", RegKind::RegKind_None, &typeLib ); + if ( typeLib == nullptr ) + { + Console::WriteLine( "LoadTypeLibEx failed." ); + return 0; + } + + TypeLibConverter^ converter = gcnew TypeLibConverter; + ConversionEventHandler^ eventHandler = gcnew ConversionEventHandler; + AssemblyBuilder^ asmb = converter->ConvertTypeLibToAssembly( typeLib, "ExplorerLib.dll", (System::Runtime::InteropServices::TypeLibImporterFlags)0, eventHandler, nullptr, nullptr, nullptr, nullptr ); + asmb->Save( "ExplorerLib.dll" ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp new file mode 100644 index 00000000000..ba7d39004e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.MarshalAsAttribute.SizeParamIndex/CPP/marshalas.sizeparamindex.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Runtime::InteropServices; + +// Force the layout of your fields to the C-style struct layout. +// Without this, the .NET Framework will reorder your fields. + +[StructLayoutAttribute(LayoutKind::Sequential)] +value struct Vertex +{ +public: + float x; + float y; + float z; +}; + + +// Add [In] or [In, Out] attributes as appropriate. +// Marshal as a C-style array of Vertex, where the second (SizeParamIndex is zero-based) +// parameter (size) contains the count of array elements. + +[DllImport("SomeDLL.dll")] +extern void SomeUnsafeMethod( [MarshalAs(UnmanagedType::LPArray,SizeParamIndex=1)]array^data, long size ); +int main() +{ + array^verts = gcnew array(3); + SomeUnsafeMethod( verts, verts->Length ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp new file mode 100644 index 00000000000..e4e62835e32 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Runtime.InteropServices.TypelibConverter.ConvertAssemblyToTypelib1/CPP/convert2.cpp @@ -0,0 +1,49 @@ + +// +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; +using namespace System::Runtime::InteropServices; + +[ComImport, +GuidAttribute("00020406-0000-0000-C000-000000000046"), +InterfaceTypeAttribute(ComInterfaceType::InterfaceIsIUnknown), +ComVisible(false)] +interface class UCOMICreateITypeLib +{ + void CreateTypeInfo(); + void SetName(); + void SetVersion(); + void SetGuid(); + void SetDocString(); + void SetHelpFileName(); + void SetHelpContext(); + void SetLcid(); + void SetLibFlags(); + void SaveAllChanges(); +}; + +public ref class ConversionEventHandler: public ITypeLibExporterNotifySink +{ +public: + virtual void ReportEvent( ExporterEventKind eventKind, int eventCode, String^ eventMsg ) + { + // Handle the warning event here. + } + + virtual Object^ ResolveRef( Assembly^ a ) + { + // Resolve the reference here and return a correct type library. + return nullptr; + } +}; + +int main() +{ + Assembly^ a = Assembly::LoadFrom( "MyAssembly.dll" ); + TypeLibConverter^ converter = gcnew TypeLibConverter; + ConversionEventHandler^ eventHandler = gcnew ConversionEventHandler; + UCOMICreateITypeLib^ typeLib = dynamic_cast(converter->ConvertAssemblyToTypeLib( a, "MyTypeLib.dll", static_cast(0), eventHandler )); + typeLib->SaveAllChanges(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp new file mode 100644 index 00000000000..08370f3519c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.AllowPartiallyTrustedCallersAttribute/CPP/AllowPartiallyTrustedCallersAttribute.cpp @@ -0,0 +1,150 @@ + +//#pragma comment(linker, "/CLRUNMANAGEDCODECHECK:NO") +// +// The following HTML code can be used to call the user control in this sample. +// +// +// +// +// +//

+// +// +// To run this test control you must create a strong name key, snkey.snk, and +// a code group that gives full trust to assemblies signed with snkey.snk. +// The user control displays an OpenFileDialog box, then displays a text box containing the name of +// the file selected and a list box that displays the contents of the file. The selected file must +// contain text in order for the control to display the data properly. +// Caution This sample demonstrates the use of the Assert method. Calling Assert removes the +// requirement that all code in the call chain must be granted permission to access the specified +// resource, it can open up security vulnerabilities if used incorrectly or inappropriately. Therefore, +// it should be used with great caution. Assert should always be followed with a RevertAssert +// command to restore the security settings. +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::IO; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; + +// This strong name key is used to create a code group that gives permissions to this assembly. +// The AllowPartiallyTrustedCallersAttribute requires the assembly to be signed with a strong name key. +// This attribute is necessary since the control is called by either an intranet or Internet +// Web page that should be running under restricted permissions. +// The userControl1 displays an OpenFileDialog box, then displays a text box containing the name of +// the file selected and a list box that displays the contents of the file. The selected file must +// contain text in order for the control to display the data properly. + +[assembly:AssemblyKeyFile("snKey.snk")]; +[assembly:AssemblyVersion("1.0.0.0")]; +[assembly:AllowPartiallyTrustedCallers]; +public ref class UserControl1: public System::Windows::Forms::UserControl +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::ListBox^ listBox1; + + // Required designer variable. + System::ComponentModel::Container^ components; + +public: +// Demand the zone requirement for the calling application. +[ZoneIdentityPermission(SecurityAction::Demand, Zone = SecurityZone::Intranet)] + UserControl1() + { + + // This call is required by the Windows.Forms Form Designer. + InitializeComponent(); + + // The OpenFileDialog box should not require any special permissions. + OpenFileDialog^ fileDialog = gcnew OpenFileDialog; + if ( fileDialog->ShowDialog() == DialogResult::OK ) + { + + // Reading the name of the selected file from the OpenFileDialog box + // and reading the file requires FileIOPermission. The user control should + // have this permission granted through its code group; the Web page that calls the + // control should not have this permission. The Assert command prevents a stack walk + // that would fail because the caller does not have the required FileIOPermission. + // The use of Assert can open up security vulnerabilities if used incorrectly or + // inappropriately. Therefore, it should be used with great caution. + // The Assert command should be followed by a RevertAssert as soon as the file operation + // is completed. + (gcnew FileIOPermission( PermissionState::Unrestricted ))->Assert(); + textBox1->Text = fileDialog->FileName; + + // Display the contents of the file in the text box. + FileStream^ fsIn = gcnew FileStream( textBox1->Text,FileMode::Open,FileAccess::Read,FileShare::Read ); + StreamReader^ sr = gcnew StreamReader( fsIn ); + + // Process every line in the file + for ( String ^ Line = sr->ReadLine(); Line != nullptr; Line = sr->ReadLine() ) + { + listBox1->Items->Add( Line ); + + } + + // file operations. + FileIOPermission::RevertAssert(); + } + } + +private: + + ///

+ /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 208, 112 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 320, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + this->textBox1->TextChanged += gcnew System::EventHandler( this,&UserControl1::textBox1_TextChanged ); + + // + // listBox1 + // + this->listBox1->Location = System::Drawing::Point( 200, 184 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 336, 108 ); + this->listBox1->TabIndex = 1; + + // + // UserControl1 + // + this->Controls->Add( this->listBox1 ); + this->Controls->Add( this->textBox1 ); + this->Name = "UserControl1"; + this->Size = System::Drawing::Size( 592, 400 ); + this->Load += gcnew System::EventHandler( this,&UserControl1::UserControl1_Load ); + this->ResumeLayout( false ); + } + + void UserControl1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + + void textBox1_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + +}; + +//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp new file mode 100644 index 00000000000..5a67133635d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcrypto.cpp @@ -0,0 +1,320 @@ +// This class creates a custom crytographic object based on the asymmetric +// algorithm by extending the abstract base class AsymmetricAlgorithm. +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Text; +using namespace System::Security::Cryptography; +using namespace System::Reflection; + +[assembly: AssemblyKeyFile("CustomCrypto.snk")]; +[assembly: AssemblyVersion("1.0.0.0")]; +[assembly: CLSCompliant(true)]; +namespace Contoso +{ + // Define a CustomCrypto class that inherits from the AsymmetricAlgorithm + // class. + public ref class CustomCrypto : + public System::Security::Cryptography::AsymmetricAlgorithm + { + // Declare local member variables. + private: + CspParameters^ cryptoServiceParameters; + array^ customValidKeySizes; + + // Initialize a CustomCrypto with the default key size of 8. + public: + CustomCrypto() + { + customValidKeySizes = + gcnew array{gcnew KeySizes(8, 64, 8)}; + this->KeySize = 8; + } + + // Initialize a CustomCrypto with the specified key size. + public: + CustomCrypto(int keySize) + { + customValidKeySizes = + gcnew array{gcnew KeySizes(8, 64, 8)}; + this->KeySize = keySize; + } + + // Accessor function for keySizes member variable. + public: + property array^ LegalKeySizes + { + virtual array^ get() override + { + return (array^)customValidKeySizes->Clone(); + } + } + + // Modify the KeySizeValue property inherited from the Asymmetric + // class. Prior to setting the value, ensure it falls within the + // range identified in the local keySizes member variable. + // + public: + property int KeySize + { + virtual int get() override + { + return KeySizeValue; + } + + virtual void set(int value) override + { + for (int i = 0; i < customValidKeySizes->Length; i++) + { + if (customValidKeySizes[i]->SkipSize == 0) + { + if (customValidKeySizes[i]->MinSize == value) + { + KeySizeValue = value; + return; + } + } + else + { + for (int j = customValidKeySizes[i]->MinSize; + j <= customValidKeySizes[i]->MaxSize; + j += customValidKeySizes[i]->SkipSize) + { + if (j == value) + { + KeySizeValue = value; + return; + } + } + } + } + + // If the key does not fall within the range identified + // in the keySizes member variable, throw an exception. + throw gcnew CryptographicException("Invalid key size."); + } + } + // + + // Initialize the parameters with default values. + public: + void InitializeParameters() + { + cryptoServiceParameters = gcnew CspParameters(); + cryptoServiceParameters->ProviderName = "Contoso"; + cryptoServiceParameters->KeyContainerName = "SecurityBin1"; + cryptoServiceParameters->KeyNumber = 1; + cryptoServiceParameters->ProviderType = 2; + } + + // Parse specified xmlString for values to populate the CspParams + // + // Expected XML schema: + // + // + // + // + // + // + public: + virtual void FromXmlString(String^ xmlString) override + { + if (xmlString != nullptr) + { + XmlDocument^ document = gcnew XmlDocument(); + document->LoadXml(xmlString); + XmlNode^ firstNode = document->FirstChild; + XmlNodeList^ nodeList; + + // Assemble parameters from values in each XML element. + cryptoServiceParameters = gcnew CspParameters(); + + // KeyContainerName is optional. + nodeList = + document->GetElementsByTagName("KeyContainerName"); + if (nodeList->Count > 0) + { + cryptoServiceParameters->KeyContainerName = + nodeList->Item(0)->InnerText; + } + + // KeyNumber is optional. + nodeList = document->GetElementsByTagName("KeyNumber"); + if (nodeList->Count > 0) + { + cryptoServiceParameters->KeyNumber = + Int32::Parse(nodeList->Item(0)->InnerText); + } + + // ProviderName is optional. + nodeList = document->GetElementsByTagName("ProviderName"); + if (nodeList->Count > 0) + { + cryptoServiceParameters->ProviderName = + nodeList->Item(0)->InnerText; + } + + // ProviderType is optional. + nodeList = document->GetElementsByTagName("ProviderType"); + if (nodeList->Count > 0) + { + cryptoServiceParameters->ProviderType = + Int32::Parse(nodeList->Item(0)->InnerText); + } + } + else + { + throw gcnew ArgumentNullException("xmlString"); + } + } + // + + // Create an XML string representation of the parameters in the + // current customCrypto object. + // + public: + virtual String^ ToXmlString(bool includePrivateParameters) override + { + String^ keyContainerName = ""; + String^ keyNumber = ""; + String^ providerName = ""; + String^ providerType = ""; + + if (cryptoServiceParameters != nullptr) + { + keyContainerName = + cryptoServiceParameters->KeyContainerName; + keyNumber = cryptoServiceParameters->KeyNumber.ToString(); + providerName = cryptoServiceParameters->ProviderName; + providerType = + cryptoServiceParameters->ProviderType.ToString(); + } + + StringBuilder^ sb = gcnew StringBuilder(); + sb->Append(""); + + sb->Append(""); + sb->Append(keyContainerName); + sb->Append(""); + + sb->Append(""); + sb->Append(keyNumber); + sb->Append(""); + + sb->Append(""); + sb->Append(providerName); + sb->Append(""); + + sb->Append(""); + sb->Append(providerType); + sb->Append(""); + + sb->Append(""); + return(sb->ToString()); + } + // + + // Return the name for the key exchange algorithm. + // + public: + property String^ KeyExchangeAlgorithm + { + virtual String^ get() override + { + return "RSA-PKCS1-KeyEx"; + } + } + // + + // Retrieves the name of the signature alogrithm. + // + // This example uses the SHA1 algorithm. + // Due to collision problems with SHA1, Microsoft recommends SHA256 or better. + + public: + property String^ SignatureAlgorithm + { + virtual String^ get() override + { + return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; + } + } + // + + // Required member for implementing the AsymmetricAlgorithm class. + protected: + virtual ~CustomCrypto() + { + } + + // Call the Create method using the CustomCrypto assembly name. + // + // The create function attempts to create a CustomCrypto + // object using the assembly name. This functionality requires + // modification of the machine.config file. Add the following + // section to the configuration element and modify the values + // of the cryptoClass to reflect what isinstalled + // in your machines GAC. + // + // + // + // + // + // + // + // + // + // + // + + public: + static CustomCrypto^ Create() + { + return Create("CustomCrypto"); + } + // + + // Create a CustomCrypto object by calling CrytoConfig's + // CreateFromName method and casting the type to CustomCrypto. + // + // The create function attempts to create a CustomCrypto object + // using the assembly name. This functionality requires + // modification of the machine.config file. Add the following + // section to the configuration element and modify the values + // of the cryptoClass to reflect what is installed + // in your machines GAC. + // + // + // + // + // + // + // + // + // + // + // + + public: + static CustomCrypto^ Create(String^ algorithmName) + { + return (CustomCrypto^) + CryptoConfig::CreateFromName(algorithmName); + } + // + }; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp new file mode 100644 index 00000000000..0de4308d5f7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.AsymmetricAlgorithm/cpp/customcryptoimpl.cpp @@ -0,0 +1,129 @@ + +// This sample demonstrates how to implement a custom asymmetric algorithm +// inherited from the AsymmetricAlgorithm base class. +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Text; +using namespace System::Security::Cryptography; + +// Display the properties of the specified CustomCrypto object to the +// console. +static void DisplayProperties(Contoso::CustomCrypto^ customCryptoAlgorithm) +{ + // Retrieve the class description for the customCrypto object. + // + String^ classDescription = customCryptoAlgorithm->ToString(); + // + + Console::WriteLine(classDescription); + Console::WriteLine("KeyExchangeAlgorithm: {0}", + customCryptoAlgorithm->KeyExchangeAlgorithm); + Console::WriteLine("SignatureAlgorithm: {0}", + customCryptoAlgorithm->SignatureAlgorithm); + Console::WriteLine("KeySize: {0}", + customCryptoAlgorithm->KeySize); + Console::WriteLine("Parameters described in Xml format:"); + Console::WriteLine(customCryptoAlgorithm->ToXmlString(true)); + + // Display the MinSize, MaxSize, and SkipSize properties of + // each KeySize item in the local keySizes member variable. + // + array^ legalKeySizes = customCryptoAlgorithm->LegalKeySizes; + for (int i = 0; i < legalKeySizes->Length; i++) + { + Console::WriteLine( + "Keysize{0} min, max, step: {1}, {2}, {3}, ", i, + legalKeySizes[i]->MinSize, + legalKeySizes[i]->MaxSize, + legalKeySizes[i]->SkipSize); + } + // +} + +[STAThread] +int main() +{ + // Construct a CustomCrypto object and initialize its + // CspParameters. + Contoso::CustomCrypto^ customCryptoAlgorithm = gcnew Contoso::CustomCrypto(); + customCryptoAlgorithm->InitializeParameters(); + + // Display properties of the current customCrypto object. + Console::WriteLine( + "*** CustomCrypto created with default parameters:"); + DisplayProperties(customCryptoAlgorithm); + + // Release all the resources used by this instance of + // CustomCrypto. + // + customCryptoAlgorithm->Clear(); + // + + customCryptoAlgorithm = gcnew Contoso::CustomCrypto(64); + // Create new parameters and set them by using the FromXmlString + // method. + String^ parameterXml = "" + + "Contoso" + + "SecurityBin2" + + "1" + + "2" + + ""; + customCryptoAlgorithm->FromXmlString(parameterXml); + + // Display the properties of a customCrypto object created with + // custom parameters. + Console::WriteLine( + "{0}*** CustomCrypto created with custom parameters:", Environment::NewLine); + DisplayProperties(customCryptoAlgorithm); + + // Create an object by using the assembly name. + Contoso::CustomCrypto^ cryptoFromAssembly = + Contoso::CustomCrypto::Create("CustomCrypto"); + if (cryptoFromAssembly != nullptr) + { + Console::WriteLine("{0}*** Successfully created " + + "CustomCrypto from the Create method.", Environment::NewLine); + DisplayProperties(cryptoFromAssembly); + } + else + { + Console::WriteLine("Unable to create CustomCrypto from " + + "the Create method."); + } + + Console::WriteLine( + "This sample completed successfully; press Enter to exit."); + Console::ReadLine(); +} + +// +// This sample produces the following output: +// +// *** CustomCrypto created with default parameters: +// Contoso.vbCustomCrypto +// KeyExchangeAlgorithm: RSA-PKCS1-KeyEx +// SignatureAlgorithm: http://www.w3.org/2000/09/xmldsig#rsa-sha1 +// KeySize: 8 +// Parameters described in Xml format: +// SecurityBin1 +// 1Contoso +// 2 +// Keysize0 min, max, step: 8, 64, 8, +// +// *** CustomCrypto created with custom parameters: +// Contoso.vbCustomCrypto +// KeyExchangeAlgorithm: RSA-PKCS1-KeyEx +// SignatureAlgorithm: http://www.w3.org/2000/09/xmldsig#rsa-sha1 +// KeySize: 64 +// Parameters described in Xml format: +// SecurityBin2 +// 1Contoso +// 2 +// Keysize0 min, max, step: 8, 64, 8, +// Unable to create CustomCrypto from the Create method +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp new file mode 100644 index 00000000000..713b1c01bb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoAPITransform/CPP/members.cpp @@ -0,0 +1,199 @@ +// This sample demonstrates how to use each member of the CryptoAPITransform +// class. +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Collections; +using namespace System::Text; + +ref class Members +{ +private: + + // Use a public service provider for encryption and decryption. + static DESCryptoServiceProvider^ des = gcnew DESCryptoServiceProvider; + +public: + [STAThread] + static void Main() + { + String^ message = L"012345678901234567890"; + array^sourceBytes = Encoding::ASCII->GetBytes( message ); + Console::WriteLine( L"** Phrase to be encoded: {0}", message ); + array^encodedBytes = EncodeBytes( sourceBytes ); + Console::WriteLine( L"** Phrase after encoding: {0}", + Encoding::ASCII->GetString( encodedBytes ) ); + array^decodedBytes = DecodeBytes( encodedBytes ); + Console::WriteLine( L"** Phrase after decoding: {0}", + Encoding::ASCII->GetString( decodedBytes ) ); + Console::WriteLine( L"Sample ended successfully; " + L"press Enter to continue." ); + Console::ReadLine(); + } + +private: + // Encode the specified byte array by using CryptoAPITranform. + static array^ EncodeBytes( array^sourceBytes ) + { + int currentPosition = 0; + array^targetBytes = gcnew array(1024); + int sourceByteLength = sourceBytes->Length; + + // Create a DES encryptor from this instance to perform encryption. + CryptoAPITransform^ cryptoTransform = + static_cast(des->CreateEncryptor()); + + // Retrieve the block size to read the bytes. + // + int inputBlockSize = cryptoTransform->InputBlockSize; + // + + // Retrieve the key handle. + // + IntPtr keyHandle = cryptoTransform->KeyHandle; + // + + // Retrieve the block size to write the bytes. + // + int outputBlockSize = cryptoTransform->OutputBlockSize; + // + + try + { + // Determine if multiple blocks can be transformed. + // + if ( cryptoTransform->CanTransformMultipleBlocks ) + // + { + int numBytesRead = 0; + while ( sourceByteLength - currentPosition >= inputBlockSize ) + { + // Transform the bytes from currentPosition in the + // sourceBytes array, writing the bytes to the targetBytes + // array. + // + numBytesRead = cryptoTransform->TransformBlock( + sourceBytes, currentPosition, inputBlockSize, + targetBytes, currentPosition ); + // + // Advance the current position in the sourceBytes array. + currentPosition += numBytesRead; + } + + // Transform the final block of bytes. + // + array^finalBytes = cryptoTransform->TransformFinalBlock( + sourceBytes, currentPosition, sourceByteLength - currentPosition ); + // + + // Copy the contents of the finalBytes array to the + // targetBytes array. + finalBytes->CopyTo( targetBytes, currentPosition ); + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Caught unexpected exception:{0}", ex ); + } + + // Determine if the current transform can be reused. + // + if ( !cryptoTransform->CanReuseTransform ) + // + { + // Free up any used resources. + // + cryptoTransform->Clear(); + // + } + + // Trim the extra bytes in the array that were not used. + return TrimArray( targetBytes ); + } + + // Decode the specified byte array using CryptoAPITranform. + static array^ DecodeBytes( array^sourceBytes ) + { + array^targetBytes = gcnew array(1024); + int currentPosition = 0; + + // Create a DES decryptor from this instance to perform decryption. + CryptoAPITransform^ cryptoTransform = + static_cast(des->CreateDecryptor()); + int inputBlockSize = cryptoTransform->InputBlockSize; + int sourceByteLength = sourceBytes->Length; + try + { + int numBytesRead = 0; + while ( sourceByteLength - currentPosition >= inputBlockSize ) + { + // Transform the bytes from currentposition in the + // sourceBytes array, writing the bytes to the targetBytes + // array. + numBytesRead = cryptoTransform->TransformBlock( + sourceBytes, currentPosition, inputBlockSize, + targetBytes, currentPosition ); + + // Advance the current position in the source array. + currentPosition += numBytesRead; + } + + // Transform the final block of bytes. + array^finalBytes = cryptoTransform->TransformFinalBlock( + sourceBytes, currentPosition, sourceByteLength - currentPosition ); + + // Copy the contents of the finalBytes array to the targetBytes + // array. + finalBytes->CopyTo( targetBytes, currentPosition ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Caught unexpected exception:{0}", ex ); + } + + // Strip out the second block of bytes. + Array::Copy(targetBytes, (inputBlockSize * 2), targetBytes, inputBlockSize, targetBytes->Length - (inputBlockSize * 2)); + + + // Trim the extra bytes in the array that were not used. + return TrimArray( targetBytes ); + } + + // Resize the dimensions of the array to a size that contains only valid + // bytes. + static array^ TrimArray( array^targetArray ) + { + IEnumerator^ enum1 = targetArray->GetEnumerator(); + int i = 0; + while ( enum1->MoveNext() ) + { + if ( enum1->Current->ToString()->Equals( L"0" ) ) + { + break; + } + i++; + } + + // Create a new array with the number of valid bytes. + array^returnedArray = gcnew array(i); + for ( int j = 0; j < i; j++ ) + { + returnedArray[ j ] = targetArray[ j ]; + } + return returnedArray; + } +}; + +int main() +{ + Members::Main(); +} + +// +// This sample produces the following output: +// +// ** Phrase to be encoded: 012345678901234567890 +// ** Phrase after encoding: AIGC(+b7X?^djAU?15ve?o +// ** Phrase after decoding: 012345678901234567890 +// Sample ended successfully; press Enter to continue. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp new file mode 100644 index 00000000000..49ba079bd65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptoConfig/CPP/members.cpp @@ -0,0 +1,71 @@ +// This sample demonstrates how to use each member of the CryptoConfig class. +// +using namespace System; +using namespace System::Security::Cryptography; + +int main() +{ + // Create a CryptoConfig object to store configuration information. + // + CryptoConfig^ cryptoConfig = gcnew CryptoConfig; + // + + // Retrieve the class path for CryptoConfig. + // + String^ classDescription = cryptoConfig->ToString(); + // + + // Create a new SHA1 provider. + // + SHA1CryptoServiceProvider^ SHA1alg = + dynamic_cast( + CryptoConfig::CreateFromName( L"SHA1" )); + // + + // Create an RSAParameters with the TestContainer key container. + // + CspParameters^ parameters = gcnew CspParameters; + parameters->KeyContainerName = L"TestContainer"; + array^argsArray = gcnew array(1){ + parameters + }; + + // Instantiate the RSA provider instance accessing the TestContainer + // key container. + RSACryptoServiceProvider^ rsaProvider = + static_cast( + CryptoConfig::CreateFromName( L"RSA", argsArray )); + // + + // Use the MapNameToOID method to get an object identifier + // (OID) from the string name of the SHA1 algorithm. + // + String^ sha1Oid = CryptoConfig::MapNameToOID( L"SHA1" ); + // + + // Encode the specified object identifier. + // + array^encodedMessage = CryptoConfig::EncodeOID( sha1Oid ); + + // + // Display the results to the console. + Console::WriteLine( L"** {0} **", classDescription ); + Console::WriteLine( L"Created an RSA provider with a KeyContainerName called {0}.", + parameters->KeyContainerName ); + Console::WriteLine( L"Object identifier from the SHA1 name:{0}", + sha1Oid ); + Console::WriteLine( L"The object identifier encoded: {0}", + System::Text::Encoding::ASCII->GetString( encodedMessage ) ); + Console::WriteLine( L"This sample completed successfully; press Enter to exit." ); + Console::ReadLine(); +} + +// +// This sample produces the following output: +// +// ** System.Security.Cryptography.CryptoConfig ** +// Created an RSA provider with a KeyContainerName called TestContainer. +// Object identifier from the SHA1 name:1.3.14.3.2.26 +// The object identifier encoded: HH*((*H9 +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp new file mode 100644 index 00000000000..fc83f952401 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.CryptographicException/CPP/cryptographicexceptionmembers.cpp @@ -0,0 +1,243 @@ +// This sample demonstrates how to use each member of the +// CryptographicException class. +// +using namespace System; +using namespace System::Text; +using namespace System::Security::Cryptography; +using namespace System::Runtime::Serialization; + +ref class CryptographicExceptionMembers +{ +public: + + static void Run() + { + CryptographicExceptionMembers^ testRun = gcnew CryptographicExceptionMembers; + testRun->TestConstructors(); + testRun->ShowProperties(); + Console::WriteLine( L"This sample ended successfully; " + L" press Enter to exit." ); + Console::ReadLine(); + } + +private: + // Test each public implementation of the CryptographicException + // constructors. + void TestConstructors() + { + EmptyConstructor(); + IntConstructor(); + StringConstructor(); + StringExceptionConstructor(); + StringStringConstructor(); + } + + void EmptyConstructor() + { + // Construct a CryptographicException with no parameters. + // + CryptographicException^ cryptographicException = gcnew CryptographicException; + + // + Console::WriteLine( L"Created an empty CryptographicException." ); + } + + void IntConstructor() + { + // Construct a CryptographicException using the error code for an + // unexpected operation exception. + // + int exceptionNumber = (int)0x80131431; + CryptographicException^ cryptographicException = gcnew CryptographicException( exceptionNumber ); + // + + Console::WriteLine( L"Created a CryptographicException with the " + L"following error code: {0}", exceptionNumber ); + } + + void StringConstructor() + { + // Construct a CryptographicException using a custom error message. + // + String^ errorMessage = (L"Unexpected Operation exception."); + CryptographicException^ cryptographicException = gcnew CryptographicException( errorMessage ); + // + + Console::WriteLine( L"Created a CryptographicException with the " + L"following error message: {0}", errorMessage ); + } + + void StringExceptionConstructor() + { + // Construct a CryptographicException using a custom error message + // and an inner exception. + // + String^ errorMessage = (L"The current operation is not supported."); + NullReferenceException^ nullException = gcnew NullReferenceException; + CryptographicException^ cryptographicException = gcnew CryptographicException( errorMessage,nullException ); + // + + Console::WriteLine( L"Created a CryptographicException with the " + L"following error message: {0} and the inner exception of {1}", errorMessage, nullException ); + } + + void StringStringConstructor() + { + // Create a CryptographicException using a time format and a the + // current date. + // + String^ dateFormat = L"{0:t}"; + String^ timeStamp = (DateTime::Now.ToString()); + CryptographicException^ cryptographicException = gcnew CryptographicException( dateFormat,timeStamp ); + // + + Console::WriteLine( L"Created a CryptographicException with ({0}) as the format and ({1}) as the message.", dateFormat, timeStamp ); + } + + // Construct an invalid DSACryptoServiceProvider to throw a + // CryptographicException for introspection. + void ShowProperties() + { + try + { + // Create a DSACryptoServiceProvider with invalid provider type + // code to throw a CryptographicException exception. + CspParameters^ cspParams = gcnew CspParameters( 44 ); + DSACryptoServiceProvider^ DSAalg = gcnew DSACryptoServiceProvider( cspParams ); + } + catch ( CryptographicException^ ex ) + { + // Retrieve the link to the help file for the exception. + // + String^ helpLink = ex->HelpLink; + // + + // Retrieve the exception that caused the current + // CryptographicException exception. + // + System::Exception^ innerException = ex->InnerException; + // + + String^ innerExceptionMessage = L""; + if ( innerException != nullptr ) + { + innerExceptionMessage = innerException->ToString(); + } + + // Retrieve the message that describes the exception. + // + String^ message = ex->Message; + // + + // Retrieve the name of the application that caused the exception. + // + String^ exceptionSource = ex->Source; + // + + // Retrieve the call stack at the time the exception occurred. + // + String^ stackTrace = ex->StackTrace; + // + + // Retrieve the method that threw the exception. + // + System::Reflection::MethodBase^ targetSite = ex->TargetSite; + // + + String^ siteName = targetSite->Name; + + // Retrieve the entire exception as a single string. + // + String^ entireException = ex->ToString(); + // + + // GetObjectData + setSerializationInfo( &ex ); + + // Get the root exception that caused the current + // CryptographicException exception. + // + System::Exception^ baseException = ex->GetBaseException(); + // + + String^ baseExceptionMessage = L""; + if ( baseException != nullptr ) + { + baseExceptionMessage = baseException->Message; + } + Console::WriteLine( L"Caught an expected exception:" ); + Console::WriteLine( entireException ); + Console::WriteLine( L"\n" ); + Console::WriteLine( L"Properties of the exception are as follows:" ); + Console::WriteLine( L"Message: {0}", message ); + Console::WriteLine( L"Source: {0}", exceptionSource ); + Console::WriteLine( L"Stack trace: {0}", stackTrace ); + Console::WriteLine( L"Help link: {0}", helpLink ); + Console::WriteLine( L"Target site's name: {0}", siteName ); + Console::WriteLine( L"Base exception message: {0}", baseExceptionMessage ); + Console::WriteLine( L"Inner exception message: {0}", innerExceptionMessage ); + } + + } + + void setSerializationInfo( interior_ptr ex ) + { + // Insert information about the exception into a serialized object. + // + FormatterConverter^ formatConverter = gcnew FormatterConverter; + SerializationInfo^ serializationInfo = gcnew SerializationInfo( ( *ex)->GetType(),formatConverter ); + StreamingContext streamingContext = StreamingContext(StreamingContextStates::All); + ( *ex)->GetObjectData( serializationInfo, streamingContext ); + // + } + +}; + +void main() +{ + CryptographicExceptionMembers::Run(); +} + +// +// This sample produces the following output: +// +// Created an empty CryptographicException. +// Created a CryptographicException with the following error code: -2146233295 +// Created a CryptographicException with the following error message: +// Unexpected Operation exception. +// Created a CryptographicException with the following error message: The +// current operation is not supported. and the inner exception of +// System.NullReferenceException: Object reference not set to an instance of +// an object. +// Created a CryptographicException with ({0:t}) as the format and (2/24/2004 +// 2:13:15 PM) as the message. +// Caught an expected exception: +// System.Security.Cryptography.CryptographicException: CryptoAPI +// cryptographic service provider (CSP) for this implementation could not be +// acquired. +// at System.Security.Cryptography.DSACryptoServiceProvider..ctor(Int32 +// dwKeySize, CspParameters parameters) +// at System.Security.Cryptography.DSACryptoServiceProvider..ctor( +// CspParametersparameters) +// at CryptographicExceptionMembers.ShowProperties() in c:\inetpub\ +// vssolutions\test\testbuild\consoleapplication1\class1.cs:line 109 +// +// +// Properties of the exception are as follows: +// Message: CryptoAPI cryptographic service provider (CSP) for this +// implementation could not be acquired. +// Source: mscorlib +// Stack trace: +// at System.Security.Cryptography.DSACryptoServiceProvider..ctor( +// Int32 dwKeySize, CspParameters parameters) +// at System.Security.Cryptography.DSACryptoServiceProvider..ctor( +// CspParameters parameters) +// at CryptographicExceptionMembers.ShowProperties() in c:\inetpub\ +// vssolutions\test\testbuild\consoleapplication1\class1.cs:line 109 +// Help link: +// Target site's name: .ctor +// Base exception message: CryptoAPI cryptographic service provider (CSP) for +// this implementation could not be acquired. +// Inner exception message: +// This sample ended successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp new file mode 100644 index 00000000000..463fd5703f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureDeformatter/CPP/sample.cpp @@ -0,0 +1,50 @@ + + +// +#using + +using namespace System; +using namespace System::Security::Cryptography; +int main() +{ + try + { + + //Create a new instance of DSA. + DSA^ DSA = DSA::Create(); + + //The hash to sign. + array^Hash = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135}; + + //Create an DSASignatureFormatter object and pass it the + //DSA instance to transfer the key information. + DSASignatureFormatter^ DSAFormatter = gcnew DSASignatureFormatter( DSA ); + + //Set the hash algorithm to SHA1. + DSAFormatter->SetHashAlgorithm( "SHA1" ); + + //Create a signature for HashValue and return it. + array^SignedHash = DSAFormatter->CreateSignature( Hash ); + + //Create an DSASignatureDeformatter object and pass it the + //DSA instance to transfer the key information. + DSASignatureDeformatter^ DSADeformatter = gcnew DSASignatureDeformatter( DSA ); + + //Verify the hash and display the results to the console. + if ( DSADeformatter->VerifySignature( Hash, SignedHash ) ) + { + Console::WriteLine( "The signature was verified." ); + } + else + { + Console::WriteLine( "The signature was not verified." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp new file mode 100644 index 00000000000..bc448969175 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.DSASignatureFormatter/CPP/sample.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; +using namespace System::Security::Cryptography; +int main() +{ + try + { + + //Create a new instance of DSA. + DSA^ DSA = DSA::Create(); + + //The hash to sign. + array^Hash = {59,4,248,102,77,97,142,201,210,12,224,93,25,41,100,197,213,134,130,135}; + + //Create an DSASignatureFormatter Object* and pass it the + //DSA instance to transfer the key information. + DSASignatureFormatter^ DSAFormatter = gcnew DSASignatureFormatter( DSA ); + + //Set the hash algorithm to SHA1. + DSAFormatter->SetHashAlgorithm( "SHA1" ); + + //Create a signature for HashValue and return it. + array^SignedHash = DSAFormatter->CreateSignature( Hash ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp new file mode 100644 index 00000000000..2d3ec8ddc55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.FromBase64Transform Example/CPP/class1.cpp @@ -0,0 +1,56 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; +class MyMainClass +{ +public: + static void DecodeFromFile( String^ inFileName, String^ outFileName ) + { + FromBase64Transform^ myTransform = gcnew FromBase64Transform( FromBase64TransformMode::IgnoreWhiteSpaces ); + array^myOutputBytes = gcnew array(myTransform->OutputBlockSize); + + //Open the input and output files. + FileStream^ myInputFile = gcnew FileStream( inFileName,FileMode::Open,FileAccess::Read ); + FileStream^ myOutputFile = gcnew FileStream( outFileName,FileMode::Create,FileAccess::Write ); + + //Retrieve the file contents into a Byte array. + array^myInputBytes = gcnew array(myInputFile->Length); + myInputFile->Read( myInputBytes, 0, myInputBytes->Length ); + + //Transform the data in chunks the size of InputBlockSize. + int i = 0; + while ( myInputBytes->Length - i > 4 ) + { + myTransform->TransformBlock( myInputBytes, i, 4, myOutputBytes, 0 ); + + /*myTransform->InputBlockSize*/ + i += 4; + + /*myTransform->InputBlockSize*/ + myOutputFile->Write( myOutputBytes, 0, myTransform->OutputBlockSize ); + } + + + //Transform the final block of data. + myOutputBytes = myTransform->TransformFinalBlock( myInputBytes, i, myInputBytes->Length - i ); + myOutputFile->Write( myOutputBytes, 0, myOutputBytes->Length ); + + //Free up any used resources. + myTransform->Clear(); + myInputFile->Close(); + myOutputFile->Close(); + } + +}; + +int main() +{ + MyMainClass * m = new MyMainClass; + + //Insert your file names into this method call. + m->DecodeFromFile( "c:\\encoded.txt", "c:\\roundtrip.txt" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp new file mode 100644 index 00000000000..7ac5fae23ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeySizes/CPP/members.cpp @@ -0,0 +1,110 @@ +// This sample demonstrates how to use each member of the KeySizes class. +// + +using namespace System; +using namespace System::Security::Cryptography; + +namespace CryptographySample +{ + ref class KeySizesMembers + { + public: + static void Work() + { + // Initializes a new instance of the KeySizes class + // with the specified key values. + // + int minSize = 64; + int maxSize = 1024; + int skipSize = 64; + KeySizes^ keySizes = + gcnew KeySizes(minSize, maxSize, skipSize); + // + + // Show the values of the keys. + ShowKeys(gcnew array(1) {keySizes}, + "Custom Keys"); + + // Create a new symmetric algorithm and display its + // key values. + Aes^ aes = Aes::Create(); + ShowKeys(aes->LegalKeySizes, aes->ToString()); + Console::WriteLine("aes.blocksize:{0}", + aes->BlockSize); + + // Create a new RSA algorithm and display its key values. + RSA^ rsa = RSA::Create(); + ShowKeys(rsa->LegalKeySizes, rsa->ToString()); + Console::WriteLine("RSA KeySize =" + " {0}", + rsa->KeySize); + + Console::WriteLine("This sample completed successfully; " + "press Enter to exit."); + Console::ReadLine(); + } + + private: + // Display specified KeySize properties to the console. + static void ShowKeys(array ^ keySizes, + String^ objectName) + { + // Retrieve the first KeySizes in the array. + KeySizes^ firstKeySize = keySizes[0]; + + // Retrieve the minimum key size in bits. + // + int minKeySize = firstKeySize->MinSize; + // + + // Retrieve the maximum key size in bits. + // + int maxKeySize = firstKeySize->MaxSize; + // + + // Retrieve the interval between valid key size in bits. + // + int skipKeySize = firstKeySize->SkipSize; + // + + Console::Write("\n KeySizes retrieved from the "); + Console::WriteLine("{0} object.", objectName); + Console::WriteLine("Minimum key size bits: {0}", + minKeySize); + Console::WriteLine("Maximum key size bits: {0}", + maxKeySize); + Console::WriteLine("Interval between key size bits: {0}", + skipKeySize); + } + }; +} + +using namespace CryptographySample; + +int main() +{ + KeySizesMembers::Work(); +} +// +// This sample produces the following output: +// +// KeySizes retrieved from the Custom Keys object. +// Minimum key size bits: 64 +// Maximum key size bits: 1024 +// Interval between key size bits: 64 +// +// KeySizes retrieved from the +// System.Security.Cryptography.Aes object. +// Minimum key size bits: 128 +// Maximum key size bits: 256 +// Interval between key size bits: 64 +// aes.blocksize:128 +// +// KeySizes retrieved from the +// System.Security.Cryptography.RSA object. +// Minimum key size bits: 512 +// Maximum key size bits: 16384 +// Interval between key size bits: 64 +// RSA KeySize = 2048 +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp new file mode 100644 index 00000000000..d25c4d73ac5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.KeyedHashAlgorithm/CPP/contosokeyedhash.cpp @@ -0,0 +1,80 @@ +// This sample demonstrates how to extend the KeyedHashAlgorithm class. +// +using namespace System; +using namespace System::Security::Cryptography; + +namespace Contoso +{ + public ref class ContosoKeyedHash: public KeyedHashAlgorithm + { + private: + KeyedHashAlgorithm^ keyedCrypto; + + public: + ContosoKeyedHash( array^ rgbKey ) + { + Init( L"System.Security.Cryptography.KeyedHashAlgorithm", rgbKey ); + } + + ContosoKeyedHash( String^ keyedHashName, array^ rgbKey ) + { + Init( keyedHashName, rgbKey ); + } + + void Init( String^ keyedHashName, array^ rgbKey ) + { + // Make sure we know which algorithm to use + if ( rgbKey != nullptr ) + { + KeyValue = rgbKey; + HashSizeValue = 160; + + // Create a KeyedHashAlgorithm encryptor + if ( keyedHashName == nullptr ) + { + + // + keyedCrypto = KeyedHashAlgorithm::Create(); + // + } + else + { + // + keyedCrypto = KeyedHashAlgorithm::Create( keyedHashName ); + // + } + } + else + { + throw gcnew ArgumentNullException( L"rgbKey" ); + } + } + + // Override abstract methods from the HashAlgorithm class. + virtual void Initialize() override {} + + property array^ Key + { + // + virtual array^ get() override + { + return dynamic_cast^>(keyedCrypto->Key->Clone()); + } + + virtual void set( array^value ) override + { + keyedCrypto->Key = dynamic_cast^>(value->Clone()); + } + } + // + + protected: + virtual void HashCore( array^ , int /*ibStart*/, int /*cbSize*/ ) override {} + + virtual array^ HashFinal() override + { + return gcnew array(0); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp new file mode 100644 index 00000000000..3c77ea0c947 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.MaskGenerationMethod/CPP/maskgenerator.cpp @@ -0,0 +1,114 @@ +// This sample demonstrates how to derive from +// the MaskGenerationMethod class. +// +#using + +using namespace System; +using namespace System::Security::Cryptography; + +namespace Contoso +{ + // + ref class MaskGenerator: MaskGenerationMethod + { + private: + String^ hashNameValue; + + public: + // Initialize a mask to encrypt using the SHA256 algorithm. + MaskGenerator() + { + hashNameValue = "SHA256"; + } + + // + // Create a mask with the specified seed. + // + virtual array^ GenerateMask(array^ seed, int maskLength) override + { + HashAlgorithm^ hash; + array^ rgbCounter = gcnew array(4); + array^ targetRgb = gcnew array(maskLength); + UInt32 counter = 0; + for (int inc = 0; inc < targetRgb->Length; ) + { + ConvertIntToByteArray(counter++, rgbCounter); + hash = (HashAlgorithm^)CryptoConfig::CreateFromName( + hashNameValue); + array^ temp = gcnew array( + 4 + seed->Length); + Buffer::BlockCopy(rgbCounter, 0, temp, 0, 4); + Buffer::BlockCopy(seed, 0, temp, 4, seed->Length); + hash->ComputeHash(temp); + if (targetRgb->Length - inc > hash->HashSize / 8) + { + Buffer::BlockCopy(hash->Hash, 0, targetRgb, inc, + hash->Hash->Length); + } + else + { + Buffer::BlockCopy(hash->Hash, 0, targetRgb, inc, + targetRgb->Length - inc); + } + + inc += hash->Hash->Length; + } + return targetRgb; + } + + private: + // + // Convert the specified integer to the byte array. + void ConvertIntToByteArray(UInt32 source, + array^ targetBytes) + { + UInt32 remainder; + int inc = 0; + + // Clear the array prior to filling it. + Array::Clear(targetBytes, 0, targetBytes->Length); + while (source > 0) + { + remainder = source % 256; + targetBytes[ 3 - inc ] = (Byte)remainder; + source = (source - remainder) / 256; + inc++; + } + } + }; + + // This class demonstrates how to create the MaskGenerator class + // and call its GenerateMask member. + ref class MaskGeneratorImpl + { + public: + void static Work() + { + array^ seed = gcnew array(4){ + 0x01,0x02,0x03,0x04}; + int length = 16; + MaskGenerator^ maskGenerator = gcnew MaskGenerator; + array^ mask = maskGenerator->GenerateMask(seed, + length); + Console::WriteLine("Generated the following mask:"); + Console::WriteLine(System::Text::Encoding:: + ASCII::get()->GetString(mask)); + Console::WriteLine("This sample completed successfully;" + " press Enter to exit."); + Console::ReadLine(); + } + }; +} + +void main() +{ + Contoso::MaskGeneratorImpl::Work(); +} + +// +// This sample produces the following output: +// +// Generated the following mask: +// ?"TFd(?~OtO? +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp new file mode 100644 index 00000000000..18a61d351be --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.Encrypt/CPP/sample.cpp @@ -0,0 +1,52 @@ + + +// +#using + +using namespace System; +using namespace System::Security::Cryptography; +int main() +{ + try + { + + //initialze the Byte arrays to the public key information. + array^PublicKey = {214,46,220,83,160,73,40,39,201,155,19,202,3,11,191,178,56,74,90,36,248,103,18,144,170,163,145,87,54,61,34,220,222,207,137,149,173,14,92,120,206,222,158,28,40,24,30,16,175,108,128,35,230,118,40,121,113,125,216,130,11,24,90,48,194,240,105,44,76,34,57,249,228,125,80,38,9,136,29,117,207,139,168,181,85,137,126,10,126,242,120,247,121,8,100,12,201,171,38,226,193,180,190,117,177,87,143,242,213,11,44,180,113,93,106,99,179,68,175,211,164,116,64,148,226,254,172,147}; + array^Exponent = {1,0,1}; + + //Values to store encrypted symmetric keys. + array^EncryptedSymmetricKey; + array^EncryptedSymmetricIV; + + //Create a new instance of RSACryptoServiceProvider. + RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; + + //Create a new instance of RSAParameters. + RSAParameters RSAKeyInfo; + + //Set RSAKeyInfo to the public key values. + RSAKeyInfo.Modulus = PublicKey; + RSAKeyInfo.Exponent = Exponent; + + //Import key parameters into RSA. + RSA->ImportParameters( RSAKeyInfo ); + + //Create a new instance of the Aes class. + Aes^ aes = Aes::Create(); + + //Encrypt the symmetric key and IV. + EncryptedSymmetricKey = RSA->Encrypt( aes->Key, false ); + EncryptedSymmetricIV = RSA->Encrypt( aes->IV, false ); + Console::WriteLine( "Aes Key and IV have been encrypted with RSACryptoServiceProvider." ); + } + catch ( CryptographicException^ e ) + { + + //Catch and display a CryptographicException + //to the console. + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp new file mode 100644 index 00000000000..92218fec226 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ExportParameters/CPP/sample.cpp @@ -0,0 +1,25 @@ +#using + +using namespace System; +using namespace System::Security::Cryptography; +void main() +{ + // + try + { + //Create a new RSACryptoServiceProvider Object*. + RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; + + //Export the key information to an RSAParameters object. + //Pass false to export the public key information or pass + //true to export public and private key information. + RSAParameters RSAParams = RSA->ExportParameters( false ); + } + catch ( CryptographicException^ e ) + { + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( e->Message ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp new file mode 100644 index 00000000000..a5bf383b029 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider.ImportParameters/CPP/sample.cpp @@ -0,0 +1,33 @@ +#using + +using namespace System; +using namespace System::Security::Cryptography; + +int main() +{ + // + try + { + //Create a new RSACryptoServiceProvider object. + RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; + + //Export the key information to an RSAParameters object. + //Pass false to export the public key information or pass + //true to export public and private key information. + RSAParameters RSAParams = RSA->ExportParameters( false ); + + //Create another RSACryptoServiceProvider object. + RSACryptoServiceProvider^ RSA2 = gcnew RSACryptoServiceProvider; + + //Import the key information from the other + //RSACryptoServiceProvider object. + RSA2->ImportParameters( RSAParams ); + } + catch ( CryptographicException^ e ) + { + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( e->Message ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp new file mode 100644 index 00000000000..9f6ac45281c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSACryptoServiceProvider/CPP/sample.cpp @@ -0,0 +1,106 @@ +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; +array^ RSAEncrypt( array^DataToEncrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) +{ + try + { + + //Create a new instance of RSACryptoServiceProvider. + RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; + + //Import the RSA Key information. This only needs + //toinclude the public key information. + RSA->ImportParameters( RSAKeyInfo ); + + //Encrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + + array^encryptedData = RSA->Encrypt( DataToEncrypt, DoOAEPPadding ); + delete RSA; + return encryptedData; + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + return nullptr; + } + +} + +array^ RSADecrypt( array^DataToDecrypt, RSAParameters RSAKeyInfo, bool DoOAEPPadding ) +{ + try + { + + //Create a new instance of RSACryptoServiceProvider. + RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; + + //Import the RSA Key information. This needs + //to include the private key information. + RSA->ImportParameters( RSAKeyInfo ); + + //Decrypt the passed byte array and specify OAEP padding. + //OAEP padding is only available on Microsoft Windows XP or + //later. + + array^decryptedData = RSA->Decrypt( DataToDecrypt, DoOAEPPadding ); + delete RSA; + return decryptedData; + } + //Catch and display a CryptographicException + //to the console. + catch ( CryptographicException^ e ) + { + Console::WriteLine( e ); + return nullptr; + } + +} + +int main() +{ + try + { + + //Create a UnicodeEncoder to convert between byte array and string. + UnicodeEncoding^ ByteConverter = gcnew UnicodeEncoding; + + //Create byte arrays to hold original, encrypted, and decrypted data. + array^dataToEncrypt = ByteConverter->GetBytes( "Data to Encrypt" ); + array^encryptedData; + array^decryptedData; + + //Create a new instance of RSACryptoServiceProvider to generate + //public and private key data. + RSACryptoServiceProvider^ RSA = gcnew RSACryptoServiceProvider; + + //Pass the data to ENCRYPT, the public key information + //(using RSACryptoServiceProvider.ExportParameters(false), + //and a boolean flag specifying no OAEP padding. + encryptedData = RSAEncrypt( dataToEncrypt, RSA->ExportParameters( false ), false ); + + //Pass the data to DECRYPT, the private key information + //(using RSACryptoServiceProvider.ExportParameters(true), + //and a boolean flag specifying no OAEP padding. + decryptedData = RSADecrypt( encryptedData, RSA->ExportParameters( true ), false ); + + //Display the decrypted plaintext to the console. + Console::WriteLine( "Decrypted plaintext: {0}", ByteConverter->GetString( decryptedData ) ); + delete RSA; + } + catch ( ArgumentNullException^ ) + { + + //Catch this exception in case the encryption did + //not succeed. + Console::WriteLine( "Encryption failed." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp new file mode 100644 index 00000000000..cb8ce0d69c9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.RSAOAEPKeyExchangeDeformatter/CPP/rsaencoder.cpp @@ -0,0 +1,213 @@ +// This sample demonstrates how to encode and decode a string using +// the RSAOAEPKeyExchangeFormatter and RSAOAEPKeyExchangeDeformatter classes. +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; + +ref class RSAEncoder +{ +private: + // Use a member variable to hold the RSA key for encoding and decoding. + RSA^ rsaKey; + +public: + [STAThread] + static void Main() + { + String^ message = L"A phrase to be encoded."; + RSAEncoder^ rsaEncoder = gcnew RSAEncoder; + rsaEncoder->InitializeKey( RSA::Create() ); + Console::WriteLine( L"Encoding the following message:" ); + Console::WriteLine( message ); + array^encodedMessage = rsaEncoder->EncodeMessage( message ); + Console::WriteLine( L"Resulting message encoded:" ); + Console::WriteLine( Encoding::ASCII->GetString( encodedMessage ) ); + String^ decodedMessage = rsaEncoder->DecodeMessage( encodedMessage ); + Console::WriteLine( L"Resulting message decoded:" ); + Console::WriteLine( decodedMessage ); + + // Construct a formatter to demonstrate how to set each property. + rsaEncoder->ConstructFormatter(); + + // Construct a deformatter to demonstrate how to set each property. + rsaEncoder->ConstructDeformatter(); + Console::WriteLine( L"This sample completed successfully, " + L" press enter to continue." ); + Console::ReadLine(); + } + + +private: + // Initialize an rsaKey member variable with the specified RSA key. + void InitializeKey( RSA^ key ) + { + rsaKey = key; + } + + // Use the RSAOAEPKeyExchangeDeformatter class to decode the + // specified message. + array^ EncodeMessage( String^ message ) + { + array^encodedMessage = nullptr; + try + { + + // Construct a formatter with the specified RSA key. + // + RSAOAEPKeyExchangeFormatter^ keyEncryptor = + gcnew RSAOAEPKeyExchangeFormatter( rsaKey ); + // + + // Convert the message to bytes to create the encrypted data. + // + array^byteMessage = Encoding::ASCII->GetBytes( message ); + encodedMessage = keyEncryptor->CreateKeyExchange( byteMessage ); + // + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Unexpected exception caught:{0}", ex ); + } + + return encodedMessage; + } + + // Use the RSAOAEPKeyExchangeDeformatter class to decode the + // specified message. + String^ DecodeMessage( array^encodedMessage ) + { + String^ decodedMessage = nullptr; + try + { + // Construct a deformatter with the specified RSA key. + // + RSAOAEPKeyExchangeDeformatter^ keyDecryptor = + gcnew RSAOAEPKeyExchangeDeformatter( rsaKey ); + // + + // Decrypt the encoded message. + // + array^decodedBytes = keyDecryptor->DecryptKeyExchange( encodedMessage ); + // + + // Retrieve a string representation of the decoded message. + decodedMessage = Encoding::ASCII->GetString( decodedBytes ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Unexpected exception caught:{0}", ex ); + } + + return decodedMessage; + } + + + // Create an RSAOAEPKeyExchangeFormatter object with a new RSA key. + // Display its properties to the console. + void ConstructFormatter() + { + // Construct an empty Optimal Asymmetric Encryption Padding (OAEP) + // key exchange. + // + RSAOAEPKeyExchangeFormatter^ rsaFormatter = gcnew RSAOAEPKeyExchangeFormatter; + // + + // Create an RSA and set it into the specified + // RSAOAEPKeyExchangeFormatter. + // + RSA^ key = RSA::Create(); + rsaFormatter->SetKey( key ); + // + + // Create a random number using the RNGCryptoServiceProvider provider. + // + RandomNumberGenerator^ ring = RandomNumberGenerator::Create(); + rsaFormatter->Rng = ring; + // + + // Export InverseQ and set it into the RSAOAEPKeyExchangeFormatter. + // + rsaFormatter->Parameter = key->ExportParameters( true ).InverseQ; + // + + Console::WriteLine(); + Console::WriteLine( L"**{0}**", rsaFormatter ); + Console::Write( L"The following random number was generated using the " ); + Console::WriteLine( L"class:" ); + Console::WriteLine( rsaFormatter->Rng ); + Console::WriteLine(); + Console::Write( L"The RSA formatter contains the following InverseQ" ); + Console::WriteLine( L" parameter:" ); + Console::WriteLine( Encoding::ASCII->GetString( rsaFormatter->Parameter ) ); + Console::WriteLine(); + + // + String^ xmlParameters = rsaFormatter->Parameters; + // + + Console::WriteLine( L"The RSA formatter has the following parameters:" ); + Console::WriteLine( xmlParameters ); + } + + // Create an RSAOAEPKeyExchangeDeformatter object with a new RSA key. + // Display its properties to the console. + void ConstructDeformatter() + { + // Construct an empty OAEP key exchange. + // + RSAOAEPKeyExchangeDeformatter^ rsaDeformatter = + gcnew RSAOAEPKeyExchangeDeformatter; + // + + // Create an RSAKey and set it into the specified + // RSAOAEPKeyExchangeFormatter. + // + RSA^ key = RSA::Create(); + rsaDeformatter->SetKey( key ); + // + + Console::WriteLine(); + Console::WriteLine( L"**{0}**", rsaDeformatter ); + + // + String^ xmlParameters = rsaDeformatter->Parameters; + // + + Console::WriteLine(); + Console::WriteLine( L"The RSA deformatter has the following " ); + Console::WriteLine( L"parameters:{0}", xmlParameters ); + } +}; + +int main() +{ + RSAEncoder::Main(); +} + +// +// This sample produces the following output: +// +// Encoding the following message: +// A phrase to be encoded. +// Resulting message encoded: %?}T:v??xu?eD)YucItjwu¦ALH HB,Uj??2xq?.?s45 +// ?f?L2?=X?CPzWx???"q5?6&N"AE,Z+T?(]S?_7~,?G{?VV!:S?df? +// Resulting message decoded: +// A phrase to be encoded. +// +// **System.Security.Cryptography.RSAOAEPKeyExchangeFormatter** +// The following random number was generated using the class: +// System.Security.Cryptography.RNGCryptoServiceProvider +// +// The RSA formatter contains the following InverseQ parameter: +// 3MM??]D#?mBq_;:ws^1?ko??,_ ??A[hyWcP$?`v.>@?^!dU%\?H0N'??Ca?Ns +// +// The RSA formatter has the following parameters: +// +// +// **System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter** +// +// The RSA deformatter has the following +// parameters: +// This sample completed successfully, press enter to continue. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp new file mode 100644 index 00000000000..1cf5a6c9d9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.ToBase64Transform/CPP/members.cpp @@ -0,0 +1,129 @@ +// This sample demonstrates how to use each member of the ToBase64Transform +// class. The file named members.cs is read in and written out as a +// transformed file named members.enc. +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Cryptography; + +ref class Members +{ +public: + [STAThread] + static void Main() + { + String^ appPath = (String::Concat( + System::IO::Directory::GetCurrentDirectory(), L"\\" )); + + // Insert your file names into this method call. + EncodeFromFile( String::Concat( appPath, L"members.cpp" ), + String::Concat( appPath, L"members.enc" ) ); + Console::WriteLine( L"This sample completed successfully; " + L"press Enter to exit." ); + Console::ReadLine(); + } + +private: + // Read in the specified source file and write out an encoded target file. + static void EncodeFromFile( String^ sourceFile, String^ targetFile ) + { + // Verify members.cpp exists at the specified directory. + if ( !File::Exists( sourceFile ) ) + { + Console::Write( L"Unable to locate source file located at " ); + Console::WriteLine( L"{0}.", sourceFile ); + Console::Write( L"Please correct the path and run the " ); + Console::WriteLine( L"sample again." ); + return; + } + + // Retrieve the input and output file streams. + FileStream^ inputFileStream = gcnew FileStream( + sourceFile,FileMode::Open,FileAccess::Read ); + FileStream^ outputFileStream = gcnew FileStream( + targetFile,FileMode::Create,FileAccess::Write ); + + // Create a new ToBase64Transform object to convert to base 64. + // + ToBase64Transform^ base64Transform = gcnew ToBase64Transform; + // + + // Create a new byte array with the size of the output block size. + // + array^outputBytes = gcnew array( + base64Transform->OutputBlockSize); + // + + // Retrieve the file contents into a byte array. + array^inputBytes = gcnew array(inputFileStream->Length); + inputFileStream->Read( inputBytes, 0, inputBytes->Length ); + + // Verify that multiple blocks can not be transformed. + // + if ( !base64Transform->CanTransformMultipleBlocks ) + // + { + // Initializie the offset size. + int inputOffset = 0; + + // Iterate through inputBytes transforming by blockSize. + // + // + int inputBlockSize = base64Transform->InputBlockSize; + // + while ( inputBytes->Length - inputOffset > inputBlockSize ) + { + base64Transform->TransformBlock( + inputBytes, + inputOffset, + inputBytes->Length - inputOffset, + outputBytes, + 0 ); + + inputOffset += base64Transform->InputBlockSize; + outputFileStream->Write( + outputBytes, + 0, + base64Transform->OutputBlockSize ); + } + // + + // Transform the final block of data. + // + outputBytes = base64Transform->TransformFinalBlock( + inputBytes, + inputOffset, + inputBytes->Length - inputOffset ); + // + outputFileStream->Write( outputBytes, 0, outputBytes->Length ); + Console::WriteLine( L"Created encoded file at {0}", targetFile ); + } + + // Determine if the current transform can be reused. + // + if ( !base64Transform->CanReuseTransform ) + // + { + // Free up any used resources. + // + base64Transform->Clear(); + // + } + + // Close file streams. + inputFileStream->Close(); + outputFileStream->Close(); + } +}; + +int main() +{ + Members::Main(); +} + +// +// This sample produces the following output: +// +// Created encoded file at C:\ConsoleApplication1\\membersvcs.enc +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp new file mode 100644 index 00000000000..080c61111a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigDetached/CPP/xmldsigdetach.cpp @@ -0,0 +1,132 @@ + + +// +// +// This example signs a file specified by a URI +// using a detached signature. It then verifies +// the signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ Key ) +{ + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml; + + // Assign the key to the SignedXml object. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + + // Add the passed URI to the reference object. + reference->Uri = URIString; + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); + xmlDigitalSignature->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyDetachedSignature( String^ XmlSigFileName ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Load the passed XML file into the document. + xmlDocument->Load( XmlSigFileName ); + + // Create a new SignedXMl object. + SignedXml^ signedXml = gcnew SignedXml; + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// + +[STAThread] +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // The URI to sign. + String^ resourceToSign = "http://www.microsoft.com"; + + // The name of the file to which to save the XML signature. + String^ XmlFileName = "xmldsig.xml"; + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + Console::WriteLine( "Signing: {0}", resourceToSign ); + + // Sign the detached resourceand save the signature in an XML file. + SignDetachedResource( resourceToSign, XmlFileName, Key ); + Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + + //Verify the XML signature in the XML file. + bool result = VerifyDetachedSignature( XmlFileName ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp new file mode 100644 index 00000000000..780d8fbafbf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML-XMLDsigEnvelope/CPP/xmldsigenv.cpp @@ -0,0 +1,171 @@ + + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", Key ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp new file mode 100644 index 00000000000..d4942102cf3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Detached/CPP/exampledetached.cpp @@ -0,0 +1,132 @@ + + +// +// +// This example signs a file specified by a URI +// using a detached signature. It then verifies +// the signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignDetachedResource( String^ URIString, String^ XmlSigFileName, DSA^ DSAKey ) +{ + + // Create a SignedXml Object*. + SignedXml^ signedXml = gcnew SignedXml; + + // Assign the DSA key to the SignedXml object. + signedXml->SigningKey = DSAKey; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + + // Add the passed URI to the reference object. + reference->Uri = URIString; + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add a DSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew DSAKeyValue( safe_cast(DSAKey) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); + xmlDigitalSignature->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyDetachedSignature( String^ XmlSigFileName ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Load the passed XML file into the document. + xmlDocument->Load( XmlSigFileName ); + + // Create a new SignedXMl object. + SignedXml^ signedXml = gcnew SignedXml; + + // Find the S"Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// + +[STAThread] +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // The URI to sign. + String^ resourceToSign = "http://www.microsoft.com"; + + // The name of the file to which to save the XML signature. + String^ XmlFileName = "xmldsig.xml"; + try + { + + // Generate a DSA signing key. + DSA^ DSAKey = DSA::Create(); + Console::WriteLine( "Signing: {0}", resourceToSign ); + + // Sign the detached resourceand save the signature in an XML file. + SignDetachedResource( resourceToSign, XmlFileName, DSAKey ); + Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + + //Verify the XML signature in the XML file. + bool result = VerifyDetachedSignature( XmlFileName ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp new file mode 100644 index 00000000000..20276a9a84d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.DSAKeyValue_Envelope/CPP/exampleenvelope.cpp @@ -0,0 +1,174 @@ + + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, DSA^ DSAKey ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the DSA key to the SignedXml document. + signedXml->SigningKey = DSAKey; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add a transformation to the reference. + Transform^ trns = gcnew XmlDsigC14NTransform; + reference->AddTransform( trns ); + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add a DSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew DSAKeyValue( safe_cast(DSAKey) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate a DSA signing key. + DSA^ DSAKey = DSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", DSAKey ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp new file mode 100644 index 00000000000..aca4a856e3f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Detached/CPP/examplecreatedetached.cpp @@ -0,0 +1,100 @@ + + +// +// +// This example signs a file specified by a URI +// using a detached signature. It then verifies +// the signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ Key, String^ Certificate ) +{ + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml; + + // Assign the key to the SignedXml object. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + + // Add the passed URI to the reference object. + reference->Uri = URIString; + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Create a new KeyInfo object. + KeyInfo^ keyInfo = gcnew KeyInfo; + + // Load the X509 certificate. + X509Certificate^ MSCert = X509Certificate::CreateFromCertFile( Certificate ); + + // Load the certificate into a KeyInfoX509Data object + // and add it to the KeyInfo object. + keyInfo->AddClause( gcnew KeyInfoX509Data( MSCert ) ); + + // Add the KeyInfo object to the SignedXml object. + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); + xmlDigitalSignature->WriteTo( xmltw ); + xmltw->Close(); +} + + +// + +[STAThread] +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // The URI to sign. + String^ resourceToSign = "http://www.microsoft.com"; + + // The name of the file to which to save the XML signature. + String^ XmlFileName = "xmldsig.xml"; + + // The name of the X509 certificate + String^ Certificate = "microsoft.cer"; + try + { + + // Generate a signing key. This key should match the certificate. + RSA^ Key = RSA::Create(); + Console::WriteLine( "Signing: {0}", resourceToSign ); + + // Sign the detached resource and save the signature in an XML file. + SignDetachedResource( resourceToSign, XmlFileName, Key, Certificate ); + Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp new file mode 100644 index 00000000000..31aee98e1a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.KeyInfoX509Data_Envelope/CPP/examplecreateenvelope.cpp @@ -0,0 +1,135 @@ + + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key, String^ Certificate ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Create a new KeyInfo object. + KeyInfo^ keyInfo = gcnew KeyInfo; + + // Load the X509 certificate. + X509Certificate^ MSCert = X509Certificate::CreateFromCertFile( Certificate ); + + // Load the certificate into a KeyInfoX509Data object + // and add it to the KeyInfo object. + keyInfo->AddClause( gcnew KeyInfoX509Data( MSCert ) ); + + // Add the KeyInfo object to the SignedXml object. + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + String^ Certificate = "microsoft.cer"; + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", Key, Certificate ); + Console::WriteLine( "XML file signed." ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp new file mode 100644 index 00000000000..43ae77e2392 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXML_CheckReturnValue_Envelope/CPP/exampleenvelope.cpp @@ -0,0 +1,170 @@ + + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ RSAKey ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the RSA key to the SignedXml document. + signedXml->SigningKey = RSAKey; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add a RSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(RSAKey) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate a RSA signing key. + RSA^ RSAKey = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", RSAKey ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml" ); + + // Display the results of the signature verification to \ + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp new file mode 100644 index 00000000000..8d9b7b1fc42 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml-AddObject-AddReference/CPP/example.cpp @@ -0,0 +1,172 @@ + + +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ RSAKey ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the RSA key to the SignedXml document. + signedXml->SigningKey = RSAKey; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add a transformation to the reference. + Transform^ trns = gcnew XmlDsigC14NTransform; + reference->AddTransform( trns ); + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue to the KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(RSAKey) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate an RSA signing key. + RSA^ RSAKey = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", RSAKey ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp new file mode 100644 index 00000000000..fa1867d2679 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Detached/CPP/exampledetached.cpp @@ -0,0 +1,124 @@ + + +// +// +// This example signs a file specified by a URI +// using a detached signature. It then verifies +// the signed XML. +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. This method does not +// save the public key within the XML file. This file cannot be verified unless +// the verifying code has the key with which it was signed. +void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ Key ) +{ + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml; + + // Assign the key to the SignedXml object. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + + // Add the passed URI to the reference object. + reference->Uri = URIString; + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); + xmlDigitalSignature->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file against an asymmetric +// algorithm and return the result. +static Boolean VerifyDetachedSignature( String^ XmlSigFileName, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Load the passedXML file into the document. + xmlDocument->Load( XmlSigFileName ); + + // Create a new SignedXml object. + SignedXml^ signedXml = gcnew SignedXml; + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( dynamic_cast(nodeList[ 0 ]) ); + + // Check the signature against the passed asymmetric key + // and return the result. + return signedXml->CheckSignature( Key ); +} + +int main() +{ + + // The URI to sign. + String^ resourceToSign = "http://www.microsoft.com"; + + // The name of the file to which to save the XML signature. + String^ XmlFileName = "xmldsig.xml"; + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + Console::WriteLine( "Signing: {0}", resourceToSign ); + + // Sign the detached resourceand save the signature in an XML file. + SignDetachedResource( resourceToSign, XmlFileName, Key ); + Console::WriteLine( "XML Signature was successfully computed and saved to {0}.", XmlFileName ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + + //Verify the XML signature in the XML file against the key. + bool result = VerifyDetachedSignature( XmlFileName, Key ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp new file mode 100644 index 00000000000..270360c4f71 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-AsymetricAlg-Envelope/CPP/exampleenvelope.cpp @@ -0,0 +1,159 @@ + + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. This method does not +// save the public key within the XML file. This file cannot be verified unless +// the verifying code has the key with which it was signed. +void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file against an asymmetric +// algorithm and return the result. +Boolean VerifyXmlFile( String^ Name, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature( Key ); +} + + +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument Object*. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "signedExample.xml", Key ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml", Key ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp new file mode 100644 index 00000000000..979040a9f1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Detached/CPP/xmldsigdetachedkeyedhashalg.cpp @@ -0,0 +1,117 @@ + + +// +// +// This example signs a file specified by a URI +// using a detached signature. It then verifies +// the signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. +void SignDetachedResource( String^ URIString, String^ XmlSigFileName, KeyedHashAlgorithm^ Key ) +{ + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + + // Add the passed URI to the reference object. + reference->Uri = URIString; + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Compute the signature. + signedXml->ComputeSignature( Key ); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); + xmlDigitalSignature->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +Boolean VerifyDetachedSignature( String^ XmlSigFileName, KeyedHashAlgorithm^ Key ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Load the passedXML file into the document. + xmlDocument->Load( XmlSigFileName ); + + // Create a new SignedXml object and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml; + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature( Key ); +} + +int main() +{ + try + { + + // The URI to sign. + String^ resourceToSign = "http://www.microsoft.com"; + + // The name of the file to which to save the XML signature. + String^ XmlFileName = "xmlsig.xml"; + + // Generate a signing key. + HMACSHA256^ Key = gcnew HMACSHA256; + Console::WriteLine( "Signing: {0}", resourceToSign ); + + // Sign the detached resourceand save the signature in an XML file. + SignDetachedResource( resourceToSign, XmlFileName, Key ); + Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + + //Verify the XML signature in the XML file. + bool result = VerifyDetachedSignature( XmlFileName, Key ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp new file mode 100644 index 00000000000..5ea1b276c55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.SignedXml.ComputeSig-Check-KeyedHash-Envelope/CPP/xmldsigenvkeyedhashalg.cpp @@ -0,0 +1,160 @@ + + +// +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, KeyedHashAlgorithm^ Key ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using its name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXML object. + signedXml->AddReference( reference ); + + // Compute the signature. + signedXml->ComputeSignature( Key ); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// Verify the signature of an XML file and return the result. +Boolean VerifyXmlFile( String^ Name, KeyedHashAlgorithm^ Key ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXMl object and pass it + // the XMl document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the "Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature( Key ); +} + + +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument object. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode object. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the filename specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +int main() +{ + try + { + + // Generate a signing key. + HMACSHA256^ Key = gcnew HMACSHA256; + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", Key ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying Signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml", Key ); + + // Display the results of the signature verification to \ + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp new file mode 100644 index 00000000000..24b3bee5ff8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Detached/CPP/sampledetached.cpp @@ -0,0 +1,134 @@ + + +// +// +// This example signs a file specified by a URI +// using a detached signature. It then verifies +// the signed XML. +// +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignDetachedResource( String^ URIString, String^ XmlSigFileName, RSA^ RSAKey ) +{ + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml; + + // Assign the key to the SignedXml object. + signedXml->SigningKey = RSAKey; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + + // Add the passed URI to the reference object. + reference->Uri = URIString; + + // Add a transformation if the URI is an XML file. + if ( URIString->EndsWith( "xml" ) ) + { + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(RSAKey) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement object. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Save the signed XML document to a file specified + // using the passed string. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( XmlSigFileName,gcnew UTF8Encoding( false ) ); + xmlDigitalSignature->WriteTo( xmltw ); + xmltw->Close(); + } +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyDetachedSignature( String^ XmlSigFileName ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Load the passed XML file into the document. + xmlDocument->Load( XmlSigFileName ); + + // Create a new SignedXMl object. + SignedXml^ signedXml = gcnew SignedXml; + + // Find the S"Signature" node and create a new + // XmlNodeList object. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// +int main() +{ + + // The URI to sign. + String^ resourceToSign = "http://www.microsoft.com"; + + // The name of the file to which to save the XML signature. + String^ XmlFileName = "xmldsig.xml"; + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + Console::WriteLine( "Signing: {0}", resourceToSign ); + + // Sign the detached resourceand save the signature in an XML file. + SignDetachedResource( resourceToSign, XmlFileName, Key ); + Console::WriteLine( "XML signature was successfully computed and saved to {0}.", XmlFileName ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + + //Verify the XML signature in the XML file. + bool result = VerifyDetachedSignature( XmlFileName ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp new file mode 100644 index 00000000000..19f81fd3bec --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.XML.XmlDsigC14NWithCommentsTransform_Envelope/CPP/sampleenvelope.cpp @@ -0,0 +1,168 @@ + + +// +// This example signs an XML file using an +// envelope signature. It then verifies the +// signed XML. +#using +#using + +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; +using namespace System::Xml; + +// +// Sign an XML file and save the signature in a new file. +void SignXmlFile( String^ FileName, String^ SignedFileName, RSA^ Key ) +{ + + // Create a new XML document. + XmlDocument^ doc = gcnew XmlDocument; + + // Format the document to ignore white spaces. + doc->PreserveWhitespace = false; + + // Load the passed XML file using it's name. + doc->Load( gcnew XmlTextReader( FileName ) ); + + // Create a SignedXml Object*. + SignedXml^ signedXml = gcnew SignedXml( doc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = ""; + + // Add an enveloped transformation to the reference. + XmlDsigEnvelopedSignatureTransform^ env = gcnew XmlDsigEnvelopedSignatureTransform; + reference->AddTransform( env ); + + // Add the reference to the SignedXml Object*. + signedXml->AddReference( reference ); + + // Add an RSAKeyValue KeyInfo (optional; helps recipient find key to validate). + KeyInfo^ keyInfo = gcnew KeyInfo; + keyInfo->AddClause( gcnew RSAKeyValue( safe_cast(Key) ) ); + signedXml->KeyInfo = keyInfo; + + // Compute the signature. + signedXml->ComputeSignature(); + + // Get the XML representation of the signature and save + // it to an XmlElement Object*. + XmlElement^ xmlDigitalSignature = signedXml->GetXml(); + + // Append the element to the XML document. + doc->DocumentElement->AppendChild( doc->ImportNode( xmlDigitalSignature, true ) ); + if ( (doc->FirstChild)->GetType() == XmlDeclaration::typeid ) + { + doc->RemoveChild( doc->FirstChild ); + } + + + // Save the signed XML document to a file specified + // using the passed String*. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( SignedFileName,gcnew UTF8Encoding( false ) ); + doc->WriteTo( xmltw ); + xmltw->Close(); +} + + +// +// +// Verify the signature of an XML file and return the result. +Boolean VerifyXmlFile( String^ Name ) +{ + + // Create a new XML document. + XmlDocument^ xmlDocument = gcnew XmlDocument; + + // Format using white spaces. + xmlDocument->PreserveWhitespace = true; + + // Load the passed XML file into the document. + xmlDocument->Load( Name ); + + // Create a new SignedXml Object* and pass it + // the XML document class. + SignedXml^ signedXml = gcnew SignedXml( xmlDocument ); + + // Find the S"Signature" node and create a new + // XmlNodeList Object*. + XmlNodeList^ nodeList = xmlDocument->GetElementsByTagName( "Signature" ); + + // Load the signature node. + signedXml->LoadXml( safe_cast(nodeList->Item( 0 )) ); + + // Check the signature and return the result. + return signedXml->CheckSignature(); +} + + +// +// Create example data to sign. +void CreateSomeXml( String^ FileName ) +{ + + // Create a new XmlDocument Object*. + XmlDocument^ document = gcnew XmlDocument; + + // Create a new XmlNode Object*. + XmlNode^ node = document->CreateNode( XmlNodeType::Element, "", "MyElement", "samples" ); + + // Add some text to the node. + node->InnerText = "Example text to be signed."; + + // Append the node to the document. + document->AppendChild( node ); + + // Save the XML document to the file name specified. + XmlTextWriter^ xmltw = gcnew XmlTextWriter( FileName,gcnew UTF8Encoding( false ) ); + document->WriteTo( xmltw ); + xmltw->Close(); +} + +void main() +{ + try + { + + // Generate a signing key. + RSA^ Key = RSA::Create(); + + // Create an XML file to sign. + CreateSomeXml( "Example.xml" ); + Console::WriteLine( "New XML file created." ); + + // Sign the XML that was just created and save it in a + // new file. + SignXmlFile( "Example.xml", "SignedExample.xml", Key ); + Console::WriteLine( "XML file signed." ); + + // Verify the signature of the signed XML. + Console::WriteLine( "Verifying signature..." ); + bool result = VerifyXmlFile( "SignedExample.xml" ); + + // Display the results of the signature verification to + // the console. + if ( result ) + { + Console::WriteLine( "The XML signature is valid." ); + } + else + { + Console::WriteLine( "The XML signature is not valid." ); + } + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp new file mode 100644 index 00000000000..35c00691bbc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigBase64Transform/CPP/members.cpp @@ -0,0 +1,219 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; + +namespace CryptographyXmlDsigBase64Transform +{ + ref class Example + { + public: + static void Produce() + { + + // Encrypt an XML message + EncryptXML(LoadXMLDoc()); + + // Using XmlDsigBase64Transform resolving a Uri. + Uri^ baseUri = gcnew Uri("http://www.microsoft.com"); + String^ relativeUri = "msdn"; + Uri^ absoluteUri = ResolveUris(baseUri, relativeUri); + Console::WriteLine("This sample completed successfully; " + "press Enter to exit."); + Console::ReadLine(); + } + + + private: + + // Encrypt the text in the specified XmlDocument. + static void EncryptXML(XmlDocument^ xmlDoc) + { + + // + XmlDsigBase64Transform^ xmlTransform = + gcnew XmlDsigBase64Transform; + // + // Ensure the transform is using the proper algorithm. + // + xmlTransform->Algorithm = + SignedXml::XmlDsigBase64TransformUrl; + // + // Retrieve the XML representation of the current + // transform. + // + XmlElement^ xmlInTransform = xmlTransform->GetXml(); + // + Console::WriteLine("Xml representation of the " + "current transform: "); + Console::WriteLine(xmlInTransform->OuterXml); + + // Retrieve the valid input types for the current + // transform. + // + array^ validInTypes = xmlTransform->InputTypes; + // + // Verify the xmlTransform can accept the XMLDocument + // as an input type. + for each (Type^ validInType in validInTypes) + { + if (validInType == xmlDoc->GetType()) + { + + // Demonstrate loading the entire Xml Document. + // + xmlTransform->LoadInput(xmlDoc); + // + // This transform is created for demonstration + // purposes. + XmlDsigBase64Transform^ secondTransform = + gcnew XmlDsigBase64Transform; + // + String^ classDescription = + secondTransform->ToString(); + // + // This call does not perform as expected. + // LoadInnerXml is overridden by the + // XmlDsigBase64Transform class, but is + // stubbed out. + // + secondTransform->LoadInnerXml( + xmlDoc->SelectNodes("//.")); + // + break; + } + + } + + // + array^ validOutTypes = xmlTransform->OutputTypes; + // + for each (Type^ validOutType in validOutTypes) + { + if (validOutType == Stream::typeid) + { + try + { + + // + Type^ streamType = Stream::typeid; + CryptoStream^ outputStream = + (CryptoStream^)(xmlTransform->GetOutput( + streamType)); + // + // Read the CryptoStream into a stream reader. + StreamReader^ streamReader = + gcnew StreamReader(outputStream); + + // Read the stream into a string. + String^ outputMessage = + streamReader->ReadToEnd(); + + // Close the streams. + outputStream->Close(); + streamReader->Close(); + + // Display to the console the Xml before and + // after encryption. + Console::WriteLine("Encoding the following " + "message: {0}", xmlDoc->InnerText); + Console::WriteLine("Message encoded: {0}", + outputMessage); + } + catch (CryptographicException^ ex) + { + Console::WriteLine("Cryptographic exception " + "caught: {0}", ex); + } + + break; + } + else + { + + // + Object^ outputObject = xmlTransform->GetOutput(); + // + } + + } + } + + + // Create an XML document with Element and Text nodes. + static XmlDocument^ LoadXMLDoc() + { + XmlDocument^ xmlDoc = gcnew XmlDocument; + XmlNode^ mainNode = + xmlDoc->CreateNode(XmlNodeType::Element, + "ContosoMessages", "http://www.contoso.com"); + XmlNode^ textNode = xmlDoc->CreateTextNode("Some text " + "to encode."); + mainNode->AppendChild(textNode); + xmlDoc->AppendChild(mainNode); + Console::WriteLine("Created the following XML Document " + "for transformation: "); + Console::WriteLine(xmlDoc->InnerXml); + return xmlDoc; + } + + + // Resolve the specified base and relative Uri's. + static Uri^ ResolveUris(Uri^ baseUri, String^ relativeUri) + { + + // + XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver; + xmlResolver->Credentials = + System::Net::CredentialCache::DefaultCredentials; + XmlDsigBase64Transform^ xmlTransform = + gcnew XmlDsigBase64Transform; + xmlTransform->Resolver = xmlResolver; + // + Uri^ absoluteUri = xmlResolver->ResolveUri(baseUri, + relativeUri); + if (absoluteUri != nullptr) + { + Console::WriteLine("Resolved the base Uri and " + "relative Uri to the following:"); + Console::WriteLine(absoluteUri); + } + else + { + Console::WriteLine("Unable to resolve the base " + "Uri and relative Uri"); + } + + return absoluteUri; + } + + }; + +} + +int main() +{ + CryptographyXmlDsigBase64Transform::Example::Produce(); +} + +// +// This sample produces the following output: +// +// Created the following XML Document for transformation: +// Some text to encode. +// +// Xml representation of the current transform: +// +// Encoding the following message: Some text to encode. +// Message encoded: Jmr^ +// Resolved the base Uri and relative Uri to the following: +// http://www.microsoft.com/msdn +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp new file mode 100644 index 00000000000..9c590aba971 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigC14NTransform/CPP/members.cpp @@ -0,0 +1,334 @@ +// +#using +#using +#using +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Security::Cryptography::X509Certificates; + +ref class Class1 +{ +private: + static String^ Certificate = L"..\\..\\my509.cer"; + +public: + [STAThread] + static void Main() + { + // Encrypt an XML message + XmlDocument^ productsXml = LoadProducts(); + ShowTransformProperties( productsXml ); + SignDocument( productsXml ); + ShowTransformProperties( productsXml ); + + // Use XmlDsigC14NTransform to resolve a Uri. + Uri^ baseUri = gcnew Uri( L"http://www.contoso.com" ); + String^ relativeUri = L"xml"; + Uri^ absoluteUri = ResolveUris( baseUri, relativeUri ); + Console::WriteLine( L"This sample completed successfully; " + L"press Enter to exit." ); + Console::ReadLine(); + } + + +private: + // Encrypt the text in the specified XmlDocument. + static void ShowTransformProperties( XmlDocument^ xmlDoc ) + { + // + XmlDsigC14NTransform^ xmlTransform = + gcnew XmlDsigC14NTransform( true ); + // + + // Ensure the transform is using the appropriate algorithm. + // + xmlTransform->Algorithm = + SignedXml::XmlDsigExcC14NTransformUrl; + // + + // Retrieve the XML representation of the current transform. + // + XmlElement^ xmlInTransform = xmlTransform->GetXml(); + // + + Console::WriteLine( L"\nXml representation of the current transform: " ); + Console::WriteLine( xmlInTransform->OuterXml ); + + // Retrieve the valid input types for the current transform. + // + array^validInTypes = xmlTransform->InputTypes; + // + + // Verify the xmlTransform can accept the XMLDocument as an + // input type. + for ( int i = 0; i < validInTypes->Length; i++ ) + { + if ( validInTypes[ i ] == xmlDoc->GetType() ) + { + // Load the document into the transfrom. + // + xmlTransform->LoadInput( xmlDoc ); + // + + // + XmlDsigC14NTransform^ secondTransform = gcnew XmlDsigC14NTransform; + // + + // + String^ classDescription = secondTransform->ToString(); + // + + // This call does not perform as expected. + // This transform does not contain inner XML elements + // + secondTransform->LoadInnerXml( xmlDoc->SelectNodes( L"//." ) ); + // + + break; + } + } + + // + array^validOutTypes = xmlTransform->OutputTypes; + // + + for ( int i = 0; i < validOutTypes->Length; i++ ) + { + if ( validOutTypes[ i ] == System::IO::Stream::typeid ) + { + try + { + + // + Type^ streamType = System::IO::Stream::typeid; + MemoryStream^ outputStream = static_cast( + xmlTransform->GetOutput( streamType )); + // + + // Read the CryptoStream into a stream reader. + StreamReader^ streamReader = + gcnew StreamReader( outputStream ); + + // Read the stream into a string. + String^ outputMessage = streamReader->ReadToEnd(); + + // Close the streams. + outputStream->Close(); + streamReader->Close(); + + // Display to the console the Xml before and after + // encryption. + Console::WriteLine( L"Encoding the following xml: {0}", + xmlDoc->OuterXml ); + Console::WriteLine( L"Message encoded: {0}", outputMessage ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Unexpected exception caught: {0}", ex ); + } + + break; + } + else + { + // + Object^ outputObject = xmlTransform->GetOutput(); + // + } + } + } + + // Create an XML document describing various products. + static XmlDocument^ LoadProducts() + { + XmlDocument^ xmlDoc = gcnew XmlDocument; + String^ contosoProducts = L""; + contosoProducts = String::Concat( contosoProducts, + L"123"); + contosoProducts = String::Concat( contosoProducts, + L"Router"); + contosoProducts = String::Concat( contosoProducts, + L"456"); + contosoProducts = String::Concat( contosoProducts, + L"Keyboard"); + + // Include a comment to test the comments feature of the transform. + contosoProducts = String::Concat( contosoProducts, + L"" ); + + // Include the CDATA tag to test the transform results. + contosoProducts = String::Concat( contosoProducts, + L"" ); + contosoProducts = String::Concat( contosoProducts, + L"" ); + + xmlDoc->LoadXml( contosoProducts ); + return xmlDoc; + } + + // Create a signature and add it to the specified document. + static void SignDocument( XmlDocument^ xmlDoc ) + { + // Generate a signing key. + RSA^ Key = RSA::Create(); + + // Create a SignedXml object. + SignedXml^ signedXml = gcnew SignedXml( xmlDoc ); + + // Add the key to the SignedXml document. + signedXml->SigningKey = Key; + + // Create a reference to be signed. + Reference^ reference = gcnew Reference; + reference->Uri = L""; + + // Add an enveloped transformation to the reference. + reference->AddTransform( gcnew XmlDsigC14NTransform ); + + // Add the reference to the SignedXml object. + signedXml->AddReference( reference ); + try + { + // Create a new KeyInfo object. + KeyInfo^ keyInfo = gcnew KeyInfo; + + // Load the X509 certificate. + X509Certificate^ MSCert = + X509Certificate::CreateFromCertFile( Certificate ); + + // Load the certificate into a KeyInfoX509Data object + // and add it to the KeyInfo object. + keyInfo->AddClause( gcnew KeyInfoX509Data( MSCert ) ); + + // Add the KeyInfo object to the SignedXml object. + signedXml->KeyInfo = keyInfo; + } + catch ( FileNotFoundException^ ) + { + Console::WriteLine( L"Unable to locate the following file: {0}", + Certificate ); + } + catch ( CryptographicException^ ex ) + { + Console::WriteLine( L"Unexpected exception caught while creating " + L"the certificate:{0}", ex ); + } + + // Compute the signature. + signedXml->ComputeSignature(); + + // Add the signature branch to the original tree so it is enveloped. + xmlDoc->DocumentElement->AppendChild( signedXml->GetXml() ); + } + + // Resolve the specified base and relative Uri's . + static Uri^ ResolveUris( Uri^ baseUri, String^ relativeUri ) + { + // + XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver; + xmlResolver->Credentials = + System::Net::CredentialCache::DefaultCredentials; + XmlDsigC14NTransform^ xmlTransform = gcnew XmlDsigC14NTransform; + xmlTransform->Resolver = xmlResolver; + // + + Uri^ absoluteUri = xmlResolver->ResolveUri( baseUri, relativeUri ); + if ( absoluteUri != nullptr ) + { + Console::WriteLine( + L"\nResolved the base Uri and relative Uri to the following:" ); + Console::WriteLine( absoluteUri ); + } + else + { + Console::WriteLine( L"Unable to resolve the base Uri and relative Uri" ); + } + + return absoluteUri; + } +}; + +int main() +{ + Class1::Main(); +} + +// +// This sample produces the following output: +// +// Xml representation of the current transform: +// +// Encoding the following xml: 123Rou +// ter456Keyboard +// Message encoded: 123Rou +// ter456Keyboard'http:\\www.contoso.com\partner.asp?h1=en&h2=cr' +// Xml representation of the current transform: +// +// Encoding the following xml: 123Rou +// ter456Keyboard +// BFN2s0/NA2NGgb/R0mvfnNM0Ito= +// vSfZUG5xHuNxzOSEbQjN +// dtEt1D+O7I1LTJ13RrwLaJSfQPrdT/s8IeaA+idw2f2WGuGrdqMJUddpE4GxfK61HmPQ6S7lBG+ +// +ND+YaUYf2AtTRs3SnToXQQrARa/pHVjsKxYHR/9tjy6maHBwxjgjFQABvYZu0gZHYRuXvvfxv0 +// 8=MIICCzCCAXSgAwIBAgIQ5eVQY8pRZ5xBF2WLkYPjijANBgkqhkiG +// 9w0BAQQFADAbMRkwFwYDVQQDExBHcmVnc0NlcnRpZmljYXRlMB4XDTAzMDkxNzIzMzU0N1oXDTM +// 5MTIzMTIzNTk1OVowGzEZMBcGA1UEAxMQR3JlZ3NDZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQ +// EFAAOBjQAwgYkCgYEAmFJ4v7rS3BYTXgVW9PgBFfTYAcB/m9mOFCmUrrChcBpoEtu/tSESlNfEH +// pECIdqg9vUrCNSkY08HRn3ueNeBSnSpssWd8/XoOboWLh1nd+79Y5uZd1WOJI4s0XM0MegZgCoJ +// cEEhpxCd/HOPIQvEsbpN/DuFiovZLo+Ek3hHoxMCAwEAAaNQME4wTAYDVR0BBEUwQ4AQaCb19dl +// yf/zSxPVYQZY9AKEdMBsxGTAXBgNVBAMTEEdyZWdzQ2VydGlmaWNhdGWCEOXlUGPKUWecQRdli5 +// GD44owDQYJKoZIhvcNAQEEBQADgYEAZuZaFDGDJogh7FuT0hfaMAVlRONv6wWVBJVV++eUo38Xu +// RfJ5nNJ0UnhiV2sEtLobYBPEIrNhuk8skdU0AHgx4ILiA4rR96ifWwxtrFQF+h+DL2ZB7xhwcOJ +// +Pa7IC4wIaEp/oBmmX+JHSzfQt6/If4ohwikfxfljKMyIcMlwl4= +// +// Message encoded: 123Router456Keyboard

'http:\\ww +// w.contoso.com\partner.asp?h1=en&h2=cr'BFN2s0/NA2NGgb/R0mvfnNM0Ito= +// vSfZUG5xHuNxzOSEbQjN +// dtEt1D+O7I1LTJ13RrwLaJSfQPrdT/s8IeaA+idw2f2WGuGrdqMJUddpE4GxfK61HmPQ6S7lBG+ +// +ND+YaUYf2AtTRs3SnToXQQrARa/pHVjsKxYHR/9tjy6maHBwxjgjFQABvYZu0gZHYRuXvvfxv0 +// 8=MIICCzCCAXSgAwIBAgIQ5eVQY8pRZ5xBF2WLkYPjijANBgkqhkiG +// 9w0BAQQFADAbMRkwFwYDVQQDExBHcmVnc0NlcnRpZmljYXRlMB4XDTAzMDkxNzIzMzU0N1oXDTM +// 5MTIzMTIzNTk1OVowGzEZMBcGA1UEAxMQR3JlZ3NDZXJ0aWZpY2F0ZTCBnzANBgkqhkiG9w0BAQ +// EFAAOBjQAwgYkCgYEAmFJ4v7rS3BYTXgVW9PgBFfTYAcB/m9mOFCmUrrChcBpoEtu/tSESlNfEH +// pECIdqg9vUrCNSkY08HRn3ueNeBSnSpssWd8/XoOboWLh1nd+79Y5uZd1WOJI4s0XM0MegZgCoJ +// cEEhpxCd/HOPIQvEsbpN/DuFiovZLo+Ek3hHoxMCAwEAAaNQME4wTAYDVR0BBEUwQ4AQaCb19dl +// yf/zSxPVYQZY9AKEdMBsxGTAXBgNVBAMTEEdyZWdzQ2VydGlmaWNhdGWCEOXlUGPKUWecQRdli5 +// GD44owDQYJKoZIhvcNAQEEBQADgYEAZuZaFDGDJogh7FuT0hfaMAVlRONv6wWVBJVV++eUo38Xu +// RfJ5nNJ0UnhiV2sEtLobYBPEIrNhuk8skdU0AHgx4ILiA4rR96ifWwxtrFQF+h+DL2ZB7xhwcOJ +// +Pa7IC4wIaEp/oBmmX+JHSzfQt6/If4ohwikfxfljKMyIcMlwl4=
+// +// Resolved the base Uri and relative Uri to the following: +// http://www.contoso.com/xml +// This sample completed successfully; press Enter to exit. +//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp new file mode 100644 index 00000000000..bf4107ed47b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigEnvelopedSignatureTransform/cpp/members.cpp @@ -0,0 +1,290 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Security::Cryptography::X509Certificates; + +public ref class EnvelopedSignatureSample +{ +private: + static String^ Certificate = "..\\..\\my509.cer"; + + // Encrypt the text in the specified XmlDocument. +public: + static void ShowTransformProperties(XmlDocument^ xmlDoc) + { + // + XmlDsigEnvelopedSignatureTransform^ xmlTransform = + gcnew XmlDsigEnvelopedSignatureTransform(); + // + + // Ensure the transform is using the proper algorithm. + // + xmlTransform->Algorithm = + SignedXml::XmlDsigEnvelopedSignatureTransformUrl; + // + + // Retrieve the XML representation of the current transform. + // + XmlElement^ xmlInTransform = xmlTransform->GetXml(); + // + + Console::WriteLine("\nXml representation of the current transform: "); + Console::WriteLine(xmlInTransform->OuterXml); + + // Retrieve the valid input types for the current transform. + // + array^ validInTypes = xmlTransform->InputTypes; + // + + // Verify the xmlTransform can accept the XMLDocument as an + // input type. + for (int i = 0; i < validInTypes->Length; i++) + { + if (validInTypes[i] == xmlDoc->GetType()) + { + // Load the document into the transfrom. + // + xmlTransform->LoadInput(xmlDoc); + // + + // + bool IncludeComments = true; + // This transform is created for demonstration purposes. + XmlDsigEnvelopedSignatureTransform^ secondTransform = + gcnew XmlDsigEnvelopedSignatureTransform(IncludeComments); + // + + // + String^ classDescription = secondTransform->ToString(); + // + + // This call does not perform as expected. + // + // An enveloped signature has no inner XML elements + secondTransform->LoadInnerXml(xmlDoc->SelectNodes("//.")); + // + + break; + } + } + + // + array^ validOutTypes = xmlTransform->OutputTypes; + // + + for (int i = validOutTypes->Length-1; i >= 0; i--) + { + if (validOutTypes[i] == System::Xml::XmlDocument::typeid) + { + // + Type^ xmlDocumentType = System::Xml::XmlDocument::typeid; + XmlDocument^ xmlDocumentOutput = (XmlDocument^) + xmlTransform->GetOutput(xmlDocumentType); + // + + // Display to the console the Xml before and after + // encryption. + Console::WriteLine("Result of the GetOutput method call" + + " from the current transform: " + + xmlDocumentOutput->OuterXml); + + break; + } + else if (validOutTypes[i] == System::Xml::XmlNodeList::typeid) + { + Type^ xmlNodeListType = System::Xml::XmlNodeList::typeid; + XmlNodeList^ xmlNodes = (XmlNodeList^) + xmlTransform->GetOutput(xmlNodeListType); + + // Display to the console the Xml before and after + // encryption. + Console::WriteLine("Encoding the following message: " + + xmlDoc->InnerText); + + Console::WriteLine("Nodes of the XmlNodeList retrieved " + + "from GetOutput:"); + for (int j = 0; j < xmlNodes->Count; j++) + { + Console::WriteLine("Node " + j + + " has the following name: " + + xmlNodes->Item(j)->Name + + " and the following InnerXml: " + + xmlNodes->Item(j)->InnerXml); + } + + break; + } + else + { + // + Object^ outputObject = xmlTransform->GetOutput(); + // + } + } + } + + // Create an XML document describing various products. +public: + static XmlDocument^ LoadProducts() + { + XmlDocument^ xmlDoc = gcnew XmlDocument(); + + String^ contosoProducts = "" + + "123Router" + + "" + + "456Keyboard" + + "" + + "789Monitor" + + "" + + ""; + + xmlDoc->LoadXml(contosoProducts); + return xmlDoc; + } + + // Create a signature and add it to the specified document. +public: + static void SignDocument(XmlDocument^ xmlDoc) + { + // Generate a signing key. + RSA^ key = RSA::Create(); + + // Create a SignedXml object. + SignedXml^ signedDocument = gcnew SignedXml(xmlDoc); + + // Add the key to the SignedXml document. + signedDocument->SigningKey = key; + + // Create a reference to be signed. + Reference^ referenceToBeSigned = gcnew Reference(); + referenceToBeSigned->Uri = ""; + + // Add an enveloped transformation to the reference. + referenceToBeSigned->AddTransform( + gcnew XmlDsigEnvelopedSignatureTransform()); + + // Add the reference to the SignedXml object. + signedDocument->AddReference(referenceToBeSigned); + + if(File::Exists(Certificate)) + { + // Create a new KeyInfo object. + KeyInfo^ info = gcnew KeyInfo(); + + // Load the X509 certificate. + X509Certificate^ certFromFile = + X509Certificate::CreateFromCertFile(Certificate); + + // Load the certificate into a KeyInfoX509Data object + // and add it to the KeyInfo object. + info->AddClause(gcnew KeyInfoX509Data(certFromFile)); + + // Add the KeyInfo object to the SignedXml object. + signedDocument->KeyInfo = info; + } + else + { + Console::WriteLine("Unable to locate the following file: " + + Certificate); + } + + // Compute the signature. + signedDocument->ComputeSignature(); + + // Add the signature branch to the original tree so it is enveloped. + xmlDoc->DocumentElement->AppendChild(signedDocument->GetXml()); + } + + // Resolve the specified base and relative Uri's . +public: + static Uri^ ResolveUris(Uri^ baseUri, String^ relativeUri) + { + // + XmlUrlResolver^ xmlResolver = gcnew XmlUrlResolver(); + xmlResolver->Credentials = + System::Net::CredentialCache::DefaultCredentials; + + XmlDsigEnvelopedSignatureTransform^ xmlTransform = + gcnew XmlDsigEnvelopedSignatureTransform(); + xmlTransform->Resolver = xmlResolver; + // + + Uri^ absoluteUri = xmlResolver->ResolveUri(baseUri, relativeUri); + + if (absoluteUri != nullptr) + { + Console::WriteLine( + "\nResolved the base Uri and relative Uri to the following:"); + Console::WriteLine(absoluteUri->ToString()); + } + else + { + Console::WriteLine( + "Unable to resolve the base Uri and relative Uri"); + } + return absoluteUri; + } +}; + +[STAThread] +int main() +{ + // Encrypt an XML message + XmlDocument^ productsXml = EnvelopedSignatureSample::LoadProducts(); + EnvelopedSignatureSample::ShowTransformProperties(productsXml); + + EnvelopedSignatureSample::SignDocument(productsXml); + EnvelopedSignatureSample::ShowTransformProperties(productsXml); + + // Use XmlDsigEnvelopedSignatureTransform to resolve a Uri. + Uri^ baseUri = gcnew Uri("http://www.contoso.com"); + String^ relativeUri = "xml"; + Uri^ absoluteUri = + EnvelopedSignatureSample::ResolveUris(baseUri, relativeUri); + + Console::WriteLine("This sample completed successfully; " + + "press Enter to exit."); + Console::ReadLine(); +} + +// +// This sample produces the following output: +// +// Xml representation of the current transform: +// +// Result of the GetOutput method call from the current transform: +// 123Router +// 456Keyboard789 +// Monitor +// Unable to load the following file: ..\\my509.cer +// +// Xml representation of the current transform: +// +// Result of the GetOutput method call from the current transform: +// 123Router +// 456Keyboard789 +// Monitor +// +// KvPW6HUiIUMEDS0YSoT +// gpo2JPbA=c/njCGDru/a +// WAmWG83I+mWO040xOzxvmNx0b0o8ZyPc9j5VwApdAt103OGBtB1H6EkOvt7Ekw+PVuUo8m5LzLP +// yaTxUDMbb2kZZ5itSkGD4rmMUMUMuzrkAoquJZjxeOydBJ2CMehV2rE3RMPLIwRX176DZVy5JKU +// 6Cb7PR2Rpw= +// +// Resolved the base Uri and relative Uri to the following: +// http://www.contoso.com/xml +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp new file mode 100644 index 00000000000..5a53f0d8e0a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Cryptography.Xml.XmlDsigXsltTransform/CPP/members.cpp @@ -0,0 +1,261 @@ +// +#using +#using +#using +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::Xml; +using namespace System::Text; + +ref class Class1 +{ +public: + [STAThread] + static void Main() + { + XmlDocument^ productsXml = LoadProducts(); + XmlNodeList^ xsltNodeList = GetXsltAsNodeList(); + TransformDoc( productsXml, xsltNodeList ); + + // Use XmlDsigXsltTransform to resolve a Uri. + Uri^ baseUri = gcnew Uri( L"http://www.contoso.com" ); + String^ relativeUri = L"xml"; + Uri^ absoluteUri = ResolveUris( baseUri, relativeUri ); + Console::WriteLine( L"This sample completed successfully; " + L"press Enter to exit." ); + Console::ReadLine(); + } + +private: + static void TransformDoc( XmlDocument^ xmlDoc, XmlNodeList^ xsltNodeList ) + { + try + { + // Construct a new XmlDsigXsltTransform. + // + XmlDsigXsltTransform^ xmlTransform = gcnew XmlDsigXsltTransform; + // + + // Load the Xslt tranform as a node list. + // + xmlTransform->LoadInnerXml( xsltNodeList ); + // + + // Load the Xml document to perform the tranform on. + // + XmlNamespaceManager^ namespaceManager; + namespaceManager = gcnew XmlNamespaceManager( xmlDoc->NameTable ); + XmlNodeList^ productsNodeList; + productsNodeList = xmlDoc->SelectNodes( L"//.", namespaceManager ); + xmlTransform->LoadInput( productsNodeList ); + // + + // Retrieve the output from the transform. + // + Stream^ outputStream = (Stream^)xmlTransform->GetOutput( + System::IO::Stream::typeid ); + // + + // Read the output stream into a stream reader. + StreamReader^ streamReader = gcnew StreamReader( outputStream ); + + // Read the stream into a string. + String^ outputMessage = streamReader->ReadToEnd(); + + // Close the streams. + outputStream->Close(); + streamReader->Close(); + + // Display to the console the Xml before and after + // encryption. + Console::WriteLine( L"\nResult of transformation: {0}", outputMessage ); + ShowTransformProperties( xmlTransform ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Caught exception in TransformDoc method: {0}", ex ); + } + } + + static XmlNodeList^ GetXsltAsNodeList() + { + String^ transformXml = L"" ); + transformXml = String::Concat( transformXml, + L"" ); + transformXml = String::Concat( transformXml, + L"" ); + transformXml = String::Concat( transformXml, + L"
ProductIdName
" ); + transformXml = String::Concat( transformXml, + L"
" ); + transformXml = String::Concat( transformXml, + L"" ); + transformXml = String::Concat( transformXml, + L"
ProductIdName
+// +// Result of transformation:
ProductIdName
1Widgets
2Gadgits
+// +// ** Summary for System.Security.Cryptography.Xml.XmlDsigXsltTransform ** +// Xml representation of the current transform: +// +// Algorithm used: System.Security.Cryptography.Xml.XmlDsigXsltTransform +// Transform accepts the following inputs: +// System.IO.Stream +// System.Xml.XmlDocument +// System.Xml.XmlNodeList +// Transform outputs in the following types: +// System.IO.Stream +// +// Resolved the base Uri and relative Uri to the following: +// http://www.contoso.com/xml +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp new file mode 100644 index 00000000000..cef1b5fb817 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.PermissionSet/CPP/permissionset.cpp @@ -0,0 +1,164 @@ + +// +// This sample demonstrates the use of the PermissionSet class. +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Permissions; +using namespace System::Security; +using namespace System::IO; +using namespace System::Collections; +void PermissionSetDemo() +{ + Console::WriteLine( "Executing PermissionSetDemo" ); + try + { + // + // Open a new PermissionSet. + PermissionSet^ ps1 = gcnew PermissionSet( PermissionState::None ); + + Console::WriteLine( "Adding permission to open a file from a file dialog box." ); + + // + // Add a permission to the permission set. + ps1->AddPermission( gcnew FileDialogPermission( FileDialogPermissionAccess::Open ) ); + // + + Console::WriteLine( "Demanding permission to open a file." ); + ps1->Demand(); + Console::WriteLine( "Demand succeeded." ); + // + Console::WriteLine( "Adding permission to save a file from a file dialog box." ); + ps1->AddPermission( gcnew FileDialogPermission( FileDialogPermissionAccess::Save ) ); + Console::WriteLine( "Demanding permission to open and save a file." ); + ps1->Demand(); + Console::WriteLine( "Demand succeeded." ); + Console::WriteLine( "Adding permission to read environment variable USERNAME." ); + ps1->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) ); + ps1->Demand(); + Console::WriteLine( "Demand succeeded." ); + Console::WriteLine( "Adding permission to read environment variable COMPUTERNAME." ); + ps1->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"COMPUTERNAME" ) ); + + // + // Demand all the permissions in the set. + Console::WriteLine( "Demand all permissions." ); + ps1->Demand(); + // + + Console::WriteLine( "Demand succeeded." ); + + // + // Display the number of permissions in the set. + Console::WriteLine( "Number of permissions = {0}", ps1->Count ); + // + + // + // Display the value of the IsSynchronized property. + Console::WriteLine( "IsSynchronized property = {0}", ps1->IsSynchronized ); + // + + // + // Display the value of the IsReadOnly property. + Console::WriteLine( "IsReadOnly property = {0}", ps1->IsReadOnly ); + // + + // + // Display the value of the SyncRoot property. + Console::WriteLine( "SyncRoot property = {0}", ps1->SyncRoot ); + // + + // + // Display the result of a call to the ContainsNonCodeAccessPermissions method. + // Gets a value indicating whether the PermissionSet contains permissions + // that are not derived from CodeAccessPermission. + // Returns true if the PermissionSet contains permissions that are not + // derived from CodeAccessPermission; otherwise, false. + Console::WriteLine( "ContainsNonCodeAccessPermissions method returned {0}", ps1->ContainsNonCodeAccessPermissions() ); + // + + // + Console::WriteLine( "Value of the permission set ToString = \n{0}", ps1->ToString() ); + // + + PermissionSet^ ps2 = gcnew PermissionSet( PermissionState::None ); + + // + // Create a second permission set and compare it to the first permission set. + ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Read,"USERNAME" ) ); + ps2->AddPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::Write,"COMPUTERNAME" ) ); + IEnumerator^ list = ps1->GetEnumerator(); + Console::WriteLine("Permissions in first permission set:"); + while (list->MoveNext()) + Console::WriteLine(list->Current->ToString()); + Console::WriteLine( "Second permission IsSubsetOf first permission = {0}", ps2->IsSubsetOf( ps1 ) ); + // + + // + // Display the intersection of two permission sets. + PermissionSet^ ps3 = ps2->Intersect( ps1 ); + Console::WriteLine( "The intersection of the first permission set and the second permission set = {0}", ps3 ); + // + + // Create a new permission set. + PermissionSet^ ps4 = gcnew PermissionSet( PermissionState::None ); + ps4->AddPermission( gcnew FileIOPermission( FileIOPermissionAccess::Read,"C:\\Temp\\Testfile.txt" ) ); + ps4->AddPermission( gcnew FileIOPermission( static_cast(FileIOPermissionAccess::Read | FileIOPermissionAccess::Write | FileIOPermissionAccess::Append),"C:\\Temp\\Testfile.txt" ) ); + // + + // Display the union of two permission sets. + PermissionSet^ ps5 = ps3->Union( ps4 ); + Console::WriteLine( "The union of permission set 3 and permission set 4 = {0}", ps5 ); + // + + // + // Remove FileIOPermission from the permission set. + ps5->RemovePermission( FileIOPermission::typeid ); + Console::WriteLine( "The last permission set after removing FileIOPermission = {0}", ps5 ); + // + + // + // Change the permission set using SetPermission. + ps5->SetPermission( gcnew EnvironmentPermission( EnvironmentPermissionAccess::AllAccess,"USERNAME" ) ); + Console::WriteLine( "Permission set after SetPermission = {0}", ps5 ); + // + + // + // Display result of ToXml and FromXml operations. + PermissionSet^ ps6 = gcnew PermissionSet( PermissionState::None ); + ps6->FromXml( ps5->ToXml() ); + Console::WriteLine( "Result of ToFromXml = {0}\n", ps6 ); + // + + // + // Display results of PermissionSet::GetEnumerator. + IEnumerator^ psEnumerator = ps1->GetEnumerator(); + while ( psEnumerator->MoveNext() ) + { + Console::WriteLine( psEnumerator->Current ); + } + // + + // + // Check for an unrestricted permission set. + PermissionSet^ ps7 = gcnew PermissionSet( PermissionState::Unrestricted ); + Console::WriteLine( "Permission set is unrestricted = {0}", ps7->IsUnrestricted() ); + // + + // + // Create and display a copy of a permission set. + ps7 = ps5->Copy(); + Console::WriteLine( "Result of copy = {0}", ps7 ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +int main() +{ + PermissionSetDemo(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp new file mode 100644 index 00000000000..67c13f7830e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.CodeAccessSecurityAttribute/CPP/nameidpermissionattribute.cpp @@ -0,0 +1,59 @@ +#using "NameIdPermission.dll" +// +using namespace System; +using namespace System::IO; +using namespace System::Runtime::Remoting; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Reflection; +using namespace MyPermission; + +// Use the command line option '/keyfile' or appropriate project settings to sign this assembly. +[assembly:System::Security::AllowPartiallyTrustedCallersAttribute]; +[AttributeUsage(AttributeTargets::Method|AttributeTargets::Constructor|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Assembly,AllowMultiple=true,Inherited=false)] +[Serializable] +public ref class NameIdPermissionAttribute: public CodeAccessSecurityAttribute +{ +private: + String^ m_Name; + bool m_unrestricted; + +public: + NameIdPermissionAttribute( SecurityAction action ) + : CodeAccessSecurityAttribute( action ) + { + m_Name = nullptr; + m_unrestricted = false; + } + + + property String^ Name + { + String^ get() + { + return m_Name; + } + + void set( String^ value ) + { + m_Name = value; + } + + } + virtual IPermission^ CreatePermission() override + { + if ( m_unrestricted ) + { + throw gcnew ArgumentException( "Unrestricted permissions not allowed in identity permissions." ); + } + else + { + if ( m_Name == nullptr ) + return gcnew NameIdPermission( PermissionState::None ); + return gcnew NameIdPermission( m_Name ); + } + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp new file mode 100644 index 00000000000..e1cfddf9959 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.DataProtectionPermission2/CPP/dataprotect.cpp @@ -0,0 +1,234 @@ + +// +#using + +using namespace System; +using namespace System::Security::Permissions; +using namespace System::Security::Cryptography; +using namespace System::Security; +using namespace System::IO; + +[assembly:DataProtectionPermissionAttribute( +SecurityAction::RequestMinimum, +Flags=DataProtectionPermissionFlags::ProtectData)]; +public ref class DataProtect +{ +private: + + // Create a byte array for additional entropy when using the + // Protect and Unprotect methods. + static array^ s_additionalEntropy = {9,8,7,6,5}; + static array^ encryptedSecret; + static array^ originalData; + +public: + static void Main() + { + + // + Console::WriteLine( "Creating a permission with the Flags property =" + " ProtectData." ); + DataProtectionPermission ^ sp = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData ); + + ProtectData(); + // + sp->PermitOnly(); + // The following code results in an exception due to an attempt + // to unprotect data. + UnprotectData(); + + // Remove the restrictive permission. + CodeAccessPermission::RevertPermitOnly(); + + // The untprotect call will now succeed. + UnprotectData(); + + // Demonstrate the behavior of the class members. + ShowMembers(); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadKey(); + return; + } + + +private: + + + // The following method is intended to demonstrate only the behavior of + // DataProtectionPermission class members,and not their practical usage. + // Most properties and methods in this class are used for the resolution + // and enforcement of security policy by the security infrastructure code. + static void ShowMembers() + { + Console::WriteLine( "Creating four DataProtectionPermissions" ); + Console::WriteLine( "Creating the first permission with the Flags " + "property = ProtectData." ); + DataProtectionPermission ^ sp1 = gcnew DataProtectionPermission( DataProtectionPermissionFlags::ProtectData ); + Console::WriteLine( "Creating the second permission with the Flags " + "property = AllFlags." ); + DataProtectionPermission ^ sp2 = gcnew DataProtectionPermission( DataProtectionPermissionFlags::AllFlags ); + Console::WriteLine( "Creating the third permission with a permission " + "state = Unrestricted." ); + + // + DataProtectionPermission ^ sp3 = gcnew DataProtectionPermission( PermissionState::Unrestricted ); + + // + Console::WriteLine( "Creating the fourth permission with a permission" + " state = None." ); + DataProtectionPermission ^ sp4 = gcnew DataProtectionPermission( PermissionState::None ); + + // + bool rc = sp2->IsSubsetOf( sp3 ); + Console::WriteLine( "Is the permission with all flags set (AllFlags) " + "a subset of \n \tthe permission with an Unrestricted " + "permission state? {0}", (rc ? (String^)"Yes" : "No") ); + rc = sp1->IsSubsetOf( sp2 ); + Console::WriteLine( "Is the permission with ProtectData access a " + "subset of the permission with \n" + "\tAllFlags set? {0}", (rc ? (String^)"Yes" : "No") ); + + // + // + rc = sp3->IsUnrestricted(); + Console::WriteLine( "Is the third permission unrestricted? {0}", (rc ? (String^)"Yes" : "No") ); + + // + // + Console::WriteLine( "Copying the second permission to the fourth " + "permission." ); + sp4 = dynamic_cast(sp2->Copy()); + rc = sp4->Equals( sp2 ); + Console::WriteLine( "Is the fourth permission equal to the second " + "permission? {0}", (rc ? (String^)"Yes" : "No") ); + + // + // + Console::WriteLine( "Creating the intersection of the second and " + "first permissions." ); + sp4 = dynamic_cast(sp2->Intersect( sp1 )); + Console::WriteLine( "The value of the Flags property is: {0}", sp4->Flags ); + + // + // + Console::WriteLine( "Creating the union of the second and first " + "permissions." ); + sp4 = dynamic_cast(sp2->Union( sp1 )); + Console::WriteLine( "Result of the union of the second permission " + "with the first: {0}", sp4->Flags ); + + // + // + Console::WriteLine( "Using an XML round trip to reset the fourth " + "permission." ); + sp4->FromXml( sp2->ToXml() ); + rc = sp4->Equals( sp2 ); + Console::WriteLine( "Does the XML round trip result equal the " + "original permission? {0}", (rc ? (String^)"Yes" : "No") ); + + // + } + + +public: + + // Create a simple byte array containing data to be encrypted. + static void ProtectData() + { + array^secret = {0,1,2,3,4,1,2,3,4}; + + //Encrypt the data. + encryptedSecret = Protect( secret ); + Console::WriteLine( "The encrypted byte array is:" ); + if ( encryptedSecret != nullptr ) + PrintValues( encryptedSecret ); + } + + + // Decrypt the data and store in a byte array. + static void UnprotectData() + { + originalData = Unprotect( encryptedSecret ); + if ( originalData != nullptr ) + { + Console::WriteLine( "\r\nThe original data is:" ); + PrintValues( originalData ); + } + } + + + // Encrypt data in the specified byte array. + static array^ Protect( array^data ) + { + try + { + + // Encrypt the data using DataProtectionScope.CurrentUser. + // The result can be decrypted only by the user who encrypted + // the data. + return ProtectedData::Protect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "Data was not encrypted. " + "An error has occurred." ); + Console::WriteLine( e ); + return nullptr; + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Insufficient permissions. " + "An error has occurred." ); + Console::WriteLine( e ); + return nullptr; + } + + } + + + // Decrypt data in the specified byte array. + static array^ Unprotect( array^data ) + { + try + { + + //Decrypt the data using DataProtectionScope.CurrentUser. + return ProtectedData::Unprotect( data, s_additionalEntropy, DataProtectionScope::CurrentUser ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "Data was not decrypted. " + "An error has occurred." ); + Console::WriteLine( e ); + return nullptr; + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Insufficient permissions. " + "An error has occurred." ); + Console::WriteLine( e ); + return nullptr; + } + + } + + static void PrintValues( array^myArr ) + { + System::Collections::IEnumerator^ myEnum = myArr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte i = safe_cast(myEnum->Current); + Console::Write( "\t{0}", i ); + } + + Console::WriteLine(); + } + +}; + +int main() +{ + DataProtect::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp new file mode 100644 index 00000000000..8f6d1b640df --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/fileiopermission.cpp @@ -0,0 +1,534 @@ + +// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml, FromXml, +// GetPathList and SetPathList methods, and the AllFiles and AllLocalFiles properties +// of the FileIOPermission class. +// +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +// This class generates FileIOPermission objects. + +[assembly:CLSCompliant(true)]; +private ref class FileIOGenerator +{ +private: + array^myFile; + array^myAccess; + int fileIndex; + +public: + FileIOGenerator() + { + array^tempFile = {"C:\\Examples\\Test\\TestFile.txt","C:\\Examples\\Test\\","C:\\Examples\\Test\\..","C:\\Temp"}; + myFile = tempFile; + array^ tempAccess = {FileIOPermissionAccess::AllAccess,FileIOPermissionAccess::Append,FileIOPermissionAccess::NoAccess,FileIOPermissionAccess::PathDiscovery,FileIOPermissionAccess::Read,FileIOPermissionAccess::Write}; + myAccess = tempAccess; + ResetIndex(); + } + + void ResetIndex() + { + fileIndex = 0; + } + + + // Create a file path. + // + bool CreateFilePath( [Out]interior_ptr file ) + { + if ( fileIndex == myFile->Length ) + { + *file = ""; + fileIndex++; + return true; + } + + if ( fileIndex > myFile->Length ) + { + *file = ""; + return false; + } + + *file = myFile[ fileIndex++ ]; + try + { + return true; + } + catch ( Exception^ e ) + { + Console::WriteLine( "Cannot create FileIOPermission: {0} {1}", *file, e ); + *file = ""; + return true; + } + + } + + // +}; + +public ref class FileIOPermissionDemo +{ +private: + + // IsSubsetOf determines whether the current permission is a subset of the specified permission. + // This method compares various FileIOPermission paths with FileIOPermissionAccess set to AllAccess. + // + bool IsSubsetOfDemo() + { + bool returnValue = true; + String^ fileIO1; + String^ fileIO2; + FileIOPermission^ fileIOPerm1; + FileIOPermission^ fileIOPerm2; + FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; + FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; + fileIOGen1->ResetIndex(); + while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) + { + if (fileIO1 == "") + fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::AllAccess, fileIO1); + + Console::WriteLine( "**********************************************************\n" ); + fileIOGen2->ResetIndex(); + while ( fileIOGen2->CreateFilePath( &fileIO2 ) ) + { + if (fileIO2 == "") + fileIOPerm2 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::AllAccess, fileIO2); + String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1; + String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2; + if ( fileIOPerm2 == nullptr ) + continue; + try + { + if ( fileIOPerm1->IsSubsetOf( fileIOPerm2 ) ) + { + Console::WriteLine( "{0} is a subset of {1}\n", firstPermission, secondPermission ); + } + else + { + Console::WriteLine( "{0} is not a subset of {1}\n", firstPermission, secondPermission ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown for subset :{0}\n{1}\n{2}", (fileIO1->Equals( "" ) ? "null" : fileIO1), (fileIO2->Equals( "" ) ? "null" : fileIO2), e ); + } + + } + } + + return returnValue; + } + + + // + // Union creates a new permission that is the union of the current permission and the specified permission. + // + bool UnionDemo() + { + bool returnValue = true; + String^ fileIO1; + String^ fileIO2; + FileIOPermission^ fileIOPerm1; + FileIOPermission^ fileIOPerm2; + IPermission^ fileIOPerm3; + FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; + FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; + fileIOGen1->ResetIndex(); + while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) + { + if (fileIO1 == "") + fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); + + Console::WriteLine( "**********************************************************\n" ); + fileIOGen2->ResetIndex(); + while ( fileIOGen2->CreateFilePath( &fileIO2 ) ) + { + if (fileIO2 == "") + fileIOPerm2 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2); + try + { + if ( fileIOPerm2 == nullptr ) + continue; + String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1; + String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2; + fileIOPerm3 = dynamic_cast(fileIOPerm1->Union( fileIOPerm2 )); + fileIOPerm3 = fileIOPerm1->Union( fileIOPerm2 ); + if ( fileIOPerm3 == nullptr ) + { + Console::WriteLine( "The union of {0} and {1} is null.", firstPermission, secondPermission ); + } + else + { + Console::WriteLine( "The union of {0} and {1} = \n\t{2}", firstPermission, secondPermission, (dynamic_cast(fileIOPerm3))->GetPathList( FileIOPermissionAccess::Read )[ 0 ] ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown for union {0}", e ); + returnValue = false; + } + + } + } + + return returnValue; + } + + + // + // Intersect creates and returns a new permission that is the intersection of the current + // permission and the permission specified. + // + bool IntersectDemo() + { + bool returnValue = true; + String^ fileIO1; + String^ fileIO2; + FileIOPermission^ fileIOPerm1; + FileIOPermission^ fileIOPerm2; + FileIOPermission^ fileIOPerm3; + FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; + FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; + fileIOGen1->ResetIndex(); + while ( fileIOGen1->CreateFilePath ( &fileIO1 ) ) + { + if (fileIO1 == "") + fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); + + Console::WriteLine( "**********************************************************\n" ); + fileIOGen2->ResetIndex(); + while ( fileIOGen2->CreateFilePath( &fileIO2 ) ) + { + if (fileIO2 == "") + fileIOPerm2 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm2 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO2); + String^ firstPermission = fileIO1 == "" || fileIO1 == nullptr ? "null" : fileIO1; + String^ secondPermission = fileIO2 == "" || fileIO2 == nullptr ? "null" : fileIO2; + try + { + fileIOPerm3 = dynamic_cast(fileIOPerm1->Intersect( fileIOPerm2 )); + if ( fileIOPerm3 != nullptr && fileIOPerm3->GetPathList( FileIOPermissionAccess::Read ) != nullptr ) + { + Console::WriteLine( "The intersection of {0} and \n\t{1} = \n\t{2}", firstPermission, secondPermission, (dynamic_cast(fileIOPerm3))->GetPathList( FileIOPermissionAccess::Read )[ 0 ] ); + } + else + { + Console::WriteLine( "The intersection of {0} and {1} is null.", firstPermission, secondPermission ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown for intersection {0}", e ); + returnValue = false; + } + + } + } + + return returnValue; + } + + + // + //Copy creates and returns an identical copy of the current permission. + // + bool CopyDemo() + { + bool returnValue = true; + String^ fileIO1; + FileIOPermission^ fileIOPerm1; + FileIOPermission^ fileIOPerm2; + FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; + FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; + fileIOGen1->ResetIndex(); + while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) + { + if (fileIO1 == "") + fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); + + Console::WriteLine( "**********************************************************\n" ); + fileIOGen2->ResetIndex(); + try + { + fileIOPerm2 = dynamic_cast(fileIOPerm1->Copy()); + if ( fileIOPerm2 != nullptr ) + { + Console::WriteLine( "Result of copy = {0}\n", fileIOPerm2 ); + } + else + { + Console::WriteLine( "Result of copy is null. \n" ); + } + } + catch ( Exception^ e ) + { + { + if ( fileIO1->Equals( "" ) ) + { + Console::WriteLine( "The target FileIOPermission is empty, copy failed." ); + } + else + Console::WriteLine( e ); + } + continue; + } + + } + + return returnValue; + } + + + // + // ToXml creates an XML encoding of the permission and its current state; + // FromXml reconstructs a permission with the specified state from the XML encoding. + // + bool ToFromXmlDemo() + { + bool returnValue = true; + String^ fileIO1; + FileIOPermission^ fileIOPerm1; + FileIOPermission^ fileIOPerm2; + FileIOGenerator^ fileIOGen1 = gcnew FileIOGenerator; + FileIOGenerator^ fileIOGen2 = gcnew FileIOGenerator; + fileIOGen1->ResetIndex(); + while ( fileIOGen1->CreateFilePath( &fileIO1 ) ) + { + if (fileIO1 == "") + fileIOPerm1 = gcnew FileIOPermission(PermissionState::None); + else + fileIOPerm1 = gcnew FileIOPermission(FileIOPermissionAccess::Read, fileIO1); + + Console::WriteLine( "********************************************************\n" ); + fileIOGen2->ResetIndex(); + try + { + fileIOPerm2 = gcnew FileIOPermission( PermissionState::None ); + fileIOPerm2->FromXml( fileIOPerm1->ToXml() ); + Console::WriteLine( "Result of ToFromXml = {0}\n", fileIOPerm2 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "ToFromXml failed :{0}{1}", fileIOPerm1, e ); + continue; + } + + } + + return returnValue; + } + + + // + // AddPathList adds access for the specified files and directories to the existing state of the permission. + // SetPathList sets the specified access to the specified files and directories, replacing the existing state + // of the permission. + // GetPathList gets all files and directories that have the specified FileIOPermissionAccess. + // + bool SetGetPathListDemo() + { + try + { + Console::WriteLine( "********************************************************\n" ); + FileIOPermission^ fileIOPerm1; + Console::WriteLine( "Creating a FileIOPermission with AllAccess rights for 'C:\\Examples\\Test\\TestFile.txt" ); + + // + fileIOPerm1 = gcnew FileIOPermission( FileIOPermissionAccess::AllAccess,"C:\\Examples\\Test\\TestFile.txt" ); + + // + Console::WriteLine( "Adding 'C:\\Temp' to the write access list, and \n 'C:\\Examples\\Test' to read access." ); + fileIOPerm1->AddPathList( FileIOPermissionAccess::Write, "C:\\Temp" ); + fileIOPerm1->AddPathList( FileIOPermissionAccess::Read, "C:\\Examples\\Test" ); + array^paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Read ); + Console::WriteLine( "Read access before SetPathList = " ); + IEnumerator^ myEnum = paths->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ path = safe_cast(myEnum->Current); + Console::WriteLine( "\t{0}", path ); + } + + Console::WriteLine( "Setting the read access list to \n'C:\\Temp'" ); + fileIOPerm1->SetPathList( FileIOPermissionAccess::Read, "C:\\Temp" ); + paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Read ); + Console::WriteLine( "Read access list after SetPathList = " ); + IEnumerator^ myEnum1 = paths->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + String^ path = safe_cast(myEnum1->Current); + Console::WriteLine( "\t{0}", path ); + } + + paths = fileIOPerm1->GetPathList( FileIOPermissionAccess::Write ); + Console::WriteLine( "Write access list after SetPathList = " ); + IEnumerator^ myEnum2 = paths->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + String^ path = safe_cast(myEnum2->Current); + Console::WriteLine( "\t{0}", path ); + } + + Console::WriteLine( "Write access = \n{0}", fileIOPerm1->GetPathList( FileIOPermissionAccess::AllAccess ) ); + } + catch ( ArgumentException^ e ) + { + + // FileIOPermissionAccess.AllAccess can not be used as a parameter for GetPathList. + Console::WriteLine( "An ArgumentException occurred as a result of using AllAccess. This property cannot be used as a parameter in GetPathList because it represents more than one type of file variable access. : \n{0}", e ); + } + + return true; + } + + + // + // The AllFiles property gets or sets the permitted access to all files. + // The AllLocalFiles property gets or sets the permitted access to all local files. + // + bool AllFilesDemo() + { + try + { + Console::WriteLine( "********************************************************\n" ); + FileIOPermission^ fileIOPerm1; + Console::WriteLine( "Creating a FileIOPermission and adding read access for all files" ); + fileIOPerm1 = gcnew FileIOPermission( FileIOPermissionAccess::AllAccess,"C:\\Examples\\Test\\TestFile.txt" ); + fileIOPerm1->AllFiles = FileIOPermissionAccess::Read; + Console::WriteLine( "AllFiles access = {0}", fileIOPerm1->AllFiles ); + Console::WriteLine( "Adding AllAccess rights for local files." ); + fileIOPerm1->AllLocalFiles = FileIOPermissionAccess::AllAccess; + Console::WriteLine( "AllLocalFiles access = {0}", fileIOPerm1->AllLocalFiles ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e ); + return false; + } + + return true; + } + + +public: + + // + // Invoke all demos. + bool RunDemo() + { + bool ret = true; + bool retTmp; + + // Call the IsSubsetOfPath demo. + if ( retTmp = IsSubsetOfDemo() ) + Console::WriteLine( "IsSubsetOf demo completed successfully." ); + else + Console::WriteLine( "IsSubsetOf demo failed." ); + + ret = retTmp && ret; + + // Call the Union demo. + if ( retTmp = UnionDemo() ) + Console::WriteLine( "Union demo completed successfully." ); + else + Console::WriteLine( "Union demo failed." ); + + ret = retTmp && ret; + + // Call the Intersect demo. + if ( retTmp = IntersectDemo() ) + Console::WriteLine( "Intersect demo completed successfully." ); + else + Console::WriteLine( "Intersect demo failed." ); + + ret = retTmp && ret; + + // Call the Copy demo. + if ( retTmp = CopyDemo() ) + Console::WriteLine( "Copy demo completed successfully." ); + else + Console::WriteLine( "Copy demo failed." ); + + ret = retTmp && ret; + + // Call the ToFromXml demo. + if ( retTmp = ToFromXmlDemo() ) + Console::WriteLine( "ToFromXml demo completed successfully." ); + else + Console::WriteLine( "ToFromXml demo failed." ); + + ret = retTmp && ret; + + // Call the SetGetPathList demo. + if ( retTmp = SetGetPathListDemo() ) + Console::WriteLine( "SetGetPathList demo completed successfully." ); + else + Console::WriteLine( "SetGetPathList demo failed." ); + + ret = retTmp && ret; + + // Call the AllFiles demo. + if ( retTmp = AllFilesDemo() ) + Console::WriteLine( "AllFiles demo completed successfully." ); + else + Console::WriteLine( "AllFiles demo failed." ); + + ret = retTmp && ret; + return (ret); + } + +}; + + +// Test harness. +int main() +{ + try + { + FileIOPermissionDemo^ democase = gcnew FileIOPermissionDemo; + bool ret = democase->RunDemo(); + if ( ret ) + { + Console::WriteLine( "FileIOPermission demo completed successfully." ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 100; + } + else + { + Console::WriteLine( "FileIOPermission demo failed." ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "FileIOPermission demo failed" ); + Console::WriteLine( e ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + +} + +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp new file mode 100644 index 00000000000..6593317f496 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermission/CPP/remarks.cpp @@ -0,0 +1,95 @@ + +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; + +int main() +{ + try + { + FileIOPermission^ fileIOPerm1; + fileIOPerm1 = gcnew FileIOPermission(PermissionState::Unrestricted); + + // Tests for: SetPathList(FileIOPermissionAccess,String) + + // Test the Read list + fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, "C:\\documents"); + + Console::WriteLine("Read access before SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) + { + Console::WriteLine("\t" + path); + } + + // + fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, "C:\\temp"); + // + + Console::WriteLine("Read access after SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) + { + Console::WriteLine("\t" + path); + } + + // Test the Write list + fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, "C:\\temp"); + + Console::WriteLine("Write access before SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) + { + Console::WriteLine("\t" + path); + } + // + fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, "C:\\documents"); + // + + Console::WriteLine("Write access after SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) + { + Console::WriteLine("\t" + path); + } + + // Tests for: SetPathList(FileIOPermissionAccess,String[]) + + // Test the Read list + fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, gcnew array {"C:\\pictures", "C:\\music"}); + + Console::WriteLine("Read access before SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) + { + Console::WriteLine("\t" + path); + } + + // + fileIOPerm1->SetPathList(FileIOPermissionAccess::Read, gcnew array {"C:\\temp", "C:\\Documents"}); + // + + Console::WriteLine("Read access after SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Read)) + { + Console::WriteLine("\t" + path); + } + + // Test the Write list + fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, gcnew array {"C:\\temp", "C:\\Documents"}); + + Console::WriteLine("Write access before SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) + { + Console::WriteLine("\t" + path); + } + // + fileIOPerm1->SetPathList(FileIOPermissionAccess::Write, gcnew array {"C:\\pictures", "C:\\music"}); + // + + Console::WriteLine("Write access after SetPathList = "); + for each (String^ path in fileIOPerm1->GetPathList(FileIOPermissionAccess::Write)) + { + Console::WriteLine("\t" + path); + } + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + } +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp new file mode 100644 index 00000000000..da97ffa6c9f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.FileIOPermissionAttribute/CPP/fileiopermissionattribute.cpp @@ -0,0 +1,102 @@ + +// +// This sample demonstrates the use of the FileIOPermissionAttribute class. +// The sample follows the recommended procedure of first granting PermitOnly permissions, +// then using a Deny on that set of granted permissions. +using namespace System; +using namespace System::Reflection; +using namespace System::Security::Permissions; +using namespace System::Security; +using namespace System::IO; +void PermitOnlyMethod(); +void PermitOnlyTestMethod(); +void TestFailed(); + + +// This method demonstrates the use of the FileIOPermissionAttribute to create a PermitOnly permission. +// +// +// Set the Read property. +[FileIOPermissionAttribute(SecurityAction::PermitOnly,Read="C:\\")] +// +// +// Set the PathDiscovery property. +[FileIOPermissionAttribute(SecurityAction::PermitOnly, +PathDiscovery="C:\\Documents and Settings\\All Users")] +// +// +// Set the Append property. +[FileIOPermissionAttribute(SecurityAction::PermitOnly, +Append="C:\\Documents and Settings\\All Users\\Application Data")] +// +// +// Set the Write property. +[FileIOPermissionAttribute(SecurityAction::PermitOnly, +Write="C:\\Documents and Settings\\All Users\\Application Data\\Microsoft")] +// +// +// Set the All property. +[FileIOPermissionAttribute(SecurityAction::PermitOnly, +All="C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network")] +// + +void PermitOnlyMethod() +{ + Console::WriteLine( "Executing PermitOnlyMethod." ); + Console::WriteLine( "PermitOnly the Read permission for drive C." ); + Console::WriteLine( "PermitOnly the PathDiscovery permission for \n\tC:\\Documents and Settings\\All Users." ); + Console::WriteLine( "PermitOnly the Append permission for \n\tC:\\Documents and Settings\\All Users\\Application Data." ); + Console::WriteLine( "PermitOnly the Write permission for \n\tC:\\Documents and Settings\\All Users\\Application Data\\Microsoft." ); + Console::WriteLine( "PermitOnly the All permission for \n\tC:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network." ); + PermitOnlyTestMethod(); +} +// + +void PermitOnlyTestMethod() +{ + Console::WriteLine("Executing PermitOnlyTestMethod."); + try + { + PermissionSet^ ps = gcnew PermissionSet(PermissionState::None); + ps->AddPermission(gcnew FileIOPermission(FileIOPermissionAccess::Write, + "C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network\\SomeFile")); + Console::WriteLine("Demanding permission to write " + + "'C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Network\\SomeFile'"); + ps->Demand(); + Console::WriteLine("Demand succeeded."); + ps->AddPermission( + gcnew FileIOPermission(FileIOPermissionAccess::Write, + "C:\\")); + Console::WriteLine("Demanding permission to write to drive C."); + + // This demand should cause an exception. + ps->Demand(); + // The TestFailed method is called if an exception is not thrown. + TestFailed(); + } + catch (Exception^ e) + { + Console::WriteLine("An exception was thrown because of a write demand: " + e->Message); + } +} + +void TestFailed() +{ + Console::WriteLine( "Executing TestFailed." ); + Console::WriteLine( "Throwing an exception." ); + throw gcnew Exception; +} + +int main() +{ + try + { + PermitOnlyMethod(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp new file mode 100644 index 00000000000..0f1fb73c3e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermission/CPP/gacidentitypermission.cpp @@ -0,0 +1,260 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +public ref class GacIdentityPermissionDemo +{ +private: + + // + // IsSubsetOf determines whether the current permission is a subset of the specified permission. + bool IsSubsetOfDemo() + { + try + { + + // + GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; + GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission( PermissionState::None ); + if ( Gac1->Equals( Gac2 ) ) + Console::WriteLine( "GacIdentityPermission() equals GacIdentityPermission(PermissionState.None)." ); + + + // + if ( Gac1->IsSubsetOf( Gac2 ) ) + { + Console::WriteLine( "{0} is a subset of {1}", Gac1, Gac2 ); + } + else + { + Console::WriteLine( "{0} is not a subset of {1}", Gac1, Gac2 ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown : {0}", e ); + return false; + } + + return true; + } + + + // + // + // Union creates a new permission that is the union of the current permission + // and the specified permission. + bool UnionDemo() + { + + // + GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission( PermissionState::None ); + + // + // + GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; + + // + try + { + GacIdentityPermission ^ p3 = dynamic_cast(Gac1->Union( Gac2 )); + if ( p3 != nullptr ) + { + Console::WriteLine( "The union of two GacIdentityPermissions was successful." ); + } + else + { + Console::WriteLine( "The union of two GacIdentityPermissions failed." ); + return false; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown : {0}", e ); + return false; + } + + return true; + } + + + // + // + // Intersect creates and returns a new permission that is the intersection of the + // current permission and the specified permission. + bool IntersectDemo() + { + GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; + GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; + try + { + GacIdentityPermission ^ p3 = dynamic_cast(Gac1->Intersect( Gac2 )); + if ( p3 != nullptr ) + { + Console::WriteLine( "The intersection of the two permissions = {0}\n", p3 ); + } + else + { + Console::WriteLine( "The intersection of the two permissions is null.\n" ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception was thrown : {0}", e ); + return false; + } + + return true; + } + + + // + // + //Copy creates and returns an identical copy of the current permission. + bool CopyDemo() + { + GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; + GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; + Console::WriteLine( "**************************************************************************" ); + try + { + Gac2 = dynamic_cast(Gac1->Copy()); + if ( Gac2 != nullptr ) + { + Console::WriteLine( "Result of copy = {0}\n", Gac2 ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Copy failed : {0}{1}", Gac1, e ); + return false; + } + + return true; + } + + + // + // + // ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a + // permission with the specified state from the XML encoding. + bool ToFromXmlDemo() + { + GacIdentityPermission ^ Gac1 = gcnew GacIdentityPermission; + GacIdentityPermission ^ Gac2 = gcnew GacIdentityPermission; + Console::WriteLine( "**************************************************************************" ); + try + { + Gac2 = gcnew GacIdentityPermission( PermissionState::None ); + Gac2->FromXml( Gac1->ToXml() ); + bool result = Gac2->Equals( Gac1 ); + if ( Gac2->IsSubsetOf( Gac1 ) && Gac1->IsSubsetOf( Gac2 ) ) + { + Console::WriteLine( "Result of ToFromXml = {0}", Gac2 ); + } + else + { + Console::WriteLine( Gac2 ); + Console::WriteLine( Gac1 ); + return false; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "ToFromXml failed. {0}", e ); + return false; + } + + return true; + } + + +public: + + // + // Invoke all demos. + bool RunDemo() + { + bool returnCode = true; + bool tempReturnCode; + + // Call the IsSubsetOf demo. + if ( tempReturnCode = IsSubsetOfDemo() ) + Console::WriteLine( "IsSubsetOf demo completed successfully." ); + else + Console::WriteLine( "Subset demo failed." ); + + returnCode = tempReturnCode && returnCode; + + // Call the Union demo. + if ( tempReturnCode = UnionDemo() ) + Console::WriteLine( "Union demo completed successfully." ); + else + Console::WriteLine( "Union demo failed." ); + + returnCode = tempReturnCode && returnCode; + + // Call the Intersect demo. + if ( tempReturnCode = IntersectDemo() ) + Console::WriteLine( "Intersect demo completed successfully." ); + else + Console::WriteLine( "Intersect demo failed." ); + + returnCode = tempReturnCode && returnCode; + + // Call the Copy demo. + if ( tempReturnCode = CopyDemo() ) + Console::WriteLine( "Copy demo completed successfully." ); + else + Console::WriteLine( "Copy demo failed." ); + + returnCode = tempReturnCode && returnCode; + + // Call the ToFromXML demo. + if ( tempReturnCode = ToFromXmlDemo() ) + Console::WriteLine( "ToFromXML demo completed successfully." ); + else + Console::WriteLine( "ToFromXml demo failed." ); + + returnCode = tempReturnCode && returnCode; + return (returnCode); + } + +}; + + +// Test harness. +int main() +{ + try + { + GacIdentityPermissionDemo^ testcase = gcnew GacIdentityPermissionDemo; + bool returnCode = testcase->RunDemo(); + if ( returnCode ) + { + Console::WriteLine( "The GacIdentityPermission demo completed successfully." ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 100; + } + else + { + Console::WriteLine( "The GacIdentityPermission demo failed." ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "The GacIdentityPermission demo failed." ); + Console::WriteLine( e ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp new file mode 100644 index 00000000000..19d961987aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.GacIdentityPermissionAttribute/CPP/gacidentitypermissionattribute.cpp @@ -0,0 +1,51 @@ + +// +// To run this sample you must create a strong-name key named snkey.snk +// using the Strong Name tool (sn.exe). Both the library assembly and the +// application assembly that calls it must be signed with that key. +// To run successfully, the application assembly must be in the global +// assembly cache. +// This console application can be created using the following code. + +//#using +//#using +//using namespace System; +//using namespace System::Security; +//using namespace System::Reflection; +//using namespace ClassLibrary1; +//[assembly: AssemblyVersion(S"1.0.555.0")] +//[assembly: AssemblyKeyFile(S"snKey.snk")]; +//int main() +//{ +// try +// { +// Class1* myLib = new Class1(); +// myLib->DoNothing(); +// +// Console::WriteLine(S"Exiting the sample."); +// } +// catch (Exception* e) +// { +// Console::WriteLine(e->Message); +// } +//} +using namespace System; +using namespace System::Security::Permissions; + +namespace ClassLibrary1 +{ + // + // Demand that the calling program be in the global assembly cache. + [GacIdentityPermissionAttribute(SecurityAction::Demand)] + public ref class Class1 + // + { + public: + void DoNothing() + { + Console::WriteLine( "Exiting the library program." ); + } + }; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp new file mode 100644 index 00000000000..6d805d4667a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.HostProtectionAttribute.1.1/CPP/hostprotectionattribute.cpp @@ -0,0 +1,243 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Threading; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Principal; +using namespace System::Security::Permissions; +using namespace System::Diagnostics; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +// +// The following class is an example of code that exposes external process management. +// Add the LicenseProviderAttribute to the control. + +[LicenseProvider(LicFileLicenseProvider::typeid)] +public ref class MyControl: public System::Windows::Forms::Control +{ +private: + + // Create a new, null license. + License^ license; + +public: + [HostProtection(ExternalProcessMgmt=true)] + MyControl() + { + license = nullptr; + + // Determine if a valid license can be granted. + bool isValid = LicenseManager::IsValid( MyControl::typeid ); + Console::WriteLine( "The result of the IsValid method call is {0}", isValid ); + } + +}; +// + +// If this application is run on a server that implements host protection, the HostProtection attribute +// is applied. If the application is run on a server that is not host-protected, the attribute +// evaporates; it is not detected and therefore not applied. HostProtection can be configured with +// members of the HostProtectionResource enumeration to customize the protection offered. +// The primary intent of this sample is to show situations in which the HostProtection attribute +// might be meaningfully used. The environment required to demonstrate a particular HostProtection is +// too complex to invoke within the scope of this sample. +public ref class HostProtectionExample +{ +public: + static int Success = 100; + +private: + + // + // Use the enumeration flags to indicate that this method exposes shared state and + // self-affecting process management. + // Either of the following attribute statements can be used to set the + // resource flags. + // Exit the sample when an exception is thrown. + + [HostProtection(SharedState=true,SelfAffectingProcessMgmt=true)] + [HostProtection(Resources=HostProtectionResource::SharedState| + HostProtectionResource::SelfAffectingProcessMgmt)] + static void Exit( String^ Message, int Code ) + { + Console::WriteLine( "\nFAILED: {0} {1}", Message, Code ); + Environment::ExitCode = Code; + Environment::Exit( Code ); + } + // + + // + // Use the enumeration flags to indicate that this method exposes shared state, + // self-affecting process management, and self-affecting threading. + // This method allows the user to quit the sample. + + [HostProtection(SharedState=true,SelfAffectingProcessMgmt=true, + SelfAffectingThreading=true,UI=true)] + static void ExecuteBreak() + { + Console::WriteLine( "Executing Debugger.Break." ); + Debugger::Break(); + Debugger::Log( 1, "info", "test message" ); + } + // + + // + // Use the enumeration flags to indicate that this method exposes shared state, + // self-affecting threading and the security infrastructure. + // ApplyIdentity sets the current identity. + + [HostProtection(SharedState=true,SelfAffectingThreading=true, + SecurityInfrastructure=true)] + static int ApplyIdentity() + { + array^roles = {"User"}; + try + { + AppDomain^ mAD = AppDomain::CurrentDomain; + GenericPrincipal^ mGenPr = gcnew GenericPrincipal( WindowsIdentity::GetCurrent(),roles ); + mAD->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal ); + mAD->SetThreadPrincipal( mGenPr ); + return Success; + } + catch ( Exception^ e ) + { + Exit( e->ToString(), 5 ); + } + + return 0; + } + // + +public: + + // The following method is started on a separate thread. + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + static void WatchFileEvents() + { + try + { + Console::WriteLine( "In the child thread." ); + FileSystemWatcher^ watcher = gcnew FileSystemWatcher; + watcher->Path = "C:\\Temp"; + + // Watch for changes in LastAccess and LastWrite times, and + // name changes to files or directories. + watcher->NotifyFilter = static_cast(NotifyFilters::LastAccess | NotifyFilters::LastWrite | NotifyFilters::FileName | NotifyFilters::DirectoryName); + + // Watch only text files. + watcher->Filter = "*.txt"; + + // Add event handlers. + watcher->Changed += gcnew FileSystemEventHandler( OnChanged ); + watcher->Created += gcnew FileSystemEventHandler( OnChanged ); + watcher->Deleted += gcnew FileSystemEventHandler( OnChanged ); + + // Begin watching. + watcher->EnableRaisingEvents = true; + + // Wait for the user to quit the program. + Console::WriteLine( "Event handlers have been enabled." ); + while ( Console::Read() != 'q' ) + ; + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + + } + + +private: + + // + // Use the enumeration flags to indicate that this method exposes synchronization + // and external threading. + + [HostProtection(Synchronization=true,ExternalThreading=true)] + static void StartThread() + { + Thread^ t = gcnew Thread( gcnew ThreadStart( WatchFileEvents ) ); + + // Start the new thread. On a uniprocessor, the thread is not given + // any processor time until the main thread yields the processor. + t->Start(); + + // Give the new thread a chance to execute. + Thread::Sleep( 1000 ); + } + // + +public: + + // Call methods that show the use of the HostProtectionResource enumeration. + [HostProtection(Resources=HostProtectionResource::All)] + static int Main() + { + try + { + + // Show use of the HostProtectionResource.SharedState, + // HostProtectionResource.SelfAffectingThreading, and + // HostProtectionResource.Security enumeration values. + ApplyIdentity(); + Directory::CreateDirectory( "C:\\Temp" ); + + // Show use of the HostProtectionResource.Synchronization and + // HostProtectionResource.ExternalThreading enumeration values. + StartThread(); + Console::WriteLine( "In the main thread." ); + Console::WriteLine( "Deleting and creating 'MyTestFile.txt'." ); + if ( File::Exists( "C:\\Temp\\MyTestFile.txt" ) ) + { + File::Delete( "C:\\Temp\\MyTestFile.txt" ); + } + StreamWriter^ sr = File::CreateText( "C:\\Temp\\MyTestFile.txt" ); + sr->WriteLine( "This is my file." ); + sr->Close(); + Thread::Sleep( 1000 ); + + // Show use of the HostProtectionResource.SharedState, + // HostProtectionResource.SelfProcessMgmt, + // HostProtectionResource.SelfAffectingThreading, and + // HostProtectionResource.UI enumeration values. + ExecuteBreak(); + + // Show the use of the HostProtectionResource.ExternalProcessManagement enumeration value. + MyControl^ myControl = gcnew MyControl; + Console::WriteLine( "Enter 'q' to quit the sample." ); + return 100; + } + catch ( Exception^ e ) + { + Exit( e->ToString(), 0 ); + return 0; + } + } + + // Define the event handlers. + private: + static void OnChanged( Object^ /*source*/, FileSystemEventArgs^ e ) + { + + // Specify whether a file is changed, created, or deleted. + Console::WriteLine( "In the OnChanged event handler." ); + Console::WriteLine( "File: {0} {1}", e->FullPath, e->ChangeType ); + } + +}; + +int main() +{ + return HostProtectionExample::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp new file mode 100644 index 00000000000..ac08770304c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.KeyContainerPermission/CPP/keycontainerpermission.cpp @@ -0,0 +1,296 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Cryptography; + +public ref class KeyContainerPermissionDemo +{ +private: + static CspParameters^ cspParams = gcnew CspParameters; + static RSACryptoServiceProvider^ rsa = gcnew RSACryptoServiceProvider; + static String^ providerName; + static int providerType; + static String^ myKeyContainerName; + + // Create three KeyContainerPermissionAccessEntry objects, each with a different constructor. + // + static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry1 = gcnew KeyContainerPermissionAccessEntry( "MyKeyContainer",KeyContainerPermissionFlags::Create ); + + // + // + static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry2 = gcnew KeyContainerPermissionAccessEntry( cspParams,KeyContainerPermissionFlags::Open ); + + // + // + static KeyContainerPermissionAccessEntry^ keyContainerPermAccEntry3 = gcnew KeyContainerPermissionAccessEntry( "Machine",providerName,providerType,myKeyContainerName,1,KeyContainerPermissionFlags::Open ); + +public: + + // + static int Main() + { + try + { + + // Create a key container for use in the sample. + GenKey_SaveInContainer( "MyKeyContainer" ); + + // Initialize property values for creating a KeyContainerPermissionAccessEntry object. + myKeyContainerName = rsa->CspKeyContainerInfo->KeyContainerName; + providerName = rsa->CspKeyContainerInfo->ProviderName; + providerType = rsa->CspKeyContainerInfo->ProviderType; + cspParams->KeyContainerName = myKeyContainerName; + cspParams->ProviderName = providerName; + cspParams->ProviderType = providerType; + + // Display the KeyContainerPermissionAccessEntry properties using + // the third KeyContainerPermissionAccessEntry object. + DisplayAccessEntryMembers(); + + // + // Add access entry objects to a key container permission. + KeyContainerPermission ^ keyContainerPerm1 = gcnew KeyContainerPermission( PermissionState::Unrestricted ); + Console::WriteLine( "Is the permission unrestricted? {0}", keyContainerPerm1->IsUnrestricted() ); + keyContainerPerm1->AccessEntries->Add( keyContainerPermAccEntry1 ); + keyContainerPerm1->AccessEntries->Add( keyContainerPermAccEntry2 ); + + // + // Display the permission. + System::Console::WriteLine( keyContainerPerm1->ToXml() ); + + // + // Create an array of KeyContainerPermissionAccessEntry objects + array^keyContainerPermAccEntryArray = {keyContainerPermAccEntry1,keyContainerPermAccEntry2}; + + // Create a new KeyContainerPermission using the array. + KeyContainerPermission ^ keyContainerPerm2 = gcnew KeyContainerPermission( KeyContainerPermissionFlags::AllFlags,keyContainerPermAccEntryArray ); + + // + DisplayPermissionMembers( keyContainerPerm2, keyContainerPermAccEntryArray ); + + // Demonstrate the effect of a deny for opening a key container. + DenyOpen(); + + // Demonstrate the deletion of a key container. + DeleteContainer(); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadKey(); + return 0; + + // Close the current try block that did not expect an exception. + } + catch ( Exception^ e ) + { + Console::WriteLine( "Unexpected exception thrown: {0}", e->Message ); + return 0; + } + + } + + +private: + static void DisplayAccessEntryMembers() + { + + // + Console::WriteLine( "\nKeycontainerName is {0}", keyContainerPermAccEntry3->KeyContainerName ); + + // + // + Console::WriteLine( "KeySpec is {0}", (1 == keyContainerPermAccEntry3->KeySpec ? "AT_KEYEXCHANGE " : "AT_SIGNATURE") ); + + // + // + Console::WriteLine( "KeyStore is {0}", keyContainerPermAccEntry3->KeyStore ); + + // + // + Console::WriteLine( "ProviderName is {0}", keyContainerPermAccEntry3->ProviderName ); + + // + // + Console::WriteLine( "ProviderType is {0}", (1 == keyContainerPermAccEntry3->ProviderType ? "PROV_RSA_FULL" : keyContainerPermAccEntry3->ProviderType.ToString()) ); + + // + // + Console::WriteLine( "Hashcode = {0}", keyContainerPermAccEntry3->GetHashCode() ); + + // + // + Console::WriteLine( "Are the KeyContainerPermissionAccessEntry objects equal? {0}", keyContainerPermAccEntry3->Equals( keyContainerPermAccEntry2 ) ); + + // + } + + static void DisplayPermissionMembers( KeyContainerPermission ^ keyContainerPerm2, array^keyContainerPermAccEntryArray ) + { + + // Display the KeyContainerPermission properties. + // + Console::WriteLine( "\nFlags value is {0}", keyContainerPerm2->Flags ); + + // + // + KeyContainerPermission ^ keyContainerPerm3 = dynamic_cast(keyContainerPerm2->Copy()); + Console::WriteLine( "Is the copy equal to the original? {0}", keyContainerPerm3->Equals( keyContainerPerm2 ) ); + + // + // + // Perform an XML roundtrip. + keyContainerPerm3->FromXml( keyContainerPerm2->ToXml() ); + Console::WriteLine( "Was the XML roundtrip successful? {0}", keyContainerPerm3->Equals( keyContainerPerm2 ) ); + + // + KeyContainerPermission ^ keyContainerPerm4 = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Open,keyContainerPermAccEntryArray ); + + // + KeyContainerPermission ^ keyContainerPerm5 = dynamic_cast(keyContainerPerm2->Intersect( keyContainerPerm4 )); + Console::WriteLine( "Flags value after the intersection is {0}", keyContainerPerm5->Flags ); + + // + // + keyContainerPerm5 = dynamic_cast(keyContainerPerm2->Union( keyContainerPerm4 )); + + // + // + Console::WriteLine( "Flags value after the union is {0}", keyContainerPerm5->Flags ); + + // + // + Console::WriteLine( "Is one permission a subset of the other? {0}", keyContainerPerm4->IsSubsetOf( keyContainerPerm2 ) ); + + // + } + + static void GenKey_SaveInContainer( String^ containerName ) + { + + // Create the CspParameters object and set the key container + // name used to store the RSA key pair. + cspParams = gcnew CspParameters; + cspParams->KeyContainerName = containerName; + + // Create a new instance of RSACryptoServiceProvider that accesses + // the key container identified by the containerName parameter. + rsa = gcnew RSACryptoServiceProvider( cspParams ); + + // Display the key information to the console. + Console::WriteLine( "\nKey added to container: \n {0}", rsa->ToXmlString( true ) ); + } + + static void GetKeyFromContainer( String^ containerName ) + { + try + { + cspParams = gcnew CspParameters; + cspParams->KeyContainerName = containerName; + + // Create a new instance of RSACryptoServiceProvider that accesses + // the key container identified by the containerName parameter. + // If the key container does not exist, a new one is created. + rsa = gcnew RSACryptoServiceProvider( cspParams ); + + // Use the rsa object to access the key. + // Display the key information to the console. + Console::WriteLine( "\nKey retrieved from container : \n {0}", rsa->ToXmlString( true ) ); + Console::WriteLine( "KeycontainerName is {0}", rsa->CspKeyContainerInfo->KeyContainerName ); + Console::WriteLine( "ProviderName is {0}", rsa->CspKeyContainerInfo->ProviderName ); + Console::WriteLine( "ProviderType is {0}", (1 == rsa->CspKeyContainerInfo->ProviderType ? "PROV_RSA_FULL" : rsa->CspKeyContainerInfo->ProviderType.ToString()) ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception thrown: {0}", e->Message ); + } + + } + + static void DeleteKeyContainer( String^ containerName ) + { + + // Create the CspParameters object and set the key container + // name used to store the RSA key pair. + cspParams = gcnew CspParameters; + cspParams->KeyContainerName = containerName; + + // Create a new instance of RSACryptoServiceProvider that accesses + // the key container. + rsa = gcnew RSACryptoServiceProvider( cspParams ); + + // Do not persist the key entry, effectively deleting the key. + rsa->PersistKeyInCsp = false; + + // Call Clear to release the key container resources. + rsa->Clear(); + Console::WriteLine( "\nKey container released." ); + } + + static void DenyOpen() + { + try + { + + // + // Create a KeyContainerPermission with the right to open the key container. + KeyContainerPermission ^ keyContainerPerm = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Open ); + + // + // Demonstrate the results of a deny for an open action. + keyContainerPerm->Deny(); + + // The next line causes an exception to be thrown when the infrastructure code attempts + // to open the key container. + CspKeyContainerInfo ^ info = gcnew CspKeyContainerInfo( cspParams ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Expected exception thrown: {0}", e->Message ); + } + + + // Revert the deny. + CodeAccessPermission::RevertDeny(); + } + + static void DeleteContainer() + { + try + { + + // Create a KeyContainerPermission with the right to create a key container. + KeyContainerPermission ^ keyContainerPerm = gcnew KeyContainerPermission( KeyContainerPermissionFlags::Create ); + + // Deny the ability to create a key container. + // This deny is used to show the key container has been successfully deleted. + keyContainerPerm->Deny(); + + // Retrieve the key from the container. + // This code executes successfully because the key container already exists. + // The deny for permission to create a key container does not affect this method call. + GetKeyFromContainer( "MyKeyContainer" ); + + // Delete the key and the container. + DeleteKeyContainer( "MyKeyContainer" ); + + // Attempt to obtain the key from the deleted key container. + // This time the method call results in an exception because of + // an attempt to create a new key container. + Console::WriteLine( "\nAttempt to create a new key container with create permission denied." ); + GetKeyFromContainer( "MyKeyContainer" ); + } + catch ( CryptographicException^ e ) + { + Console::WriteLine( "Expected exception thrown: {0}", e->Message ); + } + + } + +}; + +int main() +{ + return KeyContainerPermissionDemo::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp new file mode 100644 index 00000000000..953013ec45d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.NameIdPermission/CPP/nameidpermission.cpp @@ -0,0 +1,280 @@ +#define debug 0 + +// +//#define debug +// This custom permission is intended only for the purposes of illustration. +// The following code shows how to create a custom permission that inherits +// from CodeAccessPermission. The code implements all required overrides. +// A wildcard character ('*') is implemented for the Name property. + +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; +using namespace System::Security::Policy; +using namespace System::Collections; +using namespace System::Text; + +[assembly:System::Reflection::AssemblyKeyFile("Key.snk")]; +[assembly:System::Security::AllowPartiallyTrustedCallersAttribute]; + +[Serializable] +public ref class NameIdPermission: public CodeAccessPermission, public IUnrestrictedPermission +{ +private: + String^ m_Name; + bool m_Unrestricted; + +public: + NameIdPermission( String^ name ) + { + m_Name = name; + } + + NameIdPermission( PermissionState state ) + { + if ( state == PermissionState::None ) + { + m_Name = ""; + } + else if ( state == PermissionState::Unrestricted ) + { + throw gcnew ArgumentException( "Unrestricted state is not allowed for identity permissions." ); + } + else + { + throw gcnew ArgumentException( "Invalid permission state." ); + } + } + + property String^ Name + { + String^ get() + { + return m_Name; + } + void set( String^ value ) + { + m_Name = value; + } + } + + // +public: + virtual IPermission^ Copy() override + { + String^ name = m_Name; + return gcnew NameIdPermission( name ); + } + // + + // +public: + virtual bool IsUnrestricted() + { + // Always false, unrestricted state is not allowed. + return m_Unrestricted; + } + // + +private: + bool VerifyType( IPermission^ target ) + { + return dynamic_cast(target) != nullptr; + } + + // +public: + virtual bool IsSubsetOf( IPermission^ target ) override + { +#if ( debug ) + Console::WriteLine( "************* Entering IsSubsetOf *********************" ); +#endif + + if ( target == nullptr ) + { + Console::WriteLine( "IsSubsetOf: target == null" ); + return false; + } + +#if ( debug ) + Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name ); + Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name ); +#endif + + try + { + NameIdPermission^ operand = dynamic_cast(target); + + // The following check for unrestricted permission is only included as an example for + // permissions that allow the unrestricted state. It is of no value for this permission. + if ( true == operand->m_Unrestricted ) + { + return true; + } + else if ( true == this->m_Unrestricted ) + { + return false; + } + + if ( this->m_Name != nullptr ) + { + if ( operand->m_Name == nullptr ) + { + return false; + } + if ( this->m_Name->Equals( "" ) ) + { + return true; + } + } + + if ( this->m_Name->Equals( operand->m_Name ) ) + { + return true; + } + else + { + // Check for wild card character '*'. + int i = operand->m_Name->LastIndexOf( "*" ); + + if ( i > 0 ) + { + String^ prefix = operand->m_Name->Substring( 0, i ); + if ( this->m_Name->StartsWith( prefix ) ) + { + return true; + } + } + } + return false; + } + catch ( InvalidCastException^ ) + { + throw gcnew ArgumentException( String::Format( "Argument_WrongType", this->GetType()->FullName ) ); + } + } + // + + // +public: + virtual IPermission^ Intersect( IPermission^ target ) override + { + Console::WriteLine( "************* Entering Intersect *********************" ); + if ( target == nullptr ) + { + return nullptr; + } + +#if ( debug ) + Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name ); + Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name ); +#endif + + if ( !VerifyType( target ) ) + { + throw gcnew ArgumentException( String::Format( "Argument is wrong type.", this->GetType()->FullName ) ); + } + + NameIdPermission^ operand = dynamic_cast(target); + + if ( operand->IsSubsetOf( this ) ) + { + return operand->Copy(); + } + else if ( this->IsSubsetOf( operand ) ) + { + return this->Copy(); + } + else + { + return nullptr; + } + } + // + + // +public: + virtual IPermission^ Union( IPermission^ target ) override + { +#if ( debug ) + Console::WriteLine( "************* Entering Union *********************" ); +#endif + + if ( target == nullptr ) + { + return this; + } + +#if ( debug ) + Console::WriteLine( "This is = {0}", ((NameIdPermission)this).Name ); + Console::WriteLine( "Target is {0}", ((NameIdPermission)target).m_Name ); +#endif + + if ( !VerifyType( target ) ) + { + throw gcnew ArgumentException( String::Format( "Argument_WrongType", this->GetType()->FullName ) ); + } + + NameIdPermission^ operand = dynamic_cast(target); + + if ( operand->IsSubsetOf( this ) ) + { + return this->Copy(); + } + else if ( this->IsSubsetOf( operand ) ) + { + return operand->Copy(); + } + else + { + return nullptr; + } + } + // + + // +public: + virtual void FromXml( SecurityElement^ e ) override + { + // The following code for unrestricted permission is only included as an example for + // permissions that allow the unrestricted state. It is of no value for this permission. + String^ elUnrestricted = e->Attribute("Unrestricted"); + if ( nullptr != elUnrestricted ) + { + m_Unrestricted = Boolean::Parse( elUnrestricted ); + return; + } + + String^ elName = e->Attribute("Name"); + m_Name = elName == nullptr ? nullptr : elName; + } + // + + // +public: + virtual SecurityElement^ ToXml() override + { + // Use the SecurityElement class to encode the permission to XML. + SecurityElement^ esd = gcnew SecurityElement( "IPermission" ); + String^ name = NameIdPermission::typeid->AssemblyQualifiedName; + esd->AddAttribute( "class", name ); + esd->AddAttribute( "version", "1.0" ); + + // The following code for unrestricted permission is only included as an example for + // permissions that allow the unrestricted state. It is of no value for this permission. + if ( m_Unrestricted ) + { + esd->AddAttribute( "Unrestricted", true.ToString() ); + } + + if ( m_Name != nullptr ) + { + esd->AddAttribute( "Name", m_Name ); + } + + return esd; + } + // +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp new file mode 100644 index 00000000000..603984a43af --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.PublisherIdentityPermission/CPP/publisheridentitypermission.cpp @@ -0,0 +1,166 @@ +// +// To execute this sample you will need two certification files, MyCert1.cer and MyCert2.cer. +// The certification files can be created using the Certification Creation Tool, MakeCert.exe, +// which runs from the command line. Usage: MakeCert MyCert1.cer + +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; + +// Demonstrate all methods. +void main() +{ + Console::WriteLine("Welcome to the PublisherIdentityPermission CPP sample\n"); + + array^publisherCertificate = gcnew array(2); + PublisherIdentityPermission ^ publisherPerm1; + PublisherIdentityPermission ^ publisherPerm2; + + // Initialize the PublisherIdentityPermissions for use in the sample +// + FileStream ^ fs1 = gcnew FileStream("MyCert1.cer", FileMode::Open); + array^certSBytes1 = gcnew array((int)fs1->Length); + fs1->Read(certSBytes1, 0, (int)fs1->Length); + publisherCertificate[0] = gcnew X509Certificate(certSBytes1); + fs1->Close(); + + FileStream ^ fs2 = gcnew FileStream("MyCert2.cer", FileMode::Open); + array^certSBytes2 = gcnew array((int)fs2->Length); + fs2->Read(certSBytes2, 0, (int)fs2->Length); + publisherCertificate[1] = gcnew X509Certificate(certSBytes2); + fs2->Close(); +// + + publisherPerm1 = gcnew PublisherIdentityPermission(publisherCertificate[0]); + publisherPerm2 = gcnew PublisherIdentityPermission(publisherCertificate[1]); + +// + Console::WriteLine("\n******************** IsSubsetOf DEMO ********************\n"); + // IsSubsetOf determines whether the current permission is a subset of the specified permission. + if (publisherPerm2->IsSubsetOf(publisherPerm1)) + Console::WriteLine(publisherPerm2->Certificate->Subject + " is a subset of " + + publisherPerm1->Certificate->Subject); + else + Console::WriteLine(publisherPerm2->Certificate->Subject + " is not a subset of " + + publisherPerm1->Certificate->Subject); +// + +// + Console::WriteLine("\n******************** Copy DEMO ********************\n"); + // Copy creates and returns an identical copy of the current permission. +// + // Create an empty PublisherIdentityPermission to serve as the target of the copy. + publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None); + publisherPerm2 = (PublisherIdentityPermission^)publisherPerm1->Copy(); + Console::WriteLine("Result of copy = " + publisherPerm2); +// +// + + +// + Console::WriteLine("\n******************** Union DEMO ********************\n"); + PublisherIdentityPermission ^ publisherPerm3 = (PublisherIdentityPermission ^)publisherPerm1->Union(publisherPerm2); + + if (publisherPerm3 == nullptr) + Console::WriteLine("The union of " + publisherPerm1 + " and " + + publisherPerm2->Certificate->Subject + " is null."); + else + Console::WriteLine("The union of " + publisherPerm1->Certificate->Subject + " and " + + publisherPerm2->Certificate->Subject + " = " + + publisherPerm3->Certificate->Subject); +// + + +// + // Intersect creates and returns a new permission that is the intersection of the current + // permission and the permission specified. + Console::WriteLine("\n******************** Intersect DEMO ********************\n"); + publisherPerm3 = (PublisherIdentityPermission^)publisherPerm1->Intersect(publisherPerm2); + if (publisherPerm3 != nullptr) + Console::WriteLine("The intersection of " + publisherPerm1->Certificate->Subject + + " and " + publisherPerm2->Certificate->Subject + " = " + + publisherPerm3->Certificate->Subject); + else + Console::WriteLine("The intersection of " + publisherPerm1->Certificate->Subject + " and " + + publisherPerm2->Certificate->Subject + " is null."); + // + + +// +// ToXml creates an XML encoding of the permission and its current state; +// FromXml reconstructs a permission with the specified state from the XML encoding. + Console::WriteLine("\n******************** ToXml DEMO ********************\n"); + publisherPerm2 = gcnew PublisherIdentityPermission(PermissionState::None); + publisherPerm2->FromXml(publisherPerm1->ToXml()); + Console::WriteLine("Result of ToFromXml = " + publisherPerm2); +// + + Console::WriteLine("Press Enter to return"); + Console::ReadLine(); +} + +/* +Expected output: + +Welcome to the PublisherIdentityPermission CPP sample + + +******************** IsSubsetOf DEMO ******************** + +CN=Joe's-Software-Emporium is not a subset of CN=Joe's-Software-Emporium + +******************** Copy DEMO ******************** + +Result of copy = + + +******************** Union DEMO ******************** + +The union of CN=Joe's-Software-Emporium and CN=Joe's-Software-Emporium = CN=Joe' +s-Software-Emporium + +******************** Intersect DEMO ******************** + +The intersection of CN=Joe's-Software-Emporium and CN=Joe's-Software-Emporium = +CN=Joe's-Software-Emporium + +******************** ToXml DEMO ******************** + +Result of ToFromXml = + +Press Enter to return +*/ + +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp new file mode 100644 index 00000000000..cfad634f423 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.SecurityPermissionAttribute/CPP/securitypermissionattribute.cpp @@ -0,0 +1,457 @@ + +// +// This sample demonstrates the use of the SecurityPermissionAttribute. +using namespace System; +using namespace System::Security::Permissions; +using namespace System::Security; +class MyClass +{ +public: + static void PermissionDemo() + { + try + { + DenySecurityPermissions(); + DenyAllSecurityPermissions(); + DoNotDenySecurityPermissions(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + + } + + + // This method demonstrates the use of the SecurityPermissionAttribute to deny individual security permissions. + // + // Set the Assertion property. + [SecurityPermissionAttribute(SecurityAction::Deny,Assertion=true)] + // + // + // Set the ControlAppDomain property. + [SecurityPermissionAttribute(SecurityAction::Deny,ControlAppDomain=true)] + // + // + // Set the ControlDomainPolicy property. + [SecurityPermissionAttribute(SecurityAction::Deny,ControlDomainPolicy=true)] + // + // + [SecurityPermissionAttribute(SecurityAction::Deny,ControlEvidence=true)] + // Set the ControlEvidence property. + // + // + [SecurityPermissionAttribute(SecurityAction::Deny,ControlPolicy=true)] + // Set the ControlPolicy property. + // + // + [SecurityPermissionAttribute(SecurityAction::Deny,ControlPrincipal=true)] + // Set the ControlPrincipal property. + // + // + // Set the ControlThread property. + [SecurityPermissionAttribute(SecurityAction::Deny,ControlThread=true)] + // + // + // Set the Execution property. + [SecurityPermissionAttribute(SecurityAction::Deny,Execution=true)] + // + // + // Set the Flags property. + [SecurityPermissionAttribute(SecurityAction::Deny,Flags=SecurityPermissionFlag::NoFlags)] + // + // + // Set the Infrastructure property. + [SecurityPermissionAttribute(SecurityAction::Deny,Infrastructure=true)] + // + // + // Set the RemotingConfiguration property. + [SecurityPermissionAttribute(SecurityAction::Deny,RemotingConfiguration=true)] + // + // + // Set the SerializationFormatter property. + [SecurityPermissionAttribute(SecurityAction::Deny,SerializationFormatter=true)] + // + // + // Set the SkipVerification property. + [SecurityPermissionAttribute(SecurityAction::Deny,SkipVerification=true)] + // + // + // Set the UnmanagedCode property. + [SecurityPermissionAttribute(SecurityAction::Deny,UnmanagedCode=true)] + // + + static void DenySecurityPermissions() + { + Console::WriteLine( "Executing DenySecurityPermissions." ); + Console::WriteLine( "Denied all permissions individually." ); + TestSecurityPermissions(); + } + + + // This method demonstrates the use of SecurityPermissionFlag::AllFlags to deny all security permissions. + + [SecurityPermissionAttribute(SecurityAction::Deny,Flags=SecurityPermissionFlag::AllFlags)] + static void DenyAllSecurityPermissions() + { + Console::WriteLine( "\nExecuting DenyAllSecurityPermissions." ); + Console::WriteLine( "Denied all permissions using SecurityPermissionFlag::AllFlags." ); + TestSecurityPermissions(); + } + + + // This method demonstrates the effect of not denying security permissions. + static void DoNotDenySecurityPermissions() + { + Console::WriteLine( "\nExecuting DoNotDenySecurityPermissions." ); + Console::WriteLine( "No permissions have been denied." ); + DemandSecurityPermissions(); + } + + static void TestSecurityPermissions() + { + Console::WriteLine( "\nExecuting TestSecurityPermissions.\n" ); + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Assertion ); + Console::WriteLine( "Demanding SecurityPermissionFlag::Assertion" ); + + // This demand should cause an exception. + sp->Demand(); + + // The TestFailed method is called if an exception is not thrown. + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlAppDomain ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlAppDomain" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlDomainPolicy ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlDomainPolicy" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlEvidence ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlEvidence" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPolicy ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPolicy" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPrincipal ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPrincipal" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlThread ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlThread" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Execution ); + Console::WriteLine( "Demanding SecurityPermissionFlag::Execution" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::Execution failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Infrastructure ); + Console::WriteLine( "Demanding SecurityPermissionFlag::Infrastructure" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::RemotingConfiguration ); + Console::WriteLine( "Demanding SecurityPermissionFlag::RemotingConfiguration" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SerializationFormatter ); + Console::WriteLine( "Demanding SecurityPermissionFlag::SerializationFormatter" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SkipVerification ); + Console::WriteLine( "Demanding SecurityPermissionFlag::SkipVerification" ); + sp->Demand(); + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::UnmanagedCode ); + Console::WriteLine( "Demanding SecurityPermissionFlag::UnmanagedCode" ); + + // This demand should cause an exception. + sp->Demand(); + + // The TestFailed method is called if an exception is not thrown. + TestFailed(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode failed: {0}", e->Message ); + } + + } + + static void TestFailed() + { + Console::WriteLine( "In TestFailed method." ); + Console::WriteLine( "Throwing an exception." ); + throw gcnew Exception; + } + +// + static void DemandSecurityPermissions() + { + Console::WriteLine( "\nExecuting DemandSecurityPermissions.\n" ); + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Assertion ); + Console::WriteLine( "Demanding SecurityPermissionFlag::Assertion" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::Assertion failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlAppDomain ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlAppDomain" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlAppDomain failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlDomainPolicy ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlDomainPolicy" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlDomainPolicy failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlEvidence ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlEvidence" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlEvidence failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPolicy ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPolicy" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPolicy failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlPrincipal ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlPrincipal" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlPrincipal failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::ControlThread ); + Console::WriteLine( "Demanding SecurityPermissionFlag::ControlThread" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::ControlThread failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Execution ); + Console::WriteLine( "Demanding SecurityPermissionFlag::Execution" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::Execution succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::Execution failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::Infrastructure ); + Console::WriteLine( "Demanding SecurityPermissionFlag::Infrastructure" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::Infrastructure failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::RemotingConfiguration ); + Console::WriteLine( "Demanding SecurityPermissionFlag::RemotingConfiguration" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::RemotingConfiguration failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SerializationFormatter ); + Console::WriteLine( "Demanding SecurityPermissionFlag::SerializationFormatter" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::SerializationFormatter failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::SkipVerification ); + Console::WriteLine( "Demanding SecurityPermissionFlag::SkipVerification" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::SkipVerification failed: {0}", e->Message ); + } + + try + { + SecurityPermission^ sp = gcnew SecurityPermission( SecurityPermissionFlag::UnmanagedCode ); + Console::WriteLine( "Demanding SecurityPermissionFlag::UnmanagedCode" ); + sp->Demand(); + Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode succeeded." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Demand for SecurityPermissionFlag::UnmanagedCode failed: {0}", e->Message ); + } + + } +// + +}; + +int main() +{ + MyClass::PermissionDemo(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp new file mode 100644 index 00000000000..1cf6f037e02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StorePermission/CPP/storepermission.cpp @@ -0,0 +1,143 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Security::Permissions; +using namespace System::Security::Cryptography; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::Security; +using namespace System::IO; + +[assembly:StorePermissionAttribute(SecurityAction::RequestMinimum, +Flags=StorePermissionFlags::DeleteStore)]; +void AddToStore( X509Certificate2 ^ cert ); +void ShowMembers(); +int main() +{ + + // + Console::WriteLine( "Creating a permission with Flags = OpenStore." ); + StorePermission^ sp = gcnew StorePermission( StorePermissionFlags::OpenStore ); + + // + //Create a new X509 store named teststore from the local certificate store. + //You must put in a valid path to a certificate in the following constructor. + X509Certificate2^ certificate = gcnew X509Certificate2( "c:\\certificates\\*****.cer" ); + + // Deny the permission to open a store. + sp->Deny(); + + // The following code results in an exception due to an attempt to open a store. + AddToStore( certificate ); + + // Remove the deny for opening a store. + CodeAccessPermission::RevertDeny(); + + // The following code results in an exception due to an attempt to add a certificate. + // The exception is thrown due to a StorePermissionAttribute on the method denying AddToStore permission. + AddToStore( certificate ); + + // The current code is not affected by the attribute in the previously called method, so the following + // intructions execute without an exception. + X509Store^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser ); + store->Open( OpenFlags::ReadWrite ); + store->Add( certificate ); + + // Demonstrate the behavior of the class members. + ShowMembers(); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadKey(); +} + + +// +//Deny the permission the ability to add to a store. + +[StorePermission(SecurityAction::Deny,Flags=StorePermissionFlags::AddToStore)] +void AddToStore( X509Certificate2^ cert ) +{ + try + { + X509Store^ store = gcnew X509Store( "teststore",StoreLocation::CurrentUser ); + store->Open( OpenFlags::ReadWrite ); + + // The following attempt to add a certificate results in an exception being thrown. + store->Add( cert ); + return; + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Security exception thrown when attempting: {0}", + (dynamic_cast(e->FirstPermissionThatFailed))->Flags ); + return; + } + +} + + +// +// The following function is intended to demonstrate only the behavior of +// StorePermission class members,and not their practical usage. Most properties +// and methods in this class are used for the resolution and enforcement of +// security policy by the security infrastructure code. +void ShowMembers() +{ + Console::WriteLine( "Creating first permission with Flags = OpenStore." ); + StorePermission^ sp1 = gcnew StorePermission( StorePermissionFlags::OpenStore ); + Console::WriteLine( "Creating second permission with Flags = AllFlags." ); + StorePermission^ sp2 = gcnew StorePermission( StorePermissionFlags::AllFlags ); + Console::WriteLine( "Creating third permission as Unrestricted." ); + + // + StorePermission^ sp3 = gcnew StorePermission( PermissionState::Unrestricted ); + + // + Console::WriteLine( "Creating fourth permission with a permission state of none." ); + StorePermission^ sp4 = gcnew StorePermission( PermissionState::None ); + + // + bool rc = sp2->IsSubsetOf( sp3 ); + Console::WriteLine( "Is the permission with complete store access (AllFlags) a subset of \n" + "\tthe permission with an Unrestricted permission state? {0}", (rc ? (String^)"Yes" : "No") ); + rc = sp1->IsSubsetOf( sp2 ); + Console::WriteLine( "Is the permission with OpenStore access a subset of the permission with \n" + "\tcomplete store access (AllFlags)? {0}", (rc ? (String^)"Yes" : "No") ); + + // + // + rc = sp3->IsUnrestricted(); + Console::WriteLine( "Is the third permission unrestricted? {0}", (rc ? (String^)"Yes" : "No") ); + + // + // + Console::WriteLine( "Copying the second permission to the fourth permission." ); + sp4 = dynamic_cast(sp2->Copy()); + rc = sp4->Equals( sp2 ); + Console::WriteLine( "Is the fourth permission equal to the second permission? {0}", (rc ? (String^)"Yes" : "No") ); + + // + // + Console::WriteLine( "Creating the intersection of the second and first permissions." ); + sp4 = dynamic_cast(sp2->Intersect( sp1 )); + Console::WriteLine( "Value of the Flags property is: {0}", sp4->Flags ); + + // + // + Console::WriteLine( "Creating the union of the second and first permissions." ); + sp4 = dynamic_cast(sp2->Union( sp1 )); + Console::WriteLine( "Result of the union of the second permission with the first: {0}", sp4->Flags ); + + // + // + Console::WriteLine( "Using an XML roundtrip to reset the fourth permission." ); + sp4->FromXml( sp2->ToXml() ); + rc = sp4->Equals( sp2 ); + Console::WriteLine( "Does the XML roundtrip result equal the original permission? {0}", (rc ? (String^)"Yes" : "No") ); + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp new file mode 100644 index 00000000000..6fbc207a89a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.StrongNameIdentityPermission/CPP/strongnameidentity.cpp @@ -0,0 +1,244 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Runtime::InteropServices; + +// This class generates StrongNameIdentityPermission objects. + +[assembly:CLSCompliant(true)]; + +public ref class StrongNameIdentityDemo +{ +private: + // Public key + static array^b1 = {0,36,0,0,4,128,0,0,148,0,0,0,6,2,0,0,0,36,0,0,82,83,65,49,0,4,0,0,1,0,1,0,237,146,145,51,34,97,123,196,90,174,41,170,173,221,41,193,175,39,7,151,178,0,230,152,218,8,206,206,170,84,111,145,26,208,158,240,246,219,228,34,31,163,11,130,16,199,111,224,4,112,46,84,0,104,229,38,39,63,53,189,0,157,32,38,34,109,0,171,114,244,34,59,9,232,150,192,247,175,104,143,171,42,219,66,66,194,191,218,121,59,92,42,37,158,13,108,210,189,9,203,204,32,48,91,212,101,193,19,227,107,25,133,70,2,220,83,206,71,102,245,104,252,87,109,190,56,34,180}; + static StrongNamePublicKeyBlob^ blob = gcnew StrongNamePublicKeyBlob( b1 ); + + // Use this version number. + static Version^ v1 = gcnew Version( "1.0.0.0" ); + + // + // IsSubsetOf determines whether the current permission is a subset of the specified permission. + bool IsSubsetOfDemo() + { + bool returnValue = true; + + StrongNameIdentityPermission^ snIdPerm1; + StrongNameIdentityPermission^ snIdPerm2; + + // + snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); + // + snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); + + if (snIdPerm1->IsSubsetOf(snIdPerm2)) + { + + Console::WriteLine("MyCompany.MyDepartment.* is a subset " + + "of MyCompany.MyDepartment.MyFile \n"); + } + else + { + Console::WriteLine("MyCompany.MyDepartment.*" + + " is not a subset of MyCompany.MyDepartment.MyFile \n"); + } + + return returnValue; + } + + + // + // + // Union creates a new permission that is the union of the current permission and the specified permission. + bool UnionDemo() + { + bool returnValue = true; + StrongNameIdentityPermission^ snIdPerm1; + StrongNameIdentityPermission^ snIdPerm2; + IPermission^ snIdPerm3; + snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); + snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); + snIdPerm3 = dynamic_cast(snIdPerm1->Union( snIdPerm2 )); + snIdPerm3 = snIdPerm1->Union( snIdPerm2 ); + + try + { + Console::WriteLine("The union of MyCompany.MyDepartment.*" + + "and MyCompany.MyDepartment.MyFile is " + + (dynamic_cast(snIdPerm3))->Name); + } + catch (Exception^ e) + { + Console::WriteLine("An expected exception was thrown: " + e->Message); + } + + + return returnValue; + } + + + // + // + // Intersect creates and returns a new permission that is the intersection of the current + // permission and the permission specified. + bool IntersectDemo() + { + bool returnValue = true; + StrongNameIdentityPermission^ snIdPerm1; + StrongNameIdentityPermission^ snIdPerm2; + StrongNameIdentityPermission^ snIdPerm3; + snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); + snIdPerm2 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.MyFile", gcnew Version("1.0.0.0")); + + try + { + + snIdPerm3 = dynamic_cast(snIdPerm1->Intersect(snIdPerm2)); + + Console::WriteLine("The intersection of MyCompany.MyDepartment.*" + + "and MyCompany.MyDepartment.MyFile is " + + (dynamic_cast(snIdPerm3))->Name); + } + catch (Exception^ e) + { + Console::WriteLine("An exception was thrown: " + e); + returnValue = false; + } + + return returnValue; + + } + + + // + // + //Copy creates and returns an identical copy of the current permission. + bool CopyDemo() + { + bool returnValue = true; + StrongNameIdentityPermission^ snIdPerm1; + StrongNameIdentityPermission^ snIdPerm2; + snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); + // + snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None); + // + + snIdPerm2 = dynamic_cast(snIdPerm1->Copy()); + Console::WriteLine("Result of copy = " + snIdPerm2->ToString() + "\n"); + + return returnValue; + } + + + // + // + // ToXml creates an XML encoding of the permission and its current state; + //FromXml reconstructs a permission with the specified state from the XML encoding. + bool ToFromXmlDemo() + { + bool returnValue = true; + StrongNameIdentityPermission^ snIdPerm1; + StrongNameIdentityPermission^ snIdPerm2; + snIdPerm1 = gcnew StrongNameIdentityPermission(blob, "MyCompany.MyDepartment.*", gcnew Version("1.0.0.0")); + snIdPerm2 = gcnew StrongNameIdentityPermission(PermissionState::None); + snIdPerm2->FromXml(snIdPerm1->ToXml()); + Console::WriteLine("Result of ToFromXml = " + snIdPerm2->ToString() + "\n"); + + return returnValue; + } + + +public: + + // + // Invoke all demos. + bool RunDemo() + { + bool ret = true; + bool retTmp; + + // Call the IsSubsetOf demo. + if ( retTmp = IsSubsetOfDemo() ) + Console::WriteLine( "IsSubsetOf demo completed successfully." ); + else + Console::WriteLine( "IsSubsetOf demo failed." ); + + ret = retTmp && ret; + + // Call the Union demo. + if ( retTmp = UnionDemo() ) + Console::WriteLine( "Union demo completed successfully." ); + else + Console::WriteLine( "Union demo failed." ); + + ret = retTmp && ret; + + // Call the Intersect demo. + if ( retTmp = IntersectDemo() ) + Console::WriteLine( "Intersect demo completed successfully." ); + else + Console::WriteLine( "Intersect demo failed." ); + + ret = retTmp && ret; + + // Call the Copy demo. + if ( retTmp = CopyDemo() ) + Console::WriteLine( "Copy demo completed successfully" ); + else + Console::WriteLine( "Copy demo failed." ); + + ret = retTmp && ret; + + // Call the ToFromXml demo. + if ( retTmp = ToFromXmlDemo() ) + Console::WriteLine( "ToFromXml demo completed successfully" ); + else + Console::WriteLine( "ToFromXml demo failed." ); + + ret = retTmp && ret; + Console::WriteLine( "********************************************************\n" ); + return (ret); + } + +}; + + +// Test harness. +int main() +{ + try + { + StrongNameIdentityDemo^ democase = gcnew StrongNameIdentityDemo; + bool ret = democase->RunDemo(); + if ( ret ) + { + Console::WriteLine( "StrongNameIdentity demo completed successfully." ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 100; + } + else + { + Console::WriteLine( "StrongNameIdentity demo failed." ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "StrongNameIdentity demo failed." ); + Console::WriteLine( e ); + Console::WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + +} + +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp new file mode 100644 index 00000000000..2ff0e156c43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UIPermission/CPP/uipermission.cpp @@ -0,0 +1,178 @@ +// UIPermCPP.cpp : main project file. + + + +// +// This sample demonstrates the IsSubsetOf, Union, Intersect, Copy, ToXml and FromXml methods +// of the UIPermission class. + +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Runtime::InteropServices; + +void IsSubsetOfDemo(); // Forward references +void CopyDemo(); +void UnionDemo(); +void IntersectDemo(); +void ToFromXmlDemo(); + + +int main() +{ + IsSubsetOfDemo(); + CopyDemo(); + UnionDemo(); + IntersectDemo(); + ToFromXmlDemo(); +} + + + +// +// IsSubsetOf determines whether the current permission is a subset of the specified permission. + +void IsSubsetOfDemo() +{ + Console::WriteLine("\n********************** IsSubsetOf() Demo **********************\n"); +// + UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); +// + UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows); + + Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm1->Window, + uiPerm1->IsSubsetOf(uiPerm2)?"":"not ", uiPerm2->Window); + + Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm2->Window, + uiPerm2->IsSubsetOf(uiPerm1)?"":"not ", uiPerm1->Window); + +// + uiPerm1 = gcnew UIPermission(UIPermissionClipboard::AllClipboard); +// + uiPerm2 = gcnew UIPermission(UIPermissionClipboard::OwnClipboard); + + Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm1->Clipboard, + uiPerm1->IsSubsetOf(uiPerm2)?"":"not ", uiPerm2->Clipboard); + + Console::WriteLine(" {0} is {1}a subset of {2} ", uiPerm2->Clipboard, + uiPerm2->IsSubsetOf(uiPerm1)?"":"not ", uiPerm1->Clipboard); +} +// + + + +// + // Union creates a new permission that is the union of the current permission + // and the specified permission. +void UnionDemo() +{ + Console::WriteLine("\n************************ Union() Demo *************************\n"); + + UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); + UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows); + + UIPermission ^ p3 = dynamic_cast(uiPerm1->Union(uiPerm2)); + Console::WriteLine(" The union of {0} and \n\t{1} = {2} ", uiPerm1->Window, + uiPerm2->Window, (nullptr != p3)?p3->Window.ToString():"null"); +} +// + +// +// Intersect creates and returns a new permission that is the intersection of the +// current permission and the permission specified. +void IntersectDemo() +{ + Console::WriteLine("\n********************** Intersect() Demo ***********************\n"); +// + UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows,UIPermissionClipboard::OwnClipboard); +// + UIPermission ^ uiPerm2 = gcnew UIPermission(UIPermissionWindow::SafeSubWindows,UIPermissionClipboard::NoClipboard); + UIPermission ^ p3 = (UIPermission^)uiPerm1->Intersect(uiPerm2); + + Console::WriteLine(" The intersection of {0} and \n\t{1} = {2} ", uiPerm1->Window, + uiPerm1->Window, (nullptr != p3)?p3->Window.ToString():"null"); + + Console::WriteLine(" The intersection of " + uiPerm1->Clipboard.ToString() + " and \n\t" + + uiPerm2->Clipboard.ToString() + " is " + p3->Clipboard.ToString()); +} +// + + +// +//Copy creates and returns an identical copy of the current permission. +void CopyDemo() +{ + Console::WriteLine("\n************************* Copy() Demo *************************\n"); + + UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); + // + UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None); + // + uiPerm2 = (UIPermission ^)uiPerm1->Copy(); + if (uiPerm2 != nullptr) + Console::WriteLine("The copy succeeded: " + uiPerm2->ToString()); +} +// + +// + +// ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a +// permission with the specified state from the XML encoding. +void ToFromXmlDemo() +{ + Console::WriteLine("\n********************** To/From XML() Demo *********************\n"); + + UIPermission ^ uiPerm1 = gcnew UIPermission(UIPermissionWindow::SafeTopLevelWindows); + UIPermission ^ uiPerm2 = gcnew UIPermission(PermissionState::None); + uiPerm2->FromXml(uiPerm1->ToXml()); + bool result = uiPerm2->Equals(uiPerm1); + if (result) + Console::WriteLine("Result of ToFromXml = " + uiPerm2->ToString()); + else + { + Console::WriteLine(uiPerm2->ToString()); + Console::WriteLine(uiPerm1->ToString()); + } +} +// +// + +/* +// This code example creates the following output: + +********************** IsSubsetOf() Demo ********************** + + SafeTopLevelWindows is not a subset of SafeSubWindows + SafeSubWindows is a subset of SafeTopLevelWindows + AllClipboard is not a subset of OwnClipboard + OwnClipboard is a subset of AllClipboard + +************************* Copy() Demo ************************* + +The copy succeeded: + + +************************ Union() Demo ************************* + + The union of SafeTopLevelWindows and + SafeSubWindows = SafeTopLevelWindows + +********************** Intersect() Demo *********************** + + The intersection of SafeTopLevelWindows and + SafeTopLevelWindows = SafeSubWindows + The intersection of OwnClipboard and + NoClipboard is NoClipboard + +********************** To/From XML() Demo ********************* + +Result of ToFromXml = + +*/ \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp new file mode 100644 index 00000000000..ba4df789e20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Permissions.UrlIdentityPermission/CPP/urlidentity.cpp @@ -0,0 +1,121 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Runtime::InteropServices; + +void IsSubsetOfDemo(); // Forward references +void CopyDemo(); +void IntersectDemo(); +void ToFromXmlDemo(); + +void main() +{ + IsSubsetOfDemo(); + CopyDemo(); + IntersectDemo(); + ToFromXmlDemo(); + + Console::WriteLine("\n\nPress ENTER to return"); + Console::ReadLine(); +} + +// +// IsSubsetOf determines whether the current permission is a subset of the specified permission. +void IsSubsetOfDemo() +{ + // + UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/"); + // + UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/*"); + + if (permIdPerm1->IsSubsetOf(permIdPerm2)) + Console::WriteLine(permIdPerm1->Url + " is a subset of " + permIdPerm2->Url); + else Console::WriteLine(permIdPerm1->Url + " is not a subset of " + permIdPerm2->Url); + if (permIdPerm2->IsSubsetOf(permIdPerm1)) + Console::WriteLine(permIdPerm2->Url + " is a subset of " + permIdPerm1->Url); + else Console::WriteLine(permIdPerm2->Url + " is not a subset of " + permIdPerm1->Url); +} +// + +// +// Intersect creates and returns a gcnew permission that is the intersection of the +// current permission and the permission specified. +void IntersectDemo() +{ + + UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/"); + UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/*"); + UrlIdentityPermission ^ p3 = (UrlIdentityPermission^)permIdPerm1->Intersect(permIdPerm2); + + if (p3 != nullptr) + Console::WriteLine("The intersection of " + permIdPerm1->Url + " and \n\t" + + permIdPerm2->Url + " is " + p3->Url + "\n"); + else Console::WriteLine("The intersection of " + permIdPerm1->Url + + " and \n\t" + permIdPerm2->Url + " is null.\n"); +} +// + +// +//Copy creates and returns an identical copy of the current permission. +void CopyDemo() +{ + UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/*"); + // + UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None); + // + permIdPerm2 = (UrlIdentityPermission^)permIdPerm1->Copy(); + if (permIdPerm2) + Console::WriteLine("The copy succeeded: " + permIdPerm2->ToString() + " \n"); +} +// + +// +// ToXml creates an XML encoding of the permission and its current state; FromXml reconstructs a +// permission with the specified state from the XML encoding. +void ToFromXmlDemo() +{ + UrlIdentityPermission ^ permIdPerm1 = gcnew UrlIdentityPermission("http://www.fourthcoffee.com/process/*"); + UrlIdentityPermission ^ permIdPerm2 = gcnew UrlIdentityPermission(PermissionState::None); + permIdPerm2->FromXml(permIdPerm1->ToXml()); + bool result = permIdPerm2->Equals(permIdPerm1); + if (result) + Console::WriteLine("Result of ToFromXml = " + permIdPerm2->ToString()); + else + { + Console::WriteLine(permIdPerm2->ToString()); + Console::WriteLine(permIdPerm1->ToString()); + } + +} +// + + + +// +// This code example creates the following output: + +//http://www.fourthcoffee.com/process/ is a subset of http://www.fourthcoffee.com/ +//* +//http://www.fourthcoffee.com/* is not a subset of http://www.fourthcoffee.com/pro +//cess/ +//The copy succeeded: + + +//The union of http://www.fourthcoffee.com/process/ and +// http://www.fourthcoffee.com/* failed. +//The operation is ambiguous because the permission represents multiple identities +//. +//The intersection of http://www.fourthcoffee.com/process/ and +// http://www.fourthcoffee.com/* is http://www.fourthcoffee.com/process/ + +//Result of ToFromXml = \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp new file mode 100644 index 00000000000..374ca3601e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Evidence/CPP/evidence_evidence.cpp @@ -0,0 +1,220 @@ + +// +using namespace System; +using namespace System::Collections; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; +using namespace System::Globalization; +public ref class Evidence_Example +{ +public: + bool CreateEvidence() + { + bool retVal = true; + try + { + // Create empty evidence using the default contructor. + // + Evidence^ ev1 = gcnew Evidence; + Console::WriteLine( "Created empty evidence with the default constructor." ); + + // + // Constructor used to create null host evidence. + Evidence^ ev2a = gcnew Evidence( nullptr ); + Console::WriteLine( "Created an Evidence object with null host evidence." ); + + // Constructor used to create host evidence. + // + Url^ url = gcnew Url( "http://www.treyresearch.com" ); + Console::WriteLine( "Adding host evidence {0}", url ); + ev2a->AddHost( url ); + Evidence^ ev2b = gcnew Evidence( ev2a ); + Console::WriteLine( "Copy evidence into new evidence" ); + IEnumerator^ enum1 = ev2b->GetHostEnumerator(); + enum1->MoveNext(); + Console::WriteLine( enum1->Current ); + + // + // Constructor used to create both host and assembly evidence. + // + array^oa1 = {}; + Site^ site = gcnew Site( "www.wideworldimporters.com" ); + array^oa2 = {url,site}; + Evidence^ ev3a = gcnew Evidence( oa1,oa2 ); + enum1 = ev3a->GetHostEnumerator(); + IEnumerator^ enum2 = ev3a->GetAssemblyEnumerator(); + enum2->MoveNext(); + Object^ obj1 = enum2->Current; + enum2->MoveNext(); + Console::WriteLine( "URL = {0} Site = {1}", obj1, enum2->Current ); + + // + // Constructor used to create null host and null assembly evidence. + Evidence^ ev3b = gcnew Evidence( (array^)nullptr, (array^)nullptr ); + Console::WriteLine( "Create new evidence with null host and assembly evidence" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Fatal error: {0}", e ); + return false; + } + + return retVal; + } + + Evidence^ DemonstrateEvidenceMembers() + { + Evidence^ myEvidence = gcnew Evidence; + String^ sPubKeyBlob = "00240000048000009400000006020000" + "00240000525341310004000001000100" + "19390E945A40FB5730204A25FA5DC4DA" + "B18688B412CB0EDB87A6EFC50E2796C9" + "B41AD3040A7E46E4A02516C598678636" + "44A0F74C39B7AB9C38C01F10AF4A5752" + "BFBCDF7E6DD826676AD031E7BCE63393" + "495BAD2CA4BE03B529A73C95E5B06BE7" + "35CA0F622C63E8F54171BD73E4C8F193" + "CB2664163719CA41F8159B8AC88F8CD3"; + array^pubkey = HexsToArray( sPubKeyBlob ); + + // Create a strong name. + StrongName^ mSN = gcnew StrongName( gcnew StrongNamePublicKeyBlob( pubkey ),"SN01",gcnew Version( "0.0.0.0" ) ); + + // Create assembly and host evidence. + // + Console::WriteLine( "Adding assembly evidence." ); + myEvidence->AddAssembly( "SN01" ); + myEvidence->AddAssembly( gcnew Version( "0.0.0.0" ) ); + myEvidence->AddAssembly( mSN ); + Console::WriteLine( "Count of evidence items = {0}", myEvidence->Count ); + // + + // + Url^ url = gcnew Url( "http://www.treyresearch.com" ); + Console::WriteLine( "Adding host evidence {0}", url ); + myEvidence->AddHost( url ); + PrintEvidence( myEvidence ).ToString(); + Console::WriteLine( "Count of evidence items = {0}", myEvidence->Count ); + // + + // + Console::WriteLine( "\nCopy the evidence to an array using CopyTo, then display the array." ); + array^evidenceArray = gcnew array(myEvidence->Count); + myEvidence->CopyTo( evidenceArray, 0 ); + for each (Object^ obj in evidenceArray) + { + Console::WriteLine(obj->ToString()); + } + // + + Console::WriteLine( "\nDisplay the contents of the properties." ); + Console::WriteLine( "Locked is the only property normally used by code." ); + Console::WriteLine( "IsReadOnly, IsSynchronized, and SyncRoot properties are not normally used." ); + + // + Console::WriteLine( "\nThe default value for the Locked property = {0}", myEvidence->Locked ); + // + + // + Console::WriteLine( "\nGet the hashcode for the evidence." ); + Console::WriteLine( "HashCode = {0}", myEvidence->GetHashCode() ); + // + + // + Console::WriteLine( "\nGet the type for the evidence." ); + Console::WriteLine( "Type = {0}", myEvidence->GetType() ); + // + + // + Console::WriteLine( "\nMerge new evidence with the current evidence." ); + array^oa1 = {}; + Site^ site = gcnew Site( "www.wideworldimporters.com" ); + array^oa2 = {url,site}; + Evidence^ newEvidence = gcnew Evidence( oa1,oa2 ); + myEvidence->Merge( newEvidence ); + Console::WriteLine( "Evidence count = {0}", PrintEvidence( myEvidence ) ); + // + + // + Console::WriteLine( "\nRemove URL evidence." ); + myEvidence->RemoveType( url->GetType() ); + Console::WriteLine( "Evidence count is now: {0}", myEvidence->Count ); + // + + // + Console::WriteLine( "\nMake a copy of the current evidence." ); + Evidence^ evidenceCopy = gcnew Evidence( myEvidence ); + Console::WriteLine( "Count of new evidence items = {0}", evidenceCopy->Count ); + Console::WriteLine( "Does the copy equal the current evidence? {0}", myEvidence->Equals( evidenceCopy ) ); + // + + // + Console::WriteLine( "\nClear the current evidence." ); + myEvidence->Clear(); + Console::WriteLine( "Count is now {0}", myEvidence->Count ); + // + + return myEvidence; + } + + static int PrintEvidence( Evidence^ myEvidence ) + { + // + int p = 0; + Console::WriteLine( "\nCurrent evidence = " ); + if ( nullptr == myEvidence ) + return 0; + + IEnumerator^ list = myEvidence->GetEnumerator(); + IEnumerator^ myEnum1 = list; + while ( myEnum1->MoveNext() ) + { + Object^ obj = safe_cast(myEnum1->Current); + Console::WriteLine( obj ); + p++; + } + // + + Console::WriteLine( "\n" ); + return p; + } + + // Convert a hexadecimal string to an array. + static array^ HexsToArray( String^ sHexString ) + { + array^arr = gcnew array(sHexString->Length / 2); + for ( int i = 0; i < sHexString->Length; i += 2 ) + { + arr[ i / 2 ] = Byte::Parse( sHexString->Substring( i, 2 ), NumberStyles::HexNumber ); + + } + return arr; + } +}; + + +// Main method. +int main() +{ + try + { + Evidence_Example^ EvidenceTest = gcnew Evidence_Example; + bool ret = EvidenceTest->CreateEvidence(); + if ( ret ) + { + Console::WriteLine( "Evidence successfully created." ); + } + else + { + Console::WriteLine( "Evidence creation failed." ); + } + EvidenceTest->DemonstrateEvidenceMembers(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + Environment::ExitCode = 101; + } +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp new file mode 100644 index 00000000000..6c337fe9923 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FileCodeGroup_Evt/CPP/members.cpp @@ -0,0 +1,314 @@ +// This sample demonstrates how to use each member of the FileCodeGroup class. +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; +using namespace System::Reflection; + +ref class Members +{ +public: + [STAThread] + static void Main() + { + FileCodeGroup^ fileCodeGroup = constructDefaultGroup(); + + // Create a deep copy of the FileCodeGroup. + // + FileCodeGroup^ copyCodeGroup = + dynamic_cast(fileCodeGroup->Copy()); + // + + CompareTwoCodeGroups( fileCodeGroup, copyCodeGroup ); + addPolicy( &fileCodeGroup ); + addXmlMember( &fileCodeGroup ); + updateMembershipCondition( &fileCodeGroup ); + addChildCodeGroup( &fileCodeGroup ); + Console::Write( L"Comparing the resolved code group " ); + Console::WriteLine( L"with the initial code group." ); + FileCodeGroup^ resolvedCodeGroup = + ResolveGroupToEvidence( fileCodeGroup ); + if ( CompareTwoCodeGroups( fileCodeGroup, resolvedCodeGroup ) ) + { + PrintCodeGroup( resolvedCodeGroup ); + } + else + { + PrintCodeGroup( fileCodeGroup ); + } + + Console::WriteLine( L"This sample completed successfully; press Enter to exit." ); + Console::ReadLine(); + } + +private: + // Construct a new FileCodeGroup with Read, Write, Append + // and PathDiscovery access. + static FileCodeGroup^ constructDefaultGroup() + { + // Construct a new file code group that has complete access to + // files in the specified path. + // + FileCodeGroup^ fileCodeGroup = gcnew FileCodeGroup( + gcnew AllMembershipCondition,FileIOPermissionAccess::AllAccess ); + // + + // Set the name of the file code group. + // + fileCodeGroup->Name = L"TempCodeGroup"; + // + + // Set the description of the file code group. + // + fileCodeGroup->Description = L"Temp folder permissions group"; + // + + // Retrieve the string representation of the fileCodeGroup’s + // attributes. FileCodeGroup does not use AttributeString, so the + // value should be null. + // + if ( fileCodeGroup->AttributeString != nullptr ) + { + throw gcnew NullReferenceException( + L"The AttributeString property should be null." ); + } + // + + return fileCodeGroup; + } + + // Add file permission to restrict write access to all files on the + // local machine. + static void addPolicy( interior_ptr fileCodeGroup ) + { + // Set the PolicyStatement property to a policy with read access to + // the root directory of drive C. + // + FileIOPermission^ rootFilePermissions = + gcnew FileIOPermission( PermissionState::None ); + rootFilePermissions->AllLocalFiles = + FileIOPermissionAccess::Read; + rootFilePermissions->SetPathList( + FileIOPermissionAccess::Read, L"C:\\" ); + NamedPermissionSet^ namedPermissions = + gcnew NamedPermissionSet( L"RootPermissions" ); + namedPermissions->AddPermission( rootFilePermissions ); + ( *fileCodeGroup )->PolicyStatement = + gcnew PolicyStatement( namedPermissions ); + // + } + + // Set the membership condition of the specified FileCodeGroup + // to the Intranet zone. + static void updateMembershipCondition( interior_ptr fileCodeGroup ) + { + // + ZoneMembershipCondition^ zoneCondition = + gcnew ZoneMembershipCondition( SecurityZone::Intranet ); + ( *fileCodeGroup )->MembershipCondition = zoneCondition; + // + } + + // Add a child group with read-access file permission to the specified + // code group. + static void addChildCodeGroup( interior_ptr fileCodeGroup ) + { + // Create a file code group with read-access permission. + // + FileCodeGroup^ tempFolderCodeGroup = gcnew FileCodeGroup( + gcnew AllMembershipCondition,FileIOPermissionAccess::Read ); + + // Set the name of the child code group and add it to + // the specified code group. + tempFolderCodeGroup->Name = L"Read-only group"; + ( *fileCodeGroup )->AddChild( tempFolderCodeGroup ); + // + } + + // Compare the two specified file code groups for equality. + static bool CompareTwoCodeGroups( FileCodeGroup^ firstCodeGroup, + FileCodeGroup^ secondCodeGroup ) + { + // + if ( firstCodeGroup->Equals( secondCodeGroup ) ) + // + { + Console::WriteLine( L"The two code groups are equal." ); + return true; + } + else + { + Console::WriteLine( L"The two code groups are not equal." ); + return false; + } + } + + // Retrieve the resolved policy based on Evidence from the executing + // assembly found in the specified code group. + static String^ ResolveEvidence( CodeGroup^ fileCodeGroup ) + { + String^ policyString = L""; + + // Resolve the policy based on evidence in the executing assembly. + // + Assembly^ assembly = Members::typeid->Assembly; + Evidence^ executingEvidence = assembly->Evidence; + PolicyStatement^ policy = fileCodeGroup->Resolve( executingEvidence ); + // + + if ( policy != nullptr ) + { + policyString = policy->ToString(); + } + + return policyString; + } + + // Retrieve the resolved code group based on the Evidence from + // the executing assembly found in the specified code group. + static FileCodeGroup^ ResolveGroupToEvidence( FileCodeGroup^ fileCodeGroup ) + { + // Resolve matching code groups to the executing assembly. + // + Assembly^ assembly = Members::typeid->Assembly; + Evidence^ evidence = assembly->Evidence; + CodeGroup^ codeGroup = fileCodeGroup->ResolveMatchingCodeGroups( evidence ); + // + + return dynamic_cast(codeGroup); + } + + // If a domain attribute is not found in the specified FileCodeGroup, + // add a child XML element identifying a custom membership condition. + static void addXmlMember( interior_ptr fileCodeGroup ) + { + // + SecurityElement^ xmlElement = ( *fileCodeGroup )->ToXml(); + // + + SecurityElement^ rootElement = gcnew SecurityElement( L"CodeGroup" ); + if ( xmlElement->Attribute(L"domain") == nullptr ) + { + // + SecurityElement^ newElement = gcnew SecurityElement( + L"CustomMembershipCondition" ); + newElement->AddAttribute( L"class", L"CustomMembershipCondition" ); + newElement->AddAttribute( L"version", L"1" ); + newElement->AddAttribute( L"domain", L"contoso.com" ); + rootElement->AddChild( newElement ); + ( *fileCodeGroup )->FromXml( rootElement ); + // + } + + Console::WriteLine( L"Added a custom membership condition:" ); + Console::WriteLine( rootElement ); + } + + // Print the properties of the specified code group to the console. + static void PrintCodeGroup( CodeGroup^ codeGroup ) + { + // Compare the type of the specified object with the FileCodeGroup + // type. + // + if ( !codeGroup->GetType()->Equals( FileCodeGroup::typeid ) ) + // + { + throw gcnew ArgumentException( L"Expected the FileCodeGroup type." ); + } + + String^ codeGroupName = codeGroup->Name; + String^ membershipCondition = codeGroup->MembershipCondition->ToString(); + + // + String^ permissionSetName = codeGroup->PermissionSetName; + // + + // + int hashCode = codeGroup->GetHashCode(); + // + + String^ mergeLogic = L""; + + // + if ( codeGroup->MergeLogic->Equals( L"Union" ) ) + { + mergeLogic = L" with Union merge logic"; + } + // + + // Retrieve the class path for FileCodeGroup. + // + String^ fileGroupClass = codeGroup->ToString(); + + // + // Write summary to the console window. + Console::WriteLine( L"\n*** {0} summary ***", fileGroupClass ); + Console::Write( L"A FileCodeGroup named " ); + Console::Write( L"{0}{1}", codeGroupName, mergeLogic ); + Console::Write( L" has been created with hash code{0}.", hashCode ); + Console::Write( L"This code group contains a {0}", membershipCondition ); + Console::Write( L" membership condition with the " ); + Console::Write( L"{0} permission set. ", permissionSetName ); + Console::Write( L"The code group has the following security policy: " ); + Console::WriteLine( ResolveEvidence( codeGroup ) ); + int childCount = codeGroup->Children->Count; + if ( childCount > 0 ) + { + Console::Write( L"There are {0}", childCount ); + Console::WriteLine( L" child code groups in this code group." ); + + // Iterate through the child code groups to display their names + // and remove them from the specified code group. + for ( int i = 0; i < childCount; i++ ) + { + // Get child code group as type FileCodeGroup. + // + FileCodeGroup^ childCodeGroup = + dynamic_cast(codeGroup->Children->default[ i ]); + + // + Console::Write( L"Removing the {0}.", childCodeGroup->Name ); + // Remove child code group. + + // + codeGroup->RemoveChild( childCodeGroup ); + // + } + Console::WriteLine(); + } + else + { + Console::Write( L"There are no child code groups" ); + Console::WriteLine( L" in this code group." ); + } + } +}; + +int main() +{ + Members::Main(); +} + +// +// This sample produces the following output: +// +// The two code groups are equal. +// Added a custom membership condition: +// +// +// +// Comparing the resolved code group with the initial code group. +// The two code groups are not equal. +// +// *** System.Security.Policy.FileCodeGroup summary *** +// A FileCodeGroup named with Union merge logic has been created with hash +// code 113151473. This code group contains a Zone - Intranet membership +// condition with the Same directory FileIO - NoAccess permission set. The +// code group has the following security policy: +// There are 1 child code groups in this code group. +// Removing the Read-only group. +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp new file mode 100644 index 00000000000..e8c9be6b48e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.FirstMatchCodeGroup_Evt/CPP/members.cpp @@ -0,0 +1,359 @@ +// This sample demonstrates how to use each member of the FirstMatchCodeGroup +// class. +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; +using namespace System::Reflection; + +ref class Members +{ +public: + [STAThread] + static void Main() + { + // Create a new FirstMatchCodeGroup. + FirstMatchCodeGroup^ codeGroup = constructDefaultGroup(); + + // Create a deep copy of the FirstMatchCodeGroup. + // + FirstMatchCodeGroup^ copyCodeGroup = + dynamic_cast(codeGroup->Copy()); + // + + // Compare the original code group with the copy. + CompareTwoCodeGroups( codeGroup, copyCodeGroup ); + + addPolicy( &codeGroup ); + addXmlMember( &codeGroup ); + updateMembershipCondition( &codeGroup ); + addChildCodeGroup( &codeGroup ); + + Console::Write( L"Comparing the resolved code group " ); + Console::WriteLine( L"with the initial code group." ); + FirstMatchCodeGroup^ resolvedCodeGroup = + ResolveGroupToEvidence( codeGroup ); + if ( CompareTwoCodeGroups( codeGroup, resolvedCodeGroup ) ) + { + PrintCodeGroup( resolvedCodeGroup ); + } + else + { + PrintCodeGroup( codeGroup ); + } + + Console::WriteLine( L"This sample completed successfully; " + L"press Enter to exit." ); + Console::ReadLine(); + } + +private: + // Create a FirstMatchCodeGroup with an exclusive policy and membership + // condition. + static FirstMatchCodeGroup^ constructDefaultGroup() + { + // Construct a new FirstMatchCodeGroup with Read, Write, Append + // and PathDiscovery access. + // Create read access permission to the root directory on drive C. + // + FileIOPermission^ rootFilePermissions = + gcnew FileIOPermission( PermissionState::None ); + rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read; + rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" ); + + // Add a permission to a named permission set. + NamedPermissionSet^ namedPermissions = + gcnew NamedPermissionSet( L"RootPermissions" ); + namedPermissions->AddPermission( rootFilePermissions ); + + // Create a PolicyStatement with exclusive rights to the policy. + PolicyStatement^ policy = gcnew PolicyStatement( + namedPermissions,PolicyStatementAttribute::Exclusive ); + + // Create a FirstMatchCodeGroup with a membership condition that + // matches all code, and an exclusive policy. + FirstMatchCodeGroup^ codeGroup = gcnew FirstMatchCodeGroup( + gcnew AllMembershipCondition,policy ); + // + + // Set the name of the first match code group. + // + codeGroup->Name = L"TempCodeGroup"; + // + + // Set the description of the first match code group. + // + codeGroup->Description = L"Temp folder permissions group"; + // + return codeGroup; + } + + // Add file permission to restrict write access to all files + // on the local machine. + static void addPolicy( interior_ptr codeGroup ) + { + // Set the PolicyStatement property to a policy with read access to + // the root directory on drive C. + // + FileIOPermission^ rootFilePermissions = + gcnew FileIOPermission( PermissionState::None ); + rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read; + rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" ); + + NamedPermissionSet^ namedPermissions = + gcnew NamedPermissionSet( L"RootPermissions" ); + namedPermissions->AddPermission( rootFilePermissions ); + + // Create a PolicyStatement with exclusive rights to the policy. + PolicyStatement^ policy = gcnew PolicyStatement( + namedPermissions,PolicyStatementAttribute::Exclusive ); + ( *codeGroup )->PolicyStatement = policy; + // + } + + // Set the membership condition of the code group. + static void updateMembershipCondition( + interior_ptr codeGroup ) + { + // Set the membership condition of the specified FirstMatchCodeGroup + // to the Intranet zone. + // + ZoneMembershipCondition^ zoneCondition = + gcnew ZoneMembershipCondition( SecurityZone::Intranet ); + ( *codeGroup )->MembershipCondition = zoneCondition; + // + } + + // Create a child code group with read-access file permissions and add it + // to the specified code group. + static void addChildCodeGroup( interior_ptr codeGroup ) + { + // Create a first match code group with read access. + // + FileIOPermission^ rootFilePermissions = gcnew FileIOPermission( + PermissionState::None ); + rootFilePermissions->AllLocalFiles = FileIOPermissionAccess::Read; + rootFilePermissions->SetPathList( FileIOPermissionAccess::Read, L"C:\\" ); + + PermissionSet^ permissions = gcnew PermissionSet( + PermissionState::Unrestricted ); + permissions->AddPermission( rootFilePermissions ); + + FirstMatchCodeGroup^ tempFolderCodeGroup = + gcnew FirstMatchCodeGroup( gcnew AllMembershipCondition, + gcnew PolicyStatement( permissions ) ); + + // Set the name of the child code group and add it to + // the specified code group. + tempFolderCodeGroup->Name = L"Read-only code group"; + ( *codeGroup )->AddChild( tempFolderCodeGroup ); + // + } + + // Compare the two FirstMatchCodeGroups. + static bool CompareTwoCodeGroups( FirstMatchCodeGroup^ firstCodeGroup, + FirstMatchCodeGroup^ secondCodeGroup ) + { + // Compare the two specified FirstMatchCodeGroups for equality. + // + if ( firstCodeGroup->Equals( secondCodeGroup ) ) + // + { + Console::WriteLine( L"The two code groups are equal." ); + return true; + } + else + { + Console::WriteLine( L"The two code groups are not equal." ); + return false; + } + } + + // Retrieve the resolved policy based on executing evidence found + // in the specified code group. + static String^ ResolveEvidence( CodeGroup^ codeGroup ) + { + String^ policyString = L"None"; + + // Resolve the policy based on the executing assembly's evidence. + // + Assembly^ assembly = Members::typeid->Assembly; + Evidence^ executingEvidence = assembly->Evidence; + + PolicyStatement^ policy = codeGroup->Resolve( executingEvidence ); + // + + if ( policy != nullptr ) + { + policyString = policy->ToString(); + } + + return policyString; + } + + // Retrieve the resolved code group based on the evidence from the + // specified code group. + static FirstMatchCodeGroup^ ResolveGroupToEvidence( + FirstMatchCodeGroup^ codeGroup ) + { + // Resolve matching code groups to the executing assembly. + // + Assembly^ assembly = Members::typeid->Assembly; + Evidence^ evidence = assembly->Evidence; + CodeGroup^ resolvedCodeGroup = + codeGroup->ResolveMatchingCodeGroups( evidence ); + // + + return dynamic_cast(resolvedCodeGroup); + } + + // If a domain attribute is not found in the specified + // FirstMatchCodeGroup, add a child XML element identifying a custom + // membership condition. + static void addXmlMember( interior_ptr codeGroup ) + { + // + SecurityElement^ xmlElement = ( *codeGroup )->ToXml(); + // + + SecurityElement^ rootElement = gcnew SecurityElement( L"CodeGroup" ); + + if ( xmlElement->Attribute(L"domain") == nullptr ) + { + // + SecurityElement^ newElement = gcnew SecurityElement( + L"CustomMembershipCondition" ); + newElement->AddAttribute( L"class", L"CustomMembershipCondition" ); + newElement->AddAttribute( L"version", L"1" ); + newElement->AddAttribute( L"domain", L"contoso.com" ); + rootElement->AddChild( newElement ); + ( *codeGroup )->FromXml( rootElement ); + // + } + + Console::WriteLine( L"Added a custom membership condition:" ); + Console::WriteLine( rootElement ); + } + + // Print the properties of the specified code group to the console. + static void PrintCodeGroup( CodeGroup^ codeGroup ) + { + // Compare the type of the specified object with the + // FirstMatchCodeGroup type. + // + if ( !codeGroup->GetType()->Equals( FirstMatchCodeGroup::typeid ) ) + // + { + throw gcnew ArgumentException( L"Expected the FirstMatchCodeGroup type." ); + } + + String^ codeGroupName = codeGroup->Name; + String^ membershipCondition = codeGroup->MembershipCondition->ToString(); + + // + String^ permissionSetName = codeGroup->PermissionSetName; + // + + // + int hashCode = codeGroup->GetHashCode(); + // + + String^ mergeLogic = L""; + // + if ( codeGroup->MergeLogic->Equals( L"First Match" ) ) + // + { + mergeLogic = L"with first-match merge logic"; + } + + // Retrieve the class path for the FirstMatchCodeGroup. + // + String^ firstMatchGroupClass = codeGroup->ToString(); + // + + String^ attributeString = L""; + // Retrieve the string representation of the FirstMatchCodeGroup's + // attributes. + // + if ( codeGroup->AttributeString != nullptr ) + { + attributeString = codeGroup->AttributeString; + } + // + + // Write a summary to the console window. + Console::WriteLine( L"\n*** {0} summary ***", firstMatchGroupClass ); + Console::Write( L"A FirstMatchCodeGroup named " ); + Console::Write( L"{0}{1}", codeGroupName, mergeLogic ); + Console::Write( L" has been created with hash code({0}).", hashCode ); + Console::Write( L"\nThis code group contains a {0}", membershipCondition ); + Console::Write( L" membership condition with the " ); + Console::WriteLine( L"{0} permission set.", permissionSetName ); + + Console::Write( L"The code group contains the following policy: " ); + Console::Write( ResolveEvidence( codeGroup ) ); + Console::Write( L"\nIt also contains the following attributes: " ); + Console::WriteLine( attributeString ); + + int childCount = codeGroup->Children->Count; + if ( childCount > 0 ) + { + Console::Write( L"There are {0}", childCount ); + Console::WriteLine( L" child elements in the code group." ); + + // Iterate through the child code groups to display their names + // and then remove them from the specified code group. + for ( int i = 0; i < childCount; i++ ) + { + // Retrieve a child code group, which has been cast as a + // FirstMatchCodeGroup type. + // + FirstMatchCodeGroup^ childCodeGroup = + dynamic_cast(codeGroup->Children->default[ i ]); + // + + Console::Write( L"Removing the {0}.", childCodeGroup->Name ); + // Remove the child code group. + // + codeGroup->RemoveChild( childCodeGroup ); + // + } + Console::WriteLine(); + } + else + { + Console::WriteLine( L" No child code groups were found in this" + L" code group." ); + } + } +}; + +int main() +{ + Members::Main(); +} +// +// This sample produces the following output: +// +// The two code groups are equal. +// Added a custom membership condition: +// +// +// +// +// Comparing the resolved code group with the initial code group. +// The two code groups are not equal. +// +// *** System.Security.Policy.FirstMatchCodeGroup summary *** +// A FirstMatchCodeGroup named with first-match merge logic has been created +// with hash code(113151525). +// This code group contains a Zone - Intranet membership condition with the +// permission set. The code group contains the following policy: +// It also contains the following attributes: +// There are 1 child elements in the code group. +// Removing the Read-only code group. +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp new file mode 100644 index 00000000000..0e0dece2b02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.Gac/CPP/gac.cpp @@ -0,0 +1,39 @@ + +// +using namespace System; +using namespace System::Security::Policy; +using namespace System::Security; +using namespace System::Security::Permissions; + +[STAThread] +int main() +{ + + // + GacInstalled ^ myGacInstalled = gcnew GacInstalled; + // + + // + array^hostEvidence = {myGacInstalled}; + array^assemblyEvidence = {}; + Evidence^ myEvidence = gcnew Evidence( hostEvidence,assemblyEvidence ); + GacIdentityPermission ^ myPerm = dynamic_cast + (myGacInstalled->CreateIdentityPermission( myEvidence )); + Console::WriteLine( myPerm->ToXml() ); + // + + // + GacInstalled ^ myGacInstalledCopy = + dynamic_cast(myGacInstalled->Copy()); + bool result = myGacInstalled->Equals( myGacInstalledCopy ); + // + + // + Console::WriteLine( "Hashcode = {0}", myGacInstalled->GetHashCode() ); + // + + // + Console::WriteLine( myGacInstalled->ToString() ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp new file mode 100644 index 00000000000..e3e119284e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.GacMembershipCondition/CPP/gacmembershipcondition.cpp @@ -0,0 +1,227 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Collections; +public ref class GacMembershipConditionDemo +{ +private: + + // Demonstrate the Copy method, which creates an identical + // copy of the current permission. + bool CopyDemo() + { + Console::WriteLine( + "************************************************************"); + // + GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; + Console::WriteLine("Original membership condition = "); + Console::WriteLine(Gac1->ToXml()); + try + { + IMembershipCondition^ membershipCondition = Gac1->Copy(); + Console::WriteLine("Result of Copy = "); + Console::WriteLine( + (dynamic_cast(membershipCondition)) + ->ToXml()); + } + catch (Exception^ e) + { + Console::WriteLine("Copy failed : {0}{1}", Gac1, e); + return false; + } + // + + return true; + } + + // Demonstrate the Check method, which determines whether the specified + // evidence satisfies the membership condition. + bool CheckDemo() + { + Console::WriteLine( + "************************************************************"); + // + GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; + GacInstalled ^ myGac = gcnew GacInstalled; + try + { + array^hostEvidence = {myGac}; + array^assemblyEvidence = {}; + Evidence^ myEvidence = + gcnew Evidence(hostEvidence,assemblyEvidence); + bool retCode = Gac1->Check(myEvidence); + Console::WriteLine("Result of Check = {0}\n", retCode); + } + catch (Exception^ e) + { + Console::WriteLine("Check failed : {0}{1}", Gac1, e); + return false; + } + // + + return true; + } + + // Demonstrate the GetHashCode method, which returns a hash code + // for the specified membership condition. + bool GetHashCodeDemo() + { + Console::WriteLine( + "************************************************************"); + // + GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; + try + { + Console::WriteLine( + "Result of GetHashCode for a GacMembershipCondition = {0}\n", + Gac1->GetHashCode()); + } + catch (Exception^ e) + { + Console::WriteLine("GetHashCode failed : {0}{1}", Gac1, e); + return false; + } + // + + return true; + } + + // Demonstrate the ToXml and FromXml methods, including the overloads. + // ToXml creates an XML encoding of the membership condition and its + // current state; FromXml reconstructs a membership condition with the + // specified state from the XML encoding. + bool ToFromXmlDemo() + { + Console::WriteLine( + "************************************************************"); + try + { + // + GacMembershipCondition ^ Gac1 = gcnew GacMembershipCondition; + GacMembershipCondition ^ Gac2 = gcnew GacMembershipCondition; + + // Roundtrip a GacMembershipCondition to and from an XML encoding. + Gac2->FromXml(Gac1->ToXml()); + bool result = Gac2->Equals(Gac1); + if (result) + { + Console::WriteLine("Result of ToXml() = {0}", Gac2->ToXml()); + Console::WriteLine( + "Result of ToFromXml roundtrip = {0}", Gac2); + } + else + { + Console::WriteLine(Gac2->ToString()); + Console::WriteLine(Gac1->ToString()); + return false; + } + // + + // + GacMembershipCondition ^ Gac3 = gcnew GacMembershipCondition; + GacMembershipCondition ^ Gac4 = gcnew GacMembershipCondition; + IEnumerator^ policyEnumerator = SecurityManager::PolicyHierarchy(); + while (policyEnumerator->MoveNext()) + { + PolicyLevel^ currentLevel = + dynamic_cast(policyEnumerator->Current); + if (currentLevel->Label->Equals("Machine")) + { + Console::WriteLine("Result of ToXml(level) = {0}", + Gac3->ToXml(currentLevel)); + Gac4->FromXml(Gac3->ToXml(), currentLevel); + Console::WriteLine( + "Result of FromXml(element, level) = {0}", Gac4); + } + } + // + } + catch (Exception^ e) + { + Console::WriteLine("ToFromXml failed. {0}", e); + return false; + } + + return true; + } + +public: + + // Invoke all demos. + bool RunDemo() + { + bool returnCode = true; + bool tempReturnCode; + + // Call the Copy demo. + if (tempReturnCode = CopyDemo()) + Console::WriteLine("Copy demo completed successfully."); + else + Console::WriteLine("Copy demo failed."); + + returnCode = tempReturnCode && returnCode; + + // Call the Check demo. + if (tempReturnCode = CheckDemo()) + Console::WriteLine("Check demo completed successfully."); + else + Console::WriteLine("Check demo failed."); + + returnCode = tempReturnCode && returnCode; + + // Call the GetHashCode demo. + if (tempReturnCode = GetHashCodeDemo()) + Console::WriteLine("GetHashCode demo completed successfully."); + else + Console::WriteLine("GetHashCode demo failed."); + + returnCode = tempReturnCode && returnCode; + + // Call the ToFromXml demo. + if (tempReturnCode = ToFromXmlDemo()) + Console::WriteLine("ToFromXml demo completed successfully."); + else + Console::WriteLine("ToFromXml demo failed."); + + returnCode = tempReturnCode && returnCode; + return (returnCode); + } +}; + +// Test harness. +int main() +{ + try + { + GacMembershipConditionDemo^ testcase = + gcnew GacMembershipConditionDemo; + bool returnCode = testcase->RunDemo(); + if (returnCode) + { + Console::WriteLine( + "The GacMembershipCondition demo completed successfully."); + Console::WriteLine("Press the Enter key to exit."); + Console::ReadLine(); + System::Environment::ExitCode = 100; + } + else + { + Console::WriteLine("The GacMembershipCondition demo failed."); + Console::WriteLine("Press the ENTER key to exit."); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } + } + catch (Exception^ e) + { + Console::WriteLine("The GacIdentityPermission demo failed."); + Console::WriteLine(e); + Console::WriteLine("Press the Enter key to exit."); + Console::ReadLine(); + System::Environment::ExitCode = 101; + } +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp new file mode 100644 index 00000000000..c41e32df504 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Policy.PolicyStatement_Evt/CPP/members.cpp @@ -0,0 +1,224 @@ +// This sample demonstrates how to use each member of the PolicyStatement +// class. +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Principal; +using namespace System::Security::Permissions; + +ref class Members +{ +public: + [STAThread] + static void Main() + { + // Create two new policy statements. + PolicyStatement^ policyStatement = firstConstructorTest(); + PolicyStatement^ policyStatement2 = secondConstructorTest(); + + // Add attributes to the first policy statement. + // + policyStatement->Attributes = PolicyStatementAttribute::All; + // + + // Create a copy of the first policy statement. + PolicyStatement^ policyStatementCopy = createCopy( policyStatement ); + addXmlMember( &policyStatementCopy ); + + summarizePolicyStatment( policyStatement ); + Console::Write( L"This sample completed successfully; " ); + Console::WriteLine( L"press Enter to exit." ); + Console::ReadLine(); + } + +private: + // Construct a PolicyStatement with an Unrestricted permission set. + static PolicyStatement^ firstConstructorTest() + { + // Construct the permission set. + // + PermissionSet^ permissions = gcnew PermissionSet( + PermissionState::Unrestricted ); + permissions->AddPermission( gcnew SecurityPermission( + SecurityPermissionFlag::Execution ) ); + permissions->AddPermission( gcnew ZoneIdentityPermission( + SecurityZone::MyComputer ) ); + + // Create a policy statement based on the newly created permission + // set. + PolicyStatement^ policyStatement = gcnew PolicyStatement( + permissions ); + // + + return policyStatement; + } + + // Construct a PolicyStatement with an Unrestricted permission set and + // the LevelFinal attribute. + static PolicyStatement^ secondConstructorTest() + { + // Construct the permission set. + // + PermissionSet^ permissions = gcnew PermissionSet( + PermissionState::Unrestricted ); + permissions->AddPermission( gcnew SecurityPermission( + SecurityPermissionFlag::Execution ) ); + permissions->AddPermission( gcnew ZoneIdentityPermission( + SecurityZone::MyComputer ) ); + + PolicyStatementAttribute levelFinalAttribute = + PolicyStatementAttribute::LevelFinal; + + // Create a new policy statement with the specified permission set. + // The LevelFinal attribute is set to prevent the evaluation of lower + // policy levels in a resolve operation. + PolicyStatement^ policyStatement = gcnew PolicyStatement( + permissions,levelFinalAttribute ); + // + + return policyStatement; + } + + // Add a named permission set to the specified PolicyStatement. + static void AddPermissions( interior_ptrpolicyStatement ) + { + // Construct a NamedPermissionSet with basic permissions. + // + NamedPermissionSet^ allPerms = gcnew NamedPermissionSet( + L"allPerms" ); + allPerms->AddPermission( gcnew SecurityPermission( + SecurityPermissionFlag::Execution ) ); + allPerms->AddPermission( gcnew ZoneIdentityPermission( + SecurityZone::MyComputer ) ); + allPerms->AddPermission( gcnew SiteIdentityPermission( + L"www.contoso.com" ) ); + + ( *policyStatement)->PermissionSet = allPerms; + // + } + + // If a class attribute is not found in the specified PolicyStatement, + // add a child XML element with an added class attribute. + static void addXmlMember( interior_ptrpolicyStatement ) + { + // + SecurityElement^ xmlElement = ( *policyStatement)->ToXml(); + // + if ( xmlElement->Attribute(L"class") == nullptr ) + { + // + SecurityElement^ newElement = gcnew SecurityElement( + L"PolicyStatement" ); + newElement->AddAttribute( L"class", ( + *policyStatement)->ToString() ); + newElement->AddAttribute( L"version", L"1.1" ); + + newElement->AddChild( gcnew SecurityElement( L"PermissionSet" ) ); + + ( *policyStatement)->FromXml( newElement ); + // + + Console::Write( L"Added the class attribute and modified its " ); + Console::WriteLine( L"version number.\n{0}", newElement ); + } + } + + // Verify that the type of the specified object is a PolicyStatement type + // then create a copy of the object. + static PolicyStatement^ createCopy( Object^ sourceObject ) + { + PolicyStatement^ returnedStatement = gcnew PolicyStatement( nullptr ); + // Compare specified object type with the PolicyStatement type. + // + if ( sourceObject->GetType()->Equals( PolicyStatement::typeid ) ) + // + { + returnedStatement = getCopy( + static_cast(sourceObject) ); + } + else + { + throw gcnew ArgumentException( + L"Expected the PolicyStatement type." ); + } + + return returnedStatement; + } + + // Return a copy of the specified PolicyStatement if the result of the + // Copy command is an equivalent object. Otherwise, return the + // original PolicyStatement object. + static PolicyStatement^ getCopy( PolicyStatement^ policyStatement ) + { + // Create an equivalent copy of the policy statement. + // + PolicyStatement^ policyStatementCopy = policyStatement->Copy(); + // + + // Compare the specified objects for equality. + // + if ( !policyStatementCopy->Equals( policyStatement ) ) + // + { + return policyStatementCopy; + } + else + { + return policyStatement; + } + } + + // Summarize the attributes of the specified PolicyStatement on the + // console window. + static void summarizePolicyStatment( PolicyStatement^ policyStatement ) + { + // Retrieve the class path for policyStatement. + // + String^ policyStatementClass = policyStatement->ToString(); + // + + // + int hashCode = policyStatement->GetHashCode(); + // + + String^ attributeString = L""; + + // Retrieve the string representation of the PolicyStatement + // attributes. + // + if ( policyStatement->AttributeString != nullptr ) + { + attributeString = policyStatement->AttributeString; + } + // + + // Write a summary to the console window. + Console::WriteLine( L"\n*** {0} summary ***", policyStatementClass ); + Console::Write( L"This PolicyStatement has been created with hash " ); + Console::Write( L"code({0}) ", hashCode ); + + Console::Write( L"and contains the following attributes: " ); + Console::WriteLine( attributeString ); + } +}; + +int main() +{ + Members::Main(); +} + +// +// This sample produces the following output: +// +// Added the class attribute and modified the version number. +// +// +// +// +// *** System.Security.Policy.PolicyStatement summary *** +// PolicyStatement has been created with hash code(20) containing the +// following attributes: Exclusive LevelFinal +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp new file mode 100644 index 00000000000..00423830711 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericIdentity2/CPP/genericidentitymembers.cpp @@ -0,0 +1,81 @@ + +// This sample demonstrates how to call each member of the GenericIdentity +// class. +// +using namespace System; +using namespace System::Security::Principal; +void ShowIdentityPreferences( GenericIdentity^ genericIdentity ); +GenericIdentity^ GetGenericIdentity(); + +[STAThread] +int main() +{ + // Create a GenericIdentity object with no authentication type + // specified. + // + GenericIdentity^ defaultIdentity = gcnew GenericIdentity( "DefaultUser" ); + // + + // Retrieve a GenericIdentity created from current WindowsIdentity + // values. + GenericIdentity^ currentIdentity = GetGenericIdentity(); + ShowIdentityPreferences( gcnew GenericIdentity( "" ) ); + ShowIdentityPreferences( defaultIdentity ); + ShowIdentityPreferences( currentIdentity ); + Console::WriteLine( "The sample completed successfully; " + "press Enter to continue." ); + Console::ReadLine(); +} + +// Print identity preferences to the console window. +void ShowIdentityPreferences( GenericIdentity^ genericIdentity ) +{ + // Retrieve the name of the generic identity object. + // + String^ identityName = genericIdentity->Name; + // + + // Retrieve the authentication type of the generic identity object. + // + String^ identityAuthenticationType = genericIdentity->AuthenticationType; + // + + Console::WriteLine( "Name: {0}", identityName ); + Console::WriteLine( "Type: {0}", identityAuthenticationType ); + + // Verify that the user's identity has been authenticated + // (was created with a valid name). + // + if ( genericIdentity->IsAuthenticated ) + // + { + Console::WriteLine( "The user's identity has been authenticated." ); + } + else + { + Console::WriteLine( "The user's identity has not been " + "authenticated." ); + } + + Console::WriteLine( "~~~~~~~~~~~~~~~~~~~~~~~~~" ); +} + + +// Create generic identity based on values from the current +// WindowsIdentity. +GenericIdentity^ GetGenericIdentity() +{ + // Get values from the current WindowsIdentity. + // + WindowsIdentity^ windowsIdentity = WindowsIdentity::GetCurrent(); + + // Construct a GenericIdentity object based on the current Windows + // identity name and authentication type. + String^ authenticationType = windowsIdentity->AuthenticationType; + String^ userName = windowsIdentity->Name; + GenericIdentity^ authenticatedGenericIdentity = gcnew GenericIdentity( userName,authenticationType ); + // + + return authenticatedGenericIdentity; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp new file mode 100644 index 00000000000..9f65a364819 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.GenericPrincipal2/CPP/genericprincipalmembers.cpp @@ -0,0 +1,98 @@ +// This sample demonstrates how to call each member of the GenericPrincipal +// class. +// +using namespace System; +using namespace System::Security::Principal; + +ref class GenericPrincipalMembers +{ +public: + [STAThread] + static void Main() + { + // Retrieve a GenericPrincipal that is based on the current user's + // WindowsIdentity. + GenericPrincipal^ genericPrincipal = GetGenericPrincipal(); + + // Retrieve the generic identity of the GenericPrincipal object. + // + GenericIdentity^ principalIdentity = + dynamic_cast(genericPrincipal->Identity); + // + + // Display the identity name and authentication type. + if ( principalIdentity->IsAuthenticated ) + { + Console::WriteLine( principalIdentity->Name ); + Console::WriteLine( L"Type:{0}", + principalIdentity->AuthenticationType ); + } + + // Verify that the generic principal has been assigned the + // NetworkUser role. + // + if ( genericPrincipal->IsInRole( L"NetworkUser" ) ) + { + Console::WriteLine( L"User belongs to the NetworkUser role." ); + } + // + Console::WriteLine( L"The sample completed successfully; " + L"press Enter to continue." ); + Console::ReadLine(); + } + +private: + // Create a generic principal based on values from the current + // WindowsIdentity. + static GenericPrincipal^ GetGenericPrincipal() + { + // Use values from the current WindowsIdentity to construct + // a set of GenericPrincipal roles. + // + WindowsIdentity^ windowsIdentity = WindowsIdentity::GetCurrent(); + array^roles = gcnew array(10); + if ( windowsIdentity->IsAuthenticated ) + { + + // Add custom NetworkUser role. + roles[ 0 ] = L"NetworkUser"; + } + + if ( windowsIdentity->IsGuest ) + { + + // Add custom GuestUser role. + roles[ 1 ] = L"GuestUser"; + } + + if ( windowsIdentity->IsSystem ) + { + + // Add custom SystemUser role. + roles[ 2 ] = L"SystemUser"; + } + + // Construct a GenericIdentity object based on the current Windows + // identity name and authentication type. + String^ authenticationType = windowsIdentity->AuthenticationType; + String^ userName = windowsIdentity->Name; + GenericIdentity^ genericIdentity = gcnew GenericIdentity( + userName,authenticationType ); + + // Construct a GenericPrincipal object based on the generic identity + // and custom roles for the user. + GenericPrincipal^ genericPrincipal = gcnew GenericPrincipal( + genericIdentity,roles ); + // + + return genericPrincipal; + } +}; + +int main() +{ + GenericPrincipalMembers::Main(); +} + + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp new file mode 100644 index 00000000000..3ded7b386b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsBuiltInRole Example/CPP/source.cpp @@ -0,0 +1,41 @@ +using namespace System; +using namespace System::Threading; +using namespace System::Security::Permissions; +using namespace System::Security::Principal; + +class SecurityPrincipalDemo +{ + // +public: + static void DemonstrateWindowsBuiltInRoleEnum() + { + AppDomain^ myDomain = Thread::GetDomain(); + + myDomain->SetPrincipalPolicy( PrincipalPolicy::WindowsPrincipal ); + WindowsPrincipal^ myPrincipal = dynamic_cast(Thread::CurrentPrincipal); + + Console::WriteLine( "{0} belongs to: ", myPrincipal->Identity->Name ); + + Array^ wbirFields = Enum::GetValues( WindowsBuiltInRole::typeid ); + + for each ( Object^ roleName in wbirFields ) + { + try + { + Console::WriteLine( "{0}? {1}.", roleName, + myPrincipal->IsInRole( *dynamic_cast(roleName) ) ); + } + catch ( Exception^ ) + { + Console::WriteLine( "{0}: Could not obtain role for this RID.", + roleName ); + } + } + } + // +}; + +int main() +{ + SecurityPrincipalDemo::DemonstrateWindowsBuiltInRoleEnum(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp new file mode 100644 index 00000000000..1379e071f99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.Principal.WindowsIdentity_AllMembers/CPP/windowsidentitymembers.cpp @@ -0,0 +1,220 @@ + +// This sample demonstrates how to use each member of the WindowsIdentity +// class. +// +using namespace System; +using namespace System::Security::Principal; +void IntPtrConstructor( IntPtr logonToken ); +void IntPtrStringConstructor( IntPtr logonToken ); +void IntPrtStringTypeBoolConstructor( IntPtr logonToken ); +void IntPtrStringTypeConstructor( IntPtr logonToken ); +void UseProperties( IntPtr logonToken ); +IntPtr LogonUser(); +void GetAnonymousUser(); +void ImpersonateIdentity( IntPtr logonToken ); + +[STAThread] +int main() +{ + + // Retrieve the Windows account token for the current user. + IntPtr logonToken = LogonUser(); + + // Constructor implementations. + IntPtrConstructor( logonToken ); + IntPtrStringConstructor( logonToken ); + IntPtrStringTypeConstructor( logonToken ); + IntPrtStringTypeBoolConstructor( logonToken ); + + // Property implementations. + UseProperties( logonToken ); + + // Method implementations. + GetAnonymousUser(); + ImpersonateIdentity( logonToken ); + Console::WriteLine( "This sample completed successfully; " + "press Enter to exit." ); + Console::ReadLine(); +} + + +// Create a WindowsIdentity object for the user represented by the +// specified Windows account token. + // +void IntPtrConstructor( IntPtr logonToken ) +{ + + // Construct a WindowsIdentity object using the input account token. + WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken ); + + Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); +} + // + +// Create a WindowsIdentity object for the user represented by the +// specified account token and authentication type. + // +void IntPtrStringConstructor( IntPtr logonToken ) +{ + + // Construct a WindowsIdentity object using the input account token + // and the specified authentication type. + String^ authenticationType = "WindowsAuthentication"; + WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType ); + + Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); +} + + // + + +// Create a WindowsIdentity object for the user represented by the +// specified account token, authentication type and Windows account +// type. + // +void IntPtrStringTypeConstructor( IntPtr logonToken ) +{ + + // Construct a WindowsIdentity object using the input account token, + // and the specified authentication type and Windows account type. + String^ authenticationType = "WindowsAuthentication"; + WindowsAccountType guestAccount = WindowsAccountType::Guest; + WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType,guestAccount ); + + Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); +} + // + +// Create a WindowsIdentity object for the user represented by the +// specified account token, authentication type, Windows account type and +// Boolean authentication flag. + // +void IntPrtStringTypeBoolConstructor( IntPtr logonToken ) +{ + + // Construct a WindowsIdentity object using the input account token, + // and the specified authentication type, Windows account type, and + // authentication flag. + String^ authenticationType = "WindowsAuthentication"; + WindowsAccountType guestAccount = WindowsAccountType::Guest; + bool isAuthenticated = true; + WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken,authenticationType,guestAccount,isAuthenticated ); + + Console::WriteLine( "Created a Windows identity object named {0}.", windowsIdentity->Name ); +} + // + +// Access the properties of a WindowsIdentity object. +void UseProperties( IntPtr logonToken ) +{ + WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken ); + String^ propertyDescription = "The windows identity named "; + + // Retrieve the Windows logon name from the Windows identity object. + // + propertyDescription = String::Concat( propertyDescription, windowsIdentity->Name ); + + // + // Verify that the user account is not considered to be an Anonymous + // account by the system. + // + if ( !windowsIdentity->IsAnonymous ) + { + propertyDescription = String::Concat( propertyDescription, ", is not an Anonymous account" ); + } + // + + + // Verify that the user account has been authenticated by Windows. + // + if ( windowsIdentity->IsAuthenticated ) + { + propertyDescription = String::Concat( propertyDescription, ", is authenticated" ); + } + // + + // Verify that the user account is considered to be a System account + // by the system. + // + if ( windowsIdentity->IsSystem ) + { + propertyDescription = String::Concat( propertyDescription, ", is a System account" ); + } + // + + // Verify that the user account is considered to be a Guest account + // by the system. + // + if ( windowsIdentity->IsGuest ) + { + propertyDescription = String::Concat( propertyDescription, ", is a Guest account" ); + } + // + + // Retrieve the authentication type for the + // + String^ authenticationType = windowsIdentity->AuthenticationType; + + // Append the authenication type to the output message. + if ( authenticationType != nullptr ) + { + propertyDescription = String::Format( "{0} and uses {1} authentication type.", propertyDescription, authenticationType ); + } + // + + Console::WriteLine( propertyDescription ); +} + + +// Retrieve the account token from the current WindowsIdentity object +// instead of calling the unmanaged LogonUser method in the advapi32.dll. +IntPtr LogonUser() +{ + + // + // + IntPtr accountToken = WindowsIdentity::GetCurrent()->Token; + + // + // + return accountToken; +} + + +// Get the WindowsIdentity object for an Anonymous user. +void GetAnonymousUser() +{ + + // Retrieve a WindowsIdentity object that represents an anonymous + // Windows user. + // + WindowsIdentity^ windowsIdentity = WindowsIdentity::GetAnonymous(); + + // +} + + +// Impersonate a Windows identity. +// +void ImpersonateIdentity( IntPtr logonToken ) +{ + + // Retrieve the Windows identity using the specified token. + WindowsIdentity^ windowsIdentity = gcnew WindowsIdentity( logonToken ); + + // Create a WindowsImpersonationContext object by impersonating the + // Windows identity. + WindowsImpersonationContext^ impersonationContext = windowsIdentity->Impersonate(); + Console::WriteLine( "Name of the identity after impersonation: {0}.", WindowsIdentity::GetCurrent()->Name ); + + // Stop impersonating the user. + impersonationContext->Undo(); + + // Check the identity name. + Console::Write( "Name of the identity after performing an Undo on the" ); + Console::WriteLine( " impersonation: {0}", WindowsIdentity::GetCurrent()->Name ); +} + +// +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp new file mode 100644 index 00000000000..6f27c73ab00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor2.cpp @@ -0,0 +1,25 @@ +// +using namespace System; +using namespace System::Security; + +int main(array ^args) +{ + // Define the string value to assign to a new secure string. + Char chars[4] = { 't', 'e', 's', 't' }; + // Instantiate the secure string. + SecureString^ testString = gcnew SecureString(); + // Assign the character array to the secure string. + for each (Char ch in chars) + { + testString->AppendChar(ch); + } + // Display secure string length. + Console::WriteLine("The length of the string is {0} characters.", + testString->Length); + + delete testString; + return 0; +} +// The example displays the following output: +// The length of the string is 4 characters. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp new file mode 100644 index 00000000000..103271ae878 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecureString.Ctor/cpp/Ctor3.cpp @@ -0,0 +1,25 @@ +// +using namespace System; +using namespace System::Security; + +int main(array ^args) +{ + // Define the string value to be assigned to the secure string. + String^ initString = "TestString"; + // Instantiate the secure string. + SecureString^ testString = gcnew SecureString(); + // Assign the character array to the secure string. + for each (Char ch in initString) + { + testString->AppendChar(ch); + } + // Display secure string length. + Console::WriteLine("The length of the string is {0} characters.", + testString->Length); + + delete testString; + return 0; +} +// The example displays the following output: +// The length of the string is 10 characters. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp new file mode 100644 index 00000000000..41c475aa884 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.SecurityException/CPP/form1.cpp @@ -0,0 +1,243 @@ + +#using "System.Data.dll" + +// +using namespace System; +using namespace System::Data; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Policy; +using namespace System::Reflection; +using namespace System::Runtime::Serialization; + +namespace SecurityExceptionSample +{ + [assembly:KeyContainerPermissionAttribute( + SecurityAction::RequestRefuse, + Flags=KeyContainerPermissionFlags::Import)]; + ref class TestSecurityException + { + public: + void MakeTest() + { + try + { + // Deny a permission. + KeyContainerPermission^ keyContainerDecryptPermission = + gcnew KeyContainerPermission( + KeyContainerPermissionFlags::Decrypt); + keyContainerDecryptPermission->Deny(); + + // Demand the denied permission and display + // the exception properties. + Display("Demanding a denied permission. \n\n"); + DemandDeniedPermission(); + Display("*******************************************" + "**************\n"); + CodeAccessPermission::RevertDeny(); + + // Demand the permission refused + // in the assembly-level attribute. + Display("Demanding a refused permission. \n\n"); + DemandRefusedPermission(); + Display("*******************************************" + "**************\n"); + + // Demand the permission implicitly refused through a + // PermitOnly attribute. Permit only the permission that + // will cause the failure and the security permissions + // necessary to display the results of the failure. + PermissionSet^ permitOnlySet = gcnew PermissionSet( + PermissionState::None); + permitOnlySet->AddPermission(gcnew KeyContainerPermission( + KeyContainerPermissionFlags::Import)); + permitOnlySet->AddPermission(gcnew SecurityPermission( + SecurityPermissionFlag::ControlEvidence | + SecurityPermissionFlag::ControlPolicy | + SecurityPermissionFlag::SerializationFormatter)); + permitOnlySet->PermitOnly(); + Display("Demanding an implicitly refused permission. \n\n"); + DemandPermitOnly(); + } + catch (SecurityException^ exception) + { + Display("*******************************************" + "**************\n"); + + // + Display("Displaying an exception using the ToString " + "method: "); + Display(exception->ToString()); + // + } + + } + + private: + void DemandDeniedPermission() + { + try + { + KeyContainerPermission^ keyContainerDecryptPermission = + gcnew KeyContainerPermission( + KeyContainerPermissionFlags::Decrypt); + keyContainerDecryptPermission->Demand(); + } + catch (SecurityException^ exception) + { + // + Display("The denied permission is: {0}", + exception->DenySetInstance); + // + + // + Display("The demanded permission is: {0}", + exception->Demanded); + // + + // + Display("The security action is: {0}", + exception->Action); + // + + // + Display("The method is: {0}", exception->Method); + // + + // + Display("The permission state at the time " + "of the exception was: {0}", + exception->PermissionState); + // + + // + Display("The permission that failed was: {0}", + exception->FirstPermissionThatFailed); + // + + // + Display("The permission type is: {0}", + exception->PermissionType); + // + + // + Display("Demonstrating the use of the GetObjectData " + "method."); + SerializationInfo^ entryPointSerializatonInfo = + gcnew SerializationInfo(TestSecurityException::typeid, + gcnew FormatterConverter); + exception->GetObjectData(entryPointSerializatonInfo, + *gcnew StreamingContext(StreamingContextStates::All)); + Display("The FirstPermissionThatFailed from the call" + " to GetObjectData is: "); + Display(entryPointSerializatonInfo->GetString( + "FirstPermissionThatFailed")); + // + } + } + + void DemandRefusedPermission() + { + try + { + KeyContainerPermission^ keyContainerImportPermission = + gcnew KeyContainerPermission( + KeyContainerPermissionFlags::Import); + keyContainerImportPermission->Demand(); + } + catch (SecurityException^ exception) + { + // + Display("The refused permission set is: {0}", + exception->RefusedSet); + // + + // + Display("The exception message is: {0}", + exception->Message); + // + + // + Display("The failed assembly is: {0}", + exception->FailedAssemblyInfo->EscapedCodeBase); + // + + // + Display("The granted set is: \n{0}", + exception->GrantedSet); + // + + Display("The permission that failed is: {0}", + exception->FirstPermissionThatFailed); + Display("The permission type is: {0}", + exception->PermissionType); + + // + Display("The source is: {0}", exception->Source); + // + } + } + + void DemandPermitOnly() + { + try + { + KeyContainerPermission^ keyContainerDecryptPermission = + gcnew KeyContainerPermission( + KeyContainerPermissionFlags::Decrypt); + keyContainerDecryptPermission->Demand(); + } + catch (SecurityException^ exception) + { + // + Display("The permitted permission is: {0}", + exception->PermitOnlySetInstance); + // + Display("The demanded permission is: {0}", + exception->Demanded); + Display("The security action is: {0}", + exception->Action); + Display("The method is: {0}", exception->Method); + Display("The permission state at the time of the " + "exception was: {0}", exception->PermissionState); + Display("The permission that failed was: {0}", + exception->FirstPermissionThatFailed); + Display("The permission type is: {0}", + exception->PermissionType); + + // + // Demonstrate the SecurityException constructor + // by throwing the exception again. + Display("Rethrowing the exception thrown as a " + "result of a PermitOnly security action."); + throw gcnew SecurityException(exception->Message, + exception->DenySetInstance, + exception->PermitOnlySetInstance, + exception->Method, exception->Demanded, + exception->FirstPermissionThatFailed); + // + } + } + + void Display(String^ line) + { + Console::WriteLine(line); + } + + void Display(String^ format, Object^ arg) + { + Console::WriteLine(format, arg); + } + }; +} + +using namespace SecurityExceptionSample; + +int main() +{ + TestSecurityException^ test = gcnew TestSecurityException; + test->MakeTest(); + Console::WriteLine("Press the enter key to exit."); + Console::Read(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp new file mode 100644 index 00000000000..93d345d1108 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Security.policy.policylevel/CPP/policylevel.cpp @@ -0,0 +1,272 @@ + +// +// This sample demonstrates how to set code access permissions programmatically. It creates a +// new parent and child code group pair, and allows the user to optionally delete the child group +// and/or the parent code group. It also shows the result of a ResolvePolicy call, and displays +// the permissions for the three security levels; Enterprise, Machine, and User. +using namespace System; +using namespace System::Collections; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Security::Permissions; +using namespace System::Reflection; +using namespace System::Globalization; + +array^ GetKey(); +void ListPermissionSets( PolicyLevel^ pLevel ); +bool ComparePolicyLevels( PolicyLevel^ pLevel1, PolicyLevel^ pLevel2 ); +void CreateAPolicyLevel(); +void CheckEvidence( PolicyLevel^ pLevel, Evidence^ evidence ); +void CheckEvidence( Evidence^ evidence ); +void ListMachinePermissionSets(); + +int main() +{ + Console::WriteLine( "*************************************************************************************" ); + Console::WriteLine( "Create an AppDomain policy level." ); + Console::WriteLine( "Use the AppDomain to demonstrate PolicyLevel methods and properties." ); + Console::WriteLine( "*************************************************************************************" ); + CreateAPolicyLevel(); + array^temp0 = {gcnew Zone( SecurityZone::Intranet )}; + Evidence^ intranetZoneEvidence = gcnew Evidence( temp0,nullptr ); + Console::WriteLine( "*************************************************************************************" ); + Console::WriteLine( "Show the result of ResolvePolicy on this computer for LocalIntranet zone evidence." ); + Console::WriteLine( "*************************************************************************************" ); + CheckEvidence( intranetZoneEvidence ); + Console::WriteLine( "*************************************************************************************" ); + Console::WriteLine( "Enumerate the permission sets for Machine policy level." ); + Console::WriteLine( "*************************************************************************************" ); + ListMachinePermissionSets(); + Console::Out->WriteLine( "Press the Enter key to exit." ); + Console::ReadLine(); +} + +void CreateAPolicyLevel() +{ + try + { + // + // Create an AppDomain policy level. + PolicyLevel^ pLevel = PolicyLevel::CreateAppDomainLevel(); + // + + // The root code group of the policy level combines all + // permissions of its children. + UnionCodeGroup^ rootCodeGroup; + PermissionSet^ ps = gcnew PermissionSet( PermissionState::None ); + ps->AddPermission( gcnew SecurityPermission( SecurityPermissionFlag::Execution ) ); + rootCodeGroup = gcnew UnionCodeGroup( gcnew AllMembershipCondition,gcnew PolicyStatement( ps,PolicyStatementAttribute::Nothing ) ); + + // This code group grants FullTrust to assemblies with the strong + // name key from this assembly. + UnionCodeGroup^ myCodeGroup = gcnew UnionCodeGroup( gcnew StrongNameMembershipCondition( gcnew StrongNamePublicKeyBlob( GetKey() ),nullptr,nullptr ),gcnew PolicyStatement( gcnew PermissionSet( PermissionState::Unrestricted ),PolicyStatementAttribute::Nothing ) ); + myCodeGroup->Name = "My CodeGroup"; + + + // + // Add the code groups to the policy level. + rootCodeGroup->AddChild( myCodeGroup ); + pLevel->RootCodeGroup = rootCodeGroup; + Console::WriteLine( "Permissions granted to all code running in this AppDomain level: " ); + Console::WriteLine( rootCodeGroup->ToXml() ); + Console::WriteLine( "Child code groups in RootCodeGroup:" ); + IList^ codeGroups = pLevel->RootCodeGroup->Children; + IEnumerator^ codeGroup = codeGroups->GetEnumerator(); + while ( codeGroup->MoveNext() ) + { + Console::WriteLine( "\t{0}", (dynamic_cast(codeGroup->Current))->Name ); + } + // + + // + Console::WriteLine( "Demonstrate adding and removing named permission sets." ); + Console::WriteLine( "Original named permission sets:" ); + ListPermissionSets( pLevel ); + NamedPermissionSet^ myInternet = pLevel->GetNamedPermissionSet( "Internet" ); + // + + myInternet->Name = "MyInternet"; + + // + pLevel->AddNamedPermissionSet( myInternet ); + // + + Console::WriteLine( "\nNew named permission sets:" ); + ListPermissionSets( pLevel ); + myInternet->RemovePermission( System::Security::Permissions::FileDialogPermission::typeid ); + + // + pLevel->ChangeNamedPermissionSet( "MyInternet", myInternet ); + // + + // + pLevel->RemoveNamedPermissionSet( "MyInternet" ); + // + + Console::WriteLine( "\nCurrent permission sets:" ); + ListPermissionSets( pLevel ); + pLevel->AddNamedPermissionSet( myInternet ); + Console::WriteLine( "\nUpdated named permission sets:" ); + ListPermissionSets( pLevel ); + + // + pLevel->Reset(); + // + + Console::WriteLine( "\nReset named permission sets:" ); + ListPermissionSets( pLevel ); + + // + Console::WriteLine( "\nType property = {0}", pLevel->Type ); + // + + // + Console::WriteLine( "The result of GetHashCode is {0}", pLevel->GetHashCode() ); + // + + Console::WriteLine( "StoreLocation property for the AppDomain level is empty, since AppDomain policy " + "cannot be saved to a file." ); + Console::WriteLine( "StoreLocation property = {0}", pLevel->StoreLocation ); + + // + PolicyLevel^ pLevelCopy = PolicyLevel::CreateAppDomainLevel(); + // + + // Create a copy of the PolicyLevel using ToXml/FromXml. + pLevelCopy->FromXml( pLevel->ToXml() ); + if ( ComparePolicyLevels( pLevel, pLevelCopy ) ) + { + Console::WriteLine( "The ToXml/FromXml roundtrip was successful." ); + } + else + { + Console::WriteLine( "ToXml/FromXml roundtrip failed." ); + } + Console::WriteLine( "Show the result of resolving policy for evidence unique to the AppDomain policy level." ); + array^temp1 = {myCodeGroup}; + Evidence^ myEvidence = gcnew Evidence( temp1,nullptr ); + CheckEvidence( pLevel, myEvidence ); + return; + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + return; + } +} + + +// Compare two PolicyLevels using ToXml and FromXml. +bool ComparePolicyLevels( PolicyLevel^ pLevel1, PolicyLevel^ pLevel2 ) +{ + bool retVal = false; + PolicyLevel^ firstCopy = PolicyLevel::CreateAppDomainLevel(); + PolicyLevel^ secondCopy = PolicyLevel::CreateAppDomainLevel(); + + // Create copies of the two PolicyLevels passed in. + // Convert the two PolicyLevels to their canonical form using ToXml and FromXml. + firstCopy->FromXml( pLevel1->ToXml() ); + secondCopy->FromXml( pLevel2->ToXml() ); + if ( firstCopy->ToXml()->ToString()->CompareTo( secondCopy->ToXml()->ToString() ) == 0 ) + retVal = true; + + return retVal; +} + + +// +// Demonstrate the use of ResolvePolicy for the supplied evidence and a specified policy level. +void CheckEvidence( PolicyLevel^ pLevel, Evidence^ evidence ) +{ + // Display the code groups to which the evidence belongs. + Console::WriteLine( "\tResolvePolicy for the given evidence: " ); + IEnumerator^ codeGroup = evidence->GetEnumerator(); + while ( codeGroup->MoveNext() ) + { + Console::WriteLine( "\t\t{0}", (dynamic_cast(codeGroup->Current))->Name ); + } + + Console::WriteLine( "The current evidence belongs to the following root CodeGroup:" ); + + // pLevel is the current PolicyLevel, evidence is the Evidence to be resolved. + CodeGroup^ cg1 = pLevel->ResolveMatchingCodeGroups( evidence ); + Console::WriteLine( "{0} Level", pLevel->Label ); + Console::WriteLine( "\tRoot CodeGroup = {0}", cg1->Name ); + + // Show how Resolve is used to determine the set of permissions that + // the security system grants to code, based on the evidence. + // Show the granted permissions. + Console::WriteLine( "\nCurrent permissions granted:" ); + PolicyStatement^ pState = pLevel->Resolve( evidence ); + Console::WriteLine( pState->ToXml() ); + return; +} +// + +// +void ListPermissionSets( PolicyLevel^ pLevel ) +{ + IList^ namedPermissions = pLevel->NamedPermissionSets; + IEnumerator^ namedPermission = namedPermissions->GetEnumerator(); + while ( namedPermission->MoveNext() ) + { + Console::WriteLine( "\t{0}", (dynamic_cast(namedPermission->Current))->Name ); + } +} +// + +array^ GetKey() +{ + return Assembly::GetCallingAssembly()->GetName()->GetPublicKey(); +} + +// +// Demonstrate the use of ResolvePolicy for passed in evidence. +void CheckEvidence( Evidence^ evidence ) +{ + // Display the code groups to which the evidence belongs. + Console::WriteLine( "ResolvePolicy for the given evidence." ); + Console::WriteLine( "\tCurrent evidence belongs to the following code groups:" ); + IEnumerator^ policyEnumerator = SecurityManager::PolicyHierarchy(); + + // Resolve the evidence at all the policy levels. + while ( policyEnumerator->MoveNext() ) + { + PolicyLevel^ currentLevel = dynamic_cast(policyEnumerator->Current); + CodeGroup^ cg1 = currentLevel->ResolveMatchingCodeGroups( evidence ); + Console::WriteLine( "\n\t{0} Level", currentLevel->Label ); + Console::WriteLine( "\t\tCodeGroup = {0}", cg1->Name ); + IEnumerator^ cgE1 = cg1->Children->GetEnumerator(); + while ( cgE1->MoveNext() ) + { + Console::WriteLine( "\t\t\tGroup = {0}", (dynamic_cast(cgE1->Current))->Name ); + } + + Console::WriteLine( "\tStoreLocation = {0}", currentLevel->StoreLocation ); + } + + return; +} +// + +// +void ListMachinePermissionSets() +{ + Console::WriteLine( "\nPermission sets in Machine policy level:" ); + IEnumerator^ policyEnumerator = SecurityManager::PolicyHierarchy(); + while ( policyEnumerator->MoveNext() ) + { + PolicyLevel^ currentLevel = dynamic_cast(policyEnumerator->Current); + if ( currentLevel->Label->Equals( "Machine" ) ) + { + IList^ namedPermissions = currentLevel->NamedPermissionSets; + IEnumerator^ namedPermission = namedPermissions->GetEnumerator(); + while ( namedPermission->MoveNext() ) + { + Console::WriteLine( "\t{0}", (dynamic_cast(namedPermission->Current))->Name ); + } + } + } +} +// +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp new file mode 100644 index 00000000000..b32ab193862 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Single/CPP/singlesample.cpp @@ -0,0 +1,163 @@ +using namespace System; + +class SingleSample +{ +public: + SingleSample() + { + + // + Single s = 4.55F; + // + + // + Console::WriteLine( "A Single is of type {0}.", s.GetType() ); + // + + // + bool done = false; + String^ inp; + do + { + Console::Write( "Enter a real number: " ); + inp = Console::ReadLine(); + try + { + s = Single::Parse( inp ); + Console::WriteLine( "You entered {0}.", s ); + done = true; + } + catch ( FormatException^ ) + { + Console::WriteLine( "You did not enter a number." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "An exception occurred while parsing your response: {0}", e ); + } + } + while ( !done ); + // + + // + if ( s > Single::MaxValue ) + { + Console::WriteLine( "Your number is larger than a Single." ); + } + // + + // + if ( s < Single::MinValue ) + { + Console::WriteLine( "Your number is smaller than a Single." ); + } + // + + // + Console::WriteLine( "Epsilon, or the permittivity of a vacuum, has value {0}", Single::Epsilon ); + // + + // + Single zero = 0; + + // This condition will return false. + if ( (0 / zero) == Single::NaN ) + { + Console::WriteLine( "0 / 0 can be tested with Single::NaN." ); + } + else + { + Console::WriteLine( "0 / 0 cannot be tested with Single::NaN; use Single::IsNan() instead." ); + } + // + + // + // This will return true. + if ( Single::IsNaN( 0 / zero ) ) + { + Console::WriteLine( "Single::IsNan() can determine whether a value is not-a-number." ); + } + // + + // + // This will equal Infinity. + Console::WriteLine( "10.0 minus NegativeInfinity equals {0}.", (10.0 - Single::NegativeInfinity) ); + // + + // + // This will equal Infinity. + Console::WriteLine( "PositiveInfinity plus 10.0 equals {0}.", (Single::PositiveInfinity + 10.0) ); + // + + // + // This will return S"true". + Console::WriteLine( "IsInfinity(3.0F / 0) == {0}.", Single::IsInfinity( 3.0F / zero ) ? (String^)"true" : "false" ); + // + + // + // This will return true. + Console::WriteLine( "IsPositiveInfinity(4.0F / 0) == {0}.", Single::IsPositiveInfinity( 4.0F / zero ) ? (String^)"true" : "false" ); + // + + // + // This will return true. + Console::WriteLine( "IsNegativeInfinity(-5.0F / 0) == {0}.", Single::IsNegativeInfinity( -5.0F / zero ) ? (String^)"true" : "false" ); + // + + // + Single a; + a = 500; + + Object^ obj1; + // + + // + // The variables point to the same objects. + Object^ obj2; + obj1 = a; + obj2 = obj1; + + if ( Single::ReferenceEquals( obj1, obj2 ) ) + { + Console::WriteLine( "The variables point to the same Single object." ); + } + else + { + Console::WriteLine( "The variables point to different Single objects." ); + } + // + + // + obj1 = (Single)450; + + if ( a.CompareTo( obj1 ) < 0 ) + { + Console::WriteLine( " {0} is less than {1}.", a, obj1 ); + } + + if ( a.CompareTo( obj1 ) > 0 ) + { + Console::WriteLine( " {0} is greater than {1}.", a, obj1 ); + } + + if ( a.CompareTo( obj1 ) == 0 ) + { + Console::WriteLine( " {0} equals {1}.", a, obj1 ); + } + // + + // + obj1 = (Single)500; + + if ( a.Equals( obj1 ) ) + { + Console::WriteLine( "The value type and reference type values are equal." ); + } + // + } +}; + +int main() +{ + new SingleSample; +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp new file mode 100644 index 00000000000..851ef4dcfad --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Class/cpp/system.string.class.cpp @@ -0,0 +1,10 @@ +// +using namespace System; +using namespace System::Text; + +void main() +{ + String^ characters = "abc" + L'0' + "def"; + Console::WriteLine(characters->Length); // Displays 7 +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp new file mode 100644 index 00000000000..9da4bfb57cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/compare02.cpp @@ -0,0 +1,30 @@ +// +using namespace System; + +void main() +{ + // Create upper-case characters from their Unicode code units. + String^ stringUpper = "\x0041\x0042\x0043"; + + // Create lower-case characters from their Unicode code units. + String^ stringLower = "\x0061\x0062\x0063"; + + // Display the strings. + Console::WriteLine("Comparing '{0}' and '{1}':", + stringUpper, stringLower); + + // Compare the uppercased strings; the result is true. + Console::WriteLine("The Strings are equal when capitalized? {0}", + String::Compare(stringUpper->ToUpper(), stringLower->ToUpper()) == 0 + ? "true" : "false"); + + // The previous method call is equivalent to this Compare method, which ignores case. + Console::WriteLine("The Strings are equal when case is ignored? {0}", + String::Compare(stringUpper, stringLower, true) == 0 + ? "true" : "false"); +} +// The example displays the following output: +// Comparing 'ABC' and 'abc': +// The Strings are equal when capitalized? true +// The Strings are equal when case is ignored? true +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp new file mode 100644 index 00000000000..ceae78e341d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/example.cpp @@ -0,0 +1,65 @@ +// +using namespace System; +using namespace System::Globalization; + +public ref class Example +{ +public: + static void Main() + { + String^ string1 = "brother"; + String^ string2 = "Brother"; + String^ relation; + int result; + + // Cultural (linguistic) comparison. + result = String::Compare(string1, string2, gcnew CultureInfo("en-US"), + CompareOptions::None); + if (result > 0) + relation = "comes after"; + else if (result == 0) + relation = "is the same as"; + else + relation = "comes before"; + + Console::WriteLine("'{0}' {1} '{2}'.", + string1, relation, string2); + + // Cultural (linguistic) case-insensitive comparison. + result = String::Compare(string1, string2, gcnew CultureInfo("en-US"), + CompareOptions::IgnoreCase); + if (result > 0) + relation = "comes after"; + else if (result == 0) + relation = "is the same as"; + else + relation = "comes before"; + + Console::WriteLine("'{0}' {1} '{2}'.", + string1, relation, string2); + + // Culture-insensitive ordinal comparison. + result = String::CompareOrdinal(string1, string2); + if (result > 0) + relation = "comes after"; + else if (result == 0) + relation = "is the same as"; + else + relation = "comes before"; + + Console::WriteLine("'{0}' {1} '{2}'.", + string1, relation, string2); + } +}; + +int main() +{ + Example::Main(); +} + + +// The example produces the following output: +// 'brother' comes before 'Brother'. +// 'brother' is the same as 'Brother'. +// 'brother' comes after 'Brother'. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp new file mode 100644 index 00000000000..403d3a1c663 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Compare/cpp/remarks.cpp @@ -0,0 +1,197 @@ +using namespace System; +using namespace System::Globalization; + +public ref class Example +{ +public: + static void Main() + { + Console::WriteLine("Hi!"); + } +}; + +int main() +{ + Example::Main(); +} + +// System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32) +public ref class CompareSample1_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +// System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32) +public ref class CompareSample1_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + +//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32,System.Boolean) +public class CompareSample2_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32,System.Boolean) +public class CompareSample2_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + + +//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32, +// System.Boolean,System.Globalization.CultureInfo) +public class CompareSample3_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.Int32,System.String,System.Int32,System.Int32, +// System.Boolean,System.Globalization.CultureInfo) +public class CompareSample3_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + +//System.String.Compare(System.String,System.Int32,System.String,System.Int32, +// System.Int32,System.StringComparison) +public class CompareSample4_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.Int32,System.String,System.Int32, +// System.Int32,System.StringComparison) +public class CompareSample4_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String) +public class CompareSample5_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String) +public class CompareSample5_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String,System.Boolean) +public class CompareSample6_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String,System.Boolean) +public class CompareSample6_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String,System.Boolean,System.Globalization.CultureInfo) +public class CompareSample7_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String,System.Boolean,System.Globalization.CultureInfo) +public class CompareSample7_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String,System.StringComparison) +public class CompareSample8_1 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, true) == 0); + } + // +}; + +//System.String.Compare(System.String,System.String,System.StringComparison) +public class CompareSample8_2 +{ + // + static bool IsFileURI(String^ path) + { + return (String::Compare(path, 0, "file:", 0, 5, StringComparison::OrdinalIgnoreCase) == 0); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp new file mode 100644 index 00000000000..3c33eb9d8a7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.CompareCmp/cpp/cmpcmp.cpp @@ -0,0 +1,140 @@ +// +// This example demonstrates the +// System.String.Compare(String, String, StringComparison) method. + +using namespace System; +using namespace System::Threading; + +void Test(int testStringIndex, int searchStringIndex, + StringComparison comparison, array^ testI, + array^ testNames) +{ + String^ resultFormat = "{0} is {1} {2}"; + String^ resultString = "equal to"; + int comparisonValue = 0; + + comparisonValue = String::Compare(testI[testStringIndex], + testI[searchStringIndex], comparison); + if (comparisonValue < 0) + { + resultString = "less than"; + } + else if (comparisonValue > 0) + { + resultString = "greater than"; + } + Console::WriteLine(resultFormat, testNames[testStringIndex], resultString, + testNames[searchStringIndex]); +} + +int main() +{ + String^ introMessage = + "Compare three versions of the letter I using different " + + "values of StringComparison."; + + // Define an array of strings where each element contains a version of + // the letter I. (An array of strings is used so you can easily modify + // this code example to test additional or different combinations of + // strings.) + + array^ letterVariation = gcnew array(3); + // LATIN SMALL LETTER I (U+0069) + letterVariation[0] = "i"; + // LATIN SMALL LETTER DOTLESS I (U+0131) + letterVariation[1] = L"\u0131"; + // LATIN CAPITAL LETTER I (U+0049) + letterVariation[2] = "I"; + + array^ unicodeNames = { + "LATIN SMALL LETTER I (U+0069)", + "LATIN SMALL LETTER DOTLESS I (U+0131)", + "LATIN CAPITAL LETTER I (U+0049)"}; + + array^ comparisonValues = { + StringComparison::CurrentCulture, + StringComparison::CurrentCultureIgnoreCase, + StringComparison::InvariantCulture, + StringComparison::InvariantCultureIgnoreCase, + StringComparison::Ordinal, + StringComparison::OrdinalIgnoreCase}; + + Console::Clear(); + Console::WriteLine(introMessage); + + // Display the current culture because the culture-specific comparisons + // can produce different results with different cultures. + Console::WriteLine("The current culture is {0}.{1}", + Thread::CurrentThread->CurrentCulture->Name, Environment::NewLine); + + // Determine the relative sort order of three versions of the letter I. + for each (StringComparison stringCmp in comparisonValues) + { + Console::WriteLine("StringComparison.{0}:", stringCmp); + + // LATIN SMALL LETTER I (U+0069) : LATIN SMALL LETTER DOTLESS I + // (U+0131) + Test(0, 1, stringCmp, letterVariation, unicodeNames); + + // LATIN SMALL LETTER I (U+0069) : LATIN CAPITAL LETTER I (U+0049) + Test(0, 2, stringCmp, letterVariation, unicodeNames); + + // LATIN SMALL LETTER DOTLESS I (U+0131) : LATIN CAPITAL LETTER I + // (U+0049) + Test(1, 2, stringCmp, letterVariation, unicodeNames); + + Console::WriteLine(); + } +} + +/* +This code example produces the following results: + +Compare three versions of the letter I using different values of +StringComparison. +The current culture is en-US. + +StringComparison.CurrentCulture: +LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER + DOTLESS I (U+0131) +LATIN SMALL LETTER I (U+0069) is less than LATIN CAPITAL LETTER I (U+0049) +LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN + CAPITAL LETTER I (U+0049) + +StringComparison.CurrentCultureIgnoreCase: +LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER + DOTLESS I (U+0131) +LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) +LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN + CAPITAL LETTER I (U+0049) + +StringComparison.InvariantCulture: +LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER + DOTLESS I (U+0131) +LATIN SMALL LETTER I (U+0069) is less than LATIN CAPITAL LETTER I (U+0049) +LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN + CAPITAL LETTER I (U+0049) + +StringComparison.InvariantCultureIgnoreCase: +LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER + DOTLESS I (U+0131) +LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) +LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN + CAPITAL LETTER I (U+0049) + +StringComparison.Ordinal: +LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER + DOTLESS I (U+0131) +LATIN SMALL LETTER I (U+0069) is greater than LATIN CAPITAL LETTER I (U+0049) +LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN + CAPITAL LETTER I (U+0049) + +StringComparison.OrdinalIgnoreCase: +LATIN SMALL LETTER I (U+0069) is less than LATIN SMALL LETTER + DOTLESS I (U+0131) +LATIN SMALL LETTER I (U+0069) is equal to LATIN CAPITAL LETTER I (U+0049) +LATIN SMALL LETTER DOTLESS I (U+0131) is greater than LATIN + CAPITAL LETTER I (U+0049) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp new file mode 100644 index 00000000000..85a57be8c79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.EndsWithCmp/cpp/ewcmp.cpp @@ -0,0 +1,83 @@ +// +// This example demonstrates the +// System.String.EndsWith(String, StringComparison) method. + +using namespace System; +using namespace System::Threading; + +void Test(String^ testString, String^ searchString, + StringComparison comparison) +{ + String^ resultFormat = "\"{0}\" {1} with \"{2}\"."; + String^ resultString = "does not end"; + + if (testString->EndsWith(searchString, comparison)) + { + resultString = "ends"; + } + Console::WriteLine(resultFormat, testString, resultString, searchString); +} + +int main() +{ + String^ introMessage = + "Determine whether a string ends with another string, " + + "using\ndifferent values of StringComparison."; + + array^ comparisonValues = { + StringComparison::CurrentCulture, + StringComparison::CurrentCultureIgnoreCase, + StringComparison::InvariantCulture, + StringComparison::InvariantCultureIgnoreCase, + StringComparison::Ordinal, + StringComparison::OrdinalIgnoreCase}; + + Console::WriteLine(introMessage); + + // Display the current culture because the culture-specific comparisons + // can produce different results with different cultures. + Console::WriteLine("The current culture is {0}.\n", + Thread::CurrentThread->CurrentCulture->Name); + // Perform two tests for each StringComparison + for each (StringComparison stringCmp in comparisonValues) + { + Console::WriteLine("StringComparison.{0}:", stringCmp); + Test("abcXYZ", "XYZ", stringCmp); + Test("abcXYZ", "xyz", stringCmp); + Console::WriteLine(); + } +} + +/* +This code example produces the following results: + +Determine whether a string ends with another string, using +different values of StringComparison. +The current culture is en-US. + +StringComparison.CurrentCulture: +"abcXYZ" ends with "XYZ". +"abcXYZ" does not end with "xyz". + +StringComparison.CurrentCultureIgnoreCase: +"abcXYZ" ends with "XYZ". +"abcXYZ" ends with "xyz". + +StringComparison.InvariantCulture: +"abcXYZ" ends with "XYZ". +"abcXYZ" does not end with "xyz". + +StringComparison.InvariantCultureIgnoreCase: +"abcXYZ" ends with "XYZ". +"abcXYZ" ends with "xyz". + +StringComparison.Ordinal: +"abcXYZ" ends with "XYZ". +"abcXYZ" does not end with "xyz". + +StringComparison.OrdinalIgnoreCase: +"abcXYZ" ends with "XYZ". +"abcXYZ" ends with "xyz". + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp new file mode 100644 index 00000000000..ecbc4947741 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Equality/CPP/equalityop.cpp @@ -0,0 +1,28 @@ + +// +// Example for the String Equality operator. +using namespace System; +void CompareAndDisplay( String^ Comparand ) +{ + String^ Lower = "abcd"; + Console::WriteLine( "\"{0}\" == \"{1}\" ? {2}", Lower, Comparand, Lower == Comparand ); +} + +int main() +{ + Console::WriteLine( "This example of the String Equality operator\n" + "generates the following output.\n" ); + CompareAndDisplay( "ijkl" ); + CompareAndDisplay( "ABCD" ); + CompareAndDisplay( "abcd" ); +} + +/* +This example of the String Equality operator +generates the following output. + +"abcd" == "ijkl" ? False +"abcd" == "ABCD" ? False +"abcd" == "abcd" ? True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp new file mode 100644 index 00000000000..546e49f2c89 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format4.cpp @@ -0,0 +1,24 @@ +// Format4.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +void main() +{ + String^ formatString = " {0,10} ({0,8:X8})\n" + + "And {1,10} ({1,8:X8})\n" + + " = {2,10} ({2,8:X8})"; + int value1 = 16932; + int value2 = 15421; + String^ result = String::Format(formatString, + value1, value2, value1 & value2); + Console::WriteLine(result); +} +// The example displays the following output: +// 16932 (00004224) +// And 15421 (00003C3D) +// = 36 (00000024) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp new file mode 100644 index 00000000000..8415cc4c1df --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format5.cpp @@ -0,0 +1,33 @@ +// Format5.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +void main() +{ + DateTime date1 = DateTime(2009, 7, 1); + TimeSpan hiTime = TimeSpan(14, 17, 32); + Decimal hiTemp = (Decimal) 62.1; + TimeSpan loTime = TimeSpan(3, 16, 10); + Decimal loTemp = (Decimal)54.8; + + String^ result1 = String::Format("Temperature on {0:d}:\n{1,11}: {2} degrees (hi)\n{3,11}: {4} degrees (lo)", + date1, hiTime, hiTemp, loTime, loTemp); + Console::WriteLine(result1); + Console::WriteLine(); + + String^ result2 = String::Format("Temperature on {0:d}:\n{1,11}: {2} degrees (hi)\n{3,11}: {4} degrees (lo)", + gcnew array { date1, hiTime, hiTemp, loTime, loTemp }); + Console::WriteLine(result2); +} +// The example displays the following output: +// Temperature on 7/1/2009: +// 14:17:32: 62.1 degrees (hi) +// 03:16:10: 54.8 degrees (lo) +// Temperature on 7/1/2009: +// 14:17:32: 62.1 degrees (hi) +// 03:16:10: 54.8 degrees (lo) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp new file mode 100644 index 00000000000..166e0c1c832 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format7.cpp @@ -0,0 +1,41 @@ +// Format7.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +void main() +{ + DateTime birthdate = DateTime(1993, 7, 28); + array^ dates = gcnew array { DateTime(1993, 8, 16), + DateTime(1994, 7, 28), + DateTime(2000, 10, 16), + DateTime(2003, 7, 27), + DateTime(2007, 5, 27) }; + + for each (DateTime dateValue in dates) + { + TimeSpan interval = dateValue - birthdate; + // Get the approximate number of years, without accounting for leap years. + int years = ((int)interval.TotalDays) / 365; + // See if adding the number of years exceeds dateValue. + String^ output; + if (birthdate.AddYears(years) <= dateValue) { + output = String::Format("You are now {0} years old.", years); + Console::WriteLine(output); + } + else { + output = String::Format("You are now {0} years old.", years - 1); + Console::WriteLine(output); + } + } +} +// The example displays the following output: +// You are now 0 years old. +// You are now 1 years old. +// You are now 7 years old. +// You are now 9 years old. +// You are now 13 years old. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp new file mode 100644 index 00000000000..30af678140b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/format_paramarray1.cpp @@ -0,0 +1,48 @@ +// Format_ParamArray1.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +ref class CityInfo +{ +public: + CityInfo(String^ name, int population, Decimal area, int year) + { + this->Name = name; + this->Population = population; + this->Area = area; + this->Year = year; + } + + String^ Name; + int Population; + Decimal Area; + int Year; +}; + +ref class Example +{ +public: + static void ShowPopulationData(CityInfo^ city) + { + array^ args = gcnew array { city->Name, city->Year, city->Population, city->Area }; + String^ result = String::Format("{0} in {1}: Population {2:N0}, Area {3:N1} sq. feet", + args); + Console::WriteLine(result); + } +}; + +void main() +{ + CityInfo^ nyc2010 = gcnew CityInfo("New York", 8175133, (Decimal) 302.64, 2010); + Example::ShowPopulationData(nyc2010); + CityInfo^ sea2010 = gcnew CityInfo("Seattle", 608660, (Decimal) 83.94, 2010); + Example::ShowPopulationData(sea2010); +} +// The example displays the following output: +// New York in 2010: Population 8,175,133, Area 302.6 sq. feet +// Seattle in 2010: Population 608,660, Area 83.9 sq. feet +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp new file mode 100644 index 00000000000..1acc61d5d34 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample2.cpp @@ -0,0 +1,77 @@ +// FormatExample2.cpp : Defines the entry point for the console application. +// + +// #include "stdafx.h" + +// +using namespace System; + +ref class CustomerFormatter : IFormatProvider, ICustomFormatter +{ +public: + virtual Object^ GetFormat(Type^ formatType) + { + if (formatType == ICustomFormatter::typeid) + return this; + else + return nullptr; + } + + virtual String^ Format(String^ format, + Object^ arg, + IFormatProvider^ formatProvider) + { + if (!this->Equals(formatProvider)) + { + return nullptr; + } + else + { + if (String::IsNullOrEmpty(format)) + format = "G"; + + String^ customerString = arg->ToString(); + if (customerString->Length < 8) + customerString = customerString->PadLeft(8, '0'); + + format = format->ToUpper(); + if (format == L"G") + return customerString->Substring(0, 1) + "-" + + customerString->Substring(1, 5) + "-" + + customerString->Substring(6); + else if (format == L"S") + return customerString->Substring(0, 1) + "/" + + customerString->Substring(1, 5) + "/" + + customerString->Substring(6); + else if (format == L"P") + return customerString->Substring(0, 1) + "." + + customerString->Substring(1, 5) + "." + + customerString->Substring(6); + else + throw gcnew FormatException( + String::Format("The '{0}' format specifier is not supported.", format)); + } + } +}; + +void main() +{ + int acctNumber = 79203159; + Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0}", acctNumber)); + Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:G}", acctNumber)); + Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:S}", acctNumber)); + Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:P}", acctNumber)); + try { + Console::WriteLine(String::Format(gcnew CustomerFormatter, "{0:X}", acctNumber)); + } + catch (FormatException^ e) { + Console::WriteLine(e->Message); + } +} +// The example displays the following output: +// 7-92031-59 +// 7-92031-59 +// 7/92031/59 +// 7.92031.59 +// The 'X' format specifier is not supported. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp new file mode 100644 index 00000000000..a0a958f9dc8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatexample4.cpp @@ -0,0 +1,32 @@ +// FormatExample4.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + + +// +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ + Dictionary^ temperatureInfo = gcnew Dictionary(); + temperatureInfo->Add(DateTime(2010, 6, 1, 14, 0, 0), 87.46); + temperatureInfo->Add(DateTime(2010, 12, 1, 10, 0, 0), 36.81); + + Console::WriteLine("Temperature Information:\n"); + String^ output; + for each (KeyValuePair^ item in temperatureInfo) + { + output = String::Format("Temperature at {0,8:t} on {0,9:d}: {1,5:N1}°F", + item->Key, item->Value); + Console::WriteLine(output); + } +} +// The example displays the following output: +// Temperature Information: +// +// Temperature at 2:00 PM on 6/1/2010: 87.5°F +// Temperature at 10:00 AM on 12/1/2010: 36.8°F +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp new file mode 100644 index 00000000000..34c12932dfc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload1.cpp @@ -0,0 +1,20 @@ +// FormatOverload1.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +void main() +{ + DateTime^ dat = gcnew DateTime(2012, 1, 17, 9, 30, 0); + String^ city = "Chicago"; + int temp = -16; + String^ output = String::Format("At {0} in {1}, the temperature was {2} degrees.", + dat, city, temp); + Console::WriteLine(output); +} +// The example displays the following output: +// At 1/17/2012 9:30:00 AM in Chicago, the temperature was -16 degrees. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp new file mode 100644 index 00000000000..6ac7fe64f84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatoverload2.cpp @@ -0,0 +1,41 @@ +// FormatOverload2.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +void main() +{ + // Create array of 5-tuples with population data for three U.S. cities, 1940-1950. + array^>^ cities = gcnew array^> + { gcnew Tuple("Los Angeles", DateTime(1940, 1, 1), 1504277, + DateTime(1950, 1, 1), 1970358), + gcnew Tuple("New York", DateTime(1940, 1, 1), 7454995, + DateTime(1950, 1, 1), 7891957), + gcnew Tuple("Chicago", DateTime(1940, 1, 1), 3396808, + DateTime(1950, 1, 1), 3620962), + gcnew Tuple("Detroit", DateTime(1940, 1, 1), 1623452, + DateTime(1950, 1, 1), 1849568) }; + + // Display header + String^ header = String::Format("{0,-12}{1,8}{2,12}{1,8}{2,12}{3,14}\n", + "City", "Year", "Population", "Change (%)"); + Console::WriteLine(header); + String^ output; + for each (Tuple^ city in cities) { + output = String::Format("{0,-12}{1,8:yyyy}{2,12:N0}{3,8:yyyy}{4,12:N0}{5,14:P1}", + city->Item1, city->Item2, city->Item3, city->Item4, city->Item5, + (city->Item5 - city->Item3)/ (double)city->Item3); + Console::WriteLine(output); + } +} +// The example displays the following output: +// City Year Population Year Population Change (%) +// +// Los Angeles 1940 1,504,277 1950 1,970,358 31.0 % +// New York 1940 7,454,995 1950 7,891,957 5.9 % +// Chicago 1940 3,396,808 1950 3,620,962 6.6 % +// Detroit 1940 1,623,452 1950 1,849,568 13.9 % +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp new file mode 100644 index 00000000000..c0e1e10820b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/formatsyntax1.cpp @@ -0,0 +1,16 @@ +// FormatSyntax1.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +using namespace System; + +void main() +{ + String^ value = +// +String::Format("{0,-10:C}", (Decimal) 126347.89); +// +} + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp new file mode 100644 index 00000000000..a5be70b67be --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/interceptor2.cpp @@ -0,0 +1,122 @@ +// Interceptor2.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; +using namespace System::Globalization; + +ref class InterceptProvider : IFormatProvider, ICustomFormatter +{ +public: + virtual Object^ GetFormat(Type^ formatType) + { + if (formatType == ICustomFormatter::typeid) + return this; + else + return nullptr; + } + + virtual String^ Format(String^ format, Object^ obj, IFormatProvider^ provider) + { + // Display information about method call. + String^ formatString = format != nullptr ? format : ""; + Console::WriteLine("Provider: {0}, Object: {1}, Format String: {2}", + provider, obj != nullptr ? obj : "", formatString); + + if (obj == nullptr) return String::Empty; + + // If this is a byte and the "R" format string, format it with Roman numerals. + if (obj->GetType() == Byte::typeid && formatString->ToUpper()->Equals("R")) { + Byte value = (Byte) obj; + int remainder; + int result; + String^ returnString = String::Empty; + + // Get the hundreds digit(s) + result = Math::DivRem(value, 100, remainder); + if (result > 0) + returnString = gcnew String('C', result); + value = (Byte) remainder; + // Get the 50s digit + result = Math::DivRem(value, 50, remainder); + if (result == 1) + returnString += "L"; + value = (Byte) remainder; + // Get the tens digit. + result = Math::DivRem(value, 10, remainder); + if (result > 0) + returnString += gcnew String('X', result); + value = (Byte) remainder; + // Get the fives digit. + result = Math::DivRem(value, 5, remainder); + if (result > 0) + returnString += "V"; + value = (Byte) remainder; + // Add the ones digit. + if (remainder > 0) + returnString += gcnew String('I', remainder); + + // Check whether we have too many X characters. + int pos = returnString->IndexOf("XXXX"); + if (pos >= 0) { + int xPos = returnString->IndexOf("L"); + if ((xPos >= 0) & (xPos == pos - 1)) + returnString = returnString->Replace("LXXXX", "XC"); + else + returnString = returnString->Replace("XXXX", "XL"); + } + // Check whether we have too many I characters + pos = returnString->IndexOf("IIII"); + if (pos >= 0) + if (returnString->IndexOf("V") >= 0) + returnString = returnString->Replace("VIIII", "IX"); + else + returnString = returnString->Replace("IIII", "IV"); + + return returnString; + } + + // Use default for all other formatting. + if (obj->GetType() == IFormattable::typeid) + return ((IFormattable^) obj)->ToString(format, CultureInfo::CurrentCulture); + else + return obj->ToString(); + } +}; + +void main() +{ + int n = 10; + double value = 16.935; + DateTime day = DateTime::Now; + InterceptProvider^ provider = gcnew InterceptProvider(); + Console::WriteLine(String::Format(provider, "{0:N0}: {1:C2} on {2:d}\n", n, value, day)); + Console::WriteLine(String::Format(provider, "{0}: {1:F}\n", "Today: ", + (DayOfWeek) DateTime::Now.DayOfWeek)); + Console::WriteLine(String::Format(provider, "{0:X}, {1}, {2}\n", + (Byte) 2, (Byte) 12, (Byte) 199)); + Console::WriteLine(String::Format(provider, "{0:R}, {1:R}, {2:R}\n", + (Byte) 2, (Byte) 12, (Byte) 199)); +} +// The example displays the following output: +// Provider: InterceptProvider, Object: 10, Format String: N0 +// Provider: InterceptProvider, Object: 16.935, Format String: C2 +// Provider: InterceptProvider, Object: 1/31/2013 6:10:28 PM, Format String: d +// 10: $16.94 on 1/31/2013 +// +// Provider: InterceptProvider, Object: Today: , Format String: +// Provider: InterceptProvider, Object: Thursday, Format String: F +// Today: : Thursday +// +// Provider: InterceptProvider, Object: 2, Format String: X +// Provider: InterceptProvider, Object: 12, Format String: +// Provider: InterceptProvider, Object: 199, Format String: +// 2, 12, 199 +// +// Provider: InterceptProvider, Object: 2, Format String: R +// Provider: InterceptProvider, Object: 12, Format String: R +// Provider: InterceptProvider, Object: 199, Format String: R +// II, XII, CXCIX +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp new file mode 100644 index 00000000000..d74de7f473c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting1.cpp @@ -0,0 +1,80 @@ +using namespace System; +using namespace System::Text; + +ref class Example +{ + public: + static void Snippet31() + { + // + String^ s = String::Format("At {0}, the temperature is {1}°C.", + DateTime::Now, 20.4); + // Output similar to: 'At 4/10/2015 9:29:41 AM, the temperature is 20.4°C.' + // + Console::WriteLine(s); + } + + static void Snippet32() + { + // + String^ s = String::Format("It is now {0:d} at {0:t}", + DateTime::Now); + // Output similar to: 'It is now 4/10/2015 at 10:04 AM' + // + Console::WriteLine(s); + } + + static void Snippet33() + { + // + array^ years = { 2013, 2014, 2015 }; + array^ population = { 1025632, 1105967, 1148203 }; + StringBuiler^ sb = gcnew StringBuilder(); + sb->Append(String::Format("{0,6} {1,15}\n\n", "Year", "Population")); + for(int index = 0; index < years->Length; index++) + sb->AppendFormat("{0,6} {1,15:N0}\n", + years[index], population[index]); + // Result: + // Year Population + // + // 2013 1,025,632 + // 2014 1,105,967 + // 2015 1,148,203 + // + Console::WriteLine(sb); + } + + static void Snippet34() + { + // + array^ years = { 2013, 2014, 2015 }; + array^ population = { 1025632, 1105967, 1148203 }; + String^ s = String::Format("{0,-10} {1,-10}\n\n", "Year", "Population"); + for(int index = 0; index < years->Length; index++) + s += String::Format("{0,-10} {1,-10:N0}\n", + years[index], population[index]); + // Result: + // Year Population + // + // 2013 1,025,632 + // 2014 1,105,967 + // 2015 1,148,203 + // + Console::WriteLine("\n{0}", s); + } +}; + +void main() +{ + // + Decimal temp = (Decimal)20.4; + String^ s = String::Format("The temperature is {0}°C.", temp); + Console::WriteLine(s); + // Displays 'The temperature is 20.4°C.' + // + + Example::Snippet31(); + Example::Snippet32(); + Example::Snippet33(); + Example::Snippet34(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp new file mode 100644 index 00000000000..068c5e9cd1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Format/cpp/starting2.cpp @@ -0,0 +1,37 @@ +using namespace System; + +ref class Example +{ + public: + + void Main() + { + // + Decimal pricePerOunce = (Decimal)17.36; + String^ s = String::Format("The current price is {0} per ounce.", + pricePerOunce); + // Result: The current price is 17.36 per ounce. + // + Console::WriteLine(s); + ShowFormatted(); + } + + void ShowFormatted() + { + // + Decimal pricePerOunce = (Decimal)17.36; + String^ s = String::Format("The current price is {0:C2} per ounce.", + pricePerOunce); + // Result if current culture is en-US: + // The current price is $17.36 per ounce. + // + Console::WriteLine(s); + } +}; + + +void main() +{ + Example^ ex = gcnew Example(); + ex->Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp new file mode 100644 index 00000000000..cf52d962e88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetEnumerator/CPP/getenumerator.cpp @@ -0,0 +1,69 @@ +// +using namespace System; + +void EnumerateAndDisplay(String^ phrase) +{ + Console::WriteLine("The characters in the string \"{0}\" are:", + phrase); + + int CharCount = 0; + int controlChars = 0; + int alphanumeric = 0; + int punctuation = 0; + + for each (Char ch in phrase) { + Console::Write("'{0}' ", (! Char::IsControl(ch)) ? ch.ToString() : + "0x" + Convert::ToUInt16(ch).ToString("X4")); + if (Char::IsLetterOrDigit(ch)) + alphanumeric++; + else if (Char::IsControl(ch)) + controlChars++; + else if (Char::IsPunctuation(ch)) + punctuation++; + CharCount++; + } + + Console::WriteLine("\n Total characters: {0,3}", CharCount); + Console::WriteLine(" Alphanumeric characters: {0,3}", alphanumeric); + Console::WriteLine(" Punctuation characters: {0,3}", punctuation); + Console::WriteLine(" Control Characters: {0,3}\n", controlChars); +} + +int main() +{ + EnumerateAndDisplay("Test Case"); + EnumerateAndDisplay("This is a sentence."); + EnumerateAndDisplay("Has\ttwo\ttabs"); + EnumerateAndDisplay("Two\nnew\nlines"); +} +// The example displays the following output: +// The characters in the string "Test Case" are: +// 'T' 'e' 's' 't' ' ' 'C' 'a' 's' 'e' +// Total characters: 9 +// Alphanumeric characters: 8 +// Punctuation characters: 0 +// Control Characters: 0 +// +// The characters in the string "This is a sentence." are: +// 'T' 'h' 'i' 's' ' ' 'i' 's' ' ' 'a' ' ' 's' 'e' 'n' 't' 'e' 'n' 'c' 'e' '.' +// Total characters: 19 +// Alphanumeric characters: 15 +// Punctuation characters: 1 +// Control Characters: 0 +// +// The characters in the string "Has two tabs" are: +// 'H' 'a' 's' '0x0009' 't' 'w' 'o' '0x0009' 't' 'a' 'b' 's' +// Total characters: 12 +// Alphanumeric characters: 10 +// Punctuation characters: 0 +// Control Characters: 2 +// +// The characters in the string "Two +// new +// lines" are: +// 'T' 'w' 'o' '0x000A' 'n' 'e' 'w' '0x000A' 'l' 'i' 'n' 'e' 's' +// Total characters: 13 +// Alphanumeric characters: 11 +// Punctuation characters: 0 +// Control Characters: 2 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp new file mode 100644 index 00000000000..d0860d3d34b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.GetHashCode/CPP/gethashcode.cpp @@ -0,0 +1,43 @@ +// +using namespace System; + +void DisplayHashCode( String^ Operand ) +{ + int HashCode = Operand->GetHashCode(); + Console::WriteLine( "The hash code for \"{0}\" is: 0x{1:X8}, {1}", Operand, HashCode ); +} + +int main() +{ + DisplayHashCode( "" ); + DisplayHashCode( "a" ); + DisplayHashCode( "ab" ); + DisplayHashCode( "abc" ); + DisplayHashCode( "abd" ); + DisplayHashCode( "abe" ); + DisplayHashCode( "abcdef" ); + DisplayHashCode( "abcdeg" ); + DisplayHashCode( "abcdeh" ); + DisplayHashCode( "abcdei" ); + DisplayHashCode( "Abcdeg" ); + DisplayHashCode( "Abcdeh" ); + DisplayHashCode( "Abcdei" ); +} + +/* +This example displays output like the following: + The hash code for "" is: 0x2D2816FE, 757602046 + The hash code for "a" is: 0xCDCAB7BF, -842352705 + The hash code for "ab" is: 0xCDE8B7BF, -840386625 + The hash code for "abc" is: 0x2001D81A, 536991770 + The hash code for "abd" is: 0xC2A94CB5, -1029092171 + The hash code for "abe" is: 0x6550C150, 1699791184 + The hash code for "abcdef" is: 0x1762906D, 392335469 + The hash code for "abcdeg" is: 0x1763906D, 392401005 + The hash code for "abcdeh" is: 0x175C906D, 391942253 + The hash code for "abcdei" is: 0x175D906D, 392007789 + The hash code for "Abcdeg" is: 0x1763954D, 392402253 + The hash code for "Abcdeh" is: 0x175C954D, 391943501 + The hash code for "Abcdei" is: 0x175D954D, 392009037 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp new file mode 100644 index 00000000000..129189e1c03 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexof_c.cpp @@ -0,0 +1,33 @@ +// +using namespace System; + +void main() +{ + // Create a Unicode String with 5 Greek Alpha characters. + String^ szGreekAlpha = gcnew String(L'\x0391',5); + + // Create a Unicode String with a 3 Greek Omega characters. + String^ szGreekOmega = L"\x03A9\x03A9\x03A9"; + + String^ szGreekLetters = String::Concat(szGreekOmega, szGreekAlpha, + szGreekOmega->Clone()); + + // Display the entire string. + Console::WriteLine(szGreekLetters); + + // The first index of Alpha. + int ialpha = szGreekLetters->IndexOf( L'\x0391'); + // The first index of Omega. + int iomega = szGreekLetters->IndexOf(L'\x03A9'); + + Console::WriteLine("First occurrence of the Greek letter Alpha: Index {0}", + ialpha); + Console::WriteLine("First occurrence of the Greek letter Omega: Index {0}", + iomega); +} +// The example displays the following output: +// The string: OOO?????OOO +// First occurrence of the Greek letter Alpha: Index 3 +// First occurrence of the Greek letter Omega: Index 0 +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp new file mode 100644 index 00000000000..536ce88ab56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/indexofcii.cpp @@ -0,0 +1,61 @@ + +// +// Example for the String::IndexOf( Char, int, int ) method. +using namespace System; +void FindAllChar( Char target, String^ searched ) +{ + Console::Write( "The character '{0}' occurs at position(s): ", target ); + int startIndex = -1; + int hitCount = 0; + + // Search for all occurrences of the target. + while ( true ) + { + startIndex = searched->IndexOf( target, startIndex + 1, searched->Length - startIndex - 1 ); + + // Exit the loop if the target is not found. + if ( startIndex < 0 ) + break; + + Console::Write( "{0}, ", startIndex ); + hitCount++; + } + + Console::WriteLine( "occurrences: {0}", hitCount ); +} + +int main() +{ + String^ br1 = "0----+----1----+----2----+----3----+----" + "4----+----5----+----6----+----7"; + String^ br2 = "0123456789012345678901234567890123456789" + "0123456789012345678901234567890"; + String^ str = "ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi " + "ABCDEFGHI abcdefghi ABCDEFGHI"; + Console::WriteLine( "This example of String::IndexOf( Char, int, int )\n" + "generates the following output." ); + Console::WriteLine( "{0}{1}{0}{2}{0}{3}{0}", Environment::NewLine, br1, br2, str ); + FindAllChar( 'A', str ); + FindAllChar( 'a', str ); + FindAllChar( 'I', str ); + FindAllChar( 'i', str ); + FindAllChar( '@', str ); + FindAllChar( ' ', str ); +} + +/* +This example of String::IndexOf( Char, int, int ) +generates the following output. + +0----+----1----+----2----+----3----+----4----+----5----+----6----+----7 +01234567890123456789012345678901234567890123456789012345678901234567890 +ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi ABCDEFGHI abcdefghi ABCDEFGHI + +The character 'A' occurs at position(s): 0, 20, 40, 60, occurrences: 4 +The character 'a' occurs at position(s): 10, 30, 50, occurrences: 3 +The character 'I' occurs at position(s): 8, 28, 48, 68, occurrences: 4 +The character 'i' occurs at position(s): 18, 38, 58, occurrences: 3 +The character '@' occurs at position(s): occurrences: 0 +The character ' ' occurs at position(s): 9, 19, 29, 39, 49, 59, occurrences: 6 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp new file mode 100644 index 00000000000..777e7856dd8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.IndexOf/CPP/simple1.cpp @@ -0,0 +1,15 @@ +// +using namespace System; + +void main() +{ + String^ str = "animal"; + String^ toFind = "n"; + int index = str->IndexOf("n"); + Console::WriteLine("Found '{0}' in '{1}' at position {2}", + toFind, str, index); + +} +// The example displays the following output: +// Found 'n' in 'animal' at position 1 +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp new file mode 100644 index 00000000000..fb115d56be2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Inequality/CPP/inequalityop.cpp @@ -0,0 +1,28 @@ + +// +// Example for the String Inequality operator. +using namespace System; +void CompareAndDisplay( String^ Comparand ) +{ + String^ Lower = "abcd"; + Console::WriteLine( "\"{0}\" != \"{1}\" ? {2}", Lower, Comparand, Lower != Comparand ); +} + +int main() +{ + Console::WriteLine( "This example of the String Inequality operator\n" + "generates the following output.\n" ); + CompareAndDisplay( "ijkl" ); + CompareAndDisplay( "ABCD" ); + CompareAndDisplay( "abcd" ); +} + +/* +This example of the String Inequality operator +generates the following output. + +"abcd" != "ijkl" ? True +"abcd" != "ABCD" ? True +"abcd" != "abcd" ? False +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp new file mode 100644 index 00000000000..9a0970cfcc3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.ToUpper/cpp/ToUpperEx.cpp @@ -0,0 +1,82 @@ +// +using namespace System; + +void main() +{ + int n = 0; + for (int ctr = 0x20; ctr <= 0x017F; ctr++) { + String^ string1 = Convert::ToChar(ctr).ToString(); + String^ upperString = string1->ToUpper(); + if (string1 != upperString) { + Console::Write(L"{0} (\u+{1}) --> {2} (\u+{3}) ", + string1, + Convert::ToUInt16(string1[0]).ToString("X4"), + upperString, + Convert::ToUInt16(upperString[0]).ToString("X4")); + n++; + if (n % 2 == 0) Console::WriteLine(); + } + } +} +// The example displays the following output: +// a (\u+0061) --> A (\u+0041) b (\u+0062) --> B (\u+0042) +// c (\u+0063) --> C (\u+0043) d (\u+0064) --> D (\u+0044) +// e (\u+0065) --> E (\u+0045) f (\u+0066) --> F (\u+0046) +// g (\u+0067) --> G (\u+0047) h (\u+0068) --> H (\u+0048) +// i (\u+0069) --> I (\u+0049) j (\u+006A) --> J (\u+004A) +// k (\u+006B) --> K (\u+004B) l (\u+006C) --> L (\u+004C) +// m (\u+006D) --> M (\u+004D) n (\u+006E) --> N (\u+004E) +// o (\u+006F) --> O (\u+004F) p (\u+0070) --> P (\u+0050) +// q (\u+0071) --> Q (\u+0051) r (\u+0072) --> R (\u+0052) +// s (\u+0073) --> S (\u+0053) t (\u+0074) --> T (\u+0054) +// u (\u+0075) --> U (\u+0055) v (\u+0076) --> V (\u+0056) +// w (\u+0077) --> W (\u+0057) x (\u+0078) --> X (\u+0058) +// y (\u+0079) --> Y (\u+0059) z (\u+007A) --> Z (\u+005A) +// à (\u+00E0) --> À (\u+00C0) á (\u+00E1) --> à (\u+00C1) +// â (\u+00E2) -->  (\u+00C2) ã (\u+00E3) --> à (\u+00C3) +// ä (\u+00E4) --> Ä (\u+00C4) Ã¥ (\u+00E5) --> Ã… (\u+00C5) +// æ (\u+00E6) --> Æ (\u+00C6) ç (\u+00E7) --> Ç (\u+00C7) +// è (\u+00E8) --> È (\u+00C8) é (\u+00E9) --> É (\u+00C9) +// ê (\u+00EA) --> Ê (\u+00CA) ë (\u+00EB) --> Ë (\u+00CB) +// ì (\u+00EC) --> ÃŒ (\u+00CC) í (\u+00ED) --> à (\u+00CD) +// î (\u+00EE) --> ÃŽ (\u+00CE) ï (\u+00EF) --> à (\u+00CF) +// ð (\u+00F0) --> à (\u+00D0) ñ (\u+00F1) --> Ñ (\u+00D1) +// ò (\u+00F2) --> Ã’ (\u+00D2) ó (\u+00F3) --> Ó (\u+00D3) +// ô (\u+00F4) --> Ô (\u+00D4) õ (\u+00F5) --> Õ (\u+00D5) +// ö (\u+00F6) --> Ö (\u+00D6) ø (\u+00F8) --> Ø (\u+00D8) +// ù (\u+00F9) --> Ù (\u+00D9) ú (\u+00FA) --> Ú (\u+00DA) +// û (\u+00FB) --> Û (\u+00DB) ü (\u+00FC) --> Ü (\u+00DC) +// ý (\u+00FD) --> à (\u+00DD) þ (\u+00FE) --> Þ (\u+00DE) +// ÿ (\u+00FF) --> Ÿ (\u+0178) Ä (\u+0101) --> Ä€ (\u+0100) +// ă (\u+0103) --> Ä‚ (\u+0102) Ä… (\u+0105) --> Ä„ (\u+0104) +// ć (\u+0107) --> Ć (\u+0106) ĉ (\u+0109) --> Ĉ (\u+0108) +// Ä‹ (\u+010B) --> ÄŠ (\u+010A) Ä (\u+010D) --> ÄŒ (\u+010C) +// Ä (\u+010F) --> ÄŽ (\u+010E) Ä‘ (\u+0111) --> Ä (\u+0110) +// Ä“ (\u+0113) --> Ä’ (\u+0112) Ä• (\u+0115) --> Ä” (\u+0114) +// Ä— (\u+0117) --> Ä– (\u+0116) Ä™ (\u+0119) --> Ę (\u+0118) +// Ä› (\u+011B) --> Äš (\u+011A) Ä (\u+011D) --> Äœ (\u+011C) +// ÄŸ (\u+011F) --> Äž (\u+011E) Ä¡ (\u+0121) --> Ä  (\u+0120) +// Ä£ (\u+0123) --> Ä¢ (\u+0122) Ä¥ (\u+0125) --> Ĥ (\u+0124) +// ħ (\u+0127) --> Ħ (\u+0126) Ä© (\u+0129) --> Ĩ (\u+0128) +// Ä« (\u+012B) --> Ī (\u+012A) Ä­ (\u+012D) --> Ĭ (\u+012C) +// į (\u+012F) --> Ä® (\u+012E) ı (\u+0131) --> I (\u+0049) +// ij (\u+0133) --> IJ (\u+0132) ĵ (\u+0135) --> Ä´ (\u+0134) +// Ä· (\u+0137) --> Ķ (\u+0136) ĺ (\u+013A) --> Ĺ (\u+0139) +// ļ (\u+013C) --> Ä» (\u+013B) ľ (\u+013E) --> Ľ (\u+013D) +// Å€ (\u+0140) --> Ä¿ (\u+013F) Å‚ (\u+0142) --> Å (\u+0141) +// Å„ (\u+0144) --> Ń (\u+0143) ņ (\u+0146) --> Å… (\u+0145) +// ň (\u+0148) --> Ň (\u+0147) Å‹ (\u+014B) --> ÅŠ (\u+014A) +// Å (\u+014D) --> ÅŒ (\u+014C) Å (\u+014F) --> ÅŽ (\u+014E) +// Å‘ (\u+0151) --> Å (\u+0150) Å“ (\u+0153) --> Å’ (\u+0152) +// Å• (\u+0155) --> Å” (\u+0154) Å— (\u+0157) --> Å– (\u+0156) +// Å™ (\u+0159) --> Ř (\u+0158) Å› (\u+015B) --> Åš (\u+015A) +// Å (\u+015D) --> Åœ (\u+015C) ÅŸ (\u+015F) --> Åž (\u+015E) +// Å¡ (\u+0161) --> Å  (\u+0160) Å£ (\u+0163) --> Å¢ (\u+0162) +// Å¥ (\u+0165) --> Ť (\u+0164) ŧ (\u+0167) --> Ŧ (\u+0166) +// Å© (\u+0169) --> Ũ (\u+0168) Å« (\u+016B) --> Ū (\u+016A) +// Å­ (\u+016D) --> Ŭ (\u+016C) ů (\u+016F) --> Å® (\u+016E) +// ű (\u+0171) --> Ű (\u+0170) ų (\u+0173) --> Ų (\u+0172) +// ŵ (\u+0175) --> Å´ (\u+0174) Å· (\u+0177) --> Ŷ (\u+0176) +// ź (\u+017A) --> Ź (\u+0179) ż (\u+017C) --> Å» (\u+017B) +// ž (\u+017E) --> Ž (\u+017D) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp new file mode 100644 index 00000000000..befd0ecbf85 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim1.cpp @@ -0,0 +1,16 @@ +// +using namespace System; + +void main() +{ + array^ charsToTrim = { L'*', L' ', L'\\' }; + String^ banner = "*** Much Ado About Nothing ***"; + String^ result = banner->Trim(charsToTrim); + Console::WriteLine("Trimmmed\n {0}\nto\n '{1}'", banner, result); +} +// The example displays the following output: +// Trimmmed +// *** Much Ado About Nothing *** +// to +// 'Much Ado About Nothing' +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp new file mode 100644 index 00000000000..bd9807b395d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.String.Trim/cpp/trim2.cpp @@ -0,0 +1,30 @@ +// +using namespace System; + +void main() +{ + Console::Write("Enter your first name: "); + String^ firstName = Console::ReadLine(); + + Console::Write("Enter your middle name or initial: "); + String^ middleName = Console::ReadLine(); + + Console::Write("Enter your last name: "); + String^ lastName = Console::ReadLine(); + + Console::WriteLine(); + Console::WriteLine("You entered '{0}', '{1}', and '{2}'.", + firstName, middleName, lastName); + + String^ name = ((firstName->Trim() + " " + middleName->Trim())->Trim() + " " + + lastName->Trim())->Trim(); + Console::WriteLine("The result is " + name + "."); +} +// The following is possible output from this example: +// Enter your first name: John +// Enter your middle name or initial: +// Enter your last name: Doe +// +// You entered ' John ', '', and ' Doe'. +// The result is John Doe. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp new file mode 100644 index 00000000000..19daa2e0cd4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.StringComparer/cpp/omni.cpp @@ -0,0 +1,139 @@ +// +// This example demonstrates members of the +// System::StringComparer class. + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Generic; +using namespace System::Globalization; +using namespace System::Threading; + +void Display(List^ stringList, String^ title) +{ + Char firstChar; + int codePoint; + Console::WriteLine(title); + for each (String^ s in stringList) + { + firstChar = s[0]; + codePoint = Convert::ToInt32(firstChar); + Console::WriteLine("0x{0:x}", codePoint); + } + Console::WriteLine(); +} + +int main() +{ + // Create a list of string. + List^ stringList = gcnew List(); + + // Get the tr-TR (Turkish-Turkey) culture. + CultureInfo^ turkishCulture = gcnew CultureInfo("tr-TR"); + + // Get the culture that is associated with the current thread. + CultureInfo^ currentCulture = Thread::CurrentThread->CurrentCulture; + + // Get the standard StringComparers. + StringComparer^ invariant = StringComparer::InvariantCulture; + StringComparer^ invariantIgnoreCase = + StringComparer::InvariantCultureIgnoreCase; + StringComparer^ current = StringComparer::CurrentCulture; + StringComparer^ currentIgnoreCase = + StringComparer::CurrentCultureIgnoreCase; + StringComparer^ ordinal = StringComparer::Ordinal; + StringComparer^ ordinalIgnoreCase = StringComparer::OrdinalIgnoreCase; + + // Create a StringComparer that uses the Turkish culture and ignores + // case. + StringComparer^ turkishIgnoreCase = + StringComparer::Create(turkishCulture, true); + + // Define three strings consisting of different versions of the + // letter I. LATIN CAPITAL LETTER I (U+0049) + String^ capitalLetterI = "I"; + + // LATIN SMALL LETTER I (U+0069) + String^ smallLetterI = "i"; + + // LATIN SMALL LETTER DOTLESS I (U+0131) + String^ smallLetterDotlessI = L"\u0131"; + + // Add the three strings to the list. + stringList->Add(capitalLetterI); + stringList->Add(smallLetterI); + stringList->Add(smallLetterDotlessI); + + // Display the original list order. + Display(stringList, "The original order of the list entries..."); + + // Sort the list using the invariant culture. + stringList->Sort(invariant); + Display(stringList, "Invariant culture..."); + stringList->Sort(invariantIgnoreCase); + Display(stringList, "Invariant culture, ignore case..."); + + // Sort the list using the current culture. + Console::WriteLine("The current culture is \"{0}\".", + currentCulture->Name); + stringList->Sort(current); + Display(stringList, "Current culture..."); + stringList->Sort(currentIgnoreCase); + Display(stringList, "Current culture, ignore case..."); + + // Sort the list using the ordinal value of the character code points. + stringList->Sort(ordinal); + Display(stringList, "Ordinal..."); + stringList->Sort(ordinalIgnoreCase); + Display(stringList, "Ordinal, ignore case..."); + + // Sort the list using the Turkish culture, which treats LATIN SMALL + // LETTER DOTLESS I differently than LATIN SMALL LETTER I. + stringList->Sort(turkishIgnoreCase); + Display(stringList, "Turkish culture, ignore case..."); +} +/* +This code example produces the following results: + +The original order of the list entries... +0x49 +0x69 +0x131 + +Invariant culture... +0x69 +0x49 +0x131 + +Invariant culture, ignore case... +0x49 +0x69 +0x131 + +The current culture is "en-US". +Current culture... +0x69 +0x49 +0x131 + +Current culture, ignore case... +0x49 +0x69 +0x131 + +Ordinal... +0x49 +0x69 +0x131 + +Ordinal, ignore case... +0x69 +0x49 +0x131 + +Turkish culture, ignore case... +0x131 +0x49 +0x69 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp new file mode 100644 index 00000000000..b1cbd4a7c59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding Example/CPP/snippet.cpp @@ -0,0 +1,67 @@ + +// +using namespace System; +using namespace System::Collections; +using namespace System::Text; +int main() +{ + + // The encoding. + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + + // A Unicode string with two characters outside the ASCII code range. + String^ unicodeString = L"This Unicode String* contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3)."; + Console::WriteLine( "Original String*:" ); + Console::WriteLine( unicodeString ); + + // Save positions of the special characters for later reference. + int indexOfPi = unicodeString->IndexOf( L'\u03a0' ); + int indexOfSigma = unicodeString->IndexOf( L'\u03a3' ); + + // Encode string. + array^encodedBytes = ascii->GetBytes( unicodeString ); + Console::WriteLine(); + Console::WriteLine( "Encoded bytes:" ); + IEnumerator^ myEnum = encodedBytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "->Item[ {0}]", b ); + } + + Console::WriteLine(); + + // Notice that the special characters have been replaced with + // the value 63, which is the ASCII character code for '?'. + Console::WriteLine(); + Console::WriteLine( "Value at position of Pi character: {0}", encodedBytes[ indexOfPi ] ); + Console::WriteLine( "Value at position of Sigma character: {0}", encodedBytes[ indexOfSigma ] ); + + // Decode bytes back to string. + // Notice missing Pi and Sigma characters. + String^ decodedString = ascii->GetString( encodedBytes ); + Console::WriteLine(); + Console::WriteLine( "Decoded bytes:" ); + Console::WriteLine( decodedString ); +} +// The example displays the following output: +// Original string: +// This Unicode string contains two characters with codes outside the ASCII code ra +// nge, Pi (Π) and Sigma (Σ). +// +// Encoded bytes: +// [84][104][105][115][32][85][110][105][99][111][100][101][32][115][116][114][105] +// [110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][ +// 104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][1 +// 00][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][ +// 83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][1 +// 05][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41] +// [46] +// +// Value at position of Pi character: 63 +// Value at position of Sigma character: 63 +// +// Decoded bytes: +// This Unicode string contains two characters with codes outside the ASCII code ra +// nge, Pi (?) and Sigma (?). +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp new file mode 100644 index 00000000000..6c219637683 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount1 Example/CPP/getbytecount-char[]-int32-int32.cpp @@ -0,0 +1,18 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int byteCount = ascii->GetByteCount( chars, 1, 2 ); + Console::WriteLine( " {0} bytes needed to encode characters.", byteCount.ToString() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp new file mode 100644 index 00000000000..9cca1f732fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetByteCount2 Example/CPP/getbytecount-string.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + String^ chars = "ASCII Encoding Example"; + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int byteCount = ascii->GetByteCount( chars ); + Console::WriteLine( " {0} bytes needed to encode string.", byteCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..8c299b71779 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes1 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + String^ chars = "ASCII Encoding Example"; + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int byteCount = ascii->GetByteCount( chars->ToCharArray(), 6, 8 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = ascii->GetBytes( chars, 6, 8, bytes, 0 ); + Console::WriteLine( " {0} bytes used to encode string.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..50c3b1c6605 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetBytes2/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int byteCount = ascii->GetByteCount( chars, 1, 2 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = ascii->GetBytes( chars, 1, 2, bytes, 0 ); + Console::WriteLine( " {0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp new file mode 100644 index 00000000000..9a924b51b64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + array^bytes = {65,83,67,73,73,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int charCount = ascii->GetCharCount( bytes, 6, 8 ); + Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp new file mode 100644 index 00000000000..7185ebd1815 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {65,83,67,73,73,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int charCount = ascii->GetCharCount( bytes, 6, 8 ); + chars = gcnew array(charCount); + int charsDecodedCount = ascii->GetChars( bytes, 6, 8, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp new file mode 100644 index 00000000000..2f2f78f27ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int charCount = 2; + int maxByteCount = ascii->GetMaxByteCount( charCount ); + Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp new file mode 100644 index 00000000000..b6d834c02f9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + int byteCount = 8; + int maxCharCount = ascii->GetMaxCharCount( byteCount ); + Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp new file mode 100644 index 00000000000..b8f188b7df6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.GetString1 Example/CPP/getstring-byte[].cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::Text; + +int main() +{ + // Define a string. + String^ original = "ASCII Encoding Example"; + // Instantiate an ASCII encoding object. + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + + // Create an ASCII byte array. + array^ bytes = ascii->GetBytes(original); + + // Display encoded bytes. + Console::Write("Encoded bytes (in hex): "); + for each (Byte value in bytes) + Console::Write("{0:X2} ", value); + Console::WriteLine(); + + // Decode the bytes and display the resulting Unicode string. + String^ decoded = ascii->GetString(bytes); + Console::WriteLine("Decoded string: '{0}'", decoded); +} +// The example displays the following output: +// Encoded bytes (in hex): 41 53 43 49 49 20 45 6E 63 6F 64 69 6E 67 20 45 78 61 6D 70 6C 65 +// Decoded string: 'ASCII Encoding Example' +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp new file mode 100644 index 00000000000..962a0f07f41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.ASCIIEncoding.ctor Example/CPP/ctor.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + ASCIIEncoding^ ascii = gcnew ASCIIEncoding; + String^ encodingName = ascii->EncodingName; + Console::WriteLine( "Encoding name: {0}", encodingName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp new file mode 100644 index 00000000000..370f5662328 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp @@ -0,0 +1,19 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; + Decoder^ uniDecoder = Encoding::Unicode->GetDecoder(); + int charCount = uniDecoder->GetCharCount( bytes, 0, bytes->Length ); + Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); +} + +/* This code example produces the following output. + +7 characters needed to decode bytes. + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp new file mode 100644 index 00000000000..7183cd449b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp @@ -0,0 +1,33 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; + Decoder^ uniDecoder = Encoding::Unicode->GetDecoder(); + int charCount = uniDecoder->GetCharCount( bytes, 0, bytes->Length ); + chars = gcnew array(charCount); + int charsDecodedCount = uniDecoder->GetChars( bytes, 0, bytes->Length, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +/* This code example produces the following output. + +7 characters used to decode bytes. +Decoded chars: [U][n][i][c][o][d][e] + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp new file mode 100644 index 00000000000..70bd454cc25 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Decoder.ctor Example/CPP/ctor.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // A Decoder is obtained from an Encoding. + UnicodeEncoding^ uni = gcnew UnicodeEncoding; + Decoder^ dec1 = uni->GetDecoder(); + + // A more direct technique. + Decoder^ dec2 = Encoding::Unicode->GetDecoder(); + + // dec1 and dec2 seem to be the same. + Console::WriteLine( dec1 ); + Console::WriteLine( dec2 ); + + // Note that their hash codes differ. + Console::WriteLine( dec1->GetHashCode() ); + Console::WriteLine( dec2->GetHashCode() ); +} + +/* This code example produces the following output. + +System.Text.UnicodeEncoding+Decoder +System.Text.UnicodeEncoding+Decoder +54267293 +18643596 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp new file mode 100644 index 00000000000..74bd7968408 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder Example/CPP/snippet.cpp @@ -0,0 +1,125 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +void ShowArray( Array^ theArray ) +{ + IEnumerator^ myEnum = theArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::Write( "[{0}]", o ); + } + + Console::WriteLine( "\n" ); +} + +int main() +{ + + // The characters to encode. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + + // Encode characters using an Encoding Object*. + Encoding^ encoding = Encoding::UTF7; + Console::WriteLine( "Using Encoding\n--------------" ); + + // Encode complete array for comparison. + array^allCharactersFromEncoding = encoding->GetBytes( chars ); + Console::WriteLine( "All characters encoded:" ); + ShowArray( allCharactersFromEncoding ); + + // Encode characters, one-by-one. + // The Encoding Object* will NOT maintain state between calls. + array^firstchar = encoding->GetBytes( chars, 0, 1 ); + Console::WriteLine( "First character:" ); + ShowArray( firstchar ); + array^secondchar = encoding->GetBytes( chars, 1, 1 ); + Console::WriteLine( "Second character:" ); + ShowArray( secondchar ); + array^thirdchar = encoding->GetBytes( chars, 2, 1 ); + Console::WriteLine( "Third character:" ); + ShowArray( thirdchar ); + array^fourthchar = encoding->GetBytes( chars, 3, 1 ); + Console::WriteLine( "Fourth character:" ); + ShowArray( fourthchar ); + + // Now, encode characters using an Encoder Object*. + Encoder^ encoder = encoding->GetEncoder(); + Console::WriteLine( "Using Encoder\n-------------" ); + + // Encode complete array for comparison. + array^allCharactersFromEncoder = gcnew array(encoder->GetByteCount( chars, 0, chars->Length, true )); + encoder->GetBytes( chars, 0, chars->Length, allCharactersFromEncoder, 0, true ); + Console::WriteLine( "All characters encoded:" ); + ShowArray( allCharactersFromEncoder ); + + // Do not flush state; i.e. maintain state between calls. + bool bFlushState = false; + + // Encode characters one-by-one. + // By maintaining state, the Encoder will not store extra bytes in the output. + array^firstcharNoFlush = gcnew array(encoder->GetByteCount( chars, 0, 1, bFlushState )); + encoder->GetBytes( chars, 0, 1, firstcharNoFlush, 0, bFlushState ); + Console::WriteLine( "First character:" ); + ShowArray( firstcharNoFlush ); + array^secondcharNoFlush = gcnew array(encoder->GetByteCount( chars, 1, 1, bFlushState )); + encoder->GetBytes( chars, 1, 1, secondcharNoFlush, 0, bFlushState ); + Console::WriteLine( "Second character:" ); + ShowArray( secondcharNoFlush ); + array^thirdcharNoFlush = gcnew array(encoder->GetByteCount( chars, 2, 1, bFlushState )); + encoder->GetBytes( chars, 2, 1, thirdcharNoFlush, 0, bFlushState ); + Console::WriteLine( "Third character:" ); + ShowArray( thirdcharNoFlush ); + + // Must flush state on last call to GetBytes(). + bFlushState = true; + array^fourthcharNoFlush = gcnew array(encoder->GetByteCount( chars, 3, 1, bFlushState )); + encoder->GetBytes( chars, 3, 1, fourthcharNoFlush, 0, bFlushState ); + Console::WriteLine( "Fourth character:" ); + ShowArray( fourthcharNoFlush ); +} + +/* This code example produces the following output. + +Using Encoding +-------------- +All characters encoded: +[43][65][54][65][68][111][119][79][109][65][54][107][45] + +First character: +[43][65][54][65][45] + +Second character: +[43][65][54][77][45] + +Third character: +[43][65][54][89][45] + +Fourth character: +[43][65][54][107][45] + +Using Encoder +------------- +All characters encoded: +[43][65][54][65][68][111][119][79][109][65][54][107][45] + +First character: +[43][65][54] + +Second character: +[65][68][111] + +Third character: +[119][79][109] + +Fourth character: +[65][54][107][45] + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp new file mode 100644 index 00000000000..d8af6efc812 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp @@ -0,0 +1,24 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + Encoder^ uniEncoder = Encoding::Unicode->GetEncoder(); + int byteCount = uniEncoder->GetByteCount( chars, 0, chars->Length, true ); + Console::WriteLine( "{0} bytes needed to encode characters.", byteCount ); +} + +/* This code example produces the following output. + +8 bytes needed to encode characters. + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..1430f4918f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + Encoder^ uniEncoder = Encoding::Unicode->GetEncoder(); + int byteCount = uniEncoder->GetByteCount( chars, 0, chars->Length, true ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = uniEncoder->GetBytes( chars, 0, chars->Length, bytes, 0, true ); + Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +/* This code example produces the following output. + +8 bytes used to encode characters. +Encoded bytes: [160][3][163][3][166][3][169][3] + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp new file mode 100644 index 00000000000..0f8e033017f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoder.ctor Example/CPP/ctor.cpp @@ -0,0 +1,33 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // An Encoder is obtained from an Encoding. + UnicodeEncoding^ uni = gcnew UnicodeEncoding; + Encoder^ enc1 = uni->GetEncoder(); + + // A more direct technique. + Encoder^ enc2 = Encoding::Unicode->GetEncoder(); + + // enc1 and enc2 seem to be the same. + Console::WriteLine( enc1 ); + Console::WriteLine( enc2 ); + + // Note that their hash codes differ. + Console::WriteLine( enc1->GetHashCode() ); + Console::WriteLine( enc2->GetHashCode() ); +} + +/* This code example produces the following output. + +System.Text.EncoderNLS +System.Text.EncoderNLS +54267293 +18643596 + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp new file mode 100644 index 00000000000..3ea34429d23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.ASCII Example/CPP/ascii.cpp @@ -0,0 +1,65 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + + // Create an ASCII encoding. + Encoding^ ascii = Encoding::ASCII; + + // A Unicode String* with two characters outside the ASCII code range. + String^ unicodeString = L"This unicode string contains two characters with codes outside the ASCII code range, Pi (\u03a0) and Sigma (\u03a3)."; + Console::WriteLine( "Original string:" ); + Console::WriteLine( unicodeString ); + + // Save the positions of the special characters for later reference. + int indexOfPi = unicodeString->IndexOf( L'\u03a0' ); + int indexOfSigma = unicodeString->IndexOf( L'\u03a3' ); + + // Encode the String*. + array^encodedBytes = ascii->GetBytes( unicodeString ); + Console::WriteLine(); + Console::WriteLine( "Encoded bytes:" ); + IEnumerator^ myEnum = encodedBytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); + + // Notice that the special characters have been replaced with + // the value 63, which is the ASCII character code for '?'. + Console::WriteLine(); + Console::WriteLine( "Value at position of Pi character: {0}", encodedBytes[ indexOfPi ] ); + Console::WriteLine( "Value at position of Sigma character: {0}", encodedBytes[ indexOfSigma ] ); + + // Decode bytes back to String*. + // Notice the missing Pi and Sigma characters. + String^ decodedString = ascii->GetString( encodedBytes ); + Console::WriteLine(); + Console::WriteLine( "Decoded bytes:" ); + Console::WriteLine( decodedString ); +} + +/* +This code produces the following output. + +Original string: +This unicode string contains two characters with codes outside the ASCII code range, Pi (Π) and Sigma (Σ). + +Encoded bytes: +[84][104][105][115][32][117][110][105][99][111][100][101][32][115][116][114][105][110][103][32][99][111][110][116][97][105][110][115][32][116][119][111][32][99][104][97][114][97][99][116][101][114][115][32][119][105][116][104][32][99][111][100][101][115][32][111][117][116][115][105][100][101][32][116][104][101][32][65][83][67][73][73][32][99][111][100][101][32][114][97][110][103][101][44][32][80][105][32][40][63][41][32][97][110][100][32][83][105][103][109][97][32][40][63][41][46] + +Value at position of Pi character: 63 +Value at position of Sigma character: 63 + +Decoded bytes: +This unicode string contains two characters with codes outside the ASCII code range, Pi (?) and Sigma (?). + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp new file mode 100644 index 00000000000..8e692e11ce8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.BigEndianUnicode/CPP/bigendianunicode.cpp @@ -0,0 +1,19 @@ + +// +using namespace System; +using namespace System::IO; +int main() +{ + + // Read a text file saved with Big Endian Unicode encoding. + System::Text::Encoding^ encoding = System::Text::Encoding::BigEndianUnicode; + StreamReader^ reader = gcnew StreamReader( "TextFile.txt",encoding ); + String^ line = reader->ReadLine(); + while ( line != nullptr ) + { + Console::WriteLine( line ); + line = reader->ReadLine(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp new file mode 100644 index 00000000000..1c3ea4a7481 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.CodePage/CPP/codepage.cpp @@ -0,0 +1,176 @@ + +// The following code example determines the Windows code page that most closely corresponds to each encoding. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Print the header. + Console::Write( "CodePage identifier and name " ); + Console::WriteLine( "WindowsCodePage" ); + + // For every encoding, get the Windows code page for it. + System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EncodingInfo ^ ei = safe_cast(myEnum->Current); + Encoding^ e = ei->GetEncoding(); + Console::Write( "{0,-6} {1,-25} ", ei->CodePage, ei->Name ); + Console::Write( "{0,-6} ", e->WindowsCodePage ); + + // Mark the ones that are different. + if ( ei->CodePage != e->WindowsCodePage ) + Console::Write( "*" ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +CodePage identifier and name WindowsCodePage +37 IBM037 1252 * +437 IBM437 1252 * +500 IBM500 1252 * +708 ASMO-708 1256 * +720 DOS-720 1256 * +737 ibm737 1253 * +775 ibm775 1257 * +850 ibm850 1252 * +852 ibm852 1250 * +855 IBM855 1252 * +857 ibm857 1254 * +858 IBM00858 1252 * +860 IBM860 1252 * +861 ibm861 1252 * +862 DOS-862 1255 * +863 IBM863 1252 * +864 IBM864 1256 * +865 IBM865 1252 * +866 cp866 1251 * +869 ibm869 1253 * +870 IBM870 1250 * +874 windows-874 874 +875 cp875 1253 * +932 shift_jis 932 +936 gb2312 936 +949 ks_c_5601-1987 949 +950 big5 950 +1026 IBM1026 1254 * +1047 IBM01047 1252 * +1140 IBM01140 1252 * +1141 IBM01141 1252 * +1142 IBM01142 1252 * +1143 IBM01143 1252 * +1144 IBM01144 1252 * +1145 IBM01145 1252 * +1146 IBM01146 1252 * +1147 IBM01147 1252 * +1148 IBM01148 1252 * +1149 IBM01149 1252 * +1200 utf-16 1200 +1201 unicodeFFFE 1200 * +1250 windows-1250 1250 +1251 windows-1251 1251 +1252 Windows-1252 1252 +1253 windows-1253 1253 +1254 windows-1254 1254 +1255 windows-1255 1255 +1256 windows-1256 1256 +1257 windows-1257 1257 +1258 windows-1258 1258 +1361 Johab 949 * +10000 macintosh 1252 * +10001 x-mac-japanese 932 * +10002 x-mac-chinesetrad 950 * +10003 x-mac-korean 949 * +10004 x-mac-arabic 1256 * +10005 x-mac-hebrew 1255 * +10006 x-mac-greek 1253 * +10007 x-mac-cyrillic 1251 * +10008 x-mac-chinesesimp 936 * +10010 x-mac-romanian 1250 * +10017 x-mac-ukrainian 1251 * +10021 x-mac-thai 874 * +10029 x-mac-ce 1250 * +10079 x-mac-icelandic 1252 * +10081 x-mac-turkish 1254 * +10082 x-mac-croatian 1250 * +12000 utf-32 1200 * +12001 utf-32BE 1200 * +20000 x-Chinese-CNS 950 * +20001 x-cp20001 950 * +20002 x-Chinese-Eten 950 * +20003 x-cp20003 950 * +20004 x-cp20004 950 * +20005 x-cp20005 950 * +20105 x-IA5 1252 * +20106 x-IA5-German 1252 * +20107 x-IA5-Swedish 1252 * +20108 x-IA5-Norwegian 1252 * +20127 us-ascii 1252 * +20261 x-cp20261 1252 * +20269 x-cp20269 1252 * +20273 IBM273 1252 * +20277 IBM277 1252 * +20278 IBM278 1252 * +20280 IBM280 1252 * +20284 IBM284 1252 * +20285 IBM285 1252 * +20290 IBM290 932 * +20297 IBM297 1252 * +20420 IBM420 1256 * +20423 IBM423 1253 * +20424 IBM424 1255 * +20833 x-EBCDIC-KoreanExtended 949 * +20838 IBM-Thai 874 * +20866 koi8-r 1251 * +20871 IBM871 1252 * +20880 IBM880 1251 * +20905 IBM905 1254 * +20924 IBM00924 1252 * +20932 EUC-JP 932 * +20936 x-cp20936 936 * +20949 x-cp20949 949 * +21025 cp1025 1251 * +21866 koi8-u 1251 * +28591 iso-8859-1 1252 * +28592 iso-8859-2 1250 * +28593 iso-8859-3 1254 * +28594 iso-8859-4 1257 * +28595 iso-8859-5 1251 * +28596 iso-8859-6 1256 * +28597 iso-8859-7 1253 * +28598 iso-8859-8 1255 * +28599 iso-8859-9 1254 * +28603 iso-8859-13 1257 * +28605 iso-8859-15 1252 * +29001 x-Europa 1252 * +38598 iso-8859-8-i 1255 * +50220 iso-2022-jp 932 * +50221 csISO2022JP 932 * +50222 iso-2022-jp 932 * +50225 iso-2022-kr 949 * +50227 x-cp50227 936 * +51932 euc-jp 932 * +51936 EUC-CN 936 * +51949 euc-kr 949 * +52936 hz-gb-2312 936 * +54936 GB18030 936 * +57002 x-iscii-de 57002 +57003 x-iscii-be 57003 +57004 x-iscii-ta 57004 +57005 x-iscii-te 57005 +57006 x-iscii-as 57006 +57007 x-iscii-or 57007 +57008 x-iscii-ka 57008 +57009 x-iscii-ma 57009 +57010 x-iscii-gu 57010 +57011 x-iscii-pa 57011 +65000 utf-7 1200 * +65001 utf-8 1200 * + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp new file mode 100644 index 00000000000..90b8851bb09 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Convert Example/CPP/convert.cpp @@ -0,0 +1,32 @@ + +// +using namespace System; +using namespace System::Text; + +int main() +{ + String^ unicodeString = "This string contains the unicode character Pi (\u03a0)"; + + // Create two different encodings. + Encoding^ ascii = Encoding::ASCII; + Encoding^ unicode = Encoding::Unicode; + + // Convert the string into a byte array. + array^unicodeBytes = unicode->GetBytes( unicodeString ); + + // Perform the conversion from one encoding to the other. + array^asciiBytes = Encoding::Convert( unicode, ascii, unicodeBytes ); + + // Convert the new Byte into[] a char and[] then into a string. + array^asciiChars = gcnew array(ascii->GetCharCount( asciiBytes, 0, asciiBytes->Length )); + ascii->GetChars( asciiBytes, 0, asciiBytes->Length, asciiChars, 0 ); + String^ asciiString = gcnew String( asciiChars ); + + // Display the strings created before and after the conversion. + Console::WriteLine( "Original String*: {0}", unicodeString ); + Console::WriteLine( "Ascii converted String*: {0}", asciiString ); +} +// The example displays the following output: +// Original string: This string contains the unicode character Pi (Π) +// Ascii converted string: This string contains the unicode character Pi (?) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp new file mode 100644 index 00000000000..cfdede118a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Equals/CPP/equals.cpp @@ -0,0 +1,25 @@ + +// The following code example gets two instances of the same encoding (one by codepage and another by name), and checks their equality. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Get a UTF-32 encoding by codepage. + Encoding^ e1 = Encoding::GetEncoding( 12000 ); + + // Get a UTF-32 encoding by name. + Encoding^ e2 = Encoding::GetEncoding( "utf-32" ); + + // Check their equality. + Console::WriteLine( "e1 equals e2? {0}", e1->Equals( e2 ) ); +} + +/* +This code produces the following output. + +e1 equals e2? True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp new file mode 100644 index 00000000000..b6762b0e360 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp @@ -0,0 +1,82 @@ + +// The following code example determines the number of bytes required to encode a character array, +// encodes the characters, and displays the resulting bytes. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndBytes( array^chars, Encoding^ enc ); +void PrintHexBytes( array^bytes ); +int main() +{ + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + // a high-surrogate value (U+D8FF) + // a low-surrogate value (U+DCFF) + array^myChars = gcnew array{ + L'z','a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF' + }; + + // Get different encodings. + Encoding^ u7 = Encoding::UTF7; + Encoding^ u8 = Encoding::UTF8; + Encoding^ u16LE = Encoding::Unicode; + Encoding^ u16BE = Encoding::BigEndianUnicode; + Encoding^ u32 = Encoding::UTF32; + + // Encode the entire array, and print out the counts and the resulting bytes. + PrintCountsAndBytes( myChars, u7 ); + PrintCountsAndBytes( myChars, u8 ); + PrintCountsAndBytes( myChars, u16LE ); + PrintCountsAndBytes( myChars, u16BE ); + PrintCountsAndBytes( myChars, u32 ); +} + +void PrintCountsAndBytes( array^chars, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-30} :", enc ); + + // Display the exact byte count. + int iBC = enc->GetByteCount( chars ); + Console::Write( " {0,-3}", iBC ); + + // Display the maximum byte count. + int iMBC = enc->GetMaxByteCount( chars->Length ); + Console::Write( " {0,-3} :", iMBC ); + + // Encode the array of chars. + array^bytes = enc->GetBytes( chars ); + + // Display all the encoded bytes. + PrintHexBytes( bytes ); +} + +void PrintHexBytes( array^bytes ) +{ + if ( (bytes == nullptr) || (bytes->Length == 0) ) + Console::WriteLine( "" ); + else + { + for ( int i = 0; i < bytes->Length; i++ ) + Console::Write( "{0:X2} ", bytes[ i ] ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D +System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF +System.Text.UnicodeEncoding : 14 16 :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC +System.Text.UnicodeEncoding : 14 16 :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF +System.Text.UTF32Encoding : 24 32 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp new file mode 100644 index 00000000000..2fd11ecfbd4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_CharArrIC/CPP/getbytes_chararric.cpp @@ -0,0 +1,85 @@ + +// The following code example determines the number of bytes required to encode three characters from a character array, +// encodes the characters, and displays the resulting bytes. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ); +void PrintHexBytes( array^bytes ); +int main() +{ + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + // a high-surrogate value (U+D8FF) + // a low-surrogate value (U+DCFF) + array^myChars = gcnew array{ + L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF' + }; + + // Get different encodings. + Encoding^ u7 = Encoding::UTF7; + Encoding^ u8 = Encoding::UTF8; + Encoding^ u16LE = Encoding::Unicode; + Encoding^ u16BE = Encoding::BigEndianUnicode; + Encoding^ u32 = Encoding::UTF32; + + // Encode three characters starting at index 4, and print out the counts and the resulting bytes. + PrintCountsAndBytes( myChars, 4, 3, u7 ); + PrintCountsAndBytes( myChars, 4, 3, u8 ); + PrintCountsAndBytes( myChars, 4, 3, u16LE ); + PrintCountsAndBytes( myChars, 4, 3, u16BE ); + PrintCountsAndBytes( myChars, 4, 3, u32 ); +} + +void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-30} :", enc ); + + // Display the exact byte count. + int iBC = enc->GetByteCount( chars, index, count ); + Console::Write( " {0,-3}", iBC ); + + // Display the maximum byte count. + int iMBC = enc->GetMaxByteCount( count ); + Console::Write( " {0,-3} :", iMBC ); + + // Encode the array of chars. + array^bytes = enc->GetBytes( chars, index, count ); + + // The following is an alternative way to encode the array of chars: + // byte[] bytes = new byte[iBC]; + // enc.GetBytes( chars, index, count, bytes, bytes.GetLowerBound(0) ); + // Display all the encoded bytes. + PrintHexBytes( bytes ); +} + +void PrintHexBytes( array^bytes ) +{ + if ( (bytes == nullptr) || (bytes->Length == 0) ) + Console::WriteLine( "" ); + else + { + for ( int i = 0; i < bytes->Length; i++ ) + Console::Write( "{0:X2} ", bytes[ i ] ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D +System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF +System.Text.UnicodeEncoding : 6 8 :B2 03 FF D8 FF DC +System.Text.UnicodeEncoding : 6 8 :03 B2 D8 FF DC FF +System.Text.UTF32Encoding : 8 16 :B2 03 00 00 FF FC 04 00 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp new file mode 100644 index 00000000000..bf43b1262a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetBytes_String/CPP/getbytes_string.cpp @@ -0,0 +1,121 @@ + +// The following code example determines the number of bytes required to encode a string or a range in the string, +// encodes the characters, and displays the resulting bytes. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndBytes( String^ s, Encoding^ enc ); +void PrintCountsAndBytes( String^ s, int index, int count, Encoding^ enc ); +void PrintHexBytes( array^bytes ); +int main() +{ + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + // a high-surrogate value (U+D8FF) + // a low-surrogate value (U+DCFF) + String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; + + // Get different encodings. + Encoding^ u7 = Encoding::UTF7; + Encoding^ u8 = Encoding::UTF8; + Encoding^ u16LE = Encoding::Unicode; + Encoding^ u16BE = Encoding::BigEndianUnicode; + Encoding^ u32 = Encoding::UTF32; + + // Encode the entire string, and print out the counts and the resulting bytes. + Console::WriteLine( "Encoding the entire string:" ); + PrintCountsAndBytes( myStr, u7 ); + PrintCountsAndBytes( myStr, u8 ); + PrintCountsAndBytes( myStr, u16LE ); + PrintCountsAndBytes( myStr, u16BE ); + PrintCountsAndBytes( myStr, u32 ); + Console::WriteLine(); + + // Encode three characters starting at index 4, and print out the counts and the resulting bytes. + Console::WriteLine( "Encoding the characters from index 4 through 6:" ); + PrintCountsAndBytes( myStr, 4, 3, u7 ); + PrintCountsAndBytes( myStr, 4, 3, u8 ); + PrintCountsAndBytes( myStr, 4, 3, u16LE ); + PrintCountsAndBytes( myStr, 4, 3, u16BE ); + PrintCountsAndBytes( myStr, 4, 3, u32 ); +} + +void PrintCountsAndBytes( String^ s, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-30} :", enc ); + + // Display the exact byte count. + int iBC = enc->GetByteCount( s ); + Console::Write( " {0,-3}", iBC ); + + // Display the maximum byte count. + int iMBC = enc->GetMaxByteCount( s->Length ); + Console::Write( " {0,-3} :", iMBC ); + + // Encode the entire string. + array^bytes = enc->GetBytes( s ); + + // Display all the encoded bytes. + PrintHexBytes( bytes ); +} + +void PrintCountsAndBytes( String^ s, int index, int count, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-30} :", enc ); + + // Display the exact byte count. + int iBC = enc->GetByteCount( s->ToCharArray(), index, count ); + Console::Write( " {0,-3}", iBC ); + + // Display the maximum byte count. + int iMBC = enc->GetMaxByteCount( count ); + Console::Write( " {0,-3} :", iMBC ); + + // Encode a range of characters in the string. + array^bytes = gcnew array(iBC); + enc->GetBytes( s, index, count, bytes, bytes->GetLowerBound( 0 ) ); + + // Display all the encoded bytes. + PrintHexBytes( bytes ); +} + +void PrintHexBytes( array^bytes ) +{ + if ( (bytes == nullptr) || (bytes->Length == 0) ) + Console::WriteLine( "" ); + else + { + for ( int i = 0; i < bytes->Length; i++ ) + Console::Write( "{0:X2} ", bytes[ i ] ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +Encoding the entire string: +System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D +System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF +System.Text.UnicodeEncoding : 14 16 :7A 00 61 00 06 03 FD 01 B2 03 FF D8 FF DC +System.Text.UnicodeEncoding : 14 16 :00 7A 00 61 03 06 01 FD 03 B2 D8 FF DC FF +System.Text.UTF32Encoding : 24 32 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 + +Encoding the characters from index 4 through 6: +System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D +System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF +System.Text.UnicodeEncoding : 6 8 :B2 03 FF D8 FF DC +System.Text.UnicodeEncoding : 6 8 :03 B2 D8 FF DC FF +System.Text.UTF32Encoding : 8 16 :B2 03 00 00 FF FC 04 00 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp new file mode 100644 index 00000000000..14988aae74c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetChars/CPP/getchars.cpp @@ -0,0 +1,64 @@ + +// The following code example encodes a string into an array of bytes, +// and then decodes the bytes into an array of characters. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndChars( array^bytes, Encoding^ enc ); +int main() +{ + + // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order. + Encoding^ u32LE = Encoding::GetEncoding( "utf-32" ); + Encoding^ u32BE = Encoding::GetEncoding( "utf-32BE" ); + + // Use a string containing the following characters: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + String^ myStr = "za\u0306\u01FD\u03B2"; + + // Encode the string using the big-endian byte order. + array^barrBE = gcnew array(u32BE->GetByteCount( myStr )); + u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 ); + + // Encode the string using the little-endian byte order. + array^barrLE = gcnew array(u32LE->GetByteCount( myStr )); + u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 ); + + // Get the char counts, and decode the byte arrays. + Console::Write( "BE array with BE encoding : " ); + PrintCountsAndChars( barrBE, u32BE ); + Console::Write( "LE array with LE encoding : " ); + PrintCountsAndChars( barrLE, u32LE ); +} + +void PrintCountsAndChars( array^bytes, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-25} :", enc ); + + // Display the exact character count. + int iCC = enc->GetCharCount( bytes ); + Console::Write( " {0,-3}", iCC ); + + // Display the maximum character count. + int iMCC = enc->GetMaxCharCount( bytes->Length ); + Console::Write( " {0,-3} :", iMCC ); + + // Decode the bytes and display the characters. + array^chars = enc->GetChars( bytes ); + Console::WriteLine( chars ); +} + +/* +This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. + +BE array with BE encoding : System.Text.UTF32Encoding : 5 12 :zăǽβ +LE array with LE encoding : System.Text.UTF32Encoding : 5 12 :zăǽβ + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp new file mode 100644 index 00000000000..5d42df4246f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetCharsIC/CPP/getcharsic.cpp @@ -0,0 +1,69 @@ + +// The following code example encodes a string into an array of bytes, +// and then decodes a range of the bytes into an array of characters. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndChars( array^bytes, int index, int count, Encoding^ enc ); +int main() +{ + + // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order. + Encoding^ u32LE = Encoding::GetEncoding( "utf-32" ); + Encoding^ u32BE = Encoding::GetEncoding( "utf-32BE" ); + + // Use a string containing the following characters: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + String^ myStr = "za\u0306\u01FD\u03B2"; + + // Encode the string using the big-endian byte order. + array^barrBE = gcnew array(u32BE->GetByteCount( myStr )); + u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 ); + + // Encode the string using the little-endian byte order. + array^barrLE = gcnew array(u32LE->GetByteCount( myStr )); + u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 ); + + // Get the char counts, decode eight bytes starting at index 0, + // and print out the counts and the resulting bytes. + Console::Write( "BE array with BE encoding : " ); + PrintCountsAndChars( barrBE, 0, 8, u32BE ); + Console::Write( "LE array with LE encoding : " ); + PrintCountsAndChars( barrLE, 0, 8, u32LE ); +} + +void PrintCountsAndChars( array^bytes, int index, int count, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-25} :", enc ); + + // Display the exact character count. + int iCC = enc->GetCharCount( bytes, index, count ); + Console::Write( " {0,-3}", iCC ); + + // Display the maximum character count. + int iMCC = enc->GetMaxCharCount( count ); + Console::Write( " {0,-3} :", iMCC ); + + // Decode the bytes and display the characters. + array^chars = enc->GetChars( bytes, index, count ); + + // The following is an alternative way to decode the bytes: + // Char[] chars = new Char[iCC]; + // enc->GetChars( bytes, index, count, chars, 0 ); + Console::WriteLine( chars ); +} + +/* +This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. + +BE array with BE encoding : System.Text.UTF32Encoding : 2 6 :za +LE array with LE encoding : System.Text.UTF32Encoding : 2 6 :za + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp new file mode 100644 index 00000000000..8b3e3c0da25 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.GetPreamble Example/CPP/preamble.cpp @@ -0,0 +1,41 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + Encoding^ unicode = Encoding::Unicode; + + // Get the preamble for the Unicode encoder. + // In this case the preamblecontains the Byte order mark (BOM). + array^preamble = unicode->GetPreamble(); + + // Make sure a preamble was returned + // and is large enough to contain a BOM. + if ( preamble->Length >= 2 ) + { + + // if (preamble->Item[0] == 0xFE && preamble->Item[1] == 0xFF) + if ( preamble[ 0 ] == 0xFE && preamble[ 1 ] == 0xFF ) + { + Console::WriteLine( "The Unicode encoder is encoding in big-endian order." ); + } + // else if (preamble->Item[0] == 0xFF && preamble->Item[1] == 0xFE) + else + + // else if (preamble->Item[0] == 0xFF && preamble->Item[1] == 0xFE) + if ( preamble[ 0 ] == 0xFF && preamble[ 1 ] == 0xFE ) + { + Console::WriteLine( "The Unicode encoder is encoding in little-endian order." ); + } + } +} + +/* +This code produces the following output. + +The Unicode encoder is encoding in little-endian order. + +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp new file mode 100644 index 00000000000..79ba4ed7a77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.IsProps/CPP/isprops.cpp @@ -0,0 +1,173 @@ + +// The following code example checks the values of the Boolean properties of each encoding. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Print the header. + Console::Write( "CodePage identifier and name " ); + Console::Write( "BrDisp BrSave " ); + Console::Write( "MNDisp MNSave " ); + Console::WriteLine( "1-Byte ReadOnly " ); + + // For every encoding, get the property values. + System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EncodingInfo ^ ei = safe_cast(myEnum->Current); + Encoding^ e = ei->GetEncoding(); + Console::Write( "{0,-6} {1,-25} ", ei->CodePage, ei->Name ); + Console::Write( "{0,-8} {1,-8} ", e->IsBrowserDisplay, e->IsBrowserSave ); + Console::Write( "{0,-8} {1,-8} ", e->IsMailNewsDisplay, e->IsMailNewsSave ); + Console::WriteLine( "{0,-8} {1,-8} ", e->IsSingleByte, e->IsReadOnly ); + } +} + +/* +This code produces the following output. + +CodePage identifier and name BrDisp BrSave MNDisp MNSave 1-Byte ReadOnly +37 IBM037 False False False False True True +437 IBM437 False False False False True True +500 IBM500 False False False False True True +708 ASMO-708 True True False False True True +720 DOS-720 True True False False True True +737 ibm737 False False False False True True +775 ibm775 False False False False True True +850 ibm850 False False False False True True +852 ibm852 True True False False True True +855 IBM855 False False False False True True +857 ibm857 False False False False True True +858 IBM00858 False False False False True True +860 IBM860 False False False False True True +861 ibm861 False False False False True True +862 DOS-862 True True False False True True +863 IBM863 False False False False True True +864 IBM864 False False False False True True +865 IBM865 False False False False True True +866 cp866 True True False False True True +869 ibm869 False False False False True True +870 IBM870 False False False False True True +874 windows-874 True True True True True True +875 cp875 False False False False True True +932 shift_jis True True True True False True +936 gb2312 True True True True False True +949 ks_c_5601-1987 True True True True False True +950 big5 True True True True False True +1026 IBM1026 False False False False True True +1047 IBM01047 False False False False True True +1140 IBM01140 False False False False True True +1141 IBM01141 False False False False True True +1142 IBM01142 False False False False True True +1143 IBM01143 False False False False True True +1144 IBM01144 False False False False True True +1145 IBM01145 False False False False True True +1146 IBM01146 False False False False True True +1147 IBM01147 False False False False True True +1148 IBM01148 False False False False True True +1149 IBM01149 False False False False True True +1200 utf-16 False True False False False True +1201 unicodeFFFE False False False False False True +1250 windows-1250 True True True True True True +1251 windows-1251 True True True True True True +1252 Windows-1252 True True True True True True +1253 windows-1253 True True True True True True +1254 windows-1254 True True True True True True +1255 windows-1255 True True True True True True +1256 windows-1256 True True True True True True +1257 windows-1257 True True True True True True +1258 windows-1258 True True True True True True +1361 Johab False False False False False True +10000 macintosh False False False False True True +10001 x-mac-japanese False False False False False True +10002 x-mac-chinesetrad False False False False False True +10003 x-mac-korean False False False False False True +10004 x-mac-arabic False False False False True True +10005 x-mac-hebrew False False False False True True +10006 x-mac-greek False False False False True True +10007 x-mac-cyrillic False False False False True True +10008 x-mac-chinesesimp False False False False False True +10010 x-mac-romanian False False False False True True +10017 x-mac-ukrainian False False False False True True +10021 x-mac-thai False False False False True True +10029 x-mac-ce False False False False True True +10079 x-mac-icelandic False False False False True True +10081 x-mac-turkish False False False False True True +10082 x-mac-croatian False False False False True True +12000 utf-32 False False False False False True +12001 utf-32BE False False False False False True +20000 x-Chinese-CNS False False False False False True +20001 x-cp20001 False False False False False True +20002 x-Chinese-Eten False False False False False True +20003 x-cp20003 False False False False False True +20004 x-cp20004 False False False False False True +20005 x-cp20005 False False False False False True +20105 x-IA5 False False False False True True +20106 x-IA5-German False False False False True True +20107 x-IA5-Swedish False False False False True True +20108 x-IA5-Norwegian False False False False True True +20127 us-ascii False False True True True True +20261 x-cp20261 False False False False False True +20269 x-cp20269 False False False False True True +20273 IBM273 False False False False True True +20277 IBM277 False False False False True True +20278 IBM278 False False False False True True +20280 IBM280 False False False False True True +20284 IBM284 False False False False True True +20285 IBM285 False False False False True True +20290 IBM290 False False False False True True +20297 IBM297 False False False False True True +20420 IBM420 False False False False True True +20423 IBM423 False False False False True True +20424 IBM424 False False False False True True +20833 x-EBCDIC-KoreanExtended False False False False True True +20838 IBM-Thai False False False False True True +20866 koi8-r True True True True True True +20871 IBM871 False False False False True True +20880 IBM880 False False False False True True +20905 IBM905 False False False False True True +20924 IBM00924 False False False False True True +20932 EUC-JP False False False False False True +20936 x-cp20936 False False False False False True +20949 x-cp20949 False False False False False True +21025 cp1025 False False False False True True +21866 koi8-u True True True True True True +28591 iso-8859-1 True True True True True True +28592 iso-8859-2 True True True True True True +28593 iso-8859-3 False False True True True True +28594 iso-8859-4 True True True True True True +28595 iso-8859-5 True True True True True True +28596 iso-8859-6 True True True True True True +28597 iso-8859-7 True True True True True True +28598 iso-8859-8 True True False False True True +28599 iso-8859-9 True True True True True True +28603 iso-8859-13 False False True True True True +28605 iso-8859-15 False True True True True True +29001 x-Europa False False False False True True +38598 iso-8859-8-i True True True True True True +50220 iso-2022-jp False False True True False True +50221 csISO2022JP False True True True False True +50222 iso-2022-jp False False False False False True +50225 iso-2022-kr False False True False False True +50227 x-cp50227 False False False False False True +51932 euc-jp True True True True False True +51936 EUC-CN False False False False False True +51949 euc-kr False False True True False True +52936 hz-gb-2312 True True True True False True +54936 GB18030 True True True True False True +57002 x-iscii-de False False False False False True +57003 x-iscii-be False False False False False True +57004 x-iscii-ta False False False False False True +57005 x-iscii-te False False False False False True +57006 x-iscii-as False False False False False True +57007 x-iscii-or False False False False False True +57008 x-iscii-ka False False False False False True +57009 x-iscii-ma False False False False False True +57010 x-iscii-gu False False False False False True +57011 x-iscii-pa False False False False False True +65001 utf-8 True True True True False True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp new file mode 100644 index 00000000000..53f98f67454 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.Names/CPP/names.cpp @@ -0,0 +1,52 @@ + +// The following code example retrieves the different names for each encoding +// and displays the encodings with one or more names that are different from EncodingInfo.Name. +// It displays EncodingName but does not compare against it. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Print the header. + Console::Write( "Name " ); + Console::Write( "CodePage " ); + Console::Write( "BodyName " ); + Console::Write( "HeaderName " ); + Console::Write( "WebName " ); + Console::WriteLine( "Encoding.EncodingName" ); + + // For every encoding, compare the name properties with EncodingInfo.Name. + // Display only the encodings that have one or more different names. + System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EncodingInfo ^ ei = safe_cast(myEnum->Current); + Encoding^ e = ei->GetEncoding(); + if ( !ei->Name->Equals( e->BodyName ) || !ei->Name->Equals( e->HeaderName ) || !ei->Name->Equals( e->WebName ) ) + { + Console::Write( "{0,-18} ", ei->Name ); + Console::Write( "{0,-9} ", e->CodePage ); + Console::Write( "{0,-18} ", e->BodyName ); + Console::Write( "{0,-18} ", e->HeaderName ); + Console::Write( "{0,-18} ", e->WebName ); + Console::WriteLine( "{0} ", e->EncodingName ); + } + } +} + +/* +This code produces the following output. + +Name CodePage BodyName HeaderName WebName Encoding.EncodingName +shift_jis 932 iso-2022-jp iso-2022-jp shift_jis Japanese (Shift-JIS) +windows-1250 1250 iso-8859-2 windows-1250 windows-1250 Central European (Windows) +windows-1251 1251 koi8-r windows-1251 windows-1251 Cyrillic (Windows) +Windows-1252 1252 iso-8859-1 Windows-1252 Windows-1252 Western European (Windows) +windows-1253 1253 iso-8859-7 windows-1253 windows-1253 Greek (Windows) +windows-1254 1254 iso-8859-9 windows-1254 windows-1254 Turkish (Windows) +csISO2022JP 50221 iso-2022-jp iso-2022-jp csISO2022JP Japanese (JIS-Allow 1 byte Kana) +iso-2022-kr 50225 iso-2022-kr euc-kr iso-2022-kr Korean (ISO) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp new file mode 100644 index 00000000000..7b3357371c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.Encoding.WebName/CPP/webname.cpp @@ -0,0 +1,39 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Web; +int main() +{ + + // Use UTF8 encoding. + Encoding^ encoding = Encoding::UTF8; + StreamWriter^ writer = gcnew StreamWriter( "Encoding.html",false,encoding ); + writer->WriteLine( "" ); + + // Write charset attribute to the html file. + // writer -> WriteLine(S""); + writer->WriteLine( String::Concat( "" ) ); + writer->WriteLine( "" ); + writer->WriteLine( "

{0}

", HttpUtility::HtmlEncode( encoding->EncodingName ) ); + writer->WriteLine( "" ); + writer->Flush(); + writer->Close(); +} + +/* +This code produces the following output in an HTML file. + + + + +

Unicode (UTF-8)

+ + +*/ +//
diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp new file mode 100644 index 00000000000..60ac3dd0f2b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.EncodingInfo/CPP/encodinginfo.cpp @@ -0,0 +1,188 @@ + +// The following code example retrieves the different names for each encoding +// and compares them with the equivalent Encoding names. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Print the header. + Console::Write( "Info.CodePage " ); + Console::Write( "Info.Name " ); + Console::Write( "Info.DisplayName" ); + Console::WriteLine(); + + // Display the EncodingInfo names for every encoding, and compare with the equivalent Encoding names. + System::Collections::IEnumerator^ myEnum = Encoding::GetEncodings()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EncodingInfo ^ ei = safe_cast(myEnum->Current); + Encoding^ e = ei->GetEncoding(); + Console::Write( "{0,-15}", ei->CodePage ); + if ( ei->CodePage == e->CodePage ) + Console::Write( " " ); + else + Console::Write( "*** " ); + Console::Write( "{0,-25}", ei->Name ); + if ( ei->CodePage == e->CodePage ) + Console::Write( " " ); + else + Console::Write( "*** " ); + Console::Write( "{0,-25}", ei->DisplayName ); + if ( ei->CodePage == e->CodePage ) + Console::Write( " " ); + else + Console::Write( "*** " ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +Info.CodePage Info.Name Info.DisplayName +37 IBM037 IBM EBCDIC (US-Canada) +437 IBM437 OEM United States +500 IBM500 IBM EBCDIC (International) +708 ASMO-708 Arabic (ASMO 708) +720 DOS-720 Arabic (DOS) +737 ibm737 Greek (DOS) +775 ibm775 Baltic (DOS) +850 ibm850 Western European (DOS) +852 ibm852 Central European (DOS) +855 IBM855 OEM Cyrillic +857 ibm857 Turkish (DOS) +858 IBM00858 OEM Multilingual Latin I +860 IBM860 Portuguese (DOS) +861 ibm861 Icelandic (DOS) +862 DOS-862 Hebrew (DOS) +863 IBM863 French Canadian (DOS) +864 IBM864 Arabic (864) +865 IBM865 Nordic (DOS) +866 cp866 Cyrillic (DOS) +869 ibm869 Greek, Modern (DOS) +870 IBM870 IBM EBCDIC (Multilingual Latin-2) +874 windows-874 Thai (Windows) +875 cp875 IBM EBCDIC (Greek Modern) +932 shift_jis Japanese (Shift-JIS) +936 gb2312 Chinese Simplified (GB2312) +949 ks_c_5601-1987 Korean +950 big5 Chinese Traditional (Big5) +1026 IBM1026 IBM EBCDIC (Turkish Latin-5) +1047 IBM01047 IBM Latin-1 +1140 IBM01140 IBM EBCDIC (US-Canada-Euro) +1141 IBM01141 IBM EBCDIC (Germany-Euro) +1142 IBM01142 IBM EBCDIC (Denmark-Norway-Euro) +1143 IBM01143 IBM EBCDIC (Finland-Sweden-Euro) +1144 IBM01144 IBM EBCDIC (Italy-Euro) +1145 IBM01145 IBM EBCDIC (Spain-Euro) +1146 IBM01146 IBM EBCDIC (UK-Euro) +1147 IBM01147 IBM EBCDIC (France-Euro) +1148 IBM01148 IBM EBCDIC (International-Euro) +1149 IBM01149 IBM EBCDIC (Icelandic-Euro) +1200 utf-16 Unicode +1201 unicodeFFFE Unicode (Big-Endian) +1250 windows-1250 Central European (Windows) +1251 windows-1251 Cyrillic (Windows) +1252 Windows-1252 Western European (Windows) +1253 windows-1253 Greek (Windows) +1254 windows-1254 Turkish (Windows) +1255 windows-1255 Hebrew (Windows) +1256 windows-1256 Arabic (Windows) +1257 windows-1257 Baltic (Windows) +1258 windows-1258 Vietnamese (Windows) +1361 Johab Korean (Johab) +10000 macintosh Western European (Mac) +10001 x-mac-japanese Japanese (Mac) +10002 x-mac-chinesetrad Chinese Traditional (Mac) +10003 x-mac-korean Korean (Mac) +10004 x-mac-arabic Arabic (Mac) +10005 x-mac-hebrew Hebrew (Mac) +10006 x-mac-greek Greek (Mac) +10007 x-mac-cyrillic Cyrillic (Mac) +10008 x-mac-chinesesimp Chinese Simplified (Mac) +10010 x-mac-romanian Romanian (Mac) +10017 x-mac-ukrainian Ukrainian (Mac) +10021 x-mac-thai Thai (Mac) +10029 x-mac-ce Central European (Mac) +10079 x-mac-icelandic Icelandic (Mac) +10081 x-mac-turkish Turkish (Mac) +10082 x-mac-croatian Croatian (Mac) +12000 utf-32 Unicode (UTF-32) +12001 utf-32BE Unicode (UTF-32 Big-Endian) +20000 x-Chinese-CNS Chinese Traditional (CNS) +20001 x-cp20001 TCA Taiwan +20002 x-Chinese-Eten Chinese Traditional (Eten) +20003 x-cp20003 IBM5550 Taiwan +20004 x-cp20004 TeleText Taiwan +20005 x-cp20005 Wang Taiwan +20105 x-IA5 Western European (IA5) +20106 x-IA5-German German (IA5) +20107 x-IA5-Swedish Swedish (IA5) +20108 x-IA5-Norwegian Norwegian (IA5) +20127 us-ascii US-ASCII +20261 x-cp20261 T.61 +20269 x-cp20269 ISO-6937 +20273 IBM273 IBM EBCDIC (Germany) +20277 IBM277 IBM EBCDIC (Denmark-Norway) +20278 IBM278 IBM EBCDIC (Finland-Sweden) +20280 IBM280 IBM EBCDIC (Italy) +20284 IBM284 IBM EBCDIC (Spain) +20285 IBM285 IBM EBCDIC (UK) +20290 IBM290 IBM EBCDIC (Japanese katakana) +20297 IBM297 IBM EBCDIC (France) +20420 IBM420 IBM EBCDIC (Arabic) +20423 IBM423 IBM EBCDIC (Greek) +20424 IBM424 IBM EBCDIC (Hebrew) +20833 x-EBCDIC-KoreanExtended IBM EBCDIC (Korean Extended) +20838 IBM-Thai IBM EBCDIC (Thai) +20866 koi8-r Cyrillic (KOI8-R) +20871 IBM871 IBM EBCDIC (Icelandic) +20880 IBM880 IBM EBCDIC (Cyrillic Russian) +20905 IBM905 IBM EBCDIC (Turkish) +20924 IBM00924 IBM Latin-1 +20932 EUC-JP Japanese (JIS 0208-1990 and 0212-1990) +20936 x-cp20936 Chinese Simplified (GB2312-80) +20949 x-cp20949 Korean Wansung +21025 cp1025 IBM EBCDIC (Cyrillic Serbian-Bulgarian) +21866 koi8-u Cyrillic (KOI8-U) +28591 iso-8859-1 Western European (ISO) +28592 iso-8859-2 Central European (ISO) +28593 iso-8859-3 Latin 3 (ISO) +28594 iso-8859-4 Baltic (ISO) +28595 iso-8859-5 Cyrillic (ISO) +28596 iso-8859-6 Arabic (ISO) +28597 iso-8859-7 Greek (ISO) +28598 iso-8859-8 Hebrew (ISO-Visual) +28599 iso-8859-9 Turkish (ISO) +28603 iso-8859-13 Estonian (ISO) +28605 iso-8859-15 Latin 9 (ISO) +29001 x-Europa Europa +38598 iso-8859-8-i Hebrew (ISO-Logical) +50220 iso-2022-jp Japanese (JIS) +50221 csISO2022JP Japanese (JIS-Allow 1 byte Kana) +50222 iso-2022-jp Japanese (JIS-Allow 1 byte Kana - SO/SI) +50225 iso-2022-kr Korean (ISO) +50227 x-cp50227 Chinese Simplified (ISO-2022) +51932 euc-jp Japanese (EUC) +51936 EUC-CN Chinese Simplified (EUC) +51949 euc-kr Korean (EUC) +52936 hz-gb-2312 Chinese Simplified (HZ) +54936 GB18030 Chinese Simplified (GB18030) +57002 x-iscii-de ISCII Devanagari +57003 x-iscii-be ISCII Bengali +57004 x-iscii-ta ISCII Tamil +57005 x-iscii-te ISCII Telugu +57006 x-iscii-as ISCII Assamese +57007 x-iscii-or ISCII Oriya +57008 x-iscii-ka ISCII Kannada +57009 x-iscii-ma ISCII Malayalam +57010 x-iscii-gu ISCII Gujarati +57011 x-iscii-pa ISCII Punjabi +65000 utf-7 Unicode (UTF-7) +65001 utf-8 Unicode (UTF-8) + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp new file mode 100644 index 00000000000..b70e9f7092d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.StringBuilder.Constructors/CPP/constructors.cpp @@ -0,0 +1,127 @@ +// This sample demonstrates how to use each member of the StringBuilder class. +// +using namespace System; +using namespace System::Text; + +ref class Constructors +{ +public: + static void Main() + { + ConstructorWithNothing(); + ConstructorWithCapacity(); + ConstructorWithString(); + ConstructorWithCapacityAndMax(); + ConstructorWithSubstring(); + ConstructorWithStringAndMax(); + + Console::Write( L"This sample completed successfully; " ); + Console::WriteLine( L"press Enter to exit." ); + Console::ReadLine(); + } + +private: + static void ConstructorWithNothing() + { + // Initialize a new StringBuilder object. + // + StringBuilder^ stringBuilder = gcnew StringBuilder; + // + } + + static void ConstructorWithCapacity() + { + // Initialize a new StringBuilder object with the specified capacity. + // + int capacity = 255; + StringBuilder^ stringBuilder = gcnew StringBuilder( capacity ); + // + } + + static void ConstructorWithString() + { + // Initialize a new StringBuilder object with the specified string. + // + String^ initialString = L"Initial string."; + StringBuilder^ stringBuilder = gcnew StringBuilder( initialString ); + // + } + + static void ConstructorWithCapacityAndMax() + { + // Initialize a new StringBuilder object with the specified capacity + // and maximum capacity. + // + int capacity = 255; + int maxCapacity = 1024; + StringBuilder^ stringBuilder = gcnew StringBuilder( capacity,maxCapacity ); + // + } + + static void ConstructorWithSubstring() + { + // Initialize a new StringBuilder object with the specified substring. + // + String^ initialString = L"Initial string for stringbuilder."; + int startIndex = 0; + int substringLength = 14; + int capacity = 255; + StringBuilder^ stringBuilder = gcnew StringBuilder( + initialString,startIndex,substringLength,capacity ); + // + } + + static void ConstructorWithStringAndMax() + { + // Initialize a new StringBuilder object with the specified string + // and maximum capacity. + // + String^ initialString = L"Initial string. "; + int capacity = 255; + StringBuilder^ stringBuilder = gcnew StringBuilder( + initialString,capacity ); + // + + // Ensure that appending the specified string will not exceed the + // maximum capacity of the object. + // + String^ phraseToAdd = L"Sentence to be appended."; + if ( (stringBuilder->Length + phraseToAdd->Length) <= + stringBuilder->MaxCapacity ) + { + stringBuilder->Append( phraseToAdd ); + } + // + + // Retrieve the string value of the StringBuilder object. + // + String^ builderResults = stringBuilder->ToString(); + // + + // Retrieve the last 10 characters of the StringBuilder object. + // + int sentenceLength = 10; + int startPosition = stringBuilder->Length - sentenceLength; + String^ endPhrase = stringBuilder->ToString( startPosition, + sentenceLength ); + // + + // Retrieve the last character of the StringBuilder object. + // + int lastCharacterPosition = stringBuilder->Length - 1; + char lastCharacter = static_cast( + stringBuilder->default[ lastCharacterPosition ] ); + // + } +}; + +int main() +{ + Constructors::Main(); +} + +// +// This sample produces the following output: +// +// This sample completed successfully; press Enter to exit. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp new file mode 100644 index 00000000000..86fc73cb09c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.EncDec/CPP/encdec.cpp @@ -0,0 +1,56 @@ + +// The following code example uses an encoder and a decoder to encode a string into an array of bytes, +// and then decode the bytes into an array of characters. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Get an encoder and a decoder from UTF32Encoding. + UTF32Encoding ^ u32 = gcnew UTF32Encoding( false,true,true ); + Encoder^ myEnc = u32->GetEncoder(); + Decoder^ myDec = u32->GetDecoder(); + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + array^myChars = gcnew array(5){ + L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2' + }; + Console::Write( "The original characters : " ); + Console::WriteLine( myChars ); + + // Encode the character array. + int iBC = myEnc->GetByteCount( myChars, 0, myChars.Length, true ); + array^myBytes = gcnew array(iBC); + myEnc->GetBytes( myChars, 0, myChars.Length, myBytes, 0, true ); + + // Print the resulting bytes. + Console::Write( "Using the encoder : " ); + for ( int i = 0; i < myBytes.Length; i++ ) + Console::Write( "{0:X2} ", myBytes[ i ] ); + Console::WriteLine(); + + // Decode the byte array back into an array of characters. + int iCC = myDec->GetCharCount( myBytes, 0, myBytes.Length, true ); + array^myDecodedChars = gcnew array(iCC); + myDec->GetChars( myBytes, 0, myBytes.Length, myDecodedChars, 0, true ); + + // Print the resulting characters. + Console::Write( "Using the decoder : " ); + Console::WriteLine( myDecodedChars ); +} + +/* +This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. + +The original characters : za?? +Using the encoder : 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 +Using the decoder : za?? + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp new file mode 100644 index 00000000000..a627b7388d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.Equals/CPP/equals.cpp @@ -0,0 +1,94 @@ + +// The following code example creates instances of the UTF32Encoding class using different parameter values and then checks them for equality. +// +using namespace System; +using namespace System::Text; +void CompareEncodings( UTF32Encoding ^ a, String^ name ); +int main() +{ + + // Create different instances of UTF32Encoding. + UTF32Encoding ^ u32 = gcnew UTF32Encoding; + UTF32Encoding ^ u32tt = gcnew UTF32Encoding( true,true ); + UTF32Encoding ^ u32tf = gcnew UTF32Encoding( true,false ); + UTF32Encoding ^ u32ft = gcnew UTF32Encoding( false,true ); + UTF32Encoding ^ u32ff = gcnew UTF32Encoding( false,false ); + + // Compare these instances with instances created using the ctor with three parameters. + CompareEncodings( u32, "u32 " ); + CompareEncodings( u32tt, "u32tt" ); + CompareEncodings( u32tf, "u32tf" ); + CompareEncodings( u32ft, "u32ft" ); + CompareEncodings( u32ff, "u32ff" ); +} + +void CompareEncodings( UTF32Encoding ^ a, String^ name ) +{ + + // Create different instances of UTF32Encoding using the ctor with three parameters. + UTF32Encoding ^ u32ttt = gcnew UTF32Encoding( true,true,true ); + UTF32Encoding ^ u32ttf = gcnew UTF32Encoding( true,true,false ); + UTF32Encoding ^ u32tft = gcnew UTF32Encoding( true,false,true ); + UTF32Encoding ^ u32tff = gcnew UTF32Encoding( true,false,false ); + UTF32Encoding ^ u32ftt = gcnew UTF32Encoding( false,true,true ); + UTF32Encoding ^ u32ftf = gcnew UTF32Encoding( false,true,false ); + UTF32Encoding ^ u32fft = gcnew UTF32Encoding( false,false,true ); + UTF32Encoding ^ u32fff = gcnew UTF32Encoding( false,false,false ); + + // Compare the specified instance with each of the instances that were just created. + Console::WriteLine( "{0} and u32ttt : {1}", name, a->Equals( u32ttt ) ); + Console::WriteLine( "{0} and u32ttf : {1}", name, a->Equals( u32ttf ) ); + Console::WriteLine( "{0} and u32tft : {1}", name, a->Equals( u32tft ) ); + Console::WriteLine( "{0} and u32tff : {1}", name, a->Equals( u32tff ) ); + Console::WriteLine( "{0} and u32ftt : {1}", name, a->Equals( u32ftt ) ); + Console::WriteLine( "{0} and u32ftf : {1}", name, a->Equals( u32ftf ) ); + Console::WriteLine( "{0} and u32fft : {1}", name, a->Equals( u32fft ) ); + Console::WriteLine( "{0} and u32fff : {1}", name, a->Equals( u32fff ) ); +} + +/* +This code produces the following output. + +u32 vs u32ttt : False +u32 vs u32ttf : False +u32 vs u32tft : False +u32 vs u32tff : False +u32 vs u32ftt : False +u32 vs u32ftf : False +u32 vs u32fft : False +u32 vs u32fff : True +u32tt vs u32ttt : False +u32tt vs u32ttf : True +u32tt vs u32tft : False +u32tt vs u32tff : False +u32tt vs u32ftt : False +u32tt vs u32ftf : False +u32tt vs u32fft : False +u32tt vs u32fff : False +u32tf vs u32ttt : False +u32tf vs u32ttf : False +u32tf vs u32tft : False +u32tf vs u32tff : True +u32tf vs u32ftt : False +u32tf vs u32ftf : False +u32tf vs u32fft : False +u32tf vs u32fff : False +u32ft vs u32ttt : False +u32ft vs u32ttf : False +u32ft vs u32tft : False +u32ft vs u32tff : False +u32ft vs u32ftt : False +u32ft vs u32ftf : True +u32ft vs u32fft : False +u32ft vs u32fff : False +u32ff vs u32ttt : False +u32ff vs u32ttf : False +u32ff vs u32tft : False +u32ff vs u32tff : False +u32ff vs u32ftt : False +u32ff vs u32ftf : False +u32ff vs u32fft : False +u32ff vs u32fff : True + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp new file mode 100644 index 00000000000..c1436193d7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.ErrorDetection/CPP/errordetection.cpp @@ -0,0 +1,70 @@ + +// The following code example demonstrates the behavior of UTF32Encoding with error detection enabled and without. +// +using namespace System; +using namespace System::Text; +void PrintDecodedString( array^bytes, Encoding^ enc ); +int main() +{ + + // Create an instance of UTF32Encoding using little-endian byte order. + // This will be used for encoding. + UTF32Encoding^ u32LE = gcnew UTF32Encoding( false,true ); + + // Create two instances of UTF32Encoding using big-endian byte order: one with error detection and one without. + // These will be used for decoding. + UTF32Encoding^ u32withED = gcnew UTF32Encoding( true,true,true ); + UTF32Encoding^ u32noED = gcnew UTF32Encoding( true,true,false ); + + // Create byte arrays from the same string containing the following characters: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; + + // Encode the string using little-endian byte order. + array^myBytes = gcnew array(u32LE->GetByteCount( myStr )); + u32LE->GetBytes( myStr, 0, myStr->Length, myBytes, 0 ); + + // Decode the byte array with error detection. + Console::WriteLine( "Decoding with error detection:" ); + PrintDecodedString( myBytes, u32withED ); + + // Decode the byte array without error detection. + Console::WriteLine( "Decoding without error detection:" ); + PrintDecodedString( myBytes, u32noED ); +} + + +// Decode the bytes and display the string. +void PrintDecodedString( array^bytes, Encoding^ enc ) +{ + try + { + Console::WriteLine( " Decoded string: {0}", enc->GetString( bytes, 0, bytes->Length ) ); + } + catch ( System::ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + Console::WriteLine(); +} + +// +/* +This code produces the following output. + +Decoding with error detection: +System.ArgumentException: Invalid byte was found at byte index 3. + at System.Text.UTF32Encoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder) + at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding) + at System.Text.UTF32Encoding.GetString(Byte[] bytes, Int32 index, Int32 count) + at SamplesUTF32Encoding.PrintDecodedString(Byte[] bytes, Encoding enc) + +Decoding without error detection: + Decoded string: + +*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp new file mode 100644 index 00000000000..019b60c8871 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_CharArr/CPP/getbytes_chararr.cpp @@ -0,0 +1,87 @@ + +// The following code example determines the number of bytes required to encode three characters from a character array, +// then encodes the characters and displays the resulting bytes. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ); +void PrintHexBytes( array^bytes ); +int main() +{ + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + // a high-surrogate value (U+D8FF) + // a low-surrogate value (U+DCFF) + array^myChars = gcnew array(7){ + L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2',L'\xD8FF',L'\xDCFF' + }; + + // Create instances of different encodings. + UTF7Encoding^ u7 = gcnew UTF7Encoding; + UTF8Encoding^ u8Nobom = gcnew UTF8Encoding( false,true ); + UTF8Encoding^ u8Bom = gcnew UTF8Encoding( true,true ); + UTF32Encoding ^ u32Nobom = gcnew UTF32Encoding( false,false,true ); + UTF32Encoding ^ u32Bom = gcnew UTF32Encoding( false,true,true ); + + // Encode three characters starting at index 4 and print out the counts and the resulting bytes. + PrintCountsAndBytes( myChars, 4, 3, u7 ); + PrintCountsAndBytes( myChars, 4, 3, u8Nobom ); + PrintCountsAndBytes( myChars, 4, 3, u8Bom ); + PrintCountsAndBytes( myChars, 4, 3, u32Nobom ); + PrintCountsAndBytes( myChars, 4, 3, u32Bom ); +} + +void PrintCountsAndBytes( array^chars, int index, int count, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-25} :", enc ); + + // Display the exact byte count. + int iBC = enc->GetByteCount( chars, index, count ); + Console::Write( " {0,-3}", iBC ); + + // Display the maximum byte count. + int iMBC = enc->GetMaxByteCount( count ); + Console::Write( " {0,-3} :", iMBC ); + + // Get the byte order mark, if any. + array^preamble = enc->GetPreamble(); + + // Combine the preamble and the encoded bytes. + array^bytes = gcnew array(preamble->Length + iBC); + Array::Copy( preamble, bytes, preamble->Length ); + enc->GetBytes( chars, index, count, bytes, preamble->Length ); + + // Display all the encoded bytes. + PrintHexBytes( bytes ); +} + +void PrintHexBytes( array^bytes ) +{ + if ( (bytes == nullptr) || (bytes->Length == 0) ) + Console::WriteLine( "" ); + else + { + for ( int i = 0; i < bytes->Length; i++ ) + Console::Write( "{0:X2} ", bytes[ i ] ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +System.Text.UTF7Encoding : 10 11 :2B 41 37 4C 59 2F 39 7A 2F 2D +System.Text.UTF8Encoding : 6 12 :CE B2 F1 8F B3 BF +System.Text.UTF8Encoding : 6 12 :EF BB BF CE B2 F1 8F B3 BF +System.Text.UTF32Encoding : 8 12 :B2 03 00 00 FF FC 04 00 +System.Text.UTF32Encoding : 8 12 :FF FE 00 00 B2 03 00 00 FF FC 04 00 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp new file mode 100644 index 00000000000..d554ef4eb8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetBytes_String/CPP/getbytes_string.cpp @@ -0,0 +1,85 @@ + +// The following code example determines the number of bytes required to encode a string, +// then encodes the string and displays the resulting bytes. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndBytes( String^ s, Encoding^ enc ); +void PrintHexBytes( array^bytes ); +int main() +{ + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + // a high-surrogate value (U+D8FF) + // a low-surrogate value (U+DCFF) + String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; + + // Create instances of different encodings. + UTF7Encoding^ u7 = gcnew UTF7Encoding; + UTF8Encoding^ u8Nobom = gcnew UTF8Encoding( false,true ); + UTF8Encoding^ u8Bom = gcnew UTF8Encoding( true,true ); + UTF32Encoding ^ u32Nobom = gcnew UTF32Encoding( false,false,true ); + UTF32Encoding ^ u32Bom = gcnew UTF32Encoding( false,true,true ); + + // Get the byte counts and the bytes. + PrintCountsAndBytes( myStr, u7 ); + PrintCountsAndBytes( myStr, u8Nobom ); + PrintCountsAndBytes( myStr, u8Bom ); + PrintCountsAndBytes( myStr, u32Nobom ); + PrintCountsAndBytes( myStr, u32Bom ); +} + +void PrintCountsAndBytes( String^ s, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-25} :", enc ); + + // Display the exact byte count. + int iBC = enc->GetByteCount( s ); + Console::Write( " {0,-3}", iBC ); + + // Display the maximum byte count. + int iMBC = enc->GetMaxByteCount( s->Length ); + Console::Write( " {0,-3} :", iMBC ); + + // Get the byte order mark, if any. + array^preamble = enc->GetPreamble(); + + // Combine the preamble and the encoded bytes. + array^bytes = gcnew array(preamble->Length + iBC); + Array::Copy( preamble, bytes, preamble->Length ); + enc->GetBytes( s, 0, s->Length, bytes, preamble->Length ); + + // Display all the encoded bytes. + PrintHexBytes( bytes ); +} + +void PrintHexBytes( array^bytes ) +{ + if ( (bytes == nullptr) || (bytes->Length == 0) ) + Console::WriteLine( "" ); + else + { + for ( int i = 0; i < bytes->Length; i++ ) + Console::Write( "{0:X2} ", bytes[ i ] ); + Console::WriteLine(); + } +} + +/* +This code produces the following output. + +System.Text.UTF7Encoding : 18 23 :7A 61 2B 41 77 59 42 2F 51 4F 79 32 50 2F 63 2F 77 2D +System.Text.UTF8Encoding : 12 24 :7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF +System.Text.UTF8Encoding : 12 24 :EF BB BF 7A 61 CC 86 C7 BD CE B2 F1 8F B3 BF +System.Text.UTF32Encoding : 24 28 :7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 +System.Text.UTF32Encoding : 24 28 :FF FE 00 00 7A 00 00 00 61 00 00 00 06 03 00 00 FD 01 00 00 B2 03 00 00 FF FC 04 00 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp new file mode 100644 index 00000000000..beeadd8f48b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetChars/CPP/getchars.cpp @@ -0,0 +1,88 @@ + +// The following code example encodes a string into an array of bytes, and then decodes the bytes into an array of characters. +// +using namespace System; +using namespace System::Text; +void PrintCountsAndChars( array^bytes, Encoding^ enc ); +int main() +{ + + // Create two instances of UTF32Encoding: one with little-endian byte order and one with big-endian byte order. + UTF32Encoding^ u32LE = gcnew UTF32Encoding( false,true,true ); + UTF32Encoding^ u32BE = gcnew UTF32Encoding( true,true,true ); + + // Create byte arrays from the same string containing the following characters: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + String^ myStr = L"za\u0306\u01FD\u03B2\xD8FF\xDCFF"; + + // barrBE uses the big-endian byte order. + array^barrBE = gcnew array(u32BE->GetByteCount( myStr )); + u32BE->GetBytes( myStr, 0, myStr->Length, barrBE, 0 ); + + // barrLE uses the little-endian byte order. + array^barrLE = gcnew array(u32LE->GetByteCount( myStr )); + u32LE->GetBytes( myStr, 0, myStr->Length, barrLE, 0 ); + + // Get the char counts and decode the byte arrays. + Console::Write( "BE array with BE encoding : " ); + PrintCountsAndChars( barrBE, u32BE ); + Console::Write( "LE array with LE encoding : " ); + PrintCountsAndChars( barrLE, u32LE ); + + // Decode the byte arrays using an encoding with a different byte order. + Console::Write( "BE array with LE encoding : " ); + try + { + PrintCountsAndChars( barrBE, u32LE ); + } + catch ( System::ArgumentException^ e ) + { + Console::WriteLine( e->Message ); + } + + Console::Write( "LE array with BE encoding : " ); + try + { + PrintCountsAndChars( barrLE, u32BE ); + } + catch ( System::ArgumentException^ e ) + { + Console::WriteLine( e->Message ); + } + +} + +void PrintCountsAndChars( array^bytes, Encoding^ enc ) +{ + + // Display the name of the encoding used. + Console::Write( "{0,-25} :", enc ); + + // Display the exact character count. + int iCC = enc->GetCharCount( bytes ); + Console::Write( " {0,-3}", iCC ); + + // Display the maximum character count. + int iMCC = enc->GetMaxCharCount( bytes->Length ); + Console::Write( " {0,-3} :", iMCC ); + + // Decode the bytes and display the characters. + array^chars = gcnew array(iCC); + enc->GetChars( bytes, 0, bytes->Length, chars, 0 ); + Console::WriteLine( chars ); +} + +/* +This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. + +BE array with BE encoding : System.Text.UTF32Encoding : 7 14 :za??ß? +LE array with LE encoding : System.Text.UTF32Encoding : 7 14 :za??ß? +BE array with LE encoding : System.Text.UTF32Encoding :Invalid byte was found at byte index 3. +LE array with BE encoding : System.Text.UTF32Encoding :Invalid byte was found at byte index 3. + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp new file mode 100644 index 00000000000..9d05673135c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF32Encoding.GetPreamble/CPP/getpreamble.cpp @@ -0,0 +1,44 @@ + +// The following code example retrieves and displays the byte order mark for different UTF32Encoding instances. +// +using namespace System; +using namespace System::Text; + +void PrintHexBytes( array^bytes ); + +int main() +{ + + // Create instances of UTF32Encoding, with the byte order mark and without. + UTF32Encoding ^ u32LeNone = gcnew UTF32Encoding; + UTF32Encoding ^ u32BeNone = gcnew UTF32Encoding( true,false ); + UTF32Encoding ^ u32LeBom = gcnew UTF32Encoding( false,true ); + UTF32Encoding ^ u32BeBom = gcnew UTF32Encoding( true,true ); + + // Display the preamble for each instance. + PrintHexBytes( u32LeNone->GetPreamble() ); + PrintHexBytes( u32BeNone->GetPreamble() ); + PrintHexBytes( u32LeBom->GetPreamble() ); + PrintHexBytes( u32BeBom->GetPreamble() ); +} + +void PrintHexBytes( array^bytes ) +{ + if ( (bytes == nullptr) || (bytes->Length == 0) ) + Console::WriteLine( "" ); + else + { + for ( int i = 0; i < bytes->Length; i++ ) + Console::Write( "{0:X2} ", bytes[ i ] ); + Console::WriteLine(); + } +} + +/* +This example displays the following output: + FF FE 00 00 + + FF FE 00 00 + 00 00 FE FF +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp new file mode 100644 index 00000000000..c84f8ce2a84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding Example/CPP/snippet.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + + // Create a UTF-7 encoding. + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + + // A Unicode string with two characters outside a 7-bit code range. + String^ unicodeString = L"This Unicode string contains two characters with codes outside a 7-bit code range, Pi (\u03a0) and Sigma (\u03a3)."; + Console::WriteLine( "Original string:" ); + Console::WriteLine( unicodeString ); + + // Encode the string. + array^encodedBytes = utf7->GetBytes( unicodeString ); + Console::WriteLine(); + Console::WriteLine( "Encoded bytes:" ); + IEnumerator^ myEnum = encodedBytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); + + // Decode bytes back to string. + // Notice Pi and Sigma characters are still present. + String^ decodedString = utf7->GetString( encodedBytes ); + Console::WriteLine(); + Console::WriteLine( "Decoded bytes:" ); + Console::WriteLine( decodedString ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp new file mode 100644 index 00000000000..ddc015fa0f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetByteCount Example/CPP/getbytecount-char[]-int32-int32.cpp @@ -0,0 +1,18 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + int byteCount = utf7->GetByteCount( chars, 1, 2 ); + Console::WriteLine( "{0} bytes needed to encode characters.", byteCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..97b50574c01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetBytes Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + int byteCount = utf7->GetByteCount( chars, 1, 2 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = utf7->GetBytes( chars, 1, 2, bytes, 0 ); + Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp new file mode 100644 index 00000000000..b5e8fc2023a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {85,84,70,55,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + int charCount = utf7->GetCharCount( bytes, 2, 8 ); + chars = gcnew array(charCount); + int charsDecodedCount = utf7->GetChars( bytes, 2, 8, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp new file mode 100644 index 00000000000..7fb0ea443fe --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetDecoder Example/CPP/getdecoder-.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {99,43,65,119,67,103,111,65,45}; + Decoder^ utf7Decoder = Encoding::UTF7->GetDecoder(); + int charCount = utf7Decoder->GetCharCount( bytes, 0, bytes->Length ); + chars = gcnew array(charCount); + int charsDecodedCount = utf7Decoder->GetChars( bytes, 0, bytes->Length, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp new file mode 100644 index 00000000000..60c28256953 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetEncoder Example/CPP/getencoder-.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars = {'a','b','c',L'\u0300',L'\ua0a0'}; + array^bytes; + Encoder^ utf7Encoder = Encoding::UTF7->GetEncoder(); + int byteCount = utf7Encoder->GetByteCount( chars, 2, 3, true ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = utf7Encoder->GetBytes( chars, 2, 3, bytes, 0, true ); + Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp new file mode 100644 index 00000000000..e368c581615 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + int charCount = 2; + int maxByteCount = utf7->GetMaxByteCount( charCount ); + Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp new file mode 100644 index 00000000000..e11609a9b4f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + int byteCount = 8; + int maxCharCount = utf7->GetMaxCharCount( byteCount ); + Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp new file mode 100644 index 00000000000..3474715e028 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor1 Example/CPP/ctor.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + String^ encodingName = utf7->EncodingName; + Console::WriteLine( "Encoding name: {0}", encodingName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp new file mode 100644 index 00000000000..0af6372132d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.ctor2 Example/CPP/ctor-boolean.cpp @@ -0,0 +1,47 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +void ShowArray( Array^ theArray ) +{ + IEnumerator^ myEnum = theArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::Write( "[{0}]", o ); + } + + Console::WriteLine(); +} + +int main() +{ + + // A few optional characters. + String^ chars = "!@#$"; + + // The default Encoding does not allow optional characters. + // Alternate Byte values are used. + UTF7Encoding^ utf7 = gcnew UTF7Encoding; + array^bytes1 = utf7->GetBytes( chars ); + Console::WriteLine( "Default UTF7 Encoding:" ); + ShowArray( bytes1 ); + + // Convert back to characters. + Console::WriteLine( "Characters:" ); + ShowArray( utf7->GetChars( bytes1 ) ); + + // Now, allow optional characters. + // Optional characters are encoded with their normal code points. + UTF7Encoding^ utf7AllowOptionals = gcnew UTF7Encoding( true ); + array^bytes2 = utf7AllowOptionals->GetBytes( chars ); + Console::WriteLine( "UTF7 Encoding with optional characters allowed:" ); + ShowArray( bytes2 ); + + // Convert back to characters. + Console::WriteLine( "Characters:" ); + ShowArray( utf7AllowOptionals->GetChars( bytes2 ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp new file mode 100644 index 00000000000..0f2e71a46f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF7Encoding.getstring/CPP/getstring.cpp @@ -0,0 +1,34 @@ + +// The following code example encodes a string into an array of bytes, and then decodes the bytes back into a string. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Create an instance of UTF7Encoding. + UTF7Encoding^ u7 = gcnew UTF7Encoding( true ); + + // Create byte arrays from the same string containing the following characters: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + String^ myStr = "za\u0306\u01FD\u03B2"; + + // Encode the string. + array^myBArr = gcnew array(u7->GetByteCount( myStr )); + u7->GetBytes( myStr, 0, myStr->Length, myBArr, 0 ); + + // Decode the byte array. + Console::WriteLine( "The new string is: {0}", u7->GetString( myBArr, 0, myBArr->Length ) ); +} + +/* +This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. + +The new string is: za?? + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp new file mode 100644 index 00000000000..207ede33c02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding Example/CPP/snippet.cpp @@ -0,0 +1,51 @@ + +// +using namespace System; +using namespace System::Text; +//using namespace System::Collections; + +int main() +{ + // Create a UTF-8 encoding. + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + + // A Unicode string with two characters outside an 8-bit code range. + String^ unicodeString = L"This Unicode string has 2 characters " + + L"outside the ASCII range:\n" + + L"Pi (\u03a0), and Sigma (\u03a3)."; + Console::WriteLine("Original string:"); + Console::WriteLine(unicodeString); + + // Encode the string. + array^ encodedBytes = utf8->GetBytes(unicodeString ); + Console::WriteLine(); + Console::WriteLine("Encoded bytes:"); + for (int ctr = 0; ctr < encodedBytes->Length; ctr++) { + Console::Write( "{0:X2} ", encodedBytes[ctr]); + if ((ctr + 1) % 25 == 0) + Console::WriteLine(); + } + + Console::WriteLine(); + + // Decode bytes back to string. + String^ decodedString = utf8->GetString(encodedBytes); + Console::WriteLine(); + Console::WriteLine("Decoded bytes:"); + Console::WriteLine(decodedString); +} +// The example displays the following output: +// Original string: +// This Unicode string has 2 characters outside the ASCII range: +// Pi (Ï€), and Sigma (Σ). +// +// Encoded bytes: +// 54 68 69 73 20 55 6E 69 63 6F 64 65 20 73 74 72 69 6E 67 20 68 61 73 20 32 +// 20 63 68 61 72 61 63 74 65 72 73 20 6F 75 74 73 69 64 65 20 74 68 65 20 41 +// 53 43 49 49 20 72 61 6E 67 65 3A 20 0D 0A 50 69 20 28 CE A0 29 2C 20 61 6E +// 64 20 53 69 67 6D 61 20 28 CE A3 29 2E +// +// Decoded bytes: +// This Unicode string has 2 characters outside the ASCII range: +// Pi (Ï€), and Sigma (Σ). +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp new file mode 100644 index 00000000000..5e6ae2e299e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.Equals Example/CPP/equals-object.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::Text; +void DescribeEquivalence( Boolean isEquivalent ) +{ + Console::WriteLine( "{0} equivalent encoding.", (isEquivalent ? (String^)"An" : "Not an") ); +} + +int main() +{ + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + UTF8Encoding^ utf8true = gcnew UTF8Encoding( true ); + UTF8Encoding^ utf8truetrue = gcnew UTF8Encoding( true,true ); + UTF8Encoding^ utf8falsetrue = gcnew UTF8Encoding( false,true ); + DescribeEquivalence( utf8->Equals( utf8 ) ); + DescribeEquivalence( utf8->Equals( utf8true ) ); + DescribeEquivalence( utf8->Equals( utf8truetrue ) ); + DescribeEquivalence( utf8->Equals( utf8falsetrue ) ); + DescribeEquivalence( utf8true->Equals( utf8 ) ); + DescribeEquivalence( utf8true->Equals( utf8true ) ); + DescribeEquivalence( utf8true->Equals( utf8truetrue ) ); + DescribeEquivalence( utf8true->Equals( utf8falsetrue ) ); + DescribeEquivalence( utf8truetrue->Equals( utf8 ) ); + DescribeEquivalence( utf8truetrue->Equals( utf8true ) ); + DescribeEquivalence( utf8truetrue->Equals( utf8truetrue ) ); + DescribeEquivalence( utf8truetrue->Equals( utf8falsetrue ) ); + DescribeEquivalence( utf8falsetrue->Equals( utf8 ) ); + DescribeEquivalence( utf8falsetrue->Equals( utf8true ) ); + DescribeEquivalence( utf8falsetrue->Equals( utf8truetrue ) ); + DescribeEquivalence( utf8falsetrue->Equals( utf8falsetrue ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..5adc3b4928a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + int byteCount = utf8->GetByteCount( chars, 1, 2 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = utf8->GetBytes( chars, 1, 2, bytes, 0 ); + Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..e89bbb84c9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + String^ chars = "UTF8 Encoding Example"; + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + int byteCount = utf8->GetByteCount( chars->ToCharArray(), 0, 13 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = utf8->GetBytes( chars, 0, 13, bytes, 0 ); + Console::WriteLine( "{0} bytes used to encode string.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp new file mode 100644 index 00000000000..7456dd1e21a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + array^bytes = {85,84,70,56,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + int charCount = utf8->GetCharCount( bytes, 2, 8 ); + Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp new file mode 100644 index 00000000000..6d629f2db9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {85,84,70,56,32,69,110,99,111,100,105,110,103,32,69,120,97,109,112,108,101}; + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + int charCount = utf8->GetCharCount( bytes, 2, 13 ); + chars = gcnew array(charCount); + int charsDecodedCount = utf8->GetChars( bytes, 2, 13, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp new file mode 100644 index 00000000000..3e5900dd0e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetDecoder Example/CPP/getdecoder-.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {99,204,128,234,130,160}; + Decoder^ utf8Decoder = Encoding::UTF8->GetDecoder(); + int charCount = utf8Decoder->GetCharCount( bytes, 0, bytes->Length ); + chars = gcnew array(charCount); + int charsDecodedCount = utf8Decoder->GetChars( bytes, 0, bytes->Length, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp new file mode 100644 index 00000000000..2969f330f96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetEncoder Example/CPP/getencoder-.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars = {'a','b','c',L'\u0300',L'\ua0a0'}; + array^bytes; + Encoder^ utf8Encoder = Encoding::UTF8->GetEncoder(); + int byteCount = utf8Encoder->GetByteCount( chars, 2, 3, true ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = utf8Encoder->GetBytes( chars, 2, 3, bytes, 0, true ); + Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp new file mode 100644 index 00000000000..00934592f35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetHashCode Example/CPP/gethashcode-.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Many ways to instantiate a UTF8 encoding. + UTF8Encoding^ UTF8a = gcnew UTF8Encoding; + Encoding^ UTF8b = Encoding::UTF8; + Encoding^ UTF8c = gcnew UTF8Encoding( true,true ); + Encoding^ UTF8d = gcnew UTF8Encoding( false,false ); + + // But not all are the same. + Console::WriteLine( UTF8a->GetHashCode() ); + Console::WriteLine( UTF8b->GetHashCode() ); + Console::WriteLine( UTF8c->GetHashCode() ); + Console::WriteLine( UTF8d->GetHashCode() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp new file mode 100644 index 00000000000..eaf84b21006 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + int charCount = 2; + int maxByteCount = utf8->GetMaxByteCount( charCount ); + Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp new file mode 100644 index 00000000000..624c31a8ccf --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + int byteCount = 8; + int maxCharCount = utf8->GetMaxCharCount( byteCount ); + Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp new file mode 100644 index 00000000000..8bc22343a5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.GetPreamble Example/CPP/getpreamble-.cpp @@ -0,0 +1,42 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; + +void ShowArray(array^ bytes) +{ + for each (Byte b in bytes) + Console::Write( "{0:X2} ", b); + + Console::WriteLine(); +} + +int main() +{ + // The default constructor does not provide a preamble. + UTF8Encoding^ UTF8NoPreamble = gcnew UTF8Encoding; + UTF8Encoding^ UTF8WithPreamble = gcnew UTF8Encoding( true ); + array^preamble; + preamble = UTF8NoPreamble->GetPreamble(); + Console::WriteLine( "UTF8NoPreamble" ); + Console::WriteLine( " preamble length: {0}", preamble->Length ); + Console::Write( " preamble: " ); + ShowArray( preamble ); + Console::WriteLine(); + + preamble = UTF8WithPreamble->GetPreamble(); + Console::WriteLine( "UTF8WithPreamble" ); + Console::WriteLine( " preamble length: {0}", preamble->Length ); + Console::Write( " preamble: " ); + ShowArray( preamble ); +} +// The example displays the following output: +// UTF8NoPreamble +// preamble length: 0 +// preamble: +// +// UTF8WithPreamble +// preamble length: 3 +// preamble: EF BB BF +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp new file mode 100644 index 00000000000..862c4ca0aec --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor1 Example/CPP/ctor.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + String^ encodingName = utf8->EncodingName; + Console::WriteLine( "Encoding name: {0}", encodingName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp new file mode 100644 index 00000000000..0dafbdef102 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor2 Example/CPP/ctor-boolean.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +void ShowArray( Array^ theArray ) +{ + IEnumerator^ myEnum = theArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::Write( "[{0}]", o ); + } + + Console::WriteLine(); +} + +int main() +{ + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + UTF8Encoding^ utf8EmitBOM = gcnew UTF8Encoding( true ); + Console::WriteLine( "utf8 preamble:" ); + ShowArray( utf8->GetPreamble() ); + Console::WriteLine( "utf8EmitBOM:" ); + ShowArray( utf8EmitBOM->GetPreamble() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp new file mode 100644 index 00000000000..9f6b9081759 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UTF8Encoding.ctor3 Example/CPP/ctor-boolean-boolean.cpp @@ -0,0 +1,39 @@ + +// +using namespace System; +using namespace System::Text; + +void ShowArray(Array^ theArray) +{ + for each (Byte b in theArray) { + Console::Write( "{0:X2} ", b); + } + Console::WriteLine(); +} + +int main() +{ + UTF8Encoding^ utf8 = gcnew UTF8Encoding; + UTF8Encoding^ utf8ThrowException = gcnew UTF8Encoding(false,true); + + // This array contains two high surrogates in a row (\uD801, \uD802). + array^chars = {'a','b','c',L'\xD801',L'\xD802','d'}; + + // The following method call will not throw an exception. + array^bytes = utf8->GetBytes( chars ); + ShowArray( bytes ); + Console::WriteLine(); + + try { + + // The following method call will throw an exception. + bytes = utf8ThrowException->GetBytes( chars ); + } + catch (EncoderFallbackException^ e ) { + Console::WriteLine("{0} exception\nMessage:\n{1}", + e->GetType()->Name, e->Message); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp new file mode 100644 index 00000000000..c498942c8f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding Example/CPP/snippet.cpp @@ -0,0 +1,38 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + + // The encoding. + UnicodeEncoding^ unicode = gcnew UnicodeEncoding; + + // Create a String* that contains Unicode characters. + String^ unicodeString = L"This Unicode string contains two characters with codes outside the traditional ASCII code range, Pi (\u03a0) and Sigma (\u03a3)."; + Console::WriteLine( "Original string:" ); + Console::WriteLine( unicodeString ); + + // Encode the String*. + array^encodedBytes = unicode->GetBytes( unicodeString ); + Console::WriteLine(); + Console::WriteLine( "Encoded bytes:" ); + IEnumerator^ myEnum = encodedBytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); + + // Decode bytes back to String*. + // Notice Pi and Sigma characters are still present. + String^ decodedString = unicode->GetString( encodedBytes ); + Console::WriteLine(); + Console::WriteLine( "Decoded bytes:" ); + Console::WriteLine( decodedString ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp new file mode 100644 index 00000000000..39d50f0b408 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.CharSize Example/CPP/charsize.cpp @@ -0,0 +1,10 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + Console::WriteLine( "Unicode character size: {0} bytes", UnicodeEncoding::CharSize ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp new file mode 100644 index 00000000000..7f46e6d47b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.EncDec/CPP/encdec.cpp @@ -0,0 +1,56 @@ + +// The following code example uses an encoder and a decoder to encode a string into an array of bytes, +// and then decode the bytes into an array of characters. +// +using namespace System; +using namespace System::Text; +int main() +{ + + // Get an encoder and a decoder from UnicodeEncoding. + UnicodeEncoding^ u16 = gcnew UnicodeEncoding( false,true,true ); + Encoder^ myEnc = u16->GetEncoder(); + Decoder^ myDec = u16->GetDecoder(); + + // The characters to encode: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + array^myChars = gcnew array(5){ + L'z',L'a',L'\u0306',L'\u01FD',L'\u03B2' + }; + Console::Write( "The original characters : " ); + Console::WriteLine( myChars ); + + // Encode the character array. + int iBC = myEnc->GetByteCount( myChars, 0, myChars->Length, true ); + array^myBytes = gcnew array(iBC); + myEnc->GetBytes( myChars, 0, myChars->Length, myBytes, 0, true ); + + // Print the resulting bytes. + Console::Write( "Using the encoder : " ); + for ( int i = 0; i < myBytes->Length; i++ ) + Console::Write( "{0:X2} ", myBytes[ i ] ); + Console::WriteLine(); + + // Decode the byte array back into an array of characters. + int iCC = myDec->GetCharCount( myBytes, 0, myBytes->Length, true ); + array^myDecodedChars = gcnew array(iCC); + myDec->GetChars( myBytes, 0, myBytes->Length, myDecodedChars, 0, true ); + + // Print the resulting characters. + Console::Write( "Using the decoder : " ); + Console::WriteLine( myDecodedChars ); +} + +/* +This code produces the following output. The question marks take the place of characters that cannot be displayed at the console. + +The original characters : za??ß +Using the encoder : 7A 00 61 00 06 03 FD 01 B2 03 +Using the decoder : za??ß + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp new file mode 100644 index 00000000000..de042ae169e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ErrorDetection/CPP/errordetection.cpp @@ -0,0 +1,71 @@ + +// The following code example demonstrates the behavior of UnicodeEncoding with error detection enabled and without. +// +using namespace System; +using namespace System::Text; +void PrintDecodedString( array^bytes, Encoding^ enc ); +int main() +{ + + // Create an instance of UnicodeEncoding using little-endian byte order. + // This will be used for encoding. + UnicodeEncoding^ u16LE = gcnew UnicodeEncoding( false,true ); + + // Create two instances of UnicodeEncoding using big-endian byte order: one with error detection and one without. + // These will be used for decoding. + UnicodeEncoding^ u16withED = gcnew UnicodeEncoding( true,true,true ); + UnicodeEncoding^ u16noED = gcnew UnicodeEncoding( true,true,false ); + + // Create byte arrays from the same string containing the following characters: + // Latin Small Letter Z (U+007A) + // Latin Small Letter A (U+0061) + // Combining Breve (U+0306) + // Latin Small Letter AE With Acute (U+01FD) + // Greek Small Letter Beta (U+03B2) + // Latin Capital Letter U with Diaeresis (U+00DC) + String^ myStr = "za\u0306\u01FD\u03B2\u00DC"; + + // Encode the string using little-endian byte order. + array^myBytes = gcnew array(u16LE->GetByteCount( myStr )); + u16LE->GetBytes( myStr, 0, myStr->Length, myBytes, 0 ); + + // Decode the byte array with error detection. + Console::WriteLine( "Decoding with error detection:" ); + PrintDecodedString( myBytes, u16withED ); + + // Decode the byte array without error detection. + Console::WriteLine( "Decoding without error detection:" ); + PrintDecodedString( myBytes, u16noED ); +} + + +// Decode the bytes and display the string. +void PrintDecodedString( array^bytes, Encoding^ enc ) +{ + try + { + Console::WriteLine( " Decoded string: {0}", enc->GetString( bytes, 0, bytes->Length ) ); + } + catch ( System::ArgumentException^ e ) + { + Console::WriteLine( e ); + } + + Console::WriteLine(); +} + +// +/* BUGBUG: Reproduce this output in retail build, then add to the snippet. +This code produces the following output. + +Decoding with error detection: +System.ArgumentException: Invalid byte was found at byte index 3. + at System.Text.UnicodeEncoding.GetCharCount(Byte* bytes, Int32 count, DecoderNLS baseDecoder) + at System.String.CreateStringFromEncoding(Byte* bytes, Int32 byteLength, Encoding encoding) + at System.Text.UnicodeEncoding.GetString(Byte[] bytes, Int32 index, Int32 count) + at SamplesUnicodeEncoding.PrintDecodedString(Byte[] bytes, Encoding enc) + +Decoding without error detection: + Decoded string: + +*/ diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..bbefc038187 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes1 Example/CPP/getbytes-char[]-int32-int32-byte[]-int32.cpp @@ -0,0 +1,31 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + + // Unicode characters. + + // Pi + // Sigma + array^chars = {L'\u03a0',L'\u03a3',L'\u03a6',L'\u03a9'}; + UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; + int byteCount = Unicode->GetByteCount( chars, 1, 2 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = Unicode->GetBytes( chars, 1, 2, bytes, 0 ); + Console::WriteLine( "{0} bytes used to encode characters.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp new file mode 100644 index 00000000000..25dee60bee6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetBytes3 Example/CPP/getbytes-string-int32-int32-byte[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^bytes; + String^ chars = "Unicode Encoding Example"; + UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; + int byteCount = Unicode->GetByteCount( chars->ToCharArray(), 8, 8 ); + bytes = gcnew array(byteCount); + int bytesEncodedCount = Unicode->GetBytes( chars, 8, 8, bytes, 0 ); + Console::WriteLine( "{0} bytes used to encode string.", bytesEncodedCount ); + Console::Write( "Encoded bytes: " ); + IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp new file mode 100644 index 00000000000..0925c759295 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetCharCount Example/CPP/getcharcount-byte[]-int32-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; + UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; + int charCount = Unicode->GetCharCount( bytes, 2, 8 ); + Console::WriteLine( "{0} characters needed to decode bytes.", charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp new file mode 100644 index 00000000000..e68162a021c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetChars Example/CPP/getchars-byte[]-int32-int32-char[]-int32.cpp @@ -0,0 +1,26 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^chars; + array^bytes = {85,0,110,0,105,0,99,0,111,0,100,0,101,0}; + UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; + int charCount = Unicode->GetCharCount( bytes, 2, 8 ); + chars = gcnew array(charCount); + int charsDecodedCount = Unicode->GetChars( bytes, 2, 8, chars, 0 ); + Console::WriteLine( "{0} characters used to decode bytes.", charsDecodedCount ); + Console::Write( "Decoded chars: " ); + IEnumerator^ myEnum = chars->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Char c = safe_cast(myEnum->Current); + Console::Write( "[{0}]", c.ToString() ); + } + + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp new file mode 100644 index 00000000000..08545fa0a5e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxByteCount Example/CPP/getmaxbytecount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; + int charCount = 2; + int maxByteCount = Unicode->GetMaxByteCount( charCount ); + Console::WriteLine( "Maximum of {0} bytes needed to encode {1} characters.", maxByteCount, charCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp new file mode 100644 index 00000000000..c956533d9a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetMaxCharCount Example/CPP/getmaxcharcount-int32.cpp @@ -0,0 +1,13 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UnicodeEncoding^ Unicode = gcnew UnicodeEncoding; + int byteCount = 8; + int maxCharCount = Unicode->GetMaxCharCount( byteCount ); + Console::WriteLine( "Maximum of {0} characters needed to decode {1} bytes.", maxCharCount, byteCount ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp new file mode 100644 index 00000000000..b2e176ae267 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.GetPreamble Example/CPP/getpreamble-.cpp @@ -0,0 +1,30 @@ + +// +using namespace System; +using namespace System::Text; +using namespace System::Collections; +int main() +{ + array^byteOrderMark; + byteOrderMark = Encoding::Unicode->GetPreamble(); + Console::WriteLine( "Default (little-endian) Unicode Preamble:" ); + IEnumerator^ myEnum = byteOrderMark->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } + + Console::WriteLine( "\n" ); + UnicodeEncoding^ bigEndianUnicode = gcnew UnicodeEncoding( true,true ); + byteOrderMark = bigEndianUnicode->GetPreamble(); + Console::WriteLine( "Big-endian Unicode Preamble:" ); + myEnum = byteOrderMark->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( "[{0}]", b ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp new file mode 100644 index 00000000000..13dd01a98bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor Example/CPP/ctor.cpp @@ -0,0 +1,12 @@ + +// +using namespace System; +using namespace System::Text; +int main() +{ + UnicodeEncoding^ unicode = gcnew UnicodeEncoding; + String^ encodingName = unicode->EncodingName; + Console::WriteLine( "Encoding name: {0}", encodingName ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp new file mode 100644 index 00000000000..e295b687fdd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Text.UnicodeEncoding.ctor2 Example/CPP/ctor-boolean-boolean.cpp @@ -0,0 +1,45 @@ + +// +using namespace System; +using namespace System::Text; +void DescribeEquivalence( Boolean isEquivalent ) +{ + Console::WriteLine( " {0} equivalent encoding.", (isEquivalent ? (String^)"An" : "Not an") ); +} + +int main() +{ + + // Create a UnicodeEncoding without parameters. + UnicodeEncoding^ unicode = gcnew UnicodeEncoding; + + // Create a UnicodeEncoding to support little-endian Byte ordering + // and include the Unicode Byte order mark. + UnicodeEncoding^ unicodeLittleEndianBOM = gcnew UnicodeEncoding( false,true ); + + // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. + DescribeEquivalence( unicode->Equals( unicodeLittleEndianBOM ) ); + + // Create a UnicodeEncoding to support little-endian Byte ordering + // and not include the Unicode Byte order mark. + UnicodeEncoding^ unicodeLittleEndianNoBOM = gcnew UnicodeEncoding( false,false ); + + // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. + DescribeEquivalence( unicode->Equals( unicodeLittleEndianNoBOM ) ); + + // Create a UnicodeEncoding to support big-endian Byte ordering + // and include the Unicode Byte order mark. + UnicodeEncoding^ unicodeBigEndianBOM = gcnew UnicodeEncoding( true,true ); + + // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. + DescribeEquivalence( unicode->Equals( unicodeBigEndianBOM ) ); + + // Create a UnicodeEncoding to support big-endian Byte ordering + // and not include the Unicode Byte order mark. + UnicodeEncoding^ unicodeBigEndianNoBOM = gcnew UnicodeEncoding( true,false ); + + // Compare this UnicodeEncoding to the UnicodeEncoding without parameters. + DescribeEquivalence( unicode->Equals( unicodeBigEndianNoBOM ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp new file mode 100644 index 00000000000..ea0fa55c83a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AbandonedMutexException/CPP/koax.cpp @@ -0,0 +1,148 @@ +// +using namespace System; +using namespace System::Threading; + +namespace SystemThreadingExample +{ + public ref class Example + { + private: + static ManualResetEvent^ dummyEvent = + gcnew ManualResetEvent(false); + + static Mutex^ orphanMutex1 = gcnew Mutex; + static Mutex^ orphanMutex2 = gcnew Mutex; + static Mutex^ orphanMutex3 = gcnew Mutex; + static Mutex^ orphanMutex4 = gcnew Mutex; + static Mutex^ orphanMutex5 = gcnew Mutex; + + public: + static void ProduceAbandonMutexException(void) + { + + // Start a thread that grabs all five mutexes, and then + // abandons them. + Thread^ abandonThread = + gcnew Thread(gcnew ThreadStart(AbandonMutex)); + + abandonThread->Start(); + + // Make sure the thread is finished. + abandonThread->Join(); + + // Wait on one of the abandoned mutexes. The WaitOne + // throws an AbandonedMutexException. + try + { + orphanMutex1->WaitOne(); + Console::WriteLine("WaitOne succeeded."); + } + catch (AbandonedMutexException^ ex) + { + Console::WriteLine("Exception in WaitOne: {0}", + ex->Message); + } + finally + { + + // Whether or not the exception was thrown, + // the current thread owns the mutex, and + // must release it. + orphanMutex1->ReleaseMutex(); + } + + + // Create an array of wait handles, consisting of one + // ManualResetEvent and two mutexes, using two more of + // the abandoned mutexes. + array ^ waitFor = {dummyEvent, + orphanMutex2, orphanMutex3}; + + // WaitAny returns when any of the wait handles in the + // array is signaled. Either of the two abandoned mutexes + // satisfy the wait, but lower of the two index values is + // returned by MutexIndex. Note that the Try block and + // the Catch block obtain the index in different ways. + try + { + int index = WaitHandle::WaitAny(waitFor); + Console::WriteLine("WaitAny succeeded."); + (safe_cast(waitFor[index]))->ReleaseMutex(); + } + catch (AbandonedMutexException^ ex) + { + Console::WriteLine("Exception in WaitAny at index {0}" + "\r\n\tMessage: {1}", ex->MutexIndex, + ex->Message); + (safe_cast(waitFor[ex->MutexIndex]))-> + ReleaseMutex(); + } + + orphanMutex3->ReleaseMutex(); + + // Use two more of the abandoned mutexes for the WaitAll + // call. WaitAll doesn't return until all wait handles + // are signaled, so the ManualResetEvent must be signaled + // by calling Set(). + dummyEvent->Set(); + waitFor[1] = orphanMutex4; + waitFor[2] = orphanMutex5; + + // Because WaitAll requires all the wait handles to be + // signaled, both mutexes must be released even if the + // exception is thrown. Thus, the ReleaseMutex calls are + // placed in the Finally block. Again, MutexIndex returns + // the lower of the two index values for the abandoned + // mutexes. + // + try + { + WaitHandle::WaitAll(waitFor); + Console::WriteLine("WaitAll succeeded."); + } + catch (AbandonedMutexException^ ex) + { + Console::WriteLine("Exception in WaitAny at index {0}" + "\r\n\tMessage: {1}", ex->MutexIndex, + ex->Message); + } + finally + { + orphanMutex4->ReleaseMutex(); + orphanMutex5->ReleaseMutex(); + } + + } + + + private: + [MTAThread] + static void AbandonMutex() + { + orphanMutex1->WaitOne(); + orphanMutex2->WaitOne(); + orphanMutex3->WaitOne(); + orphanMutex4->WaitOne(); + orphanMutex5->WaitOne(); + Console::WriteLine( + "Thread exits without releasing the mutexes."); + } + }; +} + +//Entry point of example application +[MTAThread] +int main(void) +{ + SystemThreadingExample::Example::ProduceAbandonMutexException(); +} + +// This code example produces the following output: +// Thread exits without releasing the mutexes. +// Exception in WaitOne: The wait completed due to an abandoned mutex. +// Exception in WaitAny at index 1 +// Message: The wait completed due to an abandoned mutex. +// Exception in WaitAll at index -1 +// Message: The wait completed due to an abandoned mutex. + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp new file mode 100644 index 00000000000..286d1b48439 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/class1.cpp @@ -0,0 +1,51 @@ + +// +using namespace System; +using namespace System::Threading; +ref class MyMainClass +{ +public: + static void MyReadThreadProc() + { + while ( true ) + { + + //The value will not be read until the writer has written + // at least once since the last read. + myResetEvent->WaitOne(); + Console::WriteLine( " {0} reading value: {1}", Thread::CurrentThread->Name, number ); + } + } + + + //Initially not signaled. + static AutoResetEvent^ myResetEvent = gcnew AutoResetEvent( false ); + static int number; + literal int numIterations = 100; +}; + +int main() +{ + + //Create and start the reader thread. + Thread^ myReaderThread = gcnew Thread( gcnew ThreadStart( MyMainClass::MyReadThreadProc ) ); + myReaderThread->Name = "ReaderThread"; + myReaderThread->Start(); + for ( int i = 1; i <= MyMainClass::numIterations; i++ ) + { + Console::WriteLine( "Writer thread writing value: {0}", i ); + MyMainClass::number = i; + + //Signal that a value has been written. + MyMainClass::myResetEvent->Set(); + + //Give the Reader thread an opportunity to act. + Thread::Sleep( 1 ); + + } + + //Terminate the reader thread. + myReaderThread->Abort(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp new file mode 100644 index 00000000000..96444ba3776 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.AutoResetEvent/CPP/simplerisbetter.cpp @@ -0,0 +1,105 @@ +// +using namespace System; +using namespace System::Threading; + +ref class Example +{ +private: + static AutoResetEvent^ event_1 = gcnew AutoResetEvent(true); + static AutoResetEvent^ event_2 = gcnew AutoResetEvent(false); + + static void ThreadProc() + { + String^ name = Thread::CurrentThread->Name; + + Console::WriteLine("{0} waits on AutoResetEvent #1.", name); + event_1->WaitOne(); + Console::WriteLine("{0} is released from AutoResetEvent #1.", name); + + Console::WriteLine("{0} waits on AutoResetEvent #2.", name); + event_2->WaitOne(); + Console::WriteLine("{0} is released from AutoResetEvent #2.", name); + + Console::WriteLine("{0} ends.", name); + } + +public: + static void Demo() + { + Console::WriteLine("Press Enter to create three threads and start them.\r\n" + + "The threads wait on AutoResetEvent #1, which was created\r\n" + + "in the signaled state, so the first thread is released.\r\n" + + "This puts AutoResetEvent #1 into the unsignaled state."); + Console::ReadLine(); + + for (int i = 1; i < 4; i++) + { + Thread^ t = gcnew Thread(gcnew ThreadStart(&ThreadProc)); + t->Name = "Thread_" + i; + t->Start(); + } + Thread::Sleep(250); + + for (int i = 0; i < 2; i++) + { + Console::WriteLine("Press Enter to release another thread."); + Console::ReadLine(); + event_1->Set(); + Thread::Sleep(250); + } + + Console::WriteLine("\r\nAll threads are now waiting on AutoResetEvent #2."); + for (int i = 0; i < 3; i++) + { + Console::WriteLine("Press Enter to release a thread."); + Console::ReadLine(); + event_2->Set(); + Thread::Sleep(250); + } + + // Visual Studio: Uncomment the following line. + //Console::Readline(); + } +}; + +void main() +{ + Example::Demo(); +} + +/* This example produces output similar to the following: + +Press Enter to create three threads and start them. +The threads wait on AutoResetEvent #1, which was created +in the signaled state, so the first thread is released. +This puts AutoResetEvent #1 into the unsignaled state. + +Thread_1 waits on AutoResetEvent #1. +Thread_1 is released from AutoResetEvent #1. +Thread_1 waits on AutoResetEvent #2. +Thread_3 waits on AutoResetEvent #1. +Thread_2 waits on AutoResetEvent #1. +Press Enter to release another thread. + +Thread_3 is released from AutoResetEvent #1. +Thread_3 waits on AutoResetEvent #2. +Press Enter to release another thread. + +Thread_2 is released from AutoResetEvent #1. +Thread_2 waits on AutoResetEvent #2. + +All threads are now waiting on AutoResetEvent #2. +Press Enter to release a thread. + +Thread_2 is released from AutoResetEvent #2. +Thread_2 ends. +Press Enter to release a thread. + +Thread_1 is released from AutoResetEvent #2. +Thread_1 ends. +Press Enter to release a thread. + +Thread_3 is released from AutoResetEvent #2. +Thread_3 ends. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp new file mode 100644 index 00000000000..9545b8e2fae --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.EventWaitHandle.ctor named 5/CPP/source.cpp @@ -0,0 +1,197 @@ +// +using namespace System; +using namespace System::Threading; +using namespace System::Security::AccessControl; +using namespace System::Security::Permissions; + +public ref class Example +{ +public: + [SecurityPermissionAttribute(SecurityAction::Demand,Flags=SecurityPermissionFlag::UnmanagedCode)] + static void Main() + { + // + String^ ewhName = L"EventWaitHandleExample5"; + + EventWaitHandle^ ewh = nullptr; + bool doesNotExist = false; + bool unauthorized = false; + + // The value of this variable is set by the event + // constructor. It is true if the named system event was + // created, and false if the named event already existed. + // + bool wasCreated; + + // Attempt to open the named event. + try + { + // Open the event with (EventWaitHandleRights.Synchronize + // | EventWaitHandleRights.Modify), to wait on and + // signal the named event. + // + ewh = EventWaitHandle::OpenExisting( ewhName ); + } + catch ( WaitHandleCannotBeOpenedException^ ) + { + Console::WriteLine( L"Named event does not exist." ); + doesNotExist = true; + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); + unauthorized = true; + } + // + + // There are three cases: (1) The event does not exist. + // (2) The event exists, but the current user doesn't + // have access. (3) The event exists and the user has + // access. + // + if ( doesNotExist ) + { + // + // The event does not exist, so create it. + + // Create an access control list (ACL) that denies the + // current user the right to wait on or signal the + // event, but allows the right to read and change + // security information for the event. + // + String^ user = String::Concat( Environment::UserDomainName, L"\\", + Environment::UserName ); + EventWaitHandleSecurity^ ewhSec = gcnew EventWaitHandleSecurity; + //following constructor fails + EventWaitHandleAccessRule^ rule = gcnew EventWaitHandleAccessRule( + user, + static_cast( + EventWaitHandleRights::Synchronize | + EventWaitHandleRights::Modify), + AccessControlType::Deny ); + ewhSec->AddAccessRule( rule ); + + rule = gcnew EventWaitHandleAccessRule( user, + static_cast( + EventWaitHandleRights::ReadPermissions | + EventWaitHandleRights::ChangePermissions), + AccessControlType::Allow ); + ewhSec->AddAccessRule( rule ); + + // Create an EventWaitHandle object that represents + // the system event named by the constant 'ewhName', + // initially signaled, with automatic reset, and with + // the specified security access. The Boolean value that + // indicates creation of the underlying system object + // is placed in wasCreated. + // + ewh = gcnew EventWaitHandle( true, + EventResetMode::AutoReset, + ewhName, + wasCreated, + ewhSec ); + + // If the named system event was created, it can be + // used by the current instance of this program, even + // though the current user is denied access. The current + // program owns the event. Otherwise, exit the program. + // + if ( wasCreated ) + { + Console::WriteLine( L"Created the named event." ); + } + else + { + Console::WriteLine( L"Unable to create the event." ); + return; + } + // + } + else if ( unauthorized ) + { + // + // Open the event to read and change the access control + // security. The access control security defined above + // allows the current user to do this. + // + try + { + ewh = EventWaitHandle::OpenExisting( ewhName, + static_cast( + EventWaitHandleRights::ReadPermissions | + EventWaitHandleRights::ChangePermissions) ); + + // Get the current ACL. This requires + // EventWaitHandleRights.ReadPermissions. + EventWaitHandleSecurity^ ewhSec = ewh->GetAccessControl(); + String^ user = String::Concat( Environment::UserDomainName, L"\\", + Environment::UserName ); + + // First, the rule that denied the current user + // the right to enter and release the event must + // be removed. + EventWaitHandleAccessRule^ rule = gcnew EventWaitHandleAccessRule( + user, + static_cast( + EventWaitHandleRights::Synchronize | + EventWaitHandleRights::Modify), + AccessControlType::Deny ); + ewhSec->RemoveAccessRule( rule ); + + // Now grant the user the correct rights. + // + rule = gcnew EventWaitHandleAccessRule( user, + static_cast( + EventWaitHandleRights::Synchronize | + EventWaitHandleRights::Modify), + AccessControlType::Allow ); + ewhSec->AddAccessRule( rule ); + + // Update the ACL. This requires + // EventWaitHandleRights.ChangePermissions. + ewh->SetAccessControl( ewhSec ); + Console::WriteLine( L"Updated event security." ); + + // Open the event with (EventWaitHandleRights.Synchronize + // | EventWaitHandleRights.Modify), the rights required + // to wait on and signal the event. + // + ewh = EventWaitHandle::OpenExisting( ewhName ); + // + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unable to change permissions: {0}", + ex->Message ); + return; + } + + } + + // Wait on the event, and hold it until the program + // exits. + // + try + { + Console::WriteLine( L"Wait on the event." ); + ewh->WaitOne(); + Console::WriteLine( L"Event was signaled." ); + Console::WriteLine( L"Press the Enter key to signal the event and exit." ); + Console::ReadLine(); + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); + } + finally + { + ewh->Set(); + } + } +}; + +int main() +{ + Example::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp new file mode 100644 index 00000000000..37370e944c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked CompareExchange0/CPP/source.cpp @@ -0,0 +1,70 @@ + + +// +// This example demonstrates a thread-safe method that adds to a +// running total. It cannot be run directly. You can compile it +// as a library, or add the class to a project. +#using + +using namespace System::Threading; +public ref class ThreadSafe +{ +private: + + // totalValue contains a running total that can be updated + // by multiple threads. It must be protected from unsynchronized + // access. + int totalValue; + +public: + + property int Total + { + + // The Total property returns the running total. + int get() + { + return totalValue; + } + + } + + // AddToTotal safely adds a value to the running total. + int AddToTotal( int addend ) + { + int initialValue; + int computedValue; + do + { + + // Save the current running total in a local variable. + initialValue = totalValue; + + // Add the new value to the running total. + computedValue = initialValue + addend; + + // CompareExchange compares totalValue to initialValue. If + // they are not equal, then another thread has updated the + // running total since this loop started. CompareExchange + // does not update totalValue. CompareExchange returns the + // contents of totalValue, which do not equal initialValue, + // so the loop executes again. + } + while ( initialValue != Interlocked::CompareExchange( totalValue, computedValue, initialValue ) ); + + + // If no other thread updated the running total, then + // totalValue and initialValue are equal when CompareExchange + // compares them, and computedValue is stored in totalValue. + // CompareExchange returns the value that was in totalValue + // before the update, which is equal to initialValue, so the + // loop ends. + // The function returns computedValue, not totalValue, because + // totalValue could be changed by another thread between + // the time the loop ends and the function returns. + return computedValue; + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp new file mode 100644 index 00000000000..a04b9df75bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Interlocked.Exchange Int32 Example/CPP/class1.cpp @@ -0,0 +1,71 @@ + +// +using namespace System; +using namespace System::Threading; + +const int numThreads = 10; +const int numThreadIterations = 5; +ref class MyInterlockedExchangeExampleClass +{ +public: + static void MyThreadProc() + { + for ( int i = 0; i < numThreadIterations; i++ ) + { + UseResource(); + + //Wait 1 second before next attempt. + Thread::Sleep( 1000 ); + + } + } + + +private: + //A simple method that denies reentrancy. + static bool UseResource() + { + + //0 indicates that the method is not in use. + if ( 0 == Interlocked::Exchange( usingResource, 1 ) ) + { + Console::WriteLine( " {0} acquired the lock", Thread::CurrentThread->Name ); + + //Code to access a resource that is not thread safe would go here. + //Simulate some work + Thread::Sleep( 500 ); + Console::WriteLine( " {0} exiting lock", Thread::CurrentThread->Name ); + + //Release the lock + Interlocked::Exchange( usingResource, 0 ); + return true; + } + else + { + Console::WriteLine( " {0} was denied the lock", Thread::CurrentThread->Name ); + return false; + } + } + + + //0 for false, 1 for true. + static int usingResource; +}; + +int main() +{ + Thread^ myThread; + Random^ rnd = gcnew Random; + for ( int i = 0; i < numThreads; i++ ) + { + myThread = gcnew Thread( gcnew ThreadStart( MyInterlockedExchangeExampleClass::MyThreadProc ) ); + myThread->Name = String::Format( "Thread {0}", i + 1 ); + + //Wait a random amount of time before starting next thread. + Thread::Sleep( rnd->Next( 0, 1000 ) ); + myThread->Start(); + + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp new file mode 100644 index 00000000000..f89e7184409 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ManualResetEvent/CPP/source.cpp @@ -0,0 +1,117 @@ +// +using namespace System; +using namespace System::Threading; + +ref class Example +{ +private: + // mre is used to block and release threads manually. It is + // created in the unsignaled state. + static ManualResetEvent^ mre = gcnew ManualResetEvent(false); + + static void ThreadProc() + { + String^ name = Thread::CurrentThread->Name; + + Console::WriteLine(name + " starts and calls mre->WaitOne()"); + + mre->WaitOne(); + + Console::WriteLine(name + " ends."); + } + +public: + static void Demo() + { + Console::WriteLine("\nStart 3 named threads that block on a ManualResetEvent:\n"); + + for(int i = 0; i <=2 ; i++) + { + Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); + t->Name = "Thread_" + i; + t->Start(); + } + + Thread::Sleep(500); + Console::WriteLine("\nWhen all three threads have started, press Enter to call Set()" + + "\nto release all the threads.\n"); + Console::ReadLine(); + + mre->Set(); + + Thread::Sleep(500); + Console::WriteLine("\nWhen a ManualResetEvent is signaled, threads that call WaitOne()" + + "\ndo not block. Press Enter to show this.\n"); + Console::ReadLine(); + + for(int i = 3; i <= 4; i++) + { + Thread^ t = gcnew Thread(gcnew ThreadStart(ThreadProc)); + t->Name = "Thread_" + i; + t->Start(); + } + + Thread::Sleep(500); + Console::WriteLine("\nPress Enter to call Reset(), so that threads once again block" + + "\nwhen they call WaitOne().\n"); + Console::ReadLine(); + + mre->Reset(); + + // Start a thread that waits on the ManualResetEvent. + Thread^ t5 = gcnew Thread(gcnew ThreadStart(ThreadProc)); + t5->Name = "Thread_5"; + t5->Start(); + + Thread::Sleep(500); + Console::WriteLine("\nPress Enter to call Set() and conclude the demo."); + Console::ReadLine(); + + mre->Set(); + + // If you run this example in Visual Studio, uncomment the following line: + //Console::ReadLine(); + } +}; + +int main() +{ + Example::Demo(); +} + +/* This example produces output similar to the following: + +Start 3 named threads that block on a ManualResetEvent: + +Thread_0 starts and calls mre->WaitOne() +Thread_1 starts and calls mre->WaitOne() +Thread_2 starts and calls mre->WaitOne() + +When all three threads have started, press Enter to call Set() +to release all the threads. + + +Thread_2 ends. +Thread_1 ends. +Thread_0 ends. + +When a ManualResetEvent is signaled, threads that call WaitOne() +do not block. Press Enter to show this. + + +Thread_3 starts and calls mre->WaitOne() +Thread_3 ends. +Thread_4 starts and calls mre->WaitOne() +Thread_4 ends. + +Press Enter to call Reset(), so that threads once again block +when they call WaitOne(). + + +Thread_5 starts and calls mre->WaitOne() + +Press Enter to call Set() and conclude the demo. + +Thread_5 ends. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp new file mode 100644 index 00000000000..b46723cfa04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 1Arg Ctor Example/CPP/class1.cpp @@ -0,0 +1,82 @@ + +// +using namespace System; +using namespace System::Threading; + +const int numIterations = 1; +const int numThreads = 3; + +ref class Test +{ +public: + + // Create a new Mutex. The creating thread owns the + // Mutex. + static Mutex^ mut = gcnew Mutex( true ); + static void MyThreadProc() + { + for ( int i = 0; i < numIterations; i++ ) + { + UseResource(); + + } + } + + +private: + + // This method represents a resource that must be synchronized + // so that only one thread at a time can enter. + static void UseResource() + { + + //Wait until it is OK to enter. + mut->WaitOne(); + Console::WriteLine( "{0} has entered protected the area", Thread::CurrentThread->Name ); + + // Place code to access non-reentrant resources here. + // Simulate some work. + Thread::Sleep( 500 ); + Console::WriteLine( "{0} is leaving protected the area\r\n", Thread::CurrentThread->Name ); + + // Release the Mutex. + mut->ReleaseMutex(); + } + +}; + +int main() +{ + + // Initialize the Mutex. + Mutex^ mut = Test::mut; + + // Create the threads that will use the protected resource. + for ( int i = 0; i < numThreads; i++ ) + { + Thread^ myThread = gcnew Thread( gcnew ThreadStart( Test::MyThreadProc ) ); + myThread->Name = String::Format( "Thread {0}", i + 1 ); + myThread->Start(); + + } + + // Wait one second before allowing other threads to + // acquire the Mutex. + Console::WriteLine( "Creating thread owns the Mutex." ); + Thread::Sleep( 1000 ); + Console::WriteLine( "Creating thread releases the Mutex.\r\n" ); + mut->ReleaseMutex(); +} +// The example displays output like the following: +// Creating thread owns the Mutex. +// Creating thread releases the Mutex. +// +// Thread1 has entered the protected area +// Thread1 is leaving the protected area +// +// Thread2 has entered the protected area +// Thread2 is leaving the protected area +// +// Thread3 has entered the protected area +// Thread3 is leaving the protected area +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp new file mode 100644 index 00000000000..4079eedaa6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 2Arg Ctor Example/CPP/class1.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +using namespace System::Threading; + +int main() +{ + // Create the named mutex. Only one system object named + // "MyMutex" can exist; the local Mutex object represents + // this system object, regardless of which process or thread + // caused "MyMutex" to be created. + Mutex^ m = gcnew Mutex( false,"MyMutex" ); + + // Try to gain control of the named mutex. If the mutex is + // controlled by another thread, wait for it to be released. + Console::WriteLine( "Waiting for the Mutex." ); + m->WaitOne(); + + // Keep control of the mutex until the user presses + // ENTER. + Console::WriteLine( "This application owns the mutex. " + "Press ENTER to release the mutex and exit." ); + Console::ReadLine(); + m->ReleaseMutex(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp new file mode 100644 index 00000000000..a8d967c7296 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex 3Arg Ctor Example/CPP/class1.cpp @@ -0,0 +1,56 @@ + +// +// This example shows how a named mutex is used to signal between +// processes or threads. +// Run this program from two (or more) command windows. Each process +// creates a Mutex object that represents the named mutex "MyMutex". +// The named mutex is a system object whose lifetime is bounded by the +// lifetimes of the Mutex objects that represent it. The named mutex +// is created when the first process creates its local Mutex; in this +// example, the named mutex is owned by the first process. The named +// mutex is destroyed when all the Mutex objects that represent it +// have been released. +// The second process (and any subsequent process) waits for earlier +// processes to release the named mutex. +using namespace System; +using namespace System::Threading; +int main() +{ + + // Set this variable to false if you do not want to request + // initial ownership of the named mutex. + bool requestInitialOwnership = true; + bool mutexWasCreated; + + // Request initial ownership of the named mutex by passing + // true for the first parameter. Only one system object named + // "MyMutex" can exist; the local Mutex object represents + // this system object. If "MyMutex" is created by this call, + // then mutexWasCreated contains true; otherwise, it contains + // false. + Mutex^ m = gcnew Mutex( requestInitialOwnership, "MyMutex", mutexWasCreated ); + + // This thread owns the mutex only if it both requested + // initial ownership and created the named mutex. Otherwise, + // it can request the named mutex by calling WaitOne. + if ( !(requestInitialOwnership && mutexWasCreated) ) + { + Console::WriteLine( "Waiting for the named mutex." ); + m->WaitOne(); + } + + + // Once the process has gained control of the named mutex, + // hold onto it until the user presses ENTER. + Console::WriteLine( "This process owns the named mutex. " + "Press ENTER to release the mutex and exit." ); + Console::ReadLine(); + + // Call ReleaseMutex to allow other threads to gain control + // of the named mutex. If you keep a reference to the local + // Mutex, you can call WaitOne to request control of the + // named mutex. + m->ReleaseMutex(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp new file mode 100644 index 00000000000..958035c2e03 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex Default Ctor Example/CPP/class1.cpp @@ -0,0 +1,66 @@ + +// +// This example shows how a Mutex is used to synchronize access +// to a protected resource. Unlike Monitor, Mutex can be used with +// WaitHandle.WaitAll and WaitAny, and can be passed across +// AppDomain boundaries. +using namespace System; +using namespace System::Threading; +const int numIterations = 1; +const int numThreads = 3; +ref class Test +{ +public: + + // Create a new Mutex. The creating thread does not own the + // Mutex. + static Mutex^ mut = gcnew Mutex; + static void MyThreadProc() + { + for ( int i = 0; i < numIterations; i++ ) + { + UseResource(); + + } + } + + +private: + + // This method represents a resource that must be synchronized + // so that only one thread at a time can enter. + static void UseResource() + { + + //Wait until it is OK to enter. + mut->WaitOne(); + Console::WriteLine( "{0} has entered protected the area", Thread::CurrentThread->Name ); + + // Place code to access non-reentrant resources here. + // Simulate some work. + Thread::Sleep( 500 ); + Console::WriteLine( "{0} is leaving protected the area\r\n", Thread::CurrentThread->Name ); + + // Release the Mutex. + mut->ReleaseMutex(); + } + +}; + +int main() +{ + + // Create the threads that will use the protected resource. + for ( int i = 0; i < numThreads; i++ ) + { + Thread^ myThread = gcnew Thread( gcnew ThreadStart( Test::MyThreadProc ) ); + myThread->Name = String::Format( "Thread {0}", i + 1 ); + myThread->Start(); + + } + + // The main thread exits, but the application continues to + // run until all foreground threads have exited. +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp new file mode 100644 index 00000000000..26673315e5e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Mutex.ctor named 4/CPP/source.cpp @@ -0,0 +1,197 @@ +// +using namespace System; +using namespace System::Threading; +using namespace System::Security::AccessControl; +using namespace System::Security::Permissions; + +public ref class Example +{ +public: + [SecurityPermissionAttribute(SecurityAction::Demand,Flags=SecurityPermissionFlag::UnmanagedCode)] + static void Main() + { + // + String^ mutexName = L"MutexExample4"; + + Mutex^ m = nullptr; + bool doesNotExist = false; + bool unauthorized = false; + + // The value of this variable is set by the mutex + // constructor. It is true if the named system mutex was + // created, and false if the named mutex already existed. + // + bool mutexWasCreated = false; + + // Attempt to open the named mutex. + try + { + // Open the mutex with (MutexRights.Synchronize | + // MutexRights.Modify), to enter and release the + // named mutex. + // + m = Mutex::OpenExisting( mutexName ); + } + catch ( WaitHandleCannotBeOpenedException^ ) + { + Console::WriteLine( L"Mutex does not exist." ); + doesNotExist = true; + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); + unauthorized = true; + } + // + + // There are three cases: (1) The mutex does not exist. + // (2) The mutex exists, but the current user doesn't + // have access. (3) The mutex exists and the user has + // access. + // + if ( doesNotExist ) + { + // + // The mutex does not exist, so create it. + // Create an access control list (ACL) that denies the + // current user the right to enter or release the + // mutex, but allows the right to read and change + // security information for the mutex. + // + String^ user = String::Concat( Environment::UserDomainName, L"\\", + Environment::UserName ); + MutexSecurity^ mSec = gcnew MutexSecurity; + + MutexAccessRule^ rule = gcnew MutexAccessRule( user, + static_cast( + MutexRights::Synchronize | + MutexRights::Modify), + AccessControlType::Deny ); + mSec->AddAccessRule( rule ); + + rule = gcnew MutexAccessRule( user, + static_cast( + MutexRights::ReadPermissions | + MutexRights::ChangePermissions), + AccessControlType::Allow ); + mSec->AddAccessRule( rule ); + + // Create a Mutex object that represents the system + // mutex named by the constant 'mutexName', with + // initial ownership for this thread, and with the + // specified security access. The Boolean value that + // indicates creation of the underlying system object + // is placed in mutexWasCreated. + // + m = gcnew Mutex( true,mutexName, mutexWasCreated,mSec ); + + // If the named system mutex was created, it can be + // used by the current instance of this program, even + // though the current user is denied access. The current + // program owns the mutex. Otherwise, exit the program. + // + if ( mutexWasCreated ) + { + Console::WriteLine( L"Created the mutex." ); + } + else + { + Console::WriteLine( L"Unable to create the mutex." ); + return; + } + // + } + else if ( unauthorized ) + { + // + // Open the mutex to read and change the access control + // security. The access control security defined above + // allows the current user to do this. + // + try + { + m = Mutex::OpenExisting( mutexName, + static_cast( + MutexRights::ReadPermissions | + MutexRights::ChangePermissions) ); + + // Get the current ACL. This requires + // MutexRights.ReadPermissions. + MutexSecurity^ mSec = m->GetAccessControl(); + + String^ user = String::Concat( Environment::UserDomainName, + L"\\", Environment::UserName ); + + // First, the rule that denied the current user + // the right to enter and release the mutex must + // be removed. + MutexAccessRule^ rule = gcnew MutexAccessRule( user, + static_cast( + MutexRights::Synchronize | + MutexRights::Modify), + AccessControlType::Deny ); + mSec->RemoveAccessRule( rule ); + + // Now grant the user the correct rights. + // + rule = gcnew MutexAccessRule( user, + static_cast( + MutexRights::Synchronize | + MutexRights::Modify), + AccessControlType::Allow ); + mSec->AddAccessRule( rule ); + + // Update the ACL. This requires + // MutexRights.ChangePermissions. + m->SetAccessControl( mSec ); + + Console::WriteLine( L"Updated mutex security." ); + + // Open the mutex with (MutexRights.Synchronize + // | MutexRights.Modify), the rights required to + // enter and release the mutex. + // + m = Mutex::OpenExisting( mutexName ); + // + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( + L"Unable to change permissions: {0}", ex->Message ); + return; + } + } + + // If this program created the mutex, it already owns + // the mutex. + // + if ( !mutexWasCreated ) + { + // Enter the mutex, and hold it until the program + // exits. + // + try + { + Console::WriteLine( L"Wait for the mutex." ); + m->WaitOne(); + Console::WriteLine( L"Entered the mutex." ); + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unauthorized access: {0}", + ex->Message ); + } + } + + Console::WriteLine( L"Press the Enter key to exit." ); + Console::ReadLine(); + m->ReleaseMutex(); + m->Dispose(); + } +}; + +int main() +{ + Example::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp new file mode 100644 index 00000000000..6395c7d937d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ParameterizedThreadStart/CPP/source.cpp @@ -0,0 +1,49 @@ +// +using namespace System; +using namespace System::Threading; + +namespace SystemThreadingExample +{ + public ref class Work + { + public: + void StartThreads() + { + // Start a thread that calls a parameterized static method. + Thread^ newThread = gcnew + Thread(gcnew ParameterizedThreadStart(Work::DoWork)); + newThread->Start(42); + + // Start a thread that calls a parameterized instance method. + Work^ someWork = gcnew Work; + newThread = gcnew Thread( + gcnew ParameterizedThreadStart(someWork, + &Work::DoMoreWork)); + newThread->Start("The answer."); + } + + static void DoWork(Object^ data) + { + Console::WriteLine("Static thread procedure. Data='{0}'", + data); + } + + void DoMoreWork(Object^ data) + { + Console::WriteLine("Instance thread procedure. Data='{0}'", + data); + } + }; +} + +//Entry point of example application +int main() +{ + SystemThreadingExample::Work^ samplework = + gcnew SystemThreadingExample::Work(); + samplework->StartThreads(); +} +// This example displays output like the following: +// Static thread procedure. Data='42' +// Instance thread procedure. Data='The answer.' +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp new file mode 100644 index 00000000000..36560d92fa5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock.IsWriterLockHeld/CPP/source.cpp @@ -0,0 +1,44 @@ + +// +using namespace System; +using namespace System::Threading; +int main() +{ + ReaderWriterLock^ rwLock = gcnew ReaderWriterLock; + rwLock->AcquireWriterLock( Timeout::Infinite ); + rwLock->AcquireReaderLock( Timeout::Infinite ); + if ( rwLock->IsReaderLockHeld ) + { + Console::WriteLine( "Reader lock held." ); + rwLock->ReleaseReaderLock(); + } + else + if ( rwLock->IsWriterLockHeld ) + { + Console::WriteLine( "Writer lock held." ); + rwLock->ReleaseWriterLock(); + } + else + { + Console::WriteLine( "No locks held." ); + } + + + if ( rwLock->IsReaderLockHeld ) + { + Console::WriteLine( "Reader lock held." ); + rwLock->ReleaseReaderLock(); + } + else + if ( rwLock->IsWriterLockHeld ) + { + Console::WriteLine( "Writer lock held." ); + rwLock->ReleaseWriterLock(); + } + else + { + Console::WriteLine( "No locks held." ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp new file mode 100644 index 00000000000..1aca8464071 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ReaderWriterLock/CPP/source.cpp @@ -0,0 +1,320 @@ +// +// This example shows a ReaderWriterLock protecting a shared +// resource that is read concurrently and written exclusively +// by multiple threads. +// +// The complete code is located in the ReaderWriterLock +// class topic. +using namespace System; +using namespace System::Threading; +public ref class Test +{ +public: + + // Declaring the ReaderWriterLock at the class level + // makes it visible to all threads. + static ReaderWriterLock^ rwl = gcnew ReaderWriterLock; + + // For this example, the shared resource protected by the + // ReaderWriterLock is just an integer. + static int resource = 0; + + // + literal int numThreads = 26; + static bool running = true; + + // Statistics. + static int readerTimeouts = 0; + static int writerTimeouts = 0; + static int reads = 0; + static int writes = 0; + static void ThreadProc() + { + Random^ rnd = gcnew Random; + + // As long as a thread runs, it randomly selects + // various ways to read and write from the shared + // resource. Each of the methods demonstrates one + // or more features of ReaderWriterLock. + while ( running ) + { + double action = rnd->NextDouble(); + if ( action < .8 ) + ReadFromResource( 10 ); + else + if ( action < .81 ) + ReleaseRestore( rnd, 50 ); + else + if ( action < .90 ) + UpgradeDowngrade( rnd, 100 ); + else + WriteToResource( rnd, 100 ); + } + } + + + // + // Shows how to request and release a reader lock, and + // how to handle time-outs. + static void ReadFromResource( int timeOut ) + { + try + { + rwl->AcquireReaderLock( timeOut ); + try + { + + // It is safe for this thread to read from + // the shared resource. + Display( String::Format( "reads resource value {0}", resource ) ); + Interlocked::Increment( reads ); + } + finally + { + + // Ensure that the lock is released. + rwl->ReleaseReaderLock(); + } + + } + catch ( ApplicationException^ ) + { + + // The reader lock request timed out. + Interlocked::Increment( readerTimeouts ); + } + + } + + + // + // + // Shows how to request and release the writer lock, and + // how to handle time-outs. + static void WriteToResource( Random^ rnd, int timeOut ) + { + try + { + rwl->AcquireWriterLock( timeOut ); + try + { + + // It is safe for this thread to read or write + // from the shared resource. + resource = rnd->Next( 500 ); + Display( String::Format( "writes resource value {0}", resource ) ); + Interlocked::Increment( writes ); + } + finally + { + + // Ensure that the lock is released. + rwl->ReleaseWriterLock(); + } + + } + catch ( ApplicationException^ ) + { + + // The writer lock request timed out. + Interlocked::Increment( writerTimeouts ); + } + + } + + + // + // + // Shows how to request a reader lock, upgrade the + // reader lock to the writer lock, and downgrade to a + // reader lock again. + static void UpgradeDowngrade( Random^ rnd, int timeOut ) + { + try + { + rwl->AcquireReaderLock( timeOut ); + try + { + + // It is safe for this thread to read from + // the shared resource. + Display( String::Format( "reads resource value {0}", resource ) ); + Interlocked::Increment( reads ); + + // If it is necessary to write to the resource, + // you must either release the reader lock and + // then request the writer lock, or upgrade the + // reader lock. Note that upgrading the reader lock + // puts the thread in the write queue, behind any + // other threads that might be waiting for the + // writer lock. + try + { + LockCookie lc = rwl->UpgradeToWriterLock( timeOut ); + try + { + + // It is safe for this thread to read or write + // from the shared resource. + resource = rnd->Next( 500 ); + Display( String::Format( "writes resource value {0}", resource ) ); + Interlocked::Increment( writes ); + } + finally + { + + // Ensure that the lock is released. + rwl->DowngradeFromWriterLock( lc ); + } + + } + catch ( ApplicationException^ ) + { + + // The upgrade request timed out. + Interlocked::Increment( writerTimeouts ); + } + + + // When the lock has been downgraded, it is + // still safe to read from the resource. + Display( String::Format( "reads resource value {0}", resource ) ); + Interlocked::Increment( reads ); + } + finally + { + + // Ensure that the lock is released. + rwl->ReleaseReaderLock(); + } + + } + catch ( ApplicationException^ ) + { + + // The reader lock request timed out. + Interlocked::Increment( readerTimeouts ); + } + + } + + + // + // + // Shows how to release all locks and later restore + // the lock state. Shows how to use sequence numbers + // to determine whether another thread has obtained + // a writer lock since this thread last accessed the + // resource. + static void ReleaseRestore( Random^ rnd, int timeOut ) + { + int lastWriter; + try + { + rwl->AcquireReaderLock( timeOut ); + try + { + + // It is safe for this thread to read from + // the shared resource. Cache the value. (You + // might do this if reading the resource is + // an expensive operation.) + int resourceValue = resource; + Display( String::Format( "reads resource value {0}", resourceValue ) ); + Interlocked::Increment( reads ); + + // Save the current writer sequence number. + lastWriter = rwl->WriterSeqNum; + + // Release the lock, and save a cookie so the + // lock can be restored later. + LockCookie lc = rwl->ReleaseLock(); + + // Wait for a random interval (up to a + // quarter of a second), and then restore + // the previous state of the lock. Note that + // there is no timeout on the Restore method. + Thread::Sleep( rnd->Next( 250 ) ); + rwl->RestoreLock( lc ); + + // Check whether other threads obtained the + // writer lock in the interval. If not, then + // the cached value of the resource is still + // valid. + if ( rwl->AnyWritersSince( lastWriter ) ) + { + resourceValue = resource; + Interlocked::Increment( reads ); + Display( String::Format( "resource has changed {0}", resourceValue ) ); + } + else + { + Display( String::Format( "resource has not changed {0}", resourceValue ) ); + } + } + finally + { + + // Ensure that the lock is released. + rwl->ReleaseReaderLock(); + } + + } + catch ( ApplicationException^ ) + { + + // The reader lock request timed out. + Interlocked::Increment( readerTimeouts ); + } + + } + + + // + // Helper method briefly displays the most recent + // thread action. Comment out calls to Display to + // get a better idea of throughput. + static void Display( String^ msg ) + { + Console::Write( "Thread {0} {1}. \r", Thread::CurrentThread->Name, msg ); + } + + // +}; + + +// +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // Start a series of threads. Each thread randomly + // performs reads and writes on the shared resource. + array^t = gcnew array(Test::numThreads); + for ( int i = 0; i < Test::numThreads; i++ ) + { + t[ i ] = gcnew Thread( gcnew ThreadStart( Test::ThreadProc ) ); + t[ i ]->Name = gcnew String( Convert::ToChar( i + 65 ),1 ); + t[ i ]->Start(); + if ( i > 10 ) + Thread::Sleep( 300 ); + + } + + // Tell the threads to shut down, then wait until they all + // finish. + Test::running = false; + for ( int i = 0; i < Test::numThreads; i++ ) + { + t[ i ]->Join(); + + } + + // Display statistics. + Console::WriteLine( "\r\n {0} reads, {1} writes, {2} reader time-outs, {3} writer time-outs.", Test::reads, Test::writes, Test::readerTimeouts, Test::writerTimeouts ); + Console::WriteLine( "Press ENTER to exit." ); + Console::ReadLine(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp new file mode 100644 index 00000000000..c9829906328 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 3/CPP/source.cpp @@ -0,0 +1,58 @@ +// +#using +using namespace System; +using namespace System::Threading; + +public ref class Example +{ +public: + static void main() + { + // Create a Semaphore object that represents the named + // system semaphore "SemaphoreExample3". The semaphore has a + // maximum count of five. The initial count is also five. + // There is no point in using a smaller initial count, + // because the initial count is not used if this program + // doesn't create the named system semaphore, and with + // this method overload there is no way to tell. Thus, this + // program assumes that it is competing with other + // programs for the semaphore. + // + Semaphore^ sem = gcnew Semaphore( 5,5,L"SemaphoreExample3" ); + + // Attempt to enter the semaphore three times. If another + // copy of this program is already running, only the first + // two requests can be satisfied. The third blocks. Note + // that in a real application, timeouts should be used + // on the WaitOne calls, to avoid deadlocks. + // + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore once." ); + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore twice." ); + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore three times." ); + + // The thread executing this program has entered the + // semaphore three times. If a second copy of the program + // is run, it will block until this program releases the + // semaphore at least once. + // + Console::WriteLine( L"Enter the number of times to call Release." ); + int n; + if ( Int32::TryParse( Console::ReadLine(),n ) ) + { + sem->Release( n ); + } + + int remaining = 3 - n; + if ( remaining > 0 ) + { + Console::WriteLine( L"Press Enter to release the remaining " + L"count ({0}) and exit the program.", remaining ); + Console::ReadLine(); + sem->Release( remaining ); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp new file mode 100644 index 00000000000..a51b308ac9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 4/CPP/source.cpp @@ -0,0 +1,71 @@ +// +#using +using namespace System; +using namespace System::Threading; + +public ref class Example +{ +public: + static void main() + { + // The value of this variable is set by the semaphore + // constructor. It is true if the named system semaphore was + // created, and false if the named semaphore already existed. + // + bool semaphoreWasCreated; + + // Create a Semaphore object that represents the named + // system semaphore "SemaphoreExample". The semaphore has a + // maximum count of five, and an initial count of two. The + // Boolean value that indicates creation of the underlying + // system object is placed in semaphoreWasCreated. + // + Semaphore^ sem = gcnew Semaphore( 2,5,L"SemaphoreExample", + semaphoreWasCreated ); + if ( semaphoreWasCreated ) + { + // If the named system semaphore was created, its count is + // set to the initial count requested in the constructor. + // In effect, the current thread has entered the semaphore + // three times. + // + Console::WriteLine( L"Entered the semaphore three times." ); + } + else + { + // If the named system semaphore was not created, + // attempt to enter it three times. If another copy of + // this program is already running, only the first two + // requests can be satisfied. The third blocks. + // + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore once." ); + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore twice." ); + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore three times." ); + } + + // The thread executing this program has entered the + // semaphore three times. If a second copy of the program + // is run, it will block until this program releases the + // semaphore at least once. + // + Console::WriteLine( L"Enter the number of times to call Release." ); + int n; + if ( Int32::TryParse( Console::ReadLine(), n ) ) + { + sem->Release( n ); + } + + int remaining = 3 - n; + if ( remaining > 0 ) + { + Console::WriteLine( L"Press Enter to release the remaining " + L"count ({0}) and exit the program.", remaining ); + Console::ReadLine(); + sem->Release( remaining ); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp new file mode 100644 index 00000000000..471a8d1e8b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore.ctor named 5a/CPP/source.cpp @@ -0,0 +1,186 @@ +// +#using +using namespace System; +using namespace System::Threading; +using namespace System::Security::AccessControl; +using namespace System::Security::Permissions; + +public ref class Example +{ +public: + [SecurityPermissionAttribute(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)] + static void main() + { + // + String^ semaphoreName = L"SemaphoreExample5"; + + Semaphore^ sem = nullptr; + bool doesNotExist = false; + bool unauthorized = false; + + // Attempt to open the named semaphore. + try + { + // Open the semaphore with (SemaphoreRights.Synchronize + // | SemaphoreRights.Modify), to enter and release the + // named semaphore. + // + sem = Semaphore::OpenExisting( semaphoreName ); + } + catch ( WaitHandleCannotBeOpenedException^ ex ) + { + Console::WriteLine( L"Semaphore does not exist." ); + doesNotExist = true; + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); + unauthorized = true; + } + // + + // There are three cases: (1) The semaphore does not exist. + // (2) The semaphore exists, but the current user doesn't + // have access. (3) The semaphore exists and the user has + // access. + // + if ( doesNotExist ) + { + // + // The semaphore does not exist, so create it. + // + // The value of this variable is set by the semaphore + // constructor. It is true if the named system semaphore was + // created, and false if the named semaphore already existed. + // + bool semaphoreWasCreated; + + // Create an access control list (ACL) that denies the + // current user the right to enter or release the + // semaphore, but allows the right to read and change + // security information for the semaphore. + // + String^ user = String::Concat( Environment::UserDomainName, + L"\\", Environment::UserName ); + SemaphoreSecurity^ semSec = gcnew SemaphoreSecurity; + + SemaphoreAccessRule^ rule = gcnew SemaphoreAccessRule( user, + static_cast( + SemaphoreRights::Synchronize | + SemaphoreRights::Modify ), + AccessControlType::Deny ); + semSec->AddAccessRule( rule ); + + rule = gcnew SemaphoreAccessRule( user, + static_cast( + SemaphoreRights::ReadPermissions | + SemaphoreRights::ChangePermissions ), + AccessControlType::Allow ); + semSec->AddAccessRule( rule ); + + // Create a Semaphore object that represents the system + // semaphore named by the constant 'semaphoreName', with + // maximum count three, initial count three, and the + // specified security access. The Boolean value that + // indicates creation of the underlying system object is + // placed in semaphoreWasCreated. + // + sem = gcnew Semaphore( 3,3,semaphoreName,semaphoreWasCreated,semSec ); + + // If the named system semaphore was created, it can be + // used by the current instance of this program, even + // though the current user is denied access. The current + // program enters the semaphore. Otherwise, exit the + // program. + // + if ( semaphoreWasCreated ) + { + Console::WriteLine( L"Created the semaphore." ); + } + else + { + Console::WriteLine( L"Unable to create the semaphore." ); + return; + } + // + + } + else if ( unauthorized ) + { + // + // Open the semaphore to read and change the access + // control security. The access control security defined + // above allows the current user to do this. + // + try + { + sem = Semaphore::OpenExisting( semaphoreName, + static_cast( + SemaphoreRights::ReadPermissions | + SemaphoreRights::ChangePermissions )); + + // Get the current ACL. This requires + // SemaphoreRights.ReadPermissions. + SemaphoreSecurity^ semSec = sem->GetAccessControl(); + + String^ user = String::Concat( Environment::UserDomainName, + L"\\", Environment::UserName ); + + // First, the rule that denied the current user + // the right to enter and release the semaphore must + // be removed. + SemaphoreAccessRule^ rule = gcnew SemaphoreAccessRule( user, + static_cast( + SemaphoreRights::Synchronize | + SemaphoreRights::Modify ), + AccessControlType::Deny ); + semSec->RemoveAccessRule( rule ); + + // Now grant the user the correct rights. + // + rule = gcnew SemaphoreAccessRule( user, + static_cast( + SemaphoreRights::Synchronize | + SemaphoreRights::Modify ), + AccessControlType::Allow ); + semSec->AddAccessRule( rule ); + + // Update the ACL. This requires + // SemaphoreRights.ChangePermissions. + sem->SetAccessControl( semSec ); + + Console::WriteLine( L"Updated semaphore security." ); + + // Open the semaphore with (SemaphoreRights.Synchronize + // | SemaphoreRights.Modify), the rights required to + // enter and release the semaphore. + // + sem = Semaphore::OpenExisting( semaphoreName ); + // + + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unable to change permissions: {0}", ex->Message ); + return; + } + } + + // Enter the semaphore, and hold it until the program + // exits. + // + try + { + sem->WaitOne(); + Console::WriteLine( L"Entered the semaphore." ); + Console::WriteLine( L"Press the Enter key to exit." ); + Console::ReadLine(); + sem->Release(); + } + catch ( UnauthorizedAccessException^ ex ) + { + Console::WriteLine( L"Unauthorized access: {0}", ex->Message ); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp new file mode 100644 index 00000000000..13cb5b616e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Semaphore2/CPP/source.cpp @@ -0,0 +1,79 @@ +// +#using +using namespace System; +using namespace System::Threading; + +public ref class Example +{ +private: + // A semaphore that simulates a limited resource pool. + // + static Semaphore^ _pool; + + // A padding interval to make the output more orderly. + static int _padding; + +public: + static void Main() + { + // Create a semaphore that can satisfy up to three + // concurrent requests. Use an initial count of zero, + // so that the entire semaphore count is initially + // owned by the main program thread. + // + _pool = gcnew Semaphore( 0,3 ); + + // Create and start five numbered threads. + // + for ( int i = 1; i <= 5; i++ ) + { + Thread^ t = gcnew Thread( + gcnew ParameterizedThreadStart( Worker ) ); + + // Start the thread, passing the number. + // + t->Start( i ); + } + + // Wait for half a second, to allow all the + // threads to start and to block on the semaphore. + // + Thread::Sleep( 500 ); + + // The main thread starts out holding the entire + // semaphore count. Calling Release(3) brings the + // semaphore count back to its maximum value, and + // allows the waiting threads to enter the semaphore, + // up to three at a time. + // + Console::WriteLine( L"Main thread calls Release(3)." ); + _pool->Release( 3 ); + + Console::WriteLine( L"Main thread exits." ); + } + +private: + static void Worker( Object^ num ) + { + // Each worker thread begins by requesting the + // semaphore. + Console::WriteLine( L"Thread {0} begins and waits for the semaphore.", num ); + _pool->WaitOne(); + + // A padding interval to make the output more orderly. + int padding = Interlocked::Add( _padding, 100 ); + + Console::WriteLine( L"Thread {0} enters the semaphore.", num ); + + // The thread's "work" consists of sleeping for + // about a second. Each thread "works" a little + // longer, just to make the output more orderly. + // + Thread::Sleep( 1000 + padding ); + + Console::WriteLine( L"Thread {0} releases the semaphore.", num ); + Console::WriteLine( L"Thread {0} previous semaphore count: {1}", + num, _pool->Release() ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp new file mode 100644 index 00000000000..91f6e6c03f5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.SemaphoreFullException/CPP/source.cpp @@ -0,0 +1,72 @@ +// +#using +using namespace System; +using namespace System::Threading; + +public ref class Example +{ +private: + // A semaphore that can satisfy at most two concurrent + // requests. + // + static Semaphore^ _pool = gcnew Semaphore( 2,2 ); + +public: + static void main() + { + // Create and start two threads, A and B. + // + Thread^ tA = gcnew Thread( gcnew ThreadStart( ThreadA ) ); + tA->Start(); + + Thread^ tB = gcnew Thread( gcnew ThreadStart( ThreadB ) ); + tB->Start(); + } + +private: + static void ThreadA() + { + // Thread A enters the semaphore and simulates a task + // that lasts a second. + // + _pool->WaitOne(); + Console::WriteLine( L"Thread A entered the semaphore." ); + + Thread::Sleep( 1000 ); + + try + { + _pool->Release(); + Console::WriteLine( L"Thread A released the semaphore." ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"Thread A: {0}", ex->Message ); + } + } + + static void ThreadB() + { + // Thread B simulates a task that lasts half a second, + // then enters the semaphore. + // + Thread::Sleep( 500 ); + + _pool->WaitOne(); + Console::WriteLine( L"Thread B entered the semaphore." ); + + // Due to a programming error, Thread B releases the + // semaphore twice. To fix the program, delete one line. + _pool->Release(); + _pool->Release(); + Console::WriteLine( L"Thread B exits successfully." ); + } +}; +/* This code example produces the following output: + +Thread A entered the semaphore. +Thread B entered the semaphore. +Thread B exits successfully. +Thread A: Adding the given count to the semaphore would cause it to exceed its maximum count. + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp new file mode 100644 index 00000000000..4ae633572bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Abort2/CPP/source.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; +ref class Test +{ +private: + Test(){} + + +public: + static void TestMethod() + { + try + { + while ( true ) + { + Console::WriteLine( "New thread running." ); + Thread::Sleep( 1000 ); + } + } + catch ( ThreadAbortException^ abortException ) + { + Console::WriteLine( dynamic_cast(abortException->ExceptionState) ); + } + + } + +}; + +int main() +{ + Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::TestMethod ) ); + newThread->Start(); + Thread::Sleep( 1000 ); + + // Abort newThread. + Console::WriteLine( "Main aborting new thread." ); + newThread->Abort( "Information from main." ); + + // Wait for the thread to terminate. + newThread->Join(); + Console::WriteLine( "New thread terminated - main exiting." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp new file mode 100644 index 00000000000..14f5dab19a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ApartmentState/CPP/source.cpp @@ -0,0 +1,40 @@ + +// +using namespace System; +using namespace System::Threading; +ref class ApartmentTest +{ +public: + static void ThreadMethod() + { + Thread::Sleep( 1000 ); + } + +}; + +int main() +{ + Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ApartmentTest::ThreadMethod ) ); + newThread->SetApartmentState(ApartmentState::MTA); + + Console::WriteLine( "ThreadState: {0}, ApartmentState: {1}", newThread->ThreadState.ToString(), newThread->GetApartmentState().ToString() ); + newThread->Start(); + + // Wait for newThread to start and go to sleep. + Thread::Sleep( 300 ); + try + { + + // This causes an exception since newThread is sleeping. + newThread->SetApartmentState(ApartmentState::STA); + } + catch ( ThreadStateException^ stateException ) + { + Console::WriteLine( "\n{0} caught:\n" + "Thread is not in the Unstarted or Running state.", stateException->GetType()->Name ); + Console::WriteLine( "ThreadState: {0}, ApartmentState: {1}", newThread->ThreadState.ToString(), newThread->GetApartmentState().ToString() ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp new file mode 100644 index 00000000000..99ee37687eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginCriticalRegion/CPP/source.cpp @@ -0,0 +1,25 @@ +// +using namespace System::Threading; + +public ref class MyUtility +{ +public: + void PerformTask() + { + // Code in this region can be aborted without affecting + // other tasks. + // + Thread::BeginCriticalRegion(); + // + // The host might decide to unload the application domain + // if a failure occurs in this code region. + // + Thread::EndCriticalRegion(); + // + // Code in this region can be aborted without affecting + // other tasks. + } +}; +// + +int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp new file mode 100644 index 00000000000..2fd262cc0fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.BeginThreadAffinity/CPP/source.cpp @@ -0,0 +1,24 @@ +// +using namespace System::Threading; +using namespace System::Security::Permissions; + +public ref class MyUtility +{ +public: + [SecurityPermissionAttribute(SecurityAction::Demand, ControlThread=true)] + void PerformTask() + { + // Code that does not have thread affinity goes here. + // + Thread::BeginThreadAffinity(); + // + // Code that has thread affinity goes here. + // + Thread::EndThreadAffinity(); + // + // More code that does not have thread affinity. + } +}; +// + +int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp new file mode 100644 index 00000000000..e91e5179e09 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Culture/CPP/source.cpp @@ -0,0 +1,29 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Threading; +using namespace System::Windows::Forms; +ref class UICulture: public Form +{ +public: + UICulture() + { + + // Set the user interface to display in the + // same culture as that set in Control Panel. + Thread::CurrentThread->CurrentUICulture = Thread::CurrentThread->CurrentCulture; + + // Add additional code. + } +}; + + +int main() +{ + Application::Run( gcnew UICulture ); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp new file mode 100644 index 00000000000..1ae83042eb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.CurrentPrincipal/CPP/source.cpp @@ -0,0 +1,29 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Principal; +using namespace System::Threading; + +int main() +{ + array^rolesArray = {"managers","executives"}; + try + { + + // Set the principal to a new generic principal. + Thread::CurrentPrincipal = gcnew GenericPrincipal( gcnew GenericIdentity( "Bob","Passport" ),rolesArray ); + } + catch ( SecurityException^ secureException ) + { + Console::WriteLine( "{0}: Permission to set Principal " + "is denied.", secureException->GetType()->Name ); + } + + IPrincipal^ threadPrincipal = Thread::CurrentPrincipal; + Console::WriteLine( "Name: {0}\nIsAuthenticated: {1}" + "\nAuthenticationType: {2}", threadPrincipal->Identity->Name, threadPrincipal->Identity->IsAuthenticated.ToString(), threadPrincipal->Identity->AuthenticationType ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp new file mode 100644 index 00000000000..88a93c82f9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DataSlot/CPP/source.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; +ref class Slot +{ +private: + static Random^ randomGenerator; + static LocalDataStoreSlot^ localSlot; + static Slot() + { + randomGenerator = gcnew Random; + localSlot = Thread::AllocateDataSlot(); + } + + +public: + static void SlotTest() + { + + // Set different data in each thread's data slot. + Thread::SetData( localSlot, randomGenerator->Next( 1, 200 ) ); + + // Write the data from each thread's data slot. + Console::WriteLine( "Data in thread_{0}'s data slot: {1,3}", AppDomain::GetCurrentThreadId().ToString(), Thread::GetData( localSlot )->ToString() ); + + // Allow other threads time to execute SetData to show + // that a thread's data slot is unique to the thread. + Thread::Sleep( 1000 ); + Console::WriteLine( "Data in thread_{0}'s data slot: {1,3}", AppDomain::GetCurrentThreadId().ToString(), Thread::GetData( localSlot )->ToString() ); + } + +}; + +int main() +{ + array^newThreads = gcnew array(4); + for ( int i = 0; i < newThreads->Length; i++ ) + { + newThreads[ i ] = gcnew Thread( gcnew ThreadStart( &Slot::SlotTest ) ); + newThreads[ i ]->Start(); + + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp new file mode 100644 index 00000000000..7e368cd0a1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.DoNotUseDataSlots/CPP/source.cpp @@ -0,0 +1,45 @@ + +// +using namespace System; +using namespace System::Threading; + +ref class ThreadData +{ +private: + [ThreadStatic] + static int threadSpecificData; + +public: + static void ThreadStaticDemo() + { + // Store the managed thread id for each thread in the static + // variable. + threadSpecificData = Thread::CurrentThread->ManagedThreadId; + + // Allow other threads time to execute the same code, to show + // that the static data is unique to each thread. + Thread::Sleep( 1000 ); + + // Display the static data. + Console::WriteLine( "Data for managed thread {0}: {1}", + Thread::CurrentThread->ManagedThreadId, threadSpecificData ); + } +}; + +int main() +{ + for ( int i = 0; i < 3; i++ ) + { + Thread^ newThread = + gcnew Thread( gcnew ThreadStart( ThreadData::ThreadStaticDemo )); + newThread->Start(); + } +} + +/* This code example produces output similar to the following: + +Data for managed thread 4: 4 +Data for managed thread 5: 5 +Data for managed thread 3: 3 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp new file mode 100644 index 00000000000..497071f1d0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Domain/CPP/source.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Threading; +ref class Test +{ +private: + Test(){} + + +public: + static void ThreadMethod() + { + Console::WriteLine( "Thread {0} started in {1} with AppDomainID = {2}.", AppDomain::GetCurrentThreadId().ToString(), Thread::GetDomain()->FriendlyName, Thread::GetDomainID().ToString() ); + } + +}; + +int main() +{ + Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Test::ThreadMethod ) ); + newThread->Start(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp new file mode 100644 index 00000000000..533813e424f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Interrupt/CPP/source.cpp @@ -0,0 +1,75 @@ + +// +using namespace System; +using namespace System::Security::Permissions; +using namespace System::Threading; + +ref class StayAwake +{ +private: + bool sleepSwitch; + +public: + + property bool SleepSwitch + { + void set( bool value ) + { + sleepSwitch = value; + } + + } + StayAwake() + { + sleepSwitch = false; + } + + void ThreadMethod() + { + Console::WriteLine( "newThread is executing ThreadMethod." ); + while ( !sleepSwitch ) + { + + // Use SpinWait instead of Sleep to demonstrate the + // effect of calling Interrupt on a running thread. + Thread::SpinWait( 10000000 ); + } + + try + { + Console::WriteLine( "newThread going to sleep." ); + + // When newThread goes to sleep, it is immediately + // woken up by a ThreadInterruptedException. + Thread::Sleep( Timeout::Infinite ); + } + catch ( ThreadInterruptedException^ /*e*/ ) + { + Console::WriteLine( "newThread cannot go to sleep - " + "interrupted by main thread." ); + } + + } + +}; + +int main() +{ + StayAwake^ stayAwake = gcnew StayAwake; + Thread^ newThread = gcnew Thread( gcnew ThreadStart( stayAwake, &StayAwake::ThreadMethod ) ); + newThread->Start(); + + // The following line causes an exception to be thrown + // in ThreadMethod if newThread is currently blocked + // or becomes blocked in the future. + newThread->Interrupt(); + Console::WriteLine( "Main thread calls Interrupt on newThread." ); + + // Then tell newThread to go to sleep. + stayAwake->SleepSwitch = true; + + // Wait for newThread to end. + newThread->Join(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp new file mode 100644 index 00000000000..7743178ff7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsBackground/CPP/source.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; + +ref class BackgroundTest +{ +private: + int maxIterations; + +public: + BackgroundTest(int maxIterations) + { + this->maxIterations = maxIterations; + } + + void RunLoop() + { + for (int i = 0; i < maxIterations; i++ ) + { + Console::WriteLine("{0} count: {1}", + Thread::CurrentThread->IsBackground ? + "Background Thread" : "Foreground Thread", i); + Thread::Sleep(250); + + } + Console::WriteLine("{0} finished counting.", + Thread::CurrentThread->IsBackground ? + "Background Thread" : "Foreground Thread"); + } +}; + +int main() +{ + BackgroundTest^ shortTest = gcnew BackgroundTest( 10 ); + Thread^ foregroundThread = gcnew Thread( gcnew ThreadStart( shortTest, &BackgroundTest::RunLoop ) ); + foregroundThread->Name = "ForegroundThread"; + BackgroundTest^ longTest = gcnew BackgroundTest( 50 ); + Thread^ backgroundThread = gcnew Thread( gcnew ThreadStart( longTest, &BackgroundTest::RunLoop ) ); + backgroundThread->Name = "BackgroundThread"; + backgroundThread->IsBackground = true; + foregroundThread->Start(); + backgroundThread->Start(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp new file mode 100644 index 00000000000..9ae320e27d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.IsThreadPoolThread/CPP/source.cpp @@ -0,0 +1,43 @@ + +// +using namespace System; +using namespace System::Threading; +ref class IsThreadPool +{ +public: + + // + static void ThreadMethod() + { + Console::WriteLine( "ThreadOne, executing ThreadMethod, " + "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " ); + } + + + // + static void WorkMethod( Object^ stateInfo ) + { + Console::WriteLine( "ThreadTwo, executing WorkMethod, " + "is {0}from the thread pool.", Thread::CurrentThread->IsThreadPoolThread ? (String^)"" : "not " ); + + // Signal that this thread is finished. + dynamic_cast(stateInfo)->Set(); + } + +}; + +int main() +{ + AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); + Thread^ regularThread = gcnew Thread( gcnew ThreadStart( &IsThreadPool::ThreadMethod ) ); + regularThread->Start(); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &IsThreadPool::WorkMethod ), autoEvent ); + + // Wait for foreground thread to end. + regularThread->Join(); + + // Wait for background thread to end. + autoEvent->WaitOne(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp new file mode 100644 index 00000000000..7ef570a3bad --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.NamedDataSlot/CPP/source.cpp @@ -0,0 +1,72 @@ +// +using namespace System; +using namespace System::Threading; + +ref class Slot +{ +private: + static Random^ randomGenerator = gcnew Random(); + +public: + static void SlotTest() + { + // Set random data in each thread's data slot. + int slotData = randomGenerator->Next(1, 200); + int threadId = Thread::CurrentThread->ManagedThreadId; + + Thread::SetData( + Thread::GetNamedDataSlot("Random"), + slotData); + + // Show what was saved in the thread's data slot. + Console::WriteLine("Data stored in thread_{0}'s data slot: {1,3}", + threadId, slotData); + + // Allow other threads time to execute SetData to show + // that a thread's data slot is unique to itself. + Thread::Sleep(1000); + + int newSlotData = + (int)Thread::GetData(Thread::GetNamedDataSlot("Random")); + + if (newSlotData == slotData) + { + Console::WriteLine("Data in thread_{0}'s data slot is still: {1,3}", + threadId, newSlotData); + } + else + { + Console::WriteLine("Data in thread_{0}'s data slot changed to: {1,3}", + threadId, newSlotData); + } + } +}; + +ref class Test +{ +public: + static void Main() + { + array^ newThreads = gcnew array(4); + int i; + for (i = 0; i < newThreads->Length; i++) + { + newThreads[i] = + gcnew Thread(gcnew ThreadStart(&Slot::SlotTest)); + newThreads[i]->Start(); + } + Thread::Sleep(2000); + for (i = 0; i < newThreads->Length; i++) + { + newThreads[i]->Join(); + Console::WriteLine("Thread_{0} finished.", + newThreads[i]->ManagedThreadId); + } + } +}; + +int main() +{ + Test::Main(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp new file mode 100644 index 00000000000..3f8ee654cfc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.Timespan/CPP/source.cpp @@ -0,0 +1,33 @@ + +// +using namespace System; +using namespace System::Threading; + +static TimeSpan waitTime = TimeSpan(0,0,1); + +ref class Test +{ +public: + static void Work() + { + Thread::Sleep( waitTime ); + } + +}; + +int main() +{ + Thread^ newThread = gcnew Thread( gcnew ThreadStart( Test::Work ) ); + newThread->Start(); + if ( newThread->Join( waitTime + waitTime ) ) + { + Console::WriteLine( "New thread terminated." ); + } + else + { + Console::WriteLine( "Join timed out." ); + } +} +// The example displays the following output: +// New thread terminated. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp new file mode 100644 index 00000000000..d4ca56d299c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor/CPP/source.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::Threading; +ref class Work +{ +private: + Work(){} + + +public: + static void DoWork(){} + +}; + +int main() +{ + Thread^ newThread = gcnew Thread( gcnew ThreadStart( &Work::DoWork ) ); + newThread->Start(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp new file mode 100644 index 00000000000..0ac57be1362 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Thread.ctor2/CPP/source.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +using namespace System::Threading; +ref class Work +{ +public: + Work(){} + + void DoWork(){} + +}; + +int main() +{ + Work^ threadWork = gcnew Work; + Thread^ newThread = gcnew Thread( gcnew ThreadStart( threadWork, &Work::DoWork ) ); + newThread->Start(); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp new file mode 100644 index 00000000000..2f2ccf1a8d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem0/CPP/source.cpp @@ -0,0 +1,34 @@ + +// +using namespace System; +using namespace System::Threading; + +ref class Example +{ +public: + + // This thread procedure performs the task. + static void ThreadProc(Object^ stateInfo) + { + + // No state object was passed to QueueUserWorkItem, so stateInfo is 0. + Console::WriteLine( "Hello from the thread pool." ); + } +}; + +int main() +{ + // Queue the task. + ThreadPool::QueueUserWorkItem(gcnew WaitCallback(Example::ThreadProc)); + + Console::WriteLine("Main thread does some work, then sleeps."); + + Thread::Sleep(1000); + Console::WriteLine("Main thread exits."); + return 0; +} +// The example displays output like the following: +// Main thread does some work, then sleeps. +// Hello from the thread pool. +// Main thread exits. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp new file mode 100644 index 00000000000..94c24506593 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool QueueUserWorkItem1/CPP/source.cpp @@ -0,0 +1,103 @@ +// +using namespace System; +using namespace System::Threading; + +public ref class Fibonacci +{ +private: + ManualResetEvent^ _doneEvent; + + int Calculate(int n) + { + if (n <= 1) + { + return n; + } + return Calculate(n - 1) + Calculate(n - 2); + } + +public: + + int ID; + int N; + int FibOfN; + + Fibonacci(int id, int n, ManualResetEvent^ doneEvent) + { + ID = id; + N = n; + _doneEvent = doneEvent; + } + + void Calculate() + { + FibOfN = Calculate(N); + } + + void SetDone() + { + _doneEvent->Set(); + } +}; + +public ref struct Example +{ +public: + + static void ThreadProc(Object^ stateInfo) + { + Fibonacci^ f = dynamic_cast(stateInfo); + Console::WriteLine("Thread {0} started...", f->ID); + f->Calculate(); + Console::WriteLine("Thread {0} result calculated...", f->ID); + f->SetDone(); + } +}; + + +void main() +{ + const int FibonacciCalculations = 5; + + array^ doneEvents = gcnew array(FibonacciCalculations); + array^ fibArray = gcnew array(FibonacciCalculations); + Random^ rand = gcnew Random(); + + Console::WriteLine("Launching {0} tasks...", FibonacciCalculations); + + for (int i = 0; i < FibonacciCalculations; i++) + { + doneEvents[i] = gcnew ManualResetEvent(false); + Fibonacci^ f = gcnew Fibonacci(i, rand->Next(20, 40), doneEvents[i]); + fibArray[i] = f; + ThreadPool::QueueUserWorkItem(gcnew WaitCallback(Example::ThreadProc), f); + } + + WaitHandle::WaitAll(doneEvents); + Console::WriteLine("All calculations are complete."); + + for (int i = 0; i < FibonacciCalculations; i++) + { + Fibonacci^ f = fibArray[i]; + Console::WriteLine("Fibonacci({0}) = {1}", f->N, f->FibOfN); + } +} +// Output is similar to: +// Launching 5 tasks... +// Thread 3 started... +// Thread 2 started... +// Thread 1 started... +// Thread 0 started... +// Thread 4 started... +// Thread 4 result calculated... +// Thread 1 result calculated... +// Thread 2 result calculated... +// Thread 0 result calculated... +// Thread 3 result calculated... +// All calculations are complete. +// Fibonacci(30) = 832040 +// Fibonacci(24) = 46368 +// Fibonacci(26) = 121393 +// Fibonacci(36) = 14930352 +// Fibonacci(20) = 6765 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp new file mode 100644 index 00000000000..290d35f3698 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool RegisterWaitForSingleObject0/CPP/source.cpp @@ -0,0 +1,86 @@ + +// +using namespace System; +using namespace System::Threading; + +// TaskInfo contains data that will be passed to the callback +// method. +public ref class TaskInfo +{ +public: + TaskInfo() + { + Handle = nullptr; + OtherInfo = "default"; + } + + RegisteredWaitHandle^ Handle; + String^ OtherInfo; +}; + +ref class Example +{ +public: + + // The callback method executes when the registered wait times out, + // or when the WaitHandle (in this case AutoResetEvent) is signaled. + // WaitProc unregisters the WaitHandle the first time the event is + // signaled. + static void WaitProc( Object^ state, bool timedOut ) + { + + // The state Object must be cast to the correct type, because the + // signature of the WaitOrTimerCallback delegate specifies type + // Object. + TaskInfo^ ti = static_cast(state); + String^ cause = "TIMED OUT"; + if ( !timedOut ) + { + cause = "SIGNALED"; + + // If the callback method executes because the WaitHandle is + // signaled, stop future execution of the callback method + // by unregistering the WaitHandle. + if ( ti->Handle != nullptr ) + ti->Handle->Unregister( nullptr ); + } + + Console::WriteLine( "WaitProc( {0}) executes on thread {1}; cause = {2}.", ti->OtherInfo, Thread::CurrentThread->GetHashCode(), cause ); + } + +}; + +int main() +{ + + // The main thread uses AutoResetEvent to signal the + // registered wait handle, which executes the callback + // method. + AutoResetEvent^ ev = gcnew AutoResetEvent( false ); + TaskInfo^ ti = gcnew TaskInfo; + ti->OtherInfo = "First task"; + + // The TaskInfo for the task includes the registered wait + // handle returned by RegisterWaitForSingleObject. This + // allows the wait to be terminated when the object has + // been signaled once (see WaitProc). + ti->Handle = ThreadPool::RegisterWaitForSingleObject( ev, gcnew WaitOrTimerCallback( Example::WaitProc ), ti, 1000, false ); + + // The main thread waits three seconds, to demonstrate the + // time-outs on the queued thread, and then signals. + Thread::Sleep( 3100 ); + Console::WriteLine( "Main thread signals." ); + ev->Set(); + + // The main thread sleeps, which should give the callback + // method time to execute. If you comment out this line, the + // program usually ends before the ThreadPool thread can execute. + Thread::Sleep( 1000 ); + + // If you start a thread yourself, you can wait for it to end + // by calling Thread::Join. This option is not available with + // thread pool threads. + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp new file mode 100644 index 00000000000..4d728332eac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetAvailableThreads/CPP/source.cpp @@ -0,0 +1,114 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Permissions; +using namespace System::Threading; + +ref class ThreadPoolTest +{ +private: + + // Maintains state information to be passed to EndWriteCallback. + // This information allows the callback to end the asynchronous + // write operation and signal when it is finished. + ref class State + { + public: + FileStream^ fStream; + AutoResetEvent^ autoEvent; + State( FileStream^ fStream, AutoResetEvent^ autoEvent ) + { + this->fStream = fStream; + this->autoEvent = autoEvent; + } + + }; + + +public: + ThreadPoolTest(){} + + static void EndWriteCallback( IAsyncResult^ asyncResult ) + { + Console::WriteLine( "Starting EndWriteCallback." ); + State^ stateInfo = dynamic_cast(asyncResult->AsyncState); + int workerThreads; + int portThreads; + try + { + ThreadPool::GetAvailableThreads( workerThreads, portThreads ); + Console::WriteLine( "\nAvailable worker threads: \t{0}" + "\nAvailable completion port threads: {1}\n", workerThreads.ToString(), portThreads.ToString() ); + stateInfo->fStream->EndWrite( asyncResult ); + + // Sleep so the other thread has a chance to run + // before the current thread ends. + Thread::Sleep( 1500 ); + } + catch ( Exception^ e ) + { + } + finally + { + + // Signal that the current thread is finished. + stateInfo->autoEvent->Set(); + Console::WriteLine( "Ending EndWriteCallback." ); + } + + } + + static void WorkItemMethod( Object^ mainEvent ) + { + Console::WriteLine( "\nStarting WorkItem.\n" ); + AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); + + // Create some data. + const int ArraySize = 10000; + const int BufferSize = 1000; + array^byteArray = gcnew array(ArraySize); + (gcnew Random)->NextBytes( byteArray ); + + // Create two files and two State objects. + FileStream^ fileWriter1 = gcnew FileStream( "C:\\Test1@##.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite,BufferSize,true ); + FileStream^ fileWriter2 = gcnew FileStream( "C:\\Test2@##.dat",FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite,BufferSize,true ); + State^ stateInfo1 = gcnew State( fileWriter1,autoEvent ); + State^ stateInfo2 = gcnew State( fileWriter2,autoEvent ); + + // Asynchronously write to the files. + fileWriter1->BeginWrite( byteArray, 0, byteArray->Length, gcnew AsyncCallback( &ThreadPoolTest::EndWriteCallback ), stateInfo1 ); + fileWriter2->BeginWrite( byteArray, 0, byteArray->Length, gcnew AsyncCallback( &ThreadPoolTest::EndWriteCallback ), stateInfo2 ); + + // Wait for each callback to finish. + autoEvent->WaitOne(); + autoEvent->WaitOne(); + fileWriter1->Close(); + fileWriter2->Close(); + Console::WriteLine( "\nEnding WorkItem.\n" ); + + // Signal Main that the work item is finished. + dynamic_cast(mainEvent)->Set(); + } + +}; + +int main() +{ + AutoResetEvent^ mainEvent = gcnew AutoResetEvent( false ); + int workerThreads; + int portThreads; + ThreadPool::GetMaxThreads( workerThreads, portThreads ); + Console::WriteLine( "\nMaximum worker threads: \t{0}" + "\nMaximum completion port threads: {1}", workerThreads.ToString(), portThreads.ToString() ); + ThreadPool::GetAvailableThreads( workerThreads, portThreads ); + Console::WriteLine( "\nAvailable worker threads: \t{0}" + "\nAvailable completion port threads: {1}\n", workerThreads.ToString(), portThreads.ToString() ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &ThreadPoolTest::WorkItemMethod ), mainEvent ); + + // Since ThreadPool threads are background threads, + // wait for the work item to signal before ending main(). + mainEvent->WaitOne( 5000, false ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp new file mode 100644 index 00000000000..654530d80b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadPool.GetSetMinThreads/CPP/source.cpp @@ -0,0 +1,28 @@ + +// +using namespace System; +using namespace System::Threading; +int main() +{ + int minWorker; + int minIOC; + + // Get the current settings. + ThreadPool::GetMinThreads( minWorker, minIOC ); + + // Change the minimum number of worker threads to four, but + // keep the old setting for minimum asynchronous I/O + // completion threads. + if ( ThreadPool::SetMinThreads( 4, minIOC ) ) + { + + // The minimum number of threads was set successfully. + } + else + { + + // The minimum number of threads was not changed. + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp new file mode 100644 index 00000000000..3295346dbdc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.ThreadStart2/CPP/source.cpp @@ -0,0 +1,49 @@ + +// +using namespace System; +using namespace System::Threading; +ref class Work +{ +public: + static void DoWork() + { + Console::WriteLine( "Static thread procedure." ); + } + + int Data; + void DoMoreWork() + { + Console::WriteLine( "Instance thread procedure. Data={0}", Data ); + } + +}; + +int main() +{ + + // To start a thread using an instance method for the thread + // procedure, specify the object as the first argument of the + // ThreadStart constructor. + // + Work^ w = gcnew Work; + w->Data = 42; + ThreadStart^ threadDelegate = gcnew ThreadStart( w, &Work::DoMoreWork ); + Thread^ newThread = gcnew Thread( threadDelegate ); + newThread->Start(); + + // To start a thread using a static thread procedure, specify + // only the address of the procedure. This is a change from + // earlier versions of the .NET Framework, which required + // two arguments, the first of which was null (0). + // + threadDelegate = gcnew ThreadStart( &Work::DoWork ); + newThread = gcnew Thread( threadDelegate ); + newThread->Start(); +} + +/* This code example produces the following output (the order + of the lines might vary): +Static thread procedure. +Instance thread procedure. Data=42 + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp new file mode 100644 index 00000000000..4dd79b85f2c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer/CPP/source.cpp @@ -0,0 +1,98 @@ + +// +using namespace System; +using namespace System::Threading; + +ref class StatusChecker +{ +private: + int invokeCount, maxCount; + +public: + StatusChecker(int count) + { + invokeCount = 0; + maxCount = count; + } + + // This method is called by the timer delegate. + void CheckStatus(Object^ stateInfo) + { + AutoResetEvent^ autoEvent = dynamic_cast(stateInfo); + Console::WriteLine("{0:h:mm:ss.fff} Checking status {1,2}.", + DateTime::Now, ++invokeCount); + + if (invokeCount == maxCount) { + // Reset the counter and signal the waiting thread. + invokeCount = 0; + autoEvent->Set(); + } + } +}; + +ref class TimerExample +{ +public: + static void Main() + { + // Create an AutoResetEvent to signal the timeout threshold in the + // timer callback has been reached. + AutoResetEvent^ autoEvent = gcnew AutoResetEvent(false); + + StatusChecker^ statusChecker = gcnew StatusChecker(10); + + // Create a delegate that invokes methods for the timer. + TimerCallback^ tcb = + gcnew TimerCallback(statusChecker, &StatusChecker::CheckStatus); + + // Create a timer that invokes CheckStatus after one second, + // and every 1/4 second thereafter. + Console::WriteLine("{0:h:mm:ss.fff} Creating timer.\n", + DateTime::Now); + Timer^ stateTimer = gcnew Timer(tcb, autoEvent, 1000, 250); + + // When autoEvent signals, change the period to every half second. + autoEvent->WaitOne(5000, false); + stateTimer->Change(0, 500); + Console::WriteLine("\nChanging period to .5 seconds.\n"); + + // When autoEvent signals the second time, dispose of the timer. + autoEvent->WaitOne(5000, false); + stateTimer->~Timer(); + Console::WriteLine("\nDestroying timer."); + } +}; + +int main() +{ + TimerExample::Main(); +} +// The example displays output like the following: +// 11:59:54.202 Creating timer. +// +// 11:59:55.217 Checking status 1. +// 11:59:55.466 Checking status 2. +// 11:59:55.716 Checking status 3. +// 11:59:55.968 Checking status 4. +// 11:59:56.218 Checking status 5. +// 11:59:56.470 Checking status 6. +// 11:59:56.722 Checking status 7. +// 11:59:56.972 Checking status 8. +// 11:59:57.223 Checking status 9. +// 11:59:57.473 Checking status 10. +// +// Changing period to .5 seconds. +// +// 11:59:57.474 Checking status 1. +// 11:59:57.976 Checking status 2. +// 11:59:58.476 Checking status 3. +// 11:59:58.977 Checking status 4. +// 11:59:59.477 Checking status 5. +// 11:59:59.977 Checking status 6. +// 12:00:00.478 Checking status 7. +// 12:00:00.980 Checking status 8. +// 12:00:01.481 Checking status 9. +// 12:00:01.981 Checking status 10. +// +// Destroying timer. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp new file mode 100644 index 00000000000..ec633fe45b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.Timer2/CPP/source2.cpp @@ -0,0 +1,59 @@ + +// +using namespace System; +using namespace System::Threading; +ref class StatusChecker +{ +private: + int invokeCount; + int maxCount; + +public: + StatusChecker( int count ) + : invokeCount( 0 ), maxCount( count ) + {} + + + // This method is called by the timer delegate. + void CheckStatus( Object^ stateInfo ) + { + AutoResetEvent^ autoEvent = dynamic_cast(stateInfo); + Console::WriteLine( "{0} Checking status {1,2}.", DateTime::Now.ToString( "h:mm:ss.fff" ), (++invokeCount).ToString() ); + if ( invokeCount == maxCount ) + { + + // Reset the counter and signal main. + invokeCount = 0; + autoEvent->Set(); + } + } + +}; + +int main() +{ + AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); + StatusChecker^ statusChecker = gcnew StatusChecker( 10 ); + + // Create the delegate that invokes methods for the timer. + TimerCallback^ timerDelegate = gcnew TimerCallback( statusChecker, &StatusChecker::CheckStatus ); + TimeSpan delayTime = TimeSpan(0,0,1); + TimeSpan intervalTime = TimeSpan(0,0,0,0,250); + + // Create a timer that signals the delegate to invoke CheckStatus + // after one second, and every 1/4 second thereafter. + Console::WriteLine( "{0} Creating timer.\n", DateTime::Now.ToString( "h:mm:ss.fff" ) ); + Timer^ stateTimer = gcnew Timer( timerDelegate,autoEvent,delayTime,intervalTime ); + + // When autoEvent signals, change the period to every 1/2 second. + autoEvent->WaitOne( 5000, false ); + stateTimer->Change( TimeSpan(0), intervalTime + intervalTime ); + Console::WriteLine( "\nChanging period.\n" ); + + // When autoEvent signals the second time, dispose of the timer. + autoEvent->WaitOne( 5000, false ); + stateTimer->~Timer(); + Console::WriteLine( "\nDestroying timer." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp new file mode 100644 index 00000000000..2de583f098d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.SignalAndWait/CPP/source.cpp @@ -0,0 +1,125 @@ +// +using namespace System; +using namespace System::Threading; + +public ref class Example +{ +private: + // The EventWaitHandle used to demonstrate the difference + // between AutoReset and ManualReset synchronization events. + // + static EventWaitHandle^ ewh; + + // A counter to make sure all threads are started and + // blocked before any are released. A Long is used to show + // the use of the 64-bit Interlocked methods. + // + static __int64 threadCount = 0; + + // An AutoReset event that allows the main thread to block + // until an exiting thread has decremented the count. + // + static EventWaitHandle^ clearCount = + gcnew EventWaitHandle( false,EventResetMode::AutoReset ); + +public: + [MTAThread] + static void main() + { + // Create an AutoReset EventWaitHandle. + // + ewh = gcnew EventWaitHandle( false,EventResetMode::AutoReset ); + + // Create and start five numbered threads. Use the + // ParameterizedThreadStart delegate, so the thread + // number can be passed as an argument to the Start + // method. + for ( int i = 0; i <= 4; i++ ) + { + Thread^ t = gcnew Thread( + gcnew ParameterizedThreadStart( ThreadProc ) ); + t->Start( i ); + } + + // Wait until all the threads have started and blocked. + // When multiple threads use a 64-bit value on a 32-bit + // system, you must access the value through the + // Interlocked class to guarantee thread safety. + // + while ( Interlocked::Read( threadCount ) < 5 ) + { + Thread::Sleep( 500 ); + } + + // Release one thread each time the user presses ENTER, + // until all threads have been released. + // + while ( Interlocked::Read( threadCount ) > 0 ) + { + Console::WriteLine( L"Press ENTER to release a waiting thread." ); + Console::ReadLine(); + + // SignalAndWait signals the EventWaitHandle, which + // releases exactly one thread before resetting, + // because it was created with AutoReset mode. + // SignalAndWait then blocks on clearCount, to + // allow the signaled thread to decrement the count + // before looping again. + // + WaitHandle::SignalAndWait( ewh, clearCount ); + } + Console::WriteLine(); + + // Create a ManualReset EventWaitHandle. + // + ewh = gcnew EventWaitHandle( false,EventResetMode::ManualReset ); + + // Create and start five more numbered threads. + // + for ( int i = 0; i <= 4; i++ ) + { + Thread^ t = gcnew Thread( + gcnew ParameterizedThreadStart( ThreadProc ) ); + t->Start( i ); + } + + // Wait until all the threads have started and blocked. + // + while ( Interlocked::Read( threadCount ) < 5 ) + { + Thread::Sleep( 500 ); + } + + // Because the EventWaitHandle was created with + // ManualReset mode, signaling it releases all the + // waiting threads. + // + Console::WriteLine( L"Press ENTER to release the waiting threads." ); + Console::ReadLine(); + ewh->Set(); + + } + + static void ThreadProc( Object^ data ) + { + int index = static_cast(data); + + Console::WriteLine( L"Thread {0} blocks.", data ); + // Increment the count of blocked threads. + Interlocked::Increment( threadCount ); + + // Wait on the EventWaitHandle. + ewh->WaitOne(); + + Console::WriteLine( L"Thread {0} exits.", data ); + // Decrement the count of blocked threads. + Interlocked::Decrement( threadCount ); + + // After signaling ewh, the main thread blocks on + // clearCount until the signaled thread has + // decremented the count. Signal it now. + // + clearCount->Set(); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp new file mode 100644 index 00000000000..77becf280e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll1/CPP/source1.cpp @@ -0,0 +1,93 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Permissions; +using namespace System::Threading; + +ref class State +{ +public: + String^ fileName; + array^byteArray; + ManualResetEvent^ manualEvent; + State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent ) + : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent ) + {} + +}; + +ref class Writer +{ +private: + static int workItemCount = 0; + Writer(){} + + +public: + static void WriteToFile( Object^ state ) + { + int workItemNumber = workItemCount; + Interlocked::Increment( workItemCount ); + Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() ); + State^ stateInfo = dynamic_cast(state); + FileStream^ fileWriter; + + // Create and write to the file. + try + { + fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create ); + fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length ); + } + finally + { + if ( fileWriter != nullptr ) + { + fileWriter->Close(); + } + + // Signal main() that the work item has finished. + Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() ); + stateInfo->manualEvent->Set(); + } + + } + +}; + +void main() +{ + const int numberOfFiles = 5; + String^ dirName = "C:\\TestTest"; + String^ fileName; + array^byteArray; + Random^ randomGenerator = gcnew Random; + array^manualEvents = gcnew array(numberOfFiles); + State^ stateInfo; + if ( !Directory::Exists( dirName ) ) + { + Directory::CreateDirectory( dirName ); + } + + + // Queue the work items that create and write to the files. + for ( int i = 0; i < numberOfFiles; i++ ) + { + fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" ); + + // Create random data to write to the file. + byteArray = gcnew array(1000000); + randomGenerator->NextBytes( byteArray ); + manualEvents[ i ] = gcnew ManualResetEvent( false ); + stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo ); + + } + + // Since ThreadPool threads are background threads, + // wait for the work items to signal before exiting. + WaitHandle::WaitAll( manualEvents ); + Console::WriteLine( "Files written - main exiting." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp new file mode 100644 index 00000000000..8cad6cf4acd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll2/CPP/source2.cpp @@ -0,0 +1,102 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Permissions; +using namespace System::Threading; + +// Maintain state to pass to WriteToFile. +ref class State +{ +public: + String^ fileName; + array^byteArray; + ManualResetEvent^ manualEvent; + State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent ) + : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent ) + {} + +}; + +ref class Writer +{ +private: + static int workItemCount = 0; + Writer(){} + + +public: + static void WriteToFile( Object^ state ) + { + int workItemNumber = workItemCount; + Interlocked::Increment( workItemCount ); + Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() ); + State^ stateInfo = dynamic_cast(state); + FileStream^ fileWriter; + + // Create and write to the file. + try + { + fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create ); + fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length ); + } + finally + { + if ( fileWriter != nullptr ) + { + fileWriter->Close(); + } + + // Signal main() that the work item has finished. + Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() ); + stateInfo->manualEvent->Set(); + } + + } + +}; + +int main() +{ + const int numberOfFiles = 5; + String^ dirName = "C:\\TestTest"; + String^ fileName; + array^byteArray; + Random^ randomGenerator = gcnew Random; + array^manualEvents = gcnew array(numberOfFiles); + State^ stateInfo; + if ( !Directory::Exists( dirName ) ) + { + Directory::CreateDirectory( dirName ); + } + + + // Queue the work items that create and write to the files. + for ( int i = 0; i < numberOfFiles; i++ ) + { + fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" ); + + // Create random data to write to the file. + byteArray = gcnew array(1000000); + randomGenerator->NextBytes( byteArray ); + manualEvents[ i ] = gcnew ManualResetEvent( false ); + stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo ); + + } + + // Since ThreadPool threads are background threads, + // wait for the work items to signal before exiting. + if ( WaitHandle::WaitAll( manualEvents, 5000, false ) ) + { + Console::WriteLine( "Files written - main exiting." ); + } + else + { + + // The wait operation times out. + Console::WriteLine( "Error writing files - main exiting." ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp new file mode 100644 index 00000000000..6044e88bdcc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAll3/CPP/source3.cpp @@ -0,0 +1,102 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Security::Permissions; +using namespace System::Threading; + +// Maintain state to pass to WriteToFile. +ref class State +{ +public: + String^ fileName; + array^byteArray; + ManualResetEvent^ manualEvent; + State( String^ fileName, array^byteArray, ManualResetEvent^ manualEvent ) + : fileName( fileName ), byteArray( byteArray ), manualEvent( manualEvent ) + {} + +}; + +ref class Writer +{ +private: + static int workItemCount = 0; + Writer(){} + + +public: + static void WriteToFile( Object^ state ) + { + int workItemNumber = workItemCount; + Interlocked::Increment( workItemCount ); + Console::WriteLine( "Starting work item {0}.", workItemNumber.ToString() ); + State^ stateInfo = dynamic_cast(state); + FileStream^ fileWriter; + + // Create and write to the file. + try + { + fileWriter = gcnew FileStream( stateInfo->fileName,FileMode::Create ); + fileWriter->Write( stateInfo->byteArray, 0, stateInfo->byteArray->Length ); + } + finally + { + if ( fileWriter != nullptr ) + { + fileWriter->Close(); + } + + // Signal main() that the work item has finished. + Console::WriteLine( "Ending work item {0}.", workItemNumber.ToString() ); + stateInfo->manualEvent->Set(); + } + + } + +}; + +int main() +{ + const int numberOfFiles = 5; + String^ dirName = "C:\\TestTest"; + String^ fileName; + array^byteArray; + Random^ randomGenerator = gcnew Random; + array^manualEvents = gcnew array(numberOfFiles); + State^ stateInfo; + if ( !Directory::Exists( dirName ) ) + { + Directory::CreateDirectory( dirName ); + } + + + // Queue the work items that create and write to the files. + for ( int i = 0; i < numberOfFiles; i++ ) + { + fileName = String::Concat( dirName, "\\Test", ((i)).ToString(), ".dat" ); + + // Create random data to write to the file. + byteArray = gcnew array(1000000); + randomGenerator->NextBytes( byteArray ); + manualEvents[ i ] = gcnew ManualResetEvent( false ); + stateInfo = gcnew State( fileName,byteArray,manualEvents[ i ] ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &Writer::WriteToFile ), stateInfo ); + + } + + // Since ThreadPool threads are background threads, + // wait for the work items to signal before exiting. + if ( WaitHandle::WaitAll( manualEvents, TimeSpan(0,0,5), false ) ) + { + Console::WriteLine( "Files written - main exiting." ); + } + else + { + + // The wait operation times out. + Console::WriteLine( "Error writing files - main exiting." ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp new file mode 100644 index 00000000000..5873df3b3ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny2/CPP/source2.cpp @@ -0,0 +1,83 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Threading; +ref class Search +{ +private: + + // Maintain state information to pass to FindCallback. + ref class State + { + public: + AutoResetEvent^ autoEvent; + String^ fileName; + State( AutoResetEvent^ autoEvent, String^ fileName ) + : autoEvent( autoEvent ), fileName( fileName ) + {} + + }; + + +public: + array^autoEvents; + array^diskLetters; + + // Search for stateInfo->fileName. + void FindCallback( Object^ state ) + { + State^ stateInfo = dynamic_cast(state); + + // Signal if the file is found. + if ( File::Exists( stateInfo->fileName ) ) + { + stateInfo->autoEvent->Set(); + } + } + + Search() + { + + // Retrieve an array of disk letters. + diskLetters = Environment::GetLogicalDrives(); + autoEvents = gcnew array(diskLetters->Length); + for ( int i = 0; i < diskLetters->Length; i++ ) + { + autoEvents[ i ] = gcnew AutoResetEvent( false ); + + } + } + + + // Search for fileName in the root directory of all disks. + void FindFile( String^ fileName ) + { + for ( int i = 0; i < diskLetters->Length; i++ ) + { + Console::WriteLine( "Searching for {0} on {1}.", fileName, diskLetters[ i ] ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( this, &Search::FindCallback ), gcnew State( autoEvents[ i ],String::Concat( diskLetters[ i ], fileName ) ) ); + + } + + // Wait for the first instance of the file to be found. + int index = WaitHandle::WaitAny( autoEvents, 3000, false ); + if ( index == WaitHandle::WaitTimeout ) + { + Console::WriteLine( "\n{0} not found.", fileName ); + } + else + { + Console::WriteLine( "\n{0} found on {1}.", fileName, diskLetters[ index ] ); + } + } + +}; + +int main() +{ + Search^ search = gcnew Search; + search->FindFile( "SomeFile.dat" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp new file mode 100644 index 00000000000..c8fbef542b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitAny3/CPP/source3.cpp @@ -0,0 +1,83 @@ + +// +using namespace System; +using namespace System::IO; +using namespace System::Threading; +ref class Search +{ +private: + + // Maintain state information to pass to FindCallback. + ref class State + { + public: + AutoResetEvent^ autoEvent; + String^ fileName; + State( AutoResetEvent^ autoEvent, String^ fileName ) + : autoEvent( autoEvent ), fileName( fileName ) + {} + + }; + + +public: + array^autoEvents; + array^diskLetters; + + // Search for stateInfo->fileName. + void FindCallback( Object^ state ) + { + State^ stateInfo = dynamic_cast(state); + + // Signal if the file is found. + if ( File::Exists( stateInfo->fileName ) ) + { + stateInfo->autoEvent->Set(); + } + } + + Search() + { + + // Retrieve an array of disk letters. + diskLetters = Environment::GetLogicalDrives(); + autoEvents = gcnew array(diskLetters->Length); + for ( int i = 0; i < diskLetters->Length; i++ ) + { + autoEvents[ i ] = gcnew AutoResetEvent( false ); + + } + } + + + // Search for fileName in the root directory of all disks. + void FindFile( String^ fileName ) + { + for ( int i = 0; i < diskLetters->Length; i++ ) + { + Console::WriteLine( "Searching for {0} on {1}.", fileName, diskLetters[ i ] ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( this, &Search::FindCallback ), gcnew State( autoEvents[ i ],String::Concat( diskLetters[ i ], fileName ) ) ); + + } + + // Wait for the first instance of the file to be found. + int index = WaitHandle::WaitAny( autoEvents, TimeSpan(0,0,3), false ); + if ( index == WaitHandle::WaitTimeout ) + { + Console::WriteLine( "\n{0} not found.", fileName ); + } + else + { + Console::WriteLine( "\n{0} found on {1}.", fileName, diskLetters[ index ] ); + } + } + +}; + +int main() +{ + Search^ search = gcnew Search; + search->FindFile( "SomeFile.dat" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp new file mode 100644 index 00000000000..1e895c2aace --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne1/CPP/source1.cpp @@ -0,0 +1,37 @@ + +// +using namespace System; +using namespace System::Threading; +ref class WaitOne +{ +private: + WaitOne(){} + + +public: + static void WorkMethod( Object^ stateInfo ) + { + Console::WriteLine( "Work starting." ); + + // Simulate time spent working. + Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) ); + + // Signal that work is finished. + Console::WriteLine( "Work ending." ); + dynamic_cast(stateInfo)->Set(); + } + +}; + +int main() +{ + Console::WriteLine( "Main starting." ); + AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent ); + + // Wait for work method to signal. + autoEvent->WaitOne( ); + Console::WriteLine( "Work method signaled.\nMain ending." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp new file mode 100644 index 00000000000..2d2d9d3a98f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne2/CPP/source2.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; +ref class WaitOne +{ +private: + WaitOne(){} + + +public: + static void WorkMethod( Object^ stateInfo ) + { + Console::WriteLine( "Work starting." ); + + // Simulate time spent working. + Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) ); + + // Signal that work is finished. + Console::WriteLine( "Work ending." ); + dynamic_cast(stateInfo)->Set(); + } + +}; + +int main() +{ + Console::WriteLine( "Main starting." ); + AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent ); + + // Wait for work method to signal. + if ( autoEvent->WaitOne( 1000 ) ) + { + Console::WriteLine( "Work method signaled." ); + } + else + { + Console::WriteLine( "Timed out waiting for work " + "method to signal." ); + } + + Console::WriteLine( "Main ending." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp new file mode 100644 index 00000000000..d43bd113677 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Threading.WaitHandle.WaitOne3/CPP/source3.cpp @@ -0,0 +1,46 @@ + +// +using namespace System; +using namespace System::Threading; +ref class WaitOne +{ +private: + WaitOne(){} + + +public: + static void WorkMethod( Object^ stateInfo ) + { + Console::WriteLine( "Work starting." ); + + // Simulate time spent working. + Thread::Sleep( (gcnew Random)->Next( 100, 2000 ) ); + + // Signal that work is finished. + Console::WriteLine( "Work ending." ); + dynamic_cast(stateInfo)->Set(); + } + +}; + +int main() +{ + Console::WriteLine( "Main starting." ); + AutoResetEvent^ autoEvent = gcnew AutoResetEvent( false ); + ThreadPool::QueueUserWorkItem( gcnew WaitCallback( &WaitOne::WorkMethod ), autoEvent ); + + // Wait for work method to signal. + if ( autoEvent->WaitOne( TimeSpan(0,0,1), false ) ) + { + Console::WriteLine( "Work method signaled." ); + } + else + { + Console::WriteLine( "Timed out waiting for work " + "method to signal." ); + } + + Console::WriteLine( "Main ending." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp new file mode 100644 index 00000000000..fba1b99c662 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/comp_equal.cpp @@ -0,0 +1,64 @@ + +// +// Example of the TimeSpan::Compare( TimeSpan, TimeSpan ) and +// TimeSpan::Equals( TimeSpan, TimeSpan ) methods. +using namespace System; +const __wchar_t * protoFmt = L"{0,-38}{1}"; + +// Compare TimeSpan parameters, and display them with the results. +void CompareTimeSpans( TimeSpan Left, TimeSpan Right, String^ RightText ) +{ + String^ dataFmt = gcnew String( protoFmt ); + Console::WriteLine(); + Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); + Console::WriteLine( dataFmt, "TimeSpan::Equals( Left, Right )", TimeSpan::Equals( Left, Right ) ); + Console::WriteLine( dataFmt, "TimeSpan::Compare( Left, Right )", TimeSpan::Compare( Left, Right ) ); +} + +int main() +{ + TimeSpan Left = TimeSpan(2,0,0); + Console::WriteLine( "This example of the TimeSpan::Equals( TimeSpan, TimeSpan " + ") and \nTimeSpan::Compare( TimeSpan, TimeSpan ) " + "methods generates the \nfollowing output by creating " + "several different TimeSpan \nobjects and comparing " + "them with a 2-hour TimeSpan.\n" ); + Console::WriteLine( gcnew String( protoFmt ), "Left: TimeSpan( 2, 0, 0 )", Left ); + + // Create objects to compare with a 2-hour TimeSpan. + CompareTimeSpans( Left, TimeSpan(0,120,0), "TimeSpan( 0, 120, 0 )" ); + CompareTimeSpans( Left, TimeSpan(2,0,1), "TimeSpan( 2, 0, 1 )" ); + CompareTimeSpans( Left, TimeSpan(2,0,-1), "TimeSpan( 2, 0, -1 )" ); + CompareTimeSpans( Left, TimeSpan(72000000000), "TimeSpan( 72000000000 )" ); + CompareTimeSpans( Left, TimeSpan::FromDays( 1.0 / 12. ), "TimeSpan::FromDays( 1 / 12 )" ); +} + +/* +This example of the TimeSpan::Equals( TimeSpan, TimeSpan ) and +TimeSpan::Compare( TimeSpan, TimeSpan ) methods generates the +following output by creating several different TimeSpan +objects and comparing them with a 2-hour TimeSpan. + +Left: TimeSpan( 2, 0, 0 ) 02:00:00 + +Right: TimeSpan( 0, 120, 0 ) 02:00:00 +TimeSpan::Equals( Left, Right ) True +TimeSpan::Compare( Left, Right ) 0 + +Right: TimeSpan( 2, 0, 1 ) 02:00:01 +TimeSpan::Equals( Left, Right ) False +TimeSpan::Compare( Left, Right ) -1 + +Right: TimeSpan( 2, 0, -1 ) 01:59:59 +TimeSpan::Equals( Left, Right ) False +TimeSpan::Compare( Left, Right ) 1 + +Right: TimeSpan( 72000000000 ) 02:00:00 +TimeSpan::Equals( Left, Right ) True +TimeSpan::Compare( Left, Right ) 0 + +Right: TimeSpan::FromDays( 1 / 12 ) 02:00:00 +TimeSpan::Equals( Left, Right ) True +TimeSpan::Compare( Left, Right ) 0 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp new file mode 100644 index 00000000000..3c27f181be1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Compare_Equals/CPP/cto_eq_obj.cpp @@ -0,0 +1,78 @@ + +// +// Example of the TimeSpan::CompareTo( Object* ) and +// TimeSpan::Equals( Object* ) methods. +using namespace System; + +// Compare the TimeSpan to the Object parameters, +// and display the Object parameters with the results. +void CompTimeSpanToObject( TimeSpan Left, Object^ Right, String^ RightText ) +{ + Console::WriteLine( "{0,-33}{1}", String::Concat( "Object: ", RightText ), Right ); + Console::WriteLine( "{0,-33}{1}", "Left.Equals( Object )", Left.Equals( Right ) ); + Console::Write( "{0,-33}", "Left.CompareTo( Object )" ); + + // Catch the exception if CompareTo( ) throws one. + try + { + Console::WriteLine( "{0}\n", Left.CompareTo( Right ) ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Error: {0}\n", ex->Message ); + } + +} + +int main() +{ + TimeSpan Left = TimeSpan(0,5,0); + Console::WriteLine( "This example of the TimeSpan::Equals( Object* ) " + "and \nTimeSpan::CompareTo( Object* ) methods generates " + "the \nfollowing output by creating several different " + "TimeSpan \nobjects and comparing them with a " + "5-minute TimeSpan.\n" ); + Console::WriteLine( "{0,-33}{1}\n", "Left: TimeSpan( 0, 5, 0 )", Left ); + + // Create objects to compare with a 5-minute TimeSpan. + CompTimeSpanToObject( Left, TimeSpan(0,0,300), "TimeSpan( 0, 0, 300 )" ); + CompTimeSpanToObject( Left, TimeSpan(0,5,1), "TimeSpan( 0, 5, 1 )" ); + CompTimeSpanToObject( Left, TimeSpan(0,5,-1), "TimeSpan( 0, 5, -1 )" ); + CompTimeSpanToObject( Left, TimeSpan(3000000000), "TimeSpan( 3000000000 )" ); + CompTimeSpanToObject( Left, 3000000000L, "__int64 3000000000L" ); + CompTimeSpanToObject( Left, "00:05:00", "String \"00:05:00\"" ); +} + +/* +This example of the TimeSpan::Equals( Object* ) and +TimeSpan::CompareTo( Object* ) methods generates the +following output by creating several different TimeSpan +objects and comparing them with a 5-minute TimeSpan. + +Left: TimeSpan( 0, 5, 0 ) 00:05:00 + +Object: TimeSpan( 0, 0, 300 ) 00:05:00 +Left.Equals( Object ) True +Left.CompareTo( Object ) 0 + +Object: TimeSpan( 0, 5, 1 ) 00:05:01 +Left.Equals( Object ) False +Left.CompareTo( Object ) -1 + +Object: TimeSpan( 0, 5, -1 ) 00:04:59 +Left.Equals( Object ) False +Left.CompareTo( Object ) 1 + +Object: TimeSpan( 3000000000 ) 00:05:00 +Left.Equals( Object ) True +Left.CompareTo( Object ) 0 + +Object: __int64 3000000000L 3000000000 +Left.Equals( Object ) False +Left.CompareTo( Object ) Error: Object must be of type TimeSpan. + +Object: String "00:05:00" 00:05:00 +Left.Equals( Object ) False +Left.CompareTo( Object ) Error: Object must be of type TimeSpan. +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp new file mode 100644 index 00000000000..f60d07081bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriii.cpp @@ -0,0 +1,45 @@ + +// +// Example of the TimeSpan( int, int, int ) constructor. +using namespace System; + +// Create a TimeSpan object and display its value. +static void CreateTimeSpan( int hours, int minutes, int seconds ) +{ + TimeSpan elapsedTime = TimeSpan(hours,minutes,seconds); + + // Format the constructor for display. + String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2} )", hours, minutes, seconds ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-37}{1,16}", ctor, elapsedTime.ToString() ); +} + +int main() +{ + Console::WriteLine( "This example of the TimeSpan( int, int, int ) " + "\nconstructor generates the following output.\n" ); + Console::WriteLine( "{0,-37}{1,16}", "Constructor", "Value" ); + Console::WriteLine( "{0,-37}{1,16}", "-----------", "-----" ); + CreateTimeSpan( 10, 20, 30 ); + CreateTimeSpan( -10, 20, 30 ); + CreateTimeSpan( 0, 0, 37230 ); + CreateTimeSpan( 1000, 2000, 3000 ); + CreateTimeSpan( 1000, -2000, -3000 ); + CreateTimeSpan( 999999, 999999, 999999 ); +} + +/* +This example of the TimeSpan( int, int, int ) +constructor generates the following output. + +Constructor Value +----------- ----- +TimeSpan( 10, 20, 30 ) 10:20:30 +TimeSpan( -10, 20, 30 ) -09:39:30 +TimeSpan( 0, 0, 37230 ) 10:20:30 +TimeSpan( 1000, 2000, 3000 ) 43.02:10:00 +TimeSpan( 1000, -2000, -3000 ) 40.05:50:00 +TimeSpan( 999999, 999999, 999999 ) 42372.15:25:39 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp new file mode 100644 index 00000000000..4a1c4233cf3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiii.cpp @@ -0,0 +1,42 @@ + +// +using namespace System; + +// Create a TimeSpan object and display its value. +void CreateTimeSpan( int days, int hours, int minutes, int seconds ) +{ + TimeSpan elapsedTime = TimeSpan(days,hours,minutes,seconds); + + // Format the constructor for display. + array^boxedParams = gcnew array(4); + boxedParams[ 0 ] = days; + boxedParams[ 1 ] = hours; + boxedParams[ 2 ] = minutes; + boxedParams[ 3 ] = seconds; + String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2}, {3} )", boxedParams ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-44}{1,16}", ctor, elapsedTime.ToString() ); +} + +int main() +{ + Console::WriteLine( "{0,-44}{1,16}", "Constructor", "Value" ); + Console::WriteLine( "{0,-44}{1,16}", "-----------", "-----" ); + CreateTimeSpan( 10, 20, 30, 40 ); + CreateTimeSpan( -10, 20, 30, 40 ); + CreateTimeSpan( 0, 0, 0, 937840 ); + CreateTimeSpan( 1000, 2000, 3000, 4000 ); + CreateTimeSpan( 1000, -2000, -3000, -4000 ); + CreateTimeSpan( 999999, 999999, 999999, 999999 ); +} +// The example displays the following output: +// Constructor Value +// ----------- ----- +// TimeSpan( 10, 20, 30, 40 ) 10.20:30:40 +// TimeSpan( -10, 20, 30, 40 ) -9.03:29:20 +// TimeSpan( 0, 0, 0, 937840 ) 10.20:30:40 +// TimeSpan( 1000, 2000, 3000, 4000 ) 1085.11:06:40 +// TimeSpan( 1000, -2000, -3000, -4000 ) 914.12:53:20 +// TimeSpan( 999999, 999999, 999999, 999999 ) 1042371.15:25:39 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp new file mode 100644 index 00000000000..2806b7c4188 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctoriiiii.cpp @@ -0,0 +1,51 @@ + +// +// Example of the TimeSpan( int, int, int, int, int ) constructor. +using namespace System; + +// Create a TimeSpan object and display its value. +void CreateTimeSpan( int days, int hours, int minutes, int seconds, int millisec ) +{ + TimeSpan elapsedTime = TimeSpan(days,hours,minutes,seconds,millisec); + + // Format the constructor for display. + array^boxedParams = gcnew array(5); + boxedParams[ 0 ] = days; + boxedParams[ 1 ] = hours; + boxedParams[ 2 ] = minutes; + boxedParams[ 3 ] = seconds; + boxedParams[ 4 ] = millisec; + String^ ctor = String::Format( "TimeSpan( {0}, {1}, {2}, {3}, {4} )", boxedParams ); + + // Display the constructor and its value. + Console::WriteLine( "{0,-48}{1,24}", ctor, elapsedTime.ToString() ); +} + +int main() +{ + Console::WriteLine( "This example of the TimeSpan( int, int, int, int, int ) " + "\nconstructor generates the following output.\n" ); + Console::WriteLine( "{0,-48}{1,16}", "Constructor", "Value" ); + Console::WriteLine( "{0,-48}{1,16}", "-----------", "-----" ); + CreateTimeSpan( 10, 20, 30, 40, 50 ); + CreateTimeSpan( -10, 20, 30, 40, 50 ); + CreateTimeSpan( 0, 0, 0, 0, 937840050 ); + CreateTimeSpan( 1111, 2222, 3333, 4444, 5555 ); + CreateTimeSpan( 1111, -2222, -3333, -4444, -5555 ); + CreateTimeSpan( 99999, 99999, 99999, 99999, 99999 ); +} + +/* +This example of the TimeSpan( int, int, int, int, int ) +constructor generates the following output. + +Constructor Value +----------- ----- +TimeSpan( 10, 20, 30, 40, 50 ) 10.20:30:40.0500000 +TimeSpan( -10, 20, 30, 40, 50 ) -9.03:29:19.9500000 +TimeSpan( 0, 0, 0, 0, 937840050 ) 10.20:30:40.0500000 +TimeSpan( 1111, 2222, 3333, 4444, 5555 ) 1205.22:47:09.5550000 +TimeSpan( 1111, -2222, -3333, -4444, -5555 ) 1016.01:12:50.4450000 +TimeSpan( 99999, 99999, 99999, 99999, 99999 ) 104236.05:27:18.9990000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp new file mode 100644 index 00000000000..d5dd9f79124 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Ctor/CPP/ctorl.cpp @@ -0,0 +1,54 @@ + +// +// Example of the TimeSpan( __int64 ) constructor. +using namespace System; + +// Create a TimeSpan object and display its value. +void CreateTimeSpan( __int64 ticks ) +{ + TimeSpan elapsedTime = TimeSpan(ticks); + + // Format the constructor for display. + String^ ctor = String::Format( "TimeSpan( {0} )", ticks ); + + // Pad the end of a TimeSpan string with spaces if + // it does not contain milliseconds. + String^ elapsedStr = elapsedTime.ToString(); + int pointIndex = elapsedStr->IndexOf( ':' ); + pointIndex = elapsedStr->IndexOf( '.', pointIndex ); + if ( pointIndex < 0 ) + elapsedStr = String::Concat( elapsedStr, " " ); + + + // Display the constructor and its value. + Console::WriteLine( "{0,-33}{1,24}", ctor, elapsedStr ); +} + +int main() +{ + Console::WriteLine( "This example of the TimeSpan( __int64 ) constructor " + "\ngenerates the following output.\n" ); + Console::WriteLine( "{0,-33}{1,16}", "Constructor", "Value" ); + Console::WriteLine( "{0,-33}{1,16}", "-----------", "-----" ); + CreateTimeSpan( 1 ); + CreateTimeSpan( 999999 ); + CreateTimeSpan( -1000000000000 ); + CreateTimeSpan( 18012202000000 ); + CreateTimeSpan( 999999999999999999 ); + CreateTimeSpan( 1000000000000000000 ); +} + +/* +This example of the TimeSpan( __int64 ) constructor +generates the following output. + +Constructor Value +----------- ----- +TimeSpan( 1 ) 00:00:00.0000001 +TimeSpan( 999999 ) 00:00:00.0999999 +TimeSpan( -1000000000000 ) -1.03:46:40 +TimeSpan( 18012202000000 ) 20.20:20:20.2000000 +TimeSpan( 999999999999999999 ) 1157407.09:46:39.9999999 +TimeSpan( 1000000000000000000 ) 1157407.09:46:40 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp new file mode 100644 index 00000000000..82a2aebbbc8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Dura_Nega_Unary/CPP/dura_nega_una.cpp @@ -0,0 +1,48 @@ + +// +// Example of the TimeSpan::Duration( ) and TimeSpan::Negate( ) methods, +// and the TimeSpan Unary Negation and Unary Plus operators. +using namespace System; +const __wchar_t * protoFmt = L"{0,22}{1,22}{2,22}"; +void ShowDurationNegate( TimeSpan interval ) +{ + + // Display the TimeSpan value and the results of the + // Duration and Negate methods. + Console::WriteLine( gcnew String( protoFmt ), interval, interval.Duration(), interval.Negate() ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::Duration( ), " + "TimeSpan::Negate( ), \nand the TimeSpan Unary " + "Negation and Unary Plus operators \n" + "generates the following output.\n" ); + Console::WriteLine( gcnew String( protoFmt ), "TimeSpan", "Duration( )", "Negate( )" ); + Console::WriteLine( gcnew String( protoFmt ), "--------", "-----------", "---------" ); + + // Create TimeSpan objects and apply the Unary Negation + // and Unary Plus operators to them. + ShowDurationNegate( TimeSpan(1) ); + ShowDurationNegate( TimeSpan( -1234567) ); + ShowDurationNegate( +TimeSpan(0,0,10,-20,-30) ); + ShowDurationNegate( +TimeSpan(0,-10,20,-30,40) ); + ShowDurationNegate( -TimeSpan(1,10,20,40,160) ); + ShowDurationNegate( -TimeSpan( -10,-20,-30,-40,-50) ); +} + +/* +This example of TimeSpan::Duration( ), TimeSpan::Negate( ), +and the TimeSpan Unary Negation and Unary Plus operators +generates the following output. + + TimeSpan Duration( ) Negate( ) + -------- ----------- --------- + 00:00:00.0000001 00:00:00.0000001 -00:00:00.0000001 + -00:00:00.1234567 00:00:00.1234567 00:00:00.1234567 + 00:09:39.9700000 00:09:39.9700000 -00:09:39.9700000 + -09:40:29.9600000 09:40:29.9600000 09:40:29.9600000 + -1.10:20:40.1600000 1.10:20:40.1600000 1.10:20:40.1600000 + 10.20:30:40.0500000 10.20:30:40.0500000 -10.20:30:40.0500000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp new file mode 100644 index 00000000000..c72d87bcf54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Fields/CPP/fields.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan fields. +using namespace System; + +// Pad the end of a TimeSpan string with spaces if it does not +// contain milliseconds. +String^ Align( TimeSpan interval ) +{ + String^ intervalStr = interval.ToString(); + int pointIndex = intervalStr->IndexOf( ':' ); + pointIndex = intervalStr->IndexOf( '.', pointIndex ); + if ( pointIndex < 0 ) + intervalStr = String::Concat( intervalStr, " " ); + + return intervalStr; +} + +int main() +{ + String^ numberFmt = "{0,-22}{1,18:N0}"; + String^ timeFmt = "{0,-22}{1,26}"; + Console::WriteLine( "This example of the fields of the TimeSpan class" + "\ngenerates the following output.\n" ); + Console::WriteLine( numberFmt, "Field", "Value" ); + Console::WriteLine( numberFmt, "-----", "-----" ); + + // Display the maximum, minimum, and zero TimeSpan values. + Console::WriteLine( timeFmt, "Maximum TimeSpan", Align( TimeSpan::MaxValue ) ); + Console::WriteLine( timeFmt, "Minimum TimeSpan", Align( TimeSpan::MinValue ) ); + Console::WriteLine( timeFmt, "Zero TimeSpan", Align( TimeSpan::Zero ) ); + Console::WriteLine(); + + // Display the ticks-per-time-unit fields. + Console::WriteLine( numberFmt, "Ticks per day", TimeSpan::TicksPerDay ); + Console::WriteLine( numberFmt, "Ticks per hour", TimeSpan::TicksPerHour ); + Console::WriteLine( numberFmt, "Ticks per minute", TimeSpan::TicksPerMinute ); + Console::WriteLine( numberFmt, "Ticks per second", TimeSpan::TicksPerSecond ); + Console::WriteLine( numberFmt, "Ticks per millisecond", TimeSpan::TicksPerMillisecond ); +} + +/* +This example of the fields of the TimeSpan class +generates the following output. + +Field Value +----- ----- +Maximum TimeSpan 10675199.02:48:05.4775807 +Minimum TimeSpan -10675199.02:48:05.4775808 +Zero TimeSpan 00:00:00 + +Ticks per day 864,000,000,000 +Ticks per hour 36,000,000,000 +Ticks per minute 600,000,000 +Ticks per second 10,000,000 +Ticks per millisecond 10,000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp new file mode 100644 index 00000000000..1ad4da8b17d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromdays.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan::FromDays( double ) method. +using namespace System; +void GenTimeSpanFromDays( double days ) +{ + + // Create a TimeSpan object and TimeSpan string from + // a number of days. + TimeSpan interval = TimeSpan::FromDays( days ); + String^ timeInterval = interval.ToString(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,21}{1,26}", days, timeInterval ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::FromDays( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "{0,21}{1,18}", "FromDays", "TimeSpan" ); + Console::WriteLine( "{0,21}{1,18}", "--------", "--------" ); + GenTimeSpanFromDays( 0.000000006 ); + GenTimeSpanFromDays( 0.000000017 ); + GenTimeSpanFromDays( 0.000123456 ); + GenTimeSpanFromDays( 1.234567898 ); + GenTimeSpanFromDays( 12345.678987654 ); + GenTimeSpanFromDays( 0.000011574 ); + GenTimeSpanFromDays( 0.000694444 ); + GenTimeSpanFromDays( 0.041666666 ); + GenTimeSpanFromDays( 1 ); + GenTimeSpanFromDays( 20.84745602 ); +} + +/* +This example of TimeSpan::FromDays( double ) +generates the following output. + + FromDays TimeSpan + -------- -------- + 6E-09 00:00:00.0010000 + 1.7E-08 00:00:00.0010000 + 0.000123456 00:00:10.6670000 + 1.234567898 1.05:37:46.6660000 + 12345.678987654 12345.16:17:44.5330000 + 1.1574E-05 00:00:01 + 0.000694444 00:01:00 + 0.041666666 01:00:00 + 1 1.00:00:00 + 20.84745602 20.20:20:20.2000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp new file mode 100644 index 00000000000..291263f4c76 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromhours.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan::FromHours( double ) method. +using namespace System; +void GenTimeSpanFromHours( double hours ) +{ + + // Create a TimeSpan object and TimeSpan string from + // a number of hours. + TimeSpan interval = TimeSpan::FromHours( hours ); + String^ timeInterval = interval.ToString(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,21}{1,26}", hours, timeInterval ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::FromHours( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "{0,21}{1,18}", "FromHours", "TimeSpan" ); + Console::WriteLine( "{0,21}{1,18}", "---------", "--------" ); + GenTimeSpanFromHours( 0.0000002 ); + GenTimeSpanFromHours( 0.0000003 ); + GenTimeSpanFromHours( 0.0012345 ); + GenTimeSpanFromHours( 12.3456789 ); + GenTimeSpanFromHours( 123456.7898765 ); + GenTimeSpanFromHours( 0.0002777 ); + GenTimeSpanFromHours( 0.0166666 ); + GenTimeSpanFromHours( 1 ); + GenTimeSpanFromHours( 24 ); + GenTimeSpanFromHours( 500.3389445 ); +} + +/* +This example of TimeSpan::FromHours( double ) +generates the following output. + + FromHours TimeSpan + --------- -------- + 2E-07 00:00:00.0010000 + 3E-07 00:00:00.0010000 + 0.0012345 00:00:04.4440000 + 12.3456789 12:20:44.4440000 + 123456.7898765 5144.00:47:23.5550000 + 0.0002777 00:00:01 + 0.0166666 00:01:00 + 1 01:00:00 + 24 1.00:00:00 + 500.3389445 20.20:20:20.2000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp new file mode 100644 index 00000000000..abaa9a05413 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/frommillisec.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan::FromMilliseconds( double ) method. +using namespace System; +void GenTimeSpanFromMillisec( Double millisec ) +{ + + // Create a TimeSpan object and TimeSpan string from + // a number of milliseconds. + TimeSpan interval = TimeSpan::FromMilliseconds( millisec ); + String^ timeInterval = interval.ToString(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,21}{1,26}", millisec, timeInterval ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::FromMilliseconds( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "{0,21}{1,18}", "FromMilliseconds", "TimeSpan" ); + Console::WriteLine( "{0,21}{1,18}", "----------------", "--------" ); + GenTimeSpanFromMillisec( 1 ); + GenTimeSpanFromMillisec( 1.5 ); + GenTimeSpanFromMillisec( 12345.6 ); + GenTimeSpanFromMillisec( 123456789.8 ); + GenTimeSpanFromMillisec( 1234567898765.4 ); + GenTimeSpanFromMillisec( 1000 ); + GenTimeSpanFromMillisec( 60000 ); + GenTimeSpanFromMillisec( 3600000 ); + GenTimeSpanFromMillisec( 86400000 ); + GenTimeSpanFromMillisec( 1801220200 ); +} + +/* +This example of TimeSpan::FromMilliseconds( double ) +generates the following output. + + FromMilliseconds TimeSpan + ---------------- -------- + 1 00:00:00.0010000 + 1.5 00:00:00.0020000 + 12345.6 00:00:12.3460000 + 123456789.8 1.10:17:36.7900000 + 1234567898765.4 14288.23:31:38.7650000 + 1000 00:00:01 + 60000 00:01:00 + 3600000 01:00:00 + 86400000 1.00:00:00 + 1801220200 20.20:20:20.2000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp new file mode 100644 index 00000000000..79a767372f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromminutes.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan::FromMinutes( double ) method. +using namespace System; +void GenTimeSpanFromMinutes( double minutes ) +{ + + // Create a TimeSpan object and TimeSpan string from + // a number of minutes. + TimeSpan interval = TimeSpan::FromMinutes( minutes ); + String^ timeInterval = interval.ToString(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,21}{1,26}", minutes, timeInterval ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::FromMinutes( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "{0,21}{1,18}", "FromMinutes", "TimeSpan" ); + Console::WriteLine( "{0,21}{1,18}", "-----------", "--------" ); + GenTimeSpanFromMinutes( 0.00001 ); + GenTimeSpanFromMinutes( 0.00002 ); + GenTimeSpanFromMinutes( 0.12345 ); + GenTimeSpanFromMinutes( 1234.56789 ); + GenTimeSpanFromMinutes( 12345678.98765 ); + GenTimeSpanFromMinutes( 0.01666 ); + GenTimeSpanFromMinutes( 1 ); + GenTimeSpanFromMinutes( 60 ); + GenTimeSpanFromMinutes( 1440 ); + GenTimeSpanFromMinutes( 30020.33667 ); +} + +/* +This example of TimeSpan::FromMinutes( double ) +generates the following output. + + FromMinutes TimeSpan + ----------- -------- + 1E-05 00:00:00.0010000 + 2E-05 00:00:00.0010000 + 0.12345 00:00:07.4070000 + 1234.56789 20:34:34.0730000 + 12345678.98765 8573.09:18:59.2590000 + 0.01666 00:00:01 + 1 00:01:00 + 60 01:00:00 + 1440 1.00:00:00 + 30020.33667 20.20:20:20.2000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp new file mode 100644 index 00000000000..7ff5d2de047 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromseconds.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan::FromSeconds( double ) method. +using namespace System; +void GenTimeSpanFromSeconds( double seconds ) +{ + + // Create a TimeSpan object and TimeSpan string from + // a number of seconds. + TimeSpan interval = TimeSpan::FromSeconds( seconds ); + String^ timeInterval = interval.ToString(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,21}{1,26}", seconds, timeInterval ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::FromSeconds( double )\n" + "generates the following output.\n" ); + Console::WriteLine( "{0,21}{1,18}", "FromSeconds", "TimeSpan" ); + Console::WriteLine( "{0,21}{1,18}", "-----------", "--------" ); + GenTimeSpanFromSeconds( 0.001 ); + GenTimeSpanFromSeconds( 0.0015 ); + GenTimeSpanFromSeconds( 12.3456 ); + GenTimeSpanFromSeconds( 123456.7898 ); + GenTimeSpanFromSeconds( 1234567898.7654 ); + GenTimeSpanFromSeconds( 1 ); + GenTimeSpanFromSeconds( 60 ); + GenTimeSpanFromSeconds( 3600 ); + GenTimeSpanFromSeconds( 86400 ); + GenTimeSpanFromSeconds( 1801220.2 ); +} + +/* +This example of TimeSpan::FromSeconds( double ) +generates the following output. + + FromSeconds TimeSpan + ----------- -------- + 0.001 00:00:00.0010000 + 0.0015 00:00:00.0020000 + 12.3456 00:00:12.3460000 + 123456.7898 1.10:17:36.7900000 + 1234567898.7654 14288.23:31:38.7650000 + 1 00:00:01 + 60 00:01:00 + 3600 01:00:00 + 86400 1.00:00:00 + 1801220.2 20.20:20:20.2000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp new file mode 100644 index 00000000000..489db154b67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.From/CPP/fromticks.cpp @@ -0,0 +1,58 @@ + +// +// Example of the TimeSpan::FromTicks( __int64 ) method. +using namespace System; +void GenTimeSpanFromTicks( __int64 ticks ) +{ + + // Create a TimeSpan object and TimeSpan string from + // a number of ticks. + TimeSpan interval = TimeSpan::FromTicks( ticks ); + String^ timeInterval = interval.ToString(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,21}{1,26}", ticks, timeInterval ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::FromTicks( __int64 )\n" + "generates the following output.\n" ); + Console::WriteLine( "{0,21}{1,18}", "FromTicks", "TimeSpan" ); + Console::WriteLine( "{0,21}{1,18}", "---------", "--------" ); + GenTimeSpanFromTicks( 1 ); + GenTimeSpanFromTicks( 12345 ); + GenTimeSpanFromTicks( 123456789 ); + GenTimeSpanFromTicks( 1234567898765 ); + GenTimeSpanFromTicks( 12345678987654321 ); + GenTimeSpanFromTicks( 10000000 ); + GenTimeSpanFromTicks( 600000000 ); + GenTimeSpanFromTicks( 36000000000 ); + GenTimeSpanFromTicks( 864000000000 ); + GenTimeSpanFromTicks( 18012202000000 ); +} + +/* +This example of TimeSpan::FromTicks( __int64 ) +generates the following output. + + FromTicks TimeSpan + --------- -------- + 1 00:00:00.0000001 + 12345 00:00:00.0012345 + 123456789 00:00:12.3456789 + 1234567898765 1.10:17:36.7898765 + 12345678987654321 14288.23:31:38.7654321 + 10000000 00:00:01 + 600000000 00:01:00 + 36000000000 01:00:00 + 864000000000 1.00:00:00 + 18012202000000 20.20:20:20.2000000 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp new file mode 100644 index 00000000000..9c57a8242fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.GetHashCode/CPP/hashcode.cpp @@ -0,0 +1,73 @@ + +// +// Example for the TimeSpan::GetHashCode( ) method. +using namespace System; +void DisplayHashCode( TimeSpan interval ) +{ + + // Create a hash code and a string representation of + // the TimeSpan parameter. + String^ timeInterval = interval.ToString(); + int hashCode = interval.GetHashCode(); + + // Pad the end of the TimeSpan string with spaces if it + // does not contain milliseconds. + int pIndex = timeInterval->IndexOf( ':' ); + pIndex = timeInterval->IndexOf( '.', pIndex ); + if ( pIndex < 0 ) + timeInterval = String::Concat( timeInterval, " " ); + + Console::WriteLine( "{0,22} 0x{1:X8}, {1}", timeInterval, hashCode ); +} + +int main() +{ + Console::WriteLine( "This example of TimeSpan::GetHashCode( ) generates " + "the following \noutput, which displays " + "the hash codes of representative TimeSpan \n" + "objects in hexadecimal and decimal formats.\n" ); + Console::WriteLine( "{0,22} {1,10}", "TimeSpan ", "Hash Code" ); + Console::WriteLine( "{0,22} {1,10}", "-------- ", "---------" ); + DisplayHashCode( TimeSpan(0) ); + DisplayHashCode( TimeSpan(1) ); + DisplayHashCode( TimeSpan(0,0,0,0,1) ); + DisplayHashCode( TimeSpan(0,0,1) ); + DisplayHashCode( TimeSpan(0,1,0) ); + DisplayHashCode( TimeSpan(1,0,0) ); + DisplayHashCode( TimeSpan(36000000001) ); + DisplayHashCode( TimeSpan(0,1,0,0,1) ); + DisplayHashCode( TimeSpan(1,0,1) ); + DisplayHashCode( TimeSpan(1,0,0,0) ); + DisplayHashCode( TimeSpan(864000000001) ); + DisplayHashCode( TimeSpan(1,0,0,0,1) ); + DisplayHashCode( TimeSpan(1,0,0,1) ); + DisplayHashCode( TimeSpan(100,0,0,0) ); + DisplayHashCode( TimeSpan(100,0,0,0,1) ); + DisplayHashCode( TimeSpan(100,0,0,1) ); +} + +/* +This example of TimeSpan::GetHashCode( ) generates the following +output, which displays the hash codes of representative TimeSpan +objects in hexadecimal and decimal formats. + + TimeSpan Hash Code + -------- --------- + 00:00:00 0x00000000, 0 + 00:00:00.0000001 0x00000001, 1 + 00:00:00.0010000 0x00002710, 10000 + 00:00:01 0x00989680, 10000000 + 00:01:00 0x23C34600, 600000000 + 01:00:00 0x61C46808, 1640261640 + 01:00:00.0000001 0x61C46809, 1640261641 + 01:00:00.0010000 0x61C48F18, 1640271640 + 01:00:01 0x625CFE88, 1650261640 + 1.00:00:00 0x2A69C0C9, 711573705 + 1.00:00:00.0000001 0x2A69C0C8, 711573704 + 1.00:00:00.0010000 0x2A69E7D9, 711583705 + 1.00:00:01 0x2B025649, 721573449 + 100.00:00:00 0x914F4E94, -1857073516 + 100.00:00:00.0010000 0x914F6984, -1857066620 + 100.00:00:01 0x91E7D814, -1847076844 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp new file mode 100644 index 00000000000..6e3817f134c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.Properties/CPP/properties.cpp @@ -0,0 +1,88 @@ +// +using namespace System; + +static void ShowTimeSpanProperties(TimeSpan interval) +{ + Console::WriteLine("{0,21}", interval ); + Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", + "Days", interval.Days, "TotalDays", + interval.TotalDays); + Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", + "Hours", interval.Hours, "TotalHours", + interval.TotalHours); + Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", + "Minutes", interval.Minutes, "TotalMinutes", + interval.TotalMinutes); + Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", + "Seconds", interval.Seconds, "TotalSeconds", + interval.TotalSeconds); + Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N3}", + "Milliseconds", interval.Milliseconds, + "TotalMilliseconds", interval.TotalMilliseconds); + Console::WriteLine("{0,-12}{1,8} {2,-18}{3,21:N0}", + nullptr, nullptr, "Ticks", interval.Ticks); +} + +void main() +{ + // Create and display a TimeSpan value of 1 tick. + Console::Write("\n{0,-45}", "TimeSpan( 1 )"); + ShowTimeSpanProperties(TimeSpan(1)); + + // Create a TimeSpan value with a large number of ticks. + Console::Write("\n{0,-45}", "TimeSpan( 111222333444555 )"); + ShowTimeSpanProperties( TimeSpan(111222333444555)); + + // This TimeSpan has all fields specified. + Console::Write("\n{0,-45}", "TimeSpan( 10, 20, 30, 40, 50 )"); + ShowTimeSpanProperties( TimeSpan(10,20,30,40,50)); + + // This TimeSpan has all fields overflowing. + Console::Write("\n{0,-45}", "TimeSpan( 1111, 2222, 3333, 4444, 5555 )"); + ShowTimeSpanProperties( TimeSpan(1111,2222,3333,4444,5555)); + + // This TimeSpan is based on a number of days. + Console::Write("\n{0,-45}", "FromDays( 20.84745602 )"); + ShowTimeSpanProperties( TimeSpan::FromDays( 20.84745602 )); +} +// The example displays the following output if the current culture is en-US: +// TimeSpan( 1 ) 00:00:00.0000001 +// Days 0 TotalDays 0.000 +// Hours 0 TotalHours 0.000 +// Minutes 0 TotalMinutes 0.000 +// Seconds 0 TotalSeconds 0.000 +// Milliseconds 0 TotalMilliseconds 0.000 +// Ticks 1 +// +// TimeSpan( 111222333444555 ) 128.17:30:33.3444555 +// Days 128 TotalDays 128.730 +// Hours 17 TotalHours 3,089.509 +// Minutes 30 TotalMinutes 185,370.556 +// Seconds 33 TotalSeconds 11,122,233.344 +// Milliseconds 344 TotalMilliseconds 11,122,233,344.456 +// Ticks 111,222,333,444,555 +// +// TimeSpan( 10, 20, 30, 40, 50 ) 10.20:30:40.0500000 +// Days 10 TotalDays 10.855 +// Hours 20 TotalHours 260.511 +// Minutes 30 TotalMinutes 15,630.668 +// Seconds 40 TotalSeconds 937,840.050 +// Milliseconds 50 TotalMilliseconds 937,840,050.000 +// Ticks 9,378,400,500,000 +// +// TimeSpan( 1111, 2222, 3333, 4444, 5555 ) 1205.22:47:09.5550000 +// Days 1205 TotalDays 1,205.949 +// Hours 22 TotalHours 28,942.786 +// Minutes 47 TotalMinutes 1,736,567.159 +// Seconds 9 TotalSeconds 104,194,029.555 +// Milliseconds 555 TotalMilliseconds 104,194,029,555.000 +// Ticks 1,041,940,295,550,000 +// +// FromDays( 20.84745602 ) 20.20:20:20.2000000 +// Days 20 TotalDays 20.847 +// Hours 20 TotalHours 500.339 +// Minutes 20 TotalMinutes 30,020.337 +// Seconds 20 TotalSeconds 1,801,220.200 +// Milliseconds 200 TotalMilliseconds 1,801,220,200.000 +// Ticks 18,012,202,000,000 +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp new file mode 100644 index 00000000000..526f4e39d00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeSpan.RelationalOps/CPP/relationalops.cpp @@ -0,0 +1,76 @@ + +// +// Example of the TimeSpan relational operators. +using namespace System; +const __wchar_t * protoFmt = L"{0,35} {1}"; + +// Compare TimeSpan parameters, and display them with the results. +void CompareTimeSpans( TimeSpan Left, TimeSpan Right, String^ RightText ) +{ + String^ dataFmt = gcnew String( protoFmt ); + Console::WriteLine(); + Console::WriteLine( dataFmt, String::Concat( "Right: ", RightText ), Right ); + Console::WriteLine( dataFmt, "Left == Right", Left == Right ); + Console::WriteLine( dataFmt, "Left > Right", Left > Right ); + Console::WriteLine( dataFmt, "Left >= Right", Left >= Right ); + Console::WriteLine( dataFmt, "Left != Right", Left != Right ); + Console::WriteLine( dataFmt, "Left < Right", Left < Right ); + Console::WriteLine( dataFmt, "Left <= Right", Left <= Right ); +} + +int main() +{ + TimeSpan Left = TimeSpan(2,0,0); + Console::WriteLine( "This example of the TimeSpan relational operators " + "generates \nthe following output. It creates several " + "different TimeSpan \nobjects and compares them with " + "a 2-hour TimeSpan.\n" ); + Console::WriteLine( gcnew String( protoFmt ), "Left: TimeSpan( 2, 0, 0 )", Left ); + + // Create objects to compare with a 2-hour TimeSpan. + CompareTimeSpans( Left, TimeSpan(0,120,0), "TimeSpan( 0, 120, 0 )" ); + CompareTimeSpans( Left, TimeSpan(2,0,1), "TimeSpan( 2, 0, 1 )" ); + CompareTimeSpans( Left, TimeSpan(2,0,-1), "TimeSpan( 2, 0, -1 )" ); + CompareTimeSpans( Left, TimeSpan::FromDays( 1.0 / 12. ), "TimeSpan::FromDays( 1 / 12 )" ); +} + +/* +This example of the TimeSpan relational operators generates +the following output. It creates several different TimeSpan +objects and compares them with a 2-hour TimeSpan. + + Left: TimeSpan( 2, 0, 0 ) 02:00:00 + + Right: TimeSpan( 0, 120, 0 ) 02:00:00 + Left == Right True + Left > Right False + Left >= Right True + Left != Right False + Left < Right False + Left <= Right True + + Right: TimeSpan( 2, 0, 1 ) 02:00:01 + Left == Right False + Left > Right False + Left >= Right False + Left != Right True + Left < Right True + Left <= Right True + + Right: TimeSpan( 2, 0, -1 ) 01:59:59 + Left == Right False + Left > Right True + Left >= Right True + Left != Right True + Left < Right False + Left <= Right False + +Right: TimeSpan::FromDays( 1 / 12 ) 02:00:00 + Left == Right True + Left > Right False + Left >= Right True + Left != Right False + Left < Right False + Left <= Right True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp new file mode 100644 index 00000000000..e1a104a5583 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TimeZone.Class/CPP/tzclass.cpp @@ -0,0 +1,61 @@ + +// +// Example of selected TimeZone class elements. +using namespace System; +using namespace System::Globalization; +int main() +{ + String^ dataFmt = "{0,-30}{1}"; + String^ timeFmt = "{0,-30}{1:yyyy-MM-dd HH:mm}"; + Console::WriteLine( "This example of selected TimeZone class " + "elements generates the following \n" + "output, which varies depending on the " + "time zone in which it is run.\n" ); + + // Get the local time zone and the current local time and year. + TimeZone^ localZone = TimeZone::CurrentTimeZone; + DateTime currentDate = DateTime::Now; + int currentYear = currentDate.Year; + + // Display the names for standard time and daylight saving + // time for the local time zone. + Console::WriteLine( dataFmt, "Standard time name:", localZone->StandardName ); + Console::WriteLine( dataFmt, "Daylight saving time name:", localZone->DaylightName ); + + // Display the current date and time and show if they occur + // in daylight saving time. + Console::WriteLine( String::Concat( "\n", timeFmt ), "Current date and time:", currentDate ); + Console::WriteLine( dataFmt, "Daylight saving time?", localZone->IsDaylightSavingTime( currentDate ) ); + + // Get the current Coordinated Universal Time (UTC) and UTC + // offset. + DateTime currentUTC = localZone->ToUniversalTime( currentDate ); + TimeSpan currentOffset = localZone->GetUtcOffset( currentDate ); + Console::WriteLine( timeFmt, "Coordinated Universal Time:", currentUTC ); + Console::WriteLine( dataFmt, "UTC offset:", currentOffset ); + + // Get the DaylightTime object for the current year. + DaylightTime^ daylight = localZone->GetDaylightChanges( currentYear ); + + // Display the daylight saving time range for the current year. + Console::WriteLine( "\nDaylight saving time for year {0}:", currentYear ); + Console::WriteLine( "{0:yyyy-MM-dd HH:mm} to " + "{1:yyyy-MM-dd HH:mm}, delta: {2}", daylight->Start, daylight->End, daylight->Delta ); +} + +/* +This example of selected TimeZone class elements generates the following +output, which varies depending on the time zone in which it is run. + +Standard time name: Pacific Standard Time +Daylight saving time name: Pacific Daylight Time + +Current date and time: 2006-01-06 16:47 +Daylight saving time? False +Coordinated Universal Time: 2006-01-07 00:47 +UTC offset: -08:00:00 + +Daylight saving time for year 2006: +2006-04-02 02:00 to 2006-10-29 02:00, delta: 01:00:00 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp new file mode 100644 index 00000000000..3ac30b92e74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.BindGenericParameters/CPP/source.cpp @@ -0,0 +1,100 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; + +namespace Example +{ + public ref class Test + { + public: + static void CreateConstructedType(void) + { + Console::WriteLine("\r\n--- Create a constructed type" + " from the generic Dictionary`2 type."); + + // Create a type object representing + // the generic Dictionary`2 type. + Type^ genericType = Type::GetType( + "System.Collections.Generic.Dictionary`2"); + if (genericType != nullptr) + { + DisplayTypeInfo(genericType); + } + else + { + Console::WriteLine("The type is not found"); + return; + } + + // Create an array of types to substitute for the type + // parameters of Dictionary`2. + // The key is of type string, and the type to be + // contained in the Dictionary`2 is Test. + array^ typeArgs = {String::typeid, Test::typeid}; + Type^ constructedType = + genericType->MakeGenericType(typeArgs); + DisplayTypeInfo(constructedType); + + // Compare the type objects obtained above to type objects + // obtained using typeof() and GetGenericTypeDefinition(). + Console::WriteLine("\r\n--- Compare types obtained by" + " different methods:"); + + Type^ definedType = Dictionary::typeid; + Console::WriteLine("\tAre the constructed types " + "equal? {0}", definedType == constructedType); + Console::WriteLine("\tAre the generic types equal? {0}", + definedType->GetGenericTypeDefinition() == genericType); + } + + private: + static void DisplayTypeInfo(Type^ typeToDisplay) + { + Console::WriteLine("\r\n{0}", typeToDisplay); + Console::WriteLine("\tIs this a generic type definition? " + "{0}", typeToDisplay->IsGenericTypeDefinition); + Console::WriteLine("\tIs it a generic type? " + "{0}", typeToDisplay->IsGenericType); + + array^ typeArguments = + typeToDisplay->GetGenericArguments(); + Console::WriteLine("\tList type arguments ({0}):", + typeArguments->Length); + + for each (Type^ typeArgument in typeArguments) + { + Console::WriteLine("\t\t{0}", typeArgument); + } + } + }; +} + +int main(void) +{ + Example::Test::CreateConstructedType(); +} + +/* This example produces the following output: + +--- Create a constructed type from the generic Dictionary`2 type. + +System.Collections.Generic.Dictionary`2[KeyType,ValueType] + Is this a generic type definition? True + Is it a generic type? True + List type arguments (2): + K + V + +System.Collections.Generic.Dictionary`2[System.String, Test] + Is this a generic type definition? False + Is it a generic type? True + List type arguments (2): + System.String + Test + +--- Compare types obtained by different methods: + Are the constructed types equal? True + Are the generic types equal? True + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp new file mode 100644 index 00000000000..8720dbc53fd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericParameterConstraints/CPP/source.cpp @@ -0,0 +1,126 @@ +// +using namespace System; +using namespace System::Collections; +using namespace System::Reflection; + +// Define a sample interface to use as an interface constraint. +interface class ITest{}; + +// Define a base type to use as a class constraint. +public ref class Base{}; + +// Define the generic type to examine. The first generic type parameter, +// T, derives from the class Base and implements ITest. This demonstrates +// a base class constraint and an interface constraint. In the .NET +// Framework version 2.0, C++ has no way of expressing special constraints. +// See the C# example code. +// +generic + where T : Base, ITest +ref class Test {}; + +// Define a type that derives from Base and implements interface +// ITest. This type satisfies the constraint on T in class Test. +public ref class Derived: public Base, public ITest {}; + +public ref class Example +{ +public: + static void Main() + { + // Create a constructed type from Test, and from it + // get the generic type definition. + // + Type^ def = Test::typeid; + Console::WriteLine( L"\r\nExamining generic type {0}", def ); + + // Get the type parameters of the generic type definition, + // and display them. + // + for each (Type^ tp in def->GetGenericArguments()) + { + Console::WriteLine( L"\r\nType parameter: {0}", tp); + Console::WriteLine( L"\t{0}", + ListGenericParameterAttributes( tp ) ); + + // List the base class and interface constraints. The + // constraints do not appear in any particular order. If + // there are no class or interface constraints, an empty + // array is returned. + // + for each (Type^ constraint in tp->GetGenericParameterConstraints()) + { + Console::WriteLine( L"\t{0}", constraint ); + } + } + } + +private: + + // List the variance and special constraint flags. + // + static String^ ListGenericParameterAttributes( Type^ t ) + { + String^ retval; + GenericParameterAttributes gpa = t->GenericParameterAttributes; + + // Select the variance flag. + GenericParameterAttributes variance = + static_cast( + gpa & GenericParameterAttributes::VarianceMask ); + + if ( variance == GenericParameterAttributes::None ) + retval = L"No variance flag;"; + else + { + if ( (variance & GenericParameterAttributes::Covariant) != + GenericParameterAttributes::None ) + retval = L"Covariant;"; + else + retval = L"Contravariant;"; + } + + // Select the special constraint flags. + GenericParameterAttributes constraints = + static_cast( + gpa & GenericParameterAttributes::SpecialConstraintMask); + + if ( constraints == GenericParameterAttributes::None ) + retval = String::Concat( retval, L" No special constraints" ); + else + { + if ( (constraints & GenericParameterAttributes::ReferenceTypeConstraint) != + GenericParameterAttributes::None ) + retval = String::Concat( retval, L" ReferenceTypeConstraint" ); + + if ( (constraints & GenericParameterAttributes::NotNullableValueTypeConstraint) != + GenericParameterAttributes::None ) + retval = String::Concat( retval, L" NotNullableValueTypeConstraint" ); + + if ( (constraints & GenericParameterAttributes::DefaultConstructorConstraint) != + GenericParameterAttributes::None ) + retval = String::Concat( retval, L" DefaultConstructorConstraint" ); + } + + return retval; + } +}; + +int main() +{ + Example::Main(); +} + +/* This example produces the following output: + +Examining generic type Test`2[T,U] + +Type parameter: T + No variance flag; No special constraints + Base + ITest + +Type parameter: U + No variance flag; No special constraints + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp new file mode 100644 index 00000000000..42acac613e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.GetGenericTypeDefinition/CPP/source.cpp @@ -0,0 +1,70 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; + +public ref class Test +{ +public: + static void Main() + { + Console::Write( L"\r\n--- Get the generic type that " ); + Console::WriteLine( L"defines a constructed type." ); + + // Create a Dictionary of Test objects, using strings for the + // keys. + Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; + + // Get a Type object representing the constructed type. + // + Type^ constructed = d->GetType(); + DisplayTypeInfo( constructed ); + Type^ myGeneric = constructed->GetGenericTypeDefinition(); + DisplayTypeInfo( myGeneric ); + } + +private: + static void DisplayTypeInfo( Type^ t ) + { + Console::WriteLine( L"\r\n{0}", t ); + Console::WriteLine( L"\tIs this a generic type definition? {0}", + t->IsGenericTypeDefinition ); + Console::WriteLine( L"\tIs it a generic type? {0}", + t->IsGenericType ); + array^typeArguments = t->GetGenericArguments(); + Console::WriteLine( L"\tList type arguments ({0}):", + typeArguments->Length ); + System::Collections::IEnumerator^ myEnum = + typeArguments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ tParam = safe_cast(myEnum->Current); + Console::WriteLine( L"\t\t{0}", tParam ); + } + } +}; + +int main() +{ + Test::Main(); +} + +/* This example produces the following output: + +--- Get the generic type that defines a constructed type. + +System.Collections.Generic.Dictionary`2[System.String,Test] + Is this a generic type definition? False + Is it a generic type? True + List type arguments (2): + System.String + Test + +System.Collections.Generic.Dictionary`2[TKey,TValue] + Is this a generic type definition? True + Is it a generic type? True + List type arguments (2): + TKey + TValue + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp new file mode 100644 index 00000000000..bd05647c2bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.HasUnboundGenericParameters/CPP/source.cpp @@ -0,0 +1,108 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; + +// Define a base class with two type parameters. +generic< class T,class U > +public ref class Base {}; + +// Define a derived class. The derived class inherits from a constructed +// class that meets the following criteria: +// (1) Its generic type definition is Base. +// (2) It specifies int for the first type parameter. +// (3) For the second type parameter, it uses the same type that is used +// for the type parameter of the derived class. +// Thus, the derived class is a generic type with one type parameter, but +// its base class is an open constructed type with one type argument and +// one type parameter. +generic +public ref class Derived : Base {}; + +public ref class Test +{ +public: + static void Main() + { + Console::WriteLine( + L"\r\n--- Display a generic type and the open constructed"); + Console::WriteLine(L" type from which it is derived."); + + // Create a Type object representing the generic type definition + // for the Derived type. Note the absence of type arguments. + // + Type^ derivedType = Derived::typeid; + DisplayGenericTypeInfo(derivedType); + + // Display its open constructed base type. + DisplayGenericTypeInfo(derivedType->BaseType); + } + + +private: + static void DisplayGenericTypeInfo(Type^ t) + { + Console::WriteLine(L"\r\n{0}", t); + Console::WriteLine(L"\tIs this a generic type definition? {0}", + t->IsGenericTypeDefinition); + Console::WriteLine(L"\tIs it a generic type? {0}", t->IsGenericType); + Console::WriteLine(L"\tDoes it have unassigned generic parameters? {0}", + t->ContainsGenericParameters); + if (t->IsGenericType) + { + + // If this is a generic type, display the type arguments. + // + array^typeArguments = t->GetGenericArguments(); + Console::WriteLine(L"\tList type arguments ({0}):", + typeArguments->Length); + System::Collections::IEnumerator^ myEnum = + typeArguments->GetEnumerator(); + while (myEnum->MoveNext()) + { + Type^ tParam = safe_cast(myEnum->Current); + + // IsGenericParameter is true only for generic type + // parameters. + // + if (tParam->IsGenericParameter) + { + Console::WriteLine( + L"\t\t{0} (unassigned - parameter position {1})", + tParam, tParam->GenericParameterPosition); + } + else + { + Console::WriteLine(L"\t\t{0}", tParam); + } + } + } + } +}; + +int main() +{ + Test::Main(); +} + +/* This example produces the following output: + +--- Display a generic type and the open constructed + type from which it is derived. + +Derived`1[V] + Is this a generic type definition? True + Is it a generic type? True + Does it have unassigned generic parameters? True + List type arguments (1): + V (unassigned - parameter position 0) + +Base`2[System.Int32,V] + Is this a generic type definition? False + Is it a generic type? True + Does it have unassigned generic parameters? True + List type arguments (2): + System.Int32 + V (unassigned - parameter position 0) + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp new file mode 100644 index 00000000000..7382ca1e398 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericParameter/CPP/source.cpp @@ -0,0 +1,101 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; + +public ref class Test +{ +private: + static void DisplayGenericTypeInfo( Type^ t ) + { + Console::WriteLine( L"\r\n{0}", t ); + Console::WriteLine( L"\tIs this a generic type definition? {0}", + t->IsGenericTypeDefinition ); + Console::WriteLine( L"\tIs it a generic type? {0}", + t->IsGenericType ); + + // + if ( t->IsGenericType ) + { + + // If this is a generic type, display the type arguments. + // + array^typeArguments = t->GetGenericArguments(); + Console::WriteLine( L"\tList type arguments ({0}):", + typeArguments->Length ); + System::Collections::IEnumerator^ myEnum = + typeArguments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ tParam = safe_cast(myEnum->Current); + + // If this is a type parameter, display its + // position. + // + if ( tParam->IsGenericParameter ) + { + Console::WriteLine( + L"\t\t{0}\t(unassigned - parameter position {1})", + tParam, tParam->GenericParameterPosition ); + } + else + { + Console::WriteLine( L"\t\t{0}", tParam ); + } + } + } + // + } + + +public: + static void Main() + { + Console::Write( L"\r\n--- Display information about a " ); + Console::WriteLine( L"constructed type, its" ); + Console::WriteLine( L" generic type definition, and an ordinary type." ); + + // Create a Dictionary of Test objects, using strings for the + // keys. + Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; + + // Display information for the constructed type and its generic + // type definition. + DisplayGenericTypeInfo( d->GetType() ); + DisplayGenericTypeInfo( d->GetType()->GetGenericTypeDefinition() ); + + // Display information for an ordinary type. + DisplayGenericTypeInfo( String::typeid ); + } + +}; + +int main() +{ + Test::Main(); +} + +/* This example produces the following output: + +--- Display information about a constructed type, its + generic type definition, and an ordinary type. + +System.Collections.Generic.Dictionary[System.String,Test] + Is this a generic type definition? False + Is it a generic type? True + List type arguments (2): + System.String + Test + +System.Collections.Generic.Dictionary[TKey,TValue] + Is this a generic type definition? True + Is it a generic type? True + List type arguments (2): + TKey (unassigned - parameter position 0) + TValue (unassigned - parameter position 1) + +System.String + Is this a generic type definition? False + Is it a generic type? False + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp new file mode 100644 index 00000000000..ae4ef65dd24 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/remarks.cpp @@ -0,0 +1,21 @@ + +using namespace System; +using namespace System::Reflection; + +// +generic public ref class Base {}; + +generic public ref class G {}; + +generic public ref class Derived : Base +{ +public: + G^>^ F; + + ref class Nested {}; +}; +// + + +void main() {} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp new file mode 100644 index 00000000000..39b29ec5a65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericType/cpp/source.cpp @@ -0,0 +1,110 @@ +// +using namespace System; +using namespace System::Reflection; + +generic public ref class Base {}; + +generic public ref class G {}; + +generic public ref class Derived : Base +{ +public: + G^>^ F; + + ref class Nested {}; +}; + +void DisplayGenericType(Type^ t, String^ caption) +{ + Console::WriteLine("\n{0}", caption); + Console::WriteLine(" Type: {0}", t); + + Console::WriteLine("\t IsGenericType: {0}", + t->IsGenericType); + Console::WriteLine("\t IsGenericTypeDefinition: {0}", + t->IsGenericTypeDefinition); + Console::WriteLine("\tContainsGenericParameters: {0}", + t->ContainsGenericParameters); + Console::WriteLine("\t IsGenericParameter: {0}", + t->IsGenericParameter); +} + +void main() +{ + // Get the generic type definition for Derived, and the base + // type for Derived. + // + Type^ tDerived = Derived::typeid; + Type^ tDerivedBase = tDerived->BaseType; + + // Declare an array of Derived, and get its type. + // + array^>^ d = gcnew array^>(0); + Type^ tDerivedArray = d->GetType(); + + // Get a generic type parameter, the type of a field, and a + // type that is nested in Derived. Notice that in order to + // get the nested type it is necessary to either (1) specify + // the generic type definition Derived::typeid, as shown here, + // or (2) specify a type parameter for Derived. + // + Type^ tT = Base::typeid->GetGenericArguments()[0]; + Type^ tF = tDerived->GetField("F")->FieldType; + Type^ tNested = Derived::Nested::typeid; + + DisplayGenericType(tDerived, "generic Derived"); + DisplayGenericType(tDerivedBase, "Base type of generic Derived"); + DisplayGenericType(tDerivedArray, "Array of Derived"); + DisplayGenericType(tT, "Type parameter T from generic Base"); + DisplayGenericType(tF, "Field type, G^>^"); + DisplayGenericType(tNested, "Nested type in generic Derived"); +} + +/* This code example produces the following output: + +generic Derived + Type: Derived`1[V] + IsGenericType: True + IsGenericTypeDefinition: True + ContainsGenericParameters: True + IsGenericParameter: False + +Base type of generic Derived + Type: Base`2[System.String,V] + IsGenericType: True + IsGenericTypeDefinition: False + ContainsGenericParameters: True + IsGenericParameter: False + +Array of Derived + Type: Derived`1[System.Int32][] + IsGenericType: False + IsGenericTypeDefinition: False + ContainsGenericParameters: False + IsGenericParameter: False + +Type parameter T from generic Base + Type: T + IsGenericType: False + IsGenericTypeDefinition: False + ContainsGenericParameters: True + IsGenericParameter: True + +Field type, G^>^ + Type: G`1[Derived`1[V]] + IsGenericType: True + IsGenericTypeDefinition: False + ContainsGenericParameters: True + IsGenericParameter: False + +Nested type in generic Derived + Type: Derived`1+Nested[V] + IsGenericType: True + IsGenericTypeDefinition: True + ContainsGenericParameters: True + IsGenericParameter: False + */ +// + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp new file mode 100644 index 00000000000..7382ca1e398 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsGenericTypeDefinition/CPP/source.cpp @@ -0,0 +1,101 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Collections::Generic; + +public ref class Test +{ +private: + static void DisplayGenericTypeInfo( Type^ t ) + { + Console::WriteLine( L"\r\n{0}", t ); + Console::WriteLine( L"\tIs this a generic type definition? {0}", + t->IsGenericTypeDefinition ); + Console::WriteLine( L"\tIs it a generic type? {0}", + t->IsGenericType ); + + // + if ( t->IsGenericType ) + { + + // If this is a generic type, display the type arguments. + // + array^typeArguments = t->GetGenericArguments(); + Console::WriteLine( L"\tList type arguments ({0}):", + typeArguments->Length ); + System::Collections::IEnumerator^ myEnum = + typeArguments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Type^ tParam = safe_cast(myEnum->Current); + + // If this is a type parameter, display its + // position. + // + if ( tParam->IsGenericParameter ) + { + Console::WriteLine( + L"\t\t{0}\t(unassigned - parameter position {1})", + tParam, tParam->GenericParameterPosition ); + } + else + { + Console::WriteLine( L"\t\t{0}", tParam ); + } + } + } + // + } + + +public: + static void Main() + { + Console::Write( L"\r\n--- Display information about a " ); + Console::WriteLine( L"constructed type, its" ); + Console::WriteLine( L" generic type definition, and an ordinary type." ); + + // Create a Dictionary of Test objects, using strings for the + // keys. + Dictionary< String^,Test^ >^ d = gcnew Dictionary< String^,Test^ >; + + // Display information for the constructed type and its generic + // type definition. + DisplayGenericTypeInfo( d->GetType() ); + DisplayGenericTypeInfo( d->GetType()->GetGenericTypeDefinition() ); + + // Display information for an ordinary type. + DisplayGenericTypeInfo( String::typeid ); + } + +}; + +int main() +{ + Test::Main(); +} + +/* This example produces the following output: + +--- Display information about a constructed type, its + generic type definition, and an ordinary type. + +System.Collections.Generic.Dictionary[System.String,Test] + Is this a generic type definition? False + Is it a generic type? True + List type arguments (2): + System.String + Test + +System.Collections.Generic.Dictionary[TKey,TValue] + Is this a generic type definition? True + Is it a generic type? True + List type arguments (2): + TKey (unassigned - parameter position 0) + TValue (unassigned - parameter position 1) + +System.String + Is this a generic type definition? False + Is it a generic type? False + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp new file mode 100644 index 00000000000..8332eed2ff0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.IsVisible/CPP/source.cpp @@ -0,0 +1,36 @@ +// +using namespace System; + +private ref class InternalOnly +{ +public: + ref class Nested {}; +}; + +public ref class Example +{ +public: + ref class Nested {}; +}; + + +// Entry point of example +int main() +{ + Type^ classType = InternalOnly::Nested::typeid; + Console::WriteLine( + "Is the {0} class visible outside the assembly? {1}", + classType->FullName, classType->IsVisible); + + classType = Example::Nested::typeid; + Console::WriteLine( + "Is the {0} class visible outside the assembly? {1}", + classType->FullName, classType->IsVisible); +} + +/* This example produces the following output: + +Is the InternalOnly+Nested class visible outside the assembly? False +Is the Example+Nested class visible outside the assembly? True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp new file mode 100644 index 00000000000..c9c917bc746 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type.MakeXxxType/CPP/source.cpp @@ -0,0 +1,82 @@ +// +using namespace System; +using namespace System::Reflection; + +public ref class Example +{ +public: + static void Main() + { + // Create a Type object that represents a one-dimensional + // array of Example objects. + Type^ t = Example::typeid->MakeArrayType(); + Console::WriteLine( L"\r\nArray of Example: {0}", t ); + + // Create a Type object that represents a two-dimensional + // array of Example objects. + t = Example::typeid->MakeArrayType( 2 ); + Console::WriteLine( L"\r\nTwo-dimensional array of Example: {0}", t ); + + // Demonstrate an exception when an invalid array rank is + // specified. + try + { + t = Example::typeid->MakeArrayType( -1 ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( L"\r\n{0}", ex ); + } + + // Create a Type object that represents a ByRef parameter + // of type Example. + t = Example::typeid->MakeByRefType(); + Console::WriteLine( L"\r\nByRef Example: {0}", t ); + + // Get a Type object representing the Example class, a + // MethodInfo representing the "Test" method, a ParameterInfo + // representing the parameter of type Example, and finally + // a Type object representing the type of this ByRef parameter. + // Compare this Type object with the Type object created using + // MakeByRefType. + Type^ t2 = Example::typeid; + MethodInfo^ mi = t2->GetMethod( L"Test" ); + ParameterInfo^ pi = mi->GetParameters()[ 0 ]; + Type^ pt = pi->ParameterType; + Console::WriteLine( L"Are the ByRef types equal? {0}", (t == pt) ); + + // Create a Type object that represents a pointer to an + // Example object. + t = Example::typeid->MakePointerType(); + Console::WriteLine( L"\r\nPointer to Example: {0}", t ); + } + + // A sample method with a ByRef parameter. + // + void Test( interior_ptr /*e*/ ) + { + } +}; + +int main() +{ + Example::Main(); +} + +/* This example produces output similar to the following: + +Array of Example: Example[] + +Two-dimensional array of Example: Example[,] + +System.IndexOutOfRangeException: Index was outside the bounds of the array. + at System.RuntimeType.MakeArrayType(Int32 rank) in c:\vbl\ndp\clr\src\BCL\System\RtType.cs:line 2999 + at Example.Main() + +ByRef Example: Example& +Are the ByRef types equal? True + +Pointer to Example: Example* + + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp new file mode 100644 index 00000000000..b9aab72110f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.Type/cpp/source.cpp @@ -0,0 +1,27 @@ +// The following code example demonstrates that Type objects are returned +// by the typeid operator, and shows how Type objects are used in reflection +// to explore information about types and to invoke members of types. +// +#using + +using namespace System; +using namespace System::Reflection; + +void main() +{ + // Get a Type object representing the System.String type. + Type^ t = String::typeid; + + MethodInfo^ substr = t->GetMethod("Substring", + gcnew array { int::typeid, int::typeid }); + + Object^ result = + substr->Invoke("Hello, World!", gcnew array { 7, 5 }); + Console::WriteLine("{0} returned \"{1}\".", substr, result); +} + +/* This code example produces the following output: + +System.String Substring(Int32, Int32) returned "World". + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp new file mode 100644 index 00000000000..84ebc81e817 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.TypeCode/CPP/iconvertible.cpp @@ -0,0 +1,153 @@ + +// +using namespace System; + +/// Class that implements IConvertible* +public ref class Complex: public IConvertible +{ +private: + double x; + double y; + +public: + Complex( double x, double y ) + { + this->x = x; + this->y = y; + } + + virtual TypeCode GetTypeCode() + { + return TypeCode::Object; + } + + virtual bool ToBoolean( IFormatProvider^ provider ) + { + if ( (x != 0.0) || (y != 0.0) ) + return true; + else + return false; + } + + double GetDoubleValue() + { + return Math::Sqrt( x * x + y * y ); + } + + virtual Byte ToByte( IFormatProvider^ provider ) + { + return Convert::ToByte( GetDoubleValue() ); + } + + virtual Char ToChar( IFormatProvider^ provider ) + { + return Convert::ToChar( GetDoubleValue() ); + } + + virtual DateTime ToDateTime( IFormatProvider^ provider ) + { + return Convert::ToDateTime( GetDoubleValue() ); + } + + virtual Decimal ToDecimal( IFormatProvider^ provider ) + { + return Convert::ToDecimal( GetDoubleValue() ); + } + + virtual double ToDouble( IFormatProvider^ provider ) + { + return GetDoubleValue(); + } + + virtual short ToInt16( IFormatProvider^ provider ) + { + return Convert::ToInt16( GetDoubleValue() ); + } + + virtual int ToInt32( IFormatProvider^ provider ) + { + return Convert::ToInt32( GetDoubleValue() ); + } + + virtual Int64 ToInt64( IFormatProvider^ provider ) + { + return Convert::ToInt64( GetDoubleValue() ); + } + + virtual signed char ToSByte( IFormatProvider^ provider ) + { + return Convert::ToSByte( GetDoubleValue() ); + } + + virtual float ToSingle( IFormatProvider^ provider ) + { + return Convert::ToSingle( GetDoubleValue() ); + } + + virtual String^ ToString( IFormatProvider^ provider ) + { + return x.ToString() + ", " + y.ToString(); + } + + virtual Object^ ToType( Type^ conversionType, IFormatProvider^ provider ) + { + return Convert::ChangeType( GetDoubleValue(), conversionType ); + } + + virtual UInt16 ToUInt16( IFormatProvider^ provider ) + { + return Convert::ToUInt16( GetDoubleValue() ); + } + + virtual UInt32 ToUInt32( IFormatProvider^ provider ) + { + return Convert::ToUInt32( GetDoubleValue() ); + } + + virtual UInt64 ToUInt64( IFormatProvider^ provider ) + { + return Convert::ToUInt64( GetDoubleValue() ); + } +}; + + +// +void WriteObjectInfo( Object^ testObject ) +{ + TypeCode typeCode = Type::GetTypeCode( testObject->GetType() ); + switch ( typeCode ) + { + case TypeCode::Boolean: + Console::WriteLine( "Boolean: {0}", testObject ); + break; + + case TypeCode::Double: + Console::WriteLine( "Double: {0}", testObject ); + break; + + default: + Console::WriteLine( "{0}: {1}", typeCode, testObject ); + break; + } +} +// + +void main() +{ + Complex^ testComplex = gcnew Complex( 4,7 ); + WriteObjectInfo( testComplex ); + WriteObjectInfo( Convert::ToBoolean( testComplex ) ); + WriteObjectInfo( Convert::ToDecimal( testComplex ) ); + WriteObjectInfo( Convert::ToString( testComplex ) ); +} + +/* +This code example produces the following results: + +Object: ConsoleApplication2.Complex +Boolean: True +Decimal: 8.06225774829855 +String: ( 4 , 7 ) + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp new file mode 100644 index 00000000000..e10fb59e8bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.cpp @@ -0,0 +1,42 @@ +// Lambda.cpp : main project file. + +//#include "stdafx.h" + +// +using namespace System; +using namespace System::Windows::Forms; + +public delegate void ShowValue(); + + +public ref class Name +{ +private: + String^ instanceName; + +public: + Name(String^ name) + { + instanceName = name; + } + + void DisplayToConsole() + { + Console::WriteLine(this->instanceName); + } + + void DisplayToWindow() + { + MessageBox::Show(this->instanceName); + } +}; + +int main() +{ + Name^ testName = gcnew Name(L"Koani"); + ShowValue^ showMethod; + showMethod = gcnew ShowValue(testName, &Name::DisplayToWindow); + showMethod(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj new file mode 100644 index 00000000000..747bfeb6b76 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.action.delegate/cpp/delegate.vcxproj @@ -0,0 +1,89 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9EC80F18-EB27-492B-9D70-40C7B2052756} + v4.0 + ManagedCProj + TestWinForms + + + + Application + true + Pure + Unicode + + + Application + false + Pure + Unicode + + + + + + + + + + + + + true + + + false + + + + Level3 + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + + + true + + + Windows + main + + + + + Level3 + WIN32;NDEBUG;%(PreprocessorDefinitions) + Use + + + true + + + Windows + main + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp new file mode 100644 index 00000000000..8dd9c5712f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.activation.createinstance~~1/cpp/remarks.cpp @@ -0,0 +1,18 @@ + +using namespace System; + +public ref class Dummy +{ +// + public: + generic where T:gcnew() + static T Bar() + { + return gcnew T(); + } +// +}; + + +void main() {} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp new file mode 100644 index 00000000000..c877a1585fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.createinstancefrom_stringstring/cpp/example.cpp @@ -0,0 +1,54 @@ +// +using namespace System; + +public interface class ITest +{ + void Test(String^ greeting); +}; + +public ref class MarshalableExample : MarshalByRefObject, ITest +{ +public: + virtual void Test(String^ greeting) + { + Console::WriteLine("{0} from '{1}'!", greeting, + AppDomain::CurrentDomain->FriendlyName); + } +}; + +void main() +{ + // Construct a path to the current assembly. + String^ assemblyPath = Environment::CurrentDirectory + "\\" + + MarshalableExample::typeid->Assembly->GetName()->Name + ".exe"; + + AppDomain^ ad = AppDomain::CreateDomain("MyDomain"); + + System::Runtime::Remoting::ObjectHandle^ oh = + ad->CreateInstanceFrom(assemblyPath, "MarshalableExample"); + + Object^ obj = oh->Unwrap(); + + + // Three ways to use the newly created object, depending on how + // much is known about the type: Late bound, early bound through + // a mutually known interface, or early binding of a known type. + // + obj->GetType()->InvokeMember("Test", + System::Reflection::BindingFlags::InvokeMethod, + Type::DefaultBinder, obj, gcnew array { "Hello" }); + + ITest^ it = (ITest^) obj; + it->Test("Hi"); + + MarshalableExample^ ex = (MarshalableExample^) obj; + ex->Test("Goodbye"); +} + +/* This example produces the following output: + +Hello from 'MyDomain'! +Hi from 'MyDomain'! +Goodbye from 'MyDomain'! + */ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp new file mode 100644 index 00000000000..41005ae1378 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.appdomain.load/cpp/source.cpp @@ -0,0 +1,31 @@ +using namespace System; + +ref class AppDomainLoad +{ +private: + AppDomainLoad(){} + + +public: + static void CreateAndLoad() + { + try + { +// + AppDomain^ ad = AppDomain::CreateDomain("ChildDomain"); + ad->Load("MyAssembly"); +// + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + Console::WriteLine(ex->StackTrace); + } + } + +}; + +int main() +{ + AppDomainLoad::CreateAndLoad(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp new file mode 100644 index 00000000000..f739b8705dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.array.foreach/cpp/source.cpp @@ -0,0 +1,40 @@ +// The following example demonstrates using the ForEach method. + +// +using namespace System; + +public ref class SamplesArray +{ +public: + static void Main() + { + // create a three element array of integers + array^ intArray = gcnew array {2, 3, 4}; + + // set a delegate for the ShowSquares method + Action^ action = gcnew Action(ShowSquares); + + Array::ForEach(intArray, action); + } + +private: + static void ShowSquares(int val) + { + Console::WriteLine("{0:d} squared = {1:d}", val, val*val); + } +}; + +int main() +{ + SamplesArray::Main(); +} + +/* +This code produces the following output: + +2 squared = 4 +3 squared = 9 +4 squared = 16 +*/ + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp new file mode 100644 index 00000000000..fb3486b04d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.array.getlength/cpp/source.cpp @@ -0,0 +1,64 @@ +// The following example demonstrates using the Array.GetLength method. + +// +using namespace System; + +public ref class SamplesArray +{ +public: + static void Main() + { + // make a single dimension array + Array^ MyArray1 = Array::CreateInstance(int::typeid, 5); + + // make a 3 dimensional array + Array^ MyArray2 = Array::CreateInstance(int::typeid, 5, 3, 2); + + // make an array container + Array^ BossArray = Array::CreateInstance(Array::typeid, 2); + BossArray->SetValue(MyArray1, 0); + BossArray->SetValue(MyArray2, 1); + + int i = 0, j, rank; + for each (Array^ anArray in BossArray) + { + rank = anArray->Rank; + if (rank > 1) + { + Console::WriteLine("Lengths of {0:d} dimension array[{1:d}]", rank, i); + // show the lengths of each dimension + for (j = 0; j < rank; j++) + { + Console::WriteLine(" Length of dimension({0:d}) = {1:d}", j, anArray->GetLength(j)); + } + } + else + { + Console::WriteLine("Lengths of single dimension array[{0:d}]", i); + } + // show the total length of the entire array or all dimensions + Console::WriteLine(" Total length of the array = {0:d}", anArray->Length); + Console::WriteLine(); + i++; + } + } +}; + +int main() +{ + SamplesArray::Main(); +} + +/* +This code produces the following output: + +Lengths of single dimension array[0] + Total length of the array = 5 + +Lengths of 3 dimension array[1] + Length of dimension(0) = 5 + Length of dimension(1) = 3 + Length of dimension(2) = 2 + Total length of the array = 30 +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp new file mode 100644 index 00000000000..62891bfe86f --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.array.getupperbound/cpp/source.cpp @@ -0,0 +1,65 @@ +// +using namespace System; + +void main() +{ + // Create a one-dimensional integer array. + array^ integers = { 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; + // Get the upper and lower bound of the array. + int upper = integers->GetUpperBound(0); + int lower = integers->GetLowerBound(0); + Console::WriteLine("Elements from index {0} to {1}:", lower, upper); + // Iterate the array. + for (int ctr = lower; ctr <= upper; ctr++) + Console::Write("{0}{1}{2}", ctr == lower ? " " : "", + integers[ctr], + ctr < upper ? ", " : Environment::NewLine); + + Console::WriteLine(); + + // Create a two-dimensional integer array. + array^ integers2d = { {2, 4}, {3, 9}, {4, 16}, {5, 25}, + {6, 36}, {7, 49}, {8, 64}, {9, 81} }; + // Get the number of dimensions. + int rank = integers2d->Rank; + Console::WriteLine("Number of dimensions: {0}", rank); + for (int ctr = 0; ctr < rank; ctr++) + Console::WriteLine(" Dimension {0}: from {1} to {2}", + ctr, integers2d->GetLowerBound(ctr), + integers2d->GetUpperBound(ctr)); + + // Iterate the 2-dimensional array and display its values. + Console::WriteLine(" Values of array elements:"); + for (int outer = integers2d->GetLowerBound(0); outer <= integers2d->GetUpperBound(0); + outer++) + for (int inner = integers2d->GetLowerBound(1); inner <= integers2d->GetUpperBound(1); + inner++) + Console::WriteLine(" {3}{0}, {1}{4} = {2}", outer, inner, + integers2d->GetValue(outer, inner), "{", "}"); +} +// The example displays the following output: +// Elements from index 0 to 9: +// 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 +// +// Number of dimensions: 2 +// Dimension 0: from 0 to 7 +// Dimension 1: from 0 to 1 +// Values of array elements: +// {0, 0} = 2 +// {0, 1} = 4 +// {1, 0} = 3 +// {1, 1} = 9 +// {2, 0} = 4 +// {2, 1} = 16 +// {3, 0} = 5 +// {3, 1} = 25 +// {4, 0} = 6 +// {4, 1} = 36 +// {5, 0} = 7 +// {5, 1} = 49 +// {6, 0} = 8 +// {6, 1} = 64 +// {7, 0} = 9 +// {7, 1} = 81 +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp new file mode 100644 index 00000000000..7d01f577679 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.byte.equals/cpp/eq.cpp @@ -0,0 +1,24 @@ +// Byte.Equals.cpp : main project file. + +// +using namespace System; + +void main() +{ + Byte byteVal1 = 0x7f; + Byte byteVal2 = 127; + Object^ objectVal3 = byteVal2; + + Console::WriteLine("byteVal1 = {0}, byteVal2 = {1}, objectVal3 = {2}\n", + byteVal1, byteVal2, objectVal3); + Console::WriteLine("byteVal1 equals byteVal2?: {0}", byteVal1.Equals(byteVal2)); + Console::WriteLine("byteVal1 equals objectVal3?: {0}", byteVal1.Equals(objectVal3)); +} +/* +This example displays the following output: + byteVal1 = 127, byteVal2 = 127, objectVal3 = 127 + + byteVal1 equals byteVal2?: True + byteVal1 equals objectVal3?: True +*/ +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp new file mode 100644 index 00000000000..2b795397fac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributeargument/cpp/source.cpp @@ -0,0 +1,37 @@ +// +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +int main() +{ + // Declare a new type called Class1. + CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); + + // Use attributes to mark the class as serializable and obsolete. + CodeAttributeDeclaration^ codeAttrDecl = + gcnew CodeAttributeDeclaration("System.Serializable"); + class1->CustomAttributes->Add(codeAttrDecl); + + CodeAttributeArgument^ codeAttr = + gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression("This class is obsolete.")); + codeAttrDecl = gcnew CodeAttributeDeclaration("System.Obsolete", codeAttr); + class1->CustomAttributes->Add(codeAttrDecl); + + // Create a C# code provider + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Generate code and send the output to the console + provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); +} + +// The CPP code generator produces the following source code for the preceeding example code: +// +//[System.Serializable()] +//[System.Obsolete("This class is obsolete.")] +//public class Class1 { +//} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp new file mode 100644 index 00000000000..5523f2c37c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codeattributedeclaration/cpp/source.cpp @@ -0,0 +1,32 @@ +// +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +int main() +{ + // Declare a new type called Class1. + CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); + + // Declare a new code attribute + CodeAttributeDeclaration^ codeAttrDecl = gcnew CodeAttributeDeclaration( + "System.CLSCompliantAttribute", + gcnew CodeAttributeArgument(gcnew CodePrimitiveExpression(false))); + class1->CustomAttributes->Add(codeAttrDecl); + + // Create a C# code provider + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Generate code and send the output to the console + provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); +} + +// The CPP code generator produces the following source code for the preceeding example code: +// +//[System.CLSCompliantAttribute(false)] +//public class Class1 { +//} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp new file mode 100644 index 00000000000..4db196685db --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.codemethodreferenceexpression/cpp/source.cpp @@ -0,0 +1,48 @@ +// +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +int main() +{ + // Declare a new type called Class1. + CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); + + // Declares a type constructor that calls a method. + CodeConstructor^ constructor1 = gcnew CodeConstructor(); + constructor1->Attributes = MemberAttributes::Public; + class1->Members->Add(constructor1); + + // Creates a method reference for dict.Init. + CodeMethodReferenceExpression^ methodRef1 = + gcnew CodeMethodReferenceExpression( + gcnew CodeVariableReferenceExpression("dict"), + "Init", + gcnew array { + gcnew CodeTypeReference("System.Decimal"), + gcnew CodeTypeReference("System.Int32")}); + + // Invokes the dict.Init method from the constructor. + CodeMethodInvokeExpression^ invoke1 = + gcnew CodeMethodInvokeExpression(methodRef1, gcnew array {}); + constructor1->Statements->Add(invoke1); + + // Create a C# code provider + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Generate code and send the output to the console + provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); +} + +// The CPP code generator produces the following source code for the preceeding example code: +// +//public class Class1 { +// +// public Class1() { +// dict.Init(); +// } +// } +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp new file mode 100644 index 00000000000..dcd7661e4aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.codedom.compiler.generatedcodeattribute/cpp/source.cpp @@ -0,0 +1,39 @@ +// +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +int main() +{ + // Declare a new type called Class1. + CodeTypeDeclaration^ class1 = gcnew CodeTypeDeclaration("Class1"); + + // Declare a new generated code attribute + GeneratedCodeAttribute^ generatedCodeAttribute = + gcnew GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0"); + + // Use the generated code attribute members in the attribute declaration + CodeAttributeDeclaration^ codeAttrDecl = + gcnew CodeAttributeDeclaration(generatedCodeAttribute->GetType()->Name, + gcnew CodeAttributeArgument( + gcnew CodePrimitiveExpression(generatedCodeAttribute->Tool)), + gcnew CodeAttributeArgument( + gcnew CodePrimitiveExpression(generatedCodeAttribute->Version))); + class1->CustomAttributes->Add(codeAttrDecl); + + // Create a C# code provider + CodeDomProvider^ provider = CodeDomProvider::CreateProvider("CSharp"); + + // Generate code and send the output to the console + provider->GenerateCodeFromType(class1, Console::Out, gcnew CodeGeneratorOptions()); +} + +// The CPP code generator produces the following source code for the preceeding example code: +// +// [GeneratedCodeAttribute("SampleCodeGenerator", "2.0.0.0")] +// public class Class1 { +// } +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp new file mode 100644 index 00000000000..66e77dee281 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.collections.icollection/cpp/remarks.cpp @@ -0,0 +1,59 @@ +using namespace System; +using namespace System::Collections; +using namespace System::Threading; + +public ref class Remarks +{ +public: + static void Main() + { + ArrayList^ someCollection = gcnew ArrayList(5); + // + ICollection^ myCollection = someCollection; + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + for each (Object^ item in myCollection); + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } + + static void Dummy() + { + ArrayList^ someCollection = gcnew ArrayList(5); + // + ICollection^ myCollection = someCollection; + bool lockTaken = false; + try + { + Monitor::Enter(myCollection->SyncRoot, lockTaken); + // Some operation on the collection, which is now thread safe. + } + finally + { + if (lockTaken) + { + Monitor::Exit(myCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + Remarks::Main(); +} + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp new file mode 100644 index 00000000000..95fbc966ac0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.collectionsutil/cpp/source.cpp @@ -0,0 +1,63 @@ +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; + +ref class TestCollectionsUtils +{ +public: + static void Main() + { + Hashtable^ population1 = CollectionsUtil::CreateCaseInsensitiveHashtable(); + + population1["Trapperville"] = 15; + population1["Doggerton"] = 230; + population1["New Hollow"] = 1234; + population1["McHenry"] = 185; + + // Select cities from the table using mixed case. + Console::WriteLine("Case insensitive hashtable results:\n"); + Console::WriteLine("{0}'s population is: {1}", "Trapperville", population1["trapperville"]); + Console::WriteLine("{0}'s population is: {1}", "Doggerton", population1["DOGGERTON"]); + Console::WriteLine("{0}'s population is: {1}", "New Hollow", population1["New hoLLow"]); + Console::WriteLine("{0}'s population is: {1}", "McHenry", population1["MchenrY"]); + + SortedList^ population2 = CollectionsUtil::CreateCaseInsensitiveSortedList(); + + for each (String^ city in population1->Keys) + { + population2->Add(city, population1[city]); + } + + // Select cities from the sorted list using mixed case. + Console::WriteLine("\nCase insensitive sorted list results:\n"); + Console::WriteLine("{0}'s population is: {1}", "Trapperville", population2["trapPeRVille"]); + Console::WriteLine("{0}'s population is: {1}", "Doggerton", population2["dOGGeRtON"]); + Console::WriteLine("{0}'s population is: {1}", "New Hollow", population2["nEW hOLLOW"]); + Console::WriteLine("{0}'s population is: {1}", "McHenry", population2["MchEnrY"]); + } +}; + +int main() +{ + TestCollectionsUtils::Main(); +} + +// This program displays the following output to the console +// +// Case insensitive hashtable results: +// +// Trapperville's population is: 15 +// Doggerton's population is: 230 +// New Hollow's population is: 1234 +// McHenry's population is: 185 +// +// Case insensitive sorted list results: +// +// Trapperville's population is: 15 +// Doggerton's population is: 230 +// New Hollow's population is: 1234 +// McHenry's population is: 185 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp new file mode 100644 index 00000000000..9fef255cba7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.collections.specialized.nameobjectcollectionbase.keyscollection/cpp/source.cpp @@ -0,0 +1,131 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Threading; + +public ref class DerivedCollection : public NameObjectCollectionBase { + +private: + DictionaryEntry^ _de; + + // Creates an empty collection. +public: + DerivedCollection() { + _de = gcnew DictionaryEntry(); + } + + // Adds elements from an IDictionary into the new collection. + DerivedCollection( IDictionary^ d, Boolean bReadOnly ) { + + _de = gcnew DictionaryEntry(); + + for each ( DictionaryEntry^ de in d ) { + this->BaseAdd( (String^) de->Key, de->Value ); + } + this->IsReadOnly = bReadOnly; + } + + // Gets a key-and-value pair (DictionaryEntry) using an index. + property DictionaryEntry^ default[ int ] { + DictionaryEntry^ get(int index) { + _de->Key = this->BaseGetKey(index); + _de->Value = this->BaseGet(index); + return( _de ); + } + } + + // Gets or sets the value associated with the specified key. + property Object^ default[ String^ ] { + Object^ get(String^ key) { + return( this->BaseGet( key ) ); + } + void set( String^ key, Object^ value ) { + this->BaseSet( key, value ); + } + } + + // Gets a String array that contains all the keys in the collection. + property array^ AllKeys { + array^ get() { + return( (array^)this->BaseGetAllKeys() ); + } + } + + // Gets an Object array that contains all the values in the collection. + property Array^ AllValues { + Array^ get() { + return( this->BaseGetAllValues() ); + } + } + + // Gets a String array that contains all the values in the collection. + property array^ AllStringValues { + array^ get() { + return( (array^) this->BaseGetAllValues( String ::typeid )); + } + } + + // Gets a value indicating if the collection contains keys that are not null. + property Boolean HasKeys { + Boolean get() { + return( this->BaseHasKeys() ); + } + } + + // Adds an entry to the collection. + void Add( String^ key, Object^ value ) { + this->BaseAdd( key, value ); + } + + // Removes an entry with the specified key from the collection. + void Remove( String^ key ) { + this->BaseRemove( key ); + } + + // Removes an entry in the specified index from the collection. + void Remove( int index ) { + this->BaseRemoveAt( index ); + } + + // Clears all the elements in the collection. + void Clear() { + this->BaseClear(); + } +}; + +public ref class SamplesNameObjectCollectionBaseKeys +{ +public: + static void Main() + { + // + // Create a collection derived from NameObjectCollectionBase + NameObjectCollectionBase^ myBaseCollection = gcnew DerivedCollection(); + // Get the ICollection from NameObjectCollectionBase.KeysCollection + ICollection^ myKeysCollection = myBaseCollection->Keys; + bool lockTaken = false; + try + { + Monitor::Enter(myKeysCollection->SyncRoot, lockTaken); + for each (Object^ item in myKeysCollection) + { + // Insert your code here. + } + } + finally + { + if (lockTaken) + { + Monitor::Exit(myKeysCollection->SyncRoot); + } + } + // + } +}; + +int main() +{ + SamplesNameObjectCollectionBaseKeys::Main(); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp new file mode 100644 index 00000000000..65a52f0b6cc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.console.setout/cpp/source.cpp @@ -0,0 +1,29 @@ + +using namespace System; +using namespace System::IO; + +void main() +{ + try + { +// + Console::WriteLine("Hello World"); + FileStream^ fs = gcnew FileStream("Test.txt", FileMode::Create); + // First, save the standard output. + TextWriter^ tmp = Console::Out; + StreamWriter^ sw = gcnew StreamWriter(fs); + Console::SetOut(sw); + Console::WriteLine("Hello file"); + Console::SetOut(tmp); + Console::WriteLine("Hello World"); + sw->Close(); +// + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + Console::WriteLine(ex->StackTrace); + } +} + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp new file mode 100644 index 00000000000..829d3eb8423 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.console.windowleft/cpp/windowleft1.cpp @@ -0,0 +1,53 @@ +// Console.WindowLeft.cpp : main project file. + +// +using namespace System; + +void ShowConsoleStatistics() +{ + Console::WriteLine("Console statistics:"); + Console::WriteLine(" Buffer: {0} x {1}", Console::BufferHeight, Console::BufferWidth); + Console::WriteLine(" Window: {0} x {1}", Console::WindowHeight, Console::WindowWidth); + Console::WriteLine(" Window starts at {0}.", Console::WindowLeft); + Console::WriteLine("Press <- or -> to move window, Ctrl+C to exit."); +} + +int main() +{ + ConsoleKeyInfo key; + bool moved = false; + + Console::BufferWidth = 120; + Console::Clear(); + + ShowConsoleStatistics(); + + do { + key = Console::ReadKey(true); + if (key.Key == ConsoleKey::LeftArrow) + { + int pos = Console::WindowLeft - 1; + if (pos >= 0 && pos + Console::WindowWidth <= Console::BufferWidth) + { + Console::WindowLeft = pos; + moved = true; + } + } + else if (key.Key == ConsoleKey::RightArrow) + { + int pos = Console::WindowLeft + 1; + if (pos + Console::WindowWidth <= Console::BufferWidth) + { + Console::WindowLeft = pos; + moved = true; + } + } + if (moved) + { + ShowConsoleStatistics(); + moved = false; + } + Console::WriteLine(); + } while (true); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp new file mode 100644 index 00000000000..2e488e00359 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.console.write/cpp/con_write.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +//void main(array ^args) +void main() +{ + DateTime dateRecorded(2009, 6, 15); + DateTime startTime(1, 1, 1, 0, 30, 0); + TimeSpan interval(12, 0, 0); + + Double temperature1 = 52.8; + Double temperature2 = 63.5; + + Console::Write("Date: {0:d}:\n Temperature at {1:t}: {2}\n Temperature at {3:t}: {4}\n", + dateRecorded, startTime, temperature1, + startTime.Add(interval), temperature2); + Console::ReadLine(); +} +// The example displays the following output: +// Date: 6/15/2009: +// Temperature at 12:30 AM: 52.8 +// Temperature at 12:30 PM: 63.5 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp new file mode 100644 index 00000000000..33eb3685a6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype00.cpp @@ -0,0 +1,98 @@ +// Convert.ChangeType00.cpp : main project file. + +// +using namespace System; +using namespace System::Globalization; + +ref class InterceptProvider : IFormatProvider +{ +public: + virtual Object^ GetFormat(Type^ formatType) + { + CultureInfo^ culture; + if (formatType == NumberFormatInfo::typeid) { + Console::WriteLine(" Returning a fr-FR numeric format provider."); + + culture = gcnew CultureInfo("fr-FR"); + return culture->NumberFormat; + } + else if (formatType == DateTimeFormatInfo::typeid) { + Console::WriteLine(" Returning an en-US date/time format provider."); + culture = gcnew CultureInfo("en-US"); + return culture->DateTimeFormat; + } + else { + Console::WriteLine(" Requesting a format provider of {0}.", formatType->Name); + return nullptr; + } + } +}; + +void main() +{ + array^ values = gcnew array { 103.5, gcnew DateTime(2010, 12, 26, 14, 34, 0) }; + IFormatProvider^ provider = gcnew InterceptProvider(); + + // Convert value to each of the types represented in TypeCode enum. + for each (Object^ value in values) + { + // Iterate types in TypeCode enum. + for each (TypeCode enumType in (array^) Enum::GetValues(TypeCode::typeid)) + { + if (enumType == TypeCode::DBNull || enumType == TypeCode::Empty) continue; + + try { + Console::WriteLine("{0} ({1}) --> {2} ({3}).", + value, value->GetType()->Name, + Convert::ChangeType(value, enumType, provider), + enumType.ToString()); + } + catch (InvalidCastException^ e) { + Console::WriteLine("Cannot convert a {0} to a {1}", + value->GetType()->Name, enumType.ToString()); + } + catch (OverflowException^ e) { + Console::WriteLine("Overflow: {0} is out of the range of a {1}", + value, enumType.ToString()); + } + } + Console::WriteLine(); + } +} +// The example displays the following output: +// 103.5 (Double) --> 103.5 (Object). +// 103.5 (Double) --> True (Boolean). +// Cannot convert a Double to a Char +// 103.5 (Double) --> 104 (SByte). +// 103.5 (Double) --> 104 (Byte). +// 103.5 (Double) --> 104 (Int16). +// 103.5 (Double) --> 104 (UInt16). +// 103.5 (Double) --> 104 (Int32). +// 103.5 (Double) --> 104 (UInt32). +// 103.5 (Double) --> 104 (Int64). +// 103.5 (Double) --> 104 (UInt64). +// 103.5 (Double) --> 103.5 (Single). +// 103.5 (Double) --> 103.5 (Double). +// 103.5 (Double) --> 103.5 (Decimal). +// Cannot convert a Double to a DateTime +// Returning a fr-FR numeric format provider. +// 103.5 (Double) --> 103,5 (String). +// +// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (Object). +// Cannot convert a DateTime to a Boolean +// Cannot convert a DateTime to a Char +// Cannot convert a DateTime to a SByte +// Cannot convert a DateTime to a Byte +// Cannot convert a DateTime to a Int16 +// Cannot convert a DateTime to a UInt16 +// Cannot convert a DateTime to a Int32 +// Cannot convert a DateTime to a UInt32 +// Cannot convert a DateTime to a Int64 +// Cannot convert a DateTime to a UInt64 +// Cannot convert a DateTime to a Single +// Cannot convert a DateTime to a Double +// Cannot convert a DateTime to a Decimal +// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (DateTime). +// Returning an en-US date/time format provider. +// 12/26/2010 2:34:00 PM (DateTime) --> 12/26/2010 2:34:00 PM (String). +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp new file mode 100644 index 00000000000..36b41bcee35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype03.cpp @@ -0,0 +1,239 @@ +// Convert.ChangeType03.cpp : main project file. + +// +using namespace System; +using namespace System::Globalization; + +public ref class Temperature : IConvertible +{ +private: + Decimal m_Temp; + +public: + Temperature(Decimal temperature) + { + m_Temp = temperature; + } + + property Decimal Celsius { + Decimal get() { return m_Temp; } + } + + property Decimal Kelvin { + Decimal get() { return m_Temp + (Decimal) 273.15; } + } + + property Decimal Fahrenheit { + Decimal get() { return Math::Round((Decimal) (m_Temp * 9 / 5 + 32), 2); } + } + + virtual String^ ToString() + override { + return m_Temp.ToString("N2") + "°C"; + } + + // IConvertible implementations. + virtual TypeCode GetTypeCode() + { + return TypeCode::Object; + } + + virtual bool ToBoolean(IFormatProvider^ provider) + { + if (m_Temp == 0) + return false; + else + return true; + } + + virtual Byte ToByte(IFormatProvider^ provider) + { + if (m_Temp < Byte::MinValue || m_Temp > Byte::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the Byte type.", + m_Temp)); + else + return Decimal::ToByte(m_Temp); + } + + virtual Char ToChar(IFormatProvider^ provider) + { + throw gcnew InvalidCastException("Temperature to Char conversion is not supported."); + } + + virtual DateTime ToDateTime(IFormatProvider^ provider) + { + throw gcnew InvalidCastException("Temperature to DateTime conversion is not supported."); + } + + virtual Decimal ToDecimal(IFormatProvider^ provider) + { + return m_Temp; + } + + virtual Double ToDouble(IFormatProvider^ provider) + { + return Decimal::ToDouble(m_Temp); + } + + virtual Int16 ToInt16(IFormatProvider^ provider) + { + if (m_Temp < Int16::MinValue || m_Temp > Int16::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the Int16 type.", + m_Temp)); + else + return Decimal::ToInt16(m_Temp); + } + + virtual Int32 ToInt32(IFormatProvider^ provider) + { + if (m_Temp < Int32::MinValue || m_Temp > Int32::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the Int32 type.", + m_Temp)); + else + return Decimal::ToInt32(m_Temp); + } + + virtual Int64 ToInt64(IFormatProvider^ provider) + { + if (m_Temp < Int64::MinValue || m_Temp > Int64::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the Int64 type.", + m_Temp)); + else + return Decimal::ToInt64(m_Temp); + } + + virtual SByte ToSByte(IFormatProvider^ provider) + { + if (m_Temp < SByte::MinValue || m_Temp > SByte::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the SByte type.", + m_Temp)); + else + return Decimal::ToSByte(m_Temp); + } + + virtual Single ToSingle(IFormatProvider^ provider) + { + return Decimal::ToSingle(m_Temp); + } + + virtual String^ ToString(IFormatProvider^ provider) + { + return m_Temp.ToString("N2", provider) + "°C"; + } + + virtual Object^ ToType(Type^ conversionType, IFormatProvider^ provider) + { + switch (Type::GetTypeCode(conversionType)) + { + case TypeCode::Boolean: + return ToBoolean(nullptr); + case TypeCode::Byte: + return ToByte(nullptr); + case TypeCode::Char: + return ToChar(nullptr); + case TypeCode::DateTime: + return ToDateTime(nullptr); + case TypeCode::Decimal: + return ToDecimal(nullptr); + case TypeCode::Double: + return ToDouble(nullptr); + case TypeCode::Int16: + return ToInt16(nullptr); + case TypeCode::Int32: + return ToInt32(nullptr); + case TypeCode::Int64: + return ToInt64(nullptr); + case TypeCode::Object: + if (Temperature::typeid->Equals(conversionType)) + return this; + else + throw gcnew InvalidCastException(String::Format("Conversion to a {0} is not supported.", + conversionType->Name)); + case TypeCode::SByte: + return ToSByte(nullptr); + case TypeCode::Single: + return ToSingle(nullptr); + case TypeCode::String: + return ToString(provider); + case TypeCode::UInt16: + return ToUInt16(nullptr); + case TypeCode::UInt32: + return ToUInt32(nullptr); + case TypeCode::UInt64: + return ToUInt64(nullptr); + default: + throw gcnew InvalidCastException(String::Format("Conversion to {0} is not supported.", conversionType->Name)); + } + } + + virtual UInt16 ToUInt16(IFormatProvider^ provider) + { + if (m_Temp < UInt16::MinValue || m_Temp > UInt16::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the UInt16 type.", + m_Temp)); + else + return Decimal::ToUInt16(m_Temp); + } + + virtual UInt32 ToUInt32(IFormatProvider^ provider) + { + if (m_Temp < UInt32::MinValue || m_Temp > UInt32::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the UInt32 type.", + m_Temp)); + else + return Decimal::ToUInt32(m_Temp); + } + + virtual UInt64 ToUInt64(IFormatProvider^ provider) + { + if (m_Temp < UInt64::MinValue || m_Temp > UInt64::MaxValue) + throw gcnew OverflowException(String::Format("{0} is out of range of the UInt64 type.", + m_Temp)); + else + return Decimal::ToUInt64(m_Temp); + } +}; +// + +// +void main() +{ + Temperature^ cool = gcnew Temperature(5); + array^ targetTypes = gcnew array { SByte::typeid, Int16::typeid, Int32::typeid, + Int64::typeid, Byte::typeid, UInt16::typeid, + UInt32::typeid, UInt64::typeid, Decimal::typeid, + Single::typeid, Double::typeid, String::typeid }; + CultureInfo^ provider = gcnew CultureInfo("fr-FR"); + + for each (Type^ targetType in targetTypes) + { + try { + Object^ value = Convert::ChangeType(cool, targetType, provider); + Console::WriteLine("Converted {0} {1} to {2} {3}.", + cool->GetType()->Name, cool->ToString(), + targetType->Name, value); + } + catch (InvalidCastException^) { + Console::WriteLine("Unsupported {0} --> {1} conversion.", + cool->GetType()->Name, targetType->Name); + } + catch (OverflowException^) { + Console::WriteLine("{0} is out of range of the {1} type.", + cool, targetType->Name); + } + } +} +// The example dosplays the following output: +// Converted Temperature 5.00°C to SByte 5. +// Converted Temperature 5.00°C to Int16 5. +// Converted Temperature 5.00°C to Int32 5. +// Converted Temperature 5.00°C to Int64 5. +// Converted Temperature 5.00°C to Byte 5. +// Converted Temperature 5.00°C to UInt16 5. +// Converted Temperature 5.00°C to UInt32 5. +// Converted Temperature 5.00°C to UInt64 5. +// Converted Temperature 5.00°C to Decimal 5. +// Converted Temperature 5.00°C to Single 5. +// Converted Temperature 5.00°C to Double 5. +// Converted Temperature 5.00°C to String 5,00°C. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp new file mode 100644 index 00000000000..162b7f8fc5b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.convert.changetype/cpp/changetype_01.cpp @@ -0,0 +1,21 @@ +// ChangeType01.cpp : main project file. + +// +using namespace System; + +void main() +{ + Double d = -2.345; + int i = (int) Convert::ChangeType(d, TypeCode::Int32); + + Console::WriteLine("The Double {0} when converted to an Int32 is {1}", d, i); + + String^ s = "12/12/2009"; + DateTime dt = (DateTime)Convert::ChangeType(s, DateTime::typeid); + + Console::WriteLine("The String {0} when converted to a Date is {1}", s, dt); +} +// The example displays the following output: +// The Double -2.345 when converted to an Int32 is -2 +// The String 12/12/2009 when converted to a Date is 12/12/2009 12:00:00 AM +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp new file mode 100644 index 00000000000..c114fe2f378 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.convert.tobyte/cpp/tobyte1.cpp @@ -0,0 +1,19 @@ +// Convert.ToByte.cpp : main project file. + +// +using namespace System; + +void main() +{ + bool falseFlag = false; + bool trueFlag = true; + + Console::WriteLine("{0} converts to {1}.", falseFlag, + Convert::ToByte(falseFlag)); + Console::WriteLine("{0} converts to {1}.", trueFlag, + Convert::ToByte(trueFlag)); +} +// The example displays the following output: +// False converts to 0. +// True converts to 1. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp new file mode 100644 index 00000000000..d4d8b439ff3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.addminutes/cpp/addminutes1.cpp @@ -0,0 +1,33 @@ +// +using namespace System; + +void main() +{ + DateTime dateValue(2013, 9, 15, 12, 0, 0); + + array^ minutes = { .01667, .08333, .16667, .25, .33333, + .5, .66667, 1, 2, 15, 30, 17, 45, + 60, 180, 60 * 24 }; + + for each (Double minute in minutes) + Console::WriteLine("{0} + {1} minute(s) = {2}", dateValue, minute, + dateValue.AddMinutes(minute)); +} +// The example displays the following output on a system whose current culture is en-US: +// 9/15/2013 12:00:00 PM + 0.01667 minute(s) = 9/15/2013 12:00:01 PM +// 9/15/2013 12:00:00 PM + 0.08333 minute(s) = 9/15/2013 12:00:05 PM +// 9/15/2013 12:00:00 PM + 0.16667 minute(s) = 9/15/2013 12:00:10 PM +// 9/15/2013 12:00:00 PM + 0.25 minute(s) = 9/15/2013 12:00:15 PM +// 9/15/2013 12:00:00 PM + 0.33333 minute(s) = 9/15/2013 12:00:20 PM +// 9/15/2013 12:00:00 PM + 0.5 minute(s) = 9/15/2013 12:00:30 PM +// 9/15/2013 12:00:00 PM + 0.66667 minute(s) = 9/15/2013 12:00:40 PM +// 9/15/2013 12:00:00 PM + 1 minute(s) = 9/15/2013 12:01:00 PM +// 9/15/2013 12:00:00 PM + 2 minute(s) = 9/15/2013 12:02:00 PM +// 9/15/2013 12:00:00 PM + 15 minute(s) = 9/15/2013 12:15:00 PM +// 9/15/2013 12:00:00 PM + 30 minute(s) = 9/15/2013 12:30:00 PM +// 9/15/2013 12:00:00 PM + 17 minute(s) = 9/15/2013 12:17:00 PM +// 9/15/2013 12:00:00 PM + 45 minute(s) = 9/15/2013 12:45:00 PM +// 9/15/2013 12:00:00 PM + 60 minute(s) = 9/15/2013 1:00:00 PM +// 9/15/2013 12:00:00 PM + 180 minute(s) = 9/15/2013 3:00:00 PM +// 9/15/2013 12:00:00 PM + 1440 minute(s) = 9/16/2013 12:00:00 PM +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp new file mode 100644 index 00000000000..6392ec34c1a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now1.cpp @@ -0,0 +1,23 @@ +// +using namespace System; +using namespace System::Globalization; + +void main() +{ + DateTime localDate = DateTime::Now; + array^ cultureNames = { "en-US", "en-GB", "fr-FR", + "de-DE", "ru-RU" }; + + for each (String^ cultureName in cultureNames) { + CultureInfo^ culture = gcnew CultureInfo(cultureName); + Console::WriteLine("{0}: {1}", cultureName, + localDate.ToString(culture)); + } +} +// The example displays the following output: +// en-US: 6/19/2015 10:03:06 AM +// en-GB: 19/06/2015 10:03:06 +// fr-FR: 19/06/2015 10:03:06 +// de-DE: 19.06.2015 10:03:06 +// ru-RU: 19.06.2015 10:03:06 +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp new file mode 100644 index 00000000000..3026aeda282 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.datetime.now/cpp/now2.cpp @@ -0,0 +1,42 @@ +// +using namespace System; +using namespace System::Globalization; + +void main() +{ + DateTime localDate = DateTime::Now; + DateTime utcDate = DateTime::UtcNow; + array^ cultureNames = { "en-US", "en-GB", "fr-FR", + "de-DE", "ru-RU" } ; + + for each (String^ cultureName in cultureNames) { + CultureInfo^ culture = gcnew CultureInfo(cultureName); + Console::WriteLine("{0}:", culture->NativeName); + Console::WriteLine(" Local date and time: {0}, {1:G}", + localDate.ToString(culture), localDate.Kind); + Console::WriteLine(" UTC date and time: {0}, {1:G}\n", + utcDate.ToString(culture), utcDate.Kind); + } +} +// The example displays the following output: +// English (United States): +// Local date and time: 6/19/2015 10:35:50 AM, Local +// UTC date and time: 6/19/2015 5:35:50 PM, Utc +// +// English (United Kingdom): +// Local date and time: 19/06/2015 10:35:50, Local +// UTC date and time: 19/06/2015 17:35:50, Utc +// +// français (France): +// Local date and time: 19/06/2015 10:35:50, Local +// UTC date and time: 19/06/2015 17:35:50, Utc +// +// Deutsch (Deutschland): +// Local date and time: 19.06.2015 10:35:50, Local +// UTC date and time: 19.06.2015 17:35:50, Utc +// +// руÑÑкий (РоÑÑиÑ): +// Local date and time: 19.06.2015 10:35:50, Local +// UTC date and time: 19.06.2015 17:35:50, Utc +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp new file mode 100644 index 00000000000..e2e407522b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosbyte.cpp @@ -0,0 +1,43 @@ +// +using namespace System; + +void main() +{ + // Define an array of decimal values. + array^ values = { Decimal::Parse("78"), + Decimal(78000,0,0,false,3), + Decimal::Parse("78.999"), + Decimal::Parse("255.999"), + Decimal::Parse("256"), + Decimal::Parse("127.999"), + Decimal::Parse("128"), + Decimal::Parse("-0.999"), + Decimal::Parse("-1"), + Decimal::Parse("-128.999"), + Decimal::Parse("-129") }; + for each (Decimal value in values) { + try { + SByte byteValue = (SByte) value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, byteValue, + byteValue.GetType()->Name); + } + catch (OverflowException^ e) { + Console::WriteLine("OverflowException: Cannot convert {0}", + value); + } + } +} +// The example displays the following output: +// 78 (Decimal) --> 78 (SByte) +// 78.000 (Decimal) --> 78 (SByte) +// 78.999 (Decimal) --> 78 (SByte) +// OverflowException: Cannot convert 255.999 +// OverflowException: Cannot convert 256 +// 127.999 (Decimal) --> 127 (SByte) +// OverflowException: Cannot convert 128 +// -0.999 (Decimal) --> 0 (SByte) +// -1 (Decimal) --> -1 (SByte) +// -128.999 (Decimal) --> -128 (SByte) +// OverflowException: Cannot convert -129 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp new file mode 100644 index 00000000000..ddfc63d3603 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.decimal.operators.explicit/cpp/tosingle1.cpp @@ -0,0 +1,31 @@ +// +using namespace System; + +void main() +{ + // Define an array of Decimal values. + array^ values = { Decimal::Parse("0.0000000000000000000000000001"), + Decimal::Parse("0.0000000000123456789123456789"), + Decimal::Parse("123"), + Decimal(123000000, 0, 0, false, 6), + Decimal::Parse("123456789.123456789"), + Decimal::Parse("123456789123456789123456789"), + Decimal::MinValue, Decimal::MaxValue }; + // Convert each value to a double. + for each (Decimal value in values) { + float dblValue = (float) value; + Console::WriteLine("{0} ({1}) --> {2} ({3})", value, + value.GetType()->Name, dblValue, + dblValue.GetType()->Name); + } +} +// The example displays the following output: +// 0.0000000000000000000000000001 (Decimal) --> 1E-28 (Single) +// 0.0000000000123456789123456789 (Decimal) --> 1.234568E-11 (Single) +// 123 (Decimal) --> 123 (Single) +// 123.000000 (Decimal) --> 123 (Single) +// 123456789.123456789 (Decimal) --> 1.234568E+08 (Single) +// 123456789123456789123456789 (Decimal) --> 1.234568E+26 (Single) +// -79228162514264337593543950335 (Decimal) --> -7.922816E+28 (Single) +// 79228162514264337593543950335 (Decimal) --> 7.922816E+28 (Single) +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp new file mode 100644 index 00000000000..2e0fc257300 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.diagnostics.tracefilter/cpp/source.cpp @@ -0,0 +1,52 @@ +// +#define TRACE + +#using + +using namespace System; +using namespace System::Diagnostics; + +namespace TestingTracing +{ + // + public ref class ErrorFilter : TraceFilter + { + public: + virtual bool ShouldTrace(TraceEventCache^ cache, String^ source, + TraceEventType eventType, int id, String^ formatOrMessage, + array^ args, Object^ data, array^ dataArray) override + { + return eventType == TraceEventType::Error; + } + }; + // + + ref class TraceTest + { + public: + static void Main() + { + TraceSource^ ts = gcnew TraceSource("TraceTest"); + SourceSwitch^ sourceSwitch = gcnew SourceSwitch("SourceSwitch", "Verbose"); + ts->Switch = sourceSwitch; + ConsoleTraceListener^ ctl = gcnew ConsoleTraceListener(); + ctl->Name = "console"; + ctl->TraceOutputOptions = TraceOptions::DateTime; + ctl->Filter = gcnew ErrorFilter(); + ts->Listeners->Add(ctl); + + ts->TraceEvent(TraceEventType::Warning, 1, "*** This event will be filtered out ***"); + // this event will be get displayed + ts->TraceEvent(TraceEventType::Error, 2, "*** This event will be be displayed ***"); + + ts->Flush(); + ts->Close(); + } + }; +} + +int main() +{ + TestingTracing::TraceTest::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp new file mode 100644 index 00000000000..69b58914b35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp new file mode 100644 index 00000000000..c6836e32db0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// TestDll.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h new file mode 100644 index 00000000000..f3a07375c76 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/stdafx.h @@ -0,0 +1,16 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + + +// TODO: reference additional headers your program requires here diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h new file mode 100644 index 00000000000..87c0086de75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp new file mode 100644 index 00000000000..f2d4821f015 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.cpp @@ -0,0 +1,23 @@ +// TestDll.cpp : Defines the exported functions for the DLL application. +// + +#include "stdafx.h" +#include "TestDll.h" + + +// This is an example of an exported variable +// TESTDLL_API int nTestDll=0; + +// This is an example of an exported function. +//TESTDLL_API int fnTestDll(void) +//{ +// return 42; +//} + +// +__declspec(dllexport) int Double(int number) +{ + return number * 2; +} +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h new file mode 100644 index 00000000000..71f013b09d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.h @@ -0,0 +1,22 @@ +// The following ifdef block is the standard way of creating macros which make exporting +// from a DLL simpler. All files within this DLL are compiled with the TESTDLL_EXPORTS +// symbol defined on the command line. This symbol should not be defined on any project +// that uses this DLL. This way any other project whose source files include this file see +// TESTDLL_API functions as being imported from a DLL, whereas this DLL sees symbols +// defined with this macro as being exported. +#ifdef TESTDLL_EXPORTS +#define TESTDLL_API __declspec(dllexport) +#else +#define TESTDLL_API __declspec(dllimport) +#endif + +// This class is exported from the TestDll.dll +class TESTDLL_API CTestDll { +public: + CTestDll(void); + // TODO: add your methods here. +}; + +extern TESTDLL_API int nTestDll; + +TESTDLL_API int fnTestDll(void); diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj new file mode 100644 index 00000000000..077c9128720 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.entrypointnotfoundexception.class/cpp/testdll.vcxproj @@ -0,0 +1,100 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {FFF28EB8-7F4C-4D3F-B492-C9F17D5CFE1B} + Win32Proj + TestDll + + + + DynamicLibrary + true + Unicode + + + DynamicLibrary + false + true + Unicode + + + + + + + + + + + + + true + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTDLL_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;TESTDLL_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + true + true + + + + + + + + + + + + + false + + + false + + + + + Create + Create + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp new file mode 100644 index 00000000000..94a5f963ddb --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.exception.tostring/cpp/ToStringEx1.cpp @@ -0,0 +1,47 @@ + +// +using namespace System; + +public ref class TestClass{}; + +int main() +{ + TestClass^ test = gcnew TestClass; + array^ objectsToCompare = { test, test->ToString(), 123, + (123).ToString(), "some text", + "Some Text" }; + String^ s = "some text"; + for each (Object^ objectToCompare in objectsToCompare) { + try { + Int32 i = s->CompareTo(objectToCompare); + Console::WriteLine("Comparing '{0}' with '{1}': {2}", + s, objectToCompare, i); + } + catch (ArgumentException^ e) { + Console::WriteLine("Bad argument: {0} (type {1})", + objectToCompare, + objectToCompare->GetType()->Name); + Console::WriteLine("Exception information: {0}", e); + } + Console::WriteLine(); + } +} +// The example displays the following output: +// Bad argument: TestClass (type TestClass) +// Exception information: System.ArgumentException: Object must be of type String. +// at System.String.CompareTo(Object value) +// at Example.Main() +// +// Comparing 'some text' with 'TestClass': -1 +// +// Bad argument: 123 (type Int32) +// Exception information: System.ArgumentException: Object must be of type String. +// at System.String.CompareTo(Object value) +// at Example.Main() +// +// Comparing 'some text' with '123': 1 +// +// Comparing 'some text' with 'some text': 0 +// +// Comparing 'some text' with 'Some Text': -1 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp new file mode 100644 index 00000000000..ed84d371b80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.gc.collect int example/CPP/class1.cpp @@ -0,0 +1,54 @@ + +// +using namespace System; +const long maxGarbage = 1000; +ref class MyGCCollectClass +{ +public: + void MakeSomeGarbage() + { + Version^ vt; + for ( int i = 0; i < maxGarbage; i++ ) + { + + // Create objects and release them to fill up memory + // with unused objects. + vt = gcnew Version; + + } + } + +}; + +int main() +{ + MyGCCollectClass^ myGCCol = gcnew MyGCCollectClass; + + // Determine the maximum number of generations the system + // garbage collector currently supports. + Console::WriteLine( "The highest generation is {0}", GC::MaxGeneration ); + myGCCol->MakeSomeGarbage(); + + // Determine which generation myGCCol object is stored in. + Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); + + // Determine the best available approximation of the number + // of bytes currently allocated in managed memory. + Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); + + // Perform a collection of generation 0 only. + GC::Collect( 0 ); + + // Determine which generation myGCCol object is stored in. + Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); + Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); + + // Perform a collection of all generations up to and including 2. + GC::Collect( 2 ); + + // Determine which generation myGCCol object is stored in. + Console::WriteLine( "Generation: {0}", GC::GetGeneration( myGCCol ) ); + Console::WriteLine( "Total Memory: {0}", GC::GetTotalMemory( false ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp new file mode 100644 index 00000000000..b8f17f0074a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.int32.maxvalue/cpp/maxvalue1.cpp @@ -0,0 +1,29 @@ +// +using namespace System; + +void main() +{ + array^ numbersToConvert = gcnew array { 162345, 32183, -54000, + Int64::MaxValue/2 }; + Int32 newNumber; + for each (Int64 number in numbersToConvert) + { + if ((number >= Int32::MinValue) && (number <= Int32::MaxValue)) + { + newNumber = Convert::ToInt32(number); + Console::WriteLine("Successfully converted {0} to an Int32.", + newNumber); + } + else + { + Console::WriteLine("Unable to convert {0} to an Int32.", number); + } + } +} +// The example displays the following output to the console: +// Successfully converted 162345 to an Int32. +// Successfully converted 32183 to an Int32. +// Successfully converted -54000 to an Int32. +// Unable to convert 4611686018427387903 to an Int32. +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp new file mode 100644 index 00000000000..c6b41982d9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.intptr/cpp/topointer.cpp @@ -0,0 +1,55 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +class NotTooSafeStringReverse +{ +public: + static void Main() + { + String^ stringA = "I seem to be turned around!"; + int copylen = stringA->Length; + + // Allocate HGlobal memory for source and destination strings + IntPtr sptr = Marshal::StringToHGlobalAnsi(stringA); + IntPtr dptr = Marshal::AllocHGlobal(copylen + 1); + + char *src = (char *)sptr.ToPointer(); + char *dst = (char *)dptr.ToPointer(); + + if (copylen > 0) + { + // set the source pointer to the end of the string + // to do a reverse copy. + src += copylen - 1; + + while (copylen-- > 0) + { + *dst++ = *src--; + } + *dst = 0; + } + String^ stringB = Marshal::PtrToStringAnsi(dptr); + + Console::WriteLine("Original:\n{0}\n", stringA); + Console::WriteLine("Reversed:\n{0}", stringB); + + // Free HGlobal memory + Marshal::FreeHGlobal(dptr); + Marshal::FreeHGlobal(sptr); + } +}; + +int main() +{ + NotTooSafeStringReverse::Main(); +} + +// The progam has the following output: +// +// Original: +// I seem to be turned around! +// +// Reversed: +// !dnuora denrut eb ot mees I +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp new file mode 100644 index 00000000000..40f37b3e60b --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.io.pipes.pipestream/cpp/sample.cpp @@ -0,0 +1,98 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::IO::Pipes; +using namespace System::Diagnostics; + +ref class PipeStreamExample +{ +private: + static array^ matchSign = {9, 0, 9, 0}; + +public: + static void Main() + { + array^ args = Environment::GetCommandLineArgs(); + if (args->Length < 2) + { + Process^ clientProcess = gcnew Process(); + + clientProcess->StartInfo->FileName = Environment::CommandLine; + + AnonymousPipeServerStream^ pipeServer = + gcnew AnonymousPipeServerStream(PipeDirection::In, + HandleInheritability::Inheritable); + // Pass the client process a handle to the server. + clientProcess->StartInfo->Arguments = pipeServer->GetClientHandleAsString(); + clientProcess->StartInfo->UseShellExecute = false; + Console::WriteLine("[SERVER] Starting client process..."); + clientProcess->Start(); + + pipeServer->DisposeLocalCopyOfClientHandle(); + + try + { + if (WaitForClientSign(pipeServer)) + { + Console::WriteLine("[SERVER] Valid sign code received!"); + } + else + { + Console::WriteLine("[SERVER] Invalid sign code received!"); + } + } + catch (IOException^ e) + { + Console::WriteLine("[SERVER] Error: {0}", e->Message); + } + clientProcess->WaitForExit(); + clientProcess->Close(); + Console::WriteLine("[SERVER] Client quit. Server terminating."); + } + else + { + PipeStream^ pipeClient = + gcnew AnonymousPipeClientStream(PipeDirection::Out, args[1]); + try + { + Console::WriteLine("[CLIENT] Sending sign code..."); + SendClientSign(pipeClient); + } + catch (IOException^ e) + { + Console::WriteLine("[CLIENT] Error: {0}", e->Message); + } + Console::WriteLine("[CLIENT] Terminating."); + } + } + + // +private: + static bool WaitForClientSign(PipeStream^ inStream) + { + array^ inSign = gcnew array(matchSign->Length); + int len = inStream->Read(inSign, 0, matchSign->Length); + bool valid = len == matchSign->Length; + + while (valid && len-- > 0) + { + valid = valid && (matchSign[len] == inSign[len]); + } + return valid; + } + // + + static void SendClientSign(PipeStream^ outStream) + { + outStream->Write(matchSign, 0, matchSign->Length); + } +}; + +int main() +{ + PipeStreamExample::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp new file mode 100644 index 00000000000..e08099e7418 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.nullableOfT.class/cpp/tarow.cpp @@ -0,0 +1,80 @@ +// +using namespace System; + +// Define the "titleAuthor" table of the Microsoft "pubs" database. +value struct titleAuthor +{ + public: + // Author ID; format ###-##-#### + String^ au_id; + // Title ID; format AA#### + String^ title_id; + // Author ORD is nullable. + Nullable au_ord; + // Royalty Percent is nullable. + Nullable royaltyper; + + // Display the values of the titleAuthor array elements. + static void Display(String^ dspTitle, + array^ dspAllTitleAuthors) + { + Console::WriteLine("*** {0} ***", dspTitle); + for each (titleAuthor dspTA in dspAllTitleAuthors) { + Console::WriteLine("Author ID ... {0}", dspTA.au_id); + Console::WriteLine("Title ID .... {0}", dspTA.title_id); + Console::WriteLine("Author ORD .. {0}", dspTA.au_ord.HasValue ? + dspTA.au_ord.Value : -1); + Console::WriteLine("Royalty % ... {0}", dspTA.royaltyper.HasValue ? + dspTA.royaltyper.Value : 0); + Console::WriteLine(); + } + } +}; + +void main() +{ + // Declare and initialize the titleAuthor array. + array^ ta = gcnew array(3); + ta[0].au_id = "712-32-1176"; + ta[0].title_id = "PS3333"; + ta[0].au_ord = 1; + ta[0].royaltyper = 100; + + ta[1].au_id = "213-46-8915"; + ta[1].title_id = "BU1032"; +// ta[1].au_ord = nullptr; +// ta[1].royaltyper = nullptr; + + ta[2].au_id = "672-71-3249"; + ta[2].title_id = "TC7777"; +// ta[2].au_ord = nullptr; + ta[2].royaltyper = 40; + + // Display the values of the array elements, and + // display a legend. + titleAuthor::Display("Title Authors Table", ta); + Console::WriteLine("Legend:"); + Console::WriteLine("An Author ORD of -1 means no value is defined."); + Console::WriteLine("A Royalty % of 0 means no value is defined."); +} +// The example displays the following output: +// *** Title Authors Table *** +// Author ID ... 712-32-1176 +// Title ID .... PS3333 +// Author ORD .. 1 +// Royalty % ... 100 +// +// Author ID ... 213-46-8915 +// Title ID .... BU1032 +// Author ORD .. -1 +// Royalty % ... 0 +// +// Author ID ... 672-71-3249 +// Title ID .... TC7777 +// Author ORD .. -1 +// Royalty % ... 40 +// +// Legend: +// An Author ORD of -1 means no value is defined. +// A Royalty % of 0 means no value is defined. +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp new file mode 100644 index 00000000000..aed41164638 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring1.cpp @@ -0,0 +1,11 @@ +// +using namespace System; + +void main() +{ + Object^ obj = gcnew Object(); + Console::WriteLine(obj->ToString()); +} +// The example displays the following output: +// System.Object +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp new file mode 100644 index 00000000000..555db31ba29 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring2.cpp @@ -0,0 +1,18 @@ +// +using namespace System; + +namespace Examples +{ + ref class Object1 + { + }; +} + +void main() +{ + Object^ obj1 = gcnew Examples::Object1(); + Console::WriteLine(obj1->ToString()); +} +// The example displays the following output: +// Examples.Object1 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp new file mode 100644 index 00000000000..874d33085c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.object.tostring/cpp/tostring3.cpp @@ -0,0 +1,29 @@ +// +using namespace System; + +ref class Object2 +{ + private: + Object^ value; + + public: + Object2(Object^ value) + { + this->value = value; + } + + virtual String^ ToString() override + { + return Object::ToString() + ": " + value->ToString(); + } +}; + +void main() +{ + Object2^ obj2 = gcnew Object2(L'a'); + Console::WriteLine(obj2->ToString()); + +} +// The example displays the following output: +// Object2: a +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp new file mode 100644 index 00000000000..f2ad3ec6d43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.assembly.getexecutingassembly/cpp/getexecutingassembly1.cpp @@ -0,0 +1,32 @@ +// +using namespace System; +using namespace System::Reflection; + +ref class Example +{}; + +void main() +{ + // Get the assembly from a known type in that assembly. + Type^ t = Example::typeid; + Assembly^ assemFromType = t->Assembly; + Console::WriteLine("Assembly that contains Example:"); + Console::WriteLine(" {0}\n", assemFromType->FullName); + + // Get the currently executing assembly. + Assembly^ currentAssem = Assembly::GetExecutingAssembly(); + Console::WriteLine("Currently executing assembly:"); + Console::WriteLine(" {0}\n", currentAssem->FullName); + + Console::WriteLine("The two Assembly objects are equal: {0}", + assemFromType->Equals(currentAssem)); +} +// The example displays the following output: +// Assembly that contains Example: +// GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +// +// Currently executing assembly: +// GetExecutingAssembly1, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null +// +// The two Assembly objects are equal: True +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp new file mode 100644 index 00000000000..31f5e221cac --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.emit.typebuilder.makegenerictype/cpp/remarks.cpp @@ -0,0 +1,43 @@ + +using namespace System; +using namespace System::Reflection; +using namespace System::Reflection::Emit; + +public ref class CompareGenericTypes +{ +public: + static void Main() + { + try + { + AppDomain^ currentDomain = AppDomain::CurrentDomain; + + AssemblyName^ aName = gcnew AssemblyName("TempAssembly"); + AssemblyBuilder^ ab = currentDomain->DefineDynamicAssembly(aName, AssemblyBuilderAccess::Run); + + ModuleBuilder^ mb = ab->DefineDynamicModule(aName->Name); + + TypeBuilder^ tbldr = mb->DefineType("MyNewType", TypeAttributes::Public); + tbldr->DefineGenericParameters("T"); + // + Type^ t1 = tbldr->MakeGenericType(String::typeid); + Type^ t2 = tbldr->MakeGenericType(String::typeid); + bool result = t1->Equals(t2); + // + Console::WriteLine("Types t1 and t2 match: {0:s}", result ? "Yes" : "No"); + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + Console::WriteLine(ex->StackTrace); + } + } +}; + +int main() +{ + CompareGenericTypes::Main(); +} + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp new file mode 100644 index 00000000000..7f81c1fa446 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.fieldattributes/cpp/remarks.cpp @@ -0,0 +1,32 @@ + +using namespace System; +using namespace System::Reflection; + +public ref class FieldAttribTest +{ +public: + static int field1 = 99; + + static void Main() + { + Object^ obj = gcnew FieldAttribTest(); + + // + FieldInfo^ fi = obj->GetType()->GetField("field1"); + + if ((fi->Attributes & FieldAttributes::FieldAccessMask) == + FieldAttributes::Public) + { + Console::WriteLine("{0:s} is public. Value: {1:d}", fi->Name, fi->GetValue(obj)); + } + // + } +}; + +int main() +{ + FieldAttribTest::Main(); +} + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp new file mode 100644 index 00000000000..588767ccad5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.reflection.parametermodifier/cpp/source.cpp @@ -0,0 +1,46 @@ + +using namespace System; +using namespace System::Reflection; + +public ref class ParmInfoTest +{ +public: + static void Main() + { + Object^ obj = gcnew ParmInfoTest; + + // + // Create an array containing the arguments. + array^ args = {"Argument 1", "Argument 2", "Argument 3" }; + + // Initialize a ParameterModifier with the number of parameters. + ParameterModifier p = ParameterModifier(3); + + // Pass the first and third parameters by reference. + p[0] = true; + p[2] = true; + + // The ParameterModifier must be passed as the single element + // of an array. + + array^ mods = { p }; + + // Invoke the method late bound. + obj->GetType()->InvokeMember("MethodName", BindingFlags::InvokeMethod, + nullptr, obj, args, mods, nullptr, nullptr); + // + } + + void MethodName(String^% str1, String^ str2, String^% str3) + { + Console::WriteLine("Called 'MethodName'"); + } +}; + +int main() +{ + ParmInfoTest::Main(); +} + + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp new file mode 100644 index 00000000000..64c01acb0e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend1.cpp @@ -0,0 +1,39 @@ +using namespace System; + +ref class FileUtilities +{ + public: + static String^ AppendDirectorySeparator(String^ dir) + { + if (!dir->Trim()->EndsWith(System::IO::Path::DirectorySeparatorChar.ToString())) + return dir->Trim() + System::IO::Path::DirectorySeparatorChar; + else + return dir; + } +}; + + +// +// +// The assembly that exposes its internal types to this assembly should be +// named Assembly1.dll. +// +// The public key of this assembly should correspond to the public key +// specified in the class constructor of the InternalsVisibleTo attribute in the +// Assembly1 assembly. +// +#using as_friend + +using namespace System; + +void main() +{ + String^ dir = L"C:\\Program Files"; + dir = FileUtilities::AppendDirectorySeparator(dir); + Console::WriteLine(dir); +} +// The example displays the following output: +// C:\Program Files\ +// + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp new file mode 100644 index 00000000000..d98516de040 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.compilerservices.internalsvisibletoattribute/cpp/friend2.cpp @@ -0,0 +1,12 @@ +// +#using as_friend + +using namespace System; +using namespace Utilities::StringUtilities; + +void main() +{ + String^ s = "The Sign of the Four"; + Console::WriteLine(StringLib::IsFirstLetterUpperCase(s)); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp new file mode 100644 index 00000000000..d7d17f47f53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.bestfitmappingattribute/cpp/source.cpp @@ -0,0 +1,23 @@ +using namespace System; +using namespace System::Runtime::InteropServices; + +// +[BestFitMapping(false, ThrowOnUnmappableChar = true)] +interface class IMyInterface1 +{ + //Insert code here. +}; +// + +public ref class InteropBFMA : IMyInterface1 +{ +}; + + +int main() +{ + InteropBFMA^ bfma = gcnew InteropBFMA(); + + Console::WriteLine(bfma->GetType()->GetInterfaces()[0]->Name); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp new file mode 100644 index 00000000000..13ef0dc79f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.charset/cpp/source.cpp @@ -0,0 +1,18 @@ +using namespace System; +using namespace System::Runtime::InteropServices; + +// +[StructLayout(LayoutKind::Sequential, CharSet=CharSet::Ansi)] +public ref struct MyPerson +{ +public: + String^ first; + String^ last; +}; +// + + +int main() +{ + +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp new file mode 100644 index 00000000000..75c699ead3d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.comcompatibleversionattribute/cpp/source.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +[assembly: AssemblyVersion("3.0.0.0")]; +[assembly: ComCompatibleVersion(1,0,0,0)]; +namespace MyNamespace +{ + public ref class TheClass + { + // Insert code. + }; +}; +// + + +int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp new file mode 100644 index 00000000000..d6d0e897418 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dispatchwrapper/cpp/source.cpp @@ -0,0 +1,34 @@ +using namespace System; +using namespace System::Runtime::InteropServices; + +// +// Some interface +// +[Guid("1F948D8D-D9ED-4CCC-BB61-5C1730E39EE9"), +InterfaceType(ComInterfaceType::InterfaceIsDual)] +public interface class ISomeIFace +{ +}; + +public ref class MyObject : public ISomeIFace +{ +}; + +class DispatchWrapperTest +{ +public: + // + void MyMethod(Object^ o); + + void DoWrap() + { + Object^ o = gcnew MyObject(); + MyMethod(o); // passes o as VT_UNKNOWN + MyMethod(gcnew DispatchWrapper(o)); // passes o as VT_DISPATCH + + //... + } + // +}; + +int main() {} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp new file mode 100644 index 00000000000..aefdd15e3e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.dllimportattribute/cpp/source.cpp @@ -0,0 +1,62 @@ +// +using namespace System; +using namespace System::Runtime::InteropServices; + +private ref class NativeMethods +{ + // Managed class methods don't support varargs so all arguments must be + // explicitly defined. CallingConvention.Cdecl must be used since the + // stack is cleaned up by the caller. + // int printf(const char *format [, argument]...) +public: + [DllImport("msvcrt.dll", CharSet = CharSet::Ansi, + CallingConvention = CallingConvention::Cdecl)] + static int printf(String^ format, int i, double d); + + [DllImport("msvcrt.dll", CharSet = CharSet::Ansi, + CallingConvention = CallingConvention::Cdecl)] + static int printf(String^ format, int i, String^ s); +}; + +void main() +{ + NativeMethods::printf("\nPrint params: %i %f", 99, 99.99); + NativeMethods::printf("\nPrint params: %i %s", 99, "abcd"); +} +// + +// +[DllImport("unmanaged.dll, MyAssembly, Version= 1.0.0.0," + "Culture=neutral, PublicKeyToken=a77e0ba5eab10125")] +int SomeFuncion1(int parm); +// + +// +[DllImport("My.dll", CharSet = CharSet::Ansi, + BestFitMapping = false, + ThrowOnUnmappableChar = true)] +int SomeFuncion2(int parm); +// + +[DllImport("msvcrt.dll", CharSet = CharSet::Ansi, + CallingConvention = CallingConvention::Cdecl)] +int printf(String^ format, ...); + + +namespace znippet4 +{ + // + [DllImport("user32.dll", CharSet = CharSet::Ansi, ExactSpelling = true)] + int MessageBoxA(IntPtr hWnd, String^ Text, + String^ Caption, unsigned int Type); + // +} + +namespace znippet5 +{ + // + [DllImport("user32.dll", SetLastError = true)] + int MessageBoxA(IntPtr hWnd, String^ Text, + String^ Caption, unsigned int Type); + // +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp new file mode 100644 index 00000000000..dcb414f56c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.runtime.interopservices.typelibversionattribute/cpp/source.cpp @@ -0,0 +1,18 @@ +// +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; + +[assembly: AssemblyVersion("1.2.500.0")]; +[assembly: TypeLibVersion(1,25)]; +namespace MyNamespace +{ + public ref class TheClass + { + // Insert code. + }; +}; +// + + +int main() {} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp new file mode 100644 index 00000000000..9bb50f4bd80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.security.cryptography.symmetricalgorithm/cpp/encryptor.cpp @@ -0,0 +1,54 @@ +// +using namespace System; +using namespace System::Security::Cryptography; +using namespace System::Text; + +class EncryptorExample +{ +public: + static void Main() + { + TripleDESCryptoServiceProvider^ tdesCSP = gcnew TripleDESCryptoServiceProvider(); + + tdesCSP->GenerateKey(); + tdesCSP->GenerateIV(); + String^ quote = + "Things may come to those who wait, but only the " + + "things left by those who hustle. -- Abraham Lincoln"; + array^ encQuote = EncryptString(tdesCSP, quote); + + Console::WriteLine("Encrypted Quote:\n"); + Console::WriteLine(Convert::ToBase64String(encQuote)); + + Console::WriteLine("\nDecrypted Quote:\n"); + Console::WriteLine(DecryptBytes(tdesCSP, encQuote)); + } + + // +public: + static array^ EncryptString(SymmetricAlgorithm^ symAlg, String^ inString) + { + array^ inBlock = UnicodeEncoding::Unicode->GetBytes(inString); + ICryptoTransform^ xfrm = symAlg->CreateEncryptor(); + array^ outBlock = xfrm->TransformFinalBlock(inBlock, 0, inBlock->Length); + + return outBlock; + } + // + + // + static String^ DecryptBytes(SymmetricAlgorithm^ symAlg, array^ inBytes) + { + ICryptoTransform^ xfrm = symAlg->CreateDecryptor(); + array^ outBlock = xfrm->TransformFinalBlock(inBytes, 0, inBytes->Length); + + return UnicodeEncoding::Unicode->GetString(outBlock); + } + // +}; + +int main() +{ + EncryptorExample::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp new file mode 100644 index 00000000000..bb909af8192 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.security.permissions.principalpermission/cpp/remarks.cpp @@ -0,0 +1,39 @@ + +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Security::Policy; + +public ref class PrincipalPermTest +{ +public: + void Dummy1() + { + // + PrincipalPermission^ ppBob = gcnew PrincipalPermission("Bob", "Administrator"); + PrincipalPermission^ ppLouise = gcnew PrincipalPermission("Louise", "Administrator"); + IPermission^ pp1 = ppBob->Intersect(ppLouise); + // + } + + void Dummy2() + { + // + IPermission^ pp1 = gcnew PrincipalPermission("", "Administrator"); + // + } + + void Dummy3() + { + // + PrincipalPermission^ ppBob = gcnew PrincipalPermission("Bob", "Administrator"); + PrincipalPermission^ ppLouise = gcnew PrincipalPermission("Louise", "Administrator"); + // + } +}; + + +int main() +{ + +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp new file mode 100644 index 00000000000..80d78080d26 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.security.securestring.ctor2/cpp/ctor1.cpp @@ -0,0 +1,23 @@ +// +using namespace System; +using namespace System::Security; + +int main(array ^args) +{ + SecureString^ testString; + // Define the string value to assign to a new secure string. + Char chars[4] = { 't', 'e', 's', 't' }; + // Instantiate a new secure string. + Char* pChars = &chars[0]; + + testString = gcnew SecureString(pChars, sizeof(chars)/sizeof(chars[0])); + + // Display secure string length. + Console::WriteLine("The length of the string is {0} characters.", + testString->Length); + delete testString; + return 0; +} +// The example displays the following output: +// The length of the string is 4 characters. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp new file mode 100644 index 00000000000..7ff6cd67159 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.security.securityelement/cpp/remarks.cpp @@ -0,0 +1,44 @@ + +using namespace System; +using namespace System::Security; + + +public ref class SecurityElementTest +{ +private: + SecurityElement^ xmlRootElement; + +public: + SecurityElementTest() + { + xmlRootElement = gcnew SecurityElement("thetag", " "); + + xmlRootElement->AddAttribute("a", "123"); + xmlRootElement->AddAttribute("b", "456"); + xmlRootElement->AddAttribute("c", "789"); + + xmlRootElement->AddChild(gcnew SecurityElement("first", "text1")); + xmlRootElement->AddChild(gcnew SecurityElement("second", "text2")); + } + + // + String^ SearchForTextOfTag(String^ tag) + { + SecurityElement^ element = this->SearchForChildByTag(tag); + return element->Text; + } + // + +private: + SecurityElement^ SearchForChildByTag(String^ tag) + { + return xmlRootElement->SearchForChildByTag(tag); + } +}; + +int main() +{ + SecurityElementTest^ seTest = gcnew SecurityElementTest(); + + Console::WriteLine("Found the text for : " + seTest->SearchForTextOfTag("second")); +} diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp new file mode 100644 index 00000000000..2f65db80fc4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.concat/cpp/Concat6.cpp @@ -0,0 +1,15 @@ +// +using namespace System; + +void main() +{ + String^ s1 = "We went to a bookstore, "; + String^ s2 = "a movie, "; + String^ s3 = "and a restaurant."; + + String^ s = String::Concat(s1, s2, s3); + Console::WriteLine(s); +} +// The example displays the following output: +// We went to a bookstore, a movie, and a restaurant. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp new file mode 100644 index 00000000000..013c216996e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/assignment.cpp @@ -0,0 +1,18 @@ +// Assignment.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" +// +using namespace System; + +void main() +{ + String^ value1 = L"This is a string."; + String^ value2 = value1; + Console::WriteLine(value1); + Console::WriteLine(value2); +} +// The example displays the following output: +// This is a string. +// This is a string. +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp new file mode 100644 index 00000000000..a5ea741588d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char1_ctor.cpp @@ -0,0 +1,20 @@ +// Char1_Ctor.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + +void main() +{ + wchar_t characters[] = {L'H',L'e',L'l',L'l',L'o',L' ', + L'W',L'o',L'r',L'l',L'd',L'!',L'\x0000'}; + + Char* charPtr = characters; + String^ value = gcnew String(charPtr); + Console::WriteLine(value); +} +// The example displays the following output: +// Hello world! +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp new file mode 100644 index 00000000000..94226ba6f8d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/char2_ctor.cpp @@ -0,0 +1,32 @@ +// Char2_Ctor.cpp : Defines the entry point for the console application. +// + +//#include "stdafx.h" + +// +using namespace System; + + +void main() +{ + wchar_t characters[] = {L'H',L'e',L'l',L'l',L'o',L' ', + L'W',L'o',L'r',L'l',L'd',L'!',L'\x0000'}; + + Char* charPtr = characters; + int length = 0; + Char* iterator = charPtr; + + while (*iterator != '\x0000') + { + if (*iterator == L'!' || *iterator == L'.') + break; + *iterator++; + length++; + } + String^ value = gcnew String(charPtr, 0, length); + Console::WriteLine(value); +} +// The example displays the following output: +// Hello World +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp new file mode 100644 index 00000000000..312c24bbe53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/chptrctor_null.cpp @@ -0,0 +1,24 @@ +// +using namespace System; + +void main() +{ + wchar_t chars[] = { L'a', L'b', L'c', L'd', L'\0', L'A', L'B', + L'C', L'D', L'\0' }; + Char* chPtr = chars; + String^ s = gcnew String(chPtr, 0, + sizeof(chars) / sizeof (wchar_t)); + for each (Char ch in s) + Console::Write("{0:X4} ", Convert::ToUInt16(ch)); + Console::WriteLine(); + + s = gcnew String(chPtr); + + for each (Char ch in s) + Console::Write("{0:X4} ", Convert::ToUInt16(ch)); + Console::WriteLine(); +} +// The example displays the following output: +// 0061 0062 0063 0064 0000 0041 0042 0043 0044 0000 +// 0061 0062 0063 0064 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp new file mode 100644 index 00000000000..3116bd1e648 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.ctor/cpp/ptrctor_null.cpp @@ -0,0 +1,27 @@ +// +using namespace System; + +void main() +{ + char bytes[] = { 0x61, 0x62, 0x063, 0x064, 0x00, 0x41, 0x42,0x43, + 0x44, 0x00 }; + + char* bytePtr = bytes; + String^ s = gcnew String(bytePtr, 0, sizeof(bytes) / sizeof (char)); + + for each (Char ch in s) + Console::Write("{0:X4} ", Convert::ToUInt16(ch)); + + Console::WriteLine(); + + s = gcnew String(bytePtr); + + for each (Char ch in s) + Console::Write("{0:X4} ", Convert::ToUInt16(ch)); + Console::WriteLine(); +} +// The example displays the following output: +// 0061 0062 0063 0064 0000 0041 0042 0043 0044 0000 +// 0061 0062 0063 0064 +// + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp new file mode 100644 index 00000000000..7902bf7169d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/NullString1.cpp @@ -0,0 +1,32 @@ +// +using namespace System; + +void main() +{ + String^ s; + + Console::WriteLine("The value of the string is '{0}'", s); + + try { + Console::WriteLine("String length is {0}", s->Length); + } + catch (NullReferenceException^ e) { + Console::WriteLine(e->Message); + } +} +// The example displays the following output: +// The value of the string is '' +// Object reference not set to an instance of an object. +// + +void Test() +{ + // + String^ s = ""; + Console::WriteLine("The length of '{0}' is {1}.", s, s->Length); + // The example displays the following output: + // The length of '' is 0. + // +} + + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp new file mode 100644 index 00000000000..f7d1b9f1579 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.isnullorempty/cpp/isnullorempty1.cpp @@ -0,0 +1,18 @@ +using namespace System; + +bool Test( String^ s ) +{ + bool result; + // + result = s == nullptr || s == String::Empty; + // + return result; +} + +int main() +{ + String^ s1; + String^ s2 = ""; + Console::WriteLine( "String s1 {0}.", Test( s1 ) ); + Console::WriteLine( "String s2 {0}.", Test( s2 ) ); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp new file mode 100644 index 00000000000..c61179db48d --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/StartsWith2.cpp @@ -0,0 +1,23 @@ +// +using namespace System; + +void main() +{ + String^ title = "The House of the Seven Gables"; + String^ searchString = "the"; + StringComparison comparison = StringComparison::InvariantCulture; + Console::WriteLine("'{0}':", title); + Console::WriteLine(" Starts with '{0}' ({1:G} comparison): {2}", + searchString, comparison, + title->StartsWith(searchString, comparison)); + + comparison = StringComparison::InvariantCultureIgnoreCase; + Console::WriteLine(" Starts with '{0}' ({1:G} comparison): {2}", + searchString, comparison, + title->StartsWith(searchString, comparison)); + } +// The example displays the following output: +// 'The House of the Seven Gables': +// Starts with 'the' (InvariantCulture comparison): False +// Starts with 'the' (InvariantCultureIgnoreCase comparison): True +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp new file mode 100644 index 00000000000..efd8df82bf8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.string.startswith/cpp/startswith1.cpp @@ -0,0 +1,54 @@ +// +using namespace System; + +void main() +{ + array^ strings = gcnew array { {"ABCdef", "abc" }, + {"ABCdef", "abc" }, {"Å“il","oe" }, + { "læring}", "lae" } }; + for (int ctr1 = strings->GetLowerBound(0); ctr1 <= strings->GetUpperBound(0); ctr1++) + { + for each (String^ cmpName in Enum::GetNames(StringComparison::typeid)) + { + StringComparison strCmp = (StringComparison) Enum::Parse(StringComparison::typeid, + cmpName); + String^ instance = strings[ctr1, 0]; + String^ value = strings[ctr1, 1]; + Console::WriteLine("{0} starts with {1}: {2} ({3} comparison)", + instance, value, + instance->StartsWith(value, strCmp), + strCmp); + } + Console::WriteLine(); + } +} + +// The example displays the following output: +// ABCdef starts with abc: False (CurrentCulture comparison) +// ABCdef starts with abc: True (CurrentCultureIgnoreCase comparison) +// ABCdef starts with abc: False (InvariantCulture comparison) +// ABCdef starts with abc: True (InvariantCultureIgnoreCase comparison) +// ABCdef starts with abc: False (Ordinal comparison) +// ABCdef starts with abc: True (OrdinalIgnoreCase comparison) +// +// ABCdef starts with abc: False (CurrentCulture comparison) +// ABCdef starts with abc: True (CurrentCultureIgnoreCase comparison) +// ABCdef starts with abc: False (InvariantCulture comparison) +// ABCdef starts with abc: True (InvariantCultureIgnoreCase comparison) +// ABCdef starts with abc: False (Ordinal comparison) +// ABCdef starts with abc: True (OrdinalIgnoreCase comparison) +// +// Å“il starts with oe: True (CurrentCulture comparison) +// Å“il starts with oe: True (CurrentCultureIgnoreCase comparison) +// Å“il starts with oe: True (InvariantCulture comparison) +// Å“il starts with oe: True (InvariantCultureIgnoreCase comparison) +// Å“il starts with oe: False (Ordinal comparison) +// Å“il starts with oe: False (OrdinalIgnoreCase comparison) +// +// læring} starts with lae: True (CurrentCulture comparison) +// læring} starts with lae: True (CurrentCultureIgnoreCase comparison) +// læring} starts with lae: True (InvariantCulture comparison) +// læring} starts with lae: True (InvariantCultureIgnoreCase comparison) +// læring} starts with lae: False (Ordinal comparison) +// læring} starts with lae: False (OrdinalIgnoreCase comparison) +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp new file mode 100644 index 00000000000..e378abfd947 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.text.regularexpressions.MatchEvaluator/CPP/regexreplace.cpp @@ -0,0 +1,49 @@ + + +// +#using + +using namespace System; +using namespace System::Text::RegularExpressions; +ref class MyClass +{ +public: + static int i = 0; + static String^ ReplaceCC( Match^ m ) + { + + // Replace each Regex cc match with the number of the occurrence. + i++; + return i.ToString(); + } + +}; + +int main() +{ + String^ sInput; + String^ sRegex; + + // The string to search. + sInput = "aabbccddeeffcccgghhcccciijjcccckkcc"; + + // A very simple regular expression. + sRegex = "cc"; + Regex^ r = gcnew Regex( sRegex ); + + // Assign the replace method to the MatchEvaluator delegate. + MatchEvaluator^ myEvaluator = gcnew MatchEvaluator( &MyClass::ReplaceCC ); + + // Write out the original string. + Console::WriteLine( sInput ); + + // Replace matched characters using the delegate method. + sInput = r->Replace( sInput, myEvaluator ); + + // Write out the modified string. + Console::WriteLine( sInput ); +} +// The example displays the following output: +// aabbccddeeffcccgghhcccciijjcccckkcc +// aabb11ddeeff22cgghh3344iijj5566kk77 +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp new file mode 100644 index 00000000000..8cee8672a42 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.threading.thread.threadstate/cpp/source.cpp @@ -0,0 +1,36 @@ + +// +using namespace System; +using namespace System::Threading; + +// ref class ApartmentTest +// { +// public: + static void ThreadMethod() + { + Thread::Sleep( 1000 ); +// } + +}; + +int main() +{ +// Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ApartmentTest::ThreadMethod ) ); + Thread^ newThread = gcnew Thread( gcnew ThreadStart( &ThreadMethod ) ); + + Console::WriteLine("ThreadState: {0}", newThread->ThreadState); + newThread->Start(); + + // Wait for newThread to start and go to sleep. + Thread::Sleep(300); + Console::WriteLine("ThreadState: {0}", newThread->ThreadState); + + // Wait for newThread to restart. + Thread::Sleep(1000); + Console::WriteLine("ThreadState: {0}", newThread->ThreadState); +} +// The example displays the following output: +// ThreadState: Unstarted +// ThreadState: WaitSleepJoin +// ThreadState: Stopped +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp new file mode 100644 index 00000000000..857931694b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.threading.waithandle.waitone4/cpp/source.cpp @@ -0,0 +1,102 @@ +// +using namespace System; +using namespace System::Threading; +using namespace System::Runtime::Remoting::Contexts; + +[Synchronization(true)] +public ref class SyncingClass : ContextBoundObject +{ +private: + EventWaitHandle^ waitHandle; + +public: + SyncingClass() + { + waitHandle = + gcnew EventWaitHandle(false, EventResetMode::ManualReset); + } + + void Signal() + { + Console::WriteLine("Thread[{0:d4}]: Signalling...", Thread::CurrentThread->GetHashCode()); + waitHandle->Set(); + } + + void DoWait(bool leaveContext) + { + bool signalled; + + waitHandle->Reset(); + Console::WriteLine("Thread[{0:d4}]: Waiting...", Thread::CurrentThread->GetHashCode()); + signalled = waitHandle->WaitOne(3000, leaveContext); + if (signalled) + { + Console::WriteLine("Thread[{0:d4}]: Wait released!!!", Thread::CurrentThread->GetHashCode()); + } + else + { + Console::WriteLine("Thread[{0:d4}]: Wait timeout!!!", Thread::CurrentThread->GetHashCode()); + } + } +}; + +public ref class TestSyncDomainWait +{ +public: + static void Main() + { + SyncingClass^ syncClass = gcnew SyncingClass(); + + Thread^ runWaiter; + + Console::WriteLine("\nWait and signal INSIDE synchronization domain:\n"); + runWaiter = gcnew Thread(gcnew ParameterizedThreadStart(&TestSyncDomainWait::RunWaitKeepContext)); + runWaiter->Start(syncClass); + Thread::Sleep(1000); + Console::WriteLine("Thread[{0:d4}]: Signal...", Thread::CurrentThread->GetHashCode()); + // This call to Signal will block until the timeout in DoWait expires. + syncClass->Signal(); + runWaiter->Join(); + + Console::WriteLine("\nWait and signal OUTSIDE synchronization domain:\n"); + runWaiter = gcnew Thread(gcnew ParameterizedThreadStart(&TestSyncDomainWait::RunWaitLeaveContext)); + runWaiter->Start(syncClass); + Thread::Sleep(1000); + Console::WriteLine("Thread[{0:d4}]: Signal...", Thread::CurrentThread->GetHashCode()); + // This call to Signal is unblocked and will set the wait handle to + // release the waiting thread. + syncClass->Signal(); + runWaiter->Join(); + } + + static void RunWaitKeepContext(Object^ parm) + { + ((SyncingClass^)parm)->DoWait(false); + } + + static void RunWaitLeaveContext(Object^ parm) + { + ((SyncingClass^)parm)->DoWait(true); + } +}; + +int main() +{ + TestSyncDomainWait::Main(); +} +// The output for the example program will be similar to the following: +// +// Wait and signal INSIDE synchronization domain: +// +// Thread[0004]: Waiting... +// Thread[0001]: Signal... +// Thread[0004]: Wait timeout!!! +// Thread[0001]: Signalling... +// +// Wait and signal OUTSIDE synchronization domain: +// +// Thread[0006]: Waiting... +// Thread[0001]: Signal... +// Thread[0001]: Signalling... +// Thread[0006]: Wait released!!! +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp new file mode 100644 index 00000000000..84663c2d1bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.timers.timer/cpp/timer1.cpp @@ -0,0 +1,49 @@ +// +using namespace System; +using namespace System::Timers; + +public ref class Example +{ +private: + static System::Timers::Timer^ aTimer; + +public: + static void Demo() + { + // Create a timer and set a two second interval. + aTimer = gcnew System::Timers::Timer(); + aTimer->Interval = 2000; + + // Hook up the Elapsed event for the timer. + aTimer->Elapsed += gcnew System::Timers::ElapsedEventHandler(Example::OnTimedEvent); + + // Have the timer fire repeated events (true is the default) + aTimer->AutoReset = true; + + // Start the timer + aTimer->Enabled = true; + + Console::WriteLine("Press the Enter key to exit the program at any time... "); + Console::ReadLine(); + } + +private: + static void OnTimedEvent(Object^ source, System::Timers::ElapsedEventArgs^ e) + { + Console::WriteLine("The Elapsed event was raised at {0}", e->SignalTime); + } +}; + +int main() +{ + Example::Demo(); +} +// The example displays output like the following: +// Press the Enter key to exit the program at any time... +// The Elapsed event was raised at 5/20/2015 8:48:58 PM +// The Elapsed event was raised at 5/20/2015 8:49:00 PM +// The Elapsed event was raised at 5/20/2015 8:49:02 PM +// The Elapsed event was raised at 5/20/2015 8:49:04 PM +// The Elapsed event was raised at 5/20/2015 8:49:06 PM + +// diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp new file mode 100644 index 00000000000..7b4d07bf1ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.type.basetype/cpp/remarks.cpp @@ -0,0 +1,11 @@ + +using namespace System; + +// +generic ref class B { }; +generic ref class C : B { }; +// + + +int main() {} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp new file mode 100644 index 00000000000..3c606201207 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.type.declaringtype/cpp/remarks.cpp @@ -0,0 +1,12 @@ + +using namespace System; +using namespace System::Collections::Generic; + +void main() +{ +// + Type^ t = List::typeid->GetMethod("ConvertAll")->GetGenericArguments()[0]->DeclaringType; +// + Console::WriteLine("Declaring type: {0:s}", t->FullName); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp new file mode 100644 index 00000000000..887160b2c0e --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.type.genericparameterposition/cpp/remarks.cpp @@ -0,0 +1,18 @@ + +using namespace System; + +// +generic public ref class B { }; +generic public ref class A +{ +public: + generic B^ GetSomething() + { + return gcnew B(); + } +}; +// + + +int main() {} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp new file mode 100644 index 00000000000..27ef62bdf1a --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.type.makegenerictype/cpp/remarks.cpp @@ -0,0 +1,26 @@ + +using namespace System; + +// +generic + public ref class Base { }; +generic + public ref class Derived : Base { }; +// + +// +generic public ref class Outermost +{ +public: + generic ref class Inner + { + public: + generic ref class Innermost1 {}; + ref class Innermost2 {}; + }; +}; +// + + +int main() {} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp new file mode 100644 index 00000000000..c72d08ac108 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.typedreference/cpp/source.cpp @@ -0,0 +1,33 @@ + +using namespace System; +using namespace System::Reflection; + +ref class TypedReferenceArray +{ +private: + TypedReferenceArray(){} + + +public: + static void GetTypedRefArray() + { + try + { +// + Assembly::Load("mscorlib.dll")->GetType("System.TypedReference[]"); +// + } + catch (Exception^ ex) + { + Console::WriteLine(ex->Message); + Console::WriteLine(ex->StackTrace); + } + } + +}; + +int main() +{ + TypedReferenceArray::GetTypedRefArray(); +} + diff --git a/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp b/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp new file mode 100644 index 00000000000..e36381d28c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CLR_System/system.version.revision/cpp/rev.cpp @@ -0,0 +1,32 @@ +// +// This example demonstrates the Version.Revision, +// MajorRevision, and MinorRevision properties. +using namespace System; + +int main() +{ + String^ formatStandard = "Standard version:\n" + + " major.minor.build.revision = {0}.{1}.{2}.{3}"; + String^ formatInterim = "Interim version:\n" + + " major.minor.build.majRev/minRev = {0}.{1}.{2}.{3}/{4}"; + + Version^ standardVersion = gcnew Version(2, 4, 1128, 2); + Version^ interimVersion = gcnew Version(2, 4, 1128, (100 << 16) + 2); + + Console::WriteLine(formatStandard, standardVersion->Major, + standardVersion->Minor, standardVersion->Build, + standardVersion->Revision); + Console::WriteLine(formatInterim, interimVersion->Major, + interimVersion->Minor, interimVersion->Build, + interimVersion->MajorRevision, interimVersion->MinorRevision); +}; +/* +This code example produces the following results: + +Standard version: +major.minor.build.revision = 2.4.1128.2 +Interim version: +major.minor.build.majRev/minRev = 2.4.1128.100/2 + +*/ +// diff --git a/snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp b/snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp new file mode 100644 index 00000000000..6f8b7354593 --- /dev/null +++ b/snippets/cpp/VS_Snippets_CodeAnalysis/FxCop.Reliability.ReliabilityContract/cpp/FxCop.Reliability.ReliabilityContract.cpp @@ -0,0 +1,11 @@ +// +using namespace System; +using namespace System::Runtime::ConstrainedExecution; + +[assembly:ReliabilityContractAttribute( + Consistency::MayCorruptInstance, Cer::None)]; +namespace ReliabilityLibrary +{ + class SomeClass {}; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp new file mode 100644 index 00000000000..248a1274b23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.BaseURI Example/CPP/source.cpp @@ -0,0 +1,21 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "http://localhost/baseuri.xml" ); + + //Display information on the attribute node. The value + //returned for BaseURI is 'http://localhost/baseuri.xml'. + XmlAttribute^ attr = doc->DocumentElement->Attributes[ 0 ]; + Console::WriteLine( "Name of the attribute: {0}", attr->Name ); + Console::WriteLine( "Base URI of the attribute: {0}", attr->BaseURI ); + Console::WriteLine( "The value of the attribute: {0}", attr->InnerText ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp new file mode 100644 index 00000000000..7da06cb2507 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.CloneNode Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create an XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "2elems.xml" ); + + //Create an attribute. + XmlAttribute^ attr; + attr = doc->CreateAttribute( "bk", "genre", "urn:samples" ); + attr->Value = "novel"; + + //Add the attribute to the first book. + XmlElement^ currNode = dynamic_cast(doc->DocumentElement->FirstChild); + currNode->SetAttributeNode( attr ); + + //An attribute cannot be added to two different elements. + //You must clone the attribute and add it to the second book. + XmlAttribute^ attr2; + attr2 = dynamic_cast(attr->CloneNode( true )); + currNode = dynamic_cast(doc->DocumentElement->LastChild); + currNode->SetAttributeNode( attr2 ); + Console::WriteLine( "Display the modified XML...\r\n" ); + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + doc->WriteContentTo( writer ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..e610435a6f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.Name Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + Console::WriteLine( "Display information on each of the attributes... \r\n" ); + System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + XmlAttribute^ attr = safe_cast(myEnum->Current); + Console::Write( "{0} = {1}", attr->Name, attr->Value ); + Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp new file mode 100644 index 00000000000..d5ae5b95da8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.NamespaceURI Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + Console::WriteLine( "Display information on each of the attributes... \r\n" ); + System::Collections::IEnumerator^ myEnum = attrColl->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + XmlAttribute^ attr = safe_cast(myEnum->Current); + Console::Write( "{0}:{1} = {2}", attr->Prefix, attr->LocalName, attr->Value ); + Console::WriteLine( "\t namespaceURI={0}", attr->NamespaceURI ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..ab859d7c703 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerDocument Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute. + XmlAttribute^ attr; + attr = doc->CreateAttribute( "bk", "genre", "urn:samples" ); + attr->Value = "novel"; + + //Display the attribute's owner document. Note + //that although the attribute has not been inserted + //into the document, it still has an owner document. + Console::WriteLine( attr->OwnerDocument->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp new file mode 100644 index 00000000000..dcbf0298041 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttribute.OwnerElement Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute. + XmlAttribute^ attr; + attr = doc->CreateAttribute( "bk", "genre", "urn:samples" ); + attr->Value = "novel"; + + //Try to display the attribute's owner element. + if ( attr->OwnerElement == nullptr ) + Console::WriteLine( "The attribute has not been added to an element\r\n" ); + else + Console::WriteLine( attr->OwnerElement->OuterXml ); + + + //Add the attribute to an element. + doc->DocumentElement->SetAttributeNode( attr ); + + //Display the attribute's owner element. + Console::WriteLine( "Display the owner element..." ); + Console::WriteLine( attr->OwnerElement->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp new file mode 100644 index 00000000000..3adf20c7f03 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Append Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new attribute. + XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); + newAttr->Value = "novel"; + + //Create an attribute collection and add the new attribute + //to the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->Append( newAttr ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..ac6d9660ec5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.CopyTo Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + + //Declare the array. + array^arr = gcnew array(2); + int index = 0; + + //Copy all the attributes into the array. + attrColl->CopyTo( arr, index ); + Console::WriteLine( "Display all the attributes in the array.." ); + System::Collections::IEnumerator^ myEnum = arr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + XmlAttribute^ attr = safe_cast(myEnum->Current); + Console::WriteLine( "{0} = {1}", attr->Name, attr->Value ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp new file mode 100644 index 00000000000..cef8075ba6b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertAfter Example/CPP/source.cpp @@ -0,0 +1,24 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new attribute. + XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); + newAttr->Value = "novel"; + + //Create an attribute collection and add the new attribute + //to the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->InsertAfter( newAttr, attrColl[ 0 ] ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp new file mode 100644 index 00000000000..e83046a63b2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.InsertBefore Example/CPP/source.cpp @@ -0,0 +1,24 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new attribute. + XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); + newAttr->Value = "novel"; + + //Create an attribute collection and add the new attribute + //to the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->InsertBefore( newAttr, attrColl[ 0 ] ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp new file mode 100644 index 00000000000..58098e9636e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Prepend Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new attribute. + XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); + newAttr->Value = "novel"; + + //Create an attribute collection and add the new attribute + //to the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->Prepend( newAttr ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp new file mode 100644 index 00000000000..462904f2588 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.Remove Example/CPP/source.cpp @@ -0,0 +1,20 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection and remove an attribute + //from the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->Remove( attrColl[ "genre" ] ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp new file mode 100644 index 00000000000..6b44e2cdb0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAll Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection and remove all attributes + //from the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->RemoveAll(); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp new file mode 100644 index 00000000000..852996d7f61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.RemoveAt Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection and remove an attribute + //from the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->RemoveAt( 0 ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp new file mode 100644 index 00000000000..1eeb8a09d55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.SetNamedItem Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new attribute. + XmlAttribute^ newAttr = doc->CreateAttribute( "genre" ); + newAttr->Value = "novel"; + + //Create an attribute collection and add the new attribute + //to the collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + attrColl->SetNamedItem( newAttr ); + Console::WriteLine( "Display the modified XML...\r\n" ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..d05785cb9df --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlAttributeCollection.this Example/CPP/source.cpp @@ -0,0 +1,23 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute collection. + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + Console::WriteLine( "Display all the attributes in the collection...\r\n" ); + for ( int i = 0; i < attrColl->Count; i++ ) + { + Console::Write( "{0} = ", attrColl[ i ]->Name ); + Console::Write( "{0}", attrColl[ i ]->Value ); + Console::WriteLine(); + + } +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp new file mode 100644 index 00000000000..65290b3374d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlConvert.ToString Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Define the order data. They will be converted to string + //before being written out. + Int16 custID = 32632; + String^ orderID = "367A54"; + DateTime orderDate = DateTime::Now; + Double price = 19.95; + + //Create a writer that outputs to the console. + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + + //Write an element (this one is the root) + writer->WriteStartElement( "order" ); + + //Write the order date. + writer->WriteAttributeString( "date", XmlConvert::ToString( orderDate, "yyyy-MM-dd" ) ); + + //Write the order time. + writer->WriteAttributeString( "time", XmlConvert::ToString( orderDate, "HH:mm:ss" ) ); + + //Write the order data. + writer->WriteElementString( "orderID", orderID ); + writer->WriteElementString( "custID", XmlConvert::ToString( custID ) ); + writer->WriteElementString( "price", XmlConvert::ToString( price ) ); + + //Write the close tag for the root element + writer->WriteEndElement(); + + //Write the XML and close the writer + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp new file mode 100644 index 00000000000..e37f5167c22 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.CloneNode Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; +using namespace System::Data::SqlClient; +int main() +{ + DataSet^ dsNorthwind = gcnew DataSet; + + //Create the connection string. + String^ sConnect; + sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"; + + //Create a connection object to connect to the northwind db. + SqlConnection^ nwconnect = gcnew SqlConnection( sConnect ); + + //Create a command string to select all the customers in the WA region. + String^ sCommand = "Select * from Customers where Region='WA'"; + + //Create an adapter to load the DataSet. + SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect ); + + //Fill the DataSet with the selected records. + myDataAdapter->Fill( dsNorthwind, "Customers" ); + + //Load the document with the DataSet. + XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind ); + + //Create a shallow clone of the XmlDataDocument. Note that although + //none of the child nodes were copied over, the cloned node does + //have the schema information. + XmlDataDocument^ clone = dynamic_cast(doc->CloneNode( false )); + Console::WriteLine( "Child count: {0}", clone->ChildNodes->Count ); + Console::WriteLine( clone->DataSet->GetXmlSchema() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp new file mode 100644 index 00000000000..8ef5454e02d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.DataSet Example/CPP/source.cpp @@ -0,0 +1,28 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; + +int main() +{ + + //Create an XmlDataDocument. + XmlDataDocument^ doc = gcnew XmlDataDocument; + + //Load the schema file. + doc->DataSet->ReadXmlSchema( "store.xsd" ); + + //Load the XML data. + doc->Load( "2books.xml" ); + + //Update the price on the first book using the DataSet methods. + DataTable^ books = doc->DataSet->Tables[ "book" ]; + books->Rows[ 0 ][ "price" ] = "12.95"; + Console::WriteLine( "Display the modified XML data..." ); + doc->Save( Console::Out ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp new file mode 100644 index 00000000000..9ee8eb597d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.GetElementFromRow Example/CPP/source.cpp @@ -0,0 +1,41 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; +using namespace System::Data::SqlClient; + +int main() +{ + DataSet^ dsNorthwind = gcnew DataSet; + + //Create the connection string + String^ sConnect; + sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"; + + //Create a connection object to connect to the northwind db. + SqlConnection^ nwconnect = gcnew SqlConnection( sConnect ); + + //Create a command string to select all the customers in the WA region. + String^ sCommand = "Select * from Customers where Region='WA'"; + + //Create an adapter to load the DataSet. + SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect ); + + //Fill the DataSet with the selected records. + myDataAdapter->Fill( dsNorthwind, "Customers" ); + + //Load the document with the DataSet. + XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind ); + + //Create an element representing the first customer record. + DataRow^ row = doc->DataSet->Tables[ 0 ]->Rows[ 0 ]; + XmlElement^ elem = doc->GetElementFromRow( row ); + Console::WriteLine( elem->OuterXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp new file mode 100644 index 00000000000..efc4bd880c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDataDocument.XmlDataDocument1 Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; +using namespace System::Data::SqlClient; +int main() +{ + DataSet^ dsNorthwind = gcnew DataSet; + + //Create the connection string. + String^ sConnect; + sConnect = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"; + + //Create a connection object to connect to the northwind db. + SqlConnection^ nwconnect = gcnew SqlConnection( sConnect ); + + //Create a command string to select all the customers in the WA region. + String^ sCommand = "Select * from Customers where Region='WA'"; + + //Create an adapter to load the DataSet. + SqlDataAdapter^ myDataAdapter = gcnew SqlDataAdapter( sCommand,nwconnect ); + + //Fill the DataSet with the selected records. + myDataAdapter->Fill( dsNorthwind, "Customers" ); + + //Load the document with the DataSet. + XmlDataDocument^ doc = gcnew XmlDataDocument( dsNorthwind ); + + //Display the XmlDataDocument. + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp new file mode 100644 index 00000000000..cf3fc8cd852 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Encoding Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + String^ xmlString = "Oberon's Legacy"; + doc->Load( gcnew StringReader( xmlString ) ); + + // Create an XML declaration. + XmlDeclaration^ xmldecl; + xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); + xmldecl->Encoding = "UTF-8"; + xmldecl->Standalone = "yes"; + + // Add the new node to the document. + XmlElement^ root = doc->DocumentElement; + doc->InsertBefore( xmldecl, root ); + + // Display the modified XML document + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp new file mode 100644 index 00000000000..cf3fc8cd852 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDeclaration.Standalone Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + String^ xmlString = "Oberon's Legacy"; + doc->Load( gcnew StringReader( xmlString ) ); + + // Create an XML declaration. + XmlDeclaration^ xmldecl; + xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); + xmldecl->Encoding = "UTF-8"; + xmldecl->Standalone = "yes"; + + // Add the new node to the document. + XmlElement^ root = doc->DocumentElement; + doc->InsertBefore( xmldecl, root ); + + // Display the modified XML document + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp new file mode 100644 index 00000000000..1f39979cb87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp @@ -0,0 +1,28 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a deep clone. The cloned node + //includes the child node. + XmlDocument^ deep = dynamic_cast(doc->CloneNode( true )); + Console::WriteLine( deep->ChildNodes->Count ); + + //Create a shallow clone. The cloned node does not + //include the child node. + XmlDocument^ shallow = dynamic_cast(doc->CloneNode( false )); + Console::WriteLine( "{0}{1}", shallow->Name, shallow->OuterXml ); + Console::WriteLine( shallow->ChildNodes->Count ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..e1c7160ac1f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an attribute. + XmlAttribute^ attr = doc->CreateAttribute( "publisher" ); + attr->Value = "WorldWide Publishing"; + + //Add the new node to the document. + doc->DocumentElement->SetAttributeNode( attr ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp new file mode 100644 index 00000000000..b99d05865e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a CData section. + XmlCDataSection^ CData; + CData = doc->CreateCDataSection( "All Jane Austen novels 25% off starting 3/23!" ); + + //Add the new node to the document. + XmlElement^ root = doc->DocumentElement; + root->AppendChild( CData ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp new file mode 100644 index 00000000000..de2b9a3e426 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a comment. + XmlComment^ newComment; + newComment = doc->CreateComment( "Sample XML document" ); + + //Add the new node to the document. + XmlElement^ root = doc->DocumentElement; + doc->InsertBefore( newComment, root ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp new file mode 100644 index 00000000000..43a191e3ad8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" ); + + //Create a document fragment. + XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); + + //Set the contents of the document fragment. + docFrag->InnerXml = "widget"; + + //Add the children of the document fragment to the + //original document. + doc->DocumentElement->AppendChild( docFrag ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp new file mode 100644 index 00000000000..9ef82e4bbe0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp @@ -0,0 +1,28 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + + //Create a document type node and + //add it to the document. + XmlDocumentType^ doctype; + doctype = doc->CreateDocumentType( "book", nullptr, nullptr, "" ); + doc->AppendChild( doctype ); + + //Create the root element and + //add it to the document. + doc->AppendChild( doc->CreateElement( "book" ) ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp new file mode 100644 index 00000000000..75a61a9cebf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new node and add it to the document. + //The text node is the content of the price element. + XmlElement^ elem = doc->CreateElement( "price" ); + XmlText^ text = doc->CreateTextNode( "19.95" ); + doc->DocumentElement->AppendChild( elem ); + doc->DocumentElement->LastChild->AppendChild( text ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp new file mode 100644 index 00000000000..726fefbd045 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + String^ xmlData = ""; + doc->Load( gcnew StringReader( xmlData ) ); + + // Create a new element and add it to the document. + XmlElement^ elem = doc->CreateElement( "bk", "genre", "urn:samples" ); + elem->InnerText = "fantasy"; + doc->DocumentElement->AppendChild( elem ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp new file mode 100644 index 00000000000..7bf73f8915c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>Pride And Prejudice" ); + + //Create an entity reference node. The child count should be 0 + //since the node has not been expanded. + XmlEntityReference^ entityref = doc->CreateEntityReference( "h" ); + Console::WriteLine( entityref->ChildNodes->Count ); + + //After the node has been added to the document, its parent node + //is set and the entity reference node is expanded. It now has a child + //node containing the entity replacement text. + doc->DocumentElement->LastChild->AppendChild( entityref ); + Console::WriteLine( entityref->FirstChild->InnerText ); + + //Create and insert an undefined entity reference node. When the entity + //reference node is expanded, because the entity reference is undefined + //the child is an empty text node. + XmlEntityReference^ entityref2 = doc->CreateEntityReference( "p" ); + doc->DocumentElement->LastChild->AppendChild( entityref2 ); + Console::WriteLine( entityref2->FirstChild->InnerText ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp new file mode 100644 index 00000000000..8a885ff4f33 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a new node and add it to the document. + XmlNode^ elem = doc->CreateNode( XmlNodeType::Element, "price", nullptr ); + elem->InnerText = "19.95"; + doc->DocumentElement->AppendChild( elem ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp new file mode 100644 index 00000000000..e638f3db6fd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Oberon's Legacy 5.95" ); + + // Create a new element node. + XmlNode^ newElem = doc->CreateNode( "element", "pages", "" ); + newElem->InnerText = "290"; + Console::WriteLine( "Add the new element to the document..." ); + XmlElement^ root = doc->DocumentElement; + root->AppendChild( newElem ); + Console::WriteLine( "Display the modified XML document..." ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp new file mode 100644 index 00000000000..a51f50b4f52 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Oberon's Legacy 5.95" ); + + // Create a new element node. + XmlNode^ newElem; + newElem = doc->CreateNode( XmlNodeType::Element, "g" , "ISBN" , "https://global.ISBN/list" ); + newElem->InnerText = "1-861001-57-5"; + + // Add the new element to the document + XmlElement^ root = doc->DocumentElement; + root->AppendChild( newElem ); + + // Display the modified XML document + Console::WriteLine( doc->OuterXml ); + + // Output: + // Oberon's Legacy5.951-861001-57-5 +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp new file mode 100644 index 00000000000..27a969f9685 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + + // Create a procesing instruction. + XmlProcessingInstruction^ newPI; + String^ PItext = "type='text/xsl' href='book.xsl'"; + newPI = doc->CreateProcessingInstruction( "xml-stylesheet", PItext ); + + // Display the target and data information. + Console::WriteLine( "", newPI->Target, newPI->Data ); + + // Add the processing instruction node to the document. + doc->AppendChild( newPI ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp new file mode 100644 index 00000000000..4817ff6ccf4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "EvaCorets" ); + Console::WriteLine( "InnerText before..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); + + // Add white space. + XmlNode^ currNode = doc->DocumentElement; + XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" ); + currNode->InsertAfter( sigws, currNode->FirstChild ); + Console::WriteLine(); + Console::WriteLine( "InnerText after..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp new file mode 100644 index 00000000000..7eeb3da5079 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "EvaCorets" ); + Console::WriteLine( "InnerText before..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); + + // Add white space. + XmlNode^ currNode = doc->DocumentElement; + XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" ); + currNode->InsertAfter( ws, currNode->FirstChild ); + Console::WriteLine(); + Console::WriteLine( "InnerText after..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp new file mode 100644 index 00000000000..af70be8e025 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create an XML declaration. + XmlDeclaration^ xmldecl; + xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); + + //Add the new node to the document. + XmlElement^ root = doc->DocumentElement; + doc->InsertBefore( xmldecl, root ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp new file mode 100644 index 00000000000..ee5192065b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Display the document element. + Console::WriteLine( doc->DocumentElement->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp new file mode 100644 index 00000000000..3240940efc2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "" + "" ); + + // Display the DocumentType. + Console::WriteLine( doc->DocumentType->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp new file mode 100644 index 00000000000..f9842a8ef80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "ids.xml" ); + + //Get the first element with an attribute of type ID and value of A111. + //This displays the node . + XmlElement^ elem = doc->GetElementById( "A111" ); + Console::WriteLine( elem->OuterXml ); + + //Get the first element with an attribute of type ID and value of A222. + //This displays the node . + elem = doc->GetElementById( "A222" ); + Console::WriteLine( elem->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp new file mode 100644 index 00000000000..3c1265c6b3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp @@ -0,0 +1,21 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + + //Display all the book titles. + XmlNodeList^ elemList = doc->GetElementsByTagName( "title" ); + for ( int i = 0; i < elemList->Count; i++ ) + { + Console::WriteLine( elemList[ i ]->InnerXml ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp new file mode 100644 index 00000000000..df8b7f49438 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataSet^ dataset; + +public: + void Method() + { +// + XmlDocument^ doc1 = gcnew XmlDocument; + doc1->Load( "books.xml" ); + XmlDocument^ doc2 = doc1->Implementation->CreateDocument(); +// + } +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp new file mode 100644 index 00000000000..2e836430e60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create another XmlDocument which holds a list of books. + XmlDocument^ doc2 = gcnew XmlDocument; + doc2->Load( "books.xml" ); + + //Import the last book node from doc2 into the original document. + XmlNode^ newBook = doc->ImportNode( doc2->DocumentElement->LastChild, true ); + doc->DocumentElement->AppendChild( newBook ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..893b4782d72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "" + "" ); + + //Check if the node is read-only. + if ( doc->DocumentElement->LastChild->FirstChild->IsReadOnly ) + Console::WriteLine( "Entity reference nodes are always read-only" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp new file mode 100644 index 00000000000..de9abc8d55b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + + //Load the document with the last book node. + XmlTextReader^ reader = gcnew XmlTextReader( "books.xml" ); + reader->WhitespaceHandling = WhitespaceHandling::None; + reader->MoveToContent(); + reader->Read(); + reader->Skip(); //Skip the first book. + reader->Skip(); //Skip the second book. + doc->Load( reader ); + doc->Save( Console::Out ); +} + +// +XmlDocument ^XMLDOMProcessing::XMLHelperMethods::LoadDocument(bool generateXML) +{ + + XmlDocument ^doc = gcnew XmlDocument(); + doc->PreserveWhitespace = true; + try + {doc->Load("booksData.xml");} + catch (System::IO::FileNotFoundException ^e1) + { + // If no book is found, generate some XML. + + doc->LoadXml(" \n" + + " \n" + + " \n" + + " Pride And Prejudice \n" + + " 24.95 \n" + + " \n" + + " \n" + + " The Handmaid's Tale \n" + + " 29.95 \n" + + " \n" + + ""); + } + + return doc; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp new file mode 100644 index 00000000000..e2a7b610d8e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "wrench" ); + + // Add a price element. + XmlElement^ newElem = doc->CreateElement( "price" ); + newElem->InnerText = "10.95"; + doc->DocumentElement->AppendChild( newElem ); + + // Save the document to a file and auto-indent the output. + XmlTextWriter^ writer = gcnew XmlTextWriter( "data.xml", nullptr ); + writer->Formatting = Formatting::Indented; + doc->Save( writer ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp new file mode 100644 index 00000000000..c2c17bfded5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Load XML data which includes white space, but ignore + //any white space in the file. + XmlDocument^ doc = gcnew XmlDocument; + doc->PreserveWhitespace = false; + doc->Load( "book.xml" ); + + //Save the document as is (no white space). + Console::WriteLine( "Display the modified XML..." ); + doc->PreserveWhitespace = true; + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp new file mode 100644 index 00000000000..5f22526fb55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + //Create a reader. + XmlTextReader^ reader = gcnew XmlTextReader( "cd.xml" ); + reader->MoveToContent(); //Move to the cd element node. + + //Create a node representing the cd element node. + XmlNode^ cd = doc->ReadNode( reader ); + + //Insert the new node into the document. + doc->DocumentElement->AppendChild( cd ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp new file mode 100644 index 00000000000..2bfdcba7729 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "wrench" ); + + // Add a price element. + XmlElement^ newElem = doc->CreateElement( "price" ); + newElem->InnerText = "10.95"; + doc->DocumentElement->AppendChild( newElem ); + + // Save the document to a file. White space is + // preserved (no white space). + doc->PreserveWhitespace = true; + doc->Save( "data.xml" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp new file mode 100644 index 00000000000..a3dd876f834 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Data; +using namespace System::Windows::Forms; + +// +void WriteXml( XmlDocument^ doc ) +{ + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + doc->WriteContentTo( writer ); + writer->Flush(); + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp new file mode 100644 index 00000000000..254d4e4b649 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Data; +using namespace System::Windows::Forms; + +// +void WriteXml( XmlDocument^ doc ) +{ + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + doc->WriteTo( writer ); + writer->Flush(); + Console::WriteLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp new file mode 100644 index 00000000000..f4464977f99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.CloneNode Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" ); + + // Create a document fragment. + XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); + + // Set the contents of the document fragment. + docFrag->InnerXml = "widget"; + + // Create a deep clone. The cloned node + // includes child nodes. + XmlNode^ deep = docFrag->CloneNode( true ); + Console::WriteLine( "Name: {0}", deep->Name ); + Console::WriteLine( "OuterXml: {0}", deep->OuterXml ); + + // Create a shallow clone. The cloned node does + // not include any child nodes. + XmlNode^ shallow = docFrag->CloneNode( false ); + Console::WriteLine( "Name: {0}", shallow->Name ); + Console::WriteLine( "OuterXml: {0}", shallow->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp new file mode 100644 index 00000000000..28e3cfe2a6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.InnerXml Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + + // Create a document fragment. + XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); + + // Set the contents of the document fragment. + docFrag->InnerXml = "widget"; + + // Display the document fragment. + Console::WriteLine( docFrag->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..8c15797d0b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentFragment.OwnerDocument Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" ); + + // Create a document fragment. + XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); + + // Display the owner document of the document fragment. + Console::WriteLine( docFrag->OwnerDocument->OuterXml ); + + // Add nodes to the document fragment. Notice that the + // new element is created using the owner document of + // the document fragment. + XmlElement^ elem = doc->CreateElement( "item" ); + elem->InnerText = "widget"; + docFrag->AppendChild( elem ); + Console::WriteLine( "Display the document fragment..." ); + Console::WriteLine( docFrag->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..6c4328103ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.IsReadOnly Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "" + "" ); + + // Check if the node is read-only. + if ( doc->DocumentType->IsReadOnly ) + Console::WriteLine( "Document type nodes are always read-only" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..7c1b61160cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocumentType.Name Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "" + "" ); + + // Display information on the DocumentType node. + XmlDocumentType^ doctype = doc->DocumentType; + Console::WriteLine( "Name of the document type: {0}", doctype->Name ); + Console::WriteLine( "The internal subset of the document type: {0}", doctype->InternalSubset ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp new file mode 100644 index 00000000000..0b8dd71f455 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Attributes Example/CPP/source.cpp @@ -0,0 +1,19 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Change the value of the first attribute. + root->Attributes[ 0 ]->Value = "fiction"; + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp new file mode 100644 index 00000000000..b75667b60fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.CloneNode Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "2books.xml" ); + + // Create a new element. + XmlElement^ elem = doc->CreateElement( "misc" ); + elem->InnerText = "hardcover"; + elem->SetAttribute( "publisher", "WorldWide Publishing" ); + + // Clone the element so we can add one to each of the book nodes. + XmlNode^ elem2 = elem->CloneNode( true ); + + // Add the new elements. + doc->DocumentElement->FirstChild->AppendChild( elem ); + doc->DocumentElement->LastChild->AppendChild( elem2 ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp new file mode 100644 index 00000000000..fc626a6df19 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetAttributeNode Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Check to see if the element has a genre attribute. + if ( root->HasAttribute( "genre" ) ) + { + XmlAttribute^ attr = root->GetAttributeNode( "genre" ); + Console::WriteLine( attr->Value ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp new file mode 100644 index 00000000000..43426ae0dd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.GetElementsByTagName Example/CPP/source.cpp @@ -0,0 +1,21 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "2books.xml" ); + + // Get and display all the book titles. + XmlElement^ root = doc->DocumentElement; + XmlNodeList^ elemList = root->GetElementsByTagName( "title" ); + for ( int i = 0; i < elemList->Count; i++ ) + { + Console::WriteLine( elemList[ i ]->InnerXml ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..ab87fd72095 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttribute Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Check to see if the element has a genre attribute. + if ( root->HasAttribute( "genre" ) ) + { + String^ genre = root->GetAttribute( "genre" ); + Console::WriteLine( genre ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..b0288ee6c7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.HasAttributes Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Remove all attributes from the root element. + if ( root->HasAttributes ) + root->RemoveAllAttributes(); + + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp new file mode 100644 index 00000000000..1c76c3bca01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.InnerXml Example/CPP/source.cpp @@ -0,0 +1,40 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "some textmore text" ); + XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild); + + // Note that InnerText does not include the markup. + Console::WriteLine( "Display the InnerText of the element..." ); + Console::WriteLine( elem->InnerText ); + + // InnerXml includes the markup of the element. + Console::WriteLine( "Display the InnerXml of the element..." ); + Console::WriteLine( elem->InnerXml ); + + // Set InnerText to a string that includes markup. + // The markup is escaped. + elem->InnerText = "Text containing will have char(<) and char(>) escaped."; + Console::WriteLine( elem->OuterXml ); + + // Set InnerXml to a string that includes markup. + // The markup is not escaped. + elem->InnerXml = "Text containing ."; + Console::WriteLine( elem->OuterXml ); +} +// This example produces the following results: +// +// Display the InnerText of the element... +// some textmore text +// Display the InnerXml of the element... +// some textmore text +// Text containing <markup/> will have char(<) and char(>) escaped. +// Text containing . +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp new file mode 100644 index 00000000000..32d168f69fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.IsEmpty Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Pride And Prejudice " ); + XmlElement^ currNode = dynamic_cast(doc->DocumentElement->LastChild); + if ( currNode->IsEmpty ) + currNode->InnerXml = "19.95"; + + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp new file mode 100644 index 00000000000..79d6693b5c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.LocalName Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "1-861001-57-5" + "Pride And Prejudice" + "" ); + + // Display information on the ISBN element. + XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild); + Console::Write( "{0}:{1} = {2}", elem->Prefix, elem->LocalName, elem->InnerText ); + Console::WriteLine( "\t namespaceURI={0}", elem->NamespaceURI ); +} + +// This code produces the following output. +// bk:ISBN = 1-861001-57-5 namespaceURI=urn:samples +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..0523cdebda0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.Name Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "1-861001-57-5" + "Pride And Prejudice" + "" ); + + // Display information on the ISBN element. + XmlElement^ elem = dynamic_cast(doc->DocumentElement->FirstChild); + Console::Write( "{0} = {1}", elem->Name, elem->InnerText ); + Console::WriteLine( "\t namespaceURI={0}", elem->NamespaceURI ); +} + +// This code produces the following output. +// bk:ISBN = 1-861001-57-5 namespaceURI=urn:samples +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..61bff069bb3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.OwnerDocument Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Create a new element. + XmlElement^ elem = doc->CreateElement( "price" ); + elem->InnerText = "19.95"; + + // Display the new element's owner document. Note + // that although the element has not been inserted + // into the document, it still has an owner document. + Console::WriteLine( elem->OwnerDocument->OuterXml ); + + // Add the new element into the document. + root->AppendChild( elem ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp new file mode 100644 index 00000000000..55d58e8f4df --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAll Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + + // Remove all attributes and child nodes from the book element. + XmlElement^ root = doc->DocumentElement; + root->RemoveAll(); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..b35acf816b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAllAttributes Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Remove all attributes from the root element. + root->RemoveAllAttributes(); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..b0464c9da27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Remove the genre attribute. + root->RemoveAttribute( "genre" ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp new file mode 100644 index 00000000000..f16ed9f8182 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttribute1 Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Remove the ISBN attribute. + root->RemoveAttribute( "ISBN", "urn:samples" ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp new file mode 100644 index 00000000000..d65bd739012 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeAt Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Remove the genre attribute. + root->RemoveAttributeAt( 0 ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp new file mode 100644 index 00000000000..85f87dd21d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.RemoveAttributeNode1 Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Remove the ISBN attribute. + root->RemoveAttributeNode( "ISBN", "urn:samples" ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp new file mode 100644 index 00000000000..495d6d0bedd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.SetAttributeNode1 Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Add a new attribute. + XmlAttribute^ attr = root->SetAttributeNode( "genre", "urn:samples" ); + attr->Value = "novel"; + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp new file mode 100644 index 00000000000..577c59e10dc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteContentTo Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Note that because WriteContentTo saves only the children of the element + // to the writer none of the attributes are displayed. + Console::WriteLine( "Display the contents of the element..." ); + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + root->WriteContentTo( writer ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp new file mode 100644 index 00000000000..dc693bbe781 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlElement.WriteTo Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "Pride And Prejudice" ); + XmlElement^ root = doc->DocumentElement; + + // Add a new attribute. + root->SetAttribute( "genre", "urn:samples", "novel" ); + Console::WriteLine( "Display the modified XML..." ); + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + root->WriteTo( writer ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp new file mode 100644 index 00000000000..557e86ed61a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.BaseURI Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "http://localhost/uri.xml" ); + + //Display information on the entity reference node. + XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild); + Console::WriteLine( "Name of the entity reference: {0}", entref->Name ); + Console::WriteLine( "Base URI of the entity reference: {0}", entref->BaseURI ); + Console::WriteLine( "The entity replacement text: {0}", entref->InnerText ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..5df1512470f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.IsReadOnly Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "" + "" ); + + // Check if the node is read-only. + XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild); + if ( entref->IsReadOnly ) + Console::WriteLine( "Entity reference nodes are always read-only" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..0635eed93bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlEntityReference.Name Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "" + "" ); + + // Display information on the entity reference node. + XmlEntityReference^ entref = dynamic_cast(doc->DocumentElement->LastChild->FirstChild); + Console::WriteLine( "Name of the entity reference: {0}", entref->Name ); + Console::WriteLine( "The entity replacement text: {0}", entref->InnerText ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..80c8c8c001b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlImplementation.CreateDocument Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataSet^ dataset; + +public: + void Method() + { +// + XmlImplementation^ imp = gcnew XmlImplementation; + XmlDocument^ doc1 = imp->CreateDocument(); + XmlDocument^ doc2 = imp->CreateDocument(); +// + } +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp new file mode 100644 index 00000000000..da00cfebf0a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.NextSibling Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + + // Display the first two book nodes. + XmlNode^ book = doc->DocumentElement->FirstChild; + Console::WriteLine( book->OuterXml ); + Console::WriteLine(); + Console::WriteLine( book->NextSibling->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp new file mode 100644 index 00000000000..6b73208b236 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlLinkedNode.PreviousSibling Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + XmlNode^ lastNode = doc->DocumentElement->LastChild; + Console::WriteLine( "Last book..." ); + Console::WriteLine( lastNode->OuterXml ); + XmlNode^ prevNode = lastNode->PreviousSibling; + Console::WriteLine( "\r\nPrevious book..." ); + Console::WriteLine( prevNode->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..284b8359eb1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.Count Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Pride And Prejudice" ); + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + Console::WriteLine( "Display all the attributes for this book..." ); + for ( int i = 0; i < attrColl->Count; i++ ) + { + Console::WriteLine( "{0} = {1}", attrColl->Item( i )->Name, attrColl->Item( i )->Value ); + + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..4d3bd90411a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Collections; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + " Pride And Prejudice" + "" ); + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + Console::WriteLine( "Display all the attributes for this book..." ); + IEnumerator^ ienum = attrColl->GetEnumerator(); + while ( ienum->MoveNext() ) + { + XmlAttribute^ attr = dynamic_cast(ienum->Current); + Console::WriteLine( "{0} = {1}", attr->Name, attr->Value ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp new file mode 100644 index 00000000000..0f47e848c12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.GetNamedItem Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Pride And Prejudice" ); + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + + // Change the value for the genre attribute. + XmlAttribute^ attr = dynamic_cast(attrColl->GetNamedItem( "genre" )); + attr->Value = "fiction"; + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp new file mode 100644 index 00000000000..8850c3b5bc0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.RemoveNamedItem1 Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Pride And Prejudice" ); + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + + // Remove the publicationdate attribute. + attrColl->RemoveNamedItem( "publicationdate" ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp new file mode 100644 index 00000000000..6dda24559d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamedNodeMap.SetNamedItem Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " Pride And Prejudice" ); + XmlAttributeCollection^ attrColl = doc->DocumentElement->Attributes; + + // Add a new attribute to the collection. + XmlAttribute^ attr = doc->CreateAttribute( "style" ); + attr->Value = "hardcover"; + attrColl->SetNamedItem( attr ); + Console::WriteLine( "Display the modified XML..." ); + Console::WriteLine( doc->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp new file mode 100644 index 00000000000..e1cf039093e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.DefaultNamespace Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataSet^ dataset; + +public: + void Method( XmlNamespaceManager^ nsmgr ) + { +// + if ( nsmgr->HasNamespace( String::Empty ) ) + { + Console::WriteLine( nsmgr->DefaultNamespace ); + } +// + } +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp new file mode 100644 index 00000000000..38bee9fe649 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.PopScope Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +public ref class Sample +{ +public: + Sample() + { + + // Create the XmlNamespaceManager. + NameTable^ nt = gcnew NameTable; + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); + + // Add prefix/namespace pairs to the XmlNamespaceManager. + nsmgr->AddNamespace( "", "www.wideworldimporters.com" ); //Adds a default namespace. + nsmgr->AddNamespace( "europe", "www.wideworldimporters.com/europe" ); + nsmgr->PushScope(); //Pushes a namespace scope on the stack. + nsmgr->AddNamespace( "", "www.lucernepublishing.com" ); //Adds another default namespace. + nsmgr->AddNamespace( "partners", "www.lucernepublishing.com/partners" ); + Console::WriteLine( "Show all the prefix/namespace pairs in the XmlNamespaceManager..." ); + ShowAllNamespaces( nsmgr ); + } + + +private: + void ShowAllNamespaces( XmlNamespaceManager^ nsmgr ) + { + do + { + System::Collections::IEnumerator^ myEnum = nsmgr->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ prefix = safe_cast(myEnum->Current); + Console::WriteLine( "Prefix={0}, Namespace={1}", prefix, nsmgr->LookupNamespace( prefix ) ); + } + } + while ( nsmgr->PopScope() ); + } + +}; + +int main() +{ + gcnew Sample; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp new file mode 100644 index 00000000000..7e0abed5a53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNamespaceManager.XmlNamespaceManager Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; +using namespace System::Xml::Schema; +public ref class Class1 +{ +public: + void Method1() + { + + // + XmlTextReader^ reader = gcnew XmlTextReader( "myfile.xml" ); + XmlNamespaceManager^ nsmanager = gcnew XmlNamespaceManager( reader->NameTable ); + nsmanager->AddNamespace( "msbooks", "www.microsoft.com/books" ); + nsmanager->PushScope(); + nsmanager->AddNamespace( "msstore", "www.microsoft.com/store" ); + while ( reader->Read() ) + { + Console::WriteLine( "Reader Prefix:{0}", reader->Prefix ); + Console::WriteLine( "XmlNamespaceManager Prefix:{0}", nsmanager->LookupPrefix( nsmanager->NameTable->Get( reader->NamespaceURI ) ) ); + } + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp new file mode 100644 index 00000000000..cc33f1ca5ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.AppendChild Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Create a new node. + XmlElement^ elem = doc->CreateElement( "price" ); + elem->InnerText = "19.95"; + + //Add the node to the document. + root->AppendChild( elem ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp new file mode 100644 index 00000000000..0e20454fc0c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.Clone Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" ); + XmlNode^ root = doc->FirstChild; + + //Clone the root node. The cloned node includes + //child nodes. This is similar to calling CloneNode(true). + XmlNode^ clone = root->Clone(); + Console::WriteLine( clone->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp new file mode 100644 index 00000000000..5d3608a3e74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.CloneNode Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" ); + XmlNode^ root = doc->FirstChild; + + //Create a deep clone. The cloned node + //includes the child nodes. + XmlNode^ deep = root->CloneNode( true ); + Console::WriteLine( deep->OuterXml ); + + //Create a shallow clone. The cloned node does not + //include the child nodes, but does include its attribute. + XmlNode^ shallow = root->CloneNode( false ); + Console::WriteLine( shallow->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp new file mode 100644 index 00000000000..8c9bb154ef8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.FirstChild Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" ); + XmlNode^ root = doc->FirstChild; + Console::WriteLine( "Display the title element..." ); + Console::WriteLine( root->FirstChild->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..b7fb2e4d051 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + Console::WriteLine( "Display all the books..." ); + XmlNode^ root = doc->DocumentElement; + IEnumerator^ ienum = root->GetEnumerator(); + XmlNode^ book; + while ( ienum->MoveNext() ) + { + book = dynamic_cast(ienum->Current); + Console::WriteLine( book->OuterXml ); + Console::WriteLine(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp new file mode 100644 index 00000000000..7f8efa23a79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetNamespaceOfPrefix Example/CPP/source.cpp @@ -0,0 +1,28 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->FirstChild; + + //Create a new attribute. + String^ ns = root->GetNamespaceOfPrefix( "bk" ); + XmlNode^ attr = doc->CreateNode( XmlNodeType::Attribute, "genre", ns ); + attr->Value = "novel"; + + //Add the attribute to the document. + root->Attributes->SetNamedItem( attr ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp new file mode 100644 index 00000000000..24c5ad1996b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.GetPrefixOfNamespace Example/CPP/source.cpp @@ -0,0 +1,28 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->FirstChild; + + //Create a new node. + String^ prefix = root->GetPrefixOfNamespace( "urn:samples" ); + XmlElement^ elem = doc->CreateElement( prefix, "style", "urn:samples" ); + elem->InnerText = "hardcover"; + + //Add the node to the document. + root->AppendChild( elem ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp new file mode 100644 index 00000000000..ff8ddddef56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.HasChildNodes Example/CPP/source.cpp @@ -0,0 +1,26 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" ); + XmlNode^ root = doc->FirstChild; + + //Display the contents of the child nodes. + if ( root->HasChildNodes ) + { + for ( int i = 0; i < root->ChildNodes->Count; i++ ) + { + Console::WriteLine( root->ChildNodes[ i ]->InnerText ); + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp new file mode 100644 index 00000000000..afa0e8a8997 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InnerText Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "some textmore text" + "" ); + XmlNode^ elem = doc->DocumentElement->FirstChild; + + // Note that InnerText does not include the markup. + Console::WriteLine( "Display the InnerText of the element..." ); + Console::WriteLine( elem->InnerText ); + + // InnerXml includes the markup of the element. + Console::WriteLine( "Display the InnerXml of the element..." ); + Console::WriteLine( elem->InnerXml ); + + // Set InnerText to a string that includes markup. + // The markup is escaped. + elem->InnerText = "Text containing will have char(<) and char(>) escaped."; + Console::WriteLine( elem->OuterXml ); + + // Set InnerXml to a string that includes markup. + // The markup is not escaped. + elem->InnerXml = "Text containing ."; + Console::WriteLine( elem->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp new file mode 100644 index 00000000000..bbc72ef7e69 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertAfter Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Create a new node. + XmlElement^ elem = doc->CreateElement( "price" ); + elem->InnerText = "19.95"; + + //Add the node to the document. + root->InsertAfter( elem, root->FirstChild ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp new file mode 100644 index 00000000000..3ebee800a51 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.InsertBefore Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Create a new node. + XmlElement^ elem = doc->CreateElement( "price" ); + elem->InnerText = "19.95"; + + //Add the node to the document. + root->InsertBefore( elem, root->FirstChild ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp new file mode 100644 index 00000000000..9514236fc62 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.LastChild Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" ); + XmlNode^ root = doc->FirstChild; + Console::WriteLine( "Display the price element..." ); + Console::WriteLine( root->LastChild->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp new file mode 100644 index 00000000000..c78113a0dab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.NextSibling Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + XmlNode^ currNode = doc->DocumentElement->FirstChild; + Console::WriteLine( "First book..." ); + Console::WriteLine( currNode->OuterXml ); + XmlNode^ nextNode = currNode->NextSibling; + Console::WriteLine( "\r\nSecond book..." ); + Console::WriteLine( nextNode->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp new file mode 100644 index 00000000000..9465dbc7815 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.OuterXml Example/CPP/source.cpp @@ -0,0 +1,28 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + // OuterXml includes the markup of current node. + Console::WriteLine( "Display the OuterXml property..." ); + Console::WriteLine( root->OuterXml ); + + // InnerXml does not include the markup of the current node. + // As a result, the attributes are not displayed. + Console::WriteLine(); + Console::WriteLine( "Display the InnerXml property..." ); + Console::WriteLine( root->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp new file mode 100644 index 00000000000..63c23bf93d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PrependChild Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Create a new node. + XmlElement^ elem = doc->CreateElement( "price" ); + elem->InnerText = "19.95"; + + //Add the node to the document. + root->PrependChild( elem ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp new file mode 100644 index 00000000000..6b73208b236 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.PreviousSibling Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + XmlNode^ lastNode = doc->DocumentElement->LastChild; + Console::WriteLine( "Last book..." ); + Console::WriteLine( lastNode->OuterXml ); + XmlNode^ prevNode = lastNode->PreviousSibling; + Console::WriteLine( "\r\nPrevious book..." ); + Console::WriteLine( prevNode->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp new file mode 100644 index 00000000000..5d7402c67e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveAll Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Remove all attribute and child nodes. + root->RemoveAll(); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp new file mode 100644 index 00000000000..3eeeb8ee336 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.RemoveChild Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Remove the title element. + root->RemoveChild( root->FirstChild ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp new file mode 100644 index 00000000000..8b2b88dc130 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.ReplaceChild Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->DocumentElement; + + //Create a new title element. + XmlElement^ elem = doc->CreateElement( "title" ); + elem->InnerText = "The Handmaid's Tale"; + + //Replace the title element. + root->ReplaceChild( elem, root->FirstChild ); + Console::WriteLine( "Display the modified XML..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp new file mode 100644 index 00000000000..fa145876295 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectNodes Example/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "booksort.xml" ); + XmlNodeList^ nodeList; + XmlNode^ root = doc->DocumentElement; + nodeList = root->SelectNodes( "descendant::book[author/last-name='Austen']" ); + + //Change the price on the books. + System::Collections::IEnumerator^ myEnum = nodeList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + XmlNode^ book = safe_cast(myEnum->Current); + book->LastChild->InnerText = "15.95"; + } + + Console::WriteLine( "Display the modified XML document...." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp new file mode 100644 index 00000000000..7ef2af1b754 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.SelectSingleNode Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "booksort.xml" ); + XmlNode^ book; + XmlNode^ root = doc->DocumentElement; + book = root->SelectSingleNode( "descendant::book[author/last-name='Austen']" ); + + //Change the price on the book. + book->LastChild->InnerText = "15.95"; + Console::WriteLine( "Display the modified XML document...." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp new file mode 100644 index 00000000000..109df9f1d9a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteContentTo Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->FirstChild; + + // Because WriteContentTo saves only the child nodes of the node + // to the writer none of the attributes are displayed. + Console::WriteLine( "Display the contents of the node..." ); + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + root->WriteContentTo( writer ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp new file mode 100644 index 00000000000..7a871794b8e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.WriteTo Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "" ); + XmlNode^ root = doc->FirstChild; + Console::WriteLine( "Display the root node..." ); + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + root->WriteTo( writer ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp new file mode 100644 index 00000000000..d308ff6a9b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNode.this Example/CPP/source.cpp @@ -0,0 +1,19 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" ); + XmlNode^ root = doc->FirstChild; + Console::WriteLine( "Display the title element..." ); + Console::WriteLine( root[ "title" ]->OuterXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..931cd16856c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Collections; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "2books.xml" ); + + //Get and display all the book titles. + XmlElement^ root = doc->DocumentElement; + XmlNodeList^ elemList = root->GetElementsByTagName( "title" ); + IEnumerator^ ienum = elemList->GetEnumerator(); + while ( ienum->MoveNext() ) + { + XmlNode^ title = dynamic_cast(ienum->Current); + Console::WriteLine( title->InnerText ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp new file mode 100644 index 00000000000..8fcc0d2c019 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeList.Item Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + " First item" + " Second item" + "" ); + + //Get and display the last item node. + XmlElement^ root = doc->DocumentElement; + XmlNodeList^ nodeList = root->GetElementsByTagName( "item" ); + Console::WriteLine( nodeList->Item( 1 )->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp new file mode 100644 index 00000000000..91353be15eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.AttributeCount Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " " + "" ); + + //Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + + //Read the attributes on the root element. + reader->MoveToContent(); + if ( reader->HasAttributes ) + { + for ( int i = 0; i < reader->AttributeCount; i++ ) + { + reader->MoveToAttribute( i ); + Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); + + } + reader->MoveToElement(); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp new file mode 100644 index 00000000000..d3287716081 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.BaseURI Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load an XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "http://localhost/uri.xml" ); + reader = gcnew XmlNodeReader( doc ); + + //Parse the file and display the base URI for each node. + while ( reader->Read() ) + { + Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..5b0e8725b23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.GetAttribute Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " " + "" ); + + // Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + + //Read the ISBN attribute. + reader->MoveToContent(); + String^ isbn = reader->GetAttribute( "ISBN" ); + Console::WriteLine( "The ISBN value: {0}", isbn ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp new file mode 100644 index 00000000000..009705ea4c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.HasValue Example/CPP/source.cpp @@ -0,0 +1,42 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + // Create and load an XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "]>" + "" + "Pride And Prejudice" + "&h;" + "" ); + reader = gcnew XmlNodeReader( doc ); + + // Parse the file and display each node. + while ( reader->Read() ) + { + if ( reader->HasValue ) + Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); + else + Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp new file mode 100644 index 00000000000..a63f00d1f68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.IsEmptyElement Example/CPP/source.cpp @@ -0,0 +1,54 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Pride And Prejudice" + "19.95" + "" + "" ); + + //Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + + //Parse the XML and display the text content of each of the elements. + while ( reader->Read() ) + { + if ( reader->IsStartElement() ) + { + if ( reader->IsEmptyElement ) + Console::WriteLine( "<{0}/>", reader->Name ); + else + { + Console::Write( "<{0}> ", reader->Name ); + reader->Read(); //Read the start tag. + if ( reader->IsStartElement() ) + + //Handle nested elements. + Console::Write( "\r\n<{0}>", reader->Name ); + Console::WriteLine( reader->ReadString() ); //Read the text content of the element. + } + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..255f2c6a1da --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToFirstAttribute Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" ); + + //Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + + //Read the genre attribute. + reader->MoveToContent(); + reader->MoveToFirstAttribute(); + String^ genre = reader->Value; + Console::WriteLine( "The genre value: {0}", genre ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..2d6857ce16e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.MoveToNextAttribute Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " " + "Pride And Prejudice" + "19.95" + "" ); + + //Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + + //Read the attributes on the book element. + reader->MoveToContent(); + while ( reader->MoveToNextAttribute() ) + { + Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); + } + + //Move the reader to the title element. + reader->Read(); + + //Read the title and price elements. + Console::WriteLine( reader->ReadElementString() ); + Console::WriteLine( reader->ReadElementString() ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..b596f0cbf8c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Name Example/CPP/source.cpp @@ -0,0 +1,67 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + String^ filename = "items.xml"; + XmlNodeReader^ reader = nullptr; + try + { + + //Create an XmlNodeReader to read the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( filename ); + reader = gcnew XmlNodeReader( doc ); + + //Parse the file and display each of the nodes. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( "<{0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( reader->Value ); + break; + + case XmlNodeType::CDATA: + Console::Write( reader->Value ); + break; + + case XmlNodeType::ProcessingInstruction: + Console::Write( "", reader->Name, reader->Value ); + break; + + case XmlNodeType::Comment: + Console::Write( "", reader->Value ); + break; + + case XmlNodeType::XmlDeclaration: + Console::Write( "" ); + break; + + case XmlNodeType::Document: + break; + + case XmlNodeType::EndElement: + Console::Write( "", reader->Name ); + break; + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp new file mode 100644 index 00000000000..209660c6243 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.NamespaceURI Example/CPP/source.cpp @@ -0,0 +1,49 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( " " + "Pride And Prejudice" + "novel" + "" ); + + //Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + + //Parse the XML. If they exist, display the prefix and + //namespace URI of each node. + while ( reader->Read() ) + { + if ( reader->IsStartElement() ) + { + if ( reader->Prefix == String::Empty ) + Console::WriteLine( "<{0}>", reader->LocalName ); + else + { + Console::Write( "<{0}:{1}>", reader->Prefix, reader->LocalName ); + Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI ); + } + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp new file mode 100644 index 00000000000..fa8f90ee268 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ReadAttributeValue Example/CPP/source.cpp @@ -0,0 +1,46 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load an XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "" ); + + //Create the reader. + reader = gcnew XmlNodeReader( doc ); + + //Read the misc attribute. The attribute is parsed into multiple + //text and entity reference nodes. + reader->MoveToContent(); + reader->MoveToAttribute( "misc" ); + while ( reader->ReadAttributeValue() ) + { + if ( reader->NodeType == XmlNodeType::EntityReference ) + + //To expand the entity, call ResolveEntity. + Console::WriteLine( "{0} {1}", reader->NodeType, reader->Name ); + else + Console::WriteLine( "{0} {1}", reader->NodeType, reader->Value ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp new file mode 100644 index 00000000000..a980ac2665e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.ResolveEntity Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load an XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "]>" + "" + "Pride And Prejudice" + "&h;" + "" ); + + //Create the reader. + reader = gcnew XmlNodeReader( doc ); + reader->MoveToContent(); //Move to the root element. + reader->Read(); //Move to title start tag. + reader->Skip(); //Skip the title element. + + //Read the misc start tag. The reader is now positioned on + //the entity reference node. + reader->ReadStartElement(); + + //You must call ResolveEntity to expand the entity reference. + //The entity replacement text is then parsed and returned as a child node. + Console::WriteLine( "Expand the entity..." ); + reader->ResolveEntity(); + Console::WriteLine( "The entity replacement text is returned as a text node." ); + reader->Read(); + Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value ); + Console::WriteLine( "An EndEntity node closes the entity reference scope." ); + reader->Read(); + Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp new file mode 100644 index 00000000000..cb90b873442 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlNodeReader.Skip Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlNodeReader^ reader = nullptr; + try + { + + //Create and load the XML document. + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "" + "Pride And Prejudice" + "19.95" + "" ); + + //Load the XmlNodeReader + reader = gcnew XmlNodeReader( doc ); + reader->MoveToContent(); //Move to the book node. + reader->Read(); //Read the book start tag. + reader->Skip(); //Skip the title element. + Console::WriteLine( reader->ReadOuterXml() ); //Read the price element. + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..7658108b64d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.HasAttributes Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; +using namespace System::Xml::Schema; + +public ref class Class1 +{ +// +public: + void DisplayAttributes( XmlReader^ reader ) + { + if ( reader->HasAttributes ) + { + Console::WriteLine( "Attributes of <{0}>", reader->Name ); + while ( reader->MoveToNextAttribute() ) + { + Console::WriteLine( " {0}={1}", reader->Name, reader->Value ); + } + } + } +// +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp new file mode 100644 index 00000000000..4d1aa635c0e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.IsStartElement Example/CPP/source.cpp @@ -0,0 +1,46 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + try + { + + //Load the reader with the XML file. + reader = gcnew XmlTextReader( "elems.xml" ); + + //Parse the XML and display the text content of each of the elements. + while ( reader->Read() ) + { + if ( reader->IsStartElement() ) + { + if ( reader->IsEmptyElement ) + Console::WriteLine( "<{0}/>", reader->Name ); + else + { + Console::Write( "<{0}> ", reader->Name ); + reader->Read(); //Read the start tag. + if ( reader->IsStartElement() ) + + //Handle nested elements. + Console::Write( "\r\n<{0}>", reader->Name ); + Console::WriteLine( reader->ReadString() ); //Read the text content of the element. + } + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp new file mode 100644 index 00000000000..05bb06db971 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlReader.MoveToContent Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + String^ _price; + +public: + void Method( XmlReader^ reader ) + { +// + if ( reader->MoveToContent() == XmlNodeType::Element && + reader->Name->Equals( "price" ) ) + { + _price = reader->ReadString(); + } +// + } +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp new file mode 100644 index 00000000000..2ecb603c997 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchema Example/CPP/source.cpp @@ -0,0 +1,97 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + static void Main() + { + + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ elementCat = gcnew XmlSchemaElement(); + schema->Items->Add(elementCat); + elementCat->Name = "cat"; + elementCat->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementDog = gcnew XmlSchemaElement(); + schema->Items->Add(elementDog); + elementDog->Name = "dog"; + elementDog->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementRedDog = gcnew XmlSchemaElement(); + schema->Items->Add(elementRedDog); + elementRedDog->Name = "redDog"; + elementRedDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); + + // + XmlSchemaElement^ elementBrownDog = gcnew XmlSchemaElement(); + schema->Items->Add(elementBrownDog); + elementBrownDog->Name = "brownDog"; + elementBrownDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); + + + // + XmlSchemaElement^ elementPets = gcnew XmlSchemaElement(); + schema->Items->Add(elementPets); + elementPets->Name = "pets"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + elementPets->SchemaType = complexType; + + // + XmlSchemaChoice^ choice = gcnew XmlSchemaChoice(); + complexType->Particle = choice; + choice->MinOccurs = 0; + choice->MaxOccursString = "unbounded"; + + // + XmlSchemaElement^ catRef = gcnew XmlSchemaElement(); + choice->Items->Add(catRef); + catRef->RefName = gcnew XmlQualifiedName("cat"); + + // + XmlSchemaElement^ dogRef = gcnew XmlSchemaElement(); + choice->Items->Add(dogRef); + dogRef->RefName = gcnew XmlQualifiedName("dog"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// + + diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp new file mode 100644 index 00000000000..d410a9785b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAll Example/CPP/source.cpp @@ -0,0 +1,100 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + XmlSchemaElement^ thing1 = gcnew XmlSchemaElement(); + thing1->Name = "thing1"; + thing1->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + schema->Items->Add(thing1); + + XmlSchemaElement^ thing2 = gcnew XmlSchemaElement(); + thing2->Name = "thing2"; + thing2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + schema->Items->Add(thing2); + + XmlSchemaElement^ thing3 = gcnew XmlSchemaElement(); + thing3->Name = "thing3"; + thing3->SchemaTypeName = + gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + schema->Items->Add(thing3); + + XmlSchemaElement^ thing4 = gcnew XmlSchemaElement(); + thing4->Name = "thing4"; + thing4->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + schema->Items->Add(thing4); + + XmlSchemaAttribute^ myAttribute = gcnew XmlSchemaAttribute(); + myAttribute->Name = "myAttribute"; + myAttribute->SchemaTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); + schema->Items->Add(myAttribute); + + XmlSchemaComplexType^ myComplexType = gcnew XmlSchemaComplexType(); + myComplexType->Name = "myComplexType"; + + XmlSchemaAll^ complexType_all = gcnew XmlSchemaAll(); + + XmlSchemaElement^ complexType_all_thing1 = gcnew XmlSchemaElement(); + complexType_all_thing1->RefName = gcnew XmlQualifiedName("thing1", ""); + complexType_all->Items->Add(complexType_all_thing1); + + XmlSchemaElement^ complexType_all_thing2 = gcnew XmlSchemaElement(); + complexType_all_thing2->RefName = gcnew XmlQualifiedName("thing2", ""); + complexType_all->Items->Add(complexType_all_thing2); + + XmlSchemaElement^ complexType_all_thing3 = gcnew XmlSchemaElement(); + complexType_all_thing3->RefName = gcnew XmlQualifiedName("thing3", ""); + complexType_all->Items->Add(complexType_all_thing3); + + XmlSchemaElement^ complexType_all_thing4 = gcnew XmlSchemaElement(); + complexType_all_thing4->RefName = gcnew XmlQualifiedName("thing4", ""); + complexType_all->Items->Add(complexType_all_thing4); + + myComplexType->Particle = complexType_all; + + XmlSchemaAttribute^ complexType_myAttribute = gcnew XmlSchemaAttribute(); + complexType_myAttribute->RefName = gcnew XmlQualifiedName("myAttribute", ""); + myComplexType->Attributes->Add(complexType_myAttribute); + + schema->Items->Add(myComplexType); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp new file mode 100644 index 00000000000..0da1a34fd86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnnotation Example/CPP/source.cpp @@ -0,0 +1,115 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + static void Main() + { + + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType(); + simpleType->Name = "northwestStates"; + schema->Items->Add(simpleType); + + // + XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation(); + simpleType->Annotation = annNorthwestStates; + + // States in the Pacific Northwest of US + XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation(); + annNorthwestStates->Items->Add(docNorthwestStates); + docNorthwestStates->Markup = TextToNodeArray("States in the Pacific Northwest of US"); + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + simpleType->Content = restriction; + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaEnumerationFacet^ enumerationWA = gcnew XmlSchemaEnumerationFacet(); + restriction->Facets->Add(enumerationWA); + enumerationWA->Value = "WA"; + + // + XmlSchemaAnnotation^ annWA = gcnew XmlSchemaAnnotation(); + enumerationWA->Annotation = annWA; + + // Washington + XmlSchemaDocumentation^ docWA = gcnew XmlSchemaDocumentation(); + annWA->Items->Add(docWA); + docWA->Markup = TextToNodeArray("Washington"); + + // + XmlSchemaEnumerationFacet^ enumerationOR = gcnew XmlSchemaEnumerationFacet(); + restriction->Facets->Add(enumerationOR); + enumerationOR->Value = "OR"; + + // + XmlSchemaAnnotation^ annOR = gcnew XmlSchemaAnnotation(); + enumerationOR->Annotation = annOR; + + // Oregon + XmlSchemaDocumentation^ docOR = gcnew XmlSchemaDocumentation(); + annOR->Items->Add(docOR); + docOR->Markup = TextToNodeArray("Oregon"); + + // + XmlSchemaEnumerationFacet^ enumerationID = gcnew XmlSchemaEnumerationFacet(); + + restriction->Facets->Add(enumerationID); + enumerationID->Value = "ID"; + + // + XmlSchemaAnnotation^ annID = gcnew XmlSchemaAnnotation(); + enumerationID->Annotation = annID; + + // Idaho + XmlSchemaDocumentation^ docID = gcnew XmlSchemaDocumentation(); + annID->Items->Add(docID); + docID->Markup = TextToNodeArray("Idaho"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + + static array^ TextToNodeArray(String^ text) + { + XmlDocument^ doc = gcnew XmlDocument(); + array^ temp = {doc->CreateTextNode(text)}; + return temp; + } + +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp new file mode 100644 index 00000000000..de4222ca95d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAny Example/CPP/source.cpp @@ -0,0 +1,70 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ xeHtmlText = gcnew XmlSchemaElement(); + xeHtmlText->Name = "htmlText"; + + // + XmlSchemaComplexType^ ct = gcnew XmlSchemaComplexType(); + + // + XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence(); + + // + XmlSchemaAny^ any = gcnew XmlSchemaAny(); + any->MinOccurs = 1; + any->MaxOccursString = "unbounded"; + any->Namespace = "http://www.w3.org/1999/xhtml"; + any->ProcessContents = XmlSchemaContentProcessing::Lax; + sequence->Items->Add(any); + + ct->Particle = sequence; + xeHtmlText->SchemaType = ct; + + schema->Items->Add(xeHtmlText); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + schema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..17a9abb810d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAnyAttribute Example/CPP/source.cpp @@ -0,0 +1,68 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + schema->Items->Add(element); + element->Name = "stringElementWithAnyAttribute"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + element->SchemaType = complexType; + + // + XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent(); + complexType->ContentModel = simpleContent; + + // + XmlSchemaSimpleContentExtension^ extension = gcnew XmlSchemaSimpleContentExtension(); + simpleContent->Content = extension; + extension->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAnyAttribute^ anyAttribute = gcnew XmlSchemaAnyAttribute(); + extension->AnyAttribute = anyAttribute; + anyAttribute->Namespace = "##targetNamespace"; + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp new file mode 100644 index 00000000000..cb4bdbb1014 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAppInfo Example/CPP/source.cpp @@ -0,0 +1,72 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + schema->Items->Add(element); + element->Name = "State"; + + // + XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation(); + element->Annotation = annNorthwestStates; + + // State Name + XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation(); + annNorthwestStates->Items->Add(docNorthwestStates); + docNorthwestStates->Markup = TextToNodeArray("State Name"); + + // Application Information + XmlSchemaAppInfo^ appInfo = gcnew XmlSchemaAppInfo(); + annNorthwestStates->Items->Add(appInfo); + appInfo->Markup = TextToNodeArray("Application Information"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + + Console::WriteLine(args->Message); + } + + static array^ TextToNodeArray(String^ text) + { + XmlDocument^ doc = gcnew XmlDocument(); + array^ nodes = {doc->CreateTextNode(text)}; + return nodes; + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..083c98e686d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttribute Example/CPP/source.cpp @@ -0,0 +1,74 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaAttribute^ attributeBase = gcnew XmlSchemaAttribute(); + schema->Items->Add(attributeBase); + attributeBase->Name = "mybaseattribute"; + + // + XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType(); + attributeBase->SchemaType = simpleType; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + simpleType->Content = restriction; + restriction->BaseTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet(); + restriction->Facets->Add(maxInclusive); + maxInclusive->Value = "1000"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + schema->Items->Add(complexType); + complexType->Name = "myComplexType"; + + // + XmlSchemaAttribute^ attributeBaseRef = gcnew XmlSchemaAttribute(); + complexType->Attributes->Add(attributeBaseRef); + attributeBaseRef->RefName = gcnew XmlQualifiedName("mybaseattribute"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp new file mode 100644 index 00000000000..465d8de18d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaAttributeGroup Example/CPP/source.cpp @@ -0,0 +1,106 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaAttributeGroup^ myAttributeGroup = gcnew XmlSchemaAttributeGroup(); + schema->Items->Add(myAttributeGroup); + myAttributeGroup->Name = "myAttributeGroup"; + + // + XmlSchemaAttribute^ someattribute1 = gcnew XmlSchemaAttribute(); + myAttributeGroup->Attributes->Add(someattribute1); + someattribute1->Name = "someattribute1"; + someattribute1->SchemaTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema"); + + + // + XmlSchemaAttribute^ someattribute2 = gcnew XmlSchemaAttribute(); + myAttributeGroup->Attributes->Add(someattribute2); + someattribute2->Name = "someattribute2"; + someattribute2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaComplexType^ myElementType = gcnew XmlSchemaComplexType(); + schema->Items->Add(myElementType); + myElementType->Name = "myElementType"; + + // + XmlSchemaAttributeGroupRef^ myAttributeGroupRef = gcnew XmlSchemaAttributeGroupRef(); + myElementType->Attributes->Add(myAttributeGroupRef); + myAttributeGroupRef->RefName = gcnew XmlQualifiedName("myAttributeGroup"); + + // + XmlSchemaAttributeGroup^ myAttributeGroupA = gcnew XmlSchemaAttributeGroup(); + schema->Items->Add(myAttributeGroupA); + myAttributeGroupA->Name = "myAttributeGroupA"; + + // + XmlSchemaAttribute^ someattribute10 = gcnew XmlSchemaAttribute(); + myAttributeGroupA->Attributes->Add(someattribute10); + someattribute10->Name = "someattribute10"; + someattribute10->SchemaTypeName = gcnew XmlQualifiedName("integer", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAttribute^ someattribute11 = gcnew XmlSchemaAttribute(); + myAttributeGroupA->Attributes->Add(someattribute11); + someattribute11->Name = "someattribute11"; + someattribute11->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAttributeGroup^ myAttributeGroupB = gcnew XmlSchemaAttributeGroup(); + schema->Items->Add(myAttributeGroupB); + myAttributeGroupB->Name = "myAttributeGroupB"; + + // + XmlSchemaAttribute^ someattribute20 = gcnew XmlSchemaAttribute(); + myAttributeGroupB->Attributes->Add(someattribute20); + someattribute20->Name = "someattribute20"; + someattribute20->SchemaTypeName = gcnew XmlQualifiedName("date", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAttributeGroupRef^ myAttributeGroupRefA = gcnew XmlSchemaAttributeGroupRef(); + myAttributeGroupB->Attributes->Add(myAttributeGroupRefA); + myAttributeGroupRefA->RefName = gcnew XmlQualifiedName("myAttributeGroupA"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp new file mode 100644 index 00000000000..d73de8b2cf6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaChoice Example/CPP/source.cpp @@ -0,0 +1,96 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ xeSelected = gcnew XmlSchemaElement(); + xeSelected->Name = "selected"; + schema->Items->Add(xeSelected); + + // + XmlSchemaElement^ xeUnselected = gcnew XmlSchemaElement(); + xeUnselected->Name = "unselected"; + schema->Items->Add(xeUnselected); + + // + XmlSchemaElement^ xeDimpled = gcnew XmlSchemaElement(); + xeDimpled->Name = "dimpled"; + schema->Items->Add(xeDimpled); + + // + XmlSchemaElement^ xePerforated = gcnew XmlSchemaElement(); + xePerforated->Name = "perforated"; + schema->Items->Add(xePerforated); + + // + XmlSchemaComplexType^ chadState = gcnew XmlSchemaComplexType(); + schema->Items->Add(chadState); + chadState->Name = "chadState"; + + // + XmlSchemaChoice^ choice = gcnew XmlSchemaChoice(); + chadState->Particle = choice; + choice->MinOccurs = 1; + choice->MaxOccurs = 1; + + // + XmlSchemaElement^ elementSelected = gcnew XmlSchemaElement(); + choice->Items->Add(elementSelected); + elementSelected->RefName = gcnew XmlQualifiedName("selected"); + + // + XmlSchemaElement^ elementUnselected = gcnew XmlSchemaElement(); + choice->Items->Add(elementUnselected); + elementUnselected->RefName = gcnew XmlQualifiedName("unselected"); + + // + XmlSchemaElement^ elementDimpled = gcnew XmlSchemaElement(); + choice->Items->Add(elementDimpled); + elementDimpled->RefName = gcnew XmlQualifiedName("dimpled"); + + // + XmlSchemaElement^ elementPerforated = gcnew XmlSchemaElement(); + choice->Items->Add(elementPerforated); + elementPerforated->RefName = gcnew XmlQualifiedName("perforated"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..b9bf69edc70 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; +using namespace System::Xml::Schema; + +public ref class Class1 +{ + // +public: + void DisplaySchemas( XmlSchemaCollection^ xsc ) + { + XmlSchemaCollectionEnumerator^ ienum = xsc->GetEnumerator(); + while ( ienum->MoveNext() ) + { + XmlSchema^ schema = ienum->Current; + StringWriter^ sw = gcnew StringWriter; + XmlTextWriter^ writer = gcnew XmlTextWriter( sw ); + writer->Formatting = Formatting::Indented; + writer->Indentation = 2; + schema->Write( writer ); + Console::WriteLine( sw ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..9dfc421ef93 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaCollection.this Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method( XmlSchemaCollection^ xsc ) + { + // + if ( xsc->Contains( "urn:bookstore-schema" ) ) + { + XmlSchema^ schema = xsc[ "urn:bookstore-schema" ]; + StringWriter^ sw = gcnew StringWriter; + XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( sw ); + xmlWriter->Formatting = Formatting::Indented; + xmlWriter->Indentation = 2; + schema->Write( xmlWriter ); + Console::WriteLine( sw ); + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp new file mode 100644 index 00000000000..65680c23fba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContent Example/CPP/source.cpp @@ -0,0 +1,103 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaComplexType^ address = gcnew XmlSchemaComplexType(); + schema->Items->Add(address); + address->Name = "address"; + + // + XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence(); + address->Particle = sequence; + + // + XmlSchemaElement^ elementName = gcnew XmlSchemaElement(); + sequence->Items->Add(elementName); + elementName->Name = "name"; + elementName->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementStreet = gcnew XmlSchemaElement(); + sequence->Items->Add(elementStreet); + elementStreet->Name = "street"; + elementStreet->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementCity = gcnew XmlSchemaElement(); + sequence->Items->Add(elementCity); + elementCity->Name = "city"; + elementCity->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaComplexType^ USAddress = gcnew XmlSchemaComplexType(); + schema->Items->Add(USAddress); + USAddress->Name = "USAddress"; + + // + XmlSchemaComplexContent^ complexContent = gcnew XmlSchemaComplexContent(); + USAddress->ContentModel = complexContent; + + // + XmlSchemaComplexContentExtension^ extensionAddress = gcnew XmlSchemaComplexContentExtension(); + complexContent->Content = extensionAddress; + extensionAddress->BaseTypeName = gcnew XmlQualifiedName("address"); + + // + XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence(); + extensionAddress->Particle = sequence2; + + // + XmlSchemaElement^ elementUSState = gcnew XmlSchemaElement(); + sequence2->Items->Add(elementUSState); + elementUSState->Name = "state"; + elementUSState->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + + // + XmlSchemaElement^ elementZipcode = gcnew XmlSchemaElement(); + sequence2->Items->Add(elementZipcode); + elementZipcode->Name = "zipcode"; + elementZipcode->SchemaTypeName = gcnew XmlQualifiedName("positiveInteger", "http://www.w3.org/2001/XMLSchema"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp new file mode 100644 index 00000000000..8c05936319d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaComplexContentRestriction Example/CPP/source.cpp @@ -0,0 +1,118 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaComplexType^ phoneNumber = gcnew XmlSchemaComplexType(); + phoneNumber->Name = "phoneNumber"; + + // + XmlSchemaSequence^ phoneNumberSequence = gcnew XmlSchemaSequence(); + + // + XmlSchemaElement^ areaCode1 = gcnew XmlSchemaElement(); + areaCode1->MinOccurs = 0; + areaCode1->MaxOccursString = "1"; + areaCode1->Name = "areaCode"; + phoneNumberSequence->Items->Add(areaCode1); + + // + XmlSchemaElement^ prefix1 = gcnew XmlSchemaElement(); + prefix1->MinOccurs = 1; + prefix1->MaxOccursString = "1"; + prefix1->Name = "prefix"; + phoneNumberSequence->Items->Add(prefix1); + + // + XmlSchemaElement^ number1 = gcnew XmlSchemaElement(); + number1->MinOccurs = 1; + number1->MaxOccursString = "1"; + number1->Name = "number"; + phoneNumberSequence->Items->Add(number1); + + phoneNumber->Particle = phoneNumberSequence; + + schema->Items->Add(phoneNumber); + + // + XmlSchemaComplexType^ localPhoneNumber = gcnew XmlSchemaComplexType(); + localPhoneNumber->Name = "localPhoneNumber"; + + // + XmlSchemaComplexContent^ complexContent = gcnew XmlSchemaComplexContent(); + + // + XmlSchemaComplexContentRestriction^ restriction = gcnew XmlSchemaComplexContentRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("phoneNumber", ""); + + // + XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence(); + + // + XmlSchemaElement^ areaCode2 = gcnew XmlSchemaElement(); + areaCode2->MinOccurs = 0; + areaCode2->MaxOccursString = "1"; + areaCode2->Name = "areaCode"; + sequence2->Items->Add(areaCode2); + + // + XmlSchemaElement^ prefix2 = gcnew XmlSchemaElement(); + prefix2->MinOccurs = 1; + prefix2->MaxOccursString = "1"; + prefix2->Name = "prefix"; + sequence2->Items->Add(prefix2); + + // + XmlSchemaElement^ number2 = gcnew XmlSchemaElement(); + number2->MinOccurs = 1; + number2->MaxOccursString = "1"; + number2->Name = "number"; + sequence2->Items->Add(number2); + + restriction->Particle = sequence2; + complexContent->Content = restriction; + localPhoneNumber->ContentModel = complexContent; + + schema->Items->Add(localPhoneNumber); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp new file mode 100644 index 00000000000..6381b6b7526 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaEnumerationFacet Example/CPP/source.cpp @@ -0,0 +1,89 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ SizeType = gcnew XmlSchemaSimpleType(); + SizeType->Name = "SizeType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaEnumerationFacet^ enumerationSmall = gcnew XmlSchemaEnumerationFacet(); + enumerationSmall->Value = "Small"; + restriction->Facets->Add(enumerationSmall); + + // + XmlSchemaEnumerationFacet^ enumerationMedium = gcnew XmlSchemaEnumerationFacet(); + enumerationMedium->Value = "Medium"; + restriction->Facets->Add(enumerationMedium); + + // + XmlSchemaEnumerationFacet^ enumerationLarge = gcnew XmlSchemaEnumerationFacet(); + enumerationLarge->Value = "Large"; + restriction->Facets->Add(enumerationLarge); + + SizeType->Content = restriction; + + schema->Items->Add(SizeType); + + // + XmlSchemaElement^ elementItem = gcnew XmlSchemaElement(); + elementItem->Name = "Item"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ attributeSize = gcnew XmlSchemaAttribute(); + attributeSize->Name = "Size"; + attributeSize->SchemaTypeName = gcnew XmlQualifiedName("SizeType", ""); + complexType->Attributes->Add(attributeSize); + + elementItem->SchemaType = complexType; + + schema->Items->Add(elementItem); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp new file mode 100644 index 00000000000..b7af3eb044a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaException Example/CPP/source.cpp @@ -0,0 +1,66 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class ValidXsd +{ +public: + + static void Main() + { + FileStream^ fs; + XmlSchema^ schema; + + try + { + fs = gcnew FileStream("example.xsd", FileMode::Open); + schema = XmlSchema::Read(fs, gcnew ValidationEventHandler(ShowCompileError)); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ShowCompileError); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + schema = compiledSchema; + + if (schema->IsCompiled) + { + // Schema is successfully compiled. + // Do something with it here. + + } + } + catch (XmlSchemaException^ e) + { + Console::WriteLine("LineNumber = {0}", e->LineNumber); + Console::WriteLine("LinePosition = {0}", e->LinePosition); + Console::WriteLine("Message = {0}", e->Message); + } + + } + + static void ShowCompileError(Object^ sender, ValidationEventArgs^ e) + { + Console::WriteLine("Validation Error: {0}", e->Message); + } +}; + +int main() +{ + ValidXsd::Main(); + Console::ReadLine(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp new file mode 100644 index 00000000000..308c590aadf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaGroup Example/CPP/source.cpp @@ -0,0 +1,108 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ elementThing1 = gcnew XmlSchemaElement(); + schema->Items->Add(elementThing1); + elementThing1->Name = "thing1"; + elementThing1->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementThing2 = gcnew XmlSchemaElement(); + schema->Items->Add(elementThing2); + elementThing2->Name = "thing2"; + elementThing2->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementThing3 = gcnew XmlSchemaElement(); + schema->Items->Add(elementThing3); + elementThing3->Name = "thing3"; + elementThing3->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAttribute^ myAttribute = gcnew XmlSchemaAttribute(); + schema->Items->Add(myAttribute); + myAttribute->Name = "myAttribute"; + myAttribute->SchemaTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaGroup^ myGroupOfThings = gcnew XmlSchemaGroup(); + schema->Items->Add(myGroupOfThings); + myGroupOfThings->Name = "myGroupOfThings"; + + // + XmlSchemaSequence^ sequence = gcnew XmlSchemaSequence(); + myGroupOfThings->Particle = sequence; + + // + XmlSchemaElement^ elementThing1Ref = gcnew XmlSchemaElement(); + sequence->Items->Add(elementThing1Ref); + elementThing1Ref->RefName = gcnew XmlQualifiedName("thing1"); + + // + XmlSchemaElement^ elementThing2Ref = gcnew XmlSchemaElement(); + sequence->Items->Add(elementThing2Ref); + elementThing2Ref->RefName = gcnew XmlQualifiedName("thing2"); + + // + XmlSchemaElement^ elementThing3Ref = gcnew XmlSchemaElement(); + sequence->Items->Add(elementThing3Ref); + elementThing3Ref->RefName = gcnew XmlQualifiedName("thing3"); + + // + XmlSchemaComplexType^ myComplexType = gcnew XmlSchemaComplexType(); + schema->Items->Add(myComplexType); + myComplexType->Name = "myComplexType"; + + // + XmlSchemaGroupRef^ myGroupOfThingsRef = gcnew XmlSchemaGroupRef(); + myComplexType->Particle = myGroupOfThingsRef; + myGroupOfThingsRef->RefName = gcnew XmlQualifiedName("myGroupOfThings"); + + // + XmlSchemaAttribute^ myAttributeRef = gcnew XmlSchemaAttribute(); + myComplexType->Attributes->Add(myAttributeRef); + myAttributeRef->RefName = gcnew XmlQualifiedName("myAttribute"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp new file mode 100644 index 00000000000..4f5ccb60525 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaNotation Example/CPP/notation.cpp @@ -0,0 +1,52 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaNotation^ notation = gcnew XmlSchemaNotation(); + notation->Name = "jpeg"; + notation->Public = "image/jpeg"; + notation->System = "viewer.exe"; + + schema->Items->Add(notation); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp new file mode 100644 index 00000000000..320ba3c48fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject Example/CPP/source.cpp @@ -0,0 +1,89 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Reflection; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class ValidXSD +{ +private: + static void DisplayObjects(Object^ o) + { + DisplayObjects(o, ""); + } + + static void DisplayObjects(Object^ o, String^ indent) + { + Console::WriteLine("{0}{1}", indent, o); + + for each (PropertyInfo^ property1 in o->GetType()->GetProperties()) + { + if (property1->PropertyType->FullName == "System.Xml.Schema.XmlSchemaObjectCollection") + { + XmlSchemaObjectCollection^ childObjectCollection = dynamic_cast(property1->GetValue(o, nullptr)); + + for each (XmlSchemaObject^ schemaObject in childObjectCollection) + { + DisplayObjects(schemaObject, indent + "\t"); + } + } + } + } + + static void ShowCompileError(Object^ sender, ValidationEventArgs^ e) + { + Console::WriteLine("Validation Error: {0}", e->Message); + } + +public: + static int Main() + { + String^ xsd = "example.xsd"; + + FileStream^ fs; + XmlSchema^ schema; + try + { + fs = gcnew FileStream(xsd, FileMode::Open); + schema = XmlSchema::Read(fs, gcnew ValidationEventHandler(ShowCompileError)); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ShowCompileError); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + schema = compiledSchema; + + if (schema->IsCompiled) + { + DisplayObjects(schema); + } + return 0; + } + catch (XmlSchemaException^ e) + { + Console::WriteLine("LineNumber = {0}", e->LineNumber); + Console::WriteLine("LinePosition = {0}", e->LinePosition); + Console::WriteLine("Message = {0}", e->Message); + Console::WriteLine("Source = {0}", e->Source); + return -1; + } + } +}; + +int main() +{ + ValidXSD::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp new file mode 100644 index 00000000000..f4e63a564af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaObject.Namespaces Example/CPP/namespaces.cpp @@ -0,0 +1,30 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +int main() +{ + XmlSchema^ s = gcnew XmlSchema; + s->TargetNamespace = "myNamespace"; + s->Namespaces->Add( "myImpPrefix", "myImportNamespace" ); + + // Create the element. + XmlSchemaImport^ import = gcnew XmlSchemaImport; + import->Namespace = "myImportNamespace"; + import->SchemaLocation = "http://www.example.com/myImportNamespace"; + s->Includes->Add( import ); + + // Create an element and assign a type from imported schema. + XmlSchemaElement^ elem = gcnew XmlSchemaElement; + elem->SchemaTypeName = gcnew XmlQualifiedName( "importType","myImportNamespace" ); + elem->Name = "element1"; + s->Items->Add( elem ); + s->Write( Console::Out ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp new file mode 100644 index 00000000000..4c7edb2f322 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleContent Example/CPP/source.cpp @@ -0,0 +1,71 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XMLSchemaExamples +{ + +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ generalPrice = gcnew XmlSchemaElement(); + generalPrice->Name = "generalPrice"; + + // + XmlSchemaComplexType^ ct = gcnew XmlSchemaComplexType(); + + // + XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent(); + + // + XmlSchemaSimpleContentExtension^ simpleContent_extension = gcnew XmlSchemaSimpleContentExtension(); + simpleContent_extension->BaseTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAttribute^ currency = gcnew XmlSchemaAttribute(); + currency->Name = "currency"; + currency->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + simpleContent_extension->Attributes->Add(currency); + + simpleContent->Content = simpleContent_extension; + ct->ContentModel = simpleContent; + generalPrice->SchemaType = ct; + + schema->Items->Add(generalPrice); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp new file mode 100644 index 00000000000..35a881cdd78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSchemaSimpleType Example/CPP/source.cpp @@ -0,0 +1,100 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ LotteryNumberType = gcnew XmlSchemaSimpleType(); + LotteryNumberType->Name = "LotteryNumber"; + + // + XmlSchemaSimpleTypeRestriction^ LotteryNumberRestriction = gcnew XmlSchemaSimpleTypeRestriction(); + LotteryNumberRestriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMinInclusiveFacet^ minInclusive = gcnew XmlSchemaMinInclusiveFacet(); + minInclusive->Value = "1"; + LotteryNumberRestriction->Facets->Add(minInclusive); + + // + XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet(); + maxInclusive->Value = "99"; + LotteryNumberRestriction->Facets->Add(maxInclusive); + + LotteryNumberType->Content = LotteryNumberRestriction; + schema->Items->Add(LotteryNumberType); + + // + XmlSchemaSimpleType^ LotteryNumberListType = gcnew XmlSchemaSimpleType(); + LotteryNumberListType->Name = "LotteryNumberList"; + + // + XmlSchemaSimpleTypeList^ list = gcnew XmlSchemaSimpleTypeList(); + list->ItemTypeName = gcnew XmlQualifiedName("LotteryNumber", ""); + LotteryNumberListType->Content = list; + + schema->Items->Add(LotteryNumberListType); + + // + XmlSchemaSimpleType^ LotteryNumbersType = gcnew XmlSchemaSimpleType(); + LotteryNumbersType->Name = "LotteryNumbers"; + + // + XmlSchemaSimpleTypeRestriction^ LotteryNumbersRestriction = gcnew XmlSchemaSimpleTypeRestriction(); + LotteryNumbersRestriction->BaseTypeName = gcnew XmlQualifiedName("LotteryNumberList", ""); + + // + XmlSchemaLengthFacet^ length = gcnew XmlSchemaLengthFacet(); + length->Value = "5"; + LotteryNumbersRestriction->Facets->Add(length); + + LotteryNumbersType->Content = LotteryNumbersRestriction; + + schema->Items->Add(LotteryNumbersType); + + // + XmlSchemaElement^ TodaysLottery = gcnew XmlSchemaElement(); + TodaysLottery->Name = "TodaysLottery"; + TodaysLottery->SchemaTypeName = gcnew XmlQualifiedName("LotteryNumbers", ""); + + schema->Items->Add(TodaysLottery); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp new file mode 100644 index 00000000000..78ec91dd354 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlSignificantWhitespace.NodeType Example/CPP/source.cpp @@ -0,0 +1,119 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +public ref class Sample +{ +private: + XmlNode^ currNode; + XmlTextReader^ reader; + +public: + Sample() + { + reader = nullptr; + String^ filename = "space.xml"; + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "" + "Eva" + "Corets" + "" ); + Console::WriteLine( "InnerText before..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); + + // Add white space. + currNode = doc->DocumentElement; + XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" ); + currNode->InsertAfter( sigws, currNode->FirstChild ); + Console::WriteLine(); + Console::WriteLine( "InnerText after..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); + + // Save and then display the file. + doc->Save( filename ); + Console::WriteLine(); + Console::WriteLine( "Reading file..." ); + ReadFile( filename ); + } + + + // Parse the file and print out each node. + void ReadFile( String^ filename ) + { + try + { + reader = gcnew XmlTextReader( filename ); + String^ sNodeType = nullptr; + while ( reader->Read() ) + { + sNodeType = NodeTypeToString( reader->NodeType ); + + // Print the node type, name, and value. + Console::WriteLine( "{0}<{1}> {2}", sNodeType, reader->Name, reader->Value ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + + } + + static String^ NodeTypeToString( XmlNodeType nodetype ) + { + String^ sNodeType = nullptr; + switch ( nodetype ) + { + case XmlNodeType::None: + sNodeType = "None"; + break; + + case XmlNodeType::Element: + sNodeType = "Element"; + break; + + case XmlNodeType::Attribute: + sNodeType = "Attribute"; + break; + + case XmlNodeType::Text: + sNodeType = "Text"; + break; + + case XmlNodeType::Comment: + sNodeType = "Comment"; + break; + + case XmlNodeType::Document: + sNodeType = "Document"; + break; + + case XmlNodeType::Whitespace: + sNodeType = "Whitespace"; + break; + + case XmlNodeType::SignificantWhitespace: + sNodeType = "SignificantWhitespace"; + break; + + case XmlNodeType::EndElement: + sNodeType = "EndElement"; + break; + } + return sNodeType; + } + +}; + +int main() +{ + gcnew Sample; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp new file mode 100644 index 00000000000..47a0236b987 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.BaseURI Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + try + { + + //Load the reader with the XML file. + reader = gcnew XmlTextReader( "http://localhost/baseuri.xml" ); + + //Parse the file and display the base URI for each node. + while ( reader->Read() ) + { + Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp new file mode 100644 index 00000000000..e63d63dc208 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetAttribute1 Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + try + { + + //Load the reader with the XML file. + reader = gcnew XmlTextReader( "attrs.xml" ); + + //Read the ISBN attribute. + reader->MoveToContent(); + String^ isbn = reader->GetAttribute( "ISBN" ); + Console::WriteLine( "The ISBN value: {0}", isbn ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp new file mode 100644 index 00000000000..f61a0885d7c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.GetRemainder Example/CPP/source.cpp @@ -0,0 +1,82 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + String^ filename = "tworeads.xml"; + XmlTextReader^ reader = gcnew XmlTextReader( filename ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Read the first part of the XML document + while ( reader->Read() ) + { + + // Display the elements and stop reading on the book endelement tag + // then go to ReadPart2 to start another reader to read the rest of the file. + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::WriteLine( "Name: {0}", reader->Name ); + break; + + case XmlNodeType::Text: + Console::WriteLine( " Element Text: {0}", reader->Value ); + break; + + case XmlNodeType::EndElement: + + // Stop reading when the reader gets to the end element of the book node. + if ( "book" == reader->LocalName ) + { + Console::WriteLine( "End reading first book..." ); + Console::WriteLine(); + goto ReadPart2; + } + break; + } + } + + + // Read the rest of the XML document + +ReadPart2: + Console::WriteLine( "Begin reading second book..." ); + + // Create a new reader to read the rest of the document. + XmlTextReader^ reader2 = gcnew XmlTextReader( reader->GetRemainder() ); + while ( reader2->Read() ) + { + switch ( reader2->NodeType ) + { + case XmlNodeType::Element: + Console::WriteLine( "Name: {0}", reader2->Name ); + break; + + case XmlNodeType::Text: + Console::WriteLine( " Element Text: {0}", reader2->Value ); + break; + + case XmlNodeType::EndElement: + + // Stop reading when the reader gets to the end element of the book node. + if ( "book" == reader2->LocalName ) + { + Console::WriteLine( "End reading second book..." ); + goto Done; + } + break; + } + } + + +Done: + Console::WriteLine( "Done." ); + reader->Close(); + reader2->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp new file mode 100644 index 00000000000..96ecc78d7af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.HasValue Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + try + { + + //Load the reader with the XML file. + reader = gcnew XmlTextReader( "book1.xml" ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + //Parse the file and display each node. + while ( reader->Read() ) + { + if ( reader->HasValue ) + Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); + else + Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp new file mode 100644 index 00000000000..a5d564f75ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.LocalName Example/CPP/source.cpp @@ -0,0 +1,42 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + try + { + + // Load the reader with the XML file. + reader = gcnew XmlTextReader( "book2.xml" ); + + // Parse the file. If they exist, display the prefix and + // namespace URI of each node. + while ( reader->Read() ) + { + if ( reader->IsStartElement() ) + { + if ( reader->Prefix == String::Empty ) + Console::WriteLine( "<{0}>", reader->LocalName ); + else + { + Console::Write( "<{0}:{1}>", reader->Prefix, reader->LocalName ); + Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI ); + } + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp new file mode 100644 index 00000000000..21a005822c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToElement Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; + +public ref class Class1 +{ + // +public: + void DisplayAttributes( XmlReader^ reader ) + { + if ( reader->HasAttributes ) + { + Console::WriteLine( "Attributes of <{0}>", reader->Name ); + for ( int i = 0; i < reader->AttributeCount; i++ ) + { + reader->MoveToAttribute( i ); + Console::Write( " {0}={1}", reader->Name, reader->Value ); + + } + reader->MoveToElement(); //Moves the reader back to the element node. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..b5a9bd22ca6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.MoveToFirstAttribute Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + try + { + + //Load the reader with the XML file. + reader = gcnew XmlTextReader( "attrs.xml" ); + + //Read the genre attribute. + reader->MoveToContent(); + reader->MoveToFirstAttribute(); + String^ genre = reader->Value; + Console::WriteLine( "The genre value: {0}", genre ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..e6fe1c8a26a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.Name Example/CPP/source.cpp @@ -0,0 +1,74 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + String^ filename = "items.xml"; + try + { + + // Load the reader with the data file and ignore all white space nodes. + reader = gcnew XmlTextReader( filename ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Parse the file and display each of the nodes. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( "<{0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( reader->Value ); + break; + + case XmlNodeType::CDATA: + Console::Write( "", reader->Value ); + break; + + case XmlNodeType::ProcessingInstruction: + Console::Write( "", reader->Name, reader->Value ); + break; + + case XmlNodeType::Comment: + Console::Write( "", reader->Value ); + break; + + case XmlNodeType::XmlDeclaration: + Console::Write( "" ); + break; + + case XmlNodeType::Document: + break; + + case XmlNodeType::DocumentType: + Console::Write( "Name, reader->Value ); + break; + + case XmlNodeType::EntityReference: + Console::Write( reader->Name ); + break; + + case XmlNodeType::EndElement: + Console::Write( "", reader->Name ); + break; + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp new file mode 100644 index 00000000000..e47fe405c6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadBase64 Example/CPP/source.cpp @@ -0,0 +1,61 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + String^ filename = "binary.xml"; + try + { + reader = gcnew XmlTextReader( filename ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Read the file. Stop at the Base64 element. + while ( reader->Read() ) + { + if ( "Base64" == reader->Name ) + break; + } + + // Read the Base64 data. Write the decoded + // bytes to the console. + Console::WriteLine( "Reading Base64... " ); + int base64len = 0; + array^base64 = gcnew array(1000); + do + { + base64len = reader->ReadBase64( base64, 0, 50 ); + for ( int i = 0; i < base64len; i++ ) + Console::Write( base64[ i ] ); + } + while ( reader->Name->Equals( "Base64" ) ); + + // Read the BinHex data. Write the decoded + // bytes to the console. + Console::WriteLine( "\r\nReading BinHex..." ); + int binhexlen = 0; + array^binhex = gcnew array(1000); + do + { + binhexlen = reader->ReadBinHex( binhex, 0, 50 ); + for ( int i = 0; i < binhexlen; i++ ) + Console::Write( binhex[ i ] ); + } + while ( reader->Name->Equals( "BinHex" ) ); + } + finally + { + Console::WriteLine(); + Console::WriteLine( "Processing of the file {0} complete.", filename ); + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp new file mode 100644 index 00000000000..f4197a14142 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.ReadChars Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; + +// Reads an XML document using ReadChars +int main() +{ + XmlTextReader^ reader = nullptr; + String^ filename = "items.xml"; + try + { + + // Declare variables used by ReadChars + array^buffer; + int iCnt = 0; + int charbuffersize; + + // Load the reader with the data file. Ignore white space. + reader = gcnew XmlTextReader( filename ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Set variables used by ReadChars. + charbuffersize = 10; + buffer = gcnew array(charbuffersize); + + // Parse the file. Read the element content + // using the ReadChars method. + reader->MoveToContent(); + while ( (iCnt = reader->ReadChars( buffer, 0, charbuffersize )) > 0 ) + { + + // Print out chars read and the buffer contents. + Console::WriteLine( " Chars read to buffer:{0}", iCnt ); + Console::WriteLine( " Buffer: [{0}]", gcnew String( buffer,0,iCnt ) ); + + // Clear the buffer. + Array::Clear( buffer, 0, charbuffersize ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp new file mode 100644 index 00000000000..f64733ec447 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextReader.WhitespaceHandling Example/CPP/source.cpp @@ -0,0 +1,69 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +void ReadXML( XmlParserContext^ context, String^ xmlFrag, WhitespaceHandling ws ) +{ + + //Create the reader and specify the WhitespaceHandling setting. + XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); + reader->WhitespaceHandling = ws; + + //Parse the XML and display each of the nodes. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::WriteLine( "{0}: <{1}>", reader->NodeType, reader->Name ); + break; + + case XmlNodeType::Text: + Console::WriteLine( "{0}: {1}", reader->NodeType, reader->Value ); + break; + + case XmlNodeType::EndElement: + Console::WriteLine( "{0}: ", reader->NodeType, reader->Name ); + break; + + case XmlNodeType::Whitespace: + Console::WriteLine( "{0}:", reader->NodeType ); + break; + + case XmlNodeType::SignificantWhitespace: + Console::WriteLine( "{0}:", reader->NodeType ); + break; + } + } + + + //Close the reader. + reader->Close(); +} + +int main() +{ + + //Create the XML fragment to be parsed. + String^ xmlFrag = " " + " Pride And Prejudice" + " novel" + ""; + + //Create the XmlNamespaceManager. + NameTable^ nt = gcnew NameTable; + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); + + //Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::Default ); + Console::WriteLine( "Read the XML and ignore all white space..." ); + ReadXML( context, xmlFrag, WhitespaceHandling::None ); + Console::WriteLine( "\r\nRead the XML including white space nodes..." ); + ReadXML( context, xmlFrag, WhitespaceHandling::All ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp new file mode 100644 index 00000000000..fb1cc689964 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.Formatting Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create a writer to write XML to the console. + XmlTextWriter^ writer = nullptr; + writer = gcnew XmlTextWriter( Console::Out ); + + //Use indentation for readability. + writer->Formatting = Formatting::Indented; + writer->Indentation = 4; + + //Write an element (this one is the root). + writer->WriteStartElement( "book" ); + + //Write the title element. + writer->WriteStartElement( "title" ); + writer->WriteString( "Pride And Prejudice" ); + writer->WriteEndElement(); + + //Write the close tag for the root element. + writer->WriteEndElement(); + + //Write the XML to file and close the writer. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp new file mode 100644 index 00000000000..f9eaffb0162 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteEndElement Example/CPP/source.cpp @@ -0,0 +1,75 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextWriter^ writer = nullptr; + String^ filename = "sampledata.xml"; + writer = gcnew XmlTextWriter( filename, nullptr ); + + //Use indenting for readability. + writer->Formatting = Formatting::Indented; + + //Write the XML delcaration + writer->WriteStartDocument(); + + //Write the ProcessingInstruction node. + String^ PItext = "type=\"text/xsl\" href=\"book.xsl\""; + writer->WriteProcessingInstruction( "xml-stylesheet", PItext ); + + //Write the DocumentType node. + writer->WriteDocType( "book", nullptr, nullptr, "" ); + + //Write a Comment node. + writer->WriteComment( "sample XML" ); + + //Write the root element. + writer->WriteStartElement( "book" ); + + //Write the genre attribute. + writer->WriteAttributeString( "genre", "novel" ); + + //Write the ISBN attribute. + writer->WriteAttributeString( "ISBN", "1-8630-014" ); + + //Write the title. + writer->WriteElementString( "title", "The Handmaid's Tale" ); + + //Write the style element. + writer->WriteStartElement( "style" ); + writer->WriteEntityRef( "h" ); + writer->WriteEndElement(); + + //Write the price. + writer->WriteElementString( "price", "19.95" ); + + //Write CDATA. + writer->WriteCData( "Prices 15% off!!" ); + + //Write the close tag for the root element. + writer->WriteEndElement(); + writer->WriteEndDocument(); + + //Write the XML to file and close the writer. + writer->Flush(); + writer->Close(); + + //Load the file into an XmlDocument to ensure well formed XML. + XmlDocument^ doc = gcnew XmlDocument; + + //Preserve white space for readability. + doc->PreserveWhitespace = true; + + //Load the file. + doc->Load( filename ); + + //Display the XML content to the console. + Console::Write( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp new file mode 100644 index 00000000000..51d524810dc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteFullEndElement Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create a writer to write XML to the console. + XmlTextWriter^ writer = nullptr; + writer = gcnew XmlTextWriter( Console::Out ); + + //Use indentation for readability. + writer->Formatting = Formatting::Indented; + + //Write an element (this one is the root). + writer->WriteStartElement( "order" ); + + //Write some attributes. + writer->WriteAttributeString( "date", "2/19/01" ); + writer->WriteAttributeString( "orderID", "136A5" ); + + //Write a full end element. Because this element has no + //content, calling WriteEndElement would have written a + //short end tag '/>'. + writer->WriteFullEndElement(); + + //Write the XML to file and close the writer + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp new file mode 100644 index 00000000000..2adeaa8ff54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteQualifiedName Example/CPP/source.cpp @@ -0,0 +1,53 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextWriter^ writer = nullptr; + String^ filename = "sampledata.xml"; + writer = gcnew XmlTextWriter( filename, nullptr ); + + // Use indenting for readability. + writer->Formatting = Formatting::Indented; + + // Write the root element. + writer->WriteStartElement( "schema" ); + + // Write the namespace declarations. + writer->WriteAttributeString( "xmlns", nullptr, "http://www.w3.org/2001/XMLSchema" ); + writer->WriteAttributeString( "xmlns", "po", nullptr, "http://contoso.com/po" ); + writer->WriteStartElement( "element" ); + writer->WriteAttributeString( "name", "purchaseOrder" ); + + // Write the type attribute. + writer->WriteStartAttribute( nullptr, "type", nullptr ); + writer->WriteQualifiedName( "PurchaseOrder", "http://contoso.com/po" ); + writer->WriteEndAttribute(); + writer->WriteEndElement(); + + // Write the close tag for the root element. + writer->WriteEndElement(); + + // Write the XML to file and close the writer. + writer->Flush(); + writer->Close(); + + // Read the file back in and parse to ensure well formed XML. + XmlDocument^ doc = gcnew XmlDocument; + + // Preserve white space for readability. + doc->PreserveWhitespace = true; + + // Load the file. + doc->Load( filename ); + + // Write the XML content to the console. + Console::Write( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp new file mode 100644 index 00000000000..147d3385162 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteRaw1 Example/CPP/source.cpp @@ -0,0 +1,40 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create a writer that outputs to the console. + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + + // Write the root element. + writer->WriteStartElement( "Items" ); + + // Write a string using WriteRaw. Note that the special + // characters are not escaped. + writer->WriteStartElement( "Item" ); + writer->WriteString( "Write unescaped text: " ); + writer->WriteRaw( "this & that" ); + writer->WriteEndElement(); + + // Write the same string using WriteString. Note that the + // special characters are escaped. + writer->WriteStartElement( "Item" ); + writer->WriteString( "Write the same string using WriteString: " ); + writer->WriteString( "this & that" ); + writer->WriteEndElement(); + + // Write the close tag for the root element. + writer->WriteEndElement(); + + // Write the XML to file and close the writer. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..7ebefe6b4d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartDocument Example/CPP/source.cpp @@ -0,0 +1,75 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextWriter^ writer = nullptr; + String^ filename = "sampledata.xml"; + writer = gcnew XmlTextWriter( filename, nullptr ); + + //Use indenting for readability. + writer->Formatting = Formatting::Indented; + + //Write the XML delcaration. + writer->WriteStartDocument(); + + //Write the ProcessingInstruction node. + String^ PItext = "type='text/xsl' href='book.xsl'"; + writer->WriteProcessingInstruction( "xml-stylesheet", PItext ); + + //Write the DocumentType node. + writer->WriteDocType( "book", nullptr, nullptr, "" ); + + //Write a Comment node. + writer->WriteComment( "sample XML" ); + + //Write a root element. + writer->WriteStartElement( "book" ); + + //Write the genre attribute. + writer->WriteAttributeString( "genre", "novel" ); + + //Write the ISBN attribute. + writer->WriteAttributeString( "ISBN", "1-8630-014" ); + + //Write the title. + writer->WriteElementString( "title", "The Handmaid's Tale" ); + + //Write the style element. + writer->WriteStartElement( "style" ); + writer->WriteEntityRef( "h" ); + writer->WriteEndElement(); + + //Write the price. + writer->WriteElementString( "price", "19.95" ); + + //Write CDATA. + writer->WriteCData( "Prices 15% off!!" ); + + //Write the close tag for the root element. + writer->WriteEndElement(); + writer->WriteEndDocument(); + + //Write the XML to file and close the writer. + writer->Flush(); + writer->Close(); + + //Load the file into an XmlDocument to ensure well formed XML. + XmlDocument^ doc = gcnew XmlDocument; + + //Preserve white space for readability. + doc->PreserveWhitespace = true; + + //Load the file. + doc->Load( filename ); + + //Display the XML content to the console. + Console::Write( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp new file mode 100644 index 00000000000..d18c68662b6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteStartElement Example/CPP/source.cpp @@ -0,0 +1,67 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + String^ filename = "sampledata.xml"; + XmlTextWriter^ writer = gcnew XmlTextWriter( filename, nullptr ); + + //Use indenting for readability. + writer->Formatting = Formatting::Indented; + writer->WriteComment( "sample XML fragment" ); + + //Write an element (this one is the root). + writer->WriteStartElement( "bookstore" ); + + //Write the namespace declaration. + writer->WriteAttributeString( "xmlns", "bk", nullptr, "urn:samples" ); + writer->WriteStartElement( "book" ); + + //Lookup the prefix and then write the ISBN attribute. + String^ prefix = writer->LookupPrefix( "urn:samples" ); + writer->WriteStartAttribute( prefix, "ISBN", "urn:samples" ); + writer->WriteString( "1-861003-78" ); + writer->WriteEndAttribute(); + + //Write the title. + writer->WriteStartElement( "title" ); + writer->WriteString( "The Handmaid's Tale" ); + writer->WriteEndElement(); + + //Write the price. + writer->WriteElementString( "price", "19.95" ); + + //Write the style element. + writer->WriteStartElement( prefix, "style", "urn:samples" ); + writer->WriteString( "hardcover" ); + writer->WriteEndElement(); + + //Write the end tag for the book element. + writer->WriteEndElement(); + + //Write the close tag for the root element. + writer->WriteEndElement(); + + //Write the XML to file and close the writer. + writer->Flush(); + writer->Close(); + + //Read the file back in and parse to ensure well formed XML. + XmlDocument^ doc = gcnew XmlDocument; + + //Preserve white space for readability. + doc->PreserveWhitespace = true; + + //Load the file + doc->Load( filename ); + + //Write the XML content to the console. + Console::Write( doc->InnerXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp new file mode 100644 index 00000000000..ef94526fc30 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.WriteTimeSpan Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlTextWriter^ writer = nullptr; + try + { + writer = gcnew XmlTextWriter( Console::Out ); + + // Write an element. + writer->WriteStartElement( "address" ); + + // Write an email address using entities + // for the @ and . characters. + writer->WriteString( "someone" ); + writer->WriteCharEntity( '@' ); + writer->WriteString( "example" ); + writer->WriteCharEntity( '.' ); + writer->WriteString( "com" ); + writer->WriteEndElement(); + } + finally + { + + // Close the writer. + if ( writer != nullptr ) + writer->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp new file mode 100644 index 00000000000..e5fd8acae1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlTextWriter.XmlSpace Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the writer. + XmlTextWriter^ writer = nullptr; + writer = gcnew XmlTextWriter( "ws.html", nullptr ); + + // Write an element (this one is the root). + writer->WriteStartElement( "p" ); + + // Write the xml:space attribute. + writer->WriteAttributeString( "xml", "space", nullptr, "preserve" ); + + // Verify that xml:space is set properly. + if ( writer->XmlSpace == XmlSpace::Preserve ) + Console::WriteLine( "xmlspace is correct!" ); + + + // Write out the HTML elements. Insert white space + // between 'something' and 'Big' + writer->WriteString( "something" ); + writer->WriteWhitespace( " " ); + writer->WriteElementString( "b", "B" ); + writer->WriteString( "ig" ); + + // Write the root end element. + writer->WriteEndElement(); + + // Write the XML to file and close the writer. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp new file mode 100644 index 00000000000..be6e39b350c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlUrlResolver.ResolveUri Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; + +int main() +{ + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + Uri^ baseUri = gcnew Uri( "http://servername/tmp/test.xsl" ); + Uri^ fulluri = resolver->ResolveUri( baseUri, "includefile.xsl" ); + + // Get a stream object containing the XSL file + Stream^ s = dynamic_cast(resolver->GetEntity( fulluri, nullptr, Stream::typeid )); + + // Read the stream object displaying the contents of the XSL file + XmlTextReader^ reader = gcnew XmlTextReader( s ); + while ( reader->Read() ) + { + Console::WriteLine( reader->ReadOuterXml() ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp new file mode 100644 index 00000000000..ff06ae7ba94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp @@ -0,0 +1,49 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlValidatingReader^ reader = nullptr; + try + { + + //Create the string to parse. + String^ xmlFrag = " "; + + //Create the XmlNamespaceManager. + NameTable^ nt = gcnew NameTable; + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); + + //Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); + + //Create the XmlValidatingReader . + reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); + + //Read the attributes on the root element. + reader->MoveToContent(); + if ( reader->HasAttributes ) + { + for ( int i = 0; i < reader->AttributeCount; i++ ) + { + reader->MoveToAttribute( i ); + Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); + + } + reader->MoveToElement(); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp new file mode 100644 index 00000000000..a62f1c24651 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlValidatingReader^ reader = nullptr; + XmlTextReader^ txtreader = nullptr; + try + { + + //Create the validating reader. + txtreader = gcnew XmlTextReader( "http://localhost/uri.xml" ); + reader = gcnew XmlValidatingReader( txtreader ); + reader->ValidationType = ValidationType::None; + + //Parse the file and display the base URI for each node. + while ( reader->Read() ) + { + Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..05e5e364a1d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the validating reader. + XmlTextReader^ txtreader = gcnew XmlTextReader( "attrs.xml" ); + XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); + + //Read the ISBN attribute. + reader->MoveToContent(); + String^ isbn = reader->GetAttribute( "ISBN" ); + Console::WriteLine( "The ISBN value: {0}", isbn ); + + //Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp new file mode 100644 index 00000000000..2ce1e6eba01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the validating reader. + XmlTextReader^ txtreader = gcnew XmlTextReader( "book1.xml" ); + txtreader->WhitespaceHandling = WhitespaceHandling::None; + XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); + reader->ValidationType = ValidationType::None; + + //Parse the file and each node and its value. + while ( reader->Read() ) + { + if ( reader->HasValue ) + Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); + else + Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); + } + + + //Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp new file mode 100644 index 00000000000..bd57e805816 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp @@ -0,0 +1,48 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ txtreader = nullptr; + XmlValidatingReader^ reader = nullptr; + try + { + + //Implement the readers. + txtreader = gcnew XmlTextReader( "elems.xml" ); + reader = gcnew XmlValidatingReader( txtreader ); + + //Parse the XML and display the text content of each of the elements. + while ( reader->Read() ) + { + if ( reader->IsStartElement() ) + { + if ( reader->IsEmptyElement ) + Console::WriteLine( "<{0}/>", reader->Name ); + else + { + Console::Write( "<{0}> ", reader->Name ); + reader->Read(); //Read the start tag. + if ( reader->IsStartElement() ) + + //Handle nested elements. + Console::Write( "\r\n<{0}>", reader->Name ); + Console::WriteLine( reader->ReadString() ); //Read the text content of the element. + } + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..3ce23489cc5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp @@ -0,0 +1,51 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlValidatingReader^ reader = nullptr; + try + { + + //Create the XML fragment to be parsed. + String^ xmlFrag = ""; + + //Create the XmlParserContext. + XmlParserContext^ context; + String^ subset = ""; + context = gcnew XmlParserContext( nullptr,nullptr,"book",nullptr,nullptr,subset,"","",XmlSpace::None ); + + //Create the reader and set it to not expand general entities. + reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); + reader->ValidationType = ValidationType::None; + reader->EntityHandling = EntityHandling::ExpandCharEntities; + + //Read the misc attribute. Because EntityHandling is set to + //ExpandCharEntities, the attribute is parsed into multiple text + //and entity reference nodes. + reader->MoveToContent(); + reader->MoveToAttribute( "misc" ); + while ( reader->ReadAttributeValue() ) + { + if ( reader->NodeType == XmlNodeType::EntityReference ) + + //To expand the entity, call ResolveEntity. + Console::WriteLine( "{0} {1}", reader->NodeType, reader->Name ); + else + Console::WriteLine( "{0} {1}", reader->NodeType, reader->Value ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..cdcfa93664a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + //Create the validating reader. + XmlTextReader^ txtreader = gcnew XmlTextReader( "attrs.xml" ); + XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); + + //Read the genre attribute. + reader->MoveToContent(); + reader->MoveToFirstAttribute(); + String^ genre = reader->Value; + Console::WriteLine( "The genre value: {0}", genre ); + + //Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..805e896e1d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp @@ -0,0 +1,79 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ txtreader = nullptr; + XmlValidatingReader^ reader = nullptr; + String^ filename = "items.xml"; + try + { + + //Load the reader with the data file and ignore all white space nodes. + txtreader = gcnew XmlTextReader( filename ); + txtreader->WhitespaceHandling = WhitespaceHandling::None; + + //Implement the validating reader over the text reader. + reader = gcnew XmlValidatingReader( txtreader ); + reader->ValidationType = ValidationType::None; + + //Parse the file and display each of the nodes. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( "<{0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( reader->Value ); + break; + + case XmlNodeType::CDATA: + Console::Write( "", reader->Value ); + break; + + case XmlNodeType::ProcessingInstruction: + Console::Write( "", reader->Name, reader->Value ); + break; + + case XmlNodeType::Comment: + Console::Write( "", reader->Value ); + break; + + case XmlNodeType::XmlDeclaration: + Console::Write( "" ); + break; + + case XmlNodeType::Document: + break; + + case XmlNodeType::DocumentType: + Console::Write( "Name, reader->Value ); + break; + + case XmlNodeType::EntityReference: + Console::Write( reader->Name ); + break; + + case XmlNodeType::EndElement: + Console::Write( "", reader->Name ); + break; + } + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp new file mode 100644 index 00000000000..233a1ec1a99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp @@ -0,0 +1,53 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlValidatingReader^ reader = nullptr; + XmlTextReader^ txtreader = nullptr; + try + { + + //Create and load the XmlTextReader with the XML file. + txtreader = gcnew XmlTextReader( "book1.xml" ); + txtreader->WhitespaceHandling = WhitespaceHandling::None; + + //Create the XmlValidatingReader over the XmlTextReader. + //Set the reader to not expand general entities. + reader = gcnew XmlValidatingReader( txtreader ); + reader->ValidationType = ValidationType::None; + reader->EntityHandling = EntityHandling::ExpandCharEntities; + reader->MoveToContent(); //Move to the root element. + reader->Read(); //Move to title start tag. + reader->Skip(); //Skip the title element. + + //Read the misc start tag. The reader is now positioned on + //the entity reference node. + reader->ReadStartElement(); + + //Because EntityHandling is set to ExpandCharEntities, you must call + //ResolveEntity to expand the entity. The entity replacement text is + //then parsed and returned as a child node. + Console::WriteLine( "Expand the entity..." ); + reader->ResolveEntity(); + Console::WriteLine( "The entity replacement text is returned as a text node." ); + reader->Read(); + Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value ); + Console::WriteLine( "An EndEntity node closes the entity reference scope." ); + reader->Read(); + Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name ); + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp new file mode 100644 index 00000000000..211a6e4604b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp @@ -0,0 +1,83 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; + +public ref class SchemaCollectionSample +{ +private: + XmlTextReader^ reader; + XmlValidatingReader^ vreader; + Boolean m_success; + +public: + SchemaCollectionSample() + { + reader = nullptr; + vreader = nullptr; + m_success = true; + + //Load the schema collection. + XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection; + String^ schema = "books.xsd"; + String^ schema1 = "schema1.xdr"; + xsc->Add( "urn:bookstore-schema", schema ); //XSD schema + xsc->Add( "urn:newbooks-schema", schema1 ); //XDR schema + String^ doc1 = "booksSchema.xml"; + String^ doc2 = "booksSchemaFail.xml"; + String^ doc3 = "newbooks.xml"; + + //Validate the files using schemas stored in the collection. + Validate( doc1, xsc ); //Should pass. + Validate( doc2, xsc ); //Should fail. + Validate( doc3, xsc ); //Should fail. + } + + +private: + void Validate( String^ filename, XmlSchemaCollection^ xsc ) + { + m_success = true; + Console::WriteLine(); + Console::WriteLine( "Validating XML file {0}...", filename ); + reader = gcnew XmlTextReader( filename ); + + //Create a validating reader. + vreader = gcnew XmlValidatingReader( reader ); + + //Validate using the schemas stored in the schema collection. + vreader->Schemas->Add( xsc ); + + //Set the validation event handler + vreader->ValidationEventHandler += gcnew ValidationEventHandler( this, &SchemaCollectionSample::ValidationCallBack ); + + //Read and validate the XML data. + while ( vreader->Read() ) + {} + + Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful" : "failed") ); + Console::WriteLine(); + + //Close the reader. + vreader->Close(); + } + + void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) + { + m_success = false; + Console::Write( "\r\n\tValidation error: {0}", args->Message ); + } + +}; + +int main() +{ + gcnew SchemaCollectionSample; +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp new file mode 100644 index 00000000000..bb70d44f9ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp @@ -0,0 +1,72 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +public ref class Sample +{ +private: + XmlTextReader^ txtreader; + XmlValidatingReader^ reader; + Boolean m_success; + +public: + Sample() + { + txtreader = nullptr; + reader = nullptr; + m_success = true; + + //Validate file against the XSD schema. + //The validation should fail. + Validate( "notValidXSD.xml" ); + } + + +private: + void Validate( String^ filename ) + { + try + { + Console::WriteLine( "Validating XML file {0}", filename ); + txtreader = gcnew XmlTextReader( filename ); + reader = gcnew XmlValidatingReader( txtreader ); + + // Set the validation event handler + reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationEventHandle ); + + // Read XML data + while ( reader->Read() ) + {} + Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful" : "failed") ); + } + finally + { + + //Close the reader. + if ( reader != nullptr ) + reader->Close(); + } + + } + + + //Display the validation error. + void ValidationEventHandle( Object^ /*sender*/, ValidationEventArgs^ args ) + { + m_success = false; + Console::WriteLine( "\r\n\tValidation error: {0}", args->Message ); + } + +}; + +int main() +{ + gcnew Sample; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp new file mode 100644 index 00000000000..a803c48b3ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp @@ -0,0 +1,90 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +public ref class Sample +{ +private: + XmlTextReader^ txtreader; + XmlValidatingReader^ reader; + Boolean m_success; + +public: + Sample() + { + txtreader = nullptr; + reader = nullptr; + m_success = true; + String^ doc1 = "notValid.xml"; + String^ doc2 = "cdDTD.xml"; + String^ doc3 = "book1.xml"; + + //Parse the files and validate when requested. + Validate( doc1, ValidationType::XDR ); //Validation should fail. + Validate( doc2, ValidationType::DTD ); //Validation should fail. + Validate( doc3, ValidationType::None ); //No validation performed. + } + + +private: + void Validate( String^ filename, ValidationType vt ) + { + try + { + + //Implement the readers. Set the ValidationType. + txtreader = gcnew XmlTextReader( filename ); + reader = gcnew XmlValidatingReader( txtreader ); + reader->ValidationType = vt; + + //If the reader is set to validate, set the event handler. + if ( vt == ValidationType::None ) + Console::WriteLine( "\nParsing XML file {0}", filename ); + else + { + Console::WriteLine( "\nValidating XML file {0}", filename ); + m_success = true; + + //Set the validation event handler. + reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationCallBack ); + } + + // Read XML data + while ( reader->Read() ) + {} + if ( vt == ValidationType::None ) + Console::WriteLine( "Finished parsing file." ); + else + Console::WriteLine( "Validation finished. Validation {0}", m_success ? (String^)"successful" : "failed" ); + } + finally + { + + //Close the reader. + if ( reader != nullptr ) + reader->Close(); + } + + } + + + //Display the validation errors. + void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) + { + m_success = false; + Console::Write( "\r\n\tValidation error: {0}", args->Message ); + } + +}; + +int main() +{ + gcnew Sample; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp new file mode 100644 index 00000000000..15790751077 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlWhitespace.NodeType Example/CPP/source.cpp @@ -0,0 +1,117 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +public ref class Sample +{ +private: + XmlNode^ currNode; + XmlTextReader^ reader; + +public: + Sample() + { + String^ filename = "space.xml"; + XmlDocument^ doc = gcnew XmlDocument; + doc->LoadXml( "" + "Eva" + "Corets" + "" ); + Console::WriteLine( "InnerText before..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); + + // Add white space. + currNode = doc->DocumentElement; + XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" ); + currNode->InsertAfter( ws, currNode->FirstChild ); + Console::WriteLine(); + Console::WriteLine( "InnerText after..." ); + Console::WriteLine( doc->DocumentElement->InnerText ); + + // Save and then display the file. + doc->Save( filename ); + Console::WriteLine(); + Console::WriteLine( "Reading file..." ); + ReadFile( filename ); + } + + + // Parse the file and display each node. + void ReadFile( String^ filename ) + { + try + { + reader = gcnew XmlTextReader( filename ); + String^ sNodeType = nullptr; + while ( reader->Read() ) + { + sNodeType = NodeTypeToString( reader->NodeType ); + + // Print the node type, name, and value. + Console::WriteLine( "{0}<{1}> {2}", sNodeType, reader->Name, reader->Value ); + } + } + finally + { + if ( reader != nullptr ) + reader->Close(); + } + + } + + static String^ NodeTypeToString( XmlNodeType nodetype ) + { + String^ sNodeType = nullptr; + switch ( nodetype ) + { + case XmlNodeType::None: + sNodeType = "None"; + break; + + case XmlNodeType::Element: + sNodeType = "Element"; + break; + + case XmlNodeType::Attribute: + sNodeType = "Attribute"; + break; + + case XmlNodeType::Text: + sNodeType = "Text"; + break; + + case XmlNodeType::Comment: + sNodeType = "Comment"; + break; + + case XmlNodeType::Document: + sNodeType = "Document"; + break; + + case XmlNodeType::Whitespace: + sNodeType = "Whitespace"; + break; + + case XmlNodeType::SignificantWhitespace: + sNodeType = "SignificantWhitespace"; + break; + + case XmlNodeType::EndElement: + sNodeType = "EndElement"; + break; + } + return sNodeType; + } + +}; + +int main() +{ + gcnew Sample; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp new file mode 100644 index 00000000000..fed23d6f782 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic WebData XslTransform.Transform7 Example/CPP/source.cpp @@ -0,0 +1,30 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; + +int main() +{ + String^ filename = "books.xml"; + String^ stylesheet = "output.xsl"; + + //Load the stylesheet. + XslTransform^ xslt = gcnew XslTransform; + xslt->Load( stylesheet ); + + //Load the file to transform. + XPathDocument^ doc = gcnew XPathDocument( filename ); + + //Create an XmlTextWriter which outputs to the console. + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + + //Transform the file and send the output to the console. + xslt->Transform(doc,nullptr,writer,nullptr); + writer->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp new file mode 100644 index 00000000000..3c119776397 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaComplexType Example/CPP/complextype.cpp @@ -0,0 +1,68 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + schema->Items->Add(element); + element->Name = "stringElementWithAnyAttribute"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + element->SchemaType = complexType; + + // + XmlSchemaSimpleContent^ simpleContent = gcnew XmlSchemaSimpleContent(); + complexType->ContentModel = simpleContent; + + // + XmlSchemaSimpleContentExtension^ extension = gcnew XmlSchemaSimpleContentExtension(); + simpleContent->Content = extension; + extension->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaAnyAttribute^ anyAttribute = gcnew XmlSchemaAnyAttribute(); + extension->AnyAttribute = anyAttribute; + anyAttribute->Namespace = "##targetNamespace"; + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp new file mode 100644 index 00000000000..92d06d54db3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDatatype Example/CPP/datatype.cpp @@ -0,0 +1,57 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlTextReader^ xtr = gcnew XmlTextReader("example.xsd"); + XmlSchema^ schema = XmlSchema::Read(xtr, gcnew ValidationEventHandler(ValidationCallbackOne)); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + for each (XmlSchemaObject^ schemaObject in compiledSchema->Items) + { + if (schemaObject->GetType() == XmlSchemaSimpleType::typeid) + { + XmlSchemaSimpleType^ simpleType = dynamic_cast(schemaObject); + Console::WriteLine("{0} {1}", simpleType->Name, simpleType->Datatype->ValueType); + } + if (schemaObject->GetType() == XmlSchemaComplexType::typeid) + { + XmlSchemaComplexType^ complexType = dynamic_cast(schemaObject); + Console::WriteLine("{0} {1}", complexType->Name, complexType->Datatype->ValueType); + } + } + xtr->Close(); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp new file mode 100644 index 00000000000..78ca73c17ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaDocumentation Example/CPP/documentation.cpp @@ -0,0 +1,114 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ simpleType = gcnew XmlSchemaSimpleType(); + simpleType->Name = "northwestStates"; + schema->Items->Add(simpleType); + + // + XmlSchemaAnnotation^ annNorthwestStates = gcnew XmlSchemaAnnotation(); + simpleType->Annotation = annNorthwestStates; + + // States in the Pacific Northwest of US + XmlSchemaDocumentation^ docNorthwestStates = gcnew XmlSchemaDocumentation(); + annNorthwestStates->Items->Add(docNorthwestStates); + docNorthwestStates->Markup = TextToNodeArray("States in the Pacific Northwest of US"); + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + simpleType->Content = restriction; + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaEnumerationFacet^ enumerationWA = gcnew XmlSchemaEnumerationFacet(); + restriction->Facets->Add(enumerationWA); + enumerationWA->Value = "WA"; + + // + XmlSchemaAnnotation^ annWA = gcnew XmlSchemaAnnotation(); + enumerationWA->Annotation = annWA; + + // Washington + XmlSchemaDocumentation^ docWA = gcnew XmlSchemaDocumentation(); + annWA->Items->Add(docWA); + docWA->Markup = TextToNodeArray("Washington"); + + // + XmlSchemaEnumerationFacet^ enumerationOR = gcnew XmlSchemaEnumerationFacet(); + restriction->Facets->Add(enumerationOR); + enumerationOR->Value = "OR"; + + // + XmlSchemaAnnotation^ annOR = gcnew XmlSchemaAnnotation(); + enumerationOR->Annotation = annOR; + + // Oregon + XmlSchemaDocumentation^ docOR = gcnew XmlSchemaDocumentation(); + annOR->Items->Add(docOR); + docOR->Markup = TextToNodeArray("Oregon"); + + // + XmlSchemaEnumerationFacet^ enumerationID = gcnew XmlSchemaEnumerationFacet(); + restriction->Facets->Add(enumerationID); + enumerationID->Value = "ID"; + + // + XmlSchemaAnnotation^ annID = gcnew XmlSchemaAnnotation(); + enumerationID->Annotation = annID; + + // Idaho + XmlSchemaDocumentation^ docID = gcnew XmlSchemaDocumentation(); + annID->Items->Add(docID); + docID->Markup = TextToNodeArray("Idaho"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + + static array^ TextToNodeArray(String^ text) + { + XmlDocument^ doc = gcnew XmlDocument(); + array^ nodes = gcnew array {doc->CreateTextNode(text)}; + return nodes; + } + +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp new file mode 100644 index 00000000000..cb71c94ba29 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaElement Example/CPP/element.cpp @@ -0,0 +1,94 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaElement^ elementCat = gcnew XmlSchemaElement(); + schema->Items->Add(elementCat); + elementCat->Name = "cat"; + elementCat->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementDog = gcnew XmlSchemaElement(); + schema->Items->Add(elementDog); + elementDog->Name = "dog"; + elementDog->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaElement^ elementRedDog = gcnew XmlSchemaElement(); + schema->Items->Add(elementRedDog); + elementRedDog->Name = "redDog"; + elementRedDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); + + // + XmlSchemaElement^ elementBrownDog = gcnew XmlSchemaElement(); + schema->Items->Add(elementBrownDog); + elementBrownDog->Name = "brownDog"; + elementBrownDog->SubstitutionGroup = gcnew XmlQualifiedName("dog"); + + // + XmlSchemaElement^ elementPets = gcnew XmlSchemaElement(); + schema->Items->Add(elementPets); + elementPets->Name = "pets"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + elementPets->SchemaType = complexType; + + // + XmlSchemaChoice^ choice = gcnew XmlSchemaChoice(); + complexType->Particle = choice; + choice->MinOccurs = 0; + choice->MaxOccursString = "unbounded"; + + // + XmlSchemaElement^ catRef = gcnew XmlSchemaElement(); + choice->Items->Add(catRef); + catRef->RefName = gcnew XmlQualifiedName("cat"); + + // + XmlSchemaElement^ dogRef = gcnew XmlSchemaElement(); + choice->Items->Add(dogRef); + dogRef->RefName = gcnew XmlQualifiedName("dog"); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp new file mode 100644 index 00000000000..acf2f9e018f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaFractionDigitsFacet Example/CPP/fractiondigitsfacet.cpp @@ -0,0 +1,84 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +class XmlSchemaExamples +{ +public: + + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ RatingType = gcnew XmlSchemaSimpleType(); + RatingType->Name = "RatingType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("decimal", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaTotalDigitsFacet^ totalDigits = gcnew XmlSchemaTotalDigitsFacet(); + totalDigits->Value = "2"; + restriction->Facets->Add(totalDigits); + + // + XmlSchemaFractionDigitsFacet^ fractionDigits = gcnew XmlSchemaFractionDigitsFacet(); + fractionDigits->Value = "1"; + restriction->Facets->Add(fractionDigits); + + RatingType->Content = restriction; + + schema->Items->Add(RatingType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "movie"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ ratingAttribute = gcnew XmlSchemaAttribute(); + ratingAttribute->Name = "rating"; + ratingAttribute->SchemaTypeName = gcnew XmlQualifiedName("RatingType", ""); + complexType->Attributes->Add(ratingAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } +}; + +int main() +{ + XmlSchemaExamples::Main(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp new file mode 100644 index 00000000000..777c38d292a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaInclude Example/CPP/import_include_sample.cpp @@ -0,0 +1,63 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class ImportIncludeSample +{ +private: + static void ValidationCallBack(Object^ sender, ValidationEventArgs^ args) + { + + if (args->Severity == XmlSeverityType::Warning) + Console::Write("WARNING: "); + else if (args->Severity == XmlSeverityType::Error) + Console::Write("ERROR: "); + + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + schema->ElementFormDefault = XmlSchemaForm::Qualified; + schema->TargetNamespace = "http://www.w3.org/2001/05/XMLInfoset"; + + // + XmlSchemaImport^ import = gcnew XmlSchemaImport(); + import->Namespace = "http://www.example.com/IPO"; + schema->Includes->Add(import); + + // + XmlSchemaInclude^ include = gcnew XmlSchemaInclude(); + include->SchemaLocation = "example.xsd"; + schema->Includes->Add(include); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } + +}; + +int main() +{ + ImportIncludeSample::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp new file mode 100644 index 00000000000..89d0bf0c37b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaKeyRef Example/CPP/key_sample.cpp @@ -0,0 +1,83 @@ +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Xml::Schema; +public ref class XmlSchemaObjectGenerator +{ +private: + static void ValidationCallback( Object^ /*sender*/, ValidationEventArgs^ args ) + { + if ( args->Severity == XmlSeverityType::Warning ) + Console::Write( "WARNING: " ); + else + if ( args->Severity == XmlSeverityType::Error ) + Console::Write( "ERROR: " ); + + Console::WriteLine( args->Message ); + } + + // XmlSchemaObjectGenerator + int main() + { + XmlTextReader^ tr = gcnew XmlTextReader( "empty.xsd" ); + XmlSchema^ schema = XmlSchema::Read( tr, gcnew ValidationEventHandler( XmlSchemaObjectGenerator::ValidationCallback ) ); + schema->ElementFormDefault = XmlSchemaForm::Qualified; + schema->TargetNamespace = "http://www.example.com/Report"; + { + XmlSchemaElement^ element = gcnew XmlSchemaElement; + element->Name = "purchaseReport"; + XmlSchemaComplexType^ element_complexType = gcnew XmlSchemaComplexType; + XmlSchemaSequence^ element_complexType_sequence = gcnew XmlSchemaSequence; + { + XmlSchemaElement^ element_complexType_sequence_element = gcnew XmlSchemaElement; + element_complexType_sequence_element->Name = "region"; + element_complexType_sequence_element->SchemaTypeName = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); + { + XmlSchemaKeyref^ element_complexType_sequence_element_keyref = gcnew XmlSchemaKeyref; + element_complexType_sequence_element_keyref->Name = "dummy2"; + element_complexType_sequence_element_keyref->Selector = gcnew XmlSchemaXPath; + element_complexType_sequence_element_keyref->Selector->XPath = "r:zip/r:part"; + { + XmlSchemaXPath^ field = gcnew XmlSchemaXPath; + field->XPath = "@number"; + element_complexType_sequence_element_keyref->Fields->Add( field ); + } + element_complexType_sequence_element_keyref->Refer = gcnew XmlQualifiedName( "pNumKey","http://www.example.com/Report" ); + element_complexType_sequence_element->Constraints->Add( element_complexType_sequence_element_keyref ); + } + element_complexType_sequence->Items->Add( element_complexType_sequence_element ); + } + element_complexType->Particle = element_complexType_sequence; + { + XmlSchemaAttribute^ element_complexType_attribute = gcnew XmlSchemaAttribute; + element_complexType_attribute->Name = "periodEnding"; + element_complexType_attribute->SchemaTypeName = gcnew XmlQualifiedName( "date","http://www.w3.org/2001/XMLSchema" ); + element_complexType->Attributes->Add( element_complexType_attribute ); + } + element->SchemaType = element_complexType; + { + XmlSchemaKey^ element_key = gcnew XmlSchemaKey; + element_key->Name = "pNumKey"; + element_key->Selector = gcnew XmlSchemaXPath; + element_key->Selector->XPath = "r:parts/r:part"; + { + XmlSchemaXPath^ field = gcnew XmlSchemaXPath; + field->XPath = "@number"; + element_key->Fields->Add( field ); + } + element->Constraints->Add( element_key ); + } + schema->Items->Add( element ); + } + schema->Write( Console::Out ); + + return 0; + } // main +}; +// diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp new file mode 100644 index 00000000000..47765242264 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaLengthFacet Example/CPP/lengthfacet.cpp @@ -0,0 +1,77 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); + ZipCodeType->Name = "ZipCodeType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaLengthFacet^ length = gcnew XmlSchemaLengthFacet(); + length->Value = "5"; + restriction->Facets->Add(length); + + ZipCodeType->Content = restriction; + + schema->Items->Add(ZipCodeType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "Address"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); + ZipCodeAttribute->Name = "ZipCode"; + ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); + complexType->Attributes->Add(ZipCodeAttribute); + + element->SchemaType = complexType; + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp new file mode 100644 index 00000000000..a66dd7e2553 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxExclusiveFacet Example/CPP/maxexclusivefacet.cpp @@ -0,0 +1,78 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ WaitQueueLengthType = gcnew XmlSchemaSimpleType(); + WaitQueueLengthType->Name = "WaitQueueLengthType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMaxExclusiveFacet^ maxExclusive = gcnew XmlSchemaMaxExclusiveFacet(); + maxExclusive->Value = "5"; + restriction->Facets->Add(maxExclusive); + + WaitQueueLengthType->Content = restriction; + + schema->Items->Add(WaitQueueLengthType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "Lobby"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ WaitQueueLengthAttribute = gcnew XmlSchemaAttribute(); + WaitQueueLengthAttribute->Name = "WaitQueueLength"; + WaitQueueLengthAttribute->SchemaTypeName = gcnew XmlQualifiedName("WaitQueueLengthType", ""); + complexType->Attributes->Add(WaitQueueLengthAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp new file mode 100644 index 00000000000..f27f5519922 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxInclusiveFacet Example/CPP/maxinclusivefacet.cpp @@ -0,0 +1,78 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ WaitQueueLengthType = gcnew XmlSchemaSimpleType(); + WaitQueueLengthType->Name = "WaitQueueLengthType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMaxInclusiveFacet^ maxInclusive = gcnew XmlSchemaMaxInclusiveFacet(); + maxInclusive->Value = "5"; + restriction->Facets->Add(maxInclusive); + + WaitQueueLengthType->Content = restriction; + + schema->Items->Add(WaitQueueLengthType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "Lobby"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ WaitQueueLengthAttribute = gcnew XmlSchemaAttribute(); + WaitQueueLengthAttribute->Name = "WaitQueueLength"; + WaitQueueLengthAttribute->SchemaTypeName = gcnew XmlQualifiedName("WaitQueueLengthType", ""); + complexType->Attributes->Add(WaitQueueLengthAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp new file mode 100644 index 00000000000..b50d96ac18d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMaxLengthFacet Example/CPP/maxlengthfacet.cpp @@ -0,0 +1,79 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); + ZipCodeType->Name = "ZipCodeType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMaxLengthFacet^ maxLength = gcnew XmlSchemaMaxLengthFacet(); + maxLength->Value = "10"; + restriction->Facets->Add(maxLength); + + ZipCodeType->Content = restriction; + + schema->Items->Add(ZipCodeType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "Address"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); + ZipCodeAttribute->Name = "ZipCode"; + ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); + + complexType->Attributes->Add(ZipCodeAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp new file mode 100644 index 00000000000..34816fb1131 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinExclusiveFacet Example/CPP/minexclusivefacet.cpp @@ -0,0 +1,78 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ OrderQuantityType = gcnew XmlSchemaSimpleType(); + OrderQuantityType->Name = "OrderQuantityType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMinExclusiveFacet^ MinExclusive = gcnew XmlSchemaMinExclusiveFacet(); + MinExclusive->Value = "5"; + restriction->Facets->Add(MinExclusive); + + OrderQuantityType->Content = restriction; + + schema->Items->Add(OrderQuantityType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "item"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ OrderQuantityAttribute = gcnew XmlSchemaAttribute(); + OrderQuantityAttribute->Name = "OrderQuantity"; + OrderQuantityAttribute->SchemaTypeName = gcnew XmlQualifiedName("OrderQuantityType", ""); + complexType->Attributes->Add(OrderQuantityAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp new file mode 100644 index 00000000000..8b460bf9a13 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinInclusiveFacet Example/CPP/mininclusivefacet.cpp @@ -0,0 +1,78 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ OrderQuantityType = gcnew XmlSchemaSimpleType(); + OrderQuantityType->Name = "OrderQuantityType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMinInclusiveFacet^ minInclusive = gcnew XmlSchemaMinInclusiveFacet(); + minInclusive->Value = "5"; + restriction->Facets->Add(minInclusive); + + OrderQuantityType->Content = restriction; + + schema->Items->Add(OrderQuantityType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "item"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ OrderQuantityAttribute = gcnew XmlSchemaAttribute(); + OrderQuantityAttribute->Name = "OrderQuantity"; + OrderQuantityAttribute->SchemaTypeName = gcnew XmlQualifiedName("OrderQuantityType", ""); + complexType->Attributes->Add(OrderQuantityAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp new file mode 100644 index 00000000000..7bc0e93f86c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaMinLengthFacet Example/CPP/minlengthfacet.cpp @@ -0,0 +1,79 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); + ZipCodeType->Name = "ZipCodeType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaMinLengthFacet^ minLength = gcnew XmlSchemaMinLengthFacet(); + minLength->Value = "5"; + restriction->Facets->Add(minLength); + + ZipCodeType->Content = restriction; + + schema->Items->Add(ZipCodeType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "Address"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); + ZipCodeAttribute->Name = "ZipCode"; + ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); + complexType->Attributes->Add(ZipCodeAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp new file mode 100644 index 00000000000..c21f9400afa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaPatternFacet Example/CPP/patternfacet.cpp @@ -0,0 +1,78 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ ZipCodeType = gcnew XmlSchemaSimpleType(); + ZipCodeType->Name = "ZipCodeType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaPatternFacet^ pattern = gcnew XmlSchemaPatternFacet(); + pattern->Value = "[0-9]{5}(-[0-9]{4})?"; + restriction->Facets->Add(pattern); + + ZipCodeType->Content = restriction; + + schema->Items->Add(ZipCodeType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "Address"; + + // + XmlSchemaComplexType^ complexType = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ ZipCodeAttribute = gcnew XmlSchemaAttribute(); + ZipCodeAttribute->Name = "ZipCode"; + ZipCodeAttribute->SchemaTypeName = gcnew XmlQualifiedName("ZipCodeType", ""); + complexType->Attributes->Add(ZipCodeAttribute); + + element->SchemaType = complexType; + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp new file mode 100644 index 00000000000..2f67440b88f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaSimpleTypeUnion Example/CPP/simpletypeunion.cpp @@ -0,0 +1,78 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ StringOrIntType = gcnew XmlSchemaSimpleType(); + StringOrIntType->Name = "StringOrIntType"; + schema->Items->Add(StringOrIntType); + + // + XmlSchemaSimpleTypeUnion^ union1 = gcnew XmlSchemaSimpleTypeUnion(); + StringOrIntType->Content = union1; + + // + XmlSchemaSimpleType^ simpleType1 = gcnew XmlSchemaSimpleType(); + union1->BaseTypes->Add(simpleType1); + + // + XmlSchemaSimpleTypeRestriction^ restriction1 = gcnew XmlSchemaSimpleTypeRestriction(); + restriction1->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + simpleType1->Content = restriction1; + + // + XmlSchemaSimpleType^ simpleType2 = gcnew XmlSchemaSimpleType(); + union1->BaseTypes->Add(simpleType2); + + // + XmlSchemaSimpleTypeRestriction^ restriction2 = gcnew XmlSchemaSimpleTypeRestriction(); + restriction2->BaseTypeName = gcnew XmlQualifiedName("int", "http://www.w3.org/2001/XMLSchema"); + simpleType2->Content = restriction2; + + + // + XmlSchemaElement^ elementSize = gcnew XmlSchemaElement(); + elementSize->Name = "size"; + elementSize->SchemaTypeName = gcnew XmlQualifiedName("StringOrIntType"); + schema->Items->Add(elementSize); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp new file mode 100644 index 00000000000..27611f0c5e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaUnique Example/CPP/unique.cpp @@ -0,0 +1,128 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaComplexType^ customerOrderType = gcnew XmlSchemaComplexType(); + customerOrderType->Name = "customerOrderType"; + + // + XmlSchemaSequence^ sequence1 = gcnew XmlSchemaSequence(); + + // + XmlSchemaElement^ item = gcnew XmlSchemaElement(); + item->MinOccurs = 0; + item->MaxOccursString = "unbounded"; + item->Name = "item"; + + // + XmlSchemaComplexType^ ct1 = gcnew XmlSchemaComplexType(); + + // + XmlSchemaAttribute^ itemID = gcnew XmlSchemaAttribute(); + itemID->Name = "itemID"; + itemID->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + ct1->Attributes->Add(itemID); + + // + item->SchemaType = ct1; + + // + sequence1->Items->Add(item); + customerOrderType->Particle = sequence1; + + // + XmlSchemaAttribute^ CustomerID = gcnew XmlSchemaAttribute(); + CustomerID->Name = "CustomerID"; + CustomerID->SchemaTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + customerOrderType->Attributes->Add(CustomerID); + + // + schema->Items->Add(customerOrderType); + + // + XmlSchemaElement^ ordersByCustomer = gcnew XmlSchemaElement(); + ordersByCustomer->Name = "ordersByCustomer"; + + // + XmlSchemaComplexType^ ct2 = gcnew XmlSchemaComplexType(); + + // + XmlSchemaSequence^ sequence2 = gcnew XmlSchemaSequence(); + + // + XmlSchemaElement^ customerOrders = gcnew XmlSchemaElement(); + customerOrders->MinOccurs = 0; + customerOrders->MaxOccursString = "unbounded"; + customerOrders->Name = "customerOrders"; + customerOrders->SchemaTypeName = gcnew XmlQualifiedName("customerOrderType", ""); + + // + sequence2->Items->Add(customerOrders); + + // + ct2->Particle = sequence2; + ordersByCustomer->SchemaType = ct2; + + // + XmlSchemaUnique^ element_unique = gcnew XmlSchemaUnique(); + element_unique->Name = "oneCustomerOrdersforEachCustomerID"; + + // + element_unique->Selector = gcnew XmlSchemaXPath(); + element_unique->Selector->XPath = "customerOrders"; + + // + XmlSchemaXPath^ field = gcnew XmlSchemaXPath(); + field->XPath = "@customerID"; + + // + element_unique->Fields->Add(field); + ordersByCustomer->Constraints->Add(element_unique); + + // + schema->Items->Add(ordersByCustomer); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp new file mode 100644 index 00000000000..82b40e0837b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/Classic Webdata XmlSchemaWhiteSpaceFacet Example/CPP/whitespacefacet.cpp @@ -0,0 +1,68 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XMLSchemaExamples +{ +private: + static void ValidationCallbackOne(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + XmlSchema^ schema = gcnew XmlSchema(); + + // + XmlSchemaSimpleType^ NameType = gcnew XmlSchemaSimpleType(); + NameType->Name = "NameType"; + + // + XmlSchemaSimpleTypeRestriction^ restriction = gcnew XmlSchemaSimpleTypeRestriction(); + restriction->BaseTypeName = gcnew XmlQualifiedName("string", "http://www.w3.org/2001/XMLSchema"); + + // + XmlSchemaWhiteSpaceFacet^ whiteSpace = gcnew XmlSchemaWhiteSpaceFacet(); + whiteSpace->Value = "collapse"; + restriction->Facets->Add(whiteSpace); + + NameType->Content = restriction; + + schema->Items->Add(NameType); + + // + XmlSchemaElement^ element = gcnew XmlSchemaElement(); + element->Name = "LastName"; + element->SchemaTypeName = gcnew XmlQualifiedName("NameType", ""); + + schema->Items->Add(element); + + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallbackOne); + schemaSet->Add(schema); + schemaSet->Compile(); + + XmlSchema^ compiledSchema = nullptr; + + for each (XmlSchema^ schema1 in schemaSet->Schemas()) + { + compiledSchema = schema1; + } + + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager(gcnew NameTable()); + nsmgr->AddNamespace("xs", "http://www.w3.org/2001/XMLSchema"); + compiledSchema->Write(Console::Out, nsmgr); + } +}; + +int main() +{ + XMLSchemaExamples::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp b/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp new file mode 100644 index 00000000000..31d19ed131b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/IHasXmlNode.GetNode/CPP/hasxmlnode.cpp @@ -0,0 +1,26 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::XPath; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + + // Create an XPathNavigator and select all books by Plato. + XPathNavigator^ nav = doc->CreateNavigator(); + XPathNodeIterator^ ni = nav->Select("descendant::book[author/name='Plato']"); + ni->MoveNext(); + + // Get the first matching node and change the book price. + XmlNode^ book = dynamic_cast(ni->Current)->GetNode(); + book->LastChild->InnerText = "12.95"; + Console::WriteLine( book->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp b/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp new file mode 100644 index 00000000000..8bc4192df74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/IXmlLineInfo/CPP/lineinfo.cpp @@ -0,0 +1,60 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XML fragment to be parsed. + String^ xmlFrag = "\n" + "\n" + "\n" + "240\n" + "\n" + "\n"; + + // Create the XmlNamespaceManager. + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( gcnew NameTable ); + + // Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); + + // Create the reader. + XmlValidatingReader^ reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); + IXmlLineInfo^ lineInfo = (dynamic_cast(reader)); + if ( lineInfo->HasLineInfo() ) + { + + // Parse the XML and display each node. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition ); + Console::WriteLine( "< {0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition ); + Console::WriteLine( " {0}", reader->Value ); + break; + + case XmlNodeType::EndElement: + Console::Write( " {0} {1}, {2} ", reader->Depth, lineInfo->LineNumber, lineInfo->LinePosition ); + Console::WriteLine( "", reader->Name ); + break; + } + } + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp b/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp new file mode 100644 index 00000000000..27ae8903478 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/NameTable/CPP/nametable.cpp @@ -0,0 +1,31 @@ + + +#using +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + + // + NameTable^ nt = gcnew NameTable; + Object^ book = nt->Add( "book" ); + Object^ price = nt->Add( "price" ); + + // Create the reader. + XmlReaderSettings ^ settings = gcnew XmlReaderSettings; + settings->NameTable = nt; + XmlReader^ reader = XmlReader::Create( (String^)"books.xml", settings ); + reader->MoveToContent(); + reader->ReadToDescendant( "book" ); + if ( System::Object::ReferenceEquals( book, reader->Name ) ) + { + + // Do additional processing. + } + // + //Close the reader. + reader->Close(); +} + diff --git a/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp b/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp new file mode 100644 index 00000000000..711f1bfbba1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/ValidationEventArgs.Severity/CPP/severity.cpp @@ -0,0 +1,67 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class Sample +{ +private: + static void Validate(String^ filename, XmlSchemaSet^ schemaSet) + { + Console::WriteLine(); + Console::WriteLine("\r\nValidating XML file {0}...", filename->ToString()); + + XmlSchema^ compiledSchema; + + for each (XmlSchema^ schema in schemaSet->Schemas()) + { + compiledSchema = schema; + } + + XmlReaderSettings^ settings = gcnew XmlReaderSettings(); + settings->Schemas->Add(compiledSchema); + settings->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack); + settings->ValidationType = ValidationType::Schema; + + //Create the schema validating reader. + XmlReader^ vreader = XmlReader::Create(filename, settings); + + while (vreader->Read()) { } + + //Close the reader. + vreader->Close(); + } + + //Display any warnings or errors. + static void ValidationCallBack(Object^ sender, ValidationEventArgs^ args) + { + if (args->Severity == XmlSeverityType::Warning) + Console::WriteLine("\tWarning: Matching schema not found. No validation occurred." + args->Message); + else + Console::WriteLine("\tValidation error: " + args->Message); + } + +public: + static void Main() + { + //Load the XmlSchemaSet. + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + schemaSet->Add("urn:bookstore-schema", "books.xsd"); + + //Validate the file using the schema stored in the schema set. + //Any elements belonging to the namespace "urn:cd-schema" generate + //a warning because there is no schema matching that namespace. + Validate("store.xml", schemaSet); + Console::ReadLine(); + } +}; + +int main() +{ + Sample::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp b/snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp new file mode 100644 index 00000000000..85e97372f69 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XPathExpression.ReturnType/CPP/returntype.cpp @@ -0,0 +1,54 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::XPath; + +// +public ref class Sample +{ +public: + static void Evaluate( XPathExpression^ expr, XPathNavigator^ nav ) + { + XPathNodeIterator^ i = nav->Select(expr); + switch ( expr->ReturnType ) + { + case XPathResultType::Number: + Console::WriteLine( nav->Evaluate( expr ) ); + break; + + case XPathResultType::NodeSet: + while ( i->MoveNext() ) + Console::WriteLine( i->Current ); + break; + + case XPathResultType::Boolean: + if ( *safe_cast(nav->Evaluate( expr )) ) + Console::WriteLine( "True!" ); + break; + + case XPathResultType::String: + Console::WriteLine( nav->Evaluate( expr ) ); + break; + } + } + +}; + +int main() +{ + XPathDocument^ doc = gcnew XPathDocument( "contosoBooks.xml" ); + XPathNavigator^ nav = doc->CreateNavigator(); + XPathExpression^ expr1 = nav->Compile( ".//price/text()*10" ); // Returns a number. + + XPathExpression^ expr2 = nav->Compile( "bookstore/book/price" ); // Returns a nodeset. + + Sample^ MySample = gcnew Sample; + MySample->Evaluate( expr1, nav ); + MySample->Evaluate( expr2, nav ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp b/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp new file mode 100644 index 00000000000..beabf44763b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XPathNavigatorMethods/CPP/xpathnavigatormethods.cpp @@ -0,0 +1,1166 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::XPath; +using namespace System::Collections; + +ref class XPathNavigatorMethods +{ +public: + + static String^ contosobooks = "C:\\Documents and Settings\\dylanm\\My Documents\\contosoBooks.xml"; + + static void XPathNavigatorMethods_AppendChild1() + { + // XPathNavigator->AppendChild() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlWriter^ pages = navigator->AppendChild(); + pages->WriteElementString("pages", "100"); + pages->Close(); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_AppendChild2() + { + // XPathNavigator->AppendChild(string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + navigator->AppendChild("100"); + + Console::WriteLine(navigator->OuterXml); + // + } + + + static void XPathNavigatorMethods_AppendChild3() + { + // XPathNavigator->AppendChile(XmlReader^) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); + + navigator->AppendChild(pages); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_AppendChild4() + { + // XPathNavigator->AppendChild(XPathNavigator^) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlDocument^ childNodes = gcnew XmlDocument(); + childNodes->Load(gcnew StringReader("100")); + XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); + + + if (childNodesNavigator->MoveToChild("pages", "http://www.contoso.com/books")) + { + navigator->AppendChild(childNodesNavigator); + } + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_AppendChildElement() + { + // XPathNavigator->AppendChildElement(string, string, string, string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + navigator->AppendChildElement(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_Clone() + { + // XPathNavigator->Clone() + + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + // Select all books authored by Melville. + XPathNodeIterator^ nodes = navigator->Select("descendant::book[author/last-name='Melville']"); + + while (nodes->MoveNext()) + { + // Clone the navigator returned by the Current property. + // Use the cloned navigator to get the title element. + XPathNavigator^ clone = nodes->Current->Clone(); + clone->MoveToFirstChild(); + Console::WriteLine("Book title: {0}", clone->Value); + } + // + } + + static void XPathNavigatorMethods_CreateAttribute() + { + // XPathNavigator->CreateAttribute(string, string, string, string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->CreateAttribute("", "discount", "", "1.00"); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_CreateAttributes() + { + // XPathNavigator->CreateAttributes() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlWriter^ attributes = navigator->CreateAttributes(); + + attributes->WriteAttributeString("discount", "1.00"); + attributes->WriteAttributeString("currency", "USD"); + attributes->Close(); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_DeleteSelf() + { + // XPathNavigator->DeleteSelf() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->DeleteSelf(); + + Console::WriteLine("Position after delete: {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_DeleteRange() + { + // XPathNavigator->DeleteRange() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + XPathNavigator^ first = navigator->SelectSingleNode("/bk:bookstore/bk:book[1]", manager); + XPathNavigator^ last = navigator->SelectSingleNode("/bk:bookstore/bk:book[2]", manager); + + navigator->MoveTo(first); + navigator->DeleteRange(last); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_Evaluate1() + { + // XPathNavigator->Evaluate(string) + + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + Double total = (double)navigator->Evaluate("sum(descendant::book/price)"); + Console::WriteLine("Total price for all books: {0}", total.ToString()); + // + } + + static void XPathNavigatorMethods_Evaluate2() + { + // XPathNavigator->Evaluate(XPathExpression) + + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XPathExpression^ query = navigator->Compile("sum(descendant::book/price)"); + + Double total = (double)navigator->Evaluate(query); + Console::WriteLine("Total price for all books: {0}", total.ToString()); + // + } + + static void XPathNavigatorMethods_Evaluate3() + { + // XPathNavigator->Evaluate(string, IXmlNamespaceResolver) + + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + Double total = (double)navigator->Evaluate("sum(descendant::bk:book/bk:price)", manager); + Console::WriteLine("Total price for all books: {0}", total.ToString()); + // + } + + static void XPathNavigatorMethods_Evaluate4() + { + // XPathNavigator->Evaluate(XPathExpression, XPathNodeIterator^) + + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XPathNodeIterator^ nodes = navigator->Select("//book"); + XPathExpression^ query = nodes->Current->Compile("sum(descendant::price)"); + + Double total = (double)navigator->Evaluate(query, nodes); + Console::WriteLine("Total price for all books: {0}", total.ToString()); + // + } + + static void XPathNavigatorMethods_InsertAfter1() + { + // XPathNavigator->InsertAfter() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlWriter^ pages = navigator->InsertAfter(); + pages->WriteElementString("pages", "100"); + pages->Close(); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertAfter2() + { + // XPathNavigator->InsertAfter(string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->InsertAfter("100"); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertAfter3() + { + // XPathNavigator->InsertAfter(XmlReader^) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); + + navigator->InsertAfter(pages); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertAfter4() + { + // XPathNavigator->InsertAfter(XPathNavigator^) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlDocument^ childNodes = gcnew XmlDocument(); + childNodes->Load(gcnew StringReader("100")); + XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); + + navigator->InsertAfter(childNodesNavigator); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertBefore1() + { + // XPathNavigator->InsertBefore() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlWriter^ pages = navigator->InsertBefore(); + pages->WriteElementString("pages", "100"); + pages->Close(); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertBefore2() + { + // XPathNavigator->InsertBefore(string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->InsertBefore("100"); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertBefore3() + { + // XPathNavigator->InsertBefore(XmlReader^) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); + + navigator->InsertBefore(pages); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertBefore4() + { + // XPathNavigator->InsertBefore(XPathNavigator^) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlDocument^ childNodes = gcnew XmlDocument(); + childNodes->Load(gcnew StringReader("100")); + XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); + + navigator->InsertBefore(childNodesNavigator); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertElementAfter() + { + // XPathNavigator->InsertElementAfter(string, string, string, string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->InsertElementAfter(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_InsertElementBefore() + { + // XPathNavigator->InsertElementBefore(string, string, string, string) + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->InsertElementBefore(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_Matches() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + // Select all book nodes. + XPathNodeIterator^ nodes = navigator->SelectDescendants("book", "", false); + + // Select all book nodes that have the matching attribute value. + XPathExpression^ expr = navigator->Compile("book[@genre='novel']"); + while (nodes->MoveNext()) + { + XPathNavigator^ navigator2 = nodes->Current->Clone(); + if (navigator2->Matches(expr)) + { + navigator2->MoveToFirstChild(); + Console::WriteLine("Book title: {0}", navigator2->Value); + } + } + // + } + + static void XPathNavigatorMethods_MoveToFollowing1() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToFollowing(XPathNodeType::Element); + + Console::WriteLine("Position: {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_MoveToFollowing2() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToFollowing("price", "http://www.contoso.com/books"); + + Console::WriteLine("Position: {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_MoveToFollowing3() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToFollowing("price", "http://www.contoso.com/books"); + XPathNavigator^ boundary = navigator->Clone(); + + navigator->MoveToRoot(); + + while (navigator->MoveToFollowing(XPathNodeType::Text, boundary)) + { + Console::WriteLine(navigator->OuterXml); + } + // + } + + static void XPathNavigatorMethods_MoveToFollowing4() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToFollowing("book", "http://www.contoso.com/books"); + XPathNavigator^ boundary = navigator->Clone(); + boundary->MoveToFollowing("first-name", "http://www.contoso.com/books"); + + navigator->MoveToFollowing("price", "http://www.contoso.com/books", boundary); + + Console::WriteLine("Position (after boundary): {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + + navigator->MoveToFollowing("title", "http://www.contoso.com/books", boundary); + + Console::WriteLine("Position (before boundary): {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + // + static void XPathNavigatorMethods_MoveToNext() + { + + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + XPathNodeIterator^ nodeset = navigator->Select("descendant::book[author/last-name='Melville']"); + + while (nodeset->MoveNext()) + { + // Clone iterator here when working with it. + RecursiveWalk(nodeset->Current->Clone()); + } + } + + static void RecursiveWalk(XPathNavigator^ navigator) + { + switch (navigator->NodeType) + { + case XPathNodeType::Element: + if (navigator->Prefix == String::Empty) + Console::WriteLine("<{0}>", navigator->LocalName); + else + Console::Write("<{0}:{1}>", navigator->Prefix, navigator->LocalName); + Console::WriteLine("\t" + navigator->NamespaceURI); + break; + case XPathNodeType::Text: + Console::WriteLine("\t" + navigator->Value); + break; + } + + if (navigator->MoveToFirstChild()) + { + do + { + RecursiveWalk(navigator); + } while (navigator->MoveToNext()); + + navigator->MoveToParent(); + if (navigator->NodeType == XPathNodeType::Element) + Console::WriteLine("", navigator->Name); + } + else + { + if (navigator->NodeType == XPathNodeType::Element) + { + Console::WriteLine("", navigator->Name); + } + } + } + // + + static void XPathNavigatorMethods_PrependChild1() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlWriter^ pages = navigator->PrependChild(); + pages->WriteElementString("pages", "100"); + pages->Close(); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_PrependChild2() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + navigator->PrependChild("100"); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_PrependChild3() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); + + navigator->PrependChild(pages); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_PrependChild4() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlDocument^ childNodes = gcnew XmlDocument(); + childNodes->Load(gcnew StringReader("100")); + XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); + + navigator->PrependChild(childNodesNavigator); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_PrependChildElement() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + navigator->PrependChildElement(navigator->Prefix, "pages", navigator->LookupNamespace(navigator->Prefix), "100"); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_ReadSubtree() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlReader^ reader = navigator->ReadSubtree(); + + while (reader->Read()) + { + Console::WriteLine(reader->ReadInnerXml()); + } + + reader->Close(); + // + } + + static void XPathNavigatorMethods_ReplaceRange() + { + // XPathNavigator->ReplaceRange() + + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + XPathNavigator^ first = navigator->SelectSingleNode("/bk:bookstore/bk:book[1]", manager); + XPathNavigator^ last = navigator->SelectSingleNode("/bk:bookstore/bk:book[2]", manager); + + navigator->MoveTo(first); + XmlWriter^ newRange = navigator->ReplaceRange(last); + newRange->WriteStartElement("book"); + newRange->WriteAttributeString("genre", ""); + newRange->WriteAttributeString("publicationdate", "2005-04-07"); + newRange->WriteAttributeString("ISBN", "0"); + newRange->WriteStartElement("title"); + newRange->WriteString("New Book"); + newRange->WriteEndElement(); + newRange->WriteStartElement("author"); + newRange->WriteStartElement("first-name"); + newRange->WriteString("First Name"); + newRange->WriteEndElement(); + newRange->WriteStartElement("last-name"); + newRange->WriteString("Last Name"); + newRange->WriteEndElement(); + newRange->WriteEndElement(); + newRange->WriteElementString("price", "$0.00"); + newRange->WriteEndElement(); + newRange->Close(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_ReplaceSelf1() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + navigator->ReplaceSelf("100"); + + Console::WriteLine("Position after delete: {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_ReplaceSelf2() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlReader^ pages = XmlReader::Create(gcnew StringReader("100")); + + navigator->ReplaceSelf(pages); + + Console::WriteLine("Position after delete: {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_ReplaceSelf3() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + XmlDocument^ childNodes = gcnew XmlDocument(); + childNodes->Load(gcnew StringReader("100")); + XPathNavigator^ childNodesNavigator = childNodes->CreateNavigator(); + + navigator->ReplaceSelf(childNodesNavigator); + + Console::WriteLine("Position after delete: {0}", navigator->Name); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_Select1() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XPathNodeIterator^ nodes = navigator->Select("/bookstore/book"); + nodes->MoveNext(); + XPathNavigator^ nodesNavigator = nodes->Current; + + XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false); + + while (nodesText->MoveNext()) + Console::WriteLine(nodesText->Current->Value); + // + } + + static void XPathNavigatorMethods_Select2() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XPathExpression^ query = navigator->Compile("/bookstore/book"); + XPathNodeIterator^ nodes = navigator->Select(query); + XPathNavigator^ nodesNavigator = nodes->Current; + + XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false); + + while (nodesText->MoveNext()) + { + Console::WriteLine(nodesText->Current->Value); + } + // + } + + static void XPathNavigatorMethods_Select3() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + XPathNodeIterator^ nodes = navigator->Select("/bk:bookstore/bk:book/bk:price", manager); + // Move to the first node bk:price node. + if(nodes->MoveNext()) + { + // Now nodes.Current points to the first selected node. + XPathNavigator^ nodesNavigator = nodes->Current; + + // Select all the descendants of the current price node. + XPathNodeIterator^ nodesText = nodesNavigator->SelectDescendants(XPathNodeType::Text, false); + + while(nodesText->MoveNext()) + { + Console::WriteLine(nodesText->Current->Value); + } + } + // + } + + static void XPathNavigatorMethods_SelectAncestorsChildrenDescendants() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + // Select all the descendant nodes of the book node. + XPathNodeIterator^ bookDescendants = navigator->SelectDescendants("", "http://www.contoso.com/books", false); + + // Display the LocalName of each descendant node. + Console::WriteLine("Descendant nodes of the book node:"); + while (bookDescendants->MoveNext()) + { + Console::WriteLine(bookDescendants->Current->Name); + } + + // Select all the child nodes of the book node. + XPathNodeIterator^ bookChildren = navigator->SelectChildren("", "http://www.contoso.com/books"); + + // Display the LocalName of each child node. + Console::WriteLine("\nChild nodes of the book node:"); + while (bookChildren->MoveNext()) + { + Console::WriteLine(bookChildren->Current->Name); + } + + // Select all the ancestor nodes of the title node. + navigator->MoveToChild("title", "http://www.contoso.com/books"); + + XPathNodeIterator^ bookAncestors = navigator->SelectAncestors("", "http://www.contoso.com/books", false); + + // Display the LocalName of each ancestor node. + Console::WriteLine("\nAncestor nodes of the title node:"); + + while (bookAncestors->MoveNext()) + { + Console::WriteLine(bookAncestors->Current->Name); + } + // + } + + static void XPathNavigatorMethods_SelectSingleNode1() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XPathNavigator^ node = navigator->SelectSingleNode("//title"); + Console::WriteLine(node->InnerXml); + // + } + + static void XPathNavigatorMethods_SelectSingleNode2() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XPathExpression^ query = navigator->Compile("//title"); + + XPathNavigator^ node = navigator->SelectSingleNode(query); + Console::WriteLine(node->InnerXml); + // + } + + static void XPathNavigatorMethods_SelectSingleNode3() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + XPathNavigator^ node = navigator->SelectSingleNode("//bk:title", manager); + Console::WriteLine(node->InnerXml); + // + } + + static void XPathNavigatorMethods_SetTypedValue() + { + // + XmlReaderSettings^ settings = gcnew XmlReaderSettings(); + settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd"); + settings->ValidationType = ValidationType::Schema; + + XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings); + XmlDocument^ document = gcnew XmlDocument(); + document->Load(reader); + + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + Decimal^ price = gcnew Decimal(19.99); + navigator->SetTypedValue(price); + + navigator->MoveToParent(); + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_SetValue() + { + // + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(navigator->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + for each (XPathNavigator^ nav in navigator->Select("//bk:price", manager)) + { + if(nav->Value == "11.99") + { + nav->SetValue("12.99"); + } + } + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorMethods_WriteSubtree() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + XmlWriter^ writer = XmlWriter::Create("contosoBook.xml"); + navigator->WriteSubtree(writer); + + writer->Close(); + // + } + + static void XPathNavigatorMethods_MoveToNextAttribute() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + // Select all book nodes and display all attributes on each book. + XPathNodeIterator^ nodes = navigator->SelectDescendants("book", "", false); + while (nodes->MoveNext()) + { + XPathNavigator^ navigator2 = nodes->Current->Clone(); + navigator2->MoveToFirstAttribute(); + Console::WriteLine("{0} = {1}", navigator2->Name, navigator2->Value); + + while (navigator2->MoveToNextAttribute()) + { + Console::WriteLine("{0} = {1}", navigator2->Name, navigator2->Value); + } + + Console::WriteLine(); + } + // + } + + static void XPathNavigatorMethods_BasicMoveTos() + { + // + // Load the XML document. + XmlDocument^ document = gcnew XmlDocument(); + document->Load("contosoBooks.xml"); + + // Create the XPathNavigator. + XPathNavigator^ navigator = document->CreateNavigator(); + + // Create an XmlNamespaceManager used to handle namespaces + // found in the XML document. + XmlNamespaceManager^ manager = gcnew XmlNamespaceManager(document->NameTable); + manager->AddNamespace("bk", "http://www.contoso.com/books"); + + // Move to the last book node using the SelectSingleNode method. + navigator = navigator->SelectSingleNode("//bk:book[last()]", manager); + Console::WriteLine("Last book node: \n===============\n{0}", navigator->OuterXml); + + // Move to the previous book node and write it to the console + // if the move was successful. + if (navigator->MoveToPrevious()) + { + Console::WriteLine("\nSecond book node: \n=================\n{0}", + navigator->OuterXml); + } + + // Move to the first book node and write it to the console + // if the move was successful. + if (navigator->MoveToFirst()) + { + Console::WriteLine("\nFirst book node: \n================\n{0}", + navigator->OuterXml); + } + + // Move to the parent bookstore node and write it to the console + // if the move was successful. + if (navigator->MoveToParent()) + { + Console::WriteLine("\nParent bookstore node: \n======================\n{0}", + navigator->OuterXml); + } + + // Move to the first child node of the bookstore node and write + // it to the console if the move was successful. + if (navigator->MoveToFirstChild()) + { + Console::WriteLine("\nFirst book node: \n================\n{0}", + navigator->OuterXml); + } + + // Move to the root node and write it to the console. + navigator->MoveToRoot(); + Console::WriteLine("\nRoot node: \n==========\n{0}", + navigator->OuterXml); + // + } + static void XPathNavigatorMethods_TwoWaysToIterateOverXPathNavigator() + { + XPathDocument^ doc = gcnew XPathDocument(gcnew StringReader("")); + XPathNavigator^ nav = doc->CreateNavigator(); + XPathNodeIterator^ nodeIterator = nav->SelectDescendants("", "", false); + + // + while (nodeIterator->MoveNext()) + { + XPathNavigator^ n = nodeIterator->Current; + Console::WriteLine(n->LocalName); + } + // + + // + for each (XPathNavigator^ n in nodeIterator) + Console::WriteLine(n->LocalName); + // + } + + +}; + +int main() +{ + return 0; +}; \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp b/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp new file mode 100644 index 00000000000..98a87366e0c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XPathNavigatorProperties/CPP/xpathnavigatorproperties.cpp @@ -0,0 +1,134 @@ +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::XPath; +using namespace System::Collections; + +class XPathNavigatorProperties +{ +public: + + static void XPathNavigatorProperties_CanEdit() + { + // + XPathDocument^ readOnlyDocument = gcnew XPathDocument("books.xml"); + XPathNavigator^ readOnlyNavigator = readOnlyDocument->CreateNavigator(); + + XmlDocument^ editableDocument = gcnew XmlDocument(); + editableDocument->Load("books.xml"); + XPathNavigator^ editableNavigator = editableDocument->CreateNavigator(); + + Console::WriteLine("XPathNavigator.CanEdit from XPathDocument: {0}", readOnlyNavigator->CanEdit); + Console::WriteLine("XPathNavigator.CanEdit from XmlDocument: {0}", editableNavigator->CanEdit); + // + } + + static void XPathNavigatorProperties_InnerXml() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + Console::WriteLine(navigator->InnerXml); + // + } + + static void XPathNavigatorProperties_NavigatorComparer() + { + // + XPathDocument^ document = gcnew XPathDocument("books.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + Hashtable^ table = gcnew Hashtable(XPathNavigator::NavigatorComparer); + + // Add nodes to the Hashtable. + for each (XPathNavigator^ navigator2 in navigator->Select("//book")) + { + Object^ value = navigator2->Evaluate("string(./title)"); + table->Add(navigator2->Clone(), value); + Console::WriteLine("Added book with title {0}", value); + } + + Console::WriteLine(table->Count); + Console::WriteLine("Does the Hashtable have the book \"The Confidence Man\"?"); + Console::WriteLine(table->Contains(navigator->SelectSingleNode("//book[title='The Confidence Man']"))); + // + } + + static void XPathNavigatorProperties_OuterXml() + { + // + XPathDocument^ document = gcnew XPathDocument("contosoBooks.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + + Console::WriteLine(navigator->OuterXml); + // + } + + static void XPathNavigatorProperties_ValueAs() + { + // + XPathDocument^ document = gcnew XPathDocument("valueas.xml"); + XPathNavigator^ navigator = document->CreateNavigator(); + + // ValueAsBoolean + navigator->MoveToChild("root", ""); + navigator->MoveToChild("booleanElement", ""); + bool^ booleanValue = navigator->ValueAsBoolean; + Console::WriteLine(navigator->LocalName + ": " + booleanValue); + + // ValueAsDateTime + navigator->MoveToNext("dateTimeElement", ""); + DateTime^ dateTimeValue = navigator->ValueAsDateTime; + Console::WriteLine(navigator->LocalName + ": " + dateTimeValue); + + // ValueAsDouble, ValueAsInt32, ValueAsInt64, ValueAsSingle + navigator->MoveToNext("numberElement", ""); + Double doubleValue = navigator->ValueAsDouble; + Int32 int32Value = navigator->ValueAsInt; + Int64 int64Value = navigator->ValueAsLong; + Console::WriteLine(navigator->LocalName + ": " + doubleValue); + Console::WriteLine(navigator->LocalName + ": " + int32Value); + Console::WriteLine(navigator->LocalName + ": " + int64Value); + // + } + + static void XPathNavigatorProperties_ValueType() + { + // + // Create an XmlReaderSettings object with the contosoBooks.xsd schema. + XmlReaderSettings^ settings = gcnew XmlReaderSettings(); + settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd"); + settings->ValidationType = ValidationType::Schema; + + // Create an XmlReader object with the contosoBooks.xml file and its schema. + XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings); + + XPathDocument^ document = gcnew XPathDocument(reader); + XPathNavigator^ navigator = document->CreateNavigator(); + + navigator->MoveToChild("bookstore", "http://www.contoso.com/books"); + navigator->MoveToChild("book", "http://www.contoso.com/books"); + navigator->MoveToChild("price", "http://www.contoso.com/books"); + + // Display the current type of the price element. + Console::WriteLine(navigator->ValueType); + + // Get the value of the price element as a string and display it. + String^ price = dynamic_cast(navigator->ValueAs(String::typeid)); + Console::WriteLine(price); + // + } +}; + +int main() +{ + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp b/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp new file mode 100644 index 00000000000..75adbf6a471 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XPathValidation/CPP/XPathValidation.cpp @@ -0,0 +1,68 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::XPath; + +class XPathValidation +{ +public: + + static void Main() + { + try + { + XmlReaderSettings^ settings = gcnew XmlReaderSettings(); + settings->Schemas->Add("http://www.contoso.com/books", "contosoBooks.xsd"); + settings->ValidationType = ValidationType::Schema; + + XmlReader^ reader = XmlReader::Create("contosoBooks.xml", settings); + XmlDocument^ document = gcnew XmlDocument(); + document->Load(reader); + + ValidationEventHandler^ eventHandler = gcnew ValidationEventHandler(ValidationEventHandlerOne); + + // the following call to Validate succeeds. + document->Validate(eventHandler); + + // add a node so that the document is no longer valid + XPathNavigator^ navigator = document->CreateNavigator(); + navigator->MoveToFollowing("price", "http://www.contoso.com/books"); + XmlWriter^ writer = navigator->InsertAfter(); + writer->WriteStartElement("anotherNode", "http://www.contoso.com/books"); + writer->WriteEndElement(); + writer->Close(); + + // the document will now fail to successfully validate + document->Validate(eventHandler); + } + catch(Exception^ ex) + { + Console::WriteLine(ex->Message); + } + } + + static void ValidationEventHandlerOne(Object^ sender, ValidationEventArgs^ e) + { + switch (e->Severity) + { + case XmlSeverityType::Error: + Console::WriteLine("Error: {0}", e->Message); + break; + case XmlSeverityType::Warning: + Console::WriteLine("Warning {0}", e->Message); + break; + } + + } +}; + +int main() +{ + XPathValidation::Main(); + Console::ReadLine(); + return 0; +}; +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp new file mode 100644 index 00000000000..47d9622fae0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlConvert.EncodeName/CPP/convert.cpp @@ -0,0 +1,24 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Encode and decode a name with spaces. + String^ name1 = XmlConvert::EncodeName( "Order Detail" ); + Console::WriteLine( "Encoded name: {0}", name1 ); + Console::WriteLine( "Decoded name: {0}", XmlConvert::DecodeName( name1 ) ); + + // Encode and decode a local name. + String^ name2 = XmlConvert::EncodeLocalName( "a:book" ); + Console::WriteLine( "Encoded local name: {0}", name2 ); + Console::WriteLine( "Decoded local name: {0}", XmlConvert::DecodeName( name2 ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp new file mode 100644 index 00000000000..c3d8da70f59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlConvert.ToDouble/CPP/readData.cpp @@ -0,0 +1,38 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = gcnew XmlTextReader( "orderData.xml" ); + + //Parse the file and pull out the order date and price. + while ( reader->Read() ) + { + if ( reader->NodeType == XmlNodeType::Element ) + { + if ( reader->Name->Equals( "order" ) ) + { + DateTime orderDate = XmlConvert::ToDateTime( reader->GetAttribute( "date" ) ); + Console::WriteLine( "order date: {0}", orderDate.ToString() ); + } + else + if ( reader->Name->Equals( "price" ) ) + { + Double price = XmlConvert::ToDouble( reader->ReadInnerXml() ); + Console::WriteLine( "price: {0}", price ); + } + } + } + + + //Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp b/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp new file mode 100644 index 00000000000..a3e011767f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlConvert.VerifyName/CPP/verifyname.cpp @@ -0,0 +1,35 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Xml; +int main() +{ + XmlTextWriter^ writer = gcnew XmlTextWriter( "out.xml", nullptr ); + String^ tag = "item name"; + try + { + + // Write the root element. + writer->WriteStartElement( "root" ); + writer->WriteStartElement( XmlConvert::VerifyName( tag ) ); + } + catch ( XmlException^ e ) + { + Console::WriteLine( e->Message ); + Console::WriteLine( "Convert to a valid name..." ); + writer->WriteStartElement( XmlConvert::EncodeName( tag ) ); + } + + writer->WriteString( "hammer" ); + writer->WriteEndElement(); + + // Write the end tag for the root element. + writer->WriteEndElement(); + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp new file mode 100644 index 00000000000..f69ebbfb60c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.GetRowFromElement/CPP/getrow.cpp @@ -0,0 +1,30 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; + +int main() +{ + // Create an XmlDataDocument. + XmlDataDocument^ doc = gcnew XmlDataDocument; + + // Load the schema file. + doc->DataSet->ReadXmlSchema( "store.xsd" ); + + // Load the XML data. + doc->Load( "2books.xml" ); + + //Change the price on the first book. + XmlElement^ root = doc->DocumentElement; + DataRow^ row = doc->GetRowFromElement( safe_cast(root->FirstChild) ); + row["price"] = "12.95"; + Console::WriteLine( "Display the modified XML data..." ); + Console::WriteLine( doc->DocumentElement->OuterXml ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp new file mode 100644 index 00000000000..631d04fa9a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlDataDocument.Load/CPP/loadrdr.cpp @@ -0,0 +1,31 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; +int main() +{ + // Create an XmlDataDocument. + XmlDataDocument^ doc = gcnew XmlDataDocument; + + // Load the schema file. + doc->DataSet->ReadXmlSchema( "store.xsd" ); + + // Load the XML data. + XmlTextReader^ reader = gcnew XmlTextReader( "2books.xml" ); + reader->MoveToContent(); // Moves the reader to the root node. + doc->Load( reader ); + + // Update the price on the first book using the DataSet methods. + DataTable^ books = doc->DataSet->Tables["book"]; + books->Rows[0]["price"] = "12.95"; + Console::WriteLine( "Display the modified XML data..." ); + doc->Save( Console::Out ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp new file mode 100644 index 00000000000..2b1b5ca9f4d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlDocument.XmlResolver/CPP/docresolver.cpp @@ -0,0 +1,27 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Net; +int main() +{ + + // Supply the credentials necessary to access the DTD file stored on the network. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + resolver->Credentials = CredentialCache::DefaultCredentials; + + // Create and load the XmlDocument. + XmlDocument^ doc = gcnew XmlDocument; + doc->XmlResolver = resolver; // Set the resolver. + doc->Load( "book5.xml" ); + + // Display the entity replacement text which is pulled from the DTD file. + Console::WriteLine( doc->DocumentElement->LastChild->InnerText ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp b/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp new file mode 100644 index 00000000000..cf02bc534b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp @@ -0,0 +1,56 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XmlDocumentSample +{ +private: + static XmlReader^ reader; + static String^ filename = "bookdtd.xml"; + + // Display the validation error. + static void ValidationCallback(Object^ sender, ValidationEventArgs^ args) + { + Console::WriteLine("Validation error loading: {0}", filename); + Console::WriteLine(args->Message); + } + +public: + static void Main() + { + ValidationEventHandler^ eventHandler = gcnew ValidationEventHandler(XmlDocumentSample::ValidationCallback); + + try + { + // Create the validating reader and specify DTD validation. + XmlReaderSettings^ settings = gcnew XmlReaderSettings(); + settings->DtdProcessing = DtdProcessing::Parse; + settings->ValidationType = ValidationType::DTD; + settings->ValidationEventHandler += eventHandler; + + reader = XmlReader::Create(filename, settings); + + // Pass the validating reader to the XML document. + // Validation fails due to an undefined attribute, but the + // data is still loaded into the document. + XmlDocument^ doc = gcnew XmlDocument(); + doc->Load(reader); + Console::WriteLine(doc->OuterXml); + } + finally + { + if (reader != nullptr) + reader->Close(); + } + } +}; + +int main() +{ + XmlDocumentSample::Main(); + return 0; +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp b/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp new file mode 100644 index 00000000000..85250f42094 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlEntity/CPP/entities.cpp @@ -0,0 +1,39 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +public ref class Sample +{ +public: + static void DisplayEntities( XmlNamedNodeMap^ nMap ) + { + for ( int i = 0; i < nMap->Count; i++ ) + { + XmlEntity^ ent = dynamic_cast(nMap->Item( i )); + Console::Write( " {0} ", ent->NodeType ); + Console::Write( " {0} ", ent->Name ); + Console::Write( " {0} ", ent->NotationName ); + Console::Write( " {0} ", ent->PublicId ); + Console::Write( " {0} ", ent->SystemId ); + Console::WriteLine(); + + } + } + +}; + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "doment.xml" ); + Console::WriteLine( "Display information on all entities..." ); + XmlNamedNodeMap^ nMap = doc->DocumentType->Entities; + Sample^ MySample = gcnew Sample; + MySample->DisplayEntities( nMap ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp new file mode 100644 index 00000000000..3424276fabf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectNodes1/CPP/selectnodes1.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Collections; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "booksort.xml" ); + + // Create an XmlNamespaceManager for resolving namespaces. + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ); + nsmgr->AddNamespace( "bk", "urn:samples" ); + + // Select and display the value of all the ISBN attributes. + XmlNodeList^ nodeList; + XmlElement^ root = doc->DocumentElement; + nodeList = root->SelectNodes( "/bookstore/book/@bk:ISBN", nsmgr ); + IEnumerator^ myEnum = nodeList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + XmlNode^ isbn = safe_cast(myEnum->Current); + Console::WriteLine( isbn->Value ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp new file mode 100644 index 00000000000..3cc1ad791d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode1/CPP/selectsingnode.cpp @@ -0,0 +1,25 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "booksort.xml" ); + + //Create an XmlNamespaceManager for resolving namespaces. + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ); + nsmgr->AddNamespace( "bk", "urn:samples" ); + + //Select the book node with the matching attribute value. + XmlNode^ book; + XmlElement^ root = doc->DocumentElement; + book = root->SelectSingleNode( "descendant::book->Item[@bk:ISBN='1-861001-57-6']", nsmgr ); + Console::WriteLine( book->OuterXml ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp new file mode 100644 index 00000000000..f460ecd9f3d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlNode.SelectSingleNode2/CPP/XmlNode.SelectSingleNode2.cpp @@ -0,0 +1,25 @@ + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( L"newbooks.xml" ); + + // Create an XmlNamespaceManager to resolve the default namespace. + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( doc->NameTable ); + nsmgr->AddNamespace( L"bk", L"urn:newbooks-schema" ); + + // Select the first book written by an author whose last name is Atwood. + XmlNode^ book; + XmlElement^ root = doc->DocumentElement; + book = root->SelectSingleNode( L"descendant::bk:book[bk:author/bk:last-name='Atwood']", nsmgr ); + Console::WriteLine( book->OuterXml ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp b/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp new file mode 100644 index 00000000000..ab467b652be --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlNodeChangedEventHandler/CPP/nodeevent.cpp @@ -0,0 +1,64 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +public ref class Sample +{ +public: + void Run( String^ args ) + { + // Create and load the XML document. + Console::WriteLine( "Loading file {0} ...", args ); + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( args ); + + //Create the event handlers. + doc->NodeChanged += gcnew XmlNodeChangedEventHandler( this, &Sample::MyNodeChangedEvent ); + doc->NodeInserted += gcnew XmlNodeChangedEventHandler( this, &Sample::MyNodeInsertedEvent ); + + // Change the book price. + doc->DocumentElement->LastChild->InnerText = "5.95"; + + // Add a new element. + XmlElement^ newElem = doc->CreateElement( "style" ); + newElem->InnerText = "hardcover"; + doc->DocumentElement->AppendChild( newElem ); + Console::WriteLine( "\r\nDisplay the modified XML..." ); + Console::WriteLine( doc->OuterXml ); + } + + // Handle the NodeChanged event. +private: + void MyNodeChangedEvent( Object^ /*src*/, XmlNodeChangedEventArgs^ args ) + { + Console::Write( "Node Changed Event: <{0}> changed", args->Node->Name ); + if ( args->Node->Value != nullptr ) + { + Console::WriteLine( " with value {0}", args->Node->Value ); + } + else + Console::WriteLine( "" ); + } + + // Handle the NodeInserted event. + void MyNodeInsertedEvent( Object^ /*src*/, XmlNodeChangedEventArgs^ args ) + { + Console::Write( "Node Inserted Event: <{0}> inserted", args->Node->Name ); + if ( args->Node->Value != nullptr ) + { + Console::WriteLine( " with value {0}", args->Node->Value ); + } + else + Console::WriteLine( "" ); + } +}; +// End class + +int main() +{ + Sample^ mySample = gcnew Sample; + mySample->Run( "book.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp b/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp new file mode 100644 index 00000000000..5e7a6c8360b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlNotation/CPP/notation.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +void DisplayNotations( XmlNamedNodeMap^ nMap ) +{ + for ( int i = 0; i < nMap->Count; i++ ) + { + XmlNotation^ note = dynamic_cast(nMap->Item( i )); + Console::Write( " {0} ", note->NodeType ); + Console::Write( " {0} ", note->Name ); + Console::Write( " {0} ", note->PublicId ); + Console::Write( " {0} ", note->SystemId ); + Console::WriteLine(); + + } +} + +int main() +{ + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "doment.xml" ); + Console::WriteLine( "Display information on all notations..." ); + XmlNamedNodeMap^ nMap = doc->DocumentType->Notations; + DisplayNotations( nMap ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp new file mode 100644 index 00000000000..a3f97a98a5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.DtdValidate/CPP/XmlReaderSettings.DtdValidate.cpp @@ -0,0 +1,33 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::IO; + +// Display any validation errors. +static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) +{ + Console::WriteLine( L"Validation Error: {0}", e->Message ); +} + +int main() +{ + // Set the validation settings. + XmlReaderSettings^ settings = gcnew XmlReaderSettings; + settings->DtdProcessing = DtdProcessing::Parse; + settings->ValidationType = ValidationType::DTD; + settings->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack ); + + // Create the XmlReader object. + XmlReader^ reader = XmlReader::Create( L"itemDTD.xml", settings ); + + // Parse the file. + while ( reader->Read() ) + ; + + return 1; +} +// + diff --git a/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp new file mode 100644 index 00000000000..2c42e5cc4eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlReaderSettings.cctor/CPP/XmlReaderSettings.cctor.cpp @@ -0,0 +1,38 @@ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::IO; +int main() +{ + + // + // Set the reader settings. + XmlReaderSettings^ settings = gcnew XmlReaderSettings; + settings->IgnoreComments = true; + settings->IgnoreProcessingInstructions = true; + settings->IgnoreWhitespace = true; + + // + // + // Create a resolver with default credentials. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + resolver->Credentials = System::Net::CredentialCache::DefaultCredentials; + + // Set the reader settings object to use the resolver. + settings->XmlResolver = resolver; + + // Create the XmlReader object. + XmlReader^ reader = XmlReader::Create( L"http://ServerName/data/books.xml", settings ); + + // + // Parse the file. + while ( reader->Read() ) + ; + + return 1; +} + diff --git a/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp b/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp new file mode 100644 index 00000000000..f202c678601 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlReader_Validate_SchemaSet/CPP/XmlReader_Validate_SchemaSet.cpp @@ -0,0 +1,50 @@ + +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::IO; + +// Display any validation errors. +static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) +{ + Console::WriteLine( L"Validation Error:\n {0}", e->Message ); + Console::WriteLine(); +} + +int main() +{ + // Create the XmlSchemaSet class. + XmlSchemaSet^ sc = gcnew XmlSchemaSet; + + // Add the schema to the collection. + sc->Add( L"urn:bookstore-schema", L"books.xsd" ); + + // Set the validation settings. + XmlReaderSettings^ settings = gcnew XmlReaderSettings; + settings->ValidationType = ValidationType::Schema; + settings->Schemas = sc; + settings->ValidationEventHandler += gcnew ValidationEventHandler(ValidationCallBack); + + // Create the XmlReader object. + XmlReader^ reader = XmlReader::Create( L"booksSchemaFail.xml", settings ); + + // Parse the file. + while ( reader->Read() ) + ; + + return 1; +} +// The example displays output like the following: +// Validation Error: +// The element 'book' in namespace 'urn:bookstore-schema' has invalid child element 'author' +// in namespace 'urn:bookstore-schema'. List of possible elements expected: 'title' in +// namespace 'urn:bookstore-schema'. +// +// Validation Error: +// The element 'author' in namespace 'urn:bookstore-schema' has invalid child element 'name' +// in namespace 'urn:bookstore-schema'. List of possible elements expected: 'first-name' in +// namespace 'urn:bookstore-schema'. +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp new file mode 100644 index 00000000000..8ad92c04292 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSchema.ValidationEventHandler/CPP/schemaevent.cpp @@ -0,0 +1,37 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; + +public ref class Sample +{ +private: + //Display the schema error information. + static void ValidationCallBack( Object^ sender, ValidationEventArgs^ args ) + { + Console::WriteLine( "Invalid XSD schema: {0}", args->Exception->Message ); + } + +public: + static void main() + { + // Create the schema collection. + XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection; + + //Set an event handler to manage invalid schemas. + xsc->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); + + //Add the schema to the collection. + xsc->Add( nullptr, "invalid.xsd" ); + } +}; + +int main() +{ + Sample::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp new file mode 100644 index 00000000000..d496898fad0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Add/CPP/schemacolladd.cpp @@ -0,0 +1,55 @@ +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +public ref class Sample +{ +private: + // Display any errors. + static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) + { + Console::WriteLine( "Validation Error: {0}", e->Message ); + } + +public: + static void main() + { + array^ args = Environment::GetCommandLineArgs(); + String^ UserName = args[ 1 ]; + String^ SecurelyStoredPassword = args[ 2 ]; + String^ Domain = args[ 3 ]; + + // + XmlSchemaCollection^ sc = gcnew XmlSchemaCollection; + sc->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); + + // Create a resolver with the necessary credentials. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + System::Net::NetworkCredential^ nc; + nc = gcnew System::Net::NetworkCredential( UserName,SecurelyStoredPassword,Domain ); + resolver->Credentials = nc; + + // Add the new schema to the collection. + sc->Add( nullptr, gcnew XmlTextReader( "sample.xsd" ), resolver ); + // + + if ( sc->Count > 0 ) + { + XmlTextReader^ tr = gcnew XmlTextReader( "notValidXSD.xml" ); + XmlValidatingReader^ rdr = gcnew XmlValidatingReader( tr ); + + rdr->ValidationType = ValidationType::Schema; + rdr->Schemas->Add( sc ); + rdr->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); + while ( rdr->Read() ); + } + } +}; + +int main() +{ + Sample::main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp new file mode 100644 index 00000000000..16126254e5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSchemaCollection.Basic/CPP/aa.cpp @@ -0,0 +1,45 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::IO; +public ref class ValidXSD +{ +public: + static void main() + { + XmlSchemaCollection^ sc = gcnew XmlSchemaCollection; + sc->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack ); + sc->Add( nullptr, "books.xsd" ); + if ( sc->Count > 0 ) + { + XmlTextReader^ tr = gcnew XmlTextReader( "notValidXSD.xml" ); + XmlValidatingReader^ rdr = gcnew XmlValidatingReader( tr ); + rdr->ValidationType = ValidationType::Schema; + rdr->Schemas->Add( sc ); + rdr->ValidationEventHandler += gcnew ValidationEventHandler( ValidationCallBack ); + while ( rdr->Read() ) + ; + } + } + + +private: + static void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ e ) + { + Console::WriteLine( "Validation Error: {0}", e->Message ); + } + +}; + +int main() +{ + ValidXSD::main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp new file mode 100644 index 00000000000..0d338c1f4c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSchemaInferenceExamples/CPP/XmlSchemaInferenceExamples.cpp @@ -0,0 +1,101 @@ +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +ref class XmlSchemaInferenceExamples +{ +public: + + static void Main() + { + + } + + static void XmlSchemaInference_OverallExample() + { + // + XmlReader^ reader = XmlReader::Create("contosoBooks.xml"); + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + XmlSchemaInference^ schema = gcnew XmlSchemaInference(); + + schemaSet = schema->InferSchema(reader); + + for each (XmlSchema^ s in schemaSet->Schemas()) + { + s->Write(Console::Out); + } + // + } + + static void XmlSchemaInference_Occurrence() + { + // + XmlReader^ reader = XmlReader::Create("input.xml"); + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + XmlSchemaInference^ schema = gcnew XmlSchemaInference(); + + schema->Occurrence = XmlSchemaInference::InferenceOption::Relaxed; + + schemaSet = schema->InferSchema(reader); + + for each (XmlSchema^ s in schemaSet->Schemas()) + { + s->Write(Console::Out); + } + // + } + + static void XmlSchemaInference_TypeInference() + { + // + XmlReader^ reader = XmlReader::Create("input.xml"); + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + XmlSchemaInference^ schema = gcnew XmlSchemaInference(); + + schema->TypeInference = XmlSchemaInference::InferenceOption::Relaxed; + + schemaSet = schema->InferSchema(reader); + + for each (XmlSchema^ s in schemaSet->Schemas()) + { + s->Write(Console::Out); + } + // + } + + static void XmlSchemaInference_RefinementProcess() + { + // + XmlReader^ reader = XmlReader::Create("item1.xml"); + XmlReader^ reader1 = XmlReader::Create("item2.xml"); + XmlSchemaSet^ schemaSet = gcnew XmlSchemaSet(); + XmlSchemaInference^ inference = gcnew XmlSchemaInference(); + schemaSet = inference->InferSchema(reader); + + // Display the inferred schema. + Console::WriteLine("Original schema:\n"); + for each (XmlSchema^ schema in schemaSet->Schemas("http://www.contoso.com/items")) + { + schema->Write(Console::Out); + } + + // Use the additional data in item2.xml to refine the original schema. + schemaSet = inference->InferSchema(reader1, schemaSet); + + // Display the refined schema. + Console::WriteLine("\n\nRefined schema:\n"); + for each (XmlSchema^ schema in schemaSet->Schemas("http://www.contoso.com/items")) + { + schema->Write(Console::Out); + } + // + } +}; + +int main() +{ + XmlSchemaInferenceExamples::Main(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp b/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp new file mode 100644 index 00000000000..1f3adf25c44 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSchemaSetOverall Example/CPP/xmlschemasetexample.cpp @@ -0,0 +1,36 @@ +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; + +static void booksSettingsValidationEventHandler( Object^ /*sender*/, ValidationEventArgs^ e ) +{ + if ( e->Severity == XmlSeverityType::Warning ) + { + Console::Write( L"WARNING: " ); + Console::WriteLine( e->Message ); + } + else + if ( e->Severity == XmlSeverityType::Error ) + { + Console::Write( L"ERROR: " ); + Console::WriteLine( e->Message ); + } +} + +int main() +{ + XmlReaderSettings^ booksSettings = gcnew XmlReaderSettings; + booksSettings->Schemas->Add( L"http://www.contoso.com/books", L"books.xsd" ); + booksSettings->ValidationType = ValidationType::Schema; + booksSettings->ValidationEventHandler += gcnew ValidationEventHandler( booksSettingsValidationEventHandler ); + XmlReader^ books = XmlReader::Create( L"books.xml", booksSettings ); + while ( books->Read() ) + {} + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp new file mode 100644 index 00000000000..ccf73e57aee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.Credentials/CPP/secresolver2.cpp @@ -0,0 +1,37 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Net; +int main() +{ + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" ); + + // Create a secure resolver with default credentials. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,"http://myServer/data/" ); + sResolver->Credentials = CredentialCache::DefaultCredentials; + + // Use the secure resolver to resolve resources. + reader->XmlResolver = sResolver; + + // Parse the file. + while ( reader->Read() ) + { + + // Do any additional processing here. + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp new file mode 100644 index 00000000000..3da4b5ed406 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlSecureResolver.cctor/CPP/secresolver.cpp @@ -0,0 +1,41 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Security; +using namespace System::Security::Policy; +using namespace System::Net; + +// NOTE: To test, replace www.contoso.com w/ the local string + +// +Object^ GetFile( String^ fileURL, XmlResolver^ resolver ) +{ + // Generate the default PermissionSet using the file URL. + Evidence^ evidence = XmlSecureResolver::CreateEvidenceForUrl( fileURL ); + PermissionSet^ myPermissions = SecurityManager::ResolvePolicy( evidence ); + + // Modify the PermissionSet to only allow access to http://www.contoso.com. + // Create a WebPermission which only allows access to http://www.contoso.com. + WebPermission^ myWebPermission = gcnew WebPermission( + NetworkAccess::Connect,"http://www.contoso.com" ); + // Replace the existing WebPermission in myPermissions with the updated WebPermission. + myPermissions->SetPermission( myWebPermission ); + + // Use the modified PermissionSet to construct the XmlSecureResolver. + XmlSecureResolver^ sResolver = gcnew XmlSecureResolver( resolver,myPermissions ); + + // Get the object. + Uri^ fullUri = sResolver->ResolveUri( nullptr, fileURL ); + return sResolver->GetEntity( fullUri, nullptr, nullptr ); +} +// + +int main() +{ + Stream^ s = (Stream^)(GetFile( "http://localhost/data/books.xml", + gcnew XmlUrlResolver )); + XmlTextReader^ reader = gcnew XmlTextReader( s ); +} diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp new file mode 100644 index 00000000000..91be2b8ba6b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Cctor/CPP/readfrag.cpp @@ -0,0 +1,47 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XML fragment to be parsed. + String^ xmlFrag = " Pride And Prejudice novel "; + + // Create the XmlNamespaceManager. + NameTable^ nt = gcnew NameTable; + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); + nsmgr->AddNamespace( "bk", "urn:sample" ); + + // Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); + + // Parse the XML. If they exist, display the prefix and + // namespace URI of each element. + while ( reader->Read() ) + { + if ( reader->IsStartElement() ) + { + if ( reader->Prefix == String::Empty ) + Console::WriteLine( "< {0}>", reader->LocalName ); + else + { + Console::Write( "< {0}: {1}>", reader->Prefix, reader->LocalName ); + Console::WriteLine( " The namespace URI is {0}", reader->NamespaceURI ); + } + } + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp new file mode 100644 index 00000000000..5ef9f82c8ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.LineNum/CPP/readlinenum.cpp @@ -0,0 +1,57 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XML fragment to be parsed. + String^ xmlFrag = "\n" + "\n" + "\n" + "240\n" + "\n" + "\n"; + + // Create the XmlNamespaceManager. + NameTable^ nt = gcnew NameTable; + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); + + // Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); + + // Parse the XML and display each node. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition ); + Console::WriteLine( "< {0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition ); + Console::WriteLine( " {0}", reader->Value ); + break; + + case XmlNodeType::EndElement: + Console::Write( " {0} {1}, {2} ", reader->Depth, reader->LineNumber, reader->LinePosition ); + Console::WriteLine( "", reader->Name ); + break; + } + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp new file mode 100644 index 00000000000..d7a782ca81e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.Normalization/CPP/readnormal.cpp @@ -0,0 +1,45 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XML fragment to be parsed. + String^ xmlFrag = "\n" + "\n"; + + // Create the XmlNamespaceManager. + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( gcnew NameTable ); + + // Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::Preserve ); + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); + + // Show attribute value normalization. + reader->Read(); + reader->Normalization = false; + Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr1" ) ); + reader->Normalization = true; + Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr1" ) ); + + // Set Normalization back to false. This allows the reader to accept + // character entities in the � to  range. If Normalization had + // been set to true, character entities in this range throw an exception. + reader->Normalization = false; + reader->Read(); + reader->MoveToContent(); + Console::WriteLine( "Attribute value: {0}", reader->GetAttribute( "attr2" ) ); + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp new file mode 100644 index 00000000000..67a11857486 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ReadAttributeValue/CPP/readattrval.cpp @@ -0,0 +1,46 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = nullptr; + __try + { + + // Create the XML fragment to be parsed. + String^ xmlFrag = ""; + + // Create the XmlParserContext. + XmlParserContext^ context; + String^ subset = ""; + context = gcnew XmlParserContext( nullptr,nullptr,"book",nullptr,nullptr,subset,"","",XmlSpace::None ); + + // Create the reader. + reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); + + // Read the misc attribute. The attribute is parsed + // into multiple text and entity reference nodes. + reader->MoveToContent(); + reader->MoveToAttribute( "misc" ); + while ( reader->ReadAttributeValue() ) + { + if ( reader->NodeType == XmlNodeType::EntityReference ) + Console::WriteLine( " {0} {1}", reader->NodeType, reader->Name ); + else + Console::WriteLine( " {0} {1}", reader->NodeType, reader->Value ); + } + } + __finally + { + if ( reader != nullptr ) + reader->Close(); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp new file mode 100644 index 00000000000..43944b7d4c9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.ResetState/CPP/resetstate.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +int main() +{ + Encoding^ enc = gcnew UTF8Encoding; + array^utf8Buffer = enc->GetBytes( " 12345 " ); + enc = gcnew UnicodeEncoding; + array^unicodeBuffer = enc->GetBytes( " root " ); + MemoryStream^ memStrm = gcnew MemoryStream; + memStrm->Write( unicodeBuffer, 0, unicodeBuffer->Length ); + memStrm->Write( utf8Buffer, 0, utf8Buffer->Length ); + memStrm->Position = 0; + XmlTextReader^ reader = gcnew XmlTextReader( memStrm ); + while ( reader->Read() ) + { + Console::WriteLine( "NodeType: {0}", reader->NodeType ); + if ( XmlNodeType::EndElement == reader->NodeType && "root" == reader->Name ) + break; + if ( XmlNodeType::EndElement == reader->NodeType ) + reader->ResetState(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp new file mode 100644 index 00000000000..baa5d62f323 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlLang/CPP/readlang.cpp @@ -0,0 +1,50 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the XML fragment to be parsed. + String^ xmlFrag = " Colour Analysis Color Analysis "; + + // Create the XmlNamespaceManager. + NameTable^ nt = gcnew NameTable; + XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); + + // Create the XmlParserContext. + XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( xmlFrag,XmlNodeType::Element,context ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Parse the XML and display each of the nodes, including the xml:lang setting. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::WriteLine( "{0}: < {1}>", reader->XmlLang, reader->Name ); + break; + + case XmlNodeType::Text: + Console::WriteLine( "{0}: {1}", reader->XmlLang, reader->Value ); + break; + + case XmlNodeType::EndElement: + Console::WriteLine( "{0}: ", reader->XmlLang, reader->Name ); + break; + } + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp new file mode 100644 index 00000000000..dcc839cdab3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlResolver/CPP/rdr_resolver.cpp @@ -0,0 +1,34 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Net; +int main() +{ + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( "http://myServer/data/books.xml" ); + + // Supply the credentials necessary to access the Web server. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + resolver->Credentials = CredentialCache::DefaultCredentials; + reader->XmlResolver = resolver; + + // Parse the file. + while ( reader->Read() ) + { + + // Do any additional processing here. + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp new file mode 100644 index 00000000000..ae4be95667f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.XmlSpace/CPP/readspace.cpp @@ -0,0 +1,41 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = gcnew XmlTextReader( "authors.xml" ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Parse the file. Return white space only if an + // xml:space='preserve' attribute is found. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( "<{0}>", reader->Name ); + if ( reader->XmlSpace == XmlSpace::Preserve ) + reader->WhitespaceHandling = WhitespaceHandling::Significant; + break; + + case XmlNodeType::Text: + Console::Write( reader->Value ); + break; + + case XmlNodeType::EndElement: + Console::Write( "", reader->Name ); + break; + + case XmlNodeType::SignificantWhitespace: + Console::Write( reader->Value ); + break; + } + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp new file mode 100644 index 00000000000..32f5080e71f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextReader.cctor1/CPP/rdrcctor1.cpp @@ -0,0 +1,41 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + String^ xmlData = "\r\n Oberon's Legacy\r\n 5.95\r\n "; + + // Create the reader. + XmlTextReader^ reader = gcnew XmlTextReader( gcnew StringReader( xmlData ) ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Display each element node. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( "<{0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( reader->Value ); + break; + + case XmlNodeType::EndElement: + Console::Write( "", reader->Name ); + break; + } + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp b/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp new file mode 100644 index 00000000000..7457e02c9e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlTextWriter.Flush/CPP/write2docs.cpp @@ -0,0 +1,32 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + + // Use indenting for readability + writer->Formatting = Formatting::Indented; + + // Write an XML fragment. + writer->WriteStartElement( "book" ); + writer->WriteElementString( "title", "Pride And Prejudice" ); + writer->WriteEndElement(); + writer->Flush(); + + // Write another XML fragment. + writer->WriteStartElement( "cd" ); + writer->WriteElementString( "title", "Americana" ); + writer->WriteEndElement(); + writer->Flush(); + + // Close the writer. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp new file mode 100644 index 00000000000..1b175cb5e4e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.Cctor/CPP/valid_xsd2.cpp @@ -0,0 +1,64 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +public ref class Sample +{ +private: + static Boolean m_success = true; + +public: + Sample() + { + + // Validate the document using an external XSD schema. Validation should fail. + Validate( "notValidXSD.xml" ); + + // Validate the document using an inline XSD. Validation should succeed. + Validate( "inlineXSD.xml" ); + } + + +private: + + // Display the validation error. + void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) + { + m_success = false; + Console::WriteLine( "\r\n\tValidation error: {0}", args->Message ); + } + + void Validate( String^ filename ) + { + m_success = true; + Console::WriteLine( "\r\n******" ); + Console::WriteLine( "Validating XML file {0}", filename ); + XmlTextReader^ txtreader = gcnew XmlTextReader( filename ); + XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); + + // Set the validation event handler + reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationCallBack ); + + // Read XML data + while ( reader->Read() ) + {} + + Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful!" : "failed.") ); + + // Close the reader. + reader->Close(); + } + +}; + +int main() +{ + Sample^ validation = gcnew Sample; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp new file mode 100644 index 00000000000..d4ffcecd285 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.IsDefault/CPP/readdefattr.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create the reader. + XmlTextReader^ txtreader = gcnew XmlTextReader( "book4.xml" ); + XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); + reader->MoveToContent(); + + // Display each of the attribute nodes, including default attributes. + while ( reader->MoveToNextAttribute() ) + { + if ( reader->IsDefault ) + Console::Write( "(default attribute) " ); + + Console::WriteLine( " {0} = {1}", reader->Name, reader->Value ); + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp new file mode 100644 index 00000000000..8704a0b66bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.SchemaType/CPP/schematype.cpp @@ -0,0 +1,51 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; + +public ref class Sample +{ +private: + static void ValidationCallBack( Object^ sender, ValidationEventArgs^ args ) + { + Console::WriteLine( "***Validation error" ); + Console::WriteLine( "\tSeverity: {0}", args->Severity ); + Console::WriteLine( "\tMessage : {0}", args->Message ); + } + +public: + static void main() + { + XmlTextReader^ tr = gcnew XmlTextReader( "booksSchema.xml" ); + XmlValidatingReader^ vr = gcnew XmlValidatingReader( tr ); + vr->Schemas->Add( nullptr, "books.xsd" ); + vr->ValidationType = ValidationType::Schema; + vr->ValidationEventHandler += gcnew ValidationEventHandler( Sample::ValidationCallBack ); + while ( vr->Read() ) + { + if ( vr->NodeType == XmlNodeType::Element ) + { + if ( dynamic_cast(vr->SchemaType) != nullptr ) + { + XmlSchemaComplexType^ sct = dynamic_cast(vr->SchemaType); + Console::WriteLine( " {0}( {1})", vr->Name, sct->Name ); + } + else + { + Object^ value = vr->ReadTypedValue(); + Console::WriteLine( " {0}( {1}): {2}", vr->Name, value->GetType()->Name, value ); + } + } + } + } +}; + +int main() +{ + Sample::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp new file mode 100644 index 00000000000..c8b97c43ecc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlValidatingReader.XmlResolver/CPP/vrdr_resolver.cpp @@ -0,0 +1,59 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + array^args = Environment::GetCommandLineArgs(); + String^ UserName = args[ 1 ]; + String^ SecurelyStoredPassword = args[ 2 ]; + String^ Domain = args[ 3 ]; + + // + // Create the reader. -> + XmlTextReader^ txtreader = gcnew XmlTextReader( "book5.xml" ); + XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); + txtreader->WhitespaceHandling = WhitespaceHandling::None; + + // Set the credentials necessary to access the DTD file stored on the network. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + resolver->Credentials = System::Net::CredentialCache::DefaultCredentials; + reader->XmlResolver = resolver; + + // Display each of the element nodes. + while ( reader->Read() ) + { + switch ( reader->NodeType ) + { + case XmlNodeType::Element: + Console::Write( "< {0}>", reader->Name ); + break; + + case XmlNodeType::Text: + Console::Write( reader->Value ); + break; + + case XmlNodeType::DocumentType: + Console::Write( "Name, reader->Value ); + break; + + case XmlNodeType::EntityReference: + Console::Write( reader->Name ); + break; + + case XmlNodeType::EndElement: + Console::Write( "", reader->Name ); + break; + } + } + + + // Close the reader. + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp new file mode 100644 index 00000000000..ff9fd542be2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.Close/CPP/XmlWriter.Close.cpp @@ -0,0 +1,32 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + + // Create a writer to write XML to the console. + XmlWriterSettings^ settings = gcnew XmlWriterSettings; + settings->Indent = true; + settings->OmitXmlDeclaration = true; + XmlWriter^ writer = XmlWriter::Create( Console::Out, settings ); + + // Write the book element. + writer->WriteStartElement( L"book" ); + + // Write the title element. + writer->WriteStartElement( L"title" ); + writer->WriteString( L"Pride And Prejudice" ); + writer->WriteEndElement(); + + // Write the close tag for the root element. + writer->WriteEndElement(); + + // Write the XML and close the writer. + writer->Close(); + return 1; +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp new file mode 100644 index 00000000000..ca3bcbf4373 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.Flush/CPP/write2docs_v2.cpp @@ -0,0 +1,33 @@ + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +void main() +{ + + // Create an XmlWriter to write XML fragments. + XmlWriterSettings^ settings = gcnew XmlWriterSettings; + settings->ConformanceLevel = ConformanceLevel::Fragment; + settings->Indent = true; + XmlWriter^ writer = XmlWriter::Create( Console::Out, settings ); + + // Write an XML fragment. + writer->WriteStartElement( L"book" ); + writer->WriteElementString( L"title", L"Pride And Prejudice" ); + writer->WriteEndElement(); + writer->Flush(); + + // Write another XML fragment. + writer->WriteStartElement( L"cd" ); + writer->WriteElementString( L"title", L"Americana" ); + writer->WriteEndElement(); + writer->Flush(); + + // Close the writer. + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp new file mode 100644 index 00000000000..59b7bac475a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributeString/CPP/writeattrstring.cpp @@ -0,0 +1,29 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +void main() +{ + XmlWriter^ writer = nullptr; + writer = XmlWriter::Create( L"sampledata.xml" ); + + // Write the root element. + writer->WriteStartElement( L"book" ); + + // Write the xmlns:bk="urn:book" namespace declaration. + writer->WriteAttributeString( L"xmlns", L"bk", nullptr, L"urn:book" ); + + // Write the bk:ISBN="1-800-925" attribute. + writer->WriteAttributeString( L"ISBN", L"urn:book", L"1-800-925" ); + writer->WriteElementString( L"price", L"19.95" ); + + // Write the close tag for the root element. + writer->WriteEndElement(); + + // Write the XML to file and close the writer. + writer->Flush(); + writer->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp new file mode 100644 index 00000000000..cd4481a5f86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteAttributes/CPP/writeattrs_v2.cpp @@ -0,0 +1,32 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +void main() +{ + XmlReader^ reader = XmlReader::Create( L"test1.xml" ); + XmlWriterSettings^ settings = gcnew XmlWriterSettings; + settings->Indent = true; + XmlWriter^ writer = XmlWriter::Create( Console::Out ); + while ( reader->Read() ) + { + if ( reader->NodeType == XmlNodeType::Element ) + { + writer->WriteStartElement( reader->Name->ToUpper() ); + writer->WriteAttributes( reader, false ); + if ( reader->IsEmptyElement ) + writer->WriteEndElement(); + } + else + if ( reader->NodeType == XmlNodeType::EndElement ) + { + writer->WriteEndElement(); + } + } + + writer->Close(); + reader->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp new file mode 100644 index 00000000000..af773508941 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteBase64/CPP/writebase64.cpp @@ -0,0 +1,143 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Text; +ref class TestBase64 +{ +private: + static int bufferSize = 4096; + +public: + + // Use the WriteBase64 method to create an XML document. The object + // passed by the user is encoded and included in the document. + void EncodeXmlFile( String^ xmlFileName, FileStream^ fileOld ) + { + array^buffer = gcnew array(bufferSize); + int readByte = 0; + XmlTextWriter^ xw = gcnew XmlTextWriter( xmlFileName,Encoding::UTF8 ); + xw->WriteStartDocument(); + xw->WriteStartElement( "root" ); + + // Create a Char writer. + BinaryReader^ br = gcnew BinaryReader( fileOld ); + + // Set the file pointer to the end. + try + { + do + { + readByte = br->Read( buffer, 0, bufferSize ); + xw->WriteBase64( buffer, 0, readByte ); + } + while ( bufferSize <= readByte ); + } + catch ( Exception^ ex ) + { + EndOfStreamException^ ex1 = gcnew EndOfStreamException; + if ( ex1->Equals( ex ) ) + Console::WriteLine( "We are at end of file" ); + else + Console::WriteLine( ex ); + } + + xw->WriteEndElement(); + xw->WriteEndDocument(); + xw->Flush(); + xw->Close(); + } + + // Use the ReadBase64 method to decode the new XML document + // and generate the original object. + void DecodeOrignalObject( String^ xmlFileName, FileStream^ fileNew ) + { + array^buffer = gcnew array(bufferSize); + int readByte = 0; + + // Create a file to write the bmp back. + BinaryWriter^ bw = gcnew BinaryWriter( fileNew ); + XmlTextReader^ tr = gcnew XmlTextReader( xmlFileName ); + tr->MoveToContent(); + Console::WriteLine( tr->Name ); + do + { + readByte = tr->ReadBase64( buffer, 0, bufferSize ); + bw->Write( buffer, 0, readByte ); + } + while ( readByte >= bufferSize ); + + bw->Flush(); + } + + // Compare the two files. + bool CompareResult( FileStream^ fileOld, FileStream^ fileNew ) + { + int readByteOld = 0; + int readByteNew = 0; + int count; + int readByte = 0; + array^bufferOld = gcnew array(bufferSize); + array^bufferNew = gcnew array(bufferSize); + BinaryReader^ binaryReaderOld = gcnew BinaryReader( fileOld ); + BinaryReader^ binaryReaderNew = gcnew BinaryReader( fileNew ); + binaryReaderOld->BaseStream->Seek( 0, SeekOrigin::Begin ); + binaryReaderNew->BaseStream->Seek( 0, SeekOrigin::Begin ); + do + { + readByteOld = binaryReaderOld->Read( bufferOld, 0, bufferSize ); + readByteNew = binaryReaderNew->Read( bufferNew, 0, bufferSize ); + if ( readByteOld != readByteNew ) + return false; + + for ( count = 0; count < bufferSize; ++count ) + if ( bufferOld[ count ] != bufferNew[ count ] ) + return false; + } + while ( count < readByte ); + + return true; + } + + // Display the usage statement. + void Usage() + { + Console::WriteLine( "TestBase64 sourceFile, targetFile \n" ); + Console::WriteLine( "For example: TestBase64 winlogon.bmp, target.bmp\n" ); + } +}; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + TestBase64^ testBase64 = gcnew TestBase64; + + // Check that the usage is correct. + if ( args->Length < 3 ) + { + testBase64->Usage(); + return 1; + } + + FileStream^ fileOld = gcnew FileStream( args[ 1 ],FileMode::OpenOrCreate,FileAccess::Read,FileShare::Read ); + testBase64->EncodeXmlFile( "temp.xml", fileOld ); + FileStream^ fileNew = gcnew FileStream( args[ 2 ],FileMode::Create,FileAccess::ReadWrite,FileShare::ReadWrite ); + testBase64->DecodeOrignalObject( "temp.xml", fileNew ); + + // Compare the two files. + if ( testBase64->CompareResult( fileOld, fileNew ) ) + Console::WriteLine( "The recreated binary file {0} is the same as {1}", args[ 2 ], args[ 1 ] ); + else + Console::WriteLine( "The recreated binary file {0} is not the same as {1}", args[ 2 ], args[ 1 ] ); + + fileOld->Flush(); + fileNew->Flush(); + fileOld->Close(); + fileNew->Close(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp new file mode 100644 index 00000000000..1b8726a4f19 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteElementString/CPP/writeelemstring_v2.cpp @@ -0,0 +1,71 @@ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +public ref class Sample +{ +private: + static String^ m_Document = L"sampledata.xml"; + +public: + static void Main() + { + XmlWriter^ writer = nullptr; + try + { + XmlWriterSettings^ settings = gcnew XmlWriterSettings; + settings->Indent = true; + writer = XmlWriter::Create( m_Document,settings ); + writer->WriteComment( L"sample XML fragment" ); + + // Write an element (this one is the root). + writer->WriteStartElement( L"book" ); + + // Write the namespace declaration. + writer->WriteAttributeString( L"xmlns", L"bk", nullptr, L"urn:samples" ); + + // Write the genre attribute. + writer->WriteAttributeString( L"genre", L"novel" ); + + // Write the title. + writer->WriteStartElement( L"title" ); + writer->WriteString( L"The Handmaid's Tale" ); + writer->WriteEndElement(); + + // Write the price. + writer->WriteElementString( L"price", L"19.95" ); + + // Lookup the prefix and write the ISBN element. + String^ prefix = writer->LookupPrefix( L"urn:samples" ); + writer->WriteStartElement( prefix, L"ISBN", L"urn:samples" ); + writer->WriteString( L"1-861003-78" ); + writer->WriteEndElement(); + + // Write the style element (shows a different way to handle prefixes). + writer->WriteElementString( L"style", L"urn:samples", L"hardcover" ); + + // Write the close tag for the root element. + writer->WriteEndElement(); + + // Write the XML to file and close the writer. + writer->Flush(); + writer->Close(); + } + finally + { + if ( writer != nullptr ) + writer->Close(); + } + + } + +}; + +void main() +{ + Sample::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp new file mode 100644 index 00000000000..a34c595c6da --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XmlWriter.WriteNode/CPP/writenode.cpp @@ -0,0 +1,40 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + XmlTextReader^ reader = gcnew XmlTextReader( "books.xml" ); + reader->WhitespaceHandling = WhitespaceHandling::None; + + // Move the reader to the first book element. + reader->MoveToContent(); + reader->Read(); + + // Create a writer that outputs to the console. + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + writer->Formatting = Formatting::Indented; + + // Write the start tag. + writer->WriteStartElement( "myBooks" ); + + // Write the first book. + writer->WriteNode( reader, false ); + + // Skip the second book. + reader->Skip(); + + // Write the last book. + writer->WriteNode( reader, false ); + writer->WriteEndElement(); + + // Close the writer and the reader. + writer->Close(); + reader->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp b/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp new file mode 100644 index 00000000000..c26844cce27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XslTRansform.Transform7/CPP/trans_snip4.cpp @@ -0,0 +1,25 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; + +int main() +{ + // + // Create a resolver with default credentials. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + resolver->Credentials = System::Net::CredentialCache::DefaultCredentials; + + // Create the XslTransform object. + XslTransform^ xslt = gcnew XslTransform; + + // Load the stylesheet. + xslt->Load( "http://myServer/data/authors.xsl", resolver ); + + // Transform the file. + xslt->Transform( "books.xml", "books.html", resolver ); + // +} diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp new file mode 100644 index 00000000000..c1c69b21c5d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XslTransform.Load3/CPP/trans3.cpp @@ -0,0 +1,38 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; +int main() +{ + String^ filename = "books.xml"; + String^ stylesheet = "titles.xsl"; + + // Create the reader to load the stylesheet. + // Move the reader to the xsl:stylesheet node. + XmlTextReader^ reader = gcnew XmlTextReader( stylesheet ); + reader->Read(); + reader->Read(); + + // Create the XslTransform object and load the stylesheet. + XslTransform^ xslt = gcnew XslTransform; + xslt->Load( reader ); + + // Load the file to transform. + XPathDocument^ doc = gcnew XPathDocument( filename ); + + // Create an XmlTextWriter which outputs to the console. + XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); + + // Transform the file and send the output to the console. + xslt->Transform(doc,nullptr,writer); + writer->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp new file mode 100644 index 00000000000..589fa928b67 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XslTransform.Load4/CPP/trans_ev.cpp @@ -0,0 +1,35 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; +void TransformFile( XmlReader^ xsltReader, String^ secureURL ); +int main() +{ + String^ stylesheet = "c:\\tmp\\output.xsl"; + String^ myURL = "http://localhost/data"; + XmlTextReader^ reader = gcnew XmlTextReader( stylesheet ); + TransformFile( reader, myURL ); +} + + +// Perform an XSLT transformation where xsltReader is an XmlReader containing +// a stylesheet and secureURI is a trusted URI that can be used to create Evidence. +// +void TransformFile( XmlReader^ xsltReader, String^ secureURL ) +{ + + // Load the stylesheet using a default XmlUrlResolver and Evidence + // created using the trusted URL. + XslTransform^ xslt = gcnew XslTransform; + xslt->Load( xsltReader, gcnew XmlUrlResolver, XmlSecureResolver::CreateEvidenceForUrl( secureURL ) ); + + // Transform the file. + xslt->Transform("books.xml","books.html",gcnew XmlUrlResolver); +} + +// diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp new file mode 100644 index 00000000000..4b4ca81384f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform2/CPP/trans_snip.cpp @@ -0,0 +1,27 @@ +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; + +int main() +{ +// + XmlDocument^ doc = gcnew XmlDocument; + doc->Load( "books.xml" ); + + // Modify the XML file. + XmlElement^ root = doc->DocumentElement; + root->FirstChild->LastChild->InnerText = "12.95"; + + // Create an XPathNavigator to use for the transform. + XPathNavigator^ nav = root->CreateNavigator(); + + // Transform the file. + XslTransform^ xslt = gcnew XslTransform; + xslt->Load( "output.xsl" ); + XmlTextWriter^ writer = gcnew XmlTextWriter( "books.html", nullptr ); + xslt->Transform( nav, nullptr, writer, nullptr); +// +} diff --git a/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp new file mode 100644 index 00000000000..93872c9a3c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/XslTransform.Transform4/CPP/trans_snip3.cpp @@ -0,0 +1,41 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; +using namespace System::Xml::XPath; + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + String^ UserName = args[ 1 ]; + String^ SecurelyStoredPassword = args[ 2 ]; + String^ Domain = args[ 3 ]; + + // + // Create the XslTransform object. + XslTransform^ xslt = gcnew XslTransform; + + // Load the stylesheet. + xslt->Load( "titles.xsl" ); + + // Create a resolver and specify the necessary credentials. + XmlUrlResolver^ resolver = gcnew XmlUrlResolver; + System::Net::NetworkCredential^ myCred; + myCred = gcnew System::Net::NetworkCredential( UserName, SecurelyStoredPassword, Domain ); + resolver->Credentials = myCred; + + // Transform the file using the resolver. The resolver is used + // to process the XSLT document() function. + XPathDocument^ doc = gcnew XPathDocument( "books.xml" ); + XmlReader^ reader = xslt->Transform( doc, nullptr, resolver ); + + // Load the reader into a new document for more processing. + XmlDocument^ xmldoc = gcnew XmlDocument; + xmldoc->Load( reader ); + // + + Console::WriteLine( xmldoc->OuterXml ); +} diff --git a/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp b/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp new file mode 100644 index 00000000000..326d279b9ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Data/xsltransform.transform3/CPP/trans_snip2.cpp @@ -0,0 +1,20 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Xsl; + +int main() +{ + // + // Create the XslTransform object. + XslTransform^ xslt = gcnew XslTransform; + + // Load the stylesheet. + xslt->Load( "output.xsl" ); + + // Transform the file. + xslt->Transform("books.xml","books.html"); + // +} diff --git a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp new file mode 100644 index 00000000000..df2c6373e93 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange/cpp/source.cpp @@ -0,0 +1,47 @@ +/*System::Net::HttpWebRequest->AddRange(int, int) +This program demonstrates 'AddRange(int, int)' method of 'HttpWebRequest class. +A new 'HttpWebRequest' Object* is created. The number of characters of the response to be received can be +restricted by the 'AddRange' method.By calling 'AddRange(50, 150)' on the 'HttpWebRequest' Object* the content +of the response page is restricted from the 50th character to 150th charater. The response of the request is +obtained and displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; + +int main() +{ + try + { +// + // Create a New 'HttpWebRequest' object. + HttpWebRequest^ myHttpWebRequest1 = + (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + myHttpWebRequest1->AddRange( 1000); + Console::WriteLine("Call AddRange(1000)"); + Console::Write("Resulting Headers: "); + Console::WriteLine(myHttpWebRequest1->Headers); + + HttpWebRequest^ myHttpWebRequest2 = + (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + myHttpWebRequest2->AddRange(-1000); + Console::WriteLine("Call AddRange(-1000)"); + Console::Write("Resulting Headers: "); + Console::WriteLine(myHttpWebRequest2->Headers); + +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp new file mode 100644 index 00000000000..68d09127497 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Misc/system.net.httpwebrequest.addrange2/cpp/source.cpp @@ -0,0 +1,63 @@ +/*System::Net::HttpWebRequest->AddRange(int, int) +This program demonstrates 'AddRange(int, int)' method of 'HttpWebRequest class. +A new 'HttpWebRequest' Object* is created. The number of characters of the response to be received can be +restricted by the 'AddRange' method.By calling 'AddRange(50, 150)' on the 'HttpWebRequest' Object* the content +of the response page is restricted from the 50th character to 150th charater. The response of the request is +obtained and displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; + +int main() +{ + try + { +// + // Create a New 'HttpWebRequest' object. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + myHttpWebRequest->AddRange( 50, 150 ); + Console::WriteLine("Call AddRange(50, 150)"); + Console::Write("Resulting Request Headers: "); + Console::WriteLine(myHttpWebRequest->Headers); + + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + + // Displays the headers in the response received + Console::Write("Resulting Response Headers: "); + Console::WriteLine(myHttpWebResponse->Headers); + + // Display the contents of the page to the console. + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuffer = gcnew array(256); + int count = streamRead->Read( readBuffer, 0, 256 ); + Console::WriteLine( "\nThe HTML contents of the page from 50th to 150 charaters are :\n " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuffer,0,count ); + Console::WriteLine( outputData ); + count = streamRead->Read( readBuffer, 0, 256 ); + } + streamRead->Close(); + streamResponse->Close(); + myHttpWebResponse->Close(); +// + Console::WriteLine( "\nPress 'Enter' Key to Continue..........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp b/snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp new file mode 100644 index 00000000000..188aacb6278 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ActivatedServiceTypeEntry_ObjectType_Client/CPP/activatedservicetypeentry_objecttype_server.cpp @@ -0,0 +1,53 @@ +// System.Runtime.Remoting.ActivatedServiceTypeEntry +// System.Runtime.Remoting.ActivatedServiceTypeEntry.ObjectType +// System.Runtime.Remoting.ActivatedServiceTypeEntry.ToString + +/* +The following example demonstrates the 'ActivatedServiceTypeEntry' class and +the 'ObjectType' property ,'ToString' method of 'ActivatedServiceTypeEntry' class. +It registers a 'TcpChannel' object with the channel services. Then registers the 'HelloServer' +object at the service end that can be activated on request from a client.By using the +'GetRegisteredActivatedServiceTypes' method it gets the registered activated service types +and displays it's information to the console:: +*/ + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +void main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); + + // Create an instance of 'ActivatedServiceTypeEntry' class + // which holds the values for 'HelloServer' type. + ActivatedServiceTypeEntry^ myActivatedServiceTypeEntry = + gcnew ActivatedServiceTypeEntry( HelloServer::typeid ); + + // Register an object Type on the service end so that + // it can be activated on request from a client. + RemotingConfiguration::RegisterActivatedServiceType( + myActivatedServiceTypeEntry ); + +// +// + // Get the registered activated service types. + array^ activatedServiceEntries = + RemotingConfiguration::GetRegisteredActivatedServiceTypes(); + Console::WriteLine( "Information of first registered activated" + + " service type :" ); + Console::WriteLine( "Object type: {0}", + activatedServiceEntries[ 0 ]->ObjectType->ToString() ); + Console::WriteLine( "Description: {0}", + activatedServiceEntries[ 0 ]->ToString() ); +// +// + + Console::WriteLine( "Press enter to stop this process" ); + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp b/snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp new file mode 100644 index 00000000000..eaec1a8cfc9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/AuthenticationManager_UnRegister2/CPP/authenticationmanager_unregister2.cpp @@ -0,0 +1,63 @@ +// System.Net.AuthenticationManager.UnRegister(String). +// System.Net.AuthenticationManager.Register. +// Grouping Clause : 1,3 AND 2,3. + +/*This program demonstrates the 'UnRegister(String)' and 'Register' methods of +'AuthenticationManager' class. It gets all the authentication modules registered with the system into an +IEnumerator instance ,unregisters the first authentication module and displays to show that it was +unregistered. Then registers the same module back again and displays all the modules again.*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Collections; + +// +void DisplayAllModules() +{ + IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; + Console::WriteLine( "\n\tThe following modules are now registered with the system:" ); + while ( registeredModules->MoveNext() ) + { + Console::WriteLine( "\n\t\tModule : {0}", registeredModules->Current ); + IAuthenticationModule^ currentAuthenticationModule = dynamic_cast(registeredModules->Current); + Console::WriteLine( "\t\t\t CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate ); + } +} +// + +int main() +{ + try + { +// +// + IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; + // Display all the modules that are already registered with the system. + DisplayAllModules(); + registeredModules->Reset(); + registeredModules->MoveNext(); + // Get the first Authentication module registered with the system. + IAuthenticationModule^ authenticationModule1 = dynamic_cast(registeredModules->Current); + // Call the UnRegister() method to unregister the first authentication module from the system. + String^ authenticationScheme = authenticationModule1->AuthenticationType; + AuthenticationManager::Unregister( authenticationScheme ); + Console::WriteLine( "\nSuccessfully unregistered '{0}'.", authenticationModule1 ); + // Display all modules to see that the module was unregistered. + DisplayAllModules(); +// + // Calling 'Register()' method to register 'authenticationModule1' module back again. + AuthenticationManager::Register( authenticationModule1 ); + Console::WriteLine( "\nSuccessfully re-registered '{0}'.", authenticationModule1 ); + // Display the modules to verify that 'authenticationModule1' has been registered back again. + DisplayAllModules(); +// + Console::WriteLine( "Press any key to continue" ); + Console::ReadLine(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\n The following Exception was raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp b/snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp new file mode 100644 index 00000000000..9d25d5c5604 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Authorization_Constructor3/CPP/authorization_constructor3.cpp @@ -0,0 +1,104 @@ + + +// System::Net::Authorization::Authorization(String*, bool, String*) +/* This program demonstrates the contructor 'Authorization(String*, bool, String*)' of the authorization +* class. +* +* We implement the interface S"IAuthenticationModule*" to make CloneBasic which is a custom authentication module. +* The custom authentication module encodes username and password as base64 strings and then returns +* back an authorization instance. This authorization is internally used by the HttpWebRequest for +* authentication. +* * +* Please Note : This program has to be compiled as a dll. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +namespace CloneBasicAuthentication +{ + public ref class CloneBasic: public IAuthenticationModule + { + private: + String^ m_authenticationType; + bool m_canPreAuthenticate; + + public: + CloneBasic() + { + m_authenticationType = "CloneBasic"; + m_canPreAuthenticate = false; + } + + property String^ AuthenticationType + { + virtual String^ get() + { + return m_authenticationType; + } + } + + property bool CanPreAuthenticate + { + virtual bool get() + { + return m_canPreAuthenticate; + } + } + + // + virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) + { + try + { + String^ message; + + // Check if Challenge String* was raised by a site which requires CloneBasic authentication. + if ( (challenge == nullptr) || ( !challenge->StartsWith( "CloneBasic" )) ) + return nullptr; + NetworkCredential^ myCredentials; + if ( dynamic_cast(credentials) == nullptr ) + { + myCredentials = credentials->GetCredential( request->RequestUri, "CloneBasic" ); + if ( myCredentials == nullptr ) + return nullptr; + } + else + myCredentials = dynamic_cast(credentials); + + // Message encryption scheme : + // a)Concatenate username and password seperated by space; + // b)Apply ASCII encoding to obtain a stream of bytes; + // c)Apply Base64 Encoding to this array of bytes to obtain our encoded authorization message. + message = String::Concat( myCredentials->UserName, " ", myCredentials->Password ); + + // Apply AsciiEncoding to our user name and password to obtain it as an array of bytes. + Encoding^ asciiEncoding = Encoding::ASCII; + array^byteArray = gcnew array(asciiEncoding->GetByteCount( message )); + byteArray = asciiEncoding->GetBytes( message ); + + // Perform Base64 transform. + message = Convert::ToBase64String( byteArray ); + + // The following overloaded contructor sets the 'Message' property of authorization to the base64 String*; + // that we just formed and it also sets the 'Complete' property to true and the connection group id; + // to the domain of the NetworkCredential Object*. + Authorization^ myAuthorization = gcnew Authorization( String::Concat( "CloneBasic ", message, true, request->ConnectionGroupName ) ); + return myAuthorization; + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Raised ...: {0}", e->Message ); + return nullptr; + } + } + // + + virtual Authorization^ PreAuthenticate( WebRequest^ request, ICredentials^ credentials ) + { + return nullptr; + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp b/snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp new file mode 100644 index 00000000000..6f0a633e81e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Authorization_ProtectionRealm/CPP/authorization_protectionrealm.cpp @@ -0,0 +1,192 @@ + + +// System::Net::Authorization::Authorization(String*, bool);System::Net::Authorization::ProtectionRealm +/* This program demonstrates the 'ProtectionRealm' property and 'Authorization(String*, bool)' constructor of +the S"Authorization" class. The S"IAuthenticationModule*" interface is implemented in 'CloneBasic' to make +it a custom authentication module. The custom authentication module encodes username and password as +base64 strings and then returns back an 'Authorization' instance. The 'Authorization' instance encapsulates +a list of Uri's for which it is applicable using the S"ProtectionRealm" property. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +void GetPage( String^ url, String^ username, String^ passwd ) +{ + try + { + String^ challenge = nullptr; + HttpWebRequest^ myHttpWebRequest = nullptr; + try + { + // Create a 'HttpWebRequest' Object* for the above 'url'. + myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); + + // The following method call throws the 'WebException'. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Release resources of response Object*. + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + for ( int i = 0; i < e->Response->Headers->Count; ++i ) + + // Retrieve the challenge String* from the header S"WWW-Authenticate". + if ( (String::Compare( e->Response->Headers->Keys[ i ], "WWW-Authenticate", true ) == 0) ) + challenge = e->Response->Headers[ i ]; + } + + if ( challenge != nullptr ) + { + // Challenge was raised by the client.Declare your credentials. + NetworkCredential^ myCredentials = gcnew NetworkCredential( username,passwd ); + + // Pass the challenge , 'NetworkCredential' Object* and the 'HttpWebRequest' Object* to the + // 'Authenticate' method of the S"AuthenticationManager" to retrieve an S"Authorization" ; + // instance. + Authorization^ urlAuthorization = AuthenticationManager::Authenticate( challenge, myHttpWebRequest, myCredentials ); + if ( urlAuthorization != nullptr ) + { + Console::WriteLine( "\nSuccessfully Created 'Authorization' object with authorization Message:\n \" {0}\"", urlAuthorization->Message ); + Console::WriteLine( "\n\nThis authorization is valid for the following Uri's:" ); + int count = 0; + System::Collections::IEnumerator^ myEnum = urlAuthorization->ProtectionRealm->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ uri = safe_cast(myEnum->Current); + ++count; + Console::WriteLine( "\nUri->Item[ {0}]: {1}", count, uri ); + } + } + else + Console::WriteLine( "\nAuthorization Object* was returned as 0. Please check if site accepts 'CloneBasic' authentication" ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "\n The following exception was raised : {0}", e->Message ); + } +} + +void PrintUsage() +{ + Console::WriteLine( "\r\nUsage: Try a site which requires CloneBasic(custom made) authentication as below" ); + Console::WriteLine( " Authorization_ProtectionRealm URLname username password" ); + Console::WriteLine( "\nExample:" ); + Console::WriteLine( "\n Authorization_ProtectionRealm http://www.microsoft.com/net/ george george123" ); +} + +// The 'CloneBasic' authentication module class implements 'IAuthenticationModule*'. +public ref class CloneBasic: public IAuthenticationModule +{ +private: + String^ m_authenticationType; + bool m_canPreAuthenticate; + +public: + CloneBasic() + { + m_authenticationType = "CloneBasic"; + m_canPreAuthenticate = false; + } + + property String^ AuthenticationType + { + virtual String^ get() + { + return m_authenticationType; + } + } + + property bool CanPreAuthenticate + { + virtual bool get() + { + return m_canPreAuthenticate; + } + } + + // + // + virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) + { + try + { + String^ message; + + // Check if Challenge String* was raised by a site which requires 'CloneBasic' authentication. + if ( (challenge == nullptr) || ( !challenge->StartsWith( "CloneBasic" )) ) + return nullptr; + NetworkCredential^ myCredentials; + if ( dynamic_cast(credentials) == nullptr ) + { + myCredentials = credentials->GetCredential( request->RequestUri, "CloneBasic" ); + if ( myCredentials == nullptr ) + return nullptr; + } + else + myCredentials = dynamic_cast(credentials); + + // Message encryption scheme : + // a)Concatenate username and password seperated by space; + // b)Apply ASCII encoding to obtain a stream of bytes; + // c)Apply Base64 Encoding to this array of bytes to obtain our encoded authorization message. + message = String::Concat( myCredentials->UserName, " ", myCredentials->Password ); + + // Apply AsciiEncoding to 'message' String* to obtain it as an array of bytes. + Encoding^ ascii = Encoding::ASCII; + array^byteArray = gcnew array(ascii->GetByteCount( message )); + byteArray = ascii->GetBytes( message ); + + // Performing Base64 transformation. + message = Convert::ToBase64String( byteArray ); + Authorization^ myAuthorization = gcnew Authorization( String::Concat( "CloneBasic ", message, true ) ); + array^protectionRealm = gcnew array(1); + protectionRealm[ 0 ] = request->RequestUri->AbsolutePath; + myAuthorization->ProtectionRealm = protectionRealm; + return myAuthorization; + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised in Authenticate method: {0}", e->Message ); + return nullptr; + } + } + // + // + + virtual Authorization^ PreAuthenticate( WebRequest^ request, ICredentials^ credentials ) + { + return nullptr; + } +}; + +// The 'Client' class is defined here to test the above custom authentication module. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + String^ url; + String^ userName; + String^ passwd; + if ( args->Length < 3 ) + { + PrintUsage(); + return 0; + } + else + { + url = args[ 0 ]; + userName = args[ 1 ]; + passwd = args[ 2 ]; + } + + Console::WriteLine(); + CloneBasic^ authenticationModule = gcnew CloneBasic; + AuthenticationManager::Register( authenticationModule ); + AuthenticationManager::Unregister( "Basic" ); + + // Get response from Uri. + GetPage( url, userName, passwd ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp new file mode 100644 index 00000000000..6bc8503b66d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionSample2/CPP/bindingcollectionsample2.cpp @@ -0,0 +1,170 @@ +// System.Web.Services.Description.Binding.Binding();System.Web.Services.Description.Binding.Name; +// System.Web.Services.Description.Binding.Type;System.Web.Services.Description.Binding.Extensions;System.Web.Services.Description.Binding.Operations; +// System.Web.Services.Description.BindingCollection.Insert; +// System.Web.Services.Description.Binding.ServiceDescription; + +// Grouping Clause : Snippet5 and Snippet8 go together. + +/* The following example demonstrates the constructor 'Binding()' and properties 'Extensions','Name','Operations', + 'ServiceDescription' and 'Type' property of 'Binding' class AND method 'Insert' of 'BindingCollection' class. + The input to the program is a WSDL file 'MathService_input.wsdl' with all information related to SOAP protocol + removed from it. In a way, it tries to simulate a scenario wherein a service initially did not support a protocol, however later + on happen to support it. + In this example, the WSDL file is modified to insert a new Binding for SOAP. The binding is populated based on + WSDL document structure defined in WSDL specification. The ServiceDescription instance is loaded with values + for 'Messages', 'PortTypes','Bindings', and 'Port'. The instance is then written to an external file 'MathService_new.wsdl'. + * */ + +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +ref class MyClass +{ +public: + // Creates a Message with name ="messageName" having one MessagePart with name = "partName". + static Message^ CreateMessage( String^ messageName, String^ partName, String^ element, String^ targetNamespace ) + { + Message^ myMessage = gcnew Message; + myMessage->Name = messageName; + MessagePart^ myMessagePart = gcnew MessagePart; + myMessagePart->Name = partName; + myMessagePart->Element = gcnew XmlQualifiedName( element,targetNamespace ); + myMessage->Parts->Add( myMessagePart ); + return myMessage; + } + + // Used to create Operations under PortType. + static Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) + { + Operation^ myOperation = gcnew Operation; + myOperation->Name = operationName; + OperationMessage^ input = (OperationMessage^)( gcnew OperationInput ); + input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); + OperationMessage^ output = (OperationMessage^)( gcnew OperationOutput ); + output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); + myOperation->Messages->Add( input ); + myOperation->Messages->Add( output ); + return myOperation; + } + +// + // Used to create OperationBinding instances within 'Binding'. +public: + static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) + { + // Create OperationBinding instance for operation. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = operation; + // Create InputBinding for operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + // Create extensibility element for 'SoapOperationBinding'. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation ); + // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + return myOperationBinding; + } +// + + static void Main() + { + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input.wsdl" ); + // Create SOAP Messages. + myServiceDescription->Messages->Add( CreateMessage( "AddSoapIn", "parameters", "Add", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "AddSoapOut", "parameters", "AddResponse", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapIn", "parameters", "Subtract", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapOut", "parameters", "SubtractResponse", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapIn", "parameters", "Multiply", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapOut", "parameters", "MultiplyResponse", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "DivideSoapIn", "parameters", "Divide", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "DivideSoapOut", "parameters", "DivideResponse", myServiceDescription->TargetNamespace ) ); + + // Create a new PortType. + PortType^ soapPortType = gcnew PortType; + soapPortType->Name = "MathServiceSoap"; + soapPortType->Operations->Add( CreateOperation( "Add", "AddSoapIn", "AddSoapOut", myServiceDescription->TargetNamespace ) ); + soapPortType->Operations->Add( CreateOperation( "Subtract", "SubtractSoapIn", "SubtractSoapOut", myServiceDescription->TargetNamespace ) ); + soapPortType->Operations->Add( CreateOperation( "Multiply", "MultiplySoapIn", "MultiplySoapOut", myServiceDescription->TargetNamespace ) ); + soapPortType->Operations->Add( CreateOperation( "Divide", "DivideSoapIn", "DivideSoapOut", myServiceDescription->TargetNamespace ) ); + myServiceDescription->PortTypes->Add( soapPortType ); + +// +// +// + // Create a new Binding for SOAP Protocol. + Binding^ myBinding = gcnew Binding; + myBinding->Name = String::Concat( myServiceDescription->Services->default[ 0 ]->Name, "Soap" ); +// + +// + // Pass the name of the existing porttype 'MathServiceSoap' and the Xml targetNamespace attribute of the Descriptions tag. + myBinding->Type = gcnew XmlQualifiedName( "MathServiceSoap",myServiceDescription->TargetNamespace ); +// + +// + // Create SOAP Extensibility element. + SoapBinding^ mySoapBinding = gcnew SoapBinding; + // SOAP over HTTP. + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + // Add tag soap:binding as an extensibility element. + myBinding->Extensions->Add( mySoapBinding ); +// + +// + // Create OperationBindings for each of the operations defined in asmx file. + OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( addOperationBinding ); + OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( subtractOperationBinding ); + OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( multiplyOperationBinding ); + OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( divideOperationBinding ); +// + + myServiceDescription->Bindings->Insert( 0, myBinding ); +// +// + +// + Console::WriteLine( "\nTarget Namespace of the Service Description to which the binding was added is:{0}", myServiceDescription->Bindings->default[ 0 ]->ServiceDescription->TargetNamespace ); +// + + // Create Port. + Port^ soapPort = gcnew Port; + soapPort->Name = "MathServiceSoap"; + soapPort->Binding = gcnew XmlQualifiedName( myBinding->Name,myServiceDescription->TargetNamespace ); + // Create SoapAddress extensibility element to add to port. + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/BindingCollectionSample/MathService.asmx"; + soapPort->Extensions->Add( mySoapAddressBinding ); + // Add port to the MathService which is the first service in the Service Collection. + myServiceDescription->Services->default[ 0 ]->Ports->Add( soapPort ); + // Save the ServiceDescription instance to an external file. + myServiceDescription->Write( "MathService_new.wsdl" ); + Console::WriteLine( "\nSuccessfully added bindings for SOAP protocol and saved results in file MathService_new.wsdl" ); + Console::WriteLine( "\n This file should be passed to wsdl tool as input to generate proxy" ); + } +}; + +int main() +{ + MyClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp new file mode 100644 index 00000000000..1e66ce14ccb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample1/CPP/bindingcollectionsample1.cpp @@ -0,0 +1,62 @@ + + +// System::Web::Services::Description.BindingCollection;System::Web::Services::Description.BindingCollection::Item->Item[Int32]; +// System::Web::Services::Description.BindingCollection::Item->Item[String];System::Web::Services::Description.BindingCollection::CopyTo +/* The program reads a wsdl document S"MathService::wsdl" and instantiates a +// ServiceDescription instance from the WSDL document.A BindingCollection instance +// is then retrieved from this ServiceDescription instance and it's members are demonstrated. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + Binding^ myBinding; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input.wsdl" ); + Console::WriteLine( "Total Number of bindings : {0}", myServiceDescription->Bindings->Count ); + + // + for ( int i = 0; i < myServiceDescription->Bindings->Count; ++i ) + { + Console::WriteLine( "\nBinding {0}", i ); + + // Get Binding at index i. + myBinding = myServiceDescription->Bindings[ i ]; + Console::WriteLine( "\t Name : {0}", myBinding->Name ); + Console::WriteLine( "\t Type : {0}", myBinding->Type ); + } + // + + // + array^myBindings = gcnew array(myServiceDescription->Bindings->Count); + + // Copy BindingCollection to an Array. + myServiceDescription->Bindings->CopyTo( myBindings, 0 ); + Console::WriteLine( "\n\n Displaying array copied from BindingCollection" ); + for ( int i = 0; i < myServiceDescription->Bindings->Count; ++i ) + { + Console::WriteLine( "\nBinding {0}", i ); + Console::WriteLine( "\t Name : {0}", myBindings[ i ]->Name ); + Console::WriteLine( "\t Type : {0}", myBindings[ i ]->Type ); + } + // + + // + // Get Binding Name = S"MathServiceSoap". + myBinding = myServiceDescription->Bindings[ "MathServiceHttpGet" ]; + if ( myBinding != nullptr ) + { + Console::WriteLine( "\n\nName : {0}", myBinding->Name ); + Console::WriteLine( "Type : {0}", myBinding->Type ); + } + // + + myServiceDescription = nullptr; + myBinding = nullptr; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp new file mode 100644 index 00000000000..3be2280b84d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/BindingCollectionsample3/CPP/bindingcollectionsample3.cpp @@ -0,0 +1,51 @@ + + +// System::Web::Services::Description.BindingCollection;System::Web::Services::Description.Remove;System::Web::Services::Description.Add; +// System::Web::Services::Description.Contains;System::Web::Services::Description.IndexOf +/*The following example reads the contents of a file 'MathService::wsdl' into a ServiceDescription instance. +Removes first binding in the BindingCollection of the ServiceDescription instance and writes the current +'ServiceDescription' instance into a temporary file. +Adds the same binding back again into the instance and writes to another temporary file. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + Binding^ myBinding; + + // + // + // + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input.wsdl" ); + Console::WriteLine( "Total Number of bindings defined are: {0}", myServiceDescription->Bindings->Count ); + myBinding = myServiceDescription->Bindings[ 0 ]; + + // Remove the first binding in the collection. + myServiceDescription->Bindings->Remove( myBinding ); + Console::WriteLine( "Successfully removed binding {0}", myBinding->Name ); + Console::WriteLine( "Total Number of bindings defined now are: {0}", myServiceDescription->Bindings->Count ); + myServiceDescription->Write( "MathService_temp.wsdl" ); + // + + // Add binding to the ServiceDescription instance. + myServiceDescription->Bindings->Add( myBinding ); + // + + if ( myServiceDescription->Bindings->Contains( myBinding ) ) + Console::WriteLine( "Successfully added binding {0}", myBinding->Name ); + // + + Console::WriteLine( "Binding was added at index {0}", myServiceDescription->Bindings->IndexOf( myBinding ) ); + Console::WriteLine( "Total Number of bindings defined now are: {0}", myServiceDescription->Bindings->Count ); + myServiceDescription->Write( "MathService_temp1.wsdl" ); + // + * myServiceDescription = 0; + + myBinding = nullptr; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp new file mode 100644 index 00000000000..e138ddb4a2f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/client.cpp @@ -0,0 +1,49 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Principal; +int main() +{ + GenericIdentity^ ident = gcnew GenericIdentity( "Bob" ); + array^id = gcnew array(1); + id[ 0 ] = "Level1"; + GenericPrincipal^ prpal = gcnew GenericPrincipal( ident,id ); + LogicalCallContextData ^ data = gcnew LogicalCallContextData( prpal ); + + //Enter data into the CallContext + CallContext::SetData( "test data", data ); + Console::WriteLine( data->numOfAccesses ); + ChannelServices::RegisterChannel( gcnew TcpChannel ); + RemotingConfiguration::RegisterActivatedClientType( HelloServiceClass::typeid, "tcp://localhost:8082" ); + HelloServiceClass ^ service = gcnew HelloServiceClass; + if ( service == nullptr ) + { + Console::WriteLine( "Could not locate server." ); + return 0; + } + + // call remote method + Console::WriteLine(); + Console::WriteLine( "Calling remote Object*" ); + Console::WriteLine( service->HelloMethod( "Caveman" ) ); + Console::WriteLine( service->HelloMethod( "Spaceman" ) ); + Console::WriteLine( service->HelloMethod( "Bob" ) ); + Console::WriteLine( "Finished remote Object* call" ); + Console::WriteLine(); + + //Extract the returned data from the call context + LogicalCallContextData ^ returnedData = static_cast(CallContext::GetData( "test data" )); + Console::WriteLine( data->numOfAccesses ); + Console::WriteLine( returnedData->numOfAccesses ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp new file mode 100644 index 00000000000..62c2799b868 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CallContext/CPP/service.cpp @@ -0,0 +1,94 @@ + +using namespace System; +using namespace System::Text; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Principal; + +// +[Serializable] +public ref class LogicalCallContextData: public ILogicalThreadAffinative +{ +private: + int _nAccesses; + IPrincipal^ _principal; + +public: + + property String^ numOfAccesses + { + String^ get() + { + return String::Format( "The identity of {0} has been accessed {1} times.", _principal->Identity->Name, _nAccesses ); + } + } + + property IPrincipal^ Principal + { + IPrincipal^ get() + { + _nAccesses++; + return _principal; + } + } + + LogicalCallContextData( IPrincipal^ p ) + { + _nAccesses = 0; + _principal = p; + } + +}; +// + +// +using namespace System; +using namespace System::Text; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Principal; +using namespace System::Security::Permissions; + +ref class LogicalCallContextData; + +public ref class HelloServiceClass: public MarshalByRefObject +{ +private: + static int n_instances; + int instanceNum; + +public: + HelloServiceClass() + { + n_instances++; + instanceNum = n_instances; + Console::WriteLine( "{0} has been created. Instance # = {1}", this->GetType()->Name, instanceNum ); + } + + ~HelloServiceClass() + { + Console::WriteLine( "Destroyed instance {0} of HelloServiceClass.", instanceNum ); + } + + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + String^ HelloMethod( String^ name ) + { + //Extract the call context data + LogicalCallContextData^ data = dynamic_cast(CallContext::GetData( "test data" )); + IPrincipal^ myPrincipal = data->Principal; + + //Check the user identity + if ( myPrincipal->Identity->Name == "Bob" ) + { + Console::WriteLine( "\nHello {0}, you are identified!", myPrincipal->Identity->Name ); + Console::WriteLine( data->numOfAccesses ); + } + else + { + Console::WriteLine( "Go away! You are not identified!" ); + return String::Empty; + } + + // calculate and return result to client + return String::Format( "Hi there {0}.", name ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp new file mode 100644 index 00000000000..f5539f7655b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_client.cpp @@ -0,0 +1,110 @@ +// System::Runtime::Remoting::CallContext.FreeNamedDataSlot(String*) +// System::Runtime::Remoting::CallContext.GetHeaders() +// System::Runtime::Remoting::CallContext.SetHeaders(Header->Item[]) + +/* The following example demonstrates 'FreeNamedDataSlot', 'GetHeaders', +and 'SetHeaders' methods of 'CallContext' class. + +In the example 'SetData' method is used to set dataSlot. The 'DataSlot' is freed using +'FreeNamedDataSlot' method by passing the Name parameter. +For Setting header an array of type 'Messaging::Header' is passed with method call. +Headers are set in 'HeaderMethod' of remote Object* using 'SetHeaders' method. +Finally the 'GetHeaders' method is used to get all headers. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Security; +using namespace System::Security::Principal; +using namespace System::Collections; + +int main() +{ +// + // Register the channel. + TcpChannel^ myChannel = gcnew TcpChannel; + ChannelServices::RegisterChannel( myChannel ); + RemotingConfiguration::RegisterActivatedClientType( HelloService::typeid, "Tcp://localhost:8082" ); + + GenericIdentity^ myIdentity = gcnew GenericIdentity( "Bob" ); + array^ idStr = gcnew array(1); + idStr[ 0 ] = "Level1"; + GenericPrincipal^ myPrincipal = gcnew GenericPrincipal( myIdentity, idStr ); + MyLogicalCallContextData ^ myData = gcnew MyLogicalCallContextData( myPrincipal ); + + // Set DataSlot with name parameter. + CallContext::SetData( "test data", myData ); + + // Create a remote Object*. + HelloService ^ myService = gcnew HelloService; + if ( myService == nullptr ) + { + Console::WriteLine( "Cannot locate server." ); + return -1; + } + + // Call the Remote methods. + Console::WriteLine( "Remote method output is {0}", myService->HelloMethod( "Microsoft" ) ); + + MyLogicalCallContextData ^ myReturnData = + (MyLogicalCallContextData^)( CallContext::GetData( "test data" ) ); + if ( myReturnData == nullptr ) + { + Console::WriteLine( "Data is 0." ); + } + else + { + Console::WriteLine( "Data is ' {0}'", myReturnData->numOfAccesses ); + } + + // DataSlot with same Name Parameter which was Set is Freed. + CallContext::FreeNamedDataSlot( "test data" ); + MyLogicalCallContextData ^ myReturnData1 = + (MyLogicalCallContextData^)( CallContext::GetData( "test data" ) ); + if ( myReturnData1 == nullptr ) + { + Console::WriteLine( "FreeNamedDataSlot Successful for test data" ); + } + else + { + Console::WriteLine( "FreeNamedDataSlot Failed for test data" ); + } +// + +// + // Array of Headers with name and values initialized. + array^ myArrSetHeader = { gcnew Header( "Header0","CallContextHeader0" ), + gcnew Header( "Header1","CallContextHeader1" ) }; + + // Pass the Header Array with method call. + // Header will be set in the method by'CallContext::SetHeaders' method in remote Object*. + Console::WriteLine( "Remote HeaderMethod output is {0}", + myService->HeaderMethod( "CallContextHeader", myArrSetHeader ) ); + + array^ myArrGetHeader; + // Get Header Array. + myArrGetHeader = CallContext::GetHeaders(); + if ( nullptr == myArrGetHeader ) + { + Console::WriteLine( "CallContext::GetHeaders Failed" ); + } + else + { + Console::WriteLine( "Headers:" ); + } + + for each ( Header^ myHeader in myArrGetHeader ) + { + Console::WriteLine( "Value in Header '{0}' is '{1}'.", + myHeader->Name, myHeader->Value ); + } +// +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp b/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp new file mode 100644 index 00000000000..0881c0e9ab0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CallContext_GetHeaders/CPP/callcontext_share.cpp @@ -0,0 +1,69 @@ +// System::Runtime::Remoting::CallContext.SetHeaders(Header->Item[]) + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Security; +using namespace System::Security::Principal; +using namespace System::Security::Permissions; + +// +public ref class HelloService: public MarshalByRefObject +{ +public: + String^ HelloMethod( String^ name ) + { + Console::WriteLine( "Hello {0}", name ); + return "Hello {0}",name; + } + + + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + String^ HeaderMethod( String^ name, array^arrHeader ) + { + Console::WriteLine( "HeaderMethod {0}", name ); + + //Header Set with the header array passed + CallContext::SetHeaders( arrHeader ); + return "HeaderMethod {0}",name; + } +}; +// + +// 'CallContext' and 'ILogicalThreadAffinative*' is needed to pass information between threads +// on either end of a call across an application domain boundary or context boundary. + +[Serializable] +public ref class MyLogicalCallContextData: public ILogicalThreadAffinative +{ +private: + int noOfAccesses; + IPrincipal^ myIprincipal; + +public: + property String^ numOfAccesses + { + String^ get() + { + return String::Format( "The identity of {0} has been accessed {1} times.", + myIprincipal->Identity->Name, noOfAccesses ); + } + } + + property IPrincipal^ Principal + { + IPrincipal^ get() + { + noOfAccesses++; + return myIprincipal; + } + } + + MyLogicalCallContextData( IPrincipal^ p ) + { + noOfAccesses = 0; + myIprincipal = p; + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp new file mode 100644 index 00000000000..9bd8438fc36 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_GetChannel/CPP/channelservices_getchannel_client.cpp @@ -0,0 +1,56 @@ + + +// System.Runtime.Remoting.Channels.ChannelServices.GetChannel +// System.Runtime.Remoting.Channels.ChannelServices.GetChannelSinkProperties +/* +This example demonstrates the usage of the properties 'GetChannel' and +'GetChannelSinkProperties' of the 'ChannelServices' class. It displays +the registered channel name, priority and channelsinkproperties +for a given proxy and executes a remote method 'HelloMethod'. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Collections; +using namespace System::Collections::Specialized; +int main() +{ + ListDictionary^ myProperties = gcnew ListDictionary; + myProperties->Add( "port", 8085 ); + myProperties->Add( "name", "MyHttpChannel" ); + + // + HttpChannel^ myClientChannel = gcnew HttpChannel( myProperties,gcnew SoapClientFormatterSinkProvider,gcnew SoapServerFormatterSinkProvider ); + ChannelServices::RegisterChannel( myClientChannel, false ); + + // Get the registered channel. + Console::WriteLine( "Channel Name : {0}", ChannelServices::GetChannel( myClientChannel->ChannelName )->ChannelName ); + Console::WriteLine( "Channel Priorty : {0}", ChannelServices::GetChannel( myClientChannel->ChannelName )->ChannelPriority ); + + // + RemotingSamples::HelloServer^ myProxy = dynamic_cast(Activator::GetObject( RemotingSamples::HelloServer::typeid, "http://localhost:8086/SayHello" )); + + // + // Get an IDictionary of properties for a given proxy. + IDictionary^ myDictionary = ChannelServices::GetChannelSinkProperties( myProxy ); + ICollection^ myKeysCollection = myDictionary->Keys; + array^myKeysArray = gcnew array(myKeysCollection->Count); + ICollection^ myValuesCollection = myDictionary->Values; + array^myValuesArray = gcnew array(myValuesCollection->Count); + myKeysCollection->CopyTo( myKeysArray, 0 ); + myValuesCollection->CopyTo( myValuesArray, 0 ); + for ( int iIndex = 0; iIndex < myKeysArray->Length; iIndex++ ) + { + Console::WriteLine( "Property Name : {0} value : {1}", myKeysArray[ iIndex ], myValuesArray[ iIndex ] ); + + } + // + if ( myProxy == nullptr ) + System::Console::WriteLine( "Could not locate server" ); + else + Console::WriteLine( myProxy->HelloMethod( "Caveman" ) ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp new file mode 100644 index 00000000000..21547e27699 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_client.cpp @@ -0,0 +1,50 @@ + + +// System.Runtime.Remoting.Channels.ChannelServices.GetUrlsForObject(MarshalByRefObject) +/* +The following example demonstrates the method 'GetUrlsForObject' +of the class 'ChannelServices'. The example is just a client, it +locates and connects to the server, retrieves a proxy for the remote +object, and calls the 'HelloMethod' on the remote object, passing the +string 'Caveman' as a parameter. The server returns the string +'Hi there Caveman'. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Channels::Http; + +int main() +{ + try + { + TcpChannel^ myTcpChannel = gcnew TcpChannel( 8084 ); + ChannelServices::RegisterChannel( myTcpChannel ); + RemotingSamples::HelloServer ^ myHelloServer = dynamic_cast(Activator::GetObject( RemotingSamples::HelloServer::typeid, "tcp://localhost:8080/SayHello" )); + if ( myHelloServer == nullptr ) + System::Console::WriteLine( "Could not locate server" ); + else + { + + // + array^myURLArray = ChannelServices::GetUrlsForObject( myHelloServer ); + Console::WriteLine( "Number of URLs for the specified Object: {0}", myURLArray->Length ); + for ( int iIndex = 0; iIndex < myURLArray->Length; iIndex++ ) + Console::WriteLine( "URL: {0}", myURLArray[ iIndex ] ); + // + + Console::WriteLine( myHelloServer->HelloMethod( "Caveman" ) ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "The source of exception: {0}", e->Source ); + Console::WriteLine( "The Message of exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp new file mode 100644 index 00000000000..66308d44723 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_RegisteredChannels/CPP/channelservices_registeredchannels_server.cpp @@ -0,0 +1,69 @@ + + +// System.Runtime.Remoting.Channels.ChannelServices +// System.Runtime.Remoting.Channels.ChannelServices.RegisteredChannels +// System.Runtime.Remoting.Channels.ChannelServices.UnregisterChannel(IChannel[]) +/* +The following example demonstrates the property 'RegisteredChannels' +of the class 'ChannelServices', its method 'UnregisterChannel', +and usage of the class 'ChannelServices'. The example demonstrates +the remoting version of a server. When a client calls the +'HelloMethod' on the 'HelloServer' class, the server object appends the +string passed from the client to the string "Hi There" and returns the +resulting string back to the client. +*/ +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Channels::Http; + +int main() +{ + try + { + // + // Create and register 'HttpChannel'. + HttpChannel^ myHttpChannel = gcnew HttpChannel( 8085 ); + ChannelServices::RegisterChannel( myHttpChannel ); + + // Create and register 'TcpChannel'. + TcpChannel^ myTcpChannel = gcnew TcpChannel( 8080 ); + ChannelServices::RegisterChannel( myTcpChannel ); + + // + // Retrieve and print information about the registered channels. + array^myIChannelArray = ChannelServices::RegisteredChannels; + for ( int i = 0; i < myIChannelArray->Length; i++ ) + { + Console::WriteLine( "Name of Channel: {0}", myIChannelArray[ i ]->ChannelName ); + Console::WriteLine( "Priority of Channel: {0}", myIChannelArray[ i ]->ChannelPriority ); + + } + // + RemotingConfiguration::RegisterWellKnownServiceType( Type::GetType( "RemotingSamples.HelloServer,ChannelServices_RegisteredChannels_Share" ), "SayHello", WellKnownObjectMode::SingleCall ); + + // + System::Console::WriteLine( "Hit to unregister the channels..." ); + System::Console::ReadLine(); + + // Unregister the 'HttpChannel' and 'TcpChannel' channels. + ChannelServices::UnregisterChannel( myTcpChannel ); + ChannelServices::UnregisterChannel( myHttpChannel ); + Console::WriteLine( "Unregistered the channels." ); + + // + System::Console::WriteLine( "Hit to exit..." ); + System::Console::ReadLine(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "The source of exception: {0}", e->Source ); + Console::WriteLine( "The Message of exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp new file mode 100644 index 00000000000..9c540f3858a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ChannelServices_SyncDispatchMessage/CPP/channelservices_syncdispatchmessage_client.cpp @@ -0,0 +1,132 @@ + + +// System.Runtime.Remoting.Channels.ChannelServices.SyncDispatchMessage(IMessage) +/* + The following example demonstrates 'SyncDispatchMessage' method of + 'ChannelServices' class. In the example, 'MyProxy' extends 'RealProxy' + class and overrides its constructor and 'Invoke' messages. In the 'Main' + method, the 'MyProxy' class is instantiated and 'MyPrintMethod' method + is called on it. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; + +// +// Create a custom 'RealProxy'. +public ref class MyProxy: public RealProxy +{ +private: + String^ myURIString; + MarshalByRefObject^ myMarshalByRefObject; + +public: + MyProxy( Type^ myType ) + : RealProxy( myType ) + { + + // RealProxy uses the Type to generate a transparent proxy. + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance(myType)); + + // Get 'ObjRef', for transmission serialization between application domains. + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + + // Get the 'URI' property of 'ObjRef' and store it. + myURIString = myObjRef->URI; + Console::WriteLine( "URI :{0}", myObjRef->URI ); + } + + virtual IMessage^ Invoke ( IMessage^ myIMessage ) override + { + Console::WriteLine( "MyProxy.Invoke Start" ); + Console::WriteLine( "" ); + if ( dynamic_cast(myIMessage) ) + Console::WriteLine( "IMethodCallMessage" ); + + if ( dynamic_cast(myIMessage) ) + Console::WriteLine( "IMethodReturnMessage" ); + + Type^ msgType = myIMessage->GetType(); + Console::WriteLine( "Message Type: {0}", msgType ); + Console::WriteLine( "Message Properties" ); + IDictionary^ myIDictionary = myIMessage->Properties; + + // Set the '__Uri' property of 'IMessage' to 'URI' property of 'ObjRef'. + myIDictionary->default[ "__Uri" ] = myURIString; + IDictionaryEnumerator^ myIDictionaryEnumerator = dynamic_cast(myIDictionary->GetEnumerator()); + while ( myIDictionaryEnumerator->MoveNext() ) + { + Object^ myKey = myIDictionaryEnumerator->Key; + String^ myKeyName = myKey->ToString(); + Object^ myValue = myIDictionaryEnumerator->Value; + Console::WriteLine( "\t{0} : {1}", myKeyName, myIDictionaryEnumerator->Value ); + if ( myKeyName->Equals( "__Args" ) ) + { + array^myObjectArray = (array^)myValue; + for ( int aIndex = 0; aIndex < myObjectArray->Length; aIndex++ ) + Console::WriteLine( "\t\targ: {0} myValue: {1}", aIndex, myObjectArray[ aIndex ] ); + } + + if ( (myKeyName->Equals( "__MethodSignature" )) && (nullptr != myValue) ) + { + array^myObjectArray = (array^)myValue; + for ( int aIndex = 0; aIndex < myObjectArray->Length; aIndex++ ) + Console::WriteLine( "\t\targ: {0} myValue: {1}", aIndex, myObjectArray[ aIndex ] ); + } + } + + IMessage^ myReturnMessage; + myIDictionary->default[ "__Uri" ] = myURIString; + Console::WriteLine( "__Uri {0}", myIDictionary->default[ "__Uri" ] ); + Console::WriteLine( "ChannelServices.SyncDispatchMessage" ); + myReturnMessage = ChannelServices::SyncDispatchMessage( myIMessage ); + + // Push return value and OUT parameters back onto stack. + IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast(myReturnMessage); + Console::WriteLine( "IMethodReturnMessage.ReturnValue: {0}", myMethodReturnMessage->ReturnValue ); + Console::WriteLine( "MyProxy.Invoke - Finish" ); + return myReturnMessage; + } +}; +// + +int main() +{ + try + { + TcpChannel^ myTcpChannel = gcnew TcpChannel( 8086 ); + ChannelServices::RegisterChannel( myTcpChannel, false ); + MyProxy^ myProxyObject = gcnew MyProxy( PrintServer::typeid); + PrintServer^ myPrintServer = dynamic_cast(myProxyObject->GetTransparentProxy()); + if ( myPrintServer == nullptr ) + Console::WriteLine( "Could not locate server" ); + else + Console::WriteLine( myPrintServer->MyPrintMethod( "String1", 1.2, 6 ) ); + Console::WriteLine( "Calling the Proxy" ); + int kValue = myPrintServer->MyPrintMethod( "String1", 1.2, 6 ); + Console::WriteLine( "Checking result" ); + if ( kValue == 6 ) + { + Console::WriteLine( "PrintServer.MyPrintMethod PASSED : returned {0}", kValue ); + } + else + { + Console::WriteLine( "PrintServer.MyPrintMethod FAILED : returned {0}", kValue ); + } + Console::WriteLine( "Sample Done" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "The source of exception: {0}", e->Source ); + Console::WriteLine( "The Message of exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..eb8a5c280ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic CredentialCache.Add Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using + +using namespace System; +using namespace System::Net; +public ref class Class +{ +private: + void Method1() + { + String^ UserName = Console::ReadLine(); + String^ SecurelyStoredPassword = Console::ReadLine(); + String^ Domain = Console::ReadLine(); + + WebRequest^ wReq = WebRequest::Create( "http://www.contoso.com" ); + + // + CredentialCache^ myCache = gcnew CredentialCache; + + myCache->Add( gcnew Uri( "http://www.contoso.com/" ), "Basic", gcnew NetworkCredential( UserName,SecurelyStoredPassword ) ); + myCache->Add( gcnew Uri( "http://www.contoso.com/" ), "Digest", gcnew NetworkCredential( UserName,SecurelyStoredPassword,Domain ) ); + + wReq->Credentials = myCache; + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp new file mode 100644 index 00000000000..1902e81255b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Dns Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Net; +using namespace System::Windows::Forms; +public ref class Form1: public Form + +{ +protected: + void Method() + { + // + IPHostEntry^ hostInfo = Dns::GetHostEntry( "www.contoso.com" ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp new file mode 100644 index 00000000000..56d68e22b91 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic DnsPermissionAttributeExample/CPP/source.cpp @@ -0,0 +1,42 @@ + + +#using + +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Net; +using namespace System; + +// +//Uses the DnsPermissionAttribute to restrict access only to those who have permission. + +[DnsPermission(SecurityAction::Demand,Unrestricted=true)] +public ref class MyClass +{ +public: + static IPAddress^ GetIPAddress() + { + IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; + return ipAddress; + } + +}; + +int main() +{ + try + { + + //Grants Access. + Console::WriteLine( " Access granted\n The local host IP Address is :{0}", MyClass::GetIPAddress() ); + } + // Denies Access. + catch ( SecurityException^ securityException ) + { + Console::WriteLine( "Access denied" ); + Console::WriteLine( securityException->ToString() ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp new file mode 100644 index 00000000000..e4aa5aedcd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic GlobalProxySelection Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + // + Uri^ proxyURI = gcnew Uri( "http://webproxy:80" ); + GlobalProxySelection::Select = gcnew WebProxy( proxyURI ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp new file mode 100644 index 00000000000..4d4eebf4ef8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpGetClientProtocol Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +public ref class MyMath: public System::Web::Services::Protocols::HttpGetClientProtocol +{ +public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MyMath() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, + System::Web::Services::Protocols::UrlParameterWriter::typeid)] + [returnvalue:System::Xml::Serialization::XmlRootAttribute("snippet1>",Namespace="http://www.contoso.com/",IsNullable=false)] + int Add( String^ num1, String^ num2 ) + { + array^temp0 = {num1,num2}; + return *dynamic_cast(this->Invoke( "Add", (String::Concat( this->Url, "/Add" )), temp0 )); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( String^ num1, String^ num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", (String::Concat( this->Url, "/Add" )), temp1, callback, asyncState ); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + return *dynamic_cast(this->EndInvoke( asyncResult )); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..984c156653d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Web; +using namespace System::Web::UI; + +// +[System::Xml::Serialization::XmlRootAttribute(Namespace="http://tempuri.org/",IsNullable=true)] +public ref class UserName +{ +public: + String^ Name; + String^ Domain; +}; + +public ref class MyUser: public System::Web::Services::Protocols::HttpPostClientProtocol +{ +public: + MyUser() + { + this->Url = "http://www.contoso.com/username.asmx"; + } + + [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,System::Web::Services::Protocols::HtmlFormParameterWriter::typeid)] + UserName^ GetUserName() + { + return (dynamic_cast(this->Invoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0) ))); + } + + System::IAsyncResult^ BeginGetUserName( System::AsyncCallback^ callback, Object^ asyncState ) + { + return this->BeginInvoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0), callback, asyncState ); + } + + UserName^ EndGetUserName( System::IAsyncResult^ asyncResult ) + { + return (dynamic_cast(this->EndInvoke( asyncResult ))); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp new file mode 100644 index 00000000000..3d8283f1fa7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpMethodAttribute.ReturnFormatter Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Web; +using namespace System::Web::UI; + +// +[System::Xml::Serialization::XmlRootAttribute(Namespace="http://tempuri.org/",IsNullable=true)] +public ref class UserName +{ +public: + String^ Name; + String^ Domain; +}; + +public ref class MyUser: public System::Web::Services::Protocols::HttpGetClientProtocol +{ +public: + MyUser() + { + this->Url = "http://www.contoso.com/username.asmx"; + } + + [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid,System::Web::Services::Protocols::UrlParameterWriter::typeid)] + UserName^ GetUserName() + { + return (dynamic_cast(this->Invoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0) ))); + } + + System::IAsyncResult^ BeginGetUserName( System::AsyncCallback^ callback, Object^ asyncState ) + { + return this->BeginInvoke( "GetUserName", (String::Concat( this->Url, "/GetUserName" )), gcnew array(0), callback, asyncState ); + } + + UserName^ EndGetUserName( System::IAsyncResult^ asyncResult ) + { + return (dynamic_cast(this->EndInvoke( asyncResult ))); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp new file mode 100644 index 00000000000..57e073dd49c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpPostClientProtocol Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +public ref class MyMath: public System::Web::Services::Protocols::HttpPostClientProtocol +{ +public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MyMath() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, + System::Web::Services::Protocols::HtmlFormParameterWriter::typeid)] + [returnvalue:System::Xml::Serialization::XmlRootAttribute("snippet1>",Namespace="http://www.contoso.com/",IsNullable=false)] + int Add( String^ num1, String^ num2 ) + { + array^temp2 = {num1,num2}; + return *dynamic_cast(this->Invoke( "Add", (String::Concat( this->Url, "/Add" )), temp2 )); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( String^ num1, String^ num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp3 = {num1,num2}; + return this->BeginInvoke( "Add", (this->Url + "/Add" ), temp3, callback, asyncState ); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + return *dynamic_cast(this->EndInvoke( asyncResult )); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp new file mode 100644 index 00000000000..4c25623d8ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +// +#using +#using + +using namespace System::Web::Services; +using namespace System; +public ref class Math +{ +public: + + [WebMethod] + int Add( int num1, int num2 ) + { + return num1 + num2; + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp new file mode 100644 index 00000000000..87d6b7f28b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpSimpleClientProtocol.EndInvoke Example/CPP/source.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Xml::Serialization; +using namespace System::Web::Services::Protocols; + +// +namespace MyMath +{ + [XmlRootAttribute("snippet1>",Namespace="http://MyMath/",IsNullable=false)] + public ref class Math: public HttpGetClientProtocol + { + public: + Math() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + [HttpMethodAttribute(System::Web::Services::Protocols::XmlReturnReader::typeid, + System::Web::Services::Protocols::UrlParameterWriter::typeid)] + int Add( String^ num1, String^ num2 ) + { + array^temp0 = {num1,num2}; + return *dynamic_cast(this->Invoke( "Add", String::Concat( this->Url, "/Add" ), temp0 )); + } + + IAsyncResult^ BeginAdd( String^ num1, String^ num2, AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", String::Concat( this->Url, "/Add" ), temp1, callback, asyncState ); + } + + int EndAdd( IAsyncResult^ asyncResult ) + { + return *dynamic_cast(this->EndInvoke( asyncResult )); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp new file mode 100644 index 00000000000..b705fba6e3b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebClientProtocol.Proxy Example/CPP/source.cpp @@ -0,0 +1,48 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Web; +using namespace System::Web::UI; +using namespace System::Net; + +namespace MyMath +{ +using namespace System::Xml::Serialization; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + public ref class Math: public SoapHttpClientProtocol + { + public: + int Add( int num1, int num2 ) + { + return num1 + num2; + } + }; +} + +public ref class Page1: public Page +{ +private: + void Page_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // + MyMath::Math^ math = gcnew MyMath::Math; + + // Set the proxy server to proxyserver, set the port to 80, and specify to bypass the proxy server + // for local addresses. + IWebProxy^ proxyObject = gcnew WebProxy( "http://proxyserver:80",true ); + math->Proxy = proxyObject; + + // Call the Add XML Web service method. + int total = math->Add( 8, 5 ); + + // + } +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp new file mode 100644 index 00000000000..16cbdf361c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest Example/CPP/source.cpp @@ -0,0 +1,16 @@ + + +#using + +using namespace System; +using namespace System::Net; +public ref class Sample +{ +public: + void Method() + { + // + HttpWebRequest^ myReq = dynamic_cast(WebRequest::Create( "http://www.contoso.com/" )); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp new file mode 100644 index 00000000000..352469e1bea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebRequest.RequestUri Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Web; +using namespace System::Web::UI; + +public ref class Page1: public Page +{ +private: + void Page_Load( Object^, EventArgs^ ) + { + HttpWebRequest^ req = dynamic_cast(WebRequest::Create( "http://www.contoso.com/" )); + + // + bool hasChanged = req->RequestUri->Equals( req->Address ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp new file mode 100644 index 00000000000..945bd743eee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic HttpWebResponse Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Web; +using namespace System::Web::UI; + +public ref class Page1: public Page +{ +private: + void Page_Load( Object^, EventArgs^ ) + { + // + HttpWebRequest^ HttpWReq = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); + HttpWebResponse^ HttpWResp = dynamic_cast(HttpWReq->GetResponse()); + + // Insert code that uses the response object. + HttpWResp->Close(); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp new file mode 100644 index 00000000000..8d014c2ed72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic ICertificatePolicy Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security::Cryptography::X509Certificates; + +// +public enum class CertificateProblem : UInt32 +{ + CertEXPIRED = 0x800B0101, + CertVALIDITYPERIODNESTING = 0x800B0102, + CertROLE = 0x800B0103, + CertPATHLENCONST = 0x800B0104, + CertCRITICAL = 0x800B0105, + CertPURPOSE = 0x800B0106, + CertISSUERCHAINING = 0x800B0107, + CertMALFORMED = 0x800B0108, + CertUNTRUSTEDROOT = 0x800B0109, + CertCHAINING = 0x800B010A, + CertREVOKED = 0x800B010C, + CertUNTRUSTEDTESTROOT = 0x800B010D, + CertREVOCATION_FAILURE = 0x800B010E, + CertCN_NO_MATCH = 0x800B010F, + CertWRONG_USAGE = 0x800B0110, + CertUNTRUSTEDCA = 0x800B0112 +}; + +public ref class MyCertificateValidation: public ICertificatePolicy +{ +public: + + // Default policy for certificate validation. + static bool DefaultValidate = false; + virtual bool CheckValidationResult( ServicePoint^ /*sp*/, X509Certificate^ /*cert*/, WebRequest^ request, int problem ) + { + bool ValidationResult = false; + Console::WriteLine( "Certificate Problem with accessing {0}", request->RequestUri ); + Console::Write( "Problem code 0x{0:X8},", (int)problem ); + Console::WriteLine( GetProblemMessage( (CertificateProblem)problem ) ); + ValidationResult = DefaultValidate; + return ValidationResult; + } + +private: + String^ GetProblemMessage( CertificateProblem Problem ) + { + String^ ProblemMessage = ""; + CertificateProblem problemList = CertificateProblem( ); + String^ ProblemCodeName = Enum::GetName( problemList.GetType(), Problem ); + if ( ProblemCodeName != nullptr ) + ProblemMessage = String::Concat( ProblemMessage, "-Certificateproblem:", ProblemCodeName ); + else + ProblemMessage = "Unknown Certificate Problem"; + + return ProblemMessage; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp new file mode 100644 index 00000000000..ef840b46dcf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic LingerOption Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; + +public ref class Sample +{ +protected: + void Method( Socket^ mySocket ) + { + // + LingerOption^ myOpts = gcnew LingerOption( true,1 ); + mySocket->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::Linger, myOpts ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp new file mode 100644 index 00000000000..c92542655c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic NetworkCredential Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Http; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + String^ SecurelyStoredUserName = ""; + String^ SecurelyStoredPassword = ""; + String^ SecurelyStoredDomain = ""; + + // + NetworkCredential^ myCred = gcnew NetworkCredential( + SecurelyStoredUserName,SecurelyStoredPassword,SecurelyStoredDomain ); + + CredentialCache^ myCache = gcnew CredentialCache; + + myCache->Add( gcnew Uri( "http://www.contoso.com" ), "Basic", myCred ); + myCache->Add( gcnew Uri( "http://app.contoso.com" ), "Basic", myCred ); + + // HttpClient lifecycle management best practices: + // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use + HttpClientHandler^ handler = gcnew HttpClientHandler(); + handler->Credentials = myCache; + HttpClient^ client = gcnew HttpClient(handler); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp new file mode 100644 index 00000000000..4613eef8236 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SerializationInfo.GetValue Example/CPP/source.cpp @@ -0,0 +1,41 @@ +using namespace System; +using namespace System::Runtime::Serialization; + +// Class added so sample will compile +ref class Node +{ +public: + Node( int /*i*/ ){} +}; + +// +// A serializable LinkedList example. For the full LinkedList implementation +// see the Serialization sample. +[Serializable] +ref class LinkedList: public ISerializable +{ +private: + Node^ m_head; + Node^ m_tail; + + // Serializes the object. +public: + virtual void GetObjectData( SerializationInfo^ info, StreamingContext /*context*/ ) + { + // Stores the m_head and m_tail references in the SerializationInfo info. + info->AddValue( "head", m_head, m_head->GetType() ); + info->AddValue( "tail", m_tail, m_tail->GetType() ); + } + + // Constructor that is called automatically during deserialization. +private: + // Reconstructs the object from the information in SerializationInfo info + LinkedList( SerializationInfo^ info, StreamingContext /*context*/ ) + { + Node^ temp = gcnew Node( 0 ); + // Retrieves the values of Type temp.GetType() from SerializationInfo info + m_head = dynamic_cast(info->GetValue( "head", temp->GetType() )); + m_tail = dynamic_cast(info->GetValue( "tail", temp->GetType() )); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp new file mode 100644 index 00000000000..1a04a196a24 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic ServicePoint Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + void Method() + { + // + Uri^ myUri = gcnew Uri( "http://www.contoso.com/" ); + ServicePoint^ mySP = ServicePointManager::FindServicePoint( myUri ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp new file mode 100644 index 00000000000..7a9fdb44639 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic ServicePointManager.CertificatePolicy Example/CPP/source.cpp @@ -0,0 +1,53 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Windows::Forms; +using namespace System::Web; +using namespace System::Web::Services; + +// Class added so sample will compile +public ref class MyCertificatePolicy: public ICertificatePolicy +{ +public: + virtual bool CheckValidationResult( System::Net::ServicePoint^, System::Security::Cryptography::X509Certificates::X509Certificate^, System::Net::WebRequest^, int ) + { + return true; + } +}; + +public ref class Form1: public Form +{ +public: + void Method( Uri^ myUri ) + { + // + ServicePointManager::CertificatePolicy = gcnew MyCertificatePolicy; + + // Create the request and receive the response + try + { + WebRequest^ myRequest = WebRequest::Create( myUri ); + WebResponse^ myResponse = myRequest->GetResponse(); + ProcessResponse( myResponse ); + myResponse->Close(); + } + // Catch any exceptions + catch ( WebException^ e ) + { + if ( e->Status == WebExceptionStatus::TrustFailure ) + { + // Code for handling security certificate problems goes here. + } + // Other exception handling goes here + } + // + } + + // Method added so sample will compile + void ProcessResponse( WebResponse^ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp new file mode 100644 index 00000000000..40bea86464b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension Example/CPP/source.cpp @@ -0,0 +1,166 @@ +// +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::IO; +using namespace System::Net; + +ref class TraceExtension; + +// Create a SoapExtensionAttribute for the SOAP Extension that can be +// applied to an XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ filename; + int priority; + +public: + TraceExtensionAttribute() + : filename( "c:\\log.txt" ) + {} + + property Type^ ExtensionType + { + virtual Type^ get() override + { + return TraceExtension::typeid; + } + } + + property int Priority + { + virtual int get() override + { + return priority; + } + virtual void set( int value ) override + { + priority = value; + } + } + + property String^ Filename + { + String^ get() + { + return filename; + } + void set( String^ value ) + { + filename = value; + } + } +}; + +// Define a SOAP Extension that traces the SOAP request and SOAP +// response for the XML Web service method the SOAP extension is +// applied to. +public ref class TraceExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // Save the Stream representing the SOAP request or SOAP response into + // a local memory buffer. + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + // When the SOAP extension is accessed for the first time, the XML Web + // service method it is applied to is accessed to store the file + // name passed in, using the corresponding SoapExtensionAttribute. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override + { + return (dynamic_cast(attribute))->Filename; + } + + // The SOAP extension was configured to run using a configuration file + // instead of an attribute applied to a specific XML Web service + // method. + virtual Object^ GetInitializer( Type^ WebServiceType ) override + { + // Return a file name to log the trace information to, based on the + // type. + return String::Format( "C:\\{0}.log", WebServiceType->FullName ); + } + + // Receive the file name stored by GetInitializer and store it in a + // member variable for this specific instance. + virtual void Initialize( Object^ initializer ) override + { + filename = dynamic_cast(initializer); + } + + // If the SoapMessageStage is such that the SoapRequest or + // SoapResponse is still in the SOAP format to be sent or received, + // save it out to a file. + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + case SoapMessageStage::AfterDeserialize: + break; + } + } + + void WriteOutput( SoapMessage^ message ) + { + newStream->Position = 0; + FileStream^ fs = gcnew FileStream( filename, FileMode::Append, + FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + + String^ soapString = ( (SoapServerMessage^)( message ) ) ? + (String^)"SoapResponse" : "SoapRequest"; + w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); + w->Flush(); + Copy( newStream, fs ); + w->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + void WriteInput( SoapMessage^ message ) + { + Copy( oldStream, newStream ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + String^ soapString = (dynamic_cast(message)) ? (String^)"SoapRequest" : "SoapResponse"; + w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); + w->Flush(); + newStream->Position = 0; + Copy( newStream, fs ); + w->Close(); + newStream->Position = 0; + } + + void Copy( Stream^ from, Stream^ to ) + { + TextReader^ reader = gcnew StreamReader( from ); + TextWriter^ writer = gcnew StreamWriter( to ); + writer->WriteLine( reader->ReadToEnd() ); + writer->Flush(); + } +}; +// + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp new file mode 100644 index 00000000000..dfe63fe65f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ChainStream Example/CPP/source.cpp @@ -0,0 +1,157 @@ +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::IO; + +ref class TraceExtension; + +// Create a SoapExtensionAttribute for our SOAP Extension that can be +// applied to an XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ filename; + int priority; + +public: + TraceExtensionAttribute() + : filename( "c:\\log.txt" ) + {} + + property Type^ ExtensionType + { + virtual Type^ get() override + { + return TraceExtension::typeid; + } + } + + property int Priority + { + virtual int get() override + { + return priority; + } + virtual void set( int value ) override + { + priority = value; + } + } + + property String^ Filename + { + String^ get() + { + return filename; + } + void set( String^ value ) + { + filename = value; + } + } +}; + + +// Define a SOAP Extension that traces the SOAP request and SOAP response +// for the XML Web service method, the SOAP extension is applied to. +public ref class TraceExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // When the SOAP extension is accessed for the first time the XML Web service method it is applied + // is accessed store the filename passed in using the corresponding SoapExtensionAttribute. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override + { + return (dynamic_cast(attribute))->Filename; + } + + // The extension was configured to run using a configuration file instead of an attribute applied to a + // specific XML Web service method. Return a file name based on the class implementing the XML Web service's type. + virtual Object^ GetInitializer( Type^ WebServiceType ) override + { + // Return a file name to log the trace information to based on the passed in type. + return String::Format( "C:\\{0}.log", WebServiceType->FullName ); + } + + // Receive the filename stored by GetInitializer and store it in a member variable + // for this specific instance. + virtual void Initialize( Object^ initializer ) override + { + filename = dynamic_cast(initializer); + } + + // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP + // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Save the Stream representing the SOAP request or SOAP response into a local memory buffer + // +public: + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + // + + void WriteOutput( SoapMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); + w->Flush(); + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + void WriteInput( SoapMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "================================== Request at {0}", DateTime::Now ); + w->Flush(); + newStream->Position = 0; + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + } + + void Copy( Stream^ from, Stream^ to ) + { + TextReader^ reader = gcnew StreamReader( from ); + TextWriter^ writer = gcnew StreamWriter( to ); + writer->WriteLine( reader->ReadToEnd() ); + writer->Flush(); + } +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp new file mode 100644 index 00000000000..98113ace5c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.GetInitializer Example/CPP/source.cpp @@ -0,0 +1,156 @@ +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::IO; + +ref class TraceExtension; + +// Create a SoapExtensionAttribute for our SOAP Extension that can be +// applied to an XML Web service method. + +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ filename; + int priority; + +public: + TraceExtensionAttribute() + : filename( "c:\\log.txt" ) + {} + + property Type^ ExtensionType + { + virtual Type^ get() override + { + return TraceExtension::typeid; + } + } + + property int Priority + { + virtual int get() override + { + return priority; + } + virtual void set( int value ) override + { + priority = value; + } + } + + property String^ Filename + { + String^ get() + { + return filename; + } + void set( String^ value ) + { + filename = value; + } + } +}; + +// Define a SOAP Extension that traces the SOAP request and SOAP response +// for the XML Web service method, the SOAP extension is applied to. +public ref class TraceExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + + // +public: + // When the SOAP extension is accessed for the first time, cache the + // file name passed in by the SoapExtensionAttribute. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override + { + return (dynamic_cast(attribute))->Filename; + } + // + + // The extension was configured to run using a configuration file instead of an attribute applied to a + // specific XML Web service method. Return a file name based on the class implementing the XML Web service's type. + virtual Object^ GetInitializer( Type^ WebServiceType ) override + { + // Return a file name to log the trace information to based on the passed in type. + return String::Format( "C:\\{0}.log", WebServiceType->FullName ); + } + + // Receive the filename stored by GetInitializer and store it in a member variable + // for this specific instance. + virtual void Initialize( Object^ initializer ) override + { + filename = dynamic_cast(initializer); + } + + // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP + // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Save the Stream representing the SOAP request or SOAP response into a local memory buffer + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + void WriteOutput( SoapMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); + w->Flush(); + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + void WriteInput( SoapMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "================================== Request at {0}", DateTime::Now ); + w->Flush(); + newStream->Position = 0; + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + } + + void Copy( Stream^ from, Stream^ to ) + { + TextReader^ reader = gcnew StreamReader( from ); + TextWriter^ writer = gcnew StreamWriter( to ); + writer->WriteLine( reader->ReadToEnd() ); + writer->Flush(); + } +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp new file mode 100644 index 00000000000..8fdb714ad46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.Initialize Example/CPP/source.cpp @@ -0,0 +1,154 @@ +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::IO; + +ref class TraceExtension; + +// Create a SoapExtensionAttribute for our SOAP Extension that can be +// applied to an XML Web service method. + +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ filename; + int priority; + +public: + TraceExtensionAttribute() + : filename( "c:\\log.txt" ) + {} + + property Type^ ExtensionType + { + virtual Type^ get() override + { + return TraceExtension::typeid; + } + } + + property int Priority + { + virtual int get() override + { + return priority; + } + virtual void set( int value ) override + { + priority = value; + } + } + + property String^ Filename + { + String^ get() + { + return filename; + } + void set( String^ value ) + { + filename = value; + } + } +}; + +// Define a SOAP Extension that traces the SOAP request and SOAP response +// for the XML Web service method, the SOAP extension is applied to. +public ref class TraceExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // When the SOAP extension is accessed for the first time the XML Web service method it is applied + // is accessed store the filename passed in using the corresponding SoapExtensionAttribute. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override + { + return (dynamic_cast(attribute))->Filename; + } + + virtual Object^ GetInitializer( Type^ filename ) override + { + return dynamic_cast(filename); + } + + // + // Receive the file name stored by GetInitializer and store it in + // a member variable for this specific instance. +public: + virtual void Initialize( Object^ initializer ) override + { + filename = dynamic_cast(initializer); + } + // + + // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP + // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Save the Stream representing the SOAP request or SOAP response into a local memory buffer + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + void WriteOutput( SoapMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); + w->Flush(); + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + void WriteInput( SoapMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "================================== Request at {0}", DateTime::Now ); + w->Flush(); + newStream->Position = 0; + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + } + + void Copy( Stream^ from, Stream^ to ) + { + TextReader^ reader = gcnew StreamReader( from ); + TextWriter^ writer = gcnew StreamWriter( to ); + writer->WriteLine( reader->ReadToEnd() ); + writer->Flush(); + } +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp new file mode 100644 index 00000000000..b15566f7bea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtension.ProcessMessage Example/CPP/source.cpp @@ -0,0 +1,68 @@ +#using +#using + +using namespace System; +using namespace System::Web; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; + +public ref class Sample: public SoapExtension +{ + // +public: + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + + case SoapMessageStage::AfterDeserialize: + break; + + + } + } + // + + virtual Object^ GetInitializer( LogicalMethodInfo^ /*lmi*/, SoapExtensionAttribute^ /*sea*/ ) override + { + // method added so sample will compile + Object^ myobject = gcnew Object; + return myobject; + } + + virtual void Initialize( Object^ /*o*/ ) override + { + + // method added so sample will compile + } + + void WriteOutput( SoapMessage^ /*message*/ ) + { + + // method added so sample will compile + } + + void WriteInput( SoapMessage^ /*message*/ ) + { + + // method added so sample will compile + } + + virtual Object^ GetInitializer( Type^ filename ) override + { + return dynamic_cast(filename); + } + +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..f1845cb9d2d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapExtensionAttribute Example/CPP/source.cpp @@ -0,0 +1,69 @@ + + +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::IO; + +// Class added so sample will compile +public ref class TraceExtension{}; + +// +// Create a SoapExtensionAttribute for a SOAP extension that can be +// applied to an XML Web service method. + +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + + // Set the name of the log file were SOAP messages will be stored. + TraceExtensionAttribute() + : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of 'TraceExtension' class. + virtual Type^ get() override + { + return TraceExtension::typeid; + } + } + + property int Priority + { + // User can set priority of the 'SoapExtension'. + virtual int get() override + { + return myPriority; + } + + virtual void set( int value ) override + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + + void set( String^ value ) + { + myFilename = value; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp new file mode 100644 index 00000000000..789a774b3b2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.Actor Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +#using +#using + +using namespace System; +using namespace System::Web::Services::Protocols; + +// Following was added to make the sample compile. +public ref class MyHeader: public SoapHeader +{ +public: + String^ MyValue; +}; + +public ref class MyWebService +{ +public: + MyHeader^ myHeader; + int MyWebMethod( int num1, int num2 ) + { + return num1 + num2; + } + +}; + + +// +int main() +{ + MyWebService^ ws = gcnew MyWebService; + try + { + MyHeader^ customHeader = gcnew MyHeader; + customHeader->MyValue = "Header Value for MyValue"; + customHeader->Actor = "http://www.contoso.com/MySoapHeaderHandler"; + ws->myHeader = customHeader; + int results = ws->MyWebMethod( 3, 5 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp new file mode 100644 index 00000000000..20b86237884 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeader.MustUnderstand Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +#using +#using + +using namespace System::Web::Services::Protocols; +using namespace System; + +// Following was added to make the sample compile. +public ref class MyHeader: public SoapHeader +{ +public: + String^ MyValue; +}; + +public ref class MyWebService +{ +public: + MyHeader^ myHeader; + int MyWebMethod( int num1, int num2 ) + { + return num1 + num2; + } + +}; + + +// +int main() +{ + MyWebService^ ws = gcnew MyWebService; + try + { + MyHeader^ customHeader = gcnew MyHeader; + customHeader->MyValue = "Header Value for MyValue"; + customHeader->MustUnderstand = true; + ws->myHeader = customHeader; + int results = ws->MyWebMethod( 3, 5 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp new file mode 100644 index 00000000000..eb179a86c88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderAttribute.MemberName Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; + +// Define a SOAP header by deriving from the SoapHeader base class. +// The header contains just one string value. +public ref class MyHeader: public SoapHeader +{ +public: + String^ MyValue; +}; + +public ref class MyWebService +{ +public: + + // Member variable to receive the contents of the MyHeader SOAP header. + MyHeader^ myHeader; + + [WebMethod] + [SoapHeader("myHeader",Direction=SoapHeaderDirection::InOut)] + void Hello(){} + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp new file mode 100644 index 00000000000..2c181c54c3b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHeaderDirection Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Web; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; + +// +public ref class MyHeader: public SoapHeader +{ +public: + String^ MyValue; +}; + +public ref class MyWebService +{ +public: + MyHeader^ myHeader; + + [WebMethod] + [SoapHeader("myHeader", + Direction=SoapHeaderDirection::InOut|SoapHeaderDirection::Fault)] + void MySoapHeaderReceivingMethod() + { + + // Set myHeader->MyValue to some value. + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp new file mode 100644 index 00000000000..b46a3f5ba86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol Example/CPP/source.cpp @@ -0,0 +1,61 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +namespace MyMath +{ + + [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] + public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MyMath() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add", + RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int num1, int num2 ) + { + array^temp0 = {num1,num2}; + array^results = this->Invoke( "Add", temp0 ); + return *dynamic_cast(results[ 0 ]); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp new file mode 100644 index 00000000000..1a106c1b0b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.BeginInvoke Example/CPP/source.cpp @@ -0,0 +1,61 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +namespace MyMath +{ + + [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] + public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MyMath() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add", + RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int num1, int num2 ) + { + array^temp1 = {num1,num2}; + array^results = this->Invoke( "Add", temp1 ); + return *dynamic_cast(results[ 0 ]); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp2 = {num1,num2}; + return this->BeginInvoke( "Add", temp2, callback, asyncState ); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp new file mode 100644 index 00000000000..9cdfc4f439d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.EndInvoke Example/CPP/source.cpp @@ -0,0 +1,58 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +namespace MyMath +{ + + [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] + public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MyMath() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add",RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/",Use=System::Web::Services::Description::SoapBindingUse::Literal,ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int num1, int num2 ) + { + array^temp0 = {num1,num2}; + array^results = this->Invoke( "Add", temp0 ); + return *dynamic_cast(results[ 0 ]); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp new file mode 100644 index 00000000000..b46a3f5ba86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapHttpClientProtocol.Invoke Example/CPP/source.cpp @@ -0,0 +1,61 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +namespace MyMath +{ + + [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap",Namespace="http://www.contoso.com/")] + public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MyMath() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://www.contoso.com/Add", + RequestNamespace="http://www.contoso.com/",ResponseNamespace="http://www.contoso.com/", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int num1, int num2 ) + { + array^temp0 = {num1,num2}; + array^results = this->Invoke( "Add", temp0 ); + return *dynamic_cast(results[ 0 ]); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp new file mode 100644 index 00000000000..12e7ead3332 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SoapMessage.EnsureStage Example/CPP/source.cpp @@ -0,0 +1,24 @@ +namespace EnsureStageExample +{ + public enum class SoapMessageStage + { + BeforeSerialize = 1, + BeforeDeserialize = 2 + }; + + ref class Class1 + { + public: + static void main() + { + // + EnsureStage( (SoapMessageStage)( SoapMessageStage::BeforeSerialize | + SoapMessageStage::BeforeDeserialize ) ); + // + } + + private: + //This method is a standin for the real method so that the example will compile + static void EnsureStage( SoapMessageStage /*sms*/ ){} + }; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp new file mode 100644 index 00000000000..e1e657e660b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Accept Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; + +public ref class Sample +{ + // +protected: + void AcceptMethod( Socket^ listeningSocket ) + { + Socket^ mySocket = listeningSocket->Accept(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp new file mode 100644 index 00000000000..6c46b3b92d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Bind Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; + +public ref class Sample +{ +protected: + void Method( Socket^ aSocket, EndPoint^ anEndPoint ) + { + // + try + { + aSocket->Bind( anEndPoint ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Winsock error: {0}", e ); + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp new file mode 100644 index 00000000000..2e51128de63 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Close Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Security::Permissions; + +public ref class Sample +{ +protected: + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + void Method( Socket^ aSocket ) + { + // + try + { + aSocket->Shutdown(SocketShutdown::Both); + aSocket->Close(); + } + catch (...) + { + aSocket->Close(); + throw; + } + + if ( aSocket->Connected ) + { + Console::WriteLine( "Winsock error: {0}", Convert::ToString( + System::Runtime::InteropServices::Marshal::GetLastWin32Error() ) ); + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp new file mode 100644 index 00000000000..6693a8bdfcc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Connect Example/CPP/source.cpp @@ -0,0 +1,62 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; + +static void ConnectAndCheck( Socket^ client, EndPoint^ anEndPoint ) +{ + // + client->Connect( anEndPoint ); + if ( !client->Connected ) + { + Console::WriteLine( "Winsock error: {0}", Convert::ToString( + System::Runtime::InteropServices::Marshal::GetLastWin32Error() ) ); + } + + // This is how you can determine whether a socket is still connected. + bool blockingState = client->Blocking; + try + { + array^tmp = gcnew array(1); + client->Blocking = false; + client->Send( tmp, 0, static_cast(0) ); + Console::WriteLine( L"Connected!" ); + } + catch ( SocketException^ e ) + { + // 10035 == WSAEWOULDBLOCK + if ( e->NativeErrorCode.Equals( 10035 ) ) + { + Console::WriteLine( "Connected from an exception!" ); + } + else + { + Console::WriteLine( "Disconnected: {0}!", e->NativeErrorCode ); + } + } + finally + { + client->Blocking = blockingState; + } + + Console::WriteLine( "Connected: {0}", client->Connected ); + // +} + +[STAThread] +int main() +{ + Socket^ s = gcnew Socket( AddressFamily::InterNetwork, + SocketType::Stream, + ProtocolType::Tcp ); + + String^ host = "localhost"; + int port = 80; + + IPHostEntry^ hostEntry = Dns::Resolve( host ); + IPEndPoint^ EPHost = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],port ); + + ConnectAndCheck( s, EPHost ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp new file mode 100644 index 00000000000..66f68944d86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Socket.Listen Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; + +void CreateAndListen( int port, int backlog ) +{ + // + // create the socket + Socket^ listenSocket = gcnew Socket( AddressFamily::InterNetwork, + SocketType::Stream, + ProtocolType::Tcp ); + + // bind the listening socket to the port + IPAddress^ hostIP = ( Dns::Resolve( IPAddress::Any->ToString() ) )->AddressList[ 0 ]; + IPEndPoint^ ep = gcnew IPEndPoint( hostIP,port ); + listenSocket->Bind( ep ); + + // start listening + listenSocket->Listen( backlog ); + // +} + +[STAThread] +int main() +{ + CreateAndListen( 10042, 10 ); + Console::WriteLine( "enter to exit" ); + Console::Read(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp new file mode 100644 index 00000000000..27d0003bd8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic SocketAddressExample/CPP/source.cpp @@ -0,0 +1,30 @@ +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; + +void MySerializeIPEndPointClassMethod() +{ + // + //Creates an IpEndPoint. + IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; + IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); + + //Serializes the IPEndPoint. + SocketAddress^ socketAddress = ipLocalEndPoint->Serialize(); + + //Verifies that ipLocalEndPoint is now serialized by printing its contents. + Console::WriteLine( "Contents of the socketAddress are: {0}", socketAddress ); + //Checks the Family property. + Console::WriteLine( "The address family of the socketAddress is: {0}", socketAddress->Family ); + //Checks the underlying buffer size. + Console::WriteLine( "The size of the underlying buffer is: {0}", socketAddress->Size ); + // +} + +int main() +{ + MySerializeIPEndPointClassMethod(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp new file mode 100644 index 00000000000..719fbbc6521 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic TcpListener.PublicMethodsAndPropertiesExample/CPP/source.cpp @@ -0,0 +1,106 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length == 1 ) + { + Console::WriteLine( "Enter a selection" ); + return 0; + } + + if ( args[ 1 ] == "endpointExample" ) + { + // + //Creates an instance of the TcpListener class by providing a local endpoint. + + IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; + IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); + + try + { + TcpListener^ tcpListener = gcnew TcpListener( ipLocalEndPoint ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else + if ( args[ 1 ] == "ipAddressExample" ) + { + // + //Creates an instance of the TcpListener class by providing a local IP address and port number. + + IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; + + try + { + TcpListener^ tcpListener = gcnew TcpListener( ipAddress,13 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else + if ( args[ 1 ] == "portNumberExample" ) + { + // + //Creates an instance of the TcpListener class by providing a local port number. + + IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; + + try + { + TcpListener^ tcpListener = gcnew TcpListener( ipAddress,13 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else + { + IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; + TcpListener^ tcpListener = gcnew TcpListener( ipAddress,13 ); + tcpListener->Start(); + Console::WriteLine( "Waiting for a connection...." ); + + try + { + // + // Accepts the pending client connection and returns a socket for communciation. + Socket^ socket = tcpListener->AcceptSocket(); + Console::WriteLine( "Connection accepted." ); + + String^ responseString = "You have successfully connected to me"; + + //Forms and sends a response string to the connected client. + array^sendBytes = Encoding::ASCII->GetBytes( responseString ); + int i = socket->Send( sendBytes ); + Console::WriteLine( "Message Sent /> : {0}", responseString ); + // + + //Any communication with the remote client using the socket can go here. + + //Closes the tcpListener and the socket. + socket->Shutdown( SocketShutdown::Both ); + socket->Close(); + tcpListener->Stop(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp new file mode 100644 index 00000000000..c216c7fe3f7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic TcpListenerExample/CPP/source.cpp @@ -0,0 +1,83 @@ +// +/** +* This program shows how to use the TcpListener class. +* It creates a TcpListener that listens on the specified port (13000). +* To run this program at the command line you enter: +* cs_tcpserver +* Any TcpClient that wants to use this server +* has to explicitly connect to an address obtained by the combination of +* the server on which this TcpServer is running and the port 13000. +* This TcpServer simply echoes back the message sent by the TcpClient, after +* translating it into uppercase. +**/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; + +int main() +{ + try + { + + // Set the TcpListener on port 13000. + Int32 port = 13000; + TcpListener^ server = gcnew TcpListener(IPAddress::Any, port); + + // Start listening for client requests. + server->Start(); + + // Buffer for reading data + array^bytes = gcnew array(256); + String^ data = nullptr; + + // Enter the listening loop. + while ( true ) + { + Console::Write( "Waiting for a connection... " ); + + // Perform a blocking call to accept requests. + // You could also use server.AcceptSocket() here. + TcpClient^ client = server->AcceptTcpClient(); + Console::WriteLine( "Connected!" ); + data = nullptr; + + // Get a stream object for reading and writing + NetworkStream^ stream = client->GetStream(); + Int32 i; + + // Loop to receive all the data sent by the client. + while ( (i = stream->Read( bytes, 0, bytes->Length )) != 0 ) + { + + // Translate data bytes to a ASCII string. + data = System::Text::Encoding::ASCII->GetString( bytes, 0, i ); + Console::WriteLine( String::Format( "Received: {0}", data ) ); + + // Process the data sent by the client. + data = data->ToUpper(); + array^msg = System::Text::Encoding::ASCII->GetBytes( data ); + + // Send back a response. + stream->Write( msg, 0, msg->Length ); + Console::WriteLine( String::Format( "Sent: {0}", data ) ); + } + + // Shutdown and end connection + client->Close(); + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException: {0}", e ); + } + + Console::WriteLine( "\nHit enter to continue..." ); + Console::Read(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp new file mode 100644 index 00000000000..8c3fe289538 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.ProtectedMethodsAndPropertiesExample/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; + +// +// This derived class demonstrate the use of three protected methods belonging to the UdpClient class. +public ref class MyUdpClientDerivedClass: public UdpClient +{ +public: + MyUdpClientDerivedClass() + : UdpClient() + {} + + void UsingProtectedMethods() + { + //Uses the protected Active property belonging to the UdpClient base class to determine if a connection is established. + if ( this->Active ) + { + //Calls the protected Client property belonging to the UdpClient base class. + Socket^ s = this->Client; + + //Uses the Socket returned by Client to set an option that is not available using UdpClient. + s->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::Broadcast, 1 ); + } + } +}; +// + +int main() +{ + MyUdpClientDerivedClass^ myUdpClientDerivedClass = gcnew MyUdpClientDerivedClass; + myUdpClientDerivedClass->UsingProtectedMethods(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp new file mode 100644 index 00000000000..9ac0d6b76e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp @@ -0,0 +1,280 @@ +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; + +public ref class MyUdpClientExample +{ +public: + // MyUdpClientConstructor is just used to illustrate the different constructors available in in the UdpClient class. + static void MyUdpClientConstructor( String^ myConstructorType ) + { + if ( myConstructorType->Equals( "PortNumberExample" ) ) + { + // + //Creates an instance of the UdpClient class to listen on + // the default interface using a particular port. + try + { + UdpClient^ udpClient = gcnew UdpClient( 11000 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( myConstructorType->Equals( "LocalEndPointExample" ) ) + { + // + //Creates an instance of the UdpClient class using a local endpoint. + IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; + IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); + + try + { + UdpClient^ udpClient = gcnew UdpClient( ipLocalEndPoint ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( myConstructorType->Equals( "HostNameAndPortNumExample" ) ) + { + // + //Creates an instance of the UdpClient class with a remote host name and a port number. + try + { + UdpClient^ udpClient = gcnew UdpClient( "www.contoso.com",11000 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( myConstructorType->Equals( "DefaultExample" ) ) + { + // + //Creates an instance of the UdpClient class using the default constructor. + UdpClient^ udpClient = gcnew UdpClient; + // + } + else + { + // Do nothing. + } + } + + // MyUdpClientConnection method is just used to illustrate the different connection methods of UdpClient class. + static void MyUdpClientConnection( String^ myConnectionType ) + { + if ( myConnectionType->Equals( "HostnameAndPortNumExample" ) ) + { + // + //Uses a host name and port number to establish a socket connection. + UdpClient^ udpClient = gcnew UdpClient; + try + { + udpClient->Connect( "www.contoso.com", 11002 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( myConnectionType == "IPAddressAndPortNumExample" ) + { + // + //Uses the IP address and port number to establish a socket connection. + UdpClient^ udpClient = gcnew UdpClient; + IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; + try + { + udpClient->Connect( ipAddress, 11003 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( myConnectionType == "RemoteEndPointExample" ) + { + // + //Uses a remote endpoint to establish a socket connection. + UdpClient^ udpClient = gcnew UdpClient; + IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress,11004 ); + try + { + udpClient->Connect( ipEndPoint ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else + { + // Do nothing. + } + } + + // This class demonstrates sending and receiving using a Udp socket. + static void MyUdpClientCommunicator( String^ mySendType ) + { + if ( mySendType == "EndPointExample" ) + { + // + UdpClient^ udpClient = gcnew UdpClient; + IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress,11004 ); + + array^ sendBytes = Encoding::ASCII->GetBytes( "Is anybody there?" ); + try + { + udpClient->Send( sendBytes, sendBytes->Length, ipEndPoint ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( mySendType == "HostNameAndPortNumberExample" ) + { + // + UdpClient^ udpClient = gcnew UdpClient; + + array^ sendBytes = Encoding::ASCII->GetBytes( "Is anybody there" ); + try + { + udpClient->Send( sendBytes, sendBytes->Length, "www.contoso.com", 11000 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( mySendType == "StraightSendExample" ) + { + // + UdpClient^ udpClient = gcnew UdpClient( "www.contoso.com",11000 ); + array^ sendBytes = Encoding::ASCII->GetBytes( "Is anybody there" ); + try + { + udpClient->Send( sendBytes, sendBytes->Length ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else + { + // Do nothing. + } + + // + //Creates a UdpClient for reading incoming data. + UdpClient^ receivingUdpClient = gcnew UdpClient( 11000 ); + + //Creates an IPEndPoint to record the IP Address and port number of the sender. + // The IPEndPoint will allow you to read datagrams sent from any source. + IPEndPoint^ RemoteIpEndPoint = gcnew IPEndPoint( IPAddress::Any,0 ); + try + { + // Blocks until a message returns on this socket from a remote host. + array^receiveBytes = receivingUdpClient->Receive( RemoteIpEndPoint ); + + String^ returnData = Encoding::ASCII->GetString( receiveBytes ); + + Console::WriteLine( "This is the message you received {0}", returnData ); + Console::WriteLine( "This message was sent from {0} on their port number {1}", + RemoteIpEndPoint->Address, RemoteIpEndPoint->Port ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + + // This example class demonstrates methods used to join and drop multicast groups. + static void MyUdpClientMulticastConfiguration( String^ myAction ) + { + if ( myAction == "JoinMultiCastExample" ) + { + // + UdpClient^ udpClient = gcnew UdpClient; + IPAddress^ multicastIpAddress = Dns::Resolve( "MulticastGroupName" )->AddressList[ 0 ]; + try + { + udpClient->JoinMulticastGroup( multicastIpAddress ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + } + else if ( myAction == "JoinMultiCastWithTimeToLiveExample" ) + { + // + UdpClient^ udpClient = gcnew UdpClient; + // Creates an IPAddress to use to join and drop the multicast group. + IPAddress^ multicastIpAddress = IPAddress::Parse( "239.255.255.255" ); + + try + { + // The packet dies after 50 router hops. + udpClient->JoinMulticastGroup( multicastIpAddress, 50 ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + + // + // Informs the server that you want to remove yourself from the multicast client list. + try + { + udpClient->DropMulticastGroup( multicastIpAddress ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // + + // + // Closes the UDP client by calling the public method Close(). + udpClient->Close(); + // + } + else + { + // Do nothing. + } + } +}; +//end class + +int main() +{ + // For our example, we will use the default constructor. + MyUdpClientExample::MyUdpClientConstructor( "defaultExample" ); + MyUdpClientExample::MyUdpClientConnection( "HostNameAndPortNumExample" ); + MyUdpClientExample::MyUdpClientCommunicator( "EndPointExample" ); + MyUdpClientExample::MyUdpClientMulticastConfiguration( "JoinMultiCastExample" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp new file mode 100644 index 00000000000..12a033e105e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UdpClientExample/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; + +int main() +{ + // + // With this constructor the local port number is arbitrarily assigned. + UdpClient^ udpClient = gcnew UdpClient; + try + { + udpClient->Connect( "host.contoso.com", 11000 ); + + // Send message to the host to which you have connected. + array^sendBytes = Encoding::ASCII->GetBytes( "Is anybody there?" ); + udpClient->Send( sendBytes, sendBytes->Length ); + + // Send message to a different host using optional hostname and port parameters. + UdpClient^ udpClientB = gcnew UdpClient; + udpClientB->Send( sendBytes, sendBytes->Length, "AlternateHostMachineName", 11000 ); + + //IPEndPoint object will allow us to read datagrams sent from any source. + IPEndPoint^ RemoteIpEndPoint = gcnew IPEndPoint( IPAddress::Any,0 ); + + // Block until a message returns on this socket from a remote host. + array^receiveBytes = udpClient->Receive( RemoteIpEndPoint ); + String^ returnData = Encoding::ASCII->GetString( receiveBytes ); + + // Use the IPEndPoint object to determine which of these two hosts responded. + Console::WriteLine( String::Concat( "This is the message you received ", returnData->ToString() ) ); + Console::WriteLine( String::Concat( "This message was sent from ", RemoteIpEndPoint->Address->ToString(), " on their port number ", RemoteIpEndPoint->Port.ToString() ) ); + udpClient->Close(); + udpClientB->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp new file mode 100644 index 00000000000..072abfddaab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Net; +using namespace System::Net::Http; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method() + { + // + Uri^ siteUri = gcnew Uri("http://www.contoso.com/"); + + // HttpClient lifecycle management best practices: + // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use + HttpClient^ client = gcnew HttpClient; + HttpRequestMessage^ request = gcnew HttpRequestMessage(HttpMethod::Get, siteUri); + HttpResponseMessage^ response = client->Send(request); + // + } +}; + +void main() +{ + Form1^ f = gcnew Form1; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp new file mode 100644 index 00000000000..1d511f22f6b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsolutePath Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method() + { + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); + Console::WriteLine( myUri->AbsolutePath ); + // + } +}; + +void main() +{ + Form1^ f = gcnew Form1; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp new file mode 100644 index 00000000000..f5adb1e6dc0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.AbsoluteUri Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com" ); + Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); + Console::WriteLine( myUri->AbsoluteUri ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp new file mode 100644 index 00000000000..2cb8990b9d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Authority Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com:8080/" ); + Uri^ myUri = gcnew Uri( baseUri,"shownew.htm?date=today" ); + Console::WriteLine( myUri->Authority ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp new file mode 100644 index 00000000000..0d5b9b87897 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.CheckHostName Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Console::WriteLine( Uri::CheckHostName( "www.contoso.com" ) ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp new file mode 100644 index 00000000000..db24745352e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Host Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com:8080/" ); + Uri^ myUri = gcnew Uri( baseUri,"shownew.htm?date=today" ); + Console::WriteLine( myUri->Host ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp new file mode 100644 index 00000000000..77b48ab3d82 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.PathAndQuery Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm?date=today" ); + + Console::WriteLine( myUri->PathAndQuery ); + // +} + +void Method2() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm?date=today" ); + + Console::WriteLine( myUri->Query ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp new file mode 100644 index 00000000000..2298149c102 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Port Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); + Console::WriteLine( myUri->Port ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp new file mode 100644 index 00000000000..2a79562ae4c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Scheme Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + Uri^ myUri = gcnew Uri( baseUri,"catalog/shownew.htm?date=today" ); + Console::WriteLine( myUri->Scheme ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp new file mode 100644 index 00000000000..1977347df49 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp new file mode 100644 index 00000000000..74ea933f0d1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri1 Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ myUri = gcnew Uri( "http://www.contoso.com/Hello%20World.htm",true ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp new file mode 100644 index 00000000000..aa310799d84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri3 Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com" ); + Uri^ myUri = gcnew Uri( baseUri, "catalog/shownew.htm" ); + Console::WriteLine( myUri->ToString() ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp new file mode 100644 index 00000000000..1cd0cad6310 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic Uri.Uri4 Example/CPP/source.cpp @@ -0,0 +1,12 @@ + + +#using + +using namespace System; +void main() +{ + // + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + Uri^ myUri = gcnew Uri( baseUri,"Hello%20World.htm",false ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp new file mode 100644 index 00000000000..7d57c1f31fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.Fragment Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + UriBuilder^ uBuild = gcnew UriBuilder( "http://www.contoso.com/" ); + uBuild->Path = "index.htm"; + uBuild->Fragment = "main"; + Uri^ myUri = uBuild->Uri; + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp new file mode 100644 index 00000000000..8ed7f68ec92 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder3 Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + UriBuilder^ myUri = gcnew UriBuilder( "http", "www.contoso.com" ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp new file mode 100644 index 00000000000..af69e8f961a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder4 Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + UriBuilder^ myUri = gcnew UriBuilder( "http", "www.contoso.com",8080 ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp new file mode 100644 index 00000000000..6c6a09487e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder5 Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + UriBuilder^ myUri = gcnew UriBuilder( "http","www.contoso.com",8080,"index.htm" ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp new file mode 100644 index 00000000000..3e0bf14858e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic UriBuilder.UriBuilder6 Example/CPP/source.cpp @@ -0,0 +1,18 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Security::Principal; +using namespace System::Windows::Forms; + +void main() +{ + // + UriBuilder^ myUri = gcnew UriBuilder( "http","www.contoso.com",8080,"index.htm","#top" ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp new file mode 100644 index 00000000000..cecb1ef6072 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Timeout Example/CPP/source.cpp @@ -0,0 +1,21 @@ +using namespace System; + +// Struct added so sample will compile +public value struct myMath +{ +public: + int Timeout; +}; + +public ref class Sample +{ +public: + void sampleFunction() + { + myMath math = myMath( ); + + // + math.Timeout = 15000; + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp new file mode 100644 index 00000000000..3e503131573 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic WebClientProtocol.Url Example/CPP/source.cpp @@ -0,0 +1,37 @@ +using namespace System; + +// Class added so sample will compile +public ref class myMath +{ +public: + String^ Url; + int Add( int /*a*/, int /*b*/ ) + { + return 0; + } +}; + +// Structure added so sample will compile +public value struct myNum +{ +public: + String^ Text; +}; + +public ref class Sample +{ +public: + void sampleFunction() + { + myMath^ math = gcnew myMath; + myNum Num1 = myNum( ); + myNum Num2 = myNum( ); + + // + // Set the URL property to a different Web server than that described in the + // service description. + math->Url = "http://www.contoso.com/math.asmx"; + int total = math->Add( Convert::ToInt32( Num1.Text ), Convert::ToInt32( Num2.Text ) ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp new file mode 100644 index 00000000000..bfcfe422816 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic WebProxy Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Http; + +public ref class Sample +{ +private: + void sampleFunction() + { + // + WebProxy^ proxyObject = gcnew WebProxy("http://proxyserver:80/", true); + + // HttpClient lifecycle management best practices: + // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use + HttpClientHandler^ handler = gcnew HttpClientHandler(); + handler->Proxy = proxyObject; + HttpClient^ client = gcnew HttpClient(handler); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp new file mode 100644 index 00000000000..2a706abc691 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using + +using namespace System; +using namespace System::Net; + +public ref class Sample +{ +private: + void sampleFunction() + { + // + // Initialize the WebRequest. + WebRequest^ myRequest = WebRequest::Create( "http://www.contoso.com" ); + + // Return the response. + WebResponse^ myResponse = myRequest->GetResponse(); + + // Code to use the WebResponse goes here. + + // Close the response to free resources. + myResponse->Close(); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp new file mode 100644 index 00000000000..ef3028f80a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic WebRequest.WebRequest Example/CPP/source.cpp @@ -0,0 +1,15 @@ +#using + +using namespace System; +using namespace System::Net; + +public ref class Sample +{ +private: + void sampleFunction() + { + // + WebRequest^ myRequest = WebRequest::Create( "http://www.contoso.com" ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..557ea7d00c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAnyElementAttribute Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class XClass +{ +public: + + /* Apply the XmlAnyElementAttribute to a field returning an array + of XmlElement objects. */ + + [XmlAnyElement] + array^AllElements; +}; + +public ref class Test +{ +public: + void DeserializeObject( String^ filename ) + { + // Create an XmlSerializer. + XmlSerializer^ mySerializer = gcnew XmlSerializer( XClass::typeid ); + + // To read a file, a FileStream is needed. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + + // Deserialize the class. + XClass^ x = dynamic_cast(mySerializer->Deserialize( fs )); + + // Read the element names and values. + System::Collections::IEnumerator^ myEnum = x->AllElements->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + XmlElement^ xel = safe_cast(myEnum->Current); + Console::WriteLine( "{0}: {1}", xel->LocalName, xel->Value ); + } + } +}; + +int main() +{ + Test^ t = gcnew Test; + t->DeserializeObject( "XFile.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..7824f3ba5cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute Example/CPP/source.cpp @@ -0,0 +1,132 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; +public ref class Item +{ +public: + + [XmlElement(ElementName="OrderItem")] + String^ ItemName; + String^ ItemCode; + Decimal ItemPrice; + int ItemQuantity; +}; + +public ref class BookItem: public Item +{ +public: + String^ Title; + String^ Author; + String^ ISBN; +}; + +// This is the class that will be serialized. +public ref class MyRootClass +{ +private: + array^items; + +public: + + /* Here is a simple way to serialize the array as XML. Using the + XmlArrayAttribute, assign an element name and namespace. The + IsNullable property determines whether the element will be + generated if the field is set to a null value. If set to true, + the default, setting it to a null value will cause the XML + xsi:null attribute to be generated. */ + + [XmlArray(ElementName="MyStrings", + Namespace="http://www.cpandl.com",IsNullable=true)] + array^MyStringArray; + + /* Here is a more complex example of applying an + XmlArrayAttribute. The Items property can contain both Item + and BookItem objects. Use the XmlArrayItemAttribute to specify + that both types can be inserted into the array. */ + [XmlArrayItem(ElementName="Item", + IsNullable=true, + Type=Item::typeid, + Namespace="http://www.cpandl.com"), + XmlArrayItem(ElementName="BookItem", + IsNullable=true, + Type=BookItem::typeid, + Namespace="http://www.cohowinery.com")] + [XmlArray] + property array^ Items + { + array^ get() + { + return items; + } + + void set( array^value ) + { + items = value; + } + } +}; + +public ref class Run +{ +public: + void SerializeDocument( String^ filename ) + { + // Creates a new XmlSerializer. + XmlSerializer^ s = gcnew XmlSerializer( MyRootClass::typeid ); + + // Writing the file requires a StreamWriter. + TextWriter^ myWriter = gcnew StreamWriter( filename ); + + // Creates an instance of the class to serialize. + MyRootClass^ myRootClass = gcnew MyRootClass; + + /* Uses a basic method of creating an XML array: Create and + populate a string array, and assign it to the + MyStringArray property. */ + array^myString = {"Hello","world","!"}; + myRootClass->MyStringArray = myString; + + /* Uses a more advanced method of creating an array: + create instances of the Item and BookItem, where BookItem + is derived from Item. */ + Item^ item1 = gcnew Item; + BookItem^ item2 = gcnew BookItem; + + // Sets the objects' properties. + item1->ItemName = "Widget1"; + item1->ItemCode = "w1"; + item1->ItemPrice = 231; + item1->ItemQuantity = 3; + item2->ItemCode = "w2"; + item2->ItemPrice = 123; + item2->ItemQuantity = 7; + item2->ISBN = "34982333"; + item2->Title = "Book of Widgets"; + item2->Author = "John Smith"; + + // Fills the array with the items. + array^myItems = {item1,item2}; + + // Sets the class's Items property to the array. + myRootClass->Items = myItems; + + /* Serializes the class, writes it to disk, and closes + the TextWriter. */ + s->Serialize( myWriter, myRootClass ); + myWriter->Close(); + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeDocument( "books.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp new file mode 100644 index 00000000000..dc6cfc478ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.ElementName Example/CPP/source.cpp @@ -0,0 +1,62 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Book +{ +public: + String^ Title; + String^ Author; + String^ ISBN; +}; + +public ref class Library +{ +private: + array^books; + +public: + + [XmlArray(ElementName="My_Books")] + property array^ Books + { + array^ get() + { + return books; + } + + void set( array^value ) + { + books = value; + } + } +}; + +int main() +{ + String^ filename = "ArrayExample.xml"; + XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid ); + TextWriter^ t = gcnew StreamWriter( filename ); + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + ns->Add( "bk", "http://wwww.contoso.com" ); + Book^ b1 = gcnew Book; + b1->Title = "MyBook Title"; + b1->Author = "An Author"; + b1->ISBN = "00000000"; + Book^ b2 = gcnew Book; + b2->Title = "Another Title"; + b2->Author = "Another Author"; + b2->ISBN = "0000000"; + Library^ myLibrary = gcnew Library; + array^myBooks = {b1,b2}; + myLibrary->Books = myBooks; + mySerializer->Serialize( t, myLibrary, ns ); + t->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp new file mode 100644 index 00000000000..84965bcbf7a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Form Example/CPP/source.cpp @@ -0,0 +1,111 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; +public ref class Winery +{ +public: + String^ Name; +}; + +public ref class VacationCompany +{ +public: + String^ Name; +}; + +public ref class Enterprises +{ +private: + array^wineries; + array^companies; + +public: + + // Sets the Form property to qualified, and specifies the namespace. + [XmlArray(Form=XmlSchemaForm::Qualified,ElementName="Company", + Namespace="http://www.cohowinery.com")] + property array^ Wineries + { + array^ get() + { + return wineries; + } + void set( array^value ) + { + wineries = value; + } + } + + [XmlArray(Form=XmlSchemaForm::Qualified,ElementName="Company", + Namespace="http://www.treyresearch.com")] + property array^ Companies + { + array^ get() + { + return companies; + } + void set( array^value ) + { + companies = value; + } + } +}; + +int main() +{ + String^ filename = "MyEnterprises.xml"; + + // Creates an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Enterprises::typeid ); + + // Writing file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Creates an instance of the XmlSerializerNamespaces class. + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + + // Adds namespaces and prefixes for the XML document instance. + ns->Add( "winery", "http://www.cohowinery.com" ); + ns->Add( "vacationCompany", "http://www.treyresearch.com" ); + + // Creates an instance of the class that will be serialized. + Enterprises^ myEnterprises = gcnew Enterprises; + + // Creates objects and adds to the array. + Winery^ w1 = gcnew Winery; + w1->Name = "cohowinery"; + array^myWinery = {w1}; + myEnterprises->Wineries = myWinery; + VacationCompany^ com1 = gcnew VacationCompany; + com1->Name = "adventure-works"; + array^myCompany = {com1}; + myEnterprises->Companies = myCompany; + + // Serializes the class, and closes the TextWriter. + mySerializer->Serialize( writer, myEnterprises, ns ); + writer->Close(); +} + +void ReadEnterprises( String^ filename ) +{ + XmlSerializer^ mySerializer = gcnew XmlSerializer( Enterprises::typeid ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Enterprises^ myEnterprises = dynamic_cast(mySerializer->Deserialize( fs )); + for ( int i = 0; i < myEnterprises->Wineries->Length; i++ ) + { + Console::WriteLine( myEnterprises->Wineries[ i ]->Name ); + } + for ( int i = 0; i < myEnterprises->Companies->Length; i++ ) + { + Console::WriteLine( myEnterprises->Companies[ i ]->Name ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp new file mode 100644 index 00000000000..b04f9de845e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.IsNullable Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class MyClass +{ +public: + + [XmlArray(IsNullable=true)] + array^IsNullableIsTrueArray; + + [XmlArray(IsNullable=false)] + array^IsNullableIsFalseArray; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp new file mode 100644 index 00000000000..ffc20656b48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.Namespace Example/CPP/source.cpp @@ -0,0 +1,162 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Book +{ +public: + String^ Title; + String^ Author; + String^ ISBN; + + [XmlAttributeAttribute] + String^ Publisher; +}; + +public ref class Periodical +{ +private: + String^ title; + +public: + + property String^ Title + { + String^ get() + { + return title; + } + void set( String^ value ) + { + title = value; + } + } +}; + +public ref class Library +{ +private: + array^books; + array^periodicals; + +public: + + /* This element will be qualified with the prefix + that is associated with the namespace http://wwww.cpandl.com. */ + [XmlArray(ElementName="Titles", + Namespace="http://wwww.cpandl.com")] + property array^ Books + { + array^ get() + { + return books; + } + void set( array^value ) + { + books = value; + } + } + + /* This element will be qualified with the prefix that is + associated with the namespace http://www.proseware.com. */ + [XmlArray(ElementName="Titles",Namespace= + "http://www.proseware.com")] + property array^ Periodicals + { + array^ get() + { + return periodicals; + } + void set( array^value ) + { + periodicals = value; + } + } +}; + +void WriteBook( String^ filename ) +{ + // Creates a new XmlSerializer. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid ); + + // Writing the file requires a StreamWriter. + TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); + + /* Creates an XmlSerializerNamespaces and adds prefixes and + namespaces to be used. */ + XmlSerializerNamespaces^ myNamespaces = gcnew XmlSerializerNamespaces; + myNamespaces->Add( "books", "http://wwww.cpandl.com" ); + myNamespaces->Add( "magazines", "http://www.proseware.com" ); + + // Creates an instance of the class to be serialized. + Library^ myLibrary = gcnew Library; + + // Creates two book objects. + Book^ b1 = gcnew Book; + b1->Title = "My Book Title"; + b1->Author = "An Author"; + b1->ISBN = "000000000"; + b1->Publisher = "Microsoft Press"; + Book^ b2 = gcnew Book; + b2->Title = "Another Book Title"; + b2->Author = "Another Author"; + b2->ISBN = "00000001"; + b2->Publisher = "Another Press"; + + /* Creates an array using the objects, and sets the Books property + to the array. */ + array^myBooks = {b1,b2}; + myLibrary->Books = myBooks; + + // Creates two Periodical objects. + Periodical^ per1 = gcnew Periodical; + per1->Title = "My Magazine Title"; + Periodical^ per2 = gcnew Periodical; + per2->Title = "Another Magazine Title"; + + // Sets the Periodicals property to the array. + array^myPeridocials = {per1,per2}; + myLibrary->Periodicals = myPeridocials; + + // Serializes the myLibrary object. + mySerializer->Serialize( myStreamWriter, myLibrary, myNamespaces ); + myStreamWriter->Close(); +} + +void ReadBook( String^ filename ) +{ + /* Creates an instance of an XmlSerializer + with the class used to read the document. */ + XmlSerializer^ mySerializer = gcnew XmlSerializer( Library::typeid ); + + // A FileStream is needed to read the file. + FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); + Library^ myLibrary = dynamic_cast(mySerializer->Deserialize( myFileStream )); + + // Reads each book in the array returned by the Books property. + for ( int i = 0; i < myLibrary->Books->Length; i++ ) + { + Console::WriteLine( myLibrary->Books[ i ]->Title ); + Console::WriteLine( myLibrary->Books[ i ]->Author ); + Console::WriteLine( myLibrary->Books[ i ]->ISBN ); + Console::WriteLine( myLibrary->Books[ i ]->Publisher ); + Console::WriteLine(); + } + for ( int i = 0; i < myLibrary->Periodicals->Length; i++ ) + { + Console::WriteLine( myLibrary->Periodicals[ i ]->Title ); + } +} + +int main() +{ + WriteBook( "MyLibrary.xml" ); + ReadBook( "MyLibrary.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..78a6040f3fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class MyClass +{ +public: + + [XmlArrayAttribute] + array^MyStringArray; + + [XmlArrayAttribute] + array^MyIntegerArray; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp new file mode 100644 index 00000000000..9b68919eff8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayAttribute.XmlArrayAttribute1 Example/CPP/source.cpp @@ -0,0 +1,48 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class MyClass +{ +public: + + [XmlArrayAttribute("MyStrings")] + array^MyStringArray; + + [XmlArrayAttribute(ElementName="MyIntegers")] + array^MyIntegerArray; +}; + +int main() +{ + String^ filename = "MyClass.xml"; + + // Creates a new instance of the XmlSerializer class. + XmlSerializer^ s = gcnew XmlSerializer( MyClass::typeid ); + + // Needs a StreamWriter to write the file. + TextWriter^ myWriter = gcnew StreamWriter( filename ); + MyClass^ myClass = gcnew MyClass; + + // Creates and populates a string array, then assigns + // it to the MyStringArray property. + array^myStrings = {"Hello","World","!"}; + myClass->MyStringArray = myStrings; + + /* Creates and populates an integer array, and assigns + it to the MyIntegerArray property. */ + array^myIntegers = {1,2,3}; + myClass->MyIntegerArray = myIntegers; + + // Serializes the class, and writes it to disk. + s->Serialize( myWriter, myClass ); + myWriter->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..7504aad63a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute Example/CPP/source.cpp @@ -0,0 +1,93 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +public ref class Employee +{ +public: + String^ Name; +}; + +public ref class Manager: public Employee +{ +public: + int Level; +}; + +public ref class Group +{ +public: + + /* The XmlArrayItemAttribute allows the XmlSerializer to insert + both the base type (Employee) and derived type (Manager) + into serialized arrays. */ + + [XmlArrayItem(Manager::typeid), + XmlArrayItem(Employee::typeid)] + array^Employees; + + /* Use the XmlArrayItemAttribute to specify types allowed + in an array of Object items. */ + + [XmlArray] + [XmlArrayItem(Int32::typeid, + ElementName="MyNumber"), + XmlArrayItem(String::typeid, + ElementName="MyString"), + XmlArrayItem(Manager::typeid)] + array^ExtraInfo; +}; + +void SerializeObject( String^ filename ) +{ + // Creates a new XmlSerializer. + XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); + + // Writing the XML file to disk requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + Group^ group = gcnew Group; + Manager^ manager = gcnew Manager; + Employee^ emp1 = gcnew Employee; + Employee^ emp2 = gcnew Employee; + manager->Name = "Consuela"; + manager->Level = 3; + emp1->Name = "Seiko"; + emp2->Name = "Martina"; + array^emps = {manager,emp1,emp2}; + group->Employees = emps; + + // Creates an int and a string and assigns to ExtraInfo. + array^temp = {43,"Extra",manager}; + group->ExtraInfo = temp; + + // Serializes the object, and closes the StreamWriter. + s->Serialize( writer, group ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + XmlSerializer^ x = gcnew XmlSerializer( Group::typeid ); + Group^ g = dynamic_cast(x->Deserialize( fs )); + Console::WriteLine( "Members:" ); + System::Collections::IEnumerator^ myEnum = g->Employees->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Employee^ e = safe_cast(myEnum->Current); + Console::WriteLine( "\t{0}", e->Name ); + } +} + +int main() +{ + SerializeObject( "TypeDoc.xml" ); + DeserializeObject( "TypeDoc.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp new file mode 100644 index 00000000000..1ad1f494f35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.ElementName Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +// By default, this class results in XML elements named "Vehicle". +public ref class Vehicle +{ +public: + String^ id; +}; + +// By default, this class results in XML elements named "Car". +public ref class Car: public Vehicle +{ +public: + String^ Maker; +}; + +public ref class Transportation +{ +public: + + /* Specifies acceptable types and the ElementName generated + for each object type. */ + + [XmlArray("Vehicles")] + [XmlArrayItem(Vehicle::typeid,ElementName="Transport"), + XmlArrayItem(Car::typeid,ElementName="Automobile")] + array^MyVehicles; +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp new file mode 100644 index 00000000000..6f0101ea001 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Form Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; + +// +public ref class Vehicle +{ +public: + String^ id; +}; + +public ref class Car: public Vehicle +{ +public: + String^ Maker; +}; + +public ref class Transportation +{ +public: + + // Specifies the Form property value. + + [XmlArray("Vehicles")] + [XmlArrayItem(Vehicle::typeid, + Form=XmlSchemaForm::Unqualified), + XmlArrayItem(Car::typeid, + Form=XmlSchemaForm::Qualified)] + array^MyVehicles; +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp new file mode 100644 index 00000000000..10b3c35b2f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.IsNullable Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +public ref class Employee +{ +public: + String^ Name; +}; + +public ref class Manager: public Employee +{ +public: + int Level; +}; + +public ref class Group +{ +public: + + [XmlArray(IsNullable=true)] + [XmlArrayItem(Manager::typeid,IsNullable=false), + XmlArrayItem(Employee::typeid,IsNullable=false)] + array^Employees; +}; + +void SerializeObject( String^ filename ) +{ + XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); + + // To write the file, a TextWriter is required. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Creates the object to serialize. + Group^ group = gcnew Group; + + // Creates a null Manager object. + Manager^ mgr = nullptr; + + // Creates a null Employee object. + Employee^ y = nullptr; + array^temp = {mgr,y}; + group->Employees = temp; + + // Serializes the object and closes the TextWriter. + s->Serialize( writer, group ); + writer->Close(); +} + +int main() +{ + SerializeObject( "TypeDoc.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp new file mode 100644 index 00000000000..41cc05bd344 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Namespace Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Vehicle{}; + +public ref class Car: public Vehicle{}; + +// +public ref class Transportation +{ +public: + + // Sets the Namespace property. + + [XmlArrayItem(Car::typeid,Namespace="http://www.cpandl.com")] + array^MyVehicles; +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp new file mode 100644 index 00000000000..b249fa9707c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.Type Example/CPP/source.cpp @@ -0,0 +1,59 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +public ref class Person +{ +public: + String^ Name; +}; + +public ref class Manager: public Person +{ +public: + int Rank; +}; + +public ref class Group +{ +public: + + /* The Type property instructs the XmlSerializer to accept both + the Person and Manager types in the array. */ + + [XmlArrayItem(Type=Manager::typeid), + XmlArrayItem(Type=Person::typeid)] + array^Staff; +}; + +void SerializeOrder( String^ filename ) +{ + // Creates an XmlSerializer. + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid ); + + // Creates the Group object, and two array items. + Group^ myGroup = gcnew Group; + Person^ p1 = gcnew Person; + p1->Name = "Jacki"; + Manager^ p2 = gcnew Manager; + p2->Name = "Megan"; + p2->Rank = 2; + array^myStaff = {p1,p2}; + myGroup->Staff = myStaff; + + // Serializes the object, and closes the StreamWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myGroup ); +} + +int main() +{ + SerializeOrder( "TypeEx.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..153e7b6e3d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute Example/CPP/source.cpp @@ -0,0 +1,75 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Vehicle +{ +public: + String^ id; +}; + +public ref class Car: public Vehicle +{ +public: + String^ Maker; +}; + +public ref class Transportation +{ +public: + + [XmlArrayItem, + XmlArrayItem(Car::typeid,ElementName="Automobile")] + array^MyVehicles; +}; + +void SerializeObject( String^ filename ) +{ + // Creates an XmlSerializer for the Transportation class. + XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); + + // Writing the XML file to disk requires a TextWriter. + TextWriter^ myTextWriter = gcnew StreamWriter( filename ); + + // Creates the object to serialize. + Transportation^ myTransportation = gcnew Transportation; + + // Creates objects to add to the array. + Vehicle^ myVehicle = gcnew Vehicle; + myVehicle->id = "A12345"; + Car^ myCar = gcnew Car; + myCar->id = "Car 34"; + myCar->Maker = "FamousCarMaker"; + array^temp = {myVehicle,myCar}; + myTransportation->MyVehicles = temp; + + // Serializes the object, and closes the StreamWriter. + MySerializer->Serialize( myTextWriter, myTransportation ); + myTextWriter->Close(); +} + +void DeserializeObject( String^ filename ) +{ + // Creates an XmlSerializer instance. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); + FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); + Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); + for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) + { + Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); + } +} + +int main() +{ + SerializeObject( "XmlArrayItem1.xml" ); + DeserializeObject( "XmlArrayItem1.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp new file mode 100644 index 00000000000..27560a12758 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute1 Example/CPP/source.cpp @@ -0,0 +1,71 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Vehicle +{ +public: + String^ id; +}; + +public ref class Car: public Vehicle +{ +public: + String^ Maker; +}; + +public ref class Transportation +{ +public: + + [XmlArrayItem(ElementName="Transportation"), + XmlArrayItem(Car::typeid,ElementName="Automobile")] + array^MyVehicles; +}; + +void SerializeObject( String^ filename ) +{ + // Creates an XmlSerializer for the Transportation class. + XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); + + // Writing the XML file to disk requires a TextWriter. + TextWriter^ myTextWriter = gcnew StreamWriter( filename ); + Transportation^ myTransportation = gcnew Transportation; + Vehicle^ myVehicle = gcnew Vehicle; + myVehicle->id = "A12345"; + Car^ myCar = gcnew Car; + myCar->id = "Car 34"; + myCar->Maker = "FamousCarMaker"; + array^myVehicles = {myVehicle,myCar}; + myTransportation->MyVehicles = myVehicles; + + // Serializes the object, and closes the StreamWriter. + MySerializer->Serialize( myTextWriter, myTransportation ); + myTextWriter->Close(); +} + +void DeserializeObject( String^ filename ) +{ + // Creates the serializer with the type to deserialize. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); + FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); + Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); + for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) + { + Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); + } +} + +int main() +{ + SerializeObject( "XmlArrayItem2.xml" ); + DeserializeObject( "XmlArrayItem2.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp new file mode 100644 index 00000000000..8809b40c0af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute2 Example/CPP/source.cpp @@ -0,0 +1,71 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Vehicle +{ +public: + String^ id; +}; + +public ref class Car: public Vehicle +{ +public: + String^ Maker; +}; + +public ref class Transportation +{ +public: + + [XmlArrayItem(Vehicle::typeid), + XmlArrayItem(Car::typeid)] + array^MyVehicles; +}; + +void SerializeObject( String^ filename ) +{ + // Creates an XmlSerializer. + XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); + + // Writing the XML file to disk requires a TextWriter. + TextWriter^ myTextWriter = gcnew StreamWriter( filename ); + Transportation^ myTransportation = gcnew Transportation; + Vehicle^ myVehicle = gcnew Vehicle; + myVehicle->id = "A12345"; + Car^ myCar = gcnew Car; + myCar->id = "Car 34"; + myCar->Maker = "FamousCarMaker"; + array^myVehicles = {myVehicle,myCar}; + myTransportation->MyVehicles = myVehicles; + + // Serializes the object, and closes the StreamWriter. + MySerializer->Serialize( myTextWriter, myTransportation ); + myTextWriter->Close(); +} + +void DeserializeObject( String^ filename ) +{ + // Creates the serializer with the type to deserialize. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); + FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); + Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); + for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) + { + Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); + } +} + +int main() +{ + SerializeObject( "XmlArrayItem3.xml" ); + DeserializeObject( "XmlArrayItem3.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp new file mode 100644 index 00000000000..6886a80fe91 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlArrayItemAttribute.XmlArrayItemAttribute3 Example/CPP/source.cpp @@ -0,0 +1,72 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Vehicle +{ +public: + String^ id; +}; + +public ref class Car: public Vehicle +{ +public: + String^ Maker; +}; + +public ref class Transportation +{ +public: + + [XmlArray] + [XmlArrayItem("Transport",Vehicle::typeid), + XmlArrayItem("Automobile",Car::typeid)] + array^MyVehicles; +}; + +void SerializeObject( String^ filename ) +{ + // Creates an XmlSerializer for the Transportation class. + XmlSerializer^ MySerializer = gcnew XmlSerializer( Transportation::typeid ); + + // Writing the XML file to disk requires a TextWriter. + TextWriter^ myTextWriter = gcnew StreamWriter( filename ); + Transportation^ myTransportation = gcnew Transportation; + Vehicle^ myVehicle = gcnew Vehicle; + myVehicle->id = "A12345"; + Car^ myCar = gcnew Car; + myCar->id = "Car 34"; + myCar->Maker = "FamousCarMaker"; + array^myVehicles = {myVehicle,myCar}; + myTransportation->MyVehicles = myVehicles; + + // Serializes the object, and closes the StreamWriter. + MySerializer->Serialize( myTextWriter, myTransportation ); + myTextWriter->Close(); +} + +void DeserializeObject( String^ filename ) +{ + // Creates an XmlSerializer. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Transportation::typeid ); + FileStream^ myFileStream = gcnew FileStream( filename,FileMode::Open ); + Transportation^ myTransportation = dynamic_cast(mySerializer->Deserialize( myFileStream )); + for ( int i = 0; i < myTransportation->MyVehicles->Length; i++ ) + { + Console::WriteLine( myTransportation->MyVehicles[ i ]->id ); + } +} + +int main() +{ + SerializeObject( "XmlArrayItem4.xml" ); + DeserializeObject( "XmlArrayItem4.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..ded3d3f240a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute Example/CPP/source.cpp @@ -0,0 +1,54 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Schema; + +public ref class Group +{ +public: + + [XmlAttributeAttribute(Namespace="http://www.cpandl.com")] + String^ GroupName; + + [XmlAttributeAttribute(DataType="base64Binary")] + array^GroupNumber; + + [XmlAttributeAttribute(DataType="date",AttributeName="CreationDate")] + DateTime Today; +}; + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + myGroup->GroupName = ".NET"; + array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )}; + myGroup->GroupNumber = hexByte; + DateTime myDate = DateTime(2001,1,10); + myGroup->Today = myDate; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); +} + +int main() +{ + SerializeObject( "Attributes.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp new file mode 100644 index 00000000000..bf8889f6772 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.AttributeName Example/CPP/source.cpp @@ -0,0 +1,65 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Group +{ +public: + + // Change the XML attribute name. + + [XmlAttributeAttribute(AttributeName="MgrName")] + String^ Name; + /* Use the AttributeName to collect all the XML attributes + in the XML-document instance. */ +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Serializing" ); + + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + /* Set the Name property, which will be generated + as an XML attribute. */ + myGroup->Name = "Wallace"; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + Console::WriteLine( "Deserializing" ); + XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); + Console::WriteLine( myGroup->Name ); +} + +int main() +{ + /* To use the AttributeName to collect all the + XML attributes. Call SerializeObject to generate + an XML document and alter the document by adding + new XML attributes to it. Then comment out the SerializeObject + method, and call DeserializeObject. */ + SerializeObject( "MyAtts.xml" ); + DeserializeObject( "MyAtts.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp new file mode 100644 index 00000000000..dbc9a73c48f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.DataType Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class Group +{ +public: + + [XmlAttributeAttribute(DataType="string")] + String^ Name; + + [XmlAttributeAttribute(DataType="base64Binary")] + array^Hex64Code; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp new file mode 100644 index 00000000000..37de504e9b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Form Example/CPP/source.cpp @@ -0,0 +1,23 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; + +// +public ref class Vehicle +{ +public: + + [XmlAttributeAttribute(Form=XmlSchemaForm::Qualified)] + String^ Maker; + + [XmlAttributeAttribute(Form=XmlSchemaForm::Unqualified)] + String^ ModelID; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp new file mode 100644 index 00000000000..8cd4fd710f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeAttribute.Namespace Example/CPP/source.cpp @@ -0,0 +1,22 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class Car +{ +public: + + [XmlAttributeAttribute(Namespace="Make")] + String^ MakerName; + + [XmlAttributeAttribute(Namespace="Model")] + String^ ModelName; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp new file mode 100644 index 00000000000..4dc40d33dd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void serializer_UnknownAttribute( Object^ /*sender*/, XmlAttributeEventArgs^ e ) + { + System::Xml::XmlAttribute^ attr = e->Attr; + Console::WriteLine( "Unknown Attribute Name and Value: {0} = '{1}'", + attr->Name, attr->Value ); + Object^ x = e->ObjectBeingDeserialized; + Console::WriteLine( "ObjectBeingDeserialized: {0}", x ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp new file mode 100644 index 00000000000..5d23724e8ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides Example/CPP/source.cpp @@ -0,0 +1,113 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +public ref class Instrument +{ +public: + String^ Name; +}; + +public ref class Brass: public Instrument +{ +public: + bool IsValved; +}; + +public ref class Orchestra +{ +public: + array^Instruments; +}; + +void SerializeObject( String^ filename ) +{ + /* Each overridden field, property, or type requires + an XmlAttributes object. */ + XmlAttributes^ attrs = gcnew XmlAttributes; + + /* Create an XmlElementAttribute to override the + field that returns Instrument objects. The overridden field + returns Brass objects instead. */ + XmlElementAttribute^ attr = gcnew XmlElementAttribute; + attr->ElementName = "Brass"; + attr->Type = Brass::typeid; + + // Add the element to the collection of elements. + attrs->XmlElements->Add( attr ); + + // Create the XmlAttributeOverrides object. + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + + /* Add the type of the class that contains the overridden + member and the XmlAttributes to override it with to the + XmlAttributeOverrides object. */ + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + + // Create the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create the object that will be serialized. + Orchestra^ band = gcnew Orchestra; + + // Create an object of the derived type. + Brass^ i = gcnew Brass; + i->Name = "Trumpet"; + i->IsValved = true; + array^myInstruments = {i}; + band->Instruments = myInstruments; + + // Serialize the object. + s->Serialize( writer, band ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + + // Create an XmlElementAttribute to override the Instrument. + XmlElementAttribute^ attr = gcnew XmlElementAttribute; + attr->ElementName = "Brass"; + attr->Type = Brass::typeid; + + // Add the XmlElementAttribute to the collection of objects. + attrs->XmlElements->Add( attr ); + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + + // Create the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Orchestra^ band = dynamic_cast(s->Deserialize( fs )); + Console::WriteLine( "Brass:" ); + + /* The difference between deserializing the overridden + XML document and serializing it is this: To read the derived + object values, you must declare an object of the derived type + (Brass), and cast the Instrument instance to it. */ + Brass^ b; + System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Instrument^ i = safe_cast(myEnum->Current); + b = dynamic_cast(i); + Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved ); + } +} + +int main() +{ + SerializeObject( "Override.xml" ); + DeserializeObject( "Override.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..e474a5694c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add Example/CPP/source.cpp @@ -0,0 +1,102 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +ref class Band; +ref class Instrument; + +/* This is the class that will be overridden. The XmlIncludeAttribute +tells the XmlSerializer that the overriding type exists. */ + +[XmlInclude(Band::typeid)] +public ref class Orchestra +{ +public: + array^Instruments; +}; + +// This is the overriding class. +public ref class Band: public Orchestra +{ +public: + String^ BandName; +}; + +public ref class Instrument +{ +public: + String^ Name; +}; + +void SerializeObject( String^ filename ) +{ + /* Each object that is being overridden requires + an XmlAttributes object. */ + XmlAttributes^ attrs = gcnew XmlAttributes; + + // An XmlRootAttribute allows overriding the Orchestra class. + XmlRootAttribute^ xmlRoot = gcnew XmlRootAttribute; + + // Set the object to the XmlAttribute.XmlRoot property. + attrs->XmlRoot = xmlRoot; + + // Create an XmlAttributeOverrides object. + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + + // Add the XmlAttributes to the XmlAttributeOverrrides. + attrOverrides->Add( Orchestra::typeid, attrs ); + + // Create the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create the object using the derived class. + Band^ band = gcnew Band; + band->BandName = "NewBand"; + + // Create an Instrument. + Instrument^ i = gcnew Instrument; + i->Name = "Trumpet"; + array^myInstruments = {i}; + band->Instruments = myInstruments; + + // Serialize the object. + s->Serialize( writer, band ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlRootAttribute^ attr = gcnew XmlRootAttribute; + attrs->XmlRoot = attr; + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + + // Deserialize the Band object. + Band^ band = dynamic_cast(s->Deserialize( fs )); + Console::WriteLine( "Brass:" ); + System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Instrument^ i = safe_cast(myEnum->Current); + Console::WriteLine( i->Name ); + } +} + +int main() +{ + SerializeObject( "Override.xml" ); + DeserializeObject( "Override.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp new file mode 100644 index 00000000000..ae9b594d0f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.Add1 Example/CPP/source.cpp @@ -0,0 +1,48 @@ + + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +// This is the class that will be serialized. +public ref class Group +{ +public: + String^ GroupName; + + [XmlAttributeAttribute] + int GroupCode; +}; + +public ref class Sample +{ +public: + XmlSerializer^ CreateOverrider() + { + // Create an XmlAttributeOverrides object. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Create an XmlAttributeAttribute to override the base class + object's XmlAttributeAttribute object. Give the overriding object + a new attribute name ("Code"). */ + XmlAttributeAttribute^ xAtt = gcnew XmlAttributeAttribute; + xAtt->AttributeName = "Code"; + + /* Create an instance of the XmlAttributes class and set the + XmlAttribute property to the XmlAttributeAttribute object. */ + XmlAttributes^ attrs = gcnew XmlAttributes; + attrs->XmlAttribute = xAtt; + + /* Add the XmlAttributes object to the XmlAttributeOverrides + and specify the type and member name to override. */ + xOver->Add( Group::typeid, "GroupCode", attrs ); + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); + return xSer; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp new file mode 100644 index 00000000000..d9d43cdf6b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this Example/CPP/source.cpp @@ -0,0 +1,47 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +// This is the class that will be serialized. +public ref class Group +{ +public: + String^ GroupName; + + [XmlAttributeAttribute] + int GroupCode; +}; + +public ref class Sample +{ +public: + XmlSerializer^ CreateOverrider() + { + // Create an XmlSerializer with overriding attributes. + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; + + // Set a new Namespace and ElementName for the root element. + xRoot->Namespace = "http://www.cpandl.com"; + xRoot->ElementName = "NewGroup"; + attrs->XmlRoot = xRoot; + xOver->Add( Group::typeid, attrs ); + + // Get the XmlAttributes object, based on the type. + XmlAttributes^ tempAttrs; + tempAttrs = xOver[ Group::typeid ]; + + // Print the Namespace and ElementName of the root. + Console::WriteLine( tempAttrs->XmlRoot->Namespace ); + Console::WriteLine( tempAttrs->XmlRoot->ElementName ); + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); + return xSer; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp new file mode 100644 index 00000000000..099c81b6664 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributeOverrides.this1 Example/CPP/source.cpp @@ -0,0 +1,52 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +// This is the class that will be serialized. +public ref class Group +{ +public: + String^ GroupName; + + [XmlAttributeAttribute] + int GroupCode; +}; + +public ref class Sample +{ +public: + XmlSerializer^ CreateOverrider() + { + // Create an XmlSerializer with overriding attributes. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Create an XmlAttributeAttribute object and set the + AttributeName property. */ + XmlAttributeAttribute^ xAtt = gcnew XmlAttributeAttribute; + xAtt->AttributeName = "Code"; + + /* Create a new XmlAttributes object and set the + XmlAttributeAttribute object to the XmlAttribute property. */ + XmlAttributes^ attrs = gcnew XmlAttributes; + attrs->XmlAttribute = xAtt; + + /* Add the XmlAttributes to the XmlAttributeOverrides object. The + name of the overridden attribute must be specified. */ + xOver->Add( Group::typeid, "GroupCode", attrs ); + + // Get the XmlAttributes object for the type and member. + XmlAttributes^ tempAttrs; + tempAttrs = xOver[Group::typeid, "GroupCode"]; + Console::WriteLine( tempAttrs->XmlAttribute->AttributeName ); + + // Create the XmlSerializer instance and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); + return xSer; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp new file mode 100644 index 00000000000..c0960e934fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArray Example/CPP/source.cpp @@ -0,0 +1,85 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Member +{ +public: + String^ MemberName; +}; + + +// This is the class that will be serialized. +public ref class Group +{ +public: + + // This field will be overridden. + array^Members; +}; + + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Creating XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + // Add an override for the XmlArray. + XmlArrayAttribute^ xArray = gcnew XmlArrayAttribute( "Staff" ); + xArray->Namespace = "http://www.cpandl.com"; + xAttrs->XmlArray = xArray; + xOver->Add( Group::typeid, "Members", xAttrs ); + + // Create the XmlSerializer and return it. + return gcnew XmlSerializer( Group::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + Member^ m = gcnew Member; + m->MemberName = "Paul"; + array^temp = {m}; + myGroup->Members = temp; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); + System::Collections::IEnumerator^ myEnum = myGroup->Members->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Member^ m = safe_cast(myEnum->Current); + Console::WriteLine( m->MemberName ); + } +} + +int main() +{ + SerializeObject( "OverrideArray.xml" ); + DeserializeObject( "OverrideArray.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp new file mode 100644 index 00000000000..d2aff93a0ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlArrayItems Example/CPP/source.cpp @@ -0,0 +1,107 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Member +{ +public: + String^ MemberName; +}; + +// This is the class that will be serialized. +public ref class Group +{ +public: + array^Members; +}; + +public ref class NewMember: public Member +{ +public: + int MemberID; +}; + +public ref class RetiredMember: public NewMember +{ +public: + DateTime RetireDate; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + // Add an override for the XmlArrayItem. + XmlArrayItemAttribute^ xArrayItem = gcnew XmlArrayItemAttribute( NewMember::typeid ); + xArrayItem->Namespace = "http://www.cpandl.com"; + xAttrs->XmlArrayItems->Add( xArrayItem ); + + // Add a second override. + XmlArrayItemAttribute^ xArrayItem2 = gcnew XmlArrayItemAttribute( RetiredMember::typeid ); + xArrayItem2->Namespace = "http://www.cpandl.com"; + xAttrs->XmlArrayItems->Add( xArrayItem2 ); + + // Add all overrides to XmlAttribueOverrides object. + xOver->Add( Group::typeid, "Members", xAttrs ); + + // Create the XmlSerializer and return it. + return gcnew XmlSerializer( Group::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + NewMember^ m = gcnew NewMember; + m->MemberName = "Paul"; + m->MemberID = 2; + + // Create a second member. + RetiredMember^ m2 = gcnew RetiredMember; + m2->MemberName = "Renaldo"; + m2->MemberID = 23; + m2->RetireDate = DateTime(2000,10,10); + array^temp = {m,m2}; + myGroup->Members = temp; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); + System::Collections::IEnumerator^ myEnum = myGroup->Members->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Member^ m = safe_cast(myEnum->Current); + Console::WriteLine( m->MemberName ); + } +} + +int main() +{ + SerializeObject( "OverrideArrayItem.xml" ); + DeserializeObject( "OverrideArrayItem.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..080d02f704e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttribute Example/CPP/source.cpp @@ -0,0 +1,78 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class Group +{ +public: + + // This is the attribute that will be overridden. + + [XmlAttributeAttribute] + String^ GroupName; + int GroupNumber; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + /* Create an overriding XmlAttributeAttribute set it to + the XmlAttribute property of the XmlAttributes object.*/ + XmlAttributeAttribute^ xAttribute = gcnew XmlAttributeAttribute( "SplinterName" ); + xAttrs->XmlAttribute = xAttribute; + + // Add to the XmlAttributeOverrides. Specify the member name. + xOver->Add( Group::typeid, "GroupName", xAttrs ); + + // Create the XmlSerializer and return it. + return gcnew XmlSerializer( Group::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + /* Set the Name property, which will be generated + as an XML attribute. */ + myGroup->GroupName = ".NET"; + myGroup->GroupNumber = 1; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); + Console::WriteLine( myGroup->GroupName ); + Console::WriteLine( myGroup->GroupNumber ); +} + +int main() +{ + SerializeObject( "OverrideAttribute.xml" ); + DeserializeObject( "OverrideAttribute.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..79e6e301177 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlAttributes Example/CPP/source.cpp @@ -0,0 +1,112 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +public ref class Instrument +{ +public: + String^ Name; +}; + +public ref class Brass: public Instrument +{ +public: + bool IsValved; +}; + +public ref class Orchestra +{ +public: + array^Instruments; +}; + +void SerializeObject( String^ filename ) +{ + /* Each overridden field, property, or type requires + an XmlAttributes object. */ + XmlAttributes^ attrs = gcnew XmlAttributes; + + /* Create an XmlElementAttribute to override the + field that returns Instrument objects. The overridden field + returns Brass objects instead. */ + XmlElementAttribute^ attr = gcnew XmlElementAttribute; + attr->ElementName = "Brass"; + attr->Type = Brass::typeid; + + // Add the element to the collection of elements. + attrs->XmlElements->Add( attr ); + + // Create the XmlAttributeOverrides object. + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + + /* Add the type of the class that contains the overridden + member and the XmlAttributes to override it with to the + XmlAttributeOverrides object. */ + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + + // Create the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create the object that will be serialized. + Orchestra^ band = gcnew Orchestra; + + // Create an object of the derived type. + Brass^ i = gcnew Brass; + i->Name = "Trumpet"; + i->IsValved = true; + array^myInstruments = {i}; + band->Instruments = myInstruments; + + // Serialize the object. + s->Serialize( writer, band ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + + // Create an XmlElementAttribute to override the Instrument. + XmlElementAttribute^ attr = gcnew XmlElementAttribute; + attr->ElementName = "Brass"; + attr->Type = Brass::typeid; + + // Add the element to the collection of elements. + attrs->XmlElements->Add( attr ); + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + + // Create the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Orchestra^ band = dynamic_cast(s->Deserialize( fs )); + Console::WriteLine( "Brass:" ); + + /* The difference between deserializing the overridden + XML document and serializing it is this: To read the derived + object values, you must declare an object of the derived type + (Brass), and cast the Instrument instance to it. */ + Brass^ b; + System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Instrument^ i = safe_cast(myEnum->Current); + b = dynamic_cast(i); + Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved ); + } +} + +int main() +{ + SerializeObject( "Override.xml" ); + DeserializeObject( "Override.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp new file mode 100644 index 00000000000..40f6a96deb7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlDefaultValue Example/CPP/source.cpp @@ -0,0 +1,88 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::ComponentModel; + +// This is the class that will be serialized. +public ref class Pet +{ +public: + + // The default value for the Animal field is "Dog". + + [DefaultValueAttribute("Dog")] + String^ Animal; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + // Add an override for the default value of the GroupName. + Object^ defaultAnimal = "Cat"; + xAttrs->XmlDefaultValue = defaultAnimal; + + // Add all the XmlAttributes to the XmlAttributeOverrides object. + xOver->Add( Pet::typeid, "Animal", xAttrs ); + + // Create the XmlSerializer and return it. + return gcnew XmlSerializer( Pet::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Pet^ myPet = gcnew Pet; + + /* Set the Animal property. If you set it to the default value, + which is "Cat" (the value assigned to the XmlDefaultValue + of the XmlAttributes object), no value will be serialized. + If you change the value to any other value (including "Dog"), + the value will be serialized. + */ + // The default value "Cat" will be assigned (nothing serialized). + myPet->Animal = ""; + + // Uncommenting the next line also results in the default + // value because Cat is the default value (not serialized). + // myPet.Animal = "Cat"; + // Uncomment the next line to see the value serialized: + // myPet.Animal = "fish"; + // This will also be serialized because Dog is not the + // default anymore. + // myPet.Animal = "Dog"; + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myPet ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Pet^ myPet = dynamic_cast(mySerializer->Deserialize( fs )); + Console::WriteLine( myPet->Animal ); +} + +int main() +{ + SerializeObject( "OverrideDefaultValue.xml" ); + DeserializeObject( "OverrideDefaultValue.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp new file mode 100644 index 00000000000..dc3a90e6177 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlElements Example/CPP/source.cpp @@ -0,0 +1,101 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Collections; +using namespace System::Xml; + +public ref class Car +{ +public: + String^ Name; +}; + +public ref class Plane +{ +public: + String^ Name; +}; + +public ref class Truck +{ +public: + String^ Name; +}; + +public ref class Train +{ +public: + String^ Name; +}; + +public ref class Transportation +{ +public: + + // Subsequent code overrides these two XmlElementAttributes. + + [XmlElement(Car::typeid), + XmlElement(Plane::typeid)] + ArrayList^ Vehicles; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributes and XmlAttributeOverrides objects. + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Create an XmlElementAttribute to override + the Vehicles property. */ + XmlElementAttribute^ xElement1 = gcnew XmlElementAttribute( Truck::typeid ); + + // Add the XmlElementAttribute to the collection. + attrs->XmlElements->Add( xElement1 ); + + /* Create a second XmlElementAttribute, and + add it to the collection. */ + XmlElementAttribute^ xElement2 = gcnew XmlElementAttribute( Train::typeid ); + attrs->XmlElements->Add( xElement2 ); + + /* Add the XmlAttributes to the XmlAttributeOverrides, + specifying the member to override. */ + xOver->Add( Transportation::typeid, "Vehicles", attrs ); + + // Create the XmlSerializer, and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver ); + return xSer; +} + +void SerializeObject( String^ filename ) +{ + // Create an XmlSerializer instance. + XmlSerializer^ xSer = CreateOverrider(); + + // Create the object and serialize it. + Transportation^ myTransportation = gcnew Transportation; + + /* Create two new override objects that can be + inserted into the array. */ + myTransportation->Vehicles = gcnew ArrayList; + Truck^ myTruck = gcnew Truck; + myTruck->Name = "MyTruck"; + Train^ myTrain = gcnew Train; + myTrain->Name = "MyTrain"; + myTransportation->Vehicles->Add( myTruck ); + myTransportation->Vehicles->Add( myTrain ); + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myTransportation ); +} + +int main() +{ + SerializeObject( "OverrideElement.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp new file mode 100644 index 00000000000..9b65599120b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlEnum Example/CPP/source.cpp @@ -0,0 +1,80 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public enum class FoodType +{ + // Subsequent code overrides these enumerations. + Low, High +}; + +// This is the class that will be serialized. +public ref class Food +{ +public: + FoodType Type; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + // Add an XmlEnumAttribute for the FoodType.Low enumeration. + XmlEnumAttribute^ xEnum = gcnew XmlEnumAttribute; + xEnum->Name = "Cold"; + xAttrs->XmlEnum = xEnum; + xOver->Add( FoodType::typeid, "Low", xAttrs ); + + // Add an XmlEnumAttribute for the FoodType.High enumeration. + xAttrs = gcnew XmlAttributes; + xEnum = gcnew XmlEnumAttribute; + xEnum->Name = "Hot"; + xAttrs->XmlEnum = xEnum; + xOver->Add( FoodType::typeid, "High", xAttrs ); + + // Create the XmlSerializer, and return it. + return gcnew XmlSerializer( Food::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Food^ myFood = gcnew Food; + + // Set the object properties. + myFood->Type = FoodType::High; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myFood ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Food^ myFood = dynamic_cast(mySerializer->Deserialize( fs )); + Console::WriteLine( myFood->Type ); +} + +int main() +{ + SerializeObject( "OverrideEnum.xml" ); + DeserializeObject( "OverrideEnum.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp new file mode 100644 index 00000000000..1f586f80547 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlIgnore Example/CPP/source.cpp @@ -0,0 +1,70 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class Group +{ +public: + + // The GroupName value will be serialized--unless it's overridden. + String^ GroupName; + + /* This field will be ignored when serialized-- + unless it's overridden. */ + + [XmlIgnoreAttribute] + String^ Comment; +}; + + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + + /* Setting XmlIgnore to false overrides the XmlIgnoreAttribute + applied to the Comment field. Thus it will be serialized.*/ + attrs->XmlIgnore = false; + xOver->Add( Group::typeid, "Comment", attrs ); + + /* Use the XmlIgnore to instruct the XmlSerializer to ignore + the GroupName instead. */ + attrs = gcnew XmlAttributes; + attrs->XmlIgnore = true; + xOver->Add( Group::typeid, "GroupName", attrs ); + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); + return xSer; +} + +void SerializeObject( String^ filename ) +{ + // Create an XmlSerializer instance. + XmlSerializer^ xSer = CreateOverrider(); + + // Create the object to serialize and set its properties. + Group^ myGroup = gcnew Group; + myGroup->GroupName = ".NET"; + myGroup->Comment = "My Comment..."; + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Serialize the object and close the TextWriter. + xSer->Serialize( writer, myGroup ); + writer->Close(); +} + +int main() +{ + SerializeObject( "IgnoreXml.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp new file mode 100644 index 00000000000..42c1f3a3503 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlRoot Example/CPP/source.cpp @@ -0,0 +1,70 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class Group +{ +public: + String^ GroupName; + + [XmlAttributeAttribute] + int GroupCode; +}; + +// Return an XmlSerializer for overriding attributes. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributes and XmlAttributeOverrides objects. + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; + + // Set a new Namespace and ElementName for the root element. + xRoot->Namespace = "http://www.cpandl.com"; + xRoot->ElementName = "NewGroup"; + attrs->XmlRoot = xRoot; + + /* Add the XmlAttributes object to the XmlAttributeOverrides. + No member name is needed because the whole class is + overridden. */ + xOver->Add( Group::typeid, attrs ); + + // Get the XmlAttributes object, based on the type. + XmlAttributes^ tempAttrs; + tempAttrs = xOver[ Group::typeid ]; + + // Print the Namespace and ElementName of the root. + Console::WriteLine( tempAttrs->XmlRoot->Namespace ); + Console::WriteLine( tempAttrs->XmlRoot->ElementName ); + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); + return xSer; +} + +void SerializeObject( String^ filename ) +{ + // Create the XmlSerializer using the CreateOverrider method. + XmlSerializer^ xSer = CreateOverrider(); + + // Create the object to serialize. + Group^ myGroup = gcnew Group; + myGroup->GroupName = ".NET"; + myGroup->GroupCode = 123; + + // To write the file, a TextWriter is required. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Serialize the object and close the TextWriter. + xSer->Serialize( writer, myGroup ); + writer->Close(); +} + +int main() +{ + SerializeObject( "OverrideRoot.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp new file mode 100644 index 00000000000..e2732ed2c57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlText Example/CPP/source.cpp @@ -0,0 +1,74 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class Group +{ +public: + String^ GroupName; + + // This field will be serialized as XML text. + String^ Comment; +}; + +// Return an XmlSerializer to be used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + /* Create an XmlTextAttribute and assign it to the XmlText + property. This instructs the XmlSerializer to treat the + Comment field as XML text. */ + XmlTextAttribute^ xText = gcnew XmlTextAttribute; + xAttrs->XmlText = xText; + xOver->Add( Group::typeid, "Comment", xAttrs ); + + // Create the XmlSerializer, and return it. + return gcnew XmlSerializer( Group::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + myGroup->GroupName = ".NET"; + myGroup->Comment = "Great Stuff!"; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); + Console::WriteLine( myGroup->GroupName ); + Console::WriteLine( myGroup->Comment ); +} + +int main() +{ + SerializeObject( "OverrideText.xml" ); + DeserializeObject( "OverrideText.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp new file mode 100644 index 00000000000..d2cccc13596 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlAttributes.XmlType Example/CPP/source.cpp @@ -0,0 +1,69 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +public ref class Car +{ +public: + int ID; +}; + +public ref class Transportation +{ +public: + array^Cars; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlAttributes and XmlAttributeOverrides objects. + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Create an XmlTypeAttribute and change the name of the + XML type. */ + XmlTypeAttribute^ xType = gcnew XmlTypeAttribute; + xType->TypeName = "Autos"; + + // Set the XmlTypeAttribute to the XmlType property. + attrs->XmlType = xType; + + /* Add the XmlAttributes to the XmlAttributeOverrides, + specifying the member to override. */ + xOver->Add( Car::typeid, attrs ); + + // Create the XmlSerializer, and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver ); + return xSer; +} + +void SerializeObject( String^ filename ) +{ + // Create an XmlSerializer instance. + XmlSerializer^ xSer = CreateOverrider(); + + // Create object and serialize it. + Transportation^ myTransportation = gcnew Transportation; + Car^ c1 = gcnew Car; + c1->ID = 12; + Car^ c2 = gcnew Car; + c2->ID = 44; + array^temp0 = {c1,c2}; + myTransportation->Cars = temp0; + + // To write the file, a TextWriter is required. + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myTransportation ); +} + +int main() +{ + SerializeObject( "XmlType.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..eea4fa29c6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute Example/CPP/source.cpp @@ -0,0 +1,115 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml::Serialization; +public ref class Employee +{ +public: + String^ Name; +}; + +public ref class Manager: public Employee +{ +public: + int Level; +}; + +public ref class Group +{ +public: + + /* Set the element name and namespace of the XML element. + By applying an XmlElementAttribute to an array, you instruct + the XmlSerializer to serialize the array as a series of XML + elements, instead of a nested set of elements. */ + + [XmlElement( + ElementName="Members", + Namespace="http://www.cpandl.com")] + array^Employees; + + [XmlElement(DataType="snippet1>", + ElementName="Building")] + double GroupID; + + [XmlElement(DataType="hexBinary")] + array^HexBytes; + + [XmlElement(DataType="boolean")] + bool IsActive; + + [XmlElement(Type=::Manager::typeid)] + Employee^ Manager; + + [XmlElement(Int32::typeid, + ElementName="ObjectNumber"), + XmlElement(String::typeid, + ElementName="ObjectString")] + ArrayList^ ExtraInfo; +}; + +void SerializeObject( String^ filename ) +{ + // Create the XmlSerializer. + XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); + + // To write the file, a TextWriter is required. + TextWriter^ writer = gcnew StreamWriter( filename ); + + /* Create an instance of the group to serialize, and set + its properties. */ + Group^ group = gcnew Group; + group->GroupID = 10.089f; + group->IsActive = false; + array^temp0 = {Convert::ToByte( 100 )}; + group->HexBytes = temp0; + Employee^ x = gcnew Employee; + Employee^ y = gcnew Employee; + x->Name = "Jack"; + y->Name = "Jill"; + array^temp1 = {x,y}; + group->Employees = temp1; + Manager^ mgr = gcnew Manager; + mgr->Name = "Sara"; + mgr->Level = 4; + group->Manager = mgr; + + /* Add a number and a string to the + ArrayList returned by the ExtraInfo property. */ + group->ExtraInfo = gcnew ArrayList; + group->ExtraInfo->Add( 42 ); + group->ExtraInfo->Add( "Answer" ); + + // Serialize the object, and close the TextWriter. + s->Serialize( writer, group ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + XmlSerializer^ x = gcnew XmlSerializer( Group::typeid ); + Group^ g = dynamic_cast(x->Deserialize( fs )); + Console::WriteLine( g->Manager->Name ); + Console::WriteLine( g->GroupID ); + Console::WriteLine( g->HexBytes[ 0 ] ); + IEnumerator^ myEnum = g->Employees->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Employee^ e = safe_cast(myEnum->Current); + Console::WriteLine( e->Name ); + } +} + +int main() +{ + SerializeObject( "FirstDoc.xml" ); + DeserializeObject( "FirstDoc.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp new file mode 100644 index 00000000000..dac3339b9d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.DataType Example/CPP/source.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml::Serialization; +public ref class Group +{ +public: + + /* Apply two XmlElementAttributes to the field. Set the DataType + to string an int to allow the ArrayList to accept + both types. The Namespace is also set to different values + for each type. */ + + [XmlElement(DataType="string", + Type=String::typeid, + Namespace="http://www.cpandl.com"), + XmlElement(DataType="snippet1>", + Namespace="http://www.cohowinery.com", + Type=Int32::typeid)] + ArrayList^ ExtraInfo; +}; + +void SerializeObject( String^ filename ) +{ + // A TextWriter is needed to write the file. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); + + // Create the object to serialize. + Group^ myGroup = gcnew Group; + + /* Add a string and an integer to the ArrayList returned + by the ExtraInfo field. */ + myGroup->ExtraInfo = gcnew ArrayList; + myGroup->ExtraInfo->Add( "hello" ); + myGroup->ExtraInfo->Add( 100 ); + + // Serialize the object and close the TextWriter. + s->Serialize( writer, myGroup ); + writer->Close(); +} + +int main() +{ + SerializeObject( "ElementTypes.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp new file mode 100644 index 00000000000..c73eab60f3b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.ElementName Example/CPP/source.cpp @@ -0,0 +1,20 @@ +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// +// This is the class that will be serialized. +public ref class XClass +{ +public: + /* The XML element name will be XName + instead of the default ClassName. */ + [XmlElement(ElementName="XName")] + String^ ClassName; +}; +// + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp new file mode 100644 index 00000000000..323a5e3febf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Form Example/CPP/source.cpp @@ -0,0 +1,20 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; + +// +public ref class MyClass +{ +public: + + [XmlElement(Form=XmlSchemaForm::Unqualified)] + String^ ClassName; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp new file mode 100644 index 00000000000..496244672df --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.IsNullable Example/CPP/source.cpp @@ -0,0 +1,19 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class MyClass +{ +public: + + [XmlElement(IsNullable=false)] + String^ Group; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp new file mode 100644 index 00000000000..217959b7fad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.Type Example/CPP/source.cpp @@ -0,0 +1,64 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Employee +{ +public: + String^ Name; +}; + +public ref class Manager: public Employee +{ +public: + int Level; +}; + +public ref class Group +{ +public: + + [XmlElement(Manager::typeid)] + array^Staff; + + [XmlElement(Int32::typeid), + XmlElement(String::typeid), + XmlElement(DateTime::typeid)] + ArrayList^ ExtraInfo; +}; + +void SerializeObject( String^ filename ) +{ + // Create an XmlSerializer instance. + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid ); + + // Create object and serialize it. + Group^ myGroup = gcnew Group; + Manager^ e1 = gcnew Manager; + e1->Name = "Manager1"; + Manager^ m1 = gcnew Manager; + m1->Name = "Manager2"; + m1->Level = 4; + array^emps = {e1,m1}; + myGroup->Staff = emps; + myGroup->ExtraInfo = gcnew ArrayList; + myGroup->ExtraInfo->Add( ".NET" ); + myGroup->ExtraInfo->Add( 42 ); + myGroup->ExtraInfo->Add( DateTime(2001,1,1) ); + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myGroup ); + writer->Close(); +} + +int main() +{ + SerializeObject( "TypeEx.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..f06647e1954 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute Example/CPP/source.cpp @@ -0,0 +1,19 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class MyClass +{ +public: + + [XmlElement] + String^ TeacherName; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp new file mode 100644 index 00000000000..a92464e29dc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute1 Example/CPP/source.cpp @@ -0,0 +1,19 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class Transportation +{ +public: + + [XmlElement("Cars")] + String^ Vehicles; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp new file mode 100644 index 00000000000..701b642c490 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttribute.XmlElementAttribute2 Example/CPP/source.cpp @@ -0,0 +1,96 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +public ref class Instrument +{ +public: + String^ Name; +}; + +public ref class Brass: public Instrument +{ +public: + bool IsValved; +}; + +public ref class Orchestra +{ +public: + array^Instruments; +}; + +void SerializeObject( String^ filename ) +{ + // To write the file, a TextWriter is required. + TextWriter^ writer = gcnew StreamWriter( filename ); + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + + // Creates an XmlElementAttribute that overrides the Instrument type. + XmlElementAttribute^ attr = gcnew XmlElementAttribute( Brass::typeid ); + attr->ElementName = "Brass"; + + // Adds the element to the collection of elements. + attrs->XmlElements->Add( attr ); + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + + // Creates the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + + // Creates the object to serialize. + Orchestra^ band = gcnew Orchestra; + + // Creates an object of the derived type. + Brass^ i = gcnew Brass; + i->Name = "Trumpet"; + i->IsValved = true; + array^myInstruments = {i}; + band->Instruments = myInstruments; + s->Serialize( writer, band ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + + // Creates an XmlElementAttribute that override the Instrument type. + XmlElementAttribute^ attr = gcnew XmlElementAttribute( Brass::typeid ); + attr->ElementName = "Brass"; + + // Adds the element to the collection of elements. + attrs->XmlElements->Add( attr ); + attrOverrides->Add( Orchestra::typeid, "Instruments", attrs ); + + // Creates the XmlSerializer using the XmlAttributeOverrides. + XmlSerializer^ s = gcnew XmlSerializer( Orchestra::typeid,attrOverrides ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Orchestra^ band = dynamic_cast(s->Deserialize( fs )); + Console::WriteLine( "Brass:" ); + + /* Deserializing differs from serializing. To read the + derived-object values, declare an object of the derived + type (Brass) and cast the Instrument instance to it. */ + Brass^ b; + System::Collections::IEnumerator^ myEnum = band->Instruments->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Instrument^ i = safe_cast(myEnum->Current); + b = dynamic_cast(i); + Console::WriteLine( "{0}\n{1}", b->Name, b->IsValved ); + } +} + +int main() +{ + SerializeObject( "Override.xml" ); + DeserializeObject( "Override.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp new file mode 100644 index 00000000000..000e548b46f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes Example/CPP/source.cpp @@ -0,0 +1,100 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Collections; +using namespace System::Xml; + +public ref class Car +{ +public: + String^ Name; +}; + +public ref class Plane +{ +public: + String^ Name; +}; + +public ref class Truck +{ +public: + String^ Name; +}; + +public ref class Train +{ +public: + String^ Name; +}; + +public ref class Transportation +{ +public: + + // Override these two XmlElementAttributes. + + [XmlElement(Car::typeid), + XmlElement(Plane::typeid)] + ArrayList^ Vehicles; +}; + +XmlSerializer^ CreateOverrider() +{ + // Create XmlAtrributes and XmlAttributeOverrides instances. + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Create an XmlElementAttributes object to override + one of the attributes applied to the Vehicles property. */ + XmlElementAttribute^ xElement1 = gcnew XmlElementAttribute( Truck::typeid ); + + // Add the XmlElementAttribute to the collection. + attrs->XmlElements->Add( xElement1 ); + + /* Create a second XmlElementAttribute and + add it to the collection. */ + XmlElementAttribute^ xElement2 = gcnew XmlElementAttribute( Train::typeid ); + attrs->XmlElements->Add( xElement2 ); + + /* Add the XmlAttributes to the XmlAttributeOverrides, + specifying the member to override. */ + xOver->Add( Transportation::typeid, "Vehicles", attrs ); + + // Create the XmlSerializer, and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( Transportation::typeid,xOver ); + return xSer; +} + +void SerializeObject( String^ filename ) +{ + // Create an XmlSerializer instance. + XmlSerializer^ xSer = CreateOverrider(); + + // Create the object. + Transportation^ myTransportation = gcnew Transportation; + + /* Create two new, overriding objects that can be + inserted into the Vehicles array. */ + myTransportation->Vehicles = gcnew ArrayList; + Truck^ myTruck = gcnew Truck; + myTruck->Name = "MyTruck"; + Train^ myTrain = gcnew Train; + myTrain->Name = "MyTrain"; + myTransportation->Vehicles->Add( myTruck ); + myTransportation->Vehicles->Add( myTrain ); + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myTransportation ); +} + +int main() +{ + SerializeObject( "OverrideElement.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..3933ca7d495 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlElementAttributes.Add Example/CPP/source.cpp @@ -0,0 +1,56 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Truck{ + // Class added so sample will compile +}; + +public ref class Train{ + // Class added so sample will compile +}; + +public ref class Transportation{ + // Class added so sample will compile +}; + +public ref class Sample +{ + // +public: + XmlSerializer^ CreateOverrider() + { + // Create XmlAttributes and XmlAttributeOverrides instances. + + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = + gcnew XmlAttributeOverrides; + + /* Create an XmlElementAttributes to override + the Vehicles property. */ + XmlElementAttribute^ xElement1 = + gcnew XmlElementAttribute( Truck::typeid ); + // Add the XmlElementAttribute to the collection. + attrs->XmlElements->Add( xElement1 ); + + /* Create a second XmlElementAttribute, and + add to the collection. */ + XmlElementAttribute^ xElement2 = + gcnew XmlElementAttribute( Train::typeid ); + attrs->XmlElements->Add( xElement2 ); + + /* Add the XmlAttributes to the XmlAttributeOverrides, + specifying the member to override. */ + xOver->Add( Transportation::typeid, "Vehicles", attrs ); + + // Create the XmlSerializer, and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( + Transportation::typeid,xOver ); + return xSer; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..b82f373dbe0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public enum class EmployeeStatus +{ + [XmlEnum(Name = "Single")] + One, + [XmlEnum(Name = "Double")] + Two, + [XmlEnum(Name = "Triple")] + Three +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..d494e993e3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.Name Example/CPP/source.cpp @@ -0,0 +1,21 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public enum class EmployeeStatus +{ + [XmlEnum("Single")] + One, + [XmlEnum("Double")] + Two, + [XmlEnum("Triple")] + Three +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..d7f0debeaec --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlEnumAttribute.XmlEnumAttribute Example/CPP/source.cpp @@ -0,0 +1,80 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public enum class FoodType +{ + // Subsequent code overrides these enumerations. + Low, High +}; + +// This is the class that will be serialized. +public ref class Food +{ +public: + FoodType Type; +}; + +// Return an XmlSerializer used for overriding. +XmlSerializer^ CreateOverrider() +{ + // Create the XmlOverrides and XmlAttributes objects. + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + XmlAttributes^ xAttrs = gcnew XmlAttributes; + + // Add an XmlEnumAttribute for the FoodType.Low enumeration. + XmlEnumAttribute^ xEnum = gcnew XmlEnumAttribute; + xEnum->Name = "Cold"; + xAttrs->XmlEnum = xEnum; + xOver->Add( FoodType::typeid, "Low", xAttrs ); + + // Add an XmlEnumAttribute for the FoodType.High enumeration. + xAttrs = gcnew XmlAttributes; + xEnum = gcnew XmlEnumAttribute; + xEnum->Name = "Hot"; + xAttrs->XmlEnum = xEnum; + xOver->Add( FoodType::typeid, "High", xAttrs ); + + // Create the XmlSerializer, and return it. + return gcnew XmlSerializer( Food::typeid,xOver ); +} + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrider(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Food^ myFood = gcnew Food; + + // Set the object properties. + myFood->Type = FoodType::High; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myFood ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = CreateOverrider(); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Food^ myFood = dynamic_cast(mySerializer->Deserialize( fs )); + Console::WriteLine( myFood->Type ); +} + +int main() +{ + SerializeObject( "OverrideEnum.xml" ); + DeserializeObject( "OverrideEnum.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..7298f812c7a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIgnoreAttribute.XmlIgnoreAttribute Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class Group +{ +public: + + // The XmlSerializer ignores this field. + + [XmlIgnore] + String^ Comment; + + // The XmlSerializer serializes this field. + String^ GroupName; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp new file mode 100644 index 00000000000..cbfdda004f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.Type Example/CPP/source.cpp @@ -0,0 +1,72 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +ref class Employee; + +ref class Manager; + +ref class Group +{ +public: + array^Employees; +}; + +// Instruct the XmlSerializer to accept Manager types as well. +[XmlInclude(Manager::typeid)] +public ref class Employee +{ +public: + String^ Name; +}; + +public ref class Manager: public Employee +{ +public: + int Level; +}; + +void SerializeObject( String^ filename ) +{ + XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); + TextWriter^ writer = gcnew StreamWriter( filename ); + Group^ group = gcnew Group; + Manager^ manager = gcnew Manager; + Employee^ emp1 = gcnew Employee; + Employee^ emp2 = gcnew Employee; + manager->Name = "Zeus"; + manager->Level = 2; + emp1->Name = "Ares"; + emp2->Name = "Artemis"; + array^emps = {manager,emp1,emp2}; + group->Employees = emps; + s->Serialize( writer, group ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + XmlSerializer^ x = gcnew XmlSerializer( Group::typeid ); + Group^ g = dynamic_cast(x->Deserialize( fs )); + Console::Write( "Members:" ); + System::Collections::IEnumerator^ myEnum = g->Employees->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Employee^ e = safe_cast(myEnum->Current); + Console::WriteLine( "\t{0}", e->Name ); + } +} + +int main() +{ + SerializeObject( "IncludeExample.xml" ); + DeserializeObject( "IncludeExample.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..8ba6ec67f15 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlIncludeAttribute.XmlIncludeAttribute Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +public ref class Vehicle{}; + +public ref class Car: public Vehicle{}; + +public ref class Truck: public Vehicle{}; + +public ref class Sample +{ +public: + + [WebMethodAttribute] + [XmlInclude(Car::typeid)] + [XmlInclude(Truck::typeid)] + Vehicle^ ReturnVehicle( int i ) + { + if ( i == 0 ) + return gcnew Car; + else + return gcnew Truck; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp new file mode 100644 index 00000000000..1945e706e46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source.cpp @@ -0,0 +1,43 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// placeholder; see complete definition elsewhere in this section +public ref class Order +{ +public: + void ShipItems(){} + +}; + + +// Creates the queue if it does not already exist. +void EnsureQueueExists( String^ path ) +{ + if ( !MessageQueue::Exists( path ) ) + { + MessageQueue::Create( path ); + } +} + +int main() +{ + Console::WriteLine( "Processing Orders" ); + String^ queuePath = ".\\orders"; + EnsureQueueExists( queuePath ); + MessageQueue^ queue = gcnew MessageQueue( queuePath ); + array^temp0 = {"Order"}; + (dynamic_cast(queue->Formatter))->TargetTypeNames = temp0; + while ( true ) + { + Order^ newOrder = dynamic_cast(queue->Receive()->Body); + newOrder->ShipItems(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp new file mode 100644 index 00000000000..057b230d28d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source2.cpp @@ -0,0 +1,23 @@ + +// +using namespace System; +public ref class Order +{ +public: + int itemId; + int quantity; + String^ address; + void ShipItems() + { + Console::WriteLine( "Order Placed:" ); + Console::WriteLine( "\tItem ID : {0}", itemId ); + Console::WriteLine( "\tQuantity : {0}", quantity ); + Console::WriteLine( "\tShip To : {0}", address ); + + // Add order to the database. + /* Insert code here. */ + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp new file mode 100644 index 00000000000..44d1d0daa09 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlMessageFormatter Example/CPP/source3.cpp @@ -0,0 +1,46 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// placeholder; see complete definition elsewhere in this section +public ref class Order +{ +public: + int itemId; + int quantity; + String^ address; + void ShipItems(){} + +}; + + +// Creates the queue if it does not already exist. +void EnsureQueueExists( String^ path ) +{ + if ( !MessageQueue::Exists( path ) ) + { + MessageQueue::Create( path ); + } +} + +int main() +{ + String^ queuePath = ".\\orders"; + EnsureQueueExists( queuePath ); + MessageQueue^ queue = gcnew MessageQueue( queuePath ); + Order^ orderRequest = gcnew Order; + orderRequest->itemId = 1025; + orderRequest->quantity = 5; + orderRequest->address = "One Microsoft Way"; + queue->Send( orderRequest ); + + // This line uses a new method you define on the Order class: + // orderRequest.PrintReceipt(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp new file mode 100644 index 00000000000..78b7ac99698 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.LocalName Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp new file mode 100644 index 00000000000..de9d0304ae4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Name Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ +private: + // + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "UnknownNode Name: {0}", e->Name ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp new file mode 100644 index 00000000000..68985474069 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NamespaceURI Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp new file mode 100644 index 00000000000..bd6a1e29d72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.NodeType Example/CPP/source.cpp @@ -0,0 +1,18 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + XmlNodeType myNodeType = e->NodeType; + Console::WriteLine( myNodeType ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp new file mode 100644 index 00000000000..88a67fdab41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.ObjectBeingDeserialized Example/CPP/source.cpp @@ -0,0 +1,18 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Object^ o = e->ObjectBeingDeserialized; + Console::WriteLine( "Object being deserialized: {0}", o ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp new file mode 100644 index 00000000000..a4734b7e012 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventArgs.Text Example/CPP/source.cpp @@ -0,0 +1,17 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "UnknownNode Text: {0}", e->Text ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp new file mode 100644 index 00000000000..b4318feda2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlNodeEventHandler Example/CPP/source.cpp @@ -0,0 +1,41 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Class1 +{ + // +private: + void DeserializeItem( String^ filename ) + { + XmlSerializer^ mySerializer = gcnew XmlSerializer( ObjectToDeserialize::typeid ); + + // Add an instance of the delegate to the event. + mySerializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Class1::Serializer_UnknownNode ); + + // A FileStream is needed to read the file to deserialize. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + ObjectToDeserialize^ o = dynamic_cast(mySerializer->Deserialize( fs )); + } + + void Serializer_UnknownNode( Object^ sender, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "UnknownNode Name: {0}", e->Name ); + Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName ); + Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI ); + Console::WriteLine( "UnknownNode Text: {0}", e->Text ); + Object^ o = e->ObjectBeingDeserialized; + Console::WriteLine( "Object being deserialized {0}", o ); + XmlNodeType myNodeType = e->NodeType; + Console::WriteLine( myNodeType ); + } + // + +public: + + ref class ObjectToDeserialize{}; +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..705ea6b1244 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute Example/CPP/source.cpp @@ -0,0 +1,67 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; + +[XmlRoot(Namespace="www.contoso.com", +ElementName="MyGroupName", +DataType="string", +IsNullable=true)] +public ref class Group +{ +private: + String^ groupNameValue; + +public: + + // Insert code for the Group class. + Group(){} + + Group( String^ groupNameVal ) + { + groupNameValue = groupNameVal; + } + + property String^ GroupName + { + String^ get() + { + return groupNameValue; + } + void set( String^ value ) + { + groupNameValue = value; + } + + } + +}; + +void SerializeGroup() +{ + // Create an instance of the Group class, and an + // instance of the XmlSerializer to serialize it. + Group^ myGroup = gcnew Group( "Redmond" ); + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + + // A FileStream is used to write the file. + FileStream^ fs = gcnew FileStream( "group.xml",FileMode::Create ); + ser->Serialize( fs, myGroup ); + fs->Close(); + Console::WriteLine( myGroup->GroupName ); + Console::WriteLine( "Done" ); + Console::ReadLine(); +} + +int main() +{ + SerializeGroup(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp new file mode 100644 index 00000000000..9780f3bb003 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.IsNullable Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; + +// Apply the XmlRootAttribute and set the IsNullable property to false. + +[XmlRoot(IsNullable=false)] +public ref class Group +{ +public: + String^ Name; +}; + +void SerializeObject( String^ filename ) +{ + XmlSerializer^ s = gcnew XmlSerializer( Group::typeid ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create the object to serialize. + Group^ mygroup = nullptr; + + // Serialize the object, and close the TextWriter. + s->Serialize( writer, mygroup ); + writer->Close(); +} + +int main() +{ + Console::WriteLine( "Running" ); + SerializeObject( "NullDoc.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp new file mode 100644 index 00000000000..4d0cd2a4a61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.Namespace Example/CPP/source.cpp @@ -0,0 +1,15 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// + +[XmlRoot(Namespace="http://www.cpandl.com")] +public ref class Group{}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..ee176b3d4b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlRootAttribute.XmlRootAttribute Example/CPP/source.cpp @@ -0,0 +1,62 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that is the default root element. +public ref class MyClass +{ +public: + String^ Name; +}; + +XmlSerializer^ CreateOverrider(); +void SerializeOrder( String^ filename ) +{ + // Create an XmlSerializer instance using the method below. + XmlSerializer^ xSer = CreateOverrider(); + + // Create the object, and set its Name property. + MyClass^ myClass = gcnew MyClass; + myClass->Name = "New Class Name"; + + // Serialize the class, and close the TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myClass ); + writer->Close(); +} + +// Return an XmlSerializer to override the root serialization. +XmlSerializer^ CreateOverrider() +{ + // Create an XmlAttributes to override the default root element. + XmlAttributes^ attrs = gcnew XmlAttributes; + + // Create an XmlRootAttribute and set its element name and namespace. + XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; + xRoot->ElementName = "OverriddenRootElementName"; + xRoot->Namespace = "http://www.microsoft.com"; + + // Set the XmlRoot property to the XmlRoot object. + attrs->XmlRoot = xRoot; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Add the XmlAttributes object to the + XmlAttributeOverrides object. */ + xOver->Add( MyClass::typeid, attrs ); + + // Create the Serializer, and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( MyClass::typeid,xOver ); + return xSer; +} + +int main() +{ + SerializeOrder( "OverrideAttribute.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp new file mode 100644 index 00000000000..0bfeccd401c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer Example/CPP/source.cpp @@ -0,0 +1,216 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::IO; +ref class Address; +ref class OrderedItem; + +/* The XmlRootAttribute allows you to set an alternate name + (PurchaseOrder) of the XML element, the element namespace; by + default, the XmlSerializer uses the class name. The attribute + also allows you to set the XML namespace for the element. Lastly, + the attribute sets the IsNullable property, which specifies whether + the xsi:null attribute appears if the class instance is set to + a null reference. */ + +[XmlRootAttribute("PurchaseOrder",Namespace="http://www.cpandl.com", +IsNullable=false)] +public ref class PurchaseOrder +{ +public: + Address^ ShipTo; + String^ OrderDate; + + /* The XmlArrayAttribute changes the XML element name + from the default of "OrderedItems" to "Items". */ + + [XmlArrayAttribute("Items")] + array^OrderedItems; + Decimal SubTotal; + Decimal ShipCost; + Decimal TotalCost; +}; + +public ref class Address +{ +public: + + /* The XmlAttribute instructs the XmlSerializer to serialize the Name + field as an XML attribute instead of an XML element (the default + behavior). */ + + [XmlAttributeAttribute] + String^ Name; + String^ Line1; + + /* Setting the IsNullable property to false instructs the + XmlSerializer that the XML attribute will not appear if + the City field is set to a null reference. */ + + [XmlElementAttribute(IsNullable=false)] + String^ City; + String^ State; + String^ Zip; +}; + +public ref class OrderedItem +{ +public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + Decimal LineTotal; + + /* Calculate is a custom method that calculates the price per item, + and stores the value in a field. */ + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } + +}; + +public ref class Test +{ +public: + static void main() + { + // Read and write purchase orders. + Test^ t = gcnew Test; + t->CreatePO( "po.xml" ); + t->ReadPO( "po.xml" ); + } + +private: + void CreatePO( String^ filename ) + { + // Create an instance of the XmlSerializer class; + // specify the type of object to serialize. + XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); + TextWriter^ writer = gcnew StreamWriter( filename ); + PurchaseOrder^ po = gcnew PurchaseOrder; + + // Create an address to ship and bill to. + Address^ billAddress = gcnew Address; + billAddress->Name = "Teresa Atkinson"; + billAddress->Line1 = "1 Main St."; + billAddress->City = "AnyTown"; + billAddress->State = "WA"; + billAddress->Zip = "00000"; + + // Set ShipTo and BillTo to the same addressee. + po->ShipTo = billAddress; + po->OrderDate = System::DateTime::Now.ToLongDateString(); + + // Create an OrderedItem object. + OrderedItem^ i1 = gcnew OrderedItem; + i1->ItemName = "Widget S"; + i1->Description = "Small widget"; + i1->UnitPrice = (Decimal)5.23; + i1->Quantity = 3; + i1->Calculate(); + + // Insert the item into the array. + array^items = {i1}; + po->OrderedItems = items; + + // Calculate the total cost. + Decimal subTotal = Decimal(0); + System::Collections::IEnumerator^ myEnum = items->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + OrderedItem^ oi = safe_cast(myEnum->Current); + subTotal = subTotal + oi->LineTotal; + } + + po->SubTotal = subTotal; + po->ShipCost = (Decimal)12.51; + po->TotalCost = po->SubTotal + po->ShipCost; + + // Serialize the purchase order, and close the TextWriter. + serializer->Serialize( writer, po ); + writer->Close(); + } + +protected: + void ReadPO( String^ filename ) + { + // Create an instance of the XmlSerializer class; + // specify the type of object to be deserialized. + XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); + + /* If the XML document has been altered with unknown + nodes or attributes, handle them with the + UnknownNode and UnknownAttribute events.*/ + serializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Test::serializer_UnknownNode ); + serializer->UnknownAttribute += gcnew XmlAttributeEventHandler( this, &Test::serializer_UnknownAttribute ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + + // Declare an object variable of the type to be deserialized. + PurchaseOrder^ po; + + /* Use the Deserialize method to restore the object's state with + data from the XML document. */ + po = dynamic_cast(serializer->Deserialize( fs )); + + // Read the order date. + Console::WriteLine( "OrderDate: {0}", po->OrderDate ); + + // Read the shipping address. + Address^ shipTo = po->ShipTo; + ReadAddress( shipTo, "Ship To:" ); + + // Read the list of ordered items. + array^items = po->OrderedItems; + Console::WriteLine( "Items to be shipped:" ); + System::Collections::IEnumerator^ myEnum1 = items->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + OrderedItem^ oi = safe_cast(myEnum1->Current); + Console::WriteLine( "\t{0}\t{1}\t{2}\t{3}\t{4}", oi->ItemName, oi->Description, oi->UnitPrice, oi->Quantity, oi->LineTotal ); + } + + Console::WriteLine( "\t\t\t\t\t Subtotal\t{0}", po->SubTotal ); + Console::WriteLine( "\t\t\t\t\t Shipping\t{0}", po->ShipCost ); + Console::WriteLine( "\t\t\t\t\t Total\t\t{0}", po->TotalCost ); + } + + void ReadAddress( Address^ a, String^ label ) + { + // Read the fields of the Address object. + Console::WriteLine( label ); + Console::WriteLine( "\t{0}", a->Name ); + Console::WriteLine( "\t{0}", a->Line1 ); + Console::WriteLine( "\t{0}", a->City ); + Console::WriteLine( "\t{0}", a->State ); + Console::WriteLine( "\t{0}", a->Zip ); + Console::WriteLine(); + } + +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "Unknown Node:{0}\t{1}", e->Name, e->Text ); + } + + void serializer_UnknownAttribute( Object^ /*sender*/, XmlAttributeEventArgs^ e ) + { + System::Xml::XmlAttribute^ attr = e->Attr; + Console::WriteLine( "Unknown attribute {0}='{1}'", attr->Name, attr->Value ); + } +}; + +int main() +{ + Test::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp new file mode 100644 index 00000000000..b488c27b932 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.CanDeserialize Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void TestDocument( String^ filename, Type^ objType ) + { + // Using a FileStream, create an XmlTextReader. + Stream^ fs = gcnew FileStream( filename,FileMode::Open ); + XmlReader^ reader = gcnew XmlTextReader( fs ); + XmlSerializer^ serializer = gcnew XmlSerializer( objType ); + if ( serializer->CanDeserialize( reader ) ) + { + Object^ o = serializer->Deserialize( reader ); + } + fs->Close(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp new file mode 100644 index 00000000000..542444fb61a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize Example/CPP/source.cpp @@ -0,0 +1,70 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that will be deserialized. +public ref class OrderedItem +{ +public: + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ ItemName; + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ Description; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal UnitPrice; + + [XmlElement(Namespace="http://www.cpandl.com")] + int Quantity; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void DeserializeObject(String^ filename) +{ + Console::WriteLine("Reading with Stream"); + + // Create an instance of the XmlSerializer. + XmlSerializer^ serializer = gcnew XmlSerializer(OrderedItem::typeid); + + // Declare an object variable of the type to be deserialized. + OrderedItem^ i; + + // Reading the XML document requires a FileStream. + Stream^ reader = gcnew FileStream(filename, FileMode::Open); + + try + { + // Call the Deserialize method to restore the object's state. + i = dynamic_cast(serializer->Deserialize(reader)); + } + finally + { + delete reader; + } + + // Write out the properties of the object. + Console::Write("{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal); +} + +int main() +{ + // Read a purchase order. + DeserializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp new file mode 100644 index 00000000000..b803c3b61af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize1 Example/CPP/source.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml::Serialization; + +// This is the class that will be deserialized. +public ref class OrderedItem +{ +public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void DeserializeObject( String^ filename ) +{ + Console::WriteLine( "Reading with TextReader" ); + + // Create an instance of the XmlSerializer specifying type. + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + + /* Create a TextReader to read the file. Specify an + Encoding to use. */ + TextReader^ reader = gcnew StreamReader( filename,Encoding::Unicode ); + + // Declare an object variable of the type to be deserialized. + OrderedItem^ i; + + // Use the Deserialize method to restore the object's state. + i = dynamic_cast(serializer->Deserialize( reader )); + + // Write out the properties of the object. + Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal ); +} + +int main() +{ + // Read a purchase order. + DeserializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp new file mode 100644 index 00000000000..3b2738346ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Deserialize2 Example/CPP/source.cpp @@ -0,0 +1,56 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// This is the class that will be deserialized. +public ref class OrderedItem +{ +public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void DeserializeObject( String^ filename ) +{ + Console::WriteLine( "Reading with XmlReader" ); + + // Create an instance of the XmlSerializer specifying type and namespace. + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + XmlReader^ reader = gcnew XmlTextReader( fs ); + + // Declare an object variable of the type to be deserialized. + OrderedItem^ i; + + // Use the Deserialize method to restore the object's state. + i = dynamic_cast(serializer->Deserialize( reader )); + + // Write out the properties of the object. + Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal ); +} + +int main() +{ + // Read a purchase order. + DeserializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp new file mode 100644 index 00000000000..a9b0d0bf54e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.FromTypes Example/CPP/source.cpp @@ -0,0 +1,57 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +/* Three classes are included here. Each one will +be used to create three XmlSerializer objects. */ +public ref class Instrument +{ +public: + String^ InstrumentName; +}; + +public ref class Player +{ +public: + String^ PlayerName; +}; + +public ref class Piece +{ +public: + String^ PieceName; +}; + +void GetSerializers() +{ + // Create an array of types. + array^types = gcnew array(3); + types[ 0 ] = Instrument::typeid; + types[ 1 ] = Player::typeid; + types[ 2 ] = Piece::typeid; + + // Create an array for XmlSerializer objects. + array^serializers = gcnew array(3); + serializers = XmlSerializer::FromTypes( types ); + + // Create one Instrument and serialize it. + Instrument^ i = gcnew Instrument; + i->InstrumentName = "Piano"; + + // Create a TextWriter to write with. + TextWriter^ writer = gcnew StreamWriter( "Inst.xml" ); + serializers[ 0 ]->Serialize( writer, i ); + writer->Close(); +} + +int main() +{ + GetSerializers(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp new file mode 100644 index 00000000000..deb65e2782e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize Example/CPP/source.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class OrderedItem +{ +public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Writing With TextWriter" ); + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + OrderedItem^ i = gcnew OrderedItem; + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + i->Calculate(); + + /* Create a StreamWriter to write with. First create a FileStream + object, and create the StreamWriter specifying an Encoding to use. */ + FileStream^ fs = gcnew FileStream( filename,FileMode::Create ); + TextWriter^ writer = gcnew StreamWriter( fs,gcnew UTF8Encoding ); + + // Serialize using the XmlTextWriter. + serializer->Serialize( writer, i ); + writer->Close(); +} + +int main() +{ + // Write a purchase order. + SerializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp new file mode 100644 index 00000000000..c635e566468 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize1 Example/CPP/source.cpp @@ -0,0 +1,72 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class OrderedItem +{ +public: + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ ItemName; + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ Description; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal UnitPrice; + + [XmlElement(Namespace="http://www.cpandl.com")] + int Quantity; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Writing With TextWriter" ); + + // Create an XmlSerializer instance using the type. + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + OrderedItem^ i = gcnew OrderedItem; + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + i->Calculate(); + + // Create an XmlSerializerNamespaces object. + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + + // Add two namespaces with prefixes. + ns->Add( "inventory", "http://www.cpandl.com" ); + ns->Add( "money", "http://www.cohowinery.com" ); + + // Create a StreamWriter to write with. + TextWriter^ writer = gcnew StreamWriter( filename ); + + /* Serialize using the object using the TextWriter + and namespaces. */ + serializer->Serialize( writer, i, ns ); + writer->Close(); +} + +int main() +{ + // Write a purchase order. + SerializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp new file mode 100644 index 00000000000..053d871e78a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize2 Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class OrderedItem +{ +public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Writing With Stream" ); + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + OrderedItem^ i = gcnew OrderedItem; + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + i->Calculate(); + + // Create a FileStream to write with. + Stream^ writer = gcnew FileStream( filename,FileMode::Create ); + + // Serialize the object, and close the TextWriter + serializer->Serialize( writer, i ); + writer->Close(); +} + +int main() +{ + // Write a purchase order. + SerializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp new file mode 100644 index 00000000000..baf2cd1b7c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize3 Example/CPP/source.cpp @@ -0,0 +1,91 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class OrderedItem +{ +public: + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ ItemName; + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ Description; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal UnitPrice; + + [XmlElement(Namespace="http://www.cpandl.com")] + int Quantity; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Writing With Stream" ); + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + OrderedItem^ i = gcnew OrderedItem; + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + i->Calculate(); + + // Create an XmlSerializerNamespaces object. + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + + // Add two prefix-namespace pairs. + ns->Add( "inventory", "http://www.cpandl.com" ); + ns->Add( "money", "http://www.cohowinery.com" ); + + // Create a FileStream to write with. + Stream^ writer = gcnew FileStream( filename,FileMode::Create ); + + // Serialize the object, and close the TextWriter + serializer->Serialize( writer, i, ns ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + Console::WriteLine( "Reading with Stream" ); + + // Create an instance of the XmlSerializer. + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + + // Writing the file requires a Stream. + Stream^ reader = gcnew FileStream( filename,FileMode::Open ); + + // Declare an object variable of the type to be deserialized. + OrderedItem^ i; + + /* Use the Deserialize method to restore the object's state + using data from the XML document. */ + i = dynamic_cast(serializer->Deserialize( reader )); + + // Write out the properties of the object. + Console::Write( "{0}\t{1}\t{2}\t{3}\t{4}", i->ItemName, i->Description, i->UnitPrice, i->Quantity, i->LineTotal ); +} + +int main() +{ + // Write a purchase order. + SerializeObject( "simple.xml" ); + DeserializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp new file mode 100644 index 00000000000..1774c451ee4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize4 Example/CPP/source.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class OrderedItem +{ +public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Writing With XmlTextWriter" ); + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + OrderedItem^ i = gcnew OrderedItem; + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + i->Calculate(); + + // Create an XmlTextWriter using a FileStream. + Stream^ fs = gcnew FileStream( filename,FileMode::Create ); + XmlWriter^ writer = gcnew XmlTextWriter( fs,Encoding::Unicode ); + + // Serialize using the XmlTextWriter. + serializer->Serialize( writer, i ); + writer->Close(); +} + +int main() +{ + // Write a purchase order. + SerializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp new file mode 100644 index 00000000000..8a82ba5a382 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.Serialize5 Example/CPP/source.cpp @@ -0,0 +1,72 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class OrderedItem +{ +public: + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ ItemName; + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ Description; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal UnitPrice; + + [XmlElement(Namespace="http://www.cpandl.com")] + int Quantity; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal LineTotal; + + // A custom method used to calculate price per item. + void Calculate() + { + LineTotal = UnitPrice * Quantity; + } +}; + +void SerializeObject( String^ filename ) +{ + Console::WriteLine( "Writing With XmlTextWriter" ); + XmlSerializer^ serializer = gcnew XmlSerializer( OrderedItem::typeid ); + OrderedItem^ i = gcnew OrderedItem; + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + i->Calculate(); + + // Create an XmlSerializerNamespaces object. + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + + // Add two namespaces with prefixes. + ns->Add( "inventory", "http://www.cpandl.com" ); + ns->Add( "money", "http://www.cohowinery.com" ); + + // Create an XmlTextWriter using a FileStream. + Stream^ fs = gcnew FileStream( filename,FileMode::Create ); + XmlWriter^ writer = gcnew XmlTextWriter( fs,gcnew UTF8Encoding ); + + // Serialize using the XmlTextWriter. + serializer->Serialize( writer, i, ns ); + writer->Close(); +} + +int main() +{ + // Write a purchase order. + SerializeObject( "simple.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..cef506f6c43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownAttribute Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; +using namespace System::Xml::Schema; + +public ref class Group +{ +public: + String^ GroupName; +}; + +public ref class Test +{ +public: + static void main() + { + Test^ t = gcnew Test; + + // Deserialize the file containing unknown elements. + t->DeserializeObject( "UnknownAttributes.xml" ); + } + +private: + void Serializer_UnknownAttribute( Object^ sender, XmlAttributeEventArgs^ e ) + { + Console::WriteLine( "Unknown Attribute" ); + Console::WriteLine( "\t{0} {1}", e->Attr->Name, e->Attr->InnerXml ); + Console::WriteLine( "\t LineNumber: {0}", e->LineNumber ); + Console::WriteLine( "\t LinePosition: {0}", e->LinePosition ); + Group^ x = dynamic_cast(e->ObjectBeingDeserialized); + Console::WriteLine( x->GroupName ); + Console::WriteLine( sender ); + } + + void DeserializeObject( String^ filename ) + { + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + + // Add a delegate to handle unknown element events. + ser->UnknownAttribute += gcnew XmlAttributeEventHandler( this, &Test::Serializer_UnknownAttribute ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ g = dynamic_cast(ser->Deserialize( fs )); + fs->Close(); + } +}; + +int main() +{ + Test::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp new file mode 100644 index 00000000000..57d80144134 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.UnknownNode Example/CPP/source.cpp @@ -0,0 +1,79 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Group +{ +public: + + // Only the GroupName field will be known. + String^ GroupName; +}; + +public ref class Test +{ +public: + static void main() + { + Test^ t = gcnew Test; + t->DeserializeObject( "UnknownNodes.xml" ); + } + +private: + void DeserializeObject( String^ filename ) + { + XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + mySerializer->UnknownNode += gcnew XmlNodeEventHandler( this, &Test::serializer_UnknownNode ); + Group^ myGroup = dynamic_cast(mySerializer->Deserialize( fs )); + fs->Close(); + } + +private: + void serializer_UnknownNode( Object^ /*sender*/, XmlNodeEventArgs^ e ) + { + Console::WriteLine( "UnknownNode Name: {0}", e->Name ); + Console::WriteLine( "UnknownNode LocalName: {0}", e->LocalName ); + Console::WriteLine( "UnknownNode Namespace URI: {0}", e->NamespaceURI ); + Console::WriteLine( "UnknownNode Text: {0}", e->Text ); + XmlNodeType myNodeType = e->NodeType; + Console::WriteLine( "NodeType: {0}", myNodeType ); + Group^ myGroup = dynamic_cast(e->ObjectBeingDeserialized); + Console::WriteLine( "GroupName: {0}", myGroup->GroupName ); + Console::WriteLine(); + } +}; + +int main() +{ + Test::main(); +} + +/* Paste this XML into a file named UnknownNodes: + + + MyGroup + Large + 444 + West + + 1 + Thing1 + + element + + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp new file mode 100644 index 00000000000..1df7c03435e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer Example/CPP/source.cpp @@ -0,0 +1,181 @@ + + +// +// Beginning of the HighSchool.dll +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +namespace HighSchool +{ + public ref class Student + { + public: + String^ Name; + int ID; + }; + + public ref class MyClass + { + public: + array^Students; + }; +} + +namespace College +{ + +using namespace HighSchool; + public ref class Graduate: public HighSchool::Student + { + public: + Graduate(){} + + // Add a new field named University. + String^ University; + + // Use extra types to use this field. + array^Info; + }; + + public ref class Address + { + public: + String^ City; + }; + + public ref class Phone + { + public: + String^ Number; + }; + + public ref class Run + { + public: + static void main() + { + Run^ test = gcnew Run; + test->WriteOverriddenAttributes( "College.xml" ); + test->ReadOverriddenAttributes( "College.xml" ); + } + + private: + void WriteOverriddenAttributes( String^ filename ) + { + // Writing the file requires a TextWriter. + TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); + + // Create an XMLAttributeOverrides class. + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + + // Create the XmlAttributes class. + XmlAttributes^ attrs = gcnew XmlAttributes; + + /* Override the Student class. "Alumni" is the name + of the overriding element in the XML output. */ + XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); + + /* Add the XmlElementAttribute to the collection of + elements in the XmlAttributes object. */ + attrs->XmlElements->Add( attr ); + + /* Add the XmlAttributes to the XmlAttributeOverrides. + "Students" is the name being overridden. */ + attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); + + // Create array of extra types. + array^extraTypes = gcnew array(2); + extraTypes[ 0 ] = Address::typeid; + extraTypes[ 1 ] = Phone::typeid; + + // Create an XmlRootAttribute. + XmlRootAttribute^ root = gcnew XmlRootAttribute( "Graduates" ); + + /* Create the XmlSerializer with the + XmlAttributeOverrides object. */ + XmlSerializer^ mySerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides,extraTypes,root,"http://www.microsoft.com" ); + MyClass ^ myClass = gcnew MyClass; + Graduate^ g1 = gcnew Graduate; + g1->Name = "Jacki"; + g1->ID = 1; + g1->University = "Alma"; + Graduate^ g2 = gcnew Graduate; + g2->Name = "Megan"; + g2->ID = 2; + g2->University = "CM"; + array^myArray = {g1,g2}; + myClass->Students = myArray; + + // Create extra information. + Address^ a1 = gcnew Address; + a1->City = "Ionia"; + Address^ a2 = gcnew Address; + a2->City = "Stamford"; + Phone^ p1 = gcnew Phone; + p1->Number = "555-0101"; + Phone^ p2 = gcnew Phone; + p2->Number = "555-0100"; + array^o1 = {a1,p1}; + array^o2 = {a2,p2}; + g1->Info = o1; + g2->Info = o2; + mySerializer->Serialize( myStreamWriter, myClass ); + myStreamWriter->Close(); + } + + void ReadOverriddenAttributes( String^ filename ) + { + /* The majority of the code here is the same as that in the + WriteOverriddenAttributes method. Because the XML being read + doesn't conform to the schema defined by the DLL, the + XMLAttributesOverrides must be used to create an + XmlSerializer instance to read the XML document.*/ + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); + attrs->XmlElements->Add( attr ); + attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); + array^extraTypes = gcnew array(2); + extraTypes[ 0 ] = Address::typeid; + extraTypes[ 1 ] = Phone::typeid; + XmlRootAttribute^ root = gcnew XmlRootAttribute( "Graduates" ); + XmlSerializer^ readSerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides,extraTypes,root,"http://www.microsoft.com" ); + + // A FileStream object is required to read the file. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + MyClass ^ myClass; + myClass = dynamic_cast(readSerializer->Deserialize( fs )); + + /* Here is the difference between reading and writing an + XML document: You must declare an object of the derived + type (Graduate) and cast the Student instance to it.*/ + Graduate^ g; + Address^ a; + Phone^ p; + System::Collections::IEnumerator^ myEnum = myClass->Students->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Graduate^ grad = safe_cast(myEnum->Current); + g = dynamic_cast(grad); + Console::Write( "{0}\t", g->Name ); + Console::Write( "{0}\t", g->ID ); + Console::Write( "{0}\n", g->University ); + a = dynamic_cast(g->Info[ 0 ]); + Console::WriteLine( a->City ); + p = dynamic_cast(g->Info[ 1 ]); + Console::WriteLine( p->Number ); + } + } + }; +} + +int main() +{ + College::Run::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp new file mode 100644 index 00000000000..173d91e6ff3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer1 Example/CPP/source.cpp @@ -0,0 +1,51 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Class1 +{ + // +private: + void SerializeObject( String^ filename ) + { + XmlSerializer^ serializer = gcnew XmlSerializer( + OrderedItem::typeid,"http://www.cpandl.com" ); + + // Create an instance of the class to be serialized. + OrderedItem^ i = gcnew OrderedItem; + + // Insert code to set property values. + + // Writing the document requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + // Serialize the object, and close the TextWriter + serializer->Serialize( writer, i ); + writer->Close(); + } + + void DeserializeObject( String^ filename ) + { + XmlSerializer^ serializer = gcnew XmlSerializer( + OrderedItem::typeid,"http://www.cpandl.com" ); + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + + // Declare an object variable of the type to be deserialized. + OrderedItem^ i; + + // Deserialize the object. + i = dynamic_cast(serializer->Deserialize( fs )); + + // Insert code to use the properties and methods of the object. + } + // + +public: + ref class OrderedItem{ + // Members of OrderedItem go here + }; +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp new file mode 100644 index 00000000000..2ce08d9f7a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer2 Example/CPP/source.cpp @@ -0,0 +1,58 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Class1 +{ + // +private: + void SerializeObject( String^ filename ) + { + // Create an XmlRootAttribute, and set its properties. + XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; + xRoot->ElementName = "CustomRoot"; + xRoot->Namespace = "http://www.cpandl.com"; + xRoot->IsNullable = true; + + // Construct the XmlSerializer with the XmlRootAttribute. + XmlSerializer^ serializer = gcnew XmlSerializer( + OrderedItem::typeid,xRoot ); + + // Create an instance of the object to serialize. + OrderedItem^ i = gcnew OrderedItem; + // Insert code to set properties of the ordered item. + + // Writing the document requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + serializer->Serialize( writer, i ); + writer->Close(); + } + + void DeserializeObject( String^ filename ) + { + // Create an XmlRootAttribute, and set its properties. + XmlRootAttribute^ xRoot = gcnew XmlRootAttribute; + xRoot->ElementName = "CustomRoot"; + xRoot->Namespace = "http://www.cpandl.com"; + xRoot->IsNullable = true; + + XmlSerializer^ serializer = gcnew XmlSerializer( + OrderedItem::typeid,xRoot ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + // Deserialize the object. + OrderedItem^ i = dynamic_cast(serializer->Deserialize( fs )); + // Insert code to use the object's properties and methods. + } + // + +public: + ref class OrderedItem{ + // Members of OrderedItem go here + }; +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp new file mode 100644 index 00000000000..669af6e0644 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer3 Example/CPP/source.cpp @@ -0,0 +1,137 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +ref class Address; +ref class Phone; + +// This defines the object that will be serialized. +public ref class Teacher +{ +public: + String^ Name; + Teacher(){} + + /* Note that the Info field returns an array of objects. + Any object can be added to the array by adding the + object type to the array passed to the extraTypes argument. */ + + [XmlArray(ElementName="ExtraInfo",IsNullable=true)] + array^Info; + Phone^ PhoneInfo; +}; + + +// This defines one of the extra types to be included. +public ref class Address +{ +public: + String^ City; + Address(){} + + Address( String^ city ) + { + City = city; + } +}; + +// Another extra type to include. +public ref class Phone +{ +public: + String^ PhoneNumber; + Phone(){} + + Phone( String^ phoneNumber ) + { + PhoneNumber = phoneNumber; + } +}; + +// Another type, derived from Phone +public ref class InternationalPhone: public Phone +{ +public: + String^ CountryCode; + InternationalPhone(){} + + InternationalPhone( String^ countryCode ) + { + CountryCode = countryCode; + } +}; + +public ref class Run +{ +public: + static void main() + { + Run^ test = gcnew Run; + test->SerializeObject( "Teacher.xml" ); + test->DeserializeObject( "Teacher.xml" ); + } + +private: + void SerializeObject( String^ filename ) + { + // Writing the file requires a TextWriter. + TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); + + // Create a Type array. + array^extraTypes = gcnew array(3); + extraTypes[ 0 ] = Address::typeid; + extraTypes[ 1 ] = Phone::typeid; + extraTypes[ 2 ] = InternationalPhone::typeid; + + // Create the XmlSerializer instance. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Teacher::typeid,extraTypes ); + Teacher^ teacher = gcnew Teacher; + teacher->Name = "Mike"; + + // Add extra types to the Teacher object + array^info = gcnew array(2); + info[ 0 ] = gcnew Address( "Springville" ); + info[ 1 ] = gcnew Phone( "555-0100" ); + teacher->Info = info; + teacher->PhoneInfo = gcnew InternationalPhone( "000" ); + mySerializer->Serialize( myStreamWriter, teacher ); + myStreamWriter->Close(); + } + + void DeserializeObject( String^ filename ) + { + // Create a Type array. + array^extraTypes = gcnew array(3); + extraTypes[ 0 ] = Address::typeid; + extraTypes[ 1 ] = Phone::typeid; + extraTypes[ 2 ] = InternationalPhone::typeid; + + // Create the XmlSerializer instance. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Teacher::typeid,extraTypes ); + + // Reading a file requires a FileStream. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Teacher^ teacher = dynamic_cast(mySerializer->Deserialize( fs )); + + // Read the extra information. + Address^ a = dynamic_cast(teacher->Info[ 0 ]); + Phone^ p = dynamic_cast(teacher->Info[ 1 ]); + InternationalPhone^ Ip = dynamic_cast(teacher->PhoneInfo); + Console::WriteLine( teacher->Name ); + Console::WriteLine( a->City ); + Console::WriteLine( p->PhoneNumber ); + Console::WriteLine( Ip->CountryCode ); + } +}; + +int main() +{ + Run::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp new file mode 100644 index 00000000000..0050ba6a3ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer4 Example/CPP/source.cpp @@ -0,0 +1,133 @@ + + +// +// Beginning of HighSchool.dll +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +namespace HighSchool +{ + public ref class Student + { + public: + String^ Name; + int ID; + }; + + public ref class MyClass + { + public: + array^Students; + }; +} + +namespace College +{ + +using namespace HighSchool; + public ref class Graduate: public HighSchool::Student + { + public: + Graduate(){} + + // Add a new field named University. + String^ University; + }; + + public ref class Run + { + public: + static void main() + { + Run^ test = gcnew Run; + test->WriteOverriddenAttributes( "College.xml" ); + test->ReadOverriddenAttributes( "College.xml" ); + } + + private: + void WriteOverriddenAttributes( String^ filename ) + { + // Writing the file requires a TextWriter. + TextWriter^ myStreamWriter = gcnew StreamWriter( filename ); + + // Create an XMLAttributeOverrides class. + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + + // Create the XmlAttributes class. + XmlAttributes^ attrs = gcnew XmlAttributes; + + /* Override the Student class. "Alumni" is the name + of the overriding element in the XML output. */ + XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); + + /* Add the XmlElementAttribute to the collection of + elements in the XmlAttributes object. */ + attrs->XmlElements->Add( attr ); + + /* Add the XmlAttributes to the XmlAttributeOverrides. + "Students" is the name being overridden. */ + attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); + + // Create the XmlSerializer. + XmlSerializer^ mySerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides ); + MyClass ^ myClass = gcnew MyClass; + Graduate^ g1 = gcnew Graduate; + g1->Name = "Jackie"; + g1->ID = 1; + g1->University = "Alma Mater"; + Graduate^ g2 = gcnew Graduate; + g2->Name = "Megan"; + g2->ID = 2; + g2->University = "CM"; + array^myArray = {g1,g2}; + myClass->Students = myArray; + mySerializer->Serialize( myStreamWriter, myClass ); + myStreamWriter->Close(); + } + + void ReadOverriddenAttributes( String^ filename ) + { + /* The majority of the code here is the same as that in the + WriteOverriddenAttributes method. Because the XML being read + doesn't conform to the schema defined by the DLL, the + XMLAttributesOverrides must be used to create an + XmlSerializer instance to read the XML document.*/ + XmlAttributeOverrides^ attrOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlElementAttribute^ attr = gcnew XmlElementAttribute( "Alumni",Graduate::typeid ); + attrs->XmlElements->Add( attr ); + attrOverrides->Add( HighSchool::MyClass::typeid, "Students", attrs ); + XmlSerializer^ readSerializer = gcnew XmlSerializer( HighSchool::MyClass::typeid,attrOverrides ); + + // To read the file, a FileStream object is required. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + MyClass ^ myClass; + myClass = dynamic_cast(readSerializer->Deserialize( fs )); + + /* Here is the difference between reading and writing an + XML document: You must declare an object of the derived + type (Graduate) and cast the Student instance to it.*/ + Graduate^ g; + System::Collections::IEnumerator^ myEnum = myClass->Students->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Graduate^ grad = safe_cast(myEnum->Current); + g = dynamic_cast(grad); + Console::Write( "{0}\t", g->Name ); + Console::Write( "{0}\t", g->ID ); + Console::Write( "{0}\n", g->University ); + } + } + }; +} + +int main() +{ + College::Run::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp new file mode 100644 index 00000000000..6dabc064fb4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializer.XmlSerializer6 Example/CPP/source.cpp @@ -0,0 +1,46 @@ +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void SerializeObject( String^ filename ) + { + XmlSerializer^ serializer = + gcnew XmlSerializer( OrderedItem::typeid ); + + // Create an instance of the class to be serialized. + OrderedItem^ i = gcnew OrderedItem; + + // Set the public property values. + i->ItemName = "Widget"; + i->Description = "Regular Widget"; + i->Quantity = 10; + i->UnitPrice = (Decimal)2.30; + + // Writing the document requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Serialize the object, and close the TextWriter. + serializer->Serialize( writer, i ); + writer->Close(); + } + +public: + // This is the class that will be serialized. + ref class OrderedItem + { + public: + String^ ItemName; + String^ Description; + Decimal UnitPrice; + int Quantity; + }; + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp new file mode 100644 index 00000000000..01f91598da8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces Example/CPP/source.cpp @@ -0,0 +1,82 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Price +{ +public: + + [XmlAttributeAttribute(Namespace="http://www.cpandl.com")] + String^ currency; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Decimal price; +}; + +[XmlType(Namespace="http://www.cpandl.com")] +public ref class Book +{ +public: + + [XmlElement(Namespace="http://www.cpandl.com")] + String^ TITLE; + + [XmlElement(Namespace="http://www.cohowinery.com")] + Price^ PRICE; +}; + +public ref class Books +{ +public: + + [XmlElement(Namespace="http://www.cohowinery.com")] + Book^ Book; +}; + +public ref class Run +{ +public: + static void main() + { + Run^ test = gcnew Run; + test->SerializeObject( "XmlNamespaces.xml" ); + } + + void SerializeObject( String^ filename ) + { + XmlSerializer^ s = gcnew XmlSerializer( Books::typeid ); + + // Writing a file requires a TextWriter. + TextWriter^ t = gcnew StreamWriter( filename ); + + /* Create an XmlSerializerNamespaces object and add two + prefix-namespace pairs. */ + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + ns->Add( "books", "http://www.cpandl.com" ); + ns->Add( "money", "http://www.cohowinery.com" ); + + // Create a Book instance. + Book^ b = gcnew Book; + b->TITLE = "A Book Title"; + Price^ p = gcnew Price; + p->price = (Decimal)9.95; + p->currency = "US Dollar"; + b->PRICE = p; + Books^ bks = gcnew Books; + bks->Book = b; + s->Serialize( t, bks, ns ); + t->Close(); + } +}; + +int main() +{ + Run::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..825b960ef4a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.Add Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + XmlSerializerNamespaces^ AddNamespaces() + { + XmlSerializerNamespaces^ xmlNamespaces = + gcnew XmlSerializerNamespaces; + + // Add three prefix-namespace pairs. + xmlNamespaces->Add( "money", "http://www.cpandl.com" ); + xmlNamespaces->Add( "books", "http://www.cohowinery.com" ); + xmlNamespaces->Add( "software", "http://www.microsoft.com" ); + + return xmlNamespaces; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp new file mode 100644 index 00000000000..89a101a18a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.ToArray Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + void PrintNamespacePairs( XmlSerializerNamespaces^ namespaces ) + { + array^ qualifiedNames = namespaces->ToArray(); + for ( int i = 0; i < qualifiedNames->Length; i++ ) + { + Console::WriteLine( "{0}\t{1}", + qualifiedNames[ i ]->Name, qualifiedNames[ i ]->Namespace ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp new file mode 100644 index 00000000000..58d5dd55649 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlSerializerNamespaces.XmlSerializerNamespaces1 Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Sample +{ + // +private: + XmlSerializerNamespaces^ CreateFromQNames() + { + XmlQualifiedName^ q1 = + gcnew XmlQualifiedName( "money","http://www.cohowinery.com" ); + + XmlQualifiedName^ q2 = + gcnew XmlQualifiedName( "books","http://www.cpandl.com" ); + + array^ names = { q1, q2 }; + + return gcnew XmlSerializerNamespaces( names ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..fadecdb274e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute Example/CPP/source.cpp @@ -0,0 +1,99 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Xml::Serialization; +using namespace System::IO; + +public ref class Group1 +{ +public: + + // The XmlTextAttribute with type set to string informs the + // XmlSerializer that strings should be serialized as XML text. + + [XmlText(String::typeid)] + [XmlElement(Int32::typeid)] + [XmlElement(Double::typeid)] + array^All; + Group1() + { + array^temp = {321,"One",2,3.0,"Two"}; + All = temp; + } +}; + +public enum class GroupType +{ + Small, Medium, Large +}; + +public ref class Group2 +{ +public: + + [XmlText(Type=GroupType::typeid)] + GroupType Type; +}; + +public ref class Group3 +{ +public: + + [XmlText(Type=DateTime::typeid)] + DateTime CreationTime; + Group3() + { + CreationTime = DateTime::Now; + } +}; + +public ref class Test +{ +public: + static void main() + { + Test^ t = gcnew Test; + t->SerializeArray( "XmlText1.xml" ); + t->SerializeEnum( "XmlText2.xml" ); + t->SerializeDateTime( "XmlText3.xml" ); + } + +private: + void SerializeArray( String^ filename ) + { + XmlSerializer^ ser = gcnew XmlSerializer( Group1::typeid ); + Group1^ myGroup1 = gcnew Group1; + TextWriter^ writer = gcnew StreamWriter( filename ); + ser->Serialize( writer, myGroup1 ); + writer->Close(); + } + + void SerializeEnum( String^ filename ) + { + XmlSerializer^ ser = gcnew XmlSerializer( Group2::typeid ); + Group2^ myGroup = gcnew Group2; + myGroup->Type = GroupType::Medium; + TextWriter^ writer = gcnew StreamWriter( filename ); + ser->Serialize( writer, myGroup ); + writer->Close(); + } + + void SerializeDateTime( String^ filename ) + { + XmlSerializer^ ser = gcnew XmlSerializer( Group3::typeid ); + Group3^ myGroup = gcnew Group3; + TextWriter^ writer = gcnew StreamWriter( filename ); + ser->Serialize( writer, myGroup ); + writer->Close(); + } +}; + +int main() +{ + Test::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..d6719698f71 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTextAttribute.XmlTextAttribute Example/CPP/source.cpp @@ -0,0 +1,68 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Schema; + +public ref class Group +{ +public: + String^ GroupName; + String^ Comment; +}; + +public ref class Test +{ +public: + static void main() + { + Test^ t = gcnew Test; + t->SerializerOrder( "TextOverride.xml" ); + } + + /* Create an instance of the XmlSerializer class that overrides + the default way it serializes an object. */ + XmlSerializer^ CreateOverrider() + { + /* Create instances of the XmlAttributes and + XmlAttributeOverrides classes. */ + XmlAttributes^ attrs = gcnew XmlAttributes; + XmlAttributeOverrides^ xOver = gcnew XmlAttributeOverrides; + + /* Create an XmlTextAttribute to override the default + serialization process. */ + XmlTextAttribute^ xText = gcnew XmlTextAttribute; + attrs->XmlText = xText; + + // Add the XmlAttributes to the XmlAttributeOverrides. + xOver->Add( Group::typeid, "Comment", attrs ); + + // Create the XmlSerializer, and return it. + XmlSerializer^ xSer = gcnew XmlSerializer( Group::typeid,xOver ); + return xSer; + } + + void SerializerOrder( String^ filename ) + { + // Create an XmlSerializer instance. + XmlSerializer^ xSer = CreateOverrider(); + + // Create the object and serialize it. + Group^ myGroup = gcnew Group; + myGroup->Comment = "This is a great product."; + TextWriter^ writer = gcnew StreamWriter( filename ); + xSer->Serialize( writer, myGroup ); + } +}; + +int main() +{ + Test::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..0b402e1de87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// + +[XmlType(Namespace="http://www.cpandl.com", +TypeName="GroupMember")] +public ref class Person +{ +public: + String^ Name; +}; + + +[XmlType(Namespace="http://www.cohowinery.com", +TypeName="GroupAddress")] +public ref class Address +{ +public: + String^ Line1; + String^ Line2; + String^ City; + String^ State; + String^ Zip; +}; + +public ref class Group +{ +public: + array^Staff; + Person^ Manager; + Address^ Location; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp new file mode 100644 index 00000000000..592b8ccb053 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.IncludeInSchema Example/CPP/source.cpp @@ -0,0 +1,15 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// + +[XmlType(IncludeInSchema=false)] +public ref class ExtraneousInfo{}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp new file mode 100644 index 00000000000..04919033ae5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.Namespace Example/CPP/source.cpp @@ -0,0 +1,15 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// + +[XmlType(Namespace="http://www.cpandl.com")] +public ref class Book{}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp new file mode 100644 index 00000000000..87847fcbb3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Classic XmlTypeAttribute.TypeName Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// +ref class Person; +ref class Job; +ref class Group +{ +public: + array^Staff; +}; + + +[XmlType(TypeName="Employee", +Namespace="http://www.cpandl.com")] +public ref class Person +{ +public: + String^ PersonName; + Job^ Position; +}; + + +[XmlType(TypeName="Occupation", +Namespace="http://www.cohowinery.com")] +public ref class Job +{ +public: + String^ JobName; +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp new file mode 100644 index 00000000000..7064ebe4ae4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ClassicTcpClient.PublicMethodsAndPropertiesExample/CPP/source.cpp @@ -0,0 +1,248 @@ + + +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; +public ref class MyTcpClientExample +{ +public: + + // + // MyTcpClientConstructor is just used to illustrate the different constructors available in in the TcpClient class + static void MyTcpClientConstructor( String^ myConstructorType ) + { + if ( myConstructorType == "IPAddressExample" ) + { + + // + //Creates a TCPClient using a local end point. + IPAddress^ ipAddress = Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ]; + IPEndPoint^ ipLocalEndPoint = gcnew IPEndPoint( ipAddress,11000 ); + TcpClient^ tcpClientA = gcnew TcpClient( ipLocalEndPoint ); + + // + } + else + if ( myConstructorType == "HostNameExample" ) + { + + // + // Creates a TCPClient using hostname and port. + TcpClient^ tcpClientB = gcnew TcpClient( "www.contoso.com",11000 ); + + // + } + else + if ( myConstructorType == "DefaultExample" ) + { + + // + //Creates a TCPClient using the default constructor. + TcpClient^ tcpClientC = gcnew TcpClient; + + // + } + else + { + + // + TcpClient^ tcpClientD = gcnew TcpClient( AddressFamily::InterNetwork ); + + // + } + } + + + // MyTcpClientConnection class is just used to illustrate the different connection methods of the TcpClient class. + static void MyTcpClientConnection( String^ myConnectionType ) + { + if ( myConnectionType == "HostnameExample" ) + { + + // + //Uses a host name and port number to establish a socket connection. + TcpClient^ tcpClient = gcnew TcpClient; + tcpClient->Connect( "www.contoso.com", 11002 ); + + // + tcpClient->Close(); + } + else + if ( myConnectionType == "IPAddressExample" ) + { + + // + //Uses the IP address and port number to establish a socket connection. + TcpClient^ tcpClient = gcnew TcpClient; + IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; + tcpClient->Connect( ipAddress, 11003 ); + + // + tcpClient->Close(); + } + else + if ( myConnectionType == "RemoteEndPointExample" ) + { + + // + //Uses a remote end point to establish a socket connection. + TcpClient^ tcpClient = gcnew TcpClient; + IPAddress^ ipAddress = Dns::Resolve( "www.contoso.com" )->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddress,11004 ); + tcpClient->Connect( ipEndPoint ); + + // + tcpClient->Close(); + } + else + { + + // Do nothing. + } + } + + + // MyTcpClientPropertySetter is just used to illustrate setting and getting various properties of the TcpClient class. + static void MyTcpClientPropertySetter() + { + TcpClient^ tcpClient = gcnew TcpClient; + + // + // sets the receive buffer size using the ReceiveBufferSize public property. + tcpClient->ReceiveBufferSize = 1024; + + // gets the receive buffer size using the ReceiveBufferSize public property. + if ( tcpClient->ReceiveBufferSize == 1024 ) + Console::WriteLine( "The receive buffer was successfully set to {0}", tcpClient->ReceiveBufferSize ); + + + // + // + //sets the send buffer size using the SendBufferSize public property. + tcpClient->SendBufferSize = 1024; + + // gets the send buffer size using the SendBufferSize public property. + if ( tcpClient->SendBufferSize == 1024 ) + Console::WriteLine( "The send buffer was successfully set to {0}", tcpClient->SendBufferSize ); + + + // + // + // Sets the receive time out using the ReceiveTimeout public property. + tcpClient->ReceiveTimeout = 5; + + // Gets the receive time out using the ReceiveTimeout public property. + if ( tcpClient->ReceiveTimeout == 5 ) + Console::WriteLine( "The receive time out limit was successfully set {0}", tcpClient->ReceiveTimeout ); + + + // + // + // sets the send time out using the SendTimeout public property. + tcpClient->SendTimeout = 5; + + // gets the send time out using the SendTimeout public property. + if ( tcpClient->SendTimeout == 5 ) + Console::WriteLine( "The send time out limit was successfully set {0}", tcpClient->SendTimeout ); + + + // + // + // sets the amount of time to linger after closing, using the LingerOption public property. + LingerOption^ lingerOption = gcnew LingerOption( true,10 ); + tcpClient->LingerState = lingerOption; + + // gets the amount of linger time set, using the LingerOption public property. + if ( tcpClient->LingerState->LingerTime == 10 ) + Console::WriteLine( "The linger state setting was successfully set to {0}", tcpClient->LingerState->LingerTime ); + + + // + // + // Sends data immediately upon calling NetworkStream.Write. + tcpClient->NoDelay = true; + + // Determines if the delay is enabled by using the NoDelay property. + if ( tcpClient->NoDelay) + Console::WriteLine( "The delay was set successfully to {0}", tcpClient->NoDelay ); + + + // + tcpClient->Close(); + } + + static void MyTcpClientCommunicator() + { + + // + TcpClient^ tcpClient = gcnew TcpClient; + + // Uses the GetStream public method to return the NetworkStream. + NetworkStream^ netStream = tcpClient->GetStream(); + if ( netStream->CanWrite ) + { + array^sendBytes = Encoding::UTF8->GetBytes( "Is anybody there?" ); + netStream->Write( sendBytes, 0, sendBytes->Length ); + } + else + { + Console::WriteLine( "You cannot write data to this stream." ); + tcpClient->Close(); + + // Closing the tcpClient instance does not close the network stream. + netStream->Close(); + return; + } + + if ( netStream->CanRead ) + { + + // Reads NetworkStream into a byte buffer. + array^bytes = gcnew array(tcpClient->ReceiveBufferSize); + + // Read can return anything from 0 to numBytesToRead. + // This method blocks until at least one byte is read. + netStream->Read( bytes, 0, (int)tcpClient->ReceiveBufferSize ); + + // Returns the data received from the host to the console. + String^ returndata = Encoding::UTF8->GetString( bytes ); + Console::WriteLine( "This is what the host returned to you: {0}", returndata ); + } + else + { + Console::WriteLine( "You cannot read data from this stream." ); + tcpClient->Close(); + + // Closing the tcpClient instance does not close the network stream. + netStream->Close(); + return; + } + + + // + } + +}; + + +//end class +int main() +{ + + // Using the default constructor. + MyTcpClientExample::MyTcpClientConstructor( "DefaultExample" ); + + // Establish a connection by using the hostname and port number. + MyTcpClientExample::MyTcpClientConnection( "HostnameExample" ); + + // Set and verify all communication parameters before attempting communication. + MyTcpClientExample::MyTcpClientPropertySetter(); + + // Send and receive data using tcpClient class. + MyTcpClientExample::MyTcpClientCommunicator(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp new file mode 100644 index 00000000000..9338142454c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ClientSponsor_Register/CPP/clientsponsor_client.cpp @@ -0,0 +1,61 @@ +// System::Runtime::Remoting::Lifetime.ClientSponsor::Register(MarshalByRefObject) +// System::Runtime::Remoting::Lifetime.ClientSponsor::Unregister(MarshalByRefObject) +// System::Runtime::Remoting::Lifetime.ClientSponsor::RenewalTime +// System::Runtime::Remoting::Lifetime.ClientSponsor::InitializeLifetimeService() +// System::Runtime::Remoting::Lifetime.ClientSponsor::Renewal(ILease*) +// System::Runtime::Remoting::Lifetime.ClientSponsor::Close() +// System::Runtime::Remoting::Lifetime.ClientSponsor + +/* The following example demonstrates 'RenewalTime', 'Register', 'UnRegister' and +'Close' methods of 'ClientSponsor' class. +A remote Object* is created and registered with 'ClientSponsor' class. The renewal +time is set. Then the leased time is renewed and the method of remote Object* is invoked. +Finally the remote Object* is unregistered. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Lifetime; + +// +int main() +{ + // Register a channel. + TcpChannel^ myChannel = gcnew TcpChannel; + ChannelServices::RegisterChannel( myChannel ); + RemotingConfiguration::RegisterActivatedClientType( + RemotingSamples::HelloService::typeid, "tcp://localhost:8085/" ); + + // Get the remote Object*. + RemotingSamples::HelloService ^ myService = gcnew RemotingSamples::HelloService; + + // Get a sponsor for renewal of time. + ClientSponsor^ mySponsor = gcnew ClientSponsor; + + // Register the service with sponsor. + mySponsor->Register( myService ); + + // Set renewaltime. + mySponsor->RenewalTime = TimeSpan::FromMinutes( 2 ); + + // Renew the lease. + ILease^ myLease = dynamic_cast(mySponsor->InitializeLifetimeService()); + TimeSpan myTime = mySponsor->Renewal( myLease ); + Console::WriteLine( "Renewed time in minutes is {0}", myTime.Minutes ); + + // Call the remote method. + Console::WriteLine( myService->HelloMethod( "World" ) ); + + // Unregister the channel. + mySponsor->Unregister( myService ); + mySponsor->Close(); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp b/snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp new file mode 100644 index 00000000000..92548f77799 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CommonTransportKeys/CPP/commontransportkeys.cpp @@ -0,0 +1,228 @@ +// System.Runtime.Remoting.Channels.CommonTransportKeys +// System.Runtime.Remoting.Channels.CommonTransportKeys.IPAddress +// System.Runtime.Remoting.Channels.CommonTransportKeys.ConnectionId +// System.Runtime.Remoting.Channels.CommonTransportKeys.RequestUri +/* +This program demonstrates 'CommonTransportKeys' class and the static members 'IPAddress', 'ConnectionId', +'RequestUri'. 'LoggingClientChannelSinkProvider' and 'LoggingServerChannelSinkProvider' classes are +created which inherits'IClientChannelSinkProvider' and 'IServerChannelSinkProvider' respectively. +'ProcessMessage' method is having 'ITransportHeaders' parameter which gives the required header values. + +Note: This snippet assumes CommonTransportKeys_Server.cs, CommonTransportKeys_Client.cs, +CommonTransportKeys_Share.cs files along with channels.config, server.exe.config, client.exe. +config config files. +*/ +#using + +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Permissions; + +namespace Logging +{ + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + private ref class LoggingClientChannelSink: public BaseChannelObjectWithProperties, public IClientChannelSink + { + private: + IClientChannelSink^ nextSink1; + + public: + LoggingClientChannelSink() + : nextSink1( nullptr ) + {} + + LoggingClientChannelSink( IClientChannelSink^ localNextSink ) + : BaseChannelObjectWithProperties() + { + nextSink1 = localNextSink; + } + + + virtual void ProcessMessage( IMessage^ msg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) = IClientChannelSink::ProcessMessage + { + nextSink1->ProcessMessage( msg, requestHeaders, requestStream, responseHeaders, responseStream ); + } + + virtual void AsyncProcessRequest( IClientChannelSinkStack^ sinkStack, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream1 ) + { + sinkStack->Push( this, nullptr ); + nextSink1->AsyncProcessRequest( sinkStack, msg, headers, stream1 ); + } + + virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ sinkStack, Object^ /*state*/, ITransportHeaders^ headers, Stream^ stream1 ) + { + sinkStack->AsyncProcessResponse( headers, stream1 ); + } + + virtual Stream^ GetRequestStream( IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) + { + return nullptr; + } + + property IClientChannelSink^ NextChannelSink + { + virtual IClientChannelSink^ get() + { + return nextSink1; + } + } + }; + + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + public ref class LoggingClientChannelSinkProvider: public IClientChannelSinkProvider + { + private: + IClientChannelSinkProvider^ next1; + + public: + LoggingClientChannelSinkProvider() + : next1( nullptr ) + {} + + virtual IClientChannelSink^ CreateSink( IChannelSender^ channel1, String^ url1, Object^ remoteChannelData ) + { + IClientChannelSink^ localNextSink = nullptr; + if ( next1 != nullptr ) + { + localNextSink = next1->CreateSink( channel1, url1, remoteChannelData ); + if ( localNextSink == nullptr ) + return nullptr; + } + + return gcnew LoggingClientChannelSink( localNextSink ); + } + + property IClientChannelSinkProvider^ Next + { + virtual IClientChannelSinkProvider^ get() + { + return next1; + } + + virtual void set( IClientChannelSinkProvider^ value ) + { + next1 = value; + } + } + }; + + // + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + private ref class LoggingServerChannelSink: public BaseChannelObjectWithProperties, public IServerChannelSink + { + private: + IServerChannelSink^ nextSink2; + bool bEnabled2; + + public: + LoggingServerChannelSink() + : nextSink2( nullptr ), bEnabled2( true ) + {} + + LoggingServerChannelSink( IServerChannelSink^ localNextSink ) + : BaseChannelObjectWithProperties() + { + nextSink2 = localNextSink; + } + + virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% responseMsg, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) = IServerChannelSink::ProcessMessage + { + if ( bEnabled2 ) + { + Console::WriteLine( "----------Request Headers-----------" ); + + // + Console::WriteLine( "{0}:{1}", CommonTransportKeys::IPAddress, + requestHeaders[ CommonTransportKeys::IPAddress ] ); + // + // + Console::WriteLine( "{0}:{1}", CommonTransportKeys::ConnectionId, + requestHeaders[ CommonTransportKeys::ConnectionId ] ); + // + // + Console::WriteLine( "{0}:{1}", CommonTransportKeys::RequestUri, + requestHeaders[ CommonTransportKeys::RequestUri ] ); + // + } + + sinkStack->Push( this, nullptr ); + ServerProcessing processing = nextSink2->ProcessMessage( sinkStack, requestMsg, requestHeaders, requestStream, responseMsg, responseHeaders, responseStream ); + switch ( processing ) + { + case ServerProcessing::Complete: + sinkStack->Pop( this ); + break; + + case ServerProcessing::OneWay: + sinkStack->Pop( this ); + break; + + case ServerProcessing::Async: + sinkStack->Store( this, nullptr ); + break; + } + return processing; + } + + virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ /*state*/, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream1 ) + { + sinkStack->AsyncProcessResponse( msg, headers, stream1 ); + } + + virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) + { + return nullptr; + } + + property IServerChannelSink^ NextChannelSink + { + virtual IServerChannelSink^ get() + { + return nextSink2; + } + } + }; + + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + public ref class LoggingServerChannelSinkProvider: public IServerChannelSinkProvider + { + private: + IServerChannelSinkProvider^ next2; + + public: + LoggingServerChannelSinkProvider() + : next2( nullptr ) + {} + + LoggingServerChannelSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} + + virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){} + + virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel1 ) + { + IServerChannelSink^ localNextSink = nullptr; + if ( next2 != nullptr ) + localNextSink = next2->CreateSink( channel1 ); + + return gcnew LoggingServerChannelSink( localNextSink ); + } + + property IServerChannelSinkProvider^ Next + { + virtual IServerChannelSinkProvider^ get() + { + return next2; + } + + virtual void set( IServerChannelSinkProvider^ value ) + { + next2 = value; + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp new file mode 100644 index 00000000000..393044fb260 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference/CPP/contractreference.cpp @@ -0,0 +1,63 @@ + + +// System::Web::Services::Discovery.ContractReference +/* +The following example demonstrates the 'ContractReference' class . +A new instance of 'ContractReference' class is obtained. The +Contract reference Object* is added to the list of references +contained within the discovery document and a '.disco' file is +generated for the Webservice where the reference tags of +ContractReference are reflected. +*/ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +int main() +{ + try + { + + // Get a DiscoveryDocument. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + + // Get a ContractReference. + ContractReference^ myContractReference = gcnew ContractReference; + + // Set the URL to the referenced service description. + myContractReference->Ref = "http://localhost/service1.asmx?wsdl"; + + // Set the URL for an XML Web service implementing the service + // description. + myContractReference->DocRef = "http://localhost/service1.asmx"; + SoapBinding^ myBinding = gcnew SoapBinding; + myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); + myBinding->Address = "http://localhost/service1.asmx"; + + // Add myContractReference to the list of references contained + // in the discovery document. + myDiscoveryDocument->References->Add( myContractReference ); + + // Add Binding to the references collection. + myDiscoveryDocument->References->Add( myBinding ); + + // Open or create a file for writing. + FileStream^ myFileStream = gcnew FileStream( "Service1.disco",FileMode::OpenOrCreate,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + + // Write myDiscoveryDocument into the passed stream. + myDiscoveryDocument->Write( myStreamWriter ); + Console::WriteLine( "The Service1.disco is generated." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error is {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp new file mode 100644 index 00000000000..e4861522f0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_Contract/CPP/contractreference_contract.cpp @@ -0,0 +1,52 @@ +// System.Web.Services.Discovery.ContractReference.Contract +/* +The following example demonstrates the 'Contract' property of the 'ContractReference' +class. +It creates an instance of 'DiscoveryDocument' class by reading from a disco file +and gets the first reference to a service description in a 'ContractReference' instance. +Using the 'Contract' property of the 'ContractReference' instance it creates a wsdl +file which works as a service description file. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Net; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Web::Services::Description; + +// +int main() +{ + try + { + // Create the file stream. + FileStream^ discoStream = gcnew FileStream( "Service1_CS.disco",FileMode::Open ); + + // Create the discovery document. + DiscoveryDocument^ myDiscoveryDocument = DiscoveryDocument::Read( discoStream ); + + // Get the first ContractReference in the collection. + ContractReference^ myContractReference = dynamic_cast(myDiscoveryDocument->References[ 0 ]); + + // Set the client protocol. + myContractReference->ClientProtocol = gcnew DiscoveryClientProtocol; + myContractReference->ClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // Get the service description. + ServiceDescription^ myContract = myContractReference->Contract; + + // Create the service description file. + myContract->Write( "MyService1.wsdl" ); + Console::WriteLine( "The WSDL file created is MyService1.wsdl" ); + discoStream->Close(); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Exception: {0}", ex->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp new file mode 100644 index 00000000000..e61ce94cb75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_DefaultFileName/CPP/contractreference_defaultfilename.cpp @@ -0,0 +1,41 @@ +// System.Web.Services.Discovery.ContractReference.DefaultFileName +// System.Web.Services.Discovery.ContractReference.Url +/* +The following example demonstrates the 'DefaultFilename' and 'Url' properties of +'ContractReference' class. It gets the 'DiscoveryDocument' object using the +'Discover' method of 'DiscoveryClientProtocol' class. It gets the 'ContractReference' +object by using the 'References' property of 'DiscoveryDocument' object.Then it displays the +'DefaultFileName' and 'Url' properties of 'ContractReference'. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::Xml::Schema; +using namespace System::Collections; + +int main() +{ + // + // + DiscoveryClientProtocol^ myProtocol = gcnew DiscoveryClientProtocol; + + // Get the DiscoveryDocument. + DiscoveryDocument^ myDiscoveryDocument = myProtocol->Discover( "http://localhost/ContractReference/test_cs.disco" ); + ArrayList^ myArrayList = dynamic_cast(myDiscoveryDocument->References); + + // Get the ContractReference. + ContractReference^ myContractRefrence = dynamic_cast(myArrayList[ 0 ]); + + // Get the DefaultFileName associated with the .disco file. + String^ myFileName = myContractRefrence->DefaultFilename; + + // Get the URL associated with the .disco file. + String^ myUrl = myContractRefrence->Url; + Console::WriteLine( "The DefaulFilename is: {0}", myUrl ); + Console::WriteLine( "The URL is: {0}", myUrl ); + // + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp new file mode 100644 index 00000000000..b1f994d4654 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ReadDocument/CPP/contractreference_readdocument.cpp @@ -0,0 +1,37 @@ +// System::Web::Services::Discovery.ContractReference::ReadDocument +/* +* The following example demonstrates the 'ReadDocument' method of the +* 'ContractReference' class. +* It creates an instance of 'ContractReference' class and calls the +* 'ReadDocument' method passing a service description stream and get a +* 'ServiceDescription' instance. +*/ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Web::Services::Description; + +// +int main() +{ + try + { + // Create the file stream. + FileStream^ wsdlStream = gcnew FileStream( "MyService1_cpp.wsdl",FileMode::Open ); + ContractReference^ myContractReference = gcnew ContractReference; + + // Read the service description from the passed stream. + ServiceDescription^ myServiceDescription = dynamic_cast(myContractReference->ReadDocument( wsdlStream )); + Console::Write( "Target Namespace for the service description is: {0}", myServiceDescription->TargetNamespace ); + wsdlStream->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp new file mode 100644 index 00000000000..a906da5b758 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_Reference/CPP/contractreference_ref.cpp @@ -0,0 +1,46 @@ +/* +System::Web::Services::Discovery.ContractReference::ctor +System::Web::Services::Discovery.ContractReference::Ref +System::Web::Services::Discovery.ContractReference::DocRef +System::Web::Services::Discovery.ContractReference::Namespace + +The following example demonstrates the constructor, the +properties 'Ref', 'DocRef' and 'Namespace'. A sample discovery +document is read and 'Ref', 'DocRef' and 'Namespace' properties +are displayed. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Xml; +using namespace System::Web::Services::Discovery; + +int main() +{ + + // + // + // + // + // Call the Constructor of ContractReference. + ContractReference^ myContractReference = gcnew ContractReference; + // + XmlDocument^ myXmlDocument = gcnew XmlDocument; + + // Read the discovery document for the 'contractRef' tag. + myXmlDocument->Load( "http://localhost/Discoverydoc.disco" ); + XmlNode^ myXmlRoot = myXmlDocument->FirstChild; + XmlNode^ myXmlNode = myXmlRoot[ "scl:contractRef" ]; + XmlAttributeCollection^ myAttributeCollection = myXmlNode->Attributes; + myContractReference->Ref = myAttributeCollection[ 0 ]->Value; + Console::WriteLine( "The URL to the referenced service description is : {0}", myContractReference->Ref ); + // + myContractReference->DocRef = myAttributeCollection[ 1 ]->Value; + Console::WriteLine( "The URL implementing the referenced service description is : {0}", myContractReference->DocRef ); + // + Console::WriteLine( "Namespace for the referenced service description is : {0}", ContractReference::Namespace ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp new file mode 100644 index 00000000000..e2220cc74c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_WriteDocument/CPP/contractreference_writedocument.cpp @@ -0,0 +1,45 @@ +/* +The following example demonstrates the 'WriteDocument' method of +'ContractReference' class. It creates a 'ContactReference' and a 'FileStream' Object*. +Then it gets the 'ServiceDescription' Object* corresponding to the 'test.wsdl' file. +Using the 'WriteDocument' method, the 'ServiceDescription' Object* is written into the +file stream. +Note: The 'TestInput_cpp::wsdl' file should exist in the same folder. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::IO; +using namespace System::Web::Services::Description; + +int main() +{ + try + { +// + ContractReference^ myContractReference = gcnew ContractReference; + FileStream^ myFileStream = gcnew FileStream( "TestOutput_cpp.wsdl", + FileMode::OpenOrCreate,FileAccess::Write ); + + // Get the ServiceDescription for the test .wsdl file. + ServiceDescription^ myServiceDescription = + ServiceDescription::Read( "TestInput_cpp.wsdl" ); + + // Write the ServiceDescription into the file stream. + myContractReference->WriteDocument( myServiceDescription, myFileStream ); + Console::WriteLine( "ServiceDescription is written " + + "into the file stream successfully." ); + Console::WriteLine( "The number of bytes written into the file stream: {0}", + myFileStream->Length ); + myFileStream->Close(); +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp new file mode 100644 index 00000000000..a188fe4e240 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor1/CPP/contractreference_ctor1.cpp @@ -0,0 +1,56 @@ +// System::Web::Services::Discovery.ContractReference::ContractReference(String*) + +/* +The following example demonstrates the constructor 'ContractReference(String*)' +of 'ContractReference' class. A 'DiscoveryDocument' Object* is created .The +constructor initializes a new instance of 'ContractReference' using the supplied +reference to a Service Description::The Contract reference Object* is added to the list +of references contained within the discovery document. A '.disco' file is generated +for the webservice, where the reference tags of ContractReference are reflected. +*/ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; + +int main() +{ + try + { + // Create a DiscoveryDocument. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + +// + // Create a ContractReference using a reference to a service description. + ContractReference^ myContractReference = gcnew ContractReference( + "http://localhost/Service1::asmx?wsdl" ); +// + + // Set the URL for an XML Web service implementing the service description. + myContractReference->DocRef = "http://localhost/service1.asmx"; + SoapBinding^ myBinding = gcnew SoapBinding; + myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); + myBinding->Address = "http://localhost/service1.asmx"; + + // Add myContractReference to the list of references contained + // in the discovery document. + myDiscoveryDocument->References->Add( myContractReference ); + myDiscoveryDocument->References->Add( myBinding ); + + // Open or create a file for writing. + FileStream^ myFileStream = gcnew FileStream( "Service1.disco",FileMode::OpenOrCreate,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + + // Write myDiscoveryDocument into the passed stream. + myDiscoveryDocument->Write( myStreamWriter ); + Console::WriteLine( "The Service1.disco is generated." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error is {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp new file mode 100644 index 00000000000..ce3f7b776af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ContractReference_ctor2/CPP/contractreference_ctor2.cpp @@ -0,0 +1,57 @@ +// System::Web::Services::Discovery.ContractReference::ContractReference(String*, String*) + +/* +The following example demonstrates the constructor 'ContractReference(String*, String*)' +of 'ContractReference' class. In this example the 'ContractReference' class constructor +initializes a new instance of the 'ContractReference' class using the supplied references +to a service description and a XML Web service implementing the service description.The +Contract reference Object* is added to the list of references contained within the +discovery document and a '.disco' file is generated for the webservice where the +reference tags of ContractReference are reflected. +*/ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; + +int main() +{ + try + { + // Get a DiscoveryDocument. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + +// + // Create a ContractReference using a service description and + // an XML Web service. + ContractReference^ myContractReference = gcnew ContractReference( + "http://localhost/Service1::asmx?wsdl","http://localhost/Service1::asmx" ); +// + + SoapBinding^ myBinding = gcnew SoapBinding; + myBinding->Binding = gcnew XmlQualifiedName( "q1:Service1Soap" ); + myBinding->Address = "http://localhost/service1.asmx"; + + // Add myContractReference to the list of references contained + // in the discovery document. + myDiscoveryDocument->References->Add( myContractReference ); + myDiscoveryDocument->References->Add( myBinding ); + + // Open or create a file for writing. + FileStream^ myFileStream = gcnew FileStream( "Service1.disco", + FileMode::OpenOrCreate,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + + // Write myDiscoveryDocument into the passed stream. + myDiscoveryDocument->Write( myStreamWriter ); + Console::WriteLine( "The Service1.disco is generated." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error is {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp b/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp new file mode 100644 index 00000000000..14edae82980 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_1/CPP/CookieCollection_Item_1.cpp @@ -0,0 +1,147 @@ + + +/* +This program demonstrates 'Item(string)' and 'Count' properties of 'CookieCollection' class. + +This program uses an internal site called "CookiesServer.aspx". The program creates a 'HttpWebRequest' +object with the 'URL' taken from command line argument. When no cookies are initially sent to +the server, it responds with a specific page querying the client for information. The client queries +this information from the user and sends it to the server in the second request. This information is +used by the server to not only structure the page sent subsequently but also construct some cookies to be +set by the client, for future requests. The response and the cookies that are sent from the server are +displayed to the console. + +Note: This program requires the "CookiesServer.aspx" server to be running before the execution of this +program.Please refer the "ReadmeCookiesServer.txt" file for setting up the server. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Text::RegularExpressions; +void DisplayCookies( CookieCollection^ cookies ) +{ + // + // + // Get the cookies in the 'CookieCollection' object using the 'Item' property. + // The 'Item' property in C++ is implemented through Indexers. + // The class that implements indexers is usually a collection of other objects. + // This class provides access to those objects with the '[i]' syntax. + try + { + if ( cookies->Count == 0 ) + { + Console::WriteLine( "No cookies to display" ); + return; + } + + Console::WriteLine( "{0}", cookies[ "UserName" ] ); + Console::WriteLine( "{0}", cookies[ "DateOfBirth" ] ); + Console::WriteLine( "{0}", cookies[ "PlaceOfBirth" ] ); + Console::WriteLine( "" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); + } + // + // +} + +void printUsage() +{ + Console::WriteLine( "Usage : " ); + Console::WriteLine( "CookieCollection_Item_1 " ); + Console::WriteLine( " is the name of the CookiesServer.aspx site installed locally" ); + Console::WriteLine( "\nExample : CookieCollection_Item_1 http://www.MyServer.com/CookiesServer.aspx" ); +} + +void GetPage( Uri^ requestUri ) +{ + try + { + array^output = gcnew array(120); + Stream^ myStream; + Encoding^ asciiEncoding = gcnew ASCIIEncoding; + + // Create the request. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); + + // Get the response without any cookies sent to the server. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + String^ usrName; + String^ dateBirth; + String^ placeBirth; + + // Get the information from the user as requested by the server and send it over to the server. + myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); + myHttpWebRequest->Method = "POST"; + myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; + Console::WriteLine( "\nEnter the values to be sent to the server :\n" ); + Console::Write( "UserName : " ); + usrName = Console::ReadLine(); + Console::Write( "\nDateOfBirth [dd/mm/yyyy]: " ); + dateBirth = Console::ReadLine(); + Regex^ regex = gcnew Regex( "/" ); + String^ convertDate = regex->Replace( dateBirth, "%2F" ); + Console::Write( "\nPlaceOfBirth : " ); + placeBirth = Console::ReadLine(); + Console::WriteLine( "" ); + output = asciiEncoding->GetBytes( String::Format( "UserName={0}&DateOfBirth={1}&PlaceOfBirth={2}&__EVENTTARGET=PlaceOfBirth&__EVENTARGUMENT=", usrName, convertDate, placeBirth ) ); + myHttpWebRequest->ContentLength = output->Length; + myStream = myHttpWebRequest->GetRequestStream(); + myStream->Write( output, 0, output->Length ); + myStream->Close(); + myHttpWebResponse->Close(); + + // Get the response. + myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Output the response to the console. + myStream = myHttpWebResponse->GetResponseStream(); + Console::WriteLine( "Displaying the contents of the page of '{0}' site:", requestUri ); + Console::WriteLine( "" ); + int bytesRead = 0; + while ( (bytesRead = myStream->Read( output, 0, output->Length )) != 0 ) + Console::Write( asciiEncoding->GetString( output, 0, bytesRead ) ); + Console::WriteLine( "" ); + Console::WriteLine( "\nDisplaying the cookies in the response : " ); + Console::WriteLine( "" ); + DisplayCookies( myHttpWebResponse->Cookies ); + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException raised.\nError : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); + } + +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + try + { + if ( args->Length < 2 ) + { + printUsage(); + return 0; + } + GetPage( gcnew Uri( args[ 1 ] ) ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "UriFormatException raised.\nError : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); + } + +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp b/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp new file mode 100644 index 00000000000..5f84293fef8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CookieCollection_Item_2/CPP/CookieCollection_Item_2.cpp @@ -0,0 +1,143 @@ + + +/* +This program demonstrates 'Item(int)' properties of 'CookieCollection' class. + +This program uses an internal site called "CookiesServer.aspx". The program creates a 'HttpWebRequest' +object with the 'URL' taken from command line argument. When no cookies are initially sent to +the server, it responds with a specific page querying the client for information. The client queries +this information from the user and sends it to the server in the second request. This information is +used by the server to not only structure the page sent subsequently but also construct some cookies to be +set by the client, for future requests. The response and the cookies that are sent from the server are +displayed to the console. + +Note: This program requires the "CookiesServer.aspx" server to be running before the execution of this +program.Please refer the "ReadmeCookiesServer.txt" file for setting up the server. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Text::RegularExpressions; +void DisplayCookies( CookieCollection^ cookies ) +{ + // + // Get the cookies in the 'CookieCollection' object using the 'Item' property. + // The 'Item' property in C++ is implemented through Indexers. + // The class that implements indexers is usually a collection of other objects. + // This class provides access to those objects with the '[i]' syntax. + try + { + if ( cookies->Count == 0 ) + { + Console::WriteLine( "No cookies to display" ); + return; + } + + for ( int j = 0; j < cookies->Count; j++ ) + Console::WriteLine( "{0}", cookies[ j ] ); + Console::WriteLine( "" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); + } + // +} + +void GetPage( Uri^ requestUri ) +{ + try + { + array^output = gcnew array(120); + Stream^ myStream; + Encoding^ asciiEncoding = gcnew ASCIIEncoding; + + // Create the request. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); + + // Get the response without any cookies sent to the server. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + String^ usrName; + String^ dateBirth; + String^ placeBirth; + + // Get the information from the user as requested by the server and send it over to the server. + myHttpWebRequest = dynamic_cast(WebRequest::Create( requestUri )); + myHttpWebRequest->Method = "POST"; + myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; + Console::WriteLine( "\nEnter the values to be sent to the server :\n" ); + Console::Write( "UserName : " ); + usrName = Console::ReadLine(); + Console::Write( "\nDateOfBirth [dd/mm/yyyy]: " ); + dateBirth = Console::ReadLine(); + Regex^ regex = gcnew Regex( "/" ); + String^ convertDate = regex->Replace( dateBirth, "%2F" ); + Console::Write( "\nPlaceOfBirth : " ); + placeBirth = Console::ReadLine(); + Console::WriteLine( "" ); + output = asciiEncoding->GetBytes( String::Format( "UserName={0}&DateOfBirth={1}&PlaceOfBirth={2}&__EVENTTARGET=PlaceOfBirth&__EVENTARGUMENT=", usrName, convertDate, placeBirth ) ); + myHttpWebRequest->ContentLength = output->Length; + myStream = myHttpWebRequest->GetRequestStream(); + myStream->Write( output, 0, output->Length ); + myStream->Close(); + myHttpWebResponse->Close(); + + // Get the response. + myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Output the response to the console. + myStream = myHttpWebResponse->GetResponseStream(); + Console::WriteLine( "Displaying the contents of the page of '{0}' site:", requestUri ); + Console::WriteLine( "" ); + int bytesRead = 0; + while ( (bytesRead = myStream->Read( output, 0, output->Length )) != 0 ) + Console::Write( asciiEncoding->GetString( output, 0, bytesRead ) ); + Console::WriteLine( "" ); + Console::WriteLine( "\nDisplaying the cookies in the response : " ); + Console::WriteLine( "" ); + DisplayCookies( myHttpWebResponse->Cookies ); + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException raised.\nError : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); + } + +} + +void printUsage() +{ + Console::WriteLine( "Usage : " ); + Console::WriteLine( "CookieCollection_Item_2 " ); + Console::WriteLine( " is the name of the CookiesServer.aspx site installed locally" ); + Console::WriteLine( "\nExample : CookieCollection_Item_2 http://www.MyServer.com/CookiesServer.aspx" ); +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + try + { + if ( args->Length < 2 ) + { + printUsage(); + return 0; + } + GetPage( gcnew Uri( args[ 1 ] ) ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "UriFormatException raised.\nError : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised.\nError : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp b/snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp new file mode 100644 index 00000000000..2426daf471f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CreateObjRef/CPP/example.cpp @@ -0,0 +1,141 @@ + +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Serialization; + +// +// a custom ObjRef class that outputs its status +[System::Security::Permissions::SecurityPermissionAttribute( + System::Security::Permissions::SecurityAction::Demand, + Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::Demand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::InheritanceDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + +public ref class MyObjRef: public ObjRef +{ +private: + + // only instantiate via marshaling or deserialization + MyObjRef(){} + +public: + MyObjRef( MarshalByRefObject^ o, Type^ t ) + : ObjRef( o, t ) + { + Console::WriteLine( "Created MyObjRef." ); + ORDump(); + } + + MyObjRef( SerializationInfo^ i, StreamingContext c ) + : ObjRef( i, c ) + { + Console::WriteLine( "Deserialized MyObjRef." ); + } + + virtual void GetObjectData( SerializationInfo^ s, StreamingContext c ) override + { + + // After calling the base method, change the type from ObjRef to MyObjRef + ObjRef::GetObjectData( s, c ); + s->SetType( GetType() ); + Console::WriteLine( "Serialized MyObjRef." ); + } + + virtual Object^ GetRealObject( StreamingContext context ) override + { + if ( IsFromThisAppDomain() || IsFromThisProcess() ) + { + Console::WriteLine( "Returning actual Object* referenced by MyObjRef." ); + return ObjRef::GetRealObject( context ); + } + else + { + Console::WriteLine( "Returning proxy to remote Object*." ); + return RemotingServices::Unmarshal( this ); + } + } + + void ORDump() + { + Console::WriteLine( " --- Reporting MyObjRef Info --- " ); + Console::WriteLine( "Reference to {0}.", TypeInfo->TypeName ); + Console::WriteLine( "URI is {0}.", URI ); + Console::WriteLine( "\nWriting EnvoyInfo: " ); + if ( EnvoyInfo != nullptr ) + { + IMessageSink^ EISinks = EnvoyInfo->EnvoySinks; + while ( EISinks != nullptr ) + { + Console::WriteLine( "\tSink: {0}", EISinks ); + EISinks = EISinks->NextSink; + } + } + else + Console::WriteLine( "\t {no sinks}" ); + + Console::WriteLine( "\nWriting ChannelInfo: " ); + for ( int i = 0; i < ChannelInfo->ChannelData->Length; i++ ) + Console::WriteLine( "\tChannel: {0}", ChannelInfo->ChannelData[ i ] ); + Console::WriteLine( " ----------------------------- " ); + } +}; + +// a class that uses MyObjRef +public ref class LocalObject: public MarshalByRefObject +{ +public: + + // overriding CreateObjRef will allow us to return a custom ObjRef + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual ObjRef^ CreateObjRef( Type^ t ) override + { + return gcnew MyObjRef( this,t ); + } +}; +// + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Serialization; + +public ref class RemoteObject: public MarshalByRefObject +{ +public: + void Method1( LocalObject^ param ) + { + Console::WriteLine( "Invoked: Method1( {0})", param ); + } + +}; + +int main() +{ + ChannelServices::RegisterChannel( gcnew HttpChannel( 8090 ) ); + RemotingConfiguration::RegisterWellKnownServiceType( RemoteObject::typeid, "RemoteObject", WellKnownObjectMode::Singleton ); + RemoteObject^ RObj = dynamic_cast(Activator::GetObject( RemoteObject::typeid, "http://localhost:8090/RemoteObject" )); + LocalObject^ LObj = gcnew LocalObject; + RObj->Method1( LObj ); + Console::WriteLine( "Press Return to exit..." ); + Console::ReadLine(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp b/snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp new file mode 100644 index 00000000000..3f4dc5fd571 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CreateObjRef2/CPP/example.cpp @@ -0,0 +1,139 @@ + +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Serialization; + +// +// a custom ObjRef class that outputs its status +[System::Security::Permissions::SecurityPermissionAttribute( + System::Security::Permissions::SecurityAction::Demand, + Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::Demand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::InheritanceDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +public ref class MyObjRef: public ObjRef +{ +private: + + // only instantiate using marshaling or deserialization + MyObjRef(){} + +public: + MyObjRef( MarshalByRefObject^ o, Type^ t ) + : ObjRef( o, t ) + { + Console::WriteLine( "Created MyObjRef." ); + ORDump(); + } + + MyObjRef( SerializationInfo^ i, StreamingContext c ) + : ObjRef( i, c ) + { + Console::WriteLine( "Deserialized MyObjRef." ); + } + + virtual void GetObjectData( SerializationInfo^ s, StreamingContext c ) override + { + // After calling the base method, change the type from ObjRef to MyObjRef + ObjRef::GetObjectData( s, c ); + s->SetType( GetType() ); + Console::WriteLine( "Serialized MyObjRef." ); + } + + virtual Object^ GetRealObject( StreamingContext context ) override + { + if ( IsFromThisAppDomain() || IsFromThisProcess() ) + { + Console::WriteLine( "Returning actual Object^ referenced by MyObjRef." ); + return ObjRef::GetRealObject( context ); + } + else + { + Console::WriteLine( "Returning proxy to remote Object^." ); + return RemotingServices::Unmarshal( this ); + } + } + + void ORDump() + { + Console::WriteLine( " --- Reporting MyObjRef Info --- " ); + Console::WriteLine( "Reference to {0}.", TypeInfo->TypeName ); + Console::WriteLine( "URI is {0}.", URI ); + Console::WriteLine( "\nWriting EnvoyInfo: " ); + if ( EnvoyInfo != nullptr ) + { + IMessageSink^ EISinks = EnvoyInfo->EnvoySinks; + while ( EISinks != nullptr ) + { + Console::WriteLine( "\tSink: {0}", EISinks ); + EISinks = EISinks->NextSink; + } + } + else + Console::WriteLine( "\t {no sinks}" ); + + Console::WriteLine( "\nWriting ChannelInfo: " ); + for ( int i = 0; i < ChannelInfo->ChannelData->Length; i++ ) + Console::WriteLine( "\tChannel: {0}", ChannelInfo->ChannelData[ i ] ); + Console::WriteLine( " ----------------------------- " ); + } + +}; + +// a class that uses MyObjRef +public ref class LocalObject: public MarshalByRefObject +{ +public: + + // overriding CreateObjRef will allow us to return a custom ObjRef + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual ObjRef^ CreateObjRef( Type^ t ) override + { + return gcnew MyObjRef( this,t ); + } +}; +// + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Serialization; + +public ref class RemoteObject: public MarshalByRefObject +{ +public: + void Method1( LocalObject^ param ) + { + Console::WriteLine( "Invoked: Method1( {0})", param ); + } +}; + +int main() +{ + ChannelServices::RegisterChannel( gcnew HttpChannel( 8090 ) ); + WellKnownServiceTypeEntry^ wkste = gcnew WellKnownServiceTypeEntry( RemoteObject::typeid,"RemoteObject",WellKnownObjectMode::Singleton ); + RemotingConfiguration::RegisterWellKnownServiceType( wkste ); + RemoteObject^ RObj = dynamic_cast(Activator::GetObject( RemoteObject::typeid, "http://localhost:8090/RemoteObject" )); + LocalObject^ LObj = gcnew LocalObject; + RObj->Method1( LObj ); + Console::WriteLine( "Press Return to exit..." ); + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp new file mode 100644 index 00000000000..30b79abc081 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_Add_Remove/CPP/credentialcache_add_remove.cpp @@ -0,0 +1,84 @@ +// System::Net::CredentialCache->Add;System::Net::CredentialCache::CredentialCache(); +// System::Net::CredentialCache::Remove;System::Net::CredentialCache. + +/*This program demontrates the 'Remove' method, 'Add' method and 'CredentialCache' +constructor of the 'CredentialCache' class. It takes an URL creates a 'WebRequest' Object* for the Url. +The program stores a known set of credentials in a credential cache and removes a credential when it +is no longer needed. +*/ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url, String^ userName, String^ password, String^ domainName ) +{ + try + { +// +// + CredentialCache^ myCredentialCache = gcnew CredentialCache; + // Used Dummy names as credentials. They are to be replaced by credentials applicable locally. + myCredentialCache->Add( gcnew Uri( "http://www.microsoft.com/" ), "Basic", gcnew NetworkCredential( "user1","passwd1","domain1" ) ); + myCredentialCache->Add( gcnew Uri( "http://www.msdn.com/" ), "Basic", gcnew NetworkCredential( "user2","passwd2","domain2" ) ); + myCredentialCache->Add( gcnew Uri( url ), "Basic", gcnew NetworkCredential( userName,password,domainName ) ); + Console::WriteLine( "\nAdded your credentials to the program's CredentialCache" ); +// +// + // Create a webrequest with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( url ); + myWebRequest->Credentials = myCredentialCache; + Console::WriteLine( "\nLinked CredentialCache to your request." ); + // Send the request and wait for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); +// + + // Process response here. + + Console::Write( "Response received successfully." ); + + // Call 'Remove' method to dispose credentials for current Uri as not required further. + myCredentialCache->Remove( myWebRequest->RequestUri, "Basic" ); + Console::WriteLine( "\nYour credentials have now been removed from the program's CredentialCache" ); + myWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + if ( e->Response != nullptr ) + { + Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", (dynamic_cast(e->Response))->StatusDescription ); + } + else + { + Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", e->Status ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } + +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 4 ) + { + Console::WriteLine( "\n Usage:" ); + Console::WriteLine( "\n CredentialCache_Add_Remove " ); + Console::WriteLine( "\n Example: CredentialCache_Add_Remove http://www.microsoft.com Catherine cath$ microsoft" ); + } + else if ( args->Length == 4 ) + GetPage( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ] ); + else + { + Console::WriteLine( "\nInvalid arguments." ); + return 0; + } + + Console::WriteLine( " Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp new file mode 100644 index 00000000000..778e10ae046 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_DefaultCredentials/CPP/credentialcache_defaultcredentials.cpp @@ -0,0 +1,82 @@ + + +// System::Net::CredentialCache::DefaultCredentials. +/* This program demonstrates the 'DefaultCredentials' property of the 'CredentialCache' +class. +Creates an 'HttpWebRequest' Object* to access the local Uri S"http://localhost"(IIS documentation start page) +Assigns the static property 'DefaultCredentials' of 'CredentialCache' as 'Credentials' for the 'HttpWebRequest' +Object*. DefaultCredentials returns the system credentials for the current security context in which +the application is running. For a client-side application, these are usually the Windows credentials +(user name, password, and domain) of the user running the application. +These credentials are used internally to authenticate the request. +The html contents of the start page are displayed to the console. + +Note: Make sure that S"Windows Authentication" has been set as Directory Security settings +for default web site in IIS +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + try + { + // + // Ensure Directory Security settings for default web site in IIS is "Windows Authentication". + String^ url = "http://localhost"; + + // Create a 'HttpWebRequest' object with the specified url. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); + + // Assign the credentials of the logged in user or the user being impersonated. + myHttpWebRequest->Credentials = CredentialCache::DefaultCredentials; + + // Send the 'HttpWebRequest' and wait for response. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + Console::WriteLine( "Authentication successful" ); + Console::WriteLine( "Response received successfully" ); + + // + Console::WriteLine( "\nPress enter to continue" ); + Console::ReadLine(); + + // Get the stream associated with the response object. + Stream^ receiveStream = myHttpWebResponse->GetResponseStream(); + Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); + + // Pipe the stream to a higher level stream reader with the required encoding format. + StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); + Console::WriteLine( "\r\nResponse stream received" ); + array^read = gcnew array(256); + + // Read 256 characters at a time. + int count = readStream->Read( read, 0, 256 ); + Console::WriteLine( "HTML...\r\n" ); + while ( count > 0 ) + { + // Dump the 256 characters on a string and display the string onto the console. + String^ output = gcnew String( read,0,count ); + Console::Write( output ); + count = readStream->Read( read, 0, 256 ); + } + Console::WriteLine( "" ); + + // Release the resources of response Object*. + myHttpWebResponse->Close(); + + // Release the resources of stream Object*. + readStream->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nException Raised. The following error occurred : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp new file mode 100644 index 00000000000..f38f54663af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetCredential/CPP/credentialcache_getcredential.cpp @@ -0,0 +1,86 @@ + + +// System::Net::CredentialCache::GetCredential +/*This program demontrates the 'GetCredential' method of the CredentialCache class. It takes an URL +creates a 'WebRequest' Object* for the Url. The program stores a known set of credentials in a credential cache. +'GetCredential' will then retrieve the credentials for the requested Uri. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Collections; + +// +void Display( NetworkCredential^ credential ) +{ + Console::WriteLine( "\nThe credentials are:" ); + Console::WriteLine( "\nUsername : {0} , Password : {1} , Domain : {2}", credential->UserName, credential->Password, credential->Domain ); +} + +void GetPage( String^ url, String^ userName, String^ password, String^ domainName ) +{ + try + { + CredentialCache^ myCredentialCache = gcnew CredentialCache; + + // Dummy names used as credentials. + myCredentialCache->Add( gcnew Uri( "http://microsoft.com/" ), "Basic", gcnew NetworkCredential( "user1","passwd1","domain1" ) ); + myCredentialCache->Add( gcnew Uri( "http://msdn.com/" ), "Basic", gcnew NetworkCredential( "user2","passwd2","domain2" ) ); + myCredentialCache->Add( gcnew Uri( url ), "Basic", gcnew NetworkCredential( userName,password,domainName ) ); + + // Create a webrequest with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( url ); + + // Call 'GetCredential' to obtain the credentials specific to our Uri. + NetworkCredential^ myCredential = myCredentialCache->GetCredential( gcnew Uri( url ), "Basic" ); + Display( myCredential ); + + // Associating only our credentials. + myWebRequest->Credentials = myCredential; + + // Sends the request and waits for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Process response here. + Console::WriteLine( "\nResponse Received." ); + myWebResponse->Close(); + } + catch ( WebException^ e ) + { + if ( e->Response != nullptr ) + Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", (dynamic_cast(e->Response))->StatusDescription ); + else + Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } +} +// + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 4 ) + { + Console::WriteLine( "\n Usage:" ); + Console::WriteLine( "\n CredentialCache_GetCredential " ); + Console::WriteLine( "\n Example: CredentialCache_GetCredential http://www.microsoft.com Catherine cath$ microsoft" ); + } + else + if ( (args->Length == 4) ) + { + GetPage( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ] ); + } + else + { + Console::WriteLine( "\nInvalid arguments." ); + return 0; + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp new file mode 100644 index 00000000000..86beeaa5a72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CredentialCache_GetEnumerator/CPP/credentialcache_getenumerator.cpp @@ -0,0 +1,92 @@ + + +// System::Net::CredentialCache::GetEnumerator +/*This program demontrates the 'GetEnumerator' method of the CredentialCache class. +It takes an URL, creates a 'WebRequest' Object* for the Url. The program stores a known set of credentials +in a credential cache which is then bound to the request. If the url requested has it's credentials in the cache +the response will be OK . 'GetEnumerator' method is used to enlist all the credentials stored in the +'CredentialCache' Object*. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Collections; + +// +void Display( NetworkCredential^ credential ) +{ + Console::WriteLine( "\n\tUsername : {0} , Password : {1} , Domain : {2}", credential->UserName, credential->Password, credential->Domain ); +} + +void GetPage( String^ url, String^ userName, String^ password, String^ domainName ) +{ + try + { + CredentialCache^ myCredentialCache = gcnew CredentialCache; + + // Dummy Credentials used here. + myCredentialCache->Add( gcnew Uri( "http://microsoft.com/" ), "Basic", gcnew NetworkCredential( "user1","passwd1","domain1" ) ); + myCredentialCache->Add( gcnew Uri( "http://msdn.com/" ), "Basic", gcnew NetworkCredential( "user2","passwd2","domain2" ) ); + myCredentialCache->Add( gcnew Uri( url ), "Basic", gcnew NetworkCredential( userName,password,domainName ) ); + + // Creates a webrequest with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( url ); + myWebRequest->Credentials = myCredentialCache; + IEnumerator^ listCredentials = myCredentialCache->GetEnumerator(); + Console::WriteLine( "\nDisplaying credentials stored in CredentialCache: " ); + while ( listCredentials->MoveNext() ) + Display( dynamic_cast(listCredentials->Current) ); + Console::WriteLine( "\nNow Displaying the same using 'foreach' : " ); + + // Can use foreach with CredentialCache(Since GetEnumerator function of IEnumerable* has been implemented by 'CredentialCache' class. + IEnumerator^ myEnum = myCredentialCache->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + NetworkCredential^ credential = safe_cast(myEnum->Current); + Display( credential ); + } + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Process response here. + Console::WriteLine( "\nResponse Received." ); + myWebResponse->Close(); + } + catch ( WebException^ e ) + { + if ( e->Response != nullptr ) + Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", (dynamic_cast(e->Response))->StatusDescription ); + else + Console::WriteLine( "\r\nFailed to obtain a response. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } +} +// + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 4 ) + { + Console::WriteLine( "\n Usage:" ); + Console::WriteLine( "\n CredentialCache_GetEnumerator " ); + Console::WriteLine( "\n Example: CredentialCache_GetEnumerator http://www.microsoft.com Catherine cath$ microsoft" ); + } + else + if ( args->Length == 4 ) + { + GetPage( args[ 0 ], args[ 1 ], args[ 2 ], args[ 3 ] ); + } + else + { + Console::WriteLine( "\n Invalid arguments." ); + return 0; + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp new file mode 100644 index 00000000000..f2179104c27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/CustomProxy_Attribute_RealProxy/CPP/customproxy_sample.cpp @@ -0,0 +1,250 @@ + + +// System::Runtime::Remoting::Proxies.ProxyAttribute::CreateInstance; +// System::Runtime::Remoting::Proxies.ProxyAttribute::CreateProxy; +// System::Runtime::Remoting::Proxies.RealProxy::SetStubData; +// System::Runtime::Remoting::Proxies.RealProxy::Invoke; +// System::Runtime::Remoting::Proxies.RealProxy::InitializeServerObject; +// System::Runtime::Remoting::Proxies.RealProxy::CreateObjRef; +// System::Runtime::Remoting::Proxies.RealProxy::GetObjectData; +// System::Runtime::Remoting::Proxies.RealProxy::GetTransparentProxy; +// System::Runtime::Remoting::Proxies.RealProxy::GetStubData; +// System::Runtime::Remoting::Proxies.RealProxy::GetProxiedType; +// System::Runtime::Remoting::Proxies.ProxyAttribute; +// System::Runtime::Remoting::Proxies.RealProxy; + +/* The following example demonstrates implementation of methods +'CreateInstance' and 'CreateProxy' of System::Runtime::Remoting::Proxies.ProxyAttribute and methods +'SetStubData', 'Invoke', 'InitializeServerObject', 'CreateObjRef', 'GetStubData', 'GetObjectData', +'GetTransparentProxy', 'GetProxiedType' of System::Runtime::Remoting::Proxies.RealProxy. + +The following program has derived from'ProxyAttribute', 'RealProxy' classes. CustomProxy is implemented by deriving +from 'RealProxy' and overriding 'Invoke' method. The new statement for 'CustomServer' class is intercepted to +derived 'CustomProxyAttribute' by setting 'ProxyAttribute' on the CustomServer class. Implementation of +'RealProxy' and 'ProxyAttribute' methods are shown. +*/ + +// +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Activation; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Security::Permissions; + +ref class CustomServer; + +[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] +public ref class MyProxy: public RealProxy +{ +private: + String^ myUri; + MarshalByRefObject^ myMarshalByRefObject; + +public: + MyProxy() + : RealProxy() + { + Console::WriteLine( "MyProxy Constructor Called..." ); + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( CustomServer::typeid )); + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + myUri = myObjRef->URI; + } + + MyProxy( Type^ type1 ) + : RealProxy( type1 ) + { + Console::WriteLine( "MyProxy Constructor Called..." ); + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( type1 )); + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + myUri = myObjRef->URI; + } + + MyProxy( Type^ type1, MarshalByRefObject^ targetObject ) + : RealProxy( type1 ) + { + Console::WriteLine( "MyProxy Constructor Called..." ); + myMarshalByRefObject = targetObject; + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + myUri = myObjRef->URI; + } + + // + // + virtual IMessage^ Invoke( IMessage^ myMessage ) override + { + Console::WriteLine( "MyProxy 'Invoke method' Called..." ); + if ( dynamic_cast(myMessage) ) + { + Console::WriteLine( "IMethodCallMessage*" ); + } + + if ( dynamic_cast(myMessage) ) + { + Console::WriteLine( "IMethodReturnMessage*" ); + } + + if ( dynamic_cast(myMessage) ) + { + // Initialize a new instance of remote object + IConstructionReturnMessage^ myIConstructionReturnMessage = this->InitializeServerObject( static_cast(myMessage) ); + ConstructionResponse^ constructionResponse = gcnew ConstructionResponse( nullptr,static_cast(myMessage) ); + return constructionResponse; + } + + IDictionary^ myIDictionary = myMessage->Properties; + IMessage^ returnMessage; + myIDictionary[ "__Uri" ] = myUri; + + // Synchronously dispatch messages to server. + returnMessage = ChannelServices::SyncDispatchMessage( myMessage ); + + // Pushing return value and OUT parameters back onto stack. + IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast(returnMessage); + return returnMessage; + } + // + // + + // + virtual ObjRef^ CreateObjRef( Type^ ServerType ) override + { + Console::WriteLine( "CreateObjRef Method Called ..." ); + CustomObjRef ^ myObjRef = gcnew CustomObjRef( myMarshalByRefObject,ServerType ); + myObjRef->URI = myUri; + return myObjRef; + } + // + + // + [System::Security::Permissions::SecurityPermissionAttribute( + System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override + { + // Add your custom data if any here. + RealProxy::GetObjectData( info, context ); + } + // + + [System::Security::Permissions::SecurityPermissionAttribute( + System::Security::Permissions::SecurityAction::Demand, + Flags=System::Security::Permissions::SecurityPermissionFlag::SerializationFormatter)] + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::InheritanceDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + ref class CustomObjRef: public ObjRef + { + public: + CustomObjRef( MarshalByRefObject^ myMarshalByRefObject, Type^ serverType ) + : ObjRef( myMarshalByRefObject, serverType ) + { + Console::WriteLine( "ObjRef 'Constructor' called" ); + } + + // Override this method to store custom data. + virtual void GetObjectData( SerializationInfo^ info, StreamingContext context ) override + { + ObjRef::GetObjectData( info, context ); + } + }; +}; + +// +[AttributeUsageAttribute(AttributeTargets::Class)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::LinkDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::InheritanceDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +public ref class MyProxyAttribute: public ProxyAttribute +{ +public: + MyProxyAttribute(){} + + // + // Create an instance of ServicedComponentProxy + virtual MarshalByRefObject^ CreateInstance( Type^ serverType ) override + { + return ProxyAttribute::CreateInstance( serverType ); + } + // + + // + // + virtual RealProxy^ CreateProxy( ObjRef^ objRef1, Type^ serverType, Object^ serverObject, Context^ serverContext ) override + { + MyProxy^ myCustomProxy = gcnew MyProxy( serverType ); + if ( serverContext != nullptr ) + { + RealProxy::SetStubData( myCustomProxy, serverContext ); + } + + if ( ( !serverType->IsMarshalByRef) && (serverContext == nullptr) ) + { + throw gcnew RemotingException( "Bad Type for CreateProxy" ); + } + + return myCustomProxy; + } + // + // +}; + +[MyProxyAttribute] +ref class CustomServer: public ContextBoundObject +{ +public: + CustomServer() + { + Console::WriteLine( "CustomServer Base Class constructor called" ); + } + + void HelloMethod( String^ str ) + { + Console::WriteLine( "HelloMethod of Server is invoked with message : {0}", str ); + } +}; +// + +// Acts as a custom proxy user. +int main() +{ + Console::WriteLine( "" ); + Console::WriteLine( "CustomProxy Sample" ); + Console::WriteLine( "================" ); + Console::WriteLine( "" ); + + // + // + // + // Create an instance of MyProxy. + MyProxy^ myProxyInstance = gcnew MyProxy( CustomServer::typeid ); + + // Get a CustomServer proxy. + CustomServer^ myHelloServer = static_cast(myProxyInstance->GetTransparentProxy()); + // + + // Get stubdata. + Console::WriteLine( "GetStubData = {0}", RealProxy::GetStubData( myProxyInstance ) ); + // + + // Get ProxyType. + Console::WriteLine( "Type of object represented by RealProxy is : {0}", myProxyInstance->GetProxiedType() ); + // + + myHelloServer->HelloMethod( "RealProxy Sample" ); + Console::WriteLine( "" ); + + // Get a reference object from server. + Console::WriteLine( "Create an objRef object to be marshalled across Application Domains..." ); + ObjRef^ CustomObjRef = myProxyInstance->CreateObjRef( CustomServer::typeid ); + Console::WriteLine( "URI of 'ObjRef' object = {0}", CustomObjRef->URI ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp new file mode 100644 index 00000000000..1b5f86b7e5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_Constructor/CPP/dateclient_socketpermission_constructor.cpp @@ -0,0 +1,168 @@ +/* +This program demonstrates the 'SocketPermission(PermissionState)', +'SocketPermission(NetworkAccess, TransportType, String*, int) constructors, +'FromXml', 'Intersect', 'AddPermission' methods and 'AllPorts' field +of 'SocketPermission' class. + +This program provides a class called 'DateClient' that functions as a client +for a 'DateServer'. A 'DateServer' is a server that provides the current date on +the server in response to a request from a client. The 'DateClient' class +provides a method called 'GetDate' which returns the current date on the server. +The 'GetDate' is the method that shows the use of 'SocketPermission' class. An +instance of 'SocketPermission' is obtained using the 'FromXml' method. Another +instance of 'SocketPermission' is created with the 'SocketPermission(NetworkAccess, +TransportType, String*, int)' constructor. A third 'SocketPermission' Object* is +formed from the intersection of the above two 'SocketPermission' objects with the +use of the 'Intersect' method of 'SocketPermission' class. This 'SocketPermission' +Object* is used by the 'GetDate' method to verify the permissions of the calling +method. If the calling method has the requisite permissions the 'GetDate' method +connects to the 'DateServer' and returns the current date that the 'DateServer' +sends. If any exception occurs the 'GetDate' method returns an empty String*. + +Note: This program requires 'DateServer_SocketPermission' program executing. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Collections; +using namespace System::Security; +using namespace System::Security::Permissions; + +void PrintUsage() +{ + Console::WriteLine( "Usage : DateClient_SocketPermission_Constructor" ); + Console::WriteLine( "\tDateClient_SocketPermission_Constructor " ); + Console::WriteLine( "\tThe ipaddress argument is the ip address of the Date server." ); + Console::WriteLine( "\tThe port argument is the port of the Date server." ); +} + +public ref class DateClient +{ +private: + Socket^ serverSocket; + Encoding^ asciiEncoding; + IPAddress^ serverAddress; + + int serverPort; + +public: + // The constructor takes the address and port of the remote server. + DateClient( IPAddress^ ipAddress, int port ) + { + serverAddress = ipAddress; + serverPort = port; + serverSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + asciiEncoding = Encoding::ASCII; + } + + String^ GetDate() + { +// +// +// +// +// +// + SocketPermission^ socketPermission1 = gcnew SocketPermission( PermissionState::Unrestricted ); + + // Create a 'SocketPermission' Object* for two ip addresses. + SocketPermission^ socketPermission2 = gcnew SocketPermission( PermissionState::None ); + SecurityElement^ securityElement1 = socketPermission2->ToXml(); + // 'SocketPermission' Object* for 'Connect' permission + SecurityElement^ securityElement2 = gcnew SecurityElement( "ConnectAccess" ); + // Format to specify ip address are ## + // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and + // for 'All'ports for the ip-address. + SecurityElement^ securityElement3 = gcnew SecurityElement( "URI","192.168.144.238#-1#3" ); + // Second 'SocketPermission' ip-address is '192.168.144.240' for 'All' transport types and + // for 'All' ports for the ip-address. + SecurityElement^ securityElement4 = gcnew SecurityElement( "URI","192.168.144.240#-1#3" ); + securityElement2->AddChild( securityElement3 ); + securityElement2->AddChild( securityElement4 ); + securityElement1->AddChild( securityElement2 ); + + // Obtain a 'SocketPermission' Object* using 'FromXml' method. + socketPermission2->FromXml( securityElement1 ); + + Console::WriteLine( "\nDisplays the result of FromXml method : \n" ); + Console::WriteLine( socketPermission2 ); + + // Create another 'SocketPermission' Object* with two ip addresses. + // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and for 'All' ports for the ip-address. + SocketPermission^ socketPermission3 = + gcnew SocketPermission( NetworkAccess::Connect, + TransportType::All, + "192.168.144.238", + SocketPermission::AllPorts ); + + // Second 'SocketPermission' ip-address is '192.168.144.239' for 'All' transport types and for 'All' ports for the ip-address. + socketPermission3->AddPermission( NetworkAccess::Connect, + TransportType::All, + "192.168.144.239", + SocketPermission::AllPorts ); + + Console::WriteLine( "Displays the result of AddPermission method : \n" ); + Console::WriteLine( socketPermission3 ); + + // Find the intersection between two 'SocketPermission' objects. + socketPermission1 = dynamic_cast(socketPermission2->Intersect( socketPermission3 )); + + Console::WriteLine( "Displays the result of Intersect method :\n " ); + Console::WriteLine( socketPermission1 ); + + // Demand that the calling method have the requsite socket permission. + socketPermission1->Demand(); +// +// +// +// +// +// + // Get the current date from the remote date server. + try + { + int bytesReceived; + array^getByte = gcnew array(100); + serverSocket->Connect( gcnew IPEndPoint( serverAddress,serverPort ) ); + bytesReceived = serverSocket->Receive( getByte, getByte->Length, SocketFlags::None ); + return asciiEncoding->GetString( getByte, 0, bytesReceived ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised : {0}", e->Message ); + return ""; + } + } +}; + +// demonstrates the caller of the 'GetDate' method for the 'DateClient' object. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length != 2 ) + { + PrintUsage(); + return 0; + } + + try + { + DateClient^ myDateClient = gcnew DateClient( IPAddress::Parse( args[ 0 ] ),Int32::Parse( args[ 1 ] ) ); + String^ currentDate = myDateClient->GetDate(); + Console::WriteLine( "The current date and time is : " ); + Console::WriteLine( " {0}", currentDate ); + } + // This exception is thrown by the called method in the context of improper permissions. + catch ( SecurityException^ e ) + { + Console::WriteLine( "\nSecurityException raised : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp b/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp new file mode 100644 index 00000000000..427b6c42002 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DateClient_SocketPermission_ToXml/CPP/dateclient_socketpermission_toxml.cpp @@ -0,0 +1,193 @@ +/* +This program demonstrates the 'ToXml' and 'IsUnrestricted' method and 'ConnectList' property of +'SocketPermission' class. + +This program provides a class called 'DateClient' that functions as a client +for a 'DateServer'. A 'DateServer' is a server that provides the current date on +the server in response to a request from a client. The 'DateClient' class +provides a method called 'GetDate' which returns the current date on the server. +The 'GetDate' is the method that shows the use of 'SocketPermission' class. An +instance of 'SocketPermission' is obtained using the 'FromXml' method. Another +instance of 'SocketPermission' is created with the 'SocketPermission(NetworkAccess, +TransportType, String*, int)' constructor. A third 'SocketPermission' Object* is +formed from the union of the above two 'SocketPermission' objects with the use of the +'Union' method of 'SocketPermission' class. This 'SocketPermission' Object* is used by +the 'GetDate' method to verify the permissions of the calling method. If the calling +method has the requisite permissions the 'GetDate' method connects to the 'DateServer' +and returns the current date that the 'DateServer' sends. If any exception occurs +the 'GetDate' method returns an empty String*. + +Note: This program requires 'DateServer_SocketPermission' program executing. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Collections; +using namespace System::Security; +using namespace System::Security::Permissions; + +void PrintUsage() +{ + Console::WriteLine( "Usage : DateClient_SocketPermission_ToXml" ); + Console::WriteLine( "\tDateClient_SocketPermission_ToXml " ); + Console::WriteLine( "\tThe ipaddress argument is the ip address of the Date server." ); + Console::WriteLine( "\tThe port argument is the port of the Date server." ); +} + +public ref class DateClient +{ +private: + Socket^ serverSocket; + Encoding^ asciiEncoding; + IPAddress^ serverAddress; + int serverPort; + + // The constructor takes the address and port of the remote server. +public: + DateClient( IPAddress^ serverIpAddress, int port ) + { + serverAddress = serverIpAddress; + serverPort = port; + serverSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + asciiEncoding = Encoding::ASCII; + } + +private: + + // Print a security element and all its children, in a depth-first manner. + void PrintSecurityElement( SecurityElement^ securityElementObj, int depth ) + { + Console::WriteLine( "Depth : {0}", depth ); + Console::WriteLine( "Tag : {0}", securityElementObj->Tag ); + Console::WriteLine( "Text : {0}", securityElementObj->Text ); + if ( securityElementObj->Children != nullptr ) + Console::WriteLine( "Children : {0}", securityElementObj->Children->Count ); + + if ( securityElementObj->Attributes != nullptr ) + { + IEnumerator^ attributeEnumerator = securityElementObj->Attributes->GetEnumerator(); + while ( attributeEnumerator->MoveNext() ) + Console::WriteLine( "Attribute - \" {0}\" , Value - \" {1}\"", (dynamic_cast(attributeEnumerator))->Key, (dynamic_cast(attributeEnumerator))->Value ); + } + + Console::WriteLine( "" ); + if ( securityElementObj->Children != nullptr ) + { + depth += 1; + for ( int i = 0; i < securityElementObj->Children->Count; i++ ) + PrintSecurityElement( dynamic_cast(securityElementObj->Children[ i ]), depth ); + } + } + + +public: + String^ GetDate() + { + // + // + // + SocketPermission^ socketPermission1 = gcnew SocketPermission( PermissionState::Unrestricted ); + + // Create a 'SocketPermission' Object* for two ip addresses. + SocketPermission^ socketPermission2 = gcnew SocketPermission( PermissionState::None ); + SecurityElement^ securityElement4 = socketPermission2->ToXml(); + + // 'SocketPermission' Object* for 'Connect' permission + SecurityElement^ securityElement1 = gcnew SecurityElement( "ConnectAccess" ); + + // Format to specify ip address are ## + // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and for 'All' ports for the ip-address. + SecurityElement^ securityElement2 = gcnew SecurityElement( "URI","192.168.144.238#-1#3" ); + + // Second 'SocketPermission' ip-address is '192.168.144.240' for 'All' transport types and for 'All' ports for the ip-address. + SecurityElement^ securityElement3 = gcnew SecurityElement( "URI","192.168.144.240#-1#3" ); + securityElement1->AddChild( securityElement2 ); + securityElement1->AddChild( securityElement3 ); + securityElement4->AddChild( securityElement1 ); + + // Obtain a 'SocketPermission' Object* using 'FromXml' method. + socketPermission2->FromXml( securityElement4 ); + + // Create another 'SocketPermission' Object* with two ip addresses. + // First 'SocketPermission' ip-address is '192.168.144.238' for 'All' transport types and for 'All' ports for the ip-address. + SocketPermission^ socketPermission3 = gcnew SocketPermission( NetworkAccess::Connect,TransportType::All,"192.168.144.238",SocketPermission::AllPorts ); + + // Second 'SocketPermission' ip-address is '192.168.144.239' for 'All' transport types and for 'All' ports for the ip-address. + socketPermission3->AddPermission( NetworkAccess::Connect, TransportType::All, "192.168.144.239", SocketPermission::AllPorts ); + Console::WriteLine( "\nChecks the Socket permissions using IsUnrestricted method : " ); + if ( socketPermission1->IsUnrestricted() ) + Console::WriteLine( "Socket permission is unrestricted" ); + else + Console::WriteLine( "Socket permission is restricted" ); + + Console::WriteLine(); + Console::WriteLine( "Display result of ConnectList property : \n" ); + IEnumerator^ enumerator = socketPermission3->ConnectList; + while ( enumerator->MoveNext() ) + { + Console::WriteLine( "The hostname is : {0}", dynamic_cast(enumerator->Current)->Hostname ); + Console::WriteLine( "The port is : {0}", dynamic_cast(enumerator->Current)->Port ); + Console::WriteLine( "The Transport type is : {0}", dynamic_cast(enumerator->Current)->Transport ); + } + + Console::WriteLine( "" ); + Console::WriteLine( "Display Security Elements :\n " ); + PrintSecurityElement( socketPermission2->ToXml(), 0 ); + + // Get a 'SocketPermission' Object* which is a union of two other 'SocketPermission' objects. + socketPermission1 = dynamic_cast(socketPermission3->Union( socketPermission2 )); + + // Demand that the calling method have the socket permission. + socketPermission1->Demand(); + // + // + // + + // Get the current date from the remote date server. + try + { + int bytesReceived; + array^getByte = gcnew array(100); + serverSocket->Connect( gcnew IPEndPoint( serverAddress,serverPort ) ); + bytesReceived = serverSocket->Receive( getByte, getByte->Length, static_cast(0) ); + return asciiEncoding->GetString( getByte, 0, bytesReceived ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised : {0}", e->Message ); + return ""; + } + } +}; + +// This class is used to demonstrate the caller of the 'GetDate' method for the 'DateClient' Object*. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length != 2 ) + { + PrintUsage(); + return 0; + } + + try + { + DateClient^ myDateClient = gcnew DateClient( IPAddress::Parse( args[ 0 ] ),Int32::Parse( args[ 1 ] ) ); + String^ currentDate = myDateClient->GetDate(); + Console::WriteLine( "The current date and time is : " ); + Console::WriteLine( " {0}", currentDate ); + } + // This exception is thrown by the called method in the context of improper permissions. + catch ( SecurityException^ e ) + { + Console::WriteLine( "\nSecurityException raised : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp b/snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp new file mode 100644 index 00000000000..94ef69ae84a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DescriptionNamespaceSample1/CPP/descriptionnamespacesample1.cpp @@ -0,0 +1,213 @@ +// System.Web.Services.Description.InputBinding.InputBinding(); +// System.Web.Services.Description.InputBinding.Extensions +// System.Web.Services.Description.InputBinding +// System.Web.Services.Description.Message.Message(); +// System.Web.Services.Description.Message.Name; +// System.Web.Services.Description.Message.Parts; +// System.Web.Services.Description.MessageCollection.Add; +// System.Web.Services.Description.MessageCollection.Insert; +// System.Web.Services.Description.MessageCollection; +// System.Web.Services.Description.MessagePart.MessagePart(); +// System.Web.Services.Description.MessagePart.Element; +// System.Web.Services.Description.MessagePart.Name; +// System.Web.Services.Description.MessagePart; +// System.Web.Services.Description.MessagePartCollection.Add; +// System.Web.Services.Description.MessagePartCollection.Insert; + +/* + The following program takes input a WSDL file 'MathService_input.wsdl' with all information related to SOAP protocol + removed from it.In a way it tries to simulate a scenario wherein a service initially did not support a protocol, however later + on happen to support it. + In this example, the WSDL file is modified to insert a new Binding for SOAP. The binding is populated based on + WSDL document structure defined in WSDL specification. The ServiceDescription instance is loaded with values + for 'Messages', 'PortTypes','Bindings', and 'Port'. The instance is then written to an external file 'MathService_new.wsdl'. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +ref class MyClass1 +{ + // + // Creates a Message with name = messageName having one MessagePart + // with name = partName. +public: + static Message^ CreateMessage( String^ messageName, String^ partName, String^ element, String^ targetNamespace ) + { + // + // + Message^ myMessage = gcnew Message; + myMessage->Name = messageName; + // + // + // + // + // + MessagePart^ myMessagePart = gcnew MessagePart; + myMessagePart->Name = partName; + myMessagePart->Element = gcnew XmlQualifiedName( element,targetNamespace ); + myMessage->Parts->Add( myMessagePart ); + // + // + // + // + // + return myMessage; + } + // + + // + // Used to create OperationBinding instances within 'Binding'. + static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) + { + // Create OperationBinding for operation. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = operation; + + // + // + // Create InputBinding for operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + + // + // + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add InputBinding and OutputBinding to OperationBinding. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + + // Create an extensibility element for SoapOperationBinding. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation ); + + // Add the extensibility element SoapOperationBinding to OperationBinding. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + return myOperationBinding; + } + // + + // Used to create Operations under PortType. + static Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) + { + Operation^ myOperation = gcnew Operation; + myOperation->Name = operationName; + OperationMessage^ input = dynamic_cast(gcnew OperationInput); + input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); + OperationMessage^ output = dynamic_cast(gcnew OperationOutput); + output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); + myOperation->Messages->Add( input ); + myOperation->Messages->Add( output ); + return myOperation; + } + + static void main() + { + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cpp.wsdl" ); + // Create SOAP messages. + // + Message^ myMessage = gcnew Message; + myMessage->Name = "AddSoapOut"; + // + MessagePart^ myMessagePart = gcnew MessagePart; + myMessagePart->Name = "parameters"; + myMessagePart->Element = gcnew XmlQualifiedName( "AddResponse",myServiceDescription->TargetNamespace ); + myMessage->Parts->Add( myMessagePart ); + // + myServiceDescription->Messages->Add( myMessage ); + // + // + // + Message^ myMessage1 = gcnew Message; + myMessage1->Name = "AddSoapIn"; + // + MessagePart^ myMessagePart1 = gcnew MessagePart; + myMessagePart1->Name = "parameters"; + myMessagePart1->Element = gcnew XmlQualifiedName( "Add",myServiceDescription->TargetNamespace ); + myMessage1->Parts->Insert( 0, myMessagePart1 ); + // + myServiceDescription->Messages->Insert( 16, myMessage1 ); + // + myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapIn", "parameters", "Subtract", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "SubtractSoapOut", "parameters", "SubtractResponse", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapIn", "parameters", "Multiply", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "MultiplySoapOut", "parameters", "MultiplyResponse", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "DivideSoapIn", "parameters", "Divide", myServiceDescription->TargetNamespace ) ); + myServiceDescription->Messages->Add( CreateMessage( "DivideSoapOut", "parameters", "DivideResponse", myServiceDescription->TargetNamespace ) ); + + // Create a new PortType. + PortType^ soapPortType = gcnew PortType; + soapPortType->Name = "MathServiceSoap"; + soapPortType->Operations->Add( CreateOperation( "Add", "AddSoapIn", "AddSoapOut", myServiceDescription->TargetNamespace ) ); + soapPortType->Operations->Add( CreateOperation( "Subtract", "SubtractSoapIn", "SubtractSoapOut", myServiceDescription->TargetNamespace ) ); + soapPortType->Operations->Add( CreateOperation( "Multiply", "MultiplySoapIn", "MultiplySoapOut", myServiceDescription->TargetNamespace ) ); + soapPortType->Operations->Add( CreateOperation( "Divide", "DivideSoapIn", "DivideSoapOut", myServiceDescription->TargetNamespace ) ); + myServiceDescription->PortTypes->Add( soapPortType ); + + // Create a new Binding for the SOAP protocol. + Binding^ myBinding = gcnew Binding; + myBinding->Name = String::Concat( myServiceDescription->Services[ 0 ]->Name, "Soap" ); + + // Pass the name of the existing PortType MathServiceSoap and the + // Xml TargetNamespace attribute of the Descriptions tag. + myBinding->Type = gcnew XmlQualifiedName( "MathServiceSoap",myServiceDescription->TargetNamespace ); + + // Create a SOAP extensibility element. + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + + // Add tag soap:binding as an extensibility element. + myBinding->Extensions->Add( mySoapBinding ); + + // Create OperationBindings for each of the operations defined + // in the .asmx file. + OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( addOperationBinding ); + OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( subtractOperationBinding ); + OperationBinding^ multiplyOperationBinding = CreateOperationBinding( "Multiply", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( multiplyOperationBinding ); + OperationBinding^ divideOperationBinding = CreateOperationBinding( "Divide", myServiceDescription->TargetNamespace ); + myBinding->Operations->Add( divideOperationBinding ); + myServiceDescription->Bindings->Insert( 0, myBinding ); + Console::WriteLine( "\nTarget namespace of the service description to which the binding was added is: {0}", myServiceDescription->Bindings[ 0 ]->ServiceDescription->TargetNamespace ); + + // Create a Port. + Port^ soapPort = gcnew Port; + soapPort->Name = "MathServiceSoap"; + soapPort->Binding = gcnew XmlQualifiedName( myBinding->Name,myServiceDescription->TargetNamespace ); + + // Create a SoapAddress extensibility element to add to the port. + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/MathService.cs.asmx"; + soapPort->Extensions->Add( mySoapAddressBinding ); + + // Add the port to the MathService, which is the first service in + // the service collection. + myServiceDescription->Services[ 0 ]->Ports->Add( soapPort ); + + // Save the ServiceDescription to an external file. + myServiceDescription->Write( "MathService_new.wsdl" ); + Console::WriteLine( "\nSuccessfully added bindings for SOAP protocol and saved results in the file MathService_new.wsdl" ); + Console::WriteLine( "\n This file should be passed to the WSDL tool as input to generate the proxy" ); + } +}; + +int main() +{ + MyClass1::main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp new file mode 100644 index 00000000000..d293d82792a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection2/CPP/discoveryclientdocumentcollection.cpp @@ -0,0 +1,60 @@ +/* +System::Web::Services::Discovery.DiscoveryClientDocumentCollection + +The following example demonstrates the class 'DiscoveryClientDocumentCollection'. +A sample discovery document is read and the 'Keys' and 'Values' properties +are displayed. +*/ + +// +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Collections; +using namespace System::Web::Services::Discovery; + +int main() +{ + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // 'dataservice.disco' is a sample discovery document. + String^ myStringUrl = "http://localhost/dataservice.disco"; + + // 'Discover' method is called to populate the 'Documents' property. + DiscoveryDocument^ myDiscoveryDocument = + myDiscoveryClientProtocol->Discover( myStringUrl ); + + // An instance of the 'DiscoveryClientDocumentCollection' class is created. + DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = + myDiscoveryClientProtocol->Documents; + + // 'Keys' in the collection are retrieved. + ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys; + array^myObjectCollection = + gcnew array(myDiscoveryClientDocumentCollection->Count); + myCollection->CopyTo( myObjectCollection, 0 ); + Console::WriteLine( "The discovery documents in the collection are :" ); + for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection[ iIndex ] ); + + } + Console::WriteLine( "" ); + + // 'Values' in the collection are retrieved. + ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values; + array^myObjectCollection1 = + gcnew array(myDiscoveryClientDocumentCollection->Count); + myCollection1->CopyTo( myObjectCollection1, 0 ); + Console::WriteLine( "The objects in the collection are :" ); + for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection1[ iIndex ] ); + + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp new file mode 100644 index 00000000000..f41808e363c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_Keys/CPP/discoveryclientdocumentcollection_keys.cpp @@ -0,0 +1,68 @@ +/* +System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Keys +System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Values +System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Contains(String) + +The following example demonstrates the 'Keys', 'Values' properties +and the 'Contains' method. The 'Keys' property returns the names +the discoverydocuments in the 'DiscoveryClientDocumentCollection' and +the 'Values' property returns the type of objects in the +'DiscoveryClientDocumentCollection'. A sample discovery document is read +and the properties 'Keys' and 'Values' and the method 'Contains' are +displayed. +*/ + +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Collections; +using namespace System::Web::Services::Discovery; + +int main() +{ + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // 'dataservice.disco' is a sample discovery document. + String^ myStringUrl = "http://localhost/dataservice.disco"; + + // 'Discover' method is called to populate the 'Documents' property. + myDiscoveryClientProtocol->Discover( myStringUrl ); + DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = + myDiscoveryClientProtocol->Documents; + + // 'Keys' in the collection are retrieved. + // + ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys; + array^myObjectCollection = + gcnew array(myDiscoveryClientDocumentCollection->Count); + myCollection->CopyTo( myObjectCollection, 0 ); + Console::WriteLine( "The discovery documents in the collection are :" ); + for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) + Console::WriteLine( myObjectCollection[ iIndex ] ); + // + + Console::WriteLine( "" ); + + // + // 'Values' in the collection are retrieved. + ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values; + array^myObjectCollection1 = + gcnew array(myDiscoveryClientDocumentCollection->Count); + myCollection1->CopyTo( myObjectCollection1, 0 ); + Console::WriteLine( "The objects in the collection are :" ); + for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) + Console::WriteLine( myObjectCollection1[ iIndex ] ); + // + + Console::WriteLine( "" ); + + // + bool myContains = myDiscoveryClientDocumentCollection->Contains( myStringUrl ); + if ( myContains ) + Console::WriteLine( "The discovery document {0} is present in the Collection", myStringUrl ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp new file mode 100644 index 00000000000..e5595a2be7a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientDocumentCollection_ctor/CPP/discoveryclientdocumentcollection_ctor.cpp @@ -0,0 +1,70 @@ +/* +System::Web::Services::Discovery.DiscoveryClientDocumentCollection::DiscoveryClientDocumentCollection +System::Web::Services::Discovery.DiscoveryClientDocumentCollection->Add +System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Remove +System::Web::Services::Discovery.DiscoveryClientDocumentCollection::Item + +The following example demonstrates the constructor, the 'Add' and +'Remove' methods and the 'Item' property. The method 'Add', adds a +discovery document Object* to the DiscoveryClientDocumentCollection. +The method 'Remove', removes a discovery document Object* from the +DiscoveryClientDocumentCollection. The Item property is used to +retrieve an Object* in the DiscoveryClientDocumentCollection. A sample +discovery document is read and the methods 'Add', 'Remove' and the +property 'Item' are applied on the sample. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Collections; +using namespace System::Web::Services::Discovery; + +int main() +{ + // + // + // + DiscoveryClientDocumentCollection^ myDiscoveryClientDocumentCollection = gcnew DiscoveryClientDocumentCollection; + // + + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + String^ myStringUrl = "http://www.contoso.com/service.disco"; + String^ myStringUrl1 = "http://www.contoso.com/service1.disco"; + myDiscoveryClientDocumentCollection->Add( myStringUrl, myDiscoveryDocument ); + myDiscoveryClientDocumentCollection->Add( myStringUrl1, myDiscoveryDocument ); + // + + myDiscoveryClientDocumentCollection->Remove( myStringUrl1 ); + // + + // + Object^ myObject = myDiscoveryClientDocumentCollection[ myStringUrl ]; + Console::WriteLine( "Object representing the Url : {0}", myObject ); + // + + Console::WriteLine( "" ); + + // 'Keys' in the collection are retrieved. + ICollection^ myCollection = myDiscoveryClientDocumentCollection->Keys; + array^myObjectCollection = gcnew array(myDiscoveryClientDocumentCollection->Count); + myCollection->CopyTo( myObjectCollection, 0 ); + Console::WriteLine( "The discovery documents in the collection are :" ); + for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection[ iIndex ] ); + } + Console::WriteLine( "" ); + + // 'Values' in the collection are retrieved. + ICollection^ myCollection1 = myDiscoveryClientDocumentCollection->Values; + array^myObjectCollection1 = gcnew array(myDiscoveryClientDocumentCollection->Count); + myCollection1->CopyTo( myObjectCollection1, 0 ); + Console::WriteLine( "The objects in the collection are :" ); + for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) + Console::WriteLine( myObjectCollection1[ iIndex ] ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp new file mode 100644 index 00000000000..4f8e4cdbea9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_AdditionalInformation/CPP/discoveryclientprotocol_additionalinformation.cpp @@ -0,0 +1,49 @@ +// System::Web::Services::Discovery.DiscoveryClientProtocol->AdditionalInformation + +/* The following example demonstrates 'AdditionalInformation' of DiscoveryClientProtocol +class. +In the example 'SoapBinding' informations is added to a 'DiscoveryClientProtocol' using +'AdditionalInformation' collection. The soap binding added is retrived back and SoapBinding +address is displayed. The resultant document is written back. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Xml; +using namespace System::Web::Services::Discovery; + +int main() +{ + try + { + // dataservice.disco is a sample discovery document. + String^ myStringUrl = "http://localhost/dataservice.disco"; + + // Call the Discover method to populate the Documents property. + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + myDiscoveryClientProtocol->Discover( myStringUrl ); + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Address = "http://schemas.xmlsoap.org/disco/scl/"; + mySoapBinding->Binding = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); + myDiscoveryClientProtocol->AdditionalInformation->Add( mySoapBinding ); + + // Write the information back. + myDiscoveryClientProtocol->WriteAll( "MyDirectory", "results.discomap" ); + System::Collections::IList^ myIList = myDiscoveryClientProtocol->AdditionalInformation; + mySoapBinding = nullptr; + mySoapBinding = dynamic_cast(myIList[ 0 ]); + Console::WriteLine( "The address of the SoapBinding associated with " + "AdditionalInformation is: {0}", mySoapBinding->Address ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp new file mode 100644 index 00000000000..13d35e01f30 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download/CPP/discoveryclientprotocol_download.cpp @@ -0,0 +1,38 @@ +/* +System::Web::Services::Discovery.DiscoveryClientProtocol::DiscoveryClientProtocol +System::Web::Services::Discovery.DiscoveryClientProtocol::Download(String)* + +The following example demonstrates the 'constructor' and the +method 'Download' of the 'DiscoveryClientProtocol' class. The +'Download' method downloads a discovery document into a stream. +A sample discovery document is read and the method 'download' +is applied on it. +*/ + +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Web::Services::Discovery; + +int main() +{ +// +// + // Call the constructor of the DiscoveryClientProtocol class. + DiscoveryClientProtocol^ myDiscoveryClientProtocol = + gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + // 'dataservice.disco' is a sample discovery document. + String^ myStringUrl = "http://localhost:80/dataservice.disco"; + + Stream^ myStream = myDiscoveryClientProtocol->Download( myStringUrl ); + + Console::WriteLine( "Size of the discovery document downloaded" ); + Console::WriteLine( "is : {0} bytes", myStream->Length ); + myStream->Close(); +// +// +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp new file mode 100644 index 00000000000..03531eb4e6d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Download2/CPP/discoveryclientprotocol_download.cpp @@ -0,0 +1,36 @@ +// System.web.Services.Discovery.DiscoveryClientProtocol.Download(string,string) + +/* +The following example demonstrates the usage of the 'Download' method +of the class 'DiscoveryClientProtocol'. The input to the program is +a discovery file 'MathService_cs.vsdisco'. It generates a 'Stream' +instance of the discovery file 'MathService_cs.vsdisco' from the +'Download' method of 'DiscoveryClientPrototocol' and prints out +the 'contentType' and length in bytes of the discoverydocument. +*/ + +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::Collections; +using namespace System::IO; + +int main() +{ +// + String^ myDiscoFile = "http://localhost/MathService_cs.vsdisco"; + String^ myEncoding = ""; + DiscoveryClientProtocol^ myDiscoveryClientProtocol = + gcnew DiscoveryClientProtocol; + + Stream^ myStream = myDiscoveryClientProtocol->Download( + myDiscoFile, myEncoding ); + Console::WriteLine( "The length of the stream in bytes: {0}", + myStream->Length ); + Console::WriteLine( "The MIME encoding of the downloaded " + + "discovery document: {0}", myEncoding ); + myStream->Close(); +// +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp new file mode 100644 index 00000000000..8f7d7442435 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientProtocol_Errors/CPP/discoveryclientprotocol_errors.cpp @@ -0,0 +1,54 @@ +// System.web.Services.Discovery.DiscoveryClientProtocol.Errors + +/* +The following example demonstrates the usage of the 'Errors' property +of the class 'DiscoveryClientProtocol'. The input to the program is +a discovery file 'MathService_cs.vsdisco', which holds reference +related to 'MathService_cs.asmx' web service. The program is +excecuted first time with existence of the file +'MathService_cs.asmx' in the location as specified in the discovery +file. The file 'MathService_cs.asmx' is removed from the referred +location in a way to simulate a scenario wherein the file related +to web service is missing, and the program is excecuted the second time +to show the exception occuring. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::Collections; + +int main() +{ + +// + String^ myDiscoFile = "http://localhost/MathService_cs.vsdisco"; + String^ myUrlKey = "http://localhost/MathService_cs.asmx?wsdl"; + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + + // Get the discovery document. + DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myDiscoFile ); + IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + { + ContractReference^ myContractReference = dynamic_cast(myEnumerator->Current); + + // Get the DiscoveryClientProtocol from the ContractReference. + myDiscoveryClientProtocol = myContractReference->ClientProtocol; + myDiscoveryClientProtocol->ResolveAll(); + DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol->Errors; + if ( myExceptionDictionary->Contains( myUrlKey ) ) + { + Console::WriteLine( "System generated exceptions." ); + + // Get the exception from the DiscoveryExceptionDictionary. + Exception^ myException = myExceptionDictionary[ myUrlKey ]; + Console::WriteLine( " Source : {0}", myException->Source ); + Console::WriteLine( " Exception : {0}", myException->Message ); + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp new file mode 100644 index 00000000000..256a95000a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection/CPP/discoveryclientreferencecollection.cpp @@ -0,0 +1,63 @@ +// System::Web::Services::Discovery.DiscoveryClientReferenceCollection + +/* +The following example demonstrates the class +'DiscoveryClientReferenceCollection'. A sample discovery document +is read and the 'Keys' and 'Values' properties are displayed. A +String* containing the URL of a discovery document is passed as +an argument to 'Contains' method of the instance of the class. +*/ + +// +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Collections; +using namespace System::Web::Services::Discovery; + +int main() +{ + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // 'dataservice.vsdisco' is a sample discovery document. + String^ myStringUrl = "http://localhost/dataservice.vsdisco"; + + // Call the Discover method to populate the References property. + DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); + + // Resolve all references found in the discovery document. + myDiscoveryClientProtocol->ResolveAll(); + DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = myDiscoveryClientProtocol->References; + + // Retrieve the keys from the collection. + ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys; + array^myObjectCollection = gcnew array(myDiscoveryClientReferenceCollection->Count); + myCollection->CopyTo( myObjectCollection, 0 ); + Console::WriteLine( "The discovery documents, service descriptions, and XML schema" ); + Console::WriteLine( " definitions in the collection are: " ); + for ( int i = 0; i < myObjectCollection->Length; i++ ) + { + Console::WriteLine( myObjectCollection[ i ] ); + } + Console::WriteLine( "" ); + + // Retrieve the values from the collection. + ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values; + array^myObjectCollection1 = gcnew array(myDiscoveryClientReferenceCollection->Count); + myCollection1->CopyTo( myObjectCollection1, 0 ); + Console::WriteLine( "The objects in the collection are: " ); + for ( int i = 0; i < myObjectCollection1->Length; i++ ) + { + Console::WriteLine( myObjectCollection1[ i ] ); + } + Console::WriteLine( "" ); + String^ myStringUrl1 = "http://localhost/dataservice.vsdisco"; + if ( myDiscoveryClientReferenceCollection->Contains( myStringUrl1 ) ) + { + Console::WriteLine( "The document reference {0} is part of the collection.", myStringUrl1 ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp new file mode 100644 index 00000000000..97d6c8335c8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Items/CPP/discoveryclientreferencecollection_items.cpp @@ -0,0 +1,75 @@ +/* +System::Web::Services::Discovery.DiscoveryClientReferenceCollection::DiscoveryClientReferenceCollection +System::Web::Services::Discovery.DiscoveryClientReferenceCollection->Add(DiscoveryReference) +System::Web::Services::Discovery.DiscoveryClientReferenceCollection->Add(DiscoveryReference, url) +System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Remove +System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Item + +The following example demonstrates the 'constructor' and various members of +the class 'DiscoveryClientReferenceCollection'. The 'Add(DiscoveryReference)' +method adds a DocumentReference Object* to the DiscoveryClientDocumentCollection +collection. The Add(url, DiscoveryReference) method adds a DiscoveryReference +with the specified Url. The 'Remove' method removes a DiscoveryReference with +the specified Url from the 'DiscoveryClientReferenceCollection' collection. +The 'Item' property gets or sets a DiscoveryReference Object* from the +'DiscoveryClientReferenceCollection' with the specified Url. +*/ + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Web::Services::Discovery; + +int main() +{ + // + // + // + DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = gcnew DiscoveryClientReferenceCollection; + ContractReference^ myContractReference = gcnew ContractReference; + String^ myStringUrl1 = "http://www.contoso.com/service1.disco"; + myContractReference->Ref = myStringUrl1; + myDiscoveryClientReferenceCollection->Add( myContractReference ); + // + // + + // myDiscoveryClientReferenceCollection is an instance collection. + Object^ myObject = myDiscoveryClientReferenceCollection[ myStringUrl1 ]; + Console::WriteLine( "Object representing the URL: {0}", myObject ); + // + + Console::WriteLine( "" ); + + // + // + DiscoveryDocumentReference^ myDiscoveryDocumentReference = gcnew DiscoveryDocumentReference; + String^ myStringUrl = "http://www.contoso.com/service.disco"; + myDiscoveryClientReferenceCollection->Add( myStringUrl, myDiscoveryDocumentReference ); + // + + myDiscoveryClientReferenceCollection->Remove( myStringUrl ); + // + + // Retrieve the keys in the collection. + ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys; + array^myObjectCollection = gcnew array(myDiscoveryClientReferenceCollection->Count); + myCollection->CopyTo( myObjectCollection, 0 ); + Console::WriteLine( "The discovery documents, service descriptions, and" ); + Console::WriteLine( "XML schema definitions in the collection are:" ); + for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection[ iIndex ] ); + } + Console::WriteLine( "" ); + + // Retrieve the values in the collection. + ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values; + array^myObjectCollection1 = gcnew array(myDiscoveryClientReferenceCollection->Count); + myCollection1->CopyTo( myObjectCollection1, 0 ); + Console::WriteLine( "The objects in the collection are:" ); + for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection1[ iIndex ] ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp new file mode 100644 index 00000000000..58015aa26df --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientReferenceCollection_Keys/CPP/discoveryclientreferencecollection_keys.cpp @@ -0,0 +1,67 @@ +/* +System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Keys +System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Values +System::Web::Services::Discovery.DiscoveryClientReferenceCollection::Contains + +The following example demonstrates the 'Keys', 'Values' properties and +the method 'Contains' of the class 'DiscoveryClientReferenceCollection'. A sample +discovery document is read and the 'Keys', 'Values' and 'Contains' properties +are displayed. +*/ + +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Collections; +using namespace System::Web::Services::Discovery; + +int main() +{ +// + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // 'dataservice.disco' is a sample discovery document. + String^ myStringUrl = "http://localhost/dataservice.disco"; + + // Call the Discover method to populate the References property. + DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); + + // Resolve all references found in the discovery document. + myDiscoveryClientProtocol->ResolveAll(); + DiscoveryClientReferenceCollection^ myDiscoveryClientReferenceCollection = myDiscoveryClientProtocol->References; + + // Retrieve the keys in the collection. + ICollection^ myCollection = myDiscoveryClientReferenceCollection->Keys; + array^myObjectCollection = gcnew array(myDiscoveryClientReferenceCollection->Count); + myCollection->CopyTo( myObjectCollection, 0 ); + Console::WriteLine( "The discovery documents, service descriptions, and XML schema" ); + Console::WriteLine( " definitions in the collection are:" ); + for ( int iIndex = 0; iIndex < myObjectCollection->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection[ iIndex ] ); + } +// + Console::WriteLine( "" ); +// + // Retrieve the values in the collection. + ICollection^ myCollection1 = myDiscoveryClientReferenceCollection->Values; + array^myObjectCollection1 = gcnew array(myDiscoveryClientReferenceCollection->Count); + myCollection1->CopyTo( myObjectCollection1, 0 ); + Console::WriteLine( "The objects in the collection are:" ); + for ( int iIndex = 0; iIndex < myObjectCollection1->Length; iIndex++ ) + { + Console::WriteLine( myObjectCollection1[ iIndex ] ); + } +// + Console::WriteLine( "" ); +// + String^ myStringUrl1 = "http://localhost/dataservice.disco"; + if ( myDiscoveryClientReferenceCollection->Contains( myStringUrl1 ) ) + { + Console::WriteLine( "The document reference {0} is part of the collection.", myStringUrl1 ); + } +// +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp new file mode 100644 index 00000000000..8dc400a665b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult/CPP/discoveryclientresult.cpp @@ -0,0 +1,46 @@ + + +// System.Web.Services.DiscoveryClientResult +/* +The following example demonstrates 'DiscoveryClientResult' class. +A 'DiscoveryClientResultCollection' object is obtained by reading a +'.discomap' file which contains the 'DiscoveryClientResult' objects, +representing the details of discovery references. The contents of this +collection are displayed.. +*/ +// +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +int main() +{ + try + { + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + + // Get the collection holding DiscoveryClientResult objects. + DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = myDiscoveryClientProtocol->ReadAll( "results.discomap" ); + Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count ); + Console::WriteLine( "Displaying the items in the collection:" ); + + // Iterate through the collection and display the properties + // of each DiscoveryClientResult in it. + System::Collections::IEnumerator^ myEnum = myDiscoveryClientResultCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DiscoveryClientResult^ myDiscoveryClientResult = safe_cast(myEnum->Current); + Console::WriteLine( "Type of reference in the discovery document: {0}", myDiscoveryClientResult->ReferenceTypeName ); + Console::WriteLine( "Url for the reference: {0}", myDiscoveryClientResult->Url ); + Console::WriteLine( "File for saving the reference: {0}", myDiscoveryClientResult->Filename ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error is {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp new file mode 100644 index 00000000000..0a3223d17da --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultCollection/CPP/discoveryclientresultcollection.cpp @@ -0,0 +1,62 @@ +// System.Web.Services.Discovery.DiscoveryClientResultCollection + +/* +The following example demonstrates 'DiscoveryClientResultCollection' class. +A 'DiscoveryClientResultCollection' object is obtained by reading a '.discomap' file +which contains the 'DiscoveryClientResult' objects, representing the details of +discovery references. An element from the collection is removed and programmatically +added to 'DiscoveryClientResultCollection' class. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Xml::Schema; +using namespace System::Collections; + +int main() +{ + try + { + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + + // Get the collection of DiscoveryClientResult objects. + DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = + myDiscoveryClientProtocol->ReadAll( "results.discomap" ); + Console::WriteLine( "Removing a DiscoveryClientResult from the collection..." ); + + // Remove the first DiscoveryClientResult from the collection. + myDiscoveryClientResultCollection->Remove( myDiscoveryClientResultCollection[ 0 ] ); + Console::WriteLine( "Adding a DiscoveryClientResult to the collection..." ); + DiscoveryClientResult^ myDiscoveryClientResult = gcnew DiscoveryClientResult; + + // Set the DiscoveryDocumentReference class as the type of + // reference in the discovery document. + myDiscoveryClientResult->ReferenceTypeName = + "System.Web.Services.Discovery.DiscoveryDocumentReference"; + + // Set the URL for the reference. + myDiscoveryClientResult->Url = "http://localhost/Discovery/Service1_cs.asmx?disco"; + + // Set the name of the file in which the reference is saved. + myDiscoveryClientResult->Filename = "Service1_cs.disco"; + + // Add myDiscoveryClientResult to the collection. + myDiscoveryClientResultCollection->Add( myDiscoveryClientResult ); + if ( myDiscoveryClientResultCollection->Contains( myDiscoveryClientResult ) ) + { + Console::WriteLine( "Instance of DiscoveryClientResult found in the Collection" ); + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Error is {0}", ex->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp new file mode 100644 index 00000000000..e186c3aeca3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_Filename/CPP/discoveryclientresult_filename.cpp @@ -0,0 +1,96 @@ +// System.Web.Services.Discovery.DiscoveryClientResultCollection.Remove +// System.Web.Services.Discovery.DiscoveryClientResult() +// System.Web.Services.Discovery.DiscoveryClientResult.ReferenceTypeName +// System.Web.Services.Discovery.DiscoveryClientResult.Url +// System.Web.Services.Discovery.DiscoveryClientResult.Filename +// System.Web.Services.Discovery.DiscoveryClientResultCollection.Add +// System.Web.Services.Discovery.DiscoveryClientResultCollection.Contains +// System.Web.Services.Discovery.DiscoveryClientResultCollection.Item + +/* +The following example demonstrates 'ReferenceTypeName' ,'Url','Filename' properties and the +constructor of 'DiscoveryClientResult' class and 'Remove', 'Add' 'Contains' methods and +'Item' property of 'DiscoveryClientResultCollection' class. +A 'DiscoveryClientResultCollection' object is obtained by reading a '.discomap' file +which contains the 'DiscoveryClientResult' objects, representing the details of +discovery references. An element from the collection is removed and programmatically +added to it to show the usage of methods of 'DiscoveryClientResultCollection' class . +The contents of this collection are displayed.. +*/ + +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; + +int main() +{ + try + { + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + + // Get the collection of DiscoveryClientResult objects. + DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = myDiscoveryClientProtocol->ReadAll( "results.discomap" ); + Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count ); + Console::WriteLine( "Removing a DiscoveryClientResult from the collection..." ); + + // + // Remove the first DiscoveryClientResult from the collection. + myDiscoveryClientResultCollection->Remove( myDiscoveryClientResultCollection[ 0 ] ); + // + + Console::WriteLine( "Adding a DiscoveryClientResult to the collection..." ); + + // + // + // + // + // + // Initialize new instance of the DiscoveryClientResult class. + DiscoveryClientResult^ myDiscoveryClientResult = gcnew DiscoveryClientResult; + + // Set the type of reference in the discovery document as + // DiscoveryDocumentReference. + myDiscoveryClientResult->ReferenceTypeName = "System.Web.Services.Discovery.DiscoveryDocumentReference"; + + // Set the URL for the reference. + myDiscoveryClientResult->Url = "http://localhost/Discovery/Service1_cs.asmx?disco"; + + // Set the name of the file in which the reference is saved. + myDiscoveryClientResult->Filename = "Service1_cs.disco"; + + // Add the DiscoveryClientResult to the collection. + myDiscoveryClientResultCollection->Add( myDiscoveryClientResult ); + // + // + // + // + // + + // + if ( myDiscoveryClientResultCollection->Contains( myDiscoveryClientResult ) ) + { + Console::WriteLine( "The collection contains the specified " + "DiscoveryClientResult instance." ); + } + // + + Console::WriteLine( "Displaying the items in collection" ); + + // + for ( int i = 0; i < myDiscoveryClientResultCollection->Count; i++ ) + { + DiscoveryClientResult^ myClientResult = myDiscoveryClientResultCollection[ i ]; + Console::WriteLine( "DiscoveryClientResult {0}", (i + 1) ); + Console::WriteLine( "Type of reference in the discovery document: {0}", myClientResult->ReferenceTypeName ); + Console::WriteLine( "Url for reference:{0}", myClientResult->Url ); + Console::WriteLine( "File for saving the reference: {0}", myClientResult->Filename ); + } + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error is {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp new file mode 100644 index 00000000000..40ff11fefc4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResult_ctor/CPP/discoveryclientresult_ctor.cpp @@ -0,0 +1,64 @@ +// System.Web.Services.Discovery.DiscoveryClientResult(Type,String,String) + +/* +The following example demonstrates the DiscoveryClientResult(Type,String,String) +constructor of 'DiscoveryClientResult' class. +A 'DiscoveryClientResultCollection' object is obtained by reading a '.discomap' file +which contains the 'DiscoveryClientResult' objects, representing the details of +discovery references. A 'DiscoveryClientProtocol' object from the collection is +removed. Then a 'DiscoveryClientProtocol' is created suppling the type of reference +in the discovery document, URL for the reference and name of the file in which the +reference is saved.and programmatically added to it. The contents of this collection +are displayed. +*/ + +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Web::Services::Discovery; + +int main() +{ + try + { + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + + // Get the collection of DiscoveryClientResult objects. + DiscoveryClientResultCollection^ myDiscoveryClientResultCollection = + myDiscoveryClientProtocol->ReadAll( "results.discomap" ); + Console::WriteLine( "The number of DiscoveryClientResult objects: {0}", myDiscoveryClientResultCollection->Count ); + Console::WriteLine( "Removing a DiscoveryClientResult " + "from the collection..." ); + + // Remove first DiscoveryClientResult from the collection. + myDiscoveryClientResultCollection->Remove( myDiscoveryClientResultCollection[ 0 ] ); + Console::WriteLine( "Adding a DiscoveryClientResult " + "to the collection..." ); + + // + // Initialize a new instance of the DiscoveryClientResult class. + DiscoveryClientResult^ myDiscoveryClientResult = + gcnew DiscoveryClientResult( System::Web::Services::Discovery::DiscoveryDocumentReference::typeid, + "http://localhost/Discovery/Service1_cs.asmx?disco","Service1_cs.disco" ); + + // Add the DiscoveryClientResult to the collection. + myDiscoveryClientResultCollection->Add( myDiscoveryClientResult ); + // + + Console::WriteLine( "Displaying the items in the collection" ); + for ( int i = 0; i < myDiscoveryClientResultCollection->Count; i++ ) + { + DiscoveryClientResult^ myClientResult = myDiscoveryClientResultCollection[ i ]; + Console::WriteLine( "DiscoveryClientResult Object {0}", (i + 1) ); + Console::WriteLine( "Type of reference in the discovery document: {0}", myClientResult->ReferenceTypeName ); + Console::WriteLine( "URL for reference: {0}", myClientResult->Url ); + Console::WriteLine( "File for saving the reference: {0}", myClientResult->Filename ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error is {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp new file mode 100644 index 00000000000..331ee9af577 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryClientResultsFile_Results/CPP/discoveryclientresultsfile_results.cpp @@ -0,0 +1,66 @@ + + +// System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoveryClientResultsFile +// System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoveryClientResultsFile.ctor +// System.Web.Services.Discovery.DiscoveryClientProtocol.DiscoveryClientResultsFile.Results +/* +The following example demonstrates the usage of 'DiscoveryClientProtocol. +DiscoveryClientResultsFile' class, constructor 'DiscoveryClientProtocol. +DiscoveryClientResultsFile()' and the property 'Results' of the class. +The input to the program is a VSDisco file 'MathService.vsdisco', which +holds reference to 'MathService' web service. The 'Results' property returns +all valid references of the discovery document 'MathService.vsdisco'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::Net; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +int main() +{ + String^ outputDirectory = "c:\\InetPub\\wwwroot"; + DiscoveryClientProtocol^ myClient = gcnew DiscoveryClientProtocol; + + // Use default credentials to access the URL being discovered. + myClient->Credentials = CredentialCache::DefaultCredentials; + try + { + DiscoveryDocument^ myDocument; + + // Discover the supplied URL to determine if it is a discovery document. + myDocument = myClient->Discover( "http://localhost/MathService_cs.vsdisco" ); + myClient->ResolveAll(); + DiscoveryClientResultCollection^ myCollection = myClient->WriteAll( outputDirectory, "MyDiscoMap.discomap" ); + + // + // + // Get the DiscoveryClientProtocol.DiscoveryClientResultsFile. + DiscoveryClientProtocol::DiscoveryClientResultsFile ^ myResultFile = gcnew DiscoveryClientProtocol::DiscoveryClientResultsFile; + XmlSerializer^ mySerializer = gcnew XmlSerializer( myResultFile->GetType() ); + XmlReader^ reader = gcnew XmlTextReader( "http://localhost/MyDiscoMap.discomap" ); + myResultFile = dynamic_cast(mySerializer->Deserialize( reader )); + + // Get a collection of DiscoveryClientResult objects. + DiscoveryClientResultCollection^ myResultcollection = myResultFile->Results; + Console::WriteLine( "Referred file(s): " ); + System::Collections::IEnumerator^ myEnum = myResultcollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DiscoveryClientResult^ myResult = safe_cast(myEnum->Current); + Console::WriteLine( myResult->Filename ); + } + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp new file mode 100644 index 00000000000..8106396f6fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument/CPP/discoverydocument.cpp @@ -0,0 +1,64 @@ + + +// System::Web::Services::Discovery.DiscoveryDocument +// System::Web::Services::Discovery.DiscoveryDocument::Write(TextWriter) +/* The following example deomonstrates DiscoveryDocument class and the 'Write(Stream)' method +of the 'DiscoveryDocument' class. +A XmlTextReader Object* is created with a sample discovery file and this +is passed to the Read method to create a DiscoveryDocument. The contents +of this document is displayed onto the console using the Write(TextWriter) +method. +*/ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Collections; +int main() +{ + try + { + + // Create an Object* of the 'DiscoveryDocument'. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + + // Create an XmlTextReader with the sample file. + XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/example_cs.disco" ); + + // Read the given XmlTextReader. + myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); + + // + // Write the DiscoveryDocument into the 'TextWriter'. + FileStream^ myFileStream = gcnew FileStream( "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myDiscoveryDocument->Write( myStreamWriter ); + myStreamWriter->Flush(); + myStreamWriter->Close(); + + // + // Display the contents of the DiscoveryDocument onto the console. + FileStream^ myFileStream1 = gcnew FileStream( "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); + StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); + + // Set the file pointer to the begin. + myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); + Console::WriteLine( "The contents of the DiscoveryDocument are-" ); + while ( myStreamReader->Peek() > -1 ) + { + Console::WriteLine( myStreamReader->ReadLine() ); + } + myStreamReader->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp new file mode 100644 index 00000000000..8643d966691 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ReadDocument/CPP/discoverydocumentreference_readdocument.cpp @@ -0,0 +1,44 @@ + + +// System::Web::Services::Discovery.DiscoveryDocumentReference::ReadDocument(stream) +/* +This program demonstrates the 'ReadDocument(stream)' of 'DiscoveryDocumentReference' +class. Read the contents of the discovery document from the stream and returns +discovery document reference. The references of the 'DiscoveryDocumentReference' +are printed. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::IO; +using namespace System::Collections; +int main() +{ + try + { + // + String^ myUrl = "http://localhost/Sample_cs.vsdisco"; + DiscoveryClientProtocol^ myProtocol = gcnew DiscoveryClientProtocol; + DiscoveryDocumentReference^ myReference = gcnew DiscoveryDocumentReference( myUrl ); + Stream^ myFileStream = myProtocol->Download( myUrl ); + DiscoveryDocument^ myDiscoveryDocument = dynamic_cast(myReference->ReadDocument( myFileStream )); + // + + IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); + Console::WriteLine( "\nThe references to the discovery document are : \n" ); + while ( myEnumerator->MoveNext() ) + { + DiscoveryDocumentReference^ myNewReference = dynamic_cast(myEnumerator->Current); + + // Print the discovery document references on the console. + Console::WriteLine( myNewReference->Url ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp new file mode 100644 index 00000000000..25a62274838 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_Properties/CPP/discoverydocumentreference_ctor_properties.cpp @@ -0,0 +1,59 @@ + + +// System::Web::Services::Discovery.DiscoveryDocumentReference::DiscoveryDocumentReference(String*) +// System::Web::Services::Discovery.DiscoveryDocumentReference::Ref +// System::Web::Services::Discovery.DiscoveryDocumentReference::Url +// System::Web::Services::Discovery.DiscoveryDocumentReference::DefaultFileName +/* +This program demonstrates the 'DiscoveryDocumentReference(String*)' Constructor, 'Ref', +'Url', and 'DefaultFileName' properties of the 'DiscoveryDocumentReference' class. +It creates an instance of 'DiscoveryDocumentReference' and displays the 'Ref', 'Url' and +'DefaultFilename' properties. +*/ +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Discovery; + +int main() +{ + try + { + +// + DiscoveryDocumentReference^ myDiscoveryDocumentReference = + gcnew DiscoveryDocumentReference( + "http://localhost/Sample_cpp.disco" ); +// + + Console::WriteLine( "The reference to the discovery document is:" ); + +// + // Display the discovery document reference. + Console::WriteLine( myDiscoveryDocumentReference->Ref ); +// + Console::WriteLine(); + Console::WriteLine( + "The URL of the referenced discovery document is:" ); + +// + // Display the URL of the referenced discovery document. + Console::WriteLine( myDiscoveryDocumentReference->Url ); +// + Console::WriteLine(); + Console::WriteLine( "The name of the default disco file is:" ); + +// + // Display the name of the default file used for reference. + Console::WriteLine( + myDiscoveryDocumentReference->DefaultFilename ); +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp new file mode 100644 index 00000000000..36a4b5400c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocumentReference_ctor_WriteDocument/CPP/discoverydocumentreference_ctor_writedocument.cpp @@ -0,0 +1,61 @@ + + +// System::Web::Services::Discovery.DiscoveryDocumentReference +// System::Web::Services::Discovery.DiscoveryDocumentReference::DiscoveryDocumentReference() +// System::Web::Services::Discovery.DiscoveryDocumentReference::WriteDocument(Object*, Stream) +/* +This program demonstrates the 'DiscoveryDocumentReference' class, default constructor and +'WriteDocument(Object*, Stream)' method of the 'DiscoveryDocumentReference' class. +Discovery file is read by using 'DiscoveryDocument' instance. Write this discovery +document into a file stream and print its contents on the console. +*/ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Discovery; +using namespace System::IO; +using namespace System::Collections; +int main() +{ + try + { + DiscoveryDocument^ myDiscoveryDocument; + XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/Sample_cs::vsdisco" ); + myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); + + // + // Create a new instance of DiscoveryDocumentReference. + DiscoveryDocumentReference^ myDiscoveryDocumentReference = gcnew DiscoveryDocumentReference; + + // + // + FileStream^ myFileStream = gcnew FileStream( "Temp::vsdisco",FileMode::OpenOrCreate,FileAccess::Write ); + myDiscoveryDocumentReference->WriteDocument( myDiscoveryDocument, myFileStream ); + myFileStream->Close(); + + // + FileStream^ myFileStream1 = gcnew FileStream( "Temp::vsdisco",FileMode::OpenOrCreate,FileAccess::Read ); + StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); + + // Initialize the file pointer. + myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); + Console::WriteLine( "The contents of the discovery document are: \n" ); + while ( myStreamReader->Peek() > -1 ) + { + + // Display the contents of the discovery document. + Console::WriteLine( myStreamReader->ReadLine() ); + } + myStreamReader->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp new file mode 100644 index 00000000000..c21d85aea5b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_DiscoveryDocument/CPP/discoverydocument_discoverydocument.cpp @@ -0,0 +1,70 @@ + + +// System::Web::Services::Discovery.DiscoveryDocument::DiscoveryDocument +// System::Web::Services::Discovery.DiscoveryDocument::Namespace +// System::Web::Services::Discovery.DiscoveryDocument::CanRead +// System::Web::Services::Discovery.DiscoveryDocument::Read(XmlReader) +// System::Web::Services::Discovery.DiscoveryDocument::References +/* The following example deomonstrates the 'DiscoveryDocument' constructor, +'Namespace' field, 'References' property and the 'CanRead' and 'Read(XmlReader)' +methods of the 'DiscoveryDocument' class. +The namespace field is displayed onto the console. A XmlTextReader Object* is +created with a sample discovery file and this is passed to the CanRead method +to check whether it is readable. Then we read this file to create a Discovery +document and display the references in the created document. +*/ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Collections; +int main() +{ + try + { + + // Create an Object* of the 'DiscoveryDocument'. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + + // + // Display the 'Namespace' field. + Console::WriteLine( "The namespace is : {0}", DiscoveryDocument::Namespace ); + + // + // Create an XmlTextReader with the sample file. + XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( "http://localhost/example.vsdisco" ); + + // + // + // Check whether the given XmlTextReader is readable. + if ( DiscoveryDocument::CanRead( myXmlTextReader ) ) + + // Read the given XmlTextReader. + myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); + else + Console::WriteLine( "The supplied file is not readable" ); + + // + // + // + // Enumerate the 'References' in the DiscoveryDocument. + IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); + Console::WriteLine( "The 'References' in the discovery document are-" ); + while ( myEnumerator->MoveNext() ) + Console::Write( (dynamic_cast(myEnumerator->Current)->Url) ); + + // + Console::WriteLine(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp new file mode 100644 index 00000000000..4354c6bd9c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write1/CPP/discoverydocument_write1.cpp @@ -0,0 +1,62 @@ +// System::Web::Services::Discovery.DiscoveryDocument::Write(Stream) + +/* The following example deomonstrates the 'Write(Stream)' method +of the 'DiscoveryDocument' class. +A XmlTextReader Object* is created with a sample discovery file and this is +passed to the Read method to create a DiscoveryDocument. The contents of this +document are displayed onto the console using the Write(Stream) method. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Collections; + +int main() +{ + try + { + // + // Create an object of the 'DiscoveryDocument'. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + + // Create an XmlTextReader with the sample file. + XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( + "http://localhost/example_Write1_cs.disco" ); + + // Read the given XmlTextReader. + myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); + + // Write the DiscoveryDocument into the stream. + FileStream^ myFileStream = gcnew FileStream( + "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); + myDiscoveryDocument->Write( myFileStream ); + + myFileStream->Flush(); + myFileStream->Close(); + + // Display the contents of the DiscoveryDocument onto the console. + FileStream^ myFileStream1 = gcnew FileStream( + "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); + StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); + + // Set the file pointer to the begin. + myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); + Console::WriteLine( "The contents of the DiscoveryDocument are-" ); + while ( myStreamReader->Peek() > -1 ) + { + Console::WriteLine( myStreamReader->ReadLine() ); + } + myStreamReader->Close(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp new file mode 100644 index 00000000000..7eb75ffdfb5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryDocument_Write2/CPP/discoverydocument_write2.cpp @@ -0,0 +1,64 @@ +// System::Web::Services::Discovery.DiscoveryDocument::Write(XmlTextWriter) + +/* The following example deomonstrates the 'Write(XmlTextWriter)' method +of the 'DiscoveryDocument' class. +A XmlTextReader Object* is created with a sample discovery file and this is +passed to the Read method to create a DiscoveryDocument. The contents of this +document are displayed onto the console using the Write(XmlTextWriter) method. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Collections; + +int main() +{ + try + { +// + // Create a DiscoveryDocument. + DiscoveryDocument^ myDiscoveryDocument = gcnew DiscoveryDocument; + + // Create an XmlTextReader with the sample file. + XmlTextReader^ myXmlTextReader = gcnew XmlTextReader( + "http://localhost/example_Write2_cs.disco" ); + + // Read the given XmlTextReader. + myDiscoveryDocument = DiscoveryDocument::Read( myXmlTextReader ); + + FileStream^ myFileStream = gcnew FileStream( + "log.txt",FileMode::OpenOrCreate,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + + XmlTextWriter^ myXmlTextWriter = gcnew XmlTextWriter( myStreamWriter ); + myDiscoveryDocument->Write( myXmlTextWriter ); + + myXmlTextWriter->Flush(); + myXmlTextWriter->Close(); + + // Display the contents of the DiscoveryDocument on the console. + FileStream^ myFileStream1 = gcnew FileStream( + "log.txt",FileMode::OpenOrCreate,FileAccess::Read ); + StreamReader^ myStreamReader = gcnew StreamReader( myFileStream1 ); + + // Set the file pointer to the beginning. + myStreamReader->BaseStream->Seek( 0, SeekOrigin::Begin ); + Console::WriteLine( "The contents of the DiscoveryDocument are: " ); + while ( myStreamReader->Peek() > -1 ) + { + Console::WriteLine( myStreamReader->ReadLine() ); + } + myStreamReader->Close(); +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp new file mode 100644 index 00000000000..b231f74defd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryExceptionDictionary_Property_Method/CPP/discoveryexceptiondictionary_property_method.cpp @@ -0,0 +1,115 @@ +// System.Web.Services.Discovery.DiscoveryExceptionDictionary +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Contains +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Item +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Remove +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.DiscoveryExceptionDictionary +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Add +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Keys +// System.Web.Services.Discovery.DiscoveryExceptionDictionary.Values + +/* +The following example demonstrates the usage of the +'DiscoveryExceptionDictionary' class, the constructor +'DiscoveryExceptionDictionary()', the properties 'Item', 'Keys', +'Values' and the methods 'Contains', 'Add' and 'Remove' of the class. +The input to the program is a discovery file 'MathService_cs.disco' +which holds reference related to 'MathService_cs.asmx' web service. +The program is executed first with the file 'MathService_cs.asmx' in +the location as specified in the discovery file. The file +'MathService_cs.asmx' is removed from the referred location in a way to +simulate a scenario wherein the file related to web service is missing, +and the program is excecuted second time to show the exception occuring. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Discovery; +using namespace System::Xml; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Net; + +int main() +{ + String^ myDiscoFile = "http://localhost/MathService_cs.disco"; + String^ myUrlKey = "http://localhost/MathService_cs.asmx?wsdl"; + DiscoveryClientProtocol^ myDiscoveryClientProtocol1 = gcnew DiscoveryClientProtocol; + DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol1->Discover( myDiscoFile ); + IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + { + ContractReference^ myContractReference = dynamic_cast(myEnumerator->Current); + DiscoveryClientProtocol^ myDiscoveryClientProtocol2 = myContractReference->ClientProtocol; + myDiscoveryClientProtocol2->ResolveAll(); + + // + DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol2->Errors; + if ( myExceptionDictionary->Contains( myUrlKey )) + { + Console::WriteLine( "'myExceptionDictionary' contains a discovery exception for the key '{0}'", myUrlKey ); + } + else + { + Console::WriteLine( "'myExceptionDictionary' does not contain a discovery exception for the key '{0}'", myUrlKey ); + } + // + if ( myExceptionDictionary->Contains( myUrlKey ) ) + { + Console::WriteLine( "System generated exceptions." ); + + // + Exception^ myException = myExceptionDictionary[ myUrlKey ]; + Console::WriteLine( " Source : {0}", myException->Source ); + Console::WriteLine( " Exception : {0}", myException->Message ); + // + + Console::WriteLine(); + + // + // Remove the discovery exception.for the key 'myUrlKey'. + myExceptionDictionary->Remove( myUrlKey ); + // + + // + // + DiscoveryExceptionDictionary^ myNewExceptionDictionary = gcnew DiscoveryExceptionDictionary; + + // Add an exception with the custom error message. + Exception^ myNewException = gcnew Exception( "The requested service is not available." ); + myNewExceptionDictionary->Add( myUrlKey, myNewException ); + myExceptionDictionary = myNewExceptionDictionary; + // + // + + Console::WriteLine( "Added exceptions." ); + + // + array^myArray = gcnew array(myExceptionDictionary->Count); + myExceptionDictionary->Keys->CopyTo( (Array^)myArray, 0 ); + Console::WriteLine( " Keys are :" ); + + for each(Object^ myObj in myArray) + { + Console::WriteLine(" " + myObj->ToString()); + } + // + + Console::WriteLine(); + + // + array^myCollectionArray = gcnew array(myExceptionDictionary->Count); + myExceptionDictionary->Values->CopyTo( (Array^)myCollectionArray, 0 ); + Console::WriteLine( " Values are :" ); + for each(Object^ myObj in myCollectionArray) + { + Console::WriteLine(" " + myObj->ToString()); + } + // + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp new file mode 100644 index 00000000000..f9a87f28eac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference/CPP/discoveryreference.cpp @@ -0,0 +1,119 @@ +// System::Web::Services::Discovery.DiscoveryReference::ClientProtocol +// System::Web::Services::Discovery.DiscoveryReference::DefaultFilename +// System::Web::Services::Discovery.DiscoveryReference::WriteDocument(Object*, Stream) +// System::Web::Services::Discovery.DiscoveryReference::ReadDocument(Stream) +// System::Web::Services::Discovery.DiscoveryReference::Url +// System::Web::Services::Discovery.DiscoveryReference::Resolve() +// This program demonstrates 'ClientProtocol', 'WriteDocumant', 'Url' properties +// and 'DefaultFilename', 'readDocument', 'Resolve' methods of 'DiscoveryReference' +// class. DiscoveryReference class is derived in 'MyDiscoveryReferenceClass'. A +// variable of type 'MyDiscoveryReferenceClass' class is taken to demonstrate these +// members. +// Note : The dataservice.disco file should be copied to Inetpub\wwwroot +// + +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Net; + +// Class derived from DiscoveryReference class and overriding its members. +ref class MyDiscoveryReferenceClass: public DiscoveryReference +{ +private: + String^ myDocumentUrl; + +public: + property String^ DefaultFilename + { + virtual String^ get() override + { + return "dataservice.disco"; + } + } + + virtual Object^ ReadDocument( Stream^ stream ) override + { + return stream; + } + + void Resolve() + { + try + { + DiscoveryDocument^ myDiscoveryRefDocument; + myDiscoveryRefDocument = __super::ClientProtocol->Discover( Url ); + } + catch ( Exception^ e ) + { + throw e; + } + } + +protected: + virtual void Resolve( String^ contentType, Stream^ stream ) override {} + +public: + + property String^ Url + { + virtual String^ get() override + { + return myDocumentUrl; + } + + virtual void set( String^ value ) override + { + myDocumentUrl = value; + } + } + virtual void WriteDocument( Object^ document, System::IO::Stream^ stream ) override + { + DiscoveryDocument^ myDiscoveryDocument = dynamic_cast(document); + myDiscoveryDocument->Write( stream ); + } +}; + +int main() +{ + DiscoveryDocument^ myDiscoveryDocument; + StreamReader^ myStreamReader = gcnew StreamReader( "c:\\Inetpub\\wwwroot\\dataservice.disco" ); + FileStream^ myStream = gcnew FileStream( "C:\\MyDiscovery.disco",FileMode::OpenOrCreate ); + Console::WriteLine( "Demonstrating Discovery Reference class." ); + + // Read discovery file. + myDiscoveryDocument = DiscoveryDocument::Read( myStreamReader ); + + // Variable of type DiscoveryReference class defined. + MyDiscoveryReferenceClass^ myDiscoveryReference; + myDiscoveryReference = gcnew MyDiscoveryReferenceClass; + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // Set client protocol. + myDiscoveryReference->ClientProtocol = myDiscoveryClientProtocol; + + // Read the default file name. + Console::WriteLine( "Default file name is: {0}", myDiscoveryReference->DefaultFilename ); + + // Write the document. + myDiscoveryReference->WriteDocument( myDiscoveryDocument, myStream ); + + // Read the document. + myDiscoveryReference->ReadDocument( myStream ); + + // Set the URL. + myDiscoveryReference->Url = "http://localhost/dataservice.disco"; + Console::WriteLine( "Url is: {0}", myDiscoveryReference->Url ); + + // Resolve the URL. + myDiscoveryReference->Resolve(); + myStreamReader->Close(); + myStream->Close(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp new file mode 100644 index 00000000000..2476f726e96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReference1/CPP/discoveryreference.cpp @@ -0,0 +1,122 @@ +// System.Web.Services.Discovery.DiscoveryReference + +/* +This program demonstrates 'DiscoveryReference' class. +DiscoveryReference class is derived in 'MyDiscoveryReferenceClass'. A +variable of type 'MyDiscoveryReferenceClass' class is taken to demonstrate +members of 'MyDiscoveryReferenceClass'. +Note : The dataservice.disco file should be copied to c:\Inetpub\wwwroot +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Discovery; +using namespace System::Net; + +// Class derived from DiscoveryReference class and overriding it members. +ref class MyDiscoveryReferenceClass: public DiscoveryReference +{ +private: + String^ myDocumentUrl; + +public: + property String^ DefaultFilename + { + virtual String^ get() override + { + return "dataservice.disco"; + } + } + + virtual Object^ ReadDocument( Stream^ stream ) override + { + return stream; + } + + void Resolve() + { + try + { + DiscoveryDocument^ myDiscoveryRefDocument; + myDiscoveryRefDocument = DiscoveryReference::ClientProtocol->Discover( Url ); + } + catch ( Exception^ e ) + { + throw e; + } + } + +protected: + virtual void Resolve( String^ /*contentType*/, Stream^ /*stream*/ ) override {} + +public: + property String^ Url + { + virtual String^ get() override + { + return myDocumentUrl; + } + + virtual void set( String^ value ) override + { + myDocumentUrl = value; + } + } + + virtual void WriteDocument( Object^ document, System::IO::Stream^ stream ) override + { + DiscoveryDocument^ myDiscoveryDocument = dynamic_cast(document); + myDiscoveryDocument->Write( stream ); + } +}; + +int main() +{ + try + { + DiscoveryDocument^ myDiscoveryDocument; + StreamReader^ myStreamReader = gcnew StreamReader( "c:\\Inetpub\\wwwroot\\dataservice.disco" ); + FileStream^ myStream = gcnew FileStream( "c:\\MyDiscovery.disco",FileMode::OpenOrCreate ); + Console::WriteLine( "Demonstrating DiscoveryReference class." ); + + // Read discovery file. + myDiscoveryDocument = DiscoveryDocument::Read( myStreamReader ); + + // Create a new instance of the DiscoveryReference class. + MyDiscoveryReferenceClass^ myDiscoveryReference; + myDiscoveryReference = gcnew MyDiscoveryReferenceClass; + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // Set the client protocol. + myDiscoveryReference->ClientProtocol = myDiscoveryClientProtocol; + + // Read the default file name. + Console::WriteLine( "Default file name is: {0}", myDiscoveryReference->DefaultFilename ); + + // Write the document. + myDiscoveryReference->WriteDocument( myDiscoveryDocument, myStream ); + + // Read the document. + myDiscoveryReference->ReadDocument( myStream ); + + // Set the URL. + myDiscoveryReference->Url = "http://localhost/dataservice.disco"; + Console::WriteLine( "Url is: {0}", myDiscoveryReference->Url ); + + // Resolve the URL. + myDiscoveryReference->Resolve(); + myStreamReader->Close(); + myStream->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught! - {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp new file mode 100644 index 00000000000..75dcc210381 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DiscoveryReferenceCollection/CPP/discoveryreferencecollection.cpp @@ -0,0 +1,58 @@ +// System::Web::Services::Discovery.DiscoveryReferenceCollection::DiscoveryReferenceCollection +// System::Web::Services::Discovery.DiscoveryReferenceCollection->Add(DiscoveryReference) +// System::Web::Services::Discovery.DiscoveryReferenceCollection::Contains(DiscoveryReference) +// System::Web::Services::Discovery.DiscoveryReferenceCollection::Item(int) +// System::Web::Services::Discovery.DiscoveryReferenceCollection::Remove(DiscoveryReference) +// System::Web::Services::Discovery.DiscoveryReferenceCollection + +/* The following example demonstrates the usage of 'DiscoveryReferenceCollection' class, 'Add', 'Contains', +* 'Item'and 'Remove' methods and its constructor. A variable of 'DiscoveryReferenceCollection' +* class is taken. Two 'DiscoveryReference' type member is added to the collection. Using this +* various methods of 'DiscoveryReferenceCollection' class are demonstrated. +*/ + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Discovery; + +// +int main() +{ + DiscoveryDocumentReference^ myDiscoveryDocReference1 = gcnew DiscoveryDocumentReference; + DiscoveryDocumentReference^ myDiscoveryDocReference2 = gcnew DiscoveryDocumentReference; + DiscoveryReference^ myDiscoveryReference; + Console::WriteLine( "Demonstrating DiscoveryReferenceCollection class." ); + + // Create new DiscoveryReferenceCollection. + DiscoveryReferenceCollection^ myDiscoveryReferenceCollection = gcnew DiscoveryReferenceCollection; + + // Access the Count method. + Console::WriteLine( "The number of elements in the collection is: {0}", myDiscoveryReferenceCollection->Count ); + + // Add elements to the collection. + myDiscoveryReferenceCollection->Add( myDiscoveryDocReference1 ); + myDiscoveryReferenceCollection->Add( myDiscoveryDocReference2 ); + Console::WriteLine( "The number of elements in the collection after adding two elements to the collection: {0}", myDiscoveryReferenceCollection->Count ); + + // Call the Contains method. + if ( !myDiscoveryReferenceCollection->Contains( myDiscoveryDocReference1 ) ) + { + throw gcnew Exception( "Element not found in collection." ); + } + + // Access the indexed member. + myDiscoveryReference = dynamic_cast(myDiscoveryReferenceCollection[ 0 ]); + if ( myDiscoveryReference == nullptr ) + { + throw gcnew Exception( "Element not found in collection." ); + } + + // Remove one element from collection. + myDiscoveryReferenceCollection->Remove( myDiscoveryDocReference1 ); + Console::WriteLine( "The number of elements in the collection after removing one element is: {0}", myDiscoveryReferenceCollection->Count ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp new file mode 100644 index 00000000000..36bc202ae4d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Discovery_SoapBinding1/CPP/discovery_soapbinding.cpp @@ -0,0 +1,64 @@ + + +// System::Web::Services::Discovery.SoapBinding::SoapBinding +// System::Web::Services::Discovery.SoapBinding->Address +// System::Web::Services::Discovery.SoapBinding::Binding +// System::Web::Services::Discovery.SoapBinding::Namespace +// System::Web::Services::Discovery.SoapBinding +/* The following example demonstrates 'Discovery::SoapBinding' class, its +* constructor, 'Address', 'Binding' and 'Namespace' members. A variable +* of type 'SoapBinding' is created. The properties are set. +* Finally the created 'SoapBinding' is added to 'DiscoveryClientProtocol'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Xml; +using namespace System::Web::Services::Discovery; +int main() +{ + try + { + + // + // 'dataservice.disco' is a sample discovery document. + String^ myStringUrl = "http://localhost/dataservice.disco"; + + // Call the Discover method to populate the Documents property. + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol->Discover( myStringUrl ); + Console::WriteLine( "Demonstrating the Discovery::SoapBinding class." ); + + // Create a SOAP binding. + SoapBinding^ mySoapBinding = gcnew SoapBinding; + + // Assign an address to the created SOAP binding. + mySoapBinding->Address = "http://schemas.xmlsoap.org/disco/scl/"; + + // Bind the created SOAP binding with a new XmlQualifiedName. + mySoapBinding->Binding = gcnew XmlQualifiedName( "String*","http://www.w3.org/2001/XMLSchema" ); + + // Add the created SOAP binding to the DiscoveryClientProtocol. + myDiscoveryClientProtocol->AdditionalInformation->Add( mySoapBinding ); + + // Display the namespace associated with SOAP binding. + Console::WriteLine( "Namespace associated with the SOAP binding is: {0}", SoapBinding::Namespace ); + + // Write all the information of the DiscoveryClientProtocol. + myDiscoveryClientProtocol->WriteAll( ".", "results.discomap" ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp new file mode 100644 index 00000000000..cfe2812f5b9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Constructor/CPP/dnspermission_constructor.cpp @@ -0,0 +1,69 @@ +/* +This program demonstrates the 'Constructor' of 'DnsPermission' class. +It creates an instance of 'DnsPermission' class and checks for permission.Then it +creates a 'SecurityElement' Object* and prints it's attributes which hold the XML +encoding of 'DnsPermission' instance . +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class DnsPermissionExample +{ + // +public: + void useDns() + { + // Create a DnsPermission instance. + DnsPermission^ permission = gcnew DnsPermission( PermissionState::Unrestricted ); + + // Check for permission. + permission->Demand(); + // Create a SecurityElement Object* to hold XML encoding of the DnsPermission instance. + SecurityElement^ securityElementObj = permission->ToXml(); + Console::WriteLine( "Tag, Attributes and Values of 'DnsPermission' instance :" ); + Console::WriteLine( "\n\tTag : {0}", securityElementObj->Tag ); + // Print the attributes and values. + PrintKeysAndValues( securityElementObj->Attributes ); + } + +private: + void PrintKeysAndValues( Hashtable^ myList ) + { + // Get the enumerator that can iterate through the hash table. + IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); + Console::WriteLine( "\n\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } + // +}; + +int main() +{ + try + { + DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; + dnsPermissionExampleObj->useDns(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp new file mode 100644 index 00000000000..0e9c78efb39 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_Copy/CPP/dnspermission_copy.cpp @@ -0,0 +1,67 @@ +/* +This program demonstrates the 'Copy' method of 'DnsPermission' class. +It creates an identical copy of 'DnsPermission' instance. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +class DnsPermissionExample +{ + // +public: + void UseDns() + { + // Create a DnsPermission instance. + DnsPermission^ myPermission = gcnew DnsPermission( PermissionState::Unrestricted ); + // Check for permission. + myPermission->Demand(); + // Create an identical copy of the above 'DnsPermission' Object*. + DnsPermission^ myPermissionCopy = dynamic_cast(myPermission->Copy()); + Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); + // Print the attributes and values. + PrintKeysAndValues( myPermission->ToXml()->Attributes ); + Console::WriteLine( "Attribute and values of copied instance :" ); + PrintKeysAndValues( myPermissionCopy->ToXml()->Attributes ); + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable ) + { + // Get the enumerator that can iterate through the hash table. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } + // +}; + +int main() +{ + try + { + DnsPermissionExample * dnsPermissionExampleObj = new DnsPermissionExample; + dnsPermissionExampleObj->UseDns(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp new file mode 100644 index 00000000000..3674b00df6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_FromXml/CPP/dnspermission_fromxml.cpp @@ -0,0 +1,95 @@ +/* +This program demonstrates the 'FromXml' method of 'DnsPermission' class. +It creates an instance of 'DnsPermission' class and prints the XML encoding of that instance.Then it +creates a 'SecurityElement' Object* and adds the attributes corresponding to the above 'DnsPermission' +Object*. A new 'DnsPermission' instance is reconstructed from the 'SecurityElement' instance by calling +'FromXml' method and it's XML encoding is printed. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class DnsPermissionExample +{ + // +public: + void ConstructDnsPermission() + { + try + { + // Create a DnsPermission instance. + DnsPermission^ permission = gcnew DnsPermission( PermissionState::None ); + // Create a SecurityElement instance by calling the ToXml method on the + // DnsPermission instance. + // Print its attributes, which hold the XML encoding of the DnsPermission + // instance. + Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); + PrintKeysAndValues( permission->ToXml()->Attributes ); + + // Create a SecurityElement instance. + SecurityElement^ securityElementObj = gcnew SecurityElement( "IPermission" ); + // Add attributes and values of the SecurityElement instance corresponding to + // the permission instance. + securityElementObj->AddAttribute( "version", "1" ); + securityElementObj->AddAttribute( "Unrestricted", "true" ); + securityElementObj->AddAttribute( "class", "System.Net.DnsPermission" ); + + // Reconstruct a DnsPermission instance from an XML encoding. + DnsPermission^ permission1 = gcnew DnsPermission( PermissionState::None ); + permission1->FromXml( securityElementObj ); + + // Print the attributes and values of the constructed DnsPermission Object*. + Console::WriteLine( "After reconstruction Attributes and Values of new DnsPermission instance :" ); + PrintKeysAndValues( permission1->ToXml()->Attributes ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "NullReferenceException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + } + +private: + void PrintKeysAndValues( Hashtable^ myList ) + { + // Get the enumerator that can iterate through the hash table. + IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } + // +}; + +int main() +{ + DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; + dnsPermissionExampleObj->ConstructDnsPermission(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp new file mode 100644 index 00000000000..929717f0e2e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsSubsetOf/CPP/dnspermission_issubsetof.cpp @@ -0,0 +1,84 @@ +/* +This program demonstrates the 'IsSubsetOf' method of 'DnsPermission' class. +'IsSubsetOf' method returns true, if the current DnsPermission instance allows no +more access to DNS servers than does the specified 'DnsPermission' instance. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class DnsPermissionExample +{ +private: + DnsPermission^ permission; + + // +public: + void useDns() + { + // Create a DnsPermission instance. + permission = gcnew DnsPermission( PermissionState::Unrestricted ); + DnsPermission^ dnsPermission1 = gcnew DnsPermission( PermissionState::None ); + // Check for permission. + permission->Demand(); + dnsPermission1->Demand(); + // Print the attributes and values. + Console::WriteLine( "Attributes and Values of 'DnsPermission' instance :" ); + PrintKeysAndValues( permission->ToXml()->Attributes ); + Console::WriteLine( "Attributes and Values of specified 'DnsPermission' instance :" ); + PrintKeysAndValues( dnsPermission1->ToXml()->Attributes ); + Subset( dnsPermission1 ); + } + +private: + void Subset( DnsPermission^ Permission1 ) + { + if ( permission->IsSubsetOf( Permission1 ) ) + { + Console::WriteLine( "Current 'DnsPermission' instance is a subset of specified 'DnsPermission' instance." ); + } + else + { + Console::WriteLine( "Current 'DnsPermission' instance is not a subset of specified 'DnsPermission' instance." ); + } + } + + void PrintKeysAndValues( Hashtable^ myList ) + { + // Get the enumerator that can iterate through the hash table. + IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } + // +}; + +int main() +{ + try + { + DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; + dnsPermissionExampleObj->useDns(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp new file mode 100644 index 00000000000..0c760523b02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DnsPermission_IsUnrestricted/CPP/dnspermission_isunrestricted.cpp @@ -0,0 +1,73 @@ +/* +This program demonstrates the 'IsUnrestricted' method of 'DnsPermission' class. +It checks the overall permission state of the Object* and it will return true if the +'DnsPermission' instance was created with unrestricted permission state otherwise false. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class DnsPermissionExample +{ + // +public: + void useDns() + { + // Create a DnsPermission instance. + DnsPermission^ permission = gcnew DnsPermission( PermissionState::Unrestricted ); + // Check for permission. + permission->Demand(); + Console::WriteLine( "Attributes and Values of DnsPermission instance :" ); + // Print the attributes and values. + PrintKeysAndValues( permission->ToXml()->Attributes ); + // Check the permission state. + if ( permission->IsUnrestricted() ) + { + Console::WriteLine( "Overall permissions : Unrestricted" ); + } + else + { + Console::WriteLine( "Overall permissions : Restricted" ); + } + } + +private: + void PrintKeysAndValues( Hashtable^ myList ) + { + // Get the enumerator that can iterate through the hash table. + IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } + // +}; + +int main() +{ + try + { + DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; + dnsPermissionExampleObj->useDns(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp new file mode 100644 index 00000000000..d3f14c02e89 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Dns_Begin_EndResolve/CPP/dns_begin_endresolve.cpp @@ -0,0 +1,80 @@ +/* +This program demonstrates 'BeginResolve' and 'EndResolve' methods of Dns class. +It obtains the 'IPHostEntry' Object* by calling 'BeginResolve' and 'EndResolve' method +of 'Dns' class by passing a URL, a callback function and an instance of 'RequestState' +class.Then prints host name, IP address list and aliases. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Threading; + +// +// +public ref class DnsBeginGetHostByName +{ +public: + static System::Threading::ManualResetEvent^ allDone = nullptr; + ref class RequestState + { + public: + IPHostEntry^ host; + RequestState() + { + host = nullptr; + } + }; + + static void RespCallback( IAsyncResult^ ar ) + { + try + { + // Convert the IAsyncResult* Object* to a RequestState Object*. + RequestState^ tempRequestState = dynamic_cast(ar->AsyncState); + + // End the asynchronous request. + tempRequestState->host = Dns::EndResolve( ar ); + allDone->Set(); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + } +}; + +int main() +{ + DnsBeginGetHostByName::allDone = gcnew ManualResetEvent( false ); + + // Create an instance of the RequestState class. + DnsBeginGetHostByName::RequestState^ myRequestState = + gcnew DnsBeginGetHostByName::RequestState; + + // Begin an asynchronous request for information like host name, IP addresses, or + // aliases for specified the specified URI. + IAsyncResult^ asyncResult = Dns::BeginResolve( "www.contoso.com", + gcnew AsyncCallback( DnsBeginGetHostByName::RespCallback ), myRequestState ); + + // Wait until asynchronous call completes. + DnsBeginGetHostByName::allDone->WaitOne(); + Console::WriteLine( "Host name : {0}", myRequestState->host->HostName ); + Console::WriteLine( "\nIP address list : " ); + for ( int index = 0; index < myRequestState->host->AddressList->Length; index++ ) + Console::WriteLine( myRequestState->host->AddressList[ index ] ); + Console::WriteLine( "\nAliases : " ); + for ( int index = 0; index < myRequestState->host->Aliases->Length; index++ ) + Console::WriteLine( myRequestState->host->Aliases[ index ] ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp new file mode 100644 index 00000000000..500d528483d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByAddress_IPAddress/CPP/dns_gethostbyaddress_ipaddress.cpp @@ -0,0 +1,80 @@ +/* +This program demonstrates 'GetHostByAddress(IPAddress)' method of 'Dns' class. +It takes an IP address String* from commandline or uses default value and creates +an instance of IPAddress for the specified IP address String*. Obtains the IPHostEntry +Object* by calling 'GetHostByAddress' method of 'Dns' class and prints host name, +IP address list and aliases. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +class DnsHostByAddress +{ +public: + void DisplayHostAddress( String^ IpAddressString ) + { + // Call 'GetHostByAddress(IPAddress)' method giving an 'IPAddress' Object* as argument. + // Obtain an 'IPHostEntry' instance, containing address information of the specified host. + // + try + { + IPAddress^ hostIPAddress = IPAddress::Parse( IpAddressString ); + IPHostEntry^ hostInfo = Dns::GetHostByAddress( hostIPAddress ); + + // Get the IP address list that resolves to the host names contained in + // the Alias property. + array^address = hostInfo->AddressList; + + // Get the alias names of the addresses in the IP address list. + array^alias = hostInfo->Aliases; + Console::WriteLine( "Host name : {0}", hostInfo->HostName ); + Console::WriteLine( "\nAliases :" ); + for ( int index = 0; index < alias->Length; index++ ) + Console::WriteLine( alias[ index ] ); + Console::WriteLine( "\nIP address list : " ); + for ( int index = 0; index < address->Length; index++ ) + Console::WriteLine( address[ index ] ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( FormatException^ e ) + { + Console::WriteLine( "FormatException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + // + } +}; + +int main() +{ + String^ IpAddressString = ""; + DnsHostByAddress * myDnsHostByAddress = new DnsHostByAddress; + Console::Write( "Type an IP address (press Enter for default, default is '207.46.131.199'): " ); + IpAddressString = Console::ReadLine(); + if ( IpAddressString->Length > 0 ) + myDnsHostByAddress->DisplayHostAddress( IpAddressString ); + else + myDnsHostByAddress->DisplayHostAddress( "207.46.131.199" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp new file mode 100644 index 00000000000..a65db62149f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostByName/CPP/dns_gethostbyname.cpp @@ -0,0 +1,73 @@ +/* +This program demonstrates 'GetHostByName' method of 'Dns' class. +It takes a URL String* from commandline or uses default value, and obtains +the 'IPHostEntry' Object* by calling 'GetHostByName' method of 'Dns' class.Then +prints host name, IP address list and aliases. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +public ref class DnsHostByName +{ +public: + void DisplayHostName( String^ hostName ) + { + // Call the GetHostByName method passing a DNS style host name(for example, + // S"www.contoso.com") as an argument. + // Obtain the IPHostEntry instance, that contains information of the specified host. + // + try + { + IPHostEntry^ hostInfo = Dns::GetHostByName( hostName ); + + // Get the IP address list that resolves to the host names contained in the + // Alias property. + array^address = hostInfo->AddressList; + + // Get the alias names of the addresses in the IP address list. + array^alias = hostInfo->Aliases; + Console::WriteLine( "Host name : {0}", hostInfo->HostName ); + Console::WriteLine( "\nAliases : " ); + for ( int index = 0; index < alias->Length; index++ ) + Console::WriteLine( alias[ index ] ); + Console::WriteLine( "\nIP address list : " ); + for ( int index = 0; index < address->Length; index++ ) + Console::WriteLine( address[ index ] ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + // + } +}; + +int main() +{ + String^ hostName = ""; + DnsHostByName^ myDnsHostByName = gcnew DnsHostByName; + Console::Write( "Type a URL (press Enter for default, default is 'www.microsoft.net') : " ); + hostName = Console::ReadLine(); + if ( hostName->Length > 0 ) + myDnsHostByName->DisplayHostName( hostName ); + else + myDnsHostByName->DisplayHostName( "www.microsoft.net" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp new file mode 100644 index 00000000000..975e9204362 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Dns_GetHostName/CPP/dns_gethostname.cpp @@ -0,0 +1,45 @@ +/* +This program demonstrates the 'GetHostName' method of 'Dns' class. +It creates a 'DnsHostName' instance and calls 'GetHostName' method to get the local host +computer name. Then prints the computer name on the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +public ref class DnsHostName +{ + // +public: + void DisplayLocalHostName() + { + try + { + // Get the local computer host name. + String^ hostName = Dns::GetHostName(); + Console::WriteLine( "Computer name : {0}", hostName ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + } + // +}; + +int main() +{ + DnsHostName^ dnsHostNameObj = gcnew DnsHostName; + dnsHostNameObj->DisplayLocalHostName(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp b/snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp new file mode 100644 index 00000000000..f280df48999 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Dns_Resolve/CPP/dns_resolve.cpp @@ -0,0 +1,84 @@ +/* +This program demonstrates 'Resolve' method of 'Dns' class. +It takes a URL or IP address String* from commandline or uses default value and obtains the 'IPHostEntry' +Object* by calling 'Resolve' method of 'Dns' class. Then prints host name, IP address list and aliases. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +class DnsResolve +{ +public: + void DisplayHostAddress( String^ hostString ) + { + // Call the Resolve method passing a DNS style host name or an IP address in dotted-quad notation + // (for example, S"www.contoso.com" or S"207.46.131.199") to obtain an IPHostEntry instance that contains + // address information for the specified host. + // + try + { + IPHostEntry^ hostInfo = Dns::Resolve( hostString ); + + // Get the IP address list that resolves to the host names contained in the + // Alias property. + array^address = hostInfo->AddressList; + + // Get the alias names of the addresses in the IP address list. + array^alias = hostInfo->Aliases; + Console::WriteLine( "Host name : {0}", hostInfo->HostName ); + Console::WriteLine( "\nAliases : " ); + for ( int index = 0; index < alias->Length; index++ ) + { + Console::WriteLine( alias[ index ] ); + + } + Console::WriteLine( "\nIP Address list :" ); + for ( int index = 0; index < address->Length; index++ ) + { + Console::WriteLine( address[ index ] ); + + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "NullReferenceException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + // + } +}; + +int main() +{ + String^ hostString = ""; + DnsResolve * myDnsResolve = new DnsResolve; + Console::Write( "Type a URL or IP address (press Enter for default, default is '207.46.131.199') : " ); + hostString = Console::ReadLine(); + if ( hostString->Length > 0 ) + myDnsResolve->DisplayHostAddress( hostString ); + else + myDnsResolve->DisplayHostAddress( "207.46.131.199" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp b/snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp new file mode 100644 index 00000000000..16ae3564724 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/DocumentableItemsample/CPP/documentableitemsample.cpp @@ -0,0 +1,48 @@ + + +// System::Web::Services::Description.DocumentableItem::Documentation; +/* +The following program demonstrates the property 'Documentation' of abstract class 'DocumentableItem' +The program reads a wsdl document S"MathService::wsdl" and instantiates a ServiceDescription instance +from the WSDL document. +This program demonstrates a generic utility function which can accept any of Types, PortType and Binding +classes as parameters. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; +using namespace System::Collections; + +// Prints documentation associated with a wsdl element. +void PrintDocumentation( DocumentableItem^ myItem ) +{ + Console::WriteLine( "\t {0}", myItem->Documentation ); +} + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_cpp.wsdl" ); + Console::WriteLine( "Documentation Element for type is " ); + PrintDocumentation( myServiceDescription->Types ); + IEnumerator^ myEnum = myServiceDescription->PortTypes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + PortType^ myPortType = safe_cast(myEnum->Current); + Console::WriteLine( "Documentation Element for Port Type {0} is ", myPortType->Name ); + PrintDocumentation( myPortType ); + } + + myEnum = myServiceDescription->Bindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Binding^ myBinding = safe_cast(myEnum->Current); + Console::WriteLine( "Documentation Element for Port Type {0} is ", myBinding->Name ); + PrintDocumentation( myBinding ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp new file mode 100644 index 00000000000..dce62908316 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices Registration/CPP/deployservicedcomponent.cpp @@ -0,0 +1,69 @@ +#using + +using namespace System; +using namespace System::EnterpriseServices; + +[STAThread] +int main() +{ + // + try + { + // + String^ applicationName = "Queued Component"; + String^ typeLibraryName = nullptr; + RegistrationHelper^ helper = gcnew RegistrationHelper; + // Call the InstallAssembly method passing it the name of the assembly to + // install as a COM+ application, the COM+ application name, and + // the name of the type library file. + // Setting the application name and the type library to NULL (nothing in Visual Basic .NET + // allows you to use the COM+ application name that is given in the assembly and + // the default type library name. The application name in the assembly metadata + // takes precedence over the application name you provide to InstallAssembly. + helper->InstallAssembly( "C:..\\..\\QueuedComponent.dll", applicationName, typeLibraryName, InstallationFlags::CreateTargetApplication ); + Console::WriteLine( "Registration succeeded: Type library {0} created.", typeLibraryName ); + Console::Read(); + // + + // + // Create a RegistrationConfig object and set its attributes + // Create a RegistrationHelper object, and call the InstallAssemblyFromConfig + // method by passing the RegistrationConfiguration object to it as a + // reference object + RegistrationConfig^ registrationConfiguration = gcnew RegistrationConfig; + registrationConfiguration->AssemblyFile = "C:..\\..\\QueuedComponent.dll"; + registrationConfiguration->Application = "MyApp"; + registrationConfiguration->InstallationFlags = InstallationFlags::CreateTargetApplication; + RegistrationHelper^ helperFromConfig = gcnew RegistrationHelper; + helperFromConfig->InstallAssemblyFromConfig( registrationConfiguration ); + // + } + // + catch ( RegistrationException^ e ) + { + Console::WriteLine( e->Message ); + // + + // + // Check whether the ErrorInfo property of the RegistrationException object is null. + // If there is no extended error information about + // methods related to multiple COM+ objects ErrorInfo will be null. + if ( e->ErrorInfo != nullptr ) + { + // Gets an array of RegistrationErrorInfo objects describing registration errors + array^ registrationErrorInfos = e->ErrorInfo; + + // Iterate through the array of RegistrationErrorInfo objects and disply the + // ErrorString for each object. + System::Collections::IEnumerator^ myEnum = registrationErrorInfos->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + RegistrationErrorInfo^ registrationErrorInfo = (RegistrationErrorInfo^)( myEnum->Current ); + Console::WriteLine( registrationErrorInfo->ErrorString ); + } + } + // + Console::Read(); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp new file mode 100644 index 00000000000..45c9a032b73 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesContextUtil/CPP/class1.cpp @@ -0,0 +1,108 @@ +// +#using +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Reflection; + +// +[Synchronization(SynchronizationOption::Required)] +public ref class ContextUtil_ActivityId: public ServicedComponent +{ +public: + void Example() + { + // Display the ActivityID associated with the current COM+ context. + Console::WriteLine( "Activity ID: {0}", ContextUtil::ActivityId ); + } +}; +// + +// +[Synchronization(SynchronizationOption::Required)] +public ref class ContextUtil_ApplicationInstanceId: public ServicedComponent +{ +public: + void Example() + { + // Display the ApplicationInstanceId associated with the current COM+ + // context. + Console::WriteLine( "Application Instance ID: {0}", + ContextUtil::ApplicationInstanceId ); + } +}; +// + +// +[Transaction(TransactionOption::Required)] +public ref class ContextUtil_DisableCommit: public ServicedComponent +{ +public: + void Example() + { + // Set both the consistent bit and the done bit to false for the + // current COM+ context. + ContextUtil::DisableCommit(); + } +}; +// + +// +[Transaction(TransactionOption::Required)] +public ref class ContextUtil_EnableCommit: public ServicedComponent +{ +public: + void Example() + { + // Set the consistent bit to true and the done bit to false for the + // current COM+ context. + ContextUtil::EnableCommit(); + } +}; +// + +// +[Transaction(TransactionOption::Required)] +public ref class ContextUtil_IsInTransaction: public ServicedComponent +{ +public: + void Example() + { + // Display whether the current COM+ context is enlisted in a + // transaction. + Console::WriteLine( "Current context enlisted in transaction: {0}", + ContextUtil::IsInTransaction ); + } +}; +// + +// +[SecurityRole("Role1")] +public ref class ContextUtil_IsSecurityEnabled: public ServicedComponent +{ +public: + void Example() + { + // Display whether role-based security is active for the current COM+ + // context. + Console::WriteLine( "Role-based security active in current context: {0}", + ContextUtil::IsSecurityEnabled ); + } +}; +// + +// +[Transaction(TransactionOption::Required)] +public ref class ContextUtil_TransactionId: public ServicedComponent +{ +public: + void Example() + { + // Display the ID of the transaction in which the current COM+ context + // is enlisted. + Console::WriteLine( "Transaction ID: {0}", ContextUtil::TransactionId ); + } +}; +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp new file mode 100644 index 00000000000..2924b763b8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesInterfaceQueuingAttribute/CPP/class1.cpp @@ -0,0 +1,19 @@ +// +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Reflection; + +// References: +// System.EnterpriseServices +// +[InterfaceQueuing] +interface class IInterfaceQueuingAttribute_Ctor{}; +// + +// +[InterfaceQueuing(true)] +interface class IInterfaceQueuingAttribute_Ctor_Bool{}; +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp new file mode 100644 index 00000000000..3fbda4b806e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesObjectPoolingAttribute/cpp/class1.cpp @@ -0,0 +1,72 @@ +// +#using +using namespace System; +using namespace System::EnterpriseServices; + +// References: +// System.EnterpriseServices + +// +[ObjectPooling(true)] +public ref class ObjectPoolingAttributeCtorBool : public ServicedComponent +{ +}; +// + +// +[ObjectPooling(true, 1, 10)] +public ref class ObjectPoolingAttributeCtorBoolIntInt : + public ServicedComponent +{ +}; +// + +// +[ObjectPooling(1, 10)] +public ref class ObjectPoolingAttributeCtorIntInt : public ServicedComponent +{ +}; +// + +// +[ObjectPooling(false)] +public ref class ObjectPoolingAttributeEnabled : public ServicedComponent +{ +public: + void EnabledExample() + { + // Get the ObjectPoolingAttribute applied to the class. + ObjectPoolingAttribute^ attribute = + (ObjectPoolingAttribute^)Attribute::GetCustomAttribute( + this->GetType(), + ObjectPoolingAttribute::typeid, + false); + + // Display the current value of the attribute's Enabled property. + Console::WriteLine("ObjectPoolingAttribute.Enabled: {0}", + attribute->Enabled); + + // Set the Enabled property value of the attribute. + attribute->Enabled = true; + + // Display the new value of the attribute's Enabled property. + Console::WriteLine("ObjectPoolingAttribute.Enabled: {0}", + attribute->Enabled); + } +}; +// + +// + + +// Test client. +int main() +{ + // Create a new instance of each example class. + ObjectPoolingAttributeEnabled^ enabledExample = + gcnew ObjectPoolingAttributeEnabled(); + + // Demonstrate the ObjectPoolingAttribute properties. + enabledExample->EnabledExample(); +}; + diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp new file mode 100644 index 00000000000..288dac0fdf8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesPrivateComponentAttribute/cpp/class1.cpp @@ -0,0 +1,45 @@ +// +#using + +using namespace System; +using namespace System::EnterpriseServices; + +// References: +// System.EnterpriseServices + +// + +// Note: Access checks must be performed at the component level to allow access +// to private components. +[assembly: ApplicationAccessControl(false, +AccessChecksLevel=AccessChecksLevelOption::ApplicationComponent)]; + +[PrivateComponent] +public ref class PrivateComponentAttributeExample : public ServicedComponent +{ +public: + void DisplayMessage() + { + // Display some output. + Console::WriteLine("Private component called successfully."); + } +}; +// + +public ref class PrivateComponentAttributeTest : public ServicedComponent +{ +public: + static void Test() + { + // Create a new instance of the example class. + PrivateComponentAttributeExample^ example = + gcnew PrivateComponentAttributeExample(); + + // Call a method on the class. + example->DisplayMessage(); + } +}; + + +// + diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp new file mode 100644 index 00000000000..de1dd4ae5ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesSynchronizationOption/cpp/class1.cpp @@ -0,0 +1,49 @@ +// +#using + +using namespace System; +using namespace System::EnterpriseServices; + +// References: +// System.EnterpriseServices + +// An instance of this class will not join an activity, but can share its +// caller's context even if its caller is configured as NotSupported, +// Supported, Required, or RequiresNew. +[Synchronization(SynchronizationOption::Disabled)] +public ref class SynchronizationAttribute_SynchronizationDisabled : + public ServicedComponent +{ +}; + +// An instance of this class will not join an activity, and will share its +// caller's context only if its caller is also configured as NotSupported. +[Synchronization(SynchronizationOption::NotSupported)] +public ref class SynchronizationAttribute_SynchronizationNotSupported : + public ServicedComponent +{ +}; + +// An instance of this class will join its caller's activity if one exists. +[Synchronization(SynchronizationOption::Supported)] +public ref class SynchronizationAttribute_SynchronizationSupported : + public ServicedComponent +{ +}; + +// An instance of this class will join its caller's activity if one exists. +// If not, a new activity will be created for it. +[Synchronization(SynchronizationOption::Required)] +public ref class SynchronizationAttribute_SynchronizationRequired : + public ServicedComponent +{ +}; + +// A new activity will always be created for an instance of this class. +[Synchronization(SynchronizationOption::RequiresNew)] +public ref class SynchronizationAttribute_SynchronizationRequiresNew : + public ServicedComponent +{ +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp new file mode 100644 index 00000000000..95137a20bbc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionIsolationLevel/cpp/class1.cpp @@ -0,0 +1,48 @@ +// +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Reflection; + +// References: +// System.EnterpriseServices + +// An instance of this class will inherit its caller's transaction isolation +// level if available. If not, it will use isolation level Serializable. +[Transaction(Isolation=TransactionIsolationLevel::Any)] +public ref class IsolationAny : public ServicedComponent +{ +}; + +// An instance of this class will read only committed data, but non-repeatable +// reads and phantom rows are still possible. +[Transaction(Isolation=TransactionIsolationLevel::ReadCommitted)] +public ref class IsolationReadCommitted : public ServicedComponent +{ +}; + +// An instance of this class will read committed and uncommitted data, so dirty +// reads, non-repeatable reads, and phantom rows are possible. +[Transaction(Isolation=TransactionIsolationLevel::ReadUncommitted)] +public ref class IsolationReadUncommitted : public ServicedComponent +{ +}; + +// An instance of this class will read only committed data and place shared +// locks on the data, preventing other users from modifying it, but other users +// can still insert rows into the data set, so phantom rows are still possible. +[Transaction(Isolation=TransactionIsolationLevel::RepeatableRead)] +public ref class IsolationRepeatableRead : public ServicedComponent +{ +}; + +// An instance of this class will read only committed data and place a range +// lock on the data set, preventing other users from updating or inserting rows +// into the data set until its transaction is complete. +[Transaction(Isolation=TransactionIsolationLevel::Serializable)] +public ref class IsolationSerializable : public ServicedComponent +{ +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp new file mode 100644 index 00000000000..f146dfea078 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServicesTransactionOption/cpp/class1.cpp @@ -0,0 +1,46 @@ +// +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Reflection; + +// References: +// System.EnterpriseServices + +// An instance of this class will not participate in transactions, but can +// share its caller's context even if its caller is configured as +// NotSupported, Supported, Required, or RequiresNew. +[Transaction(TransactionOption::Disabled)] +public ref class TransactionDisabled : public ServicedComponent +{ +}; + +// An instance of this class will not participate in transactions, and will +// share its caller's context only if its caller is also configured as +// NotSupported. +[Transaction(TransactionOption::NotSupported)] +public ref class TransactionNotSupported : public ServicedComponent +{ +}; + +// An instance of this class will participate in its caller's transaction +// if one exists. +[Transaction(TransactionOption::Supported)] +public ref class TransactionSupported : public ServicedComponent +{ +}; + +// An instance of this class will participate in its caller's transaction +// if one exists. If not, a new transaction will be created for it. +[Transaction(TransactionOption::Required)] +public ref class TransactionRequired : public ServicedComponent +{ +}; + +// A new transaction will always be created for an instance of this class. +[Transaction(TransactionOption::RequiresNew)] +public ref class TransactionRequiresNew : public ServicedComponent +{ +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp new file mode 100644 index 00000000000..17cf341fc64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Basic/CPP/calculator.cpp @@ -0,0 +1,23 @@ + + +#using + +using namespace System; +using namespace System::EnterpriseServices; + +// + +[assembly:ApplicationName("Calculator")]; +[assembly:ApplicationActivation(ActivationOption::Library)]; +[assembly:System::Reflection::AssemblyKeyFile("Calculator.snk")]; +public ref class Calculator: public ServicedComponent +{ +public: + int Add( int x, int y ) + { + return (x + y); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp new file mode 100644 index 00000000000..c4aa994f1db --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmclient.cpp @@ -0,0 +1,27 @@ +// +#using "System.EnterpriseServices.dll" + +using namespace System; + +[assembly: System::Reflection::AssemblyKeyFile("CrmServer.key")]; + +int main () +{ + + // Create a new account object. The object is created in a COM+ server application. + Account^ account = gcnew Account(); + + // Transactionally debit the account. + try + { + account->Filename = System::IO::Path::GetFullPath("JohnDoe"); + account->AllowCommit = true; + account->DebitAccount(3); + } + finally + { + delete account; + } + +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp new file mode 100644 index 00000000000..19de5456c6e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Crm/cpp/crmserver.cpp @@ -0,0 +1,289 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::EnterpriseServices::CompensatingResourceManager; +using namespace System::IO; +using namespace System::Diagnostics; + +// +[assembly: ApplicationActivation(ActivationOption::Server)]; +// +// +[assembly: ApplicationAccessControl(false)]; +// +// +[assembly: ApplicationCrmEnabled]; +// +// +[assembly: Description("A system for ensuring that the correct account " + "balance is stored after a transaction.")]; +// + +// Subroutines to read and write account files. +void WriteAccountBalance(String^ filename, int balance) +{ + StreamWriter^ streamWriter = gcnew StreamWriter(filename); + try + { + streamWriter->WriteLine(balance); + } + finally + { + delete streamWriter; + } +} + +int ReadAccountBalance(String^ filename) +{ + int balance = 0; + if (File::Exists(filename)) + { + StreamReader^ streamReader = gcnew StreamReader(filename); + try + { + String^ line = streamReader->ReadLine(); + balance = Int32::Parse(line); + } + finally + { + delete streamReader; + } + } + return balance; +} + +ref class AccountCompensator; + +// +// A CRM Worker +[Transaction] +public ref class Account : public ServicedComponent +{ + + // A data member for the account file name. +private: + String^ filenameValue; + +public: + property String^ Filename + { + String^ get() + { + return filenameValue; + } + void set( String^ value ) + { + filenameValue = value; + } + } + + // A boolean data member that determines whether to commit or abort the + // transaction. +private: + bool allowCommitValue; + +public: + property bool AllowCommit + { + bool get() + { + return allowCommitValue; + } + void set( bool value ) + { + allowCommitValue = value; + } + } + + // Debit the account, +public: + void DebitAccount(int amount) + { + + // + // Create a new clerk using the AccountCompensator class. + Clerk^ clerk = gcnew Clerk(AccountCompensator::typeid, + "An account transaction compensator", CompensatorOptions::AllPhases); + // + + // + // Create a record of previous account status, and deliver it to the + // clerk. + int balance = ReadAccountBalance(Filename); + + array^ record = gcnew array(2); + record[0] = Filename; + record[1] = balance; + + clerk->WriteLogRecord(record); + clerk->ForceLog(); + // + + // Perform the transaction + balance -= amount; + + Console::WriteLine("{0}: {1}", Filename, balance); + + WriteAccountBalance(Filename, balance); + + // + // Commit or abort the transaction + if (AllowCommit) + { + ContextUtil::SetComplete(); + } + else + { + ContextUtil::SetAbort(); + } + // + + } + +}; +// + +// +// A CRM Compensator +public ref class AccountCompensator : public Compensator +{ +private: + bool receivedPrepareRecord; + +public: + AccountCompensator() + { + receivedPrepareRecord = false; + } + + // +public: + virtual void BeginPrepare() override + { + // nothing to do + } + // + + // +public: + virtual bool PrepareRecord(LogRecord^ log) override + { + + // Check the validity of the record. + if (log == nullptr) + { + return false; + } + array^ record = dynamic_cast^>(log->Record); + if (record == nullptr) + { + return false; + } + if (record->Length != 2) + { + return false; + } + + // The record is valid. + receivedPrepareRecord = true; + return true; + } + // + + // +public: + virtual bool EndPrepare() override + { + // Allow the transaction to proceed onlyif we have received a prepare + // record. + if (receivedPrepareRecord) + { + return true; + } + else + { + return false; + } + } + // + + // +public: + virtual void BeginCommit(bool commit) override + { + // nothing to do + } + // + + // +public: + virtual bool CommitRecord(LogRecord^ log) override + { + // nothing to do + return(false); + } + // + + // +public: + virtual void EndCommit() override + { + // nothing to do + } + // + + // +public: + virtual void BeginAbort(bool abort) override + { + // nothing to do + } + // + + // +public: + virtual bool AbortRecord(LogRecord^ log) override + { + + // Check the validity of the record. + if (log == nullptr) + { + return true; + } + array^ record = dynamic_cast^>(log->Record); + if (record == nullptr) + { + return true; + } + if (record->Length != 2) + { + return true; + } + + // Extract old account data from the record. + String^ filename = (String^) record[0]; + int balance = (int) record[1]; + + // Restore the old state of the account. + WriteAccountBalance(filename, balance); + + return false; + } + // + + // +public: + virtual void EndAbort() override + { + // nothing to do + } + // + +}; +// + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp new file mode 100644 index 00000000000..50d9d6fefaf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Pooling/CPP/inspector.cpp @@ -0,0 +1,60 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Windows::Forms; + +// + +[assembly:ApplicationName("ObjectInspector")]; +[assembly:ApplicationActivation(ActivationOption::Server)]; +[assembly:System::Reflection::AssemblyKeyFile("Inspector.snk")]; +[JustInTimeActivation] +[ObjectPooling(MinPoolSize=2,MaxPoolSize=100,CreationTimeout=1000)] +public ref class ObjectInspector: public ServicedComponent +{ + // +public: + String^ IdentifyObject( Object^ obj ) + { + // Return this object to the pool after use. + ContextUtil::DeactivateOnReturn = true; + + // Get the supplied object's type. + Type^ objType = obj->GetType(); + + // Return its name. + return (objType->FullName); + } + // + + // +protected: + virtual void Activate() override + { + MessageBox::Show( String::Format( "Now entering...\nApplication: {0}\nInstance: {1}\nContext: {2}\n", ContextUtil::ApplicationId.ToString(), ContextUtil::ApplicationInstanceId.ToString(), ContextUtil::ContextId.ToString() ) ); + } + // + + // + virtual void Deactivate() override + { + MessageBox::Show( "Bye Bye!" ); + } + // + + // + // This object can be pooled. + virtual bool CanBePooled() override + { + return (true); + } + // +}; +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp new file mode 100644 index 00000000000..8aff4f6dc96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Security/CPP/employeeinformation.cpp @@ -0,0 +1,91 @@ + + +// +#using + +using namespace System; +using namespace System::EnterpriseServices; + +// +// Set component name and strong name key. +[assembly:ApplicationName("EmployeeInformation")]; +[assembly:System::Reflection::AssemblyKeyFile("EmployeeInformation.snk")]; +// + +// +// Set component access controls. +[assembly:ApplicationAccessControl(Authentication=AuthenticationOption::Privacy, +ImpersonationLevel=ImpersonationLevelOption::Identify, +AccessChecksLevel=AccessChecksLevelOption::ApplicationComponent)]; +// + +// +// Create a security role for the component. +[assembly:SecurityRole("Manager")]; +// + +// +// Accept a constructor string. + +[ConstructionEnabled] +public ref class EmployeeInformation: public ServicedComponent +{ +private: + + // The employee's user name and salary. + String^ accountName; + double salary; + +public: + + // + // Get the employee's name. All users can call this method. + String^ GetName() + { + return (accountName); + } + // + + // + // Set the employee's salary. Only managers can do this. + void SetSalary( double ammount ) + { + if ( SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) + { + salary = ammount; + } + else + { + throw gcnew UnauthorizedAccessException; + } + } + // + + // + // Get the employee's salary. Only the employee and managers can do this. + double GetSalary() + { + if ( SecurityCallContext::CurrentCall->DirectCaller->AccountName == accountName || SecurityCallContext::CurrentCall->IsCallerInRole( "Manager" ) ) + { + return (salary); + } + else + { + throw gcnew UnauthorizedAccessException; + } + } + // + + // +protected: + // Use the constructor string. + // This method is called when the object is instantiated. + virtual void Construct( String^ constructorString ) override + { + accountName = constructorString; + } + // +}; + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp new file mode 100644 index 00000000000..17d849b6a90 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_SharedProperties/CPP/receiptcounterclass.cpp @@ -0,0 +1,54 @@ +// +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Reflection; + +[assembly:AssemblyKeyFile("..\\common\\key.snk")]; +[assembly:ApplicationName("ReceiptNumberGenerator")]; +[assembly:ApplicationActivation(ActivationOption::Library)]; + +public ref class ReceiptNumberGeneratorClass +{ +public: + + // Generates a new receipt number based on the receipt number + // stored by the Shared Property Manager (SPM) + int GetNextReceiptNumber() + { + bool groupExists; + bool propertyExists; + int nextReceiptNumber = 0; + PropertyLockMode lockMode = PropertyLockMode::SetGet; + PropertyReleaseMode releaseMode = PropertyReleaseMode::Standard; + + // + // Create a shared property group manager. + SharedPropertyGroupManager^ groupManager = gcnew SharedPropertyGroupManager; + // + + // + // + // Create a shared property group. + SharedPropertyGroup^ group = + groupManager->CreatePropertyGroup( "Receipts", lockMode, releaseMode, groupExists ); + // + + // Create a shared property. + SharedProperty^ ReceiptNumber; + ReceiptNumber = group->CreateProperty( "ReceiptNumber", propertyExists ); + // + + // + // Retrieve the value from shared property, and increment the shared + // property value. + nextReceiptNumber = safe_cast(ReceiptNumber->Value); + ReceiptNumber->Value = nextReceiptNumber + 1; + // + + // Return nextReceiptNumber + return nextReceiptNumber; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp new file mode 100644 index 00000000000..720671e07a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/EnterpriseServices_Transaction/CPP/transaction.cpp @@ -0,0 +1,27 @@ + + +#using +#using + +using namespace System; +using namespace System::EnterpriseServices; + +// + +[assembly:System::Reflection::AssemblyKeyFile("Transaction.snk")]; +[Transaction] +public ref class TransactionalComponent: public ServicedComponent +{ +public: + void TransactionalMethod( String^ data ) + { + ContextUtil::DeactivateOnReturn = true; + ContextUtil::MyTransactionVote = TransactionVote::Abort; + + // do work with data + ContextUtil::MyTransactionVote = TransactionVote::Commit; + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp new file mode 100644 index 00000000000..fbcca70719e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Add/CPP/faultbindingcollection_add.cpp @@ -0,0 +1,217 @@ +/* The following example demonstrates the 'Add' method of the 'FaultBindingCollection' class +* and constructor and 'Extensions' property of 'FaultBinding'class and 'Documentation' +* property of 'DocumentableItem' class. +* +* This program generates a WSDL file for a service called StockQuote. The StockQuote service +* provides one method called 'GetTradePrice'. The 'GetTradePrice' method takes two arguments, +* a 'tickerSymbol' and 'time' strings. The 'tickerSymbol' is a unique representation of a +* stock and 'time' is the time for which the trading price is to be returned for the stock +* specified. The WSDL file generated for the service supports the SOAP protocol only. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; + +XmlSchemaElement^ CreateComplexTypeXmlElement( String^ minoccurs, String^ maxoccurs, String^ name, bool isNillable, XmlQualifiedName^ schemaTypeName ) +{ + XmlSchemaElement^ myXmlSchemaElement = gcnew XmlSchemaElement; + myXmlSchemaElement->MinOccursString = minoccurs; + myXmlSchemaElement->MaxOccursString = maxoccurs; + myXmlSchemaElement->Name = name; + myXmlSchemaElement->IsNillable = true; + myXmlSchemaElement->SchemaTypeName = schemaTypeName; + return myXmlSchemaElement; +} + +XmlSchemaElement^ CreateOtherXmlElement( String^ name, XmlQualifiedName^ SchemaTypeName ) +{ + XmlSchemaElement^ myXmlSchemaElement = gcnew XmlSchemaElement; + myXmlSchemaElement->Name = name; + myXmlSchemaElement->SchemaTypeName = SchemaTypeName; + return myXmlSchemaElement; +} + +// Creates a Message with name =S"messageName" having one MessagePart with name = S"partName". +Message^ CreateMessage( String^ messageName, String^ partName, String^ element, String^ targetNamespace ) +{ + Message^ myMessage = gcnew Message; + myMessage->Name = messageName; + MessagePart^ myMessagePart = gcnew MessagePart; + myMessagePart->Name = partName; + myMessagePart->Element = gcnew XmlQualifiedName( element,targetNamespace ); + myMessage->Parts->Add( myMessagePart ); + return myMessage; +} + +int main() +{ + ServiceDescription^ myServiceDescription = gcnew ServiceDescription; + myServiceDescription->Name = "StockQuote"; + myServiceDescription->TargetNamespace = "http://www.contoso.com/stockquote.wsdl"; + + // Generate the 'Types' element. + XmlSchema^ myXmlSchema = gcnew XmlSchema; + myXmlSchema->AttributeFormDefault = XmlSchemaForm::Qualified; + myXmlSchema->ElementFormDefault = XmlSchemaForm::Qualified; + myXmlSchema->TargetNamespace = "http://www.contoso.com/stockquote.wsdl"; + + //XmlSchemaElement myXmlSchemaElement; + XmlSchemaComplexType^ myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaComplexType->Name = "GetTradePriceInputType"; + XmlSchemaSequence^ myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "tickerSymbol", true, gcnew XmlQualifiedName( "s:string" ) ) ); + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "time", true, gcnew XmlQualifiedName( "s:string" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlSchema->Items->Add( myXmlSchemaComplexType ); + + myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaComplexType->Name = "GetTradePriceOutputType"; + myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "result", true, gcnew XmlQualifiedName( "s:string" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlSchema->Items->Add( myXmlSchemaComplexType ); + + myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaComplexType->Name = "GetTradePriceStringFaultType"; + myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "error", true, gcnew XmlQualifiedName( "s:string" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlSchema->Items->Add( myXmlSchemaComplexType ); + + myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaComplexType->Name = "GetTradePriceStringIntType"; + myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "error", true, gcnew XmlQualifiedName( "s:int" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlSchema->Items->Add( myXmlSchemaComplexType ); + + myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapIn", gcnew XmlQualifiedName( "s0:GetTradePriceInputType" ) ) ); + myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapOut", gcnew XmlQualifiedName( "s0:GetTradePriceOutputType" ) ) ); + myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapStringFault", gcnew XmlQualifiedName( "s0:GetTradePriceStringFaultType" ) ) ); + myXmlSchema->Items->Add( CreateOtherXmlElement( "GetTradePriceSoapIntFault", gcnew XmlQualifiedName( "s0:GetTradePriceIntFaultType" ) ) ); + + myServiceDescription->Types->Schemas->Add( myXmlSchema ); + + // Generate the 'Message' element. + MessageCollection^ myMessageCollection = myServiceDescription->Messages; + myMessageCollection->Add( CreateMessage( "GetTradePriceInput", "parameters", "GetTradePriceSoapIn", myServiceDescription->TargetNamespace ) ); + myMessageCollection->Add( CreateMessage( "GetTradePriceOutput", "parameters", "GetTradePriceSoapOut", myServiceDescription->TargetNamespace ) ); + myMessageCollection->Add( CreateMessage( "GetTradePriceStringFault", "parameters", "GetTradePriceStringSoapFault", myServiceDescription->TargetNamespace ) ); + myMessageCollection->Add( CreateMessage( "GetTradePriceIntFault", "parameters", "GetTradePriceIntSoapFault", myServiceDescription->TargetNamespace ) ); + + // Generate the 'Port Type' element. + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = gcnew PortType; + myPortType->Name = "StockQuotePortType"; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = gcnew Operation; + myOperation->Name = "GetTradePrice"; + OperationMessage^ myOperationMessage; + OperationMessageCollection^ myOperationMessageCollection = myOperation->Messages; + myOperationMessage = dynamic_cast(gcnew OperationInput); + myOperationMessage->Message = gcnew XmlQualifiedName( "s0:GetTradePriceInput" ); + myOperationMessageCollection->Add( myOperationMessage ); + myOperationMessage = dynamic_cast(gcnew OperationOutput); + myOperationMessage->Message = gcnew XmlQualifiedName( "s0:GetTradePriceOutput" ); + myOperationMessageCollection->Add( myOperationMessage ); + OperationFault^ myOperationFault = gcnew OperationFault; + myOperationFault->Name = "ErrorString"; + myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" ); + myOperation->Faults->Add( myOperationFault ); + myOperationFault = gcnew OperationFault; + myOperationFault->Name = "ErrorInt"; + myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" ); + myOperation->Faults->Add( myOperationFault ); + myOperationCollection->Add( myOperation ); + myPortTypeCollection->Add( myPortType ); + + // Generate the 'Binding' element. + ServiceDescriptionFormatExtensionCollection^ myExtensions; + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + Binding^ myBinding = gcnew Binding; + myBinding->Name = "StockQuoteSoapBinding"; + myBinding->Type = gcnew XmlQualifiedName( "s0:StockQuotePortType" ); + myExtensions = myBinding->Extensions; + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Style = SoapBindingStyle::Document; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + myExtensions->Add( mySoapBinding ); + OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myExtensions = myOperationBinding->Extensions; + SoapOperationBinding^ mySoapBindingOperation = gcnew SoapOperationBinding; + mySoapBindingOperation->SoapAction = "http://www.contoso.com/GetTradePrice"; + myExtensions->Add( mySoapBindingOperation ); + myOperationBinding->Name = "GetTradePrice"; + myOperationBinding->Input = gcnew InputBinding; + myExtensions = myOperationBinding->Input->Extensions; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + mySoapBodyBinding->Namespace = "http://www.contoso.com/stockquote"; + myExtensions->Add( mySoapBodyBinding ); + myOperationBinding->Output = gcnew OutputBinding; + myExtensions = myOperationBinding->Output->Extensions; + mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + mySoapBodyBinding->Namespace = "http://www.contoso.com/stockquote"; + myExtensions->Add( mySoapBodyBinding ); + +// +// +// + FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; + FaultBinding^ myFaultBinding = gcnew FaultBinding; + myFaultBinding->Name = "ErrorString"; + // Associate SOAP fault binding to the fault binding of the operation. + myExtensions = myFaultBinding->Extensions; + SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; + mySoapFaultBinding->Use = SoapBindingUse::Literal; + mySoapFaultBinding->Namespace = "http://www.contoso.com/stockquote"; + myExtensions->Add( mySoapFaultBinding ); + myFaultBindingCollection->Add( myFaultBinding ); +// +// +// + + myFaultBinding = gcnew FaultBinding; + myFaultBinding->Name = "ErrorInt"; + // Associate SOAP fault binding to the fault binding of the operation. + myExtensions = myFaultBinding->Extensions; + mySoapFaultBinding = gcnew SoapFaultBinding; + mySoapFaultBinding->Use = SoapBindingUse::Literal; + mySoapFaultBinding->Namespace = "http://www.contoso.com/stockquote"; + myExtensions->Add( mySoapFaultBinding ); + myFaultBindingCollection->Add( myFaultBinding ); + myOperationBindingCollection->Add( myOperationBinding ); + myBindingCollection->Add( myBinding ); + + // Generate the 'Service' element. + ServiceCollection^ myServiceCollection = myServiceDescription->Services; + +// + Service^ myService = gcnew Service; + // Add a simple documentation for the service to ease the readability of the generated WSDL file. + myService->Documentation = "A Simple Stock Quote Service"; + myService->Name = "StockQuoteService"; + PortCollection^ myPortCollection = myService->Ports; + Port^ myPort = gcnew Port; + myPort->Name = "StockQuotePort"; + myPort->Binding = gcnew XmlQualifiedName( "s0:StockQuoteSoapBinding" ); + myExtensions = myPort->Extensions; + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://www.contoso.com/stockquote"; + myExtensions->Add( mySoapAddressBinding ); + myPortCollection->Add( myPort ); + // + myServiceCollection->Add( myService ); + + // Display the WSDL generated to the console. + myServiceDescription->Write( Console::Out ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp new file mode 100644 index 00000000000..5084e6fa169 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Item/CPP/faultbindingcollection_item.cpp @@ -0,0 +1,47 @@ +/* +* The following example demonstrates the 'Item[String*]' property of +FaultBindingCollection class +* The program removes a fault binding with the name 'ErrorString' +from the WSDL file. It also removes a operation fault with the name +'ErrorString' and displays the resultant WSDL file to the console. +* +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + + // Read the 'StockQuote::wsdl' file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote.wsdl" ); + + // Get the operation fault collection and remove the operation fault with the name 'ErrorString'. + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = myOperationCollection[ 0 ]; + OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; + if ( myOperationFaultCollection->Contains( myOperationFaultCollection[ "ErrorString" ] ) ) + myOperationFaultCollection->Remove( myOperationFaultCollection[ "ErrorString" ] ); + + + // Get the fault binding collection and remove the fault binding with the name 'ErrorString'. + // + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + Binding^ myBinding = myBindingCollection[ 0 ]; + OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; + OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; + FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; + if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) ) + myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] ); + + + // + myServiceDescription->Write( Console::Out ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp new file mode 100644 index 00000000000..5d0f962f077 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FaultBindingCollection_Remove/CPP/faultbindingcollection_remove.cpp @@ -0,0 +1,89 @@ +/* +* The following example demonstrates the 'Remove', 'CopyTo', 'Insert', +'Contains', 'IndexOf' method and 'Item[int]' property of FaultBindingCollection +class +The program reverses the fault bindings that appear in the WSDL file. +It also reverses the operation faults and displays the resultant WSDL file +to the console. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + + // Read the 'StockQuote::wsdl' file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = myOperationCollection[ 0 ]; + OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; + + // Reverse the operation fault order. + if ( myOperationFaultCollection->Count > 1 ) + { + array^myOperationFaultArray = gcnew array(myOperationFaultCollection->Count); + + // Copy the operation fault to a temporary array. + myOperationFaultCollection->CopyTo( myOperationFaultArray, 0 ); + + // Remove all the operation fault instances in the fault binding collection. + for ( int i = 0; i < myOperationFaultArray->Length; i++ ) + myOperationFaultCollection->Remove( myOperationFaultArray[ i ] ); + + // Insert the operation fault instance in the reverse order. + for ( int i = 0,j = (myOperationFaultArray->Length - 1); i < myOperationFaultArray->Length; i++,j-- ) + myOperationFaultCollection->Insert( i, myOperationFaultArray[ j ] ); + } + + // + // + // + // + // + // + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + Binding^ myBinding = myBindingCollection[ 0 ]; + OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; + OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; + FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; + + // Reverse the fault bindings order. + if ( myFaultBindingCollection->Count > 1 ) + { + FaultBinding^ myFaultBinding = myFaultBindingCollection[ 0 ]; + array^myFaultBindingArray = gcnew array(myFaultBindingCollection->Count); + + // Copy the fault bindings to a temporary array. + myFaultBindingCollection->CopyTo( myFaultBindingArray, 0 ); + + // Remove all the fault binding instances in the fault binding collection. + for ( int i = 0; i < myFaultBindingArray->Length; i++ ) + myFaultBindingCollection->Remove( myFaultBindingArray[ i ] ); + + // Insert the fault binding instance in the reverse order. + for ( int i = 0,j = (myFaultBindingArray->Length - 1); i < myFaultBindingArray->Length; i++,j-- ) + myFaultBindingCollection->Insert( i, myFaultBindingArray[ j ] ); + + // Check if the first element in the collection before the reversal is now the last element. + if ( myFaultBindingCollection->Contains( myFaultBinding ) && myFaultBindingCollection->IndexOf( myFaultBinding ) == (myFaultBindingCollection->Count - 1) ) + + // Display the WSDL generated to the console. + myServiceDescription->Write( Console::Out ); + else + Console::WriteLine( "Error while reversing" ); + } + // + // + // + // + // + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp new file mode 100644 index 00000000000..ff1a5cacc7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ContentLength/CPP/filewebrequest_contentlength.cpp @@ -0,0 +1,72 @@ +// System::Net::FileWebRequest::ContentLength;System::Net::FileWebRequest::RequestUri; + +/* +This program demonstrates 'ContentLength'and 'RequestUri' property of 'FileWebRequest' class. +The path of a file where user would like to write something is obtained from command line argument. +Then a 'WebRequest' Object* is created. The 'ContentLength' property of 'FileWebRequest' is used to +set the length of the file content that was written. +*/ + +#using + +using namespace System::Net; +using namespace System; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the file name as command line parameter where you want to write:" ); + Console::WriteLine( "Usage:FileWebRequest_ContentLen //\nExample:FileWebRequest_ContentLen shafeeque/shaf/hello.txt" ); + } + else + { + try + { + // Create an 'Uri' Object*. + Uri^ myUrl = gcnew Uri( String::Concat( "file://", args[ 1 ] ) ); + FileWebRequest^ myFileWebRequest = nullptr; + +// + myFileWebRequest = (FileWebRequest^)( WebRequest::Create( myUrl ) ); + + Console::WriteLine( "Enter the string you want to write into the file:" ); + String^ userInput = Console::ReadLine(); + ASCIIEncoding^ encoder = gcnew ASCIIEncoding; + array^ byteArray = encoder->GetBytes( userInput ); + + // Set the 'Method' property of 'FileWebRequest' Object* to 'POST' method. + myFileWebRequest->Method = "POST"; + + // The 'ContentLength' property is used to set the content length of the file. + myFileWebRequest->ContentLength = byteArray->Length; +// + +// + // Compare the file name and 'RequestUri' is same or not. + if ( myFileWebRequest->RequestUri->Equals( myUrl ) ) + { + // 'GetRequestStream' method returns the stream handler for writing into the file. + Stream^ readStream = myFileWebRequest->GetRequestStream(); + // Write to the stream + readStream->Write( byteArray, 0, userInput->Length ); + readStream->Close(); + } + + Console::WriteLine( "\nThe String you entered was successfully written into the file." ); + Console::WriteLine( "The content length sent to the server is {0}.", myFileWebRequest->ContentLength ); +// + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( "The ArgumentException is : {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "The UriFormatException is : {0}", e->Message ); + } + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp new file mode 100644 index 00000000000..7203551b787 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ReqBeginEnd/CPP/filewebrequest_reqbeginend.cpp @@ -0,0 +1,118 @@ + + +// System::Net::FileWebRequest::BeginGetRequestStream;System::Net::FileWebRequest::EndGetRequestStream; +// Snippet1 and Snippet2 go together +/* +This program demonstrates 'BeginGetRequestStream' and 'EndGetRequestStream' method of 'FileWebRequest' class +The path of the file from where content is to be read is obtained as a command line argument and a 'webRequest' +Object* is created.Using the 'BeginGetRequestStream' method and 'EndGetRequestStream' of 'FileWebRequest' class +a stream Object* is obtained which is used to write into the file. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Threading; + +// +// +public ref class RequestDeclare +{ +public: + FileWebRequest^ myFileWebRequest; + String^ userinput; + RequestDeclare() + { + myFileWebRequest = nullptr; + } + +}; + +ref class FileWebRequest_reqbeginend +{ +public: + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + static void ReadCallback( IAsyncResult^ ar ) + { + try + { + + // State of the request is asynchronous. + RequestDeclare^ requestDeclare = dynamic_cast(ar->AsyncState); + FileWebRequest^ myFileWebRequest = requestDeclare->myFileWebRequest; + String^ sendToFile = requestDeclare->userinput; + + // End the Asynchronus request by calling the 'EndGetRequestStream()' method. + Stream^ readStream = myFileWebRequest->EndGetRequestStream( ar ); + + // Convert the String* into Byte array. + ASCIIEncoding^ encoder = gcnew ASCIIEncoding; + array^byteArray = encoder->GetBytes( sendToFile ); + + // Write to the stream. + readStream->Write( byteArray, 0, sendToFile->Length ); + readStream->Close(); + allDone->Set(); + Console::WriteLine( "\nThe String you entered was successfully written into the file." ); + Console::WriteLine( "\nPress Enter to continue." ); + } + catch ( ApplicationException^ e ) + { + Console::WriteLine( "ApplicationException is : {0}", e->Message ); + } + + } + +}; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); + Console::WriteLine( "Usage:FileWebRequest_reqbeginend //\n" ); + Console::WriteLine( "Example:FileWebRequest_reqbeginend shafeeque/shaf/hello.txt" ); + } + else + { + try + { + + // Place a webrequest. + WebRequest^ myWebRequest = WebRequest::Create( String::Concat( "file://", args[ 1 ] ) ); + + // Create an instance of the 'RequestDeclare' and associate the 'myWebRequest' to it. + RequestDeclare^ requestDeclare = gcnew RequestDeclare; + requestDeclare->myFileWebRequest = dynamic_cast(myWebRequest); + + // Set the 'Method' property of 'FileWebRequest' Object* to 'POST' method. + requestDeclare->myFileWebRequest->Method = "POST"; + Console::WriteLine( "Enter the String* you want to write into the file:" ); + requestDeclare->userinput = Console::ReadLine(); + + // Begin the Asynchronous request for getting file content using 'BeginGetRequestStream()' method . + IAsyncResult^ r = dynamic_cast(requestDeclare->myFileWebRequest->BeginGetRequestStream( gcnew AsyncCallback( &FileWebRequest_reqbeginend::ReadCallback ), requestDeclare )); + FileWebRequest_reqbeginend::allDone->WaitOne(); + Console::Read(); + } + catch ( ProtocolViolationException^ e ) + { + Console::WriteLine( "ProtocolViolationException is : {0}", e->Message ); + } + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( "InvalidOperationException is : {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "UriFormatExceptionException is : {0}", e->Message ); + } + + } +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp new file mode 100644 index 00000000000..0a0ee8a55eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebRequest_ResBeginEnd/CPP/filewebrequest_resbeginend.cpp @@ -0,0 +1,105 @@ + + +// System::Net::FileWebRequest::BeginGetResponse;System::Net::FileWebRequest::EndGetResponse; +// Snippet1 and Snippet2 go together +/* +This program demonstrates 'BeginGetResponse' and 'EndGetResponse' methods of 'FileWebRequest' class. +The path of the file from where content is to be read is obtained as a command line argument and a +'WebRequest' Object* is created. Using the 'BeginGetResponse' method and 'EndGetResponse' of 'FileWebRequest' +class a 'FileWebResponse' Object* is obtained which is used to print the content on the file. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Threading; + +// +// +public ref class RequestDeclare +{ +public: + FileWebRequest^ myFileWebRequest; + RequestDeclare() + { + myFileWebRequest = nullptr; + } + +}; + +ref class FileWebRequest_resbeginend +{ +public: + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + static void RespCallback( IAsyncResult^ ar ) + { + + // State of request is asynchronous. + RequestDeclare^ requestDeclare = dynamic_cast(ar->AsyncState); + FileWebRequest^ myFileWebRequest = requestDeclare->myFileWebRequest; + + // End the Asynchronus request by calling the 'EndGetResponse()' method. + FileWebResponse^ myFileWebResponse = dynamic_cast(myFileWebRequest->EndGetResponse( ar )); + + // Reade the response into Stream. + StreamReader^ streamReader = gcnew StreamReader( myFileWebResponse->GetResponseStream() ); + array^readBuffer = gcnew array(256); + int count = streamReader->Read( readBuffer, 0, 256 ); + Console::WriteLine( "The contents of the file are :\n" ); + while ( count > 0 ) + { + String^ str = gcnew String( readBuffer,0,count ); + Console::WriteLine( str ); + count = streamReader->Read( readBuffer, 0, 256 ); + } + + streamReader->Close(); + + // Release the response Object* resources. + myFileWebResponse->Close(); + allDone->Set(); + Console::WriteLine( "File reading is over." ); + } + +}; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); + Console::WriteLine( "Usage:FileWebRequest_resbeginend //\n" ); + Console::WriteLine( "Example:FileWebRequest_resbeginend shafeeque/shaf/hello.txt" ); + } + else + { + try + { + + // Place a 'Webrequest'. + WebRequest^ myWebRequest = WebRequest::Create( String::Concat( "file://", args[ 1 ] ) ); + + // Create an instance of the 'RequestDeclare' and associating the 'myWebRequest' to it. + RequestDeclare^ myRequestDeclare = gcnew RequestDeclare; + myRequestDeclare->myFileWebRequest = dynamic_cast(myWebRequest); + + // Begin the Asynchronous request for getting file content using 'BeginGetResponse()' method. + IAsyncResult^ asyncResult = dynamic_cast(myRequestDeclare->myFileWebRequest->BeginGetResponse( gcnew AsyncCallback( &FileWebRequest_resbeginend::RespCallback ), myRequestDeclare )); + FileWebRequest_resbeginend::allDone->WaitOne(); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException is : {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "UriFormatException is : {0}", e->Message ); + } + + } +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp new file mode 100644 index 00000000000..7125135810a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Close/CPP/filewebresponse_close.cpp @@ -0,0 +1,58 @@ +// System::Net::FileWebResponse::Close +/*This program demontrates the 'Close' method of 'FileWebResponse' Class. +It takes an Uri from console and creates a 'FileWebRequest' Object* for the Uri::It then gets back +the response Object* from the Uri. The response Object* can be processed as desired. The program then +closes the response Object* and releases resources associated with it. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +// +void GetPage( String^ url ) +{ + try + { + Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); + // Create a FileWebrequest with the specified Uri. + FileWebRequest^ myFileWebRequest = dynamic_cast(WebRequest::Create( fileUrl )); + // Send the 'fileWebRequest' and wait for response. + FileWebResponse^ myFileWebResponse = dynamic_cast(myFileWebRequest->GetResponse()); + // Process the response here. + Console::WriteLine( "\nResponse Received::Trying to Close the response stream.." ); + // Release resources of response Object*. + myFileWebResponse->Close(); + Console::WriteLine( "\nResponse Stream successfully closed." ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} +// + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); + Console::WriteLine( "Usage:FileWebResponse_Close // \nExample:FileWebResponse_Close microsoft/shared/hello.txt" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp new file mode 100644 index 00000000000..5dff4113057 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ContentLength_ContentType/CPP/filewebresponse_contentlength_contenttype.cpp @@ -0,0 +1,56 @@ +// System::Net::FileWebResponse::ContentLength;System::Net::FileWebResponse::ContentType. + +/* This program demonstrates the 'ContentLength' and 'ContentType' properties of the 'FileWebResponse' class. +It creates a web request and queries for a response. It then prints the content length +and content type of the entity body in the response onto the console */ + +#using + +using namespace System; +using namespace System::Net; + +// +// +void GetPage( String^ url ) +{ + try + { + Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); + // Create a 'FileWebrequest' Object* with the specified Uri. + FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) ); + // Send the 'fileWebRequest' and wait for response. + FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() ); + // Print the ContentLength and ContentType properties received as headers in the response Object*. + Console::WriteLine( "\nContent length : {0}, Content Type : {1}", myFileWebResponse->ContentLength, myFileWebResponse->ContentType ); + // Release resources of response Object*. + myFileWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} +// +// + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); + Console::WriteLine( "Usage:FileWebResponse_ContentLength_ContentType // \nExample:FileWebResponse_ContentLength_ContentType microsoft/shared/hello.txt" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp new file mode 100644 index 00000000000..37b23a614f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_GetResponseStream/CPP/filewebresponse_getresponsestream.cpp @@ -0,0 +1,77 @@ +// System::Net::FileWebResponse::GetResponseStream. + +/* This program demonstrates the 'GetResponseStream' method of the 'FileWebResponse' class. +It creates a 'FileWebRequest' Object* and queries for a response. +The response stream obtained is piped to a higher level stream reader. The reader reads +256 characters at a time, writes them into a String* and then displays the String* onto the console*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ + try + { +// + Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); + // Create a 'FileWebrequest' Object* with the specified Uri. + FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) ); + // Send the 'FileWebRequest' Object* and wait for response. + FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() ); + + // Get the stream Object* associated with the response Object*. + Stream^ receiveStream = myFileWebResponse->GetResponseStream(); + + Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); + // Pipe the stream to a higher level stream reader with the required encoding format. + StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); + Console::WriteLine( "\r\nResponse stream received" ); + + array^ read = gcnew array(256); + // Read 256 characters at a time. + int count = readStream->Read( read, 0, 256 ); + Console::WriteLine( "File Data...\r\n" ); + while ( count > 0 ) + { + // Dump the 256 characters on a String* and display the String* onto the console. + String^ str = gcnew String( read,0,count ); + Console::Write( str ); + count = readStream->Read( read, 0, 256 ); + } + Console::WriteLine( "" ); + // Release resources of stream Object*. + readStream->Close(); + // Release resources of response Object*. + myFileWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the file name as command line parameter:" ); + Console::WriteLine( "Usage:FileWebResponse_GetResponseStream // \nExample:FileWebResponse_GetResponseStream microsoft/shared/hello.txt" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp new file mode 100644 index 00000000000..3d637455677 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_Headers/CPP/filewebresponse_headers.cpp @@ -0,0 +1,57 @@ +// System::Net::FileWebResponse::Headers + +/* This program demonstrates the 'Headers' property of the 'FileWebResponse' class. +It creates a web request and queries for a response. It then prints [Out] all* the response +headers (name -value pairs) onto the console. */ + +#using + +using namespace System; +using namespace System::Net; + +// +void GetPage( String^ url ) +{ + try + { + Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); + // Create a 'FileWebrequest' Object^ with the specified Uri . + FileWebRequest^ myFileWebRequest = (FileWebRequest^)(WebRequest::Create( fileUrl )); + // Send the 'FileWebRequest' and wait for response. + FileWebResponse^ myFileWebResponse = (FileWebResponse^)(myFileWebRequest->GetResponse()); + // Display all Headers present in the response received from the Uri. + Console::WriteLine( "\r\nThe following headers were received in the response:" ); + // Display each header and the key of the response Object^. + for ( int i = 0; i < myFileWebResponse->Headers->Count; ++i ) + Console::WriteLine( "\nHeader Name: {0}, Header value : {1}", + myFileWebResponse->Headers->Keys[ i ], myFileWebResponse->Headers[ (HttpRequestHeader)i ] ); + myFileWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException thrown. The Reason for failure is: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised: {0}", e->Message ); + } + +} +// + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease type the file name as command line parameter as:" ); + Console::WriteLine( "Usage:FileWebResponse_Headers // \nExample:FileWebResponse_Headers microsoft/shared/hello.txt" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp new file mode 100644 index 00000000000..677397be699 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/FileWebResponse_ResponseUri/CPP/filewebresponse_responseuri.cpp @@ -0,0 +1,56 @@ +// System::Net::FileWebResponse::ResponseUri + +/* This program demonstrates the 'ResponseUri' property of the 'FileWebResponse' class. +It creates a 'FileWebRequest' Object* and queries for a response. It then displays the Uri of the file +system resource that provided the response. +*/ + +#using + +using namespace System; +using namespace System::Net; + +// +void GetPage( String^ url ) +{ + try + { + Uri^ fileUrl = gcnew Uri( String::Concat( "file://", url ) ); + + // Create a 'FileWebrequest' object with the specified Uri . + FileWebRequest^ myFileWebRequest = (FileWebRequest^)( WebRequest::Create( fileUrl ) ); + + // Send the 'fileWebRequest' and wait for response. + FileWebResponse^ myFileWebResponse = (FileWebResponse^)( myFileWebRequest->GetResponse() ); + Console::WriteLine( "\nThe Uri of the file system resource that provided the response is :\n {0}\n\n", myFileWebResponse->ResponseUri ); + + // Release resources of response object. + myFileWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException thrown. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} +// + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease type the file name as command line parameter as:" ); + Console::WriteLine( "Usage:FileWebResponse_ResponseUri // \nExample:FileWebResponse_ResponseUri microsoft/shared/hello.txt" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp new file mode 100644 index 00000000000..6e09ece8126 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpBinding_HttpBinding/CPP/httpbinding_ctor.cpp @@ -0,0 +1,93 @@ +// System.Web.Services.Description.HttpBinding.HttpBinding() +// System.Web.Services.Description.HttpBinding.Namespace +// System.Web.Services.Description.HttpAddressBinding.HttpAddressBinding() + +/* The following program demonstrates the constructor, field 'Namespace' of + class 'HttpBinding' and constructor of class 'HttpAddressBinding'. This program writes all 'HttpPost' binding related information to the input wsdl file and genrates an output file which is later on compiled using wsdl tool. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myDescription = ServiceDescription::Read( "HttpBinding_ctor_Input_CPP.wsdl" ); + + // + // + // Create 'Binding' object. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "MyHttpBindingServiceHttpPost"; + XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:MyHttpBindingServiceHttpPost" ); + myBinding->Type = qualifiedName; + + // Create 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + Console::WriteLine( "HttpBinding Namespace : {0}", HttpBinding::Namespace ); + // + + // Add 'HttpBinding' to 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + // + + // Create 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; + myOperation->Location = "/AddNumbers"; + + // Add 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myOperation ); + + // Create 'InputBinding' object. + InputBinding^ myInput = gcnew InputBinding; + MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; + postMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInput->Extensions->Add( postMimeContentbinding ); + + // Add 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInput; + + // Create 'OutputBinding' object. + OutputBinding^ myOutput = gcnew OutputBinding; + MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; + postMimeXmlbinding->Part = "Body"; + myOutput->Extensions->Add( postMimeXmlbinding ); + + // Add 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + + // Add 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + + // + // Create a 'Port' object. + Port^ postPort = gcnew Port; + postPort->Name = "MyHttpBindingServiceHttpPost"; + postPort->Binding = gcnew XmlQualifiedName( "s0:MyHttpBindingServiceHttpPost" ); + + // Create 'HttpAddressBinding' object. + HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; + postAddressBinding->Location = "http://localhost/HttpBinding_ctor/HttpBinding_ctor_Service.cs.asmx"; + + // Add 'HttpAddressBinding' to 'Port'. + postPort->Extensions->Add( postAddressBinding ); + // + + // Add 'Port' to 'PortCollection' of 'ServiceDescription'. + myDescription->Services[ 0 ]->Ports->Add( postPort ); + + // Write 'ServiceDescription' as a WSDL file. + myDescription->Write( "HttpBinding_ctor_Output_CPP.wsdl" ); + Console::WriteLine( "WSDL file with name 'HttpBinding_ctor_Output_CPP.wsdl' file created Successfully" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp new file mode 100644 index 00000000000..a5bf4b16d1a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.AddHookChannelUri/CPP/class1.cpp @@ -0,0 +1,219 @@ + + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::IO; +using namespace System::Runtime::Remoting::Messaging; + +// This snippet demonstrates HttpChannel->AddHookChannelUri. +// client code should NOT call this call directly. So, I'm +// writing a class using an implementation that mimics the behavior +// of HttpChannel +// +ref class CustomChannel: public BaseChannelWithProperties, public IChannelReceiverHook, public IChannelReceiver, public IChannel, public IChannelSender +{ +public: + virtual void AddHookChannelUri( String^ channelUri ) + { + if ( channelUri != nullptr ) + { + array^uris = dataStore->ChannelUris; + + // This implementation only allows one URI to be hooked in. + if ( uris == nullptr ) + { + array^newUris = gcnew array(1); + newUris[ 0 ] = channelUri; + dataStore->ChannelUris = newUris; + wantsToListen = false; + } + else + { + String^ msg = "This channel is already listening for data, and can't be hooked into at this stage."; + throw gcnew System::Runtime::Remoting::RemotingException( msg ); + } + } + } + + // The rest of CustomChannel's implementation. + // + ref class TransportSink: public IServerChannelSink + { + public: + + property IServerChannelSink^ NextChannelSink + { + virtual IServerChannelSink^ get() + { + return next; + } + + } + TransportSink( IServerChannelSink^ nextSink ) + { + next = nextSink; + } + + // I am not implementing these because they are + // not needed for my snippet but they must be here. + virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ){} + + virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers ) + { + return nullptr; + } + + virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, IMessage^% msg, ITransportHeaders^% responseHeaders, Stream^% responseStream ) + { + msg = nullptr; + responseHeaders = nullptr; + responseStream = nullptr; + return ServerProcessing::Complete; + } + + + property IDictionary^ Properties + { + virtual IDictionary^ get() + { + return nullptr; + } + } + + private: + IServerChannelSink^ next; + }; + + +private: + TransportSink^ transportSink; + +public: + property IServerChannelSink^ ChannelSinkChain + { + virtual IServerChannelSink^ get() + { + return transportSink->NextChannelSink; + } + } + +public: + CustomChannel() + { + BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); + transportSink = gcnew TransportSink( formatterSink ); + priority = 0; + dataStore = gcnew ChannelDataStore( nullptr ); + wantsToListen = true; + socket = ""; + } + + CustomChannel( int portNum ) + { + BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); + transportSink = gcnew TransportSink( formatterSink ); + priority = 0; + dataStore = gcnew ChannelDataStore( nullptr ); + wantsToListen = false; + socket = String::Format( "http://localhost: {0}", portNum ); + } + + CustomChannel( IDictionary^ properties, IClientChannelSinkProvider^ clientSinkProvider, IServerChannelSinkProvider^ serverSinkProvider ){} + + + property String^ ChannelName + { + virtual String^ get() + { + return "custom"; + } + } + + property Object^ ChannelData + { + virtual Object^ get() + { + return dataStore; + } + } + + property bool WantsToListen + { + virtual bool get() + { + return wantsToListen; + } + } + + property int ChannelPriority + { + virtual int get() + { + return priority; + } + } + + property String^ ChannelScheme + { + virtual String^ get() + { + return "http"; + } + + } + virtual array^ GetUrlsForUri( String^ uri ) + { + array^urls = gcnew array(dataStore->ChannelUris->Length); + int i = 0; + IEnumerator^ myEnum = dataStore->ChannelUris->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ currUri = safe_cast(myEnum->Current); + urls[ i ] = String::Format( "{0} / {1}", socket, currUri ); + i++; + } + + return urls; + } + + virtual void StartListening( Object^ data ){} + + virtual void StopListening( Object^ data ){} + + virtual String^ Parse( String^ url, String^% objectURI ) + { + int lastSlash = url->LastIndexOf( "/" ); + objectURI = ""; + objectURI = url->Substring( lastSlash ); + return socket; + } + + virtual IMessageSink^ CreateMessageSink( String^ url, Object^ remoteChannelData, String^% objectURI ) + { + Parse( url, objectURI ); + return nullptr; + } + +private: + ChannelDataStore^ dataStore; + bool wantsToListen; + int priority; + String^ socket; +}; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + CustomChannel^ channel = gcnew CustomChannel( 8085 ); + channel->AddHookChannelUri( "TempConverter" ); + + //System::Runtime::Remoting::Channels.Http::HttpChannel* channel = new System::Runtime::Remoting::Channels.Http::HttpChannel(8085); + //System::Runtime::Remoting::Channels.Tcp::TcpChannel* channel = new System::Runtime::Remoting::Channels.Tcp::TcpChannel(8085); + System::Console::WriteLine( channel->GetUrlsForUri( "TempConverter" )[ 0 ] ); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp new file mode 100644 index 00000000000..15207731482 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.ChannelSinkChain/CPP/class1.cpp @@ -0,0 +1,215 @@ + + +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::IO; +using namespace System::Runtime::Remoting::Messaging; + +// This snippet demonstrates HttpChannel::ChannelSinkChain. +// client code should NOT call this call directly. So, I'm +// writing a class that implements the member as HttpChannel +// does. That is, it returns the first sink after the transport +// sink. ie... if the sink chain is transport=>encryption=>formatter +// then this member should return encryption. + +// +ref class CustomChannel: public BaseChannelWithProperties, public IChannelReceiverHook, public IChannelReceiver, public IChannel, public IChannelSender +{ +public: + + property IServerChannelSink^ ChannelSinkChain + { + // TransportSink is a private class defined within CustomChannel. + virtual IServerChannelSink^ get() + { + return transportSink->NextChannelSink; + } + } + + // Rest of CustomChannel's implementation... + // + CustomChannel() + { + BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); + transportSink = gcnew TransportSink( formatterSink ); + priority = 0; + dataStore = gcnew ChannelDataStore( nullptr ); + wantsToListen = true; + socket = ""; + } + + CustomChannel( int portNum ) + { + BinaryServerFormatterSink^ formatterSink = gcnew BinaryServerFormatterSink( BinaryServerFormatterSink::Protocol::Http,nullptr,this ); + transportSink = gcnew TransportSink( formatterSink ); + priority = 0; + dataStore = gcnew ChannelDataStore( nullptr ); + wantsToListen = false; + socket = "http://localhost: {0}",portNum; + } + + CustomChannel( IDictionary^ properties, IClientChannelSinkProvider^ clientSinkProvider, IServerChannelSinkProvider^ serverSinkProvider ){} + + property String^ ChannelName + { + virtual String^ get() + { + return "custom"; + } + + } + + property Object^ ChannelData + { + virtual Object^ get() + { + return dataStore; + } + + } + virtual void AddHookChannelUri( String^ channelUri ) + { + if ( channelUri != nullptr ) + { + array^uris = dataStore->ChannelUris; + if ( uris == nullptr ) + { + array^newUris = gcnew array(1); + newUris[ 0 ] = channelUri; + dataStore->ChannelUris = newUris; + } + else + { + String^ msg = "This channel is already listening for data, and can't be hooked into at this stage."; + throw gcnew System::Runtime::Remoting::RemotingException( msg ); + } + } + } + + property bool WantsToListen + { + virtual bool get() + { + return wantsToListen; + } + + } + + property int ChannelPriority + { + virtual int get() + { + return priority; + } + + } + + property String^ ChannelScheme + { + virtual String^ get() + { + return "http"; + } + + } + virtual array^ GetUrlsForUri( String^ uri ) + { + array^urls = gcnew array(dataStore->ChannelUris->Length); + int i = 0; + IEnumerator^ myEnum = dataStore->ChannelUris->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ currUri = safe_cast(myEnum->Current); + urls[ i ] = String::Format( "{0}/{1}", socket, currUri ); + i++; + } + + return urls; + } + + virtual void StartListening( Object^ data ){} + + virtual void StopListening( Object^ data ){} + + virtual String^ Parse( String^ url, String^% objectURI ) + { + int lastSlash = url->LastIndexOf( "/" ); + objectURI = ""; + objectURI = url->Substring( lastSlash ); + return socket; + } + + virtual IMessageSink^ CreateMessageSink( String^ url, Object^ remoteChannelData, String^% objectURI ) + { + Parse( url, objectURI ); + return nullptr; + } + + ref class TransportSink: public IServerChannelSink + { + public: + + property IServerChannelSink^ NextChannelSink + { + virtual IServerChannelSink^ get() + { + return next; + } + + } + TransportSink( IServerChannelSink^ nextSink ) + { + next = nextSink; + } + + // I am not implementing these because they are + // not needed for my snippet but they must be here. + virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ){} + + virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ sinkStack, Object^ state, IMessage^ msg, ITransportHeaders^ headers ) + { + return nullptr; + } + + virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, IMessage^% msg, ITransportHeaders^% responseHeaders, Stream^% responseStream ) + { + msg = nullptr; + responseHeaders = nullptr; + responseStream = nullptr; + return ServerProcessing::Complete; + } + + property IDictionary^ Properties + { + virtual IDictionary^ get() + { + return nullptr; + } + } + + private: + IServerChannelSink^ next; + }; + +private: + ChannelDataStore^ dataStore; + bool wantsToListen; + int priority; + String^ socket; + TransportSink^ transportSink; +}; + +int main() +{ + CustomChannel^ channel = gcnew CustomChannel( 8085 ); + channel->AddHookChannelUri( "TempConverter" ); + + //System::Runtime::Remoting::Channels.Http::HttpChannel* channel = new System::Runtime::Remoting::Channels.Http::HttpChannel(8085); + //System::Runtime::Remoting::Channels.Tcp::TcpChannel* channel = new System::Runtime::Remoting::Channels.Tcp::TcpChannel(8085); + System::Console::WriteLine( channel->ChannelSinkChain ); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp new file mode 100644 index 00000000000..76d14d8aed8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpChannel.GetUrlsFromUri/CPP/class1.cpp @@ -0,0 +1,33 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Collections; + +public ref class HelloService: public MarshalByRefObject{}; + +int main() +{ + // Create a remotable object. + HttpChannel^ httpChannel = gcnew HttpChannel( 8085 ); + WellKnownServiceTypeEntry^ WKSTE = gcnew WellKnownServiceTypeEntry( HelloService::typeid,"Service",WellKnownObjectMode::Singleton ); + RemotingConfiguration::RegisterWellKnownServiceType( WKSTE ); + RemotingConfiguration::ApplicationName = "HelloServer"; + + // Print out the urls for HelloServer. + array^urls = httpChannel->GetUrlsForUri( "HelloServer" ); + IEnumerator^ myEnum = urls->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ url = safe_cast(myEnum->Current); + System::Console::WriteLine( "{0}", url ); + } + + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp new file mode 100644 index 00000000000..6e1b41e8078 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpChannel/CPP/server.cpp @@ -0,0 +1,30 @@ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Lifetime; +using namespace SampleNamespace; + +// This assembly contains a remote service and its server host wrapped together. +int main() +{ + + // The following sample uses an HttpChannel constructor + // to create a new HttpChannel that will listen on port 9000. + // System::Runtime::Remoting::Channels.Http::HttpChannel.HttpChannel(int) + // System::Runtime::Remoting::Channels.Http::HttpChannel + // + HttpChannel^ channel = gcnew HttpChannel( 9000 ); + ChannelServices::RegisterChannel( channel, false ); + RemotingConfiguration::RegisterWellKnownServiceType( SampleNamespace::SampleService::typeid, "MySampleService/SampleService::soap", WellKnownObjectMode::Singleton ); + Console::WriteLine( "** Press enter to end the server process. **" ); + Console::ReadLine(); + // + + return 0; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp new file mode 100644 index 00000000000..4b14e0f5e34 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpGetClientProtocol_Constructor/CPP/httpgetclientprotocol_constructor.cpp @@ -0,0 +1,77 @@ + + +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +// System.Web.Services.Protocols.HttpGetClientProtocol.HttpGetClientProtocol +/* The following example demonstrates 'Constructor' of 'HttpGetClientProtocol' class +A variable of type 'HttpGetClientProtocol' is used to set proxy information , +client credentials and Url on the proxy class. +*/ +/* +// The following example is a proxy class generated by the Wsdl.exe +// utility for the Math Web service. The proxy class derives from +// HttpGetClientProtocol, which derives from the abstract +// HttpSimpleClientProtocol class. + +public class MyMath : System.Web.Services.Protocols.HttpGetClientProtocol +{ +[System.Diagnostics.DebuggerStepThroughAttribute()] +public MyMath() +{ +this.Url = "http://localhost/MyMath.Cs.asmx"; +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.Web.Services.Protocols.HttpMethodAttribute( +typeof(System.Web.Services.Protocols.XmlReturnReader), +typeof(System.Web.Services.Protocols.UrlParameterWriter))] +[return: System.Xml.Serialization.XmlRootAttribute("int", +Namespace="http://tempuri.org/", IsNullable=false)] +public int Add(string num1, string num2) +{ +return ((int)(this.Invoke("Add", (this.Url + "/Add"), new object[] { +num1, +num2}))); +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +public System.IAsyncResult BeginAdd(string num1, string num2, +System.AsyncCallback callback, object asyncState) +{ +return this.BeginInvoke("Add", (this.Url + "/Add"), new object[] { +num1, +num2}, callback, asyncState); +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +public int EndAdd(System.IAsyncResult asyncResult) +{ +return ((int)(this.EndInvoke(asyncResult))); +} +} +*/ +public ref class Math: public HttpGetClientProtocol{}; + +int main() +{ + + // + // Math is a proxy class derived from HttpGetClientProtocol. + HttpGetClientProtocol^ myHttpGetClientProtocol = gcnew ::Math; + + // Obtain password from a secure store. + String^ SecurelyStoredPassword = String::Empty; + + // Set the client-side credentials using the Credentials property. + ICredentials^ credentials = gcnew NetworkCredential( "Joe","mydomain",SecurelyStoredPassword ); + myHttpGetClientProtocol->Credentials = credentials; + Console::WriteLine( "Auto redirect is: {0}", myHttpGetClientProtocol->AllowAutoRedirect ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp new file mode 100644 index 00000000000..b09c48ea156 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpPostClientProtocol_Constructor/CPP/httppostclientprotocol_constructor.cpp @@ -0,0 +1,75 @@ +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +// System.Web.Services.Protocols.HttpPostClientProtocol.HttpPostClientProtocol +/* The following example demonstrates 'Constructor' of 'HttpPostClientProtocol' class +A variable of type 'HttpPostClientProtocol' is used to set proxy information , +client credentials and Url on the proxy class. +*/ +/* +// The following example is a proxy class generated by the Wsdl.exe utility +// for the Math Web service. The proxy class derives from +// HttpPostClientProtocol, which derives from the abstract +// HttpSimpleClientProtocol class. + +public class MyMath : System.Web.Services.Protocols.HttpPostClientProtocol +{ +[System.Diagnostics.DebuggerStepThroughAttribute()] +public MyMath() +{ +this.Url = "http://localhost/Mymath.Cs.asmx"; +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.Web.Services.Protocols.HttpMethodAttribute( +typeof(System.Web.Services.Protocols.XmlReturnReader), +typeof(System.Web.Services.Protocols.HtmlFormParameterWriter))] +[return: System.Xml.Serialization.XmlRootAttribute("int", +Namespace="http://tempuri.org/", IsNullable=false)] +public int Add(string num1, string num2) +{ +return ((int)(this.Invoke("Add", (this.Url + "/Add"), +new object[] {num1, num2}))); +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +public System.IAsyncResult BeginAdd(string num1, string num2, +System.AsyncCallback callback, object asyncState) +{ +return this.BeginInvoke("Add", (this.Url + "/Add"), +new object[] {num1, num2}, callback, asyncState); +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +public int EndAdd(System.IAsyncResult asyncResult) +{ +return ((int)(this.EndInvoke(asyncResult))); +} +} +*/ +public ref class Math: public HttpPostClientProtocol{}; + +int main() +{ + + // + // Math is a proxy class derived from HttpPostClientProtocol. + HttpPostClientProtocol^ myHttpPostClientProtocol = gcnew ::Math; + + // Obtain password from a secure store. + String^ SecurelyStoredPassword = String::Empty; + + // Set the client-side credentials using the Credentials property. + myHttpPostClientProtocol->Credentials = System::Net::CredentialCache::DefaultCredentials; + + // Allow the server to redirect the request. + myHttpPostClientProtocol->AllowAutoRedirect = true; + Console::WriteLine( "Auto redirect is: {0}", myHttpPostClientProtocol->AllowAutoRedirect ); + + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp new file mode 100644 index 00000000000..b891e831c59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpclientchannel_6_client.cpp @@ -0,0 +1,71 @@ + + +// System.Runtime.Remoting.Channels.Http.HttpClientChannel +// System.Runtime.Remoting.Channels.Http.HttpClientChannel.ChannelName; System.Runtime.Remoting.Channels.Http.HttpClientChannel.ChannelPriority; System.Runtime.Remoting.Channels.Http.HttpClientChannel.Parse(); System.Runtime.Remoting.Channels.Http.HttpClientChannel.Keys; System.Runtime.Remoting.Channels.Http.HttpClientChannel.CreateMessageSink() +/* +The following program demonstrates the 'HttpClientChannel' class and +'ChannelName','ChannelPriority' , 'Keys', properties, and 'Parse', +CreateMessageSink methods of 'HttpClientChannel' class. This program +create and registers 'HttpClientChannel'. This will change the priority +of the 'HttpClientChannel' channel and it displays the property values +of 'HttpClientChannel'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Collections; +using namespace System::Runtime::Remoting::Messaging; + +int main() +{ + try + { + // + // Creating the 'IDictionary' to set the server object properties. + IDictionary^ myDictionary = gcnew Hashtable; + myDictionary[ "name" ] = "HttpClientChannel"; + myDictionary[ "priority" ] = 2; + + // Set the properties along with the constructor. + HttpClientChannel^ myHttpClientChannel = gcnew HttpClientChannel( myDictionary,gcnew BinaryClientFormatterSinkProvider ); + + // Register the server channel. + ChannelServices::RegisterChannel( myHttpClientChannel ); + MyHelloServer ^ myHelloServer1 = dynamic_cast(Activator::GetObject( MyHelloServer::typeid, "http://localhost:8085/SayHello" )); + if ( myHelloServer1 == nullptr ) + System::Console::WriteLine( "Could not locate server" ); + else + { + Console::WriteLine( myHelloServer1->myHelloMethod( "Client" ) ); + + // Get the name of the channel. + Console::WriteLine( "Channel Name :{0}", myHttpClientChannel->ChannelName ); + + // Get the channel priority. + Console::WriteLine( "ChannelPriority :{0}", myHttpClientChannel->ChannelPriority ); + String^ myString; + String^ myObjectURI1; + Console::WriteLine( "Parse :{0}{1}", myHttpClientChannel->Parse( "http://localhost:8085/SayHello", myString ), myString ); + + // Get the key count. + System::Console::WriteLine( "Keys->Count : {0}", myHttpClientChannel->Keys->Count ); + + // Get the channel message sink that delivers message to the specified url. + IMessageSink^ myIMessageSink = myHttpClientChannel->CreateMessageSink( "http://localhost:8085/NewEndPoint", nullptr, myObjectURI1 ); + Console::WriteLine( "The channel message sink that delivers the messages to the URL is : {0}", myIMessageSink ); + Console::WriteLine( "URI of the new channel message sink is: {0}", myObjectURI1 ); + } + // + } + catch ( Exception^ ex ) + { + Console::WriteLine( "The following exception is raised on client side :{0}", ex->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp new file mode 100644 index 00000000000..e7549bfa2db --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpServerChannel_Server_Client/CPP/httpserverchannel_9_server.cpp @@ -0,0 +1,84 @@ + + +// System.Runtime.Remoting.Channels.Http.HttpServerChannel +// System.Runtime.Remoting.Channels.Http.HttpServerChannel.StartListening(); System.Runtime.Remoting.Channels.Http.HttpServerChannel.ChannelName; System.Runtime.Remoting.Channels.Http.HttpServerChannel.ChannelPriority; System.Runtime.Remoting.Channels.Http.HttpServerChannel.ChannelScheme; System.Runtime.Remoting.Channels.Http.HttpServerChannel.GetChannelUri(); System.Runtime.Remoting.Channels.Http.HttpServerChannel.WantsToListen +// System.Runtime.Remoting.Channels.Http.HttpServerChannel.Parse(); System.Runtime.Remoting.Channels.Http.HttpServerChannel.StopListening() +/* The following program demonstrates the 'HttpServerChannel' class, 'ChannelName', +'ChannelPriority', 'ChannelScheme', 'WantsToListen' properties, 'GetChannelUri', +'StartListening', 'StopListening' and 'Parse' methods of 'HttpServerChannel' class. +This program creates and registers 'HttpServerChannel'. This will change the priority +of the 'HttpServerChannel' channel and displays the property values of this class. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +int main() +{ + try + { + String^ myString; + + // + int myPort = 8085; + + // Creating the 'IDictionary' to set the server object properties. + IDictionary^ myDictionary = gcnew Hashtable; + myDictionary[ "name" ] = "MyServerChannel1"; + myDictionary[ "priority" ] = 2; + myDictionary[ "port" ] = 8085; + + // Set the properties along with the constructor. + HttpServerChannel^ myHttpServerChannel = gcnew HttpServerChannel( myDictionary,gcnew BinaryServerFormatterSinkProvider ); + + // Register the server channel. + ChannelServices::RegisterChannel( myHttpServerChannel ); + RemotingConfiguration::RegisterWellKnownServiceType( MyHelloServer::typeid, "SayHello", WellKnownObjectMode::SingleCall ); + myHttpServerChannel->WantsToListen = true; + + // Start listening on a specific port. + myHttpServerChannel->StartListening( myPort ); + + // Get the name of the channel. + Console::WriteLine( "ChannelName : {0}", myHttpServerChannel->ChannelName ); + + // Get the channel priority. + Console::WriteLine( "ChannelPriority : {0}", myHttpServerChannel->ChannelPriority ); + + // Get the schema of the channel. + Console::WriteLine( "ChannelScheme : {0}", myHttpServerChannel->ChannelScheme ); + + // Get the channel URI. + Console::WriteLine( "GetChannelUri : {0}", myHttpServerChannel->GetChannelUri() ); + + // Indicates whether 'IChannelReceiverHook' wants to be hooked into the outside listener service. + Console::WriteLine( "WantsToListen : {0}", myHttpServerChannel->WantsToListen ); + // + + // + // Extract the channel URI and the remote well known object URI from the specified URL. + Console::WriteLine( "Parsed : {0}", myHttpServerChannel->Parse( String::Concat( myHttpServerChannel->GetChannelUri(), "/SayHello" ), myString ) ); + Console::WriteLine( "Remote WellKnownObject : {0}", myString ); + Console::WriteLine( "Hit to stop listening..." ); + Console::ReadLine(); + + // Stop listening to channel. + myHttpServerChannel->StopListening( myPort ); + // + + Console::WriteLine( "Hit to exit..." ); + Console::ReadLine(); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "The following exception is raised on server side : {0}", ex->Message ); + } + +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp new file mode 100644 index 00000000000..6553b346e86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpSimpleClientProtocol.Invoke Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +namespace MyMath +{ + + [System::Web::Services::WebServiceBindingAttribute(Name="MathSoap",Namespace="http://tempuri.org/")] + public ref class Math: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + Math() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int num1, int num2 ) + { + array^temp0 = {num1,num2}; + array^results = this->Invoke( "Add", temp0 ); + return *dynamic_cast(results[ 0 ]); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp new file mode 100644 index 00000000000..21704539710 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpVersion_Version10/CPP/httpversion_version10.cpp @@ -0,0 +1,49 @@ +/*System::Net::HttpVersion::Version10 +This program demonstrates the 'Version10' field of the 'HttpVersion' Class. +The 'Version' property of 'HttpRequestMessage' class identifies the Version of HTTP being used. +Then the default value of 'Version' property is displayed to the console. +The 'Version10' field of the 'HttpVersion' class is assigned to the 'Version' property of the 'HttpRequestMessage' Class. +The changed Version and the 'Version' of the response object are displayed. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Http; + +int main() +{ + try + { + // + // HttpClient lifecycle management best practices: + // https://learn.microsoft.com/dotnet/fundamentals/networking/http/httpclient-guidelines#recommended-use + HttpClient^ client = gcnew HttpClient(); + + HttpRequestMessage^ request = new HttpRequestMessage(HttpMethod::Get, "http://www.microsoft.com"); + Console::WriteLine("Default HTTP request version is {0}", request.Version); + + request.Version = HttpVersion.Version10; + Console::WriteLine("Request version after assignment is {0}", request.Version); + + HttpResponseMessage^ response = client->Send(request); + Console::WriteLine("Response HTTP version {0}", response.Version); + // + Console::WriteLine("\nPress 'Enter' Key to Continue.............."); + Console::Read(); + } + catch (HttpRequestException^ e) + { + Console::WriteLine("HttpRequestException Caught!"); + Console::WriteLine("Message : {0} ", e->Message); + Console::WriteLine("Source : {0} ", e->Source); + } + catch (Exception^ e) + { + Console::WriteLine("Exception Caught!"); + Console::WriteLine("Source : {0}", e->Source); + Console::WriteLine("Message : {0}", e->Message); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp new file mode 100644 index 00000000000..2b454542d5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebClientProtocol_UserAgent/CPP/httpwebclientprotocol_useragent.cpp @@ -0,0 +1,78 @@ +#using +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::Xml; + +// System.Web.Services.Protocols.HttpWebClientProtocol.UserAgent +/* The following example demonstrates 'UserAgent' member of 'HttpWebClientProtocol' +class. First the default user agent is displayed. Then the user agent is modified +and displayed. +*/ +/* +The following example is a proxy class generated by the Wsdl.exe utility +for the Math Web service. The proxy class derives from SoapHttpClientProtocol, +which derives from the abstract HttpWebClientProtocol class. + +[System.Web.Services.WebServiceBindingAttribute(Name="MyMathSoap", +Namespace="http://tempuri.org/")] +public class MyMath : System.Web.Services.Protocols.SoapHttpClientProtocol +{ +[System.Diagnostics.DebuggerStepThroughAttribute()] +public MyMath() +{ +this.Url = "http://localhost/Mymath.Cs.asmx"; +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +[System.Web.Services.Protocols.SoapDocumentMethodAttribute( +"http://tempuri.org/Add", +Use=System.Web.Services.Description.SoapBindingUse.Literal, +ParameterStyle= +System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] +public int Add(int num1, int num2) +{ +object[] results = this.Invoke("Add", +new object[] {num1, num2}); +return ((int)(results[0])); +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +public System.IAsyncResult BeginAdd(int num1, int num2, +System.AsyncCallback callback, object asyncState) +{ +return this.BeginInvoke("Add", new object[] {num1, num2}, +callback, asyncState); +} + +[System.Diagnostics.DebuggerStepThroughAttribute()] +public int EndAdd(System.IAsyncResult asyncResult) +{ +object[] results = this.EndInvoke(asyncResult); +return ((int)(results[0])); +} +} +*/ +namespace test +{ + public ref class MyMath: public SoapHttpClientProtocol{}; + +} + +int main() +{ + + // + // MyMath is a proxy class. + test::MyMath^ objMyMath = gcnew test::MyMath; + + // Get the default user agent. + Console::WriteLine( "Default user agent is: {0}", objMyMath->UserAgent ); + objMyMath->UserAgent = "My Agent"; + Console::WriteLine( "Modified user agent is: {0}", objMyMath->UserAgent ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp new file mode 100644 index 00000000000..defe1c29135 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Accept/CPP/httpwebrequest_accept.cpp @@ -0,0 +1,92 @@ +/* System::Net::HttpWebRequest::Accept +This program demonstrates 'Accept' property of the 'HttpWebRequest' class. +A new 'HttpWebRequest' Object* is created. The 'Accept' property of 'HttpWebRequest' +class is set to 'image/*' that in turn sets the 'Accept' field of HTTP Request Headers to +S"image/*". HTTP Request and Response headers are displayed to the console. +The contents of the page of the requested URI are displayed to the console. +'Accept' property is set with an aim to receive the response in a specific format. + +Note: This program requires http://localhost/CodeSnippetTest::html as Command line parameter. +If the requested page contains any content other than 'image/*' an error of 'status (406) Not Acceptable' +is returned. The functionality of 'Accept' property is supported only by servers that use HTTP 1.1 +protocol.Please refer to RFC 2616 for further information on HTTP Headers. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; + +void GetPage( String^ myUri ) +{ + try + { +// + // Create a 'HttpWebRequest' object. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); + // Set the 'Accept' property to accept an image of any type. + myHttpWebRequest->Accept = "image/*"; + // The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); +// + Console::WriteLine( "\nHTTP Request Headers :\n\n {0}", myHttpWebRequest->Headers ); + Console::WriteLine( "\nHTTP Response Headers :\n\n {0}", myHttpWebResponse->Headers ); + Console::WriteLine( "Press 'Enter' Key to Continue......." ); + Console::Read(); + // Displaying the contents of the page to the console + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuffer = gcnew array(256); + int count = streamRead->Read( readBuffer, 0, 256 ); + Console::WriteLine( "\nThe contents of HTML page are......." ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuffer,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuffer, 0, 256 ); + } + Console::WriteLine( "\nPress 'Enter' Key to Continue......" ); + Console::Read(); + streamRead->Close(); + streamResponse->Close(); + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + try + { + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the Uri address as a command line parameter" ); + Console::WriteLine( "Usage:HttpWebRequest_Accept http://www.microsoft.com/library/homepage/images/ms-banner.gif" ); + } + else + { + GetPage( args[ 1 ] ); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp new file mode 100644 index 00000000000..1e2f153e109 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowAutoRedirect/CPP/httpwebrequest_allowautoredirect.cpp @@ -0,0 +1,60 @@ +/* System::Net::HttpWebRequest::AllowAutoRedirect System::Net::HttpWebRequest->Address +This program demonstrates the 'AllowAutoRedirect' and 'Address' properties of the 'HttpWebRequest' Class. +A new 'HttpWebRequest' Object* is created. The 'AllowAutoredirect' property, which redirects a page automatically +to the new Uri, is set to true. Using the 'Address' property, the address of the 'Responding Uri' is printed to +console. The contents of the redirected page are displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// +// + // Create a new HttpWebRequest Object to the mentioned URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + myHttpWebRequest->MaximumAutomaticRedirections = 1; + myHttpWebRequest->AllowAutoRedirect = true; + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); +// + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of Html Page are : " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); + Console::WriteLine( "\nThe Requested Uri is {0}", myHttpWebRequest->RequestUri ); + Console::WriteLine( "\nThe Actual Uri responding to the request is \n {0}", myHttpWebRequest->Address ); +// + Console::WriteLine( "\nPress any Key to Continue.........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException raised!" ); + Console::WriteLine( "\nMessage: {0}", e->Message ); + Console::WriteLine( "\nStatus: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "\nSource : {0}", e->Source ); + Console::WriteLine( "\nMessage : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp new file mode 100644 index 00000000000..da5e28f5284 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_AllowWriteStreamBuffering/CPP/httpwebrequest_allowwritestreambuffering.cpp @@ -0,0 +1,81 @@ +/*System::Net::HttpWebRequest::AllowWriteStreamBuffering +This program demonstrates 'AllowWriteStreamBuffering' property of 'HttpWebRequestClass'. +A new 'HttpWebRequest' Object* is created. +The 'AllowWriteStreamBuffering' property value is set to false. +If the 'AllowWriteStreamBuffering' is set to false, +then 'ContentLength' property should be set to the length of data to be posted before posting the data +else the Http Status(411) Length required is returned. +Data to be posted to the Uri is requested from the user. +The 'Method' property is set to POST to be able to post data to the Uri. +The 'GetRequestStream' method of the 'HttpWebRequest' class returns a stream Object*. +This stream Object* is used to write data to the Uri. +The HTML contents of the page are displayed to the console after the posted data is accepted by the URL + +Note:This program posts data to the Uri : http://www20.brinkster.com/codesnippets/next.asp. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new 'HttpWebRequest' object to the mentioned Uri. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com/codesnippets/next.asp" ) ); + // Set AllowWriteStreamBuffering to 'false'. + myHttpWebRequest->AllowWriteStreamBuffering = false; + Console::WriteLine( "\nPlease Enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp) uri:" ); + String^ inputData = Console::ReadLine(); + String^ postData = String::Concat( "firstone= ", inputData ); + // Set 'Method' property of 'HttpWebRequest' class to POST. + myHttpWebRequest->Method = "POST"; + ASCIIEncoding^ encodedData = gcnew ASCIIEncoding; + array^ byteArray = encodedData->GetBytes( postData ); + // Set 'ContentType' property of the 'HttpWebRequest' class to S"application/x-www-form-urlencoded". + myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; + // If the AllowWriteStreamBuffering property of HttpWebRequest is set to false, the contentlength has to be set to length of data to be posted else Exception(411) is raised. + myHttpWebRequest->ContentLength = byteArray->Length; + Stream^ newStream = myHttpWebRequest->GetRequestStream(); + newStream->Write( byteArray, 0, byteArray->Length ); + newStream->Close(); + Console::WriteLine( "\nData has been posted to the Uri\n\nPlease wait for the response.........." ); + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); +// + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the Html page are : " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::WriteLine( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); + Console::WriteLine( "\nPress 'Enter' Key to Continue................." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + Console::WriteLine( "\n(The 'ContentLength' property of 'HttpWebRequest' is not set after 'AllowWriteStreamBuffering' is set to 'false'.)" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp new file mode 100644 index 00000000000..452b35e9ca7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetRequestStream/CPP/httpwebrequest_begingetrequeststream.cpp @@ -0,0 +1,97 @@ +/* System::Net::HttpWebRequest::BeginGetRequestStream, System::Net::HttpWebRequest::EndGetRequestStream + +This program demonstrates the 'BeginGetRequestStream' and 'EndGetRequestStream' methods of the 'HttpWebRequest' class. +A new 'HttpWebRequest' Object is created. The 'Method' property of the 'HttpWebRequest' Object* is set to +'POST'. The 'ContentType' property is set to S"application/x-www-form-urlencoded". Then, the 'BeginGetRequestStream' +method of 'HttpWebRequest' class starts the Asynchronous writing to the 'HttpWebRequest' Object*. The +'EndGetRequestStream' method of 'HttpWebRequest' class ends the Asynchronous writing of data and returns a +stream Object*. The 'Stream' Object* is used to write data to the 'HttpWebRequest' Object*. + +Note: This program POSTs data to the Uri: http://www20.Brinkster::com/codesnippets/next.asp +*/ +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Threading; +ref class HttpWebRequestBeginGetRequest +{ +public: + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + static void Main() + { + + // + // Create a new HttpWebRequest object. + HttpWebRequest^ request = dynamic_cast(WebRequest::Create( "http://www.contoso.com/example.aspx" )); + + // Set the ContentType property. + request->ContentType = "application/x-www-form-urlencoded"; + + // Set the Method property to 'POST' to post data to the Uri. + request->Method = "POST"; + + // Start the asynchronous operation. + AsyncCallback^ del = gcnew AsyncCallback(GetRequestStreamCallback); + request->BeginGetRequestStream( del, request ); + + // Keep the main thread from continuing while the asynchronous + // operation completes. A real world application + // could do something useful such as updating its user interface. + allDone->WaitOne(); + } + + +private: + static void GetRequestStreamCallback(IAsyncResult^ asynchronousResult) + { + HttpWebRequest^ request = dynamic_cast(asynchronousResult->AsyncState); + + // End the operation + Stream^ postStream = request->EndGetRequestStream(asynchronousResult); + + Console::WriteLine("Please enter the input data to be posted:"); + String^ postData = Console::ReadLine(); + + // Convert the string into a byte array. + array^ByteArray = Encoding::UTF8->GetBytes(postData); + + // Write to the request stream. + postStream->Write(ByteArray, 0, postData->Length); + postStream->Close(); + + // Start the asynchronous operation to get the response + AsyncCallback^ del = gcnew AsyncCallback(GetResponseCallback); + request->BeginGetResponse(del, request); + } + + static void GetResponseCallback(IAsyncResult^ asynchronousResult) + { + HttpWebRequest^ request = dynamic_cast(asynchronousResult->AsyncState); + + // End the operation + HttpWebResponse^ response = dynamic_cast(request->EndGetResponse(asynchronousResult)); + Stream^ streamResponse = response->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader(streamResponse); + String^ responseString = streamRead->ReadToEnd(); + Console::WriteLine(responseString); + // Close the stream object + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse + response->Close(); + allDone->Set(); + } + // +}; + +void main() +{ + HttpWebRequestBeginGetRequest::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp new file mode 100644 index 00000000000..fb120510b57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_BeginGetResponse/CPP/httpwebrequest_begingetresponse.cpp @@ -0,0 +1,158 @@ + + +// System::Net::HttpWebRequest::BeginGetResponse System::Net::HttpWebRequest::EndGetResponse +/** +* Snippet1, Snippet2, Snippet3 go together. +* This program shows how to use BeginGetResponse and EndGetResponse methods of the +* HttpWebRequest class. +* It uses an asynchronous approach to get the response for the HTTP Web Request. +* The RequestState class is defined to chekc the state of the request. +* After a HttpWebRequest Object* is created, its BeginGetResponse method is used to start +* the asynchronous response phase. +* Finally, the EndGetResponse method is used to end the asynchronous response phase . +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Threading; +public ref class RequestState +{ +private: + + // This class stores the State of the request. + const int BUFFER_SIZE; + +public: + StringBuilder^ requestData; + array^BufferRead; + HttpWebRequest^ request; + HttpWebResponse^ response; + Stream^ streamResponse; + RequestState() + : BUFFER_SIZE( 1024 ) + { + BufferRead = gcnew array(BUFFER_SIZE); + requestData = gcnew StringBuilder( "" ); + request = nullptr; + streamResponse = nullptr; + } + +}; + +ref class HttpWebRequest_BeginGetResponse +{ +public: + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + static int BUFFER_SIZE = 1024; + + // + // + static void RespCallback( IAsyncResult^ asynchronousResult ) + { + try + { + + // State of request is asynchronous. + RequestState^ myRequestState = dynamic_cast(asynchronousResult->AsyncState); + HttpWebRequest^ myHttpWebRequest2 = myRequestState->request; + myRequestState->response = dynamic_cast(myHttpWebRequest2->EndGetResponse( asynchronousResult )); + + // Read the response into a Stream object. + Stream^ responseStream = myRequestState->response->GetResponseStream(); + myRequestState->streamResponse = responseStream; + + // Begin the Reading of the contents of the HTML page and print it to the console. + IAsyncResult^ asynchronousInputRead = responseStream->BeginRead( myRequestState->BufferRead, 0, BUFFER_SIZE, gcnew AsyncCallback( ReadCallBack ), myRequestState ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nException raised!" ); + Console::WriteLine( "\nMessage: {0}", e->Message ); + Console::WriteLine( "\nStatus: {0}", e->Status ); + } + + } + + static void ReadCallBack( IAsyncResult^ asyncResult ) + { + try + { + RequestState^ myRequestState = dynamic_cast(asyncResult->AsyncState); + Stream^ responseStream = myRequestState->streamResponse; + int read = responseStream->EndRead( asyncResult ); + + // Read the HTML page and then print it to the console. + if ( read > 0 ) + { + myRequestState->requestData->Append( Encoding::ASCII->GetString( myRequestState->BufferRead, 0, read ) ); + IAsyncResult^ asynchronousResult = responseStream->BeginRead( myRequestState->BufferRead, 0, BUFFER_SIZE, gcnew AsyncCallback( ReadCallBack ), myRequestState ); + } + else + { + Console::WriteLine( "\nThe contents of the Html page are : " ); + if ( myRequestState->requestData->Length > 1 ) + { + String^ stringContent; + stringContent = myRequestState->requestData->ToString(); + Console::WriteLine( stringContent ); + } + Console::WriteLine( "Press any key to continue.........." ); + Console::ReadLine(); + responseStream->Close(); + allDone->Set(); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nException raised!" ); + Console::WriteLine( "\nMessage: {0}", e->Message ); + Console::WriteLine( "\nStatus: {0}", e->Status ); + } + + } + +}; + +int main() +{ + try + { + + // Create a HttpWebrequest object to the desired URL. + HttpWebRequest^ myHttpWebRequest1 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); + + // Create an instance of the RequestState and assign the previous myHttpWebRequest1 + // object to its request field. + RequestState^ myRequestState = gcnew RequestState; + myRequestState->request = myHttpWebRequest1; + + // Start the asynchronous request. + IAsyncResult^ result = dynamic_cast(myHttpWebRequest1->BeginGetResponse( gcnew AsyncCallback( HttpWebRequest_BeginGetResponse::RespCallback ), myRequestState )); + HttpWebRequest_BeginGetResponse::allDone->WaitOne(); + + // Release the HttpWebResponse resource. + myRequestState->response->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nException raised!" ); + Console::WriteLine( "\nMessage: {0}", e->Message ); + Console::WriteLine( "\nStatus: {0}", e->Status ); + Console::WriteLine( "Press any key to continue.........." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised!" ); + Console::WriteLine( "Source : {0} ", e->Source ); + Console::WriteLine( "Message : {0} ", e->Message ); + Console::WriteLine( "Press any key to continue.........." ); + Console::Read(); + } + +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp new file mode 100644 index 00000000000..6d2c9db2782 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Connection/CPP/httpwebrequest_connection.cpp @@ -0,0 +1,94 @@ + + +// System::Net::HttpWebRequest::KeepAlive System::Net::HttpWebRequest::Connection +/** +* This program demonstrates Connection and KeepAlive properties of the +* HttpWebRequest Class. +* Two new HttpWebRequest objects are created. The KeepAlive property of one of +* the objects is set to false that in turn sets the value of Connection field of +* the HTTP request Headers to Close. +* The Connection property of the other HttpWebRequest Object* is assigned the +* value Close. This throws an ArgumentException which is caught. The HTTP request +* Headers are displayed to the console. +* The contents of the HTML page of the requested URI are displayed. +**/ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +// +int main() +{ + try + { + + // Create a new HttpWebRequest object. Make sure that + // a default proxy is set if you are behind a firewall. + HttpWebRequest^ myHttpWebRequest1 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); + myHttpWebRequest1->KeepAlive = false; + + // Assign the response object of HttpWebRequest to a HttpWebResponse variable. + HttpWebResponse^ myHttpWebResponse1 = dynamic_cast(myHttpWebRequest1->GetResponse()); + Console::WriteLine( "\nThe HTTP request Headers for the first request are: \n {0}", myHttpWebRequest1->Headers ); + Console::WriteLine( "Press Enter Key to Continue.........." ); + Console::Read(); + Stream^ streamResponse = myHttpWebResponse1->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "The contents of the Html page are.......\n" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + Console::WriteLine(); + + // Close the Stream object. + streamResponse->Close(); + streamRead->Close(); + + // Release the resources held by response object. + myHttpWebResponse1->Close(); + + // + // Create a new HttpWebRequest object for the specified Uri. + HttpWebRequest^ myHttpWebRequest2 = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); + myHttpWebRequest2->Connection = "Close"; + + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse2 = dynamic_cast(myHttpWebRequest2->GetResponse()); + + // Release the resources held by response object. + myHttpWebResponse2->Close(); + Console::WriteLine( "\nThe Http RequestHeaders are \n {0}", myHttpWebRequest2->Headers ); + + // + Console::WriteLine( "\nPress 'Enter' Key to Continue........." ); + Console::Read(); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( "\nThe second HttpWebRequest Object* has raised an Argument Exception as 'Connection' Property is set to 'Close'" ); + Console::WriteLine( "\n {0}", e->Message ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException raised!" ); + Console::WriteLine( "\n {0}", e->Message ); + Console::WriteLine( "\n {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "Source : {0} ", e->Source ); + Console::WriteLine( "Message : {0} ", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp new file mode 100644 index 00000000000..39d85a9efc9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ContentLength/CPP/httpwebrequest_contentlength.cpp @@ -0,0 +1,102 @@ +/* +System::Net::HttpWebRequest::Method, System::Net::HttpWebRequest::ContentLength, System::Net::HttpWebRequest::ContentType +System::Net::HttpWebRequest::GetRequestStream +This program the demonstrates 'Method', 'ContentLength', and 'ContentType' properties and the 'GetRequestStream' +method of the HttpWebRequest Class. +It creates a 'HttpWebRequest' Object*. The 'Method' property of 'HttpWebRequestClass' is set to 'POST'. +The 'ContentType' property is set to 'application/x-www-form-urlencoded'. The 'ContentLength' property +is set to the length of the Byte stream to be posted. A new 'Stream' Object* is obtained from the +'GetRequestStream' method of the 'HttpWebRequest' class. Data to be posted is requested from the user. +Data is posted using the stream Object*. The HTML contents of the page are then displayed to the console +after the Posted data is accepted by the URL. +Note: This program POSTs data to the Uri: http://www20.Brinkster::com/codesnippets/next.asp +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { + // Create a new WebRequest Object to the mentioned Uri. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com/codesnippets/next.asp" ) ); + + Console::WriteLine( "\nThe value of 'ContentLength' property before sending the data is {0}", myHttpWebRequest->ContentLength ); + +// +// + // Set the 'Method' property of the 'Webrequest' to 'POST'. + myHttpWebRequest->Method = "POST"; + Console::WriteLine( "\nPlease enter the data to be posted to the (http://www.contoso.com/codesnippets/next.asp) Uri :" ); + + // Create a new String* Object* to POST data to the Url. + String^ inputData = Console::ReadLine(); + +// +// + String^ postData = String::Concat( "firstone= ", inputData ); + ASCIIEncoding^ encoding = gcnew ASCIIEncoding; + array^ byte1 = encoding->GetBytes( postData ); + + // Set the content type of the data being posted. + myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; + + // Set the content length of the String* being posted. + myHttpWebRequest->ContentLength = byte1->Length; + + Stream^ newStream = myHttpWebRequest->GetRequestStream(); + + newStream->Write( byte1, 0, byte1->Length ); + Console::WriteLine( "The value of 'ContentLength' property after sending the data is {0}", myHttpWebRequest->ContentLength ); + + // Close the Stream Object*. + newStream->Close(); +// +// +// +// + Console::WriteLine( "\nThe String* entered is successfully posted to the Uri " ); + Console::WriteLine( "Please wait for the response......." ); + + // Assign the response Object* of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + + Console::WriteLine( "\nThe contents of the HTML page are : " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::WriteLine( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + + // Close the Stream object. + streamResponse->Close(); + streamRead->Close(); + + // Release the resources held by response Object*. + myHttpWebResponse->Close(); + Console::WriteLine( "\nPress 'Enter' Key to Continue............." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException raised!" ); + Console::WriteLine( "\n {0}", e->Message ); + Console::WriteLine( "\n {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp new file mode 100644 index 00000000000..dbc0defcc7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Headers/CPP/httpwebrequest_headers.cpp @@ -0,0 +1,57 @@ +/*System::Net::HttpWebRequest::Headers +This program demonstrates the 'Headers' property of 'HttpWebRequest' Class. +A new 'HttpWebRequest' Object* is created. +The (name, value) collection of the Http Headers are displayed to the console. +The contents of the HTML page of the requested URI are displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new 'HttpWebRequest' Object to the mentioned URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + Console::WriteLine( "\nThe HttpHeaders are \n\n\tName\t\tValue\n {0}", myHttpWebRequest->Headers ); + // Print the HTML contents of the page to the console. + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe HTML contents of page the are : \n\n " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); +// + Console::WriteLine( "\nPress 'Enter' Key to Continue........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + Console::WriteLine( "Status : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp new file mode 100644 index 00000000000..2ffbd73948e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_IfModifiedSince/CPP/httpwebrequest_ifmodifiedsince.cpp @@ -0,0 +1,90 @@ + + +/* +System::Net::HttpWebRequest::IfModifiedSince +This program demonstrates the 'IfModifiedSince' property of the 'HttpWebRequest' class . +A new 'HttpWebrequest' Object* is created. +A new 'DateTime' Object* is created with the value intialized to the present DateTime. +The 'IfModifiedSince' property of 'HttpWebRequest' Object* is compared with the 'DateTime' Object*. +If the requested page has been modified since the time of the DateTime Object* +then the output displays the page has been modified +else the response headers and the contents of the page of the requested Uri are printed to the Console. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +int main() +{ + try + { + + // + // Create a new 'Uri' object with the mentioned string. + Uri^ myUri = gcnew Uri( "http://www.contoso.com" ); + + // Create a new 'HttpWebRequest' object with the above 'Uri' object. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( myUri )); + + // Create a new 'DateTime' object. + DateTime targetDate = DateTime::Now; + // Set a target date of a week ago + targetDate.AddDays(-7.0); + myHttpWebRequest->IfModifiedSince = targetDate; + + try + { + + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + Console::WriteLine( "Response headers \n {0}\n", myHttpWebResponse->Headers ); + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of Html Page are : \n" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); + Console::WriteLine( "\nPress 'Enter' key to continue................." ); + Console::Read(); + } + catch ( WebException^ e ) + { + if (e->Response) + { + if ( ((HttpWebResponse ^)e->Response)->StatusCode == HttpStatusCode::NotModified) + Console::WriteLine("\nThe page has not been modified since {0}", targetDate); + else + Console::WriteLine("\nUnexpected status code = {0}", ((HttpWebResponse ^)e->Response)->StatusCode); + } + else + Console::WriteLine("\nUnexpected Web Exception {0}" + e->Message); + } +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp new file mode 100644 index 00000000000..df05ea9c022 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_PipeLined/CPP/httpwebrequest_pipelined.cpp @@ -0,0 +1,86 @@ +/*System::Net.HttpWebRequest::PipeLined +This program demonstrates 'Pipelined' property of the 'HttpWebRequest' class. +A new 'HttpWebRequest' Object* is created. The 'Pipelined' property is displayed to the console. +HTTP Request and Response Headers are displayed to the console. The contents of the page of the +requested URI are displayed to the console. + +Note:The 'Pipelined' property is supported only by servers that allow Pipelining of requests. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +void GetPage( String^ myUri ) +{ + try + { +// + // Create a 'HttpWebRequest' object. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + // Display the contents of the page to the console. + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuffer = gcnew array(256); + int count = streamRead->Read( readBuffer, 0, 256 ); + Console::WriteLine( "\nThe contents of HTML page are......." ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuffer,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuffer, 0, 256 ); + } + Console::WriteLine( "\nHTTP Request Headers :\n\n {0}", myHttpWebRequest->Headers ); + Console::WriteLine( "\nHTTP Response Headers :\n\n {0}", myHttpWebResponse->Headers ); + streamRead->Close(); + streamResponse->Close(); + // Release the response object resources. + myHttpWebResponse->Close(); + Console::WriteLine( "\n'Pipelined' property is: {0}", myHttpWebRequest->Pipelined ); + Console::WriteLine( "\nPress 'Enter' Key to Continue......" ); + Console::Read(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + try + { + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the Uri address as a command line parameter:" ); + Console::WriteLine( "->Item[ Usage:HttpWebRequest_Pipelined http://www.microsoft.com ]" ); + } + else + { + GetPage( args[ 1 ] ); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp new file mode 100644 index 00000000000..c8320fd47ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_ProtocolVersion/CPP/httpwebrequest_protocolversion.cpp @@ -0,0 +1,67 @@ +/* System::Net::HttpWebRequest::ProtocolVersion +This Program demonstrates the 'ProtocolVersion' property of the 'HttpWebRequest' Class. +The 'ProtocolVersion' is a property that identifies the Version of the Protocol being used. +A new 'HttpWebRequest' Object* is created. Then the default version, being used is displayed onto +the console. It is then set to another version and displayed to the Console::The HTML contents +of the page of the requested Uri are printed to the console. +Note: Here the 'ProtocolVersion' property displays the ProtocolVersion being used. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new 'HttpWebRequest' Object to the mentioned URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.microsoft.com" ) ); + // Use the existing 'ProtocolVersion' , and display it onto the console. + Console::WriteLine( "\nThe 'ProtocolVersion' of the protocol used is {0}", myHttpWebRequest->ProtocolVersion ); + // Set the 'ProtocolVersion' property of the 'HttpWebRequest' to 'Version1::0' . + myHttpWebRequest->ProtocolVersion = HttpVersion::Version10; + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + Console::WriteLine( "\nThe 'ProtocolVersion' of the protocol changed to {0}", myHttpWebRequest->ProtocolVersion ); + Console::WriteLine( "\nThe protocol version of the response Object* is {0}", myHttpWebResponse->ProtocolVersion ); +// + Console::WriteLine( "\nPress any Key to Continue.............." ); + Console::Read(); + Console::Read(); + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the HTML Page are :" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); + Console::WriteLine( "\nPress any Key to Continue.............." ); + Console::Read(); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException raised!" ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + Console::WriteLine( "\nStatus: {0} ", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException raised!" ); + Console::WriteLine( "\nSource : {0}", e->Source ); + Console::WriteLine( "\nMessage : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp new file mode 100644 index 00000000000..b5053d05743 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Referer/CPP/httpwebrequest_referer.cpp @@ -0,0 +1,89 @@ +/*System::Net::HttpWebRequest::Referer +This program demonstrates the 'Referer' property of the 'HttpWebRequest' class. +A new 'HttpWebRequest' Object* is created. The 'Referer' property is displayed to the console. +HTTP Request and Response Headers are displayed to the console. The contents of the page of the +requested URI are displayed to the console. + +Note: The 'Referer' property is used by the server to store the address of the Uri that has referred +the request to that server.Please refer to RFC 2616 for more information on HTTP Headers. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +void GetPage( String^ myUri ) +{ + try + { +// + // Create a 'HttpWebRequest' object. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); + // Set referer property to http://www.microsoft.com . + myHttpWebRequest->Referer = "http://www.microsoft.com"; + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + // Display the contents of the page to the console. + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuffer = gcnew array(256); + int count = streamRead->Read( readBuffer, 0, 256 ); + Console::WriteLine( "\nThe contents of HTML page are......." ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuffer,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuffer, 0, 256 ); + } + Console::WriteLine( "\nHTTP Request Headers :\n\n {0}", myHttpWebRequest->Headers ); + Console::WriteLine( "\nHTTP Response Headers :\n\n {0}", myHttpWebResponse->Headers ); + streamRead->Close(); + streamResponse->Close(); + // Release the response object resources. + myHttpWebResponse->Close(); + Console::WriteLine( "Referer to the site is: {0}", myHttpWebRequest->Referer ); +// + Console::WriteLine( "\nPress 'Enter' Key to Continue......" ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + try + { + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the Uri address as a command line parameter" ); + Console::WriteLine( "->Item[ Usage:HttpWebRequest_Referer http://www.microsoft.com ]" ); + } + else + { + GetPage( args[ 1 ] ); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp new file mode 100644 index 00000000000..a5409b84b58 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_SendChunked/CPP/httpwebrequest_sendchunked.cpp @@ -0,0 +1,112 @@ +/* +System::Net::HttpWebRequest::SendChunked +System::Net::HttpWebRequest::TransferEncoding +This program demonstrates the 'TransferEncoding' and 'SendChunked' properties of the 'HttpWebRequest' class. +A new 'HttpWebRequest' Object* is created. The 'SendChunked' property value is set to 'true' and the +'TransferEncoding' property is set to S"gzip". If the 'TransferEncoding' property is set with 'SendChunked' +property set to 'false' then 'InvalidOperationException' is raised. Data to be posted to the Uri is +requested from the user. The HTML contents of the page are displayed to the console after the posted +data is accepted by the URL + +Note: This program requires http://localhost/CodeSnippetTest::asp as command-line parameter. +If the 'TransferEncoding' of type 'gzip' is not implemented by the server an error of status +'(501) Not implemented' is returned. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +void GetPage( String^ myUri ) +{ + try + { +// +// + // A new 'HttpWebRequest' object is created. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); + myHttpWebRequest->SendChunked = true; + // 'TransferEncoding' property is set to 'gzip'. + myHttpWebRequest->TransferEncoding = "gzip"; + Console::WriteLine( "\nPlease Enter the data to be posted to the (http:///CodeSnippetTest::asp) uri:" ); + String^ inputData = Console::ReadLine(); + String^ postData = String::Concat( "testdata= ", inputData ); + // 'Method' property of 'HttpWebRequest' class is set to POST. + myHttpWebRequest->Method = "POST"; + ASCIIEncoding^ encodedData = gcnew ASCIIEncoding; + array^ byteArray = encodedData->GetBytes( postData ); + // 'ContentType' property of the 'HttpWebRequest' class is set to S"application/x-www-form-urlencoded". + myHttpWebRequest->ContentType = "application/x-www-form-urlencoded"; + // 'ContentLength' property is set to Length of the data to be posted. + myHttpWebRequest->ContentLength = byteArray->Length; + Stream^ newStream = myHttpWebRequest->GetRequestStream(); + newStream->Write( byteArray, 0, byteArray->Length ); + newStream->Close(); + Console::WriteLine( "\nData has been posted to the Uri\n\nPlease wait for the response.........." ); + // The response object of 'HttpWebRequest' is assigned to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + // Displaying the contents of the page to the console + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the HTML page are : " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::WriteLine( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamRead->Close(); + streamResponse->Close(); + myHttpWebResponse->Close(); +// +// + Console::WriteLine( "\nPress 'Enter' Key to Continue................." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + try + { + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the Uri address as a command line parameter:" ); + Console::WriteLine( "[ Usage:HttpWebRequest_Sendchunked http:///CodeSnippetTest.asp ]" ); + } + else + { + GetPage( args[ 1 ] ); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp new file mode 100644 index 00000000000..3d42654bab4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_Timeout/CPP/httpwebrequest_timeout.cpp @@ -0,0 +1,61 @@ +/*System::Net::HttpWebRequest::Time->Item[Out] +This program demonstrates the 'Timeout' property of the HttpWebRequest Class. +A new HttpWebRequest Object is created. The default value of the 'Timeout' property is printed to the console. +It is then set to some value and displayed to the console. If the 'Timeout' property is set to a value less +than the time required to get the response an 'Exception' is raised. The 'Timeout' property measures the time in +milliseconds. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new 'HttpWebRequest' Object to the mentioned URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + Console::WriteLine( "\nThe timeout time of the request before setting the property is {0} milliseconds.", myHttpWebRequest->Timeout ); + // Set the 'Timeout' property of the HttpWebRequest to 10 milliseconds. + myHttpWebRequest->Timeout = 10; + // Display the 'Timeout' property of the 'HttpWebRequest' on the console. + Console::WriteLine( "\nThe timeout time of the request after setting the timeout is {0} milliseconds.", myHttpWebRequest->Timeout ); + // A HttpWebResponse object is created and is GetResponse Property of the HttpWebRequest associated with it + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); +// + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the HTML page are, " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); + Console::WriteLine( "\nPress any Key to Continue............." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException raised!" ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + Console::WriteLine( "\nStatus: {0} ", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "\nSource : {0}", e->Source ); + Console::WriteLine( "\nMessage : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp new file mode 100644 index 00000000000..3ef82849abc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebRequest_UserAgent/CPP/httpwebrequest_useragent.cpp @@ -0,0 +1,58 @@ +/*System::Net::HttpWebRequest::UserAgent +This program demonstrates the 'UserAgent' property of the 'HttpWebRequest' class. +A new 'HttpWebRequest' Object* is created. The 'UserAgent' property is set to +"Mozilla/4.0 (compatible; MSIE 6.0b; Windows NT 5.0; COM+ 1.0.2702)". +This in turn sets the 'User-Agent' field of HTTP Request headers. +The response is obtained and displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; + +int main() +{ + try + { +// + // Create a new 'HttpWebRequest' object to the mentioned URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( "http://www.contoso.com" ) ); + myHttpWebRequest->UserAgent = ".NET Framework Test Client"; + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + // Display the contents of the page to the console. + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of HTML Page are :\n" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamRead->Close(); + streamResponse->Close(); + myHttpWebResponse->Close(); +// + Console::WriteLine( "\nHTTP Request Headers :\n {0}", myHttpWebRequest->Headers ); + Console::WriteLine( "\nUserAgent is: {0}", myHttpWebRequest->UserAgent ); + Console::WriteLine( "\nPress 'Enter' Key to Continue..........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Message : {0} ", e->Message ); + Console::WriteLine( "Status : {0} ", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp new file mode 100644 index 00000000000..d91c5e15fe4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Close/CPP/httpwebresponse_close.cpp @@ -0,0 +1,52 @@ +// System::Net::HttpWebResponse::Close +/* This program demonstrates the 'Close' method of the 'HttpWebResponse' class. +It creates a web request and queries for a response. The response Object* can be processed as desired. +The program then closes the response Object* and releases resources associated with it. +*/ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url ) +{ + try + { +// + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); + // Sends the HttpWebRequest and waits for a response. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + Console::WriteLine( "\nResponse Received::Trying to Close the response stream.." ); + // Releases the resources of the response. + myHttpWebResponse->Close(); + Console::WriteLine( "\nResponse Stream successfully closed" ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_Close http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp new file mode 100644 index 00000000000..3b3d5bf4ec6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ContentEncoding_CharacterSet/CPP/source.cpp @@ -0,0 +1,82 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ +// + try + { + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + + Console::WriteLine( "The encoding method used is: {0}", myHttpWebResponse->ContentEncoding ); + Console::WriteLine( "The character set used is : {0}", myHttpWebResponse->CharacterSet ); + + char separator = '/'; + String^ contenttype = myHttpWebResponse->ContentType; + // Retrieve 'text' if the content type is of 'text/html. + String^ maintype = contenttype->Substring( 0, contenttype->IndexOf( separator ) ); + // Display only 'text' type. + if ( String::Compare( maintype, "text" ) == 0 ) + { + Console::WriteLine( "\n Content type is 'text'." ); +// + +// + Stream^ receiveStream = myHttpWebResponse->GetResponseStream(); + Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); + StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); + + Console::WriteLine( "\r\nResponse stream received." ); + array^ read = gcnew array(256); + + int count = readStream->Read( read, 0, 256 ); + Console::WriteLine( "\nText retrieved from the URL follows:\r\n" ); + + int index = 0; + while ( index < myHttpWebResponse->ContentLength ) + { + // Dump the 256 characters on a string and display the string onto the console. + String^ str = gcnew String( read,0,count ); + Console::WriteLine( str ); + index += count; + count = readStream->Read( read, 0, 256 ); + } + receiveStream->Close(); + Console::WriteLine( "" ); + } + // Release the resources of response object. + myHttpWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_ContentLength_ContentType http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp new file mode 100644 index 00000000000..30522491953 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseHeader/CPP/httpwebresponse_getresponseheader.cpp @@ -0,0 +1,70 @@ +// System::Net::HttpWebResponse::GetResponseHeader +/* This program demonstrates the 'GetResponseHeader' method of the 'HttpWebResponse' class. +It creates a web request and queries for a response. If the site requires authentication it +will respond with a challenge String* which is extracted using 'GetResponse()' method. +*/ + +#using + +using namespace System; +using namespace System::Net; + +// +void GetPage( String^ url ) +{ + try + { + Uri^ ourUri = gcnew Uri( url ); + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( ourUri ) ); + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + Console::WriteLine( "\nThe server did not issue any challenge. Please try again with a protected resource URL." ); + // Releases the resources of the response. + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + HttpWebResponse^ response = (HttpWebResponse^)( e->Response ); + if ( response != nullptr ) + { + if ( response->StatusCode == HttpStatusCode::Unauthorized ) + { + String^ challenge = nullptr; + challenge = response->GetResponseHeader( "WWW-Authenticate" ); + if ( challenge != nullptr ) + Console::WriteLine( "\nThe following challenge was raised by the server: {0}", challenge ); + } + else + { + Console::WriteLine( "\nThe following WebException was raised : {0}", e->Message ); + } + } + else + { + Console::WriteLine( "\nResponse Received from server was 0" ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} +// + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter a protected resource url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_GetResponseHeader http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp new file mode 100644 index 00000000000..06388e73b74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_GetResponseStream/CPP/httpwebresponse_getresponsestream.cpp @@ -0,0 +1,73 @@ +// System::Net::HttpWebResponse::GetResponseStream +/* This program demonstrates the 'GetResponseStream' method of the 'HttpWebResponse' class. +It creates a web request and queries for a response. It then gets the response stream. +This response stream is piped to a higher level stream reader. The reader reads 256 characters at a time, +writes them into a String* and then displays the String* in the console. */ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ + try + { +// + // Creates an HttpWebRequest with the specified URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); + // Sends the HttpWebRequest and waits for the response. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + // Gets the stream associated with the response. + Stream^ receiveStream = myHttpWebResponse->GetResponseStream(); + Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); + // Pipes the stream to a higher level stream reader with the required encoding format. + StreamReader^ readStream = gcnew StreamReader( receiveStream,encode ); + Console::WriteLine( "\r\nResponse stream received." ); + array^ read = gcnew array(256); + // Reads 256 characters at a time. + int count = readStream->Read( read, 0, 256 ); + Console::WriteLine( "HTML...\r\n" ); + while ( count > 0 ) + { + // Dumps the 256 characters on a String* and displays the String* to the console. + String^ str = gcnew String( read,0,count ); + Console::Write( str ); + count = readStream->Read( read, 0, 256 ); + } + Console::WriteLine( "" ); + // Releases the resources of the response. + myHttpWebResponse->Close(); + // Releases the resources of the Stream. + readStream->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_GetResponseStream http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp new file mode 100644 index 00000000000..29ad6442cd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Headers/CPP/httpwebresponse_headers.cpp @@ -0,0 +1,61 @@ +// System::Net::HttpWebResponse::Headers + +/* This program demonstrates the 'Headers' property of the 'HttpWebResponse' class +It creates a web request and queries for a response. It then displays all the response headers +onto the console. */ +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url ) +{ + try + { + // + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); + + // Sends the HttpWebRequest and waits for response. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Displays all the headers present in the response received from the URI. + Console::WriteLine( "\r\nThe following headers were received in the response:" ); + + // Displays each header and its key associated with the response. + for ( int i = 0; i < myHttpWebResponse->Headers->Count; ++i ) + Console::WriteLine( "\nHeader Name: {0}, Value : {1}", + myHttpWebResponse->Headers->Keys[ i ], + myHttpWebResponse->Headers[ (System::Net::HttpRequestHeader)i ] ); + + // Releases the resources of the response. + myHttpWebResponse->Close(); + // + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_Headers http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp new file mode 100644 index 00000000000..07b78aa598f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_LastModified/CPP/httpwebresponse_lastmodified.cpp @@ -0,0 +1,67 @@ +// System::Net::HttpWebResponse::LastModified +/* This program demonstrates the 'LastModified' property of the 'HttpWebResponse' class +It creates a web request and queries for a response. The program checks +if the entity requested was modified any time today. +*/ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url ) +{ + try + { +// + Uri^ myUri = gcnew Uri( url ); + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) + { + Console::WriteLine( "\r\nRequest succeeded and the requested information is in the response , Description : {0}", + myHttpWebResponse->StatusDescription ); + } + DateTime today = DateTime::Now; + // Uses the LastModified property to compare with today's date. + if ( DateTime::Compare( today, myHttpWebResponse->LastModified ) == 0 ) + { + Console::WriteLine( "\nThe requested URI entity was modified today" ); + } + else if ( DateTime::Compare( today, myHttpWebResponse->LastModified ) == 1 ) + { + Console::WriteLine( "\nThe requested URI was last modified on: {0}", + myHttpWebResponse->LastModified ); + } + // Releases the resources of the response. + myHttpWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease type the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_LastModified http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp new file mode 100644 index 00000000000..527ce130a0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_Method_Server/CPP/httpwebresponse_method_server.cpp @@ -0,0 +1,59 @@ +// System::Net::HttpWebResponse::Method;System::Net::HttpWebResponse::Server +/* This program demonstrates the 'Method' and 'Server' properties of the 'HttpWebResponse' class. +It creates a Web request and queries for a response. It evaluates the response method used and the prints +the Web server name to the console*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ +// +// + try + { + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( url ) ); + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + String^ method; + method = myHttpWebResponse->Method; + if ( String::Compare( method, "GET" ) == 0 ) + { + Console::WriteLine( "\nThe 'GET' method was successfully invoked on the following Web Server : {0}", + myHttpWebResponse->Server ); + } + // Releases the resources of the response. + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +// +// +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_Method_Server http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp new file mode 100644 index 00000000000..932674a8594 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ProtocolVersion/CPP/httpwebresponse_protocolversion.cpp @@ -0,0 +1,59 @@ +// System::Net::HttpWebResponse::ProtocolVersion +/* This program demonstrates the 'ProtocolVersion' property of the 'HttpWebResponse' class. +It creates a web request and queries for a response. The server should respond using the same version */ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url ) +{ + try + { +// + Uri^ ourUri = gcnew Uri( url ); + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( ourUri ) ); + myHttpWebRequest->ProtocolVersion = HttpVersion::Version10; + // Sends the HttpWebRequest and waits for the response. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + // Ensures that only Http/1.0 responses are accepted. + if ( myHttpWebResponse->ProtocolVersion != HttpVersion::Version10 ) + { + Console::WriteLine( "\nThe server responded with a version other than Http/1.0" ); + } + else if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) + { + Console::WriteLine( "\nRequest sent using version Http/1.0. Successfully received response with version HTTP/1.0 " ); + } + // Releases the resources of the response. + myHttpWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_ProtocolVersion http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp new file mode 100644 index 00000000000..96ee68302ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_ResponseUri/CPP/httpwebresponse_responseuri.cpp @@ -0,0 +1,63 @@ +// System::Net::HttpWebResponse::ResponseUri +/*This program demonstrates the 'ResponseUri' property of the 'HttpWebResponse' class +It creates a web request and queries for a response. It checks if the original Uri +was redirected by the server. */ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url ) +{ + try + { +// + Uri^ myUri = gcnew Uri( url ); + // Create a 'HttpWebRequest' object for the specified url. + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)( WebRequest::Create( myUri ) ); + // Send the request and wait for response. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)( myHttpWebRequest->GetResponse() ); + if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) + { + Console::WriteLine( "\nRequest succeeded and the requested information is in the response , Description : {0}", + myHttpWebResponse->StatusDescription ); + } + if ( myUri->Equals( myHttpWebResponse->ResponseUri ) ) + { + Console::WriteLine( "\nThe Request Uri was not redirected by the server" ); + } + else + { + Console::WriteLine( "\nThe Request Uri was redirected to : {0}", myHttpWebResponse->ResponseUri ); + } + // Release resources of response Object*. + myHttpWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_ResponseUri http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp new file mode 100644 index 00000000000..21dba8b604f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/HttpWebResponse_StatusCode_StatusDescription/CPP/httpwebresponse_statuscode_statusdescription.cpp @@ -0,0 +1,56 @@ +// System::Net::HttpWebResponse::StatusCode; System::Net::HttpWebResponse::StatusDescription + +/* This program demonstrates the 'StatusCode' and 'StatusDescription' property of the 'HttpWebResponse' class. +It creates a web request and queries for a response. */ + +#using + +using namespace System; +using namespace System::Net; + +// +// +void GetPage( String^ url ) +{ + try + { + // Creates an HttpWebRequest for the specified URL. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( url )); + // Sends the HttpWebRequest and waits for a response. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + if ( myHttpWebResponse->StatusCode == HttpStatusCode::OK ) + { + Console::WriteLine( "\r\nResponse Status Code is OK and StatusDescription is: {0}", + myHttpWebResponse->StatusDescription ); + } + // Releases the resources of the response. + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException Raised. The following error occurred : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised : {0}", e->Message ); + } +} +// +// + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the url as command line parameter" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "HttpWebResponse_StatusCode_StatusDescription http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp new file mode 100644 index 00000000000..ebd4e3a0178 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_HaveResponse/CPP/httpwebrequest_haveresponse.cpp @@ -0,0 +1,78 @@ + + +/*System::Net::HttpWebRequest::HaveResponse + +This program demonstrates 'HaveResponse' property of 'HttpWebRequest' Class. +A new 'HttpWebRequest' is created. +The 'HaveResponse' property is a ReadOnly, boolean property that indicates +whether the Request Object* has received any response or not. +The default value of 'HaveResponse' property of the 'HttpWebRequest' is displayed to the console. +The HttpWebResponse variable is assigned the response Object* of 'HttpWebRequest'. +The HaveReponse property is tested for its value. +If there is a response then the HTML contents of the page of the requested Uri are displayed to the console +else a message 'The response is not received' is displayed to the console. + +*/ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; +int main() +{ + try + { + + // + // Create a new 'HttpWebRequest' Object. + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.contoso.com" )); + HttpWebResponse^ myHttpWebResponse; + + // Display the 'HaveResponse' property of the 'HttpWebRequest' object to the console. + Console::WriteLine( "\nThe value of 'HaveResponse' property before a response object is obtained : {0}", myHttpWebRequest->HaveResponse ); + + // Assign the response object of 'HttpWebRequest' to a 'HttpWebResponse' variable. + myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + if ( myHttpWebRequest->HaveResponse ) + { + Stream^ streamResponse = myHttpWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of Html Page are : \n" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse Resource. + myHttpWebResponse->Close(); + Console::WriteLine( "\nPress 'Enter' key to continue.........." ); + Console::Read(); + } + else + { + Console::WriteLine( "\nThe response is not received " ); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught" ); + Console::WriteLine( "\nSource : {0}", e->Source ); + Console::WriteLine( "\nMessage : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp b/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp new file mode 100644 index 00000000000..28631707a47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Httpwebrequest_proxy/CPP/httpwebrequest_proxy.cpp @@ -0,0 +1,110 @@ +/*System::Net::HttpWebRequest::Proxy +This program demonstrates the 'Proxy' property of the 'HttpWebRequest' class. +A 'HttpWebRequest' Object* and a 'Proxy' Object* is created. The Proxy Object is then assigned to +the 'Proxy' property of the 'HttpWebRequest' Object* and printed onto the console (this is the default +Proxy setting).New Proxy address and the credentials are requested from the User::A new Proxy Object* is +then constructed from the supplied inputs. Then the 'Proxy' property of the request is associated with the new +Proxy Object*. +Note: No credentials are required if the Proxy does not require any authentication. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new request to the mentioned URL. + HttpWebRequest ^ myWebRequest = + (HttpWebRequest ^) (WebRequest::Create("http://www.microsoft.com")); + + // Obtain the 'Proxy' of the Default browser. + IWebProxy ^ proxy = myWebRequest->Proxy; + // Print the Proxy Url to the console. + if (proxy) + { + Console::WriteLine("Proxy: {0}", + proxy->GetProxy(myWebRequest->RequestUri)); + } + else + { + Console::WriteLine("Proxy is null; no proxy will be used"); + } + + WebProxy ^ myProxy = gcnew WebProxy; + + Console::WriteLine("\nPlease enter the new Proxy Address that is to be set:"); + Console::WriteLine("(Example:http://myproxy.example.com:port)"); + String ^ proxyAddress; + + try + { + proxyAddress = Console::ReadLine(); + if (proxyAddress->Length > 0) { + Console::WriteLine("\nPlease enter the Credentials "); + Console::WriteLine("Username:"); + String ^ username; + username = Console::ReadLine(); + Console::WriteLine("\nPassword:"); + String ^ password; + password = Console::ReadLine(); + // Create a new Uri object. + Uri ^ newUri = gcnew Uri(proxyAddress); + // Associate the newUri object to 'myProxy' object so that new myProxy settings can be set. + myProxy->Address = newUri; + // Create a NetworkCredential object and associate it with the Proxy property of request object. + myProxy->Credentials = + gcnew NetworkCredential(username, password); + myWebRequest->Proxy = myProxy; + } + Console::WriteLine("\nThe Address of the new Proxy settings are {0}", + myProxy->Address); + HttpWebResponse ^ myWebResponse = + (HttpWebResponse ^) (myWebRequest->GetResponse()); +// + + // Print the HTML contents of the page to the console. + Stream ^ streamResponse = myWebResponse->GetResponseStream(); + StreamReader ^ streamRead = gcnew StreamReader(streamResponse); + array < Char > ^readBuff = gcnew array < Char > (256); + int count = streamRead->Read(readBuff, 0, 256); + Console::WriteLine("\nThe contents of the HTML pages are :"); + while (count > 0) { + String ^ outputData = gcnew String(readBuff, 0, count); + Console::Write(outputData); + count = streamRead->Read(readBuff, 0, 256); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myWebResponse->Close(); + Console::WriteLine("\nPress any key to continue........."); + Console::Read(); + } + catch(UriFormatException ^ e) + { + Console::WriteLine("\nUriFormatException is thrown. Message: {0}", + e->Message); + Console::WriteLine("\nThe format of the Proxy address you entered is invalid"); + Console::WriteLine("\nPress any key to continue........."); + Console::Read(); + } + } + catch(WebException ^ e) + { + Console::WriteLine("\nWebException raised!"); + Console::WriteLine("\nMessage: {0} ", e->Message); + Console::WriteLine("\nStatus: {0} ", e->Status); + } + catch(Exception ^ e) + { + Console::WriteLine("\nException is raised. "); + Console::WriteLine("\nMessage: {0} ", e->Message); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp new file mode 100644 index 00000000000..dc8a4fff2a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IChannelDataStore_Item/CPP/ichanneldatastore.cpp @@ -0,0 +1,69 @@ +// System.Runtime.Remoting.Channels.IChannelDataStore +// System.Runtime.Remoting.Channels.IChannelDataStore.ChannelUris +// System.Runtime.Remoting.Channels.IChannelDataStore.Item[object] + +/* The following example demonstrates 'ChannelUris', 'Item' and 'IChannelDataStore' +class. +In the example after registering the channel, the object is registered with remoting +infrastructure by calling 'RemotingServices.Marshal' method. After registering the +object the channel information is obtained. From the channel information the required +'IChannelInfo' is collected and displayed. +*/ + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Services; + +// Marshal ByRef Object class. +public ref class MyServiceClass: public MarshalByRefObject +{ +public: + String^ HelloWorld() + { + return "Hello World"; + } +}; + +int main() +{ + // + // + TcpChannel^ myChannel = gcnew TcpChannel( 8085 ); + ChannelServices::RegisterChannel( myChannel ); + MyServiceClass^ myService = gcnew MyServiceClass; + + // After the channel is registered, register the object + // with remoting infrastructure by calling Marshal method. + ObjRef^ myObjRef = RemotingServices::Marshal( myService, "TcpService" ); + + // Get the information contributed by active channel. + IChannelInfo^ myChannelInfo = myObjRef->ChannelInfo; + IChannelDataStore^ myIChannelData; + System::Collections::IEnumerator^ myEnum = myChannelInfo->ChannelData->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ myChannelData = safe_cast(myEnum->Current); + if ( dynamic_cast(myChannelData) ) + { + myIChannelData = dynamic_cast(myChannelData); + System::Collections::IEnumerator^ myEnum1 = myIChannelData->ChannelUris->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + String^ myUri = safe_cast(myEnum1->Current); + Console::WriteLine( "Channel Uris are -> {0}", myUri ); + } + String^ myKey = "Key1"; + myIChannelData[ myKey ] = "My Data"; + Console::WriteLine( myIChannelData[ myKey ] ); + } + } + // + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp new file mode 100644 index 00000000000..d2e8a8d8aaa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiverHook_ChannelScheme/CPP/ichannelreceiverhook_channelscheme.cpp @@ -0,0 +1,141 @@ + + + +// System.Runtime.Remoting.Channels.IChannelReceiverHook +// System.Runtime.Remoting.Channels.IChannelReceiverHook.WantsToListen +// System.Runtime.Remoting.Channels.IChannelReceiverHook.ChannelScheme + +/* +This example demonstrates the implementation of the 'ChannelScheme' and +'WantsToListen' properties of the 'IChannelReceiverHook' interface. +It creates a customized channel 'MyCustomChannel' by implementing +'IChannelReceiverHook' interface. +*/ + + + +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +// +// Implementation of 'IChannelReceiverHook' interface. +public ref class MyCustomChannel: public IChannelReceiverHook +{ +private: + bool portSet; + +public: + // Constructor for MyCustomChannel. + MyCustomChannel( int /*port*/ ) + { + MyChannelScheme = "http"; + portSet = true; + } + + // Constructor for MyCustomChannel. + MyCustomChannel() + { + MyChannelScheme = "http"; + portSet = false; + } + + property bool WantsToListen + { + // + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual bool get() + { + if ( portSet ) + { + return false; + } + else + { + return true; + } + } + } + // + + // +private: + String^ MyChannelScheme; + +public: + property String^ ChannelScheme + { + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual String^ get() + { + return MyChannelScheme; + } + } + // + + property IServerChannelSink^ ChannelSinkChain + { + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual IServerChannelSink^ get() + { + + // Null implementation. + return nullptr; + } + } + + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual void AddHookChannelUri( String^ /*channelUri*/ ) + { + // Null implementation. + } +}; +// + +int main() +{ + try + { + MyCustomChannel^ myCustomChannelWithPort = gcnew MyCustomChannel( 8085 ); + MyCustomChannel^ myCustomChannelNoPort = gcnew MyCustomChannel; + Console::WriteLine( "Channel Scheme of myCustomChannelWithPort : {0}", + myCustomChannelWithPort->ChannelScheme ); + Console::WriteLine( "Channel Scheme of myCustomChannelNoPort : {0}", + myCustomChannelNoPort->ChannelScheme ); + // 'WantsToListen' is false. It is already listening. + if ( myCustomChannelWithPort->WantsToListen ) + { + Console::WriteLine( "myCustomChannelWithPort wants to listen." ); + } + else + { + Console::WriteLine( "myCustomChannelWithPort doesn't want to listen." ); + } + if ( myCustomChannelNoPort->WantsToListen ) + { + Console::WriteLine( "myCustomChannelNoPort wants to listen." ); + } + else + { + Console::WriteLine( "myCustomChannelNoPort doesn't want to listen." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp new file mode 100644 index 00000000000..76ced6cc1ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IChannelReceiver_StartListening_ChannelData/CPP/ichannelreceiver_channeldata_server.cpp @@ -0,0 +1,174 @@ + + +// System.Runtime.Remoting.Channels.IChannelReceiver +// System.Runtime.Remoting.Channels.IChannelReceiver.ChannelData +// System.Runtime.Remoting.Channels.IChannelReceiver.GetUrlsForUri +// System.Runtime.Remoting.Channels.IChannelReceiver.StartListening +// System.Runtime.Remoting.Channels.IChannelReceiver.StopListening +/* +This example implements the 'ChannelData' property and 'GetUrlsForUri', +'StartListening' and 'StopListening' method of 'IChannelReceiver' interface. +It creates a server by implementing 'IChannelReceiver' interface to receive +request send by the client. +*/ +#using +#using + +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Threading; +using namespace System::Net::Sockets; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Text::RegularExpressions; + +// +ref class MyCustomChannel: public IChannelReceiver +{ +private: + ChannelDataStore^ myChannelData; + int myChannelPriority; + + // Set the 'ChannelName' to 'MyCustomChannel'. + String^ myChannelName; + + // Implement 'ChannelName' property. + TcpListener^ myTcpListener; + int myPortNo; + bool myListening; + Thread^ myThread; + +public: + MyCustomChannel() + : myChannelPriority( 25 ), myChannelName( "tcp" ), myListening( false ) + {} + + MyCustomChannel( int portNo ) + { + myPortNo = portNo; + array^myURI = gcnew array(1); + myURI[ 0 ] = String::Concat( Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ], ":", portNo ); + + // Store the 'URI' in 'myChannelDataStore'. + myChannelData = gcnew ChannelDataStore( myURI ); + + // Create 'myTcpListener' to listen at the 'myPortNo' port. + myTcpListener = gcnew TcpListener( myPortNo ); + + // Create the thread 'myThread'. + myThread = gcnew Thread( gcnew ThreadStart( myTcpListener, &TcpListener::Start ) ); + this->StartListening( nullptr ); + } + + property String^ ChannelName + { + virtual String^ get() + { + return myChannelName; + } + } + + property int ChannelPriority + { + virtual int get() + { + return myChannelPriority; + } + } + virtual String^ Parse( String^ myUrl, [Out]String^% objectURI ) + { + Regex^ myRegex = gcnew Regex( "/",RegexOptions::RightToLeft ); + + // Check for '/' in 'myUrl' from Right to left. + Match^ myMatch = myRegex->Match(myUrl); + + // Get the object URI. + objectURI = myUrl->Substring( myMatch->Index ); + + // Return the channel url. + return myUrl->Substring( 0, myMatch->Index ); + } + + // Implementation of 'IChannelReceiver' interface. + // + property Object^ ChannelData + { + virtual Object^ get() + { + return myChannelData; + } + } + // + + // + // Create and send the object URL. + virtual array^ GetUrlsForUri( String^ objectURI ) + { + array^myString = gcnew array(1); + myString[ 0 ] = String::Concat( Dns::Resolve( Dns::GetHostName() )->AddressList[ 0 ], "/", objectURI ); + return myString; + } + // + + // + // Start listening to the port. + virtual void StartListening( Object^ data ) + { + if ( !myListening ) + { + myTcpListener->Start(); + myListening = true; + Console::WriteLine( "Server Started Listening !!!" ); + } + } + // + + // + // Stop listening to the port. + virtual void StopListening( Object^ data ) + { + if ( myListening ) + { + myTcpListener->Stop(); + myListening = false; + Console::WriteLine( "Server Stopped Listening !!!" ); + } + } + // +}; +// + +int main() +{ + MyCustomChannel^ myChannel = gcnew MyCustomChannel( 8085 ); + ChannelDataStore^ myChannelDataStore = (ChannelDataStore^)myChannel->ChannelData; + Console::WriteLine( "The channel URI is {0}", myChannelDataStore->ChannelUris[ 0 ] ); + array^myUrlArray = myChannel->GetUrlsForUri( "SayHello" ); + Console::WriteLine( "The URL for the objectURI is {0}", myUrlArray[ 0 ] ); + bool continueOption = true; + while ( continueOption ) + { + Console::WriteLine( "" ); + Console::WriteLine( "Select a option .." ); + Console::WriteLine( " 1 - StartListening" ); + Console::WriteLine( " 2 - StopListening" ); + Console::WriteLine( " 3 - Exit" ); + Console::Write( "Option : " ); + int myOption = Int32::Parse( Console::ReadLine() ); + switch ( myOption ) + { + case 1: + myChannel->StartListening( nullptr ); + break; + + case 2: + myChannel->StopListening( nullptr ); + break; + + case 3: + continueOption = false; + break; + } + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp b/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp new file mode 100644 index 00000000000..f75401a16a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IChannelSender/CPP/ichannelsender_2_client.cpp @@ -0,0 +1,71 @@ + + +// System.Runtime.Remoting.Channels.IChannelSender +// System.Runtime.Remoting.Channels.IChannelSender.CreateMessageSink() +/* The following program demonstrates the usage of IChannelSender +interface and its 'CreateMessageSink' method in the namespace +'System.Runtime.Remoting.Channels'. This program creates and +registers an IChannelSender of type 'HttpClientChannel'. +It sets the priority of the channel and it displays the +property values of 'HttpClientChannel'. */ +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Channels::Http; +int main() +{ + try + { + + // Create the 'IDictionary' to set the server object properties. + IDictionary^ myDictionary = gcnew Hashtable; + myDictionary->default[ "name" ] = "HttpClientChannel"; + myDictionary->default[ "priority" ] = 2; + + // Set the properties along with the constructor. + IChannelSender^ myIChannelSender = gcnew HttpClientChannel( myDictionary,gcnew BinaryClientFormatterSinkProvider ); + + // Register the server channel. + ChannelServices::RegisterChannel( myIChannelSender, false ); + MyHelloServer ^ myHelloServer1 = dynamic_cast(Activator::GetObject( MyHelloServer::typeid, "http://localhost:8085/SayHello" )); + if ( myHelloServer1 == nullptr ) + { + Console::WriteLine( "Could not locate server" ); + } + else + { + Console::WriteLine( myHelloServer1->myHelloMethod( "Client" ) ); + + // Get the name of the channel. + Console::WriteLine( "Channel Name :{0}", myIChannelSender->ChannelName ); + + // Get the channel priority. + Console::WriteLine( "ChannelPriority :{0}", myIChannelSender->ChannelPriority ); + String^ myString; + String^ myObjectURI1; + Console::WriteLine( "Parse :{0}{1}", myIChannelSender->Parse( "http://localhost:8085/SayHello", myString ), myString ); + + // + // Get the channel message sink that delivers message to specified url. + IMessageSink^ myIMessageSink = myIChannelSender->CreateMessageSink( "http://localhost:8085/NewEndPoint", nullptr, myObjectURI1 ); + Console::WriteLine( "Channel message sink used :{0}", myIMessageSink ); + + // + Console::WriteLine( "URI of new channel message sink :{0}", myObjectURI1 ); + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Following exception is raised on client side : {0}", ex->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp b/snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp new file mode 100644 index 00000000000..3e874fd030b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ICredential/CPP/icredential.cpp @@ -0,0 +1,125 @@ +/* +This program demonstrates the 'GetCredential' method of the 'ICredentials*' interface. +The 'CredentialList' class implements the 'ICredentials*' interface, which stores credentials for multiple +internet resources. The program takes URL, Username, Password, and Domain name from command line and adds +it to an instance of the 'CredentialList' class. An instance of the 'WebRequest' class is obtained and the 'Credentials' +property of the 'WebRequest' class is set to an instance of the 'NetworkCredential' class obtained by calling the +'GetCredential' method of the 'CredentialList' class. Then it sends the request and obtains a response. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Collections; + +// +ref class CredentialList: public ICredentials +{ +private: + ref class CredentialInfo + { + public: + Uri^ uriObj; + String^ authenticationType; + NetworkCredential^ networkCredentialObj; + CredentialInfo( Uri^ uriObj, String^ authenticationType, NetworkCredential^ networkCredentialObj ) + { + this->uriObj = uriObj; + this->authenticationType = authenticationType; + this->networkCredentialObj = networkCredentialObj; + } + }; + + ArrayList^ arrayListObj; + +public: + CredentialList() + { + arrayListObj = gcnew ArrayList; + } + + void Add( Uri^ uriObj, String^ authenticationType, NetworkCredential^ credential ) + { + + // Add a 'CredentialInfo' object into a list. + arrayListObj->Add( gcnew CredentialInfo( uriObj,authenticationType,credential ) ); + } + + // Remove the 'CredentialInfo' object from the list that matches to the given 'Uri' and 'AuthenticationType' + void Remove( Uri^ uriObj, String^ authenticationType ) + { + for ( int index = 0; index < arrayListObj->Count; index++ ) + { + CredentialInfo^ credentialInfo = dynamic_cast(arrayListObj[ index ]); + if ( uriObj->Equals( credentialInfo->uriObj ) && authenticationType->Equals( credentialInfo->authenticationType ) ) + arrayListObj->RemoveAt( index ); + } + } + + virtual NetworkCredential^ GetCredential( Uri^ uriObj, String^ authenticationType ) + { + for ( int index = 0; index < arrayListObj->Count; index++ ) + { + CredentialInfo^ credentialInfoObj = dynamic_cast(arrayListObj[ index ]); + if ( uriObj->Equals( credentialInfoObj->uriObj ) && authenticationType->Equals( credentialInfoObj->authenticationType ) ) + return credentialInfoObj->networkCredentialObj; + } + return nullptr; + } +}; +// + +void GetPage( String^ urlString, String^ UserName, String^ password, String^ DomainName ) +{ + try + { + CredentialList^ credentialListObj = gcnew CredentialList; + + // Dummy names used as credentials. + credentialListObj->Add( gcnew Uri( urlString ), + "Basic", gcnew NetworkCredential( UserName,password,DomainName ) ); + credentialListObj->Add( gcnew Uri( "http://www.msdn.microsoft.com" ), + "Basic", gcnew NetworkCredential( "User1","Passwd1","Domain1" ) ); + + // Create a 'WebRequest' for the specified url. + WebRequest^ myWebRequest = WebRequest::Create( urlString ); + + // Call 'GetCredential' to obtain the credentials specific to a Uri. + myWebRequest->Credentials = credentialListObj->GetCredential( gcnew Uri( urlString ), "Basic" ); + + // Send the request and get the response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // ....Process the response here. + Console::WriteLine( "\n Response Received." ); + myWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException caught !!!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught !!!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} + +int main() +{ + String^ urlString; + String^ username; + String^ password; + String^ domainname; + Console::Write( "Enter a URL(for e.g. http://www.microsoft.com : " ); + urlString = Console::ReadLine(); + Console::Write( "Enter User name : " ); + username = Console::ReadLine(); + Console::Write( "Enter Password :" ); + password = Console::ReadLine(); + Console::Write( "Enter Domain name : " ); + domainname = Console::ReadLine(); + GetPage( urlString, username, password, domainname ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp new file mode 100644 index 00000000000..e1b40ce138a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ILease_ILease/CPP/ilease_client.cpp @@ -0,0 +1,91 @@ + + +// System::Runtime::Remoting::Lifetime.ILease* +// System::Runtime::Remoting::Lifetime.ILease*.InitialLeaseTime +// System::Runtime::Remoting::Lifetime.ILease*.CurrentLeaseTime +// System::Runtime::Remoting::Lifetime.ILease*.RenewOnCallTime +// System::Runtime::Remoting::Lifetime.ILease*.SponsorshipTimeout +//System::Runtime::Remoting::Lifetime.ILease*.CurrentState +// System::Runtime::Remoting::Lifetime.ILease*.Register(ISponsor*) +// System::Runtime::Remoting::Lifetime.ILease*.Renew(TimeSpam) +// System::Runtime::Remoting::Lifetime.ILease*.Unregister(ISponsor*) +// System::Runtime::Remoting::Lifetime.ILease*.Register(ISponsor*, TimeSpam) +/* The following example demonstrates 'InitialLeaseTime', 'CurrentLeaseTime', +'RenewOnCallTime', 'SponsorshipTimeout', 'CurrentState', 'Register', 'Renew', +'Unregister' and 'Register' methods of 'ClientSponsor' class. + +In the example using 'RemotingServices::GetLifetimeService' the lease information +of the remote service is obtained. All the properties and methods 'ILease' are demonstrated +using this lease variable. The client registers itself with 'ClientSponsor' class. +After registeration the current lease time is displayed. The lease is expired +and renewed. Then the renewed lease time is displayed. Finally the client unregister itself. +The client again registers itself. This time with initial lease time mentioned at +the time of registeration. The lease time is displayed. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Lifetime; +using namespace RemotingSamples; + +// +int main() +{ + // + // Register the channel. + TcpChannel^ myChannel = gcnew TcpChannel; + ChannelServices::RegisterChannel( myChannel ); + RemotingConfiguration::RegisterActivatedClientType( HelloService::typeid, "Tcp://localhost:8085" ); + TimeSpan myTimeSpan = TimeSpan::FromMinutes( 10 ); + + // Create a remote object. + HelloService ^ myService = gcnew HelloService; + ILease^ myLease; + myLease = dynamic_cast(RemotingServices::GetLifetimeService( myService )); + if ( myLease == nullptr ) + { + Console::WriteLine( "Cannot lease." ); + return -1; + } + + Console::WriteLine( "Initial lease time is {0}", myLease->InitialLeaseTime ); + Console::WriteLine( "Current lease time is {0}", myLease->CurrentLeaseTime ); + Console::WriteLine( "Renew on call time is {0}", myLease->RenewOnCallTime ); + Console::WriteLine( "Sponsorship timeout is {0}", myLease->SponsorshipTimeout ); + Console::WriteLine( "Current lease state is {0}", myLease->CurrentState ); + // + + // Register with a sponser. + ClientSponsor^ mySponsor = gcnew ClientSponsor; + myLease->Register( mySponsor ); + Console::WriteLine( "Wait for lease to expire (approx. 15 seconds)..." ); + System::Threading::Thread::Sleep( myLease->CurrentLeaseTime ); + Console::WriteLine( "Current lease time before renewal is {0}", myLease->CurrentLeaseTime ); + + // Renew the lease time. + myLease->Renew( myTimeSpan ); + Console::WriteLine( "Current lease time after renewal is {0}", myLease->CurrentLeaseTime ); + + // Call the Remote method. + Console::WriteLine( "Remote method output is {0}", myService->HelloMethod( "Microsoft" ) ); + myLease->Unregister( mySponsor ); + GC::Collect(); + GC::WaitForPendingFinalizers(); + + // Register with lease time of 15 minutes. + myLease->Register( mySponsor, TimeSpan::FromMinutes( 15 ) ); + Console::WriteLine( "Registered client with lease time of 15 minutes." ); + Console::WriteLine( "Current lease time is {0}", myLease->CurrentLeaseTime ); + + // Call the Remote method. + Console::WriteLine( "Remote method output is {0}", myService->HelloMethod( "Microsoft" ) ); + myLease->Unregister( mySponsor ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp b/snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp new file mode 100644 index 00000000000..22fe13cf2f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IMessageSink_Client/CPP/imessagesink_client.cpp @@ -0,0 +1,149 @@ + + +// System.Runtime.Remoting.Messaging.IMessage +// System.Runtime.Remoting.Messaging.IMessage.Properties +// System.Runtime.Remoting.Messaging.IMessageSink +// System.Runtime.Remoting.Messaging.IMessageSink.SyncProcessMessage(IMessage) +/* The following example demonstrates 'IMessage.Properties', 'IMessage' interface, +'IMessageSink.SyncProcessMessage' and 'IMessageSink' interface. +In the example the MyProxy is derived from 'RealProxy' class. In MyProxy +'MessageSink' is created using 'CreateMessageSink' method of 'IChannelSender' +interface. The 'IMessageSink' return by 'CreateMessageSink' is used to demonstrate +'IMessageSink.SyncProcessMessage' of 'IMessageSink' interface. The 'Invoke' method +is overridden in 'MyProxy' class.to demonstrate its properties. +*/ +// +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Threading; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Permissions; +using namespace Share; + +public ref class MyProxy: public RealProxy +{ +private: + String^ myUrl; + String^ myObjectURI; + IMessageSink^ myMessageSink; + +public: + [System::Security::Permissions::PermissionSetAttribute(System::Security::Permissions::SecurityAction::LinkDemand)] + + MyProxy( Type^ myType, String^ myUrl1 ) + : RealProxy( myType ) + { + myUrl = myUrl1; + array^myRegisteredChannels = ChannelServices::RegisteredChannels; + IEnumerator^ myEnum = myRegisteredChannels->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + IChannel^ channel = safe_cast(myEnum->Current); + if ( dynamic_cast(channel) ) + { + IChannelSender^ myChannelSender = dynamic_cast(channel); + myMessageSink = myChannelSender->CreateMessageSink( myUrl, nullptr, myObjectURI ); + if ( myMessageSink != nullptr ) + break; + } + } + + if ( myMessageSink == nullptr ) + { + throw gcnew Exception( String::Format( "A supported channel could not be found for myUrl1:{0}", myUrl ) ); + } + } + + virtual IMessage^ Invoke( IMessage^ myMesg ) override + { + Console::WriteLine( "MyProxy.Invoke Start" ); + if ( dynamic_cast(myMesg) ) + Console::WriteLine( "IMethodCallMessage" ); + + if ( dynamic_cast(myMesg) ) + Console::WriteLine( "IMethodReturnMessage" ); + + + // + Console::WriteLine( "Message Properties" ); + IDictionary^ myDictionary = myMesg->Properties; + IDictionaryEnumerator^ myEnum = dynamic_cast(myDictionary->GetEnumerator()); + while ( myEnum->MoveNext() ) + { + Object^ myKey = myEnum->Key; + String^ myKeyName = myKey->ToString(); + Object^ myValue = myEnum->Value; + Console::WriteLine( "{0} : {1}", myKeyName, myEnum->Value ); + if ( myKeyName->Equals( "__Args" ) ) + { + array^myArgs = (array^)myValue; + for ( int myInt = 0; myInt < myArgs->Length; myInt++ ) + Console::WriteLine( "arg: {0} myValue: {1}", myInt, myArgs[ myInt ] ); + } + + if ( (myKeyName->Equals( "__MethodSignature" )) && (nullptr != myValue) ) + { + array^myArgs = (array^)myValue; + for ( int myInt = 0; myInt < myArgs->Length; myInt++ ) + Console::WriteLine( "arg: {0} myValue: {1}", myInt, myArgs[ myInt ] ); + } + } + + Console::WriteLine( "myUrl1 {0} object URI{1}", myUrl, myObjectURI ); + myDictionary->default[ "__Uri" ] = myUrl; + Console::WriteLine( "URI {0}", myDictionary->default[ "__URI" ] ); + + // + // + IMessage^ myRetMsg = myMessageSink->SyncProcessMessage( myMesg ); + if ( dynamic_cast(myRetMsg) ) + { + IMethodReturnMessage^ myMethodReturnMessage = dynamic_cast(myRetMsg); + } + + + // + Console::WriteLine( "MyProxy.Invoke - Finish" ); + return myRetMsg; + } + +}; + + +// +// Main function that drives the whole sample +// +int main() +{ + ChannelServices::RegisterChannel( gcnew HttpChannel, false ); + Console::WriteLine( "Remoting Sample:" ); + Console::WriteLine( "Generate a new MyProxy using the Type" ); + Type^ myType = MyHelloService::typeid; + String^ myUrl1 = "http://localhost/myServiceAccess.soap"; + MyProxy^ myProxy = gcnew MyProxy( myType,myUrl1 ); + Console::WriteLine( "Obtain the transparent proxy from myProxy" ); + MyHelloService^ myService = dynamic_cast(myProxy->GetTransparentProxy()); + Console::WriteLine( "Calling the Proxy" ); + String^ myReturnString = myService->myFunction( "bill" ); + Console::WriteLine( "Checking result : {0}", myReturnString ); + if ( myReturnString->Equals( "Hi there bill, you are using .NET Remoting" ) ) + { + Console::WriteLine( "myService.HelloMethod PASSED : returned {0}", myReturnString ); + } + else + { + Console::WriteLine( "myService.HelloMethod FAILED : returned {0}", myReturnString ); + } +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp new file mode 100644 index 00000000000..bf01660d3c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IMethodCallMessage_GetInArg/CPP/imethodcallmessage.cpp @@ -0,0 +1,108 @@ + + +// System::Runtime::Remoting::IMethodCallMessage +// System::Runtime::Remoting::IMethodCallMessage.InArgCount +// System::Runtime::Remoting::IMethodCallMessage.InArgs +// System::Runtime::Remoting::IMethodCallMessage.GetArgName(int) +// System::Runtime::Remoting::IMethodCallMessage.GetInArg(int) +/* +The following example demonstrates 'GetInArg', 'GetArgName', 'InArgCount' and 'InArgs' +members of 'IMethodCallMessage*' interface. +In this example custom proxy is accessed by passing message to the Invoke method. +In invoke method check the type of message. If the type is IMethodCallMessage*, then +InArgCount, InArgs, GetArgName(int) and GetInArg(int) of the interface are displayed. +This example also shows how to create a custom proxy. +*/ +// +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; + +// MyProxy extends the CLR Remoting RealProxy. +// In the same class, in the Invoke method, the methods and properties of the +// IMethodCallMessage are demonstrated. + +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::LinkDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::InheritanceDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + +public ref class MyProxy: public RealProxy +{ +public: + MyProxy( Type^ myType ) + : RealProxy( myType ) + { + // This constructor forwards the call to base RealProxy. + // RealProxy uses the Type to generate a transparent proxy. + } + + // + virtual IMessage^ Invoke( IMessage^ myIMessage ) override + { + Console::WriteLine( "MyProxy::Invoke Start" ); + Console::WriteLine( "" ); + ReturnMessage^ myReturnMessage = nullptr; + if ( dynamic_cast(myIMessage) ) + { + Console::WriteLine( "Message is of type 'IMethodCallMessage*'." ); + Console::WriteLine( "" ); + IMethodCallMessage^ myIMethodCallMessage; + myIMethodCallMessage = dynamic_cast(myIMessage); + Console::WriteLine( "InArgCount is : {0}", myIMethodCallMessage->InArgCount ); + IEnumerator^ myEnum = myIMethodCallMessage->InArgs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ myObj = safe_cast(myEnum->Current); + Console::WriteLine( "InArgs is : {0}", myObj ); + } + + for ( int i = 0; i < myIMethodCallMessage->InArgCount; i++ ) + { + Console::WriteLine( "GetArgName({0}) is : {1}", i, myIMethodCallMessage->GetArgName( i ) ); + Console::WriteLine( "GetInArg({0}) is : {0}", i, myIMethodCallMessage->GetInArg( i ) ); + + } + Console::WriteLine( "" ); + } + else + if ( dynamic_cast(myIMessage) ) + Console::WriteLine( "Message is of type 'IMethodReturnMessage*'." ); + + // Build Return Message + myReturnMessage = gcnew ReturnMessage( 5,nullptr,0,nullptr,dynamic_cast(myIMessage) ); + Console::WriteLine( "MyProxy::Invoke - Finish" ); + return myReturnMessage; + } +}; + +// The class used to obtain Metadata. +public ref class MyMarshalByRefClass: public MarshalByRefObject +{ +public: + int MyMethod( String^ str, double dbl, int i ) + { + Console::WriteLine( "MyMarshalByRefClass::MyMethod {0} {1} {2}", str, dbl, i ); + return 0; + } + +}; +// + +// Main routine that drives the whole sample. +int main() +{ + Console::WriteLine( "Generate a new MyProxy." ); + MyProxy^ myProxy = gcnew MyProxy( MyMarshalByRefClass::typeid ); + Console::WriteLine( "Obtain the transparent proxy from myProxy." ); + MyMarshalByRefClass^ myMarshalByRefClassObj = dynamic_cast(myProxy->GetTransparentProxy()); + Console::WriteLine( "Calling the Proxy." ); + Object^ myReturnValue = myMarshalByRefClassObj->MyMethod( "Microsoft", 1.2, 6 ); + Console::WriteLine( "Sample Done." ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp new file mode 100644 index 00000000000..2b4d9d392c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_LogicalCallContext/CPP/imethodmessage_logicalcallcontext.cpp @@ -0,0 +1,104 @@ +// System::Runtime::Remoting::Messaging.IMethodMessage*.LogicalCallContext +// System::Runtime::Remoting::Messaging.IMethodMessage*.Uri + +/* +The program demonstrates the 'LogicalCallContext' and 'Uri' properties of +the IMethodMessage* interface. +In the program a remote Object* is created with a method by extending 'MarshalByRefObject'. +A custom proxy is created by extending 'RealProxy' and overriding 'Invoke' +method of 'RealProxy'. In this example custom proxy is accessed by passing message +to the Invoke method. Then the values of 'Uri' and 'LogicalCallContext' properties +are displayed to the console. +*/ + +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Permissions; + +// MyProxy extends the CLR Remoting RealProxy. +// This demonstrate the RealProxy extensiblity. +// +//This sample requires full trust +[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")] +public ref class MyProxy: public RealProxy +{ +private: + String^ stringUri; + MarshalByRefObject^ targetObject; + +public: + MyProxy( Type^ type ) + : RealProxy( type ) + { + targetObject = dynamic_cast(Activator::CreateInstance( type )); + ObjRef^ myObject = RemotingServices::Marshal( targetObject ); + stringUri = myObject->URI; + } + + MyProxy( Type^ type, MarshalByRefObject^ targetObject ) + : RealProxy( type ) + { + this->targetObject = targetObject; + } + + // + virtual IMessage^ Invoke( IMessage^ message ) override + { + message->Properties[ "__Uri" ] = stringUri; + IMethodMessage^ myMethodMessage = dynamic_cast(ChannelServices::SyncDispatchMessage( message )); + Console::WriteLine( "---------IMethodMessage* example-------" ); + Console::WriteLine( "Method name : {0}", myMethodMessage->MethodName ); + Console::WriteLine( "LogicalCallContext has information : {0}", myMethodMessage->LogicalCallContext->HasInfo ); + Console::WriteLine( "Uri : {0}", myMethodMessage->Uri ); + return myMethodMessage; + } + // +}; +// + + +[AttributeUsage(AttributeTargets::Class)] +[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")] +public ref class MyProxyAttribute: public ProxyAttribute +{ +public: + MyProxyAttribute(){} + + virtual MarshalByRefObject^ CreateInstance( Type^ serverType ) override + { + if ( serverType->IsMarshalByRef ) + { + MarshalByRefObject^ targetObject = dynamic_cast(Activator::CreateInstance( serverType )); + MyProxy^ proxy = gcnew MyProxy( serverType,targetObject ); + return dynamic_cast(proxy->GetTransparentProxy()); + } + else + throw gcnew Exception( "Proxies only work on MarshalByRefObject objects and their children" ); + } +}; + +public ref class Zip: public MarshalByRefObject, public ILogicalThreadAffinative +{ +public: + Zip(){} + + int Method1( int i ) + { + return i; + } +}; + +int main() +{ + MyProxy^ proxy = gcnew MyProxy( Zip::typeid ); + Zip^ myZip = dynamic_cast(proxy->GetTransparentProxy()); + CallContext::SetData( "USER", gcnew Zip ); + myZip->Method1( 6 ); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp new file mode 100644 index 00000000000..fc6f65fff23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IMethodMessage_MethodName/CPP/imethodmessage_methodname.cpp @@ -0,0 +1,111 @@ +// System::Runtime::Remoting::Messaging.IMethodMessage* +// System::Runtime::Remoting::Messaging.IMethodMessage*.MethodName +// System::Runtime::Remoting::Messaging.IMethodMessage*.ArgCount +// System::Runtime::Remoting::Messaging.IMethodMessage*.GetArgName +// System::Runtime::Remoting::Messaging.IMethodMessage*.GetArg +// System::Runtime::Remoting::Messaging.IMethodMessage*.HasVarArgs +// System::Runtime::Remoting::Messaging.IMethodMessage*.Args + +/* +The following program demonstrates the 'MethodName', 'ArgCount', 'HasVarArgs', +'Args' properties, 'GetArgName', 'GetArg' methods of 'IMethodMessage*' interface and +'IMethodMessage*' interface. +In this example custom proxy is accessed by passing message to the Invoke method. +The Invoke method calls the methods and properties of 'IMethodMessage*' interface +and displays the result to the console. +*/ + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Permissions; + +public ref class Reverser: public MarshalByRefObject +{ +private: + String^ stringReversed; + +public: + String^ GetReversedString() + { + return stringReversed; + } + + void SetString( String^ temp ) + { + DoReverse( temp ); + } + +private: + + // Exposed reverse as a method to reverse a String*. + void DoReverse( String^ argString ) + { + stringReversed = ""; + for ( int i = argString->Length - 1; i >= 0; i-- ) + { + stringReversed += argString[i]; + } + } +}; + +// +// This class requires full trust +[PermissionSetAttribute(SecurityAction::Demand, Name = "FullTrust")] +public ref class MyProxyClass: public RealProxy +{ +private: + Object^ myObjectInstance; + Type^ myType; + +public: + MyProxyClass( Type^ argType ) + : RealProxy( argType ) + { + myType = argType; + myObjectInstance = Activator::CreateInstance( argType ); + } + + // + // Overriding the Invoke method of RealProxy. + virtual IMessage^ Invoke( IMessage^ message ) override + { + IMethodMessage^ myMethodMessage = dynamic_cast(message); + Console::WriteLine( "**** Begin Invoke ****" ); + Console::WriteLine( "\tType is : {0}", myType ); + Console::WriteLine( "\tMethod name : {0}", myMethodMessage->MethodName ); + for ( int i = 0; i < myMethodMessage->ArgCount; i++ ) + { + Console::WriteLine( "\tArgName is : {0}", myMethodMessage->GetArgName( i ) ); + Console::WriteLine( "\tArgValue is: {0}", myMethodMessage->GetArg( i ) ); + + } + if ( myMethodMessage->HasVarArgs ) + Console::WriteLine( "\t The method have variable arguments!!" ); + else + Console::WriteLine( "\t The method does not have variable arguments!!" ); + + + // Dispatch the method call to the real Object*. + Object^ returnValue = myType->InvokeMember( myMethodMessage->MethodName, BindingFlags::InvokeMethod, nullptr, myObjectInstance, myMethodMessage->Args ); + Console::WriteLine( "**** End Invoke ****" ); + + // Build the return message to pass back to the transparent proxy. + ReturnMessage^ myReturnMessage = gcnew ReturnMessage( returnValue,nullptr,0,nullptr,dynamic_cast(message) ); + return myReturnMessage; + } + // +}; +// + +int main() +{ + MyProxyClass^ myProxy = gcnew MyProxyClass( Reverser::typeid ); + + // The real proxy dynamically creates a transparent proxy. + Reverser^ myReverser = dynamic_cast(myProxy->GetTransparentProxy()); + myReverser->SetString( "Hello World!" ); + Console::WriteLine( "The [Out] result is : {0}", myReverser->GetReversedString() ); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp new file mode 100644 index 00000000000..de64597d5f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_Exception/CPP/imethodreturnmessage_exception.cpp @@ -0,0 +1,87 @@ +// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.Exception + +/* +The following example demonstrates 'Exception' property of 'IMethodReturnMessage*'interface. +A 'CustomServer' class is defined extending 'MarshalByRefObject'. A custom proxy +is created by extending 'RealProxy' and overriding 'Invoke' method of 'RealProxy'. +The Invoke method calls the methods and properties of 'IMethodMessage*' interface +and display the 'Exception' property value of 'IMethodReturnMessage*' interface to +the console. +*/ + +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; + +public ref class CustomServer: public MarshalByRefObject +{ +public: + void RaiseException() + { + throw gcnew Exception( "Raising an exception." ); + } +}; + +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::LinkDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::InheritanceDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +public ref class MyProxy: public RealProxy +{ +private: + String^ _URI; + MarshalByRefObject^ myMarshalByRefObject; + +public: + MyProxy( Type^ myType ) : RealProxy( myType ) + { + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( myType )); + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + _URI = myObjRef->URI; + } + + // + virtual IMessage^ Invoke( IMessage^ myMessage ) override + { + IMethodCallMessage^ myCallMessage = dynamic_cast(myMessage); + + IMethodReturnMessage^ myIMethodReturnMessage = + RemotingServices::ExecuteMessage( myMarshalByRefObject, myCallMessage ); + if ( myIMethodReturnMessage->Exception != nullptr ) + { + Console::WriteLine( "{0} raised an exception.", + myIMethodReturnMessage->MethodName ); + } + else + { + Console::WriteLine( "{0} does not raise an exception.", + myIMethodReturnMessage->MethodName ); + } + + return myIMethodReturnMessage; + } + // +}; + +int main() +{ + // Create an instance of MyProxy. + MyProxy^ myCustomProxy = gcnew MyProxy( CustomServer::typeid ); + // Get an instance of remote class. + CustomServer^ myHelloServer = dynamic_cast(myCustomProxy->GetTransparentProxy()); + try + { + // Invoke remote method. + myHelloServer->RaiseException(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp b/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp new file mode 100644 index 00000000000..b77b076d05b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IMethodReturnMessage_ReturnValue/CPP/imethodreturnmessage_returnvalue.cpp @@ -0,0 +1,106 @@ +// System::Runtime::Remoting::Messaging.IMethodReturnMessage* +// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.OutArgs +// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.ReturnValue +// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.OutArgCount +// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.GetOutArg +// System::Runtime::Remoting::Messaging.IMethodReturnMessage*.GetOutArgName + +/* +The following example demonstrates 'ReturnValue', 'OutArgCount' properties, +'GetOutArg', 'GetOutArgName' methods of 'IMethodReturnMessage*' interface +and 'IMethodReturnMessage*' interface. +A custom proxy is created by extending 'RealProxy' and overriding 'Invoke' method of +'RealProxy'. The custom proxy is accessed by passing message to the Invoke method. +The Invoke method calls properties of 'IMethodReturnMessage*' interface and +prints the values to the console. +*/ + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::InteropServices; + +public ref class CustomServer: public MarshalByRefObject +{ +public: + String^ HelloMethod( String^ myString, interior_ptr myDoubleValue, + [Out]interior_ptr myIntValue ) + { + *myIntValue = 100; + return myString; + } +}; + +// +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::LinkDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +[System::Security::Permissions::SecurityPermissionAttribute +(System::Security::Permissions::SecurityAction::InheritanceDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +public ref class MyProxy: public RealProxy +{ +private: + String^ stringUri; + MarshalByRefObject^ myMarshalByRefObject; + +public: + MyProxy( Type^ myType ) : RealProxy( myType ) + { + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( myType )); + ObjRef^ myObject = RemotingServices::Marshal( myMarshalByRefObject ); + stringUri = myObject->URI; + } + + // + virtual IMessage^ Invoke( IMessage^ myMessage ) override + { + IMethodCallMessage^ myCallMessage = (IMethodCallMessage^)( myMessage ); + + IMethodReturnMessage^ myIMethodReturnMessage = + RemotingServices::ExecuteMessage( myMarshalByRefObject, myCallMessage ); + + Console::WriteLine( "Method name : {0}", myIMethodReturnMessage->MethodName ); + Console::WriteLine( "The return value is : {0}", myIMethodReturnMessage->ReturnValue ); + + // Get number of 'ref' and 'out' parameters. + int myArgOutCount = myIMethodReturnMessage->OutArgCount; + Console::WriteLine( "The number of 'ref', 'out' parameters are : {0}", + myIMethodReturnMessage->OutArgCount ); + // Gets name and values of 'ref' and 'out' parameters. + for ( int i = 0; i < myArgOutCount; i++ ) + { + Console::WriteLine( "Name of argument {0} is '{1}'.", + i, myIMethodReturnMessage->GetOutArgName( i ) ); + Console::WriteLine( "Value of argument {0} is '{1}'.", + i, myIMethodReturnMessage->GetOutArg( i ) ); + } + Console::WriteLine(); + array^myObjectArray = myIMethodReturnMessage->OutArgs; + for ( int i = 0; i < myObjectArray->Length; i++ ) + Console::WriteLine( "Value of argument {0} is '{1}' in OutArgs", + i, myObjectArray[ i ] ); + return myIMethodReturnMessage; + } + // +}; +// + +int main() +{ + // Create an instance of MyProxy. + MyProxy^ myCustomProxy = gcnew MyProxy( CustomServer::typeid ); + // Get an instance of remote class. + CustomServer^ myHelloServer = + (CustomServer^)( myCustomProxy->GetTransparentProxy() ); + double myDoubleValue = 10.5; + int myIntValue = 200; + // Invoke the remote method. + myHelloServer->HelloMethod( "Hello", &myDoubleValue, &myIntValue ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp b/snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp new file mode 100644 index 00000000000..252026db492 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IPAddress_Broadcast_Loopback/CPP/ipaddress_broadcast_loopback.cpp @@ -0,0 +1,33 @@ +/* +This program demonstrates the 'Loopback' and 'Broadcast' field of 'IPAddress' class. +It prints the loopback IP address 127.0.0.1 and Broadcast IP address 255.255.255.255 +*/ + +#using + +using namespace System; +using namespace System::Net; + +// +void PrintLoopbackAddress() +{ + // Gets the IP loopback address and converts it to a string. + String^ IpAddressString = IPAddress::Loopback->ToString(); + Console::WriteLine( "Loopback IP address : {0}", IpAddressString ); +} +// + +// +void PrintBroadcastAddress() +{ + // Get the IP Broadcast address and convert it to string. + String^ IpAddressString = IPAddress::Broadcast->ToString(); + Console::WriteLine( "\nBroadcast IP address : {0}", IpAddressString ); +} +// + +int main() +{ + PrintLoopbackAddress(); + PrintBroadcastAddress(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp b/snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp new file mode 100644 index 00000000000..e1bb9569466 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IPAddress_NetworkToHost/CPP/ipaddress_networktohost.cpp @@ -0,0 +1,87 @@ +/* +This program demonstrates 'NetworkToHostOrder(short)', 'NetworkToHostOrder(int)' and +'NetworkToHostOrder(long)' methods of 'IPAddress' class. +It takes a String* from commandline for each of above cases and convert it to the corresponding +primitive type(i.e. short, int, long) value. Alternatively it uses default values for each cases. +Then these values are converted from network Byte order to host Byte order by calling the +overloaded 'NetworkToHostOrder' methods of 'IPAddress' class. +*/ + +#using + +using namespace System; +using namespace System::Net; + +// +void NetworkToHostOrder_Short( short networkByte ) +{ + short hostByte; + // Converts a short value from network Byte order to host Byte order. + hostByte = IPAddress::NetworkToHostOrder( networkByte ); + Console::WriteLine( "Network Byte order to Host Byte order of {0} is {1}", networkByte, hostByte ); +} +// + +// +void NetworkToHostOrder_Integer( int networkByte ) +{ + int hostByte; + // Converts an integer value from network Byte order to host Byte order. + hostByte = IPAddress::NetworkToHostOrder( networkByte ); + Console::WriteLine( "Network Byte order to Host Byte order of {0} is {1}", networkByte, hostByte ); +} +// + +// +void NetworkToHostOrder_Long( __int64 networkByte ) +{ + __int64 hostByte; + // Converts a long value from network Byte order to host Byte order. + hostByte = IPAddress::NetworkToHostOrder( networkByte ); + Console::WriteLine( "Network Byte order to Host Byte order of {0} is {1}", networkByte, hostByte ); +} +// + +int main() +{ + try + { + short networkByteShort = 4365; + int networkByteInt = 286064640; + __int64 networkByteLong = 1228638273342013440I64; + String^ networkByteString = ""; + + Console::Write( "'Program converts Network Byte order to Host Byte order for short, int and long values'" ); + Console::Write( "\nEnter a short value for Convertion(press Enter for default, default is '4365') : " ); + networkByteString = Console::ReadLine(); + if ( networkByteString->Length > 0 ) + networkByteShort = Convert::ToInt16( networkByteString ); + NetworkToHostOrder_Short( networkByteShort ); + + networkByteString = ""; + Console::Write( "\nEnter an Integer value for Convertion(press Enter for default, default is '286064640') : " ); + networkByteString = Console::ReadLine(); + if ( networkByteString->Length > 0 ) + networkByteInt = Convert::ToInt32( networkByteString ); + NetworkToHostOrder_Integer( networkByteInt ); + + networkByteString = ""; + Console::Write( "\nEnter a long value for Convertion(press Enter for default, default is '1228638273342013440') : " ); + networkByteString = Console::ReadLine(); + if ( networkByteString->Length > 0 ) + networkByteLong = Convert::ToInt64( networkByteString ); + NetworkToHostOrder_Long( networkByteLong ); + } + catch ( FormatException^ e ) + { + Console::WriteLine( "FormatException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp b/snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp new file mode 100644 index 00000000000..c4ef78097fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IPAddress_None/CPP/ipaddress_none.cpp @@ -0,0 +1,22 @@ + + +/* +This program demonstrates the 'None' field of 'IPAddress' class. +Provides an IP address indicating that no network interface should be used. +*/ +#using + +using namespace System; +using namespace System::Net; + +// +int main() +{ + + // Gets the IP address indicating that no network interface should be used + // and converts it to a String*. + String^ address = IPAddress::None->ToString(); + Console::WriteLine( "IP address : {0}", address ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp b/snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp new file mode 100644 index 00000000000..fdaff450fae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IPEndPoint_Properties/CPP/ipendpoint_properties.cpp @@ -0,0 +1,123 @@ +// System.Net.IPEndPoint.MaxPort; System.Net.IPEndPoint.MinPort; +// System.Net.IPEndPoint.AddressFamily; System.Net.IPEndPoint.IPEndPoint(long,int) +// System.Net.IPEndPoint.Address; System.Net.IPEndPoint.Port; + +/*This program demonstrates the properties 'MaxPort', 'MinPort','Address','Port' +and 'AddressFamily' and a constructor 'IPEndPoint(long,int)' of class 'IPEndPoint'. + +A procedure DoSocketGet is created which internally uses a socket to transmit http "Get" requests to a Web resource. +The program accepts a resource Url, Resolves it to obtain 'IPAddress',Constructs 'IPEndPoint' instance using this +'IPAddress' and port 80.Invokes DoSocketGet procedure to obtain a response and displays the response to a console. + +It then accepts another Url, Resolves it to obtain 'IPAddress'. Assigns this IPAddress and port to the 'IPEndPoint' +and again invokes DoSocketGet to obtain a response and display. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +using namespace System::Net::Sockets; +using namespace System::Runtime::InteropServices; + +String^ DoSocketGet( IPEndPoint^ hostIPEndPoint, String^ getString ); // forward reference + +int main() +{ + try + { + Console::Write( "\nPlease enter an INTRANET Url as shown: [e.g. www.microsoft.com]:" ); + String^ hostString1 = Console::ReadLine(); + +// +// +// +// + IPAddress^ hostIPAddress1 = (Dns::Resolve( hostString1 ))->AddressList[ 0 ]; + Console::WriteLine( hostIPAddress1 ); + IPEndPoint^ hostIPEndPoint = gcnew IPEndPoint( hostIPAddress1,80 ); + Console::WriteLine( "\nIPEndPoint information:{0}", hostIPEndPoint ); + Console::WriteLine( "\n\tMaximum allowed Port Address :{0}", IPEndPoint::MaxPort ); + Console::WriteLine( "\n\tMinimum allowed Port Address :{0}", (int^)IPEndPoint::MinPort ); + Console::WriteLine( "\n\tAddress Family :{0}", hostIPEndPoint->AddressFamily ); +// + Console::Write( "\nPress Enter to continue" ); + Console::ReadLine(); + String^ getString = String::Format( "GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", hostString1 ); + String^ pageContent = DoSocketGet( hostIPEndPoint, getString ); + if ( pageContent != nullptr ) + { + Console::WriteLine( "Default HTML page on {0} is:\r\n{1}", hostString1, pageContent ); + } +// +// +// + + Console::Write( "\n\n\nPlease enter another INTRANET Url as shown[e.g. www.microsoft.com]: " ); + String^ hostString2 = Console::ReadLine(); + +// +// + IPAddress^ hostIPAddress2 = (Dns::Resolve( hostString2 ))->AddressList[ 0 ]; + hostIPEndPoint->Address = hostIPAddress2; + hostIPEndPoint->Port = 80; + + getString = String::Format( "GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", hostString2 ); + pageContent = DoSocketGet( hostIPEndPoint, getString ); + if ( pageContent != nullptr ) + { + Console::WriteLine( "Default HTML page on {0} is:\r\n{1}", hostString2, pageContent ); + } + +// +// + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + +String^ DoSocketGet( IPEndPoint^ hostIPEndPoint, String^ getString ) +{ + try + { + // Set up variables and String to write to the server. + Encoding^ ASCII = Encoding::ASCII; + + array^ byteGet = ASCII->GetBytes( getString ); + array^ recvBytes = gcnew array(256); + String^ strRetPage = nullptr; + // Create the Socket for sending data over TCP. + Socket^ mySocket = gcnew Socket( AddressFamily::InterNetwork, + SocketType::Stream,ProtocolType::Tcp ); + // Connect to host using IPEndPoint. + mySocket->Connect( hostIPEndPoint ); + // Send the GET text to the host. + mySocket->Send( byteGet, byteGet->Length, (SocketFlags)( 0 ) ); + // Receive the page, loop until all bytes are received. + Int32 byteCount = mySocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)( 0 ) ); + strRetPage = String::Concat( strRetPage, ASCII->GetString( recvBytes, 0, byteCount ) ); + while ( byteCount > 0 ) + { + byteCount = mySocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)( 0 ) ); + strRetPage = String::Concat( strRetPage, ASCII->GetString( recvBytes, 0, byteCount ) ); + } + return strRetPage; + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + Console::WriteLine( "WinSock Error : {0}", Convert::ToString( Marshal::GetLastWin32Error() ) ); + return nullptr; + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp b/snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp new file mode 100644 index 00000000000..f51adc5cf17 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IPHostEntry_AddressList/CPP/iphostentry_addresslist.cpp @@ -0,0 +1,59 @@ +/* +This program demostrates 'AddressList' property of 'IPHostEntry' class. +It takes a URL from commandline(or uses default value) and obtains a +'IPHostEntry' Object* by calling 'GetHostByName' method of 'Dns' class and +prints the host name and IP addresses associated with the specified URL. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +// +void GetIpAddressList( String^ hostString ) +{ + try + { + // Get 'IPHostEntry' object containing information + // like host name, IP addresses, aliases for a host. + IPHostEntry^ hostInfo = Dns::GetHostByName( hostString ); + Console::WriteLine( "Host name : {0}", hostInfo->HostName ); + Console::WriteLine( "IP address List : " ); + for ( int index = 0; index < hostInfo->AddressList->Length; index++ ) + Console::WriteLine( hostInfo->AddressList[ index ] ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// + +int main() +{ + String^ hostString = " "; + + // Create an instance of HostInfoSample class. + Console::Write( "Type a URL(or press Enter for default, default is 'www.microsoft.net') : " ); + hostString = Console::ReadLine(); + if ( hostString->Length > 0 ) + GetIpAddressList( hostString ); + else + GetIpAddressList( "www.microsoft.net" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp b/snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp new file mode 100644 index 00000000000..a648e8a91ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IServerChannelSinkProvider_CreateSink/CPP/iserverchannelsinkprovider_3.cpp @@ -0,0 +1,71 @@ +// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.CreateSink() +// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.GetChannelData() +// System.Runtime.Remoting.Channels.IServerChannelSinkProvider.Next + +/* The following program demonstrates 'CreateSink', 'GetChannelData' + methods and 'Next' property of + 'System.Runtime.Remoting.Channels.ServerChannelSinkStack' class. + It chains together two different sink providers using the 'Next' + property. The return value of 'GetChannelData()' is displayed on + the console. +*/ + +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +ref class MyServerChannelSinkStack +{ +public: + IServerChannelSinkProvider^ myIServerChannelSinkProvider; + IServerChannelSinkProvider^ myIServerChannelSinkProvider1; + IServerChannelSink^ myIServerChannelSink; + IServerChannelSink^ myIServerChannelSink1; + + void MyCreateSinkMethod() + { + Console::Write( "Press Enter to set sink providers and create sinks" ); + Console::ReadLine(); + +// +// + // Create the sink providers. + myIServerChannelSinkProvider = gcnew SoapServerFormatterSinkProvider; + myIServerChannelSinkProvider1 = gcnew BinaryServerFormatterSinkProvider; + // Create the channel sinks. + myIServerChannelSink = myIServerChannelSinkProvider->CreateSink( gcnew HttpChannel ); + myIServerChannelSinkProvider->Next = myIServerChannelSinkProvider1; + + myIServerChannelSink1 = myIServerChannelSinkProvider->Next->CreateSink( gcnew HttpChannel ); +// +// + Console::WriteLine( "Two sink providers have been set" ); + } + + void MyGetChannelDataMethod() + { +// + array^channelUri = gcnew array(5); + IChannelDataStore^ myIChannelDataStore = gcnew ChannelDataStore( channelUri ); + IChannelDataStore^ myIChannelDataStore1 = gcnew ChannelDataStore( channelUri ); + myIServerChannelSinkProvider->GetChannelData( myIChannelDataStore ); + myIServerChannelSinkProvider1->GetChannelData( myIChannelDataStore1 ); +// + + Console::WriteLine( "Number of Uris in first IChannelDataStore: {0}", + myIChannelDataStore->ChannelUris->Length ); + Console::WriteLine( "Number of Uris in second IChannelDataStore: {0}", + myIChannelDataStore1->ChannelUris->Length ); + } +}; + +int main() +{ + MyServerChannelSinkStack^ myNewServerChannelSinkStack = + gcnew MyServerChannelSinkStack; + myNewServerChannelSinkStack->MyCreateSinkMethod(); + myNewServerChannelSinkStack->MyGetChannelDataMethod(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp new file mode 100644 index 00000000000..950c783ff0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ISponsor_Client/CPP/isponsor_client.cpp @@ -0,0 +1,68 @@ +// System::Runtime::Remoting::Lifetime.ISponsor +// System::Runtime::Remoting::Lifetime.ISponsor.Renewal + +/* +The following program demonstrates the 'ISponsor' interface and its 'Renewal' method. +It defines 'MyClientSponsor' which implements 'ISponsor' interface. The server and +client is created. The client registers a sponsor that(after the initial lease time) +renews the lease at different time from that specified in the remote type. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Lifetime; +using namespace System::Security::Permissions; + +// +// +public ref class MyClientSponsor: public MarshalByRefObject, public ISponsor +{ +private: + DateTime lastRenewal; + +public: + MyClientSponsor() + { + lastRenewal = DateTime::Now; + } + + [SecurityPermissionAttribute(SecurityAction::LinkDemand,Flags=SecurityPermissionFlag::Infrastructure)] + virtual TimeSpan Renewal( ILease^ /* lease */ ) + { + Console::WriteLine( "Request to renew the lease time." ); + Console::WriteLine( "Time since last renewal: {0}", + DateTime::Now - lastRenewal ); + + lastRenewal = DateTime::Now; + return TimeSpan::FromSeconds( 20 ); + } +}; +// +// + +int main() +{ + // Load the configuration file. + RemotingConfiguration::Configure( "ISponsor_Client.config" ); + ClientActivatedType ^ clientActivatedObject = gcnew ClientActivatedType; + + ILease^ serverLease = (ILease^)( RemotingServices::GetLifetimeService( + clientActivatedObject ) ); + MyClientSponsor^ sponsor = gcnew MyClientSponsor; + + // Note: If you don't pass an initial time, the first request will be taken + // from the LeaseTime settings specified in the ISponsor_Server.config file. + serverLease->Register( sponsor ); + + Console::WriteLine( "Client-activated Object.\n {0}", + clientActivatedObject->RemoteMethod() ); + Console::WriteLine( "Press enter to end the client application domain." ); + Console::ReadLine(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp b/snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp new file mode 100644 index 00000000000..e161a956e00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ITransportHeaders_Item/CPP/itransportheaders_3_server.cpp @@ -0,0 +1,115 @@ + + +// System.Runtime.Remoting.Channels.ITransportHeaders +// System.Runtime.Remoting.Channels.ITransportHeaders.Item +// System.Runtime.Remoting.Channels.ITransportHeaders.GetEnumerator() +/* The following program demonstrates the 'ITransportHeaders' interface, +its 'Item' property and 'GetEnumerator' method. It implements the 'Item' +property and 'GetEnumerator' method in a class derived from 'ITransportHeaders' +interface. It then adds a few headers to the header list and displays them. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +ref class MyITransportHeadersClass: public ITransportHeaders +{ +private: + + // + // + int myInt; + array^myDictionaryEntry; + +public: + MyITransportHeadersClass() + { + myInt = 0; + myDictionaryEntry = gcnew array(10); + } + + + property Object^ Item [Object^] + { + + // Implement the 'Item' property. + virtual Object^ get( Object^ myKey ) + { + if ( myKey != nullptr ) + { + for ( int i = 0; i <= myInt; i++ ) + if ( myDictionaryEntry[ i ].Key == myKey ) + return myDictionaryEntry[ i ].Value; + } + + return nullptr; + } + + virtual void set( Object^ myKey, Object^ value ) + { + myDictionaryEntry[ myInt ] = DictionaryEntry(myKey,value); + myInt++; + } + + } + + // Implement the 'GetEnumerator' method. + virtual IEnumerator^ GetEnumerator() + { + Hashtable^ myHashtable = gcnew Hashtable; + for ( int j = 0; j < myInt; j++ ) + myHashtable->Add( myDictionaryEntry[ j ].Key, myDictionaryEntry[ j ].Value ); + return myHashtable->GetEnumerator(); + } + + // + // +}; + +int main() +{ + try + { + + // Create and register a 'TcpChannel' object. + TcpChannel^ myTcpChannel = gcnew TcpChannel( 8085 ); + ChannelServices::RegisterChannel( myTcpChannel, false ); + RemotingConfiguration::RegisterWellKnownServiceType( MyHelloServer::typeid, "SayHello", WellKnownObjectMode::SingleCall ); + + // Create an instance of 'myITransportHeadersObj'. + MyITransportHeadersClass^ myITransportHeadersObj = gcnew MyITransportHeadersClass; + ITransportHeaders^ myITransportHeaders = dynamic_cast(myITransportHeadersObj); + + // Add items to the header list. + myITransportHeaders->default[ "Header1" ] = "TransportHeader1"; + myITransportHeaders->default[ "Header2" ] = "TransportHeader2"; + + // Get the 'ITranportHeader' item value with key 'Header2'. + Console::WriteLine( "ITransport Header item value with key 'Header2' is :{0}", myITransportHeaders->default[ "Header2" ] ); + IEnumerator^ myEnumerator = myITransportHeaders->GetEnumerator(); + Console::WriteLine( " -KEY- -VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + + // Display the 'Key' and 'Value' of the current element. + Object^ myEntry = myEnumerator->Current; + DictionaryEntry myDictionaryEntry = *dynamic_cast(myEntry); + Console::WriteLine( " {0}: {1}", myDictionaryEntry.Key, myDictionaryEntry.Value ); + } + Console::WriteLine( "Hit to exit..." ); + Console::ReadLine(); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "The following exception is raised on the server side: {0}", ex->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp b/snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp new file mode 100644 index 00000000000..51a46703a72 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/IWebProxy_Interface/CPP/iwebproxy_interface.cpp @@ -0,0 +1,87 @@ +/* +This program demonstrates 'Credentials' property, 'GetProxy' and 'IsBypassed' methods of +IWebProxy* interface. +The 'WebProxy_Interface' class implements the 'IWebProxy*' interface. It provides an implementation for the +'GetProxy' and 'IsByPassed' methods and 'ICredentials*' property. The 'GetProxy' method returns the url +of the proxy server as specified in the constructor. The 'IsByPassed' method returns false indicating +that the proxy server must never be bypassed for any requested url. The 'ICredentials*' property stores +the credentials required by the proxy server to authenticate the actual user. +*/ + +#using + +using namespace System; +using namespace System::Net; + +// +// +// +public ref class WebProxy_Interface: public IWebProxy +{ +private: + // The credentials to be used with the web proxy. + ICredentials^ iCredentials; + + // Uri of the associated proxy server. + Uri^ webProxyUri; + +public: + WebProxy_Interface( Uri^ proxyUri ) + { + webProxyUri = proxyUri; + } + + property ICredentials^ Credentials + { + // Get and Set the Credentials property. + virtual ICredentials^ get() + { + return iCredentials; + } + virtual void set( ICredentials^ value ) + { + if ( iCredentials != value ) + { + iCredentials = value; + } + } + } + + // Return the web proxy for the specified destination (destUri). + virtual Uri^ GetProxy( Uri^ destUri ) + { + // Always use the same proxy. + return webProxyUri; + } + + // Return whether the web proxy should be bypassed for the specified destination (hostUri). + virtual bool IsBypassed( Uri^ hostUri ) + { + // Never bypass the proxy. + return false; + } +}; +// +// +// + +int main() +{ + // + WebProxy_Interface^ webProxy_Interface = gcnew WebProxy_Interface( gcnew Uri( "http://proxy.example.com" ) ); + + webProxy_Interface->Credentials = gcnew NetworkCredential( "myusername", "mypassword" ); + + Console::WriteLine( "The web proxy is : {0}", webProxy_Interface->GetProxy( gcnew Uri( "http://www.contoso.com" ) ) ); + + // Check if the webproxy can ne bypassed for the site "http://www.contoso.com". + if ( webProxy_Interface->IsBypassed( gcnew Uri( "http://www.contoso.com" ) ) ) + { + Console::WriteLine( "Web Proxy is by passed" ); + } + else + { + Console::WriteLine( "Web Proxy is not by passed" ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp b/snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp new file mode 100644 index 00000000000..a896ff5bdcf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ImportCollection_6/CPP/importcollection_6.cpp @@ -0,0 +1,71 @@ +// System::Web::Services::Description.ImportCollection +// System::Web::Services::Description.ImportCollection::Item +// System::Web::Services::Description.ImportCollection::CopyTo +// System::Web::Services::Description.ImportCollection::Contains +// System::Web::Services::Description.ImportCollection::IndexOf +// System::Web::Services::Description.ImportCollection::Remove + +/* The following program demonstrates the methods 'CopyTo', 'Contains', 'IndexOf', 'Remove' +and property 'Item' of class 'ImportCollection'. +The program reads a 'WSDL' document and gets a 'ServiceDescription' instance +An 'ImportCollection' instance is then retrieved from this 'ServiceDescription' +instance and its members have been demonstrated. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuoteService_cpp.wsdl" ); + Console::WriteLine( " ImportCollection Sample " ); + + // + // Get Import Collection. + ImportCollection^ myImportCollection = myServiceDescription->Imports; + Console::WriteLine( "Total Imports in the document = {0}", myServiceDescription->Imports->Count ); + + // Print 'Import' properties to console. + for ( int i = 0; i < myImportCollection->Count; ++i ) + Console::WriteLine( "\tImport Namespace : {0} Import Location : {1} ", + myImportCollection[ i ]->Namespace, myImportCollection[ i ]->Location ); + // + + // + array^myImports = gcnew array(myServiceDescription->Imports->Count); + + // Copy 'ImportCollection' to an array. + myServiceDescription->Imports->CopyTo( myImports, 0 ); + Console::WriteLine( "Imports that are copied to Importarray ..." ); + for ( int i = 0; i < myImports->Length; ++i ) + Console::WriteLine( "\tImport Namespace : {0} Import Location : {1} ", + myImports[ i ]->Namespace, myImports[ i ]->Location ); + // + + // + // + // + // Get Import by Index. + Import^ myImport = myServiceDescription->Imports[ myServiceDescription->Imports->Count - 1 ]; + Console::WriteLine( "Import by Index..." ); + if ( myImportCollection->Contains( myImport ) ) + { + Console::WriteLine( "Import Namespace ' {0} ' is found in 'ImportCollection'.", myImport->Namespace ); + Console::WriteLine( "Index of '{0}' in 'ImportCollection' = {1}", + myImport->Namespace, myImportCollection->IndexOf( myImport ) ); + Console::WriteLine( "Deleting Import from 'ImportCollection'..." ); + myImportCollection->Remove( myImport ); + if ( myImportCollection->IndexOf( myImport ) == -1 ) + Console::WriteLine( "Import is successfully removed from Import Collection." ); + } + // + // + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp b/snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp new file mode 100644 index 00000000000..84b92d63c6b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Importsample/CPP/importsample.cpp @@ -0,0 +1,88 @@ +// System::Web::Services::Description.ImportCollection->Add; +// System::Web::Services::Description.ImportCollection::Insert; +// System::Web::Services::Description.Import::Import(); +// System::Web::Services::Description.Import::Location; +// System::Web::Services::Description.Import::Namespace; +// System::Web::Services::Description.Import::ServiceDescription; +// System::Web::Services::Description.Import; + +/* The following example demonstrates the constructor 'Import()' and properties 'Namespace', 'Location', 'Namespace', +'ServiceDescription' of Import Class. Methods 'Add' and 'Insert' of Class 'ImportCollection' are also demonstrated. +This example uses a sample provided in WSDL specification to explain Import and ImportCollection. +It adds import instances to ImportCollection as suggested in the specification sample and enumerates the same to the console. +Note: This is an illustrative sample using an example from WSDL specification. The real world web service has been assumed. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +// +// +// +// Creates an Import object with namespace and location. +Import^ CreateImport( String^ targetNamespace, String^ targetlocation ) +{ + Import^ myImport = gcnew Import; + myImport->Location = targetlocation; + myImport->Namespace = targetNamespace; + return myImport; +} +// +// +// + +// +void PrintImportCollection( String^ fileName_wsdl ) +{ + // Read import collection properties from generated WSDL file. + ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( fileName_wsdl ); + ImportCollection^ myImportCollection = myServiceDescription1->Imports; + Console::WriteLine( "Enumerating Import Collection for file ' {0}'...", fileName_wsdl ); + + // Print Import properties to console. + for ( int i = 0; i < myImportCollection->Count; ++i ) + { + Console::WriteLine( "Namespace : {0}", myImportCollection[ i ]->Namespace ); + Console::WriteLine( "Location : {0}", myImportCollection[ i ]->Location ); + Console::WriteLine( "ServiceDescription : {0}", myImportCollection[ i ]->ServiceDescription->Name ); + } +} +// + +int main() +{ + Console::WriteLine( "Import Sample" ); + + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); + myServiceDescription->Imports->Add( CreateImport( "http://localhost/stockquote/schemas", "http://localhost/stockquote/stockquote_cpp.xsd" ) ); + // + + // Save the ServiceDescripition to an external file. + myServiceDescription->Write( "StockQuote_cpp.wsdl" ); + Console::WriteLine( "document 'StockQuote_cpp.wsdl'" ); + + // Print the import collection to the console. + PrintImportCollection( "StockQuote_cpp.wsdl" ); + + // + myServiceDescription = ServiceDescription::Read( "StockQuoteService_cpp.wsdl" ); + myServiceDescription->Imports->Insert( 0, CreateImport( "http://localhost/stockquote/definitions", "http://localhost/stockquote/stockquote_cpp.wsdl" ) ); + // + + // Save the ServiceDescripition to an external file. + myServiceDescription->Write( "StockQuoteService_cs::wsdl" ); + Console::WriteLine( "" ); + Console::WriteLine( "document 'StockQuoteService_cpp.wsdl'" ); + + //Print the import collection to the console. + PrintImportCollection( "StockQuoteService_cpp.wsdl" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp new file mode 100644 index 00000000000..052c76a6eb8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_BeginInvoke/CPP/logicalmethodinfo_begininvoke.cpp @@ -0,0 +1,123 @@ +// System.Web.Services.Protocols.LogicalMethodInfo.BeginInvoke(object,object[],AsyncCallback,object) +// System.Web.Services.Protocols.LogicalMethodInfo.EndInvoke(object,IAsyncResult) + +/* The following example demonstrates 'BeginInvoke' and 'EndInvoke' methods of +'LogicalMethodInfo' class. The 'Add' method of Math web service is called in asynchronous mode. 'BeginInvoke' +begins asynchronous invocation of method and 'EndInvoke' terminates the invocation +started by 'BeginInvoke'. The return value returned by 'Endinvoke' is displayed. + +Note: The MyMath class is a proxy class generated by the Wsdl.exe utility for +the Math Web Service. This class can also be found in SoapHttpClientProtocol Class example. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Web::Services::Protocols; +using namespace System::Security::Permissions; + +// Automatically generated proxy class for Math Web service. +// This class can also be found in the SoapHttpClientProtocol class example. +namespace MyMath +{ + using namespace System::Diagnostics; + using namespace System::Xml::Serialization; + using namespace System::Web::Services::Protocols; + using namespace System::Web::Services; + + [System::Web::Services::WebServiceBindingAttribute( + Name="MyMathSoap",Namespace="http://tempuri.org/")] + public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + MyMath() + { + this->Url = "http://localhost/Math.asmx"; + } + + [System::Web::Services::Protocols::SoapDocumentMethodAttribute( + "http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int x, int y ) + { + array^ temp2 = { x, y }; + array^ results = this->Invoke( "Add", temp2 ); + return (int)( results[ 0 ] ); + } + + System::IAsyncResult^ BeginAdd( int x, int y, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^ temp3 = {x,y}; + return this->BeginInvoke( "Add", temp3, callback, asyncState ); + } + + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^ results = this->EndInvoke( asyncResult ); + return (int)( results[ 0 ] ); + } + }; +} + +public ref class BeginInvokeClass +{ + // + // +public: + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + static void main() + { + // Get the type information. + // Note: The MyMath class is a proxy class generated by the Wsdl.exe + // utility for the Math Web service. This class can also be found in + // the SoapHttpClientProtocol class example. + Type^ myType = MyMath::MyMath::typeid; + + // Get the method info. + MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); + MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); + + // Create an instance of the LogicalMethodInfo class. + array^ temp0 = { myBeginMethod, myEndMethod }; + LogicalMethodInfo^ myLogicalMethodInfo = + ( LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async ) )[ 0 ]; + + // Get an instance of the proxy class. + MyMath::MyMath^ myMathService = gcnew MyMath::MyMath; + + // Call the MyEndIntimationMethod method to intimate the end of + // the asynchronous call. + AsyncCallback^ myAsyncCallback = gcnew AsyncCallback( MyEndIntimationMethod ); + + // Begin to invoke the Add method. + array^ temp1 = { 10, 10 }; + IAsyncResult^ myAsyncResult = myLogicalMethodInfo->BeginInvoke( + myMathService, temp1, myAsyncCallback, nullptr ); + + // Wait until invoke is complete. + myAsyncResult->AsyncWaitHandle->WaitOne(); + + // Get the result. + array^ myReturnValue; + myReturnValue = myLogicalMethodInfo->EndInvoke( myMathService, myAsyncResult ); + + Console::WriteLine( "Sum of 10 and 10 is {0}", myReturnValue[ 0 ] ); + } + + // This method will be called at the end of the asynchronous call. + static void MyEndIntimationMethod( IAsyncResult^ /*Result*/ ) + { + Console::WriteLine( "Asynchronous call on Add method finished." ); + } + // + // +}; + +int main() +{ + BeginInvokeClass::main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp new file mode 100644 index 00000000000..6845810ce5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Constructor/CPP/logicalmethodinfo_constructor.cpp @@ -0,0 +1,66 @@ + + +// All the following have been marked as 1 snippet : Snippet1 +// System::Web::Services::Protocols.LogicalMethodInfo::LogicalMethodInfo(MethodInfo) +// System::Web::Services::Protocols.LogicalMethodInfo::DeclaringType +// System::Web::Services::Protocols.LogicalMethodInfo::Parameters +// System::Web::Services::Protocols.LogicalMethodInfo::ReturnType +// System::Web::Services::Protocols.LogicalMethodInfo::Invoke(Object*, Object*->Item[]) +// System::Web::Services::Protocols.LogicalMethodInfo +/* +This following example demonstrates the constructor, 'DeclaringType', +'Parameters', 'ReturnType' properties and 'Invoke(Object*, Object*->Item[])', +'ToString()' methods of the 'LogicalMethodInfo' class. This example +displays the declaring type, parameters, return type of a method +named 'Add' in the class named 'MyService'. + +Note : The 'LogicalMethodInfo' class should only be used with +'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain +a property named 'MethodInfo' which provides for an instance of +'LogicalMethodInfo'. If you are interested only in the reflection +of a type then use the 'System::Reflection' namespace and not this +class. This class gives information ab->Item[Out] the* method invoked for +a web service and hence should only be used as such. For example +purposes it is being showed in a more simplified scenario. +*/ +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Web::Services::Protocols; + +public ref class MyService +{ +public: + int Add( int xValue, int yValue ) + { + return (xValue + yValue); + } + +}; + +int main() +{ + Type^ myType = MyService::typeid; + MethodInfo^ myMethodInfo = myType->GetMethod( "Add" ); + LogicalMethodInfo^ myLogicalMethodInfo = gcnew LogicalMethodInfo( myMethodInfo ); + Console::WriteLine( "\nPrinting properties of method : {0}\n", myLogicalMethodInfo ); + Console::WriteLine( "\nThe declaring type of the method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0}", myLogicalMethodInfo->DeclaringType ); + Console::WriteLine( "\nThe parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); + array^myParameters = myLogicalMethodInfo->Parameters; + for ( int i = 0; i < myParameters->Length; i++ ) + { + Console::WriteLine( "\t {0}", String::Concat( myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); + } + Console::WriteLine( "\nThe return type of the method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0}", myLogicalMethodInfo->ReturnType ); + MyService^ service = gcnew MyService; + Console::WriteLine( "\nInvoking the method {0}\n", myLogicalMethodInfo->Name ); + array^values = gcnew array(2); + values[ 0 ] = 10; + values[ 1 ] = 10; + Console::WriteLine( "\tThe sum of 10 and 10 is : {0}", myLogicalMethodInfo->Invoke( service, values ) ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp new file mode 100644 index 00000000000..3710797439f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create1/CPP/logicalmethodinfo_create1.cpp @@ -0,0 +1,76 @@ + + +// All the following have been marked as 1 snippet : Snippet1 +// System::Web::Services::Protocols.LogicalMethodInfo::Create(MethodInfo) +// System::Web::Services::Protocols.LogicalMethodInfo::Name +// System::Web::Services::Protocols.LogicalMethodInfo::InParameters +// System::Web::Services::Protocols.LogicalMethodInfo::OutParameters +// System::Web::Services::Protocols.LogicalMethodInfo::IsVoid +/* +This following example demonstrates the 'Name', +'InParameters', 'OutParameters', 'IsVoid' properties and +'Create(MethodInfo)' method of the 'LogicalMethodInfo' class. +This example displays the parameters, the in parameters and +[Out] parameters. + + +Note : The 'LogicalMethodInfo' class should only be used with +'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain +a property named 'MethodInfo' which provides for an instance of +'LogicalMethodInfo'. If you are interested only in the reflection +of a type then use the 'System::Reflection' namespace and not this +class. This class gives information ab->Item[Out] the* method invoked for +a web service and hence should only be used as such. For example +purposes it is being showed in a more simplified scenario. +*/ +// +#using + +using namespace System; +using namespace System::Runtime::InteropServices; +using namespace System::Reflection; +using namespace System::Web::Services::Protocols; + +public ref class MyService +{ +public: + void MyMethod( int inParameter, [Out]interior_ptr outParameter ) + { + *outParameter = inParameter; + } +}; + +int main() +{ + Type^ myType = MyService::typeid; + MethodInfo^ myMethodInfo = myType->GetMethod( "MyMethod" ); + array^temparray = {myMethodInfo}; + LogicalMethodInfo^ myLogicalMethodInfo = (LogicalMethodInfo::Create( temparray ))[ 0 ]; + Console::WriteLine( "\nPrinting parameters for the method : {0}", myLogicalMethodInfo->Name ); + Console::WriteLine( "\nThe parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); + array^myParameters = myLogicalMethodInfo->Parameters; + for ( int i = 0; i < myParameters->Length; i++ ) + { + Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); + + } + Console::WriteLine( "\nThe in parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); + myParameters = myLogicalMethodInfo->InParameters; + for ( int i = 0; i < myParameters->Length; i++ ) + { + Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); + + } + Console::WriteLine( "\nThe out parameters of the method {0} are :\n", myLogicalMethodInfo->Name ); + myParameters = myLogicalMethodInfo->OutParameters; + for ( int i = 0; i < myParameters->Length; i++ ) + { + Console::WriteLine( String::Concat( "\t ", myParameters[ i ]->Name, " : ", myParameters[ i ]->ParameterType ) ); + + } + if ( myLogicalMethodInfo->IsVoid ) + Console::WriteLine( "\nThe return type is void" ); + else + Console::WriteLine( "\nThe return type is {0}", myLogicalMethodInfo->ReturnType ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp new file mode 100644 index 00000000000..c626ad55b86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_Create2/CPP/logicalmethodinfo_create2.cpp @@ -0,0 +1,78 @@ +// System::Web::Services::Protocols.LogicalMethodInfo::Create(MethodInfo->Item[], LogicalMethodTypes) +// System::Web::Services::Protocols.LogicalMethodInfo::AsyncCallbackParameter +// System::Web::Services::Protocols.LogicalMethodInfo::AsyncStateParameter +// System::Web::Services::Protocols.LogicalMethodInfo::AsyncResultParameter +// System::Web::Services::Protocols.LogicalMethodInfo::BeginMethodInfo +// System::Web::Services::Protocols.LogicalMethodInfo::EndMethodInfo +// System::Web::Services::Protocols.LogicalMethodInfo::IsAsync +// System::Web::Services::Protocols.LogicalMethodTypes::Async + +/* +This following example demonstrates the 'AsyncCallbackParameter', +'AsyncResultParameter', 'AsyncStateParameter', 'BeginMethodInfo', +'EndMethodInfo', 'IsAsync' properties and +'Create(MethodInfo->Item[], LogicalMethodTypes)' method of the +'LogicalMethodInfo' class and the 'Async' enum member of the +'LogicalMethodTypes' enumeration. This example displays the callback, +result and state parameters for asynchronous methods. It also displays +the begin and end for such asynchronous methods. + +Note : The 'LogicalMethodInfo' class should only be used with +'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain +a property named 'MethodInfo' which provides for an instance of +'LogicalMethodInfo'. If you are interested only in the reflection +of a type then use the 'System::Reflection' namespace and not this +class. This class gives information ab->Item[Out] the* method invoked for +a web service and hence should only be used as such. For example +purposes it is being showed in a more simplified scenario. +*/ + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Web::Services::Protocols; + +public ref class MyService: public SoapHttpClientProtocol +{ +public: + IAsyncResult^ BeginAdd( int xValue, int yValue, AsyncCallback^ callback, Object^ asyncState ) + { + array^temp0 = {xValue,yValue}; + return this->BeginInvoke( "Add", temp0, callback, asyncState ); + } + + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } +}; + +int main() +{ + Type^ myType = MyService::typeid; + MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); + MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); + array^temp0 = {myBeginMethod,myEndMethod}; + LogicalMethodInfo^ myLogicalMethodInfo = LogicalMethodInfo::Create( temp0, LogicalMethodTypes::Async )[ 0 ]; + Console::WriteLine( "\nThe asynchronous callback parameter of method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0} : {1}", myLogicalMethodInfo->AsyncCallbackParameter->Name, myLogicalMethodInfo->AsyncCallbackParameter->ParameterType ); + Console::WriteLine( "\nThe asynchronous state parameter of method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0} : {1}", myLogicalMethodInfo->AsyncStateParameter->Name, myLogicalMethodInfo->AsyncStateParameter->ParameterType ); + Console::WriteLine( "\nThe asynchronous result parameter of method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0} : {1}", myLogicalMethodInfo->AsyncResultParameter->Name, myLogicalMethodInfo->AsyncResultParameter->ParameterType ); + Console::WriteLine( "\nThe begin method of the asynchronous method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0}", myLogicalMethodInfo->BeginMethodInfo ); + Console::WriteLine( "\nThe end method of the asynchronous method {0} is :\n", myLogicalMethodInfo->Name ); + Console::WriteLine( "\t {0}", myLogicalMethodInfo->EndMethodInfo ); + if ( myLogicalMethodInfo->IsAsync ) + Console::WriteLine( "\n {0} is asynchronous", myLogicalMethodInfo->Name ); + else + Console::WriteLine( "\n {0} is synchronous", myLogicalMethodInfo->Name ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp new file mode 100644 index 00000000000..ac1bdd162ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_GetCustomAttribute/CPP/logicalmethodinfo_getcustomattribute.cpp @@ -0,0 +1,124 @@ +// System::Web::Services::Protocols.LogicalMethodTypes::Sync +// System::Web::Services::Protocols.LogicalMethodTypes::LogicalMethodTypes +// System::Web::Services::Protocols.LogicalMethodInfo::MethodInfo +// All the following have been grouped as one snippet : Snippet4 +// System::Web::Services::Protocols.LogicalMethodInfo::GetCustomAttribute(Type) +// System::Web::Services::Protocols.LogicalMethodInfo::GetCustomAttributes(Type) +// System::Web::Services::Protocols.LogicalMethodInfo::ReturnTypeCustomAttributeProvider +// System::Web::Services::Protocols.LogicalMethodInfo::CustomAttributeProvider + +/* +This following example demonstrates the 'MethodInfo', +'ReturnTypeCustomAttributeProvider', 'CustomAttributeProvider', +properties and 'GetCustomAttribute(Type)', +'GetCustomAttributes(Type)' methods of the 'LogicalMethodInfo' class +and 'Sync' enum member of 'LogicalMethodTypes' enumeration. +This example demonstrates custom attributes and return attributes of the +'Add' method. + +Note : The 'LogicalMethodInfo' class should only be used with +'SoapMessage'. 'SoapClientMessage' and 'SoapServerMessage' contain +a property named 'MethodInfo' which provides for an instance of +'LogicalMethodInfo'. If you are interested only in the reflection +of a type then use the 'System::Reflection' namespace and not this +class. This class gives information ab[Out] the* method invoked for +a web service and hence should only be used as such. For example +purposes it is being showed in a more simplified scenario. +*/ + +// +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Web::Services::Protocols; + +// Define a custom attribute with one named parameter. + +[AttributeUsage(AttributeTargets::Method|AttributeTargets::ReturnValue, +AllowMultiple=true)] +public ref class MyAttribute: public Attribute +{ +private: + String^ myName; + +public: + MyAttribute( String^ name ) + { + myName = name; + } + + property String^ Name + { + String^ get() + { + return myName; + } + } +}; + +public ref class MyService +{ +public: + + [MyAttribute("This is the first sample attribute")] + [MyAttribute("This is the second sample attribute")] + [returnvalue:MyAttribute("This is the return sample attribute")] + int Add( int xValue, int yValue ) + { + return (xValue + yValue); + } +}; + +int main() +{ + // + Type^ myType = MyService::typeid; + MethodInfo^ myMethodInfo = myType->GetMethod( "Add" ); + + // + // + // Create a synchronous 'LogicalMethodInfo' instance. + array^temparray = {myMethodInfo}; + LogicalMethodInfo^ myLogicalMethodInfo = (LogicalMethodInfo::Create( temparray, LogicalMethodTypes::Sync ))[ 0 ]; + // + // + + // Display the method for which the attributes are being displayed. + Console::WriteLine( "\nDisplaying the attributes for the method : {0}\n", myLogicalMethodInfo->MethodInfo ); + // + + // Displaying a custom attribute of type 'MyAttribute' + Console::WriteLine( "\nDisplaying attribute of type 'MyAttribute'\n" ); + Object^ attribute = myLogicalMethodInfo->GetCustomAttribute( MyAttribute::typeid ); + Console::WriteLine( (dynamic_cast(attribute))->Name ); + + // Display all custom attribute of type 'MyAttribute'. + Console::WriteLine( "\nDisplaying all attributes of type 'MyAttribute'\n" ); + array^attributes = myLogicalMethodInfo->GetCustomAttributes( MyAttribute::typeid ); + for ( int i = 0; i < attributes->Length; i++ ) + Console::WriteLine( (dynamic_cast(attributes[ i ]))->Name ); + + // Display all return attributes of type 'MyAttribute'. + Console::WriteLine( "\nDisplaying all return attributes of type 'MyAttribute'\n" ); + ICustomAttributeProvider^ myCustomAttributeProvider = myLogicalMethodInfo->ReturnTypeCustomAttributeProvider; + if ( myCustomAttributeProvider->IsDefined( MyAttribute::typeid, true ) ) + { + attributes = myCustomAttributeProvider->GetCustomAttributes( true ); + for ( int i = 0; i < attributes->Length; i++ ) + if ( attributes[ i ]->GetType()->Equals( MyAttribute::typeid ) ) + Console::WriteLine( (dynamic_cast(attributes[ i ]))->Name ); + } + + // Display all the custom attributes of type 'MyAttribute'. + Console::WriteLine( "\nDisplaying all attributes of type 'MyAttribute'\n" ); + myCustomAttributeProvider = myLogicalMethodInfo->CustomAttributeProvider; + if ( myCustomAttributeProvider->IsDefined( MyAttribute::typeid, true ) ) + { + attributes = myCustomAttributeProvider->GetCustomAttributes( true ); + for ( int i = 0; i < attributes->Length; i++ ) + if ( attributes[ i ]->GetType()->Equals( MyAttribute::typeid ) ) + Console::WriteLine( (dynamic_cast(attributes[ i ]))->Name ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp new file mode 100644 index 00000000000..ce69fb86dfd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/LogicalMethodInfo_IsBeginMethod/CPP/logicalmethodinfo_isbeginmethod.cpp @@ -0,0 +1,80 @@ + + +// System.Web.Services.Protocols.LogicalMethodInfo.IsBeginMethod(MethodInfo) +// System.Web.Services.Protocols.LogicalMethodInfo.IsEndMethod(MethodInfo) +/* +The following example demonstrates 'IsBeginMethod' and 'IsEndMethod' methods of 'System.Web.Services.Protocols.LogicalMethodInfo' class. The type information of methods of Math web service is taken in a varible of type MethodInfo. Then 'IsBeginMethod' and 'IsEndMethod' is used to query on created MethodInfo variable to find whether the method is begin and end method for asynchronous invocation or not. +Note: The below MyMath class is a proxy class generated by the Wsdl.exe utility for the Math Web Service. This class can be found in SoapHttpClientProtocol Class example also. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Web::Services::Protocols; + +// Automatically generated proxy class for Math Web service. +// This class can also be found in SoapHttpClientProtocol class example. +namespace MyMath +{ +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + + [System::Web::Services::WebServiceBindingAttribute(Name="MyMathSoap", + Namespace="http://tempuri.org/")] + public ref class MyMath: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + MyMath() + { + this->Url = "http://localhost/Math.asmx"; + } + + [System::Web::Services::Protocols::SoapDocumentMethodAttribute( + "http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int x, int y ) + { + array^temp0 = {x,y}; + array^results = this->Invoke( "Add", temp0 ); + return *dynamic_cast(results[ 0 ]); + } + + System::IAsyncResult^ BeginAdd( int x, int y, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {x,y}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +int main() +{ + // + // + // Get the type for the proxy class MyMath Web service. + // Note: The MyMath class is a proxy class generated by the Wsdl.exe + // utility for the Math Web service. This class can also be found in + // the SoapHttpClientProtocol class example. + Type^ myType = MyMath::MyMath::typeid; + MethodInfo^ myBeginMethod = myType->GetMethod( "BeginAdd" ); + MethodInfo^ myEndMethod = myType->GetMethod( "EndAdd" ); + MethodInfo^ myMethod = myType->GetMethod( "Add" ); + Console::WriteLine( "Is 'BeginAdd' a Begin Method : {0}", LogicalMethodInfo::IsBeginMethod( myBeginMethod ) ); + Console::WriteLine( "Is 'Add' a Begin Method : {0}", LogicalMethodInfo::IsBeginMethod( myMethod ) ); + Console::WriteLine( "Is 'EndAdd' an End Method : {0}", LogicalMethodInfo::IsEndMethod( myEndMethod ) ); + // + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp b/snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp new file mode 100644 index 00000000000..ae08b9bd296 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MatchAttribute/CPP/SvcClient_MatchAttribute.cpp @@ -0,0 +1,141 @@ +/* + This program is used as a client of the client proxy class. +*/ + +// System.Web.Services.Protocols.MatchAttribute +// System.Web.Services.Protocols.MatchAttribute.MatchAttribute(string) +// System.Web.Services.Protocols.MatchAttribute.IgnoreCase +// System.Web.Services.Protocols.MatchAttribute.Pattern +// System.Web.Services.Protocols.MatchAttribute.Capture +// System.Web.Services.Protocols.MatchAttribute.Group +// System.Web.Services.Protocols.MatchAttribute.MaxRepeats + +/* + The following example demonstrates the constructor and 'IgnoreCase', + 'Pattern', 'Capture', 'Group', 'MaxRepeats' properties of the + 'MatchAttribute' class. This example shows a simple proxy that + parses the contents of a .html file which has been returned in + response to a web request. The web request which is a HTTP-GET + request is done behind the scenes in the 'Invoke' method of + 'HttpGetClientProtocol'. The .html file returned in response is + parsed with the help of 'MatchAttribute' class and the contents + are available in the 'Headers' instance returned by 'GetHeaders' + method. +*/ + +// +#using +#using + +using namespace System; +using namespace System::Web::Services::Protocols; + +// +// +// +// +// +// +public ref class Example_Headers +{ +public: + + [MatchAttribute("TITLE>(.*?)<")] + String^ Title; + + [MatchAttribute("",Pattern="h1>(.*?)<",IgnoreCase=true)] + String^ H1; + + [MatchAttribute("H2>((([^<,]*),?)+)<",Group=3,Capture=4)] + String^ Element; + + [MatchAttribute("H2>((([^<,]*),?){2,})<",Group=3,MaxRepeats=0)] + array^ Elements1; + + [MatchAttribute("H2>((([^<,]*),?){2,})<",Group=3,MaxRepeats=1)] + array^ Elements2; + + [MatchAttribute("H3 ([^=]*)=([^>]*)",Group=1)] + String^ Attribute; + + [MatchAttribute("H3 ([^=]*)=([^>]*)",Group=2)] + String^ Value; +}; +// +// +// +// +// +// + +public ref class MatchAttribute_Example: public HttpGetClientProtocol +{ +public: + MatchAttribute_Example() + { + Url = "http://localhost"; + } + + [HttpMethodAttribute(TextReturnReader::typeid,UrlParameterWriter::typeid)] + Example_Headers^ GetHeaders() + { + return ((Example_Headers^)(Invoke( "GetHeaders", ( Url + "/MyHeaders.html" ), + gcnew array(0) ))); + } + + System::IAsyncResult^ BeginGetHeaders( System::AsyncCallback^ callback, + Object^ asyncState ) + { + return BeginInvoke( "GetHeaders", ( Url + "/MyHeaders.html" ), + gcnew array(0), callback, asyncState ); + } + + Example_Headers^ EndGetHeaders( System::IAsyncResult^ asyncResult ) + { + return (Example_Headers^)(EndInvoke( asyncResult )); + } +}; +// + +public ref class SvcClient +{ +public: + static void main() + { + Example_Headers^ myHeaders; + MatchAttribute_Example^ mySample = gcnew MatchAttribute_Example; + myHeaders = mySample->GetHeaders(); + + Console::WriteLine( "\nThe Title html tag content is : {0}", + myHeaders->Title ); + + Console::WriteLine( "\nThe H1 html tag content is : {0}", + myHeaders->H1 ); + + Console::WriteLine( "\nThe fifth element in H2 html tag content is : {0}", + myHeaders->Element ); + + Console::WriteLine( "\nThe elements in the H2 html tag are :" + + " (MaxRepeats = 0)" ); + for ( int i = 0; i < myHeaders->Elements1->Length; i++ ) + { + Console::WriteLine( myHeaders->Elements1[ i ] ); + } + + Console::WriteLine( "\nThe elements in the H2 html tag are :" + + " (MaxRepeats = 1)" ); + for ( int i = 0; i < myHeaders->Elements2->Length; i++ ) + { + Console::WriteLine( myHeaders->Elements2[ i ] ); + } + + Console::WriteLine( "\nThe H3 html tag has attribute : {0} = {1}", + myHeaders->Attribute, myHeaders->Value ); + } +}; + +int main() +{ + SvcClient::main(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp new file mode 100644 index 00000000000..d02ef6fb793 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Message.Acknowledgment/CPP/message_acknowledgment.cpp @@ -0,0 +1,145 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + static void CreateQueue( String^ queuePath ) + { + try + { + if ( !MessageQueue::Exists( queuePath ) ) + { + MessageQueue::Create( queuePath ); + } + else + { + Console::WriteLine( "{0} already exists.", queuePath ); + } + } + catch ( MessageQueueException^ e ) + { + Console::WriteLine( e->Message ); + } + + } + + void SendMessage() + { + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Create a new message. + Message^ myMessage = gcnew Message( "Original Message" ); + myMessage->AdministrationQueue = gcnew MessageQueue( ".\\myAdministrationQueue" ); + myMessage->AcknowledgeType = (AcknowledgeTypes)(AcknowledgeTypes::PositiveReceive | AcknowledgeTypes::PositiveArrival); + + // Send the Order to the queue. + myQueue->Send( myMessage ); + return; + } + + String^ ReceiveMessage() + { + // Connect to the a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + myQueue->MessageReadPropertyFilter->CorrelationId = true; + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + String^ returnString = nullptr; + try + { + // Receive and format the message. + Message^ myMessage = myQueue->Receive(); + + // Display message information. + Console::WriteLine( "____________________________________________" ); + Console::WriteLine( "Original message information--" ); + Console::WriteLine( "Body: {0}", myMessage->Body ); + Console::WriteLine( "Id: {0}", myMessage->Id ); + Console::WriteLine( "____________________________________________" ); + returnString = myMessage->Id; + } + catch ( MessageQueueException^ ) + { + // Handle Message Queuing exceptions. + } + // Handle invalid serialization format. + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( e->Message ); + } + + // Catch other exceptions as necessary. + return returnString; + } + + void ReceiveAcknowledgment( String^ messageId, String^ queuePath ) + { + bool found = false; + MessageQueue^ queue = gcnew MessageQueue( queuePath ); + queue->MessageReadPropertyFilter->CorrelationId = true; + queue->MessageReadPropertyFilter->Acknowledgment = true; + try + { + while ( queue->PeekByCorrelationId( messageId ) != nullptr ) + { + Message^ myAcknowledgmentMessage = queue->ReceiveByCorrelationId( messageId ); + + // Output acknowledgment message information. The correlation Id is identical + // to the id of the original message. + Console::WriteLine( "Acknowledgment Message Information--" ); + Console::WriteLine( "Correlation Id: {0}", myAcknowledgmentMessage->CorrelationId ); + Console::WriteLine( "Id: {0}", myAcknowledgmentMessage->Id ); + Console::WriteLine( "Acknowledgment Type: {0}", myAcknowledgmentMessage->Acknowledgment ); + Console::WriteLine( "____________________________________________" ); + found = true; + } + } + catch ( InvalidOperationException^ e ) + { + // This exception would be thrown if there is no (further) acknowledgment message + // with the specified correlation Id. Only output a message if there are no messages; + // not if the loop has found at least one. + if ( !found ) + { + Console::WriteLine( e->Message ); + } + + // Handle other causes of invalid operation exception. + } + + } + +}; + +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Create new queues. + MyNewQueue::CreateQueue( ".\\myQueue" ); + MyNewQueue::CreateQueue( ".\\myAdministrationQueue" ); + + // Send messages to a queue. + myNewQueue->SendMessage(); + + // Receive messages from a queue. + String^ messageId = myNewQueue->ReceiveMessage(); + + // Receive acknowledgment message. + if ( messageId != nullptr ) + { + myNewQueue->ReceiveAcknowledgment( messageId, ".\\myAdministrationQueue" ); + } + + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp new file mode 100644 index 00000000000..1d933075840 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Message.Body/CPP/message_sendreceive.cpp @@ -0,0 +1,117 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Messaging; +using namespace System::Drawing; +using namespace System::IO; +ref class Order +{ +public: + int orderId; + DateTime orderTime; +}; + +ref class MyNewQueue +{ +public: + static void CreateQueue( String^ queuePath ) + { + try + { + if ( !MessageQueue::Exists( queuePath ) ) + { + MessageQueue::Create( queuePath ); + } + else + { + Console::WriteLine( "{0} already exists.", queuePath ); + } + } + catch ( MessageQueueException^ e ) + { + Console::WriteLine( e->Message ); + } + + } + + void SendMessage() + { + try + { + // Create a new order and set values. + Order^ sentOrder = gcnew Order; + sentOrder->orderId = 3; + sentOrder->orderTime = DateTime::Now; + + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Create the new order. + Message^ myMessage = gcnew Message( sentOrder ); + + // Send the order to the queue. + myQueue->Send( myMessage ); + } + catch ( ArgumentException^ e ) + { + Console::WriteLine( e->Message ); + } + + return; + } + + void ReceiveMessage() + { + // Connect to the a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Set the formatter to indicate body contains an Order. + array^p = gcnew array(1); + p[ 0 ] = Order::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + try + { + // Receive and format the message. + Message^ myMessage = myQueue->Receive(); + Order^ myOrder = dynamic_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( "Order ID: {0}", myOrder->orderId ); + Console::WriteLine( "Sent: {0}", myOrder->orderTime ); + } + catch ( MessageQueueException^ ) + { + // Handle Message Queuing exceptions. + } + // Handle invalid serialization format. + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( e->Message ); + } + + // Catch other exceptions as necessary. + return; + } +}; + +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Create a queue on the local computer. + MyNewQueue::CreateQueue( ".\\myQueue" ); + + // Send a message to a queue. + myNewQueue->SendMessage(); + + // Receive a message from a queue. + myNewQueue->ReceiveMessage(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp b/snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp new file mode 100644 index 00000000000..9bf2333fbd8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Message.DefaultPropertiesToSend/CPP/message_defaultandpriority.cpp @@ -0,0 +1,107 @@ +// + +#using +#using + +using namespace System; +using namespace System::Messaging; + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ + //************************************************** + // Sends a string message to a queue. + //************************************************** +public: + void SendMessage( MessagePriority priority, String^ messageBody ) + { + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Create a new message. + Message^ myMessage = gcnew Message; + if ( priority > MessagePriority::Normal ) + { + myMessage->Body = "High Priority: {0}",messageBody; + } + else + { + myMessage->Body = messageBody; + } + + // Set the priority of the message. + myMessage->Priority = priority; + + // Send the Order to the queue. + myQueue->Send( myMessage ); + + return; + } + + //************************************************** + // Receives a message. + //************************************************** + void ReceiveMessage() + { + // Connect to the a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Set the queue to read the priority. By default, it + // is not read. + myQueue->MessageReadPropertyFilter->Priority = true; + + // Set the formatter to indicate body contains a String^. + array^ p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + try + { + // Receive and format the message. + Message^ myMessage = myQueue->Receive(); + + // Display message information. + Console::WriteLine( "Priority: {0}", + myMessage->Priority ); + Console::WriteLine( "Body: {0}", + myMessage->Body ); + } + catch ( MessageQueueException^ ) + { + // Handle Message Queuing exceptions. + } + // Handle invalid serialization format. + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( e->Message ); + } + + // Catch other exceptions as necessary. + + return; + } +}; + +//************************************************** +// Provides an entry point into the application. +// +// This example sends and receives a message from +// a queue. +//************************************************** +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send messages to a queue. + myNewQueue->SendMessage( MessagePriority::Normal, "First Message Body." ); + myNewQueue->SendMessage( MessagePriority::Highest, "Second Message Body." ); + + // Receive messages from a queue. + myNewQueue->ReceiveMessage(); + myNewQueue->ReceiveMessage(); + + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp new file mode 100644 index 00000000000..5210e7417e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageBinding_sample/CPP/messagebinding_sample.cpp @@ -0,0 +1,85 @@ + + +// System::Web::Services::Description.MessageBinding::MessageBinding(); +// System::Web::Services::Description.MessageBinding::Extensions; +// System::Web::Services::Description.MessageBinding::Name; +/* The following program demonstrates the abstract class 'MessageBinding', it's constructor MessageBinding() +and properties 'Extensions' and 'Name'. +'MessageBinding' is an abstract class from which 'InputBinding' , 'OutputBinding' are derived. +The program contains a utility function which could be used to create either an InputBinding or OutputBinding. +This generic nature is achieved by returning an instance of 'MessageBinding'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +MessageBinding^ CreateInputOutputBinding( String^ myBindName, bool isInputBinding ) +{ + + // + // Value isInputBinding = true ---> return type = InputBinding. + // Value isInputBinding = false --> return type = OutputBinding. + // + // + MessageBinding^ myMessageBinding = nullptr; + switch ( isInputBinding ) + { + case true: + myMessageBinding = gcnew InputBinding; + Console::WriteLine( "Added an InputBinding" ); + break; + + case false: + myMessageBinding = gcnew OutputBinding; + Console::WriteLine( "Added an OutputBinding" ); + break; + } + // + myMessageBinding->Name = myBindName; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myMessageBinding->Extensions->Add( mySoapBodyBinding ); + Console::WriteLine( "Added extensibility element of type : {0}", mySoapBodyBinding->GetType() ); + // + // + + return myMessageBinding; +} + + +// Used to create OperationBinding instances within Binding. +OperationBinding^ CreateOperationBinding( String^ myOperation, String^ targetNamespace ) +{ + // Create OperationBinding for Operation. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = myOperation; + + // Create InputBinding for operation. + InputBinding^ myInputBinding = dynamic_cast(CreateInputOutputBinding( nullptr, true )); + + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = dynamic_cast(CreateInputOutputBinding( nullptr, false )); + + // Add InputBinding and OutputBinding to OperationBinding. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + + // Create an extensibility element for SoapOperationBinding. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, myOperation ); + + // Add the extensibility element SoapOperationBinding to OperationBinding. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + return myOperationBinding; +} + +int main() +{ + /* OperationBinding* addOperationBinding = */ + CreateOperationBinding( "Add", "http://tempuri.org/" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp new file mode 100644 index 00000000000..078f4450a48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageCollection/CPP/messagecollection.cpp @@ -0,0 +1,80 @@ +// System::Web::Services::Description.MessageCollection::CopyTo; +// System::Web::Services::Description.MessageCollection::Item Property(Int32); +// System::Web::Services::Description.MessageCollection::Item Property (String); +// System::Web::Services::Description.MessageCollection::Contains; +// System::Web::Services::Description.MessageCollection::IndexOf; +// System::Web::Services::Description.MessageCollection::Remove; + +/* The program reads a WSDL document S"MathService::wsdl" and gets a ServiceDescription instance. +A MessageCollection instance is then retrieved from this ServiceDescription instance and it's +members are demonstrated. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_1.wsdl" ); + Console::WriteLine( "" ); + Console::WriteLine( "MessageCollection Sample" ); + Console::WriteLine( "========================" ); + Console::WriteLine( "" ); + + // + // Get Message Collection. + MessageCollection^ myMessageCollection = myServiceDescription->Messages; + Console::WriteLine( "Total Messages in the document = {0}", myServiceDescription->Messages->Count ); + Console::WriteLine( "" ); + Console::WriteLine( "Enumerating Messages..." ); + Console::WriteLine( "" ); + + // Print messages to console. + for ( int i = 0; i < myMessageCollection->Count; ++i ) + Console::WriteLine( "Message Name : {0}", myMessageCollection[ i ]->Name ); + // + + // + // Create a Message Array. + array^myMessages = gcnew array(myServiceDescription->Messages->Count); + + // Copy MessageCollection to an array. + myServiceDescription->Messages->CopyTo( myMessages, 0 ); + Console::WriteLine( "" ); + Console::WriteLine( "Displaying Messages that were copied to Messagearray ..." ); + Console::WriteLine( "" ); + for ( int i = 0; i < myServiceDescription->Messages->Count; ++i ) + Console::WriteLine( "Message Name : {0}", myMessages[ i ]->Name ); + // + + // + // + // + // + // Get Message by Name = S"AddSoapIn". + Message^ myMessage = myServiceDescription->Messages[ "AddSoapIn" ]; + Console::WriteLine( "" ); + Console::WriteLine( "Getting Message = 'AddSoapIn' {by Name}" ); + if ( myMessageCollection->Contains( myMessage ) ) + { + Console::WriteLine( "" ); + + // Get Message Name = S"AddSoapIn" Index. + Console::WriteLine( "Message 'AddSoapIn' was found in Message Collection." ); + Console::WriteLine( "Index of 'AddSoapIn' in Message Collection = {0}", myMessageCollection->IndexOf( myMessage ) ); + Console::WriteLine( "Deleting Message from Message Collection..." ); + myMessageCollection->Remove( myMessage ); + if ( myMessageCollection->IndexOf( myMessage ) == -1 ) + Console::WriteLine( "Message 'AddSoapIn' was successfully removed from Message Collection." ); + } + // + // + // + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp new file mode 100644 index 00000000000..1b626e5d6ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessagePartCollection/CPP/messagepartcollection.cpp @@ -0,0 +1,106 @@ +// System::Web::Services::Description.MessagePartCollection::Item Property(Int32); +// System::Web::Services::Description.MessagePart::Message; +// System::Web::Services::Description.MessagePartCollection::CopyTo; +// System::Web::Services::Description.MessagePartCollection::Item Property (String); +// System::Web::Services::Description.MessagePartCollection::Contains; +// System::Web::Services::Description.MessagePartCollection::IndexOf; +// System::Web::Services::Description.MessagePartCollection::Remove; +// System::Web::Services::Description.MessagePartCollection; + +/* The program reads a wsdl document S"MathService::wsdl" and gets ServiceDescription instance. +A MessagePartCollection instance is then retrieved from each Message and it's members are demonstrated. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + Console::WriteLine( "" ); + Console::WriteLine( "MessagePartCollection Sample" ); + Console::WriteLine( "============================" ); + Console::WriteLine( "" ); + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService.wsdl" ); + + // Get the message collection. + MessageCollection^ myMessageCollection = myServiceDescription->Messages; + Console::WriteLine( "Total Messages in the document = {0}", myServiceDescription->Messages->Count ); + Console::WriteLine( "" ); + Console::WriteLine( "Enumerating PartCollection for each message..." ); + Console::WriteLine( "" ); + + // + // + // Get the message part collection for each message. + for ( int i = 0; i < myMessageCollection->Count; ++i ) + { + Console::WriteLine( "Message : {0}", myMessageCollection[ i ]->Name ); + + // Get the message part collection. + MessagePartCollection^ myMessagePartCollection = myMessageCollection[ i ]->Parts; + + // Display the part collection. + for ( int k = 0; k < myMessagePartCollection->Count; k++ ) + { + Console::WriteLine( "\t Part Name : {0}", myMessagePartCollection[ k ]->Name ); + Console::WriteLine( "\t Message Name : {0}", myMessagePartCollection[ k ]->Message->Name ); + } + Console::WriteLine( "" ); + } + // + // + + Console::WriteLine( "MessagePartCollection for the message AddHttpGetIn." ); + // + // + Message^ myLocalMessage = myServiceDescription->Messages[ "AddHttpPostOut" ]; + if ( myMessageCollection->Contains( myLocalMessage ) ) + { + Console::WriteLine( "Message : {0}", myLocalMessage->Name ); + + // Get the message part collection. + MessagePartCollection^ myMessagePartCollection = myLocalMessage->Parts; + array^myMessagePart = gcnew array(myMessagePartCollection->Count); + + // Copy the MessagePartCollection to an array. + myMessagePartCollection->CopyTo( myMessagePart, 0 ); + for ( int k = 0; k < myMessagePart->Length; k++ ) + Console::WriteLine( "\t Part Name : {0}", myMessagePartCollection[ k ]->Name ); + Console::WriteLine( "" ); + } + // + // + + // + // + // + Console::WriteLine( "Checking if message is AddHttpPostOut..." ); + Message^ myMessage = myServiceDescription->Messages[ "AddHttpPostOut" ]; + if ( myMessageCollection->Contains( myMessage ) ) + { + // Get the mssage part collection. + MessagePartCollection^ myMessagePartCollection = myMessage->Parts; + + // Get the part named Body. + MessagePart^ myMessagePart = myMessage->Parts[ "Body" ]; + if ( myMessagePartCollection->Contains( myMessagePart ) ) + { + // Get the part named Body. + Console::WriteLine( "Index of Body in MessagePart collection = {0}", myMessagePartCollection->IndexOf( myMessagePart ) ); + Console::WriteLine( "Deleting Body from MessagePart collection..." ); + myMessagePartCollection->Remove( myMessagePart ); + if ( myMessagePartCollection->IndexOf( myMessagePart ) == -1 ) + Console::WriteLine( "from the message AddHttpPostOut." ); + } + } + // + // + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp new file mode 100644 index 00000000000..6f8df31e358 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessagePropertyFilter/CPP/class1.cpp @@ -0,0 +1,930 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +namespace MessagePropertyFilterExample +{ + public ref class Order + { + private: + int orderIdValue; + DateTime orderTimeValue; + + public: + + property int OrderId + { + int get() + { + return orderIdValue; + } + + void set(int value) + { + orderIdValue = value; + } + } + + property DateTime OrderTime + { + DateTime get() + { + return orderTimeValue; + } + + void set(DateTime value) + { + orderTimeValue = value; + } + + } + }; + + public ref class OrderProcessor + { + public: + + // Creates a new queue-> + static void CreateQueue(String^ queuePath, + bool transactional) + { + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue::Create(queuePath, transactional); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } + } + + // Sends an Order to a queue-> + void SendMessage() + { + // Create a new order and set values. + Order^ sentOrder = gcnew Order; + sentOrder->OrderId = 3; + sentOrder->OrderTime = DateTime::Now; + + // Connect to a queue on the local computer. + MessageQueue^ queue = + gcnew MessageQueue(".\\orderQueue"); + + // Create the new order. + Message^ orderMessage = gcnew Message(sentOrder); + + // Label the message. + orderMessage->Label = "Order Message"; + + // Send the order to the queue-> + queue->Send(orderMessage); + } + + // Receives a message containing an order. + void ReceiveMessage() + { + // Connect to the a queue on the local computer. + MessageQueue^ queue = + gcnew MessageQueue(".\\orderQueue"); + + // Set the formatter to indicate + // the message body contains an order. + array ^targetTypes = gcnew array(1); + targetTypes[0] = Order::typeid; + queue->Formatter = + gcnew XmlMessageFormatter(targetTypes); + + // Declare the message. + Message^ orderMessage; + + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's AcknowledgeType property. + queue->MessageReadPropertyFilter-> + AcknowledgeType = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // AcknowledgeType property. + Console::WriteLine("Message.AcknowledgeType: {0}", + orderMessage->AcknowledgeType); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's AdministrationQueue property. + queue->MessageReadPropertyFilter-> + AdministrationQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // AdministrationQueue property. + Console::WriteLine("Message.AdministrationQueue: {0}", + orderMessage->AdministrationQueue); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's AppSpecific property. + queue->MessageReadPropertyFilter->AppSpecific = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // AppSpecific property. + Console::WriteLine("Message.AppSpecific: {0}", + orderMessage->AppSpecific); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's ArrivedTime property. + queue->MessageReadPropertyFilter->ArrivedTime = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // ArrivedTime property. + Console::WriteLine("Message.ArrivedTime: {0}", + orderMessage->ArrivedTime); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's AttachSenderId property. + queue->MessageReadPropertyFilter->AttachSenderId = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // AttachSenderId property. + Console::WriteLine("Message.AttachSenderId: {0}", + orderMessage->AttachSenderId); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's Authenticated property. + queue->MessageReadPropertyFilter->Authenticated = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // Authenticated property. + Console::WriteLine("Message.Authenticated: {0}", + orderMessage->Authenticated); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's + // AuthenticationProviderName property. + queue->MessageReadPropertyFilter-> + AuthenticationProviderName = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // AuthenticationProviderName property. + Console::WriteLine( + "Message.AuthenticationProviderName: {0}", + orderMessage->AuthenticationProviderName); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's + // AuthenticationProviderType property. + queue->MessageReadPropertyFilter-> + AuthenticationProviderType = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // AuthenticationProviderType property. + Console::WriteLine( + "Message.AuthenticationProviderType: {0}", + orderMessage->AuthenticationProviderType); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's Body property. + queue->MessageReadPropertyFilter->Body = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's Body property. + Console::WriteLine("Message.Body: {0}", + orderMessage->Body); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's ConnectorType property. + queue->MessageReadPropertyFilter->ConnectorType = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // ConnectorType property. + Console::WriteLine("Message.ConnectorType: {0}", + orderMessage->ConnectorType); + + // + // + // Set the filter's DefaultBodySize + // property to 2048 bytes. + queue->MessageReadPropertyFilter-> + DefaultBodySize = 2048; + + // Display the new value of the filter's + // DefaultBodySize property. + Console::WriteLine( + "MessageReadPropertyFilter.DefaultBodySize: {0}", + queue->MessageReadPropertyFilter->DefaultBodySize); + + // + // + // Set the filter's DefaultExtensionSize + // property to 1024 bytes. + queue->MessageReadPropertyFilter-> + DefaultExtensionSize = 1024; + + // Display the new value of the filter's + // DefaultExtensionSize property. + Console::WriteLine( + "MessageReadPropertyFilter." + "DefaultExtensionSize: {0}", + queue->MessageReadPropertyFilter-> + DefaultExtensionSize); + + // + // + // Set the filter's DefaultLabelSize + // property to 1024 bytes. + queue->MessageReadPropertyFilter-> + DefaultLabelSize = 1024; + + // Display the new value of the filter's + // DefaultLabelSize property. + Console::WriteLine( + "MessageReadPropertyFilter.DefaultLabelSize: {0}", + queue->MessageReadPropertyFilter->DefaultLabelSize); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's DestinationQueue property. + queue->MessageReadPropertyFilter-> + DestinationQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // Destinationqueue->QueueName property. + Console::WriteLine( + "Message.Destinationqueue->QueueName: {0}", + orderMessage->DestinationQueue->QueueName); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's + // DestinationSymmetricKey property. + queue->MessageReadPropertyFilter-> + DestinationSymmetricKey = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // DestinationSymmetricKey property. + Console::WriteLine( + "Message.DestinationSymmetricKey: {0}", + orderMessage->DestinationSymmetricKey); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's DigitalSignature property. + queue->MessageReadPropertyFilter-> + DigitalSignature = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // DigitalSignature property. + Console::WriteLine("Message.DigitalSignature: {0}", + orderMessage->DigitalSignature); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's EncryptionAlgorithm property. + queue->MessageReadPropertyFilter-> + EncryptionAlgorithm = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // EncryptionAlgorithm property. + Console::WriteLine("Message.EncryptionAlgorithm: {0}", + orderMessage->EncryptionAlgorithm); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's Extension property. + queue->MessageReadPropertyFilter->Extension = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's Extension property. + Console::WriteLine("Message.Extension: {0}", + orderMessage->Extension); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's HashAlgorithm property. + queue->MessageReadPropertyFilter->HashAlgorithm = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // HashAlgorithm property. + Console::WriteLine("Message.HashAlgorithm: {0}", + orderMessage->HashAlgorithm); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's Id property. + queue->MessageReadPropertyFilter->Id = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's Id property. + Console::WriteLine("Message.Id: {0}", orderMessage->Id); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's Label property. + queue->MessageReadPropertyFilter->Label = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's Label property. + Console::WriteLine("Message.Label: {0}", + orderMessage->Label); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's MessageType property. + queue->MessageReadPropertyFilter->MessageType = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // MessageType property. + Console::WriteLine("Message.MessageType: {0}", + orderMessage->MessageType); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's Recoverable property. + queue->MessageReadPropertyFilter->Recoverable = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // Recoverable property. + Console::WriteLine("Message.Recoverable: {0}", + orderMessage->Recoverable); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's ResponseQueue property. + queue->MessageReadPropertyFilter->ResponseQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // Responsequeue->QueueName property. + if (orderMessage->ResponseQueue != nullptr) + { + Console::WriteLine( + "Message.Responsequeue->QueueName: {0}", + orderMessage->ResponseQueue->QueueName); + } + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's SenderCertificate property. + queue->MessageReadPropertyFilter-> + SenderCertificate = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // SenderCertificate property. + Console::WriteLine("Message.SenderCertificate: {0}", + orderMessage->SenderCertificate); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's SenderId property. + queue->MessageReadPropertyFilter->SenderId = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's SenderId property. + Console::WriteLine("Message.SenderId: {0}", + orderMessage->SenderId); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's SenderVersion property. + queue->MessageReadPropertyFilter->SenderVersion = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // SenderVersion property. + Console::WriteLine("Message.SenderVersion: {0}", + orderMessage->SenderVersion); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's SentTime property. + queue->MessageReadPropertyFilter->SentTime = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's SentTime property. + Console::WriteLine("Message.SentTime: {0}", + orderMessage->SentTime); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's SourceMachine property. + queue->MessageReadPropertyFilter->SourceMachine = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // SourceMachine property. + Console::WriteLine("Message.SourceMachine: {0}", + orderMessage->SourceMachine); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's TimeToBeReceived property. + queue->MessageReadPropertyFilter-> + TimeToBeReceived = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // TimeToBeReceived property. + Console::WriteLine("Message.TimeToBeReceived: {0}", + orderMessage->TimeToBeReceived); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's TimeToReachQueue property. + queue->MessageReadPropertyFilter-> + TimeToReachQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // TimeToReachQueue property. + Console::WriteLine("Message.TimeToReachQueue: {0}", + orderMessage->TimeToReachQueue); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's UseAuthentication property. + queue->MessageReadPropertyFilter-> + UseAuthentication = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // UseAuthentication property. + Console::WriteLine("Message.UseAuthentication: {0}", + orderMessage->UseAuthentication); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's UseDeadLetterQueue property. + queue->MessageReadPropertyFilter-> + UseDeadLetterQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // UseDeadLetterQueue property. + Console::WriteLine("Message.UseDeadLetterQueue: {0}", + orderMessage->UseDeadLetterQueue); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's UseEncryption property. + queue->MessageReadPropertyFilter->UseEncryption = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // UseEncryption property. + Console::WriteLine("Message.UseEncryption: {0}", + orderMessage->UseEncryption); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's UseJournalQueue property. + queue->MessageReadPropertyFilter-> + UseJournalQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // UseJournalQueue property. + Console::WriteLine("Message.UseJournalQueue: {0}", + orderMessage->UseJournalQueue); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's UseTracing property. + queue->MessageReadPropertyFilter->UseTracing = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // UseTracing property. + Console::WriteLine("Message.UseTracing: {0}", + orderMessage->UseTracing); + + // + // + // Set all of the queue's MessageReadPropertyFilter + // Boolean properties to false. + queue->MessageReadPropertyFilter->ClearAll(); + + // + // + // Set all of the queue's MessageReadPropertyFilter + // properties to their defaults. + queue->MessageReadPropertyFilter->SetDefaults(); + + // + // + // Set all of the queue's MessageReadPropertyFilter + // Boolean properties to true. + queue->MessageReadPropertyFilter->SetAll(); + + // + // + // Assign the queue a new MessageReadPropertyFilter. + queue->MessageReadPropertyFilter = + gcnew MessagePropertyFilter; + + // + // Receive the message. This will remove the message + // from the queue-> + orderMessage = + queue->Receive(TimeSpan::FromSeconds(10.0)); + } + + // Sends an order to a transactional queue-> + void SendMessageToTransQueue() + { + // Create a new order and set values. + Order^ sentOrder = gcnew Order; + sentOrder->OrderId = 3; + sentOrder->OrderTime = DateTime::Now; + + // Connect to a queue on the local computer. + MessageQueue^ queue = + gcnew MessageQueue(".\\orderTransQueue"); + + // Create the new order. + Message^ orderMessage = gcnew Message(sentOrder); + + // Create a message queuing transaction-> + MessageQueueTransaction^ transaction = + gcnew MessageQueueTransaction; + + try + { + // Begin a transaction-> + transaction->Begin(); + + // Send the order to the queue-> + queue->Send(orderMessage, transaction); + + // Commit the transaction-> + transaction->Commit(); + } + catch (MessageQueueException^ ex) + { + // Abort the transaction-> + transaction->Abort(); + + // Propagate the exception. + throw; + } + finally + { + // Delete the transaction object. + delete transaction; + } + } + + // Receives a message containing an order. + void ReceiveMessageFromTransQueue() + { + // Connect to the a queue on the local computer. + MessageQueue^ queue = + gcnew MessageQueue(".\\orderTransQueue"); + + // Set the formatter to indicate the + // message body contains an order. + array ^targetTypes = gcnew array(1); + targetTypes[0] = Order::typeid; + queue->Formatter = + gcnew XmlMessageFormatter(targetTypes); + + // Declare the message. + Message^ orderMessage; + + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's IsFirstInTransaction property. + queue->MessageReadPropertyFilter-> + IsFirstInTransaction = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // IsFirstInTransaction property. + Console::WriteLine("Message.IsFirstInTransaction: {0}", + orderMessage->IsFirstInTransaction); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's IsLastInTransaction property. + queue->MessageReadPropertyFilter-> + IsLastInTransaction = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // IsLastInTransaction property. + Console::WriteLine("Message.IsLastInTransaction: {0}", + orderMessage->IsLastInTransaction); + + // + // + // Set the queue's MessageReadPropertyFilter property + // to enable the message's TransactionId property. + queue->MessageReadPropertyFilter->TransactionId = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // TransactionId property. + Console::WriteLine("Message.TransactionId: {0}", + orderMessage->TransactionId); + + // + // + // Set the queue's MessageReadPropertyFilter property to + // enable the message's TransactionStatusQueue property. + queue->MessageReadPropertyFilter-> + TransactionStatusQueue = true; + + // Peek at the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Peek(TimeSpan::FromSeconds(10.0)); + + // Display the value of the message's + // TransactionStatusqueue->QueueName property. + Console::WriteLine( + "Message.TransactionStatusqueue->QueueName: {0}", + orderMessage->TransactionStatusQueue->QueueName); + + // + // Create a message queuing transaction-> + MessageQueueTransaction^ transaction = + gcnew MessageQueueTransaction; + + try + { + // Begin a transaction-> + transaction->Begin(); + + // Receive the message. Time out after ten seconds + // in case the message was not delivered. + orderMessage = queue->Receive( + TimeSpan::FromSeconds(10.0), transaction); + + // Commit the transaction-> + transaction->Commit(); + } + catch (MessageQueueException^ ex) + { + // Abort the transaction-> + transaction->Abort(); + + // Propagate the exception. + throw; + } + finally + { + // Delete the transaction object. + delete transaction; + } + } + }; +} + +int main() +{ + // Create a new instance of the class. + MessagePropertyFilterExample::OrderProcessor^ processor = + gcnew MessagePropertyFilterExample::OrderProcessor; + + try + { + // Create a non-transactional queue on the local computer. + // Note that the queue might not be immediately accessible, + //and therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send + // a message to the newly created queue-> + MessagePropertyFilterExample:: + OrderProcessor::CreateQueue(".\\orderQueue", false); + + // Send a message to a queue-> + processor->SendMessage(); + + // Receive a message from a queue-> + processor->ReceiveMessage(); + + // Create a transactional queue on the local computer. + MessagePropertyFilterExample:: + OrderProcessor::CreateQueue(".\\orderTransQueue", true); + + // Send a message to a transactional queue-> + processor->SendMessageToTransQueue(); + + // Receive a message from a transactional queue-> + processor->ReceiveMessageFromTransQueue(); + } + catch (MessageQueueException^ ex) + { + // Write the exception information to the console. + Console::WriteLine(ex); + } +} + +// + +//output: +// +//.\orderQueue already exists. +//Message.AcknowledgeType: None +//Message.AdministrationQueue: +//Message.AppSpecific: 0 +//Message.ArrivedTime: 13.11.2004 14:42:30 +//Message.AttachSenderId: True +//Message.Authenticated: False +//Message.AuthenticationProviderName: +//Message.AuthenticationProviderType: None +//Message.Body: Order +//Message.ConnectorType: 00000000-0000-0000-0000-000000000000 +//MessageReadPropertyFilter.DefaultBodySize: 2048 +//MessageReadPropertyFilter.DefaultExtensionSize: 1024 +//MessageReadPropertyFilter.DefaultLabelSize: 1024 +//Message.Destinationqueue->QueueName: orderqueue +//Message.DestinationSymmetricKey: System.Byte[] +//Message.DigitalSignature: System.Byte[] +//Message.EncryptionAlgorithm: None +//Message.Extension: System.Byte[] +//Message.HashAlgorithm: None +//Message.Id: f2c7b57e-da35-4596-8b30-3b2ce0dd3756\2058 +//Message.Label: Order Message +//Message.MessageType: Normal +//Message.Recoverable: False +//Message.SenderCertificate: System.Byte[] +//Message.SenderId: System.Byte[] +//Message.SenderVersion: 16 +//Message.SentTime: 13.11.2004 14:42:30 +//Message.SourceMachine: ulkdev1 +//Message.TimeToBeReceived: 49710.06:28:15 +//Message.TimeToReachQueue: 4.00:00:00 +//Message.UseAuthentication: False +//Message.UseDeadLetterQueue: False +//Message.UseEncryption: False +//Message.UseJournalQueue: False +//Message.UseTracing: False +//.\orderTransQueue already exists. +//Message.IsFirstInTransaction: True +//Message.IsLastInTransaction: True +//Message.TransactionId: f2c7b57e-da35-4596-8b30-3b2ce0dd3756\2059 +//Message.TransactionStatusqueue->QueueName: private$\order_queue$ \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp new file mode 100644 index 00000000000..f0d29098618 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_TimeSpanStateObject/CPP/mqbeginpeek_timeoutstateobject.cpp @@ -0,0 +1,75 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // Represents a state object associated with each message. + static int messageNumber = 0; + + // Provides an event handler for the PeekCompleted + // event. + // + static void MyPeekCompleted( Object^ source, PeekCompletedEventArgs^ asyncResult ) + { + try + { + // Connect to the queue. + MessageQueue^ mq = dynamic_cast(source); + + // End the asynchronous peek operation. + Message^ m = mq->EndPeek( asyncResult->AsyncResult ); + + // Display message information on the screen, + // including the message number (state object). + Console::WriteLine( "Message: {0} {1}", asyncResult->AsyncResult->AsyncState, static_cast(m->Body) ); + + // Restart the asynchronous peek operation, with the + // same time-out. + mq->BeginPeek( TimeSpan(0,1,0), messageNumber++ ); + } + catch ( MessageQueueException^ e ) + { + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) + { + Console::WriteLine( e ); + } + + // Handle other sources of MessageQueueException. + } + + // Handle other exceptions. + return; + } +}; + + +// Provides an entry point into the application. +// +// This example performs asynchronous peek operation +// processing. +int main() +{ + // Create an instance of MessageQueue. Set its formatter. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Add an event handler for the PeekCompleted event. + myQueue->PeekCompleted += gcnew PeekCompletedEventHandler( MyNewQueue::MyPeekCompleted ); + + // Begin the asynchronous peek operation with a timeout + // of one minute. + myQueue->BeginPeek( TimeSpan(0,1,0), MyNewQueue::messageNumber++ ); + + // Do other work on the current thread. + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp new file mode 100644 index 00000000000..7ba1236a1c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_noparms/CPP/mqbeginpeek_noparms.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// This example performs asynchronous peek operation +// processing. +//************************************************* +ref class MyNewQueue +{ +public: + + // Provides an event handler for the PeekCompleted + // event. + static void MyPeekCompleted( Object^ source, PeekCompletedEventArgs^ asyncResult ) + { + // Connect to the queue. + MessageQueue^ mq = dynamic_cast(source); + + // End the asynchronous peek operation. + Message^ m = mq->EndPeek( asyncResult->AsyncResult ); + + // Display message information on the screen. + Console::WriteLine( "Message: {0}", static_cast(m->Body) ); + + // Restart the asynchronous peek operation. + mq->BeginPeek(); + return; + } +}; + +// Provides an entry point into the application. +// +int main() +{ + // Create an instance of MessageQueue. Set its formatter. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Add an event handler for the PeekCompleted event. + myQueue->PeekCompleted += gcnew PeekCompletedEventHandler( MyNewQueue::MyPeekCompleted ); + + // Begin the asynchronous peek operation. + myQueue->BeginPeek(); + + // Do other work on the current thread. + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp new file mode 100644 index 00000000000..7b1891001d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginPeek_timeout/CPP/mqbeginpeek_timeout.cpp @@ -0,0 +1,61 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + static void MyPeekCompleted( Object^ source, PeekCompletedEventArgs^ asyncResult ) + { try + { + // Connect to the queue. + MessageQueue^ mq = dynamic_cast(source); + + // End the asynchronous peek operation. + Message^ m = mq->EndPeek( asyncResult->AsyncResult ); + + // Display message information on the screen. + Console::WriteLine( "Message: {0}", static_cast(m->Body) ); + + // Restart the asynchronous peek operation, with the + // same time-out. + mq->BeginPeek( TimeSpan(0,1,0) ); + } + catch ( MessageQueueException^ e ) + { + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) + { + Console::WriteLine( e ); + } + + // Handle other sources of MessageQueueException. + } + + // Handle other exceptions. + return; + } +}; + +int main() +{ + // Create an instance of MessageQueue. Set its formatter. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Add an event handler for the PeekCompleted event. + myQueue->PeekCompleted += gcnew PeekCompletedEventHandler( MyNewQueue::MyPeekCompleted ); + + // Begin the asynchronous peek operation with a timeout + // of one minute. + myQueue->BeginPeek( TimeSpan(0,1,0) ); + + // Do other work on the current thread. + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp new file mode 100644 index 00000000000..d7d9f348653 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_mre.cpp @@ -0,0 +1,69 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; +using namespace System::Threading; + +ref class MyNewQueue +{ +public: + + // Define static class members. + static ManualResetEvent^ signal = gcnew ManualResetEvent( false ); + static int count = 0; + + // Provides an event handler for the ReceiveCompleted + // event. + static void MyReceiveCompleted( Object^ source, ReceiveCompletedEventArgs^ asyncResult ) + { + try + { + // Connect to the queue. + MessageQueue^ mq = dynamic_cast(source); + + // End the asynchronous receive operation. + mq->EndReceive( asyncResult->AsyncResult ); + count += 1; + if ( count == 10 ) + { + signal->Set(); + } + + // Restart the asynchronous receive operation. + mq->BeginReceive(); + } + catch ( MessageQueueException^ ) + { + // Handle sources of MessageQueueException. + } + + // Handle other exceptions. + return; + } +}; + +// Provides an entry point into the application. +// +// This example performs asynchronous receive +// operation processing. +int main() +{ + // Create an instance of MessageQueue. Set its formatter. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Add an event handler for the ReceiveCompleted event. + myQueue->ReceiveCompleted += gcnew ReceiveCompletedEventHandler( MyNewQueue::MyReceiveCompleted ); + + // Begin the asynchronous receive operation. + myQueue->BeginReceive(); + MyNewQueue::signal->WaitOne(); + + // Do other work on the current thread. + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp new file mode 100644 index 00000000000..9a88b22ee3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.BeginReceive_noparms_combined/CPP/mqbeginreceive_noparms_wh.cpp @@ -0,0 +1,64 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; +using namespace System::Threading; + +ref class MyNewQueue +{ +public: + + // Provides an event handler for the ReceiveCompleted + // event. + static void MyReceiveCompleted( Object^ source, ReceiveCompletedEventArgs^ asyncResult ) + { + try + { + // Connect to the queue. + MessageQueue^ mq = dynamic_cast(source); + + // End the asynchronous receive operation. + mq->EndReceive( asyncResult->AsyncResult ); + + // Process the message here. + Console::WriteLine( "Message received." ); + } + catch ( MessageQueueException^ ) + { + // Handle sources of MessageQueueException. + } + // Handle other exceptions. + return; + } +}; + +// Provides an entry point into the application. +// +// This example performs asynchronous receive +// operation processing. +int main() +{ + // Create an instance of MessageQueue. Set its formatter. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Add an event handler for the ReceiveCompleted event. + myQueue->ReceiveCompleted += gcnew ReceiveCompletedEventHandler( MyNewQueue::MyReceiveCompleted ); + + // Define wait handles for multiple operations. + array^waitHandleArray = gcnew array(10); + for ( int i = 0; i < 10; i++ ) + { + // Begin asynchronous operations. + waitHandleArray[ i ] = myQueue->BeginReceive()->AsyncWaitHandle; + } + + // Specify to wait for all operations to return. + WaitHandle::WaitAll( waitHandleArray ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp new file mode 100644 index 00000000000..5bddf73fead --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Close/CPP/mqclose.cpp @@ -0,0 +1,76 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // Sends a message to a queue. + void SendMessage() + { + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Send a message to the queue. + myQueue->Send( "My message data1." ); + + // Explicitly release resources. + myQueue->Close(); + + // Attempt to reaquire resources. + myQueue->Send( "My message data2." ); + return; + } + + // Receives a message from a queue. + void ReceiveMessage() + { + // Connect to the a on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Set the formatter to indicate body contains an Order. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + try + { + // Receive and format the message. + Message^ myMessage1 = myQueue->Receive(); + Message^ myMessage2 = myQueue->Receive(); + } + catch ( MessageQueueException^ ) + { + // Handle sources of any MessageQueueException. + } + finally + { + // Free resources. + myQueue->Close(); + } + + return; + } +}; + + +// Provides an entry point into the application. +// This example closes a queue and frees its +// resources. +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send a message to a queue. + myNewQueue->SendMessage(); + + // Receive a message from a queue. + myNewQueue->ReceiveMessage(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp new file mode 100644 index 00000000000..6d9baa8ba17 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_PathTransactional/CPP/mqcreate_transactional.cpp @@ -0,0 +1,106 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // Creates public transactional queues and sends a + // message. + void CreatePublicTransactionalQueues() + { + + // Create and connect to a public message Queuing queue. + if ( !MessageQueue::Exists( ".\\newPublicTransQueue1" ) ) + { + + // Create the queue if it does not exist. + MessageQueue::Create( ".\\newPublicTransQueue1", true ); + } + + + // Connect to the queue. + MessageQueue^ myNewPublicQueue = gcnew MessageQueue( ".\\newPublicTransQueue1" ); + + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + + // Begin the transaction. + myTransaction->Begin(); + + // Send the message. + myNewPublicQueue->Send( "My Message Data.", myTransaction ); + + // Commit the transaction. + myTransaction->Commit(); + if ( !MessageQueue::Exists( ".\\newPublicTransQueue2" ) ) + { + + // Create (but do not connect to) second public queue + MessageQueue::Create( ".\\newPublicTransQueue2", true ); + } + + return; + } + + + // Creates private queues and sends a message. + void CreatePrivateTransactionalQueues() + { + + // Create and connect to a private Message Queuing queue. + if ( !MessageQueue::Exists( ".\\Private$\\newPrivTransQ1" ) ) + { + + // Create the queue if it does not exist. + MessageQueue^ myNewPrivateQueue = MessageQueue::Create( ".\\Private$\\newPrivTransQ1", true ); + } + + + // Connect to the queue. + MessageQueue^ myNewPrivateQueue = gcnew MessageQueue( ".\\Private$\\newPrivTransQ1" ); + + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + + // Begin the transaction. + myTransaction->Begin(); + + // Send the message. + myNewPrivateQueue->Send( "My Message Data.", myTransaction ); + + // Commit the transaction. + myTransaction->Commit(); + + // Create (but do not connect to) a second private queue. + if ( !MessageQueue::Exists( ".\\Private$\\newPrivTransQ2" ) ) + { + MessageQueue::Create( ".\\Private$\\newPrivTransQ2", true ); + } + + return; + } + +}; + + +// Provides an entry point into the application. +// This example creates new transactional queues. +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Create transactional queues. + myNewQueue->CreatePublicTransactionalQueues(); + myNewQueue->CreatePrivateTransactionalQueues(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp new file mode 100644 index 00000000000..f90ef5700fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Create_path/CPP/mqcreate.cpp @@ -0,0 +1,80 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// This example creates new public and private queues. +ref class MyNewQueue +{ +public: + void CreatePublicQueues() + { + + // Create and connect to a public Message Queuing queue. + if ( !MessageQueue::Exists( ".\\newPublicQueue" ) ) + { + + // Create the queue if it does not exist. + MessageQueue^ myNewPublicQueue = MessageQueue::Create( ".\\newPublicQueue" ); + + // Send a message to the queue. + myNewPublicQueue->Send( "My message data." ); + } + + + // Create (but do not connect to) a second public queue. + if ( !MessageQueue::Exists( ".\\newPublicResponseQueue" ) ) + { + MessageQueue::Create( ".\\newPublicResponseQueue" ); + } + + return; + } + + + // Creates private queues and sends a message. + void CreatePrivateQueues() + { + + // Create and connect to a private Message Queuing queue. + if ( !MessageQueue::Exists( ".\\Private$\\newPrivQueue" ) ) + { + + // Create the queue if it does not exist. + MessageQueue^ myNewPrivateQueue = MessageQueue::Create( ".\\Private$\\newPrivQueue" ); + + // Send a message to the queue. + myNewPrivateQueue->Send( "My message data." ); + } + + + // Create (but do not connect to) a second private queue. + if ( !MessageQueue::Exists( ".\\Private$\\newResponseQueue" ) ) + { + MessageQueue::Create( ".\\Private$\\newResponseQueue" ); + } + + return; + } + +}; + + +// Provides an entry point into the application. +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Create public and private queues. + myNewQueue->CreatePublicQueues(); + myNewQueue->CreatePrivateQueues(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp new file mode 100644 index 00000000000..6195578a276 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.DefaultPropertiesToSend/CPP/mqdefaultpropertiestosend.cpp @@ -0,0 +1,76 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // Associates selected message property values + // with high priority messages. + void SendHighPriorityMessages() + { + + // Connect to a message queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Associate selected default property values with high + // priority messages. + myQueue->DefaultPropertiesToSend->Priority = MessagePriority::High; + myQueue->DefaultPropertiesToSend->Label = "High Priority Message"; + myQueue->DefaultPropertiesToSend->Recoverable = true; + myQueue->DefaultPropertiesToSend->TimeToReachQueue = TimeSpan(0,0,30); + + // Send messages using these defaults. + myQueue->Send( "High priority message data 1." ); + myQueue->Send( "High priority message data 2." ); + myQueue->Send( "High priority message data 3." ); + return; + } + + + // Associates selected message property values + // with normal priority messages. + void SendNormalPriorityMessages() + { + + // Connect to a message queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Associate selected default property values with normal + // priority messages. + myQueue->DefaultPropertiesToSend->Priority = MessagePriority::Normal; + myQueue->DefaultPropertiesToSend->Label = "Normal Priority Message"; + myQueue->DefaultPropertiesToSend->Recoverable = false; + myQueue->DefaultPropertiesToSend->TimeToReachQueue = TimeSpan(0,2,0); + + // Send messages using these defaults. + myQueue->Send( "Normal priority message data 1." ); + myQueue->Send( "Normal priority message data 2." ); + myQueue->Send( "Normal priority message data 3." ); + return; + } + +}; + + +// Provides an entry point into the application. +// This example specifies different types of default +// properties for messages. +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send normal and high priority messages. + myNewQueue->SendNormalPriorityMessages(); + myNewQueue->SendHighPriorityMessages(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp new file mode 100644 index 00000000000..5f7ef619417 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ExistsDelete/CPP/mqexistsdelete.cpp @@ -0,0 +1,36 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +int main() +{ + + // Determine whether the queue exists. + if ( MessageQueue::Exists( ".\\myQueue" ) ) + { + try + { + + // Delete the queue. + MessageQueue::Delete( ".\\myQueue" ); + } + catch ( MessageQueueException^ e ) + { + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::AccessDenied ) + { + Console::WriteLine( "Access is denied. Queue might be a system queue." ); + } + + // Handle other sources of MessageQueueException. + } + + } + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp new file mode 100644 index 00000000000..2f0f3252ea6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageEnumerator/CPP/mqgetmessageenumerator.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + void CountLowestPriority() + { + + // Holds the count of Lowest priority messages. + UInt32 numberItems = 0; + + // Connect to a queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Get a cursor into the messages in the queue. + MessageEnumerator^ myEnumerator = myQueue->GetMessageEnumerator(); + + // Specify that the messages's priority should be read. + myQueue->MessageReadPropertyFilter->Priority = true; + + // Move to the next message and examine its priority. + while ( myEnumerator->MoveNext() ) + { + + // Increase the count if priority is Lowest. + if ( myEnumerator->Current->Priority == MessagePriority::Lowest ) + numberItems++; + } + + + // Display final count. + Console::WriteLine( "Lowest priority messages: {0}", numberItems ); + return; + } + +}; + +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Output the count of Lowest priority messages. + myNewQueue->CountLowestPriority(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp new file mode 100644 index 00000000000..fad785df5ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_criteria/CPP/mqgetmessagequeueenumerator_criteria.cpp @@ -0,0 +1,60 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // Iterates through message queues and displays the + // path of each queue that was created in the last + // day and that exists on the computer "MyComputer". + void ListPublicQueuesByCriteria() + { + UInt32 numberQueues = 0; + + // Specify the criteria to filter by. + MessageQueueCriteria^ myCriteria = gcnew MessageQueueCriteria; + myCriteria->MachineName = "MyComputer"; + myCriteria->CreatedAfter = DateTime::Now.Subtract( TimeSpan(1,0,0,0) ); + + // Get a cursor into the queues on the network. + MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator( myCriteria ); + + // Move to the next queue and read its path. + while ( myQueueEnumerator->MoveNext() ) + { + + // Increase the count if priority is Lowest. + Console::WriteLine( myQueueEnumerator->Current->Path ); + numberQueues++; + } + + + // Handle no queues matching the criteria. + if ( numberQueues == 0 ) + { + Console::WriteLine( "No public queues match criteria." ); + } + + return; + } + +}; + +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Output the count of Lowest priority messages. + myNewQueue->ListPublicQueuesByCriteria(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp new file mode 100644 index 00000000000..2b942b46c1f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetMessageQueueEnumerator_noparms/CPP/mqgetmessagequeueenumerator.cpp @@ -0,0 +1,54 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +//************************************************** +// Iterates through message queues and examines the +// path for each queue. Also displays the number of +// public queues on the network. +//************************************************** +void ListPublicQueues() +{ + + // Holds the count of private queues. + int numberQueues = 0; + + // Get a cursor into the queues on the network. + MessageQueueEnumerator^ myQueueEnumerator = MessageQueue::GetMessageQueueEnumerator(); + + // Move to the next queue and read its path. + while ( myQueueEnumerator->MoveNext() ) + { + + // Increase the count if priority is Lowest. + Console::WriteLine( myQueueEnumerator->Current->Path ); + numberQueues++; + } + + + // Display final count. + Console::WriteLine( "Number of public queues: {0}", numberQueues ); + return; +} + + +//************************************************** +// Provides an entry point into the application. +// +// This example uses a cursor to step through the +// message queues and list the public queues on the +// network. +//************************************************** +int main() +{ + + // Output the count of Lowest priority messages. + ListPublicQueues(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp new file mode 100644 index 00000000000..8092de2b7ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.GetQueueLists/CPP/mqgetqueuelists.cpp @@ -0,0 +1,155 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +using namespace System::Collections; +ref class MyNewQueue +{ +public: + + // Gets a list of queues with a specified category. + // Sends a broadcast message to all queues in that + // category. + void GetQueuesByCategory() + { + + // Get a list of queues with the specified category. + array^QueueList = MessageQueue::GetPublicQueuesByCategory( Guid(" {00000000-0000-0000-0000-000000000001}") ); + + // Send a broadcast message to each queue in the array. + IEnumerator^ myEnum = QueueList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MessageQueue^ queueItem = safe_cast(myEnum->Current); + queueItem->Send( "Broadcast message." ); + } + + return; + } + + + // Gets a list of queues with a specified label. + // Sends a broadcast message to all queues with that + // label. + void GetQueuesByLabel() + { + + // Get a list of queues with the specified label. + array^QueueList = MessageQueue::GetPublicQueuesByLabel( "My Label" ); + + // Send a broadcast message to each queue in the array. + IEnumerator^ myEnum = QueueList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MessageQueue^ queueItem = safe_cast(myEnum->Current); + queueItem->Send( "Broadcast message." ); + } + + return; + } + + + // Gets a list of queues on a specified computer. + // Displays the list on screen. + void GetQueuesByComputer() + { + + // Get a list of queues on the specified computer. + array^QueueList = MessageQueue::GetPublicQueuesByMachine( "MyComputer" ); + + // Display the paths of the queues in the list. + IEnumerator^ myEnum = QueueList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MessageQueue^ queueItem = safe_cast(myEnum->Current); + Console::WriteLine( queueItem->Path ); + } + + return; + } + + + // Gets a list of all public queues. + void GetAllPublicQueues() + { + + // Get a list of public queues. + array^QueueList = MessageQueue::GetPublicQueues(); + return; + } + + + // Gets a list of all public queues that match + // specified criteria. Displays the list on + // screen. + void GetPublicQueuesByCriteria() + { + + // Define criteria to filter the queues. + MessageQueueCriteria^ myCriteria = gcnew MessageQueueCriteria; + myCriteria->CreatedAfter = DateTime::Now.Subtract( TimeSpan(1,0,0,0) ); + myCriteria->ModifiedBefore = DateTime::Now; + myCriteria->MachineName = "."; + myCriteria->Label = "My Queue"; + + // Get a list of queues with that criteria. + array^QueueList = MessageQueue::GetPublicQueues( myCriteria ); + + // Display the paths of the queues in the list. + IEnumerator^ myEnum = QueueList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MessageQueue^ queueItem = safe_cast(myEnum->Current); + Console::WriteLine( queueItem->Path ); + } + + return; + } + + + // Gets a list of private queues on the local + // computer. Displays the list on screen. + void GetPrivateQueues() + { + + // Get a list of queues with the specified category. + array^QueueList = MessageQueue::GetPrivateQueuesByMachine( "." ); + + // Display the paths of the queues in the list. + IEnumerator^ myEnum = QueueList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MessageQueue^ queueItem = safe_cast(myEnum->Current); + Console::WriteLine( queueItem->Path ); + } + + return; + } + +}; + + +// Provides an entry point into the application. +// This example gets lists of queues by a variety +// of criteria. +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send normal and high priority messages. + myNewQueue->GetQueuesByCategory(); + myNewQueue->GetQueuesByLabel(); + myNewQueue->GetQueuesByComputer(); + myNewQueue->GetAllPublicQueues(); + myNewQueue->GetPublicQueuesByCriteria(); + myNewQueue->GetPrivateQueues(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp new file mode 100644 index 00000000000..4cd306bad02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.MessageReadPropertyFilter/CPP/mqmessagereadpropertyfilter.cpp @@ -0,0 +1,117 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + //************************************************* + // Retrieves the default properties for a Message. + //************************************************* + void RetrieveDefaultProperties() + { + // Connect to a message queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Specify to retrieve the default properties only. + myQueue->MessageReadPropertyFilter->SetDefaults(); + + // Set the formatter for the Message. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Receive the first message in the queue. + Message^ myMessage = myQueue->Receive(); + + // Display selected properties. + Console::WriteLine( "Label: {0}", myMessage->Label ); + Console::WriteLine( "Body: {0}", static_cast(myMessage->Body) ); + return; + } + + + //************************************************* + // Retrieves all properties for a Message. + //************************************************* + void RetrieveAllProperties() + { + // Connect to a message queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Specify to retrieve all properties. + myQueue->MessageReadPropertyFilter->SetAll(); + + // Set the formatter for the Message. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Receive the first message in the queue. + Message^ myMessage = myQueue->Receive(); + + // Display selected properties. + Console::WriteLine( "Encryption algorithm: {0}", myMessage->EncryptionAlgorithm.ToString() ); + Console::WriteLine( "Body: {0}", myMessage->Body ); + return; + } + + //************************************************* + // Retrieves application-specific properties for a + // Message. + //************************************************* + void RetrieveSelectedProperties() + { + // Connect to a message queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Specify to retrieve selected properties. + MessagePropertyFilter^ myFilter = gcnew MessagePropertyFilter; + myFilter->ClearAll(); + + // The following list is a random subset of available properties. + myFilter->Body = true; + myFilter->Label = true; + myFilter->MessageType = true; + myFilter->Priority = true; + myQueue->MessageReadPropertyFilter = myFilter; + + // Set the formatter for the Message. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Receive the first message in the queue. + Message^ myMessage = myQueue->Receive(); + + // Display selected properties. + Console::WriteLine( "Message type: {0}", myMessage->MessageType.ToString() ); + Console::WriteLine( "Priority: {0}", myMessage->Priority.ToString() ); + return; + } +}; + + +//************************************************* +// Provides an entry point into the application. +// +// This example retrieves specific groups of Message +// properties. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Retrieve specific sets of Message properties. + myNewQueue->RetrieveDefaultProperties(); + myNewQueue->RetrieveAllProperties(); + myNewQueue->RetrieveSelectedProperties(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp new file mode 100644 index 00000000000..34ef71be8b2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Path/CPP/mqpath.cpp @@ -0,0 +1,125 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // References public queues. + void SendPublic() + { + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + myQueue->Send( "Public queue by path name." ); + return; + } + + + // References private queues. + void SendPrivate() + { + MessageQueue^ myQueue = gcnew MessageQueue( ".\\Private$\\myQueue" ); + myQueue->Send( "Private queue by path name." ); + return; + } + + + // References queues by label. + void SendByLabel() + { + MessageQueue^ myQueue = gcnew MessageQueue( "Label:TheLabel" ); + myQueue->Send( "Queue by label." ); + return; + } + + + // References queues by format name. + void SendByFormatName() + { + MessageQueue^ myQueue = gcnew MessageQueue( "FormatName:Public=5A5F7535-AE9A-41d4 -935C-845C2AFF7112" ); + myQueue->Send( "Queue by format name." ); + return; + } + + + // References computer journal queues. + void MonitorComputerJournal() + { + MessageQueue^ computerJournal = gcnew MessageQueue( ".\\Journal$" ); + while ( true ) + { + Message^ journalMessage = computerJournal->Receive(); + + // Process the journal message. + } + } + + + // References queue journal queues. + void MonitorQueueJournal() + { + MessageQueue^ queueJournal = gcnew MessageQueue( ".\\myQueue\\Journal$" ); + while ( true ) + { + Message^ journalMessage = queueJournal->Receive(); + + // Process the journal message. + } + } + + + // References dead-letter queues. + void MonitorDeadLetter() + { + MessageQueue^ deadLetter = gcnew MessageQueue( ".\\DeadLetter$" ); + while ( true ) + { + Message^ deadMessage = deadLetter->Receive(); + + // Process the dead-letter message. + } + } + + + // References transactional dead-letter queues. + void MonitorTransactionalDeadLetter() + { + MessageQueue^ TxDeadLetter = gcnew MessageQueue( ".\\XactDeadLetter$" ); + while ( true ) + { + Message^ txDeadLetter = TxDeadLetter->Receive(); + + // Process the transactional dead-letter message. + } + } + +}; + + +//************************************************* +// Provides an entry point into the application. +// +// This example demonstrates several ways to set +// a queue's path. +//************************************************* +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + myNewQueue->SendPublic(); + myNewQueue->SendPrivate(); + myNewQueue->SendByLabel(); + myNewQueue->SendByFormatName(); + myNewQueue->MonitorComputerJournal(); + myNewQueue->MonitorQueueJournal(); + myNewQueue->MonitorDeadLetter(); + myNewQueue->MonitorTransactionalDeadLetter(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp new file mode 100644 index 00000000000..15915890bde --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_noparms/CPP/mqpeek_noparms.cpp @@ -0,0 +1,127 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// This class represents an object the following example +// sends to a queue and receives from a queue. +ref class Order +{ +public: + int orderId; + DateTime orderTime; +}; + + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ +public: + + //************************************************* + // Posts a notification when a message arrives in + // the queue S"monitoredQueue". Does not retrieve any + // message information when peeking the message. + //************************************************* + void NotifyArrived() + { + // Connect to a queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\monitoredQueue" ); + + // Specify to retrieve no message information. + myQueue->MessageReadPropertyFilter->ClearAll(); + + // Wait for a message to arrive. + Message^ emptyMessage = myQueue->Peek(); + + // Post a notification when a message arrives. + Console::WriteLine( "A message has arrived in the queue." ); + return; + } + + + //************************************************* + // Sends an Order to a queue. + //************************************************* + void SendMessage() + { + // Create a new order and set values. + Order^ sentOrder = gcnew Order; + sentOrder->orderId = 3; + sentOrder->orderTime = DateTime::Now; + + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Send the Order to the queue. + myQueue->Send( sentOrder ); + return; + } + + //************************************************* + // Peeks a message containing an Order. + //************************************************* + void PeekFirstMessage() + { + // Connect to a queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Set the formatter to indicate the body contains an Order. + array^p = gcnew array(1); + p[ 0 ] = Order::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + try + { + // Peek and format the message. + Message^ myMessage = myQueue->Peek(); + Order^ myOrder = static_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( "Order ID: {0}", myOrder->orderId ); + Console::WriteLine( "Sent: {0}", myOrder->orderTime ); + } + catch ( MessageQueueException^ ) + { + // Handle Message Queuing exceptions. + } + // Handle invalid serialization format. + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( e->Message ); + } + + // Catch other exceptions as necessary. + return; + } +}; + +//************************************************* +// Provides an entry point into the application. +// +// This example posts a notification that a message +// has arrived in a queue. It sends a message +// containing an other to a separate queue, and then +// peeks the first message in the queue. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Wait for a message to arrive in the queue. + myNewQueue->NotifyArrived(); + + // Send a message to a queue. + myNewQueue->SendMessage(); + + // Peek the first message in the queue. + myNewQueue->PeekFirstMessage(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp new file mode 100644 index 00000000000..25b765ab949 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Peek_timeout/CPP/mqpeek_timeout.cpp @@ -0,0 +1,73 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + //************************************************* + // Determines whether a queue is empty. The Peek() + // method throws an exception if there is no message + // in the queue. This method handles that exception + // by returning true to the calling method. + //************************************************* + bool IsQueueEmpty() + { + bool isQueueEmpty = false; + + // Connect to a queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + try + { + + // Set Peek to return immediately. + myQueue->Peek( TimeSpan(0) ); + + // If an IOTime->Item[Out] was* not thrown, there is a message + // in the queue. + isQueueEmpty = false; + } + catch ( MessageQueueException^ e ) + { + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) + { + + // No message was in the queue. + isQueueEmpty = true; + } + + + // Handle other sources of MessageQueueException. + } + + + // Handle other exceptions as necessary. + // Return true if there are no messages in the queue. + return isQueueEmpty; + } + +}; + + +//************************************************* +// Provides an entry point into the application. +// +// This example determines whether a queue is empty. +//************************************************* +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Determine whether a queue is empty. + bool isQueueEmpty = myNewQueue->IsQueueEmpty(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp new file mode 100644 index 00000000000..693998fa995 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ReceiveCompleted/CPP/mqreceivecompletedeventhandler.cpp @@ -0,0 +1,58 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + //************************************************* + // Provides an event handler for the ReceiveCompleted + // event. + //************************************************* + static void MyReceiveCompleted( Object^ source, ReceiveCompletedEventArgs^ asyncResult ) + { + // Connect to the queue. + MessageQueue^ mq = dynamic_cast(source); + + // End the asynchronous Receive operation. + Message^ m = mq->EndReceive( asyncResult->AsyncResult ); + + // Display message information on the screen. + Console::WriteLine( "Message: {0}", m->Body ); + + // Restart the asynchronous Receive operation. + mq->BeginReceive(); + return; + } +}; + + +//************************************************* +// Provides an entry point into the application. +// +// This example performs asynchronous receive operation +// processing. +//************************************************* +int main() +{ + // Create an instance of MessageQueue. Set its formatter. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Add an event handler for the ReceiveCompleted event. + myQueue->ReceiveCompleted += gcnew ReceiveCompletedEventHandler( MyNewQueue::MyReceiveCompleted ); + + // Begin the asynchronous receive operation. + myQueue->BeginReceive(); + + // Do other work on the current thread. + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp new file mode 100644 index 00000000000..9ef51936eb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_TimeoutTransaction/CPP/mqreceive_timeouttransaction.cpp @@ -0,0 +1,121 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ +public: + + //************************************************* + // Sends a message to a transactional queue. + //************************************************* + void SendMessageTransactional() + { + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); + + // Send a message to the queue. + if ( myQueue->Transactional) + { + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + + // Begin the transaction. + myTransaction->Begin(); + + // Send the message. + myQueue->Send( "My Message Data.", myTransaction ); + + // Commit the transaction. + myTransaction->Commit(); + } + + return; + } + + //************************************************* + // Receives a message from the transactional queue. + //************************************************* + void ReceiveMessageTransactional() + { + // Connect to a transactional queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); + + // Set the formatter. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + try + { + // Begin the transaction. + myTransaction->Begin(); + + // Receive the message. + // Wait five seconds for a message to arrive. + Message^ myMessage = myQueue->Receive( TimeSpan(0,0,5), myTransaction ); + String^ myOrder = static_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( myOrder ); + + // Commit the transaction. + myTransaction->Commit(); + } + catch ( MessageQueueException^ e ) + { + // Handle nontransactional queues. + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::TransactionUsage ) + { + Console::WriteLine( "Queue is not transactional." ); + } + // Handle no message arriving in the queue. + else + + // Handle no message arriving in the queue. + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) + { + Console::WriteLine( "No message in queue." ); + } + + // Else catch other sources of MessageQueueException. + // Roll back the transaction. + myTransaction->Abort(); + } + + // Catch other exceptions as necessary, such as + // InvalidOperationException, thrown when the formatter + // cannot deserialize the message. + return; + } +}; + +//************************************************* +// Provides an entry point into the application. +// +// This example sends and receives a message from +// a transactional queue. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send a message to a queue. + myNewQueue->SendMessageTransactional(); + + // Receive a message from a queue. + myNewQueue->ReceiveMessageTransactional(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp new file mode 100644 index 00000000000..ab3720fe0ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_noparms/CPP/mqreceive_noparms.cpp @@ -0,0 +1,100 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// This class represents an object the following example +// sends to a queue and receives from a queue. +ref class Order +{ +public: + int orderId; + DateTime orderTime; +}; + + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ +public: + + //************************************************* + // Sends an Order to a queue. + //************************************************* + void SendMessage() + { + // Create a new order and set values. + Order^ sentOrder = gcnew Order; + sentOrder->orderId = 3; + sentOrder->orderTime = DateTime::Now; + + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Send the Order to the queue. + myQueue->Send( sentOrder ); + return; + } + + //************************************************* + // Receives a message containing an Order. + //************************************************* + void ReceiveMessage() + { + // Connect to the a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Set the formatter to indicate body contains an Order. + array^p = gcnew array(1); + p[ 0 ] = Order::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + try + { + // Receive and format the message. + Message^ myMessage = myQueue->Receive(); + Order^ myOrder = static_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( "Order ID: {0}", myOrder->orderId ); + Console::WriteLine( "Sent: {0}", myOrder->orderTime ); + } + catch ( MessageQueueException^ ) + { + // Handle Message Queuing exceptions. + } + // Handle invalid serialization format. + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( e->Message ); + } + + // Catch other exceptions as necessary. + return; + } +}; + +//************************************************* +// Provides an entry point into the application. +// +// This example sends and receives a message from +// a queue. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send a message to a queue. + myNewQueue->SendMessage(); + + // Receive a message from a queue. + myNewQueue->ReceiveMessage(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp new file mode 100644 index 00000000000..eedcb107410 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_timeout/CPP/mqreceive_timeout.cpp @@ -0,0 +1,85 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// This class represents an object the following example +// receives from a queue. +ref class Order +{ +public: + int orderId; + DateTime orderTime; +}; + + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ +public: + + //************************************************* + // Receives a message containing an Order. + //************************************************* + void ReceiveMessage() + { + // Connect to the a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Set the formatter to indicate body contains an Order. + array^p = gcnew array(1); + p[ 0 ] = Order::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + try + { + // Receive and format the message. + // Wait 5 seconds for a message to arrive. + Message^ myMessage = myQueue->Receive( TimeSpan(0,0,5) ); + Order^ myOrder = static_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( "Order ID: {0}", myOrder->orderId ); + Console::WriteLine( "Sent: {0}", myOrder->orderTime ); + } + catch ( MessageQueueException^ e ) + { + // Handle no message arriving in the queue. + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::IOTimeout ) + { + Console::WriteLine( "No message arrived in queue." ); + } + + // Handle other sources of a MessageQueueException. + } + // Handle invalid serialization format. + catch ( InvalidOperationException^ e ) + { + Console::WriteLine( e->Message ); + } + + // Catch other exceptions as necessary. + return; + } +}; + +//************************************************* +// Provides an entry point into the application. +// +// This example receives a message from a queue. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Receive a message from a queue. + myNewQueue->ReceiveMessage(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp new file mode 100644 index 00000000000..1e1f1b67acc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Receive_transaction/CPP/mqreceive_transaction.cpp @@ -0,0 +1,113 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ +public: + + //************************************************* + // Sends a message to a queue. + //************************************************* + void SendMessageTransactional() + { + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); + + // Send a message to the queue. + if ( myQueue->Transactional ) + { + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + + // Begin the transaction. + myTransaction->Begin(); + + // Send the message. + myQueue->Send( "My Message Data.", myTransaction ); + + // Commit the transaction. + myTransaction->Commit(); + } + + return; + } + + + //************************************************* + // Receives a message containing an Order. + //************************************************* + void ReceiveMessageTransactional() + { + // Connect to a transactional queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); + + // Set the formatter. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + try + { + // Begin the transaction. + myTransaction->Begin(); + + // Receive the message. + Message^ myMessage = myQueue->Receive( myTransaction ); + String^ myOrder = static_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( myOrder ); + + // Commit the transaction. + myTransaction->Commit(); + } + catch ( MessageQueueException^ e ) + { + // Handle nontransactional queues. + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::TransactionUsage ) + { + Console::WriteLine( "Queue is not transactional." ); + } + + // Else catch other sources of a MessageQueueException. + // Roll back the transaction. + myTransaction->Abort(); + } + + // Catch other exceptions as necessary, such as + // InvalidOperationException, thrown when the formatter + // cannot deserialize the message. + return; + } +}; + +//************************************************* +// Provides an entry point into the application. +// +// This example sends and receives a message from +// a transactional queue. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send a message to a queue. + myNewQueue->SendMessageTransactional(); + + // Receive a message from a queue. + myNewQueue->ReceiveMessageTransactional(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp new file mode 100644 index 00000000000..ec84a775eb9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_ObjectTransaction/CPP/mqsend_objtransaction.cpp @@ -0,0 +1,113 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +/// +/// Provides a container class for the example. +/// +ref class MyNewQueue +{ +public: + + //************************************************* + // Sends a message to a queue. + //************************************************* + void SendMessageTransactional() + { + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); + + // Send a message to the queue. + if ( myQueue->Transactional ) + { + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + + // Begin the transaction. + myTransaction->Begin(); + + // Send the message. + myQueue->Send( "My Message Data.", myTransaction ); + + // Commit the transaction. + myTransaction->Commit(); + } + + return; + } + + + //************************************************* + // Receives a message containing an Order. + //************************************************* + void ReceiveMessageTransactional() + { + // Connect to a transactional queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myTransactionalQueue" ); + + // Set the formatter. + array^p = gcnew array(1); + p[ 0 ] = String::typeid; + myQueue->Formatter = gcnew XmlMessageFormatter( p ); + + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + try + { + // Begin the transaction. + myTransaction->Begin(); + + // Receive the message. + Message^ myMessage = myQueue->Receive( myTransaction ); + String^ myOrder = static_cast(myMessage->Body); + + // Display message information. + Console::WriteLine( myOrder ); + + // Commit the transaction. + myTransaction->Commit(); + } + catch ( MessageQueueException^ e ) + { + // Handle nontransactional queues. + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::TransactionUsage ) + { + Console::WriteLine( "Queue is not transactional." ); + } + + // Else catch other sources of MessageQueueException. + // Roll back the transaction. + myTransaction->Abort(); + } + + // Catch other exceptions as necessary, such as + // InvalidOperationException, thrown when the formatter + // cannot deserialize the message. + return; + } +}; + +//************************************************* +// Provides an entry point into the application. +// +// This example sends and receives a message from +// a transactional queue. +//************************************************* +int main() +{ + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send a message to a queue. + myNewQueue->SendMessageTransactional(); + + // Receive a message from a queue. + myNewQueue->ReceiveMessageTransactional(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp new file mode 100644 index 00000000000..2398aece90c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.Send_obj/CPP/mqsend_generic.cpp @@ -0,0 +1,55 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + void SendMessage() + { + + // Connect to a queue on the local computer. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" ); + + // Send a message to the queue. + if ( myQueue->Transactional ) + { + + // Create a transaction. + MessageQueueTransaction^ myTransaction = gcnew MessageQueueTransaction; + + // Begin the transaction. + myTransaction->Begin(); + + // Send the message. + myQueue->Send( "My Message Data.", myTransaction ); + + // Commit the transaction. + myTransaction->Commit(); + } + else + { + myQueue->Send( "My Message Data." ); + } + + return; + } + +}; + +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Send a message to a queue. + myNewQueue->SendMessage(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp new file mode 100644 index 00000000000..c09921d9b5b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue.ctor_PathSharedModeDenyReceive/CPP/mqctor_denysharedreceive.cpp @@ -0,0 +1,63 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Messaging; +ref class MyNewQueue +{ +public: + + // Requests exlusive read access to the queue. If + // access is granted, receives a message from the + // queue. + void GetExclusiveAccess() + { + try + { + + // Request exclusive read access to the queue. + MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue",true ); + + // Receive a message. This is where SharingViolation + // exceptions would be thrown. + Message^ myMessage = myQueue->Receive(); + } + catch ( MessageQueueException^ e ) + { + + // Handle request for denial of exclusive read access. + if ( e->MessageQueueErrorCode == MessageQueueErrorCode::SharingViolation ) + { + Console::WriteLine( "Denied exclusive read access" ); + } + + + // Handle other sources of a MessageQueueException. + } + + + // Handle other exceptions as necessary. + return; + } + +}; + + +// Provides an entry point into the application. +// This example connects to a message queue, and +// requests exclusive read access to the queue. +int main() +{ + + // Create a new instance of the class. + MyNewQueue^ myNewQueue = gcnew MyNewQueue; + + // Output the count of Lowest priority messages. + myNewQueue->GetExclusiveAccess(); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp new file mode 100644 index 00000000000..5293d6d567a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue2/cpp/class1.cpp @@ -0,0 +1,1101 @@ +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +static void CreateQueue(String^ queuePath, bool transactional) +{ + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +void SendObjectString() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label"); + + queue->Close(); + + // +} + +void SendObjectTransactionType() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, MessageQueueTransactionType::Single); + + queue->Close(); + + // +} + +void SendObjectStringTransactionType() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label", + MessageQueueTransactionType::Single); + + queue->Close(); + + // +} + +void SendObjectStringTransaction() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Create a message queuing transaction. + MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); + + try + { + // Begin a transaction. + transaction->Begin(); + + // Send the message to the queue. + queue->Send(msg, "Example Message Label", transaction); + + // Commit the transaction. + transaction->Commit(); + } + catch (Exception^ ex) + { + // Cancel the transaction. + transaction->Abort(); + + // Propagate the exception. + throw ex; + } + finally + { + // Dispose of the transaction object. + delete transaction; + queue->Close(); + } + + // +} + +void PeekByCorrelationIdStringTimespan() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Designate a queue to receive the acknowledgement message for this + // message. + msg->AdministrationQueue = + gcnew MessageQueue(".\\exampleAdminQueue"); + + // Set the message to generate an acknowledgement message upon its + // arrival. + msg->AcknowledgeType = AcknowledgeTypes::PositiveArrival; + + // Send the message. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + // Connect to the admin queue. + MessageQueue^ adminQueue = + gcnew MessageQueue(".\\exampleAdminQueue"); + + // Set the admin queue's MessageReadPropertyFilter property to ensure + // that the acknowledgement message includes the desired properties. + adminQueue->MessageReadPropertyFilter->Acknowledgment = true; + adminQueue->MessageReadPropertyFilter->CorrelationId = true; + + // Peek at the acknowledgement message. + Message^ ackMsg = adminQueue->PeekByCorrelationId(id, + TimeSpan::FromSeconds(10.0)); + + // Display the acknowledgement message's property values. + Console::WriteLine("Message.Label: {0}", ackMsg->Label); + Console::WriteLine("Message.Acknowledgment: {0}", + ackMsg->Acknowledgment); + Console::WriteLine("Message.CorrelationId: {0}", ackMsg->CorrelationId); + + adminQueue->Close(); + queue->Close(); + + // +} + +void PeekByIdString() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Peek at the message. + msg = queue->PeekById(id); + + queue->Close(); + + // +} + +void PeekByIdStringTimespan() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Peek at the message. + msg = queue->PeekById(id, TimeSpan::FromSeconds(10.0)); + + queue->Close(); + + // +} + +void ReceiveTimespanTransactionType() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, MessageQueueTransactionType::Single); + + // Set the formatter to indicate the message body contains a String. + queue->Formatter = gcnew XmlMessageFormatter( + gcnew array{String::typeid}); + + // Receive the message from the queue. Because the Id of the message + // is not specified, it might not be the message just sent. + msg = queue->Receive(TimeSpan::FromSeconds(10.0), + MessageQueueTransactionType::Single); + + queue->Close(); + + // +} + +void ReceiveTransactionType() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, MessageQueueTransactionType::Single); + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Set the formatter to indicate the message body contains a String. + queue->Formatter = gcnew XmlMessageFormatter( + gcnew array{String::typeid}); + + // Receive the message from the queue. Because the Id of the message + // , it might not be the message just sent. + msg = queue->Receive(MessageQueueTransactionType::Single); + + queue->Close(); + + // +} + +void ReceiveByCorrelationIdStringTimespan() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Designate a queue to receive the acknowledgement message for this + // message. + msg->AdministrationQueue = + gcnew MessageQueue(".\\exampleAdminQueue"); + + // Set the message to generate an acknowledgement message upon its + // arrival. + msg->AcknowledgeType = AcknowledgeTypes::PositiveArrival; + + // Send the message. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + // Connect to the admin queue. + MessageQueue^ adminQueue = + gcnew MessageQueue(".\\exampleAdminQueue"); + + // Set the admin queue's MessageReadPropertyFilter property to ensure + // that the acknowledgement message includes the desired properties. + adminQueue->MessageReadPropertyFilter->Acknowledgment = true; + adminQueue->MessageReadPropertyFilter->CorrelationId = true; + + // Receive the acknowledgement message from the admin queue. + Message^ ackMsg = adminQueue->ReceiveByCorrelationId(id, + TimeSpan::FromSeconds(10.0)); + + // Display the acknowledgement message's property values. + Console::WriteLine("Message.Label: {0}", ackMsg->Label); + Console::WriteLine("Message.Acknowledgment: {0}", + ackMsg->Acknowledgment); + Console::WriteLine("Message.CorrelationId: {0}", ackMsg->CorrelationId); + + adminQueue->Close(); + queue->Close(); + + // +} + +void ReceiveByCorrelationIdStringTransactionType() +{ + // + + // Connect to a nontransactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message to the nontransactional queue. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the nontransactional queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + // Connect to a transactional queue on the local computer. + MessageQueue^ transQueue = + gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message in response to the original message. + Message^ responseMsg = gcnew Message("Example Response Message Body"); + + // Set the response message's CorrelationId property value to the Id + // property value of the original message. + responseMsg->CorrelationId = id; + + // Send the response message to the transactional queue. + transQueue->Send(responseMsg, "Example Response Message Label", + MessageQueueTransactionType::Single); + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Set the transactional queue's MessageReadPropertyFilter property to + // ensure that the response message includes the desired properties. + transQueue->MessageReadPropertyFilter->CorrelationId = true; + + // Receive the response message from the transactional queue. + responseMsg = transQueue->ReceiveByCorrelationId(id, + MessageQueueTransactionType::Single); + + // Display the response message's property values. + Console::WriteLine("Message.Label: {0}", responseMsg->Label); + Console::WriteLine("Message.CorrelationId: {0}", + responseMsg->CorrelationId); + + transQueue->Close(); + queue->Close(); + + // +} + +void ReceiveByCorrelationIdStringTimespanTransactionType() +{ + // + + // Connect to a nontransactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message to the nontransactional queue. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the nontransactional queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + // Connect to a transactional queue on the local computer. + MessageQueue^ transQueue = + gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message in response to the original message. + Message^ responseMsg = gcnew Message("Example Response Message Body"); + + // Set the response message's CorrelationId property value to the Id + // property value of the original message. + responseMsg->CorrelationId = id; + + // Send the response message to the transactional queue. + transQueue->Send(responseMsg, "Example Response Message Label", + MessageQueueTransactionType::Single); + + // Set the transactional queue's MessageReadPropertyFilter property to + // ensure that the response message includes the desired properties. + transQueue->MessageReadPropertyFilter->CorrelationId = true; + + // Receive the response message from the transactional queue. + responseMsg = transQueue->ReceiveByCorrelationId(id, + TimeSpan::FromSeconds(10.0), MessageQueueTransactionType::Single); + + // Display the response message's property values. + Console::WriteLine("Message.Label: {0}", responseMsg->Label); + Console::WriteLine("Message.CorrelationId: {0}", + responseMsg->CorrelationId); + + transQueue->Close(); + queue->Close(); + + // +} + +void ReceiveByCorrelationIdStringTimespanTransaction() +{ + // + + // Connect to a nontransactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message to the nontransactional queue. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the nontransactional queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + // Connect to a transactional queue on the local computer. + MessageQueue^ transQueue = + gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message in response to the original message. + Message^ responseMsg = gcnew Message("Example Response Message Body"); + + // Set the response message's CorrelationId property value to the Id + // property value of the original message. + responseMsg->CorrelationId = id; + + // Send the response message to the transactional queue. + transQueue->Send(responseMsg, "Example Response Message Label", + MessageQueueTransactionType::Single); + + // Set the transactional queue's MessageReadPropertyFilter property to + // ensure that the response message includes the desired properties. + transQueue->MessageReadPropertyFilter->CorrelationId = true; + + // Create a message queuing transaction. + MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); + + try + { + // Begin a transaction. + transaction->Begin(); + + // Receive the response message from the transactional queue. + responseMsg = transQueue->ReceiveByCorrelationId(id, + TimeSpan::FromSeconds(10.0), transaction); + + // Commit the transaction. + transaction->Commit(); + } + catch (Exception^ ex) + { + // Cancel the transaction. + transaction->Abort(); + + // Propagate the exception. + throw ex; + } + finally + { + // Dispose of the transaction object. + delete transaction; + transQueue->Close(); + queue->Close(); + } + + // Display the response message's property values. + Console::WriteLine("Message.Label: {0}", responseMsg->Label); + Console::WriteLine("Message.CorrelationId: {0}", + responseMsg->CorrelationId); + + // +} + +void ReceiveByCorrelationIdStringTransaction() +{ + // + + // Connect to a nontransactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message to the nontransactional queue. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the nontransactional queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + // Connect to a transactional queue on the local computer. + MessageQueue^ transQueue = + gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message in response to the original message. + Message^ responseMsg = gcnew Message("Example Response Message Body"); + + // Set the response message's CorrelationId property value to the Id + // property value of the original message. + responseMsg->CorrelationId = id; + + // Send the response message to the transactional queue. + transQueue->Send(responseMsg, "Example Response Message Label", + MessageQueueTransactionType::Single); + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Set the transactional queue's MessageReadPropertyFilter property to + // ensure that the response message includes the desired properties. + transQueue->MessageReadPropertyFilter->CorrelationId = true; + + // Create a message queuing transaction. + MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); + + try + { + // Begin a transaction. + transaction->Begin(); + + // Receive the response message from the transactional queue. + responseMsg = transQueue->ReceiveByCorrelationId(id, transaction); + + // Commit the transaction. + transaction->Commit(); + } + catch (Exception^ ex) + { + // Cancel the transaction. + transaction->Abort(); + + // Propagate the exception. + throw ex; + } + finally + { + // Dispose of the transaction object. + delete transaction; + transQueue->Close(); + queue->Close(); + } + + // Display the response message's property values. + Console::WriteLine("Message.Label: {0}", responseMsg->Label); + Console::WriteLine("Message.CorrelationId: {0}", + responseMsg->CorrelationId); + + // +} + +void ReceiveByIdStringTransactionType() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label", + MessageQueueTransactionType::Single); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Receive the message from the queue. + msg = queue->ReceiveById(id, MessageQueueTransactionType::Single); + + queue->Close(); + + // +} + +void ReceiveByIdString() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Receive the message from the queue. + msg = queue->ReceiveById(id); + + queue->Close(); + + // +} + +void ReceiveByIdStringTransaction() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label", + MessageQueueTransactionType::Single); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Simulate doing other work so the message has time to arrive. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + // Create a message queuing transaction. + MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); + + try + { + // Begin a transaction. + transaction->Begin(); + + // Receive the message from the queue. + msg = queue->ReceiveById(id, transaction); + + // Commit the transaction. + transaction->Commit(); + } + catch (Exception^ ex) + { + // Cancel the transaction. + transaction->Abort(); + + // Propagate the exception. + throw ex; + } + finally + { + // Dispose of the transaction object. + delete transaction; + queue->Close(); + } + + // +} + +void ReceiveByIdStringTimespanTransaction() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label", + MessageQueueTransactionType::Single); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Create a message queuing transaction. + MessageQueueTransaction^ transaction = gcnew MessageQueueTransaction(); + + try + { + // Begin a transaction. + transaction->Begin(); + + // Receive the message from the queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0), + transaction); + + // Commit the transaction. + transaction->Commit(); + } + catch (Exception^ ex) + { + // Cancel the transaction. + transaction->Abort(); + + // Propagate the exception. + throw ex; + } + finally + { + // Dispose of the transaction object. + delete transaction; + queue->Close(); + } + + // +} + +void ReceiveByIdStringTimespanTransactionType() +{ + // + + // Connect to a transactional queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleTransQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label", + MessageQueueTransactionType::Single); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0), + MessageQueueTransactionType::Single); + + queue->Close(); + + // +} + +void ReceiveByIdStringTimespan() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new message. + Message^ msg = gcnew Message("Example Message Body"); + + // Send the message. + queue->Send(msg, "Example Message Label"); + + // Get the message's Id property value. + String^ id = msg->Id; + + // Receive the message from the queue. + msg = queue->ReceiveById(id, TimeSpan::FromSeconds(10.0)); + + queue->Close(); + + // +} + +void GetAllMessages() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Populate an array with copies of all the messages in the queue. + array^ msgs = queue->GetAllMessages(); + + // Loop through the messages. + for each(Message^ msg in msgs) + { + // Display the label of each message. + Console::WriteLine(msg->Label); + } + + queue->Close(); + + // +} + +void GetEnumerator() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Get an IEnumerator object. + System::Collections::IEnumerator^ enumerator = + queue->GetMessageEnumerator2(); + + // Use the IEnumerator object to loop through the messages. + while(enumerator->MoveNext()) + { + // Get a message from the enumerator. + Message^ msg = (Message^)enumerator->Current; + + // Display the label of the message. + Console::WriteLine(msg->Label); + } + + queue->Close(); + + // +} + +void SetPermissionsStringAccessRights() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Grant all users in the "Everyone" user group the right to receive + // messages from the queue. + queue->SetPermissions("Everyone", + MessageQueueAccessRights::ReceiveMessage); + + queue->Close(); + + // +} + +void SetPermissionsAccessControlEntry() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new trustee to represent the "Everyone" user group. + Trustee^ tr = gcnew Trustee("Everyone"); + + // Create a MessageQueueAccessControlEntry, granting the trustee the + // right to receive messages from the queue. + MessageQueueAccessControlEntry^ entry = gcnew + MessageQueueAccessControlEntry( + tr, MessageQueueAccessRights::ReceiveMessage, + AccessControlEntryType::Allow); + + // Apply the MessageQueueAccessControlEntry to the queue. + queue->SetPermissions(entry); + + queue->Close(); + + // +} + +void SetPermissionsStringAccessRightsAccessControlEntryType() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Grant all users in the "Everyone" user group the right to receive + // messages from the queue. + queue->SetPermissions("Everyone", + MessageQueueAccessRights::ReceiveMessage, + AccessControlEntryType::Allow); + + queue->Close(); + + // +} + +void SetPermissionsAccessControlList() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create an AccessControlList. + AccessControlList^ list = gcnew AccessControlList(); + + // Create a new trustee to represent the "Everyone" user group. + Trustee^ tr = gcnew Trustee("Everyone"); + + // Create an AccessControlEntry, granting the trustee read access to + // the queue. + AccessControlEntry^ entry = gcnew AccessControlEntry( + tr, GenericAccessRights::Read, + StandardAccessRights::Read, + AccessControlEntryType::Allow); + + // Add the AccessControlEntry to the AccessControlList. + list->Add(entry); + + // Apply the AccessControlList to the queue. + queue->SetPermissions(list); + + queue->Close(); + + // +} + +void ResetPermissions() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Reset the queue's permission list to its default values. + queue->ResetPermissions(); + + queue->Close(); + + // +} + +void Refresh() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Refresh the queue's property values to obtain its current state. + queue->Refresh(); + + queue->Close(); + + // +} + +void Purge() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Delete all messages from the queue. + queue->Purge(); + + queue->Close(); + + // +} + +void main() +{ + try + { + // Create a nontransactional queue on the local computer. + // Note that the queue might not be immediately accessible, and + // therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send a + // message to the newly created queue. + CreateQueue(".\\exampleQueue", false); + + // Create a nontransactional queue on the local computer. This + // queue will be used to receive acknowledgement messages. + CreateQueue(".\\exampleAdminQueue", false); + + // Create a transactional queue on the local computer. + CreateQueue(".\\exampleTransQueue", true); + + // Send a message to a queue. + SendObjectString(); + + // Send a message to a transactional queue. + SendObjectTransactionType(); + + // Send a message to a transactional queue. + SendObjectStringTransactionType(); + + // Send a message to a transactional queue. + SendObjectStringTransaction(); + + // Demonstrate PeekById. + PeekByIdString(); + + // Demonstrate PeekById. + PeekByIdStringTimespan(); + + // Demonstrate PeekByCorrelationId. + PeekByCorrelationIdStringTimespan(); + + // Receive a message from a transactional queue. + ReceiveTimespanTransactionType(); + + // Receive a message from a transactional queue. + ReceiveTransactionType(); + + // Demonstrate ReceiveByCorrelationId. + ReceiveByCorrelationIdStringTimespan(); + + // Demonstrate ReceiveByCorrelationId. + ReceiveByCorrelationIdStringTransactionType(); + + // Demonstrate ReceiveByCorrelationId. + ReceiveByCorrelationIdStringTimespanTransactionType(); + + // Demonstrate ReceiveByCorrelationId. + ReceiveByCorrelationIdStringTimespanTransaction(); + + // Demonstrate ReceiveByCorrelationId. + ReceiveByCorrelationIdStringTransaction(); + + // Demonstrate ReceiveById. + ReceiveByIdStringTransactionType(); + + // Demonstrate ReceiveById. + ReceiveByIdString(); + + // Demonstrate ReceiveById. + ReceiveByIdStringTransaction(); + + // Demonstrate ReceiveById. + ReceiveByIdStringTimespanTransaction(); + + // Demonstrate ReceiveById. + ReceiveByIdStringTimespanTransactionType(); + + // Demonstrate ReceiveById. + ReceiveByIdStringTimespan(); + + // Demonstrate GetAllMessages. + GetAllMessages(); + + // Demonstrate GetEnumerator. + GetEnumerator(); + + // Demonstrate SetPermissions. + SetPermissionsStringAccessRights(); + + // Demonstrate SetPermissions. + SetPermissionsAccessControlEntry(); + + // Demonstrate SetPermissions. + SetPermissionsStringAccessRightsAccessControlEntryType(); + + // Demonstrate SetPermissions. + SetPermissionsAccessControlList(); + + // Demonstrate ResetPermissions. + ResetPermissions(); + + // Demonstrate Refresh. + Refresh(); + + // Demonstrate Purge. + Purge(); + } + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + catch (MessageQueueException^ ex) + { + // Write the exception information to the console. + Console::WriteLine(ex->Message); + } +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp new file mode 100644 index 00000000000..27cc2fcd0f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueue4/cpp/class1.cpp @@ -0,0 +1,43 @@ +// + +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Create a new queue. +static void CreateQueue(String^ queuePath, bool transactional) +{ + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +static void UseQueue() +{ + // + // Connect to a queue on the local computer, grant exclusive read + // access to the first application that accesses the queue, and + // enable connection caching. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue", true, true); + + queue->Close(); + // +} + +int main() +{ + // Create a nontransactional queue on the local computer. + CreateQueue(".\\exampleQueue", false); + + UseQueue(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp new file mode 100644 index 00000000000..bd142a855da --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginPeek/cpp/class1.cpp @@ -0,0 +1,69 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if(!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +// Provides an event handler for the PeekCompleted event. +void MyPeekCompleted(IAsyncResult^ asyncResult) +{ + // Connect to the queue. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // End the asynchronous peek operation. + Message^ msg = queue->EndPeek(asyncResult); + + // Display the message information on the screen. + Console::WriteLine("Message number: {0}", asyncResult->AsyncState); + Console::WriteLine("Message body: {0}", msg->Body); + + // Receive the message. This will remove the message from the queue. + msg = queue->Receive(TimeSpan::FromSeconds(10.0)); + + queue->Close(); +} + +int main() +{ + // Represents a state object associated with each message. + int messageNumber = 0; + + // Create a non-transactional queue on the local computer. + // Note that the queue might not be immediately accessible, and + // therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send a + // message to the newly created queue. + CreateQueue(".\\exampleQueue", false); + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Send a message to the queue. + queue->Send("Example Message"); + + // Begin the asynchronous peek operation. + queue->BeginPeek(TimeSpan::FromSeconds(10.0), messageNumber++, + gcnew AsyncCallback(MyPeekCompleted)); + + // Simulate doing other work on the current thread. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + + queue->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp new file mode 100644 index 00000000000..f55dd96f51c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive1/cpp/class1.cpp @@ -0,0 +1,82 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if(!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +// Provides an event handler for the ReceiveCompleted event. +void HandleReceiveCompleted(Object^ source, ReceiveCompletedEventArgs^ e) +{ + // Connect to the queue. + MessageQueue^ queue = (MessageQueue^)source; + + // End the asynchronous receive operation. + Message^ msg = queue->EndReceive(e->AsyncResult); + + // Display the message information on the screen. + Console::WriteLine("Message body: {0}", msg->Body); + + queue->Close(); +} + +int main() +{ + // Create a non-transactional queue on the local computer. + // Note that the queue might not be immediately accessible, and + // therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send a + // message to the newly created queue. + MessageQueue^ queue = nullptr; + try + { + CreateQueue(".\\exampleQueue", false); + + // Connect to a queue on the local computer. + queue = gcnew MessageQueue(".\\exampleQueue"); + + // Add an event handler for the ReceiveCompleted event. + queue->ReceiveCompleted += gcnew + ReceiveCompletedEventHandler(HandleReceiveCompleted); + + // Send a message to the queue. + queue->Send("Example Message"); + + // Begin the asynchronous receive operation. + queue->BeginReceive(TimeSpan::FromSeconds(10.0)); + + // Simulate doing other work on the current thread. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + } + + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + + catch (MessageQueueException^ ex) + { + Console::WriteLine(ex->Message); + } + + finally + { + queue->Close(); + } + +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp new file mode 100644 index 00000000000..b75428d1df7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive2/cpp/class1.cpp @@ -0,0 +1,86 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if(!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +// Provides an event handler for the ReceiveCompleted event. +void HandleReceiveCompleted(Object^ source, ReceiveCompletedEventArgs^ e) +{ + // Connect to the queue. + MessageQueue^ queue = (MessageQueue^)source; + + // End the asynchronous receive operation. + Message^ msg = queue->EndReceive(e->AsyncResult); + + // Display the message information on the screen. + Console::WriteLine("Message number: {0}", e->AsyncResult->AsyncState); + Console::WriteLine("Message body: {0}", msg->Body); + + queue->Close(); +} + +int main() +{ + // Create a non-transactional queue on the local computer. + // Note that the queue might not be immediately accessible, and + // therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send a + // message to the newly created queue. + MessageQueue^ queue = nullptr; + + // Represents a state object associated with each message. + int messageNumber = 0; + + try + { + CreateQueue(".\\exampleQueue", false); + + // Connect to a queue on the local computer. + queue = gcnew MessageQueue(".\\exampleQueue"); + + // Add an event handler for the ReceiveCompleted event. + queue->ReceiveCompleted += gcnew + ReceiveCompletedEventHandler(HandleReceiveCompleted); + + // Send a message to the queue. + queue->Send("Example Message"); + + // Begin the asynchronous receive operation. + queue->BeginReceive(TimeSpan::FromSeconds(10.0), messageNumber++); + + // Simulate doing other work on the current thread. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + } + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + + catch (MessageQueueException^ ex) + { + Console::WriteLine(ex->Message); + } + + finally + { + queue->Close(); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp new file mode 100644 index 00000000000..a60adfa80c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueueBeginReceive3/cpp/class1.cpp @@ -0,0 +1,81 @@ +// +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +// Provides an event handler for the ReceiveCompleted event. +void HandleReceiveCompleted(IAsyncResult^ asyncResult) +{ + // Connect to the queue. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // End the asynchronous receive operation. + Message^ msg = queue->EndReceive(asyncResult); + + // Display the message information on the screen. + Console::WriteLine("Message number: {0}", asyncResult->AsyncState); + Console::WriteLine("Message body: {0}", msg->Body); + + queue->Close(); +} + +int main() +{ + // Represents a state object associated with each message. + int messageNumber = 0; + + // Create a non-transactional queue on the local computer. + // Note that the queue might not be immediately accessible, and + // therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send a + // message to the newly created queue. + MessageQueue^ queue = nullptr; + try + { + CreateQueue(".\\exampleQueue", false); + + // Connect to a queue on the local computer. + queue = gcnew MessageQueue(".\\exampleQueue"); + + // Send a message to the queue. + queue->Send("Example Message"); + + // Begin the asynchronous receive operation. + queue->BeginReceive(TimeSpan::FromSeconds(10.0), messageNumber++, + gcnew AsyncCallback(HandleReceiveCompleted)); + + // Simulate doing other work on the current thread. + System::Threading::Thread::Sleep(TimeSpan::FromSeconds(10.0)); + } + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + + catch (MessageQueueException^ ex) + { + Console::WriteLine(ex->Message); + } + + finally + { + queue->Close(); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp new file mode 100644 index 00000000000..e77794103ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAccess/cpp/class1.cpp @@ -0,0 +1,62 @@ +// + +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.",queuePath); + } +} + +// Demonstrates the use of MessageQueuePermissionAccess +void CreatePermission() +{ + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission( + MessageQueuePermissionAccess::Receive, queue->MachineName, + queue->Label, queue->Category.ToString()); + + queue->Close(); + // +} + +int main() +{ + try + { + + // Create a non-transactional queue on the local computer. + CreateQueue(".\\exampleQueue", false); + + // Demonstrate use of MessageQueuePermissionAccess. + CreatePermission(); + } + + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + + catch (MessageQueueException^ ex) + { + Console::WriteLine(ex->Message); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp new file mode 100644 index 00000000000..c5679d136b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionAttribute/cpp/class1.cpp @@ -0,0 +1,213 @@ +// + +#using +#using + +using namespace System; +using namespace System::Messaging; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +// Demonstrates the following MessageQueuePermissionAttribute constructor: +// public #ctor (SecurityAction action) +void CreateAttribute() +{ + // + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // +} + + +void CategoryExample() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // Set the attribute's Category property value, based on the queue's + // Category property value. + attribute->Category = queue->Category.ToString(); + + // Display the new value of the attribute's Category property. + Console::WriteLine("attribute->Category: {0}", + attribute->Category); + + queue->Close(); + // +} + +void LabelExample() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // Set the attribute's Label property value, based on the queue's Label + // property value. + attribute->Label = queue->Label; + + // Display the new value of the attribute's Label property. + Console::WriteLine("attribute->Label: {0}", attribute->Label); + + queue->Close(); + // +} + + +void MachineNameExample() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // Set the attribute's MachineName property value, based on the queue's + // MachineName property value. + attribute->MachineName = queue->MachineName; + + // Display the new value of the attribute's MachineName property. + Console::WriteLine("attribute->MachineName: {0}", + attribute->MachineName); + + queue->Close(); + // +} + +void PathExample() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // Set the attribute's Path property value, based on the queue's Path + // property value. + attribute->Path = queue->Path; + + // Display the new value of the attribute's Path property. + Console::WriteLine("attribute->Path: {0}", attribute->Path); + + queue->Close(); + // +} + +void PermissionAccessExample() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // Set the attribute's PermissionAccess property value. + attribute->PermissionAccess = MessageQueuePermissionAccess::Receive; + + // Display the new value of the attribute's PermissionAccess property. + Console::WriteLine("attribute->PermissionAccess: {0}", + attribute->PermissionAccess); + + queue->Close(); + // +} + +void CreatePermissionExample() +{ + // + + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionAttribute. + MessageQueuePermissionAttribute^ attribute = + gcnew MessageQueuePermissionAttribute( + System::Security::Permissions::SecurityAction::Assert); + + // Set the attribute's Path property value, based on the queue's Path + // property value. + attribute->Path = queue->Path; + + // Get an IPermission interface by calling the attribute's + // CreatePermission() method. + System::Security::IPermission^ permission = attribute->CreatePermission(); + + queue->Close(); + // +} + +int main() +{ + try + { + + // Create a non-transactional queue on the local computer. + CreateQueue(".\\exampleQueue", false); + + // Demonstrate the members of MessageQueuePermissionAttribute. + // Note that the Path, FormatName, MachineName, Label, and Category + // property values cannot all be set on the same instance of + // MessageQueuePermissionAttribute. Trying to do so will throw an + // exception of type System.InvalidOperationException. + + CreateAttribute(); + CategoryExample(); + LabelExample(); + MachineNameExample(); + PathExample(); + PermissionAccessExample(); + CreatePermissionExample(); + } + + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + + catch (MessageQueueException^ ex) + { + Console::WriteLine(ex->Message); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp new file mode 100644 index 00000000000..50c49a55ddc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntry/cpp/class1.cpp @@ -0,0 +1,208 @@ +// + +#using +#using + +using namespace System; +using namespace System::Messaging; + +public ref class MessageQueuePermissionEntryExample +{ + // Creates a new queue. +public: + static void CreateQueue(String^ queuePath, bool transactional) + { + if(!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } + } + + // Demonstrates the following MessageQueuePermission constructor: + // public #ctor (MessageQueuePermissionAccess permissionAccess, + // String path) +public: + void CreateEntryShortCtor() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->Path); + + queue->Close(); + // + } + + // Demonstrates the following MessageQueuePermission constructor: + // public #ctor (MessageQueuePermissionAccess permissionAccess, + // String machineName, String label, String category) +public: + void CreateEntryLongCtor() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + queue->Close(); + // + } + +public: + void CategoryExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Display the value of the entry's Category property. + Console::WriteLine("Category: {0}", entry->Category->ToString()); + + queue->Close(); + // + } + +public: + void LabelExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Display the value of the entry's Label property. + Console::WriteLine("Label: {0}", entry->Label); + + queue->Close(); + // + } + +public: + void MachineNameExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Display the value of the entry's MachineName property. + Console::WriteLine("MachineName: {0}", entry->MachineName); + + queue->Close(); + // + } + +public: + void PathExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->Path); + + // Display the value of the entry's Path property. + Console::WriteLine("Path: {0}", entry->Path); + + queue->Close(); + // + } + +public: + void PermissionAccessExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Display the value of the entry's PermissionAccess property. + Console::WriteLine("PermissionAccess: {0}", entry->PermissionAccess); + + queue->Close(); + // + } +}; + +int main() +{ + // Create a new instance of the class. + MessageQueuePermissionEntryExample^ example = + gcnew MessageQueuePermissionEntryExample(); + + try + { + // Create a non-transactional queue on the local computer. + // Note that the queue might not be immediately accessible, and + // therefore this example might throw an exception of type + // System.Messaging.MessageQueueException when trying to send a + // message to the newly created queue. + example->CreateQueue(".\\exampleQueue", false); + + // Demonstrate MessageQueuePermissionEntry's constructors. + example->CreateEntryShortCtor(); + example->CreateEntryLongCtor(); + + // Demonstrate MessageQueuePermissionEntry's properties. + example->CategoryExample(); + example->LabelExample(); + example->MachineNameExample(); + example->PathExample(); + example->PermissionAccessExample(); + } + + catch (InvalidOperationException^) + { + Console::WriteLine("Please install Message Queuing."); + } + + catch (MessageQueueException^ ex) + { + // Write the exception information to the console. + Console::WriteLine(ex->Message); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp new file mode 100644 index 00000000000..01ab6fd2ada --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MessageQueuePermissionEntryCollection/cpp/class1.cpp @@ -0,0 +1,408 @@ +// + +#using +#using +using namespace System; +using namespace System::Messaging; + +public ref class MessageQueuePermissionEntryCollectionExample +{ + // Demonstrates: + // public Int32 Add (MessageQueuePermissionEntry value) +public: + void AddExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + queue->Close(); + // + } + + // Demonstrates: + // public Void AddRange (MessageQueuePermissionEntry[] value) +public: + void AddRangeExample1() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create an array of type MessageQueuePermissionEntry. + array^ entries = + gcnew array(1); + + // Create a new instance of MessageQueuePermissionEntry and place the + // instance in the array. + entries[0] = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the array to the collection. + collection->AddRange(entries); + + queue->Close(); + // + } + + // Demonstrates: + // public Void AddRange (MessageQueuePermissionEntryCollection value) +public: + void AddRangeExample2() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, queue->Category.ToString()); + + // Add the entry to the permission's collection. + permission->PermissionEntries->Add(entry); + + // Create another new instance of MessageQueuePermission. + MessageQueuePermission^ newPermission = gcnew MessageQueuePermission(); + + // Use AddRange() to append the original permission's collection to the + // new permission's collection. + newPermission->PermissionEntries->AddRange( + permission->PermissionEntries); + + // To show that AddRange() copies collections by value and not by + // reference, we'll clear the original permission's collection, then + // display a count of how many entries are in the original permission's + // collection and how many entries are in the new permission's + // collection. + + // Clear the original permission's collection. + permission->PermissionEntries->Clear(); + + // The original permission now contains 0 entries, but the new + // permission still contains 1 entry. + Console::WriteLine("Original permission contains {0} entries.", + permission->PermissionEntries->Count); + Console::WriteLine("New permission contains {0} entries.", + newPermission->PermissionEntries->Count); + + queue->Close(); + // + } + + // Demonstrates: + // public Boolean Contains (MessageQueuePermissionEntry value) +public: + void ContainsExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + // Show that the collection contains the entry. + Console::WriteLine("Collection contains first entry (true/false): {0}", + collection->Contains(entry)); + + // Create another new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ newEntry = + gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Send, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Show that the collection does not contain the new entry. + Console::WriteLine( + "Collection contains second entry (true/false): {0}", + collection->Contains(newEntry)); + + queue->Close(); + // + } + + // Demonstrates: + // public Void CopyTo (MessageQueuePermissionEntry[] array, Int32 index) +public: + void CopyToExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + // Create an array of type MessageQueuePermissionEntry. + array^ entries = + gcnew array(1); + + // Copy the collection to index 0 of the array. + collection->CopyTo(entries, 0); + + // Show that the array now contains the entry. + Console::WriteLine("entries[0].PermissionAccess: {0}", + entries[0]->PermissionAccess); + Console::WriteLine("entries[0].MachineName: {0}", + entries[0]->MachineName); + Console::WriteLine("entries[0].Label: {0}", entries[0]->Label); + Console::WriteLine("entries[0].Category: {0}", + entries[0]->Category); + + queue->Close(); + // + } + + // Demonstrates: + // public Int32 IndexOf (MessageQueuePermissionEntry value) +public: + void IndexOfExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + // Display the index of the entry in the collection. + Console::WriteLine("Collection contains entry at index: {0}", + collection->IndexOf(entry)); + + queue->Close(); + // + } + + // Demonstrates: + // public Void Insert (Int32 index, MessageQueuePermissionEntry value) +public: + void InsertExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + // Create another new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ newEntry = + gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Send, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Insert the new entry into the collection before the original entry. + collection->Insert(0, newEntry); + + queue->Close(); + // + } + + // Demonstrates: + // public MessageQueuePermissionEntry Item [Int32 index] { get; set; } +public: + void ItemExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + // Display the entry's properties, using the collection's Item + // accessor. + Console::WriteLine("collection[0].PermissionAccess: {0}", + collection[0]->PermissionAccess); + Console::WriteLine("collection[0].MachineName: {0}", + collection[0]->MachineName); + Console::WriteLine("collection[0].Label: {0}", collection[0]->Label); + Console::WriteLine("collection[0].Category: {0}", + collection[0]->Category); + + queue->Close(); + // + } + + // Demonstrates: + // public Void Remove (MessageQueuePermissionEntry value) +public: + void RemoveExample() + { + // + // Connect to a queue on the local computer. + MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue"); + + // Create a new instance of MessageQueuePermission. + MessageQueuePermission^ permission = gcnew MessageQueuePermission(); + + // Get an instance of MessageQueuePermissionEntryCollection from the + // permission's PermissionEntries property. + MessageQueuePermissionEntryCollection^ collection = + permission->PermissionEntries; + + // Create a new instance of MessageQueuePermissionEntry. + MessageQueuePermissionEntry^ entry = gcnew MessageQueuePermissionEntry( + MessageQueuePermissionAccess::Receive, + queue->MachineName, + queue->Label, + queue->Category.ToString()); + + // Add the entry to the collection. + collection->Add(entry); + + // Remove the entry from the collection. + collection->Remove(entry); + + queue->Close(); + // + } +}; + +// Creates a new queue. +void CreateQueue(String^ queuePath, bool transactional) +{ + if (!MessageQueue::Exists(queuePath)) + { + MessageQueue^ queue = MessageQueue::Create(queuePath, transactional); + queue->Close(); + } + else + { + Console::WriteLine("{0} already exists.", queuePath); + } +} + +int main() +{ + // Create a new instance of the class. + MessageQueuePermissionEntryCollectionExample^ example = + gcnew MessageQueuePermissionEntryCollectionExample(); + + // Create a non-transactional queue on the local computer. + CreateQueue(".\\exampleQueue", false); + + // Demonstrate MessageQueuePermissionEntryCollection's members. + example->AddExample(); + example->AddRangeExample1(); + example->AddRangeExample2(); + example->ContainsExample(); + example->CopyToExample(); + example->IndexOfExample(); + example->InsertExample(); + example->ItemExample(); + example->RemoveExample(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp b/snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp new file mode 100644 index 00000000000..ec5c5a7a240 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Message_Samples3/CPP/message_samples3.cpp @@ -0,0 +1,58 @@ +// System::Web::Services::Description.Message::FindPartsByName +// System::Web::Services::Description.Message::ServiceDescription +// System::Web::Services::Description.Message::FindPartByName + +/* The following program demonstrates the property ' ServiceDescription' and +methods 'FindPartsByName', 'FindPartByName' of class 'Message'. The program +reads a wsdl document S"MathService::wsdl" and instantiates a +ServiceDescription instance from WSDL document. +The program invokes 'FindPartsByName' to obtain an array of MessageParts and also invokes +'FindPartByName' to retrieve a specific 'MessagePart'. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + try + { + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_cpp.wsdl" ); + + // + // Get message from ServiceDescription. + Message^ myMessage1 = myServiceDescription->Messages[ "AddHttpPostIn" ]; + Console::WriteLine( "ServiceDescription : {0}", myMessage1->ServiceDescription ); + + // + array^myParts = gcnew array(2); + myParts[ 0 ] = "a"; + myParts[ 1 ] = "b"; + array^myMessageParts = myMessage1->FindPartsByName( myParts ); + Console::WriteLine( "Results of FindPartsByName operation:" ); + for ( int i = 0; i < myMessageParts->Length; ++i ) + { + Console::WriteLine( "Part Name: {0}", myMessageParts[ i ]->Name ); + Console::WriteLine( "Part Type: {0}", myMessageParts[ i ]->Type ); + } + // + // + // Get another message from ServiceDescription. + Message^ myMessage2 = myServiceDescription->Messages[ "DivideHttpGetOut" ]; + MessagePart^ myMessagePart = myMessage2->FindPartByName( "Body" ); + Console::WriteLine( "Results of FindPartByName operation:" ); + Console::WriteLine( "Part Name: {0}", myMessagePart->Name ); + Console::WriteLine( "Part Element: {0}", myMessagePart->Element ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp new file mode 100644 index 00000000000..a60f0e1720b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertCodeSourceFileToAssemblyFile/CPP/source.cpp @@ -0,0 +1,15 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting::MetadataServices; +int main() +{ + MetaData::ConvertCodeSourceFileToAssemblyFile( "CsSource.cs", "testAssm.dll", "" ); + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp new file mode 100644 index 00000000000..c8665cf1b3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToFile/CPP/source.cpp @@ -0,0 +1,48 @@ +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting::Metadata; +using namespace System::Runtime::Remoting::MetadataServices; + +ref class TestClass +{ +private: + int integer; + +public: + static const double dFloatingPoint = 5.1999; + + property int Int + { + int get() + { + return integer; + } + void set( int value ) + { + integer = value; + } + } + void Print() + { + Console::WriteLine( "The double is equal to {0}.", dFloatingPoint ); + } +}; + +int main() +{ + array^types = gcnew array(4); + String^ s = "a"; + int i = -5; + double d = 3.1415; + TestClass^ tc = gcnew TestClass; + types[ 0 ] = s->GetType(); + types[ 1 ] = i.GetType(); + types[ 2 ] = d.GetType(); + types[ 3 ] = tc->GetType(); + MetaData::ConvertTypesToSchemaToFile( types, SdlType::Wsdl, "test.xml" ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp new file mode 100644 index 00000000000..6fd71eb46d7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MetaData.ConvertTypesToSchemaToStream/CPP/source.cpp @@ -0,0 +1,50 @@ +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting::Metadata; +using namespace System::Runtime::Remoting::MetadataServices; +using namespace System::IO; + +ref class TestClass +{ +private: + int integer; + +public: + static const double dFloatingPoint = 5.1999; + + property int Int + { + int get() + { + return integer; + } + void set( int value ) + { + integer = value; + } + } + void Print() + { + Console::WriteLine( "The double is equal to {0}.", dFloatingPoint ); + } +}; + +int main() +{ + array^types = gcnew array(4); + String^ s = "a"; + int i = -5; + double d = 3.1415; + TestClass^ tc = gcnew TestClass; + types[ 0 ] = s->GetType(); + types[ 1 ] = i.GetType(); + types[ 2 ] = i.GetType(); + types[ 3 ] = tc->GetType(); + FileStream^ fs = gcnew FileStream( "test.xml",FileMode::OpenOrCreate ); + MetaData::ConvertTypesToSchemaToStream( types, SdlType::Wsdl, fs ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp new file mode 100644 index 00000000000..0623e5a713a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimeContentBinding_Part_4/CPP/mimecontentbinding_part_4.cpp @@ -0,0 +1,53 @@ +// System::Web::Services::Description.MimeContentBinding::Type +// System::Web::Services::Description.MimeContentBinding::Part +// System::Web::Services::Description.MimeContentBinding::NameSpace +// System::Web::Services::Description.MimeContentBinding + +/* The following program demonstrates the 'Type' and 'Part' properties +and the 'NameSpace' field of the 'MimeContentBinding' class. It reads the 'MimeContentSample_cs::wsdl' file +and instantiates a ServiceDescription Object*. 'MimeContentBinding' objects are retrieved from Extension +points of OutputBinding for one of the Binding Object* and its 'Type' and 'Part' properties are displayed. It also +displays 'NameSpace' of the 'MimeContentBinding' Object*. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; + +int main() +{ + // + // + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeContentSample_cpp.wsdl" ); + + // Get the Binding. + Binding^ myBinding = myServiceDescription->Bindings[ "b1" ]; + + // Get the first OperationBinding. + OperationBinding^ myOperationBinding = myBinding->Operations[ 0 ]; + OutputBinding^ myOutputBinding = myOperationBinding->Output; + ServiceDescriptionFormatExtensionCollection ^ myServiceDescriptionFormatExtensionCollection = myOutputBinding->Extensions; + + // Find all MimeContentBinding objects in extensions. + array^myMimeContentBindings = (array^)myServiceDescriptionFormatExtensionCollection->FindAll( MimeContentBinding::typeid ); + + // Enumerate the array and display MimeContentBinding properties. + IEnumerator^ myEnum = myMimeContentBindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MimeContentBinding^ myMimeContentBinding = safe_cast(myEnum->Current); + Console::WriteLine( "Type: {0}", myMimeContentBinding->Type ); + Console::WriteLine( "Part: {0}", myMimeContentBinding->Part ); + } + // + // + Console::WriteLine( "Namespace: {0}", MimeContentBinding::Namespace ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp new file mode 100644 index 00000000000..f7387c482ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimeMultiPartRelatedBinding_Parts_2/CPP/mimemultipartrelatedbinding_parts_2.cpp @@ -0,0 +1,55 @@ +// System::Web::Services::Description.MimeMultipartRelatedBinding +// System::Web::Services::Description.MimeMultipartRelatedBinding::Parts; + +/* The following program demonstrates the property 'Parts' of class 'MimeMultipartRelatedBinding'. +It reads 'MimeMultiPartRelatedSample_cpp.wsdl'file and instantiates a ServiceDescription Object*. +'MimeMultipartRelatedBinding' Object* is retrieved from Extension +points of OutputBinding for one of the Binding Object* and its property'Parts' has been demonstrated. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; + +int main() +{ + // + ServiceDescription^ myServicDescription = ServiceDescription::Read( "MimeMultiPartRelatedSample_cpp.wsdl" ); + + // Get the binding collection. + BindingCollection^ myBindingCollection = myServicDescription->Bindings; + int index = 0; + for ( int i = 0; i < myBindingCollection->Count; i++ ) + // Get the collection for MimeServiceHttpPost. + if ( String::Compare( myBindingCollection[ i ]->Name, "MimeServiceHttpPost" ) == 0 ) + { + OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ i ]->Operations; + OutputBinding^ myOutputBinding = myOperationBindingCollection[ 0 ]->Output; + ServiceDescriptionFormatExtensionCollection ^ myServiceDescriptionFormatExtensionCollection = myOutputBinding->Extensions; + MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = dynamic_cast(myServiceDescriptionFormatExtensionCollection->Find( MimeMultipartRelatedBinding::typeid )); + MimePartCollection^ myMimePartCollection = myMimeMultipartRelatedBinding->Parts; + IEnumerator^ myEnum = myMimePartCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MimePart^ myMimePart = dynamic_cast(myEnum->Current); + Console::WriteLine( "Extension Types added to MimePart: {0}", index++ ); + Console::WriteLine( "----------------------------" ); + IEnumerator^ myEnum2 = myMimePart->Extensions->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + Console::WriteLine( myEnum2->Current->GetType() ); + } + + Console::WriteLine( "" ); + } + + break; + } + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp b/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp new file mode 100644 index 00000000000..5648074bf2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_1/CPP/mimepartcollection_1.cpp @@ -0,0 +1,66 @@ +// System::Web::Services::Description.MimePartCollection + +/* The following program demostrates 'MimePartCollection' class. It +takes 'MimePartCollection_1_Input_cpp.wsdl' as input which +contains one 'MimePart' Object* that supports 'HttpPost'. +A mimepartcollection Object* is created and mimepart is added to the +mimepartcollection at the specified location, finally writes +into the file'MimePartCollection_1_Output_cpp.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePartCollection_1_Input_cpp.wsdl" ); + ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection; + myServiceDescriptionCol->Add( myServiceDescription ); + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" ); + + // Create a 'Binding' object. + Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName ); + OperationBinding^ myOperationBinding = nullptr; + for ( int i = 0; i < myBinding->Operations->Count; i++ ) + if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) ) + myOperationBinding = myBinding->Operations[ i ]; + + OutputBinding^ myOutputBinding = myOperationBinding->Output; + MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = nullptr; + IEnumerator^ myIEnumerator = myOutputBinding->Extensions->GetEnumerator(); + while ( myIEnumerator->MoveNext() ) + myMimeMultipartRelatedBinding = dynamic_cast(myIEnumerator->Current); + + // Create an instances of 'MimePartCollection'. + MimePartCollection^ myMimePartCollection = gcnew MimePartCollection; + myMimePartCollection = myMimeMultipartRelatedBinding->Parts; + Console::WriteLine( "Total number of mimepart elements initially is: {0}", myMimePartCollection->Count ); + + // Create an instance of 'MimePart'. + MimePart^ myMimePart = gcnew MimePart; + + // Create an instance of 'MimeXmlBinding'. + MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding; + myMimeXmlBinding->Part = "body"; + myMimePart->Extensions->Add( myMimeXmlBinding ); + + // Insert a mimepart at first position. + myMimePartCollection->Insert( 0, myMimePart ); + Console::WriteLine( "Inserting a mimepart object..." ); + if ( myMimePartCollection->Contains( myMimePart ) ) + { + Console::WriteLine( "'MimePart' is succesffully added at position: {0}", myMimePartCollection->IndexOf( myMimePart ) ); + Console::WriteLine( "Total number of mimepart elements after inserting is: {0}", myMimePartCollection->Count ); + } + + myServiceDescription->Write( "MimePartCollection_1_Output_cpp.wsdl" ); + Console::WriteLine( "MimePartCollection_1_Output_cpp.wsdl has been generated successfully." ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp b/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp new file mode 100644 index 00000000000..dcd7449eeb1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimePartCollection_8/CPP/mimepartcollection_8.cpp @@ -0,0 +1,146 @@ +// System::Web::Services::Description.MimePartCollection::MimePartCollection() +// System::Web::Services::Description.MimePartCollection::Item->Item[System::Int32 index] +// System::Web::Services::Description.MimePartCollection::Insert +// System::Web::Services::Description.MimePartCollection::IndexOf +// System::Web::Services::Description.MimePartCollection->Add +// System::Web::Services::Description.MimePartCollection::Contains +// System::Web::Services::Description.MimePartCollection::CopyTo +// System::Web::Services::Description.MimePartCollection::Remove + +/* This program demonstrates the constructor, the 'Item' property , the 'Insert', 'IndexOf', 'Add', +'Contains', 'CopyTo', and 'Remove' methods of the 'MimePartCollection' class. +It takes 'MimePartCollection_8_Input_cpp.wsdl' as an input file which contains +one 'MimePart' object that supports 'HttpPost'. A MimePartCollection object is +created and new MimePart objects are added to MimePartCollection using the 'Insert' +and 'Add' methods. A MimePart object is removed from the MimePartCollection using the +'Remove' method. The ServiceDescription is finally written into an output wsdl file +'MimePartCollection_8_out_CS::wsdl'. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePartCollection_8_Input_cpp.wsdl" ); + ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection; + myServiceDescriptionCol->Add( myServiceDescription ); + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" ); + + // Create a binding object. + Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName ); + OperationBinding^ myOperationBinding = nullptr; + for ( int i = 0; i < myBinding->Operations->Count; i++ ) + if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) ) + myOperationBinding = myBinding->Operations[ i ]; + + OutputBinding^ myOutputBinding = myOperationBinding->Output; + + // + // + // + // + MimeMultipartRelatedBinding^ myMimeMultipartRelatedBinding = nullptr; + IEnumerator^ myIEnumerator = myOutputBinding->Extensions->GetEnumerator(); + while ( myIEnumerator->MoveNext() ) + myMimeMultipartRelatedBinding = (MimeMultipartRelatedBinding^)myIEnumerator->Current; + + // Create an instance of 'MimePartCollection'. + MimePartCollection^ myMimePartCollection = gcnew MimePartCollection; + myMimePartCollection = myMimeMultipartRelatedBinding->Parts; + Console::WriteLine( "Total number of mimepart elements in the collection initially is: {0}", myMimePartCollection->Count ); + + // Get the type of first 'Item' in collection. + Console::WriteLine( "The first object in collection is of type: {0}", myMimePartCollection[ 0 ] ); + MimePart^ myMimePart1 = gcnew MimePart; + + // Create an instance of 'MimeXmlBinding'. + MimeXmlBinding^ myMimeXmlBinding1 = gcnew MimeXmlBinding; + myMimeXmlBinding1->Part = "body"; + myMimePart1->Extensions->Add( myMimeXmlBinding1 ); + + // a mimepart at first position. + myMimePartCollection->Insert( 0, myMimePart1 ); + Console::WriteLine( "Inserting a mimepart object..." ); + + // Check whether 'Insert' was successful or not. + if ( myMimePartCollection->Contains( myMimePart1 ) ) + { + // Display the index of inserted 'MimePart'. + Console::WriteLine( "'MimePart' is successfully inserted at position: {0}", myMimePartCollection->IndexOf( myMimePart1 ) ); + } + // + // + // + // + + Console::WriteLine( "Total number of mimepart elements after inserting is: {0}", myMimePartCollection->Count ); + + // + // + MimePart^ myMimePart2 = gcnew MimePart; + MimeXmlBinding^ myMimeXmlBinding2 = gcnew MimeXmlBinding; + myMimeXmlBinding2->Part = "body"; + myMimePart2->Extensions->Add( myMimeXmlBinding2 ); + + // Add a mimepart to the mimepartcollection. + myMimePartCollection->Add( myMimePart2 ); + Console::WriteLine( "Adding a mimepart object..." ); + + // Check if collection contains added mimepart object. + if ( myMimePartCollection->Contains( myMimePart2 ) ) + Console::WriteLine( "'MimePart' is successfully added at position: {0}", myMimePartCollection->IndexOf( myMimePart2 ) ); + // + // + + Console::WriteLine( "Total number of mimepart elements after adding is: {0}", myMimePartCollection->Count ); + + // + array^myArray = gcnew array(myMimePartCollection->Count); + + // Copy the mimepartcollection to an array. + myMimePartCollection->CopyTo( myArray, 0 ); + Console::WriteLine( "Displaying the array copied from mimepartcollection" ); + for ( int j = 0; j < myMimePartCollection->Count; j++ ) + { + Console::WriteLine( "Mimepart object at position : {0}", j ); + for ( int i = 0; i < myArray[ j ]->Extensions->Count; i++ ) + { + MimeXmlBinding^ myMimeXmlBinding3 = (MimeXmlBinding^)(myArray[ j ]->Extensions[ i ]); + Console::WriteLine( "Part: {0}", (myMimeXmlBinding3->Part) ); + } + } + // + // + Console::WriteLine( "Removing a mimepart object..." ); + + // Remove the mimepart from the mimepartcollection. + myMimePartCollection->Remove( myMimePart1 ); + + // Check whether the mimepart is removed or not. + if ( !myMimePartCollection->Contains( myMimePart1 ) ) + Console::WriteLine( "Mimepart is successfully removed from mimepartcollection" ); + // + + Console::WriteLine( "Total number of elements in collection after removing is: {0}", myMimePartCollection->Count ); + array^myArray1 = gcnew array(myMimePartCollection->Count); + myMimePartCollection->CopyTo( myArray1, 0 ); + Console::WriteLine( "Dispalying the 'MimePartCollection' after removing" ); + for ( int j = 0; j < myMimePartCollection->Count; j++ ) + { + Console::WriteLine( "Mimepart object at position : {0}", j ); + for ( int i = 0; i < myArray1[ j ]->Extensions->Count; i++ ) + { + MimeXmlBinding^ myMimeXmlBinding3 = (MimeXmlBinding^)(myArray1[ j ]->Extensions[ i ]); + Console::WriteLine( "part: {0}", (myMimeXmlBinding3->Part) ); + } + } + myServiceDescription->Write( "MimePartCollection_8_output.wsdl" ); + Console::WriteLine( "MimePartCollection_8_output.wsdl has been generated successfully." ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp b/snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp new file mode 100644 index 00000000000..78518047dc2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimePart_3/CPP/mimepart_3.cpp @@ -0,0 +1,60 @@ + + +// System.Web.Services.Description.MimePart +// System.Web.Services.Description.MimePart.ctor() +// System.Web.Services.Description.MimePart.Extensions +/* The following program demonstrates the 'MimePart' class, constructor +and 'Extensions' property of 'MimePart' class. It reads +'MimePart_3_Input_cpp.wsdl' file which does not have 'MimePart' object +supporting 'OutPut' of 'HttpPost'. It adds the 'MimePart' and finally +writes into 'MimePart_3_OutPut_cpp.wsdl' file. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimePart_3_Input_cpp.wsdl" ); + ServiceDescriptionCollection^ myServiceDescriptionCol = gcnew ServiceDescriptionCollection; + myServiceDescriptionCol->Add( myServiceDescription ); + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MimeServiceHttpPost","http://tempuri.org/" ); + + // Create the Binding. + Binding^ myBinding = myServiceDescriptionCol->GetBinding( myXmlQualifiedName ); + OperationBinding^ myOperationBinding = nullptr; + for ( int i = 0; i < myBinding->Operations->Count; i++ ) + { + if ( myBinding->Operations[ i ]->Name->Equals( "AddNumbers" ) ) + { + myOperationBinding = myBinding->Operations[ i ]; + } + } + + // + // + // Create the OutputBinding. + OutputBinding^ myOutputBinding = myOperationBinding->Output; + MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding; + myMimeXmlBinding->Part = "body"; + + // Create the MimePart. + MimePart^ myMimePart = gcnew MimePart; + myMimePart->Extensions->Add( myMimeXmlBinding ); + MimeMultipartRelatedBinding^ myMimePartRelatedBinding = gcnew MimeMultipartRelatedBinding; + + // Add the MimePart to the MimePartRelatedBinding. + myMimePartRelatedBinding->Parts->Add( myMimePart ); + myOutputBinding->Extensions->Add( myMimePartRelatedBinding ); + // + // + + myServiceDescription->Write( "MimePart_3_Output_CPP.wsdl" ); + Console::WriteLine( "MimePart_3_Output_CPP.wsdl has been generated successfully." ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp new file mode 100644 index 00000000000..a1904f5cf88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimeTextMatch_5/CPP/mimetextmatch_5.cpp @@ -0,0 +1,138 @@ + + +// System.Web.Services.Description.MimeTextMatch +// System.Web.Services.Description.MimeTextMatch.Capture +// System.Web.Services.Description.MimeTextMatch.Group +// System.Web.Services.Description.MimeTextMatch.Repeats +// System.Web.Services.Description.MimeTextMatch.RepeatsString +/* The following program demostrates constructor, 'Capture', 'Group', + 'Repeats' and 'RepeatsString' properties of 'MimeTextMatch'class. + It takes 'MimeTextMatch_5_Input_CPP.wsdl' as input which does not + contain 'Binding' object supporting 'HttpPost'. A text pattern + ''TITLE>(.*?)<' with text name as 'Title' and type + name set which is to be searched in a HTTP transmission is added to the ServiceDescription. + The modified ServiceDescription is written into 'MimeTextMatch_5_Output_CPP.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + int myInt = 0; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeTextMatch_5_Input_CPP.wsdl" ); + + // Create the 'Binding' object. + Binding^ myBinding = gcnew Binding; + + // Initialize 'Name' property of 'Binding' class. + myBinding->Name = "MimeTextMatchServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeTextMatchServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + + // Create the 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + + // Create the 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; + myHttpOperationBinding->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' object to 'OperationBinding'. + myOperationBinding->Extensions->Add( myHttpOperationBinding ); + + // + // + // + // + // Create an InputBinding. + InputBinding^ myInputBinding = gcnew InputBinding; + MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding; + MimeTextMatchCollection^ myMimeTextMatchCollection1 = gcnew MimeTextMatchCollection; + array^myMimeTextMatch = gcnew array(3); + myMimeTextMatchCollection1 = myMimeTextBinding->Matches; + + // Intialize the MimeTextMatch. + for ( myInt = 0; myInt < 3; myInt++ ) + { + // Get a new MimeTextMatch. + myMimeTextMatch[ myInt ] = gcnew MimeTextMatch; + + // Assign values to properties of the MimeTextMatch. + myMimeTextMatch[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) ); + myMimeTextMatch[ myInt ]->Type = "*/*"; + myMimeTextMatch[ myInt ]->Pattern = "TITLE>(.*?)<"; + myMimeTextMatch[ myInt ]->IgnoreCase = true; + myMimeTextMatch[ myInt ]->Capture = 2; + myMimeTextMatch[ myInt ]->Group = 2; + if ( myInt != 0 ) + { + + // Assign the Repeats property if the index is not 0. + myMimeTextMatch[ myInt ]->Repeats = 2; + } + else + { + + // Assign the RepeatsString property if the index is 0. + myMimeTextMatch[ myInt ]->RepeatsString = "4"; + } + myMimeTextMatchCollection1->Add( myMimeTextMatch[ myInt ] ); + + } + // + // + // + // + + myInputBinding->Extensions->Add( myMimeTextBinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + + // Create the 'OutputBinding' instance. + OutputBinding^ myOutput = gcnew OutputBinding; + MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; + + // Initialize 'Part' property of 'MimeXmlBinding' class. + postMimeXmlbinding->Part = "Body"; + + // Add 'MimeXmlBinding' instance to 'OutputBinding' instance. + myOutput->Extensions->Add( postMimeXmlbinding ); + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myServiceDescription->Bindings->Add( myBinding ); + + // Write the 'ServiceDescription' as a WSDL file. + myServiceDescription->Write( "MimeTextMatch_5_Output_CPP.wsdl" ); + Console::WriteLine( "WSDL file with name 'MimeTextMatch_5_Output_CPP.wsdl' is" + " created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp new file mode 100644 index 00000000000..495d3ca8b82 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimeText_Binding_Match_8/CPP/mimetext_binding_match_8.cpp @@ -0,0 +1,128 @@ + + +// System.Web.Services.Description.MimeTextBinding +// System.Web.Services.Description.MimeTextBinding() +// System.Web.Services.Description.MimeTextMatch() +// System.Web.Services.Description.MimeTextMatch.Name +// System.Web.Services.Description.MimeTextMatch.Type +// System.Web.Services.Description.MimeTextMatch.Pattern +// System.Web.Services.Description.MimeTextMatch.IgnoreCase +// System.Web.Services.Description.MimeTextBinding.Matches +/* This program demostrates constructor and 'Matches' property +of 'MimeTextBinding' class and 'Name', 'Type', 'Pattern', +'IgnoreCase' properties of 'MimeTextMatch' class. +It takes 'MimeText_Binding_Match_8_Input_CPP.wsdl' as an +input file which does not contain 'Binding' object that supports +'HttpPost'. A text pattern ''TITLE>(.*?)<' with text name +as 'Title' and with type name set, is added to the wsdl file. Finally the +' modified ServiceDescription is written to 'MimeText_Binding_Match_8_Output_CPP.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeText_Binding_Match_8_Input_CPP.wsdl" ); + + // Create a Binding. + Binding^ myBinding = gcnew Binding; + + // Initialize the Name property of the Binding. + myBinding->Name = "MimeText_Binding_MatchServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeText_Binding_MatchServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + + // Create an HttpBinding. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the HttpBinding to the Binding. + myBinding->Extensions->Add( myHttpBinding ); + + // Create an OperationBinding. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; + myHttpOperationBinding->Location = "/AddNumbers"; + + // Add the HttpOperationBinding to the OperationBinding. + myOperationBinding->Extensions->Add( myHttpOperationBinding ); + + // Create an InputBinding. + InputBinding^ myInputBinding = gcnew InputBinding; + MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; + postMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInputBinding->Extensions->Add( postMimeContentbinding ); + + // Add the InputBinding to the OperationBinding. + myOperationBinding->Input = myInputBinding; + + // + // + // + // + // + // + // + // Create an OutputBinding. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + + // Create a MimeTextBinding. + MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding; + + // Create a MimeTextMatch. + MimeTextMatch^ myMimeTextMatch = gcnew MimeTextMatch; + MimeTextMatchCollection^ myMimeTextMatchCollection; + + // Initialize properties of the MimeTextMatch. + myMimeTextMatch->Name = "Title"; + myMimeTextMatch->Type = "*/*"; + myMimeTextMatch->Pattern = "'TITLE>(.*?)<"; + myMimeTextMatch->IgnoreCase = true; + + // Initialize a MimeTextMatchCollection. + myMimeTextMatchCollection = myMimeTextBinding->Matches; + + // Add the MimeTextMatch to the MimeTextMatchCollection. + myMimeTextMatchCollection->Add( myMimeTextMatch ); + myOutputBinding->Extensions->Add( myMimeTextBinding ); + + // Add the OutputBinding to the OperationBinding. + myOperationBinding->Output = myOutputBinding; + // + // + // + // + // + // + // + + // Add the OutputBinding to the OperationBinding. + myOperationBinding->Output = myOutputBinding; + + // Add the OperationBinding to the Binding. + myBinding->Operations->Add( myOperationBinding ); + + // Add the Binding to the BindingCollection of the ServiceDescription. + myServiceDescription->Bindings->Add( myBinding ); + + // Write the ServiceDescription as a WSDL file. + myServiceDescription->Write( "MimeText_Binding_Match_8_Output_CPP.wsdl" ); + Console::WriteLine( "WSDL file named 'MimeText_Binding_Match_8_Output_CPP.wsdl' was" + " created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp new file mode 100644 index 00000000000..c488a6fea49 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimeText_Match_MatchColl_9/CPP/mimetext_match_matchcoll_9.cpp @@ -0,0 +1,180 @@ +// System.Web.Services.Description.MimeTextMatchCollection +// System.Web.Services.Description.MimeTextMatchCollection() +// System.Web.Services.Description.MimeTextMatchCollection.Contains +// System.Web.Services.Description.MimeTextMatchCollection.Add +// System.Web.Services.Description.MimeTextMatchCollection.CopyTo +// System.Web.Services.Description.MimeTextMatchCollection.Remove +// System.Web.Services.Description.MimeTextMatchCollection.Item +// System.Web.Services.Description.MimeTextMatchCollection.IndexOf +// System.Web.Services.Description.MimeTextMatchCollection.Insert + +/* This program demostrates constructor, Contains, Add, Item, + IndexOf, Insert and Remove property of 'MimeTextMatchCollection'. + This program takes 'MimeText_Match_MatchColl_9_Input_CPP.wsdl' as an + input file which does not contain 'Binding' object that supports + 'HttpPost'. A name, type, Group and Capture properties are set + which are to be searched in a HTTP transmission and + 'MimeTextMatchCollection' collection object is created + for input and output of 'HttpPost' and finally writes into + 'MimeText_Match_MatchColl_9_Output_CPP.wsdl'. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + int myInt = 0; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MimeText_Match_MatchColl_9_Input_CPP.wsdl" ); + + // Create the 'Binding' object. + Binding^ myBinding = gcnew Binding; + + // Initialize 'Name' property of 'Binding' class. + myBinding->Name = "MimeText_Match_MatchCollServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeText_Match_MatchCollServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + + // Create the 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + + // Create the 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; + myHttpOperationBinding->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myHttpOperationBinding ); + + // + // Create the 'InputBinding' object. + InputBinding^ myInputBinding = gcnew InputBinding; + MimeTextBinding^ myMimeTextBinding = gcnew MimeTextBinding; + MimeTextMatchCollection^ myMimeTextMatchCollection; + + // + // + // + // Get an array instance of 'MimeTextMatch' class. + array^myMimeTextMatch = gcnew array(4); + myMimeTextMatchCollection = myMimeTextBinding->Matches; + + // Initialize properties of 'MimeTextMatch' class. + for ( myInt = 0; myInt < 4; myInt++ ) + { + // Create the 'MimeTextMatch' instance. + myMimeTextMatch[ myInt ] = gcnew MimeTextMatch; + myMimeTextMatch[ myInt ]->Name = "Title"; + myMimeTextMatch[ myInt ]->Type = "*/*"; + myMimeTextMatch[ myInt ]->IgnoreCase = true; + if ( true == myMimeTextMatchCollection->Contains( myMimeTextMatch[ 0 ] ) ) + { + myMimeTextMatch[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) ); + myMimeTextMatch[ myInt ]->Capture = 2; + myMimeTextMatch[ myInt ]->Group = 2; + myMimeTextMatchCollection->Add( myMimeTextMatch[ myInt ] ); + } + else + { + myMimeTextMatchCollection->Add( myMimeTextMatch[ myInt ] ); + myMimeTextMatchCollection[ myInt ]->RepeatsString = "2"; + } + } + myMimeTextMatchCollection = myMimeTextBinding->Matches; + + // Copy collection to 'MimeTextMatch' array instance. + myMimeTextMatchCollection->CopyTo( myMimeTextMatch, 0 ); + // + // + // + + myInputBinding->Extensions->Add( myMimeTextBinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + + // Create the 'OutputBinding' instance. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + + // Create the 'MimeTextBinding' instance. + MimeTextBinding^ myMimeTextBinding1 = gcnew MimeTextBinding; + + // + // + // + // + // + // Get an instance of 'MimeTextMatchCollection'. + MimeTextMatchCollection^ myMimeTextMatchCollection1 = gcnew MimeTextMatchCollection; + array^myMimeTextMatch1 = gcnew array(5); + myMimeTextMatchCollection1 = myMimeTextBinding1->Matches; + for ( myInt = 0; myInt < 4; myInt++ ) + { + myMimeTextMatch1[ myInt ] = gcnew MimeTextMatch; + myMimeTextMatch1[ myInt ]->Name = String::Format( "Title{0}", Convert::ToString( myInt ) ); + if ( myInt != 0 ) + { + myMimeTextMatch1[ myInt ]->RepeatsString = "7"; + } + myMimeTextMatchCollection1->Add( myMimeTextMatch1[ myInt ] ); + } + myMimeTextMatch1[ 4 ] = gcnew MimeTextMatch; + + // Remove 'MimeTextMatch' instance from collection. + myMimeTextMatchCollection1->Remove( myMimeTextMatch1[ 1 ] ); + + // Using MimeTextMatchCollection.Item indexer to comapre. + if ( myMimeTextMatch1[ 2 ] == myMimeTextMatchCollection1[ 1 ] ) + { + // Check whether 'MimeTextMatch' instance exists. + myInt = myMimeTextMatchCollection1->IndexOf( myMimeTextMatch1[ 2 ] ); + + // Insert 'MimeTextMatch' instance at a desired position. + myMimeTextMatchCollection1->Insert( 1, myMimeTextMatch1[ myInt ] ); + myMimeTextMatchCollection1[ 1 ]->RepeatsString = "5"; + myMimeTextMatchCollection1->Insert( 4, myMimeTextMatch1[ myInt ] ); + } + // + // + // + // + // + // + + myOutputBinding->Extensions->Add( myMimeTextBinding1 ); + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutputBinding; + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutputBinding; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myServiceDescription->Bindings->Add( myBinding ); + + // Write the 'ServiceDescription' as a WSDL file. + myServiceDescription->Write( "MimeText_Match_MatchColl_9_Output_CPP.wsdl" ); + Console::WriteLine( "WSDL file with name 'MimeText_Match_MatchColl_9_Output_CPP.wsdl' is" + " created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp b/snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp new file mode 100644 index 00000000000..0cb0a7cb654 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/MimeXmlBinding_Part_3/CPP/mimexmlbinding_part_3.cpp @@ -0,0 +1,93 @@ + + +// System.Web.Services.Description.MimeXmlBinding +// System.Web.Services.Description.MimeXmlBinding.MimeXmlBinding() +// System.Web.Services.Description.MimeXmlBinding.Part +/* The following program demonstrates constructor and 'Part'property +of 'MimeXmlBinding' class. This program takes 'MimeXmlBinding_Part_3_Input_CPP.wsdl' +as input, which does not contain 'Binding' object that supports 'HttpPost'. +It sets message part property to 'Body' on which 'MimeXmlBinding' is +applied and finally writes into 'MimeXmlBinding_Part_3_Output_CPP.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "MimeXmlBinding_Part_3_Input_CPP.wsdl" ); + + // Create the 'Binding' object. + Binding^ myBinding = gcnew Binding; + + // Initialize 'Name' property of 'Binding' class. + myBinding->Name = "MimeXmlBinding_Part_3_ServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MimeXmlBinding_Part_3_ServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + + // Create the 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + + // Create the 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; + myHttpOperationBinding->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myHttpOperationBinding ); + + // Create the 'InputBinding' object. + InputBinding^ myInputBinding = gcnew InputBinding; + MimeContentBinding^ myMimeContentBinding = gcnew MimeContentBinding; + myMimeContentBinding->Type = "application/x-www-form-urlencoded"; + myInputBinding->Extensions->Add( myMimeContentBinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + + // + // + // Create an OutputBinding. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + MimeXmlBinding^ myMimeXmlBinding = gcnew MimeXmlBinding; + + // Initialize the Part property of the MimeXmlBinding. + myMimeXmlBinding->Part = "Body"; + + // Add the MimeXmlBinding to the OutputBinding. + myOutputBinding->Extensions->Add( myMimeXmlBinding ); + // + // + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutputBinding; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "MimeXmlBinding_Part_3_Output_CPP.wsdl" ); + Console::WriteLine( "WSDL file with name 'MimeXmlBinding_Part_3_Output_CPP.wsdl' is" + " created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp new file mode 100644 index 00000000000..6fdfe8f6904 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLAutoProxy/CPP/proxy.cpp @@ -0,0 +1,235 @@ + + +#using + +using namespace System; +using namespace System::Net; + +// +// The following method displays the properties of the +// specified WebProxy instance. +void DisplayProxyProperties( WebProxy^ proxy ) +{ + Console::WriteLine( "Address: {0}", proxy->Address ); + Console::WriteLine( "Bypass on local: {0}", proxy->BypassProxyOnLocal ); + + int count = proxy->BypassList->Length; + if ( count == 0 ) + { + Console::WriteLine( "The bypass list is empty." ); + return; + } + + array^bypass = proxy->BypassList; + Console::WriteLine( "The bypass list contents:" ); + for ( int i = 0; i < count; i++ ) + { + Console::WriteLine( bypass[ i ] ); + + } +} +// + +// +// The following method creates a Web proxy that uses +// Web proxy auto-discovery and supplies +// credentials to be used to download the wpad.dat script. +void CheckAutoProxyForRequest( Uri^ resource ) +{ + WebProxy^ proxy = gcnew WebProxy; + + // See what proxy is used for the resource. + Uri^ resourceProxy = proxy->GetProxy( resource ); + + // Test to see if a proxy was selected. + if ( resourceProxy == resource ) + { + Console::WriteLine( "No proxy for {0}", resource ); + } + else + { + Console::WriteLine( "Proxy for {0} is {1}", + resource, resourceProxy ); + } +} +// + +// +// The following method creates a WebProxy object that uses Internet Explorer's +// detected script if it is found in the registry; otherwise, it +// tries to use Web proxy auto-discovery to set the proxy used for +// the request. +void CheckAutoGlobalProxyForRequest( Uri^ resource ) +{ + WebProxy^ proxy = gcnew WebProxy; + + // Display the proxy's properties. + DisplayProxyProperties( proxy ); + + // See what proxy is used for the resource. + Uri^ resourceProxy = proxy->GetProxy( resource ); + + // Test to see whether a proxy was selected. + if ( resourceProxy == resource ) + { + Console::WriteLine( "No proxy for {0}", resource ); + } + else + { + Console::WriteLine( "Proxy for {0} is {1}", resource, resourceProxy ); + } +} +// + +// The following method creates a Web proxy that +// has its initial values set by the Internet Explorer's +// explicit proxy address and bypass list. +// The proxy uses Internet Explorer's automatically detected +// script if it found in the registry; otherwise, it tries to use +// Web proxy auto-discovery to set the proxy used for +// the request. +void CheckAutoDefaultProxyForRequest( Uri^ resource ) +{ + WebProxy^ proxy = dynamic_cast(WebRequest::DefaultWebProxy); + + // Display the proxy properties. + DisplayProxyProperties( proxy ); + + // See what proxy is used for resource. + Uri^ resourceProxy = proxy->GetProxy( resource ); + + // Test to see if a proxy was selected. + if ( resourceProxy == resource ) + { + Console::WriteLine( "No proxy for {0}", resource ); + } + else + { + Console::WriteLine( "Proxy for {0} is {1}", resource, resourceProxy ); + } +} + +// +// This method specifies a script that should +// be used in the event that auto-discovery fails. +void CheckAutoProxyAndScriptForRequest( Uri^ resource, Uri^ script ) +{ + WebProxy^ proxy = gcnew WebProxy; + DisplayProxyProperties( proxy ); + + // See what proxy is used for resource. + Uri^ resourceProxy = dynamic_cast(proxy->GetProxy(resource)); + + // Test to see whether a proxy was selected. + if ( resourceProxy == resource ) + { + Console::WriteLine( "No proxy for {0}", resource ); + } + else + { + Console::WriteLine( "Proxy for {0} is {1}", resource, resourceProxy ); + } +} +// + +// if construct with glocabl select +// if use system = true then if proxy = Glocalproxy.Select - the returned instance +// will have its values set +// by IE settings. If you do webProxy get default roxy reads manual setting (proxy address and +// bypass - doesn't matter what the config file has. +// +// The following method explicitly identifies +// the script to be downloaded and used to select the proxy. +void CheckScriptedProxyForRequest( Uri^ resource, Uri^ script ) +{ + WebProxy^ proxy = gcnew WebProxy; + + // See what proxy is used for resource. + Uri^ resourceProxy = dynamic_cast(proxy->GetProxy(resource)); + + // Test to see whether a proxy was selected. + if ( resourceProxy == nullptr ) + { + Console::WriteLine( "No proxy selected for {0}.", resource ); + return; + } + else + { + Console::WriteLine( "proxy returned for {0}.", resource ); + { + + // DIRECT in script is returned as a null Uri object. + if ( resourceProxy == nullptr ) + Console::WriteLine( "DIRECT" ); + else + Console::WriteLine( "{0}", resourceProxy ); + + } + } +} +// + +// +WebResponse^ CheckLatestScriptRequest( Uri^ resource, WebProxy^ proxy ) +{ + WebRequest^ request = WebRequest::Create( resource ); + request->Proxy = proxy; + WebResponse^ response = request->GetResponse(); + return response; +} +// + +void CheckScriptedProxyForRequest2( Uri^ resource, Uri^ script ) +{ + WebProxy^ proxy = gcnew WebProxy; + + // if use ssystem = true then if proxy = Glocalproxy.Select - the returned instance + // will have its values set + // by IE settings. If you do webProxy get defaultProxy reads manual setting (proxy address and + // bypass - doesn't matter what the config file has. + + // if construct with global select + + // See what proxy is used for resource. + Uri^ resourceProxy = proxy->GetProxy( resource ); + Console::WriteLine( "GetProxy returned for {0} is {1}.", resource, resourceProxy ); + + +} + +void Underline() +{ + Console::WriteLine( "=======================================" ); +} + +int main() +{ + Uri^ resource = gcnew Uri( "http://www.example.com" ); + + // Console.WriteLine("nothing - default ctor"); Underline(); + // DisplayProxyProperties(new WebProxy()); + // Console.WriteLine ("\n\nAuto-only - default ctor"); Underline(); + // CheckAutoProxyForRequest(resource); + Console::WriteLine( "\n\nAuto-only - GlobalProxySelection.Select" ); + Underline(); + CheckAutoGlobalProxyForRequest( resource ); + + /* + Console.WriteLine ("\n\nAuto-only - DefaultProxy"); Underline(); + CheckAutoDefaultProxyForRequest(resource); + */ + // Console.WriteLine("\n\n IE auto + Valid Script-only"); + // CheckScriptedProxyForRequest(resource, new Uri("http://sharriso1/wpad.dat")); + // Console.WriteLine("\n\n IE auto Invalid Script-only"); + // CheckScriptedProxyForRequest(resource, new Uri("http://sharriso1/wpadx.dat")); + /* Console.WriteLine("Auto and Valid script"); + CheckAutoProxyAndScriptForRequest(resource, new Uri("http://sharriso1/wpad.dat")); + + Console.WriteLine("Auto and Invalid script"); + CheckAutoProxyAndScriptForRequest(resource, new Uri("http://sharriso1/wpadx.dat")); + */ + // check snippet 5 + // CheckLatestScriptRequest(resource, WebProxy.GetDefaultProxy()); + // check snippet 6 + //CheckAutoProxyForRequest( resource); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp new file mode 100644 index 00000000000..18275c877c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLCookies/CPP/cookiessnippets.cpp @@ -0,0 +1,77 @@ + + +// +#using + +using namespace System; +using namespace System::Net; + +// This example is run at the command line. +// Specify one argument: the name of the host to +// send the request to. +// If the request is sucessful, the example displays the contents of the cookies +// returned by the host. +// +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args == nullptr || args->Length != 2 ) + { + Console::WriteLine( "Specify the URL to receive the request." ); + Environment::Exit( 1 ); + } + + + // + HttpWebRequest^ request = dynamic_cast(WebRequest::Create( args[ 1 ] )); + request->CookieContainer = gcnew CookieContainer; + HttpWebResponse^ response = dynamic_cast(request->GetResponse()); + response->Cookies = request->CookieContainer->GetCookies( request->RequestUri ); + + // Print the properties of each cookie. + System::Collections::IEnumerator^ myEnum = response->Cookies->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Cookie^ cook = safe_cast(myEnum->Current); + Console::WriteLine( "Cookie:" ); + Console::WriteLine( "{0} = {1}", cook->Name, cook->Value ); + Console::WriteLine( "Domain: {0}", cook->Domain ); + Console::WriteLine( "Path: {0}", cook->Path ); + Console::WriteLine( "Port: {0}", cook->Port ); + Console::WriteLine( "Secure: {0}", cook->Secure ); + Console::WriteLine( "When issued: {0}", cook->TimeStamp ); + Console::WriteLine( "Expires: {0} (expired? {1})", cook->Expires, cook->Expired ); + Console::WriteLine( "Don't save: {0}", cook->Discard ); + Console::WriteLine( "Comment: {0}", cook->Comment ); + Console::WriteLine( "Uri for comments: {0}", cook->CommentUri ); + Console::WriteLine( "Version: RFC {0}", cook->Version == 1 ? (String^)"2109" : "2965" ); + + // + // Show the string representation of the cookie. + Console::WriteLine( "String: {0}", cook ); + + // + } + // + +} + +// +// Output from this example will be vary depending on the host name specified, +// but will be similar to the following. +/* +Cookie: +CustomerID = 13xyz +Domain: .contoso.com +Path: / +Port: +Secure: False +When issued: 1/14/2003 3:20:57 PM +Expires: 1/17/2013 11:14:07 AM (expired? False) +Don't save: False +Comment: +Uri for comments: +Version: RFC 2965 +String: CustomerID = 13xyz +*/ +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp new file mode 100644 index 00000000000..848433c877c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLCredPolicy/CPP/NCLCredPolicy.cpp @@ -0,0 +1,249 @@ + +// NCLCredPolicy +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::IO; +using namespace System::Text; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace Microsoft::Win32; + +// +public ref class SelectedHostsCredentialPolicy: public ICredentialPolicy +{ +public: + SelectedHostsCredentialPolicy(){} + + virtual bool ShouldSendCredential( Uri^ challengeUri, WebRequest^ request, NetworkCredential^ /*credential*/, IAuthenticationModule^ /*authModule*/ ) + { + Console::WriteLine( L"Checking custom credential policy." ); + if ( request->RequestUri->Host->Equals( L"www.contoso.com" ) || challengeUri->IsLoopback ) + return true; + + return false; + } +}; +// + +// +// The following class allows credentials to be sent if they are for requests for resources +// in the same domain, or if the request uses the HTTPSscheme and basic authentication is +// required. +public ref class HttpsBasicCredentialPolicy: public IntranetZoneCredentialPolicy +{ +public: + HttpsBasicCredentialPolicy(){} + + virtual bool ShouldSendCredential( Uri^ challengeUri, WebRequest^ request, NetworkCredential^ credential, IAuthenticationModule^ authModule ) override + { + Console::WriteLine( L"Checking custom credential policy for HTTPS and basic." ); + bool answer = IntranetZoneCredentialPolicy::ShouldSendCredential( challengeUri, request, credential, authModule ); + if ( answer ) + { + Console::WriteLine( L"Sending credential for intranet resource." ); + return answer; + } + + // Determine whether the base implementation returned false for basic and HTTPS. + if ( request->RequestUri->Scheme == Uri::UriSchemeHttps && authModule->AuthenticationType->Equals( L"Basic" ) ) + { + Console::WriteLine( L"Sending credential for HTTPS and basic." ); + return true; + } + + return false; + } +}; +// + +public ref class CredentialPolicyExamples +{ +public: + static void UseHttpsBasicCredentialPolicy() + { + HttpsBasicCredentialPolicy^ encryptedBasic = gcnew HttpsBasicCredentialPolicy; + AuthenticationManager::CredentialPolicy = encryptedBasic; + } + + static void UseCustomCredentialPolicy() + { + SelectedHostsCredentialPolicy^ hosts = gcnew SelectedHostsCredentialPolicy; + AuthenticationManager::CredentialPolicy = hosts; + } + + // + static void UseIntranetCredentialPolicy() + { + IntranetZoneCredentialPolicy^ policy = gcnew IntranetZoneCredentialPolicy; + AuthenticationManager::CredentialPolicy = policy; + } + // + + // + // The following example uses the System, System.Net, + // and System.IO namespaces. + static void RequestMutualAuth( Uri^ resource ) + { + // Create a new HttpWebRequest object for the specified resource. + WebRequest^ request = dynamic_cast(WebRequest::Create( resource )); + + // Request mutual authentication. + request->AuthenticationLevel = AuthenticationLevel::MutualAuthRequested; + + // Supply client credentials. + request->Credentials = CredentialCache::DefaultCredentials; + HttpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // Determine whether mutual authentication was used. + Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated ); + + // Read and display the response. + Stream^ streamResponse = response->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + String^ responseString = streamRead->ReadToEnd(); + Console::WriteLine( responseString ); + + // Close the stream objects. + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse. + response->Close(); + } + // + + +private: + + static String^ GetUserName() + { + return L"sharriso1\\Jane"; + } + + static String^ GetUserPassword() + { + return L"LXMP9804!"; + } + +public: + ref class HttpsBasicCredentialOnlyPolicy: public ICredentialPolicy + { + public: + HttpsBasicCredentialOnlyPolicy(){} + + virtual bool ShouldSendCredential( Uri^ /*challengeUri*/, WebRequest^ request, NetworkCredential^ /*credential*/, IAuthenticationModule^ authModule ) + { + Console::WriteLine( L"Checking custom credential policy for HTTPS and basic." ); + + // Determine whether the base implementation returned false for basic and https. + if ( request->RequestUri->Scheme == Uri::UriSchemeHttps && authModule->AuthenticationType->Equals( L"Basic" ) ) + { + Console::WriteLine( L"Sending credential for HTTPS and basic." ); + return true; + } + + return false; + } + + }; + + static void RequestHttpBasicResource( Uri^ resource ) + { + // Set policy to send credentials when using HTTPS and basic authentication; + HttpsBasicCredentialOnlyPolicy^ encryptedBasic = gcnew HttpsBasicCredentialOnlyPolicy; + AuthenticationManager::CredentialPolicy = encryptedBasic; + + // Create a new HttpWebRequest object for the specified resource. + WebRequest^ request = dynamic_cast(WebRequest::Create( resource )); + + // Supply client credentials for basic authentication. + request->Credentials = gcnew NetworkCredential( GetUserName(),GetUserPassword() ); + HttpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // Determine whether mutual authentication was used. + Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated ); + + // Read and display the response. + System::IO::Stream^ streamResponse = response->GetResponseStream(); + System::IO::StreamReader^ streamRead = gcnew System::IO::StreamReader( streamResponse ); + String^ responseString = streamRead->ReadToEnd(); + Console::WriteLine( responseString ); + + // Close the stream objects. + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse. + response->Close(); + } + + // + static void RequestResource( Uri^ resource ) + { + // Set policy to send credentials when using HTTPS and basic authentication. + // Create a new HttpWebRequest object for the specified resource. + WebRequest^ request = dynamic_cast(WebRequest::Create( resource )); + + // Supply client credentials for basic authentication. + request->UseDefaultCredentials = true; + request->AuthenticationLevel = AuthenticationLevel::MutualAuthRequired; + HttpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // Determine mutual authentication was used. + Console::WriteLine( L"Is mutually authenticated? {0}", response->IsMutuallyAuthenticated ); + System::Collections::Specialized::StringDictionary^ spnDictionary = AuthenticationManager::CustomTargetNameDictionary; + System::Collections::IEnumerator^ myEnum = spnDictionary->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ e = safe_cast(myEnum->Current); + Console::WriteLine( "Key: {0} - {1}", dynamic_cast(e->Key), dynamic_cast(e->Value) ); + } + + // Read and display the response. + System::IO::Stream^ streamResponse = response->GetResponseStream(); + System::IO::StreamReader^ streamRead = gcnew System::IO::StreamReader( streamResponse ); + String^ responseString = streamRead->ReadToEnd(); + Console::WriteLine( responseString ); + + // Close the stream objects. + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse. + response->Close(); + } + + /* + + The output from this example will differ based on the requested resource + and whether mutual authentication was successful. For the purpose of illustration, + a sample of the output is shown here: + + Is mutually authenticated? True + Key: http://server1.someDomain.contoso.com - HTTP/server1.someDomain.contoso.com + + + ... + + + */ + // + int TestCredentialPolicy() + { + // UseCustomCredentialPolicy(); + //RequestMutualAuth(new Uri("http://wasabi/noribeta/NamespaceExceptionReport.aspx?Namespace=System.Net")); + //RequestMutualAuth(new Uri("http://sharriso1/test/postaccepter.aspx")); + // RequestResource(new Uri("http://sharriso1.redmond.corp.microsoft.com/test/postaccepter.aspx")); + RequestResource( gcnew Uri( L"http://www.google.com" ) ); + return 1; + } +}; + +void main() +{ + CredentialPolicyExamples^ cpe = gcnew CredentialPolicyExamples; + cpe->TestCredentialPolicy(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp new file mode 100644 index 00000000000..57313e17fac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp @@ -0,0 +1,188 @@ + + +//NCLCustomWebClient +#using + +using namespace System; +using namespace System::Net; + +public ref class CustomWebClient: public WebClient +{ +protected: + + // + virtual WebRequest^ GetWebRequest ( Uri^ address ) override + { + WebRequest^ request = dynamic_cast(WebClient::GetWebRequest( address )); + + // Perform any customizations on the request. + // This version of WebClient always preauthenticates. + request->PreAuthenticate = true; + return request; + } + // + + // + virtual WebResponse^ GetWebResponse( WebRequest^ request ) override + { + WebResponse^ response = WebClient::GetWebResponse( request ); + + // Perform any custom actions with the response ... + return response; + } + // + + // + virtual WebResponse^ GetWebResponse( WebRequest^ request, IAsyncResult^ result ) override + { + WebResponse^ response = WebClient::GetWebResponse( request, result ); + + // Perform any custom actions with the response ... + return response; + } + // + + // + virtual void OnDownloadDataCompleted( DownloadDataCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnDownloadDataCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnDownloadFileCompleted( System::ComponentModel::AsyncCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnDownloadFileCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnDownloadStringCompleted( DownloadStringCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnDownloadStringCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnOpenReadCompleted( OpenReadCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnOpenReadCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnOpenWriteCompleted( OpenWriteCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnOpenWriteCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnUploadDataCompleted( UploadDataCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnUploadDataCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnUploadFileCompleted( UploadFileCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnUploadFileCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnUploadStringCompleted( UploadStringCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnUploadStringCompleted( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnDownloadProgressChanged( DownloadProgressChangedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnDownloadProgressChanged( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnUploadProgressChanged( UploadProgressChangedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnUploadProgressChanged( e ); + + // Here you can perform any post event actions... + } + // + + // + virtual void OnUploadValuesCompleted( UploadValuesCompletedEventArgs ^ e ) override + { + // Here you can perform any custom actions before the event is raised + // and event handlers are called... + WebClient::OnUploadValuesCompleted( e ); + + // Here you can perform any post event actions... + } + // +}; + +int main() +{ + CustomWebClient^ newClient = gcnew CustomWebClient; +} + +// Output from this example will be vary depending on the host name specified, +// but will be similar to the following. +/* +Cookie: +CustomerID = 13xyz +Domain: .contoso.com +Path: / +Port: +Secure: False +When issued: 1/14/2003 3:20:57 PM +Expires: 1/17/2013 11:14:07 AM (expired? False) +Don't save: False +Comment: +Uri for comments: +Version: RFC 2965 +String: CustomerID = 13xyz +*/ diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp new file mode 100644 index 00000000000..6a13836357f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLEmptyWebProxy/CPP/test.cpp @@ -0,0 +1,31 @@ +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +int main() +{ + + // Create a request for the Web page at www.contoso.com. + WebRequest^ request = WebRequest::Create( L"http://www.contoso.com" ); + + // This application doesn't want they proxy to be used so it sets + // the global proxy to an empy proxy. + IWebProxy^ myProxy = GlobalProxySelection::GetEmptyWebProxy(); + + // Get the response. + WebResponse^ response = request->GetResponse(); + + // Display the response to the console. + Stream^ stream = response->GetResponseStream(); + StreamReader^ reader = gcnew StreamReader( stream ); + Console::WriteLine( reader->ReadToEnd() ); + + // Clean up. + reader->Close(); + stream->Close(); + response->Close(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp new file mode 100644 index 00000000000..e507d6263b9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLFtpAsync/CPP/async.cpp @@ -0,0 +1,227 @@ + + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Threading; +using namespace System::IO; + +// +public ref class FtpState +{ +private: + ManualResetEvent^ wait; + FtpWebRequest^ request; + String^ fileName; + Exception^ operationException; + String^ status; + +public: + FtpState() + { + wait = gcnew ManualResetEvent( false ); + } + + property ManualResetEvent^ OperationComplete + { + ManualResetEvent^ get() + { + return wait; + } + + } + + property FtpWebRequest^ Request + { + FtpWebRequest^ get() + { + return request; + } + + void set( FtpWebRequest^ value ) + { + request = value; + } + + } + + property String^ FileName + { + String^ get() + { + return fileName; + } + + void set( String^ value ) + { + fileName = value; + } + + } + + property Exception^ OperationException + { + Exception^ get() + { + return operationException; + } + + void set( Exception^ value ) + { + operationException = value; + } + + } + + property String^ StatusDescription + { + String^ get() + { + return status; + } + + void set( String^ value ) + { + status = value; + } + + } +}; +// + +// +public ref class AsynchronousFtpUpLoader +{ +public: + + // + // Command line arguments are two strings: + // 1. The url that is the name of the file being uploaded to the server. + // 2. The name of the file on the local machine. + // + static void Main() + { + array^args = Environment::GetCommandLineArgs(); + + // Create a Uri instance with the specified URI string. + // If the URI is not correctly formed, the Uri constructor + // will throw an exception. + ManualResetEvent^ waitObject; + Uri^ target = gcnew Uri( args[ 1 ] ); + String^ fileName = args[ 2 ]; + FtpState^ state = gcnew FtpState; + FtpWebRequest ^ request = dynamic_cast(WebRequest::Create( target )); + request->Method = WebRequestMethods::Ftp::UploadFile; + + // This example uses anonymous logon. + // The request is anonymous by default; the credential does not have to be specified. + // The example specifies the credential only to + // control how actions are logged on the server. + request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); + + // Store the request in the object that we pass into the + // asynchronous operations. + state->Request = request; + state->FileName = fileName; + + // Get the event to wait on. + waitObject = state->OperationComplete; + + // Asynchronously get the stream for the file contents. + request->BeginGetRequestStream( gcnew AsyncCallback( EndGetStreamCallback ), state ); + + // Block the current thread until all operations are complete. + waitObject->WaitOne(); + + // The operations either completed or threw an exception. + if ( state->OperationException != nullptr ) + { + throw state->OperationException; + } + else + { + Console::WriteLine( "The operation completed - {0}", state->StatusDescription ); + } + } + // + + // +private: + static void EndGetStreamCallback( IAsyncResult^ ar ) + { + FtpState^ state = dynamic_cast(ar->AsyncState); + Stream^ requestStream = nullptr; + + // End the asynchronous call to get the request stream. + try + { + requestStream = state->Request->EndGetRequestStream( ar ); + + // Copy the file contents to the request stream. + const int bufferLength = 2048; + array^buffer = gcnew array(bufferLength); + int count = 0; + int readBytes = 0; + FileStream^ stream = File::OpenRead( state->FileName ); + do + { + readBytes = stream->Read( buffer, 0, bufferLength ); + requestStream->Write( buffer, 0, bufferLength ); + count += readBytes; + } + while ( readBytes != 0 ); + Console::WriteLine( "Writing {0} bytes to the stream.", count ); + + // IMPORTANT: Close the request stream before sending the request. + requestStream->Close(); + + // Asynchronously get the response to the upload request. + state->Request->BeginGetResponse( gcnew AsyncCallback( EndGetResponseCallback ), state ); + } + // Return exceptions to the main application thread. + catch ( Exception^ e ) + { + Console::WriteLine( "Could not get the request stream." ); + state->OperationException = e; + state->OperationComplete->Set(); + return; + } + } + // + + // + // The EndGetResponseCallback method + // completes a call to BeginGetResponse. + static void EndGetResponseCallback( IAsyncResult^ ar ) + { + FtpState^ state = dynamic_cast(ar->AsyncState); + FtpWebResponse ^ response = nullptr; + try + { + response = dynamic_cast(state->Request->EndGetResponse( ar )); + response->Close(); + state->StatusDescription = response->StatusDescription; + + // Signal the main application thread that + // the operation is complete. + state->OperationComplete->Set(); + } + // Return exceptions to the main application thread. + catch ( Exception^ e ) + { + Console::WriteLine( "Error getting response." ); + state->OperationException = e; + state->OperationComplete->Set(); + } + } + // +}; +// + +int main() +{ + AsynchronousFtpUpLoader::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp new file mode 100644 index 00000000000..1e751d2630a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLFtpClient/CPP/ftptests.cpp @@ -0,0 +1,842 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +using namespace System::IO; +using namespace System::Threading; +using namespace System::Security::Cryptography::X509Certificates; + +public ref class FtpRequestTest +{ +private: + + // FxCop rule requires a private constructor. + FtpRequestTest(){} + + +public: + + // + static bool ListFilesOnServer( Uri^ serverUri ) + { + // The serverUri should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::ListDirectory; + + // Get the ServicePoint object used for this request, and limit it to one connection. + // In a real-world application you might use the default number of connections (2), + // or select a value that works best for your application. + ServicePoint^ sp = request->ServicePoint; + Console::WriteLine( "ServicePoint connections = {0}.", sp->ConnectionLimit ); + sp->ConnectionLimit = 1; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // The following streams are used to read the data returned from the server. + Stream^ responseStream = nullptr; + StreamReader^ readStream = nullptr; + try + { + responseStream = response->GetResponseStream(); + readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); + if ( readStream != nullptr ) + { + // Display the data received from the server. + Console::WriteLine( readStream->ReadToEnd() ); + } + + Console::WriteLine( "List status: {0}", response->StatusDescription ); + } + finally + { + if ( readStream != nullptr ) + { + readStream->Close(); + } + + if ( response != nullptr ) + { + response->Close(); + } + } + + return true; + } + // + + // new content + // + static bool NameListFilesOnServer( Uri^ serverUri ) + { + // The serverUri should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::ListDirectoryDetails; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // The following streams are used to read the data returned from the server. + Stream^ responseStream = nullptr; + StreamReader^ readStream = nullptr; + try + { + responseStream = response->GetResponseStream(); + readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); + if ( readStream != nullptr ) + { + // Display the data received from the server. + Console::WriteLine( readStream->ReadToEnd() ); + } + + Console::WriteLine( "Status: {0}", response->StatusDescription ); + } + finally + { + if ( readStream != nullptr ) + { + readStream->Close(); + } + + if ( response != nullptr ) + { + response->Close(); + } + } + + return true; + } + // + + // + static bool GetDateTimestampOnServer( Uri^ serverUri ) + { + // The serverUri should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::GetDateTimestamp; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "{0} {1}", serverUri, response->LastModified ); + + // The output from this method will vary depening on the + // file specified and your regional settings. It is similar to: + // ftp://contoso.com/Data.txt 4/15/2003 10:46:02 AM + return true; + } + // + + // + static bool MakeDirectoryOnServer( Uri^ serverUri ) + { + // The serverUri should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::MakeDirectory; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "Status: {0}", response->StatusDescription ); + return true; + } + // + + // + static bool UploadUniqueFileOnServer( Uri^ serverUri, String^ fileName ) + { + // The URI described by serverUri should use the ftp:// scheme. + // It contains the name of the directory on the server. + // Example: ftp://contoso.com. + // + // The fileName parameter identifies the file containing the data to be uploaded. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::UploadFileWithUniqueName; + + // Don't set a time limit for the operation to complete. + request->Timeout = System::Threading::Timeout::Infinite; + + // Copy the file contents to the request stream. + const int bufferLength = 2048; + array^buffer = gcnew array(bufferLength); + int count = 0; + int readBytes = 0; + FileStream^ stream = File::OpenRead( fileName ); + Stream^ requestStream = request->GetRequestStream(); + do + { + readBytes = stream->Read( buffer, 0, bufferLength ); + requestStream->Write( buffer, 0, bufferLength ); + count += readBytes; + } + while ( readBytes != 0 ); + + Console::WriteLine( "Writing {0} bytes to the stream.", count ); + + // IMPORTANT: Close the request stream before sending the request. + requestStream->Close(); + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "Upload status: {0}, {1}", response->StatusCode, response->StatusDescription ); + Console::WriteLine( "File name: {0}", response->ResponseUri ); + response->Close(); + return true; + } + // + + // + static bool RemoveDirectoryOnServer( Uri^ serverUri ) + { + // The serverUri should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::RemoveDirectory; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "Status: {0}", response->StatusDescription ); + return true; + } + // + + // + static bool UploadFileToServer( String^ fileName, Uri^ serverUri ) + { + // The URI described by serverUri should use the ftp:// scheme. + // It contains the name of the file on the server. + // Example: ftp://contoso.com/someFile.txt. + // + // The fileName parameter identifies the file containing the data to be uploaded. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::UploadFile; + + // Don't set a time limit for the operation to complete. + request->Timeout = System::Threading::Timeout::Infinite; + + // Copy the file contents to the request stream. + const int bufferLength = 2048; + array^buffer = gcnew array(bufferLength); + int count = 0; + int readBytes = 0; + FileStream^ stream = File::OpenRead( fileName ); + Stream^ requestStream = request->GetRequestStream(); + do + { + readBytes = stream->Read( buffer, 0, bufferLength ); + requestStream->Write( buffer, 0, bufferLength ); + count += readBytes; + } + while ( readBytes != 0 ); + + Console::WriteLine( "Writing {0} bytes to the stream.", count ); + + // IMPORTANT: Close the request stream before sending the request. + requestStream->Close(); + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "Upload status: {0}, {1}", response->StatusCode, response->StatusDescription ); + response->Close(); + return true; + } + // + + // + static bool AppendFileOnServer( String^ fileName, Uri^ serverUri ) + { + // The URI described by serverUri should use the ftp:// scheme. + // It contains the name of the file on the server. + // Example: ftp://contoso.com/someFile.txt. + // The fileName parameter identifies the file containing + // the data to be appended to the file on the server. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::AppendFile; + StreamReader^ sourceStream = gcnew StreamReader( fileName ); + array^fileContents = Encoding::UTF8->GetBytes( sourceStream->ReadToEnd() ); + sourceStream->Close(); + request->ContentLength = fileContents->Length; + + // This example assumes the FTP site uses anonymous logon. + request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); + Stream^ requestStream = request->GetRequestStream(); + requestStream->Write( fileContents, 0, fileContents->Length ); + requestStream->Close(); + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "Append status: {0}", response->StatusDescription ); + response->Close(); + return true; + } + // + + // + static bool DeleteFileOnServer( Uri^ serverUri ) + { + // The serverUri parameter should use the ftp:// scheme. + // It contains the name of the server file that is to be deleted. + // Example: ftp://contoso.com/someFile.txt. + // + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::DeleteFile; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "Delete status: {0}", response->StatusDescription ); + response->Close(); + return true; + } + // + + // + static bool DisplayFileFromServer( Uri^ serverUri ) + { + // The serverUri parameter should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + WebClient^ request = gcnew WebClient; + + // This example assumes the FTP site uses anonymous logon. + request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); + try + { + array^newFileData = request->DownloadData( serverUri->ToString() ); + String^ fileString = System::Text::Encoding::UTF8->GetString( newFileData ); + Console::WriteLine( fileString ); + } + catch ( WebException^ e ) + { + Console::WriteLine( e ); + } + + return true; + } + // + + + // +private: + // DisplayRequestProperties prints a request's properties. + // This method should be called after the request is sent to the server. + static void DisplayRequestProperties( FtpWebRequest^ request ) + { + // + Console::WriteLine( "User {0} {1}", request->Credentials->GetCredential( request->RequestUri, "basic" )->UserName, request->RequestUri ); + + // + Console::WriteLine( "Request: {0} {1}", request->Method, request->RequestUri ); + + // + Console::WriteLine( "Passive: {0} Keep alive: {1} Binary: {2} Timeout: {3}.", request->UsePassive, request->KeepAlive, request->UseBinary, request->Timeout == -1 ? "none" : request->Timeout.ToString() ); + + // + // + IWebProxy^ proxy = request->Proxy; + if ( proxy ) + { + Console::WriteLine( "Proxy: {0}", proxy->GetProxy( request->RequestUri ) ); + } + else + { + Console::WriteLine( "Proxy: (none)" ); + } + + Console::WriteLine( "ConnectionGroup: {0}", request->ConnectionGroupName == nullptr ? "none" : request->ConnectionGroupName ); + // + + Console::WriteLine( "Encrypted connection: {0}", request->EnableSsl ); + + Console::WriteLine("Method: {0}", request->Method); + } + // + + // +public: + // NOT Working - throws a protocolError - 350 Restarting at 8. for args shown in Main. + static bool RestartDownloadFromServer( String^ fileName, Uri^ serverUri, long offset ) + { + // The serverUri parameter should use the ftp:// scheme. + // It identifies the server file that is to be appended. + // Example: ftp://contoso.com/someFile.txt. + // + // The fileName parameter identifies the local file + // + // The offset parameter specifies where in the server file to start reading data. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::DownloadFile; + request->ContentOffset = offset; + FtpWebResponse^ response = nullptr; + try + { + response = dynamic_cast(request->GetResponse()); + } + catch ( WebException^ e ) + { + Console::WriteLine( e->Status ); + Console::WriteLine( e->Message ); + return false; + } + + Stream^ newFile = response->GetResponseStream(); + StreamReader^ reader = gcnew StreamReader( newFile ); + + // Display downloaded data. + String^ newFileData = reader->ReadToEnd(); + + // Append the response data to the local file + // using a StreamWriter. + StreamWriter^ writer = File::AppendText(fileName); + writer->Write(newFileData); + + // Display the status description. + + // Cleanup. + writer->Close(); + reader->Close(); + response->Close(); + // string fileString = System.Text.Encoding.UTF8.GetString(newFileData); + // Console::WriteLine( sr ); + Console::WriteLine("Download restart - status: {0}",response->StatusDescription); + return true; + } + // + + // not enabled in M2 + // Sample call: SendCommandToServer("ftp://contoso.com/", "pwd"); + // The output can only return status information. + static bool SendCommandToServer( String^ serverUri, String^ command ) + { + // The serverUri parameter should start with the ftp:// scheme. + // It contains the name of the file on the server that will be appended. + // Example: ftp://contoso.com/someFile.txt. + // + // The command parameter identifies the command to send to the server. + if ( !serverUri->ToLower()->StartsWith( Uri::UriSchemeFtp ) ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = command; + + // This example assumes the FTP site uses anonymous logon. + request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "{0} status: {1}", command, response->StatusDescription ); + response->Close(); + return true; + } + + // + static bool DownloadFileFromServer( Uri^ serverUri, String^ localFileName ) + { + // The serverUri parameter should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + // Note that the cast to FtpWebRequest is done only + // for the purposes of illustration. If your application + // does not set any properties other than those defined in the + // System.Net.WebRequest class, you can use the following line instead: + // WebRequest request = WebRequest.Create(serverUri); + // + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::DownloadFile; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Stream^ responseStream = nullptr; + StreamReader^ readStream = nullptr; + StreamWriter^ writeStream = nullptr; + try + { + responseStream = response->GetResponseStream(); + readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); + + // Display information about the data received from the server. + Console::WriteLine( "Bytes received: {0}", response->ContentLength ); + Console::WriteLine( "Message from server: {0}", response->StatusDescription ); + Console::WriteLine( "Resource: {0}", response->ResponseUri ); + + // Write the bytes received from the server to the local file. + if ( readStream != nullptr ) + { + writeStream = gcnew StreamWriter( localFileName,false ); + writeStream->Write( readStream->ReadToEnd() ); + } + } + finally + { + if ( readStream != nullptr ) + { + readStream->Close(); + } + + if ( response != nullptr ) + { + response->Close(); + } + + if ( writeStream != nullptr ) + { + writeStream->Close(); + } + } + + return true; + } + // + + // Make a request to show the request properties + static void GetRequestProperties( Uri^ serverUri ) + { + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + + // This example assumes the FTP site uses anonymous logon. + request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); + request->Proxy = gcnew WebProxy; + request->Method = WebRequestMethods::Ftp::DownloadFile; + request->Abort(); + DisplayRequestProperties( request ); + } + + // async snippets + // + static bool GetFileSizeFromServer( Uri^ serverUri ) + { + // The serverUri parameter should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::GetFileSize; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // Display information about the server response. + Console::WriteLine( "size of file: {0}", response->ContentLength ); + response->Close(); + return true; + } + // + + // + static bool ListFilesOnServerSsl( Uri^ serverUri ) + { + // The serverUri should start with the ftp:// scheme. + if ( serverUri->Scheme != Uri::UriSchemeFtp ) + { + return false; + } + + // Get the object used to communicate with the server. + FtpWebRequest^ request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::ListDirectory; + request->EnableSsl = true; + + // Get the ServicePoint object used for this request, and limit it to one connection. + // In a real-world application you might use the default number of connections (2), + // or select a value that works best for your application. + ServicePoint^ sp = request->ServicePoint; + Console::WriteLine( "ServicePoint connections = {0}.", sp->ConnectionLimit ); + sp->ConnectionLimit = 1; + FtpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine( "The content length is {0}", response->ContentLength ); + + // The following streams are used to read the data returned from the server. + Stream^ responseStream = nullptr; + StreamReader^ readStream = nullptr; + responseStream = response->GetResponseStream(); + readStream = gcnew StreamReader( responseStream,System::Text::Encoding::UTF8 ); + + // Display the data received from the server. + Console::WriteLine( readStream->ReadToEnd() ); + Console::WriteLine( "List status: {0}", response->StatusDescription ); + readStream->Close(); + response->Close(); + + // + Console::WriteLine( "Banner message: {0}", response->BannerMessage ); + // + + // + Console::WriteLine( "Welcome message: {0}", response->WelcomeMessage ); + // + + // + Console::WriteLine( "Exit message: {0}", response->ExitMessage ); + // + + return true; + } + + // +internal: + static FtpStatusCode WaitForFinalStatus( FtpWebResponse^ response ) + { + int status = (int)response->StatusCode; + + // < 200 is undefined or informational messages. + // 300 and 400 are intermediate and temporary errors respectively. + // 200- 299 and 500- 599 are final statuses indicating + // sucess or failure respectively. + while ( status < 200 || (status >= 300 && status < 500) ) + { + Console::Write( "{0}. ", status ); + System::Threading::Thread::Sleep( 100 ); + status = (int)response->StatusCode; + } + + return response->StatusCode; + } + + +public: + static void Main() + { + // tests for snippets: + // ListFilesOnServer(new Uri(S"ftp://sharriso1")); + // works m3.1 + // NameListFilesOnServer (new Uri (S"ftp://sharriso1")); + // throws + // GetDateTimestampOnServer (new Uri ("ftp://sharriso1")); + // GetDateTimestampOnServer (new Uri (S"ftp://sharriso1/localfile.txt")); + // RemoveDirectoryOnServer (new Uri (S"ftp://sharriso1/DirtyDir")); + // MakeDirectoryOnServer (new Uri (S"ftp://sharriso1/DirtyDir")); + // UploadUniqueFileOnServer (new Uri (S"ftp://sharriso1/SherdieDir/"), "sharriso2.log"); + // ListFilesOnServer (new Uri (S"ftp://sharriso1")); + ListFilesOnServerSsl( gcnew Uri( "ftp://sharriso1" ) ); + + // snippet 8 - not working + // snippet 1 + // ListFilesOnServer(new Uri("ftp://sharriso1/")); + // snippet 8 - not working + //SendCommandToServer("ftp://sharriso1/", "rename localfile.txt loc2.txt"); + // new snippet 7 + // upload is just helper + //UploadFileToServer("NCLFtpClient.xml", new Uri("ftp://sharriso1/NCLFtpClient.xml")); + // RestartDownloadFromServer("piecexml.txt", new Uri("ftp://sharriso1/NCLFtpClient.xml"), 8); + // DownloadFileFromServer(new Uri("ftp://sharriso1/onesandtwos.txt"), "downloadedFile0320_1.txt"); + // snippet 11 + GetFileSizeFromServer( gcnew Uri( "ftp://sharriso1/localfile.txt" ) ); + + // snippet 5 + // DisplayFileFromServer Not working! + // DisplayFileFromServer(new Uri("ftp://sharriso1/ss1.txt")); + // snippet 2 + // UploadFileToServer("local.txt", new Uri("ftp://sharriso1/localfile.txt")); + //DeleteFileOnServer(new Uri("ftp://sharriso1/localfile.txt")); + // DownloadFileFromServer(new Uri("ftp://sharriso1/localFileagain.txt"), "dlagain.txt"); + // AppendFileOnServer("dlagain.txt", new Uri("ftp://sharriso1/localfile.txt")); + // Snippet 14, 15, and 16 + // GetRequestProperties(new Uri("ftp://sharriso1/localfile.txt")); + // Snippet 9 + // DownloadFileFromServer(new Uri("ftp://sharriso1/localFileagain.txt"), "dlagain.txt"); + //AsynchronousUploadFileToServer( "system.pdb","ftp://sharriso1/localFile.pdb"); + // ListFilesOnServer(new Uri("ftp://sharriso1")); + //DownloadFileFromServer(new Uri("ftp://sharriso1/localFileagain.txt"), "dlagain.txt"); + //UploadPartialFileOnServer("allOnes.txt", "ftp://sharriso1/babyones.txt", 20 ); + // TestCloning(); + // test the async methods + // ManualResetEvent wait = new ManualResetEvent(false); + // AsynchronousFtpUpLoader uploader = new AsynchronousFtpUpLoader(wait); + // uploader.AsynchronousUploadFileToServer("ftptests.cs", "ftp://sharriso1/ftptests.txt"); + // wait.WaitOne(); + // Snippet 10 + // ManualResetEvent wait = new ManualResetEvent(false); + // AsynchronousFtpUpLoader uploader = new AsynchronousFtpUpLoader(wait); + // uploader.AbortUpload("mscorlib.xml", "ftp://sharriso1/ftptests.txt"); + // wait.WaitOne(); + } +}; + + +// The RequestState class is the state object used to store the request information +// during asynchronous operations. +private ref class RequestState +{ +internal: + FtpWebRequest^ request; + Object^ requestData; + RequestState( FtpWebRequest ^theRequest, Object^ data ) + { + request = theRequest; + requestData = data; + } +}; + +public ref class AsynchronousFtpUpLoader +{ +private: + ManualResetEvent^ wait; + FtpWebRequest^ request; + array^fileContents; + Exception^ asyncException; + +public: + AsynchronousFtpUpLoader( ManualResetEvent^ wait ) + { + this->wait = wait; + } + + // In the AsynchronousUploadFileToServer method, + // serverUri contains the name of the file on the FTP server, and + // fileName contains the name of the file on the local computer. + void AsynchronousUploadFileToServer( String^ fileName, String^ serverUri ) + { + request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::UploadFile; + + // This example assumes the FTP site uses anonymous logon. + request->Credentials = gcnew NetworkCredential( "anonymous","janeDoe@contoso.com" ); + + // Get the file to be uploaded and convert it to bytes. + StreamReader^ sourceStream = gcnew StreamReader( fileName ); + fileContents = Encoding::UTF8->GetBytes( sourceStream->ReadToEnd() ); + sourceStream->Close(); + + // Set the content length to the number of bytes in the file. + request->ContentLength = fileContents->Length; + + // Asynchronously get the stream for the file contents. + IAsyncResult^ ar = request->BeginGetRequestStream( gcnew AsyncCallback( this, &AsynchronousFtpUpLoader::EndGetStreamCallback ), nullptr ); + Console::WriteLine( "Getting the request stream asynchronously..." ); + } + +private: + void EndGetStreamCallback( IAsyncResult^ ar ) + { + // Thread.Sleep(5000); + // Console.WriteLine("I'm awake now"); + Stream^ requestStream = nullptr; + + // End the asynchronous call to get the request stream. + try + { + requestStream = request->EndGetRequestStream( ar ); + } + // Return exceptions to the main application thread. + catch ( Exception^ e ) + { + Console::WriteLine( "Could not get the request stream." ); + asyncException = e; + wait->Set(); + return; + } + + // Write the file contents to the request stream. + requestStream->Write( fileContents, 0, fileContents->Length ); + Console::WriteLine( "Writing {0} bytes to the stream.", fileContents->Length ); + + // IMPORTANT: Close the request stream before sending the request. + requestStream->Close(); + IAsyncResult^ responseAR = request->BeginGetResponse( gcnew AsyncCallback( this, &AsynchronousFtpUpLoader::EndGetResponseCallback ), nullptr ); + } + + // The EndGetResponseCallback method + // completes a call to BeginGetResponse. + void EndGetResponseCallback( IAsyncResult^ ar ) + { + FtpWebResponse^ response = nullptr; + try + { + response = dynamic_cast(request->EndGetResponse( ar )); + } + // Return exceptions to the main application thread. + catch ( Exception^ e ) + { + Console::WriteLine( "Error getting response." ); + asyncException = e; + } + + Console::WriteLine( "Upload status: {0}", response->StatusDescription ); + + // Signal the application thread that this is complete. + wait->Set(); + } + + // +public: + void AbortUpload( String^ fileName, String^ serverUri ) + { + request = dynamic_cast(WebRequest::Create( serverUri )); + request->Method = WebRequestMethods::Ftp::UploadFile; + + // Get the file to be uploaded and convert it to bytes. + StreamReader^ sourceStream = gcnew StreamReader( fileName ); + fileContents = Encoding::UTF8->GetBytes( sourceStream->ReadToEnd() ); + sourceStream->Close(); + + // Set the content length to the number of bytes in the file. + request->ContentLength = fileContents->Length; + + // Asynchronously get the stream for the file contents. + IAsyncResult^ ar = request->BeginGetRequestStream( gcnew AsyncCallback( this, &AsynchronousFtpUpLoader::EndGetStreamCallback ), nullptr ); + Console::WriteLine( "Getting the request stream asynchronously..." ); + Console::WriteLine( "Press 'a' to abort the upload or any other key to continue" ); + String^ input = Console::ReadLine(); + if ( input->Equals( "a" ) ) + { + request->Abort(); + Console::WriteLine( "Request aborted" ); + return; + } + } + // +}; + +int main() +{ + FtpRequestTest::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp new file mode 100644 index 00000000000..81d174edffb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLMailSync/CPP/NclMailSync.cpp @@ -0,0 +1,1082 @@ + +// NclMailSync +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Mail; +using namespace System::Net::Mime; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::IO; +using namespace System::Text; + +public ref class CtorExamples +{ +public: + + // + static void CreateTestMessage1( String^ server, int port ) + { + String^ to = L"jane@contoso.com"; + String^ from = L"ben@contoso.com"; + String^ subject = L"Using the new SMTP client."; + String^ body = L"Using this new feature, you can send an email message from an application very easily."; + MailMessage^ message = gcnew MailMessage( from,to,subject,body ); + SmtpClient^ client = gcnew SmtpClient( server,port ); + + // Credentials are necessary if the server requires the client + // to authenticate before it will send email on the client's behalf. + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + client->~SmtpClient(); + } + + + // + // + static void CreateTestMessage2( String^ server ) + { + String^ to = L"jane@contoso.com"; + String^ from = L"ben@contoso.com"; + MailMessage^ message = gcnew MailMessage( from,to ); + message->Subject = L"Using the new SMTP client."; + message->Body = L"Using this new feature, you can send an email message from an application very easily."; + SmtpClient^ client = gcnew SmtpClient( server ); + + // Credentials are necessary if the server requires the client + // to authenticate before it will send email on the client's behalf. + client->UseDefaultCredentials = true; + client->Send( message ); + client->~SmtpClient(); + } + + + // + // + static void CreateTimeoutTestMessage( String^ server ) + { + String^ to = L"jane@contoso.com"; + String^ from = L"ben@contoso.com"; + String^ subject = L"Using the new SMTP client."; + String^ body = L"Using this new feature, you can send an email message from an application very easily."; + MailMessage^ message = gcnew MailMessage( from,to,subject,body ); + SmtpClient^ client = gcnew SmtpClient( server ); + Console::WriteLine( L"Changing time out from {0} to 100.", client->Timeout ); + client->Timeout = 100; + + // Credentials are necessary if the server requires the client + // to authenticate before it will send email on the client's behalf. + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + } + + + // + // + static void CreateTestMessage3() + { + MailAddress^ to = gcnew MailAddress( L"jane@contoso.com" ); + MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" ); + MailMessage^ message = gcnew MailMessage( from,to ); + message->Subject = L"Using the new SMTP client."; + message->Body = L"Using this new feature, you can send an email message from an application very easily."; + + // Use the application or machine configuration to get the + // host, port, and credentials. + SmtpClient^ client = gcnew SmtpClient; + Console::WriteLine( L"Sending an email message to {0} at {1} by using the SMTP host {2}.", to->User, to->Host, client->Host ); + client->Send( message ); + } + + + // + // + static void CreateMessageWithMultipleViews( String^ server, String^ recipients ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",recipients,L"This email message has multiple views.",L"This is some plain text." ); + + // Construct the alternate body as HTML. + String^ body = L""; + body = String::Concat( body, L"" ); + body = String::Concat( body, L"
this is some HTML text" ); + body = String::Concat( body, L"
" ); + + // Add the alternate body to the message. + AlternateView^ alternate = AlternateView::CreateAlternateViewFromString(body); + message->AlternateViews->Add(alternate); + + // Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + + // Display the values in the ContentType for the attachment. + ContentType^ c = alternate->ContentType; + Console::WriteLine( L"Content type" ); + Console::WriteLine( c ); + Console::WriteLine( L"Boundary {0}", c->Boundary ); + Console::WriteLine( L"CharSet {0}", c->CharSet ); + Console::WriteLine( L"MediaType {0}", c->MediaType ); + Console::WriteLine( L"Name {0}", c->Name ); + Console::WriteLine( L"Parameters: {0}", c->Parameters->Count ); + IEnumerator^ myEnum = c->Parameters->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ d = safe_cast(myEnum->Current); + Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); + } + + Console::WriteLine(); + alternate->~AlternateView(); + } + + + //
+ // + static void CreateMessageWithAttachment( String^ server ) + { + + // Specify the file to be attached and sent. + // This example assumes that a file named Data.xls exists in the + // current working directory. + String^ file = L"data.xls"; + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"Quarterly data report.",L"See the attached spreadsheet." ); + + // Create the file attachment for this email message. + Attachment^ data = gcnew Attachment(file, MediaTypeNames::Application::Octet); + + // Add time stamp information for the file. + ContentDisposition^ disposition = data->ContentDisposition; + disposition->CreationDate = System::IO::File::GetCreationTime( file ); + disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); + disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); + + // Add the file attachment to this email message. + message->Attachments->Add( data ); + + //Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + + // Add credentials if the SMTP server requires them. + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + + // Display the values in the ContentDisposition for the attachment. + ContentDisposition^ cd = data->ContentDisposition; + Console::WriteLine( L"Content disposition" ); + Console::WriteLine( cd ); + Console::WriteLine( L"File {0}", cd->FileName ); + Console::WriteLine( L"Size {0}", cd->Size ); + Console::WriteLine( L"Creation {0}", cd->CreationDate ); + Console::WriteLine( L"Modification {0}", cd->ModificationDate ); + Console::WriteLine( L"Read {0}", cd->ReadDate ); + Console::WriteLine( L"Inline {0}", cd->Inline ); + Console::WriteLine( L"Parameters: {0}", cd->Parameters->Count ); + IEnumerator^ myEnum1 = cd->Parameters->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + DictionaryEntry^ d = safe_cast(myEnum1->Current); + Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); + } + + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void CreateTestMessage4( String^ server ) + { + MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" ); + MailAddress^ to = gcnew MailAddress( L"Jane@contoso.com" ); + MailMessage^ message = gcnew MailMessage( from,to ); + message->Subject = L"Using the SmtpClient class."; + message->Body = L"Using this feature, you can send an email message from an application very easily."; + SmtpClient^ client = gcnew SmtpClient( server ); + Console::WriteLine( L"Sending an email message to {0} by using SMTP host {1} port {2}.", to, client->Host, client->Port ); + client->Send( message ); + client->~SmtpClient(); + } + + + // + // + static void CreateTestMessage5( String^ server ) + { + String^ to = L"jane@contoso.com"; + String^ from = L"ben@contoso.com"; + String^ subject = L"Using the new SMTP client."; + String^ body = L"Using this new feature, you can send an email message from an application very easily."; + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( from, to, subject, body ); + client->~SmtpClient(); + } + + + // + // + static void CreateBccTestMessage( String^ server ) + { + MailAddress^ from = gcnew MailAddress( L"ben@contoso.com",L"Ben Miller" ); + MailAddress^ to = gcnew MailAddress( L"jane@contoso.com",L"Jane Clayton" ); + MailMessage^ message = gcnew MailMessage( from,to ); + message->Subject = L"Using the SmtpClient class."; + message->Body = L"Using this feature, you can send an email message from an application very easily."; + MailAddress^ bcc = gcnew MailAddress( L"manager1@contoso.com" ); + message->Bcc->Add( bcc ); + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + Console::WriteLine( L"Sending an email message to {0} and {1}.", to->DisplayName, message->Bcc ); + try + { + client->Send( message ); + } + catch ( Exception^ ex ) + { + Console::WriteLine(L"Exception caught in CreateBccTestMessage(): {0}", + ex->ToString() ); + } + client->~SmtpClient(); + } + + + // + // + static void CreateCopyMessage( String^ server ) + { + MailAddress^ from = gcnew MailAddress( L"ben@contoso.com",L"Ben Miller" ); + MailAddress^ to = gcnew MailAddress( L"jane@contoso.com",L"Jane Clayton" ); + MailMessage^ message = gcnew MailMessage( from,to ); + + // message.Subject = "Using the SmtpClient class."; + message->Subject = L"Using the SmtpClient class."; + message->Body = L"Using this feature, you can send an email message from an application very easily."; + + // Add a carbon copy recipient. + MailAddress^ copy = gcnew MailAddress( L"Notification_List@contoso.com" ); + message->CC->Add( copy ); + SmtpClient^ client = gcnew SmtpClient( server ); + + // Include credentials if the server requires them. + client->Credentials = CredentialCache::DefaultNetworkCredentials; + Console::WriteLine( L"Sending an email message to {0} by using the SMTP host {1}.", to->Address, client->Host ); + client->Send( message ); + client->~SmtpClient(); + } + + + // + // + static void CreateMessageAttachment1( String^ server, String^ textMessage ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"A text message for you.",L"Message: " ); + + // Attach the message string to this email message. + Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain ); + ContentDisposition^ disposition = data->ContentDisposition; + + // Suggest a file name for the attachment. + disposition->FileName = String::Format( L"message{0}", DateTime::Now ); + message->Attachments->Add( data ); + + //Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + + // Display the values in the ContentDisposition for the attachment. + Console::WriteLine( L"Content disposition" ); + Console::WriteLine( disposition ); + Console::WriteLine( L"File {0}", disposition->FileName ); + Console::WriteLine( L"Size {0}", disposition->Size ); + Console::WriteLine( L"Creation {0}", disposition->CreationDate ); + Console::WriteLine( L"Modification {0}", disposition->ModificationDate ); + Console::WriteLine( L"Read {0}", disposition->ReadDate ); + Console::WriteLine( L"Inline {0}", disposition->Inline ); + Console::WriteLine( L"Parameters: {0}", disposition->Parameters->Count ); + IEnumerator^ myEnum2 = disposition->Parameters->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + DictionaryEntry^ d = safe_cast(myEnum2->Current); + Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); + } + + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void CreateMessageInlineAttachment( String^ server, String^ textMessage ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"An inline text message for you.",L"Message: " ); + + // Attach the message string to this email message. + Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain ); + + // Send textMessage as part of the email body. + message->Attachments->Add( data ); + ContentDisposition^ disposition = data->ContentDisposition; + disposition->Inline = true; + + //Send the message. + // Include credentials if the server requires them. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void CreateMessageInlineAttachment2( String^ server, String^ textMessage ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"A text message for you.",L"Message: " ); + + // Attach the message string to this email message. + Attachment^ data = gcnew Attachment( textMessage ); + + // Send textMessage as part of the email body. + message->Attachments->Add( data ); + ContentType^ content = data->ContentType; + content->MediaType = MediaTypeNames::Text::Plain; + + //Send the message. + // Include credentials if the server requires them. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + // The following example sends a summary of a log file as the message + // and the log as an email attachment. + static void SendErrorLog( String^ server, String^ recipientList ) + { + + // Create a message from logMailer@contoso.com to recipientList. + MailMessage^ message = gcnew MailMessage( L"logMailer@contoso.com",recipientList ); + message->Subject = L"Error Log report"; + String^ fileName = L"log.txt"; + + // Get the file stream for the error log. + // Requires the System.IO namespace. + FileStream^ fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + StreamReader^ s = gcnew StreamReader( fs ); + int errors = 0; + while ( s->ReadLine() != nullptr ) + { + + // Process each line from the log file here. + errors++; + } + + message->Body = String::Format( L"{0} errors in log as of {1}", errors, DateTime::Now ); + + // Close the stream reader. This also closes the file. + s->Close(); + + // Re-open the file at the beginning to make the attachment. + fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + + // Make a contentType indicating that the log data + // that is attached is plain text. + ContentType^ ct = gcnew ContentType( MediaTypeNames::Text::Plain ); + + // Attach the log file stream to the email message. + Attachment^ data = gcnew Attachment( fs,ct ); + ContentDisposition^ disposition = data->ContentDisposition; + + // Suggest a file name for the attachment. + disposition->FileName = String::Format( L"log{0}.txt", DateTime::Now ); + + // Add the attachment to the message. + message->Attachments->Add( data ); + + // Send the message. + // Include credentials if the server requires them. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + + // Close the log file. + fs->Close(); + } + + + // + // + // The following example sends a summary of a log file as the message + // and the log as an email attachment. + static void SendNamedErrorLog( String^ server, String^ recipientList ) + { + + // Create a message from logMailer@contoso.com to recipientList. + MailMessage^ message = gcnew MailMessage( L"logMailer@contoso.com",recipientList ); + message->Subject = L"Error Log report"; + String^ fileName = L"log.txt"; + + // Get the file stream for the error log. + // Requires the System.IO namespace. + FileStream^ fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + StreamReader^ s = gcnew StreamReader( fs ); + int errors = 0; + while ( s->ReadLine() != nullptr ) + { + + // Process each line from the log file here. + errors++; + } + + message->Body = String::Format( L"{0} errors in log as of {1}", errors, DateTime::Now ); + + // Close the stream reader. This also closes the file. + s->Close(); + + // Re-open the file at the beginning to make the attachment. + fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + + // Make a ContentType indicating that the log data + // that is attached is plain text and is named. + ContentType^ ct = gcnew ContentType; + ct->MediaType = MediaTypeNames::Text::Plain; + ct->Name = String::Format( L"log{0}.txt", DateTime::Now ); + + // Create the attachment. + Attachment^ data = gcnew Attachment( fs,ct ); + + // Add the attachment to the message. + message->Attachments->Add( data ); + + // Send the message. + // Include credentials if the server requires them. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + + // Close the log file. + fs->Close(); + return; + } + + + // + // + // The following example sends a summary of a log file as the message + // and the log as an email attachment. + static void SendNamedAndTypedErrorLog( String^ server, String^ recipientList ) + { + + // Create a message from logMailer@contoso.com to recipientList. + MailMessage^ message = gcnew MailMessage( L"logMailer@contoso.com",recipientList ); + message->Subject = L"Error Log report"; + String^ fileName = L"log.txt"; + + // Get the file stream for the error log. + // Requires the System.IO namespace. + FileStream^ fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + StreamReader^ s = gcnew StreamReader( fs ); + int errors = 0; + while ( s->ReadLine() != nullptr ) + { + + // Process each line from the log file here. + errors++; + } + + message->Body = String::Format( L"{0} errors in log as of {1}", errors, DateTime::Now ); + + // Close the stream reader. This also closes the file. + s->Close(); + + // Re-open the file at the beginning to make the attachment. + fs = gcnew FileStream( fileName,FileMode::Open,FileAccess::Read ); + + // Create a name for the log data file. + String^ name = String::Format( L"log{0}.txt", DateTime::Now ); + + // Create the attachment, name it, and specify the MIME type. + Attachment^ data = gcnew Attachment( fs,name,MediaTypeNames::Text::Plain ); + + // Add the attachment to the message. + message->Attachments->Add( data ); + + // Send the message. + // Include credentials if the server requires them. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + + // Close the log file. + fs->Close(); + } + + + // + // + static Attachment^ SendAttachedMessage( String^ server ) + { + + // Set up the sender information. + String^ from = String::Concat( Environment::UserDomainName, L".", Environment::UserName, L"@contoso.com" ); + Console::WriteLine( L"From: {0}", from ); + + // Have the user enter the message recipient. + Console::Write( L"To: " ); + String^ recipient = Console::ReadLine(); + + // Check for recipient data. + // A real application would add error checking here for a valid email + // address format. This example accepts any input. + if ( recipient->Length == 0 ) + return nullptr; + + + // Get the subject. + Console::Write( L"Subject: " ); + String^ subject = Console::ReadLine(); + + // Get the message content. + Console::WriteLine( L"Enter the message. Press return on a blank line to finish:" ); + StringBuilder^ sb = gcnew StringBuilder; + String^ line; + while ( true ) + { + line = Console::ReadLine(); + if ( line->Length > 0 ) + { + + // Store the message and the end-of-line characters. + sb->AppendFormat( L"{0},{1}", line, Environment::NewLine ); + } + else + break; + } + + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( from,recipient ); + message->Subject = subject; + + // Attach the message string to this email message. + // Set the encoding to the computer's current encoding. + Attachment^ data = gcnew Attachment( sb->ToString(),MediaTypeNames::Text::Plain); + + // Add the attachment to the message. + message->Attachments->Add( data ); + + //Send the message. Supply credentials if necessary. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = CredentialCache::DefaultNetworkCredentials; + Console::WriteLine( L"Ready to send. Press enter to send. Type any character to quit:" ); + String^ answer = Console::ReadLine(); + if ( answer->Length == 0 ) + { + client->Send( message ); + Console::WriteLine( L"Message sent." ); + } + else + { + Console::WriteLine( L"Send canceled." ); + } + + client->~SmtpClient(); + return data; + } + + + // + // + static void CreateMessageWithFile( String^ server, String^ to ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to ); + message->Subject = L"Monthly Expense report"; + message->Body = L"Please review the attached report."; + + // Attach a file to this email message. + Attachment^ data = gcnew Attachment("data.xls", MediaTypeNames::Application::Octet); + AttachmentCollection^ attachments = message->Attachments; + attachments->Add( data ); + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + client->Send( message ); + client->~SmtpClient(); + } + + + // + // + static void DisplayFileAttachment( Attachment^ a ) + { + Console::WriteLine( L"Content Disposition {0}", a->ContentDisposition ); + Console::WriteLine( L"Content Type {0}", a->ContentType ); + Console::WriteLine( L"Name {0}", a->Name ); + } + + + // + // + static void DisplayStringAttachment( Attachment^ a ) + { + Console::WriteLine( L"Content: {0}", a->ContentType ); + Console::WriteLine( L"Encoding {0}", a->TransferEncoding ); + Console::WriteLine( L"Content Disposition {0}", a->ContentDisposition->ToString() ); + Console::WriteLine( L"Content Type {0}", a->ContentType->ToString() ); + } + + + // + // + static void DisplayStreamAttachment( Attachment^ a ) + { + Stream^ s = a->ContentStream; + StreamReader^ reader = gcnew StreamReader( s ); + Console::WriteLine( L"Content: {0}", reader->ReadToEnd() ); + Console::WriteLine( L"Content Type {0}", a->ContentType ); + Console::WriteLine( L"Transfer Encoding {0}", a->TransferEncoding ); + + // Note that you cannot close the reader before the email is sent. + // Closing the reader before sending the email will close the + // ContentStream and cause an SmtpException. + reader = nullptr; + } + + + // + // + static void CreateMessageWithAttachment2( String^ server, String^ to ) + { + + // Specify the file to be attached and sent. + // This example assumes that a file named Data.xls exists in the + // current working directory. + String^ file = L"data.xls"; + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to,L"Quarterly data report",L"See the attached spreadsheet." ); + + // Create the file attachment for this email message. + Attachment^ data = gcnew Attachment(file); + + // Add time stamp information for the file. + ContentDisposition^ disposition = data->ContentDisposition; + disposition->CreationDate = System::IO::File::GetCreationTime( file ); + disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); + disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); + + // Add the file attachment to this email message. + message->Attachments->Add( data ); + + //Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + + // Add credentials if the SMTP server requires them. + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void CreateMessageWithAttachment3( String^ server, String^ to ) + { + + // Specify the file to be attached and sent. + // This example assumes that a file named data.xls exists in the + // current working directory. + String^ file = L"data.xls"; + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to,L"Quarterly data report",L"See the attached spreadsheet." ); + + // Create the file attachment for this email message. + Attachment^ data = gcnew Attachment("Qtr3.xls"); + + + // Add time stamp information for the file. + ContentDisposition^ disposition = data->ContentDisposition; + disposition->CreationDate = System::IO::File::GetCreationTime( file ); + disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); + disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); + + // Add the file attachment to this email message. + message->Attachments->Add( data ); + + //Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + + // Add credentials if the SMTP server requires them. + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + + // Notify user if an error occurs. + try + { + client->Send( message ); + } + catch ( SmtpException^ e ) + { + Console::WriteLine( L"Error: {0}", e->StatusCode ); + } + finally + { + data->~Attachment(); + client->~SmtpClient(); + } + + } + + + // + // + static void CreateMessageWithAttachment4( String^ server, String^ to ) + { + + // Specify the file to be attached and sent. + // This example uses a file on a UNC share. + String^ file = L"\\\\share3\\c$\\reports\\data.xls"; + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"ReportMailer@contoso.com",to,L"Quarterly data report",L"See the attached spreadsheet." ); + + // Create the file attachment for this email message. + Attachment^ data = gcnew Attachment("qtr3.xls", MediaTypeNames::Application::Octet); + + // Add time stamp information for the file. + ContentDisposition^ disposition = data->ContentDisposition; + disposition->CreationDate = System::IO::File::GetCreationTime( file ); + disposition->ModificationDate = System::IO::File::GetLastWriteTime( file ); + disposition->ReadDate = System::IO::File::GetLastAccessTime( file ); + disposition->DispositionType = DispositionTypeNames::Attachment; + + // Add the file attachment to this email message. + message->Attachments->Add( data ); + + //Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + + // Add credentials if the SMTP server requires them. + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + client->Send( message ); + + // Display the message headers. + array^keys = message->Headers->AllKeys; + Console::WriteLine( L"Headers" ); + IEnumerator^ myEnum3 = keys->GetEnumerator(); + while ( myEnum3->MoveNext() ) + { + String^ s = safe_cast(myEnum3->Current); + Console::WriteLine( L"{0}:", s ); + Console::WriteLine( L" {0}", message->Headers[ s ] ); + } + + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void CreateMessageAttachment5( String^ server, String^ textMessage ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"A text message for you.",L"Message: " ); + + // Attach the message string to this email message. + Attachment^ data = gcnew Attachment(textMessage, + MediaTypeNames::Text::Plain); + ContentDisposition^ disposition = data->ContentDisposition; + + // Suggest a file name for the attachment. + disposition->FileName = String::Format( L"message{0}", DateTime::Now ); + message->Attachments->Add( data ); + + //Send the message. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void CreateMessageInlineAttachment3( String^ server, String^ textMessage ) + { + + // Create a message and set up the recipients. + MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"An inline text message for you.",L"Message: " ); + + // Attach the message string to this email message. + Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain ); + + // Send textMessage as part of the email body. + message->Attachments->Add( data ); + ContentDisposition^ disposition = data->ContentDisposition; + disposition->DispositionType = DispositionTypeNames::Inline; + + //Send the message. + // Include credentials if the server requires them. + SmtpClient^ client = gcnew SmtpClient( server ); + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + client->Send( message ); + data->~Attachment(); + client->~SmtpClient(); + } + + + // + // + static void RetryIfBusy( String^ server ) + { + MailAddress^ from = gcnew MailAddress( L"ben@contoso.com" ); + MailAddress^ to = gcnew MailAddress( L"jane@contoso.com" ); + MailMessage^ message = gcnew MailMessage( from,to ); + + // message.Subject = "Using the SmtpClient class."; + message->Subject = L"Using the SmtpClient class."; + message->Body = L"Using this feature, you can send an email message from an application very easily."; + + // Add a carbon copy recipient. + MailAddress^ copy = gcnew MailAddress( L"Notifications@contoso.com" ); + message->CC->Add( copy ); + SmtpClient^ client = gcnew SmtpClient( server ); + + // Include credentials if the server requires them. + client->Credentials = dynamic_cast(CredentialCache::DefaultNetworkCredentials); + Console::WriteLine( L"Sending an email message to {0} using the SMTP host {1}.", to->Address, client->Host ); + try + { + client->Send( message ); + } + catch ( SmtpFailedRecipientsException^ ex ) + { + for ( int i = 0; i < ex->InnerExceptions->Length; i++ ) + { + SmtpStatusCode status = ex->InnerExceptions[ i ]->StatusCode; + if ( status == SmtpStatusCode::MailboxBusy || status == SmtpStatusCode::MailboxUnavailable ) + { + Console::WriteLine( L"Delivery failed - retrying in 5 seconds." ); + System::Threading::Thread::Sleep( 5000 ); + client->Send( message ); + } + else + { + Console::WriteLine( L"Failed to deliver message to {0}", ex->InnerExceptions[ i ] ); + } + + } + } + catch ( Exception^ ex ) + { + Console::WriteLine(L"Exception caught in RetryIfBusy(): {0}", + ex->ToString() ); + } + finally + { + client->~SmtpClient(); + } + } + + + // + // silly snippets to get code coverage in exceptions! + // + static SmtpException^ GenerateDefaultSmtpException() + { + return gcnew SmtpException; + } + + + // + // + static SmtpException^ GenerateSmtpException( String^ message ) + { + return gcnew SmtpException( message ); + } + + + // + // + static SmtpException^ GenerateSmtpException( SmtpStatusCode status ) + { + return gcnew SmtpException( status ); + } + + + // + // + static SmtpException^ GenerateSmtpException( SmtpStatusCode status, String^ message ) + { + return gcnew SmtpException( status,message ); + } + + + // + // + static SmtpException^ GenerateSmtpException( String^ message, Exception^ innerException ) + { + return gcnew SmtpException( message,innerException ); + } + + + // + static void CreateSampleDispositions() + { + + // + ContentDisposition^ c1 = gcnew ContentDisposition; + Console::WriteLine( c1 ); + + // + // + ContentDisposition^ c2 = gcnew ContentDisposition( L"attachment" ); + Console::WriteLine( c2 ); + + // + ContentDisposition^ c3 = gcnew ContentDisposition( L"Attachment; filename = myFile;" ); + Console::WriteLine( c3 ); + } + + static void DumpMailAddress( MailAddress^ a ) + { + Console::WriteLine( L"Display: {0} Host: {1} User: {2} Address: {3}", a->DisplayName, a->Host, a->User, a->Address ); + } + + static void CreateSampleAddresses() + { + MailAddress^ a1 = gcnew MailAddress( L"Ben Miller " ); + Console::WriteLine( a1 ); + DumpMailAddress( a1 ); + + // WRONG but legal: Should not include angle brackets. + MailAddress^ a2 = gcnew MailAddress( L"" ); + Console::WriteLine( a2 ); + DumpMailAddress( a2 ); + MailAddress^ a3 = gcnew MailAddress( L"ben.address1@contoso.com" ); + Console::WriteLine( a3 ); + DumpMailAddress( a3 ); + + // Use a constructor that takes an address and the display name separately. + // Throwing a format exception + // MailAddress a4 = new MailAddress("tom@contoso.com", "Tom Smith"); + // Console.WriteLine(a4.ToString()); + // DumpMailAddress(a4); + // WRONG: Should not include angle brackets. + // MailAddress a5 = new MailAddress(" ", "Tom Smith"); + // Console.WriteLine(a5.ToString()); + // DumpMailAddress(a5); + // WRONG but legal: Should not include display name as part of address. + MailAddress^ a6 = gcnew MailAddress( L"Tom Smith",L"Bill Jones" ); + Console::WriteLine( a6 ); + DumpMailAddress( a6 ); + MailAddress^ a7 = gcnew MailAddress( L"tom@contoso.com",L" Tom Smith " ); + Console::WriteLine( a7 ); + DumpMailAddress( a7 ); + } + + static void DisplayContentType( ContentType^ c ) + { + Console::WriteLine( L"Boundary {0}", c->Boundary ); + Console::WriteLine( L"Charset {0}", c->CharSet ); + Console::WriteLine( L"MediaType {0}", c->MediaType ); + Console::WriteLine( L"Name {0}", c->Name ); + Console::WriteLine( L"Parameters: {0}", c->Parameters->Count ); + IEnumerator^ myEnum4 = c->Parameters->GetEnumerator(); + while ( myEnum4->MoveNext() ) + { + DictionaryEntry^ d = safe_cast(myEnum4->Current); + Console::WriteLine( L"{0} = {1}", d->Key, d->Value ); + } + } + + static void CreateContentTypes() + { + ContentType^ c1 = gcnew ContentType; + Console::WriteLine( L"---c1 {0}", c1 ); + DisplayContentType( c1 ); + ContentType^ c2 = gcnew ContentType( L"text/html" ); + Console::WriteLine( L"---c2 {0}", c2 ); + DisplayContentType( c2 ); + ContentType^ c3 = gcnew ContentType( L"application/x-myPrivateSubtype; name=data.xyz; charset=us-ascii" ); + Console::WriteLine( L"---c3 {0}", c3 ); + DisplayContentType( c3 ); + } + + + // The first argument is the recipient. + // The second argument is the sender. + void NCLMailSyncRun() + { + + // CreateTestMessage2(args[0]); + //CreateMessageInlineAttachment3("smarthost", "string textMessage"); + //CreateTestMessage3(); + //CreateTestMessage4(args[0]); + // CreateTestMessageX(args[0]); + //CreateMessageWithMultipleViews("smarthost","sharriso@microsoft.com"); + CreateBccTestMessage( L"sharriso1" ); + + //CreateCopyMessage("sharriso1"); + // CreateMessageWithMultipleRecipients("sharriso1"); + //CreateTestMessageY("sharriso1"); + //CreateMessageWithAttachment("smarthost"); + //CreateContentTypes(); + // CreateMessageWithMultipleRecipients("smarthost"); + //CreateSampleAddresses(); + // CreateMessageAttachment1("smarthost", "This is an attached message."); + //CreateMessageInlineAttachment("sharriso1", "How cool is this?"); + //CreateMessageInlineAttachment2("smarthost", "This is an attached message."); + //SendErrorLog("smarthost", "sharriso@microsoft.com"); + //Attachment log = SendNamedErrorLog("smarthost", "sharriso@microsoft.com"); + //SendNamedAndTypedErrorLog("smarthost", "sharriso@microsoft.com"); + //Attachment a = SendAttachedMessage("smarthost"); + //DisplayStringAttachment(a); + // CreateMessageWithFile("smarthost", "sharriso@microsoft.com"); + // CreateMessageWithAttachment2("smarthost", "sharriso@microsoft.com"); + // CreateMessageWithAttachment3("xx","sharriso@microsoft.com"); + // CreateMessageWithAttachment4("smarthost", "sharriso@microsoft.com"); + // CreateMessageAttachment5("sharriso1", "string textMessage"); + //CreateSampleDispositions(); + RetryIfBusy("sharriso1"); + } + +}; + +void main() +{ + CtorExamples^ ce = gcnew CtorExamples; + ce->NCLMailSyncRun(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp new file mode 100644 index 00000000000..210b727cdc0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfo2/CPP/networkexamples.cpp @@ -0,0 +1,1010 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::NetworkInformation; +using namespace System::Net::Sockets; + +// +void GetTcpConnections() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + array^connections = properties->GetActiveTcpConnections(); + System::Collections::IEnumerator^ myEnum = connections->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TcpConnectionInformation ^ t = safe_cast(myEnum->Current); + Console::Write( "Local endpoint: {0} ", t->LocalEndPoint->Address ); + Console::Write( "Remote endpoint: {0} ", t->RemoteEndPoint->Address ); + Console::WriteLine( "{0}", t->State ); + } +} +// + +// +void CountTcpConnections() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + array^connections = properties->GetActiveTcpConnections(); + int establishedConnections = 0; + System::Collections::IEnumerator^ myEnum1 = connections->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + TcpConnectionInformation ^ t = safe_cast(myEnum1->Current); + if ( t->State == TcpState::Established ) + { + establishedConnections++; + } + + Console::Write( "Local endpoint: {0} ", t->LocalEndPoint->Address ); + Console::WriteLine( "Remote endpoint: {0} ", t->RemoteEndPoint->Address ); + } + + Console::WriteLine( "There are {0} established TCP connections.", establishedConnections ); +} +// + +// +void DisplayActiveUdpListeners() +{ + Console::WriteLine( "Active UDP Listeners" ); + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + array^endPoints = properties->GetActiveUdpListeners(); + System::Collections::IEnumerator^ myEnum2 = endPoints->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + IPEndPoint^ e = safe_cast(myEnum2->Current); + Console::WriteLine( e ); + } +} +// + +// +void ShowNetworkInterfaces() +{ + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + if ( !nics || nics->Length < 1 ) + { + Console::WriteLine( " No network interfaces found." ); + return; + } + + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + Console::WriteLine( "Interface information for {0}.{1}", properties->HostName, properties->DomainName ); + Console::WriteLine( " Number of interfaces .................... : {0}", nics->Length ); + System::Collections::IEnumerator^ myEnum3 = nics->GetEnumerator(); + while ( myEnum3->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum3->Current); + Console::WriteLine(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + Console::WriteLine( " Interface type .......................... : {0}", + adapter->NetworkInterfaceType ); + } +} +// + +// +void ShowTcpTimeouts() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + TcpStatistics ^ tcpstat = properties->GetTcpIPv4Statistics(); + Console::WriteLine( " Minimum Transmission Timeout............. : {0}", + tcpstat->MinimumTransmissionTimeout ); + Console::WriteLine( " Maximum Transmission Timeout............. : {0}", + tcpstat->MaximumTransmissionTimeout ); + Console::WriteLine( " Maximum connections ............. : {0}", + tcpstat->MaximumConnections ); +} +// + +// +void ShowTcpConnectionStatistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + TcpStatistics ^ tcpstat = properties->GetTcpIPv4Statistics(); + Console::WriteLine( " Connection Data:" ); + Console::WriteLine( " Current ............................ : {0}", + tcpstat->CurrentConnections ); + Console::WriteLine( " Cumulative .......................... : {0}", + tcpstat->CumulativeConnections ); + Console::WriteLine( " Initiated ........................... : {0}", + tcpstat->ConnectionsInitiated ); + Console::WriteLine( " Accepted ............................ : {0}", + tcpstat->ConnectionsAccepted ); + Console::WriteLine( " Failed Attempts ..................... : {0}", + tcpstat->FailedConnectionAttempts ); + Console::WriteLine( " Reset ............................... : {0}", + tcpstat->ResetConnections ); + Console::WriteLine( " Errors .............................. : {0}", + tcpstat->ErrorsReceived ); +} +// + +// +void ShowTcpSegmentData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + TcpStatistics ^ tcpstat = properties->GetTcpIPv4Statistics(); + Console::WriteLine( " Segment Data:" ); + Console::WriteLine( " Received ........................... : {0}", + tcpstat->SegmentsReceived ); + Console::WriteLine( " Sent ................................ : {0}", + tcpstat->SegmentsSent ); + Console::WriteLine( " Retransmitted ....................... : {0}", + tcpstat->SegmentsResent ); + Console::WriteLine( " Resent with reset ................... : {0}", + tcpstat->ResetsSent ); +} +// + +// +void ShowInterfaceByteCounts() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum4 = adapters->GetEnumerator(); + while ( myEnum4->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum4->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " Bytes sent ............................: {0}", + stats->BytesSent ); + Console::WriteLine( " Bytes received ........................: {0}", + stats->BytesReceived ); + } +} +// + +// +void ShowUnicastCounts() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum5 = adapters->GetEnumerator(); + while ( myEnum5->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum5->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " Unicast Packets Sent ..................: {0}", + stats->UnicastPacketsSent ); + Console::WriteLine( " Unicast Packets Received ..............: {0}", + stats->UnicastPacketsReceived ); + } +} +// + +// +void ShowNonUnicastCounts() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum6 = adapters->GetEnumerator(); + while ( myEnum6->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum6->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " Non Unicast Packets Sent ..............: {0}", + stats->NonUnicastPacketsSent ); + Console::WriteLine( " Non Unicast Packets Received ..........: {0}", + stats->NonUnicastPacketsReceived ); + } +} +// + +// +void ShowPacketDiscards() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum7 = adapters->GetEnumerator(); + while ( myEnum7->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum7->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " Incoming Packets Discarded ............: {0}", + stats->IncomingPacketsDiscarded ); + Console::WriteLine( " Outgoing Packets Discarded ............: {0}", + stats->OutgoingPacketsDiscarded ); + } +} +// + +// +void ShowPacketErrors() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum8 = adapters->GetEnumerator(); + while ( myEnum8->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum8->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " Incoming Packets Errors ...............: {0}", + stats->IncomingPacketsWithErrors ); + Console::WriteLine( " Outgoing packets Errors ...............: {0}", + stats->OutgoingPacketsWithErrors ); + Console::WriteLine( " Incoming Unknown Protocol Errors ......: {0}", + stats->IncomingUnknownProtocolPackets ); + } +} +// + +// +void ShowInterfaceSpeedAndQueue() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum9 = adapters->GetEnumerator(); + while ( myEnum9->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum9->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " Speed .................................: {0}", + adapter->Speed ); + Console::WriteLine( " Output queue length....................: {0}", + stats->OutputQueueLength ); + } +} +// + +// +void ShowIPStatistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( " Forwarding enabled ...................... : {0}", + ipstat->ForwardingEnabled ); + Console::WriteLine( " Interfaces .............................. : {0}", + ipstat->NumberOfInterfaces ); + Console::WriteLine( " IP addresses ............................ : {0}", + ipstat->NumberOfIPAddresses ); + Console::WriteLine( " Routes .................................. : {0}", + ipstat->NumberOfRoutes ); + Console::WriteLine( " Default TTL ............................. : {0}", + ipstat->DefaultTtl ); +} +// + +// +void ShowInboundIPStatistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( " Inbound Packet Data:" ); + Console::WriteLine( " Received ............................ : {0}", + ipstat->ReceivedPackets ); + Console::WriteLine( " Forwarded ........................... : {0}", + ipstat->ReceivedPacketsForwarded ); + Console::WriteLine( " Delivered ........................... : {0}", + ipstat->ReceivedPacketsDelivered ); + Console::WriteLine( " Discarded ........................... : {0}", + ipstat->ReceivedPacketsDiscarded ); +} +// + +// +void ShowInboundIPErrors() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( " Inbound Packet Errors:" ); + Console::WriteLine( " Header Errors ....................... : {0}", + ipstat->ReceivedPacketsWithHeadersErrors ); + Console::WriteLine( " Address Errors ...................... : {0}", + ipstat->ReceivedPacketsWithAddressErrors ); + Console::WriteLine( " Unknown Protocol Errors ............. : {0}", + ipstat->ReceivedPacketsWithUnknownProtocol ); +} +// + +// +void ShowOutboundIPStatistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( " Outbound Packet Data:" ); + Console::WriteLine( " Requested ........................... : {0}", + ipstat->OutputPacketRequests ); + Console::WriteLine( " Discarded ........................... : {0}", + ipstat->OutputPacketsDiscarded ); + Console::WriteLine( " No Routing Discards ................. : {0}", + ipstat->OutputPacketsWithNoRoute ); + Console::WriteLine( " Routing Entry Discards .............. : {0}", + ipstat->OutputPacketRoutingDiscards ); +} +// + +// +void ShowFragmentationStatistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IPGlobalStatistics ^ ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( " Reassembly Data:" ); + Console::WriteLine( " Reassembly Timeout .................. : {0}", + ipstat->PacketReassemblyTimeout ); + Console::WriteLine( " Reassemblies Required ............... : {0}", + ipstat->PacketReassembliesRequired ); + Console::WriteLine( " Packets Reassembled ................. : {0}", + ipstat->PacketsReassembled ); + Console::WriteLine( " Packets Fragmented .................. : {0}", + ipstat->PacketsFragmented ); + Console::WriteLine( " Fragment Failures ................... : {0}", + ipstat->PacketFragmentFailures ); +} +// + +// +void ShowIcmpV4MessageData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", + statistics->MessagesSent, statistics->MessagesReceived ); +} +// + +// +void ShowIcmpV4EchoData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", + statistics->EchoRequestsSent, + statistics->EchoRequestsReceived ); + Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", + statistics->EchoRepliesSent, + statistics->EchoRepliesReceived ); +} +// + +// +void ShowIcmpV4ErrorData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", + statistics->ErrorsSent, + statistics->ErrorsReceived ); +} +// + +// +void ShowIcmpV4UnreachableData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", + statistics->DestinationUnreachableMessagesSent, + statistics->DestinationUnreachableMessagesReceived ); +} +// + +// +void ShowSourceQuenchData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Source Quenches ..................... Sent: {0,-10} Received: {1,-10}", + statistics->SourceQuenchesSent, + statistics->SourceQuenchesReceived ); +} +// + +// +void ShowRedirectsData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", + statistics->RedirectsSent, + statistics->RedirectsReceived ); +} +// + +// +void ShowTimeExceededData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}", + statistics->TimeExceededMessagesSent, + statistics->TimeExceededMessagesReceived ); +} +// + +// +void ShowParameterData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", + statistics->ParameterProblemsSent, + statistics->ParameterProblemsReceived ); +} +// + +// +void ShowTimestampData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Timestamp Requests .................. Sent: {0,-10} Received: {1,-10}", + statistics->TimestampRequestsSent, + statistics->TimestampRequestsReceived ); + Console::WriteLine( " Timestamp Replies ................... Sent: {0,-10} Received: {1,-10}", + statistics->TimestampRepliesSent, + statistics->TimestampRepliesReceived ); +} +// + +// +void ShowAddressMaskData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ statistics = properties->GetIcmpV4Statistics(); + Console::WriteLine( " Address Mask Requests ............... Sent: {0,-10} Received: {1,-10}", + statistics->AddressMaskRequestsSent, + statistics->AddressMaskRequestsReceived ); + Console::WriteLine( " Address Mask Replies ................ Sent: {0,-10} Received: {1,-10}", + statistics->AddressMaskRepliesSent, + statistics->AddressMaskRepliesReceived ); +} +// + +// +void ShowIcmpV6EchoData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", + statistics->EchoRequestsSent, statistics->EchoRequestsReceived ); + Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", + statistics->EchoRepliesSent, statistics->EchoRepliesReceived ); +} +// + +// +void ShowIcmpV6ErrorData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", + statistics->ErrorsSent, statistics->ErrorsReceived ); +} +// + +// +void ShowIcmpV6UnreachableData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", + statistics->DestinationUnreachableMessagesSent, + statistics->DestinationUnreachableMessagesReceived ); +} +// + +// +void ShowIcmpV6MessageData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", + statistics->MessagesSent, statistics->MessagesReceived ); +} +// + +// +void ShowIcmpV6MembershipData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Queries .............................. Sent: {0,-10} Received: {1,-10}", + statistics->MembershipQueriesSent, statistics->MembershipQueriesReceived ); + Console::WriteLine( " Reductions ........................... Sent: {0,-10} Received: {1,-10}", + statistics->MembershipReductionsSent, statistics->MembershipReductionsReceived ); + Console::WriteLine( " Reports .............................. Sent: {0,-10} Received: {1,-10}", + statistics->MembershipReportsSent, statistics->MembershipReportsReceived ); +} +// + +// +void ShowIcmpV6NeighborData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Advertisements ...................... Sent: {0,-10} Received: {1,-10}", + statistics->NeighborAdvertisementsSent, statistics->NeighborAdvertisementsReceived ); + Console::WriteLine( " Solicits ............................ Sent: {0,-10} Received: {1,-10}", + statistics->NeighborSolicitsSent, statistics->NeighborSolicitsReceived ); +} +// + +// +void ShowIcmpV6BigPacketData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Too Big Packet ........................ Sent: {0,-10} Received: {1,-10}", + statistics->PacketTooBigMessagesSent, + statistics->PacketTooBigMessagesReceived ); +} +// + +// +void ShowIcmpV6RedirectsData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", + statistics->RedirectsSent, + statistics->RedirectsReceived ); +} +// + +// +void ShowIcmpV6TimeExceededData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}", + statistics->TimeExceededMessagesSent, + statistics->TimeExceededMessagesReceived ); +} +// + +// +void ShowIcmpV6ParameterData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", + statistics->ParameterProblemsSent, + statistics->ParameterProblemsReceived ); +} +// + +// +void ShowIcmpV6RouterData() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ statistics = properties->GetIcmpV6Statistics(); + Console::WriteLine( " Advertisements ....................... Sent: {0,-10} Received: {1,-10}", + statistics->RouterAdvertisementsSent, + statistics->RouterAdvertisementsReceived ); + Console::WriteLine( " Solicits ............................. Sent: {0,-10} Received: {1,-10}", + statistics->RouterSolicitsSent, + statistics->RouterSolicitsReceived ); +} +// + +// New content 10/29/03 +// +void DisplayDnsConfiguration() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum10 = adapters->GetEnumerator(); + while ( myEnum10->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum10->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( " DNS suffix................................. :{0}", + properties->DnsSuffix ); + Console::WriteLine( " DNS enabled ............................. : {0}", + properties->IsDnsEnabled ); + Console::WriteLine( " Dynamically configured DNS .............. : {0}", + properties->IsDynamicDnsEnabled ); + } +} +// + +// +void DisplayDnsAddresses() +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum11 = adapters->GetEnumerator(); + while ( myEnum11->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum11->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + IPAddressCollection ^ dnsServers = adapterProperties->DnsAddresses; + if ( dnsServers->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + System::Collections::IEnumerator^ myEnum12 = dnsServers->GetEnumerator(); + while ( myEnum12->MoveNext() ) + { + IPAddress ^ dns = safe_cast(myEnum12->Current); + Console::WriteLine( " DNS Servers ............................. : {0}", + dns->ToString()); + } + } + } +} +// + +// +void DisplayAnycastAddresses() +{ + int count = 0; + + Console::WriteLine( "Anycast Addresses" ); + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum13 = adapters->GetEnumerator(); + while ( myEnum13->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum13->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + IPAddressInformationCollection ^ anyCast = adapterProperties->AnycastAddresses; + if ( anyCast->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + System::Collections::IEnumerator^ myEnum14 = anyCast->GetEnumerator(); + while ( myEnum14->MoveNext() ) + { + IPAddressInformation ^ any = safe_cast(myEnum14->Current); + Console::WriteLine( " Anycast Address .......................... : {0} {1} {2}", + any->Address, any->IsTransient ? "Transient" : "", + any->IsDnsEligible ? "DNS Eligible" : "" ); + count++; + } + Console::WriteLine(); + } + } + if (count == 0) + { + Console::WriteLine(" No anycast addresses were found."); + Console::WriteLine(); + } +} +// + +// +void DisplayMulticastAddresses() +{ + int count = 0; + + Console::WriteLine( "Multicast Addresses" ); + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum15 = adapters->GetEnumerator(); + while ( myEnum15->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum15->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + MulticastIPAddressInformationCollection ^ multiCast = adapterProperties->MulticastAddresses; + if ( multiCast->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + System::Collections::IEnumerator^ myEnum16 = multiCast->GetEnumerator(); + while ( myEnum16->MoveNext() ) + { + MulticastIPAddressInformation ^ multi = safe_cast(myEnum16->Current); + Console::WriteLine( " Multicast Address ....................... : {0} {1} {2}", + multi->Address, multi->IsTransient ? "Transient" : "", + multi->IsDnsEligible ? "DNS Eligible" : "" ); + count++; + } + Console::WriteLine(); + } + } + if (count == 0) + { + Console::WriteLine(" No multicast addresses were found."); + Console::WriteLine(); + } +} +// + +// +void DisplayUnicastAddresses() +{ + Console::WriteLine( "Unicast Addresses" ); + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum17 = adapters->GetEnumerator(); + while ( myEnum17->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum17->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + UnicastIPAddressInformationCollection ^ uniCast = adapterProperties->UnicastAddresses; + if ( uniCast->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + String^ lifeTimeFormat = "dddd, MMMM dd, yyyy hh:mm:ss tt"; + System::Collections::IEnumerator^ myEnum18 = uniCast->GetEnumerator(); + while ( myEnum18->MoveNext() ) + { + UnicastIPAddressInformation ^ uni = safe_cast(myEnum18->Current); + DateTime when; + Console::WriteLine( " Unicast Address ......................... : {0}", + uni->Address ); + Console::WriteLine( " Prefix Origin ........................ : {0}", + uni->PrefixOrigin ); + Console::WriteLine( " Suffix Origin ........................ : {0}", + uni->SuffixOrigin ); + Console::WriteLine( " Duplicate Address Detection .......... : {0}", + uni->DuplicateAddressDetectionState ); + + // Format the lifetimes as Sunday, February 16, 2003 11:33:44 PM + // if en-us is the current culture. + // Calculate the date and time at the end of the lifetimes. + when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressValidLifetime ); + when = when.ToLocalTime(); + Console::WriteLine( " Valid Life Time ...................... : {0}", + when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); + when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressPreferredLifetime ); + when = when.ToLocalTime(); + Console::WriteLine( " Preferred life time .................. : {0}", + when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); + when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->DhcpLeaseLifetime ); + when = when.ToLocalTime(); + Console::WriteLine( " DHCP Leased Life Time ................ : {0}", + when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); + } + Console::WriteLine(); + } + } +} +// + +// +void DisplayDhcpServerAddresses() +{ + Console::WriteLine( "DHCP Servers" ); + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum19 = adapters->GetEnumerator(); + while ( myEnum19->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum19->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + IPAddressCollection ^ addresses = adapterProperties->DhcpServerAddresses; + if ( addresses->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + System::Collections::IEnumerator^ myEnum20 = addresses->GetEnumerator(); + while ( myEnum20->MoveNext() ) + { + IPAddress^ address = safe_cast(myEnum20->Current); + Console::WriteLine( " Dhcp Address ............................ : {0}", + address ); + } + Console::WriteLine(); + } + } +} +// + +// +void DisplayGatewayAddresses() +{ + Console::WriteLine( "Gateways" ); + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum21 = adapters->GetEnumerator(); + while ( myEnum21->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum21->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + GatewayIPAddressInformationCollection ^ addresses = adapterProperties->GatewayAddresses; + if ( addresses->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + System::Collections::IEnumerator^ myEnum22 = addresses->GetEnumerator(); + while ( myEnum22->MoveNext() ) + { + GatewayIPAddressInformation^ address = safe_cast(myEnum22->Current); + Console::WriteLine( " Gateway Address ......................... : {0}", + address->Address->ToString() ); + } + Console::WriteLine(); + } + } +} +// + +// +void DisplayIPv4NetworkInterfaces() +{ + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + Console::WriteLine( "IPv4 interface information for {0}.{1}", properties->HostName, properties->DomainName ); + System::Collections::IEnumerator^ myEnum23 = nics->GetEnumerator(); + while ( myEnum23->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum23->Current); + + // Only display informatin for interfaces that support IPv4. + if ( !adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) + { + continue; + } + Console::WriteLine(); + Console::WriteLine( adapter->Description ); + + // Underline the description. + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + + // Try to get the IPv4 interface properties. + IPv4InterfaceProperties ^ p = adapterProperties->GetIPv4Properties(); + + // Display the IPv4 specific data. + Console::WriteLine( " Index ............................. : {0}", + p->Index ); + Console::WriteLine( " MTU ............................... : {0}", + p->Mtu ); + Console::WriteLine( " APIPA active....................... : {0}", + p->IsAutomaticPrivateAddressingActive ); + Console::WriteLine( " APIPA enabled...................... : {0}", + p->IsAutomaticPrivateAddressingEnabled ); + Console::WriteLine( " Forwarding enabled................. : {0}", + p->IsForwardingEnabled ); + Console::WriteLine( " Uses WINS ......................... : {0}", + p->UsesWins ); + } +} +// + +// +void DisplayIPv6NetworkInterfaces() +{ + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + Console::WriteLine( "IPv6 interface information for {0}.{1}", + properties->HostName, properties->DomainName ); + + int count = 0; + + System::Collections::IEnumerator^ myEnum24 = nics->GetEnumerator(); + while ( myEnum24->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum24->Current); + + // Only display informatin for interfaces that support IPv6. + if ( !adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) + { + continue; + } + + count++; + + Console::WriteLine(); + Console::WriteLine( adapter->Description ); + + // Underline the description. + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + + // Try to get the IPv6 interface properties. + IPv6InterfaceProperties ^ p = adapterProperties->GetIPv6Properties(); + if ( !p ) + { + Console::WriteLine( "No IPv6 information is available for this interface." ); + continue; + } + + // Display the IPv6 specific data. + Console::WriteLine( " Index ............................. : {0}", + p->Index ); + Console::WriteLine( " MTU ............................... : {0}", + p->Mtu ); + } + if (count == 0) + { + Console::WriteLine(" No IPv6 interfaces were found."); + Console::WriteLine(); + } +} +// + +// +void DisplayWinsServerAddresses() +{ + Console::WriteLine( "WINS Servers" ); + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum25 = adapters->GetEnumerator(); + while ( myEnum25->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum25->Current); + IPInterfaceProperties ^ adapterProperties = adapter->GetIPProperties(); + IPAddressCollection ^ addresses = adapterProperties->WinsServersAddresses; + if ( addresses->Count > 0 ) + { + Console::WriteLine( adapter->Description ); + System::Collections::IEnumerator^ myEnum26 = addresses->GetEnumerator(); + while ( myEnum26->MoveNext() ) + { + IPAddress^ address = safe_cast(myEnum26->Current); + Console::WriteLine( " WINS Server ............................ : {0}", + address ); + } + Console::WriteLine(); + } + } +} +// + +// +void DisplayTypeAndAddress() +{ + IPGlobalProperties ^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + Console::WriteLine( "Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName ); + System::Collections::IEnumerator^ myEnum27 = nics->GetEnumerator(); + while ( myEnum27->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum27->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + Console::WriteLine( " Interface type .......................... : {0}", + adapter->NetworkInterfaceType ); + Console::WriteLine( " Physical Address ........................ : {0}", + adapter->GetPhysicalAddress() ); + Console::WriteLine( " Is receive only.......................... : {0}", + adapter->IsReceiveOnly ); + Console::WriteLine( " Multicast................................ : {0}", + adapter->SupportsMulticast ); + } +} +// + +int main() +{ + DisplayDnsAddresses(); + DisplayDnsConfiguration(); + DisplayAnycastAddresses(); + DisplayMulticastAddresses(); + DisplayUnicastAddresses(); + + DisplayDhcpServerAddresses(); + DisplayGatewayAddresses(); + + DisplayIPv4NetworkInterfaces(); + DisplayIPv6NetworkInterfaces(); + DisplayWinsServerAddresses(); + + DisplayTypeAndAddress(); + + GetTcpConnections(); + CountTcpConnections(); + DisplayActiveUdpListeners(); + ShowTcpSegmentData(); + ShowTcpConnectionStatistics(); + ShowTcpTimeouts(); + ShowInterfaceSpeedAndQueue(); + ShowPacketErrors(); + ShowPacketDiscards(); + ShowNonUnicastCounts(); + ShowUnicastCounts(); + ShowInterfaceByteCounts(); + ShowFragmentationStatistics(); + ShowOutboundIPStatistics(); + // + ShowInboundIPErrors(); + ShowInboundIPStatistics(); + ShowIPStatistics(); + if (Socket::OSSupportsIPv6) + { + ShowIcmpV6MessageData(); + ShowIcmpV6EchoData(); + ShowIcmpV6ErrorData(); + ShowIcmpV6UnreachableData (); + ShowIcmpV6RouterData (); + } + ShowRedirectsData(); + ShowTimeExceededData(); + if (Socket::OSSupportsIPv6) + { + ShowIcmpV6ParameterData (); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp new file mode 100644 index 00000000000..850060ff81c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLNetInfoReport/CPP/netinfo.cpp @@ -0,0 +1,603 @@ + + +// Sample NCLNetInfoReport +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Net::NetworkInformation; +using namespace System::Text; + +// +void ShowIPStatistics( NetworkInterfaceComponent version ) +{ + // + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IPGlobalStatistics ^ ipstat = nullptr; + switch ( version ) + { + case NetworkInterfaceComponent::IPv4: + ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( "{0}IPv4 Statistics ", Environment::NewLine ); + break; + + case NetworkInterfaceComponent::IPv6: + ipstat = properties->GetIPv4GlobalStatistics(); + Console::WriteLine( "{0}IPv6 Statistics ", Environment::NewLine ); + break; + + default: + throw gcnew ArgumentException( "version" ); + break; + } + // + + Console::WriteLine( " Forwarding enabled ...................... : {0}", + ipstat->ForwardingEnabled ); + Console::WriteLine( " Interfaces .............................. : {0}", + ipstat->NumberOfInterfaces ); + Console::WriteLine( " IP addresses ............................ : {0}", + ipstat->NumberOfIPAddresses ); + Console::WriteLine( " Routes .................................. : {0}", + ipstat->NumberOfRoutes ); + Console::WriteLine( " Default TTL ............................. : {0}", + ipstat->DefaultTtl ); + Console::WriteLine( "" ); + Console::WriteLine( " Inbound Packet Data:" ); + Console::WriteLine( " Received ............................ : {0}", + ipstat->ReceivedPackets ); + Console::WriteLine( " Forwarded ........................... : {0}", + ipstat->ReceivedPacketsForwarded ); + Console::WriteLine( " Delivered ........................... : {0}", + ipstat->ReceivedPacketsDelivered ); + Console::WriteLine( " Discarded ........................... : {0}", + ipstat->ReceivedPacketsDiscarded ); + Console::WriteLine( " Header Errors ....................... : {0}", + ipstat->ReceivedPacketsWithHeadersErrors ); + Console::WriteLine( " Address Errors ...................... : {0}", + ipstat->ReceivedPacketsWithAddressErrors ); + Console::WriteLine( " Unknown Protocol Errors ............. : {0}", + ipstat->ReceivedPacketsWithUnknownProtocol ); + Console::WriteLine( "" ); + Console::WriteLine( " Outbound Packet Data:" ); + Console::WriteLine( " Requested ........................... : {0}", + ipstat->OutputPacketRequests ); + Console::WriteLine( " Discarded ........................... : {0}", + ipstat->OutputPacketsDiscarded ); + Console::WriteLine( " No Routing Discards ................. : {0}", + ipstat->OutputPacketsWithNoRoute ); + Console::WriteLine( " Routing Entry Discards .............. : {0}", + ipstat->OutputPacketRoutingDiscards ); + Console::WriteLine( "" ); + Console::WriteLine( " Reassembly Data:" ); + Console::WriteLine( " Reassembly Timeout .................. : {0}", + ipstat->PacketReassemblyTimeout ); + Console::WriteLine( " Reassemblies Required ............... : {0}", + ipstat->PacketReassembliesRequired ); + Console::WriteLine( " Packets Reassembled ................. : {0}", + ipstat->PacketsReassembled ); + Console::WriteLine( " Packets Fragmented .................. : {0}", + ipstat->PacketsFragmented ); + Console::WriteLine( " Fragment Failures ................... : {0}", + ipstat->PacketFragmentFailures ); + Console::WriteLine( "" ); +} +// + +// +void ShowTcpStatistics( NetworkInterfaceComponent version ) +{ + // + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + TcpStatistics ^ tcpstat = nullptr; + Console::WriteLine( "" ); + switch ( version ) + { + case NetworkInterfaceComponent::IPv4: + tcpstat = properties->GetTcpIPv4Statistics(); + Console::WriteLine( "TCP/IPv4 Statistics:" ); + break; + + case NetworkInterfaceComponent::IPv6: + tcpstat = properties->GetTcpIPv6Statistics(); + Console::WriteLine( "TCP/IPv6 Statistics:" ); + break; + + default: + throw gcnew ArgumentException( "version" ); + break; + } + // + Console::WriteLine( " Minimum Transmission Timeout............. : {0}", + tcpstat->MinimumTransmissionTimeout ); + Console::WriteLine( " Maximum Transmission Timeout............. : {0}", + tcpstat->MaximumTransmissionTimeout ); + Console::WriteLine( " Connection Data:" ); + Console::WriteLine( " Current ............................ : {0}", + tcpstat->CurrentConnections ); + Console::WriteLine( " Cumulative .......................... : {0}", + tcpstat->CumulativeConnections ); + Console::WriteLine( " Initiated ........................... : {0}", + tcpstat->ConnectionsInitiated ); + Console::WriteLine( " Accepted ............................ : {0}", + tcpstat->ConnectionsAccepted ); + Console::WriteLine( " Failed Attempts ..................... : {0}", + tcpstat->FailedConnectionAttempts ); + Console::WriteLine( " Reset ............................... : {0}", + tcpstat->ResetConnections ); + Console::WriteLine( "" ); + Console::WriteLine( " Segment Data:" ); + Console::WriteLine( " Received ........................... : {0}", + tcpstat->SegmentsReceived ); + Console::WriteLine( " Sent ................................ : {0}", + tcpstat->SegmentsSent ); + Console::WriteLine( " Retransmitted ....................... : {0}", + tcpstat->SegmentsResent ); + Console::WriteLine( "" ); +} +// + +// +void ShowUdpStatistics( NetworkInterfaceComponent version ) +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + UdpStatistics ^ udpStat = nullptr; + switch ( version ) + { + case NetworkInterfaceComponent::IPv4: + udpStat = properties->GetUdpIPv4Statistics(); + Console::WriteLine( "UDP IPv4 Statistics" ); + break; + + case NetworkInterfaceComponent::IPv6: + udpStat = properties->GetUdpIPv6Statistics(); + Console::WriteLine( "UDP IPv6 Statistics" ); + break; + + default: + throw gcnew ArgumentException( "version" ); + break; + } + Console::WriteLine( " Datagrams Received ...................... : {0}", udpStat->DatagramsReceived ); + Console::WriteLine( " Datagrams Sent .......................... : {0}", udpStat->DatagramsSent ); + Console::WriteLine( " Incoming Datagrams Discarded ............ : {0}", udpStat->IncomingDatagramsDiscarded ); + Console::WriteLine( " Incoming Datagrams With Errors .......... : {0}", udpStat->IncomingDatagramsWithErrors ); + Console::WriteLine( " UDP Listeners ........................... : {0}", udpStat->UdpListeners ); + Console::WriteLine( "" ); +} +// + +// +void ShowEchoIcmpv4( IcmpV4Statistics ^ stat4 ) +{ + if ( stat4 != nullptr ) + { + Console::WriteLine( "ICMP v4 Echo Requests ................. Sent: {0,-10} Received: {1,-10}", stat4->EchoRequestsSent, stat4->EchoRequestsReceived ); + Console::WriteLine( "ICMP v4 Echo Replies .................. Sent: {0,-10} Received: {1,-10}", stat4->EchoRepliesSent, stat4->EchoRepliesReceived ); + } +} + +void ShowEchoIcmpv6( IcmpV6Statistics ^ stat6 ) +{ + if ( stat6 != nullptr ) + { + Console::WriteLine( "ICMP v6 Echo Requests.................. Sent: {0,-10} Received: {1,-10}", stat6->EchoRequestsSent, stat6->EchoRequestsReceived ); + Console::WriteLine( "ICMP v6 Echo Replies .................. Sent: {0,-10} Received: {1,-10}", stat6->EchoRepliesSent, stat6->EchoRepliesReceived ); + } +} + +// + +// +void ShowIcmpv4MessagesAndErrors( IcmpV4Statistics ^ stat4 ) +{ + if ( stat4 != nullptr ) + { + Console::WriteLine( "ICMP v4 Messages ...................... Sent: {0,-10} Received: {1,-10}", stat4->MessagesSent, stat4->MessagesReceived ); + Console::WriteLine( "ICMP v6 Errors ........................ Sent: {0,-10} Received: {1,-10}", stat4->ErrorsSent, stat4->ErrorsReceived ); + } + +} + +void ShowIcmpv6MessagesAndErrors( IcmpV6Statistics ^ stat6 ) +{ + if ( stat6 != nullptr ) + { + Console::WriteLine( "ICMP v6 Messages ...................... Sent: {0,-10} Received: {1,-10}", stat6->MessagesSent, stat6->MessagesReceived ); + Console::WriteLine( "ICMP v6 Errors ........................ Sent: {0,-10} Received: {1,-10}", stat6->ErrorsSent, stat6->ErrorsReceived ); + } +} +// + +// +void ShowIcmpV4Statistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV4Statistics ^ stat = properties->GetIcmpV4Statistics(); + Console::WriteLine( "ICMP V4 Statistics:" ); + Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", stat->MessagesSent, stat->MessagesReceived ); + Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", stat->ErrorsSent, stat->ErrorsReceived ); + Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", stat->EchoRequestsSent, stat->EchoRequestsReceived ); + Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", stat->EchoRepliesSent, stat->EchoRepliesReceived ); + Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", stat->DestinationUnreachableMessagesSent, stat->DestinationUnreachableMessagesReceived ); + Console::WriteLine( " Source Quenches ..................... Sent: {0,-10} Received: {1,-10}", stat->SourceQuenchesSent, stat->SourceQuenchesReceived ); + Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", stat->RedirectsSent, stat->RedirectsReceived ); + Console::WriteLine( " TimeExceeded ........................ Sent: {0,-10} Received: {1,-10}", stat->TimeExceededMessagesSent, stat->TimeExceededMessagesReceived ); + Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", stat->ParameterProblemsSent, stat->ParameterProblemsReceived ); + Console::WriteLine( " Timestamp Requests .................. Sent: {0,-10} Received: {1,-10}", stat->TimestampRequestsSent, stat->TimestampRequestsReceived ); + Console::WriteLine( " Timestamp Replies ................... Sent: {0,-10} Received: {1,-10}", stat->TimestampRepliesSent, stat->TimestampRepliesReceived ); + Console::WriteLine( " Address Mask Requests ............... Sent: {0,-10} Received: {1,-10}", stat->AddressMaskRequestsSent, stat->AddressMaskRequestsReceived ); + Console::WriteLine( " Address Mask Replies ................ Sent: {0,-10} Received: {1,-10}", stat->AddressMaskRepliesSent, stat->AddressMaskRepliesReceived ); + Console::WriteLine( "" ); +} +// + +// +void ShowIcmpV6Statistics() +{ + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + IcmpV6Statistics ^ stat = properties->GetIcmpV6Statistics(); + Console::WriteLine( "ICMP V6 Statistics:" ); + Console::WriteLine( " Messages ............................ Sent: {0,-10} Received: {1,-10}", stat->MessagesSent, stat->MessagesReceived ); + Console::WriteLine( " Errors .............................. Sent: {0,-10} Received: {1,-10}", stat->ErrorsSent, stat->ErrorsReceived ); + Console::WriteLine( " Echo Requests ....................... Sent: {0,-10} Received: {1,-10}", stat->EchoRequestsSent, stat->EchoRequestsReceived ); + Console::WriteLine( " Echo Replies ........................ Sent: {0,-10} Received: {1,-10}", stat->EchoRepliesSent, stat->EchoRepliesReceived ); + Console::WriteLine( " Destination Unreachables ............ Sent: {0,-10} Received: {1,-10}", stat->DestinationUnreachableMessagesSent, stat->DestinationUnreachableMessagesReceived ); + Console::WriteLine( " Parameter Problems .................. Sent: {0,-10} Received: {1,-10}", stat->ParameterProblemsSent, stat->ParameterProblemsReceived ); + Console::WriteLine( " Packets Too Big ..................... Sent: {0,-10} Received: {1,-10}", stat->PacketTooBigMessagesSent, stat->PacketTooBigMessagesReceived ); + Console::WriteLine( " Redirects ........................... Sent: {0,-10} Received: {1,-10}", stat->RedirectsSent, stat->RedirectsReceived ); + Console::WriteLine( " Router Advertisements ............... Sent: {0,-10} Received: {1,-10}", stat->RouterAdvertisementsSent, stat->RouterAdvertisementsReceived ); + Console::WriteLine( " Router Solicitations ................ Sent: {0,-10} Received: {1,-10}", stat->RouterSolicitsSent, stat->RouterSolicitsReceived ); + Console::WriteLine( " Time Exceeded ....................... Sent: {0,-10} Received: {1,-10}", stat->TimeExceededMessagesSent, stat->TimeExceededMessagesReceived ); + Console::WriteLine( " Neighbor Advertisements ............. Sent: {0,-10} Received: {1,-10}", stat->NeighborAdvertisementsSent, stat->NeighborAdvertisementsReceived ); + Console::WriteLine( " Neighbor Solicitations .............. Sent: {0,-10} Received: {1,-10}", stat->NeighborSolicitsSent, stat->NeighborSolicitsReceived ); + Console::WriteLine( " Membership Queries .................. Sent: {0,-10} Received: {1,-10}", stat->MembershipQueriesSent, stat->MembershipQueriesReceived ); + Console::WriteLine( " Membership Reports .................. Sent: {0,-10} Received: {1,-10}", stat->MembershipReportsSent, stat->MembershipReportsReceived ); + Console::WriteLine( " Membership Reductions ............... Sent: {0,-10} Received: {1,-10}", stat->MembershipReductionsSent, stat->MembershipReductionsReceived ); + Console::WriteLine( "" ); +} +// + +// +void ShowIPAddresses( String^ label, IPAddressCollection^ addresses ) +{ + if ( addresses->Count == 0 ) + return; + +// Console::WriteLine( "{0} {1} ", label, addresses->Item[ 0 ] ); + if ( addresses->Count > 1 ) + { + for ( int i = 1; i < addresses->Count; i++ ) + { + String^ address = addresses->ToString(); + String^ line = address->PadLeft( label->Length + address->Length + 1 ); + Console::WriteLine( "{0}", line ); + + } + } +} +// + +// +void ShowIPAddresses( IPInterfaceProperties ^ adapterProperties ) +{ + // + IPAddressCollection ^ dnsServers = adapterProperties->DnsAddresses; + if ( dnsServers != nullptr ) + { + System::Collections::IEnumerator^ myEnum = dnsServers->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + IPAddressInformation ^ dns = safe_cast(myEnum->Current); + Console::WriteLine( " DNS Servers ............................. : {0} ({1} {2})", + dns->Address, dns->IsTransient ? (String^)"Transient" : "", dns->IsDnsEligible ? (String^)"DNS Eligible" : "" ); + } + } + // + + IPAddressInformationCollection ^ anyCast = adapterProperties->AnycastAddresses; + if ( anyCast != nullptr ) + { + System::Collections::IEnumerator^ myEnum1 = anyCast->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + IPAddressInformation ^ any = safe_cast(myEnum1->Current); + Console::WriteLine( " Anycast Address .......................... : {0} {1} {2}", any->Address, any->IsTransient ? (String^)"Transient" : "", any->IsDnsEligible ? (String^)"DNS Eligible" : "" ); + } + + Console::WriteLine(); + } + + MulticastIPAddressInformationCollection ^ multiCast = adapterProperties->MulticastAddresses; + if ( multiCast != nullptr ) + { + System::Collections::IEnumerator^ myEnum2 = multiCast->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + IPAddressInformation ^ multi = safe_cast(myEnum2->Current); + Console::WriteLine( " Multicast Address ....................... : {0} {1} {2}", multi->Address, multi->IsTransient ? (String^)"Transient" : "", multi->IsDnsEligible ? (String^)"DNS Eligible" : "" ); + } + + Console::WriteLine(); + } + + // + UnicastIPAddressInformationCollection ^ uniCast = adapterProperties->UnicastAddresses; + if ( uniCast != nullptr ) + { + String^ lifeTimeFormat = "dddd, MMMM dd, yyyy hh:mm:ss tt"; + System::Collections::IEnumerator^ myEnum3 = uniCast->GetEnumerator(); + while ( myEnum3->MoveNext() ) + { + UnicastIPAddressInformation ^ uni = safe_cast(myEnum3->Current); + DateTime when; + Console::WriteLine( " Unicast Address ......................... : {0}", uni->Address ); + Console::WriteLine( " Prefix Origin ........................ : {0}", uni->PrefixOrigin ); + Console::WriteLine( " Suffix Origin ........................ : {0}", uni->SuffixOrigin ); + Console::WriteLine( " Duplicate Address Detection .......... : {0}", uni->DuplicateAddressDetectionState ); + + // Format the lifetimes as Sunday, February 16, 2003 11:33:44 PM + // if en-us is the current culture. + // Calculate the date and time at the end of the lifetimes. + when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressValidLifetime ); + when = when.ToLocalTime(); + Console::WriteLine( " Valid Life Time ...................... : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); + when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->AddressPreferredLifetime ); + when = when.ToLocalTime(); + Console::WriteLine( " Preferred life time .................. : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); + when = DateTime::UtcNow + TimeSpan::FromSeconds( (double)uni->DhcpLeaseLifetime ); + when = when.ToLocalTime(); + Console::WriteLine( " DHCP Leased Life Time ................ : {0}", when.ToString( lifeTimeFormat, System::Globalization::CultureInfo::CurrentCulture ) ); + } + + Console::WriteLine(); + } + // +} +// + +// +void ShowInterfaceStatistics( NetworkInterface ^ adapter ) +{ + IPv4InterfaceStatistics ^ stats = adapter->GetIPv4Statistics(); + Console::WriteLine( "{0} Interface Statistics:", Environment::NewLine ); + Console::WriteLine( " Bytes sent ........................... : {0}", + stats->BytesSent ); + Console::WriteLine( " Bytes received ....................... : {0}", + stats->BytesReceived ); + Console::WriteLine( " Unicast Packets Sent ................. : {0}", + stats->UnicastPacketsSent ); + Console::WriteLine( " Unicast Packets Received ............. : {0}", + stats->UnicastPacketsReceived ); + Console::WriteLine( " Non Unicast Packets Sent ............. : {0}", + stats->NonUnicastPacketsSent ); + Console::WriteLine( " Non Unicast Packets Received ......... : {0}", + stats->NonUnicastPacketsReceived ); + Console::WriteLine( " Incoming Packets Discarded ........... : {0}", + stats->IncomingPacketsDiscarded ); + Console::WriteLine( " Outgoing Packets Discarded ........... : {0}", + stats->OutgoingPacketsDiscarded ); + Console::WriteLine( " Incoming Packets Errors .............. : {0}", + stats->IncomingPacketsWithErrors ); + Console::WriteLine( " Outgoing packets Errors .............. : {0}", + stats->OutgoingPacketsWithErrors ); + Console::WriteLine( " Incoming Unknown Protocol Errors ..... : {0}", + stats->IncomingUnknownProtocolPackets ); + Console::WriteLine( " Speed ................................ : {0}", + adapter->Speed ); + Console::WriteLine( " Output queue length................... : {0}", + stats->OutputQueueLength ); + Console::WriteLine(); +} +// + +// +void ShowNetworkInterfaces() +{ + IPGlobalProperties ^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + Console::WriteLine( "Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName ); + if ( nics == nullptr || nics->Length < 1 ) + { + Console::WriteLine( " No network interfaces found." ); + return; + } + + Console::WriteLine( " Number of interfaces .................... : {0}", nics->Length ); + System::Collections::IEnumerator^ myEnum4 = nics->GetEnumerator(); + while ( myEnum4->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum4->Current); + IPInterfaceProperties ^ properties = adapter->GetIPProperties(); + Console::WriteLine(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + Console::WriteLine( " Interface type .......................... : {0}", + adapter->NetworkInterfaceType ); + Console::WriteLine( " Physical Address ........................ : {0}", + adapter->GetPhysicalAddress() ); + Console::WriteLine( " Operational status ...................... : {0}", + adapter->OperationalStatus ); + String^ versions = ""; + + // Create a display string for the supported IP versions. + if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) + { + versions = "IPv4"; + } + if ( adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) + { + if ( versions->Length > 0 ) + { + versions = String::Concat( versions, " " ); + } + versions = String::Concat( versions, "IPv6" ); + } + Console::WriteLine( " IP version .............................. : {0}", + versions ); + ShowIPAddresses( properties ); + + // The following information is not useful for loopback adapters. + if ( adapter->NetworkInterfaceType == NetworkInterfaceType::Loopback ) + { + continue; + } + Console::WriteLine( " DNS suffix .............................. : {0}", + properties->DnsSuffix ); + String^ label; + + // + if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) + { + IPv4InterfaceProperties ^ ipv4 = properties->GetIPv4Properties(); + Console::WriteLine( " MTU...................................... : {0}", + ipv4->Mtu ); + if ( ipv4->UsesWins ) + { + IPAddressCollection ^ winsServers = properties->WinsServersAddresses; + if ( winsServers->Count > 0 ) + { + label = " WINS Servers ............................ :"; + ShowIPAddresses( label, winsServers ); + } + } + } + // + Console::WriteLine( " DNS enabled ............................. : {0}", + properties->IsDnsEnabled ); + Console::WriteLine( " Dynamically configured DNS .............. : {0}", + properties->IsDynamicDnsEnabled ); + Console::WriteLine( " Receive Only ............................ : {0}", + adapter->IsReceiveOnly ); + Console::WriteLine( " Multicast ............................... : {0}", + adapter->SupportsMulticast ); + ShowInterfaceStatistics( adapter ); + Console::WriteLine(); + } +} +// + + +// +void ShowInterfaceSummary() +{ + array^interfaces = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum5 = interfaces->GetEnumerator(); + while ( myEnum5->MoveNext() ) + { + NetworkInterface ^ adapter = safe_cast(myEnum5->Current); + Console::WriteLine( "Name: {0}", adapter->Name ); + Console::WriteLine( adapter->Description ); + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + Console::WriteLine( " Interface type .......................... : {0}", + adapter->NetworkInterfaceType ); + Console::WriteLine( " Operational status ...................... : {0}", adapter->OperationalStatus ); + String^ versions = ""; + + // Create a display string for the supported IP versions. + if ( adapter->Supports( NetworkInterfaceComponent::IPv4 ) ) + { + versions = "IPv4"; + } + + if ( adapter->Supports( NetworkInterfaceComponent::IPv6 ) ) + { + if ( versions->Length > 0 ) + { + versions = String::Concat( versions, " " ); + } + + versions = String::Concat( versions, "IPv6" ); + } + + Console::WriteLine( " IP version .............................. : {0}", versions ); + Console::WriteLine(); + } + + Console::WriteLine(); +} +// + +// +void ShowActiveTcpConnections() +{ + Console::WriteLine( "Active TCP Connections" ); + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + array^connections = properties->GetActiveTcpConnections(); + System::Collections::IEnumerator^ myEnum6 = connections->GetEnumerator(); + while ( myEnum6->MoveNext() ) + { + TcpConnectionInformation ^ c = safe_cast(myEnum6->Current); + Console::WriteLine( "{0} <==> {1}", c->LocalEndPoint, c->RemoteEndPoint ); + } +} +// + +// +void ShowActiveTcpListeners() +{ + Console::WriteLine( "Active TCP Listeners" ); + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + array^endPoints = properties->GetActiveTcpListeners(); + System::Collections::IEnumerator^ myEnum7 = endPoints->GetEnumerator(); + while ( myEnum7->MoveNext() ) + { + IPEndPoint^ e = safe_cast(myEnum7->Current); + Console::WriteLine( e ); + } +} +// + +// +void ShowActiveUdpListeners() +{ + Console::WriteLine( "Active UDP Listeners" ); + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + array^endPoints = properties->GetActiveUdpListeners(); + System::Collections::IEnumerator^ myEnum8 = endPoints->GetEnumerator(); + while ( myEnum8->MoveNext() ) + { + IPEndPoint^ e = safe_cast(myEnum8->Current); + Console::WriteLine( e ); + } +} +// + +int main() +{ + // + IPGlobalProperties ^ properties = IPGlobalProperties::GetIPGlobalProperties(); + Console::WriteLine( "Computer name: {0}", properties->HostName ); + Console::WriteLine( "Domain name: {0}", properties->DomainName ); + Console::WriteLine( "Node type: {0:f}", properties->NodeType ); + Console::WriteLine( "DHCP scope: {0}", properties->DhcpScopeName ); + Console::WriteLine( "WINS proxy? {0}", properties->IsWinsProxy ); + // + + ShowActiveTcpConnections(); + ShowActiveTcpListeners(); + ShowActiveUdpListeners(); + if (Socket::SupportsIPv4) + { + ShowIcmpV4Statistics(); + } + if (Socket::OSSupportsIPv6) + { + ShowIcmpV6Statistics(); + } + ShowIPStatistics( NetworkInterfaceComponent::IPv4 ); + ShowTcpStatistics( NetworkInterfaceComponent::IPv4 ); + ShowUdpStatistics( NetworkInterfaceComponent::IPv4 ); + ShowEchoIcmpv4(properties->GetIcmpV4Statistics()); + ShowIcmpv4MessagesAndErrors(properties->GetIcmpV4Statistics()); + + if (Socket::OSSupportsIPv6) + { + ShowEchoIcmpv6(properties->GetIcmpV6Statistics()); + ShowIcmpv6MessagesAndErrors(properties->GetIcmpV6Statistics()); + } + + ShowNetworkInterfaces(); + ShowInterfaceSummary(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp new file mode 100644 index 00000000000..c3837c32960 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLPhysicalAddress/CPP/NCLPhysicalAddress.cpp @@ -0,0 +1,140 @@ + +#using + +using namespace System; +using namespace System::Net::NetworkInformation; +using namespace System::Collections; + +// +void DisplayAddressNone() +{ + PhysicalAddress^ none = PhysicalAddress::None; + Console::WriteLine( L"None: {0}", none ); + array^bytes = none->GetAddressBytes(); + System::Collections::IEnumerator^ myEnum = bytes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Byte b = safe_cast(myEnum->Current); + Console::Write( L"{0} ", b.ToString() ); + } + + Console::WriteLine(); +} + + +// +// +void ShowNetworkInterfaces() +{ + IPGlobalProperties^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + Console::WriteLine( L"Interface information for {0}.{1} ", computerProperties->HostName, computerProperties->DomainName ); + if ( nics == nullptr || nics->Length < 1 ) + { + Console::WriteLine( L" No network interfaces found." ); + return; + } + + Console::WriteLine( L" Number of interfaces .................... : {0}", (nics->Length).ToString() ); + IEnumerator^ myEnum1 = nics->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + NetworkInterface^ adapter = safe_cast(myEnum1->Current); + IPInterfaceProperties^ properties = adapter->GetIPProperties(); + Console::WriteLine(); + Console::WriteLine( adapter->Description ); + Console::WriteLine( String::Empty->PadLeft( adapter->Description->Length, '=' ) ); + Console::WriteLine( L" Interface type .......................... : {0}", adapter->NetworkInterfaceType ); + Console::Write( L" Physical address ........................ : " ); + PhysicalAddress^ address = adapter->GetPhysicalAddress(); + array^bytes = address->GetAddressBytes(); + for ( int i = 0; i < bytes->Length; i++ ) + { + + // Display the physical address in hexadecimal. + Console::Write( L"{0}", bytes[ i ].ToString( L"X2" ) ); + + // Insert a hyphen after each byte, unless we are at the end of the + // address. + if ( i != bytes->Length - 1 ) + { + Console::Write( L"-" ); + } + + } + Console::WriteLine(); + } +} + + +// +// +void ParseTest() +{ + PhysicalAddress^ address = PhysicalAddress::Parse( L"AC1EBA22" ); + Console::WriteLine( L"Address parsed as {0}", address->ToString() ); + PhysicalAddress^ address2 = PhysicalAddress::Parse( L"ac1eba22" ); + Console::WriteLine( L"Address2 parsed as {0}", address2->ToString() ); + bool test = address->Equals( address2 ); + Console::WriteLine( L"Equal? {0}", test ); +} + + +// +// +array^ StoreNetworkInterfaceAddresses() +{ + IPGlobalProperties^ computerProperties = IPGlobalProperties::GetIPGlobalProperties(); + array^nics = NetworkInterface::GetAllNetworkInterfaces(); + if ( nics == nullptr || nics->Length < 1 ) + { + Console::WriteLine( L" No network interfaces found." ); + return nullptr; + } + + array^ addresses = gcnew array(nics->Length); + int i = 0; + IEnumerator^ myEnum2 = nics->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + NetworkInterface^ adapter = safe_cast(myEnum2->Current); + IPInterfaceProperties^ properties = adapter->GetIPProperties(); + PhysicalAddress^ address = adapter->GetPhysicalAddress(); + array^bytes = address->GetAddressBytes(); + PhysicalAddress^ newAddress = gcnew PhysicalAddress( bytes ); + addresses[ i++ ] = newAddress; + } + + return addresses; +} + + +// +// +PhysicalAddress^ StrictParseAddress( String^ address ) +{ + PhysicalAddress^ newAddress = PhysicalAddress::Parse( address ); + if ( PhysicalAddress::None->Equals( newAddress ) ) + return nullptr; + + return newAddress; +} + + +// +int main() +{ + + DisplayAddressNone(); + ShowNetworkInterfaces(); + ParseTest(); + /* PhysicalAddress[] addresses = StoreNetworkInterfaceAddresses(); + foreach (PhysicalAddress address in addresses) + { + Console.WriteLine(address.ToString()); + } + */ + PhysicalAddress^ a = StrictParseAddress( nullptr ); + Console::WriteLine( a == nullptr ? L"null" : a->ToString() ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp new file mode 100644 index 00000000000..845a8d231bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLPingSampler/CPP/pingtest.cpp @@ -0,0 +1,249 @@ + + +//NCLPingSampler +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::NetworkInformation; +using namespace System::Text; +using namespace System::Threading; + +// +void SimplePing(); +void ComplexPing(); +void LocalPing(); +void ComplexLocalPing(); +void LocalPingTimeout(); +void AsyncComplexLocalPing(); +void PingCompletedCallback( Object^ sender, PingCompletedEventArgs^ e ); + +int main() +{ + +// SimplePing(); + LocalPing(); Console::WriteLine(); +// ComplexPing(); Console::WriteLine(); + ComplexLocalPing(); Console::WriteLine(); + AsyncComplexLocalPing(); +} + + +// +void SimplePing() +{ + Ping ^ pingSender = gcnew Ping; + PingReply ^ reply = pingSender->Send( "www.contoso.com" ); + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } + else + { + Console::WriteLine( reply->Status ); + } +} + + +// +// +void ComplexPing() +{ + Ping ^ pingSender = gcnew Ping; + + // Create a buffer of 32 bytes of data to be transmitted. + String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + array^buffer = Encoding::ASCII->GetBytes( data ); + + // Wait 10 seconds for a reply. + int timeout = 10000; + + // Set options for transmission: + // The data can go through 64 gateways or routers + // before it is destroyed, and the data packet + // cannot be fragmented. + PingOptions ^ options = gcnew PingOptions( 64,true ); + + // Send the request. + PingReply ^ reply = pingSender->Send( "www.contoso.com", timeout, buffer, options ); + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } + else + { + Console::WriteLine( reply->Status ); + } +} + + +// +// +void LocalPing() +{ + + // Ping's the local machine. + Ping ^ pingSender = gcnew Ping; + IPAddress^ address = IPAddress::Loopback; + PingReply ^ reply = pingSender->Send( address ); + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } + else + { + Console::WriteLine( reply->Status ); + } +} + + +// +// +void ComplexLocalPing() +{ + + // Ping's the local machine. + Ping ^ pingSender = gcnew Ping; + IPAddress^ address = IPAddress::Loopback; + + // Create a buffer of 32 bytes of data to be transmitted. + String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + array^buffer = Encoding::ASCII->GetBytes( data ); + + // Wait 10 seconds for a reply. + int timeout = 10000; + + // Set options for transmission: + // The data can go through 64 gateways or routers + // before it is destroyed, and the data packet + // cannot be fragmented. + PingOptions ^ options = gcnew PingOptions( 64,true ); + PingReply ^ reply = pingSender->Send( address, timeout, buffer, options ); + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } + else + { + Console::WriteLine( reply->Status ); + } +} + + +// +// +void LocalPingTimeout() +{ + + // Ping's the local machine. + Ping ^ pingSender = gcnew Ping; + IPAddress^ address = IPAddress::Loopback; + + // Create a buffer of 32 bytes of data to be transmitted. + String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + array^buffer = Encoding::ASCII->GetBytes( data ); + + // Wait 10 seconds for a reply. + int timeout = 10000; + PingReply ^ reply = pingSender->Send( address, timeout, buffer); + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } + else + { + Console::WriteLine( reply->Status ); + } +} + + +// +// +void AsyncComplexLocalPing() +{ + + // Get an object that will block the main thread. + AutoResetEvent^ waiter = gcnew AutoResetEvent( false ); + + // Ping's the local machine. + Ping ^ pingSender = gcnew Ping; + + // When the PingCompleted event is raised, + // the PingCompletedCallback method is called. + pingSender->PingCompleted += gcnew PingCompletedEventHandler( PingCompletedCallback ); + IPAddress^ address = IPAddress::Loopback; + + // Create a buffer of 32 bytes of data to be transmitted. + String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + array^buffer = Encoding::ASCII->GetBytes( data ); + + // Wait 10 seconds for a reply. + int timeout = 10000; + + // Set options for transmission: + // The data can go through 64 gateways or routers + // before it is destroyed, and the data packet + // cannot be fragmented. + PingOptions ^ options = gcnew PingOptions( 64,true ); + + // Send the ping asynchronously. + // Use the waiter as the user token. + // When the callback completes, it can wake up this thread. + pingSender->SendAsync( address, timeout, buffer, options, waiter ); + + // Prevent this example application from ending. + // A real application should do something useful + // when possible. + waiter->WaitOne(); + Console::WriteLine( "Ping example completed." ); +} + + +// +// +void PingCompletedCallback( Object^ /*sender*/, PingCompletedEventArgs^ e ) +{ + + // If the operation was canceled, display a message to the user. + if ( e->Cancelled ) + { + Console::WriteLine( "Ping canceled." ); + } + + + // If an error occurred, display the exception to the user. + if ( e->Error != nullptr ) + { + Console::WriteLine( "Ping failed:" ); + Console::WriteLine( e->Error->ToString() ); + } + + PingReply ^ reply = e->Reply; + Console::WriteLine( reply->Status ); + + // Let the main thread resume. + (dynamic_cast(e->UserState))->Set(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp new file mode 100644 index 00000000000..d4bf6281427 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLResponse1/CPP/httpwebrequest1.cpp @@ -0,0 +1,51 @@ + + +// SampleID="NCLResponse1" +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +using namespace System::IO; + +// Specify the URL to receive the request. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + HttpWebRequest^ request = dynamic_cast(WebRequest::Create(args[1])); + + // Set some reasonable limits on resources used by this request + request->MaximumAutomaticRedirections = 4; + request->MaximumResponseHeadersLength = 4; + + // Set credentials to use for this request. + request->Credentials = CredentialCache::DefaultCredentials; + HttpWebResponse^ response = dynamic_cast(request->GetResponse()); + Console::WriteLine("Content length is {0}", response->ContentLength); + Console::WriteLine("Content type is {0}", response->ContentType); + + // Get the stream associated with the response. + Stream^ receiveStream = response->GetResponseStream(); + + // Pipes the stream to a higher level stream reader with the required encoding format. + StreamReader^ readStream = gcnew StreamReader(receiveStream, Encoding::UTF8); + Console::WriteLine("Response stream received."); + Console::WriteLine(readStream->ReadToEnd()); + response->Close(); + readStream->Close(); +} + +/* +The output from this example will vary depending on the value passed into Main +but will be similar to the following: + +Content length is 1542 +Content type is text/html; charset=utf-8 +Response stream received. + +... + + +*/ +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp new file mode 100644 index 00000000000..d9632b38b2c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLServicePoint/CPP/nclservicepoint.cpp @@ -0,0 +1,88 @@ + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::IO; +using namespace System::Threading; + +namespace SystemNetExamples +{ + public ref class ServicePointExample + { + public: + + // Pass in the name of the Web page to retrieve. + static void PrintResponse(String^ page) + { + + // Create the request. + HttpWebRequest^ request; + Uri^ uri; + + + + try + { + uri = gcnew Uri(page); + } + catch (UriFormatException^ ex) + { + Console::WriteLine(ex->Message); + } + + request = (HttpWebRequest^) WebRequest::Create(uri); + + // Get the service point that handles the request's + // socket connection. + ServicePoint^ point = request->ServicePoint; + + // Set the receive buffer size on the underlying socket. + point->ReceiveBufferSize = 2048; + + // Set the connection lease timeout to infinite. + point->ConnectionLeaseTimeout = Timeout::Infinite; + + // Send the request. + HttpWebResponse^ response = + (HttpWebResponse^) request->GetResponse(); + Stream^ responseStream = response->GetResponseStream(); + StreamReader^ streamReader = + gcnew StreamReader(responseStream); + try + { + // Display the response. + Console::WriteLine(streamReader->ReadToEnd()); + responseStream->Close(); + response->Close(); + } + finally + { + streamReader->Close(); + } + } + }; +} + +// + +using namespace SystemNetExamples; + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + String^ page; + + if ((args == nullptr)||(args->Length < 2)||(args[1]->Length == 0)) + { + page = "http://www.contoso.com/default.html"; + } + else + { + page = args[1]; + } + ServicePointExample::PrintResponse(page); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp new file mode 100644 index 00000000000..0c201db6c1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLSimpleCache/CPP/NCLSimpleCache.cpp @@ -0,0 +1,274 @@ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Cache; +using namespace System::IO; +using namespace System::Text; +using namespace System::Collections::Specialized; +using namespace System::Collections; + +public ref class CacheExample +{ +public: + + // + static WebResponse^ GetResponseUsingDefaultCache( Uri^ uri ) + { + // Set a cache policy level for the "http:" scheme. + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::Default ); + + // Create the request. + WebRequest^ request = WebRequest::Create( uri ); + request->CachePolicy = policy; + WebResponse^ response = request->GetResponse(); + Console::WriteLine( L"Policy {0}.", policy ); + Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); + return response; + } + // + + // + // The following method demonstrates overriding the + // caching policy for a request. + static WebResponse^ GetResponseNoCache( Uri^ uri ) + { + // Set a default policy level for the "http:" and "https" schemes. + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::Default ); + HttpWebRequest::DefaultCachePolicy = policy; + + // Create the request. + WebRequest^ request = WebRequest::Create( uri ); + + // Define a cache policy for this request only. + HttpRequestCachePolicy^ noCachePolicy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::NoCacheNoStore ); + request->CachePolicy = noCachePolicy; + WebResponse^ response = request->GetResponse(); + Console::WriteLine( L"IsFromCache? {0}", response->IsFromCache ); + + return response; + } + // + + // + static HttpRequestCachePolicy^ CreateLastSyncPolicy( DateTime when ) + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( when ); + Console::WriteLine( L"When: {0}", when ); + Console::WriteLine( policy->CacheSyncDate ); + return policy; + } + // + + // + static void DisplayPolicyDetails( HttpRequestCachePolicy^ policy ) + { + Console::WriteLine( L"Synchronize date: {0}", policy->CacheSyncDate ); + Console::WriteLine( L"Max age: {0}", policy->MaxAge ); + Console::WriteLine( L"Max stale: {0}", policy->MaxStale ); + Console::WriteLine( L"Min fresh: {0}", policy->MinFresh ); + } + // + + // + static HttpRequestCachePolicy^ CreateMinFreshPolicy( TimeSpan span ) + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MinFresh,span ); + Console::WriteLine( L"Minimum freshness {0}", policy->MinFresh ); + return policy; + } + // + + // + static HttpRequestCachePolicy^ CreateMaxStalePolicy( TimeSpan span ) + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxStale,span ); + Console::WriteLine( L"Max stale is {0}", policy->MaxStale ); + return policy; + } + // + + // + static HttpRequestCachePolicy^ CreateMaxAgePolicy( TimeSpan span ) + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAge,span ); + Console::WriteLine( L"Max age is {0}", policy->MaxAge ); + return policy; + } + // + + // + static HttpRequestCachePolicy^ CreateDefaultPolicy() + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy; + Console::WriteLine( policy ); + return policy; + } + // + + // + static HttpRequestCachePolicy^ CreateFreshAndAgePolicy( TimeSpan freshMinimum, TimeSpan ageMaximum ) + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAgeAndMinFresh, + ageMaximum, freshMinimum ); + Console::WriteLine( policy ); + return policy; + } + // + + // + static HttpRequestCachePolicy^ CreateFreshAndAgePolicy2( TimeSpan freshMinimum, TimeSpan ageMaximum, DateTime when ) + { + HttpRequestCachePolicy^ policy = + gcnew HttpRequestCachePolicy( HttpCacheAgeControl::MaxAgeAndMinFresh, + ageMaximum, freshMinimum, when ); + Console::WriteLine( policy ); + return policy; + + // For the following invocation: CreateFreshAndAgePolicy(new TimeSpan(5,0,0), new TimeSpan(10,0,0), ); + // the output is: + // Level:Automatic AgeControl:MinFreshAndMaxAge MinFresh:18000 MaxAge:36000 + } + // + + // + static WebResponse^ GetResponseUsingCacheDefault( Uri^ uri ) + { + // Set the default cache policy level for the "http:" scheme. + RequestCachePolicy^ policy = gcnew RequestCachePolicy; + + // Create the request. + WebRequest^ request = WebRequest::Create( uri ); + request->CachePolicy = policy; + WebResponse^ response = request->GetResponse(); + Console::WriteLine( L"Policy level is {0}.", policy->Level ); + Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); + return response; + } + // + + // + static HttpRequestCachePolicy^ CreateCacheIfAvailablePolicy() + { + HttpRequestCachePolicy^ policy = gcnew HttpRequestCachePolicy( HttpRequestCacheLevel::CacheIfAvailable ); + Console::WriteLine( policy ); + return policy; + } + // + + // + static WebResponse^ GetResponseFromCache( Uri^ uri ) + { + RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::CacheOnly ); + WebRequest^ request = WebRequest::Create( uri ); + request->CachePolicy = policy; + WebResponse^ response = request->GetResponse(); + Console::WriteLine( L"Policy level is {0}.", policy->Level ); + Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); + return response; + } + // + + // + static WebResponse^ GetResponseFromServer( Uri^ uri ) + { + RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::NoCacheNoStore ); + WebRequest^ request = WebRequest::Create( uri ); + request->CachePolicy = policy; + WebResponse^ response = request->GetResponse(); + Console::WriteLine( L"Policy is {0}.", policy ); + Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); + return response; + } + // + + // + static WebResponse^ GetResponseFromServer2( Uri^ uri ) + { + RequestCachePolicy^ policy = gcnew RequestCachePolicy( RequestCacheLevel::NoCacheNoStore ); + WebRequest^ request = WebRequest::Create( uri ); + WebRequest::DefaultCachePolicy = policy; + WebResponse^ response = request->GetResponse(); + Console::WriteLine( L"Policy is {0}.", policy ); + Console::WriteLine( L"Is the response from the cache? {0}", response->IsFromCache ); + return response; + } + // + + void TestSimpleCache() + { + /* WebResponse response = GetResponseUsingDefaultCache (new Uri("http://www.example.com")); + DisplayResponseStream (response); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + response = GetResponseNoCache (new Uri("http://www.example.com")); + DisplayResponseStream (response); + + DisplayPolicyDetails(CreateLastSyncPolicy(DateTime.Now)); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + DisplayPolicyDetails(CreateMinFreshPolicy(new TimeSpan(10,0,0))); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + DisplayPolicyDetails(CreateMaxStalePolicy(new TimeSpan(1,10,0))); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + DisplayPolicyDetails(CreateMaxAgePolicy(new TimeSpan(10,0,0))); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + DisplayPolicyDetails(CreateDefaultPolicy()); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + DisplayPolicyDetails(CreateFreshAndAgePolicy(new TimeSpan(5,0,0), new TimeSpan(10,0,0))); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + DisplayPolicyDetails(CreateFreshAndAgePolicy2(new TimeSpan(5,0,0), new TimeSpan(10,0,0), DateTime.Now)); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + response = GetResponseUsingCacheDefault (new Uri("http://www.example.com")); + DisplayResponseStream (response); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + + DisplayPolicyDetails(CreateCacheIfAvailablePolicy()); + + response = GetResponseFromCache (new Uri("http://www.example.com")); + DisplayResponseStream (response); + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + response = GetResponseFromServer (new Uri("http://www.example.com")); + DisplayResponseStream (response); + + Console.WriteLine("hit enter for next test..."); Console.ReadLine(); + */ + WebResponse^ response = GetResponseFromServer2( gcnew Uri( L"http://www.example.com" ) ); + DisplayResponseStream( response ); + Console::WriteLine( L"done." ); + } + + static void DisplayResponseStream( WebResponse^ response ) + { + Stream^ stream = response->GetResponseStream(); + while ( true ) + { + array^buffer = gcnew array(1024); + int read = stream->Read( buffer, 0, buffer->Length ); + if ( read == 0 ) + { + stream->Close(); + break; + } + else + { + Console::Write( Encoding::UTF8->GetString( buffer ) ); + } + } + + stream->Close(); + } + +}; + +void main() +{ + CacheExample^ ce = gcnew CacheExample; + ce->TestSimpleCache(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp new file mode 100644 index 00000000000..cc3ba9554a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLSocketEnhancements/CPP/nclsocketenhancements.cpp @@ -0,0 +1,713 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +/***************************** +commented out contents of snippets 1,2,8 becuase this is not legal cpp. +the use of jagged arrays is not supprted and these throw a compiler error. + +*******************************/ +// State object for reading client data asynchronously +private ref class StateObject +{ +public private: + + // Client socket. + Socket^ workSocket; + + // Size of receive buffer. + literal int BufferSize = 1024; + + // Receive buffer. + array^buffer; + + // Received data string. + StringBuilder^ sb; + +public: + StateObject() + { + workSocket = nullptr; + buffer = gcnew array(BufferSize); + sb = gcnew StringBuilder; + } + +}; + +public ref class Test +{ +public: + + // Incoming data from client. + static String^ data = nullptr; + +private: + + // ManualResetEvent instances signal completion. + static ManualResetEvent^ connectDone = gcnew ManualResetEvent( false ); + static ManualResetEvent^ sendDone = gcnew ManualResetEvent( false ); + static ManualResetEvent^ receiveDone = gcnew ManualResetEvent( false ); + static ManualResetEvent^ disconnectDone = gcnew ManualResetEvent( false ); + + // The response from the remote device. + static String^ response = String::Empty; + +public: + + // Thread signal. + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + static void Main() + { + array^args = Environment::GetCommandLineArgs(); + Console::WriteLine( "{0}", args ); + if ( args[ 1 ]->Equals( "as" ) ) + { + + // Start the asynchronous server. + Console::WriteLine( "the asychronous server" ); + AsynchronousServer(); + } + else + if ( args[ 1 ]->Equals( "ac" ) ) + { + + // Start the asynchronous client. + Console::WriteLine( "the asynchronous client" ); + AsynchronousClient(); + } + else + if ( args[ 1 ]->Equals( "ss" ) ) + { + + // Start the synchronous server. + Console::WriteLine( "the sychronous server" ); + SynchronousServer(); + } + else + if ( args[ 1 ]->Equals( "sc" ) ) + { + + // Start the synchronous client. + Console::WriteLine( "the synchronous client" ); + SynchronousClient(); + } + else + { + Console::WriteLine( "default" ); + } + } + + static void AsynchronousServer() + { + + // This server waits for a connection and then uses asychronous operations to + // accept the connection, get data from the connected client, + // echo that data back to the connected client. + // It then disconnects from the client and waits for another client. + Listen(); + + // ListenWithSocket(); + } + + static void Listen() + { + // This server waits for a connection and then uses asynchronous operations to + // accept the connection with initial data sent from the client. + // Establish the local endpoint for the socket. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + IPEndPoint^ localEndPoint = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + Socket^ listener = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Bind the socket to the local endpoint, and listen for incoming connections. + listener->Bind( localEndPoint ); + listener->Listen( 100 ); + for ( ; ; ) + { + + // Set the event to nonsignaled state. + allDone->Reset(); + + // Start an asynchronous socket to listen for connections and receive data from the client. + Console::WriteLine( "Waiting for a connection..." ); + + // Accept the connection and receive the first 10 bytes of data. + int receivedDataSize = 10; + listener->BeginAccept( receivedDataSize, gcnew AsyncCallback( AcceptReceiveCallback ), listener ); + + // Wait until a connection is made and processed before continuing. + allDone->WaitOne(); + + } + } + + static void AcceptReceiveCallback( IAsyncResult^ ar ) + { + // Get the socket that handles the client request. + Socket^ listener = dynamic_cast(ar->AsyncState); + + // End the operation and display the received data on the console. + array^Buffer; + int bytesTransferred; + Socket^ handler = listener->EndAccept( Buffer, bytesTransferred, ar ); + String^ stringTransferred = Encoding::ASCII->GetString( Buffer, 0, bytesTransferred ); + Console::WriteLine( stringTransferred ); + Console::WriteLine( "Size of data transferred is {0}", bytesTransferred ); + + // Create the state object for the asynchronous receive. + StateObject^ state = gcnew StateObject; + state->workSocket = handler; + handler->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReadCallback ), state ); + } + static void ListenWithSocket() + { + // This server waits for a connection and then uses asynchronous operations to + // accept the connection with initial data sent from the client. + // Establish the local endpoint for the socket. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + IPEndPoint^ localEndPoint = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + Socket^ listener = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Bind the socket to the local endpoint, and listen for incoming connections. + listener->Bind( localEndPoint ); + listener->Listen( 100 ); + for ( ; ; ) + { + // Set the event to nonsignaled state. + allDone->Reset(); + + // Start an asynchronous socket to listen for connections and receive data from the client. + Console::WriteLine( "Waiting for a connection..." ); + + // Accept the connection and receive the first 10 bytes of data. + // BeginAccept() creates the accepted socket. + int receivedDataSize = 10; + listener->BeginAccept( nullptr, receivedDataSize, gcnew AsyncCallback( AcceptReceiveDataCallback ), listener ); + + // Wait until a connection is made and processed before continuing. + allDone->WaitOne(); + } + } + + static void AcceptReceiveDataCallback( IAsyncResult^ ar ) + { + // Get the socket that handles the client request. + Socket^ listener = dynamic_cast(ar->AsyncState); + + // End the operation and display the received data on the console. + array^Buffer; + int bytesTransferred; + Socket^ handler = listener->EndAccept( Buffer, bytesTransferred, ar ); + String^ stringTransferred = Encoding::ASCII->GetString( Buffer, 0, bytesTransferred ); + Console::WriteLine( stringTransferred ); + Console::WriteLine( "Size of data transferred is {0}", bytesTransferred ); + + // Create the state object for the asynchronous receive. + StateObject^ state = gcnew StateObject; + state->workSocket = handler; + handler->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReadCallback ), state ); + } + + static void ReadCallback( IAsyncResult^ ar ) + { + String^ content = String::Empty; + + // Retrieve the state object and the handler socket + // from the asynchronous state object. + StateObject^ state = dynamic_cast(ar->AsyncState); + Socket^ handler = state->workSocket; + + // Read data from the client socket. + int bytesRead = handler->EndReceive( ar ); + if ( bytesRead > 0 ) + { + // There might be more data, so store the data received so far. + state->sb->Append( Encoding::ASCII->GetString( state->buffer, 0, bytesRead ) ); + + // Check for end-of-file tag. If it is not there, read + // more data. + content = state->sb->ToString(); + if ( content->IndexOf( "" ) > -1 ) + { + // All the data has been read from the + // client. Display it on the console. + Console::WriteLine( "Read {0} bytes from socket. Data : {1}", content->Length, content ); + + // Echo the data back to the client. + Send( handler, content ); + } + else + { + // Not all data received. Get more. + handler->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReadCallback ), state ); + } + } + } + + +private: + static void Send( Socket^ handler, String^ data ) + { + // Convert the string data to byte data using ASCII encoding. + array^byteData = Encoding::ASCII->GetBytes( data ); + + // Begin sending the data to the remote device. + handler->BeginSend( byteData, 0, byteData->Length, static_cast(0), gcnew AsyncCallback( SendCallback ), handler ); + } + + static void SendCallback( IAsyncResult^ ar ) + { + // Retrieve the socket from the state object. + Socket^ handler = dynamic_cast(ar->AsyncState); + + // Complete sending the data to the remote device. + int bytesSent = handler->EndSend( ar ); + Console::WriteLine( "Sent {0} bytes to client.", bytesSent ); + handler->Shutdown( SocketShutdown::Both ); + handler->Close(); + + // Signal the main thread to continue. + allDone->Set(); + } + +public: + static void AsynchronousClient() + { + // The following methods set up a socket and demonstrate the use of a new Sockets method. + // Send multiple buffers to remote device. + // AsynchronousSendBuffers(); + // Send a file to the remote host. + // AsynchronousFileSend(); + // Send a file with pre and post buffers. + // AsynchronousFileSendWithBuffers(); + // Show use of Begin/EndDisconnect + ClientDisconnect(); + } + + +private: + static void ClientSendCallback( IAsyncResult^ ar ) + { + // Retrieve the socket from the state object. + Socket^ client = dynamic_cast(ar->AsyncState); + + // Complete sending the data to the remote device. + int bytesSent = client->EndSend( ar ); + + // Write to the console the number of bytes sent. + Console::WriteLine( "Sent {0} bytes to server.", bytesSent ); + + // Signal that all bytes have been sent. + sendDone->Set(); + } + + +public: + + static void AsynchronousFileSend() + { + // Send a file to a remote device. + // Establish the remote endpoint for the socket. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect to the remote endpoint. + client->BeginConnect( remoteEP, gcnew AsyncCallback( ConnectCallback ), client ); + + // Wait for connect. + connectDone->WaitOne(); + + // There is a text file test.txt in the root directory. + String^ fileName = "C:\\test.txt"; + + // Send file fileName to the remote device. + Console::WriteLine( fileName ); + client->BeginSendFile( fileName, gcnew AsyncCallback( FileSendCallback ), client ); + + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->Close(); + } + +private: + static void FileSendCallback( IAsyncResult^ ar ) + { + // Retrieve the socket from the state object. + Socket^ client = dynamic_cast(ar->AsyncState); + + // Complete sending the data to the remote device. + client->EndSendFile( ar ); + sendDone->Set(); + } + +public: + static void AsynchronousFileSendWithBuffers() + { + // Send a file asynchronously to the remote device. Send a buffer before the file and a buffer afterwards. + // Establish the remote endpoint for the socket. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect to the remote endpoint. + client->BeginConnect( remoteEP, gcnew AsyncCallback( ConnectCallback ), client ); + + // Wait for connect. + connectDone->WaitOne(); + + // Send a file fileName to the remote device with preBuffer and postBuffer data. + // Create the preBuffer data. + String^ string1 = String::Format( "This is text data that precedes the file.{0}", Environment::NewLine ); + array^preBuf = Encoding::ASCII->GetBytes( string1 ); + + // Create the postBuffer data. + String^ string2 = String::Format( "This is text data that will follow the file.{0}", Environment::NewLine ); + array^postBuf = Encoding::ASCII->GetBytes( string2 ); + + // There is a file test.txt in the root directory. + String^ fileName = "C:\\test.txt"; + + //Send file fileName with buffers and default flags to the remote device. + Console::WriteLine( fileName ); + client->BeginSendFile( fileName, preBuf, postBuf, static_cast(0), gcnew AsyncCallback( AsynchronousFileSendCallback ), client ); + + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->Close(); + } + + +private: + static void AsynchronousFileSendCallback( IAsyncResult^ ar ) + { + // Retrieve the socket from the state object. + Socket^ client = dynamic_cast(ar->AsyncState); + + // Complete sending the data to the remote device. + client->EndSendFile( ar ); + sendDone->Set(); + } + + static void ConnectCallback( IAsyncResult^ ar ) + { + // Retrieve the socket from the state object. + Socket^ client = dynamic_cast(ar->AsyncState); + + // Complete the connection. + client->EndConnect( ar ); + Console::WriteLine( "Socket connected to {0}", client->RemoteEndPoint ); + + // Signal that the connection has been made. + connectDone->Set(); + } + + static void Receive( Socket^ client ) + { + // Create the state object. + StateObject^ state = gcnew StateObject; + state->workSocket = client; + + // Begin receiving the data from the remote device. + client->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReceiveCallback ), state ); + } + + static void ReceiveCallback( IAsyncResult^ ar ) + { + // Retrieve the state object and the client socket + // from the asynchronous state object. + StateObject^ state = dynamic_cast(ar->AsyncState); + Socket^ client = state->workSocket; + + // Read data from the remote device. + int bytesRead = client->EndReceive( ar ); + if ( bytesRead > 0 ) + { + // There might be more data, so store the data received so far. + state->sb->Append( Encoding::ASCII->GetString( state->buffer, 0, bytesRead ) ); + + // Get the rest of the data. + client->BeginReceive( state->buffer, 0, StateObject::BufferSize, static_cast(0), gcnew AsyncCallback( ReceiveCallback ), state ); + } + else + { + // All the data has arrived; put it in response. + if ( state->sb->Length > 1 ) + { + response = state->sb->ToString(); + } + + // Signal that all bytes have been received. + receiveDone->Set(); + } + } + + +public: + static void ClientDisconnect() + { + // Establish the remote endpoint for the socket. + // For this example use local computer. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect to the remote endpoint. + client->BeginConnect( remoteEP, gcnew AsyncCallback( ConnectCallback ), client ); + + // Wait for connect. + connectDone->WaitOne(); + + // Send some data to the remote device. + String^ data = "This is a string of data "; + array^buffer = Encoding::ASCII->GetBytes( data ); + client->BeginSend( buffer, 0, buffer->Length, static_cast(0), gcnew AsyncCallback( ClientSendCallback ), client ); + + // Wait for send done. + sendDone->WaitOne(); + + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->BeginDisconnect( true, gcnew AsyncCallback( DisconnectCallback ), client ); + + // Wait for the disconnect to complete. + disconnectDone->WaitOne(); + if ( client->Connected ) + Console::WriteLine( "We're still connected" ); + else + Console::WriteLine( "We're disconnected" ); + } + +private: + static void DisconnectCallback( IAsyncResult^ ar ) + { + // Complete the disconnect request. + Socket^ client = dynamic_cast(ar->AsyncState); + client->EndDisconnect( ar ); + + // Signal that the disconnect is complete. + disconnectDone->Set(); + } + +public: + + static void SynchronousServer() + { + // Establish the local endpoint for the socket. + IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); + + // For the purposes of this example, we will send and + // receive on the same machine. + // + Socket^ listener = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Bind to the local endpoint and listen to the incoming sockets. + listener->Bind( ipEndPoint ); + listener->Listen( 10 ); + for ( ; ; ) + { + Console::WriteLine( "Waiting for a connection..." ); + Socket^ handler = listener->Accept(); + String^ data = nullptr; + + // A client is connecting. + for ( ; ; ) + { + array^bytes = gcnew array(1024); + int bytesReceived = handler->Receive( bytes ); + data = String::Concat( data, Encoding::ASCII->GetString( bytes, 0, bytesReceived ) ); + if ( data->IndexOf( "" ) > -1 ) + { + break; + } + } + + // All the data has been read from the client. + // Display it on the console. + Console::WriteLine( "Read {0} bytes from socket. Data : {1}", data->Length, data ); + + // Echo the data back to the client. + //Send(handler, content); + handler->Send( Encoding::ASCII->GetBytes( data ) ); + handler->Shutdown( SocketShutdown::Both ); + handler->Close(); + } + } + + static void SynchronousClient() + { + // The following methods set up a socket and demonstrate the use of a new Sockets method. + // Set the socket options + // SetSocketOptions(); + // Send multiple buffers to remote device. + // SendMultiBuffers(); + // Send multiple buffers with socket flags + // SendMultiBuffersWithFlags(); + // Send a file to the remote host. + // FileSend(); + // Send a file with pre and post buffers + // FileSendWithBuffers(); + // Show synchronous disconnect + SynchronousDisconnect(); + } + +private: + static void SetSocketOptions() + { + // + // Establish the local endpoint for the socket. + IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); + + // Create a TCP socket. + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect the socket to the remote endpoint. + client->Connect( ipEndPoint ); + + // Set option that allows socket to close gracefully without lingering. + client->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::DontLinger, true ); + + // Set option that allows socket to receive out-of-band information in the data stream. + client->SetSocketOption( SocketOptionLevel::Socket, SocketOptionName::OutOfBandInline, true ); + + // + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->Close(); + } + + static void FileSend() + { + // + // Establish the local endpoint for the socket. + IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); + + // Create a TCP socket. + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect the socket to the remote endpoint. + client->Connect( ipEndPoint ); + + // There is a text file test.txt located in the root directory. + String^ fileName = "C:\\test.txt"; + + // Send file fileName to remote device + Console::WriteLine( "Sending {0} to the host.", fileName ); + client->SendFile( fileName ); + + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->Close(); + // + } + + static void FileSendWithBuffers() + { + // + // Establish the local endpoint for the socket. + IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); + + // Create a TCP socket. + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect the socket to the remote endpoint. + client->Connect( ipEndPoint ); + + // Send file fileName to the remote host with preBuffer and postBuffer data. + // There is a text file test.txt located in the root directory. + String^ fileName = "C:\\test.txt"; + + // Create the preBuffer data. + String^ string1 = String::Format( "This is text data that precedes the file.{0}", Environment::NewLine ); + array^preBuf = Encoding::ASCII->GetBytes( string1 ); + + // Create the postBuffer data. + String^ string2 = String::Format( "This is text data that will follow the file.{0}", Environment::NewLine ); + array^postBuf = Encoding::ASCII->GetBytes( string2 ); + + //Send file fileName with buffers and default flags to the remote device. + Console::WriteLine( "Sending {0} with buffers to the host.{1}", fileName, Environment::NewLine ); + client->SendFile( fileName, preBuf, postBuf, TransmitFileOptions::UseDefaultWorkerThread ); + + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->Close(); + // + } + +public: + static void SynchronousDisconnect() + { + // + IPHostEntry^ ipHost = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddr = ipHost->AddressList[ 0 ]; + IPEndPoint^ ipEndPoint = gcnew IPEndPoint( ipAddr,11000 ); + Socket^ client = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // Connect the socket to the remote end point. + client->Connect( ipEndPoint ); + + // Send some data to the remote device. + String^ data = "This is a string of data "; + array^buffer = Encoding::ASCII->GetBytes( data ); + int bytesTransferred = client->Send( buffer ); + + // Write to the console the number of bytes transferred. + Console::WriteLine( "{0} bytes were sent.\n", bytesTransferred ); + + // Release the socket. + client->Shutdown( SocketShutdown::Both ); + client->Disconnect( true ); + if ( client->Connected ) + Console::WriteLine( "We're still connnected" ); + else + Console::WriteLine( "We're disconnected" ); + // + } +}; + +int main() +{ + Test::Main(); +} + +/* +The output from this example will vary depending on the value passed into Main +but will be similar to the following: + +Content length is 1542 +Content type is text/html; charset=utf-8 +Response stream received. + +... + + +*/ diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp new file mode 100644 index 00000000000..41bffbe3ab7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl/CPP/iocontrolserver.cpp @@ -0,0 +1,68 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +// +// FIONREAD is also available as the "Available" property. +const int FIONREAD = 0x4004667F; + +void DisplayPendingByteCount( Socket^ s ) +{ + array^ outValue = BitConverter::GetBytes( 0 ); + + // Check how many bytes have been received. + s->IOControl( FIONREAD, nullptr, outValue ); + + UInt32 bytesAvailable = BitConverter::ToUInt32( outValue, 0 ); + Console::WriteLine( "server has {0} bytes pending. Available property says {1}.", + bytesAvailable, s->Available ); + + return; +} +// + +int main() +{ + IPHostEntry^ localHost = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( localHost->AddressList[ 0 ], 11000 ); + + // For the purposes of this example, we will send and + // receive on the same machine. + // + Socket^ s = gcnew Socket( AddressFamily::InterNetwork, + SocketType::Stream, + ProtocolType::Tcp ); + s->Bind( endPoint ); + + s->Listen( 1 ); + Console::WriteLine( "Waiting to receive messages from client..." ); + Socket^ client = s->Accept(); + + // Creates a byte buffer to receive the message. + array^ buffer = gcnew array(256); + String^ message; + + for ( ; ; ) + { + Thread::Sleep( 10000 ); + DisplayPendingByteCount( client ); + client->Receive( buffer ); + message = Encoding::UTF8->GetString( buffer ); + + // Displays the information received to the screen + Console::WriteLine( " Server received the following message : {0}", + message ); + + // Look for "" to end session. + if ( message->IndexOf( "" ) != -1 ) + { + break; + } + } + client->Close(); + s->Close(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp new file mode 100644 index 00000000000..b3fabcf3081 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLSocketIoControl1/CPP/iocontrolcode.cpp @@ -0,0 +1,70 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +// +void DisplayPendingByteCount( Socket^ s ) +{ + array^ outValue = BitConverter::GetBytes( 0 ); + + // Check how many bytes have been received. + s->IOControl( IOControlCode::DataToRead, nullptr, outValue ); + + UInt32 bytesAvailable = BitConverter::ToUInt32( outValue, 0 ); + Console::Write( "server has {0} bytes pending,", + bytesAvailable ); + Console::WriteLine( "Available property says {1}.", + s->Available ); + return; +} +// + +int main() +{ + IPHostEntry^ localHost = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( + localHost->AddressList[ 0 ],11000 ); + + // For the purposes of this example, we will send and + // receive on the same machine. + // + Socket^ s = gcnew Socket( AddressFamily::InterNetwork, + SocketType::Stream, + ProtocolType::Tcp ); + + s->Bind( endPoint ); + + s->Listen( 1 ); + Console::WriteLine( + "Waiting to receive messages from client.." ); + Socket^ client = s->Accept(); + + // Creates a byte buffer to receive the message. + array^ buffer = gcnew array(256); + String^ message; + + for ( ; ; ) + { + Thread::Sleep( 10000 ); + DisplayPendingByteCount( client ); + client->Receive( buffer ); + message = Encoding::UTF8->GetString( buffer ); + + // Displays the information received to the screen + Console::WriteLine( + " Server received the following message: {0}", + message ); + + // Look for "" to end session. + if ( message->IndexOf( "" ) != -1 ) + { + break; + } + } + client->Close(); + s->Close(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp new file mode 100644 index 00000000000..3a204ecc032 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLTcpClientSync/CPP/tcpclient.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; +int main() +{ + + // Create a client that will connect to a + // server listening on the contoso1 computer + // at port 11000. + TcpClient^ tcpClient = gcnew TcpClient; + tcpClient->Connect( "contosoServer", 11000 ); + + // Get the stream used to read the message sent by the server. + NetworkStream^ networkStream = tcpClient->GetStream(); + + // Set a 10 millisecond timeout for reading. + networkStream->ReadTimeout = 10; + + // Read the server message into a byte buffer. + array^bytes = gcnew array(1024); + networkStream->Read( bytes, 0, 1024 ); + + //Convert the server's message into a string and display it. + String^ data = Encoding::UTF8->GetString( bytes ); + Console::WriteLine( "Server sent message: {0}", data ); + networkStream->Close(); + tcpClient->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp new file mode 100644 index 00000000000..7dc16c6e6be --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLUriEnhancements/CPP/nclurienhancements.cpp @@ -0,0 +1,150 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +using namespace System::Threading; + +// TryCreate +void SampleTryCreate() +{ + // + // String to parse. + String^ addressString = "catalog/shownew.htm?date=today"; + + // Parse the string and create a new Uri instance, if possible. + Uri^ result; + if ( Uri::TryCreate( addressString, UriKind::RelativeOrAbsolute, result ) ) + { + // The call was successful. Write the URI address to the console. + Console::Write( result ); + + // Check whether new Uri instance is absolute or relative. + if ( result->IsAbsoluteUri ) + Console::WriteLine( " is an absolute Uri." ); + else + Console::WriteLine( " is a relative Uri." ); + } + else + { + // Let the user know that the call failed. + Console::WriteLine( "addressString could not be parsed as a URI address." ); + } + // +} + +// Constructor +void SampleConstructor() +{ + // + // Create an absolute Uri from a string. + String^ addressString1 = "http://www.contoso.com/"; + String^ addressString2 = "catalog/shownew.htm?date=today"; + Uri^ absoluteUri = gcnew Uri(addressString1); + + // Create a relative Uri from a string. allowRelative = true to allow for + // creating a relative Uri. + Uri^ relativeUri = gcnew Uri(addressString2); + + // Check whether the new Uri is absolute or relative. + if ( !relativeUri->IsAbsoluteUri ) + Console::WriteLine( "{0} is a relative Uri.", relativeUri ); + + // Create a new Uri from an absolute Uri and a relative Uri. + Uri^ combinedUri = gcnew Uri( absoluteUri,relativeUri ); + Console::WriteLine( combinedUri->AbsoluteUri ); + // +} + +// OriginalString +void SampleOriginalString() +{ + // + // Create a new Uri from a string address. + Uri^ uriAddress = gcnew Uri( "HTTP://www.ConToso.com:80//thick%20and%20thin.htm" ); + + // Write the new Uri to the console and note the difference in the two values. + // ToString() gives the canonical version. OriginalString gives the original + // string that was passed to the constructor. + // The following outputs "http://www.contoso.com//thick and thin.htm". + Console::WriteLine( uriAddress ); + + // The following outputs "HTTP://www.ConToso.com:80//thick%20and%20thin.htm". + Console::WriteLine( uriAddress->OriginalString ); + // +} + + +// DNSSafeHost +void SampleDNSSafeHost() +{ + // + // Create new Uri using a string address. + Uri^ address = gcnew Uri( "http://[fe80::200:39ff:fe36:1a2d%254]/temp/example.htm" ); + + // Make the address DNS safe. + // The following outputs "[fe80::200:39ff:fe36:1a2d]". + Console::WriteLine( address->Host ); + + // The following outputs "fe80::200:39ff:fe36:1a2d%254". + Console::WriteLine( address->DnsSafeHost ); + // +} + +// operator == and !== +void SampleOperatorEqual() +{ + // + // Create some Uris. + Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); + Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" ); + Uri^ address3 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); + + // The first two are equal because the fragment is ignored. + if ( address1 == address2 ) + Console::WriteLine( "{0} is equal to {1}", address1, address2 ); + + // The second two are not equal. + if ( address2 != address3 ) + Console::WriteLine( "{0} is not equal to {1}", address2, address3 ); + // +} + +// IsBaseOf +void SampleIsBaseOf() +{ + // + // Create a base Uri. + Uri^ baseUri = gcnew Uri( "http://www.contoso.com/" ); + + // Create a new Uri from a string. + Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); + + // Determine whether BaseUri is a base of UriAddress. + if ( baseUri->IsBaseOf( uriAddress ) ) + Console::WriteLine( "{0} is the base of {1}", baseUri, uriAddress ); + // +} + +int main() +{ + // TryParse + SampleTryCreate(); + + // Constructor + SampleConstructor(); + + // OriginalString + SampleOriginalString(); + + // DNSSafeHost + SampleDNSSafeHost(); + + // operator == and !== + SampleOperatorEqual(); + + // IsBaseOf + SampleIsBaseOf(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp new file mode 100644 index 00000000000..f7f450b51de --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLUriExamples/CPP/uriexamples.cpp @@ -0,0 +1,271 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +using namespace System::Threading; +using namespace System::Runtime::Serialization; + +namespace Example +{ + public ref class Test + { + public: + static void Main() + { + // Snippets 1 and 2 + HexConversions(); + + // snippet 7 + SampleToString(); + + // snippet 8 + SampleEquals(); + + // snippets 4, 5, and 6 + GetParts(); + + // snippet 3 + SampleMakeRelative(); + + // snippets 9 - 17 + SampleCheckSchemeName(); + + // snippets 18 + SampleUserInfo(); + } + + private: + static void SampleToString() + { + // + // Create a new Uri from a string address. + Uri^ uriAddress = gcnew Uri( "HTTP://www.Contoso.com:80/thick%20and%20thin.htm" ); + + // Write the new Uri to the console and note the difference in the two values. + // ToString() gives the canonical version. OriginalString gives the orginal + // string that was passed to the constructor. + // The following outputs "http://www.contoso.com/thick and thin.htm". + Console::WriteLine( uriAddress ); + + // The following outputs "HTTP://www.Contoso.com:80/thick%20and%20thin.htm". + Console::WriteLine( uriAddress->OriginalString ); + // + } + + static void SampleEquals() + { + // + // Create some Uris. + Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); + Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm" ); + if ( address1->Equals( address2 ) ) + { + Console::WriteLine( "The two addresses are equal" ); + } + else + { + Console::WriteLine( "The two addresses are not equal" ); + } + // Will output "The two addresses are equal" + // + } + + static void GetParts() + { + // + // Create Uri + Uri^ uriAddress = gcnew Uri( "http://www.contoso.com/index.htm#search" ); + Console::WriteLine( uriAddress->Fragment ); + Console::WriteLine( "Uri {0} the default port ", uriAddress->IsDefaultPort ? (String^)"uses" : "does not use" ); + + Console::WriteLine( "The path of this Uri is {0}", uriAddress->GetLeftPart( UriPartial::Path ) ); + Console::WriteLine( "Hash code {0}", uriAddress->GetHashCode() ); + // The example displays output similar to the following: + // #search + // Uri uses the default port + // The path of this Uri is http://www.contoso.com/index.htm + // Hash code -988419291 + // + + // + Uri^ uriAddress1 = gcnew Uri( "http://www.contoso.com/title/index.htm" ); + Console::WriteLine( "The parts are {0}, {1}, {2}", uriAddress1->Segments[ 0 ], uriAddress1->Segments[ 1 ], uriAddress1->Segments[ 2 ] ); + // + + // + Uri^ uriAddress2 = gcnew Uri( "file://server/filename.ext" ); + Console::WriteLine( uriAddress2->LocalPath ); + Console::WriteLine( "Uri {0} a UNC path", uriAddress2->IsUnc ? (String^)"is" : "is not" ); + Console::WriteLine( "Uri {0} a local host", uriAddress2->IsLoopback ? (String^)"is" : "is not" ); + Console::WriteLine( "Uri {0} a file", uriAddress2->IsFile ? (String^)"is" : "is not" ); + // The example displays the following output: + // \\server\filename.ext + // Uri is a UNC path + // Uri is not a local host + // Uri is a file + // + } + + static void HexConversions() + { + + // + char testChar = 'e'; + if ( Uri::IsHexDigit( testChar ) ) + { + Console::WriteLine( "'{0}' is the hexadecimal representation of {1}", + testChar, Uri::FromHex( testChar ) ); + } + else + { + Console::WriteLine( "'{0}' is not a hex character", testChar ); + } + + String^ returnString = Uri::HexEscape( testChar ); + Console::WriteLine( "The hexadecimal value of '{0}' is {1}", testChar, returnString ); + // + + // + String^ testString = "%75"; + int index = 0; + if ( Uri::IsHexEncoding( testString, index ) ) + { + Console::WriteLine( "The character is {0}", + Uri::HexUnescape( testString, index ) ); + } + else + { + Console::WriteLine( "The character is not hex encoded" ); + } + // + } + + // MakeRelative + static void SampleMakeRelative() + { + // + // Create a base Uri. + Uri^ address1 = gcnew Uri( "http://www.contoso.com/" ); + + // Create a new Uri from a string. + Uri^ address2 = gcnew Uri( "http://www.contoso.com/index.htm?date=today" ); + + // Determine the relative Uri. + Console::WriteLine( "The difference is {0}", address1->MakeRelativeUri( address2 ) ); + // + } + + //CheckSchemeName + static void SampleCheckSchemeName() + { + // + Uri^ address1 = gcnew Uri( "http://www.contoso.com/index.htm#search" ); + Console::WriteLine( "address 1 {0} a valid scheme name", + Uri::CheckSchemeName( address1->Scheme ) ? (String^)" has" : " does not have" ); + if ( address1->Scheme == Uri::UriSchemeHttp ) + { + Console::WriteLine( "Uri is HTTP type" ); + } + + Console::WriteLine( address1->HostNameType ); + // + + // + Uri^ address2 = gcnew Uri( "file://server/filename.ext" ); + if ( address2->Scheme == Uri::UriSchemeFile ) + { + Console::WriteLine( "Uri is a file" ); + } + // + + Console::WriteLine( address2->HostNameType ); + + // + Uri^ address3 = gcnew Uri( "mailto:user@contoso.com?subject=uri" ); + if ( address3->Scheme == Uri::UriSchemeMailto ) + { + Console::WriteLine( "Uri is an email address" ); + } + // + + // + Uri^ address4 = gcnew Uri( "news:123456@contoso.com" ); + if ( address4->Scheme == Uri::UriSchemeNews ) + { + Console::WriteLine( "Uri is an Internet news group" ); + } + // + + // + Uri^ address5 = gcnew Uri( "nntp://news.contoso.com/123456@contoso.com" ); + if ( address5->Scheme == Uri::UriSchemeNntp ) + { + Console::WriteLine( "Uri is nntp protocol" ); + } + // + + // + Uri^ address6 = gcnew Uri( "gopher://example.contoso.com/" ); + if ( address6->Scheme == Uri::UriSchemeGopher ) + { + Console::WriteLine( "Uri is Gopher protocol" ); + } + // + + // + Uri^ address7 = gcnew Uri( "ftp://contoso/files/testfile.txt" ); + if ( address7->Scheme == Uri::UriSchemeFtp ) + { + Console::WriteLine( "Uri is Ftp protocol" ); + } + // + + // + Uri^ address8 = gcnew Uri( "https://example.contoso.com" ); + if ( address8->Scheme == Uri::UriSchemeHttps ) + { + Console::WriteLine( "Uri is Https protocol." ); + } + // + + // + String^ address = "www.contoso.com"; + String^ uriString = String::Format( "{0}{1}{2}", + Uri::UriSchemeHttp, Uri::SchemeDelimiter, address ); + +#if OLDMETHOD + Uri^ result; + if ( Uri::TryParse( uriString, false, false, result ) ) + { + Console::WriteLine( "{0} is a valid Uri", result ); + } + else + { + Console::WriteLine( "Uri not created" ); + } +#endif + Uri ^result = gcnew Uri(uriString); + if (result->IsWellFormedOriginalString()) + Console::WriteLine("{0} is a well formed Uri", uriString); + else + Console::WriteLine("{0} is not a well formed Uri", uriString); + // + } + + static void SampleUserInfo() + { + // + Uri^ uriAddress = gcnew Uri( "http://user:password@www.contoso.com/index.htm " ); + Console::WriteLine( uriAddress->UserInfo ); + Console::WriteLine( "Fully Escaped {0}", + uriAddress->UserEscaped ? (String^)"yes" : "no" ); + // + } + }; +} + +int main() +{ + Example::Test::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp new file mode 100644 index 00000000000..430056166b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp @@ -0,0 +1,843 @@ +// NCLWebClientAsync +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::ComponentModel; + +// +void UploadString( String^ address ) +{ + String^ data = "Time = 12:00am temperature = 50"; + WebClient^ client = gcnew WebClient; + + // Optionally specify an encoding for uploading and downloading strings. + client->Encoding = System::Text::Encoding::UTF8; + + // Upload the data. + String^ reply = client->UploadString( address, data ); + + // Disply the server's response. + Console::WriteLine( reply ); +} +// + +// +void PostString( String^ address ) +{ + String^ data = "Time = 12:00am temperature = 50"; + String^ method = "POST"; + WebClient^ client = gcnew WebClient; + String^ reply = client->UploadString( address, method, data ); + Console::WriteLine( reply ); +} +// + +void UploadFileCallback2( Object^ sender, UploadFileCompletedEventArgs^ e ); + +// +// Sample call: UploadFileInBackground3("http://www.contoso.com/fileUpload.aspx", "data.txt") +void UploadFileInBackground3( String^ address, String^ fileName ) +{ + + // + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + client->UseDefaultCredentials = true; + + // + client->UploadFileCompleted += gcnew UploadFileCompletedEventHandler( UploadFileCallback2 ); + client->UploadFileAsync( uri, fileName ); + Console::WriteLine( "File upload started." ); +} + +// + +// +// Sample call: UploadFileInBackground2("http://www.contoso.com/fileUpload.aspx", "data.txt") +void UploadFileInBackground2( String^ address, String^ fileName ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + client->UploadFileCompleted += + gcnew UploadFileCompletedEventHandler (UploadFileCallback2); + + // Specify a progress notification handler. + client->UploadProgressChanged += + gcnew UploadProgressChangedEventHandler( UploadProgressCallback ); + client->UploadFileAsync( uri, "POST", fileName ); + Console::WriteLine( "File upload started." ); +} +// + +// +void UploadFileCallback2( Object^ /*sender*/, UploadFileCompletedEventArgs^ e ) +{ + String^ reply = System::Text::Encoding::UTF8->GetString( e->Result ); + Console::WriteLine( reply ); +} +// + +void UploadFileCallback( Object^ sender, UploadFileCompletedEventArgs^ e ); + +// +// Sample call: UploadFileInBackground("http://www.contoso.com/fileUpload.aspx", "data.txt") +void UploadFileInBackground( String^ address, String^ fileName ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ method = "POST"; + + // Specify that that UploadFileCallback method gets called + // when the file upload completes. + client->UploadFileCompleted += gcnew UploadFileCompletedEventHandler( UploadFileCallback ); + client->UploadFileAsync( uri, method, fileName, waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the upload to complete. + waiter->WaitOne(); + Console::WriteLine( "File upload is complete." ); +} +// + +// +void UploadFileCallback( Object^ /*sender*/, UploadFileCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + ; + try + { + String^ reply = System::Text::Encoding::UTF8->GetString( e->Result ); + Console::WriteLine( reply ); + } + finally + { + + // If this thread throws an exception, make sure that + // you let the main application thread resume. + waiter->Set(); + } + +} +// + +void UploadStringCallback( Object^ sender, UploadStringCompletedEventArgs^ e ); + +// +void UploadStringInBackground( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ data = "Time = 12:00am temperature = 50"; + String^ method = "POST"; + + client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback ); + client->UploadStringAsync( uri, method, data, waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the upload to complete. + waiter->WaitOne(); + Console::WriteLine( "String upload is complete." ); +} +// + +// +void UploadStringCallback( Object^ /*sender*/, UploadStringCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + try + { + String^ reply = dynamic_cast(e->Result); + Console::WriteLine( reply ); + } + finally + { + + // If this thread throws an exception, make sure that + // you let the main application thread resume. + waiter->Set(); + } + +} +// + +void OpenReadCallback( Object^ sender, OpenReadCompletedEventArgs^ e ); + +// +void OpenResourceForReading( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + client->OpenReadCompleted += gcnew OpenReadCompletedEventHandler( OpenReadCallback ); + client->OpenReadAsync( uri, waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the upload to complete. + waiter->WaitOne(); +} +// + +// +void OpenReadCallback( Object^ /*sender*/, OpenReadCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + Stream^ reply = nullptr; + StreamReader^ s = nullptr; + try + { + reply = dynamic_cast(e->Result); + s = gcnew StreamReader( reply ); + Console::WriteLine( s->ReadToEnd() ); + } + finally + { + if ( s != nullptr ) + { + s->Close(); + } + if ( reply != nullptr ) + { + reply->Close(); + } + + // If this thread throws an exception, make sure that + // you let the main application thread resume. + waiter->Set(); + } + +} +// + +void OpenWriteCallback( Object^ sender, OpenWriteCompletedEventArgs^ e ); + +// +void OpenResourceForWriting( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the OpenWriteCallback method gets called + // when the writeable stream is available. + client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback ); + client->OpenWriteAsync( uri, "POST", waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the upload to complete. + waiter->WaitOne(); +} +// + +// +void OpenWriteCallback( Object^ /*sender*/, OpenWriteCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + Stream^ body = nullptr; + StreamWriter^ s = nullptr; + try + { + body = dynamic_cast(e->Result); + s = gcnew StreamWriter( body ); + s->AutoFlush = true; + s->Write( "This is content data to be sent to the server." ); + } + finally + { + if ( s != nullptr ) + { + s->Close(); + } + if ( body != nullptr ) + { + body->Close(); + } + + // If this thread throws an exception, make sure that + // you let the main application thread resume. + waiter->Set(); + } + +} +// + +void OpenWriteCallback2( Object^ sender, OpenWriteCompletedEventArgs^ e ); + +// +void OpenResourceForWriting2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the OpenWriteCallback method gets called + // when the writeable stream is available. + client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback2 ); + client->OpenWriteAsync( uri, "POST" ); + + // Applications can perform other tasks + // while waiting for the upload to complete. +} +// + +// +void OpenWriteCallback2( Object^ /*sender*/, OpenWriteCompletedEventArgs^ e ) +{ + Stream^ body = nullptr; + StreamWriter^ s = nullptr; + try + { + body = dynamic_cast(e->Result); + s = gcnew StreamWriter( body ); + s->AutoFlush = true; + s->Write( "This is content data to be sent to the server." ); + } + finally + { + if ( s != nullptr ) + { + s->Close(); + } + if ( body != nullptr ) + { + body->Close(); + } + } + +} +// + +// +void OpenResourceForPosting( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the OpenWriteCallback method gets called + // when the writeable stream is available. + client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback2 ); + client->OpenWriteAsync( uri ); + + // Applications can perform other tasks + // while waiting for the upload to complete. +} +// + +void DownloadFileCallback( Object^ sender, System::ComponentModel::AsyncCompletedEventArgs^ e ); + +// +// Sample call : DownLoadFileInBackground ("http://www.contoso.com/logs/January.txt"); +void DownLoadFileInBackground( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the DownloadFileCallback method gets called + // when the download completes. + client->DownloadFileCompleted += gcnew AsyncCompletedEventHandler( DownloadFileCallback ); + client->DownloadFileAsync( uri, "serverdata.txt", waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the download to complete. + waiter->WaitOne(); +} +// + +// +void DownloadFileCallback( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ e ) +{ + if ( e->Cancelled ) + { + Console::WriteLine( "File download cancelled." ); + } + + if ( e->Error != nullptr ) + { + Console::WriteLine( e->Error->ToString() ); + } + + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + + // Let the main application thread resume. + waiter->Set(); +} +// + +void DownloadFileCallback2( Object^ sender, System::ComponentModel::AsyncCompletedEventArgs^ e ); + +// +// Sample call : DownLoadFileInBackground2 ("http://www.contoso.com/logs/January.txt"); +void DownLoadFileInBackground2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Call DownloadFileCallback2 when the download completes. + client->DownloadFileCompleted += gcnew AsyncCompletedEventHandler( DownloadFileCallback2 ); + + // Specify a progress notification handler here... + + client->DownloadFileAsync( uri, "serverdata.txt" ); +} + +void DownloadFileCallback2( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ e ) +{ + if ( e->Cancelled ) + { + Console::WriteLine( "File download cancelled." ); + } + + if ( e->Error != nullptr ) + { + Console::WriteLine( e->Error->ToString() ); + } +} +// + +void DownloadDataCallback( Object^ sender, DownloadDataCompletedEventArgs^ e ); + +// +// Sample call : DownLoadDataInBackground ("http://www.contoso.com/GameScores.html"); +void DownloadDataInBackground( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the DownloadDataCallback method gets called + // when the download completes. + client->DownloadDataCompleted += gcnew DownloadDataCompletedEventHandler( DownloadDataCallback ); + client->DownloadDataAsync( uri, waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the download to complete. + waiter->WaitOne(); +} +// + +// +void DownloadDataCallback( Object^ /*sender*/, DownloadDataCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + try + { + + // If the request was not canceled and did not throw + // an exception, display the resource. + if ( !e->Cancelled && e->Error == nullptr ) + { + array^data = dynamic_cast^>(e->Result); + String^ textData = System::Text::Encoding::UTF8->GetString( data ); + Console::WriteLine( textData ); + } + } + finally + { + + // Let the main application thread resume. + waiter->Set(); + } + +} +// + +void DownloadDataCallback2( Object^ sender, DownloadDataCompletedEventArgs^ e ); + +// +// Sample call : DownloadDataInBackground2 ("http://www.contoso.com/GameScores.html"); +void DownloadDataInBackground2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the DownloadDataCallback2 method gets called + // when the download completes. + client->DownloadDataCompleted += gcnew DownloadDataCompletedEventHandler( DownloadDataCallback2 ); + client->DownloadDataAsync( uri ); +} +// + +// +void DownloadDataCallback2( Object^ /*sender*/, DownloadDataCompletedEventArgs^ e ) +{ + + // If the request was not canceled and did not throw + // an exception, display the resource. + if ( !e->Cancelled && e->Error == nullptr ) + { + array^data = dynamic_cast^>(e->Result); + String^ textData = System::Text::Encoding::UTF8->GetString( data ); + Console::WriteLine( textData ); + } +} +// + +// +void DownloadString( String^ address ) +{ + WebClient^ client = gcnew WebClient; + String^ reply = client->DownloadString( address ); + Console::WriteLine( reply ); +} + + +// +void DownloadStringCallback( Object^ sender, DownloadStringCompletedEventArgs^ e ); + +// +// Sample call : DownLoadStringInBackground ("http://www.contoso.com/GameScores.html"); +void DownloadStringInBackground( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the DownloadStringCallback method gets called + // when the download completes. + client->DownloadStringCompleted += gcnew DownloadStringCompletedEventHandler( DownloadStringCallback ); + client->DownloadStringAsync( uri, waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the download to complete. + waiter->WaitOne(); +} +// + +// +void DownloadStringCallback( Object^ /*sender*/, DownloadStringCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + try + { + + // If the request was not canceled and did not throw + // an exception, display the resource. + if ( !e->Cancelled && e->Error == nullptr ) + { + String^ textString = dynamic_cast(e->Result); + Console::WriteLine( textString ); + } + } + finally + { + + // Let the main application thread resume. + waiter->Set(); + } + +} +// + +void DownloadStringCallback2( Object^ sender, DownloadStringCompletedEventArgs^ e ); + +// +// Sample call : DownloadStringInBackground2 ("http://www.contoso.com/GameScores.html"); +void DownloadStringInBackground2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the DownloadStringCallback2 method gets called + // when the download completes. + client->DownloadStringCompleted += gcnew DownloadStringCompletedEventHandler( DownloadStringCallback2 ); + client->DownloadStringAsync( uri ); +} +// + +// +void DownloadStringCallback2( Object^ /*sender*/, DownloadStringCompletedEventArgs^ e ) +{ + + // If the request was not canceled and did not throw + // an exception, display the resource. + if ( !e->Cancelled && e->Error == nullptr ) + { + String^ textString = dynamic_cast(e->Result); + Console::WriteLine( textString ); + } +} +// + +void OpenReadCallback2( Object^ sender, OpenReadCompletedEventArgs^ e ); + +// +void OpenResourceForReading2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + client->OpenReadCompleted += gcnew OpenReadCompletedEventHandler( OpenReadCallback2 ); + client->OpenReadAsync( uri ); +} +// + +// +void OpenReadCallback2( Object^ /*sender*/, OpenReadCompletedEventArgs^ e ) +{ + Stream^ reply = nullptr; + StreamReader^ s = nullptr; + try + { + reply = dynamic_cast(e->Result); + s = gcnew StreamReader( reply ); + Console::WriteLine( s->ReadToEnd() ); + } + finally + { + if ( s != nullptr ) + { + s->Close(); + } + if ( reply != nullptr ) + { + reply->Close(); + } + } + +} +// + +void UploadDataCallback( Object^ sender, UploadDataCompletedEventArgs^ e ); + +// +void UploadDataInBackground( String^ address ) +{ + System::Threading::AutoResetEvent^ waiter = gcnew System::Threading::AutoResetEvent( false ); + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ text = "Time = 12:00am temperature = 50"; + array^data = System::Text::Encoding::UTF8->GetBytes( text ); + String^ method = "POST"; + + client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback ); + client->UploadDataAsync( uri, method, data, waiter ); + + // Block the main application thread. Real applications + // can perform other tasks while waiting for the upload to complete. + waiter->WaitOne(); + Console::WriteLine( "Data upload is complete." ); +} +// + +// +void UploadDataCallback( Object^ /*sender*/, UploadDataCompletedEventArgs^ e ) +{ + System::Threading::AutoResetEvent^ waiter = dynamic_cast(e->UserState); + try + { + array^data = dynamic_cast^>(e->Result); + String^ reply = System::Text::Encoding::UTF8->GetString( data ); + Console::WriteLine( reply ); + } + finally + { + + // If this thread throws an exception, make sure that + // you let the main application thread resume. + waiter->Set(); + } + +} +// + +void UploadDataCallback2( Object^ sender, UploadDataCompletedEventArgs^ e ); + +// +void UploadDataInBackground2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ text = "Time = 12:00am temperature = 50"; + array^data = System::Text::Encoding::UTF8->GetBytes( text ); + String^ method = "POST"; + + client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback2 ); + client->UploadDataAsync( uri, method, data ); +} +// + +// +void UploadDataCallback2( Object^ /*sender*/, UploadDataCompletedEventArgs^ e ) +{ + array^data = dynamic_cast^>(e->Result); + String^ reply = System::Text::Encoding::UTF8->GetString( data ); + Console::WriteLine( reply ); +} +// + +void UploadDataCallback3( Object^ sender, UploadDataCompletedEventArgs^ e ); + +// +void UploadDataInBackground3( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ text = "Time = 12:00am temperature = 50"; + array^data = System::Text::Encoding::UTF8->GetBytes( text ); + + client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback3 ); + client->UploadDataAsync( uri, data ); +} +// + +// +void UploadDataCallback3( Object^ /*sender*/, UploadDataCompletedEventArgs^ e ) +{ + array^data = dynamic_cast^>(e->Result); + String^ reply = System::Text::Encoding::UTF8->GetString( data ); + Console::WriteLine( reply ); +} +// + +void UploadStringCallback2( Object^ sender, UploadStringCompletedEventArgs^ e ); + +// +void UploadStringInBackground2( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ data = "Time = 12:00am temperature = 50"; + + client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback2 ); + client->UploadStringAsync( uri, data ); +} +// + +// +void UploadStringCallback2( Object^ /*sender*/, UploadStringCompletedEventArgs^ e ) +{ + String^ reply = dynamic_cast(e->Result); + Console::WriteLine( reply ); +} +// + +// +void UploadStringInBackground3( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + String^ data = "Time = 12:00am temperature = 50"; + String^ method = "POST"; + + client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback2 ); + client->UploadStringAsync( uri, method, data ); +} +// + +// +// Sample call : DownLoadFileWithProgressNotify ("http://www.contoso.com/logs/January.txt"); +void DownLoadFileWithProgressNotify( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify that the DownloadFileCallback method gets called + // when the download completes. + client->DownloadFileCompleted += gcnew AsyncCompletedEventHandler( DownloadFileCallback2 ); + + // Specify a progress notification handler. + client->DownloadProgressChanged += gcnew DownloadProgressChangedEventHandler( DownloadProgressCallback ); + + // The user token, shown here as ID 1234, is used to uniquely + // identify notification events raised for this data transfer operation. + client->DownloadFileAsync( uri, "serverdata.txt", "ID 1234" ); +} +// + +// + static void UploadProgressCallback(Object^ sender, + UploadProgressChangedEventArgs^ e) + { + // Displays the operation identifier, and the transfer progress. + Console::WriteLine("{0} uploaded {1} of {2} bytes. {3} % complete...", + (String ^)e->UserState, + e->BytesSent, + e->TotalBytesToSend, + e->ProgressPercentage); + } + static void DownloadProgressCallback(Object^ sender, + DownloadProgressChangedEventArgs^ e) + { + // Displays the operation identifier, and the transfer progress. + Console::WriteLine("{0} downloaded {1} of {2} bytes. {3} % complete...", + (String ^)e->UserState, + e->BytesReceived, + e->TotalBytesToReceive, + e->ProgressPercentage); + } +// + +// +// Sample call : DownLoadFileInBackground4 ("http://www.contoso.com/logs/January.txt"); +void DownLoadFileInBackground4( String^ address ) +{ + WebClient^ client = gcnew WebClient; + Uri ^uri = gcnew Uri(address); + + // Specify a DownloadFileCompleted handler here... + + // Specify a progress notification handler. + client->DownloadProgressChanged += gcnew DownloadProgressChangedEventHandler( DownloadProgressCallback4 ); + + client->DownloadFileAsync( uri, "serverdata.txt" ); +} + +static void DownloadProgressCallback4(Object^ sender, DownloadProgressChangedEventArgs^ e) +{ + // Displays the operation identifier, and the transfer progress. + Console::WriteLine("{0} downloaded {1} of {2} bytes. {3} % complete...", + (String ^)e->UserState, + e->BytesReceived, + e->TotalBytesToReceive, + e->ProgressPercentage); +} +// + +// nothing below this line appears in the docs. +//[System.Security.Permissions.FileIOPermissionAttribute(System.Security.Permissions.SecurityAction.Deny, Write=@"c:\whidbeycode\ncl.xml")] +int main() +{ + + // OpenResourceForReading ("http://google.com"); + //OpenResourceForReading2("http://google.com"); + // System.Threading.Thread.Sleep (10000); + UploadDataInBackground2( "http://sharriso1/test/postaccepter.aspx" ); + + // DownloadString ("http://google.com"); + /* + UploadDataInBackground ("http://sharriso1/test/postaccepter.aspx"); + + System.Threading.Thread.Sleep (1000); + UploadDataInBackground3 ("http://sharriso1/test/postaccepter.aspx"); + System.Threading.Thread.Sleep (1000); + + UploadStringInBackground ("http://sharriso1/test/postaccepter.aspx"); + UploadStringInBackground2 ("http://sharriso1/test/postaccepter.aspx"); + System.Threading.Thread.Sleep (1000); + UploadStringInBackground3 ("http://sharriso1/test/postaccepter.aspx"); + System.Threading.Thread.Sleep (1000); + */ + // OpenResourceForWriting2("http://sharriso1/test/postaccepter.aspx"); + // DownloadDataInBackground ("http://google.com"); + //System.Threading.Thread.Sleep (10000); + // DownloadString ("http://google.com"); + // DownloadStringInBackground ("http://google.com"); + // DownloadStringInBackground2 ("http://google.com"); + // System.Threading.Thread.Sleep (1000); + // DownLoadFileInBackground2 ("http://sharriso1/test/uploadedFiles/onesandtwos.txt"); + DownLoadFileWithProgressNotify( "http://sharriso1/test/uploadedFiles/onesandtwos.txt" ); + + //System.Threading.Thread.Sleep (10000); + // UploadString (); + // UploadStringInBackground ("http://sharriso1/test/fileUploadercs.aspx"); + // UploadFileInBackground2 ("http://sharriso1/test/fileUploadercs.aspx", "onesandtwos.txt"); + // UploadFileInBackground3 ("http://sharriso1/test/fileUploadercs.aspx", "onesandtwos.txt"); + System::Threading::Thread::Sleep( 1000 ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp new file mode 100644 index 00000000000..e3efdf4be05 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp @@ -0,0 +1,31 @@ + + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args == nullptr || args->Length == 1 ) + { + throw gcnew ApplicationException( "Specify the URI of the resource to retrieve." ); + } + + WebClient^ client = gcnew WebClient; + + // Add a user agent header in case the + // requested URI contains a query. + client->Headers->Add( "user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)" ); + Stream^ data = client->OpenRead( args[ 1 ] ); + StreamReader^ reader = gcnew StreamReader( data ); + String^ s = reader->ReadToEnd(); + Console::WriteLine( s ); + data->Close(); + reader->Close(); + delete client; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp new file mode 100644 index 00000000000..bbfd7a0afd9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLWebProxy/CPP/nclwebproxy.cpp @@ -0,0 +1,186 @@ +#using + +using namespace System; +using namespace System::Net; + +// +WebProxy^ CreateProxy() +{ + return gcnew WebProxy; +} +// + +// +WebProxy^ CreateProxyWithExampleAddress() +{ + return gcnew WebProxy( gcnew Uri( "http://contoso" ) ); +} +// + +// +WebProxy^ CreateProxyWithExampleAddress( bool bypassLocal ) +{ + return gcnew WebProxy( gcnew Uri( "http://contoso" ), bypassLocal ); +} +// + +// +WebProxy^ CreateProxyWithBypassList( bool bypassLocal ) +{ + // Do not use the proxy server for Contoso.com URIs. + array^ bypassList = {";*.Contoso.com"}; + return gcnew WebProxy( gcnew Uri( "http://contoso" ), + bypassLocal, + bypassList ); +} +// + +// +WebProxy^ CreateProxyWithHost() +{ + return gcnew WebProxy( "http://contoso" ); +} +// + +// +WebProxy^ CreateProxyWithHostAndPort() +{ + return gcnew WebProxy( "contoso",80 ); +} +// + +// +WebProxy^ CreateProxyWithHostAddress( bool bypassLocal ) +{ + WebProxy^ proxy = gcnew WebProxy( "http://contoso",bypassLocal ); + Console::WriteLine( "Bypass proxy for local URIs?: {0}", + proxy->BypassProxyOnLocal ); + return proxy; +} +// + +// +WebProxy^ CreateProxyWithHostAndBypassList( bool bypassLocal ) +{ + // Do not use the proxy server for Contoso.com URIs. + array^ bypassList = {";*.Contoso.com"}; + return gcnew WebProxy( "http://contoso", + bypassLocal, + bypassList ); +} +// + +// +WebProxy^ CreateProxyWithCredentials( bool bypassLocal ) +{ + // Do not use the proxy server for Contoso.com URIs. + array^ bypassList = {";*.Contoso.com"}; + return gcnew WebProxy( "http://contoso", + bypassLocal, + bypassList, + CredentialCache::DefaultCredentials ); +} +// + +// +void DisplayDefaultProxy() +{ + WebProxy^ proxy = WebProxy::GetDefaultProxy(); + + Console::WriteLine( "Address: {0}", proxy->Address ); + + Console::WriteLine( "Bypass on local: {0}", + proxy->BypassProxyOnLocal ); + int count = proxy->BypassList->Length; + if ( count == 0 ) + { + Console::WriteLine( "The bypass list is empty." ); + return; + } + array^ bypass = proxy->BypassList; + Console::WriteLine( "The bypass list contents:" ); + + for ( int i = 0; i < count; i++ ) + { + Console::WriteLine( bypass[ i ] ); + } +} +// + +// +void CheckDefaultProxyForRequest( Uri^ resource ) +{ + WebProxy^ proxy = (WebProxy^)( WebProxy::GetDefaultProxy() ); + + // See what proxy is used for resource. + Uri^ resourceProxy = proxy->GetProxy( resource ); + + // Test to see whether a proxy was selected. + if ( resourceProxy == resource ) + { + Console::WriteLine( "No proxy for {0}", resource ); + } + else + { + Console::WriteLine( "Proxy for {0} is {1}", resource, + resourceProxy ); + } +} +// + +// +WebProxy^ CreateProxyAndCheckBypass( bool bypassLocal ) +{ + // Do not use the proxy server for Contoso.com URIs. + array^ bypassList = {";*.Contoso.com"}; + WebProxy^ proxy = gcnew WebProxy( "http://contoso", + bypassLocal, + bypassList ); + + // Test the bypass list. + if ( !proxy->IsBypassed( gcnew Uri( "http://www.Contoso.com" ) ) ) + { + Console::WriteLine( "Bypass not working!" ); + return nullptr; + } + else + { + Console::WriteLine( "Bypass is working." ); + return proxy; + } +} +// + +// +WebProxy^ CreateProxyWithCredentials2( bool bypassLocal ) +{ + + // Do not use the proxy server for Contoso.com URIs. + array^ bypassList = {";*.Contoso.com"}; + return gcnew WebProxy( gcnew Uri( "http://contoso" ), + bypassLocal, + bypassList, + CredentialCache::DefaultCredentials ); +} +// + +int main() +{ + Uri^ resource = gcnew Uri( "http://www.example.com" ); + + /* + CreateProxy(); + CreateProxyWithExampleAddress(); + CreateProxyWithExampleAddress(true); + CreateProxyWithBypassList(true); + CreateProxyWithHost(); + CreateProxyWithHostAndPort(); + CreateProxyWithHostAddress(true); + CreateProxyWithHostAndBypassList(true); + CreateProxyWithCredentials(true); + + DisplayDefaultProxy(); + */ + // CreateProxyAndCheckBypass(false); + CreateProxyWithCredentials2( false ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp b/snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp new file mode 100644 index 00000000000..51c732b4005 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCLWebRequestSimple/CPP/webrequestget.cpp @@ -0,0 +1,45 @@ + + +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; +int main() +{ + + // + // Create a request for the URL. + WebRequest^ request = WebRequest::Create( "http://www.contoso.com/default.html" ); + + // If required by the server, set the credentials. + request->Credentials = CredentialCache::DefaultCredentials; + + // Get the response. + HttpWebResponse^ response = dynamic_cast(request->GetResponse()); + + // + // Display the status. + Console::WriteLine( response->StatusDescription ); + + // Get the stream containing content returned by the server. + Stream^ dataStream = response->GetResponseStream(); + + // Open the stream using a StreamReader for easy access. + StreamReader^ reader = gcnew StreamReader( dataStream ); + + // Read the content. + String^ responseFromServer = reader->ReadToEnd(); + + // Display the content. + Console::WriteLine( responseFromServer ); + + // Cleanup the streams and the response. + reader->Close(); + dataStream->Close(); + response->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp new file mode 100644 index 00000000000..bdb99bf4675 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NCL_Credential.Cache.Add_SMTP/CPP/source.cpp @@ -0,0 +1,40 @@ +//The following sample initializes a CredentialCache with multiple security credentials +//and later uses NTLM credentials with SmtpClient + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Mail; + +void main() +{ +// + SmtpClient^ client = gcnew SmtpClient("ContosoMail", 45); + MailAddress^ from = gcnew MailAddress("sender@SenderMailServerName.com", "Sender Name"); + MailAddress^ to = gcnew MailAddress("recepient@RecepientMailServerName.com", "Recepient Name"); + MailMessage^ message = gcnew MailMessage(from, to); + + message->Body = "This is a test email message sent by an application. "; + message->Subject = "Test Email using Credentials"; + + NetworkCredential^ myCreds = gcnew NetworkCredential("username", "password", "domain"); + CredentialCache^ myCredentialCache = gcnew CredentialCache(); + try + { + myCredentialCache->Add("ContoscoMail", 35, "Basic", myCreds); + myCredentialCache->Add("ContoscoMail", 45, "NTLM", myCreds); + + client->Credentials = myCredentialCache->GetCredential("ContosoMail", 45, "NTLM"); + client->Send(message); + Console::WriteLine("Goodbye."); + } + catch(Exception^ e) + { + Console::WriteLine("Exception is raised. "); + Console::WriteLine("Message: {0} ",e->Message); + } +// + +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp b/snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp new file mode 100644 index 00000000000..4f475ac7f01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclCodeGroup/cpp/sample.cpp @@ -0,0 +1,167 @@ +#using + +using namespace System; +using namespace System::Security::Policy; + +static void DisplayConnectionAccessRules(NetCodeGroup^ group); +// + + +static CodeConnectAccess^ CreateFtpAndDefaultPortAccess() +{ + return gcnew CodeConnectAccess(Uri::UriSchemeFtp, + CodeConnectAccess::DefaultPort); +} +// +// + + +static CodeConnectAccess^ CreateHttpAndOriginPortAccess() +{ + return gcnew CodeConnectAccess(Uri::UriSchemeHttp, + CodeConnectAccess::OriginPort); +} +// +// + +static CodeConnectAccess^ CreateAnySchemeOriginPortAccess() +{ + return CodeConnectAccess::CreateAnySchemeAccess + (CodeConnectAccess::OriginPort); +} +// +// + +static void SetNetCodeGroupAccess() +{ + String^ userPolicyLevel = "User"; + // Locate the User policy level. + PolicyLevel^ level = nullptr; + System::Collections::IEnumerator^ ph = + System::Security::SecurityManager::PolicyHierarchy(); + while(ph->MoveNext()) + { + level = (PolicyLevel^)ph->Current; + if (level->Label == userPolicyLevel) + { + break; + } + } + if (level->Label != userPolicyLevel) + throw gcnew ApplicationException("Could not find User policy level."); + // + + IMembershipCondition^ membership = + gcnew UrlMembershipCondition("http://www.contoso.com/*"); + NetCodeGroup^ codeGroup = gcnew NetCodeGroup(membership); + // Delete default settings. + codeGroup->ResetConnectAccess(); + // Create an object that represents access to the FTP scheme and + // default port. + CodeConnectAccess^ CodeAccessFtp = + gcnew CodeConnectAccess(Uri::UriSchemeFtp, + CodeConnectAccess::DefaultPort); + // Create an object that represents access to the HTTPS scheme + // and default port. + CodeConnectAccess^ CodeAccessHttps = + gcnew CodeConnectAccess(Uri::UriSchemeHttps, + CodeConnectAccess::DefaultPort); + // Create an object that represents access to the origin + // scheme and port. + CodeConnectAccess^ CodeAccessOrigin = + CodeConnectAccess::CreateOriginSchemeAccess + (CodeConnectAccess::OriginPort); + // Add connection access objects to the NetCodeGroup object. + codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessFtp); + codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessHttps); + codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessOrigin); + // + // Provide name and description information for caspol.exe tool. + codeGroup->Name = "ContosoHttpCodeGroup"; + codeGroup->Description = "Code originating from contoso.com can" + + " connect back using the FTP or HTTPS."; + // Add the code group to the User policy's root node. + level->RootCodeGroup->AddChild(codeGroup); + // Save the changes to the policy level. + System::Security::SecurityManager::SavePolicy(); +} +// +// + +static void DisplayProperties (CodeConnectAccess^ access) +{ + Console::WriteLine("Scheme:{0} Port: {1}", + access->Scheme, access->Port); +} +// +// + +static void DisplayFields () +{ + Console::WriteLine("Origin scheme value:{0} AnyScheme value: {1}", + CodeConnectAccess::OriginScheme, CodeConnectAccess::AnyScheme); +} +// + + +static void CreateNetCodeGroup() +{ + IMembershipCondition^ membership = + gcnew UrlMembershipCondition("http://www.contoso.com/*"); + NetCodeGroup^ codeGroup = gcnew NetCodeGroup(membership); + + // Display default settings. + DisplayConnectionAccessRules(codeGroup); + // Delete default settings. + codeGroup->ResetConnectAccess(); + // Create an object that represents access to the ftp scheme and + // default port. + CodeConnectAccess^ CodeAccessFtp = + gcnew CodeConnectAccess(Uri::UriSchemeFtp, + CodeConnectAccess::DefaultPort); + // Create an object that represents access to the HTTPS scheme + // and default port. + CodeConnectAccess^ CodeAccessHttps = + gcnew CodeConnectAccess(Uri::UriSchemeHttps, + CodeConnectAccess::DefaultPort); + // Create an object that represents access to the origin scheme + // and port. + CodeConnectAccess^ CodeAccessOrigin = + CodeConnectAccess::CreateOriginSchemeAccess + (CodeConnectAccess::OriginPort); + + codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessFtp); + codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessHttps); + codeGroup->AddConnectAccess(Uri::UriSchemeHttp, CodeAccessOrigin); + Console::WriteLine("New NetCodeGroup settings:"); + DisplayConnectionAccessRules(codeGroup); +} +// + +static void DisplayConnectionAccessRules(NetCodeGroup^ group) +{ + array^ rules = + group->GetConnectAccessRules(); + for each (System::Collections::DictionaryEntry^ o in rules) + { + String^ key = (String^)(o->Key); + array^ values = (array^)(o->Value); + Console::WriteLine("Origin scheme: {0}", key); + for each (CodeConnectAccess^ c in values) + { + Console::WriteLine("Scheme {0} Port: {1}", c->Scheme, c->Port); + } + Console::WriteLine("__________________________"); + } +} +// + +int main() +{ + DisplayProperties(CreateFtpAndDefaultPortAccess()); + DisplayFields(); + DisplayProperties(CreateHttpAndOriginPortAccess()); + DisplayProperties(CreateAnySchemeOriginPortAccess()); + SetNetCodeGroupAccess(); + CreateNetCodeGroup(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp new file mode 100644 index 00000000000..af770e04406 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclMailASync/cpp/mailasync.cpp @@ -0,0 +1,94 @@ +//NclMailASync + +// +#using +using namespace System; +using namespace System::Net; +using namespace System::Net::Mail; +using namespace System::Net::Mime; +using namespace System::Threading; +using namespace System::ComponentModel; + +static bool mailSent; + +static void SendCompletedCallback(Object^ sender, AsyncCompletedEventArgs^ e) +{ + // Get the unique identifier for this asynchronous + // operation. + String^ token = (String^) e->UserState; + + if (e->Cancelled) + { + Console::WriteLine("[{0}] Send canceled.", token); + } + if (e->Error != nullptr) + { + Console::WriteLine("[{0}] {1}", token, + e->Error->ToString()); + } else + { + Console::WriteLine("Message sent."); + } + mailSent = true; +} + +int main(array^ args) +{ + if (args->Length > 1) + { + // Command-line argument must be the SMTP host. + SmtpClient^ client = gcnew SmtpClient(args[1]); + // Specify the email sender. + // + // Create a mailing address that includes a UTF8 + // character in the display name. + MailAddress^ from = gcnew MailAddress("jane@contoso.com", + "Jane " + (wchar_t)0xD8 + " Clayton", + System::Text::Encoding::UTF8); + // + // Set destinations for the email message. + MailAddress^ to = gcnew MailAddress("ben@contoso.com"); + // Specify the message content. + // + MailMessage^ message = gcnew MailMessage(from, to); + message->Body = "This is a test email message sent" + + " by an application. "; + // Include some non-ASCII characters in body and + // subject. + String^ someArrows = gcnew String(gcnew array{L'\u2190', + L'\u2191', L'\u2192', L'\u2193'}); + message->Body += Environment::NewLine + someArrows; + message->BodyEncoding = System::Text::Encoding::UTF8; + message->Subject = "test message 1" + someArrows; + message->SubjectEncoding = System::Text::Encoding::UTF8; + // + // Set the method that is called back when the send + // operation ends. + client->SendCompleted += gcnew + SendCompletedEventHandler(SendCompletedCallback); + // The userState can be any object that allows your + // callback method to identify this send operation. + // For this example, the userToken is a string constant. + String^ userState = "test message1"; + client->SendAsync(message, userState); + Console::WriteLine("Sending message... press c to" + + " cancel mail. Press any other key to exit."); + String^ answer = Console::ReadLine(); + // If the user canceled the send, and mail hasn't been + // sent yet,then cancel the pending operation. + if (answer->ToLower()->StartsWith("c") && !mailSent) + { + client->SendAsyncCancel(); + } + // Clean up. + delete message; + delete client; + client = nullptr; + Console::WriteLine("Goodbye."); + } + else + { + Console::WriteLine("Please give SMTP server name!"); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp b/snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp new file mode 100644 index 00000000000..9e6468dcd8f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclMailPerms/CPP/mailpermissions.cpp @@ -0,0 +1,98 @@ + +// NCLMailPerms +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Mail; +using namespace System::Net::Mime; +using namespace System::Security::Permissions; + +namespace SmtpPermissionsExamples +{ + public ref class TestSmtpPermissions + { + public: + // + static SmtpPermission^ CreateConnectPermission() + { + SmtpPermission^ connectAccess = + gcnew SmtpPermission(SmtpAccess::Connect); + Console::WriteLine("Access? {0}", connectAccess->Access); + return connectAccess; + } + // + + // + static SmtpPermission^ CreateUnrestrictedPermission() + { + SmtpPermission^ allAccess = + gcnew SmtpPermission(PermissionState::Unrestricted); + Console::WriteLine("Is unrestricted? {0}", + allAccess->IsUnrestricted()); + return allAccess; + } + // + + // + static SmtpPermission^ CreatePermissionCopy(SmtpPermission^ p) + { + SmtpPermission^ copy = (SmtpPermission^) p->Copy(); + return copy; + } + // + + // + static SmtpPermission^ CreateUnrestrictedPermission2() + { + SmtpPermission^ allAccess = gcnew SmtpPermission(true); + Console::WriteLine("Is unrestricted? {0}", + allAccess->IsUnrestricted()); + return allAccess; + } + // + + // + static SmtpPermission^ GiveFullAccess( + SmtpPermission^ permission) + { + permission->AddPermission(SmtpAccess::Connect); + return permission; + } + // + + // + static SmtpPermission^ IntersectionWithFull( + SmtpPermission^ permission) + { + SmtpPermission^ allAccess = + gcnew SmtpPermission(PermissionState::Unrestricted); + return (SmtpPermission^) permission->Intersect(allAccess); + } + // + + // + static bool CheckSubSet( + SmtpPermission^ permission) + { + SmtpPermission^ allAccess = + gcnew SmtpPermission(PermissionState::Unrestricted); + return permission->IsSubsetOf(allAccess); + } + // + + // + static SmtpPermission^ UnionWithFull( + SmtpPermission^ permission) + { + SmtpPermission^ allAccess = + gcnew SmtpPermission(PermissionState::Unrestricted); + return (SmtpPermission^) permission->Union(allAccess); + } + // + }; +}; + +int main() +{ +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp new file mode 100644 index 00000000000..6f24d42284f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp @@ -0,0 +1,239 @@ + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::Net::Sockets; +using namespace System::Security::Authentication; +using namespace System::Security::Principal; +using namespace System::Text; +using namespace System::IO; +using namespace System::Threading; + +// ClientState is the AsyncState object. +private ref class ClientState +{ +private: + AuthenticatedStream^ authStream; + TcpClient^ client; + array^buffer; + StringBuilder^ message; + ManualResetEvent^ waiter; + +internal: + ClientState( AuthenticatedStream^ a, TcpClient^ theClient ) + { + authStream = a; + client = theClient; + message = nullptr; + buffer = gcnew array(2048); + waiter = gcnew ManualResetEvent( false ); + } + +internal: + property TcpClient^ Client + { + TcpClient^ get() + { + return client; + } + } + + property AuthenticatedStream^ AuthStream + { + AuthenticatedStream^ get() + { + return authStream; + } + } + + property array^ Buffer + { + array^ get() + { + return buffer; + } + + } + + property StringBuilder^ Message + { + StringBuilder^ get() + { + if ( message == nullptr ) + message = gcnew StringBuilder; + + return message; + } + + } + + property ManualResetEvent^ Waiter + { + ManualResetEvent^ get() + { + return waiter; + } + + } + +}; + +public ref class AsynchronousAuthenticatingTcpListener +{ +public: + int Main() + { + + // Create an IPv4 TCP/IP socket. + TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 ); + + // Listen for incoming connections. + listener->Start(); + while ( true ) + { + TcpClient^ clientRequest = nullptr; + + // Application blocks while waiting for an incoming connection. + // Type CNTL-C to terminate the server. + clientRequest = listener->AcceptTcpClient(); + Console::WriteLine( L"Client connected." ); + + // A client has connected. + try + { + AuthenticateClient( clientRequest ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + continue; + } + + } + } + + + // + static void AuthenticateClient( TcpClient^ clientRequest ) + { + NetworkStream^ stream = clientRequest->GetStream(); + + // Create the NegotiateStream. + NegotiateStream^ authStream = gcnew NegotiateStream( stream,false ); + + // Save the current client and NegotiateStream instance + // in a ClientState object. + ClientState^ cState = gcnew ClientState( authStream,clientRequest ); + + // Listen for the client authentication request. + authStream->BeginAuthenticateAsServer( gcnew AsyncCallback( EndAuthenticateCallback ), cState ); + + // Wait until the authentication completes. + cState->Waiter->WaitOne(); + cState->Waiter->Reset(); + authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState ); + cState->Waiter->WaitOne(); + + // Finished with the current client. + authStream->Close(); + clientRequest->Close(); + } + + + // + // The following method is invoked by the + // BeginServerAuthenticate callback delegate. + // + static void EndAuthenticateCallback( IAsyncResult^ ar ) + { + + // Get the saved data. + ClientState^ cState = dynamic_cast(ar->AsyncState); + TcpClient^ clientRequest = cState->Client; + NegotiateStream^ authStream = dynamic_cast(cState->AuthStream); + Console::WriteLine( L"Ending authentication." ); + + // Any exceptions that occurred during authentication are + // thrown by the EndServerAuthenticate method. + try + { + + // This call blocks until the authentication is complete. + authStream->EndAuthenticateAsServer( ar ); + } + catch ( AuthenticationException^ e ) + { + Console::WriteLine( e ); + Console::WriteLine( L"Authentication failed - closing connection." ); + cState->Waiter->Set(); + return; + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + Console::WriteLine( L"Closing connection." ); + cState->Waiter->Set(); + return; + } + + + // Display properties of the authenticated client. + IIdentity^ id = authStream->RemoteIdentity; + Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType ); + cState->Waiter->Set(); + } + + + // + // + static void EndReadCallback( IAsyncResult^ ar ) + { + + // Get the saved data. + ClientState^ cState = dynamic_cast(ar->AsyncState); + TcpClient^ clientRequest = cState->Client; + NegotiateStream^ authStream = dynamic_cast(cState->AuthStream); + + // Get the buffer that stores the message sent by the client. + int bytes = -1; + + // Read the client message. + try + { + bytes = authStream->EndRead( ar ); + cState->Message->Append( Encoding::UTF8->GetChars( cState->Buffer, 0, bytes ) ); + if ( bytes != 0 ) + { + authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState ); + return; + } + } + catch ( Exception^ e ) + { + + // A real application should do something + // useful here, such as logging the failure. + Console::WriteLine( L"Client message exception:" ); + Console::WriteLine( e ); + cState->Waiter->Set(); + return; + } + + IIdentity^ id = authStream->RemoteIdentity; + Console::WriteLine( L"{0} says {1}", id->Name, cState->Message ); + cState->Waiter->Set(); + } + + // +}; + +void main() +{ + AsynchronousAuthenticatingTcpListener^ aatl = gcnew AsynchronousAuthenticatingTcpListener; + aatl->Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp new file mode 100644 index 00000000000..1a0a913e1d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp @@ -0,0 +1,107 @@ + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::Net::Sockets; +using namespace System::Security::Principal; + +// +static void DisplayStreamProperties( NegotiateStream^ stream ) +{ + Console::WriteLine( L"Can read: {0}", stream->CanRead ); + Console::WriteLine( L"Can write: {0}", stream->CanWrite ); + Console::WriteLine( L"Can seek: {0}", stream->CanSeek ); + try + { + + // If the underlying stream supports it, display the length. + Console::WriteLine( L"Length: {0}", stream->Length ); + } + catch ( NotSupportedException^ ) + { + Console::WriteLine( L"Cannot get the length of the underlying stream." ); + } + + if ( stream->CanTimeout ) + { + Console::WriteLine( L"Read time-out: {0}", stream->ReadTimeout ); + Console::WriteLine( L"Write time-out: {0}", stream->WriteTimeout ); + } +} + + +// +// +static void DisplayAuthenticationProperties( NegotiateStream^ stream ) +{ + Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated ); + Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated ); + Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted ); + Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); + Console::WriteLine( L"ImpersonationLevel: {0}", stream->ImpersonationLevel ); + Console::WriteLine( L"IsServer: {0}", stream->IsServer ); +} + + +// +// +int main() +{ + + // + // Establish the remote endpoint for the socket. + // For this example, use the local machine. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + + // Client and server use port 11000. + IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + TcpClient^ client = gcnew TcpClient; + + // Connect the socket to the remote endpoint. + client->Connect( remoteEP ); + Console::WriteLine( L"Client connected to {0}.", remoteEP ); + + // Ensure the client does not close when there is + // still data to be sent to the server. + client->LingerState = (gcnew LingerOption( true,0 )); + + // Request authentication. + NetworkStream^ clientStream = client->GetStream(); + NegotiateStream^ authStream = gcnew NegotiateStream( clientStream ); + + // Request authentication for the client only (no mutual authentication). + // Authenicate using the client's default credetials. + // Permit the server to impersonate the client to access resources on the server only. + // Request that data be transmitted using encryption and data signing. + authStream->AuthenticateAsClient( dynamic_cast(CredentialCache::DefaultCredentials), + L"", + ProtectionLevel::EncryptAndSign, + TokenImpersonationLevel::Impersonation ); + + // + DisplayAuthenticationProperties( authStream ); + DisplayStreamProperties( authStream ); + if ( authStream->CanWrite ) + { + + // Encode the test data into a byte array. + array^message = System::Text::Encoding::UTF8->GetBytes( L"Hello from the client." ); + authStream->Write( message, 0, message->Length ); + authStream->Flush(); + Console::WriteLine( L"Sent {0} bytes.", message->Length ); + } + + + // Close the client connection. + authStream->Close(); + Console::WriteLine( L"Client closed." ); +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp new file mode 100644 index 00000000000..b02ceda8bc7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp @@ -0,0 +1,73 @@ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::Net::Sockets; +using namespace System::Security::Principal; +using namespace System::Text; +using namespace System::IO; +using namespace System::Threading; + +// +static void AuthenticateClient( TcpClient^ clientRequest ) +{ + NetworkStream^ stream = clientRequest->GetStream(); + + // Create the NegotiateStream. + NegotiateStream^ authStream = gcnew NegotiateStream( stream,false ); + + // Perform the server side of the authentication. + authStream->AuthenticateAsServer(); + + // Display properties of the authenticated client. + IIdentity^ id = authStream->RemoteIdentity; + Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType ); + + // Read a message from the client. + array^buffer = gcnew array(2048); + int charLength = authStream->Read( buffer, 0, buffer->Length ); + String^ messageData = gcnew String( Encoding::UTF8->GetChars( buffer, 0, buffer->Length ) ); + Console::WriteLine( L"READ {0}", messageData ); + + // Finished with the current client. + authStream->Close(); + + // Close the client connection. + clientRequest->Close(); +} + + +// +int main() +{ + + // Create an IPv4 TCP/IP socket. + TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 ); + + // Listen for incoming connections. + listener->Start(); + while ( true ) + { + TcpClient^ clientRequest = nullptr; + + // Application blocks while waiting for an incoming connection. + // Type CNTL-C to terminate the server. + clientRequest = listener->AcceptTcpClient(); + + // A client has connected. + try + { + AuthenticateClient( clientRequest ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + continue; + } + + Console::WriteLine( L"Client connected." ); + } +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp new file mode 100644 index 00000000000..8a961ac9aff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp @@ -0,0 +1,128 @@ + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::Net::Sockets; +using namespace System::Text; + +// +// The following class displays the properties of an authenticatedStream. +public ref class AuthenticatedStreamReporter +{ +public: + static void DisplayProperties( AuthenticatedStream^ stream ) + { + Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated ); + Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated ); + Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted ); + Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); + Console::WriteLine( L"IsServer: {0}", stream->IsServer ); + } + +}; + + +// +public ref class ASynchronousAuthenticatingTcpClient +{ +private: + static TcpClient^ client = nullptr; + +public: + void Main() + { + + // + // + // Establish the remote endpoint for the socket. + // For this example, use the local machine. + IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); + IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; + + // Client and server use port 11000. + IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); + + // Create a TCP/IP socket. + client = gcnew TcpClient; + + // Connect the socket to the remote endpoint. + client->Connect( remoteEP ); + Console::WriteLine( L"Client connected to {0}.", remoteEP ); + + // Ensure the client does not close when there is + // still data to be sent to the server. + client->LingerState = (gcnew LingerOption( true,0 )); + + // + // Request authentication. + NetworkStream^ clientStream = client->GetStream(); + NegotiateStream^ authStream = gcnew NegotiateStream( clientStream,false ); + + // + // Pass the NegotiateStream as the AsyncState object + // so that it is available to the callback delegate. + IAsyncResult^ ar = authStream->BeginAuthenticateAsClient( gcnew AsyncCallback( EndAuthenticateCallback ), authStream ); + + // + Console::WriteLine( L"Client waiting for authentication..." ); + + // Wait until the result is available. + ar->AsyncWaitHandle->WaitOne(); + + // Display the properties of the authenticated stream. + AuthenticatedStreamReporter::DisplayProperties( authStream ); + + // Send a message to the server. + // Encode the test data into a byte array. + array^message = Encoding::UTF8->GetBytes( L"Hello from the client." ); + ar = authStream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( EndWriteCallback ), authStream ); + + // + ar->AsyncWaitHandle->WaitOne(); + Console::WriteLine( L"Sent {0} bytes.", message->Length ); + + // Close the client connection. + authStream->Close(); + Console::WriteLine( L"Client closed." ); + } + + + // + // The following method is called when the authentication completes. + static void EndAuthenticateCallback( IAsyncResult^ ar ) + { + Console::WriteLine( L"Client ending authentication..." ); + NegotiateStream^ authStream = dynamic_cast(ar->AsyncState); + + // End the asynchronous operation. + authStream->EndAuthenticateAsClient( ar ); + + // Console.WriteLine("AllowedImpersonation: {0}", authStream.AllowedImpersonation); + } + + + // + // + // The following method is called when the write operation completes. + static void EndWriteCallback( IAsyncResult^ ar ) + { + Console::WriteLine( L"Client ending write operation..." ); + NegotiateStream^ authStream = dynamic_cast(ar->AsyncState); + + // End the asynchronous operation. + authStream->EndWrite( ar ); + } + + // +}; + +void main() +{ + ASynchronousAuthenticatingTcpClient^ aatc = gcnew ASynchronousAuthenticatingTcpClient; + aatc->Main(); +} +// + diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp new file mode 100644 index 00000000000..ee93819179c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclNetAddressChanged1/CPP/changed.cpp @@ -0,0 +1,27 @@ + + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::NetworkInformation; +void AddressChangedCallback( Object^ /*sender*/, EventArgs^ /*e*/ ) +{ + array^adapters = NetworkInterface::GetAllNetworkInterfaces(); + System::Collections::IEnumerator^ myEnum = adapters->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + NetworkInterface^ n = safe_cast(myEnum->Current); + Console::WriteLine( " {0} is {1}", n->Name, n->OperationalStatus ); + } +} + +int main() +{ + NetworkChange::NetworkAddressChanged += gcnew NetworkAddressChangedEventHandler( AddressChangedCallback ); + Console::WriteLine( "Listening for address changes. Press any key to exit." ); + Console::ReadLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp new file mode 100644 index 00000000000..c38764723e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclNetworkInfoPerms/CPP/NclNetworkInfoPerms.cpp @@ -0,0 +1,48 @@ + +// NclNetworkInfoPerms +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::NetworkInformation; +static void CreatePermission() +{ + + // + // + // + // + System::Net::NetworkInformation::NetworkInformationPermission^ unrestricted = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::Unrestricted ); + + // + Console::WriteLine( L"Is unrestricted? {0}", unrestricted->IsUnrestricted() ); + + // + // + // + System::Net::NetworkInformation::NetworkInformationPermission^ read = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read ); + + // + System::Net::NetworkInformation::NetworkInformationPermission^ copyPermission = dynamic_cast(read->Copy()); + + // + System::Net::NetworkInformation::NetworkInformationPermission^ unionPermission = dynamic_cast(read->Union( unrestricted )); + Console::WriteLine( L"Is subset?{0}", read->IsSubsetOf( unionPermission ) ); + + // + System::Net::NetworkInformation::NetworkInformationPermission^ intersectPermission = dynamic_cast(read->Intersect( unrestricted )); + + // + // + System::Net::NetworkInformation::NetworkInformationPermission^ permission = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::None ); + permission->AddPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read ); + Console::WriteLine( L"Access is {0}", permission->Access ); + + // +} + +int main() +{ + CreatePermission(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp b/snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp new file mode 100644 index 00000000000..813df811c21 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclPingAsync/CPP/asyncping.cpp @@ -0,0 +1,115 @@ + + +//NCLPingAsync +// +#using + +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::NetworkInformation; +using namespace System::ComponentModel; +using namespace System::Threading; +void PingCompletedCallback( Object^ sender, PingCompletedEventArgs^ e ); +void DisplayReply( PingReply^ reply ); +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length == 1 ) + throw gcnew ArgumentException( "Ping needs a host or IP Address." ); + + String^ who = args[ 1 ]; + AutoResetEvent^ waiter = gcnew AutoResetEvent( false ); + + // + Ping ^ pingSender = gcnew Ping; + + // When the PingCompleted event is raised, + // the PingCompletedCallback method is called. + pingSender->PingCompleted += gcnew PingCompletedEventHandler( PingCompletedCallback ); + + // + // Create a buffer of 32 bytes of data to be transmitted. + String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + array^buffer = Encoding::ASCII->GetBytes( data ); + + // Wait 12 seconds for a reply. + int timeout = 12000; + + // + // Set options for transmission: + // The data can go through 64 gateways or routers + // before it is destroyed, and the data packet + // cannot be fragmented. + PingOptions ^ options = gcnew PingOptions( 64,true ); + Console::WriteLine( "Time to live: {0}", options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", options->DontFragment ); + + // + // Send the ping asynchronously. + // Use the waiter as the user token. + // When the callback completes, it can wake up this thread. + pingSender->SendAsync( who, timeout, buffer, options, waiter ); + + // Prevent this example application from ending. + // A real application should do something useful + // when possible. + waiter->WaitOne(); + Console::WriteLine( "Ping example completed." ); +} + + +// +void PingCompletedCallback( Object^ /*sender*/, PingCompletedEventArgs^ e ) +{ + + // If the operation was canceled, display a message to the user. + if ( e->Cancelled ) + { + Console::WriteLine( "Ping canceled." ); + + // Let the main thread resume. + // UserToken is the AutoResetEvent object that the main thread + // is waiting for. + (dynamic_cast(e->UserState))->Set(); + } + + + // If an error occurred, display the exception to the user. + if ( e->Error != nullptr ) + { + Console::WriteLine( "Ping failed:" ); + Console::WriteLine( e->Error->ToString() ); + + // Let the main thread resume. + (dynamic_cast(e->UserState))->Set(); + } + + PingReply ^ reply = e->Reply; + DisplayReply( reply ); + + // Let the main thread resume. + (dynamic_cast(e->UserState))->Set(); +} + + +// +// +void DisplayReply( PingReply ^ reply ) +{ + if ( reply == nullptr ) + return; + + Console::WriteLine( "ping status: {0}", reply->Status ); + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp b/snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp new file mode 100644 index 00000000000..49704c6adde --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclPingSync/CPP/syncping.cpp @@ -0,0 +1,48 @@ + + +//NCLPingSync +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::NetworkInformation; +using namespace System::Text; + +// args[1] can be an IPaddress or host name. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // + // + Ping ^ pingSender = gcnew Ping; + PingOptions ^ options = gcnew PingOptions; + + // Use the default Ttl value which is 128, + // but change the fragmentation behavior. + options->DontFragment = true; + + // + // Create a buffer of 32 bytes of data to be transmitted. + String^ data = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + array^buffer = Encoding::ASCII->GetBytes( data ); + int timeout = 120; + PingReply ^ reply = pingSender->Send( args[ 1 ], timeout, buffer, options ); + + // + // + if ( reply->Status == IPStatus::Success ) + { + Console::WriteLine( "Address: {0}", reply->Address->ToString() ); + Console::WriteLine( "RoundTrip time: {0}", reply->RoundtripTime ); + Console::WriteLine( "Time to live: {0}", reply->Options->Ttl ); + Console::WriteLine( "Don't fragment: {0}", reply->Options->DontFragment ); + Console::WriteLine( "Buffer size: {0}", reply->Buffer->Length ); + } + + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp new file mode 100644 index 00000000000..a1c1e3ff508 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclSslClientAsync/CPP/NclSslClientAsync.cpp @@ -0,0 +1,337 @@ + +// NclSslClientAsync +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::Net::Sockets; +using namespace System::Security::Authentication; +using namespace System::Text; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; + +// The following example demonstrates the client side of a +// client-server application that communicates using the +// SslStream and TcpClient classes. +// After connecting to the server and authenticating, +// the client sends the server a message, receives a message from the server, +// and then terminates. Messages sent to and from the server are terminated +// with ''. +public ref class SslTcpClient +{ +private: + + // certificateErrors holds the mapping of Win32 results to descriptive strings. + // It is used by the CertificateErrorDescription method. + static Hashtable^ certificateErrors = gcnew Hashtable; + + // complete is used to terminate the application when all + // asynchronous calls have completed or any call has thrown an exception. + // complete might be used by any of the callback methods. + static bool complete = false; + + // e stores any exception thrown by an asynchronous method so that + // the mail application thread can display the exception and terminate gracefully. + // e might be used by any of the callback methods. + static Exception^ e = nullptr; + + // + // readData and buffer holds the data read from the server. + // They is used by the ReadCallback method. + static StringBuilder^ readData = gcnew StringBuilder; + static array^buffer = gcnew array(2048); + + // + // + // Load a table of errors that might cause the certificate authentication to fail. + static void InitializeCertificateErrors() + { + certificateErrors->Add( 0x800B0101, L"The certification has expired." ); + certificateErrors->Add( 0x800B0104, L"A path length constraint in the certification chain has been violated." ); + certificateErrors->Add( 0x800B0105, L"A certificate contains an unknown extension that is marked critical." ); + certificateErrors->Add( 0x800B0107, L"A parent of a given certificate in fact did not issue that child certificate." ); + certificateErrors->Add( 0x800B0108, L"A certificate is missing or has an empty value for a necessary field." ); + certificateErrors->Add( 0x800B0109, L"The certificate root is not trusted." ); + certificateErrors->Add( 0x800B010C, L"The certificate has been revoked." ); + certificateErrors->Add( 0x800B010F, L"The name in the certificate does not not match the host name requested by the client." ); + certificateErrors->Add( 0x800B0111, L"The certificate was explicitly marked as untrusted by the user." ); + certificateErrors->Add( 0x800B0112, L"A certification chain processed correctly, but one of the CA certificates is not trusted." ); + certificateErrors->Add( 0x800B0113, L"The certificate has an invalid policy." ); + certificateErrors->Add( 0x800B0114, L"The certificate name is either not in the permitted list or is explicitly excluded." ); + certificateErrors->Add( 0x80092012, L"The revocation function was unable to check revocation for the certificate." ); + certificateErrors->Add( 0x80090327, L"An unknown error occurred while processing the certificate." ); + certificateErrors->Add( 0x80096001, L"A system-level error occurred while verifying trust." ); + certificateErrors->Add( 0x80096002, L"The certificate for the signer of the message is invalid or not found." ); + certificateErrors->Add( 0x80096003, L"One of the counter signatures was invalid." ); + certificateErrors->Add( 0x80096004, L"The signature of the certificate cannot be verified." ); + certificateErrors->Add( 0x80096005, L"The time stamp signature or certificate could not be verified or is malformed." ); + certificateErrors->Add( 0x80096010, L"The digital signature of the object was not verified." ); + certificateErrors->Add( 0x80096019, L"The basic constraint extension of a certificate has not been observed." ); + } + + static String^ CertificateErrorDescription( int problem ) + { + + // Initialize the error message dictionary if it is not yet available. + if ( certificateErrors->Count == 0 ) + { + InitializeCertificateErrors(); + } + + String^ description = dynamic_cast(certificateErrors[ problem ]); + if ( description == nullptr ) + { + description = String::Format( L"Unknown certificate error - 0x{0:x8}", problem ); + } + + return description; + } + + +public: + + // The following method is invoked by the CertificateValidationDelegate. + static bool ValidateServerCertificate( + Object^ sender, + X509Certificate^ certificate, + X509Chain^ chain, + SslPolicyErrors sslPolicyErrors) + { + + Console::WriteLine("Validating the server certificate."); + if (sslPolicyErrors == SslPolicyErrors::None) + return true; + + Console::WriteLine("Certificate error: {0}", sslPolicyErrors); + + // Do not allow this client to communicate with unauthenticated servers. + return false; + } + + // + // + static X509Certificate^ SelectLocalCertificate( + Object^ sender, + String^ targetHost, + X509CertificateCollection^ localCertificates, + X509Certificate^ remoteCertificate, + array^ acceptableIssuers + ) + { + Console::WriteLine("Client is selecting a local certificate."); + if (acceptableIssuers != nullptr && + acceptableIssuers->Length > 0 && + localCertificates != nullptr && + localCertificates->Count > 0) + { + // Use the first certificate that is from an acceptable issuer. + IEnumerator^ myEnum1 = localCertificates->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + X509Certificate^ certificate = safe_cast(myEnum1->Current); + String^ issuer = certificate->Issuer; + if ( Array::IndexOf( acceptableIssuers, issuer ) != -1 ) + return certificate; + } + } + if (localCertificates != nullptr && + localCertificates->Count > 0) + return localCertificates[0]; + + return nullptr; + } + + // + // + static void AuthenticateCallback( IAsyncResult^ ar ) + { + SslStream^ stream = dynamic_cast(ar->AsyncState); + try + { + stream->EndAuthenticateAsClient( ar ); + Console::WriteLine( L"Authentication succeeded." ); + Console::WriteLine( L"Cipher: {0} strength {1}", stream->CipherAlgorithm, stream->CipherStrength ); + Console::WriteLine( L"Hash: {0} strength {1}", stream->HashAlgorithm, stream->HashStrength ); + Console::WriteLine( L"Key exchange: {0} strength {1}", stream->KeyExchangeAlgorithm, stream->KeyExchangeStrength ); + Console::WriteLine( L"Protocol: {0}", stream->SslProtocol ); + + // Encode a test message into a byte array. + // Signal the end of the message using the "". + array^message = Encoding::UTF8->GetBytes( L"Hello from the client." ); + + // Asynchronously send a message to the server. + stream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( WriteCallback ), stream ); + } + catch ( Exception^ authenticationException ) + { + e = authenticationException; + complete = true; + return; + } + + } + + + // + // + static void WriteCallback( IAsyncResult^ ar ) + { + SslStream^ stream = dynamic_cast(ar->AsyncState); + try + { + Console::WriteLine( L"Writing data to the server." ); + stream->EndWrite( ar ); + + // Asynchronously read a message from the server. + stream->BeginRead( buffer, 0, buffer->Length, gcnew AsyncCallback( ReadCallback ), stream ); + } + catch ( Exception^ writeException ) + { + e = writeException; + complete = true; + return; + } + + } + + + // + // + static void ReadCallback( IAsyncResult^ ar ) + { + + // Read the message sent by the server. + // The end of the message is signaled using the + // "" marker. + SslStream^ stream = dynamic_cast(ar->AsyncState); + int byteCount = -1; + try + { + Console::WriteLine( L"Reading data from the server." ); + byteCount = stream->EndRead( ar ); + + // Use Decoder class to convert from bytes to UTF8 + // in case a character spans two buffers. + Decoder^ decoder = Encoding::UTF8->GetDecoder(); + array^chars = gcnew array(decoder->GetCharCount( buffer, 0, byteCount )); + decoder->GetChars( buffer, 0, byteCount, chars, 0 ); + readData->Append( chars ); + + // Check for EOF or an empty message. + if ( readData->ToString()->IndexOf( L"" ) == -1 && byteCount != 0 ) + { + + // We are not finished reading. + // Asynchronously read more message data from the server. + stream->BeginRead( buffer, 0, buffer->Length, gcnew AsyncCallback( ReadCallback ), stream ); + } + else + { + Console::WriteLine( L"Message from the server: {0}", readData ); + } + } + catch ( Exception^ readException ) + { + e = readException; + complete = true; + return; + } + + complete = true; + } + + + // + // + int TestNclSslClient() + { + array^args = Environment::GetCommandLineArgs(); + String^ serverName = nullptr; + if ( args == nullptr || args->Length < 3 ) + { + Console::WriteLine( L"To start the client specify the host name and" + L" one or more client certificate file names." ); + return 1; + } + + + // + // Server name must match the host name and the name on the host's certificate. + serverName = args[ 1 ]; + + // Create a TCP/IP client socket. + TcpClient^ client = gcnew TcpClient( serverName,5000 ); + Console::WriteLine( L"Client connected." ); + + // Create an SSL stream that will close the client's stream. + SslStream^ sslStream = gcnew SslStream( + client->GetStream(), + false, + gcnew RemoteCertificateValidationCallback( ValidateServerCertificate ), + gcnew LocalCertificateSelectionCallback( SelectLocalCertificate ) ); + + // + // Create the certificate collection to hold the client's certificate. + X509CertificateCollection^ clientCertificates = gcnew X509CertificateCollection; + for ( int i = 2; i < args->Length; i++ ) + { + X509Certificate^ certificate = X509Certificate::CreateFromCertFile( args[ i ] ); + clientCertificates->Add( certificate ); + + } + + // The server name must match the name on the server certificate. + sslStream->BeginAuthenticateAsClient( + serverName, + clientCertificates, + SslProtocols::Ssl3, + true, + gcnew AsyncCallback( AuthenticateCallback ), + sslStream ); + + // User can press a key to exit application, or let the + // asynchronous calls continue until they complete. + Console::WriteLine( L"To quit, press the enter key." ); + do + { + + // Real world applications would do work here + // while waiting for the asynchronous calls to complete. + System::Threading::Thread::Sleep( 100 ); + } + while ( !complete && !Console::KeyAvailable ); + + if ( Console::KeyAvailable ) + { + Console::ReadLine(); + Console::WriteLine( L"Quitting." ); + client->Close(); + sslStream->Close(); + return 1; + } + + if ( e != nullptr ) + { + Console::WriteLine( L"An exception was thrown: {0}", e ); + } + + sslStream->Close(); + client->Close(); + Console::WriteLine( L"Good bye." ); + return 0; + } + + // +}; + + +// +int main() +{ + SslTcpClient^ stc = gcnew SslTcpClient; + stc->TestNclSslClient(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp new file mode 100644 index 00000000000..3287346e00c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclSslClientSync/CPP/clientsync.cpp @@ -0,0 +1,260 @@ +// NclSslClientSync +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Globalization; +using namespace System::Net; +using namespace System::Net::Security; +using namespace System::Net::Sockets; +using namespace System::Security::Authentication; +using namespace System::Text; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; + +namespace NlsClientSync +{ + public ref class SslTcpClient + { + private: + static Hashtable^ certificateErrors = gcnew Hashtable; + // + // Load a table of errors that might cause + // the certificate authentication to fail. + static void InitializeCertificateErrors() + { + certificateErrors->Add(0x800B0101, + "The certification has expired."); + certificateErrors->Add(0x800B0104, + "A path length constraint " + "in the certification chain has been violated."); + certificateErrors->Add(0x800B0105, + "A certificate contains an unknown extension " + "that is marked critical."); + certificateErrors->Add(0x800B0107, + "A parent of a given certificate in fact " + "did not issue that child certificate."); + certificateErrors->Add(0x800B0108, + "A certificate is missing or has an empty value " + "for a necessary field."); + certificateErrors->Add(0x800B0109, + "The certificate root is not trusted."); + certificateErrors->Add(0x800B010C, + "The certificate has been revoked."); + certificateErrors->Add(0x800B010F, + "The name in the certificate does not not match " + "the host name requested by the client."); + certificateErrors->Add(0x800B0111, + "The certificate was explicitly marked " + "as untrusted by the user."); + certificateErrors->Add(0x800B0112, + "A certification chain processed correctly, " + "but one of the CA certificates is not trusted."); + certificateErrors->Add(0x800B0113, + "The certificate has an invalid policy."); + certificateErrors->Add(0x800B0114, + "The certificate name is either not " + "in the permitted list or is explicitly excluded."); + certificateErrors->Add(0x80092012, + "The revocation function was unable to check " + "revocation for the certificate."); + certificateErrors->Add(0x80090327, + "An unknown error occurred while " + "processing the certificate."); + certificateErrors->Add(0x80096001, + "A system-level error occurred " + "while verifying trust."); + certificateErrors->Add(0x80096002, + "The certificate for the signer of the message " + "is invalid or not found."); + certificateErrors->Add(0x80096003, + "One of the counter signatures was invalid."); + certificateErrors->Add(0x80096004, + "The signature of the certificate " + "cannot be verified."); + certificateErrors->Add(0x80096005, + "The time stamp signature or certificate " + "could not be verified or is malformed."); + certificateErrors->Add(0x80096010, + "The digital signature of the object " + "was not verified."); + certificateErrors->Add(0x80096019, + "The basic constraint extension of a certificate " + "has not been observed."); + } + + static String^ CertificateErrorDescription(UInt32 problem) + { + // Initialize the error message dictionary + // if it is not yet available. + if (certificateErrors->Count == 0) + { + InitializeCertificateErrors(); + } + + String^ description = safe_cast( + certificateErrors[problem]); + if (description == nullptr) + { + description = String::Format( + CultureInfo::CurrentCulture, + "Unknown certificate error - 0x{0:x8}", + problem); + } + + return description; + } + + public: + // The following method is invoked + // by the CertificateValidationDelegate. + static bool ValidateServerCertificate( + Object^ sender, + X509Certificate^ certificate, + X509Chain^ chain, + SslPolicyErrors sslPolicyErrors) + { + + Console::WriteLine("Validating the server certificate."); + if (sslPolicyErrors == SslPolicyErrors::None) + return true; + + Console::WriteLine("Certificate error: {0}", sslPolicyErrors); + + // Do not allow this client to communicate with unauthenticated servers. + return false; + } + // + + // + static void RunClient(String^ machineName, String^ serverName) + { + + // + // + // Create a TCP/IP client socket. + // machineName is the host running the server application. + TcpClient^ client = gcnew TcpClient(machineName, 5000); + Console::WriteLine("Client connected."); + + // Create an SSL stream that will close + // the client's stream. + SslStream^ sslStream = gcnew SslStream( + client->GetStream(), false, + gcnew RemoteCertificateValidationCallback(ValidateServerCertificate), + nullptr); + + // The server name must match the name + // on the server certificate. + try + { + sslStream->AuthenticateAsClient(serverName); + } + catch (AuthenticationException^ ex) + { + Console::WriteLine("Exception: {0}", ex->Message); + if (ex->InnerException != nullptr) + { + Console::WriteLine("Inner exception: {0}", + ex->InnerException->Message); + } + + Console::WriteLine("Authentication failed - " + "closing the connection."); + sslStream->Close(); + client->Close(); + return; + } + // + // Encode a test message into a byte array. + // Signal the end of the message using the "". + array^ messsage = Encoding::UTF8->GetBytes( + "Hello from the client."); + + // Send hello message to the server. + sslStream->Write(messsage); + sslStream->Flush(); + // + // Read message from the server. + String^ serverMessage = ReadMessage(sslStream); + Console::WriteLine("Server says: {0}", serverMessage); + + // Close the client connection. + sslStream->Close(); + client->Close(); + Console::WriteLine("Client closed."); + } + // + // + private: + static String^ ReadMessage(SslStream^ sslStream) + { + + // Read the message sent by the server. + // The end of the message is signaled using the + // "" marker. + array^ buffer = gcnew array(2048); + StringBuilder^ messageData = gcnew StringBuilder; + // Use Decoder class to convert from bytes to UTF8 + // in case a character spans two buffers. + Encoding^ u8 = Encoding::UTF8; + Decoder^ decoder = u8->GetDecoder(); + + int bytes = -1; + do + { + bytes = sslStream->Read(buffer, 0, buffer->Length); + + array<__wchar_t>^ chars = gcnew array<__wchar_t>( + decoder->GetCharCount(buffer, 0, bytes)); + decoder->GetChars(buffer, 0, bytes, chars, 0); + messageData->Append(chars); + + // Check for EOF. + if (messageData->ToString()->IndexOf("") != -1) + { + break; + } + } + while (bytes != 0); + + return messageData->ToString(); + } + // + }; +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + String^ serverCertificateName = nullptr; + String^ machineName = nullptr; + if (args == nullptr || args->Length < 2) + { + Console::WriteLine("To start the client specify:"); + Console::WriteLine("clientSync machineName [serverName]"); + return 1; + } + + // User can specify the machine name and server name. + // Server name must match the name on + // the server's certificate. + machineName = args[1]; + if (args->Length < 3) + { + serverCertificateName = machineName; + } + else + { + serverCertificateName = args[2]; + }; + + NlsClientSync::SslTcpClient::RunClient(machineName, + serverCertificateName); + + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp new file mode 100644 index 00000000000..b49960ce769 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclSslServerAsync/CPP/NclSslServerAsync.cpp @@ -0,0 +1,265 @@ + +// NclSslServerAsync +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Net::Security; +using namespace System::Security::Authentication; +using namespace System::Text; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; + +// The following example demonstrates the server side of a +// client-server application that communicates using the +// SslStream, TcpListener, and TcpClient classes. +// After connecting to the server and authenticating, +// the server reads a message from the client, +// sends a message to the client, +// and then terminates. Messages sent to and from the client are terminated +// with ''. +// The ClientState class holds information shared +// by asynchronous calls. +// +public ref class ClientState +{ +internal: + SslStream^ stream; + TcpClient^ client; + StringBuilder^ readData; + array^buffer; + ClientState( SslStream^ stream, TcpClient^ client ) + { + this->stream = stream; + this->client = client; + readData = gcnew StringBuilder; + buffer = gcnew array(2048); + } + + void Close() + { + + // Close the SslStream. This will also close the + // NetworkStream allocated to the TcpClient. + stream->Close(); + + // Close the TcpClient. + client->Close(); + readData = nullptr; + buffer = nullptr; + Console::WriteLine( L"Client closed." ); + } + +}; + + +// +public ref class SslTcpListener +{ +public: + + // + // The following method is invoked by the CertificateValidationDelegate. + static bool ValidateCertificate( + Object^ sender, + X509Certificate^ certificate, + X509Chain^ chain, + SslPolicyErrors sslPolicyErrors) + { + if ( certificate == nullptr ) + { + + // Null certificate and no errors means that the client was not + // required to provide a certificate. + if ( sslPolicyErrors == SslPolicyErrors::None) + { + return true; + } + else + { + Console::WriteLine(L"Certificate error: {0}", sslPolicyErrors); + } + return false; + } + + Console::WriteLine( L"Server is validating certificate." ); + Console::WriteLine( L"Certificate was issued to {0} and is valid from {1} until {2}.", + certificate->Subject, + certificate->GetEffectiveDateString(), + certificate->GetExpirationDateString() ); + return true; + } + + + // + // + void AuthenticateCallback( IAsyncResult^ ar ) + { + ClientState^ state = dynamic_cast(ar->AsyncState); + SslStream^ stream = state->stream; + try + { + stream->EndAuthenticateAsServer( ar ); + Console::WriteLine( L"Authentication succeeded." ); + Console::WriteLine( L"Cipher: {0} strength {1}", stream->CipherAlgorithm, stream->CipherStrength ); + Console::WriteLine( L"Hash: {0} strength {1}", stream->HashAlgorithm, stream->HashStrength ); + Console::WriteLine( L"Key exchange: {0} strength {1}", stream->KeyExchangeAlgorithm, stream->KeyExchangeStrength ); + Console::WriteLine( L"Protocol: {0}", stream->SslProtocol ); + + // Asynchronously read a message from the client. + stream->BeginRead( state->buffer, 0, state->buffer->Length, gcnew AsyncCallback( this, &SslTcpListener::ReadCallback ), state ); + } + catch ( Exception^ authenticationException ) + { + Console::WriteLine( L"Authentication error: {0}", authenticationException->Message ); + if ( authenticationException->InnerException != nullptr ) + { + Console::WriteLine( L" Inner exception: {0}", authenticationException->InnerException->Message ); + } + state->Close(); + return; + } + + } + + + // + // + void WriteCallback( IAsyncResult^ ar ) + { + ClientState^ state = dynamic_cast(ar->AsyncState); + SslStream^ stream = state->stream; + try + { + Console::WriteLine( L"Writing data to the client." ); + stream->EndWrite( ar ); + } + catch ( Exception^ writeException ) + { + Console::WriteLine( L"Write error: {0}", writeException->Message ); + state->Close(); + return; + } + + Console::WriteLine( L"Finished with client." ); + state->Close(); + } + + + // + // + void ReadCallback( IAsyncResult^ ar ) + { + ClientState^ state = dynamic_cast(ar->AsyncState); + SslStream^ stream = state->stream; + + // Read the message sent by the client. + // The end of the message is signaled using the + // "" marker. + int byteCount = -1; + try + { + Console::WriteLine( L"Reading data from the client." ); + byteCount = stream->EndRead( ar ); + + // Use Decoder class to convert from bytes to UTF8 + // in case a character spans two buffers. + Decoder^ decoder = Encoding::UTF8->GetDecoder(); + array^chars = gcnew array(decoder->GetCharCount( state->buffer, 0, byteCount )); + decoder->GetChars( state->buffer, 0, byteCount, chars, 0 ); + state->readData->Append( chars ); + + // Check for EOF or an empty message. + if ( state->readData->ToString()->IndexOf( L"" ) == -1 && byteCount != 0 ) + { + + // We are not finished reading. + // Asynchronously read more message data from the client. + stream->BeginRead( state->buffer, 0, state->buffer->Length, gcnew AsyncCallback( this, &SslTcpListener::ReadCallback ), state ); + } + else + { + Console::WriteLine( L"Message from the client: {0}", state->readData ); + } + + // Encode a test message into a byte array. + // Signal the end of the message using "". + array^message = Encoding::UTF8->GetBytes( L"Hello from the server." ); + + // Asynchronously send the message to the client. + stream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( this, &SslTcpListener::WriteCallback ), state ); + } + catch ( Exception^ readException ) + { + Console::WriteLine( L"Read error: {0}", readException->Message ); + state->Close(); + return; + } + + } + + + // + // + void ProcessClient( ClientState^ state, X509Certificate^ serverCertificate ) + { + try + { + state->stream->BeginAuthenticateAsServer( + serverCertificate, true, SslProtocols::Tls, true, + gcnew AsyncCallback( this, &SslTcpListener::AuthenticateCallback ), state ); + } + catch ( Exception^ authenticationException ) + { + Console::WriteLine( L"Authentication error: {0}", authenticationException->Message ); + state->Close(); + return; + } + + } + + + // + // + int ServerSideTest() + { + array^args = Environment::GetCommandLineArgs(); + if ( args == nullptr || args->Length == 0 ) + { + Console::WriteLine( L"You must specify the server certificate file." ); + return 0; + } + + X509Certificate^ serverCertificate = X509Certificate::CreateFromCertFile( args[ 1 ] ); + + // Create a TCP/IP (IPv4) socket and listen for incoming connections. + TcpListener^ listener = gcnew TcpListener( IPAddress::Any,5000 ); + listener->Start(); + while ( true ) + { + + // Application blocks while waiting for an incoming connection. + // Type CNTL-C to terminate the server. + TcpClient^ client = listener->AcceptTcpClient(); + Console::WriteLine( L"Client connected." ); + SslStream^ stream = gcnew SslStream( client->GetStream(),false, + gcnew RemoteCertificateValidationCallback( ValidateCertificate ) ); + ClientState^ state = gcnew ClientState( stream,client ); + SslTcpListener^ listenerWorker = gcnew SslTcpListener; + listenerWorker->ProcessClient( state, serverCertificate ); + } + } + + // +}; + +int main() +{ + SslTcpListener^ stl = gcnew SslTcpListener; + stl->ServerSideTest(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp b/snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp new file mode 100644 index 00000000000..1a659c12fe2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclSslServerSync/CPP/NclSslServerSync.cpp @@ -0,0 +1,235 @@ + +// NclSslServerSync +// +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Net::Security; +using namespace System::Security::Authentication; +using namespace System::Text; +using namespace System::Security::Cryptography::X509Certificates; +using namespace System::IO; +public ref class SslTcpServer sealed +{ +private: + static X509Certificate^ serverCertificate = nullptr; + +public: + + // The certificate parameter specifies the name of the file + // containing the machine certificate. + static void RunServer( String^ certificate ) + { + serverCertificate = X509Certificate::CreateFromCertFile( certificate ); + + // Create a TCP/IP (IPv4) socket and listen for incoming connections. + TcpListener^ listener = gcnew TcpListener( IPAddress::Any,5000 ); + listener->Start(); + + while (true) + { + Console::WriteLine( L"Waiting for a client to connect..." ); + + // Application blocks while waiting for an incoming connection. + // Type CNTL-C to terminate the server. + TcpClient^ client = listener->AcceptTcpClient(); + ProcessClient( client ); + + } + } + + + // + static void ProcessClient( TcpClient^ client ) + { + + // A client has connected. Create the + // SslStream using the client's network stream. + SslStream^ sslStream = gcnew SslStream( client->GetStream(),false ); + + // Authenticate the server but don't require the client to authenticate. + try + { + sslStream->AuthenticateAsServer( serverCertificate, false, true ); + // false == no client cert required; true == check cert revocation. + + // Display the properties and settings for the authenticated stream. + DisplaySecurityLevel( sslStream ); + DisplaySecurityServices( sslStream ); + DisplayCertificateInformation( sslStream ); + DisplayStreamProperties( sslStream ); + + // Set timeouts for the read and write to 5 seconds. + sslStream->ReadTimeout = 5000; + sslStream->WriteTimeout = 5000; + + // Read a message from the client. + Console::WriteLine( L"Waiting for client message..." ); + String^ messageData = ReadMessage( sslStream ); + Console::WriteLine( L"Received: {0}", messageData ); + + // Write a message to the client. + array^message = Encoding::UTF8->GetBytes( L"Hello from the server." ); + Console::WriteLine( L"Sending hello message." ); + sslStream->Write( message ); + } + catch ( AuthenticationException^ e ) + { + Console::WriteLine( L"Exception: {0}", e->Message ); + if ( e->InnerException != nullptr ) + { + Console::WriteLine( L"Inner exception: {0}", e->InnerException->Message ); + } + Console::WriteLine( L"Authentication failed - closing the connection." ); + sslStream->Close(); + client->Close(); + return; + } + finally + { + + // The client stream will be closed with the sslStream + // because we specified this behavior when creating + // the sslStream. + sslStream->Close(); + client->Close(); + } + + } + + + // + // + static String^ ReadMessage( SslStream^ sslStream ) + { + + // Read the message sent by the client. + // The client signals the end of the message using the + // "" marker. + array^buffer = gcnew array(2048); + StringBuilder^ messageData = gcnew StringBuilder; + int bytes = -1; + do + { + + // Read the client's test message. + bytes = sslStream->Read( buffer, 0, buffer->Length ); + + // Use Decoder class to convert from bytes to UTF8 + // in case a character spans two buffers. + Decoder^ decoder = Encoding::UTF8->GetDecoder(); + array^chars = gcnew array(decoder->GetCharCount( buffer, 0, bytes )); + decoder->GetChars( buffer, 0, bytes, chars, 0 ); + messageData->Append( chars ); + + // Check for EOF or an empty message. + if ( messageData->ToString()->IndexOf( L"" ) != -1 ) + { + break; + } + } + while ( bytes != 0 ); + + return messageData->ToString(); + } + + + // + // + static void DisplaySecurityLevel( SslStream^ stream ) + { + Console::WriteLine( L"Cipher: {0} strength {1}", stream->CipherAlgorithm, stream->CipherStrength ); + Console::WriteLine( L"Hash: {0} strength {1}", stream->HashAlgorithm, stream->HashStrength ); + Console::WriteLine( L"Key exchange: {0} strength {1}", stream->KeyExchangeAlgorithm, stream->KeyExchangeStrength ); + Console::WriteLine( L"Protocol: {0}", stream->SslProtocol ); + } + + + // + // + static void DisplaySecurityServices( SslStream^ stream ) + { + Console::WriteLine( L"Is authenticated: {0} as server? {1}", stream->IsAuthenticated, stream->IsServer ); + Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); + Console::WriteLine( L"Is Encrypted: {0}", stream->IsEncrypted ); + Console::WriteLine( L"Is mutually authenticated: {0}", stream->IsMutuallyAuthenticated ); + } + + + // + // + static void DisplayStreamProperties( SslStream^ stream ) + { + Console::WriteLine( L"Can read: {0}, write {1}", stream->CanRead, stream->CanWrite ); + Console::WriteLine( L"Can timeout: {0}", stream->CanTimeout ); + } + + + // + // + static void DisplayCertificateInformation( SslStream^ stream ) + { + Console::WriteLine( L"Certificate revocation list checked: {0}", stream->CheckCertRevocationStatus ); + X509Certificate^ localCertificate = stream->LocalCertificate; + if ( stream->LocalCertificate != nullptr ) + { + Console::WriteLine( L"Local cert was issued to {0} and is valid from {1} until {2}.", + localCertificate->Subject, + localCertificate->GetEffectiveDateString(), + localCertificate->GetExpirationDateString() ); + } + else + { + Console::WriteLine( L"Local certificate is null." ); + } + + X509Certificate^ remoteCertificate = stream->RemoteCertificate; + if ( stream->RemoteCertificate != nullptr ) + { + Console::WriteLine( L"Remote cert was issued to {0} and is valid from {1} until {2}.", + remoteCertificate->Subject, + remoteCertificate->GetEffectiveDateString(), + remoteCertificate->GetExpirationDateString() ); + } + else + { + Console::WriteLine( L"Remote certificate is null." ); + } + } + + +private: + + // + static void DisplayUsage() + { + Console::WriteLine( L"To start the server specify:" ); + Console::WriteLine( L"serverSync certificateFile.cer" ); + Environment::Exit( 1 ); + } + +public: + int RunServerASync() + { + array^args = Environment::GetCommandLineArgs(); + String^ certificate = nullptr; + if ( args == nullptr || args->Length < 2 ) + { + DisplayUsage(); + } + + certificate = args[ 1 ]; + SslTcpServer::RunServer( certificate ); + return 0; + } + +}; + +int main(){ + SslTcpServer^ sts = gcnew SslTcpServer(); + sts->RunServerASync(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp b/snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp new file mode 100644 index 00000000000..1cf6a399da6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NclTcpServerSync/cpp/tcplistener.cpp @@ -0,0 +1,39 @@ +// +#using +using namespace System; +using namespace System::Text; +using namespace System::Net; +using namespace System::Net::Sockets; + +int main() +{ + // Create the server side connection and + // start listening for clients. + TcpListener^ tcpListener = gcnew TcpListener(IPAddress::Any, 11000); + tcpListener->Start(); + Console::WriteLine("Waiting for a connection...."); + + // Accept the pending client connection. + TcpClient^ tcpClient = tcpListener->AcceptTcpClient(); + Console::WriteLine("Connection accepted."); + // Get the stream to write the message + // that will be sent to the client. + NetworkStream^ networkStream = tcpClient->GetStream(); + String^ responseString = "Hello."; + // Set the write timeout to 10 millseconds. + networkStream->WriteTimeout = 10; + // Convert the message to a byte array and sent it to the client. + array^ sendBytes = Encoding::UTF8->GetBytes(responseString); + networkStream->Write(sendBytes, 0, sendBytes->Length); + Console::WriteLine("Message Sent."); + // Close the connection to the client. + tcpClient->Close(); + // Stop listening for incoming connections + // and close the server. + tcpListener->Stop(); + + // Dispose allocated resources. + delete networkStream; + delete tcpClient; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp b/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp new file mode 100644 index 00000000000..1418ec5d414 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NestingLevel/cpp/nestinglevel.cpp @@ -0,0 +1,43 @@ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::IO; + +public ref class Forest +{ + // Set the NestingLevel for each array. The first + // attribute (NestingLevel = 0) is optional. +public: + [XmlArrayItem(ElementName = "tree", NestingLevel = 0)] + [XmlArrayItem(ElementName = "branch", NestingLevel = 1)] + [XmlArrayItem(ElementName = "leaf",NestingLevel = 2)] + array^>^>^ TreeArray; +}; + +int main() +{ + XmlSerializer^ serializer = gcnew XmlSerializer(Forest::typeid); + + Forest^ constructedForest = gcnew Forest(); + array^>^>^ tree = + gcnew array^>^>(2); + + array^>^ firstBranch = gcnew array^>(1); + firstBranch[0] = gcnew array{"One"}; + tree[0] = firstBranch; + + array^>^ secondBranch = gcnew array^>(2); + secondBranch[0] = gcnew array{"One","Two"}; + secondBranch[1] = gcnew array{"One","Two","Three"}; + tree[1] = secondBranch; + + constructedForest->TreeArray = tree; + + serializer->Serialize(Console::Out, constructedForest); +} + +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp new file mode 100644 index 00000000000..91eb1c27dd6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_Constructor2/CPP/networkcredential_constructor2.cpp @@ -0,0 +1,67 @@ +// System::Net::NetworkCredential::NetworkCredential(String*, String*) + +/*This program demontrates the 'NetworkCredential(String*, String*)' constructor of 'NetworkCredential' class. +It takes an URL, username, password and domainname from console and forms a 'NetworkCredential' Object* with +these arguments.Then a 'WebRequest' Object* is created and the 'NetworkCredential' Object* is associated with +it.A message is displayed onto the console on successful reception of response otherwise an exception is thrown. +*/ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url, String^ username, String^ passwd, String^ domain ) +{ + try + { +// + // Call the onstructor to create an instance of NetworkCredential with the + // specified user name and password. + NetworkCredential^ myCredentials = gcnew NetworkCredential( username,passwd ); + + // Create a WebRequest with the specified URL. + WebRequest^ myWebRequest = WebRequest::Create( url ); + myCredentials->Domain = domain; + myWebRequest->Credentials = myCredentials; + Console::WriteLine( "\n\nCredentials Domain : {0} , UserName : {1} , Password : {2}", + myCredentials->Domain, myCredentials->UserName, myCredentials->Password ); + Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response..." ); + + // Send the request and wait for a response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Process the response. + Console::WriteLine( "\nResponse received successfully." ); + + // Release the resources of the response object. + myWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException is raised. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 5 ) + { + Console::WriteLine( "\nPlease enter a protected resource Url and other details as command line parameter as below:" ); + Console::WriteLine( "\nUsage: NetworkCredential_Constructor2 URLname username password domainname" ); + Console::WriteLine( "\nExample: NetworkCredential_Constructor2 http://www.microsoft.com/net/ george george123 microsoft" ); + } + else + { + GetPage( args[ 1 ], args[ 2 ], args[ 3 ], args[ 4 ] ); + } + + Console::WriteLine( "\n\nPress 'Enter key' to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp new file mode 100644 index 00000000000..4f1b295b678 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_GetCredential/CPP/networkcredential_getcredential.cpp @@ -0,0 +1,68 @@ + + +// System::Net::NetworkCredential::GetCredential +/*This program demontrates the 'GetCredential' of 'NetworkCredential' class. +It accepts an URL, username and password from console. Creates a 'NetworkCredential' Object* +using these parameters. A 'WebRequest' Object* is created to access the Uri S"http://www.microsoft.com" +and the 'NetworkCredential' Object* is assigned as it's Credentials. +A message is displayed onto the console on successful reception of response +otherwise an exception is thrown. +*/ + +#using + +using namespace System; +using namespace System::Net; + +void GetPage( String^ url, String^ userName, String^ password ) +{ + try + { +// + // Create an empty instance of the NetworkCredential class. + NetworkCredential^ myCredentials = gcnew NetworkCredential( userName,password ); + + // Create a webrequest with the specified URL. + WebRequest^ myWebRequest = WebRequest::Create( url ); + myWebRequest->Credentials = myCredentials->GetCredential( gcnew Uri( url ), "" ); + Console::WriteLine( "\n\nUser Credentials:- UserName : {0} , Password : {1}", + myCredentials->UserName, myCredentials->Password ); + + // Send the request and wait for a response. + Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response...Please wait ..." ); + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Process the response. + Console::WriteLine( "\nResponse received successfully" ); + + // Release the resources of the response object. + myWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException is raised. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 4 ) + { + Console::WriteLine( "\nPlease enter a protected resource Url and other details as* command line parameter as below:" ); + Console::WriteLine( "\nUsage: NetworkCredential_GetCredential URLname username password" ); + Console::WriteLine( "\nExample: NetworkCredential_GetCredential http://www.microsoft.com/net/ george george123" ); + } + else + { + GetPage( args[ 1 ], args[ 2 ], args[ 3 ] ); + } + + Console::WriteLine( "\n\nPress 'Enter' to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp new file mode 100644 index 00000000000..73e255c77fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NetworkCredential_UserName_Password_Domain/CPP/networkcredential_username_password_domain.cpp @@ -0,0 +1,74 @@ + + +// System::Net::NetworkCredential::Username;System::Net::NetworkCredential::Domain;System::Net::NetworkCredential::Password +/*This program demontrates the 'UserName', 'Domain', and 'Password' properties of the 'NetworkCredential' class. +It takes an URL, username, password, and domain name from console. An empty 'NetworkCredential' Object* +is created. The 'UserName', 'Password', and 'Domain' porperties of the 'NetworkCredential' class are initialized +with the respective values taken from console. Then a 'WebRequest' Object* is created and the 'NetworkCredential' +Object* is associated with it. A message is displayed onto the console on successful reception of response +otherwise an exception is thrown. +*/ + +#using + +using namespace System; +using namespace System::Net; +void GetPage( String^ url, String^ username, String^ passwd, String^ domain ) +{ + try + { +// +// +// + // Create an empty instance of the NetworkCredential class. + NetworkCredential^ myCredentials = gcnew NetworkCredential( "","","" ); + myCredentials->Domain = domain; + myCredentials->UserName = username; + myCredentials->Password = passwd; + + // Create a WebRequest with the specified URL. + WebRequest^ myWebRequest = WebRequest::Create( url ); + myWebRequest->Credentials = myCredentials; + Console::WriteLine( "\n\nUser Credentials:- Domain : {0} , UserName : {1} , Password : {2}", + myCredentials->Domain, myCredentials->UserName, myCredentials->Password ); + + // Send the request and wait for a response. + Console::WriteLine( "\n\nRequest to Url is sent.Waiting for response...Please wait ..." ); + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Process the response. + Console::WriteLine( "\nResponse received successfully" ); + + // Release the resources of the response object. + myWebResponse->Close(); +// +// +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException is raised. The Reason for failure is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following exception was raised : {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 5 ) + { + Console::WriteLine( "\nPlease enter a protected resource Url and other details as command line parameter as below:" ); + Console::WriteLine( "\nUsage: NetworkCredential_UserName_Password_Domain URLname username password domainname" ); + Console::WriteLine( "\nExample: NetworkCredential_UserName_Password_Domain http://www.microsoft.com/net/ george george123 microsoft" ); + } + else + { + GetPage( args[ 1 ], args[ 2 ], args[ 3 ], args[ 4 ] ); + } + + Console::WriteLine( "\n\nPress 'Enter key' to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp new file mode 100644 index 00000000000..17f565e5d3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Protected_Members/CPP/source.cpp @@ -0,0 +1,51 @@ +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +ref class MyNetworkStream_Sub_Class: public NetworkStream +{ +public: + MyNetworkStream_Sub_Class( System::Net::Sockets::Socket^ socket, bool ownsSocket ) + : NetworkStream( socket, ownsSocket ) + { + } + + property bool IsConnected + { + // You can use the Socket method to examine the underlying Socket. + bool get() + { + return this->Socket->Connected; + } + } + + property bool CanCommunicate + { + bool get() + { + if ( !this->Readable | !this->Writeable ) + { + return false; + } + else + { + return true; + } + } + } +// + + static void DoSomethingSignificant() + { + // Do something significant in here + } + +}; + +int main() +{ + MyNetworkStream_Sub_Class::DoSomethingSignificant(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp new file mode 100644 index 00000000000..24eb36c07d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/NetworkStream_Synch_SendAndReceive/CPP/source.cpp @@ -0,0 +1,108 @@ +// The following sample is intended to demonstrate how to use a +//NetworkStream for synchronous communcation with a remote host +//This class uses several NetworkStream members that would be useful +// in a synchronous communciation senario + +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; + +void MySample( bool networkStreamOwnsSocket ) +{ + // Create a socket and connect with a remote host. + IPHostEntry^ myIpHostEntry = Dns::GetHostEntry( "www.contoso.com" ); + IPEndPoint^ myIpEndPoint = gcnew IPEndPoint( myIpHostEntry->AddressList[ 0 ],1001 ); + + Socket^ mySocket = gcnew Socket( myIpEndPoint->Address->AddressFamily, + SocketType::Stream, + ProtocolType::Tcp ); + try + { + mySocket->Connect( myIpEndPoint ); + + NetworkStream^ myNetworkStream; + if ( networkStreamOwnsSocket ) + { + myNetworkStream = gcnew NetworkStream( mySocket,true ); + } + else + { + myNetworkStream = gcnew NetworkStream( mySocket ); + } + + // + // Examples for CanWrite, and CanWrite + // Check to see if this NetworkStream is writable. + if ( myNetworkStream->CanWrite ) + { + array^ myWriteBuffer = Encoding::ASCII->GetBytes( + "Are you receiving this message?" ); + myNetworkStream->Write( myWriteBuffer, 0, myWriteBuffer->Length ); + } + else + { + Console::WriteLine( "Sorry. You cannot write to this NetworkStream." ); + } + // + + // Examples for CanRead, Read, and DataAvailable. + // Check to see if this NetworkStream is readable. + if ( myNetworkStream->CanRead ) + { + array^ myReadBuffer = gcnew array(1024); + String^ myCompleteMessage = ""; + int numberOfBytesRead = 0; + + // Incoming message may be larger than the buffer size. + do + { + numberOfBytesRead = myNetworkStream->Read( myReadBuffer, 0, + myReadBuffer->Length ); + myCompleteMessage = String::Concat( myCompleteMessage, + Encoding::ASCII->GetString( myReadBuffer, 0, numberOfBytesRead ) ); + } + while ( myNetworkStream->DataAvailable ); + + // Print out the received message to the console. + Console::WriteLine( "You received the following message : {0}", + myCompleteMessage ); + } + else + { + Console::WriteLine( "Sorry. You cannot read from this NetworkStream." ); + } + + // + // Example for closing the NetworkStream. + // Close the NetworkStream + myNetworkStream->Close(); + // + + } + catch ( Exception^ exception ) + { + Console::WriteLine( "Exception Thrown: {0}", exception->ToString() ); + } +} + +int main( int argc, char *argv[] ) +{ + if ( "yes" == gcnew String(argv[1]) ) + { + MySample( true ); + } + else + if ( "no" == gcnew String(argv[1]) ) + { + MySample( false ); + } + else + { + Console::WriteLine( "Must use 'yes' to allow the NetworkStream to own the Socket or {0}", "\n 'no' to prohibit NetworkStream from owning the Socket." ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp b/snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp new file mode 100644 index 00000000000..6afe3a48d86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ObjectHandle/CPP/objecthandleassembly.cpp @@ -0,0 +1,48 @@ + +// +using namespace System; +using namespace System::Runtime::Remoting; +public ref class MyType: public MarshalByRefObject +{ +public: + MyType() + { + Console::Write( "Created an instance of MyType in an AppDomain with the " ); + Console::WriteLine( "hash code {0}", AppDomain::CurrentDomain->GetHashCode() ); + Console::WriteLine( "" ); + } + + int GetAppDomainHashCode() + { + return AppDomain::CurrentDomain->GetHashCode(); + } + +}; + +int main() +{ + Console::WriteLine( "The hash code of the default AppDomain is {0}.", AppDomain::CurrentDomain->GetHashCode() ); + Console::WriteLine( "" ); + + // Creates another AppDomain. + AppDomain^ domain = AppDomain::CreateDomain( "AnotherDomain", nullptr, (AppDomainSetup^)nullptr ); + + // + // Creates an instance of MyType defined in the assembly called ObjectHandleAssembly. + ObjectHandle^ obj = domain->CreateInstance( "ObjectHandleAssembly", "MyType" ); + + // Unwraps the proxy to the MyType object created in the other AppDomain. + MyType^ testObj = dynamic_cast(obj->Unwrap()); + if ( RemotingServices::IsTransparentProxy( testObj ) ) + Console::WriteLine( "The unwrapped object is a proxy." ); + else + Console::WriteLine( "The unwrapped object is not a proxy!" ); + + Console::WriteLine( "" ); + Console::Write( "Calling a method on the object located in an AppDomain with the hash code " ); + Console::WriteLine( testObj->GetAppDomainHashCode() ); + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp new file mode 100644 index 00000000000..73662f4cd66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationBindingCollection_OperationBindingCollection/CPP/operationbindingcollection_operationbindingcollection.cpp @@ -0,0 +1,134 @@ +// System.Web.Services.Description.OperationBindingCollection +// System.Web.Services.Description.OperationBindingCollection.Contains +// System.Web.Services.Description.OperationBindingCollection.Add +// System.Web.Services.Description.OperationBindingCollection.Item +// System.Web.Services.Description.OperationBindingCollection.Remove +// System.Web.Services.Description.OperationBindingCollection.Insert +// System.Web.Services.Description.OperationBindingCollection.IndexOf +// System.Web.Services.Description.OperationBindingCollection.CopyTo + +/* +The following example demonstrates the usage of the +'OperationBindingCollection' class, the 'Item' property and various methods of the +class. The input to the program is a WSDL file 'MathService_input_cpp.wsdl' without +the add operation binding of SOAP protocol. In this example the WSDL file +is modified to insert a new 'OperationBinding' for SOAP. The +'OperationBindingCollection' is populated based on WSDL document +structure defined in WSDL specification. The updated instance is then +written to 'MathService_new_cpp.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +int main() +{ + try + { + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cpp.wsdl" ); + + // Add the OperationBinding for the Add operation. + OperationBinding^ addOperationBinding = gcnew OperationBinding; + String^ addOperation = "Add"; + String^ myTargetNamespace = myServiceDescription->TargetNamespace; + addOperationBinding->Name = addOperation; + + // Add the InputBinding for the operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + addOperationBinding->Input = myInputBinding; + + // Add the OutputBinding for the operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + addOperationBinding->Output = myOutputBinding; + + // Add the extensibility element for the SoapOperationBinding. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation ); + addOperationBinding->Extensions->Add( mySoapOperationBinding ); + + // Get the BindingCollection from the ServiceDescription. + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + + // Get the OperationBindingCollection of SOAP binding from + // the BindingCollection. + OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations; + + // + // Check for the Add OperationBinding in the collection. + bool contains = myOperationBindingCollection->Contains( addOperationBinding ); + Console::WriteLine( "\nWhether the collection contains the Add OperationBinding : {0}", contains ); + // + + // + // Add the Add OperationBinding to the collection. + myOperationBindingCollection->Add( addOperationBinding ); + Console::WriteLine( "\nAdded the OperationBinding of the Add" + " operation to the collection." ); + // + + // + // + // Get the OperationBinding of the Add operation from the collection. + OperationBinding^ myOperationBinding = myOperationBindingCollection[ 3 ]; + + // Remove the OperationBinding of the Add operation from + // the collection. + myOperationBindingCollection->Remove( myOperationBinding ); + Console::WriteLine( "\nRemoved the OperationBinding of the " + "Add operation from the collection." ); + // + // + + // + // + // Insert the OperationBinding of the Add operation at index 0. + myOperationBindingCollection->Insert( 0, addOperationBinding ); + Console::WriteLine( "\nInserted the OperationBinding of the " + "Add operation in the collection." ); + + // Get the index of the OperationBinding of the Add + // operation from the collection. + int index = myOperationBindingCollection->IndexOf( addOperationBinding ); + Console::WriteLine( "\nThe index of the OperationBinding of the Add operation : {0}", index ); + // + // + + Console::WriteLine( "" ); + + // + array^operationBindingArray = + gcnew array(myOperationBindingCollection->Count); + + // Copy this collection to the OperationBinding array. + myOperationBindingCollection->CopyTo( operationBindingArray, 0 ); + Console::WriteLine( "The operations supported by this service " + "are :" ); + + for each(OperationBinding^ myOperationBinding1 in operationBindingArray) + { + Binding^ myBinding = myOperationBinding1->Binding; + Console::WriteLine(" Binding : "+ myBinding->Name + " Name of " + + "operation : " + myOperationBinding1->Name); + } + // + + // Save the ServiceDescription to an external file. + myServiceDescription->Write( "MathService_new_cpp.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp new file mode 100644 index 00000000000..275e1d9fc9a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationBinding_OperationBinding/CPP/operationbinding_operationbinding.cpp @@ -0,0 +1,127 @@ +// System.Web.Services.Description.OperationBinding +// System.Web.Services.Description.OperationBinding.OperationBinding +// System.Web.Services.Description.OperationBinding.Name +// System.Web.Services.Description.OperationBinding.Input +// System.Web.Services.Description.OperationBinding.Output +// System.Web.Services.Description.OperationBinding.Extensions +// System.Web.Services.Description.OperationBinding.Faults +// System.Web.Services.Description.OperationBinding.Binding + +/* +The following example demonstrates the usage of the 'OperationBinding' +class, the 'OperationBinding()' constructor, and various properties of the class. The +input to the program is a WSDL file 'MathService_input_cs.wsdl' without the +add operation binding for SOAP protocol. In the example, the WSDL file is modified to insert +a new 'OperationBinding' instance for SOAP. The 'OperationBinding' instance +is populated based on the WSDL document structure defined in the WSDL specification. The updated +instance is then written to 'MathService_new_cs.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" ); + String^ myTargetNamespace = myServiceDescription->TargetNamespace; + + // + // + // Create an OperationBinding for the Add operation. + OperationBinding^ addOperationBinding = gcnew OperationBinding; + String^ addOperation = "Add"; + addOperationBinding->Name = addOperation; + // + + // + // Create an InputBinding for the Add operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add the InputBinding to the OperationBinding. + addOperationBinding->Input = myInputBinding; + // + + // + // Create an OutputBinding for the Add operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add the OutputBinding to the OperationBinding. + addOperationBinding->Output = myOutputBinding; + // + + // + // Create an extensibility element for a SoapOperationBinding. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = String::Concat( myTargetNamespace, addOperation ); + + // Add the extensibility element SoapOperationBinding to + // the OperationBinding. + addOperationBinding->Extensions->Add( mySoapOperationBinding ); + // + // + + // + ServiceDescriptionFormatExtensionCollection^ myExtensions; + + // Get the FaultBindingCollection from the OperationBinding. + FaultBindingCollection^ myFaultBindingCollection = addOperationBinding->Faults; + FaultBinding^ myFaultBinding = gcnew FaultBinding; + myFaultBinding->Name = "ErrorFloat"; + + // Associate SOAP fault binding to the fault binding of the operation. + myExtensions = myFaultBinding->Extensions; + SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; + mySoapFaultBinding->Use = SoapBindingUse::Literal; + mySoapFaultBinding->Namespace = myTargetNamespace; + myExtensions->Add( mySoapFaultBinding ); + myFaultBindingCollection->Add( myFaultBinding ); + // + + // Get the BindingCollection from the ServiceDescription. + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + + // Get the OperationBindingCollection of SOAP binding + // from the BindingCollection. + OperationBindingCollection^ myOperationBindingCollection = myBindingCollection[ 0 ]->Operations; + myOperationBindingCollection->Add( addOperationBinding ); + Console::WriteLine( "The operations supported by this service are:" ); + System::Collections::IEnumerator^ myEnum = myOperationBindingCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + OperationBinding^ myOperationBinding = safe_cast(myEnum->Current); + + // + Binding^ myBinding = myOperationBinding->Binding; + Console::WriteLine( " Binding : {0} :: Name of operation : {1}", myBinding->Name, myOperationBinding->Name ); + // + + FaultBindingCollection^ myFaultBindingCollection1 = myOperationBinding->Faults; + System::Collections::IEnumerator^ myEnum1 = myFaultBindingCollection1->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + FaultBinding^ myFaultBinding1 = safe_cast(myEnum1->Current); + Console::WriteLine( " Fault : {0}", myFaultBinding1->Name ); + } + } + myServiceDescription->Write( "MathService_new_cs.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp new file mode 100644 index 00000000000..6dc493cb959 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationCollection_Methods/CPP/operationcollection_methods.cpp @@ -0,0 +1,92 @@ +// System.Web.Sevices.Description.OperationCollection +// System.Web.Sevices.Description.OperationCollection.Add +// System.Web.Sevices.Description.OperationCollection.Contains +// System.Web.Sevices.Description.OperationCollection.IndexOf +// System.Web.Sevices.Description.OperationCollection.Remove +// System.Web.Sevices.Description.OperationCollection.Insert +// System.Web.Sevices.Description.OperationCollection.Item +// System.Web.Sevices.Description.OperationCollection.CopyTo + +/* +The following example demonstrates the usage of the +'OperationCollection' class , its property 'Item' and its methods +'Add', 'Contains', 'CopyTo', 'IndexOf', 'Insert' and 'Remove'. +The input to the program is a WSDL file 'MathService_input_cs.wsdl'with +information related to the 'Add' operation for the SOAP protocol, +removed from it. It creates a new file 'MathService_new_cs.wsdl' with +the added information about the 'Add' method. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Xml; +using namespace System::Web::Services::Description; +int main() +{ + try + { + // Read the 'MathService_Input_cs.wsdl' file. + ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_Input_cs.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; + + // Get the 'OperationCollection' for 'SOAP' protocol. + + // + OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; + Operation^ myOperation = gcnew Operation; + myOperation->Name = "Add"; + OperationMessage^ myOperationMessageInput = (OperationMessage^)(gcnew OperationInput); + myOperationMessageInput->Message = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); + OperationMessage^ myOperationMessageOutput = (OperationMessage^)(gcnew OperationOutput); + myOperationMessageOutput->Message = gcnew XmlQualifiedName( "AddSoapOut",myDescription->TargetNamespace ); + myOperation->Messages->Add( myOperationMessageInput ); + myOperation->Messages->Add( myOperationMessageOutput ); + myOperationCollection->Add( myOperation ); + // + + // + // + if ( myOperationCollection->Contains( myOperation )) + { + Console::WriteLine( "The index of the added 'myOperation' operation is : {0}", myOperationCollection->IndexOf( myOperation ) ); + } + // + // + + // + // + // + myOperationCollection->Remove( myOperation ); + + // Insert the 'myOpearation' operation at the index '0'. + myOperationCollection->Insert( 0, myOperation ); + Console::WriteLine( "The operation at index '0' is : {0}", myOperationCollection[ 0 ]->Name ); + // + // + // + + // + array^myOperationArray = gcnew array(myOperationCollection->Count); + myOperationCollection->CopyTo( myOperationArray, 0 ); + Console::WriteLine( "The operation(s) in the collection are :" ); + for ( int i = 0; i < myOperationCollection->Count; i++ ) + { + Console::WriteLine( " {0}", myOperationArray[ i ]->Name ); + } + // + + myDescription->Write( "MathService_New_cs.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp new file mode 100644 index 00000000000..ad166a97219 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_7/CPP/operationfaultcollection_7.cpp @@ -0,0 +1,114 @@ +// System::Web::Services::Description.OperationFaultCollection +// System::Web::Services::Description.OperationFaultCollection::Contains +// System::Web::Services::Description.OperationFaultCollection::CopyTo +// System::Web::Services::Description.OperationFaultCollection::IndexOf +// System::Web::Services::Description.OperationFaultCollection::Insert +// System::Web::Services::Description.OperationFaultCollection::Item +// System::Web::Services::Description.OperationFaultCollection::Remove + +/* +The following example demonstrates the usage of the +'OperationFaultCollection' class, the 'Contains', 'CopyTo', 'IndexOf', +'Insert', 'Remove', methods and the 'Item' property of the class. +The program reverses the fault bindings that appear in the WSDL file. +It also reverses the operation faults and writes the resultant WSDL +file. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +int main() +{ + try + { + // Read the StockQuote.wsdl file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); + + // + // + // + // + // + // + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = myOperationCollection[ 0 ]; + OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; + + // Reverse the operation fault order. + if ( myOperationFaultCollection->Count > 1 ) + { + OperationFault^ myOperationFault = myOperationFaultCollection[ 0 ]; + array^myOperationFaultArray = gcnew array(myOperationFaultCollection->Count); + + // Copy the operation fault to a temporary array. + myOperationFaultCollection->CopyTo( myOperationFaultArray, 0 ); + + // Remove all the operation faults from the collection. + for ( int i = 0; i < myOperationFaultArray->Length; i++ ) + myOperationFaultCollection->Remove( myOperationFaultArray[ i ] ); + + // Insert the operation faults in the reverse order. + for ( int i = 0,j = (myOperationFaultArray->Length - 1); i < myOperationFaultArray->Length; i++,j-- ) + myOperationFaultCollection->Insert( i, myOperationFaultArray[ j ] ); + if ( myOperationFaultCollection->Contains( myOperationFault ) && (myOperationFaultCollection->IndexOf( myOperationFault ) == myOperationFaultCollection->Count - 1) ) + Console::WriteLine( "Succeeded in reversing the operation faults." ); + else + Console::WriteLine( "Error while reversing the faults." ); + } + // + // + // + // + // + // + + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + Binding^ myBinding = myBindingCollection[ 0 ]; + OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; + OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; + FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; + + // Reverse the fault binding order. + if ( myFaultBindingCollection->Count > 1 ) + { + FaultBinding^ myFaultBinding = myFaultBindingCollection[ 0 ]; + array^myFaultBindingArray = gcnew array(myFaultBindingCollection->Count); + + // Copy the fault bindings to a temporary array. + myFaultBindingCollection->CopyTo( myFaultBindingArray, 0 ); + + // Remove all the fault bindings. + for ( int i = 0; i < myFaultBindingArray->Length; i++ ) + myFaultBindingCollection->Remove( myFaultBindingArray[ i ] ); + + // Insert the fault bindings in the reverse order. + for ( int i = 0,j = (myFaultBindingArray->Length - 1); i < myFaultBindingArray->Length; i++,j-- ) + myFaultBindingCollection->Insert( i, myFaultBindingArray[ j ] ); + + // Check whether the first element before the reversal + // is now the last element. + if ( myFaultBindingCollection->Contains( myFaultBinding ) && myFaultBindingCollection->IndexOf( myFaultBinding ) == (myFaultBindingCollection->Count - 1) ) + { + // Write the WSDL generated to a file. + myServiceDescription->Write( "StockQuoteOut_cpp.wsdl" ); + Console::WriteLine( "The file StockQuoteOut_cpp.wsdl was successfully written" ); + } + else + Console::WriteLine( "An error occurred while reversing the input WSDL file." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp new file mode 100644 index 00000000000..82de5e660ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Add/CPP/operationfaultcollection_add.cpp @@ -0,0 +1,54 @@ +// System::Web::Services::Description.OperationFaultCollection->Add + +/* +The following example demonstrates the 'Add' method of the +'OperationFaultCollection' class. Based on 'StockQuote_cs::wsdl', the program generates a WSDL file +'StockQuoteNew_cs::wsdl' which contains 'Fault' information written out. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; + +int main() +{ + try + { + // Read the 'StockQuote::wsdl' file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = myOperationCollection[ 0 ]; + + // + OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; + OperationFault^ myOperationFault = gcnew OperationFault; + myOperationFault->Name = "ErrorString"; + myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" ); + myOperationFaultCollection->Add( myOperationFault ); + // + + Console::WriteLine( "Added OperationFault with Name: {0}", myOperationFault->Name ); + myOperationFault = gcnew OperationFault; + myOperationFault->Name = "ErrorInt"; + myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" ); + myOperationFaultCollection->Add( myOperationFault ); + myOperationCollection->Add( myOperation ); + Console::WriteLine( "Added Second OperationFault with Name: {0}", myOperationFault->Name ); + myServiceDescription->Write( "StockQuoteNew_cpp.wsdl" ); + Console::WriteLine( "\nThe file 'StockQuoteNew_cpp.wsdl' is created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp new file mode 100644 index 00000000000..845e68c6164 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationFaultCollection_Item/CPP/operationfaultcollection_item.cpp @@ -0,0 +1,53 @@ +// System::Web::Services::Description.OperationFaultCollection::Item->Item[String*] + +/* +The following example demonstrates the 'Item' property of the +'OperationFaultCollection' class. The program removes a fault binding +with the name 'ErrorString' from the WSDL file. It also removes an +operation fault with the name 'ErrorString' and generates a WSDL file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +int main() +{ + try + { + // Read the 'StockQuote::wsdl' file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); + + // Remove the operation fault with the name 'ErrorString'. + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = myOperationCollection[ 0 ]; + + // + OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; + OperationFault^ myOperationFault = myOperationFaultCollection[ "ErrorString" ]; + if ( myOperationFault != nullptr ) + myOperationFaultCollection->Remove( myOperationFault ); + // + + // Remove the fault binding with the name 'ErrorString'. + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + Binding^ myBinding = myBindingCollection[ 0 ]; + OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; + OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; + FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; + if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) ) + myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] ); + myServiceDescription->Write( "OperationFaultCollection_out.wsdl" ); + Console::WriteLine( "WSDL file with name 'OperationFaultCollection_out.wsdl' created Successfully" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp new file mode 100644 index 00000000000..b5f3b55eaa1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationFault_OperationFault/CPP/operationfault_operationfault.cpp @@ -0,0 +1,55 @@ +// System::Web::Services::Description.OperationFault +// System::Web::Services::Description.OperationFault::OperationFault + +/* The following example demonstrates the usage of the 'OperationFault' +class and its constructor. The program generates a WSDL file +'StockQuoteNew_cs::wsdl' which contains 'Fault' information written +out. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; +int main() +{ + try + { + // Read the 'StockQuote_cpp.wsdl' file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "StockQuote_cpp.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + Operation^ myOperation = myOperationCollection[ 0 ]; + + // + OperationFault^ myOperationFault = gcnew OperationFault; + myOperationFault->Name = "ErrorString"; + myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceStringFault" ); + myOperation->Faults->Add( myOperationFault ); + Console::WriteLine( "Added OperationFault with Name: {0}", myOperationFault->Name ); + myOperationFault = gcnew OperationFault; + myOperationFault->Name = "ErrorInt"; + myOperationFault->Message = gcnew XmlQualifiedName( "s0:GetTradePriceIntFault" ); + myOperation->Faults->Add( myOperationFault ); + // + + myOperationCollection->Add( myOperation ); + Console::WriteLine( "Added Second OperationFault with Name: {0}", myOperationFault->Name ); + myServiceDescription->Write( "StockQuoteNew_cpp.wsdl" ); + Console::WriteLine( "\nThe file 'StockQuoteNew_cpp.wsdl' is created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp new file mode 100644 index 00000000000..200d1635e94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationFlow_Enum/CPP/operationflow_enum.cpp @@ -0,0 +1,141 @@ +// System.Web.Sevices.Description.OperationFlow +// System.Web.Sevices.Description.OperationFlow.None +// System.Web.Sevices.Description.OperationFlow.OneWay +// System.Web.Sevices.Description.OperationFlow.Notification +// System.Web.Sevices.Description.OperationFlow.SolicitResponse +// System.Web.Sevices.Description.OperationFlow.RequestResponse + +/* +The following example demonstrates the usage of the 'OperationFlow' +Enumeration, its members 'None', 'OneWay', 'Notification', +'SolicitResponse', 'RequestResponse'. The input to the program is a +WSDL file 'MathService_input_cs.wsdl' It creates a new file +'MathService_new_cs.wsdl' by adding the operation messages +'OperationInput' and 'OperationOutput' are added to the +'OperationInput' and 'OperationOutput' in such way that all members of +the 'OperationFlow' enumeration are generated. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; + +// +// +// +// +// +void DisplayOperationFlowDescription( OperationFlow myOperationFlow ) +{ + switch ( myOperationFlow ) + { + case OperationFlow::None: + Console::WriteLine( "Indicates that the endpoint or service " + "receives no transmissions (None)." ); + break; + + case OperationFlow::OneWay: + Console::WriteLine( "Indicates that the endpoint or service " + "receives a message (OneWay)." ); + break; + + case OperationFlow::Notification: + Console::WriteLine( "Indicates that the endpoint or service " + "sends a message (Notification)." ); + break; + + case OperationFlow::SolicitResponse: + Console::WriteLine( "Indicates that the endpoint or service " + "sends a message, then receives a " + "correlated message (SolicitResponse)." ); + break; + + case OperationFlow::RequestResponse: + Console::WriteLine( "Indicates that the endpoint or service " + "receives a message, then sends a " + "correlated message (RequestResponse)." ); + break; + } +} +// +// +// +// +// + +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_Input_cs.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; + + // Get the OperationCollection for SOAP protocol. + OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; + + // Get the OperationMessageCollection for the Add operation. + OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages; + + // Indicate that the endpoint or service receives no + // transmissions (None). + Console::WriteLine( "myOperationMessageCollection does not " + "contain any operation messages." ); + DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); + Console::WriteLine(); + + // Indicate that the endpoint or service receives a message (OneWay). + OperationMessage^ myInputOperationMessage = dynamic_cast(gcnew OperationInput); + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); + myInputOperationMessage->Message = myXmlQualifiedName; + myOperationMessageCollection->Add( myInputOperationMessage ); + Console::WriteLine( "myOperationMessageCollection contains " + "only input operation messages." ); + DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); + Console::WriteLine(); + myOperationMessageCollection->Remove( myInputOperationMessage ); + + // Indicate that an endpoint or service sends a message (Notification). + OperationMessage^ myOutputOperationMessage = dynamic_cast(gcnew OperationOutput); + XmlQualifiedName^ myXmlQualifiedName1 = gcnew XmlQualifiedName( "AddSoapOut",myDescription->TargetNamespace ); + myOutputOperationMessage->Message = myXmlQualifiedName1; + myOperationMessageCollection->Add( myOutputOperationMessage ); + Console::WriteLine( "myOperationMessageCollection contains " + "only output operation messages." ); + DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); + Console::WriteLine(); + + // Indicate that an endpoint or service sends a message, then + // receives a correlated message (SolicitResponse). + myOperationMessageCollection->Add( myInputOperationMessage ); + Console::WriteLine( "'myOperationMessageCollection' contains " + "an output operation message first, then " + "an input operation message." ); + DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); + Console::WriteLine(); + + // Indicate that an endpoint or service receives a message, + // then sends a correlated message (RequestResponse). + myOperationMessageCollection->Remove( myInputOperationMessage ); + myOperationMessageCollection->Insert( 0, myInputOperationMessage ); + Console::WriteLine( "myOperationMessageCollection contains " + "an input operation message first, then " + "an output operation message." ); + DisplayOperationFlowDescription( myOperationMessageCollection->Flow ); + Console::WriteLine(); + myDescription->Write( "MathService_new_cs.wsdl" ); + Console::WriteLine( "The file MathService_new_cs.wsdl was successfully written." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp new file mode 100644 index 00000000000..fdc4a94dd1d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationInput_OperationInput/CPP/operationinput_operationinput.cpp @@ -0,0 +1,127 @@ +// System.Web.Services.Description.OperationInput +// System.Web.Services.Description.OperationInput.OperationInput + +/* +The following example demonstrates the usage of the 'OperationInput' +class and its constructor 'OperationInput'. It instantiates the +'ServiceDescription' object by reading a file 'AddNumbersIn_cs.wsdl' +and then creates 'AddNumbersOut_cs.wsdl' file which corresponds to +added attributes in the 'ServiceDescription' instance. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersIn_cs.wsdl" ); + + // Add the ServiceHttpPost binding. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "ServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + myBinding->Extensions->Add( myHttpBinding ); + + // Add the operation name AddNumbers. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; + myOperation->Location = "/AddNumbers"; + myOperationBinding->Extensions->Add( myOperation ); + + // Add the input binding. + InputBinding^ myInput = gcnew InputBinding; + MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; + postMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInput->Extensions->Add( postMimeContentbinding ); + + // Add the InputBinding to the OperationBinding. + myOperationBinding->Input = myInput; + + // Add the ouput binding. + OutputBinding^ myOutput = gcnew OutputBinding; + MimeXmlBinding^ postMimeXmlBinding = gcnew MimeXmlBinding; + postMimeXmlBinding->Part = "Body"; + myOutput->Extensions->Add( postMimeXmlBinding ); + + // Add the OutputBinding to the OperationBinding. + myOperationBinding->Output = myOutput; + myBinding->Operations->Add( myOperationBinding ); + myDescription->Bindings->Add( myBinding ); + + // Add the port definition. + Port^ postPort = gcnew Port; + postPort->Name = "ServiceHttpPost"; + postPort->Binding = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); + HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; + postAddressBinding->Location = "http://localhost/Service.cs.asmx"; + postPort->Extensions->Add( postAddressBinding ); + myDescription->Services[ 0 ]->Ports->Add( postPort ); + + // Add the post port type definition. + PortType^ postPortType = gcnew PortType; + postPortType->Name = "ServiceHttpPost"; + Operation^ postOperation = gcnew Operation; + postOperation->Name = "AddNumbers"; + OperationMessage^ postOutput = dynamic_cast(gcnew OperationOutput); + postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); + + // + OperationInput^ postInput = gcnew OperationInput; + postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); + postOperation->Messages->Add( postInput ); + postOperation->Messages->Add( postOutput ); + postPortType->Operations->Add( postOperation ); + // + + myDescription->PortTypes->Add( postPortType ); + + // Add the first message information. + Message^ postMessage1 = gcnew Message; + postMessage1->Name = "AddNumbersHttpPostIn"; + MessagePart^ postMessagePart1 = gcnew MessagePart; + postMessagePart1->Name = "firstnumber"; + postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); + + // Add the second message information. + MessagePart^ postMessagePart2 = gcnew MessagePart; + postMessagePart2->Name = "secondnumber"; + postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); + postMessage1->Parts->Add( postMessagePart1 ); + postMessage1->Parts->Add( postMessagePart2 ); + Message^ postMessage2 = gcnew Message; + postMessage2->Name = "AddNumbersHttpPostOut"; + + // Add the third message information. + MessagePart^ postMessagePart3 = gcnew MessagePart; + postMessagePart3->Name = "Body"; + postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); + postMessage2->Parts->Add( postMessagePart3 ); + myDescription->Messages->Add( postMessage1 ); + myDescription->Messages->Add( postMessage2 ); + + // Write the ServiceDescription as a WSDL file. + myDescription->Write( "AddNumbersOut_cs.wsdl" ); + Console::WriteLine( "WSDL file named AddNumberOut_cs.Wsdl" + " created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp new file mode 100644 index 00000000000..051aa44c1c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationMessageCollection_Sample/CPP/operationmessagecollection_sample.cpp @@ -0,0 +1,129 @@ + + +// System.Web.Services.Description.OperationMessageCollection +// System.Web.Services.Description.OperationMessageCollection.Item +// System.Web.Services.Description.OperationMessageCollection.CopyTo +// System.Web.Services.Description.OperationMessageCollection.Add +// System.Web.Services.Description.OperationMessageCollection.Contains +// System.Web.Services.Description.OperationMessageCollection.IndexOf +// System.Web.Services.Description.OperationMessageCollection.Remove +// System.Web.Services.Description.OperationMessageCollection.Insert +// System.Web.Services.Description.OperationMessageCollection.Flow +// System.Web.Services.Description.OperationMessageCollection.Input +// System.Web.Services.Description.OperationMessageCollection.Output + +/* +The following example demonstrates the usage of the +'OperationMessageCollection' class and various methods and properties of it. +The input to the program is a WSDL file 'MathService_input_vb.wsdl' without +the input message of 'Add' operation for the SOAP +protocol. In a way, it tries to simulate a scenario +wherein the operation flow was 'Notification', however later operation +flow changed to 'Request-Response'. The WSDL file is +modified by inserting a new input message for the 'Add' operation. The +input message in the ServiceDescription instance is loaded with values for +'Input Message'. The instance is then written to 'MathService_new_vb.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; + +// +// +// +// Displays the properties of the OperationMessageCollection. +void DisplayFlowInputOutput( OperationMessageCollection^ myOperationMessageCollection, String^ myOperation ) +{ + Console::WriteLine( "After {0}:", myOperation ); + Console::WriteLine( "Flow : {0}", myOperationMessageCollection->Flow ); + Console::WriteLine( "The first occurrence of operation Input in the collection {0}", myOperationMessageCollection->Input ); + Console::WriteLine( "The first occurrence of operation Output in the collection {0}", myOperationMessageCollection->Output ); + Console::WriteLine(); +} +// +// +// + +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; + + // Get the OperationCollection for the SOAP protocol. + OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; + + // Get the OperationMessageCollection for the Add operation. + OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages; + + // Display the Flow, Input, and Output properties. + DisplayFlowInputOutput( myOperationMessageCollection, "Start" ); + + // + // + // Get the operation message for the Add operation. + OperationMessage^ myOperationMessage = myOperationMessageCollection[ 0 ]; + OperationMessage^ myInputOperationMessage = dynamic_cast(gcnew OperationInput); + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); + myInputOperationMessage->Message = myXmlQualifiedName; + + // + array^myCollection = gcnew array(myOperationMessageCollection->Count); + myOperationMessageCollection->CopyTo( myCollection, 0 ); + Console::WriteLine( "Operation name(s) :" ); + for ( int i = 0; i < myCollection->Length; i++ ) + { + Console::WriteLine( " {0}", myCollection[ i ]->Operation->Name ); + } + // + + // Add the OperationMessage to the collection. + myOperationMessageCollection->Add( myInputOperationMessage ); + + // + DisplayFlowInputOutput( myOperationMessageCollection, "Add" ); + + // + // + if ( myOperationMessageCollection->Contains( myOperationMessage )) + { + int myIndex = myOperationMessageCollection->IndexOf( myOperationMessage ); + Console::WriteLine( " The index of the Add operation message in the collection is : {0}", myIndex ); + } + // + // + // + + // + // + myOperationMessageCollection->Remove( myInputOperationMessage ); + + // Display Flow, Input, and Output after removing. + DisplayFlowInputOutput( myOperationMessageCollection, "Remove" ); + + // Insert the message at index 0 in the collection. + myOperationMessageCollection->Insert( 0, myInputOperationMessage ); + + // Display Flow, Input, and Output after inserting. + DisplayFlowInputOutput( myOperationMessageCollection, "Insert" ); + // + // + + myDescription->Write( "MathService_new_cs.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp new file mode 100644 index 00000000000..c7cd7a8b49c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationMessage_Properties/CPP/operationmessage_properties.cpp @@ -0,0 +1,64 @@ +// System.Web.Services.Description.OperationMessage +// System.Web.Services.Description.OperationMessage.OperationMessage +// System.Web.Services.Description.OperationMessage.Message +// System.Web.Services.Description.OperationMessage.Operation + +/* +The following example demonstrates the usage of the 'OperationMessage' +class, its constructor and the properties 'Message' and 'Operation'. +The input to the program is a WSDL file 'MathService_input_cs.wsdl' without +the input message of 'Add' operation for the SOAP +protocol. In this example a new input message for the 'Add' operation is created. +The input message in the ServiceDescription instance is loaded with values for +'InputMessage'. The instance is then written to 'MathService_new_cs.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "MathService_input_cs.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; + + // Get the OperationCollection for the SOAP protocol. + OperationCollection^ myOperationCollection = myPortTypeCollection[ 0 ]->Operations; + + // Get the OperationMessageCollection for the Add operation. + OperationMessageCollection^ myOperationMessageCollection = myOperationCollection[ 0 ]->Messages; + + // + // + // + OperationMessage^ myInputOperationMessage = (OperationMessage^)(gcnew OperationInput); + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "AddSoapIn",myDescription->TargetNamespace ); + myInputOperationMessage->Message = myXmlQualifiedName; + // + + myOperationMessageCollection->Insert( 0, myInputOperationMessage ); + + // Display the operation name of the InputMessage. + Console::WriteLine( "The operation name is {0}", myInputOperationMessage->Operation->Name ); + // + // + + // Add the OperationMessage to the collection. + myDescription->Write( "MathService_new_cs.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp b/snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp new file mode 100644 index 00000000000..9500f4f962e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/OperationOutput_OperationOutput/CPP/operationoutput_operationoutput.cpp @@ -0,0 +1,127 @@ +// System.Web.Services.Description.OperationOutput +// System.Web.Services.Description.OperationOutput.OperationOutput + +/* +The following example demonstrates the usage of the 'OperationOutput' +class and its constructor 'OperationOutput'. It creates a +'ServiceDescription' object by reading the file 'AddNumbersIn_cs.wsdl' and +then creates 'AddNumbersOut_cs.wsdl' file which corresponds to added +attributes in the 'ServiceDescription' instance. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersIn_cs.wsdl" ); + + // Add the ServiceHttpPost binding. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "ServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + myBinding->Extensions->Add( myHttpBinding ); + + // Add the operation name AddNumbers. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; + myOperation->Location = "/AddNumbers"; + myOperationBinding->Extensions->Add( myOperation ); + + // Add the input binding. + InputBinding^ myInput = gcnew InputBinding; + MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; + postMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInput->Extensions->Add( postMimeContentbinding ); + + // Add the InputBinding to the OperationBinding. + myOperationBinding->Input = myInput; + + // Add the ouput binding. + OutputBinding^ myOutput = gcnew OutputBinding; + MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; + postMimeXmlbinding->Part = "Body"; + myOutput->Extensions->Add( postMimeXmlbinding ); + + // Add the OutPutBinding to the OperationBinding. + myOperationBinding->Output = myOutput; + myBinding->Operations->Add( myOperationBinding ); + myDescription->Bindings->Add( myBinding ); + + // Add the port definition. + Port^ postPort = gcnew Port; + postPort->Name = "ServiceHttpPost"; + postPort->Binding = gcnew XmlQualifiedName( "s0:ServiceHttpPost" ); + HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; + postAddressBinding->Location = "http://localhost/Service_cs.asmx"; + postPort->Extensions->Add( postAddressBinding ); + myDescription->Services[ 0 ]->Ports->Add( postPort ); + + // Add the post port type definition. + PortType^ postPortType = gcnew PortType; + postPortType->Name = "ServiceHttpPost"; + Operation^ postOperation = gcnew Operation; + postOperation->Name = "AddNumbers"; + OperationMessage^ postInput = dynamic_cast(gcnew OperationInput); + postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); + + // + OperationOutput^ postOutput = gcnew OperationOutput; + postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); + postOperation->Messages->Add( postInput ); + postOperation->Messages->Add( postOutput ); + postPortType->Operations->Add( postOperation ); + // + + myDescription->PortTypes->Add( postPortType ); + + // Add the first message information. + Message^ postMessage1 = gcnew Message; + postMessage1->Name = "AddNumbersHttpPostIn"; + MessagePart^ postMessagePart1 = gcnew MessagePart; + postMessagePart1->Name = "firstnumber"; + postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); + + // Add the second message information. + MessagePart^ postMessagePart2 = gcnew MessagePart; + postMessagePart2->Name = "secondnumber"; + postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); + postMessage1->Parts->Add( postMessagePart1 ); + postMessage1->Parts->Add( postMessagePart2 ); + Message^ postMessage2 = gcnew Message; + postMessage2->Name = "AddNumbersHttpPostOut"; + + // Add the third message information. + MessagePart^ postMessagePart3 = gcnew MessagePart; + postMessagePart3->Name = "Body"; + postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); + postMessage2->Parts->Add( postMessagePart3 ); + myDescription->Messages->Add( postMessage1 ); + myDescription->Messages->Add( postMessage2 ); + + // Write the ServiceDescription as a WSDL file. + myDescription->Write( "AddNumbersOut_cs.wsdl" ); + Console::WriteLine( "WSDL file named AddNumbersOut_cs.Wsdl" + " created successfully." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp new file mode 100644 index 00000000000..6af07a14872 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Operation_2/CPP/operation_2.cpp @@ -0,0 +1,155 @@ +// System.Web.Services.Description Operation.ParameterOrderString +// System.Web.Services.Description Operation.ParameterOrder + +/* The following program demonstrates the 'ParameterOrderString' and + 'ParameterOrder' properties of 'Operation' class. It collects the + message part names from the input WSDL file and sets to the + 'ParameterOrderString'. It then displays the same using 'ParameterOrder' + property. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "Operation_2_Input_CS.wsdl" ); + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Operation_2_ServiceHttpPost"; + XmlQualifiedName^ myQualifiedName = gcnew XmlQualifiedName( "s0:Operation_2_ServiceHttpPost" ); + myBinding->Type = myQualifiedName; + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; + myHttpOperationBinding->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myHttpOperationBinding ); + InputBinding^ myInputBinding = gcnew InputBinding; + MimeContentBinding^ myPostMimeContentbinding = gcnew MimeContentBinding; + myPostMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInputBinding->Extensions->Add( myPostMimeContentbinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + OutputBinding^ myOutputBinding = gcnew OutputBinding; + MimeXmlBinding^ myPostMimeXmlbinding = gcnew MimeXmlBinding; + myPostMimeXmlbinding->Part = "Body"; + myOutputBinding->Extensions->Add( myPostMimeXmlbinding ); + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutputBinding; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + Port^ myPostPort = gcnew Port; + myPostPort->Name = "Operation_2_ServiceHttpPost"; + myPostPort->Binding = gcnew XmlQualifiedName( "s0:Operation_2_ServiceHttpPost" ); + HttpAddressBinding^ myPostAddressBinding = gcnew HttpAddressBinding; + myPostAddressBinding->Location = "http://localhost/Operation_2/Operation_2_Service.cs.asmx"; + + // Add the 'HttpAddressBinding' to the 'Port'. + myPostPort->Extensions->Add( myPostAddressBinding ); + + // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. + myDescription->Services[ 0 ]->Ports->Add( myPostPort ); + PortType^ myPostPortType = gcnew PortType; + myPostPortType->Name = "Operation_2_ServiceHttpPost"; + Operation^ myPostOperation = gcnew Operation; + myPostOperation->Name = "AddNumbers"; + OperationMessage^ myPostOperationInput = dynamic_cast(gcnew OperationInput); + myPostOperationInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); + OperationMessage^ myPostOperationOutput = dynamic_cast(gcnew OperationOutput); + myPostOperationOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostout" ); + myPostOperation->Messages->Add( myPostOperationInput ); + myPostOperation->Messages->Add( myPostOperationOutput ); + + // Add the 'Operation' to 'PortType'. + myPostPortType->Operations->Add( myPostOperation ); + + // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. + myDescription->PortTypes->Add( myPostPortType ); + Message^ myPostMessage1 = gcnew Message; + myPostMessage1->Name = "AddNumbersHttpPostIn"; + MessagePart^ myPostMessagePart1 = gcnew MessagePart; + myPostMessagePart1->Name = "firstnumber"; + myPostMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); + MessagePart^ myPostMessagePart2 = gcnew MessagePart; + myPostMessagePart2->Name = "secondnumber"; + myPostMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); + + // Add the 'MessagePart' objects to 'Messages'. + myPostMessage1->Parts->Add( myPostMessagePart1 ); + myPostMessage1->Parts->Add( myPostMessagePart2 ); + Message^ myPostMessage2 = gcnew Message; + myPostMessage2->Name = "AddNumbersHttpPostout"; + MessagePart^ myPostMessagePart3 = gcnew MessagePart; + myPostMessagePart3->Name = "Body"; + myPostMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); + + // Add the 'MessagePart' to 'Message'. + myPostMessage2->Parts->Add( myPostMessagePart3 ); + + // Add the 'Message' objects to 'ServiceDescription'. + myDescription->Messages->Add( myPostMessage1 ); + myDescription->Messages->Add( myPostMessage2 ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "Operation_2_Output_CS.wsdl" ); + Console::WriteLine( " 'Operation_2_Output_CS.wsdl' file created Successfully" ); + + // + // + String^ myString = nullptr; + Operation^ myOperation = gcnew Operation; + myDescription = ServiceDescription::Read( "Operation_2_Input_CS.wsdl" ); + array^myMessage = gcnew array(myDescription->Messages->Count); + + // Copy the messages from the service description. + myDescription->Messages->CopyTo( myMessage, 0 ); + for ( int i = 0; i < myDescription->Messages->Count; i++ ) + { + array^myMessagePart = gcnew array(myMessage[ i ]->Parts->Count); + + // Copy the message parts into a MessagePart. + myMessage[ i ]->Parts->CopyTo( myMessagePart, 0 ); + for ( int j = 0; j < myMessage[ i ]->Parts->Count; j++ ) + { + myString = String::Concat( myString, myMessagePart[ j ]->Name, " " ); + } + } + + // message part names. + myOperation->ParameterOrderString = myString; + array^myString1 = myOperation->ParameterOrder; + int k = 0; + Console::WriteLine( "The list of message part names is as follows:" ); + while ( k < 5 ) + { + Console::WriteLine( myString1[ k ] ); + k++; + } + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following Exception is raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp new file mode 100644 index 00000000000..13001d530c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Operation_5/CPP/operation_5.cpp @@ -0,0 +1,72 @@ + + +// System.Web.Services.Description.Operation +// System.Web.Services.Description.Operation.Operation +// System.Web.Services.Description.Operation.Messages +// System.Web.Services.Description.Operation.Name +// System.Web.Services.Description.Operation.PortType +/* The following program demonstrates 'Operation' class, its contructor +and 'Messages','Name' and 'PortType' properties. It reads the file +'Operation_5_Input_CS.wsdl' which does not have 'PortType' object that +supports 'HttpPost'. It adds a 'PortType' object that supports 'HttpPost' +protocol and writes into 'Operation_5_Output_CS.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +Operation^ CreateOperation( String^ myOperationName, String^ myInputMesg, String^ myOutputMesg ) +{ + + // + // + // + // Create an Operation. + Operation^ myOperation = gcnew Operation; + myOperation->Name = myOperationName; + OperationMessage^ myInput = dynamic_cast(gcnew OperationInput); + myInput->Message = gcnew XmlQualifiedName( myInputMesg ); + OperationMessage^ myOutput = dynamic_cast(gcnew OperationOutput); + myOutput->Message = gcnew XmlQualifiedName( myOutputMesg ); + + // Add messages to the OperationMessageCollection. + myOperation->Messages->Add( myInput ); + myOperation->Messages->Add( myOutput ); + Console::WriteLine( "Operation name is: {0}", myOperation->Name ); + + // + // + // + return myOperation; +} + +int main() +{ + ServiceDescription^ myDescription = ServiceDescription::Read( "Operation_5_Input_CS.wsdl" ); + + // Create a 'PortType' object. + PortType^ myPortType = gcnew PortType; + myPortType->Name = "OperationServiceHttpPost"; + Operation^ myOperation = CreateOperation( "AddNumbers", "s0:AddNumbersHttpPostIn", "s0:AddNumbersHttpPostOut" ); + myPortType->Operations->Add( myOperation ); + + // + // Get the PortType of the Operation. + PortType^ myPort = myOperation->PortType; + Console::WriteLine( "The port type of the operation is: {0}", myPort->Name ); + + // + // Add the 'PortType's to 'PortTypeCollection' of 'ServiceDescription'. + myDescription->PortTypes->Add( myPortType ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "Operation_5_Output_CS.wsdl" ); + Console::WriteLine( "WSDL file with name 'Operation_5_Output_CS.wsdl' file created Successfully" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp new file mode 100644 index 00000000000..69a3b7c85e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Operation_Faults/CPP/operation_faults.cpp @@ -0,0 +1,47 @@ +// System::Web::Services::Description.Operation::Faults + +/* The following program demonstrates the 'Faults' property of 'Operation' +class. It reads from a 'Operation_Faults_Input_CS::wsdl' file removes fault +binding and operation fault with the name 'ErrorString'. The modified +ServiceDescriptor is written to 'Operation_Faults_Output_Cpp.wsdl' file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + // + // Read the 'Operation_Faults_Input_cpp.wsdl' file as input. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Operation_Faults_Input_cpp.wsdl" ); + + // Get the operation fault collection. + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + PortType^ myPortType = myPortTypeCollection[ 0 ]; + OperationCollection^ myOperationCollection = myPortType->Operations; + + // Remove the operation fault with the name 'ErrorString'. + Operation^ myOperation = myOperationCollection[ 0 ]; + OperationFaultCollection^ myOperationFaultCollection = myOperation->Faults; + if ( myOperationFaultCollection->Contains( myOperationFaultCollection[ "ErrorString" ] ) ) + myOperationFaultCollection->Remove( myOperationFaultCollection[ "ErrorString" ] ); + // + + // Get the fault binding collection. + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + Binding^ myBinding = myBindingCollection[ 0 ]; + OperationBindingCollection^ myOperationBindingCollection = myBinding->Operations; + + // Remove the fault binding with the name 'ErrorString'. + OperationBinding^ myOperationBinding = myOperationBindingCollection[ 0 ]; + FaultBindingCollection^ myFaultBindingCollection = myOperationBinding->Faults; + if ( myFaultBindingCollection->Contains( myFaultBindingCollection[ "ErrorString" ] ) ) + myFaultBindingCollection->Remove( myFaultBindingCollection[ "ErrorString" ] ); + + myServiceDescription->Write( "Operation_Faults_Output_cpp.wsdl" ); + Console::WriteLine( "WSDL file with name 'Operation_Faults_Output_cpp.wsdl' file created Successfully" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp b/snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp new file mode 100644 index 00000000000..fab0c5d907a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Operation_IsBoundBy/CPP/operation_isboundby.cpp @@ -0,0 +1,95 @@ +// System.Web.Services.Description.Operation.IsBoundBy +/* The following program demonstrates the 'IsBoundBy' method of + 'Operation' class. It takes "Operation_IsBoundBy_Input_CS.wsdl" + as input which does not contain 'PortType' and 'Binding' objects + supporting 'HttpPost'. It then adds those objects and writes into + 'Operation_IsBoundBy_Output_CS.wsdl'. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Operation_IsBoundBy_Input_CS.wsdl" ); + + // Create the 'Binding' object. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "MyOperationIsBoundByServiceHttpPost"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:OperationServiceHttpPost" ); + myBinding->Type = myXmlQualifiedName; + + // Create the 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + + // Create the 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myHttpOperationBinding = gcnew HttpOperationBinding; + myHttpOperationBinding->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myHttpOperationBinding ); + + // Create the 'InputBinding' object. + InputBinding^ myInputBinding = gcnew InputBinding; + MimeContentBinding^ myPostMimeContentBinding = gcnew MimeContentBinding; + myPostMimeContentBinding->Type = "application/x-www-form-urlencoded"; + myInputBinding->Extensions->Add( myPostMimeContentBinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + + // Create the 'OutputBinding' object. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + MimeXmlBinding^ myPostMimeXmlBinding = gcnew MimeXmlBinding; + myPostMimeXmlBinding->Part = "Body"; + myOutputBinding->Extensions->Add( myPostMimeXmlBinding ); + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutputBinding; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myServiceDescription->Bindings->Add( myBinding ); + + // Create a 'PortType' object. + PortType^ myPostPortType = gcnew PortType; + myPostPortType->Name = "OperationServiceHttpPost"; + +// + Operation^ myPostOperation = gcnew Operation; + myPostOperation->Name = myOperationBinding->Name; + Console::WriteLine( "'Operation' instance uses 'OperationBinding': {0}", + myPostOperation->IsBoundBy( myOperationBinding ) ); +// + + OperationMessage^ myOperationMessage = dynamic_cast(gcnew OperationInput); + myOperationMessage->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); + OperationMessage^ myOperationMessage1 = dynamic_cast(gcnew OperationOutput); + myOperationMessage1->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); + myPostOperation->Messages->Add( myOperationMessage ); + myPostOperation->Messages->Add( myOperationMessage1 ); + + // Add the 'Operation' to 'PortType'. + myPostPortType->Operations->Add( myPostOperation ); + + // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. + myServiceDescription->PortTypes->Add( myPostPortType ); + + // Write the 'ServiceDescription' as a WSDL file. + myServiceDescription->Write( "Operation_IsBoundBy_Output_CS.wsdl" ); + Console::WriteLine( "WSDL file with name 'Operation_IsBoundBy_Output_CS.wsdl' created Successfully" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp b/snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp new file mode 100644 index 00000000000..458ca2e8f8e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortClass/CPP/portclass.cpp @@ -0,0 +1,166 @@ + + +// System.Web.Services.Description.Port.ctor(). +// System.Web.Services.Description.Port.Binding(). +// System.Web.Services.Description.Portt.Extensions. +// System.Web.Services.Description.Port.Name. +// System.Web.Services.Description.Port.Service. +/* The following example demonstrates the constructor and the properties 'Binding', + 'Extensions','Name', and 'Service' of the 'Port' class. + The input to the program is a WSDL file 'AddNumbers_cs.wsdl'. + It creates a 'ServiceDescription' instance by using the static read method + of 'ServiceDescription' by passing the 'AddNumbers.wsdl' name as an argument. + It creates a 'Binding' object and adds that binding object to + 'ServiceDescription'. It adds the 'PortType',Messages to the 'ServiceDescription' + object. Finally it writes the 'ServiceDescrption' as a WSDL file with + name 'AddNumbersOne.wsdl. + */ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Web; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + try + { + ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbers_cs.wsdl" ); + + // Create the 'Binding' object. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "PortServiceHttpPost"; + XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" ); + myBinding->Type = qualifiedName; + + // Create the 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + + // Create the 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; + myOperation->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myOperation ); + + // Create the 'InputBinding' object. + InputBinding^ myInput = gcnew InputBinding; + MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; + postMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInput->Extensions->Add( postMimeContentbinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInput; + + // Create the 'OutputBinding' object. + OutputBinding^ myOutput = gcnew OutputBinding; + MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; + postMimeXmlbinding->Part = "Body"; + myOutput->Extensions->Add( postMimeXmlbinding ); + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + + // + // + // + // + // + // Create a Port. + Port^ postPort = gcnew Port; + postPort->Name = "PortServiceHttpPost"; + postPort->Binding = gcnew XmlQualifiedName( "s0:PortServiceHttpPost" ); + // + // + + // Create an HttpAddressBinding. + HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; + postAddressBinding->Location = "http://localhost/PortClass/PortService_cs.asmx"; + + // Add the HttpAddressBinding to the Port. + postPort->Extensions->Add( postAddressBinding ); + // + + // Get the Service of the postPort. + Service^ myService = postPort->Service; + + // Print the service name for the port. + Console::WriteLine( "This is the service name of the postPort:*{0}*", myDescription->Services[ 0 ]->Ports[ 0 ]->Service->Name ); + + // Add the Port to the PortCollection of the ServiceDescription. + myDescription->Services[ 0 ]->Ports->Add( postPort ); + // + // + + // Create a 'PortType' object. + PortType^ postPortType = gcnew PortType; + postPortType->Name = "PortServiceHttpPost"; + Operation^ postOperation = gcnew Operation; + postOperation->Name = "AddNumbers"; + OperationMessage^ postInput = dynamic_cast(gcnew OperationInput); + postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); + OperationMessage^ postOutput = dynamic_cast(gcnew OperationOutput); + postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); + postOperation->Messages->Add( postInput ); + postOperation->Messages->Add( postOutput ); + + // Add the 'Operation' to 'PortType'. + postPortType->Operations->Add( postOperation ); + + // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. + myDescription->PortTypes->Add( postPortType ); + + // Create the 'Message' object. + Message^ postMessage1 = gcnew Message; + postMessage1->Name = "AddNumbersHttpPostIn"; + + // Create the 'MessageParts'. + MessagePart^ postMessagePart1 = gcnew MessagePart; + postMessagePart1->Name = "firstnumber"; + postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); + MessagePart^ postMessagePart2 = gcnew MessagePart; + postMessagePart2->Name = "secondnumber"; + postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); + + // Add the 'MessagePart' objects to 'Messages'. + postMessage1->Parts->Add( postMessagePart1 ); + postMessage1->Parts->Add( postMessagePart2 ); + + // Create another 'Message' object. + Message^ postMessage2 = gcnew Message; + postMessage2->Name = "AddNumbersHttpPostOut"; + MessagePart^ postMessagePart3 = gcnew MessagePart; + postMessagePart3->Name = "Body"; + postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); + + // Add the 'MessagePart' to 'Message' + postMessage2->Parts->Add( postMessagePart3 ); + + // Add the 'Message' objects to 'ServiceDescription'. + myDescription->Messages->Add( postMessage1 ); + myDescription->Messages->Add( postMessage2 ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "AddNumbersOne.wsdl" ); + Console::WriteLine( "WSDL file with name 'AddNumbersOne.Wsdl' file created Successfully" ); + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Exception {0} occurred", ex->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp new file mode 100644 index 00000000000..aea7134fd0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortCollection_Add/CPP/portcollection_add.cpp @@ -0,0 +1,67 @@ + + +// System.Web.Services.Description.PortCollection.Contains +// System.Web.Services.Description.PortCollection.Add +/* + The following sample reads the contents of a file 'MathServiceAdd_cs.wsdl' + into a 'ServiceDescription' instance. It gets the collection of Service + instances from 'ServiceDescription'. It then adds a new port and checks + whether a port exists. The programs writes a new web service description + file. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +int main() +{ + try + { + Service^ myService; + PortCollection^ myPortCollection; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceAdd_cs.wsdl" ); + Console::WriteLine( "\nTotal Number of Services :{0}", myServiceDescription->Services->Count ); + for ( int i = 0; i < myServiceDescription->Services->Count; ++i ) + { + myService = myServiceDescription->Services[ i ]; + Console::WriteLine( "Name : {0}", myService->Name ); + + // + // + myPortCollection = myService->Ports; + Port^ myNewPort = myPortCollection[ 0 ]; + myPortCollection->Remove( myNewPort ); + + // Display the number of ports. + Console::WriteLine( "\nTotal number of ports before adding a new port : {0}", myService->Ports->Count ); + + // Add a new port. + myPortCollection->Add( myNewPort ); + + // Display the number of ports after adding a port. + Console::WriteLine( "Total number of ports after adding a new port : {0}", myService->Ports->Count ); + // + + bool bContain = myPortCollection->Contains( myNewPort ); + Console::WriteLine( "\nPort '{0}' exists : {1}", myNewPort->Name, bContain ); + + // Remove a port from the collection. + myPortCollection->Remove( myPortCollection[ myNewPort->Name ] ); + bContain = myPortCollection->Contains( myNewPort ); + Console::WriteLine( "Port '{0}' exists : {1}", myNewPort->Name, bContain ); + + // Create the description file. + myPortCollection->Insert( 0, myNewPort ); + myServiceDescription->Write( "MathServiceAddNew_cs.wsdl" ); + // + + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Exception:{0}", ex->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp new file mode 100644 index 00000000000..3f20f18b74a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortCollection_CopyTo/CPP/portcollection_copyto.cpp @@ -0,0 +1,71 @@ + + +// System.Web.Services.Description.PortCollection.Insert +// System.Web.Services.Description.PortCollection.IndexOf +// System.Web.Services.Description.PortCollection.CopyTo +/* + The following sample reads the contents of a file 'MathService.wsdl' + into a 'ServiceDescription' instance. It gets the collection of Service + instances from 'ServiceDescription'. It instantiates 'PortCollection' for + each service in the collection. 'CopyTo' is called to copy + the contents into an array. Calls 'IndexOf' for a given port. + 'Insert' method is called to insert a new port in the collection. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +int main() +{ + try + { + Service^ myService; + PortCollection^ myPortCollection; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceCopyTo_cs.wsdl" ); + Console::WriteLine( "Total Number of Services :{0}", myServiceDescription->Services->Count ); + for ( int i = 0; i < myServiceDescription->Services->Count; ++i ) + { + myService = myServiceDescription->Services[ i ]; + Console::WriteLine( "Name : {0}", myService->Name ); + + // + // + // + myPortCollection = myService->Ports; + + // Create an array of Port objects. + Console::WriteLine( "\nPort collection :" ); + array^myPortArray = gcnew array(myService->Ports->Count); + myPortCollection->CopyTo( myPortArray, 0 ); + for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 ) + { + Console::WriteLine( "Port[{0}] : {1}", i1, myPortArray[ i1 ]->Name ); + + } + // + Port^ myIndexPort = myPortCollection[ 0 ]; + Console::WriteLine( "\n\nThe index of port '{0}' is : {1}", myIndexPort->Name, myPortCollection->IndexOf( myIndexPort ) ); + // + + Port^ myPortTestInsert = myPortCollection[ 0 ]; + myPortCollection->Remove( myPortTestInsert ); + myPortCollection->Insert( 0, myPortTestInsert ); + Console::WriteLine( "\n\nTotal Number of Ports after inserting a new port '{0}' is : {1}", myPortTestInsert->Name, myService->Ports->Count ); + for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 ) + { + Console::WriteLine( "Port[{0}] : {1}", i1, myPortArray[ i1 ]->Name ); + + } + myServiceDescription->Write( "MathServiceCopyToNew_cs.wsdl" ); + // + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Exception:{0}", ex->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp new file mode 100644 index 00000000000..2f9033c0d1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortCollection_Item/CPP/portcollection_item.cpp @@ -0,0 +1,71 @@ + + +// System.Web.Services.Description.PortCollection +// System.Web.Services.Description.PortCollection.Remove +// System.Web.Services.Description.PortCollection.Item(String) +// System.Web.Services.Description.PortCollection.Item(Int32) +/* + The following sample reads the contents of a file 'MathService_cs.wsdl' + into a 'ServiceDescription' instance. It gets the collection of Service + instances from 'ServiceDescription'. It instantiates 'PortCollection' for + each service in the collection. It access the ports from the collection and + displays them. It accesses a port by its name from the collection and + displays its index. It adds a new port and calls 'Remove' + to remove the newly added port. The programs writes a new web service + description file. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + // + // + // + // + Service^ myService; + PortCollection^ myPortCollection; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathServiceItem_cs.wsdl" ); + Console::WriteLine( "Total number of services : {0}", myServiceDescription->Services->Count ); + for ( int i = 0; i < myServiceDescription->Services->Count; ++i ) + { + myService = myServiceDescription->Services[ i ]; + Console::WriteLine( "Name : {0}", myService->Name ); + myPortCollection = myService->Ports; + + // Create an array of ports. + Console::WriteLine( "\nPort collection :" ); + for ( int i1 = 0; i1 < myService->Ports->Count; ++i1 ) + { + Console::WriteLine( "Port[{0}] : {1}", i1, myPortCollection[ i1 ]->Name ); + } + // + + String^ strPort = myPortCollection[ 0 ]->Name; + Port^ myPort = myPortCollection[ strPort ]; + Console::WriteLine( "\nIndex of Port[{0}] : {1}", strPort, myPortCollection->IndexOf( myPort ) ); + // + + Port^ myPortTestRemove = myPortCollection[ 0 ]; + Console::WriteLine( "\nTotal number of ports before removing a port '{0}' is : {1}", myPortTestRemove->Name, myService->Ports->Count ); + myPortCollection->Remove( myPortTestRemove ); + Console::WriteLine( "Total number of ports after removing a port '{0}' is : {1}", myPortTestRemove->Name, myService->Ports->Count ); + + // Create the WSDL file. + myPortCollection->Insert( 0, myPortTestRemove ); + myServiceDescription->Write( "MathServiceItemNew_cs.wsdl" ); + // + // + } + } + catch ( Exception^ ex ) + { + Console::WriteLine( "Exception: {0}", ex->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp b/snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp new file mode 100644 index 00000000000..e6400fcfd3f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortType/CPP/porttype.cpp @@ -0,0 +1,75 @@ + + +// System.Web.Services.Description.PortType.Operations +// System.Web.Services.Description.PortType.PortType() +// System.Web.Services.Description.PortType.Name +/*The following sample demonstrates the properties 'Operations','Name' and constructor +'PortType()' of class 'PortType'. This sample reads the contents of a file 'MathService_cs.wsdl' +into a 'ServiceDescription' instance. It gets the collection of 'PortType' +instances from 'ServiceDescription'. It removes a 'PortType' from the collection, creates a +new 'PortType' and adds it into collection. The programs writes a new web service description +file 'MathService_New.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) +{ + Operation^ myOperation = gcnew Operation; + myOperation->Name = operationName; + OperationMessage^ input = dynamic_cast(gcnew OperationInput); + input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); + OperationMessage^ output = dynamic_cast(gcnew OperationOutput); + output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); + myOperation->Messages->Add( input ); + myOperation->Messages->Add( output ); + return myOperation; +} + +int main() +{ + try + { + // + // + PortTypeCollection^ myPortTypeCollection; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + myPortTypeCollection = myServiceDescription->PortTypes; + int noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes : {0}", noOfPortTypes ); + PortType^ myPortType = myPortTypeCollection[ "MathServiceSoap" ]; + myPortTypeCollection->Remove( myPortType ); + + // Create a new PortType. + PortType^ myNewPortType = gcnew PortType; + myNewPortType->Name = "MathServiceSoap"; + OperationCollection^ myOperationCollection = myServiceDescription->PortTypes[ 0 ]->Operations; + String^ inputMsg; + String^ outputMsg; + for ( int i = 0; i < myOperationCollection->Count; i++ ) + { + inputMsg = String::Concat( myOperationCollection[ i ]->Name, "SoapIn" ); + outputMsg = String::Concat( myOperationCollection[ i ]->Name, "SoapOut" ); + Console::WriteLine( " Operation = {0}", myOperationCollection[ i ]->Name ); + myNewPortType->Operations->Add( CreateOperation( myOperationCollection[ i ]->Name, inputMsg, outputMsg, myServiceDescription->TargetNamespace ) ); + + } + myPortTypeCollection->Add( myNewPortType ); + noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes : {0}", noOfPortTypes ); + myServiceDescription->Write( "MathService_New.wsdl" ); + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception:{0}", e->Message ); + } + +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp new file mode 100644 index 00000000000..bfaa4c38ac4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_1/CPP/porttypecollection_1.cpp @@ -0,0 +1,59 @@ + + +// System.Web.Services.Description.PortTypeCollection.Item[int] +// System.Web.Services.Description.PortTypeCollection.Remove() +// System.Web.Services.Description.PortTypeCollection.Add() +/*The following sample demonstrates the indexer 'Item[int]', methods +'Remove()' and 'Add()' of class 'PortTypeCollection'. It reads the +contents of a file 'MathService.wsdl'into a 'ServiceDescription' instance. +It gets the collection of 'PortType' from 'ServiceDescription' and adds +a new PortType and writes a new web service description file into +'MathService_New.wsdl'. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +int main() +{ + try + { + // + // + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + int noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count ); + + // Get the first PortType in the collection. + PortType^ myNewPortType = myPortTypeCollection[ 0 ]; + Console::WriteLine( "The PortType at index 0 is: {0}", myNewPortType->Name ); + Console::WriteLine( "Removing the PortType {0}", myNewPortType->Name ); + + // Remove the PortType from the collection. + myPortTypeCollection->Remove( myNewPortType ); + + // Display the number of PortTypes. + Console::WriteLine( "\nTotal number of PortTypes after removing: {0}", myServiceDescription->PortTypes->Count ); + Console::WriteLine( "Adding a PortType {0}", myNewPortType->Name ); + + // Add a new PortType from the collection. + myPortTypeCollection->Add( myNewPortType ); + + // Display the number of PortTypes after adding a port. + Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count ); + myServiceDescription->Write( "MathService_New.wsdl" ); + // + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp new file mode 100644 index 00000000000..3a73b6fac7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_2/CPP/porttypecollection_2.cpp @@ -0,0 +1,68 @@ + + +// System.Web.Services.Description.PortTypeCollection.Contains() +// System.Web.Services.Description.PortTypeCollection.Insert() +// System.Web.Services.Description.PortTypeCollection.IndexOf() +// System.Web.Services.Description.PortTypeCollection.Item[string] +/* +The following sample demonstrates the methods 'IndexOf()','Insert()','Contains()' and +indexer 'Item[string]' of class 'PortTypeCollection'. This sample reads the contents +of 'MathService.wsdl' into a 'ServiceDescription' instance. It gets the collection of +'PortType' instances from 'ServiceDescription'. It removes a 'PortType' with the name +'MathServiceSoap' and adds the same later. Then it checks whether the collection contains +the added 'PortType'. The sample writes a new web service description file 'MathService_New.wsdl'. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +int main() +{ + try + { + // + // + // + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + int noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes ); + PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ]; + // + + // Get the index in the collection. + int index = myPortTypeCollection->IndexOf( myNewPortType ); + // + + Console::WriteLine( "Removing the PortType named {0}", myNewPortType->Name ); + + // Remove the PortType from the collection. + myPortTypeCollection->Remove( myNewPortType ); + noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes: {0}", noOfPortTypes ); + + // Check whether the PortType exists in the collection. + bool bContains = myPortTypeCollection->Contains( myNewPortType ); + Console::WriteLine( "Port Type'{0}' exists: {1}", myNewPortType->Name, bContains ); + Console::WriteLine( "Adding the PortType" ); + + // Insert a new portType at the index location. + myPortTypeCollection->Insert( index, myNewPortType ); + // + + // Display the number of portTypes after adding a port. + Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count ); + bContains = myPortTypeCollection->Contains( myNewPortType ); + Console::WriteLine( "Port Type'{0}' exists: {1}", myNewPortType->Name, bContains ); + myServiceDescription->Write( "MathService_New.wsdl" ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp new file mode 100644 index 00000000000..a0c7a4790fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_Class/CPP/porttypecollection_class.cpp @@ -0,0 +1,64 @@ + + +// System.Web.Services.Description.PortTypeCollection +/* The following sample demonstrates the class 'PortTypeCollection'. It reads the +contents of WSDL document 'MathService.wsdl'into a 'ServiceDescription' instance. +It gets the collection of 'PortType'from 'ServiceDescription'. It copies the +collection into an array of 'PortType' and displays their names. Then it removes a +'PortType', checks whether the collection contains the removed 'PortType'. +It adds the same 'PortType' and writes a new web service description file into +'MathService_New.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +using namespace System::Collections; +int main() +{ + try + { + // Read the existing Web service description file. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + int noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes: {0}", myServiceDescription->PortTypes->Count ); + + // Get the first PortType in the collection. + PortType^ myNewPortType = myPortTypeCollection[ "MathServiceSoap" ]; + int index = myPortTypeCollection->IndexOf( myNewPortType ); + Console::WriteLine( "The PortType with the name {0} is at index: {1}", myNewPortType->Name, (index + 1) ); + Console::WriteLine( "Removing the PortType: {0}", myNewPortType->Name ); + + // Remove the PortType from the collection. + myPortTypeCollection->Remove( myNewPortType ); + bool bContains = myPortTypeCollection->Contains( myNewPortType ); + Console::WriteLine( "The PortType with the name {0} exists: {1}", myNewPortType->Name, bContains ); + Console::WriteLine( "Total number of PortTypes after removing: {0}", myServiceDescription->PortTypes->Count ); + Console::WriteLine( "Adding a PortType: {0}", myNewPortType->Name ); + + // Add a new portType from the collection. + myPortTypeCollection->Add( myNewPortType ); + + // Display the number of portTypes after adding a port. + Console::WriteLine( "Total number of PortTypes after adding a new port: {0}", myServiceDescription->PortTypes->Count ); + + // List the PortTypes available in the WSDL document. + IEnumerator^ myEnum = myPortTypeCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + PortType^ myPortType = safe_cast(myEnum->Current); + Console::WriteLine( "The PortType name is: {0}", myPortType->Name ); + } + myServiceDescription->Write( "MathService_New.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp new file mode 100644 index 00000000000..f5b3a9694c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortTypeCollection_CopyTo/CPP/porttypecollection_copyto.cpp @@ -0,0 +1,50 @@ +// System.Web.Services.Description.PortTypeCollection.CopyTo() + +/* +The following sample demonstrates the 'CopyTo()' method of the class +'PortTypeCollection'. This sample reads the contents of a file 'MathService.wsdl' +into a 'ServiceDescription' instance. It gets the collection of 'PortType' +from 'ServiceDescription'. It copies the collection into an array of 'PortType' +and displays their names. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +int main() +{ + try + { +// + PortTypeCollection^ myPortTypeCollection; + + ServiceDescription^ myServiceDescription = + ServiceDescription::Read( "MathService_CS.wsdl" ); + + myPortTypeCollection = myServiceDescription->PortTypes; + int noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes: {0}", + myServiceDescription->PortTypes->Count ); + + // Copy the collection into an array. + array^ myPortTypeArray = gcnew array(noOfPortTypes); + myPortTypeCollection->CopyTo( myPortTypeArray, 0 ); + + // Display names of all PortTypes. + for ( int i = 0; i < noOfPortTypes; i++ ) + { + Console::WriteLine( "PortType name: {0}", myPortTypeArray[ i ]->Name ); + } + myServiceDescription->Write( "MathService_New.wsdl" ); +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp b/snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp new file mode 100644 index 00000000000..a8935574cb1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/PortType_Class/CPP/porttype_class.cpp @@ -0,0 +1,71 @@ + + +// System.Web.Services.Description.PortType +/* +The following sample demonstrates the class 'PortType'. This sample reads +the contents of a file 'MathService_cs.wsdl' into a 'ServiceDescription' instance. +It gets the collection of 'PortType' instances from 'ServiceDescription'. +It removes a 'PortType' from the collection, creates a new 'PortType' and adds +it into collection. The programs writes a new web service description +file 'MathService_New.wsdl'. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; +Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) +{ + Operation^ myOperation = gcnew Operation; + myOperation->Name = operationName; + OperationMessage^ input = dynamic_cast(gcnew OperationInput); + input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); + OperationMessage^ output = dynamic_cast(gcnew OperationOutput); + output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); + myOperation->Messages->Add( input ); + myOperation->Messages->Add( output ); + return myOperation; +} + +int main() +{ + try + { + PortTypeCollection^ myPortTypeCollection; + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + myPortTypeCollection = myServiceDescription->PortTypes; + int noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal number of PortTypes : {0}", noOfPortTypes ); + PortType^ myPortType = myPortTypeCollection[ "MathServiceSoap" ]; + myPortTypeCollection->Remove( myPortType ); + + // Create a new PortType. + PortType^ myNewPortType = gcnew PortType; + myNewPortType->Name = "MathServiceSoap"; + OperationCollection^ myOperationCollection = myServiceDescription->PortTypes[ 0 ]->Operations; + for ( int i = 0; i < myOperationCollection->Count; i++ ) + { + String^ inputmsg = String::Concat( myOperationCollection[ i ]->Name, "SoapIn" ); + String^ outputmsg = String::Concat( myOperationCollection[ i ]->Name, "SoapOut" ); + Console::WriteLine( "Operation = {0}", myOperationCollection[ i ]->Name ); + myNewPortType->Operations->Add( CreateOperation( myOperationCollection[ i ]->Name, inputmsg, outputmsg, myServiceDescription->TargetNamespace ) ); + + } + + // Add the PortType to the collection. + myPortTypeCollection->Add( myNewPortType ); + noOfPortTypes = myServiceDescription->PortTypes->Count; + Console::WriteLine( "\nTotal Number of PortTypes : {0}", noOfPortTypes ); + myServiceDescription->Write( "MathService_New.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp b/snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp new file mode 100644 index 00000000000..1df6d73f925 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RealProxy_Sample/CPP/realproxy_sample.cpp @@ -0,0 +1,131 @@ + + +// System.Runtime.Remoting.Proxies.RealProxy.SupportsInterface(Guid); +// System.Runtime.Remoting.Proxies.RealProxy.GetCOMIUnknown(bool); +// System.Runtime.Remoting.Proxies.RealProxy.SetCOMIUnknown(IntPtr); +/* The following example demonstrates implementation of methods +'GetCOMIUnknown','SupportsInterface' and 'SetCOMIUnknown' of +System.Runtime.Remoting.Proxies.RealProxy. + +The following program has a 'CustomProxy' referring to unmanaged COM component. +A COM Runtime Wrapper takes care of method call to unmanaged world. SupportsInterface +method is overridden to return address of COM Runtime Wrapper. +*/ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Activation; +using namespace System::Runtime::Remoting::Proxies; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; +using namespace ActiveDs; +// using namespace InterOpADS; +public ref class MyProxy: public RealProxy +{ +private: + String^ m_URI; + MarshalByRefObject^ myMarshalByRefObject; + +public: + [SecurityPermission(SecurityAction::LinkDemand)] + MyProxy() + : RealProxy() + { + Console::WriteLine( "MyProxy Constructor Called..." ); + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance(WinNTSystemInfo::typeid )); + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + m_URI = myObjRef->URI; + } + + [SecurityPermission(SecurityAction::LinkDemand)] + MyProxy( Type^ myType ) + : RealProxy( myType ) + { + Console::WriteLine( "MyProxy Constructor Called..." ); + myMarshalByRefObject = dynamic_cast(Activator::CreateInstance( myType )); + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + m_URI = myObjRef->URI; + } + + [SecurityPermission(SecurityAction::LinkDemand)] + MyProxy( Type^ myType, MarshalByRefObject^ targetObject ) + : RealProxy( myType ) + { + Console::WriteLine( "MyProxy Constructor Called..." ); + myMarshalByRefObject = targetObject; + ObjRef^ myObjRef = RemotingServices::Marshal( myMarshalByRefObject ); + m_URI = myObjRef->URI; + } + + [SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)] + virtual IMessage^ Invoke( IMessage^ msg ) override + { + if ( dynamic_cast(msg) ) + { + + // Initialize a new instance of remote object + IConstructionReturnMessage^ myIConstructionReturnMessage = this->InitializeServerObject( dynamic_cast(msg) ); + ConstructionResponse^ constructionResponse = gcnew ConstructionResponse( nullptr,dynamic_cast(msg) ); + return constructionResponse; + } + + IDictionary^ myIDictionary = msg->Properties; + IMessage^ retMsg; + myIDictionary->default[ "__Uri" ] = m_URI; + + // Synchronously dispatch messages to server. + retMsg = ChannelServices::SyncDispatchMessage( msg ); + + // Pushing return value and OUT parameters back onto stack + IMethodReturnMessage^ mrm = dynamic_cast(retMsg); + return retMsg; + } + + // + // + // + [SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::Infrastructure)] + IntPtr SupportsInterface( Guid * /*myGuid*/ ) + { + Console::WriteLine( "SupportsInterface method called" ); + + // Object reference is requested for communication with unmanaged objects + // in the current process through COM. + IntPtr myIntPtr = this->GetCOMIUnknown( false ); + + // Stores an unmanaged proxy of the object. + this->SetCOMIUnknown( myIntPtr ); + + // return COM Runtime Wrapper pointer. + return myIntPtr; + } + // + // + // +}; + + +// Acts as a custom proxy user. +[SecurityPermission(SecurityAction::LinkDemand)] +int main() +{ + Console::WriteLine( "" ); + Console::WriteLine( "CustomProxy Sample" ); + Console::WriteLine( "==================" ); + MyProxy^ mProxy = gcnew MyProxy( WinNTSystemInfo::typeid); + WinNTSystemInfo^ myHelloServer = dynamic_cast(mProxy->GetTransparentProxy()); + Console::WriteLine( "Machine Name = {0}", myHelloServer->ComputerName ); + Console::WriteLine( "Domain Name = {0}", myHelloServer->DomainName ); + Console::WriteLine( "User Name = {0}", myHelloServer->UserName ); + + // Construct Guid object from unmanaged Interface 'IADsWinNTSystemInfo' guid. + Guid myGuid = Guid("{6C6D65DC-AFD1-11D2-9CB9-0000F87A369E}"); + IntPtr myIntrPtr = mProxy->SupportsInterface( &myGuid ); + Console::WriteLine( "Requested Interface Pointer= {0}", myIntrPtr.ToInt32() ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp new file mode 100644 index 00000000000..11d4599ec99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting.ObjRef/CPP/client.cpp @@ -0,0 +1,54 @@ + + +#using +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Net::Sockets; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Lifetime; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Runtime::Serialization; +using namespace System::Collections; +using namespace SampleNamespace; + +int main() +{ + ChannelServices::RegisterChannel( gcnew HttpChannel( 0 ) ); + RemotingConfiguration::RegisterActivatedClientType( SampleService::typeid, "http://localhost:9000/MySampleService" ); + SampleService ^ myRemoteObject = gcnew SampleService; + bool result = myRemoteObject->SampleMethod(); + + // System::Runtime::Remoting::ObjRef + // + ObjRef^ objRefSample = RemotingServices::GetObjRefForProxy( myRemoteObject ); + Console::WriteLine( "***ObjRef Details***" ); + Console::WriteLine( "URI:\t {0}", objRefSample->URI ); + array^channelData = objRefSample->ChannelInfo->ChannelData; + Console::WriteLine( "Channel Info:" ); + for each(Object^ o in channelData) + Console::WriteLine("\t{0}", o->ToString()); + IEnvoyInfo^ envoyInfo = objRefSample->EnvoyInfo; + if ( envoyInfo == nullptr ) + { + Console::WriteLine( "This ObjRef does not have envoy information." ); + } + else + { + IMessageSink^ envoySinks = envoyInfo->EnvoySinks; + Console::WriteLine( "Envoy Sink Class: {0}", envoySinks ); + } + IRemotingTypeInfo^ typeInfo = objRefSample->TypeInfo; + Console::WriteLine( "Remote type name: {0}", typeInfo->TypeName ); + Console::WriteLine( "Can my Object cast to a Bitmap? {0}", typeInfo->CanCastTo( System::Drawing::Bitmap::typeid, objRefSample ) ); + Console::WriteLine( "Is this Object from this AppDomain? {0}", objRefSample->IsFromThisAppDomain() ); + Console::WriteLine( "Is this Object from this process? {0}", objRefSample->IsFromThisProcess() ); + // + + return 0; +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp new file mode 100644 index 00000000000..ef46529987d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/client.cpp @@ -0,0 +1,36 @@ + + +// +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel ); + RemotingConfiguration::RegisterActivatedClientType( HelloServiceClass::typeid, "tcp://localhost:8082" ); + try + { + HelloServiceClass ^ service = gcnew HelloServiceClass; + + // Calls the remote method. + Console::WriteLine(); + Console::WriteLine( "Calling remote Object" ); + Console::WriteLine( service->HelloMethod( "Caveman" ) ); + Console::WriteLine( service->HelloMethod( "Spaceman" ) ); + Console::WriteLine( service->HelloMethod( "Client Man" ) ); + Console::WriteLine( "Finished remote Object call" ); + } + catch (Exception ex) + { + Console::WriteLine("An exception occurred: " + ex.Message); + } + Console::WriteLine(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp new file mode 100644 index 00000000000..f11b436af12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/server.cpp @@ -0,0 +1,21 @@ + + +// +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); + RemotingConfiguration::RegisterActivatedServiceType( HelloServiceClass::typeid ); + Console::WriteLine( "Press enter to stop this process." ); + Console::ReadLine(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp new file mode 100644 index 00000000000..75ffaf57d8f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ClientActivation/CPP/service.cpp @@ -0,0 +1,36 @@ + + +// +#using + +using namespace System; + +public ref class HelloServiceClass: public MarshalByRefObject +{ +private: + static int n_instance; + +public: + HelloServiceClass() + { + n_instance++; + Console::WriteLine( "{0} has been created. Instance # = {1}", this->GetType()->Name, n_instance ); + } + + ~HelloServiceClass() + { + Console::WriteLine( "Destroyed instance {0} of HelloServiceClass.", n_instance ); + n_instance--; + } + + String^ HelloMethod( String^ name ) + { + // Reports that the method was called. + Console::WriteLine(); + Console::WriteLine( "Called HelloMethod on instance {0} with the '{1}' parameter.", n_instance, name ); + + // Calculates and returns the result to the client. + return String::Format( "Hi there {0}", name ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp new file mode 100644 index 00000000000..a7646f3ab1c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation/CPP/server.cpp @@ -0,0 +1,61 @@ +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +public ref class HelloServer: public MarshalByRefObject +{ +private: + static int n_called = 0; + +public: + static void Main() + { +// +// + // Registers the server and waits until the user hits enter. + TcpChannel^ chan = gcnew TcpChannel( 8084 ); + ChannelServices::RegisterChannel( chan ); + + RemotingConfiguration::RegisterWellKnownServiceType( + Type::GetType( "HelloServer,server" ), + "SayHello", + WellKnownObjectMode::SingleCall ); + System::Console::WriteLine( L"Hit to exit..." ); + System::Console::ReadLine(); +// +// + } + + HelloServer() + { + Console::WriteLine( "HelloServer activated" ); + } + + ~HelloServer() + { + Console::WriteLine( "Object Destroyed" ); + } + + String^ HelloMethod( String^ name ) + { + // Reports that the method was called. + Console::WriteLine(); + Console::WriteLine( "Hello.HelloMethod : {0}", name ); + n_called++; + Console::WriteLine( "The method was called {0} times.", n_called ); + + // Calculates and returns the result to the client. + return String::Format( "Hi there {0}", name ); + } +}; +// + +int main() +{ + HelloServer::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp new file mode 100644 index 00000000000..4a3d08ad8ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/client.cpp @@ -0,0 +1,38 @@ + + +// +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Channels; +int main() +{ + // + // + ChannelServices::RegisterChannel( gcnew TcpChannel ); + RemotingConfiguration::RegisterWellKnownClientType( HelloService::typeid, + "tcp://localhost:8082/HelloServiceApplication/MyUri" ); + HelloService ^ service = gcnew HelloService; + // + // + if ( service == nullptr ) + { + Console::WriteLine( "Could not locate server." ); + return -1; + } + + // Calls the remote method. + Console::WriteLine(); + Console::WriteLine( "Calling remote Object*" ); + Console::WriteLine( service->HelloMethod( "Caveman" ) ); + Console::WriteLine( service->HelloMethod( "Spaceman" ) ); + Console::WriteLine( service->HelloMethod( "Client Man" ) ); + Console::WriteLine( "Finished remote Object* call" ); + Console::WriteLine(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp new file mode 100644 index 00000000000..35c1d834e80 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/server.cpp @@ -0,0 +1,27 @@ + + +// +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +int main() +{ + // + // + ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); + RemotingConfiguration::ApplicationName = "HelloServiceApplication"; + RemotingConfiguration::RegisterWellKnownServiceType( HelloService::typeid, + "MyUri", + WellKnownObjectMode::SingleCall ); + // + // + Console::WriteLine( "Press enter to stop this process." ); + Console::ReadLine(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp new file mode 100644 index 00000000000..f8d912e49bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration.ServerActivation1/CPP/service.cpp @@ -0,0 +1,34 @@ + + +// +#using + +using namespace System; +public ref class HelloService: public MarshalByRefObject +{ +private: + static int n_instances; + +public: + HelloService() + { + n_instances++; + Console::WriteLine( "" ); + Console::WriteLine( "HelloService activated - instance # {0}.", n_instances ); + } + + ~HelloService() + { + Console::WriteLine( "HelloService instance {0} destroyed.", n_instances ); + n_instances--; + } + + String^ HelloMethod( String^ name ) + { + Console::WriteLine( "HelloMethod called on HelloService instance {0}.", n_instances ); + return String::Format( "Hi there {0}.", name ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp new file mode 100644 index 00000000000..122bcd549e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_Configure_Client/CPP/remotingconfiguration_configure_server.cpp @@ -0,0 +1,40 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.Configure +// System.Runtime.Remoting.RemotingConfiguration.GetRegisteredWellKnownServiceTypes +/* + The following example demonstrates the 'Configure' and + 'GetRegisteredWellKnownServiceTypes' methods of 'RemotingConfiguration' class. + It configures the remoting infrastructure using the 'Configure' method.Then gets + the registered well-known objects at the service end and displays it's properties + on the console. +*/ +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Channels::Http; + +int main() +{ + // + // Configure the remoting structure. + RemotingConfiguration::Configure( "server.config" ); + // + + // + // Retrive the array of objects registered as well known types at + // the service end. + array^myEntries = RemotingConfiguration::GetRegisteredWellKnownServiceTypes(); + Console::WriteLine( "The number of WellKnownServiceTypeEntries are:{0}", myEntries->Length ); + Console::WriteLine( "The Object Type is:{0}", myEntries[ 0 ]->ObjectType ); + Console::WriteLine( "The Object Uri is:{0}", myEntries[ 0 ]->ObjectUri ); + Console::WriteLine( "The Mode is:{0}", myEntries[ 0 ]->Mode ); + // + + Console::WriteLine( "Press to exit..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp new file mode 100644 index 00000000000..8853fd1bced --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredActivatedServer_Client/CPP/RemotingConfiguration_GetRegisteredActivatedService_server.cpp @@ -0,0 +1,44 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.IsActivationAllowed +// System.Runtime.Remoting.RemotingConfiguration.GetRegisteredActivatedServiceTypes +/* +The following example demonstrates the 'IsActivationAllowed' and +'GetRegisteredActivatedServiceTypes' methods of 'RemotingConfiguration' class. +It registers a 'TcpChannel' object with the channel services. Then registers the 'MyServerImpl' +object at the service end that can be activated on request from a client.By using the +'GetRegisteredActivatedClientTypes' method it gets the registered activated service types +and displays it's properties to the console. + +*/ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel( 8085 ) ); + RemotingConfiguration::RegisterActivatedServiceType( MyServerImpl::typeid ); + + // + // + // Check whether the 'MyServerImpl' object is allowed for + // activation or not. + if ( RemotingConfiguration::IsActivationAllowed( MyServerImpl::typeid ) ) + { + // Get the registered activated service types . + array^myActivatedServiceEntries = RemotingConfiguration::GetRegisteredActivatedServiceTypes(); + Console::WriteLine( "The Length of the registered activated service type array is {0}", myActivatedServiceEntries->Length ); + Console::WriteLine( "The Object type is:{0}", myActivatedServiceEntries[ 0 ]->ObjectType ); + } + // + // + + Console::WriteLine( "Press enter to stop this process." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp new file mode 100644 index 00000000000..e149f6b0fb6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_GetRegisteredWellKnownClient_Client/CPP/remotingconfiguration_getregisteredwellknownclient_client.cpp @@ -0,0 +1,36 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.GetRegisteredWellKnownClientTypes +/* +The following example demonstrates the 'GetRegisteredWellKnownClientTypes' method +of 'RemotingConfiguration' class. +It registers a 'TcpChannel' object with the channel services. Then registers the +'MyServerImpl' object as well-known type at the client end. By using the +'GetRegisteredWellKnownClientTypes' method it gets well-known types registered +at the client side and displays it's properties to the console. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +int main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel ); + + // Register the specified object as well-known type at client end. + RemotingConfiguration::RegisterWellKnownClientType( MyServerImpl::typeid, "tcp://localhost:8085/SayHello" ); + MyServerImpl ^ myObject = gcnew MyServerImpl; + Console::WriteLine( myObject->MyMethod( "ClientString" ) ); + + // + // Get the well-known types registered at the client. + array^myEntries = RemotingConfiguration::GetRegisteredWellKnownClientTypes(); + Console::WriteLine( "The number of WellKnownClientTypeEntries are:{0}", myEntries->Length ); + Console::WriteLine( "The Object type is:{0}", myEntries[ 0 ]->ObjectType ); + Console::WriteLine( "The Object Url is:{0}", myEntries[ 0 ]->ObjectUrl ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp new file mode 100644 index 00000000000..39c71256e28 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType1_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype1_client.cpp @@ -0,0 +1,43 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.IsRemotelyActivatedClientType(Type) +/* +The following example demonstrates the 'IsRemotelyActivatedClientType(Type)' method +of 'RemotingConfiguration' class. +It registers a 'TcpChannel' object with the channel services. Then registers the 'MyServerImpl' +object as activated client type which can be activated at the server. By using the above +method it gets the activated client type registered at the client side and displays it's +properties to the console. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +int main() +{ + try + { + ChannelServices::RegisterChannel( gcnew TcpChannel, false ); + RemotingConfiguration::RegisterActivatedClientType( MyServerImpl::typeid, "tcp://localhost:8085" ); + MyServerImpl ^ myObject = gcnew MyServerImpl; + for ( int i = 0; i <= 4; i++ ) + Console::WriteLine( myObject->MyMethod( String::Format( "invoke the server method {0} time.", (i + 1) ) ) ); + + // + // Check whether the 'MyServerImpl' type is registered as + // a remotely activated client type. + ActivatedClientTypeEntry^ myActivatedClientEntry = RemotingConfiguration::IsRemotelyActivatedClientType( MyServerImpl::typeid); + Console::WriteLine( "The Object type is {0}", myActivatedClientEntry->ObjectType ); + Console::WriteLine( "The Application Url is {0}", myActivatedClientEntry->ApplicationUrl ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp new file mode 100644 index 00000000000..ee5aae8ca7c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsRemotelyActivatedClientType2_Client/CPP/remotingconfiguration_isremotelyactivatedclienttype2_client.cpp @@ -0,0 +1,52 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.IsRemotelyActivatedClientType(String,String) +/* +The following example demonstrates the 'IsRemotelyActivatedClientType(String,String)' method +of 'RemotingConfiguration' class. +It registers a 'TcpChannel' object with the channel services. Then registers the 'MyServerImpl' +object as activated client type which can be activated at the server and displays it's +properties to the console. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + try + { + ChannelServices::RegisterChannel( gcnew TcpChannel, false ); + RemotingConfiguration::RegisterActivatedClientType( MyServerImpl::typeid, "tcp://localhost:8085" ); + MyServerImpl ^ myObject = gcnew MyServerImpl; + for ( int i = 0; i <= 4; i++ ) + Console::WriteLine( myObject->MyMethod( "invoke the server method " ) ); + + // Get the assembly for the 'MyServerImpl' object. + // + Assembly^ myAssembly = Assembly::GetAssembly( MyServerImpl::typeid ); + AssemblyName^ myName = myAssembly->GetName(); + + // Check whether the 'MyServerImpl' type is registered as + // a remotely activated client type. + ActivatedClientTypeEntry^ myActivatedClientEntry = + RemotingConfiguration::IsRemotelyActivatedClientType( MyServerImpl::typeid->FullName, myName->Name ); + Console::WriteLine( "The Object type : {0}", myActivatedClientEntry->ObjectType ); + Console::WriteLine( "The Application Url : {0}", myActivatedClientEntry->ApplicationUrl ); + if (myActivatedClientEntry) + Console::WriteLine( "The object is client activated"); + else + Console::WriteLine("The object is not client activated"); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp new file mode 100644 index 00000000000..00ffa473c27 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType1_Client/CPP/remotingconfiguration_iswellknownclienttype1_client.cpp @@ -0,0 +1,37 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.IsWellKnownClientType(Type) +/* +The following example demonstrates the 'IsWellKnownClientType(Type)' method +of 'RemotingConfiguration' class. It registers a 'TcpChannel' object with the channel +services. Then registers the 'MyServerImpl' object as well-known type. By using the above +method it gets the well-known type registered at the client side and displays it's +properties to the console. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel, false ); + + // Register the 'MyServerImpl' object as well known type + // at client end. + RemotingConfiguration::RegisterWellKnownClientType( MyServerImpl::typeid, "tcp://localhost:8085/SayHello" ); + MyServerImpl ^ myObject = gcnew MyServerImpl; + Console::WriteLine( myObject->MyMethod( "ClientString" ) ); + + // + // Check whether the specified object type is registered as + // well known client type or not. + WellKnownClientTypeEntry^ myWellKnownClientType = RemotingConfiguration::IsWellKnownClientType( MyServerImpl::typeid ); + Console::WriteLine( "The Object type is {0}", myWellKnownClientType->ObjectType ); + Console::WriteLine( "The Object Url is {0}", myWellKnownClientType->ObjectUrl ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp new file mode 100644 index 00000000000..ba0e93af1f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingConfiguration_IsWellKnownClientType2_Client/CPP/remotingconfiguration_iswellknownclienttype2_client.cpp @@ -0,0 +1,42 @@ + + +// System.Runtime.Remoting.RemotingConfiguration.IsWellKnownClientType(String,String) +/* +The following example demonstrates the 'IsWellKnownClientType(String,String)' method +of 'RemotingConfiguration' class. It registers a 'TcpChannel' object with the channel +services. Then registers the 'MyServerImpl' object as well-known type at the client end. +and displays it's properties to the console. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel, false ); + + // Register the 'MyServerImpl' object as well known type + // at client end. + RemotingConfiguration::RegisterWellKnownClientType( MyServerImpl::typeid, "tcp://localhost:8085/SayHello" ); + + // + MyServerImpl ^ myObject = gcnew MyServerImpl; + + // Get the assembly for the 'MyServerImpl' object. + Assembly^ myAssembly = Assembly::GetAssembly( MyServerImpl::typeid ); + AssemblyName^ myName = myAssembly->GetName(); + + // Check whether the specified object type is registered as + // well-known client type. + WellKnownClientTypeEntry^ myWellKnownClientType = RemotingConfiguration::IsWellKnownClientType( MyServerImpl::typeid->FullName, myName->Name ); + Console::WriteLine( "The Object type :{0}", myWellKnownClientType->ObjectType ); + Console::WriteLine( "The Object Uri :{0}", myWellKnownClientType->ObjectUrl ); + // + Console::WriteLine( myObject->MyMethod( "Remote method is called." ) ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp new file mode 100644 index 00000000000..d1b75b89c64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices IsObject Snippets/CPP/class1.cpp @@ -0,0 +1,56 @@ + + +#using + +using namespace System; +using namespace System::Runtime::Remoting; + +namespace TempConverter +{ + public ref class Converter: public MarshalByRefObject{}; + +} + +ref class Client +{ +public: + void RunSnippet() + { + // + // Create a remote version of TempConverter::Converter. + TempConverter::Converter^ converter1 = + dynamic_cast(Activator::GetObject( + TempConverter::Converter::typeid, + "http://localhost:8085/TempConverter" )); + + // Create a local version of TempConverter::Converter. + TempConverter::Converter^ converter2 = gcnew TempConverter::Converter; + + // Returns true, converter1 is remote and in a different appdomain. + System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter1 ); + + // Returns false, converter2 is local and running in this appdomain. + System::Runtime::Remoting::RemotingServices::IsObjectOutOfAppDomain( converter2 ); + + // Returns true, converter1 is remote and in a different context. + System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter1 ); + + // Returns false, converter2 is local and running in this context. + System::Runtime::Remoting::RemotingServices::IsObjectOutOfContext( converter2 ); + // + + // Print those function calls. + System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfAppDomain( converter1 ) ); + System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfAppDomain( converter2 ) ); + System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfContext( converter1 ) ); + System::Console::WriteLine( " {0}", RemotingServices::IsObjectOutOfContext( converter2 ) ); + } +}; + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + Client^ client = gcnew Client; + client->RunSnippet(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp new file mode 100644 index 00000000000..0bfe3822e74 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/basicclient.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace SampleNamespace; +using namespace System::Security::Permissions; + +public ref class SampleClient +{ +private: + static const String^ SERVER_URL = "http://localhost:9000/MySampleService/SampleWellKnown.soap"; + +public: + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::RemotingConfiguration)] + static void Snippet1() + { + // + Console::WriteLine( "Connecting to SampleNamespace::SampleWellKnown." ); + SampleWellKnown ^ proxy = dynamic_cast(RemotingServices::Connect( SampleWellKnown::typeid, const_cast(SERVER_URL) )); + Console::WriteLine( "Connected to SampleWellKnown" ); + + // Verifies that the Object* reference is to a transparent proxy. + if ( RemotingServices::IsTransparentProxy( proxy ) ) + Console::WriteLine( "proxy is a reference to a transparent proxy." ); + else + Console::WriteLine( "proxy is not a transparent proxy. This is unexpected." ); + + // Calls a method on the server Object*. + Console::WriteLine( "proxy->Add returned {0}.", proxy->Add( 2, 3 ) ); + // + } + +}; + +int main() +{ + SampleClient::Snippet1(); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp new file mode 100644 index 00000000000..d526055447a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.BasicSample/CPP/manualserver.cpp @@ -0,0 +1,33 @@ + + +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace SampleNamespace; + +// Note: this snippet is based on v-ralphs' Dynamic Remoting sample. +int main() +{ + // + TcpChannel^ channel = gcnew TcpChannel( 9000 ); + ChannelServices::RegisterChannel( channel ); + SampleWellKnown ^ objectWellKnown = gcnew SampleWellKnown; + + // After the channel is registered, the Object* needs to be registered + // with the remoting infrastructure. So, Marshal is called. + ObjRef^ objrefWellKnown = RemotingServices::Marshal( objectWellKnown, "objectWellKnownUri" ); + Console::WriteLine( "An instance of SampleWellKnown type is published at {0}.", objrefWellKnown->URI ); + Console::WriteLine( "Press enter to unregister SampleWellKnown, so that it is no longer available on this channel." ); + Console::ReadLine(); + RemotingServices::Disconnect( objectWellKnown ); + Console::WriteLine( "Press enter to end the server process." ); + Console::ReadLine(); + // + + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp new file mode 100644 index 00000000000..79aaac386f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.ExecuteMessage/CPP/serviceclass.cpp @@ -0,0 +1,153 @@ + + +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Diagnostics; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Contexts; +using namespace System::Runtime::Remoting::Channels; + +public ref class SampleService: public ContextBoundObject +{ +public: + bool UpdateServer( int i, double d, String^ s ) + { + Console::WriteLine( "SampleService::UpdateServer called: {0}, {1}, {2}", i, d, s ); + return true; + } + +}; + +public ref class ReplicationSink: public IDynamicMessageSink +{ +private: + static const String^ replicatedServiceUri = "/SampleServiceUri"; + static const String^ replicationServerUrl = "tcp://localhost:9001"; + +public: + + // System::Runtime::Remoting::RemotingServices.ExecuteMessage + // System::Runtime::Remoting::RemotingServices.GetSessionIdForMethodMessage + // + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual void ProcessMessageStart( IMessage^ requestMessage, bool /*bClientSide*/, bool /*bAsyncCall*/ ) + { + Console::WriteLine( "\nProcessMessageStart" ); + Console::WriteLine( "requestMessage = {0}", requestMessage ); + try + { + Console::WriteLine( "SessionId = {0}.", RemotingServices::GetSessionIdForMethodMessage( dynamic_cast(requestMessage) ) ); + } + catch ( InvalidCastException^ ) + { + Console::WriteLine( "The requestMessage is not an IMethodMessage*." ); + } + + IMethodCallMessage^ requestMethodCallMessage; + try + { + requestMethodCallMessage = dynamic_cast(requestMessage); + + // Prints the details of the IMethodCallMessage* to the console. + Console::WriteLine( "\nMethodCall details" ); + Console::WriteLine( "Uri = {0}", requestMethodCallMessage->Uri ); + Console::WriteLine( "TypeName = {0}", requestMethodCallMessage->TypeName ); + Console::WriteLine( "MethodName = {0}", requestMethodCallMessage->MethodName ); + Console::WriteLine( "ArgCount = {0}", requestMethodCallMessage->ArgCount ); + Console::WriteLine( "MethodCall::Args" ); + IEnumerator^ myEnum = requestMethodCallMessage->Args->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "\t {0}", o ); + + // Sends this method call message to another server to replicate + // the call at the second server. + if ( requestMethodCallMessage->Uri == replicatedServiceUri ) + { + String^ repSvr = String::Format( "{0}{1}", const_cast(replicationServerUrl), const_cast(replicatedServiceUri) ); + SampleService^ replicationService = dynamic_cast(Activator::GetObject( SampleService::typeid, repSvr )); + IMethodReturnMessage^ returnMessage = RemotingServices::ExecuteMessage( replicationService, requestMethodCallMessage ); + + // Prints the results of the method call stored in the IMethodReturnMessage*. + Console::WriteLine( "\nMessage returned by ExecuteMessage." ); + Console::WriteLine( "\tException = {0}", returnMessage->Exception ); + Console::WriteLine( "\tReturnValue = {0}", returnMessage->ReturnValue ); + Console::WriteLine( "\tOutArgCount = {0}", returnMessage->OutArgCount ); + Console::WriteLine( "Return message OutArgs" ); + IEnumerator^ myEnum = requestMethodCallMessage->Args->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "\t {0}", o ); + } + } + } + } + catch ( InvalidCastException^ ) + { + Console::WriteLine( "The requestMessage is not a MethodCall" ); + } + } + // + + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual void ProcessMessageFinish( IMessage^ requestMessage, bool /*bClientSide*/, bool /*bAsyncCall*/ ) + { + Console::WriteLine( "\nProcessMessageFinish" ); + Console::WriteLine( "requestMessage = {0}", requestMessage ); + ReturnMessage^ requestMethodReturn; + try + { + requestMethodReturn = static_cast(requestMessage); + + // Print the details of the ReturnMessage to the console + Console::WriteLine( "\nReturnMessage details" ); + Console::WriteLine( "\tException = {0}", requestMethodReturn->Exception ); + Console::WriteLine( "\tReturnValue = {0}", requestMethodReturn->ReturnValue ); + Console::WriteLine( "\tOutArgCount = {0}", requestMethodReturn->OutArgCount ); + Console::WriteLine( "Return message OutArgs" ); + IEnumerator^ myEnum = requestMethodReturn->Args->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "\t {0}", o ); + } + } + catch ( InvalidCastException^ ) + { + Console::WriteLine( "The requestMessage is not a ReturnMessage." ); + } + } +}; + +public ref class ReplicationSinkProp: public IDynamicProperty, public IContributeDynamicSink +{ +public: + + property String^ Name + { + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual String^ get() + { + return "ReplicationSinkProp"; + } + } + [System::Security::Permissions::SecurityPermissionAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, + Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] + virtual IDynamicMessageSink^ GetDynamicSink() + { + return gcnew ReplicationSink; + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp new file mode 100644 index 00000000000..b8502b5c48b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.GetObjRefForProxy/CPP/client.cpp @@ -0,0 +1,54 @@ + + +#using +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Net::Sockets; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Lifetime; +using namespace System::Collections; +using namespace SampleNamespace; + +int main() +{ + ChannelServices::RegisterChannel( gcnew HttpChannel( 0 ), false ); + RemotingConfiguration::RegisterActivatedClientType( SampleService::typeid, "http://localhost:9000/MySampleService" ); + SampleService ^ myRemoteObject = gcnew SampleService; + bool result = myRemoteObject->SampleMethod(); + + // System::Runtime::Remoting::RemotingServices.GetObjRefForProxy + // + ObjRef^ objRefSample = RemotingServices::GetObjRefForProxy( myRemoteObject ); + Console::WriteLine( "***ObjRef Details***" ); + Console::WriteLine( "URI:\t {0}", objRefSample->URI ); + array^channelData = objRefSample->ChannelInfo->ChannelData; + Console::WriteLine( "Channel Info:" ); + IEnumerator^ myEnum = channelData->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ o = safe_cast(myEnum->Current); + Console::WriteLine( "\t {0}", o ); + } + + IEnvoyInfo^ envoyInfo = objRefSample->EnvoyInfo; + if ( envoyInfo == nullptr ) + { + Console::WriteLine( "This ObjRef does not have envoy information." ); + } + else + { + IMessageSink^ envoySinks = envoyInfo->EnvoySinks; + Console::WriteLine( "Envoy Sink Class: {0}", envoySinks ); + } + + IRemotingTypeInfo^ typeInfo = objRefSample->TypeInfo; + Console::WriteLine( "Remote type name: {0}", typeInfo->TypeName ); + Console::WriteLine( "Can my Object* cast to a Bitmap? {0}", typeInfo->CanCastTo( System::Drawing::Bitmap::typeid, objRefSample ) ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp new file mode 100644 index 00000000000..590b94dffc7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.TimerSample/CPP/timerclient.cpp @@ -0,0 +1,75 @@ +// System::Runtime::Remoting::RemotingServices.GetLifetimeService +// This sample is of a remote client for a group coffee timer. +// Since the client must stay connected to a stateful server object +// for minutes without calling it, it needs to register as a sponsor +// of the lease to prevent the server from being collected. +// Multiple clients can connect to the same timer object, and receive +// notification when the timer expires. +// System::Runtime::Remoting::RemotingServices.GetLifetimeService +// +#using +#using +#using "timerservice.dll" + +using namespace System; +using namespace System::Net::Sockets; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Lifetime; +using namespace TimerSample; +using namespace System::Security::Permissions; + +namespace GroupCoffeeTimer +{ + public ref class TimerClient: public MarshalByRefObject, public ISponsor + { + public: + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + TimerClient() + { + // Registers the HTTP Channel so that this client can receive + // events from the remote service. + ChannelServices::RegisterChannel( gcnew HttpChannel( 0 ), false ); + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( TimerService::typeid,"http://localhost:9000/MyService/TimerService.soap" ); + RemotingConfiguration::RegisterWellKnownClientType( remoteType ); + TimerService^ groupTimer = gcnew TimerService; + groupTimer->MinutesToTime = 4.0; + + // Registers this client as a lease sponsor so that it can + // prevent the expiration of the TimerService. + ILease^ leaseObject = dynamic_cast(RemotingServices::GetLifetimeService( groupTimer )); + leaseObject->Register( this ); + + // Subscribes to the event so that the client can receive notifications from the server. + groupTimer->TimerExpired += gcnew TimerExpiredEventHandler( this, &TimerClient::OnTimerExpired ); + Console::WriteLine( "Connected to TimerExpired event" ); + groupTimer->Start(); + Console::WriteLine( "Timer started for {0} minutes.", groupTimer->MinutesToTime ); + Console::WriteLine( "Press enter to end the client process." ); + Console::ReadLine(); + } + + private: + void OnTimerExpired( Object^, TimerServiceEventArgs^ e ) + { + Console::WriteLine( "TimerHelper::OnTimerExpired: {0}", e->Message ); + } + public: + [System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] + virtual TimeSpan Renewal( ILease^ ) + { + Console::WriteLine( "TimerClient: Renewal called." ); + return TimeSpan::FromMinutes( 0.5 ); + } + }; +} + +int main() +{ + using namespace GroupCoffeeTimer; + gcnew TimerClient; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp new file mode 100644 index 00000000000..d7f3d4b569d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/RemotingServices.Unmarshal/CPP/client.cpp @@ -0,0 +1,39 @@ +// System::Runtime::Remoting::RemotingServices.GetLifetimeService +// This sample is of a remote client for a group coffee timer. +// Since the client must stay connected to a stateful server Object* +// for minutes with->Item[Out] calling* it, it needs to register as a sponsor +// of the lease to prevent the server from being collected. +// Multiple clients can connect to the same timer Object*, and receive +// notification when the timer expires. + +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Net::Sockets; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Lifetime; +using namespace SampleNamespace; + +int main() +{ + // System::Runtime::Remoting::RemotingServices.Unmarshal + // + ChannelServices::RegisterChannel( gcnew HttpChannel ); + + SampleService ^ objectSample = (SampleService^)( Activator::GetObject( SampleService::typeid, + "http://localhost:9000/MySampleService/SampleService.soap" ) ); + + // The GetManuallyMarshaledObject() method uses RemotingServices::Marshal() + // to create an ObjRef object for a SampleTwo object. + ObjRef^ objRefSampleTwo = objectSample->GetManuallyMarshaledObject(); + + SampleTwo ^ objectSampleTwo = (SampleTwo^)( RemotingServices::Unmarshal( objRefSampleTwo ) ); + + objectSampleTwo->PrintMessage( "ObjRef successfuly unmarshaled." ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp new file mode 100644 index 00000000000..a25a8b273ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/client.cpp @@ -0,0 +1,33 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +public ref class Client +{ +public: + void ClientTest() + { + // + IpcClientChannel^ clientChannel = gcnew IpcClientChannel; + ChannelServices::RegisterChannel( clientChannel ); + // + + RemotingConfiguration::RegisterWellKnownClientType( Counter::typeid, L"ipc://remote/counter" ); + Counter^ counter = gcnew Counter; + Console::WriteLine( L"This is call number {0}.", counter->Count ); + } +}; + +int main() +{ + Client^ c = gcnew Client; + c->ClientTest(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp new file mode 100644 index 00000000000..57f389d01b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/counter.cpp @@ -0,0 +1,24 @@ + +// Counter.cs +// +using namespace System; +public ref class Counter: public MarshalByRefObject +{ +private: + int count; + +public: + Counter() + { + count = 0; + } + + property int Count + { + int get() + { + return (count)++; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp new file mode 100644 index 00000000000..3e9a5712ad1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_Ipc/CPP/server.cpp @@ -0,0 +1,40 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +public ref class IpcServer +{ +public: + void IpcServerTest() + { + // + // Create and register an IPC channel + IpcServerChannel^ serverChannel = gcnew IpcServerChannel( L"remote" ); + ChannelServices::RegisterChannel( serverChannel ); + // + + // Expose an object + RemotingConfiguration::RegisterWellKnownServiceType( Counter::typeid, L"counter", WellKnownObjectMode::Singleton ); + + // Wait for calls + // + Console::WriteLine( L"Listening on {0}", serverChannel->GetChannelUri() ); + // + + Console::ReadLine(); + } +}; + +int main() +{ + IpcServer^ is = gcnew IpcServer; + is->IpcServerTest(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp new file mode 100644 index 00000000000..849a76f616e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/clientsink.cpp @@ -0,0 +1,142 @@ + +// +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; + +[System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] +public ref class ClientSink: public BaseChannelSinkWithProperties, public IClientChannelSink +{ +private: + + // This class inherits from BaseChannelSinkWithPropertes + // to get an implementation of IChannelSinkBase. + // + // The next sink in the chain. + IClientChannelSink^ nextSink; + // + + + // +public: + property IClientChannelSink^ NextChannelSink + { + virtual IClientChannelSink^ get() + { + return (nextSink); + } + } + // + + // + virtual Stream^ GetRequestStream( IMessage^ message, ITransportHeaders^ requestHeaders ) + { + // Get the request stream from the next sink in the chain. + return (nextSink->GetRequestStream( message, requestHeaders )); + } + // + + // + virtual void ProcessMessage( IMessage^ message, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) + { + // Print the request message properties. + Console::WriteLine( "---- Message from the client ----" ); + IDictionary^ dictionary = message->Properties; + IEnumerator^ myEnum = dictionary->Keys->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ key = safe_cast(myEnum->Current); + Console::WriteLine( "{0} = {1}", key, dictionary[ key ] ); + } + + Console::WriteLine( "---------------------------------" ); + + // Hand off to the next sink in the chain. + nextSink->ProcessMessage( message, requestHeaders, requestStream, responseHeaders, responseStream ); + } + // + + // + // For synchronous remoting, it is not necessary to implement this method. + virtual void AsyncProcessRequest( IClientChannelSinkStack^ /*sinkStack*/, IMessage^ /*message*/, ITransportHeaders^ /*requestHeaders*/, Stream^ /*requestStream*/ ) + { + throw gcnew NotImplementedException; + } + // + + // + virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, ITransportHeaders^ /*responseHeaders*/, Stream^ /*responseStream*/ ) + { + throw gcnew NotImplementedException; + } + + // + property System::Collections::IDictionary^ Properties + { + virtual System::Collections::IDictionary^ get() override + { + return (dynamic_cast(this))->Properties; + } + } + + // Constructor + ClientSink( IClientChannelSink^ sink ) + { + if ( sink == nullptr ) + throw gcnew ArgumentNullException( "sink" ); + + nextSink = sink; + } +}; +// + +// +[System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] +public ref class ClientSinkProvider: public IClientChannelSinkProvider +{ +private: + + // + // The next provider in the chain. + IClientChannelSinkProvider^ nextProvider; + // + + // +public: + property IClientChannelSinkProvider^ Next + { + virtual IClientChannelSinkProvider^ get() + { + return (nextProvider); + } + + virtual void set( IClientChannelSinkProvider^ value ) + { + nextProvider = value; + } + } + // + + // + virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ url, Object^ remoteChannelData ) + { + Console::WriteLine( "Creating ClientSink for {0}", url ); + + // Create the next sink in the chain. + IClientChannelSink^ nextSink = nextProvider->CreateSink( channel, url, remoteChannelData ); + + // Hook our sink up to it. + return (gcnew ClientSink( nextSink )); + } + // + + // This constructor is required in order to use the provider in file-based configuration. + // It need not do anything unless you want to use the information in the parameters. + ClientSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp new file mode 100644 index 00000000000..93da1a676ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_Sinks/CPP/serversink.cpp @@ -0,0 +1,137 @@ + +// +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; + +[System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] +public ref class ServerSink: public BaseChannelSinkWithProperties, public IServerChannelSink +{ +private: + + // This class inherits from BaseChannelSinkWithPropertes + // to get an implementation of IChannelSinkBase. + // + // The next sink in the chain. + IServerChannelSink^ nextSink; + // + + // +public: + property IServerChannelSink^ NextChannelSink + { + virtual IServerChannelSink^ get() + { + return (nextSink); + } + } + // + + // + virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*message*/, ITransportHeaders^ /*responseHeaders*/ ) + { + return nullptr; + } + // + + // + virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMessage, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% responseMessage, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) + { + // Hand off to the next sink for processing. + sinkStack->Push( this, nullptr ); + ServerProcessing status = nextSink->ProcessMessage( sinkStack, requestMessage, requestHeaders, requestStream, responseMessage, responseHeaders, responseStream ); + + // Print the response message properties. + Console::WriteLine( "---- Message from the server ----" ); + IDictionary^ dictionary = ( *responseMessage).Properties; + IEnumerator^ myEnum = dictionary->Keys->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ key = safe_cast(myEnum->Current); + Console::WriteLine( "{0} = {1}", key, dictionary[ key ] ); + } + + Console::WriteLine( "---------------------------------" ); + return (status); + } + // + + // + virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*message*/, ITransportHeaders^ /*responseHeaders*/, Stream^ /*responseStream*/ ) + { + throw gcnew NotImplementedException; + } + // + + property System::Collections::IDictionary^ Properties + { + virtual System::Collections::IDictionary^ get() override + { + return (dynamic_cast(this))->Properties; + } + } + + // Constructor + ServerSink( IServerChannelSink^ sink ) + { + if ( sink == nullptr ) + throw gcnew ArgumentNullException( "sink" ); + + nextSink = sink; + } +}; +// + +// +[System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] +public ref class ServerSinkProvider: public IServerChannelSinkProvider +{ + // + // The next provider in the chain. +private: + IServerChannelSinkProvider^ nextProvider; + // + + // +public: + property IServerChannelSinkProvider^ Next + { + virtual IServerChannelSinkProvider^ get() + { + return (nextProvider); + } + + virtual void set( IServerChannelSinkProvider^ value ) + { + nextProvider = value; + } + } + // + + // + virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel ) + { + Console::WriteLine( "Creating ServerSink" ); + + // Create the next sink in the chain. + IServerChannelSink^ nextSink = nextProvider->CreateSink( channel ); + + // Hook our sink up to it. + return (gcnew ServerSink( nextSink )); + } + // + + // + virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){} + // + + // This constructor is required in order to use the provider in file-based configuration. + // It need not do anything unless you want to use the information in the parameters. + ServerSinkProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp new file mode 100644 index 00000000000..5b2824ec1ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/client.cpp @@ -0,0 +1,35 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + // + // Specify client channel properties. + IDictionary^ dict = gcnew Hashtable; + dict[ "port" ] = 9090; + dict[ "impersonationLevel" ] = "Identify"; + dict[ "authenticationPolicy" ] = "AuthPolicy, Policy"; + + // Set up a client channel. + TcpClientChannel^ clientChannel = gcnew TcpClientChannel( dict, nullptr ); + ChannelServices::RegisterChannel( clientChannel, false ); + // + + // Obtain a proxy for a remote object. + RemotingConfiguration::RegisterWellKnownClientType( Remotable::typeid, "tcp://localhost:9090/Remotable.rem" ); + + // Call a method on the object. + Remotable ^ remoteObject = gcnew Remotable; + Console::WriteLine( remoteObject->GetMessage() ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp new file mode 100644 index 00000000000..fc2018f899f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpAuth/CPP/server.cpp @@ -0,0 +1,34 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + // + // Specify server channel properties. + IDictionary^ dict = gcnew Hashtable; + dict[ "port" ] = 9090; + dict[ "authenticationMode" ] = "IdentifyCallers"; + + // Set up a server channel. + TcpServerChannel^ serverChannel = gcnew TcpServerChannel( dict, nullptr ); + ChannelServices::RegisterChannel( serverChannel, false ); + + // + // Set up a remote object. + RemotingConfiguration::RegisterWellKnownServiceType( Remotable::typeid, "Remotable.rem", WellKnownObjectMode::Singleton ); + + // Wait for method calls. + Console::WriteLine( "Listening..." ); + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp new file mode 100644 index 00000000000..ced0c327846 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/client.cpp @@ -0,0 +1,35 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +int main() +{ + + // + // Set up a client channel. + TcpClientChannel^ clientChannel = gcnew TcpClientChannel; + ChannelServices::RegisterChannel( clientChannel ); + + // + // + // Show the name and priority of the channel. + Console::WriteLine( "Channel Name: {0}", clientChannel->ChannelName ); + Console::WriteLine( "Channel Priority: {0}", clientChannel->ChannelPriority ); + + // + // Obtain a proxy for a remote object. + RemotingConfiguration::RegisterWellKnownClientType( Remotable::typeid, "tcp://localhost:9090/Remotable.rem" ); + + // Call a method on the object. + Remotable ^ remoteObject = gcnew Remotable; + Console::WriteLine( remoteObject->GetCount() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp new file mode 100644 index 00000000000..81b3b1ffd8f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/remotable.cpp @@ -0,0 +1,22 @@ + +// +using namespace System; +using namespace System::Runtime::Remoting; + +public ref class Remotable: public MarshalByRefObject +{ +private: + int callCount; + +public: + Remotable() + : callCount( 0 ) + {} + + int GetCount() + { + callCount++; + return (callCount); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp new file mode 100644 index 00000000000..7688f7f257e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Remoting_TcpInfo/CPP/server.cpp @@ -0,0 +1,45 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + // + // Set up a server channel. + TcpServerChannel^ serverChannel = gcnew TcpServerChannel( 9090 ); + ChannelServices::RegisterChannel( serverChannel ); + // + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( Remotable::typeid, "Remotable.rem", WellKnownObjectMode::Singleton ); + + // + // Show the name and priority of the channel. + Console::WriteLine( "Channel Name: {0}", serverChannel->ChannelName ); + Console::WriteLine( "Channel Priority: {0}", serverChannel->ChannelPriority ); + // + + // + // Show the URIs associated with the channel. + ChannelDataStore^ data = dynamic_cast(serverChannel->ChannelData); + System::Collections::IEnumerator^ myEnum = data->ChannelUris->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ uri = safe_cast(myEnum->Current); + Console::WriteLine( uri ); + } + // + + // Wait for method calls. + Console::WriteLine( "Listening..." ); + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp b/snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp new file mode 100644 index 00000000000..56b4a19308e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SchemaReference/CPP/schemareference.cpp @@ -0,0 +1,83 @@ + + +// System::Web::Services::Discovery.SchemaReference::SchemaReference() +// System::Web::Services::Discovery.SchemaReference::SchemaReference(String*) +// System::Web::Services::Discovery.SchemaReference::SchemaReference.DefaultFileName +// System::Web::Services::Discovery.SchemaReference::SchemaReference.Namespace +// System::Web::Services::Discovery.SchemaReference::SchemaReference.ReadDocument(stream) +// System::Web::Services::Discovery.SchemaReference::SchemaReference.Schema +// System::Web::Services::Discovery.SchemaReference::SchemaReference.Ref +// System::Web::Services::Discovery.SchemaReference::SchemaReference.TargetNamespace +// System::Web::Services::Discovery.SchemaReference::SchemaReference.Url +// System::Web::Services::Discovery.SchemaReference::SchemaReference.WriteDocument(Object*, stream) +// System::Web::Services::Discovery.SchemaReference::SchemaReference +/* This example demonstrates 'SchemaReference' class, its constructors, 'ReadDocument', +* 'WriteDocument', 'Namespace, 'DefaultFileName', 'Schema', 'Ref', 'TargetNamespace', +* and 'Url' members. A variable of type 'SchemaReference' is taken. An xml schema +* document is passed as parameter to overloaded constructor. All the membes are shown +* using 'SchemaReference' variable. +Note : The dataservice.xsd file should be copied to Inetpub\wwwroot +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Web::Services::Discovery; +int main() +{ + try + { + + // + // Reference the schema document. + String^ myStringUrl = "c:\\Inetpub\\wwwroot\\dataservice.xsd"; + XmlSchema^ myXmlSchema; + + // Create the client protocol. + DiscoveryClientProtocol^ myDiscoveryClientProtocol = gcnew DiscoveryClientProtocol; + myDiscoveryClientProtocol->Credentials = CredentialCache::DefaultCredentials; + + // Create a schema reference. + SchemaReference^ mySchemaReferenceNoParam = gcnew SchemaReference; + SchemaReference^ mySchemaReference = gcnew SchemaReference( myStringUrl ); + + // Set the client protocol. + mySchemaReference->ClientProtocol = myDiscoveryClientProtocol; + + // Access the default file name associated with the schema reference. + Console::WriteLine( "Default filename is : {0}", mySchemaReference->DefaultFilename ); + + // Access the namespace associated with schema reference class. + Console::WriteLine( "Namespace is : {0}", SchemaReference::Namespace ); + FileStream^ myStream = gcnew FileStream( myStringUrl,FileMode::OpenOrCreate ); + + // Read the document in a stream. + mySchemaReference->ReadDocument( myStream ); + + // Get the schema of referenced document. + myXmlSchema = mySchemaReference->Schema; + Console::WriteLine( "Reference is : {0}", mySchemaReference->Ref ); + Console::WriteLine( "Target namespace (default empty) is : {0}", mySchemaReference->TargetNamespace ); + Console::WriteLine( "URL is : {0}", mySchemaReference->Url ); + + // Write the document in the stream. + mySchemaReference->WriteDocument( myXmlSchema, myStream ); + myStream->Close(); + mySchemaReference = nullptr; + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp new file mode 100644 index 00000000000..13bca5b2a43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SelectModeExample/CPP/source.cpp @@ -0,0 +1,65 @@ +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; + +int main() +{ + + //Set up variables and String to write to the server. + Encoding^ ASCII = Encoding::ASCII; + String^ Get = "GET / HTTP/1.1\r\nHost: www.contoso.com" + + "\r\nConnection: Close\r\n\r\n"; + array^ ByteGet = ASCII->GetBytes( Get ); + array^ RecvBytes = gcnew array(256); + String^ strRetPage = nullptr; + + // IPAddress and IPEndPoint represent the endpoint that will + // receive the request. + // Get first IPAddress in list return by DNS. + IPAddress^ hostadd = Dns::GetHostEntry( "www.contoso.com" )->AddressList[ 0 ]; + IPEndPoint^ EPhost = gcnew IPEndPoint( hostadd,80 ); + + // + //Creates the Socket for sending data over TCP. + Socket^ s = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, + ProtocolType::Tcp ); + + // Connects to host using IPEndPoint. + s->Connect( EPhost ); + if ( !s->Connected ) + { + strRetPage = "Unable to connect to host"; + } + // Use the SelectWrite enumeration to obtain Socket status. + if ( s->Poll( -1, SelectMode::SelectWrite ) ) + { + Console::WriteLine( "This Socket is writable." ); + } + else if ( s->Poll( -1, SelectMode::SelectRead ) ) + { + Console::WriteLine( "This Socket is readable." ); + } + else if ( s->Poll( -1, SelectMode::SelectError ) ) + { + Console::WriteLine( "This Socket has an error." ); + } + // + + // Sent the GET text to the host. + s->Send( ByteGet, ByteGet->Length, SocketFlags::None ); + + // Receives the page, loops until all bytes are received. + Int32 bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); + strRetPage = "Default HTML page on www.contoso.com:\r\n"; + strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); + + while ( bytes > 0 ) + { + bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); + strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp b/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp new file mode 100644 index 00000000000..c2507006a55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SerializationAttributes/CPP/s.cpp @@ -0,0 +1,77 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Runtime::Serialization::Formatters::Soap; + +// A test object that needs to be serialized. + +[Serializable] +ref class TestSimpleObject +{ +private: + int member1; + String^ member2; + String^ member3; + double member4; + +public: + + // A field that is not serialized. + + [NonSerialized] + String^ member5; + TestSimpleObject() + { + member1 = 11; + member2 = "hello"; + member3 = "hello"; + member4 = 3.14159265; + member5 = "hello world!"; + } + + void Print() + { + Console::WriteLine( "member1 = ' {0}'", member1 ); + Console::WriteLine( "member2 = ' {0}'", member2 ); + Console::WriteLine( "member3 = ' {0}'", member3 ); + Console::WriteLine( "member4 = ' {0}'", member4 ); + Console::WriteLine( "member5 = ' {0}'", member5 ); + } + +}; + +int main() +{ + // Creates a new TestSimpleObject object. + TestSimpleObject^ obj = gcnew TestSimpleObject; + Console::WriteLine( "Before serialization the Object* contains: " ); + obj->Print(); + + // Opens a file and serializes the object into it in binary format. + Stream^ stream = File::Open( "data.xml", FileMode::Create ); + SoapFormatter^ formatter = gcnew SoapFormatter; + + formatter->Serialize( stream, obj ); + stream->Close(); + + // Empties obj. + obj = nullptr; + + // Opens file S"data.xml" and deserializes the object from it. + stream = File::Open( "data.xml", FileMode::Open ); + formatter = gcnew SoapFormatter; + + obj = dynamic_cast(formatter->Deserialize( stream )); + stream->Close(); + Console::WriteLine( "" ); + Console::WriteLine( "After deserialization the object contains: " ); + obj->Print(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp new file mode 100644 index 00000000000..5dc403fbd36 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceClass/CPP/serviceclass.cpp @@ -0,0 +1,84 @@ +// System.Web.Services.Description.Service + +/* The following sample demonstrates the class 'Service'. This sample reads the +contents of a file 'MathService_cs.wsdl' into a 'ServiceDescription' instance. +It gets the collection of Service instances from 'ServiceDescription'. It +then removes a 'Service' from the collection and creates a new 'Service' and +adds it into collection. It writes a new web service description file 'MathService_New.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +Port^ CreatePort( String^ PortName, String^ BindingName, String^ targetNamespace ) +{ + Port^ myPort = gcnew Port; + myPort->Name = PortName; + myPort->Binding = gcnew XmlQualifiedName( BindingName,targetNamespace ); + + // Create a SoapAddress extensibility element to add to the port. + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/ServiceClass/MathService_CS.asmx"; + myPort->Extensions->Add( mySoapAddressBinding ); + return myPort; +} + +int main() +{ + try + { + // Read a WSDL document. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + ServiceCollection^ myServiceCollection = myServiceDescription->Services; + int noOfServices = myServiceCollection->Count; + Console::WriteLine( "\nTotal number of services: {0}", noOfServices ); + + // Gets a reference to the service. + Service^ myOldService = myServiceCollection[ 0 ]; + Console::WriteLine( "No. of ports in the service: {0}", myServiceCollection[ 0 ]->Ports->Count ); + Console::WriteLine( "These are the ports in the service:" ); + for ( int i = 0; i < myOldService->Ports->Count; i++ ) + Console::WriteLine( "Port name: {0}", myOldService->Ports[ i ]->Name ); + Console::WriteLine( "Service name: {0}", myOldService->Name ); + Service^ myService = gcnew Service; + myService->Name = "MathService"; + + // Add the Ports to the newly created Service. + for ( int i = 0; i < myOldService->Ports->Count; i++ ) + { + String^ PortName = myServiceCollection[ 0 ]->Ports[ i ]->Name; + String^ BindingName = myServiceCollection[ 0 ]->Ports[ i ]->Binding->Name; + myService->Ports->Add( CreatePort( PortName, BindingName, myServiceDescription->TargetNamespace ) ); + } + Console::WriteLine( "Newly created ports -" ); + for ( int i = 0; i < myService->Ports->Count; i++ ) + Console::WriteLine( "Port name: {0}", myOldService->Ports[ i ]->Name ); + + // Add the extensions to the newly created Service. + int noOfExtensions = myOldService->Extensions->Count; + Console::WriteLine( "No. of extensions: {0}", noOfExtensions ); + if ( noOfExtensions > 0 ) + { + for ( int i = 0; i < myOldService->Ports->Count; i++ ) + myService->Extensions->Add( myServiceCollection[ 0 ]->Extensions[ i ] ); + } + + // Remove the service from the collection. + myServiceCollection->Remove( myOldService ); + + // Add the newly created service. + myServiceCollection->Add( myService ); + myServiceDescription->Write( "MathService_New.wsdl" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp new file mode 100644 index 00000000000..8935936e70f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_CopyTo/CPP/servicecollection_copyto.cpp @@ -0,0 +1,111 @@ +// System.Web.Services.Description.ServiceCollection.Contains(Service) +// System.Web.Services.Description.ServiceCollection.IndexOf(service) +// System.Web.Services.Description.ServiceCollection.CopyTo(System[],int) + +/* +The following program demonstrates the methods of +ServiceDescription and ServiceCollection class. An existing WSDL document +is read. An exiting service named "MathService" is removed from the +collection. A new Service object is constructed and added at index 1 of the +Collection .A new WSDL file is created as output. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml; +int main() +{ + try + { + // Read the Existing Wsdl. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "AddSubtractService_CS.wsdl" ); + + // Remove the service named "MathService". + ServiceCollection^ myServiceDescriptionCollection = myServiceDescription->Services; + myServiceDescriptionCollection->Remove( myServiceDescription->Services[ "MathService" ] ); + + // Build a new Service. + Service^ myService = gcnew Service; + myService->Name = "MathService"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); + + // Build a new Port for Soap. + Port^ mySoapPort = gcnew Port; + mySoapPort->Name = "MathServiceSoap"; + mySoapPort->Binding = myXmlQualifiedName; + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/ServiceCollection_CopyTo/AddSubtractService_CS.asmx"; + mySoapPort->Extensions->Add( mySoapAddressBinding ); + + // Build a new Port for HttpGet. + XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); + Port^ myHttpGetPort = gcnew Port; + myHttpGetPort->Name = "MathServiceHttpGet"; + myHttpGetPort->Binding = myXmlQualifiedName2; + HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; + myHttpAddressBinding->Location = "http://localhost/ServiceCollection_CopyTo/AddSubtractService_CS.asmx"; + myHttpGetPort->Extensions->Add( myHttpAddressBinding ); + + // Build a new Port for HttpPost. + XmlQualifiedName^ myXmlQualifiedName3 = gcnew XmlQualifiedName( "s0:MathServiceHttpPost" ); + + // Build a new Port for Soap. + Port^ myHttpPostPort = gcnew Port; + myHttpPostPort->Name = "MathServiceHttpPost"; + myHttpPostPort->Binding = myXmlQualifiedName3; + HttpAddressBinding^ myHttpAddressBinding1 = gcnew HttpAddressBinding; + myHttpAddressBinding1->Location = "http://localhost/ServiceCollection_CopyTo/AddSubtractService_CS.asmx"; + myHttpPostPort->Extensions->Add( myHttpAddressBinding1 ); + + // Add the ports to the service. + myService->Ports->Add( mySoapPort ); + myService->Ports->Add( myHttpGetPort ); + myService->Ports->Add( myHttpPostPort ); + + // Add the Service to the ServiceCollection. + myServiceDescription->Services->Insert( 1, myService ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( "output.wsdl" ); + + // Output the Wsdl. + myServiceDescription->Write( myStreamWriter ); + myStreamWriter->Close(); + + // + // + if ( myServiceDescription->Services->Contains( myService ) ) + { + Console::WriteLine( "The mentioned service exists at index {0} in the WSDL.", myServiceDescription->Services->IndexOf( myService ) ); + + // + array^myServiceArray = gcnew array(myServiceDescription->Services->Count); + + // Copy the services into an array. + myServiceDescription->Services->CopyTo( myServiceArray, 0 ); + IEnumerator^ myEnumerator = myServiceArray->GetEnumerator(); + Console::WriteLine( "The names of services in the array are" ); + while ( myEnumerator->MoveNext() ) + { + Service^ myService1 = dynamic_cast(myEnumerator->Current); + Console::WriteLine( myService1->Name ); + } + // + } + else + { + Console::WriteLine( "Service does not exist in the WSDL." ); + } + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught! {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp new file mode 100644 index 00000000000..d0089a0774c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceCollection_Item/CPP/servicecollection_item.cpp @@ -0,0 +1,80 @@ +// System.Web.Services.Description.ServiceDescription.Write(FileName) +// System.Web.Services.Description.ServiceCollection.Remove +// System.Web.Services.Description.ServiceCollection.Item(int) +// System.Web.Services.Description.ServiceDescription.Services +// System.Web.Services.Description.ServiceDescription.TargetNamespace +// System.Web.Services.Description.ServiceCollection.Add + +/* +The following example demonstrates methods and properties of the +ServiceDescription and ServiceCollection classes. +A new WSDL is read and the existing service "MathService" in the +ServiceCollection is removed. The service by default is defined for +SOAP, HttpGet, HttpPost. A new Service defined for SOAP and HttpGet is +constructed and added to the ServiceCollection. +The programs writes a new web service description file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + // + // + // + // + // + // Read a ServiceDescription from existing WSDL. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Input_CS.wsdl" ); + myServiceDescription->TargetNamespace = "http://tempuri.org/"; + // + + // Get the ServiceCollection of the ServiceDescription. + ServiceCollection^ myServiceCollection = myServiceDescription->Services; + + // Remove the Service at index 0 of the collection. + myServiceCollection->Remove( myServiceDescription->Services[ 0 ] ); + // + // + // + // + // Build a new Service. + Service^ myService = gcnew Service; + myService->Name = "MathService"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); + + // Build a new Port for SOAP. + Port^ mySoapPort = gcnew Port; + mySoapPort->Name = "MathServiceSoap"; + mySoapPort->Binding = myXmlQualifiedName; + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/ServiceCollection_Item/AddSub_CS.asmx"; + mySoapPort->Extensions->Add( mySoapAddressBinding ); + + // Build a new Port for HTTP-GET. + XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); + Port^ myHttpGetPort = gcnew Port; + myHttpGetPort->Name = "MathServiceHttpGet"; + myHttpGetPort->Binding = myXmlQualifiedName2; + HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; + myHttpAddressBinding->Location = "http://localhost/ServiceCollection_Item/AddSub_CS.asmx"; + myHttpGetPort->Extensions->Add( myHttpAddressBinding ); + + // Add the ports to the service. + myService->Ports->Add( myHttpGetPort ); + myService->Ports->Add( mySoapPort ); + + // Add the service to the ServiceCollection. + myServiceCollection->Add( myService ); + + // + // Write to a new WSDL file. + myServiceDescription->Write( "output.wsdl" ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp new file mode 100644 index 00000000000..fa70e899296 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription/CPP/servicedescription.cpp @@ -0,0 +1,84 @@ +// System.Web.Services.Description.ServiceDescription + +/* +The following example demonstrates the 'ServiceDescription' class. +The input to the program is a WSDL file 'MyWsdl.wsdl'. +This program removes one 'Binding' from the existing WSDL. +A new Binding is defined and added to the ServiceDescription object. +The program generates a new Web Service Description document. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +// Used to create OperationBinding instances within 'Binding'. +OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) +{ + // Create OperationBinding instance for operation. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = operation; + + // Create InputBinding for operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + + // Create extensibility element for 'SoapOperationBinding'. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = targetNamespace + operation; + + // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + return myOperationBinding; +} + +int main() +{ + try + { + // + // Obtain the ServiceDescription of existing Wsdl. + ServiceDescription^ myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" ); + + // Remove the Binding from the Binding Collection of ServiceDescription. + BindingCollection^ myBindingCollection = myDescription->Bindings; + myBindingCollection->Remove( myBindingCollection[ 0 ] ); + + // Form a new Binding. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Service1Soap"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); + myBinding->Type = myXmlQualifiedName; + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myDescription->TargetNamespace ); + myBinding->Operations->Add( addOperationBinding ); + myBinding->Extensions->Add( mySoapBinding ); + + // Add the Binding to the ServiceDescription. + myDescription->Bindings->Add( myBinding ); + myDescription->Write( "MyOutWsdl.wsdl" ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception :{0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp new file mode 100644 index 00000000000..a8845c0e0db --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionBaseCollection/CPP/servicedescriptionbasecollection.cpp @@ -0,0 +1,192 @@ + + +// System.Web.Services.Description.ServiceDescriptionBaseCollection. +/* +The following example demonstrates 'ServiceDescriptionBaseCollection' class. +A 'ServiceDescription' instance is obtained from the existing Wsdl. +'MyMethod' takes an instance of 'ServiceDescriptionBaseCollection' as a parameter. +Instance of different types of collections that were actually derived from +'ServiceDescriptionBaseCollection' are passed to my method and modifications of +corresponding instances in done. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +ref class ServiceDescription_Sample +{ +public: + static ServiceDescription^ myServiceDescription; + static void Main() + { + // Read a ServiceDescription of existing WSDL. + myServiceDescription = ServiceDescription::Read( "Input_CS.wsdl" ); + + // Get the ServiceCollection of the ServiceDescription. + ServiceCollection^ myServiceCollection = myServiceDescription->Services; + MyMethod( myServiceCollection ); + BindingCollection^ myBindingCollection = myServiceDescription->Bindings; + MyMethod( myBindingCollection ); + PortTypeCollection^ myPortTypeCollection = myServiceDescription->PortTypes; + MyMethod( myPortTypeCollection ); + myServiceDescription->Write( "Output.Wsdl" ); + } + + // + static void MyMethod( ServiceDescriptionBaseCollection^ myServiceCollection ) + { + Type^ myType = myServiceCollection->GetType(); + if ( myType->Equals( System::Web::Services::Description::ServiceCollection::typeid ) ) + { + // Remove the services at index 0 of the collection. + (dynamic_cast(myServiceCollection))->Remove( myServiceDescription->Services[ 0 ] ); + + // Build a new Service. + Service^ myService = gcnew Service; + myService->Name = "MathService"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); + + // Build a new Port for SOAP. + Port^ mySoapPort = gcnew Port; + mySoapPort->Name = "MathServiceSoap"; + mySoapPort->Binding = myXmlQualifiedName; + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/" + "ServiceDescriptionBaseCollection/AddSubtractService.CS.asmx"; + mySoapPort->Extensions->Add( mySoapAddressBinding ); + + // Build a new Port for HTTP-GET. + XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); + Port^ myHttpGetPort = gcnew Port; + myHttpGetPort->Name = "MathServiceHttpGet"; + myHttpGetPort->Binding = myXmlQualifiedName2; + HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; + myHttpAddressBinding->Location = "http://localhost/" + "ServiceDescriptionBaseCollection/AddSubtractService.CS.asmx"; + myHttpGetPort->Extensions->Add( myHttpAddressBinding ); + + // Add the ports to the Service. + myService->Ports->Add( myHttpGetPort ); + myService->Ports->Add( mySoapPort ); + + // Add the Service to the ServiceCollection. + myServiceDescription->Services->Add( myService ); + } + else + if ( myType->Equals( System::Web::Services::Description::BindingCollection::typeid ) ) + { + // Remove the Binding in the BindingCollection at index 0. + (dynamic_cast(myServiceCollection))->Remove( myServiceDescription->Bindings[ 0 ] ); + + // Build a new Binding. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "MathServiceSoap"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); + myBinding->Type = myXmlQualifiedName; + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + + // Create the operations for the binding. + OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myServiceDescription->TargetNamespace ); + OperationBinding^ subtractOperationBinding = CreateOperationBinding( "Subtract", myServiceDescription->TargetNamespace ); + + // Add the operations to the Binding. + myBinding->Operations->Add( subtractOperationBinding ); + myBinding->Operations->Add( addOperationBinding ); + myBinding->Extensions->Add( mySoapBinding ); + + // Add the Binding to the Bindings collection. + myServiceDescription->Bindings->Add( myBinding ); + } + else + if ( myType->Equals( System::Web::Services::Description::PortTypeCollection::typeid ) ) + { + // Remove the PortType at index 0. + (dynamic_cast(myServiceCollection))->Remove( myServiceDescription->PortTypes[ 0 ] ); + + // Build a new PortType. + PortType^ myPortType = gcnew PortType; + myPortType->Name = "MathServiceSoap"; + + // Build an Add Operation for the PortType. + Operation^ myAddOperation = gcnew Operation; + myAddOperation->Name = "Add"; + + // Build the Input and Output messages for the Operations. + OperationInput^ myOperationInputMessage1 = gcnew OperationInput; + XmlQualifiedName^ myXmlQualifiedName1 = gcnew XmlQualifiedName( "s0:AddSoapIn" ); + myOperationInputMessage1->Message = myXmlQualifiedName1; + OperationOutput^ myOperationOutputMessage1 = gcnew OperationOutput; + XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:AddSoapOut" ); + myOperationOutputMessage1->Message = myXmlQualifiedName2; + + // Add the messages to the operations. + myAddOperation->Messages->Add( myOperationInputMessage1 ); + myAddOperation->Messages->Add( myOperationOutputMessage1 ); + + // Build an Add Operation for the PortType. + Operation^ mySubtractOperation = gcnew Operation; + mySubtractOperation->Name = "Subtract"; + + // Build the Input and Output messages for the operations. + OperationInput^ myOperationInputMessage2 = gcnew OperationInput; + XmlQualifiedName^ myXmlQualifiedName3 = gcnew XmlQualifiedName( "s0:SubtractSoapIn" ); + myOperationInputMessage2->Message = myXmlQualifiedName3; + OperationOutput^ myOperationOutputMessage2 = gcnew OperationOutput; + XmlQualifiedName^ myXmlQualifiedName4 = gcnew XmlQualifiedName( "s0:SubtractSoapOut" ); + myOperationOutputMessage2->Message = myXmlQualifiedName4; + + // Add the messages to the operations. + mySubtractOperation->Messages->Add( myOperationInputMessage2 ); + mySubtractOperation->Messages->Add( myOperationOutputMessage2 ); + + // Add the operations to the PortType. + myPortType->Operations->Add( myAddOperation ); + myPortType->Operations->Add( mySubtractOperation ); + + // Add the PortType to the collection. + myServiceDescription->PortTypes->Add( myPortType ); + } + } + // + + static OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) + { + // Create OperationBinding instance for operation. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = operation; + + // Create InputBinding for operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + + // Create extensibility element for 'SoapOperationBinding'. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = String::Concat( targetNamespace, operation ); + + // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + return myOperationBinding; + } +}; + +int main() +{ + ServiceDescription_Sample::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp new file mode 100644 index 00000000000..3a27bf22ab5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection/CPP/servicedescriptioncollection.cpp @@ -0,0 +1,57 @@ + + +// System::Web::Services::Description.ServiceDescriptionCollection +/*The following program demonstrates the 'ServiceDescriptionCollection' class. +It creates two 'ServiceDescription' objects and add them to +'ServiceDescriptionCollection' Object*. It displays the name of 'ServiceDescription' +objects using 'Item' property. 'GetBinding' method is used to display binding instance of the +'ServiceDescription' Object*. + +Note: This program requires 'DataTypes_CS.wsdl' and 'MathService_cpp.wsdl' files to +be placed in same directory as that of .exe for running. +*/ +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + // Get ServiceDescription objects. + ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); + ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); + + // Set the names of the ServiceDescriptions. + myServiceDescription1->Name = "DataTypes"; + myServiceDescription2->Name = "MathService"; + + // Create a ServiceDescriptionCollection. + ServiceDescriptionCollection^ myServiceDescriptionCollection = gcnew ServiceDescriptionCollection; + + // Add the ServiceDescriptions to the collection. + myServiceDescriptionCollection->Add( myServiceDescription1 ); + myServiceDescriptionCollection->Add( myServiceDescription2 ); + + // Display the elements of the collection using the Item property. + Console::WriteLine( "Elements in the collection: " ); + for ( int i = 0; i < myServiceDescriptionCollection->Count; i++ ) + Console::WriteLine( myServiceDescriptionCollection[ i ]->Name ); + + // Construct an XML qualified name. + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); + + // Get the Binding from the collection. + Binding^ myBinding = myServiceDescriptionCollection->GetBinding( myXmlQualifiedName ); + Console::WriteLine( "Binding found in collection with name: {0}", myBinding->ServiceDescription->Name ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp new file mode 100644 index 00000000000..1f4b047229c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Constructor_Add_Item/CPP/sdcollection_constructor_add_item.cpp @@ -0,0 +1,50 @@ + + +// System::Web::Services::Description.ServiceDescriptionCollection::ServiceDescriptionCollection() +// System::Web::Services::Description.ServiceDescriptionCollection->Add() +// System::Web::Services::Description.ServiceDescriptionCollection::Item(Int32) +/* The following program demonstrates 'Constructor', 'Add' method and +'Item' property of 'ServiceDescriptionCollection' class. It creates an +instance of 'ServiceDescriptionCollection' and adds +'ServiceDescription' objects to the collection. The Item property is used to +display the TargetNamespace of elements in the collection. + +Note: This program requires 'DataTypes_CS::wsdl' and 'MathService_CS::wsdl' +files to be placed in same directory as that of .exe for running. +*/ +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); + ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); + + // + // + // Create a ServiceDescriptionCollection. + ServiceDescriptionCollection^ myCollection = gcnew ServiceDescriptionCollection; + + // Add ServiceDescriptions to the collection. + myCollection->Add( myServiceDescription1 ); + myCollection->Add( myServiceDescription2 ); + // + // + + // + // Display element properties in the collection using + // the Item property. + for ( int i = 0; i < myCollection->Count; i++ ) + Console::WriteLine( myCollection[ i ]->TargetNamespace ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp new file mode 100644 index 00000000000..79ca7ba38d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetBinding/CPP/servicedescriptioncollection_getbinding.cpp @@ -0,0 +1,52 @@ + + +// System::Web::Services::Description.ServiceDescriptionCollection::GetBinding() +/* The following program demonstrates the 'GetBinding' method +of 'ServiceDescriptionCollection' class. It searches for a +'Binding' in the collection and returns the Binding instance. +On success, a message is displayed on the console. + +Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' +files to be placed in same directory as that of .exe for running. +*/ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription1 = + ServiceDescription::Read( "DataTypes_cpp.wsdl" ); + ServiceDescription^ myServiceDescription2 = + ServiceDescription::Read( "MathService_cpp.wsdl" ); + + // Create the Object* of 'ServiceDescriptionCollection' class. + ServiceDescriptionCollection^ myCollection = + gcnew ServiceDescriptionCollection; + + // Add ServiceDescription objects. + myCollection->Add( myServiceDescription1 ); + myCollection->Add( myServiceDescription2 ); + +// + // Construct an XML qualified name. + XmlQualifiedName^ myXmlQualifiedName = + gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); + + // Get the Binding from the collection. + myCollection->GetBinding( myXmlQualifiedName ); +// + Console::WriteLine( "Specified Binding is a member of ServiceDescription " + + "instances within the collection" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp new file mode 100644 index 00000000000..e84c9b01134 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetMessage/CPP/servicedescriptioncollection_getmessage.cpp @@ -0,0 +1,52 @@ +// System::Web::Services::Description.ServiceDescriptionCollection::GetMessage() + +/* The following program demonstrates the 'GetMessage' method +of 'ServiceDescriptionCollection' class. It searches for a +'Message' in the collection and returns the Message instance. On success, +a message is displayed on the console. + +Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' +files to be placed in same directory as that of .exe for running. +*/ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription1 = + ServiceDescription::Read( "DataTypes_cpp.wsdl" ); + ServiceDescription^ myServiceDescription2 = + ServiceDescription::Read( "MathService_cpp.wsdl" ); + + // Create the Object* of 'ServiceDescriptionCollection' class. + ServiceDescriptionCollection^ myCollection = + gcnew ServiceDescriptionCollection; + + // Add 'ServiceDescription' objects. + myCollection->Add( myServiceDescription1 ); + myCollection->Add( myServiceDescription2 ); + +// + // Construct an XML qualified name. + XmlQualifiedName^ myXmlQualifiedName = + gcnew XmlQualifiedName( "AddSoapIn","http://tempuri2.org/" ); + + // Get the Message from the collection. + myCollection->GetMessage( myXmlQualifiedName ); +// + + Console::WriteLine( "Specified Message is a member of ServiceDescription " + + "instances within the collection." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp new file mode 100644 index 00000000000..8374664ea9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetPortType/CPP/servicedescriptioncollection_getporttype.cpp @@ -0,0 +1,53 @@ +// System::Web::Services::Description.ServiceDescriptionCollection::GetPortType() + +/* The following program demonstrates the 'GetPortType' method +of 'ServiceDescriptionCollection' class. It searches for a +'PortType' with XmlQualifiedName in the collection and returns a +PortType instance. On success, a message is displayed on the +console. + +Note: This program requires 'DataTypes_cpp..wsdl' and 'MathService_cpp..wsdl' +files to be placed in same directory as that of .exe for running. +*/ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription1 = + ServiceDescription::Read( "DataTypes_cpp..wsdl" ); + ServiceDescription^ myServiceDescription2 = + ServiceDescription::Read( "MathService_cpp..wsdl" ); + + // Create the Object* of 'ServiceDescriptionCollection' class. + ServiceDescriptionCollection^ myCollection = + gcnew ServiceDescriptionCollection; + + // Add 'ServiceDescription' objects. + myCollection->Add( myServiceDescription1 ); + myCollection->Add( myServiceDescription2 ); + +// + // Construct an XML qualified name. + XmlQualifiedName^ myXmlQualifiedName = + gcnew XmlQualifiedName( "MathServiceSoap","http://tempuri2.org/" ); + + // Get the PortType from the collection. + myCollection->GetPortType( myXmlQualifiedName ); +// + + Console::WriteLine( "Specified PortType is a member of ServiceDescription " + + "instances within the collection." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp new file mode 100644 index 00000000000..393a442e65a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_GetService/CPP/servicedescriptioncollection_getservice.cpp @@ -0,0 +1,53 @@ +// System::Web::Services::Description.ServiceDescriptionCollection::GetService() + +/* The following program demonstrates the 'GetService' method +of 'ServiceDescriptionCollection' class. It searches for a +'Service' with XmlQualifiedName in the collection and returns +the Service instance. On success, a message is displayed on the +console. + +Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' +files to be placed in same directory as that of .exe for running. +*/ + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription1 = + ServiceDescription::Read( "DataTypes_cpp.wsdl" ); + ServiceDescription^ myServiceDescription2 = + ServiceDescription::Read( "MathService_cpp.wsdl" ); + + // Create the Object* of 'ServiceDescriptionCollection' class. + ServiceDescriptionCollection^ myCollection = + gcnew ServiceDescriptionCollection; + + // Add 'ServiceDescription' objects. + myCollection->Add( myServiceDescription1 ); + myCollection->Add( myServiceDescription2 ); + +// + // Construct an XML qualified name. + XmlQualifiedName^ myXmlQualifiedName = + gcnew XmlQualifiedName( "MathService","http://tempuri2.org/" ); + + // Get the Service from the collection. + myCollection->GetService( myXmlQualifiedName ); +// + + Console::WriteLine( "Specified Service is a member of ServiceDescription " + + "instances within the collection" ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp new file mode 100644 index 00000000000..65f79d261a7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionCollection_Insert_Item_CopyTo/CPP/sdcollection_insert_item_copyto.cpp @@ -0,0 +1,62 @@ + + +// System::Web::Services::Description.ServiceDescriptionCollection::Insert() +// System::Web::Services::Description.ServiceDescriptionCollection::Item(String) +// System::Web::Services::Description.ServiceDescriptionCollection::CopyTo() +/* The following program demonstrates 'Item' property, 'Insert' and 'CopyTo' +methods of the 'ServiceDescriptionCollection' class. It creates an instance of +'ServiceDescriptionCollection' and adds 'ServiceDescription' objects to the +collection. The elements of the collection are copied to a 'ServiceDescription' +array. + +Note: This program requires 'DataTypes_cpp.wsdl' and 'MathService_cpp.wsdl' +files to be placed in the same directory as that of .exe for running. +*/ +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + ServiceDescription^ myServiceDescription1 = ServiceDescription::Read( "DataTypes_cpp.wsdl" ); + myServiceDescription1->Name = "DataTypes"; + ServiceDescription^ myServiceDescription2 = ServiceDescription::Read( "MathService_cpp.wsdl" ); + myServiceDescription2->Name = "MathService"; + + // Create the object of 'ServiceDescriptionCollection' class. + ServiceDescriptionCollection^ myCollection = gcnew ServiceDescriptionCollection; + + // Add 'ServiceDescription' objects. + myCollection->Add( myServiceDescription1 ); + + // + // Insert a ServiceDescription into the collection. + myCollection->Insert( 1, myServiceDescription2 ); + // + + // + // Get a ServiceDescription in the collection using + // the Item property. + ServiceDescription^ myServiceDescription = myCollection[ "http://tempuri1.org/" ]; + // + + Console::WriteLine( "Name of the object retrieved using 'Item' property: {0}", myServiceDescription->Name ); + + // + array^myArray = gcnew array(myCollection->Count); + + // Copy the collection to a ServiceDescription array. + myCollection->CopyTo( myArray, 0 ); + for ( int i = 0; i < myArray->Length; i++ ) + Console::WriteLine( "Name of element in array: {0}", myArray[ i ]->Name ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp new file mode 100644 index 00000000000..bd4ca480209 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionFormatExtension_13/CPP/servicedescriptionformatextension_13.cpp @@ -0,0 +1,142 @@ + + +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::ctor +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection->Add() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Item +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Find(System::Type type) +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::FindAll(System::Type type) +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::IsHandled() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::IsRequired() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::CopyTo() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Contains() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::IndexOf() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Remove() +// System::Web::Services::Description.ServiceDescriptionFormatExtensionCollection::Insert() +/* The following program demonstrates the class, properties and methods of +'ServiceDescriptionFormatExtensionCollection' +class. It creates a ServiceDescription object, uses it to create +'ServiceDescriptionFormatExtensionCollection' object. Collection +object is used for demonstration of class properties and methods. + +Note: This program requires 'Sample_cpp.wsdl' file to be placed in +the same directory as that of .exe for running. +*/ +// +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; + +ref class MyFormatExtension: public ServiceDescriptionFormatExtension +{ +public: + MyFormatExtension() + { + // Set the properties. + this->Handled = true; + this->Required = true; + } +}; + +int main() +{ + try + { + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Sample_cpp.wsdl" ); + ServiceDescriptionFormatExtensionCollection^ myCollection = gcnew ServiceDescriptionFormatExtensionCollection( myServiceDescription ); + // + + // + SoapBinding^ mySoapBinding1 = gcnew SoapBinding; + SoapBinding^ mySoapBinding2 = gcnew SoapBinding; + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + MyFormatExtension^ myFormatExtensionObject = gcnew MyFormatExtension; + + // Add elements to collection. + myCollection->Add( mySoapBinding1 ); + myCollection->Add( mySoapAddressBinding ); + myCollection->Add( mySoapBinding2 ); + myCollection->Add( myFormatExtensionObject ); + // + + // + Console::WriteLine( "Collection contains following types of elements: " ); + + // Display the 'Type' of the elements in collection. + for ( int i = 0; i < myCollection->Count; i++ ) + Console::WriteLine( myCollection[ i ]->GetType() ); + // + + // + // Check element of type 'SoapAddressBinding' in collection. + Object^ myObj = myCollection->Find( mySoapAddressBinding->GetType() ); + if ( myObj == nullptr ) + Console::WriteLine( "Element of type ' {0}' not found in collection.", mySoapAddressBinding->GetType() ); + else + Console::WriteLine( "Element of type ' {0}' found in collection.", mySoapAddressBinding->GetType() ); + // + + // + // Check all elements of type 'SoapBinding' in collection. + array^myObjectArray1 = gcnew array(myCollection->Count); + myObjectArray1 = myCollection->FindAll( mySoapBinding1->GetType() ); + int myNumberOfElements = 0; + IEnumerator^ myIEnumerator = myObjectArray1->GetEnumerator(); + + // Calculate number of elements of type 'SoapBinding'. + while ( myIEnumerator->MoveNext() ) + if ( mySoapBinding1->GetType() == myIEnumerator->Current->GetType() ) + myNumberOfElements++; + Console::WriteLine( "Collection contains {0} objects of type ' {1}'.", myNumberOfElements, mySoapBinding1->GetType() ); + // + + // + // Check 'IsHandled' status for 'myFormatExtensionObject' object in collection. + Console::WriteLine( "'IsHandled' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsHandled( myFormatExtensionObject ) ); + // + + // + // Check 'IsRequired' status for 'myFormatExtensionObject' object in collection. + Console::WriteLine( "'IsRequired' status for {0} object is {1}.", myFormatExtensionObject, myCollection->IsRequired( myFormatExtensionObject ) ); + // + + // + // Copy elements of collection to an Object array. + array^myObjectArray2 = gcnew array(myCollection->Count); + myCollection->CopyTo( myObjectArray2, 0 ); + Console::WriteLine( "Collection elements are copied to an object array." ); + // + + // + // Check for 'myFormatExtension' object in collection. + if ( myCollection->Contains( myFormatExtensionObject ) ) + { + // + // Get index of a 'myFormatExtension' object in collection. + Console::WriteLine( "Index of 'myFormatExtensionObject' is {0} in collection.", myCollection->IndexOf( myFormatExtensionObject ) ); + // + + // + // Remove 'myFormatExtensionObject' element from collection. + myCollection->Remove( myFormatExtensionObject ); + Console::WriteLine( "'myFormatExtensionObject' is removed from collection." ); + // + } + // + + // + // Insert 'MyFormatExtension' object. + myCollection->Insert( 0, myFormatExtensionObject ); + Console::WriteLine( "'myFormatExtensionObject' is inserted to collection." ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp new file mode 100644 index 00000000000..bed420f5e01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportStyle_Client/CPP/servicedescriptionimportstyle_client.cpp @@ -0,0 +1,39 @@ + + +// System::Web::Services::Description.ServiceDescriptionImportStyle +// System::Web::Services::Description.ServiceDescriptionImportStyle::Client +/* The following program demonstrates the 'ServiceDescriptionImportStyle' +enumeration and 'Client' member of 'ServiceDescriptionImportStyle' in +'System::Web::Services::Description' namespace. It creates a +ServiceDescriptionImporter Object* from a .wsdl file and demonstrates +the usage of Client. */ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +int main() +{ + try + { + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Sample_cpp.wsdl" ); + ServiceDescriptionImporter^ myImporter = gcnew ServiceDescriptionImporter; + myImporter->ProtocolName = "Soap"; + myImporter->AddServiceDescription( myServiceDescription, "", "" ); + + // + ServiceDescriptionImportStyle myStyle = myImporter->Style; + Console::WriteLine( "Import style: {0}", myStyle ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Following exception was thrown: {0}", e ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp new file mode 100644 index 00000000000..475d65bae5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescriptionImportWarnings_Enum/CPP/servicedescriptionimportwarnings_enum.cpp @@ -0,0 +1,82 @@ +// System::Web::Services::Description.ServiceDescriptionImportWarnings::NoCodeGenerated +// System::Web::Services::Description.ServiceDescriptionImportWarnings::NoMethodsGenerated +// System::Web::Services::Description.ServiceDescriptionImportWarnings::UnsupportedOperationsIgnored +// System::Web::Services::Description.ServiceDescriptionImportWarnings::OptionalExtensionsIgnored +// System::Web::Services::Description.ServiceDescriptionImportWarnings::RequiredExtensionsIgnored +// System::Web::Services::Description.ServiceDescriptionImportWarnings::UnsupportedBindingsIgnored + +/* +The following program demonstrates the enum values of 'ServiceDescriptionImportWarnings'. +'Import' method of 'ServiceDescriptionImporter' will give the enumaration. The user selected +option will help in taking the related wsdl file and returns the corresponding warning which +is displayed on the console. +*/ + +using namespace System; + +#using +#using +#using + +using namespace System::Web::Services::Description; +using namespace System::CodeDom; + +void DisplayWarning( String^ myWSDLFileName ) +{ +// + String^ myDisplay; + // Read wsdl file. + ServiceDescription^ myServiceDescription = ServiceDescription::Read + ( myWSDLFileName ); + + ServiceDescriptionImporter^ myServiceDescriptionImporter = + gcnew ServiceDescriptionImporter; + + // Add 'myServiceDescription' to 'myServiceDescriptionImporter'. + myServiceDescriptionImporter->AddServiceDescription + ( myServiceDescription, "", "" ); + + myServiceDescriptionImporter->ProtocolName = "HttpGet"; + CodeNamespace^ myCodeNamespace = gcnew CodeNamespace; + CodeCompileUnit^ myCodeCompileUnit = gcnew CodeCompileUnit; + + // Invoke 'Import' method. + ServiceDescriptionImportWarnings myWarning = + myServiceDescriptionImporter->Import(myCodeNamespace, + myCodeCompileUnit); + + switch ( myWarning ) + { + case ServiceDescriptionImportWarnings::NoCodeGenerated: + myDisplay = "NoCodeGenerated"; + break; + case ServiceDescriptionImportWarnings::NoMethodsGenerated: + myDisplay = "NoMethodsGenerated"; + break; + case ServiceDescriptionImportWarnings::UnsupportedOperationsIgnored: + myDisplay = "UnsupportedOperationsIgnored"; + break; + case ServiceDescriptionImportWarnings::OptionalExtensionsIgnored: + myDisplay = "OptionalExtensionsIgnored"; + break; + case ServiceDescriptionImportWarnings::RequiredExtensionsIgnored: + myDisplay = "RequiredExtensionsIgnored"; + break; + case ServiceDescriptionImportWarnings::UnsupportedBindingsIgnored: + myDisplay = "UnsupportedBindingsIgnored"; + break; + default: + myDisplay = "General Warning"; + break; + } + Console::WriteLine( "Warning : " + myDisplay ); +// +} + +int main() +{ + DisplayWarning( "ServiceDescriptionImportWarnings_NoCodeGenerated.wsdl" ); + DisplayWarning( "ServiceDescriptionImportWarnings_NoMethodsGenerated::wsdl" ); + DisplayWarning( "ServiceDescriptionImportWarnings_UnsupportedOperationsIgnored::wsdl" ); + DisplayWarning( "ServiceDescriptionImportWarnings_OptionalExtensionsIgnored::wsdl" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp new file mode 100644 index 00000000000..7b2a6a89d1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Bindings/CPP/servicedescription_bindings.cpp @@ -0,0 +1,85 @@ +// System.Web.Services.Description.ServiceDescription.Bindings + +/* +The following example demonstrates the property 'Bindings' of +'ServiceDescription' class. The input to the program is a WSDL file +'MyWsdl_CS.wsdl'. This program removes one 'Binding' from the existing WSDL. +A new Binding is defined and added to the ServiceDescription object. +The program generates a new Web Service Description document. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +// Used to create OperationBinding instances within 'Binding'. +OperationBinding^ CreateOperationBinding( String^ operation, String^ targetNamespace ) +{ + // Create OperationBinding instance for operation. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = operation; + + // Create InputBinding for operation. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + + // Create extensibility element for 'SoapOperationBinding'. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + mySoapOperationBinding->SoapAction = targetNamespace + operation; + + // Add extensibility element 'SoapOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + return myOperationBinding; +} + +int main() +{ + try + { + // + // Obtain the ServiceDescription from existing WSDL. + ServiceDescription^ myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" ); + + // Remove the Binding from the BindingCollection of + // the ServiceDescription. + BindingCollection^ myBindingCollection = myDescription->Bindings; + myBindingCollection->Remove( myBindingCollection[ 0 ] ); + + // Form a new Binding. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Service1Soap"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); + myBinding->Type = myXmlQualifiedName; + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + OperationBinding^ addOperationBinding = CreateOperationBinding( "Add", myDescription->TargetNamespace ); + myBinding->Operations->Add( addOperationBinding ); + myBinding->Extensions->Add( mySoapBinding ); + + // Add the Binding to the ServiceDescription. + myDescription->Bindings->Add( myBinding ); + myDescription->Write( "MyOutWsdl.wsdl" ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp new file mode 100644 index 00000000000..4d5942332c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Constructor_4/CPP/servicedescription_constructor_4.cpp @@ -0,0 +1,59 @@ +// System.Web.Services.Description.ServiceDescription.ServiceDescription() +// System.Web.Services.Description.ServiceDescription.Read(string) +// System.Web.Services.Description.ServiceDescription.Messages +// System.Web.Services.Description.ServiceDescription.Name + +/* +The following example demonstrates the 'ServiceDescription()' constructor, +the 'Messages' and 'Name' properties and the 'Read' method of the 'ServiceDescription' +class. The input to the program is a WSDL file 'MyWsdl.wsdl'. +This program removes one message from the existing WSDL. +A new Message is defined and added to the ServiceDescription. +A new wsdl with modified ServiceDescription is written in 'MyOutWsdl.wsdl'. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +int main() +{ + // + // + // + // + ServiceDescription^ myDescription = gcnew ServiceDescription; + myDescription = ServiceDescription::Read( "MyWsdl_CS.wsdl" ); + myDescription->Name = "MyServiceDescription"; + Console::WriteLine( "Name: {0}", myDescription->Name ); + MessageCollection^ myMessageCollection = myDescription->Messages; + + // Remove the message at index 0 from the message collection. + myMessageCollection->Remove( myDescription->Messages[ 0 ] ); + + // Build a new message. + Message^ myMessage = gcnew Message; + myMessage->Name = "AddSoapIn"; + + // Build a new MessagePart. + MessagePart^ myMessagePart = gcnew MessagePart; + myMessagePart->Name = "parameters"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:Add" ); + myMessagePart->Element = myXmlQualifiedName; + + // Add MessageParts to the message. + myMessage->Parts->Add( myMessagePart ); + + // Add the message to the ServiceDescription. + myDescription->Messages->Add( myMessage ); + myDescription->Write( "MyOutWsdl.wsdl" ); + // + // + // + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp new file mode 100644 index 00000000000..5aa1c26e6f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Extensions_RetrieveUrl/CPP/servicedescription_extensions_2.cpp @@ -0,0 +1,42 @@ +// System.Web.Services.Description.ServiceDescription.Extensions +// System.Web.Services.Description.ServiceDescription.RetrievalUrl +/* The following program demonstrates properties 'Extensions', 'RetrievalUrl' of +'ServiceDescription' class. The input to the program is a WSDL file +'ServiceDescription_Extensions_Input_cs.wsdl'. This program adds one object +to the extensions collection and displays the count and set the 'RetrievalURL' and displays. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; + +int main() +{ + // + // + ServiceDescription^ myServiceDescription = gcnew ServiceDescription; + myServiceDescription = ServiceDescription::Read( "ServiceDescription_Extensions_Input_cs.wsdl" ); + Console::WriteLine( myServiceDescription->Bindings[ 1 ]->Extensions[ 0 ] ); + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Required = true; + SoapBinding^ mySoapBinding1 = gcnew SoapBinding; + mySoapBinding1->Required = false; + myServiceDescription->Extensions->Add( mySoapBinding ); + myServiceDescription->Extensions->Add( mySoapBinding1 ); + System::Collections::IEnumerator^ myEnum = myServiceDescription->Extensions->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + ServiceDescriptionFormatExtension^ myServiceDescriptionFormatExtension = (ServiceDescriptionFormatExtension^)(myEnum->Current); + Console::WriteLine( "Required: {0}", myServiceDescriptionFormatExtension->Required ); + } + + myServiceDescription->Write( "ServiceDescription_Extensions_Output_cs.wsdl" ); + myServiceDescription->RetrievalUrl = "http://www.contoso.com/"; + Console::WriteLine( "Retrieval URL is: {0}", myServiceDescription->RetrievalUrl ); + // + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp new file mode 100644 index 00000000000..7f3cffea1be --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Imports_Service/CPP/servicedescription_imports.cpp @@ -0,0 +1,42 @@ +// System.Web.Services.Description.ServiceDescription.Imports + +/* The following program demonstrates the property 'Imports' of 'ServiceDescription' class. +The input to the program is a WSDL file 'ServiceDescription_Imports_Input_CS.wsdl' which +is not having the import element. A new 'Import' is defined and added to the new modified +'ServiceDescription_Imports_Output_CS.wsdl' file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +int main() +{ + // + ServiceDescription^ myServiceDescription = gcnew ServiceDescription; + myServiceDescription = ServiceDescription::Read( "ServiceDescription_Imports_Input_CS.wsdl" ); + ImportCollection^ myImportCollection = myServiceDescription->Imports; + + // Create an Import. + Import^ myImport = gcnew Import; + myImport->Namespace = myServiceDescription->TargetNamespace; + + // Set the location for the Import. + myImport->Location = "http://www.contoso.com/"; + myImportCollection->Add( myImport ); + myServiceDescription->Write( "ServiceDescription_Imports_Output_CS.wsdl" ); + myImportCollection->Clear(); + myServiceDescription = ServiceDescription::Read( "ServiceDescription_Imports_Output_CS.wsdl" ); + myImportCollection = myServiceDescription->Imports; + Console::WriteLine( "The Import elements added to the ImportCollection are: " ); + for ( int i = 0; i < myImportCollection->Count; i++ ) + { + Console::WriteLine( "{0}. {1}", (i + 1), myImportCollection[ i ]->Location ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp new file mode 100644 index 00000000000..e200b9e1fd6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Namespace/CPP/servicedescription_namespace.cpp @@ -0,0 +1,30 @@ +// System::Web::Services::Description.ServiceDescription::Namespace + +/* +The following example demonstrates the 'Namespace' property of 'ServiceDescription' class. The input to the program is a +WSDL file 'MyWsdl::wsdl'.This program displays the Namespace of 'ServiceDescription' class. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; + +int main() +{ + try + { +// + ServiceDescription^ myDescription = + ServiceDescription::Read( "MyWsdl_CS.wsdl" ); + Console::WriteLine( "Namespace : " + ServiceDescription::Namespace ); +// + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: " + e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp new file mode 100644 index 00000000000..fb6a682faf5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_PortTypes_2/CPP/servicedescription_porttypes_2.cpp @@ -0,0 +1,69 @@ +// System.Web.Services.Description.ServiceDescription.PortTypes +// System.Web.Services.Description.ServiceDescription.CanRead + +/* +The following example demonstrates the 'PortTypes' property +and 'CanRead' method of 'ServiceDescription' class. +The input to the program is a WSDL file 'MyWsdl_CS.wsdl'. +This program checks the validity of WSDL file.One of the existing +port types is removed.A new PortType is defined and added to the +port types collection of the service description. A modified WSDL +is the output of the program. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +// +// +// Creates an Operation for a PortType. +Operation^ CreateOperation( String^ operationName, String^ inputMessage, String^ outputMessage, String^ targetNamespace ) +{ + Operation^ myOperation = gcnew Operation; + myOperation->Name = operationName; + OperationMessage^ input = dynamic_cast(gcnew OperationInput); + input->Message = gcnew XmlQualifiedName( inputMessage,targetNamespace ); + OperationMessage^ output = dynamic_cast(gcnew OperationOutput); + output->Message = gcnew XmlQualifiedName( outputMessage,targetNamespace ); + myOperation->Messages->Add( input ); + myOperation->Messages->Add( output ); + return myOperation; +} + +int main() +{ + String^ myWsdlFileName = "MyWsdl_CS.wsdl"; + XmlTextReader^ myReader = gcnew XmlTextReader( myWsdlFileName ); + if ( ServiceDescription::CanRead( myReader ) ) + { + ServiceDescription^ myDescription = ServiceDescription::Read( myWsdlFileName ); + + // Remove the PortType at index 0 of the collection. + PortTypeCollection^ myPortTypeCollection = myDescription->PortTypes; + myPortTypeCollection->Remove( myDescription->PortTypes[ 0 ] ); + + // Build a new PortType. + PortType^ myPortType = gcnew PortType; + myPortType->Name = "Service1Soap"; + Operation^ myOperation = CreateOperation( "Add", "s0:AddSoapIn", "s0:AddSoapOut", "" ); + myPortType->Operations->Add( myOperation ); + + // Add a new PortType to the PortType collection of + // the ServiceDescription. + myDescription->PortTypes->Add( myPortType ); + myDescription->Write( "MyOutWsdl.wsdl" ); + Console::WriteLine( "New WSDL file generated successfully." ); + } + else + { + Console::WriteLine( "This file is not a WSDL file." ); + } +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp new file mode 100644 index 00000000000..9f61643a1f4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read/CPP/servicedescription_read.cpp @@ -0,0 +1,85 @@ + + +// System.Web.Description.ServiceDescription.Read(XmlReader) +// System.Web.Description.ServiceCollection.Item(string) +// System.Web.Description.ServiceCollection.Insert(int,Service) +// System.Web.Description.ServiceDescription.Write(XmlWriter) +/* +The following program demonstrates the properties of ServiceDescription and +ServiceCollection class.An XmlTextReader with the required url is created. +An existing WSDL document is read. +An existing service named "MathService" is removed from the collection and +A new Service object is constructed and added at index 1 of the Collection of Services. +A new WSDL file is created as output. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + try + { + // + // + // Create a new XmlTextWriter with specified URL. + XmlTextReader^ myXmlReader = gcnew XmlTextReader( "All_CS.wsdl" ); + ServiceDescription^ myServiceDescription = ServiceDescription::Read( myXmlReader ); + myServiceDescription->TargetNamespace = "http://tempuri.org/"; + + // Remove the service named MathService. + ServiceCollection^ myServiceDescriptionCollection = myServiceDescription->Services; + myServiceDescriptionCollection->Remove( myServiceDescription->Services[ "MathService" ] ); + // + // + + // + Service^ myService = gcnew Service; + myService->Name = "MathService"; + XmlQualifiedName^ myXmlQualifiedName = gcnew XmlQualifiedName( "s0:MathServiceSoap" ); + + // Build a new Port for SOAP. + Port^ mySoapPort = gcnew Port; + mySoapPort->Name = "MathServiceSoap"; + mySoapPort->Binding = myXmlQualifiedName; + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/ServiceDescription_Read/AddService_CS.asmx"; + mySoapPort->Extensions->Add( mySoapAddressBinding ); + + // Build a new Port for HTTP-GET. + XmlQualifiedName^ myXmlQualifiedName2 = gcnew XmlQualifiedName( "s0:MathServiceHttpGet" ); + Port^ myHttpGetPort = gcnew Port; + myHttpGetPort->Name = "MathServiceHttpGet"; + myHttpGetPort->Binding = myXmlQualifiedName2; + HttpAddressBinding^ myHttpAddressBinding = gcnew HttpAddressBinding; + myHttpAddressBinding->Location = "http://localhost/ServiceDescription_Read/AddService_CS.asmx"; + myHttpGetPort->Extensions->Add( myHttpAddressBinding ); + + // Add the ports to the service. + myService->Ports->Add( myHttpGetPort ); + myService->Ports->Add( mySoapPort ); + + // Add the service to the ServiceCollection. + myServiceDescription->Services->Insert( 1, myService ); + // + + // + // Create a new XmlTextWriter object. + XmlTextWriter^ myWriter = gcnew XmlTextWriter( "output.wsdl",Encoding::UTF8 ); + myWriter->Formatting = Formatting::Indented; + + // Write the WSDL. + myServiceDescription->Write( myWriter ); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp new file mode 100644 index 00000000000..ce0c8097760 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read1/CPP/servicedescription_read1.cpp @@ -0,0 +1,44 @@ + + +// System::Web::Services::Description.Read(TextReader) +/* +The following example demonstrates the 'Read(TextReader)' method of +'ServiceDescription' class.A ServiceDescription instance is +obtained from existing Wsdl::Name property of Bindings in the +ServiceDescription is displayed to console. +*/ +#using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; +using namespace System::IO; + +int main() +{ + try + { + // + ServiceDescription^ myDescription = gcnew ServiceDescription; + + // Create a StreamReader to read a WSDL file. + TextReader^ myTextReader = gcnew StreamReader( "MyWsdl.wsdl" ); + myDescription = ServiceDescription::Read( myTextReader ); + Console::WriteLine( "Bindings are: " ); + + // Display the Bindings present in the WSDL file. + System::Collections::IEnumerator^ myEnum = myDescription->Bindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Binding^ myBinding = safe_cast(myEnum->Current); + Console::WriteLine( myBinding->Name ); + } + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp new file mode 100644 index 00000000000..11b98b37d9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Read2/CPP/servicedescription_read2.cpp @@ -0,0 +1,44 @@ + + +// System::Web::Services::Description.Read(StreamReader) +/* +The following example demonstrates the 'Read(StreamReader)' method of +'ServiceDescription' class.A ServiceDescription instance is +obtained from existing Wsdl. Name property of Bindings in the +ServiceDescription is displayed to console. +*/ +#using + +// #using +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Description; +using namespace System::Xml; +using namespace System::IO; + +int main() +{ + try + { + // + // Create a StreamReader to read a WSDL file. + StreamReader^ myStreamReader = gcnew StreamReader( "MyWsdl.wsdl" ); + ServiceDescription^ myDescription = ServiceDescription::Read( myStreamReader ); + Console::WriteLine( "Bindings are: " ); + + // Display the Bindings present in the WSDL file. + System::Collections::IEnumerator^ myEnum = myDescription->Bindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Binding^ myBinding = safe_cast(myEnum->Current); + Console::WriteLine( myBinding->Name ); + } + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp new file mode 100644 index 00000000000..306781ed271 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/ServiceDescription_Types/CPP/servicedescription_types.cpp @@ -0,0 +1,101 @@ + + +// System.Web.Services.Description.ServiceDescription.Types +// System.Web.Services.Description.ServiceDescription.Write(Stream) +/* +The following program demonstrates the 'Write' method and 'Types' property +of ServiceDescription class.An existing WSDL document is read. +Types of the SericeDescription are removed.New Types are constructed. +Types are then added to ServiceDescription .A new WSDL file is created as output. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Schema; + +// This function creates a XmlComplex Element. +XmlSchemaElement^ CreateComplexTypeXmlElement( String^ minoccurs, String^ maxoccurs, String^ name, XmlQualifiedName^ schemaTypeName ) +{ + XmlSchemaElement^ myXmlSchemaElement = gcnew XmlSchemaElement; + myXmlSchemaElement->MinOccursString = minoccurs; + myXmlSchemaElement->MaxOccursString = maxoccurs; + myXmlSchemaElement->Name = name; + myXmlSchemaElement->SchemaTypeName = schemaTypeName; + return myXmlSchemaElement; +} + +int main() +{ + try + { + // Read the existing WSDL. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "Input_CS.wsdl" ); + + // + myServiceDescription->Types->Schemas->Remove( myServiceDescription->Types->Schemas[ 0 ] ); + XmlSchema^ myXmlSchema = gcnew XmlSchema; + myXmlSchema->AttributeFormDefault = XmlSchemaForm::Qualified; + myXmlSchema->ElementFormDefault = XmlSchemaForm::Qualified; + myXmlSchema->TargetNamespace = myServiceDescription->TargetNamespace; + XmlSchemaElement^ myXmlElement1 = gcnew XmlSchemaElement; + myXmlElement1->Name = "Add"; + XmlSchemaComplexType^ myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + XmlSchemaSequence^ myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "a", gcnew XmlQualifiedName( "s:float" ) ) ); + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "b", gcnew XmlQualifiedName( "s:float" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlElement1->SchemaType = myXmlSchemaComplexType; + myXmlSchema->Items->Add( myXmlElement1 ); + XmlSchemaElement^ myXmlElement2 = gcnew XmlSchemaElement; + myXmlElement2->Name = "AddResponse"; + myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "AddResult", gcnew XmlQualifiedName( "s:float" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlElement2->SchemaType = myXmlSchemaComplexType; + myXmlSchema->Items->Add( myXmlElement2 ); + XmlSchemaElement^ myXmlElement3 = gcnew XmlSchemaElement; + myXmlElement3->Name = "Subtract"; + myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "a", gcnew XmlQualifiedName( "s:float" ) ) ); + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "b", gcnew XmlQualifiedName( "s:float" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlElement3->SchemaType = myXmlSchemaComplexType; + myXmlSchema->Items->Add( myXmlElement3 ); + XmlSchemaElement^ myXmlElement4 = gcnew XmlSchemaElement; + myXmlElement4->Name = "SubtractResponse"; + myXmlSchemaComplexType = gcnew XmlSchemaComplexType; + myXmlSchemaSequence = gcnew XmlSchemaSequence; + myXmlSchemaSequence->Items->Add( CreateComplexTypeXmlElement( "1", "1", "SubtractResult", gcnew XmlQualifiedName( "s:int" ) ) ); + myXmlSchemaComplexType->Particle = myXmlSchemaSequence; + myXmlElement4->SchemaType = myXmlSchemaComplexType; + myXmlSchema->Items->Add( myXmlElement4 ); + + // Add the schemas to the Types property of the ServiceDescription. + myServiceDescription->Types->Schemas->Add( myXmlSchema ); + // + + // + FileStream^ myFileStream = gcnew FileStream( "output.wsdl",FileMode::OpenOrCreate,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + + // Write the WSDL. + Console::WriteLine( "Writing a new WSDL file." ); + myServiceDescription->Write( myStreamWriter ); + myStreamWriter->Close(); + myFileStream->Close(); + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception Caught! {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp b/snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp new file mode 100644 index 00000000000..c6ed8c5b45d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Service_Class4/CPP/service_class.cpp @@ -0,0 +1,95 @@ +// System.Web.Services.Description.Service.Ports +// System.Web.Services.Description.Service.Extensions +// System.Web.Services.Description.Service.Service() +// System.Web.Services.Description.Service.Name + +/*The following sample demonstrates the properties 'Ports','Extensions','Name' and +constructor 'Service()'. This sample reads the contents of a file 'MathService_cs.wsdl' +into a 'ServiceDescription' instance. It gets the collection of Service +instances from 'ServiceDescription'. It then removes a 'Service' from the collection and +creates a new 'Service' and adds it into collection. It writes a new web service description +file 'MathService_New.wsdl'. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +Port^ CreatePort( String^ PortName, String^ BindingName, String^ targetNamespace ) +{ + Port^ myPort = gcnew Port; + myPort->Name = PortName; + myPort->Binding = gcnew XmlQualifiedName( BindingName,targetNamespace ); + + // Create a SoapAddress extensibility element to add to the port. + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/Service_Class/MathService_CS.asmx"; + myPort->Extensions->Add( mySoapAddressBinding ); + return myPort; +} + +int main() +{ + try + { + // + // + // + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MathService_CS.wsdl" ); + ServiceCollection^ myServiceCollection = myServiceDescription->Services; + int noOfServices = myServiceCollection->Count; + Console::WriteLine( "\nTotal number of services: {0}", noOfServices ); + + // Get a reference to the service. + Service^ myOldService = myServiceCollection[ 0 ]; + Console::WriteLine( "No. of Ports in the Service{0}", myServiceCollection[ 0 ]->Ports->Count ); + Console::WriteLine( "These are the ports in the service:" ); + for ( int i = 0; i < myOldService->Ports->Count; i++ ) + Console::WriteLine( "Port name: {0}", myOldService->Ports[ i ]->Name ); + Console::WriteLine( "Service name: {0}", myOldService->Name ); + Service^ myService = gcnew Service; + myService->Name = "MathService"; + + // Add the ports to the newly created service. + for ( int i = 0; i < myOldService->Ports->Count; i++ ) + { + String^ PortName = myServiceCollection[ 0 ]->Ports[ i ]->Name; + String^ BindingName = myServiceCollection[ 0 ]->Ports[ i ]->Binding->Name; + myService->Ports->Add( CreatePort( PortName, BindingName, myServiceDescription->TargetNamespace ) ); + + } + Console::WriteLine( "Newly created ports -" ); + for ( int i = 0; i < myService->Ports->Count; i++ ) + Console::WriteLine( "Port Name: {0}", myOldService->Ports[ i ]->Name ); + + // Add the extensions to the newly created service. + int noOfExtensions = myOldService->Extensions->Count; + Console::WriteLine( "No. of extensions: {0}", noOfExtensions ); + if ( noOfExtensions > 0 ) + { + for ( int i = 0; i < myOldService->Ports->Count; i++ ) + myService->Extensions->Add( myServiceCollection[ 0 ]->Extensions[ i ] ); + } + + // Remove the service from the collection. + myServiceCollection->Remove( myOldService ); + + // Add the newly created service. + myServiceCollection->Add( myService ); + myServiceDescription->Write( "MathService_New.wsdl" ); + // + // + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } + +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp new file mode 100644 index 00000000000..4386b6e2533 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SinkProviders/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Security::Permissions; + +[SecurityPermission(SecurityAction::Demand)] +int main() +{ + // + IDictionary^ prop = gcnew Hashtable; + prop[ "port" ] = 9000; + IClientChannelSinkProvider^ clientChain = gcnew BinaryClientFormatterSinkProvider; + IServerChannelSinkProvider^ serverChain = gcnew SoapServerFormatterSinkProvider; + serverChain->Next = gcnew BinaryServerFormatterSinkProvider; + ChannelServices::RegisterChannel( gcnew HttpChannel( prop,clientChain,serverChain ) ); + // + + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp new file mode 100644 index 00000000000..076a9f19088 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttribues.SoapDefaultValue/CPP/defvalue.cpp @@ -0,0 +1,126 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Schema; +using namespace System::ComponentModel; +public ref class Group +{ +public: + + // The default is set to .NET. + + [DefaultValue(".NET")] + String^ GroupName; +}; + +public ref class Run +{ +public: + void SerializeOriginal( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Setting the GroupName to '.NET' is like not setting it at all + // because it is the default value. So no value will be + // serialized, and on deserialization it will appear as a blank. + myGroup->GroupName = ".NET"; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); + } + + void SerializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class + // that overrides the serialization. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // The specifies that the default value is now + // 'Team1'. So setting the GroupName to '.NET' means + // the value will be serialized. + myGroup->GroupName = ".NET"; + + // Serialize the class, and close the TextWriter. + overRideSerializer->Serialize( writer, myGroup ); + writer->Close(); + } + + void DeserializeOriginal( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = gcnew XmlSerializer( Group::typeid ); + + // Reading the file requires a TextReader. + TextReader^ reader = gcnew StreamReader( filename ); + + // Deserialize and cast the Object*. + Group^ myGroup; + myGroup = safe_cast(mySerializer->Deserialize( reader )); + Console::WriteLine( myGroup->GroupName ); + Console::WriteLine(); + } + + void DeserializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + + // Reading the file requires a TextReader. + TextReader^ reader = gcnew StreamReader( filename ); + + // Deserialize and cast the Object*. + Group^ myGroup; + myGroup = safe_cast(overRideSerializer->Deserialize( reader )); + Console::WriteLine( myGroup->GroupName ); + } + +private: + XmlSerializer^ CreateOverrideSerializer() + { + SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; + SoapAttributes^ soapAtts = gcnew SoapAttributes; + + // Create a new DefaultValueAttribute Object* for the GroupName + // property. + DefaultValueAttribute^ newDefault = gcnew DefaultValueAttribute( "Team1" ); + soapAtts->SoapDefaultValue = newDefault; + mySoapAttributeOverrides->Add( Group::typeid, "GroupName", soapAtts ); + + // Create an XmlTypeMapping that is used to create an instance + // of the XmlSerializer. Then return the XmlSerializer Object*. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); + return ser; + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeOriginal( "SoapOriginal.xml" ); + test->SerializeOverride( "mySoapAttributeOverridesideAttributes.xml" ); + test->DeserializeOriginal( "SoapOriginal.xml" ); + test->DeserializeOverride( "mySoapAttributeOverridesideAttributes.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp new file mode 100644 index 00000000000..6c2fca3bb4d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttribute/CPP/soapattribute.cpp @@ -0,0 +1,115 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Schema; + +//using namespace System::Runtime::Remoting::Metadata; +public ref class Vehicle +{ +public: + String^ licenseNumber; +}; + + +[SoapInclude(Vehicle::typeid)] +public ref class Group +{ +public: + + [SoapAttributeAttribute(Namespace="http://www.cpandl.com")] + String^ GroupName; + + [SoapAttributeAttribute(DataType="base64Binary")] + array^GroupNumber; + + [SoapAttributeAttribute(DataType="date",AttributeName="CreationDate")] + DateTime Today; + + [SoapElement(DataType="nonNegativeInteger",ElementName="PosInt")] + String^ PostitiveInt; + Vehicle^ GroupVehicle; +}; + +public ref class Run +{ +public: + void SerializeObject( String^ filename ) + { + // Create an instance of the XmlSerializer class that + // can generate encoded SOAP messages. + XmlSerializer^ mySerializer = ReturnSOAPSerializer(); + Group^ myGroup = MakeGroup(); + + // Writing the file requires a TextWriter. + XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); + writer->Formatting = Formatting::Indented; + writer->WriteStartElement( "wrapper" ); + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->WriteEndElement(); + writer->Close(); + } + + +private: + Group^ MakeGroup() + { + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the Object* properties. + myGroup->GroupName = ".NET"; + array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )}; + myGroup->GroupNumber = hexByte; + DateTime myDate = DateTime(2002,5,2); + myGroup->Today = myDate; + myGroup->PostitiveInt = "10000"; + myGroup->GroupVehicle = gcnew Vehicle; + myGroup->GroupVehicle->licenseNumber = "1234"; + return myGroup; + } + +public: + void DeserializeObject( String^ filename ) + { + // Create an instance of the XmlSerializer class that + // can generate encoded SOAP messages. + XmlSerializer^ mySerializer = ReturnSOAPSerializer(); + + // Reading the file requires an XmlTextReader. + XmlTextReader^ reader = gcnew XmlTextReader( filename ); + reader->ReadStartElement( "wrapper" ); + + // Deserialize and cast the Object*. + Group^ myGroup; + myGroup = safe_cast(mySerializer->Deserialize( reader )); + reader->ReadEndElement(); + reader->Close(); + } + +private: + XmlSerializer^ ReturnSOAPSerializer() + { + + // Create an instance of the XmlSerializer class. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); + return gcnew XmlSerializer( myMapping ); + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeObject( "SoapAtts.xml" ); + test->DeserializeObject( "SoapAtts.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp new file mode 100644 index 00000000000..ca2b9a2176d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeAttributeEx2/CPP/soapattributeex2.cpp @@ -0,0 +1,76 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Group +{ +public: + + // This attribute will be overridden. + + [SoapAttributeAttribute(Namespace="http://www.cpandl.com")] + String^ GroupName; +}; + +public ref class Run +{ +public: + void SerializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class + // that overrides the serialization. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the Object* properties. + myGroup->GroupName = ".NET"; + + // Serialize the class, and close the TextWriter. + overRideSerializer->Serialize( writer, myGroup ); + writer->Close(); + } + +private: + XmlSerializer^ CreateOverrideSerializer() + { + SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; + SoapAttributes^ mySoapAttributes = gcnew SoapAttributes; + + // Create a new SoapAttributeAttribute to the + // one applied to the Group class. The resulting XML + // stream will use the new namespace and attribute name. + SoapAttributeAttribute^ mySoapAttribute = gcnew SoapAttributeAttribute; + mySoapAttribute->AttributeName = "TeamName"; + + // Change the Namespace. + mySoapAttribute->Namespace = "http://www.cohowinery.com"; + mySoapAttributes->SoapAttribute = mySoapAttribute; + mySoapAttributeOverrides->Add( Group::typeid, "GroupName", mySoapAttributes ); + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); + return ser; + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeOverride( "SoapOveride.xml" ); +} + +// +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp new file mode 100644 index 00000000000..723d53337e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 1/CPP/attadd.cpp @@ -0,0 +1,72 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +public ref class Group +{ +public: + // Override the serialization of this member. + String^ GroupName; +}; + +public ref class Run +{ +public: + void SerializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class + // that overrides the serialization. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + myGroup->GroupName = ".NET"; + + // Serialize the class, and close the TextWriter. + overRideSerializer->Serialize( writer, myGroup ); + writer->Close(); + } + +private: + XmlSerializer^ CreateOverrideSerializer() + { + SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; + SoapAttributes^ mySoapAttributes = gcnew SoapAttributes; + SoapElementAttribute^ mySoapElement = gcnew SoapElementAttribute; + mySoapElement->ElementName = "TeamName"; + mySoapAttributes->SoapElement = mySoapElement; + + // Add the SoapAttributes to the + // mySoapAttributeOverridesrides object. + mySoapAttributeOverrides->Add( Group::typeid, "GroupName", mySoapAttributes ); + + // Get the SoapAttributes with the Item property. + SoapAttributes^ thisSoapAtts = mySoapAttributeOverrides[Group::typeid, "GroupName"]; + Console::WriteLine( "New serialized element name: {0}", thisSoapAtts->SoapElement->ElementName ); + + // Create an XmlTypeMapping that is used to create an instance + // of the XmlSerializer. Then return the XmlSerializer object. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))-> + ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); + + return ser; + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeOverride( "GetSoapAttributes.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp new file mode 100644 index 00000000000..e35e9d519f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttributeOverrides.Item property 2/CPP/attadd2.cpp @@ -0,0 +1,72 @@ +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// The name of this type will be overridden using +// the SoapTypeAttribute. +public ref class Group +{ +public: + String^ GroupName; +}; + +public ref class Run +{ +public: + void SerializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class + // that overrides the serialization. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + myGroup->GroupName = ".NET"; + + // Serialize the class, and close the TextWriter. + overRideSerializer->Serialize( writer, myGroup ); + writer->Close(); + } + +private: + XmlSerializer^ CreateOverrideSerializer() + { + SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; + SoapAttributes^ mySoapAttributes = gcnew SoapAttributes; + SoapTypeAttribute^ mySoapType = gcnew SoapTypeAttribute; + mySoapType->TypeName = "Team"; + mySoapAttributes->SoapType = mySoapType; + + // Add the SoapAttributes to the + // mySoapAttributeOverridesrides object. + mySoapAttributeOverrides->Add( Group::typeid, mySoapAttributes ); + + // Get the SoapAttributes with the Item property. + SoapAttributes^ thisSoapAtts = mySoapAttributeOverrides[ Group::typeid ]; + Console::WriteLine( "New serialized type name: {0}", thisSoapAtts->SoapType->TypeName ); + + // Create an XmlTypeMapping that is used to create an instance + // of the XmlSerializer. Then return the XmlSerializer object. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))-> + ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); + return ser; + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeOverride( "GetSoapAttributes2.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp new file mode 100644 index 00000000000..97fc8013fb4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttributes1/CPP/s.cpp @@ -0,0 +1,50 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Serialization::Formatters::Soap; +using namespace System::Runtime::Remoting::Metadata; + +// A test Object* that needs to be serialized +// +[Serializable] +[SoapTypeAttribute(XmlNamespace="MyXmlNamespace")] +public ref class TestSimpleObject +{ +public: + int member1; + + [SoapFieldAttribute(XmlElementName="MyXmlElement")] String^ member2; + + String^ member3; + double member4; + + // A field that is not serialized. + + [NonSerialized] String^ member5; + + TestSimpleObject() + { + member1 = 11; + member2 = "hello"; + member3 = "hello"; + member4 = 3.14159265; + member5 = "hello world!"; + } +}; +// + +int main() +{ + // Creates a new TestSimpleObject Object^. + TestSimpleObject^ obj = gcnew TestSimpleObject; + + // Opens a file and serializes the Object^ into it in binary format. + Stream^ stream = File::Open( "data.xml", FileMode::Create ); + SoapFormatter^ formatter = gcnew SoapFormatter; + formatter->Serialize( stream, obj ); + stream->Close(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp new file mode 100644 index 00000000000..cd4ad348629 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapAttributesOverrides/CPP/soapover.cpp @@ -0,0 +1,246 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Schema; +ref class Car; + +// SoapInclude allows Vehicle to accept Car type. + +[SoapInclude(Car::typeid)] +public ref class Vehicle abstract +{ +public: + String^ licenseNumber; + DateTime makeDate; +}; + +public ref class Car: public Vehicle{}; + +public enum class GroupType +{ + // These enums can be overridden. + [SoapEnum("Small")] + A, + [SoapEnum("Large")] + B +}; + +public ref class Group +{ +public: + + [SoapAttributeAttribute(Namespace="http://www.cpandl.com")] + String^ GroupName; + + [SoapAttributeAttribute(DataType="base64Binary")] + array^GroupNumber; + + [SoapAttributeAttribute(DataType="date",AttributeName="CreationDate")] + DateTime Today; + + [SoapElement(DataType="nonNegativeInteger",ElementName="PosInt")] + String^ PostitiveInt; + + // This is ignored when serialized unless it's overridden. + + [SoapIgnore] + bool IgnoreThis; + GroupType Grouptype; + Vehicle^ MyVehicle; + + // The SoapInclude allows the method to return a Car. + + [SoapInclude(Car::typeid)] + Vehicle^ myCar( String^ licNumber ) + { + Vehicle^ v; + if ( licNumber->Equals( "" ) ) + { + v = gcnew Car; + v->licenseNumber = "!!!!!!"; + } + else + { + v = gcnew Car; + v->licenseNumber = licNumber; + } + + return v; + } +}; + +public ref class Run +{ +public: + static void main() + { + Run^ test = gcnew Run; + test->SerializeOriginal( "SoapOriginal.xml" ); + test->SerializeOverride( "SoapOverrides.xml" ); + test->DeserializeOriginal( "SoapOriginal.xml" ); + test->DeserializeOverride( "SoapOverrides.xml" ); + } + + void SerializeOriginal( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); + XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping ); + Group^ myGroup = MakeGroup(); + + // Writing the file requires a TextWriter. + XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); + writer->Formatting = Formatting::Indented; + writer->WriteStartElement( "wrapper" ); + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->WriteEndElement(); + writer->Close(); + } + + void SerializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class + // that overrides the serialization. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + Group^ myGroup = MakeGroup(); + + // Writing the file requires a TextWriter. + XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); + writer->Formatting = Formatting::Indented; + writer->WriteStartElement( "wrapper" ); + + // Serialize the class, and close the TextWriter. + overRideSerializer->Serialize( writer, myGroup ); + writer->WriteEndElement(); + writer->Close(); + } + +private: + Group^ MakeGroup() + { + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the object properties. + myGroup->GroupName = ".NET"; + array^hexByte = {Convert::ToByte( 100 ),Convert::ToByte( 50 )}; + myGroup->GroupNumber = hexByte; + DateTime myDate = DateTime(2002,5,2); + myGroup->Today = myDate; + myGroup->PostitiveInt = "10000"; + myGroup->IgnoreThis = true; + myGroup->Grouptype = GroupType::B; + Car^ thisCar = dynamic_cast(myGroup->myCar( "1234566" )); + myGroup->MyVehicle = thisCar; + return myGroup; + } + +public: + void DeserializeOriginal( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); + XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping ); + + // Reading the file requires an XmlTextReader. + XmlTextReader^ reader = gcnew XmlTextReader( filename ); + reader->ReadStartElement( "wrapper" ); + + // Deserialize and cast the object. + Group^ myGroup; + myGroup = dynamic_cast(mySerializer->Deserialize( reader )); + reader->ReadEndElement(); + reader->Close(); + } + + void DeserializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlSerializer^ overRideSerializer = CreateOverrideSerializer(); + + // Reading the file requires an XmlTextReader. + XmlTextReader^ reader = gcnew XmlTextReader( filename ); + reader->ReadStartElement( "wrapper" ); + + // Deserialize and cast the object. + Group^ myGroup; + myGroup = dynamic_cast(overRideSerializer->Deserialize( reader )); + reader->ReadEndElement(); + reader->Close(); + ReadGroup( myGroup ); + } + +private: + void ReadGroup( Group^ myGroup ) + { + Console::WriteLine( myGroup->GroupName ); + Console::WriteLine( myGroup->GroupNumber[ 0 ] ); + Console::WriteLine( myGroup->GroupNumber[ 1 ] ); + Console::WriteLine( myGroup->Today ); + Console::WriteLine( myGroup->PostitiveInt ); + Console::WriteLine( myGroup->IgnoreThis ); + Console::WriteLine(); + } + + XmlSerializer^ CreateOverrideSerializer() + { + SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; + SoapAttributes^ soapAtts = gcnew SoapAttributes; + SoapElementAttribute^ mySoapElement = gcnew SoapElementAttribute; + mySoapElement->ElementName = "xxxx"; + soapAtts->SoapElement = mySoapElement; + mySoapAttributeOverrides->Add( Group::typeid, "PostitiveInt", soapAtts ); + + // Override the IgnoreThis property. + SoapIgnoreAttribute^ myIgnore = gcnew SoapIgnoreAttribute; + soapAtts = gcnew SoapAttributes; + soapAtts->SoapIgnore = false; + mySoapAttributeOverrides->Add( Group::typeid, "IgnoreThis", soapAtts ); + + // Override the GroupType enumeration. + soapAtts = gcnew SoapAttributes; + SoapEnumAttribute^ xSoapEnum = gcnew SoapEnumAttribute; + xSoapEnum->Name = "Over1000"; + soapAtts->GroupType::SoapEnum = xSoapEnum; + + // Add the SoapAttributes to the + // mySoapAttributeOverridesrides object. + mySoapAttributeOverrides->Add( GroupType::typeid, "A", soapAtts ); + + // Create second enumeration and add it. + soapAtts = gcnew SoapAttributes; + xSoapEnum = gcnew SoapEnumAttribute; + xSoapEnum->Name = "ZeroTo1000"; + soapAtts->GroupType::SoapEnum = xSoapEnum; + mySoapAttributeOverrides->Add( GroupType::typeid, "B", soapAtts ); + + // Override the Group type. + soapAtts = gcnew SoapAttributes; + SoapTypeAttribute^ soapType = gcnew SoapTypeAttribute; + soapType->TypeName = "Team"; + soapAtts->SoapType = soapType; + mySoapAttributeOverrides->Add( Group::typeid, soapAtts ); + + // Create an XmlTypeMapping that is used to create an instance + // of the XmlSerializer. Then return the XmlSerializer object. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); + return ser; + } +}; + +int main() +{ + Run::main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp new file mode 100644 index 00000000000..477f2e9539d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapBindingStyle_Rpc/CPP/soapbindingstyle_rpc.cpp @@ -0,0 +1,110 @@ +// System::Web::Services::Description.SoapBindingStyle::Rpc +// System::Web::Services::Description.SoapBindingUse::Encoded +// System::Web::Services::Description.SoapBodyBinding::Encoding +// System::Web::Services::Description.SoapBodyBinding::Namespace +// System::Web::Services::Description.SoapHeaderBinding::Encoding +// System::Web::Services::Description.SoapHeaderBinding::Namespace + +/* +The following example demonstrates the 'Rpc' member of 'SoapBindingStyle' +enumeration , 'Encoded' member of 'SoapBindingUse' enumeration , 'Encoding' +and 'Namespace' properties of 'SoapBodyBinding' class and 'Encoding' +and 'Namespace' properties of 'SoapHeaderBinding' class. +It takes as input a wsdl file which does not contain a binding for SOAP. +By using the 'Read' method of 'ServiceDescription' class it gets a 'ServiceDescription' Object*. +It uses the SOAP protocol related classes and creates 'Binding' element +of 'SOAP' protocol which are then added to the 'ServiceDescription' Object*. +An output wsdl file is generated from 'ServiceDescription' Object* which +could be used for generating a proxy. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myServiceDescription = + ServiceDescription::Read( "SoapBindingStyleInput_cpp.wsdl" ); + Binding^ myBinding = gcnew Binding; + myBinding->Name = "SOAPSvrMgr_SOAPBinding"; + myBinding->Type = gcnew XmlQualifiedName( "tns:SOAPSvrMgr_portType" ); + +// + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + // Message to be transmitted contains parameters to call a procedure. + mySoapBinding->Style = SoapBindingStyle::Rpc; + myBinding->Extensions->Add( mySoapBinding ); +// + + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "GetServerStats"; + + SoapOperationBinding^ mySoapOperationBinding = + gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = + "http://tempuri.org/soapsvcmgr/GetServerStats"; + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + + // Create InputBinding for operation for the 'SOAP' protocol. + InputBinding^ myInputBinding = gcnew InputBinding; + +// +// +// + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + // Encode SOAP body using rules specified by the 'Encoding' property. + mySoapBodyBinding->Use = SoapBindingUse::Encoded; + // Set URI representing the encoding style for encoding the body. + mySoapBodyBinding->Encoding = "http://schemas.xmlsoap.org/soap/encoding/"; + // Set the Uri representing the location of the specification + // for encoding of content not defined by 'Encoding' property'. + mySoapBodyBinding->Namespace = "http://tempuri.org/soapsvcmgr/"; + myInputBinding->Extensions->Add( mySoapBodyBinding ); +// +// +// + +// +// + SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding; + mySoapHeaderBinding->Message = + gcnew XmlQualifiedName( "tns:Soapsvcmgr_Headers_Request" ); + mySoapHeaderBinding->Part = "AuthCS"; + // Encode SOAP header using rules specified by the 'Encoding' property. + mySoapHeaderBinding->Use = SoapBindingUse::Encoded; + // Set URI representing the encoding style for encoding the header. + mySoapHeaderBinding->Encoding = "http://schemas.xmlsoap.org/soap/encoding/"; + // Set the Uri representing the location of the specification + // for encoding of content not defined by 'Encoding' property'. + mySoapHeaderBinding->Namespace = "http://tempuri.org/SOAPSvr/soapsvcmgr/headers.xsd"; + // Add mySoapHeaderBinding to the 'myInputBinding' Object*. + myInputBinding->Extensions->Add( mySoapHeaderBinding ); +// +// + + // Create OutputBinding for operation. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + mySoapHeaderBinding->Part = "AuthSC"; + mySoapHeaderBinding->Message = + gcnew XmlQualifiedName( "tns:Soapsvcmgr_Headers_Response" ); + myOutputBinding->Extensions->Add( mySoapHeaderBinding ); + + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + myBinding->Operations->Add( myOperationBinding ); + + myServiceDescription->Bindings->Add( myBinding ); + myServiceDescription->Write( "SoapBindingStyleOutput_cpp.wsdl" ); + Console::WriteLine( "'SoapBindingStyleOutput_cpp.wsdl' file is generated." ); + Console::WriteLine( "Proxy could be created using command" + + " 'wsdl SoapBindingStyleOutput_cpp.wsdl'" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp new file mode 100644 index 00000000000..80ca9900bb5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapBinding_SoapOperationBinding/CPP/soapprotocol.cpp @@ -0,0 +1,178 @@ +// System.Web.Services.Description.SoapBinding.ctor +// System.Web.Services.Description.SoapBinding.Transport +// System.Web.Services.Description.SoapBinding.Style +// System.Web.Services.Description.SoapBindingStyle.Document +// System.Web.Services.Description.SoapOperationBinding.ctor +// System.Web.Services.Description.SoapOperationBinding.SoapAction +// System.Web.Services.Description.SoapOperationBinding.Style +// System.Web.Services.Description.SoapBodyBinding.ctor +// System.Web.Services.Description.SoapBodyBinding.Use +// System.Web.Services.Description.SoapBindingUse.Literal +// System.Web.Services.Description.SoapAddressBinding.ctor +// System.Web.Services.Description.SoapAddressBinding.Location + +/* +The following example demonstrates the 'SoapBinding' constructor,'Transport','Style' +properties of 'SoapBinding' class,'Document' member of 'SoapBindingStyle' enum, +'SoapOperationBinding' constructor,'SoapAction','Style' properties of 'SoapOperationBinding' +class, 'SoapBodyBinding' contructor,'Use' property of 'SoapBodyBinding' class, +'Literal' member of 'SoapBindingUse' enum and 'SoapAddressBinding' constructor, 'Location' +property of class 'SoapAddressBinding'. + +It takes as input a wsdl file which supports two protocols 'HttpGet' and 'HttpPost' . +By using the 'Read' method of 'ServiceDescription' class it gets a 'ServiceDescription' +object. It uses the SOAP protocol related classes and creates 'Binding','Port', +'PortType' and 'Message' elements of 'SOAP' protocol. It adds all these elements to +the 'ServiceDescription' object. The 'ServiceDescription' object creates another +wsdl file which supports 'SOAP' also. This wsdl file is used to generate a proxy +which is used by the .aspx file. +Note: To run the example run the makefile provided and open the '.aspx' file in browser. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); + + // Create a 'Binding' object for the 'SOAP' protocol. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Service1Soap"; + XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); + myBinding->Type = qualifiedName; + + // + // + // + // + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + + // Add the 'SoapBinding' object to the 'Binding' object. + myBinding->Extensions->Add( mySoapBinding ); + // + // + // + // + + // Create the 'OperationBinding' object for the 'SOAP' protocol. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + + // + // + // + // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + + // Add the 'SoapOperationBinding' object to 'OperationBinding' object. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + // + // + // + + // + // + // + // Create the 'InputBinding' object for the 'SOAP' protocol. + InputBinding^ myInput = gcnew InputBinding; + SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; + mySoapBinding1->Use = SoapBindingUse::Literal; + myInput->Extensions->Add( mySoapBinding1 ); + + // Add the 'InputBinding' object to 'OperationBinding' object. + myOperationBinding->Input = myInput; + + // Create the 'OutputBinding' object'. + OutputBinding^ myOutput = gcnew OutputBinding; + myOutput->Extensions->Add( mySoapBinding1 ); + + // Add the 'OutputBinding' object to 'OperationBinding' object. + myOperationBinding->Output = myOutput; + + // Add the 'OperationBinding' object to 'Binding' object. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' object to the ServiceDescription instance. + myDescription->Bindings->Add( myBinding ); + // + // + // + + // + // + Port^ soapPort = gcnew Port; + soapPort->Name = "Service1Soap"; + soapPort->Binding = gcnew XmlQualifiedName( "s0:Service1Soap" ); + + // Create a 'SoapAddressBinding' object for the 'SOAP' protocol. + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/Service1_cs.asmx"; + + // Add the 'SoapAddressBinding' object to the 'Port'. + soapPort->Extensions->Add( mySoapAddressBinding ); + + // Add the 'Port' object to the ServiceDescription instance. + myDescription->Services[ 0 ]->Ports->Add( soapPort ); + // + // + + // Create a 'PortType' object. for SOAP protocol. + PortType^ soapPortType = gcnew PortType; + soapPortType->Name = "Service1Soap"; + Operation^ soapOperation = gcnew Operation; + soapOperation->Name = "AddNumbers"; + OperationMessage^ soapInput = (OperationMessage^)(gcnew OperationInput); + soapInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersSoapIn" ); + OperationMessage^ soapOutput = (OperationMessage^)(gcnew OperationOutput); + soapOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersSoapOut" ); + soapOperation->Messages->Add( soapInput ); + soapOperation->Messages->Add( soapOutput ); + + // Add the 'Operation' object to 'PortType' object. + soapPortType->Operations->Add( soapOperation ); + + // Add the 'PortType' object first to 'PortTypeCollection' object + // and then to 'ServiceDescription' object. + myDescription->PortTypes->Add( soapPortType ); + + // Create the 'Message' object. + Message^ soapMessage1 = gcnew Message; + soapMessage1->Name = "AddNumbersSoapIn"; + + // Create the 'MessageParts' object. + MessagePart^ soapMessagePart1 = gcnew MessagePart; + soapMessagePart1->Name = "parameters"; + soapMessagePart1->Element = gcnew XmlQualifiedName( "s0:AddNumbers" ); + + // Add the 'MessagePart' object to 'Messages' object. + soapMessage1->Parts->Add( soapMessagePart1 ); + + // Create another 'Message' object. + Message^ soapMessage2 = gcnew Message; + soapMessage2->Name = "AddNumbersSoapOut"; + MessagePart^ soapMessagePart2 = gcnew MessagePart; + soapMessagePart2->Name = "parameters"; + soapMessagePart2->Element = gcnew XmlQualifiedName( "s0:AddNumbersResponse" ); + + // Add the 'MessagePart' object to second 'Message' object. + soapMessage2->Parts->Add( soapMessagePart2 ); + + // Add the 'Message' objects to 'ServiceDescription'. + myDescription->Messages->Add( soapMessage1 ); + myDescription->Messages->Add( soapMessage2 ); + + // Write the 'ServiceDescription' object as a WSDL file. + myDescription->Write( "AddNumbersOut_cs.wsdl" ); + Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp new file mode 100644 index 00000000000..72d797fd574 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapBodyBinding_Parts/CPP/soapbodybinding_parts.cpp @@ -0,0 +1,89 @@ +// System.Web.Services.Description.SoapBinding.Namespace +// System.Web.Services.Description.SoapBodyBinding.Parts + +/* +The following example demonstrates the 'Namespace' field of 'SoapBinding' class +and 'parts' property of 'SoapBodyBinding' class. +It takes a wsdl file which supports two protocols 'HttpGet' and 'HttpPost' as input. By +using the 'Read' method of 'ServiceDescription' class it gets the 'ServiceDescription' +object. It uses the SOAP protocol related classes to create 'Binding' elements of +'SOAP' protocol. It adds all the elements to the 'ServiceDescription' object. The +'ServiceDescription' object creates another wsdl file which supports 'SOAP' protocol +also. This wsdl file is used to generate a proxy which is used by the .aspx file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myDescription = + ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); + // Create a 'Binding' object for the 'SOAP' protocol. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Service1Soap"; + XmlQualifiedName^ qualifiedName = + gcnew XmlQualifiedName( "s0:Service1Soap" ); + + myBinding->Type = qualifiedName; + +// + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + // Get the URI for XML namespace of the SoapBinding class. + String^ myNameSpace = SoapBinding::Namespace; + Console::WriteLine( "The URI of the XML Namespace is :{0}", myNameSpace ); +// + + // Add the 'SoapBinding' object to the 'Binding' object. + myBinding->Extensions->Add( mySoapBinding ); + + // Create the 'OperationBinding' object for the 'SOAP' protocol. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + + // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. + SoapOperationBinding^ mySoapOperationBinding = + gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + // Add the 'SoapOperationBinding' object to 'OperationBinding' object. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + +// + // Create the 'InputBinding' object for the 'SOAP' protocol. + InputBinding^ myInput = gcnew InputBinding; + SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; + mySoapBinding1->Use = SoapBindingUse::Literal; + + array^ myParts = gcnew array(1); + myParts[ 0 ] = "parameters"; + // Set the names of the message parts to appear in the SOAP body. + mySoapBinding1->Parts = myParts; + myInput->Extensions->Add( mySoapBinding1 ); + // Add the 'InputBinding' object to 'OperationBinding' object. + myOperationBinding->Input = myInput; + // Create the 'OutputBinding' object'. + OutputBinding^ myOutput = gcnew OutputBinding; + myOutput->Extensions->Add( mySoapBinding1 ); + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; +// + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "AddNumbersOut_cs.wsdl" ); + Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp new file mode 100644 index 00000000000..406e0c2a195 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_BaseChannelSinkWithProperties/CPP/soapclientformattersinkprovider_customprovider.cpp @@ -0,0 +1,173 @@ + +// System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider.CreateSink +// System.Runtime.Remoting.Channels.BaseChannelSinkWithProperties +/* +The following example demonstrates the 'BaseChannelSinkWithProperties' +class and 'CreateSink' method of 'SoapClientFormatterSinkProvider' class. +Custom client formatter provider is defined by implementing +the 'IClientChannelSinkProvider' interface and custom channel sink is +defined by inheriting 'BaseChannelSinkWithProperties' abstract class. +The sink provider chain has the custom sink provider and +'SoapClientFormatterSinkProvider'. The 'CreateSink' method is used to +return a sink to the caller and form the sink chain which is used to process +the message being passed through it. +*/ +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Security::Permissions; + +public ref class MyKey{}; + +// +[SecurityPermission(SecurityAction::Demand, Flags = SecurityPermissionFlag::Infrastructure)] +private ref class MyClientFormatterChannelSink: public BaseChannelSinkWithProperties, public IClientChannelSink, public IMessageSink +{ +private: + IClientChannelSink^ nextClientSink; + IMessageSink^ nextMessageSink; + +public: + MyClientFormatterChannelSink() + : nextClientSink( nullptr ), nextMessageSink( nullptr ) + {} + + MyClientFormatterChannelSink( IClientChannelSink^ nextSink, IMessageSink^ nextMsgSink ) + : BaseChannelSinkWithProperties() + { + nextClientSink = nextSink; + nextMessageSink = nextMsgSink; + } + + virtual void ProcessMessage( IMessage^ message, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) + { + nextClientSink->ProcessMessage( message, requestHeaders, requestStream, responseHeaders, responseStream ); + } + + + + virtual void AsyncProcessRequest( IClientChannelSinkStack^ sinkStack, IMessage^ msg, ITransportHeaders^ headers, Stream^ myStream ) + { + sinkStack->Push( this, nullptr ); + nextClientSink->AsyncProcessRequest( sinkStack, msg, headers, myStream ); + } + + virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ sinkStack, Object^ /*state*/, ITransportHeaders^ headers, Stream^ myStream ) + { + sinkStack->AsyncProcessResponse( headers, myStream ); + } + + virtual Stream^ GetRequestStream( IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) + { + return nullptr; + } + + + property IClientChannelSink^ NextChannelSink + { + virtual IClientChannelSink^ get() + { + return nextClientSink; + } + + } + + property IMessageSink^ NextSink + { + virtual IMessageSink^ get() + { + return nextMessageSink; + } + + } + + virtual IMessageCtrl^ AsyncProcessMessage( IMessage^ /*msg*/, IMessageSink^ /*replySink*/ ) + { + return nullptr; + } + + virtual IMessage^ SyncProcessMessage( IMessage^ msg ) + { + return nextMessageSink->SyncProcessMessage( msg ); + } + + + property Object^ Item [Object^] + { + virtual Object^ get( Object^ key ) override + { + if ( key == MyKey::typeid ) + return this; + + return nullptr; + } + + virtual void set( Object^ /*value*/, Object^ /*key*/ ) override + { + throw gcnew NotSupportedException; + } + + } + + property ICollection^ Keys + { + virtual ICollection^ get() override + { + ArrayList^ myKeys = gcnew ArrayList( 1 ); + myKeys->Add( MyKey::typeid ); + return myKeys; + } + + } + +}; + + + +// +[SecurityPermission(SecurityAction::Demand, Flags = SecurityPermissionFlag::Infrastructure)] +public ref class MyClientFormatterProvider: public IClientChannelSinkProvider +{ +private: + IClientChannelSinkProvider^ nextProvider; + +public: + MyClientFormatterProvider() : nextProvider( nullptr ) {} + + virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ myUrl, Object^ remoteChannelData ) + { + // + IClientChannelSink^ nextSink = nullptr; + IMessageSink^ nextMsgSink = nullptr; + if ( nextProvider != nullptr ) + { + Console::WriteLine( "Next client sink provider is: {0}", nextProvider ); + + // Create a sink chain calling the next sink provider's + // 'CreateSink' method. + nextSink = nextProvider->CreateSink( channel, myUrl, remoteChannelData ); + nextMsgSink = dynamic_cast(nextSink); + } + // + return gcnew MyClientFormatterChannelSink( nextSink,nextMsgSink ); + } + + property IClientChannelSinkProvider^ Next + { + virtual IClientChannelSinkProvider^ get() + { + return nextProvider; + } + + virtual void set( IClientChannelSinkProvider^ value ) + { + nextProvider = value; + } + } +}; + + + diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp new file mode 100644 index 00000000000..269324a7eaf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapClientFormatterSinkProvider_Next_Create/CPP/soapclientformattersinkprovider_customprovider.cpp @@ -0,0 +1,270 @@ + +// System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider.CreateSink +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Messaging; + +public ref class MyKey{}; + +private ref class MyClientChannelSink: public BaseChannelObjectWithProperties, public IClientChannelSink +{ +private: + IClientChannelSink^ nextClientSink; + +public: + MyClientChannelSink() + : nextClientSink( nullptr ) + {} + + MyClientChannelSink( IClientChannelSink^ nextSink ) + : BaseChannelObjectWithProperties() + { + nextClientSink = nextSink; + } + + MyClientChannelSink( IChannelSender^ /*channel*/, String^ /*url*/, Object^ /*remoteChannelData*/, IClientChannelSink^ nextSink ) + : BaseChannelObjectWithProperties() + { + nextClientSink = nextSink; + } + + virtual void ProcessMessage( IMessage^ msg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) + { + nextClientSink->ProcessMessage( msg, requestHeaders, requestStream, responseHeaders, responseStream ); + } + + virtual void AsyncProcessRequest( IClientChannelSinkStack^ sinkStack, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ) + { + sinkStack->Push( this, nullptr ); + nextClientSink->AsyncProcessRequest( sinkStack, msg, headers, stream ); + } + + virtual void AsyncProcessResponse( IClientResponseChannelSinkStack^ sinkStack, Object^ /*state*/, ITransportHeaders^ headers, Stream^ stream ) + { + sinkStack->AsyncProcessResponse( headers, stream ); + } + + virtual Stream^ GetRequestStream( IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) + { + return nullptr; + } + + + property IClientChannelSink^ NextChannelSink + { + virtual IClientChannelSink^ get() + { + return nextClientSink; + } + + } + + property Object^ Item [Object^] + { + virtual Object^ get( Object^ key ) override + { + if ( key == MyKey::typeid ) + return this; + + return nullptr; + } + + virtual void set( Object^ /*value*/, Object^ /*key*/ ) override + { + throw gcnew NotSupportedException; + } + + } + + property ICollection^ Keys + { + virtual ICollection^ get() override + { + ArrayList^ myKeys = gcnew ArrayList( 1 ); + myKeys->Add( MyKey::typeid ); + return myKeys; + } + } +}; + +[System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] +public ref class MyClientProvider: public IClientChannelSinkProvider +{ +private: + IClientChannelSinkProvider^ nextProvider; + +public: + MyClientProvider() + : nextProvider( nullptr ) + {} + + MyClientProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} + + virtual IClientChannelSink^ CreateSink( IChannelSender^ channel, String^ myUrl, Object^ remoteChannelData ) + { + IClientChannelSink^ nextSink = nullptr; + if ( nextProvider != nullptr ) + { + nextSink = nextProvider->CreateSink( channel, myUrl, remoteChannelData ); + if ( nextSink == nullptr ) + return nullptr; + } + + return gcnew MyClientChannelSink( nextSink ); + } + + property IClientChannelSinkProvider^ Next + { + virtual IClientChannelSinkProvider^ get() + { + return nextProvider; + } + + virtual void set( IClientChannelSinkProvider^ value ) + { + nextProvider = value; + } + } +}; + +private ref class MyServerChannelSink: public BaseChannelObjectWithProperties, public IServerChannelSink +{ +private: + IServerChannelSink^ nextServerSink; + +public: + MyServerChannelSink() + : nextServerSink( nullptr ) + {} + + MyServerChannelSink( IServerChannelSink^ nextSink ) + : BaseChannelObjectWithProperties() + { + nextServerSink = nextSink; + } + + MyServerChannelSink( IChannelReceiver^ /*channel*/, IServerChannelSink^ nextSink ) + : BaseChannelObjectWithProperties() + { + nextServerSink = nextSink; + } + + virtual ServerProcessing ProcessMessage( IServerChannelSinkStack^ sinkStack, IMessage^ requestMsg, ITransportHeaders^ requestHeaders, Stream^ requestStream, [Out]IMessage^% msg, [Out]ITransportHeaders^% responseHeaders, [Out]Stream^% responseStream ) + { + sinkStack->Push( this, nullptr ); + ServerProcessing processing = nextServerSink->ProcessMessage( sinkStack, requestMsg, requestHeaders, requestStream, msg, responseHeaders, responseStream ); + switch ( processing ) + { + case ServerProcessing::Complete: + sinkStack->Pop( this ); + break; + + case ServerProcessing::OneWay: + sinkStack->Pop( this ); + break; + + case ServerProcessing::Async: + sinkStack->Store( this, nullptr ); + break; + } + return processing; + } + + virtual void AsyncProcessResponse( IServerResponseChannelSinkStack^ sinkStack, Object^ /*state*/, IMessage^ msg, ITransportHeaders^ headers, Stream^ stream ) + { + sinkStack->AsyncProcessResponse( msg, headers, stream ); + } + + virtual Stream^ GetResponseStream( IServerResponseChannelSinkStack^ /*sinkStack*/, Object^ /*state*/, IMessage^ /*msg*/, ITransportHeaders^ /*headers*/ ) + { + return nullptr; + } + + property IServerChannelSink^ NextChannelSink + { + virtual IServerChannelSink^ get() + { + return nextServerSink; + } + + } + + property Object^ Item [Object^] + { + virtual Object^ get( Object^ key ) override + { + if ( key == MyKey::typeid ) + return this; + + return nullptr; + } + + virtual void set( Object^ /*value*/, Object^ /*key*/ ) override + { + throw gcnew NotSupportedException; + } + + } + + property ICollection^ Keys + { + virtual ICollection^ get() override + { + ArrayList^ myKeys = gcnew ArrayList( 1 ); + myKeys->Add( MyKey::typeid ); + return myKeys; + } + } +}; + +[System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] +public ref class MyServerProvider: public IServerChannelSinkProvider +{ +private: + IServerChannelSinkProvider^ nextProvider; + +public: + MyServerProvider() + : nextProvider( nullptr ) + {} + + MyServerProvider( IDictionary^ /*properties*/, ICollection^ /*providerData*/ ){} + + virtual void GetChannelData( IChannelDataStore^ /*channelData*/ ){} + + virtual IServerChannelSink^ CreateSink( IChannelReceiver^ channel ) + { + // + IServerChannelSink^ nextSink = nullptr; + if ( nextProvider != nullptr ) + { + Console::WriteLine( "The next server provider is:{0}", nextProvider ); + + // Create a sink chain calling the 'SaopServerFormatterProvider' + // 'CreateSink' method. + nextSink = nextProvider->CreateSink( channel ); + } + + return gcnew MyServerChannelSink( nextSink ); + // + } + + + property IServerChannelSinkProvider^ Next + { + virtual IServerChannelSinkProvider^ get() + { + return nextProvider; + } + + virtual void set( IServerChannelSinkProvider^ value ) + { + nextProvider = value; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp new file mode 100644 index 00000000000..6a3351cd473 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapClientMessage/CPP/SoapClientMessage.cpp @@ -0,0 +1,269 @@ +// System.Web.Services.Protocols.SoapClientMessage +// System.Web.Services.Protocols.SoapClientMessage.Action +// System.Web.Services.Protocols.SoapClientMessage.Client +// System.Web.Services.Protocols.SoapClientMessage.MethodInfo +// System.Web.Services.Protocols.SoapClientMessage.OneWay +// System.Web.Services.Protocols.SoapClientMessage.Url + +/* +The following example demonstrates the 'Action', 'Client', 'MethodInfo', +'OneWay' and 'Url' properties of the 'SoapClientMessage' class. +It extends the 'SoapExtension' class to create a class that is used to +log the SOAP messages transferred for a web service method invocation. +To associate this 'SoapExtension' class with the web service method on +the client proxy, a class that extends from 'SoapExtensionAttribute' is +used. This 'SoapExtensionAttribute' is applied to a client proxy method +which is associated with a web service method. Whenever this method is +invoked on the client side all the SOAP message that get transfered both +from the client and the server(which is hosting the web service) are +written into a log file. +*/ + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +ref class MySoapExtension; +ref class MathSvc; + +// A SoapExtensionAttribute that can be associated with an +// XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class MySoapExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + + // Set the name of the log file where SOAP messages will be stored. + MySoapExtensionAttribute() + : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of MySoapExtension. + Type^ get() + { + return typeid; + } + } + + property int Priority + { + // User can set priority of the SoapExtension. + int get() + { + return myPriority; + } + void set( int value ) + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + void set( String^ value ) + { + myFilename = value; + } + } +}; + +public ref class MySoapExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // Return the filename that is to log the SOAP messages. + Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) + { + return (dynamic_cast(attribute))->Filename; + } + + // Return the filename that is to log the SOAP messages. + Object^ GetInitializer( Type^ filename ) + { + return dynamic_cast(filename); + } + + // Save the name of the log file that will save the SOAP messages. + void Initialize( Object^ initializer ) + { + filename = dynamic_cast(initializer); + } + +// + // Process the SOAP message received and write to a log file. + void ProcessMessage( SoapMessage^ message ) + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( dynamic_cast(message) ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( dynamic_cast(message) ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutput( SoapClientMessage^ message ) + { +// +// +// +// +// + newStream->Position = 0; + FileStream^ myFileStream = gcnew FileStream( filename, FileMode::Append, + FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( + "================================== Request at {0}", DateTime::Now ); + + // Print to the log file the request header field for SoapAction header. + myStreamWriter->WriteLine( "The SoapAction Http request header field is: " ); + myStreamWriter->WriteLine( "\t{0}", message->Action ); + + // Print to the log file the type of the client that invoked + // the XML Web service method. + myStreamWriter->WriteLine( "The type of the client is: " ); + if ( (message->Client->GetType())->Equals( typeid ) ) + { + myStreamWriter->WriteLine( "\tMathSvc" ); + } + + // Print to the log file the method invoked by the client. + myStreamWriter->WriteLine( + "The method that has been invoked by the client is:" ); + myStreamWriter->WriteLine( "\t{0}", message->MethodInfo->Name ); + + // Print to the log file if the method invoked is OneWay. + if ( message->OneWay ) + { + myStreamWriter->WriteLine( + "The client doesn't wait for the server to finish processing" ); + } + else + { + myStreamWriter->WriteLine( + "The client waits for the server to finish processing" ); + } + + // Print to the log file the URL of the site that provides + // implementation of the method. + myStreamWriter->WriteLine( + "The URL of the XML Web service method that has been requested is: " ); + myStreamWriter->WriteLine( "\t{0}", message->Url ); + myStreamWriter->WriteLine( "The contents of the SOAP envelope are: " ); + myStreamWriter->Flush(); + + // Copy the contents of one stream to another. + Copy( newStream, myFileStream ); + myFileStream->Close(); + newStream->Position = 0; + + // Copy the contents of one stream to another. + Copy( newStream, oldStream ); +// +// +// +// +// + } +// + + // Write the contents of the incoming SOAP message to the log file. + void WriteInput( SoapClientMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ myFileStream = gcnew FileStream( filename, FileMode::Append, + FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( + "---------------------------------- Response at {0}", DateTime::Now ); + myStreamWriter->Flush(); + newStream->Position = 0; + Copy( newStream, myFileStream ); + myFileStream->Close(); + newStream->Position = 0; + } + + // Return a new MemoryStream for SOAP processing. + Stream^ ChainStream( Stream^ stream ) + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + // Utility method to copy the contents of one stream to another. + void Copy( Stream^ fromStream, Stream^ toStream ) + { + TextReader^ myTextReader = gcnew StreamReader( fromStream ); + TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); + myTextWriter->WriteLine( myTextReader->ReadToEnd() ); + myTextWriter->Flush(); + } +}; + +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", + Namespace="http://tempuri.org/")] +public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ +public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathSvc() + { + this->Url = "http://localhost/MathSvc_SoapClientMessage.asmx"; + } + + [System::Web::Services::Protocols::SoapDocumentMethodAttribute( + "http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [MySoapExtensionAttribute] + Single Add( Single xValue, Single yValue ) + { + array^temp2 = {xValue,yValue}; + array^results = this->Invoke( "Add", temp2 ); + return safe_cast(results[ 0 ]); + } + + System::IAsyncResult^ BeginAdd( Single xValue, Single yValue, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^ temp3 = { xValue, yValue }; + return this->BeginInvoke( "Add", temp3, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return ( (Single)( results[ 0 ] ) ); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp new file mode 100644 index 00000000000..bbc969c59c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapElementOverrides/CPP/soapelementoverrides.cpp @@ -0,0 +1,106 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Collections; +using namespace System::Xml; +using namespace System::Text; +public ref class Thing +{ +public: + + [SoapElement(IsNullable=true)] + String^ ThingName; +}; + +public ref class Transportation +{ +public: + + // The SoapElementAttribute specifies that the + // generated XML element name will be S"Wheels" + // instead of S"Vehicle". + + [SoapElement("Wheels")] + String^ Vehicle; + + [SoapElement(DataType="dateTime")] + DateTime CreationDate; + + [SoapElement(IsNullable=true)] + Thing^ thing; +}; + +public ref class Test +{ +public: + + // Return an XmlSerializer used for overriding. + XmlSerializer^ CreateSoapOverrider() + { + // Create the SoapAttributes and SoapAttributeOverrides objects. + SoapAttributes^ soapAttrs = gcnew SoapAttributes; + SoapAttributeOverrides^ soapOverrides = gcnew SoapAttributeOverrides; + + // Create an SoapElementAttribute to the Vehicles property. + SoapElementAttribute^ soapElement1 = gcnew SoapElementAttribute( "Truck" ); + + // Set the SoapElement to the Object*. + soapAttrs->SoapElement = soapElement1; + + // Add the SoapAttributes to the SoapAttributeOverrides,specifying the member to. + soapOverrides->Add( Transportation::typeid, "Vehicle", soapAttrs ); + + // Create the XmlSerializer, and return it. + XmlTypeMapping^ myTypeMapping = (gcnew SoapReflectionImporter( soapOverrides ))->ImportTypeMapping( Transportation::typeid ); + return gcnew XmlSerializer( myTypeMapping ); + } + + void SerializeOverride( String^ filename ) + { + // Create an XmlSerializer instance. + XmlSerializer^ ser = CreateSoapOverrider(); + + // Create the Object* and serialize it. + Transportation^ myTransportation = gcnew Transportation; + myTransportation->Vehicle = "MyCar"; + myTransportation->CreationDate = DateTime::Now; + myTransportation->thing = gcnew Thing; + XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); + writer->Formatting = Formatting::Indented; + writer->WriteStartElement( "wrapper" ); + ser->Serialize( writer, myTransportation ); + writer->WriteEndElement(); + writer->Close(); + } + + void SerializeObject( String^ filename ) + { + // Create an XmlSerializer instance. + XmlSerializer^ ser = gcnew XmlSerializer( Transportation::typeid ); + Transportation^ myTransportation = gcnew Transportation; + myTransportation->Vehicle = "MyCar"; + myTransportation->CreationDate = DateTime::Now; + myTransportation->thing = gcnew Thing; + XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); + writer->Formatting = Formatting::Indented; + writer->WriteStartElement( "wrapper" ); + ser->Serialize( writer, myTransportation ); + writer->WriteEndElement(); + writer->Close(); + } +}; + +int main() +{ + Test^ t = gcnew Test; + t->SerializeObject( "SoapElementOriginal.xml" ); + t->SerializeOverride( "SoapElementOverride.xml" ); + Console::WriteLine( "Finished writing two XML files." ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp new file mode 100644 index 00000000000..a91c48a0ab8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapEnumOverrides/CPP/soapenumoverrides.cpp @@ -0,0 +1,94 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public enum class GroupType +{ + // Use the SoapEnumAttribute to instruct the XmlSerializer + // to generate Small and Large instead of A and B. + [SoapEnum("Small")] + A, + [SoapEnum("Large")] + B +}; + +public ref class Group +{ +public: + String^ GroupName; + GroupType Grouptype; +}; + +public ref class Run +{ +public: + void SerializeObject( String^ filename ) + { + // Create an instance of the XmlSerializer Class. + XmlTypeMapping^ mapp = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); + XmlSerializer^ mySerializer = gcnew XmlSerializer( mapp ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an instance of the Class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the Object* properties. + myGroup->GroupName = ".NET"; + myGroup->Grouptype = GroupType::A; + + // Serialize the Class, and close the TextWriter. + mySerializer->Serialize( writer, myGroup ); + writer->Close(); + } + + void SerializeOverride( String^ fileName ) + { + SoapAttributeOverrides^ soapOver = gcnew SoapAttributeOverrides; + SoapAttributes^ SoapAtts = gcnew SoapAttributes; + + // Add a SoapEnumAttribute for the GroupType::A enumerator. + // Instead of 'A' it will be S"West". + SoapEnumAttribute^ soapEnum = gcnew SoapEnumAttribute( "West" ); + + // Override the S"A" enumerator. + SoapAtts->GroupType::SoapEnum = soapEnum; + soapOver->Add( GroupType::typeid, "A", SoapAtts ); + + // Add another SoapEnumAttribute for the GroupType::B enumerator. + // Instead of //B// it will be S"East". + SoapAtts = gcnew SoapAttributes; + soapEnum = gcnew SoapEnumAttribute; + soapEnum->Name = "East"; + SoapAtts->GroupType::SoapEnum = soapEnum; + soapOver->Add( GroupType::typeid, "B", SoapAtts ); + + // Create an XmlSerializer used for overriding. + XmlTypeMapping^ map = (gcnew SoapReflectionImporter( soapOver ))->ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( map ); + Group^ myGroup = gcnew Group; + myGroup->GroupName = ".NET"; + myGroup->Grouptype = GroupType::B; + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( fileName ); + ser->Serialize( writer, myGroup ); + writer->Close(); + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeObject( "SoapEnum.xml" ); + test->SerializeOverride( "SoapOverride.xml" ); + Console::WriteLine( "Fininished writing two files" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp new file mode 100644 index 00000000000..f4f244fd8fe --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapExtension.GetInitializer-Type/CPP/traceextension.cpp @@ -0,0 +1,156 @@ +#using + +using namespace System; +using namespace System::Web::Services; +using namespace System::Web::Services::Protocols; +using namespace System::IO; + +ref class TraceExtension; + +// Create a SoapExtensionAttribute for our SOAP Extension that can be +// applied to an XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ filename; // = "c:\\log.txt"; + int priority; + +public: + property Type^ ExtensionType + { + virtual Type^ get() override + { + return TraceExtension::typeid; + } + } + + property int Priority + { + virtual int get() override + { + return priority; + } + virtual void set( int value ) override + { + priority = value; + } + } + + property String^ Filename + { + String^ get() + { + return filename; + } + void set( String^ value ) + { + filename = value; + } + } +}; + +// Define a SOAP Extension that traces the SOAP request and SOAP response +// for the XML Web service method, the SOAP extension is applied to. +public ref class TraceExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // When the SOAP extension is accessed for the first time the XML Web service method it is applied + // is accessed store the file name passed in using the corresponding SoapExtensionAttribute. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) override + { + return ( (TraceExtensionAttribute^)( attribute ) )->Filename; + } + +// + // The extension was configured to run using a configuration file instead of an attribute applied to a + // specific XML Web service method. Return a file name based on the class implementing the XML Web service's type. +public: + virtual Object^ GetInitializer( Type^ WebServiceType ) override + { + // Return a file name to log the trace information to based on the passed in type. + return String::Format( "C:\\{0}.log", WebServiceType->FullName ); + } +// + + // Receive the filename stored by GetInitializer and store it in a member variable + // for this specific instance. + virtual void Initialize( Object^ initializer ) override + { + filename = (String^)( initializer ); + } + + // If the SoapMessageStage is such that the SoapRequest or SoapResponse is still in the SOAP + // format to be sent or received over the wire, save it out to filename passed in using the SoapExtensionAttribute + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + + case SoapMessageStage::AfterDeserialize: + break; + + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Save the Stream representing the SOAP request or SOAP response into a local memory buffer + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + void WriteOutput( SoapMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); + w->Flush(); + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + void WriteInput( SoapMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Append,FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + w->WriteLine( "================================== Request at {0}", DateTime::Now ); + w->Flush(); + newStream->Position = 0; + Copy( newStream, fs ); + fs->Close(); + newStream->Position = 0; + } + + void Copy( Stream^ from, Stream^ to ) + { + TextReader^ reader = gcnew StreamReader( from ); + TextWriter^ writer = gcnew StreamWriter( to ); + writer->WriteLine( reader->ReadToEnd() ); + writer->Flush(); + } +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp new file mode 100644 index 00000000000..8084a230596 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapExtensionAttribute/CPP/SoapExtensionAttribute.cpp @@ -0,0 +1,230 @@ +// System.Web.Services.Protocols.SoapExtensionAttribute +// System.Web.Services.Protocols.SoapExtensionAttribute.ExtensionType +// System.Web.Services.Protocols.SoapExtensionAttribute.Priority + +/* +The following example demonstrates the 'ExtensionType' +and 'Priority' attribute of the 'SoapExtensionAttribute' class. +The program extends the 'SoapExtension' class to create a class +that is used to log the SOAP messages transferred for a web service +method invocation. To associate this 'SoapExtension' class with the +web service method on the client proxy, a class that extends from +'SoapExtensionAttribute' is used. This 'SoapExtensionAttribute' +is applied to a client proxy method which is associated with a +web service method. Whenever this method is invoked on the client +side all the SOAP message that get transffered both from the client +and the server(which is hosting the web service) are written into +a log file. +*/ + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +ref class TraceExtension; + +// +// A SoapExtensionAttribute that can be associated with an +// XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class TraceExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + // Set the name of the log file where SOAP messages will be stored. + TraceExtensionAttribute() : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + // + // Return the type of TraceExtension. + property Type^ ExtensionType + { + Type^ get() + { + return typeid; + } + } + // + + // + // User can set priority of the SoapExtension. + property int Priority + { + int get() + { + return myPriority; + } + void set( int value ) + { + myPriority = value; + } + + } + // + + property String^ Filename + { + String^ get() + { + return myFilename; + } + void set( String^ value ) + { + myFilename = value; + } + } +}; +// + +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",Namespace="http://tempuri.org/")] +public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ +public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathSvc() + { + this->Url = "http://localhost/MathSvc_SoapExtensionAttribute.asmx"; + } + + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", Use=System::Web::Services::Description::SoapBindingUse::Literal, ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [TraceExtension] + Single Add( Single xValue, Single yValue ) + { + array^ temp0 = { xValue, yValue }; + array^ results = this->Invoke( "Add", temp0 ); + return ( (Single)( results[ 0 ] ) ); + } + + System::IAsyncResult^ BeginAdd( Single xValue, + Single yValue, + System::AsyncCallback^ callback, + Object^ asyncState ) + { + array^ temp1 = { xValue, yValue }; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult ) + { + array^ results = this->EndInvoke( asyncResult ); + return ( (Single)( results[ 0 ] ) ); + } +}; + +// Define a SOAP Extension that traces the SOAP request and SOAP +// response for the XML Web service method the SOAP extension is +// applied to. +public ref class TraceExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // Save the Stream representing the SOAP request or SOAP response into + // a local memory buffer. + Stream^ ChainStream( Stream^ stream ) + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + // When the SOAP extension is accessed for the first time, the XML Web + // service method it is applied to is accessed to store the file + // name passed in, using the corresponding SoapExtensionAttribute. + Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) + { + return ( (TraceExtensionAttribute^)( attribute ) )->Filename; + } + + // The SOAP extension was configured to run using a configuration file + // instead of an attribute applied to a specific XML Web service + // method. + Object^ GetInitializer( Type^ WebServiceType ) + { + // Return a file name to log the trace information to, based on the + // type. + return String::Format( "C:\\{0}.log", WebServiceType->FullName ); + } + + // Receive the file name stored by GetInitializer and store it in a + // member variable for this specific instance. + void Initialize( Object^ initializer ) + { + filename = (String^)( initializer ); + } + + // If the SoapMessageStage is such that the SoapRequest or + // SoapResponse is still in the SOAP format to be sent or received, + // save it out to a file. + void ProcessMessage( SoapMessage^ message ) + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + void WriteOutput( SoapMessage^ message ) + { + newStream->Position = 0; + FileStream^ fs = gcnew FileStream( filename, FileMode::Append, + FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + + String^ soapString = ( (SoapServerMessage^)( message ) ) ? (String^)"SoapResponse" : "SoapRequest"; + w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); + w->Flush(); + Copy( newStream, fs ); + w->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + void WriteInput( SoapMessage^ message ) + { + Copy( oldStream, newStream ); + FileStream^ fs = gcnew FileStream( filename, FileMode::Append, + FileAccess::Write ); + StreamWriter^ w = gcnew StreamWriter( fs ); + String^ soapString = ( (SoapServerMessage^)( message ) ) ? + (String^)"SoapRequest" : "SoapResponse"; + w->WriteLine( "-----{0} at {1}", soapString, DateTime::Now ); + w->Flush(); + newStream->Position = 0; + Copy( newStream, fs ); + w->Close(); + newStream->Position = 0; + } + + void Copy( Stream^ from, Stream^ to ) + { + TextReader^ reader = gcnew StreamReader( from ); + TextWriter^ writer = gcnew StreamWriter( to ); + writer->WriteLine( reader->ReadToEnd() ); + writer->Flush(); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp new file mode 100644 index 00000000000..cd2422d09e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding/CPP/soapfaultbinding.cpp @@ -0,0 +1,68 @@ +// System::Web::Services::Description.SoapFaultBinding + +/* +The following example demonstrates 'SoapFaultBinding' class. +It creates an instance of 'ServiceDescription' class by reading an existing +wsdl file. Then it creates an instance of 'SoapFaultBinding' and adds it to +the collection object of 'Binding' class. It generates a new wsdl file where +the properties of 'SoapFaultBinding' objects are reflected and which could be +used for generating a proxy. +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + try + { + // Input wsdl file. + String^ myInputWsdlFile = "SoapFaultBindingInput_cpp.wsdl"; + + // Output wsdl file. + String^ myOutputWsdlFile = "SoapFaultBindingOutput_cpp.wsdl"; + + // Initialize an instance of a 'ServiceDescription' object. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( myInputWsdlFile ); + + // Get a SOAP binding object with binding name S"MyService1Soap". + Binding^ myBinding = myServiceDescription->Bindings[ "MyService1Soap" ]; + + // Create a new instance of 'SoapFaultBinding' class. + SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; + + // Encode fault message using rules specified by 'Encoding' property. + mySoapFaultBinding->Use = SoapBindingUse::Encoded; + + // Set the URI representing the encoding style. + mySoapFaultBinding->Encoding = "http://tempuri.org/stockquote"; + + // Set the URI representing the location of the specification + // for encoding of content not defined by 'Encoding' property'. + mySoapFaultBinding->Namespace = "http://tempuri.org/stockquote"; + + // Create a new instance of 'FaultBinding'. + FaultBinding^ myFaultBinding = gcnew FaultBinding; + myFaultBinding->Name = "AddFaultbinding"; + myFaultBinding->Extensions->Add( mySoapFaultBinding ); + + // Get existing 'OperationBinding' object. + OperationBinding^ myOperationBinding = myBinding->Operations[ 0 ]; + myOperationBinding->Faults->Add( myFaultBinding ); + + // Create a new wsdl file. + myServiceDescription->Write( myOutputWsdlFile ); + Console::WriteLine( "The new wsdl file created is : {0}", myOutputWsdlFile ); + Console::WriteLine( "Proxy could be created using command : wsdl {0}", myOutputWsdlFile ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error occurred : {0}", e->Message ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp new file mode 100644 index 00000000000..0c69f5c1ea8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapFaultBinding_ctor/CPP/soapfaultbinding_ctor.cpp @@ -0,0 +1,110 @@ +// System::Web::Services::Description.SoapBodyBinding::PartsString +// System::Web::Services::Description.SoapFaultBinding::ctor +// System::Web::Services::Description.SoapFaultBinding::Use +// System::Web::Services::Description.SoapFaultBinding::Encoding +// System::Web::Services::Description.SoapFaultBinding::NameSpace + +/* +The following example demonstrates the 'PartsString' property of 'SoapBodyBinding' class +and constructor, 'Encoding', 'NameSpace' and 'Use'properties of 'SoapFaultBinding' class. + +It creates an instance of 'ServiceDescription' class by reading an existing +wsdl file. Then it creates an instance of 'SoapFaultBinding' and adds it to +the collection object of 'Binding' class. It generates a new wsdl file where +the properties of 'SoapFaultBinding' objects are reflected and which could be +used for generating a proxy. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +int main() +{ + try + { + // Input wsdl file. + String^ myInputWsdlFile = "SoapFaultInput_cpp.wsdl"; + + // Output wsdl file. + String^ myOutputWsdlFile = "SoapFaultOutput_cpp.wsdl"; + + // Initialize an instance of a 'ServiceDescription' object. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( myInputWsdlFile ); + + // Get a SOAP binding object with binding name S"MyService1Soap". + Binding^ myBinding = myServiceDescription->Bindings[ "MyService1Soap" ]; + + // Create the 'OperationBinding' object for the 'SOAP' protocol. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "Add"; + + // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = "http://tempuri.org/Add"; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + + // Add the 'SoapOperationBinding' object to 'OperationBinding' object. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + + // + // Create the 'InputBinding' object for the 'SOAP' protocol. + InputBinding^ myInput = gcnew InputBinding; + SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; + mySoapBinding1->PartsString = "parameters"; + mySoapBinding1->Use = SoapBindingUse::Literal; + myInput->Extensions->Add( mySoapBinding1 ); + + // Assign the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInput; + + // Create the 'OutputBinding' object' for the 'SOAP' protocol.. + OutputBinding^ myOutput = gcnew OutputBinding; + myOutput->Extensions->Add( mySoapBinding1 ); + + // Assign the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + // + + // + // + // + // + // Create a new instance of 'SoapFaultBinding' class. + SoapFaultBinding^ mySoapFaultBinding = gcnew SoapFaultBinding; + + // Encode fault message using rules specified by 'Encoding' property. + mySoapFaultBinding->Use = SoapBindingUse::Encoded; + + // Set the URI representing the encoding style. + mySoapFaultBinding->Encoding = "http://tempuri.org/stockquote"; + + // Set the URI representing the location of the specification + // for encoding of content not defined by 'Encoding' property'. + mySoapFaultBinding->Namespace = "http://tempuri.org/stockquote"; + + // Create a new instance of 'FaultBinding'. + FaultBinding^ myFaultBinding = gcnew FaultBinding; + myFaultBinding->Name = "AddFaultbinding"; + myFaultBinding->Extensions->Add( mySoapFaultBinding ); + + // Get existing 'OperationBinding' object. + myOperationBinding->Faults->Add( myFaultBinding ); + myBinding->Operations->Add( myOperationBinding ); + + // + // + // + // + // Create a new wsdl file. + myServiceDescription->Write( myOutputWsdlFile ); + Console::WriteLine( "The new wsdl file created is : {0}", myOutputWsdlFile ); + Console::WriteLine( "Proxy could be created using command : wsdl {0}", myOutputWsdlFile ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Error occurred : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp new file mode 100644 index 00000000000..8a4e741d33b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapFormatter Example/CPP/soapformatter.cpp @@ -0,0 +1,90 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Collections; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Serialization::Formatters::Soap; +void Serialize() +{ + + // Create a hashtable of values that will eventually be serialized. + Hashtable^ addresses = gcnew Hashtable; + addresses->Add( "Jeff", "123 Main Street, Redmond, WA 98052" ); + addresses->Add( "Fred", "987 Pine Road, Phila., PA 19116" ); + addresses->Add( "Mary", "PO Box 112233, Palo Alto, CA 94301" ); + + // To serialize the hashtable (and its keys/values), + // you must first open a stream for writing. + // We will use a file stream here. + FileStream^ fs = gcnew FileStream( "DataFile.soap",FileMode::Create ); + + // Construct a SoapFormatter and use it + // to serialize the data to the stream. + SoapFormatter^ formatter = gcnew SoapFormatter; + try + { + formatter->Serialize( fs, addresses ); + } + catch ( SerializationException^ e ) + { + Console::WriteLine( "Failed to serialize. Reason: {0}", e->Message ); + throw; + } + finally + { + fs->Close(); + } + +} + +void Deserialize() +{ + + // Declare the hashtable reference. + Hashtable^ addresses = nullptr; + + // Open the file containing the data that we want to deserialize. + FileStream^ fs = gcnew FileStream( "DataFile.soap",FileMode::Open ); + try + { + SoapFormatter^ formatter = gcnew SoapFormatter; + + // Deserialize the hashtable from the file and + // assign the reference to our local variable. + addresses = dynamic_cast(formatter->Deserialize( fs )); + } + catch ( SerializationException^ e ) + { + Console::WriteLine( "Failed to deserialize. Reason: {0}", e->Message ); + throw; + } + finally + { + fs->Close(); + } + + + // To prove that the table deserialized correctly, + // display the keys/values to the console. + IEnumerator^ myEnum = addresses->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DictionaryEntry^ de = safe_cast(myEnum->Current); + Console::WriteLine( " {0} lives at {1}.", de->Key, de->Value ); + } +} + + +[STAThread] +int main() +{ + Serialize(); + Deserialize(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp new file mode 100644 index 00000000000..ff5d56ef650 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding/CPP/soapheaderbinding.cpp @@ -0,0 +1,67 @@ +// System::Web::Services::Description.SoapHeaderBinding + +/* +The following example demonstrates the class 'SoapHeaderBinding'. +It takes as input a wsdl file. By using the 'Read' method +of 'ServiceDescription' class it gets a 'ServiceDescription' object. +It uses the SOAP protocol related classes and creates 'Binding' element +of 'SOAP' protocol which are then added to the 'ServiceDescription' object. +An output wsdl file is generated from 'ServiceDescription' object which +could be used for generating a proxy. + +*/ + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" ); + Binding^ myBinding = gcnew Binding; + myBinding->Name = "MyWebServiceSoap"; + myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" ); + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + myBinding->Extensions->Add( mySoapBinding ); + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "Hello"; + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello"; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + + // Create InputBinding for operation for the 'SOAP' protocol. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding; + mySoapHeaderBinding->Message = gcnew XmlQualifiedName( "s0:HelloMyHeader" ); + mySoapHeaderBinding->Part = "MyHeader"; + mySoapHeaderBinding->Use = SoapBindingUse::Literal; + + // Add mySoapHeaderBinding to 'myInputBinding' object. + myInputBinding->Extensions->Add( mySoapHeaderBinding ); + + // Create OutputBinding for operation for the 'SOAP' protocol. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + myBinding->Operations->Add( myOperationBinding ); + myServiceDescription->Bindings->Add( myBinding ); + myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" ); + Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." ); + Console::WriteLine( "Proxy could be created using 'wsdl SoapHeaderBindingOut_cpp.wsdl'." ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp new file mode 100644 index 00000000000..094bfdc3008 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_MapToProperty/CPP/soapheaderbinding_maptoproperty.cpp @@ -0,0 +1,35 @@ +// System::Web::Services::Description.SoapHeaderBinding::MapToProperty + +/* +The following example demonstrates the 'MapToProperty' property of class 'SoapHeaderBinding'. +It reads an existing wsdl file and gets 'SoapHeaderBinding' instance from it. +'MapToProperty' property of this instance is checked to see whether this instance +is mapped to a specific property in proxy class or not. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; + +int main() +{ + // + // Read from an existing wsdl file. + ServiceDescription^ myServiceDescription = ServiceDescription::Read( "MapToProperty_cpp.wsdl" ); + + // Get the existing binding + Binding^ myBinding = myServiceDescription->Bindings[ "MyWebServiceSoap" ]; + OperationBinding^ myOperationBinding = (OperationBinding^)(myBinding->Operations[ 0 ]); + InputBinding^ myInputBinding = myOperationBinding->Input; + + // Get the 'SoapHeaderBinding' instance from 'myInputBinding'. + SoapHeaderBinding^ mySoapHeaderBinding = (SoapHeaderBinding^)(myInputBinding->Extensions[ 1 ]); + if ( mySoapHeaderBinding->MapToProperty ) + Console::WriteLine( "'SoapHeaderBinding' instance is mapped to a specific property in proxy generated class" ); + else + Console::WriteLine( "'SoapHeaderBinding' instance is not mapped to a specific property in proxy generated class" ); + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp new file mode 100644 index 00000000000..0223ff8c500 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderBinding_Use/CPP/soapheaderbinding_use.cpp @@ -0,0 +1,87 @@ +// System::Web::Services::Description.SoapHeaderBinding::ctor +// System::Web::Services::Description.SoapHeaderBinding::Message +// System::Web::Services::Description.SoapHeaderBinding::Part +// System::Web::Services::Description.SoapHeaderBinding::Use + +/* +The following example demonstrates the constructor, 'Message' , 'Part' +and 'Use' properties of the class 'SoapHeaderBinding'. +It takes as input a wsdl file. The binding element corresponding to +SOAP protocol is removed from the input file. By using the 'Read' method +of 'ServiceDescription' class it gets a 'ServiceDescription' Object*. +It uses the SOAP protocol related classes and creates 'Binding' element +of 'SOAP' protocol which are then added to the 'ServiceDescription' Object*. +An output wsdl file is generated from 'ServiceDescription' Object* which +could be used for generating a proxy. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Web::Services::Description; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myServiceDescription = + ServiceDescription::Read( "SoapHeaderBindingInput_cpp.wsdl" ); + Binding^ myBinding = gcnew Binding; + myBinding->Name = "MyWebServiceSoap"; + myBinding->Type = gcnew XmlQualifiedName( "s0:MyWebServiceSoap" ); + + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = "http://schemas.xmlsoap.org/soap/http"; + mySoapBinding->Style = SoapBindingStyle::Document; + myBinding->Extensions->Add( mySoapBinding ); + + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "Hello"; + + SoapOperationBinding^ mySoapOperationBinding = + gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = "http://tempuri.org/Hello"; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + + // Create InputBinding for operation for the 'SOAP' protocol. + InputBinding^ myInputBinding = gcnew InputBinding; + SoapBodyBinding^ mySoapBodyBinding = gcnew SoapBodyBinding; + mySoapBodyBinding->Use = SoapBindingUse::Literal; + myInputBinding->Extensions->Add( mySoapBodyBinding ); + +// +// +// +// + SoapHeaderBinding^ mySoapHeaderBinding = gcnew SoapHeaderBinding; + // Set the Message within the XML Web service to which the + // 'SoapHeaderBinding' applies. + mySoapHeaderBinding->Message = + gcnew XmlQualifiedName( "s0:HelloMyHeader" ); + mySoapHeaderBinding->Part = "MyHeader"; + mySoapHeaderBinding->Use = SoapBindingUse::Literal; + // Add mySoapHeaderBinding to the 'myInputBinding' object. + myInputBinding->Extensions->Add( mySoapHeaderBinding ); +// +// +// +// + + // Create OutputBinding for operation for the 'SOAP' protocol. + OutputBinding^ myOutputBinding = gcnew OutputBinding; + myOutputBinding->Extensions->Add( mySoapBodyBinding ); + + // Add 'InputBinding' and 'OutputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInputBinding; + myOperationBinding->Output = myOutputBinding; + myBinding->Operations->Add( myOperationBinding ); + + myServiceDescription->Bindings->Add( myBinding ); + myServiceDescription->Write( "SoapHeaderBindingOut_cpp.wsdl" ); + Console::WriteLine( "'SoapHeaderBindingOut_cpp.wsdl' file is generated." ); + Console::WriteLine( "Proxy could be created using " + + "'wsdl SoapHeaderBindingOut_cpp.wsdl'." ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp new file mode 100644 index 00000000000..c751b8d2631 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection/CPP/SoapHeaderCollection.cpp @@ -0,0 +1,257 @@ +// System.Web.Services.Protocols.SoapHeaderCollection +// System.Web.Services.Protocols.SoapHeaderCollection.SoapHeaderCollection() +// System.Web.Services.Protocols.SoapHeaderCollection.Add(SoapHeader) +// System.Web.Services.Protocols.SoapHeaderCollection.Insert(int, SoapHeader) +// System.Web.Services.Protocols.SoapHeaderCollection.CopyTo(SoapHeader[], int) +// System.Web.Services.Protocols.SoapHeaderDirection.In + +/* + The following example demonstrates various members of the + SoapHeaderCollection class and the In member of the SoapHeaderDirection + enumeration. The program extends the SoapExtension class to create a + class that is used to log the SOAP messages transferred for an XML Web + service method invocation. Whenever this method is invoked on the client + side, all the SOAP message that are transfered both from the client and + the server are written to a log file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +ref class MySoapExtension; + +// A SoapExtensionAttribute that can be associated with an +// XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class MySoapExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + + // Set the name of the log file where SOAP messages will be stored. + MySoapExtensionAttribute() + : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of MySoapExtension. + virtual Type^ get() override + { + return MySoapExtension::typeid; + } + } + + property int Priority + { + // User can set priority of the SoapExtension. + virtual int get() override + { + return myPriority; + } + + virtual void set( int value ) override + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + + void set( String^ value ) + { + myFilename = value; + } + } +}; + +public ref class MySoapHeader: public SoapHeader +{ +public: + String^ text; +}; + +// +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", + Namespace="http://tempuri.org/")] +public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ + // +public: + array^ mySoapHeaders; + + [SoapHeaderAttribute("mySoapHeaders", + Direction=SoapHeaderDirection::In)] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute( + "http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [MySoapExtensionAttribute] + Single Add( Single xValue, Single yValue ) + { + // + SoapHeaderCollection^ mySoapHeaderCollection = gcnew SoapHeaderCollection; + MySoapHeader^ mySoapHeader; + mySoapHeader = gcnew MySoapHeader; + mySoapHeader->text = "This is the first SOAP header"; + mySoapHeaderCollection->Add( mySoapHeader ); + // + + // + mySoapHeader = gcnew MySoapHeader; + mySoapHeader->text = "This is the second SOAP header"; + mySoapHeaderCollection->Add( mySoapHeader ); + // + + // + mySoapHeader = gcnew MySoapHeader; + mySoapHeader->text = "This header is inserted before the first header"; + mySoapHeaderCollection->Insert( 0, mySoapHeader ); + // + + // + mySoapHeaders = gcnew array(mySoapHeaderCollection->Count); + mySoapHeaderCollection->CopyTo( mySoapHeaders, 0 ); + // + + array^ temp0 = {xValue,yValue}; + array^ results = this->Invoke( "Add", temp0 ); + return ( (Single)( results[ 0 ] ) ); + } + // + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathSvc() + { + this->Url = "http://localhost/MathSvc_SoapHeaderCollection.cs.asmx"; + } + + System::IAsyncResult^ BeginAdd( Single xValue, + Single yValue, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^ temp1 = {xValue,yValue}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult ) + { + array^ results = this->EndInvoke( asyncResult ); + return ( (Single)( results[ 0 ] ) ); + } +}; +// + +public ref class MySoapExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // Return the file name that is to log the SOAP messages. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, + SoapExtensionAttribute^ attribute ) override + { + return ( (MySoapExtensionAttribute^)( attribute ) )->Filename; + } + + // Return the file name that is to log the SOAP messages. + virtual Object^ GetInitializer( Type^ filename ) override + { + return (Type^)( filename ); + } + + // Save the name of the log file that will save the SOAP messages. + virtual void Initialize( Object^ initializer ) override + { + filename = (String^)( initializer ); + } + + // Process the SOAP message received and write it to the log file. + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( (SoapClientMessage^)( message ) ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( (SoapClientMessage^)( message ) ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutput( SoapClientMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "================================== Request at {0}", + DateTime::Now ); + myStreamWriter->Flush(); + Copy( newStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + // Write the contents of the incoming SOAP message to the log file. + void WriteInput( SoapClientMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "---------------------------------- Response at {0}", + DateTime::Now ); + myStreamWriter->Flush(); + newStream->Position = 0; + Copy( newStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + newStream->Position = 0; + } + + // Return a new MemoryStream for SOAP processing. + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + // Utility method to copy the contents of one stream to another. + void Copy( Stream^ fromStream, Stream^ toStream ) + { + TextReader^ myTextReader = gcnew StreamReader( fromStream ); + TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); + myTextWriter->WriteLine( myTextReader->ReadToEnd() ); + myTextWriter->Flush(); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp new file mode 100644 index 00000000000..fd58130e9f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHeaderCollection_Contains/CPP/SoapHeaderCollection_Contains.cpp @@ -0,0 +1,253 @@ +// System.Web.Services.Protocols.SoapHeaderCollection.Contains(SoapHeader); System.Web.Services.Protocols.SoapHeaderCollection.IndexOf(); System.Web.Services.Protocols.SoapHeaderCollection.Item; System.Web.Services.Protocols.SoapHeaderCollection.Remove(SoapHeader) + +/* +The following example demonstrates the methods 'Contains','IndexOf' and +'Remove' and the property 'Item' of the 'SoapHeaderCollection' class. The +program extends the 'SoapExtension' class to create a class that is +used to log the SOAP messages transferred for a web service method +invocation. Whenever this method is invoked on the client side +all the SOAP message that get transfered both from the client +and the server are written into a log file. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; +using namespace System::Xml; + +ref class MySoapExtension; + +// A 'SoapExtensionAttribute' that can be associated with web service method. + +[AttributeUsage(AttributeTargets::Method)] +public ref class MySoapExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + + // Set the name of the log file were SOAP messages will be stored. + MySoapExtensionAttribute() + : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of 'MySoapExtension' class. + virtual Type^ get() override + { + return MySoapExtension::typeid; + } + } + + property int Priority + { + // User can set priority of the 'SoapExtension'. + virtual int get() override + { + return myPriority; + } + + virtual void set( int value ) override + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + + void set( String^ value ) + { + myFilename = value; + } + + } + +}; + +public ref class MySoapHeader: public SoapHeader +{ +public: + String^ Text; +}; + +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",Namespace="http://tempuri.org/")] +public ref class MathService: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ +public: + array^mySoapHeaders; + + [SoapHeaderAttribute("mySoapHeaders",Direction=SoapHeaderDirection::In,Required=false)] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [MySoapExtensionAttribute] + Single Add( Single xValue, Single yValue ) + { + SoapHeaderCollection^ mySoapHeaderCollection = gcnew SoapHeaderCollection; + MySoapHeader^ myFirstSoapHeader; + myFirstSoapHeader = gcnew MySoapHeader; + myFirstSoapHeader->Text = "This is the first soap header"; + mySoapHeaderCollection->Add( myFirstSoapHeader ); + MySoapHeader^ mySecondSoapHeader = gcnew MySoapHeader; + mySecondSoapHeader->Text = "This is the second soap header"; + mySoapHeaderCollection->Add( mySecondSoapHeader ); + + // + // Check to see whether the collection contains mySecondSoapHeader. + if ( mySoapHeaderCollection->Contains( mySecondSoapHeader ) ) + { + // Get the index of mySecondSoapHeader from the collection. + Console::WriteLine( "Index of mySecondSoapHeader: {0}", mySoapHeaderCollection->IndexOf( mySecondSoapHeader ) ); + + // Get the SoapHeader from the collection. + MySoapHeader^ mySoapHeader1 = dynamic_cast(mySoapHeaderCollection[ mySoapHeaderCollection->IndexOf( mySecondSoapHeader ) ]); + Console::WriteLine( "SoapHeader retrieved from the collection: {0}", mySoapHeader1 ); + + // Remove a SoapHeader from the collection. + mySoapHeaderCollection->Remove( mySoapHeader1 ); + Console::WriteLine( "Number of items after removal: {0}", mySoapHeaderCollection->Count ); + } + else + Console::WriteLine( "mySoapHeaderCollection does not contain mySecondSoapHeader." ); + // + + mySoapHeaders = gcnew array(mySoapHeaderCollection->Count); + mySoapHeaderCollection->CopyTo( mySoapHeaders, 0 ); + array^temp0 = {xValue,yValue}; + array^results = this->Invoke( "Add", temp0 ); + return safe_cast(results[ 0 ]); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathService() + { + this->Url = "http://localhost/MathService_SoapHeaderCollection.cs.asmx"; + } + + System::IAsyncResult^ BeginAdd( Single xValue, Single yValue, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {xValue,yValue}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return safe_cast(results[ 0 ]); + } + +}; + +public ref class MySoapExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ myFilename; + +public: + + // Return the filename that is to log the SOAP messages. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ myAttribute ) override + { + return (dynamic_cast(myAttribute))->Filename; + } + + // Return the filename that is to log the SOAP messages. + virtual Object^ GetInitializer( Type^ myFilename ) override + { + return dynamic_cast(myFilename); + } + + // Save the name of the log file that shall save the SOAP messages. + virtual void Initialize( Object^ initializer ) override + { + myFilename = dynamic_cast(initializer); + } + + // Process the SOAP message received and write to log file. + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + + case SoapMessageStage::AfterSerialize: + WriteOutput( dynamic_cast(message) ); + break; + + case SoapMessageStage::BeforeDeserialize: + WriteInput( dynamic_cast(message) ); + break; + + case SoapMessageStage::AfterDeserialize: + break; + + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutput( SoapClientMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ myFileStream = gcnew FileStream( myFilename,FileMode::Append,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "================================== Request at {0}", DateTime::Now ); + myStreamWriter->Flush(); + Copy( newStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + // Write the contents of the incoming SOAP message to the log file. + void WriteInput( SoapClientMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ myFileStream = gcnew FileStream( myFilename,FileMode::Append,FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "---------------------------------- Response at {0}", DateTime::Now ); + myStreamWriter->Flush(); + newStream->Position = 0; + Copy( newStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + newStream->Position = 0; + } + + // Return a new 'MemoryStream' instance for SOAP processing. + virtual Stream^ ChainStream( Stream^ myStream ) override + { + oldStream = myStream; + newStream = gcnew MemoryStream; + return newStream; + } + + // Utility method to copy the contents of one stream to another. + void Copy( Stream^ fromStream, Stream^ toStream ) + { + TextReader^ myTextReader = gcnew StreamReader( fromStream ); + TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); + myTextWriter->WriteLine( myTextReader->ReadToEnd() ); + myTextWriter->Flush(); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp new file mode 100644 index 00000000000..fa98d114ffe --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHeader_EncodedMustUnderstand/CPP/soapheader_encodedmustunderstand.cpp @@ -0,0 +1,53 @@ + + +// System.Web.Services.Protocols.SoapHeader.EncodedMustUnderstand +/* +This program demonstrates the 'EncodedMustUnderstand' property of +the 'SoapHeader' class. This example calls two webservice methods, +namely 'WebMethod1' for which the property 'DidUnderstand' is set +to true and 'WebMethod2' for which the property 'DidUnderstand' +is set to false. The property 'EncodedMustUnderstand' is set to '1' +for the client soapheader. The client calls the method 'WebMethod2' +whose 'DidUnderstand' property is set to false and hence a 'SoapHeaderException' +is thrown. +*/ +#using +#using +#using +#using + +using namespace System; + +int main() +{ + try + { + // + // MyHeader class is derived from the SoapHeader class. + MyHeader ^ customHeader = gcnew MyHeader; + customHeader->MyValue = "Header value for MyValue"; + + // Set the EncodedMustUnderstand property to true. + customHeader->EncodedMustUnderstand = "1"; + WebService_SoapHeader_EncodedMustUnderstand ^ myWebService = gcnew WebService_SoapHeader_EncodedMustUnderstand; + myWebService->myHeader1 = customHeader; + String^ results = myWebService->MyWebMethod1(); + Console::WriteLine( results ); + try + { + results = myWebService->MyWebMethod2(); + } + catch ( Exception^ myException ) + { + Console::WriteLine( "Exception raised in MyWebMethod2." ); + Console::WriteLine( "Message: {0}", myException->Message ); + } + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!" ); + Console::WriteLine( "Source: {0}", e->Source ); + Console::WriteLine( "Message: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp new file mode 100644 index 00000000000..6553b346e86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapHttpClientProtocol.Discover Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +// +#using +#using +#using + +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +namespace MyMath +{ + + [System::Web::Services::WebServiceBindingAttribute(Name="MathSoap",Namespace="http://tempuri.org/")] + public ref class Math: public System::Web::Services::Protocols::SoapHttpClientProtocol + { + public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + Math() + { + this->Url = "http://www.contoso.com/math.asmx"; + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + int Add( int num1, int num2 ) + { + array^temp0 = {num1,num2}; + array^results = this->Invoke( "Add", temp0 ); + return *dynamic_cast(results[ 0 ]); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + System::IAsyncResult^ BeginAdd( int num1, int num2, System::AsyncCallback^ callback, Object^ asyncState ) + { + array^temp1 = {num1,num2}; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + + [System::Diagnostics::DebuggerStepThroughAttribute] + int EndAdd( System::IAsyncResult^ asyncResult ) + { + array^results = this->EndInvoke( asyncResult ); + return *dynamic_cast(results[ 0 ]); + } + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp new file mode 100644 index 00000000000..c2b34429787 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapMessage/CPP/SoapMessage.cpp @@ -0,0 +1,322 @@ +// System.Web.Services.Protocols.SoapMessage +// System.Web.Services.Protocols.SoapMessage.Action +// System.Web.Services.Protocols.SoapMessage.ContentType +// System.Web.Services.Protocols.SoapMessage.OneWay +// System.Web.Services.Protocols.SoapMessage.Url +// System.Web.Services.Protocols.SoapMessage.GetInParameterValue(int) +// System.Web.Services.Protocols.SoapMessage.MethodInfo +// System.Web.Services.Protocols.SoapMessage.GetOutParameterValue(int) +// System.Web.Services.Protocols.SoapMessage.GetReturnValue() + +/* +The following example demonstrates various members of the SoapMessage +class. The program extends the SoapExtension class to create a class +that is used to log the SOAP messages transferred for an XML Web service +method invocation. Whenever this method is invoked on the client side, +all the SOAP messages that get transfered both from the client and the +server are written into a log file. +*/ + +#using +#using + +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +ref class MySoapExtension; + +// A SoapExtensionAttribute that can be associated with an XML +// Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class MySoapExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + // Set the name of the log file where SOAP messages will be stored. + MySoapExtensionAttribute() : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of MySoapExtension. + virtual Type^ get() override + { + return MySoapExtension::typeid; + } + } + + property int Priority + { + // User can set priority of the SoapExtension. + virtual int get() override + { + return myPriority; + } + virtual void set( int value ) override + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + void set( String^ value ) + { + myFilename = value; + } + } +}; + +public ref class MySoapHeader: public SoapHeader +{ +public: + String^ text; +}; + +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", + Namespace="http://tempuri.org/")] +public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ +public: + MySoapHeader^ mySoapHeader; + + [SoapHeaderAttribute("mySoapHeader",Direction=SoapHeaderDirection::In)] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute( + "http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [MySoapExtensionAttribute] + Single Add( Single xValue, Single yValue, + [System::Runtime::InteropServices::Out]interior_ptr returnValue ) + { + mySoapHeader = gcnew MySoapHeader; + mySoapHeader->text = "This is the first SOAP header"; + array^ temp0 = { xValue, yValue }; + array^ results = this->Invoke( "Add", temp0 ); + *returnValue = (Single)( results[ 1 ] ); + return (Single)( results[ 0 ] ); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathSvc() + { + this->Url = "http://localhost/MathSvc_SoapMessage.cs.asmx"; + } + + System::IAsyncResult^ BeginAdd( Single xValue, + Single yValue, System::AsyncCallback^ callback, + Object^ asyncState ) + { + array^ temp1 = { xValue, yValue }; + return this->BeginInvoke( "Add", + temp1, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult, + [System::Runtime::InteropServices::Out]interior_ptr returnValue ) + { + array^ results = this->EndInvoke( asyncResult ); + *returnValue = (Single)( results[ 1 ] ); + return (Single)( results[ 0 ] ); + } +}; + +public ref class MySoapExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + + // Return the file name that is to log the SOAP messages. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, + SoapExtensionAttribute^ attribute ) override + { + return ( (MySoapExtensionAttribute^)( attribute ))->Filename; + } + + // Return the file name that is to log the SOAP messages. + virtual Object^ GetInitializer( Type^ filename ) override + { + return (Type^)( filename ); + } + + // Save the name of the log file that will save the SOAP messages. + virtual void Initialize( Object^ initializer ) override + { + filename = (String^)( initializer ); + } + +// + // Process the SOAP message received and write to log file. + virtual void ProcessMessage( SoapMessage^ message ) override + { + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + WriteOutputBeforeSerialize( message ); + break; + case SoapMessageStage::AfterSerialize: + WriteOutputAfterSerialize( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInputBeforeDeserialize( message ); + break; + case SoapMessageStage::AfterDeserialize: + WriteInputAfterDeserialize( message ); + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutputBeforeSerialize( SoapMessage^ message ) + { + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "================================== Request at {0}", + DateTime::Now ); + + // + myStreamWriter->WriteLine( + "The method that has been invoked is: " ); + myStreamWriter->WriteLine( "\t{0}", message->MethodInfo ); + // + + // + myStreamWriter->WriteLine( "The contents of the SOAPAction HTTP header is:" ); + myStreamWriter->WriteLine( "\t{0}", message->Action ); + // + + // + myStreamWriter->WriteLine( "The contents of HTTP Content-type header is:" ); + myStreamWriter->WriteLine( "\t{0}", message->ContentType ); + // + + // + if ( message->OneWay ) + { + myStreamWriter->WriteLine( + "The method invoked on the client shall not wait" + + " till the server finishes" ); + } + else + { + myStreamWriter->WriteLine( + "The method invoked on the client shall wait" + + " till the server finishes" ); + } + // + + // + myStreamWriter->WriteLine( + "The site where the XML Web service is available is:" ); + myStreamWriter->WriteLine( "\t{0}", message->Url ); + // + + // + myStreamWriter->WriteLine( "The values of the in parameters are:" ); + myStreamWriter->WriteLine( + "Value of first in parameter: {0}", message->GetInParameterValue( 0 ) ); + myStreamWriter->WriteLine( + "Value of second in parameter: {0}", message->GetInParameterValue( 1 ) ); + // + + myStreamWriter->WriteLine(); + myStreamWriter->Flush(); + myStreamWriter->Close(); + myFileStream->Close(); + } + + // Write the contents of the incoming SOAP message to the log file. + void WriteInputAfterDeserialize( SoapMessage^ message ) + { + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine(); + + // + myStreamWriter->WriteLine( "The values of the out parameter are:" ); + myStreamWriter->WriteLine( + "The value of the out parameter is: {0}", message->GetOutParameterValue( 0 ) ); + // + + // + myStreamWriter->WriteLine( "The values of the return parameter are:" ); + myStreamWriter->WriteLine( + "The value of the return parameter is: {0}", message->GetReturnValue() ); + // + + myStreamWriter->Flush(); + myStreamWriter->Close(); + myFileStream->Close(); + } + // + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutputAfterSerialize( SoapMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->Flush(); + Copy( newStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + + // Write the contents of the incoming SOAP message to the log file. + void WriteInputBeforeDeserialize( SoapMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "---------------------------------- Response at {0}", + DateTime::Now ); + myStreamWriter->Flush(); + newStream->Position = 0; + Copy( newStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + newStream->Position = 0; + } + + // Return a new MemoryStream for SOAP processing. + virtual Stream^ ChainStream( Stream^ stream ) override + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + // Utility method to copy the contents of one stream to another. + void Copy( Stream^ fromStream, Stream^ toStream ) + { + TextReader^ myTextReader = gcnew StreamReader( fromStream ); + TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); + myTextWriter->WriteLine( myTextReader->ReadToEnd() ); + myTextWriter->Flush(); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp new file mode 100644 index 00000000000..f5ed2196e55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapMessageState/CPP/SoapMessageState.cpp @@ -0,0 +1,225 @@ +// System.Web.Services.Protocols.SoapMessageState +// System.Web.Services.Protocols.SoapMessageState.AfterDeserialize +// System.Web.Services.Protocols.SoapMessageState.AfterSerialize +// System.Web.Services.Protocols.SoapMessageState.BeforeDeserialize +// System.Web.Services.Protocols.SoapMessageState.BeforeSerialize + +/* + The following example demonstrates the 'AfterDeserialize', + 'AfterSerialize', 'BeforeDeserialize' and 'BeforeSerialize' enum + members of the 'SoapMessageState' class. The program extends the + 'SoapExtension' class to create a class that is used to log the + SOAP messages transferred for a web service method invocation. + To associate this 'SoapExtension' class with the web service + method on the client proxy a class that extends from + 'SoapExtensionAttribute' is used. This 'SoapExtensionAttribute' is + applied to a client proxy method which is associated with a web + service method. Whenever this method is invoked on the client + side all the SOAP message that get transfered both from the client + and the server(which is hosting the web service) are written into + a log file. +*/ + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +ref class MySoapExtension; + +// A 'SoapExtensionAttribute' that can be associated with web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class MySoapExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + // Set the name of the log file where SOAP messages will be stored. + MySoapExtensionAttribute() : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of 'MySoapExtension' class. + Type^ get() + { + return typeid; + } + } + + property int Priority + { + // User can set priority of the 'SoapExtension'. + int get() + { + return myPriority; + } + void set( int value ) + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + void set( String^ value ) + { + myFilename = value; + } + } +}; + +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap",Namespace="http://tempuri.org/")] +public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ +public: + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathSvc() + { + this->Url = "http://localhost/MathSvc_SoapMessageState.asmx"; + } + + [System::Web::Services::Protocols::SoapDocumentMethodAttribute("http://tempuri.org/Add",Use=System::Web::Services::Description::SoapBindingUse::Literal,ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [MySoapExtensionAttribute] + Single Add( Single xValue, Single yValue ) + { + array^ temp0 = {xValue,yValue}; + array^ results = this->Invoke( "Add", temp0 ); + return (Single)( results[ 0 ] ); + } + + System::IAsyncResult^ BeginAdd( Single xValue, + Single yValue, + System::AsyncCallback^ callback, + Object^ asyncState ) + { + array^ temp1 = { xValue, yValue }; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult ) + { + array^ results = this->EndInvoke( asyncResult ); + return (Single)( results[ 0 ] ); + } + +}; + +public ref class MySoapExtension: public SoapExtension +{ +private: + Stream^ oldStream; + Stream^ newStream; + String^ filename; + +public: + // Return the filename that is to log the SOAP messages. + Object^ GetInitializer( LogicalMethodInfo^ /*methodInfo*/, SoapExtensionAttribute^ attribute ) + { + return ( (MySoapExtensionAttribute^)( attribute ))->Filename; + } + + // Return the filename that is to log the SOAP messages. + Object^ GetInitializer( Type^ filename ) + { + return (Type^)( filename ); + } + + // Save the name of the log file that shall save the SOAP messages. + void Initialize( Object^ initializer ) + { + filename = (String^)( initializer ); + } + +// + // Process the SOAP message received and write to log file. + void ProcessMessage( SoapMessage^ message ) + { +// +// +// +// + switch ( message->Stage ) + { + case SoapMessageStage::BeforeSerialize: + break; + case SoapMessageStage::AfterSerialize: + WriteOutput( message ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInput( message ); + break; + case SoapMessageStage::AfterDeserialize: + break; + default: + throw gcnew Exception( "invalid stage" ); + } +// +// +// +// + } +// + + // Return a new 'MemoryStream' instance for SOAP processing. + Stream^ ChainStream( Stream^ stream ) + { + oldStream = stream; + newStream = gcnew MemoryStream; + return newStream; + } + + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutput( SoapMessage^ /*message*/ ) + { + newStream->Position = 0; + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "================================== Request at {0}", + DateTime::Now ); + myStreamWriter->Flush(); + Copy( newStream, myFileStream ); + myFileStream->Close(); + newStream->Position = 0; + Copy( newStream, oldStream ); + } + + // Write the contents of the incoming SOAP message to the log file. + void WriteInput( SoapMessage^ /*message*/ ) + { + Copy( oldStream, newStream ); + FileStream^ myFileStream = + gcnew FileStream( filename, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( "---------------------------------- Response at {0}", + DateTime::Now ); + myStreamWriter->Flush(); + newStream->Position = 0; + Copy( newStream, myFileStream ); + myFileStream->Close(); + newStream->Position = 0; + } + + // Utility method to copy the contents of one stream to another. + void Copy( Stream^ fromStream, Stream^ toStream ) + { + TextReader^ myTextReader = gcnew StreamReader( fromStream ); + TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); + myTextWriter->WriteLine( myTextReader->ReadToEnd() ); + myTextWriter->Flush(); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp new file mode 100644 index 00000000000..17482834562 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapMessage_Headers/CPP/SoapMessage_Headers.cpp @@ -0,0 +1,281 @@ +// System.Web.Services.Protocols.SoapMessage.Headers +// System.Web.Services.Protocols.SoapMessage.Stream + +/* + The following example demonstrates the 'Headers' and 'Stream' properties + of the 'SoapMessage' class. The program extends the + 'SoapExtension' class to create a class that is used to log the + SOAP messages transferred for a web service method invocation. + Whenever this method is invoked on the client side all the SOAP + message that get transfered both from the client and the server + are written into a log file. +*/ + +#using +#using +#using + +using namespace System::Runtime::InteropServices; +using namespace System; +using namespace System::IO; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +ref class MySoapExtension; + +// A SoapExtensionAttribute that can be associated with an +// XML Web service method. +[AttributeUsage(AttributeTargets::Method)] +public ref class MySoapExtensionAttribute: public SoapExtensionAttribute +{ +private: + String^ myFilename; + int myPriority; + +public: + // Set the name of the log file where SOAP messages will be stored. + MySoapExtensionAttribute() : SoapExtensionAttribute() + { + myFilename = "C:\\logClient.txt"; + } + + property Type^ ExtensionType + { + // Return the type of MySoapExtension. + virtual Type^ get() override + { + return MySoapExtension::typeid; + } + } + + property int Priority + { + // User can set priority of the SoapExtension. + virtual int get() override + { + return myPriority; + } + virtual void set( int value ) override + { + myPriority = value; + } + } + + property String^ Filename + { + String^ get() + { + return myFilename; + } + void set( String^ value ) + { + myFilename = value; + } + } +}; + +public ref class MySoapHeader: public SoapHeader +{ +public: + String^ myText; +}; + +[System::Web::Services::WebServiceBindingAttribute(Name="MathSvcSoap", + Namespace="http://tempuri.org/")] +public ref class MathSvc: public System::Web::Services::Protocols::SoapHttpClientProtocol +{ +public: + MySoapHeader^ mySoapHeader; + + [SoapHeaderAttribute("mySoapHeader",Direction=SoapHeaderDirection::In)] + [System::Web::Services::Protocols::SoapDocumentMethodAttribute( + "http://tempuri.org/Add", + Use=System::Web::Services::Description::SoapBindingUse::Literal, + ParameterStyle=System::Web::Services::Protocols::SoapParameterStyle::Wrapped)] + [MySoapExtensionAttribute] + Single Add( Single xValue, + Single yValue, + [System::Runtime::InteropServices::Out]interior_ptr returnValue ) + { + mySoapHeader = gcnew MySoapHeader; + mySoapHeader->myText = "This is the first SOAP header"; + array^ temp0 = {xValue,yValue}; + array^ results = this->Invoke( "Add", temp0 ); + *returnValue = (Single)( results[ 1 ] ); + return (Single)( results[ 0 ] ); + } + + [System::Diagnostics::DebuggerStepThroughAttribute] + MathSvc() + { + this->Url = "http://localhost/SoapMessage_Headers.cs.asmx"; + } + + System::IAsyncResult^ BeginAdd( Single xValue, Single yValue, + System::AsyncCallback^ callback, Object^ asyncState ) + { + array^ temp1 = { xValue, yValue }; + return this->BeginInvoke( "Add", temp1, callback, asyncState ); + } + + Single EndAdd( System::IAsyncResult^ asyncResult, + [System::Runtime::InteropServices::Out]interior_ptr returnValue ) + { + array^ results = this->EndInvoke( asyncResult ); + *returnValue = (Single)( results[ 1 ] ); + return (Single)( results[ 0 ] ); + } +}; + +public ref class MySoapExtension: public SoapExtension +{ +private: + Stream^ myOldStream; + Stream^ myNewStream; + String^ myFileName; + +public: + // Return the filename that is to log the SOAP messages. + virtual Object^ GetInitializer( LogicalMethodInfo^ /*myMethodInfo*/, + SoapExtensionAttribute^ mySoapExtensionAttributeObject ) override + { + return ( (MySoapExtensionAttribute^)( mySoapExtensionAttributeObject ) )->Filename; + } + + // Return the filename that is to log the SOAP messages. + virtual Object^ GetInitializer( Type^ myFileName ) override + { + return (Type^)( myFileName ); + } + + // Save the name of the log file that shall save the SOAP messages. + virtual void Initialize( Object^ myInitializer ) override + { + myFileName = (String^)( myInitializer ); + } + + // Process the SOAP message received and write to log file. + virtual void ProcessMessage( SoapMessage^ myMessage ) override + { + switch ( myMessage->Stage ) + { + case SoapMessageStage::BeforeSerialize: + WriteOutputBeforeSerialize( myMessage ); + break; + case SoapMessageStage::AfterSerialize: + WriteOutputAfterSerialize( myMessage ); + break; + case SoapMessageStage::BeforeDeserialize: + WriteInputBeforeDeserialize( myMessage ); + break; + case SoapMessageStage::AfterDeserialize: + WriteInputAfterDeserialize( myMessage ); + break; + default: + throw gcnew Exception( "invalid stage" ); + } + } + + // + // Write the contents of the outgoing SOAP message to the log file. +public: + void WriteOutputBeforeSerialize( SoapMessage^ myMessage ) + { + FileStream^ myFileStream = gcnew FileStream( + myFileName, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( + "================================== Request at {0}", DateTime::Now ); + + myStreamWriter->WriteLine( "The values of the in parameters are:" ); + myStreamWriter->WriteLine( "Value of first in parameter: {0}", + myMessage->GetInParameterValue( 0 ) ); + myStreamWriter->WriteLine( "Value of second in parameter: {0}", + myMessage->GetInParameterValue( 1 ) ); + + myStreamWriter->Write( "Number of headers for the current request: " ); + myStreamWriter->WriteLine( myMessage->Headers->Count ); + + myStreamWriter->WriteLine(); + myStreamWriter->Flush(); + myStreamWriter->Close(); + myFileStream->Close(); + } + // + + // Write the contents of the incoming SOAP message to the log file. + void WriteInputAfterDeserialize( SoapMessage^ myMessage ) + { + FileStream^ myFileStream = gcnew FileStream( + myFileName, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine(); + + myStreamWriter->WriteLine( "The values of the out parameter are:" ); + myStreamWriter->WriteLine( "The value of the out parameter is: {0}", + myMessage->GetOutParameterValue( 0 ) ); + + myStreamWriter->WriteLine( "The values of the return parameter are:" ); + myStreamWriter->WriteLine( "The value of the return parameter is: {0}", + myMessage->GetReturnValue() ); + + myStreamWriter->Flush(); + myStreamWriter->Close(); + myFileStream->Close(); + } + + // Write the contents of the outgoing SOAP message to the log file. + void WriteOutputAfterSerialize( SoapMessage^ /*myMessage*/ ) + { + myNewStream->Position = 0; + FileStream^ myFileStream = gcnew FileStream( + myFileName, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->Flush(); + Copy( myNewStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + myNewStream->Position = 0; + Copy( myNewStream, myOldStream ); + } + + // + // Write the contents of the incoming SOAP message to the log file. +public: + void WriteInputBeforeDeserialize( SoapMessage^ myMessage ) + { + Copy( myOldStream, myNewStream ); + FileStream^ myFileStream = + gcnew FileStream( myFileName, FileMode::Append, FileAccess::Write ); + StreamWriter^ myStreamWriter = gcnew StreamWriter( myFileStream ); + myStreamWriter->WriteLine( + "---------------------------------- Response at {0}", DateTime::Now ); + Stream^ myStream = myMessage->Stream; + myStreamWriter->Write( "Length of data in the current response: " ); + myStreamWriter->WriteLine( myStream->Length ); + myStreamWriter->Flush(); + myNewStream->Position = 0; + Copy( myNewStream, myFileStream ); + myStreamWriter->Close(); + myFileStream->Close(); + myNewStream->Position = 0; + } + // + + // Return a new MemoryStream for SOAP processing. + virtual Stream^ ChainStream( Stream^ myStream ) override + { + myOldStream = myStream; + myNewStream = gcnew MemoryStream; + return myNewStream; + } + + // Utility method to copy the contents of one stream to another. + void Copy( Stream^ fromStream, Stream^ toStream ) + { + TextReader^ myTextReader = gcnew StreamReader( fromStream ); + TextWriter^ myTextWriter = gcnew StreamWriter( toStream ); + myTextWriter->WriteLine( myTextReader->ReadToEnd() ); + myTextWriter->Flush(); + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp new file mode 100644 index 00000000000..c0254af595f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapOperationBinding/CPP/soapoperationbinding.cpp @@ -0,0 +1,104 @@ + + +// System.Web.Services.Description.SoapBinding +// System.Web.Services.Description.SoapOperationBinding +// System.Web.Services.Description.SoapBodyBinding +// System.Web.Services.Description.SoapAddressBinding +// System.Web.Services.Description.SoapBinding.HttpTransport; +/* +The following example demonstrates the 'SoapBinding', 'SoapOperationBinding' , +'SoapBodyBinding' , SoapAddressBinding' classes and 'HttpTransport' field of 'SoapBinding' class. + +It takes a wsdl file which supports two protocols 'HttpGet' and 'HttpPost' as input. By using the +'Read' method of 'ServiceDescription' class it gets the 'ServiceDescription' object. It uses +the SOAP protocol related classes and creates 'Binding','Port' and 'PortType' elements of +'SOAP' protocol. It adds all the elements to the 'ServiceDescription' object. The 'ServiceDescription' +object creates another wsdl file which supports 'SOAP' also. This wsdl file is used to generate a proxy +which is used by the .aspx file. +*/ +// +// +// +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; +int main() +{ + ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbersInput_cs.wsdl" ); + + // Create a 'Binding' object for the 'SOAP' protocol. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Service1Soap"; + XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1Soap" ); + myBinding->Type = qualifiedName; + + // + SoapBinding^ mySoapBinding = gcnew SoapBinding; + mySoapBinding->Transport = SoapBinding::HttpTransport; + mySoapBinding->Style = SoapBindingStyle::Document; + // + + // Add the 'SoapBinding' object to the 'Binding' object. + myBinding->Extensions->Add( mySoapBinding ); + + // Create the 'OperationBinding' object for the 'SOAP' protocol. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + + // Create the 'SoapOperationBinding' object for the 'SOAP' protocol. + SoapOperationBinding^ mySoapOperationBinding = gcnew SoapOperationBinding; + mySoapOperationBinding->SoapAction = "http://tempuri.org/AddNumbers"; + mySoapOperationBinding->Style = SoapBindingStyle::Document; + + // Add the 'SoapOperationBinding' object to 'OperationBinding' object. + myOperationBinding->Extensions->Add( mySoapOperationBinding ); + + // Create the 'InputBinding' object for the 'SOAP' protocol. + InputBinding^ myInput = gcnew InputBinding; + SoapBodyBinding^ mySoapBinding1 = gcnew SoapBodyBinding; + mySoapBinding1->Use = SoapBindingUse::Literal; + myInput->Extensions->Add( mySoapBinding1 ); + + // Assign the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInput; + + // Create the 'OutputBinding' object' for the 'SOAP' protocol.. + OutputBinding^ myOutput = gcnew OutputBinding; + myOutput->Extensions->Add( mySoapBinding1 ); + + // Assign the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + Port^ soapPort = gcnew Port; + soapPort->Name = "Service1Soap"; + soapPort->Binding = gcnew XmlQualifiedName( "s0:Service1Soap" ); + + // Create a 'SoapAddressBinding' object for the 'SOAP' protocol. + SoapAddressBinding^ mySoapAddressBinding = gcnew SoapAddressBinding; + mySoapAddressBinding->Location = "http://localhost/AddNumbers.cs.asmx"; + + // Add the 'SoapAddressBinding' to the 'Port'. + soapPort->Extensions->Add( mySoapAddressBinding ); + + // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. + myDescription->Services[ 0 ]->Ports->Add( soapPort ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "AddNumbersOut_cs.wsdl" ); + Console::WriteLine( " 'AddNumbersOut_cs.Wsdl' file was generated" ); +} +// +// +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp b/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp new file mode 100644 index 00000000000..1c316326d9c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SoapTypeAttribute Example/CPP/soaptype.cpp @@ -0,0 +1,171 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +[SoapType("EmployeeType")] +public ref class Employee +{ +public: + String^ Name; +}; + + +// The SoapType is overridden when the +// SerializeOverride method is called. + +[SoapType("SoapGroupType","http://www.cohowinery.com")] +public ref class Group +{ +public: + String^ GroupName; + array^Employees; +}; + +public ref class Run +{ +public: + void SerializeOriginal( String^ filename ) + { + // Create an instance of the XmlSerializer class that + // can be used for serializing as a SOAP message. + XmlTypeMapping^ mapp = (gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid ); + XmlSerializer^ mySerializer = gcnew XmlSerializer( mapp ); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an XML text writer. + XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( writer ); + xmlWriter->Formatting = Formatting::Indented; + xmlWriter->Indentation = 2; + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the Object* properties. + myGroup->GroupName = ".NET"; + Employee^ e1 = gcnew Employee; + e1->Name = "Pat"; + myGroup->Employees = gcnew array(1); + myGroup->Employees[ 0 ] = e1; + + // Write the root element. + xmlWriter->WriteStartElement( "root" ); + + // Serialize the class. + mySerializer->Serialize( xmlWriter, myGroup ); + + // Close the root tag. + xmlWriter->WriteEndElement(); + + // Close the XmlWriter. + xmlWriter->Close(); + + // Close the TextWriter. + writer->Close(); + } + + void SerializeOverride( String^ filename ) + { + // Create an instance of the XmlSerializer class that + // uses a SoapAttributeOverrides Object*. + XmlSerializer^ mySerializer = CreateOverrideSerializer(); + + // Writing the file requires a TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create an XML text writer. + XmlTextWriter^ xmlWriter = gcnew XmlTextWriter( writer ); + xmlWriter->Formatting = Formatting::Indented; + xmlWriter->Indentation = 2; + + // Create an instance of the class that will be serialized. + Group^ myGroup = gcnew Group; + + // Set the Object* properties. + myGroup->GroupName = ".NET"; + Employee^ e1 = gcnew Employee; + e1->Name = "Pat"; + myGroup->Employees = gcnew array(1); + myGroup->Employees[ 0 ] = e1; + + // Write the root element. + xmlWriter->WriteStartElement( "root" ); + + // Serialize the class. + mySerializer->Serialize( xmlWriter, myGroup ); + + // Close the root tag. + xmlWriter->WriteEndElement(); + + // Close the XmlWriter. + xmlWriter->Close(); + + // Close the TextWriter. + writer->Close(); + } + + void DeserializeObject( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlSerializer^ mySerializer = CreateOverrideSerializer(); + + // Reading the file requires a TextReader. + TextReader^ reader = gcnew StreamReader( filename ); + + // Create an XML text reader. + XmlTextReader^ xmlReader = gcnew XmlTextReader( reader ); + xmlReader->ReadStartElement(); + + // Deserialize and cast the object. + Group^ myGroup; + myGroup = dynamic_cast(mySerializer->Deserialize( xmlReader )); + xmlReader->ReadEndElement(); + Console::WriteLine( "The GroupName is {0}", myGroup->GroupName ); + Console::WriteLine( "Look at the SoapType.xml and SoapType2.xml " + "files for the generated XML." ); + + // Close the readers. + xmlReader->Close(); + reader->Close(); + } + +private: + XmlSerializer^ CreateOverrideSerializer() + { + // Create and return an XmlSerializer instance used to + // and create SOAP messages. + SoapAttributeOverrides^ mySoapAttributeOverrides = gcnew SoapAttributeOverrides; + SoapAttributes^ soapAtts = gcnew SoapAttributes; + + // Override the SoapTypeAttribute. + SoapTypeAttribute^ soapType = gcnew SoapTypeAttribute; + soapType->TypeName = "Team"; + soapType->IncludeInSchema = false; + soapType->Namespace = "http://www.microsoft.com"; + soapAtts->SoapType = soapType; + mySoapAttributeOverrides->Add( Group::typeid, soapAtts ); + + // Create an XmlTypeMapping that is used to create an instance + // of the XmlSerializer. Then return the XmlSerializer Object*. + XmlTypeMapping^ myMapping = (gcnew SoapReflectionImporter( mySoapAttributeOverrides ))->ImportTypeMapping( Group::typeid ); + XmlSerializer^ ser = gcnew XmlSerializer( myMapping ); + return ser; + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->SerializeOriginal( "SoapType.xml" ); + test->SerializeOverride( "SoapType2.xml" ); + test->DeserializeObject( "SoapType2.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp new file mode 100644 index 00000000000..252b3995880 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SocketPermissionExample/CPP/source.cpp @@ -0,0 +1,122 @@ +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; +using namespace System::Security::Permissions; +using namespace System::Collections; + +void MySocketPermission() +{ +// +// + // Creates a SocketPermission restricting access to and from all URIs. + SocketPermission^ mySocketPermission1 = gcnew SocketPermission( PermissionState::None ); + + // The socket to which this permission will apply will allow connections from www.contoso.com. + mySocketPermission1->AddPermission( NetworkAccess::Accept, TransportType::Tcp, "www.contoso.com", 11000 ); + + // Creates a SocketPermission which will allow the target Socket to connect with www.southridgevideo.com. + SocketPermission^ mySocketPermission2 = gcnew SocketPermission( NetworkAccess::Connect,TransportType::Tcp, "www.southridgevideo.com",11002 ); + + // Creates a SocketPermission from the union of two SocketPermissions. + SocketPermission^ mySocketPermissionUnion = + (SocketPermission^)( mySocketPermission1->Union( mySocketPermission2 ) ); + + // Checks to see if the union was successfully created by using the IsSubsetOf method. + if ( mySocketPermission1->IsSubsetOf( mySocketPermissionUnion ) && + mySocketPermission2->IsSubsetOf( mySocketPermissionUnion ) ) + { + Console::WriteLine( "This union contains permissions from both mySocketPermission1 and mySocketPermission2" ); + + // Prints the allowable accept URIs to the console. + Console::WriteLine( "This union accepts connections on :" ); + + IEnumerator^ myEnumerator = mySocketPermissionUnion->AcceptList; + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( safe_cast( myEnumerator->Current )->ToString() ); + } + + // Prints the allowable connect URIs to the console. + Console::WriteLine( "This union permits connections to :" ); + + myEnumerator = mySocketPermissionUnion->ConnectList; + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( safe_cast( myEnumerator->Current )->ToString() ); + } + } +// + +// + // Creates a SocketPermission from the intersect of two SocketPermissions. + SocketPermission^ mySocketPermissionIntersect = + (SocketPermission^)( mySocketPermission1->Intersect( mySocketPermissionUnion ) ); + + // mySocketPermissionIntersect should now contain the permissions of mySocketPermission1. + if ( mySocketPermission1->IsSubsetOf( mySocketPermissionIntersect ) ) + { + Console::WriteLine( "This is expected" ); + } + + // mySocketPermissionIntersect should not contain the permissios of mySocketPermission2. + if ( mySocketPermission2->IsSubsetOf( mySocketPermissionIntersect ) ) + { + Console::WriteLine( "This should not print" ); + } +// + +// + // Creates a copy of the intersect SocketPermission. + SocketPermission^ mySocketPermissionIntersectCopy = + (SocketPermission^)( mySocketPermissionIntersect->Copy() ); + if ( mySocketPermissionIntersectCopy->Equals( mySocketPermissionIntersect ) ) + { + Console::WriteLine( "Copy successfull" ); + } +// + + // Converts a SocketPermission to XML format and then immediately converts it back to a SocketPermission. + mySocketPermission1->FromXml( mySocketPermission1->ToXml() ); + + // Checks to see if permission for this socket resource is unrestricted. If it is, then there is no need to + // demand that permissions be enforced. + if ( mySocketPermissionUnion->IsUnrestricted() ) + { + //Do nothing. There are no restrictions. + } + else + { + // Enforces the permissions found in mySocketPermissionUnion on any Socket Resources used below this statement. + mySocketPermissionUnion->Demand(); + } + + IPHostEntry^ myIpHostEntry = Dns::Resolve( "www.contoso.com" ); + IPEndPoint^ myLocalEndPoint = gcnew IPEndPoint( myIpHostEntry->AddressList[ 0 ], 11000 ); + + Socket^ s = gcnew Socket( myLocalEndPoint->Address->AddressFamily, + SocketType::Stream, + ProtocolType::Tcp ); + try + { + s->Connect( myLocalEndPoint ); + } + catch ( Exception^ e ) + { + Console::Write( "Exception Thrown: " ); + Console::WriteLine( e->ToString() ); + } + + // Perform all socket operations in here. + s->Close(); +// +} + +int main() +{ + MySocketPermission(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp new file mode 100644 index 00000000000..9cc9a851cc9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/SocketPropertyTester/CPP/class1.cpp @@ -0,0 +1,105 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +namespace SocketOptionExamples +{ + ref class SocketPropertyTester + { + // + static void ConfigureTcpSocket(Socket^ tcpSocket) + { + + // Don't allow another socket to bind to this port. + tcpSocket->ExclusiveAddressUse = true; + + // The socket will linger for 10 seconds after + // Socket.Close is called. + tcpSocket->LingerState = gcnew LingerOption(true, 10); + + // Disable the Nagle Algorithm for this tcp socket. + tcpSocket->NoDelay = true; + + // Set the receive buffer size to 8k + tcpSocket->ReceiveBufferSize = 8192; + + // Set the timeout for synchronous receive methods to + // 1 second (1000 milliseconds.) + tcpSocket->ReceiveTimeout = 1000; + + // Set the send buffer size to 8k. + tcpSocket->SendBufferSize = 8192; + + // Set the timeout for synchronous send methods + // to 1 second (1000 milliseconds.) + tcpSocket->SendTimeout = 1000; + + // Set the Time To Live (TTL) to 42 router hops. + tcpSocket->Ttl = 42; + Console::WriteLine("Tcp Socket configured:"); + Console::WriteLine(" ExclusiveAddressUse {0}", + tcpSocket->ExclusiveAddressUse); + Console::WriteLine(" LingerState {0}, {1}", + tcpSocket->LingerState->Enabled, + tcpSocket->LingerState->LingerTime); + Console::WriteLine(" NoDelay {0}", + tcpSocket->NoDelay); + Console::WriteLine(" ReceiveBufferSize {0}", + tcpSocket->ReceiveBufferSize); + Console::WriteLine(" ReceiveTimeout {0}", + tcpSocket->ReceiveTimeout); + Console::WriteLine(" SendBufferSize {0}", + tcpSocket->SendBufferSize); + Console::WriteLine(" SendTimeout {0}", + tcpSocket->SendTimeout); + Console::WriteLine(" Ttl {0}", + tcpSocket->Ttl); + Console::WriteLine(" IsBound {0}", + tcpSocket->IsBound); + Console::WriteLine(""); + } + // + // + static void ConfigureUdpSocket(Socket^ udpSocket) + { + + // Set the Don't Fragment flag. + udpSocket->DontFragment = true; + + // Enable broadcast. + udpSocket->EnableBroadcast = true; + + // Disable multicast loopback. + udpSocket->MulticastLoopback = false; + Console::WriteLine("Udp Socket configured:"); + Console::WriteLine(" DontFragment {0}", + udpSocket->DontFragment); + Console::WriteLine(" EnableBroadcast {0}", + udpSocket->EnableBroadcast); + Console::WriteLine(" MulticastLoopback {0}", + udpSocket->MulticastLoopback); + } + // + public: + static void Work() + { + Socket^ tcpSocket = gcnew Socket( + AddressFamily::InterNetwork, + SocketType::Stream, ProtocolType::IP); + Socket^ udpSocket = gcnew Socket( + AddressFamily::InterNetwork, + SocketType::Dgram, ProtocolType::IP); + ConfigureTcpSocket(tcpSocket); + ConfigureUdpSocket(udpSocket); + } + }; +} + +int main() +{ + SocketOptionExamples::SocketPropertyTester::Work(); + return 0; +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp new file mode 100644 index 00000000000..d7441a3cbf9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Socket_Select/CPP/source.cpp @@ -0,0 +1,75 @@ + + +#using +#define NULL 0 + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; +using namespace System::Collections; +public ref class Sync_Send_Receive +{ +public: + + //Displays sending and receiving with a connected socket -- buffer only + static void SendReceive1() + { + + // + IPHostEntry^ lipa = Dns::Resolve( Dns::GetHostName() ); + + //Gets three separate local endpoints. + IPEndPoint^ lep1 = gcnew IPEndPoint( lipa->AddressList[ 0 ],11000 ); + IPEndPoint^ lep2 = gcnew IPEndPoint( lipa->AddressList[ 0 ],11001 ); + IPEndPoint^ lep3 = gcnew IPEndPoint( lipa->AddressList[ 0 ],11002 ); + + //creates an array of endpoints. + array^ipendpoints = gcnew array(3); + ipendpoints[ 0 ] = lep1; + ipendpoints[ 1 ] = lep2; + ipendpoints[ 2 ] = lep3; + + //Creates three separate sockets. + Socket^ s1 = gcnew Socket( lep1->Address->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); + Socket^ s2 = gcnew Socket( lep2->Address->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); + Socket^ s3 = gcnew Socket( lep3->Address->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); + array^socketList = gcnew array(3); + socketList[ 0 ] = s1; + socketList[ 1 ] = s2; + socketList[ 2 ] = s3; + + //Binds and Listens on all sockets in the array of sockets. + for ( int i = 0; i < 3; i++ ) + { + socketList[ i ]->Bind( ipendpoints[ i ] ); + socketList[ i ]->Listen( 1000 ); + + } + + //Calls Select to determine which sockets are ready for reading. + Socket::Select( safe_cast(socketList), nullptr, nullptr, 1000 ); + + //Reads on the sockets returned by Select. + array^buffer = gcnew array(1024); + String^ outString; + for ( Int32 j = 0; j < (socketList->Length - 1); j++ ) + { + socketList[ j ]->Receive( buffer ); + outString = "Socket "; + outString->Concat( j.ToString(), " has the message", Encoding::ASCII->GetString( buffer ) ); + Console::WriteLine( outString ); + + } + } + +}; + +int main() +{ + return 0; +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp new file mode 100644 index 00000000000..e799e953dee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Socket_Send_Receive/CPP/source.cpp @@ -0,0 +1,128 @@ + + +// +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +String^ DoSocketGet( String^ server ) +{ + + //Set up variables and String to write to the server. + Encoding^ ASCII = Encoding::ASCII; + String^ Get = "GET / HTTP/1.1\r\nHost: "; + Get->Concat( server, "\r\nConnection: Close\r\n\r\n" ); + array^ByteGet = ASCII->GetBytes( Get ); + array^RecvBytes = gcnew array(256); + String^ strRetPage = nullptr; + + // IPAddress and IPEndPoint represent the endpoint that will + // receive the request. + // Get first IPAddress in list return by DNS. + try + { + + // Define those variables to be evaluated in the next for loop and + // then used to connect to the server. These variables are defined + // outside the for loop to make them accessible there after. + Socket^ s = nullptr; + IPEndPoint^ hostEndPoint; + IPAddress^ hostAddress = nullptr; + int conPort = 80; + + // Get DNS host information. + IPHostEntry^ hostInfo = Dns::Resolve( server ); + + // Get the DNS IP addresses associated with the host. + array^IPaddresses = hostInfo->AddressList; + + // Evaluate the socket and receiving host IPAddress and IPEndPoint. + for ( int index = 0; index < IPaddresses->Length; index++ ) + { + hostAddress = IPaddresses[ index ]; + hostEndPoint = gcnew IPEndPoint( hostAddress,conPort ); + + // + // Creates the Socket to send data over a TCP connection. + s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + // + // Connect to the host using its IPEndPoint. + s->Connect( hostEndPoint ); + if ( !s->Connected ) + { + + // Connection failed, try next IPaddress. + strRetPage = "Unable to connect to host"; + s = nullptr; + continue; + } + + + // + // Sent the GET request to the host. + s->Send( ByteGet, ByteGet->Length, SocketFlags::None ); + + // + + } + + // + // Receive the host home page content and loop until all the data is received. + Int32 bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); + strRetPage = "Default HTML page on "; + strRetPage->Concat( server, ":\r\n", ASCII->GetString( RecvBytes, 0, bytes ) ); + while ( bytes > 0 ) + { + bytes = s->Receive( RecvBytes, RecvBytes->Length, SocketFlags::None ); + strRetPage->Concat( ASCII->GetString( RecvBytes, 0, bytes ) ); + } + + + // + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException caught!!!" ); + Console::Write( "Source : " ); + Console::WriteLine( e->Source ); + Console::Write( "Message : " ); + Console::WriteLine( e->Message ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNULLException caught!!!" ); + Console::Write( "Source : " ); + Console::WriteLine( e->Source ); + Console::Write( "Message : " ); + Console::WriteLine( e->Message ); + } + catch ( NullReferenceException^ e ) + { + Console::WriteLine( "NULLReferenceException caught!!!" ); + Console::Write( "Source : " ); + Console::WriteLine( e->Source ); + Console::Write( "Message : " ); + Console::WriteLine( e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::Write( "Source : " ); + Console::WriteLine( e->Source ); + Console::Write( "Message : " ); + Console::WriteLine( e->Message ); + } + + return strRetPage; +} + +int main() +{ + Console::WriteLine( DoSocketGet( "localhost" ) ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp new file mode 100644 index 00000000000..11687431bce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Socket_Socket_Options/CPP/source.cpp @@ -0,0 +1,105 @@ +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; + +public ref class Sync_Send_Receive +{ +public: + static void SetSocketOptions() + { + IPHostEntry^ lipa = Dns::Resolve("host.contoso.com"); + IPEndPoint^ lep = gcnew IPEndPoint(lipa->AddressList[0], 11000); + Socket^ s = gcnew Socket(lep->Address->AddressFamily, SocketType::Stream, ProtocolType::Tcp); + + // + // Specifies that send operations will time-out + // if confirmation is not received within 1000 milliseconds. + s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 1000); + // + + // + // Specifies that the Socket will linger for 10 seconds after Close is called. + LingerOption^ lingerOption = gcnew LingerOption(true, 10); + s->SetSocketOption(SocketOptionLevel::Socket, SocketOptionName::Linger, lingerOption); + // + + s->Connect(lep); + + array^ msg = Encoding::ASCII->GetBytes("This is a test"); + + // + Console::Write("This application will timeout if Send does not return within "); + Console::WriteLine(Encoding::ASCII->GetString(s->GetSocketOption(SocketOptionLevel::Socket, SocketOptionName::SendTimeout, 4))); + + // Blocks until send returns. + int i = s->Send(msg); + + // Blocks until read returns. + array^ bytes = gcnew array(1024); + + s->Receive(bytes); + + // Displays to the screen. + Console::WriteLine(Encoding::ASCII->GetString(bytes)); + s->Shutdown(SocketShutdown::Both); + Console::Write("If data remains to be sent, this application will stay open for "); + Console::WriteLine(safe_cast(s->GetSocketOption(SocketOptionLevel::Socket, SocketOptionName::Linger))->LingerTime.ToString()); + s->Close(); + // + } + + static void CheckProperties() + { + IPHostEntry^ lipa = Dns::Resolve("host.contoso.com"); + IPEndPoint^ lep = gcnew IPEndPoint(lipa->AddressList[0], 11000); + + // + Socket^ s = gcnew Socket(lep->Address->AddressFamily, SocketType::Stream, ProtocolType::Tcp); + + // Uses the AddressFamily, SocketType, and ProtocolType properties. + Console::Write("I just set the following properties of socket: \n"); + Console::Write("Address Family = {0}", s->AddressFamily.ToString()); + Console::Write("\nSocketType = {0}", s->SocketType.ToString()); + Console::WriteLine("\nProtocolType = {0}", s->ProtocolType.ToString()); + // + + // + s->Connect(lep); + + // Uses the RemoteEndPoint property. + Console::WriteLine("I am connected to {0} on port number {1}", + IPAddress::Parse((((IPEndPoint^)(s->RemoteEndPoint))->Address)->ToString()), + ((IPEndPoint^)(s->RemoteEndPoint))->Port.ToString()); + + // Uses the LocalEndPoint property. + Console::Write("My local IpAddress is : {0}\nI am connected on port number {1}", + IPAddress::Parse((((IPEndPoint^)(s->LocalEndPoint))->Address)->ToString()), + ((IPEndPoint^)(s->LocalEndPoint))->Port.ToString()); + // + + // + // Uses low level method IOControl to set this socket to blocking mode. + int code = 0x8004667E; + array^ inBuf = gcnew array(4); + + inBuf[0] = 0; + + array^ outBuf = gcnew array(4); + + s->IOControl(code, inBuf, outBuf); + + // Checks to see that this worked. + if (s->Blocking) + { + Console::WriteLine("Socket was set to Blocking mode successfully"); + } + // + } +}; + +int main() {} diff --git a/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp new file mode 100644 index 00000000000..847ace50a90 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/Socket_Sync_Send_Receive/CPP/source.cpp @@ -0,0 +1,449 @@ +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; + +// +// Displays sending with a connected socket +// using the overload that takes a buffer. +int SendReceiveTest1( Socket^ server ) +{ + array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); + array^ bytes = gcnew array(256); + try + { + // Blocks until send returns. + int byteCount = server->Send( msg ); + Console::WriteLine( "Sent {0} bytes.", byteCount.ToString() ); + + // Get reply from the server. + byteCount = server->Receive( bytes ); + if ( byteCount > 0 ) + { + Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); + return ( e->ErrorCode ); + } + return 0; +} +// + +// Displays receiving from a connected tcp socket +// using the overload that takes a buffer. +int ReceiveTest1( Socket^ client ) +{ + array^ bytes = gcnew array(256); + try + { + // It is usually preferable to use the overload + // that allows you to specify the maximum bytes returned. + if ( client->Available > 256 ) + { + throw gcnew ApplicationException( "This test socket only takes messages < 256 bytes." ); + } + // Blocks until read returns. + int byteCount = client->Receive( bytes ); + if ( byteCount > 0 ) + { + Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); + } + // Send reply to the client. + client->Send( Encoding::UTF8->GetBytes( "Bye." ) ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); + return ( e->ErrorCode ); + } + return 0; +} + +// +// Displays sending with a connected socket +// using the overload that takes a buffer and socket flags. +int SendReceiveTest2( Socket^ server ) +{ + array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); + array^ bytes = gcnew array(256); + try + { + // Blocks until send returns. + int byteCount = server->Send( msg, SocketFlags::None ); + Console::WriteLine( "Sent {0} bytes.", byteCount.ToString() ); + + // Get reply from the server. + byteCount = server->Receive( bytes, SocketFlags::None ); + if ( byteCount > 0 ) + { + Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); + return (e->ErrorCode); + } + return 0; +} +// + +// +// Displays sending with a connected socket +// using the overload that takes a buffer, message size, and socket flags. +int SendReceiveTest3( Socket^ server ) +{ + array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); + array^ bytes = gcnew array(256); + try + { + // Blocks until send returns. + int i = server->Send( msg, msg->Length, SocketFlags::None ); + Console::WriteLine( "Sent {0} bytes.", i.ToString() ); + + // Get reply from the server. + int byteCount = server->Receive( bytes, server->Available, + SocketFlags::None ); + if ( byteCount > 0 ) + { + Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); + return (e->ErrorCode); + } + return 0; +} +// + +// +// Displays sending with a connected socket +// using the overload that takes a buffer, offset, message size, and socket flags. +int SendReceiveTest4( Socket^ server ) +{ + array^ msg = Encoding::UTF8->GetBytes( "This is a test" ); + array^ bytes = gcnew array(256); + try + { + + // Blocks until send returns. + int byteCount = server->Send( msg, 0, msg->Length, SocketFlags::None ); + Console::WriteLine( "Sent {0} bytes.", byteCount.ToString() ); + + // Get reply from the server. + byteCount = server->Receive( bytes, 0, server->Available, + SocketFlags::None ); + if ( byteCount > 0 ) + { + Console::WriteLine( Encoding::UTF8->GetString( bytes ) ); + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "{0} Error code: {1}.", e->Message, e->ErrorCode.ToString() ); + return (e->ErrorCode); + } + return 0; +} +// + +public ref class NeedForDelegates +{ +public: + + // + static void SendTo1() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); + Console::WriteLine( "Sending data." ); + // This call blocks. + s->SendTo( msg, endPoint ); + s->Close(); + } + // + + // + static void SendTo2() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); + Console::WriteLine( "Sending data." ); + // This call blocks. + s->SendTo( msg, SocketFlags::None, endPoint ); + s->Close(); + } + // + + // + static void SendTo3() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); + Console::WriteLine( "Sending data." ); + // This call blocks. + s->SendTo( msg, msg->Length, SocketFlags::None, endPoint ); + s->Close(); + } + // + + // + static void SendTo4() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + array^ msg = Encoding::ASCII->GetBytes( "This is a test" ); + Console::WriteLine( "Sending data." ); + // This call blocks. + s->SendTo( msg, 0, msg->Length, SocketFlags::None, endPoint ); + s->Close(); + } + // + + // The ReceiveFroms + // + static void ReceiveFrom1() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + // Creates an IPEndPoint to capture the identity of the sending host. + IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); + EndPoint^ senderRemote = safe_cast(sender); + + // Binding is required with ReceiveFrom calls. + s->Bind( endPoint ); + + array^ msg = gcnew array(256); + Console::WriteLine( "Waiting to receive datagrams from client..." ); + + // This call blocks. + s->ReceiveFrom( msg, senderRemote ); + s->Close(); + } + // + + // + static void ReceiveFrom2() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + // Creates an IpEndPoint to capture the identity of the sending host. + IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); + EndPoint^ senderRemote = safe_cast(sender); + + // Binding is required with ReceiveFrom calls. + s->Bind( endPoint ); + + array^ msg = gcnew array(256); + Console::WriteLine( "Waiting to receive datagrams from client..." ); + // This call blocks. + s->ReceiveFrom( msg, SocketFlags::None, senderRemote ); + s->Close(); + } + // + + // + static void ReceiveFrom3() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + // Creates an IPEndPoint to capture the identity of the sending host. + IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); + EndPoint^ senderRemote = safe_cast(sender); + + // Binding is required with ReceiveFrom calls. + s->Bind( endPoint ); + + array^ msg = gcnew array(256); + Console::WriteLine( "SWaiting to receive datagrams from client..." ); + // This call blocks. + s->ReceiveFrom( msg, msg->Length, SocketFlags::None, senderRemote ); + s->Close(); + } + // + + // + static void ReceiveFrom4() + { + IPHostEntry^ hostEntry = Dns::Resolve( Dns::GetHostName() ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Dgram, + ProtocolType::Udp ); + + // Creates an IpEndPoint to capture the identity of the sending host. + IPEndPoint^ sender = gcnew IPEndPoint( IPAddress::Any,0 ); + EndPoint^ senderRemote = safe_cast(sender); + + // Binding is required with ReceiveFrom calls. + s->Bind( endPoint ); + + array^ msg = gcnew array(256); + Console::WriteLine( "SWaiting to receive datagrams from client..." ); + // This call blocks. + s->ReceiveFrom( msg, 0, msg->Length, SocketFlags::None, senderRemote ); + s->Close(); + } + // + // end NeedForDelegates +}; + +void RunUdpTests() +{ + // Test the upd versions. + + //NeedForDelegates^ n = new NeedForDelegates(); + ThreadStart^ myThreadDelegate = gcnew ThreadStart( &NeedForDelegates::ReceiveFrom1 ); + Thread^ myThread1 = gcnew Thread( myThreadDelegate ); + myThread1->Start(); + + while ( myThread1->IsAlive ) + { + NeedForDelegates::SendTo1(); + } + myThread1->Join(); + + Console::WriteLine( "UDP test2" ); + Thread^ myThread2 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom2 ) ); + myThread2->Start(); + while ( myThread2->IsAlive ) + { + NeedForDelegates::SendTo2(); + } + myThread2->Join(); + + Console::WriteLine( "UDP test3" ); + Thread^ myThread3 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom3 ) ); + myThread3->Start(); + while ( myThread3->IsAlive ) + { + NeedForDelegates::SendTo3(); + } + myThread3->Join(); + + Console::WriteLine( "UDP test4" ); + Thread^ myThread4 = gcnew Thread( gcnew ThreadStart( &NeedForDelegates::ReceiveFrom4 ) ); + myThread4->Start(); + while ( myThread4->IsAlive ) + { + NeedForDelegates::SendTo4(); + } + myThread4->Join(); +} + +//Main tests the snippets. +// To test tcp - run 2 instances source /s runs server, source /c runs client. +// To test Upd run source /u. +int main( int /*argc*/, char *args[] ) +{ + String^ host; + bool isServer; + + if ( args[ 1 ][ 1 ] == 'c' ) + { + isServer = false; + host = "127.0.0.1"; + } + else + if ( args[ 1 ][ 1 ] == 'u' ) + { + Console::WriteLine( "running udptests" ); + RunUdpTests(); + return 0; + } + else + { + host = "localhost"; + isServer = true; + } + + // Set up the endpoint and create the socket. + IPHostEntry^ hostEntry = Dns::Resolve( host ); + IPEndPoint^ endPoint = gcnew IPEndPoint( hostEntry->AddressList[ 0 ],11000 ); + + // Test the TCPIP snippets (Socket.Send and Socket.Receive) + + Socket^ s = gcnew Socket( endPoint->Address->AddressFamily, + SocketType::Stream, + ProtocolType::Tcp ); + + // Send or receive the test messages. + if ( isServer ) + { + Socket^ sender = nullptr; + s->Bind( endPoint ); + s->Listen( 1 ); + for ( ; ; ) + { + sender = s->Accept(); + // exchange messages with all clients tests + for ( int i = 0; i < 4; i++ ) + { + ReceiveTest1( sender ); + } + sender->Close(); + s->Close(); + Environment::Exit( 0 ); + } + } + // Its the client tcp tests. + else + { + s->Connect( endPoint ); + SendReceiveTest1( s ); + SendReceiveTest2( s ); + SendReceiveTest3( s ); + SendReceiveTest4( s ); + s->Close(); + } + + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp b/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp new file mode 100644 index 00000000000..e40bac9464b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponent.cpp @@ -0,0 +1,47 @@ + + +#using + +using namespace System; +using namespace System::EnterpriseServices; +using namespace System::Runtime::InteropServices; +using namespace System::Reflection; + +[assembly:AssemblyKeyFile("key.snk")]; +[assembly:ApplicationName("Queued Component")]; +[assembly:ApplicationID("AC6F4BE6-66E5-4a94-8162-A7F850150F9F")]; +[assembly:ApplicationActivation(ActivationOption::Server)]; +// Ensure that the example shows how to call the queued component. +// See QueuedComponentClient for example + +// +// Mark the COM+ application as queued at compile time by using the +// ApplicationQueuing attribute. Enable the COM+ listener by +// setting the QueueListenerEnabled to true +[assembly:ApplicationQueuing(Enabled=true,QueueListenerEnabled=true)]; +// + +[Guid("9A6233C4-7459-4c1a-808A-905FC648B5A8")] +// +public interface class IQueuedComponent +{ + void QueuedTask(); +}; + + +// Mark IQueuedComponent interface as queued +// Create the queued component class by inheriting the +// System.EnterpriseServices.ServicedComponent class and an +// interface that is marked as queued with the InterfaceQueuing attribute + +[InterfaceQueuing(true,Interface="IQueuedComponent")] +public ref class QueuedComponent sealed: public ServicedComponent, public IQueuedComponent +{ +public: + virtual void QueuedTask() + { + // Perform queued task here + } + +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp b/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp new file mode 100644 index 00000000000..3a9ce016420 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.EnterpriseServices.QueuedComponents/CPP/queuedcomponentclientclass.cpp @@ -0,0 +1,24 @@ + + +#using + +using namespace System; + +[STAThread] +int main() +{ + for ( int counter = 0; counter < 10; counter++ ) + { + + // + // Use BindToMoniker to run the queued moniker, to get an instance of the recorder + IQueuedComponent ^ qc = dynamic_cast(System::Runtime::InteropServices::Marshal::BindToMoniker( "queue:/new:QueuedComponent" )); + + // Call the method that will be recorded + qc->QueuedTask(); + + // Force the release of the recorder object, to send the message to the queue + System::Runtime::InteropServices::Marshal::ReleaseComObject( qc ); + // + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp new file mode 100644 index 00000000000..83b7a7e0a9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Authentication/CPP/custombasicauthentication.cpp @@ -0,0 +1,355 @@ + + +// +// This program contains snippets applicable to the following: +// System::Net::AuthenticationManger (Snippet1); +// System::Net::AuthenticationManger::Register (Snippet2); +// System::Net::AuthenticationUnregister (Snippet2); +// System::Net::AuthenticationManger::RegisteredModules (Snippet8); +// System::Net::Authorization::Authorization (Snippet3); +// System::Net::Authorization::Message (Snippet5); +// System::Net::Authorization::Complete (Snippet5); +// System::Net::Authorization::GroupId (Snippet5); +// System::Net::IAuthenticationModule* (Snippet6); +// System::Net::IAuthenticationModule*.AuthenticationType (Snippet7); +// System::Net::IAuthenticationModule*.CanPreAuthenticate (Snippet7); +// System::Net::IAuthenticationModule*.Authenticate (Snippet3); +// System::Net::IAuthenticationModule*.PreAuthenticate (Snippet4); +// +// +// This program shows how to create a custom Basic authentication module, +// how to register it via the AuthenticationManager class and how to authorize +// users to access a Web site. +// Note: In order to run this program you must create a test Web site that performs +// Basic authentication. Also you must add to your server machine a user whose +// credentials are the same you use in this program. +// Attention: Basic authenticastion sends the user's credentials over HTTP. +// Passwords and user names are encoded using Base64 encoding. Although the +// user information is encoded, it is considered insecure due to the fact that it +// could be deciphered relatively easily. +// If you must use basic authentication you are strongly adviced to use strong +// security mechanisms, such as SSL, when transfering sensitive information on +// the wire. +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Collections; + +// The TestAuthentication class performs the following main tasks: +// 1) It obtains the user's credentials. +// 2) Unregisters the standard Basic authentication. +// 3) Registers the customized Basic authentication. +// 4) Reads the selected page and displays it on the console. +ref class TestAuthentication +{ +public: + static String^ username; + static String^ password; + static String^ domain; + static String^ uri; + + // Show how to use this program. + static void showusage() + { + Console::WriteLine( "Attempts to authenticate to a URL" ); + Console::WriteLine( "\r\nUse one of the following:" ); + Console::WriteLine( "\tcustomBasicAuthentication URL username password domain" ); + Console::WriteLine( "\tcustomBasicAuthentication URL username password" ); + Console::WriteLine( "\r\nExample:" ); + Console::WriteLine( "\tcustomBasicAuthentication http://ndpue/ncl/ basicuser basic.101 ndpue" ); + } + + + // + // Display registered authentication modules. + static void displayRegisteredModules() + { + + // The AuthenticationManager calls all authentication modules sequentially + // until one of them responds with an authorization instance. Show + // the current registered modules, for testing purposes. + IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; + Console::WriteLine( "\r\nThe following authentication modules are now registered with the system" ); + while ( registeredModules->MoveNext() ) + { + Console::WriteLine( "\r \n Module : {0}", registeredModules->Current ); + IAuthenticationModule^ currentAuthenticationModule = dynamic_cast(registeredModules->Current); + Console::WriteLine( "\t CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate ); + } + } + + + // + // The getPage method accesses the selected page an displays its content + // on the console. + static void getPage( String^ url ) + { + try + { + + // Create the Web request object. + HttpWebRequest^ req = dynamic_cast(WebRequest::Create( url )); + + // Define the request access method. + req->Method = "GET"; + + // Define the request credentials according to the user's input. + if ( String::Compare( domain, String::Empty ) == 0 ) + req->Credentials = gcnew NetworkCredential( username,password ); // If the user's specifies the Internet resource domain, this usually + else + req->Credentials = gcnew NetworkCredential( username,password,domain ); + + // is by default the name of the sever hosting the resource. + // Issue the request. + // req->GetResponse(); + HttpWebResponse^ result = dynamic_cast(req->GetResponse()); + Console::WriteLine( "\nAuthentication Succeeded:" ); + + // Store the response. + Stream^ sData = result->GetResponseStream(); + + // Display the response. + displayPageContent( sData ); + } + catch ( WebException^ e ) + { + + // Display the error, if any. In particular display protocol + // related error. + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + HttpWebResponse^ hresp = dynamic_cast(e->Response); + Console::WriteLine( "\nAuthentication Failed, {0}", hresp->StatusCode ); + Console::WriteLine( "Status Code: {0}", (int)hresp->StatusCode ); + Console::WriteLine( "Status Description: {0}", hresp->StatusDescription ); + return; + } + Console::WriteLine( "Caught Exception: {0}", e->Message ); + Console::WriteLine( "Stack: {0}", e->StackTrace ); + } + + } + + + // The displayPageContent method display the content of the + // selected page. + static void displayPageContent( Stream^ ReceiveStream ) + { + + // Create an ASCII encoding object. + Encoding^ ASCII = Encoding::ASCII; + + // Define the Byte array to temporary hold the current read bytes. + array^read = gcnew array(512); + Console::WriteLine( "\r\nPage Content...\r\n" ); + + // Read the page content and display it on the console. + // Read the first 512 bytes. + int bytes = ReceiveStream->Read( read, 0, 512 ); + while ( bytes > 0 ) + { + Console::Write( ASCII->GetString( read, 0, bytes ) ); + bytes = ReceiveStream->Read( read, 0, 512 ); + } + + Console::WriteLine( "" ); + } + +}; + + +// +// The CustomBasic class creates a custom Basic authentication by implementing the +// IAuthenticationModule interface. In particular it performs the following +// tasks: +// 1) Defines and initializes the required properties. +// 2) Impements the Authenticate method. +public ref class CustomBasic: public IAuthenticationModule +{ +private: + + // + String^ m_authenticationType; + bool m_canPreAuthenticate; + +public: + + // The CustomBasic constructor initializes the properties of the customized + // authentication. + CustomBasic() + { + m_authenticationType = "Basic"; + m_canPreAuthenticate = false; + } + + + property String^ AuthenticationType + { + + // Define the authentication type. This type is then used to identify this + // custom authentication module. The default is set to Basic. + virtual String^ get() + { + return m_authenticationType; + } + + } + + property bool CanPreAuthenticate + { + + // Define the pre-authentication capabilities for the module. The default is set + // to false. + virtual bool get() + { + return m_canPreAuthenticate; + } + + } + + // + // The checkChallenge method checks if the challenge sent by the HttpWebRequest + // contains the correct type (Basic) and the correct domain name. + // Note: the challenge is in the form BASIC REALM=S"DOMAINNAME" + // and you must assure that the Internet Web site resides on a server whose + // domain name is equal to DOMAINAME. + bool checkChallenge( String^ Challenge, String^ domain ) + { + bool challengePasses = false; + String^ tempChallenge = Challenge->ToUpper(); + + // Verify that this is a Basic authorization request and the requested domain + // is correct. + // Note: When the domain is an empty string the following code only checks + // whether the authorization type is Basic. + if ( tempChallenge->IndexOf( "BASIC" ) != -1 ) + if ( String::Compare( domain, String::Empty ) != 0 ) + if ( tempChallenge->IndexOf( domain->ToUpper() ) != -1 ) + challengePasses = true; // The domain is not allowed and the authorization type is Basic. + else + challengePasses = false; + + else + challengePasses = true; + + + return challengePasses; + } + + + // + // The PreAuthenticate method specifies if the authentication implemented + // by this class allows pre-authentication. + // Even if you do not use it, this method must be implemented to obey to the rules + // of interface implemebtation. + // In this case it always returns null. + virtual Authorization^ PreAuthenticate( WebRequest^ request, ICredentials^ credentials ) + { + return nullptr; + } + + + // + // + // Authenticate is the core method for this custom authentication. + // When an internet resource requests authentication, the WebRequest::GetResponse + // method calls the AuthenticationManager::Authenticate method. This method, in + // turn, calls the Authenticate method on each of the registered authentication + // modules, in the order they were registered. When the authentication is + // complete an Authorization object is returned to the WebRequest, as + // shown by this routine's retun type. + virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) + { + Encoding^ ASCII = Encoding::ASCII; + + // Get the username and password from the credentials + NetworkCredential^ MyCreds = credentials->GetCredential( request->RequestUri, "Basic" ); + if ( PreAuthenticate( request, credentials ) == nullptr ) + Console::WriteLine( "\n Pre-authentication is not allowed." ); + else + Console::WriteLine( "\n Pre-authentication is allowed." ); + + + // Verify that the challenge satisfies the authorization requirements. + bool challengeOk = checkChallenge( challenge, MyCreds->Domain ); + if ( !challengeOk ) + return nullptr; + + + // + // Create the encrypted string according to the Basic authentication format as + // follows: + // a)Concatenate username and password separated by colon; + // b)Apply ASCII encoding to obtain a stream of bytes; + // c)Apply Base64 Encoding to this array of bytes to obtain the encoded + // authorization. + String^ BasicEncrypt = String::Concat( MyCreds->UserName, ":", MyCreds->Password ); + String^ BasicToken = String::Concat( "Basic ", Convert::ToBase64String( ASCII->GetBytes( BasicEncrypt ) ) ); + + // Create an Authorization object using the above encoded authorization. + Authorization^ resourceAuthorization = gcnew Authorization( BasicToken ); + + // Get the Message property which contains the authorization string that the + // client returns to the server when accessing protected resources + Console::WriteLine( "\n Authorization Message: {0}", resourceAuthorization->Message ); + + // Get the Complete property which is set to true when the authentication process + // between the client and the server is finished. + Console::WriteLine( "\n Authorization Complete: {0}", resourceAuthorization->Complete ); + + // + Console::WriteLine( "\n Authorization ConnectionGroupId: {0}", resourceAuthorization->ConnectionGroupId ); + return resourceAuthorization; + } + + // +}; + + +// +// This is the program entry point. It allows the user to enter +// her credentials and the Internet resource (Web page) to access. +// It also unregisters the standard and registers the customized basic +// authentication. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 4 ) + TestAuthentication::showusage(); + else + { + + // Read the user's credentials. + TestAuthentication::uri = args[ 1 ]; + TestAuthentication::username = args[ 2 ]; + TestAuthentication::password = args[ 3 ]; + if ( args->Length == 4 ) + TestAuthentication::domain = String::Empty; // If the domain exists, store it. Usually the domain name + else + TestAuthentication::domain = args[ 4 ]; + + // is by default the name of the server hosting the Internet + // resource. + // Instantiate the custom Basic authentication module. + CustomBasic^ customBasicModule = gcnew CustomBasic; + + // Unregister the standard Basic authentication module. + AuthenticationManager::Unregister( "Basic" ); + + // Register the custom Basic authentication module. + AuthenticationManager::Register( customBasicModule ); + + // Display registered Authorization modules. + TestAuthentication::displayRegisteredModules(); + + // Read the specified page and display it on the console. + TestAuthentication::getPage( TestAuthentication::uri ); + } +} + +// +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp new file mode 100644 index 00000000000..6c79604640f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Dns/CPP/dnsnewmethods.cpp @@ -0,0 +1,145 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; +using namespace System::Collections; + +ref class DNSChanges +{ + +// +public: + static void DoGetHostEntry(String^ hostname) + { + IPHostEntry^ host = Dns::GetHostEntry(hostname); + + Console::WriteLine("GetHostEntry({0}) returns:", host->HostName); + + for (int i = 0; i < host->AddressList->Length; i++) + { + Console::WriteLine(" {0}", host->AddressList[i]->ToString()); + } + } +// + +// +public: + static void DoGetHostEntry(IPAddress^ address) + { + IPHostEntry^ host = Dns::GetHostEntry(address); + + Console::WriteLine("GetHostEntry({0}) returns HostName: {1}", address->ToString(), host->HostName); + } +// + +// + // Determine the Internet Protocol(IP) addresses for a host. +public: + static void DoGetHostAddress(String^ hostname) + { + array^ addresses; + addresses = Dns::GetHostAddresses(hostname); + + Console::WriteLine("GetHostAddresses({0}) returns:", hostname); + for each (IPAddress^ address in addresses) + { + Console::Write("{0} ", address); + } + Console::WriteLine(""); + } +// + +// + // Signals when the resolve has finished. +public: + static ManualResetEvent^ GetHostEntryFinished = + gcnew ManualResetEvent(false); + + // define the state object for the callback. + // use hostName to correlate calls with the proper result. + ref class ResolveState + { + public: + String^ hostName; + IPHostEntry^ resolvedIPs; + + ResolveState(String^ host) + { + hostName = host; + } + + property IPHostEntry^ IPs + { + IPHostEntry^ get() + { + return resolvedIPs; + } + + void set(IPHostEntry^ IPs) + { + resolvedIPs = IPs; + } + } + + property String^ host + { + String^ get() + { + return hostName; + } + + void set(String^ host) + { + hostName = host; + } + } + }; + + // Record the IPs in the state object for later use. + static void GetHostEntryCallback(IAsyncResult^ ar) + { + ResolveState^ ioContext = (ResolveState^)(ar->AsyncState); + + ioContext->IPs = Dns::EndGetHostEntry(ar); + GetHostEntryFinished->Set(); + } + + + // Determine the Internet Protocol(IP) addresses for this + // host asynchronously. +public: + static void DoGetHostEntryAsync(String^ hostName) + { + GetHostEntryFinished->Reset(); + ResolveState^ ioContext = gcnew ResolveState(hostName); + + Dns::BeginGetHostEntry(ioContext->host, + gcnew AsyncCallback(GetHostEntryCallback), ioContext); + // Wait here until the resolve completes + // (the callback calls .Set()) + GetHostEntryFinished->WaitOne(); + + Console::WriteLine("EndGetHostEntry({0}) returns:", ioContext->host); + + for (int i = 0; i < ioContext->IPs->AddressList->Length; i++) + { + Console::WriteLine(" {0}", ioContext->IPs->AddressList[i]->ToString()); + } + +// for each (IPAddress^ address in ioContext->IPs) +// { +// Console::WriteLine("{0} ", address); +// } + } +// +}; + +int main() +{ + DNSChanges::DoGetHostEntry("www.contoso.com"); + DNSChanges::DoGetHostEntry(IPAddress::Parse("127.0.0.1")); + DNSChanges::DoGetHostAddress("www.contoso.com"); + DNSChanges::DoGetHostEntryAsync(""); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp new file mode 100644 index 00000000000..5896e74c960 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest.GetResponse/CPP/getresponse.cpp @@ -0,0 +1,120 @@ + + +// +// This program contains examples for the following types and methods: +// System::Net::FileWebRequest::GetResponse; +// +// +// +// This program shows how to use the FileWebRequest::GetResponse method +// to read and display the content of a file passed by the user. +// Note. In order for this program to work, the folder containing the test file +// must be shared with its permissions set to allow read access. +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +ref class TestGetResponse +{ +private: + static FileWebResponse^ myFileWebResponse; + static void showUsage() + { + Console::WriteLine( "\nPlease enter file name:" ); + Console::WriteLine( "Usage: cs_getresponse //" ); + Console::WriteLine( "Example: cs_getresponse ndpue/temp/hello.txt" ); + } + + static bool makeFileRequest( String^ fileName ) + { + bool requestOk = false; + try + { + Uri^ myUrl = gcnew Uri( String::Format( "file://{0}", fileName ) ); + + // Create a Filewebrequest object using the passed Uri. + FileWebRequest^ myFileWebRequest = dynamic_cast(WebRequest::Create( myUrl )); + + // Get the FileWebResponse object. + myFileWebResponse = dynamic_cast(myFileWebRequest->GetResponse()); + requestOk = true; + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException: {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "UriFormatWebException: {0}", e->Message ); + } + + return requestOk; + } + + static void readFile() + { + try + { + + // Create the file stream. + Stream^ receiveStream = myFileWebResponse->GetResponseStream(); + + // Create a reader object to read the file content. + StreamReader^ readStream = gcnew StreamReader( receiveStream ); + + // Create a local buffer for a temporary storage of the + // read data. + array^readBuffer = gcnew array(256); + + // Read the first up to 256 bytes. + int count = readStream->Read( readBuffer, 0, 256 ); + Console::WriteLine( "The file content is:" ); + Console::WriteLine( "" ); + + // Loop to read the remaining bytes in 256 blocks + // and display the data on the console. + while ( count > 0 ) + { + String^ str = gcnew String( readBuffer,0,count ); + Console::WriteLine( "{0}\n", str ); + count = readStream->Read( readBuffer, 0, 256 ); + } + readStream->Close(); + + // Release the response object resources. + myFileWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "The WebException: {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "The UriFormatException: {0}", e->Message ); + } + + } + + +public: + static void Main() + { + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + showUsage(); + else + { + if ( makeFileRequest( args[ 1 ] ) ) + readFile(); + } + } + +}; + +int main() +{ + TestGetResponse::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp new file mode 100644 index 00000000000..0dc5fc9d3fe --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.FileWebRequest/CPP/getrequeststream.cpp @@ -0,0 +1,134 @@ + + +// +// This program contains examples for the following types and methods: +// System::Net::FileWebRequest (Snippet1); System::Net::FileWebRequest::Method (Snippet2); +// System::Net::FileWebRequest::Timeout (Snippet3); +// System::Net::FileWebRequest::ContentLength (Snippet4). +// System::Net::FileWebRequest::GetRequestStream (Snippet5); +// +// +// This program creates or open a text file in which it stores a string. +// Both file and string are passed by the user. +// Note. In order for this program to work, the folder containing the test file +// must be shared with its permissions set to allow write access. +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Net; +ref class TestGetRequestStream +{ +private: + static FileWebRequest^ myFileWebRequest; + static void showUsage() + { + Console::WriteLine( "\nPlease enter file name and timeout :" ); + Console::WriteLine( "Usage: cs_getrequeststream // timeout" ); + Console::WriteLine( "Example: cs_getrequeststream ndpue/temp/hello.txt 1000" ); + Console::WriteLine( "Small timeout values (for instance 3 or less) cause a timeout exception." ); + } + + static void makeFileRequest( String^ fileName, int timeout ) + { + try + { + + // + // + // Create a Uri object. + Uri^ myUrl = gcnew Uri( String::Format( "file://{0}", fileName ) ); + + // Create a FileWebRequest object. + myFileWebRequest = dynamic_cast(WebRequest::CreateDefault( myUrl )); + + // Set the timeout to the value selected by the user. + myFileWebRequest->Timeout = timeout; + + // + // Set the Method property to POST + myFileWebRequest->Method = "POST"; + + // + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException: {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "UriFormatWebException: {0}", e->Message ); + } + + } + + static void writeToFile() + { + try + { + + // + // Enter the string to write into the file. + Console::WriteLine( "Enter the string you want to write:" ); + String^ userInput = Console::ReadLine(); + + // Convert the string to Byte array. + ASCIIEncoding^ encoder = gcnew ASCIIEncoding; + array^byteArray = encoder->GetBytes( userInput ); + + // + // Set the ContentLength property. + myFileWebRequest->ContentLength = byteArray->Length; + String^ contentLength = myFileWebRequest->ContentLength.ToString(); + Console::WriteLine( "\nThe content length is {0}.", contentLength ); + + // + // Get the file stream handler to write into the file. + Stream^ readStream = myFileWebRequest->GetRequestStream(); + + // Write to the file stream. + // Note. In order for this to work the file must be accessible + // on the network. This can be accomplished by setting the property + // sharing of the folder containg the file. The permissions + // can be set so everyone can modify the file. + // FileWebRequest::Credentials property cannot be used for this purpose. + readStream->Write( byteArray, 0, userInput->Length ); + Console::WriteLine( "\nThe String you entered was successfully written into the file." ); + + // + readStream->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "The WebException: {0}", e->Message ); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "The UriFormatWebException: {0}", e->Message ); + } + + } + + +public: + static void Main() + { + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 3 ) + showUsage(); + else + { + makeFileRequest( args[ 1 ], Int32::Parse( args[ 2 ] ) ); + writeToFile(); + } + } + +}; + +int main() +{ + TestGetRequestStream::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp new file mode 100644 index 00000000000..826067e44c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IPv6NoneAnyLoopback/CPP/noneanyloopback.cpp @@ -0,0 +1,140 @@ +/** +* File name: ipaddress_none_any_loopback.cs +* Exercise the IPAddress IPv6None, IPv6Any, and IPv6Loopback properties. +* Usage: cs_nal.exe. +**/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +// +// This method displays the value of the current host loopback address in +// standard compressed format. +void displayIPv6LoopBackAddress() +{ + try + { + // Get the loopback address. + IPAddress^ loopBack = IPAddress::IPv6Loopback; + + // Transform the loop-back address to a string using the overladed + // ToString() method. Note that the resulting string is in the compact + // form: "::1". + String^ ipv6LoopBack = loopBack->ToString(); + Console::WriteLine( "The IPv6 Loopback address is: {0}", ipv6LoopBack ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "->Item[displayIPv6LoopBackAddress] Exception: {0}", e ); + } +} +// + +// +// This method displays the value of the current host's Any address in +// standard compressed format. The Any address is used by the host to enable +// listening to client activities on all the interfaces for a given port. +void displayIPv6AnyAddress() +{ + try + { + // Get the Any address. + IPAddress^ any = IPAddress::IPv6Any; + + // Transform the Any address to a string using the overloaded + // ToString() method. Note that the resulting string is in the compact + // form: "::". + String^ ipv6Any = any->ToString(); + + // Display the Any address. + Console::WriteLine( "The IPv6 Any address is: {0}", ipv6Any ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "->Item[displayIPv6AnyAddress] Exception: {0}", e ); + } +} +// + +// +// This method displays the value of the current host's None address in +// standard compressed format. The None address is used by the host to disable +// listening to client activities on all the interfaces. +void displayIPv6NoneAddress() +{ + try + { + // Get the None address. + IPAddress^ none = IPAddress::IPv6None; + + // Transform the None address to a string using the overloaded + // ToString() method. Note that the resulting string is in the compact + // form: "::". + String^ ipv6None = none->ToString(); + + Console::WriteLine( "The IPv6 None address is: {0}", ipv6None ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "->Item[displayIPv6NoneAddress] Exception: {0}", e ); + } +} +// + +// +// This function checks whether the passed string represents a loop-back address. +void checkIPv6LoopBackAddress( String^ ipAddress ) +{ + try + { + // Parse the passed String* to obtain the internal address + // representation. + IPAddress^ loopBack = IPAddress::Parse( ipAddress ); + + // Verify that the address is a loopback address. + bool isLoopBack = IPAddress::IsLoopback( loopBack ); + + // Build the message. + String^ msg; + if ( isLoopBack ) + { + msg = " is a loop back address."; + } + else + { + msg = " is not a loop back address."; + } + + // Display the results. + Console::WriteLine( String::Concat( ipAddress, msg ) ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "->Item[displayIPv6LoopBackAddress] Exception: {0}", e ); + } +} +// + +int main() +{ + // Verify that the current host supports IPv6 and also call WSAStartup. + // If you do not use any IPv6 methods that call WSAStartup, you will get a + // SocketException when using IPv6Loopback, IPv6Any or IPv6None. + + bool ipv6Supported = Socket::SupportsIPv6; + + // Display current host Loopback address. + displayIPv6LoopBackAddress(); + + // Display the current host's Any address. + displayIPv6AnyAddress(); + + // Display the current host's None address. + displayIPv6NoneAddress(); + + // Check that this is a loopback address. + checkIPv6LoopBackAddress( "0::1" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp new file mode 100644 index 00000000000..8c206f281c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.IsLoopback/CPP/isloopback.cpp @@ -0,0 +1,75 @@ + + +/* +This program checks whether the specified address is a loopback address. +It invokes the IPAddress Parse method to translate the address +input String* into the correct internal format. +The IP address String* must be in dotted-quad notation for IPv4 or in +colon-hexadecimal notation for IPv6. +*/ +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; + +// This method calls the IPAddress::Parse method to check if the +// passed ipAddress parameter is in the correct format. +// Then it checks whether it represents a loopback address. +// Finally, it displays the results. +void parse( String^ ipAddress ) +{ + String^ loopBack = " is not a loopback address."; + try + { + + // Perform syntax check by parsing the address string entered by the user. + IPAddress^ address = IPAddress::Parse( ipAddress ); + + // Perform semantic check by verifying that the address is a valid IPv4 + // or IPv6 loopback address. + if ( IPAddress::IsLoopback( address ) && address->AddressFamily == AddressFamily::InterNetworkV6 ) + loopBack = String::Concat( " is an IPv6 loopback address whose internal format is: ", address, "." ); + else + if ( IPAddress::IsLoopback( address ) && address->AddressFamily == AddressFamily::InterNetwork ) + loopBack = String::Concat( " is an IPv4 loopback address whose internal format is: ", address, "." ); + + // Display the results. + Console::WriteLine( "Your input address: \" {0} \" {1}", ipAddress, loopBack ); + } + catch ( FormatException^ e ) + { + Console::WriteLine( "FormatException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length == 1 ) + { + + // No parameters entered. Display program usage. + Console::WriteLine( "Please enter an IP address." ); + Console::WriteLine( "Usage: >ipaddress_isloopback any IPv4 or IPv6 address." ); + Console::WriteLine( "Example: >ipaddress_isloopback 127.0.0.1" ); + Console::WriteLine( "Example: >ipaddress_isloopback 0:0:0:0:0:0:0:1" ); + } + else + parse( args[ 1 ] ); + + + // Parse the address string entered by the user. +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp new file mode 100644 index 00000000000..e6b401756d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress.Parse/CPP/parse.cpp @@ -0,0 +1,73 @@ + + +/* +This program converts a String* containing an IP address, in dotted-quad notation for +IPv4 or in colon-hexadecimal for IPv6, into an instance of the IPAddress class. +Then it uses the overloaded IPAddress ToString method to display the address in +its standard notation. +*/ +// +#using + +using namespace System; +using namespace System::Net; + +// This method calls the IPAddress::Parse method to check the ipAddress +// input string. If the ipAddress argument represents a syntatically correct IPv4 or +// IPv6 address, the method displays the Parse output into quad-notation or +// colon-hexadecimal notation, respectively. Otherwise, it displays an +// error message. +void parse( String^ ipAddress ) +{ + try + { + + // Create an instance of IPAddress for the specified address string (in + // dotted-quad, or colon-hexadecimal notation). + IPAddress^ address = IPAddress::Parse( ipAddress ); + + // Display the address in standard notation. + Console::WriteLine( "Parsing your input string: \"{0}\" produces this address (shown in its standard notation): {1}", ipAddress, address ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( FormatException^ e ) + { + Console::WriteLine( "FormatException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + String^ IPaddress; + if ( args->Length == 1 ) + { + Console::WriteLine( "Please enter an IP address." ); + Console::WriteLine( "Usage: >cs_parse any IPv4 or IPv6 address." ); + Console::WriteLine( "Example: >cs_parse 127.0.0.1" ); + Console::WriteLine( "Example: >cs_parse 0:0:0:0:0:0:0:1" ); + return 0; + } + else + IPaddress = args[ 1 ]; + + + // Get the list of the IPv6 addresses associated with the requested host. + parse( IPaddress ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp new file mode 100644 index 00000000000..8aa6b94aeb4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPAddress/CPP/ipaddress.cpp @@ -0,0 +1,142 @@ + + +// +// File name: ipaddress.cpp +// The snippets contained here apply to: +// 1) System.Net.IPAddress.AddressFamily, snippet3. +// 2) System.Net.IPAddess.ScopeId, snippet3. +// more +// +// +// This program shows how to use the IPAddress class to obtain a server +// IP addressess and related information. +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text::RegularExpressions; + +/** +* The IPAddresses method obtains the selected server IP address information. +* It then displays the type of address family supported by the server and its +* IP address in standard and byte format. +**/ +void IPAddresses( String^ server ) +{ + try + { + System::Text::ASCIIEncoding^ ASCII = gcnew System::Text::ASCIIEncoding; + + // Get server related information. + IPHostEntry^ heserver = Dns::GetHostEntry( server ); + + // Loop on the AddressList + System::Collections::IEnumerator^ myEnum = heserver->AddressList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + IPAddress^ curAdd = safe_cast(myEnum->Current); + + // + // Display the type of address family supported by the server. If the + // server is IPv6-enabled this value is: InterNetworkV6. If the server + // is also IPv4-enabled there will be an additional value of InterNetwork. + Console::WriteLine( "AddressFamily: {0}", curAdd->AddressFamily ); + + // Display the ScopeId property in case of IPV6 addresses. + if ( curAdd->AddressFamily.ToString() == ProtocolFamily::InterNetworkV6.ToString() ) + Console::WriteLine( "Scope Id: {0}", curAdd->ScopeId ); + // + + // Display the server IP address in the standard format. In + // IPv4 the format will be dotted-quad notation, in IPv6 it will be + // in in colon-hexadecimal notation. + Console::WriteLine( "Address: {0}", curAdd ); + + // Display the server IP address in byte format. + Console::Write( "AddressBytes: " ); + + // + array^bytes = curAdd->GetAddressBytes(); + for ( int i = 0; i < bytes->Length; i++ ) + { + Console::Write( bytes[ i ] ); + + } + // + + Console::WriteLine( "\r\n" ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "[DoResolve] Exception: {0}", e ); + } + +} + + +// This IPAddressAdditionalInfo displays additional server address information. +void IPAddressAdditionalInfo() +{ + try + { + // Display the flags that show if the server supports IPv4 or IPv6 + // address schemas. + Console::WriteLine( "\r\nSupportsIPv4: {0}", Socket::SupportsIPv4 ); + Console::WriteLine( "SupportsIPv6: {0}", Socket::SupportsIPv6 ); + if ( Socket::SupportsIPv6 ) + { + // Display the server Any address. This IP address indicates that the server + // should listen for client activity on all network interfaces. + Console::WriteLine( "\r\nIPv6Any: {0}", IPAddress::IPv6Any ); + + // Display the server loopback address. + Console::WriteLine( "IPv6Loopback: {0}", IPAddress::IPv6Loopback ); + + // Used during autoconfiguration first phase. + Console::WriteLine( "IPv6None: {0}", IPAddress::IPv6None ); + Console::WriteLine( "IsLoopback(IPv6Loopback): {0}", IPAddress::IsLoopback( IPAddress::IPv6Loopback ) ); + } + Console::WriteLine( "IsLoopback(Loopback): {0}", IPAddress::IsLoopback( IPAddress::Loopback ) ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "[IPAddresses] Exception: {0}", e ); + } + +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + String^ server = nullptr; + + // Define a regular expression to parse user's input. + // This is a security check. It allows only + // alphanumeric input string between 2 to 40 character long. + Regex^ rex = gcnew Regex( "^[a-zA-Z]\\w{1,39}$" ); + if ( args->Length < 2 ) + { + // If no server name is passed as an argument to this program, use the current + // server name as default. + server = Dns::GetHostName(); + Console::WriteLine( "Using current host: {0}", server ); + } + else + { + server = args[ 1 ]; + if ( !(rex->Match(server))->Success ) + { + Console::WriteLine( "Input string format not allowed." ); + return -1; + } + } + + // Get the list of the addresses associated with the requested server. + IPAddresses( server ); + + // Get additional address information. + IPAddressAdditionalInfo(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp new file mode 100644 index 00000000000..ddd7bf4588d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.IPEndPoint/CPP/ipendpoint.cpp @@ -0,0 +1,230 @@ + + +// File name:ipendpoint.cs. +// +// This program contains snippets applicable to the following: +// System.Net.IPEndPoint (Snippet1); +// System.Net.IPEndPoint.IPEndPoint(IPAddress, int) (Snippet2); +// System.Net.IPEndPoint.Address (Snippet3); +// System.Net.IPEndPoint.AddressFamily (Snippet3); +// System.Net.IPEndPoint.Port (Snippet3); +// System.Net.IPEndPoint.Serialize (Snippet4); +// System.Net.IPEndPoint.Create (Snippet5); +// +// +// This example uses the IPEndPoint class and its members to display the home page +// of the server selected by the user. +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text::RegularExpressions; + +// The getPage function gets the server's home page content by +// recreating the server's endpoint from the original serialized endpoint. +// Then it creates a new socket and connects it to the endpoint. +String^ getPage( String^ server, SocketAddress^ socketAddress ) +{ + //Set up variables and string to write to the server. + Encoding^ ASCII = Encoding::ASCII; + String^ Get = String::Format( "GET / HTTP/1.1\r\nHost: {0}\r\nConnection: Close\r\n\r\n", server ); + array^ByteGet = ASCII->GetBytes( Get ); + array^RecvBytes = gcnew array(256); + String^ strRetPage = nullptr; + Socket^ socket = nullptr; + + // + // Recreate the connection endpoint from the serialized information. + IPEndPoint^ endpoint = gcnew IPEndPoint( (__int64)0,0 ); + IPEndPoint^ clonedIPEndPoint = dynamic_cast(endpoint->Create( socketAddress )); + Console::WriteLine( "clonedIPEndPoint: {0}", clonedIPEndPoint ); + // + + Console::WriteLine( "Press any key to continue." ); + Console::ReadLine(); + try + { + // Create a socket object to establish a connection with the server. + socket = gcnew Socket( endpoint->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); + + // Connect to the cloned end point. + socket->Connect( clonedIPEndPoint ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + + if ( socket == nullptr ) + return ("Connection to cloned endpoint failed"); + + // Send request to the server. + socket->Send( ByteGet, ByteGet->Length, static_cast(0) ); + + // Receive the server home page content. + Int32 bytes = socket->Receive( RecvBytes, RecvBytes->Length, static_cast(0) ); + + // Read the first 256 bytes. + strRetPage = String::Format( "Default HTML page on {0}:\r\n", server ); + strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); + while ( bytes > 0 ) + { + bytes = socket->Receive( RecvBytes, RecvBytes->Length, static_cast(0) ); + strRetPage = String::Concat( strRetPage, ASCII->GetString( RecvBytes, 0, bytes ) ); + } + + socket->Close(); + return strRetPage; +} + +// +// The serializeEndpoint function serializes the endpoint and returns the +// SocketAddress containing the serialized endpoint data. +SocketAddress^ serializeEndpoint( IPEndPoint^ endpoint ) +{ + // Serialize IPEndPoint details to a SocketAddress instance. + SocketAddress^ socketAddress = endpoint->Serialize(); + + // Display the serialized endpoint information. + Console::WriteLine( "Endpoint.Serialize() : {0}", socketAddress ); + Console::WriteLine( "Socket->Family : {0}", socketAddress->Family ); + Console::WriteLine( "Socket->Size : {0}", socketAddress->Size ); + Console::WriteLine( "Press any key to continue." ); + Console::ReadLine(); + return socketAddress; +} +// + +// +void displayEndpointInfo( IPEndPoint^ endpoint ) +{ + Console::WriteLine( "Endpoint->Address : {0}", endpoint->Address ); + Console::WriteLine( "Endpoint->AddressFamily : {0}", endpoint->AddressFamily ); + Console::WriteLine( "Endpoint->Port : {0}", endpoint->Port ); + Console::WriteLine( "Endpoint.ToString() : {0}", endpoint ); + Console::WriteLine( "Press any key to continue." ); + Console::ReadLine(); +} +// + +// The serializeEndpoint function determines the server endpoint and then +// serializes it to obtain the related SocketAddress object. +// Note that in the for loop a temporary socket is created to ensure that +// the current IP address format matches the AddressFamily type. +// In fact, in the case of servers supporting both IPv4 and IPv6, an exception +// may arise if an IP address format does not match the address family type. +SocketAddress^ getSocketAddress( String^ server, int port ) +{ + Socket^ tempSocket = nullptr; + IPHostEntry^ host = nullptr; + SocketAddress^ serializedSocketAddress = nullptr; + try + { + // Get the object containing Internet host information. + host = Dns::Resolve( server ); + + // + // Obtain the IP address from the list of IP addresses associated with the server. + System::Collections::IEnumerator^ myEnum = host->AddressList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + IPAddress^ address = safe_cast(myEnum->Current); + IPEndPoint^ endpoint = gcnew IPEndPoint( address,port ); + tempSocket = gcnew Socket( endpoint->AddressFamily,SocketType::Stream,ProtocolType::Tcp ); + tempSocket->Connect( endpoint ); + if ( tempSocket->Connected ) + { + // Display the endpoint information. + displayEndpointInfo( endpoint ); + + // Serialize the endpoint to obtain a SocketAddress object. + serializedSocketAddress = serializeEndpoint( endpoint ); + break; + } + else + continue; + } + // + + // Close the temporary socket. + tempSocket->Close(); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + + return serializedSocketAddress; +} + + +// The requestServerHomePage function obtains the server's home page and returns +// its content. +String^ requestServerHomePage( String^ server, int port ) +{ + String^ strRetPage = nullptr; + + // Get a socket address using the specified server and port. + SocketAddress^ socketAddress = getSocketAddress( server, port ); + if ( socketAddress == nullptr ) + strRetPage = "Connection failed"; // Obtain the server's home page content. + else + strRetPage = getPage( server, socketAddress ); + + return strRetPage; +} + + +// Show to the user how to use this program when wrong input parameters are entered. +void showUsage() +{ + Console::WriteLine( "Enter the server name as follows:" ); + Console::WriteLine( "\tcs_ipendpoint servername" ); +} + + +// This is the program entry point. It allows the user to enter +// a server name that is used to locate its current homepage. +int main() +{ + array^args = Environment::GetCommandLineArgs(); + String^ host = nullptr; + int port = 80; + + // Define a regular expression to parse user's input. + // This is a security check. It allows only + // alphanumeric input string between 2 to 40 character long. + Regex^ rex = gcnew Regex( "^[a-zA-Z]\\w{1,39}$" ); + if ( args->Length < 2 ) + showUsage(); + else + { + String^ message = args[ 1 ]; + if ( (rex->Match(message))->Success ) + { + host = args[ 1 ]; + + // Get the specified server home_page and display its content. + String^ result = requestServerHomePage( host, port ); + Console::WriteLine( result ); + } + else + Console::WriteLine( "Input string format not allowed." ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp new file mode 100644 index 00000000000..1adf2104e7e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePoint/CPP/servicepoint.cpp @@ -0,0 +1,203 @@ + + +// +// This example shows how to use the ServicePoint and ServicePointManager classes. +// The ServicePointManager class uses the ServicePoint class to manage connections +// to a remote host. The networking classes reuse service points for all +// requests to a given URI. In fact, the same ServicePoint object +// is used to issue requests to Internet resources identified by the same +// scheme identifier (for example, HTTP) and host fragment (for example, www.contoso.com). +// This should improve your application performance. +// Reusing service points in this way can help improve application performance. +#using + +using namespace System; +using namespace System::Net; +using namespace System::Threading; +using namespace System::Text::RegularExpressions; +void ShowProperties( ServicePoint^ sp ) +{ + Console::WriteLine( "Done calling FindServicePoint()..." ); + + // + // Display the ServicePoint Internet resource address. + Console::WriteLine( "Address = {0}", sp->Address ); + + // + // + // Display the date and time that the ServicePoint was last + // connected to a host. + Console::WriteLine( "IdleSince = {0}", sp->IdleSince ); + + // Display the maximum length of time that the ServicePoint instance + // is allowed to maintain an idle connection to an Internet + // resource before it is recycled for use in another connection. + Console::WriteLine( "MaxIdleTime = {0}", sp->MaxIdleTime ); + + // + // + Console::WriteLine( "ConnectionName = {0}", sp->ConnectionName ); + + // Display the maximum number of connections allowed on this + // ServicePoint instance. + Console::WriteLine( "ConnectionLimit = {0}", sp->ConnectionLimit ); + + // Display the number of connections associated with this + // ServicePoint instance. + Console::WriteLine( "CurrentConnections = {0}", sp->CurrentConnections ); + + // + // + if ( sp->Certificate == nullptr ) + Console::WriteLine( "Certificate = (null)" ); + else + Console::WriteLine( "Certificate = {0}", sp->Certificate ); + + if ( sp->ClientCertificate == nullptr ) + Console::WriteLine( "Client Certificate = (null)" ); + else + Console::WriteLine( "Client Certificate = {0}", sp->ClientCertificate ); + + Console::WriteLine( "ProtocolVersion = {0}", sp->ProtocolVersion->ToString() ); + Console::WriteLine( "SupportsPipelining = {0}", sp->SupportsPipelining ); + + // + // + Console::WriteLine( "UseNagleAlgorithm = {0} ", sp->UseNagleAlgorithm.ToString() ); + Console::WriteLine( "Expect 100-continue = {0}", sp->Expect100Continue.ToString() ); + + // +} + + +// +void makeWebRequest( int hashCode, String^ Uri ) +{ + HttpWebResponse^ res = nullptr; + + // Make sure that the idle time has elapsed, so that a new + // ServicePoint instance is created. + Console::WriteLine( "Sleeping for 2 sec." ); + Thread::Sleep( 2000 ); + try + { + + // Create a request to the passed URI. + HttpWebRequest^ req = dynamic_cast(WebRequest::Create( Uri )); + Console::WriteLine( "\nConnecting to {0} ............", Uri ); + + // Get the response object. + res = dynamic_cast(req->GetResponse()); + Console::WriteLine( "Connected.\n" ); + ServicePoint^ currentServicePoint = req->ServicePoint; + + // Display new service point properties. + int currentHashCode = currentServicePoint->GetHashCode(); + Console::WriteLine( "New service point hashcode: {0}", currentHashCode ); + Console::WriteLine( "New service point max idle time: {0}", currentServicePoint->MaxIdleTime ); + Console::WriteLine( "New service point is idle since {0}", currentServicePoint->IdleSince ); + + // Check that a new ServicePoint instance has been created. + if ( hashCode == currentHashCode ) + Console::WriteLine( "Service point reused." ); + else + Console::WriteLine( "A new service point created." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + finally + { + if ( res != nullptr ) + res->Close(); + } + +} + + +// +// Show the user how to use this program when wrong inputs are entered. +void showUsage() +{ + Console::WriteLine( "Enter the proxy name as follows:" ); + Console::WriteLine( "\tcs_servicepoint proxyName" ); +} + + +// +int main() +{ + array^args = Environment::GetCommandLineArgs(); + int port = 80; + + // Define a regular expression to parse the user's input. + // This is a security check. It allows only + // alphanumeric input strings between 2 to 40 characters long. + Regex^ rex = gcnew Regex( "^[a-zA-Z]\\w{1,39}$" ); + if ( args->Length < 2 ) + { + showUsage(); + return -1; + } + + String^ proxy = args[ 1 ]; + if ( (!rex->Match(proxy))->Success) + { + Console::WriteLine( "Input string format not allowed." ); + return -1; + } + + String^ proxyAdd = String::Format( "http://{0}:{1}", proxy, port ); + + // Create a proxy object. + WebProxy^ DefaultProxy = gcnew WebProxy( proxyAdd,true ); + + // Set the proxy that all HttpWebRequest instances use. + WebRequest::DefaultWebProxy = DefaultProxy; + + // Get the base interface for proxy access for the + // WebRequest-based classes. + IWebProxy^ Iproxy = WebRequest::DefaultWebProxy; + + + // + // Set the maximum number of ServicePoint instances to + // maintain. If a ServicePoint instance for that host already + // exists when your application requests a connection to + // an Internet resource, the ServicePointManager object + // returns this existing ServicePoint instance. If none exists + // for that host, it creates a new ServicePoint instance. + ServicePointManager::MaxServicePoints = 4; + + // Set the maximum idle time of a ServicePoint instance to 10 seconds. + // After the idle time expires, the ServicePoint object is eligible for + // garbage collection and cannot be used by the ServicePointManager. + ServicePointManager::MaxServicePointIdleTime = 10000; + + // + // + ServicePointManager::UseNagleAlgorithm = true; + ServicePointManager::Expect100Continue = true; + ServicePointManager::CheckCertificateRevocationList = true; + ServicePointManager::DefaultConnectionLimit = ServicePointManager::DefaultPersistentConnectionLimit; + + // + // Create the Uri object for the resource you want to access. + Uri^ MS = gcnew Uri( "http://msdn.microsoft.com/" ); + + // Use the FindServicePoint method to find an existing + // ServicePoint object or to create a new one. + ServicePoint^ servicePoint = ServicePointManager::FindServicePoint( MS, Iproxy ); + ShowProperties( servicePoint ); + int hashCode = servicePoint->GetHashCode(); + Console::WriteLine( "Service point hashcode: {0}", hashCode ); + + // Make a request with the same scheme identifier and host fragment + // used to create the previous ServicePoint object. + makeWebRequest( hashCode, "http://msdn.microsoft.com/library/" ); +} + +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp new file mode 100644 index 00000000000..71b43149394 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.ServicePointWhidbey/cpp/servicepoint.cpp @@ -0,0 +1,241 @@ +// This example shows how to use the ServicePoint and ServicePointManager classes. +// The ServicePointManager class uses the ServicePoint class to manage connections +// to a remote host. The networking classes reuse service points for all +// requests to a given URI. In fact, the same ServicePoint object +// is used to issue requests to Internet resources identified by the same +// scheme identifier (for example, HTTP) and host fragment (for example, www.contoso.com). +// This should improve your application performance. +// Reusing service points in this way can help improve application performance. +#using + +using namespace System; +using namespace System::Security; +using namespace System::Net; +using namespace System::Threading; +using namespace System::Text::RegularExpressions; + +void ShowProperties(ServicePoint^ service) +{ + Console::WriteLine("Done calling FindServicePoint()..."); + + // Display the ServicePoint Internet resource address. + Console::WriteLine("Address = {0} ", service->Address); + + // Display the date and time that the ServicePoint was last + // connected to a host. + Console::WriteLine("IdleSince = {0}", service->IdleSince); + + // Display the maximum length of time that the ServicePoint + // instance is allowed to maintain an idle connection to an + // Internet resource before it is recycled for use in another + // connection. + Console::WriteLine("MaxIdleTime = {0}", service->MaxIdleTime); + + Console::WriteLine("ConnectionName = {0}", + service->ConnectionName); + + // Display the maximum number of connections allowed on this + // ServicePoint instance. + Console::WriteLine("ConnectionLimit = {0}", + service->ConnectionLimit); + + // Display the number of connections associated with this + // ServicePoint instance. + Console::WriteLine("CurrentConnections = {0}", + service->CurrentConnections); + + if (service->Certificate == nullptr) + { + Console::WriteLine("Certificate = (null)"); + } + else + { + Console::WriteLine("Certificate = {0}", service->Certificate); + } + + if (service->ClientCertificate == nullptr) + { + Console::WriteLine("ClientCertificate = (null)"); + } + else + { + Console:: WriteLine("ClientCertificate = {0}", + service->ClientCertificate); + } + + Console::WriteLine("ProtocolVersion = {0}", + service->ProtocolVersion); + Console::WriteLine("SupportsPipelining = {0}", + service->SupportsPipelining); + + Console::WriteLine("UseNagleAlgorithm = {0}", + service->UseNagleAlgorithm.ToString()); + Console::WriteLine("Expect 100-continue = {0}", + service->Expect100Continue.ToString()); +} + +void MakeWebRequest(int hashCode, String^ requestedUri) +{ + HttpWebResponse^ response = nullptr; + + // Make sure that the idle time has elapsed, so that a new + // ServicePoint instance is created. + Console::WriteLine("Sleeping for 2 sec."); + Thread::Sleep(2000); + try + { + // Create a request to the passed URI. + HttpWebRequest^ request = + (HttpWebRequest^)WebRequest::Create(requestedUri); + + Console::WriteLine("\nConnecting to {0} ............", + requestedUri); + + // Get the response object. + response = (HttpWebResponse^) request->GetResponse(); + Console::WriteLine("Connected.\n"); + + ServicePoint^ currentServicePoint = request->ServicePoint; + + // Display new service point properties. + int currentHashCode = currentServicePoint->GetHashCode(); + + Console::WriteLine("New service point hashcode: {0}", + currentHashCode); + Console::WriteLine("New service point max idle time: {0}", + currentServicePoint->MaxIdleTime); + Console::WriteLine("New service point is idle since {0}", + currentServicePoint->IdleSince ); + + // Check that a new ServicePoint instance has been created. + if (hashCode == currentHashCode) + { + Console::WriteLine("Service point reused."); + } + else + { + Console::WriteLine("A new service point created.") ; + } + + } + catch (NotSupportedException^ ex) + { + Console::WriteLine( + "The request scheme specified in {0} has not been registered.", + requestedUri); + Console::WriteLine("Source : {0}", ex->Source); + Console::WriteLine("Message : {0}", ex->Message); + } + catch (SecurityException^ ex) + { + Console::WriteLine( + "You do not have permission to connect to {0}.", + requestedUri); + Console::WriteLine("Source : {0}", ex->Source); + Console::WriteLine("Message : {0}", ex->Message); + } + catch (UriFormatException^ ex) + { + Console::WriteLine( + "The URI specified in {0} is not a valid URI.", + requestedUri); + Console::WriteLine("Source : {0}", ex->Source); + Console::WriteLine("Message : {0}", ex->Message); + } + catch (WebException^ ex) + { + Console::WriteLine("The proxy name could not be resolved."); + Console::WriteLine("Source : {0}", ex->Source); + Console::WriteLine("Message : {0}", ex->Message); + } + finally + { + if (response != nullptr) + { + response->Close(); + } + } +} + +// Show the user how to use this program when wrong inputs are entered. +void ShowUsage() +{ + Console::WriteLine("Enter the proxy name as follows:"); + Console::WriteLine("\tcs_servicepoint proxyName"); +} + + +int main(array^ args) +{ + int port = 80; + + // Define a regular expression to parse the user's input. + // This is a security check. It allows only + // alphanumeric input strings between 2 to 40 characters long. + Regex^ expression = gcnew Regex("^[a-zA-Z]\\w{1,39}$"); + + if (args->Length <= 1) + { + ShowUsage(); + return 0; + } + String^ proxy = args[1]; + + if (!(expression->Match(proxy))->Success) + { + Console::WriteLine("Input string format not allowed."); + return 0; + } + String^ proxyAddress = "http://" + proxy + ":" + port; + + // Create a proxy object. + WebProxy^ defaultProxy = gcnew WebProxy(proxyAddress, true); + + // Set the proxy that all HttpWebRequest instances use. + GlobalProxySelection::Select = (IWebProxy^)defaultProxy; + + // Get the base interface for proxy access for the + // WebRequest-based classes. + IWebProxy^ proxyInterface = GlobalProxySelection::Select; + + // Set the maximum number of ServicePoint instances to + // maintain. If a ServicePoint instance for that host already + // exists when your application requests a connection to + // an Internet resource, the ServicePointManager object + // returns this existing ServicePoint instance. If none exists + // for that host, it creates a new ServicePoint instance. + ServicePointManager::MaxServicePoints = 4; + + // Set the maximum idle time of a ServicePoint instance to 10 seconds. + // After the idle time expires, the ServicePoint object is eligible for + // garbage collection and cannot be used by the ServicePointManager object. + ServicePointManager::MaxServicePointIdleTime = 10000; + + // + ServicePointManager::UseNagleAlgorithm = true; + ServicePointManager::Expect100Continue = true; + ServicePointManager::CheckCertificateRevocationList = true; + ServicePointManager::DefaultConnectionLimit = + ServicePointManager::DefaultPersistentConnectionLimit; + ServicePointManager::EnableDnsRoundRobin = true; + ServicePointManager::DnsRefreshTimeout = 4*60*1000; // 4 minutes + // + // Create the Uri object for the resource you want to access. + Uri^ msdn = gcnew Uri("http://msdn.microsoft.com/"); + + // Use the FindServicePoint method to find an existing + // ServicePoint object or to create a new one. + ServicePoint^ servicePoint = ServicePointManager::FindServicePoint( + msdn, proxyInterface); + + ShowProperties(servicePoint); + + int hashCode = servicePoint->GetHashCode(); + + Console::WriteLine("Service point hashcode: {0}", hashCode); + + // Make a request with the same scheme identifier and host fragment + // used to create the previous ServicePoint object. + MakeWebRequest(hashCode, "http://msdn.microsoft.com/library/"); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp new file mode 100644 index 00000000000..b9d8ca6d7bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Authentication/CPP/custombasicauthentication.cpp @@ -0,0 +1,344 @@ + + +// This program shows how to create your own Basic authentication module, +// register it via the AuthenticationManager class and authorize allowed +// users to access a page on a Web site. +// Note: In order to run this program you must create a test Web site that performs +// Basic authentication. Also you must add to your server machine a user whose +// credentials are the same you plan to use for this example. +// CAVEAT: Basic authenticastion sends the user's credentials over HTTP. Passwords and +// user names are encoded using Base64 encoding. Although the password is encoded, it +// is considered insecure due its ability to be deciphered relatively easily. +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Collections; + +// +// The CustomBasic class creates a custom Basic authentication by implementing the +// IAuthenticationModule interface. In particular it performs the following +// tasks: +// 1) Defines and intializes the required properties. +// 2) Impements the Authenticate and PreAuthenticate methods. +public ref class CustomBasic: public IAuthenticationModule +{ +private: + + // + String^ m_authenticationType; + bool m_canPreAuthenticate; + +public: + + // The CustomBasic constructor initializes the properties of the customized + // authentication. + CustomBasic() + { + m_authenticationType = "Basic"; + m_canPreAuthenticate = false; + } + + + property String^ AuthenticationType + { + + // Define the authentication type. This type is then used to identify this + // custom authentication module. The default is set to Basic. + virtual String^ get() + { + return m_authenticationType; + } + + } + + property bool CanPreAuthenticate + { + + // Define the pre-authentication capabilities for the module. The default is set + // to false. + virtual bool get() + { + return m_canPreAuthenticate; + } + + } + + // + // The checkChallenge method checks if the challenge sent by the HttpWebRequest + // contains the correct type (Basic) and the correct domain name. + // Note: the challenge is in the form BASIC REALM="DOMAINNAME" + // and you must assure that the Internet Web site resides on a server whose + // domain name is equal to DOMAINAME. + bool checkChallenge( String^ Challenge, String^ domain ) + { + bool challengePasses = false; + String^ tempChallenge = Challenge->ToUpper(); + + // Verify that this is a Basic authorization request and the requested domain + // is correct. + // Note: When the domain is an empty string the following code only checks + // whether the authorization type is Basic. + if ( tempChallenge->IndexOf( "BASIC" ) != -1 ) + if ( domain != String::Empty ) + if ( tempChallenge->IndexOf( domain->ToUpper() ) != -1 ) + challengePasses = true; // The domain is not allowed and the authorization type is Basic. + else + challengePasses = false; + + else + challengePasses = true; + + + return challengePasses; + } + + + // + // The PreAuthenticate method specifies if the authentication implemented + // by this class allows pre-authentication. + // Even if you do not use it, this method must be implemented to obey to the rules + // of interface implemebtation. + // In this case it always returns false. + virtual Authorization^ PreAuthenticate( WebRequest^ /*request*/, ICredentials^ /*credentials*/ ) + { + return nullptr; + } + + + // + // + // Authenticate is the core method for this custom authentication. + // When an internet resource requests authentication, the WebRequest.GetResponse + // method calls the AuthenticationManager.Authenticate method. This method, in + // turn, calls the Authenticate method on each of the registered authentication + // modules, in the order they were registered. When the authentication is + // complete an Authorization object is returned to the WebRequest, as the + // retunr type of the following routine shows. + virtual Authorization^ Authenticate( String^ challenge, WebRequest^ request, ICredentials^ credentials ) + { + Encoding^ ASCII = Encoding::ASCII; + + // Get the username and password from the credentials + NetworkCredential^ MyCreds = credentials->GetCredential( request->RequestUri, "Basic" ); + if ( PreAuthenticate( request, credentials ) == nullptr ) + Console::WriteLine( "\n Pre-authentication is not allowed." ); + else + Console::WriteLine( "\n Pre-authentication is allowed." ); + + + // Verify that the challenge satisfies the authorization requirements. + bool challengeOk = checkChallenge( challenge, MyCreds->Domain ); + if ( !challengeOk ) + return nullptr; + + + // + // Create the encrypted string according to the Basic authentication format as + // follows: + // a)Concatenate username and password seperated by colon; + // b)Apply ASCII encoding to obtain a stream of bytes; + // c)Apply Base64 Encoding to this array of bytes to obtain the encoded + // authorization. + String^ BasicEncrypt = String::Concat( MyCreds->UserName, ":", MyCreds->Password ); + String^ BasicToken = String::Format( "Basic {0}", Convert::ToBase64String( ASCII->GetBytes( BasicEncrypt ) ) ); + + // Create an Authorization object using the above encoded authorization. + Authorization^ resourceAuthorization = gcnew Authorization( BasicToken ); + + // Get the Message property which contains the authorization string that the + // client returns to the server when accessing protected resources. + Console::WriteLine( "\n Authorization Message:{0}", resourceAuthorization->Message ); + + // Get the Complete property which is set to true when the authentication process + // between the client and the server is finished. + Console::WriteLine( "\n Authorization Complete:{0}", resourceAuthorization->Complete ); + Console::WriteLine( "\n Authorization ConnectionGroupId:{0}", resourceAuthorization->ConnectionGroupId ); + + // + return resourceAuthorization; + } + + // +}; + + +// +// The ClientAuthentication performs the following main tasks: +// 1) It obtains the user's credentials. +// 2) Unregisters the standard Basic authentication. +// 3) Registers the customized Basic authentication. +// 4) Read the selected page and displays it on the console. +ref class ClientAuthentication +{ +private: + static String^ username; + static String^ password; + static String^ domain; + static String^ uri; + + // Show how to use this program. + static void showusage() + { + Console::WriteLine( "Attempts to authenticate to a URL" ); + Console::WriteLine( "\r\nUse one of the following:" ); + Console::WriteLine( "\tcustomBasicAuthentication URL username password domain" ); + Console::WriteLine( "\tcustomBasicAuthentication URL username password" ); + Console::WriteLine( "\r\nExample:" ); + Console::WriteLine( "\tcustomBasicAuthentication http://ndpue/ncl/ basicuser basic.101 ndpue" ); + } + + + // + // Display registered authentication modules. + static void displayRegisteredModules() + { + + // The AuthenticationManager calls all authentication modules sequentially + // until one of them responds with an authorization instance. Show + // the current registered modules, for testing purposes. + IEnumerator^ registeredModules = AuthenticationManager::RegisteredModules; + Console::WriteLine( "\r\nThe following authentication modules are now registered with the system" ); + while ( registeredModules->MoveNext() ) + { + Console::WriteLine( "\r \n Module : {0}", registeredModules->Current ); + IAuthenticationModule^ currentAuthenticationModule = dynamic_cast(registeredModules->Current); + Console::WriteLine( "\t CanPreAuthenticate : {0}", currentAuthenticationModule->CanPreAuthenticate ); + } + } + + + // + // The getPage method accesses the selected page an displays its content + // on the console. + static void getPage( String^ url ) + { + try + { + + // Create the Web request object. + WebRequest^ req = dynamic_cast(WebRequest::Create( url )); + + // Define the request access method. + req->Method = "GET"; + + // Define the request credentials according to the user's input. + if ( domain == String::Empty ) + req->Credentials = gcnew NetworkCredential( username,password ); // If the user's specifies the Internet resource domain, this usually + else + req->Credentials = gcnew NetworkCredential( username,password,domain ); + + // is by default the name of the sever hosting the resource. + // Issue the request. + WebResponse^ result = req->GetResponse(); + Console::WriteLine( "\nAuthentication Succeeded:" ); + + // Store the response. + Stream^ sData = result->GetResponseStream(); + + // Display the response. + displayPageContent( sData ); + } + catch ( WebException^ e ) + { + + // Display the error, if any. In particular display protocol + // related error. + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + HttpWebResponse^ hresp = dynamic_cast(e->Response); + Console::WriteLine( "\nAuthentication Failed, {0}", hresp->StatusCode ); + Console::WriteLine( "Status Code: {0}", (int)hresp->StatusCode ); + Console::WriteLine( "Status Description: {0}", hresp->StatusDescription ); + return; + } + Console::WriteLine( "Caught Exception: {0}", e->Message ); + Console::WriteLine( "Stack: {0}", e->StackTrace ); + } + + } + + + // The displayPageContent method display the content of the + // selected page. + static void displayPageContent( Stream^ ReceiveStream ) + { + + // Create an ASCII encoding object. + Encoding^ ASCII = Encoding::ASCII; + + // Define the byte array to temporary hold the current read bytes. + array^read = gcnew array(512); + Console::WriteLine( "\r\nPage Content...\r\n" ); + + // Read the page content and display it on the console. + // Read the first 512 bytes. + int bytes = ReceiveStream->Read( read, 0, 512 ); + while ( bytes > 0 ) + { + Console::Write( ASCII->GetString( read, 0, bytes ) ); + bytes = ReceiveStream->Read( read, 0, 512 ); + } + + Console::WriteLine( "" ); + } + + +public: + + // + // This is the program entry point. It allows the user to enter + // her credentials and the Internet resource (Web page) to access. + // It also unregisters the standard and registers the customized basic + // authentication. + static void Main() + { + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 4 ) + showusage(); + else + { + + // Read the user's credentials. + uri = args[ 1 ]; + username = args[ 2 ]; + password = args[ 3 ]; + if ( args->Length == 4 ) + domain = String::Empty; // If the domain exists, store it. Usually the domain name + else + domain = args[ 4 ]; + + + // is by default the name of the server hosting the Internet + // resource. + // Unregister the standard Basic authentication module. + AuthenticationManager::Unregister( "Basic" ); + + // Instantiate the custom Basic authentication module. + CustomBasic^ customBasicModule = gcnew CustomBasic; + + // Register the custom Basic authentication module. + AuthenticationManager::Register( customBasicModule ); + + // Display registered Authorization modules. + displayRegisteredModules(); + + // Read the specified page and display it on the console. + getPage( uri ); + } + + return; + } + + // +}; + +int main() +{ + ClientAuthentication::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp new file mode 100644 index 00000000000..344dc6ed2a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionListener/CPP/listener.cpp @@ -0,0 +1,130 @@ + + +// +// This program contains snippets for the following members: +// 1) System::Net::Sockets::MulticastOption; +// 2) System::Net::Sockets::MulticastOption.MulticastOption(IPAddress, IPAddress); +// 3) System::Net::Sockets::MulticastOption.Group; +// 4) System::Net::Sockets::MulticastOption.LocalAddress; +// +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; + +// This program shows how to use the MultiCastOption type. In particular, +// it shows how to use the MultiCastOption(IPAddress, IPAddress) constructor, +// You need to use this constructor, in the case of multihomed host (i.e., +// a host with more than one network card). With the first parameter you +// specify the multicast group address, with the second you specify the +// local address of one of the network cards you want to use for the data +// exchange. +// You must run this program in conjunction with the sender program as +// follows: +// Open a console window and run the listener from the command line. +// In another console window run the sender. In both cases you must specify +// the local IPAddress to use. To obtain this address run the ipconfig from +// the command line. +// +public ref class TestMulticastOption +{ +private: + static IPAddress^ mcastAddress; + static int mcastPort; + static Socket^ mcastSocket; + static MulticastOption^ mcastOption; + + // + static void MulticastOptionProperties() + { + Console::WriteLine( "Current multicast group is: {0}", mcastOption->Group ); + Console::WriteLine( "Current multicast local address is: {0}", mcastOption->LocalAddress ); + } + + + // + static void StartMulticast() + { + try + { + mcastSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Dgram,ProtocolType::Udp ); + Console::Write( "Enter the local IP Address: " ); + IPAddress^ localIPAddr = IPAddress::Parse( Console::ReadLine() ); + + //IPAddress localIP = IPAddress::Any; + EndPoint^ localEP = dynamic_cast(gcnew IPEndPoint( localIPAddr,mcastPort )); + mcastSocket->Bind( localEP ); + + // + // Define a MuticastOption object specifying the multicast group + // address and the local IPAddress. + // The multicast group address is the same one used by the server. + mcastOption = gcnew MulticastOption( mcastAddress,localIPAddr ); + mcastSocket->SetSocketOption( SocketOptionLevel::IP, SocketOptionName::AddMembership, mcastOption ); + + // + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + + } + + static void ReceiveBrodcastMessages() + { + bool done = false; + array^bytes = gcnew array(100); + IPEndPoint^ groupEP = gcnew IPEndPoint( mcastAddress,mcastPort ); + EndPoint^ remoteEP = dynamic_cast(gcnew IPEndPoint( IPAddress::Any,0 )); + try + { + while ( !done ) + { + Console::WriteLine( "Waiting for Multicast packets......." ); + Console::WriteLine( "Enter ^C to terminate." ); + mcastSocket->ReceiveFrom( bytes, remoteEP ); + Console::WriteLine( "Received broadcast from {0} :\n {1}\n", groupEP, Encoding::ASCII->GetString( bytes, 0, bytes->Length ) ); + } + mcastSocket->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } + + } + + +public: + static void Main() + { + + // Initialize multicast address group and multicast port. + // Both address and port are selected from the allowed sets as + // defined in the related RFC documents. These are the same values + // used by the sender. + mcastAddress = IPAddress::Parse( "224.168.100.2" ); + mcastPort = 11000; + + // Start a multicast group. + StartMulticast(); + + // Display multicast option properties. + MulticastOptionProperties(); + + // Receive brodcast messages. + ReceiveBrodcastMessages(); + } + +}; + +int main() +{ + TestMulticastOption::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp new file mode 100644 index 00000000000..9b92d3984aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.MulticastOptionSender/CPP/sender.cpp @@ -0,0 +1,107 @@ + + +// +// This program contains snippets for the following members: +// 1) System::Net::Sockets::MulticastOption; +// +// +#using + +using namespace System; +using namespace System::Net::Sockets; +using namespace System::Net; +using namespace System::Text; + +// This is an auxiliary program to be used in conjunction with a listener +// program. +// You must run this program as follows: +// Open a console window and run the listener from the command line. +// In another console window run the sender. In both cases you must specify +// the local IPAddress to use. To obtain this address run the ipconfig +// from the command line. +// +ref class TestMulticastOption +{ +private: + static IPAddress^ mcastAddress; + static int mcastPort; + static Socket^ mcastSocket; + static void JoinMulticast() + { + try + { + + // Create multicast socket. + mcastSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Dgram,ProtocolType::Udp ); + + // Get the local IP address used by the listener and the sender to + // exchange data in a multicast fashion. + Console::Write( "\nEnter local IPAddress for sending multicast packets: " ); + IPAddress^ localIPAddr = IPAddress::Parse( Console::ReadLine() ); + + // Create an IPEndPoint Object*. + IPEndPoint^ IPlocal = gcnew IPEndPoint( localIPAddr,0 ); + + // Bind this end point to the multicast socket. + mcastSocket->Bind( IPlocal ); + + // Define a MuticastOption Object* specifying the multicast group + // address and the local IPAddress. + // The multicast group address is the same one used by the listener. + MulticastOption^ mcastOption; + mcastOption = gcnew MulticastOption( mcastAddress,localIPAddr ); + mcastSocket->SetSocketOption( SocketOptionLevel::IP, SocketOptionName::AddMembership, mcastOption ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\n {0}", e ); + } + + } + + static void BrodcastMessage( String^ message ) + { + IPEndPoint^ endPoint; + try + { + + //Send multicast packets to the listener. + endPoint = gcnew IPEndPoint( mcastAddress,mcastPort ); + mcastSocket->SendTo( ASCIIEncoding::ASCII->GetBytes( message ), endPoint ); + Console::WriteLine( "Multicast data sent....." ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\n {0}", e ); + } + + mcastSocket->Close(); + } + + +public: + static void main() + { + + // Initialize multicast address group and multicast port. + // Both address and port are selected from the allowed sets as + // defined in the related RFC documents. These are the same values + // used by the sender. + mcastAddress = IPAddress::Parse( "224.168.100.2" ); + mcastPort = 11000; + + // Join the listener multicast group. + JoinMulticast(); + + // Broadcast message to the listener. + BrodcastMessage( "Hello multicast listener." ); + } + +}; + +int main() +{ + TestMulticastOption::main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp new file mode 100644 index 00000000000..4b21fa80e2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socket.BeginConnect/CPP/beginconnect.cpp @@ -0,0 +1,128 @@ + + +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; +ref class ConnectTester +{ +public: + + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + + // handles the completion of the prior asynchronous + // connect call. the socket is passed via the objectState + // paramater of BeginConnect(). + static void ConnectCallback1( IAsyncResult^ ar ) + { + allDone->Set(); + Socket^ s = dynamic_cast(ar->AsyncState); + s->EndConnect( ar ); + } + + // Asynchronous connect using the host name, resolved via + // IPAddress + static void BeginConnect1( String^ host, int port ) + { + array^IPs = Dns::GetHostAddresses( host ); + Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + allDone->Reset(); + Console::WriteLine( "Establishing Connection to {0}", host ); + s->BeginConnect( IPs[ 0 ], port, gcnew AsyncCallback( ConnectCallback1 ), s ); + + // wait here until the connect finishes. + // The callback sets allDone. + allDone->WaitOne(); + Console::WriteLine( "Connection established" ); + } + + // Asynchronous connect, using DNS.ResolveToAddresses + static void BeginConnect2( String^ host, int port ) + { + array^IPs = Dns::GetHostAddresses( host ); + Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + allDone->Reset(); + Console::WriteLine( "Establishing Connection to {0}", host ); + s->BeginConnect( IPs, port, gcnew AsyncCallback( ConnectCallback1 ), s ); + + // wait here until the connect finishes. The callback + // sets allDone. + allDone->WaitOne(); + Console::WriteLine( "Connection established" ); + } + + // Asynchronous connect using host name (resolved by the + // BeginConnect call.) + static void BeginConnect3( String^ host, int port ) + { + Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + allDone->Reset(); + Console::WriteLine( "Establishing Connection to {0}", host ); + s->BeginConnect( host, port, gcnew AsyncCallback( ConnectCallback1 ), s ); + + // wait here until the connect finishes. The callback + // sets allDone. + allDone->WaitOne(); + Console::WriteLine( "Connection established" ); + } + + // + // Synchronous connect using IPAddress to resolve the + // host name. + static void Connect1( String^ host, int port ) + { + array^IPs = Dns::GetHostAddresses( host ); + Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + Console::WriteLine( "Establishing Connection to {0}", host ); + s->Connect( IPs[ 0 ], port ); + Console::WriteLine( "Connection established" ); + } + + + // + // + // Synchronous connect using Dns.ResolveToAddresses to + // resolve the host name. + static void Connect2( String^ host, int port ) + { + array^IPs = Dns::GetHostAddresses( host ); + Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + Console::WriteLine( "Establishing Connection to {0}", host ); + s->Connect( IPs, port ); + Console::WriteLine( "Connection established" ); + } + + + // + // + // Synchronous connect using host name (resolved by the + // Connect call.) + static void Connect3( String^ host, int port ) + { + Socket^ s = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + Console::WriteLine( "Establishing Connection to {0}", host ); + s->Connect( host, port ); + Console::WriteLine( "Connection established" ); + } + + // +}; + + +[STAThread] +int main() +{ + ConnectTester::BeginConnect1( "127.0.0.1", 80 ); + ConnectTester::BeginConnect2( "localhost", 80 ); + ConnectTester::BeginConnect3( "localhost", 80 ); + ConnectTester::Connect1( "127.0.0.1", 80 ); + ConnectTester::Connect2( "127.0.0.1", 80 ); + ConnectTester::Connect3( "localhost", 80 ); + Console::WriteLine( "hit any key" ); + Console::Read(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp new file mode 100644 index 00000000000..b06fa3e3760 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.Socketgenerics/CPP/sendgeneric.cpp @@ -0,0 +1,175 @@ +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +namespace SocketExample +{ + ref class TestClass + { + public: + + static void SyncSendAndReceive(String^ host, int port) + { + // + Encoding^ asciiEncoding = Encoding::ASCII; + + // Create the TCP Socket. + IPHostEntry^ hostEntry = Dns::Resolve(host); + IPEndPoint^ endPoint = gcnew IPEndPoint( + hostEntry->AddressList[0], port); + + Socket^ tcpSocket = gcnew Socket( + AddressFamily::InterNetwork, SocketType::Stream, + ProtocolType::Tcp); + + tcpSocket->Connect(endPoint); + + // Build the buffers to be sent. + List >^ buffers = + gcnew List >(2); + + buffers->Add(ArraySegment( + asciiEncoding->GetBytes(""))); + + buffers->Add(ArraySegment( + asciiEncoding->GetBytes(""))); + + // Send the data. + tcpSocket->Send(buffers); + // + + // + + // Build the buffers for the receive. + List >^ receiveBuffers = + gcnew List >(2); + + array^ bigBuffer = gcnew array(1024); + + // Specify the first buffer segment (2 bytes, starting + // at the 4th element of bigBuffer) + receiveBuffers->Add(ArraySegment(bigBuffer, 4, 2)); + + // Specify the second buffer segment (500 bytes, starting + // at the 20th element of bigBuffer) + receiveBuffers->Add( + ArraySegment(bigBuffer, 20, 500)); + + tcpSocket->Receive(receiveBuffers); + + Console::WriteLine("{0}", + asciiEncoding->GetString(bigBuffer)); + // + } + + static void AsyncSendAndReceive(String^ host, int port) + { + // + Encoding^ asciiEncoding = Encoding::ASCII; + + // Create the TCP Socket. + IPHostEntry^ hostEntry = Dns::Resolve(host); + IPEndPoint^ endPoint = gcnew IPEndPoint( + hostEntry->AddressList[0], port); + + Socket^ tcpSocket = gcnew Socket( + AddressFamily::InterNetwork, SocketType::Stream, + ProtocolType::Tcp); + + tcpSocket->Connect(endPoint); + + // Build the buffers to be sent. + List >^ buffers = + gcnew List >(2); + + buffers->Add(ArraySegment( + asciiEncoding->GetBytes(""))); + + buffers->Add(ArraySegment( + asciiEncoding->GetBytes(""))); + + // Create delegate instance for the callback function + AsyncCallback^ sendCallback = + gcnew AsyncCallback(SendCallback); + + // Send the data. + allDone->Reset(); + tcpSocket->BeginSend(buffers, SocketFlags::None, + sendCallback, (Object^)tcpSocket); + allDone->WaitOne(); + + // done + Console::WriteLine("Data sent"); + // + + // + + // Build the buffers for the receive. + List >^ receiveBuffers = + gcnew List >(2); + + array^ bigBuffer = gcnew array(1024); + + // Specify the first buffer segment (2 bytes, starting + // at the 6th element of bigBuffer) + receiveBuffers->Add(ArraySegment(bigBuffer, 6, 2)); + + // Specify the second buffer segment (500 bytes, starting + // at the 10th element of bigBuffer) + receiveBuffers->Add( + ArraySegment(bigBuffer, 10, 500)); + + // Create delegate instance for the callback function + AsyncCallback^ receiveCallback = + gcnew AsyncCallback(ReceiveCallback); + + // Receive the data. + allDone->Reset(); + tcpSocket->BeginReceive( + receiveBuffers, SocketFlags::None, + receiveCallback, (Object^)tcpSocket); + + allDone->WaitOne(); + + Console::WriteLine("Data received:"); + Console::WriteLine("{0}", + asciiEncoding->GetString(bigBuffer)); + // + } + + private: + + static ManualResetEvent^ allDone = + gcnew ManualResetEvent(false); + + static void SendCallback(IAsyncResult^ result) + { + allDone->Set(); + Socket^ sendSocket = (Socket^)result->AsyncState; + sendSocket->EndSend(result); + } + + static void ReceiveCallback(IAsyncResult^ result) + { + allDone->Set(); + Socket^ receiveSocket = (Socket^)result->AsyncState; + receiveSocket->EndReceive(result); + } + }; +} + +int main() +{ + Console::WriteLine("starting synchronous test"); + SocketExample::TestClass::SyncSendAndReceive("localhost", 80); + Console::WriteLine("starting asynchronous test"); + SocketExample::TestClass::AsyncSendAndReceive("localhost", 80); + Console::WriteLine("ending tests"); + + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp new file mode 100644 index 00000000000..93746826f75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient/CPP/tcpclient.cpp @@ -0,0 +1,118 @@ +// System.Net.Sockets.TcpClient main functionality. + +/** +* This program shows how to use the TcpClient +* It creates a TcpClient that connects to a TcpServer listening on the specified port +* (13000). When connecting to the server it forwards a message, as specified in +* the input parameter. +* To run this program at the command line you enter: +* cs_tcpclient serverName S"My message" +* Where the serverName is the name on which the server is running. +* For this program to work you need to have the TcpServer running in another +* console window. +* To avoid permission settings you can run this console application and the related +* TcpServer from your hard disk and not from a shared location on the network. +**/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Security::Permissions; + +/** +* The following function creates a TcpClient that connects to a +* TcpServer listening on the specified port (13000). +* When connecting to the server it forwards a message, as specified in +* the input parameter. +**/ +// +void Connect( String^ server, String^ message ) +{ + TcpClient^ client = nullptr; + try + { + // Create a TcpClient. + // Note, for this client to work you need to have a TcpServer + // connected to the same address as specified by the server, port + // combination. + Int32 port = 13000; + client = gcnew TcpClient(server, port); + + // Translate the passed message into ASCII and store it as a Byte array. + array^data = Text::Encoding::ASCII->GetBytes( message ); + + // Get a client stream for reading and writing. + NetworkStream^ stream = client->GetStream(); + + // Send the message to the connected TcpServer. + stream->Write( data, 0, data->Length ); + + Console::WriteLine( "Sent: {0}", message ); + + // Receive the server response. + + // Buffer to store the response bytes. + data = gcnew array(256); + + // String to store the response ASCII representation. + String^ responseData = String::Empty; + + // Read the first batch of the TcpServer response bytes. + Int32 bytes = stream->Read( data, 0, data->Length ); + responseData = Text::Encoding::ASCII->GetString( data, 0, bytes ); + Console::WriteLine( "Received: {0}", responseData ); + + // Explicit close is not necessary since TcpClient::Dispose() will be + // called automatically in finally block. + // stream->Close(); + // client->Close(); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( "ArgumentNullException: {0}", e ); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException: {0}", e ); + } + finally + { + if (client != nullptr) + delete client; + } + + Console::WriteLine( "\n Press Enter to continue..." ); + Console::Read(); +} +// + +void main( int argc, char *argv[] ) +{ + // Parse arguments + String^ server; + String^ message; + if ( argc < 3 ) + { + message = "This is a test!"; + if ( argc == 1 ) + { + server = "localhost"; + } + else + { + server = gcnew String(argv[ 1 ]); + } + } + else + { + message = gcnew String(argv[ 2 ]); + server = gcnew String(argv[ 1 ]); + } + + // Connect to server + Connect( server, message ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp new file mode 100644 index 00000000000..86c17e2e7fd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpClient1/CPP/newtcpclient.cpp @@ -0,0 +1,125 @@ + + +// This is the main project file for VC++ application project +// generated using an Application Wizard. +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; + +ref class TcpClientExamples +{ +public: + + // + static void GetAvailable( TcpClient^ t ) + { + // Find out how many bytes are ready to be read. + Console::WriteLine( "Available value is {0}", t->Available.ToString() ); + ; + } + // + + // + static void GetConnected( TcpClient^ t ) + { + // Find out whether the socket is connected to the remote + // host. + Console::WriteLine( "Connected value is {0}", t->Connected.ToString() ); + ; + } + // + + // + static void GetSetExclusiveAddressUse( TcpClient^ t ) + { + // Don't allow another process to bind to this port. + t->ExclusiveAddressUse = true; + Console::WriteLine( "ExclusiveAddressUse value is {0}", t->ExclusiveAddressUse.ToString() ); + ; + } + // + + // + static void DoConnect( String^ host, int port ) + { + // Connect to the specified host. + TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); + array^IPAddresses = Dns::GetHostAddresses( host ); + Console::WriteLine( "Establishing Connection to {0}", host ); + t->Connect( IPAddresses, port ); + Console::WriteLine( "Connection established" ); + } + // + + // + static ManualResetEvent^ connectDone = gcnew ManualResetEvent( false ); + static void ConnectCallback( IAsyncResult^ ar ) + { + connectDone->Set(); + TcpClient^ t = safe_cast(ar->AsyncState); + t->EndConnect( ar ); + } + // + + static void DoBeginConnect1( String^ host, int port ) + { + // Connect asynchronously to the specifed host. + TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); +// IPAddress^ remoteHost = gcnew IPAddress( host ); + array^ remoteHost = Dns::GetHostAddresses( host ); + connectDone->Reset(); + Console::WriteLine( "Establishing Connection to {0}", host ); + t->BeginConnect( remoteHost, port, gcnew AsyncCallback( &ConnectCallback ), t ); + + // Wait here until the callback processes the connection. + connectDone->WaitOne(); + Console::WriteLine( "Connection established" ); + } + + // Connect asynchronously to the specifed host. + static void DoBeginConnect2( String^ host, int port ) + { + TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); + array^remoteHost = Dns::GetHostAddresses( host ); + connectDone->Reset(); + Console::WriteLine( "Establishing Connection to {0}", host ); + t->BeginConnect( remoteHost, port, gcnew AsyncCallback( &ConnectCallback ), t ); + + // Wait here until the callback processes the connection. + connectDone->WaitOne(); + Console::WriteLine( "Connection established" ); + } + + // Connect asynchronously to the specifed host. + static void DoBeginConnect3( String^ host, int port ) + { + TcpClient^ t = gcnew TcpClient( AddressFamily::InterNetwork ); + connectDone->Reset(); + Console::WriteLine( "Establishing Connection to {0}", host ); + t->BeginConnect( host, port, gcnew AsyncCallback( &ConnectCallback ), t ); + + // Wait here until the callback processes the connection. + connectDone->WaitOne(); + Console::WriteLine( "Connection established" ); + } +}; + +int main() +{ + TcpClient^ t; + + // The TCP socket. + t = gcnew TcpClient( "localhost",80 ); + TcpClientExamples::GetConnected( t ); + TcpClientExamples::GetAvailable( t ); + TcpClientExamples::GetSetExclusiveAddressUse( t ); + TcpClientExamples::DoConnect( "127.0.0.1", 80 ); + TcpClientExamples::DoBeginConnect1( "127.0.0.1", 80 ); + TcpClientExamples::DoBeginConnect2( "127.0.0.1", 80 ); + TcpClientExamples::DoBeginConnect3( "127.0.0.1", 80 ); + Console::WriteLine( "enter to exit" ); + Console::Read(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp new file mode 100644 index 00000000000..9687b62e453 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener/CPP/tcpserver.cpp @@ -0,0 +1,226 @@ + + +// System.Net.Sockets.TcpListener +/** +* This program shows how to use the TcpListener class. +* It creates a TcpListener that listen on the specified port (13000). +* To run this program at the command line you enter: +* cs_tcpserver +* Any TcpClient that wants to use this server +* has to explicitly connect to an address obtained by the combination of +* the sever on which this TcpServer is runnig and the port 13000. +* This TcpServer simply echoes back the message sent by the TcpClient, after +* translating it into uppercase. +* To avoid permission settings you can run this console application and the related +* TcpClient from your hard disk and not from a shared location on the network. +**/ +// +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; +void main() +{ + try + { + + // Set the TcpListener on port 13000. + Int32 port = 13000; + IPAddress^ localAddr = IPAddress::Parse( "127.0.0.1" ); + + // TcpListener* server = new TcpListener(port); + TcpListener^ server = gcnew TcpListener( localAddr,port ); + + // Start listening for client requests. + server->Start(); + + // Buffer for reading data + array^bytes = gcnew array(256); + String^ data = nullptr; + + // Enter the listening loop. + while ( true ) + { + Console::Write( "Waiting for a connection... " ); + + // Perform a blocking call to accept requests. + // You could also use server.AcceptSocket() here. + TcpClient^ client = server->AcceptTcpClient(); + Console::WriteLine( "Connected!" ); + data = nullptr; + + // Get a stream Object* for reading and writing + NetworkStream^ stream = client->GetStream(); + Int32 i; + + // Loop to receive all the data sent by the client. + while ( i = stream->Read( bytes, 0, bytes->Length ) ) + { + + // Translate data bytes to a ASCII String*. + data = Text::Encoding::ASCII->GetString( bytes, 0, i ); + Console::WriteLine( "Received: {0}", data ); + + // Process the data sent by the client. + data = data->ToUpper(); + array^msg = Text::Encoding::ASCII->GetBytes( data ); + + // Send back a response. + stream->Write( msg, 0, msg->Length ); + Console::WriteLine( "Sent: {0}", data ); + } + + // Shutdown and end connection + client->Close(); + } + } + catch ( SocketException^ e ) + { + Console::WriteLine( "SocketException: {0}", e ); + } + + Console::WriteLine( "\nHit enter to continue..." ); + Console::Read(); +} + + +// +ref class tcplistener +{ +public: + + // + static void GetSetExclusiveAddressUse( TcpListener^ t ) + { + + // Set Exclusive Address Use for the underlying socket. + t->ExclusiveAddressUse = true; + Console::WriteLine( "ExclusiveAddressUse value is {0}", t->ExclusiveAddressUse ); + } + + + // + // + static void DoStart( TcpListener^ t, int backlog ) + { + + // Start listening for client connections with the specified + // backlog. + t->Start( backlog ); + Console::WriteLine( "started listening" ); + } + + + // + // + // Thread signal. + static ManualResetEvent^ clientConnected = gcnew ManualResetEvent( false ); + + // Accept one client connection asynchronously. + static void DoBeginAcceptSocket( TcpListener^ listener ) + { + + // Set the event to nonsignaled state. + clientConnected->Reset(); + + // Start to listen for connections from a client. + Console::WriteLine( "Waiting for a connection..." ); + + // Accept the connection. + // BeginAcceptSocket() creates the accepted socket. + listener->BeginAcceptSocket( gcnew AsyncCallback( &tcplistener::DoAcceptSocketCallback ), listener ); + + // Wait until a connection is made and processed before + // continuing. + clientConnected->WaitOne(); + } + + + // Process the client connection. + static void DoAcceptSocketCallback( IAsyncResult^ ar ) + { + + // Get the listener that handles the client request. + TcpListener^ listener = dynamic_cast(ar->AsyncState); + + // Get the client socket. + Socket^ clientSocket = listener->EndAcceptSocket( ar ); + + // Process the connection here. (Add the client to a server + // table, read data, etc.) + Console::WriteLine( "Client connected completed" ); + + // Signal the calling thread to continue. + clientConnected->Set(); + } + + + // + // + // Thread signal. + static ManualResetEvent^ tcpClientConnected = gcnew ManualResetEvent( false ); + + // Accept one client connection asynchronously. + static void DoBeginAcceptTcpClient( TcpListener^ listener ) + { + + // Set the event to nonsignaled state. + tcpClientConnected->Reset(); + + // Start to listen for connections from a client. + Console::WriteLine( "Waiting for a connection..." ); + + // Accept the connection. + // BeginAcceptSocket() creates the accepted socket. + listener->BeginAcceptTcpClient( gcnew AsyncCallback( &tcplistener::DoAcceptTcpClientCallback ), listener ); + + // Wait until a connection is made and processed before + // continuing. + tcpClientConnected->WaitOne(); + } + + + // Process the client connection. + static void DoAcceptTcpClientCallback( IAsyncResult^ ar ) + { + + // Get the listener that handles the client request. + TcpListener^ listener = dynamic_cast(ar->AsyncState); + + // Get the new TcpClient. + TcpClient^ client = listener->EndAcceptTcpClient( ar ); + + // Process the connection here. (Add the client to a server + // table, read data, etc.) + Console::WriteLine( "Client connected completed" ); + + // Signal the calling thread to continue. + tcpClientConnected->Set(); + } + + // +}; + +/*int main() +{ + TcpListener* listener = new TcpListener( + Dns::GetLocalHostAddresses()[0], + 4242); + + tcplistener::GetSetExclusiveAddressUse(listener); + + // Start listening for client connections. + tcplistener::DoStart(listener, 20); + + // Accept client connections asynchronously + tcplistener::DoBeginAcceptSocket(listener); + tcplistener::DoBeginAcceptTcpClient(listener); + + Console::WriteLine("hit any key"); + Console::Read(); + return 0; +}*/ diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp new file mode 100644 index 00000000000..0a8159bb679 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.TcpListener1/cpp/tcpserver.cpp @@ -0,0 +1,150 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Threading; + +namespace TcpListenerExample +{ + public ref class TcpServer + { + // + public: + static void GetSetExclusiveAddressUse(TcpListener^ listener) + { + // Set Exclusive Address Use for the underlying socket. + listener->ExclusiveAddressUse = true; + Console::WriteLine("ExclusiveAddressUse value is {0}", + listener->ExclusiveAddressUse); + } + // + + // + public: + static void DoStart(TcpListener^ listener, int backlog) + { + // Start listening for client connections with the + // specified backlog. + listener->Start(backlog); + Console::WriteLine("Started listening"); + } + // + + // Thread signal. + public: + static ManualResetEvent^ ClientConnected; + + // Accept one client connection asynchronously. + public: + static void DoBeginAcceptSocket(TcpListener^ listener) + { + // Set the event to nonsignaled state. + ClientConnected->Reset(); + + // Start to listen for connections from a client. + Console::WriteLine("Waiting for a connection..."); + + // Accept the connection. + // BeginAcceptSocket() creates the accepted socket. + listener->BeginAcceptSocket( + gcnew AsyncCallback(DoAcceptSocketCallback), listener); + // Wait until a connection is made and processed before + // continuing. + ClientConnected->WaitOne(); + } + + // Process the client connection. + public: + static void DoAcceptSocketCallback(IAsyncResult^ result) + { + // Get the listener that handles the client request. + TcpListener^ listener = (TcpListener^) result->AsyncState; + + // End the operation and display the received data on the + //console. + Socket^ clientSocket = listener->EndAcceptSocket(result); + + // Process the connection here. (Add the client to a + // server table, read data, etc.) + Console::WriteLine("Client connected completed"); + + // Signal the calling thread to continue. + ClientConnected->Set(); + } + + // Thread signal. + public: + static ManualResetEvent^ TcpClientConnected; + + // Accept one client connection asynchronously. + public: + static void DoBeginAcceptTcpClient(TcpListener^ listener) + { + // Set the event to nonsignaled state. + TcpClientConnected->Reset(); + + // Start to listen for connections from a client. + Console::WriteLine("Waiting for a connection..."); + + // Accept the connection. + // BeginAcceptSocket() creates the accepted socket. + listener->BeginAcceptTcpClient( + gcnew AsyncCallback(DoAcceptTcpClientCallback), + listener); + + // Wait until a connection is made and processed before + // continuing. + TcpClientConnected->WaitOne(); + } + + // Process the client connection. + public: + static void DoAcceptTcpClientCallback(IAsyncResult^ result) + { + // Get the listener that handles the client request. + TcpListener^ listener = (TcpListener^) result->AsyncState; + + // End the operation and display the received data on + // the console. + TcpClient^ client = listener->EndAcceptTcpClient(result); + + // Process the connection here. (Add the client to a + // server table, read data, etc.) + Console::WriteLine("Client connected completed"); + + // Signal the calling thread to continue. + TcpClientConnected->Set(); + + } + + public: + static void Main() + { + ClientConnected = gcnew ManualResetEvent(false); + + TcpClientConnected = gcnew ManualResetEvent(false); + + TcpListener^ listener = gcnew TcpListener( + Dns::GetHostAddresses(Dns::GetHostName())[0], 4242); + + GetSetExclusiveAddressUse(listener); + + // Start listening for client connections. + DoStart(listener, 20); + + // Accept one client connection asynchronously + DoBeginAcceptSocket(listener); + DoBeginAcceptTcpClient(listener); + + Console::WriteLine("Hit any key"); + Console::Read(); + } + }; +} + +[STAThread] +int main() +{ + TcpListenerExample::TcpServer::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp new file mode 100644 index 00000000000..dd999947811 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient.JoinMulticastGroup/CPP/joinmulticastgroup.cpp @@ -0,0 +1,326 @@ + + +// File name:multicastOperations.cs +// This example shows how to join a multicast group and perform a muticast +// data exchange. The OriginatorClient Object* starts the conversation while +// the TargetClient responds. The two helper objects Receive and Send +// perform the actual data exchange. +// Note. This program cannot be build with the current VS build version. +// Build it via command line. Rubuild it in VS when a suitable version is +// available. +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::IO; +using namespace System::Threading; + +// The following Receive class is used by both the ClientOriginator and +// the ClientTarget class to receive data from one another.. +public ref class Receive +{ +public: + + // The following static method performs the actual data + // exchange. In particular, it performs the following tasks: + // 1)Establishes a communication endpoint. + // 2)Receive data through this end point on behalf of the + // caller. + // 3) Returns the received data in ASCII format. + static String^ ReceiveUntilStop( UdpClient^ c ) + { + String^ strData = ""; + String^ Ret = ""; + ASCIIEncoding^ ASCII = gcnew ASCIIEncoding; + + // Establish the communication endpoint. + IPEndPoint^ endpoint = gcnew IPEndPoint( IPAddress::IPv6Any,50 ); + while ( !strData->Equals( "Over" ) ) + { + array^data = c->Receive( endpoint ); + strData = ASCII->GetString( data ); + Ret = String::Concat( Ret, strData, "\n" ); + } + + return Ret; + } + +}; + + +// The following Send class is used by both the ClientOriginator and +// ClientTarget classes to send data to one another. +public ref class Send +{ +private: + static array^greetings = {'H','e','l','l','o',' ','T','a','r','g','e','t','->'}; + static array^nice = {'H','a','v','e',' ','a',' ','n','i','c','e',' ','d','a','y','->'}; + static array^eom = {'O','v','e','r'}; + static array^tGreetings = {'H','e','l','l','o',' ','O','r','i','g','i','n','a','t','o','r','!'}; + static array^tNice = {'Y','o','u',' ','t','o','o','->'}; + +public: + + // The following static method sends data to the ClientTarget on + // behalf of the ClientOriginator. + static void OriginatorSendData( UdpClient^ c, IPEndPoint^ ep ) + { + Console::WriteLine( gcnew String( greetings ) ); + c->Send( GetByteArray( greetings ), greetings->Length, ep ); + Thread::Sleep( 1000 ); + Console::WriteLine( gcnew String( nice ) ); + c->Send( GetByteArray( nice ), nice->Length, ep ); + Thread::Sleep( 1000 ); + Console::WriteLine( gcnew String( eom ) ); + c->Send( GetByteArray( eom ), eom->Length, ep ); + } + + + // The following static method sends data to the ClientOriginator on + // behalf of the ClientTarget. + static void TargetSendData( UdpClient^ c, IPEndPoint^ ep ) + { + Console::WriteLine( gcnew String( tGreetings ) ); + c->Send( GetByteArray( tGreetings ), tGreetings->Length, ep ); + Thread::Sleep( 1000 ); + Console::WriteLine( gcnew String( tNice ) ); + c->Send( GetByteArray( tNice ), tNice->Length, ep ); + Thread::Sleep( 1000 ); + Console::WriteLine( gcnew String( eom ) ); + c->Send( GetByteArray( eom ), eom->Length, ep ); + } + + +private: + + // Internal utility + static array^ GetByteArray( array^ChArray ) + { + array^Ret = gcnew array(ChArray->Length); + for ( int i = 0; i < ChArray->Length; i++ ) + Ret[ i ] = (Byte)ChArray[ i ]; + return Ret; + } + +}; + + +// The ClientTarget class is the receiver of the ClientOriginator +// messages. The StartMulticastConversation method contains the +// logic for exchanging data between the ClientTarget and its +// counterpart ClientOriginator in a multicast operation. +public ref class ClientTarget +{ +private: + static UdpClient^ m_ClientTarget; + static IPAddress^ m_GrpAddr; + +public: + + // The following StartMulticastConversation method connects the UDP + // ClientTarget with the ClientOriginator. + // It performs the following main tasks: + // 1)Creates a UDP client to receive data on a specific port and using + // IPv6 addresses. The port is the same one used by the ClientOriginator + // to define its communication endpoint. + // 2)Joins or creates a multicast group at the specified address. + // 3)Defines the endpoint port to send data to the ClientOriginator. + // 4)Receives data from the ClientOriginator until the end of the + // communication. + // 5)Sends data to the ClientOriginator. + // Note this method is the counterpart of the + // ClientOriginator::ConnectOriginatorAndTarget(). + static void StartMulticastConversation() + { + String^ Ret; + + // Bind and listen on port 1000. Specify the IPv6 address family type. + m_ClientTarget = gcnew UdpClient( 1000,AddressFamily::InterNetworkV6 ); + + // Join or create a multicast group + m_GrpAddr = IPAddress::Parse( "FF01::1" ); + + // Use the overloaded JoinMulticastGroup method. + // Refer to the ClientOriginator method to see how to use the other + // methods. + m_ClientTarget->JoinMulticastGroup( m_GrpAddr ); + + // Define the endpoint data port. Note that this port number + // must match the ClientOriginator UDP port number which is the + // port on which the ClientOriginator is receiving data. + IPEndPoint^ ClientOriginatordest = gcnew IPEndPoint( m_GrpAddr,2000 ); + + // Receive data from the ClientOriginator. + Ret = Receive::ReceiveUntilStop( m_ClientTarget ); + Console::WriteLine( "\nThe ClientTarget received: \n\n {0}\n", Ret ); + + // Done receiving, now respond to the ClientOriginator. + // Wait to make sure the ClientOriginator is ready to receive. + Thread::Sleep( 2000 ); + Console::WriteLine( "\nThe ClientTarget sent:\n" ); + Send::TargetSendData( m_ClientTarget, ClientOriginatordest ); + + // Exit the multicast conversation. + m_ClientTarget->DropMulticastGroup( m_GrpAddr ); + } + +}; + + +// The following ClientOriginator class starts the multicast conversation +// with the ClientTarget class.. +// It performs the following main tasks: +// 1)Creates a socket and binds it to the port on which to communicate. +// 2)Specifies that the connection must use an IPv6 address. +// 3)Joins or create a multicast group. +// Note that the multicast address ranges to use are specified +// in the RFC#2375. +// 4)Defines the endpoint to send the data to and starts the +// client target (ClientTarget) thread. +public ref class ClientOriginator +{ +private: + static UdpClient^ clientOriginator; + static IPAddress^ m_GrpAddr; + static IPEndPoint^ m_ClientTargetdest; + static Thread^ m_t; + +public: + + // The ConnectOriginatorAndTarget method connects the + // ClientOriginator with the ClientTarget. + // It performs the following main tasks: + // 1)Creates a UDP client to receive data on a specific port + // using IPv6 addresses. + // 2)Joins or create a multicast group at the specified address. + // 3)Defines the endpoint port to send data to on the ClientTarget. + // 4)Starts the ClientTarget thread that also creates the ClientTarget Object*. + // Note this method is the counterpart of the + // ClientTarget::StartMulticastConversation(). + static bool ConnectOriginatorAndTarget() + { + try + { + + // + // Bind and listen on port 2000. This constructor creates a socket + // and binds it to the port on which to receive data. The family + // parameter specifies that this connection uses an IPv6 address. + clientOriginator = gcnew UdpClient( 2000,AddressFamily::InterNetworkV6 ); + + // Join or create a multicast group. The multicast address ranges + // to use are specified in RFC#2375. You are free to use + // different addresses. + // Transform the String* address into the internal format. + m_GrpAddr = IPAddress::Parse( "FF01::1" ); + + // Display the multicast address used. + Console::WriteLine( "Multicast Address: [ {0}]", m_GrpAddr ); + + // + // Exercise the use of the IPv6MulticastOption. + Console::WriteLine( "Instantiate IPv6MulticastOption(IPAddress)" ); + + // Instantiate IPv6MulticastOption using one of the + // overloaded constructors. + IPv6MulticastOption^ ipv6MulticastOption = gcnew IPv6MulticastOption( m_GrpAddr ); + + // Store the IPAdress multicast options. + IPAddress^ group = ipv6MulticastOption->Group; + __int64 interfaceIndex = ipv6MulticastOption->InterfaceIndex; + + // Display IPv6MulticastOption properties. + Console::WriteLine( "IPv6MulticastOption::Group: [ {0}]", group ); + Console::WriteLine( "IPv6MulticastOption::InterfaceIndex: [ {0}]", interfaceIndex ); + + // + // + // Instantiate IPv6MulticastOption using another + // overloaded constructor. + IPv6MulticastOption^ ipv6MulticastOption2 = gcnew IPv6MulticastOption( group,interfaceIndex ); + + // Store the IPAdress multicast options. + group = ipv6MulticastOption2->Group; + interfaceIndex = ipv6MulticastOption2->InterfaceIndex; + + // Display the IPv6MulticastOption2 properties. + Console::WriteLine( "IPv6MulticastOption::Group: [ {0} ]", group ); + Console::WriteLine( "IPv6MulticastOption::InterfaceIndex: [ {0} ]", interfaceIndex ); + + // Join the specified multicast group using one of the + // JoinMulticastGroup overloaded methods. + clientOriginator->JoinMulticastGroup( (int)interfaceIndex, group ); + + // + // Define the endpoint data port. Note that this port number + // must match the ClientTarget UDP port number which is the + // port on which the ClientTarget is receiving data. + m_ClientTargetdest = gcnew IPEndPoint( m_GrpAddr,1000 ); + + // + // Start the ClientTarget thread so it is ready to receive. + m_t = gcnew Thread( gcnew ThreadStart( ClientTarget::StartMulticastConversation ) ); + m_t->Start(); + + // Make sure that the thread has started. + Thread::Sleep( 2000 ); + return true; + } + catch ( Exception^ e ) + { + Console::WriteLine( "[ClientOriginator::ConnectClients] Exception: {0}", e ); + return false; + } + + } + + + // The SendAndReceive performs the data exchange + // between the ClientOriginator and the ClientTarget classes. + static String^ SendAndReceive() + { + String^ Ret = ""; + + // + // Send data to ClientTarget. + Console::WriteLine( "\nThe ClientOriginator sent:\n" ); + Send::OriginatorSendData( clientOriginator, m_ClientTargetdest ); + + // Receive data from ClientTarget + Ret = Receive::ReceiveUntilStop( clientOriginator ); + + // Stop the ClientTarget thread + m_t->Abort(); + + // Abandon the multicast group. + clientOriginator->DropMulticastGroup( m_GrpAddr ); + + // + return Ret; + } + +}; + + +//This is the console application entry point. +int main() +{ + + // Join the multicast group. + if ( ClientOriginator::ConnectOriginatorAndTarget() ) + { + + // Perform a multicast conversation with the ClientTarget. + String^ Ret = ClientOriginator::SendAndReceive(); + Console::WriteLine( "\nThe ClientOriginator received: \n\n {0}", Ret ); + } + else + { + Console::WriteLine( "Unable to Join the multicast group" ); + } +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp new file mode 100644 index 00000000000..30d3d0da5b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient/CPP/newudpclient.cpp @@ -0,0 +1,88 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +ref class UdpClientExamples +{ +public: + + // + static void GetAvailable( UdpClient^ u ) + { + // Get the number of bytes available for reading. + Console::WriteLine( "Available value is {0}", u->Available ); + } + // + + // + static void GetSetDontFragment( UdpClient^ u ) + { + // Set the don't fragment flag for packets emanating from + // this client. + u->DontFragment = true; + Console::WriteLine( "DontFragment value is {0}", u->DontFragment ); + } + // + + // + static void GetSetEnableBroadcast( UdpClient^ u ) + { + // Set the Broadcast flag for this client. + u->EnableBroadcast = true; + Console::WriteLine( "EnableBroadcast value is {0}", u->EnableBroadcast ); + } + // + + // + static void GetSetExclusiveAddressUse( UdpClient^ u ) + { + // Don't allow another client to bind to this port. + u->ExclusiveAddressUse = true; + Console::WriteLine( "ExclusiveAddressUse value is {0}", u->ExclusiveAddressUse ); + } + // + + // + static void GetSetTtl( UdpClient^ u ) + { + // Set the Time To Live (TTL) for this client. + u->Ttl = 42; + Console::WriteLine( "Ttl value is {0}", u->Ttl ); + } + // + + // + // Subscribe to a multicast group. + static void DoJoinMulticastGroup( UdpClient^ u, String^ mcast, String^ local ) + { + array^ multicastAddress = Dns::GetHostAddresses( mcast ); + + u->JoinMulticastGroup( multicastAddress[0] ); + Console::WriteLine( "Joined multicast Address {0}", multicastAddress ); + } + // + + // + static void GetSetMulticastLoopback( UdpClient^ u ) + { + // Deliver multicast packets back to the sending client. + u->MulticastLoopback = true; + Console::WriteLine( "MulticastLoopback value is {0}", u->MulticastLoopback ); + } + // +}; + +int main() +{ + UdpClient^ u = gcnew UdpClient( 4242 ); + UdpClientExamples::GetAvailable( u ); + UdpClientExamples::GetSetDontFragment( u ); + UdpClientExamples::GetSetEnableBroadcast( u ); + UdpClientExamples::GetSetExclusiveAddressUse( u ); + UdpClientExamples::GetSetTtl( u ); + UdpClientExamples::DoJoinMulticastGroup( u, "224.1.1.1", "172.30.186.134" ); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp new file mode 100644 index 00000000000..e6554acb196 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Net.Sockets.UdpClient1/cpp/asyncudp.cpp @@ -0,0 +1,261 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +public ref class UdpClientExample +{ + // +private: + static int listenPort = 13000; + +public: + value struct UdpState + { + public: + UdpClient^ udpClient; + IPEndPoint^ ipEndPoint; + }; + + static bool isMessageReceived; + + static void ReceiveCallback(IAsyncResult^ asyncResult) + { + UdpClient^ udpClient = + ((UdpState)(asyncResult->AsyncState)).udpClient; + IPEndPoint^ ipEndPoint = + ((UdpState)(asyncResult->AsyncState)).ipEndPoint; + + array^ receiveBytes = + udpClient->EndReceive(asyncResult, ipEndPoint); + String^ receiveString = + Encoding::ASCII->GetString(receiveBytes); + + Console::WriteLine("Received: {0}", receiveString); + isMessageReceived = true; + } + + static void ReceiveMessages() + { + // Receive a message and write it to the console. + IPEndPoint^ ipEndPoint = gcnew IPEndPoint(IPAddress::Any, listenPort); + UdpClient^ udpClient = gcnew UdpClient(ipEndPoint); + + UdpState^ udpState = gcnew UdpState(); + udpState->ipEndPoint = ipEndPoint; + udpState->udpClient = udpClient; + + Console::WriteLine("listening for messages"); + udpClient->BeginReceive(gcnew AsyncCallback(ReceiveCallback), + udpState); + + // Do some work while we wait for a message. For this example, + // we'll just sleep + while (!isMessageReceived) + { + Thread::Sleep(100); + } + } + // + + // +public: + static bool isMessageSent; + + static void SendCallback(IAsyncResult^ asyncResult) + { + UdpClient^ udpClient = (UdpClient^)asyncResult->AsyncState; + + Console::WriteLine("number of bytes sent: {0}", + udpClient->EndSend(asyncResult)); + isMessageSent = true; + } + // + + // +public: + static void SendMessage1(String^ server, String^ message) + { + // create the udp socket + UdpClient^ udpClient = gcnew UdpClient(); + + udpClient->Connect(server, listenPort); + array^ sendBytes = Encoding::ASCII->GetBytes(message); + + // send the message + // the destination is defined by the call to .Connect() + udpClient->BeginSend(sendBytes, sendBytes->Length, + gcnew AsyncCallback(SendCallback), udpClient); + + // Do some work while we wait for the send to complete. For + // this example, we'll just sleep + while (!isMessageSent) + { + Thread::Sleep(100); + } + } + // + + // +public: + static void SendMessage2(String^ server, String^ message) + { + // create the udp socket + UdpClient^ udpClient = gcnew UdpClient(); + array^ sendBytes = Encoding::ASCII->GetBytes(message); + + // resolve the server name + IPHostEntry^ resolvedServer = Dns::GetHostEntry(server); + + IPEndPoint^ ipEndPoint = + gcnew IPEndPoint(resolvedServer->AddressList[0], listenPort); + + // send the message + // the destination is defined by the IPEndPoint + udpClient->BeginSend(sendBytes, sendBytes->Length, ipEndPoint, + gcnew AsyncCallback(SendCallback), udpClient); + + // Do some work while we wait for the send to complete. For + // this example, we'll just sleep + while (!isMessageSent) + { + Thread::Sleep(100); + } + } + // + + // +public: + static void SendMessage3(String^ server, String^ message) + { + // create the udp socket + UdpClient^ udpClient = gcnew UdpClient(); + + array^ sendBytes = Encoding::ASCII->GetBytes(message); + + // send the message + // the destination is defined by the server name and port + udpClient->BeginSend(sendBytes, sendBytes->Length, server, listenPort, + gcnew AsyncCallback(SendCallback), udpClient); + + // Do some work while we wait for the send to complete. For + // this example, we'll just sleep + while (!isMessageSent) + { + Thread::Sleep(100); + } + } + // + +}; + +int main(array^ args) +{ + // Parse arguments + String^ server = ""; + String^ message = "This is a test!"; + bool isServer; + int sendMethod = 1; // n called SendMessagen + + if (args->Length == 0) + { + server = "localhost"; + isServer = false; + } + else if (args->Length == 1) + { + if (args[0] == "s") + { + isServer = true; + } + else + { + isServer = false; + } + } + else if (args->Length == 2) + { + if (args[0] == "s") + { + isServer = true; + } + else + { + isServer = false; + } + server = args[1]; + } + else if (args->Length == 3) + { + if (args[0] == "s") + { + isServer = true; + } + else + { + isServer = false; + } + server = args[1]; + message = args[2]; + } + else if (args->Length == 4) + { + if (args[0] == "s") + { + isServer = true; + } + else + { + isServer = false; + } + server = args[1]; + message = args[2]; + + try + { + sendMethod = Convert::ToInt32(args[3]); + } + catch (System::ArgumentNullException^ ex) + { + Console::WriteLine(ex->Message); + } + catch (System::FormatException^ ex) + { + Console::WriteLine(ex->Message); + } + catch (System::OverflowException^ ex) + { + Console::WriteLine(ex->Message); + } + } + else + { + Console::WriteLine( + "Usage: asyncudp [s|c] [host name] [message] [send method]"); + return 0; + } + + if (isServer) + { + UdpClientExample::ReceiveMessages(); + } + else + { + switch (sendMethod) + { + case 1: + UdpClientExample::SendMessage1(server, message); + break; + case 2: + UdpClientExample::SendMessage2(server, message); + break; + case 3: + UdpClientExample::SendMessage3(server, message); + break; + } + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp new file mode 100644 index 00000000000..69d3a8ab9a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_client.cpp @@ -0,0 +1,56 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +static void main() +{ + // Register TCP Channel. + ChannelServices::RegisterChannel( gcnew TcpChannel ); + + // + // Create activated client type entry. + ActivatedClientTypeEntry^ activatedClientTypeEntry = gcnew ActivatedClientTypeEntry( HelloServer::typeid, "tcp://localhost:8082" ); + + // + // Register type on client to activate it on the server. + RemotingConfiguration::RegisterActivatedClientType( activatedClientTypeEntry ); + + // Activate a client activated object type. + HelloServer^ helloServer = gcnew HelloServer( "ParameterString" ); + + // + // Print the object type. + Console::WriteLine( "Object type of client activated object: {0}", activatedClientTypeEntry->ObjectType->ToString() ); + + // + // + // Print the application URL. + Console::WriteLine( "Application url where the type is activated: {0}", activatedClientTypeEntry->ApplicationUrl->ToString() ); + + // + // + // Print the string representation of the type entry. + Console::WriteLine( "Type and assembly name and application URL of the remote object: {0}", activatedClientTypeEntry->ToString() ); + + // + // Print a blank line. + Console::WriteLine(); + + // Check that server was located. + if ( !helloServer ) + { + Console::WriteLine( "Could not locate server" ); + } + else + { + Console::WriteLine( "Calling remote object" ); + Console::WriteLine( helloServer->HelloMethod( "Bill" ) ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp new file mode 100644 index 00000000000..a394900be3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_server.cpp @@ -0,0 +1,19 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +void main() +{ + ChannelServices::RegisterChannel( gcnew TcpChannel( 8082 ) ); + RemotingConfiguration::RegisterActivatedServiceType( HelloServer::typeid ); + Console::WriteLine( "Press enter to stop this process" ); + Console::ReadLine(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp new file mode 100644 index 00000000000..ba2e8f35ea8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.ActivatedClientTypeEntry/CPP/activatedclienttypeentry_share.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; +public ref class HelloServer: public MarshalByRefObject +{ +public: + HelloServer( String^ myString ) + { + Console::WriteLine( "HelloServer activated" ); + Console::WriteLine( "Paramater passed to the constructor is {0}", myString ); + } + + String^ HelloMethod( String^ myName ) + { + Console::WriteLine( "HelloMethod : {0}", myName ); + return String::Format( "Hi there {0}", myName ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp new file mode 100644 index 00000000000..b590a6fac71 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/client.cpp @@ -0,0 +1,47 @@ + + +// +#using +#using +#using "RemoteObject.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Activation; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +[STAThread] +int main() +{ + + // Report initial status. + Console::WriteLine( "Client starting." ); + + // Register TCP channel. + ChannelServices::RegisterChannel( gcnew TcpChannel ); + + // + // Create UrlAttribute. + UrlAttribute^ attribute = gcnew UrlAttribute( "tcp://localhost:1234/RemoteApp" ); + Console::WriteLine( "UrlAttribute value: {0}", attribute->UrlValue ); + + // + array^activationAttributes = {attribute}; + + // Use UrlAttribute to register for client activated remote object. + RemotingConfiguration::RegisterActivatedClientType( RemoteObject::typeid, "tcp://localhost:1234/RemoteApp" ); + + // Activate remote object. + Console::WriteLine( "Activating remote object." ); + RemoteObject ^ obj = dynamic_cast(Activator::CreateInstance( RemoteObject::typeid, nullptr, activationAttributes )); + + // Invoke a method on it. + Console::WriteLine( "Invoking Hello() on remote object." ); + obj->Hello(); + + // Inform user of termination. + Console::WriteLine( "Terminating client." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp new file mode 100644 index 00000000000..9ce57af4de1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/remoteobject.cpp @@ -0,0 +1,27 @@ + +// +using namespace System; +using namespace System::Security; +using namespace System::Security::Permissions; + +[assembly:AllowPartiallyTrustedCallersAttribute]; +public ref class RemoteObject: public MarshalByRefObject +{ +public: + RemoteObject() + { + + // Report object construction to server's console. + Console::WriteLine( "You have called the constructor." ); + } + + void Hello() + { + + // Report method invocation to server's console. + Console::WriteLine( "You have called Hello()." ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp new file mode 100644 index 00000000000..d6e404eb60d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Activation.UrlAttribute/CPP/server.cpp @@ -0,0 +1,35 @@ + + +// +#using +#using +#using "RemoteObject.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +[STAThread] +int main() +{ + + // Report status to user. + Console::WriteLine( "Server starting." ); + + // Register the TCP channel. + ChannelServices::RegisterChannel( gcnew TcpChannel( 1234 ) ); + + // Set application name. + RemotingConfiguration::ApplicationName = "RemoteApp"; + + // Register object for client activated remoting. + RemotingConfiguration::RegisterActivatedServiceType( RemoteObject::typeid ); + + // Wait until termination. + Console::WriteLine( "Press enter to end." ); + Console::ReadLine(); + Console::WriteLine( "Terminating server." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp new file mode 100644 index 00000000000..7fd2481de46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client.cpp @@ -0,0 +1,68 @@ + +/// Class: System.Runtime.Remoting.Channels.Http.HttpClientChannel +/// 10 class - client +/// 40 class - server +/// 30 class - remotable object +/// 21 #ctor(IDictionary,IClientChannelSinkProvider) +/// 22 #ctor(string,sinkProvider) +/// 11 CreateMessageSink +/// 12 Item +/// 12 Keys +/// 13 Parse +// +#using +#using +#using "common.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +void main() +{ + // Create the channel. + HttpClientChannel^ clientChannel = gcnew HttpClientChannel; + + // Register the channel. + ChannelServices::RegisterChannel( clientChannel ); + + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( RemoteObject::typeid,L"http://localhost:9090/RemoteObject.rem" ); + RemotingConfiguration::RegisterWellKnownClientType( remoteType ); + + // + // Create a message sink. + String^ objectUri; + System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( L"http://localhost:9090/RemoteObject.rem", nullptr, objectUri ); + Console::WriteLine( L"The URI of the message sink is {0}.", objectUri ); + if ( messageSink != nullptr ) + { + Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() ); + } + // + + // + // Display the channel's properties using Keys and Item. + for each(String^ key in clientChannel->Keys) + { + Console::WriteLine("clientChannel[{0}] = <{1}>", key, clientChannel[key]); + } + // + + // + // Parse the channel's URI. + String^ objectUrl = L"http://localhost:9090/RemoteObject.rem"; + String^ channelUri = clientChannel->Parse( objectUrl, objectUri ); + Console::WriteLine( L"The object URL is {0}.", objectUrl ); + Console::WriteLine( L"The object URI is {0}.", objectUri ); + Console::WriteLine( L"The channel URI is {0}.", channelUri ); + // + + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + Console::WriteLine( L"The client is invoking the remote object." ); + Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp new file mode 100644 index 00000000000..82c72ff9ce5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/client2.cpp @@ -0,0 +1,93 @@ + +/// x broken +/// + done +/// 9 number of snippet +/// Need snippets: +/// 21 #ctor(IDictionary,IClientChannelSinkProvider) +/// 22 #ctor(string,sinkProvider) +/// 11 CreateMessageSink +/// 12 Item +/// 12 Keys +/// 13 Parse +#using +#using +#using "common.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +static HttpClientChannel^ Ctor1() +{ + + // + // Create a client channel. + System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable; + properties->default[ L"port" ] = 9090; + IClientChannelSinkProvider^ sinkProvider = nullptr; + HttpClientChannel^ clientChannel = gcnew HttpClientChannel( properties,sinkProvider ); + + // + return clientChannel; +} + +static HttpClientChannel^ Ctor2() +{ + + // + // Create a client channel. + String^ name = L"RemotingClient"; + IClientChannelSinkProvider^ sinkProvider = nullptr; + HttpClientChannel^ clientChannel = gcnew HttpClientChannel( name,sinkProvider ); + + // + return clientChannel; +} + +static void Register( HttpClientChannel^ channel ) +{ + + // Register the channel. + ChannelServices::RegisterChannel( channel ); + + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( + RemoteObject::typeid, L"http://localhost:9090/RemoteObject.rem" ); + RemotingConfiguration::RegisterWellKnownClientType( remoteType ); +} + +static void InvokeRemoteObject( RemoteObject^ service ) +{ + + // Invoke a method on the remote object. + Console::WriteLine( L"The client is invoking the remote object." ); + Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); +} + +void main() +{ + array^args = Environment::GetCommandLineArgs(); + + // Create the channel. + HttpClientChannel^ clientChannel = nullptr; + String^ overload = args[ 1 ]; + if ( overload->Equals( L"1" ) ) + clientChannel = Ctor1(); + else + if ( overload->Equals( L"2" ) ) + clientChannel = Ctor2(); + else + throw gcnew Exception( String::Format( L"Argument {0} was invalid.", args[ 1 ] ) ); + + + + // Register the channel and the client. + Register( clientChannel ); + + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + InvokeRemoteObject( service ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp new file mode 100644 index 00000000000..48993e10a85 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/common.cpp @@ -0,0 +1,22 @@ +// +#using +using namespace System; +using namespace System::Runtime::Remoting; + +// Remote object. +public ref class RemoteObject: public MarshalByRefObject +{ +private: + static int callCount = 0; + +public: + int GetCount() + { + Console::WriteLine( L"GetCount was called." ); + callCount++; + return (callCount); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp new file mode 100644 index 00000000000..644ca673c78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpClientChannel/CPP/server.cpp @@ -0,0 +1,26 @@ +// +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +void main() +{ + // Create the server channel. + HttpServerChannel^ serverChannel = gcnew HttpServerChannel( 9090 ); + + // Register the server channel. + ChannelServices::RegisterChannel( serverChannel ); + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( RemoteObject::typeid, L"RemoteObject.rem", WellKnownObjectMode::Singleton ); + + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp new file mode 100644 index 00000000000..0bc567804aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/client.cpp @@ -0,0 +1,31 @@ +// +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +void main() +{ + // Create the channel. + HttpClientChannel^ channel = gcnew HttpClientChannel; + + // Register the channel. + ChannelServices::RegisterChannel( channel ); + + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( + RemoteObject::typeid,L"http://localhost:9090/RemoteObject.rem" ); + RemotingConfiguration::RegisterWellKnownClientType( remoteType ); + + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + Console::WriteLine( L"The client is invoking the remote object." ); + Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp new file mode 100644 index 00000000000..db03ebf8070 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/common.cpp @@ -0,0 +1,19 @@ +// +using namespace System; +using namespace System::Runtime::Remoting; + +// Remote object. +public ref class RemoteObject: public MarshalByRefObject +{ +private: + static int callCount = 0; + +public: + int GetCount() + { + callCount++; + return (callCount); + } + +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp new file mode 100644 index 00000000000..52710e3ce2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server.cpp @@ -0,0 +1,91 @@ +/// Class: System.Runtime.Remoting.Channels.Http.HttpServerChannel +/// 20 class - server +/// 30 class - client +/// 40 class - remotable object +/// 12 ctor(IDictionary,IServerChannelSinkProvider) +/// 13 ctor(string,int) +/// 14 ctor(string,int,IServerChannelSinkProvider) +/// 21 ChannelScheme +/// 23 ChannelSinkChain +/// 22 GetChannelUri() +/// 25 Parse() +/// 24 WantsToListen +/// ! Ctor() +/// ! AddHookChannelUri +/// ! Item +/// ! Keys +/// ! StartListening +/// ! StopListening +/// Bug Notes [01-26-04][Mon] +/// AddHookChannelUri does not pick up port. +/// Ctor() would be usable if AddHookChannelUri could be +/// used to set the port later. Since it can't Ctor() is +/// also unusable. Items and Keys are unimplemented. While +/// StopListening works, StartListening does not restart +/// listening -- client fails. These two are likely to be +/// used as a pair and are therefore unusable. +// +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +int main() +{ + // Create the server channel. + HttpServerChannel^ serverChannel = gcnew HttpServerChannel( 9090 ); + + // Register the server channel. + ChannelServices::RegisterChannel( serverChannel ); + + // + // Display the channel's scheme. + Console::WriteLine( L"The channel scheme is {0}.", serverChannel->ChannelScheme ); + + // + // + // Display the channel's URI. + Console::WriteLine( L"The channel URI is {0}.", serverChannel->GetChannelUri() ); + + // + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid, L"RemoteObject.rem", WellKnownObjectMode::Singleton ); + + // + // Get the channel's sink chain. + IServerChannelSink^ sinkChain = serverChannel->ChannelSinkChain; + Console::WriteLine( L"The type of the server channel's sink chain is {0}.", sinkChain->GetType() ); + + // + // + // See if the channel wants to listen. + bool wantsToListen = serverChannel->WantsToListen; + Console::WriteLine( L"The value of WantsToListen is {0}.", wantsToListen ); + + // + // + // Parse the channel's URI. + array^ urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" ); + if ( urls->Length > 0 ) + { + String^ objectUrl = urls[ 0 ]; + String^ objectUri; + String^ channelUri = serverChannel->Parse( objectUrl, objectUri ); + Console::WriteLine( L"The object URI is {0}.", objectUri ); + Console::WriteLine( L"The channel URI is {0}.", channelUri ); + Console::WriteLine( L"The object URL is {0}.", objectUrl ); + } + + + // + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp new file mode 100644 index 00000000000..845f7224e29 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Http.HttpServerChannel/CPP/server2.cpp @@ -0,0 +1,97 @@ +/// Legend: +/// - Bugs +/// x Done +/// Work in progress +/// Snippets needed: +/// - Ctor() +/// x Ctor(IDictionary,IServerChannelSinkProvider) +/// x Ctor(string,int) +/// x Ctor(string,int,IServerChannelSinkProvider) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +static HttpServerChannel^ Ctor2() +{ + // + System::Collections::Hashtable^ properties = gcnew System::Collections::Hashtable; + properties->default[ L"port" ] = 9090; + IServerChannelSinkProvider^ sinkProvider = nullptr; + HttpServerChannel^ serverChannel = gcnew HttpServerChannel( properties,sinkProvider ); + + // + return serverChannel; +} + +// Broken. +static HttpServerChannel^ Ctor1() +{ + // + HttpServerChannel^ serverChannel = gcnew HttpServerChannel; + serverChannel->AddHookChannelUri( L"http://localhost:9090" ); + + // + // return serverChannel; + // Return good channel until fix. + return Ctor2(); +} + +static HttpServerChannel^ Ctor3() +{ + // + String^ name = L"RemotingServer"; + int port = 9090; + HttpServerChannel^ serverChannel = gcnew HttpServerChannel( name,port ); + + // + return serverChannel; +} + +static HttpServerChannel^ Ctor4() +{ + + // + String^ name = L"RemotingServer"; + int port = 9090; + IServerChannelSinkProvider^ sinkProvider = nullptr; + HttpServerChannel^ serverChannel = gcnew HttpServerChannel( + name,port,sinkProvider ); + + // + return serverChannel; +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + HttpServerChannel^ serverChannel = nullptr; + String^ overload = args[ 1 ]; + if ( overload->Equals( L"1" ) ) serverChannel = Ctor1(); + else if ( overload->Equals( L"2" ) ) serverChannel = Ctor2(); + else if ( overload->Equals( L"3" ) ) serverChannel = Ctor3(); + else if ( overload->Equals( L"4" ) ) serverChannel = Ctor4(); + else throw gcnew Exception( String::Format( + L"Argument {0} was invalid.", args[ 1 ] ) ); + + // Register the server channel. + ChannelServices::RegisterChannel( serverChannel ); + + // Display the channel's URI. + Console::WriteLine( L"The URI of the channel is {0}.", + serverChannel->GetChannelUri() ); + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid, L"RemoteObject.rem", + WellKnownObjectMode::Singleton ); + + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp new file mode 100644 index 00000000000..4c49318b1c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/client.cpp @@ -0,0 +1,46 @@ +// +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting::Channels::Ipc; + +void main() +{ + + // + // Create the channel. + IpcChannel^ channel = gcnew IpcChannel; + + // + // Register the channel. + System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel(channel); + + // Register as client for remote object. + System::Runtime::Remoting::WellKnownClientTypeEntry^ remoteType = gcnew + System::Runtime::Remoting::WellKnownClientTypeEntry( + RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem" ); + System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownClientType(remoteType); + + // + // Create a message sink. + String^ objectUri; + System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = channel->CreateMessageSink( + L"ipc://localhost:9090/RemoteObject.rem", nullptr, objectUri ); + Console::WriteLine( L"The URI of the message sink is {0}.", objectUri ); + if ( messageSink != nullptr ) + { + Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() ); + } + + + // + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + Console::WriteLine( L"The client is invoking the remote object." ); + Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp new file mode 100644 index 00000000000..8143f1ac9c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/common.cpp @@ -0,0 +1,21 @@ + +// +using namespace System; + +// Remote object. +public ref class RemoteObject: public MarshalByRefObject +{ +private: + static int callCount = 0; + +public: + int GetCount() + { + Console::WriteLine( L"GetCount has been called." ); + callCount++; + return (callCount); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp new file mode 100644 index 00000000000..fb005b99e64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server.cpp @@ -0,0 +1,76 @@ +/// Class: System.Runtime.Remoting.Channels.Ipc.IpcChannel +/// 10 class - Server.cs +/// 20 class - Client.cs +/// 30 class - Common.cs +/// 21 #ctor() +/// 11 #ctor(string) +/// 41 #ctor(IDictionary,IClientChannelSinkProvider,IServerChannelSinkProvider) +/// 15 ChannelData +/// 12 ChannelName +/// 13 ChannelPriority +/// 22 CreateMessageSink() +/// 19 GetUrlsForUri() +/// 19 Parse() +/// ! StartListening() +/// ! StopListening() +// +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting::Channels::Ipc; + +void main() +{ + // + // Create the server channel. + IpcChannel^ serverChannel = gcnew IpcChannel( L"localhost:9090" ); + // + + // Register the server channel. + System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel( serverChannel ); + + // + // Show the name of the channel. + Console::WriteLine( L"The name of the channel is {0}.", serverChannel->ChannelName ); + // + + // + // Show the priority of the channel. + Console::WriteLine( L"The priority of the channel is {0}.", serverChannel->ChannelPriority ); + // + + // + // Show the URIs associated with the channel. + System::Runtime::Remoting::Channels::ChannelDataStore^ channelData = (System::Runtime::Remoting::Channels::ChannelDataStore^)serverChannel->ChannelData; + for each (String^ uri in channelData->ChannelUris) + { + Console::WriteLine("The channel URI is {0}.", uri); + } + // + + // Expose an object for remote calls. + System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid,L"RemoteObject.rem", + System::Runtime::Remoting::WellKnownObjectMode::Singleton); + + // + // Parse the channel's URI. + array^ urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" ); + if ( urls->Length > 0 ) + { + String^ objectUrl = urls[ 0 ]; + String^ objectUri; + String^ channelUri = serverChannel->Parse( objectUrl, objectUri ); + Console::WriteLine( L"The object URI is {0}.", objectUri ); + Console::WriteLine( L"The channel URI is {0}.", channelUri ); + Console::WriteLine( L"The object URL is {0}.", objectUrl ); + } + // + + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp new file mode 100644 index 00000000000..3bd26211f01 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcChannel/CPP/server2.cpp @@ -0,0 +1,43 @@ +/// Class: System.Runtime.Remoting.Channels.Ipc.IpcChannel +/// 41 #ctor(IDictionary,IClientChannelSinkProvider,IServerChannelSinkProvider) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +void main() +{ + + // + // Create the server channel. + System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable; + properties->default[ L"name" ] = L"ipc"; + properties->default[ L"priority" ] = L"20"; + properties->default[ L"portName" ] = L"localhost:9090"; + IpcChannel^ serverChannel = gcnew IpcChannel( properties,nullptr,nullptr ); + + // + // Register the server channel. + ChannelServices::RegisterChannel( serverChannel ); + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid, L"RemoteObject.rem", WellKnownObjectMode::Singleton ); + + // Show the URIs associated with the channel. + ChannelDataStore^ channelData = dynamic_cast(serverChannel->ChannelData); + System::Collections::IEnumerator^ myEnum = channelData->ChannelUris->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ uri = safe_cast(myEnum->Current); + Console::WriteLine( L"The channel URI is {0}.", uri ); + } + + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp new file mode 100644 index 00000000000..83717776b8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client.cpp @@ -0,0 +1,70 @@ +/// Class: System.Runtime.Remoting.Channels.Ipc.IpcClientChannel +/// 41 #ctor(IDictionary,IClientChannelSinkProvider) +/// 42 #ctor(String,IClientChannelSinkProvider) +/// 21 ChannelName +/// 23 ChannelPriority +/// 22 CreateMessageSink(String,Object,String@) +/// 24 Parse(String,String@) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +void main() +{ + + // Create the channel. + IpcClientChannel^ clientChannel = gcnew IpcClientChannel; + + // Register the channel. + System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel(clientChannel); + + // + // Show the name of the channel. + Console::WriteLine( L"The name of the channel is {0}.", clientChannel->ChannelName ); + + // + // + // Show the priority of the channel. + Console::WriteLine( L"The priority of the channel is {0}.", clientChannel->ChannelPriority ); + + // + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( + RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem" ); + System::Runtime::Remoting::RemotingConfiguration::RegisterWellKnownClientType(remoteType); + + // + // Create a message sink. + String^ messageSinkUri; + Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( + L"ipc://localhost:9090/RemoteObject.rem", nullptr, messageSinkUri ); + Console::WriteLine( L"The URI of the message sink is {0}.", messageSinkUri ); + if ( messageSink != nullptr ) + { + Console::WriteLine( L"The type of the message sink is {0}.", messageSink->GetType() ); + } + + + // + // + // Parse the object URL. + String^ objectUrl = L"ipc://localhost:9090/RemoteObject.rem"; + String^ objectUri; + String^ channelUri = clientChannel->Parse( objectUrl, objectUri ); + Console::WriteLine( L"The object URL is {0}.", objectUrl ); + Console::WriteLine( L"The object URI is {0}.", objectUri ); + Console::WriteLine( L"The channel URI is {0}.", channelUri ); + + // + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + Console::WriteLine( L"The client is invoking the remote object." ); + Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp new file mode 100644 index 00000000000..8b87bbee8c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcClientChannel/CPP/client2.cpp @@ -0,0 +1,73 @@ +/// Class: System.Runtime.Remoting.Channels.Ipc.IpcClientChannel +/// 41 #ctor(IDictionary,IClientChannelSinkProvider) +/// 42 #ctor(String,IClientChannelSinkProvider) +/// 21 ChannelName +/// 23 ChannelPriority +/// 22 CreateMessageSink(String,Object,String@) +/// 24 Parse(String,String@) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +static IpcClientChannel^ Ctor1() +{ + // + // Create the client channel. + System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable; + properties->default[ L"name" ] = L"ipc client"; + properties->default[ L"priority" ] = L"1"; + IClientChannelSinkProvider^ sinkProvider = nullptr; + IpcClientChannel^ clientChannel = gcnew IpcClientChannel( properties,sinkProvider ); + // + + return clientChannel; +} + +static IpcClientChannel^ Ctor2() +{ + // + // Create the client channel. + String^ name = L"ipc client"; + IClientChannelSinkProvider^ sinkProvider = nullptr; + IpcClientChannel^ clientChannel = gcnew IpcClientChannel( name,sinkProvider ); + // + + return clientChannel; +} + +void main() +{ + array^args = Environment::GetCommandLineArgs(); + + // Create the client channel. + IpcClientChannel^ clientChannel = nullptr; +// if ( false ) {} +// else + if ( args[ 1 ]->Equals( L"1" ) ) + clientChannel = Ctor1(); + else + if ( args[ 1 ]->Equals( L"2" ) ) + clientChannel = Ctor2(); + else + throw gcnew ApplicationException( L"Invalid argument." ); + + // Register the channel. + ChannelServices::RegisterChannel( clientChannel ); + + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( + RemoteObject::typeid,L"ipc://localhost:9090/RemoteObject.rem" ); + RemotingConfiguration::RegisterWellKnownClientType( remoteType ); + + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + Console::WriteLine( L"The client is invoking the remote object." ); + Console::WriteLine( L"The remote object has been called {0} times.", service->GetCount() ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp new file mode 100644 index 00000000000..81cd95206cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server.cpp @@ -0,0 +1,75 @@ +/// Class: System.Runtime.Remoting.Channels.Ipc.IpcServerChannel +/// 41 #ctor(IDictionary,IServerChannelSinkProvider) +/// 42 #ctor(String,String) +/// 43 #ctor(String,String,IServerChannelSinkProvider) +/// 15 ChannelData +/// 12 ChannelName +/// 13 ChannelPriority +/// 19 GetUrlsForUri +/// 19 Parse(String,String@) +/// ! StartListening(Object) +/// ! StopListening(Object) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +void main() +{ + // Create the server channel. + IpcServerChannel^ serverChannel = gcnew IpcServerChannel( L"localhost:9090" ); + + // Register the server channel. + System::Runtime::Remoting::Channels::ChannelServices::RegisterChannel( serverChannel ); + + // + // Show the name of the channel. + Console::WriteLine( L"The name of the channel is {0}.",serverChannel->ChannelName ); + // + + // + // Show the priority of the channel. + Console::WriteLine( L"The priority of the channel is {0}.",serverChannel->ChannelPriority ); + // + + // + // Show the URIs associated with the channel. + System::Runtime::Remoting::Channels::ChannelDataStore^ channelData = + static_cast + (serverChannel->ChannelData); + System::Collections::IEnumerator^ myEnum = channelData->ChannelUris->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ uri = safe_cast( myEnum->Current ); + Console::WriteLine( L"The channel URI is {0}.",uri ); + } + // + + // Expose an object for remote calls. + System::Runtime::Remoting::RemotingConfiguration:: + RegisterWellKnownServiceType( + RemoteObject::typeid,L"RemoteObject.rem", + System::Runtime::Remoting::WellKnownObjectMode::Singleton ); + + // + // Parse the channel's URI. + array^urls = serverChannel->GetUrlsForUri( L"RemoteObject.rem" ); + if ( urls->Length > 0 ) + { + String^ objectUrl = urls[ 0 ]; + String^ objectUri; + String^ channelUri = serverChannel->Parse( objectUrl,objectUri ); + Console::WriteLine( L"The object URI is {0}.",objectUri ); + Console::WriteLine( L"The channel URI is {0}.",channelUri ); + Console::WriteLine( L"The object URL is {0}.",objectUrl ); + } + // + + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp new file mode 100644 index 00000000000..41624295c75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Ipc.IpcServerChannel/CPP/server2.cpp @@ -0,0 +1,86 @@ +/// Class: System.Runtime.Remoting.Channels.Ipc.IpcServerChannel +/// 41 #ctor(IDictionary,IServerChannelSinkProvider) +/// 42 #ctor(String,String) +/// 43 #ctor(String,String,IServerChannelSinkProvider) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Ipc; + +static IpcServerChannel^ Ctor1() +{ + // + // Create the server channel. + System::Collections::IDictionary^ properties = gcnew System::Collections::Hashtable; + properties->default[ L"name" ] = L"ipc"; + properties->default[ L"priority" ] = L"20"; + properties->default[ L"portName" ] = L"localhost:9090"; + IpcServerChannel^ serverChannel = gcnew IpcServerChannel( properties, nullptr ); + + // + return serverChannel; +} + +static IpcServerChannel^ Ctor2() +{ + // + // Create the server channel. + String^ name = L"ipc"; + String^ portName = L"localhost:9090"; + IpcServerChannel^ serverChannel = gcnew IpcServerChannel( name,portName ); + + // + return serverChannel; +} + +static IpcServerChannel^ Ctor3() +{ + // + // Create the server channel. + String^ name = L"ipc"; + String^ portName = L"localhost:9090"; + IServerChannelSinkProvider^ sinkProvider = nullptr; + IpcServerChannel^ serverChannel = gcnew IpcServerChannel( name,portName,sinkProvider ); + + // + return serverChannel; +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + + // Create the server channel. + IpcServerChannel^ serverChannel = nullptr; + if ( false ) {} + else if ( args[ 1 ]->Equals( L"1" ) ) serverChannel = Ctor1(); + else if ( args[ 1 ]->Equals( L"2" ) ) serverChannel = Ctor2(); + else if ( args[ 1 ]->Equals( L"3" ) ) serverChannel = Ctor3(); + else throw gcnew ApplicationException( L"Invalid argument." ); + + // Register the server channel. + ChannelServices::RegisterChannel( serverChannel ); + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid, L"RemoteObject.rem", + WellKnownObjectMode::Singleton ); + + // Show the URIs associated with the channel. + ChannelDataStore^ channelData = static_cast(serverChannel->ChannelData); + System::Collections::IEnumerator^ myEnum = channelData->ChannelUris->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ uri = static_cast(myEnum->Current); + Console::WriteLine( L"The channel URI is {0}.", uri ); + } + + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp new file mode 100644 index 00000000000..5318cdac4b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/client.cpp @@ -0,0 +1,51 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Security::Permissions; + +int main(array^ args) +{ + // + // Create the channel. + TcpChannel^ clientChannel = gcnew TcpChannel(); + // + + // Register the channel. + ChannelServices::RegisterChannel(clientChannel, false); + + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( + RemoteObject::typeid,"tcp://localhost:9090/RemoteObject.rem"); + RemotingConfiguration::RegisterWellKnownClientType(remoteType); + + // + // Create a message sink. + String^ objectUri; + System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = + clientChannel->CreateMessageSink( + "tcp://localhost:9090/RemoteObject.rem", nullptr, + objectUri); + Console::WriteLine("The URI of the message sink is {0}.", + objectUri); + if (messageSink != nullptr) + { + Console::WriteLine("The type of the message sink is {0}.", + messageSink->GetType()->ToString()); + } + // + + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject(); + + // Invoke a method on the remote object. + Console::WriteLine("The client is invoking the remote object."); + Console::WriteLine("The remote object has been called {0} times.", + service->GetCount()); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp new file mode 100644 index 00000000000..a84a5d0ff07 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/common.cpp @@ -0,0 +1,25 @@ + +// +using namespace System; +using namespace System::Runtime::Remoting; + +// Remote object. +public ref class RemoteObject: public MarshalByRefObject +{ +private: + int callCount; + +public: + RemoteObject() + : callCount( 0 ) + {} + + int GetCount() + { + callCount++; + return (callCount); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp new file mode 100644 index 00000000000..5fbb4596bd1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel/CPP/server.cpp @@ -0,0 +1,68 @@ +/// class: System.Runtime.Remoting.Channels.Tcp.TcpChannel +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Security::Permissions; + +[SecurityPermission(SecurityAction::Demand)] +int main(array^ args) +{ + // + // Create the server channel. + TcpChannel^ serverChannel = gcnew TcpChannel(9090); + // + + // Register the server channel. + ChannelServices::RegisterChannel(serverChannel); + + // + // Show the name of the channel. + Console::WriteLine("The name of the channel is {0}.", + serverChannel->ChannelName); + // + + // + // Show the priority of the channel. + Console::WriteLine("The priority of the channel is {0}.", + serverChannel->ChannelPriority); + // + + // + // Show the URIs associated with the channel. + ChannelDataStore^ data = (ChannelDataStore^) serverChannel->ChannelData; + for each (String^ uri in data->ChannelUris) + { + Console::WriteLine("The channel URI is {0}.", uri); + } + // + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid, "RemoteObject.rem", + WellKnownObjectMode::Singleton); + + // + // Parse the channel's URI. + array^ urls = serverChannel->GetUrlsForUri("RemoteObject.rem"); + if (urls->Length > 0) + { + String^ objectUrl = urls[0]; + String^ objectUri; + String^ channelUri = serverChannel->Parse(objectUrl, objectUri); + Console::WriteLine("The object URL is {0}.", objectUrl); + Console::WriteLine("The object URI is {0}.", objectUri); + Console::WriteLine("The channel URI is {0}.", channelUri); + } + // + + // Wait for the user prompt. + Console::WriteLine("Press ENTER to exit the server."); + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp new file mode 100644 index 00000000000..f4d15c4f152 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpChannel2/CPP/server.cpp @@ -0,0 +1,54 @@ + + +#using +#using +#using "common.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +int main() +{ + // + // Specify the properties for the server channel. + System::Collections::IDictionary^ dict = gcnew System::Collections::Hashtable; + dict[ "port" ] = 9090; + dict[ "authenticationMode" ] = "IdentifyCallers"; + + // Set up the server channel. + TcpChannel^ serverChannel = gcnew TcpChannel( dict,nullptr,nullptr ); + ChannelServices::RegisterChannel( serverChannel ); + // + + // Show the name and priority of the channel. + Console::WriteLine( "The name of the channel is {0}.", serverChannel->ChannelName ); + Console::WriteLine( "The priority of the channel is {0}.", serverChannel->ChannelPriority ); + + // Show the URIs associated with the channel. + ChannelDataStore^ data = dynamic_cast(serverChannel->ChannelData); + for each (String^ uri in data->ChannelUris) + { + Console::WriteLine("The channel URI is {0}.", uri); + } + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( RemoteObject::typeid, "RemoteObject.rem", WellKnownObjectMode::Singleton ); + + // Parse the channel's URI. + array^urls = serverChannel->GetUrlsForUri( "RemoteObject.rem" ); + if ( urls->Length > 0 ) + { + String^ objectUrl = urls[ 0 ]; + String^ objectUri; + String^ channelUri = serverChannel->Parse( objectUrl, objectUri ); + Console::WriteLine( "The object URL is {0}.", objectUrl ); + Console::WriteLine( "The object URI is {0}.", objectUri ); + Console::WriteLine( "The channel URI is {0}.", channelUri ); + } + + // Wait for the user prompt. + Console::WriteLine( "Press enter to terminate the server." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp new file mode 100644 index 00000000000..83994f5bc7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpClientChannel/CPP/client.cpp @@ -0,0 +1,57 @@ + + +// class: System.Runtime.Remoting.Channels.Tcp.TcpClientChannel +// client.cs: +// Ctor(string, IClientChannelSinkProvider) +// CreateMessageSink +// Parse +// +#using +#using +#using "common.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +int main() +{ + + // + // Create the channel. + TcpClientChannel^ clientChannel = gcnew TcpClientChannel( "Client",nullptr ); + + // + // Register the channel. + ChannelServices::RegisterChannel( clientChannel ); + + // Register as client for remote object. + WellKnownClientTypeEntry^ remoteType = gcnew WellKnownClientTypeEntry( RemoteObject::typeid,"tcp://localhost:9090/RemoteObject.rem" ); + RemotingConfiguration::RegisterWellKnownClientType( remoteType ); + + // + // Create a message sink. + String^ objectUri; + System::Runtime::Remoting::Messaging::IMessageSink^ messageSink = clientChannel->CreateMessageSink( "tcp://localhost:9090/RemoteObject.rem", nullptr, objectUri ); + Console::WriteLine( "The URI of the message sink is {0}.", objectUri ); + Console::WriteLine( "The type of the message sink is {0}.", messageSink->GetType() ); + + // + // + // Parse the channel's URI. + String^ objectUrl = "tcp://localhost:9090/RemoteObject.rem"; + String^ channelUri = clientChannel->Parse( objectUrl, objectUri ); + Console::WriteLine( "The object URL is {0}.", objectUrl ); + Console::WriteLine( "The object URI is {0}.", objectUri ); + Console::WriteLine( "The channel URI is {0}.", channelUri ); + + // + // Create an instance of the remote object. + RemoteObject^ service = gcnew RemoteObject; + + // Invoke a method on the remote object. + Console::WriteLine( "The client is invoking the remote object." ); + Console::WriteLine( "The remote object has been called {0} times.", service->GetCount() ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp new file mode 100644 index 00000000000..3f6748f6f96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel.2/CPP/server.cpp @@ -0,0 +1,44 @@ + + +/// Snippets needed: +/// 21 Ctor(string, int) +#using +#using +#using "common.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; +int main() +{ + // + // Create the server channel. + TcpServerChannel^ channel = gcnew TcpServerChannel( "Server Channel",9090 ); + + // + // Register the server channel. + ChannelServices::RegisterChannel( channel ); + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( Remotable::typeid, "Remotable.rem", WellKnownObjectMode::Singleton ); + + // Display the channel's URI. + Console::WriteLine( "The channel URI is {0}.", channel->GetChannelUri() ); + + // Parse the channel's URI. + array^urls = channel->GetUrlsForUri( "Remotable.rem" ); + if ( urls->Length > 0 ) + { + String^ objectUrl = urls[ 0 ]; + String^ objectUri; + String^ channelUri = channel->Parse( objectUrl, objectUri ); + Console::WriteLine( "The object URI is {0}.", objectUri ); + Console::WriteLine( "The channel URI is {0}.", channelUri ); + Console::WriteLine( "The object URL is {0}.", objectUrl ); + } + + // Wait for the user prompt. + Console::WriteLine( "Press enter to terminate the server." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp new file mode 100644 index 00000000000..f7e0ccdcfef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Channels.Tcp.TcpServerChannel/CPP/server.cpp @@ -0,0 +1,55 @@ +/// Class: System.Runtime.Remoting.Channels.Tcp.TcpServerChannel +/// 21 Ctor(string, int, IServerChannelSinkProvider) +/// 22 GetChannelUri(); +/// 23 Parse(); +/// ! Ctor(string, int) +#using +#using +#using "common.dll" +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Tcp; + +void main() +{ + // + // Create the server channel. + TcpServerChannel^ channel = gcnew TcpServerChannel( + L"Server Channel",9090,nullptr ); + // + + // Register the server channel. + ChannelServices::RegisterChannel( channel ); + + // Expose an object for remote calls. + RemotingConfiguration::RegisterWellKnownServiceType( + RemoteObject::typeid, L"RemoteObject.rem", + WellKnownObjectMode::Singleton ); + + // + // Display the channel's URI. + Console::WriteLine( L"The channel URI is {0}.", + channel->GetChannelUri() ); + // + + // + // Parse the channel's URI. + array^urls = channel->GetUrlsForUri( L"RemoteObject.rem" ); + if ( urls->Length > 0 ) + { + String^ objectUrl = urls[ 0 ]; + String^ objectUri; + String^ channelUri = channel->Parse( objectUrl, objectUri ); + Console::WriteLine( L"The object URI is {0}.", objectUri ); + Console::WriteLine( L"The channel URI is {0}.", channelUri ); + Console::WriteLine( L"The object URL is {0}.", objectUrl ); + } + // + + // Wait for the user prompt. + Console::WriteLine( L"Press ENTER to exit the server." ); + Console::ReadLine(); + Console::WriteLine( L"The server is exiting." ); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp new file mode 100644 index 00000000000..4c0cf07dc06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Lifetime/CPP/server.cpp @@ -0,0 +1,29 @@ + + +// +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Runtime::Remoting::Lifetime; + +int main() +{ + LifetimeServices::LeaseTime = TimeSpan::FromSeconds( 5 ); + LifetimeServices::LeaseManagerPollTime = TimeSpan::FromSeconds( 3 ); + LifetimeServices::RenewOnCallTime = TimeSpan::FromSeconds( 2 ); + LifetimeServices::SponsorshipTimeout = TimeSpan::FromSeconds( 1 ); + ChannelServices::RegisterChannel( gcnew HttpChannel( 8080 ) ); + RemotingConfiguration::RegisterActivatedServiceType( ClientActivatedType::typeid ); + Console::WriteLine( "The server is listening. Press Enter to exit...." ); + Console::ReadLine(); + Console::WriteLine( "GC'ing." ); + GC::Collect(); + GC::WaitForPendingFinalizers(); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp new file mode 100644 index 00000000000..f1a1fd691e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.SoapMethodAttribute/CPP/demo.cpp @@ -0,0 +1,69 @@ +/// Class: System.Runtime.Remoting.Metadata.SoapMethodAttribute +/// 100 class +/// 110 ResponseXmlElementName +/// 110 ResponseXmlNamespace +/// 110 ReturnXmlElementName +/// 110 SoapAction +/// 110 XmlNamespace +/// ! #ctor cannot be snippeted because attribute is not constructed +/// using new, but rather implicitly constructed through an attribute +/// tag. +/// +/// ! UseAttribute cannot be snippeted because exception is thrown. +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata; + +namespace ExampleNamespace +{ + public ref class ExampleClass + { + public: + // + [SoapMethod( + ResponseXmlElementName="ExampleResponseElement", + ResponseXmlNamespace= + "http://example.org/MethodResponseXmlNamespace", + ReturnXmlElementName="HelloMessage", + SoapAction="http://example.org/ExampleSoapAction#GetHello", + XmlNamespace="http://example.org/MethodCallXmlNamespace")] + String^ GetHello( String^ name ) + { + return String::Format( L"Hello, {0}", name ); + } + // + }; + +} + +int main() +{ + + // Get the method info object for the GetHello method. + System::Reflection::MethodBase^ getHelloMethod = + ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); + + // Print the XML namespace for the invocation of this method. + String^ methodCallXmlNamespace = + System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall( + getHelloMethod ); + Console::WriteLine( L"The XML namespace for the response of the method " + L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace ); + + // Print the XML namespace for the response of this method. + String^ methodResponseXmlNamespace = + System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall( + getHelloMethod ); + Console::WriteLine( L"The XML namespace for the invocation of the method " + L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace ); + + // Print the SOAP action for this method. + String^ getHelloSoapAction = + System::Runtime::Remoting::SoapServices::GetXmlNamespaceForMethodCall( + getHelloMethod ); + Console::WriteLine( L"The SOAP action for the method " + L"GetHello in ExampleClass is {0}.", getHelloSoapAction ); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp new file mode 100644 index 00000000000..58dea746266 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo.cpp @@ -0,0 +1,50 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri +/// 10 class +/// 21 #ctor() +/// 22 #ctor(string) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// +/// Bugs in SoapAnyUri: None found. +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapAnyUri object. + String^ xsdAnyUri = L"http://localhost:8080/WebService"; + SoapAnyUri^ anyUri = SoapAnyUri::Parse( xsdAnyUri ); + // + + // + // Print the value of the SoapAnyUri object in XSD format. + Console::WriteLine( L"The SoapAnyUri object in XSD format is {0}.", anyUri ); + // + + // + // Print the XSD type string of the SoapAnyUri object. + Console::WriteLine( L"The XSD type of the SoapAnyUri " + L"object is {0}.", anyUri->GetXsdType() ); + // + + // + // Print the value of the SoapAnyUri object. + Console::WriteLine( L"The value of the SoapAnyUri object is {0}.", anyUri->Value ); + + // + // + // Print the XSD type string of the SoapAnyUri class. + Console::WriteLine( L"The XSD type of the SoapAnyUri class " + L"is {0}.", SoapAnyUri::XsdType ); + // + + return 1; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp new file mode 100644 index 00000000000..c8ca68e2b1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapAnyUri/CPP/demo2.cpp @@ -0,0 +1,34 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(string) +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapAnyUri object. + SoapAnyUri^ anyUri = gcnew SoapAnyUri; + anyUri->Value = L"http://localhost:8080/WebService"; + Console::WriteLine( L"The value of the SoapAnyUri object is {0}.", anyUri ); + // +} + +static void Ctor2() +{ + // + // Create a SoapAnyUri object. + String^ anyUriValue = L"http://localhost:8080/WebService"; + SoapAnyUri^ anyUri = gcnew SoapAnyUri( anyUriValue ); + Console::WriteLine( L"The value of the SoapAnyUri object is {0}.", anyUri ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp new file mode 100644 index 00000000000..e73224d01e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo.cpp @@ -0,0 +1,57 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary +/// 10 class +/// 21 #ctor() +/// 22 #ctor(byte[]) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapBase64Binary: +/// No bugs were detected. +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapBase64Binary object. + // The string "AgMFBws=" is byte[]{ 2, 3, 5, 7, 11 } expressed in + // Base 64 format. + String^ xsdBase64Binary = L"AgMFBws="; + SoapBase64Binary^ base64Binary = SoapBase64Binary::Parse( xsdBase64Binary ); + // + + // + // Print the value of the SoapBase64Binary object in XSD format. + Console::WriteLine( L"The SoapBase64Binary object in XSD format is {0}.", + base64Binary ); + // + + // + // Print the XSD type string of the SoapBase64Binary object. + Console::WriteLine( L"The XSD type of the SoapBase64Binary " + L"object is {0}.", base64Binary->GetXsdType() ); + // + + // + // Print the value of the SoapBase64Binary object. + Console::Write( L"base64Binary.Value contains:" ); + for ( int i = 0; i < base64Binary->Value->Length; ++i ) + { + Console::Write( L" {0}", base64Binary->Value[ i ] ); + + } + Console::WriteLine(); + // + + // + // Print the XSD type string of the SoapBase64Binary class. + Console::WriteLine( L"The XSD type of the class SoapBase64Binary " + L"is {0}.", SoapBase64Binary::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp new file mode 100644 index 00000000000..296902a8a0e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapBase64Binary/CPP/demo2.cpp @@ -0,0 +1,40 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapBase64Binary object. + SoapBase64Binary^ base64Binary = gcnew SoapBase64Binary; + base64Binary->Value = gcnew array(7){ + 2,3,5,7,11,0,5 + }; + Console::WriteLine( L"The SoapBase64Binary object is {0}.", + base64Binary ); + // +} + +static void Ctor2() +{ + // + // Create a SoapBase64Binary object. + array^bytes = gcnew array(5){ + 2,3,5,7,11 + }; + SoapBase64Binary^ base64Binary = gcnew SoapBase64Binary( bytes ); + Console::WriteLine( L"The SoapBase64Binary object is {0}.", + base64Binary ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp new file mode 100644 index 00000000000..7f234a9eb5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo.cpp @@ -0,0 +1,55 @@ +/// Need snippets: +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 23 #ctor(DateTime,int) +/// 13 GetXsdType +/// 11 Parse +/// 15 Sign +/// 12 ToString +/// 14 Value +/// 16 XsdType + +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD date to create a SoapDate object. + String^ xsdDate = "2003-02-04"; + SoapDate^ date = SoapDate::Parse( xsdDate ); + // + + // + // Serialize a DateTime object as an XSD date string. + Console::WriteLine( "The date in XSD format is {0}.", + date ); + // + + // + // Print out the XSD type string of this particular SoapDate object. + Console::WriteLine( "The XSD type of the SoapDate instance is {0}.", + date->GetXsdType() ); + // + + // + // Print out the value of the SoapDate object. + Console::WriteLine( "The value of the SoapDate instance is {0}.", + date->Value ); + // + + // + // Print out the sign of the SoapDate object. + Console::WriteLine( "The sign of the SoapDate instance is {0}.", + date->Sign ); + // + + // + // Print out the XSD type string of the SoapDate class. + Console::WriteLine( "The XSD type of SoapDate is {0}.", + SoapDate::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp new file mode 100644 index 00000000000..668a507b945 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDate/CPP/demo2.cpp @@ -0,0 +1,42 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 23 #ctor(DateTime,int) + +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +void Ctor1() +{ + // + // Create a SoapDate object. + SoapDate^ date = gcnew SoapDate; + date->Value = DateTime::Now; + Console::WriteLine( "The date is {0}.", date ); + // +} + +void Ctor2() +{ + // + // Create a SoapDate object. + SoapDate^ date = gcnew SoapDate( DateTime::Now ); + Console::WriteLine( "The date is {0}.", date ); + // +} + +void Ctor3() +{ + // + // Create a SoapDate object with a positive sign. + SoapDate^ date = gcnew SoapDate( DateTime::Now,1 ); + Console::WriteLine( "The date is {0}.", date ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); + Ctor3(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp new file mode 100644 index 00000000000..413b5d7bcba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDateTime/CPP/demo.cpp @@ -0,0 +1,34 @@ + +/// Need snippets: +/// ! #ctor +/// x Parse +/// x ToString +/// x XsdType +/// +/// Bug report: +/// Constructor unusable since all methods are static. +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; +int main() +{ + + // + // Parse an XSD dateTime to create a DateTime object. + String^ xsdDateTime = "2003-02-04T13:58:59.9999999+03:00"; + DateTime dateTime = SoapDateTime::Parse( xsdDateTime ); + + // + // + // Serialize a DateTime object as an XSD dateTime string. + Console::WriteLine( "The date in XSD format is {0}.", SoapDateTime::ToString( dateTime ) ); + + // + // + // Print out the XSD type string of the SoapDateTime class. + Console::WriteLine( "The XSD type of SoapDateTime is {0}.", SoapDateTime::XsdType ); + + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp new file mode 100644 index 00000000000..176bd8d588a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo.cpp @@ -0,0 +1,61 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay +/// Need snippets: +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// +/// Bugs: +/// +/// 1. Documentation bug: according to the XML spec and the code +/// SoapDay.Parse(string) should accept the format "---ddzzz" and +/// "---dd"; the documentation states that SoapDay.Parse(string) +/// accepts "ddzzz" (which it does not). For gDay examples, see +/// http://books.xmlschemata.org/relaxng/ch17-77066.html. +/// 2. Documentation bug: zzz cannot be in this format "08:00". It +/// must equal "Z" or it must be in one of these formats: "+08:00" +/// or "-08:00". Without the leading "+" or "-" sign Parse(string) +/// fails. + +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD gDay to create a SoapDay object. + // The time zone of this object is +08:00. + String^ xsdDay = "---30+08:00"; + SoapDay^ day = SoapDay::Parse( xsdDay ); + // + + // + // Display the day in XSD format. + Console::WriteLine( "The day in XSD format is {0}.", + day ); + // + + // + // Display the XSD type string of this particular SoapDay object. + Console::WriteLine( "The XSD type of the SoapDay instance is {0}.", + day->GetXsdType() ); + // + + // + // Display the value of the SoapDay object. + Console::WriteLine( "The value of the SoapDay instance is {0}.", + day->Value ); + // + + // + // Display the XSD type string of the SoapDay class. + Console::WriteLine( "The XSD type of the class SoapDay is {0}.", + SoapDay::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp new file mode 100644 index 00000000000..e070d48be10 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDay/CPP/demo2.cpp @@ -0,0 +1,31 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) + +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +void Ctor1() +{ + // + // Create a SoapDay object. + SoapDay^ day = gcnew SoapDay; + day->Value = DateTime::Now; + Console::WriteLine( "The day is {0}.", day ); + // +} + +void Ctor2() +{ + // + // Create a SoapDay object. + SoapDay^ day = gcnew SoapDay( DateTime::Now ); + Console::WriteLine( "The day is {0}.", day ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp new file mode 100644 index 00000000000..cb673df07d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration/CPP/demo.cpp @@ -0,0 +1,49 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapDuration +/// 10 class +/// ! #ctor +/// 11 Parse() +/// 12 ToString() +/// 13 XsdType +/// +/// Bug report: +/// The constructor is unusable since all methods are static. +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD duration to create a TimeSpan object. + // This is a duration of 2 years, 3 months, 9 days, 12 hours, + // 35 minutes, 20 seconds, and 10 milliseconds. + String^ xsdDuration = L"P2Y3M9DT12H35M20.0100000S"; + TimeSpan timeSpan = SoapDuration::Parse( xsdDuration ); + Console::WriteLine( L"The time span contains {0} days.", + timeSpan.Days ); + Console::WriteLine( L"The time span contains {0} hours.", + timeSpan.Hours ); + Console::WriteLine( L"The time span contains {0} minutes.", + timeSpan.Minutes ); + Console::WriteLine( L"The time span contains {0} seconds.", + timeSpan.Seconds ); + // + + // + // Serialize a TimeSpan object as an XSD duration string. + // This object represents a time span of 399 days, 12 hours, + // 35 minutes, 20 seconds, and 10 milliseconds. + TimeSpan duration = TimeSpan(399,12,35,20,10); + Console::WriteLine( L"The duration in XSD format is {0}.", + SoapDuration::ToString( duration ) ); + // + + // + // Print the XSD type string of the SoapDuration class. + Console::WriteLine( L"The XSD type of SoapDuration is {0}.", + SoapDuration::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp new file mode 100644 index 00000000000..f07c6ddafe8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo.cpp @@ -0,0 +1,56 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary +/// 10 class +/// 21 #ctor() +/// 22 #ctor(byte[]) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapHexBinary: +/// No bugs were detected. +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapHexBinary object. + String^ xsdHexBinary = L"3f789ABC"; + SoapHexBinary^ hexBinary = SoapHexBinary::Parse( xsdHexBinary ); + // + + // + // Print the value of the SoapHexBinary object in XSD format. + Console::WriteLine( L"The SoapHexBinary object in XSD format is {0}.", + hexBinary ); + // + + // + // Print the XSD type string of this particular SoapHexBinary object. + Console::WriteLine( L"The XSD type of the SoapHexBinary object is {0}.", + hexBinary->GetXsdType() ); + // + + // + // Print the value of the SoapHexBinary object. + Console::Write( L"hexBinary.Value contains:" ); + for ( int i = 0; i < hexBinary->Value->Length; ++i ) + { + Console::Write( L" {0}", hexBinary->Value[ i ] ); + + } + Console::WriteLine(); + // + + // + // Print the XSD type string of the SoapHexBinary class. + Console::WriteLine( L"The XSD type of the class SoapHexBinary is {0}.", + SoapHexBinary::XsdType ); + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp new file mode 100644 index 00000000000..dc7d28b8f1a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapHexBinary/CPP/demo2.cpp @@ -0,0 +1,38 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapHexBinary object. + SoapHexBinary^ hexBinary = gcnew SoapHexBinary; + hexBinary->Value = gcnew array(5){ + 2,3,5,7,11 + }; + Console::WriteLine( L"The SoapHexBinary object is {0}.", hexBinary ); + // +} + +static void Ctor2() +{ + // + // Create a SoapHexBinary object. + array^ bytes = gcnew array(5){ + 2,3,5,7,11 + }; + SoapHexBinary^ hexBinary = gcnew SoapHexBinary( bytes ); + Console::WriteLine( L"The SoapHexBinary object is {0}.", hexBinary ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp new file mode 100644 index 00000000000..fb6f8987512 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo.cpp @@ -0,0 +1,50 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger +/// 10 class +/// 21 #ctor() +/// 22 #ctor(decimal) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapInteger: +/// No bugs were detected. +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapInteger object. + String^ xsdIntegerString = L"-13"; + SoapInteger^ xsdInteger = SoapInteger::Parse( xsdIntegerString ); + // + + // + // Print the value of the SoapInteger object in XSD format. + Console::WriteLine( L"The SoapInteger object in XSD format is {0}.", + xsdInteger ); + // + + // + // Print the XSD type string of the SoapInteger object. + Console::WriteLine( L"The XSD type of the SoapInteger " + L"object is {0}.", xsdInteger->GetXsdType() ); + // + + // + // Print the value of the SoapInteger object. + Console::WriteLine( L"The value of the SoapInteger object is {0}.", + xsdInteger->Value ); + // + + // + // Print the XSD type string of the SoapInteger class. + Console::WriteLine( L"The XSD type of the SoapInteger class is {0}.", + SoapInteger::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp new file mode 100644 index 00000000000..1ce5d78cc1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapInteger/CPP/demo2.cpp @@ -0,0 +1,36 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapInteger object. + SoapInteger^ xsdInteger = gcnew SoapInteger; + xsdInteger->Value = -14; + Console::WriteLine( L"The value of the SoapInteger object is {0}.", + xsdInteger ); + // +} + +static void Ctor2() +{ + // + // Create a SoapInteger object. + Decimal decimalValue = -14; + SoapInteger^ xsdInteger = gcnew SoapInteger( decimalValue ); + Console::WriteLine( L"The value of the SoapInteger object is {0}.", + xsdInteger ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp new file mode 100644 index 00000000000..93620f32b0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo.cpp @@ -0,0 +1,69 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// +/// Bugs in SoapMonth: +/// +/// 1. SoapMonth.Parse interprets timezone inconsistently: The +/// following both reduce the month by 1. Either they should not +/// alter the month. Or the first one should reduce but the second +/// one should not: +/// SoapMonth.Parse("--02--+08:00").ToString() // Prints "--01--". +/// SoapMonth.Parse("--02---07:00").ToString() // Prints "--01--". +/// +/// 2. SoapMonth.Parse throws exception when the timezone is "Z": +/// SoapMonth.Parse throws the following exception, +/// System.FormatException: String was not recognized as a valid DateTime. +/// when invoked as follows, +/// SoapMonth.Parse("--02--Z"); // Throws exception. +/// It fails to correctly interpret Z as the current timezone. +/// +/// 3. SoapMonth.Parse documentation incorrect: The documentation +/// states that Parse can accept months formatted as "05", "01". +/// This is incorrect. The acceptable formats (according to the code +/// and according to the XML spec) are: "--MM--" and "--MM--zzz". + +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD gMonth to create a SoapMonth object. + // The timezone of this object is +08:00. + String^ xsdMonth = "--02--+08:00"; + SoapMonth^ month = SoapMonth::Parse( xsdMonth ); + // + + // + // Print the month in XSD format. + Console::WriteLine( "The month in XSD format is {0}.", + month ); + // + + // + // Print the XSD type string of this particular SoapMonth object. + Console::WriteLine( "The XSD type of the SoapMonth instance is {0}.", + month->GetXsdType() ); + // + + // + // Print the value of the SoapMonth object. + Console::WriteLine( "The value of the SoapMonth instance is {0}.", + month->Value ); + // + + // + // Print the XSD type string of the SoapMonth class. + Console::WriteLine( "The XSD type of the class SoapMonth is {0}.", + SoapMonth::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp new file mode 100644 index 00000000000..b8fcf45cfc3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonth/CPP/demo2.cpp @@ -0,0 +1,31 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) + +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +void Ctor1() +{ + // + // Create a SoapMonth object. + SoapMonth^ month = gcnew SoapMonth; + month->Value = DateTime::Now; + Console::WriteLine( "The month is {0}.", month ); + // +} + +void Ctor2() +{ + // + // Create a SoapMonth object. + SoapMonth^ month = gcnew SoapMonth( DateTime::Now ); + Console::WriteLine( "The month is {0}.", month ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp new file mode 100644 index 00000000000..cef26ec71c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo.cpp @@ -0,0 +1,62 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapMonthDay: +/// 1. SoapMonthDay.Parse throws exception when the time zone is "Z": +/// SoapMonthDay.Parse throws the following exception, +/// System.FormatException: String was not recognized +/// as a valid DateTime. +/// when invoked as follows, +/// SoapMonthDay.Parse("--02--Z"); // Throws exception. +/// It fails to correctly interpret "Z" as the current time zone. +/// +/// 2. SoapMonthDay.Parse documentation incorrect: The documentation +/// does not state how to compose a SoapMonthDay for Parse. It also +/// incorrectly states that "08:00" is a valid time zone (this should +/// be "+08:00"). +// +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD gMonthDay to create a SoapMonthDay object. + // Parse the representation for February 21, in the UTC+8 time zone. + String^ xsdMonthDay = L"--02-21+08:00"; + SoapMonthDay^ monthDay = SoapMonthDay::Parse( xsdMonthDay ); + // + + // + // Print the monthDay in XSD format. + Console::WriteLine( L"The SoapMonthDay object in XSD format is {0}.", + monthDay ); + // + + // + // Print the XSD type string of this particular SoapMonthDay object. + Console::WriteLine( L"The XSD type of the SoapMonthDay object is {0}.", + monthDay->GetXsdType() ); + // + + // + // Print the value of the SoapMonthDay object. + Console::WriteLine( L"The value of the SoapMonthDay object is {0}.", + monthDay->Value ); + // + + // + // Print the XSD type string of the SoapMonthDay class. + Console::WriteLine( L"The XSD type of the class SoapMonthDay is {0}.", + SoapMonthDay::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp new file mode 100644 index 00000000000..f0109194443 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapMonthDay/CPP/demo2.cpp @@ -0,0 +1,33 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapMonthDay object. + SoapMonthDay^ monthDay = gcnew SoapMonthDay; + monthDay->Value = DateTime::Now; + Console::WriteLine( L"The SoapMonthDay object is {0}.", monthDay ); + // +} + +static void Ctor2() +{ + // + // Create a SoapMonthDay object. + SoapMonthDay^ monthDay = gcnew SoapMonthDay( DateTime::Now ); + Console::WriteLine( L"The SoapMonthDay object is {0}.", monthDay ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp new file mode 100644 index 00000000000..3dd233fe9fd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo.cpp @@ -0,0 +1,51 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger +/// 10 class +/// 21 #ctor() +/// 22 #ctor(Decimal) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapNegativeInteger: +/// No bugs were detected. +// +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapNegativeInteger + // object. + String^ xsdIntegerString = L"-13"; + SoapNegativeInteger^ xsdInteger = SoapNegativeInteger::Parse( + xsdIntegerString ); + // + + // + // Print the value of the SoapNegativeInteger object in XSD format. + Console::WriteLine( L"The SoapNegativeInteger object in XSD format is {0}.", + xsdInteger ); + // + + // + // Print the XSD type string of the SoapNegativeInteger object. + Console::WriteLine( L"The XSD type of the SoapNegativeInteger " + L"object is {0}.", xsdInteger->GetXsdType() ); + // + + // + // Print the value of the SoapNegativeInteger object. + Console::WriteLine( L"The value of the SoapNegativeInteger " + L"object is {0}.", xsdInteger->Value ); + // + + // + // Print the XSD type string of the SoapNegativeInteger class. + Console::WriteLine( L"The XSD type of the SoapNegativeInteger class " + L"is {0}.", SoapNegativeInteger::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp new file mode 100644 index 00000000000..bc37451f56c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNegativeInteger/CPP/demo2.cpp @@ -0,0 +1,35 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; +static void Ctor1() +{ + // + // Create a SoapNegativeInteger object. + SoapNegativeInteger^ xsdInteger = gcnew SoapNegativeInteger; + xsdInteger->Value = -14; + Console::WriteLine( L"The value of the SoapNegativeInteger object is {0}.", + xsdInteger ); + // +} + +static void Ctor2() +{ + // + // Create a SoapNegativeInteger object. + Decimal decimalValue = -14; + SoapNegativeInteger^ xsdInteger = gcnew SoapNegativeInteger( + decimalValue ); + Console::WriteLine( L"The value of the SoapNegativeInteger object is {0}.", + xsdInteger ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp new file mode 100644 index 00000000000..bfe4587163d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo.cpp @@ -0,0 +1,54 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger +/// 10 class +/// 21 #ctor() +/// 22 #ctor(Decimal) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapNonNegativeInteger: +/// No bugs were detected. +// +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapNonNegativeInteger + // object. + String^ xsdIntegerString = L"+13"; + SoapNonNegativeInteger^ xsdInteger = SoapNonNegativeInteger::Parse( + xsdIntegerString ); + // + + // + // Print the value of the SoapNonNegativeInteger object + // in XSD format. + Console::WriteLine( + L"The SoapNonNegativeInteger object in XSD format is {0}.", + xsdInteger ); + // + + // + // Print the XSD type string of the SoapNonNegativeInteger object. + Console::WriteLine( L"The XSD type of the SoapNonNegativeInteger " + L"object is {0}.", xsdInteger->GetXsdType() ); + // + + // + // Print the value of the SoapNonNegativeInteger object. + Console::WriteLine( L"The value of the SoapNonNegativeInteger " + L"object is {0}.", xsdInteger->Value ); + // + + // + // Print the XSD type string of the SoapNonNegativeInteger class. + Console::WriteLine( L"The XSD type of the SoapNonNegativeInteger class " + L"is {0}.", SoapNonNegativeInteger::XsdType ); + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp new file mode 100644 index 00000000000..073b01560aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonNegativeInteger/CPP/demo2.cpp @@ -0,0 +1,33 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapNonNegativeInteger object. + SoapNonNegativeInteger^ xsdInteger = gcnew SoapNonNegativeInteger; + xsdInteger->Value = +14; + Console::WriteLine( L"The value of the SoapNonNegativeInteger object is {0}.", xsdInteger ); + // +} + +static void Ctor2() +{ + // + // Create a SoapNonNegativeInteger object. + Decimal decimalValue = +14; + SoapNonNegativeInteger^ xsdInteger = gcnew SoapNonNegativeInteger( decimalValue ); + Console::WriteLine( L"The value of the SoapNonNegativeInteger object is {0}.", xsdInteger ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp new file mode 100644 index 00000000000..2c51262dcca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo.cpp @@ -0,0 +1,53 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger +/// 10 class +/// 21 #ctor() +/// 22 #ctor(Decimal) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapNonPositiveInteger: +/// No bugs were detected. +// +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapNonPositiveInteger + // object. + String^ xsdIntegerString = L"-13"; + SoapNonPositiveInteger^ xsdInteger = + SoapNonPositiveInteger::Parse( xsdIntegerString ); + // + + // + // Print the value of the SoapNonPositiveInteger object + // in XSD format. + Console::WriteLine( L"The SoapNonPositiveInteger object in XSD format is {0}.", + xsdInteger ); + // + + // + // Print the XSD type string of the SoapNonPositiveInteger object. + Console::WriteLine( L"The XSD type of the SoapNonPositiveInteger object is {0}.", + xsdInteger->GetXsdType() ); + // + + // + // Print the value of the SoapNonPositiveInteger object. + Console::WriteLine( L"The value of the SoapNonPositiveInteger object is {0}.", + xsdInteger->Value ); + // + + // + // Print the XSD type string of the SoapNonPositiveInteger class. + Console::WriteLine( L"The XSD type of the SoapNonPositiveInteger class is {0}.", + SoapNonPositiveInteger::XsdType ); + // +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp new file mode 100644 index 00000000000..1ab5dc805a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNonPositiveInteger/CPP/demo2.cpp @@ -0,0 +1,36 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapNonPositiveInteger object. + SoapNonPositiveInteger^ xsdInteger = gcnew SoapNonPositiveInteger; + xsdInteger->Value = -14; + Console::WriteLine( L"The value of the SoapNonPositiveInteger object is {0}.", + xsdInteger ); + // +} + +static void Ctor2() +{ + // + // Create a SoapNonPositiveInteger object. + Decimal decimalValue = -14; + SoapNonPositiveInteger^ xsdInteger = gcnew SoapNonPositiveInteger( + decimalValue ); + Console::WriteLine( L"The value of the SoapNonPositiveInteger object is {0}.", + xsdInteger ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp new file mode 100644 index 00000000000..8b481e05ce0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo.cpp @@ -0,0 +1,79 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString +/// 10 class +/// 21 #ctor() +/// 22 #ctor(string) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +// +/// Bugs in SoapNormalizedString: None found. +/// +// +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void TestParse( String^ testString ) +{ + try + { + // + // Parse the test string. + SoapNormalizedString^ normalized = SoapNormalizedString::Parse( + testString ); + // + + // Report that the parse succeeded if no exception was thrown. + Console::WriteLine( L"Parse succeeded on the string \"{0}\".", + testString ); + + // + // Print the string representation of the object. + Console::WriteLine( L"The normalized value of this string is \"{0}\".", + normalized ); + // + + // + // Print the XSD type of the object. + Console::WriteLine( L"The XSD type of the SoapNormalizedString object is {0}.", + normalized->GetXsdType() ); + // + + // + // Print the value of the SoapNormalizedString object. + Console::WriteLine( L"The value of the SoapNormalizedString object is \"{0}\".", + normalized->Value ); + // + } + catch ( System::Runtime::Remoting::RemotingException^ e ) + { + // Report the details of the exception that was thrown. + Console::WriteLine( L"Parse failed on the string \"{0}\".", + testString ); + Console::WriteLine( e->Message ); + } +} + +int main() +{ + // Create strings to test the Parse method. + String^ stringWithSpaces = L"one two"; + String^ stringWithSpacesAndTabs = L"one two\t"; + String^ stringWithSpacesAndLineFeed = L"one two\n"; + String^ stringWithSpacesAndCarriageReturn = L"one two\r"; + + // Test the Parse method with each string. + TestParse( stringWithSpaces ); + TestParse( stringWithSpacesAndTabs ); + TestParse( stringWithSpacesAndLineFeed ); + TestParse( stringWithSpacesAndCarriageReturn ); + + // + // Print the XSD type string of the SoapNormalizedString class. + Console::WriteLine( L"The XSD type of the SoapNormalizedString class is {0}.", + SoapNormalizedString::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp new file mode 100644 index 00000000000..1641c8861fe --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapNormalizedString/CPP/demo2.cpp @@ -0,0 +1,36 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(string) +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapNormalizedString object. + SoapNormalizedString^ normalized = gcnew SoapNormalizedString; + normalized->Value = L"one two"; + Console::WriteLine( L"The value of the SoapNormalizedString object is {0}.", + normalized ); + // +} + +static void Ctor2() +{ + // + // Create a SoapNormalizedString object. + String^ testString = L"one two"; + SoapNormalizedString^ normalized = gcnew SoapNormalizedString( + testString ); + Console::WriteLine( L"The value of the SoapNormalizedString object is {0}.", + normalized ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp new file mode 100644 index 00000000000..38f2440c827 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo.cpp @@ -0,0 +1,51 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger +/// 10 class +/// 21 #ctor() +/// 22 #ctor(Decimal) +/// 13 GetXsdType() +/// 11 Parse() +/// 12 ToString() +/// 14 Value +/// 16 XsdType +/// Bugs in SoapPositiveInteger: +/// No bugs were detected. +// +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapPositiveInteger + // object. + String^ xsdIntegerString = L"+13"; + SoapPositiveInteger^ xsdInteger = + SoapPositiveInteger::Parse( xsdIntegerString ); + // + + // + // Print the value of the SoapPositiveInteger object in XSD format. + Console::WriteLine( L"The SoapPositiveInteger object in XSD format is {0}.", + xsdInteger ); + // + + // + // Print the XSD type string of the SoapPositiveInteger object. + Console::WriteLine( L"The XSD type of the SoapPositiveInteger " + L"object is {0}.", xsdInteger->GetXsdType() ); + // + + // + // Print the value of the SoapPositiveInteger object. + Console::WriteLine( L"The value of the SoapPositiveInteger object is {0}.", + xsdInteger->Value ); + // + + // + // Print the XSD type string of the SoapPositiveInteger class. + Console::WriteLine( L"The XSD type of the SoapPositiveInteger class " + L"is {0}.", SoapPositiveInteger::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp new file mode 100644 index 00000000000..1992569528a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapPositiveInteger/CPP/demo2.cpp @@ -0,0 +1,35 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapPositiveInteger object. + SoapPositiveInteger^ xsdInteger = gcnew SoapPositiveInteger; + xsdInteger->Value = 14; + Console::WriteLine( L"The value of the SoapPositiveInteger object is {0}.", + xsdInteger ); + // +} + +static void Ctor2() +{ + // + // Create a SoapPositiveInteger object. + Decimal decimalValue = 14; + SoapPositiveInteger^ xsdInteger = gcnew SoapPositiveInteger( decimalValue ); + Console::WriteLine( L"The value of the SoapPositiveInteger object is {0}.", + xsdInteger ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp new file mode 100644 index 00000000000..4e39d11bf3f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo.cpp @@ -0,0 +1,73 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName +/// 10 class +/// 21 #ctor() +/// 22 #ctor(string) +/// 23 #ctor(string,string) +/// 24 #ctor(string,string,string) +/// 13 GetXsdType() +/// 17 Key +/// 18 Name +/// 19 Namespace +/// 11 Parse() +/// 12 ToString() +/// 16 XsdType +/// +/// Bugs in SoapQName: +/// 1. SoapQName.Namespace is not used anywhere. The field exists but has +/// no clear purpose. It cannot be parsed. +/// 2. SoapQName.Name cannot contain a ':', however, this is not validated +/// in the code anywhere. SoapQName.Parse("a:b:c").Name results in "b:c", +/// which is an invalid name. +// +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD formatted string to create a SoapQName object. + String^ xsdQName = L"tns:SomeName"; + SoapQName^ qName = SoapQName::Parse( xsdQName ); + // + + // + // Print the value of the SoapQName object in XSD format. + Console::WriteLine( L"The SoapQName object in XSD format is {0}.", qName ); + // + + // + // Print the XSD type string of the SoapQName object. + Console::WriteLine( L"The XSD type of the SoapQName " + L"object is {0}.", qName->GetXsdType() ); + // + + // + // Print the XSD type string of the SoapQName class. + Console::WriteLine( L"The XSD type of the SoapQName class " + L"is {0}.", SoapQName::XsdType ); + // + + // Create a QName object. + SoapQName^ soapQNameInstance = gcnew SoapQName( + L"tns",L"SomeName",L"http://example.org" ); + + // + // Print the key the SoapQName object. + Console::WriteLine( L"The key of the SoapQName object is {0}.", + soapQNameInstance->Key ); + // + + // + // Print the name of the SoapQName object. + Console::WriteLine( L"The name of the SoapQName " + L"object is {0}.", soapQNameInstance->Name ); + // + + // + // Print the namespace of the SoapQName class. + Console::WriteLine( L"The namespace for this instance of SoapQName is {0}.", + soapQNameInstance->Namespace ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp new file mode 100644 index 00000000000..7c2359708b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapQName/CPP/demo2.cpp @@ -0,0 +1,63 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(string) +/// 23 #ctor(string,string) +/// 24 #ctor(string,string,string) +#using +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +static void Ctor1() +{ + // + // Create a SoapQName object. + SoapQName^ qName = gcnew SoapQName; + Console::WriteLine( + L"The value of the SoapQName object is \"{0}\".", qName ); + // +} + +static void Ctor2() +{ + // + // Create a SoapQName object. + String^ name = L"SomeName"; + SoapQName^ qName = gcnew SoapQName( name ); + Console::WriteLine( + L"The value of the SoapQName object is \"{0}\".", qName ); + // +} + +static void Ctor3() +{ + // + // Create a SoapQName object. + String^ key = L"tns"; + String^ name = L"SomeName"; + SoapQName^ qName = gcnew SoapQName( key,name ); + Console::WriteLine( + L"The value of the SoapQName object is \"{0}\".", qName ); + // +} + +static void Ctor4() +{ + // + // Create a SoapQName object. + String^ key = L"tns"; + String^ name = L"SomeName"; + String^ namespaceValue = L"http://example.org"; + SoapQName^ qName = gcnew SoapQName( + key,name,namespaceValue ); + Console::WriteLine( + L"The value of the SoapQName object is \"{0}\".", qName ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); + Ctor3(); + Ctor4(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp new file mode 100644 index 00000000000..1192e22eec0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo.cpp @@ -0,0 +1,55 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime +/// Need snippets: +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 13 GetXsdType +/// 11 Parse +/// 12 ToString +/// 14 Value +/// 16 XsdType +/// +/// Bugs: +/// +/// Parse should take upto 9 digits in fractional seconds, but only +/// accepts up to 7. Also it only parses the first three, and ignores +/// the others (fractional second digits). + +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD gTime to create a SoapTime object. + // The timezone of this object is the current timezone. + String^ xsdTime = "12:13:14.123Z"; + SoapTime^ time = SoapTime::Parse( xsdTime ); + // + + // + // Display the time in XSD format. + Console::WriteLine( "The time in XSD format is {0}.", + time ); + // + + // + // Display the XSD type string of this particular SoapTime object. + Console::WriteLine( "The XSD type of the SoapTime instance is {0}.", + time->GetXsdType() ); + // + + // + // Display the value of the SoapTime object. + Console::WriteLine( "The value of the SoapTime instance is {0}.", + time->Value ); + // + + // + // Display the XSD type string of the SoapTime class. + Console::WriteLine( "The XSD type of the class SoapTime is {0}.", + SoapTime::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp new file mode 100644 index 00000000000..315eb68d565 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapTime/CPP/demo2.cpp @@ -0,0 +1,31 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) + +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +void Ctor1() +{ + // + // Create a SoapTime object. + SoapTime^ time = gcnew SoapTime; + time->Value = DateTime::Now; + Console::WriteLine( "The time is {0}.", time ); + // +} + +void Ctor2() +{ + // + // Create a SoapTime object. + SoapTime^ time = gcnew SoapTime( DateTime::Now ); + Console::WriteLine( "The time is {0}.", time ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp new file mode 100644 index 00000000000..0c90607a486 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo.cpp @@ -0,0 +1,55 @@ +/// Need snippets: +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 23 #ctor(DateTime,int) +/// 13 GetXsdType +/// 11 Parse +/// 15 Sign +/// 12 ToString +/// 14 Value +/// 16 XsdType + +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD date to create a SoapYear object. + String^ xsdDate = "2003"; + SoapYear^ date = SoapYear::Parse( xsdDate ); + // + + // + // Serialize a DateTime object as an XSD date string. + Console::WriteLine( "The date in XSD format is {0}.", + date ); + // + + // + // Print out the XSD type string of this particular SoapYear object. + Console::WriteLine( "The XSD type of the SoapYear instance is {0}.", + date->GetXsdType() ); + // + + // + // Print out the value of the SoapYear object. + Console::WriteLine( "The value of the SoapYear instance is {0}.", + date->Value ); + // + + // + // Print out the sign of the SoapYear object. + Console::WriteLine( "The sign of the SoapYear instance is {0}.", + date->Sign ); + // + + // + // Print out the XSD type string of the SoapYear class. + Console::WriteLine( "The XSD type of SoapYear is {0}.", + SoapYear::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp new file mode 100644 index 00000000000..aa3c6d2fbc1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYear/CPP/demo2.cpp @@ -0,0 +1,41 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 23 #ctor(DateTime,int) + +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; +void Ctor1() +{ + // + // Create a SoapYear object. + SoapYear^ date = gcnew SoapYear; + date->Value = DateTime::Now; + Console::WriteLine( "The date is {0}.", date ); + // +} + +void Ctor2() +{ + // + // Create a SoapYear object. + SoapYear^ date = gcnew SoapYear( DateTime::Now ); + Console::WriteLine( "The date is {0}.", date ); + // +} + +void Ctor3() +{ + // + // Create a SoapYear object with a positive sign. + SoapYear^ date = gcnew SoapYear( DateTime::Now,1 ); + Console::WriteLine( "The date is {0}.", date ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); + Ctor3(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp new file mode 100644 index 00000000000..0479bd8049d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo.cpp @@ -0,0 +1,57 @@ +/// Class: System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth +/// Need snippets: +/// 10 class +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 23 #ctor(DateTime,int) +/// 13 GetXsdType +/// 11 Parse +/// 15 Sign +/// 12 ToString +/// 14 Value +/// 16 XsdType + +// +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; + +int main() +{ + // + // Parse an XSD gYearMonth to create a SoapYearMonth object. + // The timezone of this object is -08:00. + String^ xsdYearMonth = "2003-11-08:00"; + SoapYearMonth^ yearMonth = SoapYearMonth::Parse( xsdYearMonth ); + // + + // + // Display the yearMonth in XSD format. + Console::WriteLine( "The yearMonth in XSD format is {0}.", + yearMonth ); + // + + // + // Display the XSD type string of this particular SoapYearMonth object. + Console::WriteLine( "The XSD type of the SoapYearMonth instance is {0}.", + yearMonth->GetXsdType() ); + // + + // + // Display the value of the SoapYearMonth object. + Console::WriteLine( "The value of the SoapYearMonth instance is {0}.", + yearMonth->Value ); + // + + // + // Display the sign of the SoapYearMonth object. + Console::WriteLine( "The sign of the SoapYearMonth instance is {0}.", + yearMonth->Sign ); + // + + // + // Display the XSD type string of the SoapYearMonth class. + Console::WriteLine( "The XSD type of the class SoapYearMonth is {0}.", + SoapYearMonth::XsdType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp new file mode 100644 index 00000000000..208e3500ca9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.Metadata.W3cXsd2001.SoapYearMonth/CPP/demo2.cpp @@ -0,0 +1,41 @@ +/// Need snippets: +/// 21 #ctor() +/// 22 #ctor(DateTime) +/// 23 #ctor(DateTime,int) + +using namespace System; +using namespace System::Runtime::Remoting::Metadata::W3cXsd2001; +void Ctor1() +{ + // + // Create a SoapYearMonth object. + SoapYearMonth^ year = gcnew SoapYearMonth; + year->Value = DateTime::Now; + Console::WriteLine( "The year is {0}.", year ); + // +} + +void Ctor2() +{ + // + // Create a SoapYearMonth object. + SoapYearMonth^ year = gcnew SoapYearMonth( DateTime::Now ); + Console::WriteLine( "The year is {0}.", year ); + // +} + +void Ctor3() +{ + // + // Create a SoapYearMonth object with a positive sign. + SoapYearMonth^ year = gcnew SoapYearMonth( DateTime::Now,1 ); + Console::WriteLine( "The year is {0}.", year ); + // +} + +int main() +{ + Ctor1(); + Ctor2(); + Ctor3(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp new file mode 100644 index 00000000000..8df0b7dcb47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.RemotingServices/CPP/remotingservicessample.cpp @@ -0,0 +1,232 @@ + + +// C:\Program Files\Microsoft::NET\FrameworkSDK\Samples\technologies\remoting\advanced\customproxies +// +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Messaging; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Reflection; +// + +// +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Runtime::Remoting::Lifetime; +using namespace System::Runtime::Remoting::Proxies; +// + +// +using namespace System::Runtime::Remoting::Channels::Http; +using namespace System::Net; +using namespace System::IO; +using namespace System::Security::Permissions; +// + +// +public ref class HelloServer: public MarshalByRefObject +{ +public: + HelloServer() + { + Console::WriteLine( "HelloServer activated." ); + } + + [OneWay] + void SayHelloToServer( String^ name ) + { + Console::WriteLine( "Client invoked SayHelloToServer(\" {0}\").", name ); + } + + // + // IsOneWay: Note the lack of the OneWayAttribute adornment on this method. + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + String^ SayHelloToServerAndWait( String^ name ) + { + Console::WriteLine( "Client invoked SayHelloToServerAndWait(\" {0}\").", name ); + Console::WriteLine( "Client waiting for return? {0}", RemotingServices::IsOneWay( MethodBase::GetCurrentMethod() ) ? (String^)"No" : "Yes" ); + return String::Format( "Hi there, {0}.", name ); + } + // +}; +// + +// +// An instance of ClientApp will call an instance of this class remotely. +public ref class TcpServerApp +{ +public: + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + TcpServerApp() + { + // Register a class over TCP at tcp://localhost:8085/HttpHelloServer. + const String^ myObjectUri = "TcpHelloServer"; + const int myPort = 8085; + TcpChannel^ myTcpChannel = gcnew TcpChannel( myPort ); + ChannelServices::RegisterChannel( myTcpChannel ); + RemotingConfiguration::RegisterWellKnownServiceType( HelloServer::typeid, const_cast(myObjectUri), WellKnownObjectMode::Singleton ); + // + + // + Console::WriteLine( "Server type: {0}", RemotingServices::GetServerTypeForUri( const_cast(myObjectUri) ) ); + // + + // + Console::WriteLine( "Press Enter to stop the demo." ); + Console::ReadLine(); + } + +}; +// + +// +public ref class HttpServerApp +{ +public: + [SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] + HttpServerApp() + { + // Marshal an Object* over HTTP at http://localhost:8090/HttpHelloServer. + const String^ myObjectUri = "HttpHelloServer"; + const int myPort = 8090; + HttpChannel^ myHttpChannel = gcnew HttpChannel( myPort ); + ChannelServices::RegisterChannel( myHttpChannel ); + MarshalByRefObject^ myMbro = dynamic_cast(Activator::CreateInstance( HelloServer::typeid )); + RemotingServices::SetObjectUriForMarshal( myMbro, const_cast(myObjectUri) ); + ObjRef^ myObjRef = RemotingServices::Marshal( myMbro ); + Console::WriteLine( "Press Enter to stop the demo." ); + Console::ReadLine(); + HelloServer^ umObj = dynamic_cast(RemotingServices::Unmarshal( myObjRef )); + RemotingServices::Disconnect( myMbro ); + } +}; +// + +// +// An instance of this class will call an instance of ServerApp remotely. +[SecurityPermissionAttribute(SecurityAction::Demand, Flags=SecurityPermissionFlag::Infrastructure)] +public ref class TcpClientApp +{ +public: + TcpClientApp() + { + const String^ myHelloServerUrl = "tcp://localhost:8085/TcpHelloServer"; + HelloServer^ obj = static_cast(RemotingServices::Connect( HelloServer::typeid, const_cast(myHelloServerUrl) )); + // + + // + //GetRealProxy, GetObjectUri, GetEnvoyChainForProxy + RealProxy^ proxy = RemotingServices::GetRealProxy( obj ); + Console::WriteLine( "Real proxy type: {0}", proxy->GetProxiedType() ); + Console::WriteLine( "Object URI: {0}", RemotingServices::GetObjectUri( obj ) ); + IMessageSink^ msgSink = RemotingServices::GetEnvoyChainForProxy( obj )->NextSink; + // + + // + //IsTransparentProxy, IsObjectOutOfAppDomain, IsObjectOutOfContext + Console::WriteLine( "Proxy transparent? {0}", RemotingServices::IsTransparentProxy( obj ) ? (String^)"Yes" : "No" ); + Console::WriteLine( "Object outside app domain? {0}", RemotingServices::IsObjectOutOfAppDomain( obj ) ? (String^)"Yes" : "No" ); + Console::WriteLine( "Object [Out] of* context? {0}", RemotingServices::IsObjectOutOfContext( obj ) ? (String^)"Yes" : "No" ); + // + + // + //GetLifetimeService + ILease^ lease = dynamic_cast(RemotingServices::GetLifetimeService( obj )); + Console::WriteLine( "Object lease time remaining: {0}.", lease->CurrentLeaseTime ); + // + + // + String^ twoWayMethodArg = "John"; + Console::WriteLine( "Invoking SayHelloToServerAndWait(\" {0}\").", twoWayMethodArg ); + Console::WriteLine( "Server returned: {0}", obj->SayHelloToServerAndWait( twoWayMethodArg ) ); + // + + // + String^ oneWayMethodArg = "Mary"; + Console::WriteLine( "Invoking SayHelloToServer(\" {0}\").", oneWayMethodArg ); + obj->SayHelloToServer( oneWayMethodArg ); + // + + // + } + // + + // +}; +// + +// +public ref class HttpClientApp +{ +public: + HttpClientApp() + { + const String^ myHelloServerUrl = "http://localhost:8090/HttpHelloServer"; + + // Output the WSDL for the marshalled Object*. + WebClient^ myWebClient = gcnew WebClient; + Stream^ myStream = myWebClient->OpenRead( String::Format( "{0}?wsdl", const_cast(myHelloServerUrl) ) ); + int b = myStream->ReadByte(); + while ( b != -1 ) + { + char p[2] = {(char)b}; + Console::Write( p ); + b = myStream->ReadByte(); + } + } + +}; +// + +// +int main() +{ + array^args = Environment::GetCommandLineArgs(); + // + + bool isServer = false; + if ( args->Length > 1 ) + if ( args[ 1 ]->ToLower()->Equals( "s" ) ) + isServer = true; + + if ( !isServer ) + { + Console::WriteLine( "Run this program in another window, \npassing the letter 's' as an argument.\nPress Enter here when the server has been activated." ); + Console::ReadLine(); + Console::WriteLine( "Running TCP client." ); + } + + // + if ( isServer ) + { + gcnew TcpServerApp; + } + else + { + gcnew TcpClientApp; + } + // + + if ( !isServer ) + { + Console::WriteLine( "\nPress Enter in the other window to continue to the next demo.\nThen press Enter here." ); + Console::ReadLine(); + } + + // + if ( isServer ) + { + gcnew HttpServerApp; + } + else + { + gcnew HttpClientApp; + } + // + + // + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp new file mode 100644 index 00000000000..dcfbf9f217f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Runtime.Remoting.SoapServices/CPP/demo.cpp @@ -0,0 +1,371 @@ +/// Class: System.Runtime.Remoting.SoapServices +/// 100 class +/// 101 CodeXmlNamespaceForClrTypeNamespace() +/// 102 DecodeXmlNamespaceForClrTypeNamespace() +/// 150 GetInteropFieldTypeAndNameFromXmlAttribute() +/// 150 GetInteropFieldTypeAndNameFromXmlElement() +/// 160 GetInteropTypeFromXmlElement() +/// 160 GetInteropTypeFromXmlType() +/// 140 GetSoapActionFromMethodBase() +/// 140 GetTypeAndMethodNameFromSoapAction() +/// 103 GetXmlElementForInteropType() +/// 105 GetXmlNamespaceForMethodCall() +/// 105 GetXmlNamespaceForMethodResponse() +/// 104 GetXmlTypeForInteropType() +/// 106 IsClrTypeNamespace() +/// 140 IsSoapActionValidForMethodBase() +/// 120 PreLoad(Assembly) +/// 121 PreLoad(Type) +/// 180 RegisterInteropXmlElement() +/// 190 RegisterInteropXmlType() +/// 170 RegisterSoapActionForMethodBase(MethodBase) +/// 170 RegisterSoapActionForMethodBase(MethodBase,String) +/// 130 XmlNsForClrType +/// 131 XmlNsForClrTypeWithAssembly +/// 132 XmlNsForClrTypeWithNs +/// 133 XmlNsForClrTypeWithNsAndAssembly +// +#using +using namespace System; +using namespace System::Runtime::Remoting; + +namespace ExampleNamespace +{ + [System::Runtime::Remoting::Metadata::SoapTypeAttribute( + XmlElementName="ExampleClassElementName", + XmlNamespace="http://example.org/ExampleXmlNamespace", + XmlTypeName="ExampleXmlTypeName", + XmlTypeNamespace="http://example.org/ExampleXmlTypeNamespace")] + public ref class ExampleClass + { + public: + + // A field that will be serialized as an XML element. + [System::Runtime::Remoting::Metadata::SoapField( + XmlElementName="ExampleFieldElementName", + XmlNamespace="http://example.org/ExampleFieldNamespace")] + String^ ExampleFieldUsingElement; + + // A field that will be serialized as an XML attribute. + [System::Runtime::Remoting::Metadata::SoapField( + XmlElementName="ExampleFieldAttributeName", + XmlNamespace="http://example.org/ExampleAttributeNamespace", + UseAttribute=true)] + String^ ExampleFieldUsingAttribute; + + [System::Runtime::Remoting::Metadata::SoapMethod( + SoapAction="http://example.org/ExampleSoapAction#GetHello")] + String^ GetHello( String^ name ) + { + return String::Format( L"Hello, {0}", name ); + } + + }; + +} + +[System::Security::Permissions::SecurityPermissionAttribute( +System::Security::Permissions::SecurityAction::LinkDemand, +Flags=System::Security::Permissions::SecurityPermissionFlag::Infrastructure)] +int main() +{ + // + // Convert a CLR namespace and assembly name into an XML namespace. + String^ xmlNamespace = SoapServices::CodeXmlNamespaceForClrTypeNamespace( + L"ExampleNamespace", L"AssemblyName" ); + Console::WriteLine( L"The name of the XML namespace is {0}.", xmlNamespace ); + // + + // + // Extract a CLR namespace and assembly name from an XML namespace. + String^ typeNamespace; + String^ assemblyName; + SoapServices::DecodeXmlNamespaceForClrTypeNamespace( + xmlNamespace,typeNamespace,assemblyName ); + Console::WriteLine( L"The name of the CLR namespace is {0}.", typeNamespace ); + Console::WriteLine( L"The name of the CLR assembly is {0}.", assemblyName ); + // + + // + // Get the XML element name and the XML namespace for + // an Interop type. + String^ xmlElement; + bool isSoapTypeAttribute = SoapServices::GetXmlElementForInteropType( + ExampleNamespace::ExampleClass::typeid,xmlElement,xmlNamespace ); + + // Print whether the requested value was flagged + // with a SoapTypeAttribute. + if ( isSoapTypeAttribute ) + { + Console::WriteLine( L"The requested value was flagged " + L"with the SoapTypeAttribute." ); + } + else + { + Console::WriteLine( L"The requested value was not flagged " + L"with the SoapTypeAttribute." ); + } + + // Print the XML element and the XML namespace. + Console::WriteLine( L"The XML element for the type " + L"ExampleNamespace.ExampleClass is {0}.", xmlElement ); + Console::WriteLine( L"The XML namespace for the type " + L"ExampleNamespace.ExampleClass is {0}.", xmlNamespace ); + // + + // + // Get the XML type name and the XML type namespace for + // an Interop type. + String^ xmlTypeName; + String^ xmlTypeNamespace; + isSoapTypeAttribute = SoapServices::GetXmlTypeForInteropType( ExampleNamespace::ExampleClass::typeid,xmlTypeName,xmlTypeNamespace ); + + // Print whether the requested value was flagged + // with a SoapTypeAttribute. + if ( isSoapTypeAttribute ) + { + Console::WriteLine( L"The requested value was flagged " + L"with the SoapTypeAttribute." ); + } + else + { + Console::WriteLine( L"The requested value was not flagged " + L"with the SoapTypeAttribute." ); + } + + // Print the XML type name and the XML type namespace. + Console::WriteLine( L"The XML type for the type " + L"ExampleNamespace.ExampleClass is {0}.", xmlTypeName ); + Console::WriteLine( L"The XML type namespace for the type " + L"ExampleNamespace.ExampleClass is {0}.", xmlTypeNamespace ); + // + + // + // Print the XML namespace for a method invocation and its + // response. + System::Reflection::MethodBase^ getHelloMethod = + ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); + String^ methodCallXmlNamespace = + SoapServices::GetXmlNamespaceForMethodCall( getHelloMethod ); + String^ methodResponseXmlNamespace = + SoapServices::GetXmlNamespaceForMethodResponse( getHelloMethod ); + Console::WriteLine( L"The XML namespace for the invocation of the method " + L"GetHello in ExampleClass is {0}.", methodResponseXmlNamespace ); + Console::WriteLine( L"The XML namespace for the response of the method " + L"GetHello in ExampleClass is {0}.", methodCallXmlNamespace ); + // + + // + // Determine whether an XML namespace represents a CLR namespace. + String^ clrNamespace = SoapServices::XmlNsForClrType; + if ( SoapServices::IsClrTypeNamespace( clrNamespace ) ) + { + Console::WriteLine( L"The namespace {0} is a CLR namespace.", + clrNamespace ); + } + else + { + Console::WriteLine( L"The namespace {0} is not a CLR namespace.", + clrNamespace ); + } + // + + // + // Print the XML namespace for the CLR types. + Console::WriteLine( L"The XML namespace for the CLR types " + L"is {0}.", SoapServices::XmlNsForClrType ); + // + + // + // Print the XML namespace for the CLR types + // that have an assembly but no common language runtime namespace. + Console::WriteLine( L"The XML namespace for the CLR types " + L"that have an assembly but no namespace, is {0}.", + SoapServices::XmlNsForClrTypeWithAssembly ); + // + + // + // Print the XML namespace for the CLR types + // that are a part of the Mscorlib.dll. + Console::WriteLine( L"The XML namespace for the CLR types " + L"that are part of the Mscorlib.dll, is {0}.", + SoapServices::XmlNsForClrTypeWithNs ); + // + + // + // Print the XML namespace for the CLR types + // that have both an assembly and a common language runtime + // namespace. + Console::WriteLine( L"The XML namespace for the CLR types " + L"that have both an assembly and a namespace, is {0}.", + SoapServices::XmlNsForClrTypeWithNsAndAssembly ); + // + + // + // Get the SOAP action for the method. + System::Reflection::MethodBase^ getHelloMethodBase = + ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); + String^ getHelloSoapAction = + SoapServices::GetSoapActionFromMethodBase( getHelloMethodBase ); + Console::WriteLine( L"The SOAP action for the method " + L"ExampleClass.GetHello is {0}.", getHelloSoapAction ); + bool isSoapActionValid = + SoapServices::IsSoapActionValidForMethodBase( + getHelloSoapAction, getHelloMethodBase ); + if ( isSoapActionValid ) + { + Console::WriteLine( L"The SOAP action, {0}, " + L"is valid for ExampleClass.GetHello", getHelloSoapAction ); + } + else + { + Console::WriteLine( L"The SOAP action, {0}, " + L"is not valid for ExampleClass.GetHello", getHelloSoapAction ); + } + + // Register the SOAP action for the GetHello method. + SoapServices::RegisterSoapActionForMethodBase( getHelloMethodBase ); + + // Get the type and the method names encoded into the SOAP action. + String^ encodedTypeName; + String^ encodedMethodName; + SoapServices::GetTypeAndMethodNameFromSoapAction( + getHelloSoapAction,encodedTypeName,encodedMethodName ); + Console::WriteLine( L"The type name encoded in this SOAP action is {0}.", + encodedTypeName ); + Console::WriteLine( L"The method name encoded in this SOAP action is {0}.", + encodedMethodName ); + // + + // + // Get the name and the type of the field using its XML + // element name and its XML namespace. For this query to work, + // the containing type must be preloaded, and the XML element + // name and the XML namespace must be explicitly declared on + // the field using a SoapFieldAttribute. + // Preload the containing type. + SoapServices::PreLoad( ExampleNamespace::ExampleClass::typeid ); + + // Get the name and the type of a field that will be + // serialized as an XML element. + Type^ containingType = ExampleNamespace::ExampleClass::typeid; + String^ xmlElementNamespace = L"http://example.org/ExampleFieldNamespace"; + String^ xmlElementName = L"ExampleFieldElementName"; + Type^ fieldType; + String^ fieldName; + SoapServices::GetInteropFieldTypeAndNameFromXmlElement( + containingType,xmlElementName,xmlElementNamespace,fieldType,fieldName ); + Console::WriteLine( L"The type of the field is {0}.", fieldType ); + Console::WriteLine( L"The name of the field is {0}.", fieldName ); + + // Get the name and the type of a field that will be + // serialized as an XML attribute. + String^ xmlAttributeNamespace = + L"http://example.org/ExampleAttributeNamespace"; + String^ xmlAttributeName = L"ExampleFieldAttributeName"; + SoapServices::GetInteropFieldTypeAndNameFromXmlAttribute( + containingType,xmlAttributeName,xmlAttributeNamespace,fieldType,fieldName ); + Console::WriteLine( L"The type of the field is {0}.", fieldType ); + Console::WriteLine( L"The name of the field is {0}.", fieldName ); + // + + // + String^ interopTypeXmlElementName = L"ExampleClassElementName"; + String^ interopTypeXmlNamespace = L"http://example.org/ExampleXmlNamespace"; + Type^ interopType = SoapServices::GetInteropTypeFromXmlElement( + interopTypeXmlElementName, interopTypeXmlNamespace ); + Console::WriteLine( L"The interop type is {0}.", interopType ); + String^ interopTypeXmlTypeName = L"ExampleXmlTypeName"; + String^ interopTypeXmlTypeNamespace = + L"http://example.org/ExampleXmlTypeNamespace"; + interopType = SoapServices::GetInteropTypeFromXmlType( + interopTypeXmlTypeName,interopTypeXmlTypeNamespace ); + Console::WriteLine( L"The interop type is {0}.", interopType ); + // + + // + // Get the method base object for the GetHello method. + System::Reflection::MethodBase^ methodBase = + ExampleNamespace::ExampleClass::typeid->GetMethod( L"GetHello" ); + + // Print its current SOAP action. + Console::WriteLine( L"The SOAP action for the method " + L"ExampleClass.GetHello is {0}.", + SoapServices::GetSoapActionFromMethodBase( methodBase ) ); + + // Set the SOAP action of the GetHello method to a new value. + String^ newSoapAction = L"http://example.org/ExampleSoapAction#NewSoapAction"; + SoapServices::RegisterSoapActionForMethodBase( methodBase, newSoapAction ); + Console::WriteLine( L"The SOAP action for the method " + L"ExampleClass.GetHello is {0}.", + SoapServices::GetSoapActionFromMethodBase( methodBase ) ); + + // Reset the SOAP action of the GetHello method to its default + // value, which is determined using its SoapMethod attribute. + SoapServices::RegisterSoapActionForMethodBase( methodBase ); + Console::WriteLine( L"The SOAP action for the method " + L"ExampleClass.GetHello is {0}.", + SoapServices::GetSoapActionFromMethodBase( methodBase ) ); + // + + // + // Register all types in the assembly with the SoapType attribute. + System::Reflection::Assembly^ executingAssembly = + System::Reflection::Assembly::GetExecutingAssembly(); + SoapServices::PreLoad( executingAssembly ); + // + + // + // Register a specific type with the SoapType attribute. + Type^ exampleType = ExampleNamespace::ExampleClass::typeid; + SoapServices::PreLoad( exampleType ); + // + + // + // Get the currently registered type for the given XML element + // and namespace. + String^ registeredXmlElementName = L"ExampleClassElementName"; + String^ registeredXmlNamespace = + L"http://example.org/ExampleXmlNamespace"; + Type^ registeredType = + SoapServices::GetInteropTypeFromXmlElement( + registeredXmlElementName, registeredXmlNamespace ); + Console::WriteLine( L"The registered interop type is {0}.", + registeredType ); + + // Register a new type for the XML element and namespace. + SoapServices::RegisterInteropXmlElement( + registeredXmlElementName,registeredXmlNamespace,String::typeid ); + + // Get the currently registered type for the given XML element + // and namespace. + registeredType = SoapServices::GetInteropTypeFromXmlElement( + registeredXmlElementName,registeredXmlNamespace ); + Console::WriteLine( L"The registered interop type is {0}.", + registeredType ); + // + + // + // Get the currently registered type for the given XML element + // and namespace. + String^ registeredXmlTypeName = L"ExampleXmlTypeName"; + String^ registeredXmlTypeNamespace = + L"http://example.org/ExampleXmlTypeNamespace"; + registeredType = SoapServices::GetInteropTypeFromXmlType( + registeredXmlTypeName, registeredXmlTypeNamespace ); + Console::WriteLine( L"The registered interop type is {0}.", + registeredType ); + + // Register a new type for the XML element and namespace. + SoapServices::RegisterInteropXmlType( registeredXmlTypeName, + registeredXmlTypeNamespace,String::typeid ); + + // Get the currently registered type for the given XML element + // and namespace. + registeredType = SoapServices::GetInteropTypeFromXmlType( + registeredXmlTypeName,registeredXmlTypeNamespace ); + Console::WriteLine( L"The registered interop type is {0}.", + registeredType ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp new file mode 100644 index 00000000000..a850a00339e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/System.Web.Services.Protocols.WebClientProtocol constructor/CPP/class1.cpp @@ -0,0 +1,28 @@ +#using +#using +#using + +using namespace System; +using namespace System::Diagnostics; +using namespace System::Xml::Serialization; +using namespace System::Web::Services::Protocols; +using namespace System::Web::Services; + +int main(){} + +// This class derives from System::Web::Services::Protocols.WebClientProtocol +// as if the user is implemented his own protocol. +// It demonstrates the use of WebClientProtocol's constructor. + +// +[System::Web::Services::WebServiceBindingAttribute(Name="Service1Soap", + Namespace="http://tempuri.org/")] +ref class TempConvertService: public System::Web::Services::Protocols::WebClientProtocol +{ +public: + TempConvertService() : WebClientProtocol() + { + // Rest of class initialization. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp new file mode 100644 index 00000000000..864f5255756 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/TcpChannel.GetUrlsForUri/CPP/class1.cpp @@ -0,0 +1,32 @@ +// +#using +#using +#using "Service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Collections; + +int main() +{ + // Create a remotable object. + TcpChannel^ tcpChannel = gcnew TcpChannel( 8085 ); + WellKnownServiceTypeEntry^ WKSTE = + gcnew WellKnownServiceTypeEntry( HelloService::typeid, + "Service", + WellKnownObjectMode::Singleton ); + RemotingConfiguration::RegisterWellKnownServiceType( WKSTE ); + + RemotingConfiguration::ApplicationName = "HelloServer"; + + // Print out the urls for the HelloServer. + array^ urls = tcpChannel->GetUrlsForUri( "HelloServer" ); + + for each ( String^ url in urls ) + { + System::Console::WriteLine( "{0}", url ); + } + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp new file mode 100644 index 00000000000..a2417ed5c55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/TcpListener_Pending_LocalEndPoint/CPP/source.cpp @@ -0,0 +1,44 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::Threading; + +void main() +{ + const int portNumber = 13; + + // + try + { + // Use the Pending method to poll the underlying socket instance for client connection requests. + TcpListener^ tcpListener = gcnew TcpListener( portNumber ); + tcpListener->Start(); + + if ( !tcpListener->Pending() ) + { + Console::WriteLine( "Sorry, no connection requests have arrived" ); + } + else + { + //Accept the pending client connection and return a TcpClient object^ initialized for communication. + TcpClient^ tcpClient = tcpListener->AcceptTcpClient(); + + // Using the RemoteEndPoint property. + Console::WriteLine( "I am listening for connections on {0} on port number {1}", + IPAddress::Parse( ( (IPEndPoint^)(tcpListener->LocalEndpoint) )->Address->ToString() ), + ( (IPEndPoint^)(tcpListener->LocalEndpoint) )->Port ); + // + + //Close the tcpListener and tcpClient instances + tcpClient->Close(); + } + tcpListener->Stop(); + } + catch ( Exception^ e ) + { + Console::WriteLine( e->ToString() ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp new file mode 100644 index 00000000000..5d26295d745 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/TcpServerChannel.GetUrlsForUri/CPP/class1.cpp @@ -0,0 +1,32 @@ +// +#using +#using +#using "service.dll" + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels::Tcp; +using namespace System::Collections; + +int main() +{ + // Create a remotable object. + TcpServerChannel^ tcpChannel = gcnew TcpServerChannel( 8085 ); + + WellKnownServiceTypeEntry^ WKSTE = + gcnew WellKnownServiceTypeEntry( HelloService::typeid, + "Service", + WellKnownObjectMode::Singleton ); + RemotingConfiguration::RegisterWellKnownServiceType( WKSTE ); + + RemotingConfiguration::ApplicationName = "HelloServer"; + + // Print out the urls for the HelloServer. + array^ urls = tcpChannel->GetUrlsForUri( "HelloServer" ); + + for each ( String^ url in urls ) + { + System::Console::WriteLine( "{0}", url ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp b/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp new file mode 100644 index 00000000000..0f5bd7c7799 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/UnreferencedObject Event Example/CPP/unrefobj.cpp @@ -0,0 +1,90 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::Xml::Schema; + +ref class Vehicle; + +[SoapInclude(Vehicle::typeid)] +public ref class Vehicle +{ +public: + String^ licenseNumber; +}; + + +// You must use the SoapIncludeAttribute to inform the XmlSerializer +// that the Vehicle type should be recognized when deserializing. + +[SoapInclude(Vehicle::typeid)] +public ref class Group +{ +public: + String^ GroupName; + Vehicle^ GroupVehicle; +}; + +public ref class Run +{ +public: + void DeserializeObject( String^ filename ) + { + // Create an instance of the XmlSerializer class. + XmlTypeMapping^ myMapping = ((gcnew SoapReflectionImporter)->ImportTypeMapping( Group::typeid )); + XmlSerializer^ mySerializer = gcnew XmlSerializer( myMapping ); + mySerializer->UnreferencedObject += gcnew UnreferencedObjectEventHandler( this, &Run::Serializer_UnreferencedObject ); + + // Reading the file requires an XmlTextReader. + XmlTextReader^ reader = gcnew XmlTextReader( filename ); + reader->ReadStartElement(); + + // Deserialize and cast the object. + Group^ myGroup; + myGroup = dynamic_cast(mySerializer->Deserialize( reader )); + reader->ReadEndElement(); + reader->Close(); + } + +private: + void Serializer_UnreferencedObject( Object^ /*sender*/, UnreferencedObjectEventArgs^ e ) + { + Console::WriteLine( "UnreferencedObject:" ); + Console::WriteLine( "ID: {0}", e->UnreferencedId ); + Console::WriteLine( "UnreferencedObject: {0}", e->UnreferencedObject ); + Vehicle^ myVehicle = dynamic_cast(e->UnreferencedObject); + Console::WriteLine( "License: {0}", myVehicle->licenseNumber ); + } +}; + +int main() +{ + Run^ test = gcnew Run; + test->DeserializeObject( "UnrefObj.xml" ); +} + +// The file named S"UnrefObj.xml" should contain this XML: +// +// +// +// +// ABCD +// +// +// 1234 +// +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp b/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp new file mode 100644 index 00000000000..dbc94df5f39 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/UriBuilderSample/cpp/main.cpp @@ -0,0 +1,27 @@ +#using +#pragma region^ Using directives + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Text; + +#pragma endregion + +int main() +{ + // + UriBuilder^ baseUri = gcnew UriBuilder + ("http://www.contoso.com/default.aspx?Param1=7890"); + String^ queryToAppend = "param2=1234"; + if (baseUri->Query != nullptr && baseUri->Query->Length > 1) + { + // Note: In .NET Core and .NET 5+, you can simplify by removing + // the call to Substring(), which removes the leading "?" character. + baseUri->Query = baseUri->Query->Substring(1)+ "&" + queryToAppend; + } + else + { + baseUri->Query = queryToAppend; + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp new file mode 100644 index 00000000000..13f395578e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp @@ -0,0 +1,37 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; +using namespace System::Collections::Specialized; + +int main() +{ + // + try + { + // Download the data to a buffer. + WebClient^ client = gcnew WebClient; + + array^ pageData = client->DownloadData( "http://www.contoso.com" ); + String^ pageHtml = Encoding::ASCII->GetString( pageData ); + Console::WriteLine( pageHtml ); + + // Download the data to a file. + client->DownloadFile( "http://www.contoso.com", "page.htm" ); + + // Upload some form post values. + NameValueCollection^ form = gcnew NameValueCollection; + form->Add( "MyName", "MyValue" ); + array^ responseData = client->UploadValues( "http://www.contoso.com/form.aspx", form ); + } + catch ( WebException^ webEx ) + { + Console::WriteLine( webEx->ToString() ); + if ( webEx->Status == WebExceptionStatus::ConnectFailure ) + { + Console::WriteLine( "Are you behind a firewall? If so, go through the proxy server." ); + } + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp new file mode 100644 index 00000000000..36fa4c47873 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp @@ -0,0 +1,27 @@ + + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +// +int main() +{ + try + { + WebClient^ client = gcnew WebClient; + client->Credentials = CredentialCache::DefaultCredentials; + array^pageData = client->DownloadData( "http://www.contoso.com" ); + String^ pageHtml = Encoding::ASCII->GetString( pageData ); + Console::WriteLine( pageHtml ); + } + catch ( WebException^ webEx ) + { + Console::Write( webEx ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp new file mode 100644 index 00000000000..f9928d15693 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp @@ -0,0 +1,67 @@ +// System::Net::WebClient::BaseAddress; System::Net::WebClient::ResponseHeaders + +/*This program demonstrates the 'BaseAddress' and 'ResponseHeaders' properties of the 'WebClient' class. +It accepts the base Uri from the user and assigns it to the 'BaseAddress' property of the +'WebClient' class. It then invokes 'DownloadFile' for the specific web page requested by the +user. WebClient internally combines the 'BaseAddress' and specific page name to retrieve the page. + +The 'ResponseHeaders' property is a 'WebHeaderCollection' that contains the +header information of the response received from the server. This is displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { + Console::Write( "\nPlease enter a Url {e.g. : http://www.microsoft.com}" ); + String^ hostUri = Console::ReadLine(); + Console::Write( "\nPlease enter the specific web page you require {e.g. : windows/default.asp} : " ); + String^ uriSuffix = Console::ReadLine(); + +// + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + + // Set the BaseAddress of the Web Resource in the WebClient. + myWebClient->BaseAddress = hostUri; + Console::WriteLine( "Downloading from {0}/ {1}", hostUri, uriSuffix ); + Console::WriteLine( "\nPress Enter key to continue" ); + Console::ReadLine(); + + // Download the target Web Resource into a Byte array. + array^ myDatabuffer = myWebClient->DownloadData( uriSuffix ); + + // Display the downloaded data. + String^ download = Encoding::ASCII->GetString( myDatabuffer ); + Console::WriteLine( download ); + Console::WriteLine( "Download of {0}{1} was successful.", myWebClient->BaseAddress, uriSuffix ); +// + +// + // Obtain the WebHeaderCollection instance containing the header name/value pair from the response. + WebHeaderCollection^ myWebHeaderCollection = myWebClient->ResponseHeaders; + Console::WriteLine( "\nDisplaying the response headers\n" ); + + // Loop through the ResponseHeaders and display the header name/value pairs. + for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) + { + Console::WriteLine( "\t{0} = {1}", myWebHeaderCollection->GetKey( i ), + myWebHeaderCollection->Get( i ) ); + } +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following WebException was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following Exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp new file mode 100644 index 00000000000..d306a8cb394 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp @@ -0,0 +1,48 @@ +// System::Net::WebClient::DownloadData; System::Net::WebClient::WebClient + +/* +This program demonstrates the 'DownloadData' method and 'WebClient()' constructor of 'WebClient' class. +It creates a URI to access a web resource. The Uri can point +to any text or binary web resource, like images etc. The 'DownloadData' method then downloads +the required text/html homepage into a Byte array. The downloaded data is displayed on the Console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// +// + Console::Write( "\nPlease enter a URI (e.g. http://www.contoso.com): " ); + String^ remoteUri = Console::ReadLine(); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + // Download home page data. + Console::WriteLine( "Downloading {0}", remoteUri ); + // Download the Web resource and save it into a data buffer. + array^ myDataBuffer = myWebClient->DownloadData( remoteUri ); + + // Display the downloaded data. + String^ download = Encoding::ASCII->GetString( myDataBuffer ); + Console::WriteLine( download ); + + Console::WriteLine( "Download successful." ); +// +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "Download failed!!! WebException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following general exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp new file mode 100644 index 00000000000..f7dd44ee87f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp @@ -0,0 +1,47 @@ +// System::Net::WebClient::DownloadFile + +/* +This program demonstrates the 'DownloadFile' method of 'WebClient' class. +It creates a URI to access a web resource at 'http://www.microsoft.com'. The Uri can point +to any text or binary web resource, like images etc. The 'DownloadFile' method then downloads +the target web resource which is a combination of the Uri and the actual web resource required, +into the current filesystem folder with a specified name. +Information regarding the sucess or failure of this operation is displayed on the console. +*/ + +#using +#using + +using namespace System; +using namespace System::Net; +using namespace System::Windows::Forms; + +int main() +{ + try + { +// + String^ remoteUri = "http://www.contoso.com/library/homepage/images/"; + String^ fileName = "ms-banner.gif", ^myStringWebResource = nullptr; + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + // Concatenate the domain with the Web resource filename. + myStringWebResource = String::Concat( remoteUri, fileName ); + Console::WriteLine( "Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource ); + // Download the Web resource and save it into the current filesystem folder. + myWebClient->DownloadFile( myStringWebResource, fileName ); + Console::WriteLine( "Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource ); + Console::WriteLine( "\nDownloaded file saved in the following file system folder:\n\t {0}", Application::StartupPath ); +// + } + catch ( WebException^ e ) + { + // Display the exception. + Console::WriteLine( "Download failed!!! WebException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + // Display the exception. + Console::WriteLine( "The following general exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp new file mode 100644 index 00000000000..d2ddda3c6cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp @@ -0,0 +1,49 @@ +// System::Net::WebClient::OpenRead + +/* +This program demonstrates the 'OpenRead' method of 'WebClient' class. +It creates a URI to access a web resource. It then invokes 'OpenRead' tp obtain a 'Stream' +instance which is used to retrieve the web page data. The data read from the stream is then +displayed on the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; + +int main() +{ + try + { + Console::Write( "\nPlease enter a URI (e.g. http://www.contoso.com): " ); + String^ uriString = Console::ReadLine(); + +// + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + // Download home page data. + Console::WriteLine( "Accessing {0} ...", uriString ); + // Open a stream to point to the data stream coming from the Web resource. + Stream^ myStream = myWebClient->OpenRead( uriString ); + + Console::WriteLine( "\nDisplaying Data :\n" ); + StreamReader^ sr = gcnew StreamReader( myStream ); + Console::WriteLine( sr->ReadToEnd() ); + + // Close the stream. + myStream->Close(); +// + } + catch ( WebException^ e ) + { + // Display the exception. + Console::WriteLine( "Webresource access failed!!! WebException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + // Display the exception. + Console::WriteLine( "The following general exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp new file mode 100644 index 00000000000..a8b2e4ba9a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp @@ -0,0 +1,56 @@ +// System::Net::WebClientOpenWrite(String, String) + +/* +This program demonstrates the 'OpenWrite(String, String)' method of S"WebClient" class. +It accepts an Uri and some String* content to be posted to the Uri. The +program makes a call to 'OpenWrite(String, String)' method and obtains a S"Stream" instance +This stream is used to post data to the site. + +Note : Behavior of this program may not be the same with all other sites. Also certain +sites would not accept S"Post" method thereby leading to an error. It is advisable +to construct a site using files accompanying this and provide +url name of this site to the program. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + try + { +// + String^ uriString; + Console::Write( "\nPlease enter the URI to post data to: " ); + uriString = Console::ReadLine(); + Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); + String^ postData = Console::ReadLine(); + // Apply ASCII encoding to obtain an array of bytes . + array^ postArray = Encoding::ASCII->GetBytes( postData ); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + + Console::WriteLine( "Uploading to {0} ...", uriString ); + Stream^ postStream = myWebClient->OpenWrite( uriString, "POST" ); + postStream->Write( postArray, 0, postArray->Length ); + + // Close the stream and release resources. + postStream->Close(); + Console::WriteLine( "\nSuccessfully posted the data." ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp new file mode 100644 index 00000000000..49e839f707e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp @@ -0,0 +1,58 @@ +// System::Net::WebClient::OpenWrite(String) + +/* +This program demonstrates the 'OpenWrite(String)' method of S"WebClient" class. +It accepts an Uri and some String* content to be posted to the Uri. The +program makes a call to 'OpenWrite(String)' method and obtains a S"Stream" instance +This stream is used to post data to the site. + +Note : Behavior of this program may not be the same with all other sites. Also certain +sites would not accept S"Post" method thereby leading to an error. It is advisable +to construct a site using files accompanying this and provide +url name of this site to the program. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + try + { +// + String^ uriString; + Console::Write( "\nPlease enter the URI to post data to: " ); + uriString = Console::ReadLine(); + Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); + String^ postData = Console::ReadLine(); + // Apply Ascii Encoding to obtain an array of bytes. + array^ postArray = Encoding::ASCII->GetBytes( postData ); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + + // postStream implicitly sets HTTP POST as the request method. + Console::WriteLine( "Uploading to {0} ...", uriString ); + Stream^ postStream = myWebClient->OpenWrite( uriString ); + + postStream->Write( postArray, 0, postArray->Length ); + + // Close the stream and release resources. + postStream->Close(); + + Console::WriteLine( "\nSuccessfully posted the data." ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp new file mode 100644 index 00000000000..9d13d718d71 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp @@ -0,0 +1,65 @@ +// System::Net::WebClient::QueryString + +/*This program demonstrates the 'QueryString' property of 'WebClient' class. +It accepts a search phrase as user input and invokes the search of www.google.com for +the user-entered search-phrase, using the 'QueryString' property of WebClient. The result is +then saved into the current +filesystem folder as 'searchresult.htm'. +*/ + +#using + +using namespace System; +using namespace System::Collections::Specialized; +using namespace System::Net; + +int main() +{ + try + { +// + String^ uriString = "http://www.contoso.com/search"; + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + // Create a new NameValueCollection instance to hold the QueryString parameters and values. + NameValueCollection^ myQueryStringCollection = gcnew NameValueCollection; + Console::Write( "Enter the word(s), separated by space character to search for in {0}: ", uriString ); + // Read user input phrase to search for at uriString. + String^ searchPhrase = Console::ReadLine(); + if ( searchPhrase->Length > 1 ) + { + // Assign the user-defined search phrase. + myQueryStringCollection->Add( "q", searchPhrase ); + } + else + { + // If error, default to search for 'Microsoft'. + myQueryStringCollection->Add( "q", "Microsoft" ); + } + // Assign auxilliary parameters required for the search. + Console::WriteLine( "Searching {0} .......", uriString ); + // Attach QueryString to the WebClient. + myWebClient->QueryString = myQueryStringCollection; + // Download the search results Web page into 'searchresult.htm' for inspection. + myWebClient->DownloadFile( uriString, "searchresult.htm" ); + Console::WriteLine( "\nDownload of {0} was successful. Please see 'searchresult.htm' for results.", uriString ); +// + // Get the collection of Headers sent back in response to the WebClient request. + WebHeaderCollection^ myWebHeaderCollection = myWebClient->ResponseHeaders; + Console::WriteLine( "\nDisplaying Response Headers\n" ); + // Loop through the ResponseHeader collection and display the Headers as name/value pairs. + for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) + { + // Display the Headers as 'Name = Value' pairs. + Console::WriteLine( "\t {0} = {1}", myWebHeaderCollection->GetKey( i ), myWebHeaderCollection->Get( i ) ); + } + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following WebException was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following Exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp new file mode 100644 index 00000000000..b457c8c5fcd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp @@ -0,0 +1,52 @@ +// System::Net::WebClient::UploadData(String, Byte->Item[]) + +/* +This program demonstrates the 'UploadData(String, Byte->Item[])' method of S"WebClient" class. +It accepts an Uri and some String* content to be posted to the Uri. This String* is posted to the Uri +provided as input using the 'UploadData(String, Byte->Item[])' method. The custom made site responds back +with whatever was posted to it. The contents of the response are displayed to the console. + +Note : The results described were obtained using a custom made site. This behavior may not be the +same with all other sites. Also certain sites would not accept "Post" method thereby leading to +an error. It is advisable to construct a site using files accompanying this and provide +url name of this site to the program. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + Console::Write( "\nPlease enter the URI to post data to: " ); + String^ uriString = Console::ReadLine(); + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); + String^ postData = Console::ReadLine(); + // Apply ASCII Encoding to obtain the String* as a Byte array. + array^ postArray = Encoding::ASCII->GetBytes( postData ); + Console::WriteLine( "Uploading to {0} ...", uriString ); + myWebClient->Headers->Add( "Content-Type", "application/x-www-form-urlencoded" ); + + //UploadData implicitly sets HTTP POST as the request method. + array^responseArray = myWebClient->UploadData( uriString, postArray ); + + // Decode and display the response. + Console::WriteLine( "\nResponse received was: {0}", Encoding::ASCII->GetString( responseArray ) ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp new file mode 100644 index 00000000000..67b84643e61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp @@ -0,0 +1,62 @@ +// System::Net::WebClient::UploadData(String, String, Byte->Item[]); System::Net::WebClient::Headers + +/* +This program demonstrates the 'UploadData(String, String, Byte->Item[])' method and 'Headers' property of +'WebClient' class. It accepts an Uri and some String* content to be posted to the Uri. This String* +is posted to the Uri provided as input using the 'UploadData(String, String, Byte->Item[])' method. +The 'Headers' property is used to set the S"Content-Type" header to S"application/x-www-form-urlencoded". +The custom made site responds back with whatever was posted to it. +The contents of the response are displayed to the console. + +Note : The results described were obtained using a custom made site. This behavior may not be the +same with all other sites. Also certain sites would not support the S"Post" method thereby leading to +an error. It is advisable to construct a site using files accompanying this and provide +url name of this site to the program. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// +// + String^ uriString; + Console::Write( "\nPlease enter the URI to post data to {for example, http://www.contoso.com}: " ); + uriString = Console::ReadLine(); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + Console::WriteLine( "\nPlease enter the data to be posted to the URI {0}:", uriString ); + String^ postData = Console::ReadLine(); + myWebClient->Headers->Add( "Content-Type", "application/x-www-form-urlencoded" ); + + // Displays the headers in the request + Console::Write( "Resulting Request Headers: "); + Console::WriteLine(myWebClient->Headers); + + // Apply ASCII Encoding to obtain the String^ as a Byte array. + array^ byteArray = Encoding::ASCII->GetBytes( postData ); + Console::WriteLine( "Uploading to {0} ...", uriString ); + // Upload the input String* using the HTTP 1.0 POST method. + array^responseArray = myWebClient->UploadData( uriString, "POST", byteArray ); + // Decode and display the response. + Console::WriteLine( "\nResponse received was {0}", + Encoding::ASCII->GetString( responseArray ) ); +// +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp new file mode 100644 index 00000000000..601e1b7166c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp @@ -0,0 +1,56 @@ + + +// System::Net::WebClient::UploadFile(String, String) +/* +This program demonstrates the 'UploadFile(String, String)' method of S"WebClient" class. +It accepts an Uri and the path of a file to be uploaded to the Uri. This file is uploaded to the Uri +provided as input using the 'UploadFile(String, String)' method. The custom made site responds back +with whatever was posted to it. Thus the contents of the file are displayed to the console. + +Note : The results described were obtained using a custom made site. This behavior may not be the +same with all other sites. Also certain sites would not accept S"Post" method thereby leading to +an error. It is advisable to construct a site using files accompanying this and provide +url name of this site to the program. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +public class WebClient_UploadFile +{ +public: + int main() + { + try + { + // + Console::Write( "\nPlease enter the URI to post data to : " ); + String^ uriString = Console::ReadLine(); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + Console::WriteLine( "\nPlease enter the fully qualified path of the file to be uploaded to the URI" ); + String^ fileName = Console::ReadLine(); + Console::WriteLine( "Uploading {0} to {1} ...", fileName, uriString ); + + // Upload the file to the URI. + // The 'UploadFile(uriString, fileName)' method implicitly uses HTTP POST method. + array^responseArray = myWebClient->UploadFile( uriString, fileName ); + + // Decode and display the response. + Console::WriteLine( "\nResponse Received::The contents of the file uploaded are: \n {0}", + System::Text::Encoding::ASCII->GetString( responseArray ) ); + // + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp new file mode 100644 index 00000000000..8c7b4cf0202 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp @@ -0,0 +1,55 @@ + + +// System::Net::WebClient::UploadFile(String, String, String) +/* +This program demonstrates the 'UploadFile(String, String, String)' method of S"WebClient" class. +It accepts an Uri and the path of a file to be uploaded to the Uri. This file is uploaded to the Uri +provided as input using the 'UploadFile(String, String, String)' method. The custom made site responds back +with whatever was posted to it. Thus the contents of the file are displayed to the console. + +Note : The results described were obtained using a custom made site. This behavior may not be the +same with all other sites. Also certain sites would not accept S"Post" method thereby leading to +an error. It is advisable to construct a site using files accompanying this and provide +url name of this site to the program. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Text; + +public class WebClient_UploadFile { + public: + int main() + { + try + { + // + Console::Write( "\nPlease enter the URL to post data to : " ); + String^ uriString = Console::ReadLine(); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + Console::WriteLine + ("\nPlease enter the fully qualified path of the file to be uploaded to the URL" ); + String^ fileName = Console::ReadLine(); + Console::WriteLine( "Uploading {0} to {1} ...", fileName, uriString ); + + // Upload the file to the URL using the HTTP 1.0 POST. + array^responseArray = myWebClient->UploadFile( uriString, "POST", fileName ); + + // Decode and display the response. + Console::WriteLine( "\nResponse Received::The contents of the file uploaded are: \n {0}", + System::Text::Encoding::ASCII->GetString( responseArray )); + // + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp new file mode 100644 index 00000000000..608d8f55e16 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp @@ -0,0 +1,68 @@ +// System::Net::WebClient::UploadValues(String, NameValueCollection) + +/* +This program demonstrates the 'UploadValues(String, NameValueCollection)' method of S"WebClient" class. +It accepts an Uri::Forms a 'NameValueCollection' instance using +a set of pre-defined name-value pairs. These are posted to the Uri provided as input using the +'UploadValues(String, NameValueCollection)'method. The custom made site responds back +with whatever was posted to it. This is displayed to the console. + +Note : The results described were obtained using a custom made site. This behavior may not be the +same with all other sites. Also certain sites would not accept S"Post" method thereby leading to +an error. It is advisable to construct a site using files accompanying this and provide +url name of this site to the program. +*/ + +#using + +using namespace System; +using namespace System::Collections::Specialized; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + Console::Write( "\nPlease enter the URI to post data to: " ); + String^ uriString = Console::ReadLine(); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + + // Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL. + NameValueCollection^ myNameValueCollection = gcnew NameValueCollection; + + Console::WriteLine( "Please enter the following parameters to be posted to the URL" ); + Console::Write( "Name: " ); + String^ name = Console::ReadLine(); + + Console::Write( "Age: " ); + String^ age = Console::ReadLine(); + + Console::Write( "Address: " ); + String^ address = Console::ReadLine(); + + // Add necessary parameter/value pairs to the name/value container. + myNameValueCollection->Add( "Name", name ); + myNameValueCollection->Add( "Address", address ); + myNameValueCollection->Add( "Age", age ); + + Console::WriteLine( "\nUploading to {0} ...", uriString ); + // 'The Upload(String, NameValueCollection)' implicitly method sets HTTP POST as the request method. + array^ responseArray = myWebClient->UploadValues( uriString, myNameValueCollection ); + + // Decode and display the response. + Console::WriteLine( "\nResponse received was :\n {0}", Encoding::ASCII->GetString( responseArray ) ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp new file mode 100644 index 00000000000..6435886d8a7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp @@ -0,0 +1,68 @@ +// System::Net::WebClient::UploadValues(String, String, NameValueCollection) + +/* +This program demonstrates the 'UploadValues(String, String, NameValueCollection)' method of S"WebClient" class. +It accepts an Uri::Forms a 'NameValueCollection' instance using +a set of pre-defined name-value pairs. These are posted to the Uri provided as input using the +'UploadValues(String, String, NameValueCollection)'method. The custom made site responds back +with whatever was posted to it. This is displayed to the console. + +Note : The results described were obtained using a custom made site. This behavior may not be the +same with all other sites. Also certain sites would not accept S"Post" method thereby leading to +an error. It is advisable to construct a site using files accompanying this and provide +url name of this site to the program. +*/ + +#using + +using namespace System; +using namespace System::Collections::Specialized; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + Console::Write( "\nPlease enter the URL to post data to: " ); + String^ uriString = Console::ReadLine(); + + // Create a new WebClient instance. + WebClient^ myWebClient = gcnew WebClient; + + // Create a new NameValueCollection instance to hold some custom parameters to be posted to the URL. + NameValueCollection^ myNameValueCollection = gcnew NameValueCollection; + + Console::WriteLine( "Please enter the following parameters to be posted to the URI" ); + Console::Write( "Name: " ); + String^ name = Console::ReadLine(); + + Console::Write( "Age: " ); + String^ age = Console::ReadLine(); + + Console::Write( "Address: " ); + String^ address = Console::ReadLine(); + + // Add necessary parameter/value pairs to the name/value container. + myNameValueCollection->Add( "Name", name ); + myNameValueCollection->Add( "Address", address ); + myNameValueCollection->Add( "Age", age ); + Console::WriteLine( "\nUploading to {0} ...", uriString ); + + // Upload the NameValueCollection. + array^ responseArray = myWebClient->UploadValues( uriString, "POST", myNameValueCollection ); + + // Decode and display the response. + Console::WriteLine( "\nResponse received was :\n {0}", Encoding::ASCII->GetString( responseArray ) ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "The following exception was raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp new file mode 100644 index 00000000000..fc78349bd84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor1/CPP/webexception_constructor1.cpp @@ -0,0 +1,63 @@ +// System::Net::WebException::WebException(); + +/* +This program demonstrates the 'WebException()' constructor of 'WebException' class. +It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with an invalid 'URL'. +When the method tries to establish a socket connection to that address an exception is thrown.In +the 'catch' block a new 'WebException' Object* is created and thrown to the caller. That exception +is caught in the calling method and the error message is displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; + +public ref class HttpConnect +{ +public: + void ConnectHttpServer( String^ connectUri ) + { +// + try + { + // A 'Socket' object has been created. + Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork,SocketType::Stream,ProtocolType::Tcp ); + + + // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. + + IPHostEntry^ hostEntry = Dns::Resolve( "http://www.contoso.com" ); + + IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; + IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); + httpSocket->Connect( endPoint ); + Console::WriteLine( "Connection created successfully" ); + httpSocket->Close(); + } + catch ( SocketException^ e ) + { + String^ exp = e->Message; + // Throw the WebException with no parameters. + throw gcnew WebException; + } +// + } +}; + +int main() +{ + try + { + HttpConnect^ myHttpConnect = gcnew HttpConnect; + // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. + myHttpConnect->ConnectHttpServer( "www.contoso.com" ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "The Exception is: {0}", e->Message ); + Console::WriteLine( "The Exception is: Unable to Contact the server" ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp new file mode 100644 index 00000000000..bd7987a1db7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor2/CPP/webexception_constructor2.cpp @@ -0,0 +1,62 @@ +// System::Net::WebException::WebException(String); + +/* +This program demonstrates the 'WebException(String)' constructor of 'WebException' class. +It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with invalid 'URL'. +When the method tries to establish a socket connection to that address an exception is thrown.In +the 'catch' block a new 'WebException' Object* is created with a message(specific to the present +situation) and thrown to the caller. That exception is caught in the calling method and the +error message is displayed on the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; + +public ref class HttpConnect +{ +public: + void ConnectHttpServer( String^ connectUri ) + { +// + try + { + // A 'Socket' object has been created. + Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); + + // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. + IPHostEntry^ hostEntry = Dns::Resolve( connectUri ); + + IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; + IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); + httpSocket->Connect( endPoint ); + Console::WriteLine( "Connection created successfully" ); + httpSocket->Close(); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "\nException thrown.\nThe Original Message is: {0}", e->Message ); + + // Throw the 'WebException' object with a message string specific to the situation. + throw gcnew WebException( "Unable to locate the Server with 'www.contoso.com' Uri." ); + } +// + } +}; + +int main() +{ + try + { + HttpConnect^ myHttpConnect = gcnew HttpConnect; + // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. + myHttpConnect->ConnectHttpServer( "www.contoso.com" ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nThe New Message is: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp new file mode 100644 index 00000000000..8a6a84a5294 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor3/CPP/webexception_constructor3.cpp @@ -0,0 +1,62 @@ +// System::Net::WebException::WebException(String, WebExceptionStatus); + +/* +This program demonstrates the 'WebException(String, WebExceptionStatus)' constructor of 'WebException' class. +It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with invalid 'URL'. +When the method tries to establish a socket connection to that address an exception is thrown and +in the 'catch' block a new 'WebException' Object* is created and thrown. That exception is caught +in the calling method and the error message is displayed on the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; + +public ref class HttpConnect +{ +public: + void ConnectHttpServer( String^ connectUri ) + { +// + try + { + // A 'Socket' object has been created. + Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); + + // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. + + IPHostEntry^ hostEntry = Dns::Resolve( "http://www.contoso.com" ); + + IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; + IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); + httpSocket->Connect( endPoint ); + Console::WriteLine( "Connection created successfully" ); + httpSocket->Close(); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "\nException thrown.\nThe Original Message is: {0}", e->Message ); + // Throw the 'WebException' object with a message string and message status specific to the situation. + throw gcnew WebException( "Unable to locate the Server with 'www.contoso.com' Uri.", WebExceptionStatus::NameResolutionFailure ); + } +// + } +}; + +int main() +{ + try + { + HttpConnect^ myHttpConnect = gcnew HttpConnect; + // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. + myHttpConnect->ConnectHttpServer( "www.contoso.com" ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nThe New Message is: {0}", e->Message ); + Console::WriteLine( "\nThe Status is : {0}", e->Status ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp new file mode 100644 index 00000000000..eb951370648 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor4/CPP/webexception_constructor4.cpp @@ -0,0 +1,64 @@ +// System::Net::WebException::WebException(String, InnerException); + +/* +This program demonstrates the 'WebException(String, InnerException)' constructor of 'WebException' class. +It creates a 'HttpConnect' Object* and calls the 'ConnectHttpServer' method with invalid 'URL'. +When the method tries to establish a socket connection to that address an exception is thrown and +in the 'catch' block a new 'WebException' Object* is created and thrown. That exception is caught +in the calling method and the error message is displayed on the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; + +public ref class HttpConnect +{ +public: + void ConnectHttpServer( String^ connectUri ) + { +// + try + { + // A 'Socket' object has been created. + Socket^ httpSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); + + // The IPaddress of the unknown uri is resolved using the 'Dns::Resolve' method. + + IPHostEntry^ hostEntry = Dns::Resolve( connectUri ); + + IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; + IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress, 80 ); + httpSocket->Connect( endPoint ); + Console::WriteLine( "Connection created successfully" ); + httpSocket->Close(); + } + catch ( SocketException^ e ) + { + Console::WriteLine( "\nException thrown.\nThe Original Message is: {0}", e->Message ); + // Throw the 'WebException' object with a message string specific to the situation; + // and the 'InnerException' that actually led to this exception. + throw gcnew WebException( "Unable to locate the Server with 'www.contoso.com' Uri.", e ); + } +// + } +}; + +int main() +{ + try + { + HttpConnect^ myHttpConnect = gcnew HttpConnect; + + // If the Uri is valid then 'ConnectHttpServer' method will connect to the server. + myHttpConnect->ConnectHttpServer( "www.contoso.com" ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nThe New Message is: {0}", e->Message ); + Console::WriteLine( "\nThe Inner Exception is : {0}", e->InnerException ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp new file mode 100644 index 00000000000..a128262f175 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebException_Constructor5/CPP/webexception_constructor5.cpp @@ -0,0 +1,117 @@ +// System::Net::WebException::WebException(String, InnerException, Status, WebResponse); + +/* +This program demonstrates the 'WebException(String, InnerException, Status, WebResponse)' constructor of +'WebException' class. +A 'HttpConnect' class is defined which extends the 'WebResponse' class. Then a 'HttpConnect' Object* is +created by taking an uri(intranet) from the user as input and 'ConnectHttpServer' method is called to connect +the InternetServer at the specified 'URL'. It asks for a file named 'nhjj.htm' , gets the response from the +InternetServer and checks the status of the response. If status is '404 File not Found' a 'WebResponse' Object* +is created and then a new 'WebException' Object* is created and thrown. That exception is caught in the calling +method and the error message along with the response obtained from the InternetServer is displayed to the +console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Net::Sockets; +using namespace System::Text; +using namespace System::IO; + +public ref class HttpConnect: public WebResponse +{ +public: + Stream^ getStream; + + // Default constructor. + HttpConnect() + { + getStream = nullptr; + } + + // Constructor accepting stream as a parameter. + HttpConnect( Stream^ getStream ) + { + this->getStream = getStream; + } + + // Override 'GetResponseStream' method of the 'WebResponse' class. + virtual Stream^ GetResponseStream() override + { + return getStream; + } + + void ConnectHttpServer( String^ connectUri ) + { +// + // Send the data. + Encoding^ ASCII = Encoding::ASCII; + String^ requestPage = String::Concat( "GET /nhjj.htm HTTP/1.1\r\nHost: ", connectUri, "\r\nConnection: Close\r\n\r\n" ); + array^ byteGet = ASCII->GetBytes( requestPage ); + array^ recvBytes = gcnew array(256); + + // Create an 'IPEndPoint' object. + + IPHostEntry^ hostEntry = Dns::Resolve( connectUri ); + IPAddress^ serverAddress = hostEntry->AddressList[ 0 ]; + IPEndPoint^ endPoint = gcnew IPEndPoint( serverAddress,80 ); + + // Create a 'Socket' object for sending data. + Socket^ connectSocket = gcnew Socket( AddressFamily::InterNetwork, SocketType::Stream, ProtocolType::Tcp ); + + // Connect to host using 'IPEndPoint' object. + + connectSocket->Connect( endPoint ); + + // Sent the 'requestPage' text to the host. + connectSocket->Send( byteGet, byteGet->Length, (SocketFlags)(0) ); + + // Receive the information sent by the server. + Int32 bytesReceived = connectSocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)(0) ); + String^ headerString = ASCII->GetString( recvBytes, 0, bytesReceived ); + + // Check whether 'status 404' is there or not in the information sent by server. + if ( headerString->IndexOf( "404" ) != -1 ) + { + bytesReceived = connectSocket->Receive( recvBytes, recvBytes->Length, (SocketFlags)(0) ); + MemoryStream^ memoryStream = gcnew MemoryStream( recvBytes ); + getStream = (System::IO::Stream^)(memoryStream); + + // Create a 'WebResponse' object + WebResponse^ myWebResponse = (WebResponse^)(gcnew HttpConnect( getStream )); + Exception^ myException = gcnew Exception( "File Not found" ); + + // Throw the 'WebException' object with a message string, message status, InnerException and WebResponse + throw gcnew WebException( "The Requested page is not found.",myException,WebExceptionStatus::ProtocolError,myWebResponse ); + } + + connectSocket->Close(); +// + } +}; + +int main() +{ + try + { + Console::WriteLine( "Please give any Intranet Site Address (eg:manjeera.wipro.com)" ); + String^ uriConnect = Console::ReadLine(); + HttpConnect^ myHttpConnect = gcnew HttpConnect; + myHttpConnect->ConnectHttpServer( uriConnect ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nThe WebException is : {0}", e->Message ); + Console::WriteLine( "\nThe status of the WebException is : {0}", e->Status ); + Console::WriteLine( "\nThe Inner Exception is :' {0}'", e->InnerException ); + Console::WriteLine( "\nThe Web Response is:\n" ); + StreamReader^ readStream = gcnew StreamReader( e->Response->GetResponseStream() ); + Console::WriteLine( readStream->ReadToEnd() ); + } + catch ( Exception^ e ) + { + Console::WriteLine( e ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp b/snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp new file mode 100644 index 00000000000..a74ca8330a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebException_Status_Response/CPP/webexception_status_response.cpp @@ -0,0 +1,40 @@ +/* This program demonstrates the S"Status" and the S"Response" property of S"WebException" class. +It tries to access an invalid site and displays the status code and status description of the +resultant exception that is raised. +*/ + +#using + +using namespace System; +using namespace System::Net; + +int main() +{ +// +// + try + { + // Create a web request for an unknown server (this raises the WebException). + HttpWebRequest^ myHttpWebRequest = (HttpWebRequest^)(WebRequest::Create( "http://unknown.unknown.com" )); + + // Get the associated response for the above request. + HttpWebResponse^ myHttpWebResponse = (HttpWebResponse^)(myHttpWebRequest->GetResponse()); + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "This program is expected to throw WebException on successful run." + + "\n\nException Message : " + e->Message ); + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + Console::WriteLine( "Status Code: {0}", ( (HttpWebResponse^)(e->Response) )->StatusCode ); + Console::WriteLine( "Status Description: {0}", ( (HttpWebResponse^)(e->Response) )->StatusDescription ); + } +// + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } +// +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp new file mode 100644 index 00000000000..69020651232 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Add/CPP/webheadercollection_add.cpp @@ -0,0 +1,67 @@ + + +/* This program demonstrates the S"Add" method of S"WebHeaderCollection" class. +It uses the S"Add" method of S"WebHeaderCollection" class to add the 'Accept-Language' header in the request. +The 'Accept-Language' header is used in a request to specify the language preferences of the user. The server +can use the language preferences specified to generate output for that particular language. +*/ +#using + +using namespace System; +using namespace System::Net; +void printHeaders( WebHeaderCollection^ headers ) +{ + Console::WriteLine( "Printing Headers : " ); + if ( headers->Count == 0 ) + Console::WriteLine( "\tNo Headers to Display" ); + + for ( int i = 0; i < headers->Count; i++ ) + Console::WriteLine( "\t {0} : {1}", headers->AllKeys[ i ], headers[ i ] ); +} + +int main() +{ + // + try + { + //Create a web request for S"www.msn.com". + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); + + //Get the headers associated with the request. + WebHeaderCollection^ myWebHeaderCollection = myHttpWebRequest->Headers; + Console::WriteLine( "Configuring Webrequest to accept Danish and English language using 'Add' method" ); + + //Add the Accept-Language header (for Danish) in the request. + myWebHeaderCollection->Add( "Accept-Language:da" ); + + //Include English in the Accept-Langauge header. + myWebHeaderCollection->Add( "Accept-Language:en;q=0.8" ); + + //Get the associated response for the above request. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + //Print the headers for the request. + printHeaders( myWebHeaderCollection ); + myHttpWebResponse->Close(); + } + //Catch exception if trying to add a restricted header. + catch ( ArgumentException^ e ) + { + Console::WriteLine( e->Message ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException is thrown. \nMessage is : {0}", e->Message ); + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); + Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); + Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp new file mode 100644 index 00000000000..096efbded87 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_GetValues_1/CPP/webheadercollection_getvalues_1.cpp @@ -0,0 +1,58 @@ + + +/* +This program demonstrate's the 'GetValues(String*)' method of 'WebHeaderCollection' class. + +The program creates a 'HttpWebRequest' Object* from the specified URL and gets the response from it. The +headers of the response is assigned to a 'WeHeaderCollection' Object* and all the values associated with +the corresponding headers in the response are displayed to the console. +*/ +#using + +using namespace System; +using namespace System::Net; +int main() +{ + try + { + // + // Create a web request for S"www.msn.com". + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); + myHttpWebRequest->Timeout = 1000; + + // Get the associated response for the above request. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Get the headers associated with the response. + WebHeaderCollection^ myWebHeaderCollection = myHttpWebResponse->Headers; + for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) + { + String^ header = myWebHeaderCollection->GetKey( i ); + array^values = myWebHeaderCollection->GetValues( header ); + if ( values->Length > 0 ) + { + Console::WriteLine( "The values of {0} header are : ", header ); + for ( int j = 0; j < values->Length; j++ ) + Console::WriteLine( "\t {0}", values[ j ] ); + } + else + Console::WriteLine( "There is no value associated with the header" ); + } + myHttpWebResponse->Close(); + // + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException raised : {0}", e->Message ); + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); + Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); + Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "\n Exception raised : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp new file mode 100644 index 00000000000..842da2d6a21 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_IsRestricted/CPP/webheadercollection_isrestricted.cpp @@ -0,0 +1,49 @@ + + +/*This program demonstrates the S"IsRestricted" method of S"WebHeaderCollection". +It checks if the first header returned in the response is a restricted header or not. +*/ +#using + +using namespace System; +using namespace System::Net; +int main() +{ + // + try + { + // Create a web request for S"www.msn.com". + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); + + // Get the associated response for the above request. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Get the headers associated with the response. + WebHeaderCollection^ myWebHeaderCollection = myHttpWebResponse->Headers; + for ( int i = 0; i < myWebHeaderCollection->Count; i++ ) + { + // Check if the first response header is restriced. + if ( WebHeaderCollection::IsRestricted( dynamic_cast(myWebHeaderCollection->AllKeys[ i ]) ) ) + Console::WriteLine( "' {0}' is a restricted header", myWebHeaderCollection->AllKeys[ i ] ); + else + Console::WriteLine( "' {0}' is not a restricted header", myWebHeaderCollection->AllKeys[ i ] ); + } + myHttpWebResponse->Close(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException is thrown.\nMessage is: {0}", e->Message ); + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); + Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); + Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); + } +// +} + diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp new file mode 100644 index 00000000000..c8286d49cd4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Remove/CPP/webheadercollection_remove.cpp @@ -0,0 +1,79 @@ + + +/* +This program demonstrates the S"Remove" method of S"WebHeaderCollection" class. +It uses the S"Remove" method of S"WebHeaderCollection" to remove the 'Cache-Control' header from the request. +The 'Cache-Control' header is used to specify the directive that must be followed by all caching mechanisms +in the Request-Response chain. The 'no-cache' directive indicates that the caching mechanism must not resend +the cached response for a previous request with->Item[Out] validating* from the origin server (HTTP version 1.1, RFC2616, +Sec 14.9) +*/ +#using + +using namespace System; +using namespace System::Net; +void printHeaders( WebHeaderCollection^ headers ) +{ + if ( headers->Count == 0 ) + Console::WriteLine( "\tNo Headers to Display" ); + + for ( int i = 0; i < headers->Count; i++ ) + Console::WriteLine( "\t {0} : {1}", headers->AllKeys[ i ], headers[ i ] ); +} + +int main() +{ + // + try + { + // Create a web request for S"www.msn.com". + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); + + // Get the headers associated with the request. + WebHeaderCollection^ myWebHeaderCollection = myHttpWebRequest->Headers; + + // Set the Cache-Control header. + myWebHeaderCollection->Set( "Cache-Control", "no-cache" ); + + // Get the associated response for the above request. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Print the headers of the request to console. + Console::WriteLine( "Print request headers after adding Cache-Control for first request:" ); + printHeaders( myHttpWebRequest->Headers ); + + // Remove the Cache-Control header for the new request. + myWebHeaderCollection->Remove( "Cache-Control" ); + + // Get the response for the new request. + myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + + // Print the headers of the new request with->Item[Out] the* Cache-Control header. + Console::WriteLine( "Print request headers after removing Cache-Control for the new request:" ); + printHeaders( myHttpWebRequest->Headers ); + myHttpWebResponse->Close(); + } + // Catch exception if trying to remove a restricted header. + catch ( ArgumentException^ e ) + { + Console::WriteLine( "Error : Trying to remove a restricted header" ); + Console::WriteLine( "ArgumentException is thrown. Message is : {0}", e->Message ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException is thrown. Message is : {0}", e->Message ); + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); + Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); + Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); + } + + + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp new file mode 100644 index 00000000000..08a56e07a73 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebHeaderCollection_Set/CPP/webheadercollection_set.cpp @@ -0,0 +1,65 @@ + + +/* This program demonstrates the S"Set" method of S"WebHeaderCollection" class. +It sets the value of the 'Cache-Control' header in the request to S"no-cache". The 'Cache-Control' header +is used to specify the directive that must be followed by all caching mechanisms in the Request-Response chain. +The 'no-cache' directive indicates that the caching mechanism must not resend the cached response for a +previous request with->Item[Out] validating* from the origin server (HTTP version 1.1, RFC2616, Sec 14.9). +*/ +#using + +using namespace System; +using namespace System::Net; +void PrintHeaders( WebHeaderCollection^ headers ) +{ + Console::WriteLine( "Printing Headers : " ); + if ( headers->Count == 0 ) + Console::WriteLine( "\tNo Headers to Display" ); + + for ( int i = 0; i < headers->Count; i++ ) + Console::WriteLine( "\t {0} : {1}", headers->AllKeys[ i ], headers[ i ] ); +} + +int main() +{ + // + try + { + // Create a web request for S"www.msn.com". + HttpWebRequest^ myHttpWebRequest = dynamic_cast(WebRequest::Create( "http://www.msn.com" )); + + // Get the headers associated with the request. + WebHeaderCollection^ myWebHeaderCollection = myHttpWebRequest->Headers; + + // Set the Cache-Control header in the request. + myWebHeaderCollection->Set( "Cache-Control", "no-cache" ); + + // Get the associated response for the above request. + HttpWebResponse^ myHttpWebResponse = dynamic_cast(myHttpWebRequest->GetResponse()); + Console::WriteLine( "Headers after 'Set' method is used on Cache-Control :" ); + + // Print the headers for the request. + PrintHeaders( myWebHeaderCollection ); + myHttpWebResponse->Close(); + } + // Catch exception if trying to set a restricted header. + catch ( ArgumentException^ e ) + { + Console::WriteLine( "ArgumentException is thrown. Message is : {0}", e->Message ); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException is thrown. Message is : {0}", e->Message ); + if ( e->Status == WebExceptionStatus::ProtocolError ) + { + Console::WriteLine( "Status Code : {0}", (dynamic_cast(e->Response))->StatusCode ); + Console::WriteLine( "Status Description : {0}", (dynamic_cast(e->Response))->StatusDescription ); + Console::WriteLine( "Server : {0}", (dynamic_cast(e->Response))->Server ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception is thrown. Message is : {0}", e->Message ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp new file mode 100644 index 00000000000..f4e56ffd6bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Accept/CPP/source.cpp @@ -0,0 +1,52 @@ +// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; + +/* +* Demonstrate how to use the WebPermissionAttribute to specify the Accept property. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; + +public ref class WebPermissionAttribute_AcceptConnect +{ +// +public: + // Deny access to a specific resource by setting the Accept property. + [method:WebPermission(SecurityAction::Deny,Accept="http://www.contoso.com/Private.htm")] + + static void CheckAcceptPermission( String^ uriToCheck ) + { + WebPermission^ permissionToCheck = gcnew WebPermission; + permissionToCheck->AddPermission( NetworkAccess::Accept, uriToCheck ); + permissionToCheck->Demand(); + } + + static void demoDenySite() + { + // Pass the security check when accessing allowed resources. + CheckAcceptPermission( "http://www.contoso.com/" ); + Console::WriteLine( "Public page has passed Accept permission check" ); + + try + { + // Throw a SecurityException when trying to access not allowed resources. + CheckAcceptPermission( "http://www.contoso.com/Private.htm" ); + Console::WriteLine( "This line will not be printed" ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Exception trying to access private resource: {0}", e->Message ); + } + } +// +}; + +int main() +{ + WebPermissionAttribute_AcceptConnect::demoDenySite(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp new file mode 100644 index 00000000000..05d097162a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptConnect/CPP/webpermissionattribute_acceptconnect.cpp @@ -0,0 +1,46 @@ +// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; + +// Demonstrate how to use the WebPermissionAttribute to specify an allowable ConnectPattern. + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; + +public ref class WebPermissionAttribute_AcceptConnect +{ +// +// +public: + // Deny access to a specific resource by setting the ConnectPattern property. + [method:WebPermission(SecurityAction::Deny,ConnectPattern="http://www.contoso.com/")] + + void Connect() + { + // Create a Connection. + HttpWebRequest^ myWebRequest = (HttpWebRequest^)(WebRequest::Create( "http://www.contoso.com" )); + Console::WriteLine( "This line should never be printed" ); + } +// +// +}; + +int main() +{ + try + { + WebPermissionAttribute_AcceptConnect^ myWebAttrib = gcnew WebPermissionAttribute_AcceptConnect; + myWebAttrib->Connect(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Security Exception raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp new file mode 100644 index 00000000000..fd594b719b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_AcceptPattern/CPP/source.cpp @@ -0,0 +1,54 @@ +// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; + +/* +This program demonstrates the 'Connect' and 'Accept' properties of the class 'WebPermissionAttribute'. +The program uses declarative security for calling the code in 'Connect' method. +By using the 'Accept' and 'Connect' properties of 'WebPermissionAttribute' accept and connect access +has been given to the uri www.contoso.com. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; +using namespace System::Text::RegularExpressions; + +public ref class WebPermissionAttribute_AcceptConnect +{ +// +public: + [method:WebPermission(SecurityAction::Deny,AcceptPattern="http://www\\.contoso\\.com/Private/.*")] + static void CheckAcceptPermission( String^ uriToCheck ) + { + WebPermission^ permissionToCheck = gcnew WebPermission; + permissionToCheck->AddPermission( NetworkAccess::Accept, uriToCheck ); + permissionToCheck->Demand(); + } + + static void demoDenySite() + { + // Passes a security check. + CheckAcceptPermission( "http://www.contoso.com/Public/page.htm" ); + Console::WriteLine( "Public page has passed Accept permission check" ); + + try + { + // Throws a SecurityException. + CheckAcceptPermission( "http://www.contoso.com/Private/page.htm" ); + Console::WriteLine( "This line will not be printed" ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Expected exception: {0}", e->Message ); + } + } +// +}; + +int main() +{ + WebPermissionAttribute_AcceptConnect::demoDenySite(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp new file mode 100644 index 00000000000..d369bcc8ee1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Connect/CPP/source.cpp @@ -0,0 +1,50 @@ +// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::connect; + +// Demonstrate how to use the WebPermissionAttribute Connect property. + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; + +public ref class WebPermissionAttribute_Connect +{ +// +public: + // Set the WebPermissionAttribute Connect property. + [method:WebPermission(SecurityAction::Deny,Connect="http://www.contoso.com/Private.htm")] + + static void demoDenySite() + { + //Pass the security check. + CheckConnectPermission( "http://www.contoso.com/Public.htm" ); + Console::WriteLine( "Public page has passed connect permission check" ); + + try + { + //Throw a SecurityException. + CheckConnectPermission( "http://www.contoso.com/Private.htm" ); + Console::WriteLine( "This line will not be printed" ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Expected exception {0}", e->Message ); + } + } + + static void CheckConnectPermission( String^ uriToCheck ) + { + WebPermission^ permissionToCheck = gcnew WebPermission; + permissionToCheck->AddPermission( NetworkAccess::Connect, uriToCheck ); + permissionToCheck->Demand(); + } +// +}; + +int main() +{ + WebPermissionAttribute_Connect::demoDenySite(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp new file mode 100644 index 00000000000..648da93ee85 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_ConnectPattern/CPP/source.cpp @@ -0,0 +1,51 @@ +// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Connect; + +// Demonstrate how to use the WebPermissionAttribute ConnectPattern property. + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; +using namespace System::Text::RegularExpressions; + +public ref class WebPermissionAttribute_Connect +{ +// +public: + // Set the WebPermissionAttribute ConnectPattern property. + [WebPermission(SecurityAction::Deny,ConnectPattern="http://www\\.contoso\\.com/Private/.*")] + + static void CheckConnectPermission( String^ uriToCheck ) + { + WebPermission^ permissionToCheck = gcnew WebPermission; + permissionToCheck->AddPermission( NetworkAccess::Connect, uriToCheck ); + permissionToCheck->Demand(); + } + + static void demoDenySite() + { + //Pass the security check. + CheckConnectPermission( "http://www.contoso.com/Public/page.htm" ); + Console::WriteLine( "Public page has passed Connect permission check" ); + + try + { + //Throw a SecurityException. + CheckConnectPermission( "http://www.contoso.com/Private/page.htm" ); + Console::WriteLine( "This line will not be printed" ); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Expected exception {0}", e->Message ); + } + } +}; +// + +int main() +{ + WebPermissionAttribute_Connect::demoDenySite(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp new file mode 100644 index 00000000000..8606c8f6c78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermissionAttribute_Constructor/CPP/source.cpp @@ -0,0 +1,47 @@ +// System::Net::WebPermissionAttribute::Connect;System::Net::WebPermissionAttribute::Accept; + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::IO; + +public ref class WebPermissionAttribute_AcceptConnect +{ +// +public: + // Set the declarative security for the URI. + [WebPermission(SecurityAction::Deny,Connect="http://www.contoso.com/")] + void Connect() + { + // Throw an exception. + try + { + HttpWebRequest^ myWebRequest = dynamic_cast(WebRequest::Create( "http://www.contoso.com/" )); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e ); + } +// + } +}; + +int main() +{ + try + { + WebPermissionAttribute_AcceptConnect^ myWebAttrib = gcnew WebPermissionAttribute_AcceptConnect; + myWebAttrib->Connect(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "Security Exception raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp new file mode 100644 index 00000000000..df794666883 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_AcceptConnectList/CPP/webpermission_acceptconnectlist.cpp @@ -0,0 +1,99 @@ + + +// System::Net::WebPermission::ConnectList;System::Net::WebPermission::AcceptList; +/** +* This program demonstrates the use of the ConnectList and AcceptList WebPermission +* class prerties. +* It first creates a WebPermission object with Permissionstate set to None and then +* sets the Connect and Accept access right to some predefined URLs. +* The using the AcceptList and ConnectList properties it displays the URLs that have +* the Accept and Connect permission set, respectively. +*/ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +class WebPermission_AcceptConnectList +{ +public: + void DisplayAcceptConnect() + { + // Create a 'WebPermission' object with permission state set to 'None'. + WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None ); + + // Allow 'Connect' access right to first set of URL's. + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.contoso.com" ); + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.adventure-works.com" ); + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.alpineskihouse.com" ); + + // Allow 'Accept' access right to second set of URL's. + myWebPermission1->AddPermission( NetworkAccess::Accept, "http://www.contoso.com" ); + myWebPermission1->AddPermission( NetworkAccess::Accept, "http://www.adventure-works.com" ); + myWebPermission1->AddPermission( NetworkAccess::Accept, "http://www.alpineskihouse.com" ); + + // Check whether all callers higher in the call stack have been granted the permission or not. + myWebPermission1->Demand(); + Console::WriteLine( "The Attributes, Values and Children of the 'WebPermission' object are :\n" ); + + // Display the Attributes, Values and Children of the XML encoded instance. + PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission1->ToXml()->Children ); + + // + // Gets all URIs with Connect permission. + IEnumerator^ myEnum = myWebPermission1->ConnectList; + Console::WriteLine( "\nThe URIs with Connect permission are :\n" ); + while ( myEnum->MoveNext() ) + { + Console::WriteLine( "\tThe URI is : {0}", myEnum->Current ); + } + // + + // + // Get all URI's with Accept permission. + IEnumerator^ myEnum1 = myWebPermission1->AcceptList; + Console::WriteLine( "\n\nThe URIs with Accept permission are :\n" ); + while ( myEnum1->MoveNext() ) + { + Console::WriteLine( "\tThe URI is : {0}", myEnum1->Current ); + } + // + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) + { + // Get the enumerator that can iterate through Hashtabel. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-Attribute-\t-Value-" ); + while ( myEnumerator->MoveNext() ) + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + + Console::WriteLine(); + IEnumerator^ myEnumerator1 = myList->GetEnumerator(); + Console::WriteLine( "The Children are : \n" ); + while ( myEnumerator1->MoveNext() ) + Console::Write( myEnumerator1->Current ); + } + +}; + +int main() +{ + try + { + WebPermission_AcceptConnectList * myWebPermission_AcceptConnectList = new WebPermission_AcceptConnectList; + myWebPermission_AcceptConnectList->DisplayAcceptConnect(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp new file mode 100644 index 00000000000..7ecf4f0e7a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Constructor4/CPP/webpermission_constructor4.cpp @@ -0,0 +1,80 @@ +// System::Net::WebPermission::WebPermission(NetworkAccess, Regex); + +/* +This program demonstrates the 'WebPermission(NetworkAccess, Regex)' constructor of 'WebPermission' class. +First a 'Regex' Object* is created that will accept all the urls which is having the hostfragment of +'www.contoso.com'.Then a 'WebPermission' Object* created by passing the 'NetworkAccess' permission and +'Regex' Object* as parameters. It checks the 'WebPermission' for all the url's having the host fragment +as 'www.contoso.com'. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Text::RegularExpressions; +using namespace System::Collections; + +class WebPermission_regexConstructor +{ +public: + void CreateRegexConstructor() + { +// + // Create an instance of 'Regex' that accepts all URL's containing the host + // fragment 'www.contoso.com'. + Regex^ myRegex = gcnew Regex( "http://www.contoso.com/.*" ); + + // Create a WebPermission that gives the permissions to all the hosts containing + // the same fragment. + WebPermission^ myWebPermission = gcnew WebPermission( NetworkAccess::Connect,myRegex ); + + // Checks all callers higher in the call stack have been granted the permission. + myWebPermission->Demand(); +// + + Console::WriteLine( "Attribute and Values of WebPermission are : \n" ); + // Display the Attributes, Values and Children of the XML encoded copied instance. + PrintKeysAndValues( myWebPermission->ToXml()->Attributes, myWebPermission->ToXml()->Children ); + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) + { + // Get the enumerator that can iterate through Hashtable. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-ATTRIBUTES-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + + Console::WriteLine(); + + IEnumerator^ myEnumerator1 = myList->GetEnumerator(); + Console::WriteLine( "\nThe Children are : " ); + while ( myEnumerator1->MoveNext() ) + { + Console::Write( "\t {0}", myEnumerator1->Current ); + } + } +}; + +int main() +{ + try + { + WebPermission_regexConstructor * myWebPermissionRegex = new WebPermission_regexConstructor; + myWebPermissionRegex->CreateRegexConstructor(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException raised: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp new file mode 100644 index 00000000000..8b3e407874a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Copy/CPP/webpermission_copy.cpp @@ -0,0 +1,91 @@ +// System::Net::WebPermission::WebPermission(PermissionState);System::Net::WebPermission::Copy; + +/** +* This program demonstrates the WebPermission(PermissionState) constructor and +* Copy method of the WebPermission class . +* It creates a WebPermission instance with Permissionstate set to None and +* sets the access right to one pair of URLs. +* Then it uses the Copy method to create another instance of WebPermission class +* Finally, the attributes , values and childrens of both the XML encoded instances +* are displayed. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class CopyWebPermission +{ +public: + void CreateCopy() + { +// + // Create a WebPermission instance. + WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None ); + + // Allow access to the first set of URL's. + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.microsoft.com/default.htm" ); + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.msn.com" ); + + // Check whether all callers higher in the call stack have been granted the permissionor not. + myWebPermission1->Demand(); +// + +// + // Create another WebPermission instance that is the copy of the above WebPermission instance. + WebPermission^ myWebPermission2 = (WebPermission^)(myWebPermission1->Copy()); + + // Check whether all callers higher in the call stack have been granted the permissionor not. + myWebPermission2->Demand(); +// + + Console::WriteLine( "The Attributes and Values are :\n" ); + // Display the Attributes, Values and Children of the XML encoded instance. + PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission1->ToXml()->Children ); + Console::WriteLine( "\nCopied Instance Attributes and Values are:\n" ); + + // Display the Attributes, Values and Children of the XML encoded copied instance. + PrintKeysAndValues( myWebPermission2->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) + { + // Gets the enumerator that can iterate through Hashtable. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + + IEnumerator^ myEnumerator1 = myList->GetEnumerator(); + Console::WriteLine( "The Children are: " ); + while ( myEnumerator1->MoveNext() ) + { + Console::Write( "\t {0}", myEnumerator1->Current ); + } + } +}; + +int main() +{ + try + { + CopyWebPermission^ myCopyWebPermission = gcnew CopyWebPermission; + myCopyWebPermission->CreateCopy(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp new file mode 100644 index 00000000000..ea42dec4dbc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_FromToXml/CPP/webpermission_fromtoxml.cpp @@ -0,0 +1,76 @@ +// System::Net::WebPermission::ToXml;System::Net::WebPermission::FromXml; + +/** +* This program shows the use of the ToXml and FromXml methods of the WebPermission class. +* It creates a WebPermission instance with the Permissionstate set to None and +* displays the attributes and the values of the XML encoded instance . +* Then a SecurityElement instance is created and it's attributes are +* set. +* Finally, using the FromXml method the WebPermission instance is reconstructed from +* the above SecurityElement instance and the attributes are displayed. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; +public ref class WebPermission_FromToXml +{ +public: + void CallXml() + { +// + // Create a WebPermission without permission on the protected resource + WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None ); + + // Create a SecurityElement by calling the ToXml method on the WebPermission + // instance and display its attributes (which hold the XML encoding of + // the WebPermission). + Console::WriteLine( "Attributes and Values of the WebPermission are:" ); + myWebPermission1->ToXml(); + + // Create another WebPermission with no permission on the protected resource + WebPermission^ myWebPermission2 = gcnew WebPermission( PermissionState::None ); + + //Converts the new WebPermission from XML using myWebPermission1. + myWebPermission2->FromXml( myWebPermission1->ToXml() ); +// + + Console::WriteLine( "The Attributes and Values of 'WebPermission' instance after reconstruction are: \n" ); + // Display the Attributes and values of the XML encoded instances. + PrintKeysAndValues( myWebPermission2->ToXml()->Attributes ); + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable ) + { + // Get the enumerator to iterate through Hashtable. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } +}; + +int main() +{ + try + { + WebPermission_FromToXml^ myWebPermission_FromToXml = gcnew WebPermission_FromToXml; + myWebPermission_FromToXml->CallXml(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp new file mode 100644 index 00000000000..692f71b9fea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Intersect/CPP/webpermission_intersect.cpp @@ -0,0 +1,104 @@ +// System::Net::WebPermission::WebPermission(); +// System::Net::WebPermission->AddPermission(NetworkAccess, stringuri); +// System::Net::WebPermission::Intersect; + +/** +* This program shows the use of the WebPermission() constructor, the AddPermission, +* and Intersect' methods of the WebPermission' class. +* It first creates two WebPermission objects with no arguments, with each of them +* setting the access rights to one pair of URLs. +* Then it displays the attributes , values and childrens of the XML encoded instances. +* Finally, it creates a third WebPermission Object* using the logical intersection of the +* first two objects. It does so by using the Intersect method. +* It then displays the attributes , values and childrens of the related XML encoded +* instances. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +class WebPermissionIntersect +{ +public: + void CreateIntersect() + { +// + // Create two WebPermission instances. + WebPermission^ myWebPermission1 = gcnew WebPermission; + WebPermission^ myWebPermission2 = gcnew WebPermission; + +// + // Allow access to the first set of resources. + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.contoso.com/default.htm" ); + myWebPermission1->AddPermission( NetworkAccess::Connect, "http://www.adventure-works.com/default.htm" ); + + // Check whether if the callers higher in the call stack have been granted + // access permissions. + myWebPermission1->Demand(); +// + + // Allow access right to the second set of resources. + myWebPermission2->AddPermission( NetworkAccess::Connect, "http://www.alpineskihouse.com/default.htm" ); + myWebPermission2->AddPermission( NetworkAccess::Connect, "http://www.baldwinmuseumofscience.com/default.htm" ); + myWebPermission2->Demand(); + +// + // Display the attributes , values and childrens of the XML encoded instances. + Console::WriteLine( "Attributes and values of first 'WebPermission' instance are :" ); + PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); + + Console::WriteLine( "\nAttributes and values of second 'WebPermission' instance are : " ); + PrintKeysAndValues( myWebPermission2->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); + +// + // Create a third WebPermission instance via the logical intersection of the previous + // two WebPermission instances. + WebPermission^ myWebPermission3 = (WebPermission^)(myWebPermission1->Intersect( myWebPermission2 )); + + Console::WriteLine( "\nAttributes and Values of the WebPermission instance after the Intersect are:\n" ); + Console::WriteLine( myWebPermission3->ToXml() ); +// + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) + { + // Get the enumerator that can iterate through Hashtable. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + + IEnumerator^ myEnumerator1 = myList->GetEnumerator(); + Console::WriteLine( "The Children are : " ); + while ( myEnumerator1->MoveNext() ) + { + Console::Write( "\t {0}", myEnumerator1->Current ); + } + } +}; + +int main() +{ + try + { + WebPermissionIntersect * myWebPermissionIntersect = new WebPermissionIntersect; + myWebPermissionIntersect->CreateIntersect(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp new file mode 100644 index 00000000000..aa616240be8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset/CPP/webpermission_issubset.cpp @@ -0,0 +1,109 @@ +// System::Net::WebPermission->AddPermission(NetworkAccess, regex); +// System::Net::WebPermission::IsSubsetOf; + +/** +* This program shows how to use the AddPermission(NetworkAccess, regex) and +* IsSubset methods of WebPermission class. +* It creates two WebPermission instances with the Connect access rights for the +* specified URIs. +* For he first WebPermission instance, a Connect access right is given to the +* URLs with the host fragment www.microsoft.com. This is done by using +* the AddPermission(NetworkAccess, regex) method. +* Then, a third WebPermission instance is created with the Connect access right to +* the URLs of the first and second WebPermission instances. +* Finally, the attributes, values and children of that instance are displayed. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; +using namespace System::Text::RegularExpressions; + +class WebPermissionIsSubset +{ +public: + void CheckSubset() + { +// + // Create a WebPermission. + WebPermission^ myWebPermission1 = gcnew WebPermission; + + // Allow Connect access to the specified URLs. + myWebPermission1->AddPermission( NetworkAccess::Connect, gcnew Regex( "http://www\\.contoso\\.com/.*", + (RegexOptions)(RegexOptions::Compiled | RegexOptions::IgnoreCase | RegexOptions::Singleline) ) ); + + myWebPermission1->Demand(); +// + + // Create another WebPermission with the specified URL. + WebPermission^ myWebPermission2 = gcnew WebPermission( NetworkAccess::Connect,"http://www.contoso.com" ); + // Check whether all callers higher in the call stack have been granted the permission. + myWebPermission2->Demand(); + +// + WebPermission^ myWebPermission3 = nullptr; + + // Check which permissions have the Connect access to more number of URLs. + if ( myWebPermission2->IsSubsetOf( myWebPermission1 ) ) + { + Console::WriteLine( "\n WebPermission2 is the Subset of WebPermission1\n" ); + myWebPermission3 = myWebPermission1; + } + else if ( myWebPermission1->IsSubsetOf( myWebPermission2 ) ) + { + Console::WriteLine( "\n WebPermission1 is the Subset of WebPermission2" ); + myWebPermission3 = myWebPermission2; + } + else + { + // Create the third permission. + myWebPermission3 = (WebPermission^)(myWebPermission1->Union( myWebPermission2 )); + } +// + + // Prints the attributes, values and children of XML encoded instances. + Console::WriteLine( "\nAttributes and Values of third WebPermission instance are : " ); + PrintKeysAndValues( myWebPermission3->ToXml()->Attributes, myWebPermission3->ToXml()->Children ); + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) + { + // Get the enumerator that can iterate through Hashtable. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + + IEnumerator^ myEnumerator1 = myList->GetEnumerator(); + Console::WriteLine( "The Children are : " ); + while ( myEnumerator1->MoveNext() ) + { + Console::Write( "\t {0}", myEnumerator1->Current ); + } + } +}; + +int main() +{ + try + { + WebPermissionIsSubset * myWebPermissionIsSubset = new WebPermissionIsSubset; + myWebPermissionIsSubset->CheckSubset(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp new file mode 100644 index 00000000000..5f132c99a7c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_IsSubset2/CPP/source.cpp @@ -0,0 +1,41 @@ +// System::Net::WebPermission->AddPermission(NetworkAccess, regex);System::Net::WebPermission::IsSubsetOf; + +/** +* This program shows the use of the AddPermission(NetworkAccess, regex) and +* IsSubset methods of the WebPermission class. +* It creates two WebPermission instances with the Connect access rights for the specified +* URIs. The second URI being a subset of the first one. +* Then the IsSubsetOf method is called to verify that the second URI is indeed a subset +* of the firts one. The result of the call to the IsSubsetOf is then displayed. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; +using namespace System::Text::RegularExpressions; + +static void myIsSubsetExample() +{ +// + // Create the target permission. + WebPermission^ targetPermission = gcnew WebPermission; + targetPermission->AddPermission( NetworkAccess::Connect, gcnew Regex( "www\\.contoso\\.com/Public/.*" ) ); + + // Create the permission for a URI matching target. + WebPermission^ connectPermission = gcnew WebPermission; + connectPermission->AddPermission( NetworkAccess::Connect, "www.contoso.com/Public/default.htm" ); + + //The following statement prints true. + Console::WriteLine( "Is the second URI a subset of the first one?: {0}", connectPermission->IsSubsetOf( targetPermission ) ); +// +} + +int main() +{ + // Verify that the second URI is a subset of the first one. + myIsSubsetExample(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp new file mode 100644 index 00000000000..ccc6b055614 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Regex/CPP/regex.cpp @@ -0,0 +1,50 @@ +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Text::RegularExpressions; +using namespace System::Collections; + +void MySample() +{ +// + // Create a Regex that accepts all URLs containing the host fragment www.contoso.com. + Regex^ myRegex = gcnew Regex( "http://www\\.contoso\\.com/.*" ); + + // Create a WebPermission that gives permissions to all the hosts containing the same host fragment. + WebPermission^ myWebPermission = gcnew WebPermission( NetworkAccess::Connect,myRegex ); + + //Add connect privileges for a www.adventure-works.com. + myWebPermission->AddPermission( NetworkAccess::Connect, "http://www.adventure-works.com" ); + + //Add accept privileges for www.alpineskihouse.com. + myWebPermission->AddPermission( NetworkAccess::Accept, "http://www.alpineskihouse.com/" ); + + // Check whether all callers higher in the call stack have been granted the permission. + myWebPermission->Demand(); + + // Get all the URIs with Connect permission. + IEnumerator^ myConnectEnum = myWebPermission->ConnectList; + Console::WriteLine( "\nThe 'URIs' with 'Connect' permission are :\n" ); + while ( myConnectEnum->MoveNext() ) + { + Console::WriteLine( "\t{0}", myConnectEnum->Current ); + } + + // Get all the URIs with Accept permission. + IEnumerator^ myAcceptEnum = myWebPermission->AcceptList; + Console::WriteLine( "\n\nThe 'URIs' with 'Accept' permission is :\n" ); + + while ( myAcceptEnum->MoveNext() ) + { + Console::WriteLine( "\t{0}", myAcceptEnum->Current ); + } +// +} + +int main() +{ + MySample(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp new file mode 100644 index 00000000000..9610688f608 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebPermission_Union/CPP/webpermission_union.cpp @@ -0,0 +1,92 @@ +// System::Net::WebPermission::WebPermission(NetworkAccess, uriString);System::Net::WebPermission::Union; + +/** +* This program shows the use of the WebPermission(NetworkAccess access, String* uriString) +* constructor and Union method of the WebPermission' class. +* It creates two instance of the WebPermission class with the specified access +* rights to the predefined URIs. +* It displays the attributes , values and childrens of those XML encoded +* instances. +* Then, using the Union method, it creates a third WebPermission instance +* via a logical union of the first two. +* Finally, it displays the attributes , values and childrens of those XML encoded +* instances. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class WebPermissionUnion +{ +public: + void CreateUnion() + { +// + // Create a WebPermission::instance. + WebPermission^ myWebPermission1 = gcnew WebPermission( NetworkAccess::Connect,"http://www.contoso.com/default.htm" ); + myWebPermission1->Demand(); +// + + // Create another WebPermission instance. + WebPermission^ myWebPermission2 = gcnew WebPermission( NetworkAccess::Connect,"http://www.adventure-works.com" ); + myWebPermission2->Demand(); + + // Print the attributes, values and childrens of the XML encoded instances. + Console::WriteLine( "Attributes and values of the first WebPermission are : " ); + PrintKeysAndValues( myWebPermission1->ToXml()->Attributes, myWebPermission1->ToXml()->Children ); + + Console::WriteLine( "\nAttributes and values of the second WebPermission are : " ); + PrintKeysAndValues( myWebPermission2->ToXml()->Attributes, myWebPermission2->ToXml()->Children ); + +// + // Create another WebPermission that is the Union of previous two WebPermission + // instances. + WebPermission^ myWebPermission3 = (WebPermission^)(myWebPermission1->Union( myWebPermission2 )); + Console::WriteLine( "\nAttributes and values of the WebPermission after the Union are : " ); + // Display the attributes, values and children. + Console::WriteLine( myWebPermission3->ToXml() ); +// + } + +private: + void PrintKeysAndValues( Hashtable^ myHashtable, IEnumerable^ myList ) + { + // Get the enumerator that can iterate through Hashtable. + IDictionaryEnumerator^ myEnumerator = myHashtable->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + + Console::WriteLine(); + IEnumerator^ myEnumerator1 = myList->GetEnumerator(); + Console::WriteLine( "The Children are : " ); + while ( myEnumerator1->MoveNext() ) + { + Console::Write( "\t {0}", myEnumerator1->Current ); + } + } +}; + +int main() +{ + try + { + WebPermissionUnion^ myWebPermissionUnion = gcnew WebPermissionUnion; + myWebPermissionUnion->CreateUnion(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException: {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp new file mode 100644 index 00000000000..c6e380e0a44 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_BeginGetRequest/CPP/webrequest_begingetrequest.cpp @@ -0,0 +1,92 @@ + + +// +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; +using namespace System::Threading; +public ref class RequestState +{ +public: + + // This class stores the request state of the request. + WebRequest^ request; + RequestState() + { + request = nullptr; + } + +}; + +ref class WebRequest_BeginGetRequeststream +{ +public: + static ManualResetEvent^ allDone = gcnew ManualResetEvent( false ); + static void ReadCallback( IAsyncResult^ asynchronousResult ) + { + RequestState^ myRequestState = dynamic_cast(asynchronousResult->AsyncState); + WebRequest^ myWebRequest = myRequestState->request; + + // End of the Asynchronus request. + Stream^ streamResponse = myWebRequest->EndGetRequestStream( asynchronousResult ); + + // Create a string that is to be posted to the uri. + Console::WriteLine( "Please enter a string to be posted:" ); + String^ postData = Console::ReadLine(); + + // Convert the string into a Byte array. + array^byteArray = Encoding::UTF8->GetBytes( postData ); + + // Write data to the stream. + streamResponse->Write( byteArray, 0, postData->Length ); + streamResponse->Close(); + allDone->Set(); + } + +}; + +int main() +{ + + // + // Create a new request to the mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + + // Create an instance of the RequestState and assign 'myWebRequest' to its request field. + RequestState^ myRequestState = gcnew RequestState; + myRequestState->request = myWebRequest; + myWebRequest->ContentType = "application/x-www-form-urlencoded"; + + // Set the 'Method' prperty to 'POST' to post data to a Uri. + myRequestState->request->Method = "POST"; + + // + // Start the Asynchronous 'BeginGetRequestStream' method call. + IAsyncResult^ r = dynamic_cast(myWebRequest->BeginGetRequestStream( gcnew AsyncCallback( WebRequest_BeginGetRequeststream::ReadCallback ), myRequestState )); + WebRequest_BeginGetRequeststream::allDone->WaitOne(); + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + Console::WriteLine( "The String* entered has been posted." ); + Console::WriteLine( "Please wait for the response..." ); + Stream^ streamResponse = myWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "The contents of the HTML page are " ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse Resource. + myWebResponse->Close(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp new file mode 100644 index 00000000000..ecac7b2e7b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_ContentType/CPP/webrequest_contenttype.cpp @@ -0,0 +1,95 @@ +/* System::Net::WebRequest::ContentType System::Net::WebRequest::ContentLength System::Net::WebRequest::GetRequestStream +This program demonstrates the 'GetRequestStream' method and the 'ContentLength' and 'ContentType' properties of + the 'WebRequest' class. +A new 'WebRequest' Object* is created and the method used for sending data is set to 'POST' method by setting +The 'Method' property to 'POST'. The 'ContentType' property is set to 'application/x-www-form-urlencoded'. +The 'ContentLength' property is set to the length of the Byte stream to be posted. A new 'Stream' Object* is +obtained from the 'GetRequestStream' method of the 'WebRequest' class. Data to be posted is requested from +the user and is posted using the stream Object*. The HTML contents of the page are then displayed to the +console after the Posted data is accepted by the URL. + +Note: This program POSTs data to the Uri: http://www20.Brinkster::com/codesnippets/next.asp +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// +// +// + // Create a new request to the mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com " ); + + // Set the 'Method' property of the myWebrequest to POST. + myWebRequest->Method = "POST"; + + // Create a new string object to POST data to the above url. + Console::WriteLine( "\nThe value of 'ContentLength' property before sending the data is {0}", myWebRequest->ContentLength ); + Console::WriteLine( "\nPlease enter the data to be posted to (http://www.contoso.com/codesnippets/next.asp) Uri" ); + String^ inputData = Console::ReadLine(); + String^ postData = String::Concat( "firstone= ", inputData ); + ASCIIEncoding^ encoding = gcnew ASCIIEncoding; + array^ byteArray = encoding->GetBytes( postData ); + +// + // Set the 'ContentType' property of the WebRequest. + myWebRequest->ContentType = "application/x-www-form-urlencoded"; + + // Set the 'ContentLength' property of the WebRequest. + myWebRequest->ContentLength = byteArray->Length; + Stream^ newStream = myWebRequest->GetRequestStream(); + newStream->Write( byteArray, 0, byteArray->Length ); + + // Close the Stream object. + newStream->Close(); + + // Assign the response object of 'WebRequest' to a 'WebResponse' variable. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); +// +// +// +// + + Console::WriteLine( "\nThe value of ContentLength property after sending the data is {0}", myWebRequest->ContentLength ); + Console::WriteLine( "\nThe String* entered has been successfully posted to the Uri." ); + Console::WriteLine( "\nPlease wait for the response......." ); + Stream^ streamResponse = myWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the Html page are : \n" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::WriteLine( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamRead->Close(); + streamResponse->Close(); + + // Release the resources of response Object*. + myWebResponse->Close(); + Console::WriteLine( "\nPress 'Enter' Key to Continue........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "WebException raised!" ); + Console::WriteLine( "\n {0}", e->Message ); + Console::WriteLine( "\n {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp new file mode 100644 index 00000000000..ff1aa9ebfe6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Create/CPP/webrequest_create.cpp @@ -0,0 +1,60 @@ +/*System::Net::WebRequest::Create(Uri) + +This program demonstrates the 'Create(Uri)' method of the 'WebRequest' class. +A new 'Uri' object is created to the specified Uri. +A new 'WebRequest' object is created to the 'specified' Uri by passing the 'Uri' object as parameter. +The response is obtained . +The HTML contents of the page of the requested Uri are displayed to the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new 'Uri' object with the specified string. + Uri^ myUri = gcnew Uri( "http://www.contoso.com" ); + // Create a new request to the above mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( myUri ); + // Assign the response object of 'WebRequest' to a 'WebResponse' variable. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); +// + + Stream^ streamResponse = myWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of HTML Page are : \n" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the WebResponse Resource. + myWebResponse->Close(); + Console::WriteLine( "\nPress 'Enter' key to continue................." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Caught!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException Caught!" ); + Console::WriteLine( "Source : {0} ", e->Source ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp new file mode 100644 index 00000000000..b4c440162f7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Headers/CPP/webrequest_headers.cpp @@ -0,0 +1,44 @@ +/*System::Net::WebRequest::Headers +* This program demonstrates the 'Headers' property of 'WebRequest' Class. +A new 'WebRequest' Object* is created. The (name, value) collection of the HTTP Headers are displayed to the +console. The contents of the HTML page of the requested URI are displayed to the console. */ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new request to the mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + + // Assign the response object of 'WebRequest' to a 'WebResponse' variable. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Release the resources of response object. + myWebResponse->Close(); + Console::WriteLine( "\nThe HttpHeaders are \n {0}", myWebRequest->Headers ); +// + + Console::WriteLine( "\nPress Enter Key to Continue........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "\n {0}", e->Message ); + Console::WriteLine( "\n {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception raised!" ); + Console::WriteLine( "Source : {0} ", e->Source ); + Console::WriteLine( "Message : {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp new file mode 100644 index 00000000000..6781c2fe114 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Proxy/CPP/webrequest_proxy.cpp @@ -0,0 +1,108 @@ +/*System::Net::WebRequest::Proxy +This program demonstrates the 'Proxy' property of the 'WebRequest' class. +A WebRequest Object* is created and a new Proxy Object is created. +The Proxy Object is assigned the 'Proxy' Property of the WebRequest Object and then printed to the console, this is the default Proxy setting. +New Proxy address and the credentials are requested from the User. +A new Proxy Object* is then constructed from the inputs. +Then the 'Proxy' property of the request is associated with the new Proxy Object* constructed*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new request to the mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + + WebProxy^ myProxy = gcnew WebProxy; + // Obtain the Proxy Prperty of the Default browser. + myProxy = (WebProxy^)(myWebRequest->Proxy); + + // Print myProxy address to the console. + Console::WriteLine( "\nThe actual default Proxy settings are {0}", myProxy->Address ); + try + { + Console::WriteLine( "\nPlease enter the new Proxy Address to be set " ); + Console::WriteLine( "The format of the address should be http://proxyUriAddress:portaddress" ); + Console::WriteLine( "Example:http://proxyadress.com:8080" ); + String^ proxyAddress; + proxyAddress = Console::ReadLine(); + + if ( proxyAddress->Length == 0 ) + { + myWebRequest->Proxy = myProxy; + } + else + { + Console::WriteLine( "\nPlease enter the Credentials" ); + Console::WriteLine( "Username:" ); + String^ username; + username = Console::ReadLine(); + Console::WriteLine( "\nPassword:" ); + String^ password; + password = Console::ReadLine(); + + // Create a new Uri object. + Uri^ newUri = gcnew Uri( proxyAddress ); + + // Associate the new Uri object to the myProxy object. + myProxy->Address = newUri; + + // Create a NetworkCredential object and is assign to the Credentials + // property of the Proxy object. + myProxy->Credentials = gcnew NetworkCredential( username,password ); + myWebRequest->Proxy = myProxy; + } + Console::WriteLine( "\nThe Address of the new Proxy settings are {0}", myProxy->Address ); + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Print the HTML contents of the page to the console. + Stream^ streamResponse = myWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the Html pages are :" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + + // Close the Stream object. + streamResponse->Close(); + streamRead->Close(); + + // Release the HttpWebResponse Resource. + myWebResponse->Close(); + Console::WriteLine( "\nPress any key to continue........." ); + Console::Read(); + } + catch ( UriFormatException^ e ) + { + Console::WriteLine( "\nUriFormatException is thrown->Message is {0}", e->Message ); + Console::WriteLine( "\nThe format of the myProxy address you entered is invalid" ); + Console::WriteLine( "\nPress any key to continue........." ); + Console::Read(); + } +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException is raised. " ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + Console::WriteLine( "\nStatus: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException is raised. " ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp new file mode 100644 index 00000000000..f763b367eb0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_RequestUri1/CPP/webrequest_requesturi.cpp @@ -0,0 +1,49 @@ +/*System::Net::WebRequest::RequestUri +* This program demonstrates the 'RequestUri' property of the 'WebRequest' Class +Here the 'RequestUri' property displays the request Uri name to the console. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new WebRequest object to the mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + Console::WriteLine( "\nThe Uri requested is {0}", myWebRequest->RequestUri); + // Assign the response object of 'WebRequest' to a 'WebResponse' variable. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + // Get the stream containing content returned by the server. + Stream^ streamResponse = myWebResponse->GetResponseStream(); + Console::WriteLine("\nThe Uri that responded to the request is '{0}'",myWebResponse->ResponseUri); + StreamReader^ reader = gcnew StreamReader(streamResponse); + // Read the content. + String^ responseFromServer = reader->ReadToEnd(); + // Display the content. + Console::WriteLine("\nThe HTML Contents received:"); + Console::WriteLine (responseFromServer); + // Cleanup the streams and the response. + reader->Close(); + streamResponse->Close(); + myWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine("\nWebException is raised. "); + Console::WriteLine("\nThe Error Message is {0} ", e->Message); + Console::WriteLine("\nStatus: {0}", e->Status); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException is raised " ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp new file mode 100644 index 00000000000..2c097ce1e40 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebRequest_Timeout/CPP/webrequest_timeout.cpp @@ -0,0 +1,66 @@ +/*System::Net::WebRequest::Time->Item[Out] ** This program demonstrates the 'Timeout' property of the WebRequest Class. +A new 'WebRequest' Object* is created. The default value of the 'Timeout' property is printed to the console. +It is then set to a value and displayed to the console. If the 'Timeout' property is set to a value less than +the time required to get the response an Exception is raised. The 'Timeout' property measures the time in +milliseconds. +*/ + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Net; +using namespace System::Text; + +int main() +{ + try + { +// + // Create a new WebRequest Object to the mentioned URL. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + Console::WriteLine( "\nThe Timeout time of the request before setting is : {0} milliseconds", myWebRequest->Timeout ); + + // Set the 'Timeout' property in Milliseconds. + myWebRequest->Timeout = 10000; + + // This request will throw a WebException if it reaches the timeout limit + // before it is able to fetch the resource. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); +// + + // Print the Timeout time to the console. + Console::WriteLine( "\nThe Time->Item[Out] time* of the request after setting the time is : {0} milliseconds", myWebRequest->Timeout ); + Console::WriteLine( "\nPress any Key to Continue..........." ); + Console::Read(); + // Print the HTML contents of the page to the console. + Stream^ streamResponse = myWebResponse->GetResponseStream(); + StreamReader^ streamRead = gcnew StreamReader( streamResponse ); + array^ readBuff = gcnew array(256); + int count = streamRead->Read( readBuff, 0, 256 ); + Console::WriteLine( "\nThe contents of the Html page of the requested Url are :" ); + while ( count > 0 ) + { + String^ outputData = gcnew String( readBuff,0,count ); + Console::Write( outputData ); + count = streamRead->Read( readBuff, 0, 256 ); + } + streamResponse->Close(); + streamRead->Close(); + // Release the HttpWebResponse Resource. + myWebResponse->Close(); + Console::WriteLine( "\nPress any Key to Continue..........." ); + Console::Read(); + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException is raised " ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + Console::WriteLine( "\nStatus: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nException is raised " ); + Console::WriteLine( "\nMessage: {0} ", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp new file mode 100644 index 00000000000..5c7f5fadec3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebResponse_Close/CPP/webresponse_close.cpp @@ -0,0 +1,58 @@ +// System::Net::WebResponse::Close +/*This program demonstrates the 'Close' method of 'WebResponse' Class. +It takes an URL from console and creates a 'WebRequest' Object* for the Url::It then gets back +the response Object* from the Url. The response Object* can be processed as desired. +The program then closes the response Object* and releases resources associated with it. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ + try + { +// + // Create a 'WebRequest' object with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + // Send the 'WebRequest' and wait for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Process the response here. + Console::WriteLine( "\nResponse Received::Trying to Close the response stream.." ); + // Release resources of response Object*. + myWebResponse->Close(); + Console::WriteLine( "\nResponse Stream successfully closed" ); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\r\nWebException Raised::Status is: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease type the Url as command line parameter" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "WebResponse_Close http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp new file mode 100644 index 00000000000..3a0d57ce817 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebResponse_ContentLength_Type/CPP/webresponse_contentlength_type.cpp @@ -0,0 +1,59 @@ +// System::Net::WebResponse::ContentLength;System::Net::WebResponse::ContentType + +/* This program demonstrates the 'ContentLength' and 'ContentType' property of 'WebResponse' class +It creates a web request and queries for a response. It then prints the content length and content type +of the entity body in the response onto the console */ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ + try + { +// +// + // Create a 'WebRequest' with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + + // Send the 'WebRequest' and wait for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Display the content length and content type received as headers in the response object. + Console::WriteLine( "\nContent length : {0}, Content Type : {1}", myWebResponse->ContentLength, myWebResponse->ContentType ); + + // Release resources of response object. + myWebResponse->Close(); +// +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException raised. Status is: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the Url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "WebResponse_ContentLength_Type http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp new file mode 100644 index 00000000000..5c96bd1c1dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebResponse_GetResponseStream/CPP/webresponse_getresponsestream.cpp @@ -0,0 +1,81 @@ +// System::Net::WebResponse::GetResponseStream + +/* This program demonstrates the 'GetResponseStream' method of the 'WebResponse' class. +It creates a web request and queries for a response. It then gets the response stream. This response stream +is piped to a higher level stream reader. The reader reads 256 characters at a time, writes them into a String* and then displays the String* in the console. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void getPage( String^ url ) +{ + try + { +// + // Create a 'WebRequest' object with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + + // Send the 'WebRequest' and wait for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Obtain a 'Stream' object associated with the response object. + Stream^ ReceiveStream = myWebResponse->GetResponseStream(); + + Encoding^ encode = System::Text::Encoding::GetEncoding( "utf-8" ); + + // Pipe the stream to a higher level stream reader with the required encoding format. + StreamReader^ readStream = gcnew StreamReader( ReceiveStream,encode ); + Console::WriteLine( "\nResponse stream received" ); + array^ read = gcnew array(256); + + // Read 256 charcters at a time. + int count = readStream->Read( read, 0, 256 ); + Console::WriteLine( "HTML...\r\n" ); + + while ( count > 0 ) + { + // Dump the 256 characters on a string and display the string onto the console. + String^ str = gcnew String( read,0,count ); + Console::Write( str ); + count = readStream->Read( read, 0, 256 ); + } + + Console::WriteLine( "" ); + // Release the resources of stream object. + readStream->Close(); + + // Release the resources of response object. + myWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Raised::Status is: {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease enter the Url as command line parameter:" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "WebResponse_GetResponseStream http://www.microsoft.com/net/" ); + } + else + { + getPage( args[ 1 ] ); + } + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp new file mode 100644 index 00000000000..5ae94b10d17 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebResponse_Headers/CPP/webresponse_headers.cpp @@ -0,0 +1,64 @@ + + +// System::Net::WebResponse::Headers +/* This program demonstrates the 'Headers' property of the 'WebResponse' class. +It creates a web request and queries for a response. It then prints out all the response +headers (name -value pairs) onto the console */ +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ + try + { + // + // Create a 'WebRequest' object with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( "http://www.contoso.com" ); + + // Send the 'WebRequest' and wait for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Display all the Headers present in the response received from the URl. + Console::WriteLine( "\nThe following headers were received in the response" ); + + // Display each header and its key , associated with the response object. + for ( int i = 0; i < myWebResponse->Headers->Count; ++i ) + Console::WriteLine( "\nHeader Name: {0}, Header value : {1}", myWebResponse->Headers->Keys[ i ], myWebResponse->Headers[ i ] ); + + // Release resources of response object. + myWebResponse->Close(); + + // + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException Raised::Status is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised.Message is : {0}", e->Message ); + } + +} + +int main() +{ + array^args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease type the Url as command line parameter" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "WebResponse_Headers http://www.microsoft.com/net/" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp b/snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp new file mode 100644 index 00000000000..e54b2a6b212 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebResponse_ResponseUri/CPP/webresponse_responseuri.cpp @@ -0,0 +1,67 @@ +// System::Net::WebResponse::ResponseUri + +/* This program demonstrates the 'ResponseUri' property of the 'WebResponse' class +It creates a web request and queries for a response. It then compares the ResponseUri value to the actual Url +value to see if the original request was redirected*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::IO; +using namespace System::Text; + +void GetPage( String^ url ) +{ + try + { +// + Uri^ ourUri = gcnew Uri( url ); + + // Create a 'WebRequest' object with the specified url. + WebRequest^ myWebRequest = WebRequest::Create( url ); + + // Send the 'WebRequest' and wait for response. + WebResponse^ myWebResponse = myWebRequest->GetResponse(); + + // Use "ResponseUri" property to get the actual Uri from where the response was attained. + if ( ourUri->Equals( myWebResponse->ResponseUri ) ) + { + Console::WriteLine( "\nRequest Url : {0} was not redirected", url ); + } + else + { + Console::WriteLine( "\nRequest Url : {0} was redirected to {1}", url, myWebResponse->ResponseUri ); + } + + // Release resources of response object. + myWebResponse->Close(); +// + } + catch ( WebException^ e ) + { + Console::WriteLine( "\nWebException is raised->Status is : {0}", e->Status ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "\nThe following Exception was raised->Message is: {0}", e->Message ); + } +} + +int main() +{ + array^ args = Environment::GetCommandLineArgs(); + if ( args->Length < 2 ) + { + Console::WriteLine( "\nPlease type the Url as command line parameter" ); + Console::WriteLine( "Example:" ); + Console::WriteLine( "WebResponse_ResponseUri http://www.microsoft.com" ); + } + else + { + GetPage( args[ 1 ] ); + } + + Console::WriteLine( "Press any key to continue..." ); + Console::ReadLine(); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp b/snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp new file mode 100644 index 00000000000..624ea9b6f2e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebServices_Description_Importer/CPP/import.cpp @@ -0,0 +1,63 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::CodeDom; +using namespace System::CodeDom::Compiler; + +int main() +{ + // Get a WSDL file describing a service. + ServiceDescription^ description = ServiceDescription::Read( "service.wsdl" ); + + // + // Initialize a service description importer. + ServiceDescriptionImporter^ importer = gcnew ServiceDescriptionImporter; + importer->ProtocolName = "Soap12"; // Use SOAP 1.2. + importer->AddServiceDescription( description, nullptr, nullptr ); + // + + // + // Report on the service descriptions. + Console::WriteLine( "Importing {0} service descriptions with {1} associated schemas.", importer->ServiceDescriptions->Count, importer->Schemas->Count ); + // + + // + // Generate a proxy client. + importer->Style = ServiceDescriptionImportStyle::Client; + // + + // + // Generate properties to represent primitive values. + importer->CodeGenerationOptions = System::Xml::Serialization::CodeGenerationOptions::GenerateProperties; + // + + // Initialize a Code-DOM tree into which we will import the service. + CodeNamespace^ nmspace = gcnew CodeNamespace; + CodeCompileUnit^ unit = gcnew CodeCompileUnit; + unit->Namespaces->Add( nmspace ); + + // + // Import the service into the Code-DOM tree. This creates proxy code + // that uses the service. + ServiceDescriptionImportWarnings warning = importer->Import(nmspace,unit); + if ( warning == (ServiceDescriptionImportWarnings)0 ) + { + // Generate and print the proxy code in C#. + CodeDomProvider^ provider = CodeDomProvider::CreateProvider( "CSharp" ); + ICodeGenerator^ generator = provider->CreateGenerator(); + generator->GenerateCodeFromCompileUnit( unit, Console::Out, gcnew CodeGeneratorOptions ); + } + else + { + // Print an error message. + Console::WriteLine( warning ); + } + // +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp b/snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp new file mode 100644 index 00000000000..311e3586e48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WebServices_HttpBinding/CPP/httpbinding.cpp @@ -0,0 +1,151 @@ + + +//System.Web.Services.HttpBinding;System.Web.Services.HttpBinding.Verb; +//System.Web.Services.HttpAddressBinding; +//System.Web.Services.HttpAddressBinding.Location; +/* + The following example demonstrates the 'HttpBinding()' constructor + and 'Verb' property of class 'HttpBinding' and 'HttpAddressBinding() + 'constructor and 'Location' property of class 'HttpAddressBinding'. + It creates a 'ServiceDescription' instance by using the + static read method of 'ServiceDescription' by passing the + 'AddNumbers1.wsdl' name as an argument. It creates a 'Binding' + object and adds that binding object to 'ServiceDescription'. + It adds the 'PortType',Messages to the 'ServiceDescription' object. + Finally it writes the 'ServiceDescrption' as a WSDL file with name + 'AddNumbers.wsdl. + */ +#using +#using +#using + +using namespace System; +using namespace System::Web::Services::Description; +using namespace System::Collections; +using namespace System::Xml; + +int main() +{ + ServiceDescription^ myDescription = ServiceDescription::Read( "AddNumbers1.wsdl" ); + + // Create the 'Binding' object. + Binding^ myBinding = gcnew Binding; + myBinding->Name = "Service1HttpPost"; + XmlQualifiedName^ qualifiedName = gcnew XmlQualifiedName( "s0:Service1HttpPost" ); + myBinding->Type = qualifiedName; + + // + // + // Create the 'HttpBinding' object. + HttpBinding^ myHttpBinding = gcnew HttpBinding; + myHttpBinding->Verb = "POST"; + + // Add the 'HttpBinding' to the 'Binding'. + myBinding->Extensions->Add( myHttpBinding ); + // + // + + // Create the 'OperationBinding' object. + OperationBinding^ myOperationBinding = gcnew OperationBinding; + myOperationBinding->Name = "AddNumbers"; + HttpOperationBinding^ myOperation = gcnew HttpOperationBinding; + myOperation->Location = "/AddNumbers"; + + // Add the 'HttpOperationBinding' to 'OperationBinding'. + myOperationBinding->Extensions->Add( myOperation ); + + // Create the 'InputBinding' object. + InputBinding^ myInput = gcnew InputBinding; + MimeContentBinding^ postMimeContentbinding = gcnew MimeContentBinding; + postMimeContentbinding->Type = "application/x-www-form-urlencoded"; + myInput->Extensions->Add( postMimeContentbinding ); + + // Add the 'InputBinding' to 'OperationBinding'. + myOperationBinding->Input = myInput; + + // Create the 'OutputBinding' object. + OutputBinding^ myOutput = gcnew OutputBinding; + MimeXmlBinding^ postMimeXmlbinding = gcnew MimeXmlBinding; + postMimeXmlbinding->Part = "Body"; + myOutput->Extensions->Add( postMimeXmlbinding ); + + // Add the 'OutPutBinding' to 'OperationBinding'. + myOperationBinding->Output = myOutput; + + // Add the 'OperationBinding' to 'Binding'. + myBinding->Operations->Add( myOperationBinding ); + + // Add the 'Binding' to 'BindingCollection' of 'ServiceDescription'. + myDescription->Bindings->Add( myBinding ); + + // Create a 'Port' object. + Port^ postPort = gcnew Port; + postPort->Name = "Service1HttpPost"; + postPort->Binding = gcnew XmlQualifiedName( "s0:Service1HttpPost" ); + + // + // + // Create the 'HttpAddressBinding' object. + HttpAddressBinding^ postAddressBinding = gcnew HttpAddressBinding; + postAddressBinding->Location = "http://localhost/Service1.asmx"; + + // Add the 'HttpAddressBinding' to the 'Port'. + postPort->Extensions->Add( postAddressBinding ); + // + // + + // Add the 'Port' to 'PortCollection' of 'ServiceDescription'. + myDescription->Services[ 0 ]->Ports->Add( postPort ); + + // Create a 'PortType' object. + PortType^ postPortType = gcnew PortType; + postPortType->Name = "Service1HttpPost"; + Operation^ postOperation = gcnew Operation; + postOperation->Name = "AddNumbers"; + OperationMessage^ postInput = dynamic_cast(gcnew OperationInput); + postInput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostIn" ); + OperationMessage^ postOutput = dynamic_cast(gcnew OperationOutput); + postOutput->Message = gcnew XmlQualifiedName( "s0:AddNumbersHttpPostOut" ); + postOperation->Messages->Add( postInput ); + postOperation->Messages->Add( postOutput ); + + // Add the 'Operation' to 'PortType'. + postPortType->Operations->Add( postOperation ); + + // Adds the 'PortType' to 'PortTypeCollection' of 'ServiceDescription'. + myDescription->PortTypes->Add( postPortType ); + + // Create the 'Message' object. + Message^ postMessage1 = gcnew Message; + postMessage1->Name = "AddNumbersHttpPostIn"; + + // Create the 'MessageParts'. + MessagePart^ postMessagePart1 = gcnew MessagePart; + postMessagePart1->Name = "firstnumber"; + postMessagePart1->Type = gcnew XmlQualifiedName( "s:string" ); + MessagePart^ postMessagePart2 = gcnew MessagePart; + postMessagePart2->Name = "secondnumber"; + postMessagePart2->Type = gcnew XmlQualifiedName( "s:string" ); + + // Add the 'MessagePart' objects to 'Messages'. + postMessage1->Parts->Add( postMessagePart1 ); + postMessage1->Parts->Add( postMessagePart2 ); + + // Create another 'Message' object. + Message^ postMessage2 = gcnew Message; + postMessage2->Name = "AddNumbersHttpPostOut"; + MessagePart^ postMessagePart3 = gcnew MessagePart; + postMessagePart3->Name = "Body"; + postMessagePart3->Element = gcnew XmlQualifiedName( "s0:int" ); + + // Add the 'MessagePart' to 'Message' + postMessage2->Parts->Add( postMessagePart3 ); + + // Add the 'Message' objects to 'ServiceDescription'. + myDescription->Messages->Add( postMessage1 ); + myDescription->Messages->Add( postMessage2 ); + + // Write the 'ServiceDescription' as a WSDL file. + myDescription->Write( "AddNumbers.wsdl" ); + Console::WriteLine( "WSDL file with name 'AddNumber.Wsdl' file created Successfully" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp b/snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp new file mode 100644 index 00000000000..e970f196609 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WellKnownClientTypeEntry_Client/CPP/wellknownclienttypeentry_client.cpp @@ -0,0 +1,43 @@ + + +// System.Runtime.Remoting.WellKnownClientTypeEntry +/* +The following example demonstrates the 'WellKnownClientTypeEntry' class. +It registers a 'HttpChannel' object with the channel services. Then registers the 'HelloServer' +type as well known type with the Remoting Infrastructure at the client end and activates the +remote object. It displays the properties of the 'WellKnownClientTypeEntry' object holding the +values for the above well-known type and makes few method calls on the remote object. +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +int main() +{ + // Create a 'HttpChannel' object and register with channel services. + ChannelServices::RegisterChannel( gcnew HttpChannel ); + Console::WriteLine( " Start calling from Client One......." ); + WellKnownClientTypeEntry^ myWellKnownClientTypeEntry = gcnew WellKnownClientTypeEntry( HelloServer::typeid,"http://localhost:8086/SayHello" ); + myWellKnownClientTypeEntry->ApplicationUrl = "http://localhost:8086/SayHello"; + RemotingConfiguration::RegisterWellKnownClientType( myWellKnownClientTypeEntry ); + + // Get the proxy object for the remote object. + HelloServer^ myHelloServerObject = gcnew HelloServer; + + // Retrieve an array of object types registered on the + // client end as well-known types. + array^myWellKnownClientTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownClientTypes(); + Console::WriteLine( "The Application Url to activate the Remote Object :{0}", myWellKnownClientTypeEntryCollection[ 0 ]->ApplicationUrl ); + Console::WriteLine( "The 'WellKnownClientTypeEntry' object :{0}", myWellKnownClientTypeEntryCollection[ 0 ] ); + + // Make remote method calls. + for ( int i = 0; i < 5; i++ ) + Console::WriteLine( myHelloServerObject->HelloMethod( " Client One" ) ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp b/snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp new file mode 100644 index 00000000000..ec8dbcb8b2f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/WellKnownServiceTypeEntry_Server/CPP/wellknownservicetypeentry_server.cpp @@ -0,0 +1,41 @@ + + +// System.Runtime.Remoting.WellKnownServiceTypeEntry +/* +The following example demonstrates the 'WellKnownServiceTypeEntry' class. +It registers a 'HttpChannel' object with the channel services. Then registers the 'HelloServer' +type as well known type with the Remoting Infrastructure at the service end. It displays the +properties of the 'WellKnownServiceTypeEntry' object holding the values for the above well-known +type . +*/ +// +#using +#using +#using + +using namespace System; +using namespace System::Runtime::Remoting; +using namespace System::Runtime::Remoting::Channels; +using namespace System::Runtime::Remoting::Channels::Http; + +int main() +{ + // Create a 'HttpChannel' object and register it with the + // channel services. + ChannelServices::RegisterChannel( gcnew HttpChannel( 8086 ) ); + + // Record the 'HelloServer' type as 'Singleton' well-known type. + WellKnownServiceTypeEntry^ myWellKnownServiceTypeEntry = gcnew WellKnownServiceTypeEntry( HelloServer::typeid,"SayHello",WellKnownObjectMode::Singleton ); + + // Register the remote object as well-known type. + RemotingConfiguration::RegisterWellKnownServiceType( myWellKnownServiceTypeEntry ); + + // Retrieve object types registered on the service end + // as well-known types. + array^myWellKnownServiceTypeEntryCollection = RemotingConfiguration::GetRegisteredWellKnownServiceTypes(); + Console::WriteLine( "The 'WellKnownObjectMode' of the remote object : {0}", myWellKnownServiceTypeEntryCollection[ 0 ]->Mode ); + Console::WriteLine( "The 'WellKnownServiceTypeEntry' object: {0}", myWellKnownServiceTypeEntryCollection[ 0 ] ); + Console::WriteLine( "Started the Server, Hit to exit..." ); + Console::ReadLine(); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp new file mode 100644 index 00000000000..165da0b159e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XMLAttributeAttribute_ctr1_2/CPP/xmlAttributeAttribute_ctr1_2.cpp @@ -0,0 +1,100 @@ + + +// System.Xml.Serialization.XmlAttributeAttribute.XmlAttributeAttribute() +// System.Xml.Serialization.XmlAttributeAttribute.XmlAttributeAttribute(String) +/* The following example demonstrates the XmlAttributeAttribute constructor. +* This sample serializes a class named 'Student'. The StudentName property is +* serialized as an XML attribute. It also serializes a class named 'Book'. +*/ +// +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +// This is the class that will be serialized. +public ref class Student +{ +public: + String^ StudentName; + int StudentNumber; +}; + +public ref class Book +{ +public: + String^ BookName; + int BookNumber; +}; + +void SerializeObject( String^ studentFilename, String^ bookFilename ) +{ + XmlSerializer^ mySerializer; + TextWriter^ writer; + + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ myXmlAttributeOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ myXmlAttributes = gcnew XmlAttributes; + + /* Create an XmlAttributeAttribute set it to + the XmlAttribute property of the XmlAttributes object.*/ + XmlAttributeAttribute^ myXmlAttributeAttribute = gcnew XmlAttributeAttribute; + myXmlAttributeAttribute->AttributeName = "Name"; + myXmlAttributes->XmlAttribute = myXmlAttributeAttribute; + + // Add to the XmlAttributeOverrides. Specify the member name. + myXmlAttributeOverrides->Add( Student::typeid, "StudentName", myXmlAttributes ); + + // Create the XmlSerializer. + mySerializer = gcnew XmlSerializer( Student::typeid,myXmlAttributeOverrides ); + writer = gcnew StreamWriter( studentFilename ); + + // Create an instance of the class that will be serialized. + Student^ myStudent = gcnew Student; + + // Set the Name property, which will be generated as an XML attribute. + myStudent->StudentName = "James"; + myStudent->StudentNumber = 1; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myStudent ); + writer->Close(); + + // Create the XmlAttributeOverrides and XmlAttributes objects. + XmlAttributeOverrides^ myXmlBookAttributeOverrides = gcnew XmlAttributeOverrides; + XmlAttributes^ myXmlBookAttributes = gcnew XmlAttributes; + + /* Create an XmlAttributeAttribute set it to + the XmlAttribute property of the XmlAttributes object.*/ + XmlAttributeAttribute^ myXmlBookAttributeAttribute = gcnew XmlAttributeAttribute( "Name" ); + myXmlBookAttributes->XmlAttribute = myXmlBookAttributeAttribute; + + // Add to the XmlAttributeOverrides. Specify the member name. + myXmlBookAttributeOverrides->Add( Book::typeid, "BookName", myXmlBookAttributes ); + + // Create the XmlSerializer. + mySerializer = gcnew XmlSerializer( Book::typeid,myXmlBookAttributeOverrides ); + writer = gcnew StreamWriter( bookFilename ); + + // Create an instance of the class that will be serialized. + Book^ myBook = gcnew Book; + + // Set the Name property, which will be generated as an XML attribute. + myBook->BookName = ".NET"; + myBook->BookNumber = 10; + + // Serialize the class, and close the TextWriter. + mySerializer->Serialize( writer, myBook ); + writer->Close(); +} + +int main() +{ + SerializeObject( "Student.xml", "Book.xml" ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp new file mode 100644 index 00000000000..a12e4ff3e02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_Constructor/CPP/xmlrootattribute_constructor.cpp @@ -0,0 +1,76 @@ +// System::Xml::Serialization::XmlRootAttribute.XmlRootAttribute(String*) + +/* The following example demonstrates the constructor +'XmlRootAttribute(String*)' of class 'XmlRootAttribute'. +This program demonstrates 'Student' class to +which the 'XmlRootAttribute(String*)' constructor has been applied. +*/ + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that is the default root element. +public ref class Student +{ +public: + String^ Name; +}; + +public ref class XMLRootAttributeClass +{ +// +public: + void SerializeOrder( String^ filename ) + { + // Create an XmlSerializer instance using the method below. + XmlSerializer^ myXmlSerializer = CreateOverrider(); + + // Create the object, and set its Name property. + Student^ myStudent = gcnew Student; + myStudent->Name = "Student class1"; + + // Serialize the class, and close the TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + myXmlSerializer->Serialize( writer, myStudent ); + writer->Close(); + } + + // Return an XmlSerializer to the root serialization. + XmlSerializer^ CreateOverrider() + { + // Create an XmlAttributes to the default root element. + XmlAttributes^ myXmlAttributes = gcnew XmlAttributes; + + // Create an XmlRootAttribute overloaded constructer + // and set its namespace. + XmlRootAttribute^ myXmlRootAttribute = + gcnew XmlRootAttribute( "OverriddenRootElementName" ); + myXmlRootAttribute->Namespace = "http://www.microsoft.com"; + + // Set the XmlRoot property to the XmlRoot object. + myXmlAttributes->XmlRoot = myXmlRootAttribute; + XmlAttributeOverrides^ myXmlAttributeOverrides = + gcnew XmlAttributeOverrides; + + // Add the XmlAttributes object to the XmlAttributeOverrides object + myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes ); + + // Create the Serializer, and return it. + XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( + Student::typeid, myXmlAttributeOverrides ); + return myXmlSerializer; + } +// +}; + +int main() +{ + XMLRootAttributeClass^ myXMLRootAttributeClass = + gcnew XMLRootAttributeClass; + myXMLRootAttributeClass->SerializeOrder( + "XMLRootAttributeConstructor.xml" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp new file mode 100644 index 00000000000..c87e784d7f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XMLRootAttribute_ElementName/CPP/xmlrootattribute_elementname.cpp @@ -0,0 +1,74 @@ +// System::Xml::Serialization::XmlRootAttribute.ElementName + +// The following example demonstrates the property +// 'ElementName' of class 'XmlRootAttribute'. +// This program demonstrates 'Student' class to +// which the 'ElementName' property has been applied. + +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +// This is the class that is the default root element. +public ref class Student +{ +public: + String^ Name; +}; + +public ref class XMLRootAttributeClass +{ +// +public: + void SerializeOrder( String^ filename ) + { + // Create an XmlSerializer instance using the method below. + XmlSerializer^ myXmlSerializer = CreateOverrider(); + + // Create the object, and set its Name property. + Student^ myStudent = gcnew Student; + myStudent->Name = "Student class1"; + + // Serialize the class, and close the TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + myXmlSerializer->Serialize( writer, myStudent ); + writer->Close(); + } + + // Return an XmlSerializer to the root serialization. + XmlSerializer^ CreateOverrider() + { + // Create an XmlAttributes to the default root element. + XmlAttributes^ myXmlAttributes = gcnew XmlAttributes; + + // Create an XmlRootAttribute and set its element name and namespace. + XmlRootAttribute^ myXmlRootAttribute = gcnew XmlRootAttribute; + myXmlRootAttribute->ElementName = "OverriddenRootElementName"; + myXmlRootAttribute->Namespace = "http://www.microsoft.com"; + + // Set the XmlRoot property to the XmlRoot object. + myXmlAttributes->XmlRoot = myXmlRootAttribute; + XmlAttributeOverrides^ myXmlAttributeOverrides = + gcnew XmlAttributeOverrides; + + // Add the XmlAttributes object to the XmlAttributeOverrides object. + myXmlAttributeOverrides->Add( Student::typeid, myXmlAttributes ); + + // Create the Serializer, and return it. + XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( + Student::typeid, myXmlAttributeOverrides ); + return myXmlSerializer; + } +// +}; + +int main() +{ + XMLRootAttributeClass^ myXMLRootAttributeClass = + gcnew XMLRootAttributeClass; + myXMLRootAttributeClass->SerializeOrder( + "XMLRootAttributeConstuctor.xml" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp b/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp new file mode 100644 index 00000000000..d2b959c3203 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XMLTypeAttribute1_2/CPP/xmltypeattribute1_2.cpp @@ -0,0 +1,77 @@ + + +// System::Xml::Serialization::XmlTypeAttribute.XmlTypeAttribute() +// System::Xml::Serialization::XmlTypeAttribute.XmlTypeAttribute(String*) +// The following example demonstrates the contructors 'XmlTypeAttribute()' +// and 'XmlTypeAttribute(String*)' of class 'XmlTypeAttribute'. +// This program demonstrates 'Person' and 'Address' classes to +// which the 'XmlTypeAttribute' has been applied. This sample then +// serializes an Object* of class 'Person' into an XML document. +// +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +public ref class Address +{ +public: + String^ state; + String^ zip; +}; + +public ref class Person +{ +public: + String^ personName; + Address^ address; +}; + +public ref class PersonTypeAttribute +{ +public: + XmlSerializer^ CreateOverrider() + { + XmlAttributeOverrides^ personOverride = gcnew XmlAttributeOverrides; + XmlAttributes^ personAttributes = gcnew XmlAttributes; + XmlTypeAttribute^ personType = gcnew XmlTypeAttribute; + personType->TypeName = "Employee"; + personType->Namespace = "http://www.microsoft.com"; + personAttributes->XmlType = personType; + XmlAttributes^ addressAttributes = gcnew XmlAttributes; + + // Create 'XmlTypeAttribute' with 'TypeName' as an argument. + XmlTypeAttribute^ addressType = gcnew XmlTypeAttribute( "Address" ); + addressType->Namespace = "http://www.microsoft.com"; + addressAttributes->XmlType = addressType; + personOverride->Add( Person::typeid, personAttributes ); + personOverride->Add( Address::typeid, addressAttributes ); + XmlSerializer^ myXmlSerializer = gcnew XmlSerializer( Person::typeid,personOverride ); + return myXmlSerializer; + } + + void SerializeObject( String^ filename ) + { + XmlSerializer^ myXmlSerializer = CreateOverrider(); + Address^ myAddress = gcnew Address; + myAddress->state = "AAA"; + myAddress->zip = "11111"; + Person^ myPerson = gcnew Person; + myPerson->personName = "Smith"; + myPerson->address = myAddress; + + // Serialize to a file. + TextWriter^ writer = gcnew StreamWriter( filename ); + myXmlSerializer->Serialize( writer, myPerson ); + } +}; + +int main() +{ + PersonTypeAttribute^ myPersonTypeAttribute = gcnew PersonTypeAttribute; + myPersonTypeAttribute->SerializeObject( "XmlType.xml" ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..5c3508dc8e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute Example/CPP/source.cpp @@ -0,0 +1,59 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; + +public ref class Group +{ +public: + String^ GroupName; + + // The UnknownAttributes array will be used to collect all unknown + // attributes found when deserializing. + + [XmlAnyAttributeAttribute] + array^XAttributes; +}; + +void SerializeObject( String^ filename, Object^ g ) +{ + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + TextWriter^ writer = gcnew StreamWriter( filename ); + ser->Serialize( writer, g ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ g = safe_cast(ser->Deserialize( fs )); + fs->Close(); + + // Write out the data, including unknown attributes. + Console::WriteLine( g->GroupName ); + Console::WriteLine( "Number of unknown attributes: {0}", g->XAttributes->Length ); + for ( IEnumerator ^ e = g->XAttributes->GetEnumerator(); e->MoveNext(); ) + { + XmlAttribute^ xAtt = safe_cast(e->Current); + Console::WriteLine( "{0}: {1}", xAtt->Name, xAtt->InnerXml ); + } + SerializeObject( "AttributesAdded.xml", g ); +} + +int main() +{ + // Deserialize the file containing unknown attributes. + DeserializeObject( "UnknownAttributes.xml" ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp new file mode 100644 index 00000000000..31e83e62519 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlAnyAttributeAttribute_ctor Example/CPP/anyattover.cpp @@ -0,0 +1,58 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; +public ref class Group +{ +public: + String^ GroupName; + + // The Things array will be used to collect all unknown + // attributes found when deserializing. + array^Things; +}; + +XmlSerializer^ CreateOverrideSerializer(); +void DeserializeObject( String^ filename ) +{ + // Use the CreateOverrideSerializer to return an instance + // of the XmlSerializer customized for overrides. + XmlSerializer^ ser = CreateOverrideSerializer(); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ g = safe_cast(ser->Deserialize( fs )); + fs->Close(); + Console::WriteLine( g->GroupName ); + Console::WriteLine( g->Things->Length ); + for ( IEnumerator ^ e = g->Things->GetEnumerator(); e->MoveNext(); ) + { + XmlAttribute^ xAtt = safe_cast(e->Current); + Console::WriteLine( "{0}: {1}", xAtt->Name, xAtt->InnerXml ); + } +} + +XmlSerializer^ CreateOverrideSerializer() +{ + // Override the Things field to capture all + // unknown XML attributes. + XmlAnyAttributeAttribute^ myAnyAttribute = gcnew XmlAnyAttributeAttribute; + XmlAttributeOverrides^ xOverride = gcnew XmlAttributeOverrides; + XmlAttributes^ xAtts = gcnew XmlAttributes; + xAtts->XmlAnyAttribute = myAnyAttribute; + xOverride->Add( Group::typeid, "Things", xAtts ); + return gcnew XmlSerializer( Group::typeid,xOverride ); +} + +int main() +{ + DeserializeObject( "UnknownAttributes.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp new file mode 100644 index 00000000000..9915009fc75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlAnyElementAttribute Example/CPP/anyelement.cpp @@ -0,0 +1,117 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; +using namespace System::Xml::Schema; + +[XmlRoot(Namespace="http://www.cohowinery.com")] +public ref class Group +{ +public: + String^ GroupName; + + // This is for serializing Employee elements. + + [XmlAnyElement(Name="Employee")] + array^UnknownEmployees; + + // This is for serializing City elements. + + [XmlAnyElement + (Name="City", + Namespace="http://www.cpandl.com")] + array^UnknownCity; + + // This one is for all other unknown elements. + + [XmlAnyElement] + array^UnknownElements; +}; + +void SerializeObject( String^ filename ) +{ + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + + // Create an XmlNamespaces to use. + XmlSerializerNamespaces^ namespaces = gcnew XmlSerializerNamespaces; + namespaces->Add( "c", "http://www.cohowinery.com" ); + namespaces->Add( "i", "http://www.cpandl.com" ); + Group^ myGroup = gcnew Group; + + // Create arrays of arbitrary XmlElement objects. + // First create an XmlDocument, used to create the + // XmlElement objects. + XmlDocument^ xDoc = gcnew XmlDocument; + + // Create an array of Employee XmlElement objects. + XmlElement^ El1 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" ); + El1->InnerText = "John"; + XmlElement^ El2 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" ); + El2->InnerText = "Joan"; + XmlElement^ El3 = xDoc->CreateElement( "Employee", "http://www.cohowinery.com" ); + El3->InnerText = "Jim"; + array^employees = {El1,El2,El3}; + myGroup->UnknownEmployees = employees; + + // Create an array of City XmlElement objects. + XmlElement^ inf1 = xDoc->CreateElement( "City", "http://www.cpandl.com" ); + inf1->InnerText = "Tokyo"; + XmlElement^ inf2 = xDoc->CreateElement( "City", "http://www.cpandl.com" ); + inf2->InnerText = "New York"; + XmlElement^ inf3 = xDoc->CreateElement( "City", "http://www.cpandl.com" ); + inf3->InnerText = "Rome"; + array^cities = {inf1,inf2,inf3}; + myGroup->UnknownCity = cities; + XmlElement^ xEl1 = xDoc->CreateElement( "bld" ); + xEl1->InnerText = "42"; + XmlElement^ xEl2 = xDoc->CreateElement( "Region" ); + xEl2->InnerText = "West"; + XmlElement^ xEl3 = xDoc->CreateElement( "type" ); + xEl3->InnerText = "Technical"; + array^elements = {xEl1,xEl2,xEl3}; + myGroup->UnknownElements = elements; + + // Serialize the class, and close the TextWriter. + TextWriter^ writer = gcnew StreamWriter( filename ); + ser->Serialize( writer, myGroup, namespaces ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ myGroup; + myGroup = safe_cast(ser->Deserialize( fs )); + fs->Close(); + for ( int i = 0; i < myGroup->UnknownEmployees->Length; ++i ) + { + XmlElement^ xEmp = myGroup->UnknownEmployees[ i ]; + Console::WriteLine( "{0}: {1}", xEmp->LocalName, xEmp->InnerText ); + } + for ( int i = 0; i < myGroup->UnknownCity->Length; ++i ) + { + XmlElement^ xCity = myGroup->UnknownCity[ i ]; + Console::WriteLine( "{0}: {1}", xCity->LocalName, xCity->InnerText ); + } + for ( int i = 0; i < myGroup->UnknownElements->Length; ++i ) + { + XmlElement^ xEmp = myGroup->UnknownElements[ i ]; + Console::WriteLine( "{0}: {1}", xEmp->LocalName, xEmp->InnerText ); + } +} + +int main() +{ + SerializeObject( "AnyElementArray.xml" ); + DeserializeObject( "AnyElementArray.xml" ); + Console::WriteLine( "Done" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp new file mode 100644 index 00000000000..9787259757c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlArrayItemAttribute Example/CPP/arrayitem.cpp @@ -0,0 +1,107 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::IO; +using namespace System::Xml::Schema; +public ref class Item +{ +public: + String^ ItemID; + Item(){} + + Item( String^ id ) + { + ItemID = id; + } +}; + +public ref class NewItem: public Item +{ +public: + String^ Category; + NewItem(){} + + NewItem( String^ id, String^ cat ) + { + ItemID = id; + Category = cat; + } +}; + +public ref class PurchaseOrder +{ +public: + + [XmlArrayItem(DataType="gMonth", + ElementName="MyMonths", + Namespace="http://www.cohowinery.com")] + array^Months; + + [XmlArrayItem(Item::typeid),XmlArrayItem(NewItem::typeid)] + array^Items; + + [XmlArray(IsNullable=true)] + [XmlArrayItem(String::typeid), + XmlArrayItem(Double::typeid), + XmlArrayItem(NewItem::typeid)] + array^Things; +}; + +void SerializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class; + // specify the type of object to serialize. + XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); + TextWriter^ writer = gcnew StreamWriter( filename ); + + // Create a PurchaseOrder and set its properties. + PurchaseOrder^ po = gcnew PurchaseOrder; + array^months = {"March","May","August"}; + po->Months = months; + array^items = {gcnew Item( "a1" ),gcnew NewItem( "b1","book" )}; + po->Items = items; + array^things = {"String",2003.31,gcnew NewItem( "Item100","book" )}; + po->Things = things; + + // Serialize the purchase order, and close the TextWriter. + serializer->Serialize( writer, po ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + // Create an instance of the XmlSerializer class; + // specify the type of object to be deserialized. + XmlSerializer^ serializer = gcnew XmlSerializer( PurchaseOrder::typeid ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + + // Declare an object variable of the type to be deserialized. + PurchaseOrder^ po; + + /* Use the Deserialize method to restore the object's state with + data from the XML document. */ + po = safe_cast(serializer->Deserialize( fs )); + for ( int i = 0; i < po->Months->Length; ++i ) + Console::WriteLine( po->Months[ i ] ); + for ( int i = 0; i < po->Items->Length; ++i ) + Console::WriteLine( po->Items[ i ]->ItemID ); + for ( int i = 0; i < po->Things->Length; ++i ) + Console::WriteLine( po->Things[ i ] ); +} + +int main() +{ + // Read and write purchase orders. + SerializeObject( "ArrayItemEx.xml" ); + DeserializeObject( "ArrayItemEx.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp new file mode 100644 index 00000000000..37278b0a8b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.XmlAnyElements/CPP/xmlanyover.cpp @@ -0,0 +1,71 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; +public ref class Group +{ +public: + String^ GroupName; + + [XmlAnyElement] + array^Things; +}; + +void SerializeObject( String^ filename ); +void DeserializeObject( String^ filename ); +XmlSerializer^ CreateOverrideSerializer(); +int main() +{ + // 1 Run this and create the XML document. + // 2 Add new elements to the XML document. + // 3 Comment out the next line, and uncomment + // the DeserializeObject line to deserialize the + // XML document and see unknown elements. + SerializeObject( "UnknownElements.xml" ); + + // DeserializeObject(S"UnknownElements.xml"); +} + +void SerializeObject( String^ filename ) +{ + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + TextWriter^ writer = gcnew StreamWriter( filename ); + Group^ g = gcnew Group; + g->GroupName = "MyGroup"; + ser->Serialize( writer, g ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ ser = CreateOverrideSerializer(); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ g = safe_cast(ser->Deserialize( fs )); + fs->Close(); + Console::WriteLine( g->GroupName ); + Console::WriteLine( g->Things->Length ); + for ( int i = 0; i < g->Things->Length; ++i ) + { + XmlElement^ xelement = safe_cast(g->Things[ i ]); + Console::WriteLine( "{0}: {1}", xelement->Name, xelement->InnerXml ); + } +} + +XmlSerializer^ CreateOverrideSerializer() +{ + XmlAnyElementAttribute^ myAnyElement = gcnew XmlAnyElementAttribute; + XmlAttributeOverrides^ xOverride = gcnew XmlAttributeOverrides; + XmlAttributes^ xAtts = gcnew XmlAttributes; + xAtts->XmlAnyElements->Add( myAnyElement ); + xOverride->Add( Group::typeid, "Things", xAtts ); + return gcnew XmlSerializer( Group::typeid,xOverride ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp new file mode 100644 index 00000000000..a86b3632f06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlAttributes.Xmlns property example/CPP/xmlns.cpp @@ -0,0 +1,86 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml; +using namespace System::Xml::Serialization; +public ref class Student +{ +public: + + [XmlAttributeAttribute] + String^ Name; + + [XmlNamespaceDeclarationsAttribute] + XmlSerializerNamespaces^ myNamespaces; +}; + +void SerializeStudent( String^ filename ); +void DeserializeStudent( String^ filename ); +int main() +{ + SerializeStudent( "Student.xml" ); + DeserializeStudent( "Student.xml" ); +} + +void SerializeStudent( String^ filename ) +{ + XmlAttributes^ atts = gcnew XmlAttributes; + + // Set to true to preserve namespaces, + // or false to ignore them. + atts->Xmlns = true; + XmlAttributeOverrides^ xover = gcnew XmlAttributeOverrides; + + // Add the XmlAttributes and specify the name of the element + // containing namespaces. + xover->Add( Student::typeid, "myNamespaces", atts ); + + // Create the XmlSerializer using the + // XmlAttributeOverrides object. + XmlSerializer^ xser = gcnew XmlSerializer( Student::typeid,xover ); + Student^ myStudent = gcnew Student; + XmlSerializerNamespaces^ ns = gcnew XmlSerializerNamespaces; + ns->Add( "myns1", "http://www.cpandl.com" ); + ns->Add( "myns2", "http://www.cohowinery.com" ); + myStudent->myNamespaces = ns; + myStudent->Name = "Student1"; + FileStream^ fs = gcnew FileStream( filename,FileMode::Create ); + xser->Serialize( fs, myStudent ); + fs->Close(); +} + +void DeserializeStudent( String^ filename ) +{ + XmlAttributes^ atts = gcnew XmlAttributes; + + // Set to true to preserve namespaces, or false to ignore them. + atts->Xmlns = true; + XmlAttributeOverrides^ xover = gcnew XmlAttributeOverrides; + + // Add the XmlAttributes and specify the name of the + // element containing namespaces. + xover->Add( Student::typeid, "myNamespaces", atts ); + + // Create the XmlSerializer using the + // XmlAttributeOverrides object. + XmlSerializer^ xser = gcnew XmlSerializer( Student::typeid,xover ); + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Student^ myStudent; + myStudent = safe_cast(xser->Deserialize( fs )); + fs->Close(); + + // Use the ToArray method to get an array of + // XmlQualifiedName objects. + array^qNames = myStudent->myNamespaces->ToArray(); + for ( int i = 0; i < qNames->Length; i++ ) + { + Console::WriteLine( "{0}:{1}", qNames[ i ]->Name, qNames[ i ]->Namespace ); + + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp new file mode 100644 index 00000000000..51329745b7a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlChoiceIdentifierAttribute Example/CPP/choice.cpp @@ -0,0 +1,131 @@ + + +// +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::IO; + +[XmlType(IncludeInSchema=false)] + +public enum class ItemChoiceType +{ + None, Word, Number, DecimalNumber +}; + +public enum class MoreChoices +{ + None, Item, Amount, Temp +}; + +public ref class Choices +{ +public: + + // The MyChoice field can be set to any one of + // the types below. + + [XmlChoiceIdentifier("EnumType")] + [XmlElement("Word",String::typeid)] + [XmlElement("Number",Int32::typeid)] + [XmlElement("DecimalNumber",Double::typeid)] + Object^ MyChoice; + + // Don't serialize this field. The EnumType field + // contains the enumeration value that corresponds + // to the MyChoice field value. + + [XmlIgnore] + ItemChoiceType EnumType; + + // The ManyChoices field can contain an array + // of choices. Each choice must be matched to + // an array item in the ChoiceArray field. + + [XmlChoiceIdentifier("ChoiceArray")] + [XmlElement("Item",String::typeid)] + [XmlElement("Amount",Int32::typeid)] + [XmlElement("Temp",Double::typeid)] + array^ManyChoices; + + // TheChoiceArray field contains the enumeration + // values, one for each item in the ManyChoices array. + + [XmlIgnore] + array^ChoiceArray; +}; + +void SerializeObject( String^ filename ); +void DeserializeObject( String^ filename ); +int main() +{ + SerializeObject( "Choices.xml" ); + DeserializeObject( "Choices.xml" ); +} + +void SerializeObject( String^ filename ) +{ + XmlSerializer^ mySerializer = gcnew XmlSerializer( Choices::typeid ); + TextWriter^ writer = gcnew StreamWriter( filename ); + Choices^ myChoices = gcnew Choices; + + // Set the MyChoice field to a string. Set the + // EnumType to Word. + myChoices->MyChoice = "Book"; + myChoices->EnumType = ItemChoiceType::Word; + + // Populate an object array with three items, one + // of each enumeration type. Set the array to the + // ManyChoices field. + array^strChoices = {"Food",5,98.6}; + myChoices->ManyChoices = strChoices; + + // For each item in the ManyChoices array, add an + // enumeration value. + array^ itmChoices = {MoreChoices::Item,MoreChoices::Amount,MoreChoices::Temp}; + myChoices->ChoiceArray = itmChoices; + mySerializer->Serialize( writer, myChoices ); + writer->Close(); +} + +void DeserializeObject( String^ filename ) +{ + XmlSerializer^ ser = gcnew XmlSerializer( Choices::typeid ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Choices^ myChoices = safe_cast(ser->Deserialize( fs )); + fs->Close(); + + // Disambiguate the MyChoice value using the enumeration. + if ( myChoices->EnumType == ItemChoiceType::Word ) + { + Console::WriteLine( "Word: {0}", myChoices->MyChoice->ToString() ); + } + else + if ( myChoices->EnumType == ItemChoiceType::Number ) + { + Console::WriteLine( "Number: {0}", myChoices->MyChoice->ToString() ); + } + else + if ( myChoices->EnumType == ItemChoiceType::DecimalNumber ) + { + Console::WriteLine( "DecimalNumber: {0}", myChoices->MyChoice->ToString() ); + } + + // Disambiguate the ManyChoices values using the enumerations. + for ( int i = 0; i < myChoices->ManyChoices->Length; i++ ) + { + if ( myChoices->ChoiceArray[ i ] == MoreChoices::Item ) + Console::WriteLine( "Item: {0}", myChoices->ManyChoices[ i ] ); + else + if ( myChoices->ChoiceArray[ i ] == MoreChoices::Amount ) + Console::WriteLine( "Amount: ", myChoices->ManyChoices[ i ]->ToString() ); + if ( myChoices->ChoiceArray[ i ] == MoreChoices::Temp ) + Console::WriteLine( "Temp: {0}", myChoices->ManyChoices[ i ]->ToString() ); + } +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp new file mode 100644 index 00000000000..61dea2ac426 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/person.cpp @@ -0,0 +1,58 @@ + + +// +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Schema; +using namespace System::Xml::Serialization; +public ref class Person: public IXmlSerializable +{ +private: + + // Private state + String^ personName; + +public: + + // Constructors + Person( String^ name ) + { + personName = name; + } + + Person() + { + personName = nullptr; + } + + // Xml Serialization Infrastructure + // + virtual void WriteXml( XmlWriter^ writer ) + { + writer->WriteString( personName ); + } + // + + // + virtual void ReadXml( XmlReader^ reader ) + { + personName = reader->ReadString(); + } + // + + // + virtual XmlSchema^ GetSchema() + { + return nullptr; + } + // + + // Print + virtual String^ ToString() override + { + return (personName); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp new file mode 100644 index 00000000000..f5ab5ef1cb0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/reader.cpp @@ -0,0 +1,19 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; + +int main() +{ + XmlSerializer^ serializer = gcnew XmlSerializer( Person::typeid ); + FileStream^ file = gcnew FileStream( "test.xml",FileMode::Open ); + Person^ aPerson = dynamic_cast(serializer->Deserialize( file )); + Console::WriteLine( aPerson ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp new file mode 100644 index 00000000000..35d2a29a532 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlSerialization_IXmlSerializable/CPP/writer.cpp @@ -0,0 +1,22 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Serialization; + +int main() +{ + // Create a person object. + Person ^ fred = gcnew Person( "Fred Flintstone" ); + + // Serialize the object to a file. + XmlTextWriter^ writer = gcnew XmlTextWriter( "test.xml", nullptr ); + XmlSerializer^ serializer = gcnew XmlSerializer( Person::typeid ); + serializer->Serialize( writer, fred ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp new file mode 100644 index 00000000000..22cef24ad7a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlSerializer.UnknownElement Example/CPP/unknownelement.cpp @@ -0,0 +1,56 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Xml; +using namespace System::Xml::Schema; + +public ref class Group +{ +public: + String^ GroupName; +}; + +public ref class Test +{ +private: + void Serializer_UnknownElement( Object^ sender, XmlElementEventArgs^ e ) + { + Console::WriteLine( "Unknown Element" ); + Console::Write( "\t {0}", e->Element->Name ); + Console::WriteLine( " {0}", e->Element->InnerXml ); + Console::WriteLine( "\t LineNumber: {0}", e->LineNumber ); + Console::WriteLine( "\t LinePosition: {0}", e->LinePosition ); + Group^ x = dynamic_cast(e->ObjectBeingDeserialized); + Console::WriteLine( x->GroupName ); + Console::WriteLine( sender ); + } + +public: + void DeserializeObject( String^ filename ) + { + XmlSerializer^ ser = gcnew XmlSerializer( Group::typeid ); + + // Add a delegate to handle unknown element events. + ser->UnknownElement += gcnew XmlElementEventHandler( this, &Test::Serializer_UnknownElement ); + + // A FileStream is needed to read the XML document. + FileStream^ fs = gcnew FileStream( filename,FileMode::Open ); + Group^ g = dynamic_cast(ser->Deserialize( fs )); + fs->Close(); + } +}; + +int main() +{ + Test^ t = gcnew Test; + + // Deserialize the file containing unknown elements. + t->DeserializeObject( "UnknownElements.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp new file mode 100644 index 00000000000..e453759982a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlSerializerNameSpaces_Constructor/CPP/xmlserializernamespaces_constructor.cpp @@ -0,0 +1,79 @@ +// System::Xml::Serialization::XmlSerializerNamespaces.constructor + +// The following example demonstrates the constructor of class +// XmlSerializerNamespaces. This sample serializes an Object* of 'MyPriceClass' +// into an XML document. + +#using +#using + +using namespace System; +using namespace System::Xml; +using namespace System::Xml::Serialization; +using namespace System::IO; + +public ref class MyPriceClass +{ +public: + [XmlAttributeAttribute] + String^ Units; + Decimal Price; +}; + +public ref class MyBook +{ +public: + String^ BookName; + String^ Author; + MyPriceClass^ BookPrice; + String^ Description; +}; + +public ref class MyMainClass +{ +// +public: + void CreateBook( String^ filename ) + { + try + { + // Create instance of XmlSerializerNamespaces and add the namespaces. + XmlSerializerNamespaces^ myNameSpaces = gcnew XmlSerializerNamespaces; + myNameSpaces->Add( "BookName", "http://www.cpandl.com" ); + + // Create instance of XmlSerializer and specify the type of object + // to be serialized. + XmlSerializer^ mySerializerObject = + gcnew XmlSerializer( MyBook::typeid ); + + TextWriter^ myWriter = gcnew StreamWriter( filename ); + // Create object to be serialized. + MyBook^ myXMLBook = gcnew MyBook; + + myXMLBook->Author = "XMLAuthor"; + myXMLBook->BookName = "DIG THE XML"; + myXMLBook->Description = "This is a XML Book"; + + MyPriceClass^ myBookPrice = gcnew MyPriceClass; + myBookPrice->Price = (Decimal)45.89; + myBookPrice->Units = "$"; + myXMLBook->BookPrice = myBookPrice; + + // Serialize the object. + mySerializerObject->Serialize( myWriter, myXMLBook, myNameSpaces ); + myWriter->Close(); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception: {0} occurred", e->Message ); + } + } +// +}; + +int main() +{ + MyMainClass^ myMain = gcnew MyMainClass; + // Create the XML document. + myMain->CreateBook( "myBook.xml" ); +} diff --git a/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp b/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp new file mode 100644 index 00000000000..8f321e5bf24 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/XmlTypeMapping Example/CPP/mapping.cpp @@ -0,0 +1,67 @@ + + +// +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Xml::Serialization; +using namespace System::Collections; +using namespace System::Xml; +using namespace System::Text; + +public ref class Thing +{ +public: + String^ ThingName; +}; + +[SoapType("TheGroup","http://www.cohowinery.com")] +public ref class Group +{ +public: + String^ GroupName; + array^Things; + + [SoapElement(DataType="language")] + static String^ Lang = "en"; + + [SoapElement(DataType="integer")] + String^ MyNumber; + + [SoapElement(DataType="duration")] + static String^ ReDate = "8/31/01"; +}; + +void GetMap( String^ filename ) +{ + // Create an XmlSerializer instance. + SoapReflectionImporter^ sri = gcnew SoapReflectionImporter; + XmlTypeMapping^ map = sri->ImportTypeMapping( Group::typeid ); + Console::WriteLine( "ElementName: {0}", map->ElementName ); + Console::WriteLine( "Namespace: {0}", map->Namespace ); + Console::WriteLine( "TypeFullName: {0}", map->TypeFullName ); + Console::WriteLine( "TypeName: {0}", map->TypeName ); + XmlSerializer^ ser = gcnew XmlSerializer( map ); + Group^ xGroup = gcnew Group; + xGroup->GroupName = "MyCar"; + xGroup->MyNumber = "5454"; + xGroup->Things = gcnew array(2); // {new Thing(), new Thing()}; + xGroup->Things[ 0 ] = gcnew Thing; + xGroup->Things[ 1 ] = gcnew Thing; + + // To write the outer wrapper, use an XmlTextWriter. + XmlTextWriter^ writer = gcnew XmlTextWriter( filename,Encoding::UTF8 ); + writer->Formatting = Formatting::Indented; + writer->WriteStartElement( "wrapper" ); + ser->Serialize( writer, xGroup ); + writer->WriteEndElement(); + writer->Close(); +} + +int main() +{ + GetMap( "MyMap.xml" ); +} +// diff --git a/snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp b/snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp new file mode 100644 index 00000000000..a1d62acbb7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Remoting/dnspermission_union_intersect/CPP/dnspermission_union_intersect.cpp @@ -0,0 +1,97 @@ +/* +This program demonstrates the 'Intersect' and 'Union' methods of 'DnsPermission' class. +It creates a 'DnsPermission' instance that is the Union/Intersection of current permission +instance and specified permission instance. +*/ + +#using + +using namespace System; +using namespace System::Net; +using namespace System::Security; +using namespace System::Security::Permissions; +using namespace System::Collections; + +public ref class DnsPermissionExample +{ +private: + DnsPermission^ dnsPermission1; + DnsPermission^ dnsPermission2; + + // +private: + void MyUnion() + { + // Create a DnsPermission instance that is the union of the current DnsPermission + // instance and the specified DnsPermission instance. + DnsPermission^ permission = dynamic_cast(dnsPermission1->Union( dnsPermission2 )); + // Print the attributes and the values of the union instance of DnsPermission. + PrintKeysAndValues( permission->ToXml()->Attributes ); + } + + // +public: + void useDns() + { + // Create a DnsPermission instance. + dnsPermission1 = gcnew DnsPermission( PermissionState::Unrestricted ); + dnsPermission2 = gcnew DnsPermission( PermissionState::None ); + // Check for permission. + dnsPermission1->Demand(); + dnsPermission2->Demand(); + Console::WriteLine( "Attributes and Values of first DnsPermission instance :" ); + PrintKeysAndValues( dnsPermission1->ToXml()->Attributes ); + Console::WriteLine( "Attributes and Values of second DnsPermission instance :" ); + PrintKeysAndValues( dnsPermission2->ToXml()->Attributes ); + Console::WriteLine( "Union of both instances : " ); + MyUnion(); + Console::WriteLine( "Intersection of both instances : " ); + MyIntersection(); + } + +private: + void PrintKeysAndValues( Hashtable^ myList ) + { + // Get the enumerator that can iterate through the hash tabble. + IDictionaryEnumerator^ myEnumerator = myList->GetEnumerator(); + Console::WriteLine( "\t-KEY-\t-VALUE-" ); + while ( myEnumerator->MoveNext() ) + { + Console::WriteLine( "\t {0}:\t {1}", myEnumerator->Key, myEnumerator->Value ); + } + Console::WriteLine(); + } + // + + // Create a DnsPermission instance that is the intersection of current + // DnsPermission instance and the specified DnsPermission instance. + void MyIntersection() + { + DnsPermission^ permission = dynamic_cast(dnsPermission1->Intersect( dnsPermission2 )); + // Print the attributes and the values of the intersection instance of + // DnsPermission. + PrintKeysAndValues( permission->ToXml()->Attributes ); + } + // +}; + +int main() +{ + try + { + DnsPermissionExample^ dnsPermissionExampleObj = gcnew DnsPermissionExample; + dnsPermissionExampleObj->useDns(); + } + catch ( SecurityException^ e ) + { + Console::WriteLine( "SecurityException caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } + catch ( Exception^ e ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", e->Source ); + Console::WriteLine( "Message : {0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp b/snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp new file mode 100644 index 00000000000..91aba7f9245 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/ColorBuilderExample/CPP/colorbuilderdesigner.cpp @@ -0,0 +1,102 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Web::UI; +using namespace System::Web::UI::Design; +using namespace System::Web::UI::WebControls; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +// +// Example designer provides a designer verb menu command to launch the +// BuildColor method of the ColorBuilder. +public ref class ColorBuilderDesigner: public System::Web::UI::Design::UserControlDesigner +{ +public: + ColorBuilderDesigner(){} + + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + + // Provides a designer verb menu command for invoking the BuildColor + // method of the ColorBuilder. + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override + { + DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; + dvc->Add( gcnew DesignerVerb( "Launch Color Builder UI",gcnew EventHandler( this, &ColorBuilderDesigner::launchColorBuilder ) ) ); + return dvc; + } + + } + +private: + + // This method handles the S"Launch Color Builder UI" menu command. + // Invokes the BuildColor method of the System::Web::UI::Design.ColorBuilder. + void launchColorBuilder( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // + // Create a parent control. + System::Windows::Forms::Control^ c = gcnew System::Windows::Forms::Control; + c->CreateControl(); + + // Launch the Color Builder using the specified control + // parent and an initial HTML format (S"RRGGBB") color String*. + System::Web::UI::Design::ColorBuilder::BuildColor( this->Component, c, "405599" ); + // + + } + +}; + + +// Example Web control displays the value of its text property. +// This control is associated with the ColorBuilderDesigner. + +[DesignerAttribute(ColorBuilderDesigner::typeid,IDesigner::typeid)] +public ref class ColorBuilderControl: public System::Web::UI::WebControls::WebControl +{ +private: + String^ text; + +public: + + property String^ Text + { + + [Bindable(true), + Category("Appearance"), + DefaultValue("")] + String^ get() + { + return text; + } + + void set( String^ value ) + { + text = value; + } + + } + +protected: + virtual void Render( HtmlTextWriter^ output ) override + { + output->Write( Text ); + } + +}; +// + diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp new file mode 100644 index 00000000000..88b3a12191a --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter.Control/CPP/controladapter.control.cpp @@ -0,0 +1,29 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::Adapters; +using namespace System::Web::UI::WebControls; + +public ref class CustomControl: public Control{}; + +public ref class CustomControlAdapter: public ControlAdapter +{ +public: + + property System::Web::UI::Control^ Control + { + // Return a strongly-typed reference to your custom control. + System::Web::UI::Control^ get() + { + return (CustomControl^)ControlAdapter::Control; + } + } + // Override other ControlAdapter members, as necessary. +}; +// + +void main(){} diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp new file mode 100644 index 00000000000..a0aaca9f13a --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_Browser/CPP/controladapter_browser.cpp @@ -0,0 +1,30 @@ +// +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::Adapters; + +public ref class CustomControlAdapter: public ControlAdapter +{ +protected: + virtual void Render( HtmlTextWriter^ writer ) override + { + // Access Browser details through the Browser property. + Version^ jScriptVersion = Browser->JScriptVersion; + + // Test if the browser supports Javascript. + if ( jScriptVersion != nullptr ) + { + // Render JavaScript-aware markup. + } + else + { + // Render scriptless markup. + } + } +}; +// + +void main(){} diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp new file mode 100644 index 00000000000..04765206bfb --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/ControlAdapter_OnInit/CPP/controladapter_oninit.cpp @@ -0,0 +1,25 @@ +// +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::Adapters; + +public ref class CustomControlAdapter: public ControlAdapter +{ + // Override the ControlAdapter default OnInit implementation. +protected: + virtual void OnInit( EventArgs^ e ) override + { + // Make the control invisible. + Control->Visible = false; + + // Call the base method, which calls OnInit of the control, + // which raises the control Init event. + ControlAdapter::OnInit( e ); + } +}; +// + +void main(){} diff --git a/snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp b/snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp new file mode 100644 index 00000000000..026280b53e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/ControlParserPersisterExample/CPP/webcustomcontrol1.cpp @@ -0,0 +1,282 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::IO; +using namespace System::Web::UI; +using namespace System::Web::UI::Design; +using namespace System::Web::UI::WebControls; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// Provides a form with a multiline text box display. +private ref class StringDisplayForm: public Form +{ +public: + StringDisplayForm( String^ displayText ) + { + this->Size = System::Drawing::Size( 400, 400 ); + this->Text = "Control Persistence String"; + this->SuspendLayout(); + System::Windows::Forms::TextBox^ tbox = gcnew System::Windows::Forms::TextBox; + tbox->Multiline = true; + tbox->Size = System::Drawing::Size( this->Width - 40, this->Height - 90 ); + tbox->Text = displayText; + this->Controls->Add( tbox ); + System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; + okButton->Text = "OK"; + okButton->Size = System::Drawing::Size( 80, 24 ); + okButton->Location = Point(this->Width - 100,this->Height - 60); + okButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); + okButton->DialogResult = ::DialogResult::OK; + this->Controls->Add( okButton ); + this->ResumeLayout(); + } + +}; + +// Provides a form with a list for selection. +private ref class ControlSelectionForm: public Form +{ +private: + array^controlArray; + +public: + System::Windows::Forms::ListBox^ controlList; + ControlSelectionForm( array^controlArray ) + { + this->controlArray = controlArray; + this->Size = System::Drawing::Size( 400, 500 ); + this->Text = "Control Persister Selection Form"; + this->SuspendLayout(); + System::Windows::Forms::Label ^ label1 = gcnew System::Windows::Forms::Label; + label1->Text = "Select the control to persist:"; + label1->Size = System::Drawing::Size( 240, 20 ); + label1->Location = Point(10,10); + this->Controls->Add( label1 ); + controlList = gcnew System::Windows::Forms::ListBox; + controlList->Size = System::Drawing::Size( 370, 400 ); + controlList->Location = Point(10,30); + controlList->Anchor = AnchorStyles(AnchorStyles::Left | AnchorStyles::Top | AnchorStyles::Bottom | AnchorStyles::Right); + this->Controls->Add( controlList ); + System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; + okButton->Text = "OK"; + okButton->Size = System::Drawing::Size( 80, 24 ); + okButton->Location = Point(this->Width - 100,this->Height - 60); + okButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); + okButton->DialogResult = ::DialogResult::OK; + this->Controls->Add( okButton ); + System::Windows::Forms::Button^ cancelButton = gcnew System::Windows::Forms::Button; + cancelButton->Text = "Cancel"; + cancelButton->Size = System::Drawing::Size( 80, 24 ); + cancelButton->Location = Point(this->Width - 200,this->Height - 60); + cancelButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); + cancelButton->DialogResult = ::DialogResult::Cancel; + this->Controls->Add( cancelButton ); + for ( int i = 0; i < controlArray->Length; i++ ) + controlList->Items->Add( controlArray[ i ]->UniqueID ); + this->ResumeLayout(); + } +}; + +// Provides a form with a multiline text box for input. +private ref class StringInputForm: public Form +{ +public: + System::Windows::Forms::TextBox^ tbox; + StringInputForm() + { + this->Size = System::Drawing::Size( 400, 400 ); + this->Text = "Input Control Persistence String"; + this->SuspendLayout(); + tbox = gcnew System::Windows::Forms::TextBox; + tbox->Multiline = true; + tbox->Size = System::Drawing::Size( this->Width - 40, this->Height - 90 ); + tbox->Text = ""; + this->Controls->Add( tbox ); + System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; + okButton->Text = "OK"; + okButton->Size = System::Drawing::Size( 80, 24 ); + okButton->Location = Point(this->Width - 100,this->Height - 60); + okButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); + okButton->DialogResult = ::DialogResult::OK; + this->Controls->Add( okButton ); + System::Windows::Forms::Button^ cancelButton = gcnew System::Windows::Forms::Button; + cancelButton->Text = "Cancel"; + cancelButton->Size = System::Drawing::Size( 80, 24 ); + cancelButton->Location = Point(this->Width - 200,this->Height - 60); + cancelButton->Anchor = AnchorStyles(AnchorStyles::Bottom | AnchorStyles::Right); + cancelButton->DialogResult = ::DialogResult::Cancel; + this->Controls->Add( cancelButton ); + this->ResumeLayout(); + } +}; + + +// Web control designer provides an interface +// to use the ControlPersister and ControlParser. +public ref class ControlParserPersisterDesigner: public System::Web::UI::Design::ControlDesigner +{ +public: + ControlParserPersisterDesigner() + : ControlDesigner() + {} + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + // Provides designer verb menu commands to + // persist a control and to load a persisted control. + [System::Security::Permissions::PermissionSetAttribute(System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override + { + DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; + dvc->Add( gcnew DesignerVerb( "Load Persisted Control...",gcnew EventHandler( this, &ControlParserPersisterDesigner::loadPersistedControl ) ) ); + dvc->Add( gcnew DesignerVerb( "Parse and Save Control...",gcnew EventHandler( this, &ControlParserPersisterDesigner::saveControl ) ) ); + return dvc; + } + + } + +private: + + // Displays a textbox form to receive an HTML + // String* that represents a control, and creates + // a toolbox item for the control, if not already + // present in the selected toolbox category. + void loadPersistedControl( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Display a StringInputForm to obtain a persisted control String*. + StringInputForm^ inputForm = gcnew StringInputForm; + if ( inputForm->ShowDialog() != DialogResult::OK ) + return; + + if ( inputForm->tbox->Text->Length < 2 ) + return; + + // Obtain an IDesignerHost* for the design-mode document. + IDesignerHost^ host = dynamic_cast(this->Component->Site->GetService( IDesignerHost::typeid )); + + // + // Create a Web control from the persisted control String*. + System::Web::UI::Control^ ctrl = ControlParser::ParseControl( host, inputForm->tbox->Text->Trim() ); + // + + // Create a Web control toolbox item for the type of the control + WebControlToolboxItem^ item = gcnew WebControlToolboxItem( ctrl->GetType() ); + + // Add the Web control toolbox item to the toolbox + IToolboxService^ toolService = dynamic_cast(this->Component->Site->GetService( IToolboxService::typeid )); + if ( toolService != nullptr ) + toolService->AddToolboxItem( item ); + else + throw gcnew Exception( "IToolboxService* was not found." ); + } + + // Displays a list of controls in the project, if any, + // and displays the HTML representing the persisted, selected control. + void saveControl( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Get the collection of components in the current + // design mode document. + ComponentCollection^ documentComponents = this->Component->Site->Container->Components; + + // Filter the components to those that derive from the + // System::Web::UI::Control class. + // Create an IComponent* array of the maximum possible length needed. + array^filterArray = gcnew array(documentComponents->Count); + + // Count the total qualifying components. + int total = 0; + for ( int i = 0; i < documentComponents->Count; i++ ) + { + // If the component derives from System::Web::UI::Control, + // copy a reference to the control to the filterArray + // array and increment the control count. + if ( System::Web::UI::Control::typeid->IsAssignableFrom( documentComponents[i]->GetType() ) ) + { + if ( (dynamic_cast(documentComponents[i]))->UniqueID != nullptr ) + { + filterArray[total] = documentComponents[i]; + total++; + } + } + + } + if ( total == 0 ) + throw gcnew Exception( "Document contains no System::Web::UI::Control components." ); + + // Move the components that derive from System::Web::UI::Control to a + // new array of the correct size. + array^controlArray = gcnew array(total); + for ( int i = 0; i < total; i++ ) + controlArray[i] = dynamic_cast(filterArray[i]); + + // Create a ControlSelectionForm to provide a persistence + // configuration interface. + ControlSelectionForm^ selectionForm = gcnew ControlSelectionForm( controlArray ); + + // Display the form. + if ( selectionForm->ShowDialog() != DialogResult::OK ) + return; + + // Validate the selection. + if ( selectionForm->controlList->SelectedIndex == -1 ) + throw gcnew Exception( "You must select a control to persist." ); + + // + // Parse the selected control. + String^ persistedData = ControlPersister::PersistControl( controlArray[ selectionForm->controlList->SelectedIndex ] ); + // + + // Display the control persistence String* in a text box. + StringDisplayForm^ displayForm = gcnew StringDisplayForm( persistedData ); + displayForm->ShowDialog(); + } +}; + +// Simple text display control hosts the ControlParserPersisterDesigner. + +[DesignerAttribute(ControlParserPersisterDesigner::typeid,IDesigner::typeid)] +public ref class ControlParserPersisterDesignerControl: public WebControl +{ +private: + String^ text; + +public: + + property String^ Text + { + [Bindable(true), + Category("Appearance"), + DefaultValue("")] + String^ get() + { + return text; + } + + void set( String^ value ) + { + text = value; + } + } + ControlParserPersisterDesignerControl() + : WebControl() + { + text = "Right-click here to access control persistence methods in design mode"; + } + +protected: + virtual void Render( HtmlTextWriter^ output ) override + { + output->Write( Text ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp b/snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp new file mode 100644 index 00000000000..185667b5413 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/DataSourceTypeConverterExamples/CPP/datasourcetypeconverterexamples.cpp @@ -0,0 +1,114 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::Design; +using namespace System::Web::UI::WebControls; +using namespace System::ComponentModel; + +public ref class DataSourceTypeConverterExampleControl: public System::Web::UI::WebControls::WebControl +{ + // + // Associates the DataBindingCollectionConverter + // with a DataBindingCollection property. +public: + [TypeConverterAttribute(DataBindingCollectionConverter::typeid)] + property DataBindingCollection^ dataBindings + { + DataBindingCollection^ get() + { + return bindings; + } + void set( DataBindingCollection^ value ) + { + bindings = value; + } + } +private: + DataBindingCollection^ bindings; + // + + // + // Associates the DataMemberConverter with a string property. +public: + [TypeConverterAttribute(DataMemberConverter::typeid)] + property String^ dataMember + { + String^ get() + { + return member; + } + void set( String^ value ) + { + member = value; + } + } +private: + String^ member; + // + + // + // Associates the DataFieldConverter with a string property. +public: + [TypeConverterAttribute(DataMemberConverter::typeid)] + property String^ dataField + { + String^ get() + { + return field; + } + void set( String^ value ) + { + field = value; + } + } +private: + String^ field; + // + + // + // Associates the DataSourceConverter with an object property. +public: + [TypeConverterAttribute(DataSourceConverter::typeid)] + property Object^ dataSource + { + Object^ get() + { + return source; + } + void set( Object^ value ) + { + source = value; + } + } +private: + Object^ source; + // + +public: + [Bindable(true), + Category("Appearance"), + DefaultValue("")] + property String^ Text + { + String^ get() + { + return text; + } + void set( String^ value ) + { + text = value; + } + } +private: + String^ text; + +protected: + virtual void Render( HtmlTextWriter^ output ) override + { + output->Write( Text ); + } +}; diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp new file mode 100644 index 00000000000..61b9fb1dc9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_AddStyleAttribute/CPP/htmltextwriter_addstyleattribute.cpp @@ -0,0 +1,65 @@ +/* +* The following example demonstrates the 'AddStyleAttribute(string, string)' method +* of 'HtmlTextWriter' class. +* +* In this program a custom web control called 'FirstControl' is shown. It has +* one property called the 'Message'. The 'Render' method has been overriden to +* write the html contents with reference to this control. This contents are +* written to the final .aspx page in which this control is inserted. The 'Render' +* method displays the contents of the 'Message' property followed by the current +* time on the server were the corresponding .aspx page resides. +* +* Note : Follow the instructions in HtmlTextWriterReadme.txt for details on installing +* a site that uses custom controls. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::WebControls; + +namespace CustomControls +{ + public ref class FirstControl: public WebControl + { + // The message property. + private: + String^ message; + + // Accessors for the message property. + public: + property String^ Message + { + virtual String^ get() + { + return message; + } + virtual void set( String^ value ) + { + message = value; + } + } + + protected: + virtual void Render( HtmlTextWriter^ writer ) override + { + // + // Add style attribute for 'p'(paragraph) element. + writer->AddStyleAttribute( "font-size", "12pt" ); + writer->AddStyleAttribute( "color", "fuchsia" ); + // Output the 'p' (paragraph) element with the style attributes. + writer->RenderBeginTag( "p" ); + // Output the 'Message' property contents and the time on the server. + writer->Write( String::Concat( Message, "
", + "The time on the server: ", + System::DateTime::Now.ToLongTimeString() ) ); + + // Close the element. + writer->RenderEndTag(); + //
+ } + }; +} diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp new file mode 100644 index 00000000000..67de2ee8b44 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods/CPP/htw.cpp @@ -0,0 +1,116 @@ +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web; +using namespace System::Web::UI; + +// Create a custom HtmlTextWriter class. +public ref class HTW1: public HtmlTextWriter +{ +public: + HTW1( TextWriter^ writer ) + : HtmlTextWriter( writer ) + {} + + HTW1( TextWriter^ writer, String^ tabString ) + : HtmlTextWriter( writer, tabString ) + {} + + // + // Override the RenderBeginTag method to check whether + // the tagKey parameter is set to a + +protected: + // + // Override the FilterAttributes method to check whether + // + + // + // Override the OutputTabs method to set the tab to + // the number of spaces defined by the Indent variable. + virtual void OutputTabs() override + { + + // Output the DefaultTabString for the number + // of times specified in the Indent property. + for ( int i = 0; i < Indent; i++ ) + Write( DefaultTabString ); + __super::OutputTabs(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp new file mode 100644 index 00000000000..a84dd30f1e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods1/CPP/htw2.cpp @@ -0,0 +1,73 @@ +// +// Create a custom HtmlTextWriter class that overrides +// the RenderBeforeContent and RenderAfterContent methods. +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::UI; +using namespace System::Security::Permissions; +using namespace System::Web; + +public ref class cstmHtmlTW: public HtmlTextWriter +{ +public: + cstmHtmlTW( TextWriter^ writer ) + : HtmlTextWriter( writer ) + {} + + cstmHtmlTW( TextWriter^ writer, String^ tabString ) + : HtmlTextWriter( writer, tabString ) + {} + + +protected: + + // + // Override the RenderBeforeContent method to write + // a font element that applies red to the text in a Label element. + + virtual String^ RenderBeforeContent() override + { + + // Check to determine whether the element being rendered + // is a label element. If so, render the opening tag + // of the font element; otherwise, call the base method. + if ( TagKey == HtmlTextWriterTag::Label ) + { + return ""; + } + else + { + return __super::RenderBeforeContent(); + } + } + + + // + // + // Override the RenderAfterContent method to render + // the closing tag of a font element if the + // rendered tag is a label element. + + virtual String^ RenderAfterContent() override + { + + // Check to determine whether the element being rendered + // is a label element. If so, render the closing tag + // of the font element; otherwise, call the base method. + if ( TagKey == HtmlTextWriterTag::Label ) + { + return ""; + } + else + { + return __super::RenderAfterContent(); + } + } + + // +}; + +// diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp new file mode 100644 index 00000000000..e9cca79b0ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods3/CPP/htmltextwriter_methods3.cpp @@ -0,0 +1,126 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::UI; +using namespace System::Web::UI::WebControls; + +// Create a custom markup writer that overrides two versions +// of the RenderBeginTag method and one version of the +// RenderEndTag method. +public ref class HtmlStyledLabelWriter: public HtmlTextWriter +{ +private: + TextWriter^ writer; + +public: + HtmlStyledLabelWriter( TextWriter^ writer ) + : HtmlTextWriter( writer ) + { + this->writer = writer; + } + + HtmlStyledLabelWriter( TextWriter^ writer, String^ tabString ) + : HtmlTextWriter( writer, tabString ) + { + this->writer = writer; + } + + // + virtual void RenderBeginTag( HtmlTextWriterTag tagKey ) override + { + // + // + // If the markup element being rendered is a Label, + // render the opening tag of a element before it. + if ( tagKey == HtmlTextWriterTag::Label ) + { + + // Check whether a Color style attribute is + // included on the Label. If not, use the + // AddStyleAttribute and GetStyleName methods to add one + // and set its value to red. + if ( !IsStyleAttributeDefined( HtmlTextWriterStyle::Color ) ) + { + AddStyleAttribute( GetStyleName( HtmlTextWriterStyle::Color ), "red" ); + } + + // + Write( TagLeftChar ); + + // + // Use the GetTagName method to associate + // the Font element with its HtmlTextWriteTag + // enumeration value in a Write method call. + Write( GetTagName( HtmlTextWriterTag::Font ) ); + + // + Write( SpaceChar ); + + // + // Use the GetAttributeName method to associate + // the Size attribute with its HtmlTextWriteAttribute + // enumeration value in a Write method call. + Write( GetAttributeName( HtmlTextWriterAttribute::Size ) ); + // + Write( EqualsChar ); + Write( DoubleQuoteChar ); + Write( "30pt" ); + Write( DoubleQuoteChar ); + Write( TagRightChar ); + // + // Close the Font element. + WriteEndTag( GetTagName( HtmlTextWriterTag::Font ) ); + // + } + + + // + // Call the base class's RenderBeginTag method. + __super::RenderBeginTag( tagKey ); + } + + + // + // + virtual void RenderBeginTag( String^ tagName ) override + { + + // Call the overloaded RenderBeginTag(HtmlTextWriterTag) method. + RenderBeginTag( GetTagKey( tagName ) ); + } + // + + // + virtual void RenderEndTag() override + { + + // Call the RenderEndTag method of the base class. + __super::RenderEndTag(); + + // If the element being rendered is a Label, + // call the PopEndTag method to write its closing tag. + if ( TagKey == HtmlTextWriterTag::Label ) + { + Write( PopEndTag() ); + } + } + // +}; +// + +// +// A custom class that overrides its CreateHtmlTextWriter method. +// This page uses the StyledLabelHtmlWriter class to render its content. +public ref class MyPage: public Page +{ +protected: + virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override + { + return gcnew HtmlStyledLabelWriter( writer ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp new file mode 100644 index 00000000000..04f022b0ab7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Methods4/CPP/htmltextwriter_methods4.cpp @@ -0,0 +1,120 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::UI; +using namespace System::Web::UI::WebControls; + +public ref class htwFour: public HtmlTextWriter +{ +public: + htwFour( TextWriter^ writer ) + : HtmlTextWriter( writer ) + {} + + htwFour( TextWriter^ writer, String^ tabString ) + : HtmlTextWriter( writer, tabString ) + {} + +protected: + + // + // Override the RenderBeforeTag method to add the + // opening tag of a Font element before the + // opening tag of any Label elements rendered by this + // custom markup writer. + virtual String^ RenderBeforeTag() override + { + // Compare the TagName property value to the + // String* label to determine whether the element to + // be rendered is a Label. If it is a Label, + // the opening tag of the Font element, with a Color + // style attribute set to red, is added before + // the Label. + if ( String::Compare( TagName, "label" ) == 0 ) + { + return ""; + } + // If a Label is not being rendered, use + // the base RenderBeforeTag method. + else + { + return __super::RenderBeforeTag(); + } + } + // + + // + // Override the RenderAfterTag method to add the + // closing tag of the Font element after the + // closing tag of a Label element has been rendered. + virtual String^ RenderAfterTag() override + { + // Compare the TagName property value to the + // String* label to determine whether the element to + // be rendered is a Label. If it is a Label, + // the closing tag of a Font element is rendered + // after the closing tag of the Label element. + if ( String::Compare( TagName, "label" ) == 0 ) + { + return ""; + } + // If a Label is not being rendered, use + // the base RenderAfterTag method. + else + { + return __super::RenderAfterTag(); + } + } + // +}; + +public ref class ctlMessage: public WebControl +{ +private: + + // The message property. + String^ myMessage; + +public: + ctlMessage() + { + myMessage = "Hello"; + } + + property String^ Message + { + // Accessors for the message property. + virtual String^ get() + { + return myMessage; + } + + virtual void set( String^ value ) + { + myMessage = value; + } + } + +protected: + virtual void Render( HtmlTextWriter^ writer ) override + { + // Write the contents of the control. + writer->RenderBeginTag( HtmlTextWriterTag::Label ); + writer->Write( Message ); + writer->RenderEndTag(); + writer->Write( "
The time on the server: {0}", System::DateTime::Now.ToLongTimeString() ); + } +}; + +public ref class MyPage: public Page +{ +protected: + virtual HtmlTextWriter^ CreateHtmlTextWriter( TextWriter^ writer ) override + { + return gcnew htwFour( writer ); + } +}; diff --git a/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp new file mode 100644 index 00000000000..a45b6c0abeb --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/HtmlTextWriter_Properties/CPP/htmltextwriter_properties1.cpp @@ -0,0 +1,81 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Web::UI; +using namespace System::Web::UI::WebControls; +public ref class FirstControl: public WebControl +{ +private: + + // The message property. + String^ myMessage; + +public: + FirstControl() + { + myMessage = "Hello"; + } + + + property String^ Message + { + + // Accessors for the message property. + virtual String^ get() + { + return myMessage; + } + + virtual void set( String^ value ) + { + myMessage = value; + } + + } + +protected: + + // + // Override a control's Render method to determine what it + // displays when included in a Web Forms page. + virtual void Render( HtmlTextWriter^ writer ) override + { + + // + // Get the value of the current markup writer's + // Encoding property, convert it to a string, and + // write it to the markup stream. + writer->Write( String::Concat( "Encoding : ", writer->Encoding, "
" ) ); + + //
+ // + // Write the opening tag of a Font element. + writer->WriteBeginTag( "font" ); + + // Write a Color style attribute to the opening tag + // of the Font element and set its value to red. + writer->WriteAttribute( "color", "red" ); + + // Write the closing character for the opening tag of + // the Font element. + writer->Write( '>' ); + + // Use the InnerWriter property to create a TextWriter + // object that will write the content found between + // the opening and closing tags of the Font element. + // Message is a string property of the control that + // overrides the Render method. + TextWriter^ innerTextWriter = writer->InnerWriter; + innerTextWriter->Write( String::Concat( Message, "
The time on the server : ", System::DateTime::Now.ToLongTimeString() ) ); + + // Write the closing tag of the Font element. + writer->WriteEndTag( "font" ); + } + + //
+}; + +//
diff --git a/snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp b/snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp new file mode 100644 index 00000000000..eb40dc1759d --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/System.Web.UI.HtmlTextWriter/CPP/htmltextwriter.cpp @@ -0,0 +1,59 @@ +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::WebControls; + +public ref class MyControl: public Control +{ +protected: + virtual void Render( HtmlTextWriter^ writer ) override + { + // + writer->AddAttribute( HtmlTextWriterAttribute::Onclick, "alert('Hello');" ); + // + writer->AddAttribute( "myattribute", "MyAttributeValue" ); + // + writer->AddStyleAttribute( HtmlTextWriterStyle::Color, "Red" ); + // + writer->AddStyleAttribute( "mystyleattr", "StyleValue" ); + writer->RenderBeginTag( HtmlTextWriterTag::Span ); + writer->WriteLine(); + writer->Indent++; + + writer->Write( "Hello" ); + writer->WriteLine(); + + // + // Control the encoding of attributes. + // Simple known values do not need encoding. + writer->AddAttribute( HtmlTextWriterAttribute::Alt, "Encoding, \"Required\"", true ); + writer->AddAttribute( "myattribute", "No "encoding " required", false ); + writer->RenderBeginTag( HtmlTextWriterTag::Img ); + writer->RenderEndTag(); + writer->WriteLine(); + // + + // + // Create a non-standard tag. + writer->RenderBeginTag( "MyTag" ); + writer->Write( "Contents of MyTag" ); + writer->RenderEndTag(); + writer->WriteLine(); + // + + // + // Create a manually rendered tag. + writer->WriteBeginTag( "img" ); + writer->WriteAttribute( "alt", "AtlValue" ); + writer->WriteAttribute( "myattribute", "No "encoding " required", false ); + writer->Write( HtmlTextWriter::TagRightChar ); + writer->WriteEndTag( "img" ); + // + writer->WriteLine(); + + writer->Indent--; + writer->RenderEndTag(); + } +}; diff --git a/snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp b/snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp new file mode 100644 index 00000000000..9a6f6824ce3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/UrlBuilderExample/CPP/urlbuilderdesigner.cpp @@ -0,0 +1,103 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Web::UI; +using namespace System::Web::UI::Design; +using namespace System::Web::UI::WebControls; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +// +// Example designer provides a designer verb menu command to launch the +// BuildUrl method of the UrlBuilder. +public ref class UrlBuilderDesigner: public UserControlDesigner +{ +public: + UrlBuilderDesigner(){} + + + property DesignerVerbCollection^ Verbs + { + + // Provides a designer verb menu command for invoking the BuildUrl + // method of the UrlBuilder. + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + virtual DesignerVerbCollection^ get() override + { + DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; + dvc->Add( gcnew DesignerVerb( "Launch URL Builder UI",gcnew EventHandler( this, &UrlBuilderDesigner::launchUrlBuilder ) ) ); + return dvc; + } + + } + +private: + + // This method handles the "Launch Url Builder UI" menu command. + // Invokes the BuildUrl method of the System::Web::UI::Design.UrlBuilder. + void launchUrlBuilder( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // + // Create a parent control. + System::Windows::Forms::Control^ c = gcnew System::Windows::Forms::Control; + c->CreateControl(); + + // Launch the Url Builder using the specified control + // parent, initial URL, empty relative base URL path, + // window caption, filter String* and URLBuilderOptions value. + UrlBuilder::BuildUrl( this->Component, c, "http://www.example.com", "Select a URL", "", UrlBuilderOptions::None ); + + // + } + +}; + + +// Example Web control displays the value of its text property. +// This control is associated with the UrlBuilderDesigner. + +[DesignerAttribute(UrlBuilderDesigner::typeid,IDesigner::typeid)] +public ref class UrlBuilderControl: public WebControl +{ +private: + String^ text; + +public: + + property String^ Text + { + + [Bindable(true), + Category("Appearance"), + DefaultValue("")] + String^ get() + { + return text; + } + + void set( String^ value ) + { + text = value; + } + + } + +protected: + virtual void Render( HtmlTextWriter^ output ) override + { + output->Write( Text ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp b/snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp new file mode 100644 index 00000000000..7ce2f1e7822 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/Urtue.Samples.Alexkr.AccessSiteMapProvider_1/CPP/accesssitemapprovider.cpp @@ -0,0 +1,219 @@ +// +#using +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Collections::Specialized; +using namespace System::Configuration; +using namespace System::Data; +using namespace System::Data::OleDb; +using namespace System::Security::Permissions; +using namespace System::Web; + +/// An extremely simple AccessSiteMapProvider that only supports a +/// site map node hierarchy 1 level deep. + +[AspNetHostingPermission(SecurityAction::Demand,Level=AspNetHostingPermissionLevel::Minimal)] +public ref class AccessSiteMapProvider: public StaticSiteMapProvider +{ +private: + SiteMapNode ^ rootNode; + OleDbConnection^ accessConnection; + + // This string is case sensitive. + String^ AccessConnectionStringName; + +public: + // Implement a default constructor. + AccessSiteMapProvider() + { + initialized = false; + AccessConnectionStringName = "accessSiteMapConnectionString"; + } + + +private: + + // Some basic state to help track the initialization state of the provider. + bool initialized; + +public: + + property bool IsInitialized + { + virtual bool get() + { + return initialized; + } + + } + + property SiteMapNode ^ RootNode + { + + // + // Return the root node of the current site map. + virtual SiteMapNode ^ get() override + { + SiteMapNode ^ temp = nullptr; + temp = BuildSiteMap(); + return temp; + } + + } + +protected: + + // + // + virtual SiteMapNode ^ GetRootNodeCore() override + { + return RootNode; + } + + +public: + + // + // + // Initialize is used to initialize the properties and any state that the + // AccessProvider holds, but is not used to build the site map. + // The site map is built when the BuildSiteMap method is called. + virtual void Initialize( String^ name, NameValueCollection^ attributes ) override + { + if ( IsInitialized ) + return; + + StaticSiteMapProvider::Initialize( name, attributes ); + + // Create and test the connection to the Microsoft Access database. + // Retrieve the Value of the Access connection string from the + // attributes NameValueCollection. + String^ connectionString = attributes[ AccessConnectionStringName ]; + if ( nullptr == connectionString || connectionString->Length == 0 ) + throw gcnew Exception( "The connection string was not found." ); + else + accessConnection = gcnew OleDbConnection( connectionString ); + + initialized = true; + } + + +protected: + + // + /// + /// SiteMapProvider and StaticSiteMapProvider methods that this derived class must override. + /// + // + // Clean up any collections or other state that an instance of this may hold. + virtual void Clear() override + { + System::Threading::Monitor::Enter( this ); + try + { + rootNode = nullptr; + StaticSiteMapProvider::Clear(); + } + finally + { + System::Threading::Monitor::Exit( this ); + } + + } + + +public: + + // + // + // Build an in-memory representation from persistent + // storage, and return the root node of the site map. + virtual SiteMapNode ^ BuildSiteMap() override + { + // Since the SiteMap class is static, make sure that it is + // not modified while the site map is built. + System::Threading::Monitor::Enter( this ); + try + { + + // If there is no initialization, this method is being + // called out of order. + if ( !IsInitialized ) + { + throw gcnew Exception( "BuildSiteMap called incorrectly." ); + } + + // If there is no root node, then there is no site map. + if ( nullptr == rootNode ) + { + + // Start with a clean slate + Clear(); + + // Select the root node of the site map from Microsoft Access. + int rootNodeId = -1; + if ( accessConnection->State == ConnectionState::Closed ) + accessConnection->Open(); + + // + OleDbCommand^ rootNodeCommand = gcnew OleDbCommand + ("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid IS NULL", accessConnection); + OleDbDataReader^ rootNodeReader = rootNodeCommand->ExecuteReader(); + if ( rootNodeReader->HasRows ) + { + rootNodeReader->Read(); + rootNodeId = rootNodeReader->GetInt32( 0 ); + + // Create a SiteMapNode that references the current StaticSiteMapProvider. + rootNode = gcnew SiteMapNode(this, rootNodeId.ToString(), + rootNodeReader->GetString( 1 ),rootNodeReader->GetString( 2 )); + } + else + return nullptr; + rootNodeReader->Close(); + + // + // Select the child nodes of the root node. + OleDbCommand^ childNodesCommand = gcnew OleDbCommand + ("SELECT nodeid, url, name FROM SiteMap WHERE parentnodeid = ?", accessConnection); + OleDbParameter^ rootParam = gcnew OleDbParameter( "parentid", OleDbType::Integer); + rootParam->Value = rootNodeId; + childNodesCommand->Parameters->Add( rootParam ); + OleDbDataReader^ childNodesReader = childNodesCommand->ExecuteReader(); + if ( childNodesReader->HasRows ) + { + SiteMapNode ^ childNode = nullptr; + while ( childNodesReader->Read() ) + { + childNode = gcnew SiteMapNode( this, + System::Convert::ToString(childNodesReader->GetInt32( 0 )), + childNodesReader->GetString( 1 ), + childNodesReader->GetString( 2 ) + ); + // Use the SiteMapNode AddNode method to add + // the SiteMapNode to the ChildNodes collection. + AddNode( childNode, rootNode ); + } + } + childNodesReader->Close(); + accessConnection->Close(); + } + return rootNode; + } + finally + { + System::Threading::Monitor::Exit( this ); + } + + } + + // +}; + +// diff --git a/snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp b/snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp new file mode 100644 index 00000000000..edabd5de573 --- /dev/null +++ b/snippets/cpp/VS_Snippets_WebNet/WebUITypeEditorsExample/CPP/webcustomcontrol1.cpp @@ -0,0 +1,175 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Web::UI; +using namespace System::Web::UI::Design; +using namespace System::Web::UI::WebControls; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; + +[DefaultProperty("Text"), +ToolboxData("< {0}:WebCustomControl1 runat=server>")] +public ref class WebCustomControl1: public WebControl +{ +private: + String^ text; + + // +public: + property String^ URL + { + + [EditorAttribute(UrlEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return http_url; + } + + [EditorAttribute(UrlEditor::typeid,UITypeEditor::typeid)] + void set( String^ value ) + { + http_url = value; + } + } + +private: + String^ http_url; + // + + // +private: + property String^ XmlFile + { + [EditorAttribute(XmlFileEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return xml_; + } + + [EditorAttribute(XmlFileEditor::typeid,UITypeEditor::typeid)] + void set( String^ value ) + { + xml_ = value; + } + } + String^ xml_; + // + + // +public: + property String^ XmlFileURL + { + [EditorAttribute(XmlUrlEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return xmlURL; + } + + + [EditorAttribute(XmlUrlEditor::typeid,UITypeEditor::typeid)] + void set( String^ value ) + { + xmlURL = value; + } + + } + +private: + String^ xmlURL; + // + + // +public: + property String^ XslFileURL + { + [EditorAttribute(XslUrlEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return xslURL; + } + + [EditorAttribute(XslUrlEditor::typeid,UITypeEditor::typeid)] + void set( String^ value ) + { + xslURL = value; + } + } + +private: + String^ xslURL; + // + + // +public: + property String^ imageURL + { + [EditorAttribute(ImageUrlEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return imgURL; + } + + + [EditorAttribute(ImageUrlEditor::typeid,UITypeEditor::typeid)] + void set( String^ value ) + { + imgURL = value; + } + + } + +private: + String^ imgURL; + // + + // +public: + property DataBindingCollection^ TestDataBindings + { + [EditorAttribute(DataBindingCollectionEditor::typeid, + UITypeEditor::typeid)] + DataBindingCollection^ get() + { + return testBindings; + } + + [EditorAttribute(DataBindingCollectionEditor::typeid, + UITypeEditor::typeid)] + void set( DataBindingCollection^ value ) + { + testBindings = value; + } + } + +private: + DataBindingCollection^ testBindings; + // + +public: + property String^ Text + { + [Bindable(true),Category("Appearance"),DefaultValue("")] + String^ get() + { + return text; + } + + [Bindable(true),Category("Appearance"),DefaultValue("")] + void set( String^ value ) + { + text = value; + } + } + +protected: + virtual void Render( HtmlTextWriter^ output ) override + { + output->Write( Text ); + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp new file mode 100644 index 00000000000..a2a0d0c5792 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventArgs/CPP/class1.cpp @@ -0,0 +1,15 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +// +ActiveDesignerEventArgs^ CreateActiveDesignerEventArgs( IDesignerHost^ losingFocus, IDesignerHost^ gainingFocus ) +{ + ActiveDesignerEventArgs^ e = gcnew ActiveDesignerEventArgs( losingFocus, gainingFocus ); + return e; +} +// + +void main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp new file mode 100644 index 00000000000..0d74c1bfa4a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ActiveDesignerEventHandlerExample/CPP/activedesignereventhandlerexample.cpp @@ -0,0 +1,41 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ActiveDesignerEventHandlerExample + { + private: + ActiveDesignerEventHandlerExample() + { + } + + // + public: + void LinkActiveDesignerEvent( IDesignerEventService^ eventService ) + { + // Registers an event handler for the ActiveDesignerChanged event. + eventService->ActiveDesignerChanged += gcnew ActiveDesignerEventHandler( this, &MiscCompModSamples::ActiveDesignerEventHandlerExample::OnActiveDesignerEvent ); + } + + private: + void OnActiveDesignerEvent( Object^ /*sender*/, ActiveDesignerEventArgs^ e ) + { + // Displays changed designer information on the console. + if ( e->NewDesigner->RootComponent->Site != nullptr ) + { + Console::WriteLine( "Name of the component of the new active designer: {0}", e->NewDesigner->RootComponent->Site->Name ); + } + Console::WriteLine( "Type of the component of the new active designer: {0}", e->NewDesigner->RootComponentClassName ); + if ( e->OldDesigner->RootComponent->Site != nullptr ) + { + Console::WriteLine( "Name of the component of the previously active designer: {0}", e->OldDesigner->RootComponent->Site->Name ); + } + Console::WriteLine( "Type of the component of the previously active designer: {0}", e->OldDesigner->RootComponentClassName ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp b/snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp new file mode 100644 index 00000000000..2753f97d6e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/AngleEditor/CPP/angleeditor.cpp @@ -0,0 +1,335 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +namespace AngleEditor +{ + // Provides a user interface for adjusting an angle value. + ref class AngleControl: public System::Windows::Forms::UserControl + { + public: + + // Stores the angle. + double angle; + + private: + + // Stores the rotation offset. + int rotation; + + // Control state tracking variables. + int dbx; + int dby; + int overButton; + + public: + AngleControl( double initial_angle ) + { + this->angle = initial_angle; + this->SetStyle( static_cast(ControlStyles::AllPaintingInWmPaint), true ); + rotation = 0; + dbx = -10; + dby = -10; + overButton = -1; + } + + protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + // Set angle origin point at center of control. + int originX = (this->Width / 2); + int originY = (this->Height / 2); + + // Fill background and ellipse and center point. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkBlue ), 0, 0, this->Width, this->Height ); + e->Graphics->FillEllipse( gcnew SolidBrush( Color::White ), 1, 1, this->Width - 3, this->Height - 3 ); + e->Graphics->FillEllipse( gcnew SolidBrush( Color::SlateGray ), originX - 1, originY - 1, 3, 3 ); + + // Draw angle markers. + int startangle = (270 - rotation) % 360; + e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8.0 ), gcnew SolidBrush( Color::DarkGray ), (float)(this->Width / 2) - 10, (float)10 ); + startangle = (startangle + 90) % 360; + e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::DarkGray ), (float)this->Width - 18, (float)(this->Height / 2) - 6 ); + startangle = (startangle + 90) % 360; + e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::DarkGray ), ((float)this->Width / 2) - 6, (float)this->Height - 18 ); + startangle = (startangle + 90) % 360; + e->Graphics->DrawString( startangle.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::DarkGray ), (float)10, (float)(this->Height / 2) - 6 ); + + // Draw line along the current angle. + double radians = ((((int)(angle + rotation) + 360) % 360) * Math::PI) / (double)180; + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Red ),1 ), originX, originY, originX + (int)((double)originX * (double)Math::Cos( radians )), originY + (int)((double)originY * (double)Math::Sin( radians )) ); + + // Output angle information. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Gray ), this->Width - 84, 3, 82, 13 ); + e->Graphics->DrawString( String::Format( "Angle: {0}", angle.ToString( "F4" ) ), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Yellow ), (float)this->Width - 84, (float)2 ); + + // Draw square at mouse position of last angle adjustment. + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), dbx - 2, dby - 2, 4, 4 ); + + // Draw rotation adjustment buttons. + if ( overButton == 1 ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 28, this->Height - 14, 12, 12 ); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Gray ), 2, this->Height - 13, 110, 12 ); + e->Graphics->DrawString( "Rotate 90 degrees left", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::White ), (float)2, (float)this->Height - 14 ); + } + else + e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 28, this->Height - 14, 12, 12 ); + + if ( overButton == 2 ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 14, this->Height - 14, 12, 12 ); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Gray ), 2, this->Height - 13, 116, 12 ); + e->Graphics->DrawString( "Rotate 90 degrees right", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::White ), (float)2, (float)this->Height - 14 ); + } + else + e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 14, this->Height - 14, 12, 12 ); + + e->Graphics->DrawEllipse( gcnew Pen( gcnew SolidBrush( Color::White ),1 ), this->Width - 11, this->Height - 11, 6, 6 ); + e->Graphics->DrawEllipse( gcnew Pen( gcnew SolidBrush( Color::White ),1 ), this->Width - 25, this->Height - 11, 6, 6 ); + if ( overButton == 1 ) + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 25, this->Height - 6, 4, 4 ); + else + e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 25, this->Height - 6, 4, 4 ); + + if ( overButton == 2 ) + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), this->Width - 8, this->Height - 6, 4, 4 ); + else + e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkGreen ), this->Width - 8, this->Height - 6, 4, 4 ); + + array^ temp0 = {Point(this->Width - 7,this->Height - 8),Point(this->Width - 3,this->Height - 8),Point(this->Width - 5,this->Height - 4)}; + e->Graphics->FillPolygon( gcnew SolidBrush( Color::White ), temp0 ); + array^ temp1 = {Point(this->Width - 26,this->Height - 8),Point(this->Width - 21,this->Height - 8),Point(this->Width - 25,this->Height - 4)}; + e->Graphics->FillPolygon( gcnew SolidBrush( Color::White ), temp1 ); + } + + virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) override + { + // Handle rotation adjustment button clicks. + if ( e->X >= this->Width - 28 && e->X <= this->Width - 2 && e->Y >= this->Height - 14 && e->Y <= this->Height - 2 ) + { + if ( e->X <= this->Width - 16 ) + rotation -= 90; + else + if ( e->X >= this->Width - 14 ) + rotation += 90; + + if ( rotation < 0 ) + rotation += 360; + + rotation = rotation % 360; + dbx = -10; + dby = -10; + } + else + UpdateAngle( e->X, e->Y ); + + this->Refresh(); + } + + virtual void OnMouseMove( System::Windows::Forms::MouseEventArgs^ e ) override + { + if ( e->Button == ::MouseButtons::Left ) + { + UpdateAngle( e->X, e->Y ); + overButton = -1; + } + else + if ( e->X >= this->Width - 28 && e->X <= this->Width - 16 && e->Y >= this->Height - 14 && e->Y <= this->Height - 2 ) + overButton = 1; + else + if ( e->X >= this->Width - 14 && e->X <= this->Width - 2 && e->Y >= this->Height - 14 && e->Y <= this->Height - 2 ) + overButton = 2; + else + overButton = -1; + + this->Refresh(); + } + + private: + void UpdateAngle( int mx, int my ) + { + // Store mouse coordinates. + dbx = mx; + dby = my; + + // Translate y coordinate input to GetAngle function to correct for ellipsoid distortion. + double widthToHeightRatio = (double)this->Width / (double)this->Height; + int tmy; + if ( my == 0 ) + tmy = my; + else + if ( my < this->Height / 2 ) + tmy = (this->Height / 2) - (int)(((this->Height / 2) - my) * widthToHeightRatio); + else + tmy = (this->Height / 2) + (int)((double)(my - (this->Height / 2)) * widthToHeightRatio); + + // Retrieve updated angle based on rise over run. + angle = (int)(GetAngle( this->Width / 2, this->Height / 2, mx, tmy ) - rotation) % 360; + } + + double GetAngle( int x1, int y1, int x2, int y2 ) + { + double degrees; + + // Avoid divide by zero run values. + if ( x2 - x1 == 0 ) + { + if ( y2 > y1 ) + degrees = 90; + else + degrees = 270; + } + else + { + // Calculate angle from offset. + double riseoverrun = (double)(y2 - y1) / (double)(x2 - x1); + double radians = Math::Atan( riseoverrun ); + degrees = radians * ((double)180 / Math::PI); + + // Handle quadrant specific transformations. + if ( (x2 - x1) < 0 || (y2 - y1) < 0 ) + degrees += 180; + + if ( (x2 - x1) > 0 && (y2 - y1) < 0 ) + degrees -= 180; + + if ( degrees < 0 ) + degrees += 360; + } + + return degrees; + } + }; + + // This UITypeEditor can be associated with Int32, Double and Single + // properties to provide a design-mode angle selection interface. + [System::Security::Permissions::PermissionSetAttribute + (System::Security::Permissions::SecurityAction::InheritanceDemand, Name="FullTrust")] + [System::Security::Permissions::PermissionSetAttribute + (System::Security::Permissions::SecurityAction::LinkDemand, Name="FullTrust")] + public ref class AngleEditor: public System::Drawing::Design::UITypeEditor + { + public: + AngleEditor(){} + + // Indicates whether the UITypeEditor provides a form-based (modal) dialog, + // drop down dialog, or no UI outside of the properties window. + virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle( System::ComponentModel::ITypeDescriptorContext^ context ) override + { + return UITypeEditorEditStyle::DropDown; + } + + // Displays the UI for value selection. + virtual Object^ EditValue( System::ComponentModel::ITypeDescriptorContext^ context, System::IServiceProvider^ provider, Object^ value ) override + { + // Return the value if the value is not of type Int32, Double and Single. + if ( value->GetType() != double::typeid && value->GetType() != float::typeid && value->GetType() != int::typeid ) + return value; + + // Uses the IWindowsFormsEditorService* to display a + // drop-down UI in the Properties window. + IWindowsFormsEditorService^ edSvc = dynamic_cast(provider->GetService( IWindowsFormsEditorService::typeid )); + if ( edSvc != nullptr ) + { + // Display an angle selection control and retrieve the value. + AngleControl^ angleControl = gcnew AngleControl( *dynamic_cast(value) ); + edSvc->DropDownControl( angleControl ); + + // Return the value in the appropraite data format. + if ( value->GetType() == double::typeid ) + return angleControl->angle; + else + if ( value->GetType() == float::typeid ) + return (float)angleControl->angle; + else + if ( value->GetType() == int::typeid ) + return (int)angleControl->angle; + } + + return value; + } + + // Draws a representation of the property's value. + private: + void PaintValue( System::Drawing::Design::PaintValueEventArgs^ e ) new + { + int normalX = (e->Bounds.Width / 2); + int normalY = (e->Bounds.Height / 2); + + // Fill background and ellipse and center point. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::DarkBlue ), e->Bounds.X, e->Bounds.Y, e->Bounds.Width, e->Bounds.Height ); + e->Graphics->FillEllipse( gcnew SolidBrush( Color::White ), e->Bounds.X + 1, e->Bounds.Y + 1, e->Bounds.Width - 3, e->Bounds.Height - 3 ); + e->Graphics->FillEllipse( gcnew SolidBrush( Color::SlateGray ), normalX + e->Bounds.X - 1, normalY + e->Bounds.Y - 1, 3, 3 ); + + // Draw line along the current angle. + double radians = ( *dynamic_cast(e->Value) * Math::PI) / (double)180; + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Red ),1 ), normalX + e->Bounds.X, normalY + e->Bounds.Y, e->Bounds.X + (normalX + (int)((double)normalX * Math::Cos( radians ))), e->Bounds.Y + (normalY + (int)((double)normalY * Math::Sin( radians ))) ); + } + + // Indicates whether the UITypeEditor supports painting a + // representation of a property's value. + bool GetPaintValueSupported( System::ComponentModel::ITypeDescriptorContext^ context ) new + { + return true; + } + }; + + public ref class AngleEditorTestControl: public System::Windows::Forms::UserControl + { + private: + double int_angle; + + public: + + property double Angle + { + [BrowsableAttribute(true)] + [EditorAttribute(AngleEditor::typeid,System::Drawing::Design::UITypeEditor::typeid)] + double get() + { + return int_angle; + } + + void set( double value ) + { + int_angle = value; + } + + } + AngleEditorTestControl() + { + int_angle = 90; + this->Size = System::Drawing::Size( 190, 42 ); + this->BackColor = Color::Beige; + } + + protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + if ( this->DesignMode ) + { + e->Graphics->DrawString( "Use the Properties Window to access", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 2 ); + e->Graphics->DrawString( "the AngleEditor UITypeEditor by", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 14 ); + e->Graphics->DrawString( "configuring the \"Angle\" property.", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 26 ); + } + else + e->Graphics->DrawString( "This example requires design mode.", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 3, 2 ); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp b/snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp new file mode 100644 index 00000000000..0cc04b2c92e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/AppSettingsSample/cpp/AppSettingsSample.cpp @@ -0,0 +1,321 @@ +//AppSettingsSample C# sample, flattened to one file for Parsnip. + + // + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Configuration; +using namespace System::Windows::Forms; + +namespace AppSettingsSample +{ + // + //Application settings wrapper class + ref class FormSettings sealed: public ApplicationSettingsBase + { + public: + [UserScopedSettingAttribute()] + property String^ FormText + { + String^ get() + { + return (String^)this["FormText"]; + } + void set( String^ value ) + { + this["FormText"] = value; + } + } + + // + public: + [UserScopedSettingAttribute()] + [DefaultSettingValueAttribute("0, 0")] + property Point FormLocation + { + Point get() + { + return (Point)(this["FormLocation"]); + } + void set( Point value ) + { + this["FormLocation"] = value; + } + } + // + + public: + [UserScopedSettingAttribute()] + [DefaultSettingValueAttribute("225, 200")] + property Size FormSize + { + Size get() + { + return (Size)this["FormSize"]; + } + void set( Size value ) + { + this["FormSize"] = value; + } + } + + public: + [UserScopedSettingAttribute()] + [DefaultSettingValueAttribute("LightGray")] + property Color FormBackColor + { + Color get() + { + return (Color)this["FormBackColor"]; + } + void set(Color value) + { + this["FormBackColor"] = value; + } + } + + }; + // + + ref class AppSettingsForm : Form + { + /// + /// Required designer variable. + /// + private: + System::ComponentModel::IContainer^ components; + + /// + /// Clean up any resources being used. The Dispose(true) + /// pattern for embedded objects is implemented with this + /// code that just contains a destructor + /// + public: + ~AppSettingsForm() + { + if (components != nullptr) + { + delete components; + } + } + +#pragma region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private: + void InitializeComponent() + { + this->components = nullptr; + this->colorDialog = gcnew System::Windows::Forms::ColorDialog(); + this->backColorButton = gcnew System::Windows::Forms::Button(); + this->resetButton = gcnew System::Windows::Forms::Button(); + this->statusDisplay = gcnew System::Windows::Forms::TextBox(); + this->reloadButton = gcnew System::Windows::Forms::Button(); + this->SuspendLayout(); + // + // backColorButton + // + this->backColorButton->Location = System::Drawing::Point(26, 24); + this->backColorButton->Name = "backColorButton"; + this->backColorButton->Size = System::Drawing::Size(159, 23); + this->backColorButton->TabIndex = 0; + this->backColorButton->Text = "Change Background Color"; + this->backColorButton->Click += gcnew System::EventHandler + (this,&AppSettingsForm::BackColorButton_Click); + // + // resetButton + // + this->resetButton->Location = System::Drawing::Point(26, 90); + this->resetButton->Name = "resetButton"; + this->resetButton->Size = System::Drawing::Size(159, 23); + this->resetButton->TabIndex = 1; + this->resetButton->Text = "Reset to Defaults"; + this->resetButton->Click += gcnew System::EventHandler + (this,&AppSettingsForm::ResetButton_Click); + // + // statusDisplay + // + this->statusDisplay->Location = System::Drawing::Point(26, 123); + this->statusDisplay->Name = "statusDisplay"; + this->statusDisplay->Size = System::Drawing::Size(159, 20); + this->statusDisplay->TabIndex = 2; + // + // reloadButton + // + this->reloadButton->Location = System::Drawing::Point(26, 57); + this->reloadButton->Name = "reloadButton"; + this->reloadButton->Size = System::Drawing::Size(159, 23); + this->reloadButton->TabIndex = 3; + this->reloadButton->Text = "Reload from Storage"; + this->reloadButton->Click += gcnew System::EventHandler + (this,&AppSettingsForm::ReloadButton_Click); + // + // AppSettingsForm + // + this->ClientSize = System::Drawing::Size(217, 166); + this->Controls->Add(this->reloadButton); + this->Controls->Add(this->statusDisplay); + this->Controls->Add(this->resetButton); + this->Controls->Add(this->backColorButton); + this->Name = "AppSettingsForm"; + this->Text = "App Settings"; + this->FormClosing += gcnew + System::Windows::Forms::FormClosingEventHandler + (this,&AppSettingsForm::AppSettingsForm_FormClosing); + this->Load += gcnew System::EventHandler(this, + &AppSettingsForm::AppSettingsForm_Load); + this->ResumeLayout(false); + this->PerformLayout(); + + } + +#pragma endregion + + // + private: + System::Windows::Forms::ColorDialog^ colorDialog; + + System::Windows::Forms::Button^ backColorButton; + + System::Windows::Forms::Button^ resetButton; + + System::Windows::Forms::TextBox^ statusDisplay; + + System::Windows::Forms::Button^ reloadButton; + // + + + + FormSettings ^ formSettings; + + public: + AppSettingsForm() + { + formSettings = gcnew FormSettings; + InitializeComponent(); + } + + // + private: + void AppSettingsForm_Load(Object^ sender, EventArgs^ e) + { + // + //Associate settings property event handlers. + formSettings->SettingChanging += gcnew SettingChangingEventHandler( + this, &AppSettingsForm::FormSettings_SettingChanging); + formSettings->SettingsSaving += gcnew SettingsSavingEventHandler( + this,&AppSettingsForm::FormSettings_SettingsSaving); + // + + // + //Data bind settings properties with straightforward associations. + Binding^ backColorBinding = gcnew Binding("BackColor", + formSettings, "FormBackColor", true, + DataSourceUpdateMode::OnPropertyChanged); + this->DataBindings->Add(backColorBinding); + Binding^ sizeBinding = gcnew Binding("Size", formSettings, + "FormSize", true, DataSourceUpdateMode::OnPropertyChanged); + this->DataBindings->Add(sizeBinding); + Binding^ locationBinding = gcnew Binding("Location", formSettings, + "FormLocation", true, DataSourceUpdateMode::OnPropertyChanged); + this->DataBindings->Add(locationBinding); + + //For more complex associations, manually assign associations. + String^ savedText = formSettings->FormText; + //Since there is no default value for FormText. + if (savedText != nullptr) + { + this->Text = savedText; + } + // + } + // + + // + private: + void AppSettingsForm_FormClosing(Object^ sender, + FormClosingEventArgs^ e) + { + //Synchronize manual associations first. + formSettings->FormText = this->Text + '.'; + formSettings->Save(); + } + // + + // + private: + void BackColorButton_Click(Object^ sender, EventArgs^ e) + { + if (::DialogResult::OK == colorDialog->ShowDialog()) + { + Color color = colorDialog->Color; + this->BackColor = color; + } + } + // + + // + private: + void ResetButton_Click(Object^ sender, EventArgs^ e) + { + formSettings->Reset(); + this->BackColor = SystemColors::Control; + } + // + + // + private: + void ReloadButton_Click(Object^ sender, EventArgs^ e) + { + formSettings->Reload(); + } + // + + // + private: + void FormSettings_SettingChanging(Object^ sender, + SettingChangingEventArgs^ e) + { + statusDisplay->Text = e->SettingName + ": " + e->NewValue; + } + // + + // + private: + void FormSettings_SettingsSaving(Object^ sender, + CancelEventArgs^ e) + { + //Should check for settings changes first. + ::DialogResult^ dialogResult = MessageBox::Show( + "Save current values for application settings?", + "Save Settings", MessageBoxButtons::YesNo); + if (::DialogResult::No == dialogResult) + { + e->Cancel = true; + } + } + // + }; + // +} + +/// +/// The main entry point for the application. +/// +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew AppSettingsSample::AppSettingsForm()); + +}; + + diff --git a/snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp new file mode 100644 index 00000000000..0ee1a0e51ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Appearance/CPP/form1.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using + +// +using namespace System; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +public: + Form1() + { + array^tabText = {"tabPage1","tabPage2"}; + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage( tabText[ 0 ] ); + TabPage^ tabPage2 = gcnew TabPage( tabText[ 1 ] ); + + // Sets the tabs to appear as buttons. + tabControl1->Appearance = TabAppearance::Buttons; + array^tabPageArray = {tabPage1,tabPage2}; + tabControl1->Controls->AddRange( tabPageArray ); + Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp new file mode 100644 index 00000000000..8e199bdfb3a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Application/CPP/source.cpp @@ -0,0 +1,249 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +using namespace System::Text; +using namespace System::IO; + +// A simple form that represents a window in our application +public ref class AppForm2: public System::Windows::Forms::Form +{ +public: + AppForm2() + { + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "AppForm2"; + } + +}; + +// A simple form that represents a window in our application +public ref class AppForm1: public System::Windows::Forms::Form +{ +public: + AppForm1() + { + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "AppForm1"; + } + +}; + +// +// The class that handles the creation of the application windows +ref class MyApplicationContext: public ApplicationContext +{ +private: + int _formCount; + AppForm1^ _form1; + AppForm2^ _form2; + System::Drawing::Rectangle _form1Position; + System::Drawing::Rectangle _form2Position; + FileStream^ _userData; + +public: + + // + MyApplicationContext() + { + _formCount = 0; + + // Handle the ApplicationExit event to know when the application is exiting. + Application::ApplicationExit += gcnew EventHandler( this, &MyApplicationContext::OnApplicationExit ); + try + { + + // Create a file that the application will store user specific data in. + _userData = gcnew FileStream( String::Concat( Application::UserAppDataPath, "\\appdata.txt" ),FileMode::OpenOrCreate ); + } + catch ( IOException^ e ) + { + + // Inform the user that an error occurred. + MessageBox::Show( "An error occurred while attempting to show the application. The error is: {0}", dynamic_cast(e) ); + + // Exit the current thread instead of showing the windows. + ExitThread(); + } + + + // Create both application forms and handle the Closed event + // to know when both forms are closed. + _form1 = gcnew AppForm1; + _form1->Closed += gcnew EventHandler( this, &MyApplicationContext::OnFormClosed ); + _form1->Closing += gcnew CancelEventHandler( this, &MyApplicationContext::OnFormClosing ); + _formCount++; + _form2 = gcnew AppForm2; + _form2->Closed += gcnew EventHandler( this, &MyApplicationContext::OnFormClosed ); + _form2->Closing += gcnew CancelEventHandler( this, &MyApplicationContext::OnFormClosing ); + _formCount++; + + // Get the form positions based upon the user specific data. + if ( ReadFormDataFromFile() ) + { + + // If the data was read from the file, set the form + // positions manually. + _form1->StartPosition = FormStartPosition::Manual; + _form2->StartPosition = FormStartPosition::Manual; + _form1->Bounds = _form1Position; + _form2->Bounds = _form2Position; + } + + + // Show both forms. + _form1->Show(); + _form2->Show(); + } + + void OnApplicationExit( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // When the application is exiting, write the application data to the + // user file and close it. + WriteFormDataToFile(); + try + { + + // Ignore any errors that might occur while closing the file handle. + _userData->Close(); + } + catch ( Exception^ ) + { + } + + } + +private: + + // + void OnFormClosing( Object^ sender, CancelEventArgs^ /*e*/ ) + { + + // When a form is closing, remember the form position so it + // can be saved in the user data file. + if ( dynamic_cast(sender) != nullptr ) + _form1Position = (dynamic_cast(sender))->Bounds; + else + if ( dynamic_cast(sender) != nullptr ) + _form2Position = (dynamic_cast(sender))->Bounds; + } + + // + void OnFormClosed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // When a form is closed, decrement the count of open forms. + // When the count gets to 0, exit the app by calling + // ExitThread(). + _formCount--; + if ( _formCount == 0 ) + { + ExitThread(); + } + } + + // + bool WriteFormDataToFile() + { + + // Write the form positions to the file. + UTF8Encoding^ encoding = gcnew UTF8Encoding; + RectangleConverter^ rectConv = gcnew RectangleConverter; + String^ form1pos = rectConv->ConvertToString( _form1Position ); + String^ form2pos = rectConv->ConvertToString( _form2Position ); + array^dataToWrite = encoding->GetBytes( String::Concat( "~", form1pos, "~", form2pos ) ); + try + { + + // Set the write position to the start of the file and write + _userData->Seek( 0, SeekOrigin::Begin ); + _userData->Write( dataToWrite, 0, dataToWrite->Length ); + _userData->Flush(); + _userData->SetLength( dataToWrite->Length ); + return true; + } + catch ( Exception^ ) + { + + // An error occurred while attempting to write, return false. + return false; + } + + } + + bool ReadFormDataFromFile() + { + + // Read the form positions from the file. + UTF8Encoding^ encoding = gcnew UTF8Encoding; + String^ data; + if ( _userData->Length != 0 ) + { + array^dataToRead = gcnew array(_userData->Length); + try + { + + // Set the read position to the start of the file and read. + _userData->Seek( 0, SeekOrigin::Begin ); + _userData->Read( dataToRead, 0, dataToRead->Length ); + } + catch ( IOException^ e ) + { + String^ errorInfo = dynamic_cast(e); + + // An error occurred while attempt to read, return false. + return false; + } + + // Parse out the data to get the window rectangles + data = encoding->GetString( dataToRead ); + try + { + + // Convert the String* data to rectangles + RectangleConverter^ rectConv = gcnew RectangleConverter; + String^ form1pos = data->Substring( 1, data->IndexOf( "~", 1 ) - 1 ); + _form1Position = *safe_cast(rectConv->ConvertFromString( form1pos )); + String^ form2pos = data->Substring( data->IndexOf( "~", 1 ) + 1 ); + _form2Position = *safe_cast(rectConv->ConvertFromString( form2pos )); + return true; + } + catch ( Exception^ ) + { + + // Error occurred while attempting to convert the rectangle data. + // Return false to use default values. + return false; + } + } + else + { + + // No data in the file, return false to use default values. + return false; + } + } +}; +// + +// +[STAThread] +int main() +{ + + // Create the MyApplicationContext, that derives from ApplicationContext, + // that manages when the application should exit. + MyApplicationContext^ context = gcnew MyApplicationContext; + + // Run the application with the specific context. It will exit when + // all forms are closed. + Application::Run( context ); +} +// +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp new file mode 100644 index 00000000000..33fb65ec266 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ArrayEditorExample/CPP/class1.cpp @@ -0,0 +1,41 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing::Design; + +namespace ArrayEditorExample +{ + public ref class ArrayEditorTestComponent: public Component + { + // + public: + property array^ componentArray + { + [EditorAttribute(System::ComponentModel::Design::ArrayEditor::typeid, + System::Drawing::Design::UITypeEditor::typeid)] + array^ get() + { + return compArray; + } + void set( array^ value ) + { + compArray = value; + } + } + private: + array^compArray; + // + + public: + ArrayEditorTestComponent() + { + array^ temp0 = {gcnew Component, gcnew Component, this}; + compArray = temp0; + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp b/snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp new file mode 100644 index 00000000000..61ef4537216 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BasicSplitContainer/CPP/basicsplitcontainer.cpp @@ -0,0 +1,179 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::SplitContainer^ splitContainer1; + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::SplitContainer^ splitContainer2; + System::Windows::Forms::ListView^ listView2; + System::Windows::Forms::ListView^ listView1; + +public: + Form1() + { + InitializeComponent(); + } + + +private: + void InitializeComponent() + { + splitContainer1 = gcnew System::Windows::Forms::SplitContainer; + treeView1 = gcnew System::Windows::Forms::TreeView; + splitContainer2 = gcnew System::Windows::Forms::SplitContainer; + listView1 = gcnew System::Windows::Forms::ListView; + listView2 = gcnew System::Windows::Forms::ListView; + splitContainer1->SuspendLayout(); + splitContainer2->SuspendLayout(); + SuspendLayout(); + + // + // Basic SplitContainer properties. + // This is a vertical splitter that moves in 10-pixel increments. + // This splitter needs no explicit Orientation property because Vertical is the default. + splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill; + splitContainer1->ForeColor = System::Drawing::SystemColors::Control; + splitContainer1->Location = System::Drawing::Point( 0, 0 ); + splitContainer1->Name = "splitContainer1"; + + // You can drag the splitter no nearer than 30 pixels from the left edge of the container. + splitContainer1->Panel1MinSize = 30; + + // You can drag the splitter no nearer than 20 pixels from the right edge of the container. + splitContainer1->Panel2MinSize = 20; + splitContainer1->Size = System::Drawing::Size( 292, 273 ); + splitContainer1->SplitterDistance = 79; + + // This splitter moves in 10-pixel increments. + splitContainer1->SplitterIncrement = 10; + splitContainer1->SplitterWidth = 6; + + // splitContainer1 is the first control in the tab order. + splitContainer1->TabIndex = 0; + splitContainer1->Text = "splitContainer1"; + + // When the splitter moves, the cursor changes shape. + splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved ); + splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving ); + + // Add a TreeView control to the left panel. + splitContainer1->Panel1->BackColor = System::Drawing::SystemColors::Control; + + // Add a TreeView control to Panel1. + splitContainer1->Panel1->Controls->Add( treeView1 ); + splitContainer1->Panel1->Name = "splitterPanel1"; + + // Controls placed on Panel1 support right-to-left fonts. + splitContainer1->Panel1->RightToLeft = System::Windows::Forms::RightToLeft::Yes; + + // + // Add a SplitContainer to the right panel. + splitContainer1->Panel2->Controls->Add( splitContainer2 ); + splitContainer1->Panel2->Name = "splitterPanel2"; + + // This TreeView control is in Panel1 of splitContainer1. + treeView1->Dock = System::Windows::Forms::DockStyle::Fill; + treeView1->ForeColor = System::Drawing::SystemColors::InfoText; + treeView1->ImageIndex = -1; + treeView1->Location = System::Drawing::Point( 0, 0 ); + treeView1->Name = "treeView1"; + treeView1->SelectedImageIndex = -1; + treeView1->Size = System::Drawing::Size( 79, 273 ); + + // treeView1 is the second control in the tab order. + treeView1->TabIndex = 1; + + // + // Basic SplitContainer properties. + // This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed. + splitContainer2->Dock = System::Windows::Forms::DockStyle::Fill; + + // The top panel remains the same size when the form is resized. + splitContainer2->FixedPanel = System::Windows::Forms::FixedPanel::Panel1; + splitContainer2->Location = System::Drawing::Point( 0, 0 ); + splitContainer2->Name = "splitContainer2"; + + // Create the horizontal splitter. + splitContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal; + splitContainer2->Size = System::Drawing::Size( 207, 273 ); + splitContainer2->SplitterDistance = 125; + splitContainer2->SplitterWidth = 6; + + // splitContainer2 is the third control in the tab order. + splitContainer2->TabIndex = 2; + splitContainer2->Text = "splitContainer2"; + + // + // This splitter panel contains the top ListView control. + splitContainer2->Panel1->Controls->Add( listView1 ); + splitContainer2->Panel1->Name = "splitterPanel3"; + + // This splitter panel contains the bottom ListView control. + splitContainer2->Panel2->Controls->Add( listView2 ); + splitContainer2->Panel2->Name = "splitterPanel4"; + + // This ListView control is in the top panel of splitContainer2. + listView1->Dock = System::Windows::Forms::DockStyle::Fill; + listView1->Location = System::Drawing::Point( 0, 0 ); + listView1->Name = "listView1"; + listView1->Size = System::Drawing::Size( 207, 125 ); + + // listView1 is the fourth control in the tab order. + listView1->TabIndex = 3; + + // This ListView control is in the bottom panel of splitContainer2. + listView2->Dock = System::Windows::Forms::DockStyle::Fill; + listView2->Location = System::Drawing::Point( 0, 0 ); + listView2->Name = "listView2"; + listView2->Size = System::Drawing::Size( 207, 142 ); + + // listView2 is the fifth control in the tab order. + listView2->TabIndex = 4; + + // These are basic properties of the form. + ClientSize = System::Drawing::Size( 292, 273 ); + Controls->Add( splitContainer1 ); + Name = "Form1"; + Text = "Form1"; + splitContainer1->ResumeLayout( false ); + splitContainer2->ResumeLayout( false ); + ResumeLayout( false ); + } + + void splitContainer1_SplitterMoving( System::Object^ /*sender*/, System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ ) + { + + // As the splitter moves, change the cursor type. + ::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert; + } + + void splitContainer1_SplitterMoved( System::Object^ /*sender*/, System::Windows::Forms::SplitterEventArgs^ /*e*/ ) + { + + // When the splitter stops moving, change the cursor back to the default. + ::Cursor::Current = System::Windows::Forms::Cursors::Default; + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp new file mode 100644 index 00000000000..aff3e542a5b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase.CancelCurrentEdit Example/CPP/canceledit.cpp @@ -0,0 +1,161 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace CancelEdit +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::TextBox^ textBox1; + DataView^ myDataView; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 24, 16 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 216, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^formControls = {this->textBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + SetBinding(); + CancelEdit(); + EndEdit(); + } + + // + private: + void CancelEdit() + { + // Gets the CurrencyManager which is returned when the + // data source is a DataView. + BindingManagerBase^ myMgr = dynamic_cast(BindingContext[ myDataView ]); + + // Gets the current row and changes a value. Then cancels the + // edit and thereby discards the changes. + DataRowView^ tempRowView = dynamic_cast(myMgr->Current); + Console::WriteLine( "Original: {0}", tempRowView[ "myCol" ] ); + tempRowView[ "myCol" ] = "These changes will be discarded"; + Console::WriteLine( "Edit: {0}", tempRowView[ "myCol" ] ); + myMgr->CancelCurrentEdit(); + Console::WriteLine( "After CanceCurrentlEdit: {0}", tempRowView[ "myCol" ] ); + } + + void EndEdit() + { + // Gets the CurrencyManager which is returned when the + // data source is a DataView. + BindingManagerBase^ myMgr = dynamic_cast(BindingContext[ myDataView ]); + + // Gets the current row and changes a value. Then ends the + // edit and thereby keeps the changes. + DataRowView^ tempRowView = dynamic_cast(myMgr->Current); + Console::WriteLine( "Original: {0}", tempRowView[ "myCol" ] ); + tempRowView[ "myCol" ] = "These changes will be kept"; + Console::WriteLine( "Edit: {0}", tempRowView[ "myCol" ] ); + myMgr->EndCurrentEdit(); + Console::WriteLine( "After EndCurrentEdit: {0}", tempRowView[ "myCol" ] ); + } + // + + void SetBinding() + { + // Creates a DataView to be used as a data source. Sets the + // myDataView variable, defined in the form, to the DataView. + // Then binds the TextBox control to the DataView. + DataTable^ myTable = gcnew DataTable( "myTable" ); + DataColumn^ myCol = gcnew DataColumn( "myCol" ); + myTable->Columns->Add( myCol ); + DataRow^ tempRow; + tempRow = myTable->NewRow(); + tempRow[ "myCol" ] = "Original Data"; + myTable->Rows->Add( tempRow ); + myDataView = myTable->DefaultView; + textBox1->DataBindings->Add( gcnew Binding( "Text",myDataView,"myCol" ) ); + } + }; +} + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew CancelEdit::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp new file mode 100644 index 00000000000..4186f01de49 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_RemoveAt/CPP/bindingmanagerbase_removeat.cpp @@ -0,0 +1,126 @@ + + +// System::BindingManagerBase::RemoveAt +/* This program demonstrates the 'RemoveAt' method of 'BindingManagerBase' class. +* It creates a 'DataGrid' control and a 'button' control. If Remove button is pressed it deletes +* the selected row from the 'DataGrid' control. +*/ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace WindowsApplication1 +{ + public ref class Form1: public Form + { + private: + Button^ button1; + DataGrid^ dataGrid1; + DataTable^ myDataTable; + + public: + Form1() + { + InitializeComponent(); + MakeDataTableAndDisplay(); + } + + private: + void InitializeComponent() + { + dataGrid1 = gcnew DataGrid; + button1 = gcnew Button; + (dynamic_cast(dataGrid1))->BeginInit(); + SuspendLayout(); + + // Create the 'DataGrid'. + dataGrid1->DataMember = ""; + dataGrid1->Location = Point(32,32); + dataGrid1->Name = "dataGrid1"; + dataGrid1->Size = System::Drawing::Size( 208, 80 ); + dataGrid1->TabIndex = 3; + button1->Location = Point(280,40); + button1->Name = "button1"; + button1->Size = System::Drawing::Size( 96, 23 ); + button1->TabIndex = 1; + button1->Text = "Remove Row"; + button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + ClientSize = System::Drawing::Size( 400, 273 ); + array^temp0 = {dataGrid1,button1}; + Controls->AddRange( temp0 ); + Name = "Form1"; + Text = "Form1"; + (dynamic_cast(dataGrid1))->EndInit(); + ResumeLayout( false ); + } + + // + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + try + { + // Get the 'BindingManagerBase' Object*. + BindingManagerBase^ myBindingManagerBase = BindingContext[ myDataTable ]; + + // Remove the selected row from the grid. + myBindingManagerBase->RemoveAt( myBindingManagerBase->Position ); + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Source ); + MessageBox::Show( ex->Message ); + } + } + // + + void MakeDataTableAndDisplay() + { + // Create new DataTable. + myDataTable = gcnew DataTable( "MyDataTable" ); + DataColumn^ myDataColumn; + DataRow^ myDataRow; + + // Create new 'DataColumn'. + myDataColumn = gcnew DataColumn; + + // Set the 'DataType'. + myDataColumn->DataType = System::Type::GetType( "System::Int32" ); + + // Set the 'ColumnName'. + myDataColumn->ColumnName = "id"; + + // Add the column to the 'DataTable'. + myDataTable->Columns->Add( myDataColumn ); + + // Create second column. + myDataColumn = gcnew DataColumn; + myDataColumn->DataType = Type::GetType( "System::String" ); + myDataColumn->ColumnName = "item"; + myDataTable->Columns->Add( myDataColumn ); + + // Create new DataRow objects and add to DataTable. + for ( int i = 0; i < 10; i++ ) + { + myDataRow = myDataTable->NewRow(); + myDataRow[ "id" ] = i; + myDataRow[ "item" ] = "item {0}",i; + myDataTable->Rows->Add( myDataRow ); + } + dataGrid1->DataSource = myDataTable; + } + }; +} + +int main() +{ + Application::Run( gcnew WindowsApplication1::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp new file mode 100644 index 00000000000..60365a230eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BindingManagerBase_Suspend_Resume_Binding/CPP/bindingmanagerbase_suspend_resume_binding.cpp @@ -0,0 +1,209 @@ + + +// System::BindingManagerBase::SuspendBinding +// System::BindingManagerBase::ResumeBinding +/* This program demonstrates 'SuspendBinding' and 'ResumeBinding' method of 'BindingManagerBase'class. +It creates a 'DataTable'and two 'TextBox' controls. The 'Text' property of the two 'TextBox' is +binded with the two columns of the 'DataTable'. If 'SuspendBinding' button is pressed it +suspend the Data Binding between TextBoxes and a 'DataTable' and if ResumeButton is pressed it +resumes Data Binding. +*/ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Globalization; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + Button^ button1; + Button^ button2; + TextBox^ textBox1; + TextBox^ textBox2; + BindingManagerBase^ myBindingManager; + Button^ button3; + Button^ button4; + Label^ label1; + Label^ label2; + DataSet^ myDataSet; + +public: + Form1() + { + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +private: + void InitializeComponent() + { + button1 = gcnew Button; + button2 = gcnew Button; + button3 = gcnew Button; + textBox2 = gcnew TextBox; + textBox1 = gcnew TextBox; + button4 = gcnew Button; + label1 = gcnew Label; + label2 = gcnew Label; + SuspendLayout(); + button1->Location = Point(120,8); + button1->Name = "button1"; + button1->Size = System::Drawing::Size( 64, 24 ); + button1->TabIndex = 0; + button1->Text = "<"; + button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + button2->Location = Point(184,8); + button2->Name = "button2"; + button2->Size = System::Drawing::Size( 64, 24 ); + button2->TabIndex = 1; + button2->Text = ">"; + button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + button3->Location = Point(96,112); + button3->Name = "button3"; + button3->TabIndex = 4; + button3->Text = "Suspend"; + button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + textBox2->Location = Point(200,72); + textBox2->Name = "textBox2"; + textBox2->Size = System::Drawing::Size( 150, 20 ); + textBox2->TabIndex = 3; + textBox2->Text = ""; + textBox1->Location = Point(40,72); + textBox1->Name = "textBox1"; + textBox1->Size = System::Drawing::Size( 150, 20 ); + textBox1->TabIndex = 2; + textBox1->Text = ""; + button4->Location = Point(192,112); + button4->Name = "button4"; + button4->TabIndex = 5; + button4->Text = "Resume"; + button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); + label1->Location = Point(48,48); + label1->Name = "label1"; + label1->TabIndex = 6; + label1->Text = "Customer Name"; + label2->Location = Point(216,48); + label2->Name = "label2"; + label2->TabIndex = 7; + label2->Text = "CustomerID"; + ClientSize = System::Drawing::Size( 450, 200 ); + array^temp0 = {label2,label1,button4,button3,button1,button2,textBox1,textBox2}; + Controls->AddRange( temp0 ); + Name = "Form1"; + Text = "Binding Sample"; + ResumeLayout( false ); + } + + void SetUp() + { + MakeDataSet(); + BindControls(); + } + +protected: + void BindControls() + { + textBox1->DataBindings->Add( gcnew Binding( "Text",myDataSet,"customers.custName" ) ); + textBox2->DataBindings->Add( gcnew Binding( "Text",myDataSet,"customers.custID" ) ); + myBindingManager = BindingContext[ myDataSet, "Customers" ]; + } + +private: + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Go to the previous item in the Customer list. + myBindingManager->Position = myBindingManager->Position - 1; + } + +private: + void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Go to the next item in the Customer list. + myBindingManager->Position = myBindingManager->Position + 1; + } + +private: + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ myCustomerColumnID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); + myCustomerTable->Columns->Add( myCustomerColumnID ); + myCustomerTable->Columns->Add( myCustomerName ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( myCustomerTable ); + DataRow^ newRow1; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = myCustomerTable->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + myCustomerTable->Rows->Add( newRow1 ); + } + myCustomerTable->Rows[ 0 ][ "custName" ] = "Alpha"; + myCustomerTable->Rows[ 1 ][ "custName" ] = "Beta"; + myCustomerTable->Rows[ 2 ][ "custName" ] = "Omega"; + UniqueConstraint^ idKeyRestraint = gcnew UniqueConstraint( myCustomerColumnID ); + myCustomerTable->Constraints->Add( idKeyRestraint ); + myDataSet->EnforceConstraints = true; + } + + // + void button3_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + BindingManagerBase^ myBindingManager1 = BindingContext[ myDataSet, "Customers" ]; + myBindingManager1->SuspendBinding(); + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Source ); + MessageBox::Show( ex->Message ); + } + } + // + + // + void button4_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + BindingManagerBase^ myBindingManager2 = BindingContext[ myDataSet, "Customers" ]; + myBindingManager2->ResumeBinding(); + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Source ); + MessageBox::Show( ex->Message ); + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp b/snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp new file mode 100644 index 00000000000..67fa8b50cfd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Binding_Editable/CPP/binding_editable.cpp @@ -0,0 +1,412 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::Collections; +using namespace System::ComponentModel; + +namespace IBindingList_Doc +{ + + ref class Customer; + + // sample for IBindingList + // + public ref class CustomersList: public CollectionBase, public IBindingList + { + private: + ListChangedEventArgs^ resetEvent; + ListChangedEventHandler^ onListChanged; + virtual event ListChangedEventHandler^ ListChanged; + + public: + property bool AllowEdit + { + // Implements IBindingList. + virtual bool get() sealed + { + return true; + } + } + + virtual property bool AllowNew + { + bool get() + { + return true; + } + } + + property bool AllowRemove + { + virtual bool get() + { + return true; + } + + } + + property bool SupportsChangeNotification + { + virtual bool get() + { + return true; + } + + } + + property bool SupportsSearching + { + virtual bool get() + { + return true; + } + + } + + property bool SupportsSorting + { + virtual bool get() + { + return true; + } + + } + + // Methods. + virtual Object^ AddNew() + { + Customer^ c = gcnew Customer( this->Count->ToString() ); + List->Add( c ); + return c; + } + + + property bool IsSorted + { + + // Unsupported properties. + virtual bool get() + { + throw gcnew NotSupportedException; + return false; + } + + } + + property ListSortDirection SortDirection + { + virtual ListSortDirection get() + { + throw gcnew NotSupportedException; + return ListSortDirection::Ascending; + } + + } + + property PropertyDescriptor^ SortProperty + { + virtual PropertyDescriptor^ get() + { + throw gcnew NotSupportedException; + return nullptr; + } + + } + + // Unsupported Methods. + virtual void AddIndex( PropertyDescriptor^ property ) + { + throw gcnew NotSupportedException; + } + + virtual void ApplySort( PropertyDescriptor^ property, ListSortDirection direction ) + { + throw gcnew NotSupportedException; + } + + virtual int Find( PropertyDescriptor^ property, Object^ key ) + { + throw gcnew NotSupportedException; + return 0; + } + + virtual void RemoveIndex( PropertyDescriptor^ property ) + { + throw gcnew NotSupportedException; + } + + virtual void RemoveSort() + { + throw gcnew NotSupportedException; + } + + + // Worker functions to populate the list with data. + static Customer^ ReadCustomer1() + { + Customer^ cust = gcnew Customer( "536-45-1245" ); + cust->FirstName = "Jo"; + cust->LastName = "Brown"; + return cust; + } + + static Customer^ ReadCustomer2() + { + Customer^ cust = gcnew Customer( "246-12-5645" ); + cust->FirstName = "Robert"; + cust->LastName = "Brown"; + return cust; + } + + protected: + virtual void OnListChanged( ListChangedEventArgs^ ev ) + { + if ( onListChanged != nullptr ) + { + onListChanged( this, ev ); + } + } + + virtual void OnClear() override + { + List->Clear(); + } + + virtual void OnClearComplete() override + { + OnListChanged( resetEvent ); + } + + virtual void OnInsertComplete( int index, Object^ value ) override + { + Customer^ c = safe_cast(value); + c->Parent = this; + OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemAdded,index ) ); + } + + virtual void OnRemoveComplete( int index, Object^ value ) override + { + Customer^ c = safe_cast(value); + c->Parent = this; + OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemDeleted,index ) ); + } + + virtual void OnSetComplete( int index, Object^ oldValue, Object^ newValue ) override + { + if ( oldValue != newValue ) + { + Customer^ oldcust = safe_cast(oldValue); + Customer^ newcust = safe_cast(newValue); + oldcust->Parent = 0; + newcust->Parent = this; + OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemAdded,index ) ); + } + } + + public: + + // Constructor + CustomersList() + { + resetEvent = gcnew ListChangedEventArgs( ListChangedType::Reset,-1 ); + } + + void LoadCustomers() + { + IList^ l = static_cast(this); + l->Add( ReadCustomer1() ); + l->Add( ReadCustomer2() ); + OnListChanged( resetEvent ); + } + + property Object^ Item [int] + { + Object^ get( int index ) + { + return static_cast(List->Item[ index ]); + } + + void set( int index, Object^ value ) + { + List->Item[ index ] = value; + } + + } + int Add( Customer^ value ) + { + return List->Add( value ); + } + + Customer^ AddNew() + { + return safe_cast(static_cast(this)->AddNew()); + } + + void Remove( Customer^ value ) + { + List->Remove( value ); + } + + internal: + + // Called by Customer when it changes. + void CustomerChanged( Customer^ cust ) + { + int index = List->IndexOf( cust ); + OnListChanged( gcnew ListChangedEventArgs( ListChangedType::ItemChanged,index ) ); + } + + }; + // + + // sample for IEditableObject + // + public ref class Customer: public IEditableObject + { + private: + ref struct CustomerData + { + internal: + String^ id; + String^ firstName; + String^ lastName; + }; + + internal: + CustomersList^ parent; + CustomerData^ custData; + CustomerData^ backupData; + bool inTxn; + + // Implements IEditableObject + public: + virtual void BeginEdit() + { + Console::WriteLine( "Start BeginEdit" ); + if ( !inTxn ) + { + this->backupData = custData; + inTxn = true; + Console::WriteLine( "BeginEdit - {0}", this->backupData->lastName ); + } + + Console::WriteLine( "End BeginEdit" ); + } + + virtual void CancelEdit() + { + Console::WriteLine( "Start CancelEdit" ); + if ( inTxn ) + { + this->custData = backupData; + inTxn = false; + Console::WriteLine( "CancelEdit - {0}", this->custData->lastName ); + } + + Console::WriteLine( "End CancelEdit" ); + } + + virtual void EndEdit() + { + Console::WriteLine( "Start EndEdit{0}{1}", this->custData->id, this->custData->lastName ); + if ( inTxn ) + { + backupData = gcnew CustomerData; + inTxn = false; + Console::WriteLine( "Done EndEdit - {0}{1}", this->custData->id, this->custData->lastName ); + } + + Console::WriteLine( "End EndEdit" ); + } + + + public: + + Customer( String^ ID ) + { + this->custData = gcnew CustomerData; + this->custData->id = ID; + this->custData->firstName = ""; + this->custData->lastName = ""; + inTxn = false; + } + + property String^ ID + { + String^ get() + { + return this->custData->id; + } + + } + + property String^ FirstName + { + String^ get() + { + return this->custData->firstName; + } + + void set( String^ value ) + { + this->custData->firstName = value; + this->OnCustomerChanged(); + } + + } + + property String^ LastName + { + String^ get() + { + return this->custData->lastName; + } + + void set( String^ value ) + { + this->custData->lastName = value; + this->OnCustomerChanged(); + } + + } + + internal: + + property CustomersList^ Parent + { + CustomersList^ get() + { + return parent; + } + + void set( CustomersList^ value ) + { + parent = value; + } + + } + + void OnCustomerChanged() + { + if (!inTxn && Parent != nullptr) + { + Parent->CustomerChanged(this); + } + } + + public: + virtual String^ ToString() override + { + StringWriter^ sb = gcnew StringWriter; + sb->Write( this->FirstName ); + sb->Write( " " ); + sb->Write( this->LastName ); + return sb->ToString(); + } + }; + // + // end of Customer class - sample for IEditableObject +} diff --git a/snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp b/snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp new file mode 100644 index 00000000000..22a3876b77e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BindingsCollectionItem Property/CPP/bindingscollectionthis.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Test +{ +private: + TextBox^ textBox1; + Test() + { + textBox1 = gcnew TextBox; + } + + // + void PrintValue() + { + ControlBindingsCollection^ myControlBindings; + myControlBindings = textBox1->DataBindings; + + // Get the Binding for the Text property. + Binding^ myBinding = myControlBindings[ "Text" ]; + + // Assuming the data source is a DataTable. + DataRowView^ drv; + drv = dynamic_cast(myBinding->BindingManagerBase->Current); + + // Assuming a column named S"custName" exists, print the value. + Console::WriteLine( drv[ "custName" ] ); + } + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp b/snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp new file mode 100644 index 00000000000..ea2d15cac0a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BitmapEditorExample/CPP/usercontrol1.cpp @@ -0,0 +1,65 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Data; +using namespace System::Windows::Forms; + +namespace BitmapEditorExample +{ + public ref class UserControl1: public System::Windows::Forms::UserControl + { + private: + System::ComponentModel::Container^ components; + + public: + + property Bitmap^ testBitmap + { + + // + [EditorAttribute(System::Drawing::Design::BitmapEditor::typeid,System::Drawing::Design::UITypeEditor::typeid)] + Bitmap^ get() + { + return testBmp; + } + + void set( Bitmap^ value ) + { + testBmp = value; + } + } + + private: + Bitmap^ testBmp; + // + + public: + + UserControl1() + { + InitializeComponent(); + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + components = gcnew System::ComponentModel::Container; + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp b/snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp new file mode 100644 index 00000000000..04cc454c6d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BufferedGraphicsExample/CPP/bufferingtest.cpp @@ -0,0 +1,176 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace BufferingExample +{ + public ref class BufferingExample: public Form + { + private: + BufferedGraphicsContext^ context; + BufferedGraphics^ grafx; + Byte bufferingMode; + array^bufferingModeStrings; + System::Windows::Forms::Timer^ timer1; + Byte count; + + public: + BufferingExample() + : Form() + { + array^tempStrings = {"Draw to Form without OptimizedDoubleBufferring control style","Draw to Form using OptimizedDoubleBuffering control style","Draw to HDC for form"}; + bufferingModeStrings = tempStrings; + + // Configure the Form for this example. + this->Text = "User double buffering"; + this->MouseDown += gcnew MouseEventHandler( this, &BufferingExample::MouseDownHandler ); + this->Resize += gcnew EventHandler( this, &BufferingExample::OnResize ); + this->SetStyle( static_cast(ControlStyles::AllPaintingInWmPaint | ControlStyles::UserPaint), true ); + + // Configure a timer to draw graphics updates. + timer1 = gcnew System::Windows::Forms::Timer; + timer1->Interval = 200; + timer1->Tick += gcnew EventHandler( this, &BufferingExample::OnTimer ); + bufferingMode = 2; + count = 0; + + // Retrieves the BufferedGraphicsContext for the + // current application domain. + context = BufferedGraphicsManager::Current; + + // Sets the maximum size for the primary graphics buffer + // of the buffered graphics context for the application + // domain. Any allocation requests for a buffer larger + // than this will create a temporary buffered graphics + // context to host the graphics buffer. + context->MaximumBuffer = System::Drawing::Size( this->Width + 1, this->Height + 1 ); + + // Allocates a graphics buffer the size of this form + // using the pixel format of the Graphics created by + // the Form.CreateGraphics() method, which returns a + // Graphics object that matches the pixel format of the form. + grafx = context->Allocate( this->CreateGraphics(), Rectangle(0,0,this->Width,this->Height) ); + + // Draw the first frame to the buffer. + DrawToBuffer( grafx->Graphics ); + } + + private: + void MouseDownHandler( Object^ /*sender*/, MouseEventArgs^ e ) + { + if ( e->Button == ::MouseButtons::Right ) + { + // Cycle the buffering mode. + if ( ++bufferingMode > 2 ) + bufferingMode = 0; + + // If the previous buffering mode used + // the OptimizedDoubleBuffering ControlStyle, + // disable the control style. + if ( bufferingMode == 1 ) + this->SetStyle( ControlStyles::OptimizedDoubleBuffer, true ); + + // If the current buffering mode uses + // the OptimizedDoubleBuffering ControlStyle, + // enabke the control style. + if ( bufferingMode == 2 ) + this->SetStyle( ControlStyles::OptimizedDoubleBuffer, false ); + + // Cause the background to be cleared and redraw. + count = 6; + DrawToBuffer( grafx->Graphics ); + this->Refresh(); + } + else + { + + // Toggle whether the redraw timer is active. + if ( timer1->Enabled ) + timer1->Stop(); + else + timer1->Start(); + } + } + + private: + void OnTimer( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Draw randomly positioned ellipses to the buffer. + DrawToBuffer( grafx->Graphics ); + + // If in bufferingMode 2, draw to the form's HDC. + if ( bufferingMode == 2 ) + + // Render the graphics buffer to the form's HDC. + grafx->Render( Graphics::FromHwnd( this->Handle ) ); + // If in bufferingMode 0 or 1, draw in the paint method. + else + + // If in bufferingMode 0 or 1, draw in the paint method. + this->Refresh(); + } + + void OnResize( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Re-create the graphics buffer for a new window size. + context->MaximumBuffer = System::Drawing::Size( this->Width + 1, this->Height + 1 ); + if ( grafx != nullptr ) + { + delete grafx; + grafx = nullptr; + } + + grafx = context->Allocate( this->CreateGraphics(), Rectangle(0,0,this->Width,this->Height) ); + + // Cause the background to be cleared and redraw. + count = 6; + DrawToBuffer( grafx->Graphics ); + this->Refresh(); + } + + void DrawToBuffer( Graphics^ g ) + { + // Clear the graphics buffer every five updates. + if ( ++count > 5 ) + { + count = 0; + grafx->Graphics->FillRectangle( Brushes::Black, 0, 0, this->Width, this->Height ); + } + + // Draw randomly positioned and colored ellipses. + Random^ rnd = gcnew Random; + for ( int i = 0; i < 20; i++ ) + { + int px = rnd->Next( 20, this->Width - 40 ); + int py = rnd->Next( 20, this->Height - 40 ); + g->DrawEllipse( gcnew Pen( Color::FromArgb( rnd->Next( 0, 255 ), rnd->Next( 0, 255 ), rnd->Next( 0, 255 ) ), 1.0f ), px, py, px + rnd->Next( 0, this->Width - px - 20 ), py + rnd->Next( 0, this->Height - py - 20 ) ); + } + + // Draw information strings. + g->DrawString( String::Format( "Buffering Mode: {0}", bufferingModeStrings[ bufferingMode ] ), gcnew System::Drawing::Font( "Arial",8 ), Brushes::White, 10, 10 ); + g->DrawString( "Right-click to cycle buffering mode", gcnew System::Drawing::Font( "Arial",8 ), Brushes::White, 10, 22 ); + g->DrawString( "Left-click to toggle timed display refresh", gcnew System::Drawing::Font( "Arial",8 ), Brushes::White, 10, 34 ); + } + + protected: + virtual void OnPaint( PaintEventArgs^ e ) override + { + grafx->Render( e->Graphics ); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew BufferingExample::BufferingExample ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp b/snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp new file mode 100644 index 00000000000..93222199cac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/BufferingExamples/CPP/bufferingexamples.cpp @@ -0,0 +1,76 @@ +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +public ref class BufferingExamples: public Form +{ +private: + BufferedGraphicsContext^ appDomainBufferedGraphicsContext; + BufferedGraphics^ grafx; + +public: + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + BufferingExamples() : Form() + { + // + // Retrieves the BufferedGraphicsContext for the + // current application domain. + BufferedGraphicsContext^ appDomainGraphicsContext = + BufferedGraphicsManager::Current; + // + + appDomainGraphicsContext->MaximumBuffer = System::Drawing::Size( 400, 400 ); + appDomainBufferedGraphicsContext = BufferedGraphicsManager::Current; + + // + // Sets the maximum size for the graphics buffer + // of the buffered graphics context. Any allocation + // requests for a buffer larger than this will create + // a temporary buffered graphics context to host + // the graphics buffer. + appDomainBufferedGraphicsContext->MaximumBuffer = System::Drawing::Size( 400, 400 ); + // + + // + // Allocates a graphics buffer using the pixel format + // of the specified Graphics object. + grafx = appDomainBufferedGraphicsContext->Allocate( this->CreateGraphics(), + Rectangle( 0, 0, 400, 400 ) ); + // + + // + // Allocates a graphics buffer using the pixel format + // of the specified handle to a device context. + grafx = appDomainBufferedGraphicsContext->Allocate( this->Handle, + Rectangle( 0, 0, 400, 400 ) ); + // + } + + // +private: + void RenderToGraphics( Graphics^ g ) + { + grafx->Render( g ); + } + // + + // +private: + void RenderToDeviceContextHandle( IntPtr hDC ) + { + grafx->Render( hDC ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew BufferingExamples ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp b/snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp new file mode 100644 index 00000000000..27ec84835c7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ButtonState/CPP/buttonstate1.cpp @@ -0,0 +1,49 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + Button^ button1; + Button^ button2; + +public: + Form1() + { + button1 = gcnew Button; + button2 = gcnew Button; + this->button2->Location = Point(0,button1->Height + 10); + this->Click += gcnew EventHandler( this, &Form1::button2_Click ); + this->Controls->Add( this->button1 ); + this->Controls->Add( this->button2 ); + } + + +private: + + // + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Draws a flat button on button1. + ControlPaint::DrawButton( System::Drawing::Graphics::FromHwnd( button1->Handle ), 0, 0, button1->Width, button1->Height, ButtonState::Flat ); + } + + // +}; + + +[STAThread] +void main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp new file mode 100644 index 00000000000..830ffade03e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ByteViewerExample/CPP/form1.cpp @@ -0,0 +1,149 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +public ref class ByteViewerForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::ComponentModel::Design::ByteViewer^ byteviewer; + +public: + ByteViewerForm() + { + // Initialize the controls other than the ByteViewer. + InitializeForm(); + + // Initialize the ByteViewer. + byteviewer = gcnew ByteViewer; + byteviewer->Location = Point(8,46); + byteviewer->Size = System::Drawing::Size( 600, 338 ); + byteviewer->Anchor = static_cast(AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Top); + byteviewer->SetBytes( (array^)Array::CreateInstance( Byte::typeid, 0 ) ); + this->Controls->Add( byteviewer ); + } + +private: + + // Show a file selection dialog and cues the byte viewer to + // load the data in a selected file. + void loadBytesFromFile( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + OpenFileDialog^ ofd = gcnew OpenFileDialog; + if ( ofd->ShowDialog() != ::DialogResult::OK ) + return; + + byteviewer->SetFile( ofd->FileName ); + } + + // Clear the bytes in the byte viewer. + void clearBytes( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + byteviewer->SetBytes( (array^)Array::CreateInstance( Byte::typeid, 0 ) ); + } + + // Changes the display mode of the byte viewer according to the + // Text property of the RadioButton sender control. + void changeByteMode( Object^ sender, EventArgs^ /*e*/ ) + { + System::Windows::Forms::RadioButton^ rbutton = dynamic_cast(sender); + DisplayMode mode; + if ( rbutton->Text->Equals( "ANSI" ) ) + { + mode = DisplayMode::Ansi; + } + else + if ( rbutton->Text->Equals( "Hex" ) ) + { + mode = DisplayMode::Hexdump; + } + else + if ( rbutton->Text->Equals( "Unicode" ) ) + { + mode = DisplayMode::Unicode; + } + else + { + mode = DisplayMode::Auto; + } + + // Sets the display mode. + byteviewer->SetDisplayMode( mode ); + } + + void InitializeForm() + { + this->SuspendLayout(); + this->ClientSize = System::Drawing::Size( 680, 440 ); + this->MinimumSize = System::Drawing::Size( 660, 400 ); + this->Size = System::Drawing::Size( 680, 440 ); + this->Name = "Byte Viewer Form"; + this->Text = "Byte Viewer Form"; + this->button1 = gcnew System::Windows::Forms::Button; + this->button1->Location = System::Drawing::Point( 8, 8 ); + this->button1->Size = System::Drawing::Size( 190, 23 ); + this->button1->Name = "button1"; + this->button1->Text = "Set Bytes From File..."; + this->button1->TabIndex = 0; + this->button1->Click += gcnew EventHandler( this, &ByteViewerForm::loadBytesFromFile ); + this->Controls->Add( this->button1 ); + this->button2 = gcnew System::Windows::Forms::Button; + this->button2->Location = System::Drawing::Point( 198, 8 ); + this->button2->Size = System::Drawing::Size( 190, 23 ); + this->button2->Name = "button2"; + this->button2->Text = "Clear Bytes"; + this->button2->Click += gcnew EventHandler( this, &ByteViewerForm::clearBytes ); + this->button2->TabIndex = 1; + this->Controls->Add( this->button2 ); + System::Windows::Forms::GroupBox^ group = gcnew System::Windows::Forms::GroupBox; + group->Location = Point(418,3); + group->Size = System::Drawing::Size( 220, 36 ); + group->Text = "Display Mode"; + this->Controls->Add( group ); + System::Windows::Forms::RadioButton^ rbutton1 = gcnew System::Windows::Forms::RadioButton; + rbutton1->Location = Point(6,15); + rbutton1->Size = System::Drawing::Size( 46, 16 ); + rbutton1->Text = "Auto"; + rbutton1->Checked = true; + rbutton1->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); + group->Controls->Add( rbutton1 ); + System::Windows::Forms::RadioButton^ rbutton2 = gcnew System::Windows::Forms::RadioButton; + rbutton2->Location = Point(54,15); + rbutton2->Size = System::Drawing::Size( 50, 16 ); + rbutton2->Text = "ANSI"; + rbutton2->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); + group->Controls->Add( rbutton2 ); + System::Windows::Forms::RadioButton^ rbutton3 = gcnew System::Windows::Forms::RadioButton; + rbutton3->Location = Point(106,15); + rbutton3->Size = System::Drawing::Size( 46, 16 ); + rbutton3->Text = "Hex"; + rbutton3->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); + group->Controls->Add( rbutton3 ); + System::Windows::Forms::RadioButton^ rbutton4 = gcnew System::Windows::Forms::RadioButton; + rbutton4->Location = Point(152,15); + rbutton4->Size = System::Drawing::Size( 64, 16 ); + rbutton4->Text = "Unicode"; + rbutton4->Click += gcnew EventHandler( this, &ByteViewerForm::changeByteMode ); + group->Controls->Add( rbutton4 ); + this->ResumeLayout( false ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew ByteViewerForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp new file mode 100644 index 00000000000..176a868248a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CategoryNameCollectionExample/CPP/toolboxcategorynamescontrol.cpp @@ -0,0 +1,81 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Data; +using namespace System::Windows::Forms; + +namespace ToolboxCategoryNamesControl +{ + public ref class ToolboxCategoryNamesControl: public System::Windows::Forms::UserControl + { + private: + System::Drawing::Design::IToolboxService^ toolboxService; + System::Drawing::Design::CategoryNameCollection^ categoryNames; + + public: + ToolboxCategoryNamesControl() + { + this->BackColor = System::Drawing::Color::Beige; + this->Name = "Category Names Display Control"; + this->Size = System::Drawing::Size( 264, 200 ); + } + + property System::ComponentModel::ISite^ Site + { + // Obtain or reset IToolboxService^ reference on each siting of control. + virtual System::ComponentModel::ISite^ get() override + { + return __super::Site; + } + + virtual void set( System::ComponentModel::ISite^ value ) override + { + __super::Site = value; + + // If the component was sited, attempt to obtain + // an IToolboxService^ instance. + if ( __super::Site != nullptr ) + { + toolboxService = dynamic_cast(this->GetService( IToolboxService::typeid )); + + // If an IToolboxService* was located, update the category list. + if ( toolboxService != nullptr ) + categoryNames = toolboxService->CategoryNames; + } + else + toolboxService = nullptr; + } + } + + protected: + [System::Security::Permissions::PermissionSetAttribute(System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + if ( categoryNames != nullptr ) + { + e->Graphics->DrawString( "IToolboxService category names list:", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 10, 10 ); + + // + // categoryNames is a CategoryNameCollection obtained from + // the IToolboxService*. CategoryNameCollection is a read-only + // String* collection. + // Output each category name in the CategoryNameCollection. + for ( int i = 0; i < categoryNames->Count; i++ ) + e->Graphics->DrawString( categoryNames[ i ], gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, (float)10, (float)24 + (10 * i) ); + // + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp new file mode 100644 index 00000000000..6aa493f9139 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CheckedListBox/CPP/source.cpp @@ -0,0 +1,163 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::CheckedListBox^ checkedListBox1; + System::Windows::Forms::Button^ WhatIsChecked; + System::Windows::Forms::Button^ CheckEveryOther; + bool insideCheckEveryOther; + +public: + Form1() + { + + // Required for Windows Form Designer support + InitializeComponent(); + } + + +private: + + /// Required method for Designer support. + void InitializeComponent() + { + this->checkedListBox1 = gcnew System::Windows::Forms::CheckedListBox; + this->WhatIsChecked = gcnew System::Windows::Forms::Button; + this->CheckEveryOther = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // checkedListBox1 + array^objectArray = {"one","two","three","four","five","six","seven","eight","nine","ten"}; + this->checkedListBox1->Items->AddRange( objectArray ); + this->checkedListBox1->Location = System::Drawing::Point( 10, 25 ); + this->checkedListBox1->Name = "checkedListBox1"; + this->checkedListBox1->Size = System::Drawing::Size( 158, 139 ); + this->checkedListBox1->TabIndex = 0; + this->checkedListBox1->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler( this, &Form1::checkedListBox1_ItemCheck ); + + // WhatIsChecked* this->WhatIsChecked::Location = new System::Drawing::Point(178, 27); + this->WhatIsChecked->Name = "WhatIsChecked"; + this->WhatIsChecked->Size = System::Drawing::Size( 106, 23 ); + this->WhatIsChecked->TabIndex = 1; + this->WhatIsChecked->Text = "What is checked?"; + this->WhatIsChecked->Click += gcnew System::EventHandler( this, &Form1::WhatIsChecked_Click ); + + // CheckEveryOther* this->CheckEveryOther::Location = new System::Drawing::Point(178, 59); + this->CheckEveryOther->Name = "CheckEveryOther"; + this->CheckEveryOther->Size = System::Drawing::Size( 106, 23 ); + this->CheckEveryOther->TabIndex = 2; + this->CheckEveryOther->Text = "Check every other"; + this->CheckEveryOther->Click += gcnew System::EventHandler( this, &Form1::CheckEveryOther_Click ); + + this->ClientSize = System::Drawing::Size( 303, 182 ); + array^controlArray = {this->CheckEveryOther,this->WhatIsChecked,this->checkedListBox1}; + this->Controls->AddRange( controlArray ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // + void WhatIsChecked_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Display in a message box all the items that are checked. + // First show the index and check state of all selected items. + IEnumerator^ myEnum1 = checkedListBox1->CheckedIndices->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Int32 indexChecked = *safe_cast(myEnum1->Current); + + // The indexChecked variable contains the index of the item. + MessageBox::Show( String::Concat( "Index#: ", indexChecked, ", is checked. Checked state is: ", checkedListBox1->GetItemCheckState( indexChecked ), "." ) ); + } + + + // Next show the Object* title and check state for each item selected. + IEnumerator^ myEnum2 = checkedListBox1->CheckedItems->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + Object^ itemChecked = safe_cast(myEnum2->Current); + + // Use the IndexOf method to get the index of an item. + MessageBox::Show( String::Concat( "Item with title: \"", itemChecked, "\", is checked. Checked state is: ", checkedListBox1->GetItemCheckState( checkedListBox1->Items->IndexOf( itemChecked ) ), "." ) ); + } + } + + + // + // + // + void CheckEveryOther_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Cycle through every item and check every other. + // Set flag to true to know when this code is being executed. Used in the ItemCheck + // event handler. + insideCheckEveryOther = true; + for ( int i = 0; i < checkedListBox1->Items->Count; i++ ) + { + + // For every other item in the list, set as checked. + if ( (i % 2) == 0 ) + { + + // But for each other item that is to be checked, set as being in an + // indeterminate checked state. + if ( (i % 4) == 0 ) + checkedListBox1->SetItemCheckState( i, CheckState::Indeterminate ); + else + checkedListBox1->SetItemChecked( i, true ); + } + + } + insideCheckEveryOther = false; + } + + + // + void checkedListBox1_ItemCheck( Object^ /*sender*/, ItemCheckEventArgs^ e ) + { + + // An item in the CheckedListBox is being checked or unchecked. + // Set the NewValue based upon the CurrentValue to allow for a tri-state checking. + // If the ItemCheck event is due to the code in CheckEveryOther, + // then exit the function. + if ( insideCheckEveryOther ) + return; + + if ( e->CurrentValue == CheckState::Unchecked ) + e->NewValue = CheckState::Indeterminate; + else + if ( e->CurrentValue == CheckState::Indeterminate ) + e->NewValue = CheckState::Checked; + else + if ( e->CurrentValue == CheckState::Checked ) + e->NewValue = CheckState::Unchecked; + } + + // +}; + + +// The main entry point for the application. + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp b/snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp new file mode 100644 index 00000000000..aa0feeca2ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CheckoutExceptionExample/CPP/checkoutexceptionexample.cpp @@ -0,0 +1,19 @@ +#using + +using namespace System; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class CheckoutExceptionExample + { + public: + CheckoutExceptionExample() + { + // + // Throws a checkout exception with a message and error code. + throw gcnew CheckoutException( "This is an example exception", 0 ); + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp new file mode 100644 index 00000000000..8fc137e80ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application Example/CPP/source.cpp @@ -0,0 +1,71 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing; + +/// +/// Summary for Form1 +/// +/// WARNING: If you change the name of this class, you will need to change the +/// 'Resource File Name' property for the managed resource compiler tool +/// associated with all .resx files this class depends on. Otherwise, +/// the designers will not be able to interact properly with localized +/// resources associated with this form. +/// +// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + Button^ button1; + ListBox^ listBox1; + +public: + Form1() + { + button1 = gcnew Button; + button1->Left = 200; + button1->Text = "Exit"; + button1->Click += gcnew EventHandler( this, &Form1::button1_Click ); + listBox1 = gcnew ListBox; + this->Controls->Add( button1 ); + this->Controls->Add( listBox1 ); + } + +private: + void Form1::button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + int count = 1; + + // Check to see whether the user wants to exit + // the application. If not, add a number to the list box. + while ( MessageBox::Show( "Exit application?", "", MessageBoxButtons::YesNo ) == ::DialogResult::No ) + { + listBox1->Items->Add( count ); + count += 1; + } + + + // The user wants to exit the application. + // Close everything down. + Application::Exit(); + } + +}; + +int main() +{ + + // Starts the application. + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp new file mode 100644 index 00000000000..4c09461c9bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CompanyName Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + + // +private: + void PrintCompanyName() + { + textBox1->Text = String::Format( "The company name is: {0}", + Application::CompanyName ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp new file mode 100644 index 00000000000..ce852ab0635 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentCulture Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + + // +private: + void PrintCurrentCulture() + { + textBox1->Text = "The current culture is: {0}", + Application::CurrentCulture->EnglishName; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp new file mode 100644 index 00000000000..a7ed064052e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.CurrentInputLanguage Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + + // +private: + void PrintCurrentInputLanguage() + { + textBox1->Text = "The current input language is: {0}", + Application::CurrentInputLanguage->Culture->EnglishName; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp new file mode 100644 index 00000000000..f5f69d94257 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.Exit Example/CPP/source.cpp @@ -0,0 +1,50 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ listBox1; + + // +public: + static void main() + { + // Starts the application. + Application::Run( gcnew Form1 ); + } + +private: + void button1_Click( Object^ sender, System::EventArgs^ e ) + { + // Populates a list box with three numbers. + int i = 3; + for ( int j = 1; j <= i; j++ ) + { + listBox1->Items->Add( j ); + } + + /* Determines whether the user wants to exit the application. + * If not, adds another number to the list box. */ + while ( MessageBox::Show( "Exit application?", "", + MessageBoxButtons::YesNo ) == ::DialogResult::No ) + { + // Increments the counter ands add the number to the list box. + i++; + listBox1->Items->Add( i ); + } + + // The user wants to exit the application. Close everything down. + Application::Exit(); + } + // +}; + +int main() +{ + Form1::main(); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp new file mode 100644 index 00000000000..d297e3b6161 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductName Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + + // +private: + void PrintProductName() + { + textBox1->Text = "The product name is: {0}", + Application::ProductName; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp new file mode 100644 index 00000000000..de18bd7712c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ProductVersion Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + + // +private: + void PrintProductVersion() + { + textBox1->Text = "The product version is: {0}", + Application::ProductVersion; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp new file mode 100644 index 00000000000..eb9a64cc33d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.RemoveMessageFilter Example/CPP/source.cpp @@ -0,0 +1,40 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + +public: + + // + // Creates a message filter. + ref class TestMessageFilter: public IMessageFilter + { + public: + [SecurityPermission(SecurityAction::LinkDemand, Flags = SecurityPermissionFlag::UnmanagedCode)] + virtual bool PreFilterMessage( Message % m ) + { + + // Blocks all the messages relating to the left mouse button. + if ( m.Msg >= 513 && m.Msg <= 515 ) + { + Console::WriteLine( "Processing the messages : {0}", m.Msg ); + return true; + } + + return false; + } + + }; + + // +}; + + diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp new file mode 100644 index 00000000000..c1980fb9e52 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.StartupPath Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ textBox1; + + // +private: + void PrintStartupPath() + { + textBox1->Text = String::Concat( "The path for the executable file", + " that started the application is: ", Application::StartupPath ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp new file mode 100644 index 00000000000..b3bad278043 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Application.ThreadException Example/CPP/source.cpp @@ -0,0 +1,89 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Threading; + +public ref class Form1: public System::Windows::Forms::Form +{ +protected: + ListBox^ textBox1; + + // + // Creates a class to throw the error. +public: + ref class ErrorHandler: public System::Windows::Forms::Form + { + // Inserts the code to create a form with a button. + + // Programs the button to throw an exception when clicked. + private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + throw gcnew ArgumentException( "The parameter was invalid" ); + } + + public: + static void Main() + { + // Creates an instance of the methods that will handle the exception. + CustomExceptionHandler ^ eh = gcnew CustomExceptionHandler; + + // Adds the event handler to the event. + Application::ThreadException += gcnew ThreadExceptionEventHandler( eh, &Form1::CustomExceptionHandler::OnThreadException ); + + // Runs the application. + Application::Run( gcnew ErrorHandler ); + } + }; + + // Creates a class to handle the exception event. +internal: + ref class CustomExceptionHandler + { + // Handles the exception event. + public: + void OnThreadException( Object^ /*sender*/, ThreadExceptionEventArgs^ t ) + { + System::Windows::Forms::DialogResult result = ::DialogResult::Cancel; + try + { + result = this->ShowThreadExceptionDialog( t->Exception ); + } + catch ( Exception^ ) + { + try + { + MessageBox::Show( "Fatal Error", "Fatal Error", MessageBoxButtons::AbortRetryIgnore, MessageBoxIcon::Stop ); + } + finally + { + Application::Exit(); + } + } + + // Exits the program when the user clicks Abort. + if ( result == ::DialogResult::Abort ) + { + Application::Exit(); + } + } + + // Creates the error message and displays it. + private: + System::Windows::Forms::DialogResult ShowThreadExceptionDialog( Exception^ e ) + { + String^ errorMsg = "An error occurred please contact the adminstrator with the following information:\n\n"; + errorMsg = String::Concat( errorMsg, e->Message, "\n\nStack Trace:\n", e->StackTrace ); + return MessageBox::Show( errorMsg, "Application Error", MessageBoxButtons::AbortRetryIgnore, MessageBoxIcon::Stop ); + } + }; + // +}; + +int main() +{ + Form1::ErrorHandler::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..50b87ecc9c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection Example/CPP/source.cpp @@ -0,0 +1,53 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void ContainsAttribute() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Sets an Attribute to the specific attribute. + BrowsableAttribute^ myAttribute = BrowsableAttribute::Yes; + + if ( attributes->Contains( myAttribute ) ) + { + textBox1->Text = "button1 has a browsable attribute."; + } + else + { + textBox1->Text = "button1 does not have a browsable attribute."; + } + } + // + + // +private: + void GetAttributeValue() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Gets the designer attribute from the collection. + DesignerAttribute^ myDesigner; + myDesigner = (DesignerAttribute^)(attributes[DesignerAttribute::typeid]); + + // Prints the value of the attribute in a text box. + textBox1->Text = myDesigner->DesignerTypeName; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..55d7cd6ddb9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.AttributeCollection Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + void Method1() + { + // + AttributeCollection^ collection1; + collection1 = TypeDescriptor::GetAttributes( button1 ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp new file mode 100644 index 00000000000..f631fa1bdba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +protected: + void ContainsAttribute() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Sets an Attribute to the specific attribute. + BrowsableAttribute^ myAttribute = BrowsableAttribute::Yes; + + if ( attributes->Contains( myAttribute ) ) + { + textBox1->Text = "button1 has a browsable attribute."; + } + else + { + textBox1->Text = "button1 does not have a browsable attribute."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp new file mode 100644 index 00000000000..89ae7f0dcd6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Contains1 Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void ContainsAttributes() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ myCollection; + myCollection = TypeDescriptor::GetAttributes( button1 ); + + // Checks to see whether the attributes in myCollection are the attributes for textBox1. + array^ myAttrArray = gcnew array(100); + TypeDescriptor::GetAttributes( textBox1 )->CopyTo( myAttrArray, 0 ); + if ( myCollection->Contains( myAttrArray ) ) + { + textBox1->Text = "Both the button and text box have the same attributes."; + } + else + { + textBox1->Text = "The button and the text box do not have the same attributes."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..2abf26e850d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Count Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void GetCount() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Prints the number of items in the collection. + textBox1->Text = attributes->Count.ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp new file mode 100644 index 00000000000..4af06166f99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.GetEnumerator Example/CPP/Source.cpp @@ -0,0 +1,38 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void MyEnumerator() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Creates an enumerator for the collection. + System::Collections::IEnumerator^ ie = attributes->GetEnumerator(); + + // Prints the type of each attribute in the collection. + Object^ myAttribute; + System::Text::StringBuilder^ text = gcnew System::Text::StringBuilder; + while ( ie->MoveNext() ) + { + myAttribute = ie->Current; + text->Append( myAttribute ); + text->Append( '\n' ); + } + textBox1->Text = text->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp new file mode 100644 index 00000000000..311557f362f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void MatchesAttribute() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Checks to see if the browsable attribute is true. + if ( attributes->Matches( BrowsableAttribute::Yes ) ) + { + textBox1->Text = "button1 is browsable."; + } + else + { + textBox1->Text = "button1 is not browsable."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp new file mode 100644 index 00000000000..65654f3a33e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.Matches1 Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void MatchesAttributes() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ myCollection; + myCollection = TypeDescriptor::GetAttributes( button1 ); + + // Checks to see whether the attributes in myCollection match the attributes for textBox1. + array^ myAttrArray = gcnew array(100); + TypeDescriptor::GetAttributes( textBox1 )->CopyTo( myAttrArray, 0 ); + if ( myCollection->Matches( myAttrArray ) ) + { + textBox1->Text = "The attributes in the button and text box match."; + } + else + { + textBox1->Text = "The attributes in the button and text box do not match."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..a7716186c43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void PrintIndexItem() + { + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Prints the second attribute's name. + textBox1->Text = attributes[ 1 ]->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp new file mode 100644 index 00000000000..b3398011bd6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic AttributeCollection.this1 Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + +private: + + // + void PrintIndexItem2() + { + + // Creates a new collection and assigns it the attributes for button1. + AttributeCollection^ attributes; + attributes = TypeDescriptor::GetAttributes( button1 ); + + // Gets the designer attribute from the collection. + DesignerAttribute^ myDesigner; + + // You must supply a valid fully qualified assembly name here. + myDesigner = dynamic_cast(attributes[ Type::GetType( "Assembly text name, Version, Culture, PublicKeyToken" ) ]); + textBox1->Text = myDesigner->DesignerTypeName; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..82077eab139 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute Example/CPP/source.cpp @@ -0,0 +1,74 @@ + + +#using +ref class C +{ +public: + + // + property int MyProperty + { + [System::ComponentModel::Bindable(true)] + int get() + { + // Insert code here. + return 0; + } + + [System::ComponentModel::Bindable(true)] + void set( int ) + { + // Insert code here. + } + } + // + + property int MyProperty2 + { + int get() + { + // + using namespace System::ComponentModel; + + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the value of the BindableAttribute is Yes. + if ( attributes[ BindableAttribute::typeid ]->Equals( BindableAttribute::Yes ) ) + { + // Insert code here. + } + + // This is another way to see whether the property is bindable. + BindableAttribute^ myAttribute = static_cast(attributes[ BindableAttribute::typeid ]); + if ( myAttribute->Bindable ) + { + // Insert code here. + } + + // Yet another way to see whether the property is bindable. + if ( attributes->Contains( BindableAttribute::Yes ) ) + { + // Insert code here. + } + // + return 0; + } + } + + property int MyProperty3 + { + int get() + { + // + using namespace System::ComponentModel; + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); + if ( attributes[ BindableAttribute::typeid ]->Equals( BindableAttribute::Yes ) ) + { + // Insert code here. + } + // + return 0; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp new file mode 100644 index 00000000000..9bbe34fdcca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.Bindable Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + void Method() + { + + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the property is bindable. + BindableAttribute^ myAttribute = dynamic_cast(attributes[ BindableAttribute::typeid ]); + if ( myAttribute->Bindable ) + { + // Insert code here. + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..a93e6f51231 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + [property:Bindable(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int theValue ) + { + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp new file mode 100644 index 00000000000..bf23113eeef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindableAttribute.BindableAttribute1 Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + + property int MyProperty + { + + // + + [Bindable(BindableSupport::Yes)] + int get() + { + + // Insert code here. + return 0; + } + + void set( int theValue ) + { + + // Insert code here. + } + + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp new file mode 100644 index 00000000000..3606e68310c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding Example/CPP/source.cpp @@ -0,0 +1,281 @@ + + +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +#define null 0L +public ref class Form1: public Form +{ +private: + System::ComponentModel::Container^ components; + Button^ button1; + Button^ button2; + Button^ button3; + Button^ button4; + TextBox^ text1; + TextBox^ text2; + TextBox^ text3; + BindingManagerBase^ bmCustomers; + BindingManagerBase^ bmOrders; + DataSet^ ds; + DateTimePicker^ DateTimePicker1; + +public: + Form1() + { + // Required for Windows Form Designer support. + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->components = gcnew System::ComponentModel::Container; + this->button1 = gcnew Button; + this->button2 = gcnew Button; + this->button3 = gcnew Button; + this->button4 = gcnew Button; + this->text1 = gcnew TextBox; + this->text2 = gcnew TextBox; + this->text3 = gcnew TextBox; + this->DateTimePicker1 = gcnew DateTimePicker; + this->Text = "Binding Sample"; + this->ClientSize = System::Drawing::Size( 450, 200 ); + button1->Location = System::Drawing::Point( 24, 16 ); + button1->Size = System::Drawing::Size( 64, 24 ); + button1->Text = "<"; + button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + button2->Location = System::Drawing::Point( 90, 16 ); + button2->Size = System::Drawing::Size( 64, 24 ); + button2->Text = ">"; + button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + button3->Location = System::Drawing::Point( 90, 100 ); + button3->Size = System::Drawing::Size( 64, 24 ); + button3->Text = "<"; + button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + button4->Location = System::Drawing::Point( 150, 100 ); + button4->Size = System::Drawing::Size( 64, 24 ); + button4->Text = ">"; + button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); + text1->Location = System::Drawing::Point( 24, 50 ); + text1->Size = System::Drawing::Size( 150, 24 ); + text2->Location = System::Drawing::Point( 190, 50 ); + text2->Size = System::Drawing::Size( 150, 24 ); + text3->Location = System::Drawing::Point( 290, 150 ); + text3->Size = System::Drawing::Size( 150, 24 ); + DateTimePicker1->Location = System::Drawing::Point( 90, 150 ); + DateTimePicker1->Size = System::Drawing::Size( 200, 800 ); + this->Controls->Add( button1 ); + this->Controls->Add( button2 ); + this->Controls->Add( button3 ); + this->Controls->Add( button4 ); + this->Controls->Add( text1 ); + this->Controls->Add( text2 ); + this->Controls->Add( text3 ); + this->Controls->Add( DateTimePicker1 ); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + BindControls(); + } + +protected: + void BindControls() + { + /* Create two Binding objects for the first two TextBox + controls. The data-bound property for both controls + is the Text property. The data source is a DataSet + (ds). The data member is the + "TableName.ColumnName" string. */ + text1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) ); + text2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) ); + + /* Bind the DateTimePicker control by adding a new Binding. + The data member of the DateTimePicker is a + TableName.RelationName.ColumnName string. */ + DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) ); + + /* Add event delegates for the Parse and Format events to a + new Binding object, and add the object to the third + TextBox control's BindingsCollection. The delegates + must be added before adding the Binding to the + collection; otherwise, no formatting occurs until + the Current object of the BindingManagerBase for + the data source changes. */ + Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" ); + b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); + b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); + text3->DataBindings->Add( b ); + + // Get the BindingManagerBase for the Customers table. + bmCustomers = this->BindingContext[ ds, "Customers" ]; + + /* Get the BindingManagerBase for the Orders table using the + RelationName. */ + bmOrders = this->BindingContext[ ds, "customers.CustToOrders" ]; + } + +private: + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + /* This method is the Format event handler. Whenever the + control displays a new value, the value is converted from + its native Decimal type to a string. The ToString method + then formats the value as a Currency, by using the + formatting character "c". */ + // The application can only convert to string type. + if ( cevent->DesiredType != String::typeid ) + return; + + cevent->Value = (dynamic_cast(cevent->Value))->ToString( "c" ); + } + + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + /* This method is the Parse event handler. The Parse event + occurs whenever the displayed value changes. The static + ToDecimal method of the Convert class converts the + value back to its native Decimal type. */ + // Can only convert to Decimal type. + if ( cevent->DesiredType != Decimal::typeid ) + return; + + cevent->Value = Decimal::Parse( cevent->Value->ToString(), NumberStyles::Currency, nullptr ); + + /* To see that no precision is lost, print the unformatted + value. For example, changing a value to "10.0001" + causes the control to display "10.00", but the + unformatted value remains "10.0001". */ + Console::WriteLine( cevent->Value ); + } + +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Go to the previous item in the Customer list. + bmCustomers->Position -= 1; + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Go to the next item in the Customer list. + bmCustomers->Position += 1; + } + + void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Go to the previous item in the Orders list. + bmOrders->Position = bmOrders->Position - 1; + } + + void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Go to the next item in the Orders list. + bmOrders->Position = bmOrders->Position + 1; + } + +private: + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + ds = gcnew DataSet( "myDataSet" ); + + // Create two DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",Int32::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",Int32::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + ds->Tables->Add( tCust ); + ds->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + ds->Relations->Add( dr ); + + /* Populate the tables. For each customer and order, + create two DataRow variables. */ + DataRow^ newRow1; // = new DataRow(); + + DataRow^ newRow2; // = new DataRow(); + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Omega"; + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = System::DateTime( 2001, i, j * 2 ); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp new file mode 100644 index 00000000000..2a8cc30a915 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Binding Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataSet^ myDataSet; + + // +private: + void CreateDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + /* Populates the DataSet with tables, relations, and + constraints. */ + } + + void BindTextBoxToDataSet() + { + /* Binds a TextBox control to a DataColumn named + CompanyName in the DataTable named Suppliers. */ + textBox1->DataBindings->Add( + "Text", myDataSet, "Suppliers.CompanyName" ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp new file mode 100644 index 00000000000..4391fb2e22e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingManagerBase Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void PrintPositions() + { + for each ( Control^ c in this->Controls ) + { + for each ( Binding^ xBinding in c->DataBindings ) + { + Console::WriteLine( + "{0}\t Position: {1}", + c, xBinding->BindingManagerBase->Position ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp new file mode 100644 index 00000000000..650cd81d566 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.BindingMemberInfo Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void PrintBindingMemberInfo() + { + for each ( Control^ thisControl in this->Controls) + { + for each ( Binding^ thisBinding in thisControl->DataBindings) + { + // Print the control's name and Binding information. + Console::WriteLine( "\n {0}", thisControl ); + BindingMemberInfo bInfo = thisBinding->BindingMemberInfo; + Console::WriteLine( "Binding Path \t {0}", bInfo.BindingPath ); + Console::WriteLine( "Binding Field \t {0}", bInfo.BindingField ); + Console::WriteLine( "Binding Member \t {0}", bInfo.BindingMember ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp new file mode 100644 index 00000000000..9b7cfda4299 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Control Example/CPP/source.cpp @@ -0,0 +1,56 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + +private: + + // + void PrintBoundControls1() + { + + // Get the BindingManagerBase for the Customers table. + BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"Customers" ]; + + /* Print the information of each control managed by + the BindingManagerBase. */ + System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Binding^ b = safe_cast(myEnum->Current); + Console::WriteLine( b->Control ); + } + } + + void PrintBoundControls2() + { + + /* Get the BindingManagerBase for a child table of + the Customers table. The RelationName of a DataRelation + is appended to the parent table's name. */ + BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"Customers::CustToOrders" ]; + + /* Print the information of each control managed by + the BindingManagerBase. */ + System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Binding^ b = safe_cast(myEnum->Current); + Console::WriteLine( b->Control ); + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp new file mode 100644 index 00000000000..686f4a22180 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.DataSource Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + + // +private: + void GetDataSource() + { + DataSet^ ds = dynamic_cast(text1->DataBindings[nullptr]->DataSource); + Console::WriteLine( ds->Tables[ 0 ]->TableName ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp new file mode 100644 index 00000000000..3115a82bdce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Format Example/CPP/source.cpp @@ -0,0 +1,57 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + + // +private: + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts only to string type. Test this using the DesiredType. + if ( cevent->DesiredType != String::typeid ) + { + return; + } + + // Use the ToString method to format the value as currency ("c"). + cevent->Value = ( (Decimal)(cevent->Value) ).ToString( "c" ); + } + + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts back to decimal type only. + if ( cevent->DesiredType != Decimal::typeid ) + { + return; + } + + // Converts the string back to decimal using the static Parse method. + cevent->Value = Decimal::Parse( cevent->Value->ToString(), + NumberStyles::Currency, nullptr ); + } + + void BindControl() + { + // Creates the binding first. The OrderAmount is a Decimal type. + Binding^ b = gcnew Binding( + "Text",ds,"customers.custToOrders.OrderAmount" ); + + // Add the delegates to the event. + b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); + b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); + text1->DataBindings->Add( b ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp new file mode 100644 index 00000000000..2f487d4f82d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.IsBinding Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void PrintBindingIsBinding() + { + for each ( Control^ c in this->Controls ) + { + for each ( Binding^ b in c->DataBindings ) + { + Console::WriteLine( "\n {0}", c ); + Console::WriteLine( "{0} IsBinding: {1}", + b->PropertyName, b->IsBinding ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp new file mode 100644 index 00000000000..29443aaa6ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.Parse Example/CPP/source.cpp @@ -0,0 +1,56 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + + // +private: + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts only to string type. Test this using the DesiredType. + if ( cevent->DesiredType != String::typeid ) + { + return; + } + + // Use the ToString method to format the value as currency ("c"). + cevent->Value = ( (Decimal)(cevent->Value) ).ToString( "c" ); + } + + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts back to decimal type only. + if ( cevent->DesiredType != Decimal::typeid ) + { + return; + } + + // Converts the string back to decimal using the static Parse method. + cevent->Value = Decimal::Parse( cevent->Value->ToString(), + NumberStyles::Currency, nullptr ); + } + + void BindControl() + { + // Creates the binding first. The OrderAmount is typed as Decimal. + Binding^ b = gcnew Binding( + "Text", ds, "customers.custToOrders.OrderAmount" ); + // Add the delegates to the event. + b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); + b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); + text1->DataBindings->Add( b ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp new file mode 100644 index 00000000000..f2c822bfe52 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Binding.PropertyName Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void PrintPropertyNameAndIsBinding() + { + for each ( Control^ thisControl in this->Controls) + { + for each ( Binding^ thisBinding in thisControl->DataBindings ) + { + Console::WriteLine( "\n {0}", thisControl ); + // Print the PropertyName value for each binding. + Console::WriteLine( thisBinding->PropertyName ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp new file mode 100644 index 00000000000..6de17a23e3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext Example/CPP/source.cpp @@ -0,0 +1,83 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + TextBox^ text2; + TextBox^ text3; + TextBox^ text4; + DateTimePicker^ DateTimePicker1; + DataSet^ ds; + BindingManagerBase^ bmCustomers; + BindingManagerBase^ bmOrders; + + // + void BindControls() + { + /* Create two Binding objects for the first two TextBox + controls. The data-bound property for both controls + is the Text property. The data source is a DataSet + (ds). The data member is a navigation path in the form: + "TableName.ColumnName". */ + text1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) ); + text2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) ); + + /* Bind the DateTimePicker control by adding a new Binding. + The data member of the DateTimePicker is a navigation path: + TableName.RelationName.ColumnName string. */ + DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) ); + + /* Add event delegates for the Parse and Format events to a + new Binding object, and add the object to the third + TextBox control's BindingsCollection. The delegates + must be added before adding the Binding to the + collection; otherwise, no formatting occurs until + the Current object of the BindingManagerBase for + the data source changes. */ + Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" ); + b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); + b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); + text3->DataBindings->Add( b ); + + // Get the BindingManagerBase for the Customers table. + bmCustomers = this->BindingContext[ ds,"Customers" ]; + + /* Get the BindingManagerBase for the Orders table using the + RelationName. */ + bmOrders = this->BindingContext[ds, "customers.CustToOrders"]; + + /* Bind the fourth TextBox control's Text property to the + third control's Text property. */ + text4->DataBindings->Add( "Text", text3, "Text" ); + } + // + +private: + void CurrencyStringToDecimal( Object^ sender, ConvertEventArgs^ cevent ) + { + + // does nothing + } + + void DecimalToCurrencyString( Object^ sender, ConvertEventArgs^ cevent ) + { + + // does nothing + } + +}; + +int main() +{ + //Application::Run(new Form1()); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp new file mode 100644 index 00000000000..b2c0ad4f581 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.BindingContext Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + GroupBox^ groupBox1; + GroupBox^ groupBox2; + TextBox^ textBox1; + TextBox^ textBox2; + DataSet^ ds; + +private: + + // + void BindControls() + { + System::Windows::Forms::BindingContext^ bcG1 = gcnew System::Windows::Forms::BindingContext; + System::Windows::Forms::BindingContext^ bcG2 = gcnew System::Windows::Forms::BindingContext; + groupBox1->BindingContext = bcG1; + groupBox2->BindingContext = bcG2; + textBox1->DataBindings->Add( "Text", ds, "Customers.CustName" ); + textBox2->DataBindings->Add( "Text", ds, "Customers.CustName" ); + } + + void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + groupBox1->BindingContext[ds, "Customers"]->Position = groupBox1->BindingContext[ds, "Customers"]->Position + 1; + } + + void Button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + groupBox2->BindingContext[ds, "Customers"]->Position = groupBox2->BindingContext[ds, "Customers"]->Position + 1; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp new file mode 100644 index 00000000000..1de98eef4c9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void TryContains( DataSet^ myDataSet ) + { + // Test each DataTable in a DataSet to see if it is bound to a BindingManagerBase. + for each ( DataTable^ thisTable in myDataSet->Tables ) + { + Console::WriteLine( "{0}: {1}", thisTable->TableName, this->BindingContext->Contains( thisTable ) ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp new file mode 100644 index 00000000000..a449d71035f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.Contains1 Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void TryContainsDataMember( DataSet^ myDataSet ) + { + bool trueorfalse; + trueorfalse = this->BindingContext->Contains( myDataSet, "Suppliers" ); + Console::WriteLine( trueorfalse ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..2bf72ad92de --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.CopyTo Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void CopyToArray() + { + // Declare the array. + array^ myArray = gcnew array(100); + ( (ICollection^)(this->BindingContext) )->CopyTo( myArray, 0 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..150886ecc54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.ICollection.Count Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void PrintCount() + { + Console::WriteLine( "BindingContext->Count {0}", + ( (ICollection^)(this->BindingContext) )->Count ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..7c887568f99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.IEnumerable.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetManagerEnumerator() + { + IEnumerator^ myEnumerator; + myEnumerator = ( (IEnumerable^)(this->BindingContext) )->GetEnumerator(); + ForEachEnumerator(); + } + + void ForEachEnumerator() + { + for each ( IEnumerator^ myEnumerator in ( (IEnumerable^)(this->BindingContext) ) ) + { + Console::WriteLine( myEnumerator ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp new file mode 100644 index 00000000000..f92a4dabcf4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingContext.this Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Collections; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataView^ myDataView; + ArrayList^ myArrayList; + +private: + + // + void ReturnBindingManagerBase() + { + + // Get the BindingManagerBase for a DataView. + BindingManagerBase^ bmCustomers = this->BindingContext[ myDataView ]; + + /* Get the BindingManagerBase for an ArrayList. */ + BindingManagerBase^ bmOrders = this->BindingContext[ myArrayList ]; + + // Get the BindingManagerBase for a TextBox control. + BindingManagerBase^ baseArray = this->BindingContext[ textBox1->DataBindings[ nullptr ]->DataSource ]; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp new file mode 100644 index 00000000000..12bbb580b25 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase Example/CPP/source.cpp @@ -0,0 +1,81 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataSet^ DataSet1; + BindingManagerBase^ myBindingManagerBase; + +private: + + // + void GetBindingManagerBase() + { + + /* CustomersToOrders is the RelationName of a DataRelation. + Therefore, the list maintained by the BindingManagerBase is the + list of orders that belong to a specific customer in the + DataTable named Customers, found in DataSet1. */ + myBindingManagerBase = this->BindingContext[DataSet1, "Customers.CustomersToOrders"]; + + // Adds delegates to the CurrentChanged and PositionChanged events. + myBindingManagerBase->PositionChanged += gcnew EventHandler( this, &Form1::BindingManagerBase_PositionChanged ); + myBindingManagerBase->CurrentChanged += gcnew EventHandler( this, &Form1::BindingManagerBase_CurrentChanged ); + } + + void BindingManagerBase_PositionChanged( Object^ sender, EventArgs^ /*e*/ ) + { + + // Prints the new Position of the BindingManagerBase. + Console::Write( "Position Changed: " ); + Console::WriteLine( (dynamic_cast(sender))->Position ); + } + + void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ ) + { + + // Prints the new value of the current object. + Console::Write( "Current Changed: " ); + Console::WriteLine( (dynamic_cast(sender))->Current ); + } + + void MoveNext() + { + + // Increments the Position property value by one. + myBindingManagerBase->Position = myBindingManagerBase->Position + 1; + } + + void MovePrevious() + { + + // Decrements the Position property value by one. + myBindingManagerBase->Position = myBindingManagerBase->Position - 1; + } + + void MoveFirst() + { + + // Goes to the first row in the list. + myBindingManagerBase->Position = 0; + } + + void MoveLast() + { + + // Goes to the last row in the list. + myBindingManagerBase->Position = myBindingManagerBase->Count - 1; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp new file mode 100644 index 00000000000..1402397723e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Bindings Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + +private: + + // + void PrintBoundControls() + { + BindingManagerBase^ myBindingBase = this->BindingContext[ ds,"customers" ]; + System::Collections::IEnumerator^ myEnum = myBindingBase->Bindings->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Binding^ b = safe_cast(myEnum->Current); + Console::WriteLine( b->Control ); + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..4d562d5ab71 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Count Example/CPP/source.cpp @@ -0,0 +1,47 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + BindingManagerBase^ myBindingManagerBase; + + // +private: + void BindingManagerBase_CurrentChanged( Object^ sender, EventArgs^ /*e*/ ) + { + // Print the new value of the current object. + Console::Write( "Current Changed: " ); + Console::WriteLine( ( (BindingManagerBase^)(sender) )->Current ); + } + + void MoveNext() + { + // Increment the Position property value by one. + myBindingManagerBase->Position = myBindingManagerBase->Position + 1; + } + + void MovePrevious() + { + // Decrement the Position property value by one. + myBindingManagerBase->Position = myBindingManagerBase->Position - 1; + } + + void MoveFirst() + { + // Go to the first item in the list. + myBindingManagerBase->Position = 0; + } + + void MoveLast() + { + // Go to the last row in the list. + myBindingManagerBase->Position = myBindingManagerBase->Count - 1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp new file mode 100644 index 00000000000..a4d4f230f20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.Current Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + + // + void Current_Changed( Object^ sender, EventArgs^ /*e*/ ) + { + BindingManagerBase^ bm = dynamic_cast(sender); + + /* Check the type of the Current object. If it is not a + DataRowView, exit the method. */ + if ( bm->Current->GetType() != DataRowView::typeid ) + return; + + // Otherwise, print the value of the column named "CustName". + DataRowView^ drv = dynamic_cast(bm->Current); + Console::Write( "CurrentChanged): " ); + Console::Write( drv[ "CustName" ] ); + Console::WriteLine(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp new file mode 100644 index 00000000000..7eb4803cebe --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void ShowGetItemProperties() + { + + // Create a new DataTable and add two columns. + DataTable^ dt = gcnew DataTable; + dt->Columns->Add( "Name", Type::GetType( "System.String" ) ); + dt->Columns->Add( "ID", Type::GetType( "System.String" ) ); + + // Add a row to the table. + DataRow^ dr = dt->NewRow(); + dr[ "Name" ] = "Ann"; + dr[ "ID" ] = "AAA"; + dt->Rows->Add( dr ); + PropertyDescriptorCollection^ myPropertyDescriptors = this->BindingContext[ dt ]->GetItemProperties(); + PropertyDescriptor^ myPropertyDescriptor = myPropertyDescriptors[ "Name" ]; + Console::WriteLine( myPropertyDescriptor->Name ); + Console::WriteLine( myPropertyDescriptor->GetValue( dt->DefaultView[ 0 ] ) ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp new file mode 100644 index 00000000000..03be34c5dc2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.GetItemProperties2 Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void PrintPropertyDescriptions( BindingManagerBase^ b ) + { + Console::WriteLine( "Printing Property Descriptions" ); + PropertyDescriptorCollection^ ps = b->GetItemProperties(); + for ( int i = 0; i < ps->Count; i++ ) + { + Console::WriteLine( "\t{0}\t{1}", ps[ i ]->Name, ps[ i ]->PropertyType ); + + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..606e0e5fcb5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingManagerBase.PositionChanged Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + + // + void BindControl() + { + + /* Create a Binding object for the TextBox control. + The data-bound property for the control is the Text + property. */ + Binding^ myBinding = gcnew Binding( "Text",ds,"customers.custName" ); + text1->DataBindings->Add( myBinding ); + + // Get the BindingManagerBase for the Customers table. + BindingManagerBase^ bmCustomers = this->BindingContext[ ds,"Customers" ]; + + // Add the delegate for the PositionChanged event. + bmCustomers->PositionChanged += gcnew EventHandler( this, &Form1::Position_Changed ); + } + + +private: + void Position_Changed( Object^ sender, EventArgs^ /*e*/ ) + { + + // Print the Position property value when it changes. + Console::WriteLine( (dynamic_cast(sender))->Position ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp new file mode 100644 index 00000000000..455be8b1188 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void PrintBindingMemberInfo() + { + for each ( Control^ c in this->Controls ) + { + for each ( Binding^ b in c->DataBindings ) + { + Console::WriteLine( "\n {0}", c ); + BindingMemberInfo bInfo = b->BindingMemberInfo; + Console::WriteLine( "Binding Path \t {0}", bInfo.BindingPath ); + Console::WriteLine( "Binding Field \t {0}", bInfo.BindingField ); + Console::WriteLine( "Binding Member \t {0}", bInfo.BindingMember ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp new file mode 100644 index 00000000000..a233f0c82ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingMemberInfo.BindingPath Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + void PrintBindingMemberInfo() + { + Console::WriteLine( "\n BindingMemberInfo" ); + for each ( Control^ thisControl in this->Controls ) + { + for each ( Binding^ thisBinding in thisControl->DataBindings ) + { + BindingMemberInfo bInfo = thisBinding->BindingMemberInfo; + Console::WriteLine( "\t BindingPath: {0}", bInfo.BindingPath ); + Console::WriteLine( "\t BindingField: {0}", bInfo.BindingField ); + Console::WriteLine( "\t BindingMember: {0}", bInfo.BindingMember ); + Console::WriteLine(); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..5def83b5196 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection Example/CPP/source.cpp @@ -0,0 +1,57 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Globalization; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + + // +private: + void BindTextBoxControl() + { + DataSet^ myDataSet = gcnew DataSet; + /* Insert code to populate the DataSet with tables, + columns, and data. */ + + // Creates a new Binding object. + Binding^ myBinding = gcnew Binding( + "Text",myDataSet,"customers.custToOrders.OrderAmount" ); + + // Adds event delegates for the Parse and Format events. + myBinding->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyToDecimal ); + myBinding->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrency ); + + // Adds the new Binding to the BindingsCollection. + text1->DataBindings->Add( myBinding ); + } + + void DecimalToCurrency( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + /* This method is the Format event handler. Whenever the + control displays a new value, the value is converted from + its native Decimal type to a string. The ToString method + then formats the value as a Currency, by using the + formatting character "c". */ + cevent->Value = safe_cast(cevent->Value)->ToString( "c" ); + } + + void CurrencyToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + /* This method is the Parse event handler. The Parse event + occurs whenever the displayed value changes. The static + Parse method of the Decimal structure converts the + string back to its native Decimal type. */ + cevent->Value = Decimal::Parse( cevent->Value->ToString(), + NumberStyles::Currency, nullptr ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..715ad30757d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BindingsCollection.this Example/CPP/source.cpp @@ -0,0 +1,25 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + +private: + + // + void PrintBindingInfo() + { + BindingsCollection^ bc = text1->DataBindings; + for ( int i = 0; i < bc->Count; i++ ) + Console::WriteLine( bc[ i ]->BindingMemberInfo.BindingMember ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..98b137766ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute Example/CPP/source.cpp @@ -0,0 +1,72 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ + // +public: + [Browsable(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int value ) + { + // Insert code here. + } + } + // + + property int MyProperty2 + { + + int get() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the value of the BrowsableAttribute is Yes. + if ( attributes[ BrowsableAttribute::typeid ]->Equals( BrowsableAttribute::Yes ) ) + { + + // Insert code here. + } + + // This is another way to see whether the property is browsable. + BrowsableAttribute^ myAttribute = dynamic_cast(attributes[ BrowsableAttribute::typeid ]); + if ( myAttribute->Browsable ) + { + // Insert code here. + } + // + return 0; + } + } + + property int MyProperty3 + { + int get() + { + // + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); + if ( attributes[ BrowsableAttribute::typeid ]->Equals( BrowsableAttribute::Yes ) ) + { + // Insert code here. + } + // + return 0; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp new file mode 100644 index 00000000000..ace5523f8ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.Browsable Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the property is browsable. + BrowsableAttribute^ myAttribute = dynamic_cast(attributes[ BrowsableAttribute::typeid ]); + if ( myAttribute->Browsable ) + { + // Insert code here. + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..fead6b5da22 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic BrowsableAttribute.BrowsableAttribute Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + property int MyProperty + { + // + [Browsable(true)] + int get() + { + // Insert code here. + return 0; + } + void set( int value ) + { + + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp new file mode 100644 index 00000000000..34bc77d638e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Button.Button Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + void InitializeMyButton() + { + // Create and initialize a Button. + Button^ button1 = gcnew Button; + + // Set the button to return a value of OK when clicked. + button1->DialogResult = ::DialogResult::OK; + + // Add the button to the form. + Controls->Add( button1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp new file mode 100644 index 00000000000..5540ff5fd46 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Button.PerformClick Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button2; + int myVar; + + // +private: + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // If myVar is an even number, click Button2. + if ( myVar % 2 == 0 ) + { + button2->PerformClick(); + // Display the status of Button2's Click event. + MessageBox::Show( "button2 was clicked " ); + } + else + { + // Display the status of Button2's Click event. + MessageBox::Show( "button2 was NOT clicked" ); + } + // Increment myVar. + myVar++; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..36c674813d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.FlatStyle Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + Button^ button1; + + // +private: + void SetMyButtonProperties() + { + // Assign an image to the button. + button1->Image = Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" ); + // Align the image and text on the button. + button1->ImageAlign = ContentAlignment::MiddleRight; + button1->TextAlign = ContentAlignment::MiddleLeft; + // Give the button a flat appearance. + button1->FlatStyle = FlatStyle::Flat; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp new file mode 100644 index 00000000000..9eee76a0ff2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ButtonBase.ImageIndex Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + Button^ button1; + ImageList^ imageList1; + + // +private: + void AddMyImage() + { + // Assign an image to the imageList. + imageList1->Images->Add( Image::FromFile( "C:\\Graphics\\MyBitmap.bmp" ) ); + // Assign the imageList to the button control. + button1->ImageList = imageList1; + // Select the image from the ImageList (using the ImageIndex property). + button1->ImageIndex = 0; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp new file mode 100644 index 00000000000..ebb3d856ac7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CancelEventArgs Example/CPP/source.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + bool myDataIsSaved; + + // +private: + // Call this method from the InitializeComponent() method of your form + void OtherInitialize() + { + this->Closing += gcnew CancelEventHandler( this, &Form1::Form1_Cancel ); + this->myDataIsSaved = true; + } + + void Form1_Cancel( Object^ /*sender*/, CancelEventArgs^ e ) + { + if ( !myDataIsSaved ) + { + e->Cancel = true; + MessageBox::Show( "You must save first." ); + } + else + { + e->Cancel = false; + MessageBox::Show( "Goodbye." ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..408c380eb86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CategoryAttribute Example/CPP/source.cpp @@ -0,0 +1,43 @@ + + +#using +#using + +using namespace System; +using namespace System::ComponentModel; +ref class C +{ +public: + System::Drawing::Image^ m_Image1; + + property System::Drawing::Image^ MyImage + { + + // + [Description("The image associated with the control"),Category("Appearance")] + System::Drawing::Image^ get() + { + // Insert code here. + return m_Image1; + } + + void set( System::Drawing::Image^ ) + { + // Insert code here. + } + } + // + + void MyMethod() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyImage" ]->Attributes; + + // Prints the description by retrieving the CategoryAttribute. + // from the AttributeCollection. + CategoryAttribute^ myAttribute = static_cast(attributes[ CategoryAttribute::typeid ]); + Console::WriteLine( myAttribute->Category ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp new file mode 100644 index 00000000000..ef6927cc6a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckAlign Example/CPP/source.cpp @@ -0,0 +1,38 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + CheckBox^ checkBox1; + Label^ label1; + + // +private: + void AdjustMyCheckBoxProperties() + { + // Concatenate the property values together on three lines. + label1->Text = String::Format( "ThreeState: {0}\nChecked: {1}\nCheckState: {2}", + checkBox1->ThreeState, checkBox1->Checked, checkBox1->CheckState ); + + // Change the ThreeState and CheckAlign properties on every other click. + if ( !checkBox1->ThreeState ) + { + checkBox1->ThreeState = true; + checkBox1->CheckAlign = ContentAlignment::MiddleRight; + } + else + { + checkBox1->ThreeState = false; + checkBox1->CheckAlign = ContentAlignment::MiddleLeft; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp new file mode 100644 index 00000000000..1508b6f4e44 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CheckBox.CheckBox Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void InstantiateMyCheckBox() + { + // Create and initialize a CheckBox. + CheckBox^ checkBox1 = gcnew CheckBox; + + // Make the check box control appear as a toggle button. + checkBox1->Appearance = Appearance::Button; + + // Turn off the update of the display on the click of the control. + checkBox1->AutoCheck = false; + + // Add the check box control to the form. + this->Controls->Add( checkBox1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp new file mode 100644 index 00000000000..ccce5e98d91 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CheckedListBox Example/CPP/source.cpp @@ -0,0 +1,172 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::CheckedListBox^ checkedListBox1; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button3; + System::ComponentModel::Container^ components; + +public: + Form1() + { + InitializeComponent(); + + // Sets up the initial objects in the CheckedListBox. + array^myFruit = {"Apples","Oranges","Tomato"}; + checkedListBox1->Items->AddRange( myFruit ); + + // Changes the selection mode from double-click to single click. + checkedListBox1->CheckOnClick = true; + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->checkedListBox1 = gcnew System::Windows::Forms::CheckedListBox; + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->button3 = gcnew System::Windows::Forms::Button; + this->textBox1->Location = System::Drawing::Point( 144, 64 ); + this->textBox1->Size = System::Drawing::Size( 128, 20 ); + this->textBox1->TabIndex = 1; + this->textBox1->TextChanged += gcnew System::EventHandler( this, &Form1::textBox1_TextChanged ); + this->checkedListBox1->Location = System::Drawing::Point( 16, 64 ); + this->checkedListBox1->Size = System::Drawing::Size( 120, 184 ); + this->checkedListBox1->TabIndex = 0; + this->checkedListBox1->ItemCheck += gcnew System::Windows::Forms::ItemCheckEventHandler( this, &Form1::checkedListBox1_ItemCheck ); + this->listBox1->Location = System::Drawing::Point( 408, 64 ); + this->listBox1->Size = System::Drawing::Size( 128, 186 ); + this->listBox1->TabIndex = 3; + this->button1->Enabled = false; + this->button1->Location = System::Drawing::Point( 144, 104 ); + this->button1->Size = System::Drawing::Size( 104, 32 ); + this->button1->TabIndex = 2; + this->button1->Text = "Add Fruit"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + this->button2->Enabled = false; + this->button2->Location = System::Drawing::Point( 288, 64 ); + this->button2->Size = System::Drawing::Size( 104, 32 ); + this->button2->TabIndex = 2; + this->button2->Text = "Show Order"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + this->button3->Enabled = false; + this->button3->Location = System::Drawing::Point( 288, 104 ); + this->button3->Size = System::Drawing::Size( 104, 32 ); + this->button3->TabIndex = 2; + this->button3->Text = "Save Order"; + this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + this->ClientSize = System::Drawing::Size( 563, 273 ); + array^temp0 = {this->listBox1,this->button3,this->button2,this->button1,this->textBox1,this->checkedListBox1}; + this->Controls->AddRange( temp0 ); + this->Text = "Fruit Order"; + } + + // Adds the string if the text box has data in it. + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( !textBox1->Text->Equals( "" ) ) + { + if ( !checkedListBox1->CheckedItems->Contains( textBox1->Text ) ) + checkedListBox1->Items->Add( textBox1->Text, CheckState::Checked ); + textBox1->Text = ""; + } + } + + // Activates or deactivates the Add button. + void textBox1_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( textBox1->Text->Equals( "" ) ) + { + button1->Enabled = false; + } + else + { + button1->Enabled = true; + } + } + + // Moves the checked items from the CheckedListBox to the listBox. + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + listBox1->Items->Clear(); + button3->Enabled = false; + for ( int i = 0; i < checkedListBox1->CheckedItems->Count; i++ ) + { + listBox1->Items->Add( checkedListBox1->CheckedItems[ i ] ); + + } + if ( listBox1->Items->Count > 0 ) + button3->Enabled = true; + } + + // Activates the move button if there are checked items. + void checkedListBox1_ItemCheck( Object^ /*sender*/, ItemCheckEventArgs^ e ) + { + if ( e->NewValue == CheckState::Unchecked ) + { + if ( checkedListBox1->CheckedItems->Count == 1 ) + { + button2->Enabled = false; + } + } + else + { + button2->Enabled = true; + } + } + + // Saves the items to a file. + void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Insert code to save a file. + listBox1->Items->Clear(); + IEnumerator^ myEnumerator; + myEnumerator = checkedListBox1->CheckedIndices->GetEnumerator(); + int y; + while ( myEnumerator->MoveNext() ) + { + y = safe_cast(myEnumerator->Current); + checkedListBox1->SetItemChecked( y, false ); + } + + button3->Enabled = false; + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp new file mode 100644 index 00000000000..4499a79da98 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard Example/CPP/source.cpp @@ -0,0 +1,51 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + TextBox^ textBox2; + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Takes the selected text from a text box and puts it on the clipboard. + if ( !textBox1->SelectedText->Equals( "" ) ) + { + Clipboard::SetDataObject( textBox1->SelectedText ); + } + else + { + textBox2->Text = "No text selected in textBox1"; + } + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Declares an IDataObject to hold the data returned from the clipboard. + // Retrieves the data from the clipboard. + IDataObject^ iData = Clipboard::GetDataObject(); + + // Determines whether the data is in a format you can use. + if ( iData->GetDataPresent( DataFormats::Text ) ) + { + // Yes it is, so display it in a text box. + textBox2->Text = (String^)(iData->GetData( DataFormats::Text )); + } + else + { + // No it is not. + textBox2->Text = "Could not retrieve data off the clipboard."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp new file mode 100644 index 00000000000..0c6fc8f64fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Clipboard.SetDataObject1 Example/CPP/source.cpp @@ -0,0 +1,56 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + TextBox^ textBox2; + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Takes the selected text from a text box and puts it on the clipboard. + if ( !textBox1->SelectedText->Equals( "" ) ) + { + Clipboard::SetDataObject( textBox1->SelectedText, true ); + } + else + { + textBox2->Text = "No text selected in textBox1"; + } + } + // + + // +private: + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Declares an IDataObject to hold the data returned from the clipboard. + // Retrieves the data from the clipboard. + IDataObject^ iData = Clipboard::GetDataObject(); + + // Determines whether the data is in a format you can use. + if ( iData->GetDataPresent( DataFormats::Text ) ) + { + + // Yes it is, so display it in a text box. + textBox2->Text = (String^)(iData->GetData( DataFormats::Text )); + } + else + { + + // No it is not. + textBox2->Text = "Could not retrieve data off the clipboard."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp new file mode 100644 index 00000000000..c773dda4e2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ColorDialog Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ColorDialog^ MyDialog = gcnew ColorDialog; + // Keeps the user from selecting a custom color. + MyDialog->AllowFullOpen = false; + // Allows the user to get help. (The default is false.) + MyDialog->ShowHelp = true; + // Sets the initial color select to the current text color. + MyDialog->Color = textBox1->ForeColor; + + // Update the text box color if the user clicks OK + if ( MyDialog->ShowDialog() == ::System::Windows::Forms::DialogResult::OK ) + { + textBox1->ForeColor = MyDialog->Color; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp new file mode 100644 index 00000000000..5b5b300a1e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ContextMenu Example/CPP/source.cpp @@ -0,0 +1,46 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + TextBox^ pictureBox1; + System::Windows::Forms::ContextMenu^ contextMenu1; + + // +private: + void MyPopupEventHandler( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Define the MenuItem objects to display for the TextBox. + MenuItem^ menuItem1 = gcnew MenuItem( "&Copy" ); + MenuItem^ menuItem2 = gcnew MenuItem( "&Find and Replace" ); + // Define the MenuItem object to display for the PictureBox. + MenuItem^ menuItem3 = gcnew MenuItem( "C&hange Picture" ); + + // Clear all previously added MenuItems. + contextMenu1->MenuItems->Clear(); + + if ( contextMenu1->SourceControl == textBox1 ) + { + + // Add MenuItems to display for the TextBox. + contextMenu1->MenuItems->Add( menuItem1 ); + contextMenu1->MenuItems->Add( menuItem2 ); + } + else if ( contextMenu1->SourceControl == pictureBox1 ) + { + // Add the MenuItem to display for the PictureBox. + contextMenu1->MenuItems->Add( menuItem3 ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..cee6b37d291 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Control.BindingContextChanged Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void AddEventHandler() + { + textBox1->BindingContextChanged += gcnew EventHandler( + this, &Form1::BindingContext_Changed ); + } + + void BindingContext_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Console::WriteLine( "BindingContext changed" ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp new file mode 100644 index 00000000000..93dd4777cb9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Control.DataBindings Example/CPP/source.cpp @@ -0,0 +1,91 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + TextBox^ textBox2; + TextBox^ textBox3; + TextBox^ textBox4; + DateTimePicker^ DateTimePicker1; + BindingManagerBase^ bmCustomers; + BindingManagerBase^ bmOrders; + DataSet^ ds; + + // + void BindControls() + { + + /* Create two Binding objects for the first two TextBox + controls. The data-bound property for both controls + is the Text property. The data source is a DataSet + (ds). The data member is specified by a navigation + path in the form : TableName.ColumnName. */ + textBox1->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custName" ) ); + textBox2->DataBindings->Add( gcnew Binding( "Text",ds,"customers.custID" ) ); + + /* Bind the DateTimePicker control by adding a new Binding. + The data member of the DateTimePicker is specified by a + navigation path in the form: TableName.RelationName.ColumnName. */ + DateTimePicker1->DataBindings->Add( gcnew Binding( "Value",ds,"customers.CustToOrders.OrderDate" ) ); + + /* Create a new Binding using the DataSet and a + navigation path(TableName.RelationName.ColumnName). + Add event delegates for the Parse and Format events to + the Binding object, and add the object to the third + TextBox control's BindingsCollection. The delegates + must be added before adding the Binding to the + collection; otherwise, no formatting occurs until + the Current object of the BindingManagerBase for + the data source changes. */ + Binding^ b = gcnew Binding( "Text",ds,"customers.custToOrders.OrderAmount" ); + b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); + b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); + textBox3->DataBindings->Add( b ); + + /*Bind the fourth TextBox to the Value of the + DateTimePicker control. This demonstrates how one control + can be bound to another.*/ + textBox4->DataBindings->Add( "Text", DateTimePicker1, "Value" ); + BindingManagerBase^ bmText = this->BindingContext[ DateTimePicker1 ]; + + /* Print the Type of the BindingManagerBase, which is + a PropertyManager because the data source + returns only a single property value. */ + Console::WriteLine( bmText->GetType() ); + + // Print the count of managed objects, which is 1. + Console::WriteLine( bmText->Count ); + + // Get the BindingManagerBase for the Customers table. + bmCustomers = this->BindingContext[ds, "Customers"]; + + /* Print the Type and count of the BindingManagerBase. + Because the data source inherits from IBindingList, + it is a RelatedCurrencyManager (derived from CurrencyManager). */ + Console::WriteLine( bmCustomers->GetType() ); + Console::WriteLine( bmCustomers->Count ); + + /* Get the BindingManagerBase for the Orders of the current + customer using a navigation path: TableName.RelationName. */ + bmOrders = this->BindingContext[ds, "customers.CustToOrders"]; + } + // + +private: + + // method added so sample will compile + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} + + // method added so sample will compile + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} + +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp new file mode 100644 index 00000000000..ac3591af8bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Control.Visible Example/CPP/source.cpp @@ -0,0 +1,43 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + PictureBox^ pictureBox1; + ScrollBar^ hScrollBar1; + ScrollBar^ vScrollBar1; + + // +public: + void DisplayScrollBars() + { + // Display or hide the scroll bars based upon + // whether the image is larger than the PictureBox. + if ( pictureBox1->Width > pictureBox1->Image->Width ) + { + hScrollBar1->Visible = false; + } + else + { + hScrollBar1->Visible = true; + } + + if ( pictureBox1->Height > pictureBox1->Image->Height ) + { + vScrollBar1->Visible = false; + } + else + { + vScrollBar1->Visible = true; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..42d43c93bdb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection Example/CPP/source.cpp @@ -0,0 +1,99 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + TextBox^ textBox2; + TextBox^ textBox3; + TextBox^ textBox4; + DateTimePicker^ DateTimePicker1; + BindingManagerBase^ bmCustomers; + BindingManagerBase^ bmOrders; + DataSet^ ds; + + // +protected: + void BindControls() + { + /* Create two Binding objects for the first two TextBox + controls. The data-bound property for both controls + is the Text property. The data source is a DataSet + (ds). The data member is the navigation path: + TableName.ColumnName. */ + textBox1->DataBindings->Add( gcnew Binding( + "Text",ds,"customers.custName" ) ); + textBox2->DataBindings->Add( gcnew Binding( + "Text",ds,"customers.custID" ) ); + + /* Bind the DateTimePicker control by adding a new Binding. + The data member of the DateTimePicker is a navigation path: + TableName.RelationName.ColumnName. */ + DateTimePicker1->DataBindings->Add( gcnew Binding( + "Value",ds,"customers.CustToOrders.OrderDate" ) ); + + /* Create a new Binding using the DataSet and a + navigation path(TableName.RelationName.ColumnName). + Add event delegates for the Parse and Format events to + the Binding object, and add the object to the third + TextBox control's BindingsCollection. The delegates + must be added before adding the Binding to the + collection; otherwise, no formatting occurs until + the Current object of the BindingManagerBase for + the data source changes. */ + Binding^ b = gcnew Binding( + "Text",ds,"customers.custToOrders.OrderAmount" ); + b->Parse += gcnew ConvertEventHandler( + this, &Form1::CurrencyStringToDecimal ); + b->Format += gcnew ConvertEventHandler( + this, &Form1::DecimalToCurrencyString ); + textBox3->DataBindings->Add( b ); + + /*Bind the fourth TextBox to the Value of the + DateTimePicker control. This demonstates how one control + can be data-bound to another.*/ + textBox4->DataBindings->Add( "Text", DateTimePicker1, "Value" ); + + // Get the BindingManagerBase for the textBox4 Binding. + BindingManagerBase^ bmText = this->BindingContext[ + DateTimePicker1 ]; + + /* Print the Type of the BindingManagerBase, which is + a PropertyManager because the data source + returns only a single property value. */ + Console::WriteLine( bmText->GetType() ); + + // Print the count of managed objects, which is one. + Console::WriteLine( bmText->Count ); + + // Get the BindingManagerBase for the Customers table. + bmCustomers = this->BindingContext[ds, "Customers"]; + + /* Print the Type and count of the BindingManagerBase. + Because the data source inherits from IBindingList, + it is a RelatedCurrencyManager (a derived class of + CurrencyManager). */ + Console::WriteLine( bmCustomers->GetType() ); + Console::WriteLine( bmCustomers->Count ); + + /* Get the BindingManagerBase for the Orders of the current + customer using a navigation path: TableName.RelationName. */ + bmOrders = this->BindingContext[ds, "customers.CustToOrders"]; + } + // + +private: + // method added so sample will compile + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} + + // method added so sample will compile + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..abacb741b88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add Example/CPP/source.cpp @@ -0,0 +1,46 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataSet^ ds; + + // +protected: + void BindControls() + { + /* Create a new Binding using the DataSet and a + navigation path(TableName.RelationName.ColumnName). + Add event delegates for the Parse and Format events to + the Binding object, and add the object to the third + TextBox control's BindingsCollection. The delegates + must be added before adding the Binding to the + collection; otherwise, no formatting occurs until + the Current object of the BindingManagerBase for + the data source changes. */ + Binding^ b = gcnew Binding( + "Text",ds,"customers.custToOrders.OrderAmount" ); + b->Parse += gcnew ConvertEventHandler( + this, &Form1::CurrencyStringToDecimal ); + b->Format += gcnew ConvertEventHandler( + this, &Form1::DecimalToCurrencyString ); + textBox1->DataBindings->Add( b ); + } + // + +private: + // method added so sample will compile + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} + + // method added so sample will compile + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ /*e*/ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp new file mode 100644 index 00000000000..7c95df795ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Add1 Example/CPP/source.cpp @@ -0,0 +1,65 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void BindTextBoxProperties() + { + // Clear the collection before adding new Binding objects. + textBox1->DataBindings->Clear(); + + // Create a DataTable containing Color objects. + DataTable^ t = MakeTable(); + + /* Bind the Text, BackColor, and ForeColor properties + to columns in the DataTable. */ + textBox1->DataBindings->Add( "Text", t, "Text" ); + textBox1->DataBindings->Add( "BackColor", t, "BackColor" ); + textBox1->DataBindings->Add( "ForeColor", t, "ForeColor" ); + } + + DataTable^ MakeTable() + { + /* Create a DataTable with three columns. + Two of the columns contain Color objects. */ + DataTable^ t = gcnew DataTable( "Control" ); + t->Columns->Add( "BackColor", Color::typeid ); + t->Columns->Add( "ForeColor", Color::typeid ); + t->Columns->Add( "Text" ); + + // Add three rows to the table. + DataRow^ r; + r = t->NewRow(); + r[ "BackColor" ] = Color::Blue; + r[ "ForeColor" ] = Color::Yellow; + r[ "Text" ] = "Yellow on Blue"; + t->Rows->Add( r ); + r = t->NewRow(); + r[ "BackColor" ] = Color::White; + r[ "ForeColor" ] = Color::Green; + r[ "Text" ] = "Green on white"; + t->Rows->Add( r ); + r = t->NewRow(); + r[ "BackColor" ] = Color::Orange; + r[ "ForeColor" ] = Color::Black; + r[ "Text" ] = "Black on Orange"; + t->Rows->Add( r ); + return t; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..37e946cd6a8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Clear Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + GroupBox^ groupBox1; + + // +private: + void ClearAllBindings() + { + for each ( Control^ c in groupBox1->Controls ) + { + c->DataBindings->Clear(); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp new file mode 100644 index 00000000000..04735dfd054 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Control Example/CPP/source.cpp @@ -0,0 +1,18 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + void GetControl( ControlBindingsCollection^ myBindings ) + { + Control^ c = myBindings->Control; + Console::WriteLine( c ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp new file mode 100644 index 00000000000..3f63c9652f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.Remove Example/CPP/source.cpp @@ -0,0 +1,24 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void RemoveBackColorBinding() + { + Binding^ colorBinding = textBox1->DataBindings[ "BackColor" ]; + textBox1->DataBindings->Remove( colorBinding ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp new file mode 100644 index 00000000000..7217503d900 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlBindingsCollection.RemoveAt Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void RemoveThirdBinding() + { + if ( textBox1->DataBindings->Count < 3 ) + { + return; + } + textBox1->DataBindings->RemoveAt( 2 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp new file mode 100644 index 00000000000..72e6eeac1be --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ControlEventHandler Example/CPP/source.cpp @@ -0,0 +1,57 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + + // +private: + void BindControl() + { + // Create the binding first. The OrderAmount is typed as Decimal. + Binding^ b = gcnew Binding( + "Text",ds,"customers.custToOrders.OrderAmount" ); + // Add the delegates to the events. + b->Format += gcnew ConvertEventHandler( this, &Form1::DecimalToCurrencyString ); + b->Parse += gcnew ConvertEventHandler( this, &Form1::CurrencyStringToDecimal ); + text1->DataBindings->Add( b ); + } + + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // Check for the appropriate DesiredType. + if ( cevent->DesiredType != String::typeid ) + { + return; + } + + // Use the ToString method to format the value as currency ("c"). + cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); + } + + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // Check for the appropriate DesiredType. + if ( cevent->DesiredType != Decimal::typeid ) + { + return; + } + + // Convert the string back to decimal using the static Parse method. + cevent->Value = Decimal::Parse( cevent->Value->ToString(), + NumberStyles::Currency, nullptr ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp new file mode 100644 index 00000000000..43f84af9a4b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs Example/CPP/source.cpp @@ -0,0 +1,60 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + + // +private: + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts only to string type. Test this using the DesiredType. + if ( cevent->DesiredType != String::typeid ) + { + return; + } + + // Use the ToString method to format the value as currency ("c"). + cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); + } + + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts back to decimal type only. + if ( cevent->DesiredType != Decimal::typeid ) + { + return; + } + + // Converts the string back to decimal using the static Parse method. + cevent->Value = Decimal::Parse( cevent->Value->ToString(), + NumberStyles::Currency, nullptr ); + } + + void BindControl() + { + // Creates the binding first. The OrderAmount is typed as Decimal. + Binding^ b = gcnew Binding( + "Text",ds,"customers.custToOrders.OrderAmount" ); + + // Adds the delegates to the events. + b->Format += gcnew ConvertEventHandler( + this, &Form1::DecimalToCurrencyString ); + b->Parse += gcnew ConvertEventHandler( + this, &Form1::CurrencyStringToDecimal ); + text1->DataBindings->Add( b ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp new file mode 100644 index 00000000000..deba5ab77bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventArgs.DesiredType Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void DecimalToCurrencyString( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts only to string type. + if ( cevent->DesiredType != String::typeid ) + { + return; + } + + cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); + } + + void CurrencyStringToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts only to decimal type. + if ( cevent->DesiredType != Decimal::typeid ) + { + return; + } + + cevent->Value = Decimal::Parse( cevent->Value->ToString(), + NumberStyles::Currency, nullptr ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp new file mode 100644 index 00000000000..5a1c7352585 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ConvertEventHandler Example/CPP/source.cpp @@ -0,0 +1,58 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + DataSet^ ds; + + // +private: + void DecimalToCurrency( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // The method converts only to string type. Test this using the DesiredType. + if ( cevent->DesiredType != String::typeid ) + { + return; + } + + // Use the ToString method to format the value as currency ("c"). + cevent->Value = ( (Decimal^)(cevent->Value) )->ToString( "c" ); + } + + void CurrencyToDecimal( Object^ /*sender*/, ConvertEventArgs^ cevent ) + { + // ' The method converts only to decimal type. + if ( cevent->DesiredType != Decimal::typeid ) + { + return; + } + + // Converts the string back to decimal using the static ToDecimal method. + cevent->Value = Convert::ToDecimal( cevent->Value->ToString() ); + } + + void BindControl() + { + // Creates the binding first. The OrderAmount is typed as Decimal. + Binding^ b = gcnew Binding( + "Text",ds,"customers.custToOrders.OrderAmount" ); + + // Add the delegates to the events. + b->Format += gcnew ConvertEventHandler( + this, &Form1::DecimalToCurrency ); + b->Parse += gcnew ConvertEventHandler( + this, &Form1::CurrencyToDecimal ); + text1->DataBindings->Add( b ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp new file mode 100644 index 00000000000..08d9400eddf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager Example/CPP/source.cpp @@ -0,0 +1,74 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + CurrencyManager^ myCurrencyManager; + void BindControl( DataTable^ myTable ) + { + + // Bind a TextBox control to a DataTable column in a DataSet. + textBox1->DataBindings->Add( "Text", myTable, "CompanyName" ); + + // Specify the CurrencyManager for the DataTable. + this->myCurrencyManager = dynamic_cast(this->BindingContext[ myTable ]); + + // Set the initial Position of the control. + this->myCurrencyManager->Position = 0; + } + + void MoveNext( CurrencyManager^ myCurrencyManager ) + { + if ( myCurrencyManager->Position == myCurrencyManager->Count - 1 ) + { + MessageBox::Show( "You're at end of the records" ); + } + else + { + myCurrencyManager->Position += 1; + } + } + + void MoveFirst( CurrencyManager^ myCurrencyManager ) + { + myCurrencyManager->Position = 0; + } + + void MovePrevious( CurrencyManager^ myCurrencyManager ) + { + if ( myCurrencyManager->Position == 0 ) + { + MessageBox::Show( "You're at the beginning of the records." ); + } + else + { + myCurrencyManager->Position -= 1; + } + } + + void MoveLast( CurrencyManager^ myCurrencyManager ) + { + myCurrencyManager->Position = myCurrencyManager->Count - 1; + } + + // +}; + +int main() +{ + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp new file mode 100644 index 00000000000..fbaa7f24a3d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.AddNew Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataTable^ DataTable1; + +private: + + // + void AddListItem() + { + + // Get the CurrencyManager for a DataTable. + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ DataTable1 ]); + myCurrencyManager->AddNew(); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..3ed60b809ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.CancelCurrentEdit Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) + { + if ( e->KeyCode == System::Windows::Forms::Keys::Escape ) + { + + // Escape key pressed. + CurrencyManager^ gridCurrencyManager = dynamic_cast(this->BindingContext[dataGrid1->DataSource, dataGrid1->DataMember]); + gridCurrencyManager->CancelCurrentEdit(); + MessageBox::Show( "Escape!" ); + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..d29b28dcaaf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Count Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void PrintListItems() + { + + // Get the CurrencyManager of a TextBox control. + CurrencyManager^ myCurrencyManager = dynamic_cast(textBox1->BindingContext[nullptr]); + + // Presuming the list is a DataView, create a DataRowView variable. + DataRowView^ drv; + for ( int i = 0; i < myCurrencyManager->Count; i++ ) + { + myCurrencyManager->Position = i; + drv = dynamic_cast(myCurrencyManager->Current); + + // Presuming a column named CompanyName exists. + Console::WriteLine( drv[ "CompanyName" ] ); + + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp new file mode 100644 index 00000000000..0bf6ef37159 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Current Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void GetCurrentItem() + { + CurrencyManager^ myCurrencyManager; + + // Get the CurrencyManager of a TextBox control. + myCurrencyManager = dynamic_cast(textBox1->BindingContext[nullptr]); + + // Get the current item cast as a DataRowView. + DataRowView^ myDataRowView; + myDataRowView = dynamic_cast(myCurrencyManager->Current); + + // Print the column named ContactName. + Console::WriteLine( myDataRowView[ "ContactName" ] ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..add815a292e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.EndCurrentEdit Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) + { + if ( e->KeyCode == Keys::Enter ) + { + + // Enter key pressed. + CurrencyManager^ gridCurrencyManager = dynamic_cast(this->BindingContext[dataGrid1->DataSource, dataGrid1->DataMember]); + gridCurrencyManager->EndCurrentEdit(); + MessageBox::Show( "End Edit" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp new file mode 100644 index 00000000000..42f7c46e213 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.GetItemProperties Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void PrintPropertyDescriptions( BindingManagerBase^ b ) + { + Console::WriteLine( "Printing Property Descriptions" ); + PropertyDescriptorCollection^ ps = b->GetItemProperties(); + for ( int i = 0; i < ps->Count; i++ ) + { + Console::WriteLine( "\t{0}\t{1}", ps[ i ]->Name, ps[ i ]->PropertyType ); + + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..4f1d0765d56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.ItemChanged Example/CPP/source.cpp @@ -0,0 +1,51 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + CurrencyManager^ myCurrencyManager; + +private: + + // + void BindControl( DataTable^ myTable ) + { + + // Bind A TextBox control to a DataTable column in a DataSet. + textBox1->DataBindings->Add( "Text", myTable, "CompanyName" ); + + // Specify the CurrencyManager for the DataTable. + myCurrencyManager = dynamic_cast(this->BindingContext[myTable, ""]); + + // Add event handlers. + myCurrencyManager->ItemChanged += gcnew ItemChangedEventHandler( this, &Form1::CurrencyManager_ItemChanged ); + myCurrencyManager->PositionChanged += gcnew EventHandler( this, &Form1::CurrencyManager_PositionChanged ); + + // Set the initial Position of the control. + myCurrencyManager->Position = 0; + } + + void CurrencyManager_PositionChanged( Object^ sender, System::EventArgs^ /*e*/ ) + { + CurrencyManager^ myCurrencyManager = dynamic_cast(sender); + Console::WriteLine( "Position Changed {0}", myCurrencyManager->Position ); + } + + void CurrencyManager_ItemChanged( Object^ sender, System::Windows::Forms::ItemChangedEventArgs^ /*e*/ ) + { + CurrencyManager^ myCurrencyManager = dynamic_cast(sender); + Console::WriteLine( "Item Changed {0}", myCurrencyManager->Position ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp new file mode 100644 index 00000000000..05e8ef3d0fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Position Example/CPP/source.cpp @@ -0,0 +1,72 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void MoveNext( CurrencyManager^ myCurrencyManager ) + { + if ( myCurrencyManager->Count == 0 ) + { + Console::WriteLine( "No records to move to." ); + return; + } + + if ( myCurrencyManager->Position == myCurrencyManager->Count - 1 ) + { + Console::WriteLine( "You're at end of the records" ); + } + else + { + myCurrencyManager->Position += 1; + } + } + + void MoveFirst( CurrencyManager^ myCurrencyManager ) + { + if ( myCurrencyManager->Count == 0 ) + { + Console::WriteLine( "No records to move to." ); + return; + } + + myCurrencyManager->Position = 0; + } + + void MovePrevious( CurrencyManager^ myCurrencyManager ) + { + if ( myCurrencyManager->Count == 0 ) + { + Console::WriteLine( "No records to move to." ); + return; + } + + if ( myCurrencyManager->Position == 0 ) + { + Console::WriteLine( "You're at the beginning of the records." ); + } + else + { + myCurrencyManager->Position -= 1; + } + } + + void MoveLast( CurrencyManager^ myCurrencyManager ) + { + if ( myCurrencyManager->Count == 0 ) + { + Console::WriteLine( "No records to move to." ); + return; + } + myCurrencyManager->Position = myCurrencyManager->Count - 1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp new file mode 100644 index 00000000000..e789e74fb58 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.Refresh Example/CPP/source.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void DemonstrateRefresh() + { + + // Create an array with ten elements and bind to a TextBox. + array^myArray = gcnew array(10); + for ( int i = 0; i < 10; i++ ) + { + myArray[ i ] = String::Format( "item {0}", i ); + + } + textBox1->DataBindings->Add( "Text", myArray, "" ); + + // Change one value. + myArray[ 0 ] = "New value"; + + // Uncomment the next line to refresh the CurrencyManager. + // RefreshGrid(myArray); + } + + void RefreshGrid( Object^ dataSource ) + { + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ dataSource ]); + myCurrencyManager->Refresh(); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp new file mode 100644 index 00000000000..082ddfe5ade --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic CurrencyManager.RemoveAt Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void RemoveFromList() + { + + // Get the CurrencyManager of a TextBox control. + CurrencyManager^ myCurrencyManager = dynamic_cast(textBox1->BindingContext[nullptr]); + + // If the count is 0, exit the function. + if ( myCurrencyManager->Count > 1 ) + myCurrencyManager->RemoveAt( 0 ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp new file mode 100644 index 00000000000..4e332e61533 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats Example/CPP/source.cpp @@ -0,0 +1,79 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +// Creates a new type. + +[Serializable] +public ref class MyNewObject: public Object +{ +private: + String^ myValue; + +public: + + // Creates a default constructor for the class. + MyNewObject() + { + myValue = "This is the value of the class"; + } + + + property String^ MyObjectValue + { + + // Creates a property to retrieve or set the value. + String^ get() + { + return myValue; + } + + void set( String^ value ) + { + myValue = value; + } + + } + +}; + +public ref class MyClass: public Form +{ +protected: + TextBox^ textBox1; + +public: + void MyClipboardMethod() + { + + // Creates a new data format. + DataFormats::Format^ myFormat = DataFormats::GetFormat( "myFormat" ); + + /* Creates a new object and stores it in a DataObject using myFormat + * as the type of format. */ + MyNewObject^ myObject = gcnew MyNewObject; + DataObject^ myDataObject = gcnew DataObject( myFormat->Name,myObject ); + + // Copies myObject into the clipboard. + Clipboard::SetDataObject( myDataObject ); + + // Performs some processing steps. + // Retrieves the data from the clipboard. + IDataObject^ myRetrievedObject = Clipboard::GetDataObject(); + + // Converts the IDataObject type to MyNewObject type. + MyNewObject^ myDereferencedObject = dynamic_cast(myRetrievedObject->GetData( myFormat->Name )); + + // Prints the value of the Object in a textBox. + textBox1->Text = myDereferencedObject->MyObjectValue; + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp new file mode 100644 index 00000000000..1cd0194b85b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.Format.Format Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void CreateMyFormat2() + { + DataFormats::Format^ myFormat = gcnew DataFormats::Format( + "AnotherNewFormat", 20916 ); + + // Displays the contents of myFormat. + textBox1->Text = String::Format( "ID value: {0}\nFormat name: {1}", + myFormat->Id, myFormat->Name ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp new file mode 100644 index 00000000000..87ad987d9fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataFormats.GetFormat Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetMyFormatInfomation() + { + // Creates a DataFormats.Format for the Unicode data format. + DataFormats::Format^ myFormat = DataFormats::GetFormat( + DataFormats::UnicodeText ); + + // Displays the contents of myFormat. + textBox1->Text = String::Format( "ID value: {0}\nFormat name: {1}", + myFormat->Id, myFormat->Name ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp new file mode 100644 index 00000000000..56961cae479 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid Example/CPP/source.cpp @@ -0,0 +1,252 @@ + + +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +#define null 0 +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + Button^ button1; + Button^ button2; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + bool TablesAlreadyAdded; + +public: + Form1() + { + // Required for Windows Form Designer support. + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->components = gcnew System::ComponentModel::Container; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->myDataGrid = gcnew DataGrid; + this->Text = "DataGrid Control Sample"; + this->ClientSize = System::Drawing::Size( 450, 330 ); + button1->Location = System::Drawing::Point( 24, 16 ); + button1->Size = System::Drawing::Size( 120, 24 ); + button1->Text = "Change Appearance"; + button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + button2->Location = System::Drawing::Point( 150, 16 ); + button2->Size = System::Drawing::Size( 120, 24 ); + button2->Text = "Get Binding Manager"; + button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + myDataGrid->Location = System::Drawing::Point( 24, 50 ); + myDataGrid->Size = System::Drawing::Size( 300, 200 ); + myDataGrid->CaptionText = "Microsoft DataGrid Control"; + myDataGrid->MouseUp += gcnew MouseEventHandler( this, &Form1::Grid_MouseUp ); + this->Controls->Add( button1 ); + this->Controls->Add( button2 ); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + /* Bind the DataGrid to the DataSet. The dataMember + specifies that the Customers table should be displayed.*/ + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + +private: + void button1_Click( Object^ sender, System::EventArgs^ e ) + { + if ( TablesAlreadyAdded ) + return; + + AddCustomDataTableStyle(); + } + +private: + void AddCustomDataTableStyle() + { + DataGridTableStyle^ ts1 = gcnew DataGridTableStyle; + ts1->MappingName = "Customers"; + + // Set other properties. + ts1->AlternatingBackColor = Color::LightGray; + + /* Add a GridColumnStyle and set its MappingName + to the name of a DataColumn in the DataTable. + Set the HeaderText and Width properties. */ + DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn; + boolCol->MappingName = "Current"; + boolCol->HeaderText = "IsCurrent Customer"; + boolCol->Width = 150; + ts1->GridColumnStyles->Add( boolCol ); + + // Add a second column style. + DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; + TextCol->MappingName = "custName"; + TextCol->HeaderText = "Customer Name"; + TextCol->Width = 250; + ts1->GridColumnStyles->Add( TextCol ); + + // Create the second table style with columns. + DataGridTableStyle^ ts2 = gcnew DataGridTableStyle; + ts2->MappingName = "Orders"; + + // Set other properties. + ts2->AlternatingBackColor = Color::LightBlue; + + // Create new ColumnStyle objects + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + ts2->GridColumnStyles->Add( cOrderDate ); + + /* Use a PropertyDescriptor to create a formatted + column. First get the PropertyDescriptorCollection + for the data source and data member. */ + PropertyDescriptorCollection^ pcol = this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties(); + + /* Create a formatted column using a PropertyDescriptor. + The formatting character "c" specifies a currency format. */ + DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + ts2->GridColumnStyles->Add( csOrderAmount ); + + /* Add the DataGridTableStyle instances to + the GridTableStylesCollection. */ + myDataGrid->TableStyles->Add( ts1 ); + myDataGrid->TableStyles->Add( ts2 ); + + // Sets the TablesAlreadyAdded to true so this doesn't happen again. + TablesAlreadyAdded = true; + } + +private: + void button2_Click( Object^ sender, System::EventArgs^ e ) + { + BindingManagerBase^ bmGrid; + bmGrid = BindingContext[myDataSet, "Customers"]; + MessageBox::Show( String::Concat( "Current BindingManager Position: ", bmGrid->Position )->ToString() ); + } + +private: + void Grid_MouseUp( Object^ sender, MouseEventArgs^ e ) + { + // Create a HitTestInfo object using the HitTest method. + // Get the DataGrid by casting sender. + DataGrid^ myGrid = dynamic_cast(sender); + DataGrid::HitTestInfo ^ myHitInfo = myGrid->HitTest( e->X, e->Y ); + Console::WriteLine( myHitInfo ); + Console::WriteLine( myHitInfo->Type ); + Console::WriteLine( myHitInfo->Row ); + Console::WriteLine( myHitInfo->Column ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create two DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",__int32::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",__int32::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + /* Populate the tables. For each customer and order, + create need two DataRow variables. */ + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Customer1"; + tCust->Rows[ 1 ][ "custName" ] = "Customer2"; + tCust->Rows[ 2 ][ "custName" ] = "Customer3"; + + // Give the Current column a value. + tCust->Rows[ 0 ][ "Current" ] = true; + tCust->Rows[ 1 ][ "Current" ] = true; + tCust->Rows[ 2 ][ "Current" ] = false; + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp new file mode 100644 index 00000000000..1d9ac91c67a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.AllowSorting Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void ToggleAllowSorting() + { + // Toggle the AllowSorting property. + dataGrid1->AllowSorting = !dataGrid1->AllowSorting; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp new file mode 100644 index 00000000000..a679c936e12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackColor Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetBackColorAndBackgroundColor() + { + // Set the BackColor and BackgroundColor properties. + dataGrid1->BackColor = System::Drawing::Color::Blue; + dataGrid1->BackgroundColor = System::Drawing::Color::Red; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp new file mode 100644 index 00000000000..05bca3eebf0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BackgroundColor Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetGridColors() + { + dataGrid1->BackColor = System::Drawing::Color::Red; + dataGrid1->AlternatingBackColor = System::Drawing::Color::AliceBlue; + dataGrid1->BackgroundColor = System::Drawing::Color::Yellow; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..28c49a03ee0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.BeginEdit Example/CPP/source.cpp @@ -0,0 +1,52 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void EditGrid( DataGrid^ dataGrid1 ) + { + // Get the selected row and column through the CurrentCell. + int colNum; + int rowNum; + colNum = dataGrid1->CurrentCell.ColumnNumber; + rowNum = dataGrid1->CurrentCell.RowNumber; + // Get the selected DataGridColumnStyle. + DataGridColumnStyle^ dgCol; + dgCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ colNum ]; + // Invoke the BeginEdit method to see if editing can begin. + if ( dataGrid1->BeginEdit( dgCol, rowNum ) ) + { + // Edit row value. Get the DataTable and selected row. + DataTable^ myTable; + DataRow^ myRow; + // Assuming the DataGrid is bound to a DataTable. + myTable = (DataTable^)(dataGrid1->DataSource); + myRow = myTable->Rows[ rowNum ]; + // Invoke the Row object's BeginEdit method. + myRow->BeginEdit(); + myRow[ colNum ] = "New Value"; + // You must accept changes on both DataRow and DataTable. + myRow->AcceptChanges(); + myTable->AcceptChanges(); + dataGrid1->EndEdit( dgCol, rowNum, false ); + } + else + { + Console::WriteLine( "BeginEdit failed" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp new file mode 100644 index 00000000000..5762f055469 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CaptionText Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + void Method() + { + + // + if ( dataGrid1->CaptionText == "" ) + { + dataGrid1->CaptionText = "Microsoft DataGrid"; + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp new file mode 100644 index 00000000000..d4a804be5e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentCell Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetCellWithFocus( DataGrid^ myGrid ) + { + // Set the current cell to cell1, row 1. + myGrid->CurrentCell = DataGridCell( 1, 1 ); + } + + void dataGrid1_GotFocus( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Console::WriteLine( "{0} {1}", dataGrid1->CurrentCell.ColumnNumber, + dataGrid1->CurrentCell.RowNumber ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp new file mode 100644 index 00000000000..d8b718d9504 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.CurrentRowIndex Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void GetSelectedIndex( DataGrid^ myGrid ) + { + Console::WriteLine( myGrid->CurrentRowIndex ); + } + + void SetSelectedIndex( DataGrid^ myGrid, int selIndex ) + { + myGrid->CurrentRowIndex = selIndex; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp new file mode 100644 index 00000000000..539f6556019 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataMember Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +protected: + Object^ source; + +private: + void SetSourceAndMember() + { + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ tableCustomers = gcnew DataTable( "Customers" ); + myDataSet->Tables->Add( tableCustomers ); + // Insert code to populate the DataSet. + + // Set DataSource and DataMember with SetDataBinding method. + String^ member; + + // The name of a DataTable is Customers. + member = "Customers"; + dataGrid1->SetDataBinding( myDataSet, member ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp new file mode 100644 index 00000000000..15f5b0b3e23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSource Example/CPP/source.cpp @@ -0,0 +1,54 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void BindToDataView( DataGrid^ myGrid ) + { + // Create a DataView using the DataTable. + DataTable^ myTable = gcnew DataTable( "Suppliers" ); + // Insert code to create and populate columns. + DataView^ myDataView = gcnew DataView( myTable ); + myGrid->DataSource = myDataView; + } + + void BindToDataSet( DataGrid^ myGrid ) + { + // Create a DataSet. + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + // Insert code to populate DataSet with several tables. + myGrid->DataSource = myDataSet; + // Use the DataMember property to specify the DataTable. + myGrid->DataMember = "Suppliers"; + } + + DataView^ GetDataViewFromDataSource() + { + // Create a DataTable variable, and set it to the DataSource. + DataView^ myDataView; + myDataView = (DataView^)(dataGrid1->DataSource); + return myDataView; + } + + DataSet^ GetDataSetFromDataSource() + { + // Create a DataSet variable, and set it to the DataSource. + DataSet^ myDataSet; + myDataSet = (DataSet^)(dataGrid1->DataSource); + return myDataSet; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..d7dd51bc50c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.DataSourceChanged Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + System::Windows::Forms::DataGrid^ dataGrid1; + + void CreateDataGrid() + { + dataGrid1 = gcnew DataGrid; + // Add the handler for the DataSourceChanged event. + dataGrid1->DataSourceChanged += gcnew EventHandler( + this, &Form1::DataGrid1_DataSourceChanged ); + } + + void DataGrid1_DataSourceChanged( Object^ sender, EventArgs^ /*e*/ ) + { + DataGrid^ thisGrid = dynamic_cast(sender); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..6daee01f18f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.EndEdit Example/CPP/source.cpp @@ -0,0 +1,35 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ ds; + +private: + + // + void EditValue() + { + int rowtoedit = 1; + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ ds->Tables[ "Suppliers" ] ]); + myCurrencyManager->Position = rowtoedit; + DataGridColumnStyle^ dgc = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]; + dataGrid1->BeginEdit( dgc, rowtoedit ); + + // Insert code to edit the value. + dataGrid1->EndEdit( dgc, rowtoedit, false ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp new file mode 100644 index 00000000000..42e054da89d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds Example/CPP/source.cpp @@ -0,0 +1,50 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ myDataSet; + + // +private: + void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e ) + { + + // Use the HitTest method to get a HitTestInfo object. + System::Windows::Forms::DataGrid::HitTestInfo^ hi; + DataGrid^ grid = dynamic_cast(sender); + hi = grid->HitTest( e->X, e->Y ); + + // Test if the clicked area was a cell. + if ( hi->Type == DataGrid::HitTestType::Cell ) + { + + // If it's a cell, get the GridTable and CurrencyManager of the + // clicked table. + DataGridTableStyle^ dgt = dataGrid1->TableStyles[ 0 ]; + CurrencyManager^ myCurrencyManager = dynamic_cast(BindingContext[ myDataSet->Tables[ dataGrid1->DataMember ] ]); + + // Get the Rectangle of the clicked cell. + Rectangle cellRect; + cellRect = grid->GetCellBounds( hi->Row, hi->Column ); + + // Get the clicked DataGridTextBoxColumn. + DataGridTextBoxColumn^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); + + // Insert code to edit the value. + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp new file mode 100644 index 00000000000..d31d2875768 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCellBounds1 Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +protected: + DataGridCell dgc; + + void GetRect() + { + Rectangle rect; + dgc.ColumnNumber = 0; + dgc.RowNumber = 0; + rect = dataGrid1->GetCellBounds( dgc ); + Console::WriteLine( rect ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp new file mode 100644 index 00000000000..9d09cdb2c2f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GetCurrentCellBounds Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_CurrentCellChange( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Rectangle rect; + rect = dataGrid1->GetCurrentCellBounds(); + Console::WriteLine( rect ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp new file mode 100644 index 00000000000..056b856882d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.GridLineColor Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetGridLineColor( + DataGrid^ myGrid, System::Drawing::Color newcolor ) + { + myGrid->GridLineColor = newcolor; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp new file mode 100644 index 00000000000..3ef01fa7245 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + Console::WriteLine(); + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + // Use the DataGrid control's HitTest method with the x and y properties. + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( myHitTest ); + Console::WriteLine( "Column {0}", myHitTest->Column ); + Console::WriteLine( "Row {0}", myHitTest->Row ); + Console::WriteLine( "Type {0}", myHitTest->Type ); + Console::WriteLine( "ToString {0}", myHitTest ); + Console::WriteLine( "Hit {0}", myHitTest->Type ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp new file mode 100644 index 00000000000..cefe8f80b66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Column Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + String^ newLine = "\n"; + Console::WriteLine( newLine ); + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + /* Use the DataGrid control's HitTest method with + the x and y properties. */ + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( "Column {0}", myHitTest->Column ); + Console::WriteLine( "Row {0}", myHitTest->Row ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp new file mode 100644 index 00000000000..d9c5c8b4cb6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.GetHashCode Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + String^ newLine = "\n"; + Console::WriteLine( newLine ); + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + // Use the DataGrid control's HitTest method with the x and y properties. + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( "Hashcode {0}", myHitTest->GetHashCode() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp new file mode 100644 index 00000000000..b2049b049a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Nowhere Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + if ( dataGrid1->HitTest( e->X, e->Y )->Equals( + DataGrid::HitTestInfo::Nowhere ) ) + { + Console::WriteLine( "Nowhere" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp new file mode 100644 index 00000000000..a682f39c48c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Row Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + String^ newLine = "\n"; + Console::WriteLine( newLine ); + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + // Use the DataGrid control's HitTest method with the x and y properties. + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( "Column {0}", myHitTest->Column ); + Console::WriteLine( "Row {0}", myHitTest->Row ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp new file mode 100644 index 00000000000..02b3dbb18dd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.ToString Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + // Use the DataGrid control's HitTest method with the x and y properties. + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( "ToString {0}", myHitTest->ToString() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp new file mode 100644 index 00000000000..10c0ed877b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestInfo.Type Example/CPP/source.cpp @@ -0,0 +1,64 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + String^ newLine = "\n"; + Console::WriteLine( newLine ); + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + // Use the DataGrid control's HitTest method with the x and y properties. + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( "Hit {0}", ReturnHitTest( myHitTest->Type ) ); + } + + String^ ReturnHitTest( + System::Windows::Forms::DataGrid::HitTestType hit ) + { + // Use this function to return the part of the grid clicked. + switch ( hit ) + { + case(System::Windows::Forms::DataGrid::HitTestType::Cell): + return "Cell"; + + case(System::Windows::Forms::DataGrid::HitTestType::Caption): + return "Caption"; + + case(System::Windows::Forms::DataGrid::HitTestType::ColumnHeader): + return "ColumnHeader"; + + case(System::Windows::Forms::DataGrid::HitTestType::ColumnResize): + return "Resize"; + + case(System::Windows::Forms::DataGrid::HitTestType::ParentRows): + return "ParentRows"; + + case(System::Windows::Forms::DataGrid::HitTestType::RowHeader): + return "RowHeader"; + + case(System::Windows::Forms::DataGrid::HitTestType::RowResize): + return "RowResize"; + + case(System::Windows::Forms::DataGrid::HitTestType::None): + return "None"; + + default: + return "Unknown"; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp new file mode 100644 index 00000000000..1bba95278ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.HitTestType Example/CPP/source.cpp @@ -0,0 +1,69 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void dataGrid1_MouseDown( Object^ /*sender*/, + System::Windows::Forms::MouseEventArgs^ e ) + { + String^ newLine = "\n"; + Console::WriteLine( newLine ); + System::Windows::Forms::DataGrid::HitTestInfo^ myHitTest; + // Use the DataGrid control's HitTest method with the x and y properties. + myHitTest = dataGrid1->HitTest( e->X, e->Y ); + Console::WriteLine( myHitTest ); + Console::WriteLine( "Column {0}", myHitTest->Column ); + Console::WriteLine( "Row {0}", myHitTest->Row ); + Console::WriteLine( "Type {0}", myHitTest->Type ); + Console::WriteLine( "ToString {0}", myHitTest ); + Console::WriteLine( "Hit {0}", ReturnHitTest( myHitTest->Type ) ); + } + + String^ ReturnHitTest( + System::Windows::Forms::DataGrid::HitTestType hit ) + { + // Use this function to return the part of the grid clicked. + switch ( hit ) + { + case(System::Windows::Forms::DataGrid::HitTestType::Cell): + return "Cell"; + + case(System::Windows::Forms::DataGrid::HitTestType::Caption): + return "Caption"; + + case(System::Windows::Forms::DataGrid::HitTestType::ColumnHeader): + return "ColumnHeader"; + + case(System::Windows::Forms::DataGrid::HitTestType::ColumnResize): + return "Resize"; + + case(System::Windows::Forms::DataGrid::HitTestType::ParentRows): + return "ParentRows"; + + case(System::Windows::Forms::DataGrid::HitTestType::RowHeader): + return "RowHeader"; + + case(System::Windows::Forms::DataGrid::HitTestType::RowResize): + return "RowResize"; + + case(System::Windows::Forms::DataGrid::HitTestType::None): + return "None"; + + default: + return "Unknown"; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp new file mode 100644 index 00000000000..fa43be4593e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.IsExpanded Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +protected: + void TextExpanded( DataGrid^ myGrid ) + { + // Get the DataTable of the grid + DataTable^ myTable; + // Assuming the grid is bound to a DataTable + myTable = (DataTable^)(myGrid->DataSource); + for ( int i = 0; i < myTable->Rows->Count; i++ ) + { + if ( myGrid->IsExpanded( i ) ) + { + Console::WriteLine( "Row {0} was expanded", i ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp new file mode 100644 index 00000000000..af08b0a2a40 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.PreferredRowHeight Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void ChangeFontHeight( DataGrid^ myGrid ) + { + myGrid->Font = gcnew System::Drawing::Font( + "Microsoft Sans Serif", + 15, System::Drawing::FontStyle::Regular ); + myGrid->PreferredRowHeight = myGrid->Font->Height; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp new file mode 100644 index 00000000000..f4dd87f8055 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.SetDataBinding Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void BindControls() + { + // Creates a DataSet named SuppliersProducts. + DataSet^ SuppliersProducts = gcnew DataSet( "SuppliersProducts" ); + // Adds two DataTable objects, Suppliers and Products. + SuppliersProducts->Tables->Add( gcnew DataTable( "Suppliers" ) ); + SuppliersProducts->Tables->Add( gcnew DataTable( "Products" ) ); + // Insert code to add DataColumn objects. + // Insert code to fill tables with columns and data. + // Binds the DataGrid to the DataSet, displaying the Suppliers table. + dataGrid1->SetDataBinding( SuppliersProducts, "Suppliers" ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp new file mode 100644 index 00000000000..243437170c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.TableStyles Example/CPP/source.cpp @@ -0,0 +1,47 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + void AddTables( DataGrid^ myDataGrid, DataSet^ myDataSet ) + { + for each ( DataTable^ t in myDataSet->Tables ) + { + DataGridTableStyle^ myGridTableStyle = + gcnew DataGridTableStyle; + myGridTableStyle->MappingName = t->TableName; + myDataGrid->TableStyles->Add( myGridTableStyle ); + + /* Note that DataGridColumnStyle objects will + be created automatically for the first DataGridTableStyle + when you add it to the GridTableStylesCollection.*/ + } + } + + void PrintGridStyleInfo( DataGrid^ myDataGrid ) + { + /* Print the MappingName of each DataGridTableStyle, + and the MappingName of each DataGridColumnStyle. */ + for each ( DataGridTableStyle^ myGridStyle in + myDataGrid->TableStyles ) + { + Console::WriteLine( myGridStyle->MappingName ); + for each ( DataGridColumnStyle^ myColumnStyle in + myGridStyle->GridColumnStyles ) + { + Console::WriteLine( myColumnStyle->MappingName ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp new file mode 100644 index 00000000000..d401aebe8a3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this Example/CPP/source.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + + // + void PrintCellValues( DataGrid^ myGrid ) + { + int iRow; + int iCol; + DataTable^ myTable; + + // Assumes the DataGrid is bound to a DataTable. + myTable = dynamic_cast(dataGrid1->DataSource); + for ( iRow = 0; iRow < myTable->Rows->Count; iRow++ ) + { + for ( iCol = 0; iCol < myTable->Columns->Count; iCol++ ) + { + Console::WriteLine( myGrid[iRow, iCol] ); + + } + + } + } + + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp new file mode 100644 index 00000000000..ad7d1c20863 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGrid.this1 Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + + // + void SetCellValue( DataGrid^ myGrid ) + { + DataGridCell myCell; + + // Use an arbitrary cell. + myCell.RowNumber = 1; + myCell.ColumnNumber = 1; + + // Change the cell's value using the CurrentCell. + myGrid[ myCell ] = "New Value"; + } + + void GetCellValue( DataGrid^ myGrid ) + { + DataGridCell myCell; + + // Use and arbitrary cell. + myCell.RowNumber = 1; + myCell.ColumnNumber = 1; + Console::WriteLine( myGrid[ myCell ] ); + } + + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp new file mode 100644 index 00000000000..30151e96eba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + + // + void AddDataGridBoolColumnStyle() + { + DataGridBoolColumn^ myColumn = gcnew DataGridBoolColumn; + myColumn->MappingName = "Current"; + myColumn->Width = 200; + dataGrid1->TableStyles[ "Customers" ]->GridColumnStyles->Add( myColumn ); + } + + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp new file mode 100644 index 00000000000..b8a8def70c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.AllowNull Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + + // + void SetAllowNull() + { + DataGridBoolColumn^ myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]); + myGridColumn->AllowNull = false; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp new file mode 100644 index 00000000000..ea84cf607db --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.DataGridBoolColumn1 Example/CPP/source.cpp @@ -0,0 +1,40 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ ds; + +private: + + // + void CreateNewDataGridColumn() + { + System::Windows::Forms::GridColumnStylesCollection^ myGridColumnCol; + myGridColumnCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles; + + // Get the CurrencyManager for the table. + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ ds->Tables[ "Products" ] ]); + + /* Get the PropertyDescriptor for the DataColumn of the new column. + The column should contain a Boolean value. */ + PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "Discontinued" ]; + DataGridColumnStyle^ myColumn = gcnew System::Windows::Forms::DataGridBoolColumn( pd ); + myColumn->MappingName = "Discontinued"; + myGridColumnCol->Add( myColumn ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp new file mode 100644 index 00000000000..94a26939b1e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.EnterNullValue Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Class1 +{ +protected: + DataGrid^ dataGrid1; + + // +private: + + void EnterNull() + { + + // Creates an instance of a class derived from DataGridBoolColumn. + MyDataGridBoolColumn^ colBool; + colBool = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 2 ]); + colBool->CallEnterNullValue(); + } + + +internal: + + // Class derived from DataGridBoolColumn. + ref class MyDataGridBoolColumn: public DataGridBoolColumn + { + public: + void CallEnterNullValue() + { + this->EnterNullValue(); + } + + }; + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp new file mode 100644 index 00000000000..a589a3f2638 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridBoolColumn.TrueValue Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ DataSet1; + + // +private: + + void SetBoolColumnValues() + { + DataGridBoolColumn^ myGridColumn; + + // Get the DataGridBoolColumn you are setting. + myGridColumn = dynamic_cast(myDataGrid->TableStyles[ "Customers" ]->GridColumnStyles[ "Current" ]); + + // Set TrueValue, FalseValue, and NullValue. + myGridColumn->TrueValue = true; + myGridColumn->FalseValue = false; + myGridColumn->NullValue = Convert::DBNull; + } + + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp new file mode 100644 index 00000000000..fc869cd8f19 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell Example/CPP/source.cpp @@ -0,0 +1,42 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ DataGrid1; + +private: + + // + void PrintCellRowAndCol() + { + DataGridCell^ myCell; + myCell = DataGrid1->CurrentCell; + Console::WriteLine( myCell->RowNumber ); + Console::WriteLine( myCell->ColumnNumber ); + + // Prints the value of the cell through the DataTable. + DataTable^ myTable; + + // Assumes the DataGrid is bound to a DataTable. + myTable = dynamic_cast(DataGrid1->DataSource); + Console::WriteLine( myTable->Rows[ myCell->RowNumber ][ myCell->ColumnNumber ] ); + } + + // +}; + +int main() +{ + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp new file mode 100644 index 00000000000..e4a98fe74a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ColumnNumber Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ DataGrid1; + +private: + + // + void PrintCell( Object^ sender, MouseEventArgs^ /*e*/ ) + { + DataGrid^ thisGrid = dynamic_cast(sender); + DataGridCell myDataGridCell = thisGrid->CurrentCell; + BindingManagerBase^ bm = BindingContext[ thisGrid->DataSource,thisGrid->DataMember ]; + DataRowView^ drv = dynamic_cast(bm->Current); + Console::WriteLine( drv[ myDataGridCell.ColumnNumber ] ); + Console::WriteLine( myDataGridCell.RowNumber ); + } + + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp new file mode 100644 index 00000000000..d5ad9ec5dc8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.DataGridCell Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetCell() + { + // Set the focus to the cell specified by the DataGridCell. + DataGridCell dc; + dc.RowNumber = 1; + dc.ColumnNumber = 1; + dataGrid1->CurrentCell = dc; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp new file mode 100644 index 00000000000..f8239e9fece --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.GetHashCode Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + Hashtable^ myHashTable; + +public: + Form1() + { + myHashTable = gcnew Hashtable; + } + +private: + void Grid_MouseUp( Object^ sender, System::Windows::Forms::MouseEventArgs^ /*e*/ ) + { + DataGrid^ dg = dynamic_cast(sender); + DataGridCell myCell = dg->CurrentCell; + String^ tempkey = myCell.ToString(); + Console::WriteLine( "Temp {0}", tempkey ); + if ( myHashTable->Contains( tempkey ) ) + { + return; + } + myHashTable->Add( tempkey, myCell.GetHashCode() ); + Console::WriteLine( "Hashcode: {0}", myCell.GetHashCode() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp new file mode 100644 index 00000000000..a0029f0a09b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridCell.ToString Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void Grid_MouseUp( + Object^ sender, System::Windows::Forms::MouseEventArgs^ /*e*/ ) + { + DataGrid^ dg = (DataGrid^)(sender); + DataGridCell myCell = dg->CurrentCell; + Console::WriteLine( myCell.ToString() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp new file mode 100644 index 00000000000..ecee2ffd7fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CheckValidDataSource Example/CPP/source.cpp @@ -0,0 +1,68 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace MyNameSpace +{ + ref class MyDataGridColumnStyle: public DataGridColumnStyle + { + // + private: + void CheckCurrencyManager( CurrencyManager^ myCurrencyManager ) + { + // This code is from a class named MyDataGridColumnStyle derived + // from DataGridColumnStyle. + MyDataGridColumnStyle^ myGridColumn = this; + try + { + myGridColumn->CheckValidDataSource( myCurrencyManager ); + } + catch ( ArgumentNullException^ e ) + { + Console::WriteLine( e->Message ); + } + catch ( ApplicationException^ e ) + { + Console::WriteLine( e->Message ); + } + } + // + + protected: + virtual void Edit( System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, System::Drawing::Rectangle /*bounds*/, bool /*readOnly1*/, String^ /*displayText*/, bool /*cellIsVisiblen*/ ) override {} + + virtual bool Commit( System::Windows::Forms::CurrencyManager^ /*dataSource*/, int /*rowNum*/ ) override + { + return true; + } + + virtual System::Drawing::Size GetPreferredSize( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override + { + return Size( Point( 1, 2 ) ); + } + + virtual int GetPreferredHeight( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override + { + return 1; + } + + virtual int GetMinimumHeight() override + { + return 1; + } + + virtual void Abort( int /*rowNum*/ ) override {} + + virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, bool /*b*/ ) override {} + + virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/ ) override {} + + }; + +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp new file mode 100644 index 00000000000..f9604b0ce32 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ConcedeFocus Example/CPP/source.cpp @@ -0,0 +1,53 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace MyNameSpace +{ + ref class MyDataGridColumnStyle: public DataGridTextBoxColumn + { + // + protected: + virtual void ConcedeFocus() override + { + // Hide the TextBox when conceding focus. + DataGridTextBoxColumn::TextBox->Visible = false; + } + // + + virtual void Edit( System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, System::Drawing::Rectangle /*bounds*/, bool /*readOnly1*/, String^ /*displayText*/, bool /*cellIsVisiblen*/ ) override {} + + virtual bool Commit( System::Windows::Forms::CurrencyManager^ /*dataSource*/, int /*rowNum*/ ) override + { + return true; + } + + virtual System::Drawing::Size GetPreferredSize( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override + { + return Size(Point(1,2)); + } + + virtual int GetPreferredHeight( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override + { + return 1; + } + + virtual int GetMinimumHeight() override + { + return 1; + } + + virtual void Abort( int /*rowNum*/ ) override {} + + virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, bool /*b*/ ) override {} + + virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/ ) override {} + + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp new file mode 100644 index 00000000000..98eda1d9f79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.CreateHeaderAccessibleObject Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void GetDataGrid( DataGridTableStyle^ thisColumn ) + { + DataGrid^ myDataGrid; + + // Get the DataGrid of the column. + myDataGrid = thisColumn->DataGrid; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp new file mode 100644 index 00000000000..054734d1d25 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.DataGridColumnStyle1 Example/CPP/source.cpp @@ -0,0 +1,40 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + + // + void CreateNewDataGridColumnStyle() + { + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + + // Insert code to populate the DataSet. + // Get the CurrencyManager for the table you want to add a column to. + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[myDataSet, "Suppliers"]); + + // Get the PropertyDescriptor for the DataColumn. + PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "City" ]; + + // Construct the DataGridColumnStyle with the PropertyDescriptor. + DataGridColumnStyle^ myColumn = gcnew DataGridTextBoxColumn( pd ); + myColumn->MappingName = "City"; + dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumn ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp new file mode 100644 index 00000000000..cd36dd551b2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.Edit1 Example/CPP/source.cpp @@ -0,0 +1,57 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class Form1: public Form +{ +private: + DataSet^ myDataSet; + void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e ) + { + // Use the HitTest method to get a HitTestInfo object. + System::Windows::Forms::DataGrid::HitTestInfo^ hi; + DataGrid^ grid = dynamic_cast(sender); + hi = grid->HitTest( e->X, e->Y ); + + // Test if the clicked area was a cell. + if ( hi->Type == DataGrid::HitTestType::Cell ) + { + // If it's a cell, get the GridTable and CurrencyManager of the + // clicked table. + DataGridTableStyle^ dgt = grid->TableStyles[ 0 ]; + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]); + + // Get the Rectangle of the clicked cell. + Rectangle cellRect; + cellRect = grid->GetCellBounds( hi->Row, hi->Column ); + + // Get the clicked DataGridTextBoxColumn. + MyColumnStyle ^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); + + // Edit the value. + gridCol->EditVal( myCurrencyManager, hi->Row, cellRect, false, "New Text" ); + } + } + + +public: + ref class MyColumnStyle: public DataGridTextBoxColumn + { + public: + void EditVal( CurrencyManager^ cm, int row, Rectangle rec, bool readOnly, String^ text ) + { + this->Edit( cm, row, rec, readOnly, text ); + } + }; +}; +// + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp new file mode 100644 index 00000000000..4969f0f0f69 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetMinimumHeight Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridBoolColumn +{ +public: + int GetMinHeight() + { + return this->GetMinimumHeight(); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + void GetHeight() + { + MyGridColumn^ myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 1 ]->GridColumnStyles[ 0 ]); + Console::WriteLine( myGridColumn->GetMinHeight() ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp new file mode 100644 index 00000000000..dfad6354bbd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredHeight Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridTextBoxColumn +{ +public: + int GetPrefHeight( Graphics^ g, String^ thisString ) + { + return this->GetPreferredHeight( g, thisString ); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + void GetHeight() + { + MyGridColumn^ myGridColumn; + + // Get a DataGridColumnStyle of a DataGrid control. + myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); + + // Create a Graphics object. + Graphics^ g = this->CreateGraphics(); + Console::WriteLine( myGridColumn->GetPrefHeight( g, "A string" ) ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp new file mode 100644 index 00000000000..813c28a73ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.GetPreferredSize Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridTextBoxColumn +{ +public: + Size GetPrefSize( Graphics^ g, String^ thisString ) + { + return this->GetPreferredSize( g, thisString ); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + void GetHeight() + { + MyGridColumn^ myGridColumn; + + // Get a DataGridColumnStyle of a DataGrid control. + myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); + + // Create a Graphics object. + Graphics^ g = this->CreateGraphics(); + System::Drawing::Size s = myGridColumn->GetPrefSize( g, "A string" ); + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp new file mode 100644 index 00000000000..7ed7b2b5311 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.HeaderText Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ dataSet1; + +private: + + // + void SetHeaderText() + { + DataGridColumnStyle^ dgCol; + DataColumn^ dataCol1; + DataTable^ dataTable1; + dgCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]; + dataTable1 = dataSet1->Tables[ dataGrid1->DataMember ]; + dataCol1 = dataTable1->Columns[ dgCol->MappingName ]; + dgCol->HeaderText = dataCol1->Caption; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp new file mode 100644 index 00000000000..21746b4e3d5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.NullText Example/CPP/source.cpp @@ -0,0 +1,27 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetNullText() + { + DataGridColumnStyle^ myGridColumn; + myGridColumn = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]; + myGridColumn->NullText = "Null Text"; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp new file mode 100644 index 00000000000..8ffe9c807d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.PropertyDescriptor Example/CPP/source.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ ds; + + // +private: + void GetPropertyDescriptor() + { + PropertyDescriptor^ pd; + pd = dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 0 ]->PropertyDescriptor; + Console::WriteLine( pd ); + } + + void CreateNewDataGridColumnStyle() + { + GridColumnStylesCollection^ myGridColumnCol; + myGridColumnCol = dataGrid1->TableStyles[ 0 ]->GridColumnStyles; + + // Get the CurrencyManager for the table you want to add a column to. + CurrencyManager^ myCurrencyManager = dynamic_cast(this->BindingContext[ ds->Tables[ "Suppliers" ] ]); + + // Get the PropertyDescriptor for the DataColumn of the new column. + PropertyDescriptor^ pd = myCurrencyManager->GetItemProperties()[ "City" ]; + DataGridColumnStyle^ myColumn = gcnew DataGridTextBoxColumn( pd ); + myGridColumnCol->Add( myColumn ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..3755678bed0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.ReadOnly Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ dataSet1; + +private: + + // + void SetReadOnly() + { + DataColumnCollection^ myDataColumns; + + // Get the columns for a table bound to a DataGrid. + myDataColumns = dataSet1->Tables[ "Suppliers" ]->Columns; + System::Collections::IEnumerator^ myEnum = myDataColumns->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataColumn^ dataColumn = safe_cast(myEnum->Current); + dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ dataColumn->ColumnName ]->ReadOnly = dataColumn->ReadOnly; + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp new file mode 100644 index 00000000000..dd5183d63da --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridColumnStyle.UpdateUI Example/CPP/source.cpp @@ -0,0 +1,73 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace MyNameSpace +{ + ref class MyDataGridColumnStyle: public DataGridTextBoxColumn + { + private: + CurrencyManager^ myCurrencyManager; + DataGrid^ dataGrid1; + + // + void UpdateGridUI() + { + + // Get the MyDataGridColumnStyle to update. + // MyDataGridColumnStyle is a class derived from DataGridColumnStyle. + MyDataGridColumnStyle^ myGridColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); + + // Call UpdateUI. + myGridColumn->UpdateUI( myCurrencyManager, 10, "my new value" ); + } + // + + + protected: + + void SetDataGrid( DataGrid^ dataGrid2, CurrencyManager^ curMan2 ) + { + myCurrencyManager = curMan2; + dataGrid1 = dataGrid2; + } + + virtual void Edit( System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, System::Drawing::Rectangle /*bounds*/, bool /*readOnly1*/, String^ /*displayText*/, bool /*cellIsVisiblen*/ ) override {} + + virtual bool Commit( System::Windows::Forms::CurrencyManager^ /*dataSource*/, int /*rowNum*/ ) override + { + return true; + } + + virtual System::Drawing::Size GetPreferredSize( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override + { + return Size(Point(1,2)); + } + + virtual int GetPreferredHeight( System::Drawing::Graphics^ /*g*/, Object^ /*value*/ ) override + { + return 1; + } + + virtual int GetMinimumHeight() override + { + return 1; + } + + virtual void Abort( int /*rowNum*/ ) override {} + + virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/, bool /*b*/ ) override {} + + virtual void Paint( System::Drawing::Graphics^ /*g*/, System::Drawing::Rectangle /*bounds*/, System::Windows::Forms::CurrencyManager^ /*source*/, int /*rowNum*/ ) override{} + + }; + +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..3e4c3ad472a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridLineStyle Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void SetGridLineAttributes() + { + dataGrid1->GridLineStyle = DataGridLineStyle::None; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..f9950f13cde --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle Example/CPP/source.cpp @@ -0,0 +1,75 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + +private: + + // + void AddCustomDataTableStyle() + { + + /* Create a new DataGridTableStyle and set + its MappingName to the TableName of a DataTable. */ + DataGridTableStyle^ ts1 = gcnew DataGridTableStyle; + ts1->MappingName = "Customers"; + + /* Add a GridColumnStyle and set its MappingName + to the name of a DataColumn in the DataTable. + Set the HeaderText and Width properties. */ + DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn; + boolCol->MappingName = "Current"; + boolCol->HeaderText = "IsCurrent Customer"; + boolCol->Width = 150; + ts1->GridColumnStyles->Add( boolCol ); + + // Add a second column style. + DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; + TextCol->MappingName = "custName"; + TextCol->HeaderText = "Customer Name"; + TextCol->Width = 250; + ts1->GridColumnStyles->Add( TextCol ); + + // Create the second table style with columns. + DataGridTableStyle^ ts2 = gcnew DataGridTableStyle; + ts2->MappingName = "Orders"; + + // Change the colors. + ts2->ForeColor = Color::Yellow; + ts2->AlternatingBackColor = Color::Blue; + ts2->BackColor = Color::Blue; + + // Create new DataGridColumnStyle objects. + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + ts2->GridColumnStyles->Add( cOrderDate ); + PropertyDescriptorCollection^ pcol = this->BindingContext[ myDataSet,"Customers.custToOrders" ]->GetItemProperties(); + DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + ts2->GridColumnStyles->Add( csOrderAmount ); + + // Add the DataGridTableStyle objects to the collection. + myDataGrid->TableStyles->Add( ts1 ); + myDataGrid->TableStyles->Add( ts2 ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..c09b0d08744 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.BeginEdit Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using +#using +#using + +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + + // +private: + void EditTable() + { + DataGridTableStyle^ dgt = myDataGrid->TableStyles[ 0 ]; + DataGridColumnStyle^ myCol = dgt->GridColumnStyles[ 0 ]; + dgt->BeginEdit( myCol, 1 ); + dgt->EndEdit( myCol, 1, true ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp new file mode 100644 index 00000000000..0a998cd743a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGrid Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + + // +private: + void GetSelectedIndex( DataGridTableStyle^ myGridTable ) + { + /* Get the name of the DataGrid of the DataGridTable + passed as an argument. */ + Console::WriteLine( myGridTable->DataGrid->CurrentCell.ToString() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..ba8e4036349 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ myDataSet; + + // +private: + void AddGridTable() + { + DataGridTableStyle^ myGridTableStyle; + myGridTableStyle = gcnew DataGridTableStyle; + myGridTableStyle->MappingName = "Customers"; + dataGrid1->TableStyles->Add( myGridTableStyle ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp new file mode 100644 index 00000000000..1a7c5f41e73 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.DataGridTableStyle2 Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + + // +private: + void CreateDataGridGridTableStyle() + { + CurrencyManager^ myCurrencyManager; + DataGridTableStyle^ myGridTableStyle; + + /* Get the CurrencyManager for a DataTable named "Customers" + found in a DataSet named "myDataSet". */ + myCurrencyManager = dynamic_cast(BindingContext[myDataSet, "Customers"]); + myGridTableStyle = gcnew DataGridTableStyle( myCurrencyManager ); + + // Add the table style to the collection of a DataGrid. + myDataGrid->TableStyles->Add( myGridTableStyle ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp new file mode 100644 index 00000000000..fa44d54187b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.EndEdit Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + + // +private: + void EditTable() + { + DataGridTableStyle^ dgt = myDataGrid->TableStyles[ 0 ]; + DataGridColumnStyle^ myCol = dgt->GridColumnStyles[ 0 ]; + dgt->BeginEdit( myCol, 1 ); + dgt->EndEdit( myCol, 1, true ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp new file mode 100644 index 00000000000..999171be739 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.GridColumnStyles Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + + // +private: + void WriteMappingNames() + { + for each ( DataGridTableStyle^ dgt in myDataGrid->TableStyles ) + { + Console::WriteLine( dgt->MappingName ); + for each ( DataGridColumnStyle^ dgc in dgt->GridColumnStyles ) + { + Console::WriteLine( dgc->MappingName ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..88cb8930293 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTableStyle.ReadOnly Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ myDataSet; + + // +private: + void PrintReadOnlyValues() + { + for each ( DataGridTableStyle^ tableStyle in dataGrid1->TableStyles ) + { + Console::WriteLine( tableStyle->ReadOnly ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp new file mode 100644 index 00000000000..5df9ccfa149 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBox Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void GetDataGridTextBox() + { + + // Get the DataGridTextBoxColumn from the DataGrid control. + DataGridTextBoxColumn^ myTextBoxColumn; + + // Assuming the CompanyName column is a DataGridTextBoxColumn. + myTextBoxColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ "CompanyName" ]); + + // Get the DataGridTextBox for the column. + DataGridTextBox^ myGridTextBox; + myGridTextBox = dynamic_cast(myTextBoxColumn->TextBox); + } + + // +}; + +int main() +{ + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp new file mode 100644 index 00000000000..8e622562c64 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn1 Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void AddColumn() + { + DataTable^ myTable = gcnew DataTable; + + // Add a new DataColumn to the DataTable. + DataColumn^ myColumn = gcnew DataColumn( "myTextBoxColumn" ); + myColumn->DataType = System::Type::GetType( "System::String" ); + myColumn->DefaultValue = "default string"; + myTable->Columns->Add( myColumn ); + + // Get the CurrencyManager for the DataTable. + CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myTable ]); + + // Use the CurrencyManager to get the PropertyDescriptor for the new column. + System::ComponentModel::PropertyDescriptor^ pd = cm->GetItemProperties()[ "myTextBoxColumn" ]; + DataGridTextBoxColumn^ myColumnTextColumn; + + // Create the DataGridTextBoxColumn with the PropertyDescriptor. + myColumnTextColumn = gcnew DataGridTextBoxColumn( pd ); + + // Add the new DataGridColumn to the GridColumnsCollection. + dataGrid1->DataSource = myTable; + dataGrid1->TableStyles->Add( gcnew DataGridTableStyle ); + dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumnTextColumn ); + } + + // +}; + +int main() +{ + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp new file mode 100644 index 00000000000..97bdabe4ddb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.DataGridTextBoxColumn2 Example/CPP/source.cpp @@ -0,0 +1,50 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; +using namespace System::Globalization; + +ref class Form1: public Form +{ +private: + DataGrid^ dataGrid1; // = new DataGrid(); + + // +private: + void AddColumn( DataTable^ myTable ) + { + // Add a new DataColumn to the DataTable. + DataColumn^ myColumn = gcnew DataColumn( "myTextBoxColumn" ); + myColumn->DataType = String::typeid; + myColumn->DefaultValue = "default string"; + myTable->Columns->Add( myColumn ); + + // Get the ListManager for the DataTable. + CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myTable ]); + + // Use the ListManager to get the PropertyDescriptor for the new column. + PropertyDescriptor^ pd = cm->GetItemProperties()[ "myTextBoxColumn" ]; + + // Create a new DataTimeFormat object. + DateTimeFormatInfo^ fmt = gcnew DateTimeFormatInfo; + + // Insert code to set format. + DataGridTextBoxColumn^ myColumnTextColumn; + + // Create the DataGridTextBoxColumn with the PropertyDescriptor and Format. + myColumnTextColumn = gcnew DataGridTextBoxColumn( pd,fmt->SortableDateTimePattern ); + + // Add the new DataGridColumnStyle to the GridColumnsCollection. + dataGrid1->TableStyles[ 0 ]->GridColumnStyles->Add( myColumnTextColumn ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp new file mode 100644 index 00000000000..d3b00c6ad29 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Edit Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridTextBoxColumn +{ +public: + void EditCol( CurrencyManager^ cm, int rowNum, Rectangle cellRect, bool readOnly, String^ myString, bool isVisible ) + { + this->Edit( cm, rowNum, cellRect, readOnly, myString, isVisible ); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ myDataSet; +private: + void dataGrid1_MouseDown( Object^ sender, MouseEventArgs^ e ) + { + + // Use the HitTest method to get a HitTestInfo object. + DataGrid::HitTestInfo ^ hi; + DataGrid^ grid = dynamic_cast(sender); + hi = grid->HitTest( e->X, e->Y ); + + // Test if the clicked area was a cell. + if ( hi->Type == DataGrid::HitTestType::Cell ) + { + + // If it's a cell, get the GridTable and CurrencyManager of the + // clicked table. + DataGridTableStyle^ dgt = dataGrid1->TableStyles[ 0 ]; + CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]); + + // Get the Rectangle of the clicked cell. + Rectangle cellRect = grid->GetCellBounds( hi->Row, hi->Column ); + + // Get the clicked DataGridTextBoxColumn. + MyGridColumn^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); + + // Edit the value. + gridCol->EditCol( cm, hi->Row, cellRect, false, "New Text", true ); + } + } + +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp new file mode 100644 index 00000000000..e8db37f48a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredHeight Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridTextBoxColumn +{ +public: + int GetPrefHeight( Graphics^ g, String^ val ) + { + return this->GetPreferredHeight( g, val ); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + void GetPreferredHeight() + { + Graphics^ g; + g = this->CreateGraphics(); + int gridPreferredHeight; + MyGridColumn^ myTextColumn; + + // Assuming column 1 of a DataGrid control is a + // DataGridTextBoxColumn. + myTextColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 1 ]); + String^ myVal; + myVal = "A long string value"; + gridPreferredHeight = myTextColumn->GetPrefHeight( g, myVal ); + Console::WriteLine( gridPreferredHeight ); + } + +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp new file mode 100644 index 00000000000..c4fdc4ccf5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.GetPreferredSize Example/CPP/source.cpp @@ -0,0 +1,47 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridTextBoxColumn +{ +public: + Size GetPrefSize( Graphics^ g, String^ val ) + { + return this->GetPreferredSize( g, val ); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + void GetPreferredSize() + { + Graphics^ g; + g = this->CreateGraphics(); + System::Drawing::Size gridPreferredSize; + MyGridColumn^ myTextColumn; + + // Assuming column 1 of a DataGrid control is a + // DataGridTextBoxColumn. + myTextColumn = dynamic_cast(dataGrid1->TableStyles[ 0 ]->GridColumnStyles[ 1 ]); + String^ myVal; + myVal = "A long string value"; + gridPreferredSize = myTextColumn->GetPrefSize( g, myVal ); + Console::WriteLine( gridPreferredSize ); + } + +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp new file mode 100644 index 00000000000..9e0de639d5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataGridTextBoxColumn.Paint2 Example/CPP/source.cpp @@ -0,0 +1,70 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +public ref class MyGridColumn: public DataGridTextBoxColumn +{ +public: + void PaintCol( Graphics^ g, Rectangle cellRect, CurrencyManager^ cm, int rowNum, Brush^ bBrush, Brush^ fBrush, bool isVisible ) + { + this->Paint( g, cellRect, cm, rowNum, bBrush, fBrush, isVisible ); + } + +}; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ myDataSet; + +private: + void PaintCell( Object^ sender, MouseEventArgs^ e ) + { + + // Use the HitTest method to get a HitTestInfo object. + DataGrid::HitTestInfo ^ hi; + DataGrid^ grid = dynamic_cast(sender); + hi = grid->HitTest( e->X, e->Y ); + + // Test if the clicked area was a cell. + if ( hi->Type == DataGrid::HitTestType::Cell ) + { + + // If it's a cell, get the GridTable and ListManager of the + // clicked table. + DataGridTableStyle^ dgt = dataGrid1->TableStyles[ 0 ]; + CurrencyManager^ cm = dynamic_cast(this->BindingContext[ myDataSet->Tables[ dgt->MappingName ] ]); + + // Get the Rectangle of the clicked cell. + Rectangle cellRect; + cellRect = grid->GetCellBounds( hi->Row, hi->Column ); + + // Get the clicked DataGridTextBoxColumn. + MyGridColumn^ gridCol = dynamic_cast(dgt->GridColumnStyles[ hi->Column ]); + + // Get the Graphics object for the form. + Graphics^ g = dataGrid1->CreateGraphics(); + + // Create two new Brush objects, a fore brush, and back brush. + Brush^ fBrush = gcnew System::Drawing::SolidBrush( Color::Blue ); + Brush^ bBrush = gcnew System::Drawing::SolidBrush( Color::Yellow ); + + // Invoke the Paint method to paint the cell with the brushes. + gridCol->PaintCol( g, cellRect, cm, hi->Row, bBrush, fBrush, false ); + } + } + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp new file mode 100644 index 00000000000..7a05ab7eed7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject Example/CPP/source.cpp @@ -0,0 +1,55 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void AddMyData3() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Creates a new data object. + DataObject^ myDataObject = gcnew DataObject; + + // Adds the component to the DataObject. + myDataObject->SetData( myComponent ); + + // Prints whether data of the specified type is in the DataObject. + Type^ myType = myComponent->GetType(); + if ( myDataObject->GetDataPresent( myType ) ) + { + textBox1->Text = String::Concat( "Data of type ", myType, + " is present in the DataObject" ); + } + else + { + textBox1->Text = String::Concat( "Data of type ", myType, + " is not present in the DataObject" ); + } + } + // + + // + void GetMyData2() + { + // Creates a new data object using a string and the text format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Text to Store" ); + + // Prints the string in a text box. + textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp new file mode 100644 index 00000000000..44e7ebed0a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject2 Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void CreateDefaultDataObject() + { + // Creates a data object. + DataObject^ myDataObject; + + // Assigns the string to the data object. + String^ myString = "My text string"; + myDataObject = gcnew DataObject( myString ); + + // Prints the string in a text box. + textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp new file mode 100644 index 00000000000..9626e98f5a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject3 Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void CreateTextDataObject() + { + // Creates a new data object using a string. + String^ myString = "My text string"; + DataObject^ myDataObject = gcnew DataObject( myString ); + + // Prints the string in a text box. + textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp new file mode 100644 index 00000000000..429ed00b4b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.DataObject4 Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void CreateTextDataObject2() + { + // Creates a new data object using a string. + String^ myString = "My next text string"; + DataObject^ myDataObject = gcnew DataObject( "System.String",myString ); + + // Prints the string in a text box. + textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp new file mode 100644 index 00000000000..c1ee4529913 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData Example/CPP/source.cpp @@ -0,0 +1,41 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetMyData3() + { + // Creates a new data object using a string and the text format. + String^ myString = "My new text string"; + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); + + // Prints the string in a text box with autoconvert = false. + if ( myDataObject->GetData( "System.String", false ) != 0 ) + { + // Prints the string in a text box. + textBox1->Text = String::Concat( + myDataObject->GetData( "System.String", false )->ToString(), "\n" ); + } + else + { + textBox1->Text = "Could not find data of the specified format\n"; + } + + // Prints the string in a text box with autoconvert = true. + textBox1->Text = String::Concat( + textBox1->Text, myDataObject->GetData( "System.String", true )->ToString() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp new file mode 100644 index 00000000000..6d4f246a31b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetData2 Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetMyData() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Creates a new data object and assigns it the component. + DataObject^ myDataObject = gcnew DataObject( myComponent ); + + // Creates a type to store the type of data. + Type^ myType = myComponent->GetType(); + + // Retrieves the data using myType to represent its type. + Object^ myObject = myDataObject->GetData( myType ); + if ( myObject != nullptr ) + { + textBox1->Text = String::Format( "The data type stored in the DataObject is: {0}", + myObject->GetType()->Name ); + } + else + { + textBox1->Text = "Data of the specified type was not stored in the DataObject."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp new file mode 100644 index 00000000000..f80c08805a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent Example/CPP/source.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetIfPresent2() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Creates a new data object and assigns it the component. + DataObject^ myDataObject = gcnew DataObject( myComponent ); + + // Creates a type to store the type of data. + Type^ myType = myComponent->GetType(); + + // Determines if the DataObject has data of the Type format. + textBox1->Text = String::Concat( "Is the specified data type available ", + "in the DataObject? ", myDataObject->GetDataPresent( myType ), "\n" ); + + // Retrieves the data using its type format, and displays the type. + Object^ myObject = myDataObject->GetData( myType ); + textBox1->Text = String::Concat( textBox1->Text, "The data type stored ", + "in the DataObject is: ", myObject->GetType()->Name ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp new file mode 100644 index 00000000000..25f1e96be04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetDataPresent1 Example/CPP/source.cpp @@ -0,0 +1,41 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetIfPresent3() + { + // Creates a new data object using a string and the text format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text, "Another string" ); + + // Prints the string in a text box with autoconvert = false. + if ( myDataObject->GetDataPresent( "System.String", false ) ) + { + // Prints the string in a text box. + textBox1->Text = String::Concat( + myDataObject->GetData( "System.String", false )->ToString(), "\n" ); + } + else + { + textBox1->Text = "Could not convert data to specified format\n"; + } + + // Prints the string in a text box with autoconvert = true. + textBox1->Text = String::Concat( textBox1->Text, + "With autoconvert = true, you can convert text to string format. String is: ", + myDataObject->GetData( "System.String", true )->ToString() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp new file mode 100644 index 00000000000..b0260219fe0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats Example/CPP/source.cpp @@ -0,0 +1,45 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetAllFormats2() + { + // Creates a new data object using a string and the text format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" ); + + // Gets the original data formats in the DataObject. + array^ arrayOfFormats = myDataObject->GetFormats( false ); + + // Prints the results. + textBox1->Text = "The format(s) associated with the data are: \n"; + for ( int i = 0; i < arrayOfFormats->Length; i++ ) + { + textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); + } + + // Gets the all data formats and data conversion formats for the DataObject. + arrayOfFormats = myDataObject->GetFormats( true ); + + // Prints the results. + textBox1->Text = String::Concat( textBox1->Text , "The data formats and conversion ", + "format(s) associated with the data are: \n" ); + for ( int i = 0; i < arrayOfFormats->Length; i++ ) + { + textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp new file mode 100644 index 00000000000..e7dfdcc44f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.GetFormats1 Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void GetAllFormats() + { + // Creates a new data object using a string and the text format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"Another string" ); + + // Gets all the data formats and data conversion formats in the DataObject. + array^ arrayOfFormats = myDataObject->GetFormats(); + + // Prints the results. + textBox1->Text = "The format(s) associated with the data are: \n"; + for ( int i = 0; i < arrayOfFormats->Length; i++ ) + { + textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp new file mode 100644 index 00000000000..8dda7860d2a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void AddMyData4() + { + // Creates a new data object, and assigns it the component. + DataObject^ myDataObject = gcnew DataObject; + + // Adds data to the DataObject, and specifies no format conversion. + myDataObject->SetData( DataFormats::UnicodeText, false, "My Unicode data" ); + + // Gets the data formats in the DataObject. + array^ arrayOfFormats = myDataObject->GetFormats(); + + // Prints the results. + textBox1->Text = "The format(s) associated with the data are: \n"; + for ( int i = 0; i < arrayOfFormats->Length; i++ ) + { + textBox1->Text = String::Concat( textBox1->Text, arrayOfFormats[ i ], "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp new file mode 100644 index 00000000000..44e43960bca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData1 Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void AddMyData() + { + // Creates a new data object using a string and the text format. + DataObject^ myDataObject = gcnew DataObject; + + // Stores a string, specifying the Unicode format. + myDataObject->SetData( DataFormats::UnicodeText, "Text string" ); + + // Retrieves the data by specifying Text. + textBox1->Text = myDataObject->GetData( DataFormats::Text )->GetType()->Name; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp new file mode 100644 index 00000000000..64f651341b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData2 Example/CPP/source.cpp @@ -0,0 +1,45 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void AddMyData2() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Gets the type of the component. + Type^ myType = myComponent->GetType(); + + // Creates a new data object. + DataObject^ myDataObject = gcnew DataObject; + + // Adds the component to the DataObject. + myDataObject->SetData( myType, myComponent ); + + // Prints whether data of the specified type is in the DataObject. + if ( myDataObject->GetDataPresent( myType ) ) + { + textBox1->Text = String::Concat( "Data of type ", myType->Name, + " is present in the DataObject" ); + } + else + { + textBox1->Text = String::Concat( "Data of type ", myType->Name, + " is not present in the DataObject" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp new file mode 100644 index 00000000000..b44ff39df75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DataObject.SetData3 Example/CPP/source.cpp @@ -0,0 +1,43 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void AddMyData3() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Creates a new data object. + DataObject^ myDataObject = gcnew DataObject; + + // Adds the component to the DataObject. + myDataObject->SetData( myComponent ); + + // Prints whether data of the specified type is in the DataObject. + Type^ myType = myComponent->GetType(); + if ( myDataObject->GetDataPresent( myType ) ) + { + textBox1->Text = String::Concat( "Data of type ", myType->Name, + " is present in the DataObject" ); + } + else + { + textBox1->Text = String::Concat( "Data of type ", myType->Name, + " is not present in the DataObject" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp new file mode 100644 index 00000000000..78e899c745d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyDateTimePicker() + { + // Create a new DateTimePicker control and initialize it. + DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; + + // Set the MinDate and MaxDate. + dateTimePicker1->MinDate = DateTime(1985,6,20); + dateTimePicker1->MaxDate = DateTime::Today; + + // Set the CustomFormat string. + dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd"; + dateTimePicker1->Format = DateTimePickerFormat::Custom; + + // Show the CheckBox and display the control as an up-down control. + dateTimePicker1->ShowCheckBox = true; + dateTimePicker1->ShowUpDown = true; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp new file mode 100644 index 00000000000..097b8ce3ee9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DateTimePicker.CustomFormat Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DateTimePicker^ dateTimePicker1; + + // +public: + void SetMyCustomFormat() + { + // Set the Format type and the CustomFormat string. + dateTimePicker1->Format = DateTimePickerFormat::Custom; + dateTimePicker1->CustomFormat = "MMMM dd, yyyy - dddd"; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..aaa0112e550 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultEventAttribute Example/CPP/source.cpp @@ -0,0 +1,55 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace DefaultEventAttributeExample +{ + // + [DefaultEvent("CollectionChanged")] + public ref class TestCollection: public BaseCollection + { + private: + CollectionChangeEventHandler^ onCollectionChanged; + + public: + event CollectionChangeEventHandler^ CollectionChanged + { + public: + void add(CollectionChangeEventHandler^ eventHandler) + { + onCollectionChanged += eventHandler; + } + + protected: + void remove(CollectionChangeEventHandler^ eventHandler) + { + onCollectionChanged -= eventHandler; + } + } + // Insert additional code. + }; + // +} + +// +int main() +{ + // Creates a new collection. + DefaultEventAttributeExample::TestCollection^ newCollection = + gcnew DefaultEventAttributeExample::TestCollection; + + // Gets the attributes for the collection. + AttributeCollection^ attributes = + TypeDescriptor::GetAttributes(newCollection); + + // Prints the name of the default event by retrieving the + // DefaultEventAttribute from the AttributeCollection. + DefaultEventAttribute^ attribute = (DefaultEventAttribute^) + attributes[DefaultEventAttribute::typeid]; + Console::WriteLine("The default event is: {0}", attribute->Name); +} +// + diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..b5ea859e190 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultPropertyAttribute Example/CPP/source.cpp @@ -0,0 +1,57 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + + // + [DefaultProperty("MyProperty")] + ref class MyControl: public Control + { + public: + + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + + void set( int value ) + { + // Insert code here. + } + } + // Insert any additional code. + }; + // +}; + + +// +int main() +{ + // Creates a new control. + Form1::MyControl^ myNewControl = gcnew Form1::MyControl; + + // Gets the attributes for the collection. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewControl ); + + /* Prints the name of the default property by retrieving the + * DefaultPropertyAttribute from the AttributeCollection. */ + DefaultPropertyAttribute^ myAttribute = dynamic_cast(attributes[ DefaultPropertyAttribute::typeid ]); + Console::WriteLine( "The default property is: {0}", myAttribute->Name ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..f2568cb4ac9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DefaultValueAttribute Example/CPP/source.cpp @@ -0,0 +1,46 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + bool _myVal; + +public: + [DefaultValue(false)] + property bool MyProperty + { + bool get() + { + return _myVal; + } + + void set( bool value ) + { + _myVal = value; + } + } + // + +protected: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + /* Prints the default value by retrieving the DefaultValueAttribute + * from the AttributeCollection. */ + DefaultValueAttribute^ myAttribute = dynamic_cast(attributes[ DefaultValueAttribute::typeid ]); + Console::WriteLine( "The default value is: {0}", myAttribute->Value ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..154c9fae14c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DescriptionAttribute Example/CPP/source.cpp @@ -0,0 +1,51 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +protected: + Image^ image1; + + // +public: + property Image^ MyImage + { + [Description("The image associated with the control"),Category("Appearance")] + Image^ get() + { + // Insert code here. + return image1; + } + + void set( Image^ value ) + { + // Insert code here. + } + } + // + +protected: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyImage" ]->Attributes; + + /* Prints the description by retrieving the DescriptionAttribute + * from the AttributeCollection. */ + DescriptionAttribute^ myAttribute = dynamic_cast(attributes[ DescriptionAttribute::typeid ]); + Console::WriteLine( myAttribute->Description ); + // + } + +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..af47a3a2241 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DesignOnlyAttribute Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Globalization; +public ref class Class1 +{ +protected: + CultureInfo^ myCultureInfo; + + // +public: + [DesignOnly(true)] + property CultureInfo^ GetLanguage + { + CultureInfo^ get() + { + // Insert code here. + return myCultureInfo; + } + void set( CultureInfo^ value ) + { + // Insert code here. + } + } + // + +private: + property int Property1 + { + int get() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "GetLanguage" ]->Attributes; + + /* Prints whether the property is marked as DesignOnly + by retrieving the DesignOnlyAttribute from the AttributeCollection. */ + DesignOnlyAttribute^ myAttribute = dynamic_cast(attributes[ DesignOnlyAttribute::typeid ]); + Console::WriteLine( "This property is design only :{0}", myAttribute->IsDesignOnly ); + // + + return 1; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..59fc15140fe --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerAttribute Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +// +[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design.DLL", +IRootDesigner::typeid), +DesignerCategory("Form")] +ref class MyForm: public ContainerControl{ + // Insert code here. +}; +// + +// +int main() +{ + // Creates a new form. + MyForm^ myNewForm = gcnew MyForm; + + // Gets the attributes for the collection. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewForm ); + + /* Prints the name of the designer by retrieving the DesignerAttribute + * from the AttributeCollection. */ + DesignerAttribute^ myAttribute = dynamic_cast(attributes[ DesignerAttribute::typeid ]); + Console::WriteLine( "The designer for this class is: {0}", myAttribute->DesignerTypeName ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..259fee58622 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerCategoryAttribute Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +// +[Designer("System.Windows.Forms.Design.DocumentDesigner, System.Windows.Forms.Design", +IRootDesigner::typeid), +DesignerCategory("Form")] +ref class MyForm: public ContainerControl{ + // Insert code here. +}; +// + +// +int main() +{ + // Creates a new form. + MyForm^ myNewForm = gcnew MyForm; + + // Gets the attributes for the collection. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewForm ); + + /* Prints the name of the designer by retrieving the + * DesignerCategoryAttribute from the AttributeCollection. */ + DesignerCategoryAttribute^ myAttribute = dynamic_cast(attributes[ DesignerCategoryAttribute::typeid ]); + Console::WriteLine( "The category of the designer for this class is: {0}", myAttribute->Category ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..932958a9e5a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute Example/CPP/source.cpp @@ -0,0 +1,100 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// This attribute indicates that the public properties of this object should be listed in the property grid. + +[TypeConverterAttribute(System::ComponentModel::ExpandableObjectConverter::typeid)] +public ref class DimensionData +{ +private: + Control^ owner; + +internal: + + // This class reads and writes the Location and Size properties from the Control which it is initialized to. + DimensionData( Control^ owner ) + { + this->owner = owner; + } + +public: + + property Point Location + { + Point get() + { + return owner->Location; + } + + void set( Point value ) + { + owner->Location = value; + } + + } + + property Size FormSize + { + Size get() + { + return owner->Size; + } + + void set( Size value ) + { + owner->Size = value; + } + } +}; + +// The code for this user control declares a public property of type DimensionData with a DesignerSerializationVisibility +// attribute set to DesignerSerializationVisibility.Content, indicating that the properties of the object should be serialized. +// The public, not hidden properties of the object that are set at design time will be persisted in the initialization code +// for the class object. Content persistence will not work for structs without a custom TypeConverter. +public ref class ContentSerializationExampleControl: public System::Windows::Forms::UserControl +{ +private: + System::ComponentModel::Container^ components; + +public: + + property DimensionData^ Dimensions + { + [DesignerSerializationVisibility(DesignerSerializationVisibility::Content)] + DimensionData^ get() + { + return gcnew DimensionData( this ); + } + } + ContentSerializationExampleControl() + { + InitializeComponent(); + } + +public: + ~ContentSerializationExampleControl() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + components = gcnew System::ComponentModel::Container; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..bac7629b68b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.DesignerSerializationVisibilityAttribute Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + [DesignerSerializationVisibility(DesignerSerializationVisibility::Content)] + property int MyProperty + { + int get() + { + // Insert code here. + return (0); + } + void set( int value ) + { + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp new file mode 100644 index 00000000000..1efa6cb6b66 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DesignerSerializationVisibilityAttribute.Visibility Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the value of the DesignerSerializationVisibilityAttribute is set to Content. + if ( attributes[ DesignerSerializationVisibilityAttribute::typeid ]->Equals( DesignerSerializationVisibilityAttribute::Content ) ) + { + // Insert code here. + } + + + // This is another way to see whether the property is marked as serializing content. + DesignerSerializationVisibilityAttribute^ myAttribute = dynamic_cast(attributes[ DesignerSerializationVisibilityAttribute::typeid ]); + if ( myAttribute->Visibility == DesignerSerializationVisibility::Content ) + { + // Insert code here. + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp new file mode 100644 index 00000000000..849b818b8ac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown Example/CPP/source.cpp @@ -0,0 +1,68 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + int myCounter; + + // +protected: + DomainUpDown^ domainUpDown1; + +private: + void MySub() + { + // Create and initialize the DomainUpDown control. + domainUpDown1 = gcnew System::Windows::Forms::DomainUpDown; + + // Add the DomainUpDown control to the form. + Controls->Add( domainUpDown1 ); + } + + void button1_Click( System::Object^ sender, + System::EventArgs^ e ) + { + // Add the text box contents and initial location in the collection + // to the DomainUpDown control. + domainUpDown1->Items->Add( String::Concat( + (textBox1->Text->Trim()), " - ", myCounter.ToString() ) ); + + // Increment the counter variable. + myCounter = myCounter + 1; + + // Clear the TextBox. + textBox1->Text = ""; + } + + void checkBox1_Click( Object^ sender, EventArgs^ e ) + { + // If Sorted is set to true, set it to false; + // otherwise set it to true. + if ( domainUpDown1->Sorted ) + { + domainUpDown1->Sorted = false; + } + else + { + domainUpDown1->Sorted = true; + } + } + + void domainUpDown1_SelectedItemChanged( Object^ sender, EventArgs^ e ) + { + // Display the SelectedIndex and SelectedItem property values in a MessageBox. + MessageBox::Show( String::Concat( "SelectedIndex: ", + domainUpDown1->SelectedIndex.ToString(), "\n", "SelectedItem: ", + domainUpDown1->SelectedItem->ToString() ) ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..0d4bcb51c53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic DomainUpDown.DomainUpDownItemCollection Example/CPP/source.cpp @@ -0,0 +1,65 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + int myCounter; + + // +protected: + DomainUpDown^ domainUpDown1; + +private: + void InitializeMyDomainUpDown() + { + // Create and initialize the DomainUpDown control. + domainUpDown1 = gcnew DomainUpDown; + + // Add the DomainUpDown control to the form. + Controls->Add( domainUpDown1 ); + } + + void button1_Click( Object^ sender, + EventArgs^ e ) + { + // Add the text box contents and initial location in the collection + // to the DomainUpDown control. + domainUpDown1->Items->Add( String::Concat( + (textBox1->Text->Trim()), " - ", myCounter ) ); + + // Increment the counter variable. + myCounter = myCounter + 1; + + // Clear the TextBox. + textBox1->Text = ""; + } + + void checkBox1_Click( Object^ sender, + EventArgs^ e ) + { + + // If Sorted is set to true, set it to false; + // otherwise set it to true. + domainUpDown1->Sorted = !domainUpDown1->Sorted; + } + + void domainUpDown1_SelectedItemChanged( Object^ sender, + EventArgs^ e ) + { + + // Display the SelectedIndex and + // SelectedItem property values in a MessageBox. + MessageBox::Show( String::Concat( "SelectedIndex: ", domainUpDown1->SelectedIndex, + "\nSelectedItem: ", domainUpDown1->SelectedItem ) ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..6b775b2abb3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EditorAttribute Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// +[Editor("System.Windows.Forms.ImageEditorIndex, System.Design", +UITypeEditor::typeid)] +public ref class MyImage{ + // Insert code here. +}; +// + +// +int main() +{ + // Creates a new component. + MyImage^ myNewImage = gcnew MyImage; + + // Gets the attributes for the component. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewImage ); + + /* Prints the name of the editor by retrieving the EditorAttribute + * from the AttributeCollection. */ + EditorAttribute^ myAttribute = dynamic_cast(attributes[ EditorAttribute::typeid ]); + Console::WriteLine( "The editor for this class is: {0}", myAttribute->EditorTypeName ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp new file mode 100644 index 00000000000..f70b1132f28 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ErrorProvider Example/CPP/source.cpp @@ -0,0 +1,56 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + ErrorProvider^ errorProvider1; + DataSet^ dataSet1; + DataTable^ dataTable1; + + // +private: + void InitializeComponent() + { + + // Standard control setup. + //.... + // You set the DataSource to a data set, and the DataMember to a table. + errorProvider1->DataSource = dataSet1; + errorProvider1->DataMember = dataTable1->TableName; + errorProvider1->ContainerControl = this; + errorProvider1->BlinkRate = 200; + + //... + // Since the ErrorProvider control does not have a visible component, + // it does not need to be added to the form. + } + + +private: + void buttonSave_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Checks for a bad post code. + DataTable^ CustomersTable; + CustomersTable = dataSet1->Tables[ "Customers" ]; + System::Collections::IEnumerator^ myEnum = (CustomersTable->Rows)->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataRow^ row = safe_cast(myEnum->Current); + if ( Convert::ToBoolean( row[ "PostalCodeIsNull" ] ) ) + { + row->RowError = "The Customer details contain errors"; + row->SetColumnError( "PostalCode", "Postal Code required" ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..6890216f914 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + + // +private: + void MyEventCollection() + { + // Creates a new collection and assigns it the events for button1. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Displays each event in the collection in a text box. + for each ( EventDescriptor^ myEvent in events ) + { + textBox1->Text = String::Concat( textBox1->Text, myEvent->Name, "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..217c8f3acc6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Count Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + + // +private: + void GetCount() + { + // Creates a new collection and assigns it the events for button1. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Prints the number of events on button1 in a text box. + textBox1->Text = events->Count.ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..bc57ab44117 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.EventDescriptorCollection Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + void Method() + { + // + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp new file mode 100644 index 00000000000..afcc29eb0ab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Find Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + + // +private: + void FindEvent() + { + // Creates a new collection and assigns it the events for button1. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Sets an EventDescriptor to the specific event. + EventDescriptor^ myEvent = events->Find( "Resize", false ); + + // Prints the event name and event description. + textBox1->Text = String::Concat( myEvent->Name, ": ", myEvent->Description ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..73599048694 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,35 @@ +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + + // +private: + void MyEnumerator() + { + // Creates a new collection, and assigns to it the events for button1. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Creates an enumerator. + IEnumerator^ ie = events->GetEnumerator(); + + // Prints the name of each event in the collection. + Object^ myEvent; + while ( ie->MoveNext() ) + { + myEvent = ie->Current; + textBox1->Text = String::Concat( textBox1->Text, myEvent, "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp new file mode 100644 index 00000000000..0dd76e1c42c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.InternalSort Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Coll1 abstract: public EventDescriptorCollection +{ +public: + Coll1() + : EventDescriptorCollection( nullptr ) + {} + +protected: + void Method() + { + // + array^ temp0 = {"D","B"}; + this->InternalSort( temp0 ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp new file mode 100644 index 00000000000..a345e12061c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.Sort Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Coll1 abstract: public EventDescriptorCollection +{ +protected: + Object^ myNewColl; + +public: + Coll1() : EventDescriptorCollection( nullptr ) + { + } + +protected: + void Method() + { + // + array^ temp0 = {"D","B"}; + myNewColl = this->Sort( temp0 ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..8463c7d4cdd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + + // +private: + void PrintIndexItem() + { + + // Creates a new collection and assigns it the events for button1. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Prints the second event's name. + textBox1->Text = events[ 1 ]->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp new file mode 100644 index 00000000000..cd52c396684 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic EventDescriptorCollection.this1 Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Button^ button1; + + // +private: + void PrintIndexItem2() + { + + // Creates a new collection and assigns it the events for button1. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Sets an EventDescriptor to the specific event. + EventDescriptor^ myEvent = events[ "KeyDown" ]; + + // Prints the name of the event. + textBox1->Text = myEvent->Name; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp new file mode 100644 index 00000000000..e41526c7f28 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic FontDialog Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + FontDialog^ fontDialog1; + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + fontDialog1->ShowColor = true; + + fontDialog1->Font = textBox1->Font; + fontDialog1->Color = textBox1->ForeColor; + + if ( fontDialog1->ShowDialog() != ::DialogResult::Cancel ) + { + textBox1->Font = fontDialog1->Font; + textBox1->ForeColor = fontDialog1->Color; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp new file mode 100644 index 00000000000..65f35c1dcd8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.AcceptButton Example/CPP/source.cpp @@ -0,0 +1,56 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyForm() + { + // Create a new instance of the form. + Form^ form1 = gcnew Form; + // Create two buttons to use as the accept and cancel buttons. + Button^ button1 = gcnew Button; + Button^ button2 = gcnew Button; + + // Set the text of button1 to "OK". + button1->Text = "OK"; + // Set the position of the button on the form. + button1->Location = Point(10,10); + // Set the text of button2 to "Cancel". + button2->Text = "Cancel"; + // Set the position of the button based on the location of button1. + button2->Location = + Point( button1->Left, button1->Height + button1->Top + 10 ); + // Set the caption bar text of the form. + form1->Text = "My Dialog Box"; + // Display a help button on the form. + form1->HelpButton = true; + + // Define the border style of the form to a dialog box. + form1->FormBorderStyle = ::FormBorderStyle::FixedDialog; + // Set the MaximizeBox to false to remove the maximize box. + form1->MaximizeBox = false; + // Set the MinimizeBox to false to remove the minimize box. + form1->MinimizeBox = false; + // Set the accept button of the form to button1. + form1->AcceptButton = button1; + // Set the cancel button of the form to button2. + form1->CancelButton = button2; + // Set the start position of the form to the center of the screen. + form1->StartPosition = FormStartPosition::CenterScreen; + + // Add button1 to the form. + form1->Controls->Add( button1 ); + // Add button2 to the form. + form1->Controls->Add( button2 ); + // Display the form as a modal dialog box. + form1->ShowDialog(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp new file mode 100644 index 00000000000..dae7cb32dfa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveForm Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + + // + void DisableActiveFormControls() + { + + // Create an instance of a form and assign it the currently active form. + Form^ currentForm = Form::ActiveForm; + + // Loop through all the controls on the active form. + for ( int i = 0; i < currentForm->Controls->Count; i++ ) + { + + // Disable each control in the active form's control collection. + currentForm->Controls[ i ]->Enabled = false; + + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp new file mode 100644 index 00000000000..890be7cbd12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ActiveMdiChild Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void ClearAllChildFormText() + { + + // Obtain a reference to the currently active MDI child form. + Form^ tempChild = this->ActiveMdiChild; + + // Loop through all controls on the child form. + for ( int i = 0; i < tempChild->Controls->Count; i++ ) + { + + // Determine if the current control on the child form is a TextBox. + if ( dynamic_cast(tempChild->Controls[ i ]) ) + { + + // Clear the contents of the control since it is a TextBox. + tempChild->Controls[ i ]->Text = ""; + } + + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp new file mode 100644 index 00000000000..3e26b76fc6b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ClientSize Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + + // +private: + void MyForm_Resize( Object^ sender, EventHandler^ e ) + { + // Set the size of button1 to the size of the client area of the form. + button1->Size = this->ClientSize; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp new file mode 100644 index 00000000000..42195595c6a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlBox Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyBorderlessWindow() + { + this->FormBorderStyle = ::FormBorderStyle::None; + this->MaximizeBox = false; + this->MinimizeBox = false; + this->StartPosition = FormStartPosition::CenterScreen; + // Remove the control box so the form will only display client area. + this->ControlBox = false; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..edded62021c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ControlCollection Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void AddMyControls() + { + TextBox^ textBox1 = gcnew TextBox; + Label^ label1 = gcnew Label; + + // Initialize the controls and their bounds. + label1->Text = "First Name"; + label1->Location = Point( 48, 48 ); + label1->Size = System::Drawing::Size( 104, 16 ); + textBox1->Text = ""; + textBox1->Location = Point(48,64); + textBox1->Size = System::Drawing::Size( 104, 16 ); + + // Add the TextBox control to the form's control collection. + Controls->Add( textBox1 ); + // Add the Label control to the form's control collection. + Controls->Add( label1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp new file mode 100644 index 00000000000..eb89c1935ec --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopBounds Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void MoveMyForm() + { + // Create a Rectangle object that will be used as the bound of the form. + Rectangle tempRect = Rectangle( 50, 50, 100, 100 ); + // Set the bounds of the form using the Rectangle object. + this->DesktopBounds = tempRect; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp new file mode 100644 index 00000000000..1aa2a3c0cad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DesktopLocation Example/CPP/source.cpp @@ -0,0 +1,23 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void MoveMyForm() + { + // Create a Point object that will be used as the location of the form. + Point tempPoint = Point( 100, 100 ); + // Set the location of the form using the Point object. + this->DesktopLocation = tempPoint; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp new file mode 100644 index 00000000000..34c63a74eab --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.DialogResult Example/CPP/source.cpp @@ -0,0 +1,95 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + Form1^ form1; + +public: + + // + void CreateMyForm() + { + + // Create a new instance of the form. + Form^ form1 = gcnew Form; + + // Create two buttons to use as the accept and cancel buttons. + Button^ button1 = gcnew Button; + Button^ button2 = gcnew Button; + + // Set the text of button1 to "OK". + button1->Text = "OK"; + + // Set the position of the button on the form. + button1->Location = Point(10,10); + + // Set the text of button2 to "Cancel". + button2->Text = "Cancel"; + + // Set the position of the button based on the location of button1. + button2->Location = Point(button1->Left,button1->Height + button1->Top + 10); + + // Make button1's dialog result OK. + button1->DialogResult = ::DialogResult::OK; + + // Make button2's dialog result Cancel. + button2->DialogResult = ::DialogResult::Cancel; + + // Set the caption bar text of the form. + form1->Text = "My Dialog Box"; + + // Define the border style of the form to a dialog box. + form1->FormBorderStyle = ::FormBorderStyle::FixedDialog; + + // Set the accept button of the form to button1. + form1->AcceptButton = button1; + + // Set the cancel button of the form to button2. + form1->CancelButton = button2; + + // Set the start position of the form to the center of the screen. + form1->StartPosition = FormStartPosition::CenterScreen; + + // Add button1 to the form. + form1->Controls->Add( button1 ); + + // Add button2 to the form. + form1->Controls->Add( button2 ); + + // Display the form as a modal dialog box. + form1->ShowDialog(); + + // Determine if the OK button was clicked on the dialog box. + if ( form1->DialogResult == ::DialogResult::OK ) + { + + // Display a message box indicating that the OK button was clicked. + MessageBox::Show( "The OK button on the form was clicked." ); + + // Optional: Call the Dispose method when you are finished with the dialog box. + delete form1; + } + else + { + + // Display a message box indicating that the Cancel button was clicked. + MessageBox::Show( "The Cancel button on the form was clicked." ); + + // Optional: Call the Dispose method when you are finished with the dialog box. + delete form1; + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp new file mode 100644 index 00000000000..037d40867cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.LayoutMdi Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void HorizontallyTileMyWindows( Object^ sender, System::EventArgs^ e ) + { + // Tile all child forms horizontally. + this->LayoutMdi( MdiLayout::TileHorizontal ); + } + + void VerticallyTileMyWindows( Object^ sender, System::EventArgs^ e ) + { + // Tile all child forms vertically. + this->LayoutMdi( MdiLayout::TileVertical ); + } + + void CascadeMyWindows( Object^ sender, System::EventArgs^ e ) + { + // Cascade all MDI child windows. + this->LayoutMdi( MdiLayout::Cascade ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp new file mode 100644 index 00000000000..eb35be13029 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.ShowDialog Example/CPP/source.cpp @@ -0,0 +1,99 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form2: public Form +{ +protected: + Button^ okay; + Button^ cancel; + +public: + TextBox^ TextBox1; + Form2() + { + this->okay = gcnew Button; + this->okay->Location = Point(50,50); + this->okay->Width = 50; + this->okay->DialogResult = ::DialogResult::OK; + this->okay->Text = "OK"; + this->cancel = gcnew Button; + this->cancel->Location = Point(okay->Left + okay->Width + 10,50); + this->cancel->Width = 50; + this->cancel->DialogResult = ::DialogResult::Cancel; + this->cancel->Text = "Cancel"; + this->TextBox1 = gcnew TextBox; + this->TextBox1->Location = Point(50,100); + this->TextBox1->Width = 110; + this->TextBox1->Text = "Enter Text"; + array^temp0 = {okay,cancel,TextBox1}; + this->Controls->AddRange( temp0 ); + } + +}; + +public ref class Form1: public Form +{ +protected: + TextBox^ txtResult; + Button^ showButton; + +public: + Form1() + { + this->txtResult = gcnew TextBox; + this->showButton = gcnew Button; + this->showButton->Width = 100; + this->showButton->Text = "Show Dialog"; + this->showButton->Location = Point(0,txtResult->Height + 10); + this->showButton->Click += gcnew EventHandler( this, &Form1::showButton_Click ); + array^temp1 = {txtResult,showButton}; + this->Controls->AddRange( temp1 ); + } + + + // + void ShowMyDialogBox() + { + Form2^ testDialog = gcnew Form2; + + // Show testDialog as a modal dialog and determine if DialogResult = OK. + if ( testDialog->ShowDialog( this ) == ::DialogResult::OK ) + { + + // Read the contents of testDialog's TextBox. + this->txtResult->Text = testDialog->TextBox1->Text; + } + else + { + this->txtResult->Text = "Cancelled"; + } + + delete testDialog; + } + // + + +private: + + void showButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowMyDialogBox(); + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp new file mode 100644 index 00000000000..2cbd27e85e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.StartPosition Example/CPP/source.cpp @@ -0,0 +1,58 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Form1^ form1; + + // +public: + void CreateMyForm() + { + // Create a new instance of the form. + Form^ form1 = gcnew Form; + // Create two buttons to use as the accept and cancel buttons. + Button^ button1 = gcnew Button; + Button^ button2 = gcnew Button; + + // Set the text of button1 to "OK". + button1->Text = "OK"; + // Set the position of the button on the form. + button1->Location = Point(10,10); + // Set the text of button2 to "Cancel". + button2->Text = "Cancel"; + // Set the position of the button based on the location of button1. + button2->Location + = Point( button1->Left, button1->Height + button1->Top + 10 ); + // Set the caption bar text of the form. + form1->Text = "My Dialog Box"; + // Display a help button on the form. + form1->HelpButton = true; + + // Define the border style of the form to a dialog box. + form1->FormBorderStyle = ::FormBorderStyle::FixedDialog; + // Set the accept button of the form to button1. + form1->AcceptButton = button1; + // Set the cancel button of the form to button2. + form1->CancelButton = button2; + // Set the start position of the form to the center of the screen. + form1->StartPosition = FormStartPosition::CenterScreen; + + // Add button1 to the form. + form1->Controls->Add( button1 ); + // Add button2 to the form. + form1->Controls->Add( button2 ); + + // Display the form as a modal dialog box. + form1->ShowDialog(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp new file mode 100644 index 00000000000..ff9eff09682 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Form.TransparencyKey Example/CPP/source.cpp @@ -0,0 +1,22 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void InitializeMyForm() + { + this->BackColor = Color::Red; + // Make the background color of form display transparently. + this->TransparencyKey = BackColor; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..c5d945975c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection Example/CPP/source.cpp @@ -0,0 +1,60 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +#define NULL 0L +public ref class Form1: public Form +{ +private: + DataGrid^ DataGrid1; + DataSet^ DataSet1; + void Setup() + { + DataGrid1 = gcnew DataGrid; + DataSet1 = gcnew DataSet( "myDataSet" ); + } + + + // + void PrintColumnInformation( DataGrid^ grid ) + { + Console::WriteLine( "Count: {0}", grid->TableStyles->Count ); + GridColumnStylesCollection^ myColumns; + DataGridTableStyle^ myTableStyle; + for ( __int32 i = 0; i < grid->TableStyles->Count; i++ ) + { + myTableStyle = grid->TableStyles[ i ]; + myColumns = myTableStyle->GridColumnStyles; + + /* Iterate through the collection and print each + object's type and width. */ + DataGridColumnStyle^ dgCol; + for ( __int32 j = 0; j < myColumns->Count; j++ ) + { + dgCol = myColumns[ j ]; + Console::WriteLine( dgCol->MappingName ); + Console::WriteLine( dgCol->GetType()->ToString() ); + Console::WriteLine( dgCol->Width ); + + } + + } + } + + // +}; + +int main() +{ + Form1^ f = gcnew Form1; + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp new file mode 100644 index 00000000000..973aec177db --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.AddRange Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + +private: + + // + void AddStyleRange() + { + + // Create two DataGridColumnStyle objects. + DataGridColumnStyle^ col1 = gcnew DataGridTextBoxColumn; + col1->MappingName = "FirstName"; + DataGridColumnStyle^ col2 = gcnew DataGridBoolColumn; + col2->MappingName = "Current"; + + // Create an array and use AddRange to add to collection. + array^cols = {col1,col2}; + dataGrid1->TableStyles[ 0 ]->GridColumnStyles->AddRange( cols ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..66f63a9ce57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic GridColumnStylesCollection.CollectionChanged Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ dataSet1; + + // +private: + void AddHandler() + { + GridColumnStylesCollection^ myGridColumns; + myGridColumns = dataGrid1->TableStyles[ 0 ]->GridColumnStyles; + + // Add the handler. + myGridColumns->CollectionChanged += gcnew CollectionChangeEventHandler( this, &Form1::GridCollection_Changed ); + } + + void GridCollection_Changed( Object^ sender, CollectionChangeEventArgs^ /*e*/ ) + { + GridColumnStylesCollection^ myGridColumns; + myGridColumns = dynamic_cast(sender); + Console::WriteLine( myGridColumns->Count ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..cbe3771d0e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.Clear Example/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void ClearAndAdd() + { + GridTableStylesCollection^ gts = dataGrid1->TableStyles; + gts->Clear(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..8725cab059a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic GridTableStylesCollection.CollectionChanged Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + + // +private: + void AddHandler() + { + dataGrid1->TableStyles->CollectionChanged += + gcnew CollectionChangeEventHandler( this, &Form1::Collection_Changed ); + } + + void Collection_Changed( Object^ sender, CollectionChangeEventArgs^ e ) + { + GridTableStylesCollection^ gts = (GridTableStylesCollection^)(sender); + Console::WriteLine( gts->Count ); + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp new file mode 100644 index 00000000000..85d25568234 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic HScrollBar Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +private: + void InitializeMyScrollBar() + { + // Create and initialize an HScrollBar. + HScrollBar^ hScrollBar1 = gcnew HScrollBar; + + // Dock the scroll bar to the bottom of the form. + hScrollBar1->Dock = DockStyle::Bottom; + + // Add the scroll bar to the form. + Controls->Add( hScrollBar1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp new file mode 100644 index 00000000000..6b0ac1b5e2c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic IUIService.Styles Example/CPP/source.cpp @@ -0,0 +1,26 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +public ref class Form1: public Form +{ +private: + + // + // The specified IDesigner implements IUIService. + System::Drawing::Font^ GetFont( IDesigner^ designer ) + { + System::Drawing::Font^ hostfont; + + // Gets the dialog box font from the host environment. + hostfont = dynamic_cast(dynamic_cast(designer)->Styles[ "DialogFont" ]); + return hostfont; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp new file mode 100644 index 00000000000..94f50b69849 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic IWin32Window Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Label^ label1; + + // +public: + Form1() + { + InitializeComponent(); + this->label1->Text = this->Handle.ToString(); + } + // + +protected: + void InitializeComponent(){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp new file mode 100644 index 00000000000..fdd6cb481c6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ImageList Example/CPP/source.cpp @@ -0,0 +1,224 @@ +#using +#using +#using + + using namespace System; + using namespace System::Drawing; + using namespace System::ComponentModel; + using namespace System::Windows::Forms; + +// +namespace myImageRotator +#using +#using +#using +{ + using namespace System; + using namespace System::Drawing; + using namespace System::ComponentModel; + using namespace System::Windows::Forms; + + public ref class Form1 : public System::Windows::Forms::Form + { + private: + System::ComponentModel::IContainer^ components; + private: + System::Windows::Forms::ListBox^ listBox1; + private: + System::Windows::Forms::Label^ label3; + private: + System::Windows::Forms::Button^ button1; + private: + System::Windows::Forms::Button^ button2; + private: + System::Windows::Forms::Button^ button3; + private: + System::Windows::Forms::Button^ button4; + private: + System::Windows::Forms::PictureBox^ pictureBox1; + private: + System::Windows::Forms::ImageList^ imageList1; + private: + System::Windows::Forms::OpenFileDialog^ openFileDialog1; + protected: + Graphics^ myGraphics; + private: + System::Windows::Forms::Panel^ panel1; + private: + System::Windows::Forms::Label^ label5; + private: + int currentImage; + + public: + Form1() + { + InitializeComponent(); + imageList1 = gcnew ImageList () ; + currentImage = 0; + + // The default image size is 16 x 16, which sets up a larger + // image size. + imageList1->ImageSize = System::Drawing::Size(255,255); + imageList1->TransparentColor = Color::White; + + // Assigns the graphics object to use in the draw options. + myGraphics = Graphics::FromHwnd(panel1->Handle); + } + + private: + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container(); + this->listBox1 = gcnew System::Windows::Forms::ListBox(); + this->label3 = gcnew System::Windows::Forms::Label(); + this->button1 = gcnew System::Windows::Forms::Button(); + this->button2 = gcnew System::Windows::Forms::Button(); + this->button3 = gcnew System::Windows::Forms::Button(); + this->button4 = gcnew System::Windows::Forms::Button(); + this->pictureBox1 = gcnew System::Windows::Forms::PictureBox(); + this->imageList1 = gcnew System::Windows::Forms::ImageList(this->components); + this->openFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog(); + this->panel1 = gcnew System::Windows::Forms::Panel(); + this->label5 = gcnew System::Windows::Forms::Label(); + this->SuspendLayout(); + + this->listBox1->Location = System::Drawing::Point(16, 16); + this->listBox1->Size = System::Drawing::Size(400, 95); + this->listBox1->TabIndex = 0; + + this->label3->Location = System::Drawing::Point(24, 168); + this->label3->Text = "label3"; + + this->button1->Location = System::Drawing::Point(96, 128); + this->button1->Size = System::Drawing::Size(104, 23); + this->button1->Text = "Show Next Image"; + this->button1->Click += gcnew System::EventHandler(this,&Form1::button1_Click); + + this->button2->Location = System::Drawing::Point(208, 128); + this->button2->Size = System::Drawing::Size(104, 23); + this->button2->Text = "Remove Image"; + this->button2->Click += gcnew System::EventHandler(this,&Form1::button2_Click); + + this->button3->Location = System::Drawing::Point(320, 128); + this->button3->Text = "Clear List"; + this->button3->Click += gcnew System::EventHandler(this,&Form1::button3_Click); + + this->button4->Location = System::Drawing::Point(16, 128); + this->button4->Text = "Open Image"; + this->button4->Click += gcnew System::EventHandler(this,&Form1::button4_Click); + + this->pictureBox1->Location = System::Drawing::Point(328, 232); + this->pictureBox1->Size = System::Drawing::Size(336, 192); + + this->imageList1->ImageSize = System::Drawing::Size(16, 16); + this->imageList1->TransparentColor = System::Drawing::Color::Transparent; + + this->panel1->Location = System::Drawing::Point(8, 240); + this->panel1->Size = System::Drawing::Size(296, 184); + + this->label5->Location = System::Drawing::Point(168, 168); + this->label5->Size = System::Drawing::Size(312, 40); + this->label5->Text = "label5"; + + this->ClientSize = System::Drawing::Size(672, 461); + this->Controls->Add(this->label5); + this->Controls->Add(this->panel1); + this->Controls->Add(this->pictureBox1); + this->Controls->Add(this->button4); + this->Controls->Add(this->button3); + this->Controls->Add(this->button2); + this->Controls->Add(this->button1); + this->Controls->Add(this->label3); + this->Controls->Add(this->listBox1); + this->ResumeLayout(false); + } + + // Display the image. + private: + void button1_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) + { + if(!imageList1->Images->Empty) + { + if(imageList1->Images->Count-1 > currentImage) + { + currentImage++; + } + else + { + currentImage=0; + } + panel1->Refresh(); + + // Draw the image in the panel. + imageList1->Draw(myGraphics,10,10,currentImage); + + // Show the image in the PictureBox. + pictureBox1->Image = imageList1->Images[currentImage]; + label3->Text = "Current image is " + currentImage ; + listBox1->SelectedIndex = currentImage; + // label5->Text = "Image is " + listBox1->Text ; + label5->Text = String::Concat("Image is ",listBox1->Text); + } + } + + // Remove the image. + private: + void button2_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) + { + imageList1->Images->RemoveAt(listBox1->SelectedIndex); + listBox1->Items->Remove(listBox1->SelectedItem); + } + + // Clear all images. + private: + void button3_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) + { + imageList1->Images->Clear(); + listBox1->Items->Clear(); + } + + // Find an image. + private: + void button4_Click (Object^ /*sender*/, System::EventArgs^ /*e*/) + { + openFileDialog1->Multiselect = true ; + if(openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK) + { + if (openFileDialog1->FileNames != nullptr) + { + for(int i =0 ; i < openFileDialog1->FileNames->Length ; i++ ) + { + addImage(openFileDialog1->FileNames[i]); + } + } + else + addImage(openFileDialog1->FileName); + } + + } + + private: + void addImage(String^ imageToLoad) + { + if (imageToLoad != "") + { + imageList1->Images->Add(Image::FromFile(imageToLoad)); + listBox1->BeginUpdate(); + listBox1->Items->Add(imageToLoad); + listBox1->EndUpdate(); + } + } + + public: + static void Main(array^ /*args*/) + { + Application::Run(gcnew Form1()); + } + }; + +} +[STAThreadAttribute] +int main(){ + myImageRotator::Form1::Main(nullptr); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp new file mode 100644 index 00000000000..a8c4af56b35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage Example/CPP/source.cpp @@ -0,0 +1,45 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void GetLanguages() + { + // Gets the list of installed languages. + for each ( InputLanguage^ lang in InputLanguage::InstalledInputLanguages ) + { + textBox1->Text = String::Concat( textBox1->Text, lang->Culture->EnglishName, "\n" ); + } + } + // + + // +public: + void SetNewCurrentLanguage() + { + + // Gets the default, and current languages. + InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; + InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; + textBox1->Text = String::Format( "Current input language is: {0}\nDefault input language is: {1}\n", + myCurrentLanguage->Culture->EnglishName, myDefaultLanguage->Culture->EnglishName ); + + // Changes the current input language to the default, and prints the new current language. + InputLanguage::CurrentInputLanguage = myDefaultLanguage; + textBox1->Text = String::Format( "{0}Current input language is now: {1}", + textBox1->Text, myDefaultLanguage->Culture->EnglishName ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp new file mode 100644 index 00000000000..f188405c0fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Culture Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void MyCulture() + { + // Gets the current input language. + InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; + + // Gets the culture for the language and prints it. + CultureInfo^ myCultureInfo = myCurrentLanguage->Culture; + textBox1->Text = myCultureInfo->EnglishName; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp new file mode 100644 index 00000000000..95851dd02a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.CurrentInputLanguage Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void MyCurrentInputLanguage() + { + // Gets the current input language and prints it in a text box. + InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; + textBox1->Text = String::Format( "Current input language is: {0}", + myCurrentLanguage->Culture->EnglishName ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp new file mode 100644 index 00000000000..229ddd98615 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.DefaultInputLanguage Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void MyDefaultInputLanguage() + { + // Gets the default input language and prints it in a text box. + InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; + textBox1->Text = String::Format( "Default input language is: {0}", + myDefaultLanguage->Culture->EnglishName ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp new file mode 100644 index 00000000000..57143dea445 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.FromCulture Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void SetNewCurrentLanguage() + { + // Gets the default, and current languages. + InputLanguage^ myDefaultLanguage = InputLanguage::DefaultInputLanguage; + InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; + textBox1->Text = String::Format( "{0}Current input language is: {1}\n", + myCurrentLanguage->Culture->EnglishName, myDefaultLanguage->Culture->EnglishName ); + + //Print the new current input language. + InputLanguage^ myCurrentLanguage2 = InputLanguage::CurrentInputLanguage; + textBox1->Text = String::Format( "{0}New current input language is: {1}", + textBox1->Text, myCurrentLanguage2->Culture->EnglishName ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp new file mode 100644 index 00000000000..1f9f2ca8dfa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.Handle Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void MyHandle() + { + // Gets the current input language. + InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; + + // Gets a handle for the language and prints the number. + IntPtr myHandle = myCurrentLanguage->Handle; + textBox1->Text = String::Format( "The handle number is: {0}", myHandle ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp new file mode 100644 index 00000000000..109b82b0061 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.InstalledInputLanguages Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void GetLanguages() + { + // Gets the list of installed languages. + for each ( InputLanguage^ lang in InputLanguage::InstalledInputLanguages ) + { + textBox1->Text = String::Concat( textBox1->Text, lang->Culture->EnglishName, "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp new file mode 100644 index 00000000000..77d24b10b47 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic InputLanguage.LayoutName Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void MyLayoutName() + { + // Gets the current input language. + InputLanguage^ myCurrentLanguage = InputLanguage::CurrentInputLanguage; + + if ( myCurrentLanguage != nullptr ) + { + textBox1->Text = String::Format( "Layout: {0}", myCurrentLanguage->LayoutName ); + } + else + { + textBox1->Text = "There is no current language"; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp new file mode 100644 index 00000000000..066abcf0e38 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source.cpp @@ -0,0 +1,52 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// +public ref class myKeyPressClass +{ +private: + static long keyPressCount = 0; + static long backspacePressed = 0; + static long returnPressed = 0; + static long escPressed = 0; + TextBox^ textBox1; + void myKeyCounter( Object^ sender, KeyPressEventArgs^ ex ) + { + switch ( ex->KeyChar ) + { + // Counts the backspaces. + case '\b': + backspacePressed = backspacePressed + 1; + break; + + // Counts the ENTER keys. + case '\r': + returnPressed = returnPressed + 1; + break; + + // Counts the ESC keys. + case (char)27: + escPressed = escPressed + 1; + break; + + // Counts all other keys. + default: + keyPressCount = keyPressCount + 1; + break; + } + textBox1->Text = String::Concat( + backspacePressed, " backspaces pressed\r\n", + escPressed, " escapes pressed\r\n", + returnPressed, " returns pressed\r\n", + keyPressCount, " other keys pressed\r\n" ); + ex->Handled = true; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp new file mode 100644 index 00000000000..85ab9f807e5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic KeyPressEventArgs Example/CPP/source2.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + ref class myKeyPressClass + { + internal: + void myKeyCounter( Object^ sender, KeyPressEventArgs^ ex ){} + }; + + TextBox^ textBox1; + + // +public: + myKeyPressClass^ myKeyPressHandler; + + Form1() + { + myKeyPressHandler = gcnew myKeyPressClass; + + InitializeComponent(); + + textBox1->KeyPress += gcnew KeyPressEventHandler( + myKeyPressHandler, &myKeyPressClass::myKeyCounter ); + } + // + +private: + void InitializeComponent(){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp new file mode 100644 index 00000000000..6caa4a34867 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Label Example/CPP/source.cpp @@ -0,0 +1,43 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ImageList^ imageList1; + + // +public: + void CreateMyLabel() + { + // Create an instance of a Label. + Label^ label1 = gcnew Label; + + // Set the border to a three-dimensional border. + label1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + // Set the ImageList to use for displaying an image. + label1->ImageList = imageList1; + // Use the second image in imageList1. + label1->ImageIndex = 1; + // Align the image to the top left corner. + label1->ImageAlign = ContentAlignment::TopLeft; + + // Specify that the text can display mnemonic characters. + label1->UseMnemonic = true; + // Set the text of the control and specify a mnemonic character. + label1->Text = "First &Name:"; + + /* Set the size of the control based on the PreferredHeight and PreferredWidth values. */ + label1->Size = System::Drawing::Size( label1->PreferredWidth, label1->PreferredHeight ); + + //...Code to add the control to the form... + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp new file mode 100644 index 00000000000..4b31e6628bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic LicenseManager Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// +// Adds the LicenseProviderAttribute to the control. + +[LicenseProvider(LicFileLicenseProvider::typeid)] +public ref class MyControl: public Control +{ + // Creates a new, null license. +private: + License^ license; + +public: + MyControl() + { + + // Adds Validate to the control's constructor. + license = LicenseManager::Validate( MyControl::typeid, this ); + + // Insert code to perform other instance creation tasks here. + } + +public: + ~MyControl() + { + if ( license != nullptr ) + { + delete license; + license = nullptr; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..b3f6a89eee9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic LicenseProviderAttribute Example/CPP/source.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// +[LicenseProvider(LicFileLicenseProvider::typeid)] +ref class MyControl: public Control +{ +protected: + + // Insert code here. + ~MyControl() + { + /* All components must dispose of the licenses they grant. + * Insert code here to dispose of the license. */ + } +}; +// + +// +int main() +{ + // Creates a new component. + MyControl^ myNewControl = gcnew MyControl; + + // Gets the attributes for the component. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewControl ); + + /* Prints the name of the license provider by retrieving the LicenseProviderAttribute + * from the AttributeCollection. */ + LicenseProviderAttribute^ myAttribute = dynamic_cast(attributes[ LicenseProviderAttribute::typeid ]); + Console::WriteLine( "The license provider for this class is: {0}", myAttribute->LicenseProvider ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp new file mode 100644 index 00000000000..b45711df95d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ListBox Example/CPP/source.cpp @@ -0,0 +1,63 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +private: + + // + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Create an instance of the ListBox. + ListBox^ listBox1 = gcnew ListBox; + + // Set the size and location of the ListBox. + listBox1->Size = System::Drawing::Size( 200, 100 ); + listBox1->Location = System::Drawing::Point( 10, 10 ); + + // Add the ListBox to the form. + this->Controls->Add( listBox1 ); + + // Set the ListBox to display items in multiple columns. + listBox1->MultiColumn = true; + + // Set the selection mode to multiple and extended. + listBox1->SelectionMode = SelectionMode::MultiExtended; + + // Shutdown the painting of the ListBox as items are added. + listBox1->BeginUpdate(); + + // Loop through and add 50 items to the ListBox. + for ( int x = 1; x <= 50; x++ ) + { + listBox1->Items->Add( String::Format( "Item {0}", x ) ); + + } + listBox1->EndUpdate(); + + // Select three items from the ListBox. + listBox1->SetSelected( 1, true ); + listBox1->SetSelected( 3, true ); + listBox1->SetSelected( 5, true ); + + #if defined(DEBUG) + // Display the second selected item in the ListBox to the console. + System::Diagnostics::Debug::WriteLine( listBox1->SelectedItems[ 1 ] ); + + // Display the index of the first selected item in the ListBox. + System::Diagnostics::Debug::WriteLine( listBox1->SelectedIndices[ 0 ] ); + #endif + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp new file mode 100644 index 00000000000..91d6bedb44d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ListBox.BeginUpdate Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ListBox^ listBox1; + +public: + + // + void AddToMyListBox() + { + // Stop the ListBox from drawing while items are added. + listBox1->BeginUpdate(); + + // Loop through and add five thousand new items. + for ( int x = 1; x < 5000; x++ ) + { + listBox1->Items->Add( String::Format( "Item {0}", x ) ); + } + listBox1->EndUpdate(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..ccc1027a41c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +#using + +using namespace System; +using namespace System::ComponentModel; +public ref class Class1 +{ + // +public: + property int MyProperty + { + [Localizable(true)] + int get() + { + // Insert code here. + return 0; + } + + void set( int value ) + { + // Insert code here. + } + } + // + + void Method1() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the property needs to be localized. + LocalizableAttribute^ myAttribute = dynamic_cast(attributes[ LocalizableAttribute::typeid ]); + if ( myAttribute->IsLocalizable ) + { + // Insert code here. + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp new file mode 100644 index 00000000000..f60ad20e72c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.IsLocalizable Example/CPP/source.cpp @@ -0,0 +1,33 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the property needs to be localized. + LocalizableAttribute^ myAttribute = dynamic_cast(attributes[ LocalizableAttribute::typeid ]); + if ( myAttribute->IsLocalizable ) + { + // Insert code here. + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..9a5586529ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic LocalizableAttribute.LocalizableAttribute Example/CPP/source.cpp @@ -0,0 +1,32 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +public: + + property int MyProperty + { + // + [Localizable(true)] + int get() + { + // Insert code here. + return 0; + } + + void set( int value ) + { + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp new file mode 100644 index 00000000000..3e73d7ec1ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.GetForm Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MainMenu^ mainMenu1; + +public: + + // + void CloneMyMenu() + { + // Determine if mainMenu1 is currently hosted on the form. + if ( mainMenu1->GetForm() != nullptr ) + { + // Create a copy of the MainMenu that is hosted on the form. + MainMenu^ mainMenu2 = mainMenu1->CloneMenu(); + + // Set the RightToLeft property for mainMenu2. + mainMenu2->RightToLeft = ::RightToLeft::Yes; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp new file mode 100644 index 00000000000..b6afcc67e31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu Example/CPP/source.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + + // + void CreateMyMainMenu() + { + // Create an empty MainMenu. + MainMenu^ mainMenu1 = gcnew MainMenu; + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + menuItem1->Text = "File"; + menuItem2->Text = "Edit"; + + // Add two MenuItem objects to the MainMenu. + mainMenu1->MenuItems->Add( menuItem1 ); + mainMenu1->MenuItems->Add( menuItem2 ); + + // Bind the MainMenu to Form1. + Menu = mainMenu1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp new file mode 100644 index 00000000000..a85380ec9cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.MainMenu1 Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + + // + void CreateMyMainMenu() + { + // Create two MenuItem objects and assign to array. + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + menuItem1->Text = "&File"; + menuItem2->Text = "&Edit"; + + // Create a MainMenu and assign MenuItem objects. + array^temp2 = {menuItem1,menuItem2}; + MainMenu^ mainMenu1 = gcnew MainMenu( temp2 ); + + // Bind the MainMenu to Form1. + Menu = mainMenu1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp new file mode 100644 index 00000000000..3e73d7ec1ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MainMenu.RightToLeft Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MainMenu^ mainMenu1; + +public: + + // + void CloneMyMenu() + { + // Determine if mainMenu1 is currently hosted on the form. + if ( mainMenu1->GetForm() != nullptr ) + { + // Create a copy of the MainMenu that is hosted on the form. + MainMenu^ mainMenu2 = mainMenu1->CloneMenu(); + + // Set the RightToLeft property for mainMenu2. + mainMenu2->RightToLeft = ::RightToLeft::Yes; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp new file mode 100644 index 00000000000..665a50ccccf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Margins Example/CPP/source.cpp @@ -0,0 +1,65 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; +public ref class Sample: public Form +{ +protected: + StreamReader^ streamToPrint; + String^ filePath; + String^ printer; + System::Drawing::Font^ printFont; + +public: + + // + void Printing() + { + try + { + + /* This assumes that a variable of type string, named filePath, + has been set to the path of the file to print. */ + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew System::Drawing::Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + + /* This assumes that a method, named pd_PrintPage, has been + defined. pd_PrintPage handles the PrintPage event. */ + pd->PrintPage += gcnew PrintPageEventHandler( this, &Sample::pd_PrintPage ); + + /* This assumes that a variable of type string, named + printer, has been set to the printer's name. */ + pd->PrinterSettings->PrinterName = printer; + + // Create a new instance of Margins with one inch margins. + Margins^ margins = gcnew Margins( 100,100,100,100 ); + pd->DefaultPageSettings->Margins = margins; + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + + } + catch ( Exception^ ex ) + { + MessageBox::Show( String::Concat( "An error occurred printing the file - ", ex->Message ) ); + } + + } + + + // +private: + void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ /*e*/ ){} + +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp new file mode 100644 index 00000000000..ad5c8dd3c9c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Margins.Left Example/CPP/source.cpp @@ -0,0 +1,68 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class Sample: public Form +{ +protected: + StreamReader^ streamToPrint; + String^ filePath; + String^ printer; + System::Drawing::Font^ printFont; + +public: + + // + void Printing() + { + try + { + + /* This assumes that a variable of type string, named filePath, + has been set to the path of the file to print. */ + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew System::Drawing::Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + + /* This assumes that a method, named pd_PrintPage, has been + defined. pd_PrintPage handles the PrintPage event. */ + pd->PrintPage += gcnew PrintPageEventHandler( this, &Sample::pd_PrintPage ); + + /* This assumes that a variable of type string, named + printer, has been set to the printer's name. */ + pd->PrinterSettings->PrinterName = printer; + + // Set the left and right margins to 1 inch. + pd->DefaultPageSettings->Margins->Left = 100; + pd->DefaultPageSettings->Margins->Right = 100; + + // Set the top and bottom margins to 1.5 inches. + pd->DefaultPageSettings->Margins->Top = 150; + pd->DefaultPageSettings->Margins->Bottom = 150; + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + + } + catch ( Exception^ ex ) + { + MessageBox::Show( String::Concat( "An error occurred printing the file - ", ex->Message ) ); + } + + } + // + +private: + void pd_PrintPage( Object^, PrintPageEventArgs^ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp new file mode 100644 index 00000000000..c36307e6974 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Menu Example/CPP/source.cpp @@ -0,0 +1,49 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MainMenu^ mainMenu1; + MenuItem^ menuItem1; + MenuItem^ menuItem2; + MenuItem^ menuItem3; + MenuItem^ menuItem4; + + // +public: + void CreateMyMenu() + { + // Set the caption for the top-level menu item. + menuItem1->Text = "Edit"; + // Set the caption for the first submenu. + menuItem2->Text = "Font Size"; + // Set the caption for menuItem2's first submenu. + menuItem3->Text = "Small"; + // Set the checked property to true since this is the default value. + menuItem3->Checked = true; + // Define a shortcut key combination for the menu item. + menuItem3->Shortcut = Shortcut::CtrlS; + // Set the caption of the second sub menu item of menuItem2. + menuItem4->Text = "Large"; + // Define a shortcut key combination for the menu item. + menuItem4->Shortcut = Shortcut::CtrlL; + // Set the index of the menu item so it is placed below the first submenu item. + menuItem4->Index = 1; + // Add menuItem3 and menuItem4 to menuItem2's list of menu items. + menuItem2->MenuItems->Add( menuItem3 ); + menuItem2->MenuItems->Add( menuItem4 ); + // Add menuItem2 to menuItem1's list of menu items. + menuItem1->MenuItems->Add( menuItem2 ); + // Add menuItem1 to the MainMenu for displaying. + mainMenu1->MenuItems->Add( menuItem1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..f1b7ca62e9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void InitializeMyMainMenu() + { + // Create the MainMenu. + MainMenu^ mainMenu1 = gcnew MainMenu; + + /* Use the MenuItems property to call the Add method + to add two new MenuItem objects to the MainMenu. */ + mainMenu1->MenuItems->Add( "&File" ); + mainMenu1->MenuItems->Add( "&Edit" ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp new file mode 100644 index 00000000000..f44b6225932 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add1 Example/CPP/source.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void InitializeMyMainMenu() + { + // Create the MainMenu. + MainMenu^ mainMenu1 = gcnew MainMenu; + + /* Use the MenuItems property to call the Add method + to add two new MenuItem objects to the MainMenu. */ + mainMenu1->MenuItems->Add( "&File" ); + mainMenu1->MenuItems->Add( "&Edit", gcnew EventHandler( + this, &Form1::menuItem2_Click ) ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + +private: + void menuItem2_Click( System::Object^ sender, System::EventArgs^ e ) + { + // Insert code to handle Click event. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp new file mode 100644 index 00000000000..7e5ac4a71c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.Add4 Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void InitializeMyMainMenu() + { + // Create the MainMenu and the MenuItem to add. + MainMenu^ mainMenu1 = gcnew MainMenu; + MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); + + /* Use the MenuItems property to call the Add method + to add the MenuItem to mainMenu1 at specific index. */ + mainMenu1->MenuItems->Add( 0, menuItem1 ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp new file mode 100644 index 00000000000..e08ebf1f4eb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItemCollection.CopyTo Example/CPP/source.cpp @@ -0,0 +1,35 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + MenuItem^ menuItem2; + System::Windows::Forms::ContextMenu^ contextMenu1; + + // +private: + void CopyMyMenus() + { + // Create empty array to store MenuItem objects. + array^ myItems = gcnew array( + menuItem1->MenuItems->Count + menuItem2->MenuItems->Count ); + + // Copy elements of the first MenuItem collection to array. + menuItem1->MenuItems->CopyTo( myItems, 0 ); + // Copy elements of the second MenuItem collection, after the first set. + menuItem2->MenuItems->CopyTo( myItems, myItems->Length ); + + // Add the array to the menu item collection of the ContextMenu. + contextMenu1->MenuItems->AddRange( myItems ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp new file mode 100644 index 00000000000..24d551c4132 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Menu.MenuItems Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void InitializeMyMainMenu() + { + // Create the MainMenu and the MenuItem to add. + MainMenu^ mainMenu1 = gcnew MainMenu; + MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); + + /* Use the MenuItems property to call the Add method + to add the MenuItem to the MainMenu menu item collection. */ + mainMenu1->MenuItems->Add( menuItem1 ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp new file mode 100644 index 00000000000..b6a6d5f0fd7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.BarBreak Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMenus() + { + // Create three top-level menu items. + MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); + MenuItem^ menuItem2 = gcnew MenuItem( "&New" ); + MenuItem^ menuItem3 = gcnew MenuItem( "&Open" ); + // Set the BarBreak property to display horizontally. + menuItem2->BarBreak = true; + menuItem3->BarBreak = true; + // Add menuItem2 and menuItem3 to the menuItem1's list of menu items. + menuItem1->MenuItems->Add( menuItem2 ); + menuItem1->MenuItems->Add( menuItem3 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp new file mode 100644 index 00000000000..1bcfed6dad4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Break Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMenus() + { + // Create three top-level menu items. + MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); + MenuItem^ menuItem2 = gcnew MenuItem( "&Options" ); + MenuItem^ menuItem3 = gcnew MenuItem( "&Edit" ); + // Place the "Edit" menu on a new line in the menu bar. + menuItem3->Break = true; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp new file mode 100644 index 00000000000..19b8accd843 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Checked Example/CPP/source.cpp @@ -0,0 +1,59 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + MenuItem^ menuItemBlue; + MenuItem^ menuItemRed; + MenuItem^ menuItemGreen; + + // +private: + // The following event handler would be connected to three menu items. + void MyMenuClick( Object^ sender, EventArgs^ e ) + { + // Determine if clicked menu item is the Blue menu item. + if ( sender == menuItemBlue ) + { + // Set the checkmark for the menuItemBlue menu item. + menuItemBlue->Checked = true; + // Uncheck the menuItemRed and menuItemGreen menu items. + menuItemRed->Checked = false; + menuItemGreen->Checked = false; + // Set the color of the text in the TextBox control to Blue. + textBox1->ForeColor = Color::Blue; + } + else if ( sender == menuItemRed ) + { + + // Set the checkmark for the menuItemRed menu item. + menuItemRed->Checked = true; + // Uncheck the menuItemBlue and menuItemGreen menu items. + menuItemBlue->Checked = false; + menuItemGreen->Checked = false; + // Set the color of the text in the TextBox control to Red. + textBox1->ForeColor = Color::Red; + } + else + { + // Set the checkmark for the menuItemGreen. + menuItemGreen->Checked = true; + // Uncheck the menuItemRed and menuItemBlue menu items. + menuItemBlue->Checked = false; + menuItemRed->Checked = false; + // Set the color of the text in the TextBox control to Blue. + textBox1->ForeColor = Color::Green; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp new file mode 100644 index 00000000000..d66c37b17d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu Example/CPP/source.cpp @@ -0,0 +1,25 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + System::Windows::Forms::ContextMenu^ contextMenu1; + + // +public: + void CloneMyMenu() + { + // Clone the menu item and add it to the collection for the shortcut menu. + contextMenu1->MenuItems->Add( menuItem1->CloneMenu() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp new file mode 100644 index 00000000000..4aee89c55e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.CloneMenu1 Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + System::Windows::Forms::ContextMenu^ contextMenu1; + + // +public: + void CloneMyMenu() + { + // Clone the existing MenuItem into the new MenuItem. + MenuItem^ tempMenuItem = menuItem1->CloneMenu(); + + // Assign the cloned MenuItem to the ContextMenu. + contextMenu1->MenuItems->Add( tempMenuItem ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp new file mode 100644 index 00000000000..82efaf99607 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.DefaultItem Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyMenus() + { + MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); + MenuItem^ menuItem2 = gcnew MenuItem( "&New" ); + MenuItem^ menuItem3 = gcnew MenuItem( "&Open" ); + // Make menuItem2 the default menu item. + menuItem2->DefaultItem = true; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp new file mode 100644 index 00000000000..9ae4fd0aa8a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Index Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + MenuItem^ menuItem2; + + // +public: + void SwitchMyMenuItems() + { + // Move menuItem1 down one position in the menu order. + menuItem1->Index = menuItem1->Index + 1; + // Move menuItem2 up one position in the menu order. + menuItem2->Index = menuItem2->Index - 1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp new file mode 100644 index 00000000000..b8f96a7d3a5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.IsParent Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem2; + +public: + + // + void DisableMyChildMenus() + { + + // Determine if menuItem2 is a parent menu. + if ( menuItem2->IsParent) + { + + // Loop through all the submenus. + for ( int i = 0; i < menuItem2->MenuItems->Count; i++ ) + { + + // Disable all of the submenus of menuItem2. + menuItem2->MenuItems[ i ]->Enabled = false; + + } + } + } + + // +}; \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp new file mode 100644 index 00000000000..011cfaf99e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MdiList Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void SetMDIList() + { + // Create the MenuItem to be used to display an MDI list. + MenuItem^ menuItem1 = gcnew MenuItem; + // Set this menu item to be used as an MDI list. + menuItem1->MdiList = true; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp new file mode 100644 index 00000000000..947494c9c18 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMenu() + { + // Create an empty menu item object. + MenuItem^ menuItem1 = gcnew MenuItem; + // Intialize the menu item using the parameterless version of the constructor. + // Set the caption of the menu item. + menuItem1->Text = "&File"; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp new file mode 100644 index 00000000000..c49a0b15784 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem1 Example/CPP/source.cpp @@ -0,0 +1,24 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + + // +public: + void CreateMyMenus() + { + // Create an instance of a MenuItem with a specified caption. + menuItem1 = gcnew MenuItem( "&File" ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp new file mode 100644 index 00000000000..e1ce22509f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem2 Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMenuItem() + { + // Create an instance of MenuItem with caption and an event handler + MenuItem^ menuItem1 = gcnew MenuItem( "&New",gcnew System::EventHandler( + this, &Form1::MenuItem1_Click ) ); + } + +private: + // This method is an event handler for menuItem1 to use when connecting its event handler. + void MenuItem1_Click( Object^ sender, System::EventArgs^ e ) + { + // Code goes here that handles the Click event. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp new file mode 100644 index 00000000000..7c8928f415a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem3 Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyMenuItem() + { + // Create a MenuItem with caption, shortcut key, and an event handler + // specified. + MenuItem^ MenuItem1 = gcnew MenuItem( "&New", + gcnew System::EventHandler( this, &Form1::MenuItem1_Click ), Shortcut::CtrlL ); + } + +private: + // The following method is an event handler for menuItem1 to use when + // connecting the event handler. + void MenuItem1_Click( Object^ sender, EventArgs^ e ) + { + // Code goes here that handles the Click event. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp new file mode 100644 index 00000000000..a676ece6eed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem4 Example/CPP/source.cpp @@ -0,0 +1,35 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMenuItem() + { + // submenu item array. + array^ subMenus = gcnew array(3); + // Create three menu items to add to the submenu item array. + MenuItem^ subMenuItem1 = gcnew MenuItem( "Red" ); + MenuItem^ subMenuItem2 = gcnew MenuItem( "Blue" ); + MenuItem^ subMenuItem3 = gcnew MenuItem( "Green" ); + // Add the submenu items to the array. + subMenus[ 0 ] = subMenuItem1; + subMenus[ 1 ] = subMenuItem2; + subMenus[ 2 ] = subMenuItem3; + // Create an instance of a MenuItem with caption and an array of submenu + // items specified. + MenuItem^ MenuItem1 = gcnew MenuItem( "&Colors",subMenus ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp new file mode 100644 index 00000000000..9b1ea1c0080 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MenuItem5 Example/CPP/source.cpp @@ -0,0 +1,58 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyMenuItem() + { + // Submenu item array. + array^ subMenus = gcnew array(3); + // Create three menu items to add to the submenu item array. + MenuItem^ subMenuItem1 = gcnew MenuItem( "Red" ); + MenuItem^ subMenuItem2 = gcnew MenuItem( "Blue" ); + MenuItem^ subMenuItem3 = gcnew MenuItem( "Green" ); + + // Add the submenu items to the array. + subMenus[ 0 ] = subMenuItem1; + subMenus[ 1 ] = subMenuItem2; + subMenus[ 2 ] = subMenuItem3; + /* Create a MenuItem with caption, shortcut key, + a Click, Popup, and Select event handler, merge type and order, and an + array of submenu items specified. + */ + MenuItem^ menuItem1 = gcnew MenuItem( MenuMerge::Add, 0, + Shortcut::CtrlShiftC, "&Colors", + gcnew EventHandler( this, &Form1::MenuItem1_Click ), + gcnew EventHandler( this, &Form1::MenuItem1_Popup ), + gcnew EventHandler( this, &Form1::MenuItem1_Select ), subMenus ); + } + +private: + // The following method is an event handler for menuItem1 to use when connecting the Click event. + void MenuItem1_Click( Object^ sender, EventArgs^ e ) + { + // Code goes here that handles the Click event. + } + + // The following method is an event handler for menuItem1 to use when connecting the Popup event. + void MenuItem1_Popup( Object^ sender, EventArgs^ e ) + { + // Code goes here that handles the Click event. + } + + // The following method is an event handler for menuItem1 to use when connecting the Select event + void MenuItem1_Select( Object^ sender, EventArgs^ e ) + { + // Code goes here that handles the Click event. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp new file mode 100644 index 00000000000..814177db384 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeMenu1 Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + MenuItem^ menuItem2; + System::Windows::Forms::ContextMenu^ contextMenu1; + + // +private: + void MergeMyMenus() + { + // Set the merge type to merge the items from both top menu items. + menuItem1->MergeType = MenuMerge::MergeItems; + menuItem2->MergeType = MenuMerge::MergeItems; + // Create a copy of my menu item. + MenuItem^ tempMenuItem = gcnew MenuItem; + // Create a copy of menuItem1 before doing the merge. + tempMenuItem = menuItem1->CloneMenu(); + // Merge menuItem1's copy with a clone of menuItem2 + tempMenuItem->MergeMenu( menuItem2->CloneMenu() ); + + // Add the merged menu to the ContextMenu control. + contextMenu1->MenuItems->Add( tempMenuItem ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp new file mode 100644 index 00000000000..9f38276d662 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.MergeType Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + + // +public: + void InitMyFileMenu() + { + // Set the MergeType to Add so that the menu item is added to the merged menu. + menuItem1->MergeType = MenuMerge::Add; + // Set the MergeOrder to 1 so that this menu item is placed lower in the merged menu order. + menuItem1->MergeOrder = 1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp new file mode 100644 index 00000000000..434f33cd25f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.RadioCheck Example/CPP/source.cpp @@ -0,0 +1,67 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + MenuItem^ menuItemRed; + MenuItem^ menuItemBlue; + MenuItem^ menuItemGreen; + + // +public: + // This method is called from the constructor of the form to set up the menu items. + void ConfigureMyMenus() + { + /* Set all of these menu items to Radio-Button check marks so the user can see + that only one color can be selected at a time. */ + menuItemRed->RadioCheck = true; + menuItemBlue->RadioCheck = true; + menuItemGreen->RadioCheck = true; + } + +private: + // The following event handler would be connected to three menu items. + void MyMenuClick( Object^ sender, EventArgs^ e ) + { + if ( sender == menuItemBlue ) + { + // Set the checkmark for the menuItemBlue menu item. + menuItemBlue->Checked = true; + // Uncheck the menuItemRed and menuItemGreen menu items. + menuItemRed->Checked = false; + menuItemGreen->Checked = false; + // Set the color of the text in the TextBox control to Blue. + textBox1->ForeColor = Color::Blue; + } + else if ( sender == menuItemRed ) + { + // Set the checkmark for the menuItemRed menu item. + menuItemRed->Checked = true; + // Uncheck the menuItemBlue and menuItemGreen menu items. + menuItemBlue->Checked = false; + menuItemGreen->Checked = false; + // Set the color of the text in the TextBox control to Red. + textBox1->ForeColor = Color::Red; + } + else + { + // Set the checkmark for the menuItemGreen menu item. + menuItemGreen->Checked = true; + // Uncheck the menuItemRed and menuItemGreen menu items. + menuItemBlue->Checked = false; + menuItemRed->Checked = false; + // Set the color of the text in the TextBox control to Blue. + textBox1->ForeColor = Color::Green; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp new file mode 100644 index 00000000000..e4919f227e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MenuItem.Text Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MenuItem^ menuItem1; + + // +public: + void SetupMyMenuItem() + { + // Set the caption for the menu item. + menuItem1->Text = "&New"; + // Assign a shortcut key. + menuItem1->Shortcut = Shortcut::CtrlN; + // Make the menu item visible. + menuItem1->Visible = true; + // Display the shortcut key combination. + menuItem1->ShowShortcut = true; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..c524e75c988 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute Example/CPP/source.cpp @@ -0,0 +1,70 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ + // +public: + [MergableProperty(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int value ) + { + // Insert code here. + } + } + // + + property int MyProperty2 + { + int get() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the value of the MergablePropertyAttribute is Yes. + if ( attributes[ MergablePropertyAttribute::typeid ]->Equals( MergablePropertyAttribute::Yes ) ) + { + // Insert code here. + } + + // This is another way to see if the property is bindable. + MergablePropertyAttribute^ myAttribute = dynamic_cast(attributes[ MergablePropertyAttribute::typeid ]); + if ( myAttribute->AllowMerge ) + { + // Insert code here. + } + // + return 0; + } + } + + property int MyProperty3 + { + int get() + { + // + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); + if ( attributes[ MergablePropertyAttribute::typeid ]->Equals( MergablePropertyAttribute::Yes ) ) + { + // Insert code here. + } + // + return 0; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp new file mode 100644 index 00000000000..77fd539522a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.AllowMerge Example/CPP/source.cpp @@ -0,0 +1,30 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyPropertyProperty" ]->Attributes; + + // Checks to see if the property is bindable. + MergablePropertyAttribute^ myAttribute = dynamic_cast(attributes[ MergablePropertyAttribute::typeid ]); + if ( myAttribute->AllowMerge ) + { + // Insert code here. + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..04ef313681d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MergablePropertyAttribute.MergablePropertyAttribute Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + [MergableProperty(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int value ) + { + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp new file mode 100644 index 00000000000..c95d4887380 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic MessageBox Example/CPP/source.cpp @@ -0,0 +1,29 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void Form1_FormClosing(Object^ sender, FormClosingEventArgs^ e) + { + // If the no button was pressed ... + if ((MessageBox::Show( + "Are you sure that you would like to close the form?", + "Form Closing", MessageBoxButtons::YesNo, + MessageBoxIcon::Question) == DialogResult::No)) + { + // cancel the closure of the form. + e->Cancel = true; + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp new file mode 100644 index 00000000000..99632a33f84 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic NumericUpDown Example/CPP/source.cpp @@ -0,0 +1,84 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + NumericUpDown^ numericUpDown1; + + // +public: + void InstantiateMyNumericUpDown() + { + // Create and initialize a NumericUpDown control. + numericUpDown1 = gcnew NumericUpDown; + + // Dock the control to the top of the form. + numericUpDown1->Dock = System::Windows::Forms::DockStyle::Top; + + // Set the Minimum, Maximum, and initial Value. + numericUpDown1->Value = 5; + numericUpDown1->Maximum = 2500; + numericUpDown1->Minimum = -100; + + // Add the NumericUpDown to the Form. + Controls->Add( numericUpDown1 ); + } + +private: + // Check box to toggle decimal places to be displayed. + void checkBox1_Click( Object^ sender, EventArgs^ e ) + { + /* If DecimalPlaces is greater than 0, set them to 0 and round the + current Value; otherwise, set DecimalPlaces to 2 and change the + Increment to 0.25. */ + if ( numericUpDown1->DecimalPlaces > 0 ) + { + numericUpDown1->DecimalPlaces = 0; + numericUpDown1->Value = Decimal::Round( numericUpDown1->Value, 0 ); + } + else + { + numericUpDown1->DecimalPlaces = 2; + numericUpDown1->Increment = Decimal(0.25); + } + } + + // Check box to toggle thousands separators to be displayed. + void checkBox2_Click( Object^ sender, EventArgs^ e ) + { + /* If ThousandsSeparator is true, set it to false; + otherwise, set it to true. */ + if ( numericUpDown1->ThousandsSeparator ) + { + numericUpDown1->ThousandsSeparator = false; + } + else + { + numericUpDown1->ThousandsSeparator = true; + } + } + + // Check box to toggle hexadecimal to be displayed. + void checkBox3_Click( Object^ sender, EventArgs^ e ) + { + /* If Hexadecimal is true, set it to false; + otherwise, set it to true. */ + if ( numericUpDown1->Hexadecimal ) + { + numericUpDown1->Hexadecimal = false; + } + else + { + numericUpDown1->Hexadecimal = true; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp new file mode 100644 index 00000000000..e761175bd12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature Example/CPP/source.cpp @@ -0,0 +1,48 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void LayeredWindows() + { + // Gets the version of the layered windows feature. + Version^ myVersion = OSFeature::Feature->GetVersionPresent( + OSFeature::LayeredWindows ); + + // Prints whether the feature is available. + if ( myVersion != nullptr ) + { + textBox1->Text = "Layered windows feature is installed.\n"; + } + else + { + textBox1->Text = "Layered windows feature is not installed.\n"; + } + + + // This is an alternate way to check whether a feature is present. + if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) ) + { + textBox1->Text = String::Concat( textBox1->Text, + "Again, layered windows feature is installed." ); + } + else + { + textBox1->Text = String::Concat( textBox1->Text, + "Again, layered windows feature is not installed." ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp new file mode 100644 index 00000000000..537c092e9ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.GetVersionPresent Example/CPP/source.cpp @@ -0,0 +1,35 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void LayeredWindows() + { + // Gets the version of the layered windows feature. + Version^ myVersion = OSFeature::Feature->GetVersionPresent( + OSFeature::LayeredWindows ); + + // Prints whether the feature is available. + if ( myVersion != nullptr ) + { + textBox1->Text = "Layered windows feature is installed.\n"; + } + else + { + textBox1->Text = "Layered windows feature is not installed.\n"; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp new file mode 100644 index 00000000000..c12ac6cb7bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic OSFeature.LayeredWindows Example/CPP/source.cpp @@ -0,0 +1,35 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void LayeredWindows() + { + // Gets the version of the layered windows feature. + Version^ myVersion = OSFeature::Feature->GetVersionPresent( + OSFeature::LayeredWindows ); + + // Prints whether the feature is available. + if ( OSFeature::Feature->IsPresent( OSFeature::LayeredWindows ) ) + { + textBox1->Text = "Layered windows feature is installed."; + } + else + { + textBox1->Text = "Layered windows feature is not installed."; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp new file mode 100644 index 00000000000..967a5941b06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic OpenFileDialog Example/CPP/source.cpp @@ -0,0 +1,38 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Stream^ myStream; + OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog; + + openFileDialog1->InitialDirectory = "c:\\"; + openFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; + openFileDialog1->FilterIndex = 2; + openFileDialog1->RestoreDirectory = true; + + if ( openFileDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK ) + { + if ( (myStream = openFileDialog1->OpenFile()) != nullptr ) + { + // Insert code to read the stream here. + myStream->Close(); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp new file mode 100644 index 00000000000..f40c24f472e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings Example/CPP/source.cpp @@ -0,0 +1,52 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Sample +{ +protected: + StreamReader^ streamToPrint; + Font^ printFont; + String^ filePath; + String^ printer; + + // +public: + void Printing() + { + try + { + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( + this, &Sample::pd_PrintPage ); + pd->PrinterSettings->PrinterName = printer; + // Set the page orientation to landscape. + pd->DefaultPageSettings->Landscape = true; + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + +private: + // Method added so sample will compile + void pd_PrintPage( Object^, PrintPageEventArgs^ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp new file mode 100644 index 00000000000..a30098eb238 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PageSettings.Margins Example/CPP/source.cpp @@ -0,0 +1,53 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Sample +{ +protected: + StreamReader^ streamToPrint; + Font^ printFont; + String^ filePath; + String^ printer; + + // +public: + void Printing() + { + try + { + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( + this, &Sample::pd_PrintPage ); + pd->PrinterSettings->PrinterName = printer; + // Create a new instance of Margins with 1-inch margins. + Margins^ margins = gcnew Margins( 100,100,100,100 ); + pd->DefaultPageSettings->Margins = margins; + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + +private: + // Method added so sample will compile + void pd_PrintPage( Object^, PrintPageEventArgs^ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp new file mode 100644 index 00000000000..afe25cc74df --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Panel Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyPanel() + { + Panel^ panel1 = gcnew Panel; + TextBox^ textBox1 = gcnew TextBox; + Label^ label1 = gcnew Label; + + // Initialize the Panel control. + panel1->Location = System::Drawing::Point( 56, 72 ); + panel1->Size = System::Drawing::Size( 264, 152 ); + // Set the Borderstyle for the Panel to three-dimensional. + panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + + // Initialize the Label and TextBox controls. + label1->Location = System::Drawing::Point( 16, 16 ); + label1->Text = "label1"; + label1->Size = System::Drawing::Size( 104, 16 ); + textBox1->Location = System::Drawing::Point( 16, 32 ); + textBox1->Text = ""; + textBox1->Size = System::Drawing::Size( 152, 20 ); + + // Add the Panel control to the form. + this->Controls->Add( panel1 ); + // Add the Label and TextBox controls to the Panel. + panel1->Controls->Add( label1 ); + panel1->Controls->Add( textBox1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..c9191c3fd20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Panel.BorderStyle Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyPanel() + { + Panel^ panel1 = gcnew Panel; + + // Initialize the Panel control. + panel1->Location = Point(56,72); + panel1->Size = System::Drawing::Size( 264, 152 ); + // Set the Borderstyle for the Panel to three-dimensional. + panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp new file mode 100644 index 00000000000..a1e2d110670 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PictureBox Example/CPP/source.cpp @@ -0,0 +1,52 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + PictureBox^ pictureBox1; + +private: + + // + Bitmap^ MyImage; + +public: + void ShowMyImage( String^ fileToDisplay, int xSize, int ySize ) + { + + // Sets up an image object to be displayed. + if ( MyImage != nullptr ) + { + delete MyImage; + } + + + // Stretches the image to fit the pictureBox. + pictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; + MyImage = gcnew Bitmap( fileToDisplay ); + pictureBox1->ClientSize = System::Drawing::Size( xSize, ySize ); + pictureBox1->Image = dynamic_cast(MyImage); + } + + // +}; + +/* +This code produces the following output: + +Reflection.Parameterinfo + +Mymethodbase = Void mymethod(Int32, System.String ByRef, System.String ByRef) +For parameter # 0, the ParameterType is - System.Int32 +For parameter # 1, the ParameterType is - System.String& +For parameter # 2, the ParameterType is - System.String& +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp new file mode 100644 index 00000000000..5ec287eade6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintControllerWithStatusDialog Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Data; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class myControllerImplementation: public PrintController{}; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + bool useMyPrintController; + bool wantsStatusDialog; + PrintDocument^ myDocumentPrinter; + + // + void myPrint() + { + if ( useMyPrintController ) + { + myDocumentPrinter->PrintController = gcnew myControllerImplementation; + if ( wantsStatusDialog ) + { + myDocumentPrinter->PrintController = + gcnew PrintControllerWithStatusDialog( myDocumentPrinter->PrintController ); + } + } + myDocumentPrinter->Print(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..944b9fad1ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument Example/CPP/source.cpp @@ -0,0 +1,116 @@ +// + +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class PrintingExample: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + System::Windows::Forms::Button^ printButton; + System::Drawing::Font^ printFont; + StreamReader^ streamToPrint; + +public: + PrintingExample() + : Form() + { + + // The Windows Forms Designer requires the following call. + InitializeComponent(); + } + + +private: + + // The Click event is raised when the user clicks the Print button. + void printButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + streamToPrint = gcnew StreamReader( "C:\\My Documents\\MyFile.txt" ); + try + { + printFont = gcnew System::Drawing::Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( this, &PrintingExample::pd_PrintPage ); + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + + } + + + // The PrintPage event is raised for each page to be printed. + void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev ) + { + float linesPerPage = 0; + float yPos = 0; + int count = 0; + float leftMargin = (float)ev->MarginBounds.Left; + float topMargin = (float)ev->MarginBounds.Top; + String^ line = nullptr; + + // Calculate the number of lines per page. + linesPerPage = ev->MarginBounds.Height / printFont->GetHeight( ev->Graphics ); + + // Print each line of the file. + while ( count < linesPerPage && ((line = streamToPrint->ReadLine()) != nullptr) ) + { + yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); + ev->Graphics->DrawString( line, printFont, Brushes::Black, leftMargin, yPos, gcnew StringFormat ); + count++; + } + + + // If more lines exist, print another page. + if ( line != nullptr ) + ev->HasMorePages = true; + else + ev->HasMorePages = false; + } + + + // The Windows Forms Designer requires the following procedure. + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->printButton = gcnew System::Windows::Forms::Button; + this->ClientSize = System::Drawing::Size( 504, 381 ); + this->Text = "Print Example"; + printButton->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft; + printButton->Location = System::Drawing::Point( 32, 110 ); + printButton->FlatStyle = System::Windows::Forms::FlatStyle::Flat; + printButton->TabIndex = 0; + printButton->Text = "Print the file."; + printButton->Size = System::Drawing::Size( 136, 40 ); + printButton->Click += gcnew System::EventHandler( this, &PrintingExample::printButton_Click ); + this->Controls->Add( printButton ); + } + +}; + + +// This is the main entry point for the application. +int main() +{ + Application::Run( gcnew PrintingExample ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp new file mode 100644 index 00000000000..3e53b5db8c4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintController Example/CPP/source.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing::Printing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class myControllerImplementation: public PrintController{}; + +public ref class Form1: public Form +{ +protected: + bool useMyPrintController; + bool wantsStatusDialog; + PrintDocument^ myPrintDocument; + + // +public: + void myPrint() + { + if ( useMyPrintController) + { + myPrintDocument->PrintController = + gcnew myControllerImplementation; + if ( wantsStatusDialog) + { + myPrintDocument->PrintController = + gcnew PrintControllerWithStatusDialog( + myPrintDocument->PrintController ); + } + } + myPrintDocument->Print(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp new file mode 100644 index 00000000000..ee6527d470b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintDocument Example/CPP/source.cpp @@ -0,0 +1,87 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + String^ printer; + String^ filePath; + +private: + System::Drawing::Font^ printFont; + StreamReader^ streamToPrint; + + // +public: + void Printing() + { + try + { + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew System::Drawing::Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( + this, &Form1::pd_PrintPage ); + pd->PrinterSettings->PrinterName = printer; + // Set the page orientation to landscape. + pd->DefaultPageSettings->Landscape = true; + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + +private: + // The PrintPage event is raised for each page to be printed. + void pd_PrintPage( Object^ sender, PrintPageEventArgs^ ev ) + { + float linesPerPage = 0; + float yPos = 0; + int count = 0; + float leftMargin = (float)(ev->MarginBounds.Left); + float topMargin = (float)(ev->MarginBounds.Top); + String^ line = nullptr; + + // Calculate the number of lines per page. + linesPerPage = ev->MarginBounds.Height / + printFont->GetHeight( ev->Graphics ); + + // Iterate over the file, printing each line. + while ( count < linesPerPage && + ( (line = streamToPrint->ReadLine()) != nullptr) ) + { + yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); + ev->Graphics->DrawString( line, printFont, Brushes::Black, + leftMargin, yPos, gcnew StringFormat ); + count++; + } + + + // If more lines exist, print another page. + if ( line != nullptr ) + { + ev->HasMorePages = true; + } + else + { + ev->HasMorePages = false; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp new file mode 100644 index 00000000000..fed5c1e96de --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrintPage Example/CPP/source.cpp @@ -0,0 +1,111 @@ +// + +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + + +public ref class PrintingExample +{ +private: + Font^ printFont; + StreamReader^ streamToPrint; + static String^ filePath; + +public: + PrintingExample() + { + Printing(); + } + + +private: + + // The PrintPage event is raised for each page to be printed. + void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev ) + { + float linesPerPage = 0; + float yPos = 0; + int count = 0; + float leftMargin = (float)ev->MarginBounds.Left; + float topMargin = (float)ev->MarginBounds.Top; + String^ line = nullptr; + + // Calculate the number of lines per page. + linesPerPage = ev->MarginBounds.Height / printFont->GetHeight( ev->Graphics ); + + // Iterate over the file, printing each line. + while ( count < linesPerPage && ((line = streamToPrint->ReadLine()) != nullptr) ) + { + yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); + ev->Graphics->DrawString( line, printFont, Brushes::Black, leftMargin, yPos, gcnew StringFormat ); + count++; + } + + + // If more lines exist, print another page. + if ( line != nullptr ) + ev->HasMorePages = true; + else + ev->HasMorePages = false; + } + + +public: + + // Print the file. + void Printing() + { + try + { + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( this, &PrintingExample::pd_PrintPage ); + + // Print the document. + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + + } + + static void Main() + { + array^args = Environment::GetCommandLineArgs(); + String^ sampleName = args[ 0 ]; + if ( args->Length != 2 ) + { + Console::WriteLine( "Usage: {0} ", sampleName ); + return; + } + + filePath = args[ 1 ]; + gcnew PrintingExample; + } + +}; + +int main() +{ + PrintingExample::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp new file mode 100644 index 00000000000..d896b6f82bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintDocument.PrinterSettings Example/CPP/source.cpp @@ -0,0 +1,85 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + String^ printer; + static String^ filePath; + +private: + System::Drawing::Font^ printFont; + StreamReader^ streamToPrint; + + // +public: + void Printing() + { + try + { + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew System::Drawing::Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( + this, &Form1::pd_PrintPage ); + // Specify the printer to use. + pd->PrinterSettings->PrinterName = printer; + pd->Print(); + } + finally + { + streamToPrint->Close(); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + +private: + // The PrintPage event is raised for each page to be printed. + void pd_PrintPage( Object^ sender, PrintPageEventArgs^ ev ) + { + float linesPerPage = 0; + float yPos = 0; + int count = 0; + float leftMargin = (float)(ev->MarginBounds.Left); + float topMargin = (float)(ev->MarginBounds.Top); + String^ line = nullptr; + + // Calculate the number of lines per page. + linesPerPage = ev->MarginBounds.Height / + printFont->GetHeight( ev->Graphics ); + + // Iterate over the file, printing each line. + while ( count < linesPerPage && + ((line = streamToPrint->ReadLine()) != nullptr)) + { + yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); + ev->Graphics->DrawString( line, printFont, Brushes::Black, + leftMargin, yPos, gcnew StringFormat ); + count++; + } + + // If more lines exist, print another page. + if ( line != nullptr ) + { + ev->HasMorePages = true; + } + else + { + ev->HasMorePages = false; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp new file mode 100644 index 00000000000..104b40ab8f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrintPageEventArgs Example/CPP/source.cpp @@ -0,0 +1,41 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + // Specifies what happens when the user clicks the Button. + void printButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + pd->Print(); + } + catch ( Exception^ ex ) + { + MessageBox::Show( "An error occurred while printing", ex->ToString() ); + } + } + + // Specifies what happens when the PrintPage event is raised. + void pd_PrintPage( Object^ /*sender*/, PrintPageEventArgs^ ev ) + { + // Draw a picture. + ev->Graphics->DrawImage( Image::FromFile( "C:\\My Folder\\MyFile.bmp" ), + ev->Graphics->VisibleClipBounds ); + + // Indicate that this is the last page to print. + ev->HasMorePages = false; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp new file mode 100644 index 00000000000..cd727cafbdc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PrinterSettings Example/CPP/source.cpp @@ -0,0 +1,91 @@ +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + System::Drawing::Font^ printFont; + StreamReader^ streamToPrint; + +protected: + static String^ filePath; + + // +public: + void Printing( String^ printer ) + { + try + { + streamToPrint = gcnew StreamReader( filePath ); + try + { + printFont = gcnew System::Drawing::Font( "Arial",10 ); + PrintDocument^ pd = gcnew PrintDocument; + pd->PrintPage += gcnew PrintPageEventHandler( + this, &Form1::pd_PrintPage ); + // Specify the printer to use. + pd->PrinterSettings->PrinterName = printer; + if ( pd->PrinterSettings->IsValid ) + { + pd->Print(); + } + else + { + MessageBox::Show( "Printer is invalid." ); + } + } + finally + { + streamToPrint->Close(); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + +private: + // The PrintPage event is raised for each page to be printed. + void pd_PrintPage( Object^ sender, PrintPageEventArgs^ ev ) + { + float linesPerPage = 0; + float yPos = 0; + int count = 0; + float leftMargin = (float)(ev->MarginBounds.Left); + float topMargin = (float)(ev->MarginBounds.Top); + String^ line = nullptr; + + // Calculate the number of lines per page. + linesPerPage = ev->MarginBounds.Height / + printFont->GetHeight( ev->Graphics ); + + // Iterate over the file, printing each line. + while ( count < linesPerPage && + ((line = streamToPrint->ReadLine()) != nullptr)) + { + yPos = topMargin + (count * printFont->GetHeight( ev->Graphics )); + ev->Graphics->DrawString( line, printFont, Brushes::Black, + leftMargin, yPos, gcnew StringFormat ); + count++; + } + + // If more lines exist, print another page. + if ( line != nullptr ) + { + ev->HasMorePages = true; + } + else + { + ev->HasMorePages = false; + } + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp new file mode 100644 index 00000000000..695fa37e18d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection Example/CPP/source.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + +private: + void Method1() + { + // + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + // + } + + // +private: + void MyPropertyCollection() + { + // Creates a new collection and assign it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Displays each property in the collection in a text box. + for each ( PropertyDescriptor^ myProperty in properties ) + { + textBox1->Text = String::Concat( textBox1->Text, myProperty->Name, "\n" ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..c562d60b18f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Count Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void GetCount() + { + // Creates a new collection and assign it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Prints the number of properties on button1 in a textbox. + textBox1->Text = properties->Count.ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp new file mode 100644 index 00000000000..24c9c39e0a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.Find Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void FindProperty() + { + // Creates a new collection and assign it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Sets a PropertyDescriptor to the specific property. + PropertyDescriptor^ myProperty = properties->Find( "Opacity", false ); + + // Prints the property and the property description. + textBox1->Text = myProperty->DisplayName + "\n" + myProperty->Description; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp new file mode 100644 index 00000000000..10a99bf32bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.GetEnumerator Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + + // +private: + void MyEnumerator() + { + // Creates a new collection and assigns it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Creates an enumerator. + IEnumerator^ ie = properties->GetEnumerator(); + + // Prints the name of each property in the collection. + Object^ myProperty; + while ( ie->MoveNext() ) + { + myProperty = ie->Current; + textBox1->Text = textBox1->Text + myProperty + "\n"; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..43b458167f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + +private: + + // + void PrintIndexItem() + { + + // Creates a new collection and assigns it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Prints the second property's name. + textBox1->Text = properties[ 1 ]->ToString(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp new file mode 100644 index 00000000000..5a3214eca1f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyDescriptorCollection.this1 Example/CPP/source.cpp @@ -0,0 +1,34 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + Button^ button1; + TextBox^ textBox1; + +private: + + // + void PrintIndexItem2() + { + + // Creates a new collection and assigns it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Sets a PropertyDescriptor to the specific property. + PropertyDescriptor^ myProperty = properties[ "Opacity" ]; + + // Prints the display name for the property. + textBox1->Text = myProperty->DisplayName; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp new file mode 100644 index 00000000000..ad679e3207f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic PropertyGrid Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + Form1() + { + // The initial constructor code goes here. + + PropertyGrid^ propertyGrid1 = gcnew PropertyGrid; + propertyGrid1->CommandsVisibleIfAvailable = true; + propertyGrid1->Location = Point( 10, 20 ); + propertyGrid1->Size = System::Drawing::Size( 400, 300 ); + propertyGrid1->TabIndex = 1; + propertyGrid1->Text = "Property Grid"; + + this->Controls->Add( propertyGrid1 ); + + propertyGrid1->SelectedObject = textBox1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..87e88922b8d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ProvidePropertyAttribute Example/CPP/source.cpp @@ -0,0 +1,41 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Globalization; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// +[ProvideProperty("MyProperty",Control::typeid)] +public ref class MyClass: public IExtenderProvider +{ +protected: + CultureInfo^ ciMine; + +public: + // Provides the Get portion of MyProperty. + CultureInfo^ GetMyProperty( Control^ myControl ) + { + // Insert code here. + return ciMine; + } + + // Provides the Set portion of MyProperty. + void SetMyProperty( Control^ myControl, String^ value ) + { + // Insert code here. + } + + /* When you inherit from IExtenderProvider, you must implement the + * CanExtend method. */ + virtual bool CanExtend( Object^ target ) + { + return dynamic_cast(target) != nullptr; + } + // Insert additional code here. +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp new file mode 100644 index 00000000000..6e6ffb573b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.CheckAlign Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Sample +{ +private: + RadioButton^ radioButton1; + + // +private: + Void radioButton1_CheckedChanged( System::Object^ sender, + System::EventArgs^ e ) + { + // Change the check box position to be opposite its current position. + if ( radioButton1->CheckAlign == ContentAlignment::MiddleLeft ) + { + radioButton1->CheckAlign = ContentAlignment::MiddleRight; + } + else + { + radioButton1->CheckAlign = ContentAlignment::MiddleLeft; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp new file mode 100644 index 00000000000..00614590c77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.Checked Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + ListBox^ listBox1; + RadioButton^ radioButton1; + RadioButton^ radioButton2; + + // +private: + void ClickMyRadioButton() + { + // If Item1 is selected and radioButton2 + // is checked, click radioButton1. + if ( listBox1->Text == "Item1" && radioButton2->Checked ) + { + radioButton1->PerformClick(); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp new file mode 100644 index 00000000000..24713598553 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RadioButton.OnCheckedChanged Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Sample +{ +private: + RadioButton^ radioButton1; + + // +private: + Void radioButton1_CheckedChanged( System::Object^ sender, System::EventArgs^ e ) + { + // Change the check box position to be opposite its current position. + if ( radioButton1->CheckAlign == ContentAlignment::MiddleLeft ) + { + radioButton1->CheckAlign = ContentAlignment::MiddleRight; + } + else + { + radioButton1->CheckAlign = ContentAlignment::MiddleLeft; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..e723fbeffa5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute Example/CPP/source.cpp @@ -0,0 +1,70 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + + property int MyProperty + { + // + [ReadOnly(true)] + int get() + { + // Insert code here. + return 0; + } + } + // + + void Method1() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see whether the value of the ReadOnlyAttribute is Yes. + if ( attributes[ ReadOnlyAttribute::typeid ]->Equals( ReadOnlyAttribute::Yes ) ) + { + // Insert code here. + } + + // This is another way to see whether the property is read-only. + ReadOnlyAttribute^ myAttribute = dynamic_cast(attributes[ ReadOnlyAttribute::typeid ]); + if ( myAttribute->IsReadOnly ) + { + // Insert code here. + } + // + } + + void Method2() + { + // + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); + if ( attributes[ ReadOnlyAttribute::typeid ]->Equals( ReadOnlyAttribute::Yes ) ) + { + // Insert code here. + } + // + } +}; + +/* +This code produces the following output. + +myQ is not synchronized. +mySyncdQ is synchronized. +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp new file mode 100644 index 00000000000..7a0827623ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.IsReadOnly Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see whether the property is read-only. + ReadOnlyAttribute^ myAttribute = dynamic_cast(attributes[ ReadOnlyAttribute::typeid ]); + if ( myAttribute->IsReadOnly ) + { + // Insert code here. + } + // + } +}; + +/* +This code produces the following output. + +myQ is not synchronized. +mySyncdQ is synchronized. +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..c35222caf0b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ReadOnlyAttribute.ReadOnlyAttribute Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + [ReadOnly(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int value ) + { + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..261eb1e694e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute Example/CPP/source.cpp @@ -0,0 +1,69 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + [RecommendedAsConfigurable(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int /*value*/ ) + { + // Insert code here. + } + } + // + void Method1() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the value of the RecommendedAsConfigurableAttribute is Yes. + if ( attributes[ RecommendedAsConfigurableAttribute::typeid ]->Equals( RecommendedAsConfigurableAttribute::Yes ) ) + { + // Insert code here. + } + + // This is another way to see if the property is recommended as configurable. + RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast(attributes[ RecommendedAsConfigurableAttribute::typeid ]); + if ( myAttribute->RecommendedAsConfigurable ) + { + // Insert code here. + } + // + } + + void Method2() + { + // + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( MyProperty ); + if ( attributes[ RecommendedAsConfigurableAttribute::typeid ]->Equals( RecommendedAsConfigurableAttribute::Yes ) ) + { + // Insert code here. + } + // + } +}; + +/* +This code produces the following output. + +myQ is not synchronized. +mySyncdQ is synchronized. +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp new file mode 100644 index 00000000000..daaf00fa8cb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurable Example/CPP/source.cpp @@ -0,0 +1,40 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + +public: + void Method() + { + // + // Gets the attributes for the property. + AttributeCollection^ attributes = TypeDescriptor::GetProperties( this )[ "MyProperty" ]->Attributes; + + // Checks to see if the property is recommended as configurable. + RecommendedAsConfigurableAttribute^ myAttribute = dynamic_cast(attributes[ RecommendedAsConfigurableAttribute::typeid ]); + if ( myAttribute->RecommendedAsConfigurable ) + { + // Insert code here. + } + // + } +}; + +/* +This code produces the following output. + +myQ is not synchronized. +mySyncdQ is synchronized. +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..7b9aaf400ee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RecommendedAsConfigurableAttribute.RecommendedAsConfigurableAttribute Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + + // +public: + [RecommendedAsConfigurable(true)] + property int MyProperty + { + int get() + { + // Insert code here. + return 0; + } + void set( int value ) + { + + // Insert code here. + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp new file mode 100644 index 00000000000..0ecb7a6993a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyRichTextBox() + { + RichTextBox^ richTextBox1 = gcnew RichTextBox; + richTextBox1->Dock = DockStyle::Fill; + + richTextBox1->LoadFile( "C:\\MyDocument.rtf" ); + richTextBox1->Find( "Text", RichTextBoxFinds::MatchCase ); + + richTextBox1->SelectionFont = gcnew System::Drawing::Font( + "Verdana", 12, FontStyle::Bold ); + richTextBox1->SelectionColor = Color::Red; + + richTextBox1->SaveFile( "C:\\MyDocument.rtf", + RichTextBoxStreamType::RichText ); + + this->Controls->Add( richTextBox1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp new file mode 100644 index 00000000000..db89f1df3a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find Example/CPP/source.cpp @@ -0,0 +1,38 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + bool FindMyText( String^ text ) + { + // Initialize the return value to false by default. + bool returnValue = false; + + // Ensure a search string has been specified. + if ( text->Length > 0 ) + { + // Obtain the location of the search string in richTextBox1. + int indexToText = richTextBox1->Find( text ); + // Determine whether the text was found in richTextBox1. + if ( indexToText >= 0 ) + { + returnValue = true; + } + } + + return returnValue; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp new file mode 100644 index 00000000000..35408c38fe7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find1 Example/CPP/source.cpp @@ -0,0 +1,38 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + bool FindMyText( String^ text ) + { + // Initialize the return value to false by default. + bool returnValue = false; + + // Ensure a search string has been specified. + if ( text->Length > 0 ) + { + // Obtain the location of the search string in richTextBox1. + int indexToText = richTextBox1->Find( text, RichTextBoxFinds::MatchCase ); + // Determine if the text was found in richTextBox1. + if ( indexToText >= 0 ) + { + returnValue = true; + } + } + + return returnValue; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp new file mode 100644 index 00000000000..9ab75655e76 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.Find2 Example/CPP/source.cpp @@ -0,0 +1,38 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + int FindMyText( String^ text, int start ) + { + // Initialize the return value to false by default. + int returnValue = -1; + + // Ensure that a search string has been specified and a valid start point. + if ( text->Length > 0 && start >= 0 ) + { + // Obtain the location of the search string in richTextBox1. + int indexToText = richTextBox1->Find( text, start, RichTextBoxFinds::MatchCase ); + // Determine whether the text was found in richTextBox1. + if ( indexToText >= 0 ) + { + returnValue = indexToText; + } + } + + return returnValue; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp new file mode 100644 index 00000000000..e06e82525b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LinkClicked Example/CPP/source.cpp @@ -0,0 +1,46 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + RichTextBox^ richTextBox1; + +public: + Form1() + { + richTextBox1 = gcnew RichTextBox; + + richTextBox1->LinkClicked += gcnew LinkClickedEventHandler( + this, &Form1::Link_Clicked ); + richTextBox1->SelectedText = "To see Microsoft go to www.microsoft.com"; + richTextBox1->Location = System::Drawing::Point( 10, 10 ); + richTextBox1->Size = System::Drawing::Size( 100, 100 ); + + this->Controls->Add( richTextBox1 ); + } + + // +private: + void Link_Clicked( Object^ sender, System::Windows::Forms::LinkClickedEventArgs^ e ) + { + System::Diagnostics::Process::Start( e->LinkText ); + } + // +}; + +/// +/// The main entry point for the application. +/// +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp new file mode 100644 index 00000000000..5fbe771c3ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + void LoadMyFile() + { + // Create an OpenFileDialog to request a file to open. + OpenFileDialog^ openFile1 = gcnew OpenFileDialog; + + // Initialize the OpenFileDialog to look for RTF files. + openFile1->DefaultExt = "*.rtf"; + openFile1->Filter = "RTF Files|*.rtf"; + + // Determine whether the user selected a file from the OpenFileDialog. + if ( openFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && + openFile1->FileName->Length > 0 ) + { + // Load the contents of the file into the RichTextBox. + richTextBox1->LoadFile( openFile1->FileName ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp new file mode 100644 index 00000000000..d064101f838 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.LoadFile1 Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + void LoadMyFile() + { + // Create an OpenFileDialog to request a file to open. + OpenFileDialog^ openFile1 = gcnew OpenFileDialog; + + // Initialize the OpenFileDialog to look for RTF files. + openFile1->DefaultExt = "*.rtf"; + openFile1->Filter = "RTF Files|*.rtf"; + + // Determine whether the user selected a file from the OpenFileDialog. + if ( openFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && + openFile1->FileName->Length > 0 ) + { + // Load the contents of the file into the RichTextBox. + richTextBox1->LoadFile( openFile1->FileName, RichTextBoxStreamType::PlainText ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp new file mode 100644 index 00000000000..7fd70215b32 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + void SaveMyFile() + { + // Create a SaveFileDialog to request a path and file name to save to. + SaveFileDialog^ saveFile1 = gcnew SaveFileDialog; + + // Initialize the SaveFileDialog to specify the RTF extention for the file. + saveFile1->DefaultExt = "*.rtf"; + saveFile1->Filter = "RTF Files|*.rtf"; + + // Determine whether the user selected a file name from the saveFileDialog. + if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && + saveFile1->FileName->Length > 0 ) + { + // Save the contents of the RichTextBox into the file. + richTextBox1->SaveFile( saveFile1->FileName ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp new file mode 100644 index 00000000000..7eb6ab700c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SaveFile1 Example/CPP/source.cpp @@ -0,0 +1,36 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + void SaveMyFile() + { + // Create a SaveFileDialog to request a path and file name to save to. + SaveFileDialog^ saveFile1 = gcnew SaveFileDialog; + + // Initialize the SaveFileDialog to specify the RTF extension for the file. + saveFile1->DefaultExt = "*.rtf"; + saveFile1->Filter = "RTF Files|*.rtf"; + + // Determine if the user selected a file name from the saveFileDialog. + if ( saveFile1->ShowDialog() == System::Windows::Forms::DialogResult::OK && + saveFile1->FileName->Length > 0 ) + { + // Save the contents of the RichTextBox into the file. + richTextBox1->SaveFile( saveFile1->FileName, RichTextBoxStreamType::PlainText ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp new file mode 100644 index 00000000000..529b0e5ccdf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionColor Example/CPP/source.cpp @@ -0,0 +1,34 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + RichTextBox^ richTextBox1; + + // +public: + void ChangeMySelectionColor() + { + ColorDialog^ colorDialog1 = gcnew ColorDialog; + + // Set the initial color of the dialog to the current text color. + colorDialog1->Color = richTextBox1->SelectionColor; + + // Determine if the user clicked OK in the dialog and that the color has changed. + if ( colorDialog1->ShowDialog() == System::Windows::Forms::DialogResult::OK && + colorDialog1->Color != richTextBox1->SelectionColor ) + { + // Change the selection color to the user specified color. + richTextBox1->SelectionColor = colorDialog1->Color; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp new file mode 100644 index 00000000000..c57eacb6a04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RichTextBox.SelectionFont Example/CPP/source.cpp @@ -0,0 +1,146 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace CSExample +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + + // + // Required for Windows Form Designer support + // + components = nullptr; + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + // #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 256, 24 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "Make me BOLD"; + this->richTextBox1->Enter += gcnew System::EventHandler( this, &Form1::richTextBox1_Enter ); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 8, 40 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 72, 32 ); + this->button1->TabIndex = 1; + this->button1->Text = "Bold"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 117 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + // #endregion + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->ToggleBold(); + } + + // + void ToggleBold() + { + if ( richTextBox1->SelectionFont != nullptr ) + { + System::Drawing::Font^ currentFont = richTextBox1->SelectionFont; + System::Drawing::FontStyle newFontStyle; + if (richTextBox1->SelectionFont->Bold) + { + newFontStyle = FontStyle::Regular; + } + else + { + newFontStyle = FontStyle::Bold; + } + richTextBox1->SelectionFont = gcnew System::Drawing::Font( currentFont->FontFamily,currentFont->Size,newFontStyle ); + } + } + // + void richTextBox1_Enter( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + richTextBox1->SelectionStart = 8; + richTextBox1->SelectionLength = 4; + } + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew CSExample::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..23e4e7d566f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic RunInstallerAttribute Example/CPP/source.cpp @@ -0,0 +1,36 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Configuration::Install; + +// +[RunInstallerAttribute(true)] +ref class MyProjectInstaller: public Installer{ + // Insert code here. +}; +// + +// +int main() +{ + // Creates a new installer. + MyProjectInstaller^ myNewProjectInstaller = gcnew MyProjectInstaller; + + // Gets the attributes for the collection. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewProjectInstaller ); + + /* Prints whether to run the installer by retrieving the + * RunInstallerAttribute from the AttributeCollection. */ + RunInstallerAttribute^ myAttribute = dynamic_cast(attributes[ RunInstallerAttribute::typeid ]); + Console::WriteLine( "Run the installer? {0}", myAttribute->RunInstaller ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp new file mode 100644 index 00000000000..4f6d586ae93 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic SaveFileDialog Example/CPP/source.cpp @@ -0,0 +1,39 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ dataGrid1; + DataSet^ dataSet1; + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Stream^ myStream; + SaveFileDialog^ saveFileDialog1 = gcnew SaveFileDialog; + saveFileDialog1->Filter = "txt files (*.txt)|*.txt|All files (*.*)|*.*"; + saveFileDialog1->FilterIndex = 2; + saveFileDialog1->RestoreDirectory = true; + if ( saveFileDialog1->ShowDialog() == ::DialogResult::OK ) + { + if ( (myStream = saveFileDialog1->OpenFile()) != nullptr ) + { + + // Code to write the stream goes here. + myStream->Close(); + } + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp new file mode 100644 index 00000000000..ff4564c10e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollBar.OnScroll Example/CPP/source.cpp @@ -0,0 +1,56 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Label^ label1; + ScrollBar^ vScrollBar1; + ScrollBar^ hScrollBar1; + +private: + + // + void AddMyScrollEventHandlers() + { + // Create and initialize a VScrollBar. + VScrollBar^ vScrollBar1 = gcnew VScrollBar; + + // Add event handlers for the OnScroll and OnValueChanged events. + vScrollBar1->Scroll += gcnew ScrollEventHandler( this, &Form1::vScrollBar1_Scroll ); + vScrollBar1->ValueChanged += gcnew EventHandler( this, &Form1::vScrollBar1_ValueChanged ); + } + + // Create the ValueChanged event handler. + void vScrollBar1_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Display the new value in the label. + label1->Text = String::Format( "vScrollBar Value:(OnValueChanged Event) {0}", vScrollBar1->Value ); + } + + // Create the Scroll event handler. + void vScrollBar1_Scroll( Object^ /*sender*/, ScrollEventArgs^ e ) + { + // Display the new value in the label. + label1->Text = String::Format( "VScrollBar Value:(OnScroll Event) {0}", e->NewValue ); + } + + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Add 40 to the Value property if it will not exceed the Maximum value. + if ( vScrollBar1->Value + 40 < vScrollBar1->Maximum ) + { + vScrollBar1->Value = vScrollBar1->Value + 40; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp new file mode 100644 index 00000000000..e50167abca9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.AutoScroll Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + Panel^ panel1; + +private: + + // + void SetAutoScrollMargins() + { + /* If the text box is outside the panel's bounds, + turn on auto-scrolling and set the margin. */ + if ( text1->Location.X > panel1->Location.X || text1->Location.Y > panel1->Location.Y ) + { + panel1->AutoScroll = true; + + /* If the AutoScrollMargin is set to less + than (5,5), set it to 5,5. */ + if ( panel1->AutoScrollMargin.Width < 5 || panel1->AutoScrollMargin.Height < 5 ) + { + panel1->SetAutoScrollMargin( 5, 5 ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp new file mode 100644 index 00000000000..060ac25877f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPadding Example/CPP/source.cpp @@ -0,0 +1,71 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + Panel^ panel1; + int myCounter; + +private: + + // + void SetDockPadding() + { + // Dock the button in the panel. + button1->Dock = System::Windows::Forms::DockStyle::Fill; + + // Reset the counter if it is greater than 5. + if ( myCounter > 5 ) + { + myCounter = 0; + } + + // Set the appropriate DockPadding and display + // which one was set on the button face. + switch ( myCounter ) + { + case 0: + panel1->DockPadding->All = 0; + button1->Text = "Start"; + break; + + case 1: + panel1->DockPadding->Top = 10; + button1->Text = "Top"; + break; + + case 2: + panel1->DockPadding->Bottom = 10; + button1->Text = "Bottom"; + break; + + case 3: + panel1->DockPadding->Left = 10; + button1->Text = "Left"; + break; + + case 4: + panel1->DockPadding->Right = 10; + button1->Text = "Right"; + break; + + case 5: + panel1->DockPadding->All = 20; + button1->Text = "All"; + break; + } + myCounter++; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp new file mode 100644 index 00000000000..23502c0025a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.DockPaddingEdges Example/CPP/source.cpp @@ -0,0 +1,73 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + Button^ button1; + Panel^ panel1; + int myCounter; + +private: + + // + void SetDockPadding() + { + // Dock the button in the panel. + button1->Dock = System::Windows::Forms::DockStyle::Fill; + + // Reset the counter if it is greater than 5. + if ( myCounter > 5 ) + { + myCounter = 0; + } + + + /* Set the appropriate DockPadding and display + which one was set on the button face. */ + switch ( myCounter ) + { + case 0: + panel1->DockPadding->All = 0; + button1->Text = "Start"; + break; + + case 1: + panel1->DockPadding->Top = 10; + button1->Text = "Top"; + break; + + case 2: + panel1->DockPadding->Bottom = 10; + button1->Text = "Bottom"; + break; + + case 3: + panel1->DockPadding->Left = 10; + button1->Text = "Left"; + break; + + case 4: + panel1->DockPadding->Right = 10; + button1->Text = "Right"; + break; + + case 5: + panel1->DockPadding->All = 20; + button1->Text = "All"; + break; + } + myCounter++; + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp new file mode 100644 index 00000000000..0a96f55a9e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ScrollableControl.SetAutoScrollMargin Example/CPP/source.cpp @@ -0,0 +1,39 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ text1; + Panel^ panel1; + +private: + + // + void MySub() + { + /* If the text box is outside the panel's bounds, + turn on auto-scrolling and set the margin. */ + if ( text1->Location.X > panel1->Location.X || text1->Location.Y > panel1->Location.Y ) + { + panel1->AutoScroll = true; + + /* If the AutoScrollMargin is set to + less than (5,5), set it to 5,5. */ + if ( panel1->AutoScrollMargin.Width < 5 || panel1->AutoScrollMargin.Height < 5 ) + { + panel1->SetAutoScrollMargin( 5, 5 ); + } + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp new file mode 100644 index 00000000000..b9e62986f13 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic SelectionRange.SelectionRange1 Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + MonthCalendar^ monthCalendar1; + TextBox^ textBox1; + TextBox^ textBox2; + + // +private: + void button1_Click( Object^ sender, EventArgs^ e ) + { + // Set the SelectionRange with start and end dates from text boxes. + try + { + monthCalendar1->SelectionRange = gcnew SelectionRange( + DateTime::Parse( textBox1->Text ), + DateTime::Parse( textBox2->Text ) ); + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp new file mode 100644 index 00000000000..626875ee4f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ServiceCreatorCallback Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +// Class added so sample will compile +public ref class myService{}; + +public ref class Sample +{ +public: + void SampleMethod() + { + ServiceContainer^ serviceContainer = gcnew ServiceContainer; + + // + // The following code shows how to publish a service using a callback function. + // Creates a service creator callback. + ServiceCreatorCallback^ callback1 = + gcnew ServiceCreatorCallback( this, &Sample::myCallBackMethod ); + + // Adds the service using its type and the service creator callback. + serviceContainer->AddService( myService::typeid, callback1 ); + // + } + + // Method added so class will compile + Object^ myCallBackMethod( IServiceContainer^ container, Type^ serviceType ) + { + return gcnew Object; + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp new file mode 100644 index 00000000000..818cf5ebaf4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TabControl Example/CPP/source.cpp @@ -0,0 +1,139 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + // Required designer variable. + System::ComponentModel::Container^ components; + + // Declare variables. + System::Windows::Forms::RadioButton^ tab3RadioButton2; + System::Windows::Forms::RadioButton^ tab3RadioButton1; + System::Windows::Forms::CheckBox^ tab2CheckBox3; + System::Windows::Forms::CheckBox^ tab2CheckBox2; + System::Windows::Forms::CheckBox^ tab2CheckBox1; + System::Windows::Forms::Label ^ tab1Label1; + System::Windows::Forms::Button^ tab1Button1; + System::Windows::Forms::TabPage^ tabPage3; + System::Windows::Forms::TabPage^ tabPage2; + System::Windows::Forms::TabPage^ tabPage1; + System::Windows::Forms::TabControl^ tabControl1; + +public: + Form1() + { + + // This call is required for Windows Form Designer support. + InitializeComponent(); + } + + +private: + + // This method is required for Designer support. + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->tabPage1 = gcnew System::Windows::Forms::TabPage; + this->tab2CheckBox3 = gcnew System::Windows::Forms::CheckBox; + this->tab3RadioButton2 = gcnew System::Windows::Forms::RadioButton; + this->tabControl1 = gcnew System::Windows::Forms::TabControl; + this->tab2CheckBox2 = gcnew System::Windows::Forms::CheckBox; + this->tab2CheckBox1 = gcnew System::Windows::Forms::CheckBox; + this->tab3RadioButton1 = gcnew System::Windows::Forms::RadioButton; + this->tab1Label1 = gcnew System::Windows::Forms::Label; + this->tabPage3 = gcnew System::Windows::Forms::TabPage; + this->tabPage2 = gcnew System::Windows::Forms::TabPage; + this->tab1Button1 = gcnew System::Windows::Forms::Button; + tabPage1->Text = "tabPage1"; + tabPage1->Size = System::Drawing::Size( 256, 214 ); + tabPage1->TabIndex = 0; + tab2CheckBox3->Location = System::Drawing::Point( 32, 136 ); + tab2CheckBox3->Text = "checkBox3"; + tab2CheckBox3->Size = System::Drawing::Size( 176, 32 ); + tab2CheckBox3->TabIndex = 2; + tab2CheckBox3->Visible = true; + tab3RadioButton2->Location = System::Drawing::Point( 40, 72 ); + tab3RadioButton2->Text = "radioButton2"; + tab3RadioButton2->Size = System::Drawing::Size( 152, 24 ); + tab3RadioButton2->TabIndex = 1; + tab3RadioButton2->Visible = true; + tabControl1->Location = System::Drawing::Point( 16, 16 ); + tabControl1->Size = System::Drawing::Size( 264, 240 ); + tabControl1->SelectedIndex = 0; + tabControl1->TabIndex = 0; + tab2CheckBox2->Location = System::Drawing::Point( 32, 80 ); + tab2CheckBox2->Text = "checkBox2"; + tab2CheckBox2->Size = System::Drawing::Size( 176, 32 ); + tab2CheckBox2->TabIndex = 1; + tab2CheckBox2->Visible = true; + tab2CheckBox1->Location = System::Drawing::Point( 32, 24 ); + tab2CheckBox1->Text = "checkBox1"; + tab2CheckBox1->Size = System::Drawing::Size( 176, 32 ); + tab2CheckBox1->TabIndex = 0; + tab3RadioButton1->Location = System::Drawing::Point( 40, 32 ); + tab3RadioButton1->Text = "radioButton1"; + tab3RadioButton1->Size = System::Drawing::Size( 152, 24 ); + tab3RadioButton1->TabIndex = 0; + tab1Label1->Location = System::Drawing::Point( 16, 24 ); + tab1Label1->Text = "label1"; + tab1Label1->Size = System::Drawing::Size( 224, 96 ); + tab1Label1->TabIndex = 1; + tabPage3->Text = "tabPage3"; + tabPage3->Size = System::Drawing::Size( 256, 214 ); + tabPage3->TabIndex = 2; + tabPage2->Text = "tabPage2"; + tabPage2->Size = System::Drawing::Size( 256, 214 ); + tabPage2->TabIndex = 1; + tab1Button1->Location = System::Drawing::Point( 88, 144 ); + tab1Button1->Size = System::Drawing::Size( 80, 40 ); + tab1Button1->TabIndex = 0; + tab1Button1->Text = "button1"; + tab1Button1->Click += gcnew System::EventHandler( this, &Form1::tab1Button1_Click ); + this->Text = "Form1"; + + // Adds controls to the second tab page. + tabPage2->Controls->Add( this->tab2CheckBox3 ); + tabPage2->Controls->Add( this->tab2CheckBox2 ); + tabPage2->Controls->Add( this->tab2CheckBox1 ); + + // Adds controls to the third tab page. + tabPage3->Controls->Add( this->tab3RadioButton2 ); + tabPage3->Controls->Add( this->tab3RadioButton1 ); + + // Adds controls to the first tab page. + tabPage1->Controls->Add( this->tab1Label1 ); + tabPage1->Controls->Add( this->tab1Button1 ); + + // Adds the TabControl to the form. + this->Controls->Add( this->tabControl1 ); + + // Adds the tab pages to the TabControl. + tabControl1->Controls->Add( this->tabPage1 ); + tabControl1->Controls->Add( this->tabPage2 ); + tabControl1->Controls->Add( this->tabPage3 ); + } + + void tab1Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Inserts the code that should run when the button is clicked. + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp new file mode 100644 index 00000000000..c991ba96036 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.AcceptsReturn Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMultilineTextBox() + { + // Create an instance of a TextBox control. + TextBox^ textBox1 = gcnew TextBox; + + // Set the Multiline property to true. + textBox1->Multiline = true; + // Add vertical scroll bars to the TextBox control. + textBox1->ScrollBars = ScrollBars::Vertical; + // Allow the RETURN key to be entered in the TextBox control. + textBox1->AcceptsReturn = true; + // Allow the TAB key to be entered in the TextBox control. + textBox1->AcceptsTab = true; + // Set WordWrap to true to allow text to wrap to the next line. + textBox1->WordWrap = true; + // Set the default text of the control. + textBox1->Text = "Welcome!"; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp new file mode 100644 index 00000000000..49cc31df5be --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.CharacterCasing Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyPasswordTextBox() + { + // Create an instance of the TextBox control. + TextBox^ textBox1 = gcnew TextBox; + // Set the maximum length of text in the control to eight. + textBox1->MaxLength = 8; + // Assign the asterisk to be the password character. + textBox1->PasswordChar = '*'; + // Change all text entered to be lowercase. + textBox1->CharacterCasing = CharacterCasing::Lower; + // Align the text in the center of the TextBox control. + textBox1->TextAlign = HorizontalAlignment::Center; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp new file mode 100644 index 00000000000..e80cd3834af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.ScrollBars Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMultilineTextBox() + { + // Create an instance of a TextBox control. + TextBox^ textBox1 = gcnew TextBox; + + // Set the Multiline property to true. + textBox1->Multiline = true; + // Add vertical scroll bars to the TextBox control. + textBox1->ScrollBars = ScrollBars::Vertical; + // Allow the TAB key to be entered in the TextBox control. + textBox1->AcceptsReturn = true; + // Allow the TAB key to be entered in the TextBox control. + textBox1->AcceptsTab = true; + // Set WordWrap to true to allow text to wrap to the next line. + textBox1->WordWrap = true; + // Set the default text of the control. + textBox1->Text = "Welcome!"; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp new file mode 100644 index 00000000000..e34e1003f03 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBox.TextBox Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyTextBoxControl() + { + // Create a new TextBox control using this constructor. + TextBox^ textBox1 = gcnew TextBox; + // Assign a string of text to the new TextBox control. + textBox1->Text = "Hello World!"; + // Code goes here to add the control to the form's control collection. + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp new file mode 100644 index 00000000000..3f8d0e73329 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.AcceptsTab Example/CPP/source.cpp @@ -0,0 +1,42 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateMyMultilineTextBox() + { + // Create an instance of a TextBox control. + TextBox^ textBox1 = gcnew TextBox; + + // Set the Multiline property to true. + textBox1->Multiline = true; + // Add vertical scroll bars to the TextBox control. + textBox1->ScrollBars = ScrollBars::Vertical; + // Allow the RETURN key in the TextBox control. + textBox1->AcceptsReturn = true; + // Allow the TAB key to be entered in the TextBox control. + textBox1->AcceptsTab = true; + // Set WordWrap to true to allow text to wrap to the next line. + textBox1->WordWrap = true; + // Set the default text of the control. + textBox1->Text = "Welcome!" + Environment::NewLine + "Second Line"; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1() ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..fab81c39672 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.BorderStyle Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CreateTextBox() + { + // Create an instance of the TextBox control. + TextBox^ textBox1 = gcnew TextBox; + + // Set the TextBox Font property to Arial 20. + textBox1->Font = gcnew System::Drawing::Font( "Arial", 20 ); + // Set the BorderStyle property to FixedSingle. + textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + // Make the height of the control equal to the preferred height. + textBox1->Height = textBox1->PreferredHeight; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp new file mode 100644 index 00000000000..b5ccb472733 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.CanUndo Example/CPP/source.cpp @@ -0,0 +1,72 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void Menu_Copy( System::Object^ sender, System::EventArgs^ e ) + { + // Ensure that text is selected in the text box. + if ( textBox1->SelectionLength > 0 ) + { + // Copy the selected text to the Clipboard. + textBox1->Copy(); + } + } + + void Menu_Cut( System::Object^ sender, System::EventArgs^ e ) + { + // Ensure that text is currently selected in the text box. + if ( !textBox1->SelectedText->Equals( "" ) ) + { + // Cut the selected text in the control and paste it into the Clipboard. + textBox1->Cut(); + } + } + + void Menu_Paste( System::Object^ sender, System::EventArgs^ e ) + { + // Determine if there is any text in the Clipboard to paste into the text box. + if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) + { + // Determine if any text is selected in the text box. + if ( textBox1->SelectionLength > 0 ) + { + // Ask user if they want to paste over currently selected text. + if ( MessageBox::Show( "Do you want to paste over current selection?", + "Cut Example", MessageBoxButtons::YesNo ) == ::DialogResult::No ) + { + // Move selection to the point after the current selection and paste. + textBox1->SelectionStart = textBox1->SelectionStart + + textBox1->SelectionLength; + } + } + // Paste current text in Clipboard into text box. + textBox1->Paste(); + } + } + + void Menu_Undo( System::Object^ sender, System::EventArgs^ e ) + { + // Determine if last operation can be undone in text box. + if ( textBox1->CanUndo) + { + // Undo the last operation. + textBox1->Undo(); + // Clear the undo buffer to prevent last action from being redone. + textBox1->ClearUndo(); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp new file mode 100644 index 00000000000..6316bd30260 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Clear Example/CPP/source.cpp @@ -0,0 +1,47 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + bool flag; + +private: + void MyTextChangedHandler( System::Object^ sender, System::EventArgs^ e ) + { + Int64 val; + // Check the flag to prevent code re-entry. + if ( !flag ) + { + // Set the flag to True to prevent re-entry of the code below. + flag = true; + // Determine if the text of the control is a number. + try + { + // Attempt to convert to long + val = System::Convert::ToInt64( textBox1->Text ); + } + catch ( Exception^ ) + { + // Display a message box and clear the contents if not a number. + MessageBox::Show( "The text is not a valid number. Please re-enter" ); + // Clear the contents of the text box to allow re-entry. + textBox1->Clear(); + } + // Reset the flag so other TextChanged events are processed correctly. + flag = false; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp new file mode 100644 index 00000000000..7fdf7511075 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Lines Example/CPP/source.cpp @@ -0,0 +1,33 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void ViewMyTextBoxContents() + { + #if defined(DEBUG) + // Create a string array and store the contents of the Lines property. + array^ tempArray = gcnew array( textBox1->Lines->Length ); + tempArray = textBox1->Lines; + + // Loop through the array and send the contents of the array to debug window. + for ( int counter = 0; counter < tempArray->Length; counter++ ) + { + System::Diagnostics::Debug::WriteLine( tempArray[ counter ] ); + } + #endif + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp new file mode 100644 index 00000000000..f7e412ae348 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.MaxLength Example/CPP/source.cpp @@ -0,0 +1,26 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void CreateMyPasswordTextBox() + { + // Create an instance of the TextBox control. + TextBox^ textBox1 = gcnew TextBox; + // Set the maximum length of text in the control to eight. + textBox1->MaxLength = 8; + // Assign the asterisk to be the password character. + textBox1->PasswordChar = '*'; + // Change all text entered to be uppercase. + textBox1->CharacterCasing = CharacterCasing::Upper; + // Align the text in the center of the TextBox control. + textBox1->TextAlign = HorizontalAlignment::Center; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp new file mode 100644 index 00000000000..53fc29349e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Modified Example/CPP/source.cpp @@ -0,0 +1,35 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + String^ originalText; + + // +private: + void TextBox1_TextChanged( Object^ sender, EventArgs^ e ) + { + /* Check to see if the change made does not return the + control to its original state. */ + if ( originalText != textBox1->Text ) + { + // Set the Modified property to true to reflect the change. + textBox1->Modified = true; + } + else + { + // Contents of textBox1 have not changed, reset the Modified property. + textBox1->Modified = false; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp new file mode 100644 index 00000000000..7372767c14a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.Select Example/CPP/source.cpp @@ -0,0 +1,32 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void SelectMyString() + { + // Create a string to search for the word "fox". + String^ searchString = "fox"; + // Determine the starting location of the word "fox". + int index = textBox1->Text->IndexOf( searchString, 16, 3 ); + // Determine if the word has been found and select it if it was. + if ( index != -1 ) + { + // Select the string using the index and the length of the string. + textBox1->Select( index,searchString->Length ); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp new file mode 100644 index 00000000000..4e83d756261 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectAll Example/CPP/source.cpp @@ -0,0 +1,31 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +public: + void CopyAllMyText() + { + // Determine if any text is selected in the TextBox control. + if ( textBox1->SelectionLength == 0 ) + { + // Select all text in the text box. + textBox1->SelectAll(); + } + + // Copy the contents of the control to the Clipboard. + textBox1->Copy(); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp new file mode 100644 index 00000000000..98dfc092c04 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectedText Example/CPP/source.cpp @@ -0,0 +1,69 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void Menu_Copy( System::Object^ sender, System::EventArgs^ e ) + { + // Ensure that text is selected in the text box. + if ( textBox1->SelectionLength > 0 ) + // Copy the selected text to the Clipboard. + textBox1->Copy(); + } + + void Menu_Cut( System::Object^ sender, System::EventArgs^ e ) + { + // Ensure that text is currently selected in the text box. + if ( !textBox1->SelectedText->Equals( "" ) ) + { + // Cut the selected text in the control and paste it into the Clipboard. + textBox1->Cut(); + } + } + + void Menu_Paste( System::Object^ sender, System::EventArgs^ e ) + { + // Determine if there is any text in the Clipboard to paste into the text box. + if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) + { + // Determine if any text is selected in the text box. + if ( textBox1->SelectionLength > 0 ) + { + // Ask user if they want to paste over currently selected text. + if ( MessageBox::Show( "Do you want to paste over current selection?", + "Cut Example", MessageBoxButtons::YesNo ) == ::DialogResult::No ) + { + // Move selection to the point after the current selection and paste. + textBox1->SelectionStart = textBox1->SelectionStart + textBox1->SelectionLength; + } + } + // Paste current text in Clipboard into text box. + textBox1->Paste(); + } + } + + void Menu_Undo( System::Object^ sender, System::EventArgs^ e ) + { + // Determine if last operation can be undone in text box. + if ( textBox1->CanUndo) + { + // Undo the last operation. + textBox1->Undo(); + // Clear the undo buffer to prevent last action from being redone. + textBox1->ClearUndo(); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp new file mode 100644 index 00000000000..b8c76b655e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TextBoxBase.SelectionLength Example/CPP/source.cpp @@ -0,0 +1,71 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void Menu_Copy( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Ensure that text is selected in the text box. + if ( textBox1->SelectionLength > 0 ) + { + // Copy the selected text to the Clipboard. + textBox1->Copy(); + } + } + + void Menu_Cut( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Ensure that text is currently selected in the text box. + if ( !textBox1->SelectedText->Equals( "" ) ) + { + // Cut the selected text in the control and paste it into the Clipboard. + textBox1->Cut(); + } + } + + void Menu_Paste( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Determine if there is any text in the Clipboard to paste into the text box. + if ( Clipboard::GetDataObject()->GetDataPresent( DataFormats::Text )) + { + // Determine if any text is selected in the text box. + if ( textBox1->SelectionLength > 0 ) + { + // Ask user if they want to paste over currently selected text. + if ( MessageBox::Show( "Do you want to paste over current selection?", + "Cut Example", MessageBoxButtons::YesNo ) == ::DialogResult::No ) + { + // Move selection to the point after the current selection and paste. + textBox1->SelectionStart = textBox1->SelectionStart + textBox1->SelectionLength; + } + } + // Paste current text in Clipboard into text box. + textBox1->Paste(); + } + } + + void Menu_Undo( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Determine if last operation can be undone in text box. + if ( textBox1->CanUndo) + { + // Undo the last operation. + textBox1->Undo(); + // Clear the undo buffer to prevent last action from being redone. + textBox1->ClearUndo(); + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp new file mode 100644 index 00000000000..0f1f797d060 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic Timer Example 2/CPP/source.cpp @@ -0,0 +1,67 @@ + + +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +// +public ref class Class1 +{ +private: + static System::Windows::Forms::Timer^ myTimer = gcnew System::Windows::Forms::Timer; + static int alarmCounter = 1; + static bool exitFlag = false; + + // This is the method to run when the timer is raised. + static void TimerEventProcessor( Object^ /*myObject*/, EventArgs^ /*myEventArgs*/ ) + { + myTimer->Stop(); + + // Displays a message box asking whether to continue running the timer. + if ( MessageBox::Show( "Continue running?", String::Format( "Count is: {0}", alarmCounter ), MessageBoxButtons::YesNo ) == DialogResult::Yes ) + { + + // Restarts the timer and increments the counter. + alarmCounter += 1; + myTimer->Enabled = true; + } + else + { + + // Stops the timer. + exitFlag = true; + } + } + + +public: + static void Main() + { + + /* Adds the event and the event handler for the method that will + process the timer event to the timer. */ + myTimer->Tick += gcnew EventHandler( TimerEventProcessor ); + + // Sets the timer interval to 5 seconds. + myTimer->Interval = 5000; + myTimer->Start(); + + // Runs the timer, and raises the event. + while ( !exitFlag ) + { + + // Processes all the events in the queue. + Application::DoEvents(); + } + } + +}; + +int main() +{ + Class1::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp new file mode 100644 index 00000000000..1f960a11e0a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.Buttons Example/CPP/source.cpp @@ -0,0 +1,37 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ + // +public: + void InitializeMyToolBar() + { + // Create and initialize the ToolBarButton controls and ToolBar. + ToolBar^ toolBar1 = gcnew ToolBar; + ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; + + // Set the Text properties of the ToolBarButton controls. + toolBarButton1->Text = "Open"; + toolBarButton2->Text = "Save"; + toolBarButton3->Text = "Print"; + + // Add the ToolBarButton controls to the ToolBar. + toolBar1->Buttons->Add( toolBarButton1 ); + toolBar1->Buttons->Add( toolBarButton2 ); + toolBar1->Buttons->Add( toolBarButton3 ); + + // Add the ToolBar to the Form. + Controls->Add( toolBar1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp new file mode 100644 index 00000000000..8fccbc33370 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBar Example/CPP/source.cpp @@ -0,0 +1,70 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ToolBar^ toolBar1; + PrintDialog^ printDialog1; + OpenFileDialog^ openFileDialog1; + SaveFileDialog^ saveFileDialog1; + + // +public: + void InitializeMyToolBar() + { + // Create and initialize the ToolBar and ToolBarButton controls. + toolBar1 = gcnew ToolBar; + ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; + + // Set the Text properties of the ToolBarButton controls. + toolBarButton1->Text = "Open"; + toolBarButton2->Text = "Save"; + toolBarButton3->Text = "Print"; + + // Add the ToolBarButton controls to the ToolBar. + toolBar1->Buttons->Add( toolBarButton1 ); + toolBar1->Buttons->Add( toolBarButton2 ); + toolBar1->Buttons->Add( toolBarButton3 ); + + // Add the event-handler delegate. + toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( + this, &Form1::toolBar1_ButtonClick ); + + // Add the ToolBar to the Form. + Controls->Add( toolBar1 ); + } + +private: + void toolBar1_ButtonClick( + Object^ sender, + ToolBarButtonClickEventArgs^ e ) + { + // Evaluate the Button property to determine which button was clicked. + switch ( toolBar1->Buttons->IndexOf( e->Button ) ) + { + case 0: + openFileDialog1->ShowDialog(); + // Insert code to open the file. + break; + case 1: + saveFileDialog1->ShowDialog(); + // Insert code to save the file. + break; + case 2: + printDialog1->ShowDialog(); + // Insert code to print the file. + break; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp new file mode 100644 index 00000000000..854f1c295b2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Add Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ToolBar^ toolBar1; + + // +public: + void AddMyButton() + { + ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; + toolBarButton1->Text = "Print"; + + // Add the new toolbar button to the toolbar. + toolBar1->Buttons->Add( toolBarButton1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp new file mode 100644 index 00000000000..437e7d3cbc5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.Count Example/CPP/source.cpp @@ -0,0 +1,28 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ToolBar^ toolBar1; + + // +public: + void ClearMyToolBar() + { + int btns; + // Get the count before the Clear method is called. + btns = toolBar1->Buttons->Count; + toolBar1->Buttons->Clear(); + MessageBox::Show( "Count Before Clear: " + btns.ToString() + + "\nCount After Clear: " + toolBar1->Buttons->Count.ToString() ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp new file mode 100644 index 00000000000..5b6185f02a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.IndexOf Example/CPP/source.cpp @@ -0,0 +1,70 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ToolBar^ toolBar1; + PrintDialog^ printDialog1; + OpenFileDialog^ openFileDialog1; + SaveFileDialog^ saveFileDialog1; + + // +public: + void InitializeMyToolBar() + { + // Create and initialize the ToolBar and ToolBarButton controls. + toolBar1 = gcnew ToolBar; + ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; + + // Set the Text properties of the ToolBarButton controls. + toolBarButton1->Text = "Open"; + toolBarButton2->Text = "Save"; + toolBarButton3->Text = "Print"; + + // Add the ToolBarButton controls to the ToolBar. + toolBar1->Buttons->Add( toolBarButton1 ); + toolBar1->Buttons->Add( toolBarButton2 ); + toolBar1->Buttons->Add( toolBarButton3 ); + + // Add the event-handler delegate. + toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( + this, &Form1::toolBar1_ButtonClick ); + + // Add the ToolBar to the Form. + Controls->Add( toolBar1 ); + } + +private: + void toolBar1_ButtonClick( + Object^ sender, + ToolBarButtonClickEventArgs^ e ) + { + // Evaluate the Button property to determine which button was clicked. + switch ( toolBar1->Buttons->IndexOf( e->Button ) ) + { + case 0: + openFileDialog1->ShowDialog(); + // Insert additional code here to open the file. + break; + case 1: + saveFileDialog1->ShowDialog(); + // Insert additional code here to save the file. + break; + case 2: + printDialog1->ShowDialog(); + // Insert additional code here to print the file. + break; + } + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp new file mode 100644 index 00000000000..4469a0000fa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.RemoveAt Example/CPP/source.cpp @@ -0,0 +1,27 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ToolBar^ toolBar1; + + // +public: + void RemoveMyButton() + { + int btns; + btns = toolBar1->Buttons->Count; + + // Remove the last toolbar button. + toolBar1->Buttons->RemoveAt( btns - 1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp new file mode 100644 index 00000000000..9102dc54226 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBar.ToolBarButtonCollection.this Example/CPP/source.cpp @@ -0,0 +1,31 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +protected: + ToolBar^ toolBar1; + +public: + + // + void ReplaceMyToolBarButton() + { + int btns; + btns = toolBar1->Buttons->Count; + ToolBarButton^ toolBarButton1 = gcnew ToolBarButton; + toolBarButton1->Text = "myButton"; + + // Replace the last ToolBarButton in the collection. + toolBar1->Buttons[ btns - 1 ] = toolBarButton1; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp new file mode 100644 index 00000000000..9120c95e878 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic ToolBarButton.Style Example/CPP/source.cpp @@ -0,0 +1,54 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + ImageList^ imageList1; + System::Windows::Forms::ContextMenu^ contextMenu1; + MenuItem^ menuItem1; + + // +public: + void InitializeMyToolBar() + { + // Create the ToolBar, ToolBarButton controls, and menus. + ToolBarButton^ toolBarButton1 = gcnew ToolBarButton( "Open" ); + ToolBarButton^ toolBarButton2 = gcnew ToolBarButton; + ToolBarButton^ toolBarButton3 = gcnew ToolBarButton; + ToolBar^ toolBar1 = gcnew ToolBar; + MenuItem^ menuItem1 = gcnew MenuItem( "Print" ); + array^ temp1 = {menuItem1}; + System::Windows::Forms::ContextMenu^ contextMenu1 = + gcnew System::Windows::Forms::ContextMenu( temp1 ); + + // Add the ToolBarButton controls to the ToolBar. + toolBar1->Buttons->Add( toolBarButton1 ); + toolBar1->Buttons->Add( toolBarButton2 ); + toolBar1->Buttons->Add( toolBarButton3 ); + + // Assign an ImageList to the ToolBar and show ToolTips. + toolBar1->ImageList = imageList1; + toolBar1->ShowToolTips = true; + + /* Assign ImageIndex, ContextMenu, Text, ToolTip, and + Style properties of the ToolBarButton controls. */ + toolBarButton2->Style = ToolBarButtonStyle::Separator; + toolBarButton3->Text = "Print"; + toolBarButton3->Style = ToolBarButtonStyle::DropDownButton; + toolBarButton3->ToolTipText = "Print"; + toolBarButton3->ImageIndex = 0; + toolBarButton3->DropDownMenu = contextMenu1; + + // Add the ToolBar to a form. + Controls->Add( toolBar1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp new file mode 100644 index 00000000000..e14a25a6457 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverter Example/CPP/source.cpp @@ -0,0 +1,69 @@ +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; + +public ref class Sample +{ +public: + enum class MyPropertyEnum + { + option1, option2, option3 + }; + + ref class MyClassConverter + { + }; + + // +public: + [TypeConverter(Sample::MyClassConverter::typeid)] + ref class MyClass + { + // Insert code here. + }; + // + + // +public: + property MyPropertyEnum MyProperty + { + void set( MyPropertyEnum value ) + { + // Checks to see if the value passed is valid. + if ( !TypeDescriptor::GetConverter( MyPropertyEnum::typeid )->IsValid( value ) ) + { + throw gcnew ArgumentException; + } + // The value is valid. Insert code to set the property. + } + } + // + + void Method1() + { + // + Color c = Color::Red; + Console::WriteLine( TypeDescriptor::GetConverter( c )->ConvertToString( c ) ); + // + } + + void Method2() + { + // + Color c = (Color)(TypeDescriptor::GetConverter( Color::typeid )->ConvertFromString( "Red" )); + // + } + + void Method3() + { + // + for each ( Color c in TypeDescriptor::GetConverter( Color::typeid )->GetStandardValues() ) + { + Console::WriteLine( TypeDescriptor::GetConverter( c )->ConvertToString( c ) ); + } + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp new file mode 100644 index 00000000000..025487381ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic TypeConverterAttribute Example/CPP/source.cpp @@ -0,0 +1,37 @@ + + +#using + +using namespace System; +using namespace System::IO; +using namespace System::ComponentModel; + +public ref class Class1 +{ +public: + ref class MyClassConverter: public TypeConverter{}; + + // + [TypeConverter(Class1::MyClassConverter::typeid)] + ref class MyClass{ + // Insert code here. + }; + // +}; + +// +int main() +{ + // Creates a new instance of MyClass. + Class1::MyClass^ myNewClass = gcnew Class1::MyClass; + + // Gets the attributes for the instance. + AttributeCollection^ attributes = TypeDescriptor::GetAttributes( myNewClass ); + + /* Prints the name of the type converter by retrieving the + * TypeConverterAttribute from the AttributeCollection. */ + TypeConverterAttribute^ myAttribute = dynamic_cast(attributes[ TypeConverterAttribute::typeid ]); + Console::WriteLine( "The type converter for this class is: {0}", myAttribute->ConverterTypeName ); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp new file mode 100644 index 00000000000..3bf08bad06d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase Example/CPP/source.cpp @@ -0,0 +1,106 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + ComboBox^ comboBox1; + ComboBox^ comboBox2; + NumericUpDown^ numericUpDown1; + +private: + + // + void comboBox1_SelectedIndexChanged( Object^ sender, EventArgs^ e ) + { + // Set the BorderStyle property. + if ( !String::Compare( comboBox1->Text, "Fixed3D" ) ) + { + numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + } + else + if ( !String::Compare( comboBox1->Text, "None" ) ) + { + numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::None; + } + else + if ( !String::Compare( comboBox1->Text, "FixedSingle" ) ) + { + numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + } + } + + void comboBox2_SelectedIndexChanged( Object^ sender, EventArgs^ e ) + { + // Set the TextAlign property. + if ( !String::Compare( comboBox2->Text, "Right" ) ) + { + numericUpDown1->TextAlign = HorizontalAlignment::Right; + } + else + if ( !String::Compare( comboBox1->Text, "Left" ) ) + { + numericUpDown1->TextAlign = HorizontalAlignment::Left; + } + else + if ( !String::Compare( comboBox1->Text, "Center" ) ) + { + numericUpDown1->TextAlign = HorizontalAlignment::Center; + } + } + + void checkBox1_Click( Object^ sender, EventArgs^ e ) + { + // Evaluate and toggle the ReadOnly property. + if ( numericUpDown1->ReadOnly ) + { + numericUpDown1->ReadOnly = false; + } + else + { + numericUpDown1->ReadOnly = true; + } + } + + void checkBox2_Click( Object^ sender, EventArgs^ e ) + { + // Evaluate and toggle the InterceptArrowKeys property. + if ( numericUpDown1->InterceptArrowKeys ) + { + numericUpDown1->InterceptArrowKeys = false; + } + else + { + numericUpDown1->InterceptArrowKeys = true; + } + } + + void checkBox3_Click( Object^ sender, EventArgs^ e ) + { + // Evaluate and toggle the UpDownAlign property. + if ( numericUpDown1->UpDownAlign == LeftRightAlignment::Left ) + { + numericUpDown1->UpDownAlign = LeftRightAlignment::Right; + } + else + { + numericUpDown1->UpDownAlign = LeftRightAlignment::Left; + } + } + // +}; + +__int32 main() +{ + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp new file mode 100644 index 00000000000..26af55578bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.BorderStyle Example/CPP/source.cpp @@ -0,0 +1,90 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + ComboBox^ comboBox1; + ComboBox^ comboBox2; + NumericUpDown^ numericUpDown1; + +private: + + // + void comboBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Set the BorderStyle property. + if ( comboBox1->Text->Equals( "Fixed3D" ) ) + numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + else + if ( comboBox1->Text->Equals( "None" ) ) + numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::None; + else + if ( comboBox1->Text->Equals( "FixedSingle" ) ) + numericUpDown1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + } + + void comboBox2_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Set the TextAlign property. + if ( comboBox2->Text->Equals( "Right" ) ) + numericUpDown1->TextAlign = HorizontalAlignment::Right; + + if ( comboBox2->Text->Equals( "Left" ) ) + numericUpDown1->TextAlign = HorizontalAlignment::Left; + + if ( comboBox2->Text->Equals( "Center" ) ) + numericUpDown1->TextAlign = HorizontalAlignment::Center; + } + + void checkBox1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Evaluate and toggle the ReadOnly property. + if ( numericUpDown1->ReadOnly ) + { + numericUpDown1->ReadOnly = false; + } + else + { + numericUpDown1->ReadOnly = true; + } + } + + void checkBox2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Evaluate and toggle the InterceptArrowKeys property. + if ( numericUpDown1->InterceptArrowKeys ) + { + numericUpDown1->InterceptArrowKeys = false; + } + else + { + numericUpDown1->InterceptArrowKeys = true; + } + } + + void checkBox3_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Evaluate and toggle the UpDownAlign property. + if ( numericUpDown1->UpDownAlign == LeftRightAlignment::Left ) + { + numericUpDown1->UpDownAlign = LeftRightAlignment::Right; + } + else + { + numericUpDown1->UpDownAlign = LeftRightAlignment::Left; + } + } + + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp new file mode 100644 index 00000000000..f6bae37132f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic UpDownBase.Text Example/CPP/source.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + NumericUpDown^ numericUpDown1; + +private: + + // + void numericUpDown1_Leave( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + /* If the entered value is greater than Minimum or Maximum, + select the text and open a message box. */ + if ( (System::Convert::ToInt32( numericUpDown1->Text ) > numericUpDown1->Maximum) || (System::Convert::ToInt32( numericUpDown1->Text ) < numericUpDown1->Minimum) ) + { + MessageBox::Show( "The value entered was not between the Minimum andMaximum allowable values.\nPlease re-enter." ); + numericUpDown1->Focus(); + numericUpDown1->Select(0,numericUpDown1->Text->Length); + } + } + + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + int varPrefHeight1; + + /* Capture the PreferredHeight before and after the Font + is changed, and display the results in a message box. */ + varPrefHeight1 = numericUpDown1->PreferredHeight; + numericUpDown1->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",12.0,System::Drawing::FontStyle::Bold ); + MessageBox::Show( String::Format( "Before Font Change: {0}\nAfter Font Change: {1}", varPrefHeight1, numericUpDown1->PreferredHeight ) ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp new file mode 100644 index 00000000000..f8c9570d3b3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic UserControl Example/CPP/source.cpp @@ -0,0 +1,163 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::ComponentModel; + +namespace UserControls +{ + public ref class MyCustomerInfoUserControl: public System::Windows::Forms::UserControl + { + private: + + // Create the controls. + System::Windows::Forms::ErrorProvider^ errorProvider1; + System::Windows::Forms::TextBox^ textName; + System::Windows::Forms::TextBox^ textAddress; + System::Windows::Forms::TextBox^ textCity; + System::Windows::Forms::TextBox^ textStateProvince; + System::Windows::Forms::TextBox^ textPostal; + System::Windows::Forms::TextBox^ textCountryRegion; + System::Windows::Forms::TextBox^ textEmail; + System::Windows::Forms::Label ^ labelName; + System::Windows::Forms::Label ^ labelAddress; + System::Windows::Forms::Label ^ labelCityStateProvincePostal; + System::Windows::Forms::Label ^ labelCountryRegion; + System::Windows::Forms::Label ^ labelEmail; + System::ComponentModel::IContainer^ components; + + public: + + // Define the constructor. + MyCustomerInfoUserControl() + { + InitializeComponent(); + } + + // Initialize the control elements. + void InitializeComponent() + { + // Initialize the controls. + components = gcnew System::ComponentModel::Container; + errorProvider1 = gcnew System::Windows::Forms::ErrorProvider; + textName = gcnew System::Windows::Forms::TextBox; + textAddress = gcnew System::Windows::Forms::TextBox; + textCity = gcnew System::Windows::Forms::TextBox; + textStateProvince = gcnew System::Windows::Forms::TextBox; + textPostal = gcnew System::Windows::Forms::TextBox; + textCountryRegion = gcnew System::Windows::Forms::TextBox; + textEmail = gcnew System::Windows::Forms::TextBox; + labelName = gcnew System::Windows::Forms::Label; + labelAddress = gcnew System::Windows::Forms::Label; + labelCityStateProvincePostal = gcnew System::Windows::Forms::Label; + labelCountryRegion = gcnew System::Windows::Forms::Label; + labelEmail = gcnew System::Windows::Forms::Label; + + // Set the tab order, text alignment, size, and location of the controls. + textName->Location = System::Drawing::Point( 120, 8 ); + textName->Size = System::Drawing::Size( 232, 20 ); + textName->TabIndex = 0; + textAddress->Location = System::Drawing::Point( 120, 32 ); + textAddress->Size = System::Drawing::Size( 232, 20 ); + textAddress->TabIndex = 1; + textCity->Location = System::Drawing::Point( 120, 56 ); + textCity->Size = System::Drawing::Size( 96, 20 ); + textCity->TabIndex = 2; + textStateProvince->Location = System::Drawing::Point( 216, 56 ); + textStateProvince->Size = System::Drawing::Size( 56, 20 ); + textStateProvince->TabIndex = 3; + textPostal->Location = System::Drawing::Point( 272, 56 ); + textPostal->Size = System::Drawing::Size( 80, 20 ); + textPostal->TabIndex = 4; + textCountryRegion->Location = System::Drawing::Point( 120, 80 ); + textCountryRegion->Size = System::Drawing::Size( 232, 20 ); + textCountryRegion->TabIndex = 5; + textEmail->Location = System::Drawing::Point( 120, 104 ); + textEmail->Size = System::Drawing::Size( 232, 20 ); + textEmail->TabIndex = 6; + labelName->Location = System::Drawing::Point( 8, 8 ); + labelName->Size = System::Drawing::Size( 112, 23 ); + labelName->Text = "Name:"; + labelName->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelAddress->Location = System::Drawing::Point( 8, 32 ); + labelAddress->Size = System::Drawing::Size( 112, 23 ); + labelAddress->Text = "Address:"; + labelAddress->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelCityStateProvincePostal->Location = System::Drawing::Point( 8, 56 ); + labelCityStateProvincePostal->Size = System::Drawing::Size( 112, 23 ); + labelCityStateProvincePostal->Text = "City, St/Prov. Postal:"; + labelCityStateProvincePostal->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelCountryRegion->Location = System::Drawing::Point( 8, 80 ); + labelCountryRegion->Size = System::Drawing::Size( 112, 23 ); + labelCountryRegion->Text = "Country/Region:"; + labelCountryRegion->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelEmail->Location = System::Drawing::Point( 8, 104 ); + labelEmail->Size = System::Drawing::Size( 112, 23 ); + labelEmail->Text = "email:"; + labelEmail->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + + // Add the Validating and Validated handlers for textEmail. + textEmail->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &MyCustomerInfoUserControl::textEmail_Validating ); + textEmail->Validated += gcnew System::EventHandler( this, &MyCustomerInfoUserControl::textEmail_Validated ); + + // Add the controls to the user control. + array^temp0 = {labelName,labelAddress,labelCityStateProvincePostal,labelCountryRegion,labelEmail,textName,textAddress,textCity,textStateProvince,textPostal,textCountryRegion,textEmail}; + Controls->AddRange( temp0 ); + + // Size the user control. + Size = System::Drawing::Size( 375, 150 ); + } + + private: + void MyValidatingCode() + { + // Confirm there is text in the control. + if ( textEmail->Text->Length == 0 ) + { + throw gcnew Exception( "Email address is a required field." ); + } + // Confirm that there is a "." and an "@" in the email address. + else + + // Confirm that there is a "." and an "@" in the email address. + if ( textEmail->Text->IndexOf( "." ) == -1 || textEmail->Text->IndexOf( "@" ) == -1 ) + { + throw gcnew Exception( "Email address must be valid email address format.\nFor example: 'someone@example.com'" ); + } + } + + // Validate the data input by the user into textEmail. + void textEmail_Validating( Object^ /*sender*/, System::ComponentModel::CancelEventArgs^ e ) + { + try + { + MyValidatingCode(); + } + catch ( Exception^ ex ) + { + // Cancel the event and select the text to be corrected by the user. + e->Cancel = true; + textEmail->Select(0,textEmail->Text->Length); + + // Set the ErrorProvider error with the text to display. + this->errorProvider1->SetError( textEmail, ex->Message ); + } + } + + void textEmail_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + //If all conditions have been met, clear the error provider of errors. + errorProvider1->SetError( textEmail, "" ); + } + }; +} + +// End Class +// End Namespace +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp new file mode 100644 index 00000000000..aeb8812aaae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic UserControl.UserControl Example/CPP/source.cpp @@ -0,0 +1,219 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +namespace UserControls +{ + public ref class MyCustomerInfoUserControl: public System::Windows::Forms::UserControl + { + private: + + // Create the controls. + System::Windows::Forms::ErrorProvider^ errorProvider1; + System::Windows::Forms::TextBox^ textName; + System::Windows::Forms::TextBox^ textAddress; + System::Windows::Forms::TextBox^ textCity; + System::Windows::Forms::TextBox^ textStateProvince; + System::Windows::Forms::TextBox^ textPostal; + System::Windows::Forms::TextBox^ textCountryRegion; + System::Windows::Forms::TextBox^ textEmail; + System::Windows::Forms::Label ^ labelName; + System::Windows::Forms::Label ^ labelAddress; + System::Windows::Forms::Label ^ labelCityStateProvincePostal; + System::Windows::Forms::Label ^ labelCountryRegion; + System::Windows::Forms::Label ^ labelEmail; + System::ComponentModel::IContainer^ components; + + public: + + // Define the constructor. + MyCustomerInfoUserControl() + { + InitializeComponent(); + } + + // Initialize the control elements. + void InitializeComponent() + { + // Initialize the controls. + components = gcnew System::ComponentModel::Container; + errorProvider1 = gcnew System::Windows::Forms::ErrorProvider; + textName = gcnew System::Windows::Forms::TextBox; + textAddress = gcnew System::Windows::Forms::TextBox; + textCity = gcnew System::Windows::Forms::TextBox; + textStateProvince = gcnew System::Windows::Forms::TextBox; + textPostal = gcnew System::Windows::Forms::TextBox; + textCountryRegion = gcnew System::Windows::Forms::TextBox; + textEmail = gcnew System::Windows::Forms::TextBox; + labelName = gcnew System::Windows::Forms::Label; + labelAddress = gcnew System::Windows::Forms::Label; + labelCityStateProvincePostal = gcnew System::Windows::Forms::Label; + labelCountryRegion = gcnew System::Windows::Forms::Label; + labelEmail = gcnew System::Windows::Forms::Label; + + // Set the tab order, text alignment, size, and location of the controls. + textName->Location = System::Drawing::Point( 120, 8 ); + textName->Size = System::Drawing::Size( 232, 20 ); + textName->TabIndex = 0; + textAddress->Location = System::Drawing::Point( 120, 32 ); + textAddress->Size = System::Drawing::Size( 232, 20 ); + textAddress->TabIndex = 1; + textCity->Location = System::Drawing::Point( 120, 56 ); + textCity->Size = System::Drawing::Size( 96, 20 ); + textCity->TabIndex = 2; + textStateProvince->Location = System::Drawing::Point( 216, 56 ); + textStateProvince->Size = System::Drawing::Size( 56, 20 ); + textStateProvince->TabIndex = 3; + textPostal->Location = System::Drawing::Point( 272, 56 ); + textPostal->Size = System::Drawing::Size( 80, 20 ); + textPostal->TabIndex = 4; + textCountryRegion->Location = System::Drawing::Point( 120, 80 ); + textCountryRegion->Size = System::Drawing::Size( 232, 20 ); + textCountryRegion->TabIndex = 5; + textEmail->Location = System::Drawing::Point( 120, 104 ); + textEmail->Size = System::Drawing::Size( 232, 20 ); + textEmail->TabIndex = 6; + labelName->Location = System::Drawing::Point( 8, 8 ); + labelName->Size = System::Drawing::Size( 112, 23 ); + labelName->Text = "Name:"; + labelName->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelAddress->Location = System::Drawing::Point( 8, 32 ); + labelAddress->Size = System::Drawing::Size( 112, 23 ); + labelAddress->Text = "Address:"; + labelAddress->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelCityStateProvincePostal->Location = System::Drawing::Point( 8, 56 ); + labelCityStateProvincePostal->Size = System::Drawing::Size( 112, 23 ); + labelCityStateProvincePostal->Text = "City, St/Prov. Postal:"; + labelCityStateProvincePostal->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelCountryRegion->Location = System::Drawing::Point( 8, 80 ); + labelCountryRegion->Size = System::Drawing::Size( 112, 23 ); + labelCountryRegion->Text = "Country/Region:"; + labelCountryRegion->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + labelEmail->Location = System::Drawing::Point( 8, 104 ); + labelEmail->Size = System::Drawing::Size( 112, 23 ); + labelEmail->Text = "email:"; + labelEmail->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + + // Add the Validating and Validated handlers for textEmail. + textEmail->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &MyCustomerInfoUserControl::textEmail_Validating ); + textEmail->Validated += gcnew System::EventHandler( this, &MyCustomerInfoUserControl::textEmail_Validated ); + + // Add the controls to the user control. + array^temp0 = {labelName,labelAddress,labelCityStateProvincePostal,labelCountryRegion,labelEmail,textName,textAddress,textCity,textStateProvince,textPostal,textCountryRegion,textEmail}; + Controls->AddRange( temp0 ); + + // Size the user control. + Size = System::Drawing::Size( 375, 150 ); + } + + private: + void MyValidatingCode() + { + // Confirm there is text in the control. + if ( textEmail->Text->Length == 0 ) + { + throw gcnew Exception( "Email address is a required field." ); + } + // Confirm that there is a "." and an "@" in the email address. + else + + // Confirm that there is a "." and an "@" in the email address. + if ( textEmail->Text->IndexOf( "." ) == -1 || textEmail->Text->IndexOf( "@" ) == -1 ) + { + throw gcnew Exception( "Email address must be valid email address format.\nFor example: 'someone@example.com'" ); + } + } + + // Validate the data input by the user into textEmail. + void textEmail_Validating( Object^ /*sender*/, System::ComponentModel::CancelEventArgs^ e ) + { + try + { + MyValidatingCode(); + } + catch ( Exception^ ex ) + { + // Cancel the event and select the text to be corrected by the user. + e->Cancel = true; + textEmail->Select(0,textEmail->Text->Length); + + // Set the ErrorProvider error with the text to display. + this->errorProvider1->SetError( textEmail, ex->Message ); + } + + } + + void textEmail_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + //If all conditions have been met, clear the error provider of errors. + errorProvider1->SetError( textEmail, "" ); + } + }; +} + +// End Class +// End Namespace +////////////////////////////////////////////////////////////////////////////////////// +// +public ref class MyUserControlHost: public System::Windows::Forms::Form +{ +private: + + // Create the controls. + System::ComponentModel::IContainer^ components; + System::Windows::Forms::Panel^ panel1; + UserControls::MyCustomerInfoUserControl^ myUserControl; + +public: + + // Define the constructor. + MyUserControlHost() + { + this->InitializeComponent(); + } + + +private: + + // Add a Panel control to a Form and host the UserControl in the Panel. + void InitializeComponent() + { + components = gcnew System::ComponentModel::Container; + panel1 = gcnew System::Windows::Forms::Panel; + myUserControl = gcnew UserControls::MyCustomerInfoUserControl; + + // Set the DockStyle of the UserControl to Fill. + myUserControl->Dock = System::Windows::Forms::DockStyle::Fill; + + // Make the Panel the same size as the UserControl and give it a border. + panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + panel1->Size = myUserControl->Size; + panel1->Location = System::Drawing::Point( 5, 5 ); + + // Add the user control to the Panel. + panel1->Controls->Add( myUserControl ); + + // Size the Form to accommodate the Panel. + this->ClientSize = System::Drawing::Size( panel1->Size.Width + 10, panel1->Size.Height + 10 ); + this->Text = "Please enter the information below..."; + + // Add the Panel to the Form. + this->Controls->Add( panel1 ); + } +}; +// End Class + +[System::STAThreadAttribute] +int main() +{ + System::Windows::Forms::Application::Run( gcnew MyUserControlHost ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp new file mode 100644 index 00000000000..170507cec4f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Classic VScrollBar Example/CPP/source.cpp @@ -0,0 +1,30 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + TextBox^ textBox1; + + // +private: + void InitializeMyScrollBar() + { + // Create and initialize a VScrollBar. + VScrollBar^ vScrollBar1 = gcnew VScrollBar; + + // Dock the scroll bar to the right side of the form. + vScrollBar1->Dock = DockStyle::Right; + + // Add the scroll bar to the form. + Controls->Add( vScrollBar1 ); + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp b/snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp new file mode 100644 index 00000000000..e7b0a3a4016 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ClearItems/CPP/clearitems.cpp @@ -0,0 +1,112 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + InitializeMyMenu(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + +public: + + /// + /// The main entry point for the application. + /// + // + void InitializeMyMenu() + { + // Create the MainMenu Object*. + MainMenu^ myMainMenu = gcnew MainMenu; + + // Create the MenuItem objects. + MenuItem^ fileMenu = gcnew MenuItem( "&File" ); + MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); + MenuItem^ newFile = gcnew MenuItem( "&New" ); + MenuItem^ openFile = gcnew MenuItem( "&Open" ); + MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); + + // Add the MenuItem objects to myMainMenu. + myMainMenu->MenuItems->Add( fileMenu ); + myMainMenu->MenuItems->Add( editMenu ); + + // Add three submenus to the File menu. + fileMenu->MenuItems->Add( newFile ); + fileMenu->MenuItems->Add( openFile ); + fileMenu->MenuItems->Add( exitProgram ); + + // Assign myMainMenu to the form. + this->Menu = myMainMenu; + + // Clear the File menu items. + fileMenu->MenuItems->Clear(); + } + // + +private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp new file mode 100644 index 00000000000..4c0476cfc6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CloneMenu/CPP/form1.cpp @@ -0,0 +1,106 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + CloneMyMainMenu(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + /// + /// The main entry point for the application. + /// + + [STAThread] + // + void CloneMyMainMenu() + { + // Create the main menu. + MainMenu^ mainMenu1 = gcnew MainMenu; + + // Create the menu items to add. + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + MenuItem^ menuItem3 = gcnew MenuItem; + + // Set the caption for the menu items. + menuItem1->Text = "File"; + menuItem2->Text = "Edit"; + menuItem3->Text = "View"; + + // Add the menu item to mainMenu1. + mainMenu1->MenuItems->Add( menuItem1 ); + mainMenu1->MenuItems->Add( menuItem2 ); + mainMenu1->MenuItems->Add( menuItem3 ); + + // Clone the mainMenu1 and name it mainMenu2. + MainMenu^ mainMenu2 = mainMenu1->CloneMenu(); + + // Assign mainMenu2 to the form. + Menu = mainMenu2; + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp new file mode 100644 index 00000000000..8369c604261 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CodeDomSerializerExceptionExample/CPP/source.cpp @@ -0,0 +1,21 @@ +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::ComponentModel::Design::Serialization; + +namespace CodeDomSerializerExceptionExample +{ + ref class CodeDomSerializerExceptionExample + { + private: + [STAThread] + static void Main() + { + // + throw gcnew CodeDomSerializerException( "This exception was raised as an example.", gcnew CodeLinePragma( "Example.txt", 20 ) ); + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp b/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp new file mode 100644 index 00000000000..faf2936a81c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxmembers.cpp @@ -0,0 +1,138 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +public ref class Win32Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ addButton; + System::Windows::Forms::TextBox^ textBox2; + System::Windows::Forms::Button^ addGrandButton; + System::Windows::Forms::ComboBox^ comboBox1; + System::Windows::Forms::Button^ showSelectedButton; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ findButton; + System::Windows::Forms::Label ^ label1; + +public: + Win32Form1() + { + this->InitializeComponent(); + } + +private: + void InitializeComponent() + { + this->addButton = gcnew System::Windows::Forms::Button; + this->textBox2 = gcnew System::Windows::Forms::TextBox; + this->addGrandButton = gcnew System::Windows::Forms::Button; + this->comboBox1 = gcnew System::Windows::Forms::ComboBox; + this->showSelectedButton = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->findButton = gcnew System::Windows::Forms::Button; + this->label1 = gcnew System::Windows::Forms::Label; + this->addButton->Location = System::Drawing::Point( 248, 32 ); + this->addButton->Size = System::Drawing::Size( 40, 24 ); + this->addButton->TabIndex = 1; + this->addButton->Text = "Add"; + this->addButton->Click += gcnew System::EventHandler( + this, &Win32Form1::addButton_Click ); + this->textBox2->Location = System::Drawing::Point( 8, 64 ); + this->textBox2->Size = System::Drawing::Size( 232, 20 ); + this->textBox2->TabIndex = 6; + this->textBox2->Text = ""; + this->addGrandButton->Location = System::Drawing::Point( 8, 96 ); + this->addGrandButton->Size = System::Drawing::Size( 280, 23 ); + this->addGrandButton->TabIndex = 2; + this->addGrandButton->Text = "Add 1, 000 Items"; + this->addGrandButton->Click += gcnew System::EventHandler( + this, &Win32Form1::addGrandButton_Click ); + this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)( + (System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left) | + System::Windows::Forms::AnchorStyles::Right); + this->comboBox1->DropDownWidth = 280; + array^ objectArray = {"Item 1", + "Item 2", + "Item 3", + "Item 4", + "Item 5"}; + this->comboBox1->Items->AddRange( objectArray ); + this->comboBox1->Location = System::Drawing::Point( 8, 248 ); + this->comboBox1->Size = System::Drawing::Size( 280, 21 ); + this->comboBox1->TabIndex = 7; + this->showSelectedButton->Location = System::Drawing::Point( 8, 128 ); + this->showSelectedButton->Size = System::Drawing::Size( 280, 24 ); + this->showSelectedButton->TabIndex = 4; + this->showSelectedButton->Text = "What Item is Selected?"; + this->showSelectedButton->Click += gcnew System::EventHandler( this, &Win32Form1::showSelectedButton_Click ); + this->textBox1->Location = System::Drawing::Point( 8, 32 ); + this->textBox1->Size = System::Drawing::Size( 232, 20 ); + this->textBox1->TabIndex = 5; + this->textBox1->Text = ""; + this->findButton->Location = System::Drawing::Point( 248, 64 ); + this->findButton->Size = System::Drawing::Size( 40, 24 ); + this->findButton->TabIndex = 3; + this->findButton->Text = "Find"; + this->findButton->Click += gcnew System::EventHandler( this, &Win32Form1::findButton_Click ); + this->label1->Location = System::Drawing::Point( 8, 224 ); + this->label1->Size = System::Drawing::Size( 144, 23 ); + this->label1->TabIndex = 0; + this->label1->Text = "Test ComboBox"; + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^ controlArray = {this->comboBox1, + this->textBox2, + this->textBox1, + this->showSelectedButton, + this->findButton, + this->addGrandButton, + this->addButton, + this->label1}; + this->Controls->AddRange( controlArray ); + this->Text = "ComboBox Sample"; + } + + // + void addButton_Click( Object^ sender, System::EventArgs^ e ) + { + comboBox1->Items->Add( textBox1->Text ); + } + // + + // + void addGrandButton_Click( Object^ sender, System::EventArgs^ e ) + { + comboBox1->BeginUpdate(); + for ( int i = 0; i < 1000; i++ ) + { + comboBox1->Items->Add( "New Item " + i.ToString() ); + } + comboBox1->EndUpdate(); + } + // + + // + void findButton_Click( Object^ sender, System::EventArgs^ e ) + { + int index = comboBox1->FindString( textBox2->Text ); + comboBox1->SelectedIndex = index; + } + // + + // + void showSelectedButton_Click( Object^ sender, System::EventArgs^ e ) + { + int selectedIndex = comboBox1->SelectedIndex; + Object^ selectedItem = comboBox1->SelectedItem; + MessageBox::Show( "Selected Item Text: " + selectedItem->ToString() + "\n" + + "Index: " + selectedIndex.ToString() ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + System::Windows::Forms::Application::Run( gcnew Win32Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp b/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp new file mode 100644 index 00000000000..af6e1f48f45 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComboBox/CPP/comboboxtype.cpp @@ -0,0 +1,140 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +namespace Win32Form1Namespace +{ + public ref class Win32Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ addButton; + System::Windows::Forms::TextBox^ textBox2; + System::Windows::Forms::Button^ addGrandButton; + System::Windows::Forms::ComboBox^ comboBox1; + System::Windows::Forms::Button^ showSelectedButton; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ findButton; + System::Windows::Forms::Label ^ label1; + + public: + Win32Form1() + { + this->InitializeComponent(); + } + + private: + void InitializeComponent() + { + this->addButton = gcnew System::Windows::Forms::Button; + this->textBox2 = gcnew System::Windows::Forms::TextBox; + this->addGrandButton = gcnew System::Windows::Forms::Button; + this->comboBox1 = gcnew System::Windows::Forms::ComboBox; + this->showSelectedButton = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->findButton = gcnew System::Windows::Forms::Button; + this->label1 = gcnew System::Windows::Forms::Label; + this->addButton->Location = System::Drawing::Point( 248, 32 ); + this->addButton->Size = System::Drawing::Size( 40, 24 ); + this->addButton->TabIndex = 1; + this->addButton->Text = "Add"; + this->addButton->Click += gcnew System::EventHandler( + this, &Win32Form1::addButton_Click ); + this->textBox2->Location = System::Drawing::Point( 8, 64 ); + this->textBox2->Size = System::Drawing::Size( 232, 20 ); + this->textBox2->TabIndex = 6; + this->textBox2->Text = ""; + this->addGrandButton->Location = System::Drawing::Point( 8, 96 ); + this->addGrandButton->Size = System::Drawing::Size( 280, 23 ); + this->addGrandButton->TabIndex = 2; + this->addGrandButton->Text = "Add 1, 000 Items"; + this->addGrandButton->Click += gcnew System::EventHandler( + this, &Win32Form1::addGrandButton_Click ); + this->comboBox1->Anchor = (System::Windows::Forms::AnchorStyles)( + (System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left) | + System::Windows::Forms::AnchorStyles::Right); + this->comboBox1->DropDownWidth = 280; + array^ objectArray = {"Item 1", + "Item 2", + "Item 3", + "Item 4", + "Item 5"}; + this->comboBox1->Items->AddRange( objectArray ); + this->comboBox1->Location = System::Drawing::Point( 8, 248 ); + this->comboBox1->Size = System::Drawing::Size( 280, 21 ); + this->comboBox1->TabIndex = 7; + this->showSelectedButton->Location = System::Drawing::Point( 8, 128 ); + this->showSelectedButton->Size = System::Drawing::Size( 280, 24 ); + this->showSelectedButton->TabIndex = 4; + this->showSelectedButton->Text = "What Item is Selected?"; + this->showSelectedButton->Click += gcnew System::EventHandler( + this, &Win32Form1::showSelectedButton_Click ); + this->textBox1->Location = System::Drawing::Point( 8, 32 ); + this->textBox1->Size = System::Drawing::Size( 232, 20 ); + this->textBox1->TabIndex = 5; + this->textBox1->Text = ""; + this->findButton->Location = System::Drawing::Point( 248, 64 ); + this->findButton->Size = System::Drawing::Size( 40, 24 ); + this->findButton->TabIndex = 3; + this->findButton->Text = "Find"; + this->findButton->Click += gcnew System::EventHandler( + this, &Win32Form1::findButton_Click ); + this->label1->Location = System::Drawing::Point( 8, 224 ); + this->label1->Size = System::Drawing::Size( 144, 23 ); + this->label1->TabIndex = 0; + this->label1->Text = "Test ComboBox"; + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^ controlsArray = {this->comboBox1, + this->textBox2, + this->textBox1, + this->showSelectedButton, + this->findButton, + this->addGrandButton, + this->addButton, + this->label1}; + this->Controls->AddRange( controlsArray ); + this->Text = "ComboBox Sample"; + } + + void addButton_Click( Object^ sender, System::EventArgs^ e ) + { + comboBox1->Items->Add( textBox1->Text ); + } + + void addGrandButton_Click( Object^ sender, System::EventArgs^ e ) + { + comboBox1->BeginUpdate(); + for ( int i = 0; i < 1000; i++ ) + { + comboBox1->Items->Add( "Item 1 " + i.ToString() ); + + } + comboBox1->EndUpdate(); + } + + void findButton_Click( Object^ sender, System::EventArgs^ e ) + { + int index = comboBox1->FindString( textBox2->Text ); + comboBox1->SelectedIndex = index; + } + + void showSelectedButton_Click( Object^ sender, System::EventArgs^ e ) + { + int selectedIndex = comboBox1->SelectedIndex; + Object^ selectedItem = comboBox1->SelectedItem; + MessageBox::Show( "Selected Item Text: " + selectedItem->ToString() + "\n" + + "Index: " + selectedIndex.ToString() ); + } + }; +} + + +[System::STAThreadAttribute] +int main() +{ + System::Windows::Forms::Application::Run( gcnew Win32Form1Namespace::Win32Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp new file mode 100644 index 00000000000..f42022f6fad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventArgsExample/CPP/componentchangedeventargsexample.cpp @@ -0,0 +1,28 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +public ref class ComponentChangedEventArgsExample +{ +public: + ComponentChangedEventArgsExample(){} + + // +public: + // This example method creates a ComponentChangedEventArgs using the specified arguments. + // Typically, this type of event args is created by a design mode subsystem. + ComponentChangedEventArgs^ CreateComponentChangedEventArgs( Object^ component, MemberDescriptor^ member, Object^ oldValue, Object^ newValue ) + { + // Creates a component changed event args with the specified arguments. + ComponentChangedEventArgs^ args = gcnew ComponentChangedEventArgs( component, member, oldValue, newValue ); + + // The component that has changed: args->Component + // The member of the component that changed: args->Member + // The old value of the member: args->oldValue + // The new value of the member: args->newValue + return args; + } + // +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp new file mode 100644 index 00000000000..72414f9b04d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentChangedEventHandlerExample/CPP/componentchangedeventhandlerexample.cpp @@ -0,0 +1,36 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentChangedEventHandlerExample + { + private: + ComponentChangedEventHandlerExample(){} + + // + public: + void LinkComponentChangedEvent( IComponentChangeService^ changeService ) + { + // Registers an event handler for the ComponentChanged event. + changeService->ComponentChanged += gcnew ComponentChangedEventHandler( + this, &ComponentChangedEventHandlerExample::OnComponentChanged ); + } + + private: + void OnComponentChanged( Object^ sender, ComponentChangedEventArgs^ e ) + { + // Displays changed component information on the console. + Console::WriteLine( "Type of the component that has changed: " + + e->Component->GetType()->FullName ); + Console::WriteLine( "Name of the member of the component that has changed: " + + e->Member->Name ); + Console::WriteLine( "Old value of the member: " + e->OldValue ); + Console::WriteLine( "New value of the member: " + e->NewValue ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp new file mode 100644 index 00000000000..f44c0bc7fff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventArgsExample2/CPP/componentchangingeventargsexample.cpp @@ -0,0 +1,26 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentChangingEventArgsExample + { + public: + ComponentChangingEventArgsExample(){} + + // + public: + // This example method creates a ComponentChangingEventArgs using the specified arguments. + // Typically, this type of event args is created by a design mode subsystem. + ComponentChangingEventArgs^ CreateComponentChangingEventArgs( Object^ component, MemberDescriptor^ member ) + { + // The component that is about to change: args.Component + // The member that is about to change: args.Member + return gcnew ComponentChangingEventArgs( component,member ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp new file mode 100644 index 00000000000..ce86fc2a207 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentChangingEventHandlerExample/CPP/componentchangingeventhandlerexample.cpp @@ -0,0 +1,34 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentChangingEventHandlerExample + { + private: + ComponentChangingEventHandlerExample(){} + + // + public: + void LinkComponentChangingEvent( IComponentChangeService^ changeService ) + { + // Registers an event handler for the ComponentChanging event. + changeService->ComponentChanging += gcnew ComponentChangingEventHandler( + this, &ComponentChangingEventHandlerExample::OnComponentChanging ); + } + + private: + void OnComponentChanging( Object^ sender, ComponentChangingEventArgs^ e ) + { + // Displays changing component information on the console. + Console::WriteLine( "Type of the component that is about to change: " + + e->Component->GetType()->FullName ); + Console::WriteLine( "Name of the member of the component that is about to change: " + + e->Member->Name ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp new file mode 100644 index 00000000000..187a922cec8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentDesignerExample/CPP/examplecomponent.cpp @@ -0,0 +1,62 @@ +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// Provides an example component designer. +ref class ExampleComponentDesigner: public ComponentDesigner +{ +public: + ExampleComponentDesigner() + { + } + + // This method provides an opportunity to perform processing when a designer is initialized. + // The component parameter is the component that the designer is associated with. + virtual void Initialize( IComponent^ component ) override + { + // Always call the base Initialize method in an of this method. + ComponentDesigner::Initialize( component ); + } + + // This method is invoked when the associated component is double-clicked. + virtual void DoDefaultAction() override + { + MessageBox::Show( "The event handler for the default action was invoked." ); + } + + // This method provides designer verbs. + property DesignerVerbCollection^ Verbs + { + virtual DesignerVerbCollection^ get() override + { + array^ newDesignerVerbs = {gcnew DesignerVerb( "Example Designer Verb Command", gcnew EventHandler( this, &ExampleComponentDesigner::onVerb ) )}; + return gcnew DesignerVerbCollection( newDesignerVerbs ); + } + } + +private: + // Event handling method for the example designer verb + void onVerb( Object^ sender, EventArgs^ e ) + { + MessageBox::Show( "The event handler for the Example Designer Verb Command was invoked." ); + } +}; + +// Provides an example component associated with the example component designer. + +[DesignerAttribute(ExampleComponentDesigner::typeid, IDesigner::typeid)] +ref class ExampleComponent: public Component +{ +public: + ExampleComponent(){} +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp new file mode 100644 index 00000000000..65d322c5f1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentEventArgsExample/CPP/componenteventargsexample.cpp @@ -0,0 +1,27 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentEventArgsExample + { + public: + ComponentEventArgsExample() + { + } + + // + public: + // This example method creates a ComponentEventArgs using the specified argument. + // Typically, this type of event args is created by a design mode subsystem. + ComponentEventArgs^ CreateComponentEventArgs( IComponent^ component ) + { + // The component that is related to the event: args.Component + return gcnew ComponentEventArgs( component ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp new file mode 100644 index 00000000000..ec45cb83d8d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentEventHandlerExample/CPP/componenteventhandlerexample.cpp @@ -0,0 +1,46 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentEventHandlerExample + { + private: + ComponentEventHandlerExample() + { + } + + // + public: + void LinkComponentEvent( IComponentChangeService^ changeService ) + { + // Registers an event handler for the ComponentAdded, + // ComponentAdding, ComponentRemoved, and ComponentRemoving events. + changeService->ComponentAdded += gcnew ComponentEventHandler( + this, &ComponentEventHandlerExample::OnComponentEvent ); + changeService->ComponentAdding += gcnew ComponentEventHandler( + this, &ComponentEventHandlerExample::OnComponentEvent ); + changeService->ComponentRemoved += gcnew ComponentEventHandler( + this, &ComponentEventHandlerExample::OnComponentEvent ); + changeService->ComponentRemoving += gcnew ComponentEventHandler( + this, &ComponentEventHandlerExample::OnComponentEvent ); + } + + private: + void OnComponentEvent( Object^ sender, ComponentEventArgs^ e ) + { + // Displays changed component information on the console. + if ( e->Component->Site != nullptr ) + { + Console::WriteLine( "Name of the component related to the event: " + + e->Component->Site->Name ); + } + Console::WriteLine( "Type of the component related to the event: " + + e->Component->GetType()->FullName ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp new file mode 100644 index 00000000000..ff6f565a63c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventArgsExample/CPP/componentrenameeventargsexample.cpp @@ -0,0 +1,29 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentRenameEventArgsExample + { + public: + ComponentRenameEventArgsExample() + { + } + + // + public: + // This example method creates a ComponentRenameEventArgs using the specified arguments. + // Typically, this type of event args is created by a design mode subsystem. + ComponentRenameEventArgs^ CreateComponentRenameEventArgs( Object^ component, String^ oldName, String^ newName ) + { + // The component that was renamed: args.Component + // The previous name of the component: args.OldName + // The new name of the component: args.NewName + return gcnew ComponentRenameEventArgs( component, oldName, newName ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp new file mode 100644 index 00000000000..4384f7cc2b1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ComponentRenameEventHandlerExample/CPP/componentrenameeventhandlerexample.cpp @@ -0,0 +1,38 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class ComponentRenameEventHandlerExample + { + private: + ComponentRenameEventHandlerExample() + { + } + + // + public: + void LinkComponentRenameEvent( IComponentChangeService^ changeService ) + { + // Registers an event handler for the ComponentRename event. + changeService->ComponentRename += gcnew ComponentRenameEventHandler( + this, &ComponentRenameEventHandlerExample::OnComponentRename ); + } + + private: + void OnComponentRename( Object^ /*sender*/, ComponentRenameEventArgs^ e ) + { + // Displayss component renamed information on the console. + Console::WriteLine( "Type of the component that has been renamed: " + + e->Component->GetType()->FullName ); + Console::WriteLine( "New name of the component that has been renamed: " + + e->NewName ); + Console::WriteLine( "Old name of the component that has been renamed: " + + e->OldName ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp b/snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp new file mode 100644 index 00000000000..6e358e05f13 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ContainsItems/CPP/containsitems.cpp @@ -0,0 +1,55 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +ref class TestForm: public Form +{ +public: + TestForm() + { + InitializeMenu(); + } + + // +public: + void InitializeMenu() + { + // Create the MainMenu object. + MainMenu^ myMainMenu = gcnew MainMenu; + + // Create the MenuItem objects. + MenuItem^ fileMenu = gcnew MenuItem( "&File" ); + MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); + MenuItem^ newFile = gcnew MenuItem( "&New" ); + MenuItem^ openFile = gcnew MenuItem( "&Open" ); + MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); + + // Add the MenuItem objects to myMainMenu. + myMainMenu->MenuItems->Add( fileMenu ); + myMainMenu->MenuItems->Add( editMenu ); + + // Add three submenus to the File menu. + fileMenu->MenuItems->Add( newFile ); + fileMenu->MenuItems->Add( openFile ); + fileMenu->MenuItems->Add( exitProgram ); + + // Assign myMainMenu to the form. + Menu = myMainMenu; + + // Check that the File menu contains the Open menu item. + if ( fileMenu->MenuItems->Contains( openFile ) ) + { + MessageBox::Show( "The File menu contains 'Open' " + fileMenu->Text ); + } + } + // +}; + +int main() +{ + Application::Run( gcnew TestForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp new file mode 100644 index 00000000000..ae81c345345 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ContextStackExample/CPP/class1.cpp @@ -0,0 +1,36 @@ + + +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Windows::Forms; + +int main() +{ + // + // Create a ContextStack. + ContextStack^ stack = gcnew ContextStack; + + // + // + // Push ten items on to the stack and output the value of each. + for ( int number = 0; number < 10; number++ ) + { + Console::WriteLine( "Value pushed to stack: {0}", number ); + stack->Push( number ); + } + // + + // + // Pop each item off the stack. + Object^ item = nullptr; + while ( (item = stack->Pop()) != 0 ) + Console::WriteLine( "Value popped from stack: {0}", item ); + // +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp new file mode 100644 index 00000000000..20fbec64d4e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.ControlRemoved/CPP/form1.cpp @@ -0,0 +1,162 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 288, 32 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::addControl_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 288, 72 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 1; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::removeControl_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 376, 334 ); + array^temp0 = {this->button2,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // + // This example demonstrates the use of the ControlAdded and + // ControlRemoved events. This example assumes that two Button controls + // are added to the form and connected to the addControl_Click and + // removeControl_Click event-handler methods. +private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Connect the ControlRemoved and ControlAdded event handlers + // to the event-handler methods. + // ControlRemoved and ControlAdded are not available at design time. + this->ControlRemoved += gcnew System::Windows::Forms::ControlEventHandler( this, &Form1::Control_Removed ); + this->ControlAdded += gcnew System::Windows::Forms::ControlEventHandler( this, &Form1::Control_Added ); + } + + void Control_Added( Object^ /*sender*/, System::Windows::Forms::ControlEventArgs^ e ) + { + MessageBox::Show( String::Format( "The control named {0} has been added to the form.", e->Control->Name ) ); + } + + void Control_Removed( Object^ /*sender*/, System::Windows::Forms::ControlEventArgs^ e ) + { + MessageBox::Show( String::Format( "The control named {0} has been removed from the form.", e->Control->Name ) ); + } + + // Click event handler for a Button control. Adds a TextBox to the form. + void addControl_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create a new TextBox control and add it to the form. + TextBox^ textBox1 = gcnew TextBox; + textBox1->Size = System::Drawing::Size( 100, 10 ); + textBox1->Location = Point(10,10); + + // Name the control in order to remove it later. The name must be specified + // if a control is added at run time. + textBox1->Name = "textBox1"; + + // Add the control to the form's control collection. + this->Controls->Add( textBox1 ); + } + + // Click event handler for a Button control. + // Removes the previously added TextBox from the form. + void removeControl_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Loop through all controls in the form's control collection. + IEnumerator^ myEnum = this->Controls->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Control^ tempCtrl = safe_cast(myEnum->Current); + + // Determine whether the control is textBox1, + // and if it is, remove it. + if ( tempCtrl->Name->Equals( "textBox1" ) ) + { + this->Controls->Remove( tempCtrl ); + } + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp new file mode 100644 index 00000000000..efd42bf6d41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.DoubleClick/CPP/form1.cpp @@ -0,0 +1,142 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp0 = {"C:\\Windows\\Windows Update.log"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 32, 24 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 200, 108 ); + this->listBox1->TabIndex = 0; + this->listBox1->DoubleClick += gcnew System::EventHandler( this, &Form1::listBox1_DoubleClick ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 32, 144 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->textBox1->Size = System::Drawing::Size( 448, 240 ); + this->textBox1->TabIndex = 1; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 520, 446 ); + array^temp1 = {this->textBox1,this->listBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // This example uses the DoubleClick event of a ListBox to load text files + // listed in the ListBox into a TextBox control. This example + // assumes that the ListBox, named listBox1, contains a list of valid file + // names with path and that this event handler method + // is connected to the DoublClick event of a ListBox control named listBox1. + // This example requires code access permission to access files. +private: + void listBox1_DoubleClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Get the name of the file to open from the ListBox. + String^ file = listBox1->SelectedItem->ToString(); + try + { + // Determine if the file exists before loading. + if ( System::IO::File::Exists( file ) ) + { + + // Open the file and use a TextReader to read the contents into the TextBox. + System::IO::FileInfo^ myFile = gcnew System::IO::FileInfo( listBox1->SelectedItem->ToString() ); + System::IO::TextReader^ myData = myFile->OpenText(); + ; + textBox1->Text = myData->ReadToEnd(); + myData->Close(); + } + } + // Exception is thrown by the OpenText method of the FileInfo class. + catch ( System::IO::FileNotFoundException^ ) + { + MessageBox::Show( "The file you specified does not exist." ); + } + // Exception is thrown by the ReadToEnd method of the TextReader class. + catch ( System::IO::IOException^ ) + { + MessageBox::Show( "There was a problem loading the file into the TextBox. Ensure that the file is a valid text file." ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp new file mode 100644 index 00000000000..8390564e1f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.Enter/CPP/form1.cpp @@ -0,0 +1,128 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 176, 32 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 80, 32 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Enter += gcnew System::EventHandler( this, &Form1::button1_Enter ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 48, 104 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 176, 20 ); + this->textBox1->TabIndex = 1; + this->textBox1->Text = "textBox1"; + this->textBox1->Leave += gcnew System::EventHandler( this, &Form1::textBox1_Leave ); + this->textBox1->Enter += gcnew System::EventHandler( this, &Form1::textBox1_Enter ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->textBox1,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Enter( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + + // +private: + void textBox1_Enter( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // If the TextBox contains text, change its foreground and background colors. + if ( textBox1->Text != String::Empty ) + { + textBox1->ForeColor = Color::Red; + textBox1->BackColor = Color::Black; + + // Move the selection pointer to the end of the text of the control. + textBox1->Select(textBox1->Text->Length,0); + } + } + + void textBox1_Leave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Reset the colors and selection of the TextBox after focus is lost. + textBox1->ForeColor = Color::Black; + textBox1->BackColor = Color::White; + textBox1->Select(0,0); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp new file mode 100644 index 00000000000..5f45db2051d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.FindForm/CPP/form1.cpp @@ -0,0 +1,126 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->groupBox1 = gcnew System::Windows::Forms::GroupBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->groupBox1->SuspendLayout(); + this->SuspendLayout(); + + // + // groupBox1 + // + array^temp0 = {this->button1}; + this->groupBox1->Controls->AddRange( temp0 ); + this->groupBox1->Location = System::Drawing::Point( 32, 24 ); + this->groupBox1->Name = "groupBox1"; + this->groupBox1->Size = System::Drawing::Size( 240, 184 ); + this->groupBox1->TabIndex = 0; + this->groupBox1->TabStop = false; + this->groupBox1->Text = "groupBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 144, 48 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp1 = {this->groupBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->groupBox1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + // + // This example uses the Parent property and the Find method of Control to set + // properties on the parent control of a Button and its Form. The example assumes + // that a Button control named button1 is located within a GroupBox control. The + // example also assumes that the Click event of the Button control is connected to + // the event handler method defined in the example. +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Get the control the Button control is located in. In this case a GroupBox. + Control^ control = button1->Parent; + + // Set the text and backcolor of the parent control. + control->Text = "My Groupbox"; + control->BackColor = Color::Blue; + + // Get the form that the Button control is contained within. + Form^ myForm = button1->FindForm(); + + // Set the text and color of the form containing the Button. + myForm->Text = "The Form of My Control"; + myForm->BackColor = Color::Red; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp new file mode 100644 index 00000000000..c0d2df832d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.KeyDown/CPP/form1.cpp @@ -0,0 +1,134 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 64, 48 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 200, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + this->textBox1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::textBox1_KeyDown ); + this->textBox1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler( this, &Form1::textBox1_KeyPress ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 376, 342 ); + array^temp0 = {this->textBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Boolean flag used to determine when a character other than a number is entered. +private: + bool nonNumberEntered; + + // Handle the KeyDown event to determine the type of character entered into the control. + void textBox1_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) + { + // Initialize the flag to false. + nonNumberEntered = false; + + // Determine whether the keystroke is a number from the top of the keyboard. + if ( e->KeyCode < Keys::D0 || e->KeyCode > Keys::D9 ) + { + // Determine whether the keystroke is a number from the keypad. + if ( e->KeyCode < Keys::NumPad0 || e->KeyCode > Keys::NumPad9 ) + { + // Determine whether the keystroke is a backspace. + if ( e->KeyCode != Keys::Back ) + { + // A non-numerical keystroke was pressed. + // Set the flag to true and evaluate in KeyPress event. + nonNumberEntered = true; + } + } + } + //If shift key was pressed, it's not a number. + if (Control::ModifierKeys == Keys::Shift) { + nonNumberEntered = true; + } + } + + // This event occurs after the KeyDown event and can be used to prevent + // characters from entering the control. + void textBox1_KeyPress( Object^ /*sender*/, System::Windows::Forms::KeyPressEventArgs^ e ) + { + // Check for the flag being set in the KeyDown event. + if ( nonNumberEntered) + { // Stop the character from being entered into the control since it is non-numerical. + e->Handled = true; + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp new file mode 100644 index 00000000000..1d20678dbec --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.KeyUp/CPP/form1.cpp @@ -0,0 +1,113 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 120, 80 ); + this->textBox1->Name = "textBox1"; + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + this->textBox1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::textBox1_MouseUp ); + this->textBox1->KeyUp += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::textBox1_KeyUp ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 464, 326 ); + array^temp0 = {this->textBox1}; + this->Controls->AddRange( temp0 ); + this->KeyPreview = true; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void textBox1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ){} + + // + // This example demonstrates how to use the KeyUp event with the Help class to display + // pop-up style help to the user of the application. When the user presses F1, the Help + // class displays a pop-up window, similar to a ToolTip, near the control. This example assumes + // that a TextBox control, named textBox1, has been added to the form and its KeyUp + // event has been connected to this event handler method. +private: + void textBox1_KeyUp( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) + { + + // Determine whether the key entered is the F1 key. Display help if it is. + if ( e->KeyCode == Keys::F1 ) + { + + // Display a pop-up help topic to assist the user. + Help::ShowPopup( textBox1, "Enter your first name", Point(textBox1->Right,this->textBox1->Bottom) ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp new file mode 100644 index 00000000000..36ce52a4484 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.Layout/CPP/layout.cpp @@ -0,0 +1,74 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::ComponentModel::Container^ components; + +public: + MyForm() + { + InitializeComponent(); + } + +public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 48, 56 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^controlArray = {this->button1}; + this->Controls->AddRange( controlArray ); + this->Name = "MyForm"; + this->Text = "MyForm"; + this->Layout += gcnew System::Windows::Forms::LayoutEventHandler( this, &MyForm::MyForm_Layout ); + this->ResumeLayout( false ); + } + + // +private: + void MyForm_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ /*e*/ ) + { + // Center the Form on the user's screen everytime it requires a Layout. + this->SetBounds( (Screen::GetBounds( this ).Width / 2) - (this->Width / 2), (Screen::GetBounds( this ).Height / 2) - (this->Height / 2), this->Width, this->Height, BoundsSpecified::Location ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp new file mode 100644 index 00000000000..87b5b860fe0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.Move/CPP/form1.cpp @@ -0,0 +1,86 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 344, 270 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Resize += gcnew System::EventHandler( this, &Form1::Form1_Resize ); + this->Move += gcnew System::EventHandler( this, &Form1::Form1_Move ); + } + + void Form1_Resize( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + + // + // The following example displays the location of the form in screen coordinates + // on the caption bar of the form. +private: + void Form1_Move( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->Text = String::Format( "Form screen position = {0}", this->Location ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp new file mode 100644 index 00000000000..ef0f2894be4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.Paint/CPP/form1.cpp @@ -0,0 +1,109 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 376, 334 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // + // This example creates a PictureBox control on the form and draws to it. + // This example assumes that the Form_Load event handler method is + // connected to the Load event of the form. +private: + PictureBox^ pictureBox1; + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + pictureBox1 = gcnew PictureBox; + + // Dock the PictureBox to the form and set its background to white. + pictureBox1->Dock = DockStyle::Fill; + pictureBox1->BackColor = Color::White; + + // Connect the Paint event of the PictureBox to the event handler method. + pictureBox1->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::pictureBox1_Paint ); + + // Add the PictureBox control to the Form. + this->Controls->Add( pictureBox1 ); + } + + void pictureBox1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) + { + // Create a local version of the graphics object for the PictureBox. + Graphics^ g = e->Graphics; + + // Draw a string on the PictureBox. + g->DrawString( "This is a diagonal line drawn on the control", + gcnew System::Drawing::Font( "Arial",10 ), System::Drawing::Brushes::Blue, Point(30,30) ); + + // Draw a line in the PictureBox. + g->DrawLine( System::Drawing::Pens::Red, pictureBox1->Left, pictureBox1->Top, + pictureBox1->Right, pictureBox1->Bottom ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp b/snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp new file mode 100644 index 00000000000..aa3e4d93824 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control.Validating/CPP/validating.cpp @@ -0,0 +1,114 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Runtime::InteropServices; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::ErrorProvider^ errorProvider1; + + + +private: + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->errorProvider1 = gcnew System::Windows::Forms::ErrorProvider; + this->textBox1->Location = System::Drawing::Point( 16, 16 ); + this->textBox1->Size = System::Drawing::Size( 216, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + this->textBox1->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &Form1::textBox1_Validating ); + this->textBox1->Validated += gcnew System::EventHandler( this, &Form1::textBox1_Validated ); + this->button1->Location = System::Drawing::Point( 208, 240 ); + this->button1->TabIndex = 2; + this->button1->Text = "button1"; + this->button2->Location = System::Drawing::Point( 108, 240 ); + this->button2->TabIndex = 1; + this->button2->Text = "Non-Validating"; + this->errorProvider1->DataMember = nullptr; + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^ controlArray = {this->textBox1,this->button1, this->button2}; + this->Controls->AddRange( controlArray ); + this->Text = "Form1"; + } + +// +public: + Form1() + { + InitializeComponent(); + //Set button2 to be non-validating. + this->button2->CausesValidation = false; + } + + // +private: + void textBox1_Validating( Object^ sender, System::ComponentModel::CancelEventArgs^ e ) + { + String^ errorMsg; + if ( !ValidEmailAddress( textBox1->Text, &errorMsg ) ) + { + // Cancel the event and select the text to be corrected by the user. + e->Cancel = true; + textBox1->Select( 0, textBox1->Text->Length ); + + // Set the ErrorProvider error with the text to display. + this->errorProvider1->SetError( textBox1, errorMsg ); + } + } + + void textBox1_Validated( Object^ sender, System::EventArgs^ e ) + { + // If all conditions have been met, clear the ErrorProvider of errors. + errorProvider1->SetError( textBox1, "" ); + } + +public: + bool ValidEmailAddress( String^ emailAddress, [Out]interior_ptr errorMessage ) + { + // Confirm that the email address String* is not empty. + if ( emailAddress->Length == 0 ) + { + *errorMessage = "email address is required."; + return false; + } + + // Confirm that there is an "@" and a "." in the email address, and in the correct order. + if ( emailAddress->IndexOf( "@" ) > -1 ) + { + if ( emailAddress->IndexOf( ".", emailAddress->IndexOf( "@" ) ) > emailAddress->IndexOf( "@" ) ) + { + *errorMessage = ""; + return true; + } + } + + *errorMessage = "email address must be valid email address format.\n" + + "For example 'someone@example.com' "; + return false; + } + // + // +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp b/snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp new file mode 100644 index 00000000000..66bff7907f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ControlCollection/CPP/controlcollection.cpp @@ -0,0 +1,223 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace Controls +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ addButton; + System::Windows::Forms::Button^ removeButton; + System::Windows::Forms::Button^ clearButton; + System::Windows::Forms::Button^ addRangeButton; + System::Windows::Forms::Panel^ panel1; + System::Windows::Forms::Button^ removeAtButton; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->panel1 = gcnew System::Windows::Forms::Panel; + this->addRangeButton = gcnew System::Windows::Forms::Button; + this->removeAtButton = gcnew System::Windows::Forms::Button; + this->addButton = gcnew System::Windows::Forms::Button; + this->removeButton = gcnew System::Windows::Forms::Button; + this->clearButton = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // panel1 + // + this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + this->panel1->Location = System::Drawing::Point( 8, 8 ); + this->panel1->Name = "panel1"; + this->panel1->Size = System::Drawing::Size( 168, 112 ); + this->panel1->TabIndex = 5; + + // + // addRangeButton + // + this->addRangeButton->Location = System::Drawing::Point( 8, 168 ); + this->addRangeButton->Name = "addRangeButton"; + this->addRangeButton->TabIndex = 4; + this->addRangeButton->Text = "AddRange"; + this->addRangeButton->Click += gcnew System::EventHandler( this, &Form1::addRangeButton_Click ); + + // + // removeAtButton + // + this->removeAtButton->Location = System::Drawing::Point( 96, 168 ); + this->removeAtButton->Name = "removeAtButton"; + this->removeAtButton->TabIndex = 6; + this->removeAtButton->Text = "RemoveAt"; + this->removeAtButton->Click += gcnew System::EventHandler( this, &Form1::removeAtButton_Click ); + + // + // addButton + // + this->addButton->Location = System::Drawing::Point( 8, 136 ); + this->addButton->Name = "addButton"; + this->addButton->TabIndex = 0; + this->addButton->Text = "Add"; + this->addButton->Click += gcnew System::EventHandler( this, &Form1::addButton_Click ); + + // + // removeButton + // + this->removeButton->Location = System::Drawing::Point( 96, 136 ); + this->removeButton->Name = "removeButton"; + this->removeButton->TabIndex = 2; + this->removeButton->Text = "Remove"; + this->removeButton->Click += gcnew System::EventHandler( this, &Form1::removeButton_Click ); + + // + // clearButton + // + this->clearButton->Location = System::Drawing::Point( 96, 200 ); + this->clearButton->Name = "clearButton"; + this->clearButton->TabIndex = 3; + this->clearButton->Text = "Clear"; + this->clearButton->Click += gcnew System::EventHandler( this, &Form1::clearButton_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 184, 229 ); + array^formControlsArray = {this->removeAtButton,this->panel1,this->addRangeButton,this->clearButton,this->removeButton,this->addButton}; + this->Controls->AddRange( formControlsArray ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Create two RadioButtons to add to the Panel. + private: + RadioButton^ radioAddButton; + RadioButton^ radioRemoveButton; + + // Add controls to the Panel using the AddRange method. + void addRangeButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + radioAddButton = gcnew RadioButton; + radioRemoveButton = gcnew RadioButton; + + // Set the Text the RadioButtons will display. + radioAddButton->Text = "radioAddButton"; + radioRemoveButton->Text = "radioRemoveButton"; + + // Set the appropriate location of radioRemoveButton. + radioRemoveButton->Location = System::Drawing::Point( radioAddButton->Location.X, radioAddButton->Location.Y + radioAddButton->Height ); + + //Add the controls to the Panel. + array^controlArray = {radioAddButton,radioRemoveButton}; + panel1->Controls->AddRange( controlArray ); + } + // + + // + // Create a TextBox to add to the Panel. + private: + TextBox^ textBox1; + + // Add controls to the Panel using the Add method. + void addButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + textBox1 = gcnew TextBox; + panel1->Controls->Add( textBox1 ); + } + // + + // + // Clear all the controls in the Panel. + private: + void clearButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + panel1->Controls->Clear(); + } + // + + // + // Remove the first control in the collection. + private: + void removeAtButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( panel1->Controls->Count > 0 ) + { + panel1->Controls->RemoveAt( 0 ); + } + } + // + + // + // Remove the RadioButton control if it exists. + private: + void removeButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( panel1->Controls->Contains( removeButton ) ) + { + panel1->Controls->Remove( removeButton ); + } + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +void main() +{ + Application::Run( gcnew Controls::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp new file mode 100644 index 00000000000..c712582c326 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ControlDesignerExample/CPP/controldesignerexample.cpp @@ -0,0 +1,97 @@ + + +#using +#using +#using +#using + +// +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Collections; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + + public ref class TestControlDesigner: public System::Windows::Forms::Design::ControlDesigner + { + private: + bool mouseover; + Color lineColor; + + public: + + property Color OutlineColor + { + Color get() + { + return lineColor; + } + + void set( Color value ) + { + lineColor = value; + } + + } + TestControlDesigner() + { + mouseover = false; + lineColor = Color::White; + } + + protected: + virtual void OnMouseEnter() override + { + this->mouseover = true; + this->Control->Refresh(); + } + + virtual void OnMouseLeave() override + { + this->mouseover = false; + this->Control->Refresh(); + } + + virtual void OnPaintAdornments( System::Windows::Forms::PaintEventArgs^ pe ) override + { + if ( this->mouseover ) + pe->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( this->lineColor ),6 ), 0, 0, this->Control->Size.Width, this->Control->Size.Height ); + } + + // + protected: + [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)] + virtual void PreFilterProperties( System::Collections::IDictionary^ properties ) override + { + properties->Add( "OutlineColor", TypeDescriptor::CreateProperty( TestControlDesigner::typeid, "OutlineColor", System::Drawing::Color::typeid, nullptr ) ); + } + // + }; + + [DesignerAttribute(TestControlDesigner::typeid)] + public ref class TestControl: public System::Windows::Forms::UserControl + { + private: + System::ComponentModel::Container^ components; + + public: + TestControl() + { + components = gcnew System::ComponentModel::Container; + } + + protected: + ~TestControl() + { + if ( components != nullptr ) + { + delete components; + } + } + }; +// + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp b/snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp new file mode 100644 index 00000000000..76705929c7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ControlIsKeyLocked/CPP/controliskeylocked.cpp @@ -0,0 +1,21 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +int main() +{ + if (Control::IsKeyLocked( Keys::CapsLock )) { + MessageBox::Show( "The Caps Lock key is ON." ); + } + else { + MessageBox::Show( "The Caps Lock key is OFF." ); + } + +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp new file mode 100644 index 00000000000..de713031fd7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_BeginInvoke/CPP/control_begininvoke.cpp @@ -0,0 +1,121 @@ +// System::Windows::Forms::Control::BeginInvoke(Delegate*, Object[]) +// System::Windows::Forms::Control::BeginInvoke(Delegate*) + +/* +The following program demonstrates the 'BeginInvoke(Delegate*)' and BeginInvoke(Delegate*, Object[]) +methods of 'Control' class. +A 'TextBox' and two 'Button' controls are added to the form. When the first 'Button' +is clicked a delegate is called asynchronously using 'BeginInvoke' method of 'Control' +class and an array of objects is passed as an arguments to the delegator which adds +'Label' control to the form. When the second 'Button' control is +clicked a delegate is called asynchronously using 'BeginInvoke' which will display +a message in the 'TextBox'. +*/ + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ components; + TextBox^ myTextBox; + Button^ myButton; + Button^ invokeButton; + +public: + MyForm() + { + components = nullptr; + + // Required for Windows Form Designer support. + InitializeComponent(); + } + +protected: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Set 'myTextBox' properties. + this->myTextBox = gcnew TextBox; + myTextBox->Location = Point(90,16); + myTextBox->Size = System::Drawing::Size( 160, 25 ); + + // Set 'myButton' properties. + this->myButton = gcnew Button; + myButton->Text = "Add Label"; + myButton->Location = Point(45,50); + myButton->Size = System::Drawing::Size( 70, 25 ); + myButton->Click += gcnew EventHandler( this, &MyForm::Button_Click ); + invokeButton = gcnew Button; + invokeButton->Text = "Invoke Delegate"; + invokeButton->Location = Point(120,50); + invokeButton->Size = System::Drawing::Size( 100, 25 ); + invokeButton->Click += gcnew EventHandler( this, &MyForm::Invoke_Click ); + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "MyForm"; + this->Text = "Invoke example"; + this->Controls->Add( myTextBox ); + this->Controls->Add( myButton ); + this->Controls->Add( invokeButton ); + } + + // +private: + delegate void MyDelegate( + Label^ myControl, String^ myArg2 ); + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + array^myArray = gcnew array(2); + myArray[ 0 ] = gcnew Label; + myArray[ 1 ] = "Enter a Value"; + myTextBox->BeginInvoke( gcnew MyDelegate( this, &MyForm::DelegateMethod ), myArray ); + } + + void DelegateMethod( Label^ myControl, String^ myCaption ) + { + myControl->Location = Point(16,16); + myControl->Size = System::Drawing::Size( 80, 25 ); + myControl->Text = myCaption; + this->Controls->Add( myControl ); + } + + delegate void InvokeDelegate(); + // + + // +private: + void Invoke_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myTextBox->BeginInvoke( gcnew InvokeDelegate( this, &MyForm::InvokeMethod ) ); + } + + void InvokeMethod() + { + myTextBox->Text = "Executed the given delegate"; + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp new file mode 100644 index 00000000000..09ce810976d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_ContextMenu_CreateGraphics/CPP/control_contextmenu_creategraphics.cpp @@ -0,0 +1,157 @@ + +// System.Windows.Forms.Control.ContextMenu +// System.Windows.Forms.Control.ContextMenuChanged +// System.Windows.Forms.Control.CreateGraphics +/* + The following program demonstrates the 'ContextMenu' property, 'ContextMenuChanged' + event handler and 'CreateGraphics' method of 'Control' class. + It displays the 'TextBox' and 'Button' controls on the form. When mouse is clicked inside + the 'TextBox' control, an instance of 'ContextMenu' is created and assigned to 'TextBox' + control by using 'ContextMenu' property. The shortcut menu pops-up when right button of + mouse is clicked inside the 'TextBox' control. When the 'Button' is clicked, an + instance of 'Graphics' class is obtained by calling 'CreateGraphics' method and draws an + ellipse inside the 'TextBox' control. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace MyApplication +{ + public ref class MyForm: public Form + { + private: + System::Windows::Forms::TextBox^ myTextBox; + System::ComponentModel::Container^ components; + System::Windows::Forms::Label^ myLabel; + System::Windows::Forms::Button^ myButton; + + public: + MyForm() + { + components = nullptr; + InitializeComponent(); + AddClickHandler(); + AddContextMenuChangedHandler(); + } + + public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->myButton = gcnew System::Windows::Forms::Button; + this->myLabel = gcnew System::Windows::Forms::Label; + this->myTextBox = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // myButton + // + this->myButton->Location = System::Drawing::Point( 48, 232 ); + this->myButton->Name = L"myButton"; + this->myButton->Size = System::Drawing::Size( 96, 23 ); + this->myButton->TabIndex = 2; + this->myButton->Text = L"CreateGraphics"; + this->myButton->Click += gcnew System::EventHandler( this, &MyForm::CreateGraphicsButton_Click ); + + // + // myLabel + // + this->myLabel->Location = System::Drawing::Point( 24, 16 ); + this->myLabel->Name = L"myLabel"; + this->myLabel->Size = System::Drawing::Size( 256, 40 ); + this->myLabel->TabIndex = 1; + this->myLabel->Text = L"Click inside the TextBox to set the ContextMenu and then" + L" click the right mouse button inside the TextBox to popup the ContextMenu."; + + // + // myTextBox + // + this->myTextBox->Location = System::Drawing::Point( 16, 80 ); + this->myTextBox->Multiline = true; + this->myTextBox->Name = L"myTextBox"; + this->myTextBox->Size = System::Drawing::Size( 240, 112 ); + this->myTextBox->TabIndex = 0; + this->myTextBox->Text = L"Welcome to .NET"; + + // + // MyForm + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^myFormControls = {this->myButton,this->myLabel,this->myTextBox}; + this->Controls->AddRange( myFormControls ); + this->Name = L"MyForm"; + this->Text = L"ContextMenu Example"; + this->ResumeLayout( false ); + } + + // + private: + void AddClickHandler() + { + this->myTextBox->Click += gcnew EventHandler( this, &MyForm::TextBox_Click ); + } + + void TextBox_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + array^myMenuItems = gcnew array(2); + myMenuItems[ 0 ] = gcnew MenuItem( L"New",gcnew EventHandler( this, &MyForm::MenuItem_New ) ); + myMenuItems[ 1 ] = gcnew MenuItem( L"Open",gcnew EventHandler( this, &MyForm::MenuItem_Open ) ); + this->myTextBox->ContextMenu = gcnew System::Windows::Forms::ContextMenu( myMenuItems ); + } + + void MenuItem_New( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( L"New MenuItem is selected from TextBox's shortcut menu." ); + } + + void MenuItem_Open( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( L"Open MenuItem is selected from TextBox's shortcut menu." ); + } + // + + // + private: + void AddContextMenuChangedHandler() + { + this->myTextBox->ContextMenuChanged += gcnew EventHandler( this, &MyForm::TextBox_ContextMenuChanged ); + } + + void TextBox_ContextMenuChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( L"Shortcut menu of TextBox is changed." ); + } + // + + void CreateGraphicsButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + Graphics^ myGraphics = myTextBox->CreateGraphics(); + myGraphics->DrawEllipse( gcnew Pen( Color::Black,3 ), 0.0F, 0.0F, 230.0F, 105.0F ); + myGraphics->FillEllipse( Brushes::Goldenrod, 0.0F, 0.0F, 230.0F, 105.0F ); + // + } + + [STAThread] + int main() + { + Application::Run( gcnew MyForm ); + return 1; + } + }; +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp new file mode 100644 index 00000000000..468b1db11e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_Font/CPP/control_font.cpp @@ -0,0 +1,92 @@ +// System::Windows::Forms::Control::Font +// System::Windows::Forms::Control::FontChanged +// System::Windows::Forms::Control::Focused +// System::Windows::Forms::Control::Focus + +/* +The following example demonstrates 'Font' & 'Focused' properties, 'Focus' +method and 'FontChanged' event of 'Control' class. +A 'DateTimePicker' control and a 'Button' control are added to a form. The font +property of 'DateTimePicker' control is changed to the font selected by user +from 'FontDialog' control. An event handler function is attached +with 'FontChanged' event of 'DateTimePicker' control which sets the focus +on 'DateTimePicker' control. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyFormControl: public Form +{ +private: + FontDialog^ myFontDialog; + DateTimePicker^ myDateTimePicker; + Button^ myButton; + +public: + MyFormControl() + { + myDateTimePicker = gcnew DateTimePicker; + myFontDialog = gcnew FontDialog; + myButton = gcnew Button; + myDateTimePicker->Location = Point( 48, 24 ); + myDateTimePicker->Name = "myDateTimePicker"; + myButton->Location = Point( 50, 150 ); + myButton->Name = "myButton"; + myButton->Size = System::Drawing::Size( 200, 40 ); + myButton->Text = "Change Font of Date Time Picker"; + myButton->Click += gcnew EventHandler( this, &MyFormControl::myButton_Click ); + ClientSize = System::Drawing::Size( 292, 273 ); + array^ formControls = {myDateTimePicker,myButton}; + Controls->AddRange( formControls ); + Text = "Control Example"; + AddEventHandler(); + } + + // +private: + void myButton_Click( Object^ sender, EventArgs^ e ) + { + FontDialog^ myFontDialog = gcnew FontDialog; + if ( myFontDialog->ShowDialog() == ::DialogResult::OK ) + { + // Set the control's font. + myDateTimePicker->Font = myFontDialog->Font; + } + } + // + + // +private: + void AddEventHandler() + { + // Add the event handler for 'FontChanged' event. + myDateTimePicker->FontChanged += gcnew EventHandler( + this, &MyFormControl::DateTimePicker_FontChanged ); + } + + void DateTimePicker_FontChanged( Object^ sender, EventArgs^ e ) + { + // + // + if ( !myDateTimePicker->Focused ) + { + // Set focus on 'DateTimePicker' control. + myDateTimePicker->Focus(); + } + // + // + } + // +}; + +int main() +{ + MyFormControl^ myForm = gcnew MyFormControl; + myForm->ShowDialog(); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp new file mode 100644 index 00000000000..9c103d16ba6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_Invoke1/CPP/control_invoke1.cpp @@ -0,0 +1,115 @@ + + +// System::Windows::Forms::Control::Invoke(Delegate*, Object[]); +/* +The following example demonstrates the 'Invoke(Delegate*, Object[])' +method of 'Control' class. +A 'ListBox' and a 'Button' control are added to a form, containing a delegate +which encapsulates a method that adds items to the listbox. This function is executed +on the thread that owns the underlying handle of the form .When user clicks on button +the above delegate is executed using 'Invoke' method. +*/ +#using +#using +#using + +// +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Threading; +ref class MyFormControl: public Form +{ +public: + delegate void AddListItem( String^ myString ); + AddListItem^ myDelegate; + +private: + Button^ myButton; + Thread^ myThread; + ListBox^ myListBox; + +public: + MyFormControl(); + void AddListItemMethod( String^ myString ); + +private: + void Button_Click( Object^ sender, EventArgs^ e ); + void ThreadFunction(); +}; + +ref class MyThreadClass +{ +private: + MyFormControl^ myFormControl1; + +public: + MyThreadClass( MyFormControl^ myForm ) + { + myFormControl1 = myForm; + } + + String^ myString; + void Run() + { + for ( int i = 1; i <= 5; i++ ) + { + myString = String::Concat( "Step number ", i, " executed" ); + Thread::Sleep( 400 ); + + // Execute the specified delegate on the thread that owns + // 'myFormControl1' control's underlying window handle with + // the specified list of arguments. + array^myStringArray = {myString}; + myFormControl1->Invoke( myFormControl1->myDelegate, myStringArray ); + + } + } + +}; + +MyFormControl::MyFormControl() +{ + myButton = gcnew Button; + myListBox = gcnew ListBox; + myButton->Location = Point(72,160); + myButton->Size = System::Drawing::Size( 152, 32 ); + myButton->TabIndex = 1; + myButton->Text = "Add items in list box"; + myButton->Click += gcnew EventHandler( this, &MyFormControl::Button_Click ); + myListBox->Location = Point(48,32); + myListBox->Name = "myListBox"; + myListBox->Size = System::Drawing::Size( 200, 95 ); + myListBox->TabIndex = 2; + ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {myListBox,myButton}; + Controls->AddRange( formControls ); + Text = " 'Control_Invoke' example "; + myDelegate = gcnew AddListItem( this, &MyFormControl::AddListItemMethod ); +} + +void MyFormControl::AddListItemMethod( String^ myString ) +{ + myListBox->Items->Add( myString ); +} + +void MyFormControl::Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) +{ + myThread = gcnew Thread( gcnew ThreadStart( this, &MyFormControl::ThreadFunction ) ); + myThread->Start(); +} + +void MyFormControl::ThreadFunction() +{ + MyThreadClass^ myThreadClassObject = gcnew MyThreadClass( this ); + myThreadClassObject->Run(); +} + +int main() +{ + MyFormControl^ myForm = gcnew MyFormControl; + myForm->ShowDialog(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp new file mode 100644 index 00000000000..d72e7ee5cc6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_Invoke2/CPP/control_invoke2.cpp @@ -0,0 +1,109 @@ +// System::Windows::Forms::Control::Invoke(Delegate*); +// +/* +The following example demonstrates the 'Invoke(Delegate*)' method of 'Control class. +A 'ListBox' and a 'Button' control are added to a form, containing a delegate +which encapsulates a method that adds items to the listbox. This function is executed +on the thread that owns the underlying handle of the form. When user clicks on button +the above delegate is executed using 'Invoke' method. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Threading; + +public ref class MyFormControl: public Form +{ +public: + delegate void AddListItem(); + AddListItem^ myDelegate; + +private: + Button^ myButton; + Thread^ myThread; + ListBox^ myListBox; + +public: + MyFormControl(); + void AddListItemMethod() + { + String^ myItem; + for ( int i = 1; i < 6; i++ ) + { + myItem = "MyListItem {0}",i; + myListBox->Items->Add( myItem ); + myListBox->Update(); + Thread::Sleep( 300 ); + } + } + +private: + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myThread = gcnew Thread( gcnew ThreadStart( this, &MyFormControl::ThreadFunction ) ); + myThread->Start(); + } + + void ThreadFunction(); +}; + + +// The following code assumes a 'ListBox' and a 'Button' control are added to a form, +// containing a delegate which encapsulates a method that adds items to the listbox. +public ref class MyThreadClass +{ +private: + MyFormControl^ myFormControl1; + +public: + MyThreadClass( MyFormControl^ myForm ) + { + myFormControl1 = myForm; + } + + void Run() + { + // Execute the specified delegate on the thread that owns + // 'myFormControl1' control's underlying window handle. + myFormControl1->Invoke( myFormControl1->myDelegate ); + } +}; + + +MyFormControl::MyFormControl() +{ + myButton = gcnew Button; + myListBox = gcnew ListBox; + myButton->Location = Point( 72, 160 ); + myButton->Size = System::Drawing::Size( 152, 32 ); + myButton->TabIndex = 1; + myButton->Text = "Add items in list box"; + myButton->Click += gcnew EventHandler( this, &MyFormControl::Button_Click ); + myListBox->Location = Point( 48, 32 ); + myListBox->Name = "myListBox"; + myListBox->Size = System::Drawing::Size( 200, 95 ); + myListBox->TabIndex = 2; + ClientSize = System::Drawing::Size( 292, 273 ); + array^ temp0 = {myListBox,myButton}; + Controls->AddRange( temp0 ); + Text = " 'Control_Invoke' example"; + myDelegate = gcnew AddListItem( this, &MyFormControl::AddListItemMethod ); +} + +void MyFormControl::ThreadFunction() +{ + MyThreadClass^ myThreadClassObject = gcnew MyThreadClass( this ); + myThreadClassObject->Run(); +} + +int main() +{ + MyFormControl^ myForm = gcnew MyFormControl; + myForm->ShowDialog(); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp new file mode 100644 index 00000000000..dcc7ebbdf6a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_Scale1/CPP/control_scale1.cpp @@ -0,0 +1,135 @@ +// System::Windows::Forms::Control::Scale(float) +// System::Windows::Forms::Control::SizeChanged + +/* +The following example demonstrates the 'Scale(float)' method +and 'SizeChanged' event of the 'Control' class. An instance of +a 'Button' control has been provided that can be scaled both +horizontally and vertically. A 'NumericUpDown' instance has been +provided that is used to provide for the horizontal and vertical +scale value. The 'Button' instance named 'OK' is used to set the +scale values for the 'Button' control instance. Whenever the size +of the control changes the event handler associated with the +'SizeChanged' event of the control is called. This event handler +displays a message box indicating that the size of the control has +changed. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + Label^ myLabel1; + NumericUpDown^ myNumericUpDown1; + Button^ myButton1; + Button^ myButton2; + System::ComponentModel::Container^ components; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + } + +public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->myLabel1 = gcnew System::Windows::Forms::Label; + this->myButton1 = gcnew System::Windows::Forms::Button; + this->myButton2 = gcnew System::Windows::Forms::Button; + this->myNumericUpDown1 = gcnew System::Windows::Forms::NumericUpDown; + (static_cast(this->myNumericUpDown1))->BeginInit(); + this->SuspendLayout(); + + // Set the properties for 'myLabel1'. + this->myLabel1->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->myLabel1->Location = System::Drawing::Point( 16, 168 ); + this->myLabel1->Name = "myLabel1"; + this->myLabel1->Size = System::Drawing::Size( 152, 24 ); + this->myLabel1->TabIndex = 1; + this->myLabel1->Text = "Scale (Horizontal & Vertical):"; + this->myLabel1->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; + + // Set the properties for 'myButton1'. + this->myButton1->Location = System::Drawing::Point( 56, 32 ); + this->myButton1->Name = "myButton1"; + this->myButton1->Size = System::Drawing::Size( 184, 80 ); + this->myButton1->TabIndex = 0; + this->myButton1->Text = "Scaleable Control"; + RegisterEventHandler(); + + // Set the properties for 'myButton2'. + this->myButton2->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->myButton2->Location = System::Drawing::Point( 48, 216 ); + this->myButton2->Name = "myButton2"; + this->myButton2->Size = System::Drawing::Size( 200, 32 ); + this->myButton2->TabIndex = 7; + this->myButton2->Text = "OK"; + this->myButton2->Click += gcnew System::EventHandler( this, &MyForm::MyButton2_Click ); + + // Set the properties for 'myNumericUpDown1'. + this->myNumericUpDown1->DecimalPlaces = 1; + this->myNumericUpDown1->Increment = System::Decimal( 0.1 ); + this->myNumericUpDown1->Location = System::Drawing::Point( 192, 168 ); + this->myNumericUpDown1->Maximum = System::Decimal( 10 ); + this->myNumericUpDown1->Minimum = System::Decimal( 0 ); + this->myNumericUpDown1->Name = "myNumericUpDown1"; + this->myNumericUpDown1->Size = System::Drawing::Size( 88, 20 ); + this->myNumericUpDown1->TabIndex = 5; + + // Set the properties for 'MyForm'. + this->ClientSize = System::Drawing::Size( 292, 261 ); + array^myFormControls = {this->myButton2,this->myNumericUpDown1,this->myLabel1,this->myButton1}; + this->Controls->AddRange( myFormControls ); + this->Name = "MyForm"; + this->Text = "MyForm"; + (static_cast(this->myNumericUpDown1))->EndInit(); + this->ResumeLayout( false ); + } + + // +private: + void RegisterEventHandler() + { + myButton1->SizeChanged += gcnew EventHandler( this, &MyForm::MyButton1_SizeChanged ); + } + + void MyButton2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Set the scale for the control to the value provided. + float scale = (float)myNumericUpDown1->Value; + myButton1->Scale( scale ); + // + } + + void MyButton1_SizeChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "The size of the 'Button' control has changed" ); + } + // +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp new file mode 100644 index 00000000000..4964763ceb7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_StyleChanged/CPP/control_stylechanged.cpp @@ -0,0 +1,98 @@ +// System::Windows::Forms::Control::StyleChanged + +/* +The following example demonstrates the 'StyleChanged' event +of 'Control' class. This example has the style of the form +set when the form is loaded. This setting of the style +raises the 'StyleChanged' event. The event handler associated +with the 'StyleChanged' event pops a message box indicating +the same. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + System::Windows::Forms::Button^ myButton1; + System::ComponentModel::Container^ components; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + } + +public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->myButton1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // Set the properties of the 'myButton1'. + this->myButton1->Location = System::Drawing::Point( 24, 8 ); + this->myButton1->Name = "myButton1"; + this->myButton1->Size = System::Drawing::Size( 192, 48 ); + this->myButton1->TabIndex = 0; + this->myButton1->Text = "button1"; + this->myButton1->Click += gcnew System::EventHandler( this, &MyForm::MyButton1_Click ); + + // Set the properties of the 'MyForm'. + this->ClientSize = System::Drawing::Size( 248, 61 ); + array^myFormControls = {this->myButton1}; + this->Controls->AddRange( myFormControls ); + this->Name = "MyForm"; + this->Text = "MyForm"; + this->Load += gcnew EventHandler( this, &MyForm::MyForm_Load ); + RegisterEventHandler(); + this->ResumeLayout( false ); + } + + void MyButton1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "The 'Control' has been clicked" ); + } + + // +private: + // Set the 'FixedHeight' and 'FixedWidth' styles to false. + void MyForm_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + this->SetStyle( ControlStyles::FixedHeight, false ); + this->SetStyle( ControlStyles::FixedWidth, false ); + } + + void RegisterEventHandler() + { + this->StyleChanged += gcnew EventHandler( this, &MyForm::MyForm_StyleChanged ); + } + + // Handle the 'StyleChanged' event for the 'Form'. + void MyForm_StyleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "The style releated to the 'Form' has been changed" ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp new file mode 100644 index 00000000000..37683520992 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Control_VisibleChanged/CPP/control_visiblechanged.cpp @@ -0,0 +1,107 @@ +// System::Windows::Forms::Control::VisibleChanged + +/* +The following program demonstrates 'VisibleChanged' event for the 'Control' class. +The 'VisibleChanged' event is raised when the 'Visible' property value of +'Label' control has changed. +*/ + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace MyControlExample +{ + public ref class MyForm: public Form + { + private: + Label^ myLabel; + Button^ myButton; + System::ComponentModel::Container^ components; + + public: + MyForm() + { + components = nullptr; + InitializeComponent(); + } + + protected: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->myLabel = gcnew Label; + this->myButton = gcnew Button; + this->SuspendLayout(); + + // + // myLabel + // + this->myLabel->Location = System::Drawing::Point( 24, 8 ); + this->myLabel->Name = "myLabel"; + this->myLabel->Size = System::Drawing::Size( 240, 40 ); + this->myLabel->Text = String::Concat( this->myLabel->Text, "Welcome to .NET." ); + + // + // myButton + // + this->myButton->Location = System::Drawing::Point( 54, 50 ); + this->myButton->Name = "myLabel"; + this->myButton->Size = System::Drawing::Size( 100, 40 ); + this->myButton->TabIndex = 0; + this->myButton->Text = "Hide Label"; + this->myButton->Click += gcnew EventHandler( this, &MyForm::Button_HideLabel ); + + // + // MyForm + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Controls->Add( this->myLabel ); + this->Controls->Add( this->myButton ); + this->Name = "MyForm"; + this->Text = "VisibleChanged example"; + this->ResumeLayout( false ); + AddVisibleChangedEventHandler(); + } + + // + private: + void Button_HideLabel( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myLabel->Visible = false; + } + + void AddVisibleChangedEventHandler() + { + myLabel->VisibleChanged += gcnew EventHandler( this, &MyForm::Label_VisibleChanged ); + } + + void Label_VisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "Visible change event raised!!!" ); + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew MyControlExample::MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp b/snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp new file mode 100644 index 00000000000..1f4fb7b0aa0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Converters/CPP/converters.cpp @@ -0,0 +1,264 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; + +namespace TypeCon +{ + ref class TypeCon_Doc + { + public: + enum class Servers + { + Windows = 1, + Exchange = 2, + BizTalk = 3 + }; + + static void Main() + { + // ArrayConverter + // + // implemented in another file + // + + //============================================================ + // BaseNumberConverter + // + // implemented in another file + // + + //============================================================ + // BooleanConverter + // This sample converts a Boolean variable to and from a string variable. + // + bool bVal(true); + String^ strA = "false"; + Console::WriteLine( TypeDescriptor::GetConverter( bVal )->ConvertTo( bVal, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( bVal )->ConvertFrom( strA ) ); + // + + //============================================================ + // ByteConverter - work + // This sample converts an 8-bit unsigned integer to and from a string. + // + Byte myUint(5); + String^ myUStr = "2"; + Console::WriteLine( TypeDescriptor::GetConverter( myUint )->ConvertTo( myUint, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myUint )->ConvertFrom( myUStr ) ); + // + + //============================================================ + // CharConverter + // This sample converts a Char variable to and from a String. + // + char chrA('a'); + String^ strB = "b"; + Console::WriteLine( TypeDescriptor::GetConverter( chrA )->ConvertTo( chrA, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( chrA )->ConvertFrom( strB ) ); + // + + //============================================================ + // CollectionConverter + // + // implemented in another file + // + + //============================================================ + // ComponentConverter + // + // implemented in another file + // + + //============================================================ + // CultureInfoConverter + // This sample converts a CultureInfo object to and from a string. + // + // The sample first constructs a CultureInfo variable using the Greek culture - 'el'. + System::Globalization::CultureInfo^ myCulture = gcnew System::Globalization::CultureInfo( "el" ); + String^ myCString = "Russian"; + Console::WriteLine( TypeDescriptor::GetConverter( myCulture )->ConvertTo( myCulture, String::typeid ) ); + // The following line will output 'ru' based on the string being converted. + Console::WriteLine( TypeDescriptor::GetConverter( myCulture )->ConvertFrom( myCString ) ); + // + + //============================================================ + // DateTimeConverter + // This sample converts a DateTime variable to and from a String. + // + DateTime dt(1990,5,6); + Console::WriteLine( TypeDescriptor::GetConverter( dt )->ConvertTo( dt, String::typeid ) ); + String^ myStr = "1991-10-10"; + Console::WriteLine( TypeDescriptor::GetConverter( dt )->ConvertFrom( myStr ) ); + // + + //============================================================ + // DecimalConverter + // + Decimal myDec(40); + String^ myDStr = "20"; + Console::WriteLine( TypeDescriptor::GetConverter( myDec )->ConvertTo( myDec, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myDec )->ConvertFrom( myDStr ) ); + // + + //============================================================ + // DoubleConverter + // + double myDoub(100.55); + String^ myDoStr = "4000.425"; + Console::WriteLine( TypeDescriptor::GetConverter( myDoub )->ConvertTo( myDoub, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myDoub )->ConvertFrom( myDoStr ) ); + // + + //============================================================ + // EnumConverter - work + // This converter can only convert an enumeration object to and from a string. + // This is declared before main() enum Servers {Windows=1, Exchange=2, BizTalk=3}; + // + // Requires public declaration of the following type. + // __value enum Servers {Windows=1, Exchange=2, BizTalk=3}; + Servers myServer = Servers::Exchange; + String^ myServerString = "BizTalk"; + Console::WriteLine( TypeDescriptor::GetConverter( myServer )->ConvertTo( myServer, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myServer )->ConvertFrom( myServerString ) ); + // + + //============================================================ + // GUIDConverter + // This converter can only convert a globally unique identifier object to and from a string. + // + Guid myGuid("B80D56EC-5899-459d-83B4-1AE0BB8418E4"); + String^ myGuidString = "1AA7F83F-C7F5-11D0-A376-00C04FC9DA04"; + Console::WriteLine( TypeDescriptor::GetConverter( myGuid )->ConvertTo( myGuid, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myGuid )->ConvertFrom( myGuidString ) ); + // + + //============================================================ + // Int16Converter + // The Int16 value type represents signed integers with values ranging from negative 32768 through positive 32767. + // This converter can only convert a 16-bit signed integer object to and from a string. + // + short myInt16( -10000); + String^ myInt16String = "+20000"; + Console::WriteLine( TypeDescriptor::GetConverter( myInt16 )->ConvertTo( myInt16, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myInt16 )->ConvertFrom( myInt16String ) ); + // + + //============================================================ + // Int32Converter + // The Int32 value type represents signed integers with values ranging from negative 2,147,483,648 through positive 2,147,483,647. + // This converter can only convert a 32-bit signed integer object to and from a string. + // + int myInt32( -967299); + String^ myInt32String = "+1345556"; + Console::WriteLine( TypeDescriptor::GetConverter( myInt32 )->ConvertTo( myInt32, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myInt32 )->ConvertFrom( myInt32String ) ); + // + + //============================================================ + // Int64Converter - work + // The Int64 value type represents integers with values ranging from negative 9,223,372,036,854,775,808 through positive 9,223,372,036,854,775,807. + // This converter can only convert a 64-bit signed integer object to and from a string. + // + long myInt64( -123456789123); + String^ myInt64String = "+184467440737095551"; + Console::WriteLine( TypeDescriptor::GetConverter( myInt64 )->ConvertTo( myInt64, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myInt64 )->ConvertFrom( myInt64String ) ); + // + + //============================================================ + // ReferenceConverter + // + // implemented in another file + // + + //============================================================ + // SByteConverter + // The SByte value type represents integers with values ranging from negative 128 to positive 127. + // This converter can convert only an 8-bit unsigned integer object to and from a string. + // + SByte mySByte( +121); + String^ mySByteStr = "-100"; + Console::WriteLine( TypeDescriptor::GetConverter( mySByte )->ConvertTo( mySByte, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( mySByte )->ConvertFrom( mySByteStr ) ); + // + + //============================================================ + // SingleConverter + // Single - ranging in value from -3.402823E+38 to -1.401298E-45 for negative values and from 1.401298E-45 to 3.402823E+38 for positive values + // This converter can only convert a single-precision, floating point number object to and from a string. + // + Single s(3.402823E+10F); + String^ mySStr = "3.402823E+10"; + Console::WriteLine( TypeDescriptor::GetConverter( s )->ConvertTo( s, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( s )->ConvertFrom( mySStr ) ); + // + + //============================================================ + // StringConverter + //cpconconvertingstringstonetframeworkdatatypes + // + //implemented in anothner file + // + + //============================================================ + // TimeSpanConverter + // This converter can only convert a TimeSpan object to and from a string. + // + TimeSpan ts(133333330); + String^ myTSStr = "5000000"; + Console::WriteLine( TypeDescriptor::GetConverter( ts )->ConvertTo( ts, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( ts )->ConvertFrom( myTSStr ) ); + // + + //============================================================ + // TypeListConverter + // + // implemented in another file + // + + //============================================================ + // UInt16Converter + // The UInt16 value type represents unsigned integers with values ranging from 0 to 65535 + // This converter can only convert a 16-bit unsigned integer object to and from a string. + // + unsigned short myUInt16(10000); + String^ myUInt16String = "20000"; + Console::WriteLine( TypeDescriptor::GetConverter( myUInt16 )->ConvertTo( myUInt16, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myUInt16 )->ConvertFrom( myUInt16String ) ); + // + + //============================================================ + // UInt32Converter + // The UInt32 value type represents unsigned integers with values ranging from 0 to 4,294,967,295. + // This converter can only convert a 32-bit unsigned integer object to and from a string. + // + unsigned int myUInt32(967299); + String^ myUInt32String = "1345556"; + Console::WriteLine( TypeDescriptor::GetConverter( myUInt32 )->ConvertTo( myUInt32, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myUInt32 )->ConvertFrom( myUInt32String ) ); + // + + //============================================================ + // UInt64Converter + // The UInt64 value type represents unsigned integers with values ranging from 0 to 184,467,440,737,095,551,615. + // This converter can only convert a 64-bit unsigned integer object to and from a string. + // + UInt64 myUInt64(123456789123); + String^ myUInt64String = "184467440737095551"; + Console::WriteLine( TypeDescriptor::GetConverter( myUInt64 )->ConvertTo( myUInt64, String::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( myUInt64 )->ConvertFrom( myUInt64String ) ); + // + + //============================================================ + // ExpandableObjectConverter + // + String^ strM = "1,2,3,4"; + System::Drawing::Printing::Margins^ m = gcnew System::Drawing::Printing::Margins( 1,2,3,4 ); + Console::WriteLine( TypeDescriptor::GetConverter( strM )->CanConvertTo( System::Drawing::Printing::Margins::typeid ) ); + Console::WriteLine( TypeDescriptor::GetConverter( m )->ConvertToString( m ) ); + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp b/snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp new file mode 100644 index 00000000000..cf49697d3d8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CountProperty/CPP/countitems.cpp @@ -0,0 +1,45 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +ref class TestForm: public Form +{ + // +public: + void InitializeMyMenu() + { + // Create the MainMenu Object*. + MainMenu^ myMainMenu = gcnew MainMenu; + + // Create the MenuItem objects. + MenuItem^ fileMenu = gcnew MenuItem( "&File" ); + MenuItem^ newFile = gcnew MenuItem( "&New" ); + MenuItem^ openFile = gcnew MenuItem( "&Open" ); + MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); + + // Add the File menu item to myMainMenu. + myMainMenu->MenuItems->Add( fileMenu ); + + // Add three submenus to the File menu. + fileMenu->MenuItems->Add( newFile ); + fileMenu->MenuItems->Add( openFile ); + fileMenu->MenuItems->Add( exitProgram ); + + // Assign myMainMenu to the form. + this->Menu = myMainMenu; + + // Count the number of objects in the File menu and display the result. + String^ objectNumber = fileMenu->MenuItems->Count.ToString(); + MessageBox::Show( "Number of objects in the File menu = " + objectNumber ); + } + // +}; + +int main() +{ + Application::Run( gcnew TestForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp b/snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp new file mode 100644 index 00000000000..f5b17f27425 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CreateParams/CPP/createparams.cpp @@ -0,0 +1,199 @@ + + +// +#include + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Runtime::InteropServices; +using namespace System::Diagnostics; +using namespace System::IO; + +public ref class MyIconButton: public Button +{ +private: + Icon^ icon; + +public: + MyIconButton() + { + + // Set the button's FlatStyle property. + FlatStyle = ::FlatStyle::System; + } + + MyIconButton( Icon^ ButtonIcon ) + { + + // Set the button's FlatStyle property. + FlatStyle = ::FlatStyle::System; + + // Assign the icon to the private field. + this->icon = ButtonIcon; + + // Size the button to 4 pixels larger than the icon. + this->Height = icon->Height + 4; + this->Width = icon->Width + 4; + } + + +protected: + + property System::Windows::Forms::CreateParams^ CreateParams + { + + // + virtual System::Windows::Forms::CreateParams^ get() override + { + + // Extend the CreateParams property of the Button class. + System::Windows::Forms::CreateParams^ cp = __super::CreateParams; + + // Update the button Style. + cp->Style |= 0x00000040; // BS_ICON value + return cp; + } + // + } + +public: + property System::Drawing::Icon^ Icon + { + System::Drawing::Icon^ get() + { + return icon; + } + void set(System::Drawing::Icon^ value) + { + icon = value; + UpdateIcon(); + this->Height = icon->Height + 4; + this->Width = icon->Width + 4; + } + } + +protected: + virtual void OnHandleCreated( EventArgs^ e ) override + { + Button::OnHandleCreated( e ); + + // Update the icon on the button if there is currently an icon assigned to the icon field. + if ( icon != nullptr ) + { + UpdateIcon(); + } + } + + +private: + void UpdateIcon() + { + IntPtr iconHandle = IntPtr::Zero; + + // Get the icon's handle. + if ( icon != nullptr ) + { + iconHandle = icon->Handle; + } + + + // Send Windows the message to update the button. + SendMessage( (HWND)Handle.ToPointer(), 0x00F7, 1, (int)iconHandle ); + + /*BM_SETIMAGE value*/ + /*IMAGE_ICON value*/ + } + + public: + [DllImport("user32.dll")] + static LRESULT SendMessage(HWND hWnd, int msg, int wParam, int lParam); + +}; + + +// +// +public ref class MyApplication: public Form +{ +private: + MyIconButton^ myIconButton; + Button^ stdButton; + OpenFileDialog^ openDlg; + +public: + MyApplication() + { + try + { + + // Create the button with the default icon. + myIconButton = gcnew MyIconButton( gcnew System::Drawing::Icon( String::Concat( Application::StartupPath, "\\Default.ico" ) ) ); + } + catch ( Exception^ ex ) + { + + // If the default icon does not exist, create the button without an icon. + myIconButton = gcnew MyIconButton; + #if defined(DEBUG) + Debug::WriteLine( ex ); + #endif + } + finally + { + stdButton = gcnew Button; + + // Add the Click event handlers. + myIconButton->Click += gcnew EventHandler( this, &MyApplication::myIconButton_Click ); + stdButton->Click += gcnew EventHandler( this, &MyApplication::stdButton_Click ); + + // Set the location, text and width of the standard button. + stdButton->Location = Point(myIconButton->Location.X,myIconButton->Location.Y + myIconButton->Height + 20); + stdButton->Text = "Change Icon"; + stdButton->Width = 100; + + // Add the buttons to the Form. + this->Controls->Add( stdButton ); + this->Controls->Add( myIconButton ); + } + + } + + +private: + void myIconButton_Click( Object^ /*Sender*/, EventArgs^ /*e*/ ) + { + +#undef MessageBox + + // Make sure MyIconButton works. + MessageBox::Show( "MyIconButton was clicked!" ); + } + + void stdButton_Click( Object^ /*Sender*/, EventArgs^ /*e*/ ) + { + + // Use an OpenFileDialog to allow the user to assign a new image to the derived button. + openDlg = gcnew OpenFileDialog; + openDlg->InitialDirectory = Application::StartupPath; + openDlg->Filter = "Icon files (*.ico)|*.ico"; + openDlg->Multiselect = false; + openDlg->ShowDialog(); + if ( !openDlg->FileName->Equals( "" ) ) + { + myIconButton->Icon = gcnew System::Drawing::Icon( openDlg->FileName ); + } + } + +}; + +int main() +{ + Application::Run( gcnew MyApplication ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp b/snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp new file mode 100644 index 00000000000..fcdb5c20b89 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CurrencyManager.List Example/CPP/list.cpp @@ -0,0 +1,68 @@ +#using +#using +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Data::SqlClient; +using namespace System::Data; + +public ref class MyGridForm: public Form +{ +private: + DataGrid^ grid; + +public: + MyGridForm() + { + grid = gcnew DataGrid; + grid->Size = this->Size; + String^ connstr = "Data Source=localhost;Initial Catalog=NORTHWIND;Integrated Security=SSPI"; + SqlDataAdapter^ custAdapter; + SqlDataAdapter^ orderAdapter; + custAdapter = gcnew SqlDataAdapter( "select * from customers",connstr ); + orderAdapter = gcnew SqlDataAdapter( "select * from orders",connstr ); + DataSet^ ds = gcnew DataSet; + custAdapter->Fill( ds, "Customers" ); + orderAdapter->Fill( ds, "Orders" ); + ds->Relations->Add( "CustOrders", ds->Tables[ "Customers" ]->Columns[ "CustomerID" ], + ds->Tables[ "Orders" ]->Columns[ "CustomerID" ] ); + Controls->Add( grid ); + grid->SetDataBinding( ds, "Customers" ); + grid->Navigate += gcnew NavigateEventHandler( this, &MyGridForm::Grid_Navigate ); + } + + // +private: + void Grid_Navigate( Object^ /*sender*/, NavigateEventArgs^ e ) + { + if ( e->Forward ) + { + DataSet^ ds = dynamic_cast(grid->DataSource); + CurrencyManager^ cm = dynamic_cast(BindingContext[ds, "Customers::CustOrders"]); + + // Cast the IList* to a DataView to set the AllowNew property. + DataView^ dv = dynamic_cast(cm->List); + dv->AllowNew = false; + } + } + // +}; + +int main() +{ + Application::Run( gcnew MyGridForm ); +} + +/* +This code produces the following output. + +$123, 456, 789, 012, 345.00 +$12, 3456, 7890, 123, 45.00 +$1234567890, 123, 45.00 +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp b/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp new file mode 100644 index 00000000000..f846363e4cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/CursorFromResource/CPP/mycursor.cpp @@ -0,0 +1,153 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; +using namespace System::Resources; + +namespace MyCursors +{ + public ref class MyCursor: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ myButton; + System::ComponentModel::Container^ components; + + public: + MyCursor() + { + components = nullptr; + InitializeComponent(); + } + + protected: + ~MyCursor() + { + if ( components != nullptr ) + { + delete components; + } + } + + // + private: + void SetCursor() + { + // Display an OpenFileDialog so the user can select a cursor. + OpenFileDialog^ openFileDialog1 = gcnew OpenFileDialog; + openFileDialog1->Filter = "Cursor Files|*.cur"; + openFileDialog1->Title = "Select a Cursor File"; + openFileDialog1->ShowDialog(); + + // If a .cur file was selected, open it. + if ( !openFileDialog1->FileName->Equals( "" ) ) + { + // Assign the cursor in the stream to the form's Cursor property. + this->Cursor = gcnew System::Windows::Forms::Cursor( openFileDialog1->OpenFile() ); + } + } + // + + // + private: + void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + /* Call the CursorFromResource method and + display the embedded cursor resource. */ + this->Cursor = CursorFromResource( MyCursors::MyCursor::typeid, "MyWaitCursor::cur" ); + } + + System::Windows::Forms::Cursor^ CursorFromResource( Type^ type, String^ resource ) + { + // Create a cursor from the resource. + try + { + return gcnew System::Windows::Forms::Cursor( type,resource ); + } + // If the cursor cannot be created, message the user. + catch ( Exception^ ex ) + { + MessageBox::Show( ex->ToString() ); + return nullptr; + } + } + // + + // + private: + void myButton_MouseEnter( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Hide the cursor when the mouse pointer enters the button. + ::Cursor::Hide(); + } + + void myButton_MouseLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Show the cursor when the mouse pointer leaves the button. + ::Cursor::Show(); + } + // + + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->myButton = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 104, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &MyCursor::button1_Click ); + this->myButton->MouseEnter += gcnew System::EventHandler( this, &MyCursor::myButton_MouseEnter ); + this->myButton->MouseLeave += gcnew System::EventHandler( this, &MyCursor::myButton_MouseLeave ); + + // + // myButton + // + this->myButton->Location = System::Drawing::Point( 40, 32 ); + this->myButton->Name = "myButton"; + this->myButton->TabIndex = 1; + this->myButton->Text = "myButton"; + this->myButton->Click += gcnew System::EventHandler( this, &MyCursor::myButton_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->myButton,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->SetCursor(); + } + }; +} +// end class +// end namespace + +[STAThread] +int main() +{ + Application::Run( gcnew MyCursors::MyCursor ); +} + +//Output: +//System::Globalization::NumberFormatInfo +//This instance is a read-only. diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp new file mode 100644 index 00000000000..8ad6a7d8749 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataFormats_CommaSeparatedValue/CPP/dataformats_dif.cpp @@ -0,0 +1,48 @@ + + +// System.Windows.Forms.DataFormats.Dif +/* +The following example demonstrates the 'Dif' field of 'DataFormats' class. +It creates a 'FileStream' object of the Temp.dif file. +It stores the object in the form of the 'Dif' +format in the 'DataObject'. Then it checks whether the data +stored in 'Dif' format is present or not. +*/ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::IO; + +int main() +{ + try + { + // + FileStream^ myFileStream = File::Open( "Temp.dif", FileMode::Open ); + + // Store the data into Dif format. + DataObject^ myDataObject = gcnew DataObject; + myDataObject->SetData( DataFormats::Dif, myFileStream ); + + // Check whether the data is stored or not in the specified format. + bool formatPresent = myDataObject->GetDataPresent( DataFormats::Dif ); + if ( formatPresent ) + { + Console::WriteLine( "The data has been stored in the Dif format is:'{0}'", formatPresent ); + } + else + { + Console::WriteLine( "The data has not been stored in the specified format" ); + } + // + } + catch ( Exception^ e ) + { + Console::WriteLine( "The Exception is:{0}", e->Message ); + } +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp new file mode 100644 index 00000000000..5cdb69c1b55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataFormats_GetFormat/CPP/dataformats_getformat.cpp @@ -0,0 +1,26 @@ + + +// System::Windows::Forms::DataFormats::GetFormat(int) +/* +The following example demonstrates the 'GetFormat(int)' method of 'DataFormats' +class. It creates a 'DataFormats' Object* using a integer into the 'GetFormat' method. +By using the 'DatFormats' Object* it displays the format name with respective the id. +*/ +#using +#using + +// +using namespace System; +using namespace System::Windows::Forms; +int main() +{ + + // Create a DataFormats::Format for the Unicode data format. + DataFormats::Format^ myFormat = DataFormats::GetFormat( 13 ); + + // Display the contents of myFormat. + Console::WriteLine( "The Format Name corresponding to the ID {0} is :", myFormat->Id ); + Console::WriteLine( myFormat->Name ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp new file mode 100644 index 00000000000..d2f936944f9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataFormats_StringFormat/CPP/dataformats_stringformat.cpp @@ -0,0 +1,46 @@ +// System::Windows::Forms::DataFormats::StringFormat + +/* +* The following example demonstrates the 'StringFormat' field of 'DataFormats' class. +* It stores a String Object^ in Clipboard using the Clipboard's 'SetDataObject' method. +* It retrieves the String Object^ stored in the Clipboard by using the GetDataObject method +* which returns the 'IDataObject^'. It checks the String^ data is available or not +* by using the 'GetDataPresent' method of 'IDataObject^'. If data is there then it +* displays the data to the console. +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Drawing::Imaging; +using namespace System::Windows::Forms; + +int main() +{ + // + try + { + String^ myString = "This is a String from the ClipBoard"; + // Sets the data to the Clipboard. + Clipboard::SetDataObject( myString ); + IDataObject^ myDataObject = Clipboard::GetDataObject(); + + // Checks whether the data is present or not in the Clipboard. + if ( myDataObject->GetDataPresent( DataFormats::StringFormat ) ) + { + String^ clipString = (String^)(myDataObject->GetData( DataFormats::StringFormat )); + Console::WriteLine( clipString ); + } + else + { + Console::WriteLine( "No String information was contained in the clipboard." ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + // +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp b/snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp new file mode 100644 index 00000000000..57deb279115 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataFormats_UnicodeText1/CPP/dataformats_unicodetext.cpp @@ -0,0 +1,57 @@ +// System::Windows::Forms::DataFormats.UnicodeText;System::Windows::Forms::Text; + +/* +* The following example demonstrates the 'UnicodeText' and 'Text' field of 'DataFormats' class. +* It stores a String Object^ in Clipboard using the Clipboard's 'SetDataObject' method. +* It retrieves the String Object^ stored in the Clipboard by using the GetDataObject method +* which returns the 'IDataObject^'. It checks whether the Unicodetext data is present +* or not by using the 'GetDataPresent' method of 'IDataObject^'. If data is there then it +* displays the data to the console. It also checks 'Text' format data is present or not. If +* the data is there it displays the data to the console. +* +*/ + +#using +#using +#using + +using namespace System; +using namespace System::Drawing::Imaging; +using namespace System::Windows::Forms; + +int main() +{ + // + // + try + { + String^ myString = "This is a String from the ClipBoard"; + + // Sets the data into the Clipboard. + Clipboard::SetDataObject( myString ); + IDataObject^ myDataObject = Clipboard::GetDataObject(); + // Checks whether the format of the data is 'UnicodeText' or not. + if ( myDataObject->GetDataPresent( DataFormats::UnicodeText ) ) + { + Console::WriteLine( "Data in 'UnicodeText' format: " + + myDataObject->GetData( DataFormats::UnicodeText ) ); + } + else + { + Console::WriteLine( "No String information was contained in the clipboard." ); + } + + // Checks whether the format of the data is 'Text' or not. + if ( myDataObject->GetDataPresent( DataFormats::Text ) ) + { + String^ clipString = (String^)(myDataObject->GetData( DataFormats::StringFormat )); + Console::WriteLine( "Data in 'Text' format: {0}", clipString ); + } + } + catch ( Exception^ e ) + { + Console::WriteLine( e->Message ); + } + // + // +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp new file mode 100644 index 00000000000..8e1f3aaa5f9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid.OnMouseDown/CPP/overridemousedown.cpp @@ -0,0 +1,133 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::ComponentModel; + +namespace DataGridSample +{ + // + public ref class MyDataGrid: public DataGrid + { + protected: + + // Override the OnMouseDown event to select the whole row + // when the user clicks anywhere on a row. + virtual void OnMouseDown( MouseEventArgs^ e ) override + { + + // Get the HitTestInfo to return the row and pass + // that value to the IsSelected property of the DataGrid. + DataGrid::HitTestInfo ^ hit = this->HitTest( e->X, e->Y ); + if ( hit->Row < 0 ) + return; + + if ( this->IsSelected( hit->Row ) ) + UnSelect( hit->Row ); + else + Select(hit->Row); + } + }; + // + + public ref class MyDataGridForm: public Form + { + private: + DataTable^ dataTable; + DataGridSample::MyDataGrid^ grid; + Button^ button1; + Label^ label1; + + public: + MyDataGridForm() + { + grid = gcnew DataGridSample::MyDataGrid; + button1 = gcnew Button; + label1 = gcnew Label; + InitForm(); + dataTable = gcnew DataTable( "name" ); + dataTable->Columns->Add( gcnew DataColumn( "First" ) ); + DataColumn^ column = gcnew DataColumn( "name" ); + dataTable->Columns->Add( column ); + dataTable->Columns->Add( gcnew DataColumn( "Second",bool::typeid ) ); + + //dataTable.Columns->Item[S"First"].ReadOnly = true; + DataSet^ First = gcnew DataSet; + First->Tables->Add( dataTable ); + grid->DataSource = First; + grid->DataMember = "name"; + AddSomeData(); + + // grid.SetDataBinding(First, S"name"); + // grid.ReadOnly = true; + // grid.DataMember = S"First"; + button1->Click += gcnew EventHandler( this, &MyDataGridForm::OnButtonClick ); + } + + private: + void OnButtonClick( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + //combo.Sorted = true; + // grid->Item[0, 0] = S"nou"; + // grid.SetDataBinding(0, S""); + //DataGridSample::SortDataGrid.Sort(grid, S"First", true); + } + + void grid_Enter( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + grid->CurrentCell = DataGridCell(2,2); + } + + void AddSomeData() + { + DataRow^ dRow; + for ( int i = 0; i < 5; i++ ) + { + dRow = dataTable->NewRow(); + dRow[ "First" ] = String::Format( "FirstName {0}", i ); + dRow[ "name" ] = String::Format( "LastName {0}", i ); + dataTable->Rows->Add( dRow ); + } + } + + void foo( Object^ /*sender*/, KeyEventArgs^ /*e*/ ) + { + Console::WriteLine( "on key down handler called" ); + } + + void InitForm() + { + this->Size = System::Drawing::Size( 700, 500 ); + button1->Location = Point(300,300); + button1->Text = "Sort the grid programatically"; + button1->Width = 200; + grid->Size = System::Drawing::Size( 350, 250 ); + grid->TabStop = true; + grid->TabIndex = 1; + button1->TabStop = true; + button1->TabIndex = 1; + label1->Width = 300; + label1->Height = 100; + label1->Top = grid->Top; + label1->Left = grid->Right + 10; + label1->Text = "The grid on this app overrides the OnMouseDown event, so that when the user clicks anywhere on the grid, the user will select the row beneath the mouse cursor"; + this->Controls->Add( label1 ); + this->StartPosition = FormStartPosition::CenterScreen; + this->Controls->Add( grid ); + this->Controls->Add( button1 ); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew DataGridSample::MyDataGridForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp new file mode 100644 index 00000000000..40e65d3ea56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn overview/CPP/boolcolumn.cpp @@ -0,0 +1,252 @@ +#using +#using +#using +#using +#using + +// +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::ComponentModel; + +public ref class DataGridBoolColumnInherit: public DataGridBoolColumn +{ +private: + SolidBrush^ trueBrush; + SolidBrush^ falseBrush; + DataColumn^ expressionColumn; + static int count = 0; + +public: + DataGridBoolColumnInherit() + : DataGridBoolColumn() + { + trueBrush = dynamic_cast(Brushes::Blue); + falseBrush = dynamic_cast(Brushes::Yellow); + expressionColumn = nullptr; + count++; + } + + property Color FalseColor + { + Color get() + { + return falseBrush->Color; + } + + void set( Color value ) + { + falseBrush = gcnew System::Drawing::SolidBrush( value ); + Invalidate(); + } + } + + property Color TrueColor + { + Color get() + { + return trueBrush->Color; + } + + void set( Color value ) + { + trueBrush = gcnew System::Drawing::SolidBrush( value ); + Invalidate(); + } + } + + property String^ Expression + { + // This will work only with a DataSet or DataTable. + // The code is not compatible with IBindingList* implementations. + String^ get() + { + return this->expressionColumn == nullptr ? String::Empty : this->expressionColumn->Expression; + } + + void set( String^ value ) + { + if ( expressionColumn == nullptr ) + AddExpressionColumn( value ); + else + expressionColumn->Expression = value; + + if ( expressionColumn != nullptr && expressionColumn->Expression->Equals( value ) ) + return; + + Invalidate(); + } + } + +private: + void AddExpressionColumn( String^ value ) + { + // Get the grid's data source. First check for a 0 + // table or data grid. + if ( this->DataGridTableStyle == nullptr || this->DataGridTableStyle->DataGrid == nullptr ) + return; + + DataGrid^ myGrid = this->DataGridTableStyle->DataGrid; + DataView^ myDataView = dynamic_cast((dynamic_cast(myGrid->BindingContext[ myGrid->DataSource,myGrid->DataMember ]))->List); + + // This works only with System::Data::DataTable. + if ( myDataView == nullptr ) + return; + + // If the user already added a column with the name + // then exit. Otherwise, add the column and set the + // expression to the value passed to this function. + DataColumn^ col = myDataView->Table->Columns[ "__Computed__Column__" ]; + if ( col != nullptr ) + return; + + col = gcnew DataColumn( String::Concat( "__Computed__Column__", count ) ); + myDataView->Table->Columns->Add( col ); + col->Expression = value; + expressionColumn = col; + } + + // the OnPaint method to paint the cell based on the expression. +protected: + virtual void Paint( Graphics^ g, Rectangle bounds, CurrencyManager^ source, int rowNum, Brush^ backBrush, Brush^ foreBrush, bool alignToRight ) override + { + bool trueExpression = false; + bool hasExpression = false; + DataRowView^ drv = dynamic_cast(source->List[ rowNum ]); + hasExpression = this->expressionColumn != nullptr && this->expressionColumn->Expression != nullptr && !this->expressionColumn->Expression->Equals( String::Empty ); + Console::WriteLine( String::Format( "hasExpressionValue {0}", hasExpression ) ); + + // Get the value from the expression column. + // For simplicity, we assume a True/False value for the + // expression column. + if ( hasExpression ) + { + Object^ expr = drv->Row[ expressionColumn->ColumnName ]; + trueExpression = expr->Equals( "True" ); + } + + // Let the DataGridBoolColumn do the painting. + if ( !hasExpression ) + DataGridBoolColumn::Paint( g, bounds, source, rowNum, backBrush, foreBrush, alignToRight ); + + // Paint using the expression color for true or false, as calculated. + if ( trueExpression ) + DataGridBoolColumn::Paint( g, bounds, source, rowNum, trueBrush, foreBrush, alignToRight ); + else + DataGridBoolColumn::Paint( g, bounds, source, rowNum, falseBrush, foreBrush, alignToRight ); + } +}; + +public ref class MyForm: public Form +{ +private: + DataTable^ myTable; + DataGrid^ myGrid; + +public: + MyForm() + { + myGrid = gcnew DataGrid; + try + { + InitializeComponent(); + myTable = gcnew DataTable( "NamesTable" ); + myTable->Columns->Add( gcnew DataColumn( "Name" ) ); + DataColumn^ column = gcnew DataColumn( "id",Int32::typeid ); + myTable->Columns->Add( column ); + myTable->Columns->Add( gcnew DataColumn( "calculatedField",bool::typeid ) ); + DataSet^ namesDataSet = gcnew DataSet; + namesDataSet->Tables->Add( myTable ); + myGrid->SetDataBinding( namesDataSet, "NamesTable" ); + AddTableStyle(); + AddData(); + } + catch ( System::Exception^ exc ) + { + Console::WriteLine( exc ); + } + } + +private: + void grid_Enter( Object^ sender, EventArgs^ e ) + { + myGrid->CurrentCell = DataGridCell(2,2); + } + + void AddTableStyle() + { + // Map a new TableStyle to the DataTable. Then + // add DataGridColumnStyle objects to the collection + // of column styles with appropriate mappings. + DataGridTableStyle^ dgt = gcnew DataGridTableStyle; + dgt->MappingName = "NamesTable"; + DataGridTextBoxColumn^ dgtbc = gcnew DataGridTextBoxColumn; + dgtbc->MappingName = "Name"; + dgtbc->HeaderText = "Name"; + dgt->GridColumnStyles->Add( dgtbc ); + dgtbc = gcnew DataGridTextBoxColumn; + dgtbc->MappingName = "id"; + dgtbc->HeaderText = "id"; + dgt->GridColumnStyles->Add( dgtbc ); + DataGridBoolColumnInherit^ db = gcnew DataGridBoolColumnInherit; + db->HeaderText = "less than 1000 = blue"; + db->Width = 150; + db->MappingName = "calculatedField"; + dgt->GridColumnStyles->Add( db ); + myGrid->TableStyles->Add( dgt ); + + // This expression instructs the grid to change + // the color of the inherited DataGridBoolColumn + // according to the value of the id field. If it's + // less than 1000, the row is blue. Otherwise, + // the color is yellow. + db->Expression = "id < 1000"; + } + + void AddData() + { + // Add data with varying numbers for the id field. + // If the number is over 1000, the cell will paint + // yellow. Otherwise, it will be blue. + DataRow^ dRow = myTable->NewRow(); + dRow[ "Name" ] = "name 1 "; + dRow[ "id" ] = 999; + myTable->Rows->Add( dRow ); + dRow = myTable->NewRow(); + dRow[ "Name" ] = "name 2"; + dRow[ "id" ] = 2300; + myTable->Rows->Add( dRow ); + dRow = myTable->NewRow(); + dRow[ "Name" ] = "name 3"; + dRow[ "id" ] = 120; + myTable->Rows->Add( dRow ); + dRow = myTable->NewRow(); + dRow[ "Name" ] = "name 4"; + dRow[ "id" ] = 4023; + myTable->Rows->Add( dRow ); + dRow = myTable->NewRow(); + dRow[ "Name" ] = "name 5"; + dRow[ "id" ] = 2345; + myTable->Rows->Add( dRow ); + myTable->AcceptChanges(); + } + + void InitializeComponent() + { + this->Size = System::Drawing::Size( 500, 500 ); + myGrid->Size = System::Drawing::Size( 350, 250 ); + myGrid->TabStop = true; + myGrid->TabIndex = 1; + this->StartPosition = FormStartPosition::CenterScreen; + this->Controls->Add( myGrid ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp new file mode 100644 index 00000000000..4ed4886d47d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridBoolColumn/CPP/datagridboolcolumn.cpp @@ -0,0 +1,284 @@ +// System::Windows::Forms::DataGridBoolColumn::TrueValueChanged +// System::Windows::Forms::DataGridBoolColumn::AllowNullChanged +// System::Windows::Forms::DataGridBoolColumn::FalseValueChanged + +/* +The following example demonstrates 'TrueValueChanged', +AllowNullChanged' and 'FalseValueChanged' events for the +'DataGridBoolColumn' class. This example had a 'DataGrid' +which is associated with three columns and a datasource +created with the 'CreateSource' method. There are three +additional combo boxes each to change the 'TrueValue', +'FalseValue' and 'AllowNull' properties of the 'DataGridBoolColumn'. +The 'TrueValue' property is used to specify the Object* that +the 'DataGridBoolColumn' presumes to be a true value. The +'FalseValue' property has the same semantics. Changing +the value of these properties raises the corresponding +events. Changing 'TrueValue' raises the 'TrueValueChanged', +changing 'FalseValue' raises the 'FalseValueChanged' and +'AllowNull' changes the 'AllowNullChanged' events respectively. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle; + System::Windows::Forms::DataGridTextBoxColumn^ myDataGridTextBoxColumn1; + System::Windows::Forms::DataGridTextBoxColumn^ myDataGridTextBoxColumn2; + System::Windows::Forms::DataGridBoolColumn^ myDataGridBoolColumn; + System::Windows::Forms::Label ^ myLabel1; + System::Windows::Forms::ComboBox^ myComboBox1; + System::Windows::Forms::Label ^ myLabel2; + System::Windows::Forms::ComboBox^ myComboBox2; + System::Windows::Forms::Label ^ myLabel3; + System::Windows::Forms::ComboBox^ myComboBox3; + System::ComponentModel::Container^ components; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + } + +public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + + ICollection^ CreateSource() + { + //Create a new 'DataTable' object. + DataTable^ myDataTable = gcnew DataTable( "TestTable" ); + DataRow^ myDataRow; + + //Associate 'DataColumns' with the 'DataTable' object. + myDataTable->Columns->Add( gcnew DataColumn( "IntegerValue",Int32::typeid ) ); + myDataTable->Columns->Add( gcnew DataColumn( "StringValue",String::typeid ) ); + myDataTable->Columns->Add( gcnew DataColumn( "CurrencyValue",double::typeid ) ); + myDataTable->Columns->Add( gcnew DataColumn( "BooleanValue",Boolean::typeid ) ); + int count = 1; + bool even = false; + + //Insert new rows into the 'DataTable' object. + for ( int i = -5; i < 5; i++ ) + { + myDataRow = myDataTable->NewRow(); + myDataRow[ 0 ] = count; + myDataRow[ 1 ] = String::Concat( "Item ", count ); + myDataRow[ 2 ] = 1.23 * (count + 1); + + // If 'even' insert a 'DBNull' into the table. + if ( even ) + { + myDataRow[ 3 ] = Convert::DBNull; + even = false; + } + else + { + if ( i < 0 ) + + // If 'negative' insert a 'false' into the table. + myDataRow[ 3 ] = (bool^)false; // If 'positive' insert a 'true' into the table. + else + myDataRow[ 3 ] = true; + even = true; + } + + myDataTable->Rows->Add( myDataRow ); + count += 1; + } + + //Create a new instance of 'DataView' from the 'DataTable' instance. + DataView^ myDataView = gcnew DataView( myDataTable ); + return myDataView; + } + +private: + void InitializeComponent() + { + System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( MyForm::typeid ); + myDataGridTableStyle = gcnew System::Windows::Forms::DataGridTableStyle; + myDataGridTextBoxColumn1 = gcnew System::Windows::Forms::DataGridTextBoxColumn; + myDataGridTextBoxColumn2 = gcnew System::Windows::Forms::DataGridTextBoxColumn; + myDataGridBoolColumn = gcnew System::Windows::Forms::DataGridBoolColumn; + myLabel1 = gcnew System::Windows::Forms::Label; + myLabel2 = gcnew System::Windows::Forms::Label; + myDataGrid = gcnew System::Windows::Forms::DataGrid; + myLabel3 = gcnew System::Windows::Forms::Label; + myComboBox3 = gcnew System::Windows::Forms::ComboBox; + myComboBox2 = gcnew System::Windows::Forms::ComboBox; + myComboBox1 = gcnew System::Windows::Forms::ComboBox; + (dynamic_cast(myDataGrid))->BeginInit(); + SuspendLayout(); + + // + // myDataGridTableStyle + // + myDataGridTableStyle->DataGrid = myDataGrid; + array^columnStyles = {myDataGridTextBoxColumn1,myDataGridTextBoxColumn2,myDataGridBoolColumn}; + myDataGridTableStyle->GridColumnStyles->AddRange( columnStyles ); + myDataGridTableStyle->MappingName = "TestTable"; + + // + // myDataGridTextBoxColumn1 + // + myDataGridTextBoxColumn1->MappingName = "IntegerValue"; + + // + // myDataGridTextBoxColumn2 + // + myDataGridTextBoxColumn2->MappingName = "StringValue"; + + // + // myDataGridBoolColumn + // + myDataGridBoolColumn->MappingName = "BooleanValue"; + myDataGridBoolColumn->TrueValue = true; + myDataGridBoolColumn->FalseValue = (bool^)false; + myDataGridBoolColumn->NullValue = Convert::DBNull; + myDataGridBoolColumn->AllowNull = true; + RegisterEventHandlers( myDataGridBoolColumn ); + + // + // myLabel1 + // + myLabel1->Location = System::Drawing::Point( 16, 232 ); + myLabel1->Size = System::Drawing::Size( 136, 24 ); + myLabel1->Text = "Change the TrueValue to:"; + + // + // myLabel2 + // + myLabel2->Location = System::Drawing::Point( 16, 264 ); + myLabel2->Size = System::Drawing::Size( 136, 24 ); + myLabel2->Text = "Change the FalseValue to:"; + + // + // myDataGrid + // + myDataGrid->Location = System::Drawing::Point( 16, 0 ); + myDataGrid->Size = System::Drawing::Size( 296, 216 ); + myDataGrid->DataSource = CreateSource(); + array^tableStyles = {myDataGridTableStyle}; + myDataGrid->TableStyles->AddRange( tableStyles ); + + // + // myLabel3 + // + myLabel3->Location = System::Drawing::Point( 16, 296 ); + myLabel3->Size = System::Drawing::Size( 136, 24 ); + myLabel3->Text = "Allow 0 values to appear:"; + + // + // myComboBox3 + // + myComboBox3->Location = System::Drawing::Point( 168, 288 ); + myComboBox3->Size = System::Drawing::Size( 144, 21 ); + array^myComboBox3Items = {true,(bool^)false}; + myComboBox3->Items->AddRange( myComboBox3Items ); + myComboBox3->SelectedIndexChanged += gcnew System::EventHandler( this, &MyForm::myComboBox3_SelectedIndexChanged ); + + // + // myComboBox2 + // + myComboBox2->Location = System::Drawing::Point( 168, 256 ); + myComboBox2->Size = System::Drawing::Size( 144, 21 ); + array^myComboBox2Items = {true,(bool^)false}; + myComboBox2->Items->AddRange( myComboBox2Items ); + myComboBox2->SelectedIndexChanged += gcnew System::EventHandler( this, &MyForm::myComboBox2_SelectedIndexChanged ); + + // + // myComboBox1 + // + myComboBox1->Location = System::Drawing::Point( 168, 224 ); + myComboBox1->Size = System::Drawing::Size( 144, 21 ); + array^myComboBox1Items = {true,(bool^)false}; + myComboBox1->Items->AddRange( myComboBox1Items ); + myComboBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &MyForm::myComboBox1_SelectedIndexChanged ); + + // + // MyForm + // + ClientSize = System::Drawing::Size( 336, 341 ); + array^formControls = {myComboBox3,myLabel3,myComboBox2,myLabel2,myComboBox1,myLabel1,myDataGrid}; + Controls->AddRange( formControls ); + Name = "MyForm"; + Text = "MyForm"; + (dynamic_cast(myDataGrid))->EndInit(); + ResumeLayout( false ); + } + + // + // + // + void RegisterEventHandlers( DataGridBoolColumn^ myDataGridBoolColumn ) + { + myDataGridBoolColumn->AllowNullChanged += gcnew System::EventHandler( this, &MyForm::myDataGridBoolColumn_AllowNullChanged ); + myDataGridBoolColumn->TrueValueChanged += gcnew System::EventHandler( this, &MyForm::myDataGridBoolColumn_TrueValueChanged ); + myDataGridBoolColumn->FalseValueChanged += gcnew System::EventHandler( this, &MyForm::myDataGridBoolColumn_FalseValueChanged ); + } + + // Event handler for event when 'TrueValue' is property changed. + void myDataGridBoolColumn_TrueValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( String::Concat( "The TrueValue property of the DataGridBoolColumn has been changed to ", myDataGridBoolColumn->TrueValue ) ); + } + + // Event handler for event when 'FalseValue' is property changed. + void myDataGridBoolColumn_FalseValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( String::Concat( "The FalseValue property of the DataGridBoolColumn has been changed to ", myDataGridBoolColumn->FalseValue ) ); + } + + // Event handler for event when 'AllowNull' is property changed. + void myDataGridBoolColumn_AllowNullChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( String::Concat( "The AllowNull property of DataGridBoolColumn has been changed to ", myDataGridBoolColumn->AllowNull ) ); + } + // + // + // + + // Change the value of 'TrueValue' property to what user specifies. + void myComboBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGridBoolColumn->TrueValue = myComboBox1->Items[ myComboBox1->SelectedIndex ]; + } + + // Change the value of 'FalseValue' property to what user specifies. + void myComboBox2_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGridBoolColumn->FalseValue = myComboBox2->Items[ myComboBox2->SelectedIndex ]; + } + + // Change the value of 'AllowNull' property to what user specifies. + void myComboBox3_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGridBoolColumn->AllowNull = *dynamic_cast(myComboBox3->Items[ myComboBox3->SelectedIndex ]); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp new file mode 100644 index 00000000000..a507f074fac --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle Overview/CPP/timecolumn.cpp @@ -0,0 +1,292 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::Security::Permissions; + +// This example shows how to create your own column style that +// hosts a control, in this case, a DateTimePicker. + +public ref class CustomDateTimePicker : public DateTimePicker +{ +protected: + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + virtual bool ProcessKeyMessage( Message% m ) override + { + // Keep all the keys for the DateTimePicker. + return ProcessKeyEventArgs( m ); + } +}; + +public ref class DataGridTimePickerColumn : public DataGridColumnStyle +{ +private: + CustomDateTimePicker^ customDateTimePicker1; + + // The isEditing field tracks whether or not the user is + // editing data with the hosted control. + bool isEditing; + +public: + DataGridTimePickerColumn() + { + customDateTimePicker1 = gcnew CustomDateTimePicker; + customDateTimePicker1->Visible = false; + } + +protected: + virtual void Abort( int /*rowNum*/ ) override + { + isEditing = false; + customDateTimePicker1->ValueChanged -= + gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); + Invalidate(); + } + + virtual bool Commit( CurrencyManager^ dataSource, int rowNum ) override + { + customDateTimePicker1->Bounds = Rectangle::Empty; + + customDateTimePicker1->ValueChanged -= + gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); + + if ( !isEditing ) + return true; + + isEditing = false; + + try + { + DateTime value = customDateTimePicker1->Value; + SetColumnValueAtRow( dataSource, rowNum, value ); + } + catch ( Exception^ ) + { + Abort( rowNum ); + return false; + } + + Invalidate(); + return true; + } + + virtual void Edit( + CurrencyManager^ source, + int rowNum, + Rectangle bounds, + bool /*readOnly*/, + String^ /*displayText*/, + bool cellIsVisible ) override + { + DateTime value = (DateTime) + GetColumnValueAtRow( source, rowNum ); + if ( cellIsVisible ) + { + customDateTimePicker1->Bounds = Rectangle( + bounds.X + 2, bounds.Y + 2, + bounds.Width - 4, bounds.Height - 4 ); + customDateTimePicker1->Value = value; + customDateTimePicker1->Visible = true; + customDateTimePicker1->ValueChanged += + gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); + } + else + { + customDateTimePicker1->Value = value; + customDateTimePicker1->Visible = false; + } + + if ( customDateTimePicker1->Visible ) + DataGridTableStyle->DataGrid->Invalidate( bounds ); + + customDateTimePicker1->Focus(); + } + + virtual System::Drawing::Size GetPreferredSize( + Graphics^ /*g*/, + Object^ /*value*/ ) override + { + return Size( 100, customDateTimePicker1->PreferredHeight + 4); + } + + virtual int GetMinimumHeight() override + { + return customDateTimePicker1->PreferredHeight + 4; + } + + virtual int GetPreferredHeight( Graphics^ /*g*/, + Object^ /*value*/ ) override + { + return customDateTimePicker1->PreferredHeight + 4; + } + + virtual void Paint( Graphics^ g, + Rectangle bounds, + CurrencyManager^ source, + int rowNum ) override + { + Paint( g, bounds, source, rowNum, false ); + } + + virtual void Paint( + Graphics^ g, + Rectangle bounds, + CurrencyManager^ source, + int rowNum, + bool alignToRight ) override + { + Paint( + g, bounds, + source, + rowNum, + Brushes::Red, + Brushes::Blue, + alignToRight ); + } + + virtual void Paint( + Graphics^ g, + Rectangle bounds, + CurrencyManager^ source, + int rowNum, + Brush^ backBrush, + Brush^ foreBrush, + bool /*alignToRight*/ ) override + { + DateTime date = (DateTime) + GetColumnValueAtRow( source, rowNum ); + Rectangle rect = bounds; + g->FillRectangle( backBrush, rect ); + rect.Offset( 0, 2 ); + rect.Height -= 2; + g->DrawString( date.ToString( "d" ), + this->DataGridTableStyle->DataGrid->Font, + foreBrush, rect ); + } + + virtual void SetDataGridInColumn( DataGrid^ value ) override + { + DataGridColumnStyle::SetDataGridInColumn( value ); + if ( customDateTimePicker1->Parent != nullptr ) + { + customDateTimePicker1->Parent->Controls->Remove + ( customDateTimePicker1 ); + } + if ( value != nullptr ) + { + value->Controls->Add( customDateTimePicker1 ); + } + } + +private: + void TimePickerValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Remove the handler to prevent it from being called twice in a row. + customDateTimePicker1->ValueChanged -= + gcnew EventHandler( this, &DataGridTimePickerColumn::TimePickerValueChanged ); + this->isEditing = true; + DataGridColumnStyle::ColumnStartedEditing( customDateTimePicker1 ); + } +}; + +public ref class MyForm: public Form +{ +private: + DataTable^ namesDataTable; + DataGrid^ grid; +public: + MyForm() + { + grid = gcnew DataGrid; + + InitForm(); + + namesDataTable = gcnew DataTable( "NamesTable" ); + namesDataTable->Columns->Add( gcnew DataColumn( "Name" ) ); + DataColumn^ dateColumn = gcnew DataColumn + ( "Date",DateTime::typeid ); + dateColumn->DefaultValue = DateTime::Today; + namesDataTable->Columns->Add( dateColumn ); + DataSet^ namesDataSet = gcnew DataSet; + namesDataSet->Tables->Add( namesDataTable ); + grid->DataSource = namesDataSet; + grid->DataMember = "NamesTable"; + AddGridStyle(); + AddData(); + } + +private: + void AddGridStyle() + { + DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle; + myGridStyle->MappingName = "NamesTable"; + DataGridTextBoxColumn^ nameColumnStyle = + gcnew DataGridTextBoxColumn; + nameColumnStyle->MappingName = "Name"; + nameColumnStyle->HeaderText = "Name"; + myGridStyle->GridColumnStyles->Add( nameColumnStyle ); + + DataGridTimePickerColumn^ timePickerColumnStyle = + gcnew DataGridTimePickerColumn; + timePickerColumnStyle->MappingName = "Date"; + timePickerColumnStyle->HeaderText = "Date"; + timePickerColumnStyle->Width = 100; + myGridStyle->GridColumnStyles->Add( timePickerColumnStyle ); + + grid->TableStyles->Add( myGridStyle ); + } + + void AddData() + { + DataRow^ dRow = namesDataTable->NewRow(); + dRow->default[ "Name" ] = "Name 1"; + dRow->default[ "Date" ] = DateTime(2001,12,01); + namesDataTable->Rows->Add( dRow ); + + dRow = namesDataTable->NewRow(); + dRow->default[ "Name" ] = "Name 2"; + dRow->default[ "Date" ] = DateTime(2001,12,04); + namesDataTable->Rows->Add( dRow ); + + dRow = namesDataTable->NewRow(); + dRow->default[ "Name" ] = "Name 3"; + dRow->default[ "Date" ] = DateTime(2001,12,29); + namesDataTable->Rows->Add( dRow ); + + dRow = namesDataTable->NewRow(); + dRow->default[ "Name" ] = "Name 4"; + dRow->default[ "Date" ] = DateTime(2001,12,13); + namesDataTable->Rows->Add( dRow ); + + dRow = namesDataTable->NewRow(); + dRow->default[ "Name" ] = "Name 5"; + dRow->default[ "Date" ] = DateTime(2001,12,21); + namesDataTable->Rows->Add( dRow ); + + namesDataTable->AcceptChanges(); + } + + void InitForm() + { + this->Size = System::Drawing::Size( 500, 500 ); + grid->Size = System::Drawing::Size( 350, 250 ); + grid->TabStop = true; + grid->TabIndex = 1; + this->StartPosition = FormStartPosition::CenterScreen; + this->Controls->Add( grid ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp new file mode 100644 index 00000000000..41d33838fdd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_AlignmentChanged/CPP/datagridcolumnstyle_alignmentchanged.cpp @@ -0,0 +1,123 @@ +// System::Windows::Forms::DataGridColumnStyle::AlignmentChanged + +/* +The following example demonstrates the 'AlignmentChanged' event of 'DataGridColumnStyle' class. +It adds a DataGrid and a button to a form. Then it creates a 'DataGridColumnStyle' Object* and +adds an eventhandler for the 'AlignmentChanged' event. When user clicks the 'Change Alignment' +button it changes the alignment of the 'DataGridColumnStyle' and the 'AlignmentChanged' event is +raised. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + Button^ myButton; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridColumnStyle^ myDataGridColumnStyle; + +public: + Form1() + { + myMessage = nullptr; + InitializeComponent(); + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + AddCustomDataTableStyle(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myButton = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->Text = "DataGrid Control Sample"; + this->ClientSize = System::Drawing::Size( 450, 330 ); + myButton->Location = Point(150,16); + myButton->Size = System::Drawing::Size( 120, 24 ); + myButton->Text = "Change Alignment"; + myButton->Click += gcnew EventHandler( this, &Form1::Button_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 300, 200 ); + myDataGrid->CaptionText = "DataGridColumnStyle"; + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + } + + String^ myMessage; + + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGridColumnStyle->Alignment = HorizontalAlignment::Center; + MessageBox::Show( myMessage ); + } + + // +private: + void AlignmentChanged_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myMessage = "Alignment has been Changed"; + } + + void AddCustomDataTableStyle() + { + // Create a 'DataGridTableStyle'. + DataGridTableStyle^ myDataTableStyle = gcnew DataGridTableStyle; + myDataTableStyle->MappingName = "Customers"; + + // Create a 'DataGridColumnStyle'. + myDataGridColumnStyle = gcnew DataGridTextBoxColumn; + myDataGridColumnStyle->MappingName = "CustName"; + myDataGridColumnStyle->HeaderText = "Customer Name"; + myDataGridColumnStyle->Width = 250; + myDataGridColumnStyle->AlignmentChanged += gcnew EventHandler( this, &Form1::AlignmentChanged_Click ); + + // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. + myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); + + // Add the 'DataGridTableStyle' to 'DataGrid'. + myDataGrid->TableStyles->Add( myDataTableStyle ); + } + // + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Customers" ); + DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); + myTable->Columns->Add( myColumn ); + myDataSet->Tables->Add( myTable ); + DataRow^ newRow1; + for ( int i = 0; i < 5; i++ ) + { + newRow1 = myTable->NewRow(); + newRow1[ "CustName" ] = i; + + // Add the row to the Customers table. + myTable->Rows->Add( newRow1 ); + } + myTable->Rows[ 0 ][ "CustName" ] = "Jones"; + myTable->Rows[ 1 ][ "CustName" ] = "James"; + myTable->Rows[ 2 ][ "CustName" ] = "David"; + myTable->Rows[ 3 ][ "CustName" ] = "Robert"; + myTable->Rows[ 4 ][ "CustName" ] = "John"; + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp new file mode 100644 index 00000000000..444c6694f65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_HeaderTextChanged/CPP/datagridcolumnstyle_headertextchanged.cpp @@ -0,0 +1,126 @@ +// System::Windows::Forms::DataGridColumnStyle:HeaderTextChanged + +/* +The following example demonstrates 'HeaderTextChanged' event of 'DataGridColumnStyle' class. +It adds a DataGrid and a Button and to a form. When user clicks on the button, it changes the'HeaderText' property +to 'Amount in $'. This raises the 'HeaderTextChanged' event which calls user defined EventHandler function and +displays a message on form. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class myDataForm: public Form +{ +private: + Button^ myButton; + Label^ myLabel; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + bool * TablesAlreadyAdded; + +public: + myDataForm() + { + InitializeComponent(); + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Orders" ); + } + +private: + void InitializeComponent() + { + Text = "HeaderTextChanged Example"; + myButton = gcnew Button; + myDataGrid = gcnew DataGrid; + ClientSize = System::Drawing::Size( 450, 330 ); + myButton->Location = Point(24,16); + myButton->Size = System::Drawing::Size( 120, 24 ); + myButton->Text = "Currency Format"; + myButton->Click += gcnew EventHandler( this, &myDataForm::myButton_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 170, 200 ); + myDataGrid->CaptionText = "DataGridColumnStyle"; + myLabel = gcnew Label; + myLabel->Location = Point(24,270); + myLabel->Width = 500; + Controls->Add( myButton ); + Controls->Add( myDataGrid ); + Controls->Add( myLabel ); + } + +private: + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( TablesAlreadyAdded ) + { + return; + } + + AddCustomDataTableStyle(); + } + + // +private: + void AddCustomDataTableStyle() + { + DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; + + // Map DataGridTableStyle to a DataTable. + myTableStyle->MappingName = "Orders"; + + // Get CurrencyManager Object*. + CurrencyManager^ myCurrencyManager = dynamic_cast(BindingContext[myDataSet, "Orders"]); + + // Use the CurrencyManager to get the PropertyDescriptor for the column. + PropertyDescriptor^ myPropertyDescriptor = myCurrencyManager->GetItemProperties()[ "Amount" ]; + + // Change the HeaderText. + DataGridColumnStyle^ myColumnStyle = gcnew DataGridTextBoxColumn( myPropertyDescriptor,"c",true ); + + // Attach a event handler function with the 'HeaderTextChanged' event. + myColumnStyle->HeaderTextChanged += gcnew EventHandler( this, &myDataForm::MyHeaderText_Changed ); + myColumnStyle->Width = 130; + myColumnStyle->HeaderText = "Amount in $"; + myTableStyle->GridColumnStyles->Add( myColumnStyle ); + myDataGrid->TableStyles->Add( myTableStyle ); + TablesAlreadyAdded = (bool *)true; + } + + void MyHeaderText_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myLabel->Text = "Header Descriptor Property of DataGridColumnStyle has changed"; + } + // + + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Orders" ); + DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); + myTable->Columns->Add( myColumn ); + myDataSet->Tables->Add( myTable ); + System::Data::DataRow^ newRow; + for ( int j = 1; j < 15; j++ ) + { + newRow = myTable->NewRow(); + newRow[ "Amount" ] = j * 10 + j * .1; + myTable->Rows->Add( newRow ); + } + } +}; + +int main() +{ + Application::Run( gcnew myDataForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp new file mode 100644 index 00000000000..ddfe02b7d37 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_MappingNameChanged/CPP/datagridcolumnstyle_mappingnamechanged.cpp @@ -0,0 +1,135 @@ +// System::Windows::Forms::DataGridColumnStyle.MappingNameChanged + +/* +* The following example demonstrates the 'MappingNameChanged' event of 'DataGridColumnStyle' class. +It adds a DataGrid and a button to a Form. When the user clicks on the 'Change Mapping Name' +button, it changes mapping name and generates 'MappingNameChanged' event. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + DataGrid^ myDataGrid; + bool * flag; + Button^ myButton; + DataSet^ myDataSet; + DataGridColumnStyle^ myColumnStyle; + +public: + MyForm() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + myDataGrid = gcnew DataGrid; + myButton = gcnew Button; + myDataGrid->Location = Point(24,24); + myDataGrid->Name = "myDataGrid"; + myDataGrid->CaptionText = "DataGridColumn"; + myDataGrid->Height = 130; + myDataGrid->Width = 150; + myDataGrid->TabIndex = 0; + myButton->Location = Point(60,208); + myButton->Name = "myButton "; + myButton->TabIndex = 3; + myButton->Size = System::Drawing::Size( 140, 20 ); + myButton->Text = "Change Mapping Name"; + myButton->Click += gcnew EventHandler( this, &MyForm::button_Click ); + ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {myButton,myDataGrid}; + Controls->AddRange( temp0 ); + Name = "Form1"; + Text = "MappingNameChanged Event"; + ResumeLayout( false ); + } + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Orders" ); + } + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Orders" ); + DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); + DataColumn^ myColumn1 = gcnew DataColumn( "Orders",Decimal::typeid ); + myTable->Columns->Add( myColumn ); + myTable->Columns->Add( myColumn1 ); + myDataSet->Tables->Add( myTable ); + DataRow^ newRow; + for ( int j = 1; j < 15; j++ ) + { + newRow = myTable->NewRow(); + newRow[ "Amount" ] = j * 10; + newRow[ "Orders" ] = 10; + myTable->Rows->Add( newRow ); + } + AddCustomColumnStyle(); + } + + // +private: + void AddCustomColumnStyle() + { + DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; + myTableStyle->MappingName = "Orders"; + myColumnStyle = gcnew DataGridTextBoxColumn; + myColumnStyle->MappingName = "Orders"; + myColumnStyle->HeaderText = "Orders"; + myTableStyle->GridColumnStyles->Add( myColumnStyle ); + myDataGrid->TableStyles->Add( myTableStyle ); + myColumnStyle->MappingNameChanged += gcnew EventHandler( this, &MyForm::columnStyle_MappingNameChanged ); + flag = (bool *)true; + } + + // MappingNameChanged event handler of DataGridColumnStyle. + void columnStyle_MappingNameChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "Mapping Name changed" ); + } + // + + void button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Change the Mapping name. + if ( flag ) + { + myColumnStyle = myDataGrid->TableStyles[ 0 ]->GridColumnStyles[ "Orders" ]; + myColumnStyle->MappingName = "Amount"; + myColumnStyle->HeaderText = "Amount"; + this->Refresh(); + flag = false; + } + else + { + myColumnStyle = myDataGrid->TableStyles[ 0 ]->GridColumnStyles[ "Amount" ]; + myColumnStyle->MappingName = "Orders"; + myColumnStyle->HeaderText = "Orders"; + this->Refresh(); + flag = (bool *)true; + } + } +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp new file mode 100644 index 00000000000..9ec399d0ad0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_NullTextChanged/CPP/datagridcolumnstyle_nulltextchanged.cpp @@ -0,0 +1,132 @@ +// System::Windows::Forms::DataGridColumnStyle::NullTextChanged + +/* +The following example demonstrates the 'NullTextChanged' event of 'DataGridColumnStyle' class. +It adds a DataGrid and a Button::to a 'Form'. When user clicks the 'Delete Column values' button, +the column becomes empty and 'NullTextChanged' event is raised which is handled by event handler +function. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + DataGrid^ myDataGrid; + Button^ myButton; + DataSet^ myDataSet; + DataGridTableStyle^ myTableStyle; + DataGridCell myCell; + DataGridColumnStyle^ myColumnStyle; + CurrencyManager^ myCurrencyManager; + +public: + int myRowcount; + MyForm() + { + InitializeComponent(); + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "CustTable" ); + myCurrencyManager = dynamic_cast(this->BindingContext[myDataSet, "CustTable"]); + } + +private: + void InitializeComponent() + { + myDataGrid = gcnew DataGrid; + myCell = DataGridCell(0,0); + myButton = gcnew Button; + myDataGrid->Location = Point(24,24); + myDataGrid->Name = "myDataGrid"; + myDataGrid->CaptionText = "DataGridColumn "; + myDataGrid->Size = System::Drawing::Size( 130, 93 ); + myButton->Location = Point(60,208); + myButton->Size = System::Drawing::Size( 130, 20 ); + myButton->Text = "Delete Column Values"; + myButton->Click += gcnew EventHandler( this, &MyForm::button_Click ); + ClientSize = System::Drawing::Size( 360, 273 ); + array^temp0 = {myButton,myDataGrid}; + Controls->AddRange( temp0 ); + Text = "NullTextChanged "; + } + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ custTable = gcnew DataTable( "CustTable" ); + DataColumn^ custName = gcnew DataColumn( "Customers" ); + custTable->Columns->Add( custName ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( custTable ); + + // Create a DataRow variable. + DataRow^ newRow1; + for ( int i = 1; i < 4; i++ ) + { + newRow1 = custTable->NewRow(); + newRow1[ "Customers" ] = i; + + // Add the row to the Customers table. + custTable->Rows->Add( newRow1 ); + + } + custTable->Rows[ 0 ][ "Customers" ] = "Alpha"; + custTable->Rows[ 1 ][ "Customers" ] = "Beta"; + custTable->Rows[ 2 ][ "Customers" ] = "Omega"; + AddCustomColumnStyle(); + } + + // +private: + void AddCustomColumnStyle() + { + myTableStyle = gcnew DataGridTableStyle; + myColumnStyle = gcnew DataGridTextBoxColumn; + myColumnStyle->NullTextChanged += gcnew EventHandler( this, &MyForm::columnStyle_NullTextChanged ); + myTableStyle->GridColumnStyles->Add( myColumnStyle ); + myDataGrid->TableStyles->Add( myTableStyle ); + } + + // NullTextChanged event handler of DataGridColumnStyle. + void columnStyle_NullTextChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + for ( int i = 0; i < myRowcount; i++ ) + { + myCell.RowNumber = i; + myDataGrid[ myCell ] = nullptr; + + } + MessageBox::Show( "NullTextChanged Event is handled" ); + } + // + + void button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myRowcount = myCurrencyManager->Count; + + // Set the column to 0 reference. + for ( int i = 0; i < myRowcount; i++ ) + { + myCell.RowNumber = i; + myDataGrid[ myCell ] = ""; + + } + myColumnStyle->NullText = nullptr; + } +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp new file mode 100644 index 00000000000..67c7742c1d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_PropertyDescriptorChanged/CPP/propertydescriptorchanged.cpp @@ -0,0 +1,128 @@ +// System::Windows::Forms::DataGridColumnStyle::PropertyDescriptorChanged + +/* The following example demonstrates 'PropertyDescriptorChanged' Event of 'DataGridColumnStyle' class. +A DataGrid and Button are added to a form. When user clicks on the button, the 'PropertyDescriptor' Format of +'DataGridColumnStyle' is changed to 'Currency' format. This raises 'PropertyDescriptorChanged' event, +which then calls user defined EventHandler function. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class myDataForm: public Form +{ +private: + Button^ myButton; + Label^ myLabel; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + bool TablesAlreadyAdded; + +public: + myDataForm() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + Text = "PropertyDescriptor Example"; + myButton = gcnew Button; + myDataGrid = gcnew DataGrid; + ClientSize = System::Drawing::Size( 450, 330 ); + myButton->Location = Point(24,16); + myButton->Size = System::Drawing::Size( 120, 24 ); + myButton->Text = "Currency Format"; + myButton->Click += gcnew EventHandler( this, &myDataForm::myButton_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 120, 200 ); + myDataGrid->CaptionText = "DataGrid Control"; + myLabel = gcnew Label; + myLabel->Location = Point(24,270); + myLabel->Width = 500; + Controls->Add( myButton ); + Controls->Add( myDataGrid ); + Controls->Add( myLabel ); + } + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Orders" ); + } + + // +private: + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( TablesAlreadyAdded ) + { + return; + } + + AddCustomDataTableStyle(); + } + + void AddCustomDataTableStyle() + { + DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; + + // Map DataGridTableStyle to a DataTable. + myTableStyle->MappingName = "Orders"; + + // Get CurrencyManager object. + CurrencyManager^ myCurrencyManager = dynamic_cast(BindingContext[myDataSet, "Orders"]); + + // Use the CurrencyManager to get the PropertyDescriptor for column. + PropertyDescriptor^ myPropertyDescriptor = myCurrencyManager->GetItemProperties()[ "Amount" ]; + + // Construct a 'DataGridColumnStyle' object changing its format to 'Currency'. + DataGridColumnStyle^ myColumnStyle = gcnew DataGridTextBoxColumn( myPropertyDescriptor,"c",true ); + + // Add EventHandler function for PropertyDescriptorChanged Event. + myColumnStyle->PropertyDescriptorChanged += gcnew System::EventHandler( this, &myDataForm::MyPropertyDescriptor_Changed ); + myTableStyle->GridColumnStyles->Add( myColumnStyle ); + + // Add the DataGridTableStyle instance to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle ); + TablesAlreadyAdded = true; + } + + void MyPropertyDescriptor_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myLabel->Text = "Property Descriptor Property of DataGridColumnStyle has changed"; + } + // + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Orders" ); + DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); + myTable->Columns->Add( myColumn ); + myDataSet->Tables->Add( myTable ); + DataRow^ newRow; + for ( int j = 1; j < 15; j++ ) + { + newRow = myTable->NewRow(); + newRow[ "Amount" ] = j * 10; + myTable->Rows->Add( newRow ); + } + } +}; + +int main() +{ + Application::Run( gcnew myDataForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp new file mode 100644 index 00000000000..b026d75f831 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ReadOnlyChanged/CPP/datagridcolumnstyle_readonlychanged.cpp @@ -0,0 +1,126 @@ +// System::Windows::Forms::DataGridColumnStyle::ReadOnlyChanged + +/* +The following example demonstrates the 'ReadOnlyChanged' event of the 'DataGridColumnStyle' class. +It adds DataGrid and Button to a form. When user clicks on button the 'ReadOnly' property of 'DataGridColumnStyle' +is changed. This raises the 'ReadOnlyChanged' event which then calls the user defined EventHandler function. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm1: public Form +{ +private: + DataGrid^ myDataGrid; + Button^ myButton; + DataSet^ myDataSet; + DataGridTableStyle^ myDataGridTableStyle; + DataGridColumnStyle^ myDataGridColumnStyle; + DataTable^ myDataTable; + DataColumn^ myDataColumn1; + +public: + MyForm1() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + myDataGrid = gcnew DataGrid; + myDataGrid->Location = Point(52,32); + myDataGrid->Size = System::Drawing::Size( 115, 125 ); + ClientSize = System::Drawing::Size( 215, 273 ); + myButton = gcnew Button; + myButton->Location = Point(35,210); + myButton->Size = System::Drawing::Size( 145, 24 ); + myButton->Text = "Make column read only"; + myButton->Click += gcnew EventHandler( this, &MyForm1::Button_Click ); + array^temp0 = {myDataGrid,myButton}; + Controls->AddRange( temp0 ); + Name = "MyForm1"; + Text = "DataGridColumnStyle"; + } + + // +private: + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myButton->Text->Equals( "Make column read/write" ) ) + { + myDataGridColumnStyle->ReadOnly = false; + myButton->Text = "Make column read only"; + } + else + { + myDataGridColumnStyle->ReadOnly = true; + myButton->Text = "Make column read/write"; + } + } + + void AddCustomDataTableStyle() + { + myDataGridTableStyle = gcnew DataGridTableStyle; + myDataGridTableStyle->MappingName = "Customers"; + myDataGridColumnStyle = gcnew DataGridTextBoxColumn; + myDataGridColumnStyle->MappingName = "CustName"; + + // Add EventHandler function for readonlychanged event. + myDataGridColumnStyle->ReadOnlyChanged += gcnew EventHandler( this, &MyForm1::myDataGridColumnStyle_ReadOnlyChanged ); + myDataGridColumnStyle->HeaderText = "Customer"; + myDataGridTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); + + // Add the 'DataGridTableStyle' instance to the 'DataGrid'. + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + } + + void myDataGridColumnStyle_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "'Readonly' property is changed" ); + } + // + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + AddCustomDataTableStyle(); + } + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + myDataTable = gcnew DataTable( "Customers" ); + myDataColumn1 = gcnew DataColumn( "CustName" ); + myDataTable->Columns->Add( myDataColumn1 ); + myDataSet->Tables->Add( myDataTable ); + DataRow^ newRow1; + for ( int i = 1; i < 4; i++ ) + { + newRow1 = myDataTable->NewRow(); + + // Add the row to the customers table. + myDataTable->Rows->Add( newRow1 ); + + } + myDataTable->Rows[ 0 ][ "custName" ] = "Alpha"; + myDataTable->Rows[ 1 ][ "custName" ] = "Beta"; + myDataTable->Rows[ 2 ][ "custName" ] = "Omega"; + } +}; + +int main() +{ + Application::Run( gcnew MyForm1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp new file mode 100644 index 00000000000..97f2049af0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_ResetHeaderText/CPP/datagridcolumnstyle_resetheadertext.cpp @@ -0,0 +1,116 @@ +// System::Windows::Forms::DataGridColumnStyle::ResetHeaderText + +/* +The following example demonstrates 'ResetHeaderText' method of 'DataGridColumnStyle' class. +A 'DataGrid' and two Buttons are added to a form. An instance of 'DataGridColumnStyle' +is mapped to column of 'DataGrid'.On clicking the set button, the Header Text is set. The +reset button resets the HeaderText to its default value. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class DataGridColumnStyle_Header: public Form +{ +private: + DataGrid^ myDataGrid; + Button^ resetButton; + Button^ setButton; + DataGridTableStyle^ myDataGridTableStyle; + DataGridColumnStyle^ myDataGridColumnStyle; + void InitializeComponent() + { + setButton = gcnew Button; + resetButton = gcnew Button; + myDataGrid = gcnew DataGrid; + setButton->Location = Point(32,208); + setButton->Size = System::Drawing::Size( 120, 23 ); + setButton->Text = "Set Header Text"; + setButton->Click += gcnew EventHandler( this, &DataGridColumnStyle_Header::SetHeaderText ); + resetButton->Location = Point(152,208); + resetButton->Size = System::Drawing::Size( 120, 23 ); + resetButton->Text = "Reset Header Text"; + resetButton->Click += gcnew EventHandler( this, &DataGridColumnStyle_Header::ResetHeaderText ); + + // Grid Initialisation. + myDataGrid->DataMember = ""; + myDataGrid->Location = Point(56,32); + myDataGrid->Name = "myDataGrid"; + myDataGrid->CaptionText = "DataGrid"; + myDataGrid->Size = System::Drawing::Size( 120, 130 ); + myDataGrid->TabIndex = 0; + ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {myDataGrid,setButton}; + Controls->AddRange( temp0 ); + Name = "DataGridColumnStyle_Width"; + Text = "Change Header Text"; + Load += gcnew System::EventHandler( this, &DataGridColumnStyle_Header::DataGridColumnStyle_Reset_Header ); + } + +public: + DataGridColumnStyle_Header() + { + myDataGridTableStyle = gcnew DataGridTableStyle; + myDataGridColumnStyle = gcnew DataGridTextBoxColumn; + InitializeComponent(); + CreateDataSet(); + } + +private: + void CreateDataSet() + { + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myEmpTable = gcnew DataTable( "Employee" ); + DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); + myEmpTable->Columns->Add( myEmpID ); + myDataSet->Tables->Add( myEmpTable ); + DataRow^ newRow1; + for ( int i = 1; i < 6; i++ ) + { + newRow1 = myEmpTable->NewRow(); + newRow1[ "EmpID" ] = i; + myEmpTable->Rows->Add( newRow1 ); + + } + myDataGrid->SetDataBinding( myDataSet, "Employee" ); + } + + void DataGridColumnStyle_Reset_Header( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGridTableStyle->MappingName = "Employee"; + myDataGridColumnStyle->MappingName = "EmpID"; + myDataGridColumnStyle->Width = 50; + myDataGridTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + } + + // +private: + void SetHeaderText( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Set the HeaderText property. + myDataGridColumnStyle->HeaderText = "Emp ID"; + myDataGrid->Invalidate(); + } + + void ResetHeaderText( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Reset the HeaderText property to its default value. + myDataGridColumnStyle->ResetHeaderText(); + myDataGrid->Invalidate(); + } + // +}; + +int main() +{ + Application::Run( gcnew DataGridColumnStyle_Header ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp new file mode 100644 index 00000000000..907ead0a352 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridColumnStyle_WidthChanged/CPP/datagridcolumnstyle_widthchanged.cpp @@ -0,0 +1,229 @@ +// System::Windows::Forms::DataGridColumnStyle::WidthChanged + +/* +The following example demonstrates the 'WidthChanged' event of +the 'DataGridColumnStyle' class. In the example a message will be +displayed whenever the width of the 'Customer ID' column of the +data grid is changed. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ myButtonNone; + Button^ myButtonSolid; + Label^ myLabel; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + SetUp(); + } + +public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + try + { + // Create a Label. + myLabel = gcnew Label; + myLabel->Text = "Change width of 'Customer ID' column to see 'WidthChanged' event message."; + myLabel->Location = Point(0,0); + myLabel->Size = System::Drawing::Size( 400, 20 ); + myLabel->ForeColor = Color::Blue; + + // Create the first button. + myButtonNone = gcnew Button; + myButtonNone->Location = Point(24,21); + myButtonNone->Size = System::Drawing::Size( 150, 24 ); + myButtonNone->Text = "Apply 'None' Line Style "; + myButtonNone->Click += gcnew EventHandler( this, &MyForm::OnNoneButtonClick ); + + // Create the second button. + myButtonSolid = gcnew Button; + myButtonSolid->Location = Point(180,21); + myButtonSolid->Size = System::Drawing::Size( 150, 24 ); + myButtonSolid->Text = "Apply 'Solid' Line Style "; + myButtonSolid->Click += gcnew EventHandler( this, &MyForm::OnSolidButtonClick ); + Text = "DataGridColumnStyle Sample"; + ClientSize = System::Drawing::Size( 400, 300 ); + + // Create a data grid. + myDataGrid = gcnew DataGrid; + myDataGrid->Location = Point(24,55); + myDataGrid->Size = System::Drawing::Size( 345, 200 ); + myDataGrid->CaptionText = "Microsoft DataGrid Control"; + + // Create a data grid table style. + DataGridTableStyle^ myDataGridTableStyle = gcnew DataGridTableStyle; + myDataGridTableStyle->MappingName = "Customers"; + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + + // + // Add the 'Customer ID' column style. + DataGridColumnStyle^ myIDCol = gcnew DataGridTextBoxColumn; + myIDCol->MappingName = "custID"; + myIDCol->HeaderText = "Customer ID"; + myIDCol->Width = 100; + myIDCol->WidthChanged += gcnew EventHandler( this, &MyForm::MyIDColumnWidthChanged ); + myDataGridTableStyle->GridColumnStyles->Add( myIDCol ); + // + + // Add the 'Customer Name' column style. + DataGridColumnStyle^ myNameCol = gcnew DataGridTextBoxColumn; + myNameCol->MappingName = "custName"; + myNameCol->HeaderText = "Customer Name"; + myNameCol->Width = 150; + myDataGridTableStyle->GridColumnStyles->Add( myNameCol ); + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + + // Add the controls. + Controls->Add( myLabel ); + Controls->Add( myButtonNone ); + Controls->Add( myButtonSolid ); + Controls->Add( myDataGrid ); + } + catch ( Exception^ exc ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", exc->Source ); + Console::WriteLine( "Message : {0}", exc->Message ); + } + } + + void SetUp() + { + try + { + // Create a DataSet with one table. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + catch ( Exception^ exc ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", exc->Source ); + Console::WriteLine( "Message : {0}", exc->Message ); + } + } + + void MakeDataSet() + { + try + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ myCustTable = gcnew DataTable( "Customers" ); + + // Create two columns and add them to the table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + myCustTable->Columns->Add( cCustID ); + myCustTable->Columns->Add( cCustName ); + myDataSet->Tables->Add( myCustTable ); + DataRow^ newRow1; + for ( int i = 1; i < 4; i++ ) + { + newRow1 = myCustTable->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + myCustTable->Rows->Add( newRow1 ); + } + myCustTable->Rows[ 0 ][ "custName" ] = "Alpha"; + myCustTable->Rows[ 1 ][ "custName" ] = "Beta"; + myCustTable->Rows[ 2 ][ "custName" ] = "Omega"; + } + catch ( Exception^ exc ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", exc->Source ); + Console::WriteLine( "Message : {0}", exc->Message ); + } + } + +private: + void MyIDColumnWidthChanged( Object^ /*obj*/, EventArgs^ /*e*/ ) + { + try + { + // Get the changed width of the 'Customer ID' column and display. + DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ "Customers" ]; + int myWidth = myTableStyle->GridColumnStyles[ "custID" ]->Width; + MessageBox::Show( String::Concat( "Width of 'Customer ID' column is changed to : ", myWidth, " pixels" ) ); + } + catch ( Exception^ exc ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", exc->Source ); + Console::WriteLine( "Message : {0}", exc->Message ); + } + } + + void OnNoneButtonClick( Object^ /*obj*/, EventArgs^ /*e*/ ) + { + try + { + DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ "Customers" ]; + myTableStyle->GridLineStyle = DataGridLineStyle::None; + } + catch ( Exception^ exc ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", exc->Source ); + Console::WriteLine( "Message : {0}", exc->Message ); + } + } + + void OnSolidButtonClick( Object^ /*obj*/, EventArgs^ /*e*/ ) + { + try + { + DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ "Customers" ]; + myTableStyle->GridLineStyle = DataGridLineStyle::Solid; + } + catch ( Exception^ exc ) + { + Console::WriteLine( "Exception caught!!!" ); + Console::WriteLine( "Source : {0}", exc->Source ); + Console::WriteLine( "Message : {0}", exc->Message ); + } + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp new file mode 100644 index 00000000000..01178401e7f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTable.MappingName Example/CPP/bindarray.cpp @@ -0,0 +1,284 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace BindToArrayGrid +{ + /// + /// Summary description for Form1. + /// + public ref class BindToArrayGridForm : public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ bindedDataGrid; + /// + /// Required designer variable. + /// + + System::ComponentModel::Container^ components; + + public: + BindToArrayGridForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + components = nullptr; + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected: + ~BindToArrayGridForm() + { + if (components) + { + delete components; + } + } + +#pragma region^ Windows Form^ Designer generated^ code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private: + void InitializeComponent() + { + this->bindedDataGrid = gcnew System::Windows::Forms::DataGrid(); + ((System::ComponentModel::ISupportInitialize^) + (this->bindedDataGrid))->BeginInit(); + this->SuspendLayout(); + // + // bindedDataGrid + // + this->bindedDataGrid->DataMember = ""; + this->bindedDataGrid->HeaderForeColor = + System::Drawing::SystemColors::ControlText; + this->bindedDataGrid->Location = System::Drawing::Point(24, 48); + this->bindedDataGrid->Name = "bindedDataGrid"; + this->bindedDataGrid->Size = System::Drawing::Size(240, 200); + this->bindedDataGrid->TabIndex = 0; + // + // BindToArrayGridForm + // + this->ClientSize = System::Drawing::Size(292, 266); + this->Controls->Add(this->bindedDataGrid); + this->Name = "BindToArrayGridForm"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( + this,&BindToArrayGridForm::Form1_Load); + ((System::ComponentModel::ISupportInitialize^) + (this->bindedDataGrid))->EndInit(); + this->ResumeLayout(false); + } +#pragma endregion + + private: + void Form1_Load(Object^ sender, System::EventArgs^ e) + { + BindToArray(); + } + + // + + void BindToArray() + { + // Create an array of Machine objects (defined below). + array^ Machines = gcnew array(3); + Machine^ tempMachine; + + tempMachine = gcnew Machine(); + tempMachine->Model = "AAA"; + tempMachine->Id = "A100"; + tempMachine->Price = Convert::ToDecimal(3.80); + Machines[0] = tempMachine; + + // The first Machine includes an array of Part objects. + Part^ p1 = gcnew Part(); + p1->PartId = "PartX"; + Part^ p2 = gcnew Part(); + p2->PartId = "PartY"; + + // Note that the Machines.Parts property returns an ArrayList. + // Add the parts to the ArrayList using the AddRange method. + tempMachine->Parts->AddRange(gcnew array {p1, p2}); + + tempMachine = gcnew Machine(); + tempMachine->Model = "BBB"; + tempMachine->Id = "B100"; + tempMachine->Price = Convert::ToDecimal(1.52); + Machines[1] = tempMachine; + + tempMachine = gcnew Machine(); + tempMachine->Id = "CCC"; + tempMachine->Model = "B100"; + tempMachine->Price = Convert::ToDecimal(2.14); + Machines[2] = tempMachine; + + bindedDataGrid->SetDataBinding(Machines, ""); + CreateTableStyle(); + } + + void CreateTableStyle() + { + // Creates two DataGridTableStyle objects, one for the Machine + // array, and one for the Parts ArrayList. + + DataGridTableStyle^ machineTable = gcnew DataGridTableStyle(); + // Sets the MappingName to the class name plus brackets. + machineTable->MappingName = "Machine[]"; + + // Sets the AlternatingBackColor so you can see the difference. + machineTable->AlternatingBackColor = + System::Drawing::Color::LightBlue; + + // Creates three column styles. + DataGridTextBoxColumn^ modelColumn = gcnew DataGridTextBoxColumn(); + modelColumn->MappingName = "Model"; + modelColumn->HeaderText = "Model"; + + DataGridTextBoxColumn^ idColumn = gcnew DataGridTextBoxColumn(); + idColumn->MappingName = "Id"; + idColumn->HeaderText = "Id"; + + DataGridTextBoxColumn^ priceColumn = gcnew DataGridTextBoxColumn(); + priceColumn->MappingName = "Price"; + priceColumn->HeaderText = "Price"; + priceColumn->Format = "c"; + + // Adds the column styles to the grid table style. + machineTable->GridColumnStyles->Add(modelColumn); + machineTable->GridColumnStyles->Add(idColumn); + machineTable->GridColumnStyles->Add(priceColumn); + + // Add the table style to the collection, but clear the + // collection first. + bindedDataGrid->TableStyles->Clear(); + bindedDataGrid->TableStyles->Add(machineTable); + + // Create another table style, one for the related data. + DataGridTableStyle^ partsTable = gcnew DataGridTableStyle(); + // Set the MappingName to an ArrayList. Note that you need not + // include brackets. + partsTable->MappingName = "ArrayList"; + DataGridTextBoxColumn^ partIdColumn = + gcnew DataGridTextBoxColumn(); + partIdColumn->MappingName = "PartID"; + partIdColumn->HeaderText = "Part ID"; + partsTable->GridColumnStyles->Add(partIdColumn); + bindedDataGrid->TableStyles->Add(partsTable); + } + + private: + ref class Machine + { + private: + String^ machineModel; + String^ machineID; + Decimal machinePrice; + + // Use an ArrayList to create a related collection. + ArrayList^ machineParts; + + public: + Machine() + { + machineParts = gcnew ArrayList; + } + + property String^ Model + { + String^ get() + { + return machineModel; + } + void set(String^ value) + { + machineModel = value; + } + } + + property String^ Id + { + String^ get() + { + return machineID; + } + void set(String^ value) + { + machineID = value; + } + } + + property ArrayList^ Parts + { + ArrayList^ get() + { + return machineParts; + } + void set(ArrayList^ value) + { + machineParts = value; + } + } + + property Decimal Price + { + Decimal get() + { + return machinePrice; + } + void set(Decimal value) + { + machinePrice = value; + } + } + }; + + private: + ref class Part + { + private: + String^ partId; + + public: + property String^ PartId + { + String^ get() + { + return partId; + } + void set(String^ value) + { + partId = value; + } + } + }; + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run(gcnew BindToArrayGrid::BindToArrayGridForm()); +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp new file mode 100644 index 00000000000..830fc6482ca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ForeColor/CPP/datagridtablestyle_forecolor.cpp @@ -0,0 +1,190 @@ +// System::Windows::Forms::DataGridTableStyle::ForeColor + +/* +The following program demonstrates the property 'ForeColor' of class 'DataGridTableStyle'. +A table with 2 columns is created and attached to grid. A listbox allows selection of forecolors +for the grid. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace Datagrid +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ dataGrid1; + System::Windows::Forms::ComboBox^ myComboBox; + System::Windows::Forms::Button^ button2; + + // Declare objects of DataSet, DataGrid, DataTable. + DataSet^ myDataSet; + + public: + DataTable^ myCustomerTable; + DataGridTableStyle^ myTableStyle; + + private: + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + InitializeComponent(); + } + + protected: + + // Clean up resources. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->myComboBox = gcnew System::Windows::Forms::ComboBox; + this->dataGrid1 = gcnew System::Windows::Forms::DataGrid; + this->button2 = gcnew System::Windows::Forms::Button; + (dynamic_cast(this->dataGrid1))->BeginInit(); + this->SuspendLayout(); + + // + // myComboBox + // + this->myComboBox->DropDownWidth = 136; + array^temp0 = {"Green","Red","Violet"}; + this->myComboBox->Items->AddRange( temp0 ); + this->myComboBox->Location = System::Drawing::Point( 64, 160 ); + this->myComboBox->Name = "myComboBox"; + this->myComboBox->Size = System::Drawing::Size( 136, 21 ); + this->myComboBox->TabIndex = 3; + this->myComboBox->DropDownStyle = ComboBoxStyle::DropDownList; + + // + // dataGrid1 + // + this->dataGrid1->CaptionText = "DataGrid"; + this->dataGrid1->DataMember = ""; + this->dataGrid1->Location = System::Drawing::Point( 56, 48 ); + this->dataGrid1->Name = "dataGrid1"; + this->dataGrid1->Size = System::Drawing::Size( 272, 80 ); + this->dataGrid1->TabIndex = 0; + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 232, 160 ); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 96, 32 ); + this->button2->TabIndex = 4; + this->button2->Text = "Change ForeGround"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::OnForeColor_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 536, 301 ); + array^formControls = {this->button2,this->myComboBox,this->dataGrid1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + (dynamic_cast(this->dataGrid1))->EndInit(); + this->ResumeLayout( false ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myComboBox->SelectedIndex = 0; + Create_Table(); + } + + // + private: + void Create_Table() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create DataTable. + DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add to the table. + DataColumn^ CustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ CustName = gcnew DataColumn( "CustName" ); + myCustomerTable->Columns->Add( CustID ); + myCustomerTable->Columns->Add( CustName ); + DataRow^ newRow1; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 3; i++ ) + { + newRow1 = myCustomerTable->NewRow(); + newRow1[ "custID" ] = i; + + // Add row to the Customers table. + myCustomerTable->Rows->Add( newRow1 ); + } + myCustomerTable->Rows[ 0 ][ "custName" ] = "Alpha"; + myCustomerTable->Rows[ 1 ][ "custName" ] = "Beta"; + + // Add table to DataSet. + myDataSet->Tables->Add( myCustomerTable ); + dataGrid1->SetDataBinding( myDataSet, "Customers" ); + myTableStyle = gcnew DataGridTableStyle; + myTableStyle->MappingName = "Customers"; + myTableStyle->ForeColor = Color::DarkMagenta; + dataGrid1->TableStyles->Add( myTableStyle ); + } + + // Set table's forecolor. + void OnForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + dataGrid1->TableStyles->Clear(); + String^ str = dynamic_cast(myComboBox->SelectedItem); + if ( str->Equals( "Green" ) ) + myTableStyle->ForeColor = Color::Green; + else + if ( str->Equals( "Red" ) ) + myTableStyle->ForeColor = Color::Red; + else + if ( str->Equals( "Violet" ) ) + myTableStyle->ForeColor = Color::Violet; + + dataGrid1->TableStyles->Add( myTableStyle ); + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Datagrid::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp new file mode 100644 index 00000000000..038f73d0035 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Header_4/CPP/datagridtablestyle_header_4.cpp @@ -0,0 +1,241 @@ +// System::Windows::Forms::DataGridTableStyle.HeaderForeColorChanged;System::Windows::Forms::DataGridTableStyle::HeaderForeColor +// System::Windows::Forms::DataGridTableStyle.HeaderBackColorChanged;System::Windows::Forms::DataGridTableStyle::HeaderBackColor + +/* +The following program demonstrates the usage of the 'HeaderBackColor' and +'HeaderForeColor' properties and the 'HeaderBackColorChanged' and 'HeaderForeColorChanged' events. +A table is created and added to a datagrid with two coloumns. The table allows to change +Header's background and foreground colors through selection of combobox values. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace Datagrid +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ dataGrid1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::ComboBox^ comboBox1; + System::Windows::Forms::ComboBox^ comboBox2; + System::Windows::Forms::Button^ button2; + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + InitializeComponent(); + } + + public: + + // Clean up resources. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->comboBox1 = gcnew System::Windows::Forms::ComboBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->dataGrid1 = gcnew System::Windows::Forms::DataGrid; + this->comboBox2 = gcnew System::Windows::Forms::ComboBox; + this->button2 = gcnew System::Windows::Forms::Button; + (dynamic_cast(this->dataGrid1))->BeginInit(); + this->SuspendLayout(); + + // + // comboBox1 + // + this->comboBox1->DropDownWidth = 136; + array^temp0 = {"Blue","Red","Yellow"}; + this->comboBox1->Items->AddRange( temp0 ); + this->comboBox1->Location = System::Drawing::Point( 56, 144 ); + this->comboBox1->Name = "comboBox1"; + this->comboBox1->Size = System::Drawing::Size( 136, 21 ); + this->comboBox1->Sorted = true; + this->comboBox1->TabIndex = 2; + this->comboBox1->DropDownStyle = ComboBoxStyle::DropDownList; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 232, 144 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 96, 32 ); + this->button1->TabIndex = 1; + this->button1->Text = "Change Header Background"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::OnHeaderBackColor_Click ); + + // + // dataGrid1 + // + this->dataGrid1->CaptionText = "DataGrid"; + this->dataGrid1->DataMember = ""; + this->dataGrid1->Location = System::Drawing::Point( 56, 48 ); + this->dataGrid1->Name = "dataGrid1"; + this->dataGrid1->Size = System::Drawing::Size( 272, 80 ); + this->dataGrid1->TabIndex = 0; + + // + // comboBox2 + // + this->comboBox2->DropDownWidth = 136; + array^temp1 = {"Green","White","Violet"}; + this->comboBox2->Items->AddRange( temp1 ); + this->comboBox2->Location = System::Drawing::Point( 56, 192 ); + this->comboBox2->Name = "comboBox2"; + this->comboBox2->Size = System::Drawing::Size( 136, 21 ); + this->comboBox2->TabIndex = 3; + this->comboBox2->DropDownStyle = ComboBoxStyle::DropDownList; + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 232, 184 ); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 96, 32 ); + this->button2->TabIndex = 4; + this->button2->Text = "Change Header ForeGround"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::OnHeaderForeColor_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 536, 301 ); + array^formControls = {this->button2,this->comboBox2,this->comboBox1,this->button1,this->dataGrid1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + (dynamic_cast(this->dataGrid1))->EndInit(); + this->ResumeLayout( false ); + } + + // Declare objects of DataSet, DataGrid, DataTable. + DataSet^ myDataSet; + + public: + DataTable^ myCustomerTable; + DataGridTableStyle^ myTableStyle; + + private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + comboBox1->SelectedIndex = 0; + comboBox2->SelectedIndex = 0; + Create_Table(); + } + + // + // + // + // + private: + void Create_Table() + { + // Create DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create DataTable. + DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the table. + DataColumn^ CustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ CustName = gcnew DataColumn( "CustName" ); + myCustomerTable->Columns->Add( CustID ); + myCustomerTable->Columns->Add( CustName ); + + // Add table to DataSet. + myDataSet->Tables->Add( myCustomerTable ); + dataGrid1->SetDataBinding( myDataSet, "Customers" ); + myTableStyle = gcnew DataGridTableStyle; + myTableStyle->MappingName = "Customers"; + myTableStyle->HeaderBackColorChanged += gcnew System::EventHandler( this, &Form1::HeaderBackColorChangedHandler ); + myTableStyle->HeaderForeColorChanged += gcnew System::EventHandler( this, &Form1::HeaderForeColorChangedHandler ); + } + + // Change header background color. + void OnHeaderBackColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + dataGrid1->TableStyles->Clear(); + String^ str = dynamic_cast(comboBox1->SelectedItem); + if ( str->Equals( "Red" ) ) + myTableStyle->ForeColor = Color::Red; + else + if ( str->Equals( "Yellow" ) ) + myTableStyle->ForeColor = Color::Yellow; + else + if ( str->Equals( "Blue" ) ) + myTableStyle->ForeColor = Color::Blue; + + myTableStyle->AlternatingBackColor = Color::LightGray; + dataGrid1->TableStyles->Add( myTableStyle ); + } + // + + void HeaderBackColorChangedHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( String::Concat( "Changed Header Background color to : ", comboBox1->SelectedItem ), "Success", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + // + + // Change header forecolor. + void OnHeaderForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + dataGrid1->TableStyles->Clear(); + String^ str = dynamic_cast(comboBox1->SelectedItem); + if ( str->Equals( "Green" ) ) + myTableStyle->ForeColor = Color::Green; + else + if ( str->Equals( "White" ) ) + myTableStyle->ForeColor = Color::White; + else + if ( str->Equals( "Violet" ) ) + myTableStyle->ForeColor = Color::Violet; + + myTableStyle->AlternatingBackColor = Color::LightGray; + dataGrid1->TableStyles->Add( myTableStyle ); + } + // + + void HeaderForeColorChangedHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( String::Concat( "Changed Header Fore color to : ", comboBox2->SelectedItem ), "Success", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Datagrid::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp new file mode 100644 index 00000000000..d2f324d18d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredColumnWidth/CPP/datagridtablestyle_preferredcolumnwidth.cpp @@ -0,0 +1,220 @@ +// System::Windows::Forms::DataGridTableStyle::PreferredColumnWidth + +/* +The following example demonstrates the property 'PreferredColumnWidth' +of 'DataGridTableStyle' class. + +It creates a 'Button' a 'TextBox' and 'DataGrid', attaches an employee table to +DataGrid and applies 'DataGridTableStyle' to it. +Event Handler has been attached to handle 'PreferredColumnWidthChanged' event. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace DataGridTableStyle_PreferredColumnWidthChanged +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ myButton; + System::Windows::Forms::TextBox^ myColWidth; + System::Windows::Forms::Label ^ myLabel; + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle; + System::ComponentModel::Container^ components; + + public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->myButton = gcnew System::Windows::Forms::Button; + this->myLabel = gcnew System::Windows::Forms::Label; + this->myColWidth = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // myButton + // + this->myButton->Location = System::Drawing::Point( 136, 304 ); + this->myButton->Name = "myButton"; + this->myButton->TabIndex = 1; + this->myButton->Text = "Apply"; + this->myButton->Click += gcnew System::EventHandler( this, &Form1::myButton_Click ); + + // + // myLabel + // + this->myLabel->Location = System::Drawing::Point( 96, 264 ); + this->myLabel->Name = "myLabel"; + this->myLabel->Size = System::Drawing::Size( 80, 16 ); + this->myLabel->TabIndex = 3; + this->myLabel->Text = "Column width: "; + + // + // myColWidth + // + this->myColWidth->Location = System::Drawing::Point( 184, 264 ); + this->myColWidth->Name = "myColWidth"; + this->myColWidth->TabIndex = 2; + this->myColWidth->Text = ""; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 400, 397 ); + array^formControls = {this->myLabel,this->myColWidth,this->myButton}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + public: + Form1() + { + components = nullptr; + myDataGrid = gcnew DataGrid; + myDataGridTableStyle = gcnew DataGridTableStyle; + InitializeComponent(); + } + + // + private: + void CreateAndBindDataSet( DataGrid^ myDataGrid ) + { + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myEmpTable = gcnew DataTable( "Employee" ); + + // Create two columns, and add them to employee table. + DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); + DataColumn^ myEmpName = gcnew DataColumn( "EmpName" ); + myEmpTable->Columns->Add( myEmpID ); + myEmpTable->Columns->Add( myEmpName ); + + // Add table to DataSet. + myDataSet->Tables->Add( myEmpTable ); + + // Populate table. + DataRow^ newRow1; + + // Create employee records in employee Table. + for ( int i = 1; i < 6; i++ ) + { + newRow1 = myEmpTable->NewRow(); + newRow1[ "EmpID" ] = i; + + // Add row to Employee table. + myEmpTable->Rows->Add( newRow1 ); + } + myEmpTable->Rows[ 0 ][ "EmpName" ] = "Alpha"; + myEmpTable->Rows[ 1 ][ "EmpName" ] = "Beta"; + myEmpTable->Rows[ 2 ][ "EmpName" ] = "Omega"; + myEmpTable->Rows[ 3 ][ "EmpName" ] = "Gamma"; + myEmpTable->Rows[ 4 ][ "EmpName" ] = "Delta"; + + // Bind DataGrid to DataSet. + myDataGrid->SetDataBinding( myDataSet, "Employee" ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Set and Display myDataGrid. + myDataGrid->DataMember = ""; + myDataGrid->Location = System::Drawing::Point( 72, 32 ); + myDataGrid->Name = "myDataGrid"; + myDataGrid->Size = System::Drawing::Size( 240, 200 ); + myDataGrid->TabIndex = 4; + + // Add it to controls. + Controls->Add( myDataGrid ); + CreateAndBindDataSet( myDataGrid ); + myDataGridTableStyle->MappingName = "Employee"; + + // Set other properties. + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + + // Add DataGridTableStyle instances to GridTableStylesCollection. + myDataGridTableStyle->PreferredColumnWidth = 100; + myColWidth->Text = ""; + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + myDataGridTableStyle->PreferredColumnWidthChanged += gcnew EventHandler( this, &Form1::MyDelegatePreferredColWidthChanged ); + } + + private: + void MyDelegatePreferredColWidthChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "Preferred Column width has changed" ); + } + + private: + void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + try + { + if ( !myColWidth->Text->Equals( "" ) ) + { + Int32 newwidth = myDataGridTableStyle->PreferredColumnWidth; + myDataGridTableStyle->PreferredColumnWidth = Int32::Parse( myColWidth->Text ); + + // Dispose datagrid and datagridtablestyle and then create. + delete myDataGrid; + delete myDataGridTableStyle; + myDataGrid = gcnew DataGrid; + myDataGridTableStyle = gcnew DataGridTableStyle; + myDataGrid->DataMember = ""; + myDataGrid->Location = System::Drawing::Point( 72, 32 ); + myDataGrid->Name = "myDataGrid"; + myDataGrid->Size = System::Drawing::Size( 240, 200 ); + myDataGrid->TabIndex = 4; + Controls->Add( myDataGrid ); + CreateAndBindDataSet( myDataGrid ); + myDataGridTableStyle->MappingName = "Employee"; + + // Set other properties. + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + + // Add DataGridTableStyle instances to GridTableStylesCollection. + myDataGridTableStyle->PreferredColumnWidth = newwidth; + myColWidth->Text = ""; + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + myDataGridTableStyle->PreferredColumnWidthChanged += gcnew EventHandler( this, &Form1::MyDelegatePreferredColWidthChanged ); + } + else + { + MessageBox::Show( "Please enter a number" ); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew DataGridTableStyle_PreferredColumnWidthChanged::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp new file mode 100644 index 00000000000..58df3b44e42 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeight/CPP/datagridtablestyle_preferredrowheight.cpp @@ -0,0 +1,141 @@ +// System::Windows::Forms::DataGridTableStyle::PreferredRowHeight + +/* +The following example demonstrates 'PreferredRowHeight' property of 'DataGridTableStyle' +class. It adds a DataGrid, Button and a TextBox to a form. It changes the +'PreferredRowHeight' property by taking the value entered in the textbox. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class myDataForm: public Form +{ +private: + Button^ myButton; + TextBox^ myTextBox; + Label^ myLabel; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridTableStyle^ myTableStyle; + +public: + myDataForm() + { + // Required for Windows Form Designer support. + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + myButton = gcnew Button; + myDataGrid = gcnew DataGrid; + ClientSize = System::Drawing::Size( 450, 330 ); + myButton->Location = Point(100,16); + myButton->Size = System::Drawing::Size( 200, 24 ); + myButton->Text = "Change Row Height"; + myButton->Click += gcnew EventHandler( this, &myDataForm::myButton_Click ); + myTextBox = gcnew TextBox; + myTextBox->Location = Point(24,16); + myTextBox->Size = System::Drawing::Size( 40, 24 ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 120, 200 ); + myDataGrid->CaptionText = "DataGridTableStyle Example"; + myLabel = gcnew Label; + myLabel->Location = Point(24,270); + myLabel->Width = 500; + Controls->Add( myButton ); + Controls->Add( myTextBox ); + Controls->Add( myDataGrid ); + Controls->Add( myLabel ); + Text = "PreferredRowHeight example"; + } + + void SetUp() + { + // Create a DataSet with a table. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Orders" ); + + // Create the DataGridTableStyle. + myTableStyle = gcnew DataGridTableStyle; + + // Map DataGridTableStyle to a DataTable. + myTableStyle->MappingName = "Orders"; + } + +private: + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myTextBox->Text->Trim()->Equals( "" ) ) + { + MessageBox::Show( "Enter the height between 18 and 134" ); + return; + } + + try + { + // + int myPreferredRowHeight = Convert::ToInt32( myTextBox->Text->Trim() ); + if ( myPreferredRowHeight < 18 || myPreferredRowHeight > 134 ) + { + MessageBox::Show( "Enter the height between 18 and 134" ); + return; + } + + // Set the 'PreferredRowHeight' property of DataGridTableStyle instance. + myTableStyle->PreferredRowHeight = myPreferredRowHeight; + + // Add the DataGridTableStyle instance to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle ); + // + } + catch ( Exception^ ex ) + { + MessageBox::Show( String::Concat( ex->Message, "Enter Integer only ." ) ); + } + } + + // Create a DataSet with a table and populate it. +private: + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Orders" ); + DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); + myTable->Columns->Add( myColumn ); + + // Add the table to the DataSet. + myDataSet->Tables->Add( myTable ); + DataRow^ newRow; + for ( int j = 1; j < 15; j++ ) + { + newRow = myTable->NewRow(); + newRow[ "Amount" ] = j * 10; + + // Add the row to the Orders table. + myTable->Rows->Add( newRow ); + } + } +}; + +int main() +{ + Application::Run( gcnew myDataForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp new file mode 100644 index 00000000000..a6b6a43cd68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_PreferredRowHeightChanged/CPP/preferredrowheightchanged.cpp @@ -0,0 +1,152 @@ +// System::Windows::Forms::DataGridTableStyle::PreferredRowHeightChanged + +/* +The following example demonstrates 'PreferredRowHeightChanged' Event of 'DataGridTableStyle' class. +A DataGrid, Button and TextBox are added to a form. The 'PreferredRowHeight' property of 'DataGridTableStyle' +class is set to the value entered by user in the textbox. When user clicks the set button, +it raises 'PreferredRowHeightChanged' Event which calls user defined EventHandler function. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyDataForm: public Form +{ +private: + Button^ myButton; + TextBox^ myTextBox; + Label^ myLabel; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridTableStyle^ myTableStyle; + +public: + MyDataForm() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + myButton = gcnew Button; + myDataGrid = gcnew DataGrid; + ClientSize = System::Drawing::Size( 450, 330 ); + myButton->Location = Point(70,16); + myButton->Size = System::Drawing::Size( 200, 24 ); + myButton->Text = "Set Row Height(in pixels)"; + myButton->Click += gcnew EventHandler( this, &MyDataForm::myButton_Click ); + myTextBox = gcnew TextBox; + myTextBox->Location = Point(24,16); + myTextBox->Size = System::Drawing::Size( 40, 24 ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 120, 200 ); + myDataGrid->CaptionText = "DataGrid Control"; + myLabel = gcnew Label; + myLabel->Location = Point(24,270); + myLabel->Width = 500; + Controls->Add( myButton ); + Controls->Add( myTextBox ); + Controls->Add( myDataGrid ); + Controls->Add( myLabel ); + Text = "PreferredRowHeightChanged example"; + } + + // + void SetUp() + { + // Create a DataSet with a table. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Orders" ); + myTableStyle = gcnew DataGridTableStyle; + + // Map 'DataGridTableStyle' instance to the DataTable. + myTableStyle->MappingName = "Orders"; + + // Add EventHandler function for 'PreferredRowHeightChanged' Event. + myTableStyle->PreferredRowHeightChanged += gcnew EventHandler( this, &MyDataForm::RowHeight_Changed ); + } + + // Called when the PreferredRowHeight property of myTableStyle is modified + void RowHeight_Changed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "PreferredRowHeight property is changed" ); + } + // + +private: + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + if ( myTextBox->Text->Trim()->Equals( "" ) ) + { + MessageBox::Show( "Enter the height between 18 and 134" ); + return; + } + int myPreferredRowHeight = Convert::ToInt32( myTextBox->Text->Trim() ); + if ( myPreferredRowHeight < 18 || myPreferredRowHeight > 134 ) + { + MessageBox::Show( "Enter the height between 18 and 134" ); + return; + } + + // Set the 'PrefferedRowHeight' property of DataGridTableStyle instance. + myTableStyle->PreferredRowHeight = myPreferredRowHeight; + + // Add the DataGridTableStyle instance to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle ); + } + catch ( Exception^ ex ) + { + + // Handle raised Exception. + if ( ex != nullptr ) + { + MessageBox::Show( "Please enter a numeric value between 18 and 134" ); + myTextBox->Text = " "; + bool val = myTextBox->Focus(); + } + } + } + + // Create a DataSet with a table and populate it. +private: + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Orders" ); + DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); + myTable->Columns->Add( myColumn ); + + // Add the table to the DataSet. + myDataSet->Tables->Add( myTable ); + DataRow^ newRow; + for ( int j = 1; j < 15; j++ ) + { + newRow = myTable->NewRow(); + newRow[ "Amount" ] = j * 10; + + // Add the row to the Orders table. + myTable->Rows->Add( newRow ); + } + } +}; + +int main() +{ + Application::Run( gcnew MyDataForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp new file mode 100644 index 00000000000..365abb6d041 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ReadOnlyChanged/CPP/datagridtablestyle_readonlychanged.cpp @@ -0,0 +1,133 @@ +// System::Windows::Forms::DataGridTableStyle::ReadOnlyChanged + +/* +The following example demonstrates the 'ReadOnlyChanged' event of 'DataGridTableStyle' class. +It adds a DataGrid and checkbox to a Form. When the Check box is checked, the 'ReadOnly' property of +'DataGridTableStyle' is changed. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + DataSet^ myDataSet1; + CheckBox^ myCheckBox1; + DataGrid^ myDataGrid1; + DataGridTableStyle^ myDataGridTableStyle; + +public: + Form1() + { + InitializeComponent(); + MakeDataSet(); + AddTableStyle(); + } + +private: + void InitializeComponent() + { + myDataGrid1 = gcnew DataGrid; + myCheckBox1 = gcnew CheckBox; + SuspendLayout(); + myDataGrid1->DataMember = ""; + myDataGrid1->Location = Point(72,64); + myDataGrid1->Name = "myDataGrid1"; + myDataGrid1->Size = System::Drawing::Size( 208, 128 ); + myDataGrid1->TabIndex = 0; + myCheckBox1->Location = Point(304,112); + myCheckBox1->Name = "myCheckBox1"; + myCheckBox1->TabIndex = 1; + myCheckBox1->Text = "Read Only"; + myCheckBox1->CheckedChanged += gcnew EventHandler( this, &Form1::myCheckBox1_CheckedChanged ); + ClientSize = System::Drawing::Size( 472, 273 ); + array^temp0 = {myCheckBox1,myDataGrid1}; + Controls->AddRange( temp0 ); + Name = "Form1"; + Text = "Test \'ReadOnleChanged\' Event of \'DataGridTableStyle\' class"; + ResumeLayout( false ); + } + + // Create a DataSet with a table and populate it. + void MakeDataSet() + { + myDataSet1 = gcnew DataSet( "myDataSet" ); + DataTable^ customerTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ myColumn = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ myColumn1 = gcnew DataColumn( "CustName" ); + customerTable->Columns->Add( myColumn ); + customerTable->Columns->Add( myColumn1 ); + + // Add the tables to the DataSet. + myDataSet1->Tables->Add( customerTable ); + + // Create three customers in the Customers Table. + DataRow^ newRow1; + for ( int i = 1; i < 4; i++ ) + { + newRow1 = customerTable->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + customerTable->Rows->Add( newRow1 ); + } + customerTable->Rows[ 0 ][ "CustName" ] = "Alpha"; + customerTable->Rows[ 1 ][ "CustName" ] = "Beta"; + customerTable->Rows[ 2 ][ "CustName" ] = "Omega"; + + // Add Unique Key constraint to the CustID column. + UniqueConstraint^ idKeyRestraint = gcnew UniqueConstraint( myColumn ); + customerTable->Constraints->Add( idKeyRestraint ); + myDataSet1->EnforceConstraints = true; + } + + // +protected: + void AddTableStyle() + { + + // Create a new DataGridTableStyle. + myDataGridTableStyle = gcnew DataGridTableStyle; + myDataGridTableStyle->MappingName = myDataSet1->Tables[ 0 ]->TableName; + myDataGrid1->DataSource = myDataSet1->Tables[ 0 ]; + myDataGridTableStyle->ReadOnlyChanged += gcnew EventHandler( this, &Form1::MyReadOnlyChangedEventHandler ); + myDataGrid1->TableStyles->Add( myDataGridTableStyle ); + } + +private: + // Handle the 'ReadOnlyChanged' event. + void MyReadOnlyChangedEventHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "ReadOnly property is changed" ); + } + + // Handle the check box's CheckedChanged event + void myCheckBox1_CheckedChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGridTableStyle->ReadOnly ) + { + myDataGridTableStyle->ReadOnly = false; + } + else + { + myDataGridTableStyle->ReadOnly = true; + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp new file mode 100644 index 00000000000..c31419cf0ce --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetAlternatingBackcolor/CPP/resetalternatingbackcolor.cpp @@ -0,0 +1,117 @@ +// System::Windows::Forms::DataGridTableStyle::ResetAlternatingBackColor + +/* +The following example demonstrates the 'ResetAlternatingBackColor' method of 'DataGridTableStyle' class. +It adds a 'DataGrid' and two buttons to a form. The instance of 'DataGridTableStyle' is mapped +to a table of DataGrid. One button sets the Alternating background color of 'DataGrid' and other resets +it to its default value. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class DataGridTableStyle_resetcolor: public Form +{ +private: + DataGridTableStyle^ myDataGridTableStyle; + DataGrid^ myDataGrid; + Button^ myButton1; + Button^ myButton2; + void InitializeComponent() + { + myButton1 = gcnew Button; + myButton2 = gcnew Button; + myDataGrid = gcnew DataGrid; + myButton1->Location = Point(56,184); + myButton1->Size = System::Drawing::Size( 176, 24 ); + myButton1->Text = "Alternating back color "; + myButton1->Click += gcnew EventHandler( this, &DataGridTableStyle_resetcolor::myButton1_Click ); + myButton2->Location = Point(56,224); + myButton2->Size = System::Drawing::Size( 184, 24 ); + myButton2->Text = "Reset"; + myButton2->Click += gcnew EventHandler( this, &DataGridTableStyle_resetcolor::myButton2_Click ); + myDataGrid->LinkColor = SystemColors::Desktop; + myDataGrid->Location = Point(56,32); + myDataGrid->Name = "myDataGrid"; + myDataGrid->Size = System::Drawing::Size( 168, 144 ); + myDataGrid->TabIndex = 1; + ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {myButton2,myDataGrid,myButton1}; + Controls->AddRange( temp0 ); + Text = "Test DataGridTableStyle::ResetAlternatingBackColor method"; + Load += gcnew EventHandler( this, &DataGridTableStyle_resetcolor::DataGridTableStyle_Reset_color ); + } + +public: + DataGridTableStyle_resetcolor() + { + myDataGridTableStyle = gcnew DataGridTableStyle; + InitializeComponent(); + + // Create and bind DataSet to DataGrid. + CreateDataSet(); + } + +private: + void CreateDataSet() + { + // Create a DataSet + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ myEmpTable = gcnew DataTable( "Employee" ); + DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); + myEmpTable->Columns->Add( myEmpID ); + + // Add the table to the DataSet. + myDataSet->Tables->Add( myEmpTable ); + DataRow^ newRow1; + for ( int i = 1; i < 6; i++ ) + { + newRow1 = myEmpTable->NewRow(); + newRow1[ "EmpID" ] = i; + + // Add the row to the Employee table. + myEmpTable->Rows->Add( newRow1 ); + } + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Employee" ); + } + + void DataGridTableStyle_Reset_color( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGridTableStyle->MappingName = "Employee"; + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + } + + // +private: + void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + //Set the 'AlternatingBackColor'. + myDataGridTableStyle->AlternatingBackColor = Color::Blue; + } + + void myButton2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the 'AlternatingBackColor'. + myDataGridTableStyle->ResetAlternatingBackColor(); + } + // +}; + +int main() +{ + Application::Run( gcnew DataGridTableStyle_resetcolor ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp new file mode 100644 index 00000000000..62d9182e74e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetBackColor/CPP/datagridtablestyle_resetbackcolor.cpp @@ -0,0 +1,123 @@ +// System::Windows::Forms::DataGridTableStyle::ResetBackColor + +/* +The following example demonstrates the 'ResetBackColor' method of 'DataGridTableStyle' class. +A DataGrid and a button are added to 'Form'. The initial back color of the DataGridTableStyle is set to +pink. When the user clicks on 'ResetBackColor' button, then the value of DataGridBackColor is set to its +default value. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + DataGrid^ myDataGrid; + Button^ myButton1; + DataSet^ myDataSet; + DataGridTableStyle^ myTableStyle; + DataGridColumnStyle^ myColumnStyle; + +public: + MyForm() + { + InitializeComponent(); + + // Create a DataSet with a table. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "customerTable" ); + AddCustomColumnStyle(); + } + +private: + + // Initialilze form and its controls. + void InitializeComponent() + { + myDataGrid = gcnew DataGrid; + myTableStyle = gcnew DataGridTableStyle; + myColumnStyle = gcnew DataGridTextBoxColumn; + myButton1 = gcnew Button; + myDataGrid->Location = Point(24,24); + myDataGrid->Name = "myDataGrid"; + myDataGrid->CaptionText = "DataGridColumn "; + myDataGrid->Size = System::Drawing::Size( 150, 153 ); + myDataGrid->TabIndex = 0; + myButton1->Location = Point(16,184); + myButton1->Name = "myButton1"; + myButton1->Size = System::Drawing::Size( 112, 23 ); + myButton1->TabIndex = 1; + myButton1->Text = "Reset BackColor"; + myButton1->Click += gcnew EventHandler( this, &MyForm::myButton1_Click ); + ClientSize = System::Drawing::Size( 360, 273 ); + array^temp0 = {myButton1,myDataGrid}; + Controls->AddRange( temp0 ); + Name = "Form1"; + Text = "Reset BackColor"; + ResumeLayout( false ); + } + + // +private: + void AddCustomColumnStyle() + { + // Set the TableStyle Mapping name. + myTableStyle->MappingName = "customerTable"; + myTableStyle->BackColor = Color::Pink; + + // Set the ColumnStyle properties and add to TableStyle. + myColumnStyle->MappingName = "Customers"; + myColumnStyle->HeaderText = "Customer Name"; + myColumnStyle->Width = 250; + myTableStyle->GridColumnStyles->Add( myColumnStyle ); + myDataGrid->TableStyles->Add( myTableStyle ); + } + + void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the background color. + myTableStyle->ResetBackColor(); + } + // + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ customerTable = gcnew DataTable( "customerTable" ); + DataColumn^ customerName = gcnew DataColumn( "Customers" ); + customerTable->Columns->Add( customerName ); + myDataSet->Tables->Add( customerTable ); + DataRow^ newRow1; + for ( int i = 1; i < 6; i++ ) + { + newRow1 = customerTable->NewRow(); + newRow1[ "Customers" ] = i; + + // Add the row to the Customers table. + customerTable->Rows->Add( newRow1 ); + + } + customerTable->Rows[ 0 ][ "Customers" ] = "Alpha"; + customerTable->Rows[ 1 ][ "Customers" ] = "Beta"; + customerTable->Rows[ 2 ][ "Customers" ] = "Omega"; + customerTable->Rows[ 3 ][ "Customers" ] = "Cust1"; + customerTable->Rows[ 4 ][ "Customers" ] = "Cust2"; + } +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp new file mode 100644 index 00000000000..23aa5980326 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetForeColor/CPP/datagridtablestyle_resetforecolor.cpp @@ -0,0 +1,144 @@ +// System::Windows::Forms::DataGridTableStyle::ResetForeColor + +/* +The following example demonstrates 'ResetForeColor' method of 'DataGridTableStyle' class. +A DataGrid and two Buttons are added to the form. A 'DataGridTableStyle' instance is mapped to table of +'DataGrid'. When the user clicks on 'Set ForeColor' button foreground color is set to blue. When +'Reset ForeColor' button is clicked foreground color is reset to its default value. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace MyDataGridColumnStyle +{ + public ref class MyForm1: public Form + { + private: + DataGrid^ myDataGrid; + Button^ btnSetForeColor; + Button^ btnResetForeColor; + DataSet^ myDataSet; + DataGridTableStyle^ myDataGridTableStyle; + DataTable^ myDataTable; + DataColumn^ myDataColumn1; + + public: + MyForm1() + { + InitializeComponent(); + + // Call 'SetUp' method to bind the controls. + SetUp(); + } + + private: + void InitializeComponent() + { + btnResetForeColor = gcnew Button; + btnSetForeColor = gcnew Button; + myDataGrid = gcnew DataGrid; + + // Initialize Buttons. + btnSetForeColor->Location = Point(35,290); + btnSetForeColor->Name = "btnSetForeColor"; + btnSetForeColor->Size = System::Drawing::Size( 110, 30 ); + btnSetForeColor->TabIndex = 1; + btnSetForeColor->Text = "Set ForeColor"; + btnSetForeColor->Click += gcnew EventHandler( this, &MyForm1::BtnSetForeColor_Click ); + btnResetForeColor->Location = Point(155,290); + btnResetForeColor->Name = "btnResetForeColor"; + btnResetForeColor->Size = System::Drawing::Size( 110, 30 ); + btnResetForeColor->TabIndex = 2; + btnResetForeColor->Text = "Reset ForeColor"; + btnResetForeColor->Click += gcnew EventHandler( this, &MyForm1::BtnResetForeColor_Click ); + + // Initialize DataGrid. + myDataGrid->DataMember = ""; + myDataGrid->Location = Point(48,72); + myDataGrid->Name = "myDataGrid"; + myDataGrid->Size = System::Drawing::Size( 200, 200 ); + myDataGrid->TabIndex = 0; + ClientSize = System::Drawing::Size( 296, 389 ); + + // Add the Buttons and the DataGrid to the Window. + Controls->Add( myDataGrid ); + Controls->Add( btnSetForeColor ); + Controls->Add( btnResetForeColor ); + Name = "MyForm1"; + Text = "MyForm1"; + (dynamic_cast(myDataGrid))->EndInit(); + ResumeLayout( false ); + } + + + // + private: + void BtnSetForeColor_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Set the foreground color of table. + myDataGridTableStyle->ForeColor = Color::Blue; + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + } + + void BtnResetForeColor_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the foreground color of table to its default value. + myDataGridTableStyle->ResetForeColor(); + } + // + + void AddCustomDataTableStyle() + { + myDataGridTableStyle = gcnew DataGridTableStyle; + myDataGridTableStyle->MappingName = "Customers"; + } + + void SetUp() + { + MakeDataSet(); + + // Bind the datagrid to the dataset. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + AddCustomDataTableStyle(); + } + + void MakeDataSet() + { + + // Create dataset. + myDataSet = gcnew DataSet( "myDataSet" ); + myDataTable = gcnew DataTable( "Customers" ); + myDataColumn1 = gcnew DataColumn( "CustName" ); + myDataTable->Columns->Add( myDataColumn1 ); + + // Add table to dataset. + myDataSet->Tables->Add( myDataTable ); + DataRow^ newRow1; + for ( int i = 1; i < 4; i++ ) + { + newRow1 = myDataTable->NewRow(); + + // Add the row to the customers table. + myDataTable->Rows->Add( newRow1 ); + + } + myDataTable->Rows[ 0 ][ "custName" ] = "Alpha"; + myDataTable->Rows[ 1 ][ "custName" ] = "Beta"; + myDataTable->Rows[ 2 ][ "custName" ] = "Omega"; + } + }; +} + +int main() +{ + Application::Run( gcnew MyDataGridColumnStyle::MyForm1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp new file mode 100644 index 00000000000..8edbbd58353 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetGridLineColor/CPP/datagridtablestyle_resetgridlinecolor.cpp @@ -0,0 +1,132 @@ +// System::Windows::Forms::DataGridTableStyle::ResetGridLineColor + +/* +The following example demonstrates the 'ResetGridLineColor' method of 'DataGridTableStyle' class. +It adds a 'DataGrid' and two buttons to a form. Then it creates a 'DataGridTableStyle' and adds it to the 'DataGrid'. +When the user clicks, the 'Change the GridLineColor' button it changes the GridLineColor to 'blue'. If the user clicks +the 'Reset GridLineColor' button it changes the GridLineColor to default color. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + Button^ myButton; + Button^ myButton1; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridColumnStyle^ myDataGridColumnStyle; + DataGridTableStyle^ myDataTableStyle; + +public: + Form1() + { + InitializeComponent(); + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + AddCustomDataTableStyle(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myButton = gcnew Button; + this->myButton1 = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->Text = "DataGridTableStyle Sample"; + this->ClientSize = System::Drawing::Size( 450, 330 ); + this->myButton->Location = Point(50,16); + this->myButton->Name = "button1"; + this->myButton->Size = System::Drawing::Size( 176, 23 ); + this->myButton->TabIndex = 2; + this->myButton->Text = "Change the GridLineColor"; + this->myButton->Click += gcnew EventHandler( this, &Form1::Button_Click ); + this->myButton1->Location = Point(230,16); + this->myButton1->Name = "myButton"; + this->myButton1->Size = System::Drawing::Size( 140, 24 ); + this->myButton1->TabIndex = 0; + this->myButton1->Text = "Reset GridLineColor"; + this->myButton1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 240, 150 ); + myDataGrid->CaptionText = "DataGridTableStyle"; + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + this->Controls->Add( myButton1 ); + } + + // +private: + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Change the 'GridLineColor'. + myDataTableStyle->GridLineColor = Color::Blue; + } + + void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the 'GridLineColor' to its orginal color. + myDataTableStyle->ResetGridLineColor(); + } + // + +private: + void AddCustomDataTableStyle() + { + // Create a 'DataGridTableStyle'. + myDataTableStyle = gcnew DataGridTableStyle; + myDataTableStyle->MappingName = "Customers"; + + // Create a 'DataGridColumnStyle'. + myDataGridColumnStyle = gcnew DataGridTextBoxColumn; + myDataGridColumnStyle->MappingName = "CustName"; + myDataGridColumnStyle->HeaderText = "Customer Name"; + myDataGridColumnStyle->Width = 150; + + // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. + myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); + + // Add the 'DataGridTableStyle' to 'DataGrid'. + myDataGrid->TableStyles->Add( myDataTableStyle ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Customers" ); + DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); + myTable->Columns->Add( myColumn ); + myDataSet->Tables->Add( myTable ); + DataRow^ newRow1; + for ( int i = 0; i < 5; i++ ) + { + newRow1 = myTable->NewRow(); + newRow1[ "CustName" ] = i; + myTable->Rows->Add( newRow1 ); + + } + myTable->Rows[ 0 ][ "CustName" ] = "Jones"; + myTable->Rows[ 1 ][ "CustName" ] = "James"; + myTable->Rows[ 2 ][ "CustName" ] = "David"; + myTable->Rows[ 3 ][ "CustName" ] = "Robert"; + myTable->Rows[ 4 ][ "CustName" ] = "John"; + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp new file mode 100644 index 00000000000..52bca764b53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderBackColor/CPP/datagridtablestyle_resetheaderbackcolor.cpp @@ -0,0 +1,133 @@ +// System::Windows::Forms::DataGridTableStyle.ResetHeaderBackColor + +/* +The following example demonstrates the 'ResetHeaderBackColor' method of 'DataGridTableStyle' class. +It adds a 'DataGrid' and two buttons to a form. Then it creates a 'DataGridTableStyle' and maps it to the table of +'DataGrid'. When the user clicks on 'Change the ResetHeaderBackColor' button it changes the Header Background +color to light pink. If the user clicks the 'ResetHeaderBackColor' button it changes the Header Background +Color to default color. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + Button^ myButton; + Button^ myButton1; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridColumnStyle^ myDataGridColumnStyle; + DataGridTableStyle^ myDataTableStyle; + +public: + Form1() + { + InitializeComponent(); + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + AddCustomDataTableStyle(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + myButton = gcnew Button; + myButton1 = gcnew Button; + myDataGrid = gcnew DataGrid; + Text = "DataGridTableStyle Sample"; + ClientSize = System::Drawing::Size( 450, 330 ); + myButton->Location = Point(50,16); + myButton->Name = "button1"; + myButton->Size = System::Drawing::Size( 176, 23 ); + myButton->TabIndex = 2; + myButton->Text = "Change the HeaderBackColor"; + myButton->Click += gcnew EventHandler( this, &Form1::Button_Click ); + myButton1->Location = Point(230,16); + myButton1->Name = "myButton"; + myButton1->Size = System::Drawing::Size( 140, 24 ); + myButton1->TabIndex = 0; + myButton1->Text = "Reset HeaderBackColor"; + myButton1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 240, 150 ); + myDataGrid->CaptionText = "DataGridTableStyle"; + Controls->Add( myButton ); + Controls->Add( myDataGrid ); + Controls->Add( myButton1 ); + } + + // +private: + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Change the color of 'HeaderBack'. + myDataTableStyle->HeaderBackColor = Color::LightPink; + } + + void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the 'HeaderBack' to its origanal color. + myDataTableStyle->ResetHeaderBackColor(); + } + // + +private: + void AddCustomDataTableStyle() + { + // Create a 'DataGridTableStyle'. + myDataTableStyle = gcnew DataGridTableStyle; + myDataTableStyle->MappingName = "Customers"; + + // Create a 'DataGridColumnStyle'. + myDataGridColumnStyle = gcnew DataGridTextBoxColumn; + myDataGridColumnStyle->MappingName = "CustName"; + myDataGridColumnStyle->HeaderText = "Customer Name"; + myDataGridColumnStyle->Width = 150; + + // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. + myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); + + // Add the 'DataGridTableStyle' to 'DataGrid'. + myDataGrid->TableStyles->Add( myDataTableStyle ); + } + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Customers" ); + DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); + myTable->Columns->Add( myColumn ); + myDataSet->Tables->Add( myTable ); + DataRow^ newRow1; + for ( int i = 0; i < 5; i++ ) + { + newRow1 = myTable->NewRow(); + newRow1[ "CustName" ] = i; + + // Add the row to the Customers table. + myTable->Rows->Add( newRow1 ); + } + myTable->Rows[ 0 ][ "CustName" ] = "Jones"; + myTable->Rows[ 1 ][ "CustName" ] = "James"; + myTable->Rows[ 2 ][ "CustName" ] = "David"; + myTable->Rows[ 3 ][ "CustName" ] = "Robert"; + myTable->Rows[ 4 ][ "CustName" ] = "John"; + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp new file mode 100644 index 00000000000..59c3deb5974 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderFont1/CPP/datagridtablestyle_resetheaderfont1.cpp @@ -0,0 +1,124 @@ +// System::Windows::Forms::DataGridTableStyle:ResetHeaderFont + +/* The following example demonstrates 'ResetHeaderFont' method of 'DataGridTableStyle' class. +A DataGrid and two Button's are added to a form. When user clicks 'Set Header Font' button the Header Font of +DataGrid is changed. The HeaderFont is reset to its default value when the 'Reset Header Font' button is clicked. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class myDataForm: public Form +{ +private: + Button^ mySetButton; + Button^ myResetButton; + Label^ myLabel; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridTableStyle^ myTableStyle; + +public: + myDataForm() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + mySetButton = gcnew Button; + myDataGrid = gcnew DataGrid; + ClientSize = System::Drawing::Size( 450, 330 ); + mySetButton->Location = Point(24,16); + mySetButton->Size = System::Drawing::Size( 220, 24 ); + mySetButton->Text = "Set Header Font To 'Impact'"; + mySetButton->Click += gcnew EventHandler( this, &myDataForm::MySetButton_Click ); + myResetButton = gcnew Button; + myResetButton->Location = Point(250,16); + myResetButton->Size = System::Drawing::Size( 130, 24 ); + myResetButton->Text = "Reset Header Font"; + myResetButton->Click += gcnew EventHandler( this, &myDataForm::MyResetButton_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 120, 200 ); + myDataGrid->CaptionText = "DataGrid Control"; + myLabel = gcnew Label; + myLabel->Location = Point(24,270); + myLabel->Width = 500; + Controls->Add( mySetButton ); + Controls->Add( myResetButton ); + Controls->Add( myDataGrid ); + Controls->Add( myLabel ); + Text = "ResetHeaderFont example"; + } + + void SetUp() + { + // Create a DataSet with a table. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Orders" ); + + // Create the DataGridTableStyle. + myTableStyle = gcnew DataGridTableStyle; + + // Map DataGridTableStyle to a DataTable. + myTableStyle->MappingName = "Orders"; + } + + // +private: + void MySetButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Set the 'HeaderFont' property of the DataGridTableStyle instance. + myTableStyle->HeaderFont = gcnew System::Drawing::Font( "Impact",10 ); + + // Add the DataGridTableStyle instance to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle ); + } + + void MyResetButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the Header Font to its default value. + myTableStyle->ResetHeaderFont(); + } + // + +private: + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Orders" ); + DataColumn^ myColumn = gcnew DataColumn( "Amount",Decimal::typeid ); + myTable->Columns->Add( myColumn ); + + // Add the table to the DataSet. + myDataSet->Tables->Add( myTable ); + DataRow^ newRow; + for ( int j = 1; j < 15; j++ ) + { + newRow = myTable->NewRow(); + newRow[ "Amount" ] = j * 10; + + // Add the row to the Orders table. + myTable->Rows->Add( newRow ); + } + } +}; + +int main() +{ + Application::Run( gcnew myDataForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp new file mode 100644 index 00000000000..970aa099b9f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetHeaderForeColor/CPP/datagridtablestyle_resetheaderforecolor.cpp @@ -0,0 +1,137 @@ +// System::Windows::Forms::DataGridTableStyle::ResetHeaderForeColor + +/* +The following example demonstrates 'ResetHeaderForeColor' method of 'DataGridTableStyle' class. +It adds a datagrid and two buttons to a form. A 'DataGridTableStyle' instance is mapped to the table of 'DataGrid'. +When the user clicks on 'Set the HeaderForeColor' button it sets the header fore color. If the user clicks on +'Reset HeaderForeColor' button it resets the grid 'HeaderForeColor' to its default value. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class MyForm1: public Form +{ +private: + Button^ myButton1; + Button^ myButton2; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridColumnStyle^ myDataGridColumnStyle; + DataGridTableStyle^ myDataTableStyle; + +public: + MyForm1() + { + InitializeComponent(); + + // Create a dataset. + MakeDataSet(); + + // Bind datagrid to the dataset. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + AddCustomDataTableStyle(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + myButton1 = gcnew Button; + myButton2 = gcnew Button; + myDataGrid = gcnew DataGrid; + Text = "DataGridTableStyle Sample"; + ClientSize = System::Drawing::Size( 450, 330 ); + myButton1->Location = Point(50,16); + myButton1->Size = System::Drawing::Size( 176, 23 ); + myButton1->Text = "Set the HeaderForeColor"; + myButton1->Click += gcnew EventHandler( this, &MyForm1::myButton1_Click ); + myButton2->Location = Point(230,16); + myButton2->Size = System::Drawing::Size( 140, 24 ); + myButton2->Text = "Reset HeaderForeColor"; + myButton2->Click += gcnew EventHandler( this, &MyForm1::myButton2_Click ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 240, 150 ); + myDataGrid->CaptionText = "DataGridTableStyle Example"; + Controls->Add( myButton1 ); + Controls->Add( myDataGrid ); + Controls->Add( myButton2 ); + } + + // +private: + void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Set the 'HeaderForeColor' property. + myDataTableStyle->HeaderForeColor = Color::Blue; + } + + void myButton2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Reset the 'HeaderForeColor' property to its default value. + myDataTableStyle->ResetHeaderForeColor(); + } + // + +private: + void AddCustomDataTableStyle() + { + // Create a 'DataGridTableStyle'. + myDataTableStyle = gcnew DataGridTableStyle; + myDataTableStyle->MappingName = "Customers"; + + // Create a 'DataGridColumnStyle'. + myDataGridColumnStyle = gcnew DataGridTextBoxColumn; + myDataGridColumnStyle->MappingName = "CustName"; + myDataGridColumnStyle->HeaderText = "Customer Name"; + myDataGridColumnStyle->Width = 150; + + // Add the 'DataGridColumnStyle' to 'DataGridTableStyle'. + myDataTableStyle->GridColumnStyles->Add( myDataGridColumnStyle ); + + // Add the 'DataGridTableStyle' to 'DataGrid'. + myDataGrid->TableStyles->Add( myDataTableStyle ); + } + + // Create a dataset with one table and populate it. + void MakeDataSet() + { + // Create a dataset. + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myTable = gcnew DataTable( "Customers" ); + + // Create a column, and add it to the table. + DataColumn^ myColumn = gcnew DataColumn( "CustName",String::typeid ); + myTable->Columns->Add( myColumn ); + + // Add the table to dataset. + myDataSet->Tables->Add( myTable ); + DataRow^ newRow1; + for ( int i = 0; i < 5; i++ ) + { + newRow1 = myTable->NewRow(); + newRow1[ "CustName" ] = i; + + // Add the row to customers table. + myTable->Rows->Add( newRow1 ); + + } + myTable->Rows[ 0 ][ "CustName" ] = "Jones"; + myTable->Rows[ 1 ][ "CustName" ] = "James"; + myTable->Rows[ 2 ][ "CustName" ] = "David"; + myTable->Rows[ 3 ][ "CustName" ] = "Robert"; + myTable->Rows[ 4 ][ "CustName" ] = "John"; + } +}; + +int main() +{ + Application::Run( gcnew MyForm1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp new file mode 100644 index 00000000000..48242c9b2ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_ResetLinkColor/CPP/datagridtablestyle_resetlinkcolor.cpp @@ -0,0 +1,288 @@ +// System::Windows::Forms::DataGridTableStyle::ResetLinkColor + +/* The following program demonstrates the 'ResetLinkColor' +of 'System::Windows::Forms::DataGridTableStyle' class. +It creates a windows form, a 'DataSet' containing two 'DataTable' +objects, and a 'DataRelation' that relates the two tables. To +display the data, a 'DataGrid' control is then bound to the +'DataSet' through the 'SetDataBinding' method. +DataGridTableStyle is attached to one of 'DataTable'. +Buttons are provided on form to demonstrate setting link color +and 'ResetLinkColor' method. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace DataGridSample +{ + + /// + /// Summary description for DatGridClass. + /// + public ref class DatGridClass: public System::Windows::Forms::Form + { + private: + DataSet^ myDataSet; + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::GroupBox^ groupBox3; + System::Windows::Forms::Button^ btnResetLinkColor; + System::Windows::Forms::Button^ btnSetLinkColor; + DataGridTableStyle^ myDataGridTableStyle; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + DatGridClass() + { + components = nullptr; + myDataGridTableStyle = gcnew DataGridTableStyle; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // Setup GridControl data. + SetUp(); + } + + public: + + /// + /// Clean up any resources being used. + /// + ~DatGridClass() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->btnSetLinkColor = gcnew System::Windows::Forms::Button; + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + this->btnResetLinkColor = gcnew System::Windows::Forms::Button; + this->groupBox3 = gcnew System::Windows::Forms::GroupBox; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->groupBox3->SuspendLayout(); + this->SuspendLayout(); + + // + // btnSetLinkColor + // + this->btnSetLinkColor->Location = System::Drawing::Point( 16, 16 ); + this->btnSetLinkColor->Name = "btnSetLinkColor"; + this->btnSetLinkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnSetLinkColor->TabIndex = 4; + this->btnSetLinkColor->Text = "Set Link Color"; + this->btnSetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetLinkColor_Click ); + + // + // myDataGrid + // + this->myDataGrid->DataMember = ""; + this->myDataGrid->ForeColor = System::Drawing::Color::Blue; + this->myDataGrid->Location = System::Drawing::Point( 12, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->ReadOnly = true; + this->myDataGrid->Size = System::Drawing::Size( 272, 192 ); + this->myDataGrid->TabIndex = 6; + + // + // btnResetLinkColor + // + this->btnResetLinkColor->Location = System::Drawing::Point( 16, 48 ); + this->btnResetLinkColor->Name = "btnResetLinkColor"; + this->btnResetLinkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnResetLinkColor->TabIndex = 1; + this->btnResetLinkColor->Text = "Reset Link Color"; + this->btnResetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetLinkColor_Click ); + + // + // groupBox3 + // + array^groupBox3Controls = {this->btnSetLinkColor,this->btnResetLinkColor}; + this->groupBox3->Controls->AddRange( groupBox3Controls ); + this->groupBox3->Location = System::Drawing::Point( 80, 232 ); + this->groupBox3->Name = "groupBox3"; + this->groupBox3->Size = System::Drawing::Size( 136, 88 ); + this->groupBox3->TabIndex = 7; + this->groupBox3->TabStop = false; + + // + // DatGridClass + // + this->ClientSize = System::Drawing::Size( 312, 341 ); + array^formControls = {this->groupBox3,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->Name = "DatGridClass"; + this->Text = "Sample Program"; + (dynamic_cast(this->myDataGrid))->EndInit(); + this->groupBox3->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void SetUp() + { + // Create a 'DataSet' with two tables and one relation. + MakeDataSet(); + + // Bind the 'DataGrid' to the 'DataSet'. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // Create a 'DataSet' with two tables and populate it. + void MakeDataSet() + { + // Create a 'DataSet'. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create two 'DataTables'. + DataTable^ tCust = gcnew DataTable( "Customers" ); + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Map 'myDataGridTableStyle' to 'Customers' table. + myDataGridTableStyle->MappingName = "Customers"; + + // Add the DataGridTableStyle objects to the collection. + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + + // Create three columns and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",String::typeid ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the 'DataSet'. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a 'DataRelation' and add it to the 'DataSet'. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + // Create two 'DataRow' variables for customer and order. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the 'Customers Table'. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the 'Customers Table'. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Customer1"; + tCust->Rows[ 1 ][ "custName" ] = "Customer2"; + tCust->Rows[ 2 ][ "custName" ] = "Customer3"; + + // Give the current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the orders table. + double myNumber = 0; + String^ myString; + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + myNumber = i * 10 + j * .1; + myString = String::Concat( "$ ", myNumber.ToString() ); + newRow2[ "OrderAmount" ] = myString; + + // Add the row to the orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } + + void btnResetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Link color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGridTableStyle->LinkColor; + myString = String::Concat( myString, myCurrentColor ); + + // Reset link color to default. + myDataGridTableStyle->ResetLinkColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGridTableStyle->LinkColor ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Link line color information" ); + // + } + + void btnSetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color select to the current color. + myColorDialog->Color = myDataGridTableStyle->LinkColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set link color to selected color. + myDataGridTableStyle->LinkColor = myColorDialog->Color; + } + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew DataGridSample::DatGridClass ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp new file mode 100644 index 00000000000..36b68f82c68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeaderWidth/CPP/rowheaderwidth.cpp @@ -0,0 +1,217 @@ +// System::Windows::Forms::DataGridTableStyle::RowHeaderWidth +// System::Windows::Forms::DataGridTableStyle::RowHeaderWidthChanged + +/* The following program demonstrates the 'RowHeaderWidth' +method and 'RowHeaderWidthChanged' event of 'DataGridTableStyle' +class. It changes the row header width on button click +and resets the row header width. */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class DataGridTableStyle_RowHeaderWidth: public Form +{ +private: + System::ComponentModel::Container^ components; + Button^ button2; + DataGridColumnStyle^ IdCol; + DataGridColumnStyle^ TextCol; + DataGridTableStyle^ myDataGridTableStyle; + Button^ button1; + DataGrid^ myDataGrid; + +public: + ~DataGridTableStyle_RowHeaderWidth() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->myDataGrid = gcnew DataGrid; + this->button1 = gcnew Button; + this->button2 = gcnew Button; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // myDataGrid + // + this->myDataGrid->DataMember = ""; + this->myDataGrid->LinkColor = SystemColors::Desktop; + this->myDataGrid->Location = Point(56,40); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 224, 144 ); + this->myDataGrid->TabIndex = 0; + + // + // button1 + // + this->button1->Location = Point(168,208); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 152, 23 ); + this->button1->TabIndex = 1; + this->button1->Text = " Change RowHeader Width"; + this->button1->Click += gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::button1_Click ); + + // + // button2 + // + this->button2->Location = Point(16,208); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 152, 23 ); + this->button2->TabIndex = 1; + this->button2->Text = "Display RowHeader Width"; + this->button2->Click += gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::button2_Click ); + + // + // DataGridTableStyle_RowHeaderWidth + // + this->ClientSize = System::Drawing::Size( 344, 261 ); + array^temp0 = {this->myDataGrid,this->button2}; + this->Controls->AddRange( temp0 ); + this->Name = "DataGridTableStyle_RowHeaderWidth"; + this->Text = "Change Row Width"; + CallEventLoader(); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + +public: + DataGridTableStyle_RowHeaderWidth() + { + components = nullptr; + IdCol = gcnew DataGridTextBoxColumn; + TextCol = gcnew DataGridTextBoxColumn; + myDataGridTableStyle = gcnew DataGridTableStyle; + InitializeComponent(); + + // Create and bind DataSet to DataGrid. + CreateNBindDataSet(); + } + +private: + void CreateNBindDataSet() + { + // Create a DataSet with one table. + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ myEmpTable = gcnew DataTable( "Employee" ); + + // Create two columns, and add them to the employee table. + DataColumn^ myEmpID = gcnew DataColumn( "EmpID",int::typeid ); + DataColumn^ myEmpName = gcnew DataColumn( "EmpName" ); + myEmpTable->Columns->Add( myEmpID ); + myEmpTable->Columns->Add( myEmpName ); + + // Add the table to the DataSet. + myDataSet->Tables->Add( myEmpTable ); + + // Populate the table. + DataRow^ newRow1; + + // Create employee records in the employee table. + for ( int i = 1; i < 6; i++ ) + { + newRow1 = myEmpTable->NewRow(); + newRow1[ "EmpID" ] = i; + + // Add the row to the Employee table. + myEmpTable->Rows->Add( newRow1 ); + } + + // Give each employee a distinct name. + myEmpTable->Rows[ 0 ][ "EmpName" ] = "Gary"; + myEmpTable->Rows[ 1 ][ "EmpName" ] = "Harry"; + myEmpTable->Rows[ 2 ][ "EmpName" ] = "Mary"; + myEmpTable->Rows[ 3 ][ "EmpName" ] = "Larry"; + myEmpTable->Rows[ 4 ][ "EmpName" ] = "Robert"; + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Employee" ); + } + + void DataGridTableStyle_RowHeaderWidth_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGridTableStyle->MappingName = "Employee"; + + // Set other properties. + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + + // Set MappingName to the DataColumn name in the DataTable. + IdCol->MappingName = "EmpID"; + + // Set the HeaderText and Width properties. + IdCol->HeaderText = "Emp ID"; + IdCol->Width = 50; + + // Add a GridColumnStyle. + myDataGridTableStyle->GridColumnStyles->Add( IdCol ); + myDataGridTableStyle->RowHeaderWidth = 10; + + // Add a second column style. + TextCol->MappingName = "EmpName"; + TextCol->HeaderText = "Emp Name"; + TextCol->Width = 100; + myDataGridTableStyle->GridColumnStyles->Add( TextCol ); + + // Add the DataGridTableStyle to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + myDataGridTableStyle->GridLineColor = Color::Red; + AttachRowHeaderWidthChanged(); + } + + // + // +private: + void CallEventLoader() + { + this->Load += gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::DataGridTableStyle_RowHeaderWidth_Load ); + } + +public: + void AttachRowHeaderWidthChanged() + { + myDataGridTableStyle->RowHeaderWidthChanged += + gcnew EventHandler( this, &DataGridTableStyle_RowHeaderWidth::MyDelegateRowHeaderChanged ); + } + +private: + void MyDelegateRowHeaderChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "Row header width is changed" ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGridTableStyle->RowHeaderWidth = 30; + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( String::Concat( "Row header width is: ", myDataGridTableStyle->RowHeaderWidth ) ); + } + // + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew DataGridTableStyle_RowHeaderWidth ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp new file mode 100644 index 00000000000..dd2460265d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_RowHeadersVisibleChanged/CPP/rowheadersvisiblechanged.cpp @@ -0,0 +1,186 @@ +// System::Windows::Forms::DataGridTableStyle::RowHeadersVisibleChanged +// System::Windows::Forms::DataGridTableStyle::RowHeadersVisible + +/* The following program demonstrates the 'RowHeadersVisible' +method and 'RowHeadersVisibleChanged' event of +'System::Windows::Forms::DataGridTableStyle' class. It makes the +row headers visible or invisible on button click */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyDataGridTableStyle_RowHeadersVisibleChanged: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGridTableStyle^ myDataGridTableStyle; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ myButton; + +public: + MyDataGridTableStyle_RowHeadersVisibleChanged() + { + components = nullptr; + + // Create the form. + InitializeComponent(); + + // Bind the controls to the DataGrid. + MakeDataSet(); + } + +public: + + // Clean up any resources being used. + ~MyDataGridTableStyle_RowHeadersVisibleChanged() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myDataGridTableStyle = gcnew DataGridTableStyle; + this->myDataGrid = gcnew DataGrid; + this->myButton = gcnew Button; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGridTableStyle"; + this->MaximizeBox = false; + myButton->Location = Point(80,15); + myButton->Size = System::Drawing::Size( 130, 40 ); + myButton->Text = "Toggle Row Headers"; + myButton->Click += gcnew EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::myButton_Click ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->ReadOnly = false; + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + this->Load += gcnew System::EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::DataGridTableStyle_RowHeadersVisible_Load ); + } + + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ tPer = gcnew DataTable( "Person" ); + + // Create two columns, and add them to the Person table. + DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); + tPer->Columns->Add( cPerID ); + tPer->Columns->Add( cPerName ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tPer ); + + // For each person create a DataRow variable. + DataRow^ newRow1; + + // Create five persons in the Person Table. + for ( int i = 1; i < 6; i++ ) + { + newRow1 = tPer->NewRow(); + newRow1[ "SSN" ] = i; + + // Add the row to the Person table. + tPer->Rows->Add( newRow1 ); + } + + // Give each person a distinct name. + tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; + tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; + tPer->Rows[ 2 ][ "PersonName" ] = "John"; + tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; + tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + void DataGridTableStyle_RowHeadersVisible_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGridTableStyle->MappingName = "Person"; + + // Set other properties. + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + + // Create DataGridColumnStyle + DataGridColumnStyle^ IdCol = gcnew DataGridTextBoxColumn; + DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; + + // Set MappingName to DataColumn name in DataTable. + IdCol->MappingName = "SSN"; + + // Set the HeaderText and Width properties. + IdCol->HeaderText = "SSN"; + IdCol->Width = 50; + + // Add a second column style. + TextCol->MappingName = "PersonName"; + TextCol->HeaderText = "Person Name"; + TextCol->Width = 150; + + // Add the GridColumnStyles to DataGridTableStyle. + myDataGridTableStyle->GridColumnStyles->Add( IdCol ); + myDataGridTableStyle->GridColumnStyles->Add( TextCol ); + + // Add the DataGridTableStyle to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + myDataGridTableStyle->GridLineColor = Color::Aquamarine; + AttachRowHeaderVisibleChanged(); + } + + // + // + // Instantiate the EventHandler. +public: + void AttachRowHeaderVisibleChanged() + { + myDataGridTableStyle->RowHeadersVisibleChanged += gcnew EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::MyDelegateRowHeadersVisibleChanged ); + } + + // raise the event when RowHeadersVisible property is changed. +private: + void MyDelegateRowHeadersVisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ myString = "'RowHeadersVisibleChanged' event raised, Row Headers are"; + if ( myDataGridTableStyle->RowHeadersVisible ) + myString = String::Concat( myString, " visible" ); + else + myString = String::Concat( myString, " not visible" ); + + MessageBox::Show( myString, "RowHeader information" ); + } + + // raise the event when a button is clicked. + void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( myDataGridTableStyle->RowHeadersVisible ) + myDataGridTableStyle->RowHeadersVisible = false; + else + myDataGridTableStyle->RowHeadersVisible = true; + } + // + // +}; + +// Main entry point for the application. +int main() +{ + Application::Run( gcnew MyDataGridTableStyle_RowHeadersVisibleChanged ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp new file mode 100644 index 00000000000..90cd8119c31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample/CPP/datagridtablestyle_sample.cpp @@ -0,0 +1,268 @@ +// System::Windows::Forms::DataGridTableStyle::LinkColor; +// System::Windows::Forms::DataGridTableStyle::HeaderFont; +// System::Windows::Forms::DataGridTableStyle::LinkColorChanged; +// System::Windows::Forms::DataGridTableStyle::HeaderFontChanged; + +/* The following example demonstrates the properties 'LinkColor', 'HeaderFont' +and Events 'LinkColorChanged', 'HeaderFontChanged' of DataGridTableStyle. +The following program creates a Windows form, a DataSet containing two DataTable objects, +and a DataRelation that relates the two tables. A button on the form changes the appearance +of the grid by setting the linkcolor and headerfont. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace SampleDataGridTableStyle +{ + public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle2; + DataSet^ myDataSet; + System::Windows::Forms::Button^ btnApplyStyles; + System::ComponentModel::Container^ components; + + public: + DataGridTableStyle_Sample() + { + components = nullptr; + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + + public: + ~DataGridTableStyle_Sample() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->btnApplyStyles = gcnew System::Windows::Forms::Button; + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // btnApplyStyles + // + this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->btnApplyStyles->Location = System::Drawing::Point( 88, 208 ); + this->btnApplyStyles->Name = "btnApplyStyles"; + this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); + this->btnApplyStyles->TabIndex = 1; + this->btnApplyStyles->Text = "Apply Custom Styles"; + this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); + + // + // myDataGrid + // + this->myDataGrid->BackColor = System::Drawing::SystemColors::Info; + this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->LinkColor = System::Drawing::Color::Gray; + this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); + this->myDataGrid->TabIndex = 0; + + // + // DataGridTableStyle_Sample + // + this->ClientSize = System::Drawing::Size( 440, 273 ); + array^formControls = {this->btnApplyStyles,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->Name = "DataGridTableStyle_Sample"; + this->Text = "DataGridTableStyle_Sample"; + this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ){} + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // + // + // + // + private: + void AddCustomDataTableStyle() + { + myDataGridTableStyle1 = gcnew DataGridTableStyle; + myDataGridTableStyle2 = gcnew DataGridTableStyle; + MessageBox::Show( String::Concat( "LinkColor Before : ", myDataGridTableStyle1->LinkColor ) ); + MessageBox::Show( String::Concat( "HeaderFont Before : ", myDataGridTableStyle1->HeaderFont ) ); + myDataGridTableStyle1->LinkColorChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::LinkColorChanged_Handler ); + myDataGridTableStyle1->HeaderFontChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::HeaderFontChanged_Handler ); + myDataGridTableStyle1->MappingName = "Customers"; + + // Set other properties. + myDataGridTableStyle1->AlternatingBackColor = Color::LightGray; + myDataGridTableStyle1->LinkColor = Color::Red; + myDataGridTableStyle1->HeaderFont = gcnew System::Drawing::Font( "Verdana",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + + // Add a GridColumnStyle and set its MappingName. + DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; + myBoolCol->MappingName = "Current"; + myBoolCol->HeaderText = "IsCurrent Customer"; + myBoolCol->Width = 150; + myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); + + // Add a second column style. + DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; + myTextCol->MappingName = "custName"; + myTextCol->HeaderText = "Customer Name"; + myTextCol->Width = 250; + myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); + + // Create new ColumnStyle objects + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + + // PropertyDescriptor to create a formatted column. + PropertyDescriptorCollection^ myPropertyDescriptorCollection = this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties(); + DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + + // Add the DataGridTableStyle instances to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); + } + + void LinkColorChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "LinkColor changed to 'RED'", "DataGridTableStyle" ); + } + + void HeaderFontChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "HeaderFont changed to 'VERDANA'", "DataGridTableStyle" ); + } + // + // + // + // + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create Customer DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create Customer order table. + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Gamma"; + + // Give the Current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } + + void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + AddCustomDataTableStyle(); + btnApplyStyles->Enabled = false; + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp new file mode 100644 index 00000000000..0a744e45790 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample2/CPP/datagridtablestyle_sample2.cpp @@ -0,0 +1,247 @@ +// System::Windows::Forms::DataGridTableStyle::AllowSorting; +// System::Windows::Forms::DataGridTableStyle::AllowSortingChanged; + +/* The following example demonstrates the property +'AllowSorting' and event 'AllowSortingChanged' of class DataGridTableStyle. +The following program creates a Windows form, a DataSet containing +two DataTable objects, and a DataRelation that relates the two tables. +A button on the form toggles sorting availability on the grid. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace SampleDataGridTableStyle +{ + public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; + DataSet^ myDataSet; + System::Windows::Forms::Button^ btnApplyStyles; + System::Windows::Forms::Label ^ mylabel; + System::ComponentModel::Container^ components; + + public: + DataGridTableStyle_Sample() + { + components = nullptr; + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + + public: + ~DataGridTableStyle_Sample() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->btnApplyStyles = gcnew System::Windows::Forms::Button; + this->mylabel = gcnew System::Windows::Forms::Label; + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // btnApplyStyles + // + this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->btnApplyStyles->Location = System::Drawing::Point( 216, 192 ); + this->btnApplyStyles->Name = "btnApplyStyles"; + this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); + this->btnApplyStyles->TabIndex = 1; + this->btnApplyStyles->Text = "Apply Sorting"; + this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); + + // + // mylabel + // + this->mylabel->Font = gcnew System::Drawing::Font( "Verdana",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->mylabel->Location = System::Drawing::Point( 48, 208 ); + this->mylabel->Name = "mylabel"; + this->mylabel->Size = System::Drawing::Size( 160, 23 ); + this->mylabel->TabIndex = 2; + this->mylabel->Text = "Sorting Status"; + + // + // myDataGrid + // + this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->LinkColor = System::Drawing::Color::Gray; + this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); + this->myDataGrid->TabIndex = 0; + + // + // DataGridTableStyle_Sample + // + this->ClientSize = System::Drawing::Size( 416, 261 ); + array^formControls = {this->mylabel,this->btnApplyStyles,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->Name = "DataGridTableStyle_Sample"; + this->Text = "DataGridTableStyle_Sample"; + this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create Customer DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create Customer order table. + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Gamma"; + + // Give the Current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } + + // + // + private: + void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGridTableStyle1 = gcnew DataGridTableStyle; + mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); + if ( myDataGridTableStyle1->AllowSorting) + { + btnApplyStyles->Text = "Remove Sorting"; + } + else + { + btnApplyStyles->Text = "Apply Sorting"; + } + + myDataGridTableStyle1->AllowSortingChanged += gcnew System::EventHandler( + this, &DataGridTableStyle_Sample::AllowSortingChanged_Handler ); + myDataGridTableStyle1->MappingName = "Customers"; + } + + void AllowSortingChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); + } + + void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGridTableStyle1->AllowSorting) + { + // Remove sorting. + myDataGridTableStyle1->AllowSorting = false; + btnApplyStyles->Text = "Allow Sorting"; + } + else + { + // Allow sorting. + myDataGridTableStyle1->AllowSorting = true; + btnApplyStyles->Text = "Remove Sorting"; + } + + mylabel->Text = String::Concat( "Sorting Status : ", myDataGridTableStyle1->AllowSorting ); + + // Add the DataGridTableStyle to DataGrid. + myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); + } + // + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp new file mode 100644 index 00000000000..c677cd04ee9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_Sample3/CPP/datagridtablestyle_sample3.cpp @@ -0,0 +1,286 @@ +// System::Windows::Forms::DataGridTableStyle::ColumnHeadersVisible; +// System::Windows::Forms::DataGridTableStyle::ColumnHeadersVisibleChanged; + +/* The following example demonstrates the property 'ColumnHeadersVisible' +and event 'ColumnHeadersVisibleChanged' of DataGridTableStyle. +The following program creates a Windows form, a DataSet containing two DataTable objects, +and a DataRelation that relates the two tables. A button on the form changes the appearance +of column headers on the grid. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace SampleDataGridTableStyle +{ + public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; + DataSet^ myDataSet; + System::Windows::Forms::Button^ btnheader; + System::Windows::Forms::Label ^ myHeaderLabel; + System::ComponentModel::Container^ components; + + public: + DataGridTableStyle_Sample() + { + components = nullptr; + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + + public: + ~DataGridTableStyle_Sample() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->myHeaderLabel = gcnew System::Windows::Forms::Label; + this->btnheader = gcnew System::Windows::Forms::Button; + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // myHeaderLabel + // + this->myHeaderLabel->Font = gcnew System::Drawing::Font( "Verdana",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->myHeaderLabel->Location = System::Drawing::Point( 48, 216 ); + this->myHeaderLabel->Name = "myHeaderLabel"; + this->myHeaderLabel->Size = System::Drawing::Size( 160, 23 ); + this->myHeaderLabel->TabIndex = 2; + this->myHeaderLabel->Text = "Header Status"; + + // + // btnheader + // + this->btnheader->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->btnheader->Location = System::Drawing::Point( 216, 200 ); + this->btnheader->Name = "btnheader"; + this->btnheader->Size = System::Drawing::Size( 144, 40 ); + this->btnheader->TabIndex = 1; + this->btnheader->Text = "Remove Header"; + this->btnheader->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnheader_Click ); + + // + // myDataGrid + // + this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->LinkColor = System::Drawing::Color::Gray; + this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->SelectionBackColor = System::Drawing::SystemColors::Window; + this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); + this->myDataGrid->TabIndex = 0; + + // + // DataGridTableStyle_Sample + // + this->ClientSize = System::Drawing::Size( 416, 277 ); + array^formControls = {this->btnheader,this->myHeaderLabel,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->Name = "DataGridTableStyle_Sample"; + this->Text = "DataGridTableStyle_Sample"; + this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create Customer DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create Customer order table. + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Gamma"; + + // Give the Current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } + + // + // + private: + void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGridTableStyle1 = gcnew DataGridTableStyle; + myHeaderLabel->Text = String::Concat( "Header Status : ", myDataGridTableStyle1->ColumnHeadersVisible ); + if (myDataGridTableStyle1->ColumnHeadersVisible) + { + btnheader->Text = "Remove Header"; + } + else + { + btnheader->Text = "Add Header"; + } + + AddCustomDataTableStyle(); + } + + void AddCustomDataTableStyle() + { + myDataGridTableStyle1->ColumnHeadersVisibleChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::ColumnHeadersVisibleChanged_Handler ); + + // Set ColumnheaderVisible property. + myDataGridTableStyle1->MappingName = "Customers"; + + // Add a GridColumnStyle and set its MappingName + DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; + myBoolCol->MappingName = "Current"; + myBoolCol->HeaderText = "IsCurrent Customer"; + myBoolCol->Width = 150; + myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); + + // Add a second column style. + DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; + myTextCol->MappingName = "custName"; + myTextCol->HeaderText = "Customer Name"; + myTextCol->Width = 250; + myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); + + // Create new ColumnStyle objects + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + + // PropertyDescriptor to create a formatted column. + PropertyDescriptorCollection^ myPropertyDescriptorCollection = + this->BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); + + // Create a formatted column using a PropertyDescriptor. + DataGridColumnStyle^ csOrderAmount = + gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + + // Add the DataGridTableStyle instances to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); + } + + void ColumnHeadersVisibleChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myHeaderLabel->Text = String::Concat( "Header Status : ", myDataGridTableStyle1->ColumnHeadersVisible ); + } + + void btnheader_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if (myDataGridTableStyle1->ColumnHeadersVisible) + { + myDataGridTableStyle1->ColumnHeadersVisible = false; + btnheader->Text = "Add Header"; + } + else + { + myDataGridTableStyle1->ColumnHeadersVisible = true; + btnheader->Text = "Remove Header"; + } + } + // + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp new file mode 100644 index 00000000000..7d372741f89 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionBackColor/CPP/selectionbackcolor.cpp @@ -0,0 +1,234 @@ +// System::Windows::Forms::DataGridTableStyle::SelectionBackColorChanged +// System::Windows::Forms::DataGridTableStyle::SelectionBackColor +// System::Windows::Forms::DataGridTableStyle::ResetSelectionBackColor + +/* The following program demonstrates the 'SelectionBackColorChanged' +event, 'SelectionBackColor' property and 'ResetSelectionBackColor' +method of the'DataGridTableStyle'class. It changes the BackColor +of the selected cells by raising the 'SelectionBackColorChanged' +event. The SelectionBackColor is reset to its default value with +the 'ResetSelectionBackColor' button. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + System::Windows::Forms::Button^ myBackColorButton; + System::Windows::Forms::Button^ myResetButton; + DataGridTableStyle^ myGridTableStyle; + DataGrid^ myDataGrid; + +public: + MyForm() + { + components = nullptr; + myDataGrid = gcnew DataGrid; + InitializeComponent(); + } + +public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->myBackColorButton = gcnew System::Windows::Forms::Button; + this->myResetButton = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // myBackColorButton + // + this->myBackColorButton->Location = System::Drawing::Point( 0, 352 ); + this->myBackColorButton->Name = "myBackColorButton"; + this->myBackColorButton->Size = System::Drawing::Size( 160, 23 ); + this->myBackColorButton->TabIndex = 0; + this->myBackColorButton->Text = "Change SelectionBackColor"; + this->myBackColorButton->Click += gcnew System::EventHandler( this, &MyForm::MyBackColorButton_Click ); + + // + // myResetButton + // + this->myResetButton->Location = System::Drawing::Point( 160, 352 ); + this->myResetButton->Name = "myResetButton"; + this->myResetButton->Size = System::Drawing::Size( 152, 23 ); + this->myResetButton->TabIndex = 1; + this->myResetButton->Text = "Reset SelectionBackColor"; + this->myResetButton->Click += gcnew System::EventHandler( this, &MyForm::MyResetButton_Click ); + + // + // MyForm + // + this->ClientSize = System::Drawing::Size( 316, 411 ); + array^formControls = {this->myResetButton,this->myBackColorButton}; + this->Controls->AddRange( formControls ); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow; + this->Name = "MyForm"; + this->Text = "MyForm"; + this->Load += gcnew System::EventHandler( this, &MyForm::MyForm_Load ); + this->ResumeLayout( false ); + } + + void MyForm_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGrid->CaptionText = "My Data Grid"; + myDataGrid->Height = 300; + myDataGrid->Width = 300; + myDataGrid->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + myDataGrid->SetDataBinding( MakeDataSet(), "Orders" ); + Controls->Add( myDataGrid ); + myGridTableStyle = gcnew DataGridTableStyle; + myGridTableStyle->MappingName = "Orders"; + myGridTableStyle->SelectionForeColor = Color::Coral; + myDataGrid->TableStyles->Add( myGridTableStyle ); + AttachSelectionBackColorChanged(); + } + + // +public: + void AttachSelectionBackColorChanged() + { + // Handle the 'SelectionBackColorChanged' event. + myGridTableStyle->SelectionBackColorChanged += gcnew EventHandler( this, &MyForm::MyDataGrid_SelectedBackColorChanged ); + } + +private: + void MyDataGrid_SelectedBackColorChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "SelectionBackColorChanged event was raised, Color changed to " + myGridTableStyle->SelectionBackColor ); + } + // + + void MyBackColorButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Allow the user to select a Color. + ColorDialog^ myColorDialog = gcnew ColorDialog; + myColorDialog->AllowFullOpen = false; + myColorDialog->ShowHelp = true; + + // Set the initial color select to the current color. + myColorDialog->Color = myGridTableStyle->SelectionBackColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set the backcolor for the selected cells. + myGridTableStyle->SelectionBackColor = myColorDialog->Color; + // + + myDataGrid->Invalidate(); + } + + void MyResetButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Set the SelectionBackColor to the default color. + myGridTableStyle->ResetSelectionBackColor(); + // + } + + DataSet^ MakeDataSet() + { + // Create a DataSet. + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + + // Create two DataTables. + DataTable^ myDataGrid = gcnew DataTable( "Customers" ); + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + myDataGrid->Columns->Add( cCustID ); + myDataGrid->Columns->Add( cCustName ); + myDataGrid->Columns->Add( cCurrent ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( myDataGrid ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + // Create for each customer and order two DataRow variables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = myDataGrid->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + myDataGrid->Rows->Add( newRow1 ); + } + myDataGrid->Rows[ 0 ][ "custName" ] = "Customer 1"; + myDataGrid->Rows[ 1 ][ "custName" ] = "Customer 2"; + myDataGrid->Rows[ 2 ][ "custName" ] = "Customer 3"; + + // Give the Current column a value. + myDataGrid->Rows[ 0 ][ "Current" ] = true.ToString(); + myDataGrid->Rows[ 1 ][ "Current" ] = true.ToString(); + myDataGrid->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + return myDataSet; + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp new file mode 100644 index 00000000000..a8d4b39752c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_SelectionForeColor/CPP/selectionforecolor.cpp @@ -0,0 +1,237 @@ +// System::Windows::Forms::DataGridTableStyle::SelectionForeColor +// System::Windows::Forms::DataGridTableStyle::ResetSelectionForeColor + +/* The following program demonstrates the use of 'SelectionForeColor' +property and 'ResetSelectionForeColor' method of +'System::Windows::Forms::DataGridTableStyle'. +It creates a windows form, a 'DataSet' containing one 'DataTable' +Object*. A 'DataGridTableStyle' is attached to 'DataTable'. +To display the data, a 'DataGrid' control is then bound to the +'DataSet' through the 'SetDataBinding' method. +Two button are provided on form to show 'SelectionForeColor' and +'ResetSelectionForeColor'. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace MyDataGridNamespace +{ + public ref class MyForm: public System::Windows::Forms::Form + { + private: + System::ComponentModel::Container^ components; + DataGridTableStyle^ customersStyle; + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::DataGrid^ myDataGrid; + + public: + MyForm() + { + components = nullptr; + customersStyle = gcnew DataGridTableStyle; + InitializeComponent(); + } + + public: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->groupBox1 = gcnew System::Windows::Forms::GroupBox; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->groupBox1->SuspendLayout(); + this->SuspendLayout(); + + // + // myDataGrid + // + this->myDataGrid->DataMember = ""; + this->myDataGrid->Location = System::Drawing::Point( 32, 16 ); + this->myDataGrid->Name = "dataGrid1"; + this->myDataGrid->Size = System::Drawing::Size( 232, 144 ); + this->myDataGrid->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 16, 16 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 144, 24 ); + this->button1->TabIndex = 0; + this->button1->Text = "SetSelectionForeColor"; + this->button1->Click += gcnew System::EventHandler( this, &MyForm::button1_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 16, 40 ); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 144, 24 ); + this->button2->TabIndex = 1; + this->button2->Text = "ResetSelectionForeColor"; + this->button2->Click += gcnew System::EventHandler( this, &MyForm::button2_Click ); + + // + // groupBox1 + // + array^groupBox1Controls = {this->button2,this->button1}; + this->groupBox1->Controls->AddRange( groupBox1Controls ); + this->groupBox1->Location = System::Drawing::Point( 64, 168 ); + this->groupBox1->Name = "groupBox1"; + this->groupBox1->Size = System::Drawing::Size( 176, 80 ); + this->groupBox1->TabIndex = 1; + this->groupBox1->TabStop = false; + + // + // MyForm + // + this->ClientSize = System::Drawing::Size( 320, 266 ); + array^formControls = {this->groupBox1,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow; + this->Name = "MyForm"; + this->Text = "MyForm"; + this->Load += gcnew System::EventHandler( this, &MyForm::MyFormLoad ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->groupBox1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void MyFormLoad( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myDataGrid->SetDataBinding( MakeDataSet(), "Customers" ); + + // Add data grid control to form. + Controls->Add( myDataGrid ); + } + + DataSet^ MakeDataSet() + { + // Create a DataSet. + DataSet^ myDataSet = gcnew DataSet( "myDataSet" ); + + // Create two DataTables. + DataTable^ tCustomers = gcnew DataTable( "Customers" ); + + // Map 'CustomersStyle' to 'Customers' table. + customersStyle->MappingName = "Customers"; + + // Add the DataGridTableStyle objects to the collection. + myDataGrid->TableStyles->Add( customersStyle ); + + // Create two columns and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCustomers->Columns->Add( cCustID ); + tCustomers->Columns->Add( cCustName ); + tCustomers->Columns->Add( cCurrent ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCustomers ); + + // Populate the tables. + // Create two DataRow variables for each customer and order. + DataRow^ newRow1; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCustomers->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCustomers->Rows->Add( newRow1 ); + } + tCustomers->Rows[ 0 ][ "custName" ] = "Customer 1"; + tCustomers->Rows[ 1 ][ "custName" ] = "Customer 2"; + tCustomers->Rows[ 2 ][ "custName" ] = "Customer 3"; + + // Give the Current column a value. + tCustomers->Rows[ 0 ][ "Current" ] = true.ToString(); + tCustomers->Rows[ 1 ][ "Current" ] = true.ToString(); + tCustomers->Rows[ 2 ][ "Current" ] = false.ToString(); + return myDataSet; + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color select to the current color. + myColorDialog->Color = customersStyle->SelectionForeColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set selection fore color to selected color. + customersStyle->SelectionForeColor = myColorDialog->Color; + // + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Fore color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = customersStyle->SelectionForeColor; + myString = String::Concat( myString, myCurrentColor ); + + // Reset selection fore color to default. + customersStyle->ResetSelectionForeColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, customersStyle->SelectionForeColor ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Selection fore color information" ); + // + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew MyDataGridNamespace::MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp new file mode 100644 index 00000000000..b15eaf7bad2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample1/CPP/datagridtablestyle_sample1.cpp @@ -0,0 +1,256 @@ +// System::Windows::Forms::DataGridTableStyle::MappingNameChanged; +// System::Windows::Forms::DataGridTableStyle::GridLineStyleChanged; + +/* The following example demonstrates the events +'MappingNameChanged', 'GridLineStyleChanged' of class 'DataGridTableStyle'. +The following program creates a Windows form, a DataSet containing two DataTable objects, +and a DataRelation that relates the two tables. A button on the form changes data and +appearance of the grid by setting the MappingName and GridLineStyle. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace SampleDataGridTableStyle +{ + public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; + DataSet^ myDataSet; + System::Windows::Forms::Button^ btnApplyStyles; + System::ComponentModel::Container^ components; + + public: + DataGridTableStyle_Sample() + { + components = nullptr; + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + + public: + ~DataGridTableStyle_Sample() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->btnApplyStyles = gcnew System::Windows::Forms::Button; + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // btnApplyStyles + // + this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->btnApplyStyles->Location = System::Drawing::Point( 88, 208 ); + this->btnApplyStyles->Name = "btnApplyStyles"; + this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); + this->btnApplyStyles->TabIndex = 1; + this->btnApplyStyles->Text = "Apply Custom Styles"; + this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); + + // + // myDataGrid + // + this->myDataGrid->BackColor = System::Drawing::SystemColors::Info; + this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->LinkColor = System::Drawing::Color::Gray; + this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); + this->myDataGrid->TabIndex = 0; + + // + // DataGridTableStyle_Sample + // + this->ClientSize = System::Drawing::Size( 384, 301 ); + array^formControls = {this->btnApplyStyles,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->Name = "DataGridTableStyle_Sample"; + this->Text = "DataGridTableStyle_Sample"; + this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ){} + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // + // + private: + void AddCustomDataTableStyle() + { + myDataGridTableStyle1 = gcnew DataGridTableStyle; + myDataGridTableStyle1->MappingNameChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::MappingNameChanged_Handler ); + myDataGridTableStyle1->GridLineStyleChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::GridLineStyleChanged_Handler ); + myDataGridTableStyle1->MappingName = "Customers"; + + // Set other properties. + myDataGridTableStyle1->AlternatingBackColor = Color::LightGray; + myDataGridTableStyle1->GridLineStyle = System::Windows::Forms::DataGridLineStyle::None; + + // Add a GridColumnStyle and set its MappingName. + DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; + myBoolCol->MappingName = "Current"; + myBoolCol->HeaderText = "IsCurrent Customer"; + myBoolCol->Width = 150; + myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); + + // Add a second column style. + DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; + myTextCol->MappingName = "custName"; + myTextCol->HeaderText = "Customer Name"; + myTextCol->Width = 250; + myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); + + // Create new ColumnStyle objects. + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + + // Use PropertyDescriptor to create a formatted column. + PropertyDescriptorCollection^ myPropertyDescriptorCollection = this->BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); + DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + + // Add the DataGridTableStyle Object* to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); + } + + void MappingNameChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "MappingName Changed", "DataGridTableStyle" ); + } + + void GridLineStyleChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "GridLineStyle Changed", "DataGridTableStyle" ); + } + // + // + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create Customer DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create Customer order table. + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Gamma"; + // Give the Current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } + + void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + AddCustomDataTableStyle(); + btnApplyStyles->Enabled = false; + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew SampleDataGridTableStyle::DataGridTableStyle_Sample ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp new file mode 100644 index 00000000000..ac30098513a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTableStyle_sample5/CPP/datagridtablestyle_sample5.cpp @@ -0,0 +1,257 @@ +// System::Windows::Forms::DataGridTableStyle::AlternatingBackColor; +// System::Windows::Forms::DataGridTableStyle::GridLineColor; +// System::Windows::Forms::DataGridTableStyle::GridLineColorChanged; + +/* The following example demonstrates properties 'GridLineColor', 'AlternatingBackColor' +and event 'GridLineColorChanged' of 'DataGridTableStyle' class. +It creates a Windows form, a DataSet containing two DataTable +objects, and a DataRelation that relates the two tables. A button on +the form changes the appearance of the grid by setting the GridLineColor +and AlternatingBackColor. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class DataGridTableStyle_Sample: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::DataGridTableStyle^ myDataGridTableStyle1; + DataSet^ myDataSet; + System::Windows::Forms::Button^ btnApplyStyles; + System::ComponentModel::Container^ components; + +public: + DataGridTableStyle_Sample() + { + components = nullptr; + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +public: + ~DataGridTableStyle_Sample() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->btnApplyStyles = gcnew System::Windows::Forms::Button; + this->myDataGrid = gcnew System::Windows::Forms::DataGrid; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // btnApplyStyles + // + this->btnApplyStyles->Font = gcnew System::Drawing::Font( "Arial",8.25F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->btnApplyStyles->Location = System::Drawing::Point( 88, 208 ); + this->btnApplyStyles->Name = "btnApplyStyles"; + this->btnApplyStyles->Size = System::Drawing::Size( 144, 40 ); + this->btnApplyStyles->TabIndex = 1; + this->btnApplyStyles->Text = "Apply Custom Styles"; + this->btnApplyStyles->Click += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::btnApplyStyles_Click ); + + // + // myDataGrid + // + this->myDataGrid->AlternatingBackColor = System::Drawing::SystemColors::Info; + this->myDataGrid->BackColor = System::Drawing::Color::Silver; + this->myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->LinkColor = System::Drawing::Color::Gray; + this->myDataGrid->Location = System::Drawing::Point( 48, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 312, 128 ); + this->myDataGrid->TabIndex = 0; + + // + // DataGridTableStyle_Sample + // + this->ClientSize = System::Drawing::Size( 384, 301 ); + array^formControls = {this->btnApplyStyles,this->myDataGrid}; + this->Controls->AddRange( formControls ); + this->Name = "DataGridTableStyle_Sample"; + this->Text = "DataGridTableStyle_Sample"; + this->Load += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::DataGridTableStyle_Sample_Load ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void DataGridTableStyle_Sample_Load( Object^ /*sender*/, EventArgs^ /*e*/ ){} + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + // The dataMember specifies that the Customers table should be displayed. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // + // + // +private: + void AddCustomDataTableStyle() + { + myDataGridTableStyle1 = gcnew DataGridTableStyle; + + // EventHandlers + myDataGridTableStyle1->GridLineColorChanged += gcnew System::EventHandler( this, &DataGridTableStyle_Sample::GridLineColorChanged_Handler ); + myDataGridTableStyle1->MappingName = "Customers"; + + // Set other properties. + myDataGridTableStyle1->AlternatingBackColor = System::Drawing::Color::Gold; + myDataGridTableStyle1->BackColor = System::Drawing::Color::White; + myDataGridTableStyle1->GridLineStyle = System::Windows::Forms::DataGridLineStyle::Solid; + myDataGridTableStyle1->GridLineColor = Color::Red; + + // Set the HeaderText and Width properties. + DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; + myBoolCol->MappingName = "Current"; + myBoolCol->HeaderText = "IsCurrent Customer"; + myBoolCol->Width = 150; + myDataGridTableStyle1->GridColumnStyles->Add( myBoolCol ); + + // Add a second column style. + DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; + myTextCol->MappingName = "custName"; + myTextCol->HeaderText = "Customer Name"; + myTextCol->Width = 250; + myDataGridTableStyle1->GridColumnStyles->Add( myTextCol ); + + // Create new ColumnStyle objects + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + + // Use a PropertyDescriptor to create a formatted column. + PropertyDescriptorCollection^ myPropertyDescriptorCollection = + BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); + + // Create a formatted column using a PropertyDescriptor. + DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( myPropertyDescriptorCollection[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + + // Add the DataGridTableStyle instances to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle1 ); + } + + void GridLineColorChanged_Handler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "GridLineColor Changed", "DataGridTableStyle" ); + } + // + // + // + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create Customer DataTables. + DataTable^ tCust = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create Customer order table. + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create three columns, and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "orderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the Customers table. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Gamma"; + + // Give the Current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + newRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + tOrders->Rows->Add( newRow2 ); + + } + } + } + + void btnApplyStyles_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + AddCustomDataTableStyle(); + btnApplyStyles->Enabled = false; + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew DataGridTableStyle_Sample ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp new file mode 100644 index 00000000000..60f1a720638 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn Format/CPP/datagridtextboxcolumn format.cpp @@ -0,0 +1,34 @@ +#using +#using +#using + +using namespace System; +using namespace System::Globalization; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +protected: + DataGrid^ myDataGrid; + + // +private: + void ChangeColumnCultureInfo() + { + /* Create a new CultureInfo Object* using the + the locale ID for Italy. */ + System::Globalization::CultureInfo^ ItalyCultureInfo = gcnew CultureInfo( 0x0410 ); + + /* Cast a column that holds numeric values to the + DataGridTextBoxColumn type, and set the FormatInfo + property to the new CultureInfo Object*. */ + DataGridTextBoxColumn^ myGridTextBoxColumn = + dynamic_cast(myDataGrid->TableStyles[ "Orders" ]-> + GridColumnStyles[ "OrderAmount" ]); + myGridTextBoxColumn->FormatInfo = ItalyCultureInfo; + myGridTextBoxColumn->Format = "c"; + } + // +}; + +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp new file mode 100644 index 00000000000..5d0a522b8e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBoxColumn_DataGridTextBoxColumn_2/CPP/datagridtextboxcolumn_2.cpp @@ -0,0 +1,147 @@ +// System::Windows::Forms::DataGridTextBoxColumn.DataGridTextBoxColumn(PropertyDescriptor*) +// System::Windows::Forms::DataGridTextBoxColumn.DataGridTextBoxColumn(PropertyDescriptor*, String*) + +/* +The following program demonstrates various constructors of +'DataGridTextBoxColumn' class. An instance of 'DataGrid' class is constructed and +it is associated with data source. When the button S"Change Appearance" is clicked, +the format of the Date column in the grid is modified to a specific format. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ myComponents; + Button^ myButton; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + +public: + MyForm() + { + // Required for Windows Form Designer support. + InitializeComponent(); + + // Call MyDataSource to bind the controls. + MyDataSource(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myComponents = gcnew System::ComponentModel::Container; + this->Text = "DataGrid Control Sample"; + this->myButton = gcnew Button; + myButton->Location = Point(24,16); + myButton->Size = System::Drawing::Size( 124, 30 ); + myButton->Text = "Change Appearance"; + myButton->Click += gcnew System::EventHandler( this, &MyForm::Button_Click ); + this->myDataGrid = gcnew DataGrid; + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 300, 200 ); + myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + } + + void MyDataSource() + { + // Create a DataSet with one table + CreateDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + +private: + void Button_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MyAddCustomDataTableStyle(); + myButton->Enabled = false; + } + + // + // +private: + void MyAddCustomDataTableStyle() + { + // Get the currency manager for 'myDataSet'. + CurrencyManager^ myCurrencyManger = dynamic_cast(this->BindingContext[ myDataSet ]); + DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; + myTableStyle->MappingName = "Customers"; + PropertyDescriptor^ proprtyDescriptorName = myCurrencyManger->GetItemProperties()[ "CustName" ]; + DataGridColumnStyle^ myCustomerNameStyle = gcnew DataGridTextBoxColumn( proprtyDescriptorName ); + myCustomerNameStyle->MappingName = "custName"; + myCustomerNameStyle->HeaderText = "Customer Name"; + myTableStyle->GridColumnStyles->Add( myCustomerNameStyle ); + + // Add style for 'Date' column. + PropertyDescriptor^ myDateDescriptor = myCurrencyManger->GetItemProperties()[ "Date" ]; + + // 'G' is for MM/dd/yyyy HH:mm:ss date format. + DataGridColumnStyle^ myDateStyle = gcnew DataGridTextBoxColumn( myDateDescriptor,"G" ); + myDateStyle->MappingName = "Date"; + myDateStyle->HeaderText = "Date"; + myDateStyle->Width = 150; + myTableStyle->GridColumnStyles->Add( myDateStyle ); + + // Add DataGridTableStyle instances to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle ); + } + // + // + + void CreateDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create an instance of 'DataTable'. + DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the table. + DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); + DataColumn^ myDate = gcnew DataColumn( "Date",System::DateTime::typeid ); + myCustomerTable->Columns->Add( myCustomerName ); + myCustomerTable->Columns->Add( myDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( myCustomerTable ); + + // Create two customers in the Customers Table. + DataRow^ myNewRow; + for ( int i = 1; i < 3; i++ ) + { + myNewRow = myCustomerTable->NewRow(); + + // Add the row to the Customers table. + myCustomerTable->Rows->Add( myNewRow ); + } + + // Populate customer name column. + myCustomerTable->Rows[ 0 ][ "custName" ] = "Customer1"; + myCustomerTable->Rows[ 1 ][ "custName" ] = "Customer2"; + + // Populate date column. + myCustomerTable->Rows[ 0 ][ "Date" ] = System::DateTime::Now; + myCustomerTable->Rows[ 1 ][ "Date" ] = System::DateTime::Today; + } +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp new file mode 100644 index 00000000000..cdb53ba5f48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_IsInEditOrNavigateMode/CPP/datagridtextbox_isineditornavigatemode.cpp @@ -0,0 +1,165 @@ +// System::Windows::Forms::DataGridTextBox::IsInEditOrNavigateMode + +/* The following program demonstrates the 'IsInEditOrNavigateMode' +property of the 'System::Windows::Forms::DataGridTextBox' class. +It creates a form with 'DataGrid' that has a 'DataTable'. +A DataGridTextBox is shown which is bound to the DataSet that +contains the 'DataTable'. A button is used to display the state of +'IsInEditOrNavigateMode' property. Editing of the +'DataGridTextBox' changes the value of 'IsInEditOrNavigateMode' +from true to false. */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class MyDataGridTextBox: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGridTableStyle^ myDataGridTableStyle; + DataGridTextBoxColumn^ myTextBoxColumn; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ myButton; + DataGridTextBox^ myDataGridTextBox; + +public: + MyDataGridTextBox() + { + components = nullptr; + + // Create the form. + InitializeComponent(); + + // Bind the controls. + MakeDataSet(); + } + +public: + + // Clean up any resources being used. + ~MyDataGridTextBox() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myDataGridTableStyle = gcnew DataGridTableStyle; + this->myDataGridTextBox = gcnew DataGridTextBox; + this->myTextBoxColumn = gcnew DataGridTextBoxColumn; + this->myDataGrid = gcnew DataGrid; + this->myButton = gcnew Button; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGridTextBox"; + this->MaximizeBox = false; + myDataGridTextBox->Location = Point(20,5); + myDataGridTextBox->Size = System::Drawing::Size( 100, 65 ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myButton->Location = Point(71,250); + myButton->Size = System::Drawing::Size( 150, 40 ); + myButton->Text = " IsInEditOrNavigateMode"; + myButton->Click += gcnew EventHandler( this, &MyDataGridTextBox::Button_ClickEvent ); + this->Controls->Add( myDataGrid ); + this->Controls->Add( myDataGridTextBox ); + this->Controls->Add( myButton ); + + // Create 'DataTableStyle' for the DataGrid. + AddCustomDataTableStyle(); + + // Set the properties of DataGridTextBox. + myDataGridTextBox->ScrollBars = ScrollBars::Vertical; + myDataGridTextBox->ForeColor = Color::Red; + myDataGridTextBox->Multiline = true; + myDataGridTextBox->WordWrap = true; + } + + void AddCustomDataTableStyle() + { + // Map the DataGridTableStyle to the Table name. + myDataGridTableStyle->MappingName = "Person"; + + // Set other properties. + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; + + // Map the DataGridColumnStyle to the Column name of the Table. + TextCol->MappingName = "PersonName"; + TextCol->HeaderText = "Person Name"; + TextCol->Width = 100; + myDataGridTableStyle->GridColumnStyles->Add( TextCol ); + myDataGridTableStyle->GridLineColor = Color::Aquamarine; + + // Add the DataGridTableStyle to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + } + + // Create a DataSet with a table and populate it. + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ tPer = gcnew DataTable( "Person" ); + DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); + tPer->Columns->Add( cPerName ); + myDataSet->Tables->Add( tPer ); + DataRow^ newRow1; + for ( int i = 1; i < 6; i++ ) + { + newRow1 = tPer->NewRow(); + tPer->Rows->Add( newRow1 ); + } + tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; + tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; + tPer->Rows[ 2 ][ "PersonName" ] = "John"; + tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; + tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; + + // Bind the 'DataSet' to the 'DataGrid'. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + myDataGridTextBox->DataBindings->Add( "Text", myDataSet, "Person::PersonName" ); + + // Set the DataGrid to the DataGridTextBox. + myDataGridTextBox->SetDataGrid( myDataGrid ); + } + + // + // Handle event to show the state of 'IsInEditOrNavigateMode'. +private: + void Button_ClickEvent( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGridTextBox->IsInEditOrNavigateMode ) + { + // DataGridTextBox has not been edited. + MessageBox::Show( "Editing of DataGridTextBox not begun, IsInEditOrNavigateMode = True" ); + } + else + { + // DataGridTextBox has been edited. + MessageBox::Show( "Editing of DataGridTextBox begun, IsInEditOrNavigateMode = False" ); + } + } + // +}; + +// Main entry point for the application. +int main() +{ + Application::Run( gcnew MyDataGridTextBox ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp new file mode 100644 index 00000000000..b315be37428 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGridTextBox_SetDataGrid/CPP/datagridtextbox_setdatagrid.cpp @@ -0,0 +1,149 @@ +// System::Windows::Forms::DataGridTextBox::DataGridTextBox +// System::Windows::Forms::DataGridTextBox::SetDataGrid + +/* The following example demonstrates the constructor for +'DataGridTextBox' and 'SetDataGrid' method of the +'System::Windows::Forms::DataGridTextBox' class. It creates +a form with 'DataGrid' which has a 'DataTable' in it. A +DataGridTextBox is shown which is bound to the DataSet +that contains the 'DataTable'. The 'DataGridTextBox' shows +the contents of the cell which is currently having the focus. +Any changes in either the cell or the 'DataGridTextBox' are +accepted. */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class MyDataGridTextBox: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGridTableStyle^ myDataGridTableStyle; + DataGridTextBoxColumn^ myTextBoxColumn; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + DataGridTextBox^ myDataGridTextBox; + +public: + MyDataGridTextBox() + { + components = nullptr; + + // + // Constructor for DataGridTextBox. + myDataGridTextBox = gcnew DataGridTextBox; + // + + // Create the form. + InitializeComponent(); + + // Bind the controls. + MakeDataSet(); + } + + // Clean up any resources being used. +public: + ~MyDataGridTextBox() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myDataGridTableStyle = gcnew DataGridTableStyle; + this->myDataGridTextBox = gcnew DataGridTextBox; + this->myTextBoxColumn = gcnew DataGridTextBoxColumn; + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGridTextBox"; + this->MaximizeBox = false; + myDataGridTextBox->Location = Point(20,5); + myDataGridTextBox->Size = System::Drawing::Size( 100, 65 ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + this->Controls->Add( myDataGrid ); + this->Controls->Add( myDataGridTextBox ); + + // Create 'DataTableStyle' for the DataGrid. + AddCustomDataTableStyle(); + + // Set the properties of DataGridTextBox. + myDataGridTextBox->ScrollBars = ScrollBars::Vertical; + myDataGridTextBox->ForeColor = Color::Red; + myDataGridTextBox->Multiline = true; + myDataGridTextBox->WordWrap = true; + } + + void AddCustomDataTableStyle() + { + // Map the DataGridTableStyle to the Table name. + myDataGridTableStyle->MappingName = "Person"; + + // Set other properties. + myDataGridTableStyle->AlternatingBackColor = Color::LightGray; + DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; + + // Map the DataGridColumnStyle to the column name of the Table. + TextCol->MappingName = "PersonName"; + TextCol->HeaderText = "Person Name"; + TextCol->Width = 100; + myDataGridTableStyle->GridColumnStyles->Add( TextCol ); + myDataGridTableStyle->GridLineColor = Color::Aquamarine; + + // Add the DataGridTableStyle to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myDataGridTableStyle ); + } + + // + // Create a DataSet with a table and populate it. +private: + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ tPer = gcnew DataTable( "Person" ); + DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); + tPer->Columns->Add( cPerName ); + myDataSet->Tables->Add( tPer ); + DataRow^ newRow1; + for ( int i = 1; i < 6; i++ ) + { + newRow1 = tPer->NewRow(); + tPer->Rows->Add( newRow1 ); + } + tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; + tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; + tPer->Rows[ 2 ][ "PersonName" ] = "John"; + tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; + tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; + + // Bind the 'DataSet' to the 'DataGrid'. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + myDataGridTextBox->DataBindings->Add( "Text", myDataSet, "Person::PersonName" ); + + // Set the DataGrid to the DataGridTextBox. + myDataGridTextBox->SetDataGrid( myDataGrid ); + } + // +}; + +// Main entry point for the application. +int main() +{ + Application::Run( gcnew MyDataGridTextBox ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp new file mode 100644 index 00000000000..5726cddc1ae --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_AllowNavigationChanged/CPP/mydatagrid_allownavigationchanged.cpp @@ -0,0 +1,213 @@ +// System::Windows::Forms::DataGrid::AllowNavigationChanged +// System::Windows::Forms::DataGrid::Navigate + +/* The following program demonstrates the 'AllowNavigationChanged' +and 'Navigate' events of 'System::Windows::Forms::DataGrid' class. +It creates a DataGrid onto a form. This Datagrid is linked +to two tables, Person (parent) table and Detail (child) table +which are related together by a 'DataRelation'. User can look +for the details of a person by navigating along. +The S"Toggle Navigation" button is used to set the +'AllowNavigation' property by toggling. When a property is set, +an event associated with it occurs and is confirmed by the +message shown by the alert message box. */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyDataGrid: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ myButton; + +public: + MyDataGrid() + { + components = nullptr; + + // Create form. + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +public: + + // Clean up any resources being used. + ~MyDataGrid() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myButton = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGrid Events"; + this->MaximizeBox = false; + myButton->Location = Point(85,15); + myButton->Size = System::Drawing::Size( 130, 40 ); + myButton->Text = "Toggle Navigation"; + myButton->Click += gcnew EventHandler( this, &MyDataGrid::myButton_Click ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 180 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->ReadOnly = true; + + // Call the methods that instantiate the Event Handlers. + CallAllowNavigationChanged(); + CallNavigate(); + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ tPer = gcnew DataTable( "Person" ); + DataTable^ tDet = gcnew DataTable( "Detail" ); + + // Create two columns, and add them to the Person table. + DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); + tPer->Columns->Add( cPerID ); + tPer->Columns->Add( cPerName ); + + // Create three columns, and add them to the Detail table. + DataColumn^ cDetID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cDetPh = gcnew DataColumn( "Phone" ); + tDet->Columns->Add( cDetID ); + tDet->Columns->Add( cDetPh ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tPer ); + myDataSet->Tables->Add( tDet ); + + // For each person create a DataRow variable. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "PersonDetail",cPerID,cDetID ); + myDataSet->Relations->Add( dr ); + + // Create five persons in the Person Table. + for ( int i = 1; i < 6; i++ ) + { + newRow1 = tPer->NewRow(); + newRow1[ "SSN" ] = i; + + // Add the row to the Person table. + tPer->Rows->Add( newRow1 ); + } + + // Give each person a distinct name. + tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; + tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; + tPer->Rows[ 2 ][ "PersonName" ] = "John"; + tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; + tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; + + // For each person, create a detail row in Detail table. + for ( int i = 0; i < 5; i++ ) + { + newRow2 = tDet->NewRow(); + newRow2[ "SSN" ] = tPer->Rows[ i ][ "SSN" ]; + newRow2[ "Phone" ] = 1000 + i; + + // Add the row to the 'Detail' table. + tDet->Rows->Add( newRow2 ); + } + } + + // +private: + // Create an instance of the 'AllowNavigationChanged' EventHandler. + void CallAllowNavigationChanged() + { + myDataGrid->AllowNavigationChanged += gcnew EventHandler( this, &MyDataGrid::Grid_AllowNavChange ); + } + + // Set the 'AllowNavigation' property on click of a button. +private: + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGrid->AllowNavigation ) + myDataGrid->AllowNavigation = false; + else + myDataGrid->AllowNavigation = true; + } + + // Raise the event when 'AllowNavigation' property is changed. +private: + void Grid_AllowNavChange( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ myString = "AllowNavigationChanged event raised, Navigation "; + bool myBool = myDataGrid->AllowNavigation; + + // Create appropriate alert message. + myString = String::Concat( myString, myBool ? (String^)" is " : " is not ", "allowed" ); + + // Show information about navigation. + MessageBox::Show( myString, "Navigation information" ); + } + // + + // + // Instantiate the 'Navigate' NavigateEventHandler. +private: + void CallNavigate() + { + myDataGrid->Navigate += gcnew NavigateEventHandler( this, &MyDataGrid::Grid_Navigate ); + } + + // Raise the event when navigating to another table. +private: + void Grid_Navigate( Object^ /*sender*/, NavigateEventArgs^ /*e*/ ) + { + // String variable used to show message. + String^ myString = "Navigate event raised, moved to another table"; + + // Show the message when navigating to another table. + MessageBox::Show( myString, "Table navigation information" ); + } + // +}; + +// Main entry point for the application. +int main() +{ + Application::Run( gcnew MyDataGrid ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp new file mode 100644 index 00000000000..b442982bfed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_BackgroundColorChanged/CPP/mydatagrid_backgroundcolorchanged.cpp @@ -0,0 +1,216 @@ +// System.Windows.Forms.DataGrid.BackButtonClick +// System.Windows.Forms.DataGrid.BackgroundColorChanged + +/* The following program demonstrates the 'BackButtonClick' +and 'BackgroundColorChanged' events of +'System.Windows.Forms.DataGrid' class. It creates a DataGrid +onto a form. This Datagrid is linked to two tables, +Person (parent) table and Detail (child) table which are related +together by a 'DataRelation'. User can look for the details of a +person by navigating along. The "Toggle Background Color" button +is used to set the 'BackgroundColor' property by toggling +the color. The BackButton can be clicked when user is in the +child table. When a property is set, an event associated with it +is raised which is confirmed by the message shown by the +alert message box. */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyDataGrid: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ myButton; + +public: + MyDataGrid() + { + // Create the form. + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +public: + + // Clean up any resources being used. + ~MyDataGrid() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myButton = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGrid Events"; + this->MaximizeBox = false; + myButton->Location = Point(85,15); + myButton->Size = System::Drawing::Size( 130, 40 ); + myButton->Text = "Toggle Background Color"; + myButton->Click += gcnew EventHandler( this, &MyDataGrid::myButton_Click ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->BackgroundColor = Color::Yellow; + myDataGrid->ReadOnly = true; + + // Call the methods that instantiate the Event Handlers. + CallBackButtonClick(); + CallBackgroundColorChanged(); + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ tPer = gcnew DataTable( "Person" ); + DataTable^ tDet = gcnew DataTable( "Detail" ); + + // Create two columns, and add them to the Person table. + DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); + tPer->Columns->Add( cPerID ); + tPer->Columns->Add( cPerName ); + + // Create three columns, and add them to the Detail table. + DataColumn^ cDetID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cDetPh = gcnew DataColumn( "Phone" ); + tDet->Columns->Add( cDetID ); + tDet->Columns->Add( cDetPh ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tPer ); + myDataSet->Tables->Add( tDet ); + + // For each person create a DataRow variable. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "PersonDetail",cPerID,cDetID ); + myDataSet->Relations->Add( dr ); + + // Create five persons in the Person Table. + for ( int i = 1; i < 6; i++ ) + { + newRow1 = tPer->NewRow(); + newRow1[ "SSN" ] = i; + + // Add the row to the Person table. + tPer->Rows->Add( newRow1 ); + } + + // Give each person a distinct name. + tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; + tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; + tPer->Rows[ 2 ][ "PersonName" ] = "John"; + tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; + tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; + + // For each person, create a detail row in Detail table. + for ( int i = 0; i < 5; i++ ) + { + newRow2 = tDet->NewRow(); + newRow2[ "SSN" ] = tPer->Rows[ i ][ "SSN" ]; + newRow2[ "Phone" ] = 1000 + i; + + // Add the row to the 'Detail' table. + tDet->Rows->Add( newRow2 ); + } + } + + // + // Create an instance of the 'BackButtonClick' EventHandler. +private: + void CallBackButtonClick() + { + myDataGrid->BackButtonClick += gcnew EventHandler( this, &MyDataGrid::Grid_BackClick ); + } + + // Raise the event when 'BackButton' on child table is clicked. + void Grid_BackClick( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // String variable used to show message. + String^ myString = "BackButtonClick event raised, showing parent table"; + + // Show information about Back button. + MessageBox::Show( myString, "Back button information" ); + } + // + + // + // Create an instance of the 'BackgroundColorChanged' EventHandler. +private: + void CallBackgroundColorChanged() + { + myDataGrid->BackgroundColorChanged += gcnew EventHandler( this, &MyDataGrid::Grid_ColChange ); + } + + // Set the 'BackgroundColor' property on click of button. + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGrid->BackgroundColor == Color::Yellow ) + { + myDataGrid->BackgroundColor = Color::Red; + } + else + { + myDataGrid->BackgroundColor = Color::Yellow; + } + } + + // Raise the event when 'Background' color of DataGrid changes. + void Grid_ColChange( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // String variable used to show message. + String^ myString = "BackgroundColorChanged event raised, changed to "; + + // Get the background color of DataGrid. + Color myColor = myDataGrid->BackgroundColor; + myString = String::Concat( myString, myColor ); + + // Show information about background color setting. + MessageBox::Show( myString, "Background color information" ); + } + // +}; + +// Main entry point for the application. +int main() +{ + Application::Run( gcnew MyDataGrid ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp new file mode 100644 index 00000000000..6c49a0581e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_CaptionVisibleChanged/CPP/mydatagrid_captionvisiblechanged.cpp @@ -0,0 +1,244 @@ +// System::Windows::Forms::DataGrid::CaptionVisibleChanged +// System::Windows::Forms::DataGrid::CurrentCellChanged +// System::Windows::Forms::DataGrid::Scroll + +/* The following program demonstrates the 'CaptionVisibleChanged', +'CurrentCellChanged' and 'Scroll' events of +'System::Windows::Forms::DataGrid' class. It creates a DataGrid +onto a form. This Datagrid is linked to two tables, +Person (parent) table and Detail (child) table which are related +together by a 'DataRelation'. User can look for the details of a +person by navigating along. The "Toggle Caption" button is used +to set the 'CaptionVisible' property by toggling. When a property +is set, an event associated with it is raised which is confirmed +by the message shown by the alert message box. */ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyDataGrid: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ myButton; + +public: + MyDataGrid() + { + components = nullptr; + + // Create form. + InitializeComponent(); + + // Call SetUp to bind the controls. + SetUp(); + } + +public: + + // Clean up any resources being used. + ~MyDataGrid() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myButton = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGrid Events"; + this->MaximizeBox = false; + myButton->Location = Point(85,15); + myButton->Size = System::Drawing::Size( 130, 40 ); + myButton->Text = "Toggle Caption"; + myButton->Click += gcnew EventHandler( this, &MyDataGrid::myButton_Click ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->ReadOnly = true; + + // Call the methods that instantiate the Event Handlers. + CallCaptionVisibleChanged(); + CallCurrentCellChanged(); + CallScroll(); + this->Controls->Add( myButton ); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ tPer = gcnew DataTable( "Person" ); + DataTable^ tDet = gcnew DataTable( "Detail" ); + + // Create two columns, and add them to the Person table. + DataColumn^ cPerID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cPerName = gcnew DataColumn( "PersonName" ); + tPer->Columns->Add( cPerID ); + tPer->Columns->Add( cPerName ); + + // Create three columns, and add them to the Detail table. + DataColumn^ cDetID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ cDetPh = gcnew DataColumn( "Phone" ); + tDet->Columns->Add( cDetID ); + tDet->Columns->Add( cDetPh ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( tPer ); + myDataSet->Tables->Add( tDet ); + + // For each person create a DataRow variable. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ dr = gcnew DataRelation( "PersonDetail",cPerID,cDetID ); + myDataSet->Relations->Add( dr ); + + // Create nine persons in the 'Person' Table. + for ( int i = 1; i < 10; i++ ) + { + newRow1 = tPer->NewRow(); + newRow1[ "SSN" ] = i; + + // Add the row to the 'Person' table. + tPer->Rows->Add( newRow1 ); + } + + // Give each person a distinct name. + tPer->Rows[ 0 ][ "PersonName" ] = "Robert"; + tPer->Rows[ 1 ][ "PersonName" ] = "Michael"; + tPer->Rows[ 2 ][ "PersonName" ] = "John"; + tPer->Rows[ 3 ][ "PersonName" ] = "Walter"; + tPer->Rows[ 4 ][ "PersonName" ] = "Simon"; + tPer->Rows[ 5 ][ "PersonName" ] = "Wilson"; + tPer->Rows[ 6 ][ "PersonName" ] = "Donald"; + tPer->Rows[ 7 ][ "PersonName" ] = "Bill"; + tPer->Rows[ 8 ][ "PersonName" ] = "James"; + + // For each person, create a detail row in 'Detail' table. + for ( int i = 0; i < 9; i++ ) + { + newRow2 = tDet->NewRow(); + newRow2[ "SSN" ] = tPer->Rows[ i ][ "SSN" ]; + newRow2[ "Phone" ] = 1000 + i; + + // Add the row to the 'Detail' table. + tDet->Rows->Add( newRow2 ); + } + } + + // + // Create an instance of the 'CaptionVisibleChanged' EventHandler. +private: + void CallCaptionVisibleChanged() + { + myDataGrid->CaptionVisibleChanged += gcnew EventHandler( this, &MyDataGrid::Grid_CaptionVisibleChanged ); + } + + // Set the 'CaptionVisible' property on click of a button. + void myButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if (myDataGrid->CaptionVisible) + myDataGrid->CaptionVisible = false; + else + myDataGrid->CaptionVisible = true; + } + + // Raise the event when 'CaptionVisible' property is changed. + void Grid_CaptionVisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // String variable used to show message. + String^ myString = "CaptionVisibleChanged event raised, caption is"; + + // Get the state of 'CaptionVisible' property. + bool myBool = myDataGrid->CaptionVisible; + + // Create appropriate alert message. + myString = String::Concat( myString, myBool ? (String^)" " : " not ", "visible" ); + + // Show information about caption of DataGrid. + MessageBox::Show( myString, "Caption information" ); + } + // + + // + // Create an instance of the 'CurrentCellChanged' EventHandler. +private: + void CallCurrentCellChanged() + { + myDataGrid->CurrentCellChanged += gcnew EventHandler( this, &MyDataGrid::Grid_CurCellChange ); + } + + // Raise the event when focus on DataGrid cell changes. + void Grid_CurCellChange( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // String variable used to show message. + String^ myString = "CurrentCellChanged event raised, cell focus is at "; + + // Get the co-ordinates of the focussed cell. + String^ myPoint = String::Concat( myDataGrid->CurrentCell.ColumnNumber, ", ", myDataGrid->CurrentCell.RowNumber ); + + // Create the alert message. + myString = String::Concat( myString, "(", myPoint, ")" ); + + // Show Co-ordinates when CurrentCellChanged event is raised. + MessageBox::Show( myString, "Current cell co-ordinates" ); + } + // + + // + // Create an instance of the 'Scroll' EventHandler. +private: + void CallScroll() + { + myDataGrid->Scroll += gcnew EventHandler( this, &MyDataGrid::Grid_Scroll ); + } + + // Raise the event when DataGrid is scrolled. + void Grid_Scroll( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // String variable used to show message. + String^ myString = "Scroll event raised, DataGrid is scrolled"; + + // Show the message when scrolling is done. + MessageBox::Show( myString, "Scroll information" ); + } + // +}; + +// Main entry point for the application. +int main() +{ + Application::Run( gcnew MyDataGrid ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp new file mode 100644 index 00000000000..2349ba3288f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ColorMembers/CPP/datagrid_10.cpp @@ -0,0 +1,731 @@ +// System::Windows::Forms::DataGrid.SelectionBackColor +// System::Windows::Forms::DataGrid.SelectionForeColor +// System::Windows::Forms::DataGrid.ResetSelectionBackColor +// System::Windows::Forms::DataGrid.ResetSelectionForeColor +// System::Windows::Forms::DataGrid.ResetBackColor +// System::Windows::Forms::DataGrid.ResetForeColor +// System::Windows::Forms::DataGrid.ForeColor +// System::Windows::Forms::DataGrid.ResetAlternatingBackColor +// System::Windows::Forms::DataGrid.ResetLinkColor +// System::Windows::Forms::DataGrid.ResetGridLineColor + +/* The following program demonstrates various members of +'System::Windows::Forms::DataGrid class' relating to Color. +It creates a windows form, a 'DataSet' containing two 'DataTable' +objects, and a 'DataRelation' that relates the two tables. To +display the data, a 'DataGrid' control is then bound to the +'DataSet' through the 'SetDataBinding' method. +Ten buttons are provided on form to demonstrate each property. +Effet of each property can be seen on 'DataGrid'. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace DataGridSample +{ + /// + /// Summary description for DatGridClass. + /// + public ref class DatGridClass: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::GroupBox^ groupBox1; + System::Windows::Forms::GroupBox^ groupBox2; + DataSet^ myDataSet; + System::Windows::Forms::DataGrid^ myDataGrid; + System::Windows::Forms::Button^ btnResetSelectionBkColor; + System::Windows::Forms::Button^ btnSeSelectiontBkColor; + System::Windows::Forms::Button^ btnSetSelectionForeColor; + System::Windows::Forms::Button^ btnResetSelectionForeColor; + System::Windows::Forms::Button^ btnSetForeColor; + System::Windows::Forms::Button^ btnResetForeColor; + System::Windows::Forms::Button^ btnSetBkColor; + System::Windows::Forms::Button^ btnResetBkColor; + System::Windows::Forms::GroupBox^ groupBox3; + System::Windows::Forms::Button^ btnResetLinkColor; + System::Windows::Forms::Button^ btnResetAlternatingBackColor; + System::Windows::Forms::Button^ btnSetLinkColor; + System::Windows::Forms::Button^ btnSetAlternatingBkColor; + System::Windows::Forms::GroupBox^ groupBox4; + System::Windows::Forms::Button^ btnResetGridLineColor; + System::Windows::Forms::Button^ btnSetGridLineColor; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + DatGridClass() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // Setup GridControl data. + SetUp(); + } + + public: + + /// + /// Clean up any resources being used. + /// + ~DatGridClass() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->btnResetBkColor = gcnew Button; + this->btnSetBkColor = gcnew Button; + this->btnResetForeColor = gcnew Button; + this->groupBox1 = gcnew GroupBox; + this->btnSeSelectiontBkColor = gcnew Button; + this->btnResetSelectionBkColor = gcnew Button; + this->btnSetSelectionForeColor = gcnew Button; + this->btnResetSelectionForeColor = gcnew Button; + this->groupBox2 = gcnew GroupBox; + this->btnSetForeColor = gcnew Button; + this->groupBox3 = gcnew GroupBox; + this->btnSetAlternatingBkColor = gcnew Button; + this->btnSetLinkColor = gcnew Button; + this->btnResetAlternatingBackColor = gcnew Button; + this->btnResetLinkColor = gcnew Button; + this->groupBox4 = gcnew GroupBox; + this->btnSetGridLineColor = gcnew Button; + this->btnResetGridLineColor = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->groupBox1->SuspendLayout(); + this->groupBox2->SuspendLayout(); + this->groupBox3->SuspendLayout(); + this->groupBox4->SuspendLayout(); + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // btnResetBkColor + // + this->btnResetBkColor->Location = System::Drawing::Point( 120, 56 ); + this->btnResetBkColor->Name = "btnResetBkColor"; + this->btnResetBkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnResetBkColor->TabIndex = 3; + this->btnResetBkColor->Text = "Reset background color"; + this->btnResetBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetBkColor_Click ); + + // + // btnSetBkColor + // + this->btnSetBkColor->Location = System::Drawing::Point( 120, 24 ); + this->btnSetBkColor->Name = "btnSetBkColor"; + this->btnSetBkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnSetBkColor->TabIndex = 2; + this->btnSetBkColor->Text = "Set background color"; + this->btnSetBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetBkColor_Click ); + + // + // btnResetForeColor + // + this->btnResetForeColor->Location = System::Drawing::Point( 16, 56 ); + this->btnResetForeColor->Name = "btnResetForeColor"; + this->btnResetForeColor->Size = System::Drawing::Size( 104, 32 ); + this->btnResetForeColor->TabIndex = 1; + this->btnResetForeColor->Text = "Reset foreground color"; + this->btnResetForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetForeColor_Click ); + + // + // groupBox1 + // + array^groupBox1Controls = {this->btnSeSelectiontBkColor,this->btnResetSelectionBkColor,this->btnSetSelectionForeColor,this->btnResetSelectionForeColor}; + this->groupBox1->Controls->AddRange( groupBox1Controls ); + this->groupBox1->Location = System::Drawing::Point( 296, 24 ); + this->groupBox1->Name = "groupBox1"; + this->groupBox1->Size = System::Drawing::Size( 248, 96 ); + this->groupBox1->TabIndex = 4; + this->groupBox1->TabStop = false; + + // + // btnSeSelectiontBkColor + // + this->btnSeSelectiontBkColor->Location = System::Drawing::Point( 125, 24 ); + this->btnSeSelectiontBkColor->Name = "btnSeSelectiontBkColor"; + this->btnSeSelectiontBkColor->Size = System::Drawing::Size( 112, 32 ); + this->btnSeSelectiontBkColor->TabIndex = 0; + this->btnSeSelectiontBkColor->Text = "Set selection background color"; + this->btnSeSelectiontBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetSelectionBkColor_Click ); + + // + // btnResetSelectionBkColor + // + this->btnResetSelectionBkColor->Location = System::Drawing::Point( 125, 56 ); + this->btnResetSelectionBkColor->Name = "btnResetSelectionBkColor"; + this->btnResetSelectionBkColor->Size = System::Drawing::Size( 112, 32 ); + this->btnResetSelectionBkColor->TabIndex = 1; + this->btnResetSelectionBkColor->Text = "Reset selection background color"; + this->btnResetSelectionBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetSelectionBkColor_Click ); + + // + // btnSetSelectionForeColor + // + this->btnSetSelectionForeColor->Location = System::Drawing::Point( 13, 24 ); + this->btnSetSelectionForeColor->Name = "btnSetSelectionForeColor"; + this->btnSetSelectionForeColor->Size = System::Drawing::Size( 112, 32 ); + this->btnSetSelectionForeColor->TabIndex = 2; + this->btnSetSelectionForeColor->Text = "Set selection foreground color"; + this->btnSetSelectionForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetSelectionForeColor_Click ); + + // + // btnResetSelectionForeColor + // + this->btnResetSelectionForeColor->Location = System::Drawing::Point( 13, 56 ); + this->btnResetSelectionForeColor->Name = "btnResetSelectionForeColor"; + this->btnResetSelectionForeColor->Size = System::Drawing::Size( 112, 32 ); + this->btnResetSelectionForeColor->TabIndex = 3; + this->btnResetSelectionForeColor->Text = "Reset selection foreground color"; + this->btnResetSelectionForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetSelectionForeColor_Click ); + + // + // groupBox2 + // + array^groupBox2Controls = {this->btnResetBkColor,this->btnSetBkColor,this->btnResetForeColor,this->btnSetForeColor}; + this->groupBox2->Controls->AddRange( groupBox2Controls ); + this->groupBox2->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + this->groupBox2->Location = System::Drawing::Point( 296, 128 ); + this->groupBox2->Name = "groupBox2"; + this->groupBox2->Size = System::Drawing::Size( 248, 96 ); + this->groupBox2->TabIndex = 5; + this->groupBox2->TabStop = false; + + // + // btnSetForeColor + // + this->btnSetForeColor->Location = System::Drawing::Point( 16, 24 ); + this->btnSetForeColor->Name = "btnSetForeColor"; + this->btnSetForeColor->Size = System::Drawing::Size( 104, 32 ); + this->btnSetForeColor->TabIndex = 0; + this->btnSetForeColor->Text = "Set foreground color"; + this->btnSetForeColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetForeColor_Click ); + + // + // groupBox3 + // + array^groupBox3Controls = {this->btnSetAlternatingBkColor,this->btnSetLinkColor,this->btnResetAlternatingBackColor,this->btnResetLinkColor}; + this->groupBox3->Controls->AddRange( groupBox3Controls ); + this->groupBox3->Location = System::Drawing::Point( 296, 224 ); + this->groupBox3->Name = "groupBox3"; + this->groupBox3->Size = System::Drawing::Size( 248, 96 ); + this->groupBox3->TabIndex = 7; + this->groupBox3->TabStop = false; + + // + // btnSetAlternatingBkColor + // + this->btnSetAlternatingBkColor->Location = System::Drawing::Point( 121, 24 ); + this->btnSetAlternatingBkColor->Name = "btnSetAlternatingBkColor"; + this->btnSetAlternatingBkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnSetAlternatingBkColor->TabIndex = 5; + this->btnSetAlternatingBkColor->Text = "Set alternating back color"; + this->btnSetAlternatingBkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetAlternatingBkColor_Click ); + + // + // btnSetLinkColor + // + this->btnSetLinkColor->Location = System::Drawing::Point( 17, 24 ); + this->btnSetLinkColor->Name = "btnSetLinkColor"; + this->btnSetLinkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnSetLinkColor->TabIndex = 4; + this->btnSetLinkColor->Text = "Set link color"; + this->btnSetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetLinkColor_Click ); + + // + // btnResetAlternatingBackColor + // + this->btnResetAlternatingBackColor->Location = System::Drawing::Point( 121, 56 ); + this->btnResetAlternatingBackColor->Name = "btnResetAlternatingBackColor"; + this->btnResetAlternatingBackColor->Size = System::Drawing::Size( 104, 32 ); + this->btnResetAlternatingBackColor->TabIndex = 3; + this->btnResetAlternatingBackColor->Text = "Reset alternating back color"; + this->btnResetAlternatingBackColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetAlternatingBackColor_Click ); + + // + // btnResetLinkColor + // + this->btnResetLinkColor->Location = System::Drawing::Point( 17, 56 ); + this->btnResetLinkColor->Name = "btnResetLinkColor"; + this->btnResetLinkColor->Size = System::Drawing::Size( 104, 32 ); + this->btnResetLinkColor->TabIndex = 1; + this->btnResetLinkColor->Text = "Reset link color"; + this->btnResetLinkColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetLinkColor_Click ); + + // + // groupBox4 + // + array^groupBox4Controls = {this->btnSetGridLineColor,this->btnResetGridLineColor}; + this->groupBox4->Controls->AddRange( groupBox4Controls ); + this->groupBox4->Location = System::Drawing::Point( 164, 226 ); + this->groupBox4->Name = "groupBox4"; + this->groupBox4->Size = System::Drawing::Size( 124, 93 ); + this->groupBox4->TabIndex = 8; + this->groupBox4->TabStop = false; + + // + // btnSetGridLineColor + // + this->btnSetGridLineColor->Location = System::Drawing::Point( 8, 16 ); + this->btnSetGridLineColor->Name = "btnSetGridLineColor"; + this->btnSetGridLineColor->Size = System::Drawing::Size( 104, 32 ); + this->btnSetGridLineColor->TabIndex = 3; + this->btnSetGridLineColor->Text = "Set grid line color"; + this->btnSetGridLineColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnSetGridLineColor_Click ); + + // + // btnResetGridLineColor + // + this->btnResetGridLineColor->Location = System::Drawing::Point( 8, 48 ); + this->btnResetGridLineColor->Name = "btnResetGridLineColor"; + this->btnResetGridLineColor->Size = System::Drawing::Size( 104, 32 ); + this->btnResetGridLineColor->TabIndex = 0; + this->btnResetGridLineColor->Text = "Reset grid line color"; + this->btnResetGridLineColor->Click += gcnew System::EventHandler( this, &DatGridClass::btnResetGridLineColor_Click ); + + // + // myDataGrid + // + this->myDataGrid->DataMember = ""; + this->myDataGrid->ForeColor = System::Drawing::Color::Blue; + this->myDataGrid->Location = System::Drawing::Point( 12, 32 ); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 272, 192 ); + this->myDataGrid->TabIndex = 6; + this->myDataGrid->ReadOnly = true; + + // + // DatGridClass + // + this->ClientSize = System::Drawing::Size( 560, 333 ); + array^dataGridClassControls = {this->groupBox4,this->groupBox3,this->myDataGrid,this->groupBox2,this->groupBox1}; + this->Controls->AddRange( dataGridClassControls ); + this->Name = "DatGridClass"; + this->Text = "Sample Program"; + this->groupBox1->ResumeLayout( false ); + this->groupBox2->ResumeLayout( false ); + this->groupBox3->ResumeLayout( false ); + this->groupBox4->ResumeLayout( false ); + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void SetUp() + { + // Create a 'DataSet' with two tables and one relation. + MakeDataSet(); + + // Bind the 'DataGrid' to the 'DataSet'. The data member + // specifies that the 'Customers Table' should be displayed. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // Create a 'DataSet' with two tables and populate it. + void MakeDataSet() + { + // Create a 'DataSet'. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create two 'DataTables'. + DataTable^ tCust = gcnew DataTable( "Customers" ); + DataTable^ tOrders = gcnew DataTable( "Orders" ); + + // Create two columns, and add them to the first table. + DataColumn^ cCustID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cCustName = gcnew DataColumn( "CustName" ); + DataColumn^ cCurrent = gcnew DataColumn( "Current",bool::typeid ); + tCust->Columns->Add( cCustID ); + tCust->Columns->Add( cCustName ); + tCust->Columns->Add( cCurrent ); + + // Create three columns and add them to the second table. + DataColumn^ cID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ cOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); + DataColumn^ cOrderAmount = gcnew DataColumn( "OrderAmount",String::typeid ); + tOrders->Columns->Add( cID ); + tOrders->Columns->Add( cOrderAmount ); + tOrders->Columns->Add( cOrderDate ); + + // Add the tables to the 'DataSet'. + myDataSet->Tables->Add( tCust ); + myDataSet->Tables->Add( tOrders ); + + // Create a 'DataRelation' and add it to the 'DataSet'. + DataRelation^ dr = gcnew DataRelation( "custToOrders",cCustID,cID ); + myDataSet->Relations->Add( dr ); + + // Populate the tables. For each customer and order, + // create need two 'DataRow' variables. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the 'Customers Table'. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = tCust->NewRow(); + newRow1[ "custID" ] = i; + + // Add the row to the 'Customers Table'. + tCust->Rows->Add( newRow1 ); + } + tCust->Rows[ 0 ][ "custName" ] = "Alpha"; + tCust->Rows[ 1 ][ "custName" ] = "Beta"; + tCust->Rows[ 2 ][ "custName" ] = "Omega"; + + // Give the current column a value. + tCust->Rows[ 0 ][ "Current" ] = true.ToString(); + tCust->Rows[ 1 ][ "Current" ] = true.ToString(); + tCust->Rows[ 2 ][ "Current" ] = false.ToString(); + + // For each customer, create five rows in the orders table. + double myNumber = 0; + String^ myString; + for ( int i = 1; i < 4; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = tOrders->NewRow(); + newRow2[ "CustID" ] = i; + newRow2[ "orderDate" ] = DateTime(2001,i,j * 2); + myNumber = i * 10 + j * .1; + myString = "$ "; + myString = String::Concat( myString, myNumber ); + newRow2[ "OrderAmount" ] = myString; + + // Add the row to the orders table. + tOrders->Rows->Add( newRow2 ); + } + } + } + + void btnSetSelectionBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Keep the user from selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color select to the current color. + myColorDialog->Color = myDataGrid->SelectionBackColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set selection background color to selected color. + myDataGrid->SelectionBackColor = myColorDialog->Color; + // + } + + void btnResetSelectionBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Selection backgound color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->SelectionBackColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset selection background color to default. + myDataGrid->ResetSelectionBackColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->SelectionBackColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Selection background color information" ); + // + } + + void btnSetSelectionForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Enable the help button. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->SelectionForeColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set selection foreground color to selected color. + myDataGrid->SelectionForeColor = myColorDialog->Color; + // + } + + void btnResetSelectionForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Selection foreground color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->SelectionForeColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset selection foreground color to default. + myDataGrid->ResetSelectionForeColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->SelectionForeColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Selection foreground color information" ); + // + } + + void btnSetForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Enable the help button. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->ForeColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set foreground color to selected color. + myDataGrid->ForeColor = myColorDialog->Color; + // + } + + void btnResetForeColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Foreground color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->ForeColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset foreground color to default. + myDataGrid->ResetForeColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->ForeColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Foreground color information" ); + // + } + + void btnSetBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->BackColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set background color to selected color. + myDataGrid->BackColor = myColorDialog->Color; + } + + void btnResetBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Backgound color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->BackColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset background color to default. + myDataGrid->ResetBackColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->BackColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Background color information" ); + // + } + + void btnResetGridLineColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Grid line color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->GridLineColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset grid line color to default. + myDataGrid->ResetGridLineColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->GridLineColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Grid line color information" ); + // + } + + void btnResetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Link color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->LinkColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset link color to default. + myDataGrid->ResetLinkColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->LinkColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Link line color information" ); + // + } + + void btnResetAlternatingBackColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // String variable used to show message. + String^ myString = "Alternating back color changed from: "; + + // Store current foreground color of selected cells. + Color myCurrentColor = myDataGrid->AlternatingBackColor; + myString = String::Concat( myString, myCurrentColor.ToString() ); + + // Reset alternating back color to default. + myDataGrid->ResetAlternatingBackColor(); + myString = String::Concat( myString, " to " ); + myString = String::Concat( myString, myDataGrid->AlternatingBackColor.ToString() ); + + // Show information about changes in color setting. + MessageBox::Show( myString, "Alternating back color information" ); + // + } + + void btnSetGridLineColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->GridLineColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set grid line color to selected color. + myDataGrid->GridLineColor = myColorDialog->Color; + } + + void btnSetLinkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->LinkColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set link color to selected color. + myDataGrid->LinkColor = myColorDialog->Color; + } + + void btnSetAlternatingBkColor_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Creates a common color dialog box. + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Allow the user to get help. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->AlternatingBackColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set alternating background color to selected color. + myDataGrid->AlternatingBackColor = myColorDialog->Color; + } + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +void main() +{ + Application::Run( gcnew DataGridSample::DatGridClass ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp new file mode 100644 index 00000000000..d9bfd97285c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ParentRowsLabelStyleChanged/CPP/datagrid_parentrowslabelstylechanged.cpp @@ -0,0 +1,197 @@ +/* +System::Windows::Forms::DataGrid::ParentRowsLabelStyleChanged +System::Windows::Forms::DataGrid::ParentRowsVisibleChanged + +The following program demonstrates the 'ParentRowsLabelStyleChanged', and +'ParentRowsVisibleChanged' events. It creates a DataGrid and +two DataTables, Person(parent) and Detail(child) which are related +together by a DataRelation, are linked to it. The S"Toggle LabelStyle" button +sets the 'ParentRowsLabelStyle' property and the S"Toggle Visible" button sets the +'ParentRowsVisible' property. When the events is raised a message will be displayed. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ toggleStyleButton; + Button^ toggleVisibleButton; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + SetUp(); + } + +public: + + // Clean up any resources being used. + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->toggleStyleButton = gcnew Button; + this->toggleVisibleButton = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGrid Events"; + this->MaximizeBox = false; + toggleStyleButton->Location = Point(70,15); + toggleStyleButton->Size = System::Drawing::Size( 130, 40 ); + toggleStyleButton->Text = "Toggle LabelStyle"; + toggleStyleButton->Click += gcnew EventHandler( this, &MyForm::ToggleStyle_Clicked ); + toggleVisibleButton->Location = Point(70,250); + toggleVisibleButton->Size = System::Drawing::Size( 130, 40 ); + toggleVisibleButton->Text = "Toggle Visible"; + toggleVisibleButton->Click += gcnew EventHandler( this, &MyForm::ToggleVisible_Clicked ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->ReadOnly = true; + + // Call the methods that instantiate the Event Handlers. + CallParentRowsLabelStyleChanged(); + CallParentRowsVisibleChanged(); + this->Controls->Add( toggleStyleButton ); + this->Controls->Add( toggleVisibleButton ); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ personTable = gcnew DataTable( "Person" ); + DataTable^ detailTable = gcnew DataTable( "Detail" ); + DataColumn^ personID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ personName = gcnew DataColumn( "PersonName" ); + personTable->Columns->Add( personID ); + personTable->Columns->Add( personName ); + DataColumn^ detailID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ detailPhone = gcnew DataColumn( "Phone" ); + detailTable->Columns->Add( detailID ); + detailTable->Columns->Add( detailPhone ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( personTable ); + myDataSet->Tables->Add( detailTable ); + DataRow^ newRow1; + DataRow^ newRow2; + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ myDataRelation = gcnew DataRelation( "PersonDetail",personID,detailID ); + myDataSet->Relations->Add( myDataRelation ); + for ( int i = 1; i < 4; i++ ) + { + newRow1 = personTable->NewRow(); + newRow1[ "SSN" ] = i; + personTable->Rows->Add( newRow1 ); + } + // Give each person a distinct name. + personTable->Rows[ 0 ][ "PersonName" ] = "Robert"; + personTable->Rows[ 1 ][ "PersonName" ] = "Michael"; + personTable->Rows[ 2 ][ "PersonName" ] = "John"; + + // For each person, create a detail row in 'Detail' table. + for ( int i = 0; i < 3; i++ ) + { + newRow2 = detailTable->NewRow(); + newRow2[ "SSN" ] = personTable->Rows[ i ][ "SSN" ]; + newRow2[ "Phone" ] = 1000 + i; + + // Add the row to the 'Detail' table. + detailTable->Rows->Add( newRow2 ); + } + } + + // +private: + void CallParentRowsLabelStyleChanged() + { + myDataGrid->ParentRowsLabelStyleChanged += gcnew EventHandler( this, &MyForm::DataGridParentRowsLabelStyleChanged_Clicked ); + } + + // Set the 'ParentRowsLabelStyle' property on click of a button. + void ToggleStyle_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGrid->ParentRowsLabelStyle.ToString()->Equals( "Both" ) ) + myDataGrid->ParentRowsLabelStyle = DataGridParentRowsLabelStyle::TableName; + else + myDataGrid->ParentRowsLabelStyle = DataGridParentRowsLabelStyle::Both; + } + + // raise the event when 'ParentRowsLabelStyle' property is changed. + void DataGridParentRowsLabelStyleChanged_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ myMessage = "ParentRowsLabelStyleChanged event raised, LabelStyle is : "; + + // Get the state of 'ParentRowsLabelStyle' property. + String^ myLabelStyle = myDataGrid->ParentRowsLabelStyle.ToString(); + myMessage = String::Concat( myMessage, myLabelStyle ); + MessageBox::Show( myMessage, "ParentRowsLabelStyle information" ); + } + // + + // +private: + void CallParentRowsVisibleChanged() + { + myDataGrid->ParentRowsVisibleChanged += gcnew EventHandler( this, &MyForm::DataGridParentRowsVisibleChanged_Clicked ); + } + + // Set the 'ParentRowsVisible' property on click of a button. + void ToggleVisible_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if (myDataGrid->ParentRowsVisible) + myDataGrid->ParentRowsVisible = false; + else + myDataGrid->ParentRowsVisible = true; + } + + // raise the event when 'ParentRowsVisible' property is changed. + void DataGridParentRowsVisibleChanged_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ myMessage = "ParentRowsVisibleChanged event raised, Parent row is : "; + bool visible = myDataGrid->ParentRowsVisible; + myMessage = String::Concat( myMessage, visible ? (String^)" " : " NOT ", "visible" ); + MessageBox::Show( myMessage, "ParentRowsVisible information" ); + } + // +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp new file mode 100644 index 00000000000..d959567cefc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_ShowParentDetailsButtonClick/CPP/datagrid_showparentdetailsbuttonclick.cpp @@ -0,0 +1,156 @@ +/* +System::Windows::Forms::DataGrid::ShowParentDetailsButtonClick + +The following program demonstrates the 'ShowParentDetailsButtonClick' +event of 'DataGrid' class. On the click of S"ParentDetailsButton" button in the +Datagrid, a message is displayed. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + SetUp(); + } + +public: + + // Clean up any resources being used. + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGrid Events"; + this->MaximizeBox = false; + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->ReadOnly = false; + + // Call the method that instantiate the Event Handlers. + CallShowParentDetailsButtonClick(); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create a DataSet with two tables and one relation. + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ personTable = gcnew DataTable( "Person" ); + DataTable^ detailTable = gcnew DataTable( "Detail" ); + + // Create two columns, and add them to the Person table. + DataColumn^ personID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ personName = gcnew DataColumn( "PersonName" ); + personTable->Columns->Add( personID ); + personTable->Columns->Add( personName ); + + // Create three columns, and add them to the Detail table. + DataColumn^ detailID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ detailPhone = gcnew DataColumn( "Phone" ); + detailTable->Columns->Add( detailID ); + detailTable->Columns->Add( detailPhone ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( personTable ); + myDataSet->Tables->Add( detailTable ); + + // For each person create a DataRow variable. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ myDataRelation = gcnew DataRelation( "PersonDetail",personID,detailID ); + myDataSet->Relations->Add( myDataRelation ); + + // Create persons in the 'Person' Table. + for ( int i = 1; i < 5; i++ ) + { + newRow1 = personTable->NewRow(); + newRow1[ "SSN" ] = i; + + // Add the row to the 'Person' table. + personTable->Rows->Add( newRow1 ); + + } + + // Give each person a distinct name. + personTable->Rows[ 0 ][ "PersonName" ] = "Robert"; + personTable->Rows[ 1 ][ "PersonName" ] = "Michael"; + personTable->Rows[ 2 ][ "PersonName" ] = "John"; + personTable->Rows[ 3 ][ "PersonName" ] = "Walter"; + + // For each person, create a detail row in 'Detail' table. + for ( int i = 0; i < 4; i++ ) + { + newRow2 = detailTable->NewRow(); + newRow2[ "SSN" ] = personTable->Rows[ i ][ "SSN" ]; + newRow2[ "Phone" ] = 1000 + i; + + // Add the row to the 'Detail' table. + detailTable->Rows->Add( newRow2 ); + + } + } + + // +private: + void CallShowParentDetailsButtonClick() + { + myDataGrid->ShowParentDetailsButtonClick += gcnew EventHandler( this, &MyForm::DataGridShowParentDetailsButtonClick_Clicked ); + } + + // raise the event when ParentDetailsButton is clicked. + void DataGridShowParentDetailsButtonClick_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ myMessage = "ShowParentDetailsButtonClick event raised"; + + // Show the message when event is raised. + MessageBox::Show( myMessage, "ShowParentDetailsButtonClick information" ); + } + // +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp b/snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp new file mode 100644 index 00000000000..534d7352340 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DataGrid_UnSelect/CPP/datagrid_unselect.cpp @@ -0,0 +1,145 @@ +/* +System::Windows::Forms::DataGrid::UnSelect + +The following program demonstrates the 'UnSelect' method of 'DataGrid' class. +On clicking the S"Unselect Row" button, the selected row of +the Datagrid is unselected. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ unselectButton; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + SetUp(); + } + +public: + + // Clean up any resources being used. + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->unselectButton = gcnew Button; + this->myDataGrid = gcnew DataGrid; + this->ClientSize = System::Drawing::Size( 292, 300 ); + this->Name = "DataGridForm"; + this->Text = "Testing DataGrid Events"; + this->MaximizeBox = false; + unselectButton->Location = Point(70,15); + unselectButton->Size = System::Drawing::Size( 130, 40 ); + unselectButton->Text = "Unselect Row"; + unselectButton->Click += gcnew EventHandler( this, &MyForm::UnselectRow_Clicked ); + myDataGrid->Location = Point(20,70); + myDataGrid->Size = System::Drawing::Size( 250, 170 ); + myDataGrid->CaptionText = "MS DataGrid Control"; + myDataGrid->ReadOnly = true; + this->Controls->Add( unselectButton ); + this->Controls->Add( myDataGrid ); + } + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Person" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ personTable = gcnew DataTable( "Person" ); + DataTable^ detailTable = gcnew DataTable( "Detail" ); + + // Create two columns, and add them to the Person table. + DataColumn^ personID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ personName = gcnew DataColumn( "PersonName" ); + personTable->Columns->Add( personID ); + personTable->Columns->Add( personName ); + + // Create three columns, and add them to the Detail table. + DataColumn^ detailID = gcnew DataColumn( "SSN",int::typeid ); + DataColumn^ detailPhone = gcnew DataColumn( "Phone" ); + detailTable->Columns->Add( detailID ); + detailTable->Columns->Add( detailPhone ); + myDataSet->Tables->Add( personTable ); + myDataSet->Tables->Add( detailTable ); + + // For each person create a DataRow variable. + DataRow^ newRow1; + DataRow^ newRow2; + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ myDataRelation = gcnew DataRelation( "PersonDetail",personID,detailID ); + myDataSet->Relations->Add( myDataRelation ); + + // Create persons in the 'Person' Table. + for ( int i = 1; i < 4; i++ ) + { + newRow1 = personTable->NewRow(); + newRow1[ "SSN" ] = i; + + // Add the row to the 'Person' table. + personTable->Rows->Add( newRow1 ); + } + + // Give each person a distinct name. + personTable->Rows[ 0 ][ "PersonName" ] = "Robert"; + personTable->Rows[ 1 ][ "PersonName" ] = "Michael"; + personTable->Rows[ 2 ][ "PersonName" ] = "John"; + + // For each person, create a detail row in 'Detail' table. + for ( int i = 0; i < 3; i++ ) + { + newRow2 = detailTable->NewRow(); + newRow2[ "SSN" ] = personTable->Rows[ i ][ "SSN" ]; + newRow2[ "Phone" ] = 1000 + i; + + // Add the row to the 'Detail' table. + detailTable->Rows->Add( newRow2 ); + } + } + + // + // On Click of Button "Unselect Row" this event is raised. +private: + void UnselectRow_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Unselect the current row from the Datagrid + myDataGrid->UnSelect( myDataGrid->CurrentRowIndex ); + } + // +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp new file mode 100644 index 00000000000..3300ea117e3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarFont/CPP/calendarfont.cpp @@ -0,0 +1,29 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyClass: public Form +{ + // +public: + MyClass() + { + // Create a new DateTimePicker. + DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; + array^ myClassControls = {dateTimePicker1}; + Controls->AddRange( myClassControls ); + dateTimePicker1->CalendarFont = gcnew System::Drawing::Font( + "Courier New", 8.25F, FontStyle::Italic, GraphicsUnit::Point, ((Byte)(0)) ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyClass ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp new file mode 100644 index 00000000000..77d21eed796 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarForeColor/CPP/calendarforecolor.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyClass: public Form +{ + // +public: + MyClass() + { + DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; + array^ myClassControls = {dateTimePicker1}; + Controls->AddRange( myClassControls ); + dateTimePicker1->CalendarForeColor = Color::Aqua; + } + // +}; + +[STAThread] +void main() +{ + Application::Run( gcnew MyClass ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp new file mode 100644 index 00000000000..218df451d69 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.CalendarMonthBackground/CPP/calendarmonthbackground.cpp @@ -0,0 +1,27 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyClass: public Form +{ + // +public: + MyClass() + { + DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; + array^ myClassControls = {dateTimePicker1}; + Controls->AddRange( myClassControls ); + dateTimePicker1->CalendarMonthBackground = Color::Aqua; + } + // +}; + +[STAThread] +void main() +{ + Application::Run( gcnew MyClass ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp new file mode 100644 index 00000000000..6dc36d77da5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DateTimePicker.Value/CPP/value.cpp @@ -0,0 +1,31 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyClass: public Form +{ + // +public: + MyClass() + { + // Create a new DateTimePicker + DateTimePicker^ dateTimePicker1 = gcnew DateTimePicker; + array^ myClassControls = {dateTimePicker1}; + Controls->AddRange( myClassControls ); + MessageBox::Show( dateTimePicker1->Value.ToString() ); + + dateTimePicker1->Value = DateTime::Now.AddDays( 1 ); + MessageBox::Show( dateTimePicker1->Value.ToString() ); + } + // +}; + +[STAThread] +void main() +{ + Application::Run( gcnew MyClass ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp new file mode 100644 index 00000000000..19388a445c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Demontrates Form Paint Event/CPP/form1.cpp @@ -0,0 +1,126 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + RcDraw = Rectangle(0,0,0,0); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::Form1_MouseDown ); + this->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::Form1_MouseUp ); + this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); + } + + // +private: + Rectangle RcDraw; + void Form1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Determine the initial rectangle coordinates... + RcDraw.X = e->X; + RcDraw.Y = e->Y; + } + + void Form1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Determine the width and height of the rectangle... + if ( e->X < RcDraw.X ) + { + RcDraw.Width = RcDraw.X - e->X; + RcDraw.X = e->X; + } + else + { + RcDraw.Width = e->X - RcDraw.X; + } + + if ( e->Y < RcDraw.Y ) + { + RcDraw.Height = RcDraw.Y - e->Y; + RcDraw.Y = e->Y; + } + else + { + RcDraw.Height = e->Y - RcDraw.Y; + } + + // Force a repaint of the region occupied by the rectangle... + this->Invalidate( RcDraw ); + } + + void Form1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) + { + // Draw the rectangle... + float PenWidth = 5; + e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,PenWidth ), RcDraw ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp new file mode 100644 index 00000000000..c5aded8ae95 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerCollectionExample/CPP/examplecomponent.cpp @@ -0,0 +1,43 @@ +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Security::Permissions; + +public ref class ExampleComponent: public Component +{ +public: + ExampleComponent() + { + IDesignerHost^ designerhost1 = nullptr; + IDesignerHost^ designerhost2 = nullptr; + + // + // Create a DesignerCollection using a constructor + // that accepts an array of IDesignerHost objects with + // which to initialize the array. + array^temp0 = {designerhost1,designerhost2}; + DesignerCollection^ collection = gcnew DesignerCollection( temp0 ); + // + } + + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + void OutputDesignerCollectionInfo( DesignerCollection^ collection ) + { + + // + // Get the number of elements in the collection. + int count = collection->Count; + // + + // + // Access each IDesignerHost in the DesignerCollection using + // the collection's indexer property, and output the class name + // of the root component associated with each IDesignerHost. + for ( int i = 0; i < collection->Count; i++ ) + Console::WriteLine( collection[ i ]->RootComponentClassName ); + // + } +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp new file mode 100644 index 00000000000..32c192263a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerEventArgsExample/CPP/designereventargsexample.cpp @@ -0,0 +1,29 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class DesignerEventArgsExample + { + public: + DesignerEventArgsExample() + { + } + + // + // This example method creates a DesignerEventArgs using the specified designer host. + // Typically, this type of event args is created by the IDesignerEventService. + DesignerEventArgs^ CreateComponentEventArgs( IDesignerHost^ host ) + { + DesignerEventArgs^ args = gcnew DesignerEventArgs( host ); + + // The designer host of the created or disposed document: args.Component + + return args; + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp new file mode 100644 index 00000000000..8923e3bd492 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerEventHandlerExample/CPP/designereventhandlerexample.cpp @@ -0,0 +1,36 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class DesignerEventHandlerExample + { + private: + DesignerEventHandlerExample() + { + } + + // + public: + void LinkDesignerEvent( IDesignerEventService^ eventService ) + { + // Registers an event handler for the DesignerCreated and DesignerDisposed events. + eventService->DesignerCreated += gcnew DesignerEventHandler( + this, &DesignerEventHandlerExample::OnDesignerEvent ); + eventService->DesignerDisposed += gcnew DesignerEventHandler( + this, &DesignerEventHandlerExample::OnDesignerEvent ); + } + + private: + void OnDesignerEvent( Object^ sender, DesignerEventArgs^ e ) + { + // Displays designer event information on the console. + Console::WriteLine( "Name of the root component of the created or disposed designer: " + + e->Designer->RootComponentClassName ); + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp new file mode 100644 index 00000000000..e1c13af4455 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerHostAcquisition/CPP/source.cpp @@ -0,0 +1,29 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +namespace DesignerHostTest +{ + public ref class DesignerHostDesigner: public ComponentDesigner + { + public: + DesignerHostDesigner(){} + + virtual void DoDefaultAction() override + { + // + // Requests an IDesignerHost service from the design time environment using Component.Site.GetService() + IDesignerHost^ dh = static_cast(this->Component->Site->GetService( IDesignerHost::typeid )); + // + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp new file mode 100644 index 00000000000..52f9b5a691a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerSerializerAttribute/CPP/source.cpp @@ -0,0 +1,41 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Windows::Forms; + +namespace ExampleControl +{ + public ref class ExampleSerializer: public CodeDomSerializer + { + public: + ExampleSerializer(){} + + virtual Object^ Deserialize( IDesignerSerializationManager^ /*manager*/, Object^ /*codeObject*/ ) override + { + return nullptr; + } + + virtual Object^ Serialize( IDesignerSerializationManager^ /*manager*/, Object^ /*value*/ ) override + { + return nullptr; + } + }; + + // + [DesignerSerializerAttribute(ExampleSerializer::typeid,CodeDomSerializer::typeid)] + public ref class ExampleControl: public UserControl + { + public: + ExampleControl() + { + + } + }; + // +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp new file mode 100644 index 00000000000..5a435721cde --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerTransaction Sample/CPP/source.cpp @@ -0,0 +1,196 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +/* +This sample demonstrates how to perform a series of actions in a designer +transaction, how to change values of properties of a component from a +designer, and how to complete transactions without being interrupted +by other activities. + +To run this sample, add this code to a class library project and compile. +Create a new Windows Forms project or load a form in the designer. Add a +reference to the class library that was compiled in the first step. +Right-click the Toolbox in design mode and click Customize Toolbox. +Browse to the class library that was compiled in the first step and +select OK until the DTComponent item appears in the Toolbox. Add an +instance of this component to the form. + +When the component is created and added to the component tray for your +design project, the Initialize method of the designer is called. +This method displays a message box informing you that designer transaction +event handlers will be registered unless you click Cancel. When you set +properties in the properties window, each change will be encapsulated in +a designer transaction, allowing the change to be undone later. + +When you right-click the component, the shortcut menu for the component +is displayed. The designer constructs this menu according to whether +designer transaction notifications are enabled, and offers the option +of enabling or disabling the notifications, depending on the current +mode. The shortcut menu also presents a Perform Example Transaction +item, which will set the values of the component's StringProperty and +CountProperty properties. You can undo the last designer transaction using +the Undo command provided by the Visual Studio development environment. +*/ + +private ref class DTDesigner: public ComponentDesigner +{ +private: + bool notification_mode; + int count; + void LinkDTNotifications( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( !notification_mode ) + { + IDesignerHost^ host = dynamic_cast(GetService( IDesignerHost::typeid )); + if ( host != nullptr ) + { + notification_mode = true; + host->TransactionOpened += gcnew EventHandler( this, &DTDesigner::OnDesignerTransactionOpened ); + host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler( this, &DTDesigner::OnDesignerTransactionClosed ); + } + } + } + + void UnlinkDTNotifications( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( notification_mode ) + { + IDesignerHost^ host = dynamic_cast(GetService( IDesignerHost::typeid )); + if ( host != nullptr ) + { + notification_mode = false; + host->TransactionOpened -= gcnew EventHandler( this, &DTDesigner::OnDesignerTransactionOpened ); + host->TransactionClosed -= gcnew DesignerTransactionCloseEventHandler( this, &DTDesigner::OnDesignerTransactionClosed ); + } + } + } + + void OnDesignerTransactionOpened( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + MessageBox::Show( "A Designer Transaction was started. (TransactionOpened)" ); + } + + void OnDesignerTransactionClosed( Object^ /*sender*/, DesignerTransactionCloseEventArgs^ /*e*/ ) + { + MessageBox::Show( "A Designer Transaction was completed. (TransactionClosed)" ); + } + + void DoTransaction( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IDesignerHost^ host = static_cast(GetService( IDesignerHost::typeid )); + DesignerTransaction^ t = host->CreateTransaction( "Change Text and Size" ); + + /* The code within the using statement is considered to be a single transaction. + When the user selects Undo, the system will undo everything executed in this code block. + */ + if ( notification_mode ) + MessageBox::Show( "Entering a Designer-Initiated Designer Transaction" ); + + // The .NET Framework automatically associates the TypeDescriptor with the correct component + PropertyDescriptor^ someText = TypeDescriptor::GetProperties( Component )[ "StringProperty" ]; + someText->SetValue( Component, "This text was set by the designer for this component." ); + PropertyDescriptor^ anInteger = TypeDescriptor::GetProperties( Component )[ "CountProperty" ]; + anInteger->SetValue( Component, count ); + count++; + + // Complete the designer transaction. + t->Commit(); + if ( notification_mode ) + MessageBox::Show( "Designer-Initiated Designer Transaction Completed" ); + } + +public: + property DesignerVerbCollection^ Verbs + { + // The Verbs property is overridden from ComponentDesigner + virtual DesignerVerbCollection^ get() override + { + DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; + dvc->Add( gcnew DesignerVerb( "Perform Example Transaction",gcnew EventHandler( this, &DTDesigner::DoTransaction ) ) ); + if ( notification_mode ) + dvc->Add( gcnew DesignerVerb( "End Designer Transaction Notifications", + gcnew EventHandler( this, &DTDesigner::UnlinkDTNotifications ) ) ); + else + dvc->Add( gcnew DesignerVerb( "Show Designer Transaction Notifications", + gcnew EventHandler( this, &DTDesigner::LinkDTNotifications ) ) ); + + return dvc; + } + } + virtual void Initialize( IComponent^ component ) override + { + ComponentDesigner::Initialize( component ); + notification_mode = false; + count = 10; + IDesignerHost^ host = dynamic_cast(GetService( IDesignerHost::typeid )); + if ( host == nullptr ) + { + MessageBox::Show( "The IDesignerHost service interface could not be obtained." ); + return; + } + + if ( MessageBox::Show( "Press the Yes button to display notification message boxes for the designer transaction opened and closed notifications.", "Link DesignerTransaction Notifications?", MessageBoxButtons::YesNo, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign ) == DialogResult::Yes ) + { + host->TransactionOpened += gcnew EventHandler( this, &DTDesigner::OnDesignerTransactionOpened ); + host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler( this, &DTDesigner::OnDesignerTransactionClosed ); + notification_mode = true; + } + } + +public: + ~DTDesigner() + { + UnlinkDTNotifications( this, gcnew EventArgs ); + } +}; + +// Associate the DTDesigner with this component + +[DesignerAttribute(DTDesigner::typeid)] +public ref class DTComponent: public System::ComponentModel::Component +{ +private: + String^ m_String; + int m_Count; + void InitializeComponent() + { + m_String = "Initial Value"; + m_Count = 0; + } + +public: + property String^ StringProperty + { + String^ get() + { + return m_String; + } + + void set( String^ value ) + { + m_String = value; + } + } + + property int CountProperty + { + int get() + { + return m_Count; + } + + void set( int value ) + { + m_Count = value; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp new file mode 100644 index 00000000000..5044a5b8b2f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventArgsExample/CPP/designertransactioncloseeventargsexample.cpp @@ -0,0 +1,31 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class DesignerTransactionCloseEventArgsExample + { + public: + DesignerTransactionCloseEventArgsExample() + { + } + + // + public: + // This example method creates a DesignerTransactionCloseEventArgs using the specified argument. + // Typically, this type of event args is created by a design mode subsystem. + DesignerTransactionCloseEventArgs^ CreateDesignerTransactionCloseEventArgs( bool commit ) + { + // Creates a component changed event args with the specified arguments. + DesignerTransactionCloseEventArgs^ args = gcnew DesignerTransactionCloseEventArgs( commit ); + + // Whether the transaction has been committed: args.TransactionCommitted + + return args; + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp new file mode 100644 index 00000000000..7ce84caf594 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerTransactionCloseEventHandlerExample/CPP/designertransactioncloseeventhandlerexample.cpp @@ -0,0 +1,42 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; + +namespace MiscCompModSamples +{ + public ref class DesignerTransactionCloseEventHandlerExample + { + private: + DesignerTransactionCloseEventHandlerExample() + { + } + + // + public: + void LinkDesignerTransactionCloseEvent( IDesignerHost^ host ) + { + // Registers an event handler for the designer TransactionClosing and TransactionClosed events. + host->TransactionClosing += gcnew DesignerTransactionCloseEventHandler( + this, &DesignerTransactionCloseEventHandlerExample::OnTransactionClose ); + host->TransactionClosed += gcnew DesignerTransactionCloseEventHandler( + this, &DesignerTransactionCloseEventHandlerExample::OnTransactionClose ); + } + + private: + void OnTransactionClose( Object^ sender, DesignerTransactionCloseEventArgs^ e ) + { + // Displays transaction close information on the console. + if ( e->TransactionCommitted ) + { + Console::WriteLine( "Transaction has been committed." ); + } + else + { + Console::WriteLine( "Transaction has not yet been committed." ); + } + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp new file mode 100644 index 00000000000..8ede6b8cfa2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerVerb Example/CPP/component1.cpp @@ -0,0 +1,65 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +/* This sample demonstrates a designer that adds menu commands +to the design-time shortcut menu for a component. + +To test this sample, build the code for the component as a class library, +add the resulting component to the toolbox, open a form in design mode, +and drag the component from the toolbox onto the form. + +The component should appear in the component tray beneath the form. +Right-click the component. The verbs should appear in the shortcut menu. +*/ +// This is a designer class which provides designer verb menu commands for +// the associated component. This code is called by the design environment at design-time. +private ref class MyDesigner: public ComponentDesigner +{ +public: + + property DesignerVerbCollection^ Verbs + { + // DesignerVerbCollection is overridden from ComponentDesigner + virtual DesignerVerbCollection^ get() override + { + if ( m_Verbs == nullptr ) + { + // Create and initialize the collection of verbs + m_Verbs = gcnew DesignerVerbCollection; + m_Verbs->Add( gcnew DesignerVerb( "First Designer Verb",gcnew EventHandler( this, &MyDesigner::OnFirstItemSelected ) ) ); + m_Verbs->Add( gcnew DesignerVerb( "Second Designer Verb",gcnew EventHandler( this, &MyDesigner::OnSecondItemSelected ) ) ); + } + + return m_Verbs; + } + } + MyDesigner(){} + +private: + DesignerVerbCollection^ m_Verbs; + void OnFirstItemSelected( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + // Display a message + MessageBox::Show( "The first designer verb was invoked." ); + } + + void OnSecondItemSelected( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + // Display a message + MessageBox::Show( "The second designer verb was invoked." ); + } +}; + +// Associate MyDesigner with this component type using a DesignerAttribute +[Designer(MyDesigner::typeid)] +public ref class Component1: public System::ComponentModel::Component{}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..b5680923ecf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DesignerVerbCollectionExample/CPP/class1.cpp @@ -0,0 +1,85 @@ +#using + +using namespace System; +using namespace System::ComponentModel::Design; +using namespace System::Security::Permissions; + +namespace DesignerVerbCollectionExample +{ + public ref class Class1 + { + private: + void ExampleEvent( Object^ sender, EventArgs^ e ) + { + } + + public: + // DesignerVerbCollection + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + void DesignerVerbCollectionExample() + { + // + // + // Creates an empty DesignerVerbCollection. + DesignerVerbCollection^ collection = gcnew DesignerVerbCollection; + // + + // + // Adds a DesignerVerb to the collection. + collection->Add( gcnew DesignerVerb( "Example designer verb",gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); + // + + // + // Adds an array of DesignerVerb objects to the collection. + array^ verbs = { + gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ), + gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) )}; + collection->AddRange( verbs ); + + // Adds a collection of DesignerVerb objects to the collection. + DesignerVerbCollection^ verbsCollection = gcnew DesignerVerbCollection; + verbsCollection->Add( gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); + verbsCollection->Add( gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); + collection->AddRange( verbsCollection ); + // + + // + // Tests for the presence of a DesignerVerb in the collection, + // and retrieves its index if it is found. + DesignerVerb^ testVerb = gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ); + int itemIndex = -1; + if ( collection->Contains( testVerb ) ) + itemIndex = collection->IndexOf( testVerb ); + // + + // + // Copies the contents of the collection, beginning at index 0, + // to the specified DesignerVerb array. + // 'verbs' is a DesignerVerb array. + collection->CopyTo( verbs, 0 ); + // + + // + // Retrieves the count of the items in the collection. + int collectionCount = collection->Count; + // + + // + // Inserts a DesignerVerb at index 0 of the collection. + collection->Insert( 0, gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ) ); + // + + // + // Removes the specified DesignerVerb from the collection. + DesignerVerb^ verb = gcnew DesignerVerb( "Example designer verb", gcnew EventHandler( this, &Class1::ExampleEvent ) ); + collection->Remove( verb ); + // + + // + // Removes the DesignerVerb at index 0. + collection->RemoveAt( 0 ); + // + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp new file mode 100644 index 00000000000..64f86526df9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DisplayRectangle1/CPP/form1.cpp @@ -0,0 +1,48 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + Rectangle myTabRect; + +public: + Form1() + { + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; + tabControl1->Appearance = TabAppearance::Buttons; + tabControl1->Location = Point(25,25); + tabControl1->Controls->Add( tabPage1 ); + Controls->Add( tabControl1 ); + + // Gets a Rectangle that represents the tab page display area of tabControl1. + myTabRect = tabControl1->DisplayRectangle; + myTabRect.Inflate( 1, 1 ); + tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::DrawOnTabPage ); + } + + +private: + void DrawOnTabPage( Object^ /*sender*/, DrawItemEventArgs^ e ) + { + Graphics^ g = e->Graphics; + Pen^ p = gcnew Pen( Color::Blue ); + g->DrawRectangle( p, myTabRect ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp new file mode 100644 index 00000000000..c14974a24ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DlgOpenFileReadOnly/CPP/form1.cpp @@ -0,0 +1,112 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; + +namespace DlgOpenFileReadOnly_CS +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + protected: + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + OpenFile(); + } + + // + private: + FileStream^ OpenFile() + { + // Displays an OpenFileDialog and shows the read/only files. + OpenFileDialog^ dlgOpenFile = gcnew OpenFileDialog; + dlgOpenFile->ShowReadOnly = true; + if ( dlgOpenFile->ShowDialog() == ::DialogResult::OK ) + { + // If ReadOnlyChecked is true, uses the OpenFile method to + // open the file with read/only access. + if ( dlgOpenFile->ReadOnlyChecked ) + { + return dynamic_cast(dlgOpenFile->OpenFile()); + } + // Otherwise, opens the file with read/write access. + else + { + String^ path = dlgOpenFile->FileName; + return gcnew FileStream( path,System::IO::FileMode::Open,System::IO::FileAccess::ReadWrite ); + } + } + + return nullptr; + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew DlgOpenFileReadOnly_CS::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp b/snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp new file mode 100644 index 00000000000..515da262025 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DrawItem/CPP/drawitem.cpp @@ -0,0 +1,62 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + Rectangle tabArea; + RectangleF tabTextArea; + +public: + Form1() + { + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + + // Allows access to the DrawItem event. + tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; + tabControl1->SizeMode = TabSizeMode::Fixed; + tabControl1->Controls->Add( tabPage1 ); + tabControl1->ItemSize = System::Drawing::Size( 80, 30 ); + tabControl1->Location = Point(25,25); + tabControl1->Size = System::Drawing::Size( 250, 250 ); + tabPage1->TabIndex = 0; + ClientSize = System::Drawing::Size( 300, 300 ); + Controls->Add( tabControl1 ); + tabArea = tabControl1->GetTabRect( 0 ); + tabTextArea = tabControl1->GetTabRect( 0 ); + + // Binds the event handler DrawOnTab to the DrawItem event + // through the DrawItemEventHandler delegate. + tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::DrawOnTab ); + } + + +private: + + // Declares the event handler DrawOnTab which is a method that + // draws a String* and Rectangle on the tabPage1 tab. + void DrawOnTab( Object^ /*sender*/, DrawItemEventArgs^ e ) + { + Graphics^ g = e->Graphics; + Pen^ p = gcnew Pen( Color::Blue ); + System::Drawing::Font^ font = gcnew System::Drawing::Font( "Arial",10.0f ); + SolidBrush^ brush = gcnew SolidBrush( Color::Red ); + g->DrawRectangle( p, tabArea ); + g->DrawString( "tabPage1", font, brush, tabTextArea ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp b/snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp new file mode 100644 index 00000000000..cf8e82d4e77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/DrawMode/CPP/drawmode.cpp @@ -0,0 +1,51 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + Rectangle myTabRect; + +public: + Form1() + { + tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + + // Sets the tabs to be drawn by the parent window Form1. + // OwnerDrawFixed allows access to DrawItem. + tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; + tabControl1->Controls->Add( tabPage1 ); + tabControl1->Location = Point(25,25); + tabControl1->Size = System::Drawing::Size( 250, 250 ); + tabPage1->TabIndex = 0; + myTabRect = tabControl1->GetTabRect( 0 ); + ClientSize = System::Drawing::Size( 300, 300 ); + Controls->Add( tabControl1 ); + tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::OnDrawItem ); + } + + +private: + void OnDrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) + { + Graphics^ g = e->Graphics; + Pen^ p = gcnew Pen( Color::Blue ); + g->DrawRectangle( p, myTabRect ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp new file mode 100644 index 00000000000..304c370b671 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/EditorAttributesExample/CPP/class1.cpp @@ -0,0 +1,132 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Web::UI::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +namespace EditorAttributeExamples +{ + public ref class Class1: public System::ComponentModel::Component + { + // System::ComponentModel::Design::CollectionEditor EditorAttribute example + // + public: + [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, + System::Drawing::Design::UITypeEditor::typeid)] + property ICollection^ testCollection + { + ICollection^ get() + { + return Icollection; + } + void set( ICollection^ value ) + { + Icollection = value; + } + } + private: + ICollection^ Icollection; + // + + // System::Drawing::Design::FontEditor EditorAttribute example + // + public: + [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, + System::Drawing::Design::UITypeEditor::typeid)] + property System::Drawing::Font^ testFont + { + System::Drawing::Font^ get() + { + return font; + } + void set( System::Drawing::Font^ value ) + { + font = value; + } + } + private: + Font^ font; + // + + // System::Drawing::Design::ImageEditor EditorAttribute example + // + public: + [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, + System::Drawing::Design::UITypeEditor::typeid)] + property Image^ testImage + { + Image^ get() + { + return testImg; + } + void set( Image^ value ) + { + testImg = value; + } + } + private: + Image^ testImg; + // + + // System::Windows::Forms::Design::AnchorEditor EditorAttribute example + // + public: + [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, + System::Drawing::Design::UITypeEditor::typeid)] + property System::Windows::Forms::AnchorStyles testAnchor + { + System::Windows::Forms::AnchorStyles get() + { + return anchor; + } + void set( System::Windows::Forms::AnchorStyles value ) + { + anchor = value; + } + } + private: + AnchorStyles anchor; + // + + // System::Windows::Forms::Design::FileNameEditor EditorAttribute example + // + public: + [EditorAttribute(System::ComponentModel::Design::CollectionEditor::typeid, + System::Drawing::Design::UITypeEditor::typeid)] + property String^ testFilename + { + String^ get() + { + return filename; + } + void set( String^ value ) + { + filename = value; + } + } + private: + String^ filename; + // + + public: + Class1() + { + // Initialize collections for design-mode editor testing. + array^ temp1 = { 0, 2, 4, 6, 8, 12, 14 }; + Icollection = (ICollection^)(temp1); + font = gcnew Font( "Arial", 8 ); + testAnchor = AnchorStyles::None; + filename = String::Empty; + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp b/snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp new file mode 100644 index 00000000000..870ca730162 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/EditorBrowsableAttribute/CPP/ctleditorbrowsable.cpp @@ -0,0 +1,41 @@ +// +#using + +using namespace System; +using namespace System::ComponentModel; + +namespace EditorBrowsableDemo +{ + public ref class Class1 + { + public: + Class1() + { + // + // TODO: Add constructor logic here + // + } + + private: + int ageval; + + public: + [EditorBrowsable(EditorBrowsableState::Never)] + property int Age + { + int get() + { + return ageval; + } + + void set( int value ) + { + if ( ageval != value ) + { + ageval = value; + } + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp new file mode 100644 index 00000000000..6ecf7397ac5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/EventDescriptor/CPP/eventdescriptor.cpp @@ -0,0 +1,117 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 8, 96 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 608, 160 ); + this->textBox1->TabIndex = 1; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 632, 273 ); + array^temp0 = {this->textBox1,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( button1 ); + + // Displays each event's information in the collection in a text box. + for each (EventDescriptor^ myEvent in events) { + textBox1->Text += myEvent->Category + '\n'; + textBox1->Text += myEvent->Description + '\n'; + textBox1->Text += myEvent->DisplayName + '\n'; + } + // + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp new file mode 100644 index 00000000000..c12d415bf94 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/EventsTabExample/CPP/class1.cpp @@ -0,0 +1,106 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Collections; +using namespace System::Drawing; +using namespace System::IO; +using namespace System::Reflection; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Serialization::Formatters::Binary; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +ref class TypeEventsTab; + +// This component adds a TypeEventsTab to the Properties Window. + +[PropertyTabAttribute(TypeEventsTab::typeid,PropertyTabScope::Document)] +public ref class TypeEventsTabComponent: public Component +{ +public: + TypeEventsTabComponent(){} + +}; + + +// This example events tab lists events by their delegate type. +[System::Security::Permissions::PermissionSetAttribute + (System::Security::Permissions::SecurityAction::InheritanceDemand, Name="FullTrust")] +[System::Security::Permissions::PermissionSetAttribute + (System::Security::Permissions::SecurityAction::Demand, Name="FullTrust")] +public ref class TypeEventsTab: public System::Windows::Forms::Design::EventsTab +{ +private: + + // This string contains a Base-64 encoded and serialized example + // property tab image. + + [BrowsableAttribute(true)] + String^ img; + IServiceProvider^ sp; + +public: + TypeEventsTab( IServiceProvider^ sp ) + : EventsTab( sp ) + { + this->sp = sp; + String^ s = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4w" + "LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRt" + "YXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAtgIAAAJCTbYCAAAAAAAANgAAACgAAAANAAAAEAAAAAEAGAAAAAAAAAAAAMQOAADED" + "gAAAAAAAAAAAADO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tn/ztbZztbZHh4eHh4eztbZztbZztbZztbZztb" + "ZztbZztbZztbZztbZ/87W2c7W2QDBAB4eHh4eHs7W2c7W2c7W2c7W2c7W2c7W2c7W2c7W2f/O1tnO1tnO1tkAwQAeHh4eHh7O1tnO1" + "tnO1tnO1tnO1tnO1tnO1tn/ztbZztbZlJSU////AMEAHh4eHh4eztbZztbZztbZztbZztbZztbZ/87W2c7W2c7W2ZSUlP///wDBAB4" + "eHh4eHs7W2c7W2c7W2c7W2c7W2f/O1tnO1tnO1tnO1tmUlJT///8AwQAeHh4eHh7O1tnO1tnO1tnO1tn/ztbZHh4eHh4eHh4eHh4eH" + "h4e////AIAAHh4eHh4eztbZztbZztbZ/87W2ZSUlP///wDBAADBAADBAADBAADBAACAAB4eHh4eHs7W2c7W2f/O1tnO1tmUlJT///8" + "AwQAAgAAeHh4eHh7O1tnO1tnO1tnO1tnO1tn/ztbZztbZztbZlJSU////AMEAAIAAHh4eHh4eztbZztbZztbZztbZ/87W2c7W2c7W2" + "c7W2ZSUlP///wDBAACAAB4eHh4eHs7W2c7W2c7W2f/O1tnO1tnO1tnO1tnO1tmUlJT///8AwQAAgAAeHh4eHh7O1tnO1tn/ztbZztb" + "ZztbZztbZztbZztbZlJSU////AMEAAIAAHh4eHh4eztbZ/87W2c7W2c7W2c7W2c7W2c7W2c7W2ZSUlP///wDBAACAAB4eHs7W2f/O1" + "tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tnO1tn/Cw=="; + img = s; + } + + // Returns the properties of the specified component extended with a + // CategoryAttribute reflecting the name of the type of the property. + virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( ITypeDescriptorContext^ /*context*/, Object^ component, array^attributes ) override + { + // Obtain an instance of the IEventBindingService. + IEventBindingService^ eventPropertySvc = dynamic_cast(sp->GetService( IEventBindingService::typeid )); + + // Return if an IEventBindingService could not be obtained. + if ( eventPropertySvc == nullptr ) + return gcnew PropertyDescriptorCollection( nullptr ); + + // Obtain the events on the component. + EventDescriptorCollection^ events = TypeDescriptor::GetEvents( component, attributes ); + + // Create an array of the events, where each event is assigned + // a category matching its type. + array^newEvents = gcnew array(events->Count); + for ( int i = 0; i < events->Count; i++ ) + { + array^temp = {gcnew CategoryAttribute( events[ i ]->EventType->FullName )}; + newEvents[ i ] = TypeDescriptor::CreateEvent( events[ i ]->ComponentType, events[ i ], temp ); + } + events = gcnew EventDescriptorCollection( newEvents ); + + // Return event properties for the event descriptors. + return eventPropertySvc->GetEventProperties( events ); + } + + property String^ TabName + { + // Provides the name for the event property tab. + virtual String^ get() override + { + return "Events by Type"; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp new file mode 100644 index 00000000000..38fae3fa420 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ExtenderListServiceExample/CPP/extenderlistserviceexample.cpp @@ -0,0 +1,72 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +namespace ExtenderListServiceExample +{ + // This control lists any active extender providers. + public ref class ExtenderListServiceControl: public UserControl + { + private: + IExtenderListService^ extenderListService; + array^extenderNames; + + public: + ExtenderListServiceControl() + { + this->Width = 600; + } + + property ISite^ Site + { + // Queries the IExtenderListService when the control is sited + // in design mode. + virtual ISite^ get() override + { + return __super::Site; + } + + virtual void set( ISite^ value ) override + { + __super::Site = value; + if ( this->DesignMode ) + { + extenderListService = dynamic_cast(this->GetService( IExtenderListService::typeid )); + if ( extenderListService != nullptr ) + { + array^extenders = extenderListService->GetExtenderProviders(); + extenderNames = gcnew array(extenders->Length); + for ( int i = 0; i < extenders->Length; i++ ) + extenderNames[ i ] = String::Concat( "ExtenderProvider #", i.ToString(), ": ", extenders[ i ]->GetType()->FullName ); + } + } + else + { + extenderListService = nullptr; + } + } + } + + protected: + + // Draws a list of any active extender providers + virtual void OnPaint( PaintEventArgs^ e ) override + { + if ( extenderNames->Length == 0 ) + e->Graphics->DrawString( "No active extender providers", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 10, 10 ); + else + e->Graphics->DrawString( "List of types of active extender providers", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 10, 10 ); + + for ( int i = 0; i < extenderNames->Length; i++ ) + e->Graphics->DrawString( extenderNames[ i ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 10, 25 + (i * 10) ); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp b/snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp new file mode 100644 index 00000000000..c9209e00143 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ExtenderServiceExample/CPP/extenderservicedesigner.cpp @@ -0,0 +1,101 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// IExtenderProviderImplementation that adds an integer property +// named "ExtenderIndex" to any design-mode document object. + +[ProvidePropertyAttribute("ExtenderIndex",IComponent::typeid)] +public ref class ComponentExtender: public IExtenderProvider +{ +public: + + // Stores the value of the property to extend a component with. + int index; + ComponentExtender() + { + index = 0; + } + + virtual bool CanExtend( Object^ /*extendee*/ ) + { + // Extends any type of object. + return true; + } + + int GetExtenderIndex( IComponent^ /*component*/ ) + { + return index; + } + + void SetExtenderIndex( IComponent^ /*component*/, int index ) + { + this->index = index; + } +}; + + +// This designer adds a ComponentExtender extender provider, +// and removes it when the designer is destroyed. +public ref class ExtenderServiceDesigner: public ControlDesigner +{ +private: + + // A local reference to an obtained IExtenderProviderService. + IExtenderProviderService^ localExtenderServiceReference; + + // An IExtenderProvider that this designer supplies. + ComponentExtender^ extender; + +public: + ExtenderServiceDesigner(){} + + virtual void Initialize( IComponent^ component ) override + { + ControlDesigner::Initialize( component ); + + // Attempts to obtain an IExtenderProviderService. + IExtenderProviderService^ extenderService = dynamic_cast(component->Site->GetService( IExtenderProviderService::typeid )); + if ( extenderService != nullptr ) + { + // If the service was obtained, adds a ComponentExtender + // that adds an "ExtenderIndex" integer property to the + // designer's component. + extender = gcnew ComponentExtender; + extenderService->AddExtenderProvider( extender ); + localExtenderServiceReference = extenderService; + } + else + MessageBox::Show( "Could not obtain an IExtenderProviderService." ); + } + + ~ExtenderServiceDesigner() + { + // Removes any previously added extender provider. + if ( localExtenderServiceReference != nullptr ) + { + localExtenderServiceReference->RemoveExtenderProvider( extender ); + localExtenderServiceReference = nullptr; + } + } +}; + +// Example UserControl associated with the ExtenderServiceDesigner. + +[DesignerAttribute(ExtenderServiceDesigner::typeid)] +public ref class ExtenderServiceTestControl: public UserControl +{ +public: + ExtenderServiceTestControl(){} +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp new file mode 100644 index 00000000000..89d6e6e6bfd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/FontDialog.ShowApply/CPP/form1.cpp @@ -0,0 +1,131 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace FontDialog_cs +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::FontDialog^ fontDialog1; + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->fontDialog1 = gcnew System::Windows::Forms::FontDialog; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 32, 8 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // fontDialog1 + // + this->fontDialog1->Apply += gcnew System::EventHandler( this, &Form1::fontDialog1_Apply ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 56, 72 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->TabIndex = 1; + this->richTextBox1->Text = "richTextBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {this->richTextBox1,this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Sets the ShowApply property, then displays the dialog. + fontDialog1->ShowApply = true; + fontDialog1->ShowDialog(); + } + + void fontDialog1_Apply( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Applies the selected font to the selected text. + richTextBox1->Font = fontDialog1->Font; + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew FontDialog_cs::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp new file mode 100644 index 00000000000..9846c8076fb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.AddOwnedForm/CPP/form1.cpp @@ -0,0 +1,132 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 184, 64 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 176, 144 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 1; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button2,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowMyOwnedForm(); + } + + // +private: + void ShowMyOwnedForm() + { + // Create an instance of the form to be owned. + Form^ ownedForm = gcnew Form; + + // Set the text of the form to identify it is an owned form. + ownedForm->Text = "Owned Form"; + + // Add ownedForm to array of owned forms. + this->AddOwnedForm( ownedForm ); + + // Show the owned form. + ownedForm->Show(); + } + // + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Form^ frm = gcnew Form; + frm->Show(); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp new file mode 100644 index 00000000000..4fb5a61f7a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.AutoScroll/CPP/form1.cpp @@ -0,0 +1,127 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 56 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 336, 294 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DisplayMyScrollableForm(); + } + + // +private: + void DisplayMyScrollableForm() + { + // Create a new form. + Form^ form2 = gcnew Form; + + // Create a button to add to the new form. + Button^ button1 = gcnew Button; + + // Set text for the button. + button1->Text = "Scrolled Button"; + + // Set the size of the button. + button1->Size = System::Drawing::Size( 100, 30 ); + + // Set the location of the button to be outside the form's client area. + button1->Location = Point(form2->Size.Width + 200,form2->Size.Height + 200); + + // Add the button control to the new form. + form2->Controls->Add( button1 ); + + // Set the AutoScroll property to true to provide scrollbars. + form2->AutoScroll = true; + + // Display the new form as a dialog box. + form2->ShowDialog(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp new file mode 100644 index 00000000000..5d2138139bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.Closing/CPP/form1.cpp @@ -0,0 +1,122 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + static String^ strMyOriginalText = ""; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 64 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 48, 64 ); + this->textBox1->Name = "textBox1"; + this->textBox1->TabIndex = 1; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->textBox1,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Closing += gcnew System::ComponentModel::CancelEventHandler( this, &Form1::Form1_Closing ); + this->ResumeLayout( false ); + } + + // +private: + void Form1_Closing( Object^ /*sender*/, System::ComponentModel::CancelEventArgs^ e ) + { + // Determine if text has changed in the textbox by comparing to original text. + if ( textBox1->Text != strMyOriginalText ) + { + // Display a MsgBox asking the user to save changes or abort. + if ( MessageBox::Show( "Do you want to save changes to your text?", "My Application", MessageBoxButtons::YesNo ) == ::DialogResult::Yes ) + { + // Cancel the Closing event from closing the form. + e->Cancel = true; + + // Call method to save file... + } + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp new file mode 100644 index 00000000000..282e8467d17 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.MDIChildren/CPP/form1.cpp @@ -0,0 +1,144 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + components = nullptr; + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + +#pragma region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 208, 48 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 72, 32 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 344, 144 ); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 96, 40 ); + this->button2->TabIndex = 2; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 512, 494 ); + array^temp1 = {this->button2,this->button1}; + this->Controls->AddRange( temp1 ); + this->IsMdiContainer = true; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } +#pragma endregion + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Form^ frm2 = gcnew Form; + frm2->MdiParent = this; + frm2->Show(); + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + AddButtonsToMyChildren(); + } + + // +private: + void AddButtonsToMyChildren() + { + // If there are child forms in the parent form, add Button controls to them. + for ( int x = 0; x < this->MdiChildren->Length; x++ ) + { + // Create a temporary Button control to add to the child form. + Button^ tempButton = gcnew Button; + + // Set the location and text of the Button control. + tempButton->Location = Point(10,10); + tempButton->Text = "OK"; + + // Create a temporary instance of a child form (Form 2 in this case). + Form^ tempChild = dynamic_cast(this->MdiChildren[ x ]); + + // Add the Button control to the control collection of the form. + tempChild->Controls->Add( tempButton ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp new file mode 100644 index 00000000000..632a09d4a07 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.MDIParent/CPP/form1.cpp @@ -0,0 +1,122 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + childCount = 0; + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 16 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->IsMdiContainer = true; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + int childCount; + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CreateMyChildForm(); + } + + // +private: + void CreateMyChildForm() + { + // Create a new form to represent the child form. + Form^ child = gcnew Form; + + // Increment the private child count. + childCount++; + + // Set the text of the child form using the count of child forms. + String^ formText = String::Format( "Child {0}", childCount ); + child->Text = formText; + + // Make the new form a child form. + child->MdiParent = this; + + // Display the child form. + child->Show(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp new file mode 100644 index 00000000000..ed746f91afa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.Modal/CPP/form1.cpp @@ -0,0 +1,123 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace FormModalEx +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 184, 56 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 88, 24 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^formControls = {this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowMyNonModalForm(); + } + + // + private: + void ShowMyNonModalForm() + { + Form^ myForm = gcnew Form; + myForm->Text = "My Form"; + myForm->SetBounds( 10, 10, 200, 200 ); + myForm->Show(); + + // Determine if the form is modal. + if ( !myForm->Modal ) + { + // Change borderstyle and make it not a top level window. + myForm->FormBorderStyle = ::FormBorderStyle::FixedToolWindow; + myForm->TopLevel = false; + } + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew FormModalEx::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp new file mode 100644 index 00000000000..019e179dd11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.Opacity/CPP/form1.cpp @@ -0,0 +1,121 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 176, 56 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CreateMyOpaqueForm(); + } + + // +private: + void CreateMyOpaqueForm() + { + // Create a new form. + Form^ form2 = gcnew Form; + + // Set the text displayed in the caption. + form2->Text = "My Form"; + + // Set the opacity to 75%. + form2->Opacity = .75; + + // Size the form to be 300 pixels in height and width. + form2->Size = System::Drawing::Size( 300, 300 ); + + // Display the form in the center of the screen. + form2->StartPosition = FormStartPosition::CenterScreen; + + // Display the form as a modal dialog box. + form2->ShowDialog(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp new file mode 100644 index 00000000000..61d1bf80520 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.OwnedForms/CPP/form1.cpp @@ -0,0 +1,140 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 184, 32 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 200, 104 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 1; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button2,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + AddMyOwnedForm(); + } + + // +private: + void AddMyOwnedForm() + { + // Create form to be owned. + Form^ ownedForm = gcnew Form; + + // Set the text of the owned form. + ownedForm->Text = String::Format( "Owned Form {0}", this->OwnedForms->Length ); + + // Add the form to the array of owned forms. + this->AddOwnedForm( ownedForm ); + + // Show the owned form. + ownedForm->Show(); + } + + void ChangeOwnedFormText() + { + // Loop through all owned forms and change their text. + for ( int x = 0; x < this->OwnedForms->Length; x++ ) + { + this->OwnedForms[ x ]->Text = String::Format( "My Owned Form {0}", x ); + } + } + // + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ChangeOwnedFormText(); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp new file mode 100644 index 00000000000..89c5c4cd872 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.ShowInTaskbar/CPP/form1.cpp @@ -0,0 +1,114 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 160, 48 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowInTaskBarEx(); + } + + // +private: + void ShowInTaskBarEx() + { + Form^ myForm = gcnew Form; + myForm->Text = "My Form"; + myForm->SetBounds( 10, 10, 200, 200 ); + myForm->FormBorderStyle = ::FormBorderStyle::FixedDialog; + myForm->MinimizeBox = false; + myForm->MaximizeBox = false; + + // Do not allow form to be displayed in taskbar. + myForm->ShowInTaskbar = false; + myForm->ShowDialog(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp new file mode 100644 index 00000000000..621e291e84e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.SizeGripStyle/CPP/form1.cpp @@ -0,0 +1,115 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 152, 56 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 96, 32 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ShowMyDialogBox(); + } + + // +private: + void ShowMyDialogBox() + { + Form^ myForm = gcnew Form; + myForm->Text = "My Form"; + myForm->SetBounds( 20, 20, 300, 300 ); + myForm->FormBorderStyle = ::FormBorderStyle::FixedDialog; + + // Display the form with no grip since form is not resizable. + myForm->SizeGripStyle = ::SizeGripStyle::Hide; + myForm->MinimizeBox = false; + myForm->MaximizeBox = false; + myForm->ShowDialog(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp new file mode 100644 index 00000000000..f2d772e6305 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Form.TopMost/CPP/form1.cpp @@ -0,0 +1,125 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 208, 56 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CreateMyTopMostForm(); + } + + // +private: + void CreateMyTopMostForm() + { + // Create lower form to display. + Form^ bottomForm = gcnew Form; + + // Display the lower form Maximized to demonstrate effect of TopMost property. + bottomForm->WindowState = FormWindowState::Maximized; + + // Display the bottom form. + bottomForm->Show(); + + // Create the top most form. + Form^ topMostForm = gcnew Form; + + // Set the size of the form larger than the default size. + topMostForm->Size = System::Drawing::Size( 300, 300 ); + + // Set the position of the top most form to center of screen. + topMostForm->StartPosition = FormStartPosition::CenterScreen; + + // Display the form as top most form. + topMostForm->TopMost = true; + topMostForm->Show(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp new file mode 100644 index 00000000000..39e452280b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/FormBorderStyle/CPP/form1.cpp @@ -0,0 +1,41 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +ref class TestForm: public Form +{ +public: + TestForm() + { + InitMyForm(); + } + + // +public: + void InitMyForm() + { + // Adds a label to the form. + Label^ label1 = gcnew Label; + label1->Location = System::Drawing::Point( 80, 80 ); + label1->Name = "label1"; + label1->Size = System::Drawing::Size( 132, 80 ); + label1->Text = "Start Position Information"; + this->Controls->Add( label1 ); + + // Changes the border to Fixed3D. + FormBorderStyle = ::FormBorderStyle::Fixed3D; + + // Displays the border information. + label1->Text = String::Format( "The border is {0}", FormBorderStyle ); + } + // +}; + +int main() +{ + Application::Run( gcnew TestForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp b/snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp new file mode 100644 index 00000000000..a4d5f91e933 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/FormStartPosition/CPP/formstartposition.cpp @@ -0,0 +1,44 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +public: + Form1() + { + InitMyForm(); + } + + // +public: + void InitMyForm() + { + // Adds a label to the form. + Label^ label1 = gcnew Label; + label1->Location = System::Drawing::Point( 54, 128 ); + label1->Name = "label1"; + label1->Size = System::Drawing::Size( 220, 80 ); + label1->Text = "Start position information"; + this->Controls->Add( label1 ); + + // Moves the start position to the center of the screen. + StartPosition = FormStartPosition::CenterScreen; + + // Displays the position information. + label1->Text = String::Format( "The start position is {0}", StartPosition ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp b/snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp new file mode 100644 index 00000000000..cf8940f90f8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/FormWindowState/CPP/formwindowstate.cpp @@ -0,0 +1,41 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +ref class TestForm: public Form +{ +public: + TestForm() + { + InitMyForm(); + } + + // +public: + void InitMyForm() + { + // Adds a label to the form. + Label^ label1 = gcnew Label; + label1->Location = System::Drawing::Point( 54, 128 ); + label1->Name = "label1"; + label1->Size = System::Drawing::Size( 220, 80 ); + label1->Text = "Start position information"; + this->Controls->Add( label1 ); + + // Changes the window state to Maximized. + WindowState = FormWindowState::Maximized; + + // Displays the state information. + label1->Text = String::Format( "The form window is {0}", WindowState ); + } + // +}; + +int main() +{ + Application::Run( gcnew TestForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp new file mode 100644 index 00000000000..ffc408f59af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetContextMenu2/CPP/form1.cpp @@ -0,0 +1,135 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + AddContextmenu(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + /// + /// The main entry point for the application. + /// + + // +public: + [STAThread] + void AddContextmenu() + { + // Create a shortcut menu. + System::Windows::Forms::ContextMenu^ m = gcnew System::Windows::Forms::ContextMenu; + this->ContextMenu = m; + + // Create MenuItem objects. + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + + // Set the Text property. + menuItem1->Text = "New"; + menuItem2->Text = "Open"; + + // Add menu items to the MenuItems collection. + m->MenuItems->Add( menuItem1 ); + m->MenuItems->Add( menuItem2 ); + + // Display the starting message. + MessageBox::Show( "Right-click the form to display the shortcut menu items" ); + + // Add functionality to the menu items. + menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); + menuItem2->Click += gcnew System::EventHandler( this, &Form1::menuItem2_Click ); + } + +private: + void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + String^ textReport = "You clicked the New menu item. \n" + "It is contained in the following shortcut menu: \n\n"; + + // Get information on the shortcut menu in which menuitem1 is contained. + textReport = String::Concat( textReport, this->ContextMenu->GetContextMenu()->ToString() ); + + // Display the shortcut menu information in a message box. + MessageBox::Show( textReport, "The ContextMenu Information" ); + } + + void menuItem2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + String^ textReport = "You clicked the Open menu item. \n" + "It is contained in the following shortcut menu: \n\n"; + + // Get information on the shortcut menu in which menuitem1 is contained. + textReport = String::Concat( textReport, this->ContextMenu->GetContextMenu()->ToString() ); + + // Display the shortcut menu information in a message box. + MessageBox::Show( textReport, "The ContextMenu Information" ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp new file mode 100644 index 00000000000..8ec31eba837 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetData1/CPP/getdata1.cpp @@ -0,0 +1,119 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + GetData1(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 8, 24 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 264, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + array^formControls = {this->textBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void GetData1() + { + // Creates a new data object using a string and the text format. + String^ myString = "My text string"; + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); + + // Displays the string in a text box. + textBox1->Text = myDataObject->GetData( DataFormats::Text )->ToString(); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp b/snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp new file mode 100644 index 00000000000..c08bd55976a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetData2/CPP/getdata2.cpp @@ -0,0 +1,109 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + GetData2(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +private: + void GetData2() + { + // Creates a component. + Component^ myComponent = gcnew Component; + + // Creates a data object, and assigns it the component. + DataObject^ myDataObject = gcnew DataObject( myComponent ); + + // Creates a type, myType, to store the type of data. + Type^ myType = myComponent->GetType(); + + // Retrieves the data using myType to represent its type. + Object^ myObject = myDataObject->GetData( myType ); + if ( myObject != nullptr ) + MessageBox::Show( "The data type stored in the data object is " + + myObject->GetType()->Name + "." ); + else + MessageBox::Show( "Data of the specified type was not stored in the data object." ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp b/snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp new file mode 100644 index 00000000000..ca555c9731f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetData3/CPP/getdata3.cpp @@ -0,0 +1,113 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + GetData3(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +private: + void GetData3() + { + // Creates a new data object using a text string. + String^ myString = "Hello World!"; + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); + + // Displays the string with autoConvert equal to false. + if ( myDataObject->GetData( "System::String", false ) != nullptr ) + { + // Displays the string in a message box. + MessageBox::Show( myDataObject->GetData( "System::String", false ) + ".", "Message #1" ); + } + else + MessageBox::Show( "Could not find data of the specified format.", "Message #1" ); + + // Displays a not found message in a message box. + // Displays the string in a text box with autoConvert equal to true. + String^ myData = "The data is " + myDataObject->GetData( "System::String", true ) + "."; + MessageBox::Show( myData, "Message #2" ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp new file mode 100644 index 00000000000..4dcd7fb9abf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent1/CPP/getdatapresent1.cpp @@ -0,0 +1,85 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + InitializeComponent(); + TestDataObject(); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +private: + void TestDataObject() + { + // Creates a new data object using a string and the Text format. + String^ myString = "Hello World!"; + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,myString ); + + // Checks whether the data is present in the Text format and displays the result. + if ( myDataObject->GetDataPresent( DataFormats::Text ) ) + MessageBox::Show( "The stored data is in the Text format.", "Test Result" ); + else + MessageBox::Show( "The stored data is not in the Text format.", "Test Result" ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp new file mode 100644 index 00000000000..01da2cc4153 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent2/CPP/getdatapresent2.cpp @@ -0,0 +1,130 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + GetDataPresent2(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 288, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + array^formControls = {this->textBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void GetDataPresent2() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Creates a new data object and assigns it the component. + DataObject^ myDataObject = gcnew DataObject( myComponent ); + + // Creates a type to store the type of data. + Type^ myType = myComponent->GetType(); + + // Checks whether the specified data type exists in the object. + if ( myDataObject->GetDataPresent( myType ) ) + { + MessageBox::Show( "The specified data is stored in the data object." ); + + // Displays the type of data. + textBox1->Text = "The data type is " + myDataObject->GetData( myType )->GetType()->Name + "."; + } + else + MessageBox::Show( "The specified data is not stored in the data object." ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp new file mode 100644 index 00000000000..b8360cc623e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetDataPresent3/CPP/getdatapresent3.cpp @@ -0,0 +1,110 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + GetDataPresent3(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +private: + void GetDataPresent3() + { + // Creates a new data object using a string and the Text format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"My String" ); + + // Checks whether the string can be displayed with autoConvert equal to false. + if ( myDataObject->GetDataPresent( "System::String", false ) ) + MessageBox::Show( myDataObject->GetData( "System::String", false )->ToString(), "Message #1" ); + else + MessageBox::Show( "Cannot convert data to the specified format with autoConvert set to false.", "Message #1" ); + + // Displays the string with autoConvert equal to true. + MessageBox::Show( "Now that autoConvert is true, you can convert " + myDataObject->GetData( "System::String", true ) + " to string format.", "Message #2" ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + + void label1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* + * Output: + * Parameter args for method ParamArrayAndDesc has a description attribute. + * The description is: "This argument is a ParamArray" + * Parameter args for method ParamArrayAndDesc has the ParamArray attribute. + */ diff --git a/snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp new file mode 100644 index 00000000000..21182fa6eb6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetFormats1/CPP/getformats1.cpp @@ -0,0 +1,38 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ + // +private: + void GetFormats1() + { + // Creates a data object using a string and the Text format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::Text,"My text string" ); + + // Gets all the data formats and data conversion formats in the data object. + array^allFormats = myDataObject->GetFormats(); + + // Creates the string that contains the formats. + String^ theResult = "The format(s) associated with the data are: \n"; + for ( int i = 0; i < allFormats->Length; i++ ) + theResult = theResult + allFormats[ i ] + "\n"; + + // Displays the result in a message box. + MessageBox::Show( theResult ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp b/snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp new file mode 100644 index 00000000000..64305743720 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetFormats2/CPP/getformats2.cpp @@ -0,0 +1,47 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ + // +private: + void GetFormats2() + { + // Creates a new data object using a string and the UnicodeText format. + DataObject^ myDataObject = gcnew DataObject( DataFormats::UnicodeText,"My text string" ); + + // Gets the original data formats in the data object by setting the automatic + // conversion parameter to false. + array^myFormatsArray = myDataObject->GetFormats( false ); + + // Stores the results in a string. + String^ theResult = "The original format associated with the data is:\n"; + for ( int i = 0; i < myFormatsArray->Length; i++ ) + theResult = theResult + myFormatsArray[ i ] + "\n"; + + // Gets all data formats and data conversion formats for the data object. + myFormatsArray = myDataObject->GetFormats( true ); + + // Stores the results in the string. + theResult = theResult + "\nThe data format(s) and conversion format(s) associated with the data are:\n"; + for ( int i = 0; i < myFormatsArray->Length; i++ ) + theResult = theResult + myFormatsArray[ i ] + "\n"; + + // Displays the results. + MessageBox::Show( theResult ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp new file mode 100644 index 00000000000..308a31b3228 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetMainMenu/CPP/form1.cpp @@ -0,0 +1,130 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Label ^ label1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + InitializeMyMainMenu(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 24, 128 ); + this->label1->Name = "label1"; + this->label1->Size = System::Drawing::Size( 240, 88 ); + this->label1->TabIndex = 0; + this->label1->Text = "label1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + array^formControls = {this->label1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "My Form"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void InitializeMyMainMenu() + { + // Create the MainMenu and the menu items to add. + MainMenu^ mainMenu1 = gcnew MainMenu; + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + MenuItem^ menuItem3 = gcnew MenuItem; + MenuItem^ menuItem4 = gcnew MenuItem; + + // Set the caption for the menu items. + menuItem1->Text = "File"; + menuItem2->Text = "Edit"; + menuItem3->Text = "View"; + + // Add 3 menu items to the MainMenu for displaying. + mainMenu1->MenuItems->Add( menuItem1 ); + mainMenu1->MenuItems->Add( menuItem2 ); + mainMenu1->MenuItems->Add( menuItem3 ); + + // Assign mainMenu1 to the form. + Menu = mainMenu1; + + // Determine whether menuItem3 is currently being used. + if ( menuItem3->GetMainMenu() != nullptr ) + + // Display the name of the form in which it is located. + label1->Text = menuItem3->GetMainMenu()->GetForm()->ToString(); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp new file mode 100644 index 00000000000..d5691135580 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetTabPageOfComponent/CPP/form1.cpp @@ -0,0 +1,62 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + Button^ button1; + Button^ button2; + void InitializeMyTabs() + { + tabControl1 = gcnew System::Windows::Forms::TabControl; + tabPage1 = gcnew System::Windows::Forms::TabPage; + tabPage2 = gcnew System::Windows::Forms::TabPage; + button1 = gcnew System::Windows::Forms::Button; + button2 = gcnew System::Windows::Forms::Button; + array^tabControls = {tabPage1,tabPage2}; + tabControl1->Controls->AddRange( tabControls ); + tabControl1->Location = System::Drawing::Point( 40, 24 ); + tabControl1->Size = System::Drawing::Size( 216, 216 ); + tabControl1->TabIndex = 0; + array^tabPage1Controls = {button1}; + tabPage1->Controls->AddRange( tabPage1Controls ); + tabPage1->TabIndex = 0; + array^tabPage2Controls = {button2}; + tabPage2->Controls->AddRange( tabPage2Controls ); + tabPage2->TabIndex = 1; + button1->Location = System::Drawing::Point( 64, 72 ); + button2->Location = System::Drawing::Point( 64, 72 ); + button2->Text = "button2"; + ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {tabControl1}; + Controls->AddRange( formControls ); + + // Gets the index of the TabPage containing button2. + // Selects the index of the TabPage containing button2. + tabControl1->SelectedIndex = (TabPage::GetTabPageOfComponent( button2 ))->TabIndex; + } + + +public: + Form1() + { + InitializeMyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp b/snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp new file mode 100644 index 00000000000..4a9e8bc47d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GetTabRect/CPP/gettabrect.cpp @@ -0,0 +1,51 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + Rectangle myTabRect; + +public: + Form1() + { + tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + tabControl1->Controls->Add( tabPage1 ); + tabControl1->DrawMode = TabDrawMode::OwnerDrawFixed; + tabControl1->Location = Point(25,25); + tabControl1->Size = System::Drawing::Size( 250, 250 ); + tabPage1->TabIndex = 0; + + // Gets the tabPage1 tab area defined by its TabIndex. + // Returns a Rectangle to myTabRect. + myTabRect = tabControl1->GetTabRect( 0 ); + ClientSize = System::Drawing::Size( 300, 300 ); + Controls->Add( tabControl1 ); + tabControl1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::OnDrawItem ); + } + + +private: + void OnDrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) + { + Graphics^ g = e->Graphics; + Pen^ p = gcnew Pen( Color::Blue ); + g->DrawRectangle( p, myTabRect ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp new file mode 100644 index 00000000000..64f5f889272 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_Members/CPP/gridcolumnstylescollection_members.cpp @@ -0,0 +1,307 @@ +// System::Windows::Forms::GridColumnStylesCollection::Clear +// System::Windows::Forms::GridColumnStylesCollection::get_Item(int) +// System::Windows::Forms::GridColumnStylesCollection::get_Item(String*) + +/* +The following program demonstrates the Clear method , the get_Item(int) and get_Item(String*) +indexers for the 'GridColumnStylesCollection' class. +In this program the user can add custom styles and clear them. The information on the styles +is displayed depending on the option chosen by user. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Collections; + +public ref class MyForm: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Label^ myLabel; + Button^ clearButton; + Button^ addStylesButton; + Button^ selectChoiceButton; + System::Windows::Forms::RadioButton^ columnNameRadioButton; + System::Windows::Forms::RadioButton^ indexRadioButton; + System::Windows::Forms::Label ^ myLabel2; + bool TablesAlreadyAdded; + +public: + MyForm() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + components = gcnew System::ComponentModel::Container; + clearButton = gcnew System::Windows::Forms::Button; + addStylesButton = gcnew System::Windows::Forms::Button; + myDataGrid = gcnew System::Windows::Forms::DataGrid; + myLabel = gcnew System::Windows::Forms::Label; + selectChoiceButton = gcnew System::Windows::Forms::Button; + columnNameRadioButton = gcnew System::Windows::Forms::RadioButton; + indexRadioButton = gcnew System::Windows::Forms::RadioButton; + myLabel2 = gcnew System::Windows::Forms::Label; + clearButton->Location = System::Drawing::Point( 24, 16 ); + clearButton->Name = "clearButton"; + clearButton->Size = System::Drawing::Size( 120, 24 ); + clearButton->Text = "Clear Table Styles"; + clearButton->Click += gcnew System::EventHandler( this, &MyForm::Clear_Clicked ); + addStylesButton->Location = System::Drawing::Point( 150, 16 ); + addStylesButton->Name = "addStylesButton"; + addStylesButton->Size = System::Drawing::Size( 120, 24 ); + addStylesButton->Text = "Add Custom Styles"; + addStylesButton->Click += gcnew System::EventHandler( this, &MyForm::AddStyles_Clicked ); + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 300, 200 ); + myDataGrid->CaptionText = "Microsoft DataGrid Control"; + myLabel->Location = System::Drawing::Point( 48, 328 ); + myLabel->Name = "myLabel"; + myLabel->Size = System::Drawing::Size( 464, 90 ); + myLabel->TabIndex = 7; + myLabel->Text = "Message."; + myLabel2->Location = System::Drawing::Point( 412, 24 ); + myLabel2->Size = System::Drawing::Size( 100, 20 ); + myLabel2->Text = "Print info using:"; + selectChoiceButton->Location = System::Drawing::Point( 276, 16 ); + selectChoiceButton->Name = "selectChoiceButton"; + selectChoiceButton->Size = System::Drawing::Size( 120, 24 ); + selectChoiceButton->Text = "Print Info"; + selectChoiceButton->Click += gcnew System::EventHandler( this, &MyForm::SelectChoice_Clicked ); + columnNameRadioButton->Location = System::Drawing::Point( 432, 56 ); + columnNameRadioButton->Name = "columnNameRadioButton"; + columnNameRadioButton->Text = "ColumnName"; + indexRadioButton->Location = System::Drawing::Point( 432, 88 ); + indexRadioButton->Name = "indexRadioButton"; + indexRadioButton->Text = "Index"; + ClientSize = System::Drawing::Size( 600, 500 ); + Name = "MyForm"; + Text = "DataGrid Control Sample"; + Controls->Add( clearButton ); + Controls->Add( addStylesButton ); + Controls->Add( selectChoiceButton ); + Controls->Add( myDataGrid ); + Controls->Add( columnNameRadioButton ); + Controls->Add( indexRadioButton ); + Controls->Add( myLabel ); + Controls->Add( myLabel2 ); + } + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ customerTable = gcnew DataTable( "Customers" ); + DataTable^ ordersTable = gcnew DataTable( "Orders" ); + + // Create two columns, add them to the first table. + DataColumn^ customerID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ customerName = gcnew DataColumn( "CustName" ); + DataColumn^ current = gcnew DataColumn( "Current",bool::typeid ); + customerTable->Columns->Add( customerID ); + customerTable->Columns->Add( customerName ); + customerTable->Columns->Add( current ); + + // Create three columns, add them to the second table. + DataColumn^ customerID2 = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ orderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); + DataColumn^ orderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + ordersTable->Columns->Add( orderAmount ); + ordersTable->Columns->Add( customerID2 ); + ordersTable->Columns->Add( orderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( customerTable ); + myDataSet->Tables->Add( ordersTable ); + + // Create a DataRelation, add it to the DataSet. + DataRelation^ myDataRelation = gcnew DataRelation( "custToOrders",customerID,customerID2 ); + myDataSet->Relations->Add( myDataRelation ); + DataRow^ newRow1; + DataRow^ newRow2; + + // Create three customers in the Customers Table. + for ( int index = 1; index < 5; index++ ) + { + newRow1 = customerTable->NewRow(); + newRow1[ "CustID" ] = index; + newRow1[ "CustName" ] = "Item " + index; + newRow1[ "Current" ] = true.ToString(); + + // Add the row to the Customers table. + customerTable->Rows->Add( newRow1 ); + } + + // For each customer, create five rows in the Orders table. + for ( int index = 1; index < 5; index++ ) + { + for ( int j = 1; j < 6; j++ ) + { + newRow2 = ordersTable->NewRow(); + newRow2[ "CustID" ] = index; + newRow2[ "OrderDate" ] = DateTime(2001,index,j * 2); + newRow2[ "OrderAmount" ] = index * 10 + j * .1; + + // Add the row to the Orders table. + ordersTable->Rows->Add( newRow2 ); + } + } + } + + void AddStyles_Clicked( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + myLabel->Text = "Styles added to the grid."; + if ( TablesAlreadyAdded ) + return; + + AddCustomDataTableStyle(); + } + + void AddCustomDataTableStyle() + { + DataGridTableStyle^ tableStyle1 = gcnew DataGridTableStyle; + tableStyle1->MappingName = "Customers"; + + // Set other properties. + tableStyle1->AlternatingBackColor = Color::LightGray; + + // Add a second column style. + DataGridColumnStyle^ textBoxColumnStyle = gcnew DataGridTextBoxColumn; + textBoxColumnStyle->MappingName = "CustName"; + textBoxColumnStyle->HeaderText = "Customer Name"; + textBoxColumnStyle->Width = 100; + tableStyle1->GridColumnStyles->Add( textBoxColumnStyle ); + + // Add a GridColumnStyle and set its MappingName to the name of a DataColumn in the DataTable. + DataGridColumnStyle^ gridColumnStyle = gcnew DataGridBoolColumn; + gridColumnStyle->MappingName = "Current"; + + // Set the HeaderText and Width properties. + gridColumnStyle->HeaderText = "IsCurrent Customer"; + gridColumnStyle->Width = 125; + tableStyle1->GridColumnStyles->Add( gridColumnStyle ); + + // Create the second table style with columns. + DataGridTableStyle^ tableStyle2 = gcnew DataGridTableStyle; + tableStyle2->MappingName = "Orders"; + + // Set other properties. + tableStyle2->AlternatingBackColor = Color::LightBlue; + + // Create new ColumnStyle Object*. + DataGridColumnStyle^ orderDate = gcnew DataGridTextBoxColumn; + orderDate->MappingName = "OrderDate"; + orderDate->HeaderText = "Order Date"; + orderDate->Width = 100; + tableStyle2->GridColumnStyles->Add( orderDate ); + + // Create a formatted column using a PropertyDescriptor. + PropertyDescriptorCollection^ pcol = + this->BindingContext[myDataSet, "Customers.custToOrders"]->GetItemProperties(); + DataGridColumnStyle^ csOrderAmount = gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + tableStyle2->GridColumnStyles->Add( csOrderAmount ); + + // Add the DataGridTableStyle objects to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( tableStyle1 ); + myDataGrid->TableStyles->Add( tableStyle2 ); + + // Set the TablesAlreadyAdded to true so we don't try to do this again. + TablesAlreadyAdded = true; + } + + void SelectChoice_Clicked( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( columnNameRadioButton->Checked ) + PrintColumnInformationUsingColumnName(); + else + if ( indexRadioButton->Checked ) + PrintColumnInformationUsingIndex(); + } + + // +private: + void Clear_Clicked( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // TablesAlreadyAdded set to false so that table styles can be added again. + TablesAlreadyAdded = false; + myLabel->Text = "All Table Styles Cleared."; + + // Clear all the column styles and also table style for the grid. + IEnumerator^ myEnum = myDataGrid->TableStyles->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridTableStyle^ myTableStyle = safe_cast(myEnum->Current); + GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; + myColumns->Clear(); + } + + myDataGrid->TableStyles->Clear(); + } + // + + // +private: + void PrintColumnInformationUsingColumnName() + { + myLabel->Text = "Table Styles info: No of Styles " + myDataGrid->TableStyles->Count; + IEnumerator^ myEnum = myDataGrid->TableStyles->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridTableStyle^ myTableStyle = safe_cast(myEnum->Current); + myLabel->Text = myLabel->Text + "\nTable Name : " + myTableStyle->MappingName; + GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; + + // 'myTableStyle->GridColumnStyles[index]->MappingName' specifies the column came for the table. + for ( int index = 0; index < myColumns->Count; index++ ) + myLabel->Text = myLabel->Text + "\nMapping Name: " + + myColumns[ myTableStyle->GridColumnStyles[ index ]->MappingName ]->MappingName; + } + } + // + + // +private: + void PrintColumnInformationUsingIndex() + { + myLabel->Text = "Table Styles info: No of Styles " + myDataGrid->TableStyles->Count; + IEnumerator^ myEnum = myDataGrid->TableStyles->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridTableStyle^ myTableStyle = safe_cast(myEnum->Current); + myLabel->Text = myLabel->Text + "\nTable Name : " + myTableStyle->MappingName; + GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; + for ( int index = 0; index < myColumns->Count; index++ ) + myLabel->Text = myLabel->Text + "\nMapping Name: " + myColumns[ index ]->MappingName; + } + } + // +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp new file mode 100644 index 00000000000..5a580bc35c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_RemoveAt/CPP/gridcolumnstylescollection_removeat.cpp @@ -0,0 +1,216 @@ +// System::Windows::Forms::GridColumnStylesCollection::RemoveAt + +/* +The following program demonstrates the 'RemoveAt(int)' method of +'GridColumnStylesCollection' class. An instance of DataGrid is created +by associating the DataGrid with a data source and column style +collections are added to it. A Remove button is provided to delete the +CustomerName column style collection. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Collections; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ components; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + Button^ removeStyle; + GridColumnStylesCollection^ myColumns; + +public: + MyForm() + { + InitializeComponent(); + SetUp(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + components = gcnew System::ComponentModel::Container; + myDataGrid = gcnew DataGrid; + removeStyle = gcnew Button; + + // Set the myDataGrid properties. + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 300, 200 ); + myDataGrid->CaptionText = "Microsoft DataGrid Control"; + + // Set the removeStyle properties. + removeStyle->Location = Point(276,16); + removeStyle->Name = "removeStyle"; + removeStyle->Size = System::Drawing::Size( 120, 24 ); + removeStyle->Text = "Remove"; + removeStyle->Click += gcnew System::EventHandler( this, &MyForm::RemoveColumnStyle_Clicked ); + ClientSize = System::Drawing::Size( 600, 500 ); + Name = "GridColumnStylesCollection_RemoveAt"; + Text = "DataGrid Control Sample"; + + // Add the controls to the form. + Controls->Add( removeStyle ); + Controls->Add( myDataGrid ); + } + + void SetUp() + { + // Create the data source. + MakeDataSet(); + + // Associate the data set. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // Create a DataSet with two tables and populate it. + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create two DataTables. + DataTable^ myCustomer = gcnew DataTable( "Customers" ); + DataTable^ myOrders = gcnew DataTable( "Orders" ); + + // Create two columns, and add them to the first table. + DataColumn^ myCustomerID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); + DataColumn^ myCurrent = gcnew DataColumn( "Current",bool::typeid ); + myCustomer->Columns->Add( myCustomerID ); + myCustomer->Columns->Add( myCustomerName ); + myCustomer->Columns->Add( myCurrent ); + + // Create three columns, and add them to the second table. + DataColumn^ myID = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ myOrderDate = gcnew DataColumn( "OrderDate",DateTime::typeid ); + DataColumn^ myOrderAmount = gcnew DataColumn( "OrderAmount",Decimal::typeid ); + myOrders->Columns->Add( myOrderAmount ); + myOrders->Columns->Add( myID ); + myOrders->Columns->Add( myOrderDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( myCustomer ); + myDataSet->Tables->Add( myOrders ); + + // Create a DataRelation, and add it to the DataSet. + DataRelation^ myDataRelation = gcnew DataRelation( "custToOrders",myCustomerID,myID ); + myDataSet->Relations->Add( myDataRelation ); + DataRow^ myNewRow1; + DataRow^ myNewRow2; + + // Create three customers in the Customers Table. + for ( int i = 1; i < 5; i++ ) + { + myNewRow1 = myCustomer->NewRow(); + myNewRow1[ "CustID" ] = i; + myNewRow1[ "CustName" ] = "Item {0}",i; + myNewRow1[ "Current" ] = true.ToString(); + + // Add the row to the Customers table. + myCustomer->Rows->Add( myNewRow1 ); + } + + // For each customer, create five rows in the Orders table. + for ( int i = 1; i < 5; i++ ) + { + for ( int j = 1; j < 6; j++ ) + { + myNewRow2 = myOrders->NewRow(); + myNewRow2[ "CustID" ] = i; + myNewRow2[ "OrderDate" ] = DateTime(2001,i,j * 2); + myNewRow2[ "OrderAmount" ] = i * 10 + j * .1; + + // Add the row to the Orders table. + myOrders->Rows->Add( myNewRow2 ); + } + } + AddCustomDataTableStyle(); + } + + void AddCustomDataTableStyle() + { + // Create a 'DataGridTableStyle'. + DataGridTableStyle^ myTableStyle1 = gcnew DataGridTableStyle; + + // Map the table style. + myTableStyle1->MappingName = "Customers"; + myTableStyle1->AlternatingBackColor = Color::LightGray; + + // Add a Name column style. + DataGridColumnStyle^ myTextCol = gcnew DataGridTextBoxColumn; + myTextCol->MappingName = "CustName"; + myTextCol->HeaderText = "Customer Name"; + myTextCol->Width = 100; + myTableStyle1->GridColumnStyles->Add( myTextCol ); + + // Add a Current column style. + DataGridColumnStyle^ myBoolCol = gcnew DataGridBoolColumn; + myBoolCol->MappingName = "Current"; + myBoolCol->HeaderText = "IsCurrent Customer"; + myBoolCol->Width = 125; + myTableStyle1->GridColumnStyles->Add( myBoolCol ); + + // Create the second table style with columns. + DataGridTableStyle^ myTableStyle2 = gcnew DataGridTableStyle; + myTableStyle2->MappingName = "Orders"; + myTableStyle2->AlternatingBackColor = Color::LightBlue; + + // Create Order Date Column Style. + DataGridColumnStyle^ myOrderDate = gcnew DataGridTextBoxColumn; + myOrderDate->MappingName = "OrderDate"; + myOrderDate->HeaderText = "Order Date"; + myOrderDate->Width = 100; + myTableStyle2->GridColumnStyles->Add( myOrderDate ); + + // Get the PropertyDescriptor of data set. + PropertyDescriptorCollection^ myPCol = this->BindingContext[myDataSet, "Customers::custToOrders"]->GetItemProperties(); + + // Create the Order Amount Column style. + DataGridColumnStyle^ myOrderAmount = gcnew DataGridTextBoxColumn( myPCol[ "OrderAmount" ],"c",true ); + myOrderAmount->MappingName = "OrderAmount"; + myOrderAmount->HeaderText = "Total"; + myOrderAmount->Width = 100; + myTableStyle2->GridColumnStyles->Add( myOrderAmount ); + + // Add the DataGridTableStyle objects to the GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle1 ); + myDataGrid->TableStyles->Add( myTableStyle2 ); + } + + // +private: + void RemoveColumnStyle_Clicked( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ 0 ]; + + // Get the GridColumnStylesCollection of Data Grid. + myColumns = myTableStyle->GridColumnStyles; + int i; + + // Remove the CustName ColumnStyle from the data grid. + if ( myColumns->Contains( "CustName" ) ) + { + DataGridColumnStyle^ myDataColumnStyle = myColumns[ "CustName" ]; + i = myColumns->IndexOf( myDataColumnStyle ); + myColumns->RemoveAt( i ); + } + } + // +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp new file mode 100644 index 00000000000..47d1bd10a52 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GridColumnStylesCollection_ResetPropertyDescriptor/CPP/resetpropertydescriptor.cpp @@ -0,0 +1,148 @@ +// System::Windows::Forms::GridColumnStylesCollection::ResetPropertyDescriptors() + +/* +The following program demonstrates the 'ResetPropertyDecriptors()' +method of 'GridColumnStylesCollection' class. An instance of DataGrid is +created and associate the data source to DataGrid. Then +column styles are added to the data grid. A Reset button is +provided to reset the property descriptors of the DataGrid +columns. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class MyForm: public Form +{ +private: + System::ComponentModel::Container^ myComponents; + Button^ resetButton; + DataGrid^ myDataGrid; + DataSet^ myDataSet; + +public: + MyForm() + { + // Required for Windows Form Designer support. + InitializeComponent(); + + // Call MyDataSource to bind the controls. + MyDataSource(); + } + +private: + void InitializeComponent() + { + // Create the form and its controls. + this->myComponents = gcnew System::ComponentModel::Container; + this->Text = "DataGrid Control Sample"; + this->resetButton = gcnew Button; + resetButton->Location = Point(24,16); + resetButton->Size = System::Drawing::Size( 124, 30 ); + resetButton->Text = "Reset Property Descriptor"; + resetButton->Click += gcnew System::EventHandler( this, &MyForm::ResetButton_Click ); + this->myDataGrid = gcnew DataGrid; + myDataGrid->Location = Point(24,50); + myDataGrid->Size = System::Drawing::Size( 300, 200 ); + myDataGrid->CaptionText = "Microsoft DataGrid Control"; + this->Controls->Add( resetButton ); + this->Controls->Add( myDataGrid ); + } + + void MyDataSource() + { + // Create a DataSet with one table + MakeDataSet(); + + // Bind the DataGrid to the DataSet. + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + // +private: + void ResetButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + DataGridTableStyle^ myTableStyle = myDataGrid->TableStyles[ 0 ]; + GridColumnStylesCollection^ myColumns = myTableStyle->GridColumnStyles; + + // Reset the property descriptor of column styles collection. + myColumns->ResetPropertyDescriptors(); + } + // + +private: + void AddCustomDataTableStyle() + { + // Get the currency manager for 'myDataSet' data source. + CurrencyManager^ myCurrencyManger = dynamic_cast(this->BindingContext[ myDataSet ]); + + // Associate the 'DataGridTableStyle' to the 'myDataSet' data source. + DataGridTableStyle^ myTableStyle = gcnew DataGridTableStyle; + myTableStyle->MappingName = "Customers"; + + // Add style for 'Name' column. + PropertyDescriptor^ pdName = myCurrencyManger->GetItemProperties()[ "CustName" ]; + + // Create an instance of 'DataGridColumnStyle'. + DataGridColumnStyle^ myCustomerNameStyle = gcnew DataGridTextBoxColumn( pdName ); + myCustomerNameStyle->MappingName = "custName"; + myCustomerNameStyle->HeaderText = "Customer Name"; + myTableStyle->GridColumnStyles->Add( myCustomerNameStyle ); + + // Add style for 'Date' column. + PropertyDescriptor^ myDateDescriptor = myCurrencyManger->GetItemProperties()[ "Date" ]; + DataGridColumnStyle^ myDateStyle = gcnew DataGridTextBoxColumn( myDateDescriptor,"G" ); + myDateStyle->MappingName = "Date"; + myDateStyle->HeaderText = "Date"; + myDateStyle->Width = 150; + myTableStyle->GridColumnStyles->Add( myDateStyle ); + + // Add DataGridTableStyle instances to GridTableStylesCollection. + myDataGrid->TableStyles->Add( myTableStyle ); + } + + void MakeDataSet() + { + myDataSet = gcnew DataSet( "myDataSet" ); + DataTable^ myCustomerTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the table. + DataColumn^ myCustomerName = gcnew DataColumn( "CustName" ); + DataColumn^ myDate = gcnew DataColumn( "Date",System::DateTime::typeid ); + myCustomerTable->Columns->Add( myCustomerName ); + myCustomerTable->Columns->Add( myDate ); + + // Add the tables to the DataSet. + myDataSet->Tables->Add( myCustomerTable ); + DataRow^ myNewRow; + for ( int i = 1; i < 3; i++ ) + { + myNewRow = myCustomerTable->NewRow(); + + // Add the row to the Customers table. + myCustomerTable->Rows->Add( myNewRow ); + } + + myCustomerTable->Rows[ 0 ][ "custName" ] = "Customer1"; + myCustomerTable->Rows[ 1 ][ "custName" ] = "Customer2"; + myCustomerTable->Rows[ 0 ][ "Date" ] = System::DateTime::Now; + myCustomerTable->Rows[ 1 ][ "Date" ] = System::DateTime::Today; + + // Add column style collections. + AddCustomDataTableStyle(); + } +}; + +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp b/snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp new file mode 100644 index 00000000000..fd8eaf24dde --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/GridTableStylesCollectionExamples/CPP/gridtablestylescollectionexamples.cpp @@ -0,0 +1,162 @@ +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::IO; +using namespace System::Data; +using namespace System::Windows::Forms; + +public ref class DataGridTableStuff: public Form +{ +private: + DataGrid^ myDataGrid; + DataSet^ myDataSet; + void SetUp() + { + myDataSet = gcnew DataSet( "myDataSet" ); + myDataGrid = gcnew DataGrid; + } + + // + void AddCustomDataTableStyle() + { + DataGridTableStyle^ ts1 = gcnew DataGridTableStyle; + ts1->MappingName = "Customers"; + + // Set other properties. + ts1->AlternatingBackColor = Color::LightGray; + + /* Add a GridColumnStyle and set its MappingName + to the name of a DataColumn in the DataTable. + Set the HeaderText and Width properties. */ + DataGridColumnStyle^ boolCol = gcnew DataGridBoolColumn; + boolCol->MappingName = "Current"; + boolCol->HeaderText = "IsCurrent Customer"; + boolCol->Width = 150; + ts1->GridColumnStyles->Add( boolCol ); + + // Add a second column style. + DataGridColumnStyle^ TextCol = gcnew DataGridTextBoxColumn; + TextCol->MappingName = "custName"; + TextCol->HeaderText = "Customer Name"; + TextCol->Width = 250; + ts1->GridColumnStyles->Add( TextCol ); + + // Create the second table style with columns. + DataGridTableStyle^ ts2 = gcnew DataGridTableStyle; + ts2->MappingName = "Orders"; + + // Set other properties. + ts2->AlternatingBackColor = Color::LightBlue; + + // Create new ColumnStyle objects. + DataGridColumnStyle^ cOrderDate = gcnew DataGridTextBoxColumn; + cOrderDate->MappingName = "OrderDate"; + cOrderDate->HeaderText = "Order Date"; + cOrderDate->Width = 100; + ts2->GridColumnStyles->Add( cOrderDate ); + + /*Use a PropertyDescriptor to create a formatted + column. First get the PropertyDescriptorCollection + for the data source and data member. */ + System::ComponentModel::PropertyDescriptorCollection^ pcol = this-> + BindingContext[myDataSet, "Customers::custToOrders"]-> + GetItemProperties(); + + /* Create a formatted column using a PropertyDescriptor. + The formatting character S"c" specifies a currency format. */ + DataGridColumnStyle^ csOrderAmount = + gcnew DataGridTextBoxColumn( pcol[ "OrderAmount" ],"c",true ); + csOrderAmount->MappingName = "OrderAmount"; + csOrderAmount->HeaderText = "Total"; + csOrderAmount->Width = 100; + ts2->GridColumnStyles->Add( csOrderAmount ); + + /* Add the DataGridTableStyle instances to + the GridTableStylesCollection. */ + myDataGrid->TableStyles->Add( ts1 ); + myDataGrid->TableStyles->Add( ts2 ); + } + // + + // + void GetGridTableByIndex() + { + DataGridTableStyle^ myGridStyle = myDataGrid->TableStyles[ 0 ]; + Console::WriteLine( myGridStyle->MappingName ); + } + // + + // + void GetGridTableByName() + { + DataGridTableStyle^ myGridStyle = myDataGrid->TableStyles[ "customers" ]; + Console::WriteLine( myGridStyle->MappingName ); + } + // + + // + void AddDataGridTableStyle() + { + // Create a new DataGridTableStyle and set MappingName. + DataGridTableStyle^ myGridStyle = gcnew DataGridTableStyle; + myGridStyle->MappingName = "Customers"; + + // Create two DataGridColumnStyle objects. + DataGridColumnStyle^ colStyle1 = gcnew DataGridTextBoxColumn; + colStyle1->MappingName = "firstName"; + DataGridColumnStyle^ colStyle2 = gcnew DataGridBoolColumn; + colStyle2->MappingName = "Current"; + + // Add column styles to table style. + myGridStyle->GridColumnStyles->Add( colStyle1 ); + myGridStyle->GridColumnStyles->Add( colStyle2 ); + + // Add the grid style to the GridStylesCollection. + myDataGrid->TableStyles->Add( myGridStyle ); + } + // + + // + void AddArray() + { + /* Get three CurrencyManager objects used to construct + DataGridTableSTyle objects. */ + CurrencyManager^ customersManager = + dynamic_cast(this->BindingContext[myDataSet, "Customers"]); + CurrencyManager^ regionsManager = + dynamic_cast(this->BindingContext[myDataSet, "Customers"]); + CurrencyManager^ productsManager = + dynamic_cast(this->BindingContext[myDataSet, "Customers"]); + DataGridTableStyle^ gridCustomers = gcnew DataGridTableStyle( customersManager ); + DataGridTableStyle^ gridRegions = gcnew DataGridTableStyle( regionsManager ); + DataGridTableStyle^ gridProducts = gcnew DataGridTableStyle( productsManager ); + + // Create a DataGridTableStyle array. + array^myGrids = {gridCustomers,gridRegions,gridProducts}; + + // Use AddRange to add to the collection. + myDataGrid->TableStyles->AddRange( myGrids ); + } + // + + // + void TestContains() + { + bool isContained; + isContained = myDataGrid->TableStyles->Contains( "Customers" ); + Console::WriteLine( isContained ); + } + // +}; + +int main() +{ + DataGridTableStuff^ dg = gcnew DataGridTableStuff; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp b/snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp new file mode 100644 index 00000000000..a522b891ba5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/HookProc Example/CPP/fontdialogoverride.cpp @@ -0,0 +1,66 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +namespace FontDialogOverride_cs +{ + /// + /// Summary description for FontDialogOverride. + /// + public ref class FontDialogOverride: public FontDialog + { + // + private: + // Defines the constants for Windows messages. + literal int WM_SETFOCUS = 0x0007; + literal int WM_INITDIALOG = 0x0110; + literal int WM_LBUTTONDOWN = 0x0201; + literal int WM_RBUTTONDOWN = 0x0204; + literal int WM_MOVE = 0x0003; + + protected: + // Overrides the base class hook procedure... + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + virtual IntPtr HookProc( IntPtr hWnd, int msg, IntPtr wParam, IntPtr lParam ) override + { + // Evaluates the message parameter to determine the user action. + #if defined(TRACE) + switch ( msg ) + { + case WM_INITDIALOG: + System::Diagnostics::Trace::Write( "The WM_INITDIALOG message was received." ); + break; + case WM_SETFOCUS: + System::Diagnostics::Trace::Write( "The WM_SETFOCUS message was received." ); + break; + case WM_LBUTTONDOWN: + System::Diagnostics::Trace::Write( "The WM_LBUTTONDOWN message was received." ); + break; + case WM_RBUTTONDOWN: + System::Diagnostics::Trace::Write( "The WM_RBUTTONDOWN message was received." ); + break; + case WM_MOVE: + System::Diagnostics::Trace::Write( "The WM_MOVE message was received." ); + break; + } + #endif + + // Always call the base class hook procedure. + return FontDialog::HookProc( hWnd, msg, wParam, lParam ); + } + // + + public: + FontDialogOverride() + { + // + // TODO: Add constructor logic here + // + } + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp new file mode 100644 index 00000000000..99a6f5e0027 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/HorizontalAlignment/CPP/form1.cpp @@ -0,0 +1,109 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Name = "textBox1"; + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + array^formControls = {this->textBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Add a text String* to the TextBox. + textBox1->Text = "Hello World!"; + + // Set the size of the TextBox. + textBox1->AutoSize = false; + textBox1->Size = System::Drawing::Size( Width, Height / 3 ); + + // Align the text in the center of the control element. + textBox1->TextAlign = HorizontalAlignment::Center; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp new file mode 100644 index 00000000000..c97b54810d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/HotTrack/CPP/form1.cpp @@ -0,0 +1,50 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + array^tabControls = {this->tabPage1,this->tabPage2}; + this->tabControl1->Controls->AddRange( tabControls ); + this->tabControl1->Padding = Point(15,10); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + + // Highlights TabPage::Text when the mouse passes over tabs. + this->tabControl1->HotTrack = true; + this->tabPage1->Text = "myTabPage1"; + this->tabPage2->Text = "myTabPage2"; + this->Size = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp new file mode 100644 index 00000000000..a50c5a0e743 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/HtmlElementEventHandler/CPP/form1.cpp @@ -0,0 +1,121 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Security::Permissions; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::WebBrowser^ WebBrowser1; + + /// + /// Required designer variable. + /// + System::ComponentModel::IContainer^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + void InitializeComponent() + { + this->WebBrowser1 = gcnew System::Windows::Forms::WebBrowser; + this->SuspendLayout(); + + // + // WebBrowser1 + // + this->WebBrowser1->Dock = System::Windows::Forms::DockStyle::Fill; + this->WebBrowser1->Location = System::Drawing::Point( 0, 0 ); + this->WebBrowser1->Name = "WebBrowser1"; + this->WebBrowser1->Size = System::Drawing::Size( 824, 440 ); + this->WebBrowser1->TabIndex = 0; + this->WebBrowser1->DocumentCompleted += gcnew System::Windows::Forms::WebBrowserDocumentCompletedEventHandler( this, &Form1::webBrowser1_DocumentCompleted ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 824, 440 ); + this->Controls->Add( this->WebBrowser1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void webBrowser1_DocumentCompleted( Object^ /*sender*/, System::Windows::Forms::WebBrowserDocumentCompletedEventArgs^ /*e*/ ) + { + WebBrowser1->Document->MouseDown += gcnew HtmlElementEventHandler( this, &Form1::Document_MouseDown ); + WebBrowser1->Document->MouseMove += gcnew HtmlElementEventHandler( this, &Form1::Document_MouseMove ); + WebBrowser1->Document->MouseUp += gcnew HtmlElementEventHandler( this, &Form1::Document_MouseUp ); + } + + void Document_MouseDown( Object^ /*sender*/, HtmlElementEventArgs^ /*e*/ ) + { + // Insert your code here. + } + + void Document_MouseMove( Object^ /*sender*/, HtmlElementEventArgs^ /*e*/ ) + { + // Insert your code here. + } + + void Document_MouseUp( Object^ /*sender*/, HtmlElementEventArgs^ /*e*/ ) + { + // Insert your code here. + } + // +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp b/snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp new file mode 100644 index 00000000000..2a22650d0e7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IButtonControl Implementation/CPP/mybutton.cpp @@ -0,0 +1,61 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class MyButton: public ButtonBase, public IButtonControl +{ +private: + System::Windows::Forms::DialogResult myDialogResult; + +public: + MyButton() + { + // Make the button White and a Popup style + // so it can be distinguished on the form. + this->FlatStyle = ::FlatStyle::Popup; + this->BackColor = Color::White; + } + + property System::Windows::Forms::DialogResult DialogResult + { + // Add implementation to the IButtonControl.DialogResult property. + virtual System::Windows::Forms::DialogResult get() + { + return this->myDialogResult; + } + + virtual void set( System::Windows::Forms::DialogResult value ) + { + if ( Enum::IsDefined( System::Windows::Forms::DialogResult::typeid, value ) ) + { + this->myDialogResult = value; + } + } + } + + // Add implementation to the IButtonControl.NotifyDefault method. + virtual void NotifyDefault( bool value ) + { + if ( this->IsDefault != value ) + { + this->IsDefault = value; + } + } + + // Add implementation to the IButtonControl.PerformClick method. + virtual void PerformClick() + { + if ( this->CanSelect ) + { + this->OnClick( EventArgs::Empty ); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp new file mode 100644 index 00000000000..72fa8a99347 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IComponentChangeServiceSample2/CPP/icomponentchangeserviceexample.cpp @@ -0,0 +1,173 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +/* This sample illustrates how to use the IComponentChangeService interface + to handle component change events. The ComponentClass control attaches + event handlers when it is sited in a document, and displays a message + when notification that a component has been added, removed, or changed + is received from the IComponentChangeService. + + To run this sample, add the ComponentClass control to a Form and + add, remove, or change components to see the behavior of the + component change event handlers. */ + +public ref class ComponentClass: public UserControl +{ +private: + System::ComponentModel::Container^ components; + ListBox^ listBox1; + IComponentChangeService^ m_changeService; + void InitializeComponent() + { + this->listBox1 = gcnew ListBox; + this->SuspendLayout(); + + // listBox1. + this->listBox1->Location = System::Drawing::Point( 24, 16 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 576, 277 ); + this->listBox1->TabIndex = 0; + + // ComponentClass. + array^myArray = {listBox1}; + this->Controls->AddRange( myArray ); + this->Name = "ComponentClass"; + this->Size = System::Drawing::Size( 624, 320 ); + this->ResumeLayout( false ); + } + + void ClearChangeNotifications() + { + // The m_changeService value is 0 when not in design mode, + // as the IComponentChangeService is only available at design time. + m_changeService = dynamic_cast(GetService( IComponentChangeService::typeid )); + + // Clear our the component change events to prepare for re-siting. + if ( m_changeService != nullptr ) + { + m_changeService->ComponentChanged -= gcnew ComponentChangedEventHandler( this, &ComponentClass::OnComponentChanged ); + m_changeService->ComponentChanging -= gcnew ComponentChangingEventHandler( this, &ComponentClass::OnComponentChanging ); + m_changeService->ComponentAdded -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdded ); + m_changeService->ComponentAdding -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdding ); + m_changeService->ComponentRemoved -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoved ); + m_changeService->ComponentRemoving -= gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoving ); + m_changeService->ComponentRename -= gcnew ComponentRenameEventHandler( this, &ComponentClass::OnComponentRename ); + } + } + + void RegisterChangeNotifications() + { + // Register the event handlers for the IComponentChangeService events + if ( m_changeService != nullptr ) + { + m_changeService->ComponentChanged += gcnew ComponentChangedEventHandler( this, &ComponentClass::OnComponentChanged ); + m_changeService->ComponentChanging += gcnew ComponentChangingEventHandler( this, &ComponentClass::OnComponentChanging ); + m_changeService->ComponentAdded += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdded ); + m_changeService->ComponentAdding += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentAdding ); + m_changeService->ComponentRemoved += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoved ); + m_changeService->ComponentRemoving += gcnew ComponentEventHandler( this, &ComponentClass::OnComponentRemoving ); + m_changeService->ComponentRename += gcnew ComponentRenameEventHandler( this, &ComponentClass::OnComponentRename ); + } + } + + /* This method handles the OnComponentChanged event to display a notification. */ + void OnComponentChanged( Object^ /*sender*/, ComponentChangedEventArgs^ ce ) + { + if ( ce->Component != nullptr && static_cast(ce->Component)->Site != nullptr && ce->Member != nullptr ) + OnUserChange( "The " + ce->Member->Name + " member of the " + static_cast(ce->Component)->Site->Name + " component has been changed." ); + } + + + /* This method handles the OnComponentChanging event to display a notification. */ + void OnComponentChanging( Object^ /*sender*/, ComponentChangingEventArgs^ ce ) + { + if ( ce->Component != nullptr && static_cast(ce->Component)->Site != nullptr && ce->Member != nullptr ) + OnUserChange( "The " + ce->Member->Name + " member of the " + static_cast(ce->Component)->Site->Name + " component is being changed." ); + } + + /* This method handles the OnComponentAdded event to display a notification. */ + void OnComponentAdded( Object^ /*sender*/, ComponentEventArgs^ ce ) + { + OnUserChange( "A component, " + ce->Component->Site->Name + ", has been added." ); + } + + /* This method handles the OnComponentAdding event to display a notification. */ + void OnComponentAdding( Object^ /*sender*/, ComponentEventArgs^ ce ) + { + OnUserChange( "A component of type " + ce->Component->GetType()->FullName + " is being added." ); + } + + /* This method handles the OnComponentRemoved event to display a notification. */ + void OnComponentRemoved( Object^ /*sender*/, ComponentEventArgs^ ce ) + { + OnUserChange( "A component, " + ce->Component->Site->Name + ", has been removed." ); + } + + /* This method handles the OnComponentRemoving event to display a notification. */ + void OnComponentRemoving( Object^ /*sender*/, ComponentEventArgs^ ce ) + { + OnUserChange( "A component, " + ce->Component->Site->Name + ", is being removed." ); + } + + /* This method handles the OnComponentRename event to display a notification. */ + void OnComponentRename( Object^ /*sender*/, ComponentRenameEventArgs^ ce ) + { + OnUserChange( "A component, " + ce->OldName + ", was renamed to " + ce->NewName + "." ); + } + + // This method adds a specified notification message to the control's listbox. + void OnUserChange( String^ text ) + { + listBox1->Items->Add( text ); + } + +public: + ComponentClass() + { + InitializeComponent(); + } + + property ISite^ Site + { + // This override allows the control to register event handlers for IComponentChangeService events + // at the time the control is sited, which happens only in design mode. + virtual ISite^ get() override + { + return Site; + } + + virtual void set( ISite^ value ) override + { + // Clear any component change event handlers. + ClearChangeNotifications(); + + // Set the new Site value. + Site = value; + m_changeService = static_cast(GetService( IComponentChangeService::typeid )); + + // Register event handlers for component change events. + RegisterChangeNotifications(); + } + } + + // Clean up any resources being used. +public: + ~ComponentClass() + { + ClearChangeNotifications(); + if ( components != nullptr ) + { + delete components; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp new file mode 100644 index 00000000000..13ee5b9d931 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IContainerControl Implementation/CPP/mycontainercontrol.cpp @@ -0,0 +1,61 @@ + + +#using +#using +#using + +// +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class MyContainer: public ScrollableControl, public IContainerControl +{ +private: + Control^ activeControl; + +public: + MyContainer() + { + // Make the container control Blue so it can be distinguished on the form. + this->BackColor = Color::Blue; + + // Make the container scrollable. + this->AutoScroll = true; + } + + property Control^ ActiveControl + { + // Add implementation to the IContainerControl.ActiveControl property. + virtual Control^ get() + { + return activeControl; + } + + virtual void set( Control^ value ) + { + + // Make sure the control is a member of the ControlCollection. + if ( this->Controls->Contains( value ) ) + { + activeControl = value; + } + } + } + + // Add implementations to the IContainerControl.ActivateControl(Control) method. + virtual bool ActivateControl( Control^ active ) + { + if ( this->Controls->Contains( active ) ) + { + // Select the control and scroll the control into view if needed. + active->Select( ); + this->ScrollControlIntoView( active ); + this->activeControl = active; + return true; + } + + return false; + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp new file mode 100644 index 00000000000..326e941da97 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IDesignerEventServiceExample/CPP/source.cpp @@ -0,0 +1,143 @@ +// +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Collections; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +namespace DesignerEventServiceExample +{ + ref class DesignerMonitorDesigner; + + // DesignerMonitor provides a display for designer event notifications. + + [Designer(DesignerEventServiceExample::DesignerMonitorDesigner::typeid)] + public ref class DesignerMonitor: public UserControl + { + public: + + // List to contain strings that describe designer events. + ArrayList^ updates; + bool monitoring_events; + DesignerMonitor() + { + monitoring_events = false; + updates = gcnew ArrayList; + this->BackColor = Color::White; + this->Size = System::Drawing::Size( 450, 300 ); + } + + protected: + + // Display the message for the current mode, and any event messages if event monitoring is active. + virtual void OnPaint( PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "IDesignerEventService DesignerMonitor Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Blue ), 5, 4 ); + int yoffset = 10; + if ( !monitoring_events ) + { + yoffset += 10; + e->Graphics->DrawString( "Currently not monitoring designer events.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 10.f ); + e->Graphics->DrawString( "Use the shortcut menu commands", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 30.f ); + e->Graphics->DrawString( "provided by an associated DesignerMonitorDesigner", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 40.f ); + e->Graphics->DrawString( "to start or stop monitoring.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 50.f ); + } + else + { + e->Graphics->DrawString( "Currently monitoring designer events.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::DarkBlue ), 5.f, yoffset + 10.f ); + e->Graphics->DrawString( "Designer created, changed and disposed events:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Brown ), 5.f, yoffset + 35.f ); + for ( int i = 0; i < updates->Count; i++ ) + { + e->Graphics->DrawString( static_cast(updates[ i ]), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5.f, yoffset + 55.f + (10 * i) ); + yoffset += 10; + } + } + } + }; + + // DesignerMonitorDesigner uses the IDesignerEventService to send event information + // to an associated DesignerMonitor control's updates collection. + public ref class DesignerMonitorDesigner: public ControlDesigner + { + private: + DesignerMonitor^ dm; + DesignerVerbCollection^ dvc; + int eventcount; + void StopMonitoring( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IDesignerEventService^ des = dynamic_cast(this->Control->Site->GetService( IDesignerEventService::typeid )); + if ( des != nullptr ) + { + // Remove event handlers for event notification methods. + des->DesignerCreated -= gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerCreated ); + des->DesignerDisposed -= gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerDisposed ); + des->ActiveDesignerChanged -= gcnew ActiveDesignerEventHandler( this, &DesignerMonitorDesigner::DesignerChanged ); + des->SelectionChanged -= gcnew EventHandler( this, &DesignerMonitorDesigner::SelectionChanged ); + dm->monitoring_events = false; + + // Rebuild menu with "Start monitoring" command. + array^myArray = {gcnew DesignerVerb( "Start monitoring",gcnew EventHandler( this, &DesignerMonitorDesigner::StartMonitoring ) )}; + dvc = gcnew DesignerVerbCollection( myArray ); + dm->Refresh(); + } + } + + void StartMonitoring( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IDesignerEventService^ des = dynamic_cast(this->Control->Site->GetService( IDesignerEventService::typeid )); + if ( des != nullptr ) + { + // Add event handlers for event notification methods. + des->DesignerCreated += gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerCreated ); + des->DesignerDisposed += gcnew DesignerEventHandler( this, &DesignerMonitorDesigner::DesignerDisposed ); + des->ActiveDesignerChanged += gcnew ActiveDesignerEventHandler( this, &DesignerMonitorDesigner::DesignerChanged ); + des->SelectionChanged += gcnew EventHandler( this, &DesignerMonitorDesigner::SelectionChanged ); + dm->monitoring_events = false; + + // Rebuild menu with "Stop monitoring" command. + array^myArray = {gcnew DesignerVerb( "Stop monitoring",gcnew EventHandler( this, &DesignerMonitorDesigner::StopMonitoring ) )}; + dvc = gcnew DesignerVerbCollection( myArray ); + dm->Refresh(); + } + } + + void DesignerCreated( Object^ /*sender*/, DesignerEventArgs^ e ) + { + UpdateStatus( "Designer for " + e->Designer->RootComponent->Site->Name + " was created." ); + } + + void DesignerDisposed( Object^ /*sender*/, DesignerEventArgs^ e ) + { + UpdateStatus( "Designer for " + e->Designer->RootComponent->Site->Name + " was disposed." ); + } + + void DesignerChanged( Object^ /*sender*/, ActiveDesignerEventArgs^ e ) + { + UpdateStatus( "Active designer moved from " + e->OldDesigner->RootComponent->Site->Name + " to " + e->NewDesigner->RootComponent->Site->Name + "." ); + } + + void SelectionChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + UpdateStatus("A component selection was changed."); + } + + // Update message buffer on DesignerMonitor control. + void UpdateStatus( String^ newmsg ) + { + if ( dm->updates->Count > 10 ) + dm->updates->RemoveAt( 10 ); + + dm->updates->Insert( 0, "Event #" + eventcount.ToString() + ": " + newmsg ); + eventcount++; + dm->Refresh(); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp new file mode 100644 index 00000000000..82ace3a89a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IDesignerExample/CPP/testcontrol.cpp @@ -0,0 +1,93 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +public ref class ExampleIDesigner: public System::ComponentModel::Design::IDesigner +{ +private: + + // Local reference to the designer's component. + IComponent^ component; + +public: + + property System::ComponentModel::IComponent^ Component + { + // Public accessor to the designer's component. + virtual System::ComponentModel::IComponent^ get() + { + return component; + } + } + ExampleIDesigner(){} + + virtual void Initialize( System::ComponentModel::IComponent^ component ) + { + // This method is called after a designer for a component is created, + // and stores a reference to the designer's component. + this->component = component; + } + + // This method peforms the 'default' action for the designer. The default action + // for a basic IDesigner implementation is invoked when the designer's component + // is double-clicked. By default, a component associated with a basic IDesigner + // implementation is displayed in the design-mode component tray. + virtual void DoDefaultAction() + { + // Shows a message box indicating that the default action for the designer was invoked. + MessageBox::Show( "The DoDefaultAction method of an IDesigner implementation was invoked.", "Information" ); + } + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + // Returns a collection of designer verb menu items to show in the + // shortcut menu for the designer's component. + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() + { + DesignerVerbCollection^ verbs = gcnew DesignerVerbCollection; + DesignerVerb^ dv1 = gcnew DesignerVerb( "Display Component Name",gcnew EventHandler( this, &ExampleIDesigner::ShowComponentName ) ); + verbs->Add( dv1 ); + return verbs; + } + } + +private: + + // Event handler for displaying a message box showing the designer's component's name. + void ShowComponentName( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->Component != nullptr ) + MessageBox::Show( this->Component->Site->Name, "Designer Component's Name" ); + } + +public: + + // Provides an opportunity to release resources before object destruction. + ~ExampleIDesigner(){} + +}; + +// A DesignerAttribute associates the example IDesigner with an example control. + +[DesignerAttribute(ExampleIDesigner::typeid)] +public ref class TestControl: public System::Windows::Forms::UserControl +{ +public: + TestControl(){} + +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp new file mode 100644 index 00000000000..0af1a128362 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IDesignerHostExample/CPP/idesignerhostexample.cpp @@ -0,0 +1,151 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +// Provides a form containing a listbox that can display +// a list of project components. +public ref class DesignerHostListForm: public System::Windows::Forms::Form +{ +public: + System::Windows::Forms::ListBox^ listBox1; + +private: + System::Windows::Forms::Button^ ok_button; + +public: + DesignerHostListForm() + { + this->Name = "DesignerHostListForm"; + this->Text = "List of design-time project components"; + this->SuspendLayout(); + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->listBox1->Location = System::Drawing::Point( 8, 8 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 385, 238 ); + this->listBox1->TabIndex = 0; + this->listBox1->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); + this->ok_button = gcnew System::Windows::Forms::Button; + this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; + this->ok_button->Location = System::Drawing::Point( 232, 256 ); + this->ok_button->Name = "ok_button"; + this->ok_button->TabIndex = 1; + this->ok_button->Text = "OK"; + this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->ClientSize = System::Drawing::Size( 400, 285 ); + array^temp2 = {this->ok_button,this->listBox1}; + this->Controls->AddRange( temp2 ); + this->ResumeLayout( false ); + } + +public: + ~DesignerHostListForm() + { + } +}; + + +// You can double-click the component of an IDesignerHostExampleDesigner +// to show a form containing a listbox that lists the name and type +// of each component or control in the current design-time project. +public ref class IDesignerHostExampleDesigner: public IDesigner +{ +private: + System::ComponentModel::IComponent^ component; + +public: + IDesignerHostExampleDesigner(){} + + virtual void DoDefaultAction() + { + ListComponents(); + } + + virtual void Initialize( System::ComponentModel::IComponent^ component ) + { + this->component = component; + MessageBox::Show( "Double-click the IDesignerHostExample component to view a list of project components." ); + } + + +private: + + // Displays a list of components in the current design + // document when the default action of the designer is invoked. + void ListComponents() + { + DesignerHostListForm^ listform = gcnew DesignerHostListForm; + + // Obtain an IDesignerHost service from the design environment. + IDesignerHost^ host = dynamic_cast(this->component->Site->GetService( IDesignerHost::typeid )); + + // Get the project components container (control containment depends on Controls collections) + IContainer^ container = host->Container; + + // Add each component's type name and name to the list box. + System::Collections::IEnumerator^ myEnum = container->Components->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + IComponent^ component = safe_cast(myEnum->Current); + listform->listBox1->Items->Add( String::Concat( component->GetType()->Name, " : ", component->Site->Name ) ); + } + + listform->ShowDialog(); + } + +public: + + property System::ComponentModel::IComponent^ Component + { + virtual System::ComponentModel::IComponent^ get() + { + return this->component; + } + } + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() + { + DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; + dvc->Add( gcnew DesignerVerb( "List Components",gcnew EventHandler( this, &IDesignerHostExampleDesigner::ListHandler ) ) ); + return dvc; + } + } + +private: + void ListHandler( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + ListComponents(); + } + +public: + ~IDesignerHostExampleDesigner(){} +}; + + +// IDesignerHostExampleComponent is a component associated +// with the IDesignerHostExampleDesigner that demonstrates +// acquisition and use of the IDesignerHost service +// to list project components. + +[DesignerAttribute(IDesignerHostExampleDesigner::typeid)] +public ref class IDesignerHostExampleComponent: public System::ComponentModel::Component +{ +public: + IDesignerHostExampleComponent(){} + +public: + ~IDesignerHostExampleComponent(){} +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp new file mode 100644 index 00000000000..6f15f0f4abb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IDesignerOptionServiceExample/CPP/idesigneroptionservicecontrol.cpp @@ -0,0 +1,95 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +namespace IDesignerOptionServiceExample +{ + // This control demonstrates retrieving the standard + // designer option service values in design mode. + public ref class IDesignerOptionServiceControl: public System::Windows::Forms::UserControl + { + private: + IDesignerOptionService^ designerOptionService; + + public: + IDesignerOptionServiceControl() + { + this->BackColor = Color::Beige; + this->Size = System::Drawing::Size( 404, 135 ); + } + + property System::ComponentModel::ISite^ Site + { + virtual System::ComponentModel::ISite^ get() override + { + return __super::Site; + } + + virtual void set( System::ComponentModel::ISite^ value ) override + { + __super::Site = value; + + // If siting component, attempt to obtain an IDesignerOptionService. + if ( __super::Site != nullptr ) + designerOptionService = dynamic_cast(this->GetService( IDesignerOptionService::typeid )); + } + } + + protected: + + // Displays control information and current IDesignerOptionService + // values, if available. + + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "IDesignerOptionServiceControl", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Blue ), 4, 4 ); + if ( this->DesignMode ) + e->Graphics->DrawString( "Currently in design mode", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 18 ); + else + e->Graphics->DrawString( "Not in design mode. Cannot access IDesignerOptionService.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Red ), 4, 18 ); + + if ( __super::Site != nullptr && designerOptionService != nullptr ) + { + e->Graphics->DrawString( "IDesignerOptionService provides access to the table of option values listed when", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 38 ); + e->Graphics->DrawString( "the Windows Forms Designer\\General tab of the Tools\\Options menu is selected.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 50 ); + e->Graphics->DrawString( "Table of standard value names and current values", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Red ), 4, 76 ); + + // Displays a table of the standard value names and current values. + int ypos = 90; + + // + // Obtains and shows the size of the standard design-mode grid square. + System::Drawing::Size size = *dynamic_cast(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "GridSize" )); + // + e->Graphics->DrawString( "GridSize", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, (float)ypos ); + e->Graphics->DrawString( size.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 100, (float)ypos ); + ypos += 12; + + // Obtains and shows whether the design mode surface grid is enabled. + bool showGrid = *dynamic_cast(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "ShowGrid" )); + e->Graphics->DrawString( "ShowGrid", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, (float)ypos ); + e->Graphics->DrawString( showGrid.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 100, (float)ypos ); + ypos += 12; + + // Obtains and shows whether components should be aligned with the surface grid. + bool snapToGrid = *dynamic_cast(designerOptionService->GetOptionValue( "WindowsFormsDesigner\\General", "SnapToGrid" )); + e->Graphics->DrawString( "SnapToGrid", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, (float)ypos ); + e->Graphics->DrawString( snapToGrid.ToString(), gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 100, (float)ypos ); + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp b/snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp new file mode 100644 index 00000000000..2b4f9c47f9b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IDesignerSerializationManagerSample/CPP/idesignerserializationmanagersample.cpp @@ -0,0 +1,88 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::CodeDom; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace CodeDomSerializerSample +{ + ref class MyComponent; + private ref class MyCodeDomSerializer: public CodeDomSerializer + { + public: + Object^ Deserialize( IDesignerSerializationManager^ manager, Object^ codeObject ) new + { + // This is how we associate the component with the serializer. + CodeDomSerializer^ baseClassSerializer = (CodeDomSerializer^)( + manager->GetSerializer( + MyComponent::typeid->BaseType, CodeDomSerializer::typeid )); + + /* This is the simplest case, in which the class just calls the base class + to do the work. */ + return baseClassSerializer->Deserialize( manager, codeObject ); + } + + Object^ Serialize( IDesignerSerializationManager^ manager, Object^ value ) new + { + /* Associate the component with the serializer in the same manner as with + Deserialize */ + CodeDomSerializer^ baseClassSerializer = (CodeDomSerializer^)( + manager->GetSerializer( + MyComponent::typeid->BaseType, CodeDomSerializer::typeid )); + + Object^ codeObject = baseClassSerializer->Serialize( manager, value ); + + /* Anything could be in the codeObject. This sample operates on a + CodeStatementCollection. */ + if ( (CodeStatementCollection^)(codeObject) ) + { + CodeStatementCollection^ statements = (CodeStatementCollection^)(codeObject); + + // The code statement collection is valid, so add a comment. + String^ commentText = "This comment was added to this object by a custom serializer."; + CodeCommentStatement^ comment = gcnew CodeCommentStatement( commentText ); + statements->Insert( 0, comment ); + } + return codeObject; + } + }; + + // + [DesignerSerializer(CodeDomSerializerSample::MyCodeDomSerializer::typeid, + CodeDomSerializer::typeid)] + public ref class MyComponent: public Component + { + private: + String^ localProperty; + + public: + MyComponent() + { + localProperty = "Component Property Value"; + } + + property String^ LocalProperty + { + String^ get() + { + return localProperty; + } + void set( String^ value ) + { + localProperty = value; + } + } + }; +} +// +// + +[STAThread] +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp new file mode 100644 index 00000000000..312ba502167 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IDictionaryServiceExample/CPP/source.cpp @@ -0,0 +1,143 @@ + + +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +namespace IDictionaryServiceControl +{ + ref class IDictionaryServiceDesigner; + + // This example control works with the IDictionaryServiceDesigner to demonstrate + // using the IDictionaryService for storing data provided by a designer, and + // accessing it from a control. The IDictionaryService provides a Site-specific + // key-based dictionary. An IDictionaryServiceDesigner sets an ArrayList of strings + // to the dictionary with a "DesignerData" key, and its contents are accessed and + // displayed once the Update box is clicked at design time. + + [DesignerAttribute(IDictionaryServiceDesigner::typeid,IDesigner::typeid)] + public ref class IDictionaryServiceControl: public System::Windows::Forms::UserControl + { + public: + ArrayList^ al; + IDictionaryServiceControl() + { + // Initializes the example control. + al = gcnew ArrayList; + this->Size = System::Drawing::Size( 344, 88 ); + this->BackColor = Color::White; + } + + protected: + + // Draws the instructions and user interface, and any strings contained + // in a local ArrayList. + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + if ( this->DesignMode ) + { + e->Graphics->DrawString( "IDictionaryServiceDesigner Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Blue ), 5, 4 ); + e->Graphics->DrawString( "Click the Update box to update display strings", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 5, 17 ); + e->Graphics->DrawString( "from the IDictionaryService.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 5, 29 ); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Beige ), 270, 7, 60, 10 ); + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 270, 7, 60, 10 ); + e->Graphics->DrawString( "Update", gcnew System::Drawing::Font( FontFamily::GenericMonospace,7 ), gcnew SolidBrush( Color::Black ), 282, 7 ); + for ( int i = 0; i < al->Count; i++ ) + e->Graphics->DrawString( dynamic_cast(al[ i ]), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5.0f, 44.0f + (i * 12) ); + } + } + + // On mouse down, this method attempts to access the IDictionaryService and + // obtain an ArrayList with a key of "DesignerData" in the dictionary. + // If successful, this ArrayList is set to the local ArrayList. + virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ /*e*/ ) override + { + // + // Attempts to obtain the IDictionaryService using the Control.GetService method. + IDictionaryService^ ds = dynamic_cast(GetService( IDictionaryService::typeid )); + + // If the service was obtained... + if ( ds != nullptr ) + { + // Attempts to retrieve a list with a key of "DesignerData". + ArrayList^ list = dynamic_cast(ds->GetValue( "DesignerData" )); + + // + // If the list exists, sets the list obtained by the + // IDictionaryService to the local list. + if ( list != nullptr ) + this->al = list; + this->Refresh(); + } + } + + }; + + // This designer uses the IDictionaryService to store an ArrayList of + // information strings that the associated control can access and + // display. The IDictionaryService creates a new dictionary for each Site. + public ref class IDictionaryServiceDesigner: public System::Windows::Forms::Design::ControlDesigner + { + public: + IDictionaryServiceDesigner(){} + + // On designer initialization, this method attempts to obtain + // the IDictionaryService, and populates an ArrayList + // associated with a "DesignerData" key in the dictionary with + // designer- and control-related information strings. + virtual void Initialize( System::ComponentModel::IComponent^ component ) override + { + ControlDesigner::Initialize( component ); + IDictionaryService^ ds = dynamic_cast(component->Site->GetService( IDictionaryService::typeid )); + if ( ds != nullptr ) + { + // If the dictionary service does not contain a + // DesignerData key, adds an ArrayList for that key. + if ( ds->GetValue( "DesignerData" ) == nullptr ) + { + ds->SetValue( "DesignerData", gcnew ArrayList ); + ds->SetValue( "DesignerData", gcnew ArrayList ); + } + + // Obtains the ArrayList with the "DesignerData" key + // from the dictionary service. + ArrayList^ al = dynamic_cast(ds->GetValue( "DesignerData" )); + if ( al != nullptr ) + { + al->Clear(); + + // Populates the array list with designer and + // control information strings. + al->Add( String::Format( "Designer type: {0}", this->GetType()->Name ) ); + al->Add( String::Format( "Control type: {0}", this->Control->GetType()->Name ) ); + al->Add( String::Format( "Control name: {0}", this->Control->Name ) ); + } + } + } + + protected: + virtual bool GetHitTest( System::Drawing::Point point ) override + { + // Translates the point to client coordinates and passes the + // messages to the control while over the click box. + Point translated = this->Control->PointToClient( point ); + if ( translated.X > 269 && translated.X < 331 && translated.Y > 7 && translated.Y < 18 ) + return true; + else + return ControlDesigner::GetHitTest( point ); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp new file mode 100644 index 00000000000..be6ede4f398 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IEventBindingServiceExample/CPP/source.cpp @@ -0,0 +1,117 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Data; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +// This designer provides a "Connect testEvent" designer verb shortcut +// menu command. When invoked, the command attaches a new event-handler +// method named "testEventHandler" to the "testEvent" event of an +// associated control. +// If a "testEvent" event of the associated control does not exist, +// the IEventBindingService declares it. +public ref class EventDesigner: public System::Windows::Forms::Design::ControlDesigner +{ +public: + EventDesigner(){} + + // When the "Connect testEvent" designer verb shortcut menu + // command is invoked, this method uses the + // IEventBindingService to attach an event handler to a + // "textEvent" event of the associated control. +private: + void ConnectEvent( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IEventBindingService^ eventservice = dynamic_cast(this->Component->Site->GetService( System::ComponentModel::Design::IEventBindingService::typeid )); + if ( eventservice != nullptr ) + { + // Attempt to obtain a PropertyDescriptor for a + // component event named "testEvent". + EventDescriptorCollection^ edc = TypeDescriptor::GetEvents( this->Component ); + if ( edc == nullptr || edc->Count == 0 ) + return; + EventDescriptor^ ed = nullptr; + + // Search for an event named "testEvent". + IEnumerator^ myEnum = edc->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + EventDescriptor^ edi = safe_cast(myEnum->Current); + if ( edi->Name->Equals( "testEvent" ) ) + { + ed = edi; + break; + } + } + if ( ed == nullptr ) + return; + + // Use the IEventBindingService to get a + // PropertyDescriptor for the event. + PropertyDescriptor^ pd = eventservice->GetEventProperty( ed ); + if ( pd == nullptr ) + return; + + // Set the value of the event to "testEventHandler". + pd->SetValue( this->Component, "testEventHandler" ); + } + } + +public: + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + // Provides a designer verb command for the designer's + // shortcut menu. + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override + { + DesignerVerbCollection^ dvc = gcnew DesignerVerbCollection; + dvc->Add( gcnew DesignerVerb( "Connect testEvent",gcnew EventHandler( this, &EventDesigner::ConnectEvent ) ) ); + return dvc; + } + } +}; + +// EventControl is associated with the EventDesigner and displays +// instructions for demonstrating the service. + +[Designer(EventDesigner::typeid)] +public ref class EventControl: public System::Windows::Forms::UserControl +{ +public: + event System::EventHandler^ testEvent; + EventControl() + { + this->BackColor = Color::White; + this->Size = System::Drawing::Size( 320, 96 ); + } + +public: + ~EventControl() + { + } + +protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "IEventBindingService Example Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Blue ), 5, 5 ); + e->Graphics->DrawString( "Use the \"Connect testEvent\" command of the", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 22 ); + e->Graphics->DrawString( "right-click shortcut menu provided by this", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 32 ); + e->Graphics->DrawString( "control's associated EventDesigner to create", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 42 ); + e->Graphics->DrawString( "a new event handler linked with the testEvent", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 52 ); + e->Graphics->DrawString( "of this control in the initialization code", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 62 ); + e->Graphics->DrawString( "for this control.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 5, 72 ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp new file mode 100644 index 00000000000..5df15661f4c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IHelpServiceExample/CPP/source.cpp @@ -0,0 +1,68 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::IO; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +public ref class HelpDesigner: public System::Windows::Forms::Design::ControlDesigner +{ +public: + HelpDesigner(){} + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override + { + array^temp0 = {gcnew DesignerVerb( "Add IHelpService Help Keyword",gcnew EventHandler( this, &HelpDesigner::addKeyword ) ),gcnew DesignerVerb( "Remove IHelpService Help Keyword",gcnew EventHandler( this, &HelpDesigner::removeKeyword ) )}; + return gcnew DesignerVerbCollection( temp0 ); + } + } + +private: + void addKeyword( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IHelpService^ hs = dynamic_cast(this->Control->Site->GetService( IHelpService::typeid )); + hs->AddContextAttribute( "keyword", "IHelpService", HelpKeywordType::F1Keyword ); + } + + void removeKeyword( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IHelpService^ hs = dynamic_cast(this->Control->Site->GetService( IHelpService::typeid )); + hs->RemoveContextAttribute( "keyword", "IHelpService" ); + } +}; + + +[Designer(HelpDesigner::typeid)] +public ref class HelpTestControl: public System::Windows::Forms::UserControl +{ +public: + HelpTestControl() + { + this->Size = System::Drawing::Size( 320, 100 ); + this->BackColor = Color::White; + } + +protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + Brush^ brush = gcnew SolidBrush( Color::Blue ); + e->Graphics->DrawString( "IHelpService Example Designer Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), brush, 5, 5 ); + e->Graphics->DrawString( "Right-click this component for", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 25 ); + e->Graphics->DrawString( "add/remove Help context keyword commands.", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 35 ); + e->Graphics->DrawString( "Press F1 while this component is", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 55 ); + e->Graphics->DrawString( "selected to raise Help topics for", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 65 ); + e->Graphics->DrawString( "the current keyword or keywords", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), brush, 5, 75 ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp new file mode 100644 index 00000000000..d89175f2476 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/INameCreationServiceExample/CPP/class1.cpp @@ -0,0 +1,102 @@ +// +#using + +using namespace System; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Globalization; + +namespace NameCreationServiceExample +{ + public ref class NameCreationService: public System::ComponentModel::Design::Serialization::INameCreationService + { + public: + NameCreationService(){} + + // + // Creates an identifier for a particular data type that does not conflict + // with the identifiers of any components in the specified collection. + virtual String^ CreateName( System::ComponentModel::IContainer^ container, System::Type^ dataType ) + { + // Create a basic type name string. + String^ baseName = dataType->Name; + int uniqueID = 1; + bool unique = false; + + // Continue to increment uniqueID numeral until a + // unique ID is located. + while ( !unique ) + { + unique = true; + + // Check each component in the container for a matching + // base type name and unique ID. + for ( int i = 0; i < container->Components->Count; i++ ) + { + // Check component name for match with unique ID string. + if ( container->Components[ i ]->Site->Name->StartsWith( String::Concat( baseName, uniqueID ) ) ) + { + // If a match is encountered, set flag to recycle + // collection, increment ID numeral, and restart. + unique = false; + uniqueID++; + break; + } + } + } + + return String::Concat( baseName, uniqueID ); + } + // + + // + // Returns whether the specified name contains + // all valid character types. + virtual bool IsValidName( String^ name ) + { + for ( int i = 0; i < name->Length; i++ ) + { + Char ch = name[ i ]; + UnicodeCategory uc = Char::GetUnicodeCategory( ch ); + switch ( uc ) + { + case UnicodeCategory::UppercaseLetter: + case UnicodeCategory::LowercaseLetter: + case UnicodeCategory::TitlecaseLetter: + case UnicodeCategory::DecimalDigitNumber: + break; + + default: + return false; + } + } + return true; + } + // + + // + // Throws an exception if the specified name does not contain + // all valid character types. + virtual void ValidateName( String^ name ) + { + for ( int i = 0; i < name->Length; i++ ) + { + Char ch = name[ i ]; + UnicodeCategory uc = Char::GetUnicodeCategory( ch ); + switch ( uc ) + { + case UnicodeCategory::UppercaseLetter: + case UnicodeCategory::LowercaseLetter: + case UnicodeCategory::TitlecaseLetter: + case UnicodeCategory::DecimalDigitNumber: + break; + + default: + throw gcnew Exception( String::Format( "The name '{0}' is not a valid identifier.", name ) ); + } + } + } + // + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp new file mode 100644 index 00000000000..3a73f1d0ba1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IReferenceServiceExample/CPP/ireferenceserviceexample.cpp @@ -0,0 +1,176 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Data; +using namespace System::Windows::Forms; + +// This control displays the name and type of the primary selection +// component in design mode, if there is one, +// and uses the IReferenceService interface to display the names of +// any components of the type of the primary selected component. +// This control uses the IComponentChangeService to monitor for +// selection changed events. +public ref class IReferenceServiceControl: public System::Windows::Forms::UserControl +{ +private: + + // Indicates the name of the type of the selected component, or "None selected.". + String^ selected_typename; + + // Indicates the name of the base type of the selected component, or "None selected." + String^ selected_basetypename; + + // Indicates the name of the selected component. + String^ selected_componentname; + + // Contains the names of components of the type of the selected + // component in design mode. + array^typeComponents; + + // Contains the names of components of the base type of the selected component in design mode. + array^basetypeComponents; + + // Reference to the IComponentChangeService for the current component. + ISelectionService^ selectionService; + +public: + IReferenceServiceControl() + { + // Initializes the control properties. + this->BackColor = Color::White; + this->SetStyle( ControlStyles::ResizeRedraw, true ); + this->Name = "IReferenceServiceControl"; + this->Size = System::Drawing::Size( 500, 250 ); + + // Initializes the data properties. + typeComponents = gcnew array(0); + basetypeComponents = gcnew array(0); + selected_typename = "None selected."; + selected_basetypename = "None selected."; + selected_componentname = "None selected."; + selectionService = nullptr; + } + + + property System::ComponentModel::ISite^ Site + { + // Registers and unregisters design-mode services when + // the component is sited and unsited. + virtual System::ComponentModel::ISite^ get() override + { + // Returns the site for the control. + return __super::Site; + } + + virtual void set( System::ComponentModel::ISite^ value ) override + { + // The site is set to null when a component is cut or + // removed from a design-mode site. + // If an event handler has already been linked with + // an ISelectionService, remove the handler. + if ( selectionService != nullptr ) + selectionService->SelectionChanged -= gcnew EventHandler( this, &IReferenceServiceControl::OnSelectionChanged ); + + // Sites the control. + __super::Site = value; + + // Obtains an ISelectionService interface to register + // the selection changed event handler with. + selectionService = dynamic_cast(this->GetService( ISelectionService::typeid )); + if ( selectionService != nullptr ) + { + selectionService->SelectionChanged += gcnew EventHandler( this, &IReferenceServiceControl::OnSelectionChanged ); + + // Updates the display for the current selection, if any. + DisplayComponentsOfSelectedComponentType(); + } + } + } + +private: + + // Updates the display according to the primary selected component, + // if any, and the names of design-mode components that the + // IReferenceService returns references for when queried for + // references to components of the primary selected component's + // type and base type. + void DisplayComponentsOfSelectedComponentType() + { + // If a component is selected... + if ( selectionService->PrimarySelection != nullptr ) + { + // Sets the selected type name and selected component name to the type and name of the primary selected component. + selected_typename = selectionService->PrimarySelection->GetType()->FullName; + selected_basetypename = selectionService->PrimarySelection->GetType()->BaseType->FullName; + selected_componentname = (dynamic_cast(selectionService->PrimarySelection))->Site->Name; + + // Obtain an IReferenceService and obtain references to + // each component in the design-mode project + // of the selected component's type and base type. + IReferenceService^ rs = dynamic_cast(this->GetService( IReferenceService::typeid )); + if ( rs != nullptr ) + { + // Get references to design-mode components of the + // primary selected component's type. + array^comps = (array^)rs->GetReferences( selectionService->PrimarySelection->GetType() ); + typeComponents = gcnew array(comps->Length); + for ( int i = 0; i < comps->Length; i++ ) + typeComponents[ i ] = (dynamic_cast(comps[ i ]))->Site->Name; + + // Get references to design-mode components with a base type + // of the primary selected component's base type. + comps = (array^)rs->GetReferences( selectionService->PrimarySelection->GetType()->BaseType ); + basetypeComponents = gcnew array(comps->Length); + for ( int i = 0; i < comps->Length; i++ ) + basetypeComponents[ i ] = (dynamic_cast(comps[ i ]))->Site->Name; + } + } + else + { + selected_typename = "None selected."; + selected_basetypename = "None selected."; + selected_componentname = "None selected."; + typeComponents = gcnew array(0); + basetypeComponents = gcnew array(0); + } + + this->Refresh(); + } + + void OnSelectionChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + DisplayComponentsOfSelectedComponentType(); + } + + +protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "IReferenceService Example Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Blue ), 5, 5 ); + e->Graphics->DrawString( "Primary Selected Component from IComponentChangeService:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 5, 20 ); + e->Graphics->DrawString( String::Format( "Name: {0}", selected_componentname ), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 10, 32 ); + e->Graphics->DrawString( String::Format( "Type: {0}", selected_typename ), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 10, 44 ); + e->Graphics->DrawString( String::Format( "Base Type: {0}", selected_basetypename ), gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 10, 56 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 5, 77, this->Width - 5, 77 ); + e->Graphics->DrawString( "Components of Type from IReferenceService:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 5, 85 ); + if ( !selected_typename->Equals( "None selected." ) ) + for ( int i = 0; i < typeComponents->Length; i++ ) + e->Graphics->DrawString( typeComponents[ i ], gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 20.f, 97.f + (i * 12) ); + + e->Graphics->DrawString( "Components of Base Type from IReferenceService:", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 5.f, 109.f + (typeComponents->Length * 12) ); + if ( !selected_typename->Equals( "None selected." ) ) + for ( int i = 0; i < basetypeComponents->Length; i++ ) + e->Graphics->DrawString( basetypeComponents[ i ], gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 20.f, 121.f + (typeComponents->Length * 12) + (i * 12) ); + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp new file mode 100644 index 00000000000..868a64bebfc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IResourceServiceExample/CPP/source.cpp @@ -0,0 +1,138 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Globalization; +using namespace System::Resources; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +ref class ResourceTestControlDesigner; + +// Associates the ResourceTestControlDesigner with the +// ResourceTestControl class. + +[Designer(ResourceTestControlDesigner::typeid)] +public ref class ResourceTestControl: public System::Windows::Forms::UserControl +{ +public: + + // Initializes a string array used to store strings that + // this control displays. + array^resource_strings; + ResourceTestControl() + { + array^temp = {"Initial Default String #1","Initial Default String #2"}; + resource_strings = temp; + this->BackColor = Color::White; + this->Size = System::Drawing::Size( 408, 160 ); + } + +protected: + + // Draws the strings contained in the string array. + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "IResourceService Example Designer Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,10 ), gcnew SolidBrush( Color::Blue ), 2, 2 ); + e->Graphics->DrawString( "String list: (use shortcut menu in design mode)", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Black ), 2, 20 ); + for ( int i = 0; i < resource_strings->Length; i++ ) + { + e->Graphics->DrawString( resource_strings[ i ], gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::SeaGreen ), 2.f, 38.f + (i * 18) ); + + } + } + +}; + +// This designer offers several menu commands for the +// shortcut menu for the associated control. +// These commands can be used to reset the control's string +// list, to generate a default resources file, or to load the string +// list for the control from the default resources file. +public ref class ResourceTestControlDesigner: public System::Windows::Forms::Design::ControlDesigner +{ +public: + ResourceTestControlDesigner(){} + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override + { + // Creates a collection of designer verb menu commands + // that link to event handlers in this designer. + array^temp0 = {gcnew DesignerVerb( "Load Strings from Default Resources File",gcnew EventHandler( this, &ResourceTestControlDesigner::LoadResources ) ),gcnew DesignerVerb( "Create Default Resources File",gcnew EventHandler( this, &ResourceTestControlDesigner::CreateResources ) ),gcnew DesignerVerb( "Clear ResourceTestControl String List",gcnew EventHandler( this, &ResourceTestControlDesigner::ClearStrings ) )}; + return gcnew DesignerVerbCollection( temp0 ); + } + } + +private: + + // Sets the string list for the control to the strings + // loaded from a resource file. + void LoadResources( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IResourceService^ rs = dynamic_cast(this->Component->Site->GetService( IResourceService::typeid )); + if ( rs == nullptr ) + throw gcnew System::Exception( "Could not obtain IResourceService." ); + + IResourceReader^ rr = rs->GetResourceReader( CultureInfo::CurrentUICulture ); + if ( rr == nullptr ) + throw gcnew System::Exception( "Resource file could not be obtained. You may need to create one first." ); + + IDictionaryEnumerator^ de = rr->GetEnumerator(); + if ( this->Control->GetType() == ResourceTestControl::typeid ) + { + ResourceTestControl^ rtc = dynamic_cast(this->Control); + String^ s1; + String^ s2; + String^ s3; + de->MoveNext(); + s1 = dynamic_cast(( *dynamic_cast(de->Current)).Value); + de->MoveNext(); + s2 = dynamic_cast(( *dynamic_cast(de->Current)).Value); + de->MoveNext(); + s3 = dynamic_cast(( *dynamic_cast(de->Current)).Value); + de->MoveNext(); + array^temp = {s1,s2,s3}; + rtc->resource_strings = temp; + this->Control->Refresh(); + } + } + + // Creates a default resource file for the current + // CultureInfo and adds 3 strings to it. + void CreateResources( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + IResourceService^ rs = dynamic_cast(this->Component->Site->GetService( IResourceService::typeid )); + if ( rs == nullptr ) + throw gcnew System::Exception( "Could not obtain IResourceService." ); + + IResourceWriter^ rw = rs->GetResourceWriter( CultureInfo::CurrentUICulture ); + rw->AddResource( "string1", "Persisted resource string #1" ); + rw->AddResource( "string2", "Persisted resource string #2" ); + rw->AddResource( "string3", "Persisted resource string #3" ); + rw->Generate(); + rw->Close(); + } + + // Clears the string list of the associated ResourceTestControl. + void ClearStrings( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->Control->GetType() == ResourceTestControl::typeid ) + { + ResourceTestControl^ rtc = dynamic_cast(this->Control); + array^temp = {"Test String #1","Test String #2"}; + rtc->resource_strings = temp; + this->Control->Refresh(); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp new file mode 100644 index 00000000000..974d765ffcb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IRootDesigner Sample/CPP/class1.cpp @@ -0,0 +1,124 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Diagnostics; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +namespace SampleRootDesigner +{ + ref class SampleRootDesigner; + + // This sample demonstrates how to provide the root designer view, or + // design mode background view, by overriding IRootDesigner.GetView(). + // The following attribute associates the SampleRootDesigner designer + // with the SampleComponent component. + + [Designer(SampleRootDesigner::typeid,IRootDesigner::typeid)] + public ref class RootDesignedComponent: public Component + { + public: + RootDesignedComponent(){} + + }; + + public ref class SampleRootDesigner: public ComponentDesigner, public IRootDesigner + { + private: + ref class RootDesignerView; + + // Member field of custom type RootDesignerView, a control that + // will be shown in the Forms designer view. This member is + // cached to reduce processing needed to recreate the + // view control on each call to GetView(). + RootDesignerView^ m_view; + + // This method returns an instance of the view for this root + // designer. The "view" is the user interface that is presented + // in a document window for the user to manipulate. + virtual Object^ GetView( ViewTechnology technology ) sealed = IRootDesigner::GetView + { + if ( technology != ViewTechnology::WindowsForms ) + { + throw gcnew ArgumentException( "Not a supported view technology","technology" ); + } + + if ( m_view == nullptr ) + { + + // Some type of displayable Form or control is required + // for a root designer that overrides GetView(). In this + // example, a Control of type RootDesignerView is used. + // Any class that inherits from Control will work. + m_view = gcnew RootDesignerView( this ); + } + + return m_view; + } + + + // IRootDesigner.SupportedTechnologies is a required override for an + // IRootDesigner. WindowsForms is the view technology used by this designer. +public: + property array^ SupportedTechnologies + { + virtual array^ get() + { + return gcnew array {ViewTechnology::Default}; + + } + } + + // RootDesignerView is a simple control that will be displayed + // in the designer window. + ref class RootDesignerView: public Control + { + private: + SampleRootDesigner^ m_designer; + + public: + RootDesignerView( SampleRootDesigner^ designer ) + { + m_designer = designer; + BackColor = Color::Blue; + Font = gcnew System::Drawing::Font( Font->FontFamily->Name,24.0f ); + } + + + protected: + virtual void OnPaint( PaintEventArgs^ pe ) override + { + Control::OnPaint( pe ); + + // Draws the name of the component in large letters. + pe->Graphics->DrawString( m_designer->Component->Site->Name, Font, Brushes::Yellow, ClientRectangle ); + } + + }; + + + }; + + + // This sample component inherits from RootDesignedComponent which + // uses the SampleRootDesigner. + public ref class RootViewSampleComponent: public RootDesignedComponent + { + public: + RootViewSampleComponent(){} + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp b/snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp new file mode 100644 index 00000000000..a3fd1a3beb4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ISelectionService/CPP/csiselectionserviceexample.cpp @@ -0,0 +1,139 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +/* This sample illustrates how to use the ISelectionService + interface to handle selection change events. The ComponentClass + control attaches event handlers when it is sited in a document + that displays a message when a component is selected or deselected. + + To run this sample, add the ComponentClass control to a Form and + then select and deselect the component to see the behavior of the + component change event handlers. */ + +public ref class ComponentClass: public UserControl +{ +private: + System::ComponentModel::Container^ components; + ListBox^ listBox1; + ISelectionService^ m_selectionService; + void InitializeComponent() + { + listBox1 = gcnew ListBox; + SuspendLayout(); + + // listBox1 + listBox1->Location = Point(24,16); + listBox1->Name = "listBox1"; + listBox1->Size = System::Drawing::Size( 560, 251 ); + listBox1->TabIndex = 0; + listBox1->SelectedIndexChanged += gcnew EventHandler( this, &ComponentClass::listBox1_SelectedIndexChanged ); + + // ComponentClass + array^myArray = {listBox1}; + Controls->AddRange( myArray ); + Name = "ComponentClass"; + Size = System::Drawing::Size( 608, 296 ); + Load += gcnew EventHandler( this, &ComponentClass::ComponentClass_Load ); + ResumeLayout( false ); + } + + // + /* This is the OnSelectionChanged handler method. This method calls + OnUserChange to display a message that indicates the name of the + handler that made the call and the type of the event argument. */ + void OnSelectionChanged( Object^ /*sender*/, EventArgs^ args ) + { + OnUserChange( "OnSelectionChanged", args->ToString() ); + } + // + + // + /* This is the OnSelectionChanging handler method. This method calls + OnUserChange to display a message that indicates the name of the + handler that made the call and the type of the event argument. */ + void OnSelectionChanging( Object^ /*sender*/, EventArgs^ args ) + { + OnUserChange( "OnSelectionChanging", args->ToString() ); + } + // + + // In this sample, all event handlers call this method + void OnUserChange( String^ text1, String^ text2 ) + { + listBox1->Items->Add( String::Concat( "Called ", text1, " using ", text2, "." ) ); + } + + void ComponentClass_Load( Object^, EventArgs^ ){} + + void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ){} + +public: + ComponentClass() + { + InitializeComponent(); + } + + property ISite^ Site + { + virtual ISite^ ComponentClass::get() override + { + return __super::Site; + } + + virtual void ComponentClass::set( ISite^ value ) override + { + // This value will always be null when not in design mode + m_selectionService = static_cast(GetService( ISelectionService::typeid )); + + /* The Selection Service works in design mode only, and only after the component is sited. + So add our services at this time */ + if ( m_selectionService != nullptr ) + { + // We are about to be re-sited. Clear our old selection change events. + m_selectionService->SelectionChanged -= gcnew EventHandler( this, &ComponentClass::OnSelectionChanged ); + m_selectionService->SelectionChanging -= gcnew EventHandler( this, &ComponentClass::OnSelectionChanging ); + } + + __super::Site = value; + + // This value will always be null when not in design mode + m_selectionService = static_cast(GetService( ISelectionService::typeid )); + + /* The Selection Service works in design mode only, and only after the component is sited. + So add our services at this time */ + if ( m_selectionService != nullptr ) + { + // + // Add SelectionChanged event handler to event + m_selectionService->SelectionChanged += gcnew EventHandler( this, &ComponentClass::OnSelectionChanged ); + // + + // + // Add SelectionChanging event handler to event + m_selectionService->SelectionChanging += gcnew EventHandler( this, &ComponentClass::OnSelectionChanging ); + // + } + } + } + +public: + + // Clean up any resources being used. + ~ComponentClass() + { + if ( components != nullptr ) + { + delete components; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp new file mode 100644 index 00000000000..264af491f39 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ISelectionServiceSample/CPP/selectioncomponent.cpp @@ -0,0 +1,141 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +/* This sample demonstrates using the ISelectionService +interface to receive notification of selection change events. +The SelectionComponent control attempts to retrieve an instance +of the ISelectionService when it is sited. If it can, it attaches +event handlers for events provided by the service that display +a message when a component is selected or deselected. + +To run this sample, add the SelectionComponent control to a Form and +then select or deselect components in design mode to see the behavior +of the component change event handlers. */ +namespace ISelectionServiceExample +{ + public ref class SelectionComponent: public System::Windows::Forms::UserControl + { + private: + System::Windows::Forms::TextBox^ tbox1; + ISelectionService^ selectionService; + + public: + SelectionComponent() + { + // Initialize control + this->SuspendLayout(); + this->Name = "SelectionComponent"; + this->Size = System::Drawing::Size( 608, 296 ); + this->tbox1 = gcnew System::Windows::Forms::TextBox; + this->tbox1->Location = System::Drawing::Point( 24, 16 ); + this->tbox1->Name = "listBox1"; + this->tbox1->Multiline = true; + this->tbox1->Size = System::Drawing::Size( 560, 251 ); + this->tbox1->TabIndex = 0; + this->Controls->Add( this->tbox1 ); + this->ResumeLayout(); + } + + property ISite^ Site + { + virtual ISite^ get() override + { + return __super::Site; + } + + virtual void set( ISite^ value ) override + { + // The ISelectionService is available in design mode + // only, and only after the component is sited. + if ( selectionService != nullptr ) + { + // Because the selection service has been + // previously obtained, the component may be in + // the process of being resited. + // Detatch the previous selection change event + // handlers in case the new selection + // service is a new service instance belonging to + // another design mode service host. + selectionService->SelectionChanged -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanged ); + selectionService->SelectionChanging -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanging ); + } + + // Establish the new site for the component. + __super::Site = value; + if ( __super::Site == nullptr ) + return; + + // The selection service is not available outside of + // design mode. A call requesting the service + // using GetService while not in design mode will + // return null. + selectionService = dynamic_cast(this->Site->GetService( ISelectionService::typeid )); + + // If an instance of the ISelectionService was obtained, + // attach event handlers for the selection + // changing and selection changed events. + if ( selectionService != nullptr ) + { + // Add an event handler for the SelectionChanging + // and SelectionChanged events. + selectionService->SelectionChanging += gcnew EventHandler( this, &SelectionComponent::OnSelectionChanging ); + selectionService->SelectionChanged += gcnew EventHandler( this, &SelectionComponent::OnSelectionChanged ); + } + } + } + + private: + void OnSelectionChanged( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + tbox1->AppendText( String::Format( "The selected component was changed. Selected components:\r\n {0}\r\n", GetSelectedComponents() ) ); + } + + void OnSelectionChanging( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + tbox1->AppendText( String::Format( "The selected component is changing. Selected components:\r\n {0}\r\n", GetSelectedComponents() ) ); + } + + String^ GetSelectedComponents() + { + String^ selectedString = String::Empty; + array^components = gcnew array((dynamic_cast(selectionService->GetSelectedComponents()))->Count); + (dynamic_cast(selectionService->GetSelectedComponents()))->CopyTo( components, 0 ); + for ( int i = 0; i < components->Length; i++ ) + { + if ( i != 0 ) + selectedString = selectedString + "&& "; + + if ( (dynamic_cast(selectionService->PrimarySelection)) == (dynamic_cast(components[ i ])) ) + selectedString = selectedString + "PrimarySelection:"; + + selectedString = selectedString + (dynamic_cast(components[ i ]))->Site->Name + " "; + + } + return selectedString; + } + + // Clean up any resources being used. + public: + ~SelectionComponent() + { + // Detach the event handlers for the selection service. + if ( selectionService != nullptr ) + { + selectionService->SelectionChanging -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanging ); + selectionService->SelectionChanged -= gcnew EventHandler( this, &SelectionComponent::OnSelectionChanged ); + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp b/snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp new file mode 100644 index 00000000000..abd659a43bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IServiceContainerExample/CPP/serviceform.cpp @@ -0,0 +1,580 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// This sample contains a Form class that is configured to demonstrate +// the behavior of a network of linked service containers. +// Notes regarding this IServiceContainer and IServiceProvider +// implementation: +// +// When implementing the IServiceContainer interface, you may want to +// implement support for a linked service container system +// which enables access to and sharing of services throughout a +// container tree or network. +// +// To effectively share a service, a GetService, AddService or +// RemoveService method must be able to locate a service +// that has been added to a shared service container tree or network. +// +// One simple approach to sharing services, suitable for container networks +// where each container has one parent and the tree has +// one parentless container, is to store services only at the top node +// (the root or grandparent) of a tree. +// +// To store services in the root node of a tree, two types of +// consistencies must be maintained in the implementation: +// +// > The GetService, AddService and RemoveService implementations +// must access the root through some mechanism. +// The ServiceContainerControl's implementations of these +// standard IServiceContainer methods call +// the same method of a parent container, if the container +// has been parented, to route methods to the root. +// +// > The services must be maintained at the root of the tree; +// therefore, any new child's services should be copied to the root. +ref class ServiceForm; + +// forward declaration +public enum class TextServiceState +{ + ServiceNotObtained, ServiceObtained, ServiceProvided, ServiceNotFound +}; + +// Example service type contains a text string, sufficient to +// demonstrate service sharing. +public ref class TextService +{ +public: + String^ text; + TextService() + { + this->text = String::Empty; + } + + TextService( String^ text ) + { + this->text = text; + } +}; + +// ServiceContainerControl provides an example user control implmentation +// of the IServiceContainer interface. This implementation of +// IServiceContainer supports a root-node linked service distribution, +// access. and removal architecture. +public ref class ServiceContainerControl: public System::Windows::Forms::UserControl, public IServiceContainer +{ +private: + + // List of service instances sorted by key of service type's full name. + SortedList^ localServices; + + // List that contains the Type for each service sorted by each + // service type's full name. + SortedList^ localServiceTypes; + + // The parent IServiceContainer, or null. + IServiceContainer^ parentServiceContainer; + +public: + + property IServiceContainer^ serviceParent + { + IServiceContainer^ get() + { + return parentServiceContainer; + } + + void set( IServiceContainer^ value ) + { + parentServiceContainer = value; + + // Move any services to parent. + for ( int i = 0; i < localServices->Count; i++ ) + parentServiceContainer->AddService( dynamic_cast(localServiceTypes->GetByIndex( i )), localServices->GetByIndex( i ) ); + localServices->Clear(); + localServiceTypes->Clear(); + } + } + +private: + + // The current state of the control reflecting whether it has + // obtained or provided a text service. + TextServiceState state_; + +public: + + property TextServiceState state + { + TextServiceState get() + { + return state_; + } + + void set( TextServiceState value ) + { + if ( (TextServiceState)value == TextServiceState::ServiceProvided ) + this->BackColor = Color::LightGreen; + else + if ( (TextServiceState)value == TextServiceState::ServiceNotObtained ) + this->BackColor = Color::White; + else + if ( (TextServiceState)value == TextServiceState::ServiceObtained ) + this->BackColor = Color::LightBlue; + else + if ( (TextServiceState)value == TextServiceState::ServiceNotFound ) + this->BackColor = Color::SeaShell; + + state_ = value; + } + } + +private: + + // Parent form reference for main program function access. + ServiceForm^ parent; + +public: + + // String for label displayed on the control to indicate + // the control's current service-related configuration state. + String^ label; + ServiceContainerControl( IServiceContainer^ ParentServiceContainer, System::Drawing::Size size, Point location, ServiceForm^ parent ) + { + this->state_ = TextServiceState::ServiceNotObtained; + localServices = gcnew SortedList; + localServiceTypes = gcnew SortedList; + this->BackColor = Color::Beige; + this->label = String::Empty; + this->Size = size; + this->Location = location; + this->parent = parent; + this->serviceParent = ParentServiceContainer; + + // If a parent is specified, set the parent property of this + // linkable IServiceContainer implementation. + if ( ParentServiceContainer != nullptr ) + serviceParent = ParentServiceContainer; + } + + // IServiceProvider.GetService implementation for a linked + // service container architecture. + virtual Object^ GetService( System::Type^ serviceType ) override + { + if ( parentServiceContainer != nullptr ) + return parentServiceContainer->GetService( serviceType ); + + Object^ serviceInstance = localServices[ serviceType->FullName ]; + if ( serviceInstance == nullptr ) + return nullptr; + else + if ( serviceInstance->GetType() == ServiceCreatorCallback::typeid ) + { + // If service instance is a ServiceCreatorCallback, invoke + // it to create the service. + return (dynamic_cast(serviceInstance)); + (this,serviceType); + } + + return serviceInstance; + } + + // IServiceContainer.AddService implementation for a linked + // service container architecture. + virtual void AddService( System::Type^ serviceType, System::ComponentModel::Design::ServiceCreatorCallback^ callback, bool promote ) + { + if ( promote && parentServiceContainer != nullptr ) + parentServiceContainer->AddService( serviceType, callback, true ); + else + { + localServiceTypes[ serviceType->FullName ] = serviceType; + localServices[ serviceType->FullName ] = callback; + } + } + + // IServiceContainer.AddService implementation for a linked + // service container architecture. + virtual void AddService( System::Type^ serviceType, System::ComponentModel::Design::ServiceCreatorCallback^ callback ) + { + AddService( serviceType, callback, true ); + } + + // IServiceContainer.AddService implementation for a linked + // service container architecture. + virtual void AddService( System::Type^ serviceType, Object^ serviceInstance, bool promote ) + { + if ( promote && parentServiceContainer != nullptr ) + parentServiceContainer->AddService( serviceType, serviceInstance, true ); + else + { + localServiceTypes[ serviceType->FullName ] = serviceType; + localServices[ serviceType->FullName ] = serviceInstance; + } + } + + // IServiceContainer.AddService (defaults to promote service addition). + virtual void AddService( System::Type^ serviceType, Object^ serviceInstance ) + { + AddService( serviceType, serviceInstance, true ); + } + + // IServiceContainer.RemoveService implementation for a linked + // service container architecture. + virtual void RemoveService( System::Type^ serviceType, bool promote ) + { + if ( localServices[ serviceType->FullName ] != nullptr ) + { + localServices->Remove( serviceType->FullName ); + localServiceTypes->Remove( serviceType->FullName ); + } + + if ( promote ) + { + if ( parentServiceContainer != nullptr ) + parentServiceContainer->RemoveService( serviceType ); + } + } + + // IServiceContainer.RemoveService (defaults to promote + // service removal) + virtual void RemoveService( System::Type^ serviceType ) + { + RemoveService( serviceType, true ); + } + +protected: + + // Paint method override draws the label string on the control. + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( label, gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); + } + + // Process mouse-down behavior for click. + virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) override; + +public: + + // Method accesses the TextService to test the visibility of the + // service from the control, and sets the UI state accordingly. + void ReflectServiceVisibility() + { + if ( state_ == TextServiceState::ServiceObtained ) + { + if ( GetService( TextService::typeid ) == nullptr ) + this->BackColor = Color::CadetBlue; + } + else + if ( state_ != TextServiceState::ServiceProvided ) + { + if ( GetService( TextService::typeid ) == nullptr ) + { + this->BackColor = Color::White; + return; + } + + // Service available. + if ( state_ == TextServiceState::ServiceNotFound ) + this->BackColor = Color::Khaki; + else + if ( state_ == TextServiceState::ServiceNotObtained && !label->Equals( "Service Removed" ) ) + this->BackColor = Color::Khaki; + } + } + +private: + + // ServiceCreatorCallback method creates a text service. + Object^ CreateTextService( IServiceContainer^ /*container*/, System::Type^ /*serviceType*/ ) + { + return gcnew TextService( "Test Callback" ); + } +}; + +// Example form provides UI for demonstrating service sharing behavior +// of a network of IServiceContainer/IServiceProvider controls. +public ref class ServiceForm: public System::Windows::Forms::Form +{ +private: + + // Root service container control for tree. + ServiceContainerControl^ root; + + // Button for clearing any provided services and resetting tree states. + System::Windows::Forms::Button^ reset_button; + + // Color list used to color code controls. + array^colorkeys; + + // Strings used to reflect text service. + array^keystrings; + +public: + ServiceForm() + { + InitializeComponent(); + colorkeys = gcnew array(6); + colorkeys[ 0 ] = Color::Beige; + colorkeys[ 1 ] = Color::SeaShell; + colorkeys[ 2 ] = Color::LightGreen; + colorkeys[ 3 ] = Color::LightBlue; + colorkeys[ 4 ] = Color::Khaki; + colorkeys[ 5 ] = Color::CadetBlue; + array^temp3 = {"No service use","Service not accessible","Service provided","Service obtained","Service accessible","No further access"}; + keystrings = temp3; + CreateServiceControlTree(); + } + +private: + void CreateServiceControlTree() + { + // Create root service control + ServiceContainerControl^ control1 = gcnew ServiceContainerControl( nullptr,System::Drawing::Size( 300, 40 ),Point(10,80),this ); + root = control1; + + // Create first tier - pass parent with service object control 1. + ServiceContainerControl^ control2 = gcnew ServiceContainerControl( control1,System::Drawing::Size( 200, 30 ),Point(50,160),this ); + ServiceContainerControl^ control3 = gcnew ServiceContainerControl( control1,System::Drawing::Size( 200, 30 ),Point(50,240),this ); + + // Create second tier A - pass parent with service object control 2. + ServiceContainerControl^ control4 = gcnew ServiceContainerControl( control2,System::Drawing::Size( 180, 20 ),Point(300,145),this ); + ServiceContainerControl^ control5 = gcnew ServiceContainerControl( control2,System::Drawing::Size( 180, 20 ),Point(300,185),this ); + + // Create second tier B - pass parent with service object control 3. + ServiceContainerControl^ control6 = gcnew ServiceContainerControl( control3,System::Drawing::Size( 180, 20 ),Point(300,225),this ); + ServiceContainerControl^ control7 = gcnew ServiceContainerControl( control3,System::Drawing::Size( 180, 20 ),Point(300,265),this ); + + // Add controls + array^temp0 = {control1,control2,control3,control4,control5,control6,control7}; + this->Controls->AddRange( temp0 ); + } + +internal: + void ResetServiceTree( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Remove the service from the service tree. + if ( root->GetService( TextService::typeid ) != nullptr ) + root->RemoveService( TextService::typeid, true ); + + // Set all controls to "not obtained" and clear their labels. + for ( int i = 0; i < Controls->Count; i++ ) + if ( !Controls[ i ]->Equals( reset_button ) ) + { + (dynamic_cast(Controls[ i ]))->state = TextServiceState::ServiceNotObtained; + (dynamic_cast(Controls[ i ]))->label = String::Empty; + (dynamic_cast(Controls[ i ]))->BackColor = Color::Beige; + } + } + +public: + void UpdateServiceCoverage() + { + // Have each control set state to reflect service availability. + for ( int i = 0; i < Controls->Count; i++ ) + if ( !Controls[ i ]->Equals( reset_button ) ) + (dynamic_cast(Controls[ i ]))->ReflectServiceVisibility(); + } + +private: + void InitializeComponent() + { + this->reset_button = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // reset_button + // + this->reset_button->Location = System::Drawing::Point( 392, 88 ); + this->reset_button->Name = "reset_button"; + this->reset_button->TabIndex = 0; + this->reset_button->TabStop = false; + this->reset_button->Text = "Reset"; + this->reset_button->Click += gcnew System::EventHandler( this, &ServiceForm::ResetServiceTree ); + + // + // ServiceForm + // + this->ClientSize = System::Drawing::Size( 512, 373 ); + array^temp1 = {this->reset_button}; + this->Controls->AddRange( temp1 ); + this->MinimumSize = System::Drawing::Size( 520, 400 ); + this->Name = "ServiceForm"; + this->Text = "Service Container Architecture Example"; + this->ResumeLayout( false ); + } + +protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "The following tree diagram represents a " + "hierarchy of linked service containers in controls.", gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 4, 4 ); + e->Graphics->DrawString( "This example demonstrates the propagation " + "behavior of services through a linked service object tree.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 26 ); + e->Graphics->DrawString( "Right-click a component to add or replace a " + "text service, or to remove it if the component provided it.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 38 ); + e->Graphics->DrawString( "Left-click a component to update text from " + "the text service if available.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 50 ); + + // Draw lines to represent tree branches. + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 125, 20, 258 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 175, 45, 175 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 258, 45, 258 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 175, 285, 175 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 258, 285, 258 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 285, 195 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 285, 278 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 290, 155 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 195, 290, 195 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 290, 238 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 278, 290, 278 ); + + // Draw color key. + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 305, 410, 60 ); + int y = 0; + for ( int i = 0; i < 3; i++ ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 310, 20, 20 ); + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 310, 20, 20 ); + e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 50.0f + (i * 140), 315.0f ); + y++; + e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 340, 20, 20 ); + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 340, 20, 20 ); + e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 50.0f + (i * 140), 345.0f ); + y++; + + } + } +}; + +// Example Form for entering a string. +private ref class StringInputDialog: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ ok_button; + System::Windows::Forms::Button^ cancel_button; + +public: + System::Windows::Forms::TextBox^ inputTextBox; + StringInputDialog( String^ text ) + { + InitializeComponent(); + inputTextBox->Text = text; + } + +private: + void InitializeComponent() + { + this->ok_button = gcnew System::Windows::Forms::Button; + this->cancel_button = gcnew System::Windows::Forms::Button; + this->inputTextBox = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->ok_button->Location = System::Drawing::Point( 180, 43 ); + this->ok_button->Name = "ok_button"; + this->ok_button->TabIndex = 1; + this->ok_button->Text = "OK"; + this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; + this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->cancel_button->Location = System::Drawing::Point( 260, 43 ); + this->cancel_button->Name = "cancel_button"; + this->cancel_button->TabIndex = 2; + this->cancel_button->Text = "Cancel"; + this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; + this->inputTextBox->Location = System::Drawing::Point( 6, 9 ); + this->inputTextBox->Name = "inputTextBox"; + this->inputTextBox->Size = System::Drawing::Size( 327, 20 ); + this->inputTextBox->TabIndex = 0; + this->inputTextBox->Text = ""; + this->inputTextBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->ClientSize = System::Drawing::Size( 342, 73 ); + array^temp4 = {this->inputTextBox,this->cancel_button,this->ok_button}; + this->Controls->AddRange( temp4 ); + this->MinimumSize = System::Drawing::Size( 350, 100 ); + this->Name = "StringInputDialog"; + this->Text = "Text Service Provide String Dialog"; + this->ResumeLayout( false ); + } +}; + +void ServiceContainerControl::OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) +{ + // This example control responds to mouse clicks as follows: + // + // Left click - control attempts to obtain a text service + // and sets its label text to the text provided by the service + // Right click - if the control has already provided a text + // service, this control does nothing. Otherwise, the control + // shows a dialog box to specify text to provide as a new text + // service, after clearing the tree's services. + if ( e->Button == ::MouseButtons::Left ) + { + if ( state_ != TextServiceState::ServiceProvided ) + { + // Attempt to update text from service, and set + // color state accordingly. + TextService^ ts = dynamic_cast(GetService( TextService::typeid )); + if ( ts != nullptr ) + { + this->label = ts->text; + state = TextServiceState::ServiceObtained; + } + else + { + this->label = "Service Not Found"; + state = TextServiceState::ServiceNotFound; + } + } + } + + if ( e->Button == ::MouseButtons::Right ) + { + if ( state_ == TextServiceState::ServiceProvided ) + { + // Remove the service if the container provided it. + if ( GetService( TextService::typeid ) != nullptr ) + { + RemoveService( TextService::typeid, true ); + state = TextServiceState::ServiceNotObtained; + this->label = "Service Removed"; + } + } + else + { + // Obtain string and provide text service. + StringInputDialog^ form = gcnew StringInputDialog( "Test String" ); + form->StartPosition = FormStartPosition::CenterParent; + if ( form->ShowDialog() == DialogResult::OK ) + { + if ( GetService( TextService::typeid ) != nullptr ) + RemoveService( TextService::typeid, true ); + parent->ResetServiceTree( this, gcnew EventArgs ); + AddService( TextService::typeid, gcnew TextService( form->inputTextBox->Text ), true ); + + // The following commented method uses a service creator callback. + // AddService(typeof(TextService), + // new ServiceCreatorCallback(this.CreateTextService)); + state = TextServiceState::ServiceProvided; + this->label = String::Format( "Provided Text: {0}", form->inputTextBox->Text ); + } + } + } + + parent->UpdateServiceCoverage(); +} + +[STAThread] +int main() +{ + Application::Run( gcnew ServiceForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp new file mode 100644 index 00000000000..fd65944a108 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IToolboxServiceExample1/CPP/itoolboxservicecontrol.cpp @@ -0,0 +1,239 @@ + + +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Data; +using namespace System::Diagnostics; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +namespace IToolboxServiceExample +{ + + // This designer passes window messages to the controls at design time. + public ref class WindowMessageDesigner: public System::Windows::Forms::Design::ControlDesigner + { + public: + WindowMessageDesigner(){} + + protected: + + // Window procedure passes events to control. + + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + virtual void WndProc( System::Windows::Forms::Message% m ) override + { + if ( m.HWnd == this->Control->Handle ) + ControlDesigner::WndProc( m ); + else + ControlDesigner::DefWndProc( m ); + } + }; + + // Provides an example control that functions in design mode to + // demonstrate use of the IToolboxService to list and select toolbox + // categories and items, and to add components or controls + // to the parent form using code. + + [DesignerAttribute(IToolboxServiceExample::WindowMessageDesigner::typeid,IDesigner::typeid)] + public ref class IToolboxServiceControl: public System::Windows::Forms::UserControl + { + private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::ListBox^ listBox2; + IToolboxService^ toolboxService; + ToolboxItemCollection^ tools; + int controlSpacingMultiplier; + + public: + IToolboxServiceControl() + { + InitializeComponent(); + listBox2->DoubleClick += gcnew EventHandler( this, &IToolboxServiceControl::CreateComponent ); + controlSpacingMultiplier = 0; + } + + property System::ComponentModel::ISite^ Site + { + // Obtain or reset IToolboxService reference on each siting of control. + virtual System::ComponentModel::ISite^ get() override + { + return __super::Site; + } + + virtual void set( System::ComponentModel::ISite^ value ) override + { + __super::Site = value; + + // If the component was sited, attempt to obtain + // an IToolboxService instance. + if ( __super::Site != nullptr ) + { + toolboxService = dynamic_cast(this->GetService( IToolboxService::typeid )); + + // If an IToolboxService was located, update the + // category list. + if ( toolboxService != nullptr ) + UpdateLists(); + } + else + toolboxService = nullptr; + } + } + + private: + + // Updates the list of categories and the list of items in the + // selected category. + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + void UpdateLists() + { + if ( toolboxService != nullptr ) + { + this->listBox1->SelectedIndexChanged -= gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedCategory ); + this->listBox2->SelectedIndexChanged -= gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedItem ); + listBox1->Items->Clear(); + for ( int i = 0; i < toolboxService->CategoryNames->Count; i++ ) + { + listBox1->Items->Add( toolboxService->CategoryNames[ i ] ); + if ( toolboxService->CategoryNames[ i ] == toolboxService->SelectedCategory ) + { + listBox1->SelectedIndex = i; + tools = toolboxService->GetToolboxItems( toolboxService->SelectedCategory ); + listBox2->Items->Clear(); + for ( int j = 0; j < tools->Count; j++ ) + listBox2->Items->Add( tools[ j ]->DisplayName ); + } + } + this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedCategory ); + this->listBox2->SelectedIndexChanged += gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedItem ); + } + } + + + // Sets the selected category when a category is clicked in the + // category list. + void UpdateSelectedCategory( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( toolboxService != nullptr ) + { + toolboxService->SelectedCategory = dynamic_cast(listBox1->SelectedItem); + UpdateLists(); + } + } + + // Sets the selected item when an item is clicked in the item list. + void UpdateSelectedItem( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( toolboxService != nullptr ) + { + if ( listBox1->SelectedIndex != -1 ) + { + if ( dynamic_cast(listBox1->SelectedItem) == toolboxService->SelectedCategory ) + toolboxService->SetSelectedToolboxItem( tools[ listBox2->SelectedIndex ] ); + else + UpdateLists(); + } + } + } + + // Creates a control from a double-clicked toolbox item and adds + // it to the parent form. + void CreateComponent( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Obtains an IDesignerHost service from design environment. + IDesignerHost^ host = dynamic_cast(this->GetService( IDesignerHost::typeid )); + + // Get the project components container (Windows Forms control + // containment depends on controls collections). + IContainer^ container = host->Container; + + // Identifies the parent Form. + System::Windows::Forms::Form^ parentForm = this->FindForm(); + + // Retrieves the parent Form's designer host. + IDesignerHost^ parentHost = dynamic_cast(parentForm->Site->GetService( IDesignerHost::typeid )); + + // Create the components. + array^comps = nullptr; + try + { + comps = toolboxService->GetSelectedToolboxItem()->CreateComponents( parentHost ); + } + catch ( Exception^ ex ) + { + // Catch and show any exceptions to prevent disabling + // the control's UI. + MessageBox::Show( ex->ToString(), "Exception message" ); + } + + if ( comps == nullptr ) + return; + + // Add any created controls to the parent form's controls + // collection. Note: components are added from the + // ToolboxItem::CreateComponents(IDesignerHost*) method. + for ( int i = 0; i < comps->Length; i++ ) + { + if ( parentForm != nullptr && comps[ i ]->GetType()->IsSubclassOf( System::Windows::Forms::Control::typeid ) ) + { + (dynamic_cast(comps[ i ]))->Location = Point(20 * controlSpacingMultiplier,20 * controlSpacingMultiplier); + if ( controlSpacingMultiplier > 10 ) + controlSpacingMultiplier = 0; + else + controlSpacingMultiplier++; + parentForm->Controls->Add( dynamic_cast(comps[ i ]) ); + } + } + } + + protected: + + // Displays labels. + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "IToolboxService Control", gcnew System::Drawing::Font( "Arial",14 ), gcnew SolidBrush( Color::Black ), 6, 4 ); + e->Graphics->DrawString( "Category List", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 8, 26 ); + e->Graphics->DrawString( "Items in Category", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 208, 26 ); + e->Graphics->DrawString( "(Double-click item to add to parent form)", gcnew System::Drawing::Font( "Arial",7 ), gcnew SolidBrush( Color::Black ), 232, 12 ); + } + + private: + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->listBox2 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + this->listBox1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left); + this->listBox1->Location = System::Drawing::Point( 8, 41 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 192, 368 ); + this->listBox1->TabIndex = 0; + this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &IToolboxServiceControl::UpdateSelectedCategory ); + this->listBox2->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->listBox2->Location = System::Drawing::Point( 208, 41 ); + this->listBox2->Name = "listBox2"; + this->listBox2->Size = System::Drawing::Size( 228, 368 ); + this->listBox2->TabIndex = 3; + this->BackColor = System::Drawing::Color::Beige; + array^temp0 = {this->listBox2,this->listBox1}; + this->Controls->AddRange( temp0 ); + this->Location = System::Drawing::Point( 500, 400 ); + this->Name = "IToolboxServiceControl*"; + this->Size = System::Drawing::Size( 442, 422 ); + this->ResumeLayout( false ); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp new file mode 100644 index 00000000000..eb3015a6390 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IToolboxUserExample/CPP/samplecontrol.cpp @@ -0,0 +1,178 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Diagnostics; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// This example contains an IRootDesigner that implements the IToolboxUser interface. +// This example demonstrates how to enable the GetToolSupported method of an IToolboxUser +// designer in order to disable specific toolbox items, and how to respond to the +// invocation of a ToolboxItem in the ToolPicked method of an IToolboxUser implementation. +public ref class SampleRootDesigner; + +// The following attribute associates the SampleRootDesigner with this example component. + +[DesignerAttribute(__typeof(SampleRootDesigner),__typeof(IRootDesigner))] +public ref class RootDesignedComponent: public Control{}; + + +// This example component class demonstrates the associated IRootDesigner which +// implements the IToolboxUser interface. When designer view is invoked, Visual +// Studio .NET attempts to display a design mode view for the class at the top +// of a code file. This can sometimes fail when the class is one of multiple types +// in a code file, and has a DesignerAttribute associating it with an IRootDesigner. +// Placing a derived class at the top of the code file solves this problem. A +// derived class is not typically needed for this reason, except that placing the +// RootDesignedComponent class in another file is not a simple solution for a code +// example that is packaged in one segment of code. +public ref class RootViewSampleComponent: public RootDesignedComponent{}; + + +// This example IRootDesigner implements the IToolboxUser interface and provides a +// Windows Forms view technology view for its associated component using an internal +// Control type. +// The following ToolboxItemFilterAttribute enables the GetToolSupported method of this +// IToolboxUser designer to be queried to check for whether to enable or disable all +// ToolboxItems which create any components whose type name begins with "System.Windows.Forms". + +[ToolboxItemFilterAttribute(S"System.Windows.Forms",ToolboxItemFilterType::Custom)] +public ref class SampleRootDesigner: public ParentControlDesigner, public IRootDesigner, public IToolboxUser +{ +public private: + ref class RootDesignerView; + +private: + + // This field is a custom Control type named RootDesignerView. This field references + // a control that is shown in the design mode document window. + RootDesignerView^ view; + + // This string array contains type names of components that should not be added to + // the component managed by this designer from the Toolbox. Any ToolboxItems whose + // type name matches a type name in this array will be marked disabled according to + // the signal returned by the IToolboxUser.GetToolSupported method of this designer. + array^blockedTypeNames; + +public: + SampleRootDesigner() + { + array^tempTypeNames = {"System.Windows.Forms.ListBox","System.Windows.Forms.GroupBox"}; + blockedTypeNames = tempTypeNames; + } + + +private: + + property array^ SupportedTechnologies + { + + // IRootDesigner.SupportedTechnologies is a required override for an IRootDesigner. + // This designer provides a display using the Windows Forms view technology. + array^ IRootDesigner::get() + { + ViewTechnology temp0[] = {ViewTechnology::WindowsForms}; + return temp0; + } + + } + + // This method returns an object that provides the view for this root designer. + Object^ IRootDesigner::GetView( ViewTechnology technology ) + { + + // If the design environment requests a view technology other than Windows + // Forms, this method throws an Argument Exception. + if ( technology != ViewTechnology::WindowsForms ) + throw gcnew ArgumentException( "An unsupported view technology was requested","Unsupported view technology." ); + + + // Creates the view object if it has not yet been initialized. + if ( view == nullptr ) + view = gcnew RootDesignerView( this ); + + return view; + } + + + // + // This method can signal whether to enable or disable the specified + // ToolboxItem when the component associated with this designer is selected. + bool IToolboxUser::GetToolSupported( ToolboxItem^ tool ) + { + + // Search the blocked type names array for the type name of the tool + // for which support for is being tested. Return false to indicate the + // tool should be disabled when the associated component is selected. + for ( int i = 0; i < blockedTypeNames->Length; i++ ) + if ( tool->TypeName == blockedTypeNames[ i ] ) + return false; + + + // Return true to indicate support for the tool, if the type name of the + // tool is not located in the blockedTypeNames string array. + return true; + } + + + // + // + // This method can perform behavior when the specified tool has been invoked. + // Invocation of a ToolboxItem typically creates a component or components, + // and adds any created components to the associated component. + void IToolboxUser::ToolPicked( ToolboxItem^ /*tool*/ ){} + + +public private: + + // + // This control provides a Windows Forms view technology view object that + // provides a display for the SampleRootDesigner. + + [DesignerAttribute(__typeof(ParentControlDesigner),__typeof(IDesigner))] + ref class RootDesignerView: public Control + { + private: + + // This field stores a reference to a designer. + IDesigner^ m_designer; + + public: + RootDesignerView( IDesigner^ designer ) + { + + // Perform basic control initialization. + m_designer = designer; + BackColor = Color::Blue; + Font = gcnew System::Drawing::Font( Font->FontFamily->Name,24.0f ); + } + + + protected: + + // This method is called to draw the view for the SampleRootDesigner. + void OnPaint( PaintEventArgs^ pe ) + { + Control::OnPaint( pe ); + + // Draw the name of the component in large letters. + pe->Graphics->DrawString( m_designer->Component->Site->Name, Font, Brushes::Yellow, ClientRectangle ); + } + + }; + + +}; + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp new file mode 100644 index 00000000000..30b9890afe7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ITypeDescriptorFilterService/CPP/source.cpp @@ -0,0 +1,372 @@ +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Drawing; +using namespace System::Reflection; +using namespace System::Timers; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// Designer for a Button control which cycles the background color. +public ref class ColorCycleButtonDesigner: public System::Windows::Forms::Design::ControlDesigner +{ +private: + System::Windows::Forms::Timer^ timer1; + Color initial_bcolor; + Color initial_fcolor; + int r; + int g; + int b; + bool ru; + bool gu; + bool bu; + bool continue_; + +public: + ColorCycleButtonDesigner() + { + timer1 = gcnew System::Windows::Forms::Timer; + timer1->Interval = 50; + timer1->Tick += gcnew EventHandler( this, &ColorCycleButtonDesigner::Elapsed ); + ru = true; + gu = false; + bu = true; + continue_ = false; + timer1->Start(); + } + +private: + void Elapsed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + this->Control->BackColor = Color::FromArgb( r % 255, g % 255, b % 255 ); + this->Control->Refresh(); + + // Updates color. + if ( ru ) + r += 10; + else + if ( r > 10 ) + r -= 10; + + if ( gu ) + g += 10; + else + if ( g > 10 ) + g -= 10; + + if ( bu ) + b += 10; + else + if ( b > 10 ) + b -= 10; + + // Randomly switches direction of color component values. + Random^ rand = gcnew Random; + for ( int i = 0; i < 4; i++ ) + switch ( rand->Next( 0, 2 ) ) + { + case 0: + if ( ru ) + ru = false; + else + ru = true; + + break; + + case 1: + if ( gu ) + gu = false; + else + gu = true; + + break; + + case 2: + if ( bu ) + bu = false; + else + bu = true; + + break; + } + this->Control->ForeColor = Color::FromArgb( (this->Control->BackColor.R + 128) % 255, (this->Control->BackColor.G + 128) % 255, (this->Control->BackColor.B + 128) % 255 ); + } + +protected: + virtual void OnMouseEnter() override + { + if ( !timer1->Enabled ) + { + initial_bcolor = this->Control->BackColor; + initial_fcolor = this->Control->ForeColor; + r = initial_bcolor.R; + g = initial_bcolor.G; + b = initial_bcolor.B; + timer1->Start(); + } + } + + virtual void OnMouseLeave() override + { + if ( !continue_ ) + { + continue_ = true; + timer1->Stop(); + } + else + continue_ = false; + + this->Control->BackColor = initial_bcolor; + this->Control->ForeColor = initial_fcolor; + } + +public: + ~ColorCycleButtonDesigner() + { + timer1->Stop(); + this->Control->BackColor = initial_bcolor; + this->Control->ForeColor = initial_fcolor; + } +}; + +// Provides a TypeDescriptorFilterService to add the +// ColorCycleButtonDesigner using a DesignerAttribute. +public ref class ButtonDesignerFilterService: public System::ComponentModel::Design::ITypeDescriptorFilterService +{ +public: + ITypeDescriptorFilterService^ oldService; + ButtonDesignerFilterService(){} + + ButtonDesignerFilterService( ITypeDescriptorFilterService^ oldService_ ) + { + // Stores any previous ITypeDescriptorFilterService to implement service chaining. + this->oldService = oldService_; + } + + virtual bool FilterAttributes( System::ComponentModel::IComponent^ component, System::Collections::IDictionary^ attributes ) + { + if ( oldService != nullptr ) + oldService->FilterAttributes( component, attributes ); + + // Creates a designer attribute to compare its TypeID with the TypeID of existing attributes of the component. + DesignerAttribute^ da = gcnew DesignerAttribute( ColorCycleButtonDesigner::typeid ); + // Adds the designer attribute if the attribute collection does not contain a DesignerAttribute of the same TypeID. + if ( dynamic_cast(component) && attributes->Contains( da->TypeId ) ) + attributes[ da->TypeId ] = da; + + return true; + } + + virtual bool FilterEvents( System::ComponentModel::IComponent^ component, System::Collections::IDictionary^ events ) + { + if ( oldService != nullptr ) + oldService->FilterEvents( component, events ); + + return true; + } + + virtual bool FilterProperties( System::ComponentModel::IComponent^ component, System::Collections::IDictionary^ properties ) + { + if ( oldService != nullptr ) + oldService->FilterProperties( component, properties ); + + return true; + } +}; + + +// System.Windows.Forms.Button associated with the ColorCycleButtonDesigner. + +[Designer(ColorCycleButtonDesigner::typeid)] +public ref class ColorCycleButton: public System::Windows::Forms::Button +{ +public: + ColorCycleButton(){} + +}; + + +// Provides a designer that can add a ColorCycleButtonDesigner to each +// button in a design time project using the ButtonDesignerFilterService +// ITypeDescriptorFilterService. +public ref class ButtonDesignerFilterComponentDesigner: public System::ComponentModel::Design::ComponentDesigner +{ +private: + + // Indicates whether the service has been loaded. + bool serviceloaded; + + // Stores any old ITypeDescriptorFilterService to restore later. + ITypeDescriptorFilterService^ oldservice; + +public: + ButtonDesignerFilterComponentDesigner() + { + serviceloaded = false; + } + + // Loads the new ITypeDescriptorFilterService and reloads the + // designers for each button. + virtual void Initialize( System::ComponentModel::IComponent^ component ) override + { + ComponentDesigner::Initialize( component ); + + // Loads the custom service if it has not been loaded already + LoadService(); + + // Build list of buttons from Container.Components. + ArrayList^ buttons = gcnew ArrayList; + IEnumerator^ myEnum = this->Component->Site->Container->Components->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + IComponent^ c = safe_cast(myEnum->Current); + if ( c->GetType() == System::Windows::Forms::Button::typeid ) + buttons->Add( dynamic_cast(c) ); + } + + if ( buttons->Count > 0 ) + { + // Tests each Button for an existing + // ColorCycleButtonDesigner; + // if it has no designer of type + // ColorCycleButtonDesigner, adds a designer. + IEnumerator^ myEnum1 = buttons->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Button^ b = safe_cast(myEnum1->Current); + bool loaddesigner = true; + + // Gets the attributes for each button. + AttributeCollection^ ac = TypeDescriptor::GetAttributes( b ); + for ( int i = 0; i < ac->Count; i++ ) + { + // If designer attribute is not for a + // ColorCycleButtonDesigner, adds a new + // ColorCycleButtonDesigner. + if ( dynamic_cast(ac[ i ]) ) + { + DesignerAttribute^ da = dynamic_cast(ac[ i ]); + if ( da->DesignerTypeName->Substring( da->DesignerTypeName->LastIndexOf( "." ) + 1 )->Equals( "ColorCycleButtonDesigner" ) ) + loaddesigner = false; + } + } + if ( loaddesigner ) + { + // Saves the button location so that it + // can be repositioned. + Point p = b->Location; + + // Gets an IMenuCommandService to cut and + // paste control in order to register with + // selection and movement interface after + // designer is changed without reloading. + IMenuCommandService^ imcs = dynamic_cast(this->GetService( IMenuCommandService::typeid )); + if ( imcs == nullptr ) + throw gcnew Exception( "Could not obtain IMenuCommandService interface." ); + + // Gets an ISelectionService to select the + // button so that it can be cut and pasted. + ISelectionService^ iss = dynamic_cast(this->GetService( ISelectionService::typeid )); + if ( iss == nullptr ) + throw gcnew Exception( "Could not obtain ISelectionService interface." ); + array^temp0 = {b}; + iss->SetSelectedComponents( dynamic_cast(temp0), SelectionTypes::Normal ); + + // Invoke Cut and Paste. + imcs->GlobalInvoke( StandardCommands::Cut ); + imcs->GlobalInvoke( StandardCommands::Paste ); + + // Regains reference to button from + // selection service. + System::Windows::Forms::Button^ b2 = dynamic_cast(iss->PrimarySelection); + iss->SetSelectedComponents( nullptr ); + + // Refreshes TypeDescriptor properties of + // button to load new attributes from + // ButtonDesignerFilterService. + TypeDescriptor::Refresh( b2 ); + b2->Location = p; + b2->Focus(); + } + } + } + } + + +private: + + // Loads a ButtonDesignerFilterService ITypeDescriptorFilterService + // to add ColorCycleButtonDesigner designers to each button. + void LoadService() + { + // If no custom ITypeDescriptorFilterService is loaded, + // loads it now. + if ( !serviceloaded ) + { + // Stores the current ITypeDescriptorFilterService + // to restore later. + ITypeDescriptorFilterService^ tdfs = dynamic_cast(this->Component->Site->GetService( ITypeDescriptorFilterService::typeid )); + if ( tdfs != nullptr ) + oldservice = tdfs; + + // Retrieves an IDesignerHost interface to use to + // remove and add services. + IDesignerHost^ dh = dynamic_cast(this->Component->Site->GetService( IDesignerHost::typeid )); + if ( dh == nullptr ) + throw gcnew Exception( "Could not obtain IDesignerHost interface." ); + + // Removes standard ITypeDescriptorFilterService. + dh->RemoveService( ITypeDescriptorFilterService::typeid ); + + // Adds new custom ITypeDescriptorFilterService. + dh->AddService( ITypeDescriptorFilterService::typeid, gcnew ButtonDesignerFilterService ); + serviceloaded = true; + } + } + + // Removes the custom service and reloads any stored, + // preexisting service. + void RemoveService() + { + IDesignerHost^ dh = dynamic_cast(this->GetService( IDesignerHost::typeid )); + if ( dh == nullptr ) + throw gcnew Exception( "Could not obtain IDesignerHost interface." ); + + dh->RemoveService( ITypeDescriptorFilterService::typeid ); + if ( oldservice != nullptr ) + dh->AddService( ITypeDescriptorFilterService::typeid, oldservice ); + + serviceloaded = false; + } + +public: + ~ButtonDesignerFilterComponentDesigner() + { + if ( serviceloaded ) + RemoveService(); + } +}; + +// Component to host the ButtonDesignerFilterComponentDesigner that loads the +// ButtonDesignerFilterService ITypeDescriptorFilterService. + +[Designer(ButtonDesignerFilterComponentDesigner::typeid)] +public ref class ButtonDesignerFilterComponent: public System::ComponentModel::Component +{ +public: + ButtonDesignerFilterComponent( System::ComponentModel::IContainer^ container ) + { + container->Add( this ); + } + + ButtonDesignerFilterComponent(){} +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp new file mode 100644 index 00000000000..9725e54d302 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ITypeResolutionServiceExample/CPP/ityperesolutionservicecontrol.cpp @@ -0,0 +1,373 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Reflection; +using namespace System::Text; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +namespace ITypeResolutionServiceExample +{ + // Since this example provides a control-based user interface + // in design mode, this designer passes window messages to the + // controls at design time. + public ref class WindowMessageDesigner: public System::Windows::Forms::Design::ControlDesigner + { + public: + WindowMessageDesigner(){} + + protected: + + // Window procedure override passes events to the control. + + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + virtual void WndProc( System::Windows::Forms::Message% m ) override + { + if ( m.HWnd == this->Control->Handle ) + ControlDesigner::WndProc( m ); + else + this->DefWndProc( m ); + } + + public: + virtual void DoDefaultAction() override {} + + }; + + // This control provides an example design-time user interface to + // the ITypeResolutionService. + + [DesignerAttribute(WindowMessageDesigner::typeid,IDesigner::typeid)] + public ref class ITypeResolutionServiceControl: public System::Windows::Forms::UserControl + { + private: + + // Reference to a type resolution service interface, or null + // if not obtained. + ITypeResolutionService^ rs; + + // Textbox for input of assembly and type names. + System::Windows::Forms::TextBox^ entryBox; + + // Textbox for output of assembly, type, and status information. + System::Windows::Forms::TextBox^ infoBox; + + // Panel to contain the radio buttons used to select the + // method to InvokeMethod. + System::Windows::Forms::Panel^ panel1; + System::Windows::Forms::RadioButton^ radioButton1; + System::Windows::Forms::RadioButton^ radioButton2; + System::Windows::Forms::RadioButton^ radioButton3; + System::Windows::Forms::RadioButton^ radioButton4; + + // Label to display textbox entry information. + System::Windows::Forms::Label ^ label1; + + // Button to InvokeMethod command. + System::Windows::Forms::Button^ button1; + + public: + ITypeResolutionServiceControl() + { + InitializeComponent(); + rs = nullptr; + + // Attaches event handlers for control clicked events. + radioButton1->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::GetAssembly ); + radioButton2->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::GetPathToAssembly ); + radioButton3->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::GetInstanceOfType ); + radioButton4->CheckedChanged += gcnew EventHandler( this, &ITypeResolutionServiceControl::ReferenceAssembly ); + button1->Click += gcnew EventHandler( this, &ITypeResolutionServiceControl::InvokeMethod ); + entryBox->KeyUp += gcnew KeyEventHandler( this, &ITypeResolutionServiceControl::InvokeOnEnterKeyHandler ); + } + + protected: + + // Displays example control name and status information. + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( "ITypeResolutionService Interface Control", gcnew System::Drawing::Font( FontFamily::GenericMonospace,9 ), gcnew SolidBrush( Color::Blue ), 5, 5 ); + if ( this->DesignMode ) + e->Graphics->DrawString( "Currently in Design Mode", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 350, 2 ); + else + e->Graphics->DrawString( "Requires Design Mode", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 350, 2 ); + + if ( rs != nullptr ) + e->Graphics->DrawString( "Type Resolution Service Obtained", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::DarkGreen ), 350, 12 ); + else + e->Graphics->DrawString( "Type Resolution Service Not Obtained", gcnew System::Drawing::Font( FontFamily::GenericMonospace,8 ), gcnew SolidBrush( Color::Red ), 350, 12 ); + } + + private: + + // InvokeMethods the currently selected method, if any, when + // the InvokeMethod button is pressed. + void InvokeMethod( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // If the GetAssembly or GetPathofAssembly radio button + // is selected. + if ( this->radioButton1->Checked || this->radioButton2->Checked || this->radioButton4->Checked ) + { + if ( this->entryBox->Text->Length == 0 ) + { + // If there is no assembly name specified, display status message. + this->infoBox->Text = "You must enter the name of the assembly to retrieve."; + } + else + if ( rs != nullptr ) + { + // Create a System.Reflection.AssemblyName + // for the entered text. + AssemblyName^ name = gcnew AssemblyName; + name->Name = this->entryBox->Text->Trim(); + + // If the GetAssembly radio button is checked... + if ( this->radioButton1->Checked ) + { + // Use the ITypeResolutionService to attempt to + // resolve an assembly reference. + Assembly^ a = rs->GetAssembly( name, false ); + + // If an assembly matching the specified name was not + // located in the GAC or local project references, + // display a message. + if ( a == nullptr ) + this->infoBox->Text = String::Format( "The {0} assembly could not be located.", this->entryBox->Text ); + else + { + // An assembly matching the specified name was located. + // Builds a list of types. + array^types = a->GetTypes(); + StringBuilder^ sb = gcnew StringBuilder; + for ( int i = 0; i < types->Length; i++ ) + sb->Append( String::Concat( types[ i ]->FullName, "\r\n" ) ); + String^ path = rs->GetPathOfAssembly( name ); + + // Displays assembly information and a list of types contained in the assembly. + this->infoBox->Text = String::Format( "Assembly located:\r\n\r\n{0}\r\n at: {1}\r\n\r\nAssembly types:\r\n\r\n{2}", a->FullName, path, sb ); + } + } + else + if ( this->radioButton2->Checked ) + { + String^ path = rs->GetPathOfAssembly( name ); + if ( path != nullptr ) + this->infoBox->Text = String::Format( "Assembly located at:\r\n{0}", path ); + else + this->infoBox->Text = "Assembly was not located."; + } + else + if ( this->radioButton4->Checked ) + { + Assembly^ a = nullptr; + try + { + // Add a reference to the assembly to the + // current project. + rs->ReferenceAssembly( name ); + + // Use the ITypeResolutionService to attempt + // to resolve an assembly reference. + a = rs->GetAssembly( name, false ); + } + catch ( Exception^ ) + { + // Catch this exception so that the exception + // does not interrupt control behavior. + } + + // If an assembly matching the specified name was not + // located in the GAC or local project references, + // display a message. + if ( a == nullptr ) + this->infoBox->Text = String::Format( "The {0} assembly could not be located.", this->entryBox->Text ); + else + this->infoBox->Text = String::Format( "A reference to the {0} assembly has been added to the project's referenced assemblies.", a->FullName ); + } + } + } + else + if ( this->radioButton3->Checked ) + { + if ( this->entryBox->Text->Length == 0 ) + { + // If there is no type name specified, display a + // status message. + this->infoBox->Text = "You must enter the name of the type to retrieve."; + } + else + if ( rs != nullptr ) + { + Type^ type = nullptr; + try + { + type = rs->GetType( this->entryBox->Text, false, true ); + } + catch ( Exception^ ) + { + // Consume exceptions raised during GetType call + } + + if ( type != nullptr ) + { + // Display type information. + this->infoBox->Text = String::Format( "Type: {0} located.\r\n Namespace: {1}\r\n{2}", type->FullName, type->Namespace, type->AssemblyQualifiedName ); + } + else + this->infoBox->Text = "Type not located."; + } + } + } + + void GetAssembly( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->radioButton1->Checked ) + this->label1->Text = "Enter the assembly name:"; + } + + void GetPathToAssembly( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->radioButton2->Checked ) + this->label1->Text = "Enter the assembly name:"; + } + + void GetInstanceOfType( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->radioButton3->Checked ) + this->label1->Text = "Enter the type name:"; + } + + void ReferenceAssembly( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->radioButton4->Checked ) + this->label1->Text = "Enter the assembly name:"; + } + + void InvokeOnEnterKeyHandler( Object^ sender, KeyEventArgs^ e ) + { + if ( e->KeyCode == Keys::Enter ) + this->InvokeMethod( sender, gcnew EventArgs ); + } + + public: + + property System::ComponentModel::ISite^ Site + { + virtual System::ComponentModel::ISite^ get() override + { + return __super::Site; + } + + virtual void set( System::ComponentModel::ISite^ value ) override + { + __super::Site = value; + + // Attempts to obtain ITypeResolutionService interface. + rs = dynamic_cast(this->GetService( ITypeResolutionService::typeid )); + } + + } + + private: + void InitializeComponent() + { + this->entryBox = gcnew System::Windows::Forms::TextBox; + this->infoBox = gcnew System::Windows::Forms::TextBox; + this->panel1 = gcnew System::Windows::Forms::Panel; + this->radioButton1 = gcnew System::Windows::Forms::RadioButton; + this->radioButton2 = gcnew System::Windows::Forms::RadioButton; + this->radioButton3 = gcnew System::Windows::Forms::RadioButton; + this->radioButton4 = gcnew System::Windows::Forms::RadioButton; + this->label1 = gcnew System::Windows::Forms::Label; + this->button1 = gcnew System::Windows::Forms::Button; + this->panel1->SuspendLayout(); + this->SuspendLayout(); + + // entryBox + this->entryBox->Location = System::Drawing::Point( 176, 80 ); + this->entryBox->Name = "entryBox"; + this->entryBox->Size = System::Drawing::Size( 320, 20 ); + this->entryBox->TabIndex = 0; + this->entryBox->Text = ""; + + // infoBox + this->infoBox->Anchor = static_cast(((System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom) | System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); + this->infoBox->Location = System::Drawing::Point( 16, 111 ); + this->infoBox->Multiline = true; + this->infoBox->Name = "infoBox"; + this->infoBox->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->infoBox->Size = System::Drawing::Size( 592, 305 ); + this->infoBox->TabIndex = 1; + this->infoBox->Text = ""; + + // panel1 + array^temp0 = {this->radioButton4,this->radioButton3,this->radioButton2,this->radioButton1}; + this->panel1->Controls->AddRange( temp0 ); + this->panel1->Location = System::Drawing::Point( 16, 32 ); + this->panel1->Name = "panel1"; + this->panel1->Size = System::Drawing::Size( 480, 40 ); + this->panel1->TabIndex = 2; + + // radioButton1 + this->radioButton1->Location = System::Drawing::Point( 8, 8 ); + this->radioButton1->Name = "radioButton1"; + this->radioButton1->Size = System::Drawing::Size( 96, 24 ); + this->radioButton1->TabIndex = 0; + this->radioButton1->Text = "GetAssembly"; + + // radioButton2 + this->radioButton2->Location = System::Drawing::Point( 112, 8 ); + this->radioButton2->Name = "radioButton2"; + this->radioButton2->Size = System::Drawing::Size( 128, 24 ); + this->radioButton2->TabIndex = 1; + this->radioButton2->Text = "GetPathToAssembly"; + + // radioButton3 + this->radioButton3->Location = System::Drawing::Point( 248, 8 ); + this->radioButton3->Name = "radioButton3"; + this->radioButton3->Size = System::Drawing::Size( 80, 24 ); + this->radioButton3->TabIndex = 2; + this->radioButton3->Text = "GetType"; + + // radioButton4 + this->radioButton4->Location = System::Drawing::Point( 344, 8 ); + this->radioButton4->Name = "radioButton4"; + this->radioButton4->Size = System::Drawing::Size( 128, 24 ); + this->radioButton4->TabIndex = 3; + this->radioButton4->Text = "ReferenceAssembly"; + + // label1 + this->label1->Location = System::Drawing::Point( 18, 83 ); + this->label1->Name = "label1"; + this->label1->Size = System::Drawing::Size( 150, 16 ); + this->label1->TabIndex = 3; + + // button1 + this->button1->Location = System::Drawing::Point( 519, 41 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 4; + this->button1->Text = "Invoke"; + + // ITypeResolutionServiceControl + this->BackColor = System::Drawing::Color::White; + array^temp1 = {this->button1,this->label1,this->panel1,this->infoBox,this->entryBox}; + this->Controls->AddRange( temp1 ); + this->Name = "ITypeResolutionServiceControl"; + this->Size = System::Drawing::Size( 624, 432 ); + this->panel1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp new file mode 100644 index 00000000000..a6a5d8fd47e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IUIServiceExample/CPP/class1.cpp @@ -0,0 +1,124 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// Provides an example Form class used by the +// IUIServiceTestDesigner::showDialog method. +ref class ExampleForm: public System::Windows::Forms::Form +{ +public: + ExampleForm() + { + this->Text = "Example Form"; + System::Windows::Forms::Button^ okButton = gcnew System::Windows::Forms::Button; + okButton->Location = Point(this->Width - 70,this->Height - 70); + okButton->Size = System::Drawing::Size( 50, 20 ); + okButton->Anchor = static_cast(AnchorStyles::Right | AnchorStyles::Bottom); + okButton->DialogResult = ::DialogResult::OK; + okButton->Text = "OK"; + this->Controls->Add( okButton ); + } +}; + +// This designer provides a set of designer verb shortcut menu commands +// that call methods of the IUIService. +public ref class IUIServiceTestDesigner: public System::Windows::Forms::Design::ControlDesigner +{ +public: + IUIServiceTestDesigner(){} + + property System::ComponentModel::Design::DesignerVerbCollection^ Verbs + { + // Provides a set of designer verb menu commands that call IUIService methods. + virtual System::ComponentModel::Design::DesignerVerbCollection^ get() override + { + array^temp0 = {gcnew DesignerVerb( "Show a test message box using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showTestMessage ) ),gcnew DesignerVerb( "Show a test error message using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showErrorMessage ) ),gcnew DesignerVerb( "Show an example Form using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showDialog ) ),gcnew DesignerVerb( "Show the Task List tool window using the IUIService",gcnew EventHandler( this, &IUIServiceTestDesigner::showToolWindow ) )}; + return gcnew DesignerVerbCollection( temp0 ); + } + } + +private: + + // Displays a message box with message text, caption text + // and buttons of a particular MessageBoxButtons style. + void showTestMessage( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // + IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); + if ( UIservice != nullptr ) + UIservice->ShowMessage( "Test message", "Test caption", System::Windows::Forms::MessageBoxButtons::AbortRetryIgnore ); + // + } + + + // Displays an error message box that displays the message + // contained within a specified exception. + void showErrorMessage( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // + IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); + if ( UIservice != nullptr ) + UIservice->ShowError( gcnew Exception( "This is a message in a test exception, displayed by the IUIService",gcnew ArgumentException( "Test inner exception" ) ) ); + // + } + + // Displays an example Windows Form using the + // IUIService::ShowDialog method. + void showDialog( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // + IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); + if ( UIservice != nullptr ) + UIservice->ShowDialog( gcnew ExampleForm ); + // + } + + // Displays a standard tool window window using the + // IUIService::ShowToolWindow method. + void showToolWindow( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // + IUIService^ UIservice = dynamic_cast(this->GetService( System::Windows::Forms::Design::IUIService::typeid )); + if ( UIservice != nullptr ) + UIservice->ShowToolWindow( StandardToolWindows::TaskList ); + // + } +}; + +// This control is associated with the IUIServiceTestDesigner, +// and can be sited in design mode to use the sample. + +[DesignerAttribute(IUIServiceTestDesigner::typeid,IDesigner::typeid)] +ref class IUIServiceExampleControl: public UserControl +{ +public: + IUIServiceExampleControl() + { + this->BackColor = Color::Beige; + this->Width = 255; + this->Height = 60; + } + +protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + if ( this->DesignMode ) + { + e->Graphics->DrawString( "Right-click this control to display a list of the", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 5, 6 ); + e->Graphics->DrawString( "designer verb menu commands provided", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 5, 20 ); + e->Graphics->DrawString( "by the IUIServiceTestDesigner.", gcnew System::Drawing::Font( "Arial",9 ), Brushes::Black, 5, 34 ); + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp b/snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp new file mode 100644 index 00000000000..36bddada314 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IndexOf/CPP/indexof.cpp @@ -0,0 +1,56 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +ref class TestForm: public Form +{ +public: + TestForm() + { + InitializeMyMenu(); + } + + // +public: + void InitializeMyMenu() + { + // Create the MainMenu Object^. + MainMenu^ myMainMenu = gcnew MainMenu; + + // Create the MenuItem objects. + MenuItem^ fileMenu = gcnew MenuItem( "&File" ); + MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); + MenuItem^ newFile = gcnew MenuItem( "&New" ); + MenuItem^ openFile = gcnew MenuItem( "&Open" ); + MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); + + // Add the MenuItem objects to myMainMenu. + myMainMenu->MenuItems->Add( fileMenu ); + myMainMenu->MenuItems->Add( editMenu ); + + // Add three submenus to the File menu. + fileMenu->MenuItems->Add( newFile ); + fileMenu->MenuItems->Add( openFile ); + fileMenu->MenuItems->Add( exitProgram ); + + // Assign myMainMenu to the form. + Menu = myMainMenu; + + // Retrieve the index of the Exit menu item. + String^ indexValue = fileMenu->MenuItems->IndexOf( exitProgram ).ToString(); + + // Display the result in a message box. + MessageBox::Show( "The index of the Exit menu item = " + + indexValue, "MenuItem Information" ); + } + // +}; + +int main() +{ + Application::Run( gcnew TestForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp new file mode 100644 index 00000000000..6fcd7a9ad62 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/InputLanguageChanged/CPP/form1.cpp @@ -0,0 +1,49 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + RichTextBox^ rtb; + +public: + Form1() + { + rtb = gcnew RichTextBox; + this->Controls->Add( rtb ); + rtb->Dock = DockStyle::Fill; + this->InputLanguageChanged += gcnew InputLanguageChangedEventHandler( this, &Form1::languageChange ); + } + + +private: + void languageChange( Object^ /*sender*/, InputLanguageChangedEventArgs^ e ) + { + + // If the input language is Japanese. + // set the initial IMEMode to Katakana. + if ( e->InputLanguage->Culture->TwoLetterISOLanguageName->Equals( "ja" ) ) + { + rtb->ImeMode = System::Windows::Forms::ImeMode::Katakana; + } + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp new file mode 100644 index 00000000000..af165ac8484 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/InstanceDescriptorSample/CPP/instancedescriptor.cpp @@ -0,0 +1,154 @@ + + +// +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Drawing; +using namespace System::Globalization; +using namespace System::Collections; +using namespace System::Reflection; + +/* This sample shows how to support code generation for a custom type of object + using a type converter and InstanceDescriptor objects. + + To use this code, copy it to a file and add the file to a project. Then add + a component to the project and declare a Triangle field and a public property + with accessors for the Triangle field on the component. + + The Triangle property will be persisted using code generation. + */ +ref class TriangleConverter; + +[TypeConverter(TriangleConverter::typeid)] +public ref class Triangle +{ +private: + + // Triangle members + Point P1; + Point P2; + Point P3; + +public: + + property Point Point1 + { + Point get() + { + return P1; + } + + void set( Point value ) + { + P1 = value; + } + } + + property Point Point2 + { + Point get() + { + return P2; + } + + void set( Point value ) + { + P2 = value; + } + } + + property Point Point3 + { + Point get() + { + return P3; + } + + void set( Point value ) + { + P3 = value; + } + + } + Triangle( Point point1, Point point2, Point point3 ) + { + P1 = point1; + P2 = point2; + P3 = point3; + } + + + /* A TypeConverter for the Triangle object. Note that you can make it internal, + private, or any scope you want and the designers will still be able to use + it through the TypeDescriptor object. This type converter provides the + capability to convert to an InstanceDescriptor. This object can be used by + the .NET Framework to generate source code that creates an instance of a + Triangle object. */ + [System::Security::Permissions::PermissionSet(System::Security:: + Permissions::SecurityAction::Demand, Name = "FullTrust")] + ref class TriangleConverter: public TypeConverter + { + public: + + /* This method overrides CanConvertTo from TypeConverter. This is called when someone + wants to convert an instance of Triangle to another type. Here, + only conversion to an InstanceDescriptor is supported. */ + virtual bool CanConvertTo( ITypeDescriptorContext^ context, Type^ destinationType ) override + { + if ( destinationType == InstanceDescriptor::typeid ) + { + return true; + } + + + // Always call the base to see if it can perform the conversion. + return TypeConverter::CanConvertTo( context, destinationType ); + } + + /* This code performs the actual conversion from a Triangle to an InstanceDescriptor. */ + virtual Object^ ConvertTo( ITypeDescriptorContext^ context, CultureInfo^ culture, Object^ value, Type^ destinationType ) override + { + if ( destinationType == InstanceDescriptor::typeid ) + { + array^type1 = {Point::typeid,Point::typeid,Point::typeid}; + ConstructorInfo^ ci = Triangle::typeid->GetConstructor( type1 ); + Triangle^ t = safe_cast(value); + array^obj1 = {t->Point1,t->Point2,t->Point3}; + return gcnew InstanceDescriptor( ci,safe_cast(obj1) ); + } + + // Always call base, even if you can't convert. + return TypeConverter::ConvertTo( context, culture, value, destinationType ); + } + }; +}; + +public ref class TestComponent: public System::ComponentModel::Component +{ +private: + Triangle^ myTriangle; + +public: + TestComponent() + { + myTriangle = gcnew Triangle( Point(5,5),Point(10,10),Point(1,8) ); + } + + property Triangle^ MyTriangle + { + Triangle^ get() + { + return myTriangle; + } + + void set( Triangle^ value ) + { + myTriangle = value; + } + } +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp new file mode 100644 index 00000000000..c1896c30445 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/IsParent/CPP/form1.cpp @@ -0,0 +1,112 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace menuIsParent +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + CreateMyMainMenu(); + + // + } + + protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // + public: + void CreateMyMainMenu() + { + // Create two MenuItem objects and assign to array. + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + menuItem1->Text = "&File"; + menuItem2->Text = "&Edit"; + + // Create a MainMenu and assign MenuItem objects. + array^menuMenu1Items = {menuItem1,menuItem2}; + MainMenu^ mainMenu1 = gcnew MainMenu( menuMenu1Items ); + + // Determine whether mainMenu1 contains menu items. + if ( mainMenu1->IsParent ) + { + // Set the RightToLeft property for mainMenu1. + mainMenu1->RightToLeft = ::RightToLeft::Yes; + + // Bind the MainMenu to Form1. + Menu = mainMenu1; + } + } + // + + private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew menuIsParent::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp new file mode 100644 index 00000000000..2679aeb2da5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ItemSize/CPP/form1.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + + // Sizes the tabs of tabControl1. + this->tabControl1->ItemSize = System::Drawing::Size( 90, 50 ); + + // Makes the tab width definable. + this->tabControl1->SizeMode = TabSizeMode::Fixed; + array^tabControl1Controls = {tabPage1,tabPage2}; + this->tabControl1->Controls->AddRange( tabControl1Controls ); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + this->Size = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp new file mode 100644 index 00000000000..9f84b390986 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/KeyEventArgs.Modifiers/CPP/form1.cpp @@ -0,0 +1,120 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 48, 48 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 176, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + this->textBox1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::textBox1_KeyDown ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->textBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // This example demonstrates how to use the KeyDown event with the Help class to display + // pop-up style help to the user of the application. The example filters for all variations + // of pressing the F1 key with a modifier key by using the KeyEventArgs properties passed + // to the event handling method. + // When the user presses any variation of F1 that includes any keyboard modifier, the Help + // class displays a pop-up window, similar to a ToolTip, near the control. If the user presses + // ALT + F2, a different Help pop-up is displayed with additional information. This example assumes + // that a tTextBox control, named textBox1, has been added to the form and its KeyDown + // event has been contected to this event handling method. +private: + void textBox1_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) + { + // Determine whether the key entered is the F1 key. If it is, display Help. + if ( e->KeyCode == Keys::F1 && (e->Alt || e->Control || e->Shift) ) + { + + // Display a pop-up Help topic to assist the user. + Help::ShowPopup( textBox1, "Enter your name.", Point(textBox1->Bottom,textBox1->Right) ); + } + else + if ( e->KeyCode == Keys::F2 && e->Modifiers == Keys::Alt ) + { + // Display a pop-up Help topic to provide additional assistance to the user. + Help::ShowPopup( textBox1, "Enter your first name followed by your last name. Middle name is optional.", + Point(textBox1->Top,this->textBox1->Left) ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp new file mode 100644 index 00000000000..bc1b7790715 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/KeyPressEventArgs/CPP/form1.cpp @@ -0,0 +1,36 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public: + Form1() + { + // Create a TextBox control. + TextBox^ tb = gcnew TextBox; + this->Controls->Add( tb ); + tb->KeyPress += gcnew KeyPressEventHandler( this, &Form1::keypressed ); + } + +private: + void keypressed( Object^ /*o*/, KeyPressEventArgs^ e ) + { + // The keypressed method uses the KeyChar property to check + // whether the ENTER key is pressed. + // If the ENTER key is pressed, the Handled property is set to true, + // to indicate the event is handled. + if ( e->KeyChar == (char)13 ) + e->Handled = true; + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp new file mode 100644 index 00000000000..39283147fc1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Label_Image/CPP/form1.cpp @@ -0,0 +1,99 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + // +public: + void CreateMyLabel() + { + // Create a new label and create a bitmap. + Label^ label1 = gcnew Label; + Image^ image1 = Image::FromFile( "c:\\MyImage.bmp" ); + + // Set the size of the label to accommodate the bitmap size. + label1->Size = System::Drawing::Size( image1->Width, image1->Height ); + + // Initialize the label control's Image property. + label1->Image = image1; + + // ...Code to add the control to the form... + } + // + +protected: + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CreateMyLabel(); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp new file mode 100644 index 00000000000..52d2d85434b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/LayoutEventArgs/CPP/form1.cpp @@ -0,0 +1,149 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Button^ layoutButton; + System::ComponentModel::Container^ components; + +public: + Form1() + { + InitializeComponent(); + } + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->layoutButton = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + // layoutButton + // + this->layoutButton->Anchor = System::Windows::Forms::AnchorStyles::Bottom; + this->layoutButton->Location = System::Drawing::Point( 72, 88 ); + this->layoutButton->Name = "layoutButton"; + this->layoutButton->Size = System::Drawing::Size( 150, 23 ); + this->layoutButton->TabIndex = 0; + this->layoutButton->Text = "Hello"; + + // + // textBox1 + // + this->textBox1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->textBox1->Location = System::Drawing::Point( 24, 40 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 248, 20 ); + this->textBox1->TabIndex = 1; + this->textBox1->Text = "Hello"; + this->textBox1->TextChanged += gcnew System::EventHandler( this, &Form1::textBox1_TextChanged ); + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 24, 16 ); + this->label1->Name = "label1"; + this->label1->TabIndex = 2; + this->label1->Text = "Button's Text:"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 129 ); + array^temp0 = {this->label1,this->textBox1,this->layoutButton}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Layout Sample"; + this->Layout += gcnew System::Windows::Forms::LayoutEventHandler( this, &Form1::Form1_Layout ); + this->ResumeLayout( false ); + } + + // This method ensures that the form's width is the preferred size of 300 pixels + // or the size of the button plus 50 pixels, whichever amount is less. + void Form1_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ e ) + { + // This event is raised once at startup with the AffectedControl + // and AffectedProperty properties on the LayoutEventArgs as null. + // The event provides size preferences for that case. + if ( (e->AffectedControl != nullptr) && (e->AffectedProperty != nullptr) ) + { + // Ensure that the affected property is the Bounds property + // of the form. + if ( e->AffectedProperty->ToString()->Equals( "Bounds" ) ) + { + // If layoutButton's width plus a padding of 50 pixels is greater than the preferred + // size of 300 pixels, increase the form's width. + if ( (this->layoutButton->Width + 50) > 300 ) + { + this->Width = this->layoutButton->Width + 50; + } + // If not, keep the form's width at 300 pixels. + else + { + this->Width = 300; + } + + // Center layoutButton on the form. + this->layoutButton->Left = (this->ClientSize.Width - this->layoutButton->Width) / 2; + } + } + } + + // This method sets the Text property of layoutButton to the Text property + // of textBox1. If the new text plus a padding of 20 pixels is larger than + // the preferred size of 150 pixels, increase layoutButton's Width property. + void textBox1_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Set the Text property of layoutButton. + this->layoutButton->Text = this->textBox1->Text; + + // Get the width of the text using the proper font. + int textWidth = (int)this->CreateGraphics()->MeasureString( layoutButton->Text, layoutButton->Font ).Width; + + // If the width of the text plus a padding of 20 pixels is greater than the preferred size of + // 150 pixels, increase layoutButton's width. + if ( (textWidth + 20) > 150 ) + { + // Setting the size property on any control raises + // the Layout event for its container. + this->layoutButton->Width = textWidth + 20; + } + // If not, keep layoutButton's width at 150 pixels. + else + { + this->layoutButton->Width = 150; + } + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp b/snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp new file mode 100644 index 00000000000..8108dbce60d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/LicenseException/CPP/licenseex.cpp @@ -0,0 +1,99 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// + +[LicenseProvider(LicFileLicenseProvider::typeid)] +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + try + { + License^ licTest = nullptr; + licTest = LicenseManager::Validate( Form1::typeid, this ); + } + catch ( LicenseException^ licE ) + { + Console::WriteLine( licE->Message ); + Console::WriteLine( licE->LicensedType ); + Console::WriteLine( licE->StackTrace ); + Console::WriteLine( licE->Source ); + } + // + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp b/snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp new file mode 100644 index 00000000000..ceca99e1d12 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/LinkLabel Overview/CPP/linklabelex.cpp @@ -0,0 +1,111 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + // + // Create a new LinkLabel control. +private: + LinkLabel^ linkLabel1; + +public: + void InitializeMyLinkLabel() + { + // Set the control to autosize based on the text content. + linkLabel1->AutoSize = true; + + // Position and size the control on the form. + linkLabel1->Location = System::Drawing::Point( 8, 16 ); + linkLabel1->Size = System::Drawing::Size( 135, 13 ); + + // Set the text to display in the label. + linkLabel1->Text = "Click here to get more info."; + + // Create a new link using the Add method of the LinkCollection class. + linkLabel1->Links->Add( 6, 4, "www.microsoft.com" ); + + // Create an event handler for the LinkClicked event. + linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler( this, &Form1::linkLabel1_LinkClicked ); + + // Add the control to the form. + this->Controls->Add( linkLabel1 ); + } + +private: + void linkLabel1_LinkClicked( Object^ /*sender*/, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e ) + { + // Determine which link was clicked within the LinkLabel. + linkLabel1->Links[ linkLabel1->Links->IndexOf( e->Link ) ]->Visited = true; + + // Display the appropriate link based on the value of the LinkData property of the Link object. + System::Diagnostics::Process::Start( e->Link->LinkData->ToString() ); + } + // + +public: + Form1() + { + linkLabel1 = gcnew LinkLabel; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + InitializeMyLinkLabel(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp new file mode 100644 index 00000000000..89e23da1c9e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString/CPP/form1.cpp @@ -0,0 +1,162 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + components = nullptr; + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + // #region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 208, 216 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 152, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + + // + // listBox1 + // + array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Alpha2","Alpha3","Bravo2","Charlie2","Delta3","Echo2","Delta2","Foxtrot2"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 192, 32 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 208, 147 ); + this->listBox1->TabIndex = 1; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 368, 216 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 2; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 496, 350 ); + array^temp1 = {this->button1,this->listBox1,this->textBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // #endregion + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + FindAllOfMyString( textBox1->Text ); + } + + // +private: + void FindAllOfMyString( String^ searchString ) + { + // Set the SelectionMode property of the ListBox to select multiple items. + listBox1->SelectionMode = SelectionMode::MultiExtended; + + // Set our intial index variable to -1. + int x = -1; + + // If the search string is empty exit. + if ( searchString->Length != 0 ) + { + // Loop through and find each item that matches the search string. + do + { + // Retrieve the item based on the previous index found. Starts with -1 which searches start. + x = listBox1->FindString( searchString, x ); + + // If no item is found that matches exit. + if ( x != -1 ) + { + // Since the FindString loops infinitely, determine if we found first item again and exit. + if ( listBox1->SelectedIndices->Count > 0 ) + { + if ( x == listBox1->SelectedIndices[ 0 ] ) + return; + } + + // Select the item in the ListBox once it is found. + listBox1->SetSelected( x, true ); + } + } + while ( x != -1 ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp new file mode 100644 index 00000000000..b950ad0543d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindString2/CPP/form1.cpp @@ -0,0 +1,131 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + components = nullptr; + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 24, 32 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 224, 108 ); + this->listBox1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 264, 32 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 104, 24 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 504, 422 ); + array^temp1 = {this->button1,this->listBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + FindMyString( "Charlie" ); + } + + // +private: + void FindMyString( String^ searchString ) + { + // Ensure we have a proper string to search for. + if ( searchString != String::Empty ) + { + // Find the item in the list and store the index to the item. + int index = listBox1->FindString( searchString ); + + // Determine if a valid index is returned. Select the item if it is valid. + if ( index != -1 ) + listBox1->SetSelected( index, true ); + else + MessageBox::Show( "The search string did not match any items in the ListBox" ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp new file mode 100644 index 00000000000..106c014ad88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact/CPP/form1.cpp @@ -0,0 +1,129 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 24, 32 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 224, 108 ); + this->listBox1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 264, 32 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 104, 24 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 504, 422 ); + array^temp1 = {this->button1,this->listBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + FindMySpecificString( "Charlie" ); + } + + // +private: + void FindMySpecificString( String^ searchString ) + { + // Ensure we have a proper string to search for. + if ( searchString != String::Empty ) + { + // Find the item in the list and store the index to the item. + int index = listBox1->FindStringExact( searchString ); + + // Determine if a valid index is returned. Select the item if it is valid. + if ( index != ListBox::NoMatches ) + listBox1->SetSelected( index, true ); + else + MessageBox::Show( "The search string did not find any items in the ListBox that exactly match the specified search string" ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp new file mode 100644 index 00000000000..d239ed6bc8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.FindStringExact2/CPP/form1.cpp @@ -0,0 +1,158 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 208, 216 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 152, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = ""; + + // + // listBox1 + // + array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Alpha2","Alpha3","Bravo2","Charlie2","Delta3","Echo2","Delta2","Foxtrot2"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 192, 32 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 208, 147 ); + this->listBox1->TabIndex = 1; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 368, 216 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 2; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 496, 350 ); + array^temp1 = {this->button1,this->listBox1,this->textBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + FindAllOfMyExactStrings( textBox1->Text ); + } + + // +private: + void FindAllOfMyExactStrings( String^ searchString ) + { + // Set the SelectionMode property of the ListBox to select multiple items. + listBox1->SelectionMode = SelectionMode::MultiExtended; + + // Set our intial index variable to -1. + int x = -1; + + // If the search string is empty exit. + if ( searchString->Length != 0 ) + { + // Loop through and find each item that matches the search string. + do + { + // Retrieve the item based on the previous index found. Starts with -1 which searches start. + x = listBox1->FindStringExact( searchString, x ); + + // If no item is found that matches exit. + if ( x != -1 ) + { + // Since the FindStringExact loops infinitely, determine if we found first item again and exit. + if ( listBox1->SelectedIndices->Count > 0 ) + { + if ( x == listBox1->SelectedIndices[ 0 ] ) + return; + } + + // Select the item in the ListBox once it is found. + listBox1->SetSelected( x, true ); + } + } + while ( x != -1 ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp new file mode 100644 index 00000000000..72b7c6f587b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.GetSelected/CPP/form1.cpp @@ -0,0 +1,158 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtro","Golf","Hotel","Igloo","Java","Koala","Lima","Mama"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 56, 40 ); + this->listBox1->Name = "listBox1"; + this->listBox1->SelectionMode = System::Windows::Forms::SelectionMode::None; + this->listBox1->Size = System::Drawing::Size( 200, 82 ); + this->listBox1->TabIndex = 0; + this->listBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::listBox1_MouseDown ); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 264, 72 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 376, 254 ); + array^temp1 = {this->button1,this->listBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void InitializeMyListBox() + { + // Add items to the ListBox. + listBox1->Items->Add( "A" ); + listBox1->Items->Add( "C" ); + listBox1->Items->Add( "E" ); + listBox1->Items->Add( "F" ); + listBox1->Items->Add( "G" ); + listBox1->Items->Add( "D" ); + listBox1->Items->Add( "B" ); + + // Sort all items added previously. + listBox1->Sorted = true; + + // Set the SelectionMode to select multiple items. + listBox1->SelectionMode = SelectionMode::MultiExtended; + + // Select three initial items from the list. + listBox1->SetSelected( 0, true ); + listBox1->SetSelected( 2, true ); + listBox1->SetSelected( 4, true ); + + // Force the ListBox to scroll back to the top of the list. + listBox1->TopIndex = 0; + } + + void InvertMySelection() + { + // Loop through all items the ListBox. + for ( int x = 0; x < listBox1->Items->Count; x++ ) + { + // Select all items that are not selected, + // deselect all items that are selected. + listBox1->SetSelected( x, !listBox1->GetSelected( x ) ); + } + listBox1->TopIndex = 0; + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + InvertMySelection(); + } + + void listBox1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ){} + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + listBox1->Items->Clear(); + this->InitializeMyListBox(); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp new file mode 100644 index 00000000000..23dbf4f7544 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.PreferredHeight/CPP/form1.cpp @@ -0,0 +1,121 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // listBox1 + // + this->listBox1->Location = System::Drawing::Point( 40, 48 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 152, 56 ); + this->listBox1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 48 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1,this->listBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + SizeMyListBox(); + } + + // +private: + void SizeMyListBox() + { + // Add items to the ListBox. + for ( int x = 0; x < 20; x++ ) + { + listBox1->Items->Add( String::Format( "Item {0}", x ) ); + } + listBox1->Height = listBox1->PreferredHeight; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp new file mode 100644 index 00000000000..7bfec5bd78b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndex/CPP/form1.cpp @@ -0,0 +1,133 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp0 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot","Golf","Hotel"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 64, 48 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 216, 69 ); + this->listBox1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 64 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 88, 24 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 448, 414 ); + array^temp1 = {this->button1,this->listBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + RemoveTopItems(); + } + + // +private: + void RemoveTopItems() + { + // Determine if the currently selected item in the ListBox + // is the item displayed at the top in the ListBox. + if ( listBox1->TopIndex != listBox1->SelectedIndex ) + + // Make the currently selected item the top item in the ListBox. + listBox1->TopIndex = listBox1->SelectedIndex; + + // Remove all items before the top item in the ListBox. + for ( int x = (listBox1->SelectedIndex - 1); x >= 0; x-- ) + { + listBox1->Items->RemoveAt( x ); + } + + // Clear all selections in the ListBox. + listBox1->ClearSelected(); + } + // +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp new file mode 100644 index 00000000000..767fc4127c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.SelectedIndexChanged/CPP/form1.cpp @@ -0,0 +1,125 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::ListBox^ listBox2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->listBox2 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp0 = {"A","B","C","D","E","F","G","H","I","J","K"}; + this->listBox1->Items->AddRange( temp0 ); + this->listBox1->Location = System::Drawing::Point( 40, 32 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 136, 95 ); + this->listBox1->TabIndex = 0; + this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::listBox1_SelectedIndexChanged ); + + // + // listBox2 + // + array^temp1 = {"D","A","B","E","C","F","H","G","K","I","J"}; + this->listBox2->Items->AddRange( temp1 ); + this->listBox2->Location = System::Drawing::Point( 200, 32 ); + this->listBox2->Name = "listBox2"; + this->listBox2->Size = System::Drawing::Size( 136, 95 ); + this->listBox2->TabIndex = 2; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 424, 266 ); + array^temp2 = {this->listBox2,this->listBox1}; + this->Controls->AddRange( temp2 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void listBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Get the currently selected item in the ListBox. + String^ curItem = listBox1->SelectedItem->ToString(); + + // Find the string in ListBox2. + int index = listBox2->FindString( curItem ); + + // If the item was not found in ListBox 2 display a message box, + // otherwise select it in ListBox2. + if ( index == -1 ) + MessageBox::Show( "Item is not available in ListBox2" ); + else + listBox2->SetSelected( index, true ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp new file mode 100644 index 00000000000..457ba273b96 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListBox.UseTabStops/CPP/form1.cpp @@ -0,0 +1,113 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 184, 48 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 88, 24 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^formControls = {this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CreateTabStopList(); + } + + // +private: + void CreateTabStopList() + { + ListBox^ listBox1 = gcnew ListBox; + listBox1->SetBounds( 20, 20, 100, 100 ); + for ( int x = 1; x < 20; x++ ) + { + listBox1->Items->Add( String::Concat( "Item\t", x ) ); + } + listBox1->UseTabStops = true; + this->Controls->Add( listBox1 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp new file mode 100644 index 00000000000..f1323d89e77 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListControl/CPP/form1.cpp @@ -0,0 +1,104 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::Collections; +public ref class USState +{ +private: + String^ myShortName; + String^ myLongName; + +public: + USState( String^ strLongName, String^ strShortName ) + { + this->myShortName = strShortName; + this->myLongName = strLongName; + } + + property String^ ShortName + { + String^ get() + { + return myShortName; + } + } + + property String^ LongName + { + String^ get() + { + return myLongName; + } + + } +}; + +public ref class ListBoxSample3: public Form +{ +private: + ListBox^ ListBox1; + Label^ label1; + TextBox^ textBox1; + +public: + ListBoxSample3() + { + ListBox1 = gcnew ListBox; + label1 = gcnew Label; + textBox1 = gcnew TextBox; + this->ClientSize = System::Drawing::Size(307, 206 ); + this->Text = "ListBox Sample3"; + ListBox1->Location = Point(54,16); + ListBox1->Name = "ListBox1"; + ListBox1->Size = System::Drawing::Size( 240, 130 ); + label1->Location = Point(14,150); + label1->Name = "label1"; + label1->Size = System::Drawing::Size(40, 24); + label1->Text = "Value"; + textBox1->Location = Point(54,150); + textBox1->Name = "textBox1"; + textBox1->Size = System::Drawing::Size( 240, 24 ); + array^temp2 = {ListBox1,label1, textBox1}; + this->Controls->AddRange( temp2 ); + + // + // Populate the list box using an array as DataSource. + // DisplayMember is used to display just the long name of each state. + ArrayList^ USStates = gcnew ArrayList; + USStates->Add( gcnew USState( "Alabama","AL" ) ); + USStates->Add( gcnew USState( "Washington","WA" ) ); + USStates->Add( gcnew USState( "West Virginia","WV" ) ); + USStates->Add( gcnew USState( "Wisconsin","WI" ) ); + USStates->Add( gcnew USState( "Wyoming","WY" ) ); + ListBox1->DataSource = USStates; + ListBox1->DisplayMember = "LongName"; + ListBox1->ValueMember = "ShortName"; + // + ListBox1->SelectedValueChanged += gcnew EventHandler( this, &ListBoxSample3::ListBox1_SelectedValueChanged ); + ListBox1->SetSelected(0, false); + } + + void InitializeComponent(){} + +private: + // + void ListBox1_SelectedValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + textBox1->Text=""; + if ( ListBox1->SelectedIndex != -1 ) + textBox1->Text = ListBox1->SelectedValue->ToString(); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew ListBoxSample3 ); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp new file mode 100644 index 00000000000..234cfd0c71f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListView.AfterLabelEdit/CPP/form1.cpp @@ -0,0 +1,144 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Text; + +namespace ListViewAfterLabelEditEx +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::ListView^ listView1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + array^temp1 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item A",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; + System::Windows::Forms::ListViewItem^ listViewItem1 = gcnew System::Windows::Forms::ListViewItem( temp1,-1 ); + array^temp2 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item B",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; + System::Windows::Forms::ListViewItem^ listViewItem2 = gcnew System::Windows::Forms::ListViewItem( temp2,-1 ); + array^temp3 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item C",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; + System::Windows::Forms::ListViewItem^ listViewItem3 = gcnew System::Windows::Forms::ListViewItem( temp3,-1 ); + array^temp4 = {gcnew System::Windows::Forms::ListViewItem::ListViewSubItem( nullptr,"Item D",System::Drawing::SystemColors::WindowText,System::Drawing::SystemColors::Window,gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,System::Drawing::FontStyle::Regular,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ) )}; + System::Windows::Forms::ListViewItem^ listViewItem4 = gcnew System::Windows::Forms::ListViewItem( temp4,-1 ); + this->listView1 = gcnew System::Windows::Forms::ListView; + this->SuspendLayout(); + + // + // listView1 + // + array^temp0 = {listViewItem1,listViewItem2,listViewItem3,listViewItem4}; + this->listView1->Items->AddRange( temp0 ); + this->listView1->LabelEdit = true; + this->listView1->Location = System::Drawing::Point( 16, 24 ); + this->listView1->Name = "listView1"; + this->listView1->Size = System::Drawing::Size( 424, 328 ); + this->listView1->TabIndex = 0; + this->listView1->AfterLabelEdit += gcnew System::Windows::Forms::LabelEditEventHandler( this, &Form1::MyListView_AfterLabelEdit ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 464, 422 ); + array^temp5 = {this->listView1}; + this->Controls->AddRange(temp5); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + private: + void MyListView_AfterLabelEdit( Object^ /*sender*/, System::Windows::Forms::LabelEditEventArgs^ e ) + { + // Determine if label is changed by checking for 0. + if ( e->Label == nullptr ) + return; + + // ASCIIEncoding is used to determine if a number character has been entered. + ASCIIEncoding^ AE = gcnew ASCIIEncoding; + + // Convert the new label to a character array. + array^temp = e->Label->ToCharArray(); + + // Check each character in the new label to determine if it is a number. + for ( int x = 0; x < temp->Length; x++ ) + { + // Encode the character from the character array to its ASCII code. + array^bc = AE->GetBytes( temp[ x ].ToString() ); + + // Determine if the ASCII code is within the valid range of numerical values. + if ( bc[ 0 ] > 47 && bc[ 0 ] < 58 ) + { + // Cancel the event and return the lable to its original state. + e->CancelEdit = true; + + // Display a MessageBox alerting the user that numbers are not allowed. + MessageBox::Show( "The text for the item cannot contain numerical values." ); + + // Break out of the loop and exit. + return; + } + } + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew ListViewAfterLabelEditEx::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp new file mode 100644 index 00000000000..504325c8fe5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListView.ColumnClick/CPP/listviewsort1.cpp @@ -0,0 +1,121 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::Collections; + +// Implements the manual sorting of items by columns. +ref class ListViewItemComparer: public IComparer +{ +private: + int col; + +public: + ListViewItemComparer() + { + col = 0; + } + + ListViewItemComparer( int column ) + { + col = column; + } + + virtual int Compare( Object^ x, Object^ y ) + { + return String::Compare( (dynamic_cast(x))->SubItems[ col ]->Text, + (dynamic_cast(y))->SubItems[ col ]->Text ); + } +}; + +public ref class ListViewSortForm: public Form +{ +private: + ListView^ listView1; + +public: + ListViewSortForm() + { + // Create ListView items to add to the control. + array^temp0 = {"Banana","a","b","c"}; + ListViewItem^ listViewItem1 = gcnew ListViewItem( temp0,-1,Color::Empty,Color::Yellow,nullptr ); + array^temp1 = {"Cherry","v","g","t"}; + ListViewItem^ listViewItem2 = gcnew ListViewItem( temp1,-1,Color::Empty,Color::Red, + gcnew System::Drawing::Font( "Microsoft Sans Serif",8.25F,FontStyle::Regular,GraphicsUnit::Point,0 ) ); + array^temp2 = {"Apple","h","j","n"}; + ListViewItem^ listViewItem3 = gcnew ListViewItem( temp2,-1,Color::Empty,Color::Lime,nullptr ); + array^temp3 = {"Pear","y","u","i"}; + ListViewItem^ listViewItem4 = gcnew ListViewItem( temp3,-1,Color::Empty,Color::FromArgb( 192, 128, 156 ),nullptr ); + + //Initialize the ListView control and add columns to it. + this->listView1 = gcnew ListView; + + // Set the initial sorting type for the ListView. + this->listView1->Sorting = SortOrder::None; + + // Disable automatic sorting to enable manual sorting. + this->listView1->View = View::Details; + + // Add columns and set their text. + this->listView1->Columns->Add( gcnew ColumnHeader ); + this->listView1->Columns[ 0 ]->Text = "Column 1"; + this->listView1->Columns[ 0 ]->Width = 100; + listView1->Columns->Add( gcnew ColumnHeader ); + listView1->Columns[ 1 ]->Text = "Column 2"; + listView1->Columns->Add( gcnew ColumnHeader ); + listView1->Columns[ 2 ]->Text = "Column 3"; + listView1->Columns->Add( gcnew ColumnHeader ); + listView1->Columns[ 3 ]->Text = "Column 4"; + + // Suspend control logic until form is done configuring form. + this->SuspendLayout(); + + // Add Items to the ListView control. + array^temp4 = {listViewItem1,listViewItem2,listViewItem3,listViewItem4}; + this->listView1->Items->AddRange( temp4 ); + + // Set the location and size of the ListView control. + this->listView1->Location = Point(10,10); + this->listView1->Name = "listView1"; + this->listView1->Size = System::Drawing::Size( 300, 100 ); + this->listView1->TabIndex = 0; + + // Enable editing of the items in the ListView. + this->listView1->LabelEdit = true; + + // Connect the ListView::ColumnClick event to the ColumnClick event handler. + this->listView1->ColumnClick += gcnew ColumnClickEventHandler( this, &ListViewSortForm::ColumnClick ); + + // Initialize the form. + this->ClientSize = System::Drawing::Size( 400, 400 ); + array^temp5 = {this->listView1}; + this->Controls->AddRange( temp5 ); + this->Name = "ListViewSortForm"; + this->Text = "Sorted ListView Control"; + + // Resume lay[Out] of* the form. + this->ResumeLayout( false ); + } + +private: + + // ColumnClick event handler. + void ColumnClick( Object^ /*o*/, ColumnClickEventArgs^ e ) + { + // Set the ListViewItemSorter property to a new ListViewItemComparer + // object. Setting this property immediately sorts the + // ListView using the ListViewItemComparer object. + this->listView1->ListViewItemSorter = gcnew ListViewItemComparer( e->Column ); + } +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew ListViewSortForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp new file mode 100644 index 00000000000..0c7cdcba505 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListView.HorizontalExtent/CPP/form1.cpp @@ -0,0 +1,138 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ListBoxHorizExtentEx +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // listBox1 + // + this->listBox1->Location = System::Drawing::Point( 56, 48 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 160, 69 ); + this->listBox1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 272, 56 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 464, 334 ); + array^temp0 = {this->button1,this->listBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ sender, System::EventArgs^ e ) + { + DisplayHScroll(); + } + + // + private: + void DisplayHScroll() + { + // Make sure no items are displayed partially. + listBox1->IntegralHeight = true; + + // Add items that are wide to the ListBox. + for ( int x = 0; x < 10; x++ ) + { + listBox1->Items->Add( String::Format( "Item {0} is a very large value that requires scroll bars", x ) ); + + } + + // Display a horizontal scroll bar. + listBox1->HorizontalScrollbar = true; + + // Create a Graphics object to use when determining the size of the largest item in the ListBox. + Graphics^ g = listBox1->CreateGraphics(); + + // Determine the size for HorizontalExtent using the MeasureString method using the last item in the list. + int hzSize = (int)g->MeasureString( dynamic_cast(listBox1->Items[ listBox1->Items->Count - 1 ]), listBox1->Font ).Width; + + // Set the HorizontalExtent property. + listBox1->HorizontalExtent = hzSize; + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew ListBoxHorizExtentEx::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp new file mode 100644 index 00000000000..eb534f52c60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ListViewExample/CPP/form1.cpp @@ -0,0 +1,177 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 344, 360 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 104, 24 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 464, 397 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void CreateMyListView() + { + // Create a new ListView control. + ListView^ listView1 = gcnew ListView; + listView1->Bounds = Rectangle(Point(10,10),System::Drawing::Size( 300, 200 )); + + // Set the view to show details. + listView1->View = View::Details; + + // Allow the user to edit item text. + listView1->LabelEdit = true; + + // Allow the user to rearrange columns. + listView1->AllowColumnReorder = true; + + // Display check boxes. + listView1->CheckBoxes = true; + + // Select the item and subitems when selection is made. + listView1->FullRowSelect = true; + + // Display grid lines. + listView1->GridLines = true; + + // Sort the items in the list in ascending order. + listView1->Sorting = SortOrder::Ascending; + + // Create three items and three sets of subitems for each item. + ListViewItem^ item1 = gcnew ListViewItem( "item1",0 ); + + // Place a check mark next to the item. + item1->Checked = true; + item1->SubItems->Add( "1" ); + item1->SubItems->Add( "2" ); + item1->SubItems->Add( "3" ); + ListViewItem^ item2 = gcnew ListViewItem( "item2",1 ); + item2->SubItems->Add( "4" ); + item2->SubItems->Add( "5" ); + item2->SubItems->Add( "6" ); + ListViewItem^ item3 = gcnew ListViewItem( "item3",0 ); + + // Place a check mark next to the item. + item3->Checked = true; + item3->SubItems->Add( "7" ); + item3->SubItems->Add( "8" ); + item3->SubItems->Add( "9" ); + + // Create columns for the items and subitems. + // Width of -2 indicates auto-size. + listView1->Columns->Add( "Item Column", -2, HorizontalAlignment::Left ); + listView1->Columns->Add( "Column 2", -2, HorizontalAlignment::Left ); + listView1->Columns->Add( "Column 3", -2, HorizontalAlignment::Left ); + listView1->Columns->Add( "Column 4", -2, HorizontalAlignment::Center ); + + //Add the items to the ListView. + array^temp1 = {item1,item2,item3}; + listView1->Items->AddRange( temp1 ); + + // Create two ImageList objects. + ImageList^ imageListSmall = gcnew ImageList; + ImageList^ imageListLarge = gcnew ImageList; + + // Initialize the ImageList objects with bitmaps. + imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage1.bmp" ) ); + imageListSmall->Images->Add( Bitmap::FromFile( "C:\\MySmallImage2.bmp" ) ); + imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage1.bmp" ) ); + imageListLarge->Images->Add( Bitmap::FromFile( "C:\\MyLargeImage2.bmp" ) ); + + //Assign the ImageList objects to the ListView. + listView1->LargeImageList = imageListLarge; + listView1->SmallImageList = imageListSmall; + + // Add the ListView to the control collection. + this->Controls->Add( listView1 ); + } + // + + void button1_Click( Object^ sender, System::EventArgs^ e ) + { + CreateMyListView(); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp new file mode 100644 index 00000000000..2739c8e4a4d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/LocalizationExtenderProviderExample/CPP/class1.cpp @@ -0,0 +1,205 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Diagnostics; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +// This example demonstrates adding localization support to a component hierarchy from a +// custom IRootDesigner using the LocalizationExtenderProvider class. +namespace LocalizationExtenderProviderExample +{ + + // Example IRootDesigner implementation demonstrates LocalizationExtenderProvider support. + private ref class SampleRootDesigner: public IRootDesigner + { + private: + + // RootDesignerView is a simple control that will be displayed in the designer window. + ref class RootDesignerView: public Control + { + private: + SampleRootDesigner^ m_designer; + IComponent^ comp; + + public: + RootDesignerView( SampleRootDesigner^ designer, IComponent^ component ) + { + m_designer = designer; + this->comp = component; + BackColor = Color::Blue; + Font = gcnew System::Drawing::Font( FontFamily::GenericMonospace,12 ); + } + + + protected: + + // Displays the name of the component and the name of the assembly of the component + // that this root designer is providing support for. + virtual void OnPaint( PaintEventArgs^ pe ) override + { + Control::OnPaint( pe ); + if ( m_designer != 0 && comp != 0 ) + { + + // Draws the name of the component in large letters. + pe->Graphics->DrawString( "Root Designer View", Font, Brushes::Yellow, 8, 4 ); + pe->Graphics->DrawString( String::Concat( "Design Name : ", comp->Site->Name ), gcnew System::Drawing::Font( "Arial",10 ), Brushes::Yellow, 8, 28 ); + pe->Graphics->DrawString( String::Concat( "Assembly : ", comp->GetType()->AssemblyQualifiedName ), gcnew System::Drawing::Font( "Arial",10 ), Brushes::Yellow, System::Drawing::RectangleF( System::Drawing::Point( 8, 44 ), System::Drawing::Size( ClientRectangle.Width - 8, ClientRectangle.Height - 44 ) ) ); + + // Uses the site of the component to acquire an ISelectionService and sets the property grid focus to the component. + ISelectionService^ selectionService = dynamic_cast(comp->Site->GetService( typeid )); + if ( selectionService != nullptr ) + { + array^myArray = {m_designer->component}; + selectionService->SetSelectedComponents( static_cast(myArray) ); + } + } + } + + }; + + + protected: + + // RootDesignerView Control provides a full region designer view for this root designer's associated component. + RootDesignerView^ m_view; + + // Stores reference to the LocalizationExtenderProvider this designer adds, in order to remove it on Dispose. + LocalizationExtenderProvider^ extender; + + // Internally stores the IDesigner's component reference + IComponent^ component; + + // Provides a RootDesignerView object that supports ViewTechnology.WindowsForms. + Object^ GetView( ViewTechnology technology ) + { + if ( technology != ViewTechnology::WindowsForms ) + { + throw gcnew ArgumentException( "Not a supported view technology", "technology" ); + } + + if ( m_view == nullptr ) + { + + // Create the view control. In this example, a Control of type RootDesignerView is used. + // A WindowsForms ViewTechnology view provider requires a class that inherits from Control. + m_view = gcnew RootDesignerView( this,this->Component ); + } + + return m_view; + } + + + property array^ SupportedTechnologies + { + + // This designer supports the WindowsForms view technology. + array^ IRootDesigner::get() + { + ViewTechnology myArray[] = {ViewTechnology::WindowsForms}; + return myArray; + } + + } + + public: + + // Adds a LocalizationExtenderProvider for the component this designer is initialized to support. + void Initialize( IComponent^ component ) + { + this->component = component; + + // If no extender from this designer is active... + if ( extender == nullptr ) + { + + // + // Adds a LocalizationExtenderProvider that provides localization support properties to the specified component. + extender = gcnew LocalizationExtenderProvider( this->component->Site,this->component ); + + // + } + } + + + property DesignerVerbCollection^ Verbs + { + + // Empty IDesigner interface property and method implementations + DesignerVerbCollection^ get() + { + return nullptr; + } + + } + + property IComponent^ Component + { + IComponent^ get() + { + return this->component; + } + + } + void DoDefaultAction(){} + + void Dispose(){} + + + protected: + + // If a LocalizationExtenderProvider has been added, removes the extender provider. + void Dispose( bool disposing ) + { + + // If an extender has been added, remove it + if ( extender != nullptr ) + { + + // Disposes of the extender provider. The extender + // provider removes itself from the extender provider + // service when it is disposed. + extender->Dispose(); + extender = nullptr; + } + } + + }; + + + // The following attribute associates the RootDesignedComponent with the RootDesignedComponent component. + + [Designer(__typeof(SampleRootDesigner),__typeof(IRootDesigner))] + public ref class RootDesignedComponent: public Component + { + public: + RootDesignedComponent(){} + + }; + + + // RootViewDesignerComponent is a component associated with the SampleRootDesigner + // IRootDesigner that provides LocalizationExtenderProvider localization support. + // This derived class is included at the top of this example to enable + // easy launching of designer view without having to put the class in its own file. + public ref class RootViewDesignerComponent: public RootDesignedComponent + { + public: + RootViewDesignerComponent(){} + + }; + +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp new file mode 100644 index 00000000000..95f6244a515 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MeasureItemEventArgs/CPP/form1.cpp @@ -0,0 +1,134 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::ComponentModel::Container^ components; + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + // listBox1 + // + this->listBox1->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawVariable; + this->listBox1->Location = System::Drawing::Point( 16, 48 ); + this->listBox1->Name = "listBox1"; + this->listBox1->SelectionMode = System::Windows::Forms::SelectionMode::MultiExtended; + this->listBox1->Size = System::Drawing::Size( 256, 134 ); + this->listBox1->TabIndex = 0; + this->listBox1->MeasureItem += gcnew System::Windows::Forms::MeasureItemEventHandler( this, &Form1::listBox1_MeasureItem ); + this->listBox1->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::listBox1_DrawItem ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->listBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void listBox1_MeasureItem( Object^ /*sender*/, MeasureItemEventArgs^ e ) + { + System::Drawing::Font^ font = (dynamic_cast(listBox1->Items[ e->Index ]))->Font; + SizeF stringSize = e->Graphics->MeasureString( font->Name, font ); + + // Set the height and width of the item + e->ItemHeight = (int)stringSize.Height; + e->ItemWidth = (int)stringSize.Width; + } + + // For efficiency, cache the brush to use for drawing. + SolidBrush^ foreColorBrush; + void listBox1_DrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) + { + Brush^ brush; + + // Create the brush using the ForeColor specified by the DrawItemEventArgs + if ( foreColorBrush == nullptr ) + foreColorBrush = gcnew SolidBrush( e->ForeColor ); + else + if ( foreColorBrush->Color != e->ForeColor ) + { + // The control's ForeColor has changed, so dispose of the cached brush and + // create a new one. + delete foreColorBrush; + foreColorBrush = gcnew SolidBrush( e->ForeColor ); + } + + // Select the appropriate brush depending on if the item is selected. + // Since State can be a combinateion (bit-flag) of enum values, you can't use + // "==" to compare them. + if ( (e->State & DrawItemState::Selected) == DrawItemState::Selected ) + brush = SystemBrushes::HighlightText; + else + brush = foreColorBrush; + + // Perform the painting. + System::Drawing::Font^ font = (dynamic_cast(listBox1->Items[ e->Index ]))->Font; + e->DrawBackground(); + e->Graphics->DrawString( font->Name, font, brush, e->Bounds ); + e->DrawFocusRectangle(); + } + +public: + + /// + /// A wrapper class for use with storing Fonts in a ListBox. Since ListBox uses the + /// ToString() of its items for the text it displays, this class is needed to return + /// the name of the font, rather than its ToString() value. + /// + ref class ListBoxFontItem + { + public: + System::Drawing::Font^ Font; + ListBoxFontItem( System::Drawing::Font^ f ) + { + Font = f; + } + + virtual String^ ToString() override + { + return Font->Name; + } + }; +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp new file mode 100644 index 00000000000..5598f1c56d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MenuCommand Example/CPP/component1.cpp @@ -0,0 +1,38 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Security::Permissions; + +namespace CppMenuCommand +{ + // + public ref class CDesigner: public ComponentDesigner + { + public: + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + virtual void Initialize( IComponent^ comp ) override + { + ComponentDesigner::Initialize( comp ); + IMenuCommandService^ mcs = static_cast(comp->Site->GetService( IMenuCommandService::typeid )); + MenuCommand^ mc = gcnew MenuCommand( gcnew EventHandler( this, &CDesigner::OnF1Help ),StandardCommands::F1Help ); + mc->Enabled = true; + mc->Visible = true; + mc->Supported = true; + mcs->AddCommand( mc ); + System::Windows::Forms::MessageBox::Show( "Initialize() has been invoked." ); + } + + private: + void OnF1Help( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + System::Windows::Forms::MessageBox::Show( "F1Help has been invoked." ); + } + }; +} +// +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp new file mode 100644 index 00000000000..b7d3456a1d0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Popup/CPP/form1.cpp @@ -0,0 +1,177 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::MainMenu^ mainMenu1; + System::Windows::Forms::MenuItem^ menuEdit; + System::Windows::Forms::MenuItem^ menuCut; + System::Windows::Forms::MenuItem^ menuCopy; + System::Windows::Forms::MenuItem^ menuPaste; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::MenuItem^ menuDelete; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->menuEdit = gcnew System::Windows::Forms::MenuItem; + this->menuCut = gcnew System::Windows::Forms::MenuItem; + this->menuCopy = gcnew System::Windows::Forms::MenuItem; + this->menuPaste = gcnew System::Windows::Forms::MenuItem; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->menuDelete = gcnew System::Windows::Forms::MenuItem; + this->SuspendLayout(); + + // + // mainMenu1 + // + array^temp0 = {this->menuEdit}; + this->mainMenu1->MenuItems->AddRange( temp0 ); + + // + // menuEdit + // + this->menuEdit->Index = 0; + array^temp1 = {this->menuCut,this->menuCopy,this->menuPaste,this->menuDelete}; + this->menuEdit->MenuItems->AddRange( temp1 ); + this->menuEdit->Text = "&Edit"; + this->menuEdit->Popup += gcnew System::EventHandler( this, &Form1::PopupMyMenu ); + + // + // menuCut + // + this->menuCut->Index = 0; + this->menuCut->Text = "Cu&t"; + + // + // menuCopy + // + this->menuCopy->Index = 1; + this->menuCopy->Text = "&Copy"; + + // + // menuPaste + // + this->menuPaste->Index = 2; + this->menuPaste->Text = "&Paste"; + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 120, 153 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 168, 20 ); + this->textBox1->TabIndex = 1; + this->textBox1->Text = "textBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 304, 152 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + + // + // menuDelete + // + this->menuDelete->Index = 3; + this->menuDelete->Text = "&Delete"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 408, 326 ); + array^temp2 = {this->button1,this->textBox1}; + this->Controls->AddRange( temp2 ); + this->Menu = this->mainMenu1; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void PopupMyMenu( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( !textBox1->Enabled || !textBox1->Focused || textBox1->SelectedText->Length == 0 ) + { + menuCut->Enabled = false; + menuCopy->Enabled = false; + menuDelete->Enabled = false; + } + else + { + menuCut->Enabled = true; + menuCopy->Enabled = true; + menuDelete->Enabled = true; + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// End Class CDesigner +// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp new file mode 100644 index 00000000000..ced6500ad8f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MenuItem.Select/CPP/form1.cpp @@ -0,0 +1,180 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::StatusBar^ statusBar1; + System::Windows::Forms::StatusBarPanel^ statusBarPanel1; + System::Windows::Forms::MainMenu^ mainMenu1; + System::Windows::Forms::MenuItem^ menuItem1; + System::Windows::Forms::MenuItem^ menuItem4; + System::Windows::Forms::MenuItem^ menuOpen; + System::Windows::Forms::MenuItem^ menuSave; + System::Windows::Forms::MenuItem^ menuExit; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->statusBar1 = gcnew System::Windows::Forms::StatusBar; + this->statusBarPanel1 = gcnew System::Windows::Forms::StatusBarPanel; + this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->menuItem1 = gcnew System::Windows::Forms::MenuItem; + this->menuOpen = gcnew System::Windows::Forms::MenuItem; + this->menuSave = gcnew System::Windows::Forms::MenuItem; + this->menuItem4 = gcnew System::Windows::Forms::MenuItem; + this->menuExit = gcnew System::Windows::Forms::MenuItem; + (dynamic_cast(this->statusBarPanel1))->BeginInit(); + this->SuspendLayout(); + + // + // statusBar1 + // + this->statusBar1->Location = System::Drawing::Point( 0, 496 ); + this->statusBar1->Name = "statusBar1"; + array^temp0 = {this->statusBarPanel1}; + this->statusBar1->Panels->AddRange( temp0 ); + this->statusBar1->ShowPanels = true; + this->statusBar1->Size = System::Drawing::Size( 536, 22 ); + this->statusBar1->TabIndex = 0; + this->statusBar1->Text = "statusBar1"; + + // + // statusBarPanel1 + // + this->statusBarPanel1->AutoSize = System::Windows::Forms::StatusBarPanelAutoSize::Spring; + this->statusBarPanel1->Text = "statusBarPanel1"; + this->statusBarPanel1->Width = 520; + + // + // mainMenu1 + // + array^temp1 = {this->menuItem1}; + this->mainMenu1->MenuItems->AddRange( temp1 ); + + // + // menuItem1 + // + this->menuItem1->Index = 0; + array^temp2 = {this->menuOpen,this->menuSave,this->menuItem4,this->menuExit}; + this->menuItem1->MenuItems->AddRange( temp2 ); + this->menuItem1->Text = "&File"; + + // + // menuOpen + // + this->menuOpen->Index = 0; + this->menuOpen->Text = "&Open"; + this->menuOpen->Select += gcnew System::EventHandler( this, &Form1::MenuSelected ); + + // + // menuSave + // + this->menuSave->Index = 1; + this->menuSave->Text = "&Save"; + this->menuSave->Select += gcnew System::EventHandler( this, &Form1::MenuSelected ); + + // + // menuItem4 + // + this->menuItem4->Index = 2; + this->menuItem4->Text = "-"; + + // + // menuExit + // + this->menuExit->Index = 3; + this->menuExit->Text = "E&xit"; + this->menuExit->Select += gcnew System::EventHandler( this, &Form1::MenuSelected ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 536, 518 ); + array^temp3 = {this->statusBar1}; + this->Controls->AddRange( temp3 ); + this->Menu = this->mainMenu1; + this->Name = "Form1"; + this->Text = "Form1"; + (dynamic_cast(this->statusBarPanel1))->EndInit(); + this->ResumeLayout( false ); + } + + // +private: + void MenuSelected( Object^ sender, System::EventArgs^ /*e*/ ) + { + if ( sender == menuOpen ) + statusBar1->Panels[ 0 ]->Text = "Opens a file to edit"; + else + if ( sender == menuSave ) + statusBar1->Panels[ 0 ]->Text = "Saves the current file"; + else + if ( sender == menuExit ) + statusBar1->Panels[ 0 ]->Text = "Exits the application"; + else + statusBar1->Panels[ 0 ]->Text = "Ready"; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// End Class CDesigner +// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp new file mode 100644 index 00000000000..8d8c236d033 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MenuItemClick/CPP/form1.cpp @@ -0,0 +1,118 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + CreateMyMenu(); + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +public: + void CreateMyMenu() + { + // Create a main menu object. + MainMenu^ mainMenu1 = gcnew MainMenu; + + // Create empty menu item objects. + MenuItem^ topMenuItem = gcnew MenuItem; + MenuItem^ menuItem1 = gcnew MenuItem; + + // Set the caption of the menu items. + topMenuItem->Text = "&File"; + menuItem1->Text = "&Open"; + + // Add the menu items to the main menu. + topMenuItem->MenuItems->Add( menuItem1 ); + mainMenu1->MenuItems->Add( topMenuItem ); + + // Add functionality to the menu items using the Click event. + menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + +private: + void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create a new OpenFileDialog and display it. + OpenFileDialog^ fd = gcnew OpenFileDialog; + fd->DefaultExt = "*."; + fd->ShowDialog(); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// End Class CDesigner +// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp new file mode 100644 index 00000000000..d91733cf31e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MergeMenu/CPP/form1.cpp @@ -0,0 +1,111 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + InitializeMyMainMenu(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +private: + void InitializeMyMainMenu() + { + // Create the 2 menus and the menu items to add. + MainMenu^ mainMenu1 = gcnew MainMenu; + MainMenu^ mainMenu2 = gcnew MainMenu; + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + + // Set the caption for the menu items. + menuItem1->Text = "File"; + menuItem2->Text = "Edit"; + + // Add a menu item to each menu for displaying. + mainMenu1->MenuItems->Add( menuItem1 ); + mainMenu2->MenuItems->Add( menuItem2 ); + + // Merge mainMenu2 with mainMenu1 + mainMenu1->MergeMenu( mainMenu2 ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// End Class CDesigner +// End nampspace CSMenuCommand diff --git a/snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp new file mode 100644 index 00000000000..f9eb80c569a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MessageBox.Show Variations/CPP/form1.cpp @@ -0,0 +1,233 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ serverName; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->serverName = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // serverName + // + this->serverName->Location = System::Drawing::Point( 32, 40 ); + this->serverName->Name = "serverName"; + this->serverName->TabIndex = 0; + this->serverName->Text = "textBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 40, 96 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {this->button1,this->serverName}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + validateUserEntry(); + validateUserEntry2(); + validateUserEntry3(); + validateUserEntry4(); + validateUserEntry5(); + } + + // +private: + void validateUserEntry() + { + // Checks the value of the text. + if ( serverName->Text->Length == 0 ) + { + // Initializes the variables to pass to the MessageBox::Show method. + String^ message = "You did not enter a server name. Cancel this operation?"; + String^ caption = "No Server Name Specified"; + MessageBoxButtons buttons = MessageBoxButtons::YesNo; + System::Windows::Forms::DialogResult result; + + // Displays the MessageBox. + result = MessageBox::Show( this, message, caption, buttons ); + if ( result == ::DialogResult::Yes ) + { + // Closes the parent form. + this->Close(); + } + } + } + // + + // +private: + void validateUserEntry2() + { + // Checks the value of the text. + if ( serverName->Text->Length == 0 ) + { + // Initializes the variables to pass to the MessageBox::Show method. + String^ message = "You did not enter a server name. Cancel this operation?"; + String^ caption = "No Server Name Specified"; + MessageBoxButtons buttons = MessageBoxButtons::YesNo; + System::Windows::Forms::DialogResult result; + + // Displays the MessageBox. + result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, MessageBoxOptions::RightAlign ); + if ( result == ::DialogResult::Yes ) + { + // Closes the parent form. + this->Close(); + } + } + } + // + + // +private: + void validateUserEntry3() + { + // Checks the value of the text. + if ( serverName->Text->Length == 0 ) + { + // Initializes the variables to pass to the MessageBox::Show method. + String^ message = "You did not enter a server name. Cancel this operation?"; + String^ caption = "No Server Name Specified"; + MessageBoxButtons buttons = MessageBoxButtons::YesNo; + System::Windows::Forms::DialogResult result; + + // Displays the MessageBox. + result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1 ); + if ( result == ::DialogResult::Yes ) + { + // Closes the parent form. + this->Close(); + } + } + } + // + + // +private: + void validateUserEntry4() + { + // Checks the value of the text. + if ( serverName->Text->Length == 0 ) + { + // Initializes the variables to pass to the MessageBox::Show method. + String^ message = "You did not enter a server name. Cancel this operation?"; + String^ caption = "No Server Name Specified"; + MessageBoxButtons buttons = MessageBoxButtons::YesNo; + System::Windows::Forms::DialogResult result; + + // Displays the MessageBox. + result = MessageBox::Show( this, message, caption, buttons, MessageBoxIcon::Question ); + if ( result == ::DialogResult::Yes ) + { + // Closes the parent form. + this->Close(); + } + } + } + // + + // +private: + void validateUserEntry5() + { + // Checks the value of the text. + if ( serverName->Text->Length == 0 ) + { + // Initializes the variables to pass to the MessageBox::Show method. + String^ message = "You did not enter a server name. Cancel this operation?"; + String^ caption = "No Server Name Specified"; + MessageBoxButtons buttons = MessageBoxButtons::YesNo; + System::Windows::Forms::DialogResult result; + + // Displays the MessageBox. + result = MessageBox::Show( this, message, caption, buttons ); + if ( result == ::DialogResult::Yes ) + { + // Closes the parent form. + this->Close(); + } + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp b/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp new file mode 100644 index 00000000000..40ce708e483 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MonthCalendar/CPP/mc.cpp @@ -0,0 +1,487 @@ +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::MonthCalendar^ monthCalendar1; + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::ComboBox^ comboBox1; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::TextBox^ textBox2; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::Label ^ label4; + System::Windows::Forms::DateTimePicker^ dateTimePicker1; + System::Windows::Forms::DateTimePicker^ dateTimePicker2; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::Button^ button3; + System::Windows::Forms::CheckBox^ checkBox1; + System::Windows::Forms::CheckBox^ checkBox2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + this->Closing += gcnew CancelEventHandler( this, &Form1::this_Closing ); + textBox1->LostFocus += gcnew EventHandler( this, &Form1::textBox1_LostFocus ); + setCalendarLook(); + dateTimePicker1->Value = monthCalendar1->MinDate; + dateTimePicker2->Value = monthCalendar1->MaxDate; + textBox1->Text = monthCalendar1->MaxSelectionCount.ToString(); + for ( Day day = Day::Monday; day <= Day::Default; day++ ) + { + comboBox1->Items->Add( day.ToString() ); + + } + comboBox1->SelectedItem = comboBox1->Items[ comboBox1->Items->IndexOf( monthCalendar1->FirstDayOfWeek.ToString() ) ]; + loadDates(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->label4 = gcnew System::Windows::Forms::Label; + this->label1 = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->label3 = gcnew System::Windows::Forms::Label; + this->dateTimePicker2 = gcnew System::Windows::Forms::DateTimePicker; + this->dateTimePicker1 = gcnew System::Windows::Forms::DateTimePicker; + this->textBox2 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button3 = gcnew System::Windows::Forms::Button; + this->checkBox1 = gcnew System::Windows::Forms::CheckBox; + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->checkBox2 = gcnew System::Windows::Forms::CheckBox; + this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; + this->button2 = gcnew System::Windows::Forms::Button; + this->comboBox1 = gcnew System::Windows::Forms::ComboBox; + this->SuspendLayout(); + + // + // label4 + // + this->label4->Location = System::Drawing::Point( 216, 176 ); + this->label4->Name = "label4"; + this->label4->Size = System::Drawing::Size( 248, 16 ); + this->label4->TabIndex = 8; + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 8, 24 ); + this->label1->Name = "label1"; + this->label1->Size = System::Drawing::Size( 128, 16 ); + this->label1->TabIndex = 2; + this->label1->Text = "Max Selection Count"; + + // + // label2 + // + this->label2->Location = System::Drawing::Point( 8, 56 ); + this->label2->Name = "label2"; + this->label2->TabIndex = 4; + this->label2->Text = "Min Date"; + + // + // label3 + // + this->label3->Location = System::Drawing::Point( 8, 104 ); + this->label3->Name = "label3"; + this->label3->TabIndex = 6; + this->label3->Text = "Max Date"; + + // + // dateTimePicker2 + // + this->dateTimePicker2->Location = System::Drawing::Point( 8, 128 ); + this->dateTimePicker2->Name = "dateTimePicker2"; + this->dateTimePicker2->TabIndex = 7; + this->dateTimePicker2->ValueChanged += gcnew System::EventHandler( this, &Form1::dateTimePicker2_ValueChanged ); + + // + // dateTimePicker1 + // + this->dateTimePicker1->Location = System::Drawing::Point( 8, 80 ); + this->dateTimePicker1->Name = "dateTimePicker1"; + this->dateTimePicker1->TabIndex = 5; + this->dateTimePicker1->ValueChanged += gcnew System::EventHandler( this, &Form1::dateTimePicker1_ValueChanged ); + + // + // textBox2 + // + this->textBox2->Enabled = false; + this->textBox2->Location = System::Drawing::Point( 216, 192 ); + this->textBox2->Name = "textBox2"; + this->textBox2->Size = System::Drawing::Size( 144, 20 ); + this->textBox2->TabIndex = 9; + this->textBox2->Text = ""; + this->textBox2->TextChanged += gcnew System::EventHandler( this, &Form1::textBox2_TextChanged ); + + // + // button1 + // + this->button1->Enabled = false; + this->button1->Location = System::Drawing::Point( 216, 216 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 112, 24 ); + this->button1->TabIndex = 10; + this->button1->Text = "Add Description"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 136, 24 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 24, 20 ); + this->textBox1->TabIndex = 3; + this->textBox1->Text = ""; + this->textBox1->KeyPress += gcnew System::Windows::Forms::KeyPressEventHandler( this, &Form1::textBox1_keypress ); + this->textBox1->Validating += gcnew System::ComponentModel::CancelEventHandler( this, &Form1::textBox1_Validate ); + + // + // button3 + // + this->button3->Enabled = false; + this->button3->Location = System::Drawing::Point( 488, 224 ); + this->button3->Name = "button3"; + this->button3->Size = System::Drawing::Size( 104, 24 ); + this->button3->TabIndex = 12; + this->button3->Text = "Clear All"; + this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + + // + // checkBox1 + // + this->checkBox1->Location = System::Drawing::Point( 8, 160 ); + this->checkBox1->Name = "checkBox1"; + this->checkBox1->Size = System::Drawing::Size( 144, 24 ); + this->checkBox1->TabIndex = 13; + this->checkBox1->Text = "Show Todays Date"; + this->checkBox1->CheckedChanged += gcnew System::EventHandler( this, &Form1::checkBox1_CheckedChanged ); + + // + // listBox1 + // + this->listBox1->Location = System::Drawing::Point( 488, 16 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 176, 160 ); + this->listBox1->TabIndex = 1; + this->listBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::listBox1_SelectedIndexChanged ); + + // + // checkBox2 + // + this->checkBox2->Location = System::Drawing::Point( 8, 192 ); + this->checkBox2->Name = "checkBox2"; + this->checkBox2->Size = System::Drawing::Size( 120, 24 ); + this->checkBox2->TabIndex = 14; + this->checkBox2->Text = "Show Today Circle"; + this->checkBox2->CheckedChanged += gcnew System::EventHandler( this, &Form1::checkBox2_CheckedChanged ); + + // + // monthCalendar1 + // + this->monthCalendar1->Location = System::Drawing::Point( 216, 8 ); + this->monthCalendar1->Name = "monthCalendar1"; + this->monthCalendar1->TabIndex = 0; + this->monthCalendar1->DateSelected += + gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateSelected ); + + // + // button2 + // + this->button2->Enabled = false; + this->button2->Location = System::Drawing::Point( 488, 184 ); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 104, 24 ); + this->button2->TabIndex = 11; + this->button2->Text = "Delete Selected"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // comboBox1 + // + this->comboBox1->DropDownWidth = 121; + this->comboBox1->Location = System::Drawing::Point( 8, 232 ); + this->comboBox1->Name = "comboBox1"; + this->comboBox1->Size = System::Drawing::Size( 121, 21 ); + this->comboBox1->TabIndex = 15; + this->comboBox1->Text = "comboBox1"; + this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::comboBox1_SelectedIndexChanged ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 672, 273 ); + array^temp3 = {this->comboBox1,this->checkBox2,this->checkBox1,this->button3, + this->button2,this->button1,this->textBox2,this->label4,this->dateTimePicker2,this->label3, + this->dateTimePicker1,this->label2,this->textBox1,this->label1,this->listBox1,this->monthCalendar1}; + this->Controls->AddRange( temp3 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void checkBox1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( checkBox1->Checked) + monthCalendar1->ShowToday = true; + else + monthCalendar1->ShowToday = false; + } + // + + // +private: + void checkBox2_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( checkBox2->Checked) + monthCalendar1->ShowTodayCircle = true; + else + monthCalendar1->ShowTodayCircle = false; + } + // + + void dateTimePicker1_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( dateTimePicker1->Value != monthCalendar1->MinDate ) + { + if ( dateTimePicker1->Value > monthCalendar1->MaxDate ) + dateTimePicker2->Value = dateTimePicker1->Value.AddDays( monthCalendar1->MaxSelectionCount ); + monthCalendar1->MinDate = dateTimePicker1->Value; + } + } + + void dateTimePicker2_ValueChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( dateTimePicker2->Value != monthCalendar1->MaxDate ) + { + if ( dateTimePicker2->Value < monthCalendar1->MinDate ) + dateTimePicker1->Value = dateTimePicker2->Value.AddDays( -monthCalendar1->MaxSelectionCount ); + monthCalendar1->MaxDate = dateTimePicker2->Value; + } + } + + void textBox1_keypress( Object^ /*sender*/, KeyPressEventArgs^ k ) + { + k->Handled = true; + if ( (k->KeyChar >= '0' && k->KeyChar <= '9') || k->KeyChar == '\t' || k->KeyChar == '\b' || k->KeyChar == '\r' ) + { + k->Handled = false; + } + + if ( k->KeyChar == '\r' ) + { + monthCalendar1->Focus(); + } + } + + void textBox1_Validate( Object^ /*sender*/, CancelEventArgs^ c ) + { + if ( Int32::Parse( textBox1->Text ) < 1 || Int32::Parse( textBox1->Text ) > 365 ) + { + MessageBox::Show( "Max Selection Count must be greater than zero and less than 366." ); + c->Cancel = true; + } + } + + // +private: + void textBox1_LostFocus( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + monthCalendar1->MaxSelectionCount = Int32::Parse( textBox1->Text ); + } + // + + // +private: + void comboBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + monthCalendar1->FirstDayOfWeek = (Day)comboBox1->SelectedIndex; + } + // + + void monthCalendar1_DateSelected( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ /*e*/ ) + { + label4->Text = String::Format( "Enter description for {0}", monthCalendar1->SelectionStart.ToShortDateString() ); + if ( monthCalendar1->SelectionEnd != monthCalendar1->SelectionStart ) + label4->Text = String::Format( "{0} to {1}", label4->Text, monthCalendar1->SelectionEnd.ToShortDateString() ); + + textBox2->Enabled = true; + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + for ( int i = 0; monthCalendar1->SelectionEnd >= monthCalendar1->SelectionStart.AddDays( i ); i++ ) + { + listBox1->Items->Add( String::Concat( monthCalendar1->SelectionStart.AddDays( i ).ToShortDateString(), " ", + textBox2->Text ) ); + } + label4->Text = ""; + textBox2->Enabled = false; + button1->Enabled = false; + button3->Enabled = true; + } + + void textBox2_TextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( textBox2->Text->Trim()->Equals( "" ) ) + { + textBox2->Text = textBox2->Text->Trim(); + button1->Enabled = false; + } + else + button1->Enabled = true; + } + + void this_Closing( Object^ /*Sender*/, CancelEventArgs^ /*c*/ ) + { + StreamWriter^ myOutputStream = File::CreateText( "myDates.txt" ); + IEnumerator^ myDates = listBox1->Items->GetEnumerator(); + while ( myDates->MoveNext() ) + { + myOutputStream->WriteLine( myDates->Current ); + } + + myOutputStream->Flush(); + myOutputStream->Close(); + } + + void listBox1_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( listBox1->SelectedIndex != -1 ) + button2->Enabled = true; + else + button2->Enabled = false; + } + + + // +private: + // The following method uses Add to add dates that are + // bolded, followed by an UpdateBoldedDates to make the + // added dates visible. + void loadDates() + { + String^ myInput; + try + { + StreamReader^ myInputStream = File::OpenText( "myDates.txt" ); + while ( (myInput = myInputStream->ReadLine()) != nullptr ) + { + monthCalendar1->AddBoldedDate( DateTime::Parse( myInput->Substring( 0, myInput->IndexOf( " " ) ) ) ); + listBox1->Items->Add( myInput ); + } + monthCalendar1->UpdateBoldedDates(); + myInputStream->Close(); + File::Delete( "myDates.txt" ); + } + catch ( FileNotFoundException^ fnfe ) + { + + // Code to handle a file that could not be found should go here. + Console::WriteLine( "An error occurred: '{0}'", fnfe ); + } + + } + // + + // +private: + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + monthCalendar1->RemoveBoldedDate( DateTime::Parse( listBox1->SelectedItem->ToString()-> + Substring( 0, listBox1->SelectedItem->ToString()->IndexOf( " " ) ) ) ); + monthCalendar1->UpdateBoldedDates(); + listBox1->Items->RemoveAt( listBox1->SelectedIndex ); + if ( listBox1->Items->Count == 0 ) + button3->Enabled = false; + } + // + + // +private: + void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + monthCalendar1->RemoveAllBoldedDates(); + monthCalendar1->UpdateBoldedDates(); + listBox1->Items->Clear(); + button3->Enabled = false; + } + // + + // +private: + void setCalendarLook() + { + monthCalendar1->MinDate = DateTime::Parse( "1/1/1900" ); + monthCalendar1->MaxDate = DateTime::Parse( "12/31/2099" ); + checkBox1->Checked = true; + checkBox2->Checked = true; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp new file mode 100644 index 00000000000..5d23523538a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MoreEventArgsExamples/CPP/class1.cpp @@ -0,0 +1,59 @@ +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Drawing; +using namespace System::Drawing::Design; + +namespace MoreEventArgsExamples +{ + public ref class EventArgsCreators + { + // + public: + ResolveNameEventArgs^ CreateResolveNameEventArgs( Object^ value, String^ name ) + { + ResolveNameEventArgs^ e = gcnew ResolveNameEventArgs( name ); + // The name to resolve e.Name + // Stores an Object matching the name e.Value + return e; + } + // + + // + PaintValueEventArgs^ CreatePaintValueEventArgs( System::ComponentModel::ITypeDescriptorContext^ context, Object^ value, Graphics^ graphics, Rectangle bounds ) + { + PaintValueEventArgs^ e = gcnew PaintValueEventArgs( context, value, graphics, bounds ); + // The context of the paint value event e.Context + // The Object representing the value to paint e.Value + // The graphics to use to paint e.Graphics + // The rectangle in which to paint e.Bounds + return e; + } + // + + // + ToolboxComponentsCreatedEventArgs^ CreateToolboxComponentsCreatedEventArgs( array^components ) + { + ToolboxComponentsCreatedEventArgs^ e = gcnew ToolboxComponentsCreatedEventArgs( components ); + // The components that were just created e.Components + return e; + } + // + + // + ToolboxComponentsCreatingEventArgs^ CreateToolboxComponentsCreatingEventArgs( System::ComponentModel::Design::IDesignerHost^ host ) + { + ToolboxComponentsCreatingEventArgs^ e = gcnew ToolboxComponentsCreatingEventArgs( host ); + // The designer host of the document receiving the components e.DesignerHost + return e; + } + // + }; +} + +[STAThread] +int main(){} diff --git a/snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp new file mode 100644 index 00000000000..e7dfd73ef17 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MoreEventHandlerExamples/CPP/form1.cpp @@ -0,0 +1,105 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::ComponentModel::Design::Serialization; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Security::Permissions; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + +public: + Form1() + { + InitializeComponent(); + } + + // +public: + void LinkResolveNameEvent( IDesignerSerializationManager^ serializationManager ) + { + // Registers an event handler for the ResolveName event. + serializationManager->ResolveName += + gcnew ResolveNameEventHandler( this, &Form1::OnResolveName ); + } + +private: + void OnResolveName( Object^ sender, ResolveNameEventArgs^ e ) + { + // Displays ResolveName event information on the console. + Console::WriteLine( "Name of the name to resolve: " + e->Name ); + Console::WriteLine( "ToString output of the Object that no name was resolved for: " + + e->Value ); + } + // + + // +public: + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + void LinkToolboxComponentsCreatedEvent( ToolboxItem^ item ) + { + item->ComponentsCreated += + gcnew ToolboxComponentsCreatedEventHandler( this, &Form1::OnComponentsCreated ); + } + +private: + void OnComponentsCreated( Object^ sender, ToolboxComponentsCreatedEventArgs^ e ) + { + // Lists created components on the Console. + for ( int i = 0; i < e->Components->Length; i++ ) + { + Console::WriteLine( "Component #" + i + ": " + + e->Components[ i ]->Site->Name ); + } + } + // + + // +public: + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + void LinkToolboxComponentsCreatingEvent( ToolboxItem^ item ) + { + item->ComponentsCreating += + gcnew ToolboxComponentsCreatingEventHandler( this, &Form1::OnComponentsCreating ); + } + +private: + void OnComponentsCreating( Object^ sender, ToolboxComponentsCreatingEventArgs^ e ) + { + // Displays ComponentsCreating event information on the Console. + Console::WriteLine( "Name of the class of the root component of " + + "the designer host receiving new components: " + + e->DesignerHost->RootComponentClassName ); + } + // + + #pragma region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + #pragma endregion +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp new file mode 100644 index 00000000000..e7a40e7d3ef --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Multiline/CPP/form1.cpp @@ -0,0 +1,56 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + TabPage^ tabPage4; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + this->tabPage3 = gcnew TabPage; + this->tabPage4 = gcnew TabPage; + + // Allows more than one row of tabs. + this->tabControl1->Multiline = true; + this->tabControl1->Padding = Point(22,5); + array^tabControls = {this->tabPage1,this->tabPage2,this->tabPage3,this->tabPage4}; + this->tabControl1->Controls->AddRange( tabControls ); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + this->tabPage1->Text = "myTabPage1"; + this->tabPage2->Text = "myTabPage2"; + this->tabPage3->Text = "myTabPage3"; + this->tabPage4->Text = "myTabPage4"; + this->Size = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp new file mode 100644 index 00000000000..2eb8b3629e8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_FlatMode_ReadOnly/CPP/mydatagridclass_flatmode_readonly.cpp @@ -0,0 +1,213 @@ +// System::Windows::Forms::DataGrid::ReadOnlyChanged +// System::Windows::Forms::DataGrid::FlatModeChanged + +/* The following program demonstrates the methods 'ReadOnlyChanged' and +'FlatModeChanged' of the 'DataGrid' class. It creates a +'GridControl' and checks the properties 'ReadOnly' and 'FlatMode' +of data grid, depending on the selection of buttons. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyDataGridClass_FlatMode_ReadOnly: public Form +{ +private: + DataGrid^ myDataGrid; + Button^ button1; + Button^ button2; + DataSet^ myDataSet; + System::ComponentModel::Container^ components; + +public: + MyDataGridClass_FlatMode_ReadOnly() + { + components = nullptr; + InitializeComponent(); + SetUp(); + } + +public: + ~MyDataGridClass_FlatMode_ReadOnly() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->FormBorderStyle = ::FormBorderStyle::FixedDialog; + this->myDataGrid = gcnew DataGrid; + this->button1 = gcnew Button; + this->button2 = gcnew Button; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // myDataGrid + // + this->myDataGrid->CaptionText = "My Grid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->Location = Point(16,16); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->Size = System::Drawing::Size( 168, 112 ); + this->myDataGrid->TabIndex = 0; + AttachFlatModeChanged(); + AttachReadOnlyChanged(); + + // + // button1 + // + this->button1->Location = Point(24,160); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 72, 40 ); + this->button1->TabIndex = 1; + this->button1->Text = "Toggle Flat Mode"; + this->button1->Click += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::button1_Click ); + + // + // button2 + // + this->button2->Location = Point(96,160); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 72, 40 ); + this->button2->TabIndex = 1; + this->button2->Text = "Toggle Read Only"; + this->button2->Click += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::button2_Click ); + + // + // MyDataGridClass_FlatMode_ReadOnly + // + this->ClientSize = System::Drawing::Size( 208, 205 ); + array^temp0 = {this->button1,this->myDataGrid,this->button2}; + this->Controls->AddRange( temp0 ); + this->MaximizeBox = false; + this->Name = "MyDataGridClass_FlatMode_ReadOnly"; + this->Text = "Grid Control"; + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + } + + void MakeDataSet() + { + // Create a DataSet. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a DataTable. + DataTable^ myTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the table. + DataColumn^ myColumn1 = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ myColumn2 = gcnew DataColumn( "CustName" ); + myTable->Columns->Add( myColumn1 ); + myTable->Columns->Add( myColumn2 ); + + // Add the table to the DataSet. + myDataSet->Tables->Add( myTable ); + + // For the customer, create a 'DataRow' variable. + DataRow^ newRow; + + // Create one customer in the customers table. + for ( int i = 1; i < 2; i++ ) + { + newRow = myTable->NewRow(); + newRow[ "custID" ] = i; + + // Add the row to the 'Customers' table. + myTable->Rows->Add( newRow ); + } + myTable->Rows[ 0 ][ "custName" ] = "Customer"; + } + + // + // Attach to event handler. +private: + void AttachFlatModeChanged() + { + this->myDataGrid->FlatModeChanged += + gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_FlatModeChanged ); + } + + // Check if the 'FlatMode' property is changed. + void myDataGrid_FlatModeChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ strMessage = "false"; + if ( myDataGrid->FlatMode) + strMessage = "true"; + + MessageBox::Show( "Flat mode changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + + // Toggle the 'FlatMode'. + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGrid->FlatMode) + myDataGrid->FlatMode = false; + else + myDataGrid->FlatMode = true; + } + // + + // + // Attach to event handler. +private: + void AttachReadOnlyChanged() + { + this->myDataGrid->ReadOnlyChanged += gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_ReadOnlyChanged ); + } + + // Check if the 'ReadOnly' property is changed. + void myDataGrid_ReadOnlyChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ strMessage = "false"; + if ( myDataGrid->ReadOnly) + strMessage = "true"; + + MessageBox::Show( "Read only changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + + // Toggle the 'ReadOnly' property. + void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGrid->ReadOnly) + myDataGrid->ReadOnly = false; + else + myDataGrid->ReadOnly = true; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew MyDataGridClass_FlatMode_ReadOnly ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp new file mode 100644 index 00000000000..33010c1f4bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/MyDataGridClass_ResetHeaderBackColor/CPP/mydatagridclass_resetheaderbackcolor.cpp @@ -0,0 +1,385 @@ +// System::Windows::Forms::DataGrid::ResetHeaderBackColor +// System::Windows::Forms::DataGrid::ResetHeaderForeColor +// System::Windows::Forms::DataGrid::ResetHeaderFont +// System::Windows::Forms::DataGrid::Select +// System::Windows::Forms::DataGrid::IsSelected +// System::Windows::Forms::DataGrid::RowHeaderWidth + +/* The following program demonstrates various methods and properties of +the 'DataGrid' class. It creates a 'GridControl', changes the +header background color, header foreground color, header font +and resets them. It also selects a row, checks weather the row is selected +and checks the 'ReadOnly' and 'FlatMode' properties of the data grid. +Displays the 'RowHeaderWidth', depending on the selection of +buttons. +*/ + +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for MyDataGridClass_ResetHeaderBackColor. +/// +public ref class MyDataGridClass_ResetHeaderBackColor: public Form +{ +private: + DataGrid^ myDataGrid; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + Button^ button1; + Button^ button2; + Button^ button3; + Button^ button4; + Button^ button5; + Button^ button6; + Button^ button7; + Button^ button8; + DataSet^ myDataSet; + Button^ button9; + Button^ button11; + +public: + MyDataGridClass_ResetHeaderBackColor() + { + components = nullptr; + InitializeComponent(); + SetUp(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~MyDataGridClass_ResetHeaderBackColor() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->FormBorderStyle = ::FormBorderStyle::FixedDialog; + this->button8 = gcnew Button; + this->button9 = gcnew Button; + this->button11 = gcnew Button; + this->button4 = gcnew Button; + this->button5 = gcnew Button; + this->button6 = gcnew Button; + this->button7 = gcnew Button; + this->button1 = gcnew Button; + this->button2 = gcnew Button; + this->button3 = gcnew Button; + this->myDataGrid = gcnew DataGrid; + (dynamic_cast(this->myDataGrid))->BeginInit(); + this->SuspendLayout(); + + // + // button8 + // + this->button8->Location = Point(352,176); + this->button8->Name = "button8"; + this->button8->Size = System::Drawing::Size( 96, 40 ); + this->button8->TabIndex = 8; + this->button8->Text = "Display Status"; + this->button8->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button8_Click ); + + // + // button9 + // + this->button9->Location = Point(24,216); + this->button9->Name = "button9"; + this->button9->Size = System::Drawing::Size( 96, 40 ); + this->button9->TabIndex = 9; + this->button9->Text = "Get Row Header Width"; + this->button9->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button9_Click ); + + // + // button11 + // + this->button11->Location = Point(256,216); + this->button11->Name = "button11"; + this->button11->Size = System::Drawing::Size( 96, 40 ); + this->button11->TabIndex = 7; + this->button11->Text = "UnSelect Row"; + this->button11->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button11_Click ); + + // + // button4 + // + this->button4->Location = Point(352,72); + this->button4->Name = "button4"; + this->button4->Size = System::Drawing::Size( 96, 40 ); + this->button4->TabIndex = 4; + this->button4->Text = "Reset Header Fore Color"; + this->button4->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button4_Click ); + + // + // button5 + // + this->button5->Location = Point(352,128); + this->button5->Name = "button5"; + this->button5->Size = System::Drawing::Size( 96, 40 ); + this->button5->TabIndex = 5; + this->button5->Text = "Reset Header Font"; + this->button5->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button5_Click ); + + // + // button6 + // + this->button6->Location = Point(256,128); + this->button6->Name = "button6"; + this->button6->Size = System::Drawing::Size( 96, 40 ); + this->button6->TabIndex = 6; + this->button6->Text = "Change Header Font"; + this->button6->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button6_Click ); + + // + // button7 + // + this->button7->Location = Point(256,176); + this->button7->Name = "button7"; + this->button7->Size = System::Drawing::Size( 96, 40 ); + this->button7->TabIndex = 7; + this->button7->Text = "Select Row"; + this->button7->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button7_Click ); + + // + // button1 + // + this->button1->Location = Point(256,24); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 96, 40 ); + this->button1->TabIndex = 1; + this->button1->Text = "Change Header Back Color"; + this->button1->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button1_Click ); + + // + // button2 + // + this->button2->Location = Point(352,24); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 96, 40 ); + this->button2->TabIndex = 2; + this->button2->Text = "Reset Header Back Color"; + this->button2->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button2_Click ); + + // + // button3 + // + this->button3->Location = Point(256,72); + this->button3->Name = "button3"; + this->button3->Size = System::Drawing::Size( 96, 40 ); + this->button3->TabIndex = 3; + this->button3->Text = "Change Header Fore Color"; + this->button3->Click += gcnew EventHandler( this, &MyDataGridClass_ResetHeaderBackColor::button3_Click ); + + // + // myDataGrid + // + this->myDataGrid->CaptionText = "My Grid Control"; + this->myDataGrid->DataMember = ""; + this->myDataGrid->Location = Point(8,32); + this->myDataGrid->Name = "myDataGrid"; + this->myDataGrid->RowHeaderWidth = 50; + this->myDataGrid->Size = System::Drawing::Size( 216, 152 ); + this->myDataGrid->TabIndex = 0; + + // + // MyDataGridClass_ResetHeaderBackColor + // + this->AutoScale = false; + this->ClientSize = System::Drawing::Size( 528, 273 ); + array^temp0 = {this->button9,this->button8,this->button7,this->button6,this->button5,this->button4,this->button3,this->button2,this->button1,this->myDataGrid,this->button11}; + this->Controls->AddRange( temp0 ); + this->MaximizeBox = false; + this->Name = "MyDataGridClass_ResetHeaderBackColor"; + this->Text = "Grid Control"; + (dynamic_cast(this->myDataGrid))->EndInit(); + this->ResumeLayout( false ); + } + + void SetUp() + { + MakeDataSet(); + myDataGrid->SetDataBinding( myDataSet, "Customers" ); + myDataGrid->ReadOnly = true; + } + + void MakeDataSet() + { + // Create a 'DataSet'. + myDataSet = gcnew DataSet( "myDataSet" ); + + // Create a 'DataTable'. + DataTable^ myTable = gcnew DataTable( "Customers" ); + + // Create two columns, and add them to the table. + DataColumn^ myColumn1 = gcnew DataColumn( "CustID",int::typeid ); + DataColumn^ myColumn2 = gcnew DataColumn( "CustName" ); + myTable->Columns->Add( myColumn1 ); + myTable->Columns->Add( myColumn2 ); + + // Add the table to the 'DataSet'. + myDataSet->Tables->Add( myTable ); + + // For the customer, create a 'DataRow' variable. + DataRow^ newRow; + + // Create one customer in the customers table. + for ( int i = 1; i < 2; i++ ) + { + newRow = myTable->NewRow(); + newRow[ "custID" ] = i; + + // Add the row to the 'Customers' table. + myTable->Rows->Add( newRow ); + } + myTable->Rows[ 0 ][ "custName" ] = "Customer"; + } + + // +private: + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Enable the help button. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->HeaderBackColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set the header background color. + myDataGrid->HeaderBackColor = myColorDialog->Color; + } + + // Reset the header background color. + void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGrid->ResetHeaderBackColor(); + } + // + + // +private: + void button3_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + ColorDialog^ myColorDialog = gcnew ColorDialog; + + // Disable selecting a custom color. + myColorDialog->AllowFullOpen = false; + + // Enable the help button. + myColorDialog->ShowHelp = true; + + // Set the initial color to the current color. + myColorDialog->Color = myDataGrid->HeaderForeColor; + + // Show color dialog box. + myColorDialog->ShowDialog(); + + // Set the header foreground color. + myDataGrid->HeaderForeColor = myColorDialog->Color; + } + + // Reset the header foregroundcolor. + void button4_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGrid->ResetHeaderForeColor(); + } + // + + // +private: + // Set the header font to Arial with size 20. + void button6_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGrid->HeaderFont = gcnew System::Drawing::Font( "Arial",20 ); + } + + // Reset the header font. + void button5_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGrid->ResetHeaderFont(); + } + // + + // + // Select the first row. +private: + void button7_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGrid->Select(0); + } + + // + // Check if the first row is selected. +private: + void button8_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( myDataGrid->IsSelected( 0 ) ) + { + MessageBox::Show( "Row selected", "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + else + { + MessageBox::Show( "Row not selected", "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + } + + // Deselect the first row. + void button11_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myDataGrid->UnSelect( 0 ); + } + // + // + + // + // Get the width of row header. +private: + void button9_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Int32 myRowHeaderWidth = myDataGrid->RowHeaderWidth; + MessageBox::Show( String::Concat( "Width of row headers is: ", myRowHeaderWidth ), "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew MyDataGridClass_ResetHeaderBackColor ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp new file mode 100644 index 00000000000..f6ee8d638e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/NativeWindow/CPP/form1.cpp @@ -0,0 +1,165 @@ + + +#using +#using +#using + +// +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Runtime::InteropServices; +ref class MyNativeWindowListener; +ref class MyNativeWindow; + +// Summary description for Form1. +ref class Form1: public System::Windows::Forms::Form +{ +private: + MyNativeWindowListener^ nwl; + MyNativeWindow^ nw; + +internal: + void ApplicationActived( bool ApplicationActivated ) + { + // The application has been activated or deactivated + #if defined(DEBUG) + System::Diagnostics::Debug::WriteLine( "Application Active = {0}", ApplicationActivated.ToString() ); + #endif + } + + +public: + Form1(); +}; + +// +// NativeWindow class to listen to operating system messages. +ref class MyNativeWindowListener: public NativeWindow +{ +private: + + // Constant value was found in the S"windows.h" header file. + literal int WM_ACTIVATEAPP = 0x001C; + Form1^ parent; + +public: + MyNativeWindowListener( Form1^ parent ) + { + parent->HandleCreated += gcnew EventHandler( this, &MyNativeWindowListener::OnHandleCreated ); + parent->HandleDestroyed += gcnew EventHandler( this, &MyNativeWindowListener::OnHandleDestroyed ); + this->parent = parent; + } + +internal: + + // Listen for the control's window creation and then hook into it. + void OnHandleCreated( Object^ sender, EventArgs^ /*e*/ ) + { + // Window is now created, assign handle to NativeWindow. + AssignHandle( (dynamic_cast(sender))->Handle ); + } + + void OnHandleDestroyed( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Window was destroyed, release hook. + ReleaseHandle(); + } + +protected: + + virtual void WndProc( Message %m ) override + { + // Listen for operating system messages + switch ( m.Msg ) + { + case WM_ACTIVATEAPP: + + // Notify the form that this message was received. + // Application is activated or deactivated, + // based upon the WParam parameter. + parent->ApplicationActived( ((int)m.WParam != 0) ); + break; + } + NativeWindow::WndProc( m ); + } + +}; +// + +// +// MyNativeWindow class to create a window given a class name. +ref class MyNativeWindow: public NativeWindow +{ +private: + + // Constant values were found in the S"windows.h" header file. + literal int WS_CHILD = 0x40000000,WS_VISIBLE = 0x10000000,WM_ACTIVATEAPP = 0x001C; + int windowHandle; + +public: + MyNativeWindow( Form^ parent ) + { + CreateParams^ cp = gcnew CreateParams; + + // Fill in the CreateParams details. + cp->Caption = "Click here"; + cp->ClassName = "Button"; + + // Set the position on the form + cp->X = 100; + cp->Y = 100; + cp->Height = 100; + cp->Width = 100; + + // Specify the form as the parent. + cp->Parent = parent->Handle; + + // Create as a child of the specified parent + cp->Style = WS_CHILD | WS_VISIBLE; + + // Create the actual window + this->CreateHandle( cp ); + } + +protected: + + // Listen to when the handle changes to keep the variable in sync + + virtual void OnHandleChange() override + { + windowHandle = (int)this->Handle; + } + + virtual void WndProc( Message % m ) override + { + // Listen for messages that are sent to the button window. Some messages are sent + // to the parent window instead of the button's window. + switch ( m.Msg ) + { + case WM_ACTIVATEAPP: + + // Do something here in response to messages + break; + } + NativeWindow::WndProc( m ); + } +}; +// + +Form1::Form1() +{ + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + nwl = gcnew MyNativeWindowListener( this ); + nw = gcnew MyNativeWindow( this ); +} + +// The main entry point for the application. + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp new file mode 100644 index 00000000000..4e87c4fa2c1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/OwnerDraw example/CPP/form1.cpp @@ -0,0 +1,163 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::MainMenu^ mainMenu1; + System::Windows::Forms::MenuItem^ menuItem1; + System::Windows::Forms::MenuItem^ menuItem2; + System::Windows::Forms::MenuItem^ menuItem3; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // Create the menu. + CreateMyMenu(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + void CreateMyMenu() + { + this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->menuItem1 = gcnew System::Windows::Forms::MenuItem; + this->menuItem2 = gcnew System::Windows::Forms::MenuItem; + this->menuItem3 = gcnew System::Windows::Forms::MenuItem; + + // + // + // mainMenu1 + // + array^temp0 = {this->menuItem1}; + this->mainMenu1->MenuItems->AddRange( temp0 ); + array^temp1 = {this->menuItem2}; + this->mainMenu1->MenuItems->AddRange( temp1 ); + array^temp2 = {this->menuItem3}; + this->mainMenu1->MenuItems->AddRange( temp2 ); + + // + // menuItem1 + // + this->menuItem1->Index = 0; + this->menuItem1->OwnerDraw = true; + this->menuItem1->Text = ""; + this->menuItem1->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::menuItem1_DrawItem ); + + // + // menuItem2 + // + this->menuItem2->Index = 1; + this->menuItem2->OwnerDraw = true; + this->menuItem2->Text = ""; + this->menuItem2->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::menuItem2_DrawItem ); + + // + // menuItem3 + // + this->menuItem3->Index = 2; + this->menuItem3->OwnerDraw = true; + this->menuItem3->Text = ""; + this->menuItem3->DrawItem += gcnew System::Windows::Forms::DrawItemEventHandler( this, &Form1::menuItem3_DrawItem ); + this->Menu = this->mainMenu1; + } + + // + // The DrawItem event handler. +private: + void menuItem1_DrawItem( Object^ /*sender*/, System::Windows::Forms::DrawItemEventArgs^ e ) + { + String^ myCaption = "Owner Draw Item1"; + + // Create a Brush and a Font with which to draw the item. + Brush^ myBrush = System::Drawing::Brushes::AliceBlue; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSerif,14,FontStyle::Underline,GraphicsUnit::Pixel ); + SizeF mySizeF = e->Graphics->MeasureString( myCaption, myFont ); + + // Draw the item, and then draw a Rectangle around it. + e->Graphics->DrawString( myCaption, myFont, myBrush, (float)e->Bounds.X, (float)e->Bounds.Y ); + e->Graphics->DrawRectangle( Pens::Black, Rectangle(e->Bounds.X,e->Bounds.Y,Convert::ToInt32( mySizeF.Width ),Convert::ToInt32( mySizeF.Height )) ); + } + // + + void menuItem2_DrawItem( Object^ /*sender*/, System::Windows::Forms::DrawItemEventArgs^ e ) + { + String^ myCaption = "Owner Draw Item2"; + Brush^ myBrush = System::Drawing::Brushes::AliceBlue; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSerif,14,FontStyle::Underline,GraphicsUnit::Pixel ); + SizeF mySizeF = e->Graphics->MeasureString( myCaption, myFont ); + e->Graphics->DrawString( myCaption, myFont, myBrush, (float)e->Bounds.X, (float)e->Bounds.Y + 20 ); + e->Graphics->DrawRectangle( Pens::Black, Rectangle(e->Bounds.X,e->Bounds.Y + 20,Convert::ToInt32( mySizeF.Width ),Convert::ToInt32( mySizeF.Height )) ); + } + + void menuItem3_DrawItem( Object^ /*sender*/, System::Windows::Forms::DrawItemEventArgs^ e ) + { + String^ myCaption = "Owner Draw Item3"; + Brush^ myBrush = System::Drawing::Brushes::AliceBlue; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSerif,14,FontStyle::Underline,GraphicsUnit::Pixel ); + SizeF mySizeF = e->Graphics->MeasureString( myCaption, myFont ); + e->Graphics->DrawString( myCaption, myFont, myBrush, (float)e->Bounds.X, (float)e->Bounds.Y + 40 ); + e->Graphics->DrawRectangle( Pens::Black, Rectangle(e->Bounds.X,e->Bounds.Y + 40,Convert::ToInt32( mySizeF.Width ),Convert::ToInt32( mySizeF.Height )) ); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp new file mode 100644 index 00000000000..108cf013b06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Padding/CPP/form1.cpp @@ -0,0 +1,50 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + this->tabControl1->Multiline = true; + array^temp0 = {this->tabPage1,this->tabPage2}; + this->tabControl1->Controls->AddRange( temp0 ); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + + // Creates a cushion of 22 pixels around TabPage.Text strings. + this->tabControl1->Padding = System::Drawing::Point( 22, 22 ); + this->tabPage1->Text = "myTabPage1"; + this->tabPage2->Text = "myTabPage2"; + this->Size = System::Drawing::Size( 300, 300 ); + array^temp1 = {this->tabControl1}; + this->Controls->AddRange( temp1 ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp new file mode 100644 index 00000000000..503e9276d13 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/PaperSource and PaperSize Example with Resolution/CPP/source.cpp @@ -0,0 +1,338 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Drawing::Printing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace WindowsApplication3 +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + + // my vars + PrintDocument^ printDoc; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::Button^ MyButtonPrint; + System::Windows::Forms::ComboBox^ comboPaperSize; + System::Windows::Forms::ComboBox^ comboPaperSource; + System::Windows::Forms::ComboBox^ comboPrintResolution; + System::Windows::Forms::ComboBox^ comboInstalledPrinters; + System::Windows::Forms::Label ^ label4; + System::ComponentModel::Container^ components; + + public: + Form1() + { + // + // Required for Windows Form Designer support + // + printDoc = gcnew PrintDocument; + components = nullptr; + currentPageNumber = 1; + InitializeComponent(); + + // Setup the event handlers + printDoc->QueryPageSettings += gcnew QueryPageSettingsEventHandler( this, &Form1::MyPrintQueryPageSettingsEvent ); + printDoc->PrintPage += gcnew PrintPageEventHandler( this, &Form1::MyPrintPageEvent ); + + /* // Other way to specify custom paper size is to set the paper kind and related properties. + PaperSize* pkCustomSize2 = new PaperSize(); + pkCustomSize2.Kind = PaperSourceKind::Custom; + pkCustomSize2.PaperName = S"Other custom size"; + pkCustomSize2.Width = 100; + pkCustomSize2.Height = 200; + + comboPaperSize.Items->Add(pkCustomSize2); + + */ + + // + // Add list of supported paper sizes found on the printer. + // The DisplayMember property is used to identify the property that will provide the display String*. + comboPaperSize->DisplayMember = "PaperName"; + PaperSize^ pkSize; + for ( int i = 0; i < printDoc->PrinterSettings->PaperSizes->Count; i++ ) + { + pkSize = printDoc->PrinterSettings->PaperSizes[ i ]; + comboPaperSize->Items->Add( pkSize ); + } + + // Create a PaperSize and specify the custom paper size through the constructor and add to combobox. + PaperSize^ pkCustomSize1 = gcnew PaperSize( "First custom size",100,200 ); + comboPaperSize->Items->Add( pkCustomSize1 ); + // + + // + // Add list of paper sources found on the printer to the combo box. + // The DisplayMember property is used to identify the property that will provide the display String*. + comboPaperSource->DisplayMember = "SourceName"; + PaperSource^ pkSource; + for ( int i = 0; i < printDoc->PrinterSettings->PaperSources->Count; i++ ) + { + pkSource = printDoc->PrinterSettings->PaperSources[ i ]; + comboPaperSource->Items->Add( pkSource ); + } + // + + // + // Add list of printer resolutions found on the printer to the combobox. + // The PrinterResolution's ToString() method will be used to provide the display String. + PrinterResolution^ pkResolution; + for ( int i = 0; i < printDoc->PrinterSettings->PrinterResolutions->Count; i++ ) + { + pkResolution = printDoc->PrinterSettings->PrinterResolutions[ i ]; + comboPrintResolution->Items->Add( pkResolution ); + } + // + + PopulateInstalledPrintersCombo(); + } + + // + private: + void PopulateInstalledPrintersCombo() + { + // Add list of installed printers found to the combo box. + // The pkInstalledPrinters String will be used to provide the display String. + String^ pkInstalledPrinters; + for ( int i = 0; i < PrinterSettings::InstalledPrinters->Count; i++ ) + { + pkInstalledPrinters = PrinterSettings::InstalledPrinters[ i ]; + comboInstalledPrinters->Items->Add( pkInstalledPrinters ); + } + } + + void comboInstalledPrinters_SelectionChanged( Object^ sender, System::EventArgs^ e ) + { + // Set the printer to a printer in the combo box when the selection changes. + if ( comboInstalledPrinters->SelectedIndex != -1 ) + { + // The combo box's Text property returns the selected item's text, which is the printer name. + printDoc->PrinterSettings->PrinterName = comboInstalledPrinters->Text; + } + } + // + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->comboPrintResolution = gcnew System::Windows::Forms::ComboBox; + this->label4 = gcnew System::Windows::Forms::Label; + this->comboInstalledPrinters = gcnew System::Windows::Forms::ComboBox; + this->label1 = gcnew System::Windows::Forms::Label; + this->label3 = gcnew System::Windows::Forms::Label; + this->comboPaperSize = gcnew System::Windows::Forms::ComboBox; + this->comboPaperSource = gcnew System::Windows::Forms::ComboBox; + this->label2 = gcnew System::Windows::Forms::Label; + this->MyButtonPrint = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // comboPrintResolution + // + this->comboPrintResolution->DropDownWidth = 121; + this->comboPrintResolution->Location = System::Drawing::Point( 104, 72 ); + this->comboPrintResolution->Name = "comboPrintResolution"; + this->comboPrintResolution->Size = System::Drawing::Size( 121, 21 ); + this->comboPrintResolution->TabIndex = 3; + + // + // label4 + // + this->label4->Location = System::Drawing::Point( 8, 104 ); + this->label4->Name = "label4"; + this->label4->TabIndex = 4; + this->label4->Text = "Installed Printers"; + + // + // comboInstalledPrinters + // + this->comboInstalledPrinters->DropDownWidth = 120; + this->comboInstalledPrinters->Location = System::Drawing::Point( 104, 104 ); + this->comboInstalledPrinters->Name = "comboInstalledPrinters"; + this->comboInstalledPrinters->Size = System::Drawing::Size( 120, 21 ); + this->comboInstalledPrinters->TabIndex = 5; + this->comboInstalledPrinters->SelectedIndexChanged += + gcnew System::EventHandler( this, &Form1::comboInstalledPrinters_SelectionChanged ); + + // + // label1 + // + this->label1->FlatStyle = System::Windows::Forms::FlatStyle::System; + this->label1->Location = System::Drawing::Point( 8, 13 ); + this->label1->Name = "label1"; + this->label1->Size = System::Drawing::Size( 56, 16 ); + this->label1->TabIndex = 1; + this->label1->Text = "Paper Sizes"; + + // + // label3 + // + this->label3->Location = System::Drawing::Point( 8, 72 ); + this->label3->Name = "label3"; + this->label3->TabIndex = 4; + this->label3->Text = "Printer Resolution"; + + // + // comboPaperSize + // + this->comboPaperSize->DropDownWidth = 121; + this->comboPaperSize->Location = System::Drawing::Point( 80, 8 ); + this->comboPaperSize->Name = "comboPaperSize"; + this->comboPaperSize->Size = System::Drawing::Size( 121, 21 ); + this->comboPaperSize->TabIndex = 0; + + // + // comboPaperSource + // + this->comboPaperSource->DropDownWidth = 121; + this->comboPaperSource->Location = System::Drawing::Point( 80, 40 ); + this->comboPaperSource->Name = "comboPaperSource"; + this->comboPaperSource->Size = System::Drawing::Size( 121, 21 ); + this->comboPaperSource->TabIndex = 0; + + // + // label2 + // + this->label2->FlatStyle = System::Windows::Forms::FlatStyle::System; + this->label2->Location = System::Drawing::Point( 8, 45 ); + this->label2->Name = "label2"; + this->label2->Size = System::Drawing::Size( 72, 16 ); + this->label2->TabIndex = 1; + this->label2->Text = "Paper Source"; + + // + // MyButtonPrint + // + this->MyButtonPrint->Location = System::Drawing::Point( 208, 8 ); + this->MyButtonPrint->Name = "MyButtonPrint"; + this->MyButtonPrint->TabIndex = 2; + this->MyButtonPrint->Text = "Print"; + this->MyButtonPrint->Click += gcnew System::EventHandler( this, &Form1::MyButtonPrint_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 133 ); + array^temp0 = {this->comboInstalledPrinters,this->comboPrintResolution,this->label3,this->comboPaperSource,this->MyButtonPrint,this->label1,this->comboPaperSize,this->label2,this->label4}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + private: + void MyButtonPrint_Click( Object^ sender, System::EventArgs^ e ) + { + // Set the paper size based upon the selection in the combo box. + if ( comboPaperSize->SelectedIndex != -1 ) + { + printDoc->DefaultPageSettings->PaperSize = printDoc->PrinterSettings->PaperSizes[ comboPaperSize->SelectedIndex ]; + } + + // Set the paper source based upon the selection in the combo box. + if ( comboPaperSource->SelectedIndex != -1 ) + { + printDoc->DefaultPageSettings->PaperSource = printDoc->PrinterSettings->PaperSources[ comboPaperSource->SelectedIndex ]; + } + + // Set the printer resolution based upon the selection in the combo box. + if ( comboPrintResolution->SelectedIndex != -1 ) + { + printDoc->DefaultPageSettings->PrinterResolution = printDoc->PrinterSettings->PrinterResolutions[ comboPrintResolution->SelectedIndex ]; + } + + // Print the document with the specified paper size, source, and print resolution. + printDoc->Print(); + } + // + + protected: + int currentPageNumber; + + // + private: + void MyButtonPrint_OnClick( Object^ sender, System::EventArgs^ e ) + { + // Set the printer name and ensure it is valid. If not, provide a message to the user. + printDoc->PrinterSettings->PrinterName = "\\mynetworkprinter"; + if ( printDoc->PrinterSettings->IsValid ) + { + // If the printer supports printing in color, then override the printer's default behavior. + if ( printDoc->PrinterSettings->SupportsColor ) + { + // Set the page default's to not print in color. + printDoc->DefaultPageSettings->Color = false; + } + + // Provide a friendly name, set the page number, and print the document. + printDoc->DocumentName = "My Presentation"; + currentPageNumber = 1; + printDoc->Print(); + } + else + { + MessageBox::Show( "Printer is not valid" ); + } + } + + void MyPrintQueryPageSettingsEvent( Object^ sender, QueryPageSettingsEventArgs^ e ) + { + // Determines if the printer supports printing in color. + if ( printDoc->PrinterSettings->SupportsColor ) + { + // If the printer supports color printing, use color. + if ( currentPageNumber == 1 ) + { + e->PageSettings->Color = true; + } + } + } + // + + void MyPrintPageEvent( Object^ sender, PrintPageEventArgs^ e ){} + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew WindowsApplication3::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp new file mode 100644 index 00000000000..b78a17d842f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form1.cpp @@ -0,0 +1,117 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::MdiClient^ mdiClient1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->mdiClient1 = gcnew System::Windows::Forms::MdiClient; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // mdiClient1 + // + this->mdiClient1->Dock = System::Windows::Forms::DockStyle::Fill; + this->mdiClient1->Name = "mdiClient1"; + this->mdiClient1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 16, 16 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 80, 24 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 568, 368 ); + array^formControls = {this->button1,this->mdiClient1}; + this->Controls->AddRange( formControls ); + this->IsMdiContainer = true; + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // + // The event handler on Form1. +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create an instance of Form2. + Form1^ f2 = gcnew Form2; + + // Make this form the parent of f2. + f2->MdiParent = this; + + // Display the form. + f2->Show(); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp b/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp new file mode 100644 index 00000000000..d7a5266cb26 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ParentForm2/CPP/form2.cpp @@ -0,0 +1,91 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +/// +/// Summary description for Form2. +/// +public ref class Form2: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form2() + { + components = nullptr; + InitializeComponent(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form2() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 160, 176 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 80, 24 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form2::button1_Click ); + + // + // Form2 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + array^formControls = {this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "Form2"; + this->Text = "Form2"; + this->Load += gcnew System::EventHandler( this, &Form2::Form2_Load ); + this->ResumeLayout( false ); + } + + // + // The event handler on Form2. +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Get the Name property of the Parent. + String^ s = ParentForm->Name; + + // Display the name in a message box. + MessageBox::Show( String::Concat( "My Parent is ", s, "." ) ); + } + // + + void Form2_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp new file mode 100644 index 00000000000..1c513c1da57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ParentMenu/CPP/form1.cpp @@ -0,0 +1,106 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + InitializeComponent(); + CreateMyMenuItems(); + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +public: + void CreateMyMenuItems() + { + // Craete a main menu object. + MainMenu^ mainMenu1 = gcnew MainMenu; + + // Create three top-level menu items. + MenuItem^ menuItem1 = gcnew MenuItem( "&File" ); + MenuItem^ menuItem2 = gcnew MenuItem( "&New" ); + MenuItem^ menuItem3 = gcnew MenuItem( "&Open" ); + + // Add menuItem1 to the main menu. + mainMenu1->MenuItems->Add( menuItem1 ); + + // Add menuItem2 and menuItem3 to menuItem1. + menuItem1->MenuItems->Add( menuItem2 ); + menuItem1->MenuItems->Add( menuItem3 ); + + // Check to see if menuItem3 has a parent menu. + if ( menuItem3->Parent != nullptr ) + MessageBox::Show( String::Concat( menuItem3->Parent, "." ), "Parent Menu Information of menuItem3" ); + else + MessageBox::Show( "No parent menu." ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + } + // + +private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp new file mode 100644 index 00000000000..75f43115eb2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/PerformClick/CPP/form1.cpp @@ -0,0 +1,116 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + InitializeComponent(); + CreateMyMenu(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + /// + // +public: + void CreateMyMenu() + { + // Create a main menu object. + MainMenu^ mainMenu1 = gcnew MainMenu; + + // Create empty menu item objects. + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + + // Set the caption of the menu items. + menuItem1->Text = "&File"; + menuItem2->Text = "&Edit"; + + // Add the menu items to the main menu. + mainMenu1->MenuItems->Add( menuItem1 ); + mainMenu1->MenuItems->Add( menuItem2 ); + + // Add functionality to the menu items. + menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); + menuItem2->Click += gcnew System::EventHandler( this, &Form1::menuItem2_Click ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + + // Perform a click on the File menu item. + menuItem1->PerformClick(); + } + +private: + void menuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "You clicked the File menu.", "The Event Information" ); + } + + void menuItem2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "You clicked the Edit menu.", "The Event Information" ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp new file mode 100644 index 00000000000..bb8f4cf2a57 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/PerformSelect/CPP/form1.cpp @@ -0,0 +1,116 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + InitializeComponent(); + CreateMyMenu(); + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +public: + void CreateMyMenu() + { + // Create a main menu objects. + MainMenu^ mainMenu1 = gcnew MainMenu; + + // Create empty menu item objects. + MenuItem^ menuItem1 = gcnew MenuItem; + MenuItem^ menuItem2 = gcnew MenuItem; + + // Set the caption of the menu items. + menuItem1->Text = "&File"; + menuItem2->Text = "&Edit"; + + // Add the menu items to the main menu. + mainMenu1->MenuItems->Add( menuItem1 ); + mainMenu1->MenuItems->Add( menuItem2 ); + + // Add functionality to the menu items. + menuItem1->Select += gcnew System::EventHandler( this, &Form1::menuItem1_Select ); + menuItem2->Select += gcnew System::EventHandler( this, &Form1::menuItem2_Select ); + + // Assign mainMenu1 to the form. + this->Menu = mainMenu1; + + // Select the File menu item. + menuItem1->PerformSelect(); + } + +private: + void menuItem1_Select( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "You selected the File menu.", "The Event Information" ); + } + + void menuItem2_Select( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "You selected the Edit menu.", "The Event Information" ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp b/snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp new file mode 100644 index 00000000000..293ecd3b156 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/PowerStatusBrowser/CPP/powerstatusbrowser.cpp @@ -0,0 +1,92 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Reflection; +using namespace System::Windows::Forms; + +public ref class PowerStatusBrowserForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::TextBox^ textBox1; + +public: + PowerStatusBrowserForm() + { + this->SuspendLayout(); + InitForm(); + + //Add each property of the PowerStatus class to the list box. + Type^ t = System::Windows::Forms::PowerStatus::typeid; + array^pi = t->GetProperties(); + for ( int i = 0; i < pi->Length; i++ ) + listBox1->Items->Add( pi[ i ]->Name ); + textBox1->Text = String::Format( "The PowerStatus class has {0} properties.\r\n", pi->Length ); + + // Configure the list item selected handler for the list box to invoke a + // method that displays the value of each property. + listBox1->SelectedIndexChanged += gcnew EventHandler( this, &PowerStatusBrowserForm::listBox1_SelectedIndexChanged ); + this->ResumeLayout( false ); + } + +private: + void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Return if no item is selected. + if ( listBox1->SelectedIndex == -1 ) + return; + + // Get the property name from the list item + String^ propname = listBox1->Text; + + // Display the value of the selected property of the PowerStatus type. + Type^ t = System::Windows::Forms::PowerStatus::typeid; + array^pi = t->GetProperties(); + PropertyInfo^ prop = nullptr; + for ( int i = 0; i < pi->Length; i++ ) + if ( pi[ i ]->Name == propname ) + { + prop = pi[ i ]; + break; + } + + Object^ propval = prop->GetValue( SystemInformation::PowerStatus, nullptr ); + textBox1->Text = String::Format( "{0}\r\nThe value of the {1} property is: {2}", textBox1->Text, propname, propval ); + } + + void InitForm() + { + // Initialize the form settings + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->listBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->listBox1->Location = System::Drawing::Point( 8, 16 ); + this->listBox1->Size = System::Drawing::Size( 172, 496 ); + this->listBox1->TabIndex = 0; + this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->textBox1->Location = System::Drawing::Point( 188, 16 ); + this->textBox1->Multiline = true; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->textBox1->Size = System::Drawing::Size( 420, 496 ); + this->textBox1->TabIndex = 1; + this->ClientSize = System::Drawing::Size( 616, 525 ); + this->Controls->Add( this->textBox1 ); + this->Controls->Add( this->listBox1 ); + this->Text = "Select a PowerStatus property to get the value of"; + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew PowerStatusBrowserForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp new file mode 100644 index 00000000000..d5e993a21b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ProgressBar.Increment/CPP/form1.cpp @@ -0,0 +1,168 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ProgressBar^ progressBar1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::StatusBar^ statusBar1; + System::Windows::Forms::StatusBarPanel^ statusBarPanel1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + time = gcnew Timer; + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->progressBar1 = gcnew System::Windows::Forms::ProgressBar; + this->button1 = gcnew System::Windows::Forms::Button; + this->statusBar1 = gcnew System::Windows::Forms::StatusBar; + this->statusBarPanel1 = gcnew System::Windows::Forms::StatusBarPanel; + (dynamic_cast(this->statusBarPanel1))->BeginInit(); + this->SuspendLayout(); + + // + // progressBar1 + // + this->progressBar1->Location = System::Drawing::Point( 24, 24 ); + this->progressBar1->Name = "progressBar1"; + this->progressBar1->Size = System::Drawing::Size( 192, 24 ); + this->progressBar1->Step = 1; + this->progressBar1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 224, 24 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // statusBar1 + // + this->statusBar1->Location = System::Drawing::Point( 0, 272 ); + this->statusBar1->Name = "statusBar1"; + array^temp0 = {this->statusBarPanel1}; + this->statusBar1->Panels->AddRange( temp0 ); + this->statusBar1->ShowPanels = true; + this->statusBar1->Size = System::Drawing::Size( 368, 22 ); + this->statusBar1->TabIndex = 2; + this->statusBar1->Text = "statusBar1"; + + // + // statusBarPanel1 + // + this->statusBarPanel1->AutoSize = System::Windows::Forms::StatusBarPanelAutoSize::Spring; + this->statusBarPanel1->Text = "Ready"; + this->statusBarPanel1->Width = 352; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 368, 294 ); + array^temp1 = {this->statusBar1,this->button1,this->progressBar1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + (dynamic_cast(this->statusBarPanel1))->EndInit(); + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + InitializeMyTimer(); + } + + // +private: + Timer^ time; + + // Call this method from the constructor of the form. + void InitializeMyTimer() + { + // Set the interval for the timer. + time->Interval = 250; + + // Connect the Tick event of the timer to its event handler. + time->Tick += gcnew EventHandler( this, &Form1::IncreaseProgressBar ); + + // Start the timer. + time->Start(); + } + + void IncreaseProgressBar( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Increment the value of the ProgressBar a value of one each time. + progressBar1->Increment( 1 ); + + // Display the textual value of the ProgressBar in the StatusBar control's first panel. + statusBarPanel1->Text = String::Concat( progressBar1->Value, "% Completed" ); + + // Determine if we have completed by comparing the value of the Value property to the Maximum value. + if ( progressBar1->Value == progressBar1->Maximum ) + + // Stop the timer. + time->Stop(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp new file mode 100644 index 00000000000..b7cf840a387 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ProgressBarOverview/CPP/form1.cpp @@ -0,0 +1,151 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + System::Windows::Forms::Button^ button1; + ProgressBar^ pBar1; + +public: + Form1() + { + components = nullptr; + pBar1 = gcnew ProgressBar; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + pBar1->Bounds = Rectangle(10,50,200,20); + this->Controls->Add( pBar1 ); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +private: + bool CopyFile( String^ filename ) + { + #if defined(DEBUG) + System::Diagnostics::Debug::WriteLine( "File Being Copied = {0}", filename ); + #endif + return true; + } + + // +private: + void CopyWithProgress( array^filenames ) + { + // Display the ProgressBar control. + pBar1->Visible = true; + + // Set Minimum to 1 to represent the first file being copied. + pBar1->Minimum = 1; + + // Set Maximum to the total number of files to copy. + pBar1->Maximum = filenames->Length; + + // Set the initial value of the ProgressBar. + pBar1->Value = 1; + + // Set the Step property to a value of 1 to represent each file being copied. + pBar1->Step = 1; + + // Loop through all files to copy. + for ( int x = 1; x <= filenames->Length; x++ ) + { + // Copy the file and increment the ProgressBar if successful. + if ( CopyFile( filenames[ x - 1 ] )) + { + // Perform the increment on the ProgressBar. + pBar1->PerformStep(); + } + } + } + // + +protected: + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 288, 72 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 120, 16 ); + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 472, 398 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + array^tempFiles = gcnew array(5); + tempFiles[ 0 ] = "file1.txt"; + tempFiles[ 1 ] = "file2.txt"; + tempFiles[ 2 ] = "file3.txt"; + tempFiles[ 3 ] = "file4.txt"; + tempFiles[ 4 ] = "file5.txt"; + CopyWithProgress( tempFiles ); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp b/snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp new file mode 100644 index 00000000000..69d2b3c9ade --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/PropertyDescriptor/CPP/propertydescriptor.cpp @@ -0,0 +1,121 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 120, 16 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->textBox1->Size = System::Drawing::Size( 288, 272 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 40, 112 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 448, 333 ); + array^temp0 = {this->button1,this->textBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + // Creates a new collection and assign it the properties for button1. + PropertyDescriptorCollection^ properties = TypeDescriptor::GetProperties( button1 ); + + // Sets an PropertyDescriptor to the specific property. + System::ComponentModel::PropertyDescriptor^ myProperty = properties->Find( "Text", false ); + + // Prints the property and the property description. + textBox1->Text = String::Concat( myProperty->DisplayName, "\n" ); + textBox1->Text = String::Concat( textBox1->Text, myProperty->Description, "\n" ); + textBox1->Text = String::Concat( textBox1->Text, myProperty->Category, "\n" ); + // + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp new file mode 100644 index 00000000000..391f53b95d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/PropertyTabExample/CPP/class1.cpp @@ -0,0 +1,90 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::IO; +using namespace System::Reflection; +using namespace System::Runtime::Serialization; +using namespace System::Runtime::Serialization::Formatters::Binary; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +namespace TypeCategoryTabExample +{ + ref class TypeCategoryTab; + + // forward declaration. + // This component adds a TypeCategoryTab to the propery browser + // that is available for any components in the current design mode document. + + [PropertyTabAttribute(TypeCategoryTabExample::TypeCategoryTab::typeid,PropertyTabScope::Document)] + public ref class TypeCategoryTabComponent: public System::ComponentModel::Component + { + public: + TypeCategoryTabComponent(){} + }; + + // A TypeCategoryTab property tab lists properties by the + // category of the type of each property. + public ref class TypeCategoryTab: public PropertyTab + { + private: + + // This String^ contains a Base-64 encoded and serialized example property tab image. + + [BrowsableAttribute(true)] + String^ img; + + public: + TypeCategoryTab() + { + img = "AAEAAAD/////AQAAAAAAAAAMAgAAAFRTeXN0ZW0uRHJhd2luZywgVmVyc2lvbj0xLjAuMzMwMC4wLCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWIwM2Y1ZjdmMTFkNTBhM2EFAQAAABVTeXN0ZW0uRHJhd2luZy5CaXRtYXABAAAABERhdGEHAgIAAAAJAwAAAA8DAAAA9gAAAAJCTfYAAAAAAAAANgAAACgAAAAIAAAACAAAAAEAGAAAAAAAAAAAAMQOAADEDgAAAAAAAAAAAAD///////////////////////////////////9ZgABZgADzPz/zPz/zPz9AgP//////////gAD/gAD/AAD/AAD/AACKyub///////+AAACAAAAAAP8AAP8AAP9AgP////////9ZgABZgABz13hz13hz13hAgP//////////gAD/gACA/wCA/wCA/wAA//////////+AAACAAAAAAP8AAP8AAP9AgP////////////////////////////////////8L"; + } + + // + // Returns the properties of the specified component extended with + // a CategoryAttribute reflecting the name of the type of the property. + [ReflectionPermission(SecurityAction::Demand, Flags=ReflectionPermissionFlag::MemberAccess)] + virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component, array^attributes ) override + { + PropertyDescriptorCollection^ props; + if ( attributes == nullptr ) + props = TypeDescriptor::GetProperties( component ); + else + props = TypeDescriptor::GetProperties( component, attributes ); + + array^propArray = gcnew array(props->Count); + for ( int i = 0; i < props->Count; i++ ) + { + // Create a new PropertyDescriptor from the old one, with + // a CategoryAttribute matching the name of the type. + array^temp0 = {gcnew CategoryAttribute( props[ i ]->PropertyType->Name )}; + propArray[ i ] = TypeDescriptor::CreateProperty( props[ i ]->ComponentType, props[ i ], temp0 ); + + } + return gcnew PropertyDescriptorCollection( propArray ); + } + + virtual System::ComponentModel::PropertyDescriptorCollection^ GetProperties( Object^ component ) override + { + return this->GetProperties( component, nullptr ); + } + // + + property String^ TabName + { + // Provides the name for the property tab. + virtual String^ get() override + { + return "Properties by Type"; + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp b/snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp new file mode 100644 index 00000000000..37c11fe73bf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RefreshEventHandler/CPP/refreshevent.cpp @@ -0,0 +1,137 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 488, 301 ); + array^temp1 = {this->textBox1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + textBox1->Text = "changed"; + System::ComponentModel::TypeDescriptor::Refreshed += gcnew System::ComponentModel::RefreshEventHandler( OnRefresh ); + System::ComponentModel::TypeDescriptor::GetProperties( textBox1 ); + System::ComponentModel::TypeDescriptor::Refresh( textBox1 ); + } + +protected: + static void OnRefresh( System::ComponentModel::RefreshEventArgs^ e ) + { + Console::WriteLine( e->ComponentChanged ); + } + // +}; + +ref class Control: public Component +{ +private: + int position; + +public: + + property int Position + { + int get() + { + return position; + } + + void set( int value ) + { + if ( !position.Equals( value ) ) + { + position = value; + + //RaisePropertyChangedEvent(position); + } + } + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp b/snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp new file mode 100644 index 00000000000..ac1127ff51c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RemoveAt/CPP/removeat.cpp @@ -0,0 +1,49 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +ref class TestForm: public Form +{ +public: + + // + void InitializeMyMenu() + { + // Create the MainMenu object. + MainMenu^ myMainMenu = gcnew MainMenu; + + // Create the MenuItem objects. + MenuItem^ fileMenu = gcnew MenuItem( "&File" ); + MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); + MenuItem^ newFile = gcnew MenuItem( "&New" ); + MenuItem^ openFile = gcnew MenuItem( "&Open" ); + MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); + + // Add the MenuItem objects to myMainMenu. + myMainMenu->MenuItems->Add( fileMenu ); + myMainMenu->MenuItems->Add( editMenu ); + + // Add three submenus to the File menu. + fileMenu->MenuItems->Add( newFile ); + fileMenu->MenuItems->Add( openFile ); + fileMenu->MenuItems->Add( exitProgram ); + + // Assign myMainMenu to the form. + Menu = myMainMenu; + + // Remove the item S"Exit" from the File menu. + fileMenu->MenuItems->RemoveAt( 2 ); + } + // +}; + +int main() +{ + Application::Run( gcnew TestForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp b/snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp new file mode 100644 index 00000000000..03b40d2ed26 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RemoveMenuItems/CPP/removeitems.cpp @@ -0,0 +1,116 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + InitializeMyMenu(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // +public: + void InitializeMyMenu() + { + // Create the MainMenu object. + MainMenu^ myMainMenu = gcnew MainMenu; + + // Create the MenuItem objects. + MenuItem^ fileMenu = gcnew MenuItem( "&File" ); + MenuItem^ editMenu = gcnew MenuItem( "&Edit" ); + MenuItem^ newFile = gcnew MenuItem( "&New" ); + MenuItem^ openFile = gcnew MenuItem( "&Open" ); + MenuItem^ exitProgram = gcnew MenuItem( "E&xit" ); + + // Add the MenuItem objects to myMainMenu. + myMainMenu->MenuItems->Add( fileMenu ); + myMainMenu->MenuItems->Add( editMenu ); + + // Add three submenus to the File menu. + fileMenu->MenuItems->Add( newFile ); + fileMenu->MenuItems->Add( openFile ); + fileMenu->MenuItems->Add( exitProgram ); + + // Assign myMainMenu to the form. + Menu = myMainMenu; + + // Remove the item S"Open" from the File menu. + fileMenu->MenuItems->Remove( openFile ); + } + // + +private: + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp new file mode 100644 index 00000000000..170567ba143 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.AllowDrop/CPP/form1.cpp @@ -0,0 +1,140 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + // + // Required for Windows Form Designer supports + // + + // +public: + Form1() + { + InitializeComponent(); + + // Sets the control to allow drops, and then adds the necessary event handlers. + this->richTextBox1->AllowDrop = true; + } + +private: + void listBox1_MouseDown( Object^ sender, System::Windows::Forms::MouseEventArgs^ e ) + { + // Determines which item was selected. + ListBox^ lb = (dynamic_cast(sender)); + Point pt = Point(e->X,e->Y); + + //Retrieve the item at the specified location within the ListBox. + int index = lb->IndexFromPoint( pt ); + + // Starts a drag-and-drop operation. + if ( index >= 0 ) + { + // Retrieve the selected item text to drag into the RichTextBox. + lb->DoDragDrop( lb->Items[ index ]->ToString(), DragDropEffects::Copy ); + } + } + + void richTextBox1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) + { + // If the data is text, copy the data to the RichTextBox control. + if ( e->Data->GetDataPresent( "Text" ) ) + e->Effect = DragDropEffects::Copy; + } + + void richTextBox1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) + { + // Paste the text into the RichTextBox where at selection location. + richTextBox1->SelectedText = e->Data->GetData( "System.String", true )->ToString(); + } + // + +public: + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // listBox1 + // + array^temp1 = {"Alpha","Bravo","Charlie","Delta","Echo","Foxtrot"}; + this->listBox1->Items->AddRange( temp1 ); + this->listBox1->Location = System::Drawing::Point( 16, 16 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 208, 238 ); + this->listBox1->TabIndex = 0; + this->listBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::listBox1_MouseDown ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 240, 16 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 208, 240 ); + this->richTextBox1->TabIndex = 1; + this->richTextBox1->Text = ""; + this->richTextBox1->DragDrop += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::richTextBox1_DragDrop ); + this->richTextBox1->DragEnter += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::richTextBox1_DragEnter ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 464, 273 ); + array^temp2 = {this->richTextBox1,this->listBox1}; + this->Controls->AddRange( temp2 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp new file mode 100644 index 00000000000..479003920cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.BulletIndent/CPP/form1.cpp @@ -0,0 +1,157 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteTextToRichTextBox(); + } + + // +private: + void WriteTextToRichTextBox() + { + // Clear all text from the RichTextBox; + richTextBox1->Clear(); + + // Indent bulleted text 30 pixels away from the bullet. + richTextBox1->BulletIndent = 30; + + // Set the font for the opening text to a larger Arial font; + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Assign the introduction text to the RichTextBox control. + richTextBox1->SelectedText = "The following is a list of bulleted items:\n"; + + // Set the Font for the first item to a smaller size Arial font. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); + + // Specify that the following items are to be added to a bulleted list. + richTextBox1->SelectionBullet = true; + + // Set the color of the item text. + richTextBox1->SelectionColor = Color::Red; + + // Assign the text to the bulleted item. + richTextBox1->SelectedText = "Apples" + "\n"; + + // Apply same font since font settings do not carry to next line. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); + richTextBox1->SelectionColor = Color::Orange; + richTextBox1->SelectedText = "Oranges" + "\n"; + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); + richTextBox1->SelectionColor = Color::Purple; + richTextBox1->SelectedText = "Grapes" + "\n"; + + // End the bulleted list. + richTextBox1->SelectionBullet = false; + + // Specify the font size and string for text displayed below bulleted list. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Verdana",10 ); + richTextBox1->SelectedText = "The bulleted text is indented 30 pixels from the bullet symbol using the BulletIndent property.\n"; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp new file mode 100644 index 00000000000..870110370b2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar1/CPP/form1.cpp @@ -0,0 +1,136 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 224 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 248, 192 ); + this->richTextBox1->TabIndex = 1; + this->richTextBox1->Text = "Alpha Bravo Charlie Delta Echo"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->richTextBox1,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + array^temp1 = {'D','e','l','t','a'}; + MessageBox::Show( FindMyText( temp1 ).ToString() ); + } + +public: + int FindMyText( array^text ) + { + // Initialize the return value to false by default. + int returnValue = -1; + + // Ensure that a search string has been specified and a valid start point. + if ( text->Length > 0 ) + { + // Obtain the location of the first character found in the control + // that matches any of the characters in the char array. + int indexToText = richTextBox1->Find( text ); + + // Determine whether the text was found in richTextBox1. + if ( indexToText >= 0 ) + { + // Return the location of the character. + returnValue = indexToText; + } + } + + return returnValue; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp new file mode 100644 index 00000000000..c1f2194d9f0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindChar2/CPP/form1.cpp @@ -0,0 +1,138 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 224 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 248, 192 ); + this->richTextBox1->TabIndex = 1; + this->richTextBox1->Text = "Alpha Bravo Charlie Delta Echo"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^formControls = {this->richTextBox1,this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + array^temp0 = {'B','r','a','v','o'}; + MessageBox::Show( FindMyText( temp0, 5 ).ToString() ); + } + +public: + int FindMyText( array^text, int start ) + { + // Initialize the return value to false by default. + int returnValue = -1; + + // Ensure that a valid char array has been specified and a valid start point. + if ( text->Length > 0 && start >= 0 ) + { + // Obtain the location of the first character found in the control + // that matches any of the characters in the char array. + int indexToText = richTextBox1->Find( text, start ); + + // Determine whether any of the chars are found in richTextBox1. + if ( indexToText >= 0 ) + { + // Return the location of the character. + returnValue = indexToText; + } + } + + return returnValue; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp new file mode 100644 index 00000000000..b3d7b066e99 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.FindStringStartEnd/CPP/form1.cpp @@ -0,0 +1,139 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 256, 160 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "Alpha Bravo Charlie Delta Echo Foxtrot Golf"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 184 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 280, 214 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( FindMyText( "Golf", 44, -1 ).ToString() ); + } + + // +public: + int FindMyText( String^ searchText, int searchStart, int searchEnd ) + { + // Initialize the return value to false by default. + int returnValue = -1; + + // Ensure that a search string and a valid starting point are specified. + if ( searchText->Length > 0 && searchStart >= 0 ) + { + // Ensure that a valid ending value is provided. + if ( searchEnd > searchStart || searchEnd == -1 ) + { + // Obtain the location of the search string in richTextBox1. + int indexToText = richTextBox1->Find( searchText, searchStart, searchEnd, RichTextBoxFinds::MatchCase ); + + // Determine whether the text was found in richTextBox1. + if ( indexToText >= 0 ) + { + // Return the index to the specified search text. + returnValue = indexToText; + } + } + } + + return returnValue; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp new file mode 100644 index 00000000000..b700aad43a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharAtIndex/CPP/form1.cpp @@ -0,0 +1,112 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 24, 24 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 320, 264 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "There once was a man from Nantucket."; + this->richTextBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::richTextBox1_MouseDown ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 368, 310 ); + array^temp0 = {this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void richTextBox1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Determine which mouse button is clicked. + if ( e->Button == ::MouseButtons::Left ) + { + // Obtain the character at which the mouse cursor was clicked at. + Char tempChar = richTextBox1->GetCharFromPosition( Point(e->X,e->Y) ); + + // Determine whether the character is an empty space. + if ( !tempChar.ToString()->Equals( " " ) ) + + // Display the character in a message box. + MessageBox::Show( String::Format( "The character at the specified position is {0}.", tempChar ) ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp new file mode 100644 index 00000000000..1ab600d1d79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.GetCharIndexFromPosition/CPP/form1.cpp @@ -0,0 +1,118 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 16, 16 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 408, 232 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "There once was a brown man from Nantucket..."; + this->richTextBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::richTextBox1_MouseDown ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 440, 270 ); + array^temp0 = {this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void richTextBox1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Declare the string to search for in the control. + String^ searchString = "brown"; + + // Determine whether the user clicks the left mouse button and whether it is a double click. + if ( e->Clicks == 1 && e->Button == ::MouseButtons::Left ) + { + // Obtain the character index where the user clicks on the control. + int positionToSearch = richTextBox1->GetCharIndexFromPosition( Point(e->X,e->Y) ); + + // Search for the search string text within the control from the point the user clicked. + int textLocation = richTextBox1->Find( searchString, positionToSearch, RichTextBoxFinds::None ); + + // If the search string is found (value greater than -1), display the index the string was found at. + if ( textLocation >= 0 ) + MessageBox::Show( String::Format( "The search string was found at character index {0}.", textLocation ) ); // Display a message box alerting the user that the text was not found. + else + MessageBox::Show( "The search string was not found within the text of the control." ); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp new file mode 100644 index 00000000000..b2f07642097 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.MaxLength/CPP/form1.cpp @@ -0,0 +1,124 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 56, 48 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 208, 176 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 288, 56 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 408, 254 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + richTextBox1->Clear(); + richTextBox1->MaxLength = 2; + AddMyText( "Foo" ); + } + + + // +private: + void AddMyText( String^ textToAdd ) + { + // Determine if the text to add is larger than the max length property. + if ( textToAdd->Length > richTextBox1->MaxLength ) + // Alert user text is too large. + MessageBox::Show( "The text is too large to add to the RichTextBox" ); // Add the text to be added to the control. + else + richTextBox1->SelectedText = textToAdd; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp new file mode 100644 index 00000000000..52a2cac1209 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.RedoAction/CPP/form1.cpp @@ -0,0 +1,127 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 32, 40 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 240, 208 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 328, 64 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 432, 350 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Selects all text in the control. + richTextBox1->SelectAll(); + richTextBox1->Cut(); + richTextBox1->Undo(); + RedoAllButDeletes(); + } + + // +private: + void RedoAllButDeletes() + { + // Determines if a Redo operation can be performed. + if ( richTextBox1->CanRedo ) + { + // Determines if the redo operation deletes text. + if ( !richTextBox1->RedoActionName->Equals( "Delete" ) ) + // Perform the redo. + richTextBox1->Redo(); + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp new file mode 100644 index 00000000000..0c418ba73e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionAlignment/CPP/form1.cpp @@ -0,0 +1,129 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteCenteredTextToRichTextBox(); + } + + // +private: + void WriteCenteredTextToRichTextBox() + { + // Clear all text from the RichTextBox; + richTextBox1->Clear(); + + // Set the foreground color of the text. + richTextBox1->ForeColor = Color::Red; + + // Set the alignment of the text that follows. + richTextBox1->SelectionAlignment = HorizontalAlignment::Center; + + // Set the font for the text. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Lucinda Console",12 ); + + // Set the text within the control. + richTextBox1->SelectedText = "This text is centered using the SelectionAlignment property.\n"; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp new file mode 100644 index 00000000000..473896b4797 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionBullet/CPP/form1.cpp @@ -0,0 +1,152 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^formControls = {this->button1,this->richTextBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteTextToRichTextBox(); + } + + // +private: + void WriteTextToRichTextBox() + { + // Clear all text from the RichTextBox; + richTextBox1->Clear(); + + // Set the font for the opening text to a larger Arial font; + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Assign the introduction text to the RichTextBox control. + richTextBox1->SelectedText = "The following is a list of bulleted items: \n"; + + // Set the Font for the first item to a smaller size Arial font. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); + + // Specify that the following items are to be added to a bulleted list. + richTextBox1->SelectionBullet = true; + + // Set the color of the item text. + richTextBox1->SelectionColor = Color::Red; + + // Assign the text to the bulleted item. + richTextBox1->SelectedText = "Apples \n"; + + // Apply same font since font settings do not carry to next line. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); + richTextBox1->SelectionColor = Color::Orange; + richTextBox1->SelectedText = "Oranges \n"; + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",12 ); + richTextBox1->SelectionColor = Color::Purple; + richTextBox1->SelectedText = "Grapes \n"; + + // End the bulleted list. + richTextBox1->SelectionBullet = false; + + // Specify the font size and string for text displayed below bulleted list. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",16 ); + richTextBox1->SelectedText = "Bulleted Text Complete!"; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp new file mode 100644 index 00000000000..c951a48851b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionCharOffset/CPP/form1.cpp @@ -0,0 +1,151 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteOffsetTextToRichTextBox(); + } + + // +private: + void WriteOffsetTextToRichTextBox() + { + // Clear all text from the RichTextBox. + richTextBox1->Clear(); + + // Set the font for the text. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Lucinda Console",12 ); + + // Set the foreground color of the text. + richTextBox1->SelectionColor = Color::Purple; + + // Set the baseline text. + richTextBox1->SelectedText = "10"; + + // Set the CharOffset to display superscript text. + richTextBox1->SelectionCharOffset = 10; + + // Set the superscripted text. + richTextBox1->SelectedText = "2"; + + // Reset the CharOffset to display text at the baseline. + richTextBox1->SelectionCharOffset = 0; + richTextBox1->AppendText( "\n\n" ); + + // Change the forecolor of the next text selection. + richTextBox1->SelectionColor = Color::Blue; + + // Set the baseline text. + richTextBox1->SelectedText = "77"; + + // Set the CharOffset to display subscript text. + richTextBox1->SelectionCharOffset = -10; + + // Set the subscripted text. + richTextBox1->SelectedText = "3"; + + // Reset the CharOffset to display text at the baseline. + richTextBox1->SelectionCharOffset = 0; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp new file mode 100644 index 00000000000..4c9d88e3eff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionHangingIndent/CPP/form1.cpp @@ -0,0 +1,130 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteIndentedTextToRichTextBox(); + } + + // +private: + void WriteIndentedTextToRichTextBox() + { + // Clear all text from the RichTextBox; + richTextBox1->Clear(); + + // Specify a 20 pixel hanging indent in all paragraphs. + richTextBox1->SelectionHangingIndent = 20; + + // Set the font for the text. + richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 ); + + // Set the text within the control. + richTextBox1->SelectedText = "This text contains a hanging indent. The first sentence of the paragraph is spaced normally."; + richTextBox1->SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent."; + richTextBox1->SelectedText = "After this paragraph the indent is returned to normal spacing.\n"; + richTextBox1->SelectedText = "Since this is a new paragraph the indent is also applied to this paragraph."; + richTextBox1->SelectedText = "All subsequent lines of text are indented based on the value of SelectionHangingIndent."; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp new file mode 100644 index 00000000000..9124f8d3b78 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionIndent/CPP/form1.cpp @@ -0,0 +1,130 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteIndentedTextToRichTextBox(); + } + + // +private: + void WriteIndentedTextToRichTextBox() + { + // Clear all text from the RichTextBox; + richTextBox1->Clear(); + + // Specify a 20 pixel indent in all paragraphs. + richTextBox1->SelectionIndent = 20; + + // Set the font for the text. + richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 ); + + // Set the text within the control. + richTextBox1->SelectedText = "All text is indented 20 pixels from the left edge of the RichTextBox."; + richTextBox1->SelectedText = "You can use this property to provide proper indentation such as when writing a letter."; + richTextBox1->SelectedText = "After this paragraph the indent is returned to normal spacing.\n\n"; + richTextBox1->SelectionIndent = 0; + richTextBox1->SelectedText = "No indenation is applied to this paragraph. All text in the paragraph flows from each control edge."; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp new file mode 100644 index 00000000000..35a7ac94136 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionLength/CPP/form1.cpp @@ -0,0 +1,131 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +internal: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::RichTextBox^ richTextBox1; + +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + richTextBox1->Clear(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 336, 72 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 3; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 24, 24 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 296, 168 ); + this->richTextBox1->TabIndex = 2; + this->richTextBox1->Text = "richTextBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 440, 222 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "C#"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ModifySelectedText(); + } + + // +private: + void ModifySelectedText() + { + // Determine if text is selected in the control. + if ( richTextBox1->SelectionLength > 0 ) + { + // Set the color of the selected text in the control. + richTextBox1->SelectionColor = Color::Red; + + // Set the font of the selected text to bold and underlined. + richTextBox1->SelectionFont = gcnew System::Drawing::Font( "Arial",10,static_cast(FontStyle::Bold | FontStyle::Underline) ); + + // Protect the selected text from modification. + richTextBox1->SelectionProtected = true; + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp new file mode 100644 index 00000000000..2944614e92f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionProtected/CPP/form1.cpp @@ -0,0 +1,133 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +internal: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::RichTextBox^ richTextBox1; + +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 336, 96 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 5; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 16, 48 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 296, 168 ); + this->richTextBox1->TabIndex = 4; + this->richTextBox1->Text = "richTextBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 424, 254 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + richTextBox1->Clear(); + richTextBox1->AppendText( "This text is being added to the RichTextBox control to protect" ); + ProtectMySelectedText(); + } + + // +private: + void ProtectMySelectedText() + { + // Determine if the selected text in the control contains the word "RichTextBox". + if ( !richTextBox1->SelectedText->Equals( "RichTextBox" ) ) + { + // Search for the word RichTextBox in the control. + if ( richTextBox1->Find( "RichTextBox", RichTextBoxFinds::WholeWord ) == -1 ) + { + //Alert the user that the word was not foun and return. + MessageBox::Show( "The text \"RichTextBox\" was not found!" ); + return; + } + } + + // Protect the selected text in the control from being altered. + richTextBox1->SelectionProtected = true; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp new file mode 100644 index 00000000000..415ba9d8dee --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.SelectionRightIndent/CPP/form1.cpp @@ -0,0 +1,134 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::RichTextBox^ richTextBox1; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 400, 168 ); + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 312, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 416, 382 ); + array^temp0 = {this->button1,this->richTextBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + WriteIndentedTextToRichTextBox(); + } + + + // +private: + void WriteIndentedTextToRichTextBox() + { + // Clear all text from the RichTextBox; + richTextBox1->Clear(); + + // Specify a 20 pixel right indent in all paragraphs. + richTextBox1->SelectionRightIndent = 20; + + // Set the font for the text. + richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 ); + + // Set the text within the control. + richTextBox1->SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox."; + richTextBox1->SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins."; + richTextBox1->SelectedText = "After this paragraph the indentation will end.\n\n"; + + // Remove all right indentation. + richTextBox1->SelectionRightIndent = 0; + richTextBox1->SelectedText = "This paragraph has no right indentation. All text should flow as normal."; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp new file mode 100644 index 00000000000..3462a60ebc4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextBox.ZoomFactor/CPP/form1.cpp @@ -0,0 +1,129 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 256, 224 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 48, 32 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->Size = System::Drawing::Size( 192, 208 ); + this->richTextBox1->TabIndex = 1; + this->richTextBox1->Text = "richTextBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 360, 310 ); + array^temp0 = {this->richTextBox1,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ZoomMyRichTextBox(); + } + + // +private: + void ZoomMyRichTextBox() + { + // Enable users to select entire word when double clicked. + richTextBox1->AutoWordSelection = true; + + // Clear contents of control. + richTextBox1->Clear(); + + // Set the right margin to restrict horizontal text. + richTextBox1->RightMargin = 2; + + // Set the text for the control. + richTextBox1->SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot"; + + // Zoom by 2 points. + richTextBox1->ZoomFactor = 2.0f; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp new file mode 100644 index 00000000000..9ad477c1c18 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichTextDragDrop/CPP/form1.cpp @@ -0,0 +1,146 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer supports + // + InitializeComponent(); + + // Sets the control to allow drops, and then adds the necessary event handlers. + this->richTextBox1->AllowDrop = true; + this->richTextBox1->DragEnter += gcnew DragEventHandler( this, &Form1::richTextBox1_DragEnter ); + this->richTextBox1->DragDrop += gcnew DragEventHandler( this, &Form1::richTextBox1_DragDrop ); + this->listBox1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::listBox1_MouseDown ); + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + + // Add code here to populate the ListBox1 with paths to text files. + } + + // +private: + void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Sets the AllowDrop property so that data can be dragged onto the control. + richTextBox1->AllowDrop = true; + + // Add code here to populate the ListBox1 with paths to text files. + } + + void listBox1_MouseDown( Object^ sender, System::Windows::Forms::MouseEventArgs^ e ) + { + // Determines which item was selected. + ListBox^ lb = (dynamic_cast(sender)); + Point pt = Point(e->X,e->Y); + int index = lb->IndexFromPoint( pt ); + + // Starts a drag-and-drop operation with that item. + if ( index >= 0 ) + { + lb->DoDragDrop( lb->Items[ index ], DragDropEffects::Link ); + } + } + + void richTextBox1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) + { + // If the data is text, copy the data to the RichTextBox control. + if ( e->Data->GetDataPresent( "Text" ) ) + e->Effect = DragDropEffects::Copy; + } + + void richTextBox1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) + { + // Loads the file into the control. + richTextBox1->LoadFile( dynamic_cast(e->Data->GetData( "Text" )), System::Windows::Forms::RichTextBoxStreamType::RichText ); + } + // + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // listBox1 + // + this->listBox1->Location = System::Drawing::Point( 256, 48 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 120, 95 ); + this->listBox1->TabIndex = 0; + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 64, 40 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->TabIndex = 1; + this->richTextBox1->Text = "richTextBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 464, 273 ); + array^formControls = {this->richTextBox1,this->listBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp new file mode 100644 index 00000000000..1c3eddf3402 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RichText_Paste/CPP/form1.cpp @@ -0,0 +1,124 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace RichText_CanPaste_CS +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::RichTextBox^ richTextBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + pasteMyBitmap( "c:\\NoImage::bmp" ); + } + + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + // + private: + bool pasteMyBitmap( String^ fileName ) + { + // Open an bitmap from file and copy it to the clipboard. + Bitmap^ myBitmap = gcnew Bitmap( fileName ); + + // Copy the bitmap to the clipboard. + Clipboard::SetDataObject( myBitmap ); + + // Get the format for the object type. + DataFormats::Format^ myFormat = DataFormats::GetFormat( DataFormats::Bitmap ); + + // After verifying that the data can be pasted, paste it. + if ( richTextBox1->CanPaste( myFormat ) ) + { + richTextBox1->Paste( myFormat ); + return true; + } + else + { + MessageBox::Show( "The data format that you attempted to paste is not supported by this control." ); + return false; + } + } + // + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + // richTextBox1 + // + this->richTextBox1->Location = System::Drawing::Point( 40, 136 ); + this->richTextBox1->Name = "richTextBox1"; + this->richTextBox1->TabIndex = 0; + this->richTextBox1->Text = "richTextBox1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {this->richTextBox1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew RichText_CanPaste_CS::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp new file mode 100644 index 00000000000..754f6b50091 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/RowCount/CPP/form1.cpp @@ -0,0 +1,50 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +public: + Form1() + { + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + TabPage^ tabPage2 = gcnew TabPage; + TabPage^ tabPage3 = gcnew TabPage; + TabPage^ tabPage4 = gcnew TabPage; + TabPage^ tabPage5 = gcnew TabPage; + Label^ label1 = gcnew Label; + + // Allows multiple rows of tabs in the tabControl1 tab strip. + tabControl1->Multiline = true; + tabControl1->SizeMode = TabSizeMode::FillToRight; + tabControl1->Padding = Point(15,5); + array^temp0 = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; + tabControl1->Controls->AddRange( temp0 ); + tabControl1->Location = Point(35,65); + tabControl1->Size = System::Drawing::Size( 220, 180 ); + + // Gets the number of rows currently in the tabControl1 tab strip. + // Assigns int value to the rows variable. + int rows = tabControl1->RowCount; + label1->Text = System::String::Concat( "There are ", rows, " rows of tabs in the tabControl1 tab strip." ); + label1->Location = Point(35,25); + label1->Size = System::Drawing::Size( 220, 30 ); + Size = System::Drawing::Size( 300, 300 ); + array^temp1 = {label1,tabControl1}; + Controls->AddRange( temp1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp new file mode 100644 index 00000000000..2be33dd0b15 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Screen Object Example/CPP/form1.cpp @@ -0,0 +1,130 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace Screen_Example_cs +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::ListBox^ listBox1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 56, 16 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 168, 23 ); + this->button1->TabIndex = 0; + this->button1->Text = "Get Screen Info"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // listBox1 + // + this->listBox1->Location = System::Drawing::Point( 8, 48 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 280, 186 ); + this->listBox1->TabIndex = 1; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {this->listBox1,this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // For each screen, add the screen properties to a list box. + for each (Screen^ screen in Screen::AllScreens) { + listBox1->Items->Add( + String::Concat("Device Name: ", screen->DeviceName)); + listBox1->Items->Add( + String::Concat("Bounds: ", screen->Bounds)); + listBox1->Items->Add( + String::Concat("Type: ", screen->GetType())); + listBox1->Items->Add( + String::Concat("Working Area: ", screen->WorkingArea)); + listBox1->Items->Add( + String::Concat("Primary Screen: ", screen->Primary)); + } + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Screen_Example_cs::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp new file mode 100644 index 00000000000..e767545725f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Screen.FromPoint/CPP/form1.cpp @@ -0,0 +1,104 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace WindowsApplication2 +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::Form1_MouseDown ); + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + + // + private: + void Form1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + Point p = Point(e->X,e->Y); + Screen^ s = Screen::FromPoint( p ); + if ( s->Primary ) + { + MessageBox::Show( "You clicked the primary screen" ); + } + else + { + MessageBox::Show( "This isn't the primary screen" ); + } + // + } + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew WindowsApplication2::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp new file mode 100644 index 00000000000..8f3add31e10 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SelectedIndex/CPP/form1.cpp @@ -0,0 +1,52 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + array^tabControls = {this->tabPage1,this->tabPage2}; + this->tabControl1->Controls->AddRange( tabControls ); + this->tabControl1->Padding = Point(15,10); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + + // Selects tabPage2 using SelectedIndex. + this->tabControl1->SelectedIndex = 1; + this->tabPage1->Text = "myTabPage1"; + this->tabPage1->TabIndex = 0; + this->tabPage2->Text = "myTabPage2"; + this->tabPage2->TabIndex = 1; + this->Size = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp new file mode 100644 index 00000000000..bffe075a14f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SelectedTab/CPP/form1.cpp @@ -0,0 +1,50 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + array^temp0 = {this->tabPage1,this->tabPage2}; + this->tabControl1->Controls->AddRange( temp0 ); + this->tabControl1->Padding = Point(15,10); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + + // Selects tabPage2 using SelectedTab. + this->tabControl1->SelectedTab = tabPage2; + this->tabPage1->Text = "tabPage1"; + this->tabPage2->Text = "tabPage2"; + this->Size = System::Drawing::Size( 300, 300 ); + array^temp1 = {this->tabControl1}; + this->Controls->AddRange( temp1 ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp b/snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp new file mode 100644 index 00000000000..e8110ab8514 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ServiceArchitectureExample/CPP/serviceform.cpp @@ -0,0 +1,421 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; + +ref class ServiceObjectControl; + +// Example form provides UI for demonstrating service sharing behavior +// of a network of IServiceContainer/IServiceProvider controls. +public ref class ServiceForm: public System::Windows::Forms::Form +{ +private: + + // Root service container control for tree. + ServiceObjectControl^ root; + + // Button for clearing any provided services and resetting tree states. + System::Windows::Forms::Button^ reset_button; + + // Color list used to color code controls. + array^colorkeys; + + // Strings used to reflect text service. + array^keystrings; + +public: + ServiceForm() + { + InitializeComponent(); + CreateServiceControlTree(); + colorkeys = gcnew array(6); + colorkeys[ 0 ] = Color::Beige; + colorkeys[ 1 ] = Color::SeaShell; + colorkeys[ 2 ] = Color::LightGreen; + colorkeys[ 3 ] = Color::LightBlue; + colorkeys[ 4 ] = Color::Khaki; + colorkeys[ 5 ] = Color::CadetBlue; + array^stringstemp = {"No service use","Service not accessible","Service provided", + "Service obtained","Service accessible","No further access"}; + keystrings = stringstemp; + } + +private: + void CreateServiceControlTree(); + void InitializeComponent(); + +internal: + void ResetServiceTree( Object^ sender, EventArgs^ e ); +public: + void UpdateServiceCoverage(); + +protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override; +}; + +// Example service type contains a text string, sufficient +// to demonstrate service sharing. +public ref class TextService +{ +public: + String^ text; + TextService() + : text( String::Empty ) + {} + + TextService( String^ text ) + { + this->text = text; + } +}; + +public enum class TextServiceState +{ + ServiceNotObtained, ServiceObtained, ServiceProvided, ServiceNotFound +}; + +// Example Form for entering a string. +private ref class StringInputDialog: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ ok_button; + System::Windows::Forms::Button^ cancel_button; + +public: + System::Windows::Forms::TextBox^ inputTextBox; + StringInputDialog( String^ text ) + { + InitializeComponent(); + inputTextBox->Text = text; + } + +private: + void InitializeComponent() + { + this->ok_button = gcnew System::Windows::Forms::Button; + this->cancel_button = gcnew System::Windows::Forms::Button; + this->inputTextBox = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | + System::Windows::Forms::AnchorStyles::Right); + this->ok_button->Location = System::Drawing::Point( 180, 43 ); + this->ok_button->Name = "ok_button"; + this->ok_button->TabIndex = 1; + this->ok_button->Text = "OK"; + this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; + this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | + System::Windows::Forms::AnchorStyles::Right); + this->cancel_button->Location = System::Drawing::Point( 260, 43 ); + this->cancel_button->Name = "cancel_button"; + this->cancel_button->TabIndex = 2; + this->cancel_button->Text = "Cancel"; + this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; + this->inputTextBox->Location = System::Drawing::Point( 6, 9 ); + this->inputTextBox->Name = "inputTextBox"; + this->inputTextBox->Size = System::Drawing::Size( 327, 20 ); + this->inputTextBox->TabIndex = 0; + this->inputTextBox->Text = ""; + this->inputTextBox->Anchor = static_cast((System::Windows::Forms::AnchorStyles::Top | + System::Windows::Forms::AnchorStyles::Left) | System::Windows::Forms::AnchorStyles::Right); + this->ClientSize = System::Drawing::Size( 342, 73 ); + array^temp0 = {this->inputTextBox,this->cancel_button,this->ok_button}; + this->Controls->AddRange( temp0 ); + this->MinimumSize = System::Drawing::Size( 350, 100 ); + this->Name = "StringInputDialog"; + this->Text = "Text Service Provide String Dialog"; + this->ResumeLayout( false ); + } +}; + + +// An example user control that uses ServiceContainer to add, remove, +// and access services through a linkable service container network. +public ref class ServiceObjectControl: public System::Windows::Forms::UserControl +{ +public: + + // This example user control implementation provides a wrapper for + // ServiceContainer, supporting a linked service container network. + ServiceContainer^ serviceContainer; + +private: + + // Parent form reference for main program function access. + ServiceForm^ parent; + +public: + + // String for label displayed on the control to indicate the + // control's current service-related configuration state. + String^ label; + +private: + + // The current state of the control reflecting whether it has + // obtained or provided a text service. + TextServiceState state_; + +public: + + property TextServiceState state + { + TextServiceState get() + { + return state_; + } + + void set( TextServiceState value ) + { + if ( (TextServiceState)value == TextServiceState::ServiceProvided ) + this->BackColor = Color::LightGreen; + else + if ( (TextServiceState)value == TextServiceState::ServiceNotObtained ) + this->BackColor = Color::White; + else + if ( (TextServiceState)value == TextServiceState::ServiceObtained ) + this->BackColor = Color::LightBlue; + else + if ( (TextServiceState)value == TextServiceState::ServiceNotFound ) + this->BackColor = Color::SeaShell; + + state_ = value; + } + } + ServiceObjectControl( ServiceObjectControl^ serviceContainerParent, System::Drawing::Size size, + Point location, ServiceForm^ parent ) + { + this->state_ = TextServiceState::ServiceNotObtained; + this->BackColor = Color::Beige; + this->label = String::Empty; + this->Size = size; + this->Location = location; + this->parent = parent; + if ( serviceContainerParent == nullptr ) + serviceContainer = gcnew ServiceContainer; + else + serviceContainer = gcnew ServiceContainer( serviceContainerParent->serviceContainer ); + } + +protected: + + // Paint method override draws the label string on the control. + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + e->Graphics->DrawString( label, gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); + } + + // Process mouse-down behavior for click. + virtual void OnMouseDown( System::Windows::Forms::MouseEventArgs^ e ) override + { + if ( e->Button == ::MouseButtons::Left ) + { + if ( state_ != TextServiceState::ServiceProvided ) + { + // Attempt to update text from service, and set color + // state accordingly. + TextService^ ts = dynamic_cast(serviceContainer->GetService( TextService::typeid )); + if ( ts != nullptr ) + { + this->label = ts->text; + state = TextServiceState::ServiceObtained; + } + else + { + this->label = "Service Not Found"; + state = TextServiceState::ServiceNotFound; + } + } + } + + if ( e->Button == ::MouseButtons::Right ) + { + if ( state_ == TextServiceState::ServiceProvided ) + { + // Remove service if the container provided it. + if ( serviceContainer->GetService( TextService::typeid ) != nullptr ) + { + serviceContainer->RemoveService( TextService::typeid, true ); + state = TextServiceState::ServiceNotObtained; + this->label = "Service Removed"; + } + } + else + { + // Obtain string and provide text service. + StringInputDialog^ form = gcnew StringInputDialog( "Test String" ); + form->StartPosition = FormStartPosition::CenterParent; + if ( form->ShowDialog() == DialogResult::OK ) + { + if ( serviceContainer->GetService( TextService::typeid ) != nullptr ) + serviceContainer->RemoveService( TextService::typeid, true ); + parent->ResetServiceTree( this, gcnew EventArgs ); + serviceContainer->AddService( TextService::typeid, gcnew TextService( form->inputTextBox->Text ), true ); + state = TextServiceState::ServiceProvided; + this->label = String::Format( "Provided Text: {0}", form->inputTextBox->Text ); + } + } + } + + parent->UpdateServiceCoverage(); + } + +public: + + // Method accesses the TextService to test the visibility of the service + // from the control, and sets the UI state accordingly. + void ReflectServiceVisibility() + { + if ( state_ == TextServiceState::ServiceObtained ) + { + if ( serviceContainer->GetService( TextService::typeid ) == nullptr ) + this->BackColor = Color::CadetBlue; + } + else + if ( state_ != TextServiceState::ServiceProvided ) + { + if ( serviceContainer->GetService( TextService::typeid ) == nullptr ) + { + this->BackColor = Color::White; + return; + } + + // Service available. + if ( state_ == TextServiceState::ServiceNotFound ) + this->BackColor = Color::Khaki; + else + if ( state_ == TextServiceState::ServiceNotObtained && !label->Equals( "Service Removed" ) ) + this->BackColor = Color::Khaki; + } + } +}; + +void ServiceForm::CreateServiceControlTree() +{ + // Create root service control. + ServiceObjectControl^ control1 = gcnew ServiceObjectControl( nullptr,System::Drawing::Size( 300, 40 ),Point(10,80),this ); + root = control1; + + // Create first tier - pass parent with service object control 1 + ServiceObjectControl^ control2 = gcnew ServiceObjectControl( control1,System::Drawing::Size( 200, 30 ),Point(50,160),this ); + ServiceObjectControl^ control3 = gcnew ServiceObjectControl( control1,System::Drawing::Size( 200, 30 ),Point(50,240),this ); + + // Create second tier A - pass parent with service object control 2 + ServiceObjectControl^ control4 = gcnew ServiceObjectControl( control2,System::Drawing::Size( 180, 20 ),Point(300,145),this ); + ServiceObjectControl^ control5 = gcnew ServiceObjectControl( control2,System::Drawing::Size( 180, 20 ),Point(300,185),this ); + + // Create second tier B - pass parent with service object control 3 + ServiceObjectControl^ control6 = gcnew ServiceObjectControl( control3,System::Drawing::Size( 180, 20 ),Point(300,225),this ); + ServiceObjectControl^ control7 = gcnew ServiceObjectControl( control3,System::Drawing::Size( 180, 20 ),Point(300,265),this ); + + // Add controls. + array^temp1 = {control1,control2,control3,control4,control5,control6,control7}; + this->Controls->AddRange( temp1 ); +} + +void ServiceForm::ResetServiceTree( Object^ /*sender*/, EventArgs^ /*e*/ ) +{ + // Remove the service from the service tree. + if ( root->serviceContainer->GetService( TextService::typeid ) != nullptr ) + root->serviceContainer->RemoveService( TextService::typeid, true ); + + // Set all controls to "not obtained" and clear their labels. + for ( int i = 0; i < Controls->Count; i++ ) + if ( !Controls[ i ]->Equals( reset_button ) ) + { + (dynamic_cast(Controls[ i ]))->state = TextServiceState::ServiceNotObtained; + (dynamic_cast(Controls[ i ]))->label = String::Empty; + (dynamic_cast(Controls[ i ]))->BackColor = Color::Beige; + } +} + +void ServiceForm::UpdateServiceCoverage() +{ + // Have each control set state to reflect service availability. + for ( int i = 0; i < Controls->Count; i++ ) + if ( !Controls[ i ]->Equals( reset_button ) ) + (dynamic_cast(Controls[ i ]))->ReflectServiceVisibility(); +} + +void ServiceForm::InitializeComponent() +{ + this->reset_button = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // reset_button + // + this->reset_button->Location = System::Drawing::Point( 392, 88 ); + this->reset_button->Name = "reset_button"; + this->reset_button->TabIndex = 0; + this->reset_button->TabStop = false; + this->reset_button->Text = "Reset"; + this->reset_button->Click += gcnew System::EventHandler( this, &ServiceForm::ResetServiceTree ); + + // + // ServiceForm + // + this->ClientSize = System::Drawing::Size( 512, 373 ); + array^temp2 = {this->reset_button}; + this->Controls->AddRange( temp2 ); + this->MinimumSize = System::Drawing::Size( 520, 400 ); + this->Name = "ServiceForm"; + this->Text = "Service Container Architecture Example"; + this->ResumeLayout( false ); +} + +void ServiceForm::OnPaint( System::Windows::Forms::PaintEventArgs^ e ) +{ + e->Graphics->DrawString( "The following tree diagram represents a hierarchy of linked service containers in controls.", + gcnew System::Drawing::Font( "Arial",9 ), gcnew SolidBrush( Color::Black ), 4, 4 ); + e->Graphics->DrawString( "This example demonstrates the propagation behavior of services through a linked service object tree.", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 26 ); + e->Graphics->DrawString( "Right-click a component to add or replace a text service, or to remove it if the component provided it.", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 38 ); + e->Graphics->DrawString( "Left-click a component to update text from the text service if available.", + gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 4, 50 ); + + // Draw lines to represent tree branches. + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 125, 20, 258 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 175, 45, 175 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 21, 258, 45, 258 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 175, 285, 175 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 255, 258, 285, 258 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 285, 195 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 285, 278 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 155, 290, 155 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 195, 290, 195 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 238, 290, 238 ); + e->Graphics->DrawLine( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 285, 278, 290, 278 ); + + // Draw color key. + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 20, 305, 410, 60 ); + int y = 0; + for ( int i = 0; i < 3; i++ ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 310, 20, 20 ); + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 310, 20, 20 ); + e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), + (float)50 + (i * 140), 315 ); + y++; + e->Graphics->FillRectangle( gcnew SolidBrush( colorkeys[ y ] ), 25 + (i * 140), 340, 20, 20 ); + e->Graphics->DrawRectangle( gcnew Pen( gcnew SolidBrush( Color::Black ),1 ), 25 + (i * 140), 340, 20, 20 ); + e->Graphics->DrawString( keystrings[ y ], gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), + (float)50 + (i * 140), 345 ); + y++; + } +} + +[STAThread] +int main() +{ + Application::Run( gcnew ServiceForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp new file mode 100644 index 00000000000..185ec5d0cc7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ServiceContainerExample/CPP/form1.cpp @@ -0,0 +1,232 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Windows::Forms; + +/* This sample uses the ServiceContainer class, which implements + the IServiceContainer interface. It creates a service container + and stores services of type Control in it. + + When the application is run, it adds control services at two + times: when button2 is clicked and when a radio button is + clicked. It adds the controls to the container by calling each + of two overloaded versions of IServiceContainer.AddService(). + + Pressing button1 invokes the button1 handler, which is + button1_Click(). In turn, this invokes a method based on + whether or not button2 or a radio button has been selected. + If one of these two button types has been selected, then its + service has been added to the service container. In this case, + button1_Click() gets the current service, which invokes the + method that was associated with this service when the service + was added to the container. If a radio button is current, the + system updates the text of that radio button with the given text. + If button2 is current, the system calls CreateNewControl(), which + creates a new control with the given text. + + Pressing button2 invokes the button2 handler, which adds a service + to the container by passing in a service creator callback. This + enables this action to invoke the event handler that the developer + specifies. In this case, the sample invokes CreateNewControl(), + which creates and maintains label controls, and displays them in + the same group box that the buttons are in. + + Clicking a radio button has the effect of adding that radio button + to the service container. +*/ + +public ref class Form1: public Form +{ +private: + Button^ button1; + GroupBox^ groupBox1; + RadioButton^ radioButton1; + RadioButton^ radioButton2; + RadioButton^ radioButton3; + RadioButton^ radioButton4; + System::ComponentModel::Container^ components; + Button^ button2; + ServiceContainer^ m_MyServiceContainer; + int m_nLabelCount; + void InitializeComponent() + { + button1 = gcnew Button; + groupBox1 = gcnew GroupBox; + button2 = gcnew Button; + radioButton4 = gcnew RadioButton; + radioButton3 = gcnew RadioButton; + radioButton2 = gcnew RadioButton; + radioButton1 = gcnew RadioButton; + groupBox1->SuspendLayout(); + SuspendLayout(); + + // + // button1 + // + button1->Location = System::Drawing::Point( 24, 16 ); + button1->Name = "button1"; + button1->Size = System::Drawing::Size( 112, 32 ); + button1->TabIndex = 0; + button1->Text = "button1"; + button1->Click += gcnew EventHandler( this, &Form1::button1_Click ); + + // + // groupBox1 + // + array^myArray = {button2,radioButton4,radioButton3,radioButton2,radioButton1}; + groupBox1->Controls->AddRange( myArray ); + groupBox1->Location = System::Drawing::Point( 8, 56 ); + groupBox1->Name = "groupBox1"; + groupBox1->Size = System::Drawing::Size( 272, 200 ); + groupBox1->TabIndex = 1; + groupBox1->TabStop = false; + groupBox1->Text = "groupBox1"; + + // + // button2 + // + button2->Location = System::Drawing::Point( 40, 152 ); + button2->Name = "button2"; + button2->Size = System::Drawing::Size( 90, 26 ); + button2->TabIndex = 4; + button2->Text = "button2"; + button2->Click += gcnew EventHandler( this, &Form1::button2_Click ); + + // + // radioButton4 + // + radioButton4->Location = System::Drawing::Point( 32, 112 ); + radioButton4->Name = "radioButton4"; + radioButton4->TabIndex = 3; + radioButton4->Text = "radioButton4"; + radioButton4->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // radioButton3 + // + radioButton3->Location = System::Drawing::Point( 32, 80 ); + radioButton3->Name = "radioButton3"; + radioButton3->TabIndex = 2; + radioButton3->Text = "radioButton3"; + radioButton3->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // radioButton2 + // + radioButton2->Location = System::Drawing::Point( 32, 48 ); + radioButton2->Name = "radioButton2"; + radioButton2->TabIndex = 1; + radioButton2->Text = "radioButton2"; + radioButton2->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // radioButton1 + // + radioButton1->Location = System::Drawing::Point( 32, 16 ); + radioButton1->Name = "radioButton1"; + radioButton1->TabIndex = 0; + radioButton1->Text = "radioButton1"; + radioButton1->CheckedChanged += gcnew EventHandler( this, &Form1::radioButton1_CheckedChanged ); + + // + // Form1 + // + ClientSize = System::Drawing::Size( 292, 272 ); + myArray = gcnew array(2); + myArray[ 0 ] = groupBox1; + myArray[ 1 ] = button1; + Controls->AddRange( myArray ); + Name = "Form1"; + Text = "Form1"; + groupBox1->ResumeLayout( false ); + ResumeLayout( false ); + } + + void radioButton1_CheckedChanged( Object^ sender, EventArgs^ /*e*/ ) + { + /* The application never displays this control so a generic + type of Control is fine */ + m_MyServiceContainer->RemoveService( Control::typeid ); + + // + m_MyServiceContainer->AddService( Control::typeid, sender ); + // + } + + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + /* Get the current control, if one is current. Here it's either a + push button or a radio control */ + Control^ c = dynamic_cast(m_MyServiceContainer->GetService( Control::typeid )); + if ( c != nullptr ) + { + + // Update the text of whichever control is currently selected. + c->Text = "Button1 clicked"; + } + } + + void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + /* ServiceContainer will throw an excpetion if a duplicate service + is added so remove it before we add */ + // + m_MyServiceContainer->RemoveService( Control::typeid ); + // + /* Whenever button2 is pressed, attach the callback method to the service + and add the service to the container. This causes any update to + invoke CreateNewControl() when button1 is pressed */ + // + m_MyServiceContainer->AddService( Control::typeid, gcnew ServiceCreatorCallback( this, &Form1::CreateNewControl ) ); + // + } + + /* If the application arrives at this method, it means that in button1_Click(), + GetService() was passed the service that corresponds to button2. This has + the effect of invoking the service creator callback for button2, which is + the method CreateNewControl(), and which was mapped in button2_Click(). */ + Object^ CreateNewControl( IServiceContainer^ /*container*/, Type^ /*serviceType*/ ) + { + Control^ c = gcnew Label; + c->Size = radioButton1->Size; + Point loc = button2->Location; + loc.X = 160; + loc.Y = 20 + 25 * m_nLabelCount; + c->Location = loc; + groupBox1->Controls->Add( c ); + ++m_nLabelCount; + return c; + } + +public: + Form1() + { + m_MyServiceContainer = gcnew ServiceContainer; + InitializeComponent(); + } + +public: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } +}; + +// The main entry point for the application. + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp new file mode 100644 index 00000000000..b746487cfb3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SetData1/CPP/setdata1.cpp @@ -0,0 +1,56 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +public: + Form1() + { + SetData1(); + } + + // +private: + void SetData1() + { + // Creates a component to store in the data object. + Component^ myComponent = gcnew Component; + + // Creates a data object. + DataObject^ myDataObject = gcnew DataObject; + + // Adds the component to the data object. + myDataObject->SetData( myComponent ); + + // Checks whether data of the specified type is in the data object. + Type^ myType = myComponent->GetType(); + String^ myMessageText; + if ( myDataObject->GetDataPresent( myType ) ) + { + myMessageText = "Data of type " + myType->Name + + " is present in the data object"; + } + else + { + myMessageText = "Data of type " + myType->Name + + " is not present in the data object"; + } + + // Displays the result in a message box. + MessageBox::Show( myMessageText, "The Test Result" ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp new file mode 100644 index 00000000000..c32123fb881 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SetData2/CPP/setdata2.cpp @@ -0,0 +1,43 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +public: + Form1() + { + SetData2(); + } + + // +private: + void SetData2() + { + // Creates a data object. + DataObject^ myDataObject = gcnew DataObject; + + // Stores a string, specifying the UnicodeText format. + myDataObject->SetData( DataFormats::UnicodeText, "Hello World!" ); + + // Retrieves the data by specifying the Text format. + String^ myMessageText = "The data type is " + + myDataObject->GetData( DataFormats::Text )->GetType()->Name; + + // Displays the result. + MessageBox::Show( myMessageText, "The Test Result" ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp new file mode 100644 index 00000000000..59455602428 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SetData3/CPP/setdata3.cpp @@ -0,0 +1,58 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public Form +{ +public: + Form1() + { + SetData3(); + } + + // +private: + void SetData3() + { + // Creates a component. + Component^ myComponent = gcnew Component; + + // Gets the type of the component. + Type^ myType = myComponent->GetType(); + + // Creates a data object. + DataObject^ myDataObject = gcnew DataObject; + + // Stores the component in the data object. + myDataObject->SetData( myType, myComponent ); + + // Checks whether data of the specified type is in the data object. + String^ myMessageText; + if ( myDataObject->GetDataPresent( myType ) ) + { + myMessageText = "Data of type " + myType->Name + + " is stored in the data object"; + } + else + { + myMessageText = "No data of type " + myType->Name + + " is stored in the data object"; + } + + // Displays the result. + MessageBox::Show( myMessageText, "The Test Result" ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp new file mode 100644 index 00000000000..6a6f91303ed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SetData4/CPP/form1.cpp @@ -0,0 +1,111 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace SetData4 +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + SetData4(); + + // + // TODO: Adds any constructor code after InitializeComponent call + // + } + + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 276 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + // + private: + void SetData4() + { + // Creates a new data object. + DataObject^ myDataObject = gcnew DataObject; + + // Adds UnicodeText string to the object, and set the autoConvert + // parameter to false. + myDataObject->SetData( DataFormats::UnicodeText, false, "My text String*" ); + + // Gets the data format(s) in the data object. + array^arrayOfFormats = myDataObject->GetFormats(); + + // Stores the results in a string. + String^ theResult = "The format(s) associated with the data are: \n"; + for ( int i = 0; i < arrayOfFormats->Length; i++ ) + theResult = theResult + arrayOfFormats[ i ], " \n"; + + // Show the results in a message box. + MessageBox::Show( theResult ); + } + // + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew SetData4::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp new file mode 100644 index 00000000000..2202cacf28f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SizeMode/CPP/form1.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + TabPage^ tabPage2 = gcnew TabPage; + TabPage^ tabPage3 = gcnew TabPage; + TabPage^ tabPage4 = gcnew TabPage; + TabPage^ tabPage5 = gcnew TabPage; + array^tabPages = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; + + // Sizes the tabs so that each row fills the entire width of tabControl1. + this->tabControl1->SizeMode = TabSizeMode::FillToRight; + this->tabControl1->Multiline = true; + this->tabControl1->Padding = Point(15,5); + array^temp0 = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; + this->tabControl1->Controls->AddRange( temp0 ); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + this->Size = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp b/snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp new file mode 100644 index 00000000000..18892c71e41 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SplitContainerEvents/CPP/splitcontainerevents.cpp @@ -0,0 +1,90 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::SplitContainer^ splitContainer1; + +public: + + // Create an empty Windows form. + Form1() + { + InitializeComponent(); + } + + +private: + void InitializeComponent() + { + splitContainer1 = gcnew System::Windows::Forms::SplitContainer; + splitContainer1->SuspendLayout(); + SuspendLayout(); + + // Place a basic SplitContainer control onto Form1. + splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill; + splitContainer1->Location = System::Drawing::Point( 0, 0 ); + splitContainer1->Name = "splitContainer1"; + splitContainer1->Size = System::Drawing::Size( 292, 273 ); + splitContainer1->SplitterDistance = 52; + splitContainer1->SplitterWidth = 6; + splitContainer1->TabIndex = 0; + splitContainer1->Text = "splitContainer1"; + + // Add the event handler for the SplitterMoved event. + splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved ); + + // Add the event handler for the SplitterMoving event. + splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving ); + + // This is the left panel of the vertical SplitContainer control. + splitContainer1->Panel1->Name = "splitterPanel1"; + + // This is the right panel of the vertical SplitContainer control. + splitContainer1->Panel2->Name = "splitterPanel2"; + + // Lay out the basic properties of the form. + ClientSize = System::Drawing::Size( 292, 273 ); + Controls->Add( splitContainer1 ); + Name = "Form1"; + Text = "Form1"; + splitContainer1->ResumeLayout( false ); + ResumeLayout( false ); + } + + void splitContainer1_SplitterMoved( System::Object^ /*sender*/, System::Windows::Forms::SplitterEventArgs^ /*e*/ ) + { + + // Define what happens when the splitter is no longer moving. + ::Cursor::Current = System::Windows::Forms::Cursors::Default; + } + + void splitContainer1_SplitterMoving( System::Object^ /*sender*/, System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ ) + { + + // Define what happens while the splitter is moving. + ::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert; + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp new file mode 100644 index 00000000000..b36e73c8558 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Splitter Example/CPP/form1.cpp @@ -0,0 +1,112 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + CreateMySplitControls(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + // +private: + void CreateMySplitControls() + { + // Create TreeView, ListView, and Splitter controls. + TreeView^ treeView1 = gcnew TreeView; + ListView^ listView1 = gcnew ListView; + Splitter^ splitter1 = gcnew Splitter; + + // Set the TreeView control to dock to the left side of the form. + treeView1->Dock = DockStyle::Left; + + // Set the Splitter to dock to the left side of the TreeView control. + splitter1->Dock = DockStyle::Left; + + // Set the minimum size the ListView control can be sized to. + splitter1->MinExtra = 100; + + // Set the minimum size the TreeView control can be sized to. + splitter1->MinSize = 75; + + // Set the ListView control to fill the remaining space on the form. + listView1->Dock = DockStyle::Fill; + + // Add a TreeView and a ListView item to identify the controls on the form. + treeView1->Nodes->Add( "TreeView Node" ); + listView1->Items->Add( "ListView Item" ); + + // Add the controls in reverse order to the form to ensure proper location. + array^temp0 = {listView1,splitter1,treeView1}; + this->Controls->AddRange( temp0 ); + } + // + +public: + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 384, 365 ); + this->Name = "Form1"; + this->Text = "Form1"; + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp new file mode 100644 index 00000000000..e4aa78ab726 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/StatusBar and StatusBarPanel Example/CPP/form1.cpp @@ -0,0 +1,144 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 152, 96 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 376, 293 ); + array^temp1 = {this->button1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void CreateMyStatusBar() + { + // Create a StatusBar control. + StatusBar^ statusBar1 = gcnew StatusBar; + + // Create two StatusBarPanel objects to display in the StatusBar. + StatusBarPanel^ panel1 = gcnew StatusBarPanel; + StatusBarPanel^ panel2 = gcnew StatusBarPanel; + + // Display the first panel with a sunken border style. + panel1->BorderStyle = StatusBarPanelBorderStyle::Sunken; + + // Initialize the text of the panel. + panel1->Text = "Ready..."; + + // Set the AutoSize property to use all remaining space on the StatusBar. + panel1->AutoSize = StatusBarPanelAutoSize::Spring; + + // Display the second panel with a raised border style. + panel2->BorderStyle = StatusBarPanelBorderStyle::Raised; + + // Create ToolTip text that displays the time the application + // was started. + panel2->ToolTipText = System::DateTime::Now.ToShortTimeString(); + + // Set the text of the panel to the current date. + panel2->Text = "Started: " + System::DateTime::Today.ToLongDateString(); + + // Set the AutoSize property to size the panel to the size of the contents. + panel2->AutoSize = StatusBarPanelAutoSize::Contents; + + // Display panels in the StatusBar control. + statusBar1->ShowPanels = true; + + // Add both panels to the StatusBarPanelCollection of the StatusBar. + statusBar1->Panels->Add( panel1 ); + statusBar1->Panels->Add( panel2 ); + + // Add the StatusBar to the form. + this->Controls->Add( statusBar1 ); + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + CreateMyStatusBar(); + } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp new file mode 100644 index 00000000000..ba6e38de238 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/StatusBar.DrawItem/CPP/form1.cpp @@ -0,0 +1,148 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace OwnerDrawnStatusBarPanel +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::StatusBar^ statusBar1; + System::Windows::Forms::StatusBarPanel^ statusBarPanel1; + System::Windows::Forms::StatusBarPanel^ statusBarPanel2; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + StatusBarPanel^ sbp = gcnew StatusBarPanel; + sbp->Width = 100; + sbp->Style = StatusBarPanelStyle::OwnerDraw; + statusBar1->Panels->Add( sbp ); + } + + protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->statusBar1 = gcnew System::Windows::Forms::StatusBar; + this->statusBarPanel1 = gcnew System::Windows::Forms::StatusBarPanel; + this->statusBarPanel2 = gcnew System::Windows::Forms::StatusBarPanel; + this->button1 = gcnew System::Windows::Forms::Button; + ((System::ComponentModel::ISupportInitialize^)(this->statusBarPanel1))->BeginInit(); + ((System::ComponentModel::ISupportInitialize^)(this->statusBarPanel2))->BeginInit(); + this->SuspendLayout(); + + // + // statusBar1 + // + this->statusBar1->Location = System::Drawing::Point( 0, 384 ); + this->statusBar1->Name = "statusBar1"; + array^statusBar1panels = {this->statusBarPanel1,this->statusBarPanel2}; + this->statusBar1->Panels->AddRange( statusBar1panels ); + this->statusBar1->ShowPanels = true; + this->statusBar1->Size = System::Drawing::Size( 536, 22 ); + this->statusBar1->TabIndex = 0; + this->statusBar1->Text = "statusBar1"; + this->statusBar1->DrawItem += gcnew System::Windows::Forms::StatusBarDrawItemEventHandler( this, &Form1::DrawMyPanel ); + + // + // statusBarPanel1 + // + this->statusBarPanel1->Text = "statusBarPanel1"; + + // + // statusBarPanel2 + // + this->statusBarPanel2->Text = "statusBarPanel2"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 336, 112 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 104, 32 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 536, 406 ); + array^formControls = {this->button1,this->statusBar1}; + this->Controls->AddRange( formControls ); + this->Name = "Form1"; + this->Text = "Form1"; + (dynamic_cast(this->statusBarPanel1))->EndInit(); + (dynamic_cast(this->statusBarPanel2))->EndInit(); + this->ResumeLayout( false ); + } + + // + private: + void DrawMyPanel( Object^ /*sender*/, System::Windows::Forms::StatusBarDrawItemEventArgs^ sbdevent ) + { + // Create a StringFormat object to align text in the panel. + StringFormat^ sf = gcnew StringFormat; + + // Format the String of the StatusBarPanel to be centered. + sf->Alignment = StringAlignment::Center; + sf->LineAlignment = StringAlignment::Center; + + // Draw a back blackground in owner-drawn panel. + sbdevent->Graphics->FillRectangle( Brushes::Black, sbdevent->Bounds ); + + // Draw the current date (short date format) with white text in the control's font. + sbdevent->Graphics->DrawString( DateTime::Today.ToShortDateString(), statusBar1->Font, Brushes::White, sbdevent->Bounds, sf ); + } + // + }; +} + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew OwnerDrawnStatusBarPanel::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp b/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp new file mode 100644 index 00000000000..abfc2d3bd7a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.ComponentModel.BackgroundWorker/CPP/fibonacciform.cpp @@ -0,0 +1,310 @@ + + +// +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Threading; +using namespace System::Windows::Forms; + +// +public ref class FibonacciForm: public System::Windows::Forms::Form +{ +private: + + // + int numberToCompute; + int highestPercentageReached; + // + + System::Windows::Forms::NumericUpDown^ numericUpDown1; + System::Windows::Forms::Button^ startAsyncButton; + System::Windows::Forms::Button^ cancelAsyncButton; + System::Windows::Forms::ProgressBar^ progressBar1; + System::Windows::Forms::Label ^ resultLabel; + System::ComponentModel::BackgroundWorker^ backgroundWorker1; + +public: + FibonacciForm() + { + InitializeComponent(); + numberToCompute = highestPercentageReached = 0; + InitializeBackgoundWorker(); + } + + +private: + + // Set up the BackgroundWorker object by + // attaching event handlers. + void InitializeBackgoundWorker() + { + backgroundWorker1->DoWork += gcnew DoWorkEventHandler( this, &FibonacciForm::backgroundWorker1_DoWork ); + backgroundWorker1->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler( this, &FibonacciForm::backgroundWorker1_RunWorkerCompleted ); + backgroundWorker1->ProgressChanged += gcnew ProgressChangedEventHandler( this, &FibonacciForm::backgroundWorker1_ProgressChanged ); + } + + // + void startAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Reset the text in the result label. + resultLabel->Text = String::Empty; + + // Disable the UpDown control until + // the asynchronous operation is done. + this->numericUpDown1->Enabled = false; + + // Disable the Start button until + // the asynchronous operation is done. + this->startAsyncButton->Enabled = false; + + // Enable the Cancel button while + // the asynchronous operation runs. + this->cancelAsyncButton->Enabled = true; + + // Get the value from the UpDown control. + numberToCompute = (int)numericUpDown1->Value; + + // Reset the variable for percentage tracking. + highestPercentageReached = 0; + + // + // Start the asynchronous operation. + backgroundWorker1->RunWorkerAsync( numberToCompute ); + // + } + // + + // + void cancelAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Cancel the asynchronous operation. + this->backgroundWorker1->CancelAsync(); + + // Disable the Cancel button. + cancelAsyncButton->Enabled = false; + } + // + + // + // This event handler is where the actual, + // potentially time-consuming work is done. + void backgroundWorker1_DoWork( Object^ sender, DoWorkEventArgs^ e ) + { + // Get the BackgroundWorker that raised this event. + BackgroundWorker^ worker = dynamic_cast(sender); + + // Assign the result of the computation + // to the Result property of the DoWorkEventArgs + // object. This is will be available to the + // RunWorkerCompleted eventhandler. + e->Result = ComputeFibonacci( safe_cast(e->Argument), worker, e ); + } + // + + // + // This event handler deals with the results of the + // background operation. + void backgroundWorker1_RunWorkerCompleted( Object^ /*sender*/, RunWorkerCompletedEventArgs^ e ) + { + // First, handle the case where an exception was thrown. + if ( e->Error != nullptr ) + { + MessageBox::Show( e->Error->Message ); + } + else + if ( e->Cancelled ) + { + // Next, handle the case where the user cancelled + // the operation. + // Note that due to a race condition in + // the DoWork event handler, the Cancelled + // flag may not have been set, even though + // CancelAsync was called. + resultLabel->Text = "Cancelled"; + } + else + { + // Finally, handle the case where the operation + // succeeded. + resultLabel->Text = e->Result->ToString(); + } + + // Enable the UpDown control. + this->numericUpDown1->Enabled = true; + + // Enable the Start button. + startAsyncButton->Enabled = true; + + // Disable the Cancel button. + cancelAsyncButton->Enabled = false; + } + // + + // + // This event handler updates the progress bar. + void backgroundWorker1_ProgressChanged( Object^ /*sender*/, ProgressChangedEventArgs^ e ) + { + this->progressBar1->Value = e->ProgressPercentage; + } + // + + // + // This is the method that does the actual work. For this + // example, it computes a Fibonacci number and + // reports progress as it does its work. + long ComputeFibonacci( int n, BackgroundWorker^ worker, DoWorkEventArgs ^ e ) + { + // The parameter n must be >= 0 and <= 91. + // Fib(n), with n > 91, overflows a long. + if ( (n < 0) || (n > 91) ) + { + throw gcnew ArgumentException( "value must be >= 0 and <= 91","n" ); + } + + long result = 0; + + // + // Abort the operation if the user has cancelled. + // Note that a call to CancelAsync may have set + // CancellationPending to true just after the + // last invocation of this method exits, so this + // code will not have the opportunity to set the + // DoWorkEventArgs.Cancel flag to true. This means + // that RunWorkerCompletedEventArgs.Cancelled will + // not be set to true in your RunWorkerCompleted + // event handler. This is a race condition. + // + if ( worker->CancellationPending ) + { + e->Cancel = true; + } + // + else + { + if ( n < 2 ) + { + result = 1; + } + else + { + result = ComputeFibonacci( n - 1, worker, e ) + ComputeFibonacci( n - 2, worker, e ); + } + + // + // Report progress as a percentage of the total task. + int percentComplete = (int)((float)n / (float)numberToCompute * 100); + if ( percentComplete > highestPercentageReached ) + { + highestPercentageReached = percentComplete; + worker->ReportProgress( percentComplete ); + } + // + } + // + + return result; + } + // + + void InitializeComponent() + { + this->numericUpDown1 = gcnew System::Windows::Forms::NumericUpDown; + this->startAsyncButton = gcnew System::Windows::Forms::Button; + this->cancelAsyncButton = gcnew System::Windows::Forms::Button; + this->resultLabel = gcnew System::Windows::Forms::Label; + this->progressBar1 = gcnew System::Windows::Forms::ProgressBar; + this->backgroundWorker1 = gcnew System::ComponentModel::BackgroundWorker; + (dynamic_cast(this->numericUpDown1))->BeginInit(); + this->SuspendLayout(); + + // + // numericUpDown1 + // + this->numericUpDown1->Location = System::Drawing::Point( 16, 16 ); + array^temp0 = {91,0,0,0}; + this->numericUpDown1->Maximum = System::Decimal( temp0 ); + array^temp1 = {1,0,0,0}; + this->numericUpDown1->Minimum = System::Decimal( temp1 ); + this->numericUpDown1->Name = "numericUpDown1"; + this->numericUpDown1->Size = System::Drawing::Size( 80, 20 ); + this->numericUpDown1->TabIndex = 0; + array^temp2 = {1,0,0,0}; + this->numericUpDown1->Value = System::Decimal( temp2 ); + + // + // startAsyncButton + // + this->startAsyncButton->Location = System::Drawing::Point( 16, 72 ); + this->startAsyncButton->Name = "startAsyncButton"; + this->startAsyncButton->Size = System::Drawing::Size( 120, 23 ); + this->startAsyncButton->TabIndex = 1; + this->startAsyncButton->Text = "Start Async"; + this->startAsyncButton->Click += gcnew System::EventHandler( this, &FibonacciForm::startAsyncButton_Click ); + + // + // cancelAsyncButton + // + this->cancelAsyncButton->Enabled = false; + this->cancelAsyncButton->Location = System::Drawing::Point( 153, 72 ); + this->cancelAsyncButton->Name = "cancelAsyncButton"; + this->cancelAsyncButton->Size = System::Drawing::Size( 119, 23 ); + this->cancelAsyncButton->TabIndex = 2; + this->cancelAsyncButton->Text = "Cancel Async"; + this->cancelAsyncButton->Click += gcnew System::EventHandler( this, &FibonacciForm::cancelAsyncButton_Click ); + + // + // resultLabel + // + this->resultLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + this->resultLabel->Location = System::Drawing::Point( 112, 16 ); + this->resultLabel->Name = "resultLabel"; + this->resultLabel->Size = System::Drawing::Size( 160, 23 ); + this->resultLabel->TabIndex = 3; + this->resultLabel->Text = "(no result)"; + this->resultLabel->TextAlign = System::Drawing::ContentAlignment::MiddleCenter; + + // + // progressBar1 + // + this->progressBar1->Location = System::Drawing::Point( 18, 48 ); + this->progressBar1->Name = "progressBar1"; + this->progressBar1->Size = System::Drawing::Size( 256, 8 ); + this->progressBar1->Step = 2; + this->progressBar1->TabIndex = 4; + + // + // backgroundWorker1 + // + this->backgroundWorker1->WorkerReportsProgress = true; + this->backgroundWorker1->WorkerSupportsCancellation = true; + + // + // FibonacciForm + // + this->ClientSize = System::Drawing::Size( 292, 118 ); + this->Controls->Add( this->progressBar1 ); + this->Controls->Add( this->resultLabel ); + this->Controls->Add( this->cancelAsyncButton ); + this->Controls->Add( this->startAsyncButton ); + this->Controls->Add( this->numericUpDown1 ); + this->Name = "FibonacciForm"; + this->Text = "Fibonacci Calculator"; + (dynamic_cast(this->numericUpDown1))->EndInit(); + this->ResumeLayout( false ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew FibonacciForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp new file mode 100644 index 00000000000..93c9b89a965 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BitmapMembers/CPP/form1.cpp @@ -0,0 +1,263 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + this->Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); + InitializeBitmap(); + InitializeStreamBitmap(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::PictureBox^ PictureBox1; + System::Windows::Forms::Button^ Button2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; + this->Button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // Button1 + // + this->Button1->Location = System::Drawing::Point( 24, 192 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 96, 23 ); + this->Button1->TabIndex = 2; + this->Button1->Text = "Rotate and Flip"; + + // + // PictureBox1 + // + this->PictureBox1->Location = System::Drawing::Point( 48, 40 ); + this->PictureBox1->Name = "PictureBox1"; + this->PictureBox1->Size = System::Drawing::Size( 168, 72 ); + this->PictureBox1->TabIndex = 3; + this->PictureBox1->TabStop = false; + + // + // Button2 + // + this->Button2->Location = System::Drawing::Point( 152, 192 ); + this->Button2->Name = "Button2"; + this->Button2->TabIndex = 4; + this->Button2->Text = "Button2"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->PictureBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // The following code example demonstrates constructing how to construct + // a new Bitmap from a file. + // This example is designed to be used with a Windows Forms that contains + // a PictureBox named PictureBox1. + // + // Paste the code into a form and call InitializeBitmap from the form's + // constructor or Load method. + // + + // + // The following code example demonstrates how to set the RotateFlip + // property of a Bitmap. + // This example is designed to be used with a Windows form that contains + // a PictureBox named PictureBox1 and a button named Button1. + // Paste the code to a form, call InitializeBitmap from the form's + // constructor or Load method and associate Button1_Click with the button's + // click event. Ensure the filepath to the bitmap is valid on + // your system. + // + // + // + Bitmap^ bitmap1; + void InitializeBitmap() + { + try + { + bitmap1 = dynamic_cast(Bitmap::FromFile( "C:\\Documents and Settings\\" + "All Users\\Documents\\My Music\\music.bmp" )); + PictureBox1->SizeMode = PictureBoxSizeMode::AutoSize; + PictureBox1->Image = bitmap1; + } + catch ( System::IO::FileNotFoundException^ ) + { + MessageBox::Show( "There was an error." + "Check the path to the bitmap." ); + } + + } + // + + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( bitmap1 != nullptr ) + { + bitmap1->RotateFlip( RotateFlipType::Rotate180FlipY ); + PictureBox1->Image = bitmap1; + } + } + // + + // The following code example demonstrates how to load a bitmap + // from an Icon handle, using the GraphicsUnit enumeration, and the + // the use of the RectangleF.Round method to draw the rectangle + // bounds of an icon. + // This example is designed to be used with Windows Forms. Create + // a form that contains a button named Button2. Paste the code into the + // form and associate this method with the button's Click event. + // + void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Bitmap^ bitmap1 = Bitmap::FromHicon( SystemIcons::Hand->Handle ); + Graphics^ formGraphics = this->CreateGraphics(); + GraphicsUnit units = GraphicsUnit::Point; + RectangleF bmpRectangleF = bitmap1->GetBounds( units ); + Rectangle bmpRectangle = Rectangle::Round( bmpRectangleF ); + formGraphics->DrawRectangle( Pens::Blue, bmpRectangle ); + delete formGraphics; + } + // + + // The following code example demonstrates how to load a bitmap + // from a stream. + // This example is designed to be used with Windows Forms. Create + // a form that contains a PictureBox named PictureBox1. Paste the code + // into the form and call InitializeStreamBitmap from the form's + // constructor or Load method. + // + void InitializeStreamBitmap() + { + try + { + System::Net::WebRequest^ request = System::Net::WebRequest::Create( "http://www.microsoft.com//h/en-us/r/ms_masthead_ltr.gif" ); + System::Net::WebResponse^ response = request->GetResponse(); + System::IO::Stream^ responseStream = response->GetResponseStream(); + Bitmap^ bitmap2 = gcnew Bitmap( responseStream ); + PictureBox1->Image = bitmap2; + } + catch ( System::Net::WebException^ ) + { + MessageBox::Show( "There was an error opening the image file." + "Check the URL" ); + } + + } + // + + // The following code example demonstrates how to use the Image.PixelFormat, + // Image.Height, Image.Width, and BitmapData.Scan0 properties; the Bitmap.LockBits + // and Bitmap.UnlockBits methods; and the ImageLockMode enumeration. + // This example is designed to be used with Windows + // Forms. To run this example, paste it into a form and handle the form's Paint event by + // calling the LockUnlockBitsExample method, passing e as PaintEventArgs. + // This example assumes the existence of an 24bpp image file named fakePhoto.jpg at c:\. + // + void LockUnlockBitsExample( PaintEventArgs^ e ) + { + // Create a new bitmap. + Bitmap^ bmp = gcnew Bitmap( "c:\\fakePhoto.jpg" ); + + // Lock the bitmap's bits. + Rectangle rect = Rectangle(0,0,bmp->Width,bmp->Height); + System::Drawing::Imaging::BitmapData^ bmpData = bmp->LockBits( rect, System::Drawing::Imaging::ImageLockMode::ReadWrite, bmp->PixelFormat ); + + // Get the address of the first line. + IntPtr ptr = bmpData->Scan0; + + // Declare an array to hold the bytes of the bitmap. + // This code is specific to a bitmap with 24 bits per pixels. + int bytes = Math::Abs(bmpData->Stride) * bmp->Height; + array^rgbValues = gcnew array(bytes); + + // Copy the RGB values into the array. + System::Runtime::InteropServices::Marshal::Copy( ptr, rgbValues, 0, bytes ); + + // Set every third value to 255. + for ( int counter = 2; counter < rgbValues->Length; counter += 3 ) + rgbValues[ counter ] = 255; + + // Copy the RGB values back to the bitmap + System::Runtime::InteropServices::Marshal::Copy( rgbValues, 0, ptr, bytes ); + + // Unlock the bits. + bmp->UnlockBits( bmpData ); + + // Draw the modified image. + e->Graphics->DrawImage( bmp, 0, 150 ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp new file mode 100644 index 00000000000..6b09806af55 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.BmpCtorAndSave/cpp/form1.cpp @@ -0,0 +1,112 @@ +#using +#using +#using +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::IO; + +public ref class Form1: public Form +{ +#pragma region " Windows Form Designer generated code " + +public: + Form1() : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + + //Form overrides dispose to clean up the component list. +protected: + ~Form1() + { + if (components != nullptr) + { + delete components; + } + } + + //Required by the Windows Form Designer +private: + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. +private: + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(292, 266); + this->Name = "Form1"; + this->Text = "Form1"; + this->Paint += + gcnew System::Windows::Forms::PaintEventHandler + (this,&Form1::Form1_Paint); + } + +#pragma endregion + + // +private: + void ConstructFromResourceSaveAsGif(PaintEventArgs^ e) + { + // Construct a bitmap from the button image resource. + Bitmap^ bmp1 = gcnew Bitmap(Button::typeid, "Button.bmp"); + String^ savePath = + Environment::GetEnvironmentVariable("TEMP") + "\\Button.bmp"; + + try + { + // Save the image as a GIF. + bmp1->Save(savePath, System::Drawing::Imaging::ImageFormat::Gif); + } + catch (IOException^) + { + // Carry on regardless + } + + // Construct a new image from the GIF file. + Bitmap^ bmp2 = nullptr; + if (File::Exists(savePath)) + { + bmp2 = gcnew Bitmap(savePath); + } + + // Draw the two images. + e->Graphics->DrawImage(bmp1, Point(10, 10)); + + // If bmp1 did not save to disk, bmp2 may be null + if (bmp2 != nullptr) + { + e->Graphics->DrawImage(bmp2, Point(10, 40)); + } + + // Dispose of the image files. + delete bmp1; + if (bmp2 != nullptr) + { + delete bmp2; + } + } + // + +private: + void Form1_Paint(Object^ sender, PaintEventArgs^ e) + { + ConstructFromResourceSaveAsGif(e); + } +}; + +[STAThread] +int main() +{ + Application::Run(gcnew Form1()); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp new file mode 100644 index 00000000000..d545aaff2d2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.CharacterRangeExample/CPP/form1.cpp @@ -0,0 +1,197 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + this->Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Button^ Button2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 40, 208 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Button1"; + + // + //Button2 + // + this->Button2->Location = System::Drawing::Point( 152, 208 ); + this->Button2->Name = "Button2"; + this->Button2->TabIndex = 1; + this->Button2->Text = "Button2"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // The following code example demonstrates how to create a CharacterRange + // and use it to highlight part of a string. This sample is designed to be + // used with Windows Forms. Paste the example into a form and + // call the HighlightACharacterRange method when handling the + // form's Paint event, passing e as PaintEventArgs. + // + // + void HighlightACharacterRange( PaintEventArgs^ e ) + { + // Declare the string to draw. + String^ message = "This is the string to highlight a word in."; + + // Declare the word to highlight. + String^ searchWord = "string"; + + // Create a CharacterRange array with the searchWord + // location and length. + array^ temp = {CharacterRange( message->IndexOf( searchWord ), searchWord->Length )}; + array^ranges = temp; + + // Construct a StringFormat object. + StringFormat^ stringFormat1 = gcnew StringFormat; + + // Set the ranges on the StringFormat object. + stringFormat1->SetMeasurableCharacterRanges( ranges ); + + // Declare the font to write the message in. + System::Drawing::Font^ largeFont = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,16.0F,GraphicsUnit::Pixel ); + + // Construct a new Rectangle. + Rectangle displayRectangle = Rectangle(20,20,200,100); + + // Convert the Rectangle to a RectangleF. + RectangleF displayRectangleF = displayRectangle; + + // Get the Region to highlight by calling the + // MeasureCharacterRanges method. + array^charRegion = e->Graphics->MeasureCharacterRanges( message, largeFont, displayRectangleF, stringFormat1 ); + + // Draw the message string on the form. + e->Graphics->DrawString( message, largeFont, Brushes::Blue, displayRectangleF ); + + // Fill in the region using a semi-transparent color. + e->Graphics->FillRegion( gcnew SolidBrush( Color::FromArgb( 50, Color::Fuchsia ) ), charRegion[ 0 ] ); + delete largeFont; + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + HighlightACharacterRange( e ); + } + + // The following code example demonstrates the Color.op_Equality operator. + // This example is designed to be used with a Windows Form that + // contains a button named Button1. Paste the following code into + // your form and associate the Button1_Click method with the button's + // Click event. + // + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( this->BackColor == SystemColors::ControlDark ) + { + this->BackColor = SystemColors::Control; + } + } + // + + // The following code example demonstrates the Color.op_Inequality + // operator. This example is designed to be used with a Windows Form + // that contains a button named Button2. Paste the following code + // into your form and associate the Button2_Click method with the + // button's Click event. + // + void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( this->BackColor != SystemColors::ControlDark ) + { + this->BackColor = SystemColors::ControlDark; + } + + if ( !(this->Font->Bold) ) + { + this->Font = gcnew System::Drawing::Font( this->Font,FontStyle::Bold ); + } + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp new file mode 100644 index 00000000000..500f519a918 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicBitmapExamples/CPP/form1.cpp @@ -0,0 +1,297 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Runtime::InteropServices; +using namespace System::Security::Permissions; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); + } + + + // +private: + void Clone_Example1( PaintEventArgs^ e ) + { + // Create a Bitmap object from a file. + Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); + + // Clone a portion of the Bitmap object. + Rectangle cloneRect = Rectangle(0,0,100,100); + System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat; + Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format ); + + // Draw the cloned portion of the Bitmap object. + e->Graphics->DrawImage( cloneBitmap, 0, 0 ); + } + // + + // +private: + void Clone_Example2( PaintEventArgs^ e ) + { + // Create a Bitmap object from a file. + Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); + + // Clone a portion of the Bitmap object. + RectangleF cloneRect = RectangleF(0,0,100,100); + System::Drawing::Imaging::PixelFormat format = myBitmap->PixelFormat; + Bitmap^ cloneBitmap = myBitmap->Clone( cloneRect, format ); + + // Draw the cloned portion of the Bitmap object. + e->Graphics->DrawImage( cloneBitmap, 0, 0 ); + } + // + + // +private: + [System::Runtime::InteropServices::DllImportAttribute("user32.dll", CharSet = CharSet::Unicode)] + static IntPtr LoadImage( int Hinstance, String^ name, int type, int width, int height, int load ); + +private: + void Hicon_Example( PaintEventArgs^ e ) + { + + // Get a handle to an icon. + IntPtr Hicon = LoadImage( 0, "smile.ico", 1, 0, 0, 16 ); + + // Create a Bitmap object from the icon handle. + Bitmap^ iconBitmap = Bitmap::FromHicon( Hicon ); + + // Draw the Bitmap object to the screen. + e->Graphics->DrawImage( iconBitmap, 0, 0 ); + } + // + + // + // + [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] + static bool DeleteObject( IntPtr hObject ); + // + +private: + void DemonstrateGetHbitmap() + { + Bitmap^ bm = gcnew Bitmap( "Picture.jpg" ); + IntPtr hBitmap = bm->GetHbitmap(); + + // Do something with hBitmap. + DeleteObject( hBitmap ); + } + // + + // + void DemonstrateGetHbitmapWithColor() + { + Bitmap^ bm = gcnew Bitmap( "Picture.jpg" ); + IntPtr hBitmap = bm->GetHbitmap( Color::Blue ); + + // Do something with hBitmap. + DeleteObject( hBitmap ); + } + // + + // +private: + [System::Runtime::InteropServices::DllImportAttribute("user32.dll",CharSet=CharSet::Auto)] + static bool DestroyIcon( IntPtr handle ); + +private: + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + void GetHicon_Example( PaintEventArgs^ e ) + { + + // Create a Bitmap object from an image file. + Bitmap^ myBitmap = gcnew Bitmap( "c:\\FakePhoto.jpg" ); + + // Draw myBitmap to the screen. + e->Graphics->DrawImage( myBitmap, 0, 0 ); + + // Get an Hicon for myBitmap. + IntPtr Hicon = myBitmap->GetHicon(); + + // Create a new icon from the handle. + System::Drawing::Icon^ newIcon = ::Icon::FromHandle( Hicon ); + + // Set the form Icon attribute to the new icon. + this->Icon = newIcon; + + // You can now destroy the Icon, since the form creates + // its own copy of the icon accesible through the Form.Icon property. + DestroyIcon( newIcon->Handle ); + } + // + + // +private: + void GetPixel_Example( PaintEventArgs^ e ) + { + // Create a Bitmap object from an image file. + Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); + + // Get the color of a pixel within myBitmap. + Color pixelColor = myBitmap->GetPixel( 50, 50 ); + + // Fill a rectangle with pixelColor. + SolidBrush^ pixelBrush = gcnew SolidBrush( pixelColor ); + e->Graphics->FillRectangle( pixelBrush, 0, 0, 100, 100 ); + } + // + + // +private: + void MakeTransparent_Example1( PaintEventArgs^ e ) + { + // Create a Bitmap object from an image file. + Bitmap^ myBitmap = gcnew Bitmap( "Grapes.gif" ); + + // Draw myBitmap to the screen. + e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); + + // Make the default transparent color transparent for myBitmap. + myBitmap->MakeTransparent(); + + // Draw the transparent bitmap to the screen. + e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); + } + // + + // +private: + void MakeTransparent_Example2( PaintEventArgs^ e ) + { + // Create a Bitmap object from an image file. + Bitmap^ myBitmap = gcnew Bitmap( "Grapes.gif" ); + + // Draw myBitmap to the screen. + e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); + + // Get the color of a background pixel. + Color backColor = myBitmap->GetPixel( 1, 1 ); + + // Make backColor transparent for myBitmap. + myBitmap->MakeTransparent( backColor ); + + // Draw the transparent bitmap to the screen. + e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); + } + // + + // +private: + void SetPixel_Example( PaintEventArgs^ e ) + { + // Create a Bitmap object from a file. + Bitmap^ myBitmap = gcnew Bitmap( "Grapes.jpg" ); + + // Draw myBitmap to the screen. + e->Graphics->DrawImage( myBitmap, 0, 0, myBitmap->Width, myBitmap->Height ); + + // Set each pixel in myBitmap to black. + for ( int Xcount = 0; Xcount < myBitmap->Width; Xcount++ ) + { + for ( int Ycount = 0; Ycount < myBitmap->Height; Ycount++ ) + { + myBitmap->SetPixel( Xcount, Ycount, Color::Black ); + } + } + + // Draw myBitmap to the screen again. + e->Graphics->DrawImage( myBitmap, myBitmap->Width, 0, myBitmap->Width, myBitmap->Height ); + } + // + +private: + void Form1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ /*e*/ ){} +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp new file mode 100644 index 00000000000..1b2db978dc5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorExamples/CPP/form1.cpp @@ -0,0 +1,568 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + +public: + + // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32) + // + void FromArgb4( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Transparent red, green, and blue brushes. + SolidBrush^ trnsRedBrush = gcnew SolidBrush( Color::FromArgb( 0x78FF0000 ) ); + SolidBrush^ trnsGreenBrush = gcnew SolidBrush( Color::FromArgb( 0x7800FF00 ) ); + SolidBrush^ trnsBlueBrush = gcnew SolidBrush( Color::FromArgb( 0x780000FF ) ); + + // Base and height of the triangle that is used to position the + // circles. Each vertex of the triangle is at the center of one of the + // 3 circles. The base is equal to the diameter of the circles. + float triBase = 100; + float triHeight = (float)Math::Sqrt( 3 * (triBase * triBase) / 4 ); + + // coordinates of first circle's bounding rectangle. + float x1 = 40; + float y1 = 40; + + // Fill 3 over-lapping circles. Each circle is a different color. + g->FillEllipse( trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight ); + g->FillEllipse( trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, 2 * triHeight, 2 * triHeight ); + g->FillEllipse( trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, 2 * triHeight ); + } + // + + // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32,System.Drawing.Color) + // + void FromArgb3( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Opaque colors (alpha value defaults to 255 -- max value). + Color red = Color::FromArgb( 255, 0, 0 ); + Color green = Color::FromArgb( 0, 255, 0 ); + Color blue = Color::FromArgb( 0, 0, 255 ); + + // Solid brush initialized to red. + SolidBrush^ myBrush = gcnew SolidBrush( red ); + int alpha; + + // x coordinate of first red rectangle + int x = 50; + + // y coordinate of first red rectangle + int y = 50; + + // Fill rectangles with red, varying the alpha value from 25 to 250. + for ( alpha = 25; alpha <= 250; alpha += 25 ) + { + myBrush->Color = Color::FromArgb( alpha, red ); + g->FillRectangle( myBrush, x, y, 50, 100 ); + g->FillRectangle( myBrush, x, y + 250, 50, 50 ); + x += 50; + } + x = 50; + + // y coordinate of first green rectangle + y += 50; + + // Fill rectangles with green, varying the alpha value from 25 to 250. + for ( alpha = 25; alpha <= 250; alpha += 25 ) + { + myBrush->Color = Color::FromArgb( alpha, green ); + g->FillRectangle( myBrush, x, y, 50, 150 ); + x += 50; + } + x = 50; + + // y coordinate of first blue rectangle + y += 100; + + // Fill rectangles with blue, varying the alpha value from 25 to 250. + for ( alpha = 25; alpha <= 250; alpha += 25 ) + { + myBrush->Color = Color::FromArgb( alpha, blue ); + g->FillRectangle( myBrush, x, y, 50, 150 ); + x += 50; + } + } + // + + // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32,System.Int32,System.Int32) + // + void FromArgb2( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Opaque colors (alpha value defaults to 255 -- max value). + Color red = Color::FromArgb( 255, 0, 0 ); + Color green = Color::FromArgb( 0, 255, 0 ); + Color blue = Color::FromArgb( 0, 0, 255 ); + + // Solid brush initialized to red. + SolidBrush^ myBrush = gcnew SolidBrush( red ); + int alpha; + + // x coordinate of first red rectangle + int x = 50; + + // y coordinate of first red rectangle + int y = 50; + + // Fill rectangles with red, varying the alpha value from 25 to 250. + for ( alpha = 25; alpha <= 250; alpha += 25 ) + { + myBrush->Color = Color::FromArgb( alpha, red ); + g->FillRectangle( myBrush, x, y, 50, 100 ); + g->FillRectangle( myBrush, x, y + 250, 50, 50 ); + x += 50; + } + x = 50; + + // y coordinate of first green rectangle. + y += 50; + + // Fill rectangles with green, varying the alpha value from 25 to 250. + for ( alpha = 25; alpha <= 250; alpha += 25 ) + { + myBrush->Color = Color::FromArgb( alpha, green ); + g->FillRectangle( myBrush, x, y, 50, 150 ); + x += 50; + } + x = 50; + + // y coordinate of first blue rectangle. + y += 100; + + // Fill rectangles with blue, varying the alpha value from 25 to 250. + for ( alpha = 25; alpha <= 250; alpha += 25 ) + { + myBrush->Color = Color::FromArgb( alpha, blue ); + g->FillRectangle( myBrush, x, y, 50, 150 ); + x += 50; + } + } + // + + // Snippet for: M:System.Drawing.Color.FromArgb(System.Int32,System.Int32,System.Int32,System.Int32) + // + void FromArgb1( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Transparent red, green, and blue brushes. + SolidBrush^ trnsRedBrush = gcnew SolidBrush( Color::FromArgb( 120, 255, 0, 0 ) ); + SolidBrush^ trnsGreenBrush = gcnew SolidBrush( Color::FromArgb( 120, 0, 255, 0 ) ); + SolidBrush^ trnsBlueBrush = gcnew SolidBrush( Color::FromArgb( 120, 0, 0, 255 ) ); + + // Base and height of the triangle that is used to position the + // circles. Each vertex of the triangle is at the center of one of the + // 3 circles. The base is equal to the diameter of the circles. + float triBase = 100; + float triHeight = (float)Math::Sqrt( 3 * (triBase * triBase) / 4 ); + + // Coordinates of first circle's bounding rectangle. + float x1 = 40; + float y1 = 40; + + // Fill 3 over-lapping circles. Each circle is a different color. + g->FillEllipse( trnsRedBrush, x1, y1, 2 * triHeight, 2 * triHeight ); + g->FillEllipse( trnsGreenBrush, x1 + triBase / 2, y1 + triHeight, 2 * triHeight, 2 * triHeight ); + g->FillEllipse( trnsBlueBrush, x1 + triBase, y1, 2 * triHeight, 2 * triHeight ); + } + // + + // Snippet for: M:System.Drawing.Color.FromKnownColor(System.Drawing.KnownColor) + // + void KnownColorBrightnessExample1( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Color structures. One is a variable used for temporary storage. The other + // is a constant used for comparisons. + Color someColor = Color::FromArgb( 0 ); + Color redShade = Color::FromArgb( 255, 200, 0, 100 ); + + // Array to store KnownColor values that match the brightness of the + // redShade color. + array^colorMatches = gcnew array(15); + + // Number of matches found. + int count = 0; + + // Iterate through the KnownColor enums until 15 matches are found. + for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) + { + someColor = Color::FromKnownColor( enumValue ); + if ( someColor.GetBrightness() == redShade.GetBrightness() ) + colorMatches[ count++ ] = enumValue; + } + + // Display the redShade color and its argb value. + SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); + int x = 20; + int y = 20; + someColor = redShade; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + + // Iterate through the matches that were found and display each color that + // Corresponds with the enum value in the array. also display the name of + // The KnownColor. + for ( int i = 0; i < count; i++ ) + { + y += 40; + someColor = Color::FromKnownColor( colorMatches[ i ] ); + myBrush1->Color = someColor; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + } + } + // + + // Snippet for: M:System.Drawing.Color.GetBrightness + // + void KnownColorBrightnessExample2( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Color structures. One is a variable used for temporary storage. The other + // is a constant used for comparisons. + Color someColor = Color::FromArgb( 0 ); + Color redShade = Color::FromArgb( 255, 200, 0, 100 ); + + // Array to store KnownColor values that match the brightness of the + // redShade color. + array^colorMatches = gcnew array(15); + + // Number of matches found. + int count = 0; + + // Iterate through the KnownColor enums until 15 matches are found. + for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) + { + someColor = Color::FromKnownColor( enumValue ); + if ( someColor.GetBrightness() == redShade.GetBrightness() ) + colorMatches[ count++ ] = enumValue; + } + + // display the redShade color and its argb value. + SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); + int x = 20; + int y = 20; + someColor = redShade; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + + // Iterate through the matches that were found and display each color that + // corresponds with the enum value in the array. also display the name of + // The KnownColor. + for ( int i = 0; i < count; i++ ) + { + y += 40; + someColor = Color::FromKnownColor( colorMatches[ i ] ); + myBrush1->Color = someColor; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + } + } + // + + // Snippet for: M:System.Drawing.Color.GetHue + // + void GetHueExample( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Color structures. One is a variable used for temporary storage. The other + // is a constant used for comparisons. + Color someColor = Color::FromArgb( 0 ); + Color redShade = Color::FromArgb( 255, 200, 0, 100 ); + + // Array to store KnownColor values that match the hue of the redShade + // color. + array^colorMatches = gcnew array(15); + + // Number of matches found. + int count = 0; + + // Iterate through the KnownColor enums until 15 matches are found. + for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) + { + someColor = Color::FromKnownColor( enumValue ); + if ( someColor.GetHue() == redShade.GetHue() ) + colorMatches[ count++ ] = enumValue; + } + + // Display the redShade color and its argb value. + SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); + int x = 20; + int y = 20; + someColor = redShade; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + + // Iterate through the matches that were found and display each color that + // corresponds with the enum value in the array. also display the name of + // the KnownColor. + for ( int i = 0; i < count; i++ ) + { + y += 40; + someColor = Color::FromKnownColor( colorMatches[ i ] ); + myBrush1->Color = someColor; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + } + } + // + + // Snippet for: M:System.Drawing.Color.GetSaturation + // + void GetSatExample( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Color structures. One is a variable used for temporary storage. The other + // is a constant used for comparisons. + Color someColor = Color::FromArgb( 0 ); + Color redShade = Color::FromArgb( 255, 200, 0, 100 ); + + // Array to store KnownColor values that match the saturation of the + // redShade color. + array^colorMatches = gcnew array(15); + + // Number of matches found. + int count = 0; + + // Iterate through the KnownColor enums until 15 matches are found. + for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen && count < 15; enumValue = enumValue + (KnownColor)1 ) + { + someColor = Color::FromKnownColor( enumValue ); + if ( someColor.GetSaturation() == redShade.GetSaturation() ) + colorMatches[ count++ ] = enumValue; + } + + // Display the redShade color and its argb value. + SolidBrush^ myBrush1 = gcnew SolidBrush( redShade ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",12 ); + int x = 20; + int y = 20; + someColor = redShade; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + + // Iterate through the matches that were found and display each color that + // corresponds with the enum value in the array. also display the name of + // the KnownColor. + for ( int i = 0; i < count; i++ ) + { + y += 40; + someColor = Color::FromKnownColor( colorMatches[ i ] ); + myBrush1->Color = someColor; + g->FillRectangle( myBrush1, x, y, 100, 30 ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 120, (float)y ); + } + } + // + + // Snippet for: M:System.Drawing.Color.ToArgb + // + void ToArgbToStringExample1( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Color structure used for temporary storage. + Color someColor = Color::FromArgb( 0 ); + + // Array to store KnownColor values that match the criteria. + array^colorMatches = gcnew array(167); + + // Number of matches found. + int count = 0; + + // Iterate through the KnownColor enums to find all corresponding colors + // that have a nonzero green component and zero-value red component and + // that are not system colors. + for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen; enumValue = enumValue + (KnownColor)1 ) + { + someColor = Color::FromKnownColor( enumValue ); + if ( someColor.G != 0 && someColor.R == 0 && !someColor.IsSystemColor ) + colorMatches[ count++ ] = enumValue; + } + SolidBrush^ myBrush1 = gcnew SolidBrush( someColor ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",9 ); + int x = 40; + int y = 40; + + // Iterate through the matches that were found and display each color that + // corresponds with the enum value in the array. also display the name of + // the KnownColor and the ARGB components. + for ( int i = 0; i < count; i++ ) + { + // Display the color. + someColor = Color::FromKnownColor( colorMatches[ i ] ); + myBrush1->Color = someColor; + g->FillRectangle( myBrush1, x, y, 50, 30 ); + + // Display KnownColor name and the four component values. To display the + // component values: Use the ToArgb method to get the 32-bit ARGB value + // of someColor, which was created from a KnownColor. Then create a + // Color structure from the 32-bit ARGB value and set someColor equal to + // this new Color structure. Then use the ToString method to convert it to + // a string. + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y ); + someColor = Color::FromArgb( someColor.ToArgb() ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y + 15 ); + y += 40; + } + } + // + + // Snippet for: M:System.Drawing.Color.ToString + // + void ToArgbToStringExample2( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Color structure used for temporary storage. + Color someColor = Color::FromArgb( 0 ); + + // Array to store KnownColor values that match the criteria. + array^colorMatches = gcnew array(167); + + // Number of matches found. + int count = 0; + + // Iterate through the KnownColor enums to find all corresponding colors + // that have a nonzero green component and zero-value red component and + // that are not system colors. + for ( KnownColor enumValue = (KnownColor)0; enumValue <= KnownColor::YellowGreen; enumValue = enumValue + (KnownColor)1 ) + { + someColor = Color::FromKnownColor( enumValue ); + if ( someColor.G != 0 && someColor.R == 0 && !someColor.IsSystemColor ) + colorMatches[ count++ ] = enumValue; + } + SolidBrush^ myBrush1 = gcnew SolidBrush( someColor ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",9 ); + int x = 40; + int y = 40; + + // Iterate through the matches that were found and display each color that + // corresponds with the enum value in the array. also display the name of + // the KnownColor and the ARGB components. + for ( int i = 0; i < count; i++ ) + { + // Display the color. + someColor = Color::FromKnownColor( colorMatches[ i ] ); + myBrush1->Color = someColor; + g->FillRectangle( myBrush1, x, y, 50, 30 ); + + // Display KnownColor name and the four component values. To display the + // component values: Use the ToArgb method to get the 32-bit ARGB value + // of someColor, which was created from a KnownColor. Then create a + // Color structure from the 32-bit ARGB value and set someColor equal to + // this new Color structure. Then use the ToString method to convert it to + // a string. + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y ); + someColor = Color::FromArgb( someColor.ToArgb() ); + g->DrawString( someColor.ToString(), myFont, Brushes::Black, (float)x + 55, (float)y + 15 ); + y += 40; + } + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp new file mode 100644 index 00000000000..704918f8b6f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicColorTranslatorExamples/CPP/form1.cpp @@ -0,0 +1,192 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.ColorTranslator.FromHtml(System.String) + // +public: + void FromHtml_Example( PaintEventArgs^ e ) + { + // Create a string representation of an HTML color. + String^ htmlColor = "Blue"; + + // Translate htmlColor to a GDI+ Color structure. + Color myColor = ColorTranslator::FromHtml( htmlColor ); + + // Fill a rectangle with myColor. + e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.ColorTranslator.FromOle(System.Int32) + // +public: + void FromOle_Example( PaintEventArgs^ e ) + { + // Create an integer representation of an OLE color. + int oleColor = 0xFF00; + + // Translate oleColor to a GDI+ Color structure. + Color myColor = ColorTranslator::FromOle( oleColor ); + + // Fill a rectangle with myColor. + e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.ColorTranslator.FromWin32(System.Int32) + // +public: + void FromWin32_Example( PaintEventArgs^ e ) + { + // Create an integer representation of a Windows color. + int winColor = 0xA000; + + // Translate winColor to a GDI+ Color structure. + Color myColor = ColorTranslator::FromWin32( winColor ); + + // Fill a rectangle with myColor. + e->Graphics->FillRectangle( gcnew SolidBrush( myColor ), 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.ColorTranslator.ToHtml(System.Drawing.Color) + // +public: + void ToHtml_Example( PaintEventArgs^ /*e*/ ) + { + // Create an instance of a Color structure. + Color myColor = Color::Red; + + // Translate myColor to an HTML color. + String^ htmlColor = ColorTranslator::ToHtml( myColor ); + + // Show a message box with the value of htmlColor. + MessageBox::Show( htmlColor ); + } + // + + // Snippet for: M:System.Drawing.ColorTranslator.ToOle(System.Drawing.Color) + // +public: + void ToOle_Example( PaintEventArgs^ /*e*/ ) + { + // Create an instance of a Color structure. + Color myColor = Color::Red; + + // Translate myColor to an OLE color. + int oleColor = ColorTranslator::ToOle( myColor ); + + // Show a message box with the value of oleColor. + MessageBox::Show( oleColor.ToString() ); + } + // + + // Snippet for: M:System.Drawing.ColorTranslator.ToWin32(System.Drawing.Color) + // +public: + void ToWin32_Example( PaintEventArgs^ /*e*/ ) + { + // Create an instance of a Color structure. + Color myColor = Color::Red; + + // Translate myColor to an OLE color. + int winColor = ColorTranslator::ToWin32( myColor ); + + // Show a message box with the value of winColor. + MessageBox::Show( winColor.ToString() ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp new file mode 100644 index 00000000000..652478b4d00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontFamilyExamples/CPP/form1.cpp @@ -0,0 +1,276 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.FontFamily.Equals(System.Object) + // +public: + void Equals_Example( PaintEventArgs^ /*e*/ ) + { + // Create two FontFamily objects. + FontFamily^ firstFontFamily = gcnew FontFamily( "Arial" ); + FontFamily^ secondFontFamily = gcnew FontFamily( "Times New Roman" ); + + // Check to see if the two font families are equivalent. + bool equalFonts = firstFontFamily->Equals( secondFontFamily ); + + // Display the result of the test in a message box. + MessageBox::Show( equalFonts.ToString() ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetCellAscent(System.Drawing.FontStyle) + // +public: + void GetCellAscent_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ ascentFontFamily = gcnew FontFamily( "arial" ); + + // Get the cell ascent of the font family in design units. + int cellAscent = ascentFontFamily->GetCellAscent( FontStyle::Regular ); + + // Draw the result as a string to the screen. + e->Graphics->DrawString( String::Format( "ascentFontFamily.GetCellAscent() returns {0}.", cellAscent ), + gcnew System::Drawing::Font( ascentFontFamily,16 ), Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetCellDescent(System.Drawing.FontStyle) + // +public: + void GetCellDescent_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ descentFontFamily = gcnew FontFamily( "arial" ); + + // Get the cell descent of the font family in design units. + int cellDescent = descentFontFamily->GetCellDescent( FontStyle::Regular ); + + // Draw the result as a string to the screen. + e->Graphics->DrawString( String::Format( "descentFontFamily.GetCellDescent() returns {0}.", cellDescent ), + gcnew System::Drawing::Font( descentFontFamily,16 ), Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetEmHeight(System.Drawing.FontStyle) + // +public: + void GetEmHeight_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ emFontFamily = gcnew FontFamily( "arial" ); + + // Get the em height of the font family in design units. + int emHeight = emFontFamily->GetEmHeight( FontStyle::Regular ); + + // Draw the result as a string to the screen. + e->Graphics->DrawString( String::Format( "emFontFamily.GetEmHeight() returns {0}.", emHeight ), + gcnew System::Drawing::Font( emFontFamily,16 ), Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetFamilies(System.Drawing.Graphics) + // +public: + void GetFamilies_Example( PaintEventArgs^ e ) + { + // Get an array of the available font families. + array^families = FontFamily::GetFamilies( e->Graphics ); + + // Draw text using each of the font families. + System::Drawing::Font^ familiesFont; + String^ familyString; + float spacing = 0; + IEnumerator^ myEnum = families->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FontFamily^ family = safe_cast(myEnum->Current); + if ( family->IsStyleAvailable( FontStyle::Regular ) ) + { + familiesFont = gcnew System::Drawing::Font( family,16 ); + familyString = String::Format( "This is the {0} family.", family->Name ); + e->Graphics->DrawString( familyString, familiesFont, Brushes::Black, PointF(0,spacing) ); + spacing += familiesFont->Height; + } + } + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetHashCode + // +public: + void GetHashCode_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); + + // Get the hash code for myFontFamily. + int hashCode = myFontFamily->GetHashCode(); + + // Draw the value of hashCode to the screen as a string. + e->Graphics->DrawString( String::Format( "hashCode = {0}", hashCode ), + gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetLineSpacing(System.Drawing.FontStyle) + // +public: + void GetLineSpacing_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); + + // Get the line spacing for myFontFamily. + int lineSpacing = myFontFamily->GetLineSpacing( FontStyle::Regular ); + + // Draw the value of lineSpacing to the screen as a string. + e->Graphics->DrawString( String::Format( "lineSpacing = {0}", lineSpacing ), + gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.GetName(System.Int32) + // +public: + void GetName_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); + + // Get the name of myFontFamily. + String^ familyName = myFontFamily->GetName( 0 ); + + // Draw the name of the myFontFamily to the screen as a string. + e->Graphics->DrawString( String::Format( "The family name is {0}", familyName ), + gcnew System::Drawing::Font( myFontFamily,16 ), Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.FontFamily.IsStyleAvailable(System.Drawing.FontStyle) + // +public: + void IsStyleAvailable_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); + + // Test whether myFontFamily is available in Italic. + if ( myFontFamily->IsStyleAvailable( FontStyle::Italic ) ) + { + // Create a Font object using myFontFamily. + System::Drawing::Font^ familyFont = gcnew System::Drawing::Font( myFontFamily,16,FontStyle::Italic ); + + // Use familyFont to draw text to the screen. + e->Graphics->DrawString( myFontFamily->Name + " is available in Italic", + familyFont, Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.FontFamily.ToString + // +public: + void ToString_Example( PaintEventArgs^ e ) + { + // Create a FontFamily object. + FontFamily^ myFontFamily = gcnew FontFamily( "Arial" ); + + // Draw a string representation of myFontFamily to the screen. + e->Graphics->DrawString( myFontFamily->ToString(), gcnew System::Drawing::Font( myFontFamily,16 ), + Brushes::Black, PointF(0,0) ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp new file mode 100644 index 00000000000..f5605530837 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicFontsExamples/CPP/form1.cpp @@ -0,0 +1,224 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Font.Clone + // +public: + void Clone_Example( PaintEventArgs^ e ) + { + // Create a Font object. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Create a copy of myFont. + System::Drawing::Font^ cloneFont = dynamic_cast(myFont->Clone()); + + // Use cloneFont to draw text to the screen. + e->Graphics->DrawString( "This is a cloned font", cloneFont, Brushes::Black, 0, 0 ); + } + // + + // Snippet for: M:System.Drawing.Font.Equals(System.Object) + // +public: + void Equals_Example( PaintEventArgs^ /*e*/ ) + { + // Create a Font object. + System::Drawing::Font^ firstFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Create a second Font object. + System::Drawing::Font^ secondFont = gcnew System::Drawing::Font( gcnew FontFamily( "Arial" ),16 ); + + // Test to see if firstFont is identical to secondFont. + bool fontTest = firstFont->Equals( secondFont ); + + // Display a message box with the result of the test. + MessageBox::Show( fontTest.ToString() ); + } + // + + // Snippet for: M:System.Drawing.Font.FromHfont(System.IntPtr) + // +private: + [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] + static IntPtr GetStockObject( int fnObject ); + +public: + void FromHfont_Example( PaintEventArgs^ e ) + { + // Get a handle for a GDI font. + IntPtr hFont = GetStockObject( 17 ); + + // Create a Font object from hFont. + System::Drawing::Font^ hfontFont = System::Drawing::Font::FromHfont( hFont ); + + // Use hfontFont to draw text to the screen. + e->Graphics->DrawString( "This font is from a GDI HFONT", hfontFont, Brushes::Black, 0, 0 ); + } + // + + // Snippet for: M:System.Drawing.Font.GetHashCode + // +public: + void GetHashCode_Example( PaintEventArgs^ /*e*/ ) + { + // Create a Font object. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Get the hash code for myFont. + int hashCode = myFont->GetHashCode(); + + // Display the hash code in a message box. + MessageBox::Show( hashCode.ToString() ); + } + // + + // Snippet for: M:System.Drawing.Font.GetHeight(System.Drawing.Graphics) + // +public: + void GetHeight_Example( PaintEventArgs^ e ) + { + // Create a Font object. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); + + //Draw text to the screen with myFont. + e->Graphics->DrawString( "This is the first line", myFont, Brushes::Black, PointF(0,0) ); + + //Get the height of myFont. + float height = myFont->GetHeight( e->Graphics ); + + //Draw text immediately below the first line of text. + e->Graphics->DrawString( "This is the second line", myFont, Brushes::Black, PointF(0,height) ); + } + // + + // Snippet for: M:System.Drawing.Font.ToHfont + // + //Reference the GDI DeleteObject method. +public: + [System::Runtime::InteropServices::DllImport("GDI32.dll")] + static bool DeleteObject( IntPtr objectHandle ); + void ToHfont_Example( PaintEventArgs^ /*e*/ ) + { + // Create a Font object. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Get a handle to the Font object. + IntPtr hFont = myFont->ToHfont(); + + // Display a message box with the value of hFont. + MessageBox::Show( hFont.ToString() ); + + //Dispose of the hFont. + DeleteObject( hFont ); + } + // + + // Snippet for: M:System.Drawing.Font.ToString + // +public: + void ToString_Example( PaintEventArgs^ /*e*/ ) + { + // Create a Font object. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Get a string that represents myFont. + String^ fontString = myFont->ToString(); + + // Display a message box with fontString. + MessageBox::Show( fontString ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp new file mode 100644 index 00000000000..3d2e17e8fb1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples/CPP/form1.cpp @@ -0,0 +1,1666 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing::Imaging; +using namespace System::Drawing::Drawing2D; +using namespace System::Drawing::Text; +using namespace System::Security::Permissions; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Graphics.AddMetafileComment(System.Byte[]) + // +private: + [SecurityPermission(SecurityAction::Demand, Flags = SecurityPermissionFlag::UnmanagedCode)] + void AddMetafileCommentBytes( PaintEventArgs^ e ) + { + // Create temporary Graphics object for metafile + // creation and get handle to its device context. + Graphics^ newGraphics = this->CreateGraphics(); + IntPtr hdc = newGraphics->GetHdc(); + + // Create metafile object to record. + Metafile^ metaFile1 = gcnew Metafile( "SampMeta.emf",hdc ); + + // Create graphics object to record metaFile. + Graphics^ metaGraphics = Graphics::FromImage( metaFile1 ); + + // Draw rectangle in metaFile. + metaGraphics->DrawRectangle( gcnew Pen( Color::Black,5.0f ), 0, 0, 100, 100 ); + + // Create comment and add to metaFile. + array^metaComment = {(Byte)'T',(Byte)'e',(Byte)'s',(Byte)'t'}; + metaGraphics->AddMetafileComment( metaComment ); + + // Dispose of graphics object. + delete metaGraphics; + + // Dispose of metafile. + delete metaFile1; + + // Release handle to temporary device context. + newGraphics->ReleaseHdc( hdc ); + + // Dispose of scratch graphics object. + delete newGraphics; + + // Create existing metafile object to draw. + Metafile^ metaFile2 = gcnew Metafile( "SampMeta.emf" ); + + // Draw metaFile to screen. + e->Graphics->DrawImage( metaFile2, Point(0,0) ); + + // Dispose of metafile. + delete metaFile2; + } + // + + // Snippet for: M:System.Drawing.Graphics.BeginContainer + // +private: + void BeginContainerVoid( PaintEventArgs^ e ) + { + // Begin graphics container. + GraphicsContainer^ containerState = e->Graphics->BeginContainer(); + + // Translate world transformation. + e->Graphics->TranslateTransform( 100.0F, 100.0F ); + + // Fill translated rectangle in container with red. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 ); + + // End graphics container. + e->Graphics->EndContainer( containerState ); + + // Fill untransformed rectangle with green. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.BeginContainer(System.Drawing.Rectangle,System.Drawing.Rectangle,System.Drawing.GraphicsUnit) + // +private: + void BeginContainerRectangle( PaintEventArgs^ e ) + { + // Define transformation for container. + Rectangle srcRect = Rectangle(0,0,200,200); + Rectangle destRect = Rectangle(100,100,150,150); + + // Begin graphics container. + GraphicsContainer^ containerState = e->Graphics->BeginContainer( destRect, srcRect, GraphicsUnit::Pixel ); + + // Fill red rectangle in container. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 ); + + // End graphics container. + e->Graphics->EndContainer( containerState ); + + // Fill untransformed rectangle with green. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.BeginContainer(System.Drawing.RectangleF,System.Drawing.RectangleF,System.Drawing.GraphicsUnit) + // +private: + void BeginContainerRectangleF( PaintEventArgs^ e ) + { + // Define transformation for container. + RectangleF srcRect = RectangleF(0.0F,0.0F,200.0F,200.0F); + RectangleF destRect = RectangleF(100.0F,100.0F,150.0F,150.0F); + + // Begin graphics container. + GraphicsContainer^ containerState = e->Graphics->BeginContainer( destRect, srcRect, GraphicsUnit::Pixel ); + + // Fill red rectangle in container. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0.0F, 0.0F, 200.0F, 200.0F ); + + // End graphics container. + e->Graphics->EndContainer( containerState ); + + // Fill untransformed rectangle with green. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0.0F, 0.0F, 200.0F, 200.0F ); + } + // + + // Snippet for: M:System.Drawing.Graphics.Clear(System.Drawing.Color) + // +private: + void ClearColor( PaintEventArgs^ e ) + { + // Clear screen with teal background. + e->Graphics->Clear( Color::Teal ); + } + // + + // Snippet for: M:System.Drawing.Graphics.Dispose + // +private: + void FromImageImage1( PaintEventArgs^ e ) + { + // Create image. + Image^ imageFile = Image::FromFile( "SampImag.jpg" ); + + // Create graphics object for alteration. + Graphics^ newGraphics = Graphics::FromImage( imageFile ); + + // Alter image. + newGraphics->FillRectangle( gcnew SolidBrush( Color::Black ), 100, 50, 100, 100 ); + + // Draw image to screen. + e->Graphics->DrawImage( imageFile, PointF(0.0F,0.0F) ); + + // Release graphics object. + delete newGraphics; + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Drawing.Rectangle,System.Single,System.Single) + // +private: + void DrawArcRectangle( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle to bound ellipse. + Rectangle rect = Rectangle(0,0,100,200); + + // Create start and sweep angles on ellipse. + float startAngle = 45.0F; + float sweepAngle = 270.0F; + + // Draw arc to screen. + e->Graphics->DrawArc( blackPen, rect, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Drawing.RectangleF,System.Single,System.Single) + // +private: + void DrawArcRectangleF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle to bound ellipse. + RectangleF rect = RectangleF(0.0F,0.0F,100.0F,200.0F); + + // Create start and sweep angles on ellipse. + float startAngle = 45.0F; + float sweepAngle = 270.0F; + + // Draw arc to screen. + e->Graphics->DrawArc( blackPen, rect, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) + // +private: + void DrawArcInt( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + // Create coordinates of rectangle to bound ellipse. + int x = 0; + int y = 0; + int width = 100; + int height = 200; + + // Create start and sweep angles on ellipse. + int startAngle = 45; + int sweepAngle = 270; + + // Draw arc to screen. + e->Graphics->DrawArc( blackPen, x, y, width, height, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawArc(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) + // +private: + void DrawArcFloat( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create coordinates of rectangle to bound ellipse. + float x = 0.0F; + float y = 0.0F; + float width = 100.0F; + float height = 200.0F; + + // Create start and sweep angles on ellipse. + float startAngle = 45.0F; + float sweepAngle = 270.0F; + + // Draw arc to screen. + e->Graphics->DrawArc( blackPen, x, y, width, height, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawBezier(System.Drawing.Pen,System.Drawing.Point,System.Drawing.Point,System.Drawing.Point,System.Drawing.Point) + // +private: + void DrawBezierPoint( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points for curve. + Point start = Point(100,100); + Point control1 = Point(200,10); + Point control2 = Point(350,50); + Point end = Point(500,100); + + // Draw arc to screen. + e->Graphics->DrawBezier( blackPen, start, control1, control2, end ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawBezier(System.Drawing.Pen,System.Drawing.PointF,System.Drawing.PointF,System.Drawing.PointF,System.Drawing.PointF) + // +private: + void DrawBezierPointF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points for curve. + PointF start = PointF(100.0F,100.0F); + PointF control1 = PointF(200.0F,10.0F); + PointF control2 = PointF(350.0F,50.0F); + PointF end = PointF(500.0F,100.0F); + + // Draw arc to screen. + e->Graphics->DrawBezier( blackPen, start, control1, control2, end ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawBezier(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) + // +private: + void DrawBezierFloat( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create coordinates of points for curve. + float startX = 100.0F; + float startY = 100.0F; + float controlX1 = 200.0F; + float controlY1 = 10.0F; + float controlX2 = 350.0F; + float controlY2 = 50.0F; + float endX = 500.0F; + float endY = 100.0F; + + // Draw arc to screen. + e->Graphics->DrawBezier( blackPen, startX, startY, controlX1, controlY1, controlX2, controlY2, endX, endY ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawBeziers(System.Drawing.Pen,System.Drawing.Point[]) + // +private: + void DrawBeziersPoint( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points for curve. + Point start = Point(100,100); + Point control1 = Point(200,10); + Point control2 = Point(350,50); + Point end1 = Point(500,100); + Point control3 = Point(600,150); + Point control4 = Point(650,250); + Point end2 = Point(500,300); + array^ bezierPoints = {start,control1,control2,end1,control3,control4,end2}; + + // Draw arc to screen. + e->Graphics->DrawBeziers( blackPen, bezierPoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawBeziers(System.Drawing.Pen,System.Drawing.PointF[]) + // +private: + void DrawBeziersPointF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points for curve. + PointF start = PointF(100.0F,100.0F); + PointF control1 = PointF(200.0F,10.0F); + PointF control2 = PointF(350.0F,50.0F); + PointF end1 = PointF(500.0F,100.0F); + PointF control3 = PointF(600.0F,150.0F); + PointF control4 = PointF(650.0F,250.0F); + PointF end2 = PointF(500.0F,300.0F); + array^ bezierPoints = {start,control1,control2,end1,control3,control4,end2}; + + // Draw arc to screen. + e->Graphics->DrawBeziers( blackPen, bezierPoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.Point[]) + // +private: + void DrawClosedCurvePoint( PaintEventArgs^ e ) + { + + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Draw closed curve to screen. + e->Graphics->DrawClosedCurve( greenPen, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.Point[],System.Single,System.Drawing.Drawing2D.FillMode) + // +private: + void DrawClosedCurvePointTension( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create tension and fill mode. + float tension = 1.0F; + FillMode aFillMode = FillMode::Alternate; + + // Draw closed curve to screen. + e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.PointF[]) + // +private: + void DrawClosedCurvePointF( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Draw closed curve to screen. + e->Graphics->DrawClosedCurve( greenPen, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawClosedCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Single,System.Drawing.Drawing2D.FillMode) + // +private: + void DrawClosedCurvePointFTension( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create tension and fill mode. + float tension = 1.0F; + FillMode aFillMode = FillMode::Alternate; + + // Draw closed curve to screen. + e->Graphics->DrawClosedCurve( greenPen, curvePoints, tension, aFillMode ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.Point[]) + // +private: + void DrawCurvePoint( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.Point[],System.Int32,System.Int32,System.Single) + // +private: + void DrawCurvePointSegmentTension( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create offset, number of segments, and tension. + int offset = 2; + int numSegments = 4; + float tension = 1.0F; + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.Point[],System.Single) + // +private: + void DrawCurvePointTension( PaintEventArgs^ e ) + { + + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create tension. + float tension = 1.0F; + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints, tension ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[]) + // +private: + void DrawCurvePointF( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Int32,System.Int32) + // +private: + void DrawCurvePointFSegments( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create offset and number of segments. + int offset = 2; + int numSegments = 4; + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Int32,System.Int32,System.Single) + // +private: + void DrawCurvePointFSegmentTension( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create offset, number of segments, and tension. + int offset = 2; + int numSegments = 4; + float tension = 1.0F; + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints, offset, numSegments, tension ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawCurve(System.Drawing.Pen,System.Drawing.PointF[],System.Single) + // +private: + void DrawCurvePointFTension( PaintEventArgs^ e ) + { + // Create pens. + Pen^ redPen = gcnew Pen( Color::Red,3.0f ); + Pen^ greenPen = gcnew Pen( Color::Green,3.0f ); + + // Create points that define curve. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw lines between original points to screen. + e->Graphics->DrawLines( redPen, curvePoints ); + + // Create tension. + float tension = 1.0F; + + // Draw curve to screen. + e->Graphics->DrawCurve( greenPen, curvePoints, tension ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Drawing.Rectangle) + // +private: + void DrawEllipseRectangle( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle for ellipse. + Rectangle rect = Rectangle(0,0,200,100); + + // Draw ellipse to screen. + e->Graphics->DrawEllipse( blackPen, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Drawing.RectangleF) + // +private: + void DrawEllipseRectangleF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle for ellipse. + RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F); + + // Draw ellipse to screen. + e->Graphics->DrawEllipse( blackPen, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32) + // +private: + void DrawEllipseInt( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create location and size of ellipse. + int x = 0; + int y = 0; + int width = 200; + int height = 100; + + // Draw ellipse to screen. + e->Graphics->DrawEllipse( blackPen, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawEllipse(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single) + // +private: + void DrawEllipseFloat( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create location and size of ellipse. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 100.0F; + + // Draw ellipse to screen. + e->Graphics->DrawEllipse( blackPen, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawIcon(System.Drawing.Icon,System.Drawing.Rectangle) + // +private: + void DrawIconRectangle( PaintEventArgs^ e ) + { + // Create icon. + System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon( "SampIcon.ico" ); + + // Create rectangle for icon. + Rectangle rect = Rectangle(100,100,200,200); + + // Draw icon to screen. + e->Graphics->DrawIcon( newIcon, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawIcon(System.Drawing.Icon,System.Int32,System.Int32) + // +private: + void DrawIconInt( PaintEventArgs^ e ) + { + + // Create icon. + System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon( "SampIcon.ico" ); + + // Create coordinates for upper-left corner of icon. + int x = 100; + int y = 100; + + // Draw icon to screen. + e->Graphics->DrawIcon( newIcon, x, y ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawIconUnstretched(System.Drawing.Icon,System.Drawing.Rectangle) + // +private: + void DrawIconUnstretchedRectangle( PaintEventArgs^ e ) + { + + // Create icon. + System::Drawing::Icon^ newIcon = gcnew System::Drawing::Icon( "SampIcon.ico" ); + + // Create rectangle for icon. + Rectangle rect = Rectangle(100,100,200,200); + + // Draw icon to screen. + e->Graphics->DrawIconUnstretched( newIcon, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point) + // +private: + void DrawImagePoint( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create Point for upper-left corner of image. + Point ulCorner = Point(100,100); + + // Draw image to screen. + e->Graphics->DrawImage( newImage, ulCorner ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[]) + // +private: + void DrawImagePara( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing image. + Point ulCorner = Point(100,100); + Point urCorner = Point(550,100); + Point llCorner = Point(150,250); + array^ destPara = {ulCorner,urCorner,llCorner}; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destPara ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit) + // +private: + void DrawImageParaRect( PaintEventArgs^ e ) + { + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing image. + Point ulCorner = Point(100,100); + Point urCorner = Point(325,100); + Point llCorner = Point(150,250); + array^ destPara = {ulCorner,urCorner,llCorner}; + + // Create rectangle for source image. + Rectangle srcRect = Rectangle(50,50,150,150); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destPara, srcRect, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) + // +private: + void DrawImageParaRectAttrib( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing image. + Point ulCorner1 = Point(100,100); + Point urCorner1 = Point(325,100); + Point llCorner1 = Point(150,250); + array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; + + // Create rectangle for source image. + Rectangle srcRect = Rectangle(50,50,150,150); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); + + // Create parallelogram for drawing adjusted image. + Point ulCorner2 = Point(325,100); + Point urCorner2 = Point(550,100); + Point llCorner2 = Point(375,250); + array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback1( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageParaRectAttribAbort( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback1 ); + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing original image. + Point ulCorner = Point(100,100); + Point urCorner = Point(550,100); + Point llCorner = Point(150,250); + array^ destPara1 = {ulCorner,urCorner,llCorner}; + + // Create rectangle for source image. + Rectangle srcRect = Rectangle(50,50,150,150); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); + + // Create parallelogram for drawing adjusted image. + Point ulCorner2 = Point(325,100); + Point urCorner2 = Point(550,100); + Point llCorner2 = Point(375,250); + array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw image to screen. + e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Point[],System.Drawing.Rectangle,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.Int32) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback2( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageParaRectAttribAbortData( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback2 ); + int imageCallbackData = 1; + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing original image. + Point ulCorner = Point(100,100); + Point urCorner = Point(550,100); + Point llCorner = Point(150,250); + array^ destPara1 = {ulCorner,urCorner,llCorner}; + + // Create rectangle for source image. + Rectangle srcRect = Rectangle(50,50,150,150); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); + + // Create parallelogram for drawing adjusted image. + Point ulCorner2 = Point(325,100); + Point urCorner2 = Point(550,100); + Point llCorner2 = Point(375,250); + array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw image to screen. + e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback, imageCallbackData ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF) + // +private: + void DrawImagePointF( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create point for upper-left corner of image. + PointF ulCorner = PointF(100.0F,100.0F); + + // Draw image to screen. + e->Graphics->DrawImage( newImage, ulCorner ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[]) + // +private: + void DrawImageParaF( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing image. + PointF ulCorner = PointF(100.0F,100.0F); + PointF urCorner = PointF(550.0F,100.0F); + PointF llCorner = PointF(150.0F,250.0F); + array^ destPara = {ulCorner,urCorner,llCorner}; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destPara ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit) + // +private: + void DrawImageParaFRectF( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing image. + PointF ulCorner = PointF(100.0F,100.0F); + PointF urCorner = PointF(550.0F,100.0F); + PointF llCorner = PointF(150.0F,250.0F); + array^ destPara = {ulCorner,urCorner,llCorner}; + + // Create rectangle for source image. + RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destPara, srcRect, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) + // + void DrawImageParaFRectFAttrib( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing original image. + PointF ulCorner1 = PointF(100.0F,100.0F); + PointF urCorner1 = PointF(325.0F,100.0F); + PointF llCorner1 = PointF(150.0F,250.0F); + array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; + + // Create rectangle for source image. + RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Create parallelogram for drawing adjusted image. + PointF ulCorner2 = PointF(325.0F,100.0F); + PointF urCorner2 = PointF(550.0F,100.0F); + PointF llCorner2 = PointF(375.0F,250.0F); + array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback3( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageParaFRectAttribAbort( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback3 ); + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing original image. + PointF ulCorner1 = PointF(100.0F,100.0F); + PointF urCorner1 = PointF(325.0F,100.0F); + PointF llCorner1 = PointF(150.0F,250.0F); + array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; + + // Create rectangle for source image. + RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Create parallelogram for drawing adjusted image. + PointF ulCorner2 = PointF(325.0F,100.0F); + PointF urCorner2 = PointF(550.0F,100.0F); + PointF llCorner2 = PointF(375.0F,250.0F); + array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.Int32) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback4( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageParaFRectAttribAbortData( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback4 ); + int imageCallbackData = 1; + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create parallelogram for drawing original image. + PointF ulCorner1 = PointF(100.0F,100.0F); + PointF urCorner1 = PointF(325.0F,100.0F); + PointF llCorner1 = PointF(150.0F,250.0F); + array^ destPara1 = {ulCorner1,urCorner1,llCorner1}; + + // Create rectangle for source image. + RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Create parallelogram for drawing adjusted image. + PointF ulCorner2 = PointF(325.0F,100.0F); + PointF urCorner2 = PointF(550.0F,100.0F); + PointF llCorner2 = PointF(375.0F,250.0F); + array^ destPara2 = {ulCorner2,urCorner2,llCorner2}; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destPara1, srcRect, units ); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destPara2, srcRect, units, imageAttr, imageCallback, imageCallbackData ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle) + // +private: + void DrawImageRect( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying image. + Rectangle destRect = Rectangle(100,100,450,150); + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destRect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Drawing.Rectangle,System.Drawing.GraphicsUnit) + // +private: + void DrawImageRectRect( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying image. + Rectangle destRect = Rectangle(100,100,450,150); + + // Create rectangle for source image. + Rectangle srcRect = Rectangle(50,50,150,150); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destRect, srcRect, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit) + // + void DrawImageRect4Int( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying image. + Rectangle destRect = Rectangle(100,100,450,150); + + // Create coordinates of rectangle for source image. + int x = 50; + int y = 50; + int width = 150; + int height = 150; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destRect, x, y, width, height, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) + // + void DrawImageRect4IntAtrrib( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying original image. + Rectangle destRect1 = Rectangle(100,25,450,150); + + // Create coordinates of rectangle for source image. + int x = 50; + int y = 50; + int width = 150; + int height = 150; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); + + // Create rectangle for adjusted image. + Rectangle destRect2 = Rectangle(100,175,450,150); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback5( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageRect4IntAtrribAbort( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback5 ); + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying original image. + Rectangle destRect1 = Rectangle(100,25,450,150); + + // Create coordinates of rectangle for source image. + int x = 50; + int y = 50; + int width = 150; + int height = 150; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); + + // Create rectangle for adjusted image. + Rectangle destRect2 = Rectangle(100,175,450,150); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Int32,System.Int32,System.Int32,System.Int32,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.IntPtr) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback6( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageRect4IntAtrribAbortData( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback6 ); + IntPtr imageCallbackData = IntPtr(1); + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying original image. + Rectangle destRect1 = Rectangle(100,25,450,150); + + // Create coordinates of rectangle for source image. + int x = 50; + int y = 50; + int width = 150; + int height = 150; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); + + // Create rectangle for adjusted image. + Rectangle destRect2 = Rectangle(100,175,450,150); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback, imageCallbackData ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit) + // +private: + void DrawImageRect4Float( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying image. + Rectangle destRect = Rectangle(100,100,450,150); + + // Create coordinates of rectangle for source image. + float x = 50.0F; + float y = 50.0F; + float width = 150.0F; + float height = 150.0F; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destRect, x, y, width, height, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes) + // +private: + void DrawImageRect4FloatAttrib( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying original image. + Rectangle destRect1 = Rectangle(100,25,450,150); + + // Create coordinates of rectangle for source image. + float x = 50.0F; + float y = 50.0F; + float width = 150.0F; + float height = 150.0F; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); + + // Create rectangle for adjusted image. + Rectangle destRect2 = Rectangle(100,175,450,150); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback7( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + // If callBackData passed, continue DrawImage method. + return false; + } + } + +private: + void DrawImageRect4FloatAttribAbort( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback7 ); + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying original image. + Rectangle destRect1 = Rectangle(100,25,450,150); + + // Create coordinates of rectangle for source image. + float x = 50.0F; + float y = 50.0F; + float width = 150.0F; + float height = 150.0F; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); + + // Create rectangle for adjusted image. + Rectangle destRect2 = Rectangle(100,175,450,150); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + try + { + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: T:System.Drawing.Image + // +private: + void ImageExampleForm_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create Point for upper-left corner of image. + Point ulCorner = Point(100,100); + + // Draw image to screen. + e->Graphics->DrawImage( newImage, ulCorner ); + } + // + + +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp new file mode 100644 index 00000000000..7fc1989d761 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples2/CPP/form1.cpp @@ -0,0 +1,1292 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.Rectangle,System.Single,System.Single,System.Single,System.Single,System.Drawing.GraphicsUnit,System.Drawing.Imaging.ImageAttributes,System.Drawing.Graphics.DrawImageAbort,System.IntPtr) + // + // Define DrawImageAbort callback method. +private: + bool DrawImageCallback8( IntPtr callBackData ) + { + // Test for call that passes callBackData parameter. + if ( callBackData == IntPtr::Zero ) + { + + // If no callBackData passed, abort DrawImage method. + return true; + } + else + { + + // If callBackData passed, continue DrawImage method. + return false; + } + } + +public: + void DrawImageRect4FloatAttribAbortData( PaintEventArgs^ e ) + { + // Create callback method. + Graphics::DrawImageAbort^ imageCallback = gcnew Graphics::DrawImageAbort( this, &Form1::DrawImageCallback8 ); + IntPtr imageCallbackData = IntPtr(1); + + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying original image. + Rectangle destRect1 = Rectangle(100,25,450,150); + + // Create coordinates of rectangle for source image. + float x = 50.0F; + float y = 50.0F; + float width = 150.0F; + float height = 150.0F; + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw original image to screen. + e->Graphics->DrawImage( newImage, destRect1, x, y, width, height, units ); + + // Create rectangle for adjusted image. + Rectangle destRect2 = Rectangle(100,175,450,150); + + // Create image attributes and set large gamma. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 4.0F ); + + // Draw adjusted image to screen. + try + { + // Draw adjusted image to screen. + e->Graphics->DrawImage( newImage, destRect2, x, y, width, height, units, imageAttr, imageCallback, imageCallbackData ); + } + catch ( Exception^ ex ) + { + e->Graphics->DrawString( ex->ToString(), gcnew System::Drawing::Font( "Arial",8 ), Brushes::Black, PointF(0,0) ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.RectangleF) + // +public: + void DrawImageRectF( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying image. + RectangleF rect = RectangleF(100.0F,100.0F,450.0F,150.0F); + + // Draw image to screen. + e->Graphics->DrawImage( newImage, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Drawing.RectangleF,System.Drawing.RectangleF,System.Drawing.GraphicsUnit) + // +public: + void DrawImageRectFRectF( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create rectangle for displaying image. + RectangleF destRect = RectangleF(100.0F,100.0F,450.0F,150.0F); + + // Create rectangle for source image. + RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, destRect, srcRect, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Int32,System.Int32) + // +public: + void DrawImage2Int( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner of image. + int x = 100; + int y = 100; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, x, y ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Int32,System.Int32,System.Drawing.Rectangle,System.Drawing.GraphicsUnit) + // +public: + void DrawImage2IntRect( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner of image. + int x = 100; + int y = 100; + + // Create rectangle for source image. + Rectangle srcRect = Rectangle(50,50,150,150); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, x, y, srcRect, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void DrawImage4Int( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner. + // of image and for size of image. + int x = 100; + int y = 100; + int width = 450; + int height = 150; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Single,System.Single) + // +public: + void DrawImage2Float( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner of image. + float x = 100.0F; + float y = 100.0F; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, x, y ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Single,System.Single,System.Drawing.RectangleF,System.Drawing.GraphicsUnit) + // +public: + void DrawImage2FloatRectF( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner of image. + float x = 100.0F; + float y = 100.0F; + + // Create rectangle for source image. + RectangleF srcRect = RectangleF(50.0F,50.0F,150.0F,150.0F); + GraphicsUnit units = GraphicsUnit::Pixel; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, x, y, srcRect, units ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImage(System.Drawing.Image,System.Single,System.Single,System.Single,System.Single) + // +public: + void DrawImage4Float( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner. + // of image and for size of image. + float x = 100.0F; + float y = 100.0F; + float width = 450.0F; + float height = 150.0F; + + // Draw image to screen. + e->Graphics->DrawImage( newImage, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImageUnscaled(System.Drawing.Image,System.Drawing.Point) + // +public: + void DrawImageUnscaledPoint( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create point for upper-left corner of image. + Point ulCorner = Point(100,100); + + // Draw image to screen. + e->Graphics->DrawImageUnscaled( newImage, ulCorner ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawImageUnscaled(System.Drawing.Image,System.Int32,System.Int32) + // +public: + void DrawImageUnscaledInt( PaintEventArgs^ e ) + { + // Create image. + Image^ newImage = Image::FromFile( "SampImag.jpg" ); + + // Create coordinates for upper-left corner of image. + int x = 100; + int y = 100; + + // Draw image to screen. + e->Graphics->DrawImageUnscaled( newImage, x, y ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Drawing.Point,System.Drawing.Point) + // +public: + void DrawLinePoint( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points that define line. + Point point1 = Point(100,100); + Point point2 = Point(500,100); + + // Draw line to screen. + e->Graphics->DrawLine( blackPen, point1, point2 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Drawing.PointF,System.Drawing.PointF) + // +public: + void DrawLinePointF( PaintEventArgs^ e ) + { + + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points that define line. + PointF point1 = PointF(100.0F,100.0F); + PointF point2 = PointF(500.0F,100.0F); + + // Draw line to screen. + e->Graphics->DrawLine( blackPen, point1, point2 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void DrawLineInt( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create coordinates of points that define line. + int x1 = 100; + int y1 = 100; + int x2 = 500; + int y2 = 100; + + // Draw line to screen. + e->Graphics->DrawLine( blackPen, x1, y1, x2, y2 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawLine(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single) + // +public: + void DrawLineFloat( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create coordinates of points that define line. + float x1 = 100.0F; + float y1 = 100.0F; + float x2 = 500.0F; + float y2 = 100.0F; + + // Draw line to screen. + e->Graphics->DrawLine( blackPen, x1, y1, x2, y2 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawLines(System.Drawing.Pen,System.Drawing.Point[]) + // +public: + void DrawLinesPoint( PaintEventArgs^ e ) + { + // Create pen. + Pen^ pen = gcnew Pen( Color::Black,3.0f ); + + // Create array of points that define lines to draw. + array^ points = {Point(10,10),Point(10,100),Point(200,50),Point(250,300)}; + + //Draw lines to screen. + e->Graphics->DrawLines( pen, points ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawLines(System.Drawing.Pen,System.Drawing.PointF[]) + // +public: + void DrawLinesPointF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ pen = gcnew Pen( Color::Black,3.0f ); + + // Create array of points that define lines to draw. + array^ points = {PointF(10.0F,10.0F),PointF(10.0F,100.0F),PointF(200.0F,50.0F),PointF(250.0F,300.0F)}; + + //Draw lines to screen. + e->Graphics->DrawLines( pen, points ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPath(System.Drawing.Pen,System.Drawing.Drawing2D.GraphicsPath) + // +public: + void DrawPathEllipse( PaintEventArgs^ e ) + { + // Create graphics path object and add ellipse. + GraphicsPath^ graphPath = gcnew GraphicsPath; + graphPath->AddEllipse( 0, 0, 200, 100 ); + + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Draw graphics path to screen. + e->Graphics->DrawPath( blackPen, graphPath ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Drawing.Rectangle,System.Single,System.Single) + // +public: + void DrawPieRectangle( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle for ellipse. + Rectangle rect = Rectangle(0,0,200,100); + + // Create start and sweep angles. + float startAngle = 0.0F; + float sweepAngle = 45.0F; + + // Draw pie to screen. + e->Graphics->DrawPie( blackPen, rect, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Drawing.RectangleF,System.Single,System.Single) + // +public: + void DrawPieRectangleF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle for ellipse. + RectangleF rect = RectangleF(0.0F,0.0F,200.0F,100.0F); + + // Create start and sweep angles. + float startAngle = 0.0F; + float sweepAngle = 45.0F; + + // Draw pie to screen. + e->Graphics->DrawPie( blackPen, rect, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void DrawPieInt( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create location and size of ellipse. + int x = 0; + int y = 0; + int width = 200; + int height = 100; + + // Create start and sweep angles. + int startAngle = 0; + int sweepAngle = 45; + + // Draw pie to screen. + e->Graphics->DrawPie( blackPen, x, y, width, height, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPie(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) + // +public: + void DrawPieFloat( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create location and size of ellipse. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 100.0F; + + // Create start and sweep angles. + float startAngle = 0.0F; + float sweepAngle = 45.0F; + + // Draw pie to screen. + e->Graphics->DrawPie( blackPen, x, y, width, height, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPolygon(System.Drawing.Pen,System.Drawing.Point[]) + // +public: + void DrawPolygonPointF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points that define polygon. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw polygon curve to screen. + e->Graphics->DrawPolygon( blackPen, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawPolygon(System.Drawing.Pen,System.Drawing.PointF[]) + // +public: + void DrawPolygonPoint( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create points that define polygon. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw polygon to screen. + e->Graphics->DrawPolygon( blackPen, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen,System.Drawing.Rectangle) + // +public: + void DrawRectangleRectangle( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create rectangle. + Rectangle rect = Rectangle(0,0,200,200); + + // Draw rectangle to screen. + e->Graphics->DrawRectangle( blackPen, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void DrawRectangleInt( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create location and size of rectangle. + int x = 0; + int y = 0; + int width = 200; + int height = 200; + + // Draw rectangle to screen. + e->Graphics->DrawRectangle( blackPen, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawRectangle(System.Drawing.Pen,System.Single,System.Single,System.Single,System.Single) + // +public: + void DrawRectangleFloat( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create location and size of rectangle. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 200.0F; + + // Draw rectangle to screen. + e->Graphics->DrawRectangle( blackPen, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawRectangles(System.Drawing.Pen,System.Drawing.Rectangle[]) + // +public: + void DrawRectanglesRectangle( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create array of rectangles. + array^ rects = {Rectangle(0,0,100,200),Rectangle(100,200,250,50),Rectangle(300,0,50,100)}; + + // Draw rectangles to screen. + e->Graphics->DrawRectangles( blackPen, rects ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawRectangles(System.Drawing.Pen,System.Drawing.RectangleF[]) + // +public: + void DrawRectanglesRectangleF( PaintEventArgs^ e ) + { + // Create pen. + Pen^ blackPen = gcnew Pen( Color::Black,3.0f ); + + // Create array of rectangles. + array^ rects = {RectangleF(0.0F,0.0F,100.0F,200.0F),RectangleF(100.0F,200.0F,250.0F,50.0F),RectangleF(300.0F,0.0F,50.0F,100.0F)}; + + // Draw rectangles to screen. + e->Graphics->DrawRectangles( blackPen, rects ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF) + // +public: + void DrawStringPointF( PaintEventArgs^ e ) + { + // Create string to draw. + String^ drawString = "Sample Text"; + + // Create font and brush. + System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); + SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); + + // Create point for upper-left corner of drawing. + PointF drawPoint = PointF(150.0F,150.0F); + + // Draw string to screen. + e->Graphics->DrawString( drawString, drawFont, drawBrush, drawPoint ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.PointF,System.Drawing.StringFormat) + // +public: + void DrawStringPointFFormat( PaintEventArgs^ e ) + { + // Create string to draw. + String^ drawString = "Sample Text"; + + // Create font and brush. + System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); + SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); + + // Create point for upper-left corner of drawing. + PointF drawPoint = PointF(150.0F,50.0F); + + // Set format of string. + StringFormat^ drawFormat = gcnew StringFormat; + drawFormat->FormatFlags = StringFormatFlags::DirectionVertical; + + // Draw string to screen. + e->Graphics->DrawString( drawString, drawFont, drawBrush, drawPoint, drawFormat ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.RectangleF) + // +public: + void DrawStringRectangleF( PaintEventArgs^ e ) + { + // Create string to draw. + String^ drawString = "Sample Text"; + + // Create font and brush. + System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); + SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); + + // Create rectangle for drawing. + float x = 150.0F; + float y = 150.0F; + float width = 200.0F; + float height = 50.0F; + RectangleF drawRect = RectangleF(x,y,width,height); + + // Draw rectangle to screen. + Pen^ blackPen = gcnew Pen( Color::Black ); + e->Graphics->DrawRectangle( blackPen, x, y, width, height ); + + // Draw string to screen. + e->Graphics->DrawString( drawString, drawFont, drawBrush, drawRect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Drawing.RectangleF,System.Drawing.StringFormat) + // +public: + void DrawStringRectangleFFormat( PaintEventArgs^ e ) + { + // Create string to draw. + String^ drawString = "Sample Text"; + + // Create font and brush. + System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); + SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); + + // Create rectangle for drawing. + float x = 150.0F; + float y = 150.0F; + float width = 200.0F; + float height = 50.0F; + RectangleF drawRect = RectangleF(x,y,width,height); + + // Draw rectangle to screen. + Pen^ blackPen = gcnew Pen( Color::Black ); + e->Graphics->DrawRectangle( blackPen, x, y, width, height ); + + // Set format of string. + StringFormat^ drawFormat = gcnew StringFormat; + drawFormat->Alignment = StringAlignment::Center; + + // Draw string to screen. + e->Graphics->DrawString( drawString, drawFont, drawBrush, drawRect, drawFormat ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single) + // +public: + void DrawStringFloat( PaintEventArgs^ e ) + { + // Create string to draw. + String^ drawString = "Sample Text"; + + // Create font and brush. + System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); + SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); + + // Create point for upper-left corner of drawing. + float x = 150.0F; + float y = 150.0F; + + // Draw string to screen. + e->Graphics->DrawString( drawString, drawFont, drawBrush, x, y ); + } + // + + // Snippet for: M:System.Drawing.Graphics.DrawString(System.String,System.Drawing.Font,System.Drawing.Brush,System.Single,System.Single,System.Drawing.StringFormat) + // +public: + void DrawStringFloatFormat( PaintEventArgs^ e ) + { + // Create string to draw. + String^ drawString = "Sample Text"; + + // Create font and brush. + System::Drawing::Font^ drawFont = gcnew System::Drawing::Font( "Arial",16 ); + SolidBrush^ drawBrush = gcnew SolidBrush( Color::Black ); + + // Create point for upper-left corner of drawing. + float x = 150.0F; + float y = 50.0F; + + // Set format of string. + StringFormat^ drawFormat = gcnew StringFormat; + drawFormat->FormatFlags = StringFormatFlags::DirectionVertical; + + // Draw string to screen. + e->Graphics->DrawString( drawString, drawFont, drawBrush, x, y, drawFormat ); + } + // + + // Snippet for: M:System.Drawing.Graphics.EndContainer(System.Drawing.Drawing2D.GraphicsContainer) + // +public: + void EndContainerState( PaintEventArgs^ e ) + { + // Begin graphics container. + GraphicsContainer^ containerState = e->Graphics->BeginContainer(); + + // Translate world transformation. + e->Graphics->TranslateTransform( 100.0F, 100.0F ); + + // Fill translated rectangle in container with red. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 200, 200 ); + + // End graphics container. + e->Graphics->EndContainer( containerState ); + + // Fill untransformed rectangle with green. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Green ), 0, 0, 200, 200 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.ExcludeClip(System.Drawing.Region) + // +public: + void ExcludeClipRegion( PaintEventArgs^ e ) + { + // Create rectangle for region. + Rectangle excludeRect = Rectangle(100,100,200,200); + + // Create region for exclusion. + System::Drawing::Region^ excludeRegion = gcnew System::Drawing::Region( excludeRect ); + + // Set clipping region to exclude region. + e->Graphics->ExcludeClip( excludeRegion ); + + // Fill large rectangle to show clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.ExcludeClip(System.Drawing.Rectangle) + // +public: + void ExcludeClipRectangle( PaintEventArgs^ e ) + { + // Create rectangle for exclusion. + Rectangle excludeRect = Rectangle(100,100,200,200); + + // Set clipping region to exclude rectangle. + e->Graphics->ExcludeClip( excludeRect ); + + // Fill large rectangle to show clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 300, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[]) + // +public: + void FillClosedCurvePoint( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + //Create array of points for curve. + Point point1 = Point(100,100); + Point point2 = Point(200,50); + Point point3 = Point(250,200); + Point point4 = Point(50,150); + array^ points = {point1,point2,point3,point4}; + + // Fill curve on screen. + e->Graphics->FillClosedCurve( redBrush, points ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode) + // +public: + void FillClosedCurvePointFillMode( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + //Create array of points for curve. + Point point1 = Point(100,100); + Point point2 = Point(200,50); + Point point3 = Point(250,200); + Point point4 = Point(50,150); + array^ points = {point1,point2,point3,point4}; + + // Set fill mode. + FillMode newFillMode = FillMode::Winding; + + // Fill curve on screen. + e->Graphics->FillClosedCurve( redBrush, points, newFillMode ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode,System.Single) + // +public: + void FillClosedCurvePointFillModeTension( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create array of points for curve. + Point point1 = Point(100,100); + Point point2 = Point(200,50); + Point point3 = Point(250,200); + Point point4 = Point(50,150); + array^ points = {point1,point2,point3,point4}; + + // Set fill mode. + FillMode newFillMode = FillMode::Winding; + + // Set tension. + float tension = 1.0F; + + // Fill curve on screen. + e->Graphics->FillClosedCurve( redBrush, points, newFillMode, tension ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.PointF[]) + // +public: + void FillClosedCurvePointF( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + //Create array of points for curve. + PointF point1 = PointF(100.0F,100.0F); + PointF point2 = PointF(200.0F,50.0F); + PointF point3 = PointF(250.0F,200.0F); + PointF point4 = PointF(50.0F,150.0F); + array^ points = {point1,point2,point3,point4}; + + // Fill curve on screen. + e->Graphics->FillClosedCurve( redBrush, points ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.PointF[],System.Drawing.Drawing2D.FillMode) + // +public: + void FillClosedCurvePointFFillMode( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create array of points for curve. + PointF point1 = PointF(100.0F,100.0F); + PointF point2 = PointF(200.0F,50.0F); + PointF point3 = PointF(250.0F,200.0F); + PointF point4 = PointF(50.0F,150.0F); + array^ points = {point1,point2,point3,point4}; + + // Set fill mode. + FillMode newFillMode = FillMode::Winding; + + // Fill curve on screen. + e->Graphics->FillClosedCurve( redBrush, points, newFillMode ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillClosedCurve(System.Drawing.Brush,System.Drawing.PointF[],System.Drawing.Drawing2D.FillMode,System.Single) + // +public: + void FillClosedCurvePointFFillModeTension( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create array of points for curve. + PointF point1 = PointF(100.0F,100.0F); + PointF point2 = PointF(200.0F,50.0F); + PointF point3 = PointF(250.0F,200.0F); + PointF point4 = PointF(50.0F,150.0F); + array^ points = {point1,point2,point3,point4}; + + // Set fill mode. + FillMode newFillMode = FillMode::Winding; + + // Set tension. + float tension = 1.0F; + + // Fill curve on screen. + e->Graphics->FillClosedCurve( redBrush, points, newFillMode, tension ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Drawing.Rectangle) + // +public: + void FillEllipseRectangle( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create rectangle for ellipse. + int x = 0; + int y = 0; + int width = 200; + int height = 100; + Rectangle rect = Rectangle(x,y,width,height); + + // Fill ellipse on screen. + e->Graphics->FillEllipse( redBrush, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Drawing.RectangleF) + // +public: + void FillEllipseRectangleF( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create rectangle for ellipse. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 100.0F; + RectangleF rect = RectangleF(x,y,width,height); + + // Fill ellipse on screen. + e->Graphics->FillEllipse( redBrush, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void FillEllipseInt( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create location and size of ellipse. + int x = 0; + int y = 0; + int width = 200; + int height = 100; + + // Fill ellipse on screen. + e->Graphics->FillEllipse( redBrush, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillEllipse(System.Drawing.Brush,System.Single,System.Single,System.Single,System.Single) + // +public: + void FillEllipseFloat( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create location and size of ellipse. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 100.0F; + + // Fill ellipse on screen. + e->Graphics->FillEllipse( redBrush, x, y, width, height ); + } + // + // Snippet for: M:System.Drawing.Graphics.FillPath(System.Drawing.Brush,System.Drawing.Drawing2D.GraphicsPath) + + // +public: + void FillPathEllipse( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create graphics path object and add ellipse. + GraphicsPath^ graphPath = gcnew GraphicsPath; + graphPath->AddEllipse( 0, 0, 200, 100 ); + + // Fill graphics path to screen. + e->Graphics->FillPath( redBrush, graphPath ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillPie(System.Drawing.Brush,System.Drawing.Rectangle,System.Single,System.Single) + // +public: + void FillPieRectangle( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create rectangle for ellipse. + Rectangle rect = Rectangle(0,0,200,100); + + // Create start and sweep angles. + float startAngle = 0.0F; + float sweepAngle = 45.0F; + + // Fill pie to screen. + e->Graphics->FillPie( redBrush, rect, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillPie(System.Drawing.Brush,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void FillPieInt( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create location and size of ellipse. + int x = 0; + int y = 0; + int width = 200; + int height = 100; + + // Create start and sweep angles. + int startAngle = 0; + int sweepAngle = 45; + + // Fill pie to screen. + e->Graphics->FillPie( redBrush, x, y, width, height, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillPie(System.Drawing.Brush,System.Single,System.Single,System.Single,System.Single,System.Single,System.Single) + // +public: + void FillPieFloat( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::Red ); + + // Create location and size of ellipse. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 100.0F; + + // Create start and sweep angles. + float startAngle = 0.0F; + float sweepAngle = 45.0F; + + // Fill pie to screen. + e->Graphics->FillPie( redBrush, x, y, width, height, startAngle, sweepAngle ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.Point[]) + // +public: + void FillPolygonPoint( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create points that define polygon. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Draw polygon to screen. + e->Graphics->FillPolygon( blueBrush, curvePoints ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.Point[],System.Drawing.Drawing2D.FillMode) + // +public: + void FillPolygonPointFillMode( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create points that define polygon. + Point point1 = Point(50,50); + Point point2 = Point(100,25); + Point point3 = Point(200,5); + Point point4 = Point(250,50); + Point point5 = Point(300,100); + Point point6 = Point(350,200); + Point point7 = Point(250,250); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Define fill mode. + FillMode newFillMode = FillMode::Winding; + + // Draw polygon to screen. + e->Graphics->FillPolygon( blueBrush, curvePoints, newFillMode ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.PointF[]) + // +public: + void FillPolygonPointF( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create points that define polygon. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Fill polygon to screen. + e->Graphics->FillPolygon( blueBrush, curvePoints ); + } + // + // Snippet for: M:System.Drawing.Graphics.FillPolygon(System.Drawing.Brush,System.Drawing.PointF[],System.Drawing.Drawing2D.FillMode) + + // +public: + void FillPolygonPointFFillMode( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create points that define polygon. + PointF point1 = PointF(50.0F,50.0F); + PointF point2 = PointF(100.0F,25.0F); + PointF point3 = PointF(200.0F,5.0F); + PointF point4 = PointF(250.0F,50.0F); + PointF point5 = PointF(300.0F,100.0F); + PointF point6 = PointF(350.0F,200.0F); + PointF point7 = PointF(250.0F,250.0F); + array^ curvePoints = {point1,point2,point3,point4,point5,point6,point7}; + + // Define fill mode. + FillMode newFillMode = FillMode::Winding; + + // Fill polygon to screen. + e->Graphics->FillPolygon( blueBrush, curvePoints, newFillMode ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp new file mode 100644 index 00000000000..1412e743da7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicGraphicsExamples3/CPP/form1.cpp @@ -0,0 +1,1410 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing::Drawing2D; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Drawing.Rectangle) + // +public: + void FillRectangleRectangle( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create rectangle. + Rectangle rect = Rectangle(0,0,200,200); + + // Fill rectangle to screen. + e->Graphics->FillRectangle( blueBrush, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Drawing.RectangleF) + // +public: + void FillRectangleRectangleF( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create rectangle. + RectangleF rect = RectangleF(0.0F,0.0F,200.0F,200.0F); + + // Fill rectangle to screen. + e->Graphics->FillRectangle( blueBrush, rect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void FillRectangleInt( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create location and size of rectangle. + int x = 0; + int y = 0; + int width = 200; + int height = 200; + + // Fill rectangle to screen. + e->Graphics->FillRectangle( blueBrush, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillRectangle(System.Drawing.Brush,System.Single,System.Single,System.Single,System.Single) + // +public: + void FillRectangleFloat( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create location and size of rectangle. + float x = 0.0F; + float y = 0.0F; + float width = 200.0F; + float height = 200.0F; + + // Fill rectangle to screen. + e->Graphics->FillRectangle( blueBrush, x, y, width, height ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillRectangles(System.Drawing.Brush,System.Drawing.Rectangle[]) + // +public: + void FillRectanglesRectangle( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create array of rectangles. + array^ rects = {Rectangle(0,0,100,200),Rectangle(100,200,250,50),Rectangle(300,0,50,100)}; + + // Fill rectangles to screen. + e->Graphics->FillRectangles( blueBrush, rects ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillRectangles(System.Drawing.Brush,System.Drawing.RectangleF[]) + // +public: + void FillRectanglesRectangleF( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create array of rectangles. + array^ rects = {RectangleF(0.0F,0.0F,100.0F,200.0F),RectangleF(100.0F,200.0F,250.0F,50.0F),RectangleF(300.0F,0.0F,50.0F,100.0F)}; + + // Fill rectangles to screen. + e->Graphics->FillRectangles( blueBrush, rects ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FillRegion(System.Drawing.Brush,System.Drawing.Region) + // +public: + void FillRegionRectangle( PaintEventArgs^ e ) + { + // Create solid brush. + SolidBrush^ blueBrush = gcnew SolidBrush( Color::Blue ); + + // Create rectangle for region. + Rectangle fillRect = Rectangle(100,100,200,200); + + // Create region for fill. + System::Drawing::Region^ fillRegion = gcnew System::Drawing::Region( fillRect ); + + // Fill region to screen. + e->Graphics->FillRegion( blueBrush, fillRegion ); + } + // + + // Snippet for: M:System.Drawing.Graphics.FromHdc(System.IntPtr) + // +public: + void FromHdcHdc( PaintEventArgs^ e ) + { + // Get handle to device context. + IntPtr hdc = e->Graphics->GetHdc(); + + // Create new graphics object using handle to device context. + Graphics^ newGraphics = Graphics::FromHdc( hdc ); + + // Draw rectangle to screen. + newGraphics->DrawRectangle( gcnew Pen( Color::Red,3.0f ), 0, 0, 200, 100 ); + + // Release handle to device context and dispose of the // Graphics object + e->Graphics->ReleaseHdc( hdc ); + delete newGraphics; + } + // + + // Snippet for: M:System.Drawing.Graphics.FromHwnd(System.IntPtr) + // +public: + void FromHwndHwnd( PaintEventArgs^ /*e*/ ) + { + // Get handle to form. + IntPtr hwnd = this->Handle; + + // Create new graphics object using handle to window. + Graphics^ newGraphics = Graphics::FromHwnd( hwnd ); + + // Draw rectangle to screen. + newGraphics->DrawRectangle( gcnew Pen( Color::Red,3.0f ), 0, 0, 200, 100 ); + + // Dispose of new graphics. + delete newGraphics; + } + // + + // Snippet for: M:System.Drawing.Graphics.FromImage(System.Drawing.Image) + // +public: + void FromImageImage( PaintEventArgs^ e ) + { + // Create image. + Image^ imageFile = Image::FromFile( "SampImag.jpg" ); + + // Create graphics object for alteration. + Graphics^ newGraphics = Graphics::FromImage( imageFile ); + + // Alter image. + newGraphics->FillRectangle( gcnew SolidBrush( Color::Black ), 100, 50, 100, 100 ); + + // Draw image to screen. + e->Graphics->DrawImage( imageFile, PointF(0.0F,0.0F) ); + + // Dispose of graphics object. + delete newGraphics; + } + // + + // Snippet for: M:System.Drawing.Graphics.GetHalftonePalette + // +private: + [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] + static IntPtr SelectPalette( IntPtr hdc, IntPtr htPalette, bool bForceBackground ); + + [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] + static int RealizePalette( IntPtr hdc ); + +public: + void GetHalftonePaletteVoid( PaintEventArgs^ e ) + { + // Create and draw image. + Image^ imageFile = Image::FromFile( "SampImag.jpg" ); + e->Graphics->DrawImage( imageFile, Point(0,0) ); + + // Get handle to device context. + IntPtr hdc = e->Graphics->GetHdc(); + + // Get handle to halftone palette. + IntPtr htPalette = Graphics::GetHalftonePalette(); + + // Select and realize new palette. + SelectPalette( hdc, htPalette, true ); + RealizePalette( hdc ); + + // Create new graphics object. + Graphics^ newGraphics = Graphics::FromHdc( hdc ); + + // Draw image with new palette. + newGraphics->DrawImage( imageFile, 300, 0 ); + + // Release handle to device context. + e->Graphics->ReleaseHdc( hdc ); + } + // + + // Snippet for: M:System.Drawing.Graphics.GetHdc + // +private: + [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] + static bool Rectangle( IntPtr hdc, int ulCornerX, int ulCornerY, int lrCornerX, int lrCornerY ); + +public: + void GetHdcForGDI1( PaintEventArgs^ e ) + { + // Create pen. + Pen^ redPen = gcnew Pen( Color::Red,1.0f ); + + // Draw rectangle with GDI+. + e->Graphics->DrawRectangle( redPen, 10, 10, 100, 50 ); + + // Get handle to device context. + IntPtr hdc = e->Graphics->GetHdc(); + + // Draw rectangle with GDI using default pen. + Rectangle( hdc, 10, 70, 110, 120 ); + + // Release handle to device context. + e->Graphics->ReleaseHdc( hdc ); + } + // + + // Snippet for: M:System.Drawing.Graphics.GetNearestColor(System.Drawing.Color) + // +public: + void GetNearestColorColor( PaintEventArgs^ e ) + { + // Create solid brush with arbitrary color. + Color arbColor = Color::FromArgb( 255, 165, 63, 136 ); + SolidBrush^ arbBrush = gcnew SolidBrush( arbColor ); + + // Fill ellipse on screen. + e->Graphics->FillEllipse( arbBrush, 0, 0, 200, 100 ); + + // Get nearest color. + Color realColor = e->Graphics->GetNearestColor( arbColor ); + SolidBrush^ realBrush = gcnew SolidBrush( realColor ); + + // Fill ellipse on screen. + e->Graphics->FillEllipse( realBrush, 0, 100, 200, 100 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.IntersectClip(System.Drawing.Rectangle) + // +public: + void IntersectClipRectangle( PaintEventArgs^ e ) + { + // Set clipping region. + Rectangle clipRect = Rectangle(0,0,200,200); + e->Graphics->SetClip( clipRect ); + + // Update clipping region to intersection of + // existing region with specified rectangle. + Rectangle intersectRect = Rectangle(100,100,200,200); + e->Graphics->IntersectClip( intersectRect ); + + // Fill rectangle to demonstrate effective clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); + + // Reset clipping region to infinite. + e->Graphics->ResetClip(); + + // Draw clipRect and intersectRect to screen. + e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.IntersectClip(System.Drawing.RectangleF) + // +public: + void IntersectClipRectangleF1( PaintEventArgs^ e ) + { + // Set clipping region. + Rectangle clipRect = Rectangle(0,0,200,200); + e->Graphics->SetClip( clipRect ); + + // Update clipping region to intersection of + // existing region with specified rectangle. + RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F); + e->Graphics->IntersectClip( intersectRectF ); + + // Fill rectangle to demonstrate effective clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); + + // Reset clipping region to infinite. + e->Graphics->ResetClip(); + + // Draw clipRect and intersectRect to screen. + e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.IntersectClip(System.Drawing.Region) + // +public: + void IntersectClipRegion( PaintEventArgs^ e ) + { + // Set clipping region. + Rectangle clipRect = Rectangle(0,0,200,200); + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( clipRect ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Update clipping region to intersection of + // existing region with specified rectangle. + Rectangle intersectRect = Rectangle(100,100,200,200); + System::Drawing::Region^ intersectRegion = gcnew System::Drawing::Region( intersectRect ); + e->Graphics->IntersectClip( intersectRegion ); + + // Fill rectangle to demonstrate effective clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); + + // Reset clipping region to infinite. + e->Graphics->ResetClip(); + + // Draw clipRect and intersectRect to screen. + e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), intersectRect ); + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.Point) + // +public: + void IsVisiblePoint( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of points. + int x1 = 100; + int y1 = 100; + int x2 = 200; + int y2 = 200; + Point point1 = Point(x1,y1); + Point point2 = Point(x2,y2); + + // If point is visible, fill ellipse that represents it. + if ( e->Graphics->IsVisible( point1 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10, 10 ); + } + + if ( e->Graphics->IsVisible( point2 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10, 10 ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.PointF) + // +public: + void IsVisiblePointF( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of points. + float x1 = 100.0F; + float y1 = 100.0F; + float x2 = 200.0F; + float y2 = 200.0F; + PointF point1 = PointF(x1,y1); + PointF point2 = PointF(x2,y2); + + // If point is visible, fill ellipse that represents it. + if ( e->Graphics->IsVisible( point1 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10.0F, 10.0F ); + } + + if ( e->Graphics->IsVisible( point2 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10.0F, 10.0F ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.Rectangle) + // +public: + void IsVisibleRectangle( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of rectangles. + Rectangle rect1 = Rectangle(100,100,20,20); + Rectangle rect2 = Rectangle(200,200,20,20); + + // If rectangle is visible, fill it. + if ( e->Graphics->IsVisible( rect1 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), rect1 ); + } + + if ( e->Graphics->IsVisible( rect2 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), rect2 ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Drawing.RectangleF) + // +public: + void IsVisibleRectangleF( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of rectangles. + RectangleF rect1 = RectangleF(100.0F,100.0F,20.0F,20.0F); + RectangleF rect2 = RectangleF(200.0F,200.0F,20.0F,20.0F); + + // If rectangle is visible, fill it. + if ( e->Graphics->IsVisible( rect1 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), rect1 ); + } + + if ( e->Graphics->IsVisible( rect2 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), rect2 ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Int32,System.Int32) + // +public: + void IsVisibleInt( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of points. + int x1 = 100; + int y1 = 100; + int x2 = 200; + int y2 = 200; + + // If point is visible, fill ellipse that represents it. + if ( e->Graphics->IsVisible( x1, y1 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10, 10 ); + } + + if ( e->Graphics->IsVisible( x2, y2 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10, 10 ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Int32,System.Int32,System.Int32,System.Int32) + // +public: + void IsVisible4Int( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of rectangles. + int x1 = 100; + int y1 = 100; + int width1 = 20; + int height1 = 20; + int x2 = 200; + int y2 = 200; + int width2 = 20; + int height2 = 20; + + // If rectangle is visible, fill it. + if ( e->Graphics->IsVisible( x1, y1, width1, height1 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), x1, y1, width1, height1 ); + } + + if ( e->Graphics->IsVisible( x2, y2, width2, height2 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), x2, y2, width2, height2 ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Single,System.Single) + // +public: + void IsVisibleFloat( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of points. + float x1 = 100.0F; + float y1 = 100.0F; + float x2 = 200.0F; + float y2 = 200.0F; + + // If point is visible, fill ellipse that represents it. + if ( e->Graphics->IsVisible( x1, y1 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Red ), x1, y1, 10.0F, 10.0F ); + } + + if ( e->Graphics->IsVisible( x2, y2 ) ) + { + e->Graphics->FillEllipse( gcnew SolidBrush( Color::Blue ), x2, y2, 10.0F, 10.0F ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.IsVisible(System.Single,System.Single,System.Single,System.Single) + // +public: + void IsVisible4Float( PaintEventArgs^ e ) + { + // Set clip region. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(50,50,100,100) ); + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Set up coordinates of rectangles. + float x1 = 100.0F; + float y1 = 100.0F; + float width1 = 20.0F; + float height1 = 20.0F; + float x2 = 200.0F; + float y2 = 200.0F; + float width2 = 20.0F; + float height2 = 20.0F; + + // If rectangle is visible, fill it. + if ( e->Graphics->IsVisible( x1, y1, width1, height1 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), x1, y1, width1, height1 ); + } + + if ( e->Graphics->IsVisible( x2, y2, width2, height2 ) ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), x2, y2, width2, height2 ); + } + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureCharacterRanges(System.String,System.Drawing.Font,System.Drawing.RectangleF,System.Drawing.StringFormat) + // +public: + void MeasureCharacterRangesRegions( PaintEventArgs^ e ) + { + // Set up string. + String^ measureString = "First and Second ranges"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Times New Roman",16.0F ); + + // Set character ranges to "First" and "Second". + array^ characterRanges = {CharacterRange(0,5),CharacterRange(10,6)}; + + // Create rectangle for layout. + float x = 50.0F; + float y = 50.0F; + float width = 35.0F; + float height = 200.0F; + RectangleF layoutRect = RectangleF(x,y,width,height); + + // Set string format. + StringFormat^ stringFormat = gcnew StringFormat; + stringFormat->FormatFlags = StringFormatFlags::DirectionVertical; + stringFormat->SetMeasurableCharacterRanges( characterRanges ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, x, y, stringFormat ); + + // Measure two ranges in string. + array^stringRegions = e->Graphics->MeasureCharacterRanges( measureString, + stringFont, layoutRect, stringFormat ); + + // Draw rectangle for first measured range. + RectangleF measureRect1 = stringRegions[ 0 ]->GetBounds( e->Graphics ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), Rectangle::Round( measureRect1 ) ); + + // Draw rectangle for second measured range. + RectangleF measureRect2 = stringRegions[ 1 ]->GetBounds( e->Graphics ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,1.0f ), Rectangle::Round( measureRect2 ) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font) + // +public: + void MeasureStringMin( PaintEventArgs^ e ) + { + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Measure string. + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.PointF,System.Drawing.StringFormat) + // +public: + void MeasureStringPointFFormat( PaintEventArgs^ e ) + { + + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Set point for upper-left corner of string. + float x = 50.0F; + float y = 50.0F; + PointF ulCorner = PointF(x,y); + + // Set string format. + StringFormat^ newStringFormat = gcnew StringFormat; + newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; + + // Measure string. + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, ulCorner, newStringFormat ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), x, y, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, ulCorner, newStringFormat ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.SizeF) + // +public: + void MeasureStringSizeF( PaintEventArgs^ e ) + { + + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Set maximum layout size. + SizeF layoutSize = SizeF(200.0F,50.0F); + + // Measure string. + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, layoutSize ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.SizeF,System.Drawing.StringFormat) + // +public: + void MeasureStringSizeFFormat( PaintEventArgs^ e ) + { + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Set maximum layout size. + SizeF layoutSize = SizeF(100.0F,200.0F); + + // Set string format. + StringFormat^ newStringFormat = gcnew StringFormat; + newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; + + // Measure string. + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, layoutSize, newStringFormat ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0), newStringFormat ); + } + // + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Drawing.SizeF,System.Drawing.StringFormat,System.Int32@,System.Int32@) + + // +public: + void MeasureStringSizeFFormatInts( PaintEventArgs^ e ) + { + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Set maximum layout size. + SizeF layoutSize = SizeF(100.0F,200.0F); + + // Set string format. + StringFormat^ newStringFormat = gcnew StringFormat; + newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; + + // Measure string. + int charactersFitted; + int linesFilled; + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, layoutSize, newStringFormat, charactersFitted, linesFilled ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0), newStringFormat ); + + // Draw output parameters to screen. + String^ outString = String::Format( "chars {0}, lines {1}", charactersFitted, linesFilled ); + e->Graphics->DrawString( outString, stringFont, Brushes::Black, PointF(100,0) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Int32) + // +public: + void MeasureStringWidth( PaintEventArgs^ e ) + { + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Set maximum width of string. + int stringWidth = 200; + + // Measure string. + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, stringWidth ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MeasureString(System.String,System.Drawing.Font,System.Int32,System.Drawing.StringFormat) + // +public: + void MeasureStringWidthFormat( PaintEventArgs^ e ) + { + // Set up string. + String^ measureString = "Measure String"; + System::Drawing::Font^ stringFont = gcnew System::Drawing::Font( "Arial",16 ); + + // Set maximum width of string. + int stringWidth = 100; + + // Set string format. + StringFormat^ newStringFormat = gcnew StringFormat; + newStringFormat->FormatFlags = StringFormatFlags::DirectionVertical; + + // Measure string. + SizeF stringSize = e->Graphics->MeasureString( measureString, stringFont, stringWidth, newStringFormat ); + + // Draw rectangle representing size of string. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), 0.0F, 0.0F, stringSize.Width, stringSize.Height ); + + // Draw string to screen. + e->Graphics->DrawString( measureString, stringFont, Brushes::Black, PointF(0,0), newStringFormat ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MultiplyTransform(System.Drawing.Drawing2D.Matrix) + // +public: + void MultiplyTransformMatrix( PaintEventArgs^ e ) + { + // Create transform matrix. + Matrix^ transformMatrix = gcnew Matrix; + + // Translate matrix, prepending translation vector. + transformMatrix->Translate( 200.0F, 100.0F ); + + // Rotate transformation matrix of graphics object, + // prepending rotation matrix. + e->Graphics->RotateTransform( 30.0F ); + + // Multiply (prepend to) transformation matrix of + // graphics object to translate graphics transformation. + e->Graphics->MultiplyTransform( transformMatrix ); + + // Draw rotated, translated ellipse. + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void MultiplyTransformMatrixOrder( PaintEventArgs^ e ) + { + // Create transform matrix. + Matrix^ transformMatrix = gcnew Matrix; + + // Translate matrix, prepending translation vector. + transformMatrix->Translate( 200.0F, 100.0F ); + + // Rotate transformation matrix of graphics object, + // prepending rotation matrix. + e->Graphics->RotateTransform( 30.0F ); + + // Multiply (append to) transformation matrix of + // graphics object to translate graphics transformation. + e->Graphics->MultiplyTransform( transformMatrix, MatrixOrder::Append ); + + // Draw rotated, translated ellipse. + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), -80, -40, 160, 80 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.ReleaseHdc(System.IntPtr) + // +private: + [System::Runtime::InteropServices::DllImportAttribute("gdi32.dll")] + static bool Rectangle2( IntPtr hdc, int ulCornerX, int ulCornerY, int lrCornerX, int lrCornerY ); + +public: + void GetHdcForGDI2( PaintEventArgs^ e ) + { + // Create pen. + Pen^ redPen = gcnew Pen( Color::Red,1.0f ); + + // Draw rectangle with GDI+. + e->Graphics->DrawRectangle( redPen, 10, 10, 100, 50 ); + + // Get handle to device context. + IntPtr hdc = e->Graphics->GetHdc(); + + // Draw rectangle with GDI using default pen. + Rectangle2( hdc, 10, 70, 110, 120 ); + + // Release handle to device context. + e->Graphics->ReleaseHdc( hdc ); + } + // + // Snippet for: M:System.Drawing.Graphics.ResetClip + + // +public: + void IntersectClipRectangleF2( PaintEventArgs^ e ) + { + // Set clipping region. + Rectangle clipRect = Rectangle(0,0,200,200); + e->Graphics->SetClip( clipRect ); + + // Update clipping region to intersection of + // existing region with specified rectangle. + RectangleF intersectRectF = RectangleF(100.0F,100.0F,200.0F,200.0F); + e->Graphics->IntersectClip( intersectRectF ); + + // Fill rectangle to demonstrate effective clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 500, 500 ); + + // Reset clipping region to infinite. + e->Graphics->ResetClip(); + + // Draw clipRect and intersectRect to screen. + e->Graphics->DrawRectangle( gcnew Pen( Color::Black ), clipRect ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), Rectangle::Round( intersectRectF ) ); + } + // + + // Snippet for: M:System.Drawing.Graphics.ResetTransform + // +public: + void SaveRestore1( PaintEventArgs^ e ) + { + // Translate transformation matrix. + e->Graphics->TranslateTransform( 100, 0 ); + + // Save translated graphics state. + GraphicsState^ transState = e->Graphics->Save(); + + // Reset transformation matrix to identity and fill rectangle. + e->Graphics->ResetTransform(); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 ); + + // Restore graphics state to translated state and fill second + // rectangle. + e->Graphics->Restore( transState ); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.Restore(System.Drawing.Drawing2D.GraphicsState) + // +public: + void SaveRestore2( PaintEventArgs^ e ) + { + // Translate transformation matrix. + e->Graphics->TranslateTransform( 100, 0 ); + + // Save translated graphics state. + GraphicsState^ transState = e->Graphics->Save(); + + // Reset transformation matrix to identity and fill rectangle. + e->Graphics->ResetTransform(); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 ); + + // Restore graphics state to translated state and fill second + // rectangle. + e->Graphics->Restore( transState ); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.RotateTransform(System.Single) + // +public: + void RotateTransformAngle( PaintEventArgs^ e ) + { + // Set world transform of graphics object to translate. + e->Graphics->TranslateTransform( 100.0F, 0.0F ); + + // Then to rotate, prepending rotation matrix. + e->Graphics->RotateTransform( 30.0F ); + + // Draw rotated, translated ellipse to screen. + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void RotateTransformAngleMatrixOrder( PaintEventArgs^ e ) + { + // Set world transform of graphics object to translate. + e->Graphics->TranslateTransform( 100.0F, 0.0F ); + + // Then to rotate, appending rotation matrix. + e->Graphics->RotateTransform( 30.0F, MatrixOrder::Append ); + + // Draw translated, rotated ellipse to screen. + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.Save + // +public: + void SaveRestore3( PaintEventArgs^ e ) + { + // Translate transformation matrix. + e->Graphics->TranslateTransform( 100, 0 ); + + // Save translated graphics state. + GraphicsState^ transState = e->Graphics->Save(); + + // Reset transformation matrix to identity and fill rectangle. + e->Graphics->ResetTransform(); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), 0, 0, 100, 100 ); + + // Restore graphics state to translated state and fill second + // rectangle. + e->Graphics->Restore( transState ); + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.ScaleTransform(System.Single,System.Single) + // +public: + void ScaleTransformFloat( PaintEventArgs^ e ) + { + // Set world transform of graphics object to rotate. + e->Graphics->RotateTransform( 30.0F ); + + // Then to scale, prepending to world transform. + e->Graphics->ScaleTransform( 3.0F, 1.0F ); + + // Draw scaled, rotated rectangle to screen. + e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,3.0f ), 50, 0, 100, 40 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void ScaleTransformFloatMatrixOrder( PaintEventArgs^ e ) + { + // Set world transform of graphics object to rotate. + e->Graphics->RotateTransform( 30.0F ); + + // Then to scale, appending to world transform. + e->Graphics->ScaleTransform( 3.0F, 1.0F, MatrixOrder::Append ); + + // Draw rotated, scaled rectangle to screen. + e->Graphics->DrawRectangle( gcnew Pen( Color::Blue,3.0f ), 50, 0, 100, 40 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Drawing2D.GraphicsPath) + // +public: + void SetClipPath( PaintEventArgs^ e ) + { + // Create graphics path. + GraphicsPath^ clipPath = gcnew GraphicsPath; + clipPath->AddEllipse( 0, 0, 200, 100 ); + + // Set clipping region to path. + e->Graphics->SetClip( clipPath ); + + // Fill rectangle to demonstrate clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Drawing2D.GraphicsPath,System.Drawing.Drawing2D.CombineMode) + // +public: + void SetClipPathCombine( PaintEventArgs^ e ) + { + // Create graphics path. + GraphicsPath^ clipPath = gcnew GraphicsPath; + clipPath->AddEllipse( 0, 0, 200, 100 ); + + // Set clipping region to path. + e->Graphics->SetClip( clipPath, CombineMode::Replace ); + + // Fill rectangle to demonstrate clipping region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Graphics) + // +public: + void SetClipGraphics( PaintEventArgs^ e ) + { + // Create temporary graphics object and set its clipping region. + Graphics^ newGraphics = this->CreateGraphics(); + newGraphics->SetClip( Rectangle(0,0,100,100) ); + + // Update clipping region of graphics to clipping region of new + // graphics. + e->Graphics->SetClip( newGraphics ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + + // Release new graphics. + delete newGraphics; + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Graphics,System.Drawing.Drawing2D.CombineMode) + // +public: + void SetClipGraphicsCombine( PaintEventArgs^ e ) + { + // Create temporary graphics object and set its clipping region. + Graphics^ newGraphics = this->CreateGraphics(); + newGraphics->SetClip( Rectangle(0,0,100,100) ); + + // Update clipping region of graphics to clipping region of new + // graphics. + e->Graphics->SetClip( newGraphics, CombineMode::Replace ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + + // Release new graphics. + delete newGraphics; + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Rectangle) + // +public: + void SetClipRectangle( PaintEventArgs^ e ) + { + // Create rectangle for clipping region. + Rectangle clipRect = Rectangle(0,0,100,100); + + // Set clipping region of graphics to rectangle. + e->Graphics->SetClip( clipRect ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Rectangle,System.Drawing.Drawing2D.CombineMode) + // +public: + void SetClipRectangleCombine( PaintEventArgs^ e ) + { + // Create rectangle for clipping region. + Rectangle clipRect = Rectangle(0,0,100,100); + + // Set clipping region of graphics to rectangle. + e->Graphics->SetClip( clipRect, CombineMode::Replace ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.RectangleF) + // +public: + void SetClipRectangleF( PaintEventArgs^ e ) + { + // Create rectangle for clipping region. + RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F); + + // Set clipping region of graphics to rectangle. + e->Graphics->SetClip( clipRect ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.RectangleF,System.Drawing.Drawing2D.CombineMode) + // +public: + void SetClipRectangleFCombine( PaintEventArgs^ e ) + { + // Create rectangle for clipping region. + RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F); + + // Set clipping region of graphics to rectangle. + e->Graphics->SetClip( clipRect, CombineMode::Replace ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.SetClip(System.Drawing.Region,System.Drawing.Drawing2D.CombineMode) + // +public: + void SetClipRegionCombine( PaintEventArgs^ e ) + { + // Create region for clipping. + System::Drawing::Region^ clipRegion = gcnew System::Drawing::Region( Rectangle(0,0,100,100) ); + + // Set clipping region of graphics to region. + e->Graphics->SetClip( clipRegion, CombineMode::Replace ); + + // Fill rectangle to demonstrate clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.Point[]) + // +public: + void TransformPointsPoint( PaintEventArgs^ e ) + { + // Create array of two points. + array^ points = {Point(0,0),Point(100,50)}; + + // Draw line connecting two untransformed points. + e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] ); + + // Set world transformation of Graphics object to translate. + e->Graphics->TranslateTransform( 40, 30 ); + + // Transform points in array from world to page coordinates. + e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points ); + + // Reset world transformation. + e->Graphics->ResetTransform(); + + // Draw line that connects transformed points. + e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] ); + } + // + + // Snippet for: M:System.Drawing.Graphics.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.Drawing2D.CoordinateSpace,System.Drawing.PointF[]) + // +public: + void TransformPointsPointF( PaintEventArgs^ e ) + { + // Create array of two points. + array^ points = {PointF(0.0F,0.0F),PointF(100.0F,50.0F)}; + + // Draw line connecting two untransformed points. + e->Graphics->DrawLine( gcnew Pen( Color::Blue,3.0f ), points[ 0 ], points[ 1 ] ); + + // Set world transformation of Graphics object to translate. + e->Graphics->TranslateTransform( 40.0F, 30.0F ); + + // Transform points in array from world to page coordinates. + e->Graphics->TransformPoints( CoordinateSpace::Page, CoordinateSpace::World, points ); + + // Reset world transformation. + e->Graphics->ResetTransform(); + + // Draw line that connects transformed points. + e->Graphics->DrawLine( gcnew Pen( Color::Red,3.0f ), points[ 0 ], points[ 1 ] ); + } + // + // Snippet for: M:System.Drawing.Graphics.TranslateClip(System.Int32,System.Int32) + + // +public: + void TranslateClipInt( PaintEventArgs^ e ) + { + // Create rectangle for clipping region. + Rectangle clipRect = Rectangle(0,0,100,100); + + // Set clipping region of graphics to rectangle. + e->Graphics->SetClip( clipRect ); + + // Translate clipping region. + int dx = 50; + int dy = 50; + e->Graphics->TranslateClip( dx, dy ); + + // Fill rectangle to demonstrate translated clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + // Snippet for: M:System.Drawing.Graphics.TranslateClip(System.Single,System.Single) + + // +public: + void TranslateClipFloat( PaintEventArgs^ e ) + { + // Create rectangle for clipping region. + RectangleF clipRect = RectangleF(0.0F,0.0F,100.0F,100.0F); + + // Set clipping region of graphics to rectangle. + e->Graphics->SetClip( clipRect ); + + // Translate clipping region. + float dx = 50.0F; + float dy = 50.0F; + e->Graphics->TranslateClip( dx, dy ); + + // Fill rectangle to demonstrate translated clip region. + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Black ), 0, 0, 500, 300 ); + } + // + // Snippet for: M:System.Drawing.Graphics.TranslateTransform(System.Single,System.Single) + + // +public: + void TranslateTransformAngle( PaintEventArgs^ e ) + { + // Set world transform of graphics object to rotate. + e->Graphics->RotateTransform( 30.0F ); + + // Then to translate, prepending to world transform. + e->Graphics->TranslateTransform( 100.0F, 0.0F ); + + // Draw translated, rotated ellipse to screen. + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); + } + // + + // Snippet for: M:System.Drawing.Graphics.TranslateTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void TranslateTransformAngleMatrixOrder( PaintEventArgs^ e ) + { + // Set world transform of graphics object to rotate. + e->Graphics->RotateTransform( 30.0F ); + + // Then to translate, appending to world transform. + e->Graphics->TranslateTransform( 100.0F, 0.0F, MatrixOrder::Append ); + + // Draw rotated, translated ellipse to screen. + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue,3.0f ), 0, 0, 200, 80 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp new file mode 100644 index 00000000000..d1b0d2404de --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImageAnimator/cpp/form1.cpp @@ -0,0 +1,83 @@ + + +// Snippet for: M:System.Drawing.ImageAnimator. +// Animate(System.Drawing.Image,System.EventHandler) +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class AnimateImageForm : public Form +{ + + // Create a Bitmap Object. +private: + Bitmap^ animatedImage; +private: + bool currentlyAnimating; + +public: + AnimateImageForm() + { + try + { + animatedImage = gcnew Bitmap("SampleAnimation.gif"); + } + catch (ArgumentException^) + { + MessageBox::Show("Could not read the image file " + + "\"SampleAnimation.gif\",\n" + + "or it is not a valid image file."); + } + } + + // This method begins the animation. +public: + void AnimateImage() + { + // Begin the animation only once. + // Make sure to animate only if animatedImage was + // successfully initialised. + if (!currentlyAnimating && animatedImage != nullptr) + { + ImageAnimator::Animate(animatedImage, + gcnew EventHandler(this, &AnimateImageForm::OnFrameChanged)); + currentlyAnimating = true; + } + } + +private: + void OnFrameChanged(Object^ , EventArgs^ ) + { + // Force a call to the Paint event handler. + this->Invalidate(); + } + +protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + // Begin the animation. + AnimateImage(); + + // Get the next frame ready for rendering. + ImageAnimator::UpdateFrames(); + + if (animatedImage != nullptr) + { + // Draw the next frame in the animation. + e->Graphics->DrawImage(this->animatedImage, + Point(0, 0)); + } + } +}; + +[STAThread] +int main() +{ + Application::Run(gcnew AnimateImageForm()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp new file mode 100644 index 00000000000..78442ccba68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImaging.ImageAttributes/CPP/form1.cpp @@ -0,0 +1,300 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +public: + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetBrushRemapTable(System.Drawing.Imaging.ColorMap[]) + // + void SetBrushRemapTableExample( PaintEventArgs^ /*e*/ ) + { + // Create a color map. + array^myColorMap = gcnew array(1); + myColorMap[ 0 ] = gcnew ColorMap; + myColorMap[ 0 ]->OldColor = Color::Red; + myColorMap[ 0 ]->NewColor = Color::Green; + + // Create an ImageAttributes object, passing it to the myColorMap + // array. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetBrushRemapTable( myColorMap ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetColorKey(System.Drawing.Color,System.Drawing.Color,System.Drawing.Imaging.ColorAdjustType) + // +private: + void SetColorKeyExample( PaintEventArgs^ e ) + { + // Open an Image file and draw it to the screen. + Image^ myImage = Image::FromFile( "Circle.bmp" ); + e->Graphics->DrawImage( myImage, 20, 20 ); + + // Create an ImageAttributes object and set the color key. + Color lowerColor = Color::FromArgb( 245, 0, 0 ); + Color upperColor = Color::FromArgb( 255, 0, 0 ); + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetColorKey( lowerColor, upperColor, ColorAdjustType::Default ); + + // Draw the image with the color key set. + Rectangle rect = Rectangle(150,20,100,100); + e->Graphics->DrawImage( myImage, rect, 0, 0, 100, 100, GraphicsUnit::Pixel, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetColorMatrix(System.Drawing.Imaging.ColorMatrix) + // +private: + void SetColorMatrixExample( PaintEventArgs^ e ) + { + // Create a rectangle image with all colors set to 128 (medium + // gray). + Bitmap^ myBitmap = gcnew Bitmap( 50,50,PixelFormat::Format32bppArgb ); + Graphics^ g = Graphics::FromImage( myBitmap ); + g->FillRectangle( gcnew SolidBrush( Color::FromArgb( 255, 128, 128, 128 ) ), Rectangle(0,0,50,50) ); + myBitmap->Save( "Rectangle1.jpg" ); + + // Open an Image file and draw it to the screen. + Image^ myImage = Image::FromFile( "Rectangle1.jpg" ); + e->Graphics->DrawImage( myImage, 20, 20 ); + + // Initialize the color matrix. + ColorMatrix^ myColorMatrix = gcnew ColorMatrix; + + // Red + myColorMatrix->Matrix00 = 1.75f; + + // Green + myColorMatrix->Matrix11 = 1.00f; + + // Blue + myColorMatrix->Matrix22 = 1.00f; + + // alpha + myColorMatrix->Matrix33 = 1.00f; + + // w + myColorMatrix->Matrix44 = 1.00f; + + // Create an ImageAttributes object and set the color matrix. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetColorMatrix( myColorMatrix ); + + // Draw the image using the color matrix. + Rectangle rect = Rectangle(100,20,200,200); + e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetGamma(System.Single) + // +private: + void SetGammaExample( PaintEventArgs^ e ) + { + // Create an Image object from the file Camera.jpg, and draw it to + // the screen. + Image^ myImage = Image::FromFile( "Camera.jpg" ); + e->Graphics->DrawImage( myImage, 20, 20 ); + + // Create an ImageAttributes object and set the gamma to 2.2. + System::Drawing::Imaging::ImageAttributes^ imageAttr = + gcnew System::Drawing::Imaging::ImageAttributes; + imageAttr->SetGamma( 2.2f ); + + // Draw the image with gamma set to 2.2. + Rectangle rect = Rectangle(250,20,200,200); + e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetNoOp + // +private: + void SetNoOpExample( PaintEventArgs^ e ) + { + // Create an Image object from the file Camera.jpg. + Image^ myImage = Image::FromFile( "Camera.jpg" ); + + // Create an ImageAttributes object, and set the gamma to 0.25. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetGamma( 0.25f ); + + // Draw the image with gamma set to 0.25. + Rectangle rect1 = Rectangle(20,20,200,200); + e->Graphics->DrawImage( myImage, rect1, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); + + // Call the ImageAttributes NoOp method. + imageAttr->SetNoOp(); + + // Draw the image after NoOp is set, so the default gamma value + // of 1.0 will be used. + Rectangle rect2 = Rectangle(250,20,200,200); + e->Graphics->DrawImage( myImage, rect2, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetRemapTable(System.Drawing.Imaging.ColorMap[]) + // +private: + void SetRemapTableExample( PaintEventArgs^ e ) + { + // Create a filled, red image, and save it to Circle2.jpg. + Bitmap^ myBitmap = gcnew Bitmap( 50,50 ); + Graphics^ g = Graphics::FromImage( myBitmap ); + g->Clear( Color::White ); + g->FillEllipse( gcnew SolidBrush( Color::Red ), Rectangle(0,0,50,50) ); + myBitmap->Save( "Circle2.jpg" ); + + // Create an Image object from the Circle2.jpg file, and draw it to + // the screen. + Image^ myImage = Image::FromFile( "Circle2.jpg" ); + e->Graphics->DrawImage( myImage, 20, 20 ); + + // Create a color map. + array^myColorMap = gcnew array(1); + myColorMap[ 0 ] = gcnew ColorMap; + myColorMap[ 0 ]->OldColor = Color::Red; + myColorMap[ 0 ]->NewColor = Color::Green; + + // Create an ImageAttributes object, and then pass the + // myColorMap object to the SetRemapTable method. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetRemapTable( myColorMap ); + + // Draw the image with the remap table set. + Rectangle rect = Rectangle(150,20,50,50); + e->Graphics->DrawImage( myImage, rect, 0, 0, 50, 50, GraphicsUnit::Pixel, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetThreshold(System.Single) + // + void SetThresholdExample( PaintEventArgs^ e ) + { + // Open an Image file, and draw it to the screen. + Image^ myImage = Image::FromFile( "Camera.jpg" ); + e->Graphics->DrawImage( myImage, 20, 20 ); + + // Create an ImageAttributes object, and set its color threshold. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetThreshold( 0.7f ); + + // Draw the image with the colors bifurcated. + Rectangle rect = Rectangle(300,20,200,200); + e->Graphics->DrawImage( myImage, rect, 0, 0, 200, 200, GraphicsUnit::Pixel, imageAttr ); + } + // + + // Snippet for: M:System.Drawing.Imaging.ImageAttributes.SetWrapMode(System.Drawing.Drawing2D.WrapMode) + // + void SetWrapModeExample( PaintEventArgs^ e ) + { + // Create a filled, red circle, and save it to Circle3.jpg. + Bitmap^ myBitmap = gcnew Bitmap( 50,50 ); + Graphics^ g = Graphics::FromImage( myBitmap ); + g->Clear( Color::White ); + g->FillEllipse( gcnew SolidBrush( Color::Red ), Rectangle(0,0,25,25) ); + myBitmap->Save( "Circle3.jpg" ); + + // Create an Image object from the Circle3.jpg file, and draw it + // to the screen. + Image^ myImage = Image::FromFile( "Circle3.jpg" ); + e->Graphics->DrawImage( myImage, 20, 20 ); + + // Set the wrap mode. + ImageAttributes^ imageAttr = gcnew ImageAttributes; + imageAttr->SetWrapMode( WrapMode::Tile ); + + // Create a TextureBrush. + Rectangle brushRect = Rectangle(0,0,25,25); + TextureBrush^ myTBrush = gcnew TextureBrush( myImage,brushRect,imageAttr ); + + // Draw to the screen a rectangle filled with red circles. + e->Graphics->FillRectangle( myTBrush, 100, 20, 200, 200 ); + } + // + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +/* +This example of the + Decimal::ToInt64( Decimal ) and + Decimal::ToUInt64( Decimal ) +methods generates the following output. It +displays several converted Decimal values. + + Decimal argument __int64/exception unsigned __int64 + ---------------- ----------------- ---------------- + 123 123 123 + 123.000 123 123 + 123.999 123 123 + 18446744073709551615.999 OverflowException 18446744073709551615 + 18446744073709551616 OverflowException OverflowException + 9223372036854775807.999 9223372036854775807 9223372036854775807 + 9223372036854775808 OverflowException 9223372036854775808 + -0.999 0 0 + -1 -1 OverflowException + -9223372036854775808.999 -9223372036854775808 OverflowException + -9223372036854775809 OverflowException OverflowException +*/ diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp new file mode 100644 index 00000000000..75d653f425a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoder2/CPP/form1.cpp @@ -0,0 +1,55 @@ + + +// Snippet for: F:System.Drawing.Imaging.Encoder.Compression +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); +int main() +{ + Bitmap^ myBitmap; + ImageCodecInfo^ myImageCodecInfo; + Encoder^ myEncoder; + EncoderParameter^ myEncoderParameter; + EncoderParameters^ myEncoderParameters; + + // Create a Bitmap object based on a BMP file. + myBitmap = gcnew Bitmap( "Shapes.bmp" ); + + // Get an ImageCodecInfo object that represents the TIFF codec. + myImageCodecInfo = GetEncoderInfo( "image/tiff" ); + + // Create an Encoder object based on the GUID + // for the Compression parameter category. + myEncoder = Encoder::Compression; + + // Create an EncoderParameters object. + // An EncoderParameters object has an array of EncoderParameter + // objects. In this case, there is only one + // EncoderParameter object in the array. + myEncoderParameters = gcnew EncoderParameters( 1 ); + + // Save the bitmap as a TIFF file with LZW compression. + myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::CompressionLZW ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + myBitmap->Save( "ShapesLZW.tif", myImageCodecInfo, myEncoderParameters ); +} + +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) +{ + int j; + array^encoders; + encoders = ImageCodecInfo::GetImageEncoders(); + for ( j = 0; j < encoders->Length; ++j ) + { + if ( encoders[ j ]->MimeType == mimeType ) + return encoders[ j ]; + + } + return nullptr; +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp new file mode 100644 index 00000000000..f78cf4ac684 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEncoderExample5/CPP/form1.cpp @@ -0,0 +1,55 @@ + + +// Snippet for: F:System.Drawing.Imaging.Encoder.Transformation +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); +int main() +{ + Bitmap^ myBitmap; + ImageCodecInfo^ myImageCodecInfo; + Encoder^ myEncoder; + EncoderParameter^ myEncoderParameter; + EncoderParameters^ myEncoderParameters; + + // Create a Bitmap object based on a JPEG file. + myBitmap = gcnew Bitmap( "Shapes.jpg" ); + + // Get an ImageCodecInfo object that represents the JPEG codec. + myImageCodecInfo = GetEncoderInfo( "image/jpeg" ); + + // Create an Encoder object based on the GUID + // for the Transformation parameter category. + myEncoder = Encoder::Transformation; + + // Create an EncoderParameters object. + // An EncoderParameters object has an array of EncoderParameter + // objects. In this case, there is only one + // EncoderParameter object in the array. + myEncoderParameters = gcnew EncoderParameters( 1 ); + + // Rotate the image 90 degrees, and save it as a separate JPEG file. + myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::TransformRotate90 ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + myBitmap->Save( "ShapesR90.jpg", myImageCodecInfo, myEncoderParameters ); +} + +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) +{ + int j; + array^encoders; + encoders = ImageCodecInfo::GetImageEncoders(); + for ( j = 0; j < encoders->Length; ++j ) + { + if ( encoders[ j ]->MimeType == mimeType ) + return encoders[ j ]; + + } + return nullptr; +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp new file mode 100644 index 00000000000..80c43b62d91 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicImagingEndcoder3/CPP/form1.cpp @@ -0,0 +1,65 @@ + + +// Snippet for: F:System.Drawing.Imaging.Encoder.Quality +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +static ImageCodecInfo^ GetEncoderInfo( ImageFormat^ format ); +int main() +{ + Bitmap^ myBitmap; + ImageCodecInfo^ myImageCodecInfo; + Encoder^ myEncoder; + EncoderParameter^ myEncoderParameter; + EncoderParameters^ myEncoderParameters; + + // Create a Bitmap object based on a BMP file. + myBitmap = gcnew Bitmap( "Shapes.bmp" ); + + // Get an ImageCodecInfo object that represents the JPEG codec. + myImageCodecInfo = GetEncoderInfo( ImageFormat->Jpeg ); + + // Create an Encoder object based on the GUID + // for the Quality parameter category. + myEncoder = Encoder::Quality; + + // Create an EncoderParameters object. + // An EncoderParameters object has an array of EncoderParameter + // objects. In this case, there is only one + // EncoderParameter object in the array. + myEncoderParameters = gcnew EncoderParameters( 1 ); + + // Save the bitmap as a JPEG file with quality level 25. + myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(25) ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + myBitmap->Save( "Shapes025.jpg", myImageCodecInfo, myEncoderParameters ); + + // Save the bitmap as a JPEG file with quality level 50. + myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(50) ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + myBitmap->Save( "Shapes050.jpg", myImageCodecInfo, myEncoderParameters ); + + // Save the bitmap as a JPEG file with quality level 75. + myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(75) ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + myBitmap->Save( "Shapes075.jpg", myImageCodecInfo, myEncoderParameters ); +} + +static ImageCodecInfo^ GetEncoderInfo( ImageFormat^ format ) +{ + int j; + array^encoders; + encoders = ImageCodecInfo::GetImageEncoders(); + for ( j = 0; j < encoders->Length; ++j ) + { + if ( encoders[ j ]->FormatID == format->Guid) + return encoders[ j ]; + + } + return nullptr; +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp new file mode 100644 index 00000000000..53345a5cd61 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicPenExamples/CPP/form1.cpp @@ -0,0 +1,273 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); + } + + // Snippet for: M:System.Drawing.Pen.Clone + // +public: + void Clone_Example( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ myPen = gcnew Pen( Color::Black,5.0f ); + + // Clone myPen. + Pen^ clonePen = dynamic_cast(myPen->Clone()); + + // Draw a line with clonePen. + e->Graphics->DrawLine( clonePen, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.MultiplyTransform(System.Drawing.Drawing2D.Matrix) + // +public: + void MultiplyTransform_Example1( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ myPen = gcnew Pen( Color::Black,5.0f ); + + // Create a translation matrix. + Matrix^ penMatrix = gcnew Matrix; + penMatrix->Scale( 3, 1 ); + + // Multiply the transformation matrix of myPen by transMatrix. + myPen->MultiplyTransform( penMatrix ); + + // Draw a line to the screen. + e->Graphics->DrawLine( myPen, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void MultiplyTransform_Example2( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ myPen = gcnew Pen( Color::Black,5.0f ); + + // Create a translation matrix. + Matrix^ penMatrix = gcnew Matrix; + penMatrix->Scale( 3, 1 ); + + // Multiply the transformation matrix of myPen by transMatrix. + myPen->MultiplyTransform( penMatrix, MatrixOrder::Prepend ); + + // Draw a line to the screen. + e->Graphics->DrawLine( myPen, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.ResetTransform + // +public: + void ResetTransform_Example( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ myPen = gcnew Pen( Color::Black,3.0f ); + + // Scale the transformation matrix of myPen. + myPen->ScaleTransform( 2, 1 ); + + // Draw a line with myPen. + e->Graphics->DrawLine( myPen, 10, 0, 10, 200 ); + + // Reset the transformation matrix of myPen to identity. + myPen->ResetTransform(); + + // Draw a second line with myPen. + e->Graphics->DrawLine( myPen, 100, 0, 100, 200 ); + } + // + + // Snippet for: M:System.Drawing.Pen.RotateTransform(System.Single) + // +public: + void RotateTransform_Example1( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ rotatePen = gcnew Pen( Color::Black,5.0f ); + + // Draw a rectangle with rotatePen. + e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 ); + + // Scale rotatePen by 2X in the x-direction. + rotatePen->ScaleTransform( 2, 1 ); + + // Rotate rotatePen 90 degrees clockwise. + rotatePen->RotateTransform( 90 ); + + // Draw a second rectangle with rotatePen. + e->Graphics->DrawRectangle( rotatePen, 140, 10, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void RotateTransform_Example2( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ rotatePen = gcnew Pen( Color::Black,5.0f ); + + // Scale rotatePen by 2X in the x-direction. + rotatePen->ScaleTransform( 2, 1 ); + + // Draw a rectangle with rotatePen. + e->Graphics->DrawRectangle( rotatePen, 10, 10, 100, 100 ); + + // Rotate rotatePen 90 degrees clockwise. + rotatePen->RotateTransform( 90, MatrixOrder::Append ); + + // Draw a second rectangle with rotatePen. + e->Graphics->DrawRectangle( rotatePen, 120, 10, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.ScaleTransform(System.Single,System.Single) + // +public: + void ScaleTransform_Example1( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ scalePen = gcnew Pen( Color::Black,5.0f ); + + // Draw a rectangle with scalePen. + e->Graphics->DrawRectangle( scalePen, 10, 10, 100, 100 ); + + // Scale scalePen by 2X in the x-direction. + scalePen->ScaleTransform( 2, 1 ); + + // Draw a second rectangle with rotatePen. + e->Graphics->DrawRectangle( scalePen, 120, 10, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void ScaleTransform_Example2( PaintEventArgs^ e ) + { + + // Create a Pen object. + Pen^ scalePen = gcnew Pen( Color::Black,5.0f ); + + // Draw a rectangle with scalePen. + e->Graphics->DrawRectangle( scalePen, 10, 10, 100, 100 ); + + // Scale scalePen by 2X in the x-direction. + scalePen->ScaleTransform( 2, 1, MatrixOrder::Prepend ); + + // Draw a second rectangle with rotatePen. + e->Graphics->DrawRectangle( scalePen, 120, 10, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Pen.SetLineCap(System.Drawing.Drawing2D.LineCap,System.Drawing.Drawing2D.LineCap,System.Drawing.Drawing2D.DashCap) + // +public: + void SetLineCap_Example( PaintEventArgs^ e ) + { + + // Create a Pen object with a dash pattern. + Pen^ capPen = gcnew Pen( Color::Black,5.0f ); + capPen->DashStyle = DashStyle::Dash; + + // Set the start and end caps for capPen. + capPen->SetLineCap( LineCap::ArrowAnchor, LineCap::Flat, DashCap::Flat ); + + // Draw a line with capPen. + e->Graphics->DrawLine( capPen, 10, 10, 200, 10 ); + } + // + +private: + void Form1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) + { + SetLineCap_Example( e ); + } +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp new file mode 100644 index 00000000000..d481bf21e14 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleExamples/CPP/form1.cpp @@ -0,0 +1,133 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Rectangle.Inflate(System.Drawing.Rectangle,System.Int32,System.Int32) + // +public: + void RectangleInflateTest( PaintEventArgs^ e ) + { + // Create a rectangle. + Rectangle rect = Rectangle(100,100,50,50); + + // Draw the uninflated rectangle to screen. + e->Graphics->DrawRectangle( Pens::Black, rect ); + + // Call Inflate. + Rectangle rect2 = Rectangle::Inflate( rect, 50, 50 ); + + // Draw the inflated rectangle to screen. + e->Graphics->DrawRectangle( Pens::Red, rect2 ); + } + // + + // Snippet for: M:System.Drawing.Rectangle.Inflate(System.Drawing.Size) + // +public: + void RectangleInflateTest2( PaintEventArgs^ e ) + { + // Create a rectangle. + Rectangle rect = Rectangle(100,100,50,50); + + // Draw the uninflated rectangle to screen. + e->Graphics->DrawRectangle( Pens::Black, rect ); + + // Set up the inflate size. + System::Drawing::Size inflateSize = System::Drawing::Size( 50, 50 ); + + // Call Inflate. + rect.Inflate( inflateSize ); + + // Draw the inflated rectangle to screen. + e->Graphics->DrawRectangle( Pens::Red, rect ); + } + // + + // Snippet for: M:System.Drawing.Rectangle.Inflate(System.Int32,System.Int32) + // +public: + void RectangleInflateTest3( PaintEventArgs^ e ) + { + // Create a rectangle. + Rectangle rect = Rectangle(100,100,50,50); + + // Draw the uninflated rectangle to screen. + e->Graphics->DrawRectangle( Pens::Black, rect ); + + // Call Inflate. + rect.Inflate( 50, 50 ); + + // Draw the inflated rectangle to screen. + e->Graphics->DrawRectangle( Pens::Red, rect ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp new file mode 100644 index 00000000000..bf6dc06947a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRectangleFExamples/CPP/form1.cpp @@ -0,0 +1,147 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.RectangleF.Inflate(System.Drawing.SizeF) + // +public: + void RectangleFInflateExample( PaintEventArgs^ e ) + { + // Create a RectangleF structure. + RectangleF myRectF = RectangleF(100,20,100,100); + + // Draw myRect to the screen. + Rectangle myRect = Rectangle::Truncate( myRectF ); + e->Graphics->DrawRectangle( Pens::Black, myRect ); + + // Create a Size structure. + SizeF inflateSize = SizeF(100,0); + + // Inflate myRect. + myRectF.Inflate( inflateSize ); + + // Draw the inflated rectangle to the screen. + myRect = Rectangle::Truncate( myRectF ); + e->Graphics->DrawRectangle( Pens::Red, myRect ); + } + // + + // Snippet for: M:System.Drawing.RectangleF.Intersect(System.Drawing.RectangleF,System.Drawing.RectangleF) + // +public: + void RectangleFIntersectExample( PaintEventArgs^ e ) + { + // Create two rectangles. + RectangleF firstRectangleF = RectangleF(0,0,75,50); + RectangleF secondRectangleF = RectangleF(50,20,50,50); + + // Convert the RectangleF structures to Rectangle structures and draw them to the + // screen. + Rectangle firstRect = Rectangle::Truncate( firstRectangleF ); + Rectangle secondRect = Rectangle::Truncate( secondRectangleF ); + e->Graphics->DrawRectangle( Pens::Black, firstRect ); + e->Graphics->DrawRectangle( Pens::Red, secondRect ); + + // Get the intersection. + RectangleF intersectRectangleF = RectangleF::Intersect( firstRectangleF, secondRectangleF ); + + // Draw the intersectRectangleF to the screen. + Rectangle intersectRect = Rectangle::Truncate( intersectRectangleF ); + e->Graphics->DrawRectangle( Pens::Blue, intersectRect ); + } + // + + // Snippet for: M:System.Drawing.RectangleF.Union(System.Drawing.RectangleF,System.Drawing.RectangleF) + // +public: + void RectangleFUnionExample( PaintEventArgs^ e ) + { + // Create two rectangles and draw them to the screen. + RectangleF firstRectangleF = RectangleF(0,0,75,50); + RectangleF secondRectangleF = RectangleF(100,100,20,20); + + // Convert the RectangleF structures to Rectangle structures and draw them to the + // screen. + Rectangle firstRect = Rectangle::Truncate( firstRectangleF ); + Rectangle secondRect = Rectangle::Truncate( secondRectangleF ); + e->Graphics->DrawRectangle( Pens::Black, firstRect ); + e->Graphics->DrawRectangle( Pens::Red, secondRect ); + + // Get the union rectangle. + RectangleF unionRectangleF = RectangleF::Union( firstRectangleF, secondRectangleF ); + + // Draw the unionRectangleF to the screen. + Rectangle unionRect = Rectangle::Truncate( unionRectangleF ); + e->Graphics->DrawRectangle( Pens::Blue, unionRect ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp new file mode 100644 index 00000000000..d356d1122f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicRegionExamples/CPP/form1.cpp @@ -0,0 +1,401 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Drawing::Drawing2D; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + + // Snippet for: M:System.Drawing.Region.Complement(System.Drawing.Drawing2D.GraphicsPath) + // +public: + void Complement_Path_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // Create the second rectangle and draw it to the screen in red. + Rectangle complementRect = Rectangle(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, complementRect ); + + // Create a graphics path and add the second rectangle to it. + GraphicsPath^ complementPath = gcnew GraphicsPath; + complementPath->AddRectangle( complementRect ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the complement of myRegion when combined with + // complementPath. + myRegion->Complement( complementPath ); + + // Fill the complement area with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.Complement(System.Drawing.RectangleF) + // +public: + void Complement_RectF_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // Create the second rectangle and draw it to the screen in red. + RectangleF complementRect = RectangleF(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the complement of the region combined with the second + // rectangle. + myRegion->Complement( complementRect ); + + // Fill the complement area with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.Complement(System.Drawing.Region) + // +public: + void Complement_Region_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // Create the second rectangle and draw it to the screen in red. + Rectangle complementRect = Rectangle(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, complementRect ); + + // Create a region from the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Create a complement region. + System::Drawing::Region^ complementRegion = gcnew System::Drawing::Region( complementRect ); + + // Get the complement of myRegion when combined with + // complementRegion. + myRegion->Complement( complementRegion ); + + // Fill the complement area with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.Exclude(System.Drawing.RectangleF) + // +public: + void Exclude_RectF_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // Create the second rectangle and draw it to the screen in red. + RectangleF complementRect = RectangleF(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the nonexcluded area of myRegion when combined with + // complementRect. + myRegion->Exclude( complementRect ); + + // Fill the nonexcluded area of myRegion with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.GetBounds(System.Drawing.Graphics) + // +public: + void GetBoundsExample( PaintEventArgs^ e ) + { + // Create a GraphicsPath and add an ellipse to it. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle ellipseRect = Rectangle(20,20,100,100); + myPath->AddEllipse( ellipseRect ); + + // Fill the path with blue and draw it to the screen. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillPath( myBrush, myPath ); + + // Create a region using the GraphicsPath. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( myPath ); + + // Get the bounding rectangle for myRegion and draw it to the + // screen in Red. + RectangleF boundsRect = myRegion->GetBounds( e->Graphics ); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( boundsRect ) ); + } + // + + // Snippet for: M:System.Drawing.Region.GetRegionData + // +public: + void GetRegionDataExample( PaintEventArgs^ e ) + { + // Create a rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the RegionData for this region. + RegionData^ myRegionData = myRegion->GetRegionData(); + int myRegionDataLength = myRegionData->Data->Length; + DisplayRegionData( e, myRegionDataLength, myRegionData ); + } + + // THIS IS A HELPER FUNCTION FOR GetRegionData. + void DisplayRegionData( PaintEventArgs^ e, int len, RegionData^ dat ) + { + // Display the result. + int i; + float x = 20,y = 140; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + e->Graphics->DrawString( "myRegionData = ", myFont, myBrush, PointF(x,y) ); + y = 160; + for ( i = 0; i < len; i++ ) + { + if ( x > 300 ) + { + y += 20; + x = 20; + } + e->Graphics->DrawString( dat->Data[ i ].ToString(), myFont, myBrush, PointF(x,y) ); + x += 30; + } + } + // + + // Snippet for: M:System.Drawing.Region.Intersect(System.Drawing.RectangleF) + // +public: + void Intersect_RectF_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // create the second rectangle and draw it to the screen in red. + RectangleF complementRect = RectangleF(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( complementRect ) ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the area of intersection for myRegion when combined with + // complementRect. + myRegion->Intersect( complementRect ); + + // Fill the intersection area of myRegion with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.IsVisible(System.Drawing.RectangleF) + // +public: + void IsVisible_RectF_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in blue. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Blue, regionRect ); + + // Create the second rectangle and draw it to the screen in red. + RectangleF myRect = RectangleF(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( myRect ) ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Determine if myRect is contained in the region. + bool contained = myRegion->IsVisible( myRect ); + + // Display the result. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + e->Graphics->DrawString( String::Format( "contained = {0}", contained ), myFont, myBrush, PointF(20,140) ); + } + // + + // Snippet for: M:System.Drawing.Region.Transform(System.Drawing.Drawing2D.Matrix) + // +public: + void TransformExample( PaintEventArgs^ e ) + { + + // Create the first rectangle and draw it to the screen in blue. + Rectangle regionRect = Rectangle(100,50,100,100); + e->Graphics->DrawRectangle( Pens::Blue, regionRect ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Create a transform matrix and set it to have a 45 degree + // rotation. + Matrix^ transformMatrix = gcnew Matrix; + transformMatrix->RotateAt( 45, Point(100,50) ); + + // Apply the transform to the region. + myRegion->Transform(transformMatrix); + + // Fill the transformed region with red and draw it to the screen + // in red. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Red ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.Translate(System.Int32,System.Int32) + // + void TranslateExample( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in blue. + Rectangle regionRect = Rectangle(100,50,100,100); + e->Graphics->DrawRectangle( Pens::Blue, regionRect ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Apply the translation to the region. + myRegion->Translate( 150, 100 ); + + // Fill the transformed region with red and draw it to the screen in red. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Red ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.Union(System.Drawing.RectangleF) + // + void Union_RectF_Example( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // create the second rectangle and draw it to the screen in red. + RectangleF unionRect = RectangleF(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( unionRect ) ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the area of union for myRegion when combined with + // complementRect. + myRegion->Union( unionRect ); + + // Fill the union area of myRegion with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // + + // Snippet for: M:System.Drawing.Region.Xor(System.Drawing.RectangleF) + // + void XorExample( PaintEventArgs^ e ) + { + // Create the first rectangle and draw it to the screen in black. + Rectangle regionRect = Rectangle(20,20,100,100); + e->Graphics->DrawRectangle( Pens::Black, regionRect ); + + // create the second rectangle and draw it to the screen in red. + RectangleF xorRect = RectangleF(90,30,100,100); + e->Graphics->DrawRectangle( Pens::Red, Rectangle::Round( xorRect ) ); + + // Create a region using the first rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( regionRect ); + + // Get the area of overlap for myRegion when combined with + // complementRect. + myRegion->Xor( xorRect ); + + // Fill the Xor area of myRegion with blue. + SolidBrush^ myBrush = gcnew SolidBrush( Color::Blue ); + e->Graphics->FillRegion( myBrush, myRegion ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp new file mode 100644 index 00000000000..c60e2ace631 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicStringFormatExamples/CPP/form1.cpp @@ -0,0 +1,273 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.StringFormat.GetTabStops(System.Single@) + // +public: + void GetSetTabStopsExample1( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Tools used for drawing, painting. + Pen^ redPen = gcnew Pen( Color::FromArgb( 255, 255, 0, 0 ) ); + SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); + + // Layout and format for text. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New Roman",12 ); + StringFormat^ myStringFormat = gcnew StringFormat; + Rectangle enclosingRectangle = Rectangle(20,20,500,100); + array^tabStops = {150.0f,100.0f,100.0f}; + + // Text with tabbed columns. + String^ myString = "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo\tThree"; + + // Set the tab stops, paint the text specified by myString, and draw the + // rectangle that encloses the text. + myStringFormat->SetTabStops( 0.0f, tabStops ); + g->DrawString( myString, myFont, blueBrush, enclosingRectangle, myStringFormat ); + g->DrawRectangle( redPen, enclosingRectangle ); + + // Get the tab stops. + float firstTabOffset; + array^tabStopsObtained = myStringFormat->GetTabStops( firstTabOffset ); + for ( int j = 0; j < tabStopsObtained->Length; j++ ) + { + // Inspect or use the value in tabStopsObtained[j]. + Console::WriteLine( "\n Tab stop {0} = {1}", j, tabStopsObtained[ j ] ); + } + } + // + + // Snippet for: M:System.Drawing.StringFormat.SetDigitSubstitution(System.Int32,System.Drawing.StringDigitSubstitute) + // +public: + void SetDigitSubExample( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Courier New",12 ); + StringFormat^ myStringFormat = gcnew StringFormat; + String^ myString = "0 1 2 3 4 5 6 7 8 9"; + + // Arabic (0x0C01) digits. + // Use National substitution method. + myStringFormat->SetDigitSubstitution( 0x0C01, StringDigitSubstitute::National ); + g->DrawString( String::Format( "Arabic:\nMethod of substitution = National: {0}", myString ), myFont, blueBrush, PointF(10.0f,20.0f), myStringFormat ); + + // Use Traditional substitution method. + myStringFormat->SetDigitSubstitution( 0x0C01, StringDigitSubstitute::Traditional ); + g->DrawString( String::Format( "Method of substitution = Traditional: {0}", myString ), myFont, blueBrush, PointF(10.0f,55.0f), myStringFormat ); + + // Thai (0x041E) digits. + // Use National substitution method. + myStringFormat->SetDigitSubstitution( 0x041E, StringDigitSubstitute::National ); + g->DrawString( String::Format( "Thai:\nMethod of substitution = National: {0}", myString ), myFont, blueBrush, PointF(10.0f,85.0f), myStringFormat ); + + // Use Traditional substitution method. + myStringFormat->SetDigitSubstitution( 0x041E, StringDigitSubstitute::Traditional ); + g->DrawString( String::Format( "Method of substitution = Traditional: {0}", myString ), myFont, blueBrush, PointF(10.0f,120.0f), myStringFormat ); + } + // + + // Snippet for: M:System.Drawing.StringFormat.SetMeasurableCharacterRanges(System.Drawing.CharacterRange[]) + // + void SetMeasCharRangesExample( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + SolidBrush^ redBrush = gcnew SolidBrush( Color::FromArgb( 50, 255, 0, 0 ) ); + + // Layout rectangles, font, and string format used for displaying string. + Rectangle layoutRectA = Rectangle(20,20,165,80); + Rectangle layoutRectB = Rectangle(20,110,165,80); + Rectangle layoutRectC = Rectangle(20,200,240,80); + System::Drawing::Font^ tnrFont = gcnew System::Drawing::Font( "Times New Roman",16 ); + StringFormat^ strFormat = gcnew StringFormat; + + // Ranges of character positions within a string. + array^ charRanges = {CharacterRange(3,5),CharacterRange(15,2),CharacterRange(30,15)}; + + // Each region specifies the area occupied by the characters within a + // range of positions. the values are obtained by using a method that + // measures the character ranges. + array^charRegions = gcnew array(charRanges->Length); + + // String to be displayed. + String^ str = "The quick, brown fox easily jumps over the lazy dog."; + + // Set the char ranges for the string format. + strFormat->SetMeasurableCharacterRanges( charRanges ); + + // loop counter (unsigned 8-bit integer) + Byte i; + + // Measure the char ranges for a given string and layout rectangle. Each + // area occupied by the characters in a range is stored as a region. Then + // draw the string and layout rectangle, and paint the regions. + charRegions = g->MeasureCharacterRanges( str, tnrFont, layoutRectA, strFormat ); + g->DrawString( str, tnrFont, Brushes::Blue, layoutRectA, strFormat ); + g->DrawRectangle( Pens::Black, layoutRectA ); + + // Paint the regions. + for ( i = 0; i < charRegions->Length; i++ ) + g->FillRegion( redBrush, charRegions[ i ] ); + + // Repeat the above steps, but include trailing spaces in the char + // range measurement by setting the appropriate string format flag. + strFormat->FormatFlags = StringFormatFlags::MeasureTrailingSpaces; + charRegions = g->MeasureCharacterRanges( str, tnrFont, layoutRectB, strFormat ); + g->DrawString( str, tnrFont, Brushes::Blue, layoutRectB, strFormat ); + g->DrawRectangle( Pens::Black, layoutRectB ); + for ( i = 0; i < charRegions->Length; i++ ) + g->FillRegion( redBrush, charRegions[ i ] ); + + // Clear all the format flags. + strFormat->FormatFlags = StringFormatFlags(0); + + // Repeat the steps, but use a different layout rectangle. the dimensions + // of the layout rectangle and the size of the font both affect the + // character range measurement. + charRegions = g->MeasureCharacterRanges( str, tnrFont, layoutRectC, strFormat ); + g->DrawString( str, tnrFont, Brushes::Blue, layoutRectC, strFormat ); + g->DrawRectangle( Pens::Black, layoutRectC ); + + // Paint the regions. + for ( i = 0; i < charRegions->Length; i++ ) + g->FillRegion( redBrush, charRegions[ i ] ); + } + // + + // Snippet for: M:System.Drawing.StringFormat.SetTabStops(System.Single,System.Single[]) + // + void GetSetTabStopsExample2( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + + // Tools used for drawing, painting. + Pen^ redPen = gcnew Pen( Color::FromArgb( 255, 255, 0, 0 ) ); + SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); + + // Layout and format for text. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New Roman",12 ); + StringFormat^ myStringFormat = gcnew StringFormat; + Rectangle enclosingRectangle = Rectangle(20,20,500,100); + array^tabStops = {150.0f,100.0f,100.0f}; + + // Text with tabbed columns. + String^ myString = "Name\tTab 1\tTab 2\tTab 3\nGeorge Brown\tOne\tTwo\tThree"; + + // Set the tab stops, paint the text specified by myString, draw the + // rectangle that encloses the text. + myStringFormat->SetTabStops( 0.0f, tabStops ); + g->DrawString( myString, myFont, blueBrush, enclosingRectangle, myStringFormat ); + g->DrawRectangle( redPen, enclosingRectangle ); + + // Get the tab stops. + float firstTabOffset; + array^tabStopsObtained = myStringFormat->GetTabStops( firstTabOffset ); + for ( int j = 0; j < tabStopsObtained->Length; j++ ) + { + // Inspect or use the value in tabStopsObtained[j]. + Console::WriteLine( "\n Tab stop {0} = {1}", j, tabStopsObtained[ j ] ); + } + } + // + + // Snippet for: M:System.Drawing.StringFormat.ToString + // + void ToStringExample( PaintEventArgs^ e ) + { + Graphics^ g = e->Graphics; + SolidBrush^ blueBrush = gcnew SolidBrush( Color::FromArgb( 255, 0, 0, 255 ) ); + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Times New Roman",14 ); + StringFormat^ myStringFormat = gcnew StringFormat; + + // String variable to hold the values of the StringFormat object. + String^ strFmtString; + + // Convert the string format object to a string (only certain information + // in the object is converted) and display the string. + strFmtString = myStringFormat->ToString(); + g->DrawString( String::Format( "Before changing properties: {0}", myStringFormat ), myFont, blueBrush, 20, 40 ); + + // Change some properties of the string format + myStringFormat->Trimming = StringTrimming::None; + myStringFormat->FormatFlags = (StringFormatFlags)(StringFormatFlags::NoWrap | StringFormatFlags::NoClip); + + // Convert the string format object to a string and display the string. + // The string will be different because the properties of the string + // format have changed. + strFmtString = myStringFormat->ToString(); + g->DrawString( String::Format( "After changing properties: {0}", myStringFormat ), myFont, blueBrush, 20, 70 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp new file mode 100644 index 00000000000..357b3878973 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassicTextureBrushExamples/CPP/form1.cpp @@ -0,0 +1,240 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.TextureBrush.Clone + // +public: + void Clone_Example( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Create an exact copy of tBrush. + TextureBrush^ cloneBrush = dynamic_cast(tBrush->Clone()); + + // Fill a rectangle with cloneBrush. + e->Graphics->FillRectangle( cloneBrush, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix) + // +public: + void MultiplyTransform_Example1( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Create a transformation matrix. + Matrix^ translateMatrix = gcnew Matrix; + translateMatrix->Translate( 50, 0 ); + + // Multiply the transformation matrix of tBrush by translateMatrix. + tBrush->MultiplyTransform( translateMatrix, MatrixOrder::Prepend ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) + // + void MultiplyTransform_Example2( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Create a transformation matrix. + Matrix^ translateMatrix = gcnew Matrix; + translateMatrix->Translate( 50, 0 ); + + // Multiply the transformation matrix of tBrush by translateMatrix. + tBrush->MultiplyTransform( translateMatrix ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.ResetTransform + // + void ResetTransform_Example( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Rotate the texture image by 90 degrees. + tBrush->RotateTransform( 90 ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + + // Reset transformation matrix to identity. + tBrush->ResetTransform(); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 110, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.RotateTransform(System.Single) + // + void RotateTransform_Example1( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Rotate the texture image by 90 degrees. + tBrush->RotateTransform( 90 ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) + // + void RotateTransform_Example2( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Rotate the texture image by 90 degrees. + tBrush->RotateTransform( 90, MatrixOrder::Prepend ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.ScaleTransform(System.Single,System.Single) + // + void ScaleTransform_Example1( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Scale the texture image 2X in the x-direction. + tBrush->ScaleTransform( 2, 1 ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // + void ScaleTransform_Example2( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Scale the texture image 2X in the x-direction. + tBrush->ScaleTransform( 2, 1, MatrixOrder::Prepend ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.TranslateTransform(System.Single,System.Single) + // + void TranslateTransform_Example1( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Move the texture image 2X in the x-direction. + tBrush->TranslateTransform( 50, 0, MatrixOrder::Prepend ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.TextureBrush.TranslateTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // + void TranslateTransform_Example2( PaintEventArgs^ e ) + { + // Create a TextureBrush object. + TextureBrush^ tBrush = gcnew TextureBrush( gcnew Bitmap( "texture.jpg" ) ); + + // Move the texture image 2X in the x-direction. + tBrush->TranslateTransform( 50, 0 ); + + // Fill a rectangle with tBrush. + e->Graphics->FillRectangle( tBrush, 0, 0, 100, 100 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp new file mode 100644 index 00000000000..4a1a9b3be97 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ClassingImagingEncoder4/CPP/form1.cpp @@ -0,0 +1,74 @@ + + +// Snippet for: F:System.Drawing.Imaging.Encoder.SaveFlag +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); +int main() +{ + Bitmap^ multi; + Bitmap^ page2; + Bitmap^ page3; + ImageCodecInfo^ myImageCodecInfo; + Encoder^ myEncoder; + EncoderParameter^ myEncoderParameter; + EncoderParameters^ myEncoderParameters; + + // Create three Bitmap objects. + multi = gcnew Bitmap( "Shapes.bmp" ); + page2 = gcnew Bitmap( "Iron.jpg" ); + page3 = gcnew Bitmap( "House.png" ); + + // Get an ImageCodecInfo object that represents the TIFF codec. + myImageCodecInfo = GetEncoderInfo( "image/tiff" ); + + // Create an Encoder object based on the GUID + // for the SaveFlag parameter category. + myEncoder = Encoder::SaveFlag; + + // Create an EncoderParameters object. + // An EncoderParameters object has an array of EncoderParameter + // objects. In this case, there is only one + // EncoderParameter object in the array. + myEncoderParameters = gcnew EncoderParameters( 1 ); + + // Save the first page (frame). + myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::MultiFrame ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + multi->Save( "Multiframe.tiff", myImageCodecInfo, myEncoderParameters ); + + // Save the second page (frame). + myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::FrameDimensionPage ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + multi->SaveAdd( page2, myEncoderParameters ); + + // Save the third page (frame). + myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::FrameDimensionPage ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + multi->SaveAdd( page3, myEncoderParameters ); + + // Close the multiple-frame file. + myEncoderParameter = gcnew EncoderParameter( myEncoder,(__int64)EncoderValue::Flush ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + multi->SaveAdd( myEncoderParameters ); +} + +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) +{ + int j; + array^encoders; + encoders = ImageCodecInfo::GetImageEncoders(); + for ( j = 0; j < encoders->Length; ++j ) + { + if ( encoders[ j ]->MimeType == mimeType ) + return encoders[ j ]; + + } + return nullptr; +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp new file mode 100644 index 00000000000..b47481a2b92 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Converters/CPP/form1.cpp @@ -0,0 +1,122 @@ +#using +#using +#using + +using namespace System::Drawing; +using namespace System; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + //Form overrides dispose to clean up the component list. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::Form1_Paint ); + } + + // The following code example demonstrates how to use the + // PointConverter.ConvertFromString and the Point.op_Subtraction + // methods. This example is designed to be used with Windows + // Forms. Paste this code into a form and call the + // ShowPointConverter method when handling the form's Paint + // event, passing e as PaintEventArgs. + // + void ShowPointConverter( PaintEventArgs^ e ) + { + // Create the PointConverter. + System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( Point::typeid ); + Point point1 = *dynamic_cast(converter->ConvertFromString( "200, 200" )); + + // Use the subtraction operator to get a second point. + Point point2 = point1 - System::Drawing::Size( 190, 190 ); + + // Draw a line between the two points. + e->Graphics->DrawLine( Pens::Black, point1, point2 ); + } + // + + // The following code example demonstrates how to use the + // ColorConverter.ConvertToString method. This example + // is designed to be used with Windows Forms. Paste this code + // into a form and call the ShowColorConverter method when + // handling the form's Paint event, passing e as PaintEventArgs. + // + void ShowColorConverter( PaintEventArgs^ e ) + { + Color myColor = Color::PaleVioletRed; + + // Create the ColorConverter. + System::ComponentModel::TypeConverter^ converter = System::ComponentModel::TypeDescriptor::GetConverter( myColor ); + String^ colorAsString = converter->ConvertToString( Color::PaleVioletRed ); + e->Graphics->DrawString( colorAsString, this->Font, Brushes::PaleVioletRed, 50.0F, 50.0F ); + } + // + + // The following code example demonstrates how to use the + // ConvertToInvariantString and ConvertToString methods. + // This example is designed to be used with Windows Forms. + // Paste this code into a form and call the ShowFontStringConversion + // method when handling the form's Paint event, passing e + // as PaintEventArgs. + // + void ShowFontStringConversion( PaintEventArgs^ e ) + { + // Create the FontConverter. + System::ComponentModel::TypeConverter^ converter = + System::ComponentModel::TypeDescriptor::GetConverter( System::Drawing::Font::typeid ); + System::Drawing::Font^ font1 = dynamic_cast(converter->ConvertFromString( "Arial, 12pt" )); + String^ fontName1 = converter->ConvertToInvariantString( font1 ); + String^ fontName2 = converter->ConvertToString( font1 ); + e->Graphics->DrawString( fontName1, font1, Brushes::Red, 10, 10 ); + e->Graphics->DrawString( fontName2, font1, Brushes::Blue, 10, 30 ); + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + ShowFontStringConversion( e ); + ShowPointConverter( e ); + ShowColorConverter( e ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp new file mode 100644 index 00000000000..022de159c08 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathExamples/CPP/form1.cpp @@ -0,0 +1,753 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddArc(System.Drawing.Rectangle,System.Single,System.Single) + // +private: + void AddArcExample( PaintEventArgs^ e ) + { + // Create a GraphicsPath object. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // Set up and call AddArc, and close the figure. + Rectangle rect = Rectangle(20,20,50,100); + myPath->StartFigure(); + myPath->AddArc( rect, 0, 180 ); + myPath->CloseFigure(); + + // Draw the path to screen. + e->Graphics->DrawPath( gcnew Pen( Color::Red,3.0f ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddBezier(System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32,System.Int32) + // +private: + void AddBezierExample( PaintEventArgs^ e ) + { + // Create a new Path. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // Call AddBezier. + myPath->StartFigure(); + myPath->AddBezier( 50, 50, 70, 0, 100, 120, 150, 50 ); + + // Close the curve. + myPath->CloseFigure(); + + // Draw the path to screen. + e->Graphics->DrawPath( gcnew Pen( Color::Red,2.0f ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddBeziers(System.Drawing.Point[]) + // +private: + void AddBeziersExample( PaintEventArgs^ e ) + { + // Adds two Bezier curves. + array^ myArray = {Point(20,100),Point(40,75),Point(60,125),Point(80,100),Point(100,50),Point(120,150),Point(140,100)}; + + // Create the path and add the curves. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddBeziers( myArray ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddClosedCurve(System.Drawing.Point[],System.Single) + // +private: + void AddClosedCurveExample( PaintEventArgs^ e ) + { + // Creates a symetrical, closed curve. + array^ myArray = {Point(20,100),Point(40,150),Point(60,125),Point(40,100),Point(60,75),Point(40,50)}; + + // Create a new path and add curve. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddClosedCurve( myArray, .5f ); + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + + // Draw the path to screen. + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddCurve(System.Drawing.Point[],System.Int32,System.Int32,System.Single) + // +private: + void AddCurveExample( PaintEventArgs^ e ) + { + // Create some points. + Point point1 = Point(20,20); + Point point2 = Point(40,0); + Point point3 = Point(60,40); + Point point4 = Point(80,20); + + // Create an array of the points. + array^ curvePoints = {point1,point2,point3,point4}; + + // Create a GraphicsPath object and add a curve. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddCurve( curvePoints, 0, 3, 0.8f ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddEllipse(System.Drawing.Rectangle) + // +private: + void AddEllipseExample( PaintEventArgs^ e ) + { + // Create a path and add an ellipse. + Rectangle myEllipse = Rectangle(20,20,100,50); + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddEllipse( myEllipse ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddLine(System.Int32,System.Int32,System.Int32,System.Int32) + // +private: + void AddLineExample( PaintEventArgs^ e ) + { + //Create a path and add a symetrical triangle using AddLine. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLine( 30, 30, 60, 60 ); + myPath->AddLine( 60, 60, 0, 60 ); + myPath->AddLine( 0, 60, 30, 30 ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddLines(System.Drawing.Point[]) + // +private: + void AddLinesExample( PaintEventArgs^ e ) + { + // Create a symetrical triangle using an array of points. + array^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)}; + + //Create a path and add lines. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLines( myArray ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddPath(System.Drawing.Drawing2D.GraphicsPath,System.Boolean) + // +private: + void AddPathExample( PaintEventArgs^ e ) + { + // Create the first pathright side up triangle. + array^ myArray = {Point(30,30),Point(60,60),Point(0,60),Point(30,30)}; + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLines( myArray ); + + // Create the second pathinverted triangle. + array^ myArray2 = {Point(30,30),Point(0,0),Point(60,0),Point(30,30)}; + GraphicsPath^ myPath2 = gcnew GraphicsPath; + myPath2->AddLines( myArray2 ); + + // Add the second path to the first path. + myPath->AddPath( myPath2, true ); + + // Draw the combined path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddPie(System.Int32,System.Int32,System.Int32,System.Int32,System.Single,System.Single) + // +private: + void AddPieExample( PaintEventArgs^ e ) + { + // Create a pie slice of a circle using the AddPie method. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddPie( 20, 20, 70, 70, -45, 90 ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddPolygon(System.Drawing.Point[]) + // +private: + void AddPolygonExample( PaintEventArgs^ e ) + { + // Create an array of points. + array^ myArray = {Point(23,20),Point(40,10),Point(57,20),Point(50,40),Point(30,40)}; + + // Create a GraphicsPath object and add a polygon. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddPolygon( myArray ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddRectangle(System.Drawing.Rectangle) + // +private: + void AddRectangleExample( PaintEventArgs^ e ) + { + // Create a GraphicsPath object and add a rectangle to it. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle pathRect = Rectangle(20,20,100,200); + myPath->AddRectangle( pathRect ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddRectangles(System.Drawing.Rectangle[]) + // +private: + void AddRectanglesExample( PaintEventArgs^ e ) + { + // Adds a pattern of rectangles to a GraphicsPath object. + GraphicsPath^ myPath = gcnew GraphicsPath; + array^ pathRects = {Rectangle(20,20,100,200),Rectangle(40,40,120,220),Rectangle(60,60,240,140)}; + myPath->AddRectangles( pathRects ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.AddString(System.String,System.Drawing.FontFamily,System.Int32,System.Single,System.Drawing.Point,System.Drawing.StringFormat) + // +private: + void AddStringExample( PaintEventArgs^ e ) + { + // Create a GraphicsPath object. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // Set up all the string parameters. + String^ stringText = "Sample Text"; + FontFamily^ family = gcnew FontFamily( "Arial" ); + int fontStyle = (int)FontStyle::Italic; + int emSize = 26; + Point origin = Point(20,20); + StringFormat^ format = StringFormat::GenericDefault; + + // Add the string to the path. + myPath->AddString( stringText, family, fontStyle, (float)emSize, origin, format ); + + //Draw the path to the screen. + e->Graphics->FillPath( Brushes::Black, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.ClearMarkers + // +private: + void ClearMarkersExample( PaintEventArgs^ e ) + { + // Set several markers in a path. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddEllipse( 0, 0, 100, 200 ); + myPath->SetMarkers(); + myPath->AddLine( Point(100,100), Point(200,100) ); + Rectangle rect = Rectangle(200,0,100,200); + myPath->AddRectangle( rect ); + myPath->SetMarkers(); + myPath->AddLine( Point(250,200), Point(250,300) ); + myPath->SetMarkers(); + + // Clear the markers. + myPath->ClearMarkers(); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Clone + // +private: + void CloneExample( PaintEventArgs^ e ) + { + // Set several markers in a path. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddEllipse( 0, 0, 100, 200 ); + myPath->AddLine( Point(100,100), Point(200,100) ); + Rectangle rect = Rectangle(200,0,100,200); + myPath->AddRectangle( rect ); + myPath->AddLine( Point(250,200), Point(250,300) ); + + // Draw the path to the screen. + Pen^ myPen = gcnew Pen( Color::Black,2.0f ); + e->Graphics->DrawPath( myPen, myPath ); + + // Clone a copy of myPath. + GraphicsPath^ myPath2 = dynamic_cast(myPath->Clone()); + + // Draw the path to the screen. + Pen^ myPen2 = gcnew Pen( Color::Red,4.0f ); + e->Graphics->DrawPath( myPen2, myPath2 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.CloseAllFigures + // +private: + void CloseAllFiguresExample( PaintEventArgs^ e ) + { + // Create a path containing several open-ended figures. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->StartFigure(); + myPath->AddLine( Point(10,10), Point(150,10) ); + myPath->AddLine( Point(150,10), Point(10,150) ); + myPath->StartFigure(); + myPath->AddArc( 200, 200, 100, 100, 0, 90 ); + myPath->StartFigure(); + Point point1 = Point(300,300); + Point point2 = Point(400,325); + Point point3 = Point(400,375); + Point point4 = Point(300,400); + array^ points = {point1,point2,point3,point4}; + myPath->AddCurve( points ); + + // Close all the figures. + myPath->CloseAllFigures(); + + // Draw the path to the screen. + e->Graphics->DrawPath( gcnew Pen( Color::Black,3.0f ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.CloseFigure + // +private: + void CloseFigureExample( PaintEventArgs^ e ) + { + // Create a path consisting of two, open-ended lines and close + // the lines using CloseFigure. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->StartFigure(); + myPath->AddLine( Point(10,10), Point(200,10) ); + myPath->AddLine( Point(200,10), Point(200,200) ); + myPath->CloseFigure(); + + // Draw the path to the screen. + e->Graphics->DrawPath( Pens::Black, myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Flatten(System.Drawing.Drawing2D.Matrix,System.Single) + // +private: + void FlattenExample( PaintEventArgs^ e ) + { + GraphicsPath^ myPath = gcnew GraphicsPath; + Matrix^ translateMatrix = gcnew Matrix; + translateMatrix->Translate( 0, 10 ); + Point point1 = Point(20,100); + Point point2 = Point(70,10); + Point point3 = Point(130,200); + Point point4 = Point(180,100); + array^ points = {point1,point2,point3,point4}; + myPath->AddCurve( points ); + e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath ); + myPath->Flatten( translateMatrix, 10.0f ); + e->Graphics->DrawPath( gcnew Pen( Color::Red,1.0f ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.GetBounds + // +public: + void GetBoundsExample( PaintEventArgs^ e ) + { + // Create path number 1 and a Pen for drawing. + GraphicsPath^ myPath = gcnew GraphicsPath; + Pen^ pathPen = gcnew Pen( Color::Black,1.0f ); + + // Add an Ellipse to the path and Draw it (circle in start + // position). + myPath->AddEllipse( 20, 20, 100, 100 ); + e->Graphics->DrawPath( pathPen, myPath ); + + // Get the path bounds for Path number 1 and draw them. + RectangleF boundRect = myPath->GetBounds(); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), boundRect.X, boundRect.Y, boundRect.Height, boundRect.Width ); + + // Create a second graphics path and a wider Pen. + GraphicsPath^ myPath2 = gcnew GraphicsPath; + Pen^ pathPen2 = gcnew Pen( Color::Black,10.0f ); + + // Create a new ellipse with a width of 10. + myPath2->AddEllipse( 150, 20, 100, 100 ); + myPath2->Widen( pathPen2 ); + e->Graphics->FillPath( Brushes::Black, myPath2 ); + + // Get the second path bounds. + RectangleF boundRect2 = myPath2->GetBounds(); + + // Draw the bounding rectangle. + e->Graphics->DrawRectangle( gcnew Pen( Color::Red,1.0f ), boundRect2.X, boundRect2.Y, boundRect2.Height, boundRect2.Width ); + + // Display the rectangle size. + MessageBox::Show( boundRect2.ToString() ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.GetLastPoint + // +private: + void GetLastPointExample( PaintEventArgs^ /*e*/ ) + { + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLine( 20, 20, 100, 20 ); + PointF lastPoint = myPath->GetLastPoint(); + if ( !lastPoint.IsEmpty ) + { + String^ lastPointXString = lastPoint.X.ToString(); + String^ lastPointYString = lastPoint.Y.ToString(); + MessageBox::Show( String::Concat( lastPointXString, ", ", lastPointYString ) ); + } + else + MessageBox::Show( "lastPoint is empty" ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.IsOutlineVisible(System.Int32,System.Int32,System.Drawing.Pen,System.Drawing.Graphics) + // +public: + void IsOutlineVisibleExample( PaintEventArgs^ e ) + { + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle rect = Rectangle(20,20,100,100); + myPath->AddRectangle( rect ); + Pen^ testPen = gcnew Pen( Color::Black,20.0f ); + myPath->Widen( testPen ); + e->Graphics->FillPath( Brushes::Black, myPath ); + bool visible = myPath->IsOutlineVisible( 100, 50, testPen, e->Graphics ); + MessageBox::Show( String::Format( "visible = {0}", visible ) ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.IsVisible(System.Int32,System.Int32,System.Drawing.Graphics) + // +private: + void IsVisibleExample( PaintEventArgs^ e ) + { + + // Create a path and add an ellipse. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddEllipse( 0, 0, 100, 100 ); + + // Test the visibility of point (50, 50). + bool visible = myPath->IsVisible( 50, 50, e->Graphics ); + + // Show the result. + MessageBox::Show( visible.ToString() ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Reset + // +public: + void GraphicsPathResetExample( PaintEventArgs^ e ) + { + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + + // Create a path and add a line, an ellipse, and an arc. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLine( Point(0,0), Point(100,100) ); + myPath->AddEllipse( 100, 100, 200, 250 ); + myPath->AddArc( 300, 250, 100, 100, 0, 90 ); + + // Draw the pre-reset points array to the screen. + DrawPoints1( e, myPath->PathPoints, 20 ); + + // Reset the path. + myPath->Reset(); + + // See if any points remain. + if ( myPath->PointCount > 0 ) + { + + // Draw the post-reset points array to the screen. + DrawPoints1( e, myPath->PathPoints, 150 ); + } + else + e->Graphics->DrawString( "No Points", myFont, Brushes::Black, 150, 20 ); + // If there are no points, say so. + } + + + //End GraphicsPathResetExample + // A helper function GraphicsPathResetExample uses to draw the points. + // to the screen. + void DrawPoints1( PaintEventArgs^ e, array^ pathPoints, int xOffset ) + { + int y = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + for ( int i = 0; i < pathPoints->Length; i++ ) + { + e->Graphics->DrawString( String::Concat( pathPoints[ i ].X, ", ", pathPoints[ i ].Y ), myFont, Brushes::Black, (float)xOffset, (float)y ); + y += 20; + + } + } + // End DrawPoints + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Reverse + // + void GraphicsPathReverseExample( PaintEventArgs^ e ) + { + // Create a path and add a line, ellipse, and arc. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLine( Point(0,0), Point(100,100) ); + myPath->AddEllipse( 100, 100, 200, 250 ); + myPath->AddArc( 300, 250, 100, 100, 0, 90 ); + + // Draw the first set of points to the screen. + DrawPoints2( e, myPath->PathPoints, 20 ); + + // Call GraphicsPath.Reverse. + myPath->Reverse(); + + // Draw the reversed set of points to the screen. + DrawPoints2( e, myPath->PathPoints, 150 ); + } + + //End GraphicsPathReverseExample. + // A helper function GraphicsPathReverseExample is used to draw the + // points to the screen. + void DrawPoints2( PaintEventArgs^ e, array^ pathPoints, int xOffset ) + { + int y = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + for ( int i = 0; i < pathPoints->Length; i++ ) + { + e->Graphics->DrawString( String::Concat( pathPoints[ i ].X, ", ", pathPoints[ i ].Y ), myFont, Brushes::Black, (float)xOffset, (float)y ); + y += 20; + + } + } + // End DrawPoints + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.SetMarkers + // +private: + void SetMarkersExample( PaintEventArgs^ e ) + { + // Create a path and set two markers. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddLine( Point(0,0), Point(50,50) ); + myPath->SetMarkers(); + Rectangle rect = Rectangle(50,50,50,50); + myPath->AddRectangle( rect ); + myPath->SetMarkers(); + myPath->AddEllipse( 100, 100, 100, 50 ); + + // Draw the path to screen. + e->Graphics->DrawPath( gcnew Pen( Color::Black,2.0f ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.StartFigure + // +public: + void StartFigureExample( PaintEventArgs^ e ) + { + // Create a GraphicsPath object. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // First set of figures. + myPath->StartFigure(); + myPath->AddArc( 10, 10, 50, 50, 0, 270 ); + myPath->AddLine( Point(50,0), Point(100,50) ); + myPath->AddArc( 50, 100, 75, 75, 0, 270 ); + myPath->CloseFigure(); + myPath->StartFigure(); + myPath->AddArc( 100, 10, 50, 50, 0, 270 ); + + // Second set of figures. + myPath->StartFigure(); + myPath->AddArc( 10, 200, 50, 50, 0, 270 ); + myPath->CloseFigure(); + myPath->StartFigure(); + myPath->AddLine( Point(60,200), Point(110,250) ); + myPath->AddArc( 50, 300, 75, 75, 0, 270 ); + myPath->CloseFigure(); + myPath->StartFigure(); + myPath->AddArc( 100, 200, 50, 50, 0, 270 ); + + // Draw the path to the screen. + e->Graphics->DrawPath( gcnew Pen( Color::Black ), myPath ); + } + // End StartFigureExample + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Transform(System.Drawing.Drawing2D.Matrix) + // +private: + void TransformExample( PaintEventArgs^ e ) + { + // Create a path and add and ellipse. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddEllipse( 0, 0, 100, 200 ); + + // Draw the starting position to screen. + e->Graphics->DrawPath( Pens::Black, myPath ); + + // Move the ellipse 100 points to the right. + Matrix^ translateMatrix = gcnew Matrix; + translateMatrix->Translate( 100, 0 ); + myPath->Transform(translateMatrix); + + // Draw the transformed ellipse to the screen. + e->Graphics->DrawPath( gcnew Pen( Color::Red,2.0f ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Warp(System.Drawing.PointF[],System.Drawing.RectangleF,System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.WarpMode,System.Single) + // +private: + void WarpExample( PaintEventArgs^ e ) + { + // Create a path and add a rectangle. + GraphicsPath^ myPath = gcnew GraphicsPath; + RectangleF srcRect = RectangleF(0,0,100,200); + myPath->AddRectangle( srcRect ); + + // Draw the source path (rectangle)to the screen. + e->Graphics->DrawPath( Pens::Black, myPath ); + + // Create a destination for the warped rectangle. + PointF point1 = PointF(200,200); + PointF point2 = PointF(400,250); + PointF point3 = PointF(220,400); + array^ destPoints = {point1,point2,point3}; + + // Create a translation matrix. + Matrix^ translateMatrix = gcnew Matrix; + translateMatrix->Translate( 100, 0 ); + + // Warp the source path (rectangle). + myPath->Warp( destPoints, srcRect, translateMatrix, WarpMode::Perspective, 0.5f ); + + // Draw the warped path (rectangle) to the screen. + e->Graphics->DrawPath( gcnew Pen( Color::Red ), myPath ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPath.Widen(System.Drawing.Pen,System.Drawing.Drawing2D.Matrix,System.Single) + // +private: + void WidenExample( PaintEventArgs^ e ) + { + // Create a path and add two ellipses. + GraphicsPath^ myPath = gcnew GraphicsPath; + myPath->AddEllipse( 0, 0, 100, 100 ); + myPath->AddEllipse( 100, 0, 100, 100 ); + + // Draw the original ellipses to the screen in black. + e->Graphics->DrawPath( Pens::Black, myPath ); + + // Widen the path. + Pen^ widenPen = gcnew Pen( Color::Black,10.0f ); + Matrix^ widenMatrix = gcnew Matrix; + widenMatrix->Translate( 50, 50 ); + myPath->Widen( widenPen, widenMatrix, 1.0f ); + + // Draw the widened path to the screen in red. + e->Graphics->FillPath( gcnew SolidBrush( Color::Red ), myPath ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp new file mode 100644 index 00000000000..204f7182726 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicGraphicsPathIterator/CPP/form1.cpp @@ -0,0 +1,569 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + /// + /// The main entry point for the application. + /// + /// + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.CopyData(System.Drawing.PointF[]@,System.Byte[]@,System.Int32,System.Int32) + // +public: + void CopyDataExample( PaintEventArgs^ e ) + { + // Create a graphics path. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // Set up a points array. + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + + // Create a rectangle. + Rectangle myRect = Rectangle(120,120,100,100); + + // Add the points, rectangle, and an ellipse to the path. + myPath->AddLines( myPoints ); + myPath->SetMarkers(); + myPath->AddRectangle( myRect ); + myPath->SetMarkers(); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Get the total number of points for the path, and arrays of + // the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for listing the array of points on the left + // side of the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // List the set of points and types and types to the left side + // of the screen. + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); + j += 20; + } + + // Create a GraphicsPathIterator for myPath and rewind it. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + myPathIterator->Rewind(); + + // Set up the arrays to receive the copied data. + array^points = gcnew array(myPathIterator->Count); + array^types = gcnew array(myPathIterator->Count); + int myStartIndex; + int myEndIndex; + + // Increment the starting index to the second marker in the + // path. + myPathIterator->NextMarker( myStartIndex, myEndIndex ); + myPathIterator->NextMarker( myStartIndex, myEndIndex ); + + // Copy all the points and types from the starting index to the + // ending index to the points array and the types array + // respectively. + int numPointsCopied = myPathIterator->CopyData( points, types, myStartIndex, myEndIndex ); + + // List the copied points to the right side of the screen. + j = 20; + int copiedStartIndex = 0; + for ( i = 0; i < numPointsCopied; i++ ) + { + copiedStartIndex = myStartIndex + i; + e->Graphics->DrawString( String::Format( "Point: {0}, Value: {1}, Type: {2}", copiedStartIndex, points[ i ], types[ i ] ), myFont, myBrush, 200, j ); + j += 20; + + } + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.Enumerate(System.Drawing.PointF[]@,System.Byte[]@) + // +public: + void EnumerateExample( PaintEventArgs^ e ) + { + GraphicsPath^ myPath = gcnew GraphicsPath; + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + myPath->AddLines( myPoints ); + myPath->AddRectangle( myRect ); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Get the total number of points for the path, and arrays of + // the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for listing the array of points on the left + // side of the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // List the set of points and types and types to the left side + // of the screen. + e->Graphics->DrawString( "Original Data", myFont, myBrush, 20, j ); + j += 20; + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); + j += 20; + } + + // Create a GraphicsPathIterator for myPath. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + myPathIterator->Rewind(); + array^points = gcnew array(myPathIterator->Count); + array^types = gcnew array(myPathIterator->Count); + + // int numPoints = myPathIterator->Enumerate(&points, &types); + // Draw the set of copied points and types to the screen. + j = 20; + e->Graphics->DrawString( "Copied Data", myFont, myBrush, 200, j ); + j += 20; + for ( i = 0; i < points->Length; i++ ) + { + e->Graphics->DrawString( String::Format( "Point: {0}, Value: {1}, Type: {2}", i, points[ i ], types[ i ] ), myFont, myBrush, 200, j ); + j += 20; + } + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.HasCurve + // +private: + void HasCurveExample( PaintEventArgs^ /*e*/ ) + { + // Create a path and add three lines, + // a rectangle and an ellipse. + GraphicsPath^ myPath = gcnew GraphicsPath; + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + myPath->AddLines( myPoints ); + myPath->AddRectangle( myRect ); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Create a GraphicsPathIterator for myPath. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + + // Test for a curve. + bool myHasCurve = myPathIterator->HasCurve(); + + // Show the test result. + MessageBox::Show( myHasCurve.ToString() ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextMarker(System.Drawing.Drawing2D.GraphicsPath) + // +public: + void NextMarkerExample2( PaintEventArgs^ e ) + { + // Create a graphics path. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // Set up primitives to add to myPath. + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + + // Add 3 lines, a rectangle, an ellipse, and 2 markers. + myPath->AddLines( myPoints ); + myPath->SetMarkers(); + myPath->AddRectangle( myRect ); + myPath->SetMarkers(); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Get the total number of points for the path, + // and the arrays of the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for listing all the values of the path's + // points to the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // List the values for all of path points and types to + // the left side of the screen. + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); + j += 20; + } + + // Create a GraphicsPathIterator. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + + // Rewind the iterator. + myPathIterator->Rewind(); + + // Create a GraphicsPath to receive a section of myPath. + GraphicsPath^ myPathSection = gcnew GraphicsPath; + + // Retrieve and list the number of points contained in + // the first marker to the right side of the screen. + int markerPoints; + markerPoints = myPathIterator->NextMarker( myPathSection ); + e->Graphics->DrawString( String::Format( "Marker: 1 Num Points: {0}", markerPoints ), myFont, myBrush, 200, 20 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextMarker(System.Int32@,System.Int32@) + // +private: + void NextMarkerExample( PaintEventArgs^ e ) + { + // Create the GraphicsPath. + GraphicsPath^ myPath = gcnew GraphicsPath; + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + + // Add 3 lines, a rectangle, an ellipse, and 2 markers. + myPath->AddLines( myPoints ); + myPath->SetMarkers(); + myPath->AddRectangle( myRect ); + myPath->SetMarkers(); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Get the total number of points for the path, + // and the arrays of the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for drawing the array + // of points to the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // Draw the set of path points and types to the screen. + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); + j += 20; + } + + // Create a GraphicsPathIterator. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + int myStartIndex; + int myEndIndex; + + // Rewind the Iterator. + myPathIterator->Rewind(); + + // Draw the Markers and their start and end points + // to the screen. + j = 20; + for ( i = 0; i < 3; i++ ) + { + myPathIterator->NextMarker( myStartIndex, myEndIndex ); + e->Graphics->DrawString( String::Format( "Marker {0}: Start: {1} End: {2}", i, myStartIndex, myEndIndex ), + myFont, myBrush, 200, j ); + j += 20; + } + + // Draw the total number of points to the screen. + j += 20; + int myPathTotalPoints = myPathIterator->Count; + e->Graphics->DrawString( String::Format( "Total Points = {0}", myPathTotalPoints ), myFont, myBrush, 200, j ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextPathType(System.Byte@,System.Int32@,System.Int32@) + // +public: + void NextPathTypeExample( PaintEventArgs^ e ) + { + // Create the GraphicsPath. + GraphicsPath^ myPath = gcnew GraphicsPath; + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + + // Add 3 lines, a rectangle, and an ellipse. + myPath->AddLines( myPoints ); + myPath->AddRectangle( myRect ); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // List all of the path points to the screen. + ListPathPoints( e, myPath, nullptr, 20, 1 ); + + // Create a GraphicsPathIterator. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + + // Rewind the Iterator. + myPathIterator->Rewind(); + + // Iterate the subpaths and types, and list the results to + // the screen. + int i; + int j = 20; + int mySubPaths; + int subPathStartIndex; + int subPathEndIndex; + Boolean IsClosed; + Byte subPathPointType; + int pointTypeStartIndex; + int pointTypeEndIndex; + int numPointsFound; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + j = 20; + for ( i = 0; i < 3; i++ ) + { + mySubPaths = myPathIterator->NextSubpath( subPathStartIndex, subPathEndIndex, IsClosed ); + numPointsFound = myPathIterator->NextPathType( subPathPointType, pointTypeStartIndex, pointTypeEndIndex ); + e->Graphics->DrawString( String::Format( "SubPath: {0} Points Found: {1} Type of Points: {2}", i, + numPointsFound, subPathPointType ), myFont, myBrush, 200.0f, (float)j ); + j += 20; + } + + // List the total number of path points to the screen. + ListPathPoints( e, myPath, myPathIterator, 200, 2 ); + } + + //------------------------------------------------------- + //This function is a helper function used by + // NextPathTypeExample. + //------------------------------------------------------- + void ListPathPoints( PaintEventArgs^ e, GraphicsPath^ myPath, GraphicsPathIterator^ myPathIterator, int xOffset, int listType ) + { + // Get the total number of points for the path, + // and the arrays of the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for drawing the points to the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + if ( listType == 1 ) + { + // Draw the set of path points and types to the screen. + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], + myFont, myBrush, (float)xOffset, (float)j ); + j += 20; + } + } + else + if ( listType == 2 ) + { + // Draw the total number of points to the screen. + int myPathTotalPoints = myPathIterator->Count; + e->Graphics->DrawString( String::Format( "Total Points = {0}", myPathTotalPoints ), myFont, myBrush, (float)xOffset, 100.0f ); + } + else + { + e->Graphics->DrawString( "Wrong or no list type argument.", myFont, myBrush, (float)xOffset, 200.0f ); + } + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath(System.Drawing.Drawing2D.GraphicsPath,System.Boolean@) + // + void NextSubpathExample2( PaintEventArgs^ e ) + { + // Create a graphics path. + GraphicsPath^ myPath = gcnew GraphicsPath; + + // Set up primitives to add to myPath. + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + + // Add 3 lines, a rectangle, an ellipse, and 2 markers. + myPath->AddLines( myPoints ); + myPath->SetMarkers(); + myPath->AddRectangle( myRect ); + myPath->SetMarkers(); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Get the total number of points for the path, + // and the arrays of the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for listing all of the path's + // points to the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // List the values of all the path points and types to the screen. + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); + j += 20; + } + + // Create a GraphicsPathIterator for myPath. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + + // Rewind the iterator. + myPathIterator->Rewind(); + + // Create the GraphicsPath section. + GraphicsPath^ myPathSection = gcnew GraphicsPath; + + // Iterate to the 3rd subpath and list the number of points therein + // to the screen. + int subpathPoints; + bool IsClosed2; + + // Iterate to the third subpath. + subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 ); + subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 ); + subpathPoints = myPathIterator->NextSubpath( myPathSection, IsClosed2 ); + + // Write the number of subpath points to the screen. + e->Graphics->DrawString( String::Format( "Subpath: 3 Num Points: {0}", subpathPoints ), myFont, myBrush, 200, 20 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.GraphicsPathIterator.NextSubpath(System.Int32@,System.Int32@,System.Boolean@) + // +private: + void NextSubpathExample( PaintEventArgs^ e ) + { + // Create the GraphicsPath. + GraphicsPath^ myPath = gcnew GraphicsPath; + array^ myPoints = {Point(20,20),Point(120,120),Point(20,120),Point(20,20)}; + Rectangle myRect = Rectangle(120,120,100,100); + + // Add 3 lines, a rectangle, an ellipse, and 2 markers. + myPath->AddLines( myPoints ); + myPath->AddRectangle( myRect ); + myPath->AddEllipse( 220, 220, 100, 100 ); + + // Get the total number of points for the path, + // and the arrays of the points and types. + int myPathPointCount = myPath->PointCount; + array^myPathPoints = myPath->PathPoints; + array^myPathTypes = myPath->PathTypes; + + // Set up variables for drawing the array of + // points to the screen. + int i; + float j = 20; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // Draw the set of path points and types to the screen. + for ( i = 0; i < myPathPointCount; i++ ) + { + e->Graphics->DrawString( myPathPoints[ i ].X + ", " + myPathPoints[ i ].Y + ", " + myPathTypes[ i ], myFont, myBrush, 20, j ); + j += 20; + } + + // Create a GraphicsPathIterator. + GraphicsPathIterator^ myPathIterator = gcnew GraphicsPathIterator( myPath ); + int myStartIndex; + int myEndIndex; + bool myIsClosed; + + // get the number of Subpaths. + int numSubpaths = myPathIterator->NextSubpath( myPath, myIsClosed ); + numSubpaths -= 1; + + // Rewind the Iterator. + myPathIterator->Rewind(); + + // List the Subpaths to the screen. + j = 20; + for ( i = 0; i < numSubpaths; i++ ) + { + myPathIterator->NextSubpath( myStartIndex, myEndIndex, myIsClosed ); + String^ s = String::Format( "Subpath {0}: Start: {1}", i, myStartIndex ); + s = s + String::Format( " End: {0} IsClosed: {1}", myEndIndex, myIsClosed ); + e->Graphics->DrawString( s, myFont, myBrush, 200, j ); + j += 20; + } + + // Draw the total number of Subpaths to the screen. + j += 20; + e->Graphics->DrawString( String::Format( "Number Subpaths = {0}", numSubpaths ), myFont, myBrush, 200, j ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp new file mode 100644 index 00000000000..cb009d52a56 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicLinearGradientBrush/CPP/form1.cpp @@ -0,0 +1,276 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.Clone + // +private: + void CloneExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + int x = 20,y = 20,h = 100,w = 200; + Rectangle myRect = Rectangle(x,y,w,h); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Aquamarine,45.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, x, y, w, h ); + + // Clone the LinearGradientBrush. + LinearGradientBrush^ clonedLGBrush = dynamic_cast(myLGBrush->Clone()); + + // Justify the left edge of the gradient with the + // left edge of the ellipse. + clonedLGBrush->TranslateTransform( -100.0f, 0.0f ); + + // Draw a second ellipse to the screen using the cloned HBrush. + y = 150; + e->Graphics->FillEllipse( clonedLGBrush, x, y, w, h ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) + // +private: + void MultiplyTransformExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, myRect ); + + // Transform the LinearGradientBrush. + array^ transformArray = {Point(20,150),Point(400,150),Point(20,200)}; + Matrix^ myMatrix = gcnew Matrix( myRect,transformArray ); + myLGBrush->MultiplyTransform( myMatrix, MatrixOrder::Prepend ); + + // Draw a second ellipse to the screen using + // the transformed brush. + e->Graphics->FillEllipse( myLGBrush, 20, 150, 380, 50 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.ResetTransform + // +private: + void ResetTransformExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, myRect ); + + // Transform the LinearGradientBrush. + array^ transformArray = {Point(20,150),Point(400,150),Point(20,200)}; + Matrix^ myMatrix = gcnew Matrix( myRect,transformArray ); + myLGBrush->MultiplyTransform( myMatrix, MatrixOrder::Prepend ); + + // Draw a second ellipse to the screen + // using the transformed brush. + e->Graphics->FillEllipse( myLGBrush, 20, 150, 380, 50 ); + + // Reset the brush transform. + myLGBrush->ResetTransform(); + + // Draw a third ellipse to the screen using the reset brush. + e->Graphics->FillEllipse( myLGBrush, 20, 250, 200, 100 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +private: + void RotateTransformExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, myRect ); + + // Rotate the LinearGradientBrush. + myLGBrush->RotateTransform( 45.0f, MatrixOrder::Prepend ); + + // Rejustify the brush to start at the left edge of the ellipse. + myLGBrush->TranslateTransform( -100.0f, 0.0f ); + + // Draw a second ellipse to the screen using + // the transformed brush. + e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +private: + void ScaleTransformExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, myRect ); + + // Scale the LinearGradientBrush. + myLGBrush->ScaleTransform( 2.0f, 1.0f, MatrixOrder::Prepend ); + + // Rejustify the brush to start at the left edge of the ellipse. + myLGBrush->TranslateTransform( -20.0f, 0.0f ); + + // Draw a second ellipse to the screen using + // the transformed brush. + e->Graphics->FillEllipse( myLGBrush, 20, 150, 200, 100 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.SetBlendTriangularShape(System.Single,System.Single) + // +private: + void SetBlendTriangularShapeExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, myRect ); + + // Create a triangular shaped brush with the peak at the center + // of the drawing area. + myLGBrush->SetBlendTriangularShape( .5f, 1.0f ); + + // Use the triangular brush to draw a second ellipse. + myRect.Y = 150; + e->Graphics->FillEllipse( myLGBrush, myRect ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.SetSigmaBellShape(System.Single,System.Single) + // +private: + void SetSigmaBellShapeExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw an ellipse to the screen using the LinearGradientBrush. + e->Graphics->FillEllipse( myLGBrush, myRect ); + + // Create a bell-shaped brush with the peak at the + // center of the drawing area. + myLGBrush->SetSigmaBellShape( .5f, 1.0f ); + + // Use the bell- shaped brush to draw a second + // ellipse. + myRect.Y = 150; + e->Graphics->FillEllipse( myLGBrush, myRect ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.LinearGradientBrush.TranslateTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +private: + void TranslateTransformExample( PaintEventArgs^ e ) + { + // Create a LinearGradientBrush. + Rectangle myRect = Rectangle(20,20,200,100); + LinearGradientBrush^ myLGBrush = gcnew LinearGradientBrush( myRect,Color::Blue,Color::Red,0.0f,true ); + + // Draw a rectangle to the screen using the LinearGradientBrush. + e->Graphics->FillRectangle( myLGBrush, myRect ); + + // Rotate the LinearGradientBrush. + myLGBrush->RotateTransform( 90.0f ); + + // Scale the gradient for the height of the rectangle. + myLGBrush->ScaleTransform( 0.5f, 1.0f ); + + // Draw to the screen, the rotated and scaled gradient. + e->Graphics->FillRectangle( myLGBrush, 20, 150, 200, 100 ); + + // Rejustify the brush to start at the top edge of the + // rectangle. + myLGBrush->TranslateTransform( -20.0f, 0.0f ); + + // Draw a third rectangle to the screen using the translated + // brush. + e->Graphics->FillRectangle( myLGBrush, 20, 300, 200, 100 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp new file mode 100644 index 00000000000..e83b192d715 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMatrixExamples/CPP/form1.cpp @@ -0,0 +1,393 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.Multiply(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void MultiplyExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Set up the matrices. + Matrix^ myMatrix1 = gcnew Matrix( 2.0f,0.0f,0.0f,1.0f,0.0f,0.0f ); + Matrix^ myMatrix2 = gcnew Matrix( 0.0f,1.0f,-1.0f,0.0f,0.0f,0.0f ); + Matrix^ myMatrix3 = gcnew Matrix( 1.0f,0.0f,0.0f,1.0f,250.0f,50.0f ); + + // Display the elements of the starting matrix. + ListMatrixElements( e, myMatrix1, "Beginning Matrix", 6, 40 ); + + // Multiply Matrix1 by Matrix 2. + myMatrix1->Multiply( myMatrix2, MatrixOrder::Append ); + + // Display the result of the multiplication of Matrix1 and + // Matrix2. + ListMatrixElements( e, myMatrix1, "Matrix After 1st Multiplication", 6, 60 ); + + // Multiply the result from the previous multiplication by + // Matrix3. + myMatrix1->Multiply( myMatrix3, MatrixOrder::Append ); + + // Display the result of the previous multiplication + // multiplied by Matrix3. + ListMatrixElements1( e, myMatrix1, "Matrix After 2nd Multiplication", 6, 80 ); + + // Draw the rectangle prior to transformation. + e->Graphics->DrawRectangle( myPen, 0, 0, 100, 100 ); + + // Make the transformation. + e->Graphics->Transform = myMatrix1; + + // Draw the rectangle after transformation. + e->Graphics->DrawRectangle( myPen2, 0, 0, 100, 100 ); + } + + //------------------------------------------------------- + // The following function is a helper function to + // list the contents of a matrix. + //------------------------------------------------------- + void ListMatrixElements1( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) + { + // Set up variables for drawing the array + // of points to the screen. + int i; + float x = 20,X = 200; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // Draw the matrix name to the screen. + e->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ); + + // Draw the set of path points and types to the screen. + for ( i = 0; i < numElements; i++ ) + { + e->Graphics->DrawString( String::Concat( matrix->Elements[ i ], ", " ), myFont, myBrush, (float)X, (float)y ); + X += 30; + } + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.Reset + // +public: + void ResetExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Create a matrix that scales by 5 in the x direction and + // by 3 in the y direction. + Matrix^ myMatrix = gcnew Matrix( 5.0f,0.0f,0.0f,3.0f,0.0f,0.0f ); + + // List the matrix elements to the screen. + ListMatrixElements( e, myMatrix, "Beginning Matrix", 6, 20 ); + + // Reset the matrix to identity. + myMatrix->Reset(); + + // Again list the matrix elements to the screen. + ListMatrixElements2( e, myMatrix, "Matrix After Reset", 6, 40 ); + + // Translate the matrix by 50 points in the x-axis and 40 points + // in the y-axis. + myMatrix->Translate( 50.0f, 40.0f ); + + // List the matrix elements to the screen. + ListMatrixElements1( e, myMatrix, "Matrix After Translation", 6, 60 ); + + // Draw a rectangle to the screen. + e->Graphics->DrawRectangle( myPen, 0, 0, 100, 100 ); + + // Apply the matrix transform to the Graphics. + e->Graphics->Transform = myMatrix; + + // Draw another rectangle to the screen that has the transform + // applied. + e->Graphics->DrawRectangle( myPen2, 0, 0, 100, 100 ); + } + + //------------------------------------------------------- + // This function is a helper function to + // list the contents of a matrix. + //------------------------------------------------------- + void ListMatrixElements2( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) + { + // Set up variables for drawing the array + // of points to the screen. + int i; + float x = 20,X = 200; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // Draw the matrix name to the screen. + e->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ); + + // Draw the set of path points and types to the screen. + for ( i = 0; i < numElements; i++ ) + { + e->Graphics->DrawString( String::Concat( matrix->Elements[ i ], ", " ), myFont, myBrush, (float)X, (float)y ); + X += 30; + } + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.Rotate(System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void RotateExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Draw the rectangle to the screen before applying the transform. + e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 ); + + // Create a matrix and rotate it 45 degrees. + Matrix^ myMatrix = gcnew Matrix; + myMatrix->Rotate( 45, MatrixOrder::Append ); + + // Draw the rectangle to the screen again after applying the + // transform. + e->Graphics->Transform = myMatrix; + e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.RotateAt(System.Single,System.Drawing.PointF,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void RotateAtExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + PointF rotatePoint = PointF(150.0f,50.0f); + + // Draw the rectangle to the screen before applying the + // transform. + e->Graphics->DrawRectangle( myPen, 150, 50, 200, 100 ); + + // Create a matrix and rotate it 45 degrees. + Matrix^ myMatrix = gcnew Matrix; + myMatrix->RotateAt( 45, rotatePoint, MatrixOrder::Append ); + + // Draw the rectangle to the screen again after applying the + // transform. + e->Graphics->Transform = myMatrix; + e->Graphics->DrawRectangle( myPen2, 150, 50, 200, 100 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.Scale(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void ScaleExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Draw the rectangle to the screen before applying the + // transform. + e->Graphics->DrawRectangle( myPen, 50, 50, 100, 100 ); + + // Create a matrix and scale it. + Matrix^ myMatrix = gcnew Matrix; + myMatrix->Scale( 3, 2, MatrixOrder::Append ); + + // Draw the rectangle to the screen again after applying the + // transform. + e->Graphics->Transform = myMatrix; + e->Graphics->DrawRectangle( myPen2, 50, 50, 100, 100 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.Shear(System.Single,System.Single) + // +public: + void MatrixShearExample( PaintEventArgs^ e ) + { + Matrix^ myMatrix = gcnew Matrix; + myMatrix->Shear( 2, 0 ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Green ), 0, 0, 100, 50 ); + e->Graphics->MultiplyTransform( myMatrix ); + e->Graphics->DrawRectangle( gcnew Pen( Color::Red ), 0, 0, 100, 50 ); + e->Graphics->DrawEllipse( gcnew Pen( Color::Blue ), 0, 0, 100, 50 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.TransformPoints(System.Drawing.Point[]) + // +public: + void TransformPointsExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Create an array of points. + array^ myArray = {Point(20,20),Point(120,20),Point(120,120),Point(20,120),Point(20,20)}; + + // Draw the Points to the screen before applying the + // transform. + e->Graphics->DrawLines( myPen, myArray ); + + // Create a matrix and scale it. + Matrix^ myMatrix = gcnew Matrix; + myMatrix->Scale( 3, 2, MatrixOrder::Append ); + myMatrix->TransformPoints( myArray ); + + // Draw the Points to the screen again after applying the + // transform. + e->Graphics->DrawLines( myPen2, myArray ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.TransformVectors(System.Drawing.Point[]) + // +public: + void TransformVectorsExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Create an array of points. + array^ myArray = {Point(20,20),Point(120,20),Point(120,120),Point(20,120),Point(20,20)}; + + // Draw the Points to the screen before applying the + // transform. + e->Graphics->DrawLines( myPen, myArray ); + + // Create a matrix, scale it, and translate it. + Matrix^ myMatrix = gcnew Matrix; + myMatrix->Scale( 3, 2, MatrixOrder::Append ); + myMatrix->Translate( 100, 100, MatrixOrder::Append ); + + // List the matrix elements to the screen. + ListMatrixElements( e, myMatrix, "Scaled and Translated Matrix", 6, 20 ); + + // Apply the transform to the array. + myMatrix->TransformVectors( myArray ); + + // Draw the Points to the screen again after applying the + // transform. + e->Graphics->DrawLines( myPen2, myArray ); + } + + //------------------------------------------------------- + // This function is a helper function to + // list the contents of a matrix. + //------------------------------------------------------- + void ListMatrixElements( PaintEventArgs^ e, Matrix^ matrix, String^ matrixName, int numElements, int y ) + { + // Set up variables for drawing the array + // of points to the screen. + int i; + float x = 20,X = 200; + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( "Arial",8 ); + SolidBrush^ myBrush = gcnew SolidBrush( Color::Black ); + + // Draw the matrix name to the screen. + e->Graphics->DrawString( String::Concat( matrixName, ": " ), myFont, myBrush, (float)x, (float)y ); + + // Draw the set of path points and types to the screen. + for ( i = 0; i < numElements; i++ ) + { + e->Graphics->DrawString( String::Concat( matrix->Elements[ i ], ", " ), myFont, myBrush, (float)X, (float)y ); + X += 30; + } + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Matrix.Translate(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void TranslateExample( PaintEventArgs^ e ) + { + Pen^ myPen = gcnew Pen( Color::Blue,1.0f ); + Pen^ myPen2 = gcnew Pen( Color::Red,1.0f ); + + // Draw a rectangle to the screen before applying the + // transform. + e->Graphics->DrawRectangle( myPen, 20, 20, 100, 50 ); + + // Create a matrix and translate it. + Matrix^ myMatrix = gcnew Matrix; + myMatrix->Translate( 100, 100, MatrixOrder::Append ); + + // Draw the Points to the screen again after applying the + // transform. + e->Graphics->Transform = myMatrix; + e->Graphics->DrawRectangle( myPen2, 20, 20, 100, 50 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp new file mode 100644 index 00000000000..52770910d88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicMisc/CPP/form1.cpp @@ -0,0 +1,145 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Drawing2D.AdjustableArrowCap.#ctor(System.Single,System.Single) + // +public: + void ConstructAdjArrowCap1( PaintEventArgs^ e ) + { + AdjustableArrowCap^ myArrow = gcnew AdjustableArrowCap( 6,6 ); + Pen^ capPen = gcnew Pen( Color::Black ); + capPen->CustomStartCap = myArrow; + capPen->CustomEndCap = myArrow; + e->Graphics->DrawLine( capPen, 50, 50, 200, 50 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.AdjustableArrowCap.#ctor(System.Single,System.Single,System.Boolean) + // +public: + void ConstructAdjArrowCap2( PaintEventArgs^ e ) + { + AdjustableArrowCap^ myArrow = gcnew AdjustableArrowCap( 6,6,false ); + Pen^ capPen = gcnew Pen( Color::Black ); + capPen->CustomStartCap = myArrow; + capPen->CustomEndCap = myArrow; + e->Graphics->DrawLine( capPen, 50, 50, 200, 50 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.Blend.#ctor + // +public: + void BlendConstExample( PaintEventArgs^ e ) + { + //Draw ellipse using Blend. + Point startPoint2 = Point(20,110); + Point endPoint2 = Point(140,110); + array^myFactors = {.2f,.4f,.8f,.8f,.4f,.2f}; + array^myPositions = {0.0f,.2f,.4f,.6f,.8f,1.0f}; + Blend^ myBlend = gcnew Blend; + myBlend->Factors = myFactors; + myBlend->Positions = myPositions; + LinearGradientBrush^ lgBrush2 = + gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Blue,Color::Red ); + lgBrush2->Blend = myBlend; + Rectangle ellipseRect2 = Rectangle(20,110,120,80); + e->Graphics->FillEllipse( lgBrush2, ellipseRect2 ); + + // End example. + } + // + + // Snippet for: M:System.Drawing.Drawing2D.ColorBlend.#ctor + // +protected: + virtual void OnPaint( PaintEventArgs^ e ) override + { + //Draw ellipse using ColorBlend. + Point startPoint2 = Point(20,110); + Point endPoint2 = Point(140,110); + array^ myColors = + {Color::Green,Color::Yellow,Color::Yellow,Color::Blue,Color::Red,Color::Red}; + array^myPositions = {0.0f,.20f,.40f,.60f,.80f,1.0f}; + ColorBlend^ myBlend = gcnew ColorBlend; + myBlend->Colors = myColors; + myBlend->Positions = myPositions; + LinearGradientBrush^ lgBrush2 = + gcnew LinearGradientBrush( startPoint2,endPoint2,Color::Green,Color::Red ); + lgBrush2->InterpolationColors = myBlend; + Rectangle ellipseRect2 = Rectangle(20,110,120,80); + e->Graphics->FillEllipse( lgBrush2, ellipseRect2 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp new file mode 100644 index 00000000000..58437a3d7a7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Drawing2D.ClassicPathGradientBrush/CPP/form1.cpp @@ -0,0 +1,256 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + + // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.MultiplyTransform(System.Drawing.Drawing2D.Matrix,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void MultiplyTransformExample( PaintEventArgs^ e ) + { + // Create a graphics path and add an rectangle. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle rect = Rectangle(20,20,100,50); + myPath->AddRectangle( rect ); + + // Get the path's array of points. + array^myPathPointArray = myPath->PathPoints; + + // Create a path gradient brush. + PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); + + // Set the color span. + myPGBrush->CenterColor = Color::Red; + array^ mySurroundColor = {Color::Blue}; + myPGBrush->SurroundColors = mySurroundColor; + + // Draw the brush to the screen prior to transformation. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); + + // Create a new matrix that rotates by 90 degrees, and + // translates by 100 in each direction. + Matrix^ myMatrix = gcnew Matrix( 0,1,-1,0,100,100 ); + + // Apply the transform to the brush. + myPGBrush->MultiplyTransform( myMatrix, MatrixOrder::Append ); + + // Draw the brush to the screen again after applying the + // transform. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.RotateTransform(System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void RotateTransformExample( PaintEventArgs^ e ) + { + // Create a graphics path and add an ellipse. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle rect = Rectangle(100,20,100,50); + myPath->AddRectangle( rect ); + + // Get the path's array of points. + array^myPathPointArray = myPath->PathPoints; + + // Create a path gradient brush. + PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); + + // Set the color span. + myPGBrush->CenterColor = Color::Red; + array^ mySurroundColor = {Color::Blue}; + myPGBrush->SurroundColors = mySurroundColor; + + // Draw the brush to the screen prior to transformation. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); + + // Apply the rotate transform to the brush. + myPGBrush->RotateTransform( 45, MatrixOrder::Append ); + + // Draw the brush to the screen again after applying the + // transform. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 300 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.ScaleTransform(System.Single,System.Single,System.Drawing.Drawing2D.MatrixOrder) + // +public: + void ScaleTransformExample( PaintEventArgs^ e ) + { + // Create a graphics path and add a rectangle. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle rect = Rectangle(100,20,100,50); + myPath->AddRectangle( rect ); + + // Get the path's array of points. + array^myPathPointArray = myPath->PathPoints; + + // Create a path gradient brush. + PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); + + // Set the color span. + myPGBrush->CenterColor = Color::Red; + array^ mySurroundColor = {Color::Blue}; + myPGBrush->SurroundColors = mySurroundColor; + + // Draw the brush to the screen prior to transformation. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); + + // Scale by a factor of 2 in the x-axis by applying the scale + // transform to the brush. + myPGBrush->ScaleTransform( 2, 1, MatrixOrder::Append ); + + // Move the brush down by 100 by Applying the translate + // transform to the brush. + myPGBrush->TranslateTransform( -100, 100, MatrixOrder::Append ); + + // Draw the brush to the screen again after applying the + // transforms. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.SetBlendTriangularShape(System.Single,System.Single) + // +public: + void SetBlendTriangularShapeExample( PaintEventArgs^ e ) + { + // Create a graphics path and add a rectangle. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle rect = Rectangle(100,20,100,50); + myPath->AddRectangle( rect ); + + // Get the path's array of points. + array^myPathPointArray = myPath->PathPoints; + + // Create a path gradient brush. + PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); + + // Set the color span. + myPGBrush->CenterColor = Color::Red; + array^ mySurroundColor = {Color::Blue}; + myPGBrush->SurroundColors = mySurroundColor; + + // Draw the brush to the screen prior to the blend. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); + + // Set the Blend factors. + myPGBrush->SetBlendTriangularShape( 0.5f, 1.0f ); + + // Move the brush down by 100 by Applying the translate + // transform to the brush. + myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append ); + + // Draw the brush to the screen again after applying the + // transforms. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 ); + } + // + + // Snippet for: M:System.Drawing.Drawing2D.PathGradientBrush.SetSigmaBellShape(System.Single,System.Single) + // +public: + void SetSigmaBellShapeExample( PaintEventArgs^ e ) + { + // Create a graphics path and add a rectangle. + GraphicsPath^ myPath = gcnew GraphicsPath; + Rectangle rect = Rectangle(100,20,100,50); + myPath->AddRectangle( rect ); + + // Get the path's array of points. + array^myPathPointArray = myPath->PathPoints; + + // Create a path gradient brush. + PathGradientBrush^ myPGBrush = gcnew PathGradientBrush( myPathPointArray ); + + // Set the color span. + myPGBrush->CenterColor = Color::Red; + array^ mySurroundColor = {Color::Blue}; + myPGBrush->SurroundColors = mySurroundColor; + + // Draw the brush to the screen prior to blend. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 200, 200 ); + + // Set the Blend factors and transform the brush. + myPGBrush->SetSigmaBellShape( 0.5f, 1.0f ); + + // Move the brush down by 100 by applying the translate + // transform to the brush. + myPGBrush->TranslateTransform( 0, 100, MatrixOrder::Append ); + + // Draw the brush to the screen again after setting the + // blend and applying the transform. + e->Graphics->FillRectangle( myPGBrush, 10, 10, 300, 300 ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp new file mode 100644 index 00000000000..467fba860a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.FontsExample/cpp/form1.cpp @@ -0,0 +1,203 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: + public System::Windows::Forms::Form + +{ + #pragma region " Windows Form Designer generated code " + + public: + Form1() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->ComboBox1->SelectedIndexChanged += gcnew EventHandler(this, + &Form1::ComboBox1_SelectedIndexChanged); + + //Add any initialization after the InitializeComponent() call + + } + + //Form overrides dispose to clean up the component list. + protected: + ~Form1() + { + if (components != nullptr) + { + delete components; + } + } + + //Required by the Windows Form Designer + private: + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + private: + System::Windows::Forms::ComboBox^ ComboBox1; + private: + System::Windows::Forms::Label^ Label1; + private: + System::Windows::Forms::Button^ Button1; + private: + System::Windows::Forms::Button^ Button2; + private: + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->ComboBox1 = gcnew System::Windows::Forms::ComboBox(); + this->Label1 = gcnew System::Windows::Forms::Label(); + this->Button1 = gcnew System::Windows::Forms::Button(); + this->Button2 = gcnew System::Windows::Forms::Button(); + this->SuspendLayout(); + // + //ComboBox1 + // + this->ComboBox1->Items->AddRange + (gcnew array{"Smaller", "Bigger"}); + this->ComboBox1->Location = System::Drawing::Point(64, 32); + this->ComboBox1->Name = "ComboBox1"; + this->ComboBox1->Size = System::Drawing::Size(121, 21); + this->ComboBox1->TabIndex = 0; + // + //Label1 + // + this->Label1->Location = System::Drawing::Point(48, 136); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size(184, 88); + this->Label1->TabIndex = 1; + this->Label1->Text = "Some text to change."; + // + // Button1 + // + this->Button1->Location = System::Drawing::Point(192, 56); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 2; + this->Button1->Text = "Button1"; + this->Button1->Click += + gcnew System::EventHandler(this,&Form1::Button1_Click); + // + // Button2 + // + this->Button2->Location = System::Drawing::Point(200, 8); + this->Button2->Name = "Button2"; + this->Button2->TabIndex = 3; + this->Button2->Text = "Button2"; + this->Button2->Click += + gcnew System::EventHandler(this,&Form1::Button2_Click); + // + //Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(292, 266); + this->Controls->Add(this->Label1); + this->Controls->Add(this->ComboBox1); + this->Controls->Add(this->Button2); + this->Controls->Add(this->Button1); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout(false); + + } + +#pragma endregion + + // The following code example demonstrates how to use the Size, + // SizeInPoints, and Unit properties. This example is designed to + // be used with a Windows Form that contains a ComboBox named + // ComboBox1. Paste the following code into the form and + // associate the ComboBox1_SelectedIndexChange method with the + // SelectedIndexChanged event of the ComboBox control. + + // + private: + void ComboBox1_SelectedIndexChanged(System::Object^ sender, + System::EventArgs^ e) + { + + // Cast the sender object back to a ComboBox. + ComboBox^ ComboBox1 = (ComboBox^) sender; + + // Retrieve the selected item. + String^ selectedString = (String^) ComboBox1->SelectedItem; + + // Convert it to lowercase. + selectedString = selectedString->ToLower(); + + // Declare the current size. + float currentSize; + + // If Bigger is selected, get the current size from the + // Size property and increase it. Reset the font to the + // new size, using the current unit. + if (selectedString == "bigger") + { + currentSize = Label1->Font->Size; + currentSize += 2.0F; + Label1->Font =gcnew System::Drawing::Font(Label1->Font->Name, + currentSize, Label1->Font->Style, Label1->Font->Unit); + + } + // If Smaller is selected, get the current size, in + // points, and decrease it by 2. Reset the font with + // the new size in points. + if (selectedString == "smaller") + { + currentSize = Label1->Font->Size; + currentSize -= 2.0F; + Label1->Font = gcnew System::Drawing::Font(Label1->Font->Name, + currentSize, Label1->Font->Style); + + } + } + // + + // The following code example demonstrates how to use the + // Font.#ctor(Font, FontStyle) constructor. To run this example, + // paste this code into a Windows Form that contains a button + // named Button1, and associate the Button1_Click method with the + // Click event of the button. + // + private: + void Button1_Click(System::Object^ sender, + System::EventArgs^ e) + { + Button1->Font = gcnew System::Drawing::Font + (this->Font, FontStyle::Italic); + } + // + + // The following code example demonstrates how to use + // the Font.#ctor(FontFamily, Single, FontStyle, GraphicsUnit) + // constructor. + // This example is designed to be used with Windows Forms. + // To run this example paste this code into a form that contains + // a button named Button2, and associate the Button2_Click method + // with the Click event of the button. + // + + private: + void Button2_Click(System::Object^ sender, + System::EventArgs^ e) + { + Button2->Font = gcnew System::Drawing::Font + (FontFamily::GenericMonospace, 12.0F, + FontStyle::Italic, GraphicsUnit::Pixel); + } + // +}; + +[STAThread] +int main() +{ + Application::Run(gcnew Form1()); +}; diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp new file mode 100644 index 00000000000..f01c00a1d3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.GraphicsProperties/CPP/form1.cpp @@ -0,0 +1,237 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Drawing::Drawing2D; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + + // The following code example demonstrates how to construct and + // use a region. + // This example is designed to be used with Windows Forms. + // Paste the code to a form and call the FillRegionExcludingPath + // method when handling the form's Paint event, passing e as + // PaintEventArgs. + // +private: + void FillRegionExcludingPath( PaintEventArgs^ e ) + { + // Create the region using a rectangle. + System::Drawing::Region^ myRegion = gcnew System::Drawing::Region( Rectangle(20,20,100,100) ); + + // Create the GraphicsPath. + System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath; + + // Add a circle to the graphics path. + path->AddEllipse( 50, 50, 25, 25 ); + + // Exclude the circle from the region. + myRegion->Exclude( path ); + + // Retrieve a Graphics object from the form. + Graphics^ formGraphics = e->Graphics; + + // Fill the region in blue. + formGraphics->FillRegion( Brushes::Blue, myRegion ); + + // Dispose of the path and region objects. + delete path; + delete myRegion; + } + // + + // The following code example demonstrates how to use the + // PageScale and TranslateTransform members to change the + // scale and origin when you draw a rectangle. + // This example is designed to be used with Windows Forms. + // Paste the code intto a form and call the + // ChangePageScaleAndTranslateTransform method when + // handling the form's Paint event, passing e as PaintEventArgs. + // +private: + void ChangePageScaleAndTranslateTransform( PaintEventArgs^ e ) + { + // Create a rectangle. + Rectangle rectangle1 = Rectangle(20,20,50,100); + + // Draw its outline. + e->Graphics->DrawRectangle( Pens::SlateBlue, rectangle1 ); + + // Change the page scale. + e->Graphics->PageScale = 2.0F; + + // Call TranslateTransform to change the origin of the + // Graphics object. + e->Graphics->TranslateTransform( 10.0F, 10.0F ); + + // Draw the rectangle again. + e->Graphics->DrawRectangle( Pens::Tomato, rectangle1 ); + + // Set the page scale and origin back to their original values. + e->Graphics->PageScale = 1.0F; + e->Graphics->ResetTransform(); + SolidBrush^ transparentBrush = gcnew SolidBrush( Color::FromArgb( 50, Color::Yellow ) ); + + // Create a new rectangle with the coordinates you expect + // after setting PageScale and calling TranslateTransform: + // x = (10 + 20) * 2 + // y = (10 + 20) * 2 + // Width = 50 * 2 + // Length = 100 * 2 + Rectangle newRectangle = Rectangle(60,60,100,200); + + // Fill in the rectangle with a semi-transparent color. + e->Graphics->FillRectangle( transparentBrush, newRectangle ); + } + // + + // The following code example demonstrates the effect of changing + // the PageUnit property. + // This example is designed to be used with Windows Forms. + // Paste the code into a form and call the ChangePageUnit + // method when handling the form's Paint event, passing e + // as PaintEventArgs. + // +private: + void ChangePageUnit( PaintEventArgs^ e ) + { + // Create a rectangle. + Rectangle rectangle1 = Rectangle(20,20,50,100); + + // Draw its outline. + e->Graphics->DrawRectangle( Pens::SlateBlue, rectangle1 ); + + // Change the page scale. + e->Graphics->PageUnit = GraphicsUnit::Point; + + // Draw the rectangle again. + e->Graphics->DrawRectangle( Pens::Tomato, rectangle1 ); + } + // + + // The following method demonstrates the use of the Clip + // property. + // This example is designed to be used with Windows Forms. + // Paste the code int a form and call the SetAndFillClip method + // when handling the form's Paint event, passing e as PaintEventArgs. + // +private: + void SetAndFillClip( PaintEventArgs^ e ) + { + // Set the Clip property to a new region. + e->Graphics->Clip = gcnew System::Drawing::Region( Rectangle(10,10,100,200) ); + + // Fill the region. + e->Graphics->FillRegion( Brushes::LightSalmon, e->Graphics->Clip ); + + // Demonstrate the clip region by drawing a string + // at the outer edge of the region. + e->Graphics->DrawString( "Outside of Clip", gcnew System::Drawing::Font( "Arial",12.0F,FontStyle::Regular ), Brushes::Black, 0.0F, 0.0F ); + } + // + + // The following code example demonstrates the use of the + // TextRenderingHint and TextContrast properties. + // This example is designed to be used with Windows Forms. + // Paste the code into a form and call the + // ChangeTextRenderingHintAndTextContrast method when + // handling the form's Paint event, passing e as PaintEventArgs. + // +private: + void ChangeTextRenderingHintAndTextContrast( PaintEventArgs^ e ) + { + // Retrieve the graphics object. + Graphics^ formGraphics = e->Graphics; + + // Declare a new font. + System::Drawing::Font^ myFont = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,20,FontStyle::Regular ); + + // Set the TextRenderingHint property. + formGraphics->TextRenderingHint = System::Drawing::Text::TextRenderingHint::SingleBitPerPixel; + + // Draw the string. + formGraphics->DrawString( "Hello World", myFont, Brushes::Firebrick, 20.0F, 20.0F ); + + // Change the TextRenderingHint property. + formGraphics->TextRenderingHint = System::Drawing::Text::TextRenderingHint::AntiAliasGridFit; + + // Draw the string again. + formGraphics->DrawString( "Hello World", myFont, Brushes::Firebrick, 20.0F, 60.0F ); + + // Set the text contrast to a high-contrast setting. + formGraphics->TextContrast = 0; + + // Draw the string. + formGraphics->DrawString( "Hello World", myFont, Brushes::DodgerBlue, 20.0F, 100.0F ); + + // Set the text contrast to a low-contrast setting. + formGraphics->TextContrast = 12; + + // Draw the string again. + formGraphics->DrawString( "Hello World", myFont, Brushes::DodgerBlue, 20.0F, 140.0F ); + + // Dispose of the font object. + delete myFont; + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + ChangeTextRenderingHintAndTextContrast( e ); + + //ChangePageScaleAndTranslateTransform(e); + //ChangePageUnit(e); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp new file mode 100644 index 00000000000..8a00128e2a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ImageExample/CPP/form1.cpp @@ -0,0 +1,381 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Drawing::Imaging; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + this->Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); + this->Button3->Click += gcnew EventHandler( this, &Form1::Button3_Click ); + this->Button4->Click += gcnew EventHandler( this, &Form1::Button4_Click ); + this->Button5->Click += gcnew EventHandler( this, &Form1::Button5_Click ); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::PictureBox^ PictureBox1; + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Button^ Button2; + System::Windows::Forms::Button^ Button3; + System::Windows::Forms::Button^ Button4; + System::Windows::Forms::Label ^ Label1; + System::Windows::Forms::Button^ Button5; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button2 = gcnew System::Windows::Forms::Button; + this->Button3 = gcnew System::Windows::Forms::Button; + this->Button4 = gcnew System::Windows::Forms::Button; + this->Label1 = gcnew System::Windows::Forms::Label; + this->Button5 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //PictureBox1 + // + this->PictureBox1->Location = System::Drawing::Point( 24, 8 ); + this->PictureBox1->Name = "PictureBox1"; + this->PictureBox1->Size = System::Drawing::Size( 100, 88 ); + this->PictureBox1->TabIndex = 0; + this->PictureBox1->TabStop = false; + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 192, 8 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 2; + this->Button1->Text = "Button1"; + + // + //Button2 + // + this->Button2->Location = System::Drawing::Point( 192, 40 ); + this->Button2->Name = "Button2"; + this->Button2->TabIndex = 3; + this->Button2->Text = "Button2"; + + // + //Button3 + // + this->Button3->Location = System::Drawing::Point( 192, 72 ); + this->Button3->Name = "Button3"; + this->Button3->TabIndex = 4; + this->Button3->Text = "Button3"; + + // + //Button4 + // + this->Button4->Location = System::Drawing::Point( 192, 104 ); + this->Button4->Name = "Button4"; + this->Button4->TabIndex = 5; + this->Button4->Text = "Button4"; + + // + //Label1 + // + this->Label1->Location = System::Drawing::Point( 24, 72 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 152, 32 ); + this->Label1->TabIndex = 6; + this->Label1->Text = "Label1"; + + // + //Button5 + // + this->Button5->Location = System::Drawing::Point( 200, 136 ); + this->Button5->Name = "Button5"; + this->Button5->TabIndex = 7; + this->Button5->Text = "Button5"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button5 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->Button4 ); + this->Controls->Add( this->Button3 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->PictureBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // The following code example demonstrates how to construct a new Bitmap + // from a file, using the GetPixel and SetPixel methods to + // recolor the image. It also uses the PixelFormat property. + // This example is designed to be used with a Windows Forms that contains + // a Label, PictureBox and Button named Label1, PictureBox1 and Button1, + // respectively. Paste the code into the form and associate the + // Button1_Click method with the button's Click event. + + // +private: + Bitmap^ image1; + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + try + { + + // Retrieve the image. + image1 = gcnew Bitmap( "C:\\Documents and Settings\\All Users\\" + "Documents\\My Music\\music.bmp",true ); + int x; + int y; + + // Loop through the images pixels to reset color. + for ( x = 0; x < image1->Width; x++ ) + { + for ( y = 0; y < image1->Height; y++ ) + { + Color pixelColor = image1->GetPixel( x, y ); + Color newColor = Color::FromArgb( pixelColor.R, 0, 0 ); + image1->SetPixel( x, y, newColor ); + + } + + } + + // Set the PictureBox to display the image. + PictureBox1->Image = image1; + + // Display the pixel format in Label1. + Label1->Text = String::Format( "Pixel format: {0}", image1->PixelFormat ); + } + catch ( ArgumentException^ ) + { + MessageBox::Show( "There was an error." + "Check the path to the image file." ); + } + + } + // + + // The following code example demonstrates how to obtain a new bitmap + // using the FromFile method. It also demonstrates a TextureBrush. + // This example is designed to be used with Windows Forms. Create + // a form containing a button named Button2. Paste the code into the form + // and associate the Button2_Click method with the button's Click event. + + // +private: + void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + try + { + Bitmap^ image1 = dynamic_cast(Image::FromFile( "C:\\Documents and Settings\\" + "All Users\\Documents\\My Music\\music.bmp", true )); + TextureBrush^ texture = gcnew TextureBrush( image1 ); + texture->WrapMode = System::Drawing::Drawing2D::WrapMode::Tile; + Graphics^ formGraphics = this->CreateGraphics(); + formGraphics->FillEllipse( texture, RectangleF(90.0F,110.0F,100,100) ); + delete formGraphics; + } + catch ( System::IO::FileNotFoundException^ ) + { + MessageBox::Show( "There was an error opening the bitmap." + "Please check the path." ); + } + } + // + + // The following code example demonstrates how to create a pen + // and set its DashStyle property. + // This example is designed to be used with Windows Forms. Create + // a form that contains a Button named Button3. Paste the code into the + // form and associate the Button3_Click method with the button's + // Click event. + + // +private: + void Button3_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Graphics^ buttonGraphics = Button3->CreateGraphics(); + Pen^ myPen = gcnew Pen( Color::ForestGreen,4.0F ); + myPen->DashStyle = System::Drawing::Drawing2D::DashStyle::DashDotDot; + Rectangle theRectangle = Button3->ClientRectangle; + theRectangle.Inflate( -2, -2 ); + buttonGraphics->DrawRectangle( myPen, theRectangle ); + delete buttonGraphics; + delete myPen; + } + // + + // The following code example demonstrates the Clear method. + // This example is designed to be used with Windows Forms. + // Create a form that contains a Button named Button4. + // Paste the code into the form and associate + // the Button4_Click method with the button's Click event. + + // +private: + void Button4_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Graphics^ buttonGraphics = Button4->CreateGraphics(); + buttonGraphics->Clear( Button4->BackColor ); + delete buttonGraphics; + } + // + + // The following code example demonstrates calling the Save method. + // This example is designed to be used with Windows Forms. + // Create a form that contains a button named Button5. + // Paste the code to the form and associate + // the Button5_Click method with button's Click event. + + // +private: + void Button5_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + try + { + if ( image1 != nullptr ) + { + image1->Save( "c:\\myBitmap.bmp" ); + Button5->Text = "Saved file."; + } + } + catch ( Exception^ ) + { + MessageBox::Show( "There was a problem saving the file." + "Check the file permissions." ); + } + } + // + + // this example was extracted from the "Reading Metadata" + // conceptual topic + // The following method demonstrates how to read and display + // the metadata in an image file using the PropertyItem class and + // PropertyItems property. + // This example is designed to be used a Windows Form that imports + // the System.Drawing.Imaging namespace. + // Paste the code into the form and change the path to fakePhoto.jpg + // to point to an image file on your system. Call the ExtractMetaData + // method when handling the form's Paint event, passing e as PaintEventArgs. + + // +private: + void ExtractMetaData( PaintEventArgs^ e ) + { + try + { + + // Create an Image object. + Image^ theImage = gcnew Bitmap( "c:\\fakePhoto.jpg" ); + + // Get the PropertyItems property from image. + array^propItems = theImage->PropertyItems; + + // Set up the display. + System::Drawing::Font^ font1 = gcnew System::Drawing::Font( "Arial",10 ); + SolidBrush^ blackBrush = gcnew SolidBrush( Color::Black ); + int X = 0; + int Y = 0; + + // For each PropertyItem in the array, display the id, + // type, and length. + int count = 0; + System::Collections::IEnumerator^ myEnum = propItems->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + PropertyItem^ propItem = safe_cast(myEnum->Current); + e->Graphics->DrawString( String::Format( "Property Item {0}", count ), font1, blackBrush, (float)X, (float)Y ); + Y += font1->Height; + e->Graphics->DrawString( String::Format( " ID: 0x{0}", propItem->Id.ToString( "x" ) ), font1, blackBrush, (float)X, (float)Y ); + Y += font1->Height; + e->Graphics->DrawString( String::Format( " type: {0}", propItem->Type ), font1, blackBrush, (float)X, (float)Y ); + Y += font1->Height; + e->Graphics->DrawString( String::Format( " length: {0} bytes", propItem->Len ), font1, blackBrush, (float)X, (float)Y ); + Y += font1->Height; + count += 1; + } + delete font1; + } + catch ( Exception^ ) + { + MessageBox::Show( "There was an error." + "Make sure the path to the image file is valid." ); + } + + } + // + + // + // The following code example demonstrates how to use the GetPropertyItem + // and SetPropertyItem methods. This example is designed to be used with Windows + // Forms. To run this example paste it into a form, and handle the form's Paint event + // by calling the DemonstratePropertyItem method, passing e as PaintEventArgs. + + // +private: + void DemonstratePropertyItem( PaintEventArgs^ e ) + { + // Create two images. + Image^ image1 = Image::FromFile( "c:\\FakePhoto1.jpg" ); + Image^ image2 = Image::FromFile( "c:\\FakePhoto2.jpg" ); + + // Get a PropertyItem from image1. + PropertyItem^ propItem = image1->GetPropertyItem( 20624 ); + + // Change the ID of the PropertyItem. + propItem->Id = 20625; + + // Set the PropertyItem for image2. + image2->SetPropertyItem( propItem ); + + // Draw the image. + e->Graphics->DrawImage( image2, 20.0F, 20.0F ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp new file mode 100644 index 00000000000..0f706351c31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicEncoderExample1/CPP/form1.cpp @@ -0,0 +1,57 @@ + + +// Snippet for: F:System.Drawing.Imaging.Encoder.ColorDepth +// Snippet for: F:System.Drawing.Imaging.Encoder.Compression +// Snippet for: F:System.Drawing.Imaging.Encoder.Quality +// +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ); +int main() +{ + Bitmap^ myBitmap; + ImageCodecInfo^ myImageCodecInfo; + Encoder^ myEncoder; + EncoderParameter^ myEncoderParameter; + EncoderParameters^ myEncoderParameters; + + // Create a Bitmap object based on a BMP file. + myBitmap = gcnew Bitmap( "C:\\Documents and Settings\\All Users\\Documents\\My Music\\music.bmp" ); + + // Get an ImageCodecInfo object that represents the TIFF codec. + myImageCodecInfo = GetEncoderInfo( "image/tiff" ); + + // Create an Encoder object based on the GUID + // for the ColorDepth parameter category. + myEncoder = Encoder::ColorDepth; + + // Create an EncoderParameters object. + // An EncoderParameters object has an array of EncoderParameter + // objects. In this case, there is only one + // EncoderParameter object in the array. + myEncoderParameters = gcnew EncoderParameters( 1 ); + + // Save the image with a color depth of 24 bits per pixel. + myEncoderParameter = gcnew EncoderParameter( myEncoder,__int64(24) ); + myEncoderParameters->Param[ 0 ] = myEncoderParameter; + myBitmap->Save( "Shapes24bpp.tiff", myImageCodecInfo, myEncoderParameters ); +} + +static ImageCodecInfo^ GetEncoderInfo( String^ mimeType ) +{ + int j; + array^encoders; + encoders = ImageCodecInfo::GetImageEncoders(); + for ( j = 0; j < encoders->Length; ++j ) + { + if ( encoders[ j ]->MimeType == mimeType ) + return encoders[ j ]; + + } + return nullptr; +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp new file mode 100644 index 00000000000..927ffac875b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Imaging.ClassicImageCodecExample/cpp/form1.cpp @@ -0,0 +1,146 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Drawing::Imaging; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ClassicImageCodecExample +{ + /// + /// Summary description for Form1. + /// + public ref class ClassicImageCodecForm : public System::Windows::Forms::Form + { + /// + /// Required designer variable. + /// + private: + System::ComponentModel::Container^ components; + + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + GetImageEncodersExample(e); + } + + public: + ClassicImageCodecForm() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + /// + /// Clean up any resources being used. + /// + protected: + ~ClassicImageCodecForm() + { + if (components) + { + delete components; + } + } + +#pragma region^ Windows Form^ Designer generated^ code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private: + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container(); + this->Size = System::Drawing::Size(300, 300); + this->Text = "Form1"; + } +#pragma endregion + + + // Snippet for: + //M:System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders + // + private: + void GetImageEncodersExample(PaintEventArgs^ e) + { + // Get an array of available codecs. + array^ codecInfo; + codecInfo = ImageCodecInfo::GetImageEncoders(); + int numCodecs = codecInfo->GetLength(0); + + //numCodecs = 1; + + // Set up display variables. + Color^ foreColor = Color::Black; + Drawing::Font^ font = gcnew Drawing::Font("Arial", 8); + + // Check to determine whether any codecs were found. + if (numCodecs > 0) + { + // Set up an array to hold codec information. There are 9 + // information elements plus 1 space for each codec, so 10 + // times the number of codecs found is allocated. + array^ codecInfoStrings = + gcnew array(numCodecs * 10); + + // Write all the codec information to the array. + for (int i = 0; i < numCodecs; i++) + { + codecInfoStrings[i * 10] = "Codec Name = " + + codecInfo[i]->CodecName; + codecInfoStrings[(i * 10) + 1] = "Class ID = " + + codecInfo[i]->Clsid.ToString(); + codecInfoStrings[(i * 10) + 2] = "DLL Name = " + + codecInfo[i]->DllName; + codecInfoStrings[(i * 10) + 3] = "Filename Ext. = " + + codecInfo[i]->FilenameExtension; + codecInfoStrings[(i * 10) + 4] = "Flags = " + + codecInfo[i]->Flags.ToString(); + codecInfoStrings[(i * 10) + 5] = "Format Descrip. = " + + codecInfo[i]->FormatDescription; + codecInfoStrings[(i * 10) + 6] = "Format ID = " + + codecInfo[i]->FormatID.ToString(); + codecInfoStrings[(i * 10) + 7] = "MimeType = " + + codecInfo[i]->MimeType; + codecInfoStrings[(i * 10) + 8] = "Version = " + + codecInfo[i]->Version.ToString(); + codecInfoStrings[(i * 10) + 9] = " "; + } + int numCodecInfo = codecInfoStrings->GetLength(0); + + // Render all of the information to the screen. + int j = 20; + for (int i = 0; i < numCodecInfo; i++) + { + e->Graphics->DrawString(codecInfoStrings[i], + font, gcnew SolidBrush(*foreColor), 20, (float)j); + j += 12; + } + } + else + e->Graphics->DrawString("No Codecs Found", + font, gcnew SolidBrush(*foreColor), 20, 20); + } + // + + }; +} + +[STAThread] +int main() +{ + Application::Run(gcnew ClassicImageCodecExample::ClassicImageCodecForm()); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp new file mode 100644 index 00000000000..4ac91a4c581 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.Misc2/CPP/form1.cpp @@ -0,0 +1,295 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + Button2->Click += gcnew EventHandler( this, &Form1::Button2_Click ); + + //UseTransparentProperty() + //Add any initialization after the InitializeComponent() call + } + +protected: + + //Form overrides dispose to clean up the component list. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::PictureBox^ PictureBox1; + System::Windows::Forms::Button^ Button2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; + this->Button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 184, 40 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Button1"; + + // + //PictureBox1 + // + this->PictureBox1->Location = System::Drawing::Point( 112, 160 ); + this->PictureBox1->Name = "PictureBox1"; + this->PictureBox1->Size = System::Drawing::Size( 128, 88 ); + this->PictureBox1->TabIndex = 3; + this->PictureBox1->TabStop = false; + + // + //Button2 + // + this->Button2->Location = System::Drawing::Point( 184, 88 ); + this->Button2->Name = "Button2"; + this->Button2->TabIndex = 2; + this->Button2->Text = "Button2"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->PictureBox1 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // The following code example demonstrates the following members: + // Rectangle.#ctor(PointF, SizeF) + // StringFormat#ctor(StringFormatFlags) + // StringFormat.#ctor(StringFormat) + // StringFormat.Alignment + // StringAlignment + // StringFormatFlags + // This example is designed to be used with + // Windows Forms. Paste the code into a form and call the + // ShowLineAndAlignment method when handling the form's Paint event, + // passing e as PaintEventArgs. + + // +private: + void ShowLineAndAlignment( PaintEventArgs^ e ) + { + // Construct a new Rectangle . + Rectangle displayRectangle = Rectangle(Point(40,40),System::Drawing::Size( 80, 80 )); + + // Construct 2 new StringFormat objects + StringFormat^ format1 = gcnew StringFormat( StringFormatFlags::NoClip ); + StringFormat^ format2 = gcnew StringFormat( format1 ); + + // Set the LineAlignment and Alignment properties for + // both StringFormat objects to different values. + format1->LineAlignment = StringAlignment::Near; + format1->Alignment = StringAlignment::Center; + format2->LineAlignment = StringAlignment::Center; + format2->Alignment = StringAlignment::Far; + + // Draw the bounding rectangle and a string for each + // StringFormat object. + e->Graphics->DrawRectangle( Pens::Black, displayRectangle ); + e->Graphics->DrawString( "Showing Format1", this->Font, Brushes::Red, displayRectangle, format1 ); + e->Graphics->DrawString( "Showing Format2", this->Font, Brushes::Red, displayRectangle, format2 ); + } + // + + // The following example shows how to set the Trimming property + // and how to use the StringTrimming enumeration. This example + // is designed to be used with a Windows Form. Paste this code + // into a form and call the ShowStringTrimming method when + // handling the form's Paint event, passing e as PaintEventArgs. + + // +private: + void ShowStringTrimming( PaintEventArgs^ e ) + { + StringFormat^ format1 = gcnew StringFormat; + String^ quote = "Not everything that can be counted counts," + " and not everything that counts can be counted."; + format1->Trimming = StringTrimming::EllipsisWord; + e->Graphics->DrawString( quote, this->Font, Brushes::Black, RectangleF(10.0F,10.0F,90.0F,50.0F), format1 ); + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ /*e*/ ) + { + //ShowLineAndAlignment(e) + //DemonstrateBlend(e) + //ShowStringTrimming(e) + } + + // The following code example demonstrates how to use the + // Transparent property. + // This example is designed to be used with Windows Forms. + // Paste the code into a form that contains two buttons named Button1 + // and Button2. Call the UseTransparentProperty method in the + // form's constructor. + + // +private: + void UseTransparentProperty() + { + // Set up the PictureBox to display the entire image, and + // to cover the entire client area. + PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; + PictureBox1->Dock = DockStyle::Fill; + try + { + // Set the Image property of the PictureBox to an image retrieved + // from the file system. + PictureBox1->Image = Image::FromFile( "C:\\Documents and Settings\\All Users\\" + "Documents\\My Pictures\\Sample Pictures\\sunset.jpg" ); + + // Set the Parent property of Button1 and Button2 to the + // PictureBox. + Button1->Parent = PictureBox1; + Button2->Parent = PictureBox1; + + // Set the Color property of both buttons to transparent. + // With this setting the buttons assume the color of their + // parent. + Button1->BackColor = Color::Transparent; + Button2->BackColor = Color::Transparent; + } + catch ( System::IO::FileNotFoundException^ ) + { + MessageBox::Show( "There was an error." + "Make sure the image file path is valid." ); + } + } + // + + // The following code example demonstrates how to use the equality + // operator and construct a Point from a Size. It also + // demonstrates the use of the X and Y properties. + // This example is designed to be used with Windows Forms. + // Paste the code into a form that contains a button named Button1 + // and associate the Button1_Click method with the button's Click event. + + // +private: + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Construct a new Point with integers. + Point Point1 = Point(100,100); + + // Create a Graphics object. + Graphics^ formGraphics = this->CreateGraphics(); + + // Construct another Point, this time using a Size. + Point Point2 = Point(System::Drawing::Size( 100, 100 )); + + // Call the equality operator to see if the points are equal, + // and if so print out their x and y values. + if ( Point1 == Point2 ) + { + array^temp0 = {Point1.X,Point2.X,Point1.Y,Point2.Y}; + formGraphics->DrawString( String::Format( "Point1.X: " + "{0},Point2.X: {1}, Point1.Y: {2}, Point2.Y {3}", temp0 ), this->Font, Brushes::Black, PointF(10,70) ); + } + } + // + + // The following code example demonstrates how to use the Name + // property of a Color. + // This example is designed to be used with Windows Forms. + // Paste the code into a form that contains a button named Button2 + // and associate the Button2_Click method with the button's + // Click event. + + // +private: + void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Button2->Width = 100; + Button2->Text = String::Format( "Color: {0}", Button2->BackColor.Name ); + } + // + + // The following code example demonstrates how to use the Blend + // class by setting the Factors and Positions properties. + // This example is designed to be used with Windows Forms. + // Paste the code into a form that imports the + // System.Drawing.Drawing2D namespace. Handle the form's Paint + // event and call the DemonstrateBlend method, passing e as + // PaintEventArgs. + + // +private: + void DemonstrateBlend( PaintEventArgs^ e ) + { + Blend^ blend1 = gcnew Blend( 9 ); + + // Set the values in the Factors array to be all green, + // go to all blue, and then go back to green. + array^temp0 = {0.0F,0.2F,0.5F,0.7F,1.0F,0.7F,0.5F,0.2F,0.0F}; + blend1->Factors = temp0; + + // Set the positions. + array^temp1 = {0.0F,0.1F,0.3F,0.4F,0.5F,0.6F,0.7F,0.8F,1.0F}; + blend1->Positions = temp1; + + // Declare a rectangle to draw the Blend in. + Rectangle rectangle1 = Rectangle(10,10,120,100); + + // Create a new LinearGradientBrush using the rectangle, + // green and blue. and 90-degree angle. + LinearGradientBrush^ brush1 = gcnew LinearGradientBrush( rectangle1,Color::LightGreen,Color::Blue,90,true ); + + // Set the Blend property on the brush to the custom blend. + brush1->Blend = blend1; + + // Fill in an ellipse with the brush. + e->Graphics->FillEllipse( brush1, rectangle1 ); + + // Dispose of the custom brush. + delete brush1; + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp new file mode 100644 index 00000000000..dae28d99350 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.MiscExamples/CPP/form1.cpp @@ -0,0 +1,489 @@ + + +#using +#using +#using + +using namespace System::Drawing; +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing::Drawing2D; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + PopulateListBoxWithFonts(); + PopulateListBoxWithGraphicsResolution(); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + this->Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //listBox1 + // + this->listBox1->Location = System::Drawing::Point( 88, 112 ); + this->listBox1->Name = "listBox1"; + this->listBox1->Size = System::Drawing::Size( 120, 95 ); + this->listBox1->TabIndex = 0; + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 120, 24 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 1; + this->Button1->Text = "Button1"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->listBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // The following code example shows all the font families in the + // Families property of the FontFamily class. This example is + // designed to be used with a Windows Form. To run this example, + // add a ListBox named listBox1 to a form and call the + // PopulateListBoxWithFonts method from the form's constructor. + + // +private: + void PopulateListBoxWithFonts() + { + listBox1->Width = 200; + listBox1->Location = Point(40,120); + System::Collections::IEnumerator^ myEnum = FontFamily::Families->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + FontFamily^ oneFontFamily = safe_cast(myEnum->Current); + listBox1->Items->Add( oneFontFamily->Name ); + } + } + // + + // The following method shows the use of the DpiX and DpiY + // properties. This example is designed for use with a Windows Form. + // To run this example, paste it into a form that contains a ListBox named + // listBox1 and call this method from the form's constructor or Load event. + + // +private: + void PopulateListBoxWithGraphicsResolution() + { + Graphics^ boxGraphics = listBox1->CreateGraphics(); + + // Graphics* formGraphics = this->CreateGraphics(); + listBox1->Items->Add( String::Format( "ListBox horizontal resolution: {0}", boxGraphics->DpiX ) ); + listBox1->Items->Add( String::Format( "ListBox vertical resolution: {0}", boxGraphics->DpiY ) ); + delete boxGraphics; + } + // + + // The following code example shows how to set a keyboard shortcut + // when drawing a string with the Graphics object. It also + // demonstrates how to use the SystemBrush.FromSystemColor method. To + // run this example, paste the code into a form, handle the form's + // Paint event, and call the following method, passing e as + // PaintEventArgs. + + // +private: + void ShowHotKey( PaintEventArgs^ e ) + { + // Declare the string with a keyboard shortcut. + String^ text = "&Click Here"; + + // Declare a new StringFormat. + StringFormat^ format = gcnew StringFormat; + + // Set the HotkeyPrefix property. + format->HotkeyPrefix = System::Drawing::Text::HotkeyPrefix::Show; + + // Draw the string. + Brush^ theBrush = SystemBrushes::FromSystemColor( SystemColors::Highlight ); + e->Graphics->DrawString( text, this->Font, theBrush, 30, 40, format ); + } + // + + // The following code example adds a shadow to a ListBox using the + // following members: + // Size.opImplicit + // SizeF.opAddition + // Point.opImplicit + // PointF.opAddition + // SolidBrush + // This example is designed to be used with a Windows Form. + // To run this example, paste this code into a form and call the + // AddShadow method when handling the form's Paint event. Make + // sure the form contains a ListBox named listBox1. + + // +private: + void AddShadow( PaintEventArgs^ e ) + { + // Create two SizeF objects. + SizeF shadowSize = listBox1->Size; + SizeF addSize = SizeF(10.5F,20.8F); + + // Add them together and save the result in shadowSize. + shadowSize = shadowSize + addSize; + + // Get the location of the ListBox and convert it to a PointF. + PointF shadowLocation = listBox1->Location; + + // Add two points to get a new location. + shadowLocation = shadowLocation + System::Drawing::Size( 5, 5 ); + + // Create a rectangleF. + RectangleF rectFToFill = RectangleF(shadowLocation,shadowSize); + + // Create a custom brush using a semi-transparent color, and + // then fill in the rectangle. + Color customColor = Color::FromArgb( 50, Color::Gray ); + SolidBrush^ shadowBrush = gcnew SolidBrush( customColor ); + array^ temp0 = {rectFToFill}; + e->Graphics->FillRectangles( shadowBrush, temp0 ); + + // Dispose of the brush. + delete shadowBrush; + } + // + +public: + + // The following code example demonstrates using a Matrix + // and the GraphicsPath.Transform method to rotate a string. + // This example is designed to be used with Windows Forms. + // Create a form and paste the following code into it. Call the + // DrawVerticalStringFromBottomUp method in the form's Paint + // event-handling method, passing e as PaintEventArgs. + + // +private: + void DrawVerticalStringFromBottomUp( PaintEventArgs^ e ) + { + // Create the string to draw on the form. + String^ text = "Can you read this?"; + + // Create a GraphicsPath. + System::Drawing::Drawing2D::GraphicsPath^ path = gcnew System::Drawing::Drawing2D::GraphicsPath; + + // Add the string to the path; declare the font, font style, size, and + // vertical format for the string. + path->AddString( text, this->Font->FontFamily, 1, 15, PointF(0.0F,0.0F), gcnew StringFormat( StringFormatFlags::DirectionVertical ) ); + + // Declare a matrix that will be used to rotate the text. + System::Drawing::Drawing2D::Matrix^ rotateMatrix = gcnew System::Drawing::Drawing2D::Matrix; + + // Set the rotation angle and starting point for the text. + rotateMatrix->RotateAt( 180.0F, PointF(10.0F,100.0F) ); + + // Transform the text with the matrix. + path->Transform(rotateMatrix); + + // Set the SmoothingMode to high quality for best readability. + e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::HighQuality; + + // Fill in the path to draw the string. + e->Graphics->FillPath( Brushes::Red, path ); + + // Dispose of the path. + delete path; + } + // + + // The following code example demonstrates how to use the KnownColor enum + // to print out the name and colors of all its values. This example is + // designed to be used with Windows Forms. Create a form and paste + // the following code into it. Call the DisplayKnownColors method in the + // form's Paint event-handling method, passing e as PaintEventArgs. + + // +private: + void DisplayKnownColors( PaintEventArgs^ e ) + { + this->Size = System::Drawing::Size( 650, 550 ); + + // Get all the values from the KnownColor enumeration. + System::Array^ colorsArray = Enum::GetValues( KnownColor::typeid ); + array^allColors = gcnew array(colorsArray->Length); + Array::Copy( colorsArray, allColors, colorsArray->Length ); + + // Loop through printing out the values' names in the colors + // they represent. + float y = 0; + float x = 10.0F; + for ( int i = 0; i < allColors->Length; i++ ) + { + // If x is a multiple of 30, start a new column. + if ( i > 0 && i % 30 == 0 ) + { + x += 105.0F; + y = 15.0F; + } + else + { + // Otherwise, increment y by 15. + y += 15.0F; + } + + // Create a custom brush from the color and use it to draw + // the brush's name. + SolidBrush^ aBrush = gcnew SolidBrush( Color::FromName( allColors[ i ].ToString() ) ); + e->Graphics->DrawString( allColors[ i ].ToString(), this->Font, aBrush, x, y ); + + // Dispose of the custom brush. + delete aBrush; + } + } + // + + // The following code example demonstrates how to use the MakeEmpty + // method. This example is designed to be used with Windows Forms. + // Create a form and paste the following code into it. Call the + // FillEmptyRegion method in the form's Paint event-handling method, + // passing e as PaintEventArgs. + + // +private: + void FillEmptyRegion( PaintEventArgs^ e ) + { + // Create a region from a rectangle. + Rectangle originalRectangle = Rectangle(40,40,40,50); + System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle ); + + // Call MakeEmpty. + smallRegion->MakeEmpty(); + + // Fill the region in red and draw the original rectangle + // in black. Note there is nothing filled in. + e->Graphics->FillRegion( Brushes::Red, smallRegion ); + e->Graphics->DrawRectangle( Pens::Black, originalRectangle ); + } + // + + // The following code example demonstrates how to use the MakeInfinite + // method. This example is designed to be used with Windows Forms. + // Create a form and paste the following code into it. Call the + // FillInfiniteRegion method in the form's Paint event-handling method, + // passing e as PaintEventArgs. + + // +private: + void FillInfiniteRegion( PaintEventArgs^ e ) + { + // Create a region from a rectangle. + Rectangle originalRectangle = Rectangle(40,40,40,50); + System::Drawing::Region^ smallRegion = gcnew System::Drawing::Region( originalRectangle ); + + // Call MakeInfinite. + smallRegion->MakeInfinite(); + + // Fill the region in red and draw the original rectangle + // in black. Note that the entire form is filled in. + e->Graphics->FillRegion( Brushes::Red, smallRegion ); + e->Graphics->DrawRectangle( Pens::Black, originalRectangle ); + } + // + + // The following code example demonstrates how to use the ToBitmap + // method. This example is designed to be used with Windows Forms. + // Create a form and paste the following code into it. Call the + // IconToBitmap method in the form's Paint event-handling method, + // passing e as PaintEventArgs. + + // +private: + void IconToBitmap( PaintEventArgs^ e ) + { + // Construct an Icon. + System::Drawing::Icon^ icon1 = gcnew System::Drawing::Icon( SystemIcons::Exclamation,40,40 ); + + // Call ToBitmap to convert it. + Bitmap^ bmp = icon1->ToBitmap(); + + // Draw the bitmap. + e->Graphics->DrawImage( bmp, Point(30,30) ); + } + // + + // The following code example demonstrates how to use the + // TranslateTransform method. This example is designed to be used + // with Windows Forms. Create a form and paste the following code + // into it. Call the TranslateAndTransform method in the form's + // Paint event-handling method, passing e as PaintEventArgs. + + // +private: + void TranslateAndTransform( PaintEventArgs^ e ) + { + // Create a GraphicsPath. + System::Drawing::Drawing2D::GraphicsPath^ myPath = gcnew System::Drawing::Drawing2D::GraphicsPath; + + // Create a rectangle. + RectangleF layoutRectangle = RectangleF(20.0F,20.0F,40.0F,50.0F); + + // Add the rectangle to the path. + myPath->AddRectangle( layoutRectangle ); + + // Add a string to the path. + myPath->AddString( "Path", this->Font->FontFamily, 2, 10.0F, layoutRectangle, gcnew StringFormat( StringFormatFlags::NoWrap ) ); + + // Draw the path. + e->Graphics->DrawPath( Pens::Black, myPath ); + + // Call TranslateTransform and draw the path again. + e->Graphics->TranslateTransform( 10.0F, 10.0F ); + e->Graphics->DrawPath( Pens::Red, myPath ); + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + //FillEmptyRegion(e) + //SetAndFillClip(e) + //FillInfiniteRegion(e) + //ShowHotKey(e) + //AddShadow(e) + //IconToBitmap(e) + //DisplayKnownColors(e) + //DrawVerticalStringFromBottomUp(e) + TranslateAndTransform( e ); + } + + // The following code example demonstrates how to set the Font property of + // a button to a new, bold-style Font. This example is designed to be + // used with Windows Forms. Create a form containing a button named + // Button1 and paste the following code into it. Associate the + // Button1_Click method with the button's Click event. + + // +private: + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Button1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,12.0F,FontStyle::Bold ); + } + // + + // The following code example demonstrates how to construct a Region + // using the RegionData class. This example is designed to be used with Windows + // Forms. To run this example paste it into a form and handle the form's Paint event + // by calling the DemonstrateRegionData method, passing e as PaintEventArgs. + + // +private: + void DemonstrateRegionData( PaintEventArgs^ e ) + { + //Create a simple region. + System::Drawing::Region^ region1 = gcnew System::Drawing::Region( Rectangle(10,10,100,100) ); + + // Extract the region data. + System::Drawing::Drawing2D::RegionData^ region1Data = region1->GetRegionData(); + + // Create a new region using the region data. + System::Drawing::Region^ region2 = gcnew System::Drawing::Region( region1Data ); + + // Dispose of the first region. + delete region1; + + // Call ExcludeClip passing in the second region. + e->Graphics->ExcludeClip( region2 ); + + // Fill in the client rectangle. + e->Graphics->FillRectangle( Brushes::Red, this->ClientRectangle ); + delete region2; + } + // + + // The following code example demonstrates how use the Data from + // one region to set the Data for another region. This example is designed + // to be used with Windows Forms. To run this example paste + // it into a form and handle the form's Paint event + // by calling the DemonstrateRegionData2 method, passing e as PaintEventArgs. + + // +private: + void DemonstrateRegionData2( PaintEventArgs^ e ) + { + //Create a simple region. + System::Drawing::Region^ region1 = gcnew System::Drawing::Region( Rectangle(10,10,100,100) ); + + // Extract the region data. + System::Drawing::Drawing2D::RegionData^ region1Data = region1->GetRegionData(); + array^data1; + data1 = region1Data->Data; + + // Create a second region. + System::Drawing::Region^ region2 = gcnew System::Drawing::Region; + + // Get the region data for the second region. + System::Drawing::Drawing2D::RegionData^ region2Data = region2->GetRegionData(); + + // Set the Data property for the second region to the Data from the first region. + region2Data->Data = data1; + + // Construct a third region using the modified RegionData of the second region. + System::Drawing::Region^ region3 = gcnew System::Drawing::Region( region2Data ); + + // Dispose of the first and second regions. + delete region1; + delete region2; + + // Call ExcludeClip passing in the third region. + e->Graphics->ExcludeClip( region3 ); + + // Fill in the client rectangle. + e->Graphics->FillRectangle( Brushes::Red, this->ClientRectangle ); + delete region3; + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp new file mode 100644 index 00000000000..11e540192ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PensExample/CPP/form1.cpp @@ -0,0 +1,169 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + components = gcnew System::ComponentModel::Container; + this->Text = "Form1"; + } + + // The following method demonstrates the effects of setting + // the LineJoin property on a Pen object. + // This example is designed to be used with Windows Forms. + // Paste the code into a form and call the ShowLineJoin method when + // handling the form's Paint event, passing e as PaintEventArgs. + // +private: + void ShowLineJoin( PaintEventArgs^ e ) + { + // Create a new pen. + Pen^ skyBluePen = gcnew Pen( Brushes::DeepSkyBlue ); + + // Set the pen's width. + skyBluePen->Width = 8.0F; + + // Set the LineJoin property. + skyBluePen->LineJoin = System::Drawing::Drawing2D::LineJoin::Bevel; + + // Draw a rectangle. + e->Graphics->DrawRectangle( skyBluePen, Rectangle(40,40,150,200) ); + + //Dispose of the pen. + delete skyBluePen; + } + // + + // The following method demonstrates the effects of setting + // the StartCap and EndCap properties on a Pen object. + // This example is designed to be used with Windows Forms. + // Paste the code into a form and call the ShowStartAndEndCaps + // method when handling the form's Paint event, passing e + // as PaintEventArgs. + // +private: + void ShowStartAndEndCaps( PaintEventArgs^ e ) + { + // Create a new custom pen. + Pen^ redPen = gcnew Pen( Brushes::Red,6.0F ); + + // Set the StartCap property. + redPen->StartCap = System::Drawing::Drawing2D::LineCap::RoundAnchor; + + // Set the EndCap property. + redPen->EndCap = System::Drawing::Drawing2D::LineCap::ArrowAnchor; + + // Draw a line. + e->Graphics->DrawLine( redPen, 40.0F, 40.0F, 145.0F, 185.0F ); + + // Dispose of the custom pen. + delete redPen; + } + // + + // The following method demonstrates the effects of setting + // the DashCap, DashPattern and SmoothingMode properties + // of a Pen object. + // This example is designed to be used with Windows Forms. + // Paste the code into a form and call the ShowPensAndSmoothingMode + // method when handling the form's Paint event, passing e as + // PaintEventArgs. + // +private: + void ShowPensAndSmoothingMode( PaintEventArgs^ e ) + { + // Set the SmoothingMode property to smooth the line. + e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::AntiAlias; + + // Create a new Pen object. + Pen^ greenPen = gcnew Pen( Color::Green ); + + // Set the width to 6. + greenPen->Width = 6.0F; + + // Set the DashCap to round. + greenPen->DashCap = System::Drawing::Drawing2D::DashCap::Round; + + // Create a custom dash pattern. + array^temp0 = {4.0F,2.0F,1.0F,3.0F}; + greenPen->DashPattern = temp0; + + // Draw a line. + e->Graphics->DrawLine( greenPen, 20.0F, 20.0F, 100.0F, 240.0F ); + + // Change the SmoothingMode to none. + e->Graphics->SmoothingMode = System::Drawing::Drawing2D::SmoothingMode::None; + + // Draw another line. + e->Graphics->DrawLine( greenPen, 100.0F, 240.0F, 160.0F, 20.0F ); + + // Dispose of the custom pen. + delete greenPen; + } + // + + // The following method demonstrates how to use the Pens class. + // This example is designed to be used with Windows Forms. + // Paste the code into a form and call the UsePensClass method + // when handling the form's Paint event, passing e as PaintEventArgs. + // +private: + void UsePensClass( PaintEventArgs^ e ) + { + e->Graphics->DrawEllipse( Pens::SlateBlue, Rectangle(40,40,140,140) ); + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + UsePensClass( e ); + ShowPensAndSmoothingMode( e ); + ShowStartAndEndCaps( e ); + ShowLineJoin( e ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp new file mode 100644 index 00000000000..a236d196d68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.PointsAndSizes/CPP/form1.cpp @@ -0,0 +1,268 @@ + + +#using +#using +#using + +using namespace System::Drawing; +using namespace System; +using namespace System::Windows::Forms; + +// The following code example demonstrates how to override the +// OnClosed method on a class derived from Form. +// +public ref class myForm: public Form +{ +protected: + virtual void OnClosed( EventArgs^ e ) override + { + MessageBox::Show( "The form is now closing.", "Close Warning", MessageBoxButtons::OK, MessageBoxIcon::Warning ); + Form::OnClosed( e ); + } + +public: + myForm() + : Form() + {} + +}; +// + +public ref class Form1: public myForm +{ +public: + Form1() + : myForm() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + addButton->Click += gcnew EventHandler( this, &Form1::addButton_Click ); + subtractButton->Click += gcnew EventHandler( this, &Form1::subtractButton_Click ); + TruncateAndRoundSizes(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ subtractButton; + System::Windows::Forms::Button^ addButton; + System::Windows::Forms::Label ^ Label1; + System::Windows::Forms::Label ^ Label2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->subtractButton = gcnew System::Windows::Forms::Button; + this->addButton = gcnew System::Windows::Forms::Button; + this->Label1 = gcnew System::Windows::Forms::Label; + this->Label2 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + //subtractButton + // + this->subtractButton->Location = System::Drawing::Point( 192, 40 ); + this->subtractButton->Name = "subtractButton"; + this->subtractButton->TabIndex = 0; + this->subtractButton->Text = "subtractButton"; + + // + //addButton + // + this->addButton->Location = System::Drawing::Point( 192, 80 ); + this->addButton->Name = "addButton"; + this->addButton->TabIndex = 1; + this->addButton->Text = "addButton"; + + // + //Label1 + // + this->Label1->Location = System::Drawing::Point( 24, 192 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 240, 23 ); + this->Label1->TabIndex = 2; + this->Label1->Text = "Label1"; + + // + //Label2 + // + this->Label2->Location = System::Drawing::Point( 24, 224 ); + this->Label2->Name = "Label2"; + this->Label2->Size = System::Drawing::Size( 240, 23 ); + this->Label2->TabIndex = 3; + this->Label2->Text = "Label2"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label2 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->addButton ); + this->Controls->Add( this->subtractButton ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // The following code example creates points and sizes using several + // of the overloaded operators defined for these types. It also + // demonstrates how to use a SystemPen. + // This example is designed to be used with Windows Forms. Create + // a form that contains a Button named subtractButton. Paste the + // code into the form and call the CreatePointsAndSizes method + // from the form's Paint event-handling method, passing e as + // PaintEventArgs. + // + void CreatePointsAndSizes( PaintEventArgs^ e ) + { + // Create the starting point. + Point startPoint = Point(subtractButton->Size); + + // Use the addition operator to get the end point. + Point endPoint = startPoint + System::Drawing::Size( 140, 150 ); + + // Draw a line between the points. + e->Graphics->DrawLine( SystemPens::Highlight, startPoint, endPoint ); + + // Convert the starting point to a size and compare it to the + // subtractButton size. + System::Drawing::Size buttonSize = (System::Drawing::Size)startPoint; + if ( buttonSize == subtractButton->Size ) + { + e->Graphics->DrawString( "The sizes are equal.", gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), Brushes::Indigo, 10.0F, 65.0F ); + } + } + // + + // The following code example demonstrates the G,B,R, and A + // properties of a Color and the Size.op_Implicit member. + // This example is designed to be used with a Windows Form. + // Paste the code into the form and call the + // ShowPropertiesOfSlateBlue method from the form's Paint + // event-handling method, passing e as PaintEventArgs. + // + void ShowPropertiesOfSlateBlue( PaintEventArgs^ e ) + { + Color slateBlue = Color::FromName( "SlateBlue" ); + Byte g = slateBlue.G; + Byte b = slateBlue.B; + Byte r = slateBlue.R; + Byte a = slateBlue.A; + array^temp0 = {a,r,g,b}; + String^ text = String::Format( "Slate Blue has these ARGB values: Alpha:{0}, " + "red:{1}, green: {2}, blue {3}", temp0 ); + e->Graphics->DrawString( text, gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), gcnew SolidBrush( slateBlue ), RectangleF(PointF(0.0F,0.0F),this->Size) ); + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + + //CreatePointsAndSizes(e) + ShowPropertiesOfSlateBlue( e ); + } + + // The following code example demonstrates the Subtraction operator. + // The example is designed to be used with Windows Forms. + // To run the example, paste it into a form that contains a button + // named subtractionButton and associate this method with the + // button's Click event. + // + void subtractButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + subtractButton->Size = subtractButton->Size - System::Drawing::Size( 10, 10 ); + } + // + + // The following code example demonstrates the Addition operator. + // The example is designed to be used with Windows Forms. To run + // this example, paste it into a form that contains a button named + // addButton and associate this method with the button's Click event. + // + void addButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + addButton->Size = addButton->Size + System::Drawing::Size( 10, 10 ); + } + // + + // The following code example demonstrates how to use static Round + // and Truncate methods to convert a SizeF to a Size. This example is + // designed to be used with Windows Forms. To run this example paste + // it into a form that contains two Label objects named Label1 + // and Label2 and then call this method from the form's constructor. + // + void TruncateAndRoundSizes() + { + // Create a SizeF. + SizeF theSize = SizeF(75.9F,75.9F); + + // Round the Size. + System::Drawing::Size roundedSize = ::Size::Round( theSize ); + + // Truncate the Size. + System::Drawing::Size truncatedSize = ::Size::Truncate( theSize ); + + //Print out the values on two labels. + Label1->Text = String::Format( "Rounded size = {0}", roundedSize ); + Label2->Text = String::Format( "Truncated size = {0}", truncatedSize ); + } + // + + // The following code example demonstrates how to use the + // Point#ctor(int) and Size#ctor(int, int) constructors and the + // ContentAlignment enumeration. To run this example paste this code into + // a Windows Form that contains a label named Label1 and call the + // IntializeLabel1 method in the form's constructor. + // + void InitializeLabel1() + { + // Set a border. + Label1->BorderStyle = BorderStyle::FixedSingle; + + // Set the size, constructing a size from two integers. + Label1->Size = System::Drawing::Size( 100, 50 ); + + // Set the location, constructing a point from a 32-bit integer + // (using hexadecimal). + Label1->Location = Point(0x280028); + + // Set and align the text on the lower-right side of the label. + Label1->TextAlign = ContentAlignment::BottomRight; + Label1->Text = "Bottom Right Alignment"; + } + // + + void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + TruncateAndRoundSizes(); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp new file mode 100644 index 00000000000..a51a30d47b7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.RectanglesAndPoints/CPP/form1.cpp @@ -0,0 +1,275 @@ + + +#using +#using +#using + +using namespace System::Drawing::Drawing2D; +using namespace System::Drawing; +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + Button1->Click += gcnew EventHandler( this, &Form1::Button1_Click ); + DrawFirstRectangle(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 208, 16 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Button1"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // The following code example demonstrates creating a rectangle + // using the FromLTRB method. This example is designed to + // be used with a Windows Form. Paste this code into a form + // and call the CreateARectangleFromLTRB method when handling + // the form's Paint event, passing e as PaintEventArgs. + // +private: + void CreateARectangleFromLTRB( PaintEventArgs^ e ) + { + Rectangle myRectangle = Rectangle::FromLTRB( 40, 40, 140, 240 ); + e->Graphics->DrawRectangle( SystemPens::ControlText, myRectangle ); + } + // + + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ /*e*/ ) + { + //ConvertRectangleToRectangleF(e) + //RoundingAndTruncatingRectangles(e); + } + + // The following code example demonstrates the static (Shared in + // Visual Basic) Intersects method. This example should be used + // with a Windows form. Paste this code into a form + // and call this method when handling the form's Paint event, + // passing e as PaintEventArgs. + // +private: + void StaticRectangleIntersection( PaintEventArgs^ e ) + { + Rectangle rectangle1 = Rectangle(50,50,200,100); + Rectangle rectangle2 = Rectangle(70,20,100,200); + e->Graphics->DrawRectangle( Pens::Black, rectangle1 ); + e->Graphics->DrawRectangle( Pens::Red, rectangle2 ); + if ( rectangle1.IntersectsWith( rectangle2 ) ) + { + Rectangle rectangle3 = Rectangle::Intersect( rectangle1, rectangle2 ); + if ( !rectangle3.IsEmpty ) + { + e->Graphics->FillRectangle( Brushes::Green, rectangle3 ); + } + } + } + // + + // The following code example demonstrates the instance + // version of the Intersects method. This example should be used + // with a Windows form. Paste this code into a form + // and call this method when handling the form's Paint event, + // passing e as PaintEventArgs. + // +private: + void InstanceRectangleIntersection( PaintEventArgs^ e ) + { + Rectangle rectangle1 = Rectangle(50,50,200,100); + Rectangle rectangle2 = Rectangle(70,20,100,200); + e->Graphics->DrawRectangle( Pens::Black, rectangle1 ); + e->Graphics->DrawRectangle( Pens::Red, rectangle2 ); + if ( rectangle1.IntersectsWith( rectangle2 ) ) + { + rectangle1.Intersect( rectangle2 ); + if ( !rectangle1.IsEmpty ) + { + e->Graphics->FillRectangle( Brushes::Green, rectangle1 ); + } + } + } + // + + // The following code example demonstrates the Contains method + // and the SystemPens class. + // This example is designed for use with a Windows Form. Paste + // this code into a form that contains a Button named Button1, + // call DrawFirstRectangle from the form's constructor + // or Load method and associate the Button1_Click method with + // the button's Click event. + // +private: + [UIPermission(SecurityAction::Demand, Window=UIPermissionWindow::AllWindows)] + void DrawFirstRectangle() + { + Rectangle rectangle1 = Rectangle(70,70,100,150); + ControlPaint::DrawReversibleFrame( rectangle1, SystemColors::Highlight, FrameStyle::Thick ); + } + + void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Rectangle rectangle1 = Rectangle(70,70,100,150); + + // Get the bounds of the screen. + Rectangle screenRectangle = Screen::PrimaryScreen->Bounds; + + // Check to see if the rectangle is within the bounds of the screen. + if ( screenRectangle.Contains( rectangle1 ) ) + { + ControlPaint::DrawReversibleFrame( rectangle1, SystemColors::Highlight, FrameStyle::Thick ); + + // Call the Offset method to move the rectangle. + rectangle1.Offset( 20, 20 ); + + // Draw the new, offset rectangle. + ControlPaint::DrawReversibleFrame( rectangle1, SystemColors::Highlight, FrameStyle::Thick ); + } + } + // + + // The following code example demonstrates the Union method. This + // example is designed for use with a Windows Form. Paste this code + // into a form and call this method when handling the form's + // Paint event, passing e as PaintEventArgs. + // +private: + void ShowRectangleUnion( PaintEventArgs^ e ) + { + // Declare two rectangles and draw them. + Rectangle rectangle1 = Rectangle(30,40,50,100); + Rectangle rectangle2 = Rectangle(50,60,100,60); + e->Graphics->DrawRectangle( Pens::Sienna, rectangle1 ); + e->Graphics->DrawRectangle( Pens::BlueViolet, rectangle2 ); + + // Declare a third rectangle as a union of the first two. + Rectangle rectangle3 = Rectangle::Union( rectangle1, rectangle2 ); + + // Fill in the third rectangle in a semi-transparent color. + Color transparentColor = Color::FromArgb( 40, 135, 135, 255 ); + e->Graphics->FillRectangle( gcnew SolidBrush( transparentColor ), rectangle3 ); + } + // + + // The following code example demonstrates how to use the Round + // and Truncate methods. + // This example is designed for use with a Windows Form. Paste this code + // into a form and call the RoundingAndTruncatingRectangles method + // when handling the form's Paint event, passing e as PaintEventArgs. + // +private: + void RoundingAndTruncatingRectangles( PaintEventArgs^ e ) + { + // Construct a new RectangleF. + RectangleF myRectangleF = RectangleF(30.6F,30.7F,40.8F,100.9F); + + // Call the Round method. + Rectangle roundedRectangle = Rectangle::Round( myRectangleF ); + + // Draw the rounded rectangle in red. + Pen^ redPen = gcnew Pen( Color::Red,4.0f ); + e->Graphics->DrawRectangle( redPen, roundedRectangle ); + + // Call the Truncate method. + Rectangle truncatedRectangle = Rectangle::Truncate( myRectangleF ); + + // Draw the truncated rectangle in white. + Pen^ whitePen = gcnew Pen( Color::White,4.0f ); + e->Graphics->DrawRectangle( whitePen, truncatedRectangle ); + + // Dispose of the custom pens. + delete redPen; + delete whitePen; + } + // + + // The following code example demonstrates how to convert + // a Rectangle object to a RectangleF using the Implicit operator. + // This example is designed for use with a Windows Form. Paste + // this code into a form and call the ConvertRectangleToRectangleF + // method when handling the form's Paint event, passing e as + // PaintEventArgs. + // +private: + void ConvertRectangleToRectangleF( PaintEventArgs^ e ) + { + // Create a rectangle. + Rectangle rectangle1 = Rectangle(30,40,50,100); + + // Convert it to a RectangleF. + RectangleF convertedRectangle = rectangle1; + + // Create a new RectangleF. + RectangleF rectangle2 = RectangleF(PointF(30.0F,40.0F),SizeF(50.0F,100.0F)); + + // Create a custom, partially transparent brush. + SolidBrush^ redBrush = gcnew SolidBrush( Color::FromArgb( 40, Color::Red ) ); + + // Compare the converted rectangle with the new one. If they + // are equal draw and fill the rectangles on the form. + if ( convertedRectangle == rectangle2 ) + { + e->Graphics->FillRectangle( redBrush, rectangle2 ); + } + + // Dispose of the custom brush. + delete redBrush; + } +}; +// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp new file mode 100644 index 00000000000..08655fa9a42 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Drawing.ToolBoxBitmapExamples/cpp/usercontrol1.cpp @@ -0,0 +1,270 @@ +#using +#using +#using +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::ComponentModel; + +public ref class Form1 : public Form +{ +private: + Button^ button1; +public: + Form1() + { + button1 = gcnew Button(); + this->Controls->Add(button1); + } + + // +private: + static Image^ GetImageOfCustomControl(Control^ userControl) + { + Image^ controlImage = nullptr; + AttributeCollection^ attrCol = + TypeDescriptor::GetAttributes(userControl); + ToolboxBitmapAttribute^ imageAttr = (ToolboxBitmapAttribute^) + attrCol[ToolboxBitmapAttribute::typeid]; + if (imageAttr != nullptr) + { + controlImage = imageAttr->GetImage(userControl); + } + + return controlImage; + } + // +}; + +// The following code example demonstrates how to use the +// ToolBoxBitmapAttribute#ctor(string) costructor to set stop.bmp +// as the toolbox icon for the StopSignControl. This example assumes +// the existence of a 16-by-16-pixel bitmap named stop.bmp at c:\. +// +[ToolboxBitmap("c:\\stop.bmp")] +public ref class StopSignControl: + public System::Windows::Forms::UserControl +{ +private: + Label^ label1; +private: + Button^ button1; + +public: + StopSignControl() : UserControl() + { + this->label1 = gcnew System::Windows::Forms::Label(); + this->button1 = gcnew System::Windows::Forms::Button(); + + this->label1->Font = gcnew System::Drawing::Font( + "Microsoft Sans Serif", 12.0F, + System::Drawing::FontStyle::Regular, + System::Drawing::GraphicsUnit::Point, ((Byte) 0)); + + this->label1->ForeColor = System::Drawing::Color::Red; + this->label1->Location = System::Drawing::Point(24, 56); + this->label1->Name = "Label1"; + this->label1->TabIndex = 0; + this->label1->Text = "Stop!"; + this->label1->TextAlign = + System::Drawing::ContentAlignment::MiddleCenter; + + this->button1->Enabled = false; + this->button1->Location = System::Drawing::Point(56, 88); + this->button1->Name = "Button1"; + this->button1->Size = System::Drawing::Size(40, 32); + this->button1->TabIndex = 1; + this->button1->Text = "stop"; + + this->Controls->Add(this->button1); + this->Controls->Add(this->label1); + this->Name = "StopSignControl"; + + this->MouseEnter += + gcnew EventHandler(this, + &StopSignControl::StopSignControl_MouseEnter); + this->MouseLeave += + gcnew EventHandler(this, + &StopSignControl::StopSignControl_MouseLeave); + + } + +private: + void StopSignControl_MouseEnter(Object^ sender, + EventArgs^ e) + { + + label1->Text = label1->Text->ToUpper(); + label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, + 14.0F, FontStyle::Bold); + button1->Enabled = true; + } + +private: + void StopSignControl_MouseLeave(Object^ sender, + EventArgs^ e) + { + + label1->Text = label1->Text->ToLower(); + label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, + 12.0F, FontStyle::Regular); + button1->Enabled = false; + } + +}; +// + +// The following code example demonstrates how to use the +// ToolBoxBitmapAttribute#ctor(type, string) constructor to set +// StopSignControl2.bmp as a toolbox icon for the StopSignControl. +// This example assumes the existence of a 16-by-16-pixel bitmap +// named StopSignControl2.bmp with its BuildAction property set to +// EmbeddedResource. +// +[ToolboxBitmap(StopSignControl2::typeid, "StopSignControl2.bmp")] +public ref class StopSignControl2: + public System::Windows::Forms::UserControl +{ +private: + Label^ label1; +private: + Button^ button1; + +public: + StopSignControl2() : UserControl() + { + this->label1 = gcnew System::Windows::Forms::Label(); + this->button1 = gcnew System::Windows::Forms::Button(); + + this->label1->Font = gcnew System::Drawing::Font( + "Microsoft Sans Serif", 12.0F, + System::Drawing::FontStyle::Regular, + System::Drawing::GraphicsUnit::Point, ((Byte) 0)); + this->label1->ForeColor = System::Drawing::Color::Red; + this->label1->Location = System::Drawing::Point(24, 56); + this->label1->Name = "Label1"; + this->label1->TabIndex = 0; + this->label1->Text = "Stop!"; + this->label1->TextAlign = + System::Drawing::ContentAlignment::MiddleCenter; + this->button1->Enabled = false; + this->button1->Location = System::Drawing::Point(56, 88); + this->button1->Name = "Button1"; + this->button1->Size = System::Drawing::Size(40, 32); + this->button1->TabIndex = 1; + this->button1->Text = "stop"; + this->Controls->Add(this->button1); + this->Controls->Add(this->label1); + this->Name = "StopSignControl"; + + this->MouseEnter += gcnew EventHandler(this, + &StopSignControl2::StopSignControl_MouseEnter); + this->MouseLeave += gcnew EventHandler(this, + &StopSignControl2::StopSignControl_MouseLeave); + + } + +private: + void StopSignControl_MouseEnter(Object^ sender, EventArgs^ e) + { + label1->Text = label1->Text->ToUpper(); + label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, + 14.0F, FontStyle::Bold); + button1->Enabled = true; + } + +private: + void StopSignControl_MouseLeave(Object^ sender, EventArgs^ e) + { + + label1->Text = label1->Text->ToLower(); + label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, + 12.0F, FontStyle::Regular); + button1->Enabled = false; + } + +}; +// + +// The following code example demonstrates how to use the +// ToolBoxBitmapAttribute#ctor(type) constructor to set the icon of +// the button control to the toolbox icon for a UserControl named +// StopSignControl3. +// +[ToolboxBitmap(Button::typeid)] +public ref class StopSignControl3: + public System::Windows::Forms::UserControl +{ +private: + Label^ label1; +private: + Button^ button1; + +public: + StopSignControl3() : UserControl() + { + this->label1 = gcnew System::Windows::Forms::Label(); + this->button1 = gcnew System::Windows::Forms::Button(); + + this->label1->Font = gcnew System::Drawing::Font( + "Microsoft Sans Serif", 12.0F, + System::Drawing::FontStyle::Regular, + System::Drawing::GraphicsUnit::Point, + ((Byte) 0)); + this->label1->ForeColor = System::Drawing::Color::Red; + this->label1->Location = System::Drawing::Point(24, 56); + this->label1->Name = "Label1"; + this->label1->TabIndex = 0; + this->label1->Text = "Stop!"; + this->label1->TextAlign = + System::Drawing::ContentAlignment::MiddleCenter; + + this->button1->Enabled = false; + this->button1->Location = System::Drawing::Point(56, 88); + this->button1->Name = "Button1"; + this->button1->Size = System::Drawing::Size(40, 32); + this->button1->TabIndex = 1; + this->button1->Text = "stop"; + this->Controls->Add(this->button1); + this->Controls->Add(this->label1); + this->Name = "StopSignControl"; + + this->MouseEnter += gcnew EventHandler(this, + &StopSignControl3::StopSignControl_MouseEnter); + this->MouseLeave += gcnew EventHandler(this, + &StopSignControl3::StopSignControl_MouseLeave); + } + +private: + void StopSignControl_MouseEnter(Object^ sender, EventArgs^ e) + { + label1->Text = label1->Text->ToUpper(); + label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, + 14.0F, FontStyle::Bold); + button1->Enabled = true; + } + +private: + void StopSignControl_MouseLeave(Object^ sender, EventArgs^ e) + { + label1->Text = label1->Text->ToLower(); + label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily, + 12.0F, FontStyle::Regular); + button1->Enabled = false; + } +}; +// + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew Form1()); +} + + + + + + + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp new file mode 100644 index 00000000000..051cef1f579 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.AccessibleObject/CPP/chartcontrol.cpp @@ -0,0 +1,599 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// Declare a chart control that demonstrates accessibility in Windows Forms. +public ref class ChartControl: public System::Windows::Forms::UserControl +{ +public: + ref class ChartControlAccessibleObject; + + // forward declaration + // Inner Class that represents a legend for a curve in the chart. + ref class CurveLegend + { + + // + // Inner class CurveLegendAccessibleObject represents accessible information + // associated with the CurveLegend object. + public: + ref class CurveLegendAccessibleObject: public AccessibleObject + { + private: + CurveLegend^ curveLegend; + + public: + CurveLegendAccessibleObject( CurveLegend^ curveLegend ) + : AccessibleObject() + { + this->curveLegend = curveLegend; + } + + + private: + + property ChartControlAccessibleObject^ ChartControl + { + + // Private property that helps get the reference to the parent ChartControl. + ChartControlAccessibleObject^ get() + { + return dynamic_cast(Parent); + } + + } + + internal: + + property int ID + { + + // Internal helper function that returns the ID for this CurveLegend. + int get() + { + for ( int i = 0; i < ChartControl->GetChildCount(); i++ ) + { + if ( ChartControl->GetChild( i ) == this ) + { + return i; + } + + } + return -1; + } + + } + + public: + + property Rectangle Bounds + { + + // Gets the Bounds for the CurveLegend. This is used by accessibility programs. + virtual Rectangle get() override + { + + // The bounds is in screen coordinates. + Point loc = curveLegend->Location; + return Rectangle(curveLegend->chart->PointToScreen( loc ),curveLegend->Size); + } + + } + + property String^ Name + { + + // Gets or sets the Name for the CurveLegend. This is used by accessibility programs. + virtual String^ get() override + { + return curveLegend->Name; + } + + virtual void set( String^ value ) override + { + curveLegend->Name = value; + } + + } + + property AccessibleObject^ Parent + { + + // Gets the Curve Legend Parent's Accessible object. + // This is used by accessibility programs. + virtual AccessibleObject^ get() override + { + return curveLegend->chart->AccessibilityObject; + } + + } + + property System::Windows::Forms::AccessibleRole Role + { + + // Gets the role for the CurveLegend. This is used by accessibility programs. + virtual System::Windows::Forms::AccessibleRole get() override + { + return ::AccessibleRole::StaticText; + } + + } + + property AccessibleStates State + { + + // Gets the state based on the selection for the CurveLegend. + // This is used by accessibility programs. + virtual AccessibleStates get() override + { + AccessibleStates state = AccessibleStates::Selectable; + if ( curveLegend->Selected ) + { + state = static_cast(state | AccessibleStates::Selected); + } + + return state; + } + + } + + // Navigates through siblings of this CurveLegend. This is used by accessibility programs. + virtual AccessibleObject^ Navigate( AccessibleNavigation navdir ) override + { + + // Uses the internal NavigateFromChild helper function that exists + // on ChartControlAccessibleObject. + return ChartControl->NavigateFromChild( this, navdir ); + } + + + // Selects or unselects this CurveLegend. This is used by accessibility programs. + virtual void Select( AccessibleSelection selection ) override + { + + // Uses the internal SelectChild helper function that exists + // on ChartControlAccessibleObject. + ChartControl->SelectChild( this, selection ); + } + + }; + // + + + private: + + // class CurveLgendAccessibleObject + String^ name; + ChartControl^ chart; + CurveLegendAccessibleObject^ accObj; + bool selected; + Point location; + + public: + CurveLegend( ChartControl^ chart, String^ name ) + { + this->chart = chart; + this->name = name; + selected = true; + } + + + property AccessibleObject^ AccessibilityObject + { + + // Gets the accessibility object for the curve legend. + AccessibleObject^ get() + { + if ( accObj == nullptr ) + { + accObj = gcnew CurveLegendAccessibleObject( this ); + } + + return accObj; + } + + } + + property Rectangle Bounds + { + + // Gets the bounds for the curve legend. + Rectangle get() + { + return Rectangle(Location,Size); + } + + } + + property Point Location + { + + // + // Gets or sets the location for the curve legend. + Point get() + { + return location; + } + + void set( Point value ) + { + location = value; + chart->Invalidate(); + + // Notifies the chart of the location change. This is used for + // the accessibility information. AccessibleEvents::LocationChange + // tells the chart the reason for the notification. + chart->AccessibilityNotifyClients( AccessibleEvents::LocationChange, (dynamic_cast(AccessibilityObject))->ID ); + } + + } + + property String^ Name + { + + // Gets or sets the Name for the curve legend. + String^ get() + { + return name; + } + + void set( String^ value ) + { + if ( name != value ) + { + name = value; + chart->Invalidate(); + + // Notifies the chart of the name change. This is used for + // the accessibility information. AccessibleEvents::NameChange + // tells the chart the reason for the notification. + chart->AccessibilityNotifyClients( AccessibleEvents::NameChange, (dynamic_cast(AccessibilityObject))->ID ); + } + } + + } + + property bool Selected + { + + // Gets or sets the Selected state for the curve legend. + bool get() + { + return selected; + } + + void set( bool value ) + { + if ( selected != value ) + { + selected = value; + chart->Invalidate(); + + // Notifies the chart of the selection value change. This is used for + // the accessibility information. The AccessibleEvents value depends upon + // if the selection is true (AccessibleEvents::SelectionAdd) or + // false (AccessibleEvents::SelectionRemove). + chart->AccessibilityNotifyClients( selected ? AccessibleEvents::SelectionAdd : AccessibleEvents::SelectionRemove, (dynamic_cast(AccessibilityObject))->ID ); + } + } + // + + } + + property System::Drawing::Size Size + { + + // Gets the Size for the curve legend. + System::Drawing::Size get() + { + int legendHeight = chart->Font->Height + 4; + Graphics^ g = chart->CreateGraphics(); + int legendWidth = (int)g->MeasureString( Name, chart->Font ).Width + 4; + return System::Drawing::Size( legendWidth, legendHeight ); + } + + } + + }; + + +private: + + // class CurveLegend + CurveLegend^ legend1; + CurveLegend^ legend2; + +public: + ChartControl() + { + + // The ChartControl draws the chart in the OnPaint . + SetStyle( ControlStyles::ResizeRedraw, true ); + SetStyle( ControlStyles::DoubleBuffer, true ); + SetStyle( ControlStyles::AllPaintingInWmPaint, true ); + this->BackColor = System::Drawing::Color::White; + this->Name = "ChartControl"; + this->Click += gcnew System::EventHandler( this, &ChartControl::ChartControl_Click ); + this->QueryAccessibilityHelp += gcnew System::Windows::Forms::QueryAccessibilityHelpEventHandler( this, &ChartControl::ChartControl_QueryAccessibilityHelp ); + + // The CurveLengend is not Control-based, it just + // represents the parts of the legend. + legend1 = gcnew CurveLegend( this,"A" ); + legend1->Location = Point(20,30); + legend2 = gcnew CurveLegend( this,"B" ); + legend2->Location = Point(20,50); + } + + + + // +protected: + // Overridden to return the custom AccessibleObject + // for the entire chart. + virtual AccessibleObject^ CreateAccessibilityInstance() override + { + return gcnew ChartControlAccessibleObject( this ); + } + // + + virtual void OnPaint( PaintEventArgs^ e ) override + { + + // The ChartControl draws the chart in the OnPaint . + System::Windows::Forms::UserControl::OnPaint( e ); + Rectangle bounds = this->ClientRectangle; + int border = 5; + + // Draws the legends first. + StringFormat^ format = gcnew StringFormat; + format->Alignment = StringAlignment::Center; + format->LineAlignment = StringAlignment::Center; + if ( legend1 != nullptr ) + { + if ( legend1->Selected ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Blue ), legend1->Bounds ); + } + else + { + e->Graphics->DrawRectangle( Pens::Blue, legend1->Bounds ); + } + + e->Graphics->DrawString( legend1->Name, this->Font, Brushes::Black, legend1->Bounds, format ); + } + + if ( legend2 != nullptr ) + { + if ( legend2->Selected ) + { + e->Graphics->FillRectangle( gcnew SolidBrush( Color::Red ), legend2->Bounds ); + } + else + { + e->Graphics->DrawRectangle( Pens::Red, legend2->Bounds ); + } + + e->Graphics->DrawString( legend2->Name, this->Font, Brushes::Black, legend2->Bounds, format ); + } + + + // Charts out the actual curves that represent data in the Chart. + bounds.Inflate( -border, -border ); + array^ temp1 = {Point(bounds.Left,bounds.Bottom),Point(bounds.Left + bounds.Width / 3,bounds.Top + bounds.Height / 5),Point(bounds.Right - bounds.Width / 3,(bounds.Top + bounds.Bottom) / 2),Point(bounds.Right,bounds.Top)}; + array^curve1 = temp1; + array^ temp2 = {Point(bounds.Left,bounds.Bottom - bounds.Height / 3),Point(bounds.Left + bounds.Width / 3,bounds.Top + bounds.Height / 5),Point(bounds.Right - bounds.Width / 3,(bounds.Top + bounds.Bottom) / 2),Point(bounds.Right,bounds.Top + bounds.Height / 2)}; + array^curve2 = temp2; + + // Draws the actual curve only if it is selected. + if ( legend1->Selected ) + e->Graphics->DrawCurve( Pens::Blue, curve1 ); + + if ( legend2->Selected ) + e->Graphics->DrawCurve( Pens::Red, curve2 ); + + e->Graphics->DrawRectangle( Pens::Blue, bounds ); + } + + // + // Handles the QueryAccessibilityHelp event. + void ChartControl_QueryAccessibilityHelp( Object^ /*sender*/, System::Windows::Forms::QueryAccessibilityHelpEventArgs^ e ) + { + e->HelpString = "Displays chart data"; + } + // + + // Handles the Click event for the chart. + // Toggles the selection of whatever legend was clicked on + void ChartControl_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Point pt = this->PointToClient( Control::MousePosition ); + if ( legend1->Bounds.Contains( pt ) ) + { + legend1->Selected = !legend1->Selected; + } + else + if ( legend2->Bounds.Contains( pt ) ) + { + legend2->Selected = !legend2->Selected; + } + } + + +public: + + property array^ Legends + { + + // Gets an array of CurveLengends used in the Chart. + array^ get() + { + array^temp3 = {legend1,legend2}; + return temp3; + } + + } + + // + // Inner class ChartControlAccessibleObject represents accessible information associated with the ChartControl. + // The ChartControlAccessibleObject is returned in the ChartControl::CreateAccessibilityInstance . + ref class ChartControlAccessibleObject: public ControlAccessibleObject + { + private: + ChartControl^ chartControl; + + public: + ChartControlAccessibleObject( ChartControl^ ctrl ) + : ControlAccessibleObject( ctrl ) + { + chartControl = ctrl; + } + + + property System::Windows::Forms::AccessibleRole Role + { + + // Gets the role for the Chart. This is used by accessibility programs. + virtual System::Windows::Forms::AccessibleRole get() override + { + return ::AccessibleRole::Chart; + } + + } + + property AccessibleStates State + { + + // Gets the state for the Chart. This is used by accessibility programs. + virtual AccessibleStates get() override + { + return AccessibleStates::ReadOnly; + } + + } + + // The CurveLegend objects are "child" controls in terms of accessibility so + // return the number of ChartLengend objects. + virtual int GetChildCount() override + { + return chartControl->Legends->Length; + } + + + // Gets the Accessibility object of the child CurveLegend idetified by index. + virtual AccessibleObject^ GetChild( int index ) override + { + if ( index >= 0 && index < chartControl->Legends->Length ) + { + return chartControl->Legends[ index ]->AccessibilityObject; + } + + return nullptr; + } + + + internal: + + // Helper function that is used by the CurveLegend's accessibility object + // to navigate between sibiling controls. Specifically, this function is used in + // the CurveLegend::CurveLegendAccessibleObject.Navigate function. + AccessibleObject^ NavigateFromChild( CurveLegend::CurveLegendAccessibleObject^ child, AccessibleNavigation navdir ) + { + switch ( navdir ) + { + case AccessibleNavigation::Down: + case AccessibleNavigation::Next: + return GetChild( child->ID + 1 ); + + case AccessibleNavigation::Up: + case AccessibleNavigation::Previous: + return GetChild( child->ID - 1 ); + } + return nullptr; + } + + + // Helper function that is used by the CurveLegend's accessibility object + // to select a specific CurveLegend control. Specifically, this function is used + // in the CurveLegend::CurveLegendAccessibleObject.Select function. + void SelectChild( CurveLegend::CurveLegendAccessibleObject^ child, AccessibleSelection selection ) + { + int childID = child->ID; + + // Determine which selection action should occur, based on the + // AccessibleSelection value. + if ( (selection & AccessibleSelection::TakeSelection) != (AccessibleSelection)0 ) + { + for ( int i = 0; i < chartControl->Legends->Length; i++ ) + { + if ( i == childID ) + { + chartControl->Legends[ i ]->Selected = true; + } + else + { + chartControl->Legends[ i ]->Selected = false; + } + + } + + // AccessibleSelection->AddSelection means that the CurveLegend will be selected. + if ( (selection & AccessibleSelection::AddSelection) != (AccessibleSelection)0 ) + { + chartControl->Legends[ childID ]->Selected = true; + } + + // AccessibleSelection->AddSelection means that the CurveLegend will be unselected. + if ( (selection & AccessibleSelection::RemoveSelection) != (AccessibleSelection)0 ) + { + chartControl->Legends[ childID ]->Selected = false; + } + } + } + + }; + + // class ChartControlAccessibleObject + // +}; + + +// class ChartControl +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + // Test out the Chart Control. + ChartControl^ chart1; + +public: + Form1() + { + + // Create a chart control and add it to the form. + this->chart1 = gcnew ChartControl; + this->ClientSize = System::Drawing::Size( 920, 566 ); + this->chart1->Location = System::Drawing::Point( 47, 16 ); + this->chart1->Size = System::Drawing::Size( 600, 400 ); + this->Controls->Add( this->chart1 ); + } + +}; + + +// class Form1 + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp new file mode 100644 index 00000000000..a274b44ccbb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Application.EnableVisualStyles/CPP/form1.cpp @@ -0,0 +1,46 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace VStyles +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + + public: + Form1() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button1->Location = System::Drawing::Point( 24, 16 ); + this->button1->Size = System::Drawing::Size( 120, 100 ); + this->button1->FlatStyle = FlatStyle::System; + this->button1->Text = "I am themed."; + + // Sets up how the form should be displayed and adds the controls to the form. + this->ClientSize = System::Drawing::Size( 300, 286 ); + this->Controls->Add( this->button1 ); + this->Text = "Application::EnableVisualStyles Example"; + } + + }; + +} + + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew VStyles::Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..29d8e5d2e0e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ButtonRenderer/cpp/form1.cpp @@ -0,0 +1,201 @@ +// This entire sample can go in the ButtonRenderer overview. +// - Snippet2 can be excerpted in ButtonRenderer.DrawBackground overload +// and specific ButtonRenderer.DrawBackground that it uses. +// - Snippet4 can be linked to in ButtonRenderer.DrawParentBackground +// - Snippet2 could be excerpted in the VisualStyles.PushButtonState enum, +// if necessary. + +// The sample defines a simple custom Control that uses ButtonRenderer to +// simulate a real Button control. When clicked, it draws a smaller button +// and uses DrawParentBackground to erase the remainder of the unpressed +// button. + +// Issue: to show using DrawParentBackground, I'm currently setting the +// BackColor of the custom control to something other than the parent form. +// There might be a better way of demonstrating this that makes more sense +// from a usability standpoint... + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace ButtonRendererSample +{ + public ref class CustomButton : public Control + { + private: + Rectangle clickRectangleValue; + + private: + PushButtonState state; + + public: + CustomButton() + { + __super::Control(); + this->Size = System::Drawing::Size(100, 40); + this->Location = Point(50, 50); + this->Font = SystemFonts::IconTitleFont; + this->Text = "Click here"; + clickRectangleValue = Rectangle(); + state = PushButtonState::Normal; + } + + // Define the bounds of the smaller pressed button. + public: + property Rectangle ClickRectangle + { + Rectangle get() + { + clickRectangleValue.X = ClientRectangle.X + + (int)(.2 * ClientRectangle.Width); + clickRectangleValue.Y = ClientRectangle.Y + + (int)(.2 * ClientRectangle.Height); + clickRectangleValue.Width = ClientRectangle.Width - + (int)(.4 * ClientRectangle.Width); + clickRectangleValue.Height = ClientRectangle.Height - + (int)(.4 * ClientRectangle.Height); + + return clickRectangleValue; + } + } + + // + // + // Draw the large or small button, depending on the current state. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + // Draw the smaller pressed button image + if (state == PushButtonState::Pressed) + { + // Set the background color to the parent if visual styles + // are disabled, because DrawParentBackground will only paint + // over the control background if visual styles are enabled. + if (Application::RenderWithVisualStyles) + { + this->BackColor = Color::Azure; + } + else + { + this->BackColor = this->Parent->BackColor; + } + + + // If you comment out the call to DrawParentBackground, + // the background of the control will still be visible + // outside the pressed button, if visual styles are enabled. + ButtonRenderer::DrawParentBackground(e->Graphics, + ClientRectangle, this); + ButtonRenderer::DrawButton(e->Graphics, ClickRectangle, + this->Text, this->Font, true, state); + } + + // Draw the bigger unpressed button image. + else + { + ButtonRenderer::DrawButton(e->Graphics, ClientRectangle, + this->Text, this->Font, false, state); + } + } + // + + // Draw the smaller pressed button image. + protected: + virtual void OnMouseDown(MouseEventArgs^ e) override + { + __super::OnMouseDown(e); + this->Text = "Clicked!"; + state = PushButtonState::Pressed; + Invalidate(); + } + + // Draw the button in the hot state. + protected: + virtual void OnMouseEnter(EventArgs^ e) override + { + __super::OnMouseEnter(e); + this->Text = "Click here"; + state = PushButtonState::Hot; + Invalidate(); + } + + // Draw the button in the unpressed state. + protected: + virtual void OnMouseLeave(EventArgs^ e) override + { + __super::OnMouseLeave(e); + this->Text = "Click here"; + state = PushButtonState::Normal; + Invalidate(); + } + // + + // Draw the button hot if the mouse is released on the button. + protected: + virtual void OnMouseUp(MouseEventArgs^ e) override + { + __super::OnMouseUp(e); + OnMouseEnter(e); + } + + // Detect when the cursor leaves the button area while + // it is pressed. + protected: + virtual void OnMouseMove(MouseEventArgs^ e) override + { + __super::OnMouseMove(e); + + // Detect when the left mouse button is down and + // the cursor has left the pressed button area. + if ((e->Button & ::MouseButtons::Left) == ::MouseButtons::Left && + !ClientRectangle.Contains(e->Location) && + state == PushButtonState::Pressed) + { + OnMouseLeave(e); + } + } + }; + + ref class Form1 : public Form + { + public: + Form1() + { + __super::Form(); + CustomButton^ Button1 = gcnew CustomButton(); + Controls->Add(Button1); + + if (Application::RenderWithVisualStyles) + { + this->Text = "Visual Styles Enabled"; + } + else + { + this->Text = "Visual Styles Disabled"; + } + } + }; +} + +using namespace ButtonRendererSample; + +[STAThread] +int main() +{ + // If you do not call EnableVisualStyles below, then + // ButtonRenderer automatically detects this and draws + // the button without visual styles. + Application::EnableVisualStyles(); + Application::Run(gcnew Form1()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..3875bc3cd1b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.CheckBoxRenderer/cpp/form1.cpp @@ -0,0 +1,155 @@ +// This sample can go in CheckBoxRenderer class overview. +// - Snippet2 can go in GetGlyphSize +// - Snippet4 can go in DrawCheckBox +// - Snippet4 can also go in the VisualStyles.CheckBoxState enum, if necessary. + +// The sample defines a simple custom Control that uses CheckBoxRenderer to +// simulate a CheckBox control. + +// Might want to think of a better, more realistic/solution-oriented example. + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace CheckBoxRendererSample +{ + ref class CustomCheckBox : Control + { + private: + Rectangle textRectangleValue; + Point clickedLocationValue; + bool clicked; + CheckBoxState state; + + public : + CustomCheckBox() : Control() + { + this->textRectangleValue = Rectangle(); + this->clickedLocationValue = Point(); + this->clicked = false; + this->state = CheckBoxState::UncheckedNormal; + this->Location = Point(50, 50); + this->Size = System::Drawing::Size(100, 20); + this->Text = "Click here"; + this->Font = SystemFonts::IconTitleFont; + } + + // + // Calculate the text bounds, exluding the check box. + Rectangle getTextRectangle() + { + Graphics ^g = this->CreateGraphics(); + textRectangleValue.X = ClientRectangle.X + + CheckBoxRenderer::GetGlyphSize(g, + CheckBoxState::UncheckedNormal).Width; + textRectangleValue.Y = ClientRectangle.Y; + textRectangleValue.Width = ClientRectangle.Width - + CheckBoxRenderer::GetGlyphSize(g, + CheckBoxState::UncheckedNormal).Width; + textRectangleValue.Height = ClientRectangle.Height; + + delete g; + return textRectangleValue; + } + // + +protected: + // + // Draw the check box in the current state. + virtual void OnPaint(PaintEventArgs ^e) override + { + Control::OnPaint(e); + + CheckBoxRenderer::DrawCheckBox(e->Graphics, + ClientRectangle.Location, this->getTextRectangle(), this->Text, + this->Font, TextFormatFlags::HorizontalCenter, + clicked, state); + } + + + // Draw the check box in the checked or unchecked state, alternately. + virtual void OnMouseDown(MouseEventArgs ^e) override + { + Control::OnMouseDown(e); + + if (!clicked) + { + clicked = true; + this->Text = "Clicked!"; + state = CheckBoxState::CheckedPressed; + Invalidate(); + } + else + { + clicked = false; + this->Text = "Click here"; + state = CheckBoxState::UncheckedNormal; + Invalidate(); + } + } + // + + // Draw the check box in the hot state. + virtual void OnMouseHover(EventArgs ^e) override + { + Control::OnMouseHover(e); + state = clicked ? CheckBoxState::CheckedHot : + CheckBoxState::UncheckedHot; + Invalidate(); + } + + // Draw the check box in the hot state. + virtual void OnMouseUp(MouseEventArgs ^e) override + { + Control::OnMouseUp(e); + this->OnMouseHover(e); + } + + // Draw the check box in the unpressed state. + virtual void OnMouseLeave(EventArgs ^e) override + { + Control::OnMouseLeave(e); + state = clicked ? CheckBoxState::CheckedNormal : + CheckBoxState::UncheckedNormal; + Invalidate(); + } + }; + + ref class Form1: public Form + { + public: + Form1() : Form() + { + CustomCheckBox ^CheckBox1 = gcnew CustomCheckBox(); + Controls->Add(CheckBox1); + + if (Application::RenderWithVisualStyles) + { + this->Text = "Visual Styles Enabled"; + } + else + { + this->Text = "Visual Styles Disabled"; + } + } + }; +} + + +[STAThread] +int main() +{ + // If you do not call EnableVisualStyles below, then + // CheckBoxRenderer.DrawCheckBox automatically detects + // this and draws the check box without visual styles. + Application::EnableVisualStyles(); + Application::Run(gcnew CheckBoxRendererSample::Form1()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp new file mode 100644 index 00000000000..2944fb65ced --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialog CustomColors Property Example/CPP/form1.cpp @@ -0,0 +1,166 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::IO; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace WindowsApplication1 +{ + + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 144, 72 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + protected: + + /// + /// The main entry point for the application. + /// + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // + System::Windows::Forms::ColorDialog^ MyDialog = gcnew ColorDialog; + + // Allows the user to select or edit a custom color. + MyDialog->AllowFullOpen = true; + + // Assigns an array of custom colors to the CustomColors property + array^temp0 = {6916092,15195440,16107657,1836924,3758726,12566463,7526079,7405793,6945974,241502,2296476,5130294,3102017,7324121,14993507,11730944}; + MyDialog->CustomColors = temp0; + + // Allows the user to get help. (The default is false.) + MyDialog->ShowHelp = true; + + // Sets the initial color select to the current text color, + // so that if the user cancels out, the original color is restored. + MyDialog->Color = this->BackColor; + MyDialog->ShowDialog(); + this->BackColor = MyDialog->Color; + // + + // Print the custom colors if the user has changed them. + PrintCustomColors( MyDialog->CustomColors ); + } + + private: + void PrintCustomColors( array^clrs ) + { + TextWriter^ writer = gcnew StreamWriter( "colors.txt" ); + { + IEnumerator^ myEnum = clrs->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + int i = safe_cast(myEnum->Current); + writer->WriteLine( i ); + } + } + writer->Close(); + } + + // private: + // int AddCustomColors() __gc[] + // { + // return new int[] {6916092, + // 15195440, + // 16107657, + // 1836924, + // 3758726, + // 12566463, + // 7526079, + // 7405793, + // 6945974, + // 241502, + // 2296476, + // 5130294, + // 3102017, + // 7324121, + // 14993507, + // 11730944, + // }; + // } + }; +} + + +[STAThread] +int main() +{ + Application::Run( gcnew WindowsApplication1::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp new file mode 100644 index 00000000000..3ef7675d846 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ColorDialogHelp/CPP/form1.cpp @@ -0,0 +1,100 @@ +// This example demonstrates handling the use of a ColorDialog object. +// The ColorDialog object does not allow the user to set a custom color +// but it allows the full set of basic colors to be displayed. By setting the +// SolidColorOnly property to false, it allows the display of colors that +// are combinations of other colors on systems with 256 or less colors. +// The dialog also shows the handling of a HelpRequest event. + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializeComponent(); + InitializeColorDialog(); + } + +internal: + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::ColorDialog^ ColorDialog1; + +private: + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + this->Button1->Location = System::Drawing::Point( 24, 16 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 88, 56 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click to change the color of the textbox"; + this->TextBox1->Location = System::Drawing::Point( 24, 88 ); + this->TextBox1->Multiline = true; + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 96, 96 ); + this->TextBox1->TabIndex = 1; + this->TextBox1->Text = "Here is some text"; + this->ClientSize = System::Drawing::Size( 152, 266 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // This method initializes ColorDialog1 to allow any colors, + // and combination colors on systems with 256 colors or less, + // but will not allow the user to set custom colors. The + // dialog will contain the help button. + void InitializeColorDialog() + { + this->ColorDialog1 = gcnew System::Windows::Forms::ColorDialog; + this->ColorDialog1->AllowFullOpen = false; + this->ColorDialog1->AnyColor = true; + this->ColorDialog1->SolidColorOnly = false; + this->ColorDialog1->ShowHelp = true; + + // Associate the event-handling method with + // the HelpRequest event. + this->ColorDialog1->HelpRequest += + gcnew System::EventHandler( this, &Form1::ColorDialog1_HelpRequest ); + } + + // This method opens the dialog and checks the DialogResult value. + // If the result is OK, the text box's background color will be changed + // to the user-selected color. + void Button1_Click( System::Object^ sender, System::EventArgs^ e ) + { + ::DialogResult result = ColorDialog1->ShowDialog(); + if ( result == ::DialogResult::OK ) + { + TextBox1->BackColor = ColorDialog1->Color; + } + } + + // This method is called when the HelpRequest event is raised, + //which occurs when the user clicks the Help button on the ColorDialog object. + void ColorDialog1_HelpRequest( Object^ sender, System::EventArgs^ e ) + { + MessageBox::Show( "Please select a color by clicking it. " + + "This will change the BackColor property of the TextBox." ); + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp new file mode 100644 index 00000000000..d23484f62a4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxDropDown/CPP/form1.cpp @@ -0,0 +1,87 @@ +// This example demonstrates the ComboBox.ObjectCollection.AddRange, +// ComboBox.DropDown, and ComboBox.Text properties and the +// MessageBox.Show(string, string, MessageBoxButton, MessageBoxIcon) +// method. + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializeComponent(); + InitializeComboBox(); + } + +internal: + System::Windows::Forms::Label ^ Label2; + System::Windows::Forms::Label ^ Label1; + +private: + void InitializeComponent() + { + this->Label2 = gcnew System::Windows::Forms::Label; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + this->Label1->Location = System::Drawing::Point( 24, 48 ); + this->Label1->Name = "Label1"; + this->Label1->TabIndex = 3; + this->Label1->Text = "Installation Type:"; + this->Label1->TextAlign = + System::Drawing::ContentAlignment::MiddleRight; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->Label2 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // +internal: + // Declare ComboBox1 + System::Windows::Forms::ComboBox^ ComboBox1; + +private: + // Initialize ComboBox1. + void InitializeComboBox() + { + this->ComboBox1 = gcnew ComboBox; + this->ComboBox1->Location = System::Drawing::Point( 128, 48 ); + this->ComboBox1->Name = "ComboBox1"; + this->ComboBox1->Size = System::Drawing::Size( 100, 21 ); + this->ComboBox1->TabIndex = 0; + this->ComboBox1->Text = "Typical"; + array^ installs = {"Typical","Compact","Custom"}; + ComboBox1->Items->AddRange( installs ); + this->Controls->Add( this->ComboBox1 ); + + // Hook up the event handler. + this->ComboBox1->DropDown += gcnew System::EventHandler( + this, &Form1::ComboBox1_DropDown ); + } + // + + // Handles the ComboBox1 DropDown event. If the user expands the + // drop-down box, a message box will appear, recommending the + // typical installation. + void ComboBox1_DropDown( Object^ sender, System::EventArgs^ e ) + { + MessageBox::Show( "Typical installation is strongly recommended.", + "Install information", MessageBoxButtons::OK, + MessageBoxIcon::Information ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp new file mode 100644 index 00000000000..4d9b53cc2d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxFindString/CPP/form1.cpp @@ -0,0 +1,153 @@ +// This example demonstrates using the following members: +// ComboBox.FindStringExact(string) +// ComboBox.FindStringExact(string, integer), +// ComboBox.ObjectCollection.AddRange(), +// ComboBox.ObjectCollection.RemoveAt(), and ComboBox.MaxDropDownItems, +// and TextBox.ReadOnly. +// CAUTION This code exposes a known bug: If the index passed to the +// FindStringExact(searchString, index) method is the last index of +// the array,the code throws an exception. +// +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializeComboBox(); + InitializeTextBox(); + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + this->Label1->Location = System::Drawing::Point( 8, 24 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 120, 32 ); + this->Label1->TabIndex = 1; + this->Label1->Text = "Use drop-down to choose a name:"; + this->Label1->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + +internal: + System::Windows::Forms::Label ^ Label1; + + // + // Declare and initialize the text box. +internal: + // This text box text will be update programmatically. The user is not + // allowed to update it, so the ReadOnly property is set to true. + System::Windows::Forms::TextBox^ TextBox1; + +private: + void InitializeTextBox() + { + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->TextBox1->ScrollBars = ScrollBars::Vertical; + this->TextBox1->Location = System::Drawing::Point( 64, 128 ); + this->TextBox1->Multiline = true; + this->TextBox1->Name = "TextBox1"; + this->TextBox1->ReadOnly = true; + this->TextBox1->Size = System::Drawing::Size( 184, 120 ); + this->TextBox1->TabIndex = 4; + this->TextBox1->Text = "Employee and Number of Awards:"; + this->Controls->Add( this->TextBox1 ); + } + // + + // + // Declare comboBox1 as a ComboBox. +internal: + System::Windows::Forms::ComboBox^ ComboBox1; + +private: + // This method initializes the combo box, adding a large string array + // but limiting the drop-down size to six rows so the combo box doesn't + // cover other controls when it expands. + void InitializeComboBox() + { + this->ComboBox1 = gcnew System::Windows::Forms::ComboBox; + array^ employees = {"Hamilton, David","Hensien, Kari", + "Hammond, Maria","Harris, Keith","Henshaw, Jeff D.", + "Hanson, Mark","Harnpadoungsataya, Sariya", + "Harrington, Mark","Harris, Keith","Hartwig, Doris", + "Harui, Roger","Hassall, Mark","Hasselberg, Jonas", + "Harnpadoungsataya, Sariya","Henshaw, Jeff D.", + "Henshaw, Jeff D.","Hensien, Kari","Harris, Keith", + "Henshaw, Jeff D.","Hensien, Kari","Hasselberg, Jonas", + "Harrington, Mark","Hedlund, Magnus","Hay, Jeff", + "Heidepriem, Brandon D."}; + ComboBox1->Items->AddRange( employees ); + this->ComboBox1->Location = System::Drawing::Point( 136, 32 ); + this->ComboBox1->IntegralHeight = false; + this->ComboBox1->MaxDropDownItems = 5; + this->ComboBox1->DropDownStyle = ComboBoxStyle::DropDownList; + this->ComboBox1->Name = "ComboBox1"; + this->ComboBox1->Size = System::Drawing::Size( 136, 81 ); + this->ComboBox1->TabIndex = 0; + this->Controls->Add( this->ComboBox1 ); + + // Associate the event-handling method with the + // SelectedIndexChanged event. + this->ComboBox1->SelectedIndexChanged += + gcnew System::EventHandler( this, &Form1::ComboBox1_SelectedIndexChanged ); + } + // + + // +private: + // This method is called when the user changes his or her selection. + // It searches for all occurrences of the selected employee's + // name in the Items array and adds the employee's name and + // the number of occurrences to TextBox1.Text. + + // CAUTION This code exposes a known bug: If the index passed to the + // FindStringExact(searchString, index) method is the last index + // of the array, the code throws an exception. + void ComboBox1_SelectedIndexChanged( Object^ sender, + System::EventArgs^ e ) + { + ComboBox^ comboBox = (ComboBox^)(sender); + + // Save the selected employee's name, because we will remove + // the employee's name from the list. + String^ selectedEmployee = (String^)(ComboBox1->SelectedItem); + + int count = 0; + int resultIndex = -1; + + // Call the FindStringExact method to find the first + // occurrence in the list. + resultIndex = ComboBox1->FindStringExact( selectedEmployee ); + + // Remove the name as it is found, and increment the found count. + // Then call the FindStringExact method again, passing in the + // index of the current found item so the search starts there + // instead of at the beginning of the list. + while ( resultIndex != -1 ) + { + ComboBox1->Items->RemoveAt( resultIndex ); + count += 1; + resultIndex = ComboBox1->FindStringExact( selectedEmployee, + resultIndex ); + } + + TextBox1->Text = TextBox1->Text + "\r\n" + selectedEmployee + ": " + + count; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp new file mode 100644 index 00000000000..699f1393f3e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxOwnerDrawn/CPP/form1.cpp @@ -0,0 +1,146 @@ +// This example demonstrates creating an owner-drawn ComboBox control. +// The DrawMode property is set to OwnerDrawnVariable. It also demonstrates +// using the ComboBox.DropDownWidth and ComboBox.DropDownStyle properties +// and handling the ComboBox.MeasureItem and ComboBox.DrawItem events for +// an owner-drawn ComboBox with variable item size. + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializeComponent(); + InitializeComboBox(); + } + +private: + void InitializeComponent() + { + this->SuspendLayout(); + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +internal: + System::Windows::Forms::ComboBox^ ComboBox1; + +private: + array^ animals; + + // This method initializes the owner-drawn combo box. + // The drop-down width is set much wider than the size of the combo box + // to accomodate the large items in the list. The drop-down style is set to + // ComboBox.DropDown, which requires the user to click on the arrow to + // see the list. + void InitializeComboBox() + { + this->ComboBox1 = gcnew ComboBox; + this->ComboBox1->DrawMode = System::Windows::Forms::DrawMode::OwnerDrawVariable; + this->ComboBox1->Location = System::Drawing::Point( 10, 20 ); + this->ComboBox1->Name = "ComboBox1"; + this->ComboBox1->Size = System::Drawing::Size( 100, 120 ); + this->ComboBox1->DropDownWidth = 250; + this->ComboBox1->TabIndex = 0; + this->ComboBox1->DropDownStyle = ComboBoxStyle::DropDown; + animals = gcnew array{"Elephant","c r o c o d i l e","lion"}; + ComboBox1->DataSource = animals; + this->Controls->Add( this->ComboBox1 ); + + // Hook up the MeasureItem and DrawItem events + this->ComboBox1->DrawItem += + gcnew DrawItemEventHandler( this, &Form1::ComboBox1_DrawItem ); + this->ComboBox1->MeasureItem += + gcnew MeasureItemEventHandler( this, &Form1::ComboBox1_MeasureItem ); + } + + // If you set the Draw property to DrawMode.OwnerDrawVariable, + // you must handle the MeasureItem event. This event handler + // will set the height and width of each item before it is drawn. +private: + void ComboBox1_MeasureItem( Object^ sender, + System::Windows::Forms::MeasureItemEventArgs^ e ) + { + switch ( e->Index ) + { + case 0: + e->ItemHeight = 45; + break; + case 1: + e->ItemHeight = 20; + break; + case 2: + e->ItemHeight = 35; + break; + } + e->ItemWidth = 260; + } + +private: + // You must handle the DrawItem event for owner-drawn combo boxes. + // This event handler changes the color, size and font of an + // item based on its position in the array. + void ComboBox1_DrawItem( Object^ sender, + System::Windows::Forms::DrawItemEventArgs^ e ) + { + float size = 0; + System::Drawing::Font^ myFont; + FontFamily^ family = nullptr; + + System::Drawing::Color animalColor; + switch ( e->Index ) + { + case 0: + size = 30; + animalColor = System::Drawing::Color::Gray; + family = FontFamily::GenericSansSerif; + break; + case 1: + size = 10; + animalColor = System::Drawing::Color::LawnGreen; + family = FontFamily::GenericMonospace; + break; + case 2: + size = 15; + animalColor = System::Drawing::Color::Tan; + family = FontFamily::GenericSansSerif; + break; + } + + // Draw the background of the item. + e->DrawBackground(); + + // Create a square filled with the animals color. Vary the size + // of the rectangle based on the length of the animals name. + Rectangle rectangle = Rectangle( 2, e->Bounds.Top + 2, + e->Bounds.Height, e->Bounds.Height - 4 ); + e->Graphics->FillRectangle( gcnew SolidBrush( animalColor ), rectangle ); + + // Draw each string in the array, using a different size, color, + // and font for each item. + myFont = gcnew System::Drawing::Font( family, size, FontStyle::Bold ); + e->Graphics->DrawString( animals[ e->Index ], myFont, + System::Drawing::Brushes::Black, RectangleF( + e->Bounds.X + rectangle.Width, e->Bounds.Y, + e->Bounds.Width, e->Bounds.Height) ); + + // Draw the focus rectangle if the mouse hovers over an item. + e->DrawFocusRectangle(); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..97d56573185 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxRenderer/cpp/form1.cpp @@ -0,0 +1,172 @@ +// This sample can go in ComboBoxRenderer class overview. +// - Snippet2 can go in IsSupported +// - Snippet4 can go in DrawTextBox and DrawDropDownButton + +// It renders the pieces of a combo box with visual styles, provided +// that visual styles are enabled in the Display Panel. +// For simplicity, this sample does not handle run-time visual style switching. + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace ComboBoxRendererSample +{ + ref class CustomComboBox: public Control + { + private: + System::Drawing::Size arrowSize; + Rectangle arrowRectangle; + Rectangle topTextBoxRectangle; + Rectangle bottomTextBoxRectangle; + ComboBoxState textBoxState; + ComboBoxState arrowState; + String^ bottomText; + bool isActivated; + int minHeight; + int minWidth; + + public: + CustomComboBox() : Control() + + { + minHeight = 38; + minWidth = 40; + this->Location = Point(10, 10); + this->Size = System::Drawing::Size(140, 38); + this->Font = SystemFonts::IconTitleFont; + this->Text = "Click the button"; + textBoxState = ComboBoxState::Normal; + bottomText = "Using ComboBoxRenderer"; + arrowState = ComboBoxState::Normal; + + // Initialize the rectangles to look like the standard combo + // box control. + arrowSize = System::Drawing::Size(18, 20); + arrowRectangle = Rectangle(ClientRectangle.X + + ClientRectangle.Width - arrowSize.Width - 1, + ClientRectangle.Y + 1, + arrowSize.Width, + arrowSize.Height); + topTextBoxRectangle = Rectangle(ClientRectangle.X, + ClientRectangle.Y, + ClientRectangle.Width, + arrowSize.Height + 2); + bottomTextBoxRectangle = Rectangle(ClientRectangle.X, + ClientRectangle.Y + topTextBoxRectangle.Height, + ClientRectangle.Width, + topTextBoxRectangle.Height - 6); + } + + // + // + // Draw the combo box in the current state. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + Control::OnPaint(e); + + if (!ComboBoxRenderer::IsSupported) + { + this->Parent->Text = "Visual Styles Disabled"; + return; + } + + this->Parent->Text = "CustomComboBox Enabled"; + + // Always draw the main text box and drop down arrow in their + // current states + ComboBoxRenderer::DrawTextBox(e->Graphics, topTextBoxRectangle, + this->Text, this->Font, textBoxState); + ComboBoxRenderer::DrawDropDownButton(e->Graphics, arrowRectangle, + arrowState); + + // Only draw the bottom text box if the arrow has been clicked + if (isActivated) + { + ComboBoxRenderer::DrawTextBox(e->Graphics, + bottomTextBoxRectangle, bottomText, this->Font, + textBoxState); + } + } + // + + protected: + virtual void OnMouseDown(MouseEventArgs^ e) override + { + Control::OnMouseDown(e); + + // Check whether the user clicked the arrow. + if (arrowRectangle.Contains(e->Location) && + ComboBoxRenderer::IsSupported) + { + // Draw the arrow in the pressed state. + arrowState = ComboBoxState::Pressed; + + // The user has activated the combo box. + if (!isActivated) + { + this->Text = "Clicked!"; + textBoxState = ComboBoxState::Pressed; + isActivated = true; + } + + // The user has deactivated the combo box. + else + { + this->Text = "Click here"; + textBoxState = ComboBoxState::Normal; + isActivated = false; + } + + // Redraw the control. + Invalidate(); + } + } + // + + protected: + virtual void OnMouseUp(MouseEventArgs^ e) override + { + Control::OnMouseUp(e); + + if (arrowRectangle.Contains(e->Location) && + ComboBoxRenderer::IsSupported) + { + arrowState = ComboBoxState::Normal; + Invalidate(); + } + } + }; + + ref class Form1 : public Form + { + public: + Form1() : Form() + { + this->Size = System::Drawing::Size(300, 300); + CustomComboBox^ ComboBox1 = gcnew CustomComboBox(); + Controls->Add(ComboBox1); + } + + }; + +} + +[STAThread] +int main() +{ + // The call to EnableVisualStyles below does not affect + // whether ComboBoxRenderer.IsSupported is true; as long as visual + // styles are enabled by the operating system, IsSupported is true. + Application::EnableVisualStyles(); + Application::Run(gcnew ComboBoxRendererSample::Form1()); + +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp new file mode 100644 index 00000000000..84d52d77f59 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ComboBoxSelectedText/CPP/form1.cpp @@ -0,0 +1,127 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeComboBoxAndTextBoxes(); + this->comboBox1->SelectionChangeCommitted += gcnew EventHandler( this, &Form1::comboBox1_SelectionChangeCommitted ); + + //Add any initialization after the InitializeComponent() call + } + + +public: + + //Destructor cleans up the component list. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->SuspendLayout(); + + // + //ComboBox1 + // + // + //TextBox1 + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + +internal: + System::Windows::Forms::ComboBox^ comboBox1; + System::Windows::Forms::TextBox^ textbox1; + +private: + void InitializeComboBoxAndTextBoxes() + { + this->comboBox1 = gcnew System::Windows::Forms::ComboBox; + this->comboBox1->Location = Point(25,150); + this->comboBox1->Width = 160; + this->textbox1 = gcnew System::Windows::Forms::TextBox; + textbox1->Location = Point(25,50); + textbox1->Name = "selectedTextBox"; + textbox1->Size = System::Drawing::Size( 25, 15 ); + array^namespaces = {"System.Windows.Forms","System.Net","System.Reflection","System.Drawing"}; + System::Collections::IEnumerator^ myEnum = namespaces->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ aNamespace = safe_cast(myEnum->Current); + comboBox1->Items->Add( String::Concat( aNamespace, ", ", (aNamespace->Length + 4) ) ); + } + + this->Controls->Add( this->textbox1 ); + this->Controls->Add( this->comboBox1 ); + } + + + // The following code example demonstrates the handling of the + // SelectionChangeCommitted event. This example uses the + // SelectionLength property to set the width of a text box that + // displays the SelectedText. Since the SelectionLength and + // SelectedText properties reflect the currently selected + // (not newly selected) text, they will lag behind what is currently + // displayed in the text portion of the ComboBox control. To run + // this example,paste the following code into a form that contains + // a ComboBox named comboBox1 and is populated with strings. + // The form should also contain a TextBox named textbox1. + // Ensure the SelectionChangedEvent is associated with the + // event-handling method in this example. + // + void comboBox1_SelectionChangeCommitted( Object^ sender, EventArgs^ /*e*/ ) + { + ComboBox^ senderComboBox = dynamic_cast(sender); + + // Change the length of the text box depending on what the user has + // selected and committed using the SelectionLength property. + if ( senderComboBox->SelectionLength > 0 ) + { + textbox1->Width = + senderComboBox->SelectedItem->ToString()->Length * + ((int)this->textbox1->Font->SizeInPoints); + textbox1->Text = senderComboBox->SelectedItem->ToString(); + } + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp new file mode 100644 index 00000000000..f7c2c136e31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.DoDragDrop/CPP/form1.cpp @@ -0,0 +1,319 @@ + + +#using +#using +#using + +// +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace Snip_DragNDrop +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::ListBox^ ListDragSource; + System::Windows::Forms::ListBox^ ListDragTarget; + System::Windows::Forms::CheckBox^ UseCustomCursorsCheck; + System::Windows::Forms::Label ^ DropLocationLabel; + Int32 indexOfItemUnderMouseToDrag; + Int32 indexOfItemUnderMouseToDrop; + Rectangle dragBoxFromMouseDown; + Point screenOffset; + System::Windows::Forms::Cursor^ MyNoDropCursor; + System::Windows::Forms::Cursor^ MyNormalCursor; + + public: + Form1() + { + this->ListDragSource = gcnew System::Windows::Forms::ListBox; + this->ListDragTarget = gcnew System::Windows::Forms::ListBox; + this->UseCustomCursorsCheck = gcnew System::Windows::Forms::CheckBox; + this->DropLocationLabel = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // ListDragSource + array^temp0 = {"five","six","seven","eight","nine","ten"}; + this->ListDragSource->Items->AddRange( temp0 ); + this->ListDragSource->Location = System::Drawing::Point( 10, 17 ); + this->ListDragSource->Size = System::Drawing::Size( 120, 225 ); + this->ListDragSource->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::ListDragSource_MouseDown ); + this->ListDragSource->QueryContinueDrag += gcnew System::Windows::Forms::QueryContinueDragEventHandler( this, &Form1::ListDragSource_QueryContinueDrag ); + this->ListDragSource->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::ListDragSource_MouseUp ); + this->ListDragSource->MouseMove += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::ListDragSource_MouseMove ); + this->ListDragSource->GiveFeedback += gcnew System::Windows::Forms::GiveFeedbackEventHandler( this, &Form1::ListDragSource_GiveFeedback ); + + // ListDragTarget + this->ListDragTarget->AllowDrop = true; + this->ListDragTarget->Location = System::Drawing::Point( 154, 17 ); + this->ListDragTarget->Size = System::Drawing::Size( 120, 225 ); + this->ListDragTarget->DragOver += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::ListDragTarget_DragOver ); + this->ListDragTarget->DragDrop += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::ListDragTarget_DragDrop ); + this->ListDragTarget->DragEnter += gcnew System::Windows::Forms::DragEventHandler( this, &Form1::ListDragTarget_DragEnter ); + this->ListDragTarget->DragLeave += gcnew System::EventHandler( this, &Form1::ListDragTarget_DragLeave ); + + // UseCustomCursorsCheck + this->UseCustomCursorsCheck->Location = System::Drawing::Point( 10, 243 ); + this->UseCustomCursorsCheck->Size = System::Drawing::Size( 137, 24 ); + this->UseCustomCursorsCheck->Text = "Use Custom Cursors"; + + // DropLocationLabel + this->DropLocationLabel->Location = System::Drawing::Point( 154, 245 ); + this->DropLocationLabel->Size = System::Drawing::Size( 137, 24 ); + this->DropLocationLabel->Text = "None"; + + // Form1 + this->ClientSize = System::Drawing::Size( 292, 270 ); + array^formControls = {this->ListDragSource,this->ListDragTarget,this->UseCustomCursorsCheck,this->DropLocationLabel}; + this->Controls->AddRange( formControls ); + this->Text = "drag-and-drop Example"; + this->ResumeLayout( false ); + } + + + private: + void ListDragSource_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + + // Get the index of the item the mouse is below. + indexOfItemUnderMouseToDrag = this->ListDragSource->IndexFromPoint( e->X, e->Y ); + if ( indexOfItemUnderMouseToDrag != ListBox::NoMatches ) + { + + // Remember the point where the mouse down occurred. The DragSize indicates + // the size that the mouse can move before a drag event should be started. + System::Drawing::Size dragSize = SystemInformation::DragSize; + + // Create a rectangle using the DragSize, with the mouse position being + // at the center of the rectangle. + dragBoxFromMouseDown = Rectangle(Point(e->X - (dragSize.Width / 2),e->Y - (dragSize.Height / 2)),dragSize); + } + else + dragBoxFromMouseDown = Rectangle::Empty; + + + // Reset the rectangle if the mouse is not over an item in the ListBox. + } + + void ListDragSource_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ) + { + + // Reset the drag rectangle when the mouse button is raised. + dragBoxFromMouseDown = Rectangle::Empty; + } + + + // + void ListDragSource_MouseMove( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + if ( (e->Button & ::MouseButtons::Left) == ::MouseButtons::Left ) + { + + // If the mouse moves outside the rectangle, start the drag. + if ( dragBoxFromMouseDown != Rectangle::Empty && !dragBoxFromMouseDown.Contains( e->X, e->Y ) ) + { + + // Create custom cursors for the drag-and-drop operation. + try + { + MyNormalCursor = gcnew System::Windows::Forms::Cursor( "3dwarro.cur" ); + MyNoDropCursor = gcnew System::Windows::Forms::Cursor( "3dwno.cur" ); + } + catch ( Exception^ ) + { + // An error occurred while attempting to load the cursors, so use + // the standard cursors. + this->UseCustomCursorsCheck->Checked = false; + } + __finally + { + // The screenOffset is used to account for any desktop bands + // that may be at the top or left side of the screen when + // determining when to cancel the drag drop operation. + screenOffset = SystemInformation::WorkingArea.Location; + + // Proceed with the drag-and-drop, passing in the list item. + DragDropEffects dropEffect = this->ListDragSource->DoDragDrop( ListDragSource->Items[ indexOfItemUnderMouseToDrag ], static_cast(DragDropEffects::All | DragDropEffects::Link) ); + + // If the drag operation was a move then remove the item. + if ( dropEffect == DragDropEffects::Move ) + { + ListDragSource->Items->RemoveAt( indexOfItemUnderMouseToDrag ); + + // Selects the previous item in the list as long as the list has an item. + if ( indexOfItemUnderMouseToDrag > 0 ) + ListDragSource->SelectedIndex = indexOfItemUnderMouseToDrag - 1; + else + if ( ListDragSource->Items->Count > 0 ) + + // Selects the first item. + ListDragSource->SelectedIndex = 0; + } + + // Dispose of the cursors since they are no longer needed. + if ( MyNormalCursor != nullptr ) + delete MyNormalCursor; + if ( MyNoDropCursor != nullptr ) + delete MyNoDropCursor; + } + } + } + } + // + + // + // + void ListDragSource_GiveFeedback( Object^ /*sender*/, System::Windows::Forms::GiveFeedbackEventArgs^ e ) + { + // Use custom cursors if the check box is checked. + if ( UseCustomCursorsCheck->Checked ) + { + // Sets the custom cursor based upon the effect. + e->UseDefaultCursors = false; + if ( (e->Effect & DragDropEffects::Move) == DragDropEffects::Move ) + ::Cursor::Current = MyNormalCursor; + else + ::Cursor::Current = MyNoDropCursor; + } + } + // + + // + void ListDragTarget_DragOver( Object^ /*sender*/, System::Windows::Forms::DragEventArgs^ e ) + { + // Determine whether string data exists in the drop data. If not, then + // the drop effect reflects that the drop cannot occur. + if ( !e->Data->GetDataPresent( System::String::typeid ) ) + { + e->Effect = DragDropEffects::None; + DropLocationLabel->Text = "None - no string data."; + return; + } + + // Set the effect based upon the KeyState. + if ( (e->KeyState & (8 + 32)) == (8 + 32) && ((e->AllowedEffect & DragDropEffects::Link) == DragDropEffects::Link) ) + { + // KeyState 8 + 32 = CTRL + ALT + // Link drag-and-drop effect. + e->Effect = DragDropEffects::Link; + } + else + if ( (e->KeyState & 32) == 32 && ((e->AllowedEffect & DragDropEffects::Link) == DragDropEffects::Link) ) + { + // ALT KeyState for link. + e->Effect = DragDropEffects::Link; + } + else + if ( (e->KeyState & 4) == 4 && ((e->AllowedEffect & DragDropEffects::Move) == DragDropEffects::Move) ) + { + // SHIFT KeyState for move. + e->Effect = DragDropEffects::Move; + } + else + if ( (e->KeyState & 8) == 8 && ((e->AllowedEffect & DragDropEffects::Copy) == DragDropEffects::Copy) ) + { + // CTRL KeyState for copy. + e->Effect = DragDropEffects::Copy; + } + else + if ( (e->AllowedEffect & DragDropEffects::Move) == DragDropEffects::Move ) + { + // By default, the drop action should be move, if allowed. + e->Effect = DragDropEffects::Move; + } + else + e->Effect = DragDropEffects::None; + + + + + + + // Get the index of the item the mouse is below. + // The mouse locations are relative to the screen, so they must be + // converted to client coordinates. + indexOfItemUnderMouseToDrop = ListDragTarget->IndexFromPoint( ListDragTarget->PointToClient( Point(e->X,e->Y) ) ); + + // Updates the label text. + if ( indexOfItemUnderMouseToDrop != ListBox::NoMatches ) + { + DropLocationLabel->Text = String::Concat( "Drops before item # ", (indexOfItemUnderMouseToDrop + 1) ); + } + else + DropLocationLabel->Text = "Drops at the end."; + } + // + + // + void ListDragTarget_DragDrop( Object^ /*sender*/, System::Windows::Forms::DragEventArgs^ e ) + { + // Ensure that the list item index is contained in the data. + if ( e->Data->GetDataPresent( System::String::typeid ) ) + { + Object^ item = dynamic_cast(e->Data->GetData( System::String::typeid )); + + // Perform drag-and-drop, depending upon the effect. + if ( e->Effect == DragDropEffects::Copy || e->Effect == DragDropEffects::Move ) + { + // Insert the item. + if ( indexOfItemUnderMouseToDrop != ListBox::NoMatches ) + ListDragTarget->Items->Insert( indexOfItemUnderMouseToDrop, item ); + else + ListDragTarget->Items->Add( item ); + } + } + + // Reset the label text. + DropLocationLabel->Text = "None"; + } + // + + // + void ListDragSource_QueryContinueDrag( Object^ sender, System::Windows::Forms::QueryContinueDragEventArgs^ e ) + { + // Cancel the drag if the mouse moves off the form. + ListBox^ lb = dynamic_cast(sender); + if ( lb != nullptr ) + { + Form^ f = lb->FindForm(); + + // Cancel the drag if the mouse moves off the form. The screenOffset + // takes into account any desktop bands that may be at the top or left + // side of the screen. + if ( ((Control::MousePosition.X - screenOffset.X) < f->DesktopBounds.Left) || ((Control::MousePosition.X - screenOffset.X) > f->DesktopBounds.Right) || ((Control::MousePosition.Y - screenOffset.Y) < f->DesktopBounds.Top) || ((Control::MousePosition.Y - screenOffset.Y) > f->DesktopBounds.Bottom) ) + { + e->Action = DragAction::Cancel; + } + } + } + // + + // + void ListDragTarget_DragEnter( Object^ /*sender*/, System::Windows::Forms::DragEventArgs^ /*e*/ ) + { + // Reset the label text. + DropLocationLabel->Text = "None"; + } + // + + // + void ListDragTarget_DragLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Reset the label text. + DropLocationLabel->Text = "None"; + } + // + // + }; +} + +/// The main entry point for the application. + +[STAThread] +int main() +{ + Application::Run( gcnew Snip_DragNDrop::Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp new file mode 100644 index 00000000000..481451b6327 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.PerformLayout/CPP/form1.cpp @@ -0,0 +1,168 @@ + + +#using +#using +#using + +// This example demonstrates using the Control.PerformLayout method. +// It contains a custom LayoutControl object and three buttons. +// The Click event handler for Button1 explicitly calls PerformLayout. +// The Click event handler for Button2 implicitly calls PerformLayout. +// PerformLayout is also called when the form is loaded. Button3 returns +// the control to the state it was in when loaded. +// +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +// This custom control has the Layout event implented so that when +// PerformLayout(AffectedControl, AffectedProperty) is called +// on the control, where AffectedProperty equals "Bounds" the +// textbox is centered on the control. +public ref class LayoutControl: public System::Windows::Forms::UserControl +{ +public private: + System::Windows::Forms::TextBox^ TextBox1; + +public: + LayoutControl() + : UserControl() + { + InitializeComponent(); + } + + +private: + void InitializeComponent() + { + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + this->TextBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + this->TextBox1->Name = "TextBox1"; + this->TextBox1->TabIndex = 0; + this->BackColor = System::Drawing::SystemColors::ControlDark; + this->Controls->Add( this->TextBox1 ); + this->Name = "LayoutControl"; + this->ResumeLayout( false ); + this->Layout += gcnew LayoutEventHandler( this, &LayoutControl::LayoutControl_Layout ); + } + + + // This method is called when the Layout event is fired. + // This happens by during the initial load, by calling PerformLayout + // or by resizing, adding or removing controls or other actions that + // affect how the control is laid out. This method checks the + // value of e.AffectedProperty and changes the look of the + // control accordingly. + void LayoutControl_Layout( Object^ /*sender*/, System::Windows::Forms::LayoutEventArgs^ e ) + { + if ( e->AffectedProperty != nullptr ) + { + if ( e->AffectedProperty->Equals( "Bounds" ) ) + { + TextBox1->Left = (this->Width - TextBox1->Width) / 2; + TextBox1->Top = (this->Height - TextBox1->Height) / 2; + } + } + else + { + this->Size = System::Drawing::Size( 150, 160 ); + TextBox1->Location = System::Drawing::Point( 16, 24 ); + } + + TextBox1->Text = String::Format( "Left = {0} Top = {1}", TextBox1->Left, TextBox1->Top ); + } + +}; + +public ref class LayoutForm: public System::Windows::Forms::Form +{ +public: + LayoutForm() + : Form() + { + InitializeComponent(); + } + + +public private: + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Button^ Button2; + LayoutControl^ LayoutControl1; + System::Windows::Forms::Button^ Button3; + +private: + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button2 = gcnew System::Windows::Forms::Button; + this->Button3 = gcnew System::Windows::Forms::Button; + this->LayoutControl1 = gcnew LayoutControl; + this->SuspendLayout(); + this->Button1->Location = System::Drawing::Point( 16, 16 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 120, 32 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Center textbox on control"; + this->Button2->Location = System::Drawing::Point( 152, 16 ); + this->Button2->Name = "Button2"; + this->Button2->Size = System::Drawing::Size( 104, 32 ); + this->Button2->TabIndex = 3; + this->Button2->Text = "Shrink user control"; + this->Button3->Location = System::Drawing::Point( 96, 232 ); + this->Button3->Name = "Button3"; + this->Button3->TabIndex = 5; + this->Button3->Text = "Reset"; + this->LayoutControl1->BackColor = System::Drawing::SystemColors::ControlDark; + this->LayoutControl1->Location = System::Drawing::Point( 72, 64 ); + this->LayoutControl1->Name = "LayoutControl1"; + this->LayoutControl1->Size = System::Drawing::Size( 150, 160 ); + this->LayoutControl1->TabIndex = 6; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button3 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->LayoutControl1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + this->Button1->Click += gcnew System::EventHandler( this,&LayoutForm::Button1_Click ); + this->Button2->Click += gcnew System::EventHandler( this,&LayoutForm::Button2_Click ); + this->Button3->Click += gcnew System::EventHandler( this,&LayoutForm::Button3_Click ); + } + + + // This method explicitly calls raises the layout event on + // LayoutControl1, changing the Bounds property. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + LayoutControl1->PerformLayout( LayoutControl1, "Bounds" ); + } + + + // This resize of LayoutControl1 implicitly triggers the layout event. + // Changing the size of the control affects its Bounds property. + void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + LayoutControl1->Size = System::Drawing::Size( 100, 100 ); + } + + + // This method explicitly calls PerformLayout with no parameters, + // which raises the Layout event with the LayoutEventArgs properties + // equal to Nothing. + void Button3_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + LayoutControl1->PerformLayout(); + } + +}; + + +[System::STAThread] +int main() +{ + Application::Run( gcnew LayoutForm ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp new file mode 100644 index 00000000000..951636882be --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.Region/CPP/form1.cpp @@ -0,0 +1,81 @@ +// This example demonstrates using the Control.Region property by +// creating a round button. + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing::Drawing2D; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializeComponent(); + } + +internal: + System::Windows::Forms::Button^ roundButton; + +private: + void InitializeComponent() + { + this->roundButton = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + this->roundButton->BackColor = System::Drawing::Color::PowderBlue; + this->roundButton->Location = System::Drawing::Point( 88, 72 ); + this->roundButton->Name = "RoundButton"; + this->roundButton->Size = System::Drawing::Size( 112, 112 ); + this->roundButton->TabIndex = 0; + this->roundButton->Text = "I'm round"; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->roundButton ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + this->roundButton->Paint += gcnew PaintEventHandler( + this, &Form1::roundButton_Paint ); + } + + // +private: + // This method will change the square button to a circular button by + // creating a new circle-shaped GraphicsPath object and setting it + // to the RoundButton objects region. + void roundButton_Paint( Object^ sender, + System::Windows::Forms::PaintEventArgs^ e ) + { + System::Drawing::Drawing2D::GraphicsPath^ buttonPath = + gcnew System::Drawing::Drawing2D::GraphicsPath; + + // Set a new rectangle to the same size as the button's + // ClientRectangle property. + System::Drawing::Rectangle newRectangle = roundButton->ClientRectangle; + + // Decrease the size of the rectangle. + newRectangle.Inflate( -10, -10 ); + + // Draw the button's border. + e->Graphics->DrawEllipse( System::Drawing::Pens::Black, newRectangle ); + + // Increase the size of the rectangle to include the border. + newRectangle.Inflate( 1, 1 ); + + // Create a circle within the new rectangle. + buttonPath->AddEllipse( newRectangle ); + + // Set the button's Region property to the newly created + // circle region. + roundButton->Region = gcnew System::Drawing::Region( buttonPath ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp new file mode 100644 index 00000000000..77c708c925d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Control.WndProc/CPP/form1.cpp @@ -0,0 +1,80 @@ +#using +#using +#using + +// +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +namespace csTempWindowsApplication1 +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + + // Constant value was found in the "windows.h" header file. + static const Int32 WM_ACTIVATEAPP = 0x001C; + Boolean appActive; + + public: + Form1() + { + appActive = true; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + this->Font = gcnew System::Drawing::Font( "Microsoft Sans Serif",18.0F,System::Drawing::FontStyle::Bold,System::Drawing::GraphicsUnit::Point,((System::Byte)(0)) ); + } + + + protected: + virtual void OnPaint( PaintEventArgs^ e ) override + { + + // Paint a string in different styles depending on whether the + // application is active. + if ( appActive ) + { + e->Graphics->FillRectangle( SystemBrushes::ActiveCaption, 20, 20, 260, 50 ); + e->Graphics->DrawString( "Application is active", this->Font, SystemBrushes::ActiveCaptionText, 20, 20 ); + } + else + { + e->Graphics->FillRectangle( SystemBrushes::InactiveCaption, 20, 20, 260, 50 ); + e->Graphics->DrawString( "Application is Inactive", this->Font, SystemBrushes::ActiveCaptionText, 20, 20 ); + } + } + + + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + virtual void WndProc( Message% m ) override + { + + // Listen for operating system messages. + switch ( m.Msg ) + { + case WM_ACTIVATEAPP: + + // The WParam value identifies what is occurring. + appActive = (int)m.WParam != 0; + + // Invalidate to get new text painted. + this->Invalidate(); + break; + } + Form::WndProc( m ); + } + + }; + +} + + +[STAThread] +int main() +{ + Application::Run( gcnew csTempWindowsApplication1::Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp new file mode 100644 index 00000000000..0ef6650f337 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlCapture/CPP/form1.cpp @@ -0,0 +1,103 @@ +// +//This code examples shows a use of the Control.Capture property. +// + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class CaptureForm: public System::Windows::Forms::Form +{ +public: + CaptureForm() : Form() + { + InitializeComponent(); + this->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); + this->listbox1->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); + this->listbox2->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); + this->label1->MouseDown += gcnew MouseEventHandler( this, &CaptureForm::Control_MouseDown ); + } + +internal: + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::ListBox^ listbox1; + System::Windows::Forms::ListBox^ listbox2; + +private: + void InitializeComponent() + { + this->label1 = gcnew System::Windows::Forms::Label; + this->listbox1 = gcnew System::Windows::Forms::ListBox; + this->listbox2 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + //Label1 + // + this->label1->Location = System::Drawing::Point( 168, 72 ); + this->label1->Name = "Label1"; + this->label1->Size = System::Drawing::Size( 104, 72 ); + this->label1->TabIndex = 4; + this->label1->Text = + "Click around the form to see what control has captured the mouse."; + + // + //LunchBox + // + this->listbox2->AllowDrop = true; + array^ temp0 = { "Sandwich", "Chips", "Soda", "Soup", "Salad" }; + this->listbox2->Items->AddRange( temp0 ); + this->listbox2->Location = System::Drawing::Point( 296, 64 ); + this->listbox2->Name = "LunchBox"; + this->listbox2->Size = System::Drawing::Size( 120, 95 ); + this->listbox2->TabIndex = 5; + + // + //BreakfastBox + // + this->listbox1->AllowDrop = true; + array^ temp1 = + { "Bagels", "Pancakes", "Donuts", "Eggs", "Hashbrowns", "Orange Juice" }; + this->listbox1->Items->AddRange( temp1 ); + this->listbox1->Location = System::Drawing::Point( 24, 64 ); + this->listbox1->Name = "BreakfastBox"; + this->listbox1->Size = System::Drawing::Size( 120, 95 ); + this->listbox1->TabIndex = 6; + + // + //CaptureForm + // + this->ClientSize = System::Drawing::Size( 440, 266 ); + this->Controls->Add( this->listbox1 ); + this->Controls->Add( this->listbox2 ); + this->Controls->Add( this->label1 ); + this->Name = "CaptureForm"; + this->Text = "CaptureForm"; + this->ResumeLayout( false ); + } + + + // + // This method handles the mouse down event for all the controls on the form. + // When a control has captured the mouse + // the control's name will be output on label1. + void Control_MouseDown( System::Object^ sender, + System::Windows::Forms::MouseEventArgs^ /*e*/ ) + { + Control^ control = (Control^)(sender); + if ( control->Capture ) + { + label1->Text = control->Name + " has captured the mouse"; + } + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew CaptureForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp new file mode 100644 index 00000000000..ee6e623e6a1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlDefaultProperties/CPP/form1.cpp @@ -0,0 +1,146 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; + +// +// To use this example create a new form and paste this class +// forming the same file, after the form class in the same file. +// Add a button of type FunButton to the form. +public ref class FunButton: public Button +{ +protected: + virtual void OnMouseHover( System::EventArgs^ e ) override + { + + // Get the font size in Points, add one to the + // size, and reset the button's font to the larger + // size. + float fontSize = Font->SizeInPoints; + fontSize += 1; + System::Drawing::Size buttonSize = Size; + this->Font = gcnew System::Drawing::Font( Font->FontFamily,fontSize,Font->Style ); + + // Increase the size width and height of the button + // by 5 points each. + Size = System::Drawing::Size( Size.Width + 5, Size.Height + 5 ); + + // Call myBase.OnMouseHover to activate the delegate. + Button::OnMouseHover( e ); + } + + virtual void OnMouseMove( MouseEventArgs^ e ) override + { + + // Make the cursor the Hand cursor when the mouse moves + // over the button. + Cursor = Cursors::Hand; + + // Call MyBase.OnMouseMove to activate the delegate. + Button::OnMouseMove( e ); + } + // +}; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + Populate_ListBox(); + + //Add any initialization after the InitializeComponent() call + } + + +public: + + //Form calls destructor to clean up the component list. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + FunButton^ Button1; + System::Windows::Forms::ListBox^ ListBox1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + Button1 = gcnew FunButton; + Button1->Text = "CLICK"; + this->ListBox1 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + //ListBox1 + this->Button1->Location = System::Drawing::Point( 40, 40 ); + + // + this->ListBox1->Location = System::Drawing::Point( 88, 112 ); + this->ListBox1->Name = "ListBox1"; + this->ListBox1->Size = System::Drawing::Size( 120, 95 ); + this->ListBox1->TabIndex = 1; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->ListBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // + // Add this method to a form containing a ListBox control named ListBox1. + // Call the method in the constructor or Load method of the form. + // + // The following method displays the default font, + // background color and foreground color values for the ListBox + // control. The values are displayed in the ListBox, itself. + void Populate_ListBox() + { + ListBox1->Dock = DockStyle::Bottom; + + // Display the values in the read-only properties + // DefaultBackColor, DefaultFont, DefaultForecolor. + ListBox1->Items->Add( String::Format( "Default BackColor: {0}", ListBox::DefaultBackColor ) ); + ListBox1->Items->Add( String::Format( "Default Font: {0}", ListBox::DefaultFont ) ); + ListBox1->Items->Add( String::Format( "Default ForeColor:{0}", ListBox::DefaultForeColor ) ); + } + // +}; + + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp new file mode 100644 index 00000000000..543331c5521 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlOnClick/CPP/form1.cpp @@ -0,0 +1,71 @@ +// This example demonstrates overriding the OnClick method of a +// custom TextBox control. + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// +// This is a custom TextBox control that overrides the OnClick method +// to allow one-click selection of the text in the text box. +public ref class SingleClickTextBox: public TextBox +{ +protected: + virtual void OnClick( EventArgs^ e ) override + { + this->SelectAll(); + TextBox::OnClick( e ); + } +}; +// + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + InitializeComponent(); + } + +internal: + TextBox^ TextBox1; + SingleClickTextBox^ TextBox2; + +private: + void InitializeComponent() + { + this->TextBox1 = gcnew TextBox; + this->TextBox2 = gcnew SingleClickTextBox; + this->SuspendLayout(); + this->TextBox1->Location = System::Drawing::Point( 40, 60 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->TabIndex = 1; + this->TextBox1->Size = System::Drawing::Size( 150, 80 ); + this->TextBox1->Text = "This textbox requires a drag motion for selection."; + this->TextBox1->Multiline = true; + this->TextBox1->Select( 0, 0 ); + this->SuspendLayout(); + this->TextBox2->Location = System::Drawing::Point( 40, 150 ); + this->TextBox2->Name = "TextBox2"; + this->TextBox2->TabIndex = 2; + this->TextBox2->Size = System::Drawing::Size( 150, 80 ); + this->TextBox2->Text = "One click causes all text to be selected."; + this->TextBox2->Multiline = true; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->TextBox2 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp new file mode 100644 index 00000000000..5e1e27f8ada --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaint1/CPP/form1.cpp @@ -0,0 +1,152 @@ + + +#using +#using +#using + +//This code example demonstrates ControlPaint.DrawReversibleLine, +//ControlPaint.DrawFocusRectangle and ControlPaint.FillReversibleRectangle. +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Button^ Button2; + System::Windows::Forms::Button^ Button3; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button2 = gcnew System::Windows::Forms::Button; + this->Button3 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 48, 40 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 88, 80 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click for focus rectangle on Button2"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Button2 + // + this->Button2->Location = System::Drawing::Point( 176, 48 ); + this->Button2->Name = "Button2"; + this->Button2->Size = System::Drawing::Size( 72, 64 ); + this->Button2->TabIndex = 1; + this->Button2->Text = "Hover over me for filled rectangle"; + this->Button2->MouseHover += gcnew System::EventHandler( this, &Form1::Button2_MouseHover ); + this->Button2->MouseLeave += gcnew System::EventHandler( this, &Form1::Button2_MouseLeave ); + + // + //Button3 + // + this->Button3->Location = System::Drawing::Point( 104, 160 ); + this->Button3->Name = "Button3"; + this->Button3->Size = System::Drawing::Size( 96, 72 ); + this->Button3->TabIndex = 2; + this->Button3->Text = "Hover over for me for reversible lines"; + this->Button3->MouseHover += gcnew System::EventHandler( this, &Form1::Button3_MouseHover ); + this->Button3->MouseLeave += gcnew System::EventHandler( this, &Form1::Button3_MouseLeave ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button3 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // This method draws a focus rectangle on Button2 using the + // handle and client rectangle of Button2. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ControlPaint::DrawFocusRectangle( Graphics::FromHwnd( Button2->Handle ), Button2->ClientRectangle ); + } + // + + // + //When the mouse hovers over Button2, its ClientRectangle is filled. + void Button2_MouseHover( Object^ sender, System::EventArgs^ /*e*/ ) + { + Control^ senderControl = dynamic_cast(sender); + Rectangle screenRectangle = senderControl->RectangleToScreen( senderControl->ClientRectangle ); + ControlPaint::FillReversibleRectangle( screenRectangle, senderControl->BackColor ); + } + + // When the mouse leaves Button2, its ClientRectangle is cleared by + // calling the FillReversibleRectangle method again. + void Button2_MouseLeave( Object^ sender, System::EventArgs^ /*e*/ ) + { + Control^ senderControl = dynamic_cast(sender); + Rectangle screenRectangle = senderControl->RectangleToScreen( senderControl->ClientRectangle ); + ControlPaint::FillReversibleRectangle( screenRectangle, senderControl->BackColor ); + } + // + + // + // When the mouse hovers over Button3, two reversible lines are + // drawn using the corner coordinates of Button3, which are first + // converted to screen coordinates. + void Button3_MouseHover( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(0,0) ), Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); + ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Top) ), Button3->PointToScreen( Point(Button1->ClientRectangle.Left,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); + } + + // When the mouse moves from Button3, the reversible lines are erased by + // using the same coordinates as are used in the Button3_MouseHover method. + void Button3_MouseLeave( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(0,0) ), Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); + ControlPaint::DrawReversibleLine( Button3->PointToScreen( Point(Button3->ClientRectangle.Right,Button3->ClientRectangle.Top) ), Button3->PointToScreen( Point(Button3->ClientRectangle.Left,Button3->ClientRectangle.Bottom) ), SystemColors::Control ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp new file mode 100644 index 00000000000..43320162e54 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ControlPaintMembers/CPP/form1.cpp @@ -0,0 +1,98 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 24, 32 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Button1"; + this->Button1->Paint += gcnew PaintEventHandler( this, &Form1::Button1_Paint ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Paint += gcnew PaintEventHandler( this, &Form1::Form1_Paint ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Handle the Button1 object's Paint Event to create a CaptionButton. + void Button1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + + // Draw a CaptionButton control using the ClientRectangle + // property of Button1. Make the button a Help button + // with a normal state. + ControlPaint::DrawCaptionButton( e->Graphics, Button1->ClientRectangle, CaptionButton::Help, ButtonState::Normal ); + } + // + + // + // Handle the Form's Paint event to draw a 3D three-dimensional + // raised border just inside the border of the frame. + void Form1_Paint( Object^ /*sender*/, PaintEventArgs^ e ) + { + Rectangle borderRectangle = this->ClientRectangle; + borderRectangle.Inflate( -10, -10 ); + ControlPaint::DrawBorder3D( e->Graphics, borderRectangle, Border3DStyle::Raised ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp new file mode 100644 index 00000000000..68d1dc93221 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursor Members/CPP/cursorstuff.cpp @@ -0,0 +1,135 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace CursorStuff +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + } + + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Cursor = System::Windows::Forms::Cursors::Default; + this->button1->Location = System::Drawing::Point( 40, 184 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 2; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->Cursor = System::Windows::Forms::Cursors::Default; + this->button2->Location = System::Drawing::Point( 56, 232 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 3; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->button2,this->button1}; + this->Controls->AddRange( temp0 ); + this->Cursor = System::Windows::Forms::Cursors::Hand; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->MoveCursor(); + } + + // + void MoveCursor() + { + // Set the Current cursor, move the cursor's Position, + // and set its clipping rectangle to the form. + + this->Cursor = gcnew System::Windows::Forms::Cursor( ::Cursor::Current->Handle ); + ::Cursor::Position = Point(::Cursor::Position.X - 50,::Cursor::Position.Y - 50); + ::Cursor::Clip = Rectangle(this->Location,this->Size); + + } + // + + // + void DrawCursorsOnForm( System::Windows::Forms::Cursor^ cursor ) + { + + // If the form's cursor is not the Hand cursor and the + // Current cursor is the Default, Draw the specified + // cursor on the form in normal size and twice normal size. + if ( this->Cursor != Cursors::Hand && System::Windows::Forms::Cursor::Current == Cursors::Default ) + { + + // Draw the cursor stretched. + Graphics^ graphics = this->CreateGraphics(); + Rectangle rectangle = Rectangle(Point(10,10),System::Drawing::Size( cursor->Size.Width * 2, cursor->Size.Height * 2 )); + cursor->DrawStretched( graphics, rectangle ); + + // Draw the cursor in normal size. + rectangle.Location = Point(rectangle.Width + rectangle.Location.X,rectangle.Height + rectangle.Location.Y); + rectangle.Size = cursor->Size; + cursor->Draw( graphics, rectangle ); + + // Dispose of the cursor. + delete cursor; + } + } + // + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->DrawCursorsOnForm( gcnew System::Windows::Forms::Cursor( "c:\\MyCursor.cur" ) ); + } + + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew CursorStuff::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp new file mode 100644 index 00000000000..35a0ebd497f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Cursors/CPP/cursorexample.cpp @@ -0,0 +1,120 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace MCursor +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::ComboBox^ cursorSelectionComboBox; + System::Windows::Forms::Panel^ testPanel; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::ListView^ cursorEventViewer; + System::Windows::Forms::Label ^ label3; + + public: + Form1() + { + this->cursorSelectionComboBox = gcnew System::Windows::Forms::ComboBox; + this->testPanel = gcnew System::Windows::Forms::Panel; + this->label1 = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->cursorEventViewer = gcnew System::Windows::Forms::ListView; + this->label3 = gcnew System::Windows::Forms::Label; + + // Select Cursor Label + this->label2->Location = System::Drawing::Point( 24, 16 ); + this->label2->Size = System::Drawing::Size( 80, 16 ); + this->label2->Text = "Select cursor:"; + + // Cursor Testing Panel Label + this->label1->Location = System::Drawing::Point( 24, 80 ); + this->label1->Size = System::Drawing::Size( 144, 23 ); + this->label1->Text = "Cursor testing panel:"; + + // Cursor Changed Events Label + this->label3->Location = System::Drawing::Point( 184, 16 ); + this->label3->Size = System::Drawing::Size( 128, 16 ); + this->label3->Text = "Cursor changed events:"; + + // Cursor Selection ComboBox + this->cursorSelectionComboBox->Location = System::Drawing::Point( 24, 40 ); + this->cursorSelectionComboBox->Size = System::Drawing::Size( 152, 21 ); + this->cursorSelectionComboBox->TabIndex = 0; + this->cursorSelectionComboBox->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::cursorSelectionComboBox_SelectedIndexChanged ); + + // Cursor Test Panel + this->testPanel->BackColor = System::Drawing::SystemColors::ControlDark; + this->testPanel->Location = System::Drawing::Point( 24, 104 ); + this->testPanel->Size = System::Drawing::Size( 152, 160 ); + this->testPanel->CursorChanged += gcnew System::EventHandler( this, &Form1::testPanel_CursorChanged ); + + // Cursor Event ListView + this->cursorEventViewer->Location = System::Drawing::Point( 184, 40 ); + this->cursorEventViewer->Size = System::Drawing::Size( 256, 224 ); + this->cursorEventViewer->TabIndex = 4; + this->cursorEventViewer->View = System::Windows::Forms::View::List; + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 456, 286 ); + array^temp0 = {this->label3,this->cursorEventViewer,this->label2,this->label1,this->testPanel,this->cursorSelectionComboBox}; + this->Controls->AddRange( temp0 ); + this->Text = "Cursors Example"; + + // Add all the cursor types to the combobox. + System::Collections::IEnumerator^ myEnum = CursorList()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + System::Windows::Forms::Cursor^ cursor = safe_cast(myEnum->Current); + cursorSelectionComboBox->Items->Add( cursor ); + } + } + + + private: + array^ CursorList() + { + + // Make an array of all the types of cursors in Windows Forms. + array^temp1 = {Cursors::AppStarting,Cursors::Arrow,Cursors::Cross,Cursors::Default,Cursors::Hand,Cursors::Help,Cursors::HSplit,Cursors::IBeam,Cursors::No,Cursors::NoMove2D,Cursors::NoMoveHoriz,Cursors::NoMoveVert,Cursors::PanEast,Cursors::PanNE,Cursors::PanNorth,Cursors::PanNW,Cursors::PanSE,Cursors::PanSouth,Cursors::PanSW,Cursors::PanWest,Cursors::SizeAll,Cursors::SizeNESW,Cursors::SizeNS,Cursors::SizeNWSE,Cursors::SizeWE,Cursors::UpArrow,Cursors::VSplit,Cursors::WaitCursor}; + return temp1; + } + + void cursorSelectionComboBox_SelectedIndexChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Set the cursor in the test panel to be the selected cursor style. + testPanel->Cursor = dynamic_cast(cursorSelectionComboBox->SelectedItem); + } + + void testPanel_CursorChanged( Object^ sender, System::EventArgs^ /*e*/ ) + { + + // Build up a String* containing the type of Object* sending the event, and the event. + String^ cursorEvent = String::Format( "[{0}]: {1}", sender->GetType(), "Cursor changed" ); + + // Record this event in the list view. + this->cursorEventViewer->Items->Add( cursorEvent ); + } + + }; + +} + + +[STAThread] +int main() +{ + Application::Run( gcnew MCursor::Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp new file mode 100644 index 00000000000..02ccd8a884c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.AddingNew/CPP/form1.cpp @@ -0,0 +1,181 @@ +// +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Globalization; +using namespace System::Windows::Forms; +// + +namespace DataConnectorAddingNewExample +{ + // + // This class implements a simple customer type. + public ref class DemoCustomer + { + private: + // These fields hold the values for the public properties. + Guid idValue; + String^ customerName; + String^ companyNameValue; + String^ phoneNumberValue; + + // The constructor is private to enforce the factory pattern. + DemoCustomer() + { + idValue = Guid::NewGuid(); + customerName = String::Empty; + companyNameValue = String::Empty; + phoneNumberValue = String::Empty; + customerName = "no data"; + companyNameValue = "no data"; + phoneNumberValue = "no data"; + } + + public: + // This is the public factory method. + static DemoCustomer^ CreateNewCustomer() + { + return gcnew DemoCustomer; + } + + property Guid ID + { + // This property represents an ID, suitable + // for use as a primary key in a database. + Guid get() + { + return this->idValue; + } + } + + property String^ CompanyName + { + String^ get() + { + return this->companyNameValue; + } + + void set(String^ value) + { + this->companyNameValue = value; + } + } + + property String^ PhoneNumber + { + String^ get() + { + return this->phoneNumberValue; + } + + void set(String^ value) + { + this->phoneNumberValue = value; + } + } + }; + // + + // + // This form demonstrates using a BindingSource to provide + // data from a collection of custom types + // to a DataGridView control. + public ref class MainForm: public System::Windows::Forms::Form + { + // + private: + + // This is the BindingSource that will provide data for + // the DataGridView control. + BindingSource^ customersBindingSource; + + // This is the DataGridView control + // that will display our data. + DataGridView^ customersDataGridView; + + // Set up the StatusBar for displaying ListChanged events. + StatusBar^ status; + // + + // + public: + + MainForm() + { + customersBindingSource = gcnew BindingSource; + customersDataGridView = gcnew DataGridView; + status = gcnew StatusBar; + + // Set up the form. + this->Size = System::Drawing::Size(600, 400); + this->Text = "BindingSource.AddingNew sample"; + this->Load += + gcnew EventHandler(this, &MainForm::OnMainFormLoad); + this->Controls->Add(status); + + // Set up the DataGridView control. + this->customersDataGridView->Dock = DockStyle::Fill; + this->Controls->Add(this->customersDataGridView); + + // Attach an event handler for the AddingNew event. + this->customersBindingSource->AddingNew += + gcnew AddingNewEventHandler(this, + &MainForm::OnCustomersBindingSourceAddingNew); + + // Attach an event handler for the ListChanged event. + this->customersBindingSource->ListChanged += + gcnew ListChangedEventHandler(this, + &MainForm::OnCustomersBindingSourceListChanged); + } + // + + // + private: + + void OnMainFormLoad(Object^ sender, EventArgs^ e) + { + // Add a DemoCustomer to cause a row to be displayed. + this->customersBindingSource->AddNew(); + + // Bind the BindingSource to the DataGridView + // control's DataSource. + this->customersDataGridView->DataSource = + this->customersBindingSource; + } + // + + // + // This event handler provides custom item-creation behavior. + void OnCustomersBindingSourceAddingNew(Object^ sender, + AddingNewEventArgs^ e) + { + e->NewObject = DemoCustomer::CreateNewCustomer(); + } + // + + // + // This event handler detects changes in the BindingSource + // list or changes to items within the list. + void OnCustomersBindingSourceListChanged(Object^ sender, + ListChangedEventArgs^ e) + { + status->Text = Convert::ToString(e->ListChangedType, + CultureInfo::CurrentCulture); + } + // + }; + // +} + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew DataConnectorAddingNewExample::MainForm); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp new file mode 100644 index 00000000000..b314e5e6fff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ItemChangedEventMode/CPP/form1.cpp @@ -0,0 +1,253 @@ +// +// +#using +#using +#using +#using +using namespace System; +using namespace System::Collections::Generic; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Data::SqlClient; +using namespace System::Drawing; +using namespace System::Windows::Forms; +// + +// +// This class implements a simple customer type. +public ref class DemoCustomer +{ +private: + // These fields hold the values for the public properties. + static Guid idValue = Guid::NewGuid(); + static String^ customerName = String::Empty; + static String^ companyNameValue = String::Empty; + static String^ phoneNumberValue = String::Empty; + + // The constructor is private to enforce the factory pattern. + DemoCustomer() + { + customerName = L"no data"; + companyNameValue = L"no data"; + phoneNumberValue = L"no data"; + } + +public: + // This is the public factory method. + static DemoCustomer^ CreateNewCustomer() + { + return gcnew DemoCustomer; + } + + property Guid ID + { + // This property represents an ID, suitable + // for use as a primary key in a database. + Guid get() + { + return this->idValue; + } + } + + property String^ CompanyName + { + String^ get() + { + return this->companyNameValue; + } + + void set( String^ value ) + { + this->companyNameValue = value; + } + } + + property String^ PhoneNumber + { + String^ get() + { + return this->phoneNumberValue; + } + + void set( String^ value ) + { + this->phoneNumberValue = value; + } + } +}; +// + +// +// This form demonstrates using the ItemChangedEventMode property +// of the BindingSource component to control which ListChanged +// events are raised when BindingSource component's underlying +// list is changed. +public ref class Form1: public System::Windows::Forms::Form +{ +private: + // + // This is the BindingSource that will provide data for + // the DataGridView control. + static BindingSource^ customersBindingSource = gcnew BindingSource; + + // This is the DataGridView control that will display our data. + static DataGridView^ customersDataGridView = gcnew DataGridView; + + // This panel holds the RadioButton controls. + static Panel^ buttonPanel = gcnew Panel; + + // These RadioButton controls manage the ItemChangedEventMode + // state of the BindingSource. + static RadioButton^ allRadioBtn = gcnew RadioButton; + static RadioButton^ currentRadioBtn = gcnew RadioButton; + static RadioButton^ noneRadioBtn = gcnew RadioButton; + + // this StatusBar control will display the ListChanged events. + static StatusBar^ status = gcnew StatusBar; + // + +public: + // + Form1() + { + // Set up the form. + this->Size = System::Drawing::Size( 800, 800 ); + this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); + + // Set up the RadioButton controls. + this->allRadioBtn->Text = L"All"; + this->allRadioBtn->Checked = true; + this->allRadioBtn->CheckedChanged += gcnew EventHandler( + this, &Form1::allRadioBtn_CheckedChanged ); + this->allRadioBtn->Dock = DockStyle::Top; + this->currentRadioBtn->Text = L"Current"; + this->currentRadioBtn->CheckedChanged += gcnew EventHandler( + this, &Form1::currentRadioBtn_CheckedChanged ); + this->currentRadioBtn->Dock = DockStyle::Top; + this->noneRadioBtn->Text = L"None"; + this->noneRadioBtn->CheckedChanged += gcnew EventHandler( + this, &Form1::noneRadioBtn_CheckedChanged ); + this->noneRadioBtn->Dock = DockStyle::Top; + this->buttonPanel->Controls->Add( this->allRadioBtn ); + this->buttonPanel->Controls->Add( this->currentRadioBtn ); + this->buttonPanel->Controls->Add( this->noneRadioBtn ); + this->buttonPanel->Dock = DockStyle::Bottom; + this->Controls->Add( this->buttonPanel ); + + // Set up the DataGridView control. + this->customersDataGridView->AllowUserToAddRows = true; + this->customersDataGridView->Dock = DockStyle::Fill; + this->Controls->Add( customersDataGridView ); + + // Add the StatusBar control to the form. + this->Controls->Add( status ); + + // Allow the user to add new items. + this->customersBindingSource->AllowNew = true; + + // Attach an event handler for the AddingNew event. + this->customersBindingSource->AddingNew += + gcnew AddingNewEventHandler( + this, &Form1::customersBindingSource_AddingNew ); + + // Attach an eventhandler for the ListChanged event. + this->customersBindingSource->ListChanged += + gcnew ListChangedEventHandler( + this, &Form1::customersBindingSource_ListChanged ); + + // Set the initial value of the ItemChangedEventMode property + // to report all ListChanged events. + this->customersBindingSource->ItemChangedEventMode = + ItemChangedEventMode::All; + + // Attach the BindingSource to the DataGridView. + this->customersDataGridView->DataSource = + this->customersBindingSource; + } + // + +private: + // + void Form1_Load( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create and populate the list of DemoCustomer objects + // which will supply data to the DataGridView. + List< DemoCustomer^ >^ customerList = gcnew List< DemoCustomer^ >; + customerList->Add( DemoCustomer::CreateNewCustomer() ); + customerList->Add( DemoCustomer::CreateNewCustomer() ); + customerList->Add( DemoCustomer::CreateNewCustomer() ); + + // Bind the list to the BindingSource. + this->customersBindingSource->DataSource = customerList; + } + // + + // + // This event handler provides custom item-creation behavior. + void customersBindingSource_AddingNew( + Object^ /*sender*/, + AddingNewEventArgs^ e ) + { + e->NewObject = DemoCustomer::CreateNewCustomer(); + } + // + + // + // This event handler detects changes in the BindingSource + // list or changes to items within the list. + void customersBindingSource_ListChanged( + Object^ /*sender*/, + ListChangedEventArgs^ e ) + { + status->Text = e->ListChangedType.ToString(); + } + // + + // + // These event handlers change the state of the BindingSource + // component's ItemChangedEventMode property. + void allRadioBtn_CheckedChanged( + Object^ /*sender*/, + EventArgs^ /*e*/ ) + { + if ( this->allRadioBtn->Checked ) + { + this->customersBindingSource->ItemChangedEventMode = + ItemChangedEventMode::All; + } + } + + void currentRadioBtn_CheckedChanged( + Object^ /*sender*/, + EventArgs^ /*e*/ ) + { + if ( this->currentRadioBtn->Checked ) + { + this->customersBindingSource->ItemChangedEventMode = + ItemChangedEventMode::Current; + } + } + + void noneRadioBtn_CheckedChanged( + Object^ /*sender*/, + EventArgs^ /*e*/ ) + { + if ( this->noneRadioBtn->Checked ) + { + this->customersBindingSource->ItemChangedEventMode = + ItemChangedEventMode::None; + } + } + // + +public: + [STAThread] + static void main() + { + Application::EnableVisualStyles(); + Application::EnableRTLMirroring(); + Application::Run( gcnew Form1 ); + } +}; +// +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp new file mode 100644 index 00000000000..a53ef06ab0f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetBindings/CPP/form1.cpp @@ -0,0 +1,169 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Text; +using namespace System::Xml; +using namespace System::Windows::Forms; +using namespace System::IO; + +namespace System_Windows_Forms_UpdateBinding +{ + public ref class Form1: public Form + { + public: + Form1() + { + InitializeComponent(); + } + + [STAThread] + static void Main() + { + Application::EnableVisualStyles(); + Application::Run( gcnew Form1 ); + } + + // + private: + void Form1_Load( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // The xml to bind to. + String^ xml = "" + + "WashingtonOlympia" + + "OregonSalem" + + "CaliforniaSacramento" + + "NevadaCarson City" + + ""; + + // Convert the xml string to bytes and load into a memory stream. + array^ xmlBytes = Encoding::UTF8->GetBytes( xml ); + MemoryStream^ stream = gcnew MemoryStream( xmlBytes,false ); + + // Create a DataSet and load the xml into it. + dataSet1->ReadXml( stream ); + + // Set the DataSource to the DataSet, and the DataMember + // to state. + bindingSource1->DataSource = dataSet1; + bindingSource1->DataMember = "state"; + + dataGridView1->DataSource = bindingSource1; + } + // + + // + private: + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ xml = "" + + "WashingtonOlympia " + + "Coast Rhododendron" + + "OregonSalem" + + "Oregon Grape" + + "CaliforniaSacramento" + + "California Poppy" + + "NevadaCarson City" + + "Sagebrush" + + ""; + + // Convert the xml string to bytes and load into a memory stream. + array^ xmlBytes = Encoding::UTF8->GetBytes( xml ); + MemoryStream^ stream = gcnew MemoryStream( xmlBytes,false ); + + // Create a DataSet and load the xml into it. + dataSet2->ReadXml( stream ); + + // Set the data source. + bindingSource1->DataSource = dataSet2; + bindingSource1->ResetBindings( true ); + } + // + + System::Windows::Forms::Button^ button1; + System::Windows::Forms::DataGridView^ dataGridView1; + System::Windows::Forms::BindingSource^ bindingSource1; + System::Data::DataSet^ dataSet1; + DataSet^ dataSet2; + + #pragma region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->dataGridView1 = gcnew System::Windows::Forms::DataGridView; + this->bindingSource1 = gcnew System::Windows::Forms::BindingSource; + this->dataSet1 = gcnew System::Data::DataSet; + this->dataSet2 = gcnew System::Data::DataSet; + ( (System::ComponentModel::ISupportInitialize^)(this->dataGridView1) )->BeginInit(); + ( (System::ComponentModel::ISupportInitialize^)(this->bindingSource1) )->BeginInit(); + ( (System::ComponentModel::ISupportInitialize^)(this->dataSet1) )->BeginInit(); + ( (System::ComponentModel::ISupportInitialize^)(this->dataSet2) )->BeginInit(); + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 98, 222 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // dataGridView1 + // + this->dataGridView1->Dock = System::Windows::Forms::DockStyle::Top; + this->dataGridView1->Location = System::Drawing::Point( 0, 0 ); + this->dataGridView1->Name = "dataGridView1"; + this->dataGridView1->Size = System::Drawing::Size( 292, 150 ); + this->dataGridView1->TabIndex = 1; + + // + // dataSet1 + // + this->dataSet1->DataSetName = "NewDataSet"; + this->dataSet1->Locale = gcnew System::Globalization::CultureInfo( "en-US" ); + + // + // dataSet2 + // + this->dataSet2->DataSetName = "NewDataSet"; + this->dataSet2->Locale = gcnew System::Globalization::CultureInfo( "en-US" ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Controls->Add( this->dataGridView1 ); + this->Controls->Add( this->button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); + ( (System::ComponentModel::ISupportInitialize^)(this->dataGridView1) )->EndInit(); + ( (System::ComponentModel::ISupportInitialize^)(this->bindingSource1) )->EndInit(); + ( (System::ComponentModel::ISupportInitialize^)(this->dataSet1) )->EndInit(); + ( (System::ComponentModel::ISupportInitialize^)(this->dataSet2) )->EndInit(); + this->ResumeLayout( false ); + } + #pragma endregion + }; +} + +int main() +{ + System_Windows_Forms_UpdateBinding::Form1::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp new file mode 100644 index 00000000000..ef99ada33f7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnector.ResetItem/CPP/form1.cpp @@ -0,0 +1,178 @@ +// +// +#using +#using +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Data::Common; +using namespace System::Data::SqlClient; +using namespace System::Diagnostics; +using namespace System::Drawing; +using namespace System::Windows::Forms; +// + +// +// This class implements a simple customer type. +public ref class DemoCustomer +{ +private: + // These fields hold the values for the public properties. + Guid idValue; + String^ customerName; + String^ companyNameValue; + String^ phoneNumberValue; + + // The constructor is private to enforce the factory pattern. + DemoCustomer() + { + idValue = Guid::NewGuid(); + customerName = L"no data"; + companyNameValue = L"no data"; + phoneNumberValue = L"no data"; + } + +public: + // This is the public factory method. + static DemoCustomer^ CreateNewCustomer() + { + return gcnew DemoCustomer; + } + + property Guid ID + { + // This property represents an ID, suitable + // for use as a primary key in a database. + Guid get() + { + return this->idValue; + } + } + + property String^ CompanyName + { + String^ get() + { + return this->companyNameValue; + } + + void set( String^ value ) + { + this->companyNameValue = value; + } + } + + property String^ PhoneNumber + { + String^ get() + { + return this->phoneNumberValue; + } + + void set( String^ value ) + { + this->phoneNumberValue = value; + } + } +}; +// + +// +// This form demonstrates using a BindingSource to bind +// a list to a DataGridView control. The list does not +// raise change notifications, so the ResetItem method +// on the BindingSource is used. +public ref class Form1: public System::Windows::Forms::Form +{ +private: + // + // This button causes the value of a list element to be changed. + Button^ changeItemBtn; + + // This is the DataGridView control that displays the contents + // of the list. + DataGridView^ customersDataGridView; + + // This is the BindingSource used to bind the list to the + // DataGridView control. + BindingSource^ customersBindingSource; + // + +public: + // + Form1() + { + changeItemBtn = gcnew Button; + customersDataGridView = gcnew DataGridView; + customersBindingSource = gcnew BindingSource; + + // Set up the "Change Item" button. + this->changeItemBtn->Text = L"Change Item"; + this->changeItemBtn->Dock = DockStyle::Bottom; + this->changeItemBtn->Click += gcnew EventHandler( + this, &Form1::changeItemBtn_Click ); + this->Controls->Add( this->changeItemBtn ); + + // Set up the DataGridView. + customersDataGridView->Dock = DockStyle::Top; + this->Controls->Add( customersDataGridView ); + this->Size = System::Drawing::Size( 800, 200 ); + this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); + } + // + +private: + // + void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Create and populate the list of DemoCustomer objects + // which will supply data to the DataGridView. + List< DemoCustomer^ >^ customerList = gcnew List< DemoCustomer^ >; + customerList->Add( DemoCustomer::CreateNewCustomer() ); + customerList->Add( DemoCustomer::CreateNewCustomer() ); + customerList->Add( DemoCustomer::CreateNewCustomer() ); + + // Bind the list to the BindingSource. + this->customersBindingSource->DataSource = customerList; + + // Attach the BindingSource to the DataGridView. + this->customersDataGridView->DataSource = + this->customersBindingSource; + } + // + + // + // This event handler changes the value of the CompanyName + // property for the first item in the list. + void changeItemBtn_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Get a reference to the list from the BindingSource. + List< DemoCustomer^ >^ customerList = + static_cast^>( + this->customersBindingSource->DataSource); + + // Change the value of the CompanyName property for the + // first item in the list. + customerList->default[ 0 ]->CompanyName = L"Tailspin Toys"; + + // Call ResetItem to alert the BindingSource that the + // list has changed. + this->customersBindingSource->ResetItem( 0 ); + } + // +}; + +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew Form1 ); +} +// +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp new file mode 100644 index 00000000000..70a8c181d3d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorBindingComplete/CPP/form1.cpp @@ -0,0 +1,215 @@ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Globalization; + +namespace DataConnectorBindingCompleteExample +{ + // + // + // Represents a business object that throws exceptions when + // invalid values are entered for some of its properties. + public ref class Part + { + private: + String^ name; + int number; + double price; + + public: + Part(String^ name, int number, double price) + { + PartName = name; + PartNumber = number; + PartPrice = price; + } + + property String^ PartName + { + String^ get() + { + return name; + } + + void set(String^ value) + { + if (value->Length <= 0) + { + throw gcnew Exception( + "Each part must have a name."); + } + else + { + name = value; + } + } + } + + property double PartPrice + { + double get() + { + return price; + } + + void set(double value) + { + price = value; + } + } + + property int PartNumber + { + int get() + { + return number; + } + + void set(int value) + { + if (value < 100) + { + throw gcnew Exception( + "Invalid part number." \ + "Part numbers must be " \ + "greater than 100."); + } + else + { + number = value; + } + } + } + + }; + + ref class MainForm: public Form + { + private: + BindingSource^ bindingSource; + TextBox^ partNameTextBox; + TextBox^ partNumberTextBox; + TextBox^ partPriceTextBox; + + public: + MainForm() + { + bindingSource = gcnew BindingSource; + partNameTextBox = gcnew TextBox; + partNumberTextBox = gcnew TextBox; + partPriceTextBox = gcnew TextBox; + + //Set up the textbox controls. + this->partNameTextBox->Location = Point(82, 13); + this->partNameTextBox->TabIndex = 1; + this->partNumberTextBox->Location = Point(81, 47); + this->partNumberTextBox->TabIndex = 2; + this->partPriceTextBox->Location = Point(81, 83); + this->partPriceTextBox->TabIndex = 3; + + // Add the textbox controls to the form + this->Controls->Add(this->partNumberTextBox); + this->Controls->Add(this->partNameTextBox); + this->Controls->Add(this->partPriceTextBox); + + // Handle the form's Load event. + this->Load += gcnew EventHandler(this, + &MainForm::OnMainFormLoad); + } + + private: + + // + void OnMainFormLoad(Object^ sender, EventArgs^ e) + { + // Set the DataSource of bindingSource to the Part type. + bindingSource->DataSource = Part::typeid; + + // Bind the textboxes to the properties of the Part type, + // enabling formatting. + partNameTextBox->DataBindings->Add( + "Text", bindingSource, "PartName", true); + partNumberTextBox->DataBindings->Add( + "Text", bindingSource, "PartNumber", true); + + //Bind the textbox to the PartPrice value + // with currency formatting. + partPriceTextBox->DataBindings->Add("Text", bindingSource, "PartPrice", true, + DataSourceUpdateMode::OnPropertyChanged, nullptr, "C"); + + // Handle the BindingComplete event for bindingSource and + // the partNameBinding. + bindingSource->BindingComplete += + gcnew BindingCompleteEventHandler(this, + &MainForm::OnBindingSourceBindingComplete); + bindingSource->BindingComplete += + gcnew BindingCompleteEventHandler(this, + &MainForm::OnPartNameBindingBindingComplete); + + // Add a new part to bindingSource. + bindingSource->Add(gcnew Part("Widget", 1234, 12.45)); + } + + // Handle the BindingComplete event to catch errors and + // exceptions in binding process. + void OnBindingSourceBindingComplete(Object^ sender, + BindingCompleteEventArgs^ e) + { + if (e->BindingCompleteState == + BindingCompleteState::Exception) + { + MessageBox::Show(String::Format( + CultureInfo::CurrentCulture, + "bindingSource: {0}", e->Exception->Message)); + } + + if (e->BindingCompleteState == + BindingCompleteState::DataError) + { + MessageBox::Show(String::Format( + CultureInfo::CurrentCulture, + "bindingSource: {0}", e->Exception->Message)); + } + } + + // Handle the BindingComplete event to catch errors and + // exceptions in binding process. + void OnPartNameBindingBindingComplete(Object^ sender, + BindingCompleteEventArgs^ e) + { + if (e->BindingCompleteState == + BindingCompleteState::Exception) + { + MessageBox::Show(String::Format( + CultureInfo::CurrentCulture, + "PartNameBinding: {0}", e->Exception->Message)); + } + + if (e->BindingCompleteState == + BindingCompleteState::DataError) + { + MessageBox::Show(String::Format( + CultureInfo::CurrentCulture, + "PartNameBinding: {0}", e->Exception->Message)); + } + } + // + }; + +// +// +} + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew + DataConnectorBindingCompleteExample::MainForm()); +} + + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp new file mode 100644 index 00000000000..e8117739846 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataConnectorCurrent/cpp/form1.cpp @@ -0,0 +1,120 @@ +#pragma region Using directives + +#using +#using +#using +#using +using namespace System; +using namespace System::Collections::Generic; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Windows::Forms; + +#pragma endregion + +namespace DataConnectors +{ + ref class Form1 : public Form + { + private: + BindingSource^ bindingSource1; + Button^ moveNextButton; + + public: + Form1() + { + this->Load += gcnew EventHandler(this, &Form1::Form1_Load); + this->Paint += gcnew PaintEventHandler(this, &Form1::Form1_Paint); + this->bindingSource1 = gcnew BindingSource(); + this->moveNextButton = gcnew Button(); + moveNextButton->Text = "Move Next"; + this->moveNextButton->Location = System::Drawing::Point(147, 129); + this->moveNextButton->Click += gcnew System::EventHandler( + this,&Form1::moveNextButton_Click); + + this->ClientSize = System::Drawing::Size(292, 266); + this->Controls->Add(this->moveNextButton); + + } + // The following snippet demonstrates the BindingSource.MoveNext, + // BindingSource.Current,BindingSource.CurrentItem, + // BindingSource.Position and the BindingSourceItem.Value members. + + // To run this example paste the code into a form that contains a + // BindingSource named bindingSource1; and a button named moveNextButton. + // Associate the Form1_Load and the Form1_Paint method with the + // load and paint events for the form, and the moveNextButton_click + // method with the click event for moveNextButton. + + // + void Form1_Load(Object^ sender, EventArgs^ e) + { + // Set the data source to the Brush type and populate + // bindingSource1; with some brushes. + bindingSource1->DataSource = System::Drawing::Brush::typeid; + bindingSource1->Add( + gcnew TextureBrush(gcnew Bitmap(Button::typeid, "Button.bmp"))); + bindingSource1->Add(gcnew HatchBrush(HatchStyle::Cross, Color::Red)); + bindingSource1->Add(gcnew SolidBrush(Color::Blue)); + } + + + private: + void moveNextButton_Click(Object^ sender, EventArgs^ e) + { + // If you are not at the end of the list, move to the next item + // in the BindingSource. + if (bindingSource1->Position + 1 < bindingSource1->Count) + { + bindingSource1->MoveNext(); + } + // Otherwise, move back to the first item. + else + { + bindingSource1->MoveFirst(); + } + // Force the form to repaint. + this->Invalidate(); + } + + void Form1_Paint(Object^ sender, PaintEventArgs^ e) + { + // Get the current item in the BindingSource. + Brush^ item = (Brush^) bindingSource1->Current; + + // If the current type is a TextureBrush, fill an ellipse. + if (item->GetType() == TextureBrush::typeid) + { + e->Graphics->FillEllipse(item,e->ClipRectangle); + } + // If the current type is a HatchBrush, fill a triangle. + else if (item->GetType() == HatchBrush::typeid) + { + + e->Graphics->FillPolygon(item, + gcnew array {*gcnew Point(0, 0), + *gcnew Point(0, 200), + *gcnew Point(200, 0)}); + } + // Otherwise, fill a rectangle. + else + { + e->Graphics->FillRectangle( + (Brush^)bindingSource1->Current, e->ClipRectangle); + } + } + + // + }; +} + + +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew DataConnectors::Form1()); +} + + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp new file mode 100644 index 00000000000..22dec589892 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.AutoSizing/CPP/autosizing.cpp @@ -0,0 +1,303 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class AutoSizing: public System::Windows::Forms::Form +{ +private: + FlowLayoutPanel^ flowLayoutPanel1; + Button^ button1; + Button^ button2; + Button^ button3; + Button^ button4; + Button^ button5; + Button^ button6; + Button^ button7; + Button^ button8; + Button^ button9; + Button^ button10; + Button^ button11; + +public: + AutoSizing() + { + button1 = gcnew Button; + button2 = gcnew Button; + button3 = gcnew Button; + button4 = gcnew Button; + button5 = gcnew Button; + button6 = gcnew Button; + button7 = gcnew Button; + button8 = gcnew Button; + button9 = gcnew Button; + button10 = gcnew Button; + button11 = gcnew Button; + thirdColumnHeader = "Main Ingredients"; + boringMeatloaf = "ground beef"; + boringMeatloafRanking = "*"; + otherRestaurant = "Gomes's Saharan Sushi"; + currentLayoutName = "DataGridView.AutoSizeRowsMode is currently: "; + InitializeComponent(); + this->Load += gcnew EventHandler( this, &AutoSizing::InitializeDataGridView ); + AddDirections(); + AddButton( button1, "Reset", gcnew EventHandler( this, &AutoSizing::ResetToDisorder ) ); + AddButton( button2, "Change Column 3 Header", gcnew EventHandler( this, &AutoSizing::ChangeColumn3Header ) ); + AddButton( button3, "Change Meatloaf Recipe", gcnew EventHandler( this, &AutoSizing::ChangeMeatloafRecipe ) ); + AddButton( button4, "Change Restaurant 2", gcnew EventHandler( this, &AutoSizing::ChangeRestaurant ) ); + AddButtonsForAutomaticResizing(); + } + + +private: + void AddDirections() + { + Label^ directions = gcnew Label; + directions->AutoSize = true; + String^ newLine = Environment::NewLine; + directions->Text = String::Format( "Press the buttons that start {0}with 'Change' to see how different sizing {1}modes deal with content changes.", newLine, newLine ); + flowLayoutPanel1->Controls->Add( directions ); + } + + void InitializeComponent() + { + flowLayoutPanel1 = gcnew FlowLayoutPanel; + flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + flowLayoutPanel1->Location = System::Drawing::Point( 492, 0 ); + flowLayoutPanel1->AutoSize = true; + flowLayoutPanel1->TabIndex = 1; + ClientSize = System::Drawing::Size( 674, 419 ); + Controls->Add( flowLayoutPanel1 ); + Text = this->GetType()->Name; + AutoSize = true; + } + + System::Drawing::Size startingSize; + String^ thirdColumnHeader; + String^ boringMeatloaf; + String^ boringMeatloafRanking; + bool boringRecipe; + bool shortMode; + DataGridView^ dataGridView1; + String^ otherRestaurant; + void InitializeDataGridView( Object^ /*ignored*/, EventArgs^ /*ignoredToo*/ ) + { + dataGridView1 = gcnew System::Windows::Forms::DataGridView; + Controls->Add( dataGridView1 ); + startingSize = System::Drawing::Size( 450, 400 ); + dataGridView1->Size = startingSize; + dataGridView1->AutoSizeRowsModeChanged += gcnew DataGridViewAutoSizeModeEventHandler( this, &AutoSizing::WatchRowsModeChanges ); + AddLabels(); + SetUpColumns(); + PopulateRows(); + shortMode = false; + boringRecipe = true; + } + + void SetUpColumns() + { + dataGridView1->ColumnCount = 4; + dataGridView1->ColumnHeadersVisible = true; + DataGridViewCellStyle ^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( "Verdana",10,FontStyle::Bold ); + dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + dataGridView1->Columns[ 0 ]->Name = "Recipe"; + dataGridView1->Columns[ 1 ]->Name = "Category"; + dataGridView1->Columns[ 2 ]->Name = thirdColumnHeader; + dataGridView1->Columns[ 3 ]->Name = "Rating"; + } + + void PopulateRows() + { + array^row1 = {"Meatloaf","Main Dish",boringMeatloaf,boringMeatloafRanking}; + array^row2 = {"Key Lime Pie","Dessert","lime juice, evaporated milk","****"}; + array^row3 = {"Orange-Salsa Pork Chops","Main Dish","pork chops, salsa, orange juice","****"}; + array^row4 = {"Black Bean and Rice Salad","Salad","black beans, brown rice","****"}; + array^row5 = {"Chocolate Cheesecake","Dessert","cream cheese","***"}; + array^row6 = {"Black Bean Dip","Appetizer","black beans, sour cream","***"}; + array^rows = {row1,row2,row3,row4,row5,row6}; + IEnumerator^ myEnum = rows->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + array^row = safe_cast^>(myEnum->Current); + dataGridView1->Rows->Add( row ); + } + + IEnumerator^ myEnum1 = safe_cast(dataGridView1->Rows)->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + DataGridViewRow ^ row = safe_cast(myEnum1->Current); + if ( row->IsNewRow ) + break; + row->HeaderCell->Value = String::Format( "Restaurant {0}", row->Index ); + } + } + + void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) + { + button->Click += handler; + button->Text = buttonLabel; + button->AutoSize = true; + button->TabIndex = flowLayoutPanel1->Controls->Count; + flowLayoutPanel1->Controls->Add( button ); + } + + void ResetToDisorder( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Controls->Remove( dataGridView1 ); + dataGridView1->DataGridView::~DataGridView(); + InitializeDataGridView( nullptr, nullptr ); + } + + void ChangeColumn3Header( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Toggle( &shortMode ); + if ( shortMode ) + dataGridView1->Columns[ 2 ]->HeaderText = "S"; + else + dataGridView1->Columns[ 2 ]->HeaderText = thirdColumnHeader; + } + + Boolean Toggle( interior_ptr toggleThis ) + { + *toggleThis = ! *toggleThis; + return *toggleThis; + } + + void ChangeMeatloafRecipe( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Toggle( &boringRecipe ); + if ( boringRecipe ) + SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); + else + { + String^ greatMeatloafRecipe = "1 lb. lean ground beef, " + "1/2 cup bread crumbs, 1/4 cup ketchup," + "1/3 tsp onion powder, " + "1 clove of garlic, 1/2 pack onion soup mix," + " dash of your favorite BBQ Sauce"; + SetMeatloaf( greatMeatloafRecipe, "***" ); + } + } + + void ChangeRestaurant( Object^ /*sender*/, EventArgs^ /*ignored*/ ) + { + if ( dataGridView1->Rows[ 2 ]->HeaderCell->Value->ToString()->Equals( otherRestaurant ) ) + dataGridView1->Rows[ 2 ]->HeaderCell->Value = "Restaurant 2"; + else + dataGridView1->Rows[ 2 ]->HeaderCell->Value = otherRestaurant; + } + + void SetMeatloaf( String^ recipe, String^ rating ) + { + dataGridView1->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; + dataGridView1->Rows[ 0 ]->Cells[ 3 ]->Value = rating; + } + + String^ currentLayoutName; + void AddLabels() + { + Label^ current = dynamic_cast(flowLayoutPanel1->Controls[ currentLayoutName ]); + if ( current == nullptr ) + { + current = gcnew Label; + current->AutoSize = true; + current->Name = currentLayoutName; + current->Text = String::Concat( currentLayoutName, dataGridView1->AutoSizeRowsMode ); + flowLayoutPanel1->Controls->Add( current ); + } + } + + void AddButtonsForAutomaticResizing() + { + AddButton( button5, "Keep Column Headers Sized", gcnew EventHandler( this, &AutoSizing::ColumnHeadersHeightSizeMode ) ); + AddButton( button6, "Keep Row Headers Sized", gcnew EventHandler( this, &AutoSizing::RowHeadersWidthSizeMode ) ); + AddButton( button7, "Keep Rows Sized", gcnew EventHandler( this, &AutoSizing::AutoSizeRowsMode ) ); + AddButton( button8, "Keep Row Headers Sized with RowsMode", gcnew EventHandler( this, &AutoSizing::AutoSizeRowHeadersUsingAllHeadersMode ) ); + AddButton( button9, "Disable AutoSizeRowsMode", gcnew EventHandler( this, &AutoSizing::DisableAutoSizeRowsMode ) ); + AddButton( button10, "AutoSize third column by rows", gcnew EventHandler( this, &AutoSizing::AutoSizeOneColumn ) ); + AddButton( button11, "AutoSize third column by rows and headers", gcnew EventHandler( this, &AutoSizing::AutoSizeOneColumnIncludingHeaders ) ); + } + + + // + void ColumnHeadersHeightSizeMode( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; + } + // + // + void RowHeadersWidthSizeMode( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders; + } + + // + // + void AutoSizeRowsMode( Object^ /*sender*/, EventArgs^ /*es*/ ) + { + dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::AllCells; + } + // + void AutoSizeRowHeadersUsingAllHeadersMode( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::AllHeaders; + } + + + // + void WatchRowsModeChanges( Object^ /*sender*/, DataGridViewAutoSizeModeEventArgs^ modeEvent ) + { + Label^ label = dynamic_cast(flowLayoutPanel1->Controls[ currentLayoutName ]); + if ( modeEvent->PreviousModeAutoSized ) + { + label->Text = String::Format( "changed to a different {0}{1}", label->Name, dataGridView1->AutoSizeRowsMode ); + } + else + { + label->Text = String::Concat( label->Name, dataGridView1->AutoSizeRowsMode ); + } + } + + + // + void DisableAutoSizeRowsMode( Object^ /*sender*/, EventArgs^ /*modeEvent*/ ) + { + dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::None; + } + + + // + void AutoSizeOneColumn( Object^ /*sender*/, EventArgs^ /*theEvent*/ ) + { + DataGridViewColumn^ column = dataGridView1->Columns[ 2 ]; + column->AutoSizeMode = DataGridViewAutoSizeColumnMode::DisplayedCellsExceptHeader; + } + + + // + void AutoSizeOneColumnIncludingHeaders( Object^ /*sender*/, EventArgs^ /*theEvent*/ ) + { + DataGridViewColumn^ column = dataGridView1->Columns[ 2 ]; + column->AutoSizeMode = DataGridViewAutoSizeColumnMode::AllCells; + } + +}; + + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew AutoSizing ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp new file mode 100644 index 00000000000..346456ec480 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewBandDemo.cpp @@ -0,0 +1,328 @@ + +// +#using +#using +#using +#using + +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System; +using namespace System::Collections; +public ref class DataGridViewBandDemo: public Form +{ +private: + +#pragma region S " form setup " + +public: + DataGridViewBandDemo() + { + Button1 = gcnew Button; + Button2 = gcnew Button; + Button3 = gcnew Button; + Button4 = gcnew Button; + Button5 = gcnew Button; + Button6 = gcnew Button; + Button7 = gcnew Button; + Button8 = gcnew Button; + Button9 = gcnew Button; + Button10 = gcnew Button; + FlowLayoutPanel1 = gcnew FlowLayoutPanel; + InitializeComponent(); + thirdColumnHeader = L"Main Ingredients"; + boringMeatloaf = L"ground beef"; + boringMeatloafRanking = L"*"; + AddButton( Button1, L"Reset", gcnew EventHandler( this, &DataGridViewBandDemo::Button1_Click ) ); + AddButton( Button2, L"Change Column 3 Header", gcnew EventHandler( this, &DataGridViewBandDemo::Button2_Click ) ); + AddButton( Button3, L"Change Meatloaf Recipe", gcnew EventHandler( this, &DataGridViewBandDemo::Button3_Click ) ); + AddAdditionalButtons(); + InitializeDataGridView(); + } + + DataGridView^ dataGridView; + Button^ Button1; + Button^ Button2; + Button^ Button3; + Button^ Button4; + Button^ Button5; + Button^ Button6; + Button^ Button7; + Button^ Button8; + Button^ Button9; + Button^ Button10; + FlowLayoutPanel^ FlowLayoutPanel1; + +private: + void InitializeComponent() + { + FlowLayoutPanel1->Location = Point(454,0); + FlowLayoutPanel1->AutoSize = true; + FlowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + AutoSize = true; + ClientSize = System::Drawing::Size( 614, 360 ); + FlowLayoutPanel1->Name = L"flowlayoutpanel"; + Controls->Add( this->FlowLayoutPanel1 ); + Text = this->GetType()->Name; + } + + +#pragma endregion +#pragma region S " setup DataGridView " + String^ thirdColumnHeader; + String^ boringMeatloaf; + String^ boringMeatloafRanking; + bool boringRecipe; + Boolean shortMode; + void InitializeDataGridView() + { + dataGridView = gcnew System::Windows::Forms::DataGridView; + Controls->Add( dataGridView ); + dataGridView->Size = System::Drawing::Size( 300, 200 ); + + // Create an unbound DataGridView by declaring a + // column count. + dataGridView->ColumnCount = 4; + AdjustDataGridViewSizing(); + + // Set the column header style. + DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); + dataGridView->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + + // Set the column header names. + dataGridView->Columns[ 0 ]->Name = L"Recipe"; + dataGridView->Columns[ 1 ]->Name = L"Category"; + dataGridView->Columns[ 2 ]->Name = thirdColumnHeader; + dataGridView->Columns[ 3 ]->Name = L"Rating"; + + // Populate the rows. + array^row1 = gcnew array{ + L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking + }; + array^row2 = gcnew array{ + L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****" + }; + array^row3 = gcnew array{ + L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****" + }; + array^row4 = gcnew array{ + L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****" + }; + array^row5 = gcnew array{ + L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***" + }; + array^row6 = gcnew array{ + L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***" + }; + array^rows = gcnew array{ + row1,row2,row3,row4,row5,row6 + }; + System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + array^rowArray = safe_cast^>(myEnum->Current); + dataGridView->Rows->Add( rowArray ); + } + + PostRowCreation(); + shortMode = false; + boringRecipe = true; + } + + void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) + { + FlowLayoutPanel1->Controls->Add( button ); + button->TabIndex = FlowLayoutPanel1->Controls->Count; + button->Text = buttonLabel; + button->AutoSize = true; + button->Click += handler; + } + + + // Reset columns to initial disorderly arrangement. + void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Controls->Remove( dataGridView ); + dataGridView->~DataGridView(); + InitializeDataGridView(); + } + + + // Change the header in column three. + void Button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Toggle( &shortMode ); + if ( shortMode ) + { + dataGridView->Columns[ 2 ]->HeaderText = L"S"; + } + else + { + dataGridView->Columns[ 2 ]->HeaderText = thirdColumnHeader; + } + } + + void Toggle( interior_ptr toggleThis ) + { + *toggleThis = ! *toggleThis; + } + + + // Change the meatloaf recipe. + void Button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Toggle( &boringRecipe ); + if ( boringRecipe ) + { + SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); + } + else + { + String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " + L"1/2 cup bread crumbs, 1/4 cup ketchup," + L"1/3 tsp onion powder, " + L"1 clove of garlic, 1/2 pack onion soup mix " + L" dash of your favorite BBQ Sauce"; + SetMeatloaf( greatMeatloafRecipe, L"***" ); + } + } + + void SetMeatloaf( String^ recipe, String^ rating ) + { + dataGridView->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; + dataGridView->Rows[ 0 ]->Cells[ 3 ]->Value = rating; + } + + +#pragma endregion +#pragma region S " demonstration code " + void AddAdditionalButtons() + { + AddButton( Button4, L"Freeze First Row", gcnew EventHandler( this, &DataGridViewBandDemo::Button4_Click ) ); + AddButton( Button5, L"Freeze Second Column", gcnew EventHandler( this, &DataGridViewBandDemo::Button5_Click ) ); + AddButton( Button6, L"Hide Salad Row", gcnew EventHandler( this, &DataGridViewBandDemo::Button6_Click ) ); + AddButton( Button7, L"Disable First Column Resizing", gcnew EventHandler( this, &DataGridViewBandDemo::Button7_Click ) ); + AddButton( Button8, L"Make ReadOnly", gcnew EventHandler( this, &DataGridViewBandDemo::Button8_Click ) ); + AddButton( Button9, L"Style Using Tag", gcnew EventHandler( this, &DataGridViewBandDemo::Button9_Click ) ); + } + + void AdjustDataGridViewSizing() + { + dataGridView->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::AllCells; + dataGridView->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; + } + + + // + // Freeze the first row. + void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + FreezeBand( dataGridView->Rows[ 0 ] ); + } + + void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + FreezeBand( dataGridView->Columns[ 1 ] ); + } + + void FreezeBand( DataGridViewBand^ band ) + { + band->Frozen = true; + DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle; + style->BackColor = Color::WhiteSmoke; + band->DefaultCellStyle = style; + } + + + // + // + // Hide a band of cells. + void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DataGridViewBand^ band = dataGridView->Rows[ 3 ]; + band->Visible = false; + } + + + // + // + // Turn off user's ability to resize a column. + void Button7_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + DataGridViewBand^ band = dataGridView->Columns[ 0 ]; + band->Resizable = DataGridViewTriState::False; + } + + + // + // + // Make the entire DataGridView read only. + void Button8_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + System::Collections::IEnumerator^ myEnum = dataGridView->Columns->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridViewBand^ band = safe_cast(myEnum->Current); + band->ReadOnly = true; + } + } + + + // + // + void PostRowCreation() + { + SetBandColor( dataGridView->Columns[ 0 ], Color::CadetBlue ); + SetBandColor( dataGridView->Rows[ 1 ], Color::Coral ); + SetBandColor( dataGridView->Columns[ 2 ], Color::DodgerBlue ); + } + + void SetBandColor( DataGridViewBand^ band, Color color ) + { + band->Tag = color; + } + + + // Color the bands by the value stored in their tag. + void Button9_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + IEnumerator^ myEnum1 = dataGridView->Columns->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + DataGridViewBand^ band = static_cast(myEnum1->Current); + if ( band->Tag != nullptr ) + { + band->DefaultCellStyle->BackColor = *dynamic_cast(band->Tag); + } + } + + IEnumerator^ myEnum2 = safe_cast(dataGridView->Rows)->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + DataGridViewBand^ band = safe_cast(myEnum2->Current); + if ( band->Tag != nullptr ) + { + band->DefaultCellStyle->BackColor = *dynamic_cast(band->Tag); + } + } + } + + + // +#pragma endregion + +public: + static void Main() + { + Application::Run( gcnew DataGridViewBandDemo ); + } +}; + +int main() +{ + DataGridViewBandDemo::Main(); +} + +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp new file mode 100644 index 00000000000..7266b7188d9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewColumnDemo.cpp @@ -0,0 +1,441 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::Collections; +public ref class DataGridViewColumnDemo: public Form +{ +private: + +#pragma region S "set up form" + +public: + DataGridViewColumnDemo() + { + Button1 = gcnew Button; + Button2 = gcnew Button; + Button3 = gcnew Button; + Button4 = gcnew Button; + Button5 = gcnew Button; + Button6 = gcnew Button; + Button7 = gcnew Button; + Button8 = gcnew Button; + Button9 = gcnew Button; + Button10 = gcnew Button; + FlowLayoutPanel1 = gcnew FlowLayoutPanel; + thirdColumnHeader = L"Main Ingredients"; + boringMeatloaf = L"ground beef"; + boringMeatloafRanking = L"*"; + toolStripItem1 = gcnew ToolStripMenuItem; + InitializeComponent(); + AddButton( Button1, L"Reset", gcnew EventHandler( this, &DataGridViewColumnDemo::ResetToDisorder ) ); + AddButton( Button2, L"Change Column 3 Header", gcnew EventHandler( this, &DataGridViewColumnDemo::ChangeColumn3Header ) ); + AddButton( Button3, L"Change Meatloaf Recipe", gcnew EventHandler( this, &DataGridViewColumnDemo::ChangeMeatloafRecipe ) ); + AddAdditionalButtons(); + InitializeDataGridView(); + } + + DataGridView^ dataGridView; + Button^ Button1; + Button^ Button2; + Button^ Button3; + Button^ Button4; + Button^ Button5; + Button^ Button6; + Button^ Button7; + Button^ Button8; + Button^ Button9; + Button^ Button10; + FlowLayoutPanel^ FlowLayoutPanel1; + +private: + void InitializeComponent() + { + FlowLayoutPanel1->Location = Point(454,0); + FlowLayoutPanel1->AutoSize = true; + FlowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + AutoSize = true; + ClientSize = System::Drawing::Size( 614, 360 ); + FlowLayoutPanel1->Name = L"flowlayoutpanel"; + Controls->Add( this->FlowLayoutPanel1 ); + Text = this->GetType()->Name; + } + + +#pragma endregion +#pragma region S " set up DataGridView " + String^ thirdColumnHeader; + String^ boringMeatloaf; + String^ boringMeatloafRanking; + bool boringRecipe; + bool shortMode; + void InitializeDataGridView() + { + dataGridView = gcnew System::Windows::Forms::DataGridView; + Controls->Add( dataGridView ); + dataGridView->Size = System::Drawing::Size( 300, 200 ); + + // Create an unbound DataGridView by declaring a + // column count. + dataGridView->ColumnCount = 4; + AdjustDataGridViewSizing(); + + // Set the column header style. + DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); + dataGridView->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + + // Set the column header names. + dataGridView->Columns[ 0 ]->Name = L"Recipe"; + dataGridView->Columns[ 1 ]->Name = L"Category"; + dataGridView->Columns[ 2 ]->Name = thirdColumnHeader; + dataGridView->Columns[ 3 ]->Name = L"Rating"; + criteriaLabel = L"Column 3 sizing criteria: "; + PostColumnCreation(); + + // Populate the rows. + array^row1 = gcnew array{ + L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking + }; + array^row2 = gcnew array{ + L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****" + }; + array^row3 = gcnew array{ + L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****" + }; + array^row4 = gcnew array{ + L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****" + }; + array^row5 = gcnew array{ + L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***" + }; + array^row6 = gcnew array{ + L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***" + }; + array^rows = gcnew array{ + row1,row2,row3,row4,row5,row6 + }; + System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + array^rowArray = safe_cast^>(myEnum->Current); + dataGridView->Rows->Add( rowArray ); + } + + shortMode = false; + boringRecipe = true; + } + + void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) + { + FlowLayoutPanel1->Controls->Add( button ); + button->TabIndex = FlowLayoutPanel1->Controls->Count; + button->Text = buttonLabel; + button->AutoSize = true; + button->Click += handler; + } + + void ResetToDisorder( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Controls->Remove( dataGridView ); + dataGridView->~DataGridView(); + InitializeDataGridView(); + } + + void ChangeColumn3Header( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Toggle( &shortMode ); + if ( shortMode ) + { + dataGridView->Columns[ 2 ]->HeaderText = L"S"; + } + else + { + dataGridView->Columns[ 2 ]->HeaderText = thirdColumnHeader; + } + } + + void Toggle( interior_ptr toggleThis ) + { + *toggleThis = ! *toggleThis; + } + + void ChangeMeatloafRecipe( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Toggle( &boringRecipe ); + if ( boringRecipe ) + { + SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); + } + else + { + String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " + L"1/2 cup bread crumbs, 1/4 cup ketchup," + L"1/3 tsp onion powder, " + L"1 clove of garlic, 1/2 pack onion soup mix " + L" dash of your favorite BBQ Sauce"; + SetMeatloaf( greatMeatloafRecipe, L"***" ); + } + } + + void SetMeatloaf( String^ recipe, String^ rating ) + { + dataGridView->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; + dataGridView->Rows[ 0 ]->Cells[ 3 ]->Value = rating; + } + + +#pragma endregion + +public: + static void Main() + { + Application::Run( gcnew DataGridViewColumnDemo ); + } + + +#pragma region S " demonstration code " + +private: + void PostColumnCreation() + { + AddContextLabel(); + AddCriteriaLabel(); + CustomizeCellsInThirdColumn(); + AddContextMenu(); + SetDefaultCellInFirstColumn(); + ToolTips(); + dataGridView->CellMouseEnter += gcnew DataGridViewCellEventHandler( this, &DataGridViewColumnDemo::dataGridView_CellMouseEnter ); + dataGridView->AutoSizeColumnModeChanged += gcnew DataGridViewAutoSizeColumnModeEventHandler( this, &DataGridViewColumnDemo::dataGridView_AutoSizeColumnModeChanged ); + } + + String^ criteriaLabel; + void AddCriteriaLabel() + { + AddLabelToPanelIfNotAlreadyThere( criteriaLabel, String::Concat( criteriaLabel, dataGridView->Columns[ 2 ]->AutoSizeMode, L"." ) ); + } + + void AddContextLabel() + { + String^ labelName = L"label"; + AddLabelToPanelIfNotAlreadyThere( labelName, L"Use shortcut menu to change cell color." ); + } + + void AddLabelToPanelIfNotAlreadyThere( String^ labelName, String^ labelText ) + { + Label^ label; + if ( FlowLayoutPanel1->Controls[ labelName ] == nullptr ) + { + label = gcnew Label; + label->AutoSize = true; + label->Name = labelName; + label->BackColor = Color::Bisque; + FlowLayoutPanel1->Controls->Add( label ); + } + else + { + label = dynamic_cast(FlowLayoutPanel1->Controls[ labelName ]); + } + + label->Text = labelText; + } + + + // + void CustomizeCellsInThirdColumn() + { + int thirdColumn = 2; + DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ]; + DataGridViewCell^ cell = gcnew DataGridViewTextBoxCell; + cell->Style->BackColor = Color::Wheat; + column->CellTemplate = cell; + } + + + // + // + ToolStripMenuItem^ toolStripItem1; + void AddContextMenu() + { + toolStripItem1->Text = L"Redden"; + toolStripItem1->Click += gcnew EventHandler( this, &DataGridViewColumnDemo::toolStripItem1_Click ); + System::Windows::Forms::ContextMenuStrip^ strip = gcnew System::Windows::Forms::ContextMenuStrip; + IEnumerator^ myEnum = dataGridView->Columns->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridViewColumn^ column = safe_cast(myEnum->Current); + column->ContextMenuStrip = strip; + column->ContextMenuStrip->Items->Add( toolStripItem1 ); + } + } + + DataGridViewCellEventArgs^ mouseLocation; + + // Change the cell's color. + void toolStripItem1_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + dataGridView->Rows[ mouseLocation->RowIndex ]->Cells[ mouseLocation->ColumnIndex ]->Style->BackColor = Color::Red; + } + + + // Deal with hovering over a cell. + void dataGridView_CellMouseEnter( Object^ /*sender*/, DataGridViewCellEventArgs^ location ) + { + mouseLocation = location; + } + + + // + // + void SetDefaultCellInFirstColumn() + { + DataGridViewColumn^ firstColumn = dataGridView->Columns[ 0 ]; + DataGridViewCellStyle^ cellStyle = gcnew DataGridViewCellStyle; + cellStyle->BackColor = Color::Thistle; + firstColumn->DefaultCellStyle = cellStyle; + } + + + // + // + void ToolTips() + { + DataGridViewColumn^ firstColumn = dataGridView->Columns[ 0 ]; + DataGridViewColumn^ thirdColumn = dataGridView->Columns[ 2 ]; + firstColumn->ToolTipText = L"This column uses a default cell."; + thirdColumn->ToolTipText = L"This column uses a template cell." + L" Style changes to one cell apply to all cells."; + } + + + // + void AddAdditionalButtons() + { + AddButton( Button4, L"Set Minimum Width of Column Two", gcnew EventHandler( this, &DataGridViewColumnDemo::Button4_Click ) ); + AddButton( Button5, L"Set Width of Column One", gcnew EventHandler( this, &DataGridViewColumnDemo::Button5_Click ) ); + AddButton( Button6, L"Autosize Third Column", gcnew EventHandler( this, &DataGridViewColumnDemo::Button6_Click ) ); + AddButton( Button7, L"Add Thick Vertical Edge", gcnew EventHandler( this, &DataGridViewColumnDemo::Button7_Click ) ); + AddButton( Button8, L"Style and Number Columns", gcnew EventHandler( this, &DataGridViewColumnDemo::Button8_Click ) ); + AddButton( Button9, L"Change Column Header Text", gcnew EventHandler( this, &DataGridViewColumnDemo::Button9_Click ) ); + AddButton( Button10, L"Swap First and Last Columns", gcnew EventHandler( this, &DataGridViewColumnDemo::Button10_Click ) ); + } + + void AdjustDataGridViewSizing() + { + dataGridView->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; + } + + + // + //Set the minimum width. + void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DataGridViewColumn^ column = dataGridView->Columns[ 1 ]; + column->MinimumWidth = 40; + } + + + // + // + // Set the width. + void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DataGridViewColumn^ column = dataGridView->Columns[ 0 ]; + column->Width = 60; + } + + + // + // + // AutoSize the third column. + void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DataGridViewColumn^ column = dataGridView->Columns[ 2 ]; + column->AutoSizeMode = DataGridViewAutoSizeColumnMode::DisplayedCells; + } + + + // + // + // Set the vertical edge. + void Button7_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + int thirdColumn = 2; + + // int edgeThickness = 5; + DataGridViewColumn^ column = dataGridView->Columns[ thirdColumn ]; + column->DividerWidth = 10; + } + + + // + // + // Style and number columns. + void Button8_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle; + style->Alignment = DataGridViewContentAlignment::MiddleCenter; + style->ForeColor = Color::IndianRed; + style->BackColor = Color::Ivory; + IEnumerator^ myEnum1 = dataGridView->Columns->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + DataGridViewColumn^ column = safe_cast(myEnum1->Current); + column->HeaderCell->Value = column->Index.ToString(); + column->HeaderCell->Style = style; + } + } + + + // + // + // Change the text in the column header. + void Button9_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + IEnumerator^ myEnum2 = dataGridView->Columns->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + DataGridViewColumn^ column = safe_cast(myEnum2->Current); + column->HeaderText = String::Concat( L"Column ", column->Index.ToString() ); + } + } + + + // + // + // Swap the last column with the first. + void Button10_Click( Object^ /*sender*/, EventArgs^ /*args*/ ) + { + DataGridViewColumnCollection^ columnCollection = dataGridView->Columns; + DataGridViewColumn^ firstDisplayedColumn = columnCollection->GetFirstColumn( DataGridViewElementStates::Visible ); + DataGridViewColumn^ lastDisplayedColumn = columnCollection->GetLastColumn( DataGridViewElementStates::Visible, DataGridViewElementStates::None ); + int firstColumn_sIndex = firstDisplayedColumn->DisplayIndex; + firstDisplayedColumn->DisplayIndex = lastDisplayedColumn->DisplayIndex; + lastDisplayedColumn->DisplayIndex = firstColumn_sIndex; + } + + + // + // + // Updated the criteria label. + void dataGridView_AutoSizeColumnModeChanged( Object^ /*sender*/, DataGridViewAutoSizeColumnModeEventArgs^ args ) + { + args->Column->DataGridView->Parent->Controls[ L"flowlayoutpanel" ]->Controls[ criteriaLabel ]->Text = String::Concat( criteriaLabel, args->Column->AutoSizeMode ); + } + // +#pragma endregion + +}; + +int main() +{ + DataGridViewColumnDemo::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp new file mode 100644 index 00000000000..fda4f9201a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ButtonDemos/CPP/DataGridViewRowDemo.cpp @@ -0,0 +1,304 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class DataGridViewRowDemo: public Form +{ +private: + +#pragma region S " form setup " + +public: + DataGridViewRowDemo() + { + Button1 = gcnew Button; + Button2 = gcnew Button; + Button3 = gcnew Button; + Button4 = gcnew Button; + Button5 = gcnew Button; + Button6 = gcnew Button; + Button7 = gcnew Button; + Button8 = gcnew Button; + Button9 = gcnew Button; + Button10 = gcnew Button; + FlowLayoutPanel1 = gcnew FlowLayoutPanel; + thirdColumnHeader = L"Main Ingredients"; + boringMeatloaf = L"ground beef"; + boringMeatloafRanking = L"*"; + ratingColumn = 3; + AddButton( Button1, L"Reset", gcnew EventHandler( this, &DataGridViewRowDemo::Button1_Click ) ); + AddButton( Button2, L"Change Column 3 Header", gcnew EventHandler( this, &DataGridViewRowDemo::Button2_Click ) ); + AddButton( Button3, L"Change Meatloaf Recipe", gcnew EventHandler( this, &DataGridViewRowDemo::Button3_Click ) ); + InitializeComponent(); + InitializeDataGridView(); + AddAdditionalButtons(); + } + + +private: + DataGridView^ dataGridView; + Button^ Button1; + Button^ Button2; + Button^ Button3; + Button^ Button4; + Button^ Button5; + Button^ Button6; + Button^ Button7; + Button^ Button8; + Button^ Button9; + Button^ Button10; + FlowLayoutPanel^ FlowLayoutPanel1; + void InitializeComponent() + { + FlowLayoutPanel1->Location = Point(454,0); + FlowLayoutPanel1->AutoSize = true; + FlowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + AutoSize = true; + ClientSize = System::Drawing::Size( 614, 360 ); + FlowLayoutPanel1->Name = L"flowlayoutpanel"; + Controls->Add( this->FlowLayoutPanel1 ); + Text = this->GetType()->Name; + } + + +#pragma endregion +#pragma region S " setup DataGridView " + String^ thirdColumnHeader; + String^ boringMeatloaf; + String^ boringMeatloafRanking; + bool boringRecipe; + bool shortMode; + void InitializeDataGridView() + { + dataGridView = gcnew System::Windows::Forms::DataGridView; + Controls->Add( dataGridView ); + dataGridView->Size = System::Drawing::Size( 300, 200 ); + + // Create an unbound DataGridView by declaring a + // column count. + dataGridView->ColumnCount = 4; + dataGridView->ColumnHeadersVisible = true; + AdjustDataGridViewSizing(); + + // Set the column header style. + DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); + dataGridView->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + + // Set the column header names. + dataGridView->Columns[ 0 ]->Name = L"Recipe"; + dataGridView->Columns[ 1 ]->Name = L"Category"; + dataGridView->Columns[ 2 ]->Name = thirdColumnHeader; + dataGridView->Columns[ 3 ]->Name = L"Rating"; + + // Populate the rows. + array^row1 = gcnew array{ + L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking + }; + array^row2 = gcnew array{ + L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****" + }; + array^row3 = gcnew array{ + L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****" + }; + array^row4 = gcnew array{ + L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****" + }; + array^row5 = gcnew array{ + L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***" + }; + array^row6 = gcnew array{ + L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***" + }; + array^rows = gcnew array{ + row1,row2,row3,row4,row5,row6 + }; + System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + array^rowArray = safe_cast^>(myEnum->Current); + dataGridView->Rows->Add( rowArray ); + } + + shortMode = false; + boringRecipe = true; + } + + void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) + { + FlowLayoutPanel1->Controls->Add( button ); + button->TabIndex = FlowLayoutPanel1->Controls->Count; + button->Text = buttonLabel; + button->AutoSize = true; + button->Click += handler; + } + + + // Reset columns to initial disorderly arrangement. + void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Controls->Remove( dataGridView ); + dataGridView->~DataGridView(); + InitializeDataGridView(); + } + + + // Change column 3 header. + void Button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Toggle( &shortMode ); + if ( shortMode ) + { + dataGridView->Columns[ 2 ]->HeaderText = L"S"; + } + else + { + dataGridView->Columns[ 2 ]->HeaderText = thirdColumnHeader; + } + } + + void Toggle( interior_ptr toggleThis ) + { + *toggleThis = ! *toggleThis; + } + + + // Change meatloaf recipe. + void Button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Toggle( &boringRecipe ); + if ( boringRecipe ) + { + SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); + } + else + { + String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " + L"1/2 cup bread crumbs, 1/4 cup ketchup," + L"1/3 tsp onion powder, " + L"1 clove of garlic, 1/2 pack onion soup mix " + L" dash of your favorite BBQ Sauce"; + SetMeatloaf( greatMeatloafRecipe, L"***" ); + } + } + + void SetMeatloaf( String^ recipe, String^ rating ) + { + dataGridView->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; + dataGridView->Rows[ 0 ]->Cells[ 3 ]->Value = rating; + } + + +#pragma endregion +#pragma region S " demonstration code " + void AddAdditionalButtons() + { + AddButton( Button4, L"Set Row Two Minimum Height", gcnew EventHandler( this, &DataGridViewRowDemo::Button4_Click ) ); + AddButton( Button5, L"Set Row One Height", gcnew EventHandler( this, &DataGridViewRowDemo::Button5_Click ) ); + AddButton( Button6, L"Label Rows", gcnew EventHandler( this, &DataGridViewRowDemo::Button6_Click ) ); + AddButton( Button7, L"Turn on Extra Edge", gcnew EventHandler( this, &DataGridViewRowDemo::Button7_Click ) ); + AddButton( Button8, L"Give Cheesecake an Excellent Rating", gcnew EventHandler( this, &DataGridViewRowDemo::Button8_Click ) ); + } + + void AdjustDataGridViewSizing() + { + dataGridView->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::AutoSize; + dataGridView->Columns[ ratingColumn ]->Width = 50; + } + + + // + // Set minimum height. + void Button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + int secondRow = 1; + DataGridViewRow^ row = dataGridView->Rows[ secondRow ]; + row->MinimumHeight = 40; + } + + + // + // + // Set height. + void Button5_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DataGridViewRow^ row = dataGridView->Rows[ 0 ]; + row->Height = 15; + } + + + // + // + // Set row labels. + void Button6_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + int rowNumber = 1; + System::Collections::IEnumerator^ myEnum = safe_cast(dataGridView->Rows)->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridViewRow^ row = safe_cast(myEnum->Current); + if ( row->IsNewRow ) + continue; + row->HeaderCell->Value = String::Format( L"Row {0}", rowNumber ); + + rowNumber = rowNumber + 1; + } + + dataGridView->AutoResizeRowHeadersWidth( DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders ); + } + + + // + // + // Set a thick horizontal edge. + void Button7_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + int secondRow = 1; + int edgeThickness = 3; + DataGridViewRow^ row = dataGridView->Rows[ secondRow ]; + row->DividerHeight = 10; + } + + + // + // + // Give cheescake excellent rating. + void Button8_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + UpdateStars( dataGridView->Rows[ 4 ], L"******************" ); + } + + int ratingColumn; + void UpdateStars( DataGridViewRow^ row, String^ stars ) + { + row->Cells[ ratingColumn ]->Value = stars; + + // Resize the column width to account for the new value. + row->DataGridView->AutoResizeColumn( ratingColumn, DataGridViewAutoSizeColumnMode::DisplayedCells ); + } + + + // +#pragma endregion + +public: + static void Main() + { + Application::Run( gcnew DataGridViewRowDemo ); + } + +}; + +int main() +{ + DataGridViewRowDemo::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp new file mode 100644 index 00000000000..b7f42ec7105 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ImageColumn_TicTacToe/CPP/tictactoe.cpp @@ -0,0 +1,480 @@ + +// This example demonstrates using images to create a +// TicTacToe game. +// +#using +#using +#using + +using namespace System::IO; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class TicTacToe: public System::Windows::Forms::Form +{ +public: + TicTacToe() + : Form() + { + oBytes = gcnew array{ + 0x42, 0x4D, 0xC6, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x76, + 0x0, 0x0, 0x0, 0x28, 0x0, 0x0, 0x0, 0xB, 0x0, 0x0, 0x0, 0xA, + 0x0, 0x0, 0x0, 0x1, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x10, + 0x0, 0x0, 0x0, 0x10, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x80, 0x0, 0x0, 0x80, 0x0, 0x0, 0x0, 0x80, 0x80, 0x0, + 0x80, 0x0, 0x0, 0x0, 0x80, 0x0, 0x80, 0x0, 0x80, 0x80, 0x0, + 0x0, 0xC0, 0xC0, 0xC0, 0x0, 0x80, 0x80, 0x80, 0x0, 0x0, 0x0, + 0xFF, 0x0, 0x0, 0xFF, 0x0, 0x0, 0x0, 0xFF, 0xFF, 0x0, 0xFF, + 0x0, 0x0, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0x0, + 0xFF, 0xFF, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0xF, 0xFF, 0xF0, + 0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0x0, 0xFF, + 0x0, 0x0, 0x0, 0xFF, 0x0, 0xFF, 0x0, 0xFF, 0xFF, 0x0, 0x0, + 0xFF, 0xFF, 0xFF, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, + 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, + 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, + 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, + 0xFF, 0xFF, 0xFF, 0xF0, 0x0, 0x0, 0xFF, 0xFF, 0xFF, 0xFF, + 0xFF, 0xF0, 0x0, 0x0}; + blank = gcnew Bitmap( gcnew MemoryStream( blankBytes ) ); + x = gcnew Bitmap( gcnew MemoryStream( xBytes ) ); + o = gcnew Bitmap( gcnew MemoryStream( oBytes ) ); + this->AutoSize = true; + turn = gcnew Label; + Button1 = gcnew Button; + Button2 = gcnew Button; + Button3 = gcnew Button; + Button4 = gcnew Button; + Button5 = gcnew Button; + Panel1 = gcnew FlowLayoutPanel; + SetupButtons(); + InitializeDataGridView( nullptr, nullptr ); + + xString = L"X's turn"; + oString = L"O's turn"; + gameOverString = L"Game Over"; + bitmapPadding = 6; + } + + +private: + DataGridView^ dataGridView1; + Button^ Button1; + Label^ turn; + Button^ Button2; + Button^ Button3; + Button^ Button4; + Button^ Button5; + FlowLayoutPanel^ Panel1; + +#pragma region S " bitmaps " + array^oBytes; + array^xBytes; + array^blankBytes; + +#pragma endregion + Bitmap^ blank; + Bitmap^ x; + Bitmap^ o; + String^ xString; + String^ oString; + String^ gameOverString; + int bitmapPadding; + void InitializeDataGridView( Object^ ignored, EventArgs^ e ) + { + this->Panel1->SuspendLayout(); + this->SuspendLayout(); + ConfigureForm(); + SizeGrid(); + CreateColumns(); + CreateRows(); + this->Panel1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void ConfigureForm() + { + AutoSize = true; + turn->Size = System::Drawing::Size( 75, 34 ); + turn->TextAlign = ContentAlignment::MiddleLeft; + Panel1->Location = System::Drawing::Point( 0, 8 ); + Panel1->Size = System::Drawing::Size( 120, 196 ); + Panel1->FlowDirection = FlowDirection::TopDown; + ClientSize = System::Drawing::Size( 355, 200 ); + Controls->Add( this->Panel1 ); + Text = L"TicTacToe"; + dataGridView1 = gcnew System::Windows::Forms::DataGridView; + dataGridView1->Location = Point(120,0); + dataGridView1->AllowUserToAddRows = false; + dataGridView1->CellClick += gcnew DataGridViewCellEventHandler( this, &TicTacToe::dataGridView1_CellClick ); + dataGridView1->CellMouseEnter += gcnew DataGridViewCellEventHandler( this, &TicTacToe::dataGridView1_CellMouseEnter ); + dataGridView1->CellMouseLeave += gcnew DataGridViewCellEventHandler( this, &TicTacToe::dataGridView1_CellMouseLeave ); + Controls->Add( dataGridView1 ); + turn->Text = xString; + turn->AutoSize = true; + } + + void SetupButtons() + { + Button1->AutoSize = true; + SetupButton( Button1, L"Restart", gcnew EventHandler( this, &TicTacToe::Reset ) ); + Panel1->Controls->Add( turn ); + SetupButton( Button2, L"Increase Cell Size", gcnew EventHandler( this, &TicTacToe::MakeCellsLarger ) ); + SetupButton( Button3, L"Stretch Images", gcnew EventHandler( this, &TicTacToe::Stretch ) ); + SetupButton( Button4, L"Zoom Images", gcnew EventHandler( this, &TicTacToe::ZoomToImage ) ); + SetupButton( Button5, L"Normal Images", gcnew EventHandler( this, &TicTacToe::NormalImage ) ); + } + + void SetupButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) + { + Panel1->Controls->Add( button ); + button->Text = buttonLabel; + button->AutoSize = true; + button->Click += handler; + } + + + // + void CreateColumns() + { + DataGridViewImageColumn^ imageColumn; + int columnCount = 0; + do + { + Bitmap^ unMarked = blank; + imageColumn = gcnew DataGridViewImageColumn; + + //Add twice the padding for the left and + //right sides of the cell. + imageColumn->Width = x->Width + 2 * bitmapPadding + 1; + imageColumn->Image = unMarked; + dataGridView1->Columns->Add( imageColumn ); + columnCount = columnCount + 1; + } + while ( columnCount < 3 ); + } + + + // + void CreateRows() + { + dataGridView1->Rows->Add(); + dataGridView1->Rows->Add(); + dataGridView1->Rows->Add(); + } + + + // + void SizeGrid() + { + dataGridView1->ColumnHeadersVisible = false; + dataGridView1->RowHeadersVisible = false; + dataGridView1->AllowUserToResizeColumns = false; + dataGridView1->AllowUserToResizeRows = false; + dataGridView1->BorderStyle = BorderStyle::None; + + //Add twice the padding for the top of the cell + //and the bottom. + dataGridView1->RowTemplate->Height = x->Height + 2 * bitmapPadding + 1; + dataGridView1->AutoSize = true; + } + + + // + void Reset( Object^ sender, System::EventArgs^ e ) + { + dataGridView1->~DataGridView(); + InitializeDataGridView( nullptr, nullptr ); + } + + + // + void dataGridView1_CellClick( Object^ sender, DataGridViewCellEventArgs^ e ) + { + if ( turn->Equals( gameOverString ) ) + { + return; + } + + DataGridViewImageCell^ cell = dynamic_cast(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]); + if ( cell->Value == blank ) + { + if ( IsOsTurn() ) + { + cell->Value = o; + } + else + { + cell->Value = x; + } + + ToggleTurn(); + } + + if ( IsAWin( cell ) ) + { + turn->Text = gameOverString; + } + } + + + // + // + void dataGridView1_CellMouseEnter( Object^ sender, DataGridViewCellEventArgs^ e ) + { + Bitmap^ markingUnderMouse = dynamic_cast(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]->Value); + if ( markingUnderMouse == blank ) + { + dataGridView1->Cursor = Cursors::Default; + } + else + if ( markingUnderMouse == o || markingUnderMouse == x ) + { + dataGridView1->Cursor = Cursors::No; + ToolTip(e,true); + } + } + + void ToolTip( DataGridViewCellEventArgs^ e, bool showTip ) + { + DataGridViewImageCell^ cell = dynamic_cast(dataGridView1->Rows[ e->RowIndex ]->Cells[ e->ColumnIndex ]); + DataGridViewImageColumn^ imageColumn = dynamic_cast(dataGridView1->Columns[ cell->ColumnIndex ]); + if ( showTip ) + cell->ToolTipText = imageColumn->Description; + else + { + cell->ToolTipText = String::Empty; + } + } + + void dataGridView1_CellMouseLeave( Object^ sender, DataGridViewCellEventArgs^ e ) + { + ToolTip( e, false ); + dataGridView1->Cursor = Cursors::Default; + } + + + // + // + void Stretch( Object^ sender, EventArgs^ e ) + { + System::Collections::IEnumerator^ myEnum = dataGridView1->Columns->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DataGridViewImageColumn^ column = safe_cast(myEnum->Current); + column->ImageLayout = DataGridViewImageCellLayout::Stretch; + column->Description = L"Stretched"; + } + } + + void ZoomToImage( Object^ sender, EventArgs^ e ) + { + System::Collections::IEnumerator^ myEnum1 = dataGridView1->Columns->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + DataGridViewImageColumn^ column = safe_cast(myEnum1->Current); + column->ImageLayout = DataGridViewImageCellLayout::Zoom; + column->Description = L"Zoomed"; + } + } + + void NormalImage( Object^ sender, EventArgs^ e ) + { + System::Collections::IEnumerator^ myEnum2 = dataGridView1->Columns->GetEnumerator(); + while ( myEnum2->MoveNext() ) + { + DataGridViewImageColumn^ column = safe_cast(myEnum2->Current); + column->ImageLayout = DataGridViewImageCellLayout::Normal; + column->Description = L"Normal"; + } + } + + + // + void MakeCellsLarger( Object^ sender, EventArgs^ e ) + { + System::Collections::IEnumerator^ myEnum3 = dataGridView1->Columns->GetEnumerator(); + while ( myEnum3->MoveNext() ) + { + DataGridViewImageColumn^ column = safe_cast(myEnum3->Current); + column->Width = column->Width * 2; + } + + System::Collections::IEnumerable^ temp = safe_cast(dataGridView1->Rows); + System::Collections::IEnumerator^ myEnum4 = temp->GetEnumerator(); + + //System::Collections::IEnumerator^ myEnum4 = dataGridView1->Rows->GetEnumerator(); + while ( myEnum4->MoveNext() ) + { + DataGridViewRow^ row = safe_cast(myEnum4->Current); + if ( row->IsNewRow ) + break; + row->Height = (int)(row->Height * 1.5); + } + } + + bool IsAWin( DataGridViewCell^ cell ) + { + if ( ARowIsSame() || AColumnIsSame() || ADiagonalIsSame() ) + return true; + else + return false; + } + + bool ARowIsSame() + { + Bitmap^ marking = nullptr; + System::Collections::IEnumerable^ temp = safe_cast(dataGridView1->Rows); + System::Collections::IEnumerator^ myEnum5 = temp->GetEnumerator(); + //System::Collections::IEnumerator^ myEnum5 = dataGridView1->Rows->GetEnumerator(); + while ( myEnum5->MoveNext() ) + { + DataGridViewRow^ row = safe_cast(myEnum5->Current); + if ( row->IsNewRow ) + break; + + marking = dynamic_cast(row->Cells[ 0 ]->Value); + if ( marking != blank ) + { + if ( marking == row->Cells[ 1 ]->Value && marking == row->Cells[ 2 ]->Value ) + return true; + } + } + + return false; + } + + bool AColumnIsSame() + { + int columnIndex = 0; + Bitmap^ marking; + do + { + marking = dynamic_cast(dataGridView1->Rows[ 0 ]->Cells[ columnIndex ]->Value); + if ( marking != blank ) + { + if ( marking == dynamic_cast(dataGridView1->Rows[ 1 ]->Cells[ columnIndex ]->Value) && marking == dynamic_cast(dataGridView1->Rows[ 2 ]->Cells[ columnIndex ]->Value) ) + return true; + } + + columnIndex = columnIndex + 1; + } + while ( columnIndex < dataGridView1->Columns->GetColumnCount( DataGridViewElementStates::Visible ) ); + + return false; + } + + bool ADiagonalIsSame() + { + if ( LeftToRightDiagonalIsSame() ) + { + return true; + } + + if ( RightToLeftDiagonalIsSame() ) + { + return true; + } + + return false; + } + + bool LeftToRightDiagonalIsSame() + { + return IsDiagonalSame( 0, 2 ); + } + + bool RightToLeftDiagonalIsSame() + { + return IsDiagonalSame( 2, 0 ); + } + + bool IsDiagonalSame( int startingColumn, int lastColumn ) + { + Bitmap^ marking = dynamic_cast(dataGridView1->Rows[ 0 ]->Cells[ startingColumn ]->Value); + if ( marking == blank ) + return false; + + if ( marking == dataGridView1->Rows[ 1 ]->Cells[ 1 ]->Value && marking == dataGridView1->Rows[ 2 ]->Cells[ lastColumn ]->Value ) + return true; + + return false; + } + + void ToggleTurn() + { + if ( turn->Text->Equals( xString ) ) + { + turn->Text = oString; + } + else + { + turn->Text = xString; + } + } + + bool IsOsTurn() + { + if ( turn->Text->Equals( oString ) ) + return true; + + return false; + } + + +public: + + [STAThread] + static void Main() + { + Application::Run( gcnew TicTacToe ); + } + +}; + +int main() +{ + TicTacToe::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp new file mode 100644 index 00000000000..33acdf176ad --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.MouseBasedResizing/CPP/mousesizing.cpp @@ -0,0 +1,311 @@ + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class MouseSizing: public Form +{ +private: + FlowLayoutPanel^ flowLayoutPanel1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::Button^ button3; + System::Windows::Forms::Button^ button4; + System::Windows::Forms::Button^ button5; + System::Windows::Forms::Button^ button6; + System::Windows::Forms::Button^ button7; + System::Windows::Forms::Button^ button8; + System::Windows::Forms::Button^ button9; + +public: + MouseSizing() + { + InitializeComponent(); + this->Load += gcnew EventHandler( this, &MouseSizing::InitializeDataGridView ); + thirdColumnHeader = L"Main Ingredients"; + boringMeatloaf = L"ground beef"; + boringMeatloafRanking = L"*"; + } + + +#pragma region form set up + +private: + void InitializeComponent() + { + this->flowLayoutPanel1 = gcnew FlowLayoutPanel; + this->button4 = gcnew System::Windows::Forms::Button; + this->button5 = gcnew System::Windows::Forms::Button; + this->button6 = gcnew System::Windows::Forms::Button; + this->button7 = gcnew System::Windows::Forms::Button; + this->button8 = gcnew System::Windows::Forms::Button; + this->button9 = gcnew System::Windows::Forms::Button; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->button3 = gcnew System::Windows::Forms::Button; + this->flowLayoutPanel1->SuspendLayout(); + this->SuspendLayout(); + this->flowLayoutPanel1->Controls->Add( this->button4 ); + this->flowLayoutPanel1->Controls->Add( this->button5 ); + this->flowLayoutPanel1->Controls->Add( this->button6 ); + this->flowLayoutPanel1->Controls->Add( this->button7 ); + this->flowLayoutPanel1->Controls->Add( this->button8 ); + this->flowLayoutPanel1->Controls->Add( this->button9 ); + this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + this->flowLayoutPanel1->Location = Point(492,103); + this->flowLayoutPanel1->Name = L"flowLayoutPanel1"; + this->flowLayoutPanel1->AutoSize = true; + this->flowLayoutPanel1->TabIndex = 1; + this->button4->Location = System::Drawing::Point( 3, 3 ); + this->button4->Name = L"button4"; + this->button4->TabIndex = 3; + this->button4->Text = L"button4"; + this->button5->Location = System::Drawing::Point( 3, 32 ); + this->button5->Name = L"button5"; + this->button5->TabIndex = 4; + this->button5->Text = L"button5"; + this->button6->Location = System::Drawing::Point( 3, 61 ); + this->button6->Name = L"button6"; + this->button6->TabIndex = 5; + this->button6->Text = L"button6"; + this->button7->Location = System::Drawing::Point( 3, 90 ); + this->button7->Name = L"button7"; + this->button7->TabIndex = 6; + this->button7->Text = L"button7"; + this->button8->Location = System::Drawing::Point( 3, 119 ); + this->button8->Name = L"button8"; + this->button8->TabIndex = 7; + this->button8->Text = L"button8"; + this->button9->Location = System::Drawing::Point( 3, 148 ); + this->button9->Name = L"button9"; + this->button9->TabIndex = 8; + this->button9->Text = L"button9"; + this->button1->Location = System::Drawing::Point( 492, 3 ); + this->button1->Name = L"button1"; + this->button1->TabIndex = 0; + this->button1->Text = L"button1"; + this->button2->Location = System::Drawing::Point( 492, 33 ); + this->button2->Name = L"button2"; + this->button2->TabIndex = 1; + this->button2->Text = L"button2"; + this->button3->Location = System::Drawing::Point( 492, 63 ); + this->button3->Name = L"button3"; + this->button3->TabIndex = 2; + this->button3->Text = L"button3"; + this->AutoSize = true; + this->Controls->Add( this->flowLayoutPanel1 ); + this->Controls->Add( this->button1 ); + this->Controls->Add( this->button2 ); + this->Controls->Add( this->button3 ); + AddButton( button1, L"Reset" ); + AddButton( button2, L"Change Column 3 Header" ); + AddButton( button3, L"Change Meatloaf Recipe" ); + button1->Click += gcnew EventHandler( this, &MouseSizing::ResetToDisorder ); + button2->Click += gcnew EventHandler( this, &MouseSizing::ChangeColumn3Header ); + button3->Click += gcnew EventHandler( this, &MouseSizing::ChangeMeatloafRecipe ); + AddButtonsForAffectingMouseResizing(); + this->Name = L"MouseSizing"; + this->Text = L"Mouse Sizing"; + this->flowLayoutPanel1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + +#pragma endregion + +public: + + [STAThread] + static void Main() + { + Application::EnableVisualStyles(); + Application::Run( gcnew MouseSizing ); + } + + +private: + System::Drawing::Size startingSize; + String^ thirdColumnHeader; + String^ boringMeatloaf; + String^ boringMeatloafRanking; + bool boringRecipe; + bool shortMode; + DataGridView^ dataGridView1; + void InitializeDataGridView( Object^ ignored, EventArgs^ ignoredToo ) + { + this->dataGridView1 = gcnew DataGridView; + this->Controls->Add( this->dataGridView1 ); + startingSize = System::Drawing::Size( 450, 400 ); + dataGridView1->Size = startingSize; + SetUpColumns(); + PopulateRows(); + shortMode = false; + boringRecipe = true; + } + + void SetUpColumns() + { + dataGridView1->ColumnCount = 4; + dataGridView1->ColumnHeadersVisible = true; + DataGridViewCellStyle^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( L"Verdana",10,FontStyle::Bold ); + dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + dataGridView1->Columns[ 0 ]->Name = L"Recipe"; + dataGridView1->Columns[ 1 ]->Name = L"Category"; + dataGridView1->Columns[ 2 ]->Name = thirdColumnHeader; + dataGridView1->Columns[ 3 ]->Name = L"Rating"; + } + + void PopulateRows() + { + array^row1 = {L"Meatloaf",L"Main Dish",boringMeatloaf,boringMeatloafRanking}; + array^row2 = {L"Key Lime Pie",L"Dessert",L"lime juice, evaporated milk",L"****"}; + array^row3 = {L"Orange-Salsa Pork Chops",L"Main Dish",L"pork chops, salsa, orange juice",L"****"}; + array^row4 = {L"Black Bean and Rice Salad",L"Salad",L"black beans, brown rice",L"****"}; + array^row5 = {L"Chocolate Cheesecake",L"Dessert",L"cream cheese",L"***"}; + array^row6 = {L"Black Bean Dip",L"Appetizer",L"black beans, sour cream",L"***"}; + array^rows = gcnew array{ + row1,row2,row3,row4,row5,row6 + }; + + for each (array^ row in rows) + dataGridView1->Rows->Add(row); + } + + void AddButton( Button^ button, String^ buttonLabel ) + { + button->Text = buttonLabel; + button->AutoSize = true; + } + + void ResetToDisorder( Object^ sender, EventArgs^ e ) + { + Controls->Remove( dataGridView1 ); + dataGridView1->~DataGridView(); + InitializeDataGridView( nullptr, nullptr ); + } + + void ChangeColumn3Header( Object^ sender, EventArgs^ e ) + { + Toggle( &shortMode ); + if ( shortMode ) + dataGridView1->Columns[ 2 ]->HeaderText = L"S"; + else + dataGridView1->Columns[ 2 ]->HeaderText = thirdColumnHeader; + } + + void Toggle( interior_ptr toggleThis ) + { + *toggleThis = ! *toggleThis; + } + + void ChangeMeatloafRecipe( Object^ sender, EventArgs^ e ) + { + Toggle( &boringRecipe ); + if ( boringRecipe ) + SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); + else + { + String^ greatMeatloafRecipe = L"1 lb. lean ground beef, " + L"1/2 cup bread crumbs, 1/4 cup ketchup," + L"1/3 tsp onion powder, " + L"1 clove of garlic, 1/2 pack onion soup mix " + L" dash of your favorite BBQ Sauce"; + SetMeatloaf( greatMeatloafRecipe, L"***" ); + } + } + + void SetMeatloaf( String^ recipe, String^ rating ) + { + dataGridView1->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; + dataGridView1->Rows[ 0 ]->Cells[ 3 ]->Value = rating; + } + + +#pragma region " prevent mouse resizing " + void AddButtonsForAffectingMouseResizing() + { + AddButton( button4, L"Fix Column Header Height" ); + AddButton( button5, L"Fix Row Header Width" ); + AddButton( button6, L"Fix Third Column" ); + AddButton( button7, L"Allow Mouse Resizing of Third Column" ); + AddButton( button8, L"Default Sizing Behavior For Third Column" ); + AddButton( button9, L"Fix Fourth Row" ); + button4->Click += gcnew EventHandler( this, &MouseSizing::FixColumnHeaderHeight ); + button5->Click += gcnew EventHandler( this, &MouseSizing::FixRowHeadersWidth ); + button6->Click += gcnew EventHandler( this, &MouseSizing::FixThirdColumn ); + button7->Click += gcnew EventHandler( this, &MouseSizing::AllowThirdColumnToResize ); + button8->Click += gcnew EventHandler( this, &MouseSizing::FixFourthRow ); + button9->Click += gcnew EventHandler( this, &MouseSizing::SetThirdColumnToDefaultBehavior ); + } + + void FixColumnHeaderHeight( Object^ sender, EventArgs^ e ) + { + + // + dataGridView1->ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode::DisableResizing; + + // + } + + void FixRowHeadersWidth( Object^ sender, EventArgs^ e ) + { + + // + dataGridView1->RowHeadersWidthSizeMode = DataGridViewRowHeadersWidthSizeMode::DisableResizing; + + // + } + + void FixThirdColumn( Object^ sender, EventArgs^ e ) + { + + // + dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::False; + + // + } + + void AllowThirdColumnToResize( Object^ sender, EventArgs^ e ) + { + + // + dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::True; + + // + } + + void SetThirdColumnToDefaultBehavior( Object^ sender, EventArgs^ e ) + { + + // + dataGridView1->Columns[ 2 ]->Resizable = DataGridViewTriState::NotSet; + + // + } + + void FixFourthRow( Object^ sender, EventArgs^ e ) + { + + // + dataGridView1->Rows[ 3 ]->Resizable = DataGridViewTriState::False; + + // + } + + +#pragma endregion + +}; + +int main() +{ + MouseSizing::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp new file mode 100644 index 00000000000..65caf14ff3c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.ProgrammaticResizing/CPP/programmaticsizing.cpp @@ -0,0 +1,281 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class ProgrammaticSizing: public System::Windows::Forms::Form +{ +private: + FlowLayoutPanel^ flowLayoutPanel1; + Button^ button1; + Button^ button2; + Button^ button3; + Button^ button4; + Button^ button5; + Button^ button6; + Button^ button7; + Button^ button8; + Button^ button9; + Button^ button10; + Button^ button11; + +public: + ProgrammaticSizing() + { + button1 = gcnew Button; + button2 = gcnew Button; + button3 = gcnew Button; + button4 = gcnew Button; + button5 = gcnew Button; + button6 = gcnew Button; + button7 = gcnew Button; + button8 = gcnew Button; + button9 = gcnew Button; + button10 = gcnew Button; + button11 = gcnew Button; + thirdColumnHeader = "Main Ingredients"; + boringMeatloaf = "ground beef"; + boringMeatloafRanking = "*"; + otherResturant = "Gomes's Saharan Sushi"; + InitializeComponent(); + AddDirections(); + this->Load += gcnew EventHandler( this, &ProgrammaticSizing::InitializeDataGridView ); + AddButton( button1, "Reset", gcnew EventHandler( this, &ProgrammaticSizing::ResetToDisorder ) ); + AddButton( button2, "Change Column 3 Header", gcnew EventHandler( this, &ProgrammaticSizing::ChangeColumn3Header ) ); + AddButton( button3, "Change Meatloaf Recipe", gcnew EventHandler( this, &ProgrammaticSizing::ChangeMeatloafRecipe ) ); + AddButton( button10, "Change Resturant 2", gcnew EventHandler( this, &ProgrammaticSizing::ChangeResturant ) ); + AddButtonsForProgrammaticResizing(); + } + + +private: + void InitializeComponent() + { + this->flowLayoutPanel1 = gcnew FlowLayoutPanel; + this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + this->flowLayoutPanel1->Location = Point(492,0); + this->flowLayoutPanel1->AutoSize = true; + this->AutoSize = true; + this->Controls->Add( this->flowLayoutPanel1 ); + this->Text = this->GetType()->Name; + } + + void AddDirections() + { + Label^ directions = gcnew Label; + directions->AutoSize = true; + String^ newLine = Environment::NewLine; + directions->Text = String::Format( "Press the buttons that start {0}with 'Change' to see how different sizing {1}modes deal with content changes.", newLine, newLine ); + flowLayoutPanel1->Controls->Add( directions ); + } + + System::Drawing::Size startingSize; + String^ thirdColumnHeader; + String^ boringMeatloaf; + String^ boringMeatloafRanking; + bool boringRecipe; + bool shortMode; + DataGridView^ dataGridView1; + String^ otherResturant; + void InitializeDataGridView( Object^ /*sender*/, EventArgs^ /*ignoredToo*/ ) + { + this->dataGridView1 = gcnew DataGridView; + this->dataGridView1->Location = Point(0,0); + this->dataGridView1->Size = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->dataGridView1 ); + startingSize = System::Drawing::Size( 450, 400 ); + dataGridView1->Size = startingSize; + AddColumns(); + PopulateRows(); + shortMode = false; + boringRecipe = true; + } + + void AddColumns() + { + dataGridView1->ColumnCount = 4; + dataGridView1->ColumnHeadersVisible = true; + DataGridViewCellStyle ^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( "Verdana",10,FontStyle::Bold ); + dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + dataGridView1->Columns[ 0 ]->Name = "Recipe"; + dataGridView1->Columns[ 1 ]->Name = "Category"; + dataGridView1->Columns[ 2 ]->Name = thirdColumnHeader; + dataGridView1->Columns[ 3 ]->Name = "Rating"; + } + + void PopulateRows() + { + array^row1 = {"Meatloaf","Main Dish",boringMeatloaf,boringMeatloafRanking}; + array^row2 = {"Key Lime Pie","Dessert","lime juice, evaporated milk","****"}; + array^row3 = {"Orange-Salsa Pork Chops","Main Dish","pork chops, salsa, orange juice","****"}; + array^row4 = {"Black Bean and Rice Salad","Salad","black beans, brown rice","****"}; + array^row5 = {"Chocolate Cheesecake","Dessert","cream cheese","***"}; + array^row6 = {"Black Bean Dip","Appetizer","black beans, sour cream","***"}; + array^rows = {row1,row2,row3,row4,row5,row6}; + IEnumerator^ myEnum = rows->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + array^row = safe_cast^>(myEnum->Current); + dataGridView1->Rows->Add( row ); + } + + IEnumerator^ myEnum1 = safe_cast(dataGridView1->Rows)->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + DataGridViewRow ^ row = safe_cast(myEnum1->Current); + if ( row->IsNewRow ) + break; + row->HeaderCell->Value = String::Format( "Resturant {0}", row->Index ); + } + } + + void AddButton( Button^ button, String^ buttonLabel, EventHandler^ handler ) + { + button->Text = buttonLabel; + button->AutoSize = true; + flowLayoutPanel1->Controls->Add( button ); + button->Click += handler; + } + + void ResetToDisorder( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Controls->Remove( dataGridView1 ); + dataGridView1->Size = startingSize; + dataGridView1->DataGridView::~DataGridView(); + InitializeDataGridView( nullptr, nullptr ); + } + + void ChangeColumn3Header( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Toggle( &shortMode ); + if ( shortMode ) + dataGridView1->Columns[ 2 ]->HeaderText = "S"; + else + dataGridView1->Columns[ 2 ]->HeaderText = thirdColumnHeader; + } + + void Toggle( interior_ptr toggleThis ) + { + *toggleThis = ! *toggleThis; + } + + void ChangeMeatloafRecipe( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + Toggle( &boringRecipe ); + if ( boringRecipe ) + SetMeatloaf( boringMeatloaf, boringMeatloafRanking ); + else + { + String^ greatMeatloafRecipe = "1 lb. lean ground beef, " + "1/2 cup bread crumbs, 1/4 cup ketchup," + "1/3 tsp onion powder, " + "1 clove of garlic, 1/2 pack onion soup mix " + " dash of your favorite BBQ Sauce"; + SetMeatloaf( greatMeatloafRecipe, "***" ); + } + } + + void SetMeatloaf( String^ recipe, String^ rating ) + { + dataGridView1->Rows[ 0 ]->Cells[ 2 ]->Value = recipe; + dataGridView1->Rows[ 0 ]->Cells[ 3 ]->Value = rating; + } + + void ChangeResturant( Object^ /*sender*/, EventArgs^ /*ignored*/ ) + { + if ( dataGridView1->Rows[ 2 ]->HeaderCell->Value == otherResturant ) + dataGridView1->Rows[ 2 ]->HeaderCell->Value = "Resturant 2"; + else + dataGridView1->Rows[ 2 ]->HeaderCell->Value = otherResturant; + } + + void AddButtonsForProgrammaticResizing() + { + AddButton( button4, "Size Third Column", gcnew EventHandler( this, &ProgrammaticSizing::SizeThirdColumnHeader ) ); + AddButton( button5, "Size Column Headers", gcnew EventHandler( this, &ProgrammaticSizing::SizeColumnHeaders ) ); + AddButton( button6, "Size All Columns", gcnew EventHandler( this, &ProgrammaticSizing::SizeAllColumns ) ); + AddButton( button7, "Size Third Row", gcnew EventHandler( this, &ProgrammaticSizing::SizeThirdRow ) ); + AddButton( button8, "Size First Row Header Using All Headers", gcnew EventHandler( this, &ProgrammaticSizing::SizeFirstRowHeaderToAllHeaders ) ); + AddButton( button9, "Size All Rows and Row Headers", gcnew EventHandler( this, &ProgrammaticSizing::SizeAllRowsAndTheirHeaders ) ); + AddButton( button11, "Size All Rows ", gcnew EventHandler( this, &ProgrammaticSizing::SizeAllRows ) ); + } + + + // + void SizeThirdColumnHeader( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->AutoResizeColumn(2, DataGridViewAutoSizeColumnMode::ColumnHeader); + } + + + // + // + void SizeColumnHeaders( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + int columnNumber; + bool dontChangeColumnWidth; + bool dontChangeRowHeadersWidth; + dataGridView1->AutoResizeColumnHeadersHeight(2); + } + + + // + // + void SizeAllColumns( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->AutoResizeColumns( DataGridViewAutoSizeColumnsMode::AllCells ); + } + + + // + // + void SizeThirdRow( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->AutoResizeRow(2, DataGridViewAutoSizeRowMode::AllCellsExceptHeader); + } + + + // + // + void SizeFirstRowHeaderToAllHeaders( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->AutoResizeRowHeadersWidth(0, DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders); + } + + + // + // + void SizeAllRowsAndTheirHeaders( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->AutoResizeRows(DataGridViewAutoSizeRowsMode::AllCells); + } + + + // + // + void SizeAllRows( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->AutoResizeRows(DataGridViewAutoSizeRowsMode::AllCellsExceptHeaders); + } + + // +}; + + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew ProgrammaticSizing ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp new file mode 100644 index 00000000000..2e3ca96ceda --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.RowTemplate/CPP/datagridviewrowtemplate.cpp @@ -0,0 +1,48 @@ + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +ref class Form1: public Form +{ +private: + DataGridView^ dataGridView1; + +public: + static void Main() + { + Application::Run( gcnew Form1 ); + } + + Form1() + { + this->dataGridView1->Dock = DockStyle::Fill; + this->Controls->Add( this->dataGridView1 ); + this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); + dataGridView1 = gcnew DataGridView; + } + + void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // + DataGridViewRow^ row = this->dataGridView1->RowTemplate; + row->DefaultCellStyle->BackColor = Color::Bisque; + row->Height = 35; + row->MinimumHeight = 20; + + // + this->dataGridView1->ColumnCount = 5; + this->dataGridView1->RowCount = 10; + } + +}; + +int main() +{ + Form1::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp new file mode 100644 index 00000000000..24331430fed --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView.VirtualMode/CPP/virtualmode.cpp @@ -0,0 +1,355 @@ +// +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +// +public ref class Customer +{ +private: + String^ companyNameValue; + String^ contactNameValue; + +public: + Customer() + { + + // Leave fields empty. + } + + Customer( String^ companyName, String^ contactName ) + { + companyNameValue = companyName; + contactNameValue = contactName; + } + + + property String^ CompanyName + { + String^ get() + { + return companyNameValue; + } + + void set( String^ value ) + { + companyNameValue = value; + } + + } + + property String^ ContactName + { + String^ get() + { + return contactNameValue; + } + + void set( String^ value ) + { + contactNameValue = value; + } + + } + +}; +// + +// +public ref class Form1: public Form +{ +private: + DataGridView^ dataGridView1; + + // Declare an ArrayList to serve as the data store. + System::Collections::ArrayList^ customers; + + // Declare a Customer object to store data for a row being edited. + Customer^ customerInEdit; + + // Declare a variable to store the index of a row being edited. + // A value of -1 indicates that there is no row currently in edit. + int rowInEdit; + + // Declare a variable to indicate the commit scope. + // Set this value to false to use cell-level commit scope. + bool rowScopeCommit; + +public: + static void Main() + { + Application::Run( gcnew Form1 ); + } + + Form1() + { + dataGridView1 = gcnew DataGridView; + customers = gcnew System::Collections::ArrayList; + rowInEdit = -1; + rowScopeCommit = true; + + // Initialize the form. + this->dataGridView1->Dock = DockStyle::Fill; + this->Controls->Add( this->dataGridView1 ); + this->Load += gcnew EventHandler( this, &Form1::Form1_Load ); + } + +private: + // + // + void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Enable virtual mode. + this->dataGridView1->VirtualMode = true; + + // Connect the virtual-mode events to event handlers. + this->dataGridView1->CellValueNeeded += gcnew + DataGridViewCellValueEventHandler( this, &Form1::dataGridView1_CellValueNeeded ); + this->dataGridView1->CellValuePushed += gcnew + DataGridViewCellValueEventHandler( this, &Form1::dataGridView1_CellValuePushed ); + this->dataGridView1->NewRowNeeded += gcnew + DataGridViewRowEventHandler( this, &Form1::dataGridView1_NewRowNeeded ); + this->dataGridView1->RowValidated += gcnew + DataGridViewCellEventHandler( this, &Form1::dataGridView1_RowValidated ); + this->dataGridView1->RowDirtyStateNeeded += gcnew + QuestionEventHandler( this, &Form1::dataGridView1_RowDirtyStateNeeded ); + this->dataGridView1->CancelRowEdit += gcnew + QuestionEventHandler( this, &Form1::dataGridView1_CancelRowEdit ); + this->dataGridView1->UserDeletingRow += gcnew + DataGridViewRowCancelEventHandler( this, &Form1::dataGridView1_UserDeletingRow ); + + // Add columns to the DataGridView. + DataGridViewTextBoxColumn^ companyNameColumn = gcnew DataGridViewTextBoxColumn; + companyNameColumn->HeaderText = L"Company Name"; + companyNameColumn->Name = L"Company Name"; + DataGridViewTextBoxColumn^ contactNameColumn = gcnew DataGridViewTextBoxColumn; + contactNameColumn->HeaderText = L"Contact Name"; + contactNameColumn->Name = L"Contact Name"; + this->dataGridView1->Columns->Add( companyNameColumn ); + this->dataGridView1->Columns->Add( contactNameColumn ); + this->dataGridView1->AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode::AllCells; + + // Add some sample entries to the data store. + this->customers->Add( gcnew Customer( L"Bon app'",L"Laurence Lebihan" ) ); + this->customers->Add( gcnew Customer( L"Bottom-Dollar Markets",L"Elizabeth Lincoln" ) ); + this->customers->Add( gcnew Customer( L"B's Beverages",L"Victoria Ashworth" ) ); + + // Set the row count, including the row for new records. + this->dataGridView1->RowCount = 4; + } + // + + // + void dataGridView1_CellValueNeeded( Object^ /*sender*/, + System::Windows::Forms::DataGridViewCellValueEventArgs^ e ) + { + Customer^ customerTmp = nullptr; + + // Store a reference to the Customer object for the row being painted. + if ( e->RowIndex == rowInEdit ) + { + customerTmp = this->customerInEdit; + } + else + { + customerTmp = dynamic_cast(this->customers[ e->RowIndex ]); + } + + // Set the cell value to paint using the Customer object retrieved. + int switchcase = 0; + if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Company Name" ) ) + switchcase = 1; + else + if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Contact Name" ) ) + switchcase = 2; + + + switch ( switchcase ) + { + case 1: + e->Value = customerTmp->CompanyName; + break; + + case 2: + e->Value = customerTmp->ContactName; + break; + } + } + + + // + // + void dataGridView1_CellValuePushed( Object^ /*sender*/, + System::Windows::Forms::DataGridViewCellValueEventArgs^ e ) + { + Customer^ customerTmp = nullptr; + + // Store a reference to the Customer object for the row being edited. + if ( e->RowIndex < this->customers->Count ) + { + + // If the user is editing a new row, create a new Customer object. + if ( this->customerInEdit == nullptr ) + { + this->customerInEdit = gcnew Customer( + (dynamic_cast(this->customers[ e->RowIndex ]))->CompanyName, + (dynamic_cast(this->customers[ e->RowIndex ])->ContactName) ); + } + + customerTmp = this->customerInEdit; + this->rowInEdit = e->RowIndex; + } + else + { + customerTmp = this->customerInEdit; + } + + + // Set the appropriate Customer property to the cell value entered. + int switchcase = 0; + if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Company Name" ) ) + switchcase = 1; + else + if ( (this->dataGridView1->Columns[ e->ColumnIndex ]->Name)->Equals( L"Contact Name" ) ) + switchcase = 2; + + + switch ( switchcase ) + { + case 1: + customerTmp->CompanyName = dynamic_cast(e->Value); + break; + + case 2: + customerTmp->ContactName = dynamic_cast(e->Value); + break; + } + } + + + // + // + void dataGridView1_NewRowNeeded( Object^ /*sender*/, + System::Windows::Forms::DataGridViewRowEventArgs^ /*e*/ ) + { + + // Create a new Customer object when the user edits + // the row for new records. + this->customerInEdit = gcnew Customer; + this->rowInEdit = this->dataGridView1->Rows->Count - 1; + } + + + // + // + void dataGridView1_RowValidated( Object^ /*sender*/, + System::Windows::Forms::DataGridViewCellEventArgs^ e ) + { + + // Save row changes if any were made and release the edited + // Customer object if there is one. + if ( e->RowIndex >= this->customers->Count && e->RowIndex != this->dataGridView1->Rows->Count - 1 ) + { + + // Add the new Customer object to the data store. + this->customers->Add( this->customerInEdit ); + this->customerInEdit = nullptr; + this->rowInEdit = -1; + } + else + if ( this->customerInEdit != nullptr && e->RowIndex < this->customers->Count ) + { + + // Save the modified Customer object in the data store. + this->customers[ e->RowIndex ] = this->customerInEdit; + this->customerInEdit = nullptr; + this->rowInEdit = -1; + } + else + if ( this->dataGridView1->ContainsFocus ) + { + this->customerInEdit = nullptr; + this->rowInEdit = -1; + } + } + + + // + // + void dataGridView1_RowDirtyStateNeeded( Object^ /*sender*/, + System::Windows::Forms::QuestionEventArgs^ e ) + { + if ( !rowScopeCommit ) + { + + // In cell-level commit scope, indicate whether the value + // of the current cell has been modified. + e->Response = this->dataGridView1->IsCurrentCellDirty; + } + } + + + // + // + void dataGridView1_CancelRowEdit( Object^ /*sender*/, + System::Windows::Forms::QuestionEventArgs^ /*e*/ ) + { + if ( this->rowInEdit == this->dataGridView1->Rows->Count - 2 && + this->rowInEdit == this->customers->Count ) + { + + // If the user has canceled the edit of a newly created row, + // replace the corresponding Customer object with a new, empty one. + this->customerInEdit = gcnew Customer; + } + else + { + + // If the user has canceled the edit of an existing row, + // release the corresponding Customer object. + this->customerInEdit = nullptr; + this->rowInEdit = -1; + } + } + + + // + // + void dataGridView1_UserDeletingRow( Object^ /*sender*/, + System::Windows::Forms::DataGridViewRowCancelEventArgs^ e ) + { + if ( e->Row->Index < this->customers->Count ) + { + + // If the user has deleted an existing row, remove the + // corresponding Customer object from the data store. + this->customers->RemoveAt( e->Row->Index ); + } + + if ( e->Row->Index == this->rowInEdit ) + { + + // If the user has deleted a newly created row, release + // the corresponding Customer object. + this->rowInEdit = -1; + this->customerInEdit = nullptr; + } + } + // + // +}; +// + +int main() +{ + Form1::Main(); +} +// + + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp new file mode 100644 index 00000000000..d53ffac68d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView._Virtual/CPP/virtual.cpp @@ -0,0 +1,174 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::IO; +using namespace System::Collections::Generic; +using namespace System::Drawing; +using namespace System::Globalization; + +namespace Sample +{ + public ref class VirtualConnector : public Form + { + DataGridView^ dataGridView1; + const int initialSize; + int numberOfRows; + Dictionary^ store; + const int initialValue; + bool newRowNeeded; + + public: + VirtualConnector(); + + private: + void dataGridView1_NewRowNeeded(Object^ sender, + DataGridViewRowEventArgs^ e); + void dataGridView1_RowsAdded(Object^ sender, + DataGridViewRowsAddedEventArgs^ e); + void dataGridView1_CellValueNeeded(Object^ sender, + DataGridViewCellValueEventArgs^ e); + void dataGridView1_CellValuePushed(Object^ sender, + DataGridViewCellValueEventArgs^ e); + void dataGridView1_CellValidating(Object^ sender, + DataGridViewCellValidatingEventArgs^ e); + }; + + + VirtualConnector::VirtualConnector(): + dataGridView1(gcnew DataGridView()), + initialSize(5000000), + newRowNeeded(false), + initialValue(-1), + numberOfRows(initialSize), + store(gcnew Dictionary()), + Form() + { + this->Text = this->GetType()->Name; + + dataGridView1->NewRowNeeded += + gcnew DataGridViewRowEventHandler(this, + &VirtualConnector::dataGridView1_NewRowNeeded); + + dataGridView1->RowsAdded += + gcnew DataGridViewRowsAddedEventHandler(this, + &VirtualConnector::dataGridView1_RowsAdded); + + dataGridView1->CellValidating += + gcnew DataGridViewCellValidatingEventHandler(this, + &VirtualConnector::dataGridView1_CellValidating); + + dataGridView1->CellValueNeeded += + gcnew DataGridViewCellValueEventHandler(this, + &VirtualConnector::dataGridView1_CellValueNeeded); + + dataGridView1->CellValuePushed += + gcnew DataGridViewCellValueEventHandler(this, + &VirtualConnector::dataGridView1_CellValuePushed); + + try + { + Controls->Add(dataGridView1); + dataGridView1->VirtualMode = true; + dataGridView1->AllowUserToDeleteRows = false; + dataGridView1->Columns->Add("Numbers", + "Positive Numbers"); + dataGridView1->Rows->AddCopies(0, initialSize); + } + catch (InvalidOperationException^ ex) + { + MessageBox::Show(String::Format( + CultureInfo::CurrentCulture, + "Exception occurred: {0}", ex)); + } + } + + // + void VirtualConnector::dataGridView1_NewRowNeeded + (Object^ sender, DataGridViewRowEventArgs^ e) + { + newRowNeeded = true; + } + + // + void VirtualConnector::dataGridView1_RowsAdded + (Object^ sender, DataGridViewRowsAddedEventArgs^ e) + { + if (newRowNeeded) + { + newRowNeeded = false; + numberOfRows = numberOfRows + 1; + } + } + // + + // +#pragma region Data store maintance + + void VirtualConnector::dataGridView1_CellValueNeeded + (Object^ sender, DataGridViewCellValueEventArgs^ e) + { + if (store->ContainsKey(e->RowIndex)) + { + // Use the store if the e value has been modified + // and stored. + e->Value = gcnew Int32(store->default[e->RowIndex]); + } + else if (newRowNeeded && e->RowIndex == numberOfRows) + { + if (dataGridView1->IsCurrentCellInEditMode) + { + e->Value = initialValue; + } + else + { + // Show a blank e if the cursor is just loitering + // over(the) last row. + e->Value = String::Empty; + } + } + else + { + e->Value = e->RowIndex; + } + } + + void VirtualConnector::dataGridView1_CellValuePushed + (Object^ sender, DataGridViewCellValueEventArgs^ e) + { + String^ value = e->Value->ToString(); + store[e->RowIndex] = Int32::Parse(value, + CultureInfo::CurrentCulture); + } +#pragma endregion + // + // + + // + void VirtualConnector::dataGridView1_CellValidating + (Object^ sender, DataGridViewCellValidatingEventArgs^ e) + { + int newInteger; + + // Don't try to validate the 'new row' until finished + // editing since there + // is not any point in validating its initial value. + if (dataGridView1->Rows[e->RowIndex]->IsNewRow) + { + return; + } + if (!Int32::TryParse(e->FormattedValue->ToString(), + newInteger) || (newInteger < 0)) + { + e->Cancel = true; + } + } + // +} +int main() +{ + Application::Run(gcnew Sample::VirtualConnector()); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp new file mode 100644 index 00000000000..cd185ce9a79 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewCell.ToolTipText/cpp/datagridviewcell.tooltiptext.cpp @@ -0,0 +1,89 @@ +#using +#using +#using +using namespace System; +using namespace System::Windows::Forms; + +ref class Form1 : public Form +{ +private: + DataGridView^ dataGridView1; + +public: + static void Main() + { + Application::Run(gcnew Form1()); + } + +public: + Form1() + { + dataGridView1 = gcnew DataGridView(); + + this->dataGridView1->Dock = DockStyle::Fill; + // Set the column header names. + this->dataGridView1->ColumnCount = 5; + this->dataGridView1->Columns[0]->Name = "Recipe"; + this->dataGridView1->Columns[1]->Name = "Category"; + this->dataGridView1->Columns[2]->Name = "Main Ingredients"; + this->dataGridView1->Columns[3]->Name = "Last Fixed"; + this->dataGridView1->Columns[4]->Name = "Rating"; + + // Populate the rows. + array^ row1 = gcnew array{"Meatloaf", + "Main Dish", "ground beef", gcnew DateTime(2000, 3, 23), "*"}; + array^ row2 = gcnew array{"Key Lime Pie", + "Dessert", "lime juice, evaporated milk", gcnew DateTime(2002, 4, 12), "****"}; + array^ row3 = gcnew array{"Orange-Salsa Pork Chops", + "Main Dish", "pork chops, salsa, orange juice", gcnew DateTime(2000, 8, 9), "****"}; + array^ row4 = gcnew array{"Black Bean and Rice Salad", + "Salad", "black beans, brown rice", gcnew DateTime(1999, 5, 7), "****"}; + array^ row5 = gcnew array{"Chocolate Cheesecake", + "Dessert", "cream cheese", gcnew DateTime(2003, 3, 12), "***"}; + array^ row6 = gcnew array{"Black Bean Dip", "Appetizer", + "black beans, sour cream", gcnew DateTime(2003, 12, 23), "***"}; + array^ rows = gcnew array { row1, row2, row3, row4, row5, row6 }; + + for each (array^ rowArray in rows) + { + this->dataGridView1->Rows->Add(rowArray); + } + this->Controls->Add(this->dataGridView1); + this->dataGridView1->CellFormatting += gcnew DataGridViewCellFormattingEventHandler(this, &Form1::dataGridView1_CellFormatting); + } + + + // + // Sets the ToolTip text for cells in the Rating column. + void dataGridView1_CellFormatting(Object^ /*sender*/, + DataGridViewCellFormattingEventArgs^ e) + { + if ( (e->ColumnIndex == this->dataGridView1->Columns["Rating"]->Index) + && e->Value != nullptr ) + { + DataGridViewCell^ cell = + this->dataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex]; + if (e->Value->Equals("*")) + { + cell->ToolTipText = "very bad"; + } + else if (e->Value->Equals("**")) + { + cell->ToolTipText = "bad"; + } + else if (e->Value->Equals("***")) + { + cell->ToolTipText = "good"; + } + else if (e->Value->Equals("****")) + { + cell->ToolTipText = "very good"; + } + } + } + // +}; + +int main(){ + Form1::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp new file mode 100644 index 00000000000..b0662bd4a65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewColumn_AllColumns_Bound_Employees/CPP/employees.cpp @@ -0,0 +1,479 @@ +//Databinding between checkbox state to some table, implement updating. +// Lots of validation work could happen for adding a new row scenario: validate employee id, boss Id. + + +// +#using +#using +#using +#using + +#using +#using +#using +using namespace System; +using namespace System::Data; +using namespace System::Data::SqlClient; +using namespace System::Windows::Forms; +using namespace System::Collections::Generic; +using namespace System::Drawing; + +public ref class Employees : public Form +{ +private: + DataGridView^ DataGridView1; + +private: + DataGridView^ DataGridView2; + +public: + [STAThread] + static void Main() + { + try + { + Application::EnableVisualStyles(); + Application::Run(gcnew Employees()); + } + catch (Exception^ e) + { + MessageBox::Show(e->Message + e->StackTrace); + } + } + +private: + Dictionary^ inOffice; + +public: + Employees() + { + DataGridView1 = gcnew DataGridView(); + DataGridView2 = gcnew DataGridView(); + connectionString = + "Integrated Security=SSPI;Persist Security Info=False;" + + "Initial Catalog=Northwind;Data Source=localhost"; + inOffice = gcnew Dictionary; + + this->Load += gcnew EventHandler(this, &Employees::Form1_Load); + } + +private: + void Form1_Load(System::Object^ /*sender*/, System::EventArgs^ /*e*/) + { + try + { + SetUpForm(); + SetUpDataGridView1(); + SetUpDataGridView2(); + } + catch (SqlException^) + { + MessageBox::Show("The connection string <" + + connectionString + + "> failed to connect. Modify it " + + "to connect to a Northwind database accessible to " + + "your system.", + "ERROR", MessageBoxButtons::OK, MessageBoxIcon::Exclamation); + Application::Exit(); + } + } + +private: + void SetUpForm() + { + Size = System::Drawing::Size(800, 600); + FlowLayoutPanel^ flowLayout = gcnew FlowLayoutPanel(); + flowLayout->FlowDirection = FlowDirection::TopDown; + flowLayout->Dock = DockStyle::Fill; + Controls->Add(flowLayout); + + flowLayout->Controls->Add(DataGridView1); + flowLayout->Controls->Add(DataGridView2); + } + + // +private: + void SetUpDataGridView2() + { + DataGridView2->Dock = DockStyle::Bottom; + DataGridView2->TopLeftHeaderCell->Value = "Sales Details"; + DataGridView2->RowHeadersWidthSizeMode = + DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders; + } + // + +private: + void SetUpDataGridView1() + { + //DataGridView1.DataError += new + // DataGridViewDataErrorEventHandler(DataGridView1_DataError); + DataGridView1->CellContentClick += gcnew + DataGridViewCellEventHandler(this, &Employees::DataGridView1_CellContentClick); + DataGridView1->CellValuePushed += gcnew + DataGridViewCellValueEventHandler(this, &Employees::DataGridView1_CellValuePushed); + DataGridView1->CellValueNeeded += gcnew + DataGridViewCellValueEventHandler(this, &Employees::DataGridView1_CellValueNeeded); + + // Virtual mode is turned on so that the + // unbound DataGridViewCheckBoxColumn will + // keep its state when the bound columns are + // sorted. + DataGridView1->VirtualMode = true; + DataGridView1->AutoSize = true; + DataGridView1->DataSource = Populate("SELECT * FROM Employees"); + DataGridView1->TopLeftHeaderCell->Value = "Employees"; + DataGridView1->RowHeadersWidthSizeMode = + DataGridViewRowHeadersWidthSizeMode::AutoSizeToAllHeaders; + DataGridView1->ColumnHeadersHeightSizeMode = + DataGridViewColumnHeadersHeightSizeMode::AutoSize; + DataGridView1->AutoSizeColumnsMode = + DataGridViewAutoSizeColumnsMode::AllCells; + DataGridView1->AllowUserToAddRows = false; + DataGridView1->AllowUserToDeleteRows = false; + + // The below autogenerated column is removed so + // a DataGridViewComboboxColumn could be used instead. + DataGridView1->Columns->Remove(ColumnName::TitleOfCourtesy.ToString()); + DataGridView1->Columns->Remove(ColumnName::ReportsTo.ToString()); + + AddLinkColumn(); + AddComboBoxColumns(); + AddButtonColumn(); + AddOutOfOfficeColumn(); + } + +private: + void AddComboBoxColumns() + { + DataGridViewComboBoxColumn^ comboboxColumn; + comboboxColumn = CreateComboBoxColumn(); + SetAlternateChoicesUsingDataSource(comboboxColumn); + comboboxColumn->HeaderText = "TitleOfCourtesy (via DataSource property)"; + DataGridView1->Columns->Insert(0, comboboxColumn); + + comboboxColumn = CreateComboBoxColumn(); + SetAlternateChoicesUsingItems(comboboxColumn); + comboboxColumn->HeaderText = "TitleOfCourtesy (via Items property)"; + // Tack this example column onto the end. + DataGridView1->Columns->Add(comboboxColumn); + } + + // +private: + void AddLinkColumn() + { + DataGridViewLinkColumn^ links = gcnew DataGridViewLinkColumn(); + + links->UseColumnTextForLinkValue = true; + links->HeaderText = ColumnName::ReportsTo.ToString(); + links->DataPropertyName = ColumnName::ReportsTo.ToString(); + links->ActiveLinkColor = Color::White; + links->LinkBehavior = LinkBehavior::SystemDefault; + links->LinkColor = Color::Blue; + links->TrackVisitedState = true; + links->VisitedLinkColor = Color::YellowGreen; + + DataGridView1->Columns->Add(links); + } + // + + // +private: + void SetAlternateChoicesUsingItems( + DataGridViewComboBoxColumn^ comboboxColumn) + { + comboboxColumn->Items->AddRange("Mr.", "Ms.", "Mrs.", "Dr."); + } + + // +private: + DataGridViewComboBoxColumn^ CreateComboBoxColumn() + { + DataGridViewComboBoxColumn^ column = + gcnew DataGridViewComboBoxColumn(); + { + column->DataPropertyName = ColumnName::TitleOfCourtesy.ToString(); + column->HeaderText = ColumnName::TitleOfCourtesy.ToString(); + column->DropDownWidth = 160; + column->Width = 90; + column->MaxDropDownItems = 3; + column->FlatStyle = FlatStyle::Flat; + } + return column; + } + // + +private: + void SetAlternateChoicesUsingDataSource(DataGridViewComboBoxColumn^ comboboxColumn) + { + { + comboboxColumn->DataSource = RetrieveAlternativeTitles(); + comboboxColumn->ValueMember = ColumnName::TitleOfCourtesy.ToString(); + comboboxColumn->DisplayMember = comboboxColumn->ValueMember; + } + } + +private: + DataTable^ RetrieveAlternativeTitles() + { + return Populate("SELECT distinct TitleOfCourtesy FROM Employees"); + } + + String^ connectionString; + +private: + DataTable^ Populate(String^ sqlCommand) + { + SqlConnection^ northwindConnection = gcnew SqlConnection(connectionString); + northwindConnection->Open(); + + SqlCommand^ command = gcnew SqlCommand(sqlCommand, northwindConnection); + SqlDataAdapter^ adapter = gcnew SqlDataAdapter(); + adapter->SelectCommand = command; + + DataTable^ table = gcnew DataTable(); + adapter->Fill(table); + + return table; + } + + // Using an enum provides some abstraction between column index + // and column name along with compile time checking, and gives + // a handy place to store the column names. + enum class ColumnName + { + EmployeeID, + LastName, + FirstName, + Title, + TitleOfCourtesy, + BirthDate, + HireDate, + Address, + City, + Region, + PostalCode, + Country, + HomePhone, + Extension, + Photo, + Notes, + ReportsTo, + PhotoPath, + OutOfOffice + }; + // + + // +private: + void AddButtonColumn() + { + DataGridViewButtonColumn^ buttons = gcnew DataGridViewButtonColumn(); + { + buttons->HeaderText = "Sales"; + buttons->Text = "Sales"; + buttons->UseColumnTextForButtonValue = true; + buttons->AutoSizeMode = + DataGridViewAutoSizeColumnMode::AllCells; + buttons->FlatStyle = FlatStyle::Standard; + buttons->CellTemplate->Style->BackColor = Color::Honeydew; + buttons->DisplayIndex = 0; + } + + DataGridView1->Columns->Add(buttons); + + } + // + + // +private: + void AddOutOfOfficeColumn() + { + DataGridViewCheckBoxColumn^ column = gcnew DataGridViewCheckBoxColumn(); + { + column->HeaderText = ColumnName::OutOfOffice.ToString(); + column->Name = ColumnName::OutOfOffice.ToString(); + column->AutoSizeMode = + DataGridViewAutoSizeColumnMode::DisplayedCells; + column->FlatStyle = FlatStyle::Standard; + column->ThreeState = true; + column->CellTemplate = gcnew DataGridViewCheckBoxCell(); + column->CellTemplate->Style->BackColor = Color::Beige; + } + + DataGridView1->Columns->Insert(0, column); + } + // + +private: + void PopulateSales(DataGridViewCellEventArgs^ buttonClick) + { + + String^ employeeID = DataGridView1->Rows[buttonClick->RowIndex] + ->Cells[ColumnName::EmployeeID.ToString()]->Value->ToString(); + DataGridView2->DataSource = Populate("SELECT * FROM Orders WHERE EmployeeID = " + employeeID); + } + + #pragma region "SQL Error handling" + // +private: + void DataGridView1_DataError(Object^ sender, DataGridViewDataErrorEventArgs^ anError) + { + + MessageBox::Show("Error happened " + anError->Context.ToString()); + + if (anError->Context == DataGridViewDataErrorContexts::Commit) + { + MessageBox::Show("Commit error"); + } + if (anError->Context == DataGridViewDataErrorContexts::CurrentCellChange) + { + MessageBox::Show("Cell change"); + } + if (anError->Context == DataGridViewDataErrorContexts::Parsing) + { + MessageBox::Show("parsing error"); + } + if (anError->Context == DataGridViewDataErrorContexts::LeaveControl) + { + MessageBox::Show("leave control error"); + } + + if (dynamic_cast(anError->Exception) != nullptr) + { + DataGridView^ view = (DataGridView^)sender; + view->Rows[anError->RowIndex]->ErrorText = "an error"; + view->Rows[anError->RowIndex]->Cells[anError->ColumnIndex]->ErrorText = "an error"; + + anError->ThrowException = false; + } + } + // + #pragma endregion + + // +private: + void DataGridView1_CellContentClick(Object^ /*sender*/, DataGridViewCellEventArgs^ e) + { + + if (IsANonHeaderLinkCell(e)) + { + MoveToLinked(e); + } + else if (IsANonHeaderButtonCell(e)) + { + PopulateSales(e); + } + } + +private: + void MoveToLinked(DataGridViewCellEventArgs^ e) + { + String^ employeeId; + Object^ value = DataGridView1->Rows[e->RowIndex]->Cells[e->ColumnIndex]->Value; + if (dynamic_cast(value) != nullptr) { return; } + + employeeId = value->ToString(); + DataGridViewCell^ boss = RetrieveSuperiorsLastNameCell(employeeId); + if (boss != nullptr) + { + DataGridView1->CurrentCell = boss; + } + } + +private: + bool IsANonHeaderLinkCell(DataGridViewCellEventArgs^ cellEvent) + { + if (dynamic_cast(DataGridView1->Columns[cellEvent->ColumnIndex]) != nullptr + && + cellEvent->RowIndex != -1) + { return true; } + else { return false; } + } + +private: + bool IsANonHeaderButtonCell(DataGridViewCellEventArgs^ cellEvent) + { + if (dynamic_cast(DataGridView1->Columns[cellEvent->ColumnIndex]) != nullptr + && + cellEvent->RowIndex != -1) + { return true; } + else { return (false); } + } + +private: + DataGridViewCell^ RetrieveSuperiorsLastNameCell(String^ employeeId) + { + + for each (DataGridViewRow^ row in DataGridView1->Rows) + { + if (row->IsNewRow) { return nullptr; } + if (row->Cells[ColumnName::EmployeeID.ToString()]->Value->ToString()->Equals(employeeId)) + { + return row->Cells[ColumnName::LastName.ToString()]; + } + } + return nullptr; + } + // + + #pragma region "checkbox state" + +private: + void DataGridView1_CellValuePushed(Object^ sender, + DataGridViewCellValueEventArgs^ e) + { + if (IsCheckBoxColumn(e->ColumnIndex)) + { + String^ employeeId = GetKey(e); + if (!inOffice->ContainsKey(employeeId)) + { + inOffice->Add(employeeId, (Boolean)e->Value); + } + else + { + inOffice[employeeId] = (Boolean)e->Value; + } + } + } + +private: + String^ GetKey(DataGridViewCellValueEventArgs^ cell) + { + return DataGridView1->Rows[cell->RowIndex]-> + Cells[ColumnName::EmployeeID.ToString()]->Value->ToString(); + } + +private: + void DataGridView1_CellValueNeeded(Object^ sender, + DataGridViewCellValueEventArgs^ e) + { + + if (IsCheckBoxColumn(e->ColumnIndex)) + { + String^ employeeId = GetKey(e); + if (!inOffice->ContainsKey(employeeId)) + { + bool defaultValue = false; + inOffice->Add(employeeId, defaultValue); + } + + e->Value = inOffice[employeeId]; + } + } + +private: + bool IsCheckBoxColumn(int columnIndex) + { + DataGridViewColumn^ outOfOfficeColumn = + DataGridView1->Columns[ColumnName::OutOfOffice.ToString()]; + return (DataGridView1->Columns[columnIndex] == outOfOfficeColumn); + } + #pragma endregion +}; + +int main() +{ + Employees::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp new file mode 100644 index 00000000000..5d19346c731 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridViewTrinaryVirtualCheckBox/cpp/trivaluevirtualcheckbox.cpp @@ -0,0 +1,96 @@ +// +#using +#using +#using +using namespace System; +using namespace System::IO; +using namespace System::Collections::Generic; +using namespace System::Windows::Forms; + +public enum class LightStatus +{ + Unknown, + TurnedOn, + TurnedOff +}; + +public ref class TriValueVirtualCheckBox: public Form +{ +private: + DataGridView^ dataGridView1; + +private: + const int initialSize; + +private: + Dictionary^ store; + +public: + TriValueVirtualCheckBox() : Form(), initialSize(500) + { + dataGridView1 = gcnew DataGridView(); + store = gcnew Dictionary(); + Text = this->GetType()->Name; + + for(int i = 0; i < initialSize; i++) + { + store->Add(i, LightStatus::Unknown); + } + + Controls->Add(dataGridView1); + dataGridView1->VirtualMode = true; + dataGridView1->AllowUserToDeleteRows = false; + dataGridView1->CellValueNeeded += + gcnew DataGridViewCellValueEventHandler( + this, &TriValueVirtualCheckBox::dataGridView1_CellValueNeeded); + dataGridView1->CellValuePushed += + gcnew DataGridViewCellValueEventHandler( + this, &TriValueVirtualCheckBox::dataGridView1_CellValuePushed); + + dataGridView1->Columns->Add(CreateCheckBoxColumn()); + dataGridView1->Rows->AddCopies(0, initialSize); + } + + // +private: + DataGridViewCheckBoxColumn^ CreateCheckBoxColumn() + { + DataGridViewCheckBoxColumn^ dataGridViewCheckBoxColumn1 + = gcnew DataGridViewCheckBoxColumn(); + dataGridViewCheckBoxColumn1->HeaderText = "Lights On"; + dataGridViewCheckBoxColumn1->TrueValue = LightStatus::TurnedOn; + dataGridViewCheckBoxColumn1->FalseValue = + LightStatus::TurnedOff; + dataGridViewCheckBoxColumn1->IndeterminateValue + = LightStatus::Unknown; + dataGridViewCheckBoxColumn1->ThreeState = true; + dataGridViewCheckBoxColumn1->ValueType = LightStatus::typeid; + return dataGridViewCheckBoxColumn1; + } + // + +#pragma region "data store maintance" +private: + void dataGridView1_CellValueNeeded(Object^ sender, + DataGridViewCellValueEventArgs^ e) + { + e->Value = store[e->RowIndex]; + } + +private: + void dataGridView1_CellValuePushed(Object^ sender, + DataGridViewCellValueEventArgs^ e) + { + store[e->RowIndex] = (LightStatus) e->Value; + } +#pragma endregion + +}; + +[STAThread] +int main() +{ + Application::Run(gcnew TriValueVirtualCheckBox()); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp new file mode 100644 index 00000000000..d8bd7ed7939 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DataGridView_SharedRowScenarios/CPP/sharedrows.cpp @@ -0,0 +1,210 @@ + +// +#using +#using +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Data::SqlClient; +using namespace System::Drawing; +using namespace System::Windows::Forms; +ref class SharedRows: public Form +{ +private: + DataGridView^ dataGridView1; + Label^ counterLabel; + Label^ description; + FlowLayoutPanel^ leftToRight; + FlowLayoutPanel^ topToBottom; + +public: + SharedRows() + { + dataGridView1 = gcnew DataGridView; + counterLabel = gcnew Label; + description = gcnew Label; + leftToRight = gcnew FlowLayoutPanel; + topToBottom = gcnew FlowLayoutPanel; + wholeTable = gcnew ToolStripMenuItem; + lookUp = gcnew ToolStripMenuItem; + count = gcnew Label; + this->Load += gcnew EventHandler( this, &SharedRows::SharedRows_Load ); + this->AutoSize = true; + this->Controls->Add( topToBottom ); + } + + static void Main() + { + Application::Run( gcnew SharedRows ); + } + + +private: + void SharedRows_Load( Object^ /*ignored*/, EventArgs^ /*e*/ ) + { + counterLabel->Text = L"Unshared Rows: "; + counterLabel->AutoSize = true; + count->AutoSize = true; + description->MaximumSize = System::Drawing::Size( 600, 300 ); + description->AutoSize = true; + description->Text = L"Try out the contextual menu, and hovering over the cells in the 'ReportsTo' column. " + L"Notice what happens when trying to lookup a picture cell. " + L"Row unsharing is minimized through the use of events."; + leftToRight->FlowDirection = FlowDirection::LeftToRight; + leftToRight->Controls->AddRange( gcnew array{ + dataGridView1,counterLabel,count + } ); + leftToRight->AutoSize = true; + topToBottom->FlowDirection = FlowDirection::TopDown; + topToBottom->AutoSize = true; + topToBottom->Controls->AddRange( gcnew array{ + leftToRight,description + } ); + dataGridView1->MaximumSize = System::Drawing::Size( 500, 300 ); + dataGridView1->AutoSize = true; + dataGridView1->MultiSelect = false; + dataGridView1->ReadOnly = true; + dataGridView1->SelectionMode = DataGridViewSelectionMode::CellSelect; + dataGridView1->AllowUserToAddRows = false; + dataGridView1->AllowUserToDeleteRows = false; + wholeTable->Click += gcnew EventHandler( this, &SharedRows::wholeTable_Click ); + lookUp->Click += gcnew EventHandler( this, &SharedRows::lookUp_Click ); + dataGridView1->RowUnshared += gcnew DataGridViewRowEventHandler( this, &SharedRows::dataGridView1_RowUnshared ); + dataGridView1->CellMouseEnter += gcnew DataGridViewCellEventHandler( this, &SharedRows::dataGridView1_CellMouseEnter ); + dataGridView1->CellErrorTextNeeded += gcnew DataGridViewCellErrorTextNeededEventHandler( this, &SharedRows::dataGridView1_CellErrorTextNeeded ); + dataGridView1->CellContextMenuStripNeeded += gcnew DataGridViewCellContextMenuStripNeededEventHandler( this, &SharedRows::dataGridView1_CellContextMenuStripNeeded ); + dataGridView1->CellToolTipTextNeeded += gcnew DataGridViewCellToolTipTextNeededEventHandler( this, &SharedRows::dataGridView1_CellToolTipTextNeeded ); + dataGridView1->DataSource = Populate( L"Select * from employees", true ); + } + + + // + // + // + ToolStripMenuItem^ wholeTable; + ToolStripMenuItem^ lookUp; + System::Windows::Forms::ContextMenuStrip^ strip; + String^ cellErrorText; + + void dataGridView1_CellContextMenuStripNeeded( Object^ /*sender*/, + DataGridViewCellContextMenuStripNeededEventArgs^ e ) + { + cellErrorText = String::Empty; + if ( strip == nullptr ) + { + strip = gcnew System::Windows::Forms::ContextMenuStrip; + lookUp->Text = L"Look Up"; + wholeTable->Text = L"See Whole Table"; + strip->Items->Add( lookUp ); + strip->Items->Add( wholeTable ); + } + + e->ContextMenuStrip = strip; + } + + void wholeTable_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + dataGridView1->DataSource = Populate( L"Select * from employees", true ); + } + + DataGridViewCellEventArgs^ theCellImHoveringOver; + void dataGridView1_CellMouseEnter( Object^ /*sender*/, DataGridViewCellEventArgs^ e ) + { + theCellImHoveringOver = e; + } + + DataGridViewCellEventArgs^ cellErrorLocation; + void lookUp_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + dataGridView1->DataSource = Populate( String::Format( L"Select * from employees where {0} = '{1}'", dataGridView1->Columns[ theCellImHoveringOver->ColumnIndex ]->Name, dataGridView1->Rows[ theCellImHoveringOver->RowIndex ]->Cells[ theCellImHoveringOver->ColumnIndex ]->Value ), true ); + } + catch ( ... ) + { + cellErrorText = L"Can't look this cell up"; + cellErrorLocation = theCellImHoveringOver; + } + + } + + void dataGridView1_CellErrorTextNeeded( Object^ /*sender*/, DataGridViewCellErrorTextNeededEventArgs^ e ) + { + if ( cellErrorLocation != nullptr ) + { + if ( e->ColumnIndex == cellErrorLocation->ColumnIndex && e->RowIndex == cellErrorLocation->RowIndex ) + { + e->ErrorText = cellErrorText; + } + } + } + + // + DataTable^ Populate( String^ query, bool resetUnsharedCounter ) + { + if ( resetUnsharedCounter ) + { + ResetCounter(); + } + + + // Alter the data source as necessary + SqlDataAdapter^ adapter = gcnew SqlDataAdapter( query, + gcnew SqlConnection( L"Integrated Security=SSPI;Persist Security Info=False;" + L"Initial Catalog=Northwind;Data Source= localhost" ) ); + DataTable^ table = gcnew DataTable; + adapter->Fill( table ); + return table; + } + + Label^ count; + int unsharedRowCounter; + void ResetCounter() + { + unsharedRowCounter = 0; + count->Text = unsharedRowCounter.ToString(); + } + // + // + // + + void dataGridView1_CellToolTipTextNeeded( Object^ /*sender*/, + DataGridViewCellToolTipTextNeededEventArgs^ e ) + { + if ( theCellImHoveringOver->ColumnIndex == dataGridView1->Columns[ L"ReportsTo" ]->Index && theCellImHoveringOver->RowIndex > -1 ) + { + String^ reportsTo = dataGridView1->Rows[ theCellImHoveringOver->RowIndex ]->Cells[ theCellImHoveringOver->ColumnIndex ]->Value->ToString(); + if ( reportsTo->Equals( L"" ) ) + { + e->ToolTipText = L"The buck stops here!"; + } + else + { + DataTable^ table = Populate( String::Format( L"select firstname, lastname from employees where employeeid = '{0}'", + dataGridView1->Rows[ theCellImHoveringOver->RowIndex ]->Cells[ theCellImHoveringOver->ColumnIndex ]->Value ), false ); + e->ToolTipText = String::Format( L"Reports to {0} {1}", table->Rows[ 0 ]->ItemArray[ 0 ], table->Rows[ 0 ]->ItemArray[ 1 ] ); + } + } + } + + + // + void dataGridView1_RowUnshared( Object^ /*sender*/, DataGridViewRowEventArgs^ /*row*/ ) + { + unsharedRowCounter += 1; + count->Text = unsharedRowCounter.ToString(); + } + +}; + +int main() +{ + SharedRows::Main(); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp new file mode 100644 index 00000000000..3000d7877b4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.DateTimePicker/CPP/form1.cpp @@ -0,0 +1,118 @@ + + +#using +#using +#using + +// This example demonstrates using the read-only fields DateTimePicker.MaxDateTime +// and DateTimePicker.MinDateTime. +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeDateTimePicker(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::ToolTip^ ToolTip1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->ToolTip1 = gcnew System::Windows::Forms::ToolTip( this->components ); + this->SuspendLayout(); + + // + //DateTimePicker1 + // + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +internal: + // Declare the DateTimePicker. + System::Windows::Forms::DateTimePicker^ DateTimePicker1; + +private: + void InitializeDateTimePicker() + { + // Construct the DateTimePicker. + this->DateTimePicker1 = gcnew System::Windows::Forms::DateTimePicker; + + //Set size and location. + this->DateTimePicker1->Location = System::Drawing::Point( 40, 88 ); + this->DateTimePicker1->Size = System::Drawing::Size( 160, 21 ); + + // Set the alignment of the drop-down MonthCalendar to right. + this->DateTimePicker1->DropDownAlign = LeftRightAlignment::Right; + + // Set the Value property to 50 years before today. + DateTimePicker1->Value = System::DateTime::Now.AddYears( -50 ); + + //Set a custom format containing the string "of the year" + DateTimePicker1->Format = DateTimePickerFormat::Custom; + DateTimePicker1->CustomFormat = "MMM dd, 'of the year' yyyy "; + + // Add the DateTimePicker to the form. + this->Controls->Add( this->DateTimePicker1 ); + } + // + + // + // When the calendar drops down, display a MessageBox indicating + // that DateTimePicker will not accept dates before MinDateTime or + // after MaxDateTime. Use a StringBuilder object to build the string + // for efficiency. + void DateTimePicker1_DropDown( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + System::Text::StringBuilder^ messageBuilder = gcnew System::Text::StringBuilder; + messageBuilder->Append( "Choose a date after: " ); + messageBuilder->Append( DateTimePicker::MinDateTime.ToShortDateString() ); + messageBuilder->Append( " and a date before: " ); + messageBuilder->Append( DateTimePicker::MaxDateTime.ToShortDateString() ); + MessageBox::Show( messageBuilder->ToString() ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp new file mode 100644 index 00000000000..dc5fa84a787 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Design.Behavior.BehaviorService/cpp/Form1.cpp @@ -0,0 +1,227 @@ +// +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Windows::Forms::Design::Behavior; +using namespace System::Text; + +namespace BehaviorServiceSample +{ + + public ref class UserControl1 : public UserControl + { + private: + System::ComponentModel::IContainer^ components; + + public: + UserControl1() + { + InitializeComponent(); + } + + protected: + ~UserControl1() + { + if (components != nullptr) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->Name = "UserControl1"; + this->Size = System::Drawing::Size(170, 156); + } + }; + + public ref class Form1 : public Form + { + private: + UserControl1^ userControl; + + public: + Form1() + { + InitializeComponent(); + } + + private: + System::ComponentModel::IContainer^ components; + + protected: + ~Form1() + { + if (components != nullptr) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->userControl = gcnew UserControl1(); + this->SuspendLayout(); + + this->userControl->Location = System::Drawing::Point(12,13); + this->userControl->Name = "userControl"; + this->userControl->Size = System::Drawing::Size(143,110); + this->userControl->TabIndex = 0; + + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(184, 153); + this->Controls->Add(this->userControl); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout(false); + } + }; + + // + + // By providing our own behavior we can do something + // interesting when the user clicks or manipulates our glyph. + // + public ref class DemoBehavior : public Behavior + { + public: + bool OnMouseUp(Glyph^ g, MouseButtons^ button) + { + MessageBox::Show("Hey, you clicked the mouse here"); + + // indicating we processed this event. + return true; + } + }; + // + + public ref class DemoGlyph : public Glyph + { + Control^ control; + BehaviorService^ behavior; + + // + public: + DemoGlyph(BehaviorService^ behavior, Control^ control): + Glyph(gcnew BehaviorServiceSample::DemoBehavior) + { + this->behavior = behavior; + this->control = control; + } + // + + // + public: + virtual property Rectangle Bounds + { + Rectangle get() override + { + // Create a glyph that is 10x10 and sitting + // in the middle of the control. Glyph coordinates + // are in adorner window coordinates, so we must map + // using the behavior service. + Point edge = behavior->ControlToAdornerWindow(control); + Size size = control->Size; + Point center = Point(edge.X + (size.Width / 2), + edge.Y + (size.Height / 2)); + + Rectangle bounds = Rectangle(center.X - 5, + center.Y - 5, 10, 10); + + return bounds; + } + } + // + + // + public: + virtual Cursor^ GetHitTest(Point p) override + { + // GetHitTest is called to see if the point is + // within this glyph. This gives us a chance to decide + // what cursor to show. Returning null from here means + // the mouse pointer is not currently inside of the + // glyph. Returning a valid cursor here indicates the + // pointer is inside the glyph, and also enables our + // Behavior property as the active behavior. + if (Bounds.Contains(p)) + { + return Cursors::Hand; + } + return nullptr; + } + // + + // + public: + virtual void Paint(PaintEventArgs^ pe) override + { + // Draw our glyph. Our's is simple: a blue ellipse. + pe->Graphics->FillEllipse(Brushes::Blue, Bounds); + } + // + }; + + // + + // + public ref class DemoDesigner : public ControlDesigner + { + private: + Adorner^ demoAdorner; + + protected: + ~DemoDesigner() + { + if (demoAdorner != nullptr) + { + System::Windows::Forms::Design::Behavior::BehaviorService^ b = + this->BehaviorService; + if (b != nullptr) + { + b->Adorners->Remove(demoAdorner); + } + } + } + + public: + virtual void Initialize(IComponent^ component) override + { + __super::Initialize(component); + + // Get a hold of the behavior service and add our own set + // of glyphs. Glyphs live on adorners. + // + // + demoAdorner = gcnew Adorner(); + BehaviorService->Adorners->Add(demoAdorner); + // + demoAdorner->Glyphs->Add + (gcnew DemoGlyph(BehaviorService, Control)); + // + } + }; + // +} + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew BehaviorServiceSample::Form1()); +} + + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp new file mode 100644 index 00000000000..0fe16853de4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ErrorProvider/CPP/errorproviderexample.cpp @@ -0,0 +1,215 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::Label ^ label4; + System::Windows::Forms::Label ^ label5; + System::Windows::Forms::Label ^ label6; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::TextBox^ nameTextBox1; + System::Windows::Forms::NumericUpDown^ ageUpDownPicker; + System::Windows::Forms::ComboBox^ favoriteColorComboBox; + System::Windows::Forms::ErrorProvider^ ageErrorProvider; + System::Windows::Forms::ErrorProvider^ nameErrorProvider; + System::Windows::Forms::ErrorProvider^ favoriteColorErrorProvider; + +public: + Form1() + { + this->nameTextBox1 = gcnew System::Windows::Forms::TextBox; + this->label1 = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->ageUpDownPicker = gcnew System::Windows::Forms::NumericUpDown; + this->favoriteColorComboBox = gcnew System::Windows::Forms::ComboBox; + this->label3 = gcnew System::Windows::Forms::Label; + this->label4 = gcnew System::Windows::Forms::Label; + this->label5 = gcnew System::Windows::Forms::Label; + this->label6 = gcnew System::Windows::Forms::Label; + + // Name Label + this->label1->Location = System::Drawing::Point( 56, 32 ); + this->label1->Size = System::Drawing::Size( 40, 23 ); + this->label1->Text = "Name:"; + + // Age Label + this->label2->Location = System::Drawing::Point( 40, 64 ); + this->label2->Size = System::Drawing::Size( 56, 23 ); + this->label2->Text = "Age (3-5)"; + + // Favorite Color Label + this->label3->Location = System::Drawing::Point( 24, 96 ); + this->label3->Size = System::Drawing::Size( 80, 24 ); + this->label3->Text = "Favorite color"; + + // ErrorBlinkStyle::AlwaysBlink Label + this->label4->Location = System::Drawing::Point( 264, 32 ); + this->label4->Size = System::Drawing::Size( 160, 23 ); + this->label4->Text = "ErrorBlinkStyle::AlwaysBlink"; + + // ErrorBlinkStyle::BlinkIfDifferentError Label + this->label5->Location = System::Drawing::Point( 264, 64 ); + this->label5->Size = System::Drawing::Size( 200, 23 ); + this->label5->Text = "ErrorBlinkStyle::BlinkIfDifferentError"; + + // ErrorBlinkStyle::NeverBlink Label + this->label6->Location = System::Drawing::Point( 264, 96 ); + this->label6->Size = System::Drawing::Size( 200, 23 ); + this->label6->Text = "ErrorBlinkStyle::NeverBlink"; + + // Name TextBox + this->nameTextBox1->Location = System::Drawing::Point( 112, 32 ); + this->nameTextBox1->Size = System::Drawing::Size( 120, 20 ); + this->nameTextBox1->TabIndex = 0; + this->nameTextBox1->Validated += gcnew System::EventHandler( this, &Form1::nameTextBox1_Validated ); + + // Age NumericUpDown + this->ageUpDownPicker->Location = System::Drawing::Point( 112, 64 ); + array^temp0 = {150,0,0,0}; + this->ageUpDownPicker->Maximum = System::Decimal( temp0 ); + this->ageUpDownPicker->TabIndex = 4; + this->ageUpDownPicker->Validated += gcnew System::EventHandler( this, &Form1::ageUpDownPicker_Validated ); + + // Favorite Color ComboBox + array^temp1 = {"None","Red","Yellow","Green","Blue","Purple"}; + this->favoriteColorComboBox->Items->AddRange( temp1 ); + this->favoriteColorComboBox->Location = System::Drawing::Point( 112, 96 ); + this->favoriteColorComboBox->Size = System::Drawing::Size( 120, 21 ); + this->favoriteColorComboBox->TabIndex = 5; + this->favoriteColorComboBox->Validated += gcnew System::EventHandler( this, &Form1::favoriteColorComboBox_Validated ); + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 464, 150 ); + array^temp2 = {this->label6,this->label5,this->label4,this->label3,this->favoriteColorComboBox,this->ageUpDownPicker,this->label2,this->label1,this->nameTextBox1}; + this->Controls->AddRange( temp2 ); + this->Text = "Error Provider Example"; + + // + // Create and set the ErrorProvider for each data entry control. + nameErrorProvider = gcnew System::Windows::Forms::ErrorProvider; + nameErrorProvider->SetIconAlignment( this->nameTextBox1, ErrorIconAlignment::MiddleRight ); + nameErrorProvider->SetIconPadding( this->nameTextBox1, 2 ); + nameErrorProvider->BlinkRate = 1000; + nameErrorProvider->BlinkStyle = System::Windows::Forms::ErrorBlinkStyle::AlwaysBlink; + ageErrorProvider = gcnew System::Windows::Forms::ErrorProvider; + ageErrorProvider->SetIconAlignment( this->ageUpDownPicker, ErrorIconAlignment::MiddleRight ); + ageErrorProvider->SetIconPadding( this->ageUpDownPicker, 2 ); + ageErrorProvider->BlinkStyle = System::Windows::Forms::ErrorBlinkStyle::BlinkIfDifferentError; + favoriteColorErrorProvider = gcnew System::Windows::Forms::ErrorProvider; + favoriteColorErrorProvider->SetIconAlignment( this->favoriteColorComboBox, ErrorIconAlignment::MiddleRight ); + favoriteColorErrorProvider->SetIconPadding( this->favoriteColorComboBox, 2 ); + favoriteColorErrorProvider->BlinkRate = 1000; + favoriteColorErrorProvider->BlinkStyle = System::Windows::Forms::ErrorBlinkStyle::NeverBlink; + // + } + + +private: + + // + void nameTextBox1_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( IsNameValid() ) + { + + // Clear the error, if any, in the error provider. + nameErrorProvider->SetError( this->nameTextBox1, String.Empty ); + } + else + { + + // Set the error if the name is not valid. + nameErrorProvider->SetError( this->nameTextBox1, "Name is required." ); + } + } + + void ageUpDownPicker_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( IsAgeTooYoung() ) + { + + // Set the error if the age is too young. + ageErrorProvider->SetError( this->ageUpDownPicker, "Age not old enough" ); + } + else + if ( IsAgeTooOld() ) + { + + // Set the error if the age is too old. + ageErrorProvider->SetError( this->ageUpDownPicker, "Age is too old" ); + } + else + { + + // Clear the error, if any, in the error provider. + ageErrorProvider->SetError( this->ageUpDownPicker, String.Empty ); + } + } + + void favoriteColorComboBox_Validated( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( !IsColorValid() ) + { + + // Set the error if the favorite color is not valid. + favoriteColorErrorProvider->SetError( this->favoriteColorComboBox, "Must select a color." ); + } + else + { + + // Clear the error, if any, in the error provider. + favoriteColorErrorProvider->SetError( this->favoriteColorComboBox, String.Empty ); + } + } + + + // + // Functions to verify data. + bool IsNameValid() + { + + // Determine whether the text box contains a zero-length String*. + return (nameTextBox1->Text->Length > 0); + } + + bool IsAgeTooYoung() + { + + // Determine whether the age value is less than three. + return (ageUpDownPicker->Value < 3); + } + + bool IsAgeTooOld() + { + + // Determine whether the age value is greater than five. + return (ageUpDownPicker->Value > 5); + } + + bool IsColorValid() + { + + // Determine whether the favorite color has a valid value. + return ((favoriteColorComboBox->SelectedItem != 0) && ( !favoriteColorComboBox->SelectedItem->Equals( "None" ))); + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp new file mode 100644 index 00000000000..41281581451 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FileDialog/CPP/filedialogform.cpp @@ -0,0 +1,203 @@ +// The following code example demonstrates using +// the following members: LostFocus, OpenFileDialog.Multiselect, +// FileNames, Title, ErrorProvider.GetError, PictureBox.Image, +// Application.DoEvents, and System.Drawing.Image.FromStream. + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializePictureBox(); + InitializeOpenFileDialog(); + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Button1 = gcnew System::Windows::Forms::Button; + this->ErrorProvider1 = gcnew System::Windows::Forms::ErrorProvider; + this->Label2 = gcnew System::Windows::Forms::Label; + this->fileButton = gcnew Button; + + this->SuspendLayout(); + this->OpenFileDialog1->Filter = "Images " + + "(*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|All files (*.*)|*.*"; + this->OpenFileDialog1->Multiselect = true; + this->OpenFileDialog1->Title = "My Image Browser"; + this->TextBox1->Location = System::Drawing::Point( 16, 56 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 150, 20 ); + this->TextBox1->TabIndex = 2; + this->TextBox1->Text = ""; + this->Button1->Location = System::Drawing::Point( 184, 48 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 88, 32 ); + this->Button1->TabIndex = 1; + this->Button1->Text = "Find pictures"; + this->fileButton->Location = System::Drawing::Point( 80, 40 ); + this->fileButton->Name = "fileButton"; + this->fileButton->TabIndex = 0; + this->fileButton->Text = "Button2"; + this->ErrorProvider1->ContainerControl = this; + this->Label2->Location = System::Drawing::Point( 24, 34 ); + this->Label2->Name = "Label2"; + this->Label2->Size = System::Drawing::Size( 150, 23 ); + this->Label2->TabIndex = 5; + this->Label2->Text = "Enter image file directory:"; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->PictureBox1 ); + this->Controls->Add( this->Label2 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + + this->Button1->Click += gcnew System::EventHandler( + this, &Form1::Button1_Click ); + this->fileButton->Click += gcnew System::EventHandler( + this, &Form1::fileButton_Click ); + this->TextBox1->LostFocus += gcnew System::EventHandler( + this, &Form1::TextBox1_LostFocus ); + this->TextBox1->Validating += gcnew System::ComponentModel::CancelEventHandler( + this, &Form1::TextBox1_Validating ); + + // Associate the event-handling method with the FileOk + // event. + this->OpenFileDialog1->FileOk += + gcnew System::ComponentModel::CancelEventHandler( + this, &Form1::OpenFileDialog1_FileOk ); + } + +internal: + System::Windows::Forms::OpenFileDialog^ OpenFileDialog1; + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::ErrorProvider^ ErrorProvider1; + System::Windows::Forms::Label ^ Label2; + System::Windows::Forms::Button^ fileButton; + System::Windows::Forms::PictureBox^ PictureBox1; + + // + // +private: + void TextBox1_Validating( Object^ sender, + System::ComponentModel::CancelEventArgs^ e ) + { + // If nothing is entered, + // an ArgumentException is caught; if an invalid directory is entered, + // a DirectoryNotFoundException is caught. An appropriate error message + // is displayed in either case. + try + { + System::IO::DirectoryInfo^ directory = gcnew System::IO::DirectoryInfo( TextBox1->Text ); + directory->GetFiles(); + ErrorProvider1->SetError( TextBox1, "" ); + } + catch ( System::ArgumentException^ ) + { + ErrorProvider1->SetError( TextBox1, "Please enter a directory" ); + } + catch ( System::IO::DirectoryNotFoundException^ ) + { + ErrorProvider1->SetError( TextBox1, "The directory does not exist." + "Try again with a different directory." ); + } + } + // + + // This method handles the LostFocus event for TextBox1 by setting the + // dialog's InitialDirectory property to the text in TextBox1. + void TextBox1_LostFocus( Object^ sender, System::EventArgs^ e ) + { + OpenFileDialog1->InitialDirectory = TextBox1->Text; + } + + // This method demonstrates using the ErrorProvider.GetError method + // to check for an error before opening the dialog box. + void Button1_Click( System::Object^ sender, System::EventArgs^ e ) + { + //If there is no error, then open the dialog box. + if ( ErrorProvider1->GetError( TextBox1 )->Equals( "" ) ) + { + ::DialogResult dialogResult = OpenFileDialog1->ShowDialog(); + } + } + // + + // These methods demonstrate the handling of the FileOk event and the + // use of the Application.DoEvents method. + // A user selects graphics files from an OpenFileDialog object. + // The files are displayed in the form. The Application.DoEvents + // method forces a repaint of the form for each graphics file opened. + // + void InitializePictureBox() + { + this->PictureBox1 = gcnew System::Windows::Forms::PictureBox; + this->PictureBox1->BorderStyle = + System::Windows::Forms::BorderStyle::FixedSingle; + this->PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; + this->PictureBox1->Location = System::Drawing::Point( 72, 112 ); + this->PictureBox1->Name = "PictureBox1"; + this->PictureBox1->Size = System::Drawing::Size( 160, 136 ); + this->PictureBox1->TabIndex = 6; + this->PictureBox1->TabStop = false; + } + + // + void InitializeOpenFileDialog() + { + this->OpenFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog; + + // Set the file dialog to filter for graphics files. + this->OpenFileDialog1->Filter = + "Images (*.BMP;*.JPG;*.GIF)|*.BMP;*.JPG;*.GIF|" + + "All files (*.*)|*.*"; + + // Allow the user to select multiple images. + this->OpenFileDialog1->Multiselect = true; + this->OpenFileDialog1->Title = "My Image Browser"; + } + + void fileButton_Click( System::Object^ sender, System::EventArgs^ e ) + { + OpenFileDialog1->ShowDialog(); + } + // + + // This method handles the FileOK event. It opens each file + // selected and loads the image from a stream into PictureBox1. + void OpenFileDialog1_FileOk( Object^ sender, + System::ComponentModel::CancelEventArgs^ e ) + { + this->Activate(); + array^ files = OpenFileDialog1->FileNames; + + // Open each file and display the image in PictureBox1. + // Call Application.DoEvents to force a repaint after each + // file is read. + for each ( String^ file in files ) + { + System::IO::FileInfo^ fileInfo = gcnew System::IO::FileInfo( file ); + System::IO::FileStream^ fileStream = fileInfo->OpenRead(); + PictureBox1->Image = System::Drawing::Image::FromStream( fileStream ); + Application::DoEvents(); + fileStream->Close(); + + // Call Sleep so the picture is briefly displayed, + //which will create a slide-show effect. + System::Threading::Thread::Sleep( 2000 ); + } + PictureBox1->Image = nullptr; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp new file mode 100644 index 00000000000..21c9a54c6aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FlowLayoutPanel/cpp/form1.cpp @@ -0,0 +1,243 @@ +// + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +// + +public ref class Form1 : public System::Windows::Forms::Form +{ + // +private: + void wrapContentsCheckBox_CheckedChanged( + System::Object^ sender, System::EventArgs^ e) + { + this->flowLayoutPanel1->WrapContents = + this->wrapContentsCheckBox->Checked; + } + // + + // +private: + void flowTopDownBtn_CheckedChanged(System::Object^ sender, + System::EventArgs^ e) + { + this->flowLayoutPanel1->FlowDirection = FlowDirection::TopDown; + } + +private: + void flowBottomUpBtn_CheckedChanged(System::Object^ sender, + System::EventArgs^ e) + { + this->flowLayoutPanel1->FlowDirection = FlowDirection::BottomUp; + } + +private: + void flowLeftToRight_CheckedChanged(System::Object^ sender, + System::EventArgs^ e) + { + this->flowLayoutPanel1->FlowDirection = + FlowDirection::LeftToRight; + } + +private: + void flowRightToLeftBtn_CheckedChanged( + System::Object^ sender, System::EventArgs^ e) + { + this->flowLayoutPanel1->FlowDirection = + FlowDirection::RightToLeft; + } + // + +#pragma region " Windows Form Designer generated code " + +public: + Form1(void) + { + + // This call is required by the Windows Form Designer. + InitializeComponent(); + + // Add any initialization after the InitializeComponent() + // call + + } + + // Form overrides dispose to clean up the component list. +protected: + ~Form1() + { + if (components != nullptr) + { + delete components; + } + } + +private: + System::Windows::Forms::FlowLayoutPanel^ flowLayoutPanel1; +private: + System::Windows::Forms::CheckBox^ wrapContentsCheckBox; +private: + System::Windows::Forms::RadioButton^ flowTopDownBtn; +private: + System::Windows::Forms::RadioButton^ flowBottomUpBtn; +private: + System::Windows::Forms::RadioButton^ flowLeftToRight; +private: + System::Windows::Forms::RadioButton^ flowRightToLeftBtn; +private: + System::Windows::Forms::Button^ button1; +private: + System::Windows::Forms::Button^ button2; +private: + System::Windows::Forms::Button^ button3; +private: + System::Windows::Forms::Button^ button4; + + // Required by the Windows Form Designer +private: + System::ComponentModel::IContainer^ components; + + // NOTE: The following procedure is required by the Windows Form + // Designer + // It can be modified using the Windows Form Designer. + // Do not modify it using the code editor. +private: + [System::Diagnostics::DebuggerNonUserCode] + void InitializeComponent() + { + this->flowLayoutPanel1 = + gcnew System::Windows::Forms::FlowLayoutPanel(); + this->button1 = gcnew System::Windows::Forms::Button(); + this->button2 = gcnew System::Windows::Forms::Button(); + this->button3 = gcnew System::Windows::Forms::Button(); + this->button4 = gcnew System::Windows::Forms::Button(); + this->wrapContentsCheckBox = + gcnew System::Windows::Forms::CheckBox(); + this->flowTopDownBtn = gcnew System::Windows::Forms::RadioButton(); + this->flowBottomUpBtn = + gcnew System::Windows::Forms::RadioButton(); + this->flowLeftToRight = + gcnew System::Windows::Forms::RadioButton(); + this->flowRightToLeftBtn = + gcnew System::Windows::Forms::RadioButton(); + this->flowLayoutPanel1->SuspendLayout(); + this->SuspendLayout(); + // + // flowLayoutPanel1 + // + this->flowLayoutPanel1->Controls->Add(this->button1); + this->flowLayoutPanel1->Controls->Add(this->button2); + this->flowLayoutPanel1->Controls->Add(this->button3); + this->flowLayoutPanel1->Controls->Add(this->button4); + this->flowLayoutPanel1->Location = + System::Drawing::Point(47, 55); + this->flowLayoutPanel1->Name = "flowLayoutPanel1"; + this->flowLayoutPanel1->TabIndex = 0; + // + // button1 + // + this->button1->Location = System::Drawing::Point(3, 3); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + // + // button2 + // + this->button2->Location = System::Drawing::Point(84, 3); + this->button2->Name = "button2"; + this->button2->TabIndex = 1; + this->button2->Text = "button2"; + // + // button3 + // + this->button3->Location = System::Drawing::Point(3, 32); + this->button3->Name = "button3"; + this->button3->TabIndex = 2; + this->button3->Text = "button3"; + // + // button4 + // + this->button4->Location = System::Drawing::Point(84, 32); + this->button4->Name = "button4"; + this->button4->TabIndex = 3; + this->button4->Text = "button4"; + // + // wrapContentsCheckBox + // + this->wrapContentsCheckBox->Location = + System::Drawing::Point(46, 162); + this->wrapContentsCheckBox->Name = "wrapContentsCheckBox"; + this->wrapContentsCheckBox->TabIndex = 1; + this->wrapContentsCheckBox->Text = "Wrap Contents"; + this->wrapContentsCheckBox->CheckedChanged += + gcnew System::EventHandler( + this, &Form1::wrapContentsCheckBox_CheckedChanged); + // + // flowTopDownBtn + // + this->flowTopDownBtn->Location = + System::Drawing::Point(45, 193); + this->flowTopDownBtn->Name = "flowTopDownBtn"; + this->flowTopDownBtn->TabIndex = 2; + this->flowTopDownBtn->Text = "Flow TopDown"; + this->flowTopDownBtn->CheckedChanged += + gcnew System::EventHandler( + this, &Form1::flowTopDownBtn_CheckedChanged); + // + // flowBottomUpBtn + // + this->flowBottomUpBtn->Location = + System::Drawing::Point(44, 224); + this->flowBottomUpBtn->Name = "flowBottomUpBtn"; + this->flowBottomUpBtn->TabIndex = 3; + this->flowBottomUpBtn->Text = "Flow BottomUp"; + this->flowBottomUpBtn->CheckedChanged += + gcnew System::EventHandler( + this, &Form1::flowBottomUpBtn_CheckedChanged); + // + // flowLeftToRight + // + this->flowLeftToRight->Location = + System::Drawing::Point(156, 193); + this->flowLeftToRight->Name = "flowLeftToRight"; + this->flowLeftToRight->TabIndex = 4; + this->flowLeftToRight->Text = "Flow LeftToRight"; + this->flowLeftToRight->CheckedChanged += + gcnew System::EventHandler( + this, &Form1::flowLeftToRight_CheckedChanged); + // + // flowRightToLeftBtn + // + this->flowRightToLeftBtn->Location = + System::Drawing::Point(155, 224); + this->flowRightToLeftBtn->Name = "flowRightToLeftBtn"; + this->flowRightToLeftBtn->TabIndex = 5; + this->flowRightToLeftBtn->Text = "Flow RightToLeft"; + this->flowRightToLeftBtn->CheckedChanged += + gcnew System::EventHandler( + this, &Form1::flowRightToLeftBtn_CheckedChanged); + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(292, 266); + this->Controls->Add(this->flowRightToLeftBtn); + this->Controls->Add(this->flowLeftToRight); + this->Controls->Add(this->flowBottomUpBtn); + this->Controls->Add(this->flowTopDownBtn); + this->Controls->Add(this->wrapContentsCheckBox); + this->Controls->Add(this->flowLayoutPanel1); + this->Name = "Form1"; + this->Text = "Form1"; + this->flowLayoutPanel1->ResumeLayout(false); + this->ResumeLayout(false); + } + +#pragma endregion +}; +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp new file mode 100644 index 00000000000..48a64a5dc48 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FolderBrowserDialog/CPP/form1.cpp @@ -0,0 +1,167 @@ + + +// +// The following example displays an application that provides the ability to +// open rich text files (rtf) into the RichTextBox. The example demonstrates +// using the FolderBrowserDialog to set the default directory for opening files. +// The OpenFileDialog is used to open the file. +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::IO; +public ref class FolderBrowserDialogExampleForm: public System::Windows::Forms::Form +{ +private: + FolderBrowserDialog^ folderBrowserDialog1; + OpenFileDialog^ openFileDialog1; + RichTextBox^ richTextBox1; + MainMenu^ mainMenu1; + MenuItem^ fileMenuItem; + MenuItem^ openMenuItem; + MenuItem^ folderMenuItem; + MenuItem^ closeMenuItem; + String^ openFileName; + String^ folderName; + bool fileOpened; + +public: + + // Constructor. + FolderBrowserDialogExampleForm() + { + fileOpened = false; + this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->fileMenuItem = gcnew System::Windows::Forms::MenuItem; + this->openMenuItem = gcnew System::Windows::Forms::MenuItem; + this->folderMenuItem = gcnew System::Windows::Forms::MenuItem; + this->closeMenuItem = gcnew System::Windows::Forms::MenuItem; + this->openFileDialog1 = gcnew System::Windows::Forms::OpenFileDialog; + this->folderBrowserDialog1 = gcnew System::Windows::Forms::FolderBrowserDialog; + this->richTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->mainMenu1->MenuItems->Add( this->fileMenuItem ); + array^temp0 = {this->openMenuItem,this->closeMenuItem,this->folderMenuItem}; + this->fileMenuItem->MenuItems->AddRange( temp0 ); + this->fileMenuItem->Text = "File"; + this->openMenuItem->Text = "Open..."; + this->openMenuItem->Click += gcnew System::EventHandler( this, &FolderBrowserDialogExampleForm::openMenuItem_Click ); + this->folderMenuItem->Text = "Select Directory..."; + this->folderMenuItem->Click += gcnew System::EventHandler( this, &FolderBrowserDialogExampleForm::folderMenuItem_Click ); + this->closeMenuItem->Text = "Close"; + this->closeMenuItem->Click += gcnew System::EventHandler( this, &FolderBrowserDialogExampleForm::closeMenuItem_Click ); + this->closeMenuItem->Enabled = false; + this->openFileDialog1->DefaultExt = "rtf"; + this->openFileDialog1->Filter = "rtf files (*.rtf)|*.rtf"; + + // Set the help text description for the FolderBrowserDialog. + this->folderBrowserDialog1->Description = "Select the directory that you want to use as the default."; + + // Do not allow the user to create new files via the FolderBrowserDialog. + this->folderBrowserDialog1->ShowNewFolderButton = false; + + // Default to the My Documents folder. + this->folderBrowserDialog1->RootFolder = Environment::SpecialFolder::Personal; + this->richTextBox1->AcceptsTab = true; + this->richTextBox1->Location = System::Drawing::Point( 8, 8 ); + this->richTextBox1->Size = System::Drawing::Size( 280, 344 ); + this->richTextBox1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Right); + this->ClientSize = System::Drawing::Size( 296, 360 ); + this->Controls->Add( this->richTextBox1 ); + this->Menu = this->mainMenu1; + this->Text = "RTF Document Browser"; + } + + +private: + + // Bring up a dialog to open a file. + void openMenuItem_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // If a file is not opened then set the initial directory to the + // FolderBrowserDialog::SelectedPath value. + if ( !fileOpened ) + { + openFileDialog1->InitialDirectory = folderBrowserDialog1->SelectedPath; + openFileDialog1->FileName = nullptr; + } + + + // Display the openFile Dialog. + System::Windows::Forms::DialogResult result = openFileDialog1->ShowDialog(); + + // OK button was pressed. + if ( result == ::DialogResult::OK ) + { + openFileName = openFileDialog1->FileName; + try + { + + // Output the requested file in richTextBox1. + Stream^ s = openFileDialog1->OpenFile(); + richTextBox1->LoadFile( s, RichTextBoxStreamType::RichText ); + s->Close(); + fileOpened = true; + } + catch ( Exception^ exp ) + { + MessageBox::Show( String::Concat( "An error occurred while attempting to load the file. The error is: ", System::Environment::NewLine, exp, System::Environment::NewLine ) ); + fileOpened = false; + } + + Invalidate(); + closeMenuItem->Enabled = fileOpened; + } + // Cancel button was pressed. + else + + // Cancel button was pressed. + if ( result == ::DialogResult::Cancel ) + { + return; + } + } + + + // Close the current file. + void closeMenuItem_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + richTextBox1->Text = ""; + fileOpened = false; + closeMenuItem->Enabled = false; + } + + + // Bring up a dialog to chose a folder path in which to open/save a file. + void folderMenuItem_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Show the FolderBrowserDialog. + System::Windows::Forms::DialogResult result = folderBrowserDialog1->ShowDialog(); + if ( result == ::DialogResult::OK ) + { + folderName = folderBrowserDialog1->SelectedPath; + if ( !fileOpened ) + { + + // No file is opened, bring up openFileDialog in selected path. + openFileDialog1->InitialDirectory = folderName; + openFileDialog1->FileName = nullptr; + openMenuItem->PerformClick(); + } + } + } + +}; + + +// The main entry point for the application. +int main() +{ + Application::Run( gcnew FolderBrowserDialogExampleForm ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp new file mode 100644 index 00000000000..e8f6838a187 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FontDialogMustExist/CPP/form1.cpp @@ -0,0 +1,164 @@ + + +#using +#using +#using + +// The following code example demonstrates using the FontDialog.MinSize, +// FontDialog.MaxSize, and FontDialog.ShowEffects members, and +// handling of Apply event. +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::FontDialog^ FontDialog1; + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::TextBox^ TextBox1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->FontDialog1 = gcnew System::Windows::Forms::FontDialog; + this->Button1 = gcnew System::Windows::Forms::Button; + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + //FontDialog1 + // + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 72, 136 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 144, 88 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click for Font Dialog"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //TextBox1 + // + this->TextBox1->Location = System::Drawing::Point( 72, 48 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 152, 20 ); + this->TextBox1->TabIndex = 1; + this->TextBox1->Text = "Here is some text."; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // + void Button1_Click( System::Object^ sender, System::EventArgs^ e ) + { + // Set FontMustExist to true, which causes message box error + // if the user enters a font that does not exist. + FontDialog1->FontMustExist = true; + + // Associate the method handling the Apply event with the event. + FontDialog1->Apply += gcnew System::EventHandler( this, &Form1::FontDialog1_Apply ); + + // Set a minimum and maximum size to be + // shown in the FontDialog. + FontDialog1->MaxSize = 32; + FontDialog1->MinSize = 18; + + // Show the Apply button in the dialog. + FontDialog1->ShowApply = true; + + // Do not show effects such as Underline + // and Bold. + FontDialog1->ShowEffects = false; + + // Save the existing font. + System::Drawing::Font^ oldFont = this->Font; + + //Show the dialog, and get the result + System::Windows::Forms::DialogResult result = FontDialog1->ShowDialog(); + + // If the OK button in the Font dialog box is clicked, + // set all the controls' fonts to the chosen font by calling + // the FontDialog1_Apply method. + if ( result == ::DialogResult::OK ) + { + FontDialog1_Apply( this->Button1, gcnew System::EventArgs ); + } + // If Cancel is clicked, set the font back to + // the original font. + else + + // If Cancel is clicked, set the font back to + // the original font. + if ( result == ::DialogResult::Cancel ) + { + this->Font = oldFont; + System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Control^ containedControl = safe_cast(myEnum->Current); + containedControl->Font = oldFont; + } + } + } + + + // Handle the Apply event by setting all controls' fonts to + // the chosen font. + void FontDialog1_Apply( Object^ sender, System::EventArgs^ e ) + { + this->Font = FontDialog1->Font; + System::Collections::IEnumerator^ myEnum1 = this->Controls->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + Control^ containedControl = safe_cast(myEnum1->Current); + containedControl->Font = FontDialog1->Font; + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp new file mode 100644 index 00000000000..88a3c2f18e0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormExample/CPP/form1.cpp @@ -0,0 +1,137 @@ + + +#using +#using +#using + +// The following code example demonstrates the result of setting +// the desktop bounds and desktop location. It also demonstrates +// the Form.MaximumSize property. +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ + + // +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Set the maximum size, so if user maximizes form, it + //will not cover entire desktop. + this->MaximumSize = System::Drawing::Size( 500, 500 ); + } + // + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Button^ Button2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 96, 48 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 96, 40 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click me to see the form move"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Button2 + // + this->Button2->Location = System::Drawing::Point( 96, 120 ); + this->Button2->Name = "Button2"; + this->Button2->Size = System::Drawing::Size( 96, 48 ); + this->Button2->TabIndex = 1; + this->Button2->Text = "Click me to see form shrink (and move)"; + this->Button2->Click += gcnew System::EventHandler( this, &Form1::Button2_Click ); + + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // + void Button1_Click( System::Object^ sender, System::EventArgs^ e ) + { + for ( int i = 0; i <= 25; i++ ) + { + + // With each loop through the code, the form's desktop + // location is adjusted right and down by 10 pixels. + this->SetDesktopLocation( this->Location.X + 10, this->Location.Y + 10 ); + + // Call Sleep to give the effect of the form walking + // across the screen. + System::Threading::Thread::Sleep( 250 ); + + } + + // Set the location back to the upper left-hand corner of + // the screen. + this->SetDesktopLocation( 10, 10 ); + } + // + + // + void Button2_Click( System::Object^ sender, System::EventArgs^ e ) + { + for ( int i = 0; i <= 20; i++ ) + { + + // With each loop through the code, the form's + // desktop location is adjusted right and down + // by 10 pixels and its height and width are each + // decreased by 10 pixels. + this->SetDesktopBounds( this->Location.X + 10, this->Location.Y + 10, this->Width - 10, this->Height - 10 ); + + // Call Sleep to show the form gradually shrinking. + System::Threading::Thread::Sleep( 50 ); + + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp new file mode 100644 index 00000000000..4f94204f708 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.FormsActivate/CPP/form1.cpp @@ -0,0 +1,151 @@ + + +#using +#using +#using + +// The following code example demonstrates another use of the +// Form.SetDesktopLocation and Form.Activate members, +// and demonstrates handling the Form.Load and Form.Activate +// events. +using namespace System; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Label ^ Label1; + System::Windows::Forms::Label ^ Label2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Label1 = gcnew System::Windows::Forms::Label; + this->Label2 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 104, 80 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 96, 56 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click me for an new inactivated form."; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Label1 + // + this->Label1->Location = System::Drawing::Point( 104, 160 ); + this->Label1->Name = "Label1"; + this->Label1->TabIndex = 1; + this->Label1->Text = "Label1"; + + // + //Label2 + // + this->Label2->Location = System::Drawing::Point( 104, 208 ); + this->Label2->Name = "Label2"; + this->Label2->Size = System::Drawing::Size( 40, 40 ); + this->Label2->TabIndex = 2; + this->Label2->Text = "Label2"; + this->Label2->AutoSize = true; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label2 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Activated += gcnew System::EventHandler( this, &Form1::Form1_Activated ); + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->Closed += gcnew System::EventHandler( this, &Form1::Form1_Closed ); + this->ResumeLayout( false ); + } + + // + static int x = 200; + static int y = 200; + void Button1_Click( System::Object^ sender, System::EventArgs^ e ) + { + + // Create a new Form1 and set its Visible property to true. + Form1^ form2 = gcnew Form1; + form2->Visible = true; + + // Set the new form's desktop location so it + // appears below and to the right of the current form. + form2->SetDesktopLocation( x, y ); + x += 30; + y += 30; + + // Keep the current form active by calling the Activate + // method. + this->Activate(); + this->Button1->Enabled = false; + } + + + // Updates the label text to reflect the current values of x + // and y, which was were incremented in the Button1 control's + // click event. + void Form1_Activated( Object^ sender, System::EventArgs^ e ) + { + Label1->Text = String::Format( "x: {0} y: {1}", x, y ); + Label2->Text = String::Format( "Number of forms currently open: {0}", count ); + } + + static int count = 0; + void Form1_Closed( Object^ sender, System::EventArgs^ e ) + { + count -= 1; + } + + void Form1_Load( Object^ sender, System::EventArgs^ e ) + { + count += 1; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp new file mode 100644 index 00000000000..ae905ef4d10 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewAutoSize/CPP/form1.cpp @@ -0,0 +1,214 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + //Form calls destructor to clean up the component list. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +internal: + System::Windows::Forms::DataGridView ^ dataGridView1; + +private: + System::Windows::Forms::Button^ Button1; + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerNonUserCode] + void InitializeComponent() + { + this->dataGridView1 = gcnew System::Windows::Forms::DataGridView; + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // dataGridView1 + // + this->dataGridView1->Location = System::Drawing::Point( 75, 67 ); + this->dataGridView1->Name = "dataGridView1"; + this->dataGridView1->Size = System::Drawing::Size( 152, 148 ); + this->dataGridView1->TabIndex = 0; + + // + // Button1 + // + this->Button1->Location = System::Drawing::Point( 101, 240 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 1; + this->Button1->Text = "Automatically Resize Cells"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->dataGridView1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + +internal: + + static property Form1^ GetInstance + { + Form1^ get() + { + if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) + { + System::Threading::Monitor::Enter( m_SyncObject ); + try + { + if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) + { + m_DefaultInstance = gcnew Form1; + } + } + finally + { + System::Threading::Monitor::Exit( m_SyncObject ); + } + } + + return m_DefaultInstance; + } + } + +private: + static Form1^ m_DefaultInstance; + static Object^ m_SyncObject = gcnew Object; + + // + // + void InitializeDataGridView() + { + this->Size = System::Drawing::Size( 600, 600 ); + dataGridView1->Size = System::Drawing::Size( 450, 400 ); + + // Create an unbound DataGridView by declaring a column count. + dataGridView1->ColumnCount = 4; + dataGridView1->ColumnHeadersVisible = true; + + // Set the column header style. + DataGridViewCellStyle ^ columnHeaderStyle = gcnew DataGridViewCellStyle; + columnHeaderStyle->BackColor = Color::Aqua; + columnHeaderStyle->Font = gcnew System::Drawing::Font( "Verdana",10,FontStyle::Bold ); + dataGridView1->ColumnHeadersDefaultCellStyle = columnHeaderStyle; + + // Set the column header names. + dataGridView1->Columns[ 0 ]->Name = "Recipe"; + dataGridView1->Columns[ 1 ]->Name = "Category"; + dataGridView1->Columns[ 2 ]->Name = "Main Ingredients"; + dataGridView1->Columns[ 3 ]->Name = "Rating"; + + // Populate the rows. + array^row1 = gcnew array{ + "Meatloaf","Main Dish","ground beef","**" + }; + array^row2 = gcnew array{ + "Key Lime Pie","Dessert","lime juice, evaporated milk","****" + }; + array^row3 = gcnew array{ + "Orange-Salsa Pork Chops","Main Dish","pork chops, salsa, orange juice","****" + }; + array^row4 = gcnew array{ + "Black Bean and Rice Salad","Salad","black beans, brown rice","****" + }; + array^row5 = gcnew array{ + "Chocolate Cheesecake","Dessert","cream cheese","***" + }; + array^row6 = gcnew array{ + "Black Bean Dip","Appetizer","black beans, sour cream","***" + }; + array^rows = {row1,row2,row3,row4,row5,row6}; + System::Collections::IEnumerator^ myEnum = rows->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + array^rowArray = safe_cast^>(myEnum->Current); + dataGridView1->Rows->Add( rowArray ); + } + } + + // + void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Resize the height of the column headers. + dataGridView1->AutoResizeColumnHeadersHeight(); + + // Resize all the row heights to fit the contents of all non-header cells. + dataGridView1->AutoResizeRows( + DataGridViewAutoSizeRowsMode::AllCellsExceptHeaders); + } + // + // + + void InitializeContextMenu() + { + // Create the menu item. + MenuItem^ getRecipe = gcnew MenuItem( "Search for recipe",gcnew System::EventHandler( this, &Form1::OnMenuClick ) ); + + // Add the menu item to the shortcut menu. + System::Windows::Forms::ContextMenuStrip^ recipeMenu = gcnew System::Windows::Forms::ContextMenuStrip(); + + // Set the shortcut menu for the first column. + dataGridView1->Columns[ 0 ]->ContextMenuStrip = recipeMenu; + } + + void OnMenuClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( dataGridView1->CurrentCell != nullptr ) + { + //Retrieve the recipe name. + String^ recipeName = dynamic_cast(dataGridView1->CurrentCell->Value); + + //Search for the recipe. + System::Diagnostics::Process::Start( String::Format( "http://search.msn.com/results.aspx?q={0}", recipeName ), nullptr ); + } + } + +private: + + // + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + InitializeDataGridView(); + InitializeContextMenu(); + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp new file mode 100644 index 00000000000..f554906e42e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewSimpleBound/CPP/form1.cpp @@ -0,0 +1,165 @@ +// +#using +#using +#using +#using +#using +#using +#using + +using namespace System; +using namespace System::Data; +using namespace System::Data::SqlClient; +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeDataGridView(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + System::Windows::Forms::DataGridView ^ dataGridView1; + System::Windows::Forms::BindingSource ^ bindingSource1; + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerNonUserCode] + void InitializeComponent() + { + this->dataGridView1 = gcnew System::Windows::Forms::DataGridView; + this->bindingSource1 = gcnew System::Windows::Forms::BindingSource; + this->SuspendLayout(); + + // + //DataGridView1 + // + this->dataGridView1->Location = System::Drawing::Point( 96, 71 ); + this->dataGridView1->Name = "DataGridView1"; + this->dataGridView1->Size = System::Drawing::Size( 321, 286 ); + this->dataGridView1->TabIndex = 0; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 518, 413 ); + this->Controls->Add( this->dataGridView1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + +internal: + + static property Form1^ GetInstance + { + Form1^ get() + { + if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) + { + System::Threading::Monitor::Enter( m_SyncObject ); + try + { + if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) + { + m_DefaultInstance = gcnew Form1; + } + } + finally + { + System::Threading::Monitor::Exit( m_SyncObject ); + } + } + + return m_DefaultInstance; + } + } + +private: + static Form1^ m_DefaultInstance; + static Object^ m_SyncObject = gcnew Object; + + // + void InitializeDataGridView() + { + try + { + // Set up the DataGridView. + dataGridView1->Dock = DockStyle::Fill; + + // Automatically generate the DataGridView columns. + dataGridView1->AutoGenerateColumns = true; + + // Set up the data source. + bindingSource1->DataSource = GetData( "Select * From Products" ); + dataGridView1->DataSource = bindingSource1; + + // Automatically resize the visible rows. + dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::DisplayedCellsExceptHeaders; + + // Set the DataGridView control's border. + dataGridView1->BorderStyle = BorderStyle::Fixed3D; + + // Put the cells in edit mode when user enters them. + dataGridView1->EditMode = DataGridViewEditMode::EditOnEnter; + } + catch ( SqlException^ ) + { + MessageBox::Show( "To run this sample replace connection.ConnectionString" + " with a valid connection string to a Northwind" + " database accessible to your system.", "ERROR", MessageBoxButtons::OK, MessageBoxIcon::Exclamation ); + System::Threading::Thread::CurrentThread->Abort(); + } + catch ( System::Exception^ ex ) + { + MessageBox::Show( ex->ToString() ); + } + } + + + // + // + DataTable^ GetData( String^ sqlCommand ) + { + String^ connectionString = "Integrated Security=SSPI;Persist Security Info=False;" + "Initial Catalog=Northwind;Data Source= localhost"; + SqlConnection^ northwindConnection = gcnew SqlConnection( connectionString ); + SqlCommand^ command = gcnew SqlCommand( sqlCommand,northwindConnection ); + SqlDataAdapter^ adapter = gcnew SqlDataAdapter; + adapter->SelectCommand = command; + DataTable^ table = gcnew DataTable; + adapter->Fill( table ); + return table; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp new file mode 100644 index 00000000000..30d2bc3dd43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GridViewUnbound/CPP/form1.cpp @@ -0,0 +1,364 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + Panel^ buttonPanel; + DataGridView^ dataGridView1; + Button^ addNewRowButton; + Button^ deleteRowButton; + Button^ ledgerStyleButton; + bool editedLastColumn; + +public: + Form1() + { + buttonPanel = gcnew Panel; + dataGridView1 = gcnew DataGridView; + addNewRowButton = gcnew Button; + deleteRowButton = gcnew Button; + ledgerStyleButton = gcnew Button; + editedLastColumn = false; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + +private: + void Form1_Load( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + SetUpLayout(); + SetUpDataGridView(); + StyleCells(); + PopulateDataGridView(); + } + + + // Set up the button and button panel. + void SetUpLayout() + { + this->Size = System::Drawing::Size( 600, 600 ); + { + addNewRowButton->Text = "Add Row"; + addNewRowButton->Location = Point(10,10); + } + { + deleteRowButton->Text = "Delete Row"; + deleteRowButton->Location = Point(100,10); + } + { + ledgerStyleButton->Text = "Ledger Style"; + ledgerStyleButton->Size = System::Drawing::Size( 80, 30 ); + ledgerStyleButton->Location = Point(200,10); + } + { + buttonPanel->Controls->Add( addNewRowButton ); + buttonPanel->Controls->Add( deleteRowButton ); + buttonPanel->Controls->Add( ledgerStyleButton ); + buttonPanel->Height = 50; + buttonPanel->Dock = DockStyle::Bottom; + } + this->Controls->Add( this->buttonPanel ); + } + + // + void dataGridView1_CellFormatting( Object^ /*sender*/, DataGridViewCellFormattingEventArgs^ e ) + { + // If the column is the Artist column, check the + // value. + if ( this->dataGridView1->Columns[ e->ColumnIndex ]->Name->Equals( "Artist" ) ) + { + if ( e->Value != nullptr ) + { + // Check for the string "pink" in the cell. + String^ stringValue = dynamic_cast(e->Value); + stringValue = stringValue->ToLower(); + if ( (stringValue->IndexOf( "pink" ) > -1) ) + { + DataGridViewCellStyle^ pinkStyle = gcnew DataGridViewCellStyle; + + //Change the style of the cell. + pinkStyle->BackColor = Color::Pink; + pinkStyle->ForeColor = Color::Black; + pinkStyle->Font = gcnew System::Drawing::Font( "Times New Roman",8,FontStyle::Bold ); + e->CellStyle = pinkStyle; + } + + } + } + else + if ( this->dataGridView1->Columns[ e->ColumnIndex ]->Name->Equals( "Release Date" ) ) + { + ShortFormDateFormat( e ); + } + } + + + //Even though the date internaly stores the year as YYYY, using formatting, the + //UI can have the format in YY. + void ShortFormDateFormat( DataGridViewCellFormattingEventArgs^ formatting ) + { + if ( formatting->Value != nullptr ) + { + try + { + System::Text::StringBuilder^ dateString = gcnew System::Text::StringBuilder; + DateTime theDate = DateTime::Parse( formatting->Value->ToString() ); + dateString->Append( theDate.Month ); + dateString->Append( "/" ); + dateString->Append( theDate.Day ); + dateString->Append( "/" ); + dateString->Append( theDate.Year.ToString()->Substring( 2 ) ); + formatting->Value = dateString->ToString(); + formatting->FormattingApplied = true; + } + catch ( Exception^ /*notInDateFormat*/ ) + { + // Set to false in case there are other handlers interested trying to + // format this DataGridViewCellFormattingEventArgs instance. + formatting->FormattingApplied = false; + } + + } + } + // + + // + // Handling CellParsing allows one to accept user input, then map it to a different + // internal representation. + void dataGridView1_CellParsing( Object^ /*sender*/, DataGridViewCellParsingEventArgs^ e ) + { + if ( this->dataGridView1->Columns[ e->ColumnIndex ]->Name->Equals( "Release Date" ) ) + { + if ( e != nullptr ) + { + if ( e->Value != nullptr ) + { + try + { + // Map what the user typed into UTC. + e->Value = DateTime::Parse( e->Value->ToString() ).ToUniversalTime(); + + // Set the ParsingApplied property to + // Show the event is handled. + e->ParsingApplied = true; + } + catch ( FormatException^ /*ex*/ ) + { + // Set to false in case another CellParsing handler + // wants to try to parse this DataGridViewCellParsingEventArgs instance. + e->ParsingApplied = false; + } + } + } + } + } + // + + // + void addNewRowButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + this->dataGridView1->Rows->Add(); + } + // + + // + void deleteRowButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + if ( this->dataGridView1->SelectedRows->Count > 0 && this->dataGridView1->SelectedRows[ 0 ]->Index != this->dataGridView1->Rows->Count - 1 ) + { + this->dataGridView1->Rows->RemoveAt( this->dataGridView1->SelectedRows[ 0 ]->Index ); + } + } + // + + // + // + void ledgerStyleButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create a new cell style. + DataGridViewCellStyle^ style = gcnew DataGridViewCellStyle; + { + style->BackColor = Color::Beige; + style->ForeColor = Color::Brown; + style->Font = gcnew System::Drawing::Font( "Verdana",8 ); + } + + // Apply the style as the default cell style. + dataGridView1->AlternatingRowsDefaultCellStyle = style; + ledgerStyleButton->Enabled = false; + } + // + + // + void SetUpDataGridView() + { + this->Controls->Add( dataGridView1 ); + dataGridView1->ColumnCount = 5; + DataGridViewCellStyle^ style = dataGridView1->ColumnHeadersDefaultCellStyle; + style->BackColor = Color::Navy; + style->ForeColor = Color::White; + style->Font = gcnew System::Drawing::Font( dataGridView1->Font,FontStyle::Bold ); + dataGridView1->EditMode = DataGridViewEditMode::EditOnEnter; + dataGridView1->Name = "dataGridView1"; + dataGridView1->Location = Point(8,8); + dataGridView1->Size = System::Drawing::Size( 500, 300 ); + dataGridView1->AutoSizeRowsMode = DataGridViewAutoSizeRowsMode::DisplayedCellsExceptHeaders; + dataGridView1->ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle::Raised; + dataGridView1->CellBorderStyle = DataGridViewCellBorderStyle::Single; + dataGridView1->GridColor = SystemColors::ActiveBorder; + dataGridView1->RowHeadersVisible = false; + dataGridView1->Columns[ 0 ]->Name = "Release Date"; + dataGridView1->Columns[ 1 ]->Name = "Track"; + dataGridView1->Columns[ 1 ]->DefaultCellStyle->Alignment = DataGridViewContentAlignment::MiddleCenter; + dataGridView1->Columns[ 2 ]->Name = "Title"; + dataGridView1->Columns[ 3 ]->Name = "Artist"; + dataGridView1->Columns[ 4 ]->Name = "Album"; + + // Make the font italic for row four. + dataGridView1->Columns[ 4 ]->DefaultCellStyle->Font = gcnew System::Drawing::Font( DataGridView::DefaultFont,FontStyle::Italic ); + dataGridView1->SelectionMode = DataGridViewSelectionMode::FullRowSelect; + dataGridView1->MultiSelect = false; + dataGridView1->BackgroundColor = Color::Honeydew; + dataGridView1->Dock = DockStyle::Fill; + dataGridView1->CellFormatting += gcnew DataGridViewCellFormattingEventHandler( this, &Form1::dataGridView1_CellFormatting ); + dataGridView1->CellParsing += gcnew DataGridViewCellParsingEventHandler( this, &Form1::dataGridView1_CellParsing ); + addNewRowButton->Click += gcnew EventHandler( this, &Form1::addNewRowButton_Click ); + deleteRowButton->Click += gcnew EventHandler( this, &Form1::deleteRowButton_Click ); + ledgerStyleButton->Click += gcnew EventHandler( this, &Form1::ledgerStyleButton_Click ); + dataGridView1->CellValidating += gcnew DataGridViewCellValidatingEventHandler( this, &Form1::dataGridView1_CellValidating ); + } + // + + // + void PopulateDataGridView() + { + // Create the string array for each row of data. + array^row0 = {"11/22/1968","29","Revolution 9","Beatles","The Beatles [White Album]"}; + array^row1 = {"4/4/1960","6","Fools Rush In","Frank Sinatra","Nice 'N' Easy"}; + array^row2 = {"11/11/1971","1","One of These Days","Pink Floyd","Meddle"}; + array^row3 = {"4/4/1988","7","Where Is My Mind?","Pixies","Surfer Rosa"}; + array^row4 = {"5/1981","9","Can't Find My Mind","Cramps","Psychedelic Jungle"}; + array^row5 = {"6/10/2003","13","Scatterbrain. (As Dead As Leaves.)","Radiohead","Hail to the Thief"}; + array^row6 = {"6/30/1992","3","Dress","P J Harvey","Dry"}; + + // Add a row for each string array. + { + DataGridViewRowCollection^ rows = this->dataGridView1->Rows; + rows->Add( row0 ); + rows->Add( row1 ); + rows->Add( row2 ); + rows->Add( row3 ); + rows->Add( row4 ); + rows->Add( row5 ); + rows->Add( row6 ); + } + + // Change the order the columns are displayed. + { + DataGridViewColumnCollection^ columns = this->dataGridView1->Columns; + columns[ 0 ]->DisplayIndex = 3; + columns[ 1 ]->DisplayIndex = 4; + columns[ 2 ]->DisplayIndex = 0; + columns[ 3 ]->DisplayIndex = 1; + columns[ 4 ]->DisplayIndex = 2; + } + } + // + // + + // + void dataGridView1_CellValidating( Object^ /*sender*/, DataGridViewCellValidatingEventArgs^ newValue ) + { + DataGridViewColumn^ column = dataGridView1->Columns[ newValue->ColumnIndex ]; + if ( column->Name->Equals( "Track" ) ) + { + CheckTrack( newValue ); + } + else + if ( column->Name->Equals( "Release Date" ) ) + { + CheckDate( newValue ); + } + } + + void CheckTrack( DataGridViewCellValidatingEventArgs^ newValue ) + { + Int32 ignored; + if ( newValue->FormattedValue->ToString() == String::Empty ) + { + NotifyUserAndForceRedo( "Please enter a track", newValue ); + } + else + if ( !Int32::TryParse( newValue->FormattedValue->ToString(), ignored ) ) + { + NotifyUserAndForceRedo( "A Track must be a number", newValue ); + } + else + if ( Int32::Parse( newValue->FormattedValue->ToString() ) < 1 ) + { + NotifyUserAndForceRedo( "Not a valid track", newValue ); + editedLastColumn = true; + } + } + + void NotifyUserAndForceRedo( String^ errorMessage, DataGridViewCellValidatingEventArgs^ newValue ) + { + MessageBox::Show( errorMessage ); + newValue->Cancel = true; + } + + void CheckDate( DataGridViewCellValidatingEventArgs^ newValue ) + { + try + { + DateTime::Parse( newValue->FormattedValue->ToString() ).ToLongDateString(); + AnnotateCell( String::Empty, newValue ); + } + catch ( FormatException^ /*ex*/ ) + { + AnnotateCell( "You did not enter a valid date.", newValue ); + } + } + + void AnnotateCell( String^ errorMessage, DataGridViewCellValidatingEventArgs^ editEvent ) + { + DataGridViewCell^ cell = dataGridView1->Rows[ editEvent->RowIndex ]->Cells[ editEvent->ColumnIndex ]; + cell->ErrorText = errorMessage; + } + // + + //Private Sub TurnOff_EditOnEnter(ByVal sender As Object, ByVal args As DataGridViewCellEventArgs) Handles dataGridView1.RowValidated + // If editedLastColumn Then + // dataGridView1.EditMode = DataGridViewEditMode.EditProgrammatically + // End If + //End Sub + // + void StyleCells() + { + dataGridView1->CellBorderStyle = DataGridViewCellBorderStyle::None; + dataGridView1->CellBorderStyle = DataGridViewCellBorderStyle::Single; + } + // +}; + +int main() +{ + try + { + Application::Run( gcnew Form1 ); + } + catch ( Exception^ e ) + { + MessageBox::Show( e->ToString() ); + } + +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp new file mode 100644 index 00000000000..f7071210b7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRadioButtonExample/CPP/form1.cpp @@ -0,0 +1,136 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeRadioButtonsAndGroupBox(); + this->RadioButton1->CheckedChanged += gcnew EventHandler( this,&Form1::RadioButton_CheckedChanged ); + this->RadioButton2->CheckedChanged += gcnew EventHandler( this,&Form1::RadioButton_CheckedChanged ); + this->RadioButton3->CheckedChanged += gcnew EventHandler( this,&Form1::RadioButton_CheckedChanged ); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // +internal: + System::Windows::Forms::GroupBox^ GroupBox1; + System::Windows::Forms::RadioButton^ RadioButton1; + System::Windows::Forms::RadioButton^ RadioButton2; + System::Windows::Forms::RadioButton^ RadioButton3; + +private: + void InitializeRadioButtonsAndGroupBox() + { + + // Construct the GroupBox object. + this->GroupBox1 = gcnew GroupBox; + + // Construct the radio buttons. + this->RadioButton1 = gcnew System::Windows::Forms::RadioButton; + this->RadioButton2 = gcnew System::Windows::Forms::RadioButton; + this->RadioButton3 = gcnew System::Windows::Forms::RadioButton; + + // Set the location, tab and text for each radio button + // to a cursor from the Cursors enumeration. + this->RadioButton1->Location = System::Drawing::Point( 24, 24 ); + this->RadioButton1->TabIndex = 0; + this->RadioButton1->Text = "Help"; + this->RadioButton1->Tag = Cursors::Help; + this->RadioButton1->TextAlign = ContentAlignment::MiddleCenter; + this->RadioButton2->Location = System::Drawing::Point( 24, 56 ); + this->RadioButton2->TabIndex = 1; + this->RadioButton2->Text = "Up Arrow"; + this->RadioButton2->Tag = Cursors::UpArrow; + this->RadioButton2->TextAlign = ContentAlignment::MiddleCenter; + this->RadioButton3->Location = System::Drawing::Point( 24, 80 ); + this->RadioButton3->TabIndex = 3; + this->RadioButton3->Text = "Cross"; + this->RadioButton3->Tag = Cursors::Cross; + this->RadioButton3->TextAlign = ContentAlignment::MiddleCenter; + + // Add the radio buttons to the GroupBox. + this->GroupBox1->Controls->Add( this->RadioButton1 ); + this->GroupBox1->Controls->Add( this->RadioButton2 ); + this->GroupBox1->Controls->Add( this->RadioButton3 ); + + // Set the location of the GroupBox. + this->GroupBox1->Location = System::Drawing::Point( 56, 64 ); + this->GroupBox1->Size = System::Drawing::Size( 200, 150 ); + + // Set the text that will appear on the GroupBox. + this->GroupBox1->Text = "Choose a Cursor Style"; + + // + // Add the GroupBox to the form. + this->Controls->Add( this->GroupBox1 ); + + // + } + // + + void RadioButton_CheckedChanged( Object^ sender, EventArgs^ /*e*/ ) + { + + // Cast the sender back to a RadioButton object. + RadioButton^ selectedRadioButton = dynamic_cast(sender); + + // If the radio button is in a checked state, then + // change the cursor. + if ( selectedRadioButton->Checked ) + { + this->Cursor = dynamic_cast(selectedRadioButton->Tag); + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..419d33913d6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.GroupBoxRenderer/cpp/form1.cpp @@ -0,0 +1,130 @@ +// This sample can go in GroupBoxRenderer class overview. +// - Snippet2 can go in DrawGroupBox + +// This is a custom GroupBox-like control that has a double border +// and uses an internal FlowLayoutPanel to contain added controls. + +// TODO: see if you can work DrawParentBackground into here somehow. + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace GroupBoxRendererSample +{ + public ref class CustomGroupBox : public Control + { + private: + Rectangle innerRectangle; + private: + GroupBoxState state; + private: + FlowLayoutPanel^ panel; + + public: + CustomGroupBox() : Control() + { + innerRectangle = Rectangle(); + state = GroupBoxState::Normal; + panel = gcnew FlowLayoutPanel(); + + this->Size = System::Drawing::Size(200, 200); + this->Location = Point(10, 10); + this->Controls->Add(panel); + this->Text = "CustomGroupBox"; + this->Font = SystemFonts::IconTitleFont; + + innerRectangle.X = ClientRectangle.X + 5; + innerRectangle.Y = ClientRectangle.Y + 15; + innerRectangle.Width = ClientRectangle.Width - 10; + innerRectangle.Height = ClientRectangle.Height - 20; + + panel->FlowDirection = FlowDirection::TopDown; + panel->Location = Point(innerRectangle.X + 5, + innerRectangle.Y + 5); + panel->Size = System::Drawing::Size(innerRectangle.Width - 10, + innerRectangle.Height - 10); + } + + // + // Draw the group box in the current state. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + GroupBoxRenderer::DrawGroupBox(e->Graphics, ClientRectangle, + this->Text, this->Font, state); + + // Draw an additional inner border if visual styles are enabled. + if (Application::RenderWithVisualStyles) + { + GroupBoxRenderer::DrawGroupBox(e->Graphics, innerRectangle, + state); + } + } + // + + // Pass added controls to the internal FlowLayoutPanel. + protected: + virtual void OnControlAdded(ControlEventArgs^ e) override + { + __super::OnControlAdded(e); + + // Ensure that you do not add the panel itself. + if (e->Control != this->panel) + { + this->Controls->Remove(e->Control); + panel->Controls->Add(e->Control); + } + } + }; + + ref class Form1 : public Form + { + public: + Form1() : Form() + { + CustomGroupBox^ groupBox1 = gcnew CustomGroupBox(); + groupBox1->Text = "Radio Button Display"; + Controls->Add(groupBox1); + + // Add some radio buttons to test the CustomGroupBox. + int count = 8; + array^ buttonArray = + gcnew array(count); + for (int i = 0; i < count; i++) + { + buttonArray[i] = gcnew RadioButton(); + buttonArray[i]->Text = "Button " + (i + 1).ToString(); + groupBox1->Controls->Add(buttonArray[i]); + } + + if (Application::RenderWithVisualStyles) + { + this->Text = "Visual Styles Enabled"; + } + else + { + this->Text = "Visual Styles Disabled"; + } + } + }; +} + +[STAThread] +int main() +{ + // If you do not call EnableVisualStyles below, then + // GroupBoxRenderer automatically detects this and draws + // the group box without visual styles. + Application::EnableVisualStyles(); + Application::Run(gcnew GroupBoxRendererSample::Form1()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp new file mode 100644 index 00000000000..884b61affca --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Help/CPP/helpsnippet.cpp @@ -0,0 +1,158 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + String^ helpfile; + System::Windows::Forms::Button^ showIndex; + System::Windows::Forms::Button^ showHelp; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::ComboBox^ navigatorCombo; + System::Windows::Forms::Button^ showKeyword; + System::Windows::Forms::TextBox^ keyword; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::TextBox^ parameterTextBox; + +public: + Form1() + { + helpfile = "mspaint.chm"; + this->showIndex = gcnew System::Windows::Forms::Button; + this->showHelp = gcnew System::Windows::Forms::Button; + this->navigatorCombo = gcnew System::Windows::Forms::ComboBox; + this->label1 = gcnew System::Windows::Forms::Label; + this->showKeyword = gcnew System::Windows::Forms::Button; + this->keyword = gcnew System::Windows::Forms::TextBox; + this->label2 = gcnew System::Windows::Forms::Label; + this->label3 = gcnew System::Windows::Forms::Label; + this->parameterTextBox = gcnew System::Windows::Forms::TextBox; + + // Help Navigator Label + this->label1->Location = System::Drawing::Point( 112, 64 ); + this->label1->Size = System::Drawing::Size( 168, 16 ); + this->label1->Text = "Help Navigator:"; + + // Keyword Label + this->label2->Location = System::Drawing::Point( 120, 184 ); + this->label2->Size = System::Drawing::Size( 100, 16 ); + this->label2->Text = "Keyword:"; + + // Parameter Label + this->label3->Location = System::Drawing::Point( 112, 120 ); + this->label3->Size = System::Drawing::Size( 168, 16 ); + this->label3->Text = "Parameter:"; + + // Show Index Button + this->showIndex->Location = System::Drawing::Point( 16, 16 ); + this->showIndex->Size = System::Drawing::Size( 264, 32 ); + this->showIndex->TabIndex = 0; + this->showIndex->Text = "Show Help Index"; + this->showIndex->Click += gcnew System::EventHandler( this, &Form1::showIndex_Click ); + + // Show Help Button + this->showHelp->Location = System::Drawing::Point( 16, 80 ); + this->showHelp->Size = System::Drawing::Size( 80, 80 ); + this->showHelp->TabIndex = 1; + this->showHelp->Text = "Show Help"; + this->showHelp->Click += gcnew System::EventHandler( this, &Form1::showHelp_Click ); + + // Show Keyword Button + this->showKeyword->Location = System::Drawing::Point( 16, 192 ); + this->showKeyword->Size = System::Drawing::Size( 88, 32 ); + this->showKeyword->TabIndex = 4; + this->showKeyword->Text = "Show Keyword"; + this->showKeyword->Click += gcnew System::EventHandler( this, &Form1::showKeyword_Click ); + + // Help Navigator ComboBox + this->navigatorCombo->DropDownStyle = System::Windows::Forms::ComboBoxStyle::DropDownList; + this->navigatorCombo->Location = System::Drawing::Point( 112, 80 ); + this->navigatorCombo->Size = System::Drawing::Size( 168, 21 ); + this->navigatorCombo->TabIndex = 2; + + // Keyword TextBox + this->keyword->Location = System::Drawing::Point( 120, 200 ); + this->keyword->Size = System::Drawing::Size( 160, 20 ); + this->keyword->TabIndex = 5; + this->keyword->Text = ""; + + // Parameter TextBox + this->parameterTextBox->Location = System::Drawing::Point( 112, 136 ); + this->parameterTextBox->Size = System::Drawing::Size( 168, 20 ); + this->parameterTextBox->TabIndex = 8; + this->parameterTextBox->Text = ""; + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^formControls = {this->parameterTextBox,this->label3,this->label2,this->keyword,this->showKeyword,this->label1,this->navigatorCombo,this->showHelp,this->showIndex}; + this->Controls->AddRange( formControls ); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; + this->Text = "Help App"; + + // + // Load the various values of the HelpNavigator enumeration + // into the combo box. + TypeConverter^ converter; + converter = TypeDescriptor::GetConverter( HelpNavigator::typeid ); + System::Collections::IEnumerator^ myEnum = converter->GetStandardValues()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Object^ value = safe_cast(myEnum->Current); + navigatorCombo->Items->Add( value ); + } + // + } + + // +private: + void showIndex_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Display the index for the help file. + Help::ShowHelpIndex( this, helpfile ); + } + // + + // + void showHelp_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Display Help using the Help navigator enumeration + // that is selected in the combo box. Some enumeration + // values make use of an extra parameter, which can + // be passed in through the Parameter text box. + HelpNavigator navigator = HelpNavigator::TableOfContents; + if ( navigatorCombo->SelectedItem != nullptr ) + { + navigator = *safe_cast(navigatorCombo->SelectedItem); + } + + Help::ShowHelp( this, helpfile, navigator, parameterTextBox->Text ); + } + // + + // + void showKeyword_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Display help using the provided keyword. + Help::ShowHelp( this, helpfile, keyword->Text ); + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp new file mode 100644 index 00000000000..c5b9dd78184 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpEventHandler/CPP/helpevent.cpp @@ -0,0 +1,117 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ addressTextBox; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::TextBox^ cityTextBox; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::TextBox^ stateTextBox; + System::Windows::Forms::TextBox^ zipTextBox; + System::Windows::Forms::Label ^ helpLabel; + +public: + Form1() + { + this->addressTextBox = gcnew System::Windows::Forms::TextBox; + this->helpLabel = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->cityTextBox = gcnew System::Windows::Forms::TextBox; + this->label3 = gcnew System::Windows::Forms::Label; + this->stateTextBox = gcnew System::Windows::Forms::TextBox; + this->zipTextBox = gcnew System::Windows::Forms::TextBox; + + // Help Label + this->helpLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + this->helpLabel->Location = System::Drawing::Point( 8, 80 ); + this->helpLabel->Size = System::Drawing::Size( 272, 72 ); + this->helpLabel->Text = "Click on any control to give it focus, and then press F1 to display help for that control. Alternately, you can click the help button at the top of the dialog and then click on a control."; + + // Address Label + this->label2->Location = System::Drawing::Point( 16, 8 ); + this->label2->Size = System::Drawing::Size( 100, 16 ); + this->label2->Text = "Address:"; + + // Comma Label + this->label3->Location = System::Drawing::Point( 136, 56 ); + this->label3->Size = System::Drawing::Size( 16, 16 ); + this->label3->Text = ", "; + + // Address TextBox + this->addressTextBox->Location = System::Drawing::Point( 16, 24 ); + this->addressTextBox->Size = System::Drawing::Size( 264, 20 ); + this->addressTextBox->TabIndex = 0; + this->addressTextBox->Tag = "Enter the street address in this text box."; + this->addressTextBox->Text = ""; + this->addressTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); + + // City TextBox + this->cityTextBox->Location = System::Drawing::Point( 16, 48 ); + this->cityTextBox->Size = System::Drawing::Size( 120, 20 ); + this->cityTextBox->TabIndex = 3; + this->cityTextBox->Tag = "Enter the city here."; + this->cityTextBox->Text = ""; + this->cityTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); + + // State TextBox + this->stateTextBox->Location = System::Drawing::Point( 152, 48 ); + this->stateTextBox->MaxLength = 2; + this->stateTextBox->Size = System::Drawing::Size( 32, 20 ); + this->stateTextBox->TabIndex = 5; + this->stateTextBox->Tag = "Enter the state in this text box."; + this->stateTextBox->Text = ""; + this->stateTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); + + // Zip TextBox + this->zipTextBox->Location = System::Drawing::Point( 192, 48 ); + this->zipTextBox->Name = "zipTextBox"; + this->zipTextBox->Size = System::Drawing::Size( 88, 20 ); + this->zipTextBox->TabIndex = 6; + this->zipTextBox->Tag = "Enter the zip code here."; + this->zipTextBox->Text = ""; + this->zipTextBox->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::textBox_HelpRequested ); + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 292, 160 ); + array^temp0 = {this->zipTextBox,this->stateTextBox,this->label3,this->cityTextBox,this->label2,this->helpLabel,this->addressTextBox}; + this->Controls->AddRange( temp0 ); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; + this->HelpButton = true; + this->MaximizeBox = false; + this->MinimizeBox = false; + this->Text = "Help Event Demonstration"; + } + + +private: + void textBox_HelpRequested( Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent ) + { + + // This event is raised when the F1 key is pressed or the + // Help cursor is clicked on any of the address fields. + // The Help text for the field is in the control's + // Tag property. It is retrieved and displayed in the label. + Control^ requestingControl = dynamic_cast(sender); + helpLabel->Text = dynamic_cast(requestingControl->Tag); + hlpevent->Handled = true; + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp new file mode 100644 index 00000000000..01ebc86f007 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpExample/CPP/form1.cpp @@ -0,0 +1,128 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::Label ^ Label1; + System::Windows::Forms::Button^ Button2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Label1 = gcnew System::Windows::Forms::Label; + this->Button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 32, 160 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 80, 32 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Help"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //TextBox1 + // + this->TextBox1->Location = System::Drawing::Point( 152, 72 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->TabIndex = 1; + this->TextBox1->Text = ""; + + // + //Label1 + // + this->Label1->Location = System::Drawing::Point( 40, 72 ); + this->Label1->Name = "Label1"; + this->Label1->TabIndex = 2; + this->Label1->Text = "Name"; + + // + //Button2 + // + this->Button2->Location = System::Drawing::Point( 168, 168 ); + this->Button2->Name = "Button2"; + this->Button2->TabIndex = 3; + this->Button2->Text = "More Help"; + this->Button2->Click += gcnew System::EventHandler( this, &Form1::Button2_Click ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Register"; + this->ResumeLayout( false ); + } + + // + // Open the Help file for the Character Map topic. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Help::ShowHelp( TextBox1, "file://c:\\charmap.chm" ); + } + // + + // + // Open the Help file for the Character Map topic and + // display the Index page. + void Button2_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Help::ShowHelp( TextBox1, "file://c:\\charmap.chm", HelpNavigator::Index ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp new file mode 100644 index 00000000000..1cdb6f9bd29 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProvider/CPP/helpprovider.cpp @@ -0,0 +1,121 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ addressTextBox; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::TextBox^ cityTextBox; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::TextBox^ stateTextBox; + System::Windows::Forms::TextBox^ zipTextBox; + System::Windows::Forms::HelpProvider^ helpProvider1; + System::Windows::Forms::Label ^ helpLabel; + +public: + Form1() + { + this->addressTextBox = gcnew System::Windows::Forms::TextBox; + this->helpLabel = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->cityTextBox = gcnew System::Windows::Forms::TextBox; + this->label3 = gcnew System::Windows::Forms::Label; + this->stateTextBox = gcnew System::Windows::Forms::TextBox; + this->zipTextBox = gcnew System::Windows::Forms::TextBox; + + // Help Label + this->helpLabel->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + this->helpLabel->Location = System::Drawing::Point( 8, 80 ); + this->helpLabel->Size = System::Drawing::Size( 272, 72 ); + this->helpLabel->Text = "Click the Help button in the title bar, then click a control to see a Help tooltip for the control. Click on a control and press F1 to invoke the Help system with a sample Help file."; + + // Address Label + this->label2->Location = System::Drawing::Point( 16, 8 ); + this->label2->Size = System::Drawing::Size( 100, 16 ); + this->label2->Text = "Address:"; + + // Comma Label + this->label3->Location = System::Drawing::Point( 136, 56 ); + this->label3->Size = System::Drawing::Size( 16, 16 ); + this->label3->Text = ", "; + + // + // Create the HelpProvider. + this->helpProvider1 = gcnew System::Windows::Forms::HelpProvider; + + // + // + // Tell the HelpProvider what controls to provide help for, and + // what the help String* is. + this->helpProvider1->SetShowHelp( this->addressTextBox, true ); + this->helpProvider1->SetHelpString( this->addressTextBox, "Enter the street address in this text box." ); + this->helpProvider1->SetShowHelp( this->cityTextBox, true ); + this->helpProvider1->SetHelpString( this->cityTextBox, "Enter the city here." ); + this->helpProvider1->SetShowHelp( this->stateTextBox, true ); + this->helpProvider1->SetHelpString( this->stateTextBox, "Enter the state in this text box." ); + this->helpProvider1->SetShowHelp( this->zipTextBox, true ); + this->helpProvider1->SetHelpString( this->zipTextBox, "Enter the zip code here." ); + + // + // + // Set what the Help file will be for the HelpProvider. + this->helpProvider1->HelpNamespace = "mspaint.chm"; + + // + // Sets properties for the different address fields. + // Address TextBox + this->addressTextBox->Location = System::Drawing::Point( 16, 24 ); + this->addressTextBox->Size = System::Drawing::Size( 264, 20 ); + this->addressTextBox->TabIndex = 0; + this->addressTextBox->Text = ""; + + // City TextBox + this->cityTextBox->Location = System::Drawing::Point( 16, 48 ); + this->cityTextBox->Size = System::Drawing::Size( 120, 20 ); + this->cityTextBox->TabIndex = 3; + this->cityTextBox->Text = ""; + + // State TextBox + this->stateTextBox->Location = System::Drawing::Point( 152, 48 ); + this->stateTextBox->MaxLength = 2; + this->stateTextBox->Size = System::Drawing::Size( 32, 20 ); + this->stateTextBox->TabIndex = 5; + this->stateTextBox->Text = ""; + + // Zip TextBox + this->zipTextBox->Location = System::Drawing::Point( 192, 48 ); + this->zipTextBox->Size = System::Drawing::Size( 88, 20 ); + this->zipTextBox->TabIndex = 6; + this->zipTextBox->Text = ""; + + // Add the controls to the form. + array^temp0 = {this->zipTextBox,this->stateTextBox,this->label3,this->cityTextBox,this->label2,this->helpLabel,this->addressTextBox}; + this->Controls->AddRange( temp0 ); + + // Set the form to look like a dialog, and show the HelpButton. + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; + this->HelpButton = true; + this->MaximizeBox = false; + this->MinimizeBox = false; + this->ClientSize = System::Drawing::Size( 292, 160 ); + this->Text = "Help Provider Demonstration"; + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp new file mode 100644 index 00000000000..637d6b1b6f1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.HelpProviderAndImageListExample/CPP/form1.cpp @@ -0,0 +1,150 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeHelpProvider(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //TextBox1 + // + this->TextBox1->Location = System::Drawing::Point( 16, 24 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->TabIndex = 0; + this->TextBox1->Text = "Press F1 for help."; + + //Button1 + // + this->Button1->Location = System::Drawing::Point( 160, 24 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 2; + this->Button1->Text = "Button1"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->TextBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + //Declare the HelpProvider. +internal: + System::Windows::Forms::HelpProvider^ HelpProvider1; + +private: + void InitializeHelpProvider() + { + // Construct the HelpProvider Object. + this->HelpProvider1 = gcnew System::Windows::Forms::HelpProvider; + + // Set the HelpNamespace property to the Help file for + // HelpProvider1. + this->HelpProvider1->HelpNamespace = "c:\\windows\\input.chm"; + + // Specify that the Help provider should open to the table + // of contents of the Help file. + this->HelpProvider1->SetHelpNavigator( TextBox1, HelpNavigator::TableOfContents ); + } + // + + // +internal: + System::Windows::Forms::ImageList^ ImageList1; + +private: + + // Create an ImageList Object, populate it, and display + // the images it contains. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Construct the ImageList. + ImageList1 = gcnew ImageList; + + // Set the ImageSize property to a larger size + // (the default is 16 x 16). + ImageList1->ImageSize = System::Drawing::Size( 112, 112 ); + + // Add two images to the list. + ImageList1->Images->Add( Image::FromFile( "c:\\windows\\FeatherTexture.bmp" ) ); + ImageList1->Images->Add( Image::FromFile( "C:\\windows\\Gone Fishing.bmp" ) ); + + // Get a Graphics object from the form's handle. + Graphics^ theGraphics = Graphics::FromHwnd( this->Handle ); + + // Loop through the images in the list, drawing each image. + for ( int count = 0; count < ImageList1->Images->Count; count++ ) + { + ImageList1->Draw( theGraphics, Point(85,85), count ); + + // Call Application.DoEvents to force a repaint of the form. + Application::DoEvents(); + + // Call the Sleep method to allow the user to see the image. + System::Threading::Thread::Sleep( 1000 ); + + } + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp new file mode 100644 index 00000000000..39107faf9a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.KeyEventsHelpAndErrors/CPP/form1.cpp @@ -0,0 +1,211 @@ + + +// +#using +#using +#using +#using + +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System; +using namespace Microsoft::VisualBasic; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + InitializeComponent(); + AddHandlers(); + InitializeFormHelp(); + } + + +public private: + System::Windows::Forms::Label ^ Label1; + System::Windows::Forms::Label ^ Label2; + System::Windows::Forms::Label ^ Label3; + System::Windows::Forms::TextBox^ withdrawal; + System::Windows::Forms::TextBox^ deposit; + System::Windows::Forms::ErrorProvider^ ErrorProvider1; + System::Windows::Forms::Label ^ balance; + System::Windows::Forms::HelpProvider^ HelpProvider1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->withdrawal = gcnew System::Windows::Forms::TextBox; + this->deposit = gcnew System::Windows::Forms::TextBox; + this->Label1 = gcnew System::Windows::Forms::Label; + this->Label2 = gcnew System::Windows::Forms::Label; + this->Label3 = gcnew System::Windows::Forms::Label; + this->ErrorProvider1 = gcnew System::Windows::Forms::ErrorProvider; + this->balance = gcnew System::Windows::Forms::Label; + this->HelpProvider1 = gcnew System::Windows::Forms::HelpProvider; + this->SuspendLayout(); + this->withdrawal->Location = System::Drawing::Point( 32, 200 ); + this->withdrawal->Name = "withdrawal"; + this->withdrawal->Size = System::Drawing::Size( 88, 20 ); + this->withdrawal->TabIndex = 0; + this->withdrawal->Text = ""; + this->deposit->Location = System::Drawing::Point( 168, 200 ); + this->deposit->Name = "deposit"; + this->deposit->TabIndex = 1; + this->deposit->Text = ""; + this->Label1->Location = System::Drawing::Point( 56, 88 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 96, 24 ); + this->Label1->TabIndex = 2; + this->Label1->Text = "Account Balance:"; + this->Label2->Location = System::Drawing::Point( 168, 168 ); + this->Label2->Name = "Label2"; + this->Label2->Size = System::Drawing::Size( 96, 24 ); + this->Label2->TabIndex = 4; + this->Label2->Text = "Deposit:"; + this->Label3->Location = System::Drawing::Point( 32, 168 ); + this->Label3->Name = "Label3"; + this->Label3->Size = System::Drawing::Size( 96, 24 ); + this->Label3->TabIndex = 5; + this->Label3->Text = "Withdrawal:"; + this->ErrorProvider1->ContainerControl = this; + this->balance->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + this->balance->Location = System::Drawing::Point( 152, 88 ); + this->balance->Name = "balance"; + this->balance->TabIndex = 6; + this->balance->Text = "345.65"; + this->balance->TextAlign = System::Drawing::ContentAlignment::MiddleLeft; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->balance ); + this->Controls->Add( this->Label3 ); + this->Controls->Add( this->Label2 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->deposit ); + this->Controls->Add( this->withdrawal ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void AddHandlers() + { + + // Add the event-handler delegates to handled the KeyDown + // events. + deposit->KeyDown += gcnew KeyEventHandler( this, &Form1::ProcessEntry ); + withdrawal->KeyDown += gcnew KeyEventHandler( this, &Form1::ProcessEntry ); + + // Add the event-handler delegates to handled the KeyPress + // events. + deposit->KeyPress += gcnew KeyPressEventHandler( this, &Form1::CheckForDigits ); + withdrawal->KeyPress += gcnew KeyPressEventHandler( this, &Form1::CheckForDigits ); + } + + + // + void InitializeFormHelp() + { + + // Set the form's border to the FixedDialog style. + this->FormBorderStyle = ::FormBorderStyle::FixedDialog; + + // Remove the Maximize and Minimize buttons from the form. + this->MaximizeBox = false; + this->MinimizeBox = false; + + // Add the Help button to the form. + this->HelpButton = true; + + // Set the Help string for the deposit textBox. + HelpProvider1->SetHelpString( deposit, "Enter an amount in the format xxx.xx" + "and press Enter to deposit." ); + + // Set the Help string for the withdrawal textBox. + HelpProvider1->SetHelpString( withdrawal, "Enter an amount in the format xxx.xx" + "and press Enter to withdraw." ); + } + + + + + // + void ProcessEntry( Object^ sender, KeyEventArgs^ e ) + { + + // Cast the sender back to a TextBox. + Control^ textBoxSender = dynamic_cast(sender); + + // Set the error description to an empty string (). + ErrorProvider1->SetError( textBoxSender, "" ); + + // Declare the variable to hold the new balance. + double newBalance = 0; + + // Wrap the code in a Try/Catch block to catch + // errors that can occur when converting the string + // to a double. + try + { + if ( e->KeyCode == Keys::Enter ) + { + if ( textBoxSender->Name->Equals( "withdrawal" ) ) + { + newBalance = Double::Parse( balance->Text ) - Double::Parse( withdrawal->Text ); + withdrawal->Text = ""; + } + else + if ( textBoxSender->Name->Equals( "deposit" ) ) + { + newBalance = Double::Parse( balance->Text ) + Double::Parse( deposit->Text ); + deposit->Text = ""; + } + + // Check the value of new balance and set the + // Forecolor property accordingly. + if ( newBalance < 0 ) + { + balance->ForeColor = Color::Red; + } + else + { + balance->ForeColor = Color::Black; + } + + // Set the text of the balance text box + // to the newBalance value. + balance->Text = newBalance.ToString(); + } + } + catch ( FormatException^ ) + { + + // If a FormatException is thrown, set the + // error string to the HelpString message for + // the control. + ErrorProvider1->SetError( textBoxSender, HelpProvider1->GetHelpString( textBoxSender ) ); + } + + } + + void CheckForDigits( Object^ /*sender*/, KeyPressEventArgs^ e ) + { + + // If the character is not a digit, period, or backspace then + // ignore it by setting the KeyPressEventArgs.Handled + // property to true. + if ( !(Char::IsDigit( e->KeyChar ) || e->KeyChar == '.' || e->KeyChar == (char)(Keys::Back)) ) + { + e->Handled = true; + } + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp new file mode 100644 index 00000000000..a0538ce191f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LabelAutoSize/CPP/form1.cpp @@ -0,0 +1,85 @@ + + +#using +#using +#using + +// The following code example demonstrates how setting the +// Label.Autosize property to True will causes the width of +// the label to adjust. +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeLabel(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->SuspendLayout(); + this->ClientSize = System::Drawing::Size( 266, 300 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Declare a label. +internal: + System::Windows::Forms::Label ^ Label1; + +private: + + // Initialize the label. + void InitializeLabel() + { + this->Label1 = gcnew Label; + this->Label1->Location = System::Drawing::Point( 10, 10 ); + this->Label1->Name = "Label1"; + this->Label1->TabIndex = 0; + + // Set the label to a small size, but set the AutoSize property + // to true. The label will adjust its length so all the text + // is visible, however if the label is wider than the form, + // the entire label will not be visible. + this->Label1->Size = System::Drawing::Size( 10, 10 ); + this->Controls->Add( this->Label1 ); + this->Label1->AutoSize = true; + this->Label1->Text = "The text in this label is longer" + " than the set size."; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp new file mode 100644 index 00000000000..8e76df324ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Layout.LayoutEngine/cpp/DemoFlowLayout.cpp @@ -0,0 +1,134 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Drawing; +using namespace System::Text; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Layout; + +// +// This class demonstrates a simple custom layout engine. +public ref class DemoFlowLayout : public LayoutEngine +{ + // +public: + virtual bool Layout(Object^ container, + LayoutEventArgs^ layoutEventArgs) override + { + Control^ parent = nullptr; + try + { + parent = (Control ^) container; + } + catch (InvalidCastException^ ex) + { + throw gcnew ArgumentException( + "The parameter 'container' must be a control", "container", ex); + } + // Use DisplayRectangle so that parent.Padding is honored. + Rectangle parentDisplayRectangle = parent->DisplayRectangle; + Point nextControlLocation = parentDisplayRectangle.Location; + + for each (Control^ currentControl in parent->Controls) + { + // Only apply layout to visible controls. + if (!currentControl->Visible) + { + continue; + } + + // Respect the margin of the control: + // shift over the left and the top. + nextControlLocation.Offset(currentControl->Margin.Left, + currentControl->Margin.Top); + + // Set the location of the control. + currentControl->Location = nextControlLocation; + + // Set the autosized controls to their + // autosized heights. + if (currentControl->AutoSize) + { + currentControl->Size = currentControl->GetPreferredSize( + parentDisplayRectangle.Size); + } + + // Move X back to the display rectangle origin. + nextControlLocation.X = parentDisplayRectangle.X; + + // Increment Y by the height of the control + // and the bottom margin. + nextControlLocation.Y += currentControl->Height + + currentControl->Margin.Bottom; + } + + // Optional: Return whether or not the container's + // parent should perform layout as a result of this + // layout. Some layout engines return the value of + // the container's AutoSize property. + + return false; + } + // +}; +// + +// +// This class demonstrates a simple custom layout panel. +// It overrides the LayoutEngine property of the Panel +// control to provide a custom layout engine. +public ref class DemoFlowPanel : public Panel +{ +private: + DemoFlowLayout^ layoutEngine; + +public: + DemoFlowPanel() + { + layoutEngine = gcnew DemoFlowLayout(); + } + +public: + virtual property System::Windows::Forms::Layout::LayoutEngine^ LayoutEngine + { + System::Windows::Forms::Layout::LayoutEngine^ get() override + { + if (layoutEngine == nullptr) + { + layoutEngine = gcnew DemoFlowLayout(); + } + + return layoutEngine; + } + } +}; +// + +// + +public ref class TestForm : public Form +{ +public: + TestForm() + { + Panel^ testPanel = gcnew DemoFlowPanel(); + for (int i = 0; i < 10; i ++) + { + Button^ b = gcnew Button(); + testPanel->Controls->Add(b); + b->Text = i.ToString( + System::Globalization::CultureInfo::CurrentCulture); + } + this->Controls->Add(testPanel); + } +}; + +[STAThread] +int main() +{ + Application::Run(gcnew TestForm()); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp new file mode 100644 index 00000000000..7360c1f90e2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabel/CPP/linklabel.cpp @@ -0,0 +1,100 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::LinkLabel^ linkLabel1; + +public: + Form1() + { + + // Create the LinkLabel. + this->linkLabel1 = gcnew System::Windows::Forms::LinkLabel; + + // Configure the LinkLabel's size and location. Specify that the + // size should be automatically determined by the content. + this->linkLabel1->Location = System::Drawing::Point( 34, 56 ); + this->linkLabel1->Size = System::Drawing::Size( 224, 16 ); + this->linkLabel1->AutoSize = true; + + // Configure the appearance. + this->linkLabel1->DisabledLinkColor = System::Drawing::Color::Red; + this->linkLabel1->VisitedLinkColor = System::Drawing::Color::Blue; + this->linkLabel1->LinkBehavior = System::Windows::Forms::LinkBehavior::HoverUnderline; + this->linkLabel1->LinkColor = System::Drawing::Color::Navy; + this->linkLabel1->TabIndex = 0; + this->linkLabel1->TabStop = true; + + // Add an event handler to do something when the links are clicked. + this->linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler( this, &Form1::linkLabel1_LinkClicked ); + + // Identify what the first Link is. + this->linkLabel1->LinkArea = System::Windows::Forms::LinkArea( 0, 8 ); + + // Identify that the first link is visited already. + this->linkLabel1->Links[ 0 ]->Visited = true; + + // Set the Text property to a String*. + this->linkLabel1->Text = "Register Online. Visit Microsoft. Visit MSN."; + + // Create new links using the Add method of the LinkCollection class. + // Underline the appropriate words in the LinkLabel's Text property. + // The words 'Register', 'Microsoft', and 'MSN' will + // all be underlined and behave as hyperlinks. + // First check that the Text property is long enough to accommodate + // the desired hyperlinked areas. If it's not, don't add hyperlinks. + if ( this->linkLabel1->Text->Length >= 45 ) + { + this->linkLabel1->Links[ 0 ]->LinkData = "Register"; + this->linkLabel1->Links->Add( 24, 9, "www.microsoft.com" ); + this->linkLabel1->Links->Add( 42, 3, "www.msn.com" ); + this->linkLabel1->Links[ 1 ]->Enabled = false; + } + + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->linkLabel1}; + this->Controls->AddRange( temp0 ); + this->Text = "Link Label Example"; + } + + +private: + void linkLabel1_LinkClicked( Object^ /*sender*/, System::Windows::Forms::LinkLabelLinkClickedEventArgs^ e ) + { + // Determine which link was clicked within the LinkLabel. + this->linkLabel1->Links[ linkLabel1->Links->IndexOf( e->Link ) ]->Visited = true; + + // Display the appropriate link based on the value of the + // LinkData property of the Link Object*. + String^ target = dynamic_cast(e->Link->LinkData); + + // If the value looks like a URL, navigate to it. + // Otherwise, display it in a message box. + if ( nullptr != target && target->StartsWith( "www" ) ) + { + System::Diagnostics::Process::Start( target ); + } + else + { + MessageBox::Show( "Item clicked: {0}", target ); + } + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp new file mode 100644 index 00000000000..45baa8a47d5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.LinkLabelExample/CPP/form1.cpp @@ -0,0 +1,138 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeLinkLabel(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 272, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + // + // Declare the LinkLabel object. +internal: + System::Windows::Forms::LinkLabel^ LinkLabel1; + + // Declare keywords array to identify links + array^keywords; + +private: + void InitializeLinkLabel() + { + this->LinkLabel1 = gcnew System::Windows::Forms::LinkLabel; + this->LinkLabel1->Links->Clear(); + // Set the location, name and size. + this->LinkLabel1->Location = System::Drawing::Point( 10, 20 ); + this->LinkLabel1->Name = "CompanyLinks"; + this->LinkLabel1->Size = System::Drawing::Size( 104, 150 ); + + // Set the LinkBehavior property to show underline when mouse + // hovers over the links. + this->LinkLabel1->LinkBehavior = System::Windows::Forms::LinkBehavior::HoverUnderline; + String^ textString = "For more information see our" + " company website or the research page at Contoso Ltd. "; + + // Set the text property. + this->LinkLabel1->Text = textString; + + // Set the color of the links to black, unless the mouse + // is hovering over a link. + this->LinkLabel1->LinkColor = System::Drawing::Color::Black; + this->LinkLabel1->ActiveLinkColor = System::Drawing::Color::Blue; + + // Associate the event-handling method with the LinkClicked + // event. + this->LinkLabel1->LinkClicked += gcnew LinkLabelLinkClickedEventHandler( this, &Form1::LinkLabel1_LinkClicked ); + + // Add links to the LinkCollection using starting index and + // length of keywords. + array^temp0 = {"company","research"}; + keywords = temp0; + System::Collections::IEnumerator^ myEnum = keywords->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ keyword = safe_cast(myEnum->Current); + this->LinkLabel1->Links->Add( textString->IndexOf( keyword ), keyword->Length ); + } + + + // Add the label to the form. + this->Controls->Add( this->LinkLabel1 ); + } + + void LinkLabel1_LinkClicked( Object^ /*sender*/, LinkLabelLinkClickedEventArgs^ e ) + { + String^ url = ""; + + // Determine which link was clicked and set the appropriate url. + switch ( LinkLabel1->Links->IndexOf( e->Link ) ) + { + case 0: + url = "www.microsoft.com"; + break; + + case 1: + url = "www.contoso.com/research"; + break; + } + + // Set the visited property to True. This will change + // the color of the link. + e->Link->Visited = true; + + // Open Internet Explorer to the correct url. + System::Diagnostics::Process::Start( "IExplore.exe", url ); + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp new file mode 100644 index 00000000000..b38686bc5a6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxExample/CPP/form1.cpp @@ -0,0 +1,152 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeOwnerDrawnListBox(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->SuspendLayout(); + + // + //ListBox1 + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +internal: + System::Windows::Forms::ListBox^ ListBox1; + +private: + void InitializeOwnerDrawnListBox() + { + this->ListBox1 = gcnew System::Windows::Forms::ListBox; + + // Set the location and size. + ListBox1->Location = Point(20,20); + ListBox1->Size = System::Drawing::Size( 240, 240 ); + + // Populate the ListBox.ObjectCollection property + // with several strings, using the AddRange method. + array^temp0 = {"System.Windows.Forms","System.Drawing","System.Xml","System.Net","System.Runtime.Remoting","System.Web"}; + this->ListBox1->Items->AddRange( temp0 ); + + // Turn off the scrollbar. + ListBox1->ScrollAlwaysVisible = false; + + // Set the border style to a single, flat border. + ListBox1->BorderStyle = BorderStyle::FixedSingle; + + // Set the DrawMode property to the OwnerDrawVariable value. + // This means the MeasureItem and DrawItem events must be + // handled. + ListBox1->DrawMode = DrawMode::OwnerDrawVariable; + ListBox1->MeasureItem += gcnew MeasureItemEventHandler( this, &Form1::ListBox1_MeasureItem ); + ListBox1->DrawItem += gcnew DrawItemEventHandler( this, &Form1::ListBox1_DrawItem ); + this->Controls->Add( this->ListBox1 ); + } + + // Handle the DrawItem event for an owner-drawn ListBox. + void ListBox1_DrawItem( Object^ /*sender*/, DrawItemEventArgs^ e ) + { + // If the item is the selected item, then draw the rectangle + // filled in blue. The item is selected when a bitwise And + // of the State property and the DrawItemState.Selected + // property is true. + if ( (e->State & DrawItemState::Selected) == DrawItemState::Selected ) + { + e->Graphics->FillRectangle( Brushes::CornflowerBlue, e->Bounds ); + } + else + { + + // Otherwise, draw the rectangle filled in beige. + e->Graphics->FillRectangle( Brushes::Beige, e->Bounds ); + } + + // Draw a rectangle in blue around each item. + e->Graphics->DrawRectangle( Pens::Blue, e->Bounds ); + + // Draw the text in the item. + e->Graphics->DrawString( ListBox1->Items[ e->Index ]->ToString(), this->Font, Brushes::Black, (float)e->Bounds.X, (float)e->Bounds.Y ); + + // Draw the focus rectangle around the selected item. + e->DrawFocusRectangle(); + } + + + // Handle the MeasureItem event for an owner-drawn ListBox. + void ListBox1_MeasureItem( Object^ sender, MeasureItemEventArgs^ e ) + { + + // Cast the sender object back to ListBox type. + ListBox^ theListBox = dynamic_cast(sender); + + // Get the string contained in each item. + String^ itemString = dynamic_cast(theListBox->Items[ e->Index ]); + + // Split the string at the " . " character. + array^temp1 = {'.'}; + array^resultStrings = itemString->Split( temp1 ); + + // If the string contains more than one period, increase the + // height by ten pixels; otherwise, increase the height by + // five pixels. + if ( resultStrings->Length > 2 ) + { + e->ItemHeight += 10; + } + else + { + e->ItemHeight += 5; + } + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp new file mode 100644 index 00000000000..56d2b0ad062 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListBoxSort/CPP/form1.cpp @@ -0,0 +1,105 @@ + + +#using +#using +#using + +// +// The following code example demonstrates using the ListBox.Sort method +// by inheriting from the ListBox class and overriding the Sort method. +using namespace System::Drawing; +using namespace System::Windows::Forms; + +// This class inherits from ListBox and implements a different +// sorting method. Sort will be called by setting the class's Sorted +// property to True. +public ref class SortByLengthListBox: public ListBox +{ +public: + SortByLengthListBox() + : ListBox() + {} + +protected: + + // Overrides the parent class Sort to perform a simple + // bubble sort on the length of the string contained in each item. + virtual void Sort() override + { + if ( Items->Count > 1 ) + { + bool swapped; + do + { + int counter = Items->Count - 1; + swapped = false; + while ( counter > 0 ) + { + + // Compare the items' length. + if ( Items[ counter ]->ToString()->Length < Items[ counter - 1 ]->ToString()->Length ) + { + + // Swap the items. + Object^ temp = Items[ counter ]; + Items[ counter ] = Items[ counter - 1 ]; + Items[ counter - 1 ] = temp; + swapped = true; + } + + // Decrement the counter. + counter -= 1; + } + } + while ( swapped ); + } + } +}; + +public ref class Form1: public System::Windows::Forms::Form +{ +internal: + System::Windows::Forms::Button^ Button1; + SortByLengthListBox^ sortingBox; + +public: + Form1() + : Form() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->sortingBox = gcnew SortByLengthListBox; + this->SuspendLayout(); + this->Button1->Location = System::Drawing::Point( 64, 16 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 176, 23 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click me for list sorted by length"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + array^temp0 = {"System","System.Windows.Forms","System.Xml","System.Net","System.Drawing","System.IO"}; + this->sortingBox->Items->AddRange( temp0 ); + this->sortingBox->Location = System::Drawing::Point( 72, 48 ); + this->sortingBox->Size = System::Drawing::Size( 120, 95 ); + this->sortingBox->TabIndex = 1; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->sortingBox ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Sort Example"; + this->ResumeLayout( false ); + } + +private: + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Set the Sorted property to True to raise the overridden Sort + // method. + sortingBox->Sorted = true; + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp new file mode 100644 index 00000000000..426680cb59a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Groups/CPP/listviewgroupsexample.cpp @@ -0,0 +1,258 @@ + + +// +#using +#using +#using +#using +using namespace System; +using namespace System::Collections; +using namespace System::Windows::Forms; + +public ref class ListViewGroupsExample : public Form +{ +private: + ListView^ myListView; + bool isRunningXPOrLater; + + // Declare a Hashtable array in which to store the groups. + array^ groupTables; + + // Declare a variable to store the current grouping column. + int groupColumn; + +public: + ListViewGroupsExample() + { + groupColumn = 0; + // Initialize myListView. + myListView = gcnew ListView(); + myListView->Dock = DockStyle::Fill; + myListView->View = View::Details; + myListView->Sorting = SortOrder::Ascending; + + // Create and initialize column headers for myListView. + ColumnHeader^ columnHeader0 = gcnew ColumnHeader(); + columnHeader0->Text = "Title"; + columnHeader0->Width = -1; + ColumnHeader^ columnHeader1 = gcnew ColumnHeader(); + columnHeader1->Text = "Author"; + columnHeader1->Width = -1; + ColumnHeader^ columnHeader2 = gcnew ColumnHeader(); + columnHeader2->Text = "Year"; + columnHeader2->Width = -1; + + // Add the column headers to myListView. + + array^ temp0 = {columnHeader0, columnHeader1, columnHeader2}; + myListView->Columns->AddRange(temp0); + + // Add a handler for the ColumnClick event. + myListView->ColumnClick += + gcnew ColumnClickEventHandler(this, &ListViewGroupsExample::myListView_ColumnClick); + + // Create items and add them to myListView. + + array^ temp1 = {"Programming Windows", "Petzold, Charles", "1998"}; + ListViewItem^ item0 = gcnew ListViewItem( temp1 ); + + array^ temp2 = {"Code: The Hidden Language of Computer Hardware and Software", + "Petzold, Charles", "2000"}; + ListViewItem^ item1 = gcnew ListViewItem( temp2 ); + + array^ temp3 = {"Programming Windows with C#", "Petzold, Charles", "2001"}; + ListViewItem^ item2 = gcnew ListViewItem( temp3 ); + + array^ temp4 = {"Coding Techniques for Microsoft Visual Basic .NET", + "Connell, John", "2001"}; + ListViewItem^ item3 = gcnew ListViewItem( temp4 ); + + array^ temp5 = {"C# for Java Developers", "Jones, Allen & Freeman, Adam", + "2002"}; + ListViewItem^ item4 = gcnew ListViewItem( temp5 ); + + array^ temp6 = {"Microsoft .NET XML Web Services Step by Step", + "Jones, Allen & Freeman, Adam", "2002"}; + ListViewItem^ item5 = gcnew ListViewItem( temp6 ); + + array^ temp7 = {item0, item1, item2, item3, item4, item5}; + myListView->Items->AddRange( temp7 ); + + // Determine whether Windows XP or a later + // operating system is present. + isRunningXPOrLater = false; + + if (System::Environment::OSVersion->Version->Major > 5 || + ( System::Environment::OSVersion->Version->Major == 5 && + System::Environment::OSVersion->Version->Minor >= 1) ) + { + isRunningXPOrLater = true; + } + + if (isRunningXPOrLater) + { + // Create the groupsTable array and populate it with one + // hash table for each column. + groupTables = gcnew array(myListView->Columns->Count); + for (int column = 0; column < myListView->Columns->Count; column++) + { + // Create a hash table containing all the groups + // needed for a single column. + groupTables[column] = CreateGroupsTable(column); + } + + // Start with the groups created for the Title column. + SetGroups(0); + } + + // Initialize the form. + this->Controls->Add(myListView); + this->Size = System::Drawing::Size(550, 330); + this->Text = "ListView Groups Example"; + } + + // Groups the items using the groups created for the clicked + // column. +private: + void myListView_ColumnClick( + Object^ /*sender*/, ColumnClickEventArgs^ e) + { + // Set the sort order to ascending when changing + // column groups; otherwise, reverse the sort order. + if ( myListView->Sorting == SortOrder::Descending || + ( isRunningXPOrLater && (e->Column != groupColumn) ) ) + { + myListView->Sorting = SortOrder::Ascending; + } + else + { + myListView->Sorting = SortOrder::Descending; + } + groupColumn = e->Column; + + // Set the groups to those created for the clicked column. + if (isRunningXPOrLater) + { + SetGroups(e->Column); + } + } + + // + // Sets myListView to the groups created for the specified column. +private: + void SetGroups(int column) + { + // Remove the current groups. + myListView->Groups->Clear(); + + // Retrieve the hash table corresponding to the column. + Hashtable^ groups = dynamic_cast(groupTables[column]); + + // Copy the groups for the column to an array. + array^ groupsArray = gcnew array(groups->Count); + groups->Values->CopyTo(groupsArray, 0); + + // Sort the groups and add them to myListView. + Array::Sort(groupsArray, gcnew ListViewGroupSorter(myListView->Sorting)); + myListView->Groups->AddRange(groupsArray); + + // Iterate through the items in myListView, assigning each + // one to the appropriate group. + IEnumerator^ myEnum = myListView->Items->GetEnumerator(); + while (myEnum->MoveNext()) + { + ListViewItem^ item = safe_cast(myEnum->Current); + // Retrieve the subitem text corresponding to the column. + String^ subItemText = item->SubItems[column]->Text; + + // For the Title column, use only the first letter. + if (column == 0) + { + subItemText = subItemText->Substring(0, 1); + } + + // Assign the item to the matching group. + item->Group = dynamic_cast(groups[subItemText]); + } + } + // + + // + // Creates a Hashtable object with one entry for each unique + // subitem value (or initial letter for the parent item) + // in the specified column. +private: + Hashtable^ CreateGroupsTable(int column) + { + // Create a Hashtable object. + Hashtable^ groups = gcnew Hashtable(); + + // Iterate through the items in myListView. + IEnumerator^ myEnum1 = myListView->Items->GetEnumerator(); + while (myEnum1->MoveNext()) + { + ListViewItem^ item = safe_cast(myEnum1->Current); + // Retrieve the text value for the column. + String^ subItemText = item->SubItems[column]->Text; + + // Use the initial letter instead if it is the first column. + if (column == 0) + { + subItemText = subItemText->Substring(0, 1); + } + + // If the groups table does not already contain a group + // for the subItemText value, add a new group using the + // subItemText value for the group header and Hashtable key. + if (!groups->Contains(subItemText)) + { + groups->Add( subItemText, gcnew ListViewGroup(subItemText, + HorizontalAlignment::Left) ); + } + } + + // Return the Hashtable object. + return groups; + } + // + + // Sorts ListViewGroup objects by header value. + ref class ListViewGroupSorter : public IComparer + { + private: + SortOrder order; + + // Stores the sort order. + public: + ListViewGroupSorter(SortOrder theOrder) + { + order = theOrder; + } + + // Compares the groups by header value, using the saved sort + // order to return the correct value. + virtual int Compare(Object^ x, Object^ y) + { + int result = String::Compare( + (dynamic_cast(x))->Header, + (dynamic_cast(y))->Header + ); + if (order == SortOrder::Ascending) + { + return result; + } + else + { + return -result; + } + } + }; +}; + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew ListViewGroupsExample()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp new file mode 100644 index 00000000000..0e1cfe242aa --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.InsertionMark/CPP/listviewinsertionmarkexample.cpp @@ -0,0 +1,160 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class ListViewInsertionMarkExample: public Form +{ +private: + ListView^ myListView; + +public: + + // + ListViewInsertionMarkExample() + { + // Initialize myListView. + myListView = gcnew ListView; + myListView->Dock = DockStyle::Fill; + myListView->View = View::LargeIcon; + myListView->MultiSelect = false; + myListView->ListViewItemSorter = gcnew ListViewIndexComparer; + + // Initialize the insertion mark. + myListView->InsertionMark->Color = Color::Green; + + // Add items to myListView. + myListView->Items->Add( "zero" ); + myListView->Items->Add( "one" ); + myListView->Items->Add( "two" ); + myListView->Items->Add( "three" ); + myListView->Items->Add( "four" ); + myListView->Items->Add( "five" ); + + // Initialize the drag-and-drop operation when running + // under Windows XP or a later operating system. + if ( System::Environment::OSVersion->Version->Major > 5 || (System::Environment::OSVersion->Version->Major == 5 && System::Environment::OSVersion->Version->Minor >= 1) ) + { + myListView->AllowDrop = true; + myListView->ItemDrag += gcnew ItemDragEventHandler( this, &ListViewInsertionMarkExample::myListView_ItemDrag ); + myListView->DragEnter += gcnew DragEventHandler( this, &ListViewInsertionMarkExample::myListView_DragEnter ); + myListView->DragOver += gcnew DragEventHandler( this, &ListViewInsertionMarkExample::myListView_DragOver ); + myListView->DragLeave += gcnew EventHandler( this, &ListViewInsertionMarkExample::myListView_DragLeave ); + myListView->DragDrop += gcnew DragEventHandler( this, &ListViewInsertionMarkExample::myListView_DragDrop ); + } + + // Initialize the form. + this->Text = "ListView Insertion Mark Example"; + this->Controls->Add( myListView ); + } + +private: + + // + // Starts the drag-and-drop operation when an item is dragged. + void myListView_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^ e ) + { + myListView->DoDragDrop( e->Item, DragDropEffects::Move ); + } + + // Sets the target drop effect. + void myListView_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) + { + e->Effect = e->AllowedEffect; + } + + // + // Moves the insertion mark as the item is dragged. + void myListView_DragOver( Object^ /*sender*/, DragEventArgs^ e ) + { + // Retrieve the client coordinates of the mouse pointer. + Point targetPoint = myListView->PointToClient( Point(e->X,e->Y) ); + + // Retrieve the index of the item closest to the mouse pointer. + int targetIndex = myListView->InsertionMark->NearestIndex( targetPoint ); + + // Confirm that the mouse pointer is not over the dragged item. + if ( targetIndex > -1 ) + { + // Determine whether the mouse pointer is to the left or + // the right of the midpoint of the closest item and set + // the InsertionMark.AppearsAfterItem property accordingly. + Rectangle itemBounds = myListView->GetItemRect( targetIndex ); + if ( targetPoint.X > itemBounds.Left + (itemBounds.Width / 2) ) + { + myListView->InsertionMark->AppearsAfterItem = true; + } + else + { + myListView->InsertionMark->AppearsAfterItem = false; + } + } + + // Set the location of the insertion mark. If the mouse is + // over the dragged item, the targetIndex value is -1 and + // the insertion mark disappears. + myListView->InsertionMark->Index = targetIndex; + } + + // + // Removes the insertion mark when the mouse leaves the control. + void myListView_DragLeave( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myListView->InsertionMark->Index = -1; + } + + // Moves the item to the location of the insertion mark. + void myListView_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) + { + // Retrieve the index of the insertion mark; + int targetIndex = myListView->InsertionMark->Index; + + // If the insertion mark is not visible, exit the method. + if ( targetIndex == -1 ) + { + return; + } + + // If the insertion mark is to the right of the item with + // the corresponding index, increment the target index. + if ( myListView->InsertionMark->AppearsAfterItem ) + { + targetIndex++; + } + + // Retrieve the dragged item. + ListViewItem^ draggedItem = dynamic_cast(e->Data->GetData( ListViewItem::typeid )); + + // Insert a copy of the dragged item at the target index. + // A copy must be inserted before the original item is removed + // to preserve item index values. + myListView->Items->Insert( targetIndex, dynamic_cast(draggedItem->Clone()) ); + + // Remove the original copy of the dragged item. + myListView->Items->Remove( draggedItem ); + + } + + // Sorts ListViewItem objects by index. + ref class ListViewIndexComparer: public System::Collections::IComparer + { + public: + virtual int Compare( Object^ x, Object^ y ) + { + return (dynamic_cast(x))->Index - (dynamic_cast(y))->Index; + } + }; +}; + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew ListViewInsertionMarkExample ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp new file mode 100644 index 00000000000..aca66507837 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView.Tiling/CPP/listviewtilingexample.cpp @@ -0,0 +1,88 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class ListViewTilingExample: public Form +{ +private: + ImageList^ myImageList; + +public: + ListViewTilingExample() + { + // Initialize myListView. + ListView^ myListView = gcnew ListView; + myListView->Dock = DockStyle::Fill; + myListView->View = View::Tile; + + // Initialize the tile size. + myListView->TileSize = System::Drawing::Size( 400, 45 ); + + // Initialize the item icons. + myImageList = gcnew ImageList; + System::Drawing::Icon^ myIcon = gcnew System::Drawing::Icon( "book.ico" ); + try + { + myImageList->Images->Add( myIcon ); + } + finally + { + if ( myIcon ) + delete safe_cast(myIcon); + } + + myImageList->ImageSize = System::Drawing::Size( 32, 32 ); + myListView->LargeImageList = myImageList; + + // Add column headers so the subitems will appear. + array^temp0 = {gcnew ColumnHeader,gcnew ColumnHeader,gcnew ColumnHeader}; + myListView->Columns->AddRange( temp0 ); + + // Create items and add them to myListView. + array^temp1 = {"Programming Windows","Petzold, Charles","1998"}; + ListViewItem^ item0 = gcnew ListViewItem( temp1,0 ); + array^temp2 = {"Code: The Hidden Language of Computer Hardware and Software","Petzold, Charles","2000"}; + ListViewItem^ item1 = gcnew ListViewItem( temp2,0 ); + array^temp3 = {"Programming Windows with C#","Petzold, Charles","2001"}; + ListViewItem^ item2 = gcnew ListViewItem( temp3,0 ); + array^temp4 = {"Coding Techniques for Microsoft Visual Basic .NET","Connell, John","2001"}; + ListViewItem^ item3 = gcnew ListViewItem( temp4,0 ); + array^temp5 = {"C# for Java Developers","Jones, Allen & Freeman, Adam","2002"}; + ListViewItem^ item4 = gcnew ListViewItem( temp5,0 ); + array^temp6 = {"Microsoft .NET XML Web Services Step by Step","Jones, Allen & Freeman, Adam","2002"}; + ListViewItem^ item5 = gcnew ListViewItem( temp6,0 ); + array^temp7 = {item0,item1,item2,item3,item4,item5}; + myListView->Items->AddRange( temp7 ); + + // Initialize the form. + this->Controls->Add( myListView ); + this->Size = System::Drawing::Size( 430, 330 ); + this->Text = "ListView Tiling Example"; + } + +protected: + + // Clean up any resources being used. + ~ListViewTilingExample() + { + if ( myImageList != nullptr ) + { + delete myImageList; + } + } +}; + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run( gcnew ListViewTilingExample ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp new file mode 100644 index 00000000000..c798f694428 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView1/CPP/form1.cpp @@ -0,0 +1,153 @@ + + +// The following Snippet code example demonstrates using the: +// ListView.MultiSelect, ListView.SelectedItems, +// ListView.SelectIndices, SelectedIndexCollection, +// SelectedListViewItemCollection ListView.SelectedIndexChanged event, +// and ListView.HeaderStyle members and the SelectedIndexCollection and +// SelectedListViewItemCollection classes. +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + InitializeComponent(); + InitializeListView(); + HookupEvents(); + } + +internal: + System::Windows::Forms::ListView^ ListView1; + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::Label ^ Label1; + +private: + void InitializeComponent() + { + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + this->TextBox1->Location = System::Drawing::Point( 88, 168 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 120, 20 ); + this->TextBox1->TabIndex = 1; + this->TextBox1->Text = ""; + this->Label1->Location = System::Drawing::Point( 32, 168 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 48, 23 ); + this->Label1->TabIndex = 2; + this->Label1->Text = "Total: $"; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->TextBox1 ); + this->Name = "Form1"; + this->Text = "Breakfast Menu"; + this->ResumeLayout( false ); + } + + // + // This method adds two columns to the ListView, setting the Text + // and TextAlign, and Width properties of each ColumnHeader. The + // HeaderStyle property is set to NonClickable since the ColumnClick + // event is not handled. Finally the method adds ListViewItems and + // SubItems to each column. + void InitializeListView() + { + this->ListView1 = gcnew System::Windows::Forms::ListView; + this->ListView1->BackColor = System::Drawing::SystemColors::Control; + this->ListView1->Dock = System::Windows::Forms::DockStyle::Top; + this->ListView1->Location = System::Drawing::Point( 0, 0 ); + this->ListView1->Name = "ListView1"; + this->ListView1->Size = System::Drawing::Size( 292, 130 ); + this->ListView1->TabIndex = 0; + this->ListView1->View = System::Windows::Forms::View::Details; + this->ListView1->MultiSelect = true; + this->ListView1->HideSelection = false; + this->ListView1->HeaderStyle = ColumnHeaderStyle::Nonclickable; + ColumnHeader^ columnHeader1 = gcnew ColumnHeader; + columnHeader1->Text = "Breakfast Item"; + columnHeader1->TextAlign = HorizontalAlignment::Left; + columnHeader1->Width = 146; + ColumnHeader^ columnHeader2 = gcnew ColumnHeader; + columnHeader2->Text = "Price Each"; + columnHeader2->TextAlign = HorizontalAlignment::Center; + columnHeader2->Width = 142; + this->ListView1->Columns->Add( columnHeader1 ); + this->ListView1->Columns->Add( columnHeader2 ); + array^foodList = {"Juice","Coffee","Cereal & Milk","Fruit Plate","Toast & Jelly","Bagel & Cream Cheese"}; + array^foodPrice = {"1.09","1.09","2.19","2.49","1.49","1.49"}; + for ( int count = 0; count < foodList->Length; count++ ) + { + ListViewItem^ listItem = gcnew ListViewItem( foodList[ count ] ); + listItem->SubItems->Add( foodPrice[ count ] ); + ListView1->Items->Add( listItem ); + + } + this->Controls->Add( ListView1 ); + } + // + + void HookupEvents() + { + this->ListView1->SelectedIndexChanged += gcnew EventHandler( this, &Form1::ListView1_SelectedIndexChanged_UsingItems ); + this->ListView1->SelectedIndexChanged += gcnew EventHandler( this, &Form1::ListView1_SelectedIndexChanged_UsingIndices ); + } + + // You can access the selected items directly with the SelectedItems + // property or you can access them through the items' indices, + // using the SelectedIndices property. The following methods show + // the two approaches. + // + // Uses the SelectedItems property to retrieve and tally the price + // of the selected menu items. + void ListView1_SelectedIndexChanged_UsingItems( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ListView::SelectedListViewItemCollection^ breakfast = this->ListView1->SelectedItems; + double price = 0.0; + System::Collections::IEnumerator^ myEnum = breakfast->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + ListViewItem^ item = safe_cast(myEnum->Current); + price += Double::Parse( item->SubItems[ 1 ]->Text ); + } + + // Output the price to TextBox1. + TextBox1->Text = price.ToString(); + } + // + + // + // Uses the SelectedIndices property to retrieve and tally the + // price of the selected menu items. + void ListView1_SelectedIndexChanged_UsingIndices( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + ListView::SelectedIndexCollection^ indexes = this->ListView1->SelectedIndices; + double price = 0.0; + System::Collections::IEnumerator^ myEnum1 = indexes->GetEnumerator(); + while ( myEnum1->MoveNext() ) + { + int index = safe_cast(myEnum1->Current); + price += Double::Parse( this->ListView1->Items[ index ]->SubItems[ 1 ]->Text ); + } + + + // Output the price to TextBox1. + TextBox1->Text = price.ToString(); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp new file mode 100644 index 00000000000..076b17028f6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView2/CPP/form1.cpp @@ -0,0 +1,170 @@ + + +// The following code example demonstrates using the ListView.CheckedItems, +// CheckedItem.CheckState, ListView.BeginUpdate, and ListView.EndUpdate +// members, along with instances of the ListViewCheckedItemCollection, +// and ItemCheckEventArgs classes +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + InitializeComponent(); + InitializeListView(); + + // Connect the events with the methods that handle them. + this->ListView1->ItemCheck += gcnew ItemCheckEventHandler( this, &Form1::ListView1_ItemCheck1 ); + this->ListView1->ItemCheck += gcnew ItemCheckEventHandler( this, &Form1::ListView1_ItemCheck2 ); + } + +internal: + System::Windows::Forms::ListView^ ListView1; + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::Label ^ Label1; + +private: + void InitializeComponent() + { + price = 0.0; + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + this->TextBox1->Location = System::Drawing::Point( 88, 168 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 120, 20 ); + this->TextBox1->TabIndex = 1; + this->TextBox1->Text = ""; + this->Label1->Location = System::Drawing::Point( 32, 168 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 48, 23 ); + this->Label1->TabIndex = 2; + this->Label1->Text = "Total: $"; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->TextBox1 ); + this->Name = "Form1"; + this->Text = "Breakfast Menu"; + this->ResumeLayout( false ); + } + + // + void InitializeListView() + { + this->ListView1 = gcnew System::Windows::Forms::ListView; + + // Set properties such as BackColor and DockStyle and Location. + this->ListView1->BackColor = System::Drawing::SystemColors::Control; + this->ListView1->Dock = System::Windows::Forms::DockStyle::Top; + this->ListView1->Location = System::Drawing::Point( 0, 0 ); + this->ListView1->Size = System::Drawing::Size( 292, 130 ); + this->ListView1->View = System::Windows::Forms::View::Details; + this->ListView1->HideSelection = false; + + // Allow the user to select multiple items. + this->ListView1->MultiSelect = true; + + // Show CheckBoxes in the ListView. + this->ListView1->CheckBoxes = true; + + //Set the column headers and populate the columns. + ListView1->HeaderStyle = ColumnHeaderStyle::Nonclickable; + ColumnHeader^ columnHeader1 = gcnew ColumnHeader; + columnHeader1->Text = "Breakfast Choices"; + columnHeader1->TextAlign = HorizontalAlignment::Left; + columnHeader1->Width = 146; + ColumnHeader^ columnHeader2 = gcnew ColumnHeader; + columnHeader2->Text = "Price Each"; + columnHeader2->TextAlign = HorizontalAlignment::Center; + columnHeader2->Width = 142; + this->ListView1->Columns->Add( columnHeader1 ); + this->ListView1->Columns->Add( columnHeader2 ); + array^foodList = {"Juice","Coffee","Cereal & Milk","Fruit Plate","Toast & Jelly","Bagel & Cream Cheese"}; + array^foodPrice = {"1.09","1.09","2.19","2.79","2.09","2.69"}; + int count; + + // Members are added one at a time, so call BeginUpdate to ensure + // the list is painted only once, rather than as each list item is added. + ListView1->BeginUpdate(); + for ( count = 0; count < foodList->Length; count++ ) + { + ListViewItem^ listItem = gcnew ListViewItem( foodList[ count ] ); + listItem->SubItems->Add( foodPrice[ count ] ); + ListView1->Items->Add( listItem ); + } + + //Call EndUpdate when you finish adding items to the ListView. + ListView1->EndUpdate(); + this->Controls->Add( this->ListView1 ); + } + // + + // + double price; + + // Handles the ItemCheck event. The method uses the CurrentValue + // property of the ItemCheckEventArgs to retrieve and tally the + // price of the menu items selected. + void ListView1_ItemCheck1( Object^ /*sender*/, System::Windows::Forms::ItemCheckEventArgs^ e ) + { + if ( e->CurrentValue == CheckState::Unchecked ) + { + price += Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); + } + else + if ( (e->CurrentValue == CheckState::Checked) ) + { + price -= Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); + } + + + + // Output the price to TextBox1. + TextBox1->Text = price.ToString(); + } + // + + // + // Handles the ItemChecked event. The method loops through all the + // checked items and tallies a new price each time an item is + // checked or unchecked. It outputs the price to TextBox1. + void ListView1_ItemCheck2( Object^ /*sender*/, System::Windows::Forms::ItemCheckEventArgs^ e ) + { + double price = 0.0; + ListView::CheckedListViewItemCollection^ checkedItems = ListView1->CheckedItems; + System::Collections::IEnumerator^ myEnum = checkedItems->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + ListViewItem^ item = safe_cast(myEnum->Current); + price += Double::Parse( item->SubItems[ 1 ]->Text ); + } + + if ( e->CurrentValue == CheckState::Unchecked ) + { + price += Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); + } + else + if ( (e->CurrentValue == CheckState::Checked) ) + { + price -= Double::Parse( this->ListView1->Items[ e->Index ]->SubItems[ 1 ]->Text ); + } + + // Output the price to TextBox1. + TextBox1->Text = price.ToString(); + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp new file mode 100644 index 00000000000..a63dbc58244 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView3/CPP/form1.cpp @@ -0,0 +1,81 @@ +// The following code example handles the ListView.BeforeLabelEdit event +// and demonstrates the EditLabelEventArgs.Item and CancelEdit properties. + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + InitializeComponent(); + } + +internal: + System::Windows::Forms::ListView^ ListView1; + System::Windows::Forms::Label ^ Label1; + +private: + void InitializeComponent() + { + ListViewItem^ ListViewItem1 = gcnew ListViewItem( "VisualBasic.Net",0 ); + ListViewItem^ ListViewItem2 = gcnew ListViewItem( "Advanced VisualBasic.Net",1 ); + ListViewItem^ ListViewItem3 = gcnew ListViewItem( "Object-Oriented Design" ); + ListViewItem^ ListViewItem4 = gcnew ListViewItem( "Design Patterns for VB" ); + ListViewItem^ ListViewItem5 = gcnew ListViewItem( "UI Design" ); + ListViewItem^ ListViewItem6 = gcnew ListViewItem( "E-Commerce" ); + ListViewItem^ ListViewItem7 = gcnew ListViewItem( "Software Testing Techniques" ); + this->ListView1 = gcnew System::Windows::Forms::ListView; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + array^ temp0 = {ListViewItem1,ListViewItem2,ListViewItem3, + ListViewItem4,ListViewItem5,ListViewItem6,ListViewItem7}; + this->ListView1->Items->AddRange( temp0 ); + this->ListView1->LabelEdit = true; + this->ListView1->Location = System::Drawing::Point( 16, 48 ); + this->ListView1->Name = "ListView1"; + this->ListView1->Size = System::Drawing::Size( 248, 120 ); + this->ListView1->TabIndex = 0; + this->ListView1->View = System::Windows::Forms::View::List; + this->ListView1->BeforeLabelEdit += gcnew LabelEditEventHandler( + this, &Form1::ListView1_BeforeLabelEdit ); + this->Label1->Location = System::Drawing::Point( 16, 8 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 240, 32 ); + this->Label1->TabIndex = 2; + this->Label1->Text = "Proposed Class Schedule" + + " (The first two classes are required):"; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->ListView1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // + void ListView1_BeforeLabelEdit( Object^ sender, + System::Windows::Forms::LabelEditEventArgs^ e ) + { + // Allow all but the first two items of the list to + // be modified by the user. + if ( e->Item < 2 ) + { + e->CancelEdit = true; + } + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp new file mode 100644 index 00000000000..aa0f444f1ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListView4/CPP/form1.cpp @@ -0,0 +1,106 @@ + + +#using +#using +#using + +// The following code example demonstrates the use of ListView.Clear() +// and ListViewItem.Selected members. +// +// This snippet example requires a form that contains a ListView +// called ListView1, on a form, with the View property set to Details. +// The form also requires a button called button1. + +using namespace System::Windows::Forms; +using namespace System; + +public ref class Form1: public System::Windows::Forms::Form +{ +internal: + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::ListView^ ListView1; + +public: + Form1() + : Form() + { + InitializeListView(); + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + this->Button1->Location = System::Drawing::Point( 80, 192 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 96, 32 ); + this->Button1->TabIndex = 1; + this->Button1->Text = "See lunch menu"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->ListView1 ); + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Meal Selection"; + this->ResumeLayout( false ); + } + + // + // +private: + void InitializeListView() + { + // Set up the inital values for the ListView and populate it. + this->ListView1 = gcnew ListView; + this->ListView1->Dock = DockStyle::Top; + this->ListView1->Location = System::Drawing::Point( 0, 0 ); + this->ListView1->Size = System::Drawing::Size( 292, 130 ); + this->ListView1->View = View::Details; + this->ListView1->FullRowSelect = true; + array^breakfast = {"Continental Breakfast","Pancakes and Sausage","Denver Omelet","Eggs & Bacon","Bagel & Cream Cheese"}; + array^breakfastPrices = {"3.09","4.09","4.19","4.79","2.09"}; + PopulateMenu( "Breakfast", breakfast, breakfastPrices ); + } + + void PopulateMenu( String^ meal, array^menuItems, array^menuPrices ) + { + ColumnHeader^ columnHeader1 = gcnew ColumnHeader; + columnHeader1->Text = String::Concat( meal, " Choices" ); + columnHeader1->TextAlign = HorizontalAlignment::Left; + columnHeader1->Width = 146; + ColumnHeader^ columnHeader2 = gcnew ColumnHeader; + columnHeader2->Text = "Price"; + columnHeader2->TextAlign = HorizontalAlignment::Center; + columnHeader2->Width = 142; + this->ListView1->Columns->Add( columnHeader1 ); + this->ListView1->Columns->Add( columnHeader2 ); + for ( int count = 0; count < menuItems->Length; count++ ) + { + ListViewItem^ listItem = gcnew ListViewItem( menuItems[ count ] ); + listItem->SubItems->Add( menuPrices[ count ] ); + ListView1->Items->Add( listItem ); + + } + + // Use the Selected property to select the first item on + // the list. + ListView1->Focus(); + ListView1->Items[ 0 ]->Selected = true; + } + // + + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create new values for the ListView, clear the list, + // and repopulate it. + array^lunch = {"Hamburger","Grilled Cheese","Soup & Salad","Club Sandwich","Hotdog"}; + array^lunchPrices = {"4.09","5.09","5.19","4.79","2.09"}; + ListView1->Clear(); + PopulateMenu( "Lunch", lunch, lunchPrices ); + Button1->Enabled = false; + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp new file mode 100644 index 00000000000..ddd553b8133 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewAndPictureBox/CPP/form1.cpp @@ -0,0 +1,167 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + PopulateListView(); + InitializePictureBox(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::PictureBox^ PictureBox1; + System::Windows::Forms::ListView^ ListView1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->ListView1 = gcnew System::Windows::Forms::ListView; + this->SuspendLayout(); + + // + //PictureBox1 + // + // + //ListView1 + // + this->ListView1->Location = System::Drawing::Point( 40, 32 ); + this->ListView1->Name = "ListView1"; + this->ListView1->TabIndex = 1; + this->ListView1->View = System::Windows::Forms::View::Details; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->ListView1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // +private: + void PopulateListView() + { + ListView1->Width = 270; + ListView1->Location = System::Drawing::Point( 10, 10 ); + + // Declare and construct the ColumnHeader objects. + ColumnHeader^ header1; + ColumnHeader^ header2; + header1 = gcnew ColumnHeader; + header2 = gcnew ColumnHeader; + + // Set the text, alignment and width for each column header. + header1->Text = "File name"; + header1->TextAlign = HorizontalAlignment::Left; + header1->Width = 70; + header2->TextAlign = HorizontalAlignment::Left; + header2->Text = "Location"; + header2->Width = 200; + + // Add the headers to the ListView control. + ListView1->Columns->Add( header1 ); + ListView1->Columns->Add( header2 ); + + // Specify that each item appears on a separate line. + ListView1->View = View::Details; + + // Populate the ListView.Items property. + // Set the directory to the sample picture directory. + System::IO::DirectoryInfo^ dirInfo = gcnew System::IO::DirectoryInfo( "C:\\Documents and Settings\\All Users" + "\\Documents\\My Pictures\\Sample Pictures" ); + + // Get the .jpg files from the directory + array^files = dirInfo->GetFiles( "*.jpg" ); + + // Add each file name and full name including path + // to the ListView. + if ( files != nullptr ) + { + System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + System::IO::FileInfo^ file = safe_cast(myEnum->Current); + ListViewItem^ item = gcnew ListViewItem( file->Name ); + item->SubItems->Add( file->FullName ); + ListView1->Items->Add( item ); + } + } + } + // + + void InitializePictureBox() + { + PictureBox1 = gcnew PictureBox; + + // Set the location and size of the PictureBox control. + this->PictureBox1->Location = System::Drawing::Point( 70, 120 ); + this->PictureBox1->Size = System::Drawing::Size( 140, 140 ); + this->PictureBox1->TabStop = false; + + // Set the SizeMode property to the StretchImage value. This + // will shrink or enlarge the image as needed to fit into + // the PictureBox. + this->PictureBox1->SizeMode = PictureBoxSizeMode::StretchImage; + + // Set the border style to a three-dimensional border. + this->PictureBox1->BorderStyle = BorderStyle::Fixed3D; + + // Add the PictureBox to the form. + this->Controls->Add( this->PictureBox1 ); + } + + void ListView1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) + { + ListViewItem^ selection = ListView1->GetItemAt( e->X, e->Y ); + + // If the user selects an item in the ListView, display + // the image in the PictureBox. + if ( selection != nullptr ) + { + PictureBox1->Image = System::Drawing::Image::FromFile( selection->SubItems[ 1 ]->Text ); + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp new file mode 100644 index 00000000000..be4243b738c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewFindItems/cpp/form1.cpp @@ -0,0 +1,188 @@ +#pragma region Using directives + +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +#pragma endregion + +namespace ListViewFindItemWithTextHowTo +{ + public ref class Form1 : public Form + { + public: + Form1() + { + + InitializeComponent(); + + //InitializeTextSearchListView(); + InitializeLocationSearchListView(); + } + + /// + /// Required designer variable. + /// + private: + System::ComponentModel::IContainer^ components; + + /// + /// Clean up any resources being used. + /// + protected: + ~Form1() + { + if (components != nullptr) + { + delete components; + } + } + +#pragma region^ Windows Form^ Designer generated^ code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private: + void InitializeComponent() + { + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(292, 266); + this->Name = "Form1"; + this->Text = "Form1"; + + } + +#pragma endregion + + // + private: + ListView^ textListView; + TextBox^ searchBox; + + private: + void InitializeTextSearchListView() + { + textListView = gcnew ListView(); + searchBox = gcnew TextBox(); + searchBox->Location = Point(150, 20); + textListView->Scrollable = true; + textListView->Width = 100; + + // Set the View to list to use the FindItemWithText method. + textListView->View = View::List; + + // Populate the ListViewWithItems + textListView->Items->AddRange(gcnew array{ + gcnew ListViewItem("Amy Alberts"), + gcnew ListViewItem("Amy Recker"), + gcnew ListViewItem("Erin Hagens"), + gcnew ListViewItem("Barry Johnson"), + gcnew ListViewItem("Jay Hamlin"), + gcnew ListViewItem("Brian Valentine"), + gcnew ListViewItem("Brian Welker"), + gcnew ListViewItem("Daniel Weisman") }); + + // Handle the TextChanged to get the text for our search. + searchBox->TextChanged += gcnew EventHandler(this, + &Form1::searchBox_TextChanged); + + // Add the controls to the form. + this->Controls->Add(textListView); + this->Controls->Add(searchBox); + } + + // + private: + void searchBox_TextChanged(Object^ sender, EventArgs^ e) + { + // Call FindItemWithText with the contents of the textbox. + ListViewItem^ foundItem = + textListView->FindItemWithText(searchBox->Text, false, 0, true); + if (foundItem != nullptr) + { + textListView->TopItem = foundItem; + } + } + // + // + + // + ListView^ iconListView; + TextBox^ previousItemBox; + + private: + void InitializeLocationSearchListView() + { + previousItemBox = gcnew TextBox(); + iconListView = gcnew ListView(); + previousItemBox->Location = Point(150, 20); + + // Create an image list for the icon ListView. + iconListView->SmallImageList = gcnew ImageList(); + + // Add an image to the ListView small icon list. + iconListView->SmallImageList->Images->Add( + gcnew Bitmap(Control::typeid, "Edit.bmp")); + + // Set the view to small icon and add some items with the image + // in the image list. + iconListView->View = View::SmallIcon; + iconListView->Items->AddRange(gcnew array{ + gcnew ListViewItem("Amy Alberts", 0), + gcnew ListViewItem("Amy Recker", 0), + gcnew ListViewItem("Erin Hagens", 0), + gcnew ListViewItem("Barry Johnson", 0), + gcnew ListViewItem("Jay Hamlin", 0), + gcnew ListViewItem("Brian Valentine", 0), + gcnew ListViewItem("Brian Welker", 0), + gcnew ListViewItem("Daniel Weisman", 0) }); + this->Controls->Add(iconListView); + this->Controls->Add(previousItemBox); + + // Handle the MouseDown event to capture user input. + iconListView->MouseDown += gcnew MouseEventHandler( + this, &Form1::iconListView_MouseDown); + } + + // + void iconListView_MouseDown(Object^ sender, MouseEventArgs^ e) + { + // Find the next item up from where the user clicked. + ListViewItem^ foundItem = iconListView->FindNearestItem( + SearchDirectionHint::Up, e->X, e->Y); + + // Display the results in a textbox.. + if (foundItem != nullptr) + { + previousItemBox->Text = foundItem->Text; + } + else + { + previousItemBox->Text = "No item found"; + } + } + // + // + }; +} + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew ListViewFindItemWithTextHowTo::Form1()); +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp new file mode 100644 index 00000000000..051086197b5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemExample/CPP/form1.cpp @@ -0,0 +1,103 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeListViewItems(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::ListView^ ListView1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->ListView1 = gcnew System::Windows::Forms::ListView; + this->SuspendLayout(); + + // + //ListView1 + // + this->ListView1->Location = System::Drawing::Point( 120, 72 ); + this->ListView1->Name = "ListView1"; + this->ListView1->TabIndex = 0; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->ListView1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void InitializeListViewItems() + { + ListView1->View = View::List; + array^favoriteCursors = {Cursors::Help,Cursors::Hand,Cursors::No,Cursors::Cross}; + + // Populate the ListView control with the array of Cursors. + System::Collections::IEnumerator^ myEnum = favoriteCursors->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + System::Windows::Forms::Cursor^ aCursor = safe_cast(myEnum->Current); + + // Construct the ListViewItem object + ListViewItem^ item = gcnew ListViewItem; + + // Set the Text property to the cursor name. + item->Text = aCursor->ToString(); + + // Set the Tag property to the cursor. + item->Tag = aCursor; + + // Add the ListViewItem to the ListView. + ListView1->Items->Add( item ); + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp new file mode 100644 index 00000000000..b9dc411f391 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ListViewItemStyle/CPP/form1.cpp @@ -0,0 +1,115 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + InitializeComponent(); + InitializeListView(); + } + +internal: + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 120, 224 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Button1"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // +internal: + // Declare the Listview object. + System::Windows::Forms::ListView^ myListView; + +private: + + // Initialize the ListView object with subitems of a different + // style than the default styles for the ListView. + void InitializeListView() + { + // Set the Location, View and Width properties for the + // ListView object. + myListView = gcnew ListView; + myListView->Location = System::Drawing::Point( 20, 20 ); + myListView->Width = 250; + + // The View property must be set to Details for the + // subitems to be visible. + myListView->View = View::Details; + + // Each SubItem object requires a column, so add three columns. + this->myListView->Columns->Add( "Key", 50, HorizontalAlignment::Left ); + this->myListView->Columns->Add( "A", 100, HorizontalAlignment::Left ); + this->myListView->Columns->Add( "B", 100, HorizontalAlignment::Left ); + + // Add a ListItem object to the ListView. + ListViewItem^ entryListItem = myListView->Items->Add( "Items" ); + + // Set UseItemStyleForSubItems property to false to change + // look of subitems. + entryListItem->UseItemStyleForSubItems = false; + + // Add the expense subitem. + ListViewItem::ListViewSubItem ^ expenseItem = entryListItem->SubItems->Add( "Expense" ); + + // Change the expenseItem object's color and font. + expenseItem->ForeColor = System::Drawing::Color::Red; + expenseItem->Font = gcnew System::Drawing::Font( "Arial",10,System::Drawing::FontStyle::Italic ); + + // Add a subitem called revenueItem + ListViewItem::ListViewSubItem ^ revenueItem = entryListItem->SubItems->Add( "Revenue" ); + + // Change the revenueItem object's color and font. + revenueItem->ForeColor = System::Drawing::Color::Blue; + revenueItem->Font = gcnew System::Drawing::Font( "Times New Roman",10,System::Drawing::FontStyle::Bold ); + + // Add the ListView to the form. + this->Controls->Add( this->myListView ); + } + // + + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Use the ListView.TopItem property to access the SubItems + // and then reset their appearance. + myListView->TopItem->SubItems[ 1 ]->ResetStyle(); + myListView->TopItem->SubItems[ 2 ]->ResetStyle(); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp new file mode 100644 index 00000000000..5e12e57cde1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ManualContextMenu/CPP/form1.cpp @@ -0,0 +1,92 @@ + + +#using +#using +#using + +// The following code example demonstrates using the +// ContextMenu.Show() method. +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 104, 80 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 80, 80 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click To See Context Menu"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Displays the shortcut menu, offsetting its location + // from the upper-left corner of Button1 by 20 pixels in each direction. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + //Declare the menu items and the shortcut menu. + array^menuItems = {gcnew MenuItem( "Some Button Info" ),gcnew MenuItem( "Some Other Button Info" ),gcnew MenuItem( "Exit" )}; + System::Windows::Forms::ContextMenu^ buttonMenu = gcnew System::Windows::Forms::ContextMenu( menuItems ); + buttonMenu->Show( Button1, System::Drawing::Point( 20, 20 ) ); + } + // +}; + + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp new file mode 100644 index 00000000000..d2134dbac8e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemMergeOrder/CPP/form1.cpp @@ -0,0 +1,141 @@ + + +#using +#using +#using + +// +// The following code example demonstrates using the MenuItem +// Merge-Order property to control the way a merged menu is displayed. +using namespace System::Windows::Forms; + +//Declare a MainMenu object and its items. +public ref class Form1: public System::Windows::Forms::Form +{ +public private: + System::Windows::Forms::MainMenu^ mainMenu1; + System::Windows::Forms::MenuItem^ fileItem; + System::Windows::Forms::MenuItem^ newItem; + System::Windows::Forms::MenuItem^ openItem; + System::Windows::Forms::MenuItem^ saveItem; + System::Windows::Forms::MenuItem^ optionsMenu; + System::Windows::Forms::MenuItem^ viewItem; + System::Windows::Forms::MenuItem^ toolsItem; + + // Declare a ContextMenu object and its items. + System::Windows::Forms::ContextMenu^ contextMenu1; + System::Windows::Forms::MenuItem^ cutItem; + System::Windows::Forms::MenuItem^ copyItem; + System::Windows::Forms::MenuItem^ pasteItem; + +public: + Form1() + : Form() + { + this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->fileItem = gcnew System::Windows::Forms::MenuItem; + this->newItem = gcnew System::Windows::Forms::MenuItem; + this->openItem = gcnew System::Windows::Forms::MenuItem; + this->saveItem = gcnew System::Windows::Forms::MenuItem; + this->viewItem = gcnew System::Windows::Forms::MenuItem; + this->toolsItem = gcnew System::Windows::Forms::MenuItem; + this->optionsMenu = gcnew System::Windows::Forms::MenuItem; + this->toolsItem = gcnew System::Windows::Forms::MenuItem; + this->viewItem = gcnew System::Windows::Forms::MenuItem; + this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu; + this->cutItem = gcnew System::Windows::Forms::MenuItem; + this->copyItem = gcnew System::Windows::Forms::MenuItem; + this->pasteItem = gcnew System::Windows::Forms::MenuItem; + + //Add file menu item and options menu item to the MainMenu. + array^temp0 = {this->fileItem,this->optionsMenu}; + this->mainMenu1->MenuItems->AddRange( temp0 ); + + // Initialize the file menu and its contents. + this->fileItem->Index = 0; + this->fileItem->Text = "File"; + this->newItem->Index = 0; + this->newItem->Text = "New"; + this->openItem->Index = 1; + this->openItem->Text = "Open"; + this->saveItem->Index = 2; + this->saveItem->Text = "Save"; + + // Set the merge order of fileItem to 2 so it has a lower priority + // on the merged menu. + this->fileItem->MergeOrder = 2; + + //Add the new items to the fileItem menu item collection. + array^temp1 = {this->newItem,this->openItem,this->saveItem}; + this->fileItem->MenuItems->AddRange( temp1 ); + + // Initialize the optionsMenu item and its contents. + this->optionsMenu->Index = 1; + this->optionsMenu->Text = "Options"; + this->viewItem->Index = 0; + this->viewItem->Text = "View"; + this->toolsItem->Index = 1; + this->toolsItem->Text = "Tools"; + + // Set mergeOrder property to 1, so it has a higher priority than + // the fileItem on the merged menu. + this->optionsMenu->MergeOrder = 1; + + //Add view and tool items to the optionsItem menu item. + array^temp2 = {this->viewItem,this->toolsItem}; + this->optionsMenu->MenuItems->AddRange( temp2 ); + + // Initialize the menu items for the shortcut menu. + this->cutItem->Index = 0; + this->cutItem->Text = "Cut"; + this->cutItem->MergeOrder = 0; + this->copyItem->Index = 1; + this->copyItem->Text = "Copy"; + this->copyItem->MergeOrder = 0; + this->pasteItem->Index = 2; + this->pasteItem->Text = "Paste"; + this->pasteItem->MergeOrder = 0; + + // Add menu items to the shortcut menu. + array^temp3 = {cutItem,copyItem,pasteItem}; + this->contextMenu1->MenuItems->AddRange( temp3 ); + + // Add the mainMenu1 items to the shortcut menu as well, by + // calling the MergeMenu method. + contextMenu1->MergeMenu( mainMenu1 ); + + //Initialize the form. + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Right click on form for merged menu."; + + // Associate the event-handling method with the + // MouseDown event. + this->MouseDown += gcnew MouseEventHandler( this, &Form1::Form1_MouseDown ); + + // Add mainMenu1 to the form. + this->Menu = mainMenu1; + } + + +private: + void Form1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) + { + + // Check for a right mouse click. + if ( e->Button == ::MouseButtons::Right ) + { + contextMenu1->Show( this, System::Drawing::Point( 30, 30 ) ); + } + } + +}; + + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp new file mode 100644 index 00000000000..25485bb09e9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MenuItemOwnerDraw/CPP/form1.cpp @@ -0,0 +1,112 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeMenu(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + // +internal: + // Declare the MainMenu control. + System::Windows::Forms::MainMenu^ MainMenu1; + + // Declare MenuItem2 as With-Events because it will be user drawn. + System::Windows::Forms::MenuItem^ MenuItem2; + +private: + void InitializeMenu() + { + + // Create MenuItem1, which will be drawn by the operating system. + MenuItem^ MenuItem1 = gcnew MenuItem( "Regular Menu Item" ); + + // Create MenuItem2. + MenuItem2 = gcnew MenuItem( "Custom Menu Item" ); + + // Set OwnerDraw property to true. This requires handling the + // DrawItem event for this menu item. + MenuItem2->OwnerDraw = true; + + //Add the event-handler delegate to handle the DrawItem event. + MenuItem2->DrawItem += gcnew DrawItemEventHandler( this, &Form1::DrawCustomMenuItem ); + + // Add the items to the menu. + array^temp0 = {MenuItem1,MenuItem2}; + MainMenu1 = gcnew MainMenu( temp0 ); + + // Add the menu to the form. + this->Menu = this->MainMenu1; + } + + // Draw the custom menu item. + void DrawCustomMenuItem( Object^ sender, DrawItemEventArgs^ e ) + { + // Cast the sender to MenuItem so you can access text property. + MenuItem^ customItem = dynamic_cast(sender); + + // Create a Brush and a Font to draw the MenuItem. + System::Drawing::Brush^ aBrush = System::Drawing::Brushes::DarkMagenta; + System::Drawing::Font^ aFont = gcnew System::Drawing::Font( "Garamond",10,FontStyle::Italic,GraphicsUnit::Point ); + + // Get the size of the text to use later to draw an ellipse + // around the item. + SizeF stringSize = e->Graphics->MeasureString( customItem->Text, aFont ); + + // Draw the item and then draw the ellipse. + e->Graphics->DrawString( customItem->Text, aFont, aBrush, (float)e->Bounds.X, (float)e->Bounds.Y ); + e->Graphics->DrawEllipse( gcnew Pen( System::Drawing::Color::Black,2 ), Rectangle(e->Bounds.X,e->Bounds.Y,(System::Int32)stringSize.Width,(System::Int32)stringSize.Height) ); + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp new file mode 100644 index 00000000000..373da0cd56d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MessageBox with Help/CPP/form1.cpp @@ -0,0 +1,233 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +// +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ImageList^ imageList1; + System::Windows::Forms::Button^ button1; + System::ComponentModel::IContainer^ components; + +public: + + /// + /// Required designer variable. + /// + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( Form1::typeid ); + this->imageList1 = gcnew System::Windows::Forms::ImageList( this->components ); + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // imageList1 + // + this->imageList1->ImageSize = System::Drawing::Size( 16, 16 ); + this->imageList1->ImageStream = (dynamic_cast(resources->GetObject( "imageList1.ImageStream" ))); + this->imageList1->TransparentColor = System::Drawing::Color::Transparent; + this->imageList1->Images->SetKeyName( 0, "" ); + this->imageList1->Images->SetKeyName( 1, "" ); + this->imageList1->Images->SetKeyName( 2, "" ); + this->imageList1->Images->SetKeyName( 3, "" ); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 103, 86 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // this.button1.HelpRequested += new System.Windows.Forms.HelpEventHandler (this.button1_HelpRequested); + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 365, 342 ); + this->Controls->Add( this->button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Display a message box with a Help button. Show a custom Help window + // by handling the HelpRequested event. + System::Windows::Forms::DialogResult AlertMessageWithCustomHelpWindow() + { + + // Handle the HelpRequested event for the following message. + this->HelpRequested += gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::Form1_HelpRequested ); + this->Tag = "Message with Help button."; + + // Show a message box with OK and Help buttons. + System::Windows::Forms::DialogResult r = MessageBox::Show( "Message with Help button.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, true ); + + // Remove the HelpRequested event handler to keep the event + // from being handled for other message boxes. + this->HelpRequested -= gcnew System::Windows::Forms::HelpEventHandler( this, &Form1::Form1_HelpRequested ); + + // Return the dialog box result. + return r; + } + + void Form1_HelpRequested( System::Object^ sender, System::Windows::Forms::HelpEventArgs^ hlpevent ) + { + + // Create a custom Help window in response to the HelpRequested event. + Form^ helpForm = gcnew Form; + + // Set up the form position, size, and title caption. + helpForm->StartPosition = FormStartPosition::Manual; + helpForm->Size = System::Drawing::Size( 200, 400 ); + helpForm->DesktopLocation = Point(this->DesktopBounds.X + this->Size.Width,this->DesktopBounds.Top); + helpForm->Text = "Help Form"; + + // Create a label to contain the Help text. + Label^ helpLabel = gcnew Label; + + // Add the label to the form and set its text. + helpForm->Controls->Add( helpLabel ); + helpLabel->Dock = DockStyle::Fill; + + // Use the sender parameter to identify the context of the Help request. + // The parameter must be cast to the Control type to get the Tag property. + Control^ senderControl = dynamic_cast(sender); + helpLabel->Text = String::Format( "Help information shown in response to user action on the '{0}' message.", dynamic_cast(senderControl->Tag) ); + + // Set the Help form to be owned by the main form. This helps + // to ensure that the Help form is disposed of. + this->AddOwnedForm( helpForm ); + + // Show the custom Help window. + helpForm->Show(); + + // Indicate that the HelpRequested event is handled. + hlpevent->Handled = true; + } + // + + void button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + DialogResult = AlertMessageWithCustomHelpWindow(); + + // + // Display a message box with a help button. + // The Help button opens the Mspaint.chm Help file. + System::Windows::Forms::DialogResult r1 = MessageBox::Show( "Message with Help file.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm" ); + // + + // + // Display a message box parented to the main form. + // The Help button opens the Mspaint.chm Help file. + System::Windows::Forms::DialogResult r2 = MessageBox::Show( this, "Message with Help file.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm" ); + // + + // + // Display a message box. The Help button opens + // the Mspaint.chm Help file and shows the Help contents + // on the Index tab. + System::Windows::Forms::DialogResult r3 = MessageBox::Show( "Message with Help file and Help navigator.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::Index ); + // + + // + // Display message box parented to the main form. + // The Help button opens the Mspaint.chm Help file + // and shows the Help contents on the Index tab. + System::Windows::Forms::DialogResult r4 = MessageBox::Show( this, "Message with Help file and Help navigator.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::Index ); + // + + // + // Display a message box. The Help button opens the Mspaint.chm Help file, + // shows index with the "ovals" keyword selected, and displays the + // associated topic. + System::Windows::Forms::DialogResult r5 = MessageBox::Show( "Message with Help file and Help navigator with additional parameter.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::KeywordIndex, "ovals" ); + // + + // + // Display message box parented to the main form. + // The Help button opens the Mspaint.chm Help file, + // shows index with the "ovals" keyword selected, and displays the + // associated topic. + System::Windows::Forms::DialogResult r6 = MessageBox::Show( this, "Message with Help file and Help navigator with additional parameter.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", HelpNavigator::KeywordIndex, "ovals" ); + // + + // + // Display a message box. The Help button opens the Mspaint.chm Help file, + // and the "mspaint.chm::/paint_brush.htm" Help keyword shows the + // associated topic. + System::Windows::Forms::DialogResult r7 = MessageBox::Show( "Message with Help file and keyword.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", "mspaint.chm::/paint_brush.htm" ); + // + + // + // Display message box parented to the main form. + // The Help button opens the Mspaint.chm Help file, + // and the "mspaint.chm::/paint_brush.htm" Help keyword shows the + // associated topic. + System::Windows::Forms::DialogResult r8 = MessageBox::Show( this, "Message with Help file and keyword.", "Help Caption", MessageBoxButtons::OK, MessageBoxIcon::Question, MessageBoxDefaultButton::Button1, (MessageBoxOptions)0, "mspaint.chm", "mspaint.chm::/paint_brush.htm" ); + // + } + + // private void button1_HelpRequested (System.Object sender, System.Windows.Forms.HelpEventArgs hlpevent) + // { + // MessageBox.Show ("Help requested from button"); + // } +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp new file mode 100644 index 00000000000..67166b7e0f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendar/CPP/monthcalendar.cpp @@ -0,0 +1,115 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::MonthCalendar^ monthCalendar1; + System::Windows::Forms::TextBox^ textBox1; + +public: + Form1() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->textBox1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + this->textBox1->Location = System::Drawing::Point( 48, 488 ); + this->textBox1->Multiline = true; + this->textBox1->ReadOnly = true; + this->textBox1->Size = System::Drawing::Size( 824, 32 ); + + // Create the calendar. + this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; + + // Set the calendar location. + this->monthCalendar1->Location = System::Drawing::Point( 47, 16 ); + + // Change the color. + this->monthCalendar1->BackColor = System::Drawing::SystemColors::Info; + this->monthCalendar1->ForeColor = System::Drawing::Color::FromArgb( ((System::Byte)(192)) ),((System::Byte)(0)),((System::Byte)(192)); + this->monthCalendar1->TitleBackColor = System::Drawing::Color::Purple; + this->monthCalendar1->TitleForeColor = System::Drawing::Color::Yellow; + this->monthCalendar1->TrailingForeColor = System::Drawing::Color::FromArgb( ((System::Byte)(192)) ),((System::Byte)(192)),((System::Byte)(0)); + + // Add dates to the AnnuallyBoldedDates array. + array^ temp1 = {System::DateTime( 2002, 4, 20, 0, 0, 0, 0 ),System::DateTime( 2002, 4, 28, 0, 0, 0, 0 ),System::DateTime( 2002, 5, 5, 0, 0, 0, 0 ),System::DateTime( 2002, 7, 4, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 12, 18, 0, 0, 0, 0 )}; + this->monthCalendar1->AnnuallyBoldedDates = temp1; + + // Add dates to BoldedDates array. + array^ temp2 = {System::DateTime( 2002, 9, 26, 0, 0, 0, 0 )}; + this->monthCalendar1->BoldedDates = temp2; + + // Add dates to MonthlyBoldedDates array. + array^ temp5 = {System::DateTime( 2002, 1, 15, 0, 0, 0, 0 ),System::DateTime( 2002, 1, 30, 0, 0, 0, 0 )}; + this->monthCalendar1->MonthlyBoldedDates = temp5; + + // Configure the calendar to display 3 rows by 4 columns of months. + this->monthCalendar1->CalendarDimensions = System::Drawing::Size( 4, 3 ); + + // Set week to begin on Monday. + this->monthCalendar1->FirstDayOfWeek = System::Windows::Forms::Day::Monday; + + // Set the maximum visible date on the calendar to 12/31/2010. + this->monthCalendar1->MaxDate = System::DateTime( 2010, 12, 31, 0, 0, 0, 0 ); + + // Set the minimum visible date on calendar to 12/31/2010. + this->monthCalendar1->MinDate = System::DateTime( 1999, 1, 1, 0, 0, 0, 0 ); + + // Only allow 21 days to be selected at the same time. + this->monthCalendar1->MaxSelectionCount = 21; + + // Set the calendar to move one month at a time when navigating using the arrows. + this->monthCalendar1->ScrollChange = 1; + + // Do not show the S"Today" banner. + this->monthCalendar1->ShowToday = false; + + // Do not circle today's date. + this->monthCalendar1->ShowTodayCircle = false; + + // Show the week numbers to the left of each week. + this->monthCalendar1->ShowWeekNumbers = true; + + // Add event handlers for the DateSelected and DateChanged events + this->monthCalendar1->DateSelected += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateSelected ); + this->monthCalendar1->DateChanged += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateChanged ); + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 920, 566 ); + array^temp0 = {this->textBox1,this->monthCalendar1}; + this->Controls->AddRange( temp0 ); + this->Text = "Month Calendar Example"; + } + + +private: + void monthCalendar1_DateSelected( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ e ) + { + + // Show the start and end dates in the text box. + this->textBox1->Text = String::Format( "Date Selected: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString() ); + } + + void monthCalendar1_DateChanged( Object^ /*sender*/, System::Windows::Forms::DateRangeEventArgs^ e ) + { + + // Show the start and end dates in the text box. + this->textBox1->Text = String::Format( "Date Changed: Start = {0} : End = {1}", e->Start.ToShortDateString(), e->End.ToShortDateString() ); + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp new file mode 100644 index 00000000000..87afed814c9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MonthCalendarSelection/CPP/form1.cpp @@ -0,0 +1,53 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() : Form() + { + InitializeComponent(); + ShowAWeeksVacationOneMonthFromToday(); + } + +internal: + System::Windows::Forms::MonthCalendar^ MonthCalendar1; + +private: + void InitializeComponent() + { + this->MonthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; + this->SuspendLayout(); + this->MonthCalendar1->Location = System::Drawing::Point( 56, 32 ); + this->MonthCalendar1->Name = "MonthCalendar1"; + this->MonthCalendar1->TabIndex = 0; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->MonthCalendar1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Computes a week one month from today. + void ShowAWeeksVacationOneMonthFromToday() + { + DateTime today = this->MonthCalendar1->TodayDate; + DateTime vacationStart = today.AddMonths(1); + DateTime vacationEnd = vacationStart.AddDays(7); + + // Select the week using SelectionStart and SelectionEnd. + this->MonthCalendar1->SelectionStart = vacationStart.AddDays(-1); + this->MonthCalendar1->SelectionEnd = vacationEnd.AddDays(-1); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp new file mode 100644 index 00000000000..377edc2e5b8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.MouseEvent/CPP/mouseeventexample.cpp @@ -0,0 +1,268 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace MouseEvent +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Panel^ panel1; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::Label ^ label4; + System::Windows::Forms::Label ^ label5; + System::Windows::Forms::Label ^ label6; + System::Windows::Forms::Label ^ label7; + System::Windows::Forms::Label ^ label8; + System::Windows::Forms::Label ^ label9; + System::Windows::Forms::Button^ clearButton; + System::Drawing::Drawing2D::GraphicsPath^ mousePath; + System::Windows::Forms::GroupBox^ groupBox1; + int fontSize; + + public: + Form1() + { + fontSize = 20; + mousePath = gcnew System::Drawing::Drawing2D::GraphicsPath; + this->panel1 = gcnew System::Windows::Forms::Panel; + this->label1 = gcnew System::Windows::Forms::Label; + this->clearButton = gcnew System::Windows::Forms::Button; + this->label2 = gcnew System::Windows::Forms::Label; + this->label3 = gcnew System::Windows::Forms::Label; + this->label4 = gcnew System::Windows::Forms::Label; + this->label5 = gcnew System::Windows::Forms::Label; + this->label6 = gcnew System::Windows::Forms::Label; + this->label7 = gcnew System::Windows::Forms::Label; + this->label8 = gcnew System::Windows::Forms::Label; + this->label9 = gcnew System::Windows::Forms::Label; + this->groupBox1 = gcnew System::Windows::Forms::GroupBox; + + // Mouse Events Label + this->label1->Location = System::Drawing::Point( 24, 504 ); + this->label1->Size = System::Drawing::Size( 392, 23 ); + + // DoubleClickSize Label + this->label2->AutoSize = true; + this->label2->Location = System::Drawing::Point( 24, 48 ); + this->label2->Size = System::Drawing::Size( 35, 13 ); + + // DoubleClickTime Label + this->label3->AutoSize = true; + this->label3->Location = System::Drawing::Point( 24, 72 ); + this->label3->Size = System::Drawing::Size( 35, 13 ); + + // MousePresent Label + this->label4->AutoSize = true; + this->label4->Location = System::Drawing::Point( 24, 96 ); + this->label4->Size = System::Drawing::Size( 35, 13 ); + + // MouseButtons Label + this->label5->AutoSize = true; + this->label5->Location = System::Drawing::Point( 24, 120 ); + this->label5->Size = System::Drawing::Size( 35, 13 ); + + // MouseButtonsSwapped Label + this->label6->AutoSize = true; + this->label6->Location = System::Drawing::Point( 320, 48 ); + this->label6->Size = System::Drawing::Size( 35, 13 ); + + // MouseWheelPresent Label + this->label7->AutoSize = true; + this->label7->Location = System::Drawing::Point( 320, 72 ); + this->label7->Size = System::Drawing::Size( 35, 13 ); + + // MouseWheelScrollLines Label + this->label8->AutoSize = true; + this->label8->Location = System::Drawing::Point( 320, 96 ); + this->label8->Size = System::Drawing::Size( 35, 13 ); + + // NativeMouseWheelSupport Label + this->label9->AutoSize = true; + this->label9->Location = System::Drawing::Point( 320, 120 ); + this->label9->Size = System::Drawing::Size( 35, 13 ); + + // Mouse Panel + this->panel1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->panel1->BackColor = System::Drawing::SystemColors::ControlDark; + this->panel1->Location = System::Drawing::Point( 16, 160 ); + this->panel1->Size = System::Drawing::Size( 664, 320 ); + this->panel1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseUp ); + this->panel1->Paint += gcnew System::Windows::Forms::PaintEventHandler( this, &Form1::panel1_Paint ); + this->panel1->MouseEnter += gcnew System::EventHandler( this, &Form1::panel1_MouseEnter ); + this->panel1->MouseHover += gcnew System::EventHandler( this, &Form1::panel1_MouseHover ); + this->panel1->MouseMove += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseMove ); + this->panel1->MouseLeave += gcnew System::EventHandler( this, &Form1::panel1_MouseLeave ); + this->panel1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseDown ); + this->panel1->MouseWheel += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::panel1_MouseWheel ); + + // Clear Button + this->clearButton->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Right); + this->clearButton->Location = System::Drawing::Point( 592, 504 ); + this->clearButton->TabIndex = 1; + this->clearButton->Text = "Clear"; + this->clearButton->Click += gcnew System::EventHandler( this, &Form1::clearButton_Click ); + + // GroupBox + this->groupBox1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->groupBox1->Location = System::Drawing::Point( 16, 24 ); + this->groupBox1->Size = System::Drawing::Size( 664, 128 ); + this->groupBox1->Text = "System::Windows::Forms::SystemInformation"; + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 696, 534 ); + array^temp0 = {this->label9,this->label8,this->label7,this->label6,this->label5,this->label4,this->label3,this->label2,this->clearButton,this->panel1,this->label1,this->groupBox1}; + this->Controls->AddRange( temp0 ); + this->Text = "Mouse Event Example"; + + // + // Displays information about the system mouse. + label2->Text = "SystemInformation::DoubleClickSize: {0}",SystemInformation::DoubleClickSize; + label3->Text = "SystemInformation::DoubleClickTime: {0}",SystemInformation::DoubleClickTime; + label4->Text = "SystemInformation::MousePresent: {0}",SystemInformation::MousePresent; + label5->Text = "SystemInformation::MouseButtons: {0}",SystemInformation::MouseButtons; + label6->Text = "SystemInformation::MouseButtonsSwapped: {0}",SystemInformation::MouseButtonsSwapped; + label7->Text = "SystemInformation::MouseWheelPresent: {0}",SystemInformation::MouseWheelPresent; + label8->Text = "SystemInformation::MouseWheelScrollLines: {0}",SystemInformation::MouseWheelScrollLines; + label9->Text = "SystemInformation::NativeMouseWheelSupport: {0}",SystemInformation::NativeMouseWheelSupport; + // + } + + // + private: + void panel1_MouseDown( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Update the mouse path with the mouse information + Point mouseDownLocation = Point(e->X,e->Y); + String^ eventString = nullptr; + switch ( e->Button ) + { + case ::MouseButtons::Left: + eventString = "L"; + break; + + case ::MouseButtons::Right: + eventString = "R"; + break; + + case ::MouseButtons::Middle: + eventString = "M"; + break; + + case ::MouseButtons::XButton1: + eventString = "X1"; + break; + + case ::MouseButtons::XButton2: + eventString = "X2"; + break; + + case ::MouseButtons::None: + default: + break; + } + if ( eventString != nullptr ) + { + mousePath->AddString( eventString, FontFamily::GenericSerif, (int)FontStyle::Bold, (float)fontSize, mouseDownLocation, StringFormat::GenericDefault ); + } + else + { + mousePath->AddLine( mouseDownLocation, mouseDownLocation ); + } + + panel1->Focus(); + panel1->Invalidate(); + } + // + + // + void panel1_MouseEnter( Object^ sender, System::EventArgs^ /*e*/ ) + { + + // Update the mouse event label to indicate the MouseEnter event occurred. + label1->Text = String::Concat( sender->GetType(), ": MouseEnter" ); + } + + void panel1_MouseHover( Object^ sender, System::EventArgs^ /*e*/ ) + { + + // Update the mouse event label to indicate the MouseHover event occurred. + label1->Text = String::Concat( sender->GetType(), ": MouseHover" ); + } + + void panel1_MouseLeave( Object^ sender, System::EventArgs^ /*e*/ ) + { + + // Update the mouse event label to indicate the MouseLeave event occurred. + label1->Text = String::Concat( sender->GetType(), ": MouseLeave" ); + } + + void panel1_MouseMove( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Update the mouse path that is drawn onto the Panel. + int mouseX = e->X; + int mouseY = e->Y; + mousePath->AddLine( mouseX, mouseY, mouseX, mouseY ); + } + // + + // + void panel1_MouseWheel( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + // Update the drawing based upon the mouse wheel scrolling. + int numberOfTextLinesToMove = e->Delta * SystemInformation::MouseWheelScrollLines / 120; + int numberOfPixelsToMove = numberOfTextLinesToMove * fontSize; + if ( numberOfPixelsToMove != 0 ) + { + System::Drawing::Drawing2D::Matrix^ translateMatrix = gcnew System::Drawing::Drawing2D::Matrix; + translateMatrix->Translate( 0, (float)numberOfPixelsToMove ); + mousePath->Transform(translateMatrix); + } + + panel1->Invalidate(); + } + // + + // + void panel1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + Point mouseUpLocation = System::Drawing::Point( e->X, e->Y ); + + // Show the number of clicks in the path graphic. + int numberOfClicks = e->Clicks; + mousePath->AddString( String::Format( " {0}", numberOfClicks ), FontFamily::GenericSerif, (int)FontStyle::Bold, (float)fontSize, mouseUpLocation, StringFormat::GenericDefault ); + panel1->Invalidate(); + } + // + + void panel1_Paint( Object^ /*sender*/, System::Windows::Forms::PaintEventArgs^ e ) + { + // Perform the painting of the Panel. + e->Graphics->DrawPath( System::Drawing::Pens::DarkRed, mousePath ); + } + + void clearButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Clear the Panel display. + delete mousePath; + mousePath = gcnew System::Drawing::Drawing2D::GraphicsPath; + panel1->Invalidate(); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew MouseEvent::Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp new file mode 100644 index 00000000000..dd14e075298 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIcon/CPP/source.cpp @@ -0,0 +1,95 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::NotifyIcon^ notifyIcon1; + System::Windows::Forms::ContextMenu^ contextMenu1; + System::Windows::Forms::MenuItem^ menuItem1; + System::ComponentModel::IContainer^ components; + +public: + Form1() + { + this->components = gcnew System::ComponentModel::Container; + this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu; + this->menuItem1 = gcnew System::Windows::Forms::MenuItem; + + // Initialize contextMenu1 + array^temp0 = {this->menuItem1}; + this->contextMenu1->MenuItems->AddRange( temp0 ); + + // Initialize menuItem1 + this->menuItem1->Index = 0; + this->menuItem1->Text = "E&xit"; + this->menuItem1->Click += gcnew System::EventHandler( this, &Form1::menuItem1_Click ); + + // Set up how the form should be displayed. + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Text = "Notify Icon Example"; + + // Create the NotifyIcon. + this->notifyIcon1 = gcnew System::Windows::Forms::NotifyIcon( this->components ); + + // The Icon property sets the icon that will appear + // in the systray for this application. + notifyIcon1->Icon = gcnew System::Drawing::Icon( "appicon.ico" ); + + // The ContextMenu property sets the menu that will + // appear when the systray icon is right clicked. + notifyIcon1->ContextMenu = this->contextMenu1; + + // The Text property sets the text that will be displayed, + // in a tooltip, when the mouse hovers over the systray icon. + notifyIcon1->Text = "Form1 (NotifyIcon example)"; + notifyIcon1->Visible = true; + + // Handle the DoubleClick event to activate the form. + notifyIcon1->DoubleClick += gcnew System::EventHandler( this, &Form1::notifyIcon1_DoubleClick ); + } + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void notifyIcon1_DoubleClick( Object^ /*Sender*/, EventArgs^ /*e*/ ) + { + + // Show the form when the user double clicks on the notify icon. + // Set the WindowState to normal if the form is minimized. + if ( this->WindowState == FormWindowState::Minimized ) + this->WindowState = FormWindowState::Normal; + + // Activate the form. + this->Activate(); + } + + void menuItem1_Click( Object^ /*Sender*/, EventArgs^ /*e*/ ) + { + + // Close the form, which closes the application. + this->Close(); + } + +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp new file mode 100644 index 00000000000..c1143749b08 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.NotifyIconExample/CPP/form1.cpp @@ -0,0 +1,98 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeContextMenu(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::NotifyIcon^ NotifyIcon1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( Form1::typeid ); + this->NotifyIcon1 = gcnew System::Windows::Forms::NotifyIcon( this->components ); + + // + //NotifyIcon1 + // + this->NotifyIcon1->Icon = System::Drawing::SystemIcons::Asterisk; + this->NotifyIcon1->Text = "NotifyIcon1"; + this->NotifyIcon1->Visible = true; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + // + // Initialize the NofifyIcon object's shortcut menu. + void InitializeContextMenu() + { + array^menuList = {gcnew MenuItem( "Sign In" ),gcnew MenuItem( "Get Help" ),gcnew MenuItem( "Open" )}; + System::Windows::Forms::ContextMenu^ clickMenu = gcnew System::Windows::Forms::ContextMenu( menuList ); + NotifyIcon1->ContextMenu = clickMenu; + + // Associate the event-handling method with + // the NotifyIcon object's click event. + NotifyIcon1->Click += gcnew System::EventHandler( this, &Form1::NotifyIcon1_Click ); + } + + // When user clicks the left mouse button display the shortcut menu. + // Use the SystemInformation.PrimaryMonitorMaximizedWindowSize property + // to place the menu at the lower corner of the screen. + void NotifyIcon1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + System::Drawing::Size windowSize = SystemInformation::PrimaryMonitorMaximizedWindowSize; + System::Drawing::Point menuPoint = System::Drawing::Point( windowSize.Width - 180, windowSize.Height - 5 ); + menuPoint = this->PointToClient( menuPoint ); + NotifyIcon1->ContextMenu->Show( this, menuPoint ); + } + // +}; + + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp new file mode 100644 index 00000000000..dba128e902e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.OSFeature.IsPresent/CPP/form1.cpp @@ -0,0 +1,103 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +// + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + + if ( components != nullptr ) + { + delete components; + } + + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ){} + + // + // Gets the caret width based upon the operating system or default value. + int GetCaretWidth() + { + // Check to see if the operating system supports the caret width metric. + if ( OSFeature::Feature->IsPresent( SystemParameter::CaretWidthMetric ) ) + { + // If the operating system supports this metric, + // return the value for the caret width metric. + return SystemInformation::CaretWidth; + } + else + 1; + + // If the operating system does not support this metric, + // return a custom default value for the caret width. + } + // +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp new file mode 100644 index 00000000000..02c8c440486 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PageSetupDialogExample/CPP/form1.cpp @@ -0,0 +1,124 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::PageSetupDialog^ PageSetupDialog1; + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::ListBox^ ListBox1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->PageSetupDialog1 = gcnew System::Windows::Forms::PageSetupDialog; + this->Button1 = gcnew System::Windows::Forms::Button; + this->ListBox1 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 104, 24 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 88, 40 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Modify page settings"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //ListBox1 + // + this->ListBox1->Dock = System::Windows::Forms::DockStyle::Bottom; + this->ListBox1->Location = System::Drawing::Point( 0, 106 ); + this->ListBox1->Name = "ListBox1"; + this->ListBox1->Size = System::Drawing::Size( 292, 160 ); + this->ListBox1->TabIndex = 1; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->ListBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + //This method displays a PageSetupDialog object. If the + // user clicks OK in the dialog, selected results of + // the dialog are displayed in ListBox1. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Initialize the dialog's PrinterSettings property to hold user + // defined printer settings. + PageSetupDialog1->PageSettings = gcnew System::Drawing::Printing::PageSettings; + + // Initialize dialog's PrinterSettings property to hold user + // set printer settings. + PageSetupDialog1->PrinterSettings = gcnew System::Drawing::Printing::PrinterSettings; + + //Do not show the network in the printer dialog. + PageSetupDialog1->ShowNetwork = false; + + //Show the dialog storing the result. + System::Windows::Forms::DialogResult result = PageSetupDialog1->ShowDialog(); + + // If the result is OK, display selected settings in + // ListBox1. These values can be used when printing the + // document. + if ( result == ::DialogResult::OK ) + { + array^results = {PageSetupDialog1->PageSettings->Margins,PageSetupDialog1->PageSettings->PaperSize,PageSetupDialog1->PageSettings->Landscape,PageSetupDialog1->PrinterSettings->PrinterName,PageSetupDialog1->PrinterSettings->PrintRange}; + ListBox1->Items->AddRange( results ); + } + + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp new file mode 100644 index 00000000000..500deda2bdf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PlaySync/CPP/system.windows.forms.sound.playasync.cpp @@ -0,0 +1,103 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::Media; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +public: + + /// + /// Clean up any resources being used. + /// + + ~Form1() + { + + + } + + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + + Player = gcnew SoundPlayer(); + this->Player->LoadCompleted += gcnew System::ComponentModel::AsyncCompletedEventHandler( this, &Form1::Player_LoadCompleted ); + } + + + + /// + /// The main entry point for the application. + /// + // +private: + SoundPlayer^ Player; + + void loadSoundAsync() + { + // Note: You may need to change the location specified based on + // the location of the sound to be played. + this->Player->SoundLocation = "http://www.tailspintoys.com/sounds/stop.wav"; + this->Player->LoadAsync(); + } + + void Player_LoadCompleted( Object^ /*sender*/, System::ComponentModel::AsyncCompletedEventArgs^ /*e*/ ) + { + if (this->Player->IsLoadCompleted) + { + this->Player->PlaySync(); + } + } + // +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp new file mode 100644 index 00000000000..185642af0cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintDialogExample/CPP/form1.cpp @@ -0,0 +1,140 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + docToPrint = gcnew System::Drawing::Printing::PrintDocument; + docToPrint->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler( this, &Form1::document_PrintPage ); + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::PrintDialog^ PrintDialog1; + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->PrintDialog1 = gcnew System::Windows::Forms::PrintDialog; + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 104, 104 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Print"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Declare the PrintDocument object. + System::Drawing::Printing::PrintDocument^ docToPrint; + + // This method will set properties on the PrintDialog object and + // then display the dialog. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Allow the user to choose the page range he or she would + // like to print. + PrintDialog1->AllowSomePages = true; + + // Show the help button. + PrintDialog1->ShowHelp = true; + + // Set the Document property to the PrintDocument for + // which the PrintPage Event has been handled. To display the + // dialog, either this property or the PrinterSettings property + // must be set + PrintDialog1->Document = docToPrint; + if ( docToPrint == nullptr ) + System::Windows::Forms::MessageBox::Show( "null" ); + + ; + ; + if ( PrintDialog1 == nullptr ) + System::Windows::Forms::MessageBox::Show( "pnull" ); + + ; + ; + System::Windows::Forms::DialogResult result = PrintDialog1->ShowDialog(); + System::Windows::Forms::MessageBox::Show( result.ToString() ); + ; + ; + + // If the result is OK then print the document. + if ( result == ::DialogResult::OK ) + { + docToPrint->Print(); + } + + } + + // The PrintDialog will print the document + // by handling the document's PrintPage event. + void document_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^ e ) + { + // Insert code to render the page here. + // This code will be called when the control is drawn. + // The following code will render a simple + // message on the printed document. + String^ text = "In document_PrintPage method."; + System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,System::Drawing::FontStyle::Regular ); + + // Draw the content. + e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 10, 10 ); + } + // +}; + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp new file mode 100644 index 00000000000..afd183a9dd1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PrintPreviewControlExample/CPP/form1.cpp @@ -0,0 +1,124 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + docToPrint = gcnew System::Drawing::Printing::PrintDocument; + InitializePrintPreviewControl(); + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::PrintDialog^ PrintDialog1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->PrintDialog1 = gcnew System::Windows::Forms::PrintDialog; + this->SuspendLayout(); + + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + + // +internal: + // Declare the PrintPreviewControl object and the + // PrintDocument object. + PrintPreviewControl^ PrintPreviewControl1; + +private: + System::Drawing::Printing::PrintDocument^ docToPrint; + void InitializePrintPreviewControl() + { + // Construct the PrintPreviewControl. + this->PrintPreviewControl1 = gcnew PrintPreviewControl; + + // Set location, name, and dock style for PrintPreviewControl1. + this->PrintPreviewControl1->Location = Point(88,80); + this->PrintPreviewControl1->Name = "PrintPreviewControl1"; + this->PrintPreviewControl1->Dock = DockStyle::Fill; + + // Set the Document property to the PrintDocument + // for which the PrintPage event has been handled. + this->PrintPreviewControl1->Document = docToPrint; + + // Set the zoom to 25 percent. + this->PrintPreviewControl1->Zoom = 0.25; + + // Set the document name. This will show be displayed when + // the document is loading into the control. + this->PrintPreviewControl1->Document->DocumentName = "c:\\someFile"; + + // Set the UseAntiAlias property to true so fonts are smoothed + // by the operating system. + this->PrintPreviewControl1->UseAntiAlias = true; + + // Add the control to the form. + this->Controls->Add( this->PrintPreviewControl1 ); + + // Associate the event-handling method with the + // document's PrintPage event. + this->docToPrint->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler( this, &Form1::docToPrint_PrintPage ); + } + + // The PrintPreviewControl will display the document + // by handling the documents PrintPage event + void docToPrint_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^ e ) + { + // Insert code to render the page here. + // This code will be called when the control is drawn. + // The following code will render a simple + // message on the document in the control. + String^ text = "In docToPrint_PrintPage method."; + System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,FontStyle::Regular ); + e->Graphics->DrawString( text, printFont, Brushes::Black, 10, 10 ); + } + // +}; + + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp new file mode 100644 index 00000000000..b51b48f5c31 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProcessMnemonic/CPP/form1.cpp @@ -0,0 +1,103 @@ + + +#using +#using +#using + +// +using namespace System::Windows::Forms; + +// +// This button is a simple extension of the button class that overrides +// the ProcessMnemonic method. If the mnemonic is correctly entered, +// the message box will appear and the click event will be raised. +// This method makes sure the control is selectable and the +// mnemonic is correct before displaying the message box +// and triggering the click event. +public ref class MyMnemonicButton: public Button +{ +protected: + bool ProcessMnemonic( char inputChar ) + { + if ( CanSelect && IsMnemonic( inputChar, this->Text ) ) + { + MessageBox::Show( "You've raised the click event " + "using the mnemonic." ); + this->PerformClick(); + return true; + } + + return false; + } + +}; + + +// +// Declare the controls contained on the form. +public ref class Form1: public System::Windows::Forms::Form +{ +private: + MyMnemonicButton^ button1; + +public private: + System::Windows::Forms::ListBox^ ListBox1; + +public: + Form1() + : Form() + { + + // Set KeyPreview object to true to allow the form to process + // the key before the control with focus processes it. + this->KeyPreview = true; + + // Add a MyMnemonicButton. + button1 = gcnew MyMnemonicButton; + button1->Text = "&Click"; + button1->Location = System::Drawing::Point( 100, 120 ); + this->Controls->Add( button1 ); + + // Initialize a ListBox control and the form itself. + this->ListBox1 = gcnew System::Windows::Forms::ListBox; + this->SuspendLayout(); + this->ListBox1->Location = System::Drawing::Point( 8, 8 ); + this->ListBox1->Name = "ListBox1"; + this->ListBox1->Size = System::Drawing::Size( 120, 95 ); + this->ListBox1->TabIndex = 0; + this->ListBox1->Text = "Press a key"; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->ListBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + + // Associate the event-handling method with the + // KeyDown event. + this->KeyDown += gcnew KeyEventHandler( this, &Form1::Form1_KeyDown ); + } + + +private: + + // The form will handle all key events before the control with + // focus handles them. Show the keys pressed by adding the + // KeyCode object to ListBox1. Ensure the processing is passed + // to the control with focus by setting the KeyEventArg.Handled + // property to false. + void Form1_KeyDown( Object^ /*sender*/, KeyEventArgs^ e ) + { + ListBox1->Items->Add( e->KeyCode ); + e->Handled = false; + } + +}; + + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..f0c6ee3b2c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ProgressBarRenderer/cpp/form1.cpp @@ -0,0 +1,227 @@ +// This sample can go in ProgressBarRenderer class overview. +// - Snippet2 can go in DrawVerticalBar and IsSupported +// - Snippet4 can go in ChunkSpaceThickness and ChunkThickness +// - Snippet6 can go in DrawVerticalChunks + +// This sample draws a vertical progress bar, something that the regular ProgressBar control +// cannot do. Because it draws a vertical bar, if visual styles aren't enabled, I simply +// don't draw a bar at all, instead of trying to expose a system ProgressBar control. +// The SetupProgressBar method uses the thickness defined by the current visual +// style to calculate the height of each rectangle. Note that the Y coordinate of +// each rectangle is near the bottom of the client rectangle and the height of +// each rectangle is negative, so the bar progresses upward. The size adjustments +// ensure that the chunks don't paint over the frame. + +// For simplicity, this sampel does not handle run-time switching of visual styles. + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace ProgressBarRendererSample +{ + public ref class VerticalProgressBar : public Control + { + private: + int numberChunksValue; + int ticks; + Timer^ progressTimer; + array^ progressBarRectangles; + + public: + VerticalProgressBar() : Control() + { + this->Location = Point(10, 10); + this->Width = 50; + progressTimer = gcnew Timer(); + + // The progress bar will update every second. + progressTimer->Interval = 1000; + progressTimer->Tick += gcnew EventHandler(this, + &VerticalProgressBar::progressTimer_Tick); + + // This property also calls SetupProgressBar to initialize + // the progress bar rectangles if styles are enabled. + NumberChunks = 20; + + // Set the default height if visual styles are not enabled. + if (!ProgressBarRenderer::IsSupported) + { + this->Height = 100; + } + } + + // Specify the number of progress bar chunks to base the height on. + public: + property int NumberChunks + { + int get() + { + return numberChunksValue; + } + + void set(int value) + { + if (value <= 50 && value > 0) + { + numberChunksValue = value; + } + else + { + MessageBox::Show("Number of chunks must be between " + + "0 and 50; defaulting to 10"); + numberChunksValue = 10; + } + + // Recalculate the progress bar size, if visual styles + // are active. + if (ProgressBarRenderer::IsSupported) + { + SetupProgressBar(); + } + } + } + + // + // Draw the progress bar in its normal state. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + if (ProgressBarRenderer::IsSupported) + { + ProgressBarRenderer::DrawVerticalBar(e->Graphics, + ClientRectangle); + this->Parent->Text = "VerticalProgressBar Enabled"; + } + else + { + this->Parent->Text = "VerticalProgressBar Disabled"; + } + } + // + + // + // Initialize the rectangles used to paint the states of the + // progress bar. + private: + void SetupProgressBar() + { + if (!ProgressBarRenderer::IsSupported) + { + return; + } + + // Determine the size of the progress bar frame. + this->Size = System::Drawing::Size(ClientRectangle.Width, + (NumberChunks * (ProgressBarRenderer::ChunkThickness + + (2 * ProgressBarRenderer::ChunkSpaceThickness))) + 6); + + // Initialize the rectangles to draw each step of the + // progress bar. + progressBarRectangles = gcnew array(NumberChunks); + + for (int i = 0; i < NumberChunks; i++) + { + // Use the thickness defined by the current visual style + // to calculate the height of each rectangle. The size + // adjustments ensure that the chunks do not paint over + // the frame. + + int filledRectangleHeight = + ((i + 1) * (ProgressBarRenderer::ChunkThickness + + (2 * ProgressBarRenderer::ChunkSpaceThickness))); + + progressBarRectangles[i] = Rectangle( + ClientRectangle.X + 3, + ClientRectangle.Y + ClientRectangle.Height - 3 + - filledRectangleHeight, + ClientRectangle.Width - 6, + filledRectangleHeight); + } + } + // + + // + // Handle the timer tick; draw each progressively larger rectangle. + private: + void progressTimer_Tick(Object^ myObject, EventArgs^ e) + { + if (ticks < NumberChunks) + { + Graphics^ g = this->CreateGraphics(); + ProgressBarRenderer::DrawVerticalChunks(g, + progressBarRectangles[ticks]); + ticks++; + } + else + { + progressTimer->Enabled = false; + } + } + // + + // Start the progress bar. + public: + void Start() + { + if (ProgressBarRenderer::IsSupported) + { + progressTimer->Start(); + } + else + { + MessageBox::Show("VerticalScrollBar requires visual styles"); + } + } + }; + + public ref class Form1 : public Form + { + private: + VerticalProgressBar^ bar1; + Button^ button1; + + public: + Form1() : Form() + { + this->Size = System::Drawing::Size(500, 500); + bar1 = gcnew VerticalProgressBar(); + bar1->NumberChunks = 30; + button1 = gcnew Button(); + button1->Location = Point(150, 10); + button1->Size = System::Drawing::Size(150, 30); + button1->Text = "Start VerticalProgressBar"; + button1->Click += gcnew EventHandler(this, &Form1::button1_Click); + Controls->AddRange(gcnew array { button1, bar1 }); + } + + // Start the VerticalProgressBar. + private: + void button1_Click(Object^ sender, EventArgs^ e) + { + bar1->Start(); + } + }; +} + + +[STAThread] +int main() +{ + // The call to EnableVisualStyles below does not affect + // whether ProgressBarRenderer.IsSupported is true; as + // long as visual styles are enabled by the operating system, + // IsSupported is true. + Application::EnableVisualStyles(); + Application::Run(gcnew ProgressBarRendererSample::Form1()); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp new file mode 100644 index 00000000000..c90c48049cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.PropertyGridExample/CPP/form1.cpp @@ -0,0 +1,144 @@ + + +#using +#using +#using + +// The following example combines some controls on +// a form with using a CheckedListBox and PropertyGrid. +// This method demonstrates the using the PropertyGrid.PropertySort, +// PropertyGrid.SelectedObjects, CheckedListBox.SelectionMode, +// and CheckListBox.ThreeDCheckBoxes, and CheckedListBox.CheckOnClick members. + +// +// This form combines uses a CheckedListBox and PropertyGrid to +// combine some controls. CheckedListBox1 is populated with itself +// and the other controls on the form. The user can then click Button1 +// to see the PropertyGrid for the selected controls. + +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +public ref class Form1: public System::Windows::Forms::Form +{ +internal: + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::Label ^ Label1; + System::Windows::Forms::Button^ Button1; + +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Label1 = gcnew System::Windows::Forms::Label; + this->Button1 = gcnew System::Windows::Forms::Button; + this->TextBox1->Location = System::Drawing::Point( 40, 20 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->TabIndex = 0; + this->TextBox1->Text = "TextBox1"; + this->Label1->Location = System::Drawing::Point( 40, 60 ); + this->Label1->Name = "Label1"; + this->Label1->TabIndex = 2; + this->Label1->Text = "Label1"; + this->Button1->Location = System::Drawing::Point( 40, 200 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 4; + this->Button1->Size = System::Drawing::Size( 100, 50 ); + this->Button1->Text = "Show properties for selected control(s)"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + this->ClientSize = System::Drawing::Size( 350, 350 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + InitializeCheckedListBox(); + InitializePropertyGrid(); + } + + // + // This method initializes CheckedListBox1 with a list of all + // the controls on the form. It sets the selection mode + // to single selection and allows selection with a single click. + // It adds itself to the list before adding itself to the form. +internal: + System::Windows::Forms::CheckedListBox^ CheckedListBox1; + +private: + void InitializeCheckedListBox() + { + this->CheckedListBox1 = gcnew CheckedListBox; + this->CheckedListBox1->Location = System::Drawing::Point( 40, 90 ); + this->CheckedListBox1->CheckOnClick = true; + this->CheckedListBox1->Name = "CheckedListBox1"; + this->CheckedListBox1->Size = System::Drawing::Size( 120, 94 ); + this->CheckedListBox1->TabIndex = 1; + this->CheckedListBox1->SelectionMode = SelectionMode::One; + this->CheckedListBox1->ThreeDCheckBoxes = true; + System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Control^ aControl = safe_cast(myEnum->Current); + this->CheckedListBox1->Items->Add( aControl, false ); + } + + this->CheckedListBox1->DisplayMember = "Name"; + this->CheckedListBox1->Items->Add( CheckedListBox1 ); + this->Controls->Add( this->CheckedListBox1 ); + } + // + + // + // Declare a propertyGrid. +internal: + PropertyGrid^ propertyGrid1; + +private: + + // Initialize propertyGrid1. + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + void InitializePropertyGrid() + { + propertyGrid1 = gcnew PropertyGrid; + propertyGrid1->Name = "PropertyGrid1"; + propertyGrid1->Location = System::Drawing::Point( 185, 20 ); + propertyGrid1->Size = System::Drawing::Size( 150, 300 ); + propertyGrid1->TabIndex = 5; + + // Set the sort to alphabetical and set Toolbar visible + // to false, so the user cannot change the sort. + propertyGrid1->PropertySort = PropertySort::Alphabetical; + propertyGrid1->ToolbarVisible = false; + propertyGrid1->Text = "Property Grid"; + + // Add the PropertyGrid to the form, but set its + // visibility to False so it will not appear when the form loads. + propertyGrid1->Visible = false; + this->Controls->Add( propertyGrid1 ); + } + // + + // Sets the SelectedObjects property of PropertyGrid1's + // SelectedObjects to the controls the user has selected in + // CheckedListBox1. + void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + propertyGrid1->Visible = true; + array^selectedControls = gcnew array(CheckedListBox1->CheckedItems->Count); + for ( int counter = 0; counter < CheckedListBox1->CheckedItems->Count; counter++ ) + { + selectedControls[ counter ] = dynamic_cast(CheckedListBox1->CheckedItems[ counter ]); + + } + propertyGrid1->SelectedObjects = selectedControls; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..18761cef505 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RadioButtonRenderer/cpp/form1.cpp @@ -0,0 +1,161 @@ +// This sample can go in RadioButtonRenderer class overview +// - Snippet2 can go in GetGlyphSize +// - Snippet4 can go in DrawRadioButton. +// - Snippet4 can also go in RadioButtonState enum, if necessary. + +// This sample mimics the RadioButton control. Might want to come up with a better +// customization sample that actually does something different from the RadioButton. + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace RadioButtonRendererSample +{ + public ref class CustomRadioButton : public Control + { + private: + Rectangle textRectangleValue; + private: + bool clicked; + private: + RadioButtonState state; + + public: + CustomRadioButton() : Control() + { + textRectangleValue = Rectangle(); + state = RadioButtonState::UncheckedNormal; + this->Location = Point(50, 50); + this->Size = System::Drawing::Size(100, 20); + this->Text = "Click here"; + this->Font = SystemFonts::IconTitleFont; + } + + // + // Define the text bounds so that the text rectangle + // does not include the radio button. + public: + property Rectangle TextRectangle + { + Rectangle get() + { + Graphics^ g = this->CreateGraphics(); + + textRectangleValue.X = ClientRectangle.X + + RadioButtonRenderer::GetGlyphSize(g, + RadioButtonState::UncheckedNormal).Width; + textRectangleValue.Y = ClientRectangle.Y; + textRectangleValue.Width = ClientRectangle.Width - + RadioButtonRenderer::GetGlyphSize(g, + RadioButtonState::UncheckedNormal).Width; + textRectangleValue.Height = ClientRectangle.Height; + + delete g; + + return textRectangleValue; + } + } + // + + // + // Draw the radio button in the current state. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + RadioButtonRenderer::DrawRadioButton(e->Graphics, + ClientRectangle.Location, TextRectangle, this->Text, + this->Font, clicked, state); + } + + // Draw the radio button in the checked or unchecked state. + protected: + virtual void OnMouseDown(MouseEventArgs^ e) override + { + __super::OnMouseDown(e); + + if (!clicked) + { + clicked = true; + this->Text = "Clicked!"; + state = RadioButtonState::CheckedPressed; + Invalidate(); + } + else + { + clicked = false; + this->Text = "Click here"; + state = RadioButtonState::UncheckedNormal; + Invalidate(); + } + } + // + + // Draw the radio button in the hot state. + protected: + virtual void OnMouseHover(EventArgs^ e) override + { + __super::OnMouseHover(e); + state = clicked ? RadioButtonState::CheckedHot : + RadioButtonState::UncheckedHot; + Invalidate(); + } + + // Draw the radio button in the hot state. + protected: + virtual void OnMouseUp(MouseEventArgs^ e) override + { + __super::OnMouseUp(e); + this->OnMouseHover(e); + } + + // Draw the radio button in the normal (i.e. not hot) state + protected: + virtual void OnMouseLeave(EventArgs^ e) override + { + __super::OnMouseLeave(e); + state = clicked ? RadioButtonState::CheckedNormal : + RadioButtonState::UncheckedNormal; + Invalidate(); + } + }; + + public ref class Form1 : public Form + { + public: + Form1() : Form() + { + Controls->Add(gcnew CustomRadioButton()); + + if (Application::RenderWithVisualStyles) + { + this->Text = "Visual Styles Enabled"; + } + else + { + this->Text = "Visual Styles Disabled"; + } + } + }; +} + +[STAThread] +int main() +{ + // If you do not call EnableVisualStyles below, then + // RadioButtonRenderer.DrawRadioButton automatically detects + // this and draws the radio button without visual styles. + Application::EnableVisualStyles(); + Application::Run(gcnew RadioButtonRendererSample::Form1()); +} +// + + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp new file mode 100644 index 00000000000..d026e56633a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RectangleToScreen/CPP/form1.cpp @@ -0,0 +1,170 @@ + + +#using +#using +#using + +// This example demonstrates using the following members: +// Form.BackColor, Control.RectangleToScreen, Control.PointToScreen, +// ControlPaint.DrawReversibleFrame, and Rectangle.Intersects. +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + // This call is required by the Windows Form Designer. + InitializeComponent(); + isDrag = false; + theRectangle = Rectangle(Point(0,0),System::Drawing::Size( 0, 0 )); + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + } + + +internal: + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Button^ Button2; + System::Windows::Forms::Label ^ Label1; + +private: + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Button2 = gcnew System::Windows::Forms::Button; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + this->Button1->Location = System::Drawing::Point( 40, 64 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 80, 50 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Click for a bigger form."; + this->Button2->Location = System::Drawing::Point( 144, 64 ); + this->Button2->Name = "Button2"; + this->Button2->Size = System::Drawing::Size( 72, 48 ); + this->Button2->TabIndex = 1; + this->Button2->Text = "Click me and nothing happens."; + this->Label1->Location = System::Drawing::Point( 72, 168 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 152, 32 ); + this->Label1->TabIndex = 2; + this->Label1->Text = "Click and drag on screen to see a frame drawn."; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + + // Explicitly set the form's BackColor property. + this->BackColor = Color::Cornsilk; + this->ResumeLayout( false ); + + // Associate the event-handling methods with the appropriate + // event. + this->MouseDown += gcnew MouseEventHandler( this, &Form1::Form1_MouseDown ); + this->MouseMove += gcnew MouseEventHandler( this, &Form1::Form1_MouseMove ); + this->MouseUp += gcnew MouseEventHandler( this, &Form1::Form1_MouseUp ); + } + + // +private: + // This method retrieves the form's client rectangle, inflates it, + // and forces layout of the form by resetting the bounds. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + Rectangle clientRectangle = this->ClientRectangle; + clientRectangle.Inflate( 50, 50 ); + + // Convert the rectangle coordinates to screen coordinates. + this->Bounds = this->RectangleToScreen( clientRectangle ); + } + // + + // +private: + // The following three methods will draw a rectangle and allow + // the user to use the mouse to resize the rectangle. If the + // rectangle intersects a control's client rectangle, the + // control's color will change. + bool isDrag; + Rectangle theRectangle; + Point startPoint; + void Form1_MouseDown( Object^ sender, System::Windows::Forms::MouseEventArgs^ e ) + { + + // Set the isDrag variable to true and get the starting point + // by using the PointToScreen method to convert form + // coordinates to screen coordinates. + if ( e->Button == ::MouseButtons::Left ) + { + isDrag = true; + } + + Control^ control = dynamic_cast(sender); + + // Calculate the startPoint by using the PointToScreen + // method. + startPoint = control->PointToScreen( Point(e->X,e->Y) ); + } + + void Form1_MouseMove( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ e ) + { + + // If the mouse is being dragged, + // undraw and redraw the rectangle as the mouse moves. + if ( isDrag ) + { + ControlPaint::DrawReversibleFrame( theRectangle, this->BackColor, FrameStyle::Dashed ); + + // Calculate the endpoint and dimensions for the new + // rectangle, again using the PointToScreen method. + Point endPoint = this->PointToScreen( Point(e->X,e->Y) ); + int width = endPoint.X - startPoint.X; + int height = endPoint.Y - startPoint.Y; + theRectangle = Rectangle(startPoint.X,startPoint.Y,width,height); + + // Draw the new rectangle by calling DrawReversibleFrame + // again. + ControlPaint::DrawReversibleFrame( theRectangle, this->BackColor, FrameStyle::Dashed ); + } + } + + void Form1_MouseUp( Object^ /*sender*/, System::Windows::Forms::MouseEventArgs^ /*e*/ ) + { + + // If the MouseUp event occurs, the user is not dragging. + isDrag = false; + + // Draw the rectangle to be evaluated. Set a dashed frame style + // using the FrameStyle enumeration. + ControlPaint::DrawReversibleFrame( theRectangle, this->BackColor, FrameStyle::Dashed ); + + // Find out which controls intersect the rectangle and + // change their color. The method uses the RectangleToScreen + // method to convert the Control's client coordinates + // to screen coordinates. + Rectangle controlRectangle; + for ( int i = 0; i < Controls->Count; i++ ) + { + controlRectangle = Controls[ i ]->RectangleToScreen( Controls[ i ]->ClientRectangle ); + if ( controlRectangle.IntersectsWith( theRectangle ) ) + { + Controls[ i ]->BackColor = Color::BurlyWood; + } + + } + + // Reset the rectangle. + theRectangle = Rectangle(0,0,0,0); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp new file mode 100644 index 00000000000..7f49035f432 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxGetLine/CPP/form1.cpp @@ -0,0 +1,160 @@ + + +#using +#using +#using + +// The following example demonstrates using the +// RichTextBox.GetLineFromCharIndex method. +using namespace System::Windows::Forms; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::RichTextBox^ RichTextBox1; + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::TextBox^ TextBox2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->TextBox2 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 40, 32 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 80, 40 ); + this->Button1->TabIndex = 1; + this->Button1->Text = "Find line numbers."; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //RichTextBox1 + // + this->RichTextBox1->Location = System::Drawing::Point( 40, 88 ); + this->RichTextBox1->Name = "RichTextBox1"; + this->RichTextBox1->TabIndex = 2; + this->RichTextBox1->Text = "This text will contain name several times." + "Here is name again, and again: name"; + + // + //TextBox1 + // + this->TextBox1->Location = System::Drawing::Point( 168, 104 ); + this->TextBox1->Multiline = true; + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 88, 64 ); + this->TextBox1->TabIndex = 3; + this->TextBox1->Text = ""; + + // + //TextBox2 + // + this->TextBox2->Location = System::Drawing::Point( 152, 48 ); + this->TextBox2->Name = "TextBox2"; + this->TextBox2->TabIndex = 4; + this->TextBox2->Text = "name"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->TextBox2 ); + this->Controls->Add( this->TextBox1 ); + this->Controls->Add( this->RichTextBox1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // This method demonstrates retrieving line numbers that + // indicate the location of a particular word + // contained in a RichTextBox. The line numbers are zero-based. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Reset the results box. + TextBox1->Text = ""; + + // Get the word to search from from TextBox2. + String^ searchWord = TextBox2->Text; + int index = 0; + + //Declare an ArrayList to store line numbers. + System::Collections::ArrayList^ lineList = gcnew System::Collections::ArrayList; + do + { + // Find occurrences of the search word, incrementing + // the start index. + index = RichTextBox1->Find( searchWord, index + 1, RichTextBoxFinds::MatchCase ); + if ( index != -1 ) + { + lineList->Add( RichTextBox1->GetLineFromCharIndex( index ) ); + } + } + while ( (index != -1) ); + + // Iterate through the list and display the line numbers in TextBox1. + System::Collections::IEnumerator^ myEnumerator = lineList->GetEnumerator(); + if ( lineList->Count <= 0 ) + { + TextBox1->Text = searchWord + " was not found"; + } + else + { + TextBox1->SelectedText = searchWord + " was found on line(s):"; + while ( myEnumerator->MoveNext() ) + { + TextBox1->SelectedText = myEnumerator->Current + " "; + } + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp new file mode 100644 index 00000000000..9e696539fba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.RichTextBoxSaveFile/CPP/form1.cpp @@ -0,0 +1,129 @@ +#using +#using +#using +#using + +// The following code example demonstrates using the +// RichTextBox1.SaveFile and RichTextBox.LoadFile methods with streams. +// It also demonstrates using the FileDialog.FileName, +// SaveFileDialog.CreatePrompt, SaveFileDialog.OverwritePrompt, and +// TextBox.Click members. +// +using namespace System; +using namespace System::Drawing; +using namespace System::IO; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +public private: + RichTextBox^ RichTextBox1; + Button^ Button1; + RichTextBox^ RichTextBox2; + Button^ Button2; + SaveFileDialog^ SaveFileDialog1; + +public: + Form1() + : Form() + { + userInput = gcnew MemoryStream; + this->RichTextBox1 = gcnew RichTextBox; + this->Button1 = gcnew Button; + this->RichTextBox2 = gcnew RichTextBox; + this->Button2 = gcnew Button; + this->SaveFileDialog1 = gcnew SaveFileDialog; + this->SuspendLayout(); + this->RichTextBox1->Location = Point( 24, 64 ); + this->RichTextBox1->Name = "RichTextBox1"; + this->RichTextBox1->TabIndex = 0; + this->RichTextBox1->Text = "Type something here."; + this->Button1->Location = Point( 96, 16 ); + this->Button1->Name = "Button1"; + this->Button1->Size = Size( 96, 24 ); + this->Button1->TabIndex = 1; + this->Button1->Text = "Save To Stream"; + this->Button1->Click += + gcnew EventHandler( this, &Form1::Button1_Click ); + this->RichTextBox2->Location = Point( 152, 64 ); + this->RichTextBox2->Name = "RichTextBox2"; + this->RichTextBox2->TabIndex = 3; + this->RichTextBox2->Text = "It will be added to the stream " + "and appear here."; + this->Button2->Location = Point( 104, 200 ); + this->Button2->Name = "Button2"; + this->Button2->Size = Size( 88, 32 ); + this->Button2->TabIndex = 4; + this->Button2->Text = "Save Stream To File"; + this->Button2->Click += + gcnew EventHandler( this, &Form1::Button2_Click ); + this->ClientSize = Size( 292, 266 ); + this->Controls->Add( this->Button2 ); + this->Controls->Add( this->RichTextBox2 ); + this->Controls->Add( this->Button1 ); + this->Controls->Add( this->RichTextBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // Declare a new memory stream. + MemoryStream^ userInput; + +private: + + // Save the content of RichTextBox1 to the memory stream, + // appending a LineFeed character. + void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + RichTextBox1->SaveFile( userInput, RichTextBoxStreamType::PlainText ); + userInput->WriteByte( 13 ); + + // Display the entire contents of the stream, + // by setting its position to 0, to RichTextBox2. + userInput->Position = 0; + RichTextBox2->LoadFile( userInput, RichTextBoxStreamType::PlainText ); + } + + + // Shows the use of a SaveFileDialog to save a MemoryStream to a file. + void Button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Set the properties on SaveFileDialog1 so the user is + // prompted to create the file if it doesn't exist + // or overwrite the file if it does exist. + SaveFileDialog1->CreatePrompt = true; + SaveFileDialog1->OverwritePrompt = true; + + // Set the file name to myText.txt, set the type filter + // to text files, and set the initial directory to the + // MyDocuments folder. + SaveFileDialog1->FileName = "myText"; + // DefaultExt is only used when "All files" is selected from + // the filter box and no extension is specified by the user. + SaveFileDialog1->DefaultExt = "txt"; + SaveFileDialog1->Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*"; + SaveFileDialog1->InitialDirectory = + Environment->GetFolderPath(Environment::SpecialFolder::MyDocuments); + + // Call ShowDialog and check for a return value of DialogResult.OK, + // which indicates that the file was saved. + DialogResult result = SaveFileDialog1->ShowDialog(); + Stream^ fileStream; + if ( result == DialogResult::OK ) + { + fileStream = SaveFileDialog1->OpenFile(); + userInput->Position = 0; + userInput->WriteTo( fileStream ); + fileStream->Close(); + } + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp new file mode 100644 index 00000000000..ffadecad709 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScreenExample/CPP/form1.cpp @@ -0,0 +1,95 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 112, 32 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "Resize form"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // This method will adjust the size of the form to utilize + // the working area of the screen. +private: + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Retrieve the working rectangle from the Screen class + // using the PrimaryScreen and the WorkingArea properties. + System::Drawing::Rectangle workingRectangle = Screen::PrimaryScreen->WorkingArea; + + // Set the size of the form slightly less than size of + // working rectangle. + this->Size = System::Drawing::Size( workingRectangle.Width - 10, workingRectangle.Height - 10 ); + + // Set the location so the entire form is visible. + this->Location = System::Drawing::Point( 5, 5 ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..39977831372 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarRenderer/cpp/form1.cpp @@ -0,0 +1,421 @@ +// This sample can go in ScrollBarRenderer class overview. +// - Snippet2 can go in IsSupported, DrawRightHorizontalTrack, +// DrawHorizontalThumb, DrawHorizontalThumbGrip, DrawArrowButton, +// and, if necessary, ScrollBarState and ScrollBarArrowButtonState enums. + +// This sample simulates a horizontal scroll bar. +// For simplicity, this sample does not handle runtime +// switching of visual styles. + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace ScrollBarRendererSample +{ + public ref class CustomScrollBar : public Control + { + private: + Rectangle clickedBarRectangle; + private: + Rectangle thumbRectangle; + private: + Rectangle leftArrowRectangle; + private: + Rectangle rightArrowRectangle; + private: + bool leftArrowClicked; + private: + bool rightArrowClicked; + private: + bool leftBarClicked; + private: + bool rightBarClicked; + private: + bool thumbClicked; + private: + ScrollBarState thumbState; + private: + ScrollBarArrowButtonState leftButtonState; + private: + ScrollBarArrowButtonState rightButtonState; + private: + int thumbWidth; + private: + int arrowWidth; + + // The right limit of the thumb's right border. + private: + int thumbRightLimitRight; + + // The right limit of the thumb's left border. + private: + int thumbRightLimitLeft; + + // The left limit of thumb's left border. + private: + int thumbLeftLimit; + + // The distance from the left edge of the thumb to the + // cursor tip. + private: + int thumbPosition; + + // The distance from the left edge of the scroll bar track + // to the cursor tip. + private: + int trackPosition; + + // This timer draws the moving thumb while the scroll arrows or + // track are pressed. + private: + Timer^ progressTimer; + + public: + CustomScrollBar() : Control() + { + thumbState = ScrollBarState::Normal; + leftButtonState = ScrollBarArrowButtonState::LeftNormal; + rightButtonState = ScrollBarArrowButtonState::RightNormal; + + // This control does not allow these widths to be altered. + thumbWidth = 15; + arrowWidth = 17; + + progressTimer = gcnew Timer(); + this->Location = Point(10, 10); + this->Width = 200; + this->Height = 20; + this->DoubleBuffered = true; + + SetUpScrollBar(); + progressTimer->Interval = 20; + progressTimer->Tick += + gcnew EventHandler(this, &CustomScrollBar::progressTimer_Tick); + } + + // Calculate the sizes of the scroll bar elements. + private: + void SetUpScrollBar() + { + clickedBarRectangle = ClientRectangle; + thumbRectangle = Rectangle( + ClientRectangle.X + ClientRectangle.Width / 2, + ClientRectangle.Y, thumbWidth, + ClientRectangle.Height); + leftArrowRectangle = Rectangle( + ClientRectangle.X, ClientRectangle.Y, + arrowWidth, ClientRectangle.Height); + rightArrowRectangle = Rectangle( + ClientRectangle.Right - arrowWidth, + ClientRectangle.Y, arrowWidth, + ClientRectangle.Height); + + // Set the default starting thumb position. + thumbPosition = thumbWidth / 2; + + // Set the right limit of the thumb's right border. + thumbRightLimitRight = ClientRectangle.Right - arrowWidth; + + // Set the right limit of the thumb's left border. + thumbRightLimitLeft = thumbRightLimitRight - thumbWidth; + + // Set the left limit of the thumb's left border. + thumbLeftLimit = ClientRectangle.X + arrowWidth; + } + + // + // Draw the scroll bar in its normal state. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + // Visual styles are not enabled. + if (!ScrollBarRenderer::IsSupported) + { + this->Parent->Text = "CustomScrollBar Disabled"; + return; + } + + this->Parent->Text = "CustomScrollBar Enabled"; + + // Draw the scroll bar track. + ScrollBarRenderer::DrawRightHorizontalTrack(e->Graphics, + ClientRectangle, ScrollBarState::Normal); + + // Draw the thumb and thumb grip in the current state. + ScrollBarRenderer::DrawHorizontalThumb(e->Graphics, + thumbRectangle, thumbState); + ScrollBarRenderer::DrawHorizontalThumbGrip(e->Graphics, + thumbRectangle, thumbState); + + // Draw the scroll arrows in the current state. + ScrollBarRenderer::DrawArrowButton(e->Graphics, + leftArrowRectangle, leftButtonState); + ScrollBarRenderer::DrawArrowButton(e->Graphics, + rightArrowRectangle, rightButtonState); + + // Draw a highlighted rectangle in the left side of the scroll + // bar track if the user has clicked between the left arrow + // and thumb. + if (leftBarClicked) + { + clickedBarRectangle.X = thumbLeftLimit; + clickedBarRectangle.Width = thumbRectangle.X - thumbLeftLimit; + ScrollBarRenderer::DrawLeftHorizontalTrack(e->Graphics, + clickedBarRectangle, ScrollBarState::Pressed); + } + + // Draw a highlighted rectangle in the right side of the scroll + // bar track if the user has clicked between the right arrow + // and thumb. + else if (rightBarClicked) + { + clickedBarRectangle.X = + thumbRectangle.X + thumbRectangle.Width; + clickedBarRectangle.Width = + thumbRightLimitRight - clickedBarRectangle.X; + ScrollBarRenderer::DrawRightHorizontalTrack(e->Graphics, + clickedBarRectangle, ScrollBarState::Pressed); + } + } + // + + // Handle a mouse click in the scroll bar. + protected: + virtual void OnMouseDown(MouseEventArgs^ e) override + { + __super::OnMouseDown(e); + + if (!ScrollBarRenderer::IsSupported) + { + return; + } + + // When the thumb is clicked, update the distance from the left + // edge of the thumb to the cursor tip. + if (thumbRectangle.Contains(e->Location)) + { + thumbClicked = true; + thumbPosition = e->Location.X - thumbRectangle.X; + thumbState = ScrollBarState::Pressed; + } + + // When the left arrow is clicked, start the timer to scroll + // while the arrow is held down. + else if (leftArrowRectangle.Contains(e->Location)) + { + leftArrowClicked = true; + leftButtonState = ScrollBarArrowButtonState::LeftPressed; + progressTimer->Start(); + } + + // When the right arrow is clicked, start the timer to scroll + // while the arrow is held down. + else if (rightArrowRectangle.Contains(e->Location)) + { + rightArrowClicked = true; + rightButtonState = ScrollBarArrowButtonState::RightPressed; + progressTimer->Start(); + } + + // When the scroll bar is clicked, start the timer to move the + // thumb while the mouse is held down. + else + { + trackPosition = e->Location.X; + + if (e->Location.X < this->thumbRectangle.X) + { + leftBarClicked = true; + } + else + { + rightBarClicked = true; + } + progressTimer->Start(); + } + + Invalidate(); + } + + // Draw the track. + protected: + virtual void OnMouseUp(MouseEventArgs^ e) override + { + __super::OnMouseUp(e); + + if (!ScrollBarRenderer::IsSupported) + { + return; + } + + // Update the thumb position, if the new location is within + // the bounds. + if (thumbClicked) + { + thumbClicked = false; + thumbState = ScrollBarState::Normal; + + if (e->Location.X > (thumbLeftLimit + thumbPosition) && + e->Location.X < (thumbRightLimitLeft + thumbPosition)) + { + thumbRectangle.X = e->Location.X - thumbPosition; + } + } + + // If one of the four thumb movement areas was clicked, + // stop the timer. + else if (leftArrowClicked) + { + leftArrowClicked = false; + leftButtonState = ScrollBarArrowButtonState::LeftNormal; + progressTimer->Stop(); + } + + else if (rightArrowClicked) + { + rightArrowClicked = false; + rightButtonState = ScrollBarArrowButtonState::RightNormal; + progressTimer->Stop(); + } + + else if (leftBarClicked) + { + leftBarClicked = false; + progressTimer->Stop(); + } + + else if (rightBarClicked) + { + rightBarClicked = false; + progressTimer->Stop(); + } + + Invalidate(); + } + + // Track mouse movements if the user clicks on the scroll bar thumb. + protected: + virtual void OnMouseMove(MouseEventArgs^ e) override + { + __super::OnMouseMove(e); + + if (!ScrollBarRenderer::IsSupported) + { + return; + } + + // Update the thumb position, if the new location is + // within the bounds. + if (thumbClicked) + { + // The thumb is all the way to the left. + if (e->Location.X <= (thumbLeftLimit + thumbPosition)) + { + thumbRectangle.X = thumbLeftLimit; + } + + // The thumb is all the way to the right. + else if (e->Location.X >= + (thumbRightLimitLeft + thumbPosition)) + { + thumbRectangle.X = thumbRightLimitLeft; + } + + // The thumb is between the ends of the track. + else + { + thumbRectangle.X = e->Location.X - thumbPosition; + } + + Invalidate(); + } + } + + // Recalculate the sizes of the scroll bar elements. + protected: + virtual void OnSizeChanged(EventArgs^ e) override + { + __super::OnSizeChanged(e); + SetUpScrollBar(); + } + + // Handle the timer tick by updating the thumb position. + private: + void progressTimer_Tick(Object^ sender, EventArgs^ myEventArgs) + { + if (!ScrollBarRenderer::IsSupported) + { + return; + } + + // If an arrow is clicked, move the thumb in small increments. + if (rightArrowClicked && thumbRectangle.X < thumbRightLimitLeft) + { + thumbRectangle.X++; + } + else if (leftArrowClicked && thumbRectangle.X > thumbLeftLimit) + { + thumbRectangle.X--; + } + + // If the track bar to right of the thumb is clicked, move the + // thumb to the right in larger increments until the right edge + // of the thumb hits the cursor. + else if (rightBarClicked && + thumbRectangle.X < thumbRightLimitLeft && + thumbRectangle.X + thumbRectangle.Width < trackPosition) + { + thumbRectangle.X += 3; + } + + // If the track bar to left of the thumb is clicked, move the + // thumb to the left in larger increments until the left edge + // of the thumb hits the cursor. + else if (leftBarClicked && + thumbRectangle.X > thumbLeftLimit && + thumbRectangle.X > trackPosition) + { + thumbRectangle.X -= 3; + } + + Invalidate(); + } + }; + + + public ref class Form1 : public Form + { + public: + Form1() : Form() + { + this->Size = System::Drawing::Size(500, 500); + + CustomScrollBar^ sampleCustomScrollBar = gcnew CustomScrollBar(); + sampleCustomScrollBar->Location = Point(50, 100); + sampleCustomScrollBar->Size = System::Drawing::Size(200, 20); + + Controls->Add(sampleCustomScrollBar); + } + }; +} + +[STAThread] +int main() +{ + // The call to EnableVisualStyles below does not affect whether + // ScrollBarRenderer.IsSupported is true; as long as visual styles + // are enabled by the operating system, IsSupported is true. + Application::EnableVisualStyles(); + Application::Run(gcnew ScrollBarRendererSample::Form1()); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp new file mode 100644 index 00000000000..d66f118f23c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ScrollBarsExample/CPP/form1.cpp @@ -0,0 +1,127 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //Me call is required by the Windows Form Designer. + InitializeComponent(); + SetFourDifferentScrollBars(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->SuspendLayout(); + + // + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Declare four textboxes. +internal: + System::Windows::Forms::TextBox^ vertical; + System::Windows::Forms::TextBox^ horizontal; + System::Windows::Forms::TextBox^ both; + System::Windows::Forms::TextBox^ none; + +private: + void SetFourDifferentScrollBars() + { + this->vertical = gcnew System::Windows::Forms::TextBox; + this->horizontal = gcnew System::Windows::Forms::TextBox; + this->both = gcnew System::Windows::Forms::TextBox; + this->none = gcnew System::Windows::Forms::TextBox; + + // Create a string for the Text property. + String^ startString = "The scroll bar style for my textbox is: "; + + // Set the location of the four textboxes. + horizontal->Location = Point(10,10); + vertical->Location = Point(10,70); + none->Location = Point(10,170); + both->Location = Point(10,110); + + // For horizonal scroll bars, the Multiline property must + // be true and the WordWrap property must be false. + // Increase the size of the Height property to ensure the + // scroll bar is visible. + horizontal->ScrollBars = ScrollBars::Horizontal; + horizontal->Multiline = true; + horizontal->WordWrap = false; + horizontal->Height = 40; + horizontal->Text = String::Concat( startString, ScrollBars::Horizontal ); + + // For the vertical scroll bar, Multiline must be true. + vertical->ScrollBars = ScrollBars::Vertical; + vertical->Multiline = true; + vertical->Text = String::Concat( startString, ScrollBars::Vertical ); + + // For both scroll bars, the Multiline property + // must be true, and the WordWrap property must be false. + // Increase the size of the Height property to ensure the + // scroll bar is visible. + both->ScrollBars = ScrollBars::Both; + both->Multiline = true; + both->WordWrap = false; + both->Height = 40; + both->AcceptsReturn = true; + both->Text = String::Concat( startString, ScrollBars::Both ); + + // The none scroll bar does not require specific + // property settings. + none->ScrollBars = ScrollBars::None; + none->Text = String::Concat( startString, ScrollBars::None ); + + // Add the textboxes to the form. + this->Controls->Add( this->vertical ); + this->Controls->Add( this->horizontal ); + this->Controls->Add( this->both ); + this->Controls->Add( this->none ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp new file mode 100644 index 00000000000..7253be011cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SelectionRange Members/CPP/selectionrangeobj.cpp @@ -0,0 +1,173 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::MonthCalendar^ monthCalendar1; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::TextBox^ textBox2; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label2; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support; do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->monthCalendar1 = gcnew System::Windows::Forms::MonthCalendar; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->textBox2 = gcnew System::Windows::Forms::TextBox; + this->label1 = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // monthCalendar1 + // + this->monthCalendar1->Location = System::Drawing::Point( 10, 8 ); + this->monthCalendar1->Name = "monthCalendar1"; + this->monthCalendar1->TabIndex = 0; + this->monthCalendar1->DateChanged += gcnew System::Windows::Forms::DateRangeEventHandler( this, &Form1::monthCalendar1_DateChanged ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 96, 176 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 104, 20 ); + this->textBox1->TabIndex = 1; + this->textBox1->Text = ""; + + // + // textBox2 + // + this->textBox2->Location = System::Drawing::Point( 96, 208 ); + this->textBox2->Name = "textBox2"; + this->textBox2->Size = System::Drawing::Size( 104, 20 ); + this->textBox2->TabIndex = 2; + this->textBox2->Text = ""; + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 24, 176 ); + this->label1->Name = "label1"; + this->label1->Size = System::Drawing::Size( 72, 23 ); + this->label1->TabIndex = 3; + this->label1->Text = "Start"; + + // + // label2 + // + this->label2->Location = System::Drawing::Point( 24, 208 ); + this->label2->Name = "label2"; + this->label2->Size = System::Drawing::Size( 72, 23 ); + this->label2->TabIndex = 4; + this->label2->Text = "End"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 72, 248 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 5; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 216, 277 ); + array^temp0 = {this->button1,this->label2,this->label1,this->textBox2,this->textBox1,this->monthCalendar1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + // Create a SelectionRange object and set its Start and End properties. + SelectionRange^ sr = gcnew SelectionRange; + sr->Start = DateTime::Parse( this->textBox1->Text ); + sr->End = DateTime::Parse( this->textBox2->Text ); + + /* Assign the SelectionRange object to the + SelectionRange property of the MonthCalendar control. */ + this->monthCalendar1->SelectionRange = sr; + } + + void monthCalendar1_DateChanged( Object^ /*sender*/, DateRangeEventArgs^ /*e*/ ) + { + /* Display the Start and End property values of + the SelectionRange object in the text boxes. */ + this->textBox1->Text = monthCalendar1->SelectionRange->Start.Date.ToShortDateString(); + this->textBox2->Text = monthCalendar1->SelectionRange->End.Date.ToShortDateString(); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp new file mode 100644 index 00000000000..5227d040486 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.SendKeys/CPP/form1.cpp @@ -0,0 +1,110 @@ + + +#using +#using +#using + +//The following code example shows the use of the +// SendKeys.Send method. +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::Label ^ Label1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + //Button1 + // + this->Button1->Location = System::Drawing::Point( 96, 72 ); + this->Button1->Name = "Button1"; + this->Button1->TabIndex = 0; + this->Button1->Text = "&Click"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + + // + //Label1 + // + this->Label1->Location = System::Drawing::Point( 80, 16 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 128, 32 ); + this->Label1->TabIndex = 1; + this->Label1->Text = "Double-clicking form, clicks the button"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + this->DoubleClick += gcnew System::EventHandler( this, &Form1::Form1_DoubleClick ); + } + + // +private: + // Clicking Button1 causes a message box to appear. + void Button1_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( "Click here!" ); + } + + // Use the SendKeys.Send method to raise the Button1 click event + // and display the message box. + void Form1_DoubleClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Send the enter key; since the tab stop of Button1 is 0, this + // will trigger the click event. + SendKeys::Send( "{ENTER}" ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp new file mode 100644 index 00000000000..875f03c8009 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.Sound/CPP/soundtestform.cpp @@ -0,0 +1,414 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Diagnostics; +using namespace System::Drawing; +using namespace System::Media; +using namespace System::Windows::Forms; + +public ref class SoundTestForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::TextBox^ filepathTextbox; + System::Windows::Forms::Button^ playOnceSyncButton; + System::Windows::Forms::Button^ playOnceAsyncButton; + System::Windows::Forms::Button^ playLoopAsyncButton; + System::Windows::Forms::Button^ selectFileButton; + System::Windows::Forms::Button^ stopButton; + System::Windows::Forms::StatusBar^ statusBar; + System::Windows::Forms::Button^ loadSyncButton; + System::Windows::Forms::Button^ loadAsyncButton; + SoundPlayer^ player; + +public: + SoundTestForm() + { + + // Initialize Forms Designer generated code. + InitializeComponent(); + + // Disable playback controls until a valid .wav file + // is selected. + EnablePlaybackControls( false ); + + // Set up the status bar and other controls. + InitializeControls(); + + // Set up the SoundPlayer object. + InitializeSound(); + } + + +private: + + // Sets up the status bar and other controls. + void InitializeControls() + { + + // Set up the status bar. + StatusBarPanel^ panel = gcnew StatusBarPanel; + panel->BorderStyle = StatusBarPanelBorderStyle::Sunken; + panel->Text = "Ready."; + panel->AutoSize = StatusBarPanelAutoSize::Spring; + this->statusBar->ShowPanels = true; + this->statusBar->Panels->Add( panel ); + } + + + // Sets up the SoundPlayer object. + void InitializeSound() + { + + // Create an instance of the SoundPlayer class. + player = gcnew SoundPlayer; + + // Listen for the LoadCompleted event. + player->LoadCompleted += gcnew AsyncCompletedEventHandler( this, &SoundTestForm::player_LoadCompleted ); + + // Listen for the SoundLocationChanged event. + player->SoundLocationChanged += gcnew EventHandler( this, &SoundTestForm::player_LocationChanged ); + } + + void selectFileButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Create a new OpenFileDialog. + OpenFileDialog^ dlg = gcnew OpenFileDialog; + + // Make sure the dialog checks for existence of the + // selected file. + dlg->CheckFileExists = true; + + // Allow selection of .wav files only. + dlg->Filter = "WAV files (*.wav)|*.wav"; + dlg->DefaultExt = ".wav"; + + // Activate the file selection dialog. + if ( dlg->ShowDialog() == ::DialogResult::OK ) + { + + // Get the selected file's path from the dialog. + this->filepathTextbox->Text = dlg->FileName; + + // Assign the selected file's path to + // the SoundPlayer object. + player->SoundLocation = filepathTextbox->Text; + } + } + + + // Convenience method for setting message text in + // the status bar. + void ReportStatus( String^ statusMessage ) + { + + // If the caller passed in a message... + if ( (statusMessage != nullptr) && (statusMessage != String::Empty) ) + { + + // ...post the caller's message to the status bar. + this->statusBar->Panels[ 0 ]->Text = statusMessage; + } + } + + + // Enables and disables play controls. + void EnablePlaybackControls( bool enabled ) + { + this->playOnceSyncButton->Enabled = enabled; + this->playOnceAsyncButton->Enabled = enabled; + this->playLoopAsyncButton->Enabled = enabled; + this->stopButton->Enabled = enabled; + } + + void filepathTextbox_TextChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Disable playback controls until the new .wav is loaded. + EnablePlaybackControls( false ); + } + + void loadSyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Disable playback controls until the .wav is + // successfully loaded. The LoadCompleted event + // handler will enable them. + EnablePlaybackControls( false ); + + // + try + { + + // Assign the selected file's path to + // the SoundPlayer object. + player->SoundLocation = filepathTextbox->Text; + + // Load the .wav file. + player->Load(); + } + catch ( Exception^ ex ) + { + ReportStatus( ex->Message ); + } + + + // + } + + void loadAsyncButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Disable playback controls until the .wav is + // successfully loaded. The LoadCompleted event + // handler will enable them. + EnablePlaybackControls( false ); + + // + try + { + + // Assign the selected file's path to + // the SoundPlayer object. + player->SoundLocation = this->filepathTextbox->Text; + + // Load the .wav file. + player->LoadAsync(); + } + catch ( Exception^ ex ) + { + ReportStatus( ex->Message ); + } + + + // + } + + + // Synchronously plays the selected .wav file once. + // If the file is large, UI response will be visibly + // affected. + void playOnceSyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // + ReportStatus( "Playing .wav file synchronously." ); + player->PlaySync(); + ReportStatus( "Finished playing .wav file synchronously." ); + + // + } + + + // Asynchronously plays the selected .wav file once. + void playOnceAsyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // + ReportStatus( "Playing .wav file asynchronously." ); + player->Play(); + + // + } + + + // Asynchronously plays the selected .wav file until the user + // clicks the Stop button. + void playLoopAsyncButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // + ReportStatus( "Looping .wav file asynchronously." ); + player->PlayLooping(); + + // + } + + + // Stops the currently playing .wav file, if any. + void stopButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // + player->Stop(); + ReportStatus( "Stopped by user." ); + + // + } + + + // + // Handler for the LoadCompleted event. + void player_LoadCompleted( Object^ /*sender*/, AsyncCompletedEventArgs^ /*e*/ ) + { + String^ message = String::Format( "LoadCompleted: {0}", this->filepathTextbox->Text ); + ReportStatus( message ); + EnablePlaybackControls( true ); + } + + + // + // + // Handler for the SoundLocationChanged event. + void player_LocationChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + String^ message = String::Format( "SoundLocationChanged: {0}", player->SoundLocation ); + ReportStatus( message ); + } + + + // + void InitializeComponent() + { + this->filepathTextbox = gcnew System::Windows::Forms::TextBox; + this->selectFileButton = gcnew System::Windows::Forms::Button; + this->label1 = gcnew System::Windows::Forms::Label; + this->loadSyncButton = gcnew System::Windows::Forms::Button; + this->playOnceSyncButton = gcnew System::Windows::Forms::Button; + this->playOnceAsyncButton = gcnew System::Windows::Forms::Button; + this->stopButton = gcnew System::Windows::Forms::Button; + this->playLoopAsyncButton = gcnew System::Windows::Forms::Button; + this->statusBar = gcnew System::Windows::Forms::StatusBar; + this->loadAsyncButton = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // filepathTextbox + // + this->filepathTextbox->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->filepathTextbox->Location = System::Drawing::Point( 7, 25 ); + this->filepathTextbox->Name = "filepathTextbox"; + this->filepathTextbox->Size = System::Drawing::Size( 263, 20 ); + this->filepathTextbox->TabIndex = 1; + this->filepathTextbox->Text = ""; + this->filepathTextbox->TextChanged += gcnew System::EventHandler( this, &SoundTestForm::filepathTextbox_TextChanged ); + + // + // selectFileButton + // + this->selectFileButton->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Right); + this->selectFileButton->Location = System::Drawing::Point( 276, 25 ); + this->selectFileButton->Name = "selectFileButton"; + this->selectFileButton->Size = System::Drawing::Size( 23, 21 ); + this->selectFileButton->TabIndex = 2; + this->selectFileButton->Text = "..."; + this->selectFileButton->Click += gcnew System::EventHandler( this, &SoundTestForm::selectFileButton_Click ); + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 7, 7 ); + this->label1->Name = "label1"; + this->label1->Size = System::Drawing::Size( 145, 17 ); + this->label1->TabIndex = 3; + this->label1->Text = ".wav path or URL:"; + + // + // loadSyncButton + // + this->loadSyncButton->Location = System::Drawing::Point( 7, 53 ); + this->loadSyncButton->Name = "loadSyncButton"; + this->loadSyncButton->Size = System::Drawing::Size( 142, 23 ); + this->loadSyncButton->TabIndex = 4; + this->loadSyncButton->Text = "Load Synchronously"; + this->loadSyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::loadSyncButton_Click ); + + // + // playOnceSyncButton + // + this->playOnceSyncButton->Location = System::Drawing::Point( 7, 86 ); + this->playOnceSyncButton->Name = "playOnceSyncButton"; + this->playOnceSyncButton->Size = System::Drawing::Size( 142, 23 ); + this->playOnceSyncButton->TabIndex = 5; + this->playOnceSyncButton->Text = "Play Once Synchronously"; + this->playOnceSyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playOnceSyncButton_Click ); + + // + // playOnceAsyncButton + // + this->playOnceAsyncButton->Location = System::Drawing::Point( 149, 86 ); + this->playOnceAsyncButton->Name = "playOnceAsyncButton"; + this->playOnceAsyncButton->Size = System::Drawing::Size( 147, 23 ); + this->playOnceAsyncButton->TabIndex = 6; + this->playOnceAsyncButton->Text = "Play Once Asynchronously"; + this->playOnceAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playOnceAsyncButton_Click ); + + // + // stopButton + // + this->stopButton->Location = System::Drawing::Point( 149, 109 ); + this->stopButton->Name = "stopButton"; + this->stopButton->Size = System::Drawing::Size( 147, 23 ); + this->stopButton->TabIndex = 7; + this->stopButton->Text = "Stop"; + this->stopButton->Click += gcnew System::EventHandler( this, &SoundTestForm::stopButton_Click ); + + // + // playLoopAsyncButton + // + this->playLoopAsyncButton->Location = System::Drawing::Point( 7, 109 ); + this->playLoopAsyncButton->Name = "playLoopAsyncButton"; + this->playLoopAsyncButton->Size = System::Drawing::Size( 142, 23 ); + this->playLoopAsyncButton->TabIndex = 8; + this->playLoopAsyncButton->Text = "Loop Asynchronously"; + this->playLoopAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::playLoopAsyncButton_Click ); + + // + // statusBar + // + this->statusBar->Location = System::Drawing::Point( 0, 146 ); + this->statusBar->Name = "statusBar"; + this->statusBar->Size = System::Drawing::Size( 306, 22 ); + this->statusBar->SizingGrip = false; + this->statusBar->TabIndex = 9; + this->statusBar->Text = "(no status)"; + + // + // loadAsyncButton + // + this->loadAsyncButton->Location = System::Drawing::Point( 149, 53 ); + this->loadAsyncButton->Name = "loadAsyncButton"; + this->loadAsyncButton->Size = System::Drawing::Size( 147, 23 ); + this->loadAsyncButton->TabIndex = 10; + this->loadAsyncButton->Text = "Load Asynchronously"; + this->loadAsyncButton->Click += gcnew System::EventHandler( this, &SoundTestForm::loadAsyncButton_Click ); + + // + // SoundTestForm + // + this->ClientSize = System::Drawing::Size( 306, 168 ); + this->Controls->Add( this->loadAsyncButton ); + this->Controls->Add( this->statusBar ); + this->Controls->Add( this->playLoopAsyncButton ); + this->Controls->Add( this->stopButton ); + this->Controls->Add( this->playOnceAsyncButton ); + this->Controls->Add( this->playOnceSyncButton ); + this->Controls->Add( this->loadSyncButton ); + this->Controls->Add( this->label1 ); + this->Controls->Add( this->selectFileButton ); + this->Controls->Add( this->filepathTextbox ); + this->MinimumSize = System::Drawing::Size( 310, 165 ); + this->Name = "SoundTestForm"; + this->SizeGripStyle = System::Windows::Forms::SizeGripStyle::Show; + this->Text = "Sound API Test Form"; + this->ResumeLayout( false ); + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew SoundTestForm ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp new file mode 100644 index 00000000000..81d129ea527 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarDrawItemEventHandler/CPP/form1.cpp @@ -0,0 +1,144 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeStatusBarPanels(); + InitializeSimpleStatusBar(); + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->SuspendLayout(); + + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Initialize a single-panel status bar. This is done + // by setting the Text property and setting ShowPanels to False. +private: + void InitializeSimpleStatusBar() + { + + // Declare the StatusBar control + StatusBar^ simpleStatusBar = gcnew StatusBar; + + // Set the ShowPanels property to False. + simpleStatusBar->ShowPanels = false; + + // Set the text. + simpleStatusBar->Text = "This is a single-panel status bar"; + + // Set the width and anchor the StatusBar + simpleStatusBar->Width = 200; + simpleStatusBar->Anchor = AnchorStyles::Top; + + // Add the StatusBar to the form. + this->Controls->Add( simpleStatusBar ); + } + // + + // + StatusBar^ StatusBar1; + void InitializeStatusBarPanels() + { + StatusBar1 = gcnew StatusBar; + + // Create two StatusBarPanel objects. + StatusBarPanel^ panel1 = gcnew StatusBarPanel; + StatusBarPanel^ panel2 = gcnew StatusBarPanel; + + // Set the style of the panels. + // panel1 will be owner-drawn. + panel1->Style = StatusBarPanelStyle::OwnerDraw; + + // The panel2 object will be drawn by the operating system. + panel2->Style = StatusBarPanelStyle::Text; + + // Set the text of both panels to the same date string. + panel1->Text = System::DateTime::Today.ToShortDateString(); + panel2->Text = System::DateTime::Today.ToShortDateString(); + + // Add both panels to the StatusBar. + StatusBar1->Panels->Add( panel1 ); + StatusBar1->Panels->Add( panel2 ); + + // Make panels visible by setting the ShowPanels + // property to True. + StatusBar1->ShowPanels = true; + + // Associate the event-handling method with the DrawItem event + // for the owner-drawn panel. + StatusBar1->DrawItem += gcnew StatusBarDrawItemEventHandler( this, &Form1::DrawCustomStatusBarPanel ); + this->Controls->Add( StatusBar1 ); + } + + + // Draw the panel. + void DrawCustomStatusBarPanel( Object^ sender, StatusBarDrawItemEventArgs^ e ) + { + + // Draw a blue background in the owner-drawn panel. + e->Graphics->FillRectangle( Brushes::AliceBlue, e->Bounds ); + + // Create a StringFormat object to align text in the panel. + StringFormat^ textFormat = gcnew StringFormat; + + // Center the text in the middle of the line. + textFormat->LineAlignment = StringAlignment::Center; + + // Align the text to the left. + textFormat->Alignment = StringAlignment::Far; + + // Draw the panel's text in dark blue using the Panel + // and Bounds properties of the StatusBarEventArgs object + // and the StringFormat object. + e->Graphics->DrawString( e->Panel->Text, StatusBar1->Font, Brushes::DarkBlue, RectangleF(e->Bounds.X,e->Bounds.Y,e->Bounds.Width,e->Bounds.Height), textFormat ); + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp new file mode 100644 index 00000000000..b0f2829671d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.StatusBarPanelExample/CPP/form1.cpp @@ -0,0 +1,148 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeStatusBarPanels(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::RichTextBox^ RichTextBox1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + //RichTextBox1 + // + this->RichTextBox1->Dock = System::Windows::Forms::DockStyle::Fill; + this->RichTextBox1->Location = System::Drawing::Point( 0, 0 ); + this->RichTextBox1->Name = "RichTextBox1"; + this->RichTextBox1->Size = System::Drawing::Size( 292, 266 ); + this->RichTextBox1->TabIndex = 0; + this->RichTextBox1->Text = " "; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->RichTextBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +internal: + System::Windows::Forms::StatusBar^ statusBar1; + +private: + void InitializeStatusBarPanels() + { + + // Create a StatusBar control. + statusBar1 = gcnew StatusBar; + + // Dock the status bar at the top of the form. + statusBar1->Dock = DockStyle::Top; + + // Set the SizingGrip property to false so the user cannot + // resize the status bar. + statusBar1->SizingGrip = false; + + // Associate the event-handling method with the + // PanelClick event. + statusBar1->PanelClick += gcnew StatusBarPanelClickEventHandler( this, &Form1::statusBar1_PanelClick ); + + // Create two StatusBarPanel objects to display in statusBar1. + StatusBarPanel^ panel1 = gcnew StatusBarPanel; + StatusBarPanel^ panel2 = gcnew StatusBarPanel; + + // Set the width of panel2 explicitly and set + // panel1 to fill in the remaining space. + panel2->Width = 80; + panel1->AutoSize = StatusBarPanelAutoSize::Spring; + + // Set the text alignment within each panel. + panel1->Alignment = HorizontalAlignment::Left; + panel2->Alignment = HorizontalAlignment::Right; + + // Display the first panel without a border and the second + // with a raised border. + panel1->BorderStyle = StatusBarPanelBorderStyle::None; + panel2->BorderStyle = StatusBarPanelBorderStyle::Raised; + + // Set the text of the panels. The panel1 object is reserved + // for line numbers, while panel2 is set to the current time. + panel1->Text = "Reserved for important information."; + panel2->Text = System::DateTime::Now.ToShortTimeString(); + + // Set a tooltip for panel2 + panel2->ToolTipText = "Click time to display seconds"; + + // Display panels in statusBar1 and add them to the + // status bar's StatusBarPanelCollection. + statusBar1->ShowPanels = true; + statusBar1->Panels->Add( panel1 ); + statusBar1->Panels->Add( panel2 ); + + // Add the StatusBar to the form. + this->Controls->Add( statusBar1 ); + } + + // If the user clicks the status bar, check the text of the + // StatusBarPanel. If the text equals a short time string, + // change it to long time display. + void statusBar1_PanelClick( Object^ /*sender*/, StatusBarPanelClickEventArgs^ e ) + { + if ( e->StatusBarPanel->Text == System::DateTime::Now.ToShortTimeString() ) + { + e->StatusBarPanel->Text = System::DateTime::Now.ToLongTimeString(); + } + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp new file mode 100644 index 00000000000..31df5973127 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabControlExample/CPP/form1.cpp @@ -0,0 +1,119 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + ChangeTheLookOfTheTabControl(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::TabControl^ TabControl1; + System::Windows::Forms::TabPage^ TabPage1; + System::Windows::Forms::TabPage^ TabPage2; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->TabControl1 = gcnew System::Windows::Forms::TabControl; + this->TabPage1 = gcnew System::Windows::Forms::TabPage; + this->TabPage2 = gcnew System::Windows::Forms::TabPage; + this->TabControl1->SuspendLayout(); + this->SuspendLayout(); + + // + //TabControl1 + // + this->TabControl1->Controls->Add( this->TabPage1 ); + this->TabControl1->Controls->Add( this->TabPage2 ); + this->TabControl1->Location = System::Drawing::Point( 0, 0 ); + this->TabControl1->Name = "TabControl1"; + this->TabControl1->SelectedIndex = 0; + this->TabControl1->TabIndex = 0; + + // + //TabPage1 + // + this->TabPage1->Location = System::Drawing::Point( 4, 22 ); + this->TabPage1->Name = "TabPage1"; + this->TabPage1->Size = System::Drawing::Size( 192, 74 ); + this->TabPage1->TabIndex = 0; + this->TabPage1->Text = "Errors"; + + // + //TabPage2 + // + this->TabPage2->Location = System::Drawing::Point( 4, 22 ); + this->TabPage2->Name = "TabPage2"; + this->TabPage2->Size = System::Drawing::Size( 192, 74 ); + this->TabPage2->TabIndex = 1; + this->TabPage2->Text = "Failures"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 296, 294 ); + this->Controls->Add( this->TabControl1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->TabControl1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + // +private: + void ChangeTheLookOfTheTabControl() + { + // Set the size and location of the TabControl. + this->TabControl1->Location = System::Drawing::Point( 20, 20 ); + TabControl1->Size = System::Drawing::Size( 250, 250 ); + + // Align the tabs along the bottom of the control. + TabControl1->Alignment = TabAlignment::Bottom; + + // Change the tabs to flat buttons. + TabControl1->Appearance = TabAppearance::FlatButtons; + } + // +}; + + +[System::STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..010134bc5ea --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TabRenderer/cpp/form1.cpp @@ -0,0 +1,156 @@ +// This entire sample can go in the TabRenderer overview. +// - Snippet2 can be excerpted in DrawTabPage, DrawTabItem, and IsSupported. +// - Snippet2 could also be excerpted in the VisualStyles.TabItemState enum, +// if necessary. + +// The sample defines a simple custom Control that uses TabRenderer to +// simulate a basic (and essentially useless) TabControl. Might want +// to add a bit more unique functionality, although the basic painting +// functionality of the class is demonstrated. + +// For simplicity, this sample doesn't handle runtime switching of visual styles. + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace TabRendererSample +{ + public ref class CustomTabControl : public Control + { + private: + Rectangle tabPageRectangle; + Rectangle tabItemRectangle1; + Rectangle tabItemRectangle2; + int tabHeight; + int tabWidth; + TabItemState tab1State; + TabItemState tab2State; + String^ tab1Text; + String^ tab2Text; + bool tab1Focused; + bool tab2Focused; + + public: + CustomTabControl() + { + this->tabHeight = 30; + this->tabWidth = 100; + this->tab1State = TabItemState::Selected; + this->tab2State = TabItemState::Normal; + this->tab1Text = "Tab 1"; + this->tab2Text = "Tab 2"; + this->tab1Focused = true; + this->tab2Focused = false; + this->Size = System::Drawing::Size(300, 300); + this->Location = Point(10, 10); + this->Font = SystemFonts::IconTitleFont; + this->Text = "TabRenderer"; + this->DoubleBuffered = true; + + tabPageRectangle = Rectangle(ClientRectangle.X, + ClientRectangle.Y + tabHeight, + ClientRectangle.Width, + ClientRectangle.Height - tabHeight); + + // Extend the first tab rectangle down by 2 pixels, + // because it is selected by default. + tabItemRectangle1 = Rectangle(ClientRectangle.X, + ClientRectangle.Y, tabWidth, tabHeight + 2); + + tabItemRectangle2 = Rectangle(ClientRectangle.Location.X + + tabWidth, ClientRectangle.Location.Y, tabWidth, tabHeight); + } + + // + // Draw the tab page and the tab items. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + if (!TabRenderer::IsSupported) + { + this->Parent->Text = "CustomTabControl Disabled"; + return; + } + + TabRenderer::DrawTabPage(e->Graphics, tabPageRectangle); + TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle1, + tab1Text, this->Font, tab1Focused, tab1State); + TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle2, + tab2Text, this->Font, tab2Focused, tab2State); + + this->Parent->Text = "CustomTabControl Enabled"; + } + // + + // Draw the selected tab item. + protected: + virtual void OnMouseDown(MouseEventArgs^ e) override + { + __super::OnMouseDown(e); + + if (!TabRenderer::IsSupported) + { + return; + } + + // The first tab is clicked. Note that the height of the + // selected tab rectangle is raised by 2, so that it draws + // over the border of the tab page. + if (tabItemRectangle1.Contains(e->Location)) + { + tab1State = TabItemState::Selected; + tab2State = TabItemState::Normal; + tabItemRectangle1.Height += 2; + tabItemRectangle2.Height -= 2; + tab1Focused = true; + tab2Focused = false; + } + + // The second tab is clicked. + if (tabItemRectangle2.Contains(e->Location)) + { + tab2State = TabItemState::Selected; + tab1State = TabItemState::Normal; + tabItemRectangle2.Height += 2; + tabItemRectangle1.Height -= 2; + tab2Focused = true; + tab1Focused = false; + } + + Invalidate(); + } + }; + public ref class Form1 : public Form + { + public: + Form1() + + { + CustomTabControl^ Tab1 = gcnew CustomTabControl(); + Controls->Add(Tab1); + this->Size = System::Drawing::Size(500, 500); + } + + }; +} + +[STAThread] +int main() +{ + // The call to EnableVisualStyles below does not affect whether + // TabRenderer.IsSupported is true; as long as visual styles + // are enabled by the operating system, IsSupported is true. + Application::EnableVisualStyles(); + Application::Run(gcnew TabRendererSample::Form1()); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp new file mode 100644 index 00000000000..df65b79856a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxBaseScrolling/CPP/form1.cpp @@ -0,0 +1,137 @@ + + +#using +#using +#using + +// The following code example demonstrates using the Keys enum, +// and the TextBoxBase.ScrollToCaret, and TextBox.HideSelection methods. +// It also demonstrates and handling the TextBox.Click event. +using namespace System; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeTextBox(); + + // Hook up the event-handling method with the + // KeyDown Event. + this->TextBox1->KeyDown += gcnew KeyEventHandler( this, &Form1::TextBox1_KeyDown ); + this->TextBox1->Click += gcnew System::EventHandler( this, &Form1::TextBox1_Click ); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows + //Form Designer. It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::RichTextBox^ RichTextBox1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + //RichTextBox1 + // + this->RichTextBox1->Location = System::Drawing::Point( 40, 80 ); + this->RichTextBox1->Name = "RichTextBox1"; + this->RichTextBox1->ReadOnly = true; + this->RichTextBox1->TabIndex = 0; + this->RichTextBox1->Text = "and the text will be added here."; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->RichTextBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + //Declare a textbox called TextBox1. +internal: + System::Windows::Forms::TextBox^ TextBox1; + +private: + + //Initialize TextBox1. + void InitializeTextBox() + { + this->TextBox1 = gcnew TextBox; + this->TextBox1->Location = System::Drawing::Point( 32, 24 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->Size = System::Drawing::Size( 136, 20 ); + this->TextBox1->TabIndex = 1; + this->TextBox1->Text = "Type and hit enter here..."; + + //Keep the selection highlighted, even after textbox loses focus. + TextBox1->HideSelection = false; + this->Controls->Add( TextBox1 ); + } + // + + // +private: + //Selects everything in TextBox1. + void TextBox1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + TextBox1->SelectAll(); + } + // + + // +private: + //Handles the Enter key being pressed while TextBox1 has focus. + void TextBox1_KeyDown( Object^ /*sender*/, KeyEventArgs^ e ) + { + TextBox1->HideSelection = false; + if ( e->KeyCode == Keys::Enter ) + { + e->Handled = true; + + // Copy the text from TextBox1 to RichTextBox1, add a CRLF after + // the copied text, and keep the caret in view. + RichTextBox1->SelectedText = String::Concat( TextBox1->Text, "\r\n" ); + RichTextBox1->ScrollToCaret(); + } + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..08bd6525d37 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TextBoxRenderer/cpp/form1.cpp @@ -0,0 +1,132 @@ +// This sample can go in TextBoxRenderer class overview. +// - Snippet2 can go in IsSupported and DrawTextBox +// - Snippet4 could go in TextFormatFlags + +// This sample is a custom control that displays a static string and allows +// the user to select the TextFormatFlag to apply to the text. +// For simplicity, this sample does not handle run-time switching of visual styles. + +// +#using +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace TextBoxRendererSample +{ + public ref class CustomTextBox : public Control + { + private: + TextFormatFlags textFlags; + ComboBox^ textFormatFlagsComboBox; + Rectangle textBorder; + Rectangle textRectangle; + StringBuilder^ textMeasurements; + + public: + CustomTextBox():Control() + { + textFlags = TextFormatFlags::Default; + textFormatFlagsComboBox = gcnew ComboBox(); + + textMeasurements = gcnew StringBuilder(); + + this->Location = Point(10, 10); + this->Size = System::Drawing::Size(300, 200); + this->Font = SystemFonts::IconTitleFont; + this->Text = "This is a long sentence that will exceed " + + "the text box bounds"; + + textBorder.Location = Point(10, 10); + textBorder.Size = System::Drawing::Size(200, 50); + textRectangle.Location = Point(textBorder.X + 2, + textBorder.Y + 2); + textRectangle.Size = System::Drawing::Size(textBorder.Size.Width - 4, + textBorder.Height - 4); + + textFormatFlagsComboBox->Location = Point(10, 100); + textFormatFlagsComboBox->Size = System::Drawing::Size(150, 20); + textFormatFlagsComboBox->SelectedIndexChanged += + gcnew EventHandler(this, + &CustomTextBox::textFormatFlagsComboBox_SelectedIndexChanged); + + // Populate the combo box with the TextFormatFlags value names. + for each (String^ name in Enum::GetNames(TextFormatFlags::typeid)) + { + textFormatFlagsComboBox->Items->Add(name); + } + + textFormatFlagsComboBox->SelectedIndex = 0; + this->Controls->Add(textFormatFlagsComboBox); + } + + // + // + // Use DrawText with the current TextFormatFlags. + + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + if (TextBoxRenderer::IsSupported) + { + TextBoxRenderer::DrawTextBox(e->Graphics, textBorder, this->Text, + this->Font, textRectangle, textFlags, TextBoxState::Normal); + + this->Parent->Text = "CustomTextBox Enabled"; + } + else + { + this->Parent->Text = "CustomTextBox Disabled"; + } + } + // + + // Assign the combo box selection to the display text. + private: + void textFormatFlagsComboBox_SelectedIndexChanged( + Object^ sender, EventArgs^ e) + { + this->textFlags = (TextFormatFlags)Enum::Parse( + TextFormatFlags::typeid, + (String^)textFormatFlagsComboBox->Items[ + textFormatFlagsComboBox->SelectedIndex]); + + Invalidate(); + } + // + }; + + public ref class Form1 : public Form + { + public: + Form1() + { + __super::Form(); + this->Size = System::Drawing::Size(350, 200); + CustomTextBox^ textBox1 = gcnew CustomTextBox(); + Controls->Add(textBox1); + } + }; +} + +using namespace TextBoxRendererSample; + +[STAThread] +int main() +{ + // The call to EnableVisualStyles below does not affect whether + // TextBoxRenderer draws the text box; as long as visual styles + // are enabled by the operating system, TextBoxRenderer will + // draw the text box. + Application::EnableVisualStyles(); + Application::Run(gcnew Form1()); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp new file mode 100644 index 00000000000..433d359cfe5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolBarButtonExample/CPP/form1.cpp @@ -0,0 +1,151 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeToolBar(); + + //Add any initialization after the InitializeComponent() call + } + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::RichTextBox^ RichTextBox1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->RichTextBox1 = gcnew System::Windows::Forms::RichTextBox; + this->SuspendLayout(); + + // + //ToolBar1 + //RichTextBox1 + // + this->RichTextBox1->Dock = System::Windows::Forms::DockStyle::Fill; + this->RichTextBox1->Location = System::Drawing::Point( 0, 0 ); + this->RichTextBox1->Name = "RichTextBox1"; + this->RichTextBox1->Size = System::Drawing::Size( 292, 224 ); + this->RichTextBox1->TabIndex = 1; + this->RichTextBox1->Text = "System.Windows.Forms System.Xml " + " System.Reflection"; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->RichTextBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Declare ToolBar1. +internal: + System::Windows::Forms::ToolBar^ ToolBar1; + +private: + + // Initialize ToolBar1 with Bold(B), Italic(I), and + // Underline(U) buttons. + void InitializeToolBar() + { + ToolBar1 = gcnew ToolBar; + + // Set the appearance to Flat. + ToolBar1->Appearance = ToolBarAppearance::Flat; + + // Set the toolbar to dock at the bottom of the form. + ToolBar1->Dock = DockStyle::Bottom; + + // Set the toolbar font to 14 points and bold. + ToolBar1->Font = gcnew System::Drawing::Font( FontFamily::GenericSansSerif,14,FontStyle::Bold ); + + // Declare fontstyle array with the three font styles. + array^ fonts = {FontStyle::Bold,FontStyle::Italic,FontStyle::Underline}; + int count; + + // Create a button for each value in the array, setting its + // text to the first letter of the style and its + // button's tag property. + for ( count = 0; count < fonts->Length; count++ ) + { + ToolBarButton^ fontButton = gcnew ToolBarButton( fonts[ count ].ToString()->Substring( 0, 1 ) ); + fontButton->Style = ToolBarButtonStyle::ToggleButton; + fontButton->Tag = fonts[ count ]; + ToolBar1->Buttons->Add( fontButton ); + + } + this->ToolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &Form1::ToolBar1_ButtonClick ); + this->Controls->Add( this->ToolBar1 ); + } + + // Declare FontStyle object, which defaults to the Regular + // FontStyle. + FontStyle style; + void ToolBar1_ButtonClick( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ e ) + { + // If a button is pushed, use a bitwise Or combination + // of the style variable and the button tag, to set style to + // the correct FontStyle. Set the button's PartialPush + // property to true for a Windows XP-like appearance. + if ( e->Button->Pushed ) + { + e->Button->PartialPush = true; + style = (FontStyle)(style | safe_cast(e->Button->Tag)); + } + else + { + // If the button was not pushed, use a bitwise XOR + // combination to turn off that style + // and set the PartialPush property to false. + e->Button->PartialPush = false; + style = (FontStyle)(style ^ safe_cast(e->Button->Tag)); + } + + // Set the font using the existing RichTextBox font and the new + // style. + RichTextBox1->Font = gcnew System::Drawing::Font( RichTextBox1->Font,style ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp new file mode 100644 index 00000000000..0c35908b473 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStrip1/CPP/form1.cpp @@ -0,0 +1,469 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ToolStripExamples +{ + // + // Extend the ToolStripRenderer class. + // + + // Override the desired methods to render items as desired. + public ref class RedTextRenderer: public + System::Windows::Forms::ToolStripRenderer + { + protected: + void OnRenderItemText(ToolStripItemTextRenderEventArgs^ e) + { + e->TextColor = Color::Red; + e->TextFont = + gcnew Font("Helvetica", 7, FontStyle::Bold); + __super::OnRenderItemText(e); + } //OnRenderItemText + }; + + + /// + /// Summary description for form. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + + /// + /// Required designer variable. + /// + System::ComponentModel::IContainer^ components; + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->statusStrip1 = + gcnew System::Windows::Forms::StatusStrip; + this->raftingContainer1 = + gcnew System::Windows::Forms::RaftingContainer; + this->movingToolStrip = + gcnew System::Windows::Forms::ToolStrip; + this->toolStrip1 = + gcnew System::Windows::Forms::ToolStrip; + this->raftingContainer2 = + gcnew System::Windows::Forms::RaftingContainer; + this->raftingContainer3 = + gcnew System::Windows::Forms::RaftingContainer; + this->raftingContainer4 = + gcnew System::Windows::Forms::RaftingContainer; + this->components = + gcnew System::ComponentModel::Container; + this->SuspendLayout(); + + // + // statusStrip1 + // + this->statusStrip1->CanOverflow = false; + this->statusStrip1->GripStyle = + System::Windows::Forms::ToolStripGripStyle::Hidden; + this->statusStrip1->Location = + System::Drawing::Point(9, 233); + this->statusStrip1->Name = "statusStrip1"; + this->statusStrip1->Size = System::Drawing::Size(274, 24); + this->statusStrip1->TabIndex = 4; + this->statusStrip1->Text = "statusStrip1"; + this->statusStrip1->Visible = true; + + // + // raftingContainer1 + // + this->raftingContainer1->AutoSize = true; + this->raftingContainer1->Dock = + System::Windows::Forms::DockStyle::Top; + this->raftingContainer1->Location = + System::Drawing::Point(9, 9); + this->raftingContainer1->Name = "raftingContainer1"; + this->raftingContainer1->Orientation = + System::Windows::Forms::Orientation::Horizontal; + this->raftingContainer1->RowMargin = + System::Windows::Forms::Padding(0); + this->raftingContainer1->Size = + System::Drawing::Size(274, 25); + this->raftingContainer1->TabIndex = 0; + this->raftingContainer1->Text = + "RaftingContainerRaftingContainerTop"; + this->raftingContainer1->Join(this->toolStrip1); + this->raftingContainer1->Join(this->movingToolStrip); + + // + // movingToolStrip + // + this->movingToolStrip->Anchor = + System::Windows::Forms::AnchorStyles::Right; + this->movingToolStrip->Dock = + System::Windows::Forms::DockStyle::None; + this->movingToolStrip->Location = + System::Drawing::Point(0, 0); + this->movingToolStrip->Name = "movingToolStrip"; + this->movingToolStrip->Raft = + System::Windows::Forms::RaftingSides::Top; + this->movingToolStrip->TabIndex = 2; + this->movingToolStrip->Text = "toolStrip2"; + this->movingToolStrip->Visible = true; + + // + // toolStrip1 + // + this->toolStrip1->Anchor = + System::Windows::Forms::AnchorStyles::Right; + this->toolStrip1->Dock = + System::Windows::Forms::DockStyle::None; + this->toolStrip1->Location = + System::Drawing::Point(0, 0); + this->toolStrip1->Name = "toolStrip1"; + this->toolStrip1->Raft = + System::Windows::Forms::RaftingSides::Top; + this->toolStrip1->Size = System::Drawing::Size(0, 25); + this->toolStrip1->TabIndex = 1; + this->toolStrip1->Text = "toolStrip1"; + this->toolStrip1->Visible = true; + + // + // raftingContainer2 + // + this->raftingContainer2->AutoSize = true; + this->raftingContainer2->Dock = + System::Windows::Forms::DockStyle::Bottom; + this->raftingContainer2->Location = + System::Drawing::Point(9, 257); + this->raftingContainer2->Name = "raftingContainer2"; + this->raftingContainer2->Orientation = + System::Windows::Forms::Orientation::Horizontal; + this->raftingContainer2->RowMargin = + System::Windows::Forms::Padding(0); + this->raftingContainer2->Size = + System::Drawing::Size(274, 0); + this->raftingContainer2->TabIndex = 1; + this->raftingContainer2->Text = + "RaftingContainerRaftingContainerBottom"; + + // + // raftingContainer3 + // + this->raftingContainer3->AutoSize = true; + this->raftingContainer3->Dock = + System::Windows::Forms::DockStyle::Left; + this->raftingContainer3->Location = + System::Drawing::Point(9, 9); + this->raftingContainer3->Name = "raftingContainer3"; + this->raftingContainer3->Orientation = + System::Windows::Forms::Orientation::Vertical; + this->raftingContainer3->RowMargin = + System::Windows::Forms::Padding(0); + this->raftingContainer3->Size = + System::Drawing::Size(0, 248); + this->raftingContainer3->TabIndex = 2; + this->raftingContainer3->Text = + "RaftingContainerRaftingContainerLeft"; + + // + // raftingContainer4 + // + this->raftingContainer4->AutoSize = true; + this->raftingContainer4->Dock = + System::Windows::Forms::DockStyle::Right; + this->raftingContainer4->Location = + System::Drawing::Point(283, 9); + this->raftingContainer4->Name = "raftingContainer4"; + this->raftingContainer4->Orientation = + System::Windows::Forms::Orientation::Vertical; + this->raftingContainer4->RowMargin = + System::Windows::Forms::Padding(0); + this->raftingContainer4->Size = System::Drawing::Size(0, 248); + this->raftingContainer4->TabIndex = 3; + this->raftingContainer4->Text = + "RaftingContainerRaftingContainerRight"; + + // + // + // Form1 + // + this->AutoSize = true; + this->ClientSize = System::Drawing::Size(292, 266); + this->Controls->Add(this->statusStrip1); + this->Controls->Add(this->raftingContainer1); + this->Controls->Add(this->raftingContainer2); + this->Controls->Add(this->raftingContainer3); + this->Controls->Add(this->raftingContainer4); + this->Name = "Form1"; + this->Padding = System::Windows::Forms::Padding(9); + this->Text = "Form1"; + this->ResumeLayout(false); + this->PerformLayout(); + } + + protected: + + /// + /// Clean up any resources being used. + /// + void Dispose(bool disposing) + { + delete components; + __super::Dispose(disposing); + } + + private: + + System::Windows::Forms::StatusStrip^ statusStrip1; + System::Windows::Forms::RaftingContainer^ raftingContainer1; + System::Windows::Forms::RaftingContainer^ raftingContainer2; + System::Windows::Forms::RaftingContainer^ raftingContainer3; + System::Windows::Forms::RaftingContainer^ raftingContainer4; + System::Windows::Forms::ToolStrip^ toolStrip1; + System::Windows::Forms::ToolStrip^ movingToolStrip; + + public: + + Form1() + { + InitializeComponent(); + InitializeMovingToolStrip(); + InitializeBoldButton(); + InitializeStatusStripPanels(); + InitializeDropDownButton(); + InitializeImageButtonWithToolTip(); + } + + private: + + // The following example demonstrates setting the + // drop-down property for a DropDownItem. + // + // Declare the drop-down button and the items it will contain. + ToolStripDropDownButton^ dropDownButton1; + ToolStripDropDown^ dropDown; + ToolStripButton^ buttonRed; + ToolStripButton^ buttonBlue; + ToolStripButton^ buttonYellow; + + void InitializeDropDownButton() + { + dropDownButton1 = gcnew ToolStripDropDownButton; + dropDown = gcnew ToolStripDropDown; + dropDownButton1->Text = "A"; + + // Set the drop-down on the DropDownButton. + dropDownButton1->DropDown = dropDown; + + // Declare three buttons, set their forecolor and text, + // and add the buttons to the drop-down. + buttonRed = gcnew ToolStripButton; + buttonRed->ForeColor = Color::Red; + buttonRed->Text = "A"; + buttonBlue = gcnew ToolStripButton; + buttonBlue->ForeColor = Color::Blue; + buttonBlue->Text = "A"; + buttonYellow = gcnew ToolStripButton; + buttonYellow->ForeColor = Color::Yellow; + buttonYellow->Text = "A"; + buttonBlue->Click += gcnew EventHandler(this, + &Form1::colorButtonsClick); + buttonRed->Click += gcnew EventHandler(this, + &Form1::colorButtonsClick); + buttonYellow->Click += gcnew EventHandler(this, + &Form1::colorButtonsClick); + array^ ToolStrips = + {buttonRed,buttonBlue,buttonYellow}; + dropDown->Items->AddRange(ToolStrips); + toolStrip1->Items->Add(dropDownButton1); + } + + + // Handle the buttons' click event by setting the forecolor + // of the form to the forecolor of the button that is clicked. + void colorButtonsClick(Object^ sender, EventArgs^ e) + { + ToolStripButton^ senderButton = (ToolStripButton^) sender; + this->ForeColor = senderButton->ForeColor; + } + + + // internal: + + // + //Sample for ToolStripButton, ToolStripButton.CheckOnClick, + //ToolStripButton.CheckedChanged, ToolStripButton.Checked + // + ToolStripButton^ boldButton; + + void InitializeBoldButton() + { + boldButton = gcnew ToolStripButton; + boldButton->Text = "B"; + boldButton->CheckOnClick = true; + boldButton->CheckedChanged += gcnew EventHandler(this, + &Form1::boldButtonCheckedChanged); + toolStrip1->Items->Add(boldButton); + } + + void boldButtonCheckedChanged(Object^ sender, EventArgs^ e) + { + if (boldButton->Checked) + { + this->Font= gcnew System::Drawing::Font(this->Font, + FontStyle::Bold); + } + else + { + this->Font = gcnew System::Drawing::Font(this->Font, + FontStyle::Regular); + } + } + + + // internal: + + // + // The following snippet demonstrates ToolStripItem.Image, + // ToolStripItem.ImageAlign, ToolStripItem.ImageScaling, + // ToolStripItem.ImageTransparentColor, ToolStripItem.ToolTipText, + // ToolStripItem.AutoToolTip, ToolStrip.ShowItemToolTips. + // + ToolStripButton^ imageButton; + + void InitializeImageButtonWithToolTip() + { + + // Construct the button and set the image-related properties. + imageButton = gcnew ToolStripButton; + imageButton->Image = + gcnew Bitmap(Timer::typeid,"Timer.bmp"); + imageButton->ImageScaling = + ToolStripItemImageScaling::SizeToFit; + + // Set the background color of the image to be transparent. + imageButton->ImageTransparentColor = + Color::FromArgb(0, 255, 0); + + // Show ToolTip text, set custom ToolTip text, and turn + // off the automatic ToolTips. + toolStrip1->ShowItemToolTips = true; + imageButton->ToolTipText = "Click for the current time"; + imageButton->AutoToolTip = false; + + // Add the button to the ToolStrip. + toolStrip1->Items->Add(imageButton); + } + + + // internal: + + // + // The following snippet demonstrates the ToolStrip.AutoSize, + // ToolStrip.RenderMode, ToolStripItem.TextDirection, + // ToolStripItem.TextAlign, ToolStrip.Raft properties + // + ToolStripButton^ changeDirectionButton; + + void InitializeMovingToolStrip() + { + changeDirectionButton = gcnew ToolStripButton; + movingToolStrip->AutoSize = true; + movingToolStrip->RenderMode = ToolStripRenderMode::System; + changeDirectionButton->TextDirection = + ToolStripTextDirection::Vertical270; + changeDirectionButton->Overflow = + ToolStripItemOverflow::Never; + changeDirectionButton->Text = "Change Alignment"; + movingToolStrip->Items->Add(changeDirectionButton); + changeDirectionButton->Click += gcnew EventHandler(this, + &Form1::changeDirectionButtonClick); + } + + void changeDirectionButtonClick(Object^ sender, EventArgs^ e) + { + ToolStripItem^ item = (ToolStripItem^) sender; + if ((item->TextDirection == ToolStripTextDirection::Vertical270) + || (item->TextDirection == ToolStripTextDirection::Vertical90)) + { + item->TextDirection = ToolStripTextDirection::Horizontal; + movingToolStrip->Raft = RaftingSides::Top; + } + else + { + item->TextDirection = + ToolStripTextDirection::Vertical270; + movingToolStrip->Raft = RaftingSides::Left; + } + } + + + // + // The following snippet can go in the StatusStripPanel and + // StatusStrip overview. + // It also demonstrates StatusStripPanel.BorderSides, + // and StatusStripPanel.BorderStyle. + // + void InitializeStatusStripPanels() + { + + // Create two StatusStripPanel objects to display in the + // StatusBar. + StatusStripPanel^ panel1 = gcnew StatusStripPanel; + StatusStripPanel^ panel2 = gcnew StatusStripPanel; + + // Display the first panel with a sunken border style on all + // sides. + panel1->BorderSides = StatusStripPanelBorderSide::All; + panel1->BorderStyle = Border3DStyle::Sunken; + + // Display the second panel with a raised border style on the + // left side only. + panel2->BorderSides = StatusStripPanelBorderSide::Left; + panel2->BorderStyle = Border3DStyle::Bump; + + // Initialize the text of the panel. + panel1->Text = "Ready..."; + + // Set the text of the panel to the current date. + panel2->Text = DateTime::Today::get().ToLongDateString(); + + + // Add both panels to the StatusBarPanelCollection of the + // StatusBar. + array^ toolStrips = {panel1, panel2}; + statusStrip1->Items->AddRange(toolStrips); + } + + // + void SetCustomRenderer() + { + // + toolStrip1->Renderer = gcnew RedTextRenderer; + // + } + + void SetCustomerRenderInManagerMode() + { + // + toolStrip1->RenderMode = + ToolStripRenderMode::ManagerRenderMode; + ToolStripManager::Renderer = gcnew RedTextRenderer; + // + } + }; +} + +int main() +{ + Application::Run(gcnew ToolStripExamples::Form1()); +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp new file mode 100644 index 00000000000..c35dc17f15b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolStripControlHost/CPP/form1.cpp @@ -0,0 +1,332 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Data; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +/// +/// Summary description for form. +/// + +// The following example shows how to wrap a control +// using ToolStripControlHost. +// +//Declare a class that inherits from ToolStripControlHost. +public ref class ToolStripMonthCalendar: public ToolStripControlHost +{ +public: + // + // Call the base constructor passing in a MonthCalendar instance. + ToolStripMonthCalendar() : ToolStripControlHost( gcnew MonthCalendar ) {} + // + + // + property MonthCalendar^ MonthCalendarControl + { + MonthCalendar^ get() + { + return static_cast(Control); + } + } + // + // + property Day FirstDayOfWeek + { + // Expose the MonthCalendar.FirstDayOfWeek as a property. + Day get() + { + return MonthCalendarControl->FirstDayOfWeek; + } + + void set( Day value ) + { + MonthCalendarControl->FirstDayOfWeek = value; + } + } + + // Expose the AddBoldedDate method. + void AddBoldedDate( DateTime dateToBold ) + { + MonthCalendarControl->AddBoldedDate( dateToBold ); + } + // + +protected: + // Subscribe and unsubscribe the control events you wish to expose. + // + // + void OnSubscribeControlEvents( System::Windows::Forms::Control^ c ) + { + // Call the base so the base events are connected. + __super::OnSubscribeControlEvents( c ); + + // Cast the control to a MonthCalendar control. + MonthCalendar^ monthCalendarControl = (MonthCalendar^)c; + + // Add the event. + monthCalendarControl->DateChanged += gcnew DateRangeEventHandler( this, &ToolStripMonthCalendar::HandleDateChanged ); + } + // + + // + void OnUnsubscribeControlEvents( System::Windows::Forms::Control^ c ) + { + + // Call the base method so the basic events are unsubscribed. + __super::OnUnsubscribeControlEvents( c ); + + // Cast the control to a MonthCalendar control. + MonthCalendar^ monthCalendarControl = (MonthCalendar^)c; + + // Remove the event. + monthCalendarControl->DateChanged -= gcnew DateRangeEventHandler( this, &ToolStripMonthCalendar::HandleDateChanged ); + } + // + // + +public: + event DateRangeEventHandler^ DateChanged; + +private: + // + // Declare the DateChanged event. + // Raise the DateChanged event. + void HandleDateChanged( Object^ sender, DateRangeEventArgs^ e ) + { + if ( DateChanged != nullptr ) + { + DateChanged( this, e ); + } + } + // +}; +// + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + /// + /// Required designer variable. + /// + static System::ComponentModel::IContainer^ components = nullptr; + static ToolStripTextBox^ textbox1; + +public: + Form1() + { + InitializeComponent(); + InitializeDropDownMonthCalendar(); + textbox1 = gcnew ToolStripTextBox; + textbox1->Width = 70; + toolStrip1->Items->Add( textbox1 ); + InitializeDateTimePickerHost(); + } + + static void Main() + { + Application::Run( gcnew Form1 ); + } + +private: + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->toolStrip1 = gcnew System::Windows::Forms::ToolStrip; + this->raftingContainer1 = gcnew System::Windows::Forms::RaftingContainer; + this->raftingContainer2 = gcnew System::Windows::Forms::RaftingContainer; + this->raftingContainer3 = gcnew System::Windows::Forms::RaftingContainer; + this->raftingContainer4 = gcnew System::Windows::Forms::RaftingContainer; + this->SuspendLayout(); + + // + // toolStrip1 + // + this->toolStrip1->Anchor = System::Windows::Forms::AnchorStyles::Right; + this->toolStrip1->Dock = System::Windows::Forms::DockStyle::None; + this->toolStrip1->Location = System::Drawing::Point( 0, 0 ); + this->toolStrip1->Name = L"toolStrip1"; + this->toolStrip1->Raft = System::Windows::Forms::RaftingSides::Top; + this->toolStrip1->TabIndex = 1; + this->toolStrip1->Text = L"toolStrip1"; + this->toolStrip1->Visible = true; + + // + // raftingContainer1 + // + this->raftingContainer1->AutoSize = true; + this->raftingContainer1->Dock = System::Windows::Forms::DockStyle::Top; + this->raftingContainer1->Location = System::Drawing::Point( 9, 9 ); + this->raftingContainer1->Name = L"raftingContainer1"; + this->raftingContainer1->Orientation = System::Windows::Forms::Orientation::Horizontal; + this->raftingContainer1->RowMargin = System::Windows::Forms::Padding( 0 ); + this->raftingContainer1->Size = System::Drawing::Size( 274, 25 ); + this->raftingContainer1->TabIndex = 0; + this->raftingContainer1->Text = L"RaftingContainerRaftingContainerTop"; + this->raftingContainer1->Join( this->toolStrip1 ); + + // + // raftingContainer2 + // + this->raftingContainer2->AutoSize = true; + this->raftingContainer2->Dock = System::Windows::Forms::DockStyle::Bottom; + this->raftingContainer2->Location = System::Drawing::Point( 9, 257 ); + this->raftingContainer2->Name = L"raftingContainer2"; + this->raftingContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal; + this->raftingContainer2->RowMargin = System::Windows::Forms::Padding( 0 ); + this->raftingContainer2->Size = System::Drawing::Size( 274, 0 ); + this->raftingContainer2->TabIndex = 1; + this->raftingContainer2->Text = L"RaftingContainerRaftingContainerBottom"; + + // + // raftingContainer3 + // + this->raftingContainer3->AutoSize = true; + this->raftingContainer3->Dock = System::Windows::Forms::DockStyle::Left; + this->raftingContainer3->Location = System::Drawing::Point( 9, 9 ); + this->raftingContainer3->Name = L"raftingContainer3"; + this->raftingContainer3->Orientation = System::Windows::Forms::Orientation::Vertical; + this->raftingContainer3->RowMargin = System::Windows::Forms::Padding( 0 ); + this->raftingContainer3->Size = System::Drawing::Size( 0, 248 ); + this->raftingContainer3->TabIndex = 2; + this->raftingContainer3->Text = L"RaftingContainerRaftingContainerLeft"; + + // + // raftingContainer4 + // + this->raftingContainer4->AutoSize = true; + this->raftingContainer4->Dock = System::Windows::Forms::DockStyle::Right; + this->raftingContainer4->Location = System::Drawing::Point( 283, 9 ); + this->raftingContainer4->Name = L"raftingContainer4"; + this->raftingContainer4->Orientation = System::Windows::Forms::Orientation::Vertical; + this->raftingContainer4->RowMargin = System::Windows::Forms::Padding( 0 ); + this->raftingContainer4->Size = System::Drawing::Size( 0, 248 ); + this->raftingContainer4->TabIndex = 3; + this->raftingContainer4->Text = L"RaftingContainerRaftingContainerRight"; + + // + // Form1 + // + this->AutoSize = true; + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->raftingContainer1 ); + this->Controls->Add( this->raftingContainer2 ); + this->Controls->Add( this->raftingContainer3 ); + this->Controls->Add( this->raftingContainer4 ); + this->Name = L"Form1"; + this->Padding = System::Windows::Forms::Padding( 9 ); + this->Text = L"Form1"; + this->ResumeLayout( false ); + this->PerformLayout(); + } + +protected: + /// + /// Clean up any resources being used. + /// + void Dispose( bool disposing ) + { + if ( disposing ) + { + if ( components != nullptr ) + { + delete components; + } + } + + __super::Dispose( disposing ); + } + +private: + System::Windows::Forms::ToolStrip^ toolStrip1; + System::Windows::Forms::RaftingContainer^ raftingContainer1; + System::Windows::Forms::RaftingContainer^ raftingContainer2; + System::Windows::Forms::RaftingContainer^ raftingContainer3; + System::Windows::Forms::RaftingContainer^ raftingContainer4; + + // The following snippet demonstrates the ToolStripControlHost(Control) + // consturctor, the ToolStripControlHost.Font, Width, DisplayStyle, + // Text properties. + // + ToolStripControlHost^ dateTimePickerHost; + void InitializeDateTimePickerHost() + { + // Create a new ToolStripControlHost, passing in a control. + dateTimePickerHost = gcnew ToolStripControlHost( gcnew DateTimePicker ); + + // Set the font on the ToolStripControlHost, this will affect the hosted control. + dateTimePickerHost->Font = + gcnew System::Drawing::Font( L"Arial",7.0F,FontStyle::Italic ); + + // Set the Width property, this will also affect the hosted control. + dateTimePickerHost->Width = 100; + dateTimePickerHost->DisplayStyle = ToolStripItemDisplayStyle::Text; + + // Setting the Text property requires a string that converts to a + // DateTime type since that is what the hosted control requires. + dateTimePickerHost->Text = L"12/23/2005"; + + // Cast the Control property back to the original type to set a + // type-specific property. + (dynamic_cast(dateTimePickerHost->Control))->Format = + DateTimePickerFormat::Short; + + // Add the control host to the ToolStrip. + toolStrip1->Items->Add( dateTimePickerHost ); + } + // + + // The following example shows how to set the custom + // ToolStripMonthCalendar control. + // + void InitializeDropDownMonthCalendar() + { + // Declare the drop-down button and the drop-down. + ToolStripDropDownButton^ dropDownButton2 = gcnew ToolStripDropDownButton; + + // Set the image to the MonthCalendar embedded bitmap + // image. + dropDownButton2->Image = + gcnew Bitmap( MonthCalendar::typeid,L"MonthCalendar.bmp" ); + + // Add the button to the ToolStrip. + toolStrip1->Items->Add( dropDownButton2 ); + + // Construct a new drop-down. + ToolStripDropDown^ dropDown = gcnew ToolStripDropDown; + + // Construct a new wrapped MonthCalendar control. + ToolStripMonthCalendar^ monthCalendar = gcnew ToolStripMonthCalendar; + + // Set a date in boldface. + monthCalendar->AddBoldedDate( DateTime::Today.AddDays( 7 ) ); + monthCalendar->DateChanged += gcnew DateRangeEventHandler( + this, &Form1::monthCalendar_DateChanged ); + + //Add the calendar to the drop-down. + dropDown->Items->Add( monthCalendar ); + + //Set the drop-down on the DropDownButton. + dropDownButton2->DropDown = dropDown; + } + +private: + void monthCalendar_DateChanged( Object^ /*sender*/, DateRangeEventArgs^ e ) + { + textbox1->Text = e->Start.ToShortDateString(); + } +}; + +int main() +{ + Form1::Main(); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp new file mode 100644 index 00000000000..35759a3ced8 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.ToolTip.OwnerDraw/CPP/form1.cpp @@ -0,0 +1,155 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +// Form for the ToolTip example. +public ref class ToolTipExampleForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ToolTip^ toolTip1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::Button^ button3; + +public: + ToolTipExampleForm() + { + // Create the ToolTip and set initial values. + this->toolTip1 = gcnew System::Windows::Forms::ToolTip; + this->toolTip1->AutoPopDelay = 5000; + this->toolTip1->InitialDelay = 500; + this->toolTip1->OwnerDraw = true; + this->toolTip1->ReshowDelay = 10; + this->toolTip1->Draw += gcnew DrawToolTipEventHandler( this, &ToolTipExampleForm::toolTip1_Draw ); + + // Create button1 and set initial values. + this->button1 = gcnew System::Windows::Forms::Button; + this->button1->Location = System::Drawing::Point( 8, 8 ); + this->button1->Text = "Button 1"; + this->toolTip1->SetToolTip( this->button1, "Button1 tip text" ); + + // Create button2 and set initial values. + this->button2 = gcnew System::Windows::Forms::Button; + this->button2->Location = System::Drawing::Point( 8, 32 ); + this->button2->Text = "Button 2"; + this->toolTip1->SetToolTip( this->button2, "Button2 tip text" ); + + // Create button3 and set initial values. + this->button3 = gcnew System::Windows::Forms::Button; + this->button3->Location = System::Drawing::Point( 8, 56 ); + this->button3->Text = "Button 3"; + this->toolTip1->SetToolTip( this->button3, "Button3 tip text" ); + + // Set up the Form. + array^temp0 = {this->button1,this->button2,this->button3}; + this->Controls->AddRange( temp0 ); + this->Text = "owner drawn ToolTip example"; + } + +protected: + + ~ToolTipExampleForm() + { + if ( toolTip1 != nullptr ) + { + delete toolTip1; + } + } + + // + // Handles drawing the ToolTip. +private: + void toolTip1_Draw( System::Object^ /*sender*/, System::Windows::Forms::DrawToolTipEventArgs^ e ) + { + // Draw the ToolTip differently depending on which + // control this ToolTip is for. + // + // Draw a custom 3D border if the ToolTip is for button1. + if ( e->AssociatedControl == button1 ) + { + // Draw the standard background. + e->DrawBackground(); + + // Draw the custom border to appear 3-dimensional. + array^ temp1 = {Point(0,e->Bounds.Height - 1),Point(0,0),Point(e->Bounds.Width - 1,0)}; + e->Graphics->DrawLines( SystemPens::ControlLightLight, temp1 ); + array^ temp2 = {Point(0,e->Bounds.Height - 1),Point(e->Bounds.Width - 1,e->Bounds.Height - 1),Point(e->Bounds.Width - 1,0)}; + e->Graphics->DrawLines( SystemPens::ControlDarkDark, temp2 ); + + // Specify custom text formatting flags. + TextFormatFlags sf = static_cast(TextFormatFlags::VerticalCenter | TextFormatFlags::HorizontalCenter | TextFormatFlags::NoFullWidthCharacterBreak); + + // Draw the standard text with customized formatting options. + e->DrawText( sf ); + } + // + // + // Draw a custom background and text if the ToolTip is for button2. + else + + // Draw a custom background and text if the ToolTip is for button2. + if ( e->AssociatedControl == button2 ) + { + // Draw the custom background. + e->Graphics->FillRectangle( SystemBrushes::ActiveCaption, e->Bounds ); + + // Draw the standard border. + e->DrawBorder(); + + // Draw the custom text. + // The using block will dispose the StringFormat automatically. + StringFormat^ sf = gcnew StringFormat; + try + { + sf->Alignment = StringAlignment::Center; + sf->LineAlignment = StringAlignment::Center; + sf->HotkeyPrefix = System::Drawing::Text::HotkeyPrefix::None; + sf->FormatFlags = StringFormatFlags::NoWrap; + System::Drawing::Font^ f = gcnew System::Drawing::Font( "Tahoma",9 ); + try + { + e->Graphics->DrawString( e->ToolTipText, f, SystemBrushes::ActiveCaptionText, e->Bounds, sf ); + } + finally + { + if ( f ) + delete safe_cast(f); + } + + } + finally + { + if ( sf ) + delete safe_cast(sf); + } + } + // + // + // Draw the ToolTip using default values if the ToolTip is for button3. + else if ( e->AssociatedControl == button3 ) + { + e->DrawBackground(); + e->DrawBorder(); + e->DrawText(); + } + // + } + // +}; + +// The main entry point for the application. + +[STAThread] +int main() +{ + Application::Run( gcnew ToolTipExampleForm ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp new file mode 100644 index 00000000000..609f86cd370 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBar/CPP/source.cpp @@ -0,0 +1,73 @@ + + +#using +#using +#using + +// +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TrackBar^ trackBar1; + System::Windows::Forms::TextBox^ textBox1; + +public: + Form1() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->trackBar1 = gcnew System::Windows::Forms::TrackBar; + + // TextBox for TrackBar::Value update. + this->textBox1->Location = System::Drawing::Point( 240, 16 ); + this->textBox1->Size = System::Drawing::Size( 48, 20 ); + + // Set up how the form should be displayed and add the controls to the form. + this->ClientSize = System::Drawing::Size( 296, 62 ); + array^formControls = {this->textBox1,this->trackBar1}; + this->Controls->AddRange( formControls ); + this->Text = "TrackBar Example"; + + // Set up the TrackBar. + this->trackBar1->Location = System::Drawing::Point( 8, 8 ); + this->trackBar1->Size = System::Drawing::Size( 224, 45 ); + this->trackBar1->Scroll += gcnew System::EventHandler( this, &Form1::trackBar1_Scroll ); + + // The Maximum property sets the value of the track bar when + // the slider is all the way to the right. + trackBar1->Maximum = 30; + + // The TickFrequency property establishes how many positions + // are between each tick-mark. + trackBar1->TickFrequency = 5; + + // The LargeChange property sets how many positions to move + // if the bar is clicked on either side of the slider. + trackBar1->LargeChange = 3; + + // The SmallChange property sets how many positions to move + // if the keyboard arrows are used to move the slider. + trackBar1->SmallChange = 2; + } + + +private: + void trackBar1_Scroll( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Display the trackbar value in the text box. + textBox1->Text = String::Concat( "", trackBar1->Value ); + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp new file mode 100644 index 00000000000..f8c59c950bd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarExample/CPP/form1.cpp @@ -0,0 +1,128 @@ + + +#using +#using +#using + +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeTrackBar(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::TextBox^ TextBox1; + System::Windows::Forms::Label ^ Label1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->TextBox1 = gcnew System::Windows::Forms::TextBox; + this->Label1 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + //TextBox1 + // + this->TextBox1->Location = System::Drawing::Point( 112, 88 ); + this->TextBox1->Name = "TextBox1"; + this->TextBox1->ReadOnly = true; + this->TextBox1->Size = System::Drawing::Size( 72, 20 ); + this->TextBox1->TabIndex = 0; + this->TextBox1->Text = ""; + + // + //Label1 + // + this->Label1->Location = System::Drawing::Point( 48, 80 ); + this->Label1->Name = "Label1"; + this->Label1->Size = System::Drawing::Size( 56, 32 ); + this->Label1->TabIndex = 1; + this->Label1->Text = "Number of teams:"; + this->Label1->TextAlign = System::Drawing::ContentAlignment::MiddleRight; + + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Label1 ); + this->Controls->Add( this->TextBox1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + //Declare a new TrackBar object. +internal: + System::Windows::Forms::TrackBar^ TrackBar1; + + // Initialize the TrackBar and add it to the form. +private: + void InitializeTrackBar() + { + this->TrackBar1 = gcnew System::Windows::Forms::TrackBar; + TrackBar1->Location = System::Drawing::Point( 75, 30 ); + + // Set the TickStyle property so there are ticks on both sides + // of the TrackBar. + TrackBar1->TickStyle = TickStyle::Both; + + // Set the minimum and maximum number of ticks. + TrackBar1->Minimum = 10; + TrackBar1->Maximum = 100; + + // Set the tick frequency to one tick every ten units. + TrackBar1->TickFrequency = 10; + + // Associate the event-handling method with the + // ValueChanged event. + TrackBar1->ValueChanged += gcnew System::EventHandler( this, &Form1::TrackBar1_ValueChanged ); + this->Controls->Add( this->TrackBar1 ); + } + + // Handle the TrackBar.ValueChanged event by calculating a value for + // TextBox1 based on the TrackBar value. + void TrackBar1_ValueChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + TextBox1->Text = (System::Math::Round( TrackBar1->Value / 10.0 )).ToString(); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..48b77946c90 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TrackBarRenderer/cpp/form1.cpp @@ -0,0 +1,234 @@ +// This sample can go in TrackBarRenderer class overview. +// - Snippet2 can go in GetTopPointingThumbSize, and possibly other Gets +// - Snippet4 can go in IsSupported, DrawHorizontalTrack, and DrawTopPointingThumb +// - Snippet6 can go in DrawVerticalTick; see below about bug in the meantime, though + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace TrackBarRendererSample +{ + ref class CustomTrackBar : public Control + { + private: + int numberTicks; + Rectangle trackRectangle; + Rectangle ticksRectangle; + Rectangle thumbRectangle; + int currentTickPosition; + float tickSpace; + bool thumbClicked; + TrackBarThumbState thumbState; + + public: + CustomTrackBar(int ticks, System::Drawing::Size trackBarSize) + { + this->Location = Point(10, 10); + this->Size = trackBarSize; + this->numberTicks = ticks; + this->BackColor = Color::DarkCyan; + this->DoubleBuffered = true; + numberTicks = 10; + thumbState = TrackBarThumbState::Normal; + + // Calculate the initial sizes of the bar, + // thumb and ticks. + SetupTrackBar(); + } + + // + // + // Calculate the sizes of the bar, thumb, and ticks rectangle. + private: + void SetupTrackBar() + { + if (!TrackBarRenderer::IsSupported) + { + return; + } + + Graphics^ g = this->CreateGraphics(); + + // Calculate the size of the track bar. + trackRectangle.X = ClientRectangle.X + 2; + trackRectangle.Y = ClientRectangle.Y + 28; + trackRectangle.Width = ClientRectangle.Width - 4; + trackRectangle.Height = 4; + + // Calculate the size of the rectangle in which to + // draw the ticks. + ticksRectangle.X = trackRectangle.X + 4; + ticksRectangle.Y = trackRectangle.Y - 8; + ticksRectangle.Width = trackRectangle.Width - 8; + ticksRectangle.Height = 4; + + tickSpace = ((float)ticksRectangle.Width - 1) / + ((float)numberTicks - 1); + + // Calculate the size of the thumb. + thumbRectangle.Size = + TrackBarRenderer::GetTopPointingThumbSize(g, + TrackBarThumbState::Normal); + + thumbRectangle.X = CurrentTickXCoordinate(); + thumbRectangle.Y = trackRectangle.Y - 8; + } + // + + private: + int CurrentTickXCoordinate() + { + if (tickSpace == 0) + { + return 0; + } + else + { + return ((int)Math::Round(tickSpace) * + currentTickPosition); + } + } + + // + // Draw the track bar. + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + if (!TrackBarRenderer::IsSupported) + { + this->Parent->Text = "CustomTrackBar Disabled"; + return; + } + + this->Parent->Text = "CustomTrackBar Enabled"; + TrackBarRenderer::DrawHorizontalTrack(e->Graphics, + trackRectangle); + TrackBarRenderer::DrawTopPointingThumb(e->Graphics, + thumbRectangle, thumbState); + TrackBarRenderer::DrawHorizontalTicks(e->Graphics, + ticksRectangle, numberTicks, EdgeStyle::Raised); + } + // + + // Determine whether the user has clicked the track bar thumb. + protected: + virtual void OnMouseDown(MouseEventArgs^ e) override + { + if (!TrackBarRenderer::IsSupported) + { + return; + } + if (this->thumbRectangle.Contains(e->Location)) + { + thumbClicked = true; + thumbState = TrackBarThumbState::Pressed; + } + + this->Invalidate(); + } + // + + // Redraw the track bar thumb if the user has moved it. + protected: + virtual void OnMouseUp(MouseEventArgs^ e) override + { + if (!TrackBarRenderer::IsSupported) + { + return; + } + if (thumbClicked) + { + if (e->Location.X > trackRectangle.X && + e->Location.X < (trackRectangle.X + + trackRectangle.Width - thumbRectangle.Width)) + { + thumbClicked = false; + thumbState = TrackBarThumbState::Hot; + this->Invalidate(); + } + + thumbClicked = false; + } + } + + // Track cursor movements. + protected: + virtual void OnMouseMove(MouseEventArgs^ e) override + { + if (!TrackBarRenderer::IsSupported) + { + return; + } + // The user is moving the thumb. + if (thumbClicked) + { + // Track movements to the next tick to the right, if + // the cursor has moved halfway to the next tick. + if (currentTickPosition < numberTicks - 1 && + e->Location.X > CurrentTickXCoordinate() + + (int)(tickSpace)) + { + currentTickPosition++; + } + + // Track movements to the next tick to the left, if + // cursor has moved halfway to the next tick. + else if (currentTickPosition > 0 && + e->Location.X < CurrentTickXCoordinate() - + (int)(tickSpace / 2)) + { + currentTickPosition--; + } + + thumbRectangle.X = CurrentTickXCoordinate(); + } + + // The cursor is passing over the track. + else + { + if (thumbRectangle.Contains(e->Location)) + { + thumbState = TrackBarThumbState::Hot; + } + else + { + thumbState = TrackBarThumbState::Normal; + } + } + + Invalidate(); + } + }; + + ref class Form1 : public Form + { + public: + Form1() + { + CustomTrackBar^ TrackBar1 = gcnew CustomTrackBar(19, + System::Drawing::Size(300, 50)); + this->Width = 500; + this->Controls->Add(TrackBar1); + } + }; +} + +[STAThread] +int main() +{ + // Note that the call to EnableVisualStyles below does + // not affect whether TrackBarRenderer.IsSupported is true; + // as long as visual styles are enabled by the operating system, + // IsSupported is true. + Application::EnableVisualStyles(); + Application::Run(gcnew TrackBarRendererSample::Form1()); + return 0; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp new file mode 100644 index 00000000000..d5a895bd94d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewAndPrintPreview/CPP/form1.cpp @@ -0,0 +1,241 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing::Printing; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + document = gcnew System::Drawing::Printing::PrintDocument; + InitializeComponent(); + InitializeTreeView(); + InitializePrintPreviewDialog(); + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + +internal: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::Button^ Button1; + System::Windows::Forms::TreeView^ TreeView1; + +private: + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + this->Button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + this->Button1->Location = System::Drawing::Point( 192, 104 ); + this->Button1->Name = "Button1"; + this->Button1->Size = System::Drawing::Size( 72, 32 ); + this->Button1->TabIndex = 0; + this->Button1->Text = "Print Preview"; + this->Button1->Click += gcnew System::EventHandler( this, &Form1::Button1_Click ); + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Controls->Add( this->Button1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // +private: + void InitializeTreeView() + { + + // Construct the TreeView object. + this->TreeView1 = gcnew System::Windows::Forms::TreeView; + + // Set dock, location, size name, and tab order + // values for the TreeView object. + TreeView1->Dock = System::Windows::Forms::DockStyle::Left; + TreeView1->Location = System::Drawing::Point( 0, 0 ); + TreeView1->Name = "TreeView1"; + TreeView1->Size = System::Drawing::Size( 152, 266 ); + TreeView1->TabIndex = 1; + + // Associate the event-handling methods with the + // BeforeLabeEdit and the AfterSelect events. + TreeView1->BeforeLabelEdit += gcnew NodeLabelEditEventHandler( this, &Form1::TreeView1_BeforeLabelEdit ); + TreeView1->AfterSelect += gcnew TreeViewEventHandler( this, &Form1::TreeView1_AfterSelect ); + + // Set the LabelEdit property to true to allow the + // user to edit the TreeNode text. + this->TreeView1->LabelEdit = true; + + // Declare and create objects needed to populate + // the TreeView. + array^files = {"bigPresentation.ppt","myFinances.xls","myResume.doc"}; + ; + String^ filePath = "c:\\myFiles"; + System::Collections::ArrayList^ nodes = gcnew System::Collections::ArrayList; + + // Create a node for each file, setting the Text property to the + // file's name and the Tag property to file's fully-qualified name. + System::Collections::IEnumerator^ myEnum = files->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ file = safe_cast(myEnum->Current); + TreeNode^ node = gcnew TreeNode( file ); + node->Tag = String::Concat( filePath, "\\", file ); + nodes->Add( node ); + } + + array^treeNodes = gcnew array(nodes->Count); + nodes->CopyTo( treeNodes ); + + // Create a new node named topNode and add the ArrayList of + // nodes to topNode. + TreeNode^ topNode = gcnew TreeNode( "myFiles",treeNodes ); + topNode->Tag = filePath; + + // Add topNode to the TreeView. + TreeView1->Nodes->Add( topNode ); + + // Add the TreeView to the form. + this->Controls->Add( TreeView1 ); + } + + void TreeView1_BeforeLabelEdit( Object^ /*sender*/, NodeLabelEditEventArgs^ e ) + { + + // Determine whether the user has selected the top node. If so, + // change the CancelEdit property to true to cancel the edit. + if ( e->Node == TreeView1->TopNode ) + { + e->CancelEdit = true; + MessageBox::Show( "You are not allowed to edit the top node" ); + } + + } + // + + // +private: + // Handle the After_Select event. + void TreeView1_AfterSelect( System::Object^ /*sender*/, System::Windows::Forms::TreeViewEventArgs^ e ) + { + + // Vary the response depending on which TreeViewAction + // triggered the event. + switch ( (e->Action) ) + { + case TreeViewAction::ByKeyboard: + MessageBox::Show( "You like the keyboard!" ); + break; + + case TreeViewAction::ByMouse: + MessageBox::Show( "You like the mouse!" ); + break; + } + } + // + + // The following code example assumes the form contains a TreeView + // object named TreeView1 that contains TreeNode objects. Each + // TreeNode objects Tag property must be set to a fully-qualified + // document name that can be accessed by the machine running the + // example. Set each Text property to a string that identifies + // the file specified by the Tag property. For example, you could set + // TreeNode1.Tag to c:\myDocuments\recipe.doc and + // TreeNode1.Text to recipe.doc. + // It also assumes the form contains a PrintPreviewDialog object + // named PrintPreviewDialog1 and a button named Button1. To run this + // example call the InitializePrintPreviewDialog method in the form's + // constructor. + + // + // Declare the dialog. +internal: + PrintPreviewDialog^ PrintPreviewDialog1; + +private: + + // Declare a PrintDocument object named document. + System::Drawing::Printing::PrintDocument^ document; + + // Initialize the dialog. + void InitializePrintPreviewDialog() + { + + // Create a new PrintPreviewDialog using constructor. + this->PrintPreviewDialog1 = gcnew PrintPreviewDialog; + + //Set the size, location, and name. + this->PrintPreviewDialog1->ClientSize = System::Drawing::Size( 400, 300 ); + this->PrintPreviewDialog1->Location = System::Drawing::Point( 29, 29 ); + this->PrintPreviewDialog1->Name = "PrintPreviewDialog1"; + + // Associate the event-handling method with the + // document's PrintPage event. + this->document->PrintPage += gcnew System::Drawing::Printing::PrintPageEventHandler( this, &Form1::document_PrintPage ); + + // Set the minimum size the dialog can be resized to. + this->PrintPreviewDialog1->MinimumSize = System::Drawing::Size( 375, 250 ); + + // Set the UseAntiAlias property to true, which will allow the + // operating system to smooth fonts. + this->PrintPreviewDialog1->UseAntiAlias = true; + } + + void Button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( TreeView1->SelectedNode != nullptr ) + { + document->DocumentName = TreeView1->SelectedNode->Tag->ToString(); + } + + // Set the PrintPreviewDialog.Document property to + // the PrintDocument object selected by the user. + PrintPreviewDialog1->Document = document; + + // Call the ShowDialog method. This will trigger the document's + // PrintPage event. + PrintPreviewDialog1->ShowDialog(); + } + + void document_PrintPage( Object^ /*sender*/, System::Drawing::Printing::PrintPageEventArgs^ e ) + { + + // Insert code to render the page here. + // This code will be called when the PrintPreviewDialog.Show + // method is called. + // The following code will render a simple + // message on the document in the dialog. + String^ text = "In document_PrintPage method."; + System::Drawing::Font^ printFont = gcnew System::Drawing::Font( "Arial",35,System::Drawing::FontStyle::Regular ); + e->Graphics->DrawString( text, printFont, System::Drawing::Brushes::Black, 0, 0 ); + } + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp new file mode 100644 index 00000000000..14b81d94cfd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewExample/CPP/form1.cpp @@ -0,0 +1,133 @@ + + +#using +#using +#using + +// This snippet shows the use of some TreeView properties. +using namespace System::Windows::Forms; +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + : Form() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + InitializeTreeView(); + + //Add any initialization after the InitializeComponent() call + } + + +protected: + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //Required by the Windows Form Designer + System::ComponentModel::IContainer^ components; + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + + [System::Diagnostics::DebuggerStepThrough] + void InitializeComponent() + { + // + //Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + // + // Declare the TreeView control. +internal: + System::Windows::Forms::TreeView^ TreeView1; + +private: + // Initialize the TreeView to blend with the form, giving it the + // same color as the form and no border. + void InitializeTreeView() + { + // Create a new TreeView control and set the location and size. + this->TreeView1 = gcnew System::Windows::Forms::TreeView; + this->TreeView1->Location = System::Drawing::Point( 72, 48 ); + this->TreeView1->Size = System::Drawing::Size( 200, 200 ); + + // Set the BorderStyle property to none, the BackColor property to + // the form's backcolor, and the Scrollable property to false. + // This allows the TreeView to blend in form. + this->TreeView1->BorderStyle = BorderStyle::None; + this->TreeView1->BackColor = this->BackColor; + this->TreeView1->Scrollable = false; + + // Set the HideSelection property to false to keep the + // selection highlighted when the user leaves the control. + // This helps it blend with form. + this->TreeView1->HideSelection = false; + + // Set the ShowRootLines and ShowLines properties to false to + // give the TreeView a list-like appearance. + this->TreeView1->ShowRootLines = false; + this->TreeView1->ShowLines = false; + + // Add the nodes. + array^temp0 = {gcnew TreeNode( "Full Color" ),gcnew TreeNode( "Project Wizards" ),gcnew TreeNode( "Visual C# and Visual Basic Support" )}; + array^temp1 = {gcnew TreeNode( "Pentium 133 MHz or faster processor " ),gcnew TreeNode( "Windows 98 or later" ),gcnew TreeNode( "100 MB Disk space" )}; + array^temp2 = {gcnew TreeNode( "Features",temp0 ),gcnew TreeNode( "System Requirements",temp1 )}; + this->TreeView1->Nodes->AddRange( temp2 ); + + // Set the tab index and add the TreeView to the form. + this->TreeView1->TabIndex = 0; + this->Controls->Add( this->TreeView1 ); + } + // + + // + System::Windows::Forms::TreeView^ TreeView2; + + // Initialize the TreeView to blend with the form, giving it the + // same color as the form and no border. + void InitializeSelectedTreeView() + { + + // Create a new TreeView control and set the location and size. + this->TreeView2 = gcnew System::Windows::Forms::TreeView; + this->TreeView2->Location = System::Drawing::Point( 72, 48 ); + this->TreeView2->Size = System::Drawing::Size( 200, 200 ); + this->TreeView2->BorderStyle = BorderStyle::Fixed3D; + + // Set the HideSelection property to false to keep the + // selection highlighted when the user leaves the control. + this->TreeView1->HideSelection = false; + + // Add the nodes. + array^temp0 = {gcnew TreeNode( "Full Color" ),gcnew TreeNode( "Project Wizards" ),gcnew TreeNode( "Visual C# and Visual Basic Support" )}; + array^temp1 = {gcnew TreeNode( "Pentium 133 MHz or faster processor " ),gcnew TreeNode( "Windows 98 or later" ),gcnew TreeNode( "100 MB Disk space" )}; + array^temp2 = {gcnew TreeNode( "Features",temp0 ),gcnew TreeNode( "System Requirements",temp1 )}; + this->TreeView1->Nodes->AddRange( temp2 ); + + // Set the tab index and add the TreeView to the form. + this->TreeView1->TabIndex = 0; + this->Controls->Add( this->TreeView1 ); + } + + // +}; + +[System::STAThreadAttribute] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp new file mode 100644 index 00000000000..0373e435aa4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.TreeViewWhidbeyMembers/cpp/Form1.cpp @@ -0,0 +1,267 @@ +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; +using namespace System::Collections; + +//Create a Class that inherits from System.Windows.Forms.Form. +public ref class TreeViewWhidbeyMembersExample : + public System::Windows::Forms::Form +{ +public: + TreeViewWhidbeyMembersExample() + { + InitializeComponent(); + //InitializeStatefulTreeView(); + //InitializeTreeViewWithToolTips(); + InitializeInitialTreeView(); + initialTreeView->MouseDown += gcnew MouseEventHandler(this, + &TreeViewWhidbeyMembersExample::InitialTreeView_MouseDown); + initialTreeView->NodeMouseClick += + gcnew TreeNodeMouseClickEventHandler(this, + &TreeViewWhidbeyMembersExample::InitialTreeView_NodeMouseClick); + initialTreeView->NodeMouseDoubleClick += + gcnew TreeNodeMouseClickEventHandler(this, + &TreeViewWhidbeyMembersExample::InitialTreeView_NodeMouseDoubleClick); + initialTreeView->NodeMouseHover += + gcnew TreeNodeMouseHoverEventHandler(this, + &TreeViewWhidbeyMembersExample::InitialTreeView_NodeMouseHover); + //InitializeLineTreeView(); + } + + // + // Create a node sorter that implements the IComparer interface. +private: + ref class NodeSorter : public IComparer + { + // Compare the length of the strings, or the strings + // themselves, if they are the same length. + public: + virtual int Compare(Object^ x, Object^ y) + { + TreeNode^ tx = (TreeNode^)x; + TreeNode^ ty = (TreeNode^)y; + + // Compare the length of the strings, returning the difference. + if (tx->Text->Length != ty->Text->Length) + { + return (tx->Text->Length - ty->Text->Length); + } + + // If they are the same length, call Compare. + return String::Compare(tx->Text, ty->Text); + } + }; + + // Declare the TreeView. +private: + TreeView^ initialTreeView; +private: + TextBox^ displayNodes; +private: + Button^ setSorter; + +private: + void InitializeInitialTreeView() + { + // Create the TreeView + initialTreeView = gcnew TreeView(); + initialTreeView->Size = System::Drawing::Size(200, 200); + + // Create the button and set some basic properties. + setSorter = gcnew Button(); + setSorter->Location = Point(205, 138); + setSorter->Text = "Set Sorter"; + + // Handle the click event for the button. + setSorter->Click += gcnew EventHandler(this, + &TreeViewWhidbeyMembersExample::SetSorter_Click); + + // Create the root nodes. + TreeNode^ docNode = gcnew TreeNode("Documents"); + TreeNode^ spreadSheetNode = gcnew TreeNode("Spreadsheets"); + + // Add some additional nodes. + spreadSheetNode->Nodes->Add("payroll.xls"); + spreadSheetNode->Nodes->Add("checking.xls"); + spreadSheetNode->Nodes->Add("tracking.xls"); + docNode->Nodes->Add("phoneList.doc"); + docNode->Nodes->Add("resume.doc"); + + // Add the root nodes to the TreeView. + initialTreeView->Nodes->Add(spreadSheetNode); + initialTreeView->Nodes->Add(docNode); + + // Add the TreeView to the form. + this->Controls->Add(initialTreeView); + this->Controls->Add(setSorter); + } + + // Set the TreeViewNodeSorter property to a new instance + // of the custom sorter. +private: + void SetSorter_Click(Object^ sender, EventArgs^ e) + { + initialTreeView->TreeViewNodeSorter = gcnew NodeSorter(); + } + // + + // The following code example demonstrates setting the TreeNode line color. + // To run this example, paste the code into a Windows Form. Call + // InitializeLineTreeView from the form's constructor or Load + // event handling method. + // +private: + TreeView^ lineTreeView; + +public: + void InitializeLineTreeView() + { + lineTreeView = gcnew TreeView(); + lineTreeView->Size = System::Drawing::Size(200, 200); + + lineTreeView->LineColor = Color::Red; + + // Create the root nodes. + TreeNode^ docNode = gcnew TreeNode("Documents"); + + // Add some additional nodes. + docNode->Nodes->Add("phoneList.doc"); + docNode->Nodes->Add("resume.doc"); + + lineTreeView->Nodes->Add(docNode); + this->Controls->Add(lineTreeView); + } + // + +private: + void InitializeComponent() + { + this->displayNodes = gcnew System::Windows::Forms::TextBox(); + this->SuspendLayout(); + // + // textBox1 + // + this->displayNodes->Location = System::Drawing::Point(180, 93); + this->displayNodes->Name = "textBox1"; + this->displayNodes->TabIndex = 0; + // + // Form1 + // + this->AutoScaleBaseSize = System::Drawing::Size(5, 13); + this->ClientSize = System::Drawing::Size(292, 266); + this->Controls->Add(this->displayNodes); + this->Name = "Form1"; + this->ResumeLayout(false); + this->PerformLayout(); + } + + // The following example code demonstrates how to use the TreeNode.Level, + // TreeViewHitTestInfo.Node and TreeView.HitTest members. + // To run this example create a Windows Form that contains a TreeView + // named treeView1 and populate it with several levels of nodes. + // Paste the following code into the form and associate the MouseDown + // event of treeView1 with the treeView1_MouseDown method in this example. + // +private: + void InitialTreeView_MouseDown(Object^ sender, MouseEventArgs^ e) + { + TreeViewHitTestInfo^ info = initialTreeView->HitTest(e->X, e->Y); + TreeNode^ hitNode; + + if (info->Node != nullptr) + { + hitNode = info->Node; + MessageBox::Show(hitNode->Level.ToString()); + } + } + // + + // The following example demonstrates how to handle the NodeMouseClick + // event. + // +private: + void InitialTreeView_NodeMouseClick(Object^ sender, + TreeNodeMouseClickEventArgs^ e) + { + displayNodes->Text = e->Node->Text; + } + // + + // The following example demonstrates how to handle the + // NodeMouseDoubleClick event and how to use the TreeNodeMouse- + // ClickEventArgs.To run this example, paste the code into a Windows Form + // that contains a TreeView named treeView1. Populate the treeView1 with + // the names of files located in the c:\ directly of the system the sample + // is running on, and associate the NodeMouseDoubleClick event of treeView1 + // with the treeView1_NodeMouseDoubleClick method in this example. + // + // If a node is double-clicked, open the file indicated by the TreeNode. +private: + void InitialTreeView_NodeMouseDoubleClick(Object^ sender, + TreeNodeMouseClickEventArgs^ e) + { + try + { + // Look for a file extension. + if (e->Node->Text->Contains(".")) + { + System::Diagnostics::Process::Start("c:\\" + e->Node->Text); + } + } + // If the file is not found, handle the exception and inform the user. + catch (System::ComponentModel::Win32Exception^) + { + MessageBox::Show("File not found."); + } + } + // + + // The following example demonstrates how to handle the + // NodeMouseHover event. + // +private: + void InitialTreeView_NodeMouseHover(Object^ sender, + TreeNodeMouseHoverEventArgs^ e) + { + e->Node->Toggle(); + } + // + + // The following code example demonstrates the StateImageList + // property. To run this example, paste the code into a Windows + // Form and call InitializeCheckTreeView from the form's + // constructor or Load event-handling method. + // + TreeView^ checkTreeView; +private: + void InitializeCheckTreeView() + { + checkTreeView = gcnew TreeView(); + + // Show check boxes for the TreeView. This + // will cause the StateImageList to be used. + checkTreeView->CheckBoxes = true; + + // Create the StateImageList and add two images. + checkTreeView->StateImageList = gcnew ImageList(); + checkTreeView->StateImageList->Images->Add(SystemIcons::Question); + checkTreeView->StateImageList->Images->Add(SystemIcons::Exclamation); + + // Add some nodes to the TreeView and the TreeView to the form. + checkTreeView->Nodes->Add("Node1"); + checkTreeView->Nodes->Add("Node2"); + this->Controls->Add(checkTreeView); + } + // +}; + +[STAThreadAttribute] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew TreeViewWhidbeyMembersExample()); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp new file mode 100644 index 00000000000..fa090410e9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleElement/cpp/form1.cpp @@ -0,0 +1,384 @@ +// This sample can go in the VisualStyleElement class overview or a conceptual +// topic to give the new user a chance to view what each of the defined +// elements looks like. This sample also gives them the ability to preview each +// element at three different sizes. + +// +#using +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::Drawing; +using namespace System::Collections::Generic; +using namespace System::Reflection; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace VisualStyleElementViewer +{ + public ref class ElementViewer : public UserControl + { + private: + VisualStyleElement^ element; + VisualStyleRenderer^ renderer; + Dictionary^ elementDictionary; + Rectangle descriptionRect; + Rectangle displayRect; + Rectangle displayRectFull; + System::Drawing::Size currentTrueSize; + StringBuilder^ elementDescription; + Label^ infoLabel; + TreeView^ treeView; + DomainUpDown^ domainUpDown; + bool drawElement; + + public: + ElementViewer():UserControl() + { + elementDictionary = + gcnew Dictionary(); + currentTrueSize = System::Drawing::Size(); + elementDescription = gcnew StringBuilder(); + infoLabel = gcnew Label(); + treeView = gcnew TreeView(); + domainUpDown = gcnew DomainUpDown(); + + this->Location = Point(10, 10); + this->Size = System::Drawing::Size(650, 500); + this->Text = "VisualStyleElement Viewer"; + this->Font = SystemFonts::IconTitleFont; + this->BackColor = Color::White; + this->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + this->AutoSize = true; + this->Load += gcnew EventHandler(this, + &ElementViewer::ElementViewer_Load); + } + + private: + void ElementViewer_Load(Object^ sender, EventArgs^ e) + { + // Make sure the visual styles are enabled before + // going any further. + if (!Application::RenderWithVisualStyles) + { + return; + } + + infoLabel->Location = Point(320, 10); + infoLabel->Size = System::Drawing::Size(300, 60); + infoLabel->Text = "Expand the element class nodes " + + "in the tree view to access visual style elements. " + + "Click an element name to draw the element below. To " + + "change the size of a resizable element, use the " + + "spin control."; + + domainUpDown->Location = Point(320, 80); + domainUpDown->Size = System::Drawing::Size(70, 30); + domainUpDown->ReadOnly = true; + domainUpDown->Items->Add(elementSizes::Large); + domainUpDown->Items->Add(elementSizes::Medium); + domainUpDown->Items->Add(elementSizes::TrueSize); + domainUpDown->SelectedIndex = 2; + domainUpDown->SelectedItemChanged += + gcnew EventHandler(this, + &ElementViewer::DomainUpDown_SelectedItemChanged); + domainUpDown->DownButton(); + + descriptionRect = Rectangle(320, 120, 250, 50); + displayRect = Rectangle(320, 160, 0, 0); + displayRectFull = Rectangle(320, 160, 300, 200); + + // Initialize the element and renderer to known good values. + element = VisualStyleElement::Button::PushButton::Normal; + renderer = gcnew VisualStyleRenderer(element); + + SetupElementCollection(); + SetupTreeView(); + + this->Controls->AddRange(gcnew array{treeView, + domainUpDown, infoLabel }); + } + + // Use reflection to build a Dictionary of all + // VisualStyleElement objects exposed in the + // System.Windows.Forms.VisualStyles namespace. + private: + void SetupElementCollection() + { + StringBuilder^ elementName = gcnew StringBuilder(); + VisualStyleElement^ currentElement; + int plusSignIndex = 0; + + // Get array of first-level nested types within + // VisualStyleElement; these are the element classes. + array^ elementClasses = + VisualStyleElement::typeid->GetNestedTypes(); + + for each (Type^ elementClass in elementClasses) + { + // Get an array of second-level nested types within + // VisualStyleElement; these are the element parts. + array^ elementParts = elementClass->GetNestedTypes(); + + // Get the index of the first '+' character in + // the full element class name. + plusSignIndex = elementClass->FullName->IndexOf('+'); + + for each (Type^ elementPart in elementParts) + { + // Get an array of static property details + // for the current type. Each of these types have + // properties that return VisualStyleElement objects. + array^ elementProperties = + elementPart->GetProperties(BindingFlags::Static | + BindingFlags::Public); + + // For each property, insert the unique full element + // name and the element into the collection. + for each(PropertyInfo^ elementProperty in + elementProperties) + { + // Get the element. + currentElement = + (VisualStyleElement^)elementProperty-> + GetValue(nullptr, BindingFlags::Static, nullptr, + nullptr, nullptr); + + // Append the full element name. + elementName->Append(elementClass->FullName, + plusSignIndex + 1, + elementClass->FullName->Length - + plusSignIndex - 1); + elementName->Append("." + + elementPart->Name + "." + + elementProperty->Name); + + // Add the element and element name to + // the Dictionary. + elementDictionary->Add(elementName->ToString(), + currentElement); + + // Clear the element name for the + // next iteration. + elementName->Remove(0, elementName->Length); + } + } + } + } + + // Initialize the tree view with the element names. + private: + void SetupTreeView() + { + treeView->Location = Point(10, 10); + treeView->Size = System::Drawing::Size(300, 450); + // treeView->BorderStyle = BorderStyle.FixedSingle; + treeView->BackColor = Color::WhiteSmoke; + treeView->SelectedNode = nullptr; + treeView->AfterSelect += + gcnew TreeViewEventHandler(this, + &ElementViewer::TreeView_AfterSelect); + + treeView->BeginUpdate(); + + // An index into the top-level tree nodes. + int nodeIndex = 0; + + // An index into the first '.' character in an element name. + int firstDotIndex = 0; + + // Initialize the element class name to compare + // with the class name of the first element + // in the Dictionary, and set this name to the first + // top-level node. + StringBuilder^ compareClassName = + gcnew StringBuilder("Button"); + treeView->Nodes->Add( + gcnew TreeNode(compareClassName->ToString())); + + // The current element class name. + StringBuilder^ currentClassName = gcnew StringBuilder(); + + // The text for each second-level node. + StringBuilder^ nodeText = gcnew StringBuilder(); + + for each(KeyValuePair^ entry + in elementDictionary) + { + // Isolate the class name of the current element. + firstDotIndex = entry->Key->IndexOf('.'); + currentClassName->Append(entry->Key, 0, firstDotIndex); + + // Determine whether we need to increment to the next + // element class. + if (currentClassName->ToString() != + compareClassName->ToString()) + { + // Increment the index to the next top-level node + // in the tree view. + nodeIndex++; + + // Get the new class name to compare with. + compareClassName->Remove(0, compareClassName->Length); + compareClassName->Append(entry->Key); + compareClassName->Remove(firstDotIndex, + compareClassName->Length - firstDotIndex); + + // Add a new top-level node to the tree view. + treeView->Nodes->Add( + gcnew TreeNode(compareClassName->ToString())); + } + + // Get the text for the new second-level node. + nodeText->Append(entry->Key, firstDotIndex + 1, + entry->Key->Length - firstDotIndex - 1); + + // Create and insert the new second-level node. + TreeNode^ newNode = gcnew TreeNode(nodeText->ToString()); + newNode->Name = entry->Key; + treeView->Nodes[nodeIndex]->Nodes->Add(newNode); + + currentClassName->Remove(0, currentClassName->Length); + nodeText->Remove(0, nodeText->Length); + } + treeView->EndUpdate(); + } + + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + // Do nothing further if visual styles are disabled. + if (!Application::RenderWithVisualStyles) + { + this->Text = "Visual styles are disabled."; + TextRenderer::DrawText(e->Graphics, this->Text, this->Font, + this->Location, this->ForeColor); + return; + } + + // Draw the element description. + TextRenderer::DrawText(e->Graphics, elementDescription->ToString(), + this->Font, descriptionRect, this->ForeColor, + TextFormatFlags::WordBreak); + + // Draw the element, if an element is selected. + if (drawElement) + { + renderer->DrawBackground(e->Graphics, this->displayRect); + } + } + + // Set the element to draw. + private: + void TreeView_AfterSelect(Object^ sender, TreeViewEventArgs^ e) + { + // Clear the element description. + elementDescription->Remove(0, elementDescription->Length); + + // If the user clicked a first-level node, disable drawing. + if (e->Node->Nodes->Count > 0) + { + drawElement = false; + elementDescription->Append("No element is selected"); + domainUpDown->Enabled = false; + } + + // The user clicked an element node. + else + { + // Add the element name to the description. + elementDescription->Append(e->Node->Text); + + // Get the element that corresponds to the selected + // node's name. + String^ key = e->Node->Name; + element = elementDictionary[key]; + + // Disable resizing if the element is not defined. + if (!VisualStyleRenderer::IsElementDefined(element)) + { + drawElement = false; + elementDescription->Append(" is not defined."); + domainUpDown->Enabled = false; + } + else + { + // Set the element to the renderer. + drawElement = true; + renderer->SetParameters(element); + elementDescription->Append(" is defined."); + + // Get the system-defined size of the element. + Graphics^ g = this->CreateGraphics(); + currentTrueSize = renderer->GetPartSize(g, + ThemeSizeType::True); + delete g; + displayRect.Size = currentTrueSize; + + domainUpDown->Enabled = true; + domainUpDown->SelectedIndex = 2; + } + } + + Invalidate(); + } + + // Resize the element display area. + private: + void DomainUpDown_SelectedItemChanged(Object^ sender, + EventArgs^ e) + { + switch ((int)domainUpDown->SelectedItem) + { + case this->elementSizes::TrueSize: + displayRect.Size = currentTrueSize; + break; + case this->elementSizes::Medium: + displayRect.Size = + System::Drawing::Size(displayRectFull.Width / 2, + displayRectFull.Height / 2); + break; + case this->elementSizes::Large: + displayRect.Size = displayRectFull.Size; + break; + } + + Invalidate(); + } + + // These values represent the options in the UpDown control. + private: + enum class elementSizes + { + TrueSize, + Medium, + Large + }; + }; + public ref class ElementViewerForm : public Form + { + public: + ElementViewerForm() + { + ElementViewer^ elementViewer = gcnew ElementViewer(); + this->Controls->Add(elementViewer); + this->Text = elementViewer->Text; + this->Size = System::Drawing::Size(700, 550); + } + }; +} + +using namespace VisualStyleElementViewer; + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew ElementViewerForm()); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp new file mode 100644 index 00000000000..07e9572f8c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleInformation/cpp/form1.cpp @@ -0,0 +1,73 @@ +// +// This is a simple example for VisualStyleInformation that displays +// all of the visual style values in a ListView. + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Text; +using namespace System::Reflection; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace VisualStyleInformationSample +{ + public ref class StyleInfo : public Form + { + private: + ListView^ displayStyleInfo; + + public: + StyleInfo() + { + this->displayStyleInfo = gcnew ListView(); + this->ClientSize = System::Drawing::Size(500, 500); + this->Text = "VisualStyleInformation Property Values"; + + displayStyleInfo->Bounds = System::Drawing::Rectangle + (System::Drawing::Point(10, 10),System::Drawing::Size(400, 300)); + displayStyleInfo->View = View::Details; + displayStyleInfo->FullRowSelect = true; + displayStyleInfo->Sorting = SortOrder::Ascending; + + Type^ typeInfo = VisualStyleInformation::typeid; + Object^ propertyValue; + + // Declare an array of static/Shared property details for the + // VisualStyleInformation class. + array^ elementProperties = typeInfo->GetProperties + (BindingFlags::Static | BindingFlags::Public); + + String^ name; + // Insert each property name and value into the ListView. + for each (PropertyInfo^ property in elementProperties) + { + name = property->Name; + propertyValue = property->GetValue(nullptr, + BindingFlags::Static, nullptr, nullptr, nullptr); + ListViewItem^ newItem = gcnew ListViewItem(name, 0); + newItem->SubItems->Add(propertyValue->ToString()); + displayStyleInfo->Items->Add(newItem); + } + + // Create columns for the items and subitems. + displayStyleInfo->Columns->Add("Property", -2, + System::Windows::Forms::HorizontalAlignment::Left); + displayStyleInfo->Columns->Add("Value", -2, + System::Windows::Forms::HorizontalAlignment::Left); + + // Add the ListView to the control collection. + this->Controls->Add(displayStyleInfo); + } + }; +} + +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew VisualStyleInformationSample::StyleInfo()); +} +// \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp new file mode 100644 index 00000000000..52a2bd32b23 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleRenderer/cpp/form1.cpp @@ -0,0 +1,438 @@ +// This sample might go in a VisualStyleRenderer conceptual topic, +// or the VisualStyleRenderer class itself. The sample defines a custom control +// that imitates a window using VisualStyleElements +// for the window parts. It handles resizing and moving the window. + +// This sample uses the following VisualStyleRenderer members: +// Snippet10: VisualStyleRenderer.GetPartSize (with ThemeSizeType.True) +// Snippet10: VisualStyleRenderer.GetPoint (with PointProperty.Offset) +// Snippet20: VisualStyleRenderer.DrawBackground +// Snippet30: VisualStyleRenderer.GetBackgroundRegion +// Snippet40: VisualStyleRenderer.IsElementDefined +// Snippet40: VisualStyleRenderer(VisualStyleElement) constructor +// Snippet40: VisualStyleRenderer.SetParameters + +// Work Items: - Try to make HitTestBackground method work in MouseDown event handler. +// - Why does the offset value obtained for the close button make it draw a bit +// too far to the right? +// - Right now I'm hard-coding the height of the status bar rect to 22, which +// visual matches the standard Windows version. Doing GetPartSize on this +// part only returns a height of 15, which is way to short; is this a bug? + + +// +#using +#using +#using + +using namespace System; +using namespace System::Text; +using namespace System::Drawing; +using namespace System::Drawing::Drawing2D; +using namespace System::Collections::Generic; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace VisualStyleRendererSample +{ + + public ref class WindowSimulation : public Control + { + private: + Dictionary^ windowElements; + Dictionary^ elementRectangles; + VisualStyleRenderer^ renderer; + Point closeButtonOffset; + System::Drawing::Size gripperSize; + System::Drawing::Size closeButtonSize; + bool isResizing; + bool isMoving; + bool isClosing; + int captionHeight; + int frameThickness; + int statusHeight; + Point originalClick; + Point resizeOffset; + + public: + WindowSimulation() : Control() + { + statusHeight = 22; + windowElements = gcnew Dictionary(); + elementRectangles = gcnew Dictionary(); + this->Location = Point(50, 50); + this->Size = System::Drawing::Size(350, 300); + this->BackColor = Color::Azure; + this->DoubleBuffered = true; + this->MinimumSize = System::Drawing::Size(300, 200); + this->Font = SystemFonts::CaptionFont; + this->Text = "Simulated Window"; + + // Insert the VisualStyleElement objects into the Dictionary. + windowElements->Add("windowCaption", + VisualStyleElement::Window::Caption::Active); + windowElements->Add("windowBottom", + VisualStyleElement::Window::FrameBottom::Active); + windowElements->Add("windowLeft", + VisualStyleElement::Window::FrameLeft::Active); + windowElements->Add("windowRight", + VisualStyleElement::Window::FrameRight::Active); + windowElements->Add("windowClose", + VisualStyleElement::Window::CloseButton::Normal); + windowElements->Add("statusBar", + VisualStyleElement::Status::Bar::Normal); + windowElements->Add("statusGripper", + VisualStyleElement::Status::Gripper::Normal); + + // Get the sizes and location offsets for the window parts + // as specified by the visual style, and then use this + // information to calcualate the rectangles for each part. + GetPartDetails(); + CalculateRectangles(); + + this->MouseDown += + gcnew MouseEventHandler(this, + &WindowSimulation::ImitationWindow_MouseDown); + this->MouseUp += + gcnew MouseEventHandler(this, + &WindowSimulation::ImitationWindow_MouseUp); + this->MouseMove += + gcnew MouseEventHandler(this, + &WindowSimulation::ImitationWindow_MouseMove); + } + + // + // Get the sizes and offsets for the window parts as specified + // by the visual style. + private: + void GetPartDetails() + { + // Do nothing further if visual styles are not enabled. + if (!Application::RenderWithVisualStyles) + { + return; + } + + Graphics^ g = this->CreateGraphics(); + + // Get the size and offset of the close button. + if (SetRenderer(windowElements["windowClose"])) + { + closeButtonSize = + renderer->GetPartSize(g, ThemeSizeType::True); + closeButtonOffset = + renderer->GetPoint(PointProperty::Offset); + } + + // Get the height of the window caption. + if (SetRenderer(windowElements["windowCaption"])) + { + captionHeight = renderer->GetPartSize(g, + ThemeSizeType::True).Height; + } + + // Get the thickness of the left, bottom, + // and right window frame. + if (SetRenderer(windowElements["windowLeft"])) + { + frameThickness = renderer->GetPartSize(g, + ThemeSizeType::True).Width; + } + + // Get the size of the resizing gripper. + if (SetRenderer(windowElements["statusGripper"])) + { + gripperSize = renderer->GetPartSize(g, + ThemeSizeType::True); + } + + } + // + + // Use the part metrics to determine the current size + // of the rectangles for all of the window parts. + private: + void CalculateRectangles() + { + int heightMinusFrame = + ClientRectangle.Height - frameThickness; + + // Calculate the window frame rectangles and add them + // to the Dictionary of rectangles. + elementRectangles["windowCaption"] = Rectangle(0, 0, + ClientRectangle.Width, captionHeight); + elementRectangles["windowBottom"] = Rectangle(0, + heightMinusFrame, ClientRectangle.Width, frameThickness); + elementRectangles["windowLeft"] = Rectangle(0, captionHeight, + frameThickness, heightMinusFrame - captionHeight); + elementRectangles["windowRight"] = Rectangle( + ClientRectangle.Width - frameThickness, captionHeight, + frameThickness, heightMinusFrame - captionHeight); + + // Calculate the window button rectangle and add it + // to the Dictionary of rectangles. + elementRectangles["windowClose"] = + Rectangle(ClientRectangle.Right + + closeButtonOffset.X - closeButtonSize.Width - frameThickness, closeButtonOffset.Y, + closeButtonSize.Width, closeButtonSize.Height); + + // Calculate the status bar rectangles and add them + // to the Dictionary of rectangles. + elementRectangles["statusBar"] = + Rectangle(frameThickness, + heightMinusFrame - statusHeight, + ClientRectangle.Width - (2 * frameThickness), + statusHeight); + elementRectangles["statusGripper"] = + Rectangle(ClientRectangle.Right - + gripperSize.Width - frameThickness, + heightMinusFrame - gripperSize.Height, + gripperSize.Width, gripperSize.Height); + } + + // + protected: + virtual void OnPaint(PaintEventArgs^ e) override + { + __super::OnPaint(e); + + // Ensure that visual styles are supported. + if (!Application::RenderWithVisualStyles) + { + this->Text = "Visual styles are not enabled."; + TextRenderer::DrawText(e->Graphics, this->Text, + this->Font, this->Location, this->ForeColor); + return; + } + + // Set the clip region to define the curved corners + // of the caption. + SetClipRegion(); + + // Draw each part of the window. + for each(KeyValuePair^ entry + in windowElements) + { + if (SetRenderer(entry->Value)) + { + renderer->DrawBackground(e->Graphics, + elementRectangles[entry->Key]); + } + } + + // Draw the caption text. + TextRenderer::DrawText(e->Graphics, this->Text, this->Font, + elementRectangles["windowCaption"], Color::White, + TextFormatFlags::VerticalCenter | + TextFormatFlags::HorizontalCenter); + } + // +private: + // Initiate dragging, resizing, or closing the imitation window. + void ImitationWindow_MouseDown(Object^ sender, MouseEventArgs^ e) + { + // The user clicked the close button. + if (elementRectangles["windowClose"].Contains(e->Location)) + { + windowElements["windowClose"] = + VisualStyleElement::Window::CloseButton::Pressed; + isClosing = true; + } + + // The user clicked the status grip. + else if (elementRectangles["statusGripper"].Contains(e->Location)) + { + isResizing = true; + this->Cursor = Cursors::SizeNWSE; + resizeOffset.X = this->Right - this->Left - e->X; + resizeOffset.Y = this->Bottom - this->Top - e->Y; + } + + // The user clicked the window caption. + else if (elementRectangles["windowCaption"].Contains(e->Location)) + { + isMoving = true; + originalClick.X = e->X; + originalClick.Y = e->Y; + } + + Invalidate(); + } + + // Stop any current resizing or moving actions. + void ImitationWindow_MouseUp(Object^ sender, MouseEventArgs^ e) + { + // Stop moving the location of the window rectangles. + if (isMoving) + { + isMoving = false; + } + + // Change the cursor back to the default if the user + // stops resizing. + else if (isResizing) + { + isResizing = false; + } + + // Close the application if the user clicks the + // close button. + else if (elementRectangles["windowClose"].Contains(e->Location) + && isClosing) + { + Application::Exit(); + } + } + + // Handle resizing or moving actions. + void ImitationWindow_MouseMove(Object^ sender, + MouseEventArgs^ e) + { + // The left mouse button is down. + if ((::MouseButtons::Left & e->Button) == ::MouseButtons::Left) + { + // Calculate the new control size if the user is + // dragging the resizing grip. + if (isResizing) + { + this->Width = e->X + resizeOffset.X; + this->Height = e->Y + resizeOffset.Y; + CalculateRectangles(); + } + + // Calculate the new location of the control if the + // user is dragging the window caption. + else if (isMoving) + { + int XChange = this->Location.X + (e->X - originalClick.X); + int YChange = this->Location.Y + (e->Y - originalClick.Y); + this->Location = Point(XChange, YChange); + } + + // Cancel the closing action if the user clicked + // and held down on the close button, and has dragged + // the pointer outside the button. + else if (!elementRectangles["windowClose"].Contains( + e->Location) && isClosing) + { + isClosing = false; + windowElements["windowClose"] = + VisualStyleElement::Window::CloseButton::Normal; + } + } + + // The left mouse button is not down. + else + { + // Paint the close button hot if the cursor is on it. + Rectangle^ closeRectangle = + elementRectangles["windowClose"]; + if (closeRectangle->Contains(e->Location)) + { + windowElements["windowClose"] = + VisualStyleElement::Window::CloseButton::Hot; + } + else + { + windowElements["windowClose"] = + VisualStyleElement::Window::CloseButton::Normal; + } + + + // Use a resizing cursor if the cursor is on the + // status grip. + Rectangle^ gripRectangle = elementRectangles["statusGripper"]; + if (gripRectangle->Contains(e->Location)) + { + this->Cursor = Cursors::SizeNWSE; + } + else + { + this->Cursor = Cursors::Default; + } + } + + Invalidate(); + } + + // + // Calculate and set the clipping region for the control + // so that the corners of the title bar are rounded. + private: + void SetClipRegion() + { + if (!Application::RenderWithVisualStyles) + { + return; + } + + Graphics^ g = this->CreateGraphics(); + // Get the current region for the window caption. + if (SetRenderer(windowElements["windowCaption"])) + { + System::Drawing::Region^ clipRegion = + renderer->GetBackgroundRegion(g, + elementRectangles["windowCaption"]); + + // Get the client rectangle, but exclude the region + // of the window caption. + int height = (int)clipRegion->GetBounds(g).Height; + System::Drawing::Rectangle nonCaptionRect = Rectangle( + ClientRectangle.X, ClientRectangle.Y + height, + ClientRectangle.Width, ClientRectangle.Height - height); + + // Add the rectangle to the caption region, and + // make this region the form's clipping region. + clipRegion->Union(nonCaptionRect); + this->Region = clipRegion; + } + + } + // + + // + // Set the VisualStyleRenderer to a new element. + private: + bool SetRenderer(VisualStyleElement^ element) + { + if (!VisualStyleRenderer::IsElementDefined(element)) + { + return false; + } + + if (renderer == nullptr) + { + renderer = gcnew VisualStyleRenderer(element); + } + else + { + renderer->SetParameters(element); + } + + return true; + } + // + }; + + public ref class Form1 : public Form + { + public: + Form1() : Form() + { + this->Size = System::Drawing::Size(800, 600); + this->Location = Point(20, 20); + this->BackColor = Color::DarkGray; + WindowSimulation^ ws = gcnew WindowSimulation(); + Controls->Add(ws); + } + + }; +} + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew VisualStyleRendererSample::Form1()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp new file mode 100644 index 00000000000..fea4b5ed5a9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.VisualStyles.VisualStyleState/cpp/visualstylestate.cpp @@ -0,0 +1,96 @@ + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::VisualStyles; + +namespace VisualStyleStateSample +{ + public ref class VisualStyleStateForm : public Form + { + Button^ updateButton; + RadioButton^ applyToClient; + RadioButton^ applyToNonClient; + RadioButton^ applyToAll; + RadioButton^ disableStyles; + + public: + VisualStyleStateForm() + { + updateButton = gcnew Button(); + applyToClient = gcnew RadioButton(); + applyToNonClient = gcnew RadioButton(); + applyToAll = gcnew RadioButton(); + disableStyles = gcnew RadioButton(); + + updateButton->AutoSize = true; + updateButton->Location = Point(10, 10); + updateButton->Text = "Update VisualStyleState"; + updateButton->Click += gcnew EventHandler(this, + &VisualStyleStateForm::UpdateButton_Click); + + applyToClient->Location = Point(10, 50); + applyToClient->AutoSize = true; + applyToClient->Text = "Apply styles to client area only"; + + applyToNonClient->Location = Point(10, 70); + applyToNonClient->AutoSize = true; + applyToNonClient->Text = "Apply styles to nonclient area only"; + + applyToAll->Location = Point(10, 90); + applyToAll->AutoSize = true; + applyToAll->Text = "Apply styles to client and nonclient areas"; + + disableStyles->Location = Point(10, 110); + disableStyles->AutoSize = true; + disableStyles->Text = "Disable styles in all areas"; + + this->Text = "VisualStyleState Test"; + this->Controls->AddRange(gcnew array{updateButton, + applyToClient, applyToNonClient, applyToAll, disableStyles}); + } + + // + private: + void UpdateButton_Click(Object^ sender, EventArgs^ e) + { + if (applyToClient->Checked) + { + Application::VisualStyleState = + VisualStyleState::ClientAreaEnabled; + } + else if (applyToNonClient->Checked) + { + Application::VisualStyleState = + VisualStyleState::NonClientAreaEnabled; + } + else if (applyToAll->Checked) + { + Application::VisualStyleState = + VisualStyleState::ClientAndNonClientAreasEnabled; + } + else if (disableStyles->Checked) + { + Application::VisualStyleState = + VisualStyleState::NoneEnabled; + } + + // Repaint the form and all child controls. + this->Invalidate(true); + } + // + }; +} + +[STAThread] +int main() +{ + Application::EnableVisualStyles(); + Application::Run(gcnew VisualStyleStateSample::VisualStyleStateForm()); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp new file mode 100644 index 00000000000..c653b994925 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/System.Windows.Forms.WebBrowser/CPP/form1.cpp @@ -0,0 +1,502 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Security::Permissions; + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + { + //This call is required by the Windows Form Designer. + InitializeComponent(); + + //Add any initialization after the InitializeComponent() call + } + + +private: + + //NOTE: The following procedure is required by the Windows Form Designer + //It can be modified using the Windows Form Designer. + //Do not modify it using the code editor. + System::Windows::Forms::MainMenu^ MainMenu1; + System::Windows::Forms::MenuItem^ MenuItemFile; + System::Windows::Forms::MenuItem^ MenuItemFileSaveAs; + System::Windows::Forms::MenuItem^ MenuItemFilePageSetup; + System::Windows::Forms::MenuItem^ MenuItemFilePrint; + System::Windows::Forms::MenuItem^ MenuItemFilePrintPreview; + System::Windows::Forms::MenuItem^ MenuItemFileProperties; + System::Windows::Forms::TextBox^ TextBoxAddress; + System::Windows::Forms::Button^ ButtonGo; + System::Windows::Forms::Button^ backButton; + System::Windows::Forms::Button^ ButtonForward; + System::Windows::Forms::Button^ ButtonStop; + System::Windows::Forms::Button^ ButtonRefresh; + System::Windows::Forms::Button^ ButtonHome; + System::Windows::Forms::Button^ ButtonSearch; + System::Windows::Forms::Panel^ Panel1; + System::Windows::Forms::WebBrowser ^ WebBrowser1; + System::Windows::Forms::StatusBar^ StatusBar1; + System::Windows::Forms::MenuItem^ MenuItem1; + System::Windows::Forms::MenuItem^ MenuItem2; + System::Windows::Forms::Button^ ButtonPrint; + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + [SecurityPermission(SecurityAction::Demand, Flags=SecurityPermissionFlag::UnmanagedCode)] + void InitializeComponent() + { + this->MainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->MenuItemFile = gcnew System::Windows::Forms::MenuItem; + this->MenuItemFileSaveAs = gcnew System::Windows::Forms::MenuItem; + this->MenuItem1 = gcnew System::Windows::Forms::MenuItem; + this->MenuItemFilePageSetup = gcnew System::Windows::Forms::MenuItem; + this->MenuItemFilePrint = gcnew System::Windows::Forms::MenuItem; + this->MenuItemFilePrintPreview = gcnew System::Windows::Forms::MenuItem; + this->MenuItem2 = gcnew System::Windows::Forms::MenuItem; + this->MenuItemFileProperties = gcnew System::Windows::Forms::MenuItem; + this->TextBoxAddress = gcnew System::Windows::Forms::TextBox; + this->ButtonGo = gcnew System::Windows::Forms::Button; + this->backButton = gcnew System::Windows::Forms::Button; + this->ButtonForward = gcnew System::Windows::Forms::Button; + this->ButtonStop = gcnew System::Windows::Forms::Button; + this->ButtonRefresh = gcnew System::Windows::Forms::Button; + this->ButtonHome = gcnew System::Windows::Forms::Button; + this->ButtonSearch = gcnew System::Windows::Forms::Button; + this->ButtonPrint = gcnew System::Windows::Forms::Button; + this->Panel1 = gcnew System::Windows::Forms::Panel; + this->WebBrowser1 = gcnew System::Windows::Forms::WebBrowser; + this->StatusBar1 = gcnew System::Windows::Forms::StatusBar; + this->Panel1->SuspendLayout(); + this->SuspendLayout(); + + // + // MainMenu1 + // + array^temp0 = {this->MenuItemFile}; + this->MainMenu1->MenuItems->AddRange( temp0 ); + this->MainMenu1->Name = "MainMenu1"; + + // + // MenuItemFile + // + this->MenuItemFile->Index = 0; + array^temp1 = {this->MenuItemFileSaveAs,this->MenuItem1,this->MenuItemFilePageSetup,this->MenuItemFilePrint,this->MenuItemFilePrintPreview,this->MenuItem2,this->MenuItemFileProperties}; + this->MenuItemFile->MenuItems->AddRange( temp1 ); + this->MenuItemFile->Name = "MenuItemFile"; + this->MenuItemFile->Text = "&File"; + + // + // MenuItemFileSaveAs + // + this->MenuItemFileSaveAs->Index = 0; + this->MenuItemFileSaveAs->Name = "MenuItemFileSaveAs"; + this->MenuItemFileSaveAs->Text = " Save &As"; + this->MenuItemFileSaveAs->Click += gcnew System::EventHandler( this, &Form1::MenuItemFileSaveAs_Click ); + + // + // MenuItem1 + // + this->MenuItem1->Index = 1; + this->MenuItem1->Name = "MenuItem1"; + this->MenuItem1->Text = "-"; + + // + // MenuItemFilePageSetup + // + this->MenuItemFilePageSetup->Index = 2; + this->MenuItemFilePageSetup->Name = "MenuItemFilePageSetup"; + this->MenuItemFilePageSetup->Text = "Page Set&up..."; + this->MenuItemFilePageSetup->Click += gcnew System::EventHandler( this, &Form1::MenuItemFilePageSetup_Click ); + + // + // MenuItemFilePrint + // + this->MenuItemFilePrint->Index = 3; + this->MenuItemFilePrint->Name = "MenuItemFilePrint"; + this->MenuItemFilePrint->Text = "&Print..."; + this->MenuItemFilePrint->Click += gcnew System::EventHandler( this, &Form1::MenuItemFilePrint_Click ); + + // + // MenuItemFilePrintPreview + // + this->MenuItemFilePrintPreview->Index = 4; + this->MenuItemFilePrintPreview->Name = "MenuItemFilePrintPreview"; + this->MenuItemFilePrintPreview->Text = "Print Pre&view..."; + this->MenuItemFilePrintPreview->Click += gcnew System::EventHandler( this, &Form1::MenuItemFilePrintPreview_Click ); + + // + // MenuItem2 + // + this->MenuItem2->Index = 5; + this->MenuItem2->Name = "MenuItem2"; + this->MenuItem2->Text = "-"; + + // + // MenuItemFileProperties + // + this->MenuItemFileProperties->Index = 6; + this->MenuItemFileProperties->Name = "MenuItemFileProperties"; + this->MenuItemFileProperties->Text = "P&roperties"; + this->MenuItemFileProperties->Click += gcnew System::EventHandler( this, &Form1::MenuItemFileProperties_Click ); + + // + // TextBoxAddress + // + this->TextBoxAddress->Location = System::Drawing::Point( 0, 0 ); + this->TextBoxAddress->Name = "TextBoxAddress"; + this->TextBoxAddress->Size = System::Drawing::Size( 240, 20 ); + this->TextBoxAddress->TabIndex = 1; + this->TextBoxAddress->Text = ""; + this->TextBoxAddress->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form1::TextBoxAddress_KeyDown ); + + // + // ButtonGo + // + this->ButtonGo->Location = System::Drawing::Point( 240, 0 ); + this->ButtonGo->Name = "ButtonGo"; + this->ButtonGo->Size = System::Drawing::Size( 48, 24 ); + this->ButtonGo->TabIndex = 2; + this->ButtonGo->Text = "Go"; + this->ButtonGo->Click += gcnew System::EventHandler( this, &Form1::ButtonGo_Click ); + + // + // backButton + // + this->backButton->Location = System::Drawing::Point( 288, 0 ); + this->backButton->Name = "backButton"; + this->backButton->Size = System::Drawing::Size( 48, 24 ); + this->backButton->TabIndex = 3; + this->backButton->Text = "Back"; + this->backButton->Click += gcnew System::EventHandler( this, &Form1::backButton_Click ); + + // + // ButtonForward + // + this->ButtonForward->Location = System::Drawing::Point( 336, 0 ); + this->ButtonForward->Name = "ButtonForward"; + this->ButtonForward->Size = System::Drawing::Size( 48, 24 ); + this->ButtonForward->TabIndex = 4; + this->ButtonForward->Text = "Forward"; + this->ButtonForward->Click += gcnew System::EventHandler( this, &Form1::ButtonForward_Click ); + + // + // ButtonStop + // + this->ButtonStop->Location = System::Drawing::Point( 384, 0 ); + this->ButtonStop->Name = "ButtonStop"; + this->ButtonStop->Size = System::Drawing::Size( 48, 24 ); + this->ButtonStop->TabIndex = 5; + this->ButtonStop->Text = "Stop"; + this->ButtonStop->Click += gcnew System::EventHandler( this, &Form1::ButtonStop_Click ); + + // + // ButtonRefresh + // + this->ButtonRefresh->Location = System::Drawing::Point( 432, 0 ); + this->ButtonRefresh->Name = "ButtonRefresh"; + this->ButtonRefresh->Size = System::Drawing::Size( 48, 24 ); + this->ButtonRefresh->TabIndex = 6; + this->ButtonRefresh->Text = "Refresh"; + this->ButtonRefresh->Click += gcnew System::EventHandler( this, &Form1::ButtonRefresh_Click ); + + // + // ButtonHome + // + this->ButtonHome->Location = System::Drawing::Point( 480, 0 ); + this->ButtonHome->Name = "ButtonHome"; + this->ButtonHome->Size = System::Drawing::Size( 48, 24 ); + this->ButtonHome->TabIndex = 7; + this->ButtonHome->Text = "Home"; + this->ButtonHome->Click += gcnew System::EventHandler( this, &Form1::ButtonHome_Click ); + + // + // ButtonSearch + // + this->ButtonSearch->Location = System::Drawing::Point( 528, 0 ); + this->ButtonSearch->Name = "ButtonSearch"; + this->ButtonSearch->Size = System::Drawing::Size( 48, 24 ); + this->ButtonSearch->TabIndex = 8; + this->ButtonSearch->Text = "Search"; + this->ButtonSearch->Click += gcnew System::EventHandler( this, &Form1::ButtonSearch_Click ); + + // + // ButtonPrint + // + this->ButtonPrint->Location = System::Drawing::Point( 576, 0 ); + this->ButtonPrint->Name = "ButtonPrint"; + this->ButtonPrint->Size = System::Drawing::Size( 48, 24 ); + this->ButtonPrint->TabIndex = 9; + this->ButtonPrint->Text = "Print"; + this->ButtonPrint->Click += gcnew System::EventHandler( this, &Form1::ButtonPrint_Click ); + + // + // Panel1 + // + this->Panel1->Controls->Add( this->ButtonPrint ); + this->Panel1->Controls->Add( this->TextBoxAddress ); + this->Panel1->Controls->Add( this->ButtonGo ); + this->Panel1->Controls->Add( this->backButton ); + this->Panel1->Controls->Add( this->ButtonForward ); + this->Panel1->Controls->Add( this->ButtonStop ); + this->Panel1->Controls->Add( this->ButtonRefresh ); + this->Panel1->Controls->Add( this->ButtonHome ); + this->Panel1->Controls->Add( this->ButtonSearch ); + this->Panel1->Dock = System::Windows::Forms::DockStyle::Top; + this->Panel1->Location = System::Drawing::Point( 0, 0 ); + this->Panel1->Name = "Panel1"; + this->Panel1->Size = System::Drawing::Size( 624, 24 ); + this->Panel1->TabIndex = 11; + + // + // WebBrowser1 + // + // + this->WebBrowser1->AllowWebBrowserDrop = false; + this->WebBrowser1->ScriptErrorsSuppressed = true; + this->WebBrowser1->WebBrowserShortcutsEnabled = false; + this->WebBrowser1->Dock = System::Windows::Forms::DockStyle::Fill; + this->WebBrowser1->IsWebBrowserContextMenuEnabled = false; + + // + this->WebBrowser1->Location = System::Drawing::Point( 0, 24 ); + this->WebBrowser1->Name = "WebBrowser1"; + this->WebBrowser1->Size = System::Drawing::Size( 624, 389 ); + this->WebBrowser1->TabIndex = 10; + this->WebBrowser1->StatusTextChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_StatusTextChanged ); + this->WebBrowser1->CanGoBackChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_CanGoBackChanged ); + this->WebBrowser1->Navigated += gcnew System::Windows::Forms::WebBrowserNavigatedEventHandler( this, &Form1::WebBrowser1_Navigated ); + this->WebBrowser1->CanGoForwardChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_CanGoForwardChanged ); + this->WebBrowser1->DocumentTitleChanged += gcnew System::EventHandler( this, &Form1::WebBrowser1_DocumentTitleChanged ); + + // + // StatusBar1 + // + this->StatusBar1->Location = System::Drawing::Point( 0, 413 ); + this->StatusBar1->Name = "StatusBar1"; + this->StatusBar1->Size = System::Drawing::Size( 624, 16 ); + this->StatusBar1->TabIndex = 12; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 624, 429 ); + this->Controls->Add( this->WebBrowser1 ); + this->Controls->Add( this->Panel1 ); + this->Controls->Add( this->StatusBar1 ); + this->Menu = this->MainMenu1; + this->Name = "Form1"; + this->Text = "WebBrowser Example"; + this->Panel1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + +internal: + + static property Form1^ GetInstance + { + Form1^ get() + { + if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) + { + System::Threading::Monitor::Enter( Form1::typeid ); + try + { + if ( m_DefaultInstance == nullptr || m_DefaultInstance->IsDisposed ) + { + m_DefaultInstance = gcnew Form1; + } + } + finally + { + System::Threading::Monitor::Exit( Form1::typeid ); + } + } + + return m_DefaultInstance; + } + } + +private: + static Form1^ m_DefaultInstance; + + // + // Displays the Save dialog box. + void MenuItemFileSaveAs_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->ShowSaveAsDialog(); + } + + // + // + // Displays the Page Setup dialog box. + void MenuItemFilePageSetup_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->ShowPageSetupDialog(); + } + // + + // + // Displays the Print dialog box. + void MenuItemFilePrint_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->ShowPrintDialog(); + } + // + + // + // Displays the Print Preview dialog box. + void MenuItemFilePrintPreview_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->ShowPrintPreviewDialog(); + } + // + + // + // Displays the Properties dialog box. + void MenuItemFileProperties_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->ShowPropertiesDialog(); + } + // + + // + // Navigates to the URL in the address text box when + // the ENTER key is pressed while the text box has focus. + void TextBoxAddress_KeyDown( Object^ /*sender*/, System::Windows::Forms::KeyEventArgs^ e ) + { + if ( e->KeyCode == System::Windows::Forms::Keys::Enter && !this->TextBoxAddress->Text->Equals( "" ) ) + { + this->WebBrowser1->Navigate( this->TextBoxAddress->Text ); + } + } + + // Navigates to the URL in the address text box when + // the Go button is clicked. + void ButtonGo_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( !this->TextBoxAddress->Text->Equals( "" ) ) + { + this->WebBrowser1->Navigate( this->TextBoxAddress->Text ); + } + } + + // Updates the URL in TextBoxAddress upon navigation. + void WebBrowser1_Navigated( Object^ /*sender*/, System::Windows::Forms::WebBrowserNavigatedEventArgs^ /*e*/ ) + { + this->TextBoxAddress->Text = this->WebBrowser1->Url->ToString(); + } + + // + + // + // Navigates WebBrowser1 to the previous page in the history. + void backButton_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->GoBack(); + } + + // Disables the Back button at the beginning of the navigation history. + void WebBrowser1_CanGoBackChanged( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->backButton->Enabled = this->WebBrowser1->CanGoBack; + } + // + + // + // Navigates WebBrowser1 to the next page in history. + void ButtonForward_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->GoForward(); + } + + // Disables the Forward button at the end of navigation history. + void WebBrowser1_CanGoForwardChanged( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->ButtonForward->Enabled = this->WebBrowser1->CanGoForward; + } + // + + // + // Halts the current navigation and any sounds or animations on + // the page. + void ButtonStop_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->Stop(); + } + // + + // + // Reloads the current page. + void ButtonRefresh_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Skip refresh if about:blank is loaded to avoid removing + // content specified by the DocumentText property. + if ( !this->WebBrowser1->Url->Equals( "about:blank" ) ) + { + this->WebBrowser1->Refresh(); + } + } + // + + // + // Navigates WebBrowser1 to the home page of the current user. + void ButtonHome_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->GoHome(); + } + // + + // + // Navigates WebBrowser1 to the search page of the current user. + void ButtonSearch_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->GoSearch(); + } + // + + // + // Prints the current document using the current print settings. + void ButtonPrint_Click( System::Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->WebBrowser1->Print(); + } + // + + // + // Updates StatusBar1 with the current browser status text. + void WebBrowser1_StatusTextChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->StatusBar1->Text = WebBrowser1->StatusText; + } + // + + // + // Updates the title bar with the current document title. + void WebBrowser1_DocumentTitleChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->Text = WebBrowser1->DocumentTitle; + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + System::Windows::Forms::Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp b/snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp new file mode 100644 index 00000000000..15a5bbaca15 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SystemEvents/cpp/SystemEvents.cpp @@ -0,0 +1,57 @@ +//Types:Microsoft.Win32.SystemEvents +// +#using + +using namespace System; +using namespace Microsoft::Win32; + +// This method is called when a user preference changes. +void SystemEvents_UserPreferenceChanging(Object^ sender, + UserPreferenceChangingEventArgs^ e) + { + Console::WriteLine("The user preference is changing. Category={0}", + e->Category); + } + +// This method is called when the palette changes. +void SystemEvents_PaletteChanged(Object^ sender, EventArgs^ e) +{ + Console::WriteLine("The palette changed."); +} + +// This method is called when the display settings change. +void SystemEvents_DisplaySettingsChanged(Object^ sender, + EventArgs^ e) +{ + Console::WriteLine("The display settings changed."); +} + +// +int main() +{ + // Set the SystemEvents class to receive event notification + // when a user preference changes, the palette changes, or + // when display settings change. + SystemEvents::UserPreferenceChanging += gcnew + UserPreferenceChangingEventHandler( + SystemEvents_UserPreferenceChanging); + SystemEvents::PaletteChanged += gcnew + EventHandler(SystemEvents_PaletteChanged); + SystemEvents::DisplaySettingsChanged += gcnew + EventHandler(SystemEvents_DisplaySettingsChanged); + + // For demonstration purposes, this application sits idle + // waiting for events. + Console::WriteLine("This application is waiting for system events."); + Console::WriteLine("Press to terminate this application."); + Console::ReadLine(); +} +// + +// This code produces the following output. +// +// This app is waiting for system events. +// Press to terminate this application. +// Display Settings changed. +// User preference is changing. Category=General +// diff --git a/snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp b/snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp new file mode 100644 index 00000000000..80114a6ba92 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SystemInformationBrowser/CPP/sysinfobrowser.cpp @@ -0,0 +1,114 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Reflection; +using namespace System::Windows::Forms; +public ref class SystemInfoBrowserForm: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ListBox^ listBox1; + System::Windows::Forms::TextBox^ textBox1; + +public: + SystemInfoBrowserForm() + { + this->SuspendLayout(); + InitForm(); + + // Add each property of the SystemInformation class to the list box. + Type^ t = System::Windows::Forms::SystemInformation::typeid; + array^pi = t->GetProperties(); + for ( int i = 0; i < pi->Length; i++ ) + listBox1->Items->Add( pi[ i ]->Name ); + textBox1->Text = String::Format( "The SystemInformation class has {0} properties.\r\n", pi->Length ); + + // Configure the list item selected handler for the list box to invoke a + // method that displays the value of each property. + listBox1->SelectedIndexChanged += gcnew EventHandler( this, &SystemInfoBrowserForm::listBox1_SelectedIndexChanged ); + this->ResumeLayout( false ); + } + + +private: + void listBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Return if no list item is selected. + if ( listBox1->SelectedIndex == -1 ) + return; + + + // Get the property name from the list item. + String^ propname = listBox1->Text; + if ( propname->Equals( "PowerStatus" ) ) + { + + // Cycle and display the values of each property of the PowerStatus property. + textBox1->Text = String::Concat( textBox1->Text, "\r\nThe value of the PowerStatus property is:" ); + Type^ t = System::Windows::Forms::PowerStatus::typeid; + array^pi = t->GetProperties(); + for ( int i = 0; i < pi->Length; i++ ) + { + Object^ propval = pi[ i ]->GetValue( SystemInformation::PowerStatus, nullptr ); + textBox1->Text = String::Format( "{0}\r\n PowerStatus.{1} is: {2}", textBox1->Text, pi[ i ]->Name, propval ); + + } + } + else + { + + // Display the value of the selected property of the SystemInformation type. + Type^ t = System::Windows::Forms::SystemInformation::typeid; + array^pi = t->GetProperties(); + PropertyInfo^ prop = nullptr; + for ( int i = 0; i < pi->Length; i++ ) + if ( pi[ i ]->Name == propname ) + { + prop = pi[ i ]; + break; + } + Object^ propval = prop->GetValue( nullptr, nullptr ); + textBox1->Text = String::Format( "{0}\r\nThe value of the {1} property is: {2}", textBox1->Text, propname, propval ); + } + } + + void InitForm() + { + + // Initialize the form settings + this->listBox1 = gcnew System::Windows::Forms::ListBox; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->listBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->listBox1->Location = System::Drawing::Point( 8, 16 ); + this->listBox1->Size = System::Drawing::Size( 172, 496 ); + this->listBox1->TabIndex = 0; + this->textBox1->Anchor = (System::Windows::Forms::AnchorStyles)(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->textBox1->Location = System::Drawing::Point( 188, 16 ); + this->textBox1->Multiline = true; + this->textBox1->ScrollBars = System::Windows::Forms::ScrollBars::Vertical; + this->textBox1->Size = System::Drawing::Size( 420, 496 ); + this->textBox1->TabIndex = 1; + this->ClientSize = System::Drawing::Size( 616, 525 ); + this->Controls->Add( this->textBox1 ); + this->Controls->Add( this->listBox1 ); + this->Text = "Select a SystemInformation property to get the value of"; + } + +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew SystemInfoBrowserForm ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp new file mode 100644 index 00000000000..fb1445d0ea6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/SystemSoundsExample/CPP/form1.cpp @@ -0,0 +1,82 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Media; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::ComponentModel::Container^ components; + +public: + Form1() + { + InitializeComponent(); + } + + void PlayAsterisk() + { + // + // Plays the sound associated with the Asterisk system event. + SystemSounds::Asterisk->Play(); + // + } + + void PlayBeep() + { + // + // Plays the sound associated with the Beep system event. + SystemSounds::Beep->Play(); + // + } + + void PlayExclamation() + { + // + // Plays the sound associated with the Exclamation system event. + SystemSounds::Exclamation->Play(); + // + } + + void PlayHand() + { + // + // Plays the sound associated with the Hand system event. + SystemSounds::Hand->Play(); + // + } + + void PlayQuestion() + { + // + // Plays the sound associated with the Question system event. + SystemSounds::Question->Play(); + // + } + + #pragma region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// +private: + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->Size = System::Drawing::Size( 300, 300 ); + this->Text = "Form1"; + } + #pragma endregion +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp new file mode 100644 index 00000000000..a6a2d5b77cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabAlignment/CPP/form1.cpp @@ -0,0 +1,54 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + this->tabPage3 = gcnew TabPage; + + // Positions tabs on the left side of tabControl1. + this->tabControl1->Alignment = System::Windows::Forms::TabAlignment::Left; + array^tabControls = {this->tabPage1,this->tabPage2,this->tabPage3}; + this->tabControl1->Controls->AddRange( tabControls ); + this->tabControl1->Location = Point(16,24); + this->tabControl1->SelectedIndex = 0; + this->tabControl1->Size = System::Drawing::Size( 248, 232 ); + this->tabControl1->TabIndex = 0; + this->tabPage1->TabIndex = 0; + this->tabPage2->TabIndex = 1; + this->tabPage3->TabIndex = 2; + this->Size = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp new file mode 100644 index 00000000000..bca1364da4c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabControl.ImageList/CPP/form1.cpp @@ -0,0 +1,48 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Resources; +public ref class Form1: public Form +{ +public: + Form1() + { + IContainer^ components = gcnew System::ComponentModel::Container; + ResourceManager^ resources = gcnew ResourceManager( Form1::typeid ); + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + + // Declares and instantiates the ImageList Object*. + ImageList^ myImages = gcnew ImageList( components ); + tabControl1->Controls->Add( tabPage1 ); + + // Sets the images in myImages to display on the tabs of tabControl1. + tabControl1->ImageList = myImages; + tabPage1->ImageIndex = 0; + tabPage1->Text = "tabPage1"; + + // Gets the handle that provides the data of myImages. + myImages->ImageStream = (dynamic_cast(resources->GetObject( "myImages.ImageStream" ))); + + // Sets properties of myImages. + myImages->ColorDepth = ColorDepth::Depth8Bit; + myImages->ImageSize = System::Drawing::Size( 16, 16 ); + myImages->TransparentColor = Color::Transparent; + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp new file mode 100644 index 00000000000..8b15def2d53 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabControl_constructor/CPP/form1.cpp @@ -0,0 +1,42 @@ + + +#using +#using +#using + +// +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + +public: + void MyTabs() + { + + // Invokes the TabControl() constructor to create the tabControl1 object. + this->tabControl1 = gcnew System::Windows::Forms::TabControl; + + // Creates a new tab page and adds it to the tab control + this->tabPage1 = gcnew TabPage; + this->tabControl1->TabPages->Add( tabPage1 ); + + // Adds the tab control to the form + this->Controls->Add( tabControl1 ); + } + + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp new file mode 100644 index 00000000000..85d5d733a03 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabCount/CPP/form1.cpp @@ -0,0 +1,48 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +public: + Form1() + { + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + TabPage^ tabPage2 = gcnew TabPage; + TabPage^ tabPage3 = gcnew TabPage; + TabPage^ tabPage4 = gcnew TabPage; + TabPage^ tabPage5 = gcnew TabPage; + Label^ label1 = gcnew Label; + tabControl1->Multiline = true; + tabControl1->SizeMode = TabSizeMode::FillToRight; + tabControl1->Padding = Point(15,5); + array^tabControls = {tabPage1,tabPage2,tabPage3,tabPage4,tabPage5}; + tabControl1->Controls->AddRange( tabControls ); + tabControl1->Location = Point(35,65); + tabControl1->Size = System::Drawing::Size( 220, 180 ); + + // Gets the number of tabs currently in the tabControl1 tab strip. + // Assigns int value to the tabsInTabStrip variable. + int tabsInTabStrip = tabControl1->TabCount; + label1->Text = System::String::Concat( "There are ", tabsInTabStrip, " tabs in the tabControl1 tab strip." ); + label1->Location = Point(35,25); + label1->Size = System::Drawing::Size( 220, 30 ); + Size = System::Drawing::Size( 300, 300 ); + array^formControls = {label1,tabControl1}; + Controls->AddRange( formControls ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp new file mode 100644 index 00000000000..b5080576b9d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPage.ImageIndex/CPP/form1.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Resources; +public ref class Form1: public Form +{ +public: + Form1() + { + IContainer^ components = gcnew System::ComponentModel::Container; + ResourceManager^ resources = gcnew ResourceManager( Form1::typeid ); + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + ImageList^ myImages = gcnew ImageList( components ); + tabControl1->Controls->Add( tabPage1 ); + + // Displays images from myImages on the tabs of tabControl1. + tabControl1->ImageList = myImages; + + // Specifies which image to display (on the tab of tabPage1) by its index. + tabPage1->ImageIndex = 0; + tabPage1->Text = "tabPage1"; + myImages->ImageStream = (dynamic_cast(resources->GetObject( "myImages.ImageStream" ))); + myImages->ColorDepth = ColorDepth::Depth8Bit; + myImages->ImageSize = System::Drawing::Size( 16, 16 ); + myImages->TransparentColor = Color::Transparent; + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp new file mode 100644 index 00000000000..999f6192095 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPage.ToString/CPP/form1.cpp @@ -0,0 +1,46 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabControl1->Controls->Add( tabPage1 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->tabControl1->ShowToolTips = true; + this->tabPage1->Text = "myTabPage1"; + + // Creates a string showing the Text value for tabPage1. + // Then assigns the string to ToolTipText. + this->tabPage1->ToolTipText = tabPage1->ToString(); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp new file mode 100644 index 00000000000..1a05c97e2e4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPage/CPP/form1.cpp @@ -0,0 +1,46 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + + // Declares tabPage1 as a TabPage type. + System::Windows::Forms::TabPage^ tabPage1; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + + // Invokes the TabPage() constructor to create the tabPage1. + this->tabPage1 = gcnew System::Windows::Forms::TabPage; + array^tabControls = {this->tabPage1}; + this->tabControl1->Controls->AddRange( tabControls ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp new file mode 100644 index 00000000000..bb689f3bdd7 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Add/CPP/form1.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + + // Gets the controls collection for tabControl1. + // Adds the tabPage1 to this collection. + this->tabControl1->TabPages->Add( tabPage1 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp new file mode 100644 index 00000000000..f1e7672f1af --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.AddRange/CPP/form1.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + this->tabPage3 = gcnew TabPage; + array^tabPages = {tabPage1,tabPage2,tabPage3}; + + // Gets the controls collection for tabControl1. + // Adds an array of tab pages to this collection. + this->tabControl1->Controls->AddRange( tabPages ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp new file mode 100644 index 00000000000..19d6d688d7d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Clear/CPP/form1.cpp @@ -0,0 +1,48 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage( "tabPage1" ); + this->tabPage2 = gcnew TabPage( "tabPage2" ); + this->tabPage3 = gcnew TabPage( "tabPage3" ); + + // Populates the tabControl1 with three tab pages. + array^tabPages = {tabPage1,tabPage2,tabPage3}; + this->tabControl1->TabPages->AddRange( tabPages ); + + // Removes all the tab pages from tabControl1. + this->tabControl1->TabPages->Clear(); + + // Adds the tabPage1 back to tabControl1. + this->tabControl1->TabPages->Add( tabPage2 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp new file mode 100644 index 00000000000..08971375d11 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Contains/CPP/form1.cpp @@ -0,0 +1,49 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + array^tabText = {"tabPage1","tabPage2","tabPage3"}; + this->tabPage1 = gcnew TabPage( tabText[ 0 ]->ToString() ); + this->tabPage2 = gcnew TabPage( tabText[ 1 ]->ToString() ); + this->tabPage3 = gcnew TabPage( tabText[ 2 ]->ToString() ); + + // Populates the tabControl1 with two tab pages. + array^tabPages = {tabPage1,tabPage2}; + this->tabControl1->TabPages->AddRange( tabPages ); + + // Checks the tabControl1 controls collection for tabPage3. + // Adds tabPage3 to tabControl1 if it is not in the collection. + if ( !tabControl1->TabPages->Contains( tabPage3 ) ) + this->tabControl1->TabPages->Add( tabPage3 ); + + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp new file mode 100644 index 00000000000..fc5497e6a60 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Count/CPP/form1.cpp @@ -0,0 +1,49 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + Label^ label1; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + this->tabPage3 = gcnew TabPage; + this->label1 = gcnew Label; + array^tabPages = {tabPage1,tabPage2,tabPage3}; + this->tabControl1->TabPages->AddRange( tabPages ); + this->tabControl1->Location = Point(25,75); + this->tabControl1->Size = System::Drawing::Size( 250, 200 ); + + // Gets the number of TabPage objects in the tabControl1 controls collection. + int tabCount = tabControl1->TabPages->Count; + this->label1->Location = Point(25,25); + this->label1->Size = System::Drawing::Size( 250, 25 ); + this->label1->Text = System::String::Concat( "The TabControl below has ", tabCount, " TabPage objects in its controls collection." ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + array^formControls = {tabControl1,label1}; + this->Controls->AddRange( formControls ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp new file mode 100644 index 00000000000..c55a6f25629 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IndexOf/CPP/form1.cpp @@ -0,0 +1,40 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage( "myTabPage" ); + this->tabControl1->TabPages->Add( tabPage1 ); + this->tabControl1->ShowToolTips = true; + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->tabPage1->ToolTipText = System::String::Concat( "TabIndex = ", (tabControl1->TabPages->IndexOf( tabPage1 )).ToString() ); + + // Gets the tabPage1 TabIndex value from the tabControl1 controls collection. + // Converts the tabPage1 TabIndex value to a string. + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp new file mode 100644 index 00000000000..84935312288 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.IsReadOnly/CPP/form1.cpp @@ -0,0 +1,44 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +public: + Form1() + { + TabControl^ tabControl1 = gcnew TabControl; + TabPage^ tabPage1 = gcnew TabPage; + TabPage^ tabPage2 = gcnew TabPage; + Label^ label1 = gcnew Label; + + // Determines if the tabControl1 controls collection is read-only. + if (tabControl1->TabPages->IsReadOnly) + label1->Text = "The tabControl1 controls collection is read-only."; + else + label1->Text = "The tabControl1 controls collection is not read-only."; + + array^tabPages = {tabPage1,tabPage2}; + tabControl1->TabPages->AddRange( tabPages ); + tabControl1->Location = Point(25,75); + tabControl1->Size = System::Drawing::Size( 250, 200 ); + label1->Location = Point(25,25); + label1->Size = System::Drawing::Size( 250, 25 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + array^formControls = {tabControl1,label1}; + this->Controls->AddRange( formControls ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp new file mode 100644 index 00000000000..b7e12f0646f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.Remove/CPP/form1.cpp @@ -0,0 +1,47 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + array^tabText = {"tabPage1","tabPage2","tabPage3"}; + this->tabPage1 = gcnew TabPage( tabText[ 0 ]->ToString() ); + this->tabPage2 = gcnew TabPage( tabText[ 1 ]->ToString() ); + this->tabPage3 = gcnew TabPage( tabText[ 2 ]->ToString() ); + + // Populates the tabControl1 with three tab pages. + array^tabPages = {tabPage1,tabPage2,tabPage3}; + this->tabControl1->TabPages->AddRange( tabPages ); + + // Gets the tabControl1 controls collection. + // Removes the tabPage2 from the collection. + this->tabControl1->TabPages->Remove( tabPage2 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp new file mode 100644 index 00000000000..c9a301cdb06 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageCollection.RemoveAt/CPP/form1.cpp @@ -0,0 +1,52 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; + +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + TabPage^ tabPage3; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + array^tabText = {"tabPage1","tabPage2","tabPage3"}; + this->tabPage1 = gcnew TabPage( tabText[ 0 ]->ToString() ); + this->tabPage2 = gcnew TabPage( tabText[ 1 ]->ToString() ); + this->tabPage3 = gcnew TabPage( tabText[ 2 ]->ToString() ); + + // Populates the tabControl1 with three tab pages. + array^tabPages = {tabPage1,tabPage2,tabPage3}; + this->tabControl1->TabPages->AddRange( tabPages ); + + // Assigns TabIndex values to tab pages. + this->tabPage1->TabIndex = 0; + this->tabPage2->TabIndex = 1; + this->tabPage3->TabIndex = 2; + + // Gets the tabControl1 controls collection. + // Removes the tabPage1 by its TabIndex. + this->tabControl1->TabPages->RemoveAt( 0 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp new file mode 100644 index 00000000000..21a4a330da5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPageControlCollection.Add/CPP/add.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + Button^ button1; + +public: + Form1() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->button1 = gcnew Button; + this->tabControl1->TabPages->Add( tabPage1 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + + // Gets the controls collection for tabPage1. + // Adds button1 to this collection. + this->tabPage1->Controls->Add( button1 ); + this->button1->Text = "button1"; + this->button1->Location = Point(25,25); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp new file mode 100644 index 00000000000..9cc28774492 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPage_constructor/CPP/form1.cpp @@ -0,0 +1,38 @@ + + +#using +#using +#using + +// +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + +public: + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + + // Invokes the TabPage() constructor to create the tabPage1. + this->tabPage1 = gcnew System::Windows::Forms::TabPage; + this->tabControl1->Controls->Add( tabPage1 ); + this->Controls->Add( tabControl1 ); + } + + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp new file mode 100644 index 00000000000..07a69dfa40c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabPage_withText/CPP/form1.cpp @@ -0,0 +1,43 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + System::String^ tabPageName = "myTabPage"; + + // Constructs a TabPage with a TabPage::Text value. + this->tabPage1 = gcnew TabPage( tabPageName ); + this->tabControl1->Controls->Add( tabPage1 ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + this->ClientSize = System::Drawing::Size( 300, 300 ); + this->Controls->Add( tabControl1 ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp new file mode 100644 index 00000000000..4457ee09e07 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TabText/CPP/form1.cpp @@ -0,0 +1,45 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + array^tabControl1Controls = {this->tabPage1}; + this->tabControl1->Controls->AddRange( tabControl1Controls ); + this->tabControl1->Location = Point(25,25); + this->tabControl1->Size = System::Drawing::Size( 250, 250 ); + + // Displays a string, myTabPage, on tabPage1. + this->tabPage1->Text = "myTabPage"; + this->ClientSize = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp new file mode 100644 index 00000000000..464ae4ea198 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TextBoxBase.AppendText/CPP/form1.cpp @@ -0,0 +1,141 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::TextBox^ textBox2; + System::Windows::Forms::Button^ button1; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + +public: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->textBox2 = gcnew System::Windows::Forms::TextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 24, 24 ); + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 144, 20 ); + this->textBox1->TabIndex = 0; + this->textBox1->Text = "textBox1"; + + // + // textBox2 + // + this->textBox2->Location = System::Drawing::Point( 24, 56 ); + this->textBox2->Name = "textBox2"; + this->textBox2->Size = System::Drawing::Size( 144, 20 ); + this->textBox2->TabIndex = 1; + this->textBox2->Text = "textBox2"; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 208, 40 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 2; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 266 ); + array^temp0 = {this->button1,this->textBox2,this->textBox1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + AppendTextBox1Text(); + } + + // + void AppendTextBox1Text() + { + // Determine if text is selected in textBox1. + if ( textBox1->SelectionLength == 0 ) + + // No selection made, return. + return; + + // Determine if the text being appended to textBox2 exceeds the MaxLength property. + if ( (textBox1->SelectedText->Length + textBox2->TextLength) > textBox2->MaxLength ) + MessageBox::Show( "The text to paste in is larger than the maximum number of characters allowed" ); // Append the text from textBox1 into textBox2. + else + textBox2->AppendText( textBox1->SelectedText ); + } + // +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp new file mode 100644 index 00000000000..e04d617e445 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ToolBar/CPP/mytoolbar.cpp @@ -0,0 +1,226 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class MyToolBar: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::ToolBar^ toolBar1; + System::Windows::Forms::ImageList^ imageList1; + System::Windows::Forms::ToolBarButton^ toolBarButton1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::TextBox^ textBox1; + System::ComponentModel::IContainer^ components; + System::Windows::Forms::ContextMenu^ contextMenu1; + MenuItem^ menuItem1; + MenuItem^ menuItem2; + +public: + MyToolBar() + { + InitializeComponent(); + this->AddToolBar(); + } + + +public: + ~MyToolBar() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + this->imageList1 = gcnew System::Windows::Forms::ImageList( this->components ); + this->imageList1->Images->Add( Image::FromFile( "c:\\copy.bmp" ) ); + this->imageList1->Images->Add( Image::FromFile( "c:\\button.bmp" ) ); + this->imageList1->Images->Add( Image::FromFile( "c:\\camera.bmp" ) ); + + // System::Resources::ResourceManager* resources = new System::Resources::ResourceManager(__typeof(MyToolBar)); + // this->imageList1 = new System::Windows::Forms::ImageList(this->components); + this->toolBarButton1 = gcnew System::Windows::Forms::ToolBarButton; + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->menuItem1 = gcnew MenuItem( "Clear" ); + this->menuItem2 = gcnew MenuItem( "Test" ); + array^menuItems = {menuItem1,menuItem2}; + this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu( menuItems ); + this->SuspendLayout(); + + // + // imageList1 + // + this->imageList1->ColorDepth = System::Windows::Forms::ColorDepth::Depth8Bit; + this->imageList1->ImageSize = System::Drawing::Size( 16, 16 ); + + //this->imageList1.ImageStream = ((System::Windows::Forms::ImageListStreamer)(resources.GetObject(S"imageList1.ImageStream"))); + this->imageList1->TransparentColor = System::Drawing::Color::Transparent; + + // + // toolBarButton1 + // + this->toolBarButton1->ImageIndex = 0; + this->toolBarButton1->Style = System::Windows::Forms::ToolBarButtonStyle::DropDownButton; + this->toolBarButton1->DropDownMenu = this->contextMenu1; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 24, 192 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &MyToolBar::button1_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 136, 200 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 2; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &MyToolBar::button2_Click ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 96, 144 ); + this->textBox1->Name = "textBox1"; + this->textBox1->TabIndex = 3; + this->textBox1->Text = "textBox1"; + + // + // MyToolBar + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^formControls = {this->textBox1,this->button2,this->button1}; + this->Controls->AddRange( formControls ); + this->Name = "MyToolBar"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + + // + void AddToolBar() + { + + // Add a toolbar and set some of its properties. + toolBar1 = gcnew ToolBar; + toolBar1->Appearance = System::Windows::Forms::ToolBarAppearance::Flat; + toolBar1->BorderStyle = System::Windows::Forms::BorderStyle::None; + toolBar1->Buttons->Add( this->toolBarButton1 ); + toolBar1->ButtonSize = System::Drawing::Size( 24, 24 ); + toolBar1->Divider = true; + toolBar1->DropDownArrows = true; + toolBar1->ImageList = this->imageList1; + toolBar1->ShowToolTips = true; + toolBar1->Size = System::Drawing::Size( 292, 25 ); + toolBar1->TabIndex = 0; + toolBar1->TextAlign = System::Windows::Forms::ToolBarTextAlign::Right; + toolBar1->Wrappable = false; + + // Add handlers for the ButtonClick and ButtonDropDown events. + toolBar1->ButtonDropDown += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonDropDown ); + toolBar1->ButtonClick += gcnew ToolBarButtonClickEventHandler( this, &MyToolBar::toolBar1_ButtonClicked ); + + // Add the toolbar to the form. + this->Controls->Add( toolBar1 ); + } + // + + // + void AddToolbarButtons( ToolBar^ toolBar ) + { + if ( !toolBar->Buttons->IsReadOnly ) + { + + // If toolBarButton1 in in the collection, remove it. + if ( toolBar->Buttons->Contains( toolBarButton1 ) ) + { + toolBar->Buttons->Remove( toolBarButton1 ); + } + + // Create three toolbar buttons. + ToolBarButton^ tbb1 = gcnew ToolBarButton( "tbb1" ); + ToolBarButton^ tbb2 = gcnew ToolBarButton( "tbb2" ); + ToolBarButton^ tbb3 = gcnew ToolBarButton( "tbb3" ); + + // Add toolbar buttons to the toolbar. + array^buttons = {tbb2,tbb3}; + toolBar->Buttons->AddRange( buttons ); + toolBar->Buttons->Add( "tbb4" ); + + // Insert tbb1 into the first position in the collection. + toolBar->Buttons->Insert( 0, tbb1 ); + } + } + // + + // + String^ GetButtonList( ToolBar^ toolBar ) + { + String^ buttonList = "ToolBarButtons: "; + IEnumerator^ x = toolBar->Buttons->GetEnumerator(); + + // Enumerate through the collection of toolbar buttons. + while ( x->MoveNext() ) + { + buttonList = String::Concat( buttonList, (dynamic_cast(x->Current))->Text, " " ); + } + + return buttonList; + } + // + + // + void toolBar1_ButtonDropDown( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ /*e*/ ) + { + + // If the text box is disabled, disable the menu item. + if ( !textBox1->Enabled ) + { + contextMenu1->MenuItems[ this->contextMenu1->MenuItems->IndexOf( menuItem1 ) ]->Enabled = false; + } + } + + void toolBar1_ButtonClicked( Object^ /*sender*/, System::Windows::Forms::ToolBarButtonClickEventArgs^ /*e*/ ) + { + + // Disable the text box. + textBox1->Enabled = false; + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + AddToolbarButtons( this->toolBar1 ); + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( this->GetButtonList( toolBar1 ) ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyToolBar ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp new file mode 100644 index 00000000000..ea8585ea7a2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ToolTip Example/CPP/form1.cpp @@ -0,0 +1,110 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::CheckBox^ checkBox1; + System::Windows::Forms::Button^ button1; + +public: + /// + /// Required designer variable. + /// + Form1() + { + // + // Required for Windows Form Designer support + // + InitializeComponent(); + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +private: + /// + /// Clean up any resources being used. + /// + + #pragma region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->checkBox1 = gcnew System::Windows::Forms::CheckBox; + this->SuspendLayout(); + // + // button1 + // + this->button1->Location = System::Drawing::Point( 200, 20 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 84, 24 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + // + // checkBox1 + // + this->checkBox1->Location = System::Drawing::Point( 204, 60 ); + this->checkBox1->Name = "checkBox1"; + this->checkBox1->TabIndex = 0; + this->checkBox1->Text = "checkBox1"; + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^ temp0 = { this->button1, this->checkBox1 }; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + #pragma endregion + + // + // This example assumes that the Form_Load event handling method + // is connected to the Load event of the form. + void Form1_Load( Object^ sender, System::EventArgs^ e ) + { + // Create the ToolTip and associate with the Form container. + ToolTip^ toolTip1 = gcnew ToolTip; + + // Set up the delays for the ToolTip. + toolTip1->AutoPopDelay = 5000; + toolTip1->InitialDelay = 1000; + toolTip1->ReshowDelay = 500; + // Force the ToolTip text to be displayed whether or not the form is active. + toolTip1->ShowAlways = true; + + // Set up the ToolTip text for the Button and Checkbox. + toolTip1->SetToolTip( this->button1, "My button1" ); + toolTip1->SetToolTip( this->checkBox1, "My checkBox1" ); + } + // +}; + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp new file mode 100644 index 00000000000..196dceb1e43 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ToolTipText/CPP/form1.cpp @@ -0,0 +1,51 @@ + + +#using +#using +#using + +// +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TabControl^ tabControl1; + TabPage^ tabPage1; + TabPage^ tabPage2; + void MyTabs() + { + this->tabControl1 = gcnew TabControl; + this->tabPage1 = gcnew TabPage; + this->tabPage2 = gcnew TabPage; + array^tabPages = {this->tabPage1,this->tabPage2}; + this->tabControl1->Controls->AddRange( tabPages ); + this->tabControl1->Location = Point(35,25); + this->tabControl1->Size = System::Drawing::Size( 220, 220 ); + + // Shows ToolTipText when the mouse passes over tabs. + this->tabControl1->ShowToolTips = true; + + // Assigns String* values to ToolTipText. + this->tabPage1->ToolTipText = "myTabPage1"; + this->tabPage2->ToolTipText = "myTabPage2"; + this->Size = System::Drawing::Size( 300, 300 ); + array^formControls = {this->tabControl1}; + this->Controls->AddRange( formControls ); + } + + +public: + Form1() + { + MyTabs(); + } + +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp new file mode 100644 index 00000000000..14653b4874e --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ToolboxCreatorCallbackSample/CPP/textdatatextboxcomponent.cpp @@ -0,0 +1,168 @@ +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Security::Permissions; + +namespace TextDataTextBoxComponent +{ + // Custom toolbox item creates a TextBox and sets its Text property + // to the constructor-specified text. + [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")] + public ref class TextToolboxItem: public ToolboxItem + { + private: + String^ text; + delegate void SetTextMethodHandler( Control^ c, String^ text ); + + public: + TextToolboxItem( String^ text ) + : ToolboxItem() + { + this->text = text; + } + + protected: + + // ToolboxItem::CreateComponentsCore to create the TextBox + // and link a method to set its Text property. + + virtual array^ CreateComponentsCore( IDesignerHost^ host ) override + { + TextBox^ textbox = dynamic_cast(host->CreateComponent( TextBox::typeid )); + + // Because the designer resets the text of the textbox, use + // a SetTextMethodHandler to set the text to the value of + // the text data. + Control^ c = dynamic_cast(host->RootComponent); + array^temp0 = {textbox,text}; + c->BeginInvoke( gcnew SetTextMethodHandler( this, &TextToolboxItem::OnSetText ), temp0 ); + array^temp1 = {textbox}; + return temp1; + } + + private: + + // Method to set the text property of a TextBox after it is initialized. + void OnSetText( Control^ c, String^ text ) + { + c->Text = text; + } + + }; + + + // Component that adds a "Text" data format ToolboxItemCreatorCallback + // to the Toolbox. This component uses a custom ToolboxItem that + // creates a TextBox containing the text data. + public ref class TextDataTextBoxComponent: public Component + { + private: + bool creatorAdded; + IToolboxService^ ts; + + public: + TextDataTextBoxComponent() + { + creatorAdded = false; + } + + + property System::ComponentModel::ISite^ Site + { + // ISite to register TextBox creator + virtual System::ComponentModel::ISite^ get() override + { + return __super::Site; + } + + virtual void set( System::ComponentModel::ISite^ value ) override + { + if ( value != nullptr ) + { + __super::Site = value; + if ( !creatorAdded ) + AddTextTextBoxCreator(); + } + else + { + if ( creatorAdded ) + RemoveTextTextBoxCreator(); + __super::Site = value; + } + } + } + + private: + + // Adds a "Text" data format creator to the toolbox that creates + // a textbox from a text fragment pasted to the toolbox. + void AddTextTextBoxCreator() + { + ts = dynamic_cast(GetService( IToolboxService::typeid )); + if ( ts != nullptr ) + { + ToolboxItemCreatorCallback^ textCreator = + gcnew ToolboxItemCreatorCallback( + this, + &TextDataTextBoxComponent::CreateTextBoxForText ); + try + { + ts->AddCreator( + textCreator, + "Text", + dynamic_cast(GetService( IDesignerHost::typeid )) ); + creatorAdded = true; + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->ToString(), "Exception Information" ); + } + } + } + + + // Removes any "Text" data format creator from the toolbox. + void RemoveTextTextBoxCreator() + { + if ( ts != nullptr ) + { + ts->RemoveCreator( + "Text", + dynamic_cast(GetService( IDesignerHost::typeid )) ); + creatorAdded = false; + } + } + + + // ToolboxItemCreatorCallback delegate format method to create + // the toolbox item. + ToolboxItem^ CreateTextBoxForText( Object^ serializedObject, String^ format ) + { + IDataObject^ o = gcnew DataObject(dynamic_cast(serializedObject)); + + if( o->GetDataPresent("System::String", true) ) + { + String^ toolboxText = dynamic_cast(o->GetData( "System::String", true )); + return( gcnew TextToolboxItem( toolboxText )); + } + + return nullptr; + } + + public: + ~TextDataTextBoxComponent() + { + if ( creatorAdded ) + RemoveTextTextBoxCreator(); + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp b/snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp new file mode 100644 index 00000000000..7a4d21396ba --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/ToolboxItemCollectionExample/CPP/class1.cpp @@ -0,0 +1,54 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; + +[STAThread] +int main() +{ + + // + // Create a new ToolboxItemCollection using a ToolboxItem array. + array^temp0 = {gcnew ToolboxItem( System::Windows::Forms::Label::typeid ),gcnew ToolboxItem( System::Windows::Forms::TextBox::typeid )}; + ToolboxItemCollection^ collection = gcnew ToolboxItemCollection( temp0 ); + // + + // + // Create a new ToolboxItemCollection using an existing ToolboxItemCollection. + ToolboxItemCollection^ coll = gcnew ToolboxItemCollection( collection ); + // + + // + // Get the number of items in the collection. + int collectionLength = collection->Count; + // + + // + // Get the ToolboxItem at each index. + ToolboxItem^ item = nullptr; + for ( int index = 0; index < collection->Count; index++ ) + item = collection[ index ]; + // + + // + // If the collection contains the specified ToolboxItem, + // retrieve the collection index of the specified item. + int indx = -1; + if ( collection->Contains( item ) ) + indx = collection->IndexOf( item ); + // + + // + // Copy the ToolboxItemCollection to the specified array. + array^items = gcnew array(collection->Count); + collection->CopyTo( items, 0 ); + // +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp new file mode 100644 index 00000000000..433d0cfab0c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Trackbar/CPP/form1.cpp @@ -0,0 +1,197 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Panel^ panel1; + System::Windows::Forms::TrackBar^ trackBar1; + System::Windows::Forms::TrackBar^ trackBar2; + System::Windows::Forms::TrackBar^ trackBar3; + System::Windows::Forms::Label ^ label1; + System::Windows::Forms::Label ^ label3; + System::Windows::Forms::Label ^ label2; + +public: + + /// + /// Required designer variable. + /// + Form1() + { + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + // + trackBar2->Orientation = Orientation::Vertical; + trackBar3->Orientation = Orientation::Vertical; + trackBar1->Maximum = 255; + trackBar2->Maximum = 255; + trackBar3->Maximum = 255; + trackBar1->Width = 400; + trackBar2->Height = trackBar1->Width; + trackBar3->Height = trackBar1->Width; + trackBar1->LargeChange = 16; + trackBar2->LargeChange = 16; + trackBar3->LargeChange = 16; + + // + } + + +private: + + /// + /// Clean up any resources being used. + /// + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->trackBar1 = gcnew System::Windows::Forms::TrackBar; + this->trackBar2 = gcnew System::Windows::Forms::TrackBar; + this->trackBar3 = gcnew System::Windows::Forms::TrackBar; + this->panel1 = gcnew System::Windows::Forms::Panel; + this->label1 = gcnew System::Windows::Forms::Label; + this->label2 = gcnew System::Windows::Forms::Label; + this->label3 = gcnew System::Windows::Forms::Label; + + // + (dynamic_cast(this->trackBar1))->BeginInit(); + (dynamic_cast(this->trackBar2))->BeginInit(); + (dynamic_cast(this->trackBar3))->BeginInit(); + this->SuspendLayout(); + + // + // trackBar1 + // + this->trackBar1->Location = System::Drawing::Point( 160, 400 ); + this->trackBar1->Name = "trackBar1"; + this->trackBar1->TabIndex = 1; + this->trackBar1->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll ); + + // + // trackBar2 + // + this->trackBar2->Location = System::Drawing::Point( 608, 40 ); + this->trackBar2->Name = "trackBar2"; + this->trackBar2->TabIndex = 2; + this->trackBar2->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll ); + + // + // trackBar3 + // + this->trackBar3->Location = System::Drawing::Point( 56, 40 ); + this->trackBar3->Name = "trackBar3"; + this->trackBar3->TabIndex = 3; + this->trackBar3->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll ); + (dynamic_cast(this->trackBar1))->EndInit(); + (dynamic_cast(this->trackBar2))->EndInit(); + (dynamic_cast(this->trackBar3))->EndInit(); + + // + // + // panel1 + // + this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + this->panel1->Location = System::Drawing::Point( 128, 32 ); + this->panel1->Name = "panel1"; + this->panel1->Size = System::Drawing::Size( 464, 352 ); + this->panel1->TabIndex = 0; + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 288, 448 ); + this->label1->Name = "label1"; + this->label1->TabIndex = 4; + + // + // label2 + // + this->label2->Location = System::Drawing::Point( 600, 16 ); + this->label2->Name = "label2"; + this->label2->Size = System::Drawing::Size( 120, 16 ); + this->label2->TabIndex = 5; + + // + // label3 + // + this->label3->Location = System::Drawing::Point( 8, 16 ); + this->label3->Name = "label3"; + this->label3->Size = System::Drawing::Size( 120, 16 ); + this->label3->TabIndex = 6; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 728, 477 ); + array^temp1 = {this->label3,this->label2,this->label1,this->trackBar3,this->trackBar2,this->trackBar1,this->panel1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Color builder"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + void Form1_Load( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + showColorValueLabels(); + } + + + // + void showColorValueLabels() + { + label1->Text = String::Format( "Red value is : {0}", trackBar1->Value ); + label2->Text = String::Format( "Green Value is : {0}", trackBar2->Value ); + label3->Text = String::Format( "Blue Value is : {0}", trackBar3->Value ); + } + + void trackBar_Scroll( Object^ sender, System::EventArgs^ /*e*/ ) + { + System::Windows::Forms::TrackBar^ myTB; + myTB = dynamic_cast(sender); + panel1->BackColor = Color::FromArgb( trackBar1->Value, trackBar2->Value, trackBar3->Value ); + myTB->Text = String::Format( "Value is {0}", myTB->Value ); + showColorValueLabels(); + } + + // +}; + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} + +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp new file mode 100644 index 00000000000..e10643d43d3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection/CPP/treenodecollection.cpp @@ -0,0 +1,176 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ToolBarStuff +{ + /// + /// Summary description for Form1. + /// + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::TreeView^ treeView2; + System::Windows::Forms::Button^ button2; + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + + + protected: + /// + /// Clean up any resources being used. + /// + + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + /// + /// Required method for Designer support; do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->treeView1 = gcnew System::Windows::Forms::TreeView; + this->button1 = gcnew System::Windows::Forms::Button; + this->treeView2 = gcnew System::Windows::Forms::TreeView; + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // treeView1 + // + this->treeView1->ImageIndex = -1; + this->treeView1->Location = System::Drawing::Point( 8, 8 ); + this->treeView1->Name = "treeView1"; + array^temp0 = {gcnew System::Windows::Forms::TreeNode( "Node5" ),gcnew System::Windows::Forms::TreeNode( "Node6" ),gcnew System::Windows::Forms::TreeNode( "Node7" )}; + array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node8" ),gcnew System::Windows::Forms::TreeNode( "Node9" ),gcnew System::Windows::Forms::TreeNode( "Node10" )}; + array^temp2 = {gcnew System::Windows::Forms::TreeNode( "Node11" ),gcnew System::Windows::Forms::TreeNode( "Node12" ),gcnew System::Windows::Forms::TreeNode( "Node13" )}; + array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node15" )}; + array^temp4 = {gcnew System::Windows::Forms::TreeNode( "Node14",temp3 ),gcnew System::Windows::Forms::TreeNode( "Node16" ),gcnew System::Windows::Forms::TreeNode( "Node17" )}; + array^temp5 = {gcnew System::Windows::Forms::TreeNode( "Node21" )}; + array^temp6 = {gcnew System::Windows::Forms::TreeNode( "Node20",temp5 )}; + array^temp7 = {gcnew System::Windows::Forms::TreeNode( "Node19",temp6 )}; + array^temp8 = {gcnew System::Windows::Forms::TreeNode( "Node18",temp7 )}; + array^temp9 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp0 ),gcnew System::Windows::Forms::TreeNode( "Node1",temp1 ),gcnew System::Windows::Forms::TreeNode( "Node2",temp2 ),gcnew System::Windows::Forms::TreeNode( "Node3",temp4 ),gcnew System::Windows::Forms::TreeNode( "Node4",temp8 )}; + this->treeView1->Nodes->AddRange( temp9 ); + this->treeView1->SelectedImageIndex = -1; + this->treeView1->Size = System::Drawing::Size( 128, 224 ); + this->treeView1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 8, 240 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "Move ->"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // treeView2 + // + this->treeView2->ImageIndex = -1; + this->treeView2->Location = System::Drawing::Point( 144, 8 ); + this->treeView2->Name = "treeView2"; + this->treeView2->SelectedImageIndex = -1; + this->treeView2->Size = System::Drawing::Size( 144, 224 ); + this->treeView2->TabIndex = 2; + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 192, 240 ); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 96, 23 ); + this->button2->TabIndex = 3; + this->button2->Text = "Delete [0] Node"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp10 = {this->button2,this->treeView2,this->button1,this->treeView1}; + this->Controls->AddRange( temp10 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // If neither TreeNodeCollection is read-only, move the + // selected node from treeView1 to treeView2. + if ( !treeView1->Nodes->IsReadOnly && !treeView2->Nodes->IsReadOnly ) + { + if ( treeView1->SelectedNode != nullptr ) + { + TreeNode^ tn = treeView1->SelectedNode; + treeView1->Nodes->Remove( tn ); + treeView2->Nodes->Insert( treeView2->Nodes->Count, tn ); + } + } + } + // + + // + void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Delete the first TreeNode in the collection + // if the Text property is S"Node0." + if ( this->treeView1->Nodes[ 0 ]->Text->Equals( "Node0" ) ) + { + this->treeView1->Nodes->RemoveAt( 0 ); + } + } + // + }; +} + + +/// +/// The main entry point for the application. +/// + +[STAThread] +int main() +{ + Application::Run( gcnew ToolBarStuff::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp new file mode 100644 index 00000000000..d4df63dad0d --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Clear/CPP/treenodecollection_clear.cpp @@ -0,0 +1,231 @@ + + +// System::Windows::Forms::TreeNodeCollection::Clear +// System::Windows::Forms::TreeNodeCollection::AddRange +/* +The following program demonstrates the 'Clear' and 'AddRange' methods of +the 'TreeNodeCollection' class. It creates two 'TreeView' objects, the first +Object* contains the customer list and the second Object* is empty. The user +is provided with the option to add or remove a 'TreeNode'. + +*/ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class MyCustomerClass +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + MyCustomerClass( String^ name ) + { + CustomerName = name; + CustomerOrders = gcnew ArrayList; + } + +}; + +public ref class MyOrder +{ +public: + String^ OrderID; + MyOrder( String^ orderID ) + { + this->OrderID = orderID; + } + +}; + +public ref class myTreeNodeCollectionForm: public Form +{ +private: + Button^ myButtonAddAll; + Button^ myButtonAdd; + TreeView^ myTreeViewBase; + TreeView^ myTreeViewCustom; + Button^ myButtonRemoveAll; + +public: + myTreeNodeCollectionForm() + { + InitializeComponent(); + FillMyTreeView(); + myButtonAddAll->Click += gcnew EventHandler( this, &myTreeNodeCollectionForm::MyButtonAddAllClick ); + myButtonAdd->Click += gcnew EventHandler( this, &myTreeNodeCollectionForm::MyButtonAddClick ); + myButtonRemoveAll->Click += gcnew EventHandler( this, &myTreeNodeCollectionForm::MyButtonRemoveAllClick ); + } + + // + // +private: + void MyButtonAddAllClick( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Get the 'myTreeNodeCollection' from the 'myTreeViewBase' TreeView. + TreeNodeCollection^ myTreeNodeCollection = myTreeViewBase->Nodes; + + // Create an array of 'TreeNodes'. + array^myTreeNodeArray = gcnew array(myTreeViewBase->Nodes->Count); + + // Copy the tree nodes to the 'myTreeNodeArray' array. + myTreeViewBase->Nodes->CopyTo( myTreeNodeArray, 0 ); + + // Remove all the tree nodes from the 'myTreeViewBase' TreeView. + myTreeViewBase->Nodes->Clear(); + + // Add the 'myTreeNodeArray' to the 'myTreeViewCustom' TreeView. + myTreeViewCustom->Nodes->AddRange( myTreeNodeArray ); + } + // + // + + void MyButtonRemoveAllClick( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Get the 'myTreeNodeCollection' from the 'myTreeViewCustom' TreeView. + TreeNodeCollection^ myTreeNodeCollection = myTreeViewCustom->Nodes; + + // Create an array of 'TreeNodes'. + array^myTreeNodeArray = gcnew array(myTreeViewCustom->Nodes->Count); + + // Copy the tree nodes to the 'myTreeNodeArray' array. + myTreeViewCustom->Nodes->CopyTo( myTreeNodeArray, 0 ); + + // Remove all the tree nodes from the 'myTreeViewCustom' TreeView. + myTreeViewCustom->Nodes->Clear(); + + // Add the 'myTreeNodeArray' to the 'myTreeViewBase' TreeView. + myTreeViewBase->Nodes->AddRange( myTreeNodeArray ); + } + + void MyButtonAddClick( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + TreeNodeCollection^ myTreeNodeCollection = myTreeViewBase->Nodes; + IEnumerator^ myEnum = myTreeNodeCollection->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ myTreeNode = safe_cast(myEnum->Current); + if ( myTreeNode->IsSelected) + { + + // Remove the selected node from the 'myTreeViewBase' TreeView. + myTreeViewBase->Nodes->Remove( myTreeNode ); + + // Add the selected node to the 'myTreeViewCustom' TreeView. + myTreeViewCustom->Nodes->Add( myTreeNode ); + } + } + } + + void FillMyTreeView() + { + ArrayList^ customerArray = gcnew ArrayList; + + // Add customers to the ArrayList of 'MyCustomerClass' objects. + for ( int x = 1; x <= 10; x++ ) + { + customerArray->Add( gcnew MyCustomerClass( String::Concat( "Customer ", x ) ) ); + + } + + // Add orders to each 'MyCustomerClass' Object* in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MyCustomerClass^ myCustomerClass1 = safe_cast(myEnum->Current); + for ( int y = 1; y <= 5; y++ ) + { + myCustomerClass1->CustomerOrders->Add( gcnew MyOrder( String::Concat( "Order ", y ) ) ); + + } + } + + // Supress repainting until all the objects have been created. + myTreeViewBase->BeginUpdate(); + + // Clear the 'TreeView' each time the method is called. + myTreeViewBase->Nodes->Clear(); + TreeNodeCollection^ myTreeNodeCollectionCustomer = myTreeViewBase->Nodes; + + // Add a root treenode for each 'MyCustomerClass' object in the ArrayList. + while ( myEnum->MoveNext() ) + { + MyCustomerClass^ myCustomerClass2 = safe_cast(myEnum->Current); + myTreeNodeCollectionCustomer->Add( gcnew TreeNode( myCustomerClass2->CustomerName ) ); + TreeNodeCollection^ myTreeNodeCollectionOrders = myTreeNodeCollectionCustomer[ customerArray->IndexOf( myCustomerClass2 ) ]->Nodes; + + // Add a child treenode for each 'MyOrder' object. + IEnumerator^ myEnum = myCustomerClass2->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MyOrder^ myOrder1 = safe_cast(myEnum->Current); + myTreeNodeCollectionOrders->Add( gcnew TreeNode( myOrder1->OrderID ) ); + TreeNode^ myTreeNodeOrder = myTreeNodeCollectionOrders[ myCustomerClass2->CustomerOrders->IndexOf( myOrder1 ) ]; + } + } + + myTreeViewBase->SelectedImageIndex = 0; + + // Begin repainting the 'TreeView'. + myTreeViewBase->EndUpdate(); + } + + void InitializeComponent() + { + this->myTreeViewBase = gcnew TreeView; + this->myButtonAddAll = gcnew Button; + this->myButtonAdd = gcnew Button; + this->myTreeViewCustom = gcnew TreeView; + this->myButtonRemoveAll = gcnew Button; + this->SuspendLayout(); + this->myTreeViewBase->ImageIndex = -1; + this->myTreeViewBase->Location = Point(64,16); + this->myTreeViewBase->Name = "myTreeViewBase"; + this->myTreeViewBase->SelectedImageIndex = -1; + this->myTreeViewBase->Size = System::Drawing::Size( 160, 192 ); + this->myTreeViewBase->TabIndex = 0; + this->myButtonAddAll->Location = Point(248,112); + this->myButtonAddAll->Name = "myButtonAddAll"; + this->myButtonAddAll->Size = System::Drawing::Size( 96, 23 ); + this->myButtonAddAll->TabIndex = 2; + this->myButtonAddAll->Text = "Add >>"; + this->myButtonAdd->Location = Point(248,48); + this->myButtonAdd->Name = "myButtonAdd"; + this->myButtonAdd->Size = System::Drawing::Size( 96, 23 ); + this->myButtonAdd->TabIndex = 3; + this->myButtonAdd->Text = "Add >"; + this->myTreeViewCustom->ImageIndex = -1; + this->myTreeViewCustom->Location = Point(376,16); + this->myTreeViewCustom->Name = "myTreeViewCustom"; + this->myTreeViewCustom->SelectedImageIndex = -1; + this->myTreeViewCustom->Size = System::Drawing::Size( 168, 192 ); + this->myTreeViewCustom->TabIndex = 1; + this->myButtonRemoveAll->Location = Point(248,176); + this->myButtonRemoveAll->Name = "myButtonRemoveAll"; + this->myButtonRemoveAll->Size = System::Drawing::Size( 96, 23 ); + this->myButtonRemoveAll->TabIndex = 4; + this->myButtonRemoveAll->Text = "<< Remove "; + this->ClientSize = System::Drawing::Size( 616, 273 ); + this->Controls->Add( this->myButtonRemoveAll ); + this->Controls->Add( this->myButtonAdd ); + this->Controls->Add( this->myButtonAddAll ); + this->Controls->Add( this->myTreeViewCustom ); + this->Controls->Add( this->myTreeViewBase ); + this->Name = "myTreeNodeCollectionForm"; + this->Text = "TreeNodeCollection class Sample"; + this->ResumeLayout( false ); + } +}; + +int main() +{ + Application::Run( gcnew myTreeNodeCollectionForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp new file mode 100644 index 00000000000..f97eff9ef45 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Contains_GetEnumerator/CPP/treenodecollection_contains_getenumerator.cpp @@ -0,0 +1,127 @@ + + +// System::Windows::Forms::TreeNodeCollection::Contains() +// System::Windows::Forms::TreeNodeCollection::GetEnumerator() + +/* +The following program demonstrates 'Contains' and 'GetEnumerator' +methods of 'System::Windows::Forms::TreeNodeCollection' class. It +creates a TreeView with two TreeNodes and gets the collection of +TreeNodes. It checks for a TreeNode in the collection and also +gets an Enumerator to iterate through the collection. +*/ + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + TreeView^ myTreeView; + TreeNode^ myTreeNode1; + TreeNode^ myTreeNode2; + Label^ myLabel; + System::ComponentModel::Container^ components; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + } + +protected: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->myTreeView = gcnew TreeView; + this->myLabel = gcnew Label; + this->SuspendLayout(); + + // + // myTreeView + // + this->myTreeView->ImageIndex = -1; + this->myTreeView->Name = "treeView1"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->TabIndex = 0; + + // Create TreeNodes. + myTreeNode1 = gcnew TreeNode( "Node1" ); + myTreeNode2 = gcnew TreeNode( "Node2" ); + array^temp0 = {myTreeNode1,myTreeNode2}; + this->myTreeView->Nodes->AddRange( temp0 ); + + // + // myLabel + // + this->myLabel->Location = Point(8,136); + this->myLabel->Name = "myLabel"; + this->myLabel->Size = System::Drawing::Size( 248, 112 ); + this->myLabel->TabIndex = 1; + + // + // MyForm + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp1 = {this->myLabel,this->myTreeView}; + this->Controls->AddRange( temp1 ); + this->Name = "MyForm"; + this->Text = "MyForm"; + this->Load += gcnew EventHandler( this, &MyForm::MyForm_Load ); + this->ResumeLayout( false ); + } + + void MyForm_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + EnumerateTreeNodes(); + } + + // + // + void EnumerateTreeNodes() + { + TreeNodeCollection^ myNodeCollection = myTreeView->Nodes; + + // Check for a node in the collection. + if ( myNodeCollection->Contains( myTreeNode2 ) ) + { + myLabel->Text = myLabel->Text + "Node2 is at index: " + myNodeCollection->IndexOf( myTreeNode2 ); + } + + myLabel->Text = myLabel->Text + "\n\nElements of the TreeNodeCollection:\n"; + + // Create an enumerator for the collection. + IEnumerator^ myEnumerator = myNodeCollection->GetEnumerator(); + while ( myEnumerator->MoveNext() ) + { + myLabel->Text = myLabel->Text + (dynamic_cast(myEnumerator->Current))->Text + "\n"; + } + } + // + // +}; + + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp new file mode 100644 index 00000000000..0dd12dbc9bc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNodeCollection_Count_CopyTo/CPP/treenodecollection_count_copyto.cpp @@ -0,0 +1,125 @@ + + +// System::Windows::Forms::TreeNodeCollection::Count +// System::Windows::Forms::TreeNodeCollection::CopyTo() +/* +The following program demonstrates 'Count' property and 'CopyTo' +method of 'System::Windows::Forms::TreeNodeCollection' class. It +creates a TreeView with two TreeNodes and gets the collection of +TreeNodes. It copies the collection into an array +and displays the count of the collection and the elements of the +array. +*/ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class MyForm: public Form +{ +private: + TreeView^ myTreeView; + TreeNode^ myTreeNode1; + TreeNode^ myTreeNode2; + Label^ myLabel; + System::ComponentModel::Container^ components; + +public: + MyForm() + { + components = nullptr; + InitializeComponent(); + } + +protected: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->myTreeView = gcnew TreeView; + this->myLabel = gcnew Label; + this->SuspendLayout(); + + // + // myTreeView + // + this->myTreeView->ImageIndex = -1; + this->myTreeView->Name = "treeView1"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->TabIndex = 0; + + // Add TreeNodes. + myTreeNode1 = gcnew TreeNode( "Node1" ); + myTreeNode2 = gcnew TreeNode( "Node2" ); + array^temp0 = {myTreeNode1,myTreeNode2}; + this->myTreeView->Nodes->AddRange( temp0 ); + + // + // myLabel + // + this->myLabel->Location = Point(8,136); + this->myLabel->Name = "myLabel"; + this->myLabel->Size = System::Drawing::Size( 248, 112 ); + this->myLabel->TabIndex = 1; + + // + // MyForm + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp1 = {this->myLabel,this->myTreeView}; + this->Controls->AddRange( temp1 ); + this->Name = "MyForm"; + this->Text = "MyForm"; + this->Load += gcnew EventHandler( this, &MyForm::MyForm_Load ); + this->ResumeLayout( false ); + } + + void MyForm_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + CopyTreeNodes(); + } + + // + // + void CopyTreeNodes() + { + // Get the collection of TreeNodes. + TreeNodeCollection^ myNodeCollection = myTreeView->Nodes; + int myCount = myNodeCollection->Count; + myLabel->Text = String::Concat( myLabel->Text, "Number of nodes in the collection : ", myCount ); + myLabel->Text = String::Concat( myLabel->Text, "\n\nElements of the Array after Copying from the collection :\n" ); + + // Create an Object array. + array^myArray = gcnew array(myCount); + + // Copy the collection into an array. + myNodeCollection->CopyTo( myArray, 0 ); + for ( int i = 0; i < myArray->Length; i++ ) + { + myLabel->Text = myLabel->Text + (dynamic_cast(myArray[ i ]))->Text + "\n"; + + } + } + // + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp new file mode 100644 index 00000000000..f7dd99b0a0a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Bounds/CPP/treenode_bounds.cpp @@ -0,0 +1,254 @@ + + +// System::Windows::Forms::TreeNode::TreeNode() +// System::Windows::Forms::TreeNode::TreeNode(String*, TreeNode[]) +// System::Windows::Forms::TreeNode::Bounds +// System::Windows::Forms::TreeNode::ForeColor +// System::Windows::Forms::TreeNode::NodeFont +// System::Windows::Forms::TreeNode::Text +// System::Windows::Forms::TreeNode::Tag +// System::Windows::Forms::TreeView::ItemHeight + +/* +The following example demonstrates the constructors 'TreeNode()' +and 'TreeNode(String*, TreeNode[])' and the property 'Bounds' of the +'TreeNode' class. This example displays customer information in a +'TreeView' control. The root tree nodes display customer names, and +the child tree nodes display the order numbers assigned to each +customer. +*/ + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +public ref class Customer +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + Customer( String^ myName ) + { + CustomerName = myName; + CustomerOrders = gcnew ArrayList; + } + +}; + +public ref class Order +{ +public: + String^ OrderID; + Order( String^ myOrderID ) + { + this->OrderID = myOrderID; + } + +}; + +public ref class TreeNode_Bounds: public Form +{ +private: + TreeView^ myTreeView; + Button^ myButton; + Label^ mylabel; + ComboBox^ myComboBox; + + // ArrayList object to hold the 'Customer' objects. + ArrayList^ customerArray; + +public: + TreeNode_Bounds() + { + customerArray = gcnew ArrayList; + InitializeComponent(); + FillMyTreeView(); + } + + +private: + void FillMyTreeView() + { + + // Add customers to the ArrayList of 'Customer' objects. + for ( int xIndex = 1; xIndex <= 5; xIndex++ ) + { + customerArray->Add( gcnew Customer( String::Concat( "Customer ", xIndex ) ) ); + + } + + // Add orders to each 'Customer' Object* in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ customer1 = safe_cast(myEnum->Current); + for ( int yIndex = 1; yIndex <= 5; yIndex++ ) + { + customer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", yIndex ) ) ); + + } + } + + myTreeView->BeginUpdate(); + + // Clear the TreeView each time the method is called. + myTreeView->Nodes->Clear(); + AddRootNodes(); + + // Begin repainting the TreeView. + myTreeView->EndUpdate(); + } + + +public: + + // +ref class Customer +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + Customer( String^ myName ) + { + CustomerName = myName; + CustomerOrders = gcnew ArrayList; + } + +}; + +ref class Order +{ +public: + String^ OrderID; + Order( String^ myOrderID ) + { + this->OrderID = myOrderID; + } + +}; + + + void AddRootNodes() + { + + // Add a root node to assign the customer nodes to. + TreeNode^ rootNode = gcnew TreeNode; + rootNode->Text = "CustomerList"; + + // Add a main root treenode. + myTreeView->Nodes->Add( rootNode ); + + // Add a root treenode for each 'Customer' object in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ myCustomer = safe_cast(myEnum->Current); + + // Add a child treenode for each Order object. + int i = 0; + array^myTreeNodeArray = gcnew array(5); + IEnumerator^ myEnum = myCustomer->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Order^ myOrder = safe_cast(myEnum->Current); + myTreeNodeArray[ i ] = gcnew TreeNode( myOrder->OrderID ); + i++; + } + TreeNode^ customerNode = gcnew TreeNode( myCustomer->CustomerName,myTreeNodeArray ); + + // Display the customer names with and Orange font. + customerNode->ForeColor = Color::Orange; + + // Store the Customer Object* in the Tag property of the TreeNode. + customerNode->Tag = myCustomer; + myTreeView->Nodes[ 0 ]->Nodes->Add( customerNode ); + } + } + // + + // +private: + void Button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + myTreeView->ItemHeight = 5; + myTreeView->SelectedNode->NodeFont = gcnew System::Drawing::Font( "Arial",5 ); + + // Get the font size from combobox. + String^ selectedString = myComboBox->SelectedItem->ToString(); + int myNodeFontSize = Int32::Parse( selectedString ); + + // Set the font of root node. + myTreeView->SelectedNode->NodeFont = gcnew System::Drawing::Font( "Arial",(float)myNodeFontSize ); + for ( int i = 0; i < myTreeView->Nodes[ 0 ]->Nodes->Count; i++ ) + { + + // Set the font of child nodes. + myTreeView->Nodes[ 0 ]->Nodes[ i ]->NodeFont = gcnew System::Drawing::Font( "Arial",(float)myNodeFontSize ); + + } + + // Get the bounds of the tree node. + Rectangle myRectangle = myTreeView->SelectedNode->Bounds; + int myNodeHeight = myRectangle.Height; + if ( myNodeHeight < myNodeFontSize ) + { + myNodeHeight = myNodeFontSize; + } + + myTreeView->ItemHeight = myNodeHeight + 4; + } + // + + void InitializeComponent() + { + this->myTreeView = gcnew System::Windows::Forms::TreeView; + this->myButton = gcnew System::Windows::Forms::Button; + this->myComboBox = gcnew System::Windows::Forms::ComboBox; + this->mylabel = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + this->myTreeView->ImageIndex = -1; + this->myTreeView->Location = System::Drawing::Point( 8, 0 ); + this->myTreeView->Name = "myTreeView"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->Size = System::Drawing::Size( 280, 152 ); + this->myTreeView->TabIndex = 0; + this->myButton->Location = System::Drawing::Point( 104, 232 ); + this->myButton->Name = "myButton"; + this->myButton->TabIndex = 2; + this->myButton->Text = "Submit"; + this->myButton->Click += gcnew System::EventHandler( this, &TreeNode_Bounds::Button1_Click ); + this->myComboBox->DropDownWidth = 121; + array^temp0 = {"6","7","8","10","12","16","18","22"}; + this->myComboBox->Items->AddRange( temp0 ); + this->myComboBox->Location = System::Drawing::Point( 112, 184 ); + this->myComboBox->Name = "myComboBox"; + this->myComboBox->Size = System::Drawing::Size( 121, 21 ); + this->myComboBox->TabIndex = 1; + this->myComboBox->SelectedIndex = 0; + this->myComboBox->DropDownStyle = ComboBoxStyle::DropDownList; + this->mylabel->Location = System::Drawing::Point( 0, 184 ); + this->mylabel->Name = "mylabel"; + this->mylabel->TabIndex = 3; + this->mylabel->Text = "Select a Height for TreeNode"; + this->mylabel->Size = System::Drawing::Size( 100, 50 ); + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp1 = {this->mylabel,this->myButton,this->myComboBox,this->myTreeView}; + this->Controls->AddRange( temp1 ); + this->Text = "TreeNode Example"; + this->ResumeLayout( false ); + } + +}; + +int main() +{ + Application::Run( gcnew TreeNode_Bounds ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp new file mode 100644 index 00000000000..a9d7cfd1f15 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Checked/CPP/treenode_checked.cpp @@ -0,0 +1,189 @@ + + +// System::Windows::Forms::TreeNode::Checked +// System::Windows::Forms::TreeNode::BackColor +/* +The following example demonstrates the properties 'Checked' and +'BackColor' of the 'TreeNode' class. This example displays customer +information in a 'TreeView' control. The root tree nodes display +customer names, and the child tree nodes display the order numbers +assigned to each customer. It also displays selected nodes in a +messagebox. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::Windows::Forms; +public ref class Customer +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + Customer( String^ myName ) + { + CustomerName = myName; + CustomerOrders = gcnew ArrayList; + } + +}; + +public ref class Order +{ +public: + String^ OrderID; + Order( String^ myOrderID ) + { + this->OrderID = myOrderID; + } + +}; + +public ref class TreeNode_Bounds: public Form +{ +private: + TreeView^ myTreeView; + Button^ myButton; + + // ArrayList Object* to hold the Customer objects. + ArrayList^ customerArray; + TreeNode^ rootNode; + +public: + TreeNode_Bounds() + { + customerArray = gcnew ArrayList; + InitializeComponent(); + FillMyTreeView(); + } + + +private: + void FillMyTreeView() + { + + // Add customers to the ArrayList of 'Customer' objects. + for ( int x = 1; x <= 5; x++ ) + { + customerArray->Add( gcnew Customer( String::Concat( "Customer ", x ) ) ); + + } + + // Add orders to each 'Customer' object in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ customer1 = safe_cast(myEnum->Current); + for ( int y = 1; y <= 5; y++ ) + { + customer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", y ) ) ); + + } + } + + myTreeView->BeginUpdate(); + + // Clear the TreeView each time the method is called. + myTreeView->Nodes->Clear(); + rootNode = gcnew TreeNode; + rootNode->Text = "CustomerList"; + + // Add a main root treenode. + myTreeView->Nodes->Add( rootNode ); + myTreeView->CheckBoxes = true; + + // Add a root treenode for each 'Customer' object in the ArrayList. + while ( myEnum->MoveNext() ) + { + Customer^ myCustomer = safe_cast(myEnum->Current); + + // Add a child treenode for each 'Order' object. + int countIndex = 0; + array^myTreeNodeArray = gcnew array(5); + IEnumerator^ myEnum = myCustomer->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Order^ myOrder = safe_cast(myEnum->Current); + myTreeNodeArray[ countIndex ] = gcnew TreeNode( myOrder->OrderID ); + countIndex++; + } + + TreeNode^ customerNode = gcnew TreeNode( myCustomer->CustomerName,myTreeNodeArray ); + myTreeView->Nodes[ 0 ]->Nodes->Add( customerNode ); + } + + + // Begin repainting the TreeView. + myTreeView->EndUpdate(); + } + + + + // +public: + void HighlightCheckedNodes() + { + int countIndex = 0; + String^ selectedNode = "Selected customer nodes are : "; + IEnumerator^ myEnum = myTreeView->Nodes[ 0 ]->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ myNode = safe_cast(myEnum->Current); + + // Check whether the tree node is checked. + if ( myNode->Checked ) + { + + // Set the node's backColor. + myNode->BackColor = Color::Yellow; + selectedNode = String::Concat( selectedNode, myNode->Text, " " ); + countIndex++; + } + else + myNode->BackColor = Color::White; + } + + if ( countIndex > 0 ) + MessageBox::Show( selectedNode ); + else + MessageBox::Show( "No nodes are selected" ); + } + // + +private: + void MyButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + HighlightCheckedNodes(); + } + + void InitializeComponent() + { + this->myTreeView = gcnew System::Windows::Forms::TreeView; + this->SuspendLayout(); + this->myTreeView->ImageIndex = -1; + this->myTreeView->Location = System::Drawing::Point( 8, 0 ); + this->myTreeView->Name = "myTreeView"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->Size = System::Drawing::Size( 280, 152 ); + this->myTreeView->TabIndex = 0; + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->myButton = gcnew Button; + array^temp0 = {this->myButton,this->myTreeView}; + this->Controls->AddRange( temp0 ); + this->myButton->Location = Point(80,200); + this->myButton->Size = System::Drawing::Size( 140, 25 ); + this->myButton->Text = "Display Selected Nodes"; + this->myButton->Click += gcnew EventHandler( this, &TreeNode_Bounds::MyButton_Click ); + this->Text = "TreeNode Example"; + this->ResumeLayout( false ); + } + +}; + +int main() +{ + Application::Run( gcnew TreeNode_Bounds ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp new file mode 100644 index 00000000000..a5dac865607 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_EnsureVisible_4/CPP/treenode_ensurevisible_4.cpp @@ -0,0 +1,222 @@ + + +// System::Windows::Forms::TreeNode::Expand() +// System::Windows::Forms::TreeNode::Collapse() +// System::Windows::Forms::TreeNode::EnsureVisible() +// System::Windows::Forms::TreeNode::Clone() +/* The following program demonstrates 'Expand', 'Collapse', +'EnsureVisible' and 'Clone' methods of 'System::Windows::Forms::TreeNode' +class. It creates a TreeView, adds 10 TreeNode objects to it and +expands node1, collapses node1 and makes a clone to Node 9 and add it to Node7. */ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace MyTreeNode +{ + // Define a Customer Class. + public ref class Customer + { + public: + String^ myCustomerName; + ArrayList^ MyOrders; + Customer( String^ name ) + { + MyOrders = gcnew ArrayList; + myCustomerName = name; + } + }; + + + // Define an Order Class which will be associated to a customer. + public ref class Order + { + public: + String^ myOrderName; + Order( String^ name1 ) + { + myOrderName = name1; + } + + }; + + public ref class Form1: public Form + { + private: + TreeView^ treeView1; + ArrayList^ myCustomerList; + Button^ button1; + Button^ button2; + Button^ button3; + Button^ button4; + System::ComponentModel::Container^ components; + + public: + Form1() + { + myCustomerList = gcnew ArrayList; + components = nullptr; + + // Required for Windows Form Designer support. + InitializeComponent(); + AddTreeNode(); + } + + protected: + // Clean up any resources being used. + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + // Required method for Designer support. + void InitializeComponent() + { + this->treeView1 = gcnew TreeView; + this->button1 = gcnew Button; + this->button2 = gcnew Button; + this->button3 = gcnew Button; + this->button4 = gcnew Button; + this->SuspendLayout(); + this->treeView1->ImageIndex = -1; + this->treeView1->Location = Point(32,48); + this->treeView1->Name = "treeView1"; + this->treeView1->SelectedImageIndex = -1; + this->treeView1->Size = System::Drawing::Size( 168, 96 ); + this->treeView1->TabIndex = 0; + this->button1->Location = Point(40,160); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 160, 23 ); + this->button1->TabIndex = 1; + this->button1->Text = "Expand Customer1 Node"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + this->button2->Location = Point(40,185); + this->button2->Name = "button2"; + this->button2->Size = System::Drawing::Size( 160, 23 ); + this->button2->TabIndex = 2; + this->button2->Text = "Collapse Customer1 Node"; + this->button3->Location = Point(40,210); + this->button3->Name = "button3"; + this->button3->Size = System::Drawing::Size( 160, 23 ); + this->button3->TabIndex = 3; + this->button3->Text = "EnsureVisible Order7 Node"; + this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + this->button4->Location = Point(40,235); + this->button4->Name = "button4"; + this->button4->Size = System::Drawing::Size( 160, 23 ); + this->button4->TabIndex = 4; + this->button4->Text = "Clone Customer9 Node"; + this->button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); + this->ClientSize = System::Drawing::Size( 240, 273 ); + array^temp0 = {this->button4,this->button3,this->button2,this->button1,this->treeView1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Demonstrating TreeNode members"; + this->ResumeLayout( false ); + } + + // Add TreeNode to the TreeView. + void AddTreeNode() + { + // Add customers to ArrayList of Customer objects. + for ( int i = 1; i < 11; i++ ) + { + myCustomerList->Add( gcnew Customer( String::Concat( "Customer ", i ) ) ); + + } + + // Add orders to each Customer Object* in the ArrayList. + int x = 1; + IEnumerator^ myEnum = myCustomerList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ Customer1 = safe_cast(myEnum->Current); + Customer1->MyOrders->Add( gcnew Order( String::Concat( "Order ", x ) ) ); + x++; + } + + + // Prevent repainting of TreeView until all objects have been created. + treeView1->BeginUpdate(); + + // Clear the TreeView each time the method is called. + treeView1->Nodes->Clear(); + + // Add a root TreeNode for each Customer Object* in the ArrayList. + while ( myEnum->MoveNext() ) + { + Customer^ Customer2 = safe_cast(myEnum->Current); + treeView1->Nodes->Add( gcnew TreeNode( Customer2->myCustomerName ) ); + + // Add a child TreeNode to each Customer TreeNode. + IEnumerator^ myEnum = Customer2->MyOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Order^ Order2 = safe_cast(myEnum->Current); + treeView1->Nodes[ myCustomerList->IndexOf( Customer2 ) ]->Nodes->Add( gcnew TreeNode( Order2->myOrderName ) ); + } + } + } + + // + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( treeView1->SelectedNode->IsExpanded ) + { + treeView1->SelectedNode->Collapse(); + MessageBox::Show( String::Concat( treeView1->SelectedNode->Text, " tree node collapsed." ) ); + } + else + { + treeView1->SelectedNode->Expand(); + MessageBox::Show( String::Concat( treeView1->SelectedNode->Text, " tree node expanded." ) ); + } + } + // + + // + void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + TreeNode^ lastNode = treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes[ treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes->Count - 1 ]; + if ( !lastNode->IsVisible ) + { + lastNode->EnsureVisible(); + MessageBox::Show( String::Concat( lastNode->Text, " tree node is visible." ) ); + } + } + // + + // + void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + TreeNode^ lastNode = treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes[ treeView1->Nodes[ treeView1->Nodes->Count - 1 ]->Nodes->Count - 1 ]; + + // Clone the last child node. + TreeNode^ clonedNode = dynamic_cast(lastNode->Clone()); + + // Insert the cloned node as the first root node. + treeView1->Nodes->Insert( 0, clonedNode ); + MessageBox::Show( String::Concat( lastNode->Text, " tree node cloned and added to ", treeView1->Nodes[ 0 ]->Text ) ); + } + + // + }; +} + + +// The main entry point for the application. +int main() +{ + Application::Run( gcnew MyTreeNode::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp new file mode 100644 index 00000000000..0cdb9542ff0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_ForeColor/CPP/treenode_forecolor.cpp @@ -0,0 +1,291 @@ + + +// System::Windows::Forms::TreeNode::ExpandAll() +// System::Windows::Forms::TreeNode::FirstNode +// System::Windows::Forms::TreeNode::ForeColor +// System::Windows::Forms::TreeNode::GetNodeCount(bool) +// System::Windows::Forms::TreeNode::IsEditing +// System::Windows::Forms::TreeNode::IsExpanded +// System::Windows::Forms::TreeNode::IsSelected +// System::Windows::Forms::TreeNode::FullPath +// System::Windows::Forms::TreeView::PathSeparator +/* +The following example demonstrates the properties 'FirstNode', +'ForeColor', 'IsEditing', 'IsExpanded' and 'IsSelected', the methods +'ExpandAll' and 'GetNodeCount(bool)' of the 'TreeNode' class. In the +program, a form is created and to it 'TreeView', 'GroupBox', +and two 'CheckBox' controls are added. A 'TreeView' control is +associated with the class 'ContextMenu' so as to enable the user to change +the content of a 'TreeNode'. The 'TreeView' control displays a +hierarchical collection of 'Customer' objects which in turn contain +'Order' objects. +*/ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class Customer +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + Customer( String^ myName ) + { + CustomerName = myName; + CustomerOrders = gcnew ArrayList; + } + +}; + +public ref class Order +{ +public: + String^ OrderID; + Order( String^ myOrderID ) + { + this->OrderID = myOrderID; + } + +}; + +public ref class MyTreeNode_FirstNode: public Form +{ +private: + TreeView^ myTreeView; + GroupBox^ myGroupBox; + CheckBox^ myCheckBox; + CheckBox^ myCheckBox2; + Button^ myButton; + System::Windows::Forms::ContextMenu^ myContextMenu; + MenuItem^ myMenuItem; + TreeNode^ mySelectedNode; + + // ArrayList object to hold the 'Customer' objects. + ArrayList^ myCustomerArrayList; + +public: + MyTreeNode_FirstNode() + { + myCustomerArrayList = gcnew ArrayList; + InitializeComponent(); + FillMyTreeView(); + } + + +private: + void FillMyTreeView() + { + + // Add customers to the ArrayList of 'Customer' objects. + for ( int iIndex = 1; iIndex <= 10; iIndex++ ) + { + myCustomerArrayList->Add( gcnew Customer( String::Concat( "Customer ", iIndex ) ) ); + + } + IEnumerator^ myEnum = myCustomerArrayList->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ myCustomer1 = safe_cast(myEnum->Current); + for ( int jIndex = 1; jIndex <= 5; jIndex++ ) + { + myCustomer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", jIndex ) ) ); + + } + } + + + // Suppress repainting the TreeView until it is fully created. + myTreeView->BeginUpdate(); + + // Clear the TreeView each time the method is called. + myTreeView->Nodes->Clear(); + TreeNode^ myMainNode = gcnew TreeNode( "CustomerList" ); + myTreeView->Nodes->Add( myMainNode ); + + // Add a root treenode for each 'Customer' in the ArrayList. + while ( myEnum->MoveNext() ) + { + Customer^ myCustomer2 = safe_cast(myEnum->Current); + TreeNode^ myTreeNode1 = gcnew TreeNode( myCustomer2->CustomerName ); + myTreeNode1->ForeColor = Color::Orange; + myTreeView->Nodes[ 0 ]->Nodes->Add( myTreeNode1 ); + + // Add a child for each 'Order' in the current 'Customer'. + IEnumerator^ myEnum = myCustomer2->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Order^ myOrder1 = safe_cast(myEnum->Current); + myTreeView->Nodes[ 0 ]->Nodes[ myCustomerArrayList->IndexOf( myCustomer2 ) ]->Nodes->Add( gcnew TreeNode( myOrder1->OrderID ) ); + } + } + + + // Reset the cursor back to the default for all controls. + ::Cursor::Current = Cursors::Default; + + // Begin repainting the TreeView. + myTreeView->EndUpdate(); + if ( !myTreeView->Nodes[ 0 ]->IsExpanded ) + myTreeView->Nodes[ 0 ]->Expand(); + } + + void InitializeComponent() + { + this->myMenuItem = gcnew MenuItem; + this->myCheckBox = gcnew CheckBox; + this->myButton = gcnew Button; + this->myCheckBox2 = gcnew CheckBox; + this->myTreeView = gcnew TreeView; + this->myContextMenu = gcnew System::Windows::Forms::ContextMenu; + this->myGroupBox = gcnew GroupBox; + this->myGroupBox->SuspendLayout(); + this->SuspendLayout(); + this->myMenuItem->Checked = true; + this->myMenuItem->DefaultItem = true; + this->myMenuItem->Index = 0; + this->myMenuItem->Text = "Edit"; + this->myMenuItem->Click += gcnew System::EventHandler( this, &MyTreeNode_FirstNode::MenuItem1_Click ); + this->myCheckBox->Location = System::Drawing::Point( 24, 24 ); + this->myCheckBox->Name = "myCheckBox"; + this->myCheckBox->TabIndex = 0; + this->myCheckBox->Text = "Expand All"; + this->myCheckBox->CheckedChanged += gcnew System::EventHandler( this, &MyTreeNode_FirstNode::myCheckBox_CheckedChanged ); + this->myButton->Location = System::Drawing::Point( 136, 24 ); + this->myButton->Name = "myCheckBox2"; + this->myButton->TabIndex = 1; + this->myButton->Text = "Child Nodes"; + this->myButton->Click += gcnew System::EventHandler( this, &MyTreeNode_FirstNode::myButton_Click ); + this->myTreeView->ContextMenu = this->myContextMenu; + this->myTreeView->ImageIndex = -1; + this->myTreeView->LabelEdit = true; + this->myTreeView->Location = System::Drawing::Point( 8, 0 ); + this->myTreeView->Name = "myTreeView"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->Size = System::Drawing::Size( 280, 152 ); + this->myTreeView->TabIndex = 0; + this->myTreeView->MouseDown += gcnew MouseEventHandler( this, &MyTreeNode_FirstNode::TreeView1_MouseDown ); + this->myTreeView->AfterLabelEdit += gcnew NodeLabelEditEventHandler( this, &MyTreeNode_FirstNode::TreeView1_AfterLabelEdit ); + array^temp0 = {this->myMenuItem}; + this->myContextMenu->MenuItems->AddRange( temp0 ); + array^temp1 = {this->myButton,this->myCheckBox}; + this->myGroupBox->Controls->AddRange( temp1 ); + this->myGroupBox->Location = System::Drawing::Point( 8, 168 ); + this->myGroupBox->Name = "myGroupBox"; + this->myGroupBox->Size = System::Drawing::Size( 272, 96 ); + this->myGroupBox->TabIndex = 1; + this->myGroupBox->TabStop = false; + this->myGroupBox->Text = "myGroupBox"; + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp2 = {this->myGroupBox,this->myTreeView}; + this->Controls->AddRange( temp2 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->myGroupBox->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + // + void myCheckBox_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // If the check box is checked, expand all the tree nodes. + if ( myCheckBox->Checked ) + { + myTreeView->ExpandAll(); + } + else + { + + // If the check box is not checked, collapse the first tree node. + myTreeView->Nodes[ 0 ]->FirstNode->Collapse(); + MessageBox::Show( "The first node of CustomerList root node is collapsed" ); + } + } + // + + // + void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + + // Set the tree view's PathSeparator property. + myTreeView->PathSeparator = "."; + + // Get the count of the child tree nodes contained in the SelectedNode. + int myNodeCount = myTreeView->SelectedNode->GetNodeCount( true ); + Decimal myChildPercentage = ((Decimal)myNodeCount / (Decimal)myTreeView->GetNodeCount( true )) * 100; + + // Display the tree node path and the number of child nodes it and the tree view have. + MessageBox::Show( String::Concat( "The '", myTreeView->SelectedNode->FullPath, "' node has ", myNodeCount, " child nodes.\nThat is ", String::Format( "{0:###.##}", myChildPercentage ), "% of the total tree nodes in the tree view control." ) ); + } + // + + // Save the tree node under the mouse pointer. + void TreeView1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) + { + mySelectedNode = myTreeView->GetNodeAt( e->X, e->Y ); + } + + void MenuItem1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + if ( mySelectedNode != nullptr && mySelectedNode->Parent != nullptr ) + { + myTreeView->SelectedNode = mySelectedNode; + myTreeView->LabelEdit = true; + mySelectedNode->BeginEdit(); + if ( mySelectedNode->IsEditing ) + MessageBox::Show( String::Concat( "The name of node being edited: ", mySelectedNode->Text ) ); + mySelectedNode->BeginEdit(); + } + else + { + MessageBox::Show( "No tree node selected or selected node is a root node. Editing of root nodes is not allowed. Invalid selection" ); + } + } + + void TreeView1_AfterLabelEdit( Object^ /*sender*/, NodeLabelEditEventArgs^ e ) + { + if ( e->Label != nullptr ) + { + if ( e->Label->Length > 0 ) + { + array^temp3 = {'@','->',',','!'}; + if ( e->Label->IndexOfAny( temp3 ) == -1 ) + { + + // Stop editing without cancelling the label change. + e->Node->EndEdit( false ); + } + else + { + + // Cancel the label edit action, place it in edit mode. + e->CancelEdit = true; + MessageBox::Show( "Invalid tree node label.\n The invalid characters are: '@', '.', ', ', '!'", "Node Label Edit" ); + e->Node->BeginEdit(); + } + } + else + { + + // Cancel the label edit action, place it in edit mode. + e->CancelEdit = true; + MessageBox::Show( "Invalid tree node label. The label cannot be blank", "Node Label Edit" ); + e->Node->BeginEdit(); + } + this->myTreeView->LabelEdit = false; + } + } + +}; + +int main() +{ + Application::Run( gcnew MyTreeNode_FirstNode ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp new file mode 100644 index 00000000000..4e6527373b0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_Parent/CPP/treenode_parent.cpp @@ -0,0 +1,304 @@ + + +// System::Windows::Forms::TreeNode::PrevVisibleNode +// System::Windows::Forms::TreeNode::PrevNode +// System::Windows::Forms::TreeNode::NextVisibleNode +// System::Windows::Forms::TreeNode::NextNode +// System::Windows::Forms::TreeNode::LastNode +// System::Windows::Forms::TreeNode::FirstNode +// System::Windows::Forms::TreeNode::TreeView +// System::Windows::Forms::TreeNode::IsSelected +/* +The following program demonstrates the 'NodeFont', 'Parent', 'Text' and 'PrevVisibleNode' +properties of the 'TreeNode' class. It creates a TreeView consisting of customer nodes +and 'order' as its child nodes. It also provides option for the user to change the font +and text of the node. +*/ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +public ref class MyCustomerClass +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + MyCustomerClass( String^ name ) + { + CustomerName = name; + CustomerOrders = gcnew ArrayList; + } + +}; + +public ref class MyOrder +{ +public: + String^ OrderID; + MyOrder( String^ orderID ) + { + this->OrderID = orderID; + } + +}; + +public ref class MyTreeNodeForm: public System::Windows::Forms::Form +{ +private: + TreeView^ myTreeView; + Button^ myButton; + ComboBox^ myComboBox; + Label^ myLabel1; + Label^ myLabel3; + Label^ myLabel4; + TextBox^ myTextBox; + +public: + MyTreeNodeForm() + { + InitializeComponent(); + myButton->Click += gcnew EventHandler( this, &MyTreeNodeForm::MyButtonClick ); + FillMyTreeView(); + } + + +private: + void MyButtonClick( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + TreeNode^ selectedNode = nullptr; + IEnumerator^ myEnum = this->myTreeView->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ node = safe_cast(myEnum->Current); + + // See if the root tree node is selected. + if ( node->IsSelected ) + { + selectedNode = node; + break; + } + + + // Recurse through the TreeNodeCollection. + selectedNode = GetSelectedNode( node ); + if ( selectedNode != nullptr ) + { + break; + } + } + + + // Display the previous visible node. + if ( selectedNode != nullptr ) + { + SelectNode( selectedNode ); + } + } + + + // + void SelectNode( TreeNode^ node ) + { + if ( node->IsSelected ) + { + + // Determine which TreeNode to select. + String^ str = myComboBox->Text; + if ( str->Equals( "Previous" ) ) + node->TreeView->SelectedNode = node->PrevNode; + else + if ( str->Equals( "PreviousVisible" ) ) + node->TreeView->SelectedNode = node->PrevVisibleNode; + else + if ( str->Equals( "Next" ) ) + node->TreeView->SelectedNode = node->NextNode; + else + if ( str->Equals( "NextVisible" ) ) + node->TreeView->SelectedNode = node->NextVisibleNode; + else + if ( str->Equals( "First" ) ) + node->TreeView->SelectedNode = node->FirstNode; + else + if ( str->Equals( "Last" ) ) + node->TreeView->SelectedNode = node->LastNode; + } + + node->TreeView->Focus(); + } + // + + TreeNode^ GetSelectedNode( TreeNode^ treeNode ) + { + + // Check each node recursively. + IEnumerator^ myEnum = treeNode->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ node = safe_cast(myEnum->Current); + if ( node->IsSelected ) + { + + // Return the TreeNode if it is selected. + return node; + } + } + + return nullptr; + } + + + // ArrayList object to hold the 'MyCustomerClass' objects. + void FillMyTreeView() + { + ArrayList^ customerArray = gcnew ArrayList; + + // Add customers to the ArrayList of 'MyCustomerClass' objects. + for ( int x = 1; x <= 10; x++ ) + { + customerArray->Add( gcnew MyCustomerClass( String::Concat( "Customer ", x ) ) ); + + } + + // Add orders to each 'MyCustomerClass' object in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MyCustomerClass^ myCustomerClass1 = safe_cast(myEnum->Current); + for ( int y = 1; y <= 5; y++ ) + { + myCustomerClass1->CustomerOrders->Add( gcnew MyOrder( String::Concat( "Order ", y ) ) ); + + } + } + + + // Supress repainting until all the objects have been created. + myTreeView->BeginUpdate(); + + // Clear the 'TreeView' each time the method is called. + myTreeView->Nodes->Clear(); + TreeNodeCollection^ myTreeNodeCollectionCustomer = myTreeView->Nodes; + + // Add a root treenode for each 'MyCustomerClass' object in the ArrayList. + while ( myEnum->MoveNext() ) + { + MyCustomerClass^ myCustomerClass2 = safe_cast(myEnum->Current); + myTreeNodeCollectionCustomer->Add( gcnew TreeNode( myCustomerClass2->CustomerName ) ); + TreeNodeCollection^ myTreeNodeCollectionOrders = myTreeNodeCollectionCustomer[ customerArray->IndexOf( myCustomerClass2 ) ]->Nodes; + + // Add a child treenode for each MyOrder object. + IEnumerator^ myEnum = myCustomerClass2->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MyOrder^ myOrder1 = safe_cast(myEnum->Current); + myTreeNodeCollectionOrders->Add( gcnew TreeNode( myOrder1->OrderID ) ); + TreeNode^ myTreeNodeOrder = myTreeNodeCollectionOrders[ myCustomerClass2->CustomerOrders->IndexOf( myOrder1 ) ]; + } + } + + myTreeView->SelectedImageIndex = 0; + + // Begin repainting the 'TreeView'. + myTreeView->EndUpdate(); + } + + void InitializeComponent() + { + this->myTreeView = gcnew System::Windows::Forms::TreeView; + this->myTextBox = gcnew System::Windows::Forms::TextBox; + this->myComboBox = gcnew System::Windows::Forms::ComboBox; + this->myLabel4 = gcnew System::Windows::Forms::Label; + this->myButton = gcnew System::Windows::Forms::Button; + this->myLabel1 = gcnew System::Windows::Forms::Label; + this->myLabel3 = gcnew System::Windows::Forms::Label; + this->SuspendLayout(); + + // + // myTreeView + // + this->myTreeView->ImageIndex = -1; + this->myTreeView->Location = System::Drawing::Point( 8, 16 ); + this->myTreeView->Name = "myTreeView"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->Size = System::Drawing::Size( 136, 328 ); + this->myTreeView->TabIndex = 0; + + // + // myTextBox + // + this->myTextBox->Location = System::Drawing::Point( 368, 96 ); + this->myTextBox->Name = "myTextBox"; + this->myTextBox->Size = System::Drawing::Size( 128, 20 ); + this->myTextBox->TabIndex = 9; + this->myTextBox->Text = "TestNode"; + + // + // myComboBox + // + this->myComboBox->DropDownWidth = 121; + array^temp0 = {"PreviousVisible","NextVisible","Previous","Next","First","Last"}; + this->myComboBox->Items->AddRange( temp0 ); + this->myComboBox->Location = System::Drawing::Point( 368, 24 ); + this->myComboBox->Name = "myComboBox"; + this->myComboBox->Size = System::Drawing::Size( 128, 21 ); + this->myComboBox->TabIndex = 1; + + // + // myLabel4 + // + this->myLabel4->Location = System::Drawing::Point( 152, 96 ); + this->myLabel4->Name = "myLabel4"; + this->myLabel4->Size = System::Drawing::Size( 192, 16 ); + this->myLabel4->TabIndex = 7; + this->myLabel4->Text = "Change text of selected TreeNode to"; + + // + // myButton + // + this->myButton->Location = System::Drawing::Point( 368, 152 ); + this->myButton->Name = "myButton"; + this->myButton->Size = System::Drawing::Size( 128, 23 ); + this->myButton->TabIndex = 2; + this->myButton->Text = "Apply"; + + // + // myLabel1 + // + this->myLabel1->Location = System::Drawing::Point( 152, 216 ); + this->myLabel1->Name = "myLabel1"; + this->myLabel1->Size = System::Drawing::Size( 408, 120 ); + this->myLabel1->TabIndex = 4; + + // + // myLabel3 + // + this->myLabel3->Location = System::Drawing::Point( 152, 32 ); + this->myLabel3->Name = "myLabel3"; + this->myLabel3->Size = System::Drawing::Size( 128, 16 ); + this->myLabel3->TabIndex = 6; + this->myLabel3->Text = "Select Font"; + + // + // MyTreeNodeForm + // + this->ClientSize = System::Drawing::Size( 624, 365 ); + array^temp1 = {this->myTextBox,this->myLabel4,this->myLabel3,this->myLabel1,this->myComboBox,this->myButton,this->myTreeView}; + this->Controls->AddRange( temp1 ); + this->Name = "MyTreeNodeForm"; + this->Text = "TreeNode class sample"; + this->ResumeLayout( false ); + } + +}; + +int main() +{ + Application::Run( gcnew MyTreeNodeForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp new file mode 100644 index 00000000000..7bf27a1da89 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeNode_TreeNode/CPP/treenode_treenode.cpp @@ -0,0 +1,188 @@ + + +// System::Windows::Forms::TreeNode.ImageIndex +// System::Windows::Forms::TreeNode.SelectedImageIndex +// System::Windows::Forms::TreeView.ImageIndex +// System::Windows::Forms::TreeView::SelectedImageIndex +// System::Windows::Forms::TreeView::ImageList +// System::Windows::Forms::TreeNode::TreeNode(String*, int, int) +// System::Windows::Forms::TreeNode::TreeNode(String*, int, int, TreeNode[]) +/* +The following example demonstrates the constructors +'TreeNode(String*, int, int)' and 'TreeNode(String*, int, int, TreeNode[])' of +the 'TreeNode' class. This example displays customerinformation in a +'TreeView' control. The root tree nodes display customer names, and the +child tree nodes display the order numbers assigned to each customer. +*/ +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::Windows::Forms; + + +public ref class TreeNode_Checked: public Form +{ +private: + int rootImageIndex; + int selectedCustomerImageIndex; + int unselectedCustomerImageIndex; + int selectedOrderImageIndex; + int unselectedOrderImageIndex; + TreeView^ myTreeView; + + // ArrayList object to hold the 'Customer' objects. + ArrayList^ customerArray; + +public: + TreeNode_Checked() + { + customerArray = gcnew ArrayList; + InitializeComponent(); + FillMyTreeView(); + } + + +private: + void FillMyTreeView() + { + + // Add customers to the ArrayList of 'Customer' objects. + for ( int xIndex = 1; xIndex <= 5; xIndex++ ) + { + customerArray->Add( gcnew Customer( String::Concat( "Customer ", xIndex ) ) ); + + } + + // Add orders to each 'Customer' object in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ customer1 = safe_cast(myEnum->Current); + for ( int yIndex = 1; yIndex <= 5; yIndex++ ) + { + customer1->CustomerOrders->Add( gcnew Order( String::Concat( "Order ", yIndex ) ) ); + + } + } + + myTreeView->BeginUpdate(); + + // Clear the TreeView each time the method is called. + myTreeView->Nodes->Clear(); + FillTreeView(); + + // Begin repainting the TreeView. + myTreeView->EndUpdate(); + } + + // +ref class Customer +{ +public: + ArrayList^ CustomerOrders; + String^ CustomerName; + Customer( String^ myName ) + { + CustomerName = myName; + CustomerOrders = gcnew ArrayList; + } + +}; + +ref class Order +{ +public: + String^ OrderID; + Order( String^ myOrderID ) + { + this->OrderID = myOrderID; + } + +}; + + void FillTreeView() + { + + // Load the images in an ImageList. + ImageList^ myImageList = gcnew ImageList; + myImageList->Images->Add( Image::FromFile( "Default.gif" ) ); + myImageList->Images->Add( Image::FromFile( "SelectedDefault.gif" ) ); + myImageList->Images->Add( Image::FromFile( "Root.gif" ) ); + myImageList->Images->Add( Image::FromFile( "UnselectedCustomer.gif" ) ); + myImageList->Images->Add( Image::FromFile( "SelectedCustomer.gif" ) ); + myImageList->Images->Add( Image::FromFile( "UnselectedOrder.gif" ) ); + myImageList->Images->Add( Image::FromFile( "SelectedOrder.gif" ) ); + + // Assign the ImageList to the TreeView. + myTreeView->ImageList = myImageList; + + // Set the TreeView control's default image and selected image indexes. + myTreeView->ImageIndex = 0; + myTreeView->SelectedImageIndex = 1; + + /* Set the index of image from the + ImageList for selected and unselected tree nodes.*/ + this->rootImageIndex = 2; + this->selectedCustomerImageIndex = 3; + this->unselectedCustomerImageIndex = 4; + this->selectedOrderImageIndex = 5; + this->unselectedOrderImageIndex = 6; + + // Create the root tree node. + TreeNode^ rootNode = gcnew TreeNode( "CustomerList" ); + rootNode->ImageIndex = rootImageIndex; + rootNode->SelectedImageIndex = rootImageIndex; + + // Add a main root tree node. + myTreeView->Nodes->Add( rootNode ); + + // Add a root tree node for each Customer object in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ myCustomer = safe_cast(myEnum->Current); + + // Add a child tree node for each Order object. + int countIndex = 0; + array^myTreeNodeArray = gcnew array(myCustomer->CustomerOrders->Count); + IEnumerator^ myEnum = myCustomer->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Order^ myOrder = safe_cast(myEnum->Current); + + // Add the Order tree node to the array. + myTreeNodeArray[ countIndex ] = gcnew TreeNode( myOrder->OrderID,unselectedOrderImageIndex,selectedOrderImageIndex ); + countIndex++; + } + TreeNode^ customerNode = gcnew TreeNode( myCustomer->CustomerName,unselectedCustomerImageIndex,selectedCustomerImageIndex,myTreeNodeArray ); + myTreeView->Nodes[ 0 ]->Nodes->Add( customerNode ); + } + } + // + + void InitializeComponent() + { + this->myTreeView = gcnew TreeView; + this->SuspendLayout(); + this->myTreeView->ImageIndex = -1; + this->myTreeView->Location = Point(8,0); + this->myTreeView->Name = "myTreeView"; + this->myTreeView->SelectedImageIndex = -1; + this->myTreeView->Size = System::Drawing::Size( 280, 152 ); + this->myTreeView->TabIndex = 0; + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Controls->Add( this->myTreeView ); + this->Name = "Form1"; + this->Text = "TreeNode Example"; + this->ResumeLayout( true ); + } +}; + +int main() +{ + Application::Run( gcnew TreeNode_Checked ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp new file mode 100644 index 00000000000..bb2ec655ad6 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeView.AfterCheck_BeforeCheck/CPP/tn_checked.cpp @@ -0,0 +1,136 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace TN_Checked +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::Button^ button1; + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->treeView1 = gcnew System::Windows::Forms::TreeView; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // treeView1 + // + this->treeView1->CheckBoxes = true; + this->treeView1->ImageIndex = -1; + this->treeView1->Location = System::Drawing::Point( 8, 8 ); + this->treeView1->Name = "treeView1"; + array^temp0 = {gcnew System::Windows::Forms::TreeNode( "Node3" )}; + array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node2",temp0 ),gcnew System::Windows::Forms::TreeNode( "Node5" )}; + array^temp4 = {gcnew System::Windows::Forms::TreeNode( "Node1",temp1 )}; + array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp4 )}; + this->treeView1->Nodes->AddRange( temp3 ); + this->treeView1->SelectedImageIndex = -1; + this->treeView1->TabIndex = 0; + this->treeView1->AfterCheck += gcnew System::Windows::Forms::TreeViewEventHandler( this, &Form1::node_AfterCheck ); + this->treeView1->BeforeCheck += gcnew System::Windows::Forms::TreeViewCancelEventHandler( this, &Form1::treeView1_BeforeCheck ); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 24, 128 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 72, 24 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 200, 229 ); + array^temp5 = {this->button1,this->treeView1}; + this->Controls->AddRange( temp5 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Updates all child tree nodes recursively. + void CheckAllChildNodes( TreeNode^ treeNode, bool nodeChecked ) + { + IEnumerator^ myEnum = treeNode->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ node = safe_cast(myEnum->Current); + node->Checked = nodeChecked; + if ( node->Nodes->Count > 0 ) + { + + // If the current node has child nodes, call the CheckAllChildsNodes method recursively. + this->CheckAllChildNodes( node, nodeChecked ); + } + } + } + + // NOTE This code can be added to the BeforeCheck event handler instead of the AfterCheck event. + // After a tree node's Checked property is changed, all its child nodes are updated to the same value. + void node_AfterCheck( Object^ /*sender*/, TreeViewEventArgs^ e ) + { + // The code only executes if the user caused the checked state to change. + if ( e->Action != TreeViewAction::Unknown ) + { + if ( e->Node->Nodes->Count > 0 ) + { + /* Calls the CheckAllChildNodes method, passing in the current + Checked value of the TreeNode whose checked state changed. */ + this->CheckAllChildNodes( e->Node, e->Node->Checked ); + } + } + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->treeView1->Nodes[ 0 ]->Nodes[ 0 ]->Checked = true; + } + + void treeView1_BeforeCheck( Object^ /*sender*/, System::Windows::Forms::TreeViewCancelEventArgs^ e ) + { + MessageBox::Show( String::Concat( e->Node, "\n ", e->Action, "BeforeCheck" ) ); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew TN_Checked::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp new file mode 100644 index 00000000000..8967c97f255 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeView/CPP/treeview.cpp @@ -0,0 +1,213 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace CustomerCodeExamples +{ + + public ref class TV1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::Button^ button1; + + // Create a new ArrayList to hold the Customer objects. + ArrayList^ customerArray; + + public: + TV1() + { + customerArray = gcnew ArrayList; + InitializeComponent(); + } + + + private: + void InitializeComponent() + { + this->treeView1 = gcnew System::Windows::Forms::TreeView; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // treeView1 + // + this->treeView1->ImageIndex = -1; + this->treeView1->Name = "treeView1"; + this->treeView1->SelectedImageIndex = -1; + this->treeView1->Size = System::Drawing::Size( 128, 240 ); + this->treeView1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 216, 248 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &TV1::button1_Click ); + + // + // TV1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->button1,this->treeView1}; + this->Controls->AddRange( temp0 ); + this->Name = "TV1"; + this->Text = "TV1"; + this->ResumeLayout( false ); + } + + // + // The basic Customer class. + ref class Customer: public System::Object + { + private: + String^ custName; + + protected: + ArrayList^ custOrders; + + public: + Customer( String^ customername ) + { + custName = ""; + custOrders = gcnew ArrayList; + this->custName = customername; + } + + + property String^ CustomerName + { + String^ get() + { + return this->custName; + } + + void set( String^ value ) + { + this->custName = value; + } + + } + + property ArrayList^ CustomerOrders + { + ArrayList^ get() + { + return this->custOrders; + } + + } + + }; + + + // End Customer class + // The basic customer Order class. + ref class Order: public System::Object + { + private: + String^ ordID; + + public: + Order( String^ orderid ) + { + ordID = ""; + this->ordID = orderid; + } + + + property String^ OrderID + { + String^ get() + { + return this->ordID; + } + + void set( String^ value ) + { + this->ordID = value; + } + + } + + }; + // End Order class + + + + void FillMyTreeView() + { + // Add customers to the ArrayList of Customer objects. + for ( int x = 0; x < 1000; x++ ) + { + customerArray->Add( gcnew Customer( "Customer " + x ) ); + } + + // Add orders to each Customer object in the ArrayList. + IEnumerator^ myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ customer1 = safe_cast(myEnum->Current); + for ( int y = 0; y < 15; y++ ) + { + customer1->CustomerOrders->Add( gcnew Order( "Order " + y ) ); + } + } + + // Display a wait cursor while the TreeNodes are being created. + ::Cursor::Current = gcnew System::Windows::Forms::Cursor( "MyWait.cur" ); + + // Suppress repainting the TreeView until all the objects have been created. + treeView1->BeginUpdate(); + + // Clear the TreeView each time the method is called. + treeView1->Nodes->Clear(); + + // Add a root TreeNode for each Customer object in the ArrayList. + myEnum = customerArray->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Customer^ customer2 = safe_cast(myEnum->Current); + treeView1->Nodes->Add( gcnew TreeNode( customer2->CustomerName ) ); + + // Add a child treenode for each Order object in the current Customer object. + IEnumerator^ myEnum = customer2->CustomerOrders->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Order^ order1 = safe_cast(myEnum->Current); + treeView1->Nodes[ customerArray->IndexOf( customer2 ) ]->Nodes->Add( gcnew TreeNode( customer2->CustomerName + "." + order1->OrderID ) ); + } + } + + // Reset the cursor to the default for all controls. + ::Cursor::Current = Cursors::Default; + + // Begin repainting the TreeView. + treeView1->EndUpdate(); + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->FillMyTreeView(); + } + }; +} +// End TV1 Class +// End NameSpace + +[STAThread] +int main() +{ + Application::Run( gcnew CustomerCodeExamples::TV1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp new file mode 100644 index 00000000000..f9f28aa57a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeViewCustomization/CPP/treeviewcustomization.cpp @@ -0,0 +1,89 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; + +// +public ref class CustomizedTreeView: public TreeView +{ +public: + CustomizedTreeView() + { + + // Customize the TreeView control by setting various properties. + BackColor = System::Drawing::Color::CadetBlue; + FullRowSelect = true; + HotTracking = true; + Indent = 34; + ShowPlusMinus = false; + + // The ShowLines property must be false for the FullRowSelect + // property to work. + ShowLines = false; + } + +protected: + virtual void OnAfterSelect( TreeViewEventArgs^ e ) override + { + // Confirm that the user initiated the selection. + // This prevents the first node from expanding when it is + // automatically selected during the initialization of + // the TreeView control. + if ( e->Action != TreeViewAction::Unknown ) + { + if ( e->Node->IsExpanded ) + { + e->Node->Collapse(); + } + else + { + e->Node->Expand(); + } + } + + + // Remove the selection. This allows the same node to be + // clicked twice in succession to toggle the expansion state. + SelectedNode = nullptr; + } +}; +// + +public ref class Form1: public System::Windows::Forms::Form +{ +public: + Form1() + { + // Initialize myTreeView. + CustomizedTreeView^ myTreeView = gcnew CustomizedTreeView; + myTreeView->Dock = DockStyle::Fill; + + // Add nodes to myTreeView. + TreeNode^ node; + for ( int x = 0; x < 3; ++x ) + { + // Add a root node. + node = myTreeView->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); + for ( int y = 1; y < 4; ++y ) + { + // Add a node as a child of the previously added node. + node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); + + } + } + + // Add myTreeView to the form. + this->Controls->Add( myTreeView ); + } +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp new file mode 100644 index 00000000000..b4eea2c87c2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeViewDragDrop/CPP/treeviewdragdrop.cpp @@ -0,0 +1,156 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TreeView^ treeView1; + +public: + Form1() + { + treeView1 = gcnew TreeView; + this->SuspendLayout(); + + // Initialize treeView1. + treeView1->AllowDrop = true; + treeView1->Dock = DockStyle::Fill; + + // Add nodes to treeView1. + TreeNode^ node; + for ( int x = 0; x < 3; ++x ) + { + + // Add a root node to treeView1. + node = treeView1->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); + for ( int y = 1; y < 4; ++y ) + { + + // Add a child node to the previously added node. + node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); + + } + } + + // Add event handlers for the required drag events. + treeView1->ItemDrag += gcnew ItemDragEventHandler( this, &Form1::treeView1_ItemDrag ); + treeView1->DragEnter += gcnew DragEventHandler( this, &Form1::treeView1_DragEnter ); + treeView1->DragOver += gcnew DragEventHandler( this, &Form1::treeView1_DragOver ); + treeView1->DragDrop += gcnew DragEventHandler( this, &Form1::treeView1_DragDrop ); + + // Initialize the form. + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Controls->Add( treeView1 ); + this->ResumeLayout( false ); + } + + // +private: + void treeView1_ItemDrag( Object^ /*sender*/, ItemDragEventArgs^ e ) + { + + // Move the dragged node when the left mouse button is used. + if ( e->Button == ::MouseButtons::Left ) + { + DoDragDrop( e->Item, DragDropEffects::Move ); + } + // Copy the dragged node when the right mouse button is used. + else + + // Copy the dragged node when the right mouse button is used. + if ( e->Button == ::MouseButtons::Right ) + { + DoDragDrop( e->Item, DragDropEffects::Copy ); + } + } + // + + // Set the target drop effect to the effect + // specified in the ItemDrag event handler. + void treeView1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) + { + e->Effect = e->AllowedEffect; + } + + // Select the node under the mouse pointer to indicate the + // expected drop location. + void treeView1_DragOver( Object^ /*sender*/, DragEventArgs^ e ) + { + // Retrieve the client coordinates of the mouse position. + Point targetPoint = treeView1->PointToClient( Point(e->X,e->Y) ); + + // Select the node at the mouse position. + treeView1->SelectedNode = treeView1->GetNodeAt( targetPoint ); + } + + void treeView1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) + { + // Retrieve the client coordinates of the drop location. + Point targetPoint = treeView1->PointToClient( Point(e->X,e->Y) ); + + // Retrieve the node at the drop location. + TreeNode^ targetNode = treeView1->GetNodeAt( targetPoint ); + + // Retrieve the node that was dragged. + TreeNode^ draggedNode = dynamic_cast(e->Data->GetData( TreeNode::typeid )); + + // Confirm that the node at the drop location is not + // the dragged node or a descendant of the dragged node. + if ( !draggedNode->Equals( targetNode ) && !ContainsNode( draggedNode, targetNode ) ) + { + + // If it is a move operation, remove the node from its current + // location and add it to the node at the drop location. + if ( e->Effect == DragDropEffects::Move ) + { + draggedNode->Remove(); + targetNode->Nodes->Add( draggedNode ); + } + // If it is a copy operation, clone the dragged node + // and add it to the node at the drop location. + else + + // If it is a copy operation, clone the dragged node + // and add it to the node at the drop location. + if ( e->Effect == DragDropEffects::Copy ) + { + targetNode->Nodes->Add( dynamic_cast(draggedNode->Clone()) ); + } + + // Expand the node at the location + // to show the dropped node. + targetNode->Expand(); + } + } + + // Determine whether one node is a parent + // or ancestor of a second node. + bool ContainsNode( TreeNode^ node1, TreeNode^ node2 ) + { + // Check the parent node of the second node. + if ( node2->Parent == nullptr ) + return false; + + if ( node2->Parent->Equals( node1 ) ) + return true; + + // If the parent node is not null or equal to the first node, + // call the ContainsNode method recursively using the parent of + // the second node. + return ContainsNode( node1, node2->Parent ); + } +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp new file mode 100644 index 00000000000..594b9185e7b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeViewOwnerDraw/CPP/treeviewownerdraw.cpp @@ -0,0 +1,175 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class TreeViewOwnerDraw: public Form +{ +private: + TreeView^ myTreeView; + + // Create a Font object for the node tags. + System::Drawing::Font^ tagFont; + +public: + + // + TreeViewOwnerDraw() + { + tagFont = gcnew System::Drawing::Font( "Helvetica",8,FontStyle::Bold ); + + // Create and initialize the TreeView control. + myTreeView = gcnew TreeView; + myTreeView->Dock = DockStyle::Fill; + myTreeView->BackColor = Color::Tan; + myTreeView->CheckBoxes = true; + + // Add nodes to the TreeView control. + TreeNode^ node; + for ( int x = 1; x < 4; ++x ) + { + // Add a root node to the TreeView control. + node = myTreeView->Nodes->Add( String::Format( "Task {0}", x ) ); + for ( int y = 1; y < 4; ++y ) + { + // Add a child node to the root node. + node->Nodes->Add( String::Format( "Subtask {0}", y ) ); + } + } + myTreeView->ExpandAll(); + + // Add tags containing alert messages to a few nodes + // and set the node background color to highlight them. + myTreeView->Nodes[ 1 ]->Nodes[ 0 ]->Tag = "urgent!"; + myTreeView->Nodes[ 1 ]->Nodes[ 0 ]->BackColor = Color::Yellow; + myTreeView->SelectedNode = myTreeView->Nodes[ 1 ]->Nodes[ 0 ]; + myTreeView->Nodes[ 2 ]->Nodes[ 1 ]->Tag = "urgent!"; + myTreeView->Nodes[ 2 ]->Nodes[ 1 ]->BackColor = Color::Yellow; + + // Configure the TreeView control for owner-draw and add + // a handler for the DrawNode event. + myTreeView->DrawMode = TreeViewDrawMode::OwnerDrawText; + myTreeView->DrawNode += gcnew DrawTreeNodeEventHandler( this, &TreeViewOwnerDraw::myTreeView_DrawNode ); + + // Add a handler for the MouseDown event so that a node can be + // selected by clicking the tag text as well as the node text. + myTreeView->MouseDown += gcnew MouseEventHandler( this, &TreeViewOwnerDraw::myTreeView_MouseDown ); + + // Initialize the form and add the TreeView control to it. + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Controls->Add( myTreeView ); + } + // + +protected: + // Clean up any resources being used. + ~TreeViewOwnerDraw() + { + if ( tagFont != nullptr ) + { + delete tagFont; + } + } + + // + // Draws a node. +private: + void myTreeView_DrawNode( Object^ sender, DrawTreeNodeEventArgs^ e ) + { + // Draw the background and node text for a selected node. + if ( (e->State & TreeNodeStates::Selected) != (TreeNodeStates)0 ) + { + // Draw the background of the selected node. The NodeBounds + // method makes the highlight rectangle large enough to + // include the text of a node tag, if one is present. + e->Graphics->FillRectangle( Brushes::Green, NodeBounds( e->Node ) ); + + // Retrieve the node font. If the node font has not been set, + // use the TreeView font. + System::Drawing::Font^ nodeFont = e->Node->NodeFont; + if ( nodeFont == nullptr ) + nodeFont = (dynamic_cast(sender))->Font; + + // Draw the node text. + e->Graphics->DrawString( e->Node->Text, nodeFont, Brushes::White, Rectangle::Inflate( e->Bounds, 2, 0 ) ); + } + // Use the default background and node text. + else + { + e->DrawDefault = true; + } + + // If a node tag is present, draw its string representation + // to the right of the label text. + if ( e->Node->Tag != nullptr ) + { + e->Graphics->DrawString( e->Node->Tag->ToString(), tagFont, Brushes::Yellow, (float)e->Bounds.Right + 2, (float)e->Bounds.Top ); + } + + + // If the node has focus, draw the focus rectangle large, making + // it large enough to include the text of the node tag, if present. + if ( (e->State & TreeNodeStates::Focused) != (TreeNodeStates)0 ) + { + Pen^ focusPen = gcnew Pen( Color::Black ); + try + { + focusPen->DashStyle = System::Drawing::Drawing2D::DashStyle::Dot; + Rectangle focusBounds = NodeBounds( e->Node ); + focusBounds.Size = System::Drawing::Size( focusBounds.Width - 1, focusBounds.Height - 1 ); + e->Graphics->DrawRectangle( focusPen, focusBounds ); + } + finally + { + if ( focusPen ) + delete safe_cast(focusPen); + } + + } + } + // + + // Selects a node that is clicked on its label or tag text. + void myTreeView_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) + { + TreeNode^ clickedNode = myTreeView->GetNodeAt( e->X, e->Y ); + if ( NodeBounds( clickedNode ).Contains( e->X, e->Y ) ) + { + myTreeView->SelectedNode = clickedNode; + } + } + + // Returns the bounds of the specified node, including the region + // occupied by the node label and any node tag displayed. + Rectangle NodeBounds( TreeNode^ node ) + { + // Set the return value to the normal node bounds. + Rectangle bounds = node->Bounds; + if ( node->Tag != nullptr ) + { + // Retrieve a Graphics object from the TreeView handle + // and use it to calculate the display width of the tag. + Graphics^ g = myTreeView->CreateGraphics(); + int tagWidth = (int)g->MeasureString( node->Tag->ToString(), tagFont ).Width + 6; + + // Adjust the node bounds using the calculated value. + bounds.Offset( tagWidth / 2, 0 ); + bounds = Rectangle::Inflate( bounds, tagWidth / 2, 0 ); + g->~Graphics(); + } + + return bounds; + } +}; + +[STAThreadAttribute] +int main() +{ + Application::Run( gcnew TreeViewOwnerDraw ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp new file mode 100644 index 00000000000..56e4a1fdb32 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes1/CPP/treeviewshowcheckednodes1.cpp @@ -0,0 +1,126 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TreeView^ treeView1; + Button^ showCheckedNodesButton; + TreeViewCancelEventHandler^ checkForCheckedChildren; + +public: + Form1() + { + treeView1 = gcnew TreeView; + showCheckedNodesButton = gcnew Button; + checkForCheckedChildren = gcnew TreeViewCancelEventHandler( this, &Form1::CheckForCheckedChildrenHandler ); + this->SuspendLayout(); + + // Initialize treeView1. + treeView1->Location = Point(0,25); + treeView1->Size = System::Drawing::Size( 292, 248 ); + treeView1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Right); + treeView1->CheckBoxes = true; + + // Add nodes to treeView1. + TreeNode^ node; + for ( int x = 0; x < 3; ++x ) + { + + // Add a root node. + node = treeView1->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); + for ( int y = 1; y < 4; ++y ) + { + + // Add a node as a child of the previously added node. + node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); + + } + } + + // Set the checked state of one of the nodes to + // demonstrate the showCheckedNodesButton button behavior. + treeView1->Nodes[ 1 ]->Nodes[ 0 ]->Nodes[ 0 ]->Checked = true; + + // Initialize showCheckedNodesButton. + showCheckedNodesButton->Size = System::Drawing::Size( 144, 24 ); + showCheckedNodesButton->Text = "Show Checked Nodes"; + showCheckedNodesButton->Click += gcnew EventHandler( this, &Form1::showCheckedNodesButton_Click ); + + // Initialize the form. + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {showCheckedNodesButton,treeView1}; + this->Controls->AddRange( temp0 ); + this->ResumeLayout( false ); + } + + // +private: + void showCheckedNodesButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Disable redrawing of treeView1 to prevent flickering + // while changes are made. + treeView1->BeginUpdate(); + + // Collapse all nodes of treeView1. + treeView1->CollapseAll(); + + // Add the checkForCheckedChildren event handler to the BeforeExpand event. + treeView1->BeforeExpand += checkForCheckedChildren; + + // Expand all nodes of treeView1. Nodes without checked children are + // prevented from expanding by the checkForCheckedChildren event handler. + treeView1->ExpandAll(); + + // Remove the checkForCheckedChildren event handler from the BeforeExpand + // event so manual node expansion will work correctly. + treeView1->BeforeExpand -= checkForCheckedChildren; + + // Enable redrawing of treeView1. + treeView1->EndUpdate(); + } + + // Prevent expansion of a node that does not have any checked child nodes. + void CheckForCheckedChildrenHandler( Object^ /*sender*/, TreeViewCancelEventArgs^ e ) + { + if ( !HasCheckedChildNodes( e->Node ) ) + e->Cancel = true; + } + + + // Returns a value indicating whether the specified + // TreeNode has checked child nodes. + bool HasCheckedChildNodes( TreeNode^ node ) + { + if ( node->Nodes->Count == 0 ) + return false; + + System::Collections::IEnumerator^ myEnum = node->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ childNode = safe_cast(myEnum->Current); + if ( childNode->Checked ) + return true; + + // Recursively check the children of the current child node. + if ( HasCheckedChildNodes( childNode ) ) + return true; + } + + return false; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp b/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp new file mode 100644 index 00000000000..42b3ee4aea9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/TreeViewShowCheckedNodes2/CPP/treeviewshowcheckednodes2.cpp @@ -0,0 +1,127 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Windows::Forms; +public ref class Form1: public Form +{ +private: + TreeView^ treeView1; + Button^ showCheckedNodesButton; + TreeViewCancelEventHandler^ checkForCheckedChildren; + +public: + Form1() + { + treeView1 = gcnew TreeView; + showCheckedNodesButton = gcnew Button; + checkForCheckedChildren = gcnew TreeViewCancelEventHandler( this, &Form1::CheckForCheckedChildrenHandler ); + this->SuspendLayout(); + + // Initialize treeView1. + treeView1->Location = Point(0,25); + treeView1->Size = System::Drawing::Size( 292, 248 ); + treeView1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Left | AnchorStyles::Bottom | AnchorStyles::Right); + treeView1->CheckBoxes = true; + + // Add nodes to treeView1. + TreeNode^ node; + for ( int x = 0; x < 3; ++x ) + { + + // Add a root node. + node = treeView1->Nodes->Add( String::Format( "Node{0}", x * 4 ) ); + for ( int y = 1; y < 4; ++y ) + { + + // Add a node as a child of the previously added node. + node = node->Nodes->Add( String::Format( "Node{0}", x * 4 + y ) ); + + } + + } + + // Set the checked state of one of the nodes to + // demonstrate the showCheckedNodesButton button behavior. + treeView1->Nodes[ 1 ]->Nodes[ 0 ]->Nodes[ 0 ]->Checked = true; + + // Initialize showCheckedNodesButton. + showCheckedNodesButton->Size = System::Drawing::Size( 144, 24 ); + showCheckedNodesButton->Text = "Show Checked Nodes"; + showCheckedNodesButton->Click += gcnew EventHandler( this, &Form1::showCheckedNodesButton_Click ); + + // Initialize the form. + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp1 = {showCheckedNodesButton,treeView1}; + this->Controls->AddRange( temp1 ); + this->ResumeLayout( false ); + } + + // +private: + void showCheckedNodesButton_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + + // Disable redrawing of treeView1 to prevent flickering + // while changes are made. + treeView1->BeginUpdate(); + + // Collapse all nodes of treeView1. + treeView1->ExpandAll(); + + // Add the checkForCheckedChildren event handler to the BeforeExpand event. + treeView1->BeforeCollapse += checkForCheckedChildren; + + // Expand all nodes of treeView1. Nodes without checked children are + // prevented from expanding by the checkForCheckedChildren event handler. + treeView1->CollapseAll(); + + // Remove the checkForCheckedChildren event handler from the BeforeExpand + // event so manual node expansion will work correctly. + treeView1->BeforeCollapse -= checkForCheckedChildren; + + // Enable redrawing of treeView1. + treeView1->EndUpdate(); + } + + // Prevent collapse of a node that has checked child nodes. + void CheckForCheckedChildrenHandler( Object^ /*sender*/, TreeViewCancelEventArgs^ e ) + { + if ( HasCheckedChildNodes( e->Node ) ) + e->Cancel = true; + } + + // Returns a value indicating whether the specified + // TreeNode has checked child nodes. + bool HasCheckedChildNodes( TreeNode^ node ) + { + if ( node->Nodes->Count == 0 ) + return false; + + System::Collections::IEnumerator^ myEnum = node->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ childNode = safe_cast(myEnum->Current); + if ( childNode->Checked ) + return true; + + // Recursively check the children of the current child node. + if ( HasCheckedChildNodes( childNode ) ) + return true; + } + + return false; + } + // +}; + +int main() +{ + Application::Run( gcnew Form1 ); +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp b/snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp new file mode 100644 index 00000000000..435550d8e86 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/WarningException/CPP/warningex_doc.cpp @@ -0,0 +1,25 @@ +#using + +using namespace System; +using namespace System::ComponentModel; + +namespace WarningEx +{ + public ref class WarningEx_Doc + { + public: + static void Main() + { + // + WarningException^ myEx = gcnew WarningException( "This is a warning" ); + Console::WriteLine( myEx->Message ); + Console::WriteLine( myEx->ToString() ); + // + } + }; +} + +int main() +{ + WarningEx::WarningEx_Doc::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp b/snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp new file mode 100644 index 00000000000..6a9fbbd08fc --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Win32Exception/CPP/win32exception.cpp @@ -0,0 +1,45 @@ +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Security::Permissions; + +//using System.Diagnostics; + +namespace Win32Exception_CPP +{ + public ref class Class1 + { + public: + [PermissionSet(SecurityAction::Demand, Name="FullTrust")] + static void Main() + { + // + try + { + System::Diagnostics::Process^ myProc = gcnew System::Diagnostics::Process; + //Attempting to start a non-existing executable + myProc->StartInfo->FileName = "c:\nonexist.exe"; + //Start the application and assign it to the process component. + myProc->Start(); + } + catch ( Win32Exception^ w ) + { + Console::WriteLine( w->Message ); + Console::WriteLine( w->ErrorCode ); + Console::WriteLine( w->NativeErrorCode ); + Console::WriteLine( w->StackTrace ); + Console::WriteLine( w->Source ); + Exception^ e = w->GetBaseException(); + Console::WriteLine( e->Message ); + } + // + } + }; +} + +int main() +{ + Win32Exception_CPP::Class1::Main(); +} + diff --git a/snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp b/snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp new file mode 100644 index 00000000000..5d5c89c213f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/WinForms.Control.Resize/CPP/form1.cpp @@ -0,0 +1,69 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ResizeEvent +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Resize += gcnew System::EventHandler( this, &Form1::Form1_Resize ); + } + + // + private: + void Form1_Resize( Object^ sender, System::EventArgs^ /*e*/ ) + { + Control^ control = dynamic_cast(sender); + + // Ensure the Form remains square (Height = Width). + if ( control->Size.Height != control->Size.Width ) + { + control->Size = System::Drawing::Size( control->Size.Width, control->Size.Width ); + } + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ResizeEvent::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp b/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp new file mode 100644 index 00000000000..5e8ce372a35 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDialogExample/CPP/winformsedserviceeditordialogexample.cpp @@ -0,0 +1,150 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +namespace IWindowsFormsEditorServiceExample +{ + // Example Form for entering a string. + private ref class StringInputDialog: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ ok_button; + System::Windows::Forms::Button^ cancel_button; + + public: + System::Windows::Forms::TextBox^ inputTextBox; + StringInputDialog( String^ text ) + { + InitializeComponent(); + inputTextBox->Text = text; + } + + private: + void InitializeComponent() + { + this->ok_button = gcnew System::Windows::Forms::Button; + this->cancel_button = gcnew System::Windows::Forms::Button; + this->inputTextBox = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->ok_button->Location = System::Drawing::Point( 180, 43 ); + this->ok_button->Name = "ok_button"; + this->ok_button->TabIndex = 1; + this->ok_button->Text = "OK"; + this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; + this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->cancel_button->Location = System::Drawing::Point( 260, 43 ); + this->cancel_button->Name = "cancel_button"; + this->cancel_button->TabIndex = 2; + this->cancel_button->Text = "Cancel"; + this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; + this->inputTextBox->Location = System::Drawing::Point( 6, 9 ); + this->inputTextBox->Name = "inputTextBox"; + this->inputTextBox->Size = System::Drawing::Size( 327, 20 ); + this->inputTextBox->TabIndex = 0; + this->inputTextBox->Text = ""; + this->inputTextBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->ClientSize = System::Drawing::Size( 342, 73 ); + array^temp0 = {this->inputTextBox,this->cancel_button,this->ok_button}; + this->Controls->AddRange( temp0 ); + this->MinimumSize = System::Drawing::Size( 350, 100 ); + this->Name = "StringInputDialog"; + this->Text = "String Input Dialog"; + this->ResumeLayout( false ); + } + }; + + // Example UITypeEditor that uses the IWindowsFormsEditorService + // to display a Form. + [PermissionSet(SecurityAction::Demand, Name = "FullTrust")] + public ref class TestDialogEditor: public System::Drawing::Design::UITypeEditor + { + public: + TestDialogEditor(){} + + virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle( System::ComponentModel::ITypeDescriptorContext^ context ) override + { + // Indicates that this editor can display a Form-based interface. + return UITypeEditorEditStyle::Modal; + } + + virtual Object^ EditValue( System::ComponentModel::ITypeDescriptorContext^ context, System::IServiceProvider^ provider, Object^ value ) override + { + // Attempts to obtain an IWindowsFormsEditorService. + IWindowsFormsEditorService^ edSvc = dynamic_cast(provider->GetService( IWindowsFormsEditorService::typeid )); + if ( edSvc == nullptr ) + return nullptr; + + // Displays a StringInputDialog Form to get a user-adjustable + // string value. + StringInputDialog^ form = gcnew StringInputDialog( dynamic_cast(value) ); + if ( edSvc->ShowDialog( form ) == DialogResult::OK ) + return form->inputTextBox->Text; + + // If OK was not pressed, return the original value + return value; + } + }; + + // Provides an example control that displays instructions in design mode, + // with which the example UITypeEditor is associated. + public ref class WinFormsEdServiceDialogExampleControl: public UserControl + { + public: + + property String^ TestDialogString + { + [EditorAttribute(IWindowsFormsEditorServiceExample::TestDialogEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return localDialogTestString; + } + + void set( String^ value ) + { + localDialogTestString = value; + } + } + + private: + String^ localDialogTestString; + + public: + WinFormsEdServiceDialogExampleControl() + { + localDialogTestString = "Test String"; + this->Size = System::Drawing::Size( 210, 74 ); + this->BackColor = Color::Beige; + } + + protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + if ( this->DesignMode ) + { + e->Graphics->DrawString( "Use the Properties window to show", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); + e->Graphics->DrawString( "a Form dialog box, using the", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 17 ); + e->Graphics->DrawString( "IWindowsFormsEditorService, for", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 29 ); + e->Graphics->DrawString( "configuring this control's", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 41 ); + e->Graphics->DrawString( "TestDialogString property.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 53 ); + } + else + { + e->Graphics->DrawString( "This example requires design mode.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp b/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp new file mode 100644 index 00000000000..18b0f70e3f3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/WinFormsEditorServiceDropDownExample/CPP/winformsedserviceeditordropdownexample.cpp @@ -0,0 +1,159 @@ + + +// +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::ComponentModel::Design; +using namespace System::Drawing; +using namespace System::Drawing::Design; +using namespace System::Windows::Forms; +using namespace System::Windows::Forms::Design; +using namespace System::Security::Permissions; + +namespace IWindowsFormsEditorServiceExample +{ + // Example control for entering a string. + private ref class StringInputControl: public UserControl + { + public: + System::Windows::Forms::TextBox^ inputTextBox; + + private: + System::Windows::Forms::Button^ ok_button; + System::Windows::Forms::Button^ cancel_button; + IWindowsFormsEditorService^ edSvc; + + public: + StringInputControl( String^ text, IWindowsFormsEditorService^ edSvc ) + { + InitializeComponent(); + inputTextBox->Text = text; + + // Stores IWindowsFormsEditorService reference to use to + // close the control. + this->edSvc = edSvc; + } + + private: + void InitializeComponent() + { + this->inputTextBox = gcnew System::Windows::Forms::TextBox; + this->ok_button = gcnew System::Windows::Forms::Button; + this->cancel_button = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + this->inputTextBox->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Top | System::Windows::Forms::AnchorStyles::Left | System::Windows::Forms::AnchorStyles::Right); + this->inputTextBox->Location = System::Drawing::Point( 6, 7 ); + this->inputTextBox->Name = "inputTextBox"; + this->inputTextBox->Size = System::Drawing::Size( 336, 20 ); + this->inputTextBox->TabIndex = 0; + this->inputTextBox->Text = ""; + this->ok_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->ok_button->DialogResult = System::Windows::Forms::DialogResult::OK; + this->ok_button->Location = System::Drawing::Point( 186, 38 ); + this->ok_button->Name = "ok_button"; + this->ok_button->TabIndex = 1; + this->ok_button->Text = "OK"; + this->ok_button->Click += gcnew EventHandler( this, &StringInputControl::CloseControl ); + this->cancel_button->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->cancel_button->DialogResult = System::Windows::Forms::DialogResult::Cancel; + this->cancel_button->Location = System::Drawing::Point( 267, 38 ); + this->cancel_button->Name = "cancel_button"; + this->cancel_button->TabIndex = 2; + this->cancel_button->Text = "Cancel"; + this->cancel_button->Click += gcnew EventHandler( this, &StringInputControl::CloseControl ); + array^temp0 = {this->cancel_button,this->ok_button,this->inputTextBox}; + this->Controls->AddRange( temp0 ); + this->Name = "StringInputControl"; + this->Size = System::Drawing::Size( 350, 70 ); + this->ResumeLayout( false ); + } + + void CloseControl( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + edSvc->CloseDropDown(); + } + }; + + // Example UITypeEditor that uses the IWindowsFormsEditorService to + // display a drop-down control. + [PermissionSet(SecurityAction::Demand, Name = "FullTrust")] + public ref class TestDropDownEditor: public System::Drawing::Design::UITypeEditor + { + public: + TestDropDownEditor(){} + + virtual System::Drawing::Design::UITypeEditorEditStyle GetEditStyle( System::ComponentModel::ITypeDescriptorContext^ /*context*/ ) override + { + // Indicates that this editor can display a control-based + // drop-down interface. + return UITypeEditorEditStyle::DropDown; + } + + virtual Object^ EditValue( System::ComponentModel::ITypeDescriptorContext^ /*context*/, System::IServiceProvider^ provider, Object^ value ) override + { + // Attempts to obtain an IWindowsFormsEditorService. + IWindowsFormsEditorService^ edSvc = dynamic_cast(provider->GetService( IWindowsFormsEditorService::typeid )); + if ( edSvc == nullptr ) + return value; + + // Displays a drop-down control. + StringInputControl^ inputControl = gcnew StringInputControl( dynamic_cast(value),edSvc ); + edSvc->DropDownControl( inputControl ); + return inputControl->inputTextBox->Text; + } + }; + + // Provides an example control that displays instructions in design mode, + // with which the example UITypeEditor is associated. + public ref class WinFormsEdServiceDropDownExampleControl: public UserControl + { + public: + + property String^ TestDropDownString + { + [EditorAttribute(IWindowsFormsEditorServiceExample::TestDropDownEditor::typeid,UITypeEditor::typeid)] + String^ get() + { + return localDropDownTestString; + } + + void set( String^ value ) + { + localDropDownTestString = value; + } + } + + private: + String^ localDropDownTestString; + + public: + WinFormsEdServiceDropDownExampleControl() + { + localDropDownTestString = "Test String"; + this->Size = System::Drawing::Size( 210, 74 ); + this->BackColor = Color::Beige; + } + + protected: + virtual void OnPaint( System::Windows::Forms::PaintEventArgs^ e ) override + { + if ( this->DesignMode ) + { + e->Graphics->DrawString( "Use the Properties window to show", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); + e->Graphics->DrawString( "a drop-down control, using the", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 17 ); + e->Graphics->DrawString( "IWindowsFormsEditorService, for", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 29 ); + e->Graphics->DrawString( "configuring this control's", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 41 ); + e->Graphics->DrawString( "TestDropDownString property.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 53 ); + } + else + { + e->Graphics->DrawString( "This example requires design mode.", gcnew System::Drawing::Font( "Arial",8 ), gcnew SolidBrush( Color::Black ), 5, 5 ); + } + } + }; +} +// diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp new file mode 100644 index 00000000000..f8b6439ab50 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Member5/CPP/controlmembers5.cpp @@ -0,0 +1,161 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::Button^ button3; + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + InitializeComponent(); + } + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->button2 = gcnew System::Windows::Forms::Button; + this->button3 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 40, 48 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 40, 112 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 1; + this->button2->Text = "button2"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // button3 + // + this->button3->Location = System::Drawing::Point( 40, 184 ); + this->button3->Name = "button3"; + this->button3->TabIndex = 2; + this->button3->Text = "button3"; + this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + + // + // Form1 + // + this->AutoScroll = true; + this->ClientSize = System::Drawing::Size( 368, 325 ); + array^temp0 = {this->button3,this->button2,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->SizeControls(); + } + + // Control.Size/Control.ClientSize/Control.SetClientSizeCore + // +private: + void SizeControls() + { + // Resize the buttons two different ways. + button1->Size = System::Drawing::Size( 75, 25 ); + button2->ClientSize = System::Drawing::Size( 100, 50 ); + + // Resize the form. + this->SetClientSizeCore( 300, 300 ); + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->ResizeForm(); + } + + /* Control.ClientRectangle/Control.Bounds/Rectangle.Inflate/ + * Control.ScrollControlIntoView/Control.AutoScroll */ + // +private: + void ResizeForm() + { + + // Enable auto-scrolling for the form. + this->AutoScroll = true; + + // Resize the form. + Rectangle r = this->ClientRectangle; + + // Subtract 100 pixels from each side of the Rectangle. + r.Inflate( -100, -100 ); + this->Bounds = this->RectangleToScreen( r ); + + // Make sure button2 is visible. + this->ScrollControlIntoView( button2 ); + } + // + + void button2_Click( Object^ sender, System::EventArgs^ /*e*/ ) + { + this->AutoSizeControl( dynamic_cast(sender), 5 ); + } + + /* Control.CreateGraphics/Control.Text/Control.Font/ + * Control.Height/Control.Width/Control.ClientSize */ + // +private: + void AutoSizeControl( Control^ control, int textPadding ) + { + + // Create a Graphics object for the Control. + Graphics^ g = control->CreateGraphics(); + + // Get the Size needed to accommodate the formatted Text. + System::Drawing::Size preferredSize = g->MeasureString( control->Text, control->Font ).ToSize(); + + // Pad the text and resize the control. + control->ClientSize = System::Drawing::Size( preferredSize.Width + (textPadding * 2), preferredSize.Height + (textPadding * 2) ); + + // Clean up the Graphics object. + delete g; + } + // +}; + +[STAThread] +int main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp new file mode 100644 index 00000000000..b4b3ffa91e1 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members2/CPP/controlmembers2.cpp @@ -0,0 +1,289 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ControlMembers3 +{ + public ref class CustomerForm: public System::Windows::Forms::Form + { + public: + String^ UserName; + }; + + public ref class Customer + { + public: + String^ Name; + int AccountNumber; + virtual String^ ToString() override + { + return String::Concat( AccountNumber, "\r\n ", Name ); + } + }; + + public ref class AboutDialog: public System::Windows::Forms::Form + { + public: + String^ FormText; + }; + + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::MainMenu^ mainMenu1; + System::Windows::Forms::MenuItem^ menuItemHelp; + System::Windows::Forms::MenuItem^ menuItemHelpAbout; + System::Windows::Forms::Button^ buttonNewCustomer; + System::Windows::Forms::MenuItem^ menuItemEditInsertCustomerInfo; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::MenuItem^ menuItemEdit; + System::Windows::Forms::MenuItem^ menuItemEditFontArial; + System::Windows::Forms::MenuItem^ menuItemEditFontTimeNewRoman; + System::Windows::Forms::MenuItem^ menuItemEditFont; + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + InitializeComponent(); + Customer^ cust = gcnew Customer; + cust->Name = "Microsoft"; + cust->AccountNumber = 123456; + this->Tag = cust; + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->mainMenu1 = gcnew System::Windows::Forms::MainMenu; + this->menuItemHelp = gcnew System::Windows::Forms::MenuItem; + this->menuItemHelpAbout = gcnew System::Windows::Forms::MenuItem; + this->buttonNewCustomer = gcnew System::Windows::Forms::Button; + this->menuItemEdit = gcnew System::Windows::Forms::MenuItem; + this->menuItemEditInsertCustomerInfo = gcnew System::Windows::Forms::MenuItem; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->menuItemEditFont = gcnew System::Windows::Forms::MenuItem; + this->menuItemEditFontArial = gcnew System::Windows::Forms::MenuItem; + this->menuItemEditFontTimeNewRoman = gcnew System::Windows::Forms::MenuItem; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 56, 168 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "New Form"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // mainMenu1 + // + array^temp0 = {this->menuItemHelp,this->menuItemEdit}; + this->mainMenu1->MenuItems->AddRange( temp0 ); + + // + // menuItemHelp + // + this->menuItemHelp->Index = 0; + array^temp1 = {this->menuItemHelpAbout}; + this->menuItemHelp->MenuItems->AddRange( temp1 ); + this->menuItemHelp->Text = "Help"; + + // + // menuItemHelpAbout + // + this->menuItemHelpAbout->Index = 0; + this->menuItemHelpAbout->Text = "About"; + this->menuItemHelpAbout->Click += gcnew System::EventHandler( this, &Form1::menuItemHelpAbout_Click ); + + // + // buttonNewCustomer + // + this->buttonNewCustomer->Location = System::Drawing::Point( 144, 168 ); + this->buttonNewCustomer->Name = "buttonNewCustomer"; + this->buttonNewCustomer->Size = System::Drawing::Size( 72, 24 ); + this->buttonNewCustomer->TabIndex = 1; + this->buttonNewCustomer->Text = "New Customer"; + this->buttonNewCustomer->Click += gcnew System::EventHandler( this, &Form1::buttonNewCustomer_Click ); + + // + // menuItemEdit + // + this->menuItemEdit->Index = 1; + array^temp2 = {this->menuItemEditInsertCustomerInfo,this->menuItemEditFont}; + this->menuItemEdit->MenuItems->AddRange( temp2 ); + this->menuItemEdit->Text = "Edit"; + this->menuItemEdit->Popup += gcnew System::EventHandler( this, &Form1::menuItemEdit_Popup ); + + // + // menuItemEditInsertCustomerInfo + // + this->menuItemEditInsertCustomerInfo->Enabled = false; + this->menuItemEditInsertCustomerInfo->Index = 0; + this->menuItemEditInsertCustomerInfo->Text = "Insert Customer Information"; + this->menuItemEditInsertCustomerInfo->Click += gcnew System::EventHandler( this, &Form1::menuItemEditInsertCustomerInfo_Click ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 56, 96 ); + this->textBox1->Multiline = true; + this->textBox1->Name = "textBox1"; + this->textBox1->Size = System::Drawing::Size( 160, 64 ); + this->textBox1->TabIndex = 2; + this->textBox1->Text = ""; + + // + // menuItemEditFont + // + this->menuItemEditFont->Index = 1; + array^temp3 = {this->menuItemEditFontArial,this->menuItemEditFontTimeNewRoman}; + this->menuItemEditFont->MenuItems->AddRange( temp3 ); + this->menuItemEditFont->Text = "Font"; + + // + // menuItemEditFontArial + // + this->menuItemEditFontArial->Index = 0; + this->menuItemEditFontArial->Text = "Arial"; + this->menuItemEditFontArial->Click += gcnew System::EventHandler( this, &Form1::menuItemEditFont_Click ); + + // + // menuItemEditFontTimeNewRoman + // + this->menuItemEditFontTimeNewRoman->Index = 1; + this->menuItemEditFontTimeNewRoman->Text = "Times New Roman"; + this->menuItemEditFontTimeNewRoman->Click += gcnew System::EventHandler( this, &Form1::menuItemEditFont_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp4 = {this->textBox1,this->buttonNewCustomer,this->button1}; + this->Controls->AddRange( temp4 ); + this->Menu = this->mainMenu1; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + AddButtons(); + } + + // + private: + void menuItemHelpAbout_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Create and display a modeless about dialog box. + AboutDialog^ about = gcnew AboutDialog; + about->Show(); + + // Draw a blue square on the form. + /* NOTE: This is not a persistent object, it will no longer be + * visible after the next call to OnPaint. To make it persistent, + * override the OnPaint method and draw the square there */ + Graphics^ g = about->CreateGraphics(); + g->FillRectangle( Brushes::Blue, 10, 10, 50, 50 ); + } + // + + // + private: + void AddButtons() + { + // Suspend the form layout and add two buttons. + this->SuspendLayout(); + Button^ buttonOK = gcnew Button; + buttonOK->Location = Point(10,10); + buttonOK->Size = System::Drawing::Size( 75, 25 ); + buttonOK->Text = "OK"; + Button^ buttonCancel = gcnew Button; + buttonCancel->Location = Point(90,10); + buttonCancel->Size = System::Drawing::Size( 75, 25 ); + buttonCancel->Text = "Cancel"; + array^temp5 = {buttonOK,buttonCancel}; + this->Controls->AddRange( temp5 ); + this->ResumeLayout(); + } + // + + // + private: + void buttonNewCustomer_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + /* Create a new customer form and assign a new + * Customer object to the Tag property. */ + CustomerForm^ customerForm = gcnew CustomerForm; + customerForm->Tag = gcnew Customer; + customerForm->Show(); + } + // + + // + private: + void menuItemEdit_Popup( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Disable the menu item if the text box does not have focus. + this->menuItemEditInsertCustomerInfo->Enabled = this->textBox1->Focused; + } + // + + void menuItemEditInsertCustomerInfo_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Insert the customer information into the text box. + this->textBox1->Text = String::Concat( this->textBox1->Text, dynamic_cast(this->Tag) ); + } + + void menuItemEditFont_Click( Object^ sender, System::EventArgs^ /*e*/ ) + { + MenuItem^ menuItem = dynamic_cast(sender); + if ( menuItem->Parent == this->menuItemEditFont ) + { + // Uncheck all the menu items. + IEnumerator^ myEnum = this->menuItemEditFont->MenuItems->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + MenuItem^ menu = safe_cast(myEnum->Current); + menu->Checked = false; + } + + // Check the menu item that was clicked. + menuItem->Checked = true; + + // Update the font used in the text box. + textBox1->Font = gcnew System::Drawing::Font( menuItem->Text,textBox1->Font->Size ); + } + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ControlMembers3::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp new file mode 100644 index 00000000000..237ccda9782 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Members4/CPP/controlmembers4.cpp @@ -0,0 +1,213 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace ControlMembers4 +{ + public ref class Form2: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Panel^ panel1; + System::Windows::Forms::Button^ button1; + System::Windows::Forms::StatusBar^ statusBar1; + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::ContextMenu^ contextMenu1; + System::Windows::Forms::MenuItem^ menuItem1; + System::Windows::Forms::MenuItem^ menuItem2; + System::Windows::Forms::MenuItem^ menuItem3; + System::Windows::Forms::Label ^ label1; + System::ComponentModel::Container^ components; + + public: + Form2() + { + components = nullptr; + InitializeComponent(); + } + + protected: + ~Form2() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->panel1 = gcnew System::Windows::Forms::Panel; + this->button1 = gcnew System::Windows::Forms::Button; + this->label1 = gcnew System::Windows::Forms::Label; + this->statusBar1 = gcnew System::Windows::Forms::StatusBar; + this->treeView1 = gcnew System::Windows::Forms::TreeView; + this->contextMenu1 = gcnew System::Windows::Forms::ContextMenu; + this->menuItem1 = gcnew System::Windows::Forms::MenuItem; + this->menuItem2 = gcnew System::Windows::Forms::MenuItem; + this->menuItem3 = gcnew System::Windows::Forms::MenuItem; + this->panel1->SuspendLayout(); + this->SuspendLayout(); + + // + // panel1 + // + this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::FixedSingle; + array^temp0 = {this->button1,this->label1}; + this->panel1->Controls->AddRange( temp0 ); + this->panel1->Location = System::Drawing::Point( 48, 40 ); + this->panel1->Name = "panel1"; + this->panel1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 16, 16 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form2::button1_Click ); + + // + // label1 + // + this->label1->Location = System::Drawing::Point( 16, 16 ); + this->label1->Name = "label1"; + this->label1->TabIndex = 2; + this->label1->Text = "label1"; + + // + // statusBar1 + // + this->statusBar1->Location = System::Drawing::Point( 0, 295 ); + this->statusBar1->Name = "statusBar1"; + this->statusBar1->Size = System::Drawing::Size( 320, 22 ); + this->statusBar1->TabIndex = 1; + this->statusBar1->Text = "statusBar1"; + + // + // treeView1 + // + this->treeView1->ContextMenu = this->contextMenu1; + this->treeView1->ImageIndex = -1; + this->treeView1->Location = System::Drawing::Point( 64, 152 ); + this->treeView1->Name = "treeView1"; + array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node2" )}; + array^temp2 = {gcnew System::Windows::Forms::TreeNode( "Node1",temp1 )}; + array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp2 )}; + this->treeView1->Nodes->AddRange( temp3 ); + this->treeView1->SelectedImageIndex = -1; + this->treeView1->TabIndex = 2; + this->treeView1->KeyDown += gcnew System::Windows::Forms::KeyEventHandler( this, &Form2::treeView1_KeyDown ); + this->treeView1->AfterLabelEdit += gcnew System::Windows::Forms::NodeLabelEditEventHandler( this, &Form2::treeView1_AfterLabelEdit ); + + // + // contextMenu1 + // + array^temp4 = {this->menuItem1,this->menuItem2,this->menuItem3}; + this->contextMenu1->MenuItems->AddRange( temp4 ); + + // + // menuItem1 + // + this->menuItem1->Index = 0; + this->menuItem1->Text = "Edit"; + + // + // menuItem2 + // + this->menuItem2->Index = 1; + this->menuItem2->Text = "Expand"; + + // + // menuItem3 + // + this->menuItem3->Index = 2; + this->menuItem3->Text = "Collapse"; + + // + // Form2 + // + this->ClientSize = System::Drawing::Size( 320, 317 ); + this->DoubleClick += gcnew System::EventHandler( this, &Form2::Form2_DoubleClick ); + array^temp5 = {this->treeView1,this->statusBar1,this->panel1}; + this->Controls->AddRange( temp5 ); + this->Name = "Form2"; + this->Text = "Form2"; + this->panel1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + void Form2_DoubleClick( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->MakeLabelVisible(); + } + + // + private: + void MakeLabelVisible() + { + + /* If the panel contains label1, bring it + * to the front to make sure it is visible. */ + if ( panel1->Contains( label1 ) ) + { + label1->BringToFront(); + } + } + // + + // + private: + void button1_Click( Object^ sender, System::EventArgs^ /*e*/ ) + { + /* If the CTRL key is pressed when the + * control is clicked, hide the control. */ + if ( Control::ModifierKeys == Keys::Control ) + { + (dynamic_cast(sender))->Hide(); + } + } + // + + // + private: + void treeView1_KeyDown( Object^ /*sender*/, KeyEventArgs^ e ) + { + /* If the 'Alt' and 'E' keys are pressed, + * allow the user to edit the TreeNode label. */ + if ( e->Alt && e->KeyCode == Keys::E ) + { + treeView1->LabelEdit = true; + + // If there is a TreeNode under the mouse cursor, begin editing. + TreeNode^ editNode = treeView1->GetNodeAt( treeView1->PointToClient( Control::MousePosition ) ); + if ( editNode != nullptr ) + { + editNode->BeginEdit(); + } + } + } + + void treeView1_AfterLabelEdit( Object^ /*sender*/, NodeLabelEditEventArgs^ /*e*/ ) + { + // Disable the ability to edit the TreeNode labels. + treeView1->LabelEdit = false; + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ControlMembers4::Form2 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp new file mode 100644 index 00000000000..a06e3d6cf65 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties/CPP/controlproperties.cpp @@ -0,0 +1,170 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ControlProperties +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::ImageList^ imageList1; + System::Windows::Forms::Button^ button2; + System::ComponentModel::IContainer^ components; + + public: + Form1() + { + InitializeComponent(); + + //this->AddMyGroupBox(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->components = gcnew System::ComponentModel::Container; + System::Resources::ResourceManager^ resources = gcnew System::Resources::ResourceManager( Form1::typeid ); + this->imageList1 = gcnew System::Windows::Forms::ImageList( this->components ); + this->button2 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // imageList1 + // + this->imageList1->ColorDepth = System::Windows::Forms::ColorDepth::Depth8Bit; + this->imageList1->ImageSize = System::Drawing::Size( 16, 16 ); + this->imageList1->ImageStream = (dynamic_cast(resources->GetObject( "imageList1.ImageStream" ))); + this->imageList1->TransparentColor = System::Drawing::Color::Transparent; + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 40, 232 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 0; + this->button2->Text = "button1"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // Form1 + // + this->BackColor = System::Drawing::Color::FromArgb( ((System::Byte)(0)) ),((System::Byte)(64)),((System::Byte)(0)); + this->ClientSize = System::Drawing::Size( 408, 405 ); + array^temp0 = {this->button2}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Add a button to a form and set some of its common properties. + private: + void AddMyButton() + { + // Create a button and add it to the form. + Button^ button1 = gcnew Button; + + // Anchor the button to the bottom right corner of the form + button1->Anchor = static_cast(AnchorStyles::Bottom | AnchorStyles::Right); + + // Assign a background image. + button1->BackgroundImage = imageList1->Images[ 0 ]; + + // Specify the layout style of the background image. Tile is the default. + button1->BackgroundImageLayout = ImageLayout::Center; + + // Make the button the same size as the image. + button1->Size = button1->BackgroundImage->Size; + + // Set the button's TabIndex and TabStop properties. + button1->TabIndex = 1; + button1->TabStop = true; + + // Add a delegate to handle the Click event. + button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // Add the button to the form. + this->Controls->Add( button1 ); + } + // + + // + // Add a GroupBox to a form and set some of its common properties. + private: + void AddMyGroupBox() + { + // Create a GroupBox and add a TextBox to it. + GroupBox^ groupBox1 = gcnew GroupBox; + TextBox^ textBox1 = gcnew TextBox; + textBox1->Location = Point(15,15); + groupBox1->Controls->Add( textBox1 ); + + // Set the Text and Dock properties of the GroupBox. + groupBox1->Text = "MyGroupBox"; + groupBox1->Dock = DockStyle::Top; + + // Disable the GroupBox (which disables all its child controls) + groupBox1->Enabled = false; + + // Add the Groupbox to the form. + this->Controls->Add( groupBox1 ); + } + // + + // + // Reset all the controls to the user's default Control color. + private: + void ResetAllControlsBackColor( Control^ control ) + { + control->BackColor = SystemColors::Control; + control->ForeColor = SystemColors::ControlText; + if ( control->HasChildren ) + { + // Recursively call this method for each child control. + IEnumerator^ myEnum = control->Controls->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Control^ childControl = safe_cast(myEnum->Current); + ResetAllControlsBackColor( childControl ); + } + } + } + // + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->ResetAllControlsBackColor( this ); + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->AddMyButton(); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ControlProperties::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp new file mode 100644 index 00000000000..2a10c125d5c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties2/CPP/misccontrolproperties.cpp @@ -0,0 +1,212 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; +using namespace System::IO; + +public ref class Form1: public System::Windows::Forms::Form +{ +private: + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::ComboBox^ comboBox1; + System::ComponentModel::Container^ components; + +public: + Form1() + { + InitializeComponent(); + array^temp0 = {gcnew MenuItem( "Edit" )}; + this->treeView1->ContextMenu = gcnew System::Windows::Forms::ContextMenu( temp0 ); + } + +protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + /// + /// Required method for Designer support; do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->treeView1 = gcnew System::Windows::Forms::TreeView; + this->comboBox1 = gcnew System::Windows::Forms::ComboBox; + this->SuspendLayout(); + + // + // treeView1 + // + this->treeView1->Anchor = static_cast(AnchorStyles::Top | AnchorStyles::Bottom | AnchorStyles::Left | AnchorStyles::Right); + this->treeView1->ImageIndex = -1; + this->treeView1->Name = "treeView1"; + this->treeView1->SelectedImageIndex = -1; + this->treeView1->Size = System::Drawing::Size( 232, 224 ); + this->treeView1->TabIndex = 0; + this->treeView1->MouseUp += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::treeView1_MouseUp ); + this->treeView1->BeforeExpand += gcnew System::Windows::Forms::TreeViewCancelEventHandler( this, &Form1::treeView1_BeforeExpand ); + + // + // comboBox1 + // + this->comboBox1->Dock = System::Windows::Forms::DockStyle::Bottom; + this->comboBox1->Location = System::Drawing::Point( 0, 224 ); + this->comboBox1->Name = "comboBox1"; + this->comboBox1->Size = System::Drawing::Size( 232, 21 ); + this->comboBox1->TabIndex = 1; + this->comboBox1->SelectedIndexChanged += gcnew System::EventHandler( this, &Form1::comboBox1_SelectedIndexChanged ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 232, 245 ); + array^temp1 = {this->comboBox1,this->treeView1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + this->ResumeLayout( false ); + } + + // +private: + void Form1_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Display the hand cursor when the mouse pointer + // is over the combo box drop-down button. + comboBox1->Cursor = Cursors::Hand; + + // Fill the combo box with all the logical + // drives available to the user. + try + { + IEnumerator^ myEnum = Environment::GetLogicalDrives()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + String^ logicalDrive = safe_cast(myEnum->Current); + comboBox1->Items->Add( logicalDrive ); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + // + + // +protected: + property System::Windows::Forms::ImeMode DefaultImeMode + { + virtual System::Windows::Forms::ImeMode get() override + { + // Disable the IME mode for the control. + return ::ImeMode::Off; + } + + } + // + + // +protected: + property System::Drawing::Size DefaultSize + { + virtual System::Drawing::Size get() override + { + // Set the default size of + // the form to 500 pixels square. + return System::Drawing::Size( 500, 500 ); + } + } + // + + // +private: + void treeView1_MouseUp( Object^ /*sender*/, MouseEventArgs^ e ) + { + // If the right mouse button was clicked and released, + // display the shortcut menu assigned to the TreeView. + if ( e->Button == ::MouseButtons::Right ) + { + treeView1->ContextMenu->Show( treeView1, Point(e->X,e->Y) ); + } + } + // + + void comboBox1_SelectedIndexChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + DirectoryInfo^ dirInfo = gcnew DirectoryInfo( dynamic_cast(comboBox1->SelectedItem) ); + this->treeView1->Nodes->Clear(); + + // Do not display or attempt to access System, Temporary, or Hidden directories. + if ( dirInfo->Exists && ((dirInfo->Attributes & (FileAttributes::Hidden | FileAttributes::System | FileAttributes::Temporary)) != (FileAttributes)0) ) + { + TreeNode^ rootNode = gcnew TreeNode( dynamic_cast(comboBox1->SelectedItem) ); + treeView1->Nodes->Add( rootNode ); + CreateChildNodes( dirInfo, rootNode ); + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + + void CreateChildNodes( DirectoryInfo^ dirInfo, TreeNode^ parentNode ) + { + try + { + IEnumerator^ myEnum = dirInfo->GetDirectories()->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + DirectoryInfo^ d = safe_cast(myEnum->Current); + + // Do not display or attempt to access System, Temporary, or System directories. + if ( (d->Attributes & (FileAttributes::Hidden | FileAttributes::System | FileAttributes::Temporary))== (FileAttributes)0 ) + { + parentNode->Nodes->Add( gcnew TreeNode( d->Name ) ); + Application::DoEvents(); + } + } + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + } + } + + void treeView1_BeforeExpand( Object^ /*sender*/, TreeViewCancelEventArgs^ e ) + { + IEnumerator^ myEnum = e->Node->Nodes->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + TreeNode^ node = safe_cast(myEnum->Current); + + // Create a DirectoryInfo Object* from the node path. + CreateChildNodes( gcnew DirectoryInfo( node->FullPath ), node ); + } + } +}; + +[STAThread] +void main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp new file mode 100644 index 00000000000..025fe9cefb9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control Properties3/CPP/aboutdialog.cpp @@ -0,0 +1,91 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Reflection; +using namespace System::Runtime::CompilerServices; + +[assembly:AssemblyCompany("Microsoft")]; +[assembly:AssemblyProduct("Test")]; +[assembly:AssemblyVersion("1.0.*")]; +namespace CodeExamples +{ + public ref class AboutDialog: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ buttonOK; + System::Windows::Forms::Label ^ labelVersionInfo; + System::ComponentModel::Container^ components; + + public: + AboutDialog() + { + InitializeComponent(); + } + + protected: + ~AboutDialog() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->labelVersionInfo = gcnew System::Windows::Forms::Label; + this->buttonOK = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // labelVersionInfo + // + this->labelVersionInfo->Location = System::Drawing::Point( 8, 8 ); + this->labelVersionInfo->Name = "labelVersionInfo"; + this->labelVersionInfo->Size = System::Drawing::Size( 360, 23 ); + this->labelVersionInfo->TabIndex = 0; + this->labelVersionInfo->Text = "label1"; + + // + // buttonOK + // + this->buttonOK->Location = System::Drawing::Point( 296, 64 ); + this->buttonOK->Name = "buttonOK"; + this->buttonOK->TabIndex = 3; + this->buttonOK->Text = "&OK"; + + // + // AboutDialog + // + this->ClientSize = System::Drawing::Size( 392, 109 ); + array^temp0 = {this->buttonOK,this->labelVersionInfo}; + this->Controls->AddRange( temp0 ); + this->Name = "AboutDialog"; + this->Text = "About"; + this->Load += gcnew System::EventHandler( this, &AboutDialog::AboutDialog_Load ); + this->ResumeLayout( false ); + } + + // + void AboutDialog_Load( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + // Display the application information in the label. + this->labelVersionInfo->Text = String::Format( "{0} {1} Version: {2}", this->CompanyName, this->ProductName, this->ProductVersion ); + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew CodeExamples::AboutDialog ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp new file mode 100644 index 00000000000..eebc7729e6c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control SizeLocation/CPP/controlsizelocation.cpp @@ -0,0 +1,125 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace ControlMembers +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support; do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Anchor = static_cast(System::Windows::Forms::AnchorStyles::Bottom | System::Windows::Forms::AnchorStyles::Right); + this->button1->Location = System::Drawing::Point( 104, 104 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + // Create three buttons and place them on a form using + // several size and location related properties. + void AddOKCancelButtons() + { + + // Set the button size and location using + // the Size and Location properties. + Button^ buttonOK = gcnew Button; + buttonOK->Location = Point(136,248); + buttonOK->Size = System::Drawing::Size( 75, 25 ); + + // Set the Text property and make the + // button the form's default button. + buttonOK->Text = "&OK"; + this->AcceptButton = buttonOK; + + // Set the button size and location using the Top, + // Left, Width, and Height properties. + Button^ buttonCancel = gcnew Button; + buttonCancel->Top = buttonOK->Top; + buttonCancel->Left = buttonOK->Right + 5; + buttonCancel->Width = buttonOK->Width; + buttonCancel->Height = buttonOK->Height; + + // Set the Text property and make the + // button the form's cancel button. + buttonCancel->Text = "&Cancel"; + this->CancelButton = buttonCancel; + + // Set the button size and location using + // the Bounds property. + Button^ buttonHelp = gcnew Button; + buttonHelp->Bounds = Rectangle(10,10,75,25); + + // Set the Text property of the button. + buttonHelp->Text = "&Help"; + + // Add the buttons to the form. + array^temp1 = {buttonOK,buttonCancel,buttonHelp}; + this->Controls->AddRange( temp1 ); + } + // + + void button_Click( Object^ sender, System::EventArgs^ /*e*/ ) + { + Control^ ctrl = dynamic_cast(sender); + array^temp2 = {ctrl->Top,ctrl->Bottom,ctrl->Left,ctrl->Right,ctrl->Width,ctrl->Height,ctrl->Size,ctrl->Location}; + MessageBox::Show( String::Format( "Top: {0}\n Bottom: {1}\n Left: {2}\n Right: {3}\n Width: {4}\n Height: {5}\n Size: {6}\n Location: {7}", temp2 ), "button1 Position", MessageBoxButtons::OKCancel ); + this->AddOKCancelButtons(); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ControlMembers::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp new file mode 100644 index 00000000000..1e20a6f2c88 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.ControlAccessibleObject/CPP/controlaccessibility.cpp @@ -0,0 +1,152 @@ + + +// +#using +#using +#using +#using + +using namespace System; +using namespace System::Windows::Forms; +using namespace System::Drawing; + +namespace MyCustomControls +{ + public ref class MyCheckBox: public CheckBox + { + public: + MyCheckBox() + { + // Make the check box appear like a toggle button. + this->Appearance = ::Appearance::Button; + + // Center the text on the button. + this->TextAlign = ContentAlignment::MiddleCenter; + + // Set the AccessibleDescription text. + this->AccessibleDescription = "A toggle style button."; + } + + protected: + + // Create an instance of the AccessibleObject + // defined for the 'MyCheckBox' control + virtual AccessibleObject^ CreateAccessibilityInstance() override; + }; + + // Accessible Object* for use with the 'MyCheckBox' control. + private ref class MyCheckBoxAccessibleObject: public Control::ControlAccessibleObject + { + public: + MyCheckBoxAccessibleObject( MyCheckBox^ owner ) + : ControlAccessibleObject( owner ) + {} + + property String^ DefaultAction + { + virtual String^ get() override + { + // Return the DefaultAction based upon + // the state of the control. + if ( (dynamic_cast(Owner))->Checked ) + { + return "Toggle button up"; + } + else + { + return "Toggle button down"; + } + } + } + + property String^ Name + { + virtual String^ get() override + { + // Return the Text property of the control + // if the AccessibleName is 0. + String^ name = Owner->AccessibleName; + if ( name != nullptr ) + { + return name; + } + + return (dynamic_cast(Owner))->Text; + } + + virtual void set( String^ value ) override + { + ControlAccessibleObject::Name = value; + } + } + + property AccessibleRole Role + { + virtual AccessibleRole get() override + { + // Since the check box appears like a button, + // make the Role the same as a button. + return AccessibleRole::PushButton; + } + } + }; + + AccessibleObject^ MyCheckBox::CreateAccessibilityInstance() + { + return gcnew MyCheckBoxAccessibleObject( this ); + } +} +// + +namespace ControlAccessibility +{ + public ref class MyForm: public System::Windows::Forms::Form + { + private: + System::ComponentModel::Container^ components; + + protected: + ~MyForm() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + } + + // + public: + MyForm() + { + // Create a 'MyCheckBox' control and + // display an image on it. + MyCustomControls::MyCheckBox^ myCheckBox = gcnew MyCustomControls::MyCheckBox; + myCheckBox->Location = Point(5,5); + myCheckBox->Image = Image::FromFile( String::Concat( Application::CommonAppDataPath, "\\Preview.jpg" ) ); + + // Set the AccessibleName property + // since there is no Text displayed. + myCheckBox->AccessibleName = "Preview"; + myCheckBox->AccessibleDescription = "A toggle button used to show the document preview."; + this->Controls->Add( myCheckBox ); + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ControlAccessibility::MyForm ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp new file mode 100644 index 00000000000..e44777c2766 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control.DragOperations/CPP/imagedrag.cpp @@ -0,0 +1,147 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace DragDrop +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::ComponentModel::Container^ components; + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support; do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + this->SuspendLayout(); + + // + // ImageDrag + // + this->AllowDrop = true; + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "ImageDrag"; + this->Text = "ImageDrag"; + this->ResumeLayout( false ); + } + + + // + private: + Image^ picture; + Point pictureLocation; + + public: + Form1() + { + + // Enable drag-and-drop operations and + // add handlers for DragEnter and DragDrop. + this->AllowDrop = true; + this->DragDrop += gcnew DragEventHandler( this, &Form1::Form1_DragDrop ); + this->DragEnter += gcnew DragEventHandler( this, &Form1::Form1_DragEnter ); + } + + protected: + virtual void OnPaint( PaintEventArgs^ e ) override + { + + // If there is an image and it has a location, + // paint it when the Form is repainted. + Form::OnPaint( e ); + if ( this->picture != nullptr && this->pictureLocation != Point::Empty ) + { + e->Graphics->DrawImage( this->picture, this->pictureLocation ); + } + } + + private: + void Form1_DragDrop( Object^ /*sender*/, DragEventArgs^ e ) + { + + // Handle FileDrop data. + if ( e->Data->GetDataPresent( DataFormats::FileDrop ) ) + { + // Assign the file names to a String* array, in + // case the user has selected multiple files. + array^files = (array^)e->Data->GetData( DataFormats::FileDrop ); + try + { + // Assign the first image to the picture variable. + this->picture = Image::FromFile( files[ 0 ] ); + + // Set the picture location equal to the drop point. + this->pictureLocation = this->PointToClient( Point(e->X,e->Y) ); + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + return; + } + + } + + // Handle Bitmap data. + if ( e->Data->GetDataPresent( DataFormats::Bitmap ) ) + { + try + { + // Create an Image and assign it to the picture variable. + this->picture = dynamic_cast(e->Data->GetData( DataFormats::Bitmap )); + + // Set the picture location equal to the drop point. + this->pictureLocation = this->PointToClient( Point(e->X,e->Y) ); + } + catch ( Exception^ ex ) + { + MessageBox::Show( ex->Message ); + return; + } + } + + // Force the form to be redrawn with the image. + this->Invalidate(); + } + + void Form1_DragEnter( Object^ /*sender*/, DragEventArgs^ e ) + { + // If the data is a file or a bitmap, display the copy cursor. + if ( e->Data->GetDataPresent( DataFormats::Bitmap ) || e->Data->GetDataPresent( DataFormats::FileDrop ) ) + { + e->Effect = DragDropEffects::Copy; + } + else + { + e->Effect = DragDropEffects::None; + } + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew DragDrop::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp new file mode 100644 index 00000000000..486f43d8feb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ControlMembers6/CPP/controlmembers6.cpp @@ -0,0 +1,225 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ControlMembers6 +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Button^ button1; + System::Windows::Forms::TextBox^ textBox1; + System::Windows::Forms::Button^ button2; + System::Windows::Forms::CheckBox^ checkBox1; + System::Windows::Forms::Button^ button3; + System::Windows::Forms::Button^ button4; + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + textBox1->Enabled = checkBox1->Checked; + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->button1 = gcnew System::Windows::Forms::Button; + this->textBox1 = gcnew System::Windows::Forms::TextBox; + this->button2 = gcnew System::Windows::Forms::Button; + this->checkBox1 = gcnew System::Windows::Forms::CheckBox; + this->button3 = gcnew System::Windows::Forms::Button; + this->button4 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 48, 40 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 0; + this->button1->Text = "Focus"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // textBox1 + // + this->textBox1->Location = System::Drawing::Point( 48, 88 ); + this->textBox1->Name = "textBox1"; + this->textBox1->TabIndex = 1; + this->textBox1->Text = "textBox1"; + + // + // button2 + // + this->button2->Location = System::Drawing::Point( 160, 40 ); + this->button2->Name = "button2"; + this->button2->TabIndex = 2; + this->button2->Text = "Select"; + this->button2->Click += gcnew System::EventHandler( this, &Form1::button2_Click ); + + // + // checkBox1 + // + this->checkBox1->Location = System::Drawing::Point( 160, 88 ); + this->checkBox1->Name = "checkBox1"; + this->checkBox1->TabIndex = 3; + this->checkBox1->Text = "Enabled"; + this->checkBox1->CheckedChanged += gcnew System::EventHandler( this, &Form1::checkBox1_CheckedChanged ); + + // + // button3 + // + this->button3->Location = System::Drawing::Point( 216, 248 ); + this->button3->Name = "button3"; + this->button3->TabIndex = 4; + this->button3->Text = "button3"; + this->button3->Click += gcnew System::EventHandler( this, &Form1::button3_Click ); + + // + // button4 + // + this->button4->Location = System::Drawing::Point( 0, 248 ); + this->button4->Name = "button4"; + this->button4->TabIndex = 5; + this->button4->Text = "button4"; + this->button4->Click += gcnew System::EventHandler( this, &Form1::button4_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + array^temp0 = {this->button4,this->button3,this->checkBox1,this->button2,this->textBox1,this->button1}; + this->Controls->AddRange( temp0 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->ControlSetFocus( this->textBox1 ); + } + + // + public: + void ControlSetFocus( Control^ control ) + { + + // Set focus to the control, if it can receive focus. + if ( control->CanFocus ) + { + control->Focus(); + } + } + // + + // + public: + void ControlSelect( Control^ control ) + { + + // Select the control, if it can be selected. + if ( control->CanSelect ) + { + control->Select( ); + } + } + // + + private: + void checkBox1_CheckedChanged( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + textBox1->Enabled = checkBox1->Checked; + } + + void button2_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->ControlSelect( this->textBox1 ); + } + + // + public: + void EnableDoubleBuffering() + { + // Set the value of the double-buffering style bits to true. + this->SetStyle( static_cast(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint), true ); + this->UpdateStyles(); + } + // + + // + public: + bool DoubleBufferingEnabled() + { + + // Get the value of the double-buffering style bits. + return this->GetStyle( static_cast(ControlStyles::DoubleBuffer | ControlStyles::UserPaint | ControlStyles::AllPaintingInWmPaint) ); + } + // + + + private: + void button4_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + this->EnableDoubleBuffering(); + } + + void button3_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ ) + { + MessageBox::Show( this->DoubleBufferingEnabled().ToString() ); + this->ScaleChildControls(); + } + + // + public: + void ScaleChildControlsEqually() + { + // Resize all child controls to 1.5 + // times their current size. + for ( int i = 0; i < this->Controls->Count; i++ ) + { + this->Controls[ i ]->Scale( 1.5f ); + } + } + // + + // + void ScaleChildControls() + { + // Resize all child controls to 1.5 times their current + // height while, maintaining their current width. + for ( int i = 0; i < this->Controls->Count; i++ ) + { + this->Controls[ i ]->Scale( 1.0f, 1.5f ); + } + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ControlMembers6::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp new file mode 100644 index 00000000000..3448e8b4a82 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_Methods/CPP/controlmethods.cpp @@ -0,0 +1,99 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::ComponentModel; +using namespace System::Drawing; +using namespace System::Windows::Forms; + +namespace SetBoundsCore +{ + public ref class MyUserControl: public System::Windows::Forms::UserControl + { + private: + System::ComponentModel::Container^ components; + + public: + MyUserControl() + { + InitializeComponent(); + } + + protected: + ~MyUserControl() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // MyUserControl + // + this->BackColor = System::Drawing::SystemColors::Desktop; + this->Name = "MyUserControl"; + this->Size = System::Drawing::Size( 224, 88 ); + } + + // + protected: + virtual void SetBoundsCore( int x, int y, int width, int height, BoundsSpecified specified ) override + { + // Set a fixed height and width for the control. + UserControl::SetBoundsCore( x, y, 150, 75, specified ); + } + // + + // + protected: + virtual void SetClientSizeCore( int x, int y ) override + { + // Keep the client size square. + if ( x > y ) + { + UserControl::SetClientSizeCore( x, x ); + } + else + { + UserControl::SetClientSizeCore( y, y ); + } + } + // + + // + protected: + virtual void ScaleCore( float dx, float dy ) override + { + // Scale all child controls. + this->SuspendLayout(); + System::Drawing::Size myClientSize = this->ClientSize; + myClientSize.Height = (int)(myClientSize.Height * dx); + myClientSize.Width = (int)(myClientSize.Width * dy); + + /* Scale the child controls because + * UserControl::ScaleCore was not called. */ + System::Collections::IEnumerator^ myEnum = this->Controls->GetEnumerator(); + while ( myEnum->MoveNext() ) + { + Control^ childControl = safe_cast(myEnum->Current); + childControl->Scale( dx, dy ); + } + + this->ResumeLayout(); + this->ClientSize = myClientSize; + } + // + }; +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp new file mode 100644 index 00000000000..a6dac132eaf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_OnPropertyChangedEvents/CPP/onpropertychangedevents.cpp @@ -0,0 +1,114 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace PropChanged +{ + public ref class MyTextBox: public TextBox + { + // + protected: + virtual void OnTextChanged( System::EventArgs^ e ) override + { + try + { + // Convert the text to a Double and determine + // if it is a negative number. + if ( Double::Parse( this->Text ) < 0 ) + { + // If the number is negative, display it in Red. + this->ForeColor = Color::Red; + } + else + { + // If the number is not negative, display it in Black. + this->ForeColor = Color::Black; + } + } + catch ( Exception^ ) + { + // If there is an error, display the + // text using the system colors. + this->ForeColor = SystemColors::ControlText; + } + + TextBox::OnTextChanged( e ); + } + // + }; + + public ref class Form1: public System::Windows::Forms::Form + { + private: + MyTextBox^ currencyTextBox; + System::Windows::Forms::Button^ button1; + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->currencyTextBox = gcnew PropChanged::MyTextBox; + this->button1 = gcnew System::Windows::Forms::Button; + this->SuspendLayout(); + + // + // currencyTextBox + // + this->currencyTextBox->Location = System::Drawing::Point( 8, 8 ); + this->currencyTextBox->Name = "currencyTextBox"; + this->currencyTextBox->Size = System::Drawing::Size( 104, 20 ); + this->currencyTextBox->TabIndex = 0; + this->currencyTextBox->Text = ""; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 64, 48 ); + this->button1->Name = "button1"; + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 194, 103 ); + array^temp0 = {this->button1,this->currencyTextBox}; + this->Controls->AddRange( temp0 ); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew PropChanged::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp new file mode 100644 index 00000000000..02b7c453c6f --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.Control_PropertyChangedEvents/CPP/propertychangedevents.cpp @@ -0,0 +1,99 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace PropChanged +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::TextBox^ currencyTextBox; + System::ComponentModel::Container^ components; + + public: + Form1() + { + components = nullptr; + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->currencyTextBox = gcnew System::Windows::Forms::TextBox; + this->SuspendLayout(); + + // + // currencyTextBox + // + this->currencyTextBox->Location = System::Drawing::Point( 8, 8 ); + this->currencyTextBox->Name = "currencyTextBox"; + this->currencyTextBox->Size = System::Drawing::Size( 104, 20 ); + this->currencyTextBox->TabIndex = 0; + this->currencyTextBox->Text = ""; + this->currencyTextBox->TextChanged += gcnew System::EventHandler( this, &Form1::currencyTextBox_TextChanged ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 194, 103 ); + array^temp0 = {this->currencyTextBox}; + this->Controls->AddRange( temp0 ); + this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + private: + void currencyTextBox_TextChanged( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + try + { + // Convert the text to a Double and determine if it is a negative number. + if ( Double::Parse( currencyTextBox->Text ) < 0 ) + { + // If the number is negative, display it in Red. + currencyTextBox->ForeColor = Color::Red; + } + else + { + // If the number is not negative, display it in Black. + currencyTextBox->ForeColor = Color::Black; + } + } + catch ( Exception^ ) + { + // If there is an error, display the text using the system colors. + currencyTextBox->ForeColor = SystemColors::ControlText; + } + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew PropChanged::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp new file mode 100644 index 00000000000..8b63df01ccf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.ScrollableControl/CPP/scrollablecontrol.cpp @@ -0,0 +1,102 @@ + + +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +namespace ScrollableControl +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::Panel^ panel1; + System::Windows::Forms::Button^ button1; + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->panel1 = gcnew System::Windows::Forms::Panel; + this->button1 = gcnew System::Windows::Forms::Button; + this->panel1->SuspendLayout(); + this->SuspendLayout(); + + // + // panel1 + // + this->panel1->AutoScroll = true; + this->panel1->AutoScrollMargin = System::Drawing::Size( 5, 5 ); + this->panel1->BorderStyle = System::Windows::Forms::BorderStyle::Fixed3D; + array^temp0 = {this->button1}; + this->panel1->Controls->AddRange( temp0 ); + this->panel1->DockPadding->All = 10; + this->panel1->Location = System::Drawing::Point( 40, 64 ); + this->panel1->Name = "panel1"; + this->panel1->Size = System::Drawing::Size( 272, 104 ); + this->panel1->TabIndex = 0; + + // + // button1 + // + this->button1->Location = System::Drawing::Point( 416, 184 ); + this->button1->Name = "button1"; + this->button1->Size = System::Drawing::Size( 104, 40 ); + this->button1->TabIndex = 1; + this->button1->Text = "button1"; + this->button1->Click += gcnew System::EventHandler( this, &Form1::button1_Click ); + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 336, 205 ); + array^temp1 = {this->panel1}; + this->Controls->AddRange( temp1 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->panel1->ResumeLayout( false ); + this->ResumeLayout( false ); + } + + // + private: + void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) + { + /* Add a button to top left corner of the + * scrollable area, allowing for the offset. */ + panel1->AutoScroll = true; + Button^ myButton = gcnew Button; + myButton->Location = Point(0 + panel1->AutoScrollPosition.X,0 + panel1->AutoScrollPosition.Y); + panel1->Controls->Add( myButton ); + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew ::ScrollableControl::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp new file mode 100644 index 00000000000..7a10caa2c37 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/Windows.Forms.TreeNode/CPP/treenode.cpp @@ -0,0 +1,148 @@ + + +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; + +namespace Foo +{ + public ref class Form1: public System::Windows::Forms::Form + { + private: + System::Windows::Forms::TreeView^ treeView1; + System::Windows::Forms::StatusBar^ statusBar1; + System::ComponentModel::Container^ components; + + public: + Form1() + { + InitializeComponent(); + } + + protected: + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + + private: + void InitializeComponent() + { + this->treeView1 = gcnew System::Windows::Forms::TreeView; + this->statusBar1 = gcnew System::Windows::Forms::StatusBar; + this->SuspendLayout(); + + // + // treeView1 + // + this->treeView1->ImageIndex = -1; + this->treeView1->Location = System::Drawing::Point( 8, 8 ); + this->treeView1->Name = "treeView1"; + array^temp0 = {gcnew System::Windows::Forms::TreeNode( "Node5" )}; + array^temp1 = {gcnew System::Windows::Forms::TreeNode( "Node4",temp0 )}; + array^temp2 = {gcnew System::Windows::Forms::TreeNode( "Node3",temp1 )}; + array^temp3 = {gcnew System::Windows::Forms::TreeNode( "Node8" )}; + array^temp4 = {gcnew System::Windows::Forms::TreeNode( "Node7",temp3 )}; + array^temp5 = {gcnew System::Windows::Forms::TreeNode( "Node6",temp4 )}; + array^temp6 = {gcnew System::Windows::Forms::TreeNode( "Node11" )}; + array^temp7 = {gcnew System::Windows::Forms::TreeNode( "Node10",temp6 )}; + array^temp8 = {gcnew System::Windows::Forms::TreeNode( "Node9",temp7 )}; + array^temp9 = {gcnew System::Windows::Forms::TreeNode( "Node0",temp2 ),gcnew System::Windows::Forms::TreeNode( "Node1",temp5 ),gcnew System::Windows::Forms::TreeNode( "Node2",temp8 )}; + this->treeView1->Nodes->AddRange( temp9 ); + this->treeView1->SelectedImageIndex = -1; + this->treeView1->Size = System::Drawing::Size( 128, 144 ); + this->treeView1->TabIndex = 0; + this->treeView1->MouseDown += gcnew System::Windows::Forms::MouseEventHandler( this, &Form1::treeView1_MouseDown ); + this->treeView1->AfterCollapse += gcnew System::Windows::Forms::TreeViewEventHandler( this, &Form1::treeView1_AfterCollapse ); + this->treeView1->AfterSelect += gcnew System::Windows::Forms::TreeViewEventHandler( this, &Form1::treeView1_AfterSelect ); + + // + // statusBar1 + // + this->statusBar1->Location = System::Drawing::Point( 0, 247 ); + this->statusBar1->Name = "statusBar1"; + this->statusBar1->Size = System::Drawing::Size( 256, 22 ); + this->statusBar1->TabIndex = 2; + this->statusBar1->Text = "statusBar1"; + + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 256, 269 ); + array^temp10 = {this->statusBar1,this->treeView1}; + this->Controls->AddRange( temp10 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->ResumeLayout( false ); + } + + // + private: + void treeView1_MouseDown( Object^ /*sender*/, MouseEventArgs^ e ) + { + switch ( e->Button ) + { + // Remove the TreeNode under the mouse cursor + // if the right mouse button was clicked. + case ::MouseButtons::Right: + treeView1->GetNodeAt( e->X, e->Y )->Remove(); + break; + + // Toggle the TreeNode under the mouse cursor + // if the middle mouse button (mouse wheel) was clicked. + case ::MouseButtons::Middle: + treeView1->GetNodeAt( e->X, e->Y )->Toggle(); + break; + } + } + // + + // + private: + void treeView1_AfterSelect( Object^ /*sender*/, TreeViewEventArgs^ e ) + { + /* Display the Text and Index of the + * selected tree node's Parent. */ + if ( e->Node->Parent != nullptr && e->Node->Parent->GetType() == TreeNode::typeid ) + { + statusBar1->Text = String::Format( "Parent: {0}\n Index Position: {1}", e->Node->Parent->Text, e->Node->Parent->Index ); + } + else + { + statusBar1->Text = "No parent node."; + } + } + // + + // + private: + void treeView1_AfterCollapse( Object^ /*sender*/, TreeViewEventArgs^ e ) + { + // Create a copy of the e.Node from its Handle. + TreeNode^ tn = TreeNode::FromHandle( e->Node->TreeView, e->Node->Handle ); + tn->Text = String::Concat( tn->Text, "Copy" ); + + // Remove the e.Node so it can be replaced with tn. + e->Node->Remove(); + + // Add tn to the TreeNodeCollection. + treeView1->Nodes->Add( tn ); + } + // + }; +} + +[STAThread] +int main() +{ + Application::Run( gcnew Foo::Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp b/snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp new file mode 100644 index 00000000000..7f57b3c80da --- /dev/null +++ b/snippets/cpp/VS_Snippets_Winforms/enumException/CPP/enumexception.cpp @@ -0,0 +1,101 @@ +#using +#using +#using +#using + +using namespace System; +using namespace System::Drawing; +using namespace System::Collections; +using namespace System::ComponentModel; +using namespace System::Windows::Forms; +using namespace System::Data; + +#define NULL 0 + +/// +/// Summary description for Form1. +/// +public ref class Form1: public System::Windows::Forms::Form +{ +private: + + /// + /// Required designer variable. + /// + System::ComponentModel::Container^ components; + +public: + Form1() + { + components = nullptr; + + // + // Required for Windows Form Designer support + // + InitializeComponent(); + + // + // TODO: Add any constructor code after InitializeComponent call + // + } + +protected: + + /// + /// Clean up any resources being used. + /// + ~Form1() + { + if ( components != nullptr ) + { + delete components; + } + } + +private: + + //#region Windows Form Designer generated code + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + void InitializeComponent() + { + // + // Form1 + // + this->ClientSize = System::Drawing::Size( 292, 273 ); + this->Name = "Form1"; + this->Text = "Form1"; + this->Load += gcnew System::EventHandler( this, &Form1::Form1_Load ); + } + + //#endregion + void Form1_Load( Object^ sender, System::EventArgs^ e ) + { + // + try + { + //Attempting to pass an invalid enum value (MessageBoxButtons) to the Show method + MessageBoxButtons myButton = (MessageBoxButtons)123; // to fix use System::Windows::Forms::DialogResult::OK; + + MessageBox::Show( this, "This is a message", "This is the Caption", myButton ); + } + catch ( InvalidEnumArgumentException^ invE ) + { + Console::WriteLine( invE->Message ); + Console::WriteLine( invE->ParamName ); + Console::WriteLine( invE->StackTrace ); + Console::WriteLine( invE->Source ); + } + // + } +}; + +/// +/// The main entry point for the application. +/// +void main() +{ + Application::Run( gcnew Form1 ); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp new file mode 100644 index 00000000000..9b45b0f17f2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/BitmapMetadata.cpp @@ -0,0 +1,92 @@ +//BitmapMetadata.cpp file + +using namespace System; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; +using namespace System::Security; + + +namespace SDKSample { + + public ref class app : Application { + + private: Window^ mainWindow; + + protected: virtual void OnStartup (StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: void CreateAndShowMainWindow () + { + + // Create the application's main window + mainWindow = gcnew Window(); + mainWindow->Title = "Image Metadata"; + + // + Stream^ pngStream = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::ReadWrite, FileShare::ReadWrite); + PngBitmapDecoder^ pngDecoder = gcnew PngBitmapDecoder(pngStream, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapFrame^ pngFrame = pngDecoder->Frames[0]; + InPlaceBitmapMetadataWriter^ pngInplace = pngFrame->CreateInPlaceBitmapMetadataWriter(); + if (pngInplace->TrySave()) + { + pngInplace->SetQuery("/Text/Description", "Have a nice day."); + } + pngStream->Close(); + // + + // Draw the Image + Image^ myImage = gcnew Image(); + myImage->Source = gcnew BitmapImage(gcnew System::Uri("smiley.png", UriKind::Relative)); + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + + // + + // Add the metadata of the bitmap image to the text block. + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "The Description metadata of this image is: " + pngInplace->GetQuery("/Text/Description")->ToString(); + // + + // Define a StackPanel to host Controls + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->Height = 200; + myStackPanel->VerticalAlignment = VerticalAlignment::Top; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Center; + + // Add the Image and TextBlock to the parent Grid + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the Content of the Parent Window Object + mainWindow->Content = myStackPanel; + mainWindow->Show(); + }; + }; + + // Define a static entry class + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj new file mode 100644 index 00000000000..74b2f3f4b02 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/bitmapmetadata.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/smiley.png b/snippets/cpp/VS_Snippets_Wpf/BitMapMetadata/CPP/smiley.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0b9496cad2e2133d1edb7c4d3511a059772473 GIT binary patch literal 4599 zcmV002t}1^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gd+O_M1?%nBL9%{pfwtqjNM-PIhr#CijiiRXT8n(y@ZihK@7DAy=K&#c7<)>9(RsW2^-Me>j;zSzWd1ol>?M;dHr%%@} zr0i_Mgb57fa>840^~1h>$xtfqnhnZoupV6aMNvdSK>;>x+JbiNykKw7V#p8%Cr?tX z68FtfWhLSKdDF$6g98r_4-c$dxf(@9MbG?Ikmm-gTGglYtgLK&{q+KPc(}vKiN)~Y zED{q=yf6tdJT>qNx`(KQxMR* zH#}Rng^RNsJ$uM7`~$-5S%j#ygruJd$Bz**&i$bi#|g>%3DKJgGo}+pk0SK!!NEap z4-a=w^zie;q<;h<+dn({VDM75(ozme>Ar53~JH=M4lk>08vX2xr3NCpvK;? zY1SEX_nv6i={@uvJQ-7i*JA6gQ^?3w;o@Z-&gGONJ+rh +#using +#using +#using +#using +#using +#using +#using +#using */ +namespace SDKSample { + ref class app; + ref class EntryClass; +} + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; + +namespace SDKSample { + + public ref class app : Application { + + private: System::Windows::Window^ mainWindow; + + protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override ; + + private: void CreateAndShowMainWindow () ; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () ; + }; +} + diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp new file mode 100644 index 00000000000..9c9135fadd2 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherfile.cpp @@ -0,0 +1,134 @@ +using namespace System; +using namespace System::Collections::Generic; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; +using namespace System::Security; + +namespace SDKSample { + + public ref class app : Application { + + private: System::Windows::Window^ mainWindow; + + protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: void CreateAndShowMainWindow () + { + // Create the application's main window + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "BMP Imaging Sample"; + ScrollViewer^ mySV = gcnew ScrollViewer(); + + // + int width = 128; + int height = width; + int stride = width / 8; + array^ pixels = gcnew array(height * stride); + + List^ colors = gcnew List(); + colors->Add(Colors::Red); + colors->Add(Colors::Blue); + colors->Add(Colors::Green); + BitmapPalette^ myPalette = gcnew BitmapPalette(colors); + + // Creates a new empty image with the pre-defined palette + + // + BitmapSource^ image = BitmapSource::Create( + width, + height, + 96, + 96, + PixelFormats::Indexed1, + myPalette, + pixels, + stride); + // + + // + FileStream^ stream = gcnew FileStream("new.bmp", FileMode::Create); + BmpBitmapEncoder^ encoder = gcnew BmpBitmapEncoder(); + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); + encoder->Frames->Add(BitmapFrame::Create(image)); + encoder->Save(stream); + // + + // + + // + + // Open a Stream and decode a BMP image + Stream^ imageStreamSource = gcnew FileStream("tulipfarm.bmp", FileMode::Open, FileAccess::Read, FileShare::Read); + BmpBitmapDecoder^ decoder = gcnew BmpBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource = decoder->Frames[0]; + + // Draw the Image + Image^ myImage = gcnew Image(); + myImage->Source = bitmapSource; + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + // + + // + + // Open a Uri and decode a BMP image + System::Uri^ myUri = gcnew System::Uri("tulipfarm.bmp", UriKind::RelativeOrAbsolute); + BmpBitmapDecoder^ decoder2 = gcnew BmpBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource2 = decoder2->Frames[0]; + + // Draw the Image + Image^ myImage2 = gcnew Image(); + myImage2->Source = bitmapSource2; + myImage2->Stretch = Stretch::None; + myImage2->Margin = System::Windows::Thickness(20); + // + + // Define a StackPanel to host the decoded BMP images + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; + + // Add the Image and TextBlock to the parent Grid + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myImage2); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the Content of the Parent Window Object + mySV->Content = myStackPanel; + mainWindow->Content = mySV; + mainWindow->Show(); + } + + + }; + + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; + +} + + +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj new file mode 100644 index 00000000000..1f985d5f281 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj @@ -0,0 +1,97 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {6900EB9F-8008-437C-BB1E-3C7C06662F84} + v4.0 + ManagedCProj + AnotherProject + + + + Application + true + Unicode + + + Application + true + Unicode + + + + + + + + + + + + + true + .\ + + + false + + + + Level3 + ProgramDatabase + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + true + + + true + + + + + + + + + Level3 + ProgramDatabase + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + true + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters new file mode 100644 index 00000000000..aad46846bb3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/anotherproject.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp b/snippets/cpp/VS_Snippets_Wpf/BmpBitmapDecoderEncoder/CPP/tulipfarm.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a3f88f4d09ad712fb5ba5a035e8ac50b66693f3a GIT binary patch literal 921654 zcmX`TXOkOQmMjRSfCfTqt+fsW0$QdP%%m)mRU}KWs!MiN^-PPIo|*UFK3lUDU-lpF zPuYX+-KAZ^GLy(mFyh|he%$?Fdsm^u#^Fx|e_i z`hDO(7Rj?w`ZRW41j_S3dTlc=eerV-el$1OK-f0X47<2r~AyB zn&#L|meXjm3Pvk`eCCeV(P~{>uG8y>P(&G`Xn=^ zxjM_ZNgOSzcwVLRs#uKkWeuMO>pDJP`uoz`W#%d{H$Iy4Cq8);(5H!n<}Mz)bl{P? zD?6DLO*Oxk+zOXd+8+^Nj0F~IvXsU5W#*WtIvO`H6($P!I1%DZ%5otJ*}x?dksqs6 z!4rwVBnJG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>+QdHeJeqB`We=` z{#F$uf5~6+*I@mdffDeJ{JjgdYHGTxDf#^Ve8&F#f&8s2&^Tl=UX9O(9sYewy|?<) z#{NfDdpiDl$AdoKGqHrlr;b=!)(YtOnbVR*9ph&`h%7&?0^VS4ynZO%K=sdJmjkI6 zYv4qjw`dT`TO}5@Wt!plt`IB z{f4Z|v(xx`yJh@zjWR1gssb4o%r_A?QA4QyS?uVzGQ05i?fv8R=bzWh^7?ptO|Mio z!?9B$W&WHbAvle%w_C=~B=N&;9IHUa1@leBP1F#oe-=ABuFQVV--Wpge3y6f*Gz$9 z=a+Zu-k@~yPyTub2K}Exfs700n~0mJAyoe?c63~so%}t;?3llkPJHxsOa9IuTI^v` z0R2B+uQ + + // Create the application's main window + mainWindow = gcnew Window(); + mainWindow->Title = "Canvas ZIndex Sample"; + + // Create the Canvas + myCanvas = gcnew Canvas(); + + // Create the child Rectangle elements + myRectangle1 = gcnew Rectangle(); + myRectangle2 = gcnew Rectangle(); + myRectangle3 = gcnew Rectangle(); + myRectangle4 = gcnew Rectangle(); + myRectangle5 = gcnew Rectangle(); + myRectangle6 = gcnew Rectangle(); + + // Set properties on the Rectangle elements + Canvas::SetTop(myRectangle1, 100); + Canvas::SetLeft(myRectangle1, 100); + Canvas::SetZIndex(myRectangle1, 3); + myRectangle1->Fill = Brushes::Blue; + myRectangle1->Width = 100; + myRectangle1->Height = 100; + + // + Canvas::SetTop(myRectangle2, 150); + Canvas::SetLeft(myRectangle2, 150); + Canvas::SetZIndex(myRectangle2, 1); + myRectangle2->Fill = Brushes::Yellow; + myRectangle2->Width = 100; + myRectangle2->Height = 100; + // + + Canvas::SetTop(myRectangle3, 200); + Canvas::SetLeft(myRectangle3, 200); + Canvas::SetZIndex(myRectangle3, 2); + myRectangle3->Fill = Brushes::Green; + myRectangle3->Width = 100; + myRectangle3->Height = 100; + + Canvas::SetTop(myRectangle4, 300); + Canvas::SetLeft(myRectangle4, 200); + Canvas::SetZIndex(myRectangle4, 1); + myRectangle4->Fill = Brushes::Green; + myRectangle4->Width = 100; + myRectangle4->Height = 100; + + Canvas::SetTop(myRectangle5, 350); + Canvas::SetLeft(myRectangle5, 150); + Canvas::SetZIndex(myRectangle5, 3); + myRectangle5->Fill = Brushes::Yellow; + myRectangle5->Width = 100; + myRectangle5->Height = 100; + + Canvas::SetTop(myRectangle6, 400); + Canvas::SetLeft(myRectangle6, 100); + Canvas::SetZIndex(myRectangle6, 2); + myRectangle6->Fill = Brushes::Blue; + myRectangle6->Width = 100; + myRectangle6->Height = 100; + + // Add the Rectangles to the Canvas' Children collection + myCanvas->Children->Add(myRectangle1); + myCanvas->Children->Add(myRectangle2); + myCanvas->Children->Add(myRectangle3); + myCanvas->Children->Add(myRectangle4); + myCanvas->Children->Add(myRectangle5); + myCanvas->Children->Add(myRectangle6); + + // Add the Canvas as the Content of the parent Window Object + mainWindow->Content = myCanvas; + mainWindow->Show(); + + // + } + ; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj b/snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj new file mode 100644 index 00000000000..f19df028c49 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/CanvasZ-Order/CPP/canvasz-order.vcxproj @@ -0,0 +1,117 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp b/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp new file mode 100644 index 00000000000..22572e527cd --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/Program.cpp @@ -0,0 +1,345 @@ +//Program.cpp file +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Text; +using namespace System::Printing; +using namespace System::IO; + +namespace DiagnoseProblematicPrintJob { + + // + private ref class TimeConverter { + + internal: + static DateTime ConvertToLocalHumanReadableTime (Int32 timeInMinutesAfterUTCMidnight) + { + // Construct a UTC midnight object. + // Must start with current date so that the local Daylight Savings system, if any, will be taken into account. + DateTime utcNow = DateTime::UtcNow; + DateTime utcMidnight = DateTime(utcNow.Year, utcNow.Month, utcNow.Day, 0, 0, 0, DateTimeKind::Utc); + + // Add the minutes passed into the method in order to get the intended UTC time. + Double minutesAfterUTCMidnight = ((Double)timeInMinutesAfterUTCMidnight); + DateTime utcTime = utcMidnight.AddMinutes(minutesAfterUTCMidnight); + + // Convert to local time. + DateTime localTime = utcTime.ToLocalTime(); + + return localTime; + }; + }; + // + + private ref class TroubleSpotter { + + internal: + // + // Check for possible trouble states of a print job using its properties + static void SpotTroubleUsingProperties (PrintSystemJobInfo^ theJob) + { + if (theJob->IsBlocked) + { + Console::WriteLine("The job is blocked."); + } + if (theJob->IsCompleted || theJob->IsPrinted) + { + Console::WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked."); + } + if (theJob->IsDeleted || theJob->IsDeleting) + { + Console::WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted."); + } + if (theJob->IsInError) + { + Console::WriteLine("The job has errored."); + } + if (theJob->IsOffline) + { + Console::WriteLine("The printer is offline. Have user put it online with printer front panel."); + } + if (theJob->IsPaperOut) + { + Console::WriteLine("The printer is out of paper of the size required by the job. Have user add paper."); + } + + if (theJob->IsPaused || theJob->HostingPrintQueue->IsPaused) + { + HandlePausedJob(theJob); + //HandlePausedJob is defined in the complete example. + } + + if (theJob->IsPrinting) + { + Console::WriteLine("The job is printing now."); + } + if (theJob->IsSpooling) + { + Console::WriteLine("The job is spooling now."); + } + if (theJob->IsUserInterventionRequired) + { + Console::WriteLine("The printer needs human intervention."); + } + }; + // + + // + // Check for possible trouble states of a print job using the flags of the JobStatus property + static void SpotTroubleUsingJobAttributes (PrintSystemJobInfo^ theJob) + { + if ((theJob->JobStatus & PrintJobStatus::Blocked) == PrintJobStatus::Blocked) + { + Console::WriteLine("The job is blocked."); + } + if (((theJob->JobStatus & PrintJobStatus::Completed) == PrintJobStatus::Completed) + || + ((theJob->JobStatus & PrintJobStatus::Printed) == PrintJobStatus::Printed)) + { + Console::WriteLine("The job has finished. Have user recheck all output bins and be sure the correct printer is being checked."); + } + if (((theJob->JobStatus & PrintJobStatus::Deleted) == PrintJobStatus::Deleted) + || + ((theJob->JobStatus & PrintJobStatus::Deleting) == PrintJobStatus::Deleting)) + { + Console::WriteLine("The user or someone with administration rights to the queue has deleted the job. It must be resubmitted."); + } + if ((theJob->JobStatus & PrintJobStatus::Error) == PrintJobStatus::Error) + { + Console::WriteLine("The job has errored."); + } + if ((theJob->JobStatus & PrintJobStatus::Offline) == PrintJobStatus::Offline) + { + Console::WriteLine("The printer is offline. Have user put it online with printer front panel."); + } + if ((theJob->JobStatus & PrintJobStatus::PaperOut) == PrintJobStatus::PaperOut) + { + Console::WriteLine("The printer is out of paper of the size required by the job. Have user add paper."); + } + if (((theJob->JobStatus & PrintJobStatus::Paused) == PrintJobStatus::Paused) + || + ((theJob->HostingPrintQueue->QueueStatus & PrintQueueStatus::Paused) == PrintQueueStatus::Paused)) + { + HandlePausedJob(theJob); + //HandlePausedJob is defined in the complete example. + } + + if ((theJob->JobStatus & PrintJobStatus::Printing) == PrintJobStatus::Printing) + { + Console::WriteLine("The job is printing now."); + } + if ((theJob->JobStatus & PrintJobStatus::Spooling) == PrintJobStatus::Spooling) + { + Console::WriteLine("The job is spooling now."); + } + if ((theJob->JobStatus & PrintJobStatus::UserIntervention) == PrintJobStatus::UserIntervention) + { + Console::WriteLine("The printer needs human intervention."); + } + }; + // + + // + static void HandlePausedJob (PrintSystemJobInfo^ theJob) + { + // If there's no good reason for the queue to be paused, resume it and + // give user choice to resume or cancel the job. + Console::WriteLine("The user or someone with administrative rights to the queue" + "\nhas paused the job or queue." + "\nResume the queue? (Has no effect if queue is not paused.)" + "\nEnter \"Y\" to resume, otherwise press return: "); + String^ resume = Console::ReadLine(); + if (resume == "Y") + { + theJob->HostingPrintQueue->Resume(); + + // It is possible the job is also paused. Find out how the user wants to handle that. + Console::WriteLine("Does user want to resume print job or cancel it?" + "\nEnter \"Y\" to resume (any other key cancels the print job): "); + String^ userDecision = Console::ReadLine(); + if (userDecision == "Y") + { + theJob->Resume(); + } else + { + theJob->Cancel(); + } + } + }; + // + + // + static void ReportQueueAndJobAvailability (PrintSystemJobInfo^ theJob) + { + if (!(ReportAvailabilityAtThisTime(theJob->HostingPrintQueue) && ReportAvailabilityAtThisTime(theJob))) + { + if (!ReportAvailabilityAtThisTime(theJob->HostingPrintQueue)) + { + Console::WriteLine("\nThat queue is not available at this time of day." + "\nJobs in the queue will start printing again at {0}", TimeConverter::ConvertToLocalHumanReadableTime(theJob->HostingPrintQueue->StartTimeOfDay).ToShortTimeString()); + // TimeConverter class is defined in the complete sample + } + if (!ReportAvailabilityAtThisTime(theJob)) + { + Console::WriteLine("\nThat job is set to print only between {0} and {1}", TimeConverter::ConvertToLocalHumanReadableTime(theJob->StartTimeOfDay).ToShortTimeString(), TimeConverter::ConvertToLocalHumanReadableTime(theJob->UntilTimeOfDay).ToShortTimeString()); + } + Console::WriteLine("\nThe job will begin printing as soon as it reaches the top of the queue after:"); + if (theJob->StartTimeOfDay > theJob->HostingPrintQueue->StartTimeOfDay) + { + Console::WriteLine(TimeConverter::ConvertToLocalHumanReadableTime(theJob->StartTimeOfDay).ToShortTimeString()); + } else + { + Console::WriteLine(TimeConverter::ConvertToLocalHumanReadableTime(theJob->HostingPrintQueue->StartTimeOfDay).ToShortTimeString()); + } + + } + }; + // + + + // + static Boolean ReportAvailabilityAtThisTime (PrintQueue^ pq) + { + Boolean available = true; + if (pq->StartTimeOfDay != pq->UntilTimeOfDay) + { + DateTime utcNow = DateTime::UtcNow; + Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes; + + // If now is not within the range of available times . . . + if (!((pq->StartTimeOfDay < utcNowAsMinutesAfterMidnight) && (utcNowAsMinutesAfterMidnight < pq->UntilTimeOfDay))) + { + available = false; + } + } + return available; + }; + // + + + // + static Boolean ReportAvailabilityAtThisTime (PrintSystemJobInfo^ theJob) + { + Boolean available = true; + if (theJob->StartTimeOfDay != theJob->UntilTimeOfDay) + { + DateTime utcNow = DateTime::UtcNow; + Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes; + + // If "now" is not within the range of available times . . . + if (!((theJob->StartTimeOfDay < utcNowAsMinutesAfterMidnight) && (utcNowAsMinutesAfterMidnight < theJob->UntilTimeOfDay))) + { + available = false; + } + } + return available; + } + // + + }; + + + private ref class Program { + + public: + static void Main (array^ args) + { + // Obtain a list of print servers. + Console::Write("Enter path and file name of CRLF-delimited list of print servers" + "\n(press Return for default \"C:\\PrintServers.txt\"): "); + String^ pathToListOfPrintServers = Console::ReadLine(); + if (pathToListOfPrintServers == "") + { + pathToListOfPrintServers = "C:\\PrintServers.txt"; + } + StreamReader^ fileOfPrintServers = gcnew StreamReader(pathToListOfPrintServers); + + // Obtain the username of the person with the problematic print job. + Console::Write("\nEnter username of person that submitted print job" + "\n(press Return for the current user {0}: ", Environment::UserName); + String^ userName = Console::ReadLine(); + if (userName == "") + { + userName = Environment::UserName; + } + + // Prompt user to determine the method that will be used to read the queue status. + Console::Write("\nEnter \"Y\" to check the problematic job using its JobStatus attributes." + "\nOtherwise, press Return and the job will be checked using its specific properties: "); + String^ useAttributesResponse = Console::ReadLine(); + + // Create list of all jobs submitted by user. + String^ line; + Boolean atLeastOne = false; + String^ jobList = "\n\nAll print jobs submitted by the user are listed here:\n\n"; + while ((line = fileOfPrintServers->ReadLine()) != nullptr) + { + PrintServer^ myPS = gcnew PrintServer(line, PrintSystemDesiredAccess::AdministrateServer); + PrintQueueCollection^ myPrintQueues = myPS->GetPrintQueues(); + + // + for each (PrintQueue^ pq in myPrintQueues) + { + pq->Refresh(); + PrintJobInfoCollection^ jobs = pq->GetPrintJobInfoCollection(); + for each (PrintSystemJobInfo^ job in jobs) + { + // Since the user may not be able to articulate which job is problematic, + // present information about each job the user has submitted. + if (job->Submitter == userName) + { + atLeastOne = true; + jobList = jobList + "\nServer:" + line; + jobList = jobList + "\n\tQueue:" + pq->Name; + jobList = jobList + "\n\tLocation:" + pq->Location; + jobList = jobList + "\n\t\tJob: " + job->JobName + " ID: " + job->JobIdentifier; + } + } + } + // + } + + fileOfPrintServers->Close(); + + if (!atLeastOne) + { + jobList = "\n\nNo jobs submitted by " + userName + " were found.\n\n"; + Console::WriteLine(jobList); + } else + { + jobList = jobList + "\n\nIf multiple jobs are listed, use the information provided" + " above and by the user to identify the job needing diagnosis.\n\n"; + Console::WriteLine(jobList); + // + // When the problematic print job has been identified, enter information about it. + Console::Write("\nEnter the print server hosting the job (including leading slashes \\\\): " + "\n(press Return for the current computer \\\\{0}): ", Environment::MachineName); + String^ pServer = Console::ReadLine(); + if (pServer == "") + { + pServer = "\\\\" + Environment::MachineName; + } + Console::Write("\nEnter the print queue hosting the job: "); + String^ pQueue = Console::ReadLine(); + Console::Write("\nEnter the job ID: "); + Int16 jobID = Convert::ToInt16(Console::ReadLine()); + + // Create objects to represent the server, queue, and print job. + PrintServer^ hostingServer = gcnew PrintServer(pServer, PrintSystemDesiredAccess::AdministrateServer); + PrintQueue^ hostingQueue = gcnew PrintQueue(hostingServer, pQueue, PrintSystemDesiredAccess::AdministratePrinter); + PrintSystemJobInfo^ theJob = hostingQueue->GetJob(jobID); + + if (useAttributesResponse == "Y") + { + TroubleSpotter::SpotTroubleUsingJobAttributes(theJob); + // TroubleSpotter class is defined in the complete example. + } else + { + TroubleSpotter::SpotTroubleUsingProperties(theJob); + } + + TroubleSpotter::ReportQueueAndJobAvailability(theJob); + // + } + Console::WriteLine("\nPress Return to end."); + Console::ReadLine(); + }; + }; + +} + +//Entry Point: +int main (array^ args) +{ + DiagnoseProblematicPrintJob::Program::Main(args); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj b/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj new file mode 100644 index 00000000000..d3327709232 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/DiagnoseProblematicPrintJob/CPP/diagnoseproblematicprintjob.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21208.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Console + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp b/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp new file mode 100644 index 00000000000..8979de0de51 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/DockPanel_Ovw_Sample.cpp @@ -0,0 +1,123 @@ +//DockPanel_Ovw_Sample.cpp file + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Shapes; +using namespace System::Threading; + +namespace SDKSample { + + public ref class app : Application { + + private: + Window^ mainWindow; + + protected: + virtual void OnStartup (StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // + + // Create the application's main window + mainWindow = gcnew Window(); + mainWindow->Title = "DockPanel Sample"; + + // Create the DockPanel + DockPanel^ myDockPanel = gcnew DockPanel(); + myDockPanel->LastChildFill = true; + + // Define the child content + Border^ myBorder1 = gcnew Border(); + myBorder1->Height = 25; + myBorder1->Background = Brushes::SkyBlue; + myBorder1->BorderBrush = Brushes::Black; + myBorder1->BorderThickness = Thickness(1); + DockPanel::SetDock(myBorder1, Dock::Top); + TextBlock^ myTextBlock1 = gcnew TextBlock(); + myTextBlock1->Foreground = Brushes::Black; + myTextBlock1->Text = "Dock = Top"; + myBorder1->Child = myTextBlock1; + + Border^ myBorder2 = gcnew Border(); + myBorder2->Height = 25; + myBorder2->Background = Brushes::SkyBlue; + myBorder2->BorderBrush = Brushes::Black; + myBorder2->BorderThickness = Thickness(1); + DockPanel::SetDock(myBorder2, Dock::Top); + TextBlock^ myTextBlock2 = gcnew TextBlock(); + myTextBlock2->Foreground = Brushes::Black; + myTextBlock2->Text = "Dock = Top"; + myBorder2->Child = myTextBlock2; + + Border^ myBorder3 = gcnew Border(); + myBorder3->Height = 25; + myBorder3->Background = Brushes::LemonChiffon; + myBorder3->BorderBrush = Brushes::Black; + myBorder3->BorderThickness = Thickness(1); + DockPanel::SetDock(myBorder3, Dock::Bottom); + TextBlock^ myTextBlock3 = gcnew TextBlock(); + myTextBlock3->Foreground = Brushes::Black; + myTextBlock3->Text = "Dock = Bottom"; + myBorder3->Child = myTextBlock3; + + Border^ myBorder4 = gcnew Border(); + myBorder4->Width = 200; + myBorder4->Background = Brushes::PaleGreen; + myBorder4->BorderBrush = Brushes::Black; + myBorder4->BorderThickness = Thickness(1); + DockPanel::SetDock(myBorder4, Dock::Left); + TextBlock^ myTextBlock4 = gcnew TextBlock(); + myTextBlock4->Foreground = Brushes::Black; + myTextBlock4->Text = "Dock = Left"; + myBorder4->Child = myTextBlock4; + + Border^ myBorder5 = gcnew Border(); + myBorder5->Background = Brushes::White; + myBorder5->BorderBrush = Brushes::Black; + myBorder5->BorderThickness = Thickness(1); + TextBlock^ myTextBlock5 = gcnew TextBlock(); + myTextBlock5->Foreground = Brushes::Black; + myTextBlock5->Text = "This content will Fill the remaining space"; + myBorder5->Child = myTextBlock5; + + // Add child elements to the DockPanel Children collection + myDockPanel->Children->Add(myBorder1); + myDockPanel->Children->Add(myBorder2); + myDockPanel->Children->Add(myBorder3); + myDockPanel->Children->Add(myBorder4); + myDockPanel->Children->Add(myBorder5); + + // Add the parent Canvas as the Content of the Window Object + mainWindow->Content = myDockPanel; + mainWindow->Show(); + + // + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj b/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj new file mode 100644 index 00000000000..9f1e7fd1db0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/DockPanelOvwSample/CPP/dockpanel_ovw_sample.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp b/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp new file mode 100644 index 00000000000..f559468cac9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/Program.cpp @@ -0,0 +1,44 @@ +//Program.cpp file + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::Text; +using namespace System::Printing; +using namespace System::Collections; + +namespace EnumerateSubsetOfPrintQueues { + + private ref class Program { + + public: + static void Main (array^ args) + { + // + // Specify that the list will contain only the print queues that are installed as local and are shared + array^ enumerationFlags = {EnumeratedPrintQueueTypes::Local,EnumeratedPrintQueueTypes::Shared}; + + LocalPrintServer^ printServer = gcnew LocalPrintServer(); + + //Use the enumerationFlags to filter out unwanted print queues + PrintQueueCollection^ printQueuesOnLocalServer = printServer->GetPrintQueues(enumerationFlags); + + Console::WriteLine("These are your shared, local print queues:\n\n"); + + for each (PrintQueue^ printer in printQueuesOnLocalServer) + { + Console::WriteLine("\tThe shared printer " + printer->Name + " is located at " + printer->Location + "\n"); + } + Console::WriteLine("Press enter to continue."); + Console::ReadLine(); + // + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +int main (array^ args) +{ + EnumerateSubsetOfPrintQueues::Program::Main(args); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj b/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj new file mode 100644 index 00000000000..4c1138eccdf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/EnumerateSubsetOfPrintQueues/CPP/enumeratesubsetofprintqueues.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21208.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Console + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp new file mode 100644 index 00000000000..4c510d2b162 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/GifEncoderDecoder.cpp @@ -0,0 +1,133 @@ +//GifEncoderDecoder.cpp file + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; +using namespace System::Security; + + +namespace SDKSample { + + public ref class app : Application { + + private: System::Windows::Window^ mainWindow; + + protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + + private: + [SecuritySafeCritical] + void CreateAndShowMainWindow () + { + // Create the application's main window + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "GIF Imaging Sample"; + ScrollViewer^ mySV = gcnew ScrollViewer(); + + // + int width = 128; + int height = width; + int stride = width / 8; + array^ pixels = gcnew array(height * stride); + + // Define the image palette + + BitmapPalette^ myPalette = BitmapPalettes::WebPalette; + + // Creates a new empty image with the pre-defined palette + + // + BitmapSource^ image = BitmapSource::Create( + width, + height, + 96, + 96, + PixelFormats::Indexed1, + myPalette, + pixels, + stride); + // + + // + FileStream^ stream = gcnew FileStream("new.gif", FileMode::Create); + GifBitmapEncoder^ encoder = gcnew GifBitmapEncoder(); + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); + encoder->Frames->Add(BitmapFrame::Create(image)); + encoder->Save(stream); + // + + // + + // + + // Open a Stream and decode a GIF image + Stream^ imageStreamSource = gcnew FileStream("tulipfarm.gif", FileMode::Open, FileAccess::Read, FileShare::Read); + GifBitmapDecoder^ decoder = gcnew GifBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource = decoder->Frames[0]; + + // Draw the Image + Image^ myImage = gcnew Image(); + myImage->Source = bitmapSource; + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + // + + // + + // Open a Uri and decode a GIF image + System::Uri^ myUri = gcnew System::Uri("tulipfarm.gif", UriKind::RelativeOrAbsolute); + GifBitmapDecoder^ decoder2 = gcnew GifBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource2 = decoder2->Frames[0]; + + // Draw the Image + Image^ myImage2 = gcnew Image(); + myImage2->Source = bitmapSource2; + myImage2->Stretch = Stretch::None; + myImage2->Margin = System::Windows::Thickness(20); + // + + // Define a StackPanel to host the decoded GIF images + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; + + // Add the Image and TextBlock to the parent Grid + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myImage2); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the Content of the Parent Window Object + mySV->Content = myStackPanel; + mainWindow->Content = mySV; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj new file mode 100644 index 00000000000..88bb5889077 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/gifencoderdecoder.vcxproj @@ -0,0 +1,126 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/tulipfarm.gif b/snippets/cpp/VS_Snippets_Wpf/GifBitmapDecoderEncoder/CPP/tulipfarm.gif new file mode 100644 index 0000000000000000000000000000000000000000..def1be66323b9726d602e12fa0559cea5b548972 GIT binary patch literal 170770 zcmeFYhgTEL`#zjbXdzTXPv`;EL=ZzY2|b{Oh=4&bND(O#KoJ2kl`bFx0-^?#Dr%&O ziV%u)FenQ42uc$b6%`SAUOwM{;~VLSZl{JRF5bp{y|&B>exdnFilX#^B)?Yd98z!D6sjJPM27Ja57p z4+r3p@c#jW#A7gc3?7e1;jK}4GS(V{w8m`aKw0Cl*7!}s+8R%`CZnv$*4E@rgJw;! zCIbLu0Gx~jkda6-216#J$Yd;;f~5f96eN;@K~XSR3dWj(M^W%t3f`JR##6{N3YkvX z%tOIbC}awSMxkup22*J96gv5TCOw#jMAFC@8W~Tc;Au2GjZUM{Aq@ThoYE;YI)zTBVd*q$Ivr1^lj-zeIz5LTOy2bRKQlO<9-K@M z&Y?%<1jFIMaAY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MKJ zbL-lUqtmjB`fM^t9%1%Ex<}~`;upyXEA?5dq@#Ueq|DNfGwXhS*L#m}tUwBsS`SUc z^6}R6D6)`#c} zlNo_$dFQM+)C$Hgcb?>x{T+shMA-jZ#uYnFF8IrSFH%Mwhuha~Muof!-+{94Cc(aP v?$N=BzBS%F;?L~`3n;p*-6e(SscJ>IWU7+SbTitle = "JPEG Imaging Sample"; + System::Windows::Controls::ScrollViewer^ mySV = gcnew System::Windows::Controls::ScrollViewer(); + + // + int width = 128; + int height = width; + int stride = width / 8; + array^ pixels = gcnew array(height * stride); + + // Define the image palette + BitmapPalette^ myPalette = BitmapPalettes::Halftone256; + + // Creates a new empty image with the pre-defined palette. + // + BitmapSource^ image = BitmapSource::Create( + width, height, + 96, 96, + PixelFormats::Indexed1, + myPalette, + pixels, + stride); + // + // + + System::IO::FileStream^ stream = gcnew System::IO::FileStream("new.jpg", FileMode::Create); + JpegBitmapEncoder^ encoder = gcnew JpegBitmapEncoder(); + TextBlock^ myTextBlock = gcnew System::Windows::Controls::TextBlock(); + myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); + encoder->FlipHorizontal = true; + encoder->FlipVertical = false; + encoder->QualityLevel = 30; + encoder->Rotation = Rotation::Rotate90; + encoder->Frames->Add(BitmapFrame::Create(image)); + encoder->Save(stream); + // + // + + // + // Open a Stream and decode a JPEG image + Stream^ imageStreamSource = gcnew FileStream("tulipfarm.jpg", FileMode::Open, FileAccess::Read, FileShare::Read); + JpegBitmapDecoder^ decoder = gcnew JpegBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource = decoder->Frames[0]; + + // Draw the Image + Image^ myImage = gcnew Image(); + myImage->Source = bitmapSource; + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + // + + // + // Open a Uri and decode a JPEG image + System::Uri^ myUri = gcnew System::Uri("tulipfarm.jpg", UriKind::RelativeOrAbsolute); + JpegBitmapDecoder^ decoder2 = gcnew JpegBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource2 = decoder2->Frames[0]; + + // Draw the Image + Image^ myImage2 = gcnew Image(); + myImage2->Source = bitmapSource2; + myImage2->Stretch = Stretch::None; + myImage2->Margin = System::Windows::Thickness(20); + // + + // Define a StackPanel to host the decoded JPEG images + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; + + // Add the Image and TextBlock to the parent Grid. + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myImage2); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the content of the parent window. + mySV->Content = myStackPanel; + mainWindow->Content = mySV; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThreadAttribute()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + } + ; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +int main(array ^args) +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj new file mode 100644 index 00000000000..f5748c97859 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/jpegencoderdecoder.vcxproj @@ -0,0 +1,129 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {6EFA9BEA-6237-4CCC-BFD8-87EB6499E919} + SDKSample + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/tulipfarm.jpg b/snippets/cpp/VS_Snippets_Wpf/JpegBitmapDecoderEncoder/CPP/tulipfarm.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2ce60cad09155366d0c4ef18b9e01dedd61a1cb8 GIT binary patch literal 110238 zcma&N1z1#F_cnfJh8()PhZK=iK#)#}p;JIYN{~+J9y$e-7;nx>vWg4- zv!^uv`wF2__>hCjzt6e2!2A&(v=R>azjkt2hZ<@_dH{T=q>}g5i-&|W59&k+h=@b< zVu1GWe|rBjIH6ubF+7P+i9tq3&}QJm9P$IS4LF1z_Pz%Wy3bCuWaWQa`IpI@$itzS z$hZoCFUSV^Uk%{N#th-}pdZJy|JU^X|NOug!I!@<4c2YQY}>a_^KU<`(?TMMH(DLx z^kR?HLH7{^Og;wBm&uwFWw4=ljZ_o8yR~!td(R)VAma+{e;kJgNiLKG z`}njpfqe<1$feka|Q zUL$!{S`P?FuRu%dA&*!u2E1^hH@VLr)$# z(LwYlT#)RKN1-s__er*Yng3^&EPosIrw3b*IC!gi^S}uG>~qwAO$VYdt}yv8_Tcp4 zs#yY^J)YE1Ltkt-W+xn;(hgvDA|U_!atIkC?Qj2G*0lr-kNR-`X-K)&!?{Ue4B2!S z+#|Im{SQzVc9Q#}GU#DRrWcb{if0#LzhFEeF@Ym~0ybAf_&3^r9PvArDF0(00Wpl- z@Mx$)OBf3F^VhIM2JOYSQ!HL;mGQJP<&30S}15JU}D+cLN1&eI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@J6 VpZH=N=;(b8{{ZTitle = "LayoutTransform Sample"; + + // Create the Grid + grid1 = gcnew Grid(); + grid1->HorizontalAlignment = HorizontalAlignment::Left; + grid1->VerticalAlignment = VerticalAlignment::Top; + grid1->ShowGridLines = true; + + // Define the Columns + colDef1 = gcnew ColumnDefinition(); + colDef1->Width = GridLength::Auto; + colDef2 = gcnew ColumnDefinition(); + colDef2->Width = GridLength::Auto; + grid1->ColumnDefinitions->Add(colDef1); + grid1->ColumnDefinitions->Add(colDef2); + + // Define the Rows + rowDef1 = gcnew RowDefinition(); + rowDef1->Height = GridLength::Auto; + rowDef2 = gcnew RowDefinition(); + rowDef2->Height = GridLength::Auto; + rowDef3 = gcnew RowDefinition(); + rowDef3->Height = GridLength::Auto; + rowDef4 = gcnew RowDefinition(); + rowDef4->Height = GridLength::Auto; + rowDef5 = gcnew RowDefinition(); + rowDef5->Height = GridLength::Auto; + rowDef6 = gcnew RowDefinition(); + rowDef6->Height = GridLength::Auto; + grid1->RowDefinitions->Add(rowDef1); + grid1->RowDefinitions->Add(rowDef2); + grid1->RowDefinitions->Add(rowDef3); + grid1->RowDefinitions->Add(rowDef4); + grid1->RowDefinitions->Add(rowDef5); + grid1->RowDefinitions->Add(rowDef6); + + // RotateTransform Sample + Button^ btn1 = gcnew Button(); + btn1->Background = Brushes::LightCoral; + btn1->Content = "No Transform Applied"; + Grid::SetRow(btn1, 0); + Grid::SetColumn(btn1, 0); + grid1->Children->Add(btn1); + + // + + Button^ btn2 = gcnew Button(); + btn2->Background = Brushes::LightCoral; + btn2->Content = "RotateTransform"; + btn2->LayoutTransform = gcnew RotateTransform(45, 25, 25); + Grid::SetRow(btn2, 0); + Grid::SetColumn(btn2, 1); + grid1->Children->Add(btn2); + + // + + // SkewTransform Sample + Button^ btn3 = gcnew Button(); + btn3->Background = Brushes::LightCyan; + btn3->Content = "No Transform Applied"; + Grid::SetRow(btn3, 1); + Grid::SetColumn(btn3, 0); + grid1->Children->Add(btn3); + + Button^ btn4 = gcnew Button(); + btn4->Background = Brushes::LightCyan; + btn4->Content = "SkewTransform"; + btn4->LayoutTransform = gcnew SkewTransform(45, 0, 0, 0); + Grid::SetRow(btn4, 1); + Grid::SetColumn(btn4, 1); + grid1->Children->Add(btn4); + + // ScaleTransform Sample + Button^ btn5 = gcnew Button(); + btn5->Background = Brushes::LightSlateGray; + btn5->Content = "No Transform Applied"; + Grid::SetRow(btn5, 2); + Grid::SetColumn(btn5, 0); + grid1->Children->Add(btn5); + + Button^ btn6 = gcnew Button(); + btn6->Background = Brushes::LightSlateGray; + btn6->Content = "ScaleTransform"; + btn6->LayoutTransform = gcnew ScaleTransform(2, 2, 25, 25); + Grid::SetRow(btn6, 2); + Grid::SetColumn(btn6, 1); + grid1->Children->Add(btn6); + + // TranslateTransform : RenderTransform Sample + Button^ btn7 = gcnew Button(); + btn7->Background = Brushes::LightSeaGreen; + btn7->Content = "No Transform Applied"; + Grid::SetRow(btn7, 3); + Grid::SetColumn(btn7, 0); + grid1->Children->Add(btn7); + + Button^ btn8 = gcnew Button(); + btn8->Background = Brushes::LightSeaGreen; + btn8->Content = "TranslateTransform: RenderTransform"; + btn8->RenderTransform = gcnew TranslateTransform(100, 200); + Grid::SetRow(btn8, 3); + Grid::SetColumn(btn8, 1); + grid1->Children->Add(btn8); + + // TranslateTransform : LayoutTransform Sample + Button^ btn9 = gcnew Button(); + btn9->Background = Brushes::LightBlue; + btn9->Content = "No Transform Applied"; + Grid::SetRow(btn9, 4); + Grid::SetColumn(btn9, 0); + grid1->Children->Add(btn9); + + Button^ btn10 = gcnew Button(); + btn10->Background = Brushes::LightBlue; + btn10->Content = "TranslateTransform: LayoutTransform"; + btn10->LayoutTransform = gcnew TranslateTransform(100, 200); + Grid::SetRow(btn10, 4); + Grid::SetColumn(btn10, 1); + grid1->Children->Add(btn10); + + // MatrixTransform Sample + Button^ btn11 = gcnew Button(); + btn11->Background = Brushes::LightGoldenrodYellow; + btn11->Content = "No Transform Applied"; + Grid::SetRow(btn11, 5); + Grid::SetColumn(btn11, 0); + grid1->Children->Add(btn11); + + Button^ btn12 = gcnew Button(); + btn12->Background = Brushes::LightGoldenrodYellow; + btn12->Content = "MatrixTransform"; + btn12->LayoutTransform = gcnew MatrixTransform(1, 3, 3, 3, 3, 3); + Grid::SetRow(btn12, 5); + Grid::SetColumn(btn12, 1); + grid1->Children->Add(btn12); + + mainWindow->Content = grid1; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + LayoutTransformCode::app^ app = gcnew LayoutTransformCode::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return LayoutTransformCode::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj b/snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj new file mode 100644 index 00000000000..7f326917b68 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/LayoutTransform/CPP/layouttransform.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp b/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp new file mode 100644 index 00000000000..2e77a263adb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/Margin_Padding_Alignment_Sample.cpp @@ -0,0 +1,220 @@ +//Margin_Padding_Alignment_Sample.cpp file +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Shapes; +using namespace System::Threading; + +namespace Margin_Padding_Alignment_Sample { + + public ref class app : Application { + + private: + Border^ myBorder; + Grid^ myGrid; + Window^ mainWindow; + + protected: + virtual void OnStartup (StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // + mainWindow = gcnew Window(); + + // + myBorder = gcnew Border(); + myBorder->Background = Brushes::LightBlue; + myBorder->BorderBrush = Brushes::Black; + myBorder->BorderThickness = Thickness(2); + myBorder->CornerRadius = CornerRadius(45); + myBorder->Padding = Thickness(25); + // + + // Define the Grid. + myGrid = gcnew Grid(); + myGrid->Background = Brushes::White; + myGrid->ShowGridLines = true; + + // Define the Columns. + ColumnDefinition^ myColDef1 = gcnew ColumnDefinition(); + myColDef1->Width = GridLength(1, GridUnitType::Auto); + ColumnDefinition^ myColDef2 = gcnew ColumnDefinition(); + myColDef2->Width = GridLength(1, GridUnitType::Star); + ColumnDefinition^ myColDef3 = gcnew ColumnDefinition(); + myColDef3->Width = GridLength(1, GridUnitType::Auto); + + // Add the ColumnDefinitions to the Grid. + myGrid->ColumnDefinitions->Add(myColDef1); + myGrid->ColumnDefinitions->Add(myColDef2); + myGrid->ColumnDefinitions->Add(myColDef3); + + // Add the first child StackPanel. + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->HorizontalAlignment = HorizontalAlignment::Left; + myStackPanel->VerticalAlignment = VerticalAlignment::Top; + Grid::SetColumn(myStackPanel, 0); + Grid::SetRow(myStackPanel, 0); + TextBlock^ myTextBlock1 = gcnew TextBlock(); + myTextBlock1->FontSize = 18; + myTextBlock1->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock1->Margin = Thickness(0, 0, 0, 15); + myTextBlock1->Text = "StackPanel 1"; + // + Button^ myButton1 = gcnew Button(); + myButton1->Margin = Thickness(0, 10, 0, 10); + myButton1->Content = "Button 1"; + Button^ myButton2 = gcnew Button(); + myButton2->Margin = Thickness(0, 10, 0, 10); + myButton2->Content = "Button 2"; + Button^ myButton3 = gcnew Button(); + myButton3->Margin = Thickness(0, 10, 0, 10); + // + TextBlock^ myTextBlock2 = gcnew TextBlock(); + myTextBlock2->Text = "ColumnDefinition.Width = \"Auto\""; + TextBlock^ myTextBlock3 = gcnew TextBlock(); + myTextBlock3->Text = "StackPanel.HorizontalAlignment = \"Left\""; + TextBlock^ myTextBlock4 = gcnew TextBlock(); + myTextBlock4->Text = "StackPanel.VerticalAlignment = \"Top\""; + TextBlock^ myTextBlock5 = gcnew TextBlock(); + myTextBlock5->Text = "StackPanel.Orientation = \"Vertical\""; + TextBlock^ myTextBlock6 = gcnew TextBlock(); + myTextBlock6->Text = "Button.Margin = \"1,10,0,10\""; + myStackPanel->Children->Add(myTextBlock1); + myStackPanel->Children->Add(myButton1); + myStackPanel->Children->Add(myButton2); + myStackPanel->Children->Add(myButton3); + myStackPanel->Children->Add(myTextBlock2); + myStackPanel->Children->Add(myTextBlock3); + myStackPanel->Children->Add(myTextBlock4); + myStackPanel->Children->Add(myTextBlock5); + myStackPanel->Children->Add(myTextBlock6); + + // Add the second child StackPanel. + StackPanel^ myStackPanel2 = gcnew StackPanel(); + myStackPanel2->HorizontalAlignment = HorizontalAlignment::Stretch; + myStackPanel2->VerticalAlignment = VerticalAlignment::Top; + myStackPanel2->Orientation = Orientation::Vertical; + Grid::SetColumn(myStackPanel2, 1); + Grid::SetRow(myStackPanel2, 0); + TextBlock^ myTextBlock7 = gcnew TextBlock(); + myTextBlock7->FontSize = 18; + myTextBlock7->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock7->Margin = Thickness(0, 0, 0, 15); + myTextBlock7->Text = "StackPanel 2"; + Button^ myButton4 = gcnew Button(); + myButton4->Margin = Thickness(10, 0, 10, 0); + myButton4->Content = "Button 4"; + Button^ myButton5 = gcnew Button(); + myButton5->Margin = Thickness(10, 0, 10, 0); + myButton5->Content = "Button 5"; + Button^ myButton6 = gcnew Button(); + myButton6->Margin = Thickness(10, 0, 10, 0); + myButton6->Content = "Button 6"; + TextBlock^ myTextBlock8 = gcnew TextBlock(); + myTextBlock8->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock8->Text = "ColumnDefinition.Width = \"*\""; + TextBlock^ myTextBlock9 = gcnew TextBlock(); + myTextBlock9->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock9->Text = "StackPanel.HorizontalAlignment = \"Stretch\""; + TextBlock^ myTextBlock10 = gcnew TextBlock(); + myTextBlock10->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock10->Text = "StackPanel.VerticalAlignment = \"Top\""; + TextBlock^ myTextBlock11 = gcnew TextBlock(); + myTextBlock11->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock11->Text = "StackPanel.Orientation = \"Horizontal\""; + TextBlock^ myTextBlock12 = gcnew TextBlock(); + myTextBlock12->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock12->Text = "Button.Margin = \"10,0,10,0\""; + myStackPanel2->Children->Add(myTextBlock7); + myStackPanel2->Children->Add(myButton4); + myStackPanel2->Children->Add(myButton5); + myStackPanel2->Children->Add(myButton6); + myStackPanel2->Children->Add(myTextBlock8); + myStackPanel2->Children->Add(myTextBlock9); + myStackPanel2->Children->Add(myTextBlock10); + myStackPanel2->Children->Add(myTextBlock11); + myStackPanel2->Children->Add(myTextBlock12); + + // Add the final child StackPanel. + StackPanel^ myStackPanel3 = gcnew StackPanel(); + myStackPanel3->HorizontalAlignment = HorizontalAlignment::Left; + myStackPanel3->VerticalAlignment = VerticalAlignment::Top; + Grid::SetColumn(myStackPanel3, 2); + Grid::SetRow(myStackPanel3, 0); + TextBlock^ myTextBlock13 = gcnew TextBlock(); + myTextBlock13->FontSize = 18; + myTextBlock13->HorizontalAlignment = HorizontalAlignment::Center; + myTextBlock13->Margin = Thickness(0, 0, 0, 15); + myTextBlock13->Text = "StackPanel 3"; + // + Button^ myButton7 = gcnew Button(); + myButton7->Margin = Thickness(10); + myButton7->Content = "Button 7"; + Button^ myButton8 = gcnew Button(); + myButton8->Margin = Thickness(10); + myButton8->Content = "Button 8"; + Button^ myButton9 = gcnew Button(); + myButton9->Margin = Thickness(10); + myButton9->Content = "Button 9"; + // + TextBlock^ myTextBlock14 = gcnew TextBlock(); + myTextBlock14->Text = "ColumnDefinition.Width = \"Auto\""; + TextBlock^ myTextBlock15 = gcnew TextBlock(); + myTextBlock15->Text = "StackPanel.HorizontalAlignment = \"Left\""; + TextBlock^ myTextBlock16 = gcnew TextBlock(); + myTextBlock16->Text = "StackPanel.VerticalAlignment = \"Top\""; + TextBlock^ myTextBlock17 = gcnew TextBlock(); + myTextBlock17->Text = "StackPanel.Orientation = \"Vertical\""; + TextBlock^ myTextBlock18 = gcnew TextBlock(); + myTextBlock18->Text = "Button.Margin = \"10\""; + myStackPanel3->Children->Add(myTextBlock13); + myStackPanel3->Children->Add(myButton7); + myStackPanel3->Children->Add(myButton8); + myStackPanel3->Children->Add(myButton9); + myStackPanel3->Children->Add(myTextBlock14); + myStackPanel3->Children->Add(myTextBlock15); + myStackPanel3->Children->Add(myTextBlock16); + myStackPanel3->Children->Add(myTextBlock17); + myStackPanel3->Children->Add(myTextBlock18); + + // Add child content to the parent Grid. + myGrid->Children->Add(myStackPanel); + myGrid->Children->Add(myStackPanel2); + myGrid->Children->Add(myStackPanel3); + + // Add the Grid as the lone child of the Border. + myBorder->Child = myGrid; + + // Add the Border to the Window as Content and show the Window. + mainWindow->Content = myBorder; + mainWindow->Title = "Margin, Padding, and Alignment Sample"; + mainWindow->Show(); + // + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + Margin_Padding_Alignment_Sample::app^ app = gcnew Margin_Padding_Alignment_Sample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return Margin_Padding_Alignment_Sample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj b/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj new file mode 100644 index 00000000000..c7ea1dd1168 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/MarginPaddingAlignmentSample/CPP/margin_padding_alignment_sample.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21230.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp b/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp new file mode 100644 index 00000000000..c9a76836322 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/PlotPanel.cpp @@ -0,0 +1,101 @@ +//PlotPanel.cpp file +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Shapes; +using namespace System::Windows::Media; +using namespace System::Threading; + +namespace PlotPanel { + + public ref class app : System::Windows::Application { + + // + public: + ref class PlotPanel : Panel { + + public: + PlotPanel () {}; + + protected: + // Override the default Measure method of Panel + // + virtual Size MeasureOverride(Size availableSize) override + { + Size^ panelDesiredSize = gcnew Size(); + + // In our example, we just have one child. + // Report that our panel requires just the size of its only child. + for each (UIElement^ child in InternalChildren) + { + child->Measure(availableSize); + panelDesiredSize = child->DesiredSize; + } + return *panelDesiredSize ; + } + // + + protected: + virtual System::Windows::Size ArrangeOverride (Size finalSize) override + { + for each (UIElement^ child in InternalChildren) + { + double x = 50; + double y = 50; + child->Arrange(Rect(Point(x, y), child->DesiredSize)); + } + return finalSize; + }; + }; + // + + private: + PlotPanel^ plot1; + Window^ mainWindow; + Shapes::Rectangle^ rect1; + + protected: + virtual void OnStartup (StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // Create the application's main window + + mainWindow = gcnew Window(); + plot1 = gcnew PlotPanel(); + plot1->Background = Brushes::White; + + rect1 = gcnew Shapes::Rectangle(); + rect1->Fill = Brushes::CornflowerBlue; + rect1->Width = 200; + rect1->Height = 200; + mainWindow->Content = plot1; + plot1->Children->Add(rect1); + mainWindow->Title = "Custom Panel Sample"; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + PlotPanel::app^ app = gcnew PlotPanel::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return PlotPanel::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj b/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj new file mode 100644 index 00000000000..4c075c21996 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/PlotPanel/CPP/plotpanel.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp new file mode 100644 index 00000000000..31e7053f823 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/PngEncoderDecoder.cpp @@ -0,0 +1,130 @@ +//PngEncoderDecoder.cpp file + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; +using namespace System::Security; + + +namespace SDKSample { + + public ref class app : Application { + + private: Window^ mainWindow; + + protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: void CreateAndShowMainWindow () + { + + // Create the application's main window + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "PNG Imaging Sample"; + ScrollViewer^ mySV = gcnew ScrollViewer(); + + // + int width = 128; + int height = 128; + int stride = width; + array^ pixels = gcnew array(height * stride); + + // Define the image palette + BitmapPalette^ myPalette = BitmapPalettes::Halftone256; + + // Creates a new empty image with the pre-defined palette + + // + BitmapSource^ image = BitmapSource::Create(width, + height, + 96, + 96, + PixelFormats::Indexed8, + myPalette, + pixels, + stride); + // + + // + FileStream^ stream = gcnew FileStream("new.png", FileMode::Create); + PngBitmapEncoder^ encoder = gcnew PngBitmapEncoder(); + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); + encoder->Interlace = PngInterlaceOption::On; + encoder->Frames->Add(BitmapFrame::Create(image)); + encoder->Save(stream); + // + + // + + // + + // Open a Stream and decode a PNG image + Stream^ imageStreamSource = gcnew FileStream("smiley.png", FileMode::Open, FileAccess::Read, FileShare::Read); + PngBitmapDecoder^ decoder = gcnew PngBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource = decoder->Frames[0]; + + // Draw the Image + Image^ myImage = gcnew Image(); + myImage->Source = bitmapSource; + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + // + + // + + // Open a Uri and decode a PNG image + System::Uri^ myUri = gcnew System::Uri("smiley.png", UriKind::RelativeOrAbsolute); + PngBitmapDecoder^ decoder2 = gcnew PngBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource2 = decoder2->Frames[0]; + + // Draw the Image + Image^ myImage2 = gcnew Image(); + myImage2->Source = bitmapSource2; + myImage2->Stretch = Stretch::None; + myImage2->Margin = System::Windows::Thickness(20); + // + + // Define a StackPanel to host the decoded PNG images + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; + + // Add the Image and TextBlock to the parent Grid + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myImage2); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the Content of the Parent Window Object + mySV->Content = myStackPanel; + mainWindow->Content = mySV; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj new file mode 100644 index 00000000000..160ee1fcda5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/pngencoderdecoder.vcxproj @@ -0,0 +1,126 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/smiley.png b/snippets/cpp/VS_Snippets_Wpf/PngBitmapDecoderEncoder/CPP/smiley.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0b9496cad2e2133d1edb7c4d3511a059772473 GIT binary patch literal 4599 zcmV002t}1^@s6I8J)%00009a7bBm000id z000id0mpBsWB>pWsYygZRCt{2oOxW7<=V%uXBpHo1RX#YK~zLgGt*F!7JEHzWu)es zrJnHEDLa|_LDS=sp^1WmqPdWWiKw83iHSQXF8GKn;g}nOAcDipGus2q@BA@hnj13= zLht+j@%u;l-1l{T@9Vywd%3Qmy+^KULSl2I(Cu}v6>+&zSbUxozVni_A}&`7*_tUW z+MFTHU!N|`k2)#MjZBs1M4Y&T{IzM){B`NlqRr=|kgb_g==L0G)h>k;7M~}r zh|7I0c7MAiTZ%h);~XuG&5`zH-auwSK7^arS7u=WvWtt5U0j5dic9$A%o+T!{{a3I zxgMh?Pea#!BjNR`AAEh+g9vly5*92VY}{y4R21Qx zZ%qFl6hs&_fY8H_;O#|d>Bys7*BHe@Aq53_kw&Q?zdF3wL)y|New8z94MfN;r3p zP+Cd=YOb;}LQW20+cv`V>4bj$2wq+U4-Zd_9Qg^>t=oXy+*}xqMrbq|>-Zy<!1#RI2;-)jKSuQVFeA3%y>4xVRnY*Ka87?d>sO0Ab4( z!j&u51@t7{xWVAZ9|<3PKxo$NCA|IiyNHR2g-WG@UayBzsk8{1RblD%dSqo~VcfXC zqeTlBy!j?!&mO|<+st!;^ypM&kd#CiGKA2)xdTRy{0L{yo`u0+fLg7tA6P1t3RRYofB+UQ zF0JtM&q+|L)ljKa)`g`~sUV6XcJ53-n>Otc5J0$eiK}<#Ez$MsgrP$T_Vx~ljg5sU zicbY*HY`&_{R&Udb{IU^)M0%)T^lKtgb5P}FTLb|`1p8KR8%|>SdC#Rl}czd8leD+qV7Lk)_dSaP{gH^z9pnzx~a0 z7`3ERy`E4|VE*NvrMi8aP*_N{K6V+6gki%7ojP?wUfw0BRH`SyQkSEmq5{j8uYg?c zfIWN6@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7z_qO?JHRyEYegemDsRhBkb&2VB9#WvoBL!tF)Bx*=K}i z&6;D$k|mEV$gCBtYG7Ke7F)N*!ok4}LxvD?a~saBXiaqG3WH(82o4S{??=?re6|>t zQmKSmt%kv1Kw@Gd+O_M1?%nBL9%{pfwtqjNM-PIhr#CijiiRXT8n(y@ZihK@7DAy=K&#c7<)>9(RsW2^-Me>j;zSzWd1ol>?M;dHr%%@} zr0i_Mgb57fa>840^~1h>$xtfqnhnZoupV6aMNvdSK>;>x+JbiNykKw7V#p8%Cr?tX z68FtfWhLSKdDF$6g98r_4-c$dxf(@9MbG?Ikmm-gTGglYtgLK&{q+KPc(}vKiN)~Y zED{q=yf6tdJT>qNx`(KQxMR* zH#}Rng^RNsJ$uM7`~$-5S%j#ygruJd$Bz**&i$bi#|g>%3DKJgGo}+pk0SK!!NEap z4-a=w^zie;q<;h<+dn({VDM75(ozme>Ar53~JH=M4lk>08vX2xr3NCpvK;? zY1SEX_nv6i={@uvJQ-7i*JA6gQ^?3w;o@Z-&gGONJ+rh + internal: + // Check for possible trouble states of a printer using its properties + static void SpotTroubleUsingProperties (System::String^% statusReport, System::Printing::PrintQueue^ pq) + { + if (pq->HasPaperProblem) + { + statusReport = statusReport + "Has a paper problem. "; + } + if (!(pq->HasToner)) + { + statusReport = statusReport + "Is out of toner. "; + } + if (pq->IsDoorOpened) + { + statusReport = statusReport + "Has an open door. "; + } + if (pq->IsInError) + { + statusReport = statusReport + "Is in an error state. "; + } + if (pq->IsNotAvailable) + { + statusReport = statusReport + "Is not available. "; + } + if (pq->IsOffline) + { + statusReport = statusReport + "Is off line. "; + } + if (pq->IsOutOfMemory) + { + statusReport = statusReport + "Is out of memory. "; + } + if (pq->IsOutOfPaper) + { + statusReport = statusReport + "Is out of paper. "; + } + if (pq->IsOutputBinFull) + { + statusReport = statusReport + "Has a full output bin. "; + } + if (pq->IsPaperJammed) + { + statusReport = statusReport + "Has a paper jam. "; + } + if (pq->IsPaused) + { + statusReport = statusReport + "Is paused. "; + } + if (pq->IsTonerLow) + { + statusReport = statusReport + "Is low on toner. "; + } + if (pq->NeedUserIntervention) + { + statusReport = statusReport + "Needs user intervention. "; + } + + // Check if queue is even available at this time of day + // The following method is defined in the complete example. + ReportAvailabilityAtThisTime(statusReport, pq); + }; + // + + // + internal: + // Check for possible trouble states of a printer using the flags of the QueueStatus property + static void SpotTroubleUsingQueueAttributes (System::String^% statusReport, System::Printing::PrintQueue^ pq) + { + if ((pq->QueueStatus & PrintQueueStatus::PaperProblem) == PrintQueueStatus::PaperProblem) + { + statusReport = statusReport + "Has a paper problem. "; + } + if ((pq->QueueStatus & PrintQueueStatus::NoToner) == PrintQueueStatus::NoToner) + { + statusReport = statusReport + "Is out of toner. "; + } + if ((pq->QueueStatus & PrintQueueStatus::DoorOpen) == PrintQueueStatus::DoorOpen) + { + statusReport = statusReport + "Has an open door. "; + } + if ((pq->QueueStatus & PrintQueueStatus::Error) == PrintQueueStatus::Error) + { + statusReport = statusReport + "Is in an error state. "; + } + if ((pq->QueueStatus & PrintQueueStatus::NotAvailable) == PrintQueueStatus::NotAvailable) + { + statusReport = statusReport + "Is not available. "; + } + if ((pq->QueueStatus & PrintQueueStatus::Offline) == PrintQueueStatus::Offline) + { + statusReport = statusReport + "Is off line. "; + } + if ((pq->QueueStatus & PrintQueueStatus::OutOfMemory) == PrintQueueStatus::OutOfMemory) + { + statusReport = statusReport + "Is out of memory. "; + } + if ((pq->QueueStatus & PrintQueueStatus::PaperOut) == PrintQueueStatus::PaperOut) + { + statusReport = statusReport + "Is out of paper. "; + } + if ((pq->QueueStatus & PrintQueueStatus::OutputBinFull) == PrintQueueStatus::OutputBinFull) + { + statusReport = statusReport + "Has a full output bin. "; + } + if ((pq->QueueStatus & PrintQueueStatus::PaperJam) == PrintQueueStatus::PaperJam) + { + statusReport = statusReport + "Has a paper jam. "; + } + if ((pq->QueueStatus & PrintQueueStatus::Paused) == PrintQueueStatus::Paused) + { + statusReport = statusReport + "Is paused. "; + } + if ((pq->QueueStatus & PrintQueueStatus::TonerLow) == PrintQueueStatus::TonerLow) + { + statusReport = statusReport + "Is low on toner. "; + } + if ((pq->QueueStatus & PrintQueueStatus::UserIntervention) == PrintQueueStatus::UserIntervention) + { + statusReport = statusReport + "Needs user intervention. "; + } + + // Check if queue is even available at this time of day + // The method below is defined in the complete example. + ReportAvailabilityAtThisTime(statusReport, pq); + }; + // + + // + private: + static void ReportAvailabilityAtThisTime (System::String^% statusReport, System::Printing::PrintQueue^ pq) + { + if (pq->StartTimeOfDay != pq->UntilTimeOfDay) + { + System::DateTime utcNow = DateTime::UtcNow; + System::Int32 utcNowAsMinutesAfterMidnight = (utcNow.TimeOfDay.Hours * 60) + utcNow.TimeOfDay.Minutes; + + // If now is not within the range of available times . . . + if (!((pq->StartTimeOfDay < utcNowAsMinutesAfterMidnight) && (utcNowAsMinutesAfterMidnight < pq->UntilTimeOfDay))) + { + statusReport = statusReport + " Is not available at this time of day. "; + } + } + }; + // + }; + + private ref class Program { + + public: + static void Main (array^ args) + { + // Obtain a list of print servers + Console::Write("Enter path and file name of CRLF-delimited list of print servers: "); + System::String^ pathToListOfPrintServers = Console::ReadLine(); + System::IO::StreamReader^ fileOfPrintServers = gcnew System::IO::StreamReader(pathToListOfPrintServers); + + // Prompt user to determine the method of reading queue status that will be used + Console::Write("Enter \"y\" to check queues using their QueueStatus attributes.\nOtherwise, press Return and they will be checked using their specific properties: "); + System::String^ useAttributesResponse = Console::ReadLine(); + + // + // Survey queue status for every queue on every print server + System::String^ line; + System::String^ statusReport = "\n\nAny problem states are indicated below:\n\n"; + while ((line = fileOfPrintServers->ReadLine()) != nullptr) + { + System::Printing::PrintServer^ myPS = gcnew System::Printing::PrintServer(line, PrintSystemDesiredAccess::AdministrateServer); + System::Printing::PrintQueueCollection^ myPrintQueues = myPS->GetPrintQueues(); + statusReport = statusReport + "\n" + line; + for each (System::Printing::PrintQueue^ pq in myPrintQueues) + { + pq->Refresh(); + statusReport = statusReport + "\n\t" + pq->Name + ":"; + if (useAttributesResponse == "y") + { + TroubleSpotter::SpotTroubleUsingQueueAttributes(statusReport, pq); + // TroubleSpotter class is defined in the complete example. + } else + { + TroubleSpotter::SpotTroubleUsingProperties(statusReport, pq); + } + } + } + fileOfPrintServers->Close(); + Console::WriteLine(statusReport); + Console::WriteLine("\nPress Return to continue."); + Console::ReadLine(); + // + }; + }; + +} + +//Entry Point: +[System::STAThreadAttribute()] +int main (array^ args) +{ + PrinterStatusSurvey::Program::Main(args); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj b/snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj new file mode 100644 index 00000000000..4ab6335b9cf --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/PrinterStatusSurvey/CPP/printerstatussurvey.vcxproj @@ -0,0 +1,127 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21208.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Console + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp b/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp new file mode 100644 index 00000000000..8739a01220b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/ScrollViewer_wcp.cpp @@ -0,0 +1,86 @@ +//ScrollViewer_wcp.cpp file + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Shapes; +using namespace System::Threading; + +namespace SDKSample { + + public ref class app : Application { + + private: + ScrollViewer^ myScrollViewer; + StackPanel^ myStackPanel; + Window^ mainWindow; + + protected: + virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // + + // Create the application's main window + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "ScrollViewer Sample"; + + // Define a ScrollViewer + myScrollViewer = gcnew ScrollViewer(); + myScrollViewer->HorizontalScrollBarVisibility = ScrollBarVisibility::Auto; + + // Add Layout control + myStackPanel = gcnew StackPanel(); + myStackPanel->HorizontalAlignment = HorizontalAlignment::Left; + myStackPanel->VerticalAlignment = VerticalAlignment::Top; + + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->TextWrapping = TextWrapping::Wrap; + myTextBlock->Margin = System::Windows::Thickness(0, 0, 0, 20); + myTextBlock->Text = "Scrolling is enabled when it is necessary. Resize the Window, making it larger and smaller."; + + Rectangle^ myRectangle = gcnew Rectangle(); + myRectangle->Fill = Brushes::Red; + myRectangle->Width = 500; + myRectangle->Height = 500; + + // Add child elements to the parent StackPanel + myStackPanel->Children->Add(myTextBlock); + myStackPanel->Children->Add(myRectangle); + + // Add the StackPanel as the lone Child of the Border + myScrollViewer->Content = myStackPanel; + + // Add the Border as the Content of the Parent Window Object + mainWindow->Content = myScrollViewer; + mainWindow->Show(); + + // + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj b/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj new file mode 100644 index 00000000000..46659bd0f75 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/ScrollViewer/CPP/scrollviewer_cpp.vcxproj @@ -0,0 +1,118 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + ScrollViewer + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30109.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp b/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp new file mode 100644 index 00000000000..d45a1b4ef20 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/ShapesProcedural.cpp @@ -0,0 +1,264 @@ +//ShapesProcedural.cpp file + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Shapes; +using namespace System::Threading; + +namespace ShapesProcedural { + + public ref class app : Application { + + private: + Border^ myBorder; + Rectangle^ myRect; + Ellipse^ myEllipse; + Line^ myLine; + Path^ myPath; + Polygon^ myPolygon; + Polyline^ myPolyline; + Grid^ myGrid; + TextBlock^ myTextBlock; + ColumnDefinition^ myColDef1; + ColumnDefinition^ myColDef2; + RowDefinition^ myRowDef; + RowDefinition^ myRowDef1; + RowDefinition^ myRowDef2; + RowDefinition^ myRowDef3; + RowDefinition^ myRowDef4; + RowDefinition^ myRowDef5; + RowDefinition^ myRowDef6; + Window^ myWindow; + + protected: virtual void OnStartup (StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: void CreateAndShowMainWindow () + { + // Create the application's main window + myWindow = gcnew Window(); + + // Add a Border + myBorder = gcnew Border(); + myBorder->BorderBrush = Brushes::Black; + myBorder->BorderThickness = Thickness(2); + myBorder->Width = 400; + myBorder->Height = 600; + myBorder->Padding = Thickness(15); + myBorder->Background = Brushes::White; + + // Create a Grid to host the Shapes + myGrid = gcnew Grid(); + myGrid->Margin = Thickness(15); + myColDef1 = gcnew ColumnDefinition(); + myColDef1->Width = GridLength(125); + myColDef2 = gcnew ColumnDefinition(); + myColDef2->Width = GridLength(1, GridUnitType::Star); + myGrid->ColumnDefinitions->Add(myColDef1); + myGrid->ColumnDefinitions->Add(myColDef2); + myRowDef = gcnew RowDefinition(); + myRowDef1 = gcnew RowDefinition(); + myRowDef2 = gcnew RowDefinition(); + myRowDef3 = gcnew RowDefinition(); + myRowDef4 = gcnew RowDefinition(); + myRowDef5 = gcnew RowDefinition(); + myRowDef6 = gcnew RowDefinition(); + myGrid->RowDefinitions->Add(myRowDef); + myGrid->RowDefinitions->Add(myRowDef1); + myGrid->RowDefinitions->Add(myRowDef2); + myGrid->RowDefinitions->Add(myRowDef3); + myGrid->RowDefinitions->Add(myRowDef4); + myGrid->RowDefinitions->Add(myRowDef5); + myGrid->RowDefinitions->Add(myRowDef6); + myTextBlock = gcnew TextBlock(); + myTextBlock->FontSize = 20; + myTextBlock->Text = "WPF Shapes Gallery"; + myTextBlock->HorizontalAlignment = HorizontalAlignment::Left; + myTextBlock->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock); + Grid::SetRow(myTextBlock, 0); + Grid::SetColumnSpan(myTextBlock, 2); + + // + + // Add a Rectangle Element + myRect = gcnew Rectangle(); + myRect->Stroke = Brushes::Black; + myRect->Fill = Brushes::SkyBlue; + myRect->HorizontalAlignment = HorizontalAlignment::Left; + myRect->VerticalAlignment = VerticalAlignment::Center; + myRect->Height = 50; + myRect->Width = 50; + myGrid->Children->Add(myRect); + // + Grid::SetRow(myRect, 1); + Grid::SetColumn(myRect, 0); + TextBlock^ myTextBlock1 = gcnew TextBlock(); + myTextBlock1->FontSize = 14; + myTextBlock1->Text = "A Rectangle Element"; + myTextBlock1->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock1); + Grid::SetRow(myTextBlock1, 1); + Grid::SetColumn(myTextBlock1, 1); + + // + + // Add an Ellipse Element + myEllipse = gcnew Ellipse(); + myEllipse->Stroke = Brushes::Black; + myEllipse->Fill = Brushes::DarkBlue; + myEllipse->HorizontalAlignment = HorizontalAlignment::Left; + myEllipse->VerticalAlignment = VerticalAlignment::Center; + myEllipse->Width = 50; + myEllipse->Height = 75; + myGrid->Children->Add(myEllipse); + // + Grid::SetRow(myEllipse, 2); + Grid::SetColumn(myEllipse, 0); + TextBlock^ myTextBlock2 = gcnew TextBlock(); + myTextBlock2->FontSize = 14; + myTextBlock2->Text = "An Ellipse Element"; + myTextBlock2->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock2); + Grid::SetRow(myTextBlock2, 2); + Grid::SetColumn(myTextBlock2, 1); + + // + + // Add a Line Element + myLine = gcnew Line(); + myLine->Stroke = Brushes::LightSteelBlue; + myLine->X1 = 1; + myLine->X2 = 50; + myLine->Y1 = 1; + myLine->Y2 = 50; + myLine->HorizontalAlignment = HorizontalAlignment::Left; + myLine->VerticalAlignment = VerticalAlignment::Center; + myLine->StrokeThickness = 2; + myGrid->Children->Add(myLine); + // + Grid::SetRow(myLine, 3); + Grid::SetColumn(myLine, 0); + TextBlock^ myTextBlock3 = gcnew TextBlock(); + myTextBlock3->FontSize = 14; + myTextBlock3->Text = "A Line Element"; + myTextBlock3->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock3); + Grid::SetRow(myTextBlock3, 3); + Grid::SetColumn(myTextBlock3, 1); + + // + + //Add the Path Element + myPath = gcnew Path(); + myPath->Stroke = Brushes::Black; + myPath->Fill = Brushes::MediumSlateBlue; + myPath->StrokeThickness = 4; + myPath->HorizontalAlignment = HorizontalAlignment::Left; + myPath->VerticalAlignment = VerticalAlignment::Center; + EllipseGeometry^ myEllipseGeometry = gcnew EllipseGeometry(); + myEllipseGeometry->Center = Point(50, 50); + myEllipseGeometry->RadiusX = 25; + myEllipseGeometry->RadiusY = 25; + myPath->Data = myEllipseGeometry; + myGrid->Children->Add(myPath); + // + Grid::SetRow(myPath, 4); + Grid::SetColumn(myPath, 0); + TextBlock^ myTextBlock4 = gcnew TextBlock(); + myTextBlock4->FontSize = 14; + myTextBlock4->Text = "A Path Element"; + myTextBlock4->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock4); + Grid::SetRow(myTextBlock4, 4); + Grid::SetColumn(myTextBlock4, 1); + + // + + //Add the Polygon Element + myPolygon = gcnew Polygon(); + myPolygon->Stroke = Brushes::Black; + myPolygon->Fill = Brushes::LightSeaGreen; + myPolygon->StrokeThickness = 2; + myPolygon->HorizontalAlignment = HorizontalAlignment::Left; + myPolygon->VerticalAlignment = VerticalAlignment::Center; + Point Point1 = Point(1, 50); + Point Point2 = Point(10, 80); + Point Point3 = Point(50, 50); + PointCollection^ myPointCollection = gcnew PointCollection(); + myPointCollection->Add(Point1); + myPointCollection->Add(Point2); + myPointCollection->Add(Point3); + myPolygon->Points = myPointCollection; + myGrid->Children->Add(myPolygon); + // + Grid::SetRow(myPolygon, 5); + Grid::SetColumn(myPolygon, 0); + TextBlock^ myTextBlock5 = gcnew TextBlock(); + myTextBlock5->Text = "A Polygon Element"; + myTextBlock5->FontSize = 14; + myTextBlock5->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock5); + Grid::SetRow(myTextBlock5, 5); + Grid::SetColumn(myTextBlock5, 1); + + // + + // Add the Polyline Element + myPolyline = gcnew Polyline(); + myPolyline->Stroke = Brushes::SlateGray; + myPolyline->StrokeThickness = 2; + myPolyline->FillRule = FillRule::EvenOdd; + Point Point4 = Point(1, 50); + Point Point5 = Point(10, 80); + Point Point6 = Point(20, 40); + PointCollection^ myPointCollection2 = gcnew PointCollection(); + myPointCollection2->Add(Point4); + myPointCollection2->Add(Point5); + myPointCollection2->Add(Point6); + myPolyline->Points = myPointCollection2; + myGrid->Children->Add(myPolyline); + // + Grid::SetRow(myPolyline, 6); + Grid::SetColumn(myPolyline, 0); + TextBlock^ myTextBlock6 = gcnew TextBlock(); + myTextBlock6->FontSize = 14; + myTextBlock6->Text = "A Polyline Element"; + myTextBlock6->VerticalAlignment = VerticalAlignment::Center; + myGrid->Children->Add(myTextBlock6); + Grid::SetRow(myTextBlock6, 6); + Grid::SetColumn(myTextBlock6, 1); + + // Add the Grid to the Window as Content and show the Window + myBorder->Child = myGrid; + myWindow->Content = myBorder; + myWindow->Background = Brushes::LightSlateGray; + myWindow->Title = "Shapes Sample"; + myWindow->Show(); + + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + ShapesProcedural::app^ app = gcnew ShapesProcedural::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return ShapesProcedural::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj b/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj new file mode 100644 index 00000000000..6a714f7e91c --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/ShapesProcedural/CPP/shapesprocedural.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21230.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp b/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp new file mode 100644 index 00000000000..76064af5593 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/StackPanel_Ovw_Sample4.cpp @@ -0,0 +1,141 @@ +//StackPanel_Ovw_Sample4.cpp file + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; + +namespace SDKSample { + + public ref class app : Application { + + private: + Border^ myBorder; + Grid^ myGrid; + StackPanel^ myStackPanel; + DockPanel^ myDockPanel; + System::Windows::Window^ mainWindow; + + protected: + virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // + + // Create the application's main window + mainWindow = gcnew Window(); + mainWindow->Title = "StackPanel vs. DockPanel"; + + // Add root Grid + myGrid = gcnew Grid(); + myGrid->Width = 175; + myGrid->Height = 150; + RowDefinition^ myRowDef1 = gcnew RowDefinition(); + RowDefinition^ myRowDef2 = gcnew RowDefinition(); + myGrid->RowDefinitions->Add(myRowDef1); + myGrid->RowDefinitions->Add(myRowDef2); + + // Define the DockPanel + myDockPanel = gcnew DockPanel(); + Grid::SetRow(myDockPanel, 0); + + //Define an Image and Source + Image^ myImage = gcnew Image(); + BitmapImage^ bi = gcnew BitmapImage(); + bi->BeginInit(); + bi->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); + bi->EndInit(); + myImage->Source = bi; + + Image^ myImage2 = gcnew Image(); + BitmapImage^ bi2 = gcnew BitmapImage(); + bi2->BeginInit(); + bi2->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); + bi2->EndInit(); + myImage2->Source = bi2; + + // + Image^ myImage3 = gcnew Image(); + BitmapImage^ bi3 = gcnew BitmapImage(); + bi3->BeginInit(); + bi3->UriSource = gcnew System::Uri("smiley_stackpanel.PNG", UriKind::Relative); + bi3->EndInit(); + myImage3->Stretch = Stretch::Fill; + myImage3->Source = bi3; + // + + // Add the images to the parent DockPanel + myDockPanel->Children->Add(myImage); + myDockPanel->Children->Add(myImage2); + myDockPanel->Children->Add(myImage3); + + //Define a StackPanel + myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Horizontal; + Grid::SetRow(myStackPanel, 1); + + Image^ myImage4 = gcnew Image(); + BitmapImage^ bi4 = gcnew BitmapImage(); + bi4->BeginInit(); + bi4->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); + bi4->EndInit(); + myImage4->Source = bi4; + + Image^ myImage5 = gcnew Image(); + BitmapImage^ bi5 = gcnew BitmapImage(); + bi5->BeginInit(); + bi5->UriSource = gcnew System::Uri("smiley_stackpanel.png", UriKind::Relative); + bi5->EndInit(); + myImage5->Source = bi5; + + Image^ myImage6 = gcnew Image(); + BitmapImage^ bi6 = gcnew BitmapImage(); + bi6->BeginInit(); + bi6->UriSource = gcnew System::Uri("smiley_stackpanel.PNG", UriKind::Relative); + bi6->EndInit(); + myImage6->Stretch = Stretch::Fill; + myImage6->Source = bi6; + + // Add the images to the parent StackPanel + myStackPanel->Children->Add(myImage4); + myStackPanel->Children->Add(myImage5); + myStackPanel->Children->Add(myImage6); + + // Add the layout panels as children of the Grid + myGrid->Children->Add(myDockPanel); + myGrid->Children->Add(myStackPanel); + + // Add the Grid as the Content of the Parent Window Object + mainWindow->Content = myGrid; + mainWindow->Show(); + + // + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/smiley_stackpanel.PNG b/snippets/cpp/VS_Snippets_Wpf/StackPanelOvw4/CPP/smiley_stackpanel.PNG new file mode 100644 index 0000000000000000000000000000000000000000..1e0b9496cad2e2133d1edb7c4d3511a059772473 GIT binary patch literal 4599 zcmV002t}1^@s6I8J)%00009a7bBm000id z000id0mpBsWB>pWsYygZRCt{2oOxW7<=V%uXBpHo1RX#YK~zLgGt*F!7JEHzWu)es zrJnHEDLa|_LDS=sp^1WmqPdWWiKw83iHSQXF8GKn;g}nOAcDipGus2q@BA@hnj13= zLht+j@%u;l-1l{T@9Vywd%3Qmy+^KULSl2I(Cu}v6>+&zSbUxozVni_A}&`7*_tUW z+MFTHU!N|`k2)#MjZBs1M4Y&T{IzM){B`NlqRr=|kgb_g==L0G)h>k;7M~}r zh|7I0c7MAiTZ%h);~XuG&5`zH-auwSK7^arS7u=WvWtt5U0j5dic9$A%o+T!{{a3I zxgMh?Pea#!BjNR`AAEh+g9vly5*92VY}{y4R21Qx zZ%qFl6hs&_fY8H_;O#|d>Bys7*BHe@Aq53_kw&Q?zdF3wL)y|New8z94MfN;r3p z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32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp new file mode 100644 index 00000000000..685472dce19 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/TiffEncoderDecoder.cpp @@ -0,0 +1,130 @@ +//TiffEncoderDecoder.cpp file + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; +using namespace System::Security; + + +namespace SDKSample { + + public ref class app : Application { + + private: System::Windows::Window^ mainWindow; + + protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: void CreateAndShowMainWindow () + { + + // Create the application's main window. + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "TIFF Imaging Sample"; + ScrollViewer^ mySV = gcnew ScrollViewer(); + + // + int width = 128; + int height = width; + int stride = width / 8; + array^ pixels = gcnew array(height * stride); + + // Define the image palette. + BitmapPalette^ myPalette = BitmapPalettes::WebPalette; + + // Creates a new empty image with the pre-defined palette. + + // + BitmapSource^ image = BitmapSource::Create(width, + height, + 96, + 96, + PixelFormats::Indexed1, + myPalette, + pixels, + stride); + // + + // + FileStream^ stream = gcnew FileStream("new.tif", FileMode::Create); + TiffBitmapEncoder^ encoder = gcnew TiffBitmapEncoder(); + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); + encoder->Compression = TiffCompressOption::Zip; + encoder->Frames->Add(BitmapFrame::Create(image)); + encoder->Save(stream); + // + + // + + // + // Open a Stream and decode a TIFF image. + Stream^ imageStreamSource = gcnew FileStream("tulipfarm.tif", FileMode::Open, FileAccess::Read, FileShare::Read); + TiffBitmapDecoder^ decoder = gcnew TiffBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource = decoder->Frames[0]; + + // Draw the Image. + Image^ myImage = gcnew Image(); + myImage->Source = bitmapSource; + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + // + + // + + // Open a Uri and decode a TIFF image. + System::Uri^ myUri = gcnew System::Uri("tulipfarm.tif", UriKind::RelativeOrAbsolute); + TiffBitmapDecoder^ decoder2 = gcnew TiffBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource2 = decoder2->Frames[0]; + + // Draw the Image. + Image^ myImage2 = gcnew Image(); + myImage2->Source = bitmapSource2; + myImage2->Stretch = Stretch::None; + myImage2->Margin = System::Windows::Thickness(20); + // + + // Define a StackPanel to host the decoded TIFF images. + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; + + // Add the Image and TextBlock to the parent Grid. + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myImage2); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the Content of the Parent Window Object. + mySV->Content = myStackPanel; + mainWindow->Content = mySV; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj new file mode 100644 index 00000000000..7c1873181a0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tiffencoderdecoder.vcxproj @@ -0,0 +1,126 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tulipfarm.tif b/snippets/cpp/VS_Snippets_Wpf/TiffBitmapDecoderEncoder/CPP/tulipfarm.tif new file mode 100644 index 0000000000000000000000000000000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new file mode 100644 index 00000000000..d9c0f207bd9 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/ViewboxCode.cpp @@ -0,0 +1,107 @@ +//ViewboxCode.cpp file +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Shapes; +using namespace System::Threading; + +namespace ViewboxCode { + + public ref class app : Application { + + private: + Canvas^ myCanvas; + Window^ mainWindow; + Viewbox^ myViewbox; + Grid^ myGrid; + TextBlock^ myTextBlock; + Ellipse^ myEllipse; + + protected: + virtual void OnStartup (StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + } + ; + + private: + void CreateAndShowMainWindow () + { + // Create the application's main window + mainWindow = gcnew Window(); + + // Create a Canvas sized to fill the window + myCanvas = gcnew Canvas(); + myCanvas->Background = Brushes::Silver; + myCanvas->Width = 600; + myCanvas->Height = 600; + // + + // + + // Create a Viewbox and add it to the Canvas + myViewbox = gcnew Viewbox(); + myViewbox->StretchDirection = StretchDirection::Both; + myViewbox->Stretch = Stretch::Fill; + myViewbox->MaxWidth = 400; + myViewbox->MaxHeight = 400; + // + + // Create a Grid that will be hosted inside the Viewbox + myGrid = gcnew Grid(); + + // Create an Ellipse that will be hosted inside the Viewbox + myEllipse = gcnew Ellipse(); + myEllipse->Stroke = Brushes::RoyalBlue; + myEllipse->Fill = Brushes::LightBlue; + + // Create an TextBlock that will be hosted inside the Viewbox + myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "Viewbox"; + + // Add the children to the Grid + myGrid->Children->Add(myEllipse); + myGrid->Children->Add(myTextBlock); + + // + + // Add the Grid as the single child of the Viewbox + myViewbox->Child = myGrid; + + // + + // Position the Viewbox in the Parent Canvas + Canvas::SetTop(myViewbox, 100); + Canvas::SetLeft(myViewbox, 100); + myCanvas->Children->Add(myViewbox); + + // + + // Set the Window content + mainWindow->Content = myCanvas; + mainWindow->Show(); + + + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + ViewboxCode::app^ app = gcnew ViewboxCode::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return ViewboxCode::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj b/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj new file mode 100644 index 00000000000..b20c477fb8b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/ViewBoxCode/CPP/viewboxcode.vcxproj @@ -0,0 +1,123 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21230.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp new file mode 100644 index 00000000000..a50b95e31c5 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/WDPEncoderDecoder.cpp @@ -0,0 +1,142 @@ +//WDPEncoderDecoder.cpp file + + +using namespace System; +using namespace System::Collections::Generic; +using namespace System::IO; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Imaging; +using namespace System::Threading; +using namespace System::Security; + + +namespace SDKSample { + + public ref class app : Application { + + private: Window^ mainWindow; + + protected: virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: void CreateAndShowMainWindow () + { + + // Create the application's main window + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "WDP Imaging Sample"; + ScrollViewer^ mySV = gcnew ScrollViewer(); + + // + int width = 128; + int height = width; + int stride = width / 8; + array^ pixels = gcnew array(height * stride); + + // Define the image palette + BitmapPalette^ myPalette = BitmapPalettes::WebPalette; + + // Creates a new empty image with the pre-defined palette + + // + BitmapSource^ image = BitmapSource::Create( + width, + height, + 96, + 96, + PixelFormats::Indexed1, + myPalette, + pixels, + stride); + // + + // + FileStream^ stream = gcnew FileStream("new.wdp", FileMode::Create); + WmpBitmapEncoder^ encoder = gcnew WmpBitmapEncoder(); + TextBlock^ myTextBlock = gcnew TextBlock(); + myTextBlock->Text = "Codec Author is: " + encoder->CodecInfo->Author->ToString(); + encoder->Frames->Add(BitmapFrame::Create(image)); + encoder->Save(stream); + // + + // + + // + + // Open a Stream and decode a WDP image + Stream^ imageStreamSource = gcnew FileStream("tulipfarm.wdp", FileMode::Open, FileAccess::Read, FileShare::Read); + WmpBitmapDecoder^ decoder = gcnew WmpBitmapDecoder(imageStreamSource, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource = decoder->Frames[0]; + + // Draw the Image + Image^ myImage = gcnew Image(); + myImage->Source = bitmapSource; + myImage->Stretch = Stretch::None; + myImage->Margin = System::Windows::Thickness(20); + // + + // + + // Open a Uri and decode a WDP image + System::Uri^ myUri = gcnew System::Uri("tulipfarm.wdp", UriKind::RelativeOrAbsolute); + WmpBitmapDecoder^ decoder3 = gcnew WmpBitmapDecoder(myUri, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource3 = decoder3->Frames[0]; + + // Draw the Image + Image^ myImage2 = gcnew Image(); + myImage2->Source = bitmapSource3; + myImage2->Stretch = Stretch::None; + myImage2->Margin = System::Windows::Thickness(20); + // + + // + FileStream^ stream2 = gcnew FileStream("tulipfarm.jpg", FileMode::Open); + JpegBitmapDecoder^ decoder2 = gcnew JpegBitmapDecoder(stream2, BitmapCreateOptions::PreservePixelFormat, BitmapCacheOption::Default); + BitmapSource^ bitmapSource2 = decoder2->Frames[0]; + FileStream^ stream3 = gcnew FileStream("new2.wdp", FileMode::Create); + WmpBitmapEncoder^ encoder2 = gcnew WmpBitmapEncoder(); + encoder2->Frames->Add(BitmapFrame::Create(bitmapSource2)); + encoder2->Save(stream3); + // + + // Define a StackPanel to host the decoded WDP images + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Orientation = Orientation::Vertical; + myStackPanel->VerticalAlignment = VerticalAlignment::Stretch; + myStackPanel->HorizontalAlignment = HorizontalAlignment::Stretch; + + // Add the Image and TextBlock to the parent Grid + myStackPanel->Children->Add(myImage); + myStackPanel->Children->Add(myImage2); + myStackPanel->Children->Add(myTextBlock); + + // Add the StackPanel as the Content of the Parent Window Object + mySV->Content = myStackPanel; + mainWindow->Content = mySV; + mainWindow->Show(); + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + SDKSample::app^ app = gcnew SDKSample::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return SDKSample::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/tulipfarm.jpg new file mode 100644 index 0000000000000000000000000000000000000000..2ce60cad09155366d0c4ef18b9e01dedd61a1cb8 GIT binary patch literal 110238 zcma&N1z1#F_cnfJh8()PhZK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ay?=8o{C{6Kr+g3ptlQS=g1W(GfWRmd!enm2)z=et(6Q!T^t#YS{ z0CY}|dzK6kUP8xRCz>a`q)^Fw(80Qnh#-G<(-3$HSl~qhBoGnjh7YFT!8=$5G&3sS=;MCpUjI|Txy%d5r$Zt?&&2z|X&lQNEm%DKge`(!k`FY$DH$onhE$#)qvSJ7XBdDYB~l()rBuUHb|+A~OT!kyX-7abOykD~x~e;k3G|~cpENUH;pZjfYXLCnTxp^ zU<$TgP~Hbj6^sJpID|fGV;9D}V>~!q*aA<9c#QxW!BqRcj45r`$8wavZ}l##LkJ=S zu|6-|@cwDt|F>;~Z$=p6?>rSkoY#aP7eAnNvH)}?5itd6Gr~(2Xb6x{*oA>Ca&&1La?5~(iJm~QmQ&tcdqXg-AoC_#@X%=nAgU@)Z2$+Qbe6*u{EXrE zmh$a{vKe1ID@Y~3*O*&hR5;;v9=Al}dT z!v&g_(B@OmRmcvaVjRxYUymRSaVHu|h`TS4%x8j7a|wxg)jZ@;UGWeBZZd#<(vS>t zUbqA^e&;C)hmjLcSoq3RkIq?(c%9XOQww)yJPo@{lkKv9D5eLBK7g8vO)*lxtbzVn zJb(k61N5qTl74s|C(kL1;nLW-5KcuD65a6 zY_EN$9=r)!4aqs!;`C;5A2(O2o8d1AmzDHDa{Rqo}ol_0r zaprkdtF5f#tT9G0UFCIHa^W~BU^Y1s1u0>$0J7vb#jZITOVT3_XTXGj@7oP*BdnXf z(BVQuA?{IcK8VTrNX+`AXTdyjW+-Q literal 0 HcmV?d00001 diff --git a/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj new file mode 100644 index 00000000000..82611d115d4 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/WdpBitmapDecoderEncoder/CPP/wdpencoderdecoder.vcxproj @@ -0,0 +1,126 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + .\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp b/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp new file mode 100644 index 00000000000..95e061129c3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/WrapPanel_Code.cpp @@ -0,0 +1,92 @@ +//WrapPanel_Code.cpp file + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Controls; +using namespace System::Windows::Media; +using namespace System::Threading; + +namespace WrapPanel_Demo { + + public ref class app : System::Windows::Application { + + private: + System::Windows::Controls::Button^ btn1; + System::Windows::Controls::Button^ btn2; + System::Windows::Controls::Button^ btn3; + System::Windows::Controls::WrapPanel^ myWrapPanel; + System::Windows::Window^ mainWindow; + + protected: + virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // + + // Create the application's main window + mainWindow = gcnew System::Windows::Window(); + mainWindow->Title = "WrapPanel Sample"; + + // + + // Instantiate a new WrapPanel and set properties + myWrapPanel = gcnew WrapPanel(); + myWrapPanel->Background = Brushes::Azure; + myWrapPanel->Orientation = Orientation::Horizontal; + // + myWrapPanel->ItemHeight = 25; + // + + // + myWrapPanel->ItemWidth = 75; + // + myWrapPanel->Width = 150; + myWrapPanel->HorizontalAlignment = HorizontalAlignment::Left; + myWrapPanel->VerticalAlignment = VerticalAlignment::Top; + + // Define 3 button elements. Each button is sized at width of 75, so the third button wraps to the next line. + btn1 = gcnew Button(); + btn1->Content = "Button 1"; + btn2 = gcnew Button(); + btn2->Content = "Button 2"; + btn3 = gcnew Button(); + btn3->Content = "Button 3"; + + // Add the buttons to the parent WrapPanel using the Children.Add method. + myWrapPanel->Children->Add(btn1); + myWrapPanel->Children->Add(btn2); + myWrapPanel->Children->Add(btn3); + + // Add the WrapPanel to the MainWindow as Content + mainWindow->Content = myWrapPanel; + mainWindow->Show(); + // + + // + }; + }; + + private ref class EntryClass { + + public: + [System::STAThread()] + static void Main () + { + WrapPanel_Demo::app^ app = gcnew WrapPanel_Demo::app(); + app->Run(); + }; + }; +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return WrapPanel_Demo::EntryClass::Main(); +} diff --git a/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj b/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj new file mode 100644 index 00000000000..98f58d453c0 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/WrapPanel_Intro/CPP/wrappanel_code_cpp.vcxproj @@ -0,0 +1,124 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + WrapPanel_Code + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21125.1 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp new file mode 100644 index 00000000000..f96bf18a4ff --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/XpsCreate.cpp @@ -0,0 +1,459 @@ +//XpsCreate.cpp file + +using namespace System; +using namespace System::IO; +using namespace System::Collections::Generic; +using namespace System::IO::Packaging; +using namespace System::Xml; +using namespace System::Windows::Forms; +using namespace System::Windows::Xps; +using namespace System::Windows::Xps::Packaging; +using namespace System::Printing; + +public ref class XpsCreate { + +private: + literal System::String^ packageWithPrintTicketName = "XpsDocument-withPrintTicket.xps"; + literal System::String^ packageName = "XpsDocument.xps"; + literal System::String^ image1 = "picture.jpg"; + literal System::String^ image2 = "image.tif"; + literal System::String^ font1 = "courier.ttf"; + literal System::String^ font2 = "arial.ttf"; + literal System::String^ fontContentType = "application/vnd.ms-package.obfuscated-opentype"; + +public: + [STAThread()] + static void Main (array^ args) + { + XpsCreate^ xpsCreate = gcnew XpsCreate(); + xpsCreate->Run(); + }; + +public: + // -------------------------------- Run ----------------------------------- + ///

+ /// Creates two XpsDocument packages, the first without a PrintTicket + /// and a second with a PrintTicket. + void Run () + { + // First, create an XpsDocument without a PrintTicket. - - - - - - - - + + // If the document package exists from a previous run, delete it. + if (File::Exists(packageName)) + { + File::Delete(packageName); + } + // + // Create an XpsDocument package (without PrintTicket). + { + Package^ package = Package::Open(packageName); + try + { + XpsDocument^ xpsDocument = gcnew XpsDocument(package); + + // Add the package content (false=without PrintTicket). + AddPackageContent(xpsDocument, false); + + // Close the package. + xpsDocument->Close(); + } finally + { + delete package; + } + // + + // Next, create a second XpsDocument with a PrintTicket. - - - - - - - + + // If the document package exists from a previous run, delete it. + if (File::Exists(packageWithPrintTicketName)) + { + File::Delete(packageWithPrintTicketName); + } + + // Create an XpsDocument with PrintTicket. + { + Package^ package2 = Package::Open(packageWithPrintTicketName); + try + { + XpsDocument^ xpsDocumentWithPrintTicket = gcnew XpsDocument(package2); + + // Add the package content (true=with PrintTicket). + AddPackageContent(xpsDocumentWithPrintTicket, true); + + // Close the package. + xpsDocumentWithPrintTicket->Close(); + } finally + { + delete package2; + } + } + + System::String^ msg = "Created two XPS document packages:\n - " + packageName + "\n - " + packageWithPrintTicketName; + MessageBox::Show(msg, "Normal Completion", MessageBoxButtons::OK, MessageBoxIcon::Information); + } + }; + +private: + // + // ------------------------- AddPackageContent ---------------------------- + /// + /// Adds a predefined set of content to a given XPS document. + /// + /// The package to add the document content to. + /// + /// true to include a PrintTicket with the + /// document; otherwise, false. + void AddPackageContent (XpsDocument^ xpsDocument, bool attachPrintTicket) + { + try + { + PrintTicket^ printTicket = GetPrintTicketFromPrinter(); + // PrintTicket is null, there is no need to attach one. + if (printTicket == nullptr) + { + attachPrintTicket = false; + } + // Add a FixedDocumentSequence at the Package root + IXpsFixedDocumentSequenceWriter^ documentSequenceWriter = xpsDocument->AddFixedDocumentSequence(); + + // Add the 1st FixedDocument to the FixedDocumentSequence. - - - - - + IXpsFixedDocumentWriter^ fixedDocumentWriter = documentSequenceWriter->AddFixedDocument(); + + AddDocumentContent(fixedDocumentWriter); + + // Commit the 1st Document + fixedDocumentWriter->Commit(); + + // Add a 2nd FixedDocument to the FixedDocumentSequence. - - - - - - + fixedDocumentWriter = documentSequenceWriter->AddFixedDocument(); + + // Add content to the 2nd document. + AddDocumentContent(fixedDocumentWriter); + + // If attaching PrintTickets, attach one at the FixedDocument level. + if (attachPrintTicket) + { + fixedDocumentWriter->PrintTicket = printTicket; + } + // Commit the 2nd document. + fixedDocumentWriter->Commit(); + + // If attaching PrintTickets, attach one at + // the package FixedDocumentSequence level. + if (attachPrintTicket) + { + documentSequenceWriter->PrintTicket = printTicket; + } + // Commit the FixedDocumentSequence + documentSequenceWriter->Commit(); + } catch (XpsPackagingException^ xpsException) + { + throw xpsException; + + } + };// end:AddPackageContent() + // + + + // + // ------------------------- AddDocumentContent --------------------------- + /// + /// Adds a predefined set of content to a given document writer. + /// + /// The document writer to add the content to. + void AddDocumentContent (IXpsFixedDocumentWriter^ fixedDocumentWriter) + { + // Collection of image and font resources used on the current page. + // Key: "XpsImage", "XpsFont" + // Value: List of XpsImage or XpsFont resources + Dictionary^>^ resources; + + try + { + // Add Page 1 to current document. + IXpsFixedPageWriter^ fixedPageWriter = fixedDocumentWriter->AddFixedPage(); + // Add the resources for Page 1 and get the resource collection. + resources = AddPageResources(fixedPageWriter); + + // Write page content for Page 1. + WritePageContent(fixedPageWriter->XmlWriter, "Page 1 of " + fixedDocumentWriter->Uri->ToString(), resources); + // Commit Page 1. + fixedPageWriter->Commit(); + + // Add Page 2 to current document. + fixedPageWriter = fixedDocumentWriter->AddFixedPage(); + + // Add the resources for Page 2 and get the resource collection. + resources = AddPageResources(fixedPageWriter); + + // Write page content to Page 2. + WritePageContent(fixedPageWriter->XmlWriter, "Page 2 of " + fixedDocumentWriter->Uri->ToString(), resources); + // Commit Page 2. + fixedPageWriter->Commit(); + } catch (XpsPackagingException^ xpsException) + { + throw xpsException; + + } + };// end:AddDocumentContent() + // + + + // + // -------------------------- AddPageResources ---------------------------- + Dictionary^>^ AddPageResources (IXpsFixedPageWriter^ fixedPageWriter) + { + // Collection of all resources for this page. + // Key: "XpsImage", "XpsFont" + // Value: List of XpsImage or XpsFont + Dictionary^>^ resources = gcnew Dictionary^>(); + + // Collections of images and fonts used in the current page. + List^ xpsImages = gcnew List(); + List^ xpsFonts = gcnew List(); + + try + { + XpsImage^ xpsImage; + XpsFont^ xpsFont; + + // Add, Write, and Commit image1 to the current page. + xpsImage = fixedPageWriter->AddImage(XpsImageType::JpegImageType); + WriteToStream(xpsImage->GetStream(), image1); + xpsImage->Commit(); + xpsImages->Add(xpsImage); // Add image1 as a required resource. + + // Add, Write, and Commit font 1 to the current page. + xpsFont = fixedPageWriter->AddFont(); + WriteObfuscatedStream(xpsFont->Uri->ToString(), xpsFont->GetStream(), font1); + xpsFont->Commit(); + xpsFonts->Add(xpsFont); // Add font1 as a required resource. + + // Add, Write, and Commit image2 to the current page. + xpsImage = fixedPageWriter->AddImage(XpsImageType::TiffImageType); + WriteToStream(xpsImage->GetStream(), image2); + xpsImage->Commit(); + xpsImages->Add(xpsImage); // Add image2 as a required resource. + + // Add, Write, and Commit font2 to the current page. + xpsFont = fixedPageWriter->AddFont(false); + WriteToStream(xpsFont->GetStream(), font2); + xpsFont->Commit(); + xpsFonts->Add(xpsFont); // Add font2 as a required resource. + + // Return the image and font resources in a combined collection. + resources->Add("XpsImage", xpsImages); + resources->Add("XpsFont", xpsFonts); + return resources; + } catch (XpsPackagingException^ xpsException) + { + throw xpsException; + + } + };// end:AddPageResources() + // + + + // + // ---------------------- GetPrintTicketFromPrinter ----------------------- + /// + /// Returns a PrintTicket based on the current default printer. + /// + /// A PrintTicket for the current local default printer. + PrintTicket^ GetPrintTicketFromPrinter () + { + PrintQueue^ printQueue = nullptr; + + LocalPrintServer^ localPrintServer = gcnew LocalPrintServer(); + + // Retrieving collection of local printer on user machine + PrintQueueCollection^ localPrinterCollection = localPrintServer->GetPrintQueues(); + + System::Collections::IEnumerator^ localPrinterEnumerator = localPrinterCollection->GetEnumerator(); + + if (localPrinterEnumerator->MoveNext()) + { + // Get PrintQueue from first available printer + printQueue = ((PrintQueue^)localPrinterEnumerator->Current); + } else + { + return nullptr; + } + // Get default PrintTicket from printer + PrintTicket^ printTicket = printQueue->DefaultPrintTicket; + + PrintCapabilities^ printCapabilities = printQueue->GetPrintCapabilities(); + + // Modify PrintTicket + if (printCapabilities->CollationCapability->Contains(Collation::Collated)) + { + printTicket->Collation = Collation::Collated; + } + if (printCapabilities->DuplexingCapability->Contains(Duplexing::TwoSidedLongEdge)) + { + printTicket->Duplexing = Duplexing::TwoSidedLongEdge; + } + if (printCapabilities->StaplingCapability->Contains(Stapling::StapleDualLeft)) + { + printTicket->Stapling = Stapling::StapleDualLeft; + } + return printTicket; + };// end:GetPrintTicketFromPrinter() + // + + + // + // --------------------------- WritePageContent --------------------------- + void WritePageContent (System::Xml::XmlWriter^ xmlWriter, System::String^ documentUri, Dictionary^>^ resources) + { + List^ xpsImages = resources["XpsImage"]; + List^ xpsFonts = resources["XpsFont"]; + + // Element are indented for reading purposes only + xmlWriter->WriteStartElement("FixedPage"); + xmlWriter->WriteAttributeString("Width", "816"); + xmlWriter->WriteAttributeString("Height", "1056"); + xmlWriter->WriteAttributeString("xmlns", "http://schemas.microsoft.com/xps/2005/06"); + xmlWriter->WriteAttributeString("xml:lang", "en-US"); + + xmlWriter->WriteStartElement("Glyphs"); + xmlWriter->WriteAttributeString("Fill", "#ff000000"); + xmlWriter->WriteAttributeString("FontUri", xpsFonts[0]->Uri->ToString()); + xmlWriter->WriteAttributeString("FontRenderingEmSize", "18"); + xmlWriter->WriteAttributeString("OriginX", "120"); + xmlWriter->WriteAttributeString("OriginY", "110"); + xmlWriter->WriteAttributeString("UnicodeString", documentUri); + xmlWriter->WriteEndElement(); + + xmlWriter->WriteStartElement("Glyphs"); + xmlWriter->WriteAttributeString("Fill", "#ff000000"); + xmlWriter->WriteAttributeString("FontUri", xpsFonts[1]->Uri->ToString()); + xmlWriter->WriteAttributeString("FontRenderingEmSize", "16"); + xmlWriter->WriteAttributeString("OriginX", "120"); + xmlWriter->WriteAttributeString("OriginY", "130"); + xmlWriter->WriteAttributeString("UnicodeString", "Test String in Arial"); + xmlWriter->WriteEndElement(); + + xmlWriter->WriteStartElement("Path"); + xmlWriter->WriteAttributeString("Data", "M 120,187 L 301,187 301,321 120,321 z"); + xmlWriter->WriteStartElement("Path.Fill"); + xmlWriter->WriteStartElement("ImageBrush"); + xmlWriter->WriteAttributeString("ImageSource", xpsImages[0]->Uri->ToString()); + xmlWriter->WriteAttributeString("Viewbox", "0,0,181,134"); + xmlWriter->WriteAttributeString("TileMode", "None"); + xmlWriter->WriteAttributeString("ViewboxUnits", "Absolute"); + xmlWriter->WriteAttributeString("ViewportUnits", "Absolute"); + xmlWriter->WriteAttributeString("Viewport", "120,187,181,134"); + xmlWriter->WriteEndElement(); + xmlWriter->WriteEndElement(); + xmlWriter->WriteEndElement(); + + xmlWriter->WriteStartElement("Path"); + xmlWriter->WriteAttributeString("Data", "M 120,357 L 324,357 324,510 120,510 z"); + xmlWriter->WriteStartElement("Path.Fill"); + xmlWriter->WriteStartElement("ImageBrush"); + xmlWriter->WriteAttributeString("ImageSource", xpsImages[1]->Uri->ToString()); + xmlWriter->WriteAttributeString("Viewbox", "0,0,204,153"); + xmlWriter->WriteAttributeString("TileMode", "None"); + xmlWriter->WriteAttributeString("ViewboxUnits", "Absolute"); + xmlWriter->WriteAttributeString("ViewportUnits", "Absolute"); + xmlWriter->WriteAttributeString("Viewport", "120,357,204,153"); + xmlWriter->WriteEndElement(); + xmlWriter->WriteEndElement(); + xmlWriter->WriteEndElement(); + xmlWriter->WriteEndElement(); + };// end:WritePageContent() + // + + + // ----------------------------- WriteToStream ---------------------------- + void WriteToStream (System::IO::Stream^ stream, System::String^ resource) + { + int bufSize = 0x1000; + array^ buf = gcnew array(bufSize); + int bytesRead = 0; + { + System::IO::FileStream^ fileStream = gcnew System::IO::FileStream(resource, FileMode::Open, FileAccess::Read); + try + { + while ((bytesRead = fileStream->Read(buf, 0, bufSize)) > 0) + { + stream->Write(buf, 0, bytesRead); + } + } finally + { + delete fileStream; + } + } + }; + + // ------------------------- WriteObfuscatedStream ------------------------ + void WriteObfuscatedStream (System::String^ resourceName, System::IO::Stream^ stream, System::String^ resource) { + int bufSize = 0x1000; + int guidByteSize = 16; + int obfuscatedByte = 32; + + // Get the GUID byte from the resource name. Typical Font name: + // /Resources/Fonts/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.ODTTF + int startPos = resourceName->LastIndexOf('/') + 1; + int length = resourceName->LastIndexOf('.') - startPos; + resourceName = resourceName->Substring(startPos, length); + + System::Guid guid = System::Guid(resourceName); + + System::String^ guidString = guid.ToString("N"); + + // Parsing the guid string and coverted into byte value + array^ guidBytes = gcnew array(guidByteSize); + + for ( + int i = 0; + i < guidBytes->Length; + i++) + { + guidBytes[i] = Convert::ToByte(guidString->Substring(i * 2, 2), 16); + } + + { + System::IO::FileStream^ filestream = gcnew System::IO::FileStream(resource, FileMode::Open); + try + { + // XOR the first 32 bytes of the source + // resource stream with GUID byte. + array^ buf = gcnew array(obfuscatedByte); + filestream->Read(buf, 0, obfuscatedByte); + + for ( + int i = 0; + i < obfuscatedByte; + i++) + { + int guidBytesPos = guidBytes->Length - (i % guidBytes->Length) - 1; + buf[i] ^= guidBytes[guidBytesPos]; + } + + stream->Write(buf, 0, obfuscatedByte); + + // copy remaining stream from source without obfuscation + buf = gcnew array(bufSize); + int bytesRead = 0; + while ((bytesRead = filestream->Read(buf, 0, bufSize)) > 0) + { + stream->Write(buf, 0, bytesRead); + } + } finally + { + delete filestream; + } + } + }; + +}; + + +//Entry Point: +int main (array^ args) +{ + XpsCreate::Main(args); + return 0; +} diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/arial.ttf new file mode 100644 index 0000000000000000000000000000000000000000..ff0815cd8c64b0a245ec780eb8d21867509155b5 GIT binary patch literal 367112 zcmeFa37lj}Rqr2Jxvw`fZ{FPZwJNJJyQ;dos<-Lc8JJ<%dS*aG0f$Y70b~;u1w)is^^&K z^Q)Blu^Z0add$F=mi3rttl@ z-}%I6|MgW*KV{7Cy%(gOe)|ia*S%}{`!6u&^KYcS&8Iy3sdxU?H+;q2#(Z*<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?qRXRm8$o-K;k0j{#oshS6( zT4q+wv(IUnH>a_wwm@dgf`*wh?Xw%3O;c-SCe5ss3sg7GZmONz0^%F0W)`5x?1tus z`Dz)J-S$RsVV=FFYF1T!ZBvoGskYW6SP4~;>!_)PP-ZrP)76M@2R$9M_jMevi=Dwi z5xB42j?gqhtvZ5%_9kT@R1INdAoNmT&=gpO^0IOxy6SMij@U%d1H=xrw+8G8YB?B0 z09aJwAGG`1+J?obgWh-a4Is)Bh6KVE$z~rpps8YPHB=RuZZ2O_`diu`zOdA^9dTUy ziaLWGxB<)*riAfzGzlkh_=~}x>DVRCI`U)EI&$m(f@QG(4=qEuHNcR!|7NElx&O+r z7tH*h4tor|DtmLFyU3pJw&x%!M6MmdE(+n2>N?gM*#FDsAZ&<)n*(8fL-#eBIoJ|o zw1h2C$&JUJQy1={l5&2Nb0MQzEY#nX6gIV_sq0nDFyT|bx3it&AH$7d^0iWv6+pdrVn5L<+{T! zJ!bppr{stS_D#LYk+xywo%X3$9(q6Rrp4}cJO`8BSUgX04gVj^-Sn5M;A0-*Y+3s! zSBm}|C5pMjXL63kS7=^0%MXA;=Si;2P(kj-yXrTaJ}&M!Y1*AHUE6)|){&GX*P^iE z7WYio^etIy?AW2D4?Cy~V0V=OQako$31BxBJN8`Z6JLhiICf2zki2?>B8QEbI8%H5Vj~i`jgp^Uh08`Q+1|o{j!w?NirY*R^eD@K0&?I1Y~b z@zV!N()(_1-SgAq7cQB%?V~GeZrSjNgWIkO{AKa}2E*(d=XKVuiu$potLfu86LQwj zCQr;GkDf5;>$l?MP@wUsiCr^81*`>Nu_O<*YT<#FMSryO(F(^Vt)<7e4yV YT{-Kox#{eO9!q}ssT<-WUTT*9ALIy2IRF3v literal 0 HcmV?d00001 diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/image.tif b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/image.tif new file mode 100644 index 0000000000000000000000000000000000000000..c9df35e7674915b7a7fc4e15e8f2a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6iEf;OBG_^);ph;e@~D~P%N^gZk&@^9lS{#!fF5CWLc06;k! c0tguX=8ORCBSEYT)+kO05cLO#gZME0AGitcj{pDw literal 0 HcmV?d00001 diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/picture.jpg new file mode 100644 index 0000000000000000000000000000000000000000..5aaafc1aa06d950d16a6204a8eaf693499ec8e8f GIT binary patch literal 18216 zcmeHucUTn7w`P+;l1PpNl2nr9Bp@On0+Mrf$Qg!=fPhNQNrE6b4IpXANy3mbLl(&y zL~`EI@B4*&clWt>cc1;w8mgp_;$Z9QV&z~DAk*Dnx&R9D^LP163mu9by@jnAQW-!;W{=-`l=uFnCu!?q<>G4kPYt@?_6~8CovrL$ z=w)n8EFj2!IKKw?l~8{BgMNoV%E8go`In8~I)90N%UJJ{yfkq%u{VR5(f`LmfIG0g-Gn!7mIo6)P8x%~3^m&F$Vm$^Ao-xhhq{M`xV@0QHulz+DH zASEb(F7o&f9sb`f9RF(hZRzZ9OX|)h_7HP3=YO~4h&=26%Y?Rp9OeIm?DrgCW6HW( znVS6y6*-%~q5x2z{*{5h&M_UnhN=R+gPWPN^WTcUX7Dc=6{ec475J~-uE@r}qW>iZ zP_+R7jUHLK184yDfD2%S%(j3TU zuy--BurM?I$5KEp=HF5has?Al`f}HGUCXio??N=x216y$n& zft;&7fI!mJ;WaYYx5z#yx3j=I01q1*8wVQ?2M3P`_YN)*DIp#nAt?nhF)1-I1rgrw z^mp;sm;Zc3!Nu;=o#7rghNOxK@qH(M9!!#$%<^Z9Or)x9uX*{L14g8(oX1fTGk7_KL{j7Y~KIXc7D8m|`^S&yfV|?W(x4Ls;^;px~?L%T7 ztP8PrA}Fh6;U1KfUjv_9KP3WCQIX!F|Mm$B6NCS^3k=-%(2*WE-6zK2@sA<-a()Ufh5{M6rsgj-YZl-&esdaSJ&dwgcR%ZFBW zwgYB4rM{>>@PZ>?s_@W3c^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reV$nfD>Em% zn#D$*&Ukq=j<2peZ|td}1B9b^Kje!KoAqQzB%m|qKc|TS3V~WHzgG&m)4g9(t!*D{ zsc#V}I#Hau_gc>x95YDSGq~V&81E*7p`CfG7J8(}%)a!3XfJDFwXi>uH?pqO!#LhN z#fy5e@Zqb|@?xi4o5UI8bbRT(`$FdDlC8&^>N~c_o-8tYo5SVnSfJ7RJ|!Z{8J}iO zS6t^@M`eMXs8?*5+i+ddcdJLK#QfdDI`&LoAD*DrGY3_i=6I>9MDEN^Trof#a*|7r zwJgWbtKvw2z8sJ?W%|x$DZ#_8oT?w9eA1t#a?MCv7;B*M|qKQ z>Muy&s(MXOn*_&Oq!iS#%tad6@Q+tqAo3~C(O-(irjix=J+U>dbJ}TCeG3mj`CL?V z^%?J^M8i|J^I79;rMcZe|4*`eN^FGBx{55uNbMH|%9o0W^tu#37cHo`(`Ebb8W#Ro ze?ELAn-}9}tGk6cwQ9=9SYGxBi`J&(%&#mjaEXMcdDc7a`PGr|_X)%H_TJI*UF54h zgii!jjv;F4&sG&y0>o%V zbEOo48I@hKOzHjJswbZalGGB?G9twp^(9MaCE8E9JMAn!rb}<^cRB5F`%8NYo8vh} zHttboh0&-Mv-Bosg|eweXXjF6g`&Kt%nC&(+1-VU3DLM^g|hR}fzxqme5|Teo*H}^ zf*8=o2vWV|3u3QB>aBHLkz>@wxx5|B&>eY?q9RTDNp|l(i?+s&ka$&(3}g3>WmX+x zMb<^RUW|9pn)(Gor}y#JgRJ_vDuU2d!t}nr9#w9Qr=s1gDG!QsS(Xa}ERZ-k4m^0^ z9a*4e{quLWQq;Q)N)+AOI=rHyNioUEUv!c~n3hWwNz^M%XQidWQyyeh>(T5(Zm0hT Db^_A} literal 0 HcmV?d00001 diff --git a/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj new file mode 100644 index 00000000000..3061287a6bb --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/XpsCreate/CPP/xpscreate.vcxproj @@ -0,0 +1,131 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {9E46617A-3919-4B6F-94D6-B3873EC9E79C} + TemplateNamespace + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21208.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp new file mode 100644 index 00000000000..1fd1457f99a --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/InteractiveExample.cpp @@ -0,0 +1,125 @@ +//InteractiveExample.cpp file +// +/* + +This sample animates the position of an ellipse when +the user clicks within the main border. If the user +left-clicks, the SnapshotAndReplace HandoffBehavior +is used when applying the animations. If the user +right-clicks, the Compose HandoffBehavior is used +instead. + +*/ + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Navigation; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Animation; +using namespace System::Windows::Shapes; +using namespace System::Windows::Controls; +using namespace System::Windows::Input; + +namespace Microsoft { + namespace Samples { + namespace Animation { + namespace LocalAnimations { + public ref class InteractiveAnimationExample : Page { + private: + TranslateTransform^ interactiveTranslateTransform; + Border^ containerBorder; + Ellipse^ interactiveEllipse; + + public: + InteractiveAnimationExample () + { + WindowTitle = "Interactive Animation Example"; + DockPanel^ myPanel = gcnew DockPanel(); + myPanel->Margin = Thickness(20.0); + + containerBorder = gcnew Border(); + containerBorder->Background = Brushes::White; + containerBorder->BorderBrush = Brushes::Black; + containerBorder->BorderThickness = Thickness(2.0); + containerBorder->VerticalAlignment = System::Windows::VerticalAlignment::Stretch; + + interactiveEllipse = gcnew Ellipse(); + interactiveEllipse->Fill = Brushes::Lime; + interactiveEllipse->Stroke = Brushes::Black; + interactiveEllipse->StrokeThickness = 2.0; + interactiveEllipse->Width = 25; + interactiveEllipse->Height = 25; + interactiveEllipse->HorizontalAlignment = System::Windows::HorizontalAlignment::Left; + interactiveEllipse->VerticalAlignment = System::Windows::VerticalAlignment::Top; + + interactiveTranslateTransform = gcnew TranslateTransform(); + interactiveEllipse->RenderTransform = interactiveTranslateTransform; + + containerBorder->MouseLeftButtonDown += + gcnew MouseButtonEventHandler(this, &Microsoft::Samples::Animation::LocalAnimations::InteractiveAnimationExample::border_mouseLeftButtonDown); + containerBorder->MouseRightButtonDown += + gcnew MouseButtonEventHandler(this, &Microsoft::Samples::Animation::LocalAnimations::InteractiveAnimationExample::border_mouseRightButtonDown); + containerBorder->Child = interactiveEllipse; + + myPanel->Children->Add(containerBorder); + this->Content = myPanel; + }; + + private: + // When the user left-clicks, use the + // SnapshotAndReplace HandoffBehavior when applying the animation. + void border_mouseLeftButtonDown (System::Object^ sender, System::Windows::Input::MouseButtonEventArgs^ e) + { + System::Windows::Point clickPoint = Mouse::GetPosition(containerBorder); + + // Set the target point so the center of the ellipse + // ends up at the clicked point. + Point targetPoint = Point(); + targetPoint.X = clickPoint.X - interactiveEllipse->Width / 2; + targetPoint.Y = clickPoint.Y - interactiveEllipse->Height / 2; + + // Animate to the target point. + DoubleAnimation^ xAnimation = gcnew DoubleAnimation(targetPoint.X, + Duration(TimeSpan::FromSeconds(4))); + interactiveTranslateTransform->BeginAnimation(TranslateTransform::XProperty, xAnimation, HandoffBehavior::SnapshotAndReplace); + + DoubleAnimation^ yAnimation = gcnew DoubleAnimation(targetPoint.Y, + Duration(TimeSpan::FromSeconds(4))); + interactiveTranslateTransform->BeginAnimation(TranslateTransform::YProperty, yAnimation, HandoffBehavior::SnapshotAndReplace); + + // Chage the color of the ellipse. + interactiveEllipse->Fill = Brushes::Lime; + } + + private: + // When the user right-clicks, use the + // Compose HandoffBehavior when applying the animation. + void border_mouseRightButtonDown (System::Object^ sender, System::Windows::Input::MouseButtonEventArgs^ e) + { + // Find the point where the use clicked. + Point clickPoint = Mouse::GetPosition(containerBorder); + + // Set the target point so the center of the ellipse + // ends up at the clicked point. + Point targetPoint = System::Windows::Point(); + targetPoint.X = clickPoint.X - interactiveEllipse->Width / 2; + targetPoint.Y = clickPoint.Y - interactiveEllipse->Height / 2; + + // Animate to the target point. + DoubleAnimation^ xAnimation = gcnew DoubleAnimation(targetPoint.X, + Duration(TimeSpan::FromSeconds(4))); + interactiveTranslateTransform->BeginAnimation(TranslateTransform::XProperty, xAnimation, HandoffBehavior::Compose); + + DoubleAnimation^ yAnimation = gcnew DoubleAnimation(targetPoint.Y, + Duration(TimeSpan::FromSeconds(4))); + + // Change the color of the ellipse. + interactiveTranslateTransform->BeginAnimation(TranslateTransform::YProperty, yAnimation, HandoffBehavior::Compose); + interactiveEllipse->Fill = Brushes::Orange; + } + }; + } + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp new file mode 100644 index 00000000000..7660b657d00 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/LocalAnimationExample.cpp @@ -0,0 +1,72 @@ +//LocalAnimationExample.cpp file +// +/* + + This sample demonstrates how to apply non-storyboard animations to a property. + To animate in markup, you must use storyboards. + +*/ + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Navigation; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Animation; +using namespace System::Windows::Shapes; +using namespace System::Windows::Controls; + + +namespace Microsoft { + namespace Samples { + namespace Animation { + namespace LocalAnimations { + // Create the demonstration. + public ref class LocalAnimationExample : Page { + + public: + LocalAnimationExample () + { + WindowTitle = "Local Animation Example"; + StackPanel^ myStackPanel = gcnew StackPanel(); + myStackPanel->Margin = Thickness(20); + + // Create and set the Button. + Button^ aButton = gcnew Button(); + aButton->Content = "A Button"; + + // Animate the Button's Width. + DoubleAnimation^ myDoubleAnimation = gcnew DoubleAnimation(); + myDoubleAnimation->From = 75; + myDoubleAnimation->To = 300; + myDoubleAnimation->Duration = Duration(TimeSpan::FromSeconds(5)); + myDoubleAnimation->AutoReverse = true; + myDoubleAnimation->RepeatBehavior = RepeatBehavior::Forever; + + // Apply the animation to the button's Width property. + aButton->BeginAnimation(Button::WidthProperty, myDoubleAnimation); + + // Create and animate a Brush to set the button's Background. + SolidColorBrush^ myBrush = gcnew SolidColorBrush(); + myBrush->Color = Colors::Blue; + + ColorAnimation^ myColorAnimation = gcnew ColorAnimation(); + myColorAnimation->From = Colors::Blue; + myColorAnimation->To = Colors::Red; + myColorAnimation->Duration = Duration(TimeSpan::FromMilliseconds(7000)); + myColorAnimation->AutoReverse = true; + myColorAnimation->RepeatBehavior = RepeatBehavior::Forever; + + // Apply the animation to the brush's Color property. + myBrush->BeginAnimation(SolidColorBrush::ColorProperty, myColorAnimation); + aButton->Background = myBrush; + + // Add the Button to the panel. + myStackPanel->Children->Add(aButton); + this->Content = myStackPanel; + }; + }; + } + } + } +} +// diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj new file mode 100644 index 00000000000..ad5eb76eab3 --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/animagionproperty_cpp.vcxproj @@ -0,0 +1,135 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + LocalAnimationsExample + {1006019E-21B6-40FF-915C-EBB1C580417E} + Microsoft.Samples.Animation.LocalAnimations + ManagedCProj + + + + Application + Unicode + Pure + true + + + Application + Unicode + Pure + + + + + + + + + + + + + <_ProjectFileVersion>10.0.21230.0 + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + WIN32;_DEBUG;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + + + Level3 + ProgramDatabase + + + + + true + true + Windows + main + false + + + MachineX86 + + + + + WIN32;NDEBUG;%(PreprocessorDefinitions) + MultiThreadedDLL + + + Level3 + ProgramDatabase + + + + + true + Windows + main + false + + + MachineX86 + + + + + true + true + + + true + true + + + true + true + + + true + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp new file mode 100644 index 00000000000..dae3f92d86b --- /dev/null +++ b/snippets/cpp/VS_Snippets_Wpf/animateproperty/CPP/app.cpp @@ -0,0 +1,99 @@ +//app.cpp file + + +using namespace System; +using namespace System::Windows; +using namespace System::Windows::Navigation; +using namespace System::Windows::Media; +using namespace System::Windows::Media::Animation; +using namespace System::Windows::Shapes; +using namespace System::Windows::Controls; +using namespace System::Windows::Input; + + +namespace Microsoft { + namespace Samples { + namespace Animation { + namespace LocalAnimations { + + // Forward class declaration. + public ref class LocalAnimationExample : Page { + public: + LocalAnimationExample () ; + }; + + // Forward class declaration. + public ref class InteractiveAnimationExample : Page { + public: + InteractiveAnimationExample () ; + private: + TranslateTransform^ interactiveTranslateTransform; + Border^ containerBorder; + Ellipse^ interactiveEllipse; + void border_mouseLeftButtonDown (System::Object^ sender, MouseButtonEventArgs^ e) ; + void border_mouseRightButtonDown (System::Object^ sender, MouseButtonEventArgs^ e) ; + }; + + // SampleViewer class. + public ref class SampleViewer : Window { + public: + SampleViewer (){ + TabControl^ tControl = gcnew TabControl(); + TabItem^ tItem = gcnew TabItem(); + tItem->Header = "Local Animation Example"; + Frame^ contentFrame = gcnew Frame(); + contentFrame->Content = gcnew LocalAnimationExample(); + tItem->Content = contentFrame; + tControl->Items->Add(tItem); + tItem = gcnew System::Windows::Controls::TabItem(); + tItem->Header = "Interactive Animation Example"; + contentFrame = gcnew System::Windows::Controls::Frame(); + contentFrame->Content = gcnew InteractiveAnimationExample(); + tItem->Content = contentFrame; + tControl->Items->Add(tItem); + this->Content = tControl; + this->Title = "Local Animations Example"; + } ; + }; + + // Application class. + public ref class app : Application { + protected: + virtual void OnStartup (System::Windows::StartupEventArgs^ e) override + { + Application::OnStartup(e); + CreateAndShowMainWindow(); + }; + + private: + void CreateAndShowMainWindow () + { + // Create the application's main window. + Window^ sViewer = gcnew SampleViewer(); + MainWindow = sViewer; + sViewer->Show(); + }; + }; + + private ref class EntryClass sealed { + public: + [System::STAThread()] + static void Main () + { + LocalAnimations::app^ app = gcnew LocalAnimations::app(); + app->Run(); + } + ; + }; + + } + } + } +} + +//Entry Point: +[System::STAThreadAttribute()] +void main () +{ + return Microsoft::Samples::Animation::LocalAnimations::EntryClass::Main(); +} From 3a0c7e687e87dddbdca91af3228c7d220ca499f8 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 15:57:50 -0700 Subject: [PATCH 4/8] delete XmlValidatingReader snippets --- .../CPP/source.cpp | 49 ---------- .../CPP/source.cpp | 35 -------- .../CPP/source.cpp | 25 ------ .../CPP/source.cpp | 32 ------- .../CPP/source.cpp | 48 ---------- .../CPP/source.cpp | 51 ----------- .../CPP/source.cpp | 26 ------ .../CPP/source.cpp | 79 ---------------- .../CPP/source.cpp | 53 ----------- .../CPP/source.cpp | 83 ----------------- .../CPP/source.cpp | 72 --------------- .../CPP/source.cpp | 90 ------------------- 12 files changed, 643 deletions(-) delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp deleted file mode 100644 index ff06ae7ba94..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.AttributeCount Example/CPP/source.cpp +++ /dev/null @@ -1,49 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - try - { - - //Create the string to parse. - String^ xmlFrag = " "; - - //Create the XmlNamespaceManager. - NameTable^ nt = gcnew NameTable; - XmlNamespaceManager^ nsmgr = gcnew XmlNamespaceManager( nt ); - - //Create the XmlParserContext. - XmlParserContext^ context = gcnew XmlParserContext( nullptr,nsmgr,nullptr,XmlSpace::None ); - - //Create the XmlValidatingReader . - reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); - - //Read the attributes on the root element. - reader->MoveToContent(); - if ( reader->HasAttributes ) - { - for ( int i = 0; i < reader->AttributeCount; i++ ) - { - reader->MoveToAttribute( i ); - Console::WriteLine( "{0} = {1}", reader->Name, reader->Value ); - - } - reader->MoveToElement(); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp deleted file mode 100644 index a62f1c24651..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.BaseURI Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - XmlTextReader^ txtreader = nullptr; - try - { - - //Create the validating reader. - txtreader = gcnew XmlTextReader( "http://localhost/uri.xml" ); - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - - //Parse the file and display the base URI for each node. - while ( reader->Read() ) - { - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->BaseURI ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp deleted file mode 100644 index 05e5e364a1d..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.GetAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the validating reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "attrs.xml" ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - - //Read the ISBN attribute. - reader->MoveToContent(); - String^ isbn = reader->GetAttribute( "ISBN" ); - Console::WriteLine( "The ISBN value: {0}", isbn ); - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp deleted file mode 100644 index 2ce1e6eba01..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.HasValue Example/CPP/source.cpp +++ /dev/null @@ -1,32 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the validating reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "book1.xml" ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - - //Parse the file and each node and its value. - while ( reader->Read() ) - { - if ( reader->HasValue ) - Console::WriteLine( "({0}) {1}={2}", reader->NodeType, reader->Name, reader->Value ); - else - Console::WriteLine( "({0}) {1}", reader->NodeType, reader->Name ); - } - - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp deleted file mode 100644 index bd57e805816..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.IsEmptyElement Example/CPP/source.cpp +++ /dev/null @@ -1,48 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ txtreader = nullptr; - XmlValidatingReader^ reader = nullptr; - try - { - - //Implement the readers. - txtreader = gcnew XmlTextReader( "elems.xml" ); - reader = gcnew XmlValidatingReader( txtreader ); - - //Parse the XML and display the text content of each of the elements. - while ( reader->Read() ) - { - if ( reader->IsStartElement() ) - { - if ( reader->IsEmptyElement ) - Console::WriteLine( "<{0}/>", reader->Name ); - else - { - Console::Write( "<{0}> ", reader->Name ); - reader->Read(); //Read the start tag. - if ( reader->IsStartElement() ) - - //Handle nested elements. - Console::Write( "\r\n<{0}>", reader->Name ); - Console::WriteLine( reader->ReadString() ); //Read the text content of the element. - } - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp deleted file mode 100644 index 3ce23489cc5..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,51 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - try - { - - //Create the XML fragment to be parsed. - String^ xmlFrag = ""; - - //Create the XmlParserContext. - XmlParserContext^ context; - String^ subset = ""; - context = gcnew XmlParserContext( nullptr,nullptr,"book",nullptr,nullptr,subset,"","",XmlSpace::None ); - - //Create the reader and set it to not expand general entities. - reader = gcnew XmlValidatingReader( xmlFrag,XmlNodeType::Element,context ); - reader->ValidationType = ValidationType::None; - reader->EntityHandling = EntityHandling::ExpandCharEntities; - - //Read the misc attribute. Because EntityHandling is set to - //ExpandCharEntities, the attribute is parsed into multiple text - //and entity reference nodes. - reader->MoveToContent(); - reader->MoveToAttribute( "misc" ); - while ( reader->ReadAttributeValue() ) - { - if ( reader->NodeType == XmlNodeType::EntityReference ) - - //To expand the entity, call ResolveEntity. - Console::WriteLine( "{0} {1}", reader->NodeType, reader->Name ); - else - Console::WriteLine( "{0} {1}", reader->NodeType, reader->Value ); - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp deleted file mode 100644 index cdcfa93664a..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.MoveToFirstAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the validating reader. - XmlTextReader^ txtreader = gcnew XmlTextReader( "attrs.xml" ); - XmlValidatingReader^ reader = gcnew XmlValidatingReader( txtreader ); - - //Read the genre attribute. - reader->MoveToContent(); - reader->MoveToFirstAttribute(); - String^ genre = reader->Value; - Console::WriteLine( "The genre value: {0}", genre ); - - //Close the reader. - reader->Close(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp deleted file mode 100644 index 805e896e1d7..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Name Example/CPP/source.cpp +++ /dev/null @@ -1,79 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlTextReader^ txtreader = nullptr; - XmlValidatingReader^ reader = nullptr; - String^ filename = "items.xml"; - try - { - - //Load the reader with the data file and ignore all white space nodes. - txtreader = gcnew XmlTextReader( filename ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - - //Implement the validating reader over the text reader. - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - - //Parse the file and display each of the nodes. - while ( reader->Read() ) - { - switch ( reader->NodeType ) - { - case XmlNodeType::Element: - Console::Write( "<{0}>", reader->Name ); - break; - - case XmlNodeType::Text: - Console::Write( reader->Value ); - break; - - case XmlNodeType::CDATA: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::ProcessingInstruction: - Console::Write( "", reader->Name, reader->Value ); - break; - - case XmlNodeType::Comment: - Console::Write( "", reader->Value ); - break; - - case XmlNodeType::XmlDeclaration: - Console::Write( "" ); - break; - - case XmlNodeType::Document: - break; - - case XmlNodeType::DocumentType: - Console::Write( "Name, reader->Value ); - break; - - case XmlNodeType::EntityReference: - Console::Write( reader->Name ); - break; - - case XmlNodeType::EndElement: - Console::Write( "", reader->Name ); - break; - } - } - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp deleted file mode 100644 index 233a1ec1a99..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ResolveEntity Example/CPP/source.cpp +++ /dev/null @@ -1,53 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlValidatingReader^ reader = nullptr; - XmlTextReader^ txtreader = nullptr; - try - { - - //Create and load the XmlTextReader with the XML file. - txtreader = gcnew XmlTextReader( "book1.xml" ); - txtreader->WhitespaceHandling = WhitespaceHandling::None; - - //Create the XmlValidatingReader over the XmlTextReader. - //Set the reader to not expand general entities. - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = ValidationType::None; - reader->EntityHandling = EntityHandling::ExpandCharEntities; - reader->MoveToContent(); //Move to the root element. - reader->Read(); //Move to title start tag. - reader->Skip(); //Skip the title element. - - //Read the misc start tag. The reader is now positioned on - //the entity reference node. - reader->ReadStartElement(); - - //Because EntityHandling is set to ExpandCharEntities, you must call - //ResolveEntity to expand the entity. The entity replacement text is - //then parsed and returned as a child node. - Console::WriteLine( "Expand the entity..." ); - reader->ResolveEntity(); - Console::WriteLine( "The entity replacement text is returned as a text node." ); - reader->Read(); - Console::WriteLine( "NodeType: {0} Value: {1}", reader->NodeType, reader->Value ); - Console::WriteLine( "An EndEntity node closes the entity reference scope." ); - reader->Read(); - Console::WriteLine( "NodeType: {0} Name: {1}", reader->NodeType, reader->Name ); - } - finally - { - if ( reader != nullptr ) - reader->Close(); - } - -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp deleted file mode 100644 index 211a6e4604b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp +++ /dev/null @@ -1,83 +0,0 @@ - - -// -#using -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; - -public ref class SchemaCollectionSample -{ -private: - XmlTextReader^ reader; - XmlValidatingReader^ vreader; - Boolean m_success; - -public: - SchemaCollectionSample() - { - reader = nullptr; - vreader = nullptr; - m_success = true; - - //Load the schema collection. - XmlSchemaCollection^ xsc = gcnew XmlSchemaCollection; - String^ schema = "books.xsd"; - String^ schema1 = "schema1.xdr"; - xsc->Add( "urn:bookstore-schema", schema ); //XSD schema - xsc->Add( "urn:newbooks-schema", schema1 ); //XDR schema - String^ doc1 = "booksSchema.xml"; - String^ doc2 = "booksSchemaFail.xml"; - String^ doc3 = "newbooks.xml"; - - //Validate the files using schemas stored in the collection. - Validate( doc1, xsc ); //Should pass. - Validate( doc2, xsc ); //Should fail. - Validate( doc3, xsc ); //Should fail. - } - - -private: - void Validate( String^ filename, XmlSchemaCollection^ xsc ) - { - m_success = true; - Console::WriteLine(); - Console::WriteLine( "Validating XML file {0}...", filename ); - reader = gcnew XmlTextReader( filename ); - - //Create a validating reader. - vreader = gcnew XmlValidatingReader( reader ); - - //Validate using the schemas stored in the schema collection. - vreader->Schemas->Add( xsc ); - - //Set the validation event handler - vreader->ValidationEventHandler += gcnew ValidationEventHandler( this, &SchemaCollectionSample::ValidationCallBack ); - - //Read and validate the XML data. - while ( vreader->Read() ) - {} - - Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful" : "failed") ); - Console::WriteLine(); - - //Close the reader. - vreader->Close(); - } - - void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::Write( "\r\n\tValidation error: {0}", args->Message ); - } - -}; - -int main() -{ - gcnew SchemaCollectionSample; -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp deleted file mode 100644 index bb70d44f9ea..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationEventHandler Example/CPP/source.cpp +++ /dev/null @@ -1,72 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -public ref class Sample -{ -private: - XmlTextReader^ txtreader; - XmlValidatingReader^ reader; - Boolean m_success; - -public: - Sample() - { - txtreader = nullptr; - reader = nullptr; - m_success = true; - - //Validate file against the XSD schema. - //The validation should fail. - Validate( "notValidXSD.xml" ); - } - - -private: - void Validate( String^ filename ) - { - try - { - Console::WriteLine( "Validating XML file {0}", filename ); - txtreader = gcnew XmlTextReader( filename ); - reader = gcnew XmlValidatingReader( txtreader ); - - // Set the validation event handler - reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationEventHandle ); - - // Read XML data - while ( reader->Read() ) - {} - Console::WriteLine( "Validation finished. Validation {0}", (m_success == true ? (String^)"successful" : "failed") ); - } - finally - { - - //Close the reader. - if ( reader != nullptr ) - reader->Close(); - } - - } - - - //Display the validation error. - void ValidationEventHandle( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::WriteLine( "\r\n\tValidation error: {0}", args->Message ); - } - -}; - -int main() -{ - gcnew Sample; -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp deleted file mode 100644 index a803c48b3ad..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.ValidationType Example/CPP/source.cpp +++ /dev/null @@ -1,90 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -using namespace System::Xml::Schema; -public ref class Sample -{ -private: - XmlTextReader^ txtreader; - XmlValidatingReader^ reader; - Boolean m_success; - -public: - Sample() - { - txtreader = nullptr; - reader = nullptr; - m_success = true; - String^ doc1 = "notValid.xml"; - String^ doc2 = "cdDTD.xml"; - String^ doc3 = "book1.xml"; - - //Parse the files and validate when requested. - Validate( doc1, ValidationType::XDR ); //Validation should fail. - Validate( doc2, ValidationType::DTD ); //Validation should fail. - Validate( doc3, ValidationType::None ); //No validation performed. - } - - -private: - void Validate( String^ filename, ValidationType vt ) - { - try - { - - //Implement the readers. Set the ValidationType. - txtreader = gcnew XmlTextReader( filename ); - reader = gcnew XmlValidatingReader( txtreader ); - reader->ValidationType = vt; - - //If the reader is set to validate, set the event handler. - if ( vt == ValidationType::None ) - Console::WriteLine( "\nParsing XML file {0}", filename ); - else - { - Console::WriteLine( "\nValidating XML file {0}", filename ); - m_success = true; - - //Set the validation event handler. - reader->ValidationEventHandler += gcnew ValidationEventHandler( this, &Sample::ValidationCallBack ); - } - - // Read XML data - while ( reader->Read() ) - {} - if ( vt == ValidationType::None ) - Console::WriteLine( "Finished parsing file." ); - else - Console::WriteLine( "Validation finished. Validation {0}", m_success ? (String^)"successful" : "failed" ); - } - finally - { - - //Close the reader. - if ( reader != nullptr ) - reader->Close(); - } - - } - - - //Display the validation errors. - void ValidationCallBack( Object^ /*sender*/, ValidationEventArgs^ args ) - { - m_success = false; - Console::Write( "\r\n\tValidation error: {0}", args->Message ); - } - -}; - -int main() -{ - gcnew Sample; -} - -// From 0aad1820098f086e8fbb0d191777d602866ef869 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 16:01:20 -0700 Subject: [PATCH 5/8] delete XmlDocument snippets --- .../CPP/source.cpp | 28 ---------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 25 --------- .../CPP/source.cpp | 25 --------- .../CPP/source.cpp | 29 ---------- .../CPP/source.cpp | 28 ---------- .../CPP/source.cpp | 26 --------- .../CPP/source.cpp | 25 --------- .../CPP/source.cpp | 35 ------------ .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 23 -------- .../CPP/source.cpp | 29 ---------- .../CPP/source.cpp | 25 --------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 25 --------- .../CPP/source.cpp | 20 ------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 21 ------- .../CPP/source.cpp | 27 --------- .../CPP/source.cpp | 27 --------- .../CPP/source.cpp | 25 --------- .../CPP/source.cpp | 52 ----------------- .../CPP/source.cpp | 26 --------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 29 ---------- .../CPP/source.cpp | 26 --------- .../CPP/source.cpp | 24 -------- .../CPP/source.cpp | 24 -------- .../XmlDocument.cctor/CPP/docload.cpp | 56 ------------------- 31 files changed, 848 deletions(-) delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp delete mode 100644 snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp deleted file mode 100644 index 1f39979cb87..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CloneNode Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a deep clone. The cloned node - //includes the child node. - XmlDocument^ deep = dynamic_cast(doc->CloneNode( true )); - Console::WriteLine( deep->ChildNodes->Count ); - - //Create a shallow clone. The cloned node does not - //include the child node. - XmlDocument^ shallow = dynamic_cast(doc->CloneNode( false )); - Console::WriteLine( "{0}{1}", shallow->Name, shallow->OuterXml ); - Console::WriteLine( shallow->ChildNodes->Count ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp deleted file mode 100644 index e1c7160ac1f..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateAttribute Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an attribute. - XmlAttribute^ attr = doc->CreateAttribute( "publisher" ); - attr->Value = "WorldWide Publishing"; - - //Add the new node to the document. - doc->DocumentElement->SetAttributeNode( attr ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp deleted file mode 100644 index b99d05865e3..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateCDataSection Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a CData section. - XmlCDataSection^ CData; - CData = doc->CreateCDataSection( "All Jane Austen novels 25% off starting 3/23!" ); - - //Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - root->AppendChild( CData ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp deleted file mode 100644 index de2b9a3e426..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateComment Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a comment. - XmlComment^ newComment; - newComment = doc->CreateComment( "Sample XML document" ); - - //Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - doc->InsertBefore( newComment, root ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp deleted file mode 100644 index 43a191e3ad8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentFragment Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "" ); - - //Create a document fragment. - XmlDocumentFragment^ docFrag = doc->CreateDocumentFragment(); - - //Set the contents of the document fragment. - docFrag->InnerXml = "widget"; - - //Add the children of the document fragment to the - //original document. - doc->DocumentElement->AppendChild( docFrag ); - Console::WriteLine( "Display the modified XML..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp deleted file mode 100644 index 9ef82e4bbe0..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateDocumentType Example/CPP/source.cpp +++ /dev/null @@ -1,28 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - - //Create a document type node and - //add it to the document. - XmlDocumentType^ doctype; - doctype = doc->CreateDocumentType( "book", nullptr, nullptr, "" ); - doc->AppendChild( doctype ); - - //Create the root element and - //add it to the document. - doc->AppendChild( doc->CreateElement( "book" ) ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp deleted file mode 100644 index 75a61a9cebf..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new node and add it to the document. - //The text node is the content of the price element. - XmlElement^ elem = doc->CreateElement( "price" ); - XmlText^ text = doc->CreateTextNode( "19.95" ); - doc->DocumentElement->AppendChild( elem ); - doc->DocumentElement->LastChild->AppendChild( text ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp deleted file mode 100644 index 726fefbd045..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateElement2 Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - String^ xmlData = ""; - doc->Load( gcnew StringReader( xmlData ) ); - - // Create a new element and add it to the document. - XmlElement^ elem = doc->CreateElement( "bk", "genre", "urn:samples" ); - elem->InnerText = "fantasy"; - doc->DocumentElement->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp deleted file mode 100644 index 7bf73f8915c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateEntityReference Example/CPP/source.cpp +++ /dev/null @@ -1,35 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>Pride And Prejudice" ); - - //Create an entity reference node. The child count should be 0 - //since the node has not been expanded. - XmlEntityReference^ entityref = doc->CreateEntityReference( "h" ); - Console::WriteLine( entityref->ChildNodes->Count ); - - //After the node has been added to the document, its parent node - //is set and the entity reference node is expanded. It now has a child - //node containing the entity replacement text. - doc->DocumentElement->LastChild->AppendChild( entityref ); - Console::WriteLine( entityref->FirstChild->InnerText ); - - //Create and insert an undefined entity reference node. When the entity - //reference node is expanded, because the entity reference is undefined - //the child is an empty text node. - XmlEntityReference^ entityref2 = doc->CreateEntityReference( "p" ); - doc->DocumentElement->LastChild->AppendChild( entityref2 ); - Console::WriteLine( entityref2->FirstChild->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp deleted file mode 100644 index 8a885ff4f33..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a new node and add it to the document. - XmlNode^ elem = doc->CreateNode( XmlNodeType::Element, "price", nullptr ); - elem->InnerText = "19.95"; - doc->DocumentElement->AppendChild( elem ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp deleted file mode 100644 index e638f3db6fd..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode1 Example/CPP/source.cpp +++ /dev/null @@ -1,23 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Oberon's Legacy 5.95" ); - - // Create a new element node. - XmlNode^ newElem = doc->CreateNode( "element", "pages", "" ); - newElem->InnerText = "290"; - Console::WriteLine( "Add the new element to the document..." ); - XmlElement^ root = doc->DocumentElement; - root->AppendChild( newElem ); - Console::WriteLine( "Display the modified XML document..." ); - Console::WriteLine( doc->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp deleted file mode 100644 index a51f50b4f52..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateNode2 Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( " Oberon's Legacy 5.95" ); - - // Create a new element node. - XmlNode^ newElem; - newElem = doc->CreateNode( XmlNodeType::Element, "g" , "ISBN" , "https://global.ISBN/list" ); - newElem->InnerText = "1-861001-57-5"; - - // Add the new element to the document - XmlElement^ root = doc->DocumentElement; - root->AppendChild( newElem ); - - // Display the modified XML document - Console::WriteLine( doc->OuterXml ); - - // Output: - // Oberon's Legacy5.951-861001-57-5 -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp deleted file mode 100644 index 27a969f9685..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - - // Create a procesing instruction. - XmlProcessingInstruction^ newPI; - String^ PItext = "type='text/xsl' href='book.xsl'"; - newPI = doc->CreateProcessingInstruction( "xml-stylesheet", PItext ); - - // Display the target and data information. - Console::WriteLine( "", newPI->Target, newPI->Data ); - - // Add the processing instruction node to the document. - doc->AppendChild( newPI ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp deleted file mode 100644 index 4817ff6ccf4..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateSignificantWhitespace Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "EvaCorets" ); - Console::WriteLine( "InnerText before..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Add white space. - XmlNode^ currNode = doc->DocumentElement; - XmlSignificantWhitespace^ sigws = doc->CreateSignificantWhitespace( "\t" ); - currNode->InsertAfter( sigws, currNode->FirstChild ); - Console::WriteLine(); - Console::WriteLine( "InnerText after..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp deleted file mode 100644 index 7eeb3da5079..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateWhitespace Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "EvaCorets" ); - Console::WriteLine( "InnerText before..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); - - // Add white space. - XmlNode^ currNode = doc->DocumentElement; - XmlWhitespace^ ws = doc->CreateWhitespace( "\r\n" ); - currNode->InsertAfter( ws, currNode->FirstChild ); - Console::WriteLine(); - Console::WriteLine( "InnerText after..." ); - Console::WriteLine( doc->DocumentElement->InnerText ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp deleted file mode 100644 index af70be8e025..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateXmlDeclaration Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create an XML declaration. - XmlDeclaration^ xmldecl; - xmldecl = doc->CreateXmlDeclaration( "1.0", nullptr, nullptr ); - - //Add the new node to the document. - XmlElement^ root = doc->DocumentElement; - doc->InsertBefore( xmldecl, root ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp deleted file mode 100644 index ee5192065b7..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentElement Example/CPP/source.cpp +++ /dev/null @@ -1,20 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Display the document element. - Console::WriteLine( doc->DocumentElement->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp deleted file mode 100644 index 3240940efc2..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.DocumentType Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - // Display the DocumentType. - Console::WriteLine( doc->DocumentType->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp deleted file mode 100644 index f9842a8ef80..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementById Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "ids.xml" ); - - //Get the first element with an attribute of type ID and value of A111. - //This displays the node . - XmlElement^ elem = doc->GetElementById( "A111" ); - Console::WriteLine( elem->OuterXml ); - - //Get the first element with an attribute of type ID and value of A222. - //This displays the node . - elem = doc->GetElementById( "A222" ); - Console::WriteLine( elem->OuterXml ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp deleted file mode 100644 index 3c1265c6b3c..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.GetElementsByTagName Example/CPP/source.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; - -int main() -{ - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->Load( "books.xml" ); - - //Display all the book titles. - XmlNodeList^ elemList = doc->GetElementsByTagName( "title" ); - for ( int i = 0; i < elemList->Count; i++ ) - { - Console::WriteLine( elemList[ i ]->InnerXml ); - } -} -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp deleted file mode 100644 index df8b7f49438..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Implementation Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#using -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -public ref class Form1: public Form -{ -protected: - DataSet^ dataset; - -public: - void Method() - { -// - XmlDocument^ doc1 = gcnew XmlDocument; - doc1->Load( "books.xml" ); - XmlDocument^ doc2 = doc1->Implementation->CreateDocument(); -// - } -}; diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp deleted file mode 100644 index 2e836430e60..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ImportNode Example/CPP/source.cpp +++ /dev/null @@ -1,27 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create another XmlDocument which holds a list of books. - XmlDocument^ doc2 = gcnew XmlDocument; - doc2->Load( "books.xml" ); - - //Import the last book node from doc2 into the original document. - XmlNode^ newBook = doc->ImportNode( doc2->DocumentElement->LastChild, true ); - doc->DocumentElement->AppendChild( newBook ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp deleted file mode 100644 index 893b4782d72..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.IsReadOnly Example/CPP/source.cpp +++ /dev/null @@ -1,25 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "]>" - "" - "Pride And Prejudice" - "" - "" ); - - //Check if the node is read-only. - if ( doc->DocumentElement->LastChild->FirstChild->IsReadOnly ) - Console::WriteLine( "Entity reference nodes are always read-only" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp deleted file mode 100644 index de9abc8d55b..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Load2 Example/CPP/source.cpp +++ /dev/null @@ -1,52 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - - //Load the document with the last book node. - XmlTextReader^ reader = gcnew XmlTextReader( "books.xml" ); - reader->WhitespaceHandling = WhitespaceHandling::None; - reader->MoveToContent(); - reader->Read(); - reader->Skip(); //Skip the first book. - reader->Skip(); //Skip the second book. - doc->Load( reader ); - doc->Save( Console::Out ); -} - -// -XmlDocument ^XMLDOMProcessing::XMLHelperMethods::LoadDocument(bool generateXML) -{ - - XmlDocument ^doc = gcnew XmlDocument(); - doc->PreserveWhitespace = true; - try - {doc->Load("booksData.xml");} - catch (System::IO::FileNotFoundException ^e1) - { - // If no book is found, generate some XML. - - doc->LoadXml(" \n" + - " \n" + - " \n" + - " Pride And Prejudice \n" + - " 24.95 \n" + - " \n" + - " \n" + - " The Handmaid's Tale \n" + - " 29.95 \n" + - " \n" + - ""); - } - - return doc; -} \ No newline at end of file diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp deleted file mode 100644 index e2a7b610d8e..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.LoadXml Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "wrench" ); - - // Add a price element. - XmlElement^ newElem = doc->CreateElement( "price" ); - newElem->InnerText = "10.95"; - doc->DocumentElement->AppendChild( newElem ); - - // Save the document to a file and auto-indent the output. - XmlTextWriter^ writer = gcnew XmlTextWriter( "data.xml", nullptr ); - writer->Formatting = Formatting::Indented; - doc->Save( writer ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp deleted file mode 100644 index c2c17bfded5..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.PreserveWhitespace Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Load XML data which includes white space, but ignore - //any white space in the file. - XmlDocument^ doc = gcnew XmlDocument; - doc->PreserveWhitespace = false; - doc->Load( "book.xml" ); - - //Save the document as is (no white space). - Console::WriteLine( "Display the modified XML..." ); - doc->PreserveWhitespace = true; - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp deleted file mode 100644 index 5f22526fb55..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.ReadNode Example/CPP/source.cpp +++ /dev/null @@ -1,29 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::IO; -using namespace System::Xml; -int main() -{ - - //Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "Pride And Prejudice" ); - - //Create a reader. - XmlTextReader^ reader = gcnew XmlTextReader( "cd.xml" ); - reader->MoveToContent(); //Move to the cd element node. - - //Create a node representing the cd element node. - XmlNode^ cd = doc->ReadNode( reader ); - - //Insert the new node into the document. - doc->DocumentElement->AppendChild( cd ); - Console::WriteLine( "Display the modified XML..." ); - doc->Save( Console::Out ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp deleted file mode 100644 index 2bfdcba7729..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.Save Example/CPP/source.cpp +++ /dev/null @@ -1,26 +0,0 @@ - - -// -#using - -using namespace System; -using namespace System::Xml; -int main() -{ - - // Create the XmlDocument. - XmlDocument^ doc = gcnew XmlDocument; - doc->LoadXml( "wrench" ); - - // Add a price element. - XmlElement^ newElem = doc->CreateElement( "price" ); - newElem->InnerText = "10.95"; - doc->DocumentElement->AppendChild( newElem ); - - // Save the document to a file. White space is - // preserved (no white space). - doc->PreserveWhitespace = true; - doc->Save( "data.xml" ); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp deleted file mode 100644 index a3dd876f834..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteContentTo Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -// -void WriteXml( XmlDocument^ doc ) -{ - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - doc->WriteContentTo( writer ); - writer->Flush(); - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp b/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp deleted file mode 100644 index 254d4e4b649..00000000000 --- a/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.WriteTo Example/CPP/source.cpp +++ /dev/null @@ -1,24 +0,0 @@ - - -#using -#using -#using -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Xsl; -using namespace System::Data; -using namespace System::Windows::Forms; - -// -void WriteXml( XmlDocument^ doc ) -{ - XmlTextWriter^ writer = gcnew XmlTextWriter( Console::Out ); - writer->Formatting = Formatting::Indented; - doc->WriteTo( writer ); - writer->Flush(); - Console::WriteLine(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp b/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp deleted file mode 100644 index cf02bc534b8..00000000000 --- a/snippets/cpp/VS_Snippets_Data/XmlDocument.cctor/CPP/docload.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -#using - -using namespace System; -using namespace System::Xml; -using namespace System::Xml::Schema; - -ref class XmlDocumentSample -{ -private: - static XmlReader^ reader; - static String^ filename = "bookdtd.xml"; - - // Display the validation error. - static void ValidationCallback(Object^ sender, ValidationEventArgs^ args) - { - Console::WriteLine("Validation error loading: {0}", filename); - Console::WriteLine(args->Message); - } - -public: - static void Main() - { - ValidationEventHandler^ eventHandler = gcnew ValidationEventHandler(XmlDocumentSample::ValidationCallback); - - try - { - // Create the validating reader and specify DTD validation. - XmlReaderSettings^ settings = gcnew XmlReaderSettings(); - settings->DtdProcessing = DtdProcessing::Parse; - settings->ValidationType = ValidationType::DTD; - settings->ValidationEventHandler += eventHandler; - - reader = XmlReader::Create(filename, settings); - - // Pass the validating reader to the XML document. - // Validation fails due to an undefined attribute, but the - // data is still loaded into the document. - XmlDocument^ doc = gcnew XmlDocument(); - doc->Load(reader); - Console::WriteLine(doc->OuterXml); - } - finally - { - if (reader != nullptr) - reader->Close(); - } - } -}; - -int main() -{ - XmlDocumentSample::Main(); - return 0; -} -// \ No newline at end of file From 6e90e4ffd354f48a0934b23a0ec83775a4111f15 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 16:04:37 -0700 Subject: [PATCH 6/8] delete NegotatiateStream snippets --- .../CPP/NclNegoAsyncServer.cpp | 239 ------------------ .../CPP/NclNegoSyncClient.cpp | 107 -------- .../CPP/NclNegoSyncServer.cpp | 73 ------ .../CPP/NclNegoasyncClient.cpp | 128 ---------- 4 files changed, 547 deletions(-) delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp delete mode 100644 snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp deleted file mode 100644 index 6f24d42284f..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoAsyncServer/CPP/NclNegoAsyncServer.cpp +++ /dev/null @@ -1,239 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Authentication; -using namespace System::Security::Principal; -using namespace System::Text; -using namespace System::IO; -using namespace System::Threading; - -// ClientState is the AsyncState object. -private ref class ClientState -{ -private: - AuthenticatedStream^ authStream; - TcpClient^ client; - array^buffer; - StringBuilder^ message; - ManualResetEvent^ waiter; - -internal: - ClientState( AuthenticatedStream^ a, TcpClient^ theClient ) - { - authStream = a; - client = theClient; - message = nullptr; - buffer = gcnew array(2048); - waiter = gcnew ManualResetEvent( false ); - } - -internal: - property TcpClient^ Client - { - TcpClient^ get() - { - return client; - } - } - - property AuthenticatedStream^ AuthStream - { - AuthenticatedStream^ get() - { - return authStream; - } - } - - property array^ Buffer - { - array^ get() - { - return buffer; - } - - } - - property StringBuilder^ Message - { - StringBuilder^ get() - { - if ( message == nullptr ) - message = gcnew StringBuilder; - - return message; - } - - } - - property ManualResetEvent^ Waiter - { - ManualResetEvent^ get() - { - return waiter; - } - - } - -}; - -public ref class AsynchronousAuthenticatingTcpListener -{ -public: - int Main() - { - - // Create an IPv4 TCP/IP socket. - TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 ); - - // Listen for incoming connections. - listener->Start(); - while ( true ) - { - TcpClient^ clientRequest = nullptr; - - // Application blocks while waiting for an incoming connection. - // Type CNTL-C to terminate the server. - clientRequest = listener->AcceptTcpClient(); - Console::WriteLine( L"Client connected." ); - - // A client has connected. - try - { - AuthenticateClient( clientRequest ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - continue; - } - - } - } - - - // - static void AuthenticateClient( TcpClient^ clientRequest ) - { - NetworkStream^ stream = clientRequest->GetStream(); - - // Create the NegotiateStream. - NegotiateStream^ authStream = gcnew NegotiateStream( stream,false ); - - // Save the current client and NegotiateStream instance - // in a ClientState object. - ClientState^ cState = gcnew ClientState( authStream,clientRequest ); - - // Listen for the client authentication request. - authStream->BeginAuthenticateAsServer( gcnew AsyncCallback( EndAuthenticateCallback ), cState ); - - // Wait until the authentication completes. - cState->Waiter->WaitOne(); - cState->Waiter->Reset(); - authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState ); - cState->Waiter->WaitOne(); - - // Finished with the current client. - authStream->Close(); - clientRequest->Close(); - } - - - // - // The following method is invoked by the - // BeginServerAuthenticate callback delegate. - // - static void EndAuthenticateCallback( IAsyncResult^ ar ) - { - - // Get the saved data. - ClientState^ cState = dynamic_cast(ar->AsyncState); - TcpClient^ clientRequest = cState->Client; - NegotiateStream^ authStream = dynamic_cast(cState->AuthStream); - Console::WriteLine( L"Ending authentication." ); - - // Any exceptions that occurred during authentication are - // thrown by the EndServerAuthenticate method. - try - { - - // This call blocks until the authentication is complete. - authStream->EndAuthenticateAsServer( ar ); - } - catch ( AuthenticationException^ e ) - { - Console::WriteLine( e ); - Console::WriteLine( L"Authentication failed - closing connection." ); - cState->Waiter->Set(); - return; - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - Console::WriteLine( L"Closing connection." ); - cState->Waiter->Set(); - return; - } - - - // Display properties of the authenticated client. - IIdentity^ id = authStream->RemoteIdentity; - Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType ); - cState->Waiter->Set(); - } - - - // - // - static void EndReadCallback( IAsyncResult^ ar ) - { - - // Get the saved data. - ClientState^ cState = dynamic_cast(ar->AsyncState); - TcpClient^ clientRequest = cState->Client; - NegotiateStream^ authStream = dynamic_cast(cState->AuthStream); - - // Get the buffer that stores the message sent by the client. - int bytes = -1; - - // Read the client message. - try - { - bytes = authStream->EndRead( ar ); - cState->Message->Append( Encoding::UTF8->GetChars( cState->Buffer, 0, bytes ) ); - if ( bytes != 0 ) - { - authStream->BeginRead( cState->Buffer, 0, cState->Buffer->Length, gcnew AsyncCallback( EndReadCallback ), cState ); - return; - } - } - catch ( Exception^ e ) - { - - // A real application should do something - // useful here, such as logging the failure. - Console::WriteLine( L"Client message exception:" ); - Console::WriteLine( e ); - cState->Waiter->Set(); - return; - } - - IIdentity^ id = authStream->RemoteIdentity; - Console::WriteLine( L"{0} says {1}", id->Name, cState->Message ); - cState->Waiter->Set(); - } - - // -}; - -void main() -{ - AsynchronousAuthenticatingTcpListener^ aatl = gcnew AsynchronousAuthenticatingTcpListener; - aatl->Main(); -} - -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp deleted file mode 100644 index 1a0a913e1d9..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp +++ /dev/null @@ -1,107 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Principal; - -// -static void DisplayStreamProperties( NegotiateStream^ stream ) -{ - Console::WriteLine( L"Can read: {0}", stream->CanRead ); - Console::WriteLine( L"Can write: {0}", stream->CanWrite ); - Console::WriteLine( L"Can seek: {0}", stream->CanSeek ); - try - { - - // If the underlying stream supports it, display the length. - Console::WriteLine( L"Length: {0}", stream->Length ); - } - catch ( NotSupportedException^ ) - { - Console::WriteLine( L"Cannot get the length of the underlying stream." ); - } - - if ( stream->CanTimeout ) - { - Console::WriteLine( L"Read time-out: {0}", stream->ReadTimeout ); - Console::WriteLine( L"Write time-out: {0}", stream->WriteTimeout ); - } -} - - -// -// -static void DisplayAuthenticationProperties( NegotiateStream^ stream ) -{ - Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated ); - Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated ); - Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted ); - Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); - Console::WriteLine( L"ImpersonationLevel: {0}", stream->ImpersonationLevel ); - Console::WriteLine( L"IsServer: {0}", stream->IsServer ); -} - - -// -// -int main() -{ - - // - // Establish the remote endpoint for the socket. - // For this example, use the local machine. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - - // Client and server use port 11000. - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - TcpClient^ client = gcnew TcpClient; - - // Connect the socket to the remote endpoint. - client->Connect( remoteEP ); - Console::WriteLine( L"Client connected to {0}.", remoteEP ); - - // Ensure the client does not close when there is - // still data to be sent to the server. - client->LingerState = (gcnew LingerOption( true,0 )); - - // Request authentication. - NetworkStream^ clientStream = client->GetStream(); - NegotiateStream^ authStream = gcnew NegotiateStream( clientStream ); - - // Request authentication for the client only (no mutual authentication). - // Authenicate using the client's default credetials. - // Permit the server to impersonate the client to access resources on the server only. - // Request that data be transmitted using encryption and data signing. - authStream->AuthenticateAsClient( dynamic_cast(CredentialCache::DefaultCredentials), - L"", - ProtectionLevel::EncryptAndSign, - TokenImpersonationLevel::Impersonation ); - - // - DisplayAuthenticationProperties( authStream ); - DisplayStreamProperties( authStream ); - if ( authStream->CanWrite ) - { - - // Encode the test data into a byte array. - array^message = System::Text::Encoding::UTF8->GetBytes( L"Hello from the client." ); - authStream->Write( message, 0, message->Length ); - authStream->Flush(); - Console::WriteLine( L"Sent {0} bytes.", message->Length ); - } - - - // Close the client connection. - authStream->Close(); - Console::WriteLine( L"Client closed." ); -} - -// -// diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp deleted file mode 100644 index b02ceda8bc7..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncServer/CPP/NclNegoSyncServer.cpp +++ /dev/null @@ -1,73 +0,0 @@ - -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Security::Principal; -using namespace System::Text; -using namespace System::IO; -using namespace System::Threading; - -// -static void AuthenticateClient( TcpClient^ clientRequest ) -{ - NetworkStream^ stream = clientRequest->GetStream(); - - // Create the NegotiateStream. - NegotiateStream^ authStream = gcnew NegotiateStream( stream,false ); - - // Perform the server side of the authentication. - authStream->AuthenticateAsServer(); - - // Display properties of the authenticated client. - IIdentity^ id = authStream->RemoteIdentity; - Console::WriteLine( L"{0} was authenticated using {1}.", id->Name, id->AuthenticationType ); - - // Read a message from the client. - array^buffer = gcnew array(2048); - int charLength = authStream->Read( buffer, 0, buffer->Length ); - String^ messageData = gcnew String( Encoding::UTF8->GetChars( buffer, 0, buffer->Length ) ); - Console::WriteLine( L"READ {0}", messageData ); - - // Finished with the current client. - authStream->Close(); - - // Close the client connection. - clientRequest->Close(); -} - - -// -int main() -{ - - // Create an IPv4 TCP/IP socket. - TcpListener^ listener = gcnew TcpListener( IPAddress::Any,11000 ); - - // Listen for incoming connections. - listener->Start(); - while ( true ) - { - TcpClient^ clientRequest = nullptr; - - // Application blocks while waiting for an incoming connection. - // Type CNTL-C to terminate the server. - clientRequest = listener->AcceptTcpClient(); - - // A client has connected. - try - { - AuthenticateClient( clientRequest ); - } - catch ( Exception^ e ) - { - Console::WriteLine( e ); - continue; - } - - Console::WriteLine( L"Client connected." ); - } -} - diff --git a/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp b/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp deleted file mode 100644 index 8a961ac9aff..00000000000 --- a/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp +++ /dev/null @@ -1,128 +0,0 @@ - -// -#using - -using namespace System; -using namespace System::Net; -using namespace System::Net::Security; -using namespace System::Net::Sockets; -using namespace System::Text; - -// -// The following class displays the properties of an authenticatedStream. -public ref class AuthenticatedStreamReporter -{ -public: - static void DisplayProperties( AuthenticatedStream^ stream ) - { - Console::WriteLine( L"IsAuthenticated: {0}", stream->IsAuthenticated ); - Console::WriteLine( L"IsMutuallyAuthenticated: {0}", stream->IsMutuallyAuthenticated ); - Console::WriteLine( L"IsEncrypted: {0}", stream->IsEncrypted ); - Console::WriteLine( L"IsSigned: {0}", stream->IsSigned ); - Console::WriteLine( L"IsServer: {0}", stream->IsServer ); - } - -}; - - -// -public ref class ASynchronousAuthenticatingTcpClient -{ -private: - static TcpClient^ client = nullptr; - -public: - void Main() - { - - // - // - // Establish the remote endpoint for the socket. - // For this example, use the local machine. - IPHostEntry^ ipHostInfo = Dns::GetHostEntry( Dns::GetHostName() ); - IPAddress^ ipAddress = ipHostInfo->AddressList[ 0 ]; - - // Client and server use port 11000. - IPEndPoint^ remoteEP = gcnew IPEndPoint( ipAddress,11000 ); - - // Create a TCP/IP socket. - client = gcnew TcpClient; - - // Connect the socket to the remote endpoint. - client->Connect( remoteEP ); - Console::WriteLine( L"Client connected to {0}.", remoteEP ); - - // Ensure the client does not close when there is - // still data to be sent to the server. - client->LingerState = (gcnew LingerOption( true,0 )); - - // - // Request authentication. - NetworkStream^ clientStream = client->GetStream(); - NegotiateStream^ authStream = gcnew NegotiateStream( clientStream,false ); - - // - // Pass the NegotiateStream as the AsyncState object - // so that it is available to the callback delegate. - IAsyncResult^ ar = authStream->BeginAuthenticateAsClient( gcnew AsyncCallback( EndAuthenticateCallback ), authStream ); - - // - Console::WriteLine( L"Client waiting for authentication..." ); - - // Wait until the result is available. - ar->AsyncWaitHandle->WaitOne(); - - // Display the properties of the authenticated stream. - AuthenticatedStreamReporter::DisplayProperties( authStream ); - - // Send a message to the server. - // Encode the test data into a byte array. - array^message = Encoding::UTF8->GetBytes( L"Hello from the client." ); - ar = authStream->BeginWrite( message, 0, message->Length, gcnew AsyncCallback( EndWriteCallback ), authStream ); - - // - ar->AsyncWaitHandle->WaitOne(); - Console::WriteLine( L"Sent {0} bytes.", message->Length ); - - // Close the client connection. - authStream->Close(); - Console::WriteLine( L"Client closed." ); - } - - - // - // The following method is called when the authentication completes. - static void EndAuthenticateCallback( IAsyncResult^ ar ) - { - Console::WriteLine( L"Client ending authentication..." ); - NegotiateStream^ authStream = dynamic_cast(ar->AsyncState); - - // End the asynchronous operation. - authStream->EndAuthenticateAsClient( ar ); - - // Console.WriteLine("AllowedImpersonation: {0}", authStream.AllowedImpersonation); - } - - - // - // - // The following method is called when the write operation completes. - static void EndWriteCallback( IAsyncResult^ ar ) - { - Console::WriteLine( L"Client ending write operation..." ); - NegotiateStream^ authStream = dynamic_cast(ar->AsyncState); - - // End the asynchronous operation. - authStream->EndWrite( ar ); - } - - // -}; - -void main() -{ - ASynchronousAuthenticatingTcpClient^ aatc = gcnew ASynchronousAuthenticatingTcpClient; - aatc->Main(); -} -// - From 717b557e8417bd1dbd12217c0bcde28ecf37f79b Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Fri, 23 May 2025 16:06:50 -0700 Subject: [PATCH 7/8] reset WebClient --- xml/System.Net/WebClient.xml | 146 ++++++++++++----------------------- 1 file changed, 50 insertions(+), 96 deletions(-) diff --git a/xml/System.Net/WebClient.xml b/xml/System.Net/WebClient.xml index 839c9f86173..c2c35b06d01 100644 --- a/xml/System.Net/WebClient.xml +++ b/xml/System.Net/WebClient.xml @@ -110,8 +110,7 @@ is set to `true` in instances. ## Examples - -The following code example takes the URI of a resource, retrieves it, and displays the response. + The following code example takes the URI of a resource, retrieves it, and displays the response. [!code-cpp[NCLWebClientUserAgent#1](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientUserAgent/CPP/useragent.cpp#1)] [!code-csharp[NCLWebClientUserAgent#1](~/snippets/csharp/System.Net/WebClient/Overview/useragent.cs#1)] @@ -179,11 +178,11 @@ The following code example takes the URI of a resource, retrieves it, and displa The parameterless constructor creates a new instance of the class. The default HTTP method is GET. The default FTP method is RETR. The default is . The default value of is `true`. ## Examples + The following code example creates a instance and then uses it to download data from a server and display it on the system console, to download data from a server and write it to a file, and to upload form values to a server and receive the response. -The following code example creates a instance and then uses it to download data from a server and display it on the system console, to download data from a server and write it to a file, and to upload form values to a server and receive the response. - -[!code-csharp[WebClient#1](~/snippets/csharp/System.Net/WebClient/.ctor/webclient.cs#1)] -[!code-vb[WebClient#1](~/snippets/visualbasic/VS_Snippets_Remoting/WebClient/VB/webclient.vb#1)] + [!code-cpp[WebClient#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient/CPP/webclient.cpp#1)] + [!code-csharp[WebClient#1](~/snippets/csharp/System.Net/WebClient/.ctor/webclient.cs#1)] + [!code-vb[WebClient#1](~/snippets/visualbasic/VS_Snippets_Remoting/WebClient/VB/webclient.vb#1)] ]]> @@ -364,8 +363,7 @@ The following code example creates a instance and th ## Examples - -The following code example downloads data from an Internet server and displays it on the console. It assumes that the server's address (such as http://www.contoso.com) is in `hostUri` and that the path to the resource (such as /default.htm) is in `uriSuffix`. + The following code example downloads data from an Internet server and displays it on the console. It assumes that the server's address (such as http://www.contoso.com) is in `hostUri` and that the path to the resource (such as /default.htm) is in `uriSuffix`. [!code-cpp[WebClient_BaseAddress_ResponseHeaders#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp#1)] [!code-csharp[WebClient_BaseAddress_ResponseHeaders#1](~/snippets/csharp/System.Net/WebClient/BaseAddress/webclient_baseaddress_responseheaders.cs#1)] @@ -565,8 +563,7 @@ The following code example downloads data from an Internet server and displays i For security reasons, when automatically following redirects, store the credentials that you want to be included in the redirect in a and assign it to this property. This property will automatically be set to `null` upon redirection if it contains anything except a . Having this property value be automatically set to `null` under those conditions prevents credentials from being sent to any unintended destination. ## Examples - -The following code example uses the user's system credentials to authenticate a request. + The following code example uses the user's system credentials to authenticate a request. [!code-cpp[WebClientAuthentication#1](~/snippets/cpp/VS_Snippets_Remoting/WebClientAuthentication/CPP/webclientauth.cpp#1)] [!code-csharp[WebClientAuthentication#1](~/snippets/csharp/System.Net/WebClient/Credentials/webclientauth.cs#1)] @@ -651,8 +648,7 @@ The following code example uses the user's system credentials to authenticate a > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example requests data from a server and displays the data returned. It assumes that `remoteUri` contains a valid URI for the requested data. + The following code example requests data from a server and displays the data returned. It assumes that `remoteUri` contains a valid URI for the requested data. [!code-cpp[WebClient_DownloadData#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadData/CPP/webclient_downloaddata.cpp#1)] [!code-csharp[WebClient_DownloadData#1](~/snippets/csharp/System.Net/WebClient/DownloadData/webclient_downloaddata.cs#1)] @@ -971,8 +967,7 @@ The following code example requests data from a server and displays the data ret ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#21](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#21)] [!code-csharp[NCLWebClientAsync#21](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#21)] @@ -1229,8 +1224,7 @@ The following code example demonstrates setting an event handler for this event. When using this method in a middle tier application, such as an ASP.NET page, you will receive an error if the account under which the application executes does not have permission to access the file. ## Examples - -The following code example downloads a file from http://www.contoso.com to the local hard drive. + The following code example downloads a file from http://www.contoso.com to the local hard drive. [!code-cpp[WebClient_DownloadFile#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_DownloadFile/CPP/webclient_downloadfile.cpp#1)] [!code-csharp[WebClient_DownloadFile#1](~/snippets/csharp/System.Net/WebClient/DownloadFile/webclient_downloadfile.cs#1)] @@ -1592,8 +1586,7 @@ The following code example downloads a file from http://www.contoso.com to the l For more information about how to handle events, see [Handling and Raising Events](/dotnet/standard/events/). ## Examples - -The following code example demonstrates setting an event handler for the `DownloadFileCompleted` event. + The following code example demonstrates setting an event handler for the `DownloadFileCompleted` event. [!code-cpp[NCLWebClientAsync#19](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#19)] [!code-csharp[NCLWebClientAsync#19](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#19)] @@ -1871,8 +1864,7 @@ internal class MyWebClient : WebClientProtocol ``` ## Examples - -The following code example demonstrates setting an event handler for the `DownloadProgressChanged` event. + The following code example demonstrates setting an event handler for the `DownloadProgressChanged` event. [!code-cpp[DownloadProgressChanged](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#SnippetDownloadProgressChanged)] [!code-csharp[DownloadProgressChanged](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#SnippetDownloadProgressChanged)] @@ -1953,8 +1945,7 @@ The following code example demonstrates setting an event handler for the `Downlo > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example demonstrates calling this method. + The following code example demonstrates calling this method. [!code-cpp[NCLWebClientAsync#25](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#25)] [!code-csharp[NCLWebClientAsync#25](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#25)] @@ -2279,8 +2270,7 @@ The following code example demonstrates calling this method. ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#28](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#28)] [!code-csharp[NCLWebClientAsync#28](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#28)] @@ -2522,8 +2512,7 @@ The following code example demonstrates setting an event handler for this event. ## Examples - -The following code example demonstrates setting the value of this property. + The following code example demonstrates setting the value of this property. [!code-cpp[NCLWebClientAsync#1](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#1)] [!code-csharp[NCLWebClientAsync#1](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#1)] @@ -2591,8 +2580,7 @@ The following code example demonstrates setting the value of this property. ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#1](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#1)] [!code-csharp[NCLCustomWebClient#1](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#1)] @@ -2669,8 +2657,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#2](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#2)] [!code-csharp[NCLCustomWebClient#2](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#2)] @@ -2739,8 +2726,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#3](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#3)] [!code-csharp[NCLCustomWebClient#3](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#3)] @@ -2836,8 +2822,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example uses the collection to set the HTTP `Content-Type` header to `application/x-www-form-urlencoded,` to notify the server that form data is attached to the post. + The following code example uses the collection to set the HTTP `Content-Type` header to `application/x-www-form-urlencoded,` to notify the server that form data is attached to the post. [!code-cpp[WebClient_UpLoadData_Headers#2](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp#2)] [!code-csharp[WebClient_UpLoadData_Headers#2](~/snippets/csharp/System.Net/WebClient/Headers/webclient_uploaddata_headers.cs#2)] @@ -2952,8 +2937,7 @@ The following code example uses the colle ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#4](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#4)] [!code-csharp[NCLCustomWebClient#4](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#4)] @@ -3024,8 +3008,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#5](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#5)] [!code-csharp[NCLCustomWebClient#5](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#5)] @@ -3096,8 +3079,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#12](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#12)] [!code-csharp[NCLCustomWebClient#12](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#12)] @@ -3168,8 +3150,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#6](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#6)] [!code-csharp[NCLCustomWebClient#6](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#6)] @@ -3240,8 +3221,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#7](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#7)] [!code-csharp[NCLCustomWebClient#7](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#7)] @@ -3312,8 +3292,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#8](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#8)] [!code-csharp[NCLCustomWebClient#8](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#8)] @@ -3384,8 +3363,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#9](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#9)] [!code-csharp[NCLCustomWebClient#9](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#9)] @@ -3456,8 +3434,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#10](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#10)] [!code-csharp[NCLCustomWebClient#10](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#10)] @@ -3528,8 +3505,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#13](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#13)] [!code-csharp[NCLCustomWebClient#13](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#13)] @@ -3597,8 +3573,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#11](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#11)] [!code-csharp[NCLCustomWebClient#11](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#11)] @@ -3669,8 +3644,7 @@ The following code example shows an implementation of this method that can be cu ## Examples - -The following code example shows an implementation of this method that can be customized by a class derived from . + The following code example shows an implementation of this method that can be customized by a class derived from . [!code-cpp[NCLCustomWebClient#14](~/snippets/cpp/VS_Snippets_Remoting/NCLCustomWebClient/CPP/mywebclient.cpp#14)] [!code-csharp[NCLCustomWebClient#14](~/snippets/csharp/System.Net/WebClient/GetWebRequest/mywebclient.cs#14)] @@ -3810,8 +3784,7 @@ The following code example shows an implementation of this method that can be cu > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example opens the resource identified by `uriString` and displays the results on the system console. The returned by is closed when the data has been read. + The following code example opens the resource identified by `uriString` and displays the results on the system console. The returned by is closed when the data has been read. [!code-cpp[WebClient_OpenRead#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenRead/CPP/webclient_openread.cpp#1)] [!code-csharp[WebClient_OpenRead#1](~/snippets/csharp/System.Net/WebClient/OpenRead/webclient_openread.cs#1)] @@ -4151,8 +4124,7 @@ The following code example opens the resource identified by `uriString` and disp ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#30](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#30)] [!code-csharp[NCLWebClientAsync#30](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#30)] @@ -4424,8 +4396,7 @@ The following code example demonstrates setting an event handler for this event. > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example reads data from the command line and uses to obtain a stream for writing the data. The returned by is closed after the data is sent. + The following code example reads data from the command line and uses to obtain a stream for writing the data. The returned by is closed after the data is sent. [!code-cpp[WebClient_OpenWrite2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite2/CPP/webclient_openwrite2.cpp#1)] [!code-csharp[WebClient_OpenWrite2#1](~/snippets/csharp/System.Net/WebClient/OpenWrite/webclient_openwrite2.cs#1)] @@ -4589,8 +4560,7 @@ The following code example reads data from the command line and uses This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example reads data from the command line and uses to obtain a stream used to write the data. The returned by must be closed to send the data. + The following code example reads data from the command line and uses to obtain a stream used to write the data. The returned by must be closed to send the data. [!code-cpp[WebClient_OpenWrite#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_OpenWrite/CPP/webclient_openwrite.cpp#1)] [!code-csharp[WebClient_OpenWrite#1](~/snippets/csharp/System.Net/WebClient/OpenWrite/webclient_openwrite.cs#1)] @@ -4998,8 +4968,7 @@ The following code example reads data from the command line and uses that is assigned to the property. It then downloads the response from the server to a local file. + The following code example takes user input from the command line and builds a that is assigned to the property. It then downloads the response from the server to a local file. [!code-cpp[WebClient_QueryString#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_QueryString/CPP/webclient_querystring.cpp#1)] [!code-csharp[WebClient_QueryString#1](~/snippets/csharp/System.Net/WebClient/QueryString/webclient_querystring.cs#1)] @@ -5576,8 +5544,7 @@ The following code example takes user input from the command line and builds a < ## Examples - -The following code example downloads and displays the returned by a server. + The following code example downloads and displays the returned by a server. [!code-cpp[WebClient_BaseAddress_ResponseHeaders#2](~/snippets/cpp/VS_Snippets_Remoting/WebClient_BaseAddress_ResponseHeaders/CPP/webclient_baseaddress_responseheaders.cpp#2)] [!code-csharp[WebClient_BaseAddress_ResponseHeaders#2](~/snippets/csharp/System.Net/WebClient/BaseAddress/webclient_baseaddress_responseheaders.cs#2)] @@ -5663,8 +5630,7 @@ The following code example downloads and displays the This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example converts a string entered from the console to a array and posts the array to the specified server using . Any response from the server is displayed to the console. + The following code example converts a string entered from the console to a array and posts the array to the specified server using . Any response from the server is displayed to the console. [!code-cpp[WebClient_UpLoadData2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData2/CPP/webclient_uploaddata2.cpp#1)] [!code-csharp[WebClient_UpLoadData2#1](~/snippets/csharp/System.Net/WebClient/UploadData/webclient_uploaddata2.cs#1)] @@ -5852,8 +5818,7 @@ The following code example converts a string entered from the console to a This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example converts a string entered from the console into a byte array and posts the array to the specified server using . Any response from the server is displayed to the console. + The following code example converts a string entered from the console into a byte array and posts the array to the specified server using . Any response from the server is displayed to the console. [!code-cpp[WebClient_UpLoadData_Headers#2](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadData_Headers/CPP/webclient_uploaddata_headers.cpp#2)] [!code-csharp[WebClient_UpLoadData_Headers#2](~/snippets/csharp/System.Net/WebClient/Headers/webclient_uploaddata_headers.cs#2)] @@ -6320,8 +6285,7 @@ The following code example converts a string entered from the console into a byt ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#36](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#36)] [!code-csharp[NCLWebClientAsync#36](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#36)] @@ -6779,8 +6743,7 @@ The following code example demonstrates setting an event handler for this event. > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. + The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. [!code-cpp[WebClient_UpLoadFile#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile/CPP/webclient_uploadfile.cpp#1)] [!code-csharp[WebClient_UpLoadFile#1](~/snippets/csharp/System.Net/WebClient/UploadFile/webclient_uploadfile.cs#1)] @@ -6987,8 +6950,7 @@ The following code example uploads the specified file to the specified URI using > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. + The following code example uploads the specified file to the specified URI using . Any response returned by the server is displayed on the console. [!code-cpp[WebClient_UpLoadFile2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UpLoadFile2/CPP/webclient_uploadfile2.cpp#1)] [!code-csharp[WebClient_UpLoadFile2#1](~/snippets/csharp/System.Net/WebClient/UploadFile/webclient_uploadfile2.cs#1)] @@ -7514,8 +7476,7 @@ The following code example uploads the specified file to the specified URI using ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#4](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#4)] [!code-csharp[NCLWebClientAsync#4](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#4)] @@ -8010,8 +7971,7 @@ The following code example demonstrates setting an event handler for this event. ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#4](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#4)] [!code-csharp[NCLWebClientAsync#4](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#4)] @@ -8100,8 +8060,7 @@ The following code example demonstrates setting an event handler for this event. > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example demonstrates calling this method. + The following code example demonstrates calling this method. [!code-cpp[NCLWebClientAsync#1](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#1)] [!code-csharp[NCLWebClientAsync#1](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#1)] @@ -8274,8 +8233,7 @@ The following code example demonstrates calling this method. > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example demonstrates calling this method. + The following code example demonstrates calling this method. [!code-cpp[NCLWebClientAsync#2](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#2)] [!code-csharp[NCLWebClientAsync#2](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#2)] @@ -8746,8 +8704,7 @@ The following code example demonstrates calling this method. ## Examples - -The following code example demonstrates setting an event handler for this event. + The following code example demonstrates setting an event handler for this event. [!code-cpp[NCLWebClientAsync#38](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#38)] [!code-csharp[NCLWebClientAsync#38](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#38)] @@ -9211,8 +9168,7 @@ The following code example demonstrates setting an event handler for this event. > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. + The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. [!code-cpp[WebClient_UploadValues#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues/CPP/webclient_uploadvalues.cpp#1)] [!code-csharp[WebClient_UploadValues#1](~/snippets/csharp/System.Net/WebClient/UploadValues/webclient_uploadvalues.cs#1)] @@ -9418,8 +9374,7 @@ The following code example gathers information from the user (name, age, and add > This member outputs trace information when you enable network tracing in your application. For more information, see [Network Tracing in .NET Framework](/dotnet/framework/network-programming/network-tracing). ## Examples - -The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. + The following code example gathers information from the user (name, age, and address) and posts the values to the server using . Any response from the server is displayed on the console. [!code-cpp[WebClient_UploadValues2#1](~/snippets/cpp/VS_Snippets_Remoting/WebClient_UploadValues2/CPP/webclient_uploadvalues2.cpp#1)] [!code-csharp[WebClient_UploadValues2#1](~/snippets/csharp/System.Net/WebClient/UploadValues/webclient_uploadvalues2.cs#1)] @@ -10390,8 +10345,7 @@ The following code example gathers information from the user (name, age, and add ## Examples - -The following code example demonstrates setting this property. + The following code example demonstrates setting this property. [!code-cpp[NCLWebClientAsync#3](~/snippets/cpp/VS_Snippets_Remoting/NCLWebClientAsync/CPP/asyncmethods.cpp#3)] [!code-csharp[NCLWebClientAsync#3](~/snippets/csharp/System.Net/DownloadDataCompletedEventArgs/Overview/asyncmethods.cs#3)] From 04851128cfecef641e46f91a13d5ebf72d97b029 Mon Sep 17 00:00:00 2001 From: Genevieve Warren <24882762+gewarren@users.noreply.github.com> Date: Tue, 27 May 2025 16:17:31 -0700 Subject: [PATCH 8/8] remove other references to deleted snippets --- .../AuthenticatedStream.xml | 18 --------- xml/System.Net.Security/ProtectionLevel.xml | 23 +++++------- xml/System.Xml.Schema/XmlSchemaCollection.xml | 37 +++++++++---------- xml/System.Xml/XmlProcessingInstruction.xml | 2 - 4 files changed, 27 insertions(+), 53 deletions(-) diff --git a/xml/System.Net.Security/AuthenticatedStream.xml b/xml/System.Net.Security/AuthenticatedStream.xml index 66238e3686c..78a5daa35b3 100644 --- a/xml/System.Net.Security/AuthenticatedStream.xml +++ b/xml/System.Net.Security/AuthenticatedStream.xml @@ -59,12 +59,9 @@ The security protocol implemented by a class that derives from together with the security protocols supported on the client and server will determine the security features that are available to an application. The and classes inherit from and implement the Negotiate and Secure Sockets Layer security protocols, respectively. - - ## Examples The following example demonstrates displaying the properties of an authenticated stream. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb" id="Snippet6"::: @@ -336,12 +333,9 @@ The following example demonstrates displaying the properties of an authenticated ## Remarks The methods called to perform authentication are defined in the classes that inherit from . - - ## Examples The following example demonstrates displaying the value of this property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb" id="Snippet6"::: @@ -394,12 +388,9 @@ The following example demonstrates displaying the value of this property. ## Remarks Encryption helps to protect the privacy of the data; namely, it helps to ensure that while data is in transit, it cannot be deciphered by third parties. - - ## Examples The following example demonstrates displaying the value of this property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb" id="Snippet6"::: @@ -452,12 +443,9 @@ The following example demonstrates displaying the value of this property. ## Remarks Not all security protocols support mutual authentication. To determine whether mutual authentication is supported by the security protocol implemented in a class that inherits from , check the class documentation. - - ## Examples The following example demonstrates displaying the value of this property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb" id="Snippet6"::: @@ -510,12 +498,9 @@ The following example demonstrates displaying the value of this property. ## Remarks Most security protocols used for client-server authentication define specific behavior and requirements for supplying credentials for authentication based on whether you are the client or the server. - - ## Examples The following example demonstrates displaying the value of this property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb" id="Snippet6"::: @@ -568,12 +553,9 @@ The following example demonstrates displaying the value of this property. ## Remarks Data signing helps to protect the integrity of the data; namely, it helps the recipient determine whether the data has been tampered with while in transit. - - ## Examples The following example demonstrates displaying the value of this property. -:::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoasyncClient/CPP/NclNegoasyncClient.cpp" id="Snippet6"::: :::code language="csharp" source="~/snippets/csharp/System.Net.Security/AuthenticatedStream/Overview/client.cs" id="Snippet6"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Remoting/NclNegoasyncClient/VB/client.vb" id="Snippet6"::: diff --git a/xml/System.Net.Security/ProtectionLevel.xml b/xml/System.Net.Security/ProtectionLevel.xml index c51aa85cd17..5e4f6d4bb9f 100644 --- a/xml/System.Net.Security/ProtectionLevel.xml +++ b/xml/System.Net.Security/ProtectionLevel.xml @@ -43,19 +43,16 @@

Indicates the security services requested for an authenticated stream. - class. - - - -## Examples - The following code example demonstrates creating and using a client-side . - - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Remoting/NclNegoSyncClient/CPP/NclNegoSyncClient.cpp" id="Snippet0"::: - :::code language="csharp" source="~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs" id="Snippet0"::: - + class. + +## Examples + The following code example demonstrates creating and using a client-side . + + :::code language="csharp" source="~/snippets/csharp/System.Net.Security/NegotiateStream/.ctor/client.cs" id="Snippet0"::: + ]]> diff --git a/xml/System.Xml.Schema/XmlSchemaCollection.xml b/xml/System.Xml.Schema/XmlSchemaCollection.xml index 815e79f23fd..8f412e3fdf1 100644 --- a/xml/System.Xml.Schema/XmlSchemaCollection.xml +++ b/xml/System.Xml.Schema/XmlSchemaCollection.xml @@ -114,7 +114,7 @@ ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -160,7 +160,7 @@ ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -221,7 +221,7 @@ ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -292,7 +292,7 @@ > If the `XmlSchemaCollection` is being accessed using the property, the `Add` method uses the `XmlResolver` specified by the property. > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -354,7 +354,7 @@ > If the `XmlSchemaCollection` is being accessed using the property, the `Add` method uses the `XmlResolver` specified by the property. > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -437,14 +437,11 @@ schemaColl.Add("urn:author", "names.xsd"); > If the `XmlSchemaCollection` is being accessed using the property, the `Add` method uses the `XmlResolver` specified by the property. > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. - - +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ## Examples The following example validates three XML files using schemas stored in the `XmlSchemaCollection`. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Xml/XmlValidatingReader/Schemas/source.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlValidatingReader.Schemas Example/VB/source.vb" id="Snippet1"::: @@ -546,7 +543,7 @@ schemaColl.Add("urn:author", "names.xsd"); > If the `XmlSchemaCollection` is being accessed using the property, the `Add` method uses the `XmlResolver` specified by the property. > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -697,7 +694,7 @@ schemaColl.Add("urn:author", "names.xsd"); If the schema being added contains references to other namespaces (through `include` and `import` elements or the `x-schema` attribute), the schemas for these other namespaces are loaded for validation purposes only. Unlike the original schema, these other schemas are not explicitly added to the schema collection. As a result, they are not accessible using any of the collection methods or properties. > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -721,7 +718,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -777,7 +774,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. @@ -841,7 +838,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -896,7 +893,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -949,7 +946,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -1000,7 +997,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. @@ -1071,7 +1068,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. @@ -1136,7 +1133,7 @@ schemaColl.Add("urn:author", "names.xsd"); ## Remarks > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. ]]> @@ -1445,7 +1442,7 @@ schemaColl.Add("urn:author", "names.xsd"); These events occur when the schemas are added to the collection. If an event handler is not provided, an is thrown on any validation errors where the is `XmlSeverityType.Error`. To specify an event handler, define a callback function and add it to the `ValidationEventHandler`. > [!IMPORTANT] -> The class is obsolete in the .NET Framework version 2.0 and has been replaced by the class. +> The class is obsolete in .NET Framework version 2.0 and has been replaced by the class. diff --git a/xml/System.Xml/XmlProcessingInstruction.xml b/xml/System.Xml/XmlProcessingInstruction.xml index 129f6cf1f23..034f2e87cb1 100644 --- a/xml/System.Xml/XmlProcessingInstruction.xml +++ b/xml/System.Xml/XmlProcessingInstruction.xml @@ -255,7 +255,6 @@ ## Examples The following example creates a processing instruction node and adds it to a document. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Xml/XmlDocument/CreateProcessingInstruction/source.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/VB/source.vb" id="Snippet1"::: @@ -525,7 +524,6 @@ ## Examples The following example creates a processing instruction node and adds it to a document. - :::code language="cpp" source="~/snippets/cpp/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/CPP/source.cpp" id="Snippet1"::: :::code language="csharp" source="~/snippets/csharp/System.Xml/XmlDocument/CreateProcessingInstruction/source.cs" id="Snippet1"::: :::code language="vb" source="~/snippets/visualbasic/VS_Snippets_Data/Classic WebData XmlDocument.CreateProcessingInstruction Example/VB/source.vb" id="Snippet1":::